From: support Date: Wed, 16 Nov 2022 15:48:23 +0000 (+0000) Subject: Built motion from commit 3fa07c60.|2.6.21 X-Git-Url: http://repos.xcallymotion.com/base//%22/%22?a=commitdiff_plain;h=45efea997f886fe28297e28f77a78681a2fa1864;p=motion2.git Built motion from commit 3fa07c60.|2.6.21 --- diff --git a/apidoc/api_project.js b/apidoc/api_project.js index 6c80094..e4790b4 100644 --- a/apidoc/api_project.js +++ b/apidoc/api_project.js @@ -1,6 +1,6 @@ define({ "name": "xCALLY Motion API", - "version": "2.6.22", + "version": "2.6.21", "description": "Thank you for choosing xCALLY MOTION, one of the first Omni Channel solution integrated with AsteriskTM and the most innovative real time solutions available on the market.", "title": "xCALLY MOTION API", "header": { @@ -17,7 +17,7 @@ define({ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2022-11-16T11:08:45.001Z", + "time": "2022-11-16T15:39:57.667Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/apidoc/api_project.json b/apidoc/api_project.json index 985ba28..cea28d5 100644 --- a/apidoc/api_project.json +++ b/apidoc/api_project.json @@ -1,6 +1,6 @@ { "name": "xCALLY Motion API", - "version": "2.6.22", + "version": "2.6.21", "description": "Thank you for choosing xCALLY MOTION, one of the first Omni Channel solution integrated with AsteriskTM and the most innovative real time solutions available on the market.", "title": "xCALLY MOTION API", "header": { @@ -17,7 +17,7 @@ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2022-11-16T11:08:45.001Z", + "time": "2022-11-16T15:39:57.667Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/npm-shrinkwrap.json b/npm-shrinkwrap.json index e40c91e..efe6876 100644 --- a/npm-shrinkwrap.json +++ b/npm-shrinkwrap.json @@ -1,6 +1,6 @@ { "name": "motion", - "version": "2.6.22", + "version": "2.6.21", "dependencies": { "@babel/code-frame": { "version": "7.18.6", diff --git a/package.json b/package.json index 2279703..69f22db 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "motion", - "version": "2.6.22", + "version": "2.6.21", "description": "xCALLY Motion is the new Realtime asynchronous solution for your multichannel contact center over Asterisk.", "main": "server/app.js", "engines": { diff --git a/server/api/action/action.attributes.js b/server/api/action/action.attributes.js index 4687a33..2a6671f 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 _0x9af2=['integration','urlForward','bot','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)]','browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]','sequelize','exports','VIRTUAL','getDataValue','action','STRING'];(function(_0x40fd66,_0x14e0f2){var _0x53e0c1=function(_0x10d1f4){while(--_0x10d1f4){_0x40fd66['push'](_0x40fd66['shift']());}};_0x53e0c1(++_0x14e0f2);}(_0x9af2,0x1c2));var _0x29af=function(_0x4b928b,_0x495842){_0x4b928b=_0x4b928b-0x0;var _0x207219=_0x9af2[_0x4b928b];return _0x207219;};'use strict';var Sequelize=require(_0x29af('0x0'));module[_0x29af('0x1')]={'name':{'type':Sequelize[_0x29af('0x2')],'get':function(_0x31f6fd){return this[_0x29af('0x3')](_0x29af('0x4'));}},'action':{'type':Sequelize[_0x29af('0x5')],'allowNull':![],'validate':{'isIn':{'args':[['contactManager',_0x29af('0x6'),'motionbar','jscripty',_0x29af('0x7'),'browser',_0x29af('0x8'),'script']],'msg':_0x29af('0x9')}},'comment':_0x29af('0x9')},'data1':{'type':Sequelize[_0x29af('0x5')](0x1000),'comment':_0x29af('0xa')},'data2':{'type':Sequelize['STRING'](0x1000),'comment':'contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]'},'data3':{'type':Sequelize[_0x29af('0x5')](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[_0x29af('0x5')](0x1000),'comments':_0x29af('0xb')},'data5':{'type':Sequelize['STRING'](0x1000),'comments':'urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]'},'data6':{'type':Sequelize[_0x29af('0x5')],'comments':'urlForward[headers],\x20browser[wsindowHeight]'},'data7':{'type':Sequelize['TEXT'],'comments':'urlForward[body]'}}; \ No newline at end of file +var _0x4044=['contactManager','integration','motionbar','jscripty','urlForward','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]','contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]','contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]','browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]','urlForward[headers],\x20browser[wsindowHeight]','TEXT','sequelize','exports','VIRTUAL','getDataValue','action','STRING'];(function(_0x1a9708,_0x12a6a8){var _0x2d46aa=function(_0x2c846b){while(--_0x2c846b){_0x1a9708['push'](_0x1a9708['shift']());}};_0x2d46aa(++_0x12a6a8);}(_0x4044,0xcb));var _0x4404=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x4044[_0x502c7d];return _0x30b7ed;};'use strict';var Sequelize=require(_0x4404('0x0'));module[_0x4404('0x1')]={'name':{'type':Sequelize[_0x4404('0x2')],'get':function(_0xb95ec4){return this[_0x4404('0x3')](_0x4404('0x4'));}},'action':{'type':Sequelize[_0x4404('0x5')],'allowNull':![],'validate':{'isIn':{'args':[[_0x4404('0x6'),_0x4404('0x7'),_0x4404('0x8'),_0x4404('0x9'),_0x4404('0xa'),'browser','bot',_0x4404('0xb')]],'msg':_0x4404('0xc')}},'comment':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'},'data1':{'type':Sequelize[_0x4404('0x5')](0x1000),'comment':_0x4404('0xd')},'data2':{'type':Sequelize[_0x4404('0x5')](0x1000),'comment':_0x4404('0xe')},'data3':{'type':Sequelize[_0x4404('0x5')](0x1000),'comment':_0x4404('0xf')},'data4':{'type':Sequelize[_0x4404('0x5')](0x1000),'comments':_0x4404('0x10')},'data5':{'type':Sequelize[_0x4404('0x5')](0x1000),'comments':'urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]'},'data6':{'type':Sequelize[_0x4404('0x5')],'comments':_0x4404('0x11')},'data7':{'type':Sequelize[_0x4404('0x12')],'comments':'urlForward[body]'}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index 58e6dcb..f942d82 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 _0x63da=['Action','params','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','set','reject','save','update','then','destroy','error','stack','name','send','body','find','catch'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x63da,0xba));var _0xa63d=function(_0x8b885,_0x31740b){_0x8b885=_0x8b885-0x0;var _0x122eb8=_0x63da[_0x8b885];return _0x122eb8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa63d('0x0'));var zipdir=require(_0xa63d('0x1'));var jsonpatch=require(_0xa63d('0x2'));var rp=require('request-promise');var moment=require(_0xa63d('0x3'));var BPromise=require(_0xa63d('0x4'));var Mustache=require('mustache');var util=require(_0xa63d('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0xa63d('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa63d('0x7'));var squel=require(_0xa63d('0x8'));var crypto=require(_0xa63d('0x9'));var jsforce=require(_0xa63d('0xa'));var deskjs=require(_0xa63d('0xb'));var toCsv=require(_0xa63d('0x6'));var querystring=require(_0xa63d('0xc'));var Papa=require(_0xa63d('0xd'));var Redis=require(_0xa63d('0xe'));var authService=require(_0xa63d('0xf'));var qs=require(_0xa63d('0x10'));var as=require(_0xa63d('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa63d('0x12'))(_0xa63d('0x13'));var utils=require(_0xa63d('0x14'));var config=require(_0xa63d('0x15'));var licenseUtil=require(_0xa63d('0x16'));var db=require(_0xa63d('0x17'))['db'];function respondWithStatusCode(_0x2a407a,_0x50309b){_0x50309b=_0x50309b||0xcc;return function(_0x5d02ae){if(_0x5d02ae){return _0x2a407a[_0xa63d('0x18')](_0x50309b);}return _0x2a407a[_0xa63d('0x19')](_0x50309b)[_0xa63d('0x1a')]();};}function respondWithResult(_0x698848,_0xa2f5d){_0xa2f5d=_0xa2f5d||0xc8;return function(_0x2289aa){if(_0x2289aa){return _0x698848[_0xa63d('0x19')](_0xa2f5d)[_0xa63d('0x1b')](_0x2289aa);}};}function respondWithFilteredResult(_0x38f8e4,_0x50fa44){return function(_0x3ac1fb){if(_0x3ac1fb){var _0xf24ce9=typeof _0x50fa44['offset']===_0xa63d('0x1c')&&typeof _0x50fa44[_0xa63d('0x1d')]===_0xa63d('0x1c');var _0x225c92=_0x3ac1fb[_0xa63d('0x1e')];var _0x2a40d0=_0xf24ce9?0x0:_0x50fa44['offset'];var _0x44f5a6=_0xf24ce9?_0x3ac1fb[_0xa63d('0x1e')]:_0x50fa44['offset']+_0x50fa44[_0xa63d('0x1d')];var _0x57dbc8;if(_0x44f5a6>=_0x225c92){_0x44f5a6=_0x225c92;_0x57dbc8=0xc8;}else{_0x57dbc8=0xce;}_0x38f8e4[_0xa63d('0x19')](_0x57dbc8);return _0x38f8e4[_0xa63d('0x1f')]('Content-Range',_0x2a40d0+'-'+_0x44f5a6+'/'+_0x225c92)[_0xa63d('0x1b')](_0x3ac1fb);}return null;};}function patchUpdates(_0x38c50b){return function(_0x383c66){try{jsonpatch['apply'](_0x383c66,_0x38c50b,!![]);}catch(_0x1e76dd){return BPromise[_0xa63d('0x20')](_0x1e76dd);}return _0x383c66[_0xa63d('0x21')]();};}function saveUpdates(_0x523c3d,_0x4781fa){return function(_0x2cc7ec){if(_0x2cc7ec){return _0x2cc7ec[_0xa63d('0x22')](_0x523c3d)[_0xa63d('0x23')](function(_0x39a977){return _0x39a977;});}return null;};}function removeEntity(_0x2f6809,_0x69f9e7){return function(_0x386ca8){if(_0x386ca8){return _0x386ca8[_0xa63d('0x24')]()[_0xa63d('0x23')](function(){_0x2f6809[_0xa63d('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x7ebc2f,_0x3f62d9){return function(_0x141906){if(!_0x141906){_0x7ebc2f['sendStatus'](0x194);}return _0x141906;};}function handleError(_0x3ca914,_0x28e092){_0x28e092=_0x28e092||0x1f4;return function(_0xdb4255){logger[_0xa63d('0x25')](_0xdb4255[_0xa63d('0x26')]);if(_0xdb4255[_0xa63d('0x27')]){delete _0xdb4255[_0xa63d('0x27')];}_0x3ca914[_0xa63d('0x19')](_0x28e092)[_0xa63d('0x28')](_0xdb4255);};}exports['update']=function(_0x5b22d9,_0x33cb2c){if(_0x5b22d9[_0xa63d('0x29')]['id']){delete _0x5b22d9[_0xa63d('0x29')]['id'];}return db['Action'][_0xa63d('0x2a')]({'where':{'id':_0x5b22d9['params']['id']}})[_0xa63d('0x23')](handleEntityNotFound(_0x33cb2c,null))[_0xa63d('0x23')](saveUpdates(_0x5b22d9[_0xa63d('0x29')],null))[_0xa63d('0x23')](respondWithResult(_0x33cb2c,null))[_0xa63d('0x2b')](handleError(_0x33cb2c,null));};exports[_0xa63d('0x24')]=function(_0x108e92,_0x1b4cbb){return db[_0xa63d('0x2c')][_0xa63d('0x2a')]({'where':{'id':_0x108e92[_0xa63d('0x2d')]['id']}})[_0xa63d('0x23')](handleEntityNotFound(_0x1b4cbb,null))[_0xa63d('0x23')](removeEntity(_0x1b4cbb,null))[_0xa63d('0x2b')](handleError(_0x1b4cbb,null));}; \ No newline at end of file +var _0x4103=['update','destroy','error','stack','name','body','Action','find','params','then','catch','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','reject','save'];(function(_0x3e36b8,_0x1ff2f0){var _0x594fd2=function(_0x370e11){while(--_0x370e11){_0x3e36b8['push'](_0x3e36b8['shift']());}};_0x594fd2(++_0x1ff2f0);}(_0x4103,0xd3));var _0x3410=function(_0x2a90f4,_0x3d46e7){_0x2a90f4=_0x2a90f4-0x0;var _0x4da9bc=_0x4103[_0x2a90f4];return _0x4da9bc;};'use strict';var emlformat=require(_0x3410('0x0'));var rimraf=require(_0x3410('0x1'));var zipdir=require(_0x3410('0x2'));var jsonpatch=require(_0x3410('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x3410('0x4'));var Mustache=require('mustache');var util=require(_0x3410('0x5'));var path=require(_0x3410('0x6'));var sox=require(_0x3410('0x7'));var csv=require(_0x3410('0x8'));var ejs=require(_0x3410('0x9'));var fs=require('fs');var fs_extra=require(_0x3410('0xa'));var _=require(_0x3410('0xb'));var squel=require(_0x3410('0xc'));var crypto=require(_0x3410('0xd'));var jsforce=require(_0x3410('0xe'));var deskjs=require(_0x3410('0xf'));var toCsv=require(_0x3410('0x8'));var querystring=require(_0x3410('0x10'));var Papa=require(_0x3410('0x11'));var Redis=require(_0x3410('0x12'));var authService=require(_0x3410('0x13'));var qs=require(_0x3410('0x14'));var as=require(_0x3410('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3410('0x16'))(_0x3410('0x17'));var utils=require(_0x3410('0x18'));var config=require(_0x3410('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x3410('0x1a'))['db'];function respondWithStatusCode(_0x4a820d,_0x38e4df){_0x38e4df=_0x38e4df||0xcc;return function(_0x5e2dfa){if(_0x5e2dfa){return _0x4a820d[_0x3410('0x1b')](_0x38e4df);}return _0x4a820d[_0x3410('0x1c')](_0x38e4df)[_0x3410('0x1d')]();};}function respondWithResult(_0x7da02b,_0x37db61){_0x37db61=_0x37db61||0xc8;return function(_0x162423){if(_0x162423){return _0x7da02b[_0x3410('0x1c')](_0x37db61)['json'](_0x162423);}};}function respondWithFilteredResult(_0x2e5582,_0x511c02){return function(_0x27794d){if(_0x27794d){var _0x1536c4=typeof _0x511c02[_0x3410('0x1e')]===_0x3410('0x1f')&&typeof _0x511c02['limit']===_0x3410('0x1f');var _0x3af1e6=_0x27794d[_0x3410('0x20')];var _0x2c2ce9=_0x1536c4?0x0:_0x511c02[_0x3410('0x1e')];var _0x48bfa9=_0x1536c4?_0x27794d['count']:_0x511c02['offset']+_0x511c02[_0x3410('0x21')];var _0x7f9dfc;if(_0x48bfa9>=_0x3af1e6){_0x48bfa9=_0x3af1e6;_0x7f9dfc=0xc8;}else{_0x7f9dfc=0xce;}_0x2e5582['status'](_0x7f9dfc);return _0x2e5582[_0x3410('0x22')](_0x3410('0x23'),_0x2c2ce9+'-'+_0x48bfa9+'/'+_0x3af1e6)[_0x3410('0x24')](_0x27794d);}return null;};}function patchUpdates(_0x8edcc9){return function(_0x139eb1){try{jsonpatch['apply'](_0x139eb1,_0x8edcc9,!![]);}catch(_0x9985a2){return BPromise[_0x3410('0x25')](_0x9985a2);}return _0x139eb1[_0x3410('0x26')]();};}function saveUpdates(_0x1d9664,_0x3d02ac){return function(_0x2744fc){if(_0x2744fc){return _0x2744fc[_0x3410('0x27')](_0x1d9664)['then'](function(_0x170132){return _0x170132;});}return null;};}function removeEntity(_0x35d14d,_0x297c57){return function(_0x577651){if(_0x577651){return _0x577651[_0x3410('0x28')]()['then'](function(){_0x35d14d[_0x3410('0x1c')](0xcc)[_0x3410('0x1d')]();});}};}function handleEntityNotFound(_0x5168e8,_0x1849f3){return function(_0x4c69b9){if(!_0x4c69b9){_0x5168e8[_0x3410('0x1b')](0x194);}return _0x4c69b9;};}function handleError(_0x3cbf7e,_0x1d18c3){_0x1d18c3=_0x1d18c3||0x1f4;return function(_0x32e00a){logger[_0x3410('0x29')](_0x32e00a[_0x3410('0x2a')]);if(_0x32e00a[_0x3410('0x2b')]){delete _0x32e00a[_0x3410('0x2b')];}_0x3cbf7e[_0x3410('0x1c')](_0x1d18c3)['send'](_0x32e00a);};}exports[_0x3410('0x27')]=function(_0x584b7d,_0x48a2f0){if(_0x584b7d['body']['id']){delete _0x584b7d[_0x3410('0x2c')]['id'];}return db[_0x3410('0x2d')][_0x3410('0x2e')]({'where':{'id':_0x584b7d[_0x3410('0x2f')]['id']}})[_0x3410('0x30')](handleEntityNotFound(_0x48a2f0,null))['then'](saveUpdates(_0x584b7d[_0x3410('0x2c')],null))[_0x3410('0x30')](respondWithResult(_0x48a2f0,null))[_0x3410('0x31')](handleError(_0x48a2f0,null));};exports[_0x3410('0x28')]=function(_0x3e30c0,_0x2be857){return db[_0x3410('0x2d')]['find']({'where':{'id':_0x3e30c0['params']['id']}})[_0x3410('0x30')](handleEntityNotFound(_0x2be857,null))[_0x3410('0x30')](removeEntity(_0x2be857,null))[_0x3410('0x31')](handleError(_0x2be857,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index 4b8ac6d..df33f28 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 _0xb368=['moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','Action','lodash','util','../../config/logger','api'];(function(_0xcf5436,_0x4632c3){var _0xc4f5c8=function(_0x567528){while(--_0x567528){_0xcf5436['push'](_0xcf5436['shift']());}};_0xc4f5c8(++_0x4632c3);}(_0xb368,0x68));var _0x8b36=function(_0xa1ffb0,_0x501e4a){_0xa1ffb0=_0xa1ffb0-0x0;var _0x3372e7=_0xb368[_0xa1ffb0];return _0x3372e7;};'use strict';var _=require(_0x8b36('0x0'));var util=require(_0x8b36('0x1'));var logger=require(_0x8b36('0x2'))(_0x8b36('0x3'));var moment=require(_0x8b36('0x4'));var BPromise=require(_0x8b36('0x5'));var rp=require(_0x8b36('0x6'));var fs=require('fs');var path=require(_0x8b36('0x7'));var rimraf=require(_0x8b36('0x8'));var config=require(_0x8b36('0x9'));var attributes=require('./action.attributes');module[_0x8b36('0xa')]=function(_0x2ce0fc,_0x48a8a4){return _0x2ce0fc['define'](_0x8b36('0xb'),attributes,{'tableName':'tools_actions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa013=['util','api','moment','bluebird','request-promise','path','./action.attributes','exports','Action','tools_actions'];(function(_0x22a8c4,_0x51c09a){var _0x104c6d=function(_0x4d4d3d){while(--_0x4d4d3d){_0x22a8c4['push'](_0x22a8c4['shift']());}};_0x104c6d(++_0x51c09a);}(_0xa013,0x1ea));var _0x3a01=function(_0x547add,_0x387042){_0x547add=_0x547add-0x0;var _0x2ed1f3=_0xa013[_0x547add];return _0x2ed1f3;};'use strict';var _=require('lodash');var util=require(_0x3a01('0x0'));var logger=require('../../config/logger')(_0x3a01('0x1'));var moment=require(_0x3a01('0x2'));var BPromise=require(_0x3a01('0x3'));var rp=require(_0x3a01('0x4'));var fs=require('fs');var path=require(_0x3a01('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x3a01('0x6'));module[_0x3a01('0x7')]=function(_0x27ee4f,_0x3b5fef){return _0x27ee4f['define'](_0x3a01('0x8'),attributes,{'tableName':_0x3a01('0x9'),'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 fe4e0e8..66799dd 100644 --- a/server/api/action/action.rpc.js +++ b/server/api/action/action.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x326f=['info','Action,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x12b253,_0x2153bc){var _0xd04dac=function(_0x20b8a8){while(--_0x20b8a8){_0x12b253['push'](_0x12b253['shift']());}};_0xd04dac(++_0x2153bc);}(_0x326f,0xd1));var _0xf326=function(_0x16cb6c,_0x5fb2cc){_0x16cb6c=_0x16cb6c-0x0;var _0x1f8a57=_0x326f[_0x16cb6c];return _0x1f8a57;};'use strict';var _=require(_0xf326('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xf326('0x1'));var rs=require(_0xf326('0x2'));var fs=require('fs');var Redis=require(_0xf326('0x3'));var db=require(_0xf326('0x4'))['db'];var utils=require(_0xf326('0x5'));var logger=require(_0xf326('0x6'))(_0xf326('0x7'));var config=require(_0xf326('0x8'));var jayson=require(_0xf326('0x9'));var client=jayson[_0xf326('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3c254d,_0x3851eb,_0x165f95){return new BPromise(function(_0x1e7b8a,_0x515bfa){return client['request'](_0x3c254d,_0x165f95)['then'](function(_0x3bacf2){logger[_0xf326('0xb')](_0xf326('0xc'),_0x3851eb,_0xf326('0xd'));logger[_0xf326('0xe')]('Action,\x20%s,\x20%s,\x20%s',_0x3851eb,_0xf326('0xd'),JSON['stringify'](_0x3bacf2));if(_0x3bacf2[_0xf326('0xf')]){if(_0x3bacf2['error'][_0xf326('0x10')]===0x1f4){logger['error'](_0xf326('0xc'),_0x3851eb,_0x3bacf2[_0xf326('0xf')]['message']);return _0x515bfa(_0x3bacf2[_0xf326('0xf')][_0xf326('0x11')]);}logger[_0xf326('0xf')](_0xf326('0xc'),_0x3851eb,_0x3bacf2['error'][_0xf326('0x11')]);return _0x1e7b8a(_0x3bacf2['error']['message']);}else{logger[_0xf326('0xb')](_0xf326('0xc'),_0x3851eb,_0xf326('0xd'));_0x1e7b8a(_0x3bacf2[_0xf326('0x12')][_0xf326('0x11')]);}})[_0xf326('0x13')](function(_0x34128e){logger[_0xf326('0xf')]('Action,\x20%s,\x20%s',_0x3851eb,_0x34128e);_0x515bfa(_0x34128e);});});} \ No newline at end of file +var _0x53ec=['error','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','client','request','then','info','Action,\x20%s,\x20%s','request\x20sent','debug','stringify','code'];(function(_0x432fca,_0xb0b1b5){var _0x3adba4=function(_0x5e3ae4){while(--_0x5e3ae4){_0x432fca['push'](_0x432fca['shift']());}};_0x3adba4(++_0xb0b1b5);}(_0x53ec,0x192));var _0xc53e=function(_0x3657d9,_0x3de284){_0x3657d9=_0x3657d9-0x0;var _0x4e5b18=_0x53ec[_0x3657d9];return _0x4e5b18;};'use strict';var _=require(_0xc53e('0x0'));var util=require(_0xc53e('0x1'));var moment=require(_0xc53e('0x2'));var BPromise=require(_0xc53e('0x3'));var rs=require(_0xc53e('0x4'));var fs=require('fs');var Redis=require(_0xc53e('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xc53e('0x6'));var logger=require('../../config/logger')(_0xc53e('0x7'));var config=require(_0xc53e('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xc53e('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x41a9e8,_0x2de88b,_0x5d3b28){return new BPromise(function(_0x1616ac,_0x1ac6c0){return client[_0xc53e('0xa')](_0x41a9e8,_0x5d3b28)[_0xc53e('0xb')](function(_0xd9612){logger[_0xc53e('0xc')](_0xc53e('0xd'),_0x2de88b,_0xc53e('0xe'));logger[_0xc53e('0xf')]('Action,\x20%s,\x20%s,\x20%s',_0x2de88b,'request\x20sent',JSON[_0xc53e('0x10')](_0xd9612));if(_0xd9612['error']){if(_0xd9612['error'][_0xc53e('0x11')]===0x1f4){logger[_0xc53e('0x12')](_0xc53e('0xd'),_0x2de88b,_0xd9612[_0xc53e('0x12')]['message']);return _0x1ac6c0(_0xd9612['error'][_0xc53e('0x13')]);}logger[_0xc53e('0x12')](_0xc53e('0xd'),_0x2de88b,_0xd9612[_0xc53e('0x12')][_0xc53e('0x13')]);return _0x1616ac(_0xd9612[_0xc53e('0x12')][_0xc53e('0x13')]);}else{logger[_0xc53e('0xc')](_0xc53e('0xd'),_0x2de88b,_0xc53e('0xe'));_0x1616ac(_0xd9612['result'][_0xc53e('0x13')]);}})[_0xc53e('0x14')](function(_0x535cd4){logger[_0xc53e('0x12')](_0xc53e('0xd'),_0x2de88b,_0x535cd4);_0x1ac6c0(_0x535cd4);});});} \ No newline at end of file diff --git a/server/api/action/index.js b/server/api/action/index.js index 7356027..34e1789 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 _0xedc5=['../../components/auth/service','../../components/interaction/service','../../config/environment','./action.controller','isAuthenticated','update','delete','/:id','destroy','multer','util','express','Router'];(function(_0x3035a5,_0x6a1b0b){var _0x396e01=function(_0x505f0d){while(--_0x505f0d){_0x3035a5['push'](_0x3035a5['shift']());}};_0x396e01(++_0x6a1b0b);}(_0xedc5,0x1dd));var _0x5edc=function(_0xcdf809,_0x2881f0){_0xcdf809=_0xcdf809-0x0;var _0x4d4d70=_0xedc5[_0xcdf809];return _0x4d4d70;};'use strict';var multer=require(_0x5edc('0x0'));var util=require(_0x5edc('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x5edc('0x2'));var router=express[_0x5edc('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x5edc('0x4'));var interaction=require(_0x5edc('0x5'));var config=require(_0x5edc('0x6'));var controller=require(_0x5edc('0x7'));router['put']('/:id',auth[_0x5edc('0x8')](),controller[_0x5edc('0x9')]);router[_0x5edc('0xa')](_0x5edc('0xb'),auth[_0x5edc('0x8')](),controller[_0x5edc('0xc')]);module['exports']=router; \ No newline at end of file +var _0xa1b0=['destroy','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./action.controller','put','update','delete','isAuthenticated'];(function(_0x199b91,_0x3f6f72){var _0x4cffea=function(_0x352d7e){while(--_0x352d7e){_0x199b91['push'](_0x199b91['shift']());}};_0x4cffea(++_0x3f6f72);}(_0xa1b0,0x169));var _0x0a1b=function(_0x2edb72,_0x2264e2){_0x2edb72=_0x2edb72-0x0;var _0x79fb87=_0xa1b0[_0x2edb72];return _0x79fb87;};'use strict';var multer=require(_0x0a1b('0x0'));var util=require('util');var path=require(_0x0a1b('0x1'));var timeout=require(_0x0a1b('0x2'));var express=require(_0x0a1b('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x0a1b('0x4'));var interaction=require(_0x0a1b('0x5'));var config=require('../../config/environment');var controller=require(_0x0a1b('0x6'));router[_0x0a1b('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x0a1b('0x8')]);router[_0x0a1b('0x9')]('/:id',auth[_0x0a1b('0xa')](),controller[_0x0a1b('0xb')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.attributes.js b/server/api/analyticCustomReport/analyticCustomReport.attributes.js index 2c2ce2d..7c48e4e 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 _0x7dfd=['STRING','TEXT','sequelize','exports'];(function(_0x195c91,_0x26f6ba){var _0x30e2e0=function(_0x1b3017){while(--_0x1b3017){_0x195c91['push'](_0x195c91['shift']());}};_0x30e2e0(++_0x26f6ba);}(_0x7dfd,0x1c2));var _0xd7df=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7dfd[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xd7df('0x0'));module[_0xd7df('0x1')]={'name':{'type':Sequelize[_0xd7df('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xd7df('0x2')]},'parent':{'type':Sequelize[_0xd7df('0x2')]},'table':{'type':Sequelize[_0xd7df('0x2')]},'conditions':{'type':Sequelize[_0xd7df('0x3')]},'joins':{'type':Sequelize[_0xd7df('0x3')]}}; \ No newline at end of file +var _0x5fc3=['sequelize','exports','STRING','TEXT'];(function(_0x134cb7,_0x4ed24e){var _0x5d81e2=function(_0x788943){while(--_0x788943){_0x134cb7['push'](_0x134cb7['shift']());}};_0x5d81e2(++_0x4ed24e);}(_0x5fc3,0xa8));var _0x35fc=function(_0x5608a3,_0x5b33c5){_0x5608a3=_0x5608a3-0x0;var _0x1ed50a=_0x5fc3[_0x5608a3];return _0x1ed50a;};'use strict';var Sequelize=require(_0x35fc('0x0'));module[_0x35fc('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x35fc('0x2')]},'parent':{'type':Sequelize[_0x35fc('0x2')]},'table':{'type':Sequelize[_0x35fc('0x2')]},'conditions':{'type':Sequelize[_0x35fc('0x3')]},'joins':{'type':Sequelize[_0x35fc('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index 03efcb7..9f2cca0 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 _0x8946=['dbH','sendStatus','status','end','json','offset','limit','undefined','count','set','apply','reject','save','update','then','destroy','get','CustomReports','UserProfileResource','error','stack','name','send','index','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','options','AnalyticCustomReport','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','preview','join','left_join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','group','field','condition','getFields','Please\x20insert\x20at\x20least\x20one\x20field','keyBy','select','from','table','MetricId','metric','replace','format','groupBy','orderBy','order','DESC','alias','joins','parse','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','parentKey','conditions','debug','sequelize','toString','QueryTypes','SELECT','UNIX_TIMESTAMP(%s)','operator','value','Sequelize','ValidationErrorItem','function','clone','output','web','%s-%s.%s','randomstring','generate','csv','custom','cdr','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','startDate','Run\x20Query:','child_process','fork','savename','run','right_join','AnalyticMetric','Limited\x20Query:','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb'];(function(_0x62f666,_0x2279b7){var _0x4827d8=function(_0x406a73){while(--_0x406a73){_0x62f666['push'](_0x62f666['shift']());}};_0x4827d8(++_0x2279b7);}(_0x8946,0x130));var _0x6894=function(_0x2faddb,_0xc18b78){_0x2faddb=_0x2faddb-0x0;var _0x273c05=_0x8946[_0x2faddb];return _0x273c05;};'use strict';var emlformat=require(_0x6894('0x0'));var rimraf=require(_0x6894('0x1'));var zipdir=require(_0x6894('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6894('0x3'));var moment=require(_0x6894('0x4'));var BPromise=require(_0x6894('0x5'));var Mustache=require(_0x6894('0x6'));var util=require(_0x6894('0x7'));var path=require(_0x6894('0x8'));var sox=require(_0x6894('0x9'));var csv=require(_0x6894('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x6894('0xa'));var querystring=require('querystring');var Papa=require(_0x6894('0xb'));var Redis=require(_0x6894('0xc'));var authService=require(_0x6894('0xd'));var qs=require(_0x6894('0xe'));var as=require(_0x6894('0xf'));var hardwareService=require(_0x6894('0x10'));var logger=require(_0x6894('0x11'))(_0x6894('0x12'));var utils=require(_0x6894('0x13'));var config=require(_0x6894('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x6894('0x15'))['db'];var dbH=require(_0x6894('0x15'))[_0x6894('0x16')];function respondWithStatusCode(_0x486d81,_0x47eaff){_0x47eaff=_0x47eaff||0xcc;return function(_0x22b531){if(_0x22b531){return _0x486d81[_0x6894('0x17')](_0x47eaff);}return _0x486d81[_0x6894('0x18')](_0x47eaff)[_0x6894('0x19')]();};}function respondWithResult(_0x5be040,_0x1391a3){_0x1391a3=_0x1391a3||0xc8;return function(_0x1d78a9){if(_0x1d78a9){return _0x5be040[_0x6894('0x18')](_0x1391a3)[_0x6894('0x1a')](_0x1d78a9);}};}function respondWithFilteredResult(_0x3aec8f,_0x45b9b7){return function(_0xf8f5ee){if(_0xf8f5ee){var _0x482475=typeof _0x45b9b7[_0x6894('0x1b')]==='undefined'&&typeof _0x45b9b7[_0x6894('0x1c')]===_0x6894('0x1d');var _0x53e9f2=_0xf8f5ee['count'];var _0x1960e6=_0x482475?0x0:_0x45b9b7[_0x6894('0x1b')];var _0x3b1ecf=_0x482475?_0xf8f5ee[_0x6894('0x1e')]:_0x45b9b7[_0x6894('0x1b')]+_0x45b9b7[_0x6894('0x1c')];var _0x242448;if(_0x3b1ecf>=_0x53e9f2){_0x3b1ecf=_0x53e9f2;_0x242448=0xc8;}else{_0x242448=0xce;}_0x3aec8f[_0x6894('0x18')](_0x242448);return _0x3aec8f[_0x6894('0x1f')]('Content-Range',_0x1960e6+'-'+_0x3b1ecf+'/'+_0x53e9f2)[_0x6894('0x1a')](_0xf8f5ee);}return null;};}function patchUpdates(_0x167af9){return function(_0x6be790){try{jsonpatch[_0x6894('0x20')](_0x6be790,_0x167af9,!![]);}catch(_0x199b3f){return BPromise[_0x6894('0x21')](_0x199b3f);}return _0x6be790[_0x6894('0x22')]();};}function saveUpdates(_0x19fd58,_0x258597){return function(_0x4e79ed){if(_0x4e79ed){return _0x4e79ed[_0x6894('0x23')](_0x19fd58)[_0x6894('0x24')](function(_0x4fb52e){return _0x4fb52e;});}return null;};}function removeEntity(_0x1efa03,_0x29179c){return function(_0x38b746){if(_0x38b746){return _0x38b746[_0x6894('0x25')]()[_0x6894('0x24')](function(){var _0x57aa38=_0x38b746[_0x6894('0x26')]({'plain':!![]});var _0x241d46=_0x6894('0x27');return db[_0x6894('0x28')]['destroy']({'where':{'type':_0x241d46,'resourceId':_0x57aa38['id']}})['then'](function(){return _0x38b746;});})[_0x6894('0x24')](function(){_0x1efa03[_0x6894('0x18')](0xcc)[_0x6894('0x19')]();});}};}function handleEntityNotFound(_0x284dc5,_0x3e7acc){return function(_0x48cec2){if(!_0x48cec2){_0x284dc5[_0x6894('0x17')](0x194);}return _0x48cec2;};}function handleError(_0x46141e,_0x3b7716){_0x3b7716=_0x3b7716||0x1f4;return function(_0x4f56cd){logger[_0x6894('0x29')](_0x4f56cd[_0x6894('0x2a')]);if(_0x4f56cd[_0x6894('0x2b')]){delete _0x4f56cd[_0x6894('0x2b')];}_0x46141e[_0x6894('0x18')](_0x3b7716)[_0x6894('0x2c')](_0x4f56cd);};}exports[_0x6894('0x2d')]=function(_0x24c4ed,_0x504a7a){var _0x2ff7b7={},_0x1c8ef9={},_0x2e933d={'count':0x0,'rows':[]};var _0x479bda=_['map'](db['AnalyticCustomReport'][_0x6894('0x2e')],function(_0x26daba){return{'name':_0x26daba[_0x6894('0x2f')],'type':_0x26daba['type'][_0x6894('0x30')]};});_0x1c8ef9[_0x6894('0x31')]=_['map'](_0x479bda,_0x6894('0x2b'));_0x1c8ef9[_0x6894('0x32')]=_['keys'](_0x24c4ed[_0x6894('0x32')]);_0x1c8ef9[_0x6894('0x33')]=_[_0x6894('0x34')](_0x1c8ef9[_0x6894('0x31')],_0x1c8ef9[_0x6894('0x32')]);_0x2ff7b7[_0x6894('0x35')]=_[_0x6894('0x34')](_0x1c8ef9[_0x6894('0x31')],qs['fields'](_0x24c4ed[_0x6894('0x32')][_0x6894('0x36')]));_0x2ff7b7[_0x6894('0x35')]=_0x2ff7b7[_0x6894('0x35')][_0x6894('0x37')]?_0x2ff7b7['attributes']:_0x1c8ef9['model'];if(!_0x24c4ed['query'][_0x6894('0x38')](_0x6894('0x39'))){_0x2ff7b7[_0x6894('0x1c')]=qs['limit'](_0x24c4ed[_0x6894('0x32')][_0x6894('0x1c')]);_0x2ff7b7[_0x6894('0x1b')]=qs['offset'](_0x24c4ed[_0x6894('0x32')][_0x6894('0x1b')]);}_0x2ff7b7['order']=qs['sort'](_0x24c4ed[_0x6894('0x32')][_0x6894('0x3a')]);_0x2ff7b7[_0x6894('0x3b')]=qs[_0x6894('0x33')](_[_0x6894('0x3c')](_0x24c4ed[_0x6894('0x32')],_0x1c8ef9[_0x6894('0x33')]),_0x479bda);if(_0x24c4ed[_0x6894('0x32')][_0x6894('0x3d')]){_0x2ff7b7['where']=_[_0x6894('0x3e')](_0x2ff7b7[_0x6894('0x3b')],{'$or':_['map'](_0x479bda,function(_0x16a68c){if(_0x16a68c[_0x6894('0x3f')]!=='VIRTUAL'){var _0x54b5d2={};_0x54b5d2[_0x16a68c[_0x6894('0x2b')]]={'$like':'%'+_0x24c4ed['query'][_0x6894('0x3d')]+'%'};return _0x54b5d2;}})});}_0x2ff7b7=_['merge']({},_0x2ff7b7,_0x24c4ed[_0x6894('0x40')]);var _0x20a9de={'where':_0x2ff7b7[_0x6894('0x3b')]};return db[_0x6894('0x41')][_0x6894('0x1e')](_0x20a9de)[_0x6894('0x24')](function(_0x57e99c){_0x2e933d[_0x6894('0x1e')]=_0x57e99c;if(_0x24c4ed[_0x6894('0x32')][_0x6894('0x42')]){_0x2ff7b7[_0x6894('0x43')]=[{'all':!![]}];}return db['AnalyticCustomReport'][_0x6894('0x44')](_0x2ff7b7);})[_0x6894('0x24')](function(_0x45fda8){_0x2e933d[_0x6894('0x45')]=_0x45fda8;return _0x2e933d;})['then'](respondWithFilteredResult(_0x504a7a,_0x2ff7b7))[_0x6894('0x46')](handleError(_0x504a7a,null));};exports[_0x6894('0x47')]=function(_0x1b5102,_0x5ccf96){var _0x2e13d7={'raw':![],'where':{'id':_0x1b5102[_0x6894('0x48')]['id']}},_0x5a795a={};_0x5a795a[_0x6894('0x31')]=_[_0x6894('0x49')](db[_0x6894('0x41')]['rawAttributes']);_0x5a795a['query']=_['keys'](_0x1b5102[_0x6894('0x32')]);_0x5a795a['filters']=_['intersection'](_0x5a795a['model'],_0x5a795a[_0x6894('0x32')]);_0x2e13d7[_0x6894('0x35')]=_['intersection'](_0x5a795a['model'],qs[_0x6894('0x36')](_0x1b5102[_0x6894('0x32')][_0x6894('0x36')]));_0x2e13d7['attributes']=_0x2e13d7[_0x6894('0x35')][_0x6894('0x37')]?_0x2e13d7['attributes']:_0x5a795a['model'];if(_0x1b5102[_0x6894('0x32')]['includeAll']){_0x2e13d7[_0x6894('0x43')]=[{'all':!![]}];}_0x2e13d7=_[_0x6894('0x3e')]({},_0x2e13d7,_0x1b5102[_0x6894('0x40')]);return db['AnalyticCustomReport'][_0x6894('0x4a')](_0x2e13d7)[_0x6894('0x24')](handleEntityNotFound(_0x5ccf96,null))['then'](respondWithResult(_0x5ccf96,null))[_0x6894('0x46')](handleError(_0x5ccf96,null));};exports[_0x6894('0x4b')]=function(_0x3f010f,_0x5cb7d3){return db['AnalyticCustomReport'][_0x6894('0x4b')](_0x3f010f[_0x6894('0x4c')],{})[_0x6894('0x24')](function(_0xbb2f08){var _0x154f7f=_0x3f010f['user'][_0x6894('0x26')]({'plain':!![]});if(!_0x154f7f)throw new Error(_0x6894('0x4d'));if(_0x154f7f[_0x6894('0x4e')]==='user'){var _0x1c486e=_0xbb2f08[_0x6894('0x26')]({'plain':!![]});var _0x8abbee=_0x6894('0x4f');return db[_0x6894('0x50')]['find']({'where':{'name':_0x8abbee,'userProfileId':_0x154f7f[_0x6894('0x51')]},'raw':!![]})[_0x6894('0x24')](function(_0x584823){if(_0x584823&&_0x584823[_0x6894('0x52')]===0x0){return db[_0x6894('0x28')][_0x6894('0x4b')]({'name':_0x1c486e[_0x6894('0x2b')],'resourceId':_0x1c486e['id'],'type':_0x6894('0x27'),'sectionId':_0x584823['id']},{})[_0x6894('0x24')](function(){return _0xbb2f08;});}else{return _0xbb2f08;}})[_0x6894('0x46')](function(_0x355218){logger[_0x6894('0x29')](_0x6894('0x53'),_0x355218);throw _0x355218;});}return _0xbb2f08;})['then'](respondWithResult(_0x5cb7d3,0xc9))['catch'](handleError(_0x5cb7d3,null));};exports[_0x6894('0x23')]=function(_0x5c9e4c,_0x2bcc0f){if(_0x5c9e4c['body']['id']){delete _0x5c9e4c[_0x6894('0x4c')]['id'];}return db[_0x6894('0x41')]['find']({'where':{'id':_0x5c9e4c[_0x6894('0x48')]['id']}})[_0x6894('0x24')](handleEntityNotFound(_0x2bcc0f,null))['then'](saveUpdates(_0x5c9e4c[_0x6894('0x4c')],null))[_0x6894('0x24')](respondWithResult(_0x2bcc0f,null))[_0x6894('0x46')](handleError(_0x2bcc0f,null));};exports[_0x6894('0x25')]=function(_0x33e8d6,_0x39a2e5){return db['AnalyticCustomReport'][_0x6894('0x4a')]({'where':{'id':_0x33e8d6['params']['id']}})['then'](handleEntityNotFound(_0x39a2e5,null))['then'](removeEntity(_0x39a2e5,null))[_0x6894('0x46')](handleError(_0x39a2e5,null));};exports[_0x6894('0x54')]=function(_0x2e8c46,_0x207989){var _0x4f87e8=0xa;var _0x409f51=[_0x6894('0x55'),_0x6894('0x56'),'right_join',_0x6894('0x57')];var _0x1c2d9c={'SUM':_0x6894('0x58'),'COUNT':_0x6894('0x59'),'COUNT DISTINCT':_0x6894('0x5a'),'MAX':_0x6894('0x5b'),'MIN':_0x6894('0x5c'),'AVG':_0x6894('0x5d'),'GROUP_CONCAT':_0x6894('0x5e'),'GROUP_CONCAT ASC':_0x6894('0x5f'),'GROUP_CONCAT DESC':_0x6894('0x60')};var _0x493c8a={'SEC_TO_TIME':_0x6894('0x61'),'DATE':_0x6894('0x62'),'HOUR':_0x6894('0x63'),'ROUND':_0x6894('0x64'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x32127b=function(_0x4e67fe){return!_[_0x6894('0x65')]([_0x6894('0x66'),_0x6894('0x67'),_0x6894('0x68'),_0x6894('0x69')],_0x4e67fe);};var _0x16aaee=function(_0x1c604c){if(!_0x1c604c||!_0x1c604c[_0x6894('0x6a')][_0x6894('0x37')]){return'';}for(var _0x5c4df6='(',_0x177c61=0x0;_0x177c61<_0x1c604c['rules'][_0x6894('0x37')];_0x177c61+=0x1){_0x177c61>0x0&&(_0x5c4df6+='\x20'+_0x1c604c['operator']+'\x20');_0x5c4df6+=_0x1c604c[_0x6894('0x6a')][_0x177c61][_0x6894('0x6b')]?_0x16aaee(_0x1c604c[_0x6894('0x6a')][_0x177c61][_0x6894('0x6b')]):_0x1c604c['rules'][_0x177c61][_0x6894('0x6c')]+'\x20'+_0x1c604c[_0x6894('0x6a')][_0x177c61]['condition']+(_0x32127b(_0x1c604c[_0x6894('0x6a')][_0x177c61][_0x6894('0x6d')])?'\x20'+_0x1c604c[_0x6894('0x6a')][_0x177c61]['value']:'');}return _0x5c4df6+')';};var _0x1ba7b9={'where':{'id':_0x2e8c46['params']['id']}},_0x3a9795,_0x2be92a,_0x408f8f,_0x5f32ea,_0x31ed10;_0x1ba7b9=_['merge']({},_0x1ba7b9,_0x2e8c46[_0x6894('0x40')]);return db[_0x6894('0x41')][_0x6894('0x4a')](_0x1ba7b9)[_0x6894('0x24')](function(_0x4683a5){if(_0x4683a5){_0x3a9795=_0x4683a5;return _0x4683a5[_0x6894('0x6e')]();}return null;})[_0x6894('0x24')](function(_0x12b1b5){if(_0x12b1b5){if(!_0x12b1b5[_0x6894('0x37')]){throw new db['Sequelize']['ValidationErrorItem'](_0x6894('0x6f'),0x193);}_0x2be92a=_0x12b1b5;return db['AnalyticMetric']['findAll']({'raw':!![]});}return null;})[_0x6894('0x24')](function(_0x9cadb9){if(_0x9cadb9){_0x408f8f=_[_0x6894('0x70')](_0x9cadb9,'id');var _0x51c7e6;var _0x4c6385=squel[_0x6894('0x71')]();_0x4c6385[_0x6894('0x72')](_0x3a9795[_0x6894('0x73')]);for(var _0x2c978f=0x0;_0x2c978f<_0x2be92a[_0x6894('0x37')];_0x2c978f+=0x1){_0x51c7e6=_0x2be92a[_0x2c978f][_0x6894('0x74')]?_0x408f8f[_0x2be92a[_0x2c978f][_0x6894('0x74')]][_0x6894('0x75')]:_0x2be92a[_0x2c978f][_0x6894('0x6c')];_0x51c7e6=_0x2be92a[_0x2c978f]['function']?_[_0x6894('0x76')](_0x1c2d9c[_0x2be92a[_0x2c978f]['function']],'%s',_0x51c7e6):_0x51c7e6;_0x51c7e6=_0x2be92a[_0x2c978f][_0x6894('0x77')]?_['replace'](_0x493c8a[_0x2be92a[_0x2c978f][_0x6894('0x77')]],'%s',_0x51c7e6):_0x51c7e6;if(_0x2be92a[_0x2c978f][_0x6894('0x78')]){_0x4c6385[_0x6894('0x6b')](_0x51c7e6);}_0x2be92a[_0x2c978f][_0x6894('0x79')]&&_0x4c6385[_0x6894('0x7a')](_0x51c7e6,_0x2be92a[_0x2c978f][_0x6894('0x79')]===_0x6894('0x7b')?![]:!![]);_0x4c6385[_0x6894('0x6c')](_0x51c7e6,_0x2be92a[_0x2c978f][_0x6894('0x7c')]||_0x51c7e6);}if(_0x3a9795[_0x6894('0x7d')]){_0x3a9795[_0x6894('0x7d')]=JSON[_0x6894('0x7e')](_0x3a9795[_0x6894('0x7d')]);for(var _0xcb7ac0=0x0;_0xcb7ac0<_0x3a9795[_0x6894('0x7d')]['length'];_0xcb7ac0+=0x1){if(_0x3a9795[_0x6894('0x7d')][_0xcb7ac0]['type']&&_[_0x6894('0x65')](_0x409f51,_0x3a9795['joins'][_0xcb7ac0][_0x6894('0x3f')])&&_0x3a9795[_0x6894('0x7d')][_0xcb7ac0]['parentKey']&&_0x3a9795['joins'][_0xcb7ac0][_0x6894('0x7f')]&&_0x3a9795[_0x6894('0x7d')][_0xcb7ac0][_0x6894('0x80')]){_0x4c6385[_0x3a9795[_0x6894('0x7d')][_0xcb7ac0]['type']](_0x3a9795[_0x6894('0x7d')][_0xcb7ac0][_0x6894('0x7f')],null,util['format'](_0x6894('0x81'),_0x3a9795[_0x6894('0x73')],_0x3a9795['joins'][_0xcb7ac0][_0x6894('0x82')],_0x3a9795[_0x6894('0x7d')][_0xcb7ac0][_0x6894('0x7f')],_0x3a9795[_0x6894('0x7d')][_0xcb7ac0][_0x6894('0x80')]));}}}if(_0x3a9795[_0x6894('0x83')]){_0x3a9795[_0x6894('0x83')]=JSON[_0x6894('0x7e')](_0x3a9795[_0x6894('0x83')]);_0x4c6385[_0x6894('0x3b')](_0x16aaee(_0x3a9795[_0x6894('0x83')][_0x6894('0x6b')]));}_0x31ed10=_0x4c6385['clone']();_0x4c6385['limit'](_0x4f87e8);_0x4c6385['offset'](0x0);logger[_0x6894('0x84')]('Limited\x20Query:',_0x4c6385['toString']());return dbH[_0x6894('0x85')]['query'](_0x4c6385[_0x6894('0x86')](),{'type':dbH[_0x6894('0x85')][_0x6894('0x87')][_0x6894('0x88')]});}})['then'](respondWithResult(_0x207989,null))[_0x6894('0x46')](handleError(_0x207989,null));};function runReport(_0x2f6da5,_0xef6f4c,_0x3ef4ca){var _0x218c26=_0xef6f4c[_0x6894('0x2b')];var _0xe62227=0xa;var _0x4cff1d=[_0x6894('0x55'),_0x6894('0x56'),'right_join',_0x6894('0x57')];var _0x1a4e9c={'SUM':_0x6894('0x58'),'COUNT':_0x6894('0x59'),'COUNT DISTINCT':_0x6894('0x5a'),'MAX':_0x6894('0x5b'),'MIN':'MIN(%s)','AVG':_0x6894('0x5d'),'GROUP_CONCAT':_0x6894('0x5e'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x6894('0x60')};var _0x2dad52={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x6894('0x62'),'HOUR':_0x6894('0x63'),'ROUND':_0x6894('0x64'),'UNIX_TIMESTAMP':_0x6894('0x89')};var _0x1ad75b=function(_0x29ddc0){return!_[_0x6894('0x65')]([_0x6894('0x66'),_0x6894('0x67'),_0x6894('0x68'),_0x6894('0x69')],_0x29ddc0);};var _0x23be9d=function(_0x1a4abd){if(!_0x1a4abd||!_0x1a4abd[_0x6894('0x6a')]['length']){return'';}for(var _0x463f20='(',_0xc97bf7=0x0;_0xc97bf7<_0x1a4abd['rules'][_0x6894('0x37')];_0xc97bf7+=0x1){_0xc97bf7>0x0&&(_0x463f20+='\x20'+_0x1a4abd[_0x6894('0x8a')]+'\x20');_0x463f20+=_0x1a4abd[_0x6894('0x6a')][_0xc97bf7][_0x6894('0x6b')]?_0x23be9d(_0x1a4abd['rules'][_0xc97bf7][_0x6894('0x6b')]):_0x1a4abd[_0x6894('0x6a')][_0xc97bf7]['field']+'\x20'+_0x1a4abd[_0x6894('0x6a')][_0xc97bf7][_0x6894('0x6d')]+(_0x1ad75b(_0x1a4abd['rules'][_0xc97bf7][_0x6894('0x6d')])?'\x20'+_0x1a4abd[_0x6894('0x6a')][_0xc97bf7][_0x6894('0x8b')]:'');}return _0x463f20+')';};var _0x106845={'where':{'id':_0x2f6da5['id']}},_0x50fd06,_0x2771a7,_0x26e980,_0x7f45d0,_0x57d661;_0x106845=_[_0x6894('0x3e')]({},_0x106845,_0x3ef4ca);return db[_0x6894('0x41')]['find'](_0x106845)[_0x6894('0x24')](function(_0x4a39f6){if(_0x4a39f6){_0x50fd06=_0x4a39f6;return _0x4a39f6['getFields']();}return null;})['then'](function(_0x263658){if(_0x263658){if(!_0x263658[_0x6894('0x37')]){throw new db[(_0x6894('0x8c'))][(_0x6894('0x8d'))](_0x6894('0x6f'),0x193);}_0x2771a7=_0x263658;return db['AnalyticMetric'][_0x6894('0x44')]({'raw':!![]});}return null;})['then'](function(_0x3696cb){if(_0x3696cb){_0x26e980=_[_0x6894('0x70')](_0x3696cb,'id');var _0x192c15;var _0x402458=squel['select']();_0x402458[_0x6894('0x72')](_0x50fd06['table']);for(var _0x19e62a=0x0;_0x19e62a<_0x2771a7[_0x6894('0x37')];_0x19e62a+=0x1){_0x192c15=_0x2771a7[_0x19e62a][_0x6894('0x74')]?_0x26e980[_0x2771a7[_0x19e62a][_0x6894('0x74')]][_0x6894('0x75')]:_0x2771a7[_0x19e62a][_0x6894('0x6c')];_0x192c15=_0x2771a7[_0x19e62a][_0x6894('0x8e')]?_[_0x6894('0x76')](_0x1a4e9c[_0x2771a7[_0x19e62a][_0x6894('0x8e')]],'%s',_0x192c15):_0x192c15;_0x192c15=_0x2771a7[_0x19e62a]['format']?_[_0x6894('0x76')](_0x2dad52[_0x2771a7[_0x19e62a][_0x6894('0x77')]],'%s',_0x192c15):_0x192c15;if(_0x2771a7[_0x19e62a][_0x6894('0x78')]){_0x402458['group'](_0x192c15);}_0x2771a7[_0x19e62a][_0x6894('0x79')]&&_0x402458[_0x6894('0x7a')](_0x192c15,_0x2771a7[_0x19e62a]['orderBy']===_0x6894('0x7b')?![]:!![]);_0x402458[_0x6894('0x6c')](_0x192c15,_0x2771a7[_0x19e62a][_0x6894('0x7c')]||_0x192c15);}if(_0x50fd06[_0x6894('0x7d')]){_0x50fd06['joins']=JSON[_0x6894('0x7e')](_0x50fd06[_0x6894('0x7d')]);for(var _0x47cefc=0x0;_0x47cefc<_0x50fd06['joins']['length'];_0x47cefc+=0x1){if(_0x50fd06['joins'][_0x47cefc][_0x6894('0x3f')]&&_['includes'](_0x4cff1d,_0x50fd06[_0x6894('0x7d')][_0x47cefc][_0x6894('0x3f')])&&_0x50fd06[_0x6894('0x7d')][_0x47cefc][_0x6894('0x82')]&&_0x50fd06[_0x6894('0x7d')][_0x47cefc]['foreignTable']&&_0x50fd06['joins'][_0x47cefc][_0x6894('0x80')]){_0x402458[_0x50fd06[_0x6894('0x7d')][_0x47cefc][_0x6894('0x3f')]](_0x50fd06['joins'][_0x47cefc][_0x6894('0x7f')],null,util[_0x6894('0x77')](_0x6894('0x81'),_0x50fd06[_0x6894('0x73')],_0x50fd06[_0x6894('0x7d')][_0x47cefc][_0x6894('0x82')],_0x50fd06['joins'][_0x47cefc][_0x6894('0x7f')],_0x50fd06[_0x6894('0x7d')][_0x47cefc][_0x6894('0x80')]));}}}if(_0x50fd06['conditions']){_0x50fd06[_0x6894('0x83')]=JSON[_0x6894('0x7e')](_0x50fd06[_0x6894('0x83')]);_0x402458['where'](_0x23be9d(_0x50fd06[_0x6894('0x83')][_0x6894('0x6b')]));}_0x57d661=_0x402458[_0x6894('0x8f')]();_0x402458[_0x6894('0x1c')](_0xe62227);_0x402458[_0x6894('0x1b')](0x0);return;}})[_0x6894('0x24')](function(){if(_0xef6f4c[_0x6894('0x90')]===_0x6894('0x91')){return null;}var _0x40c506=_[_0x6894('0x3e')](_0xef6f4c,{'name':_0xef6f4c['fullPath']||_0xef6f4c['name']||_0x50fd06[_0x6894('0x2b')],'basename':_0x218c26,'savename':util[_0x6894('0x77')](_0x6894('0x92'),_0xef6f4c[_0x6894('0x2b')]||_0x50fd06[_0x6894('0x2b')],require(_0x6894('0x93'))[_0x6894('0x94')](0x4),_0xef6f4c['output']||_0x6894('0x95')),'reportId':_0x50fd06['id'],'reportType':_0x6894('0x96')});return db['AnalyticExtractedReport'][_0x6894('0x4b')](_0x40c506,{'raw':!![]});})[_0x6894('0x24')](function(_0x458498){if(_0x50fd06[_0x6894('0x73')]===_0x6894('0x97')){_0x57d661[_0x6894('0x3b')](_0x50fd06[_0x6894('0x73')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0xef6f4c['startDate'],_0xef6f4c[_0x6894('0x98')]);}else{_0x57d661['where'](_0x50fd06[_0x6894('0x73')]+_0x6894('0x99'),_0xef6f4c[_0x6894('0x9a')],_0xef6f4c[_0x6894('0x98')]);}if(_0x458498){logger['info'](_0x6894('0x9b'),_0x57d661['toString']());require(_0x6894('0x9c'))[_0x6894('0x9d')](path[_0x6894('0x55')](__dirname,'../../components/export/',_0x458498[_0x6894('0x90')]),[_0x458498['id'],_0x57d661[_0x6894('0x86')](),path[_0x6894('0x55')](__dirname,'../../files/reports',_0x458498[_0x6894('0x9e')]),_0x218c26]);return _0x458498;}else{var _0x7c49db=squel[_0x6894('0x71')]();_0x7c49db[_0x6894('0x72')]('('+_0x57d661[_0x6894('0x86')]()+')','countTable');_0x7c49db['field']('COUNT(*)',_0x6894('0x1e'));_0x57d661[_0x6894('0x1c')](_0xef6f4c[_0x6894('0x1c')]||_0xe62227);_0x57d661[_0x6894('0x1b')](_0xef6f4c['offset']||0x0);return dbH[_0x6894('0x85')][_0x6894('0x32')](_0x7c49db[_0x6894('0x86')](),{'type':dbH['sequelize'][_0x6894('0x87')][_0x6894('0x88')]})[_0x6894('0x24')](function(_0x5f03f0){if(!_0x5f03f0[_0x6894('0x37')]){_0x7f45d0=0x0;}else{_0x7f45d0=_0x5f03f0[0x0][_0x6894('0x1e')]||0x0;}return dbH[_0x6894('0x85')][_0x6894('0x32')](_0x57d661[_0x6894('0x86')](),{'type':dbH['sequelize'][_0x6894('0x87')][_0x6894('0x88')]});})[_0x6894('0x24')](function(_0x41a083){return{'rows':_0x41a083||[],'count':_0x7f45d0};});}});}exports[_0x6894('0x9f')]=function(_0x32de82,_0x372643){return runReport(_0x32de82['params'],_0x32de82['query'],_0x32de82['options'])['then'](respondWithResult(_0x372643,null))['catch'](handleError(_0x372643,null));};exports['runReport']=runReport;exports['query']=function(_0xd41f27,_0x3eec29){var _0x318919=0xa;var _0x15bcbf=[_0x6894('0x55'),_0x6894('0x56'),_0x6894('0xa0'),_0x6894('0x57')];var _0x33adfb={'SUM':_0x6894('0x58'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x6894('0x5a'),'MAX':_0x6894('0x5b'),'MIN':_0x6894('0x5c'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x6894('0x5e'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x6894('0x60')};var _0xc6c15f={'SEC_TO_TIME':_0x6894('0x61'),'DATE':_0x6894('0x62'),'HOUR':_0x6894('0x63'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x24e7e5=function(_0x45ce41){return!_[_0x6894('0x65')]([_0x6894('0x66'),_0x6894('0x67'),'IS\x20EMPTY',_0x6894('0x69')],_0x45ce41);};var _0x182665=function(_0x4a8a81){if(!_0x4a8a81||!_0x4a8a81[_0x6894('0x6a')][_0x6894('0x37')]){return'';}for(var _0x1d44bc='(',_0x5066d2=0x0;_0x5066d2<_0x4a8a81['rules'][_0x6894('0x37')];_0x5066d2+=0x1){_0x5066d2>0x0&&(_0x1d44bc+='\x20'+_0x4a8a81[_0x6894('0x8a')]+'\x20');_0x1d44bc+=_0x4a8a81['rules'][_0x5066d2][_0x6894('0x6b')]?_0x182665(_0x4a8a81[_0x6894('0x6a')][_0x5066d2][_0x6894('0x6b')]):_0x4a8a81[_0x6894('0x6a')][_0x5066d2][_0x6894('0x6c')]+'\x20'+_0x4a8a81[_0x6894('0x6a')][_0x5066d2][_0x6894('0x6d')]+(_0x24e7e5(_0x4a8a81[_0x6894('0x6a')][_0x5066d2]['condition'])?'\x20'+_0x4a8a81['rules'][_0x5066d2][_0x6894('0x8b')]:'');}return _0x1d44bc+')';};var _0x24ce0a={'where':{'id':_0xd41f27[_0x6894('0x48')]['id']}},_0x240d8a,_0x4be470,_0x41d383,_0x422db9,_0x5b5cc5;_0x24ce0a=_[_0x6894('0x3e')]({},_0x24ce0a,_0xd41f27[_0x6894('0x40')]);return db[_0x6894('0x41')][_0x6894('0x4a')](_0x24ce0a)['then'](function(_0x412678){if(_0x412678){_0x240d8a=_0x412678;return _0x412678[_0x6894('0x6e')]();}return null;})[_0x6894('0x24')](function(_0x450af8){if(_0x450af8){if(!_0x450af8[_0x6894('0x37')]){throw new db[(_0x6894('0x8c'))]['ValidationErrorItem'](_0x6894('0x6f'),0x193);}_0x4be470=_0x450af8;return db[_0x6894('0xa1')][_0x6894('0x44')]({'raw':!![]});}return null;})[_0x6894('0x24')](function(_0x4c4f08){if(_0x4c4f08){_0x41d383=_[_0x6894('0x70')](_0x4c4f08,'id');var _0x1c9bb5;var _0x55104e=squel[_0x6894('0x71')]();_0x55104e['from'](_0x240d8a['table']);for(var _0x1e4ecd=0x0;_0x1e4ecd<_0x4be470[_0x6894('0x37')];_0x1e4ecd+=0x1){_0x1c9bb5=_0x4be470[_0x1e4ecd]['MetricId']?_0x41d383[_0x4be470[_0x1e4ecd][_0x6894('0x74')]][_0x6894('0x75')]:_0x4be470[_0x1e4ecd]['field'];_0x1c9bb5=_0x4be470[_0x1e4ecd][_0x6894('0x8e')]?_['replace'](_0x33adfb[_0x4be470[_0x1e4ecd][_0x6894('0x8e')]],'%s',_0x1c9bb5):_0x1c9bb5;_0x1c9bb5=_0x4be470[_0x1e4ecd][_0x6894('0x77')]?_['replace'](_0xc6c15f[_0x4be470[_0x1e4ecd][_0x6894('0x77')]],'%s',_0x1c9bb5):_0x1c9bb5;if(_0x4be470[_0x1e4ecd]['groupBy']){_0x55104e[_0x6894('0x6b')](_0x1c9bb5);}_0x4be470[_0x1e4ecd][_0x6894('0x79')]&&_0x55104e['order'](_0x1c9bb5,_0x4be470[_0x1e4ecd][_0x6894('0x79')]==='DESC'?![]:!![]);_0x55104e[_0x6894('0x6c')](_0x1c9bb5,_0x4be470[_0x1e4ecd][_0x6894('0x7c')]||_0x1c9bb5);}if(_0x240d8a['joins']){_0x240d8a['joins']=JSON[_0x6894('0x7e')](_0x240d8a[_0x6894('0x7d')]);for(var _0x24ce49=0x0;_0x24ce49<_0x240d8a[_0x6894('0x7d')][_0x6894('0x37')];_0x24ce49+=0x1){if(_0x240d8a['joins'][_0x24ce49][_0x6894('0x3f')]&&_['includes'](_0x15bcbf,_0x240d8a[_0x6894('0x7d')][_0x24ce49]['type'])&&_0x240d8a[_0x6894('0x7d')][_0x24ce49][_0x6894('0x82')]&&_0x240d8a['joins'][_0x24ce49][_0x6894('0x7f')]&&_0x240d8a[_0x6894('0x7d')][_0x24ce49][_0x6894('0x80')]){_0x55104e[_0x240d8a['joins'][_0x24ce49]['type']](_0x240d8a[_0x6894('0x7d')][_0x24ce49]['foreignTable'],null,util[_0x6894('0x77')](_0x6894('0x81'),_0x240d8a[_0x6894('0x73')],_0x240d8a[_0x6894('0x7d')][_0x24ce49][_0x6894('0x82')],_0x240d8a[_0x6894('0x7d')][_0x24ce49][_0x6894('0x7f')],_0x240d8a[_0x6894('0x7d')][_0x24ce49][_0x6894('0x80')]));}}}if(_0x240d8a[_0x6894('0x83')]){_0x240d8a[_0x6894('0x83')]=JSON[_0x6894('0x7e')](_0x240d8a[_0x6894('0x83')]);_0x55104e['where'](_0x182665(_0x240d8a[_0x6894('0x83')][_0x6894('0x6b')]));}_0x5b5cc5=_0x55104e['clone']();_0x55104e['limit'](_0x318919);_0x55104e[_0x6894('0x1b')](0x0);logger[_0x6894('0x84')](_0x6894('0xa2'),_0x55104e[_0x6894('0x86')]());return dbH[_0x6894('0x85')][_0x6894('0x32')](_0x55104e[_0x6894('0x86')](),{'type':dbH['sequelize'][_0x6894('0x87')][_0x6894('0x88')]});}})[_0x6894('0x24')](function(){return{'sql':_0x5b5cc5[_0x6894('0x86')]()};})[_0x6894('0x24')](respondWithResult(_0x3eec29,null))[_0x6894('0x46')](handleError(_0x3eec29,null));}; \ No newline at end of file +var _0x4159=['metric','function','replace','format','orderBy','alias','joins','parse','parentKey','foreignKey','foreignTable','%s.%s\x20=\x20%s.%s','conditions','clone','debug','toString','sequelize','QueryTypes','SELECT','left_join','COUNT(%s)','COUNT(DISTINCT\x20%s)','HOUR(%s)','UNIX_TIMESTAMP(%s)','includes','operator','getFields','groupBy','output','web','fullPath','%s-%s.%s','generate','csv','custom','.calldate\x20BETWEEN\x20?\x20AND\x20?','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','startDate','info','child_process','fork','../../components/export/','../../files/reports','COUNT(*)','run','runReport','MIN(%s)','findAll','DESC','Limited\x20Query:','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','dbH','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','CustomReports','error','name','index','rawAttributes','fieldName','type','key','map','keys','query','intersection','model','fields','attributes','length','nolimit','order','sort','pick','filters','filter','where','merge','VIRTUAL','options','AnalyticCustomReport','include','rows','catch','show','params','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','preview','join','right_join','cross_join','SUM(%s)','MAX(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','ROUND(%s)','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','group','field','condition','value','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','from','table','MetricId'];(function(_0x55c979,_0x36c5f0){var _0x690107=function(_0xa61dad){while(--_0xa61dad){_0x55c979['push'](_0x55c979['shift']());}};_0x690107(++_0x36c5f0);}(_0x4159,0x17d));var _0x9415=function(_0x305d7e,_0x377df9){_0x305d7e=_0x305d7e-0x0;var _0x9403d3=_0x4159[_0x305d7e];return _0x9403d3;};'use strict';var emlformat=require(_0x9415('0x0'));var rimraf=require(_0x9415('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9415('0x2'));var rp=require(_0x9415('0x3'));var moment=require(_0x9415('0x4'));var BPromise=require(_0x9415('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x9415('0x6'));var sox=require(_0x9415('0x7'));var csv=require(_0x9415('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9415('0x9'));var squel=require(_0x9415('0xa'));var crypto=require(_0x9415('0xb'));var jsforce=require(_0x9415('0xc'));var deskjs=require(_0x9415('0xd'));var toCsv=require(_0x9415('0x8'));var querystring=require('querystring');var Papa=require(_0x9415('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x9415('0xf'));var as=require(_0x9415('0x10'));var hardwareService=require(_0x9415('0x11'));var logger=require(_0x9415('0x12'))('api');var utils=require(_0x9415('0x13'));var config=require(_0x9415('0x14'));var licenseUtil=require(_0x9415('0x15'));var db=require(_0x9415('0x16'))['db'];var dbH=require('../../mysqldb')[_0x9415('0x17')];function respondWithStatusCode(_0x29e5af,_0x57c3d1){_0x57c3d1=_0x57c3d1||0xcc;return function(_0x185a20){if(_0x185a20){return _0x29e5af[_0x9415('0x18')](_0x57c3d1);}return _0x29e5af[_0x9415('0x19')](_0x57c3d1)['end']();};}function respondWithResult(_0x245a46,_0x2f1b97){_0x2f1b97=_0x2f1b97||0xc8;return function(_0x3656b2){if(_0x3656b2){return _0x245a46['status'](_0x2f1b97)[_0x9415('0x1a')](_0x3656b2);}};}function respondWithFilteredResult(_0x4d6035,_0x5b049a){return function(_0x4bf3f5){if(_0x4bf3f5){var _0x5b9fb8=typeof _0x5b049a[_0x9415('0x1b')]===_0x9415('0x1c')&&typeof _0x5b049a[_0x9415('0x1d')]===_0x9415('0x1c');var _0x12183e=_0x4bf3f5[_0x9415('0x1e')];var _0x554427=_0x5b9fb8?0x0:_0x5b049a[_0x9415('0x1b')];var _0x5350ea=_0x5b9fb8?_0x4bf3f5['count']:_0x5b049a['offset']+_0x5b049a[_0x9415('0x1d')];var _0x3c82d2;if(_0x5350ea>=_0x12183e){_0x5350ea=_0x12183e;_0x3c82d2=0xc8;}else{_0x3c82d2=0xce;}_0x4d6035[_0x9415('0x19')](_0x3c82d2);return _0x4d6035[_0x9415('0x1f')](_0x9415('0x20'),_0x554427+'-'+_0x5350ea+'/'+_0x12183e)[_0x9415('0x1a')](_0x4bf3f5);}return null;};}function patchUpdates(_0x4c9277){return function(_0x12941e){try{jsonpatch[_0x9415('0x21')](_0x12941e,_0x4c9277,!![]);}catch(_0x23bbf1){return BPromise[_0x9415('0x22')](_0x23bbf1);}return _0x12941e[_0x9415('0x23')]();};}function saveUpdates(_0x1d98fd,_0x656499){return function(_0x128ecd){if(_0x128ecd){return _0x128ecd[_0x9415('0x24')](_0x1d98fd)[_0x9415('0x25')](function(_0xdb7b45){return _0xdb7b45;});}return null;};}function removeEntity(_0xc31ff2,_0x43d52a){return function(_0x398ff4){if(_0x398ff4){return _0x398ff4[_0x9415('0x26')]()[_0x9415('0x25')](function(){var _0x4c18c8=_0x398ff4['get']({'plain':!![]});var _0x1115ba=_0x9415('0x27');return db['UserProfileResource'][_0x9415('0x26')]({'where':{'type':_0x1115ba,'resourceId':_0x4c18c8['id']}})[_0x9415('0x25')](function(){return _0x398ff4;});})[_0x9415('0x25')](function(){_0xc31ff2[_0x9415('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x11f064,_0x1b09d8){return function(_0x166feb){if(!_0x166feb){_0x11f064[_0x9415('0x18')](0x194);}return _0x166feb;};}function handleError(_0x356467,_0x9b7e2f){_0x9b7e2f=_0x9b7e2f||0x1f4;return function(_0x3a2be5){logger[_0x9415('0x28')](_0x3a2be5['stack']);if(_0x3a2be5[_0x9415('0x29')]){delete _0x3a2be5[_0x9415('0x29')];}_0x356467[_0x9415('0x19')](_0x9b7e2f)['send'](_0x3a2be5);};}exports[_0x9415('0x2a')]=function(_0xcd2544,_0x570982){var _0x54d20b={},_0x4ff991={},_0x16641c={'count':0x0,'rows':[]};var _0x52712c=_['map'](db['AnalyticCustomReport'][_0x9415('0x2b')],function(_0x3922c9){return{'name':_0x3922c9[_0x9415('0x2c')],'type':_0x3922c9[_0x9415('0x2d')][_0x9415('0x2e')]};});_0x4ff991['model']=_[_0x9415('0x2f')](_0x52712c,_0x9415('0x29'));_0x4ff991['query']=_[_0x9415('0x30')](_0xcd2544[_0x9415('0x31')]);_0x4ff991['filters']=_[_0x9415('0x32')](_0x4ff991[_0x9415('0x33')],_0x4ff991[_0x9415('0x31')]);_0x54d20b['attributes']=_[_0x9415('0x32')](_0x4ff991['model'],qs[_0x9415('0x34')](_0xcd2544[_0x9415('0x31')][_0x9415('0x34')]));_0x54d20b[_0x9415('0x35')]=_0x54d20b['attributes'][_0x9415('0x36')]?_0x54d20b[_0x9415('0x35')]:_0x4ff991[_0x9415('0x33')];if(!_0xcd2544['query']['hasOwnProperty'](_0x9415('0x37'))){_0x54d20b[_0x9415('0x1d')]=qs[_0x9415('0x1d')](_0xcd2544['query']['limit']);_0x54d20b[_0x9415('0x1b')]=qs['offset'](_0xcd2544[_0x9415('0x31')][_0x9415('0x1b')]);}_0x54d20b[_0x9415('0x38')]=qs[_0x9415('0x39')](_0xcd2544[_0x9415('0x31')][_0x9415('0x39')]);_0x54d20b['where']=qs['filters'](_[_0x9415('0x3a')](_0xcd2544[_0x9415('0x31')],_0x4ff991[_0x9415('0x3b')]),_0x52712c);if(_0xcd2544[_0x9415('0x31')][_0x9415('0x3c')]){_0x54d20b[_0x9415('0x3d')]=_[_0x9415('0x3e')](_0x54d20b['where'],{'$or':_[_0x9415('0x2f')](_0x52712c,function(_0x36e95d){if(_0x36e95d['type']!==_0x9415('0x3f')){var _0x4303f4={};_0x4303f4[_0x36e95d[_0x9415('0x29')]]={'$like':'%'+_0xcd2544[_0x9415('0x31')]['filter']+'%'};return _0x4303f4;}})});}_0x54d20b=_[_0x9415('0x3e')]({},_0x54d20b,_0xcd2544[_0x9415('0x40')]);var _0x5dfd9d={'where':_0x54d20b['where']};return db[_0x9415('0x41')][_0x9415('0x1e')](_0x5dfd9d)[_0x9415('0x25')](function(_0x27fdae){_0x16641c['count']=_0x27fdae;if(_0xcd2544[_0x9415('0x31')]['includeAll']){_0x54d20b[_0x9415('0x42')]=[{'all':!![]}];}return db[_0x9415('0x41')]['findAll'](_0x54d20b);})['then'](function(_0x3c2e0f){_0x16641c[_0x9415('0x43')]=_0x3c2e0f;return _0x16641c;})['then'](respondWithFilteredResult(_0x570982,_0x54d20b))[_0x9415('0x44')](handleError(_0x570982,null));};exports[_0x9415('0x45')]=function(_0xa11859,_0x41c6ed){var _0x3a03df={'raw':![],'where':{'id':_0xa11859[_0x9415('0x46')]['id']}},_0x3760cf={};_0x3760cf[_0x9415('0x33')]=_['keys'](db[_0x9415('0x41')][_0x9415('0x2b')]);_0x3760cf[_0x9415('0x31')]=_[_0x9415('0x30')](_0xa11859['query']);_0x3760cf['filters']=_[_0x9415('0x32')](_0x3760cf[_0x9415('0x33')],_0x3760cf[_0x9415('0x31')]);_0x3a03df['attributes']=_[_0x9415('0x32')](_0x3760cf[_0x9415('0x33')],qs['fields'](_0xa11859[_0x9415('0x31')][_0x9415('0x34')]));_0x3a03df[_0x9415('0x35')]=_0x3a03df[_0x9415('0x35')][_0x9415('0x36')]?_0x3a03df[_0x9415('0x35')]:_0x3760cf[_0x9415('0x33')];if(_0xa11859[_0x9415('0x31')]['includeAll']){_0x3a03df[_0x9415('0x42')]=[{'all':!![]}];}_0x3a03df=_[_0x9415('0x3e')]({},_0x3a03df,_0xa11859[_0x9415('0x40')]);return db[_0x9415('0x41')][_0x9415('0x47')](_0x3a03df)[_0x9415('0x25')](handleEntityNotFound(_0x41c6ed,null))[_0x9415('0x25')](respondWithResult(_0x41c6ed,null))['catch'](handleError(_0x41c6ed,null));};exports[_0x9415('0x48')]=function(_0xdabc6f,_0x53e3c7){return db[_0x9415('0x41')][_0x9415('0x48')](_0xdabc6f[_0x9415('0x49')],{})['then'](function(_0x441752){var _0x4ffb9c=_0xdabc6f[_0x9415('0x4a')][_0x9415('0x4b')]({'plain':!![]});if(!_0x4ffb9c)throw new Error(_0x9415('0x4c'));if(_0x4ffb9c[_0x9415('0x4d')]==='user'){var _0x216595=_0x441752[_0x9415('0x4b')]({'plain':!![]});var _0x525f3c='Reports';return db[_0x9415('0x4e')][_0x9415('0x47')]({'where':{'name':_0x525f3c,'userProfileId':_0x4ffb9c[_0x9415('0x4f')]},'raw':!![]})[_0x9415('0x25')](function(_0x56fcb7){if(_0x56fcb7&&_0x56fcb7[_0x9415('0x50')]===0x0){return db[_0x9415('0x51')][_0x9415('0x48')]({'name':_0x216595[_0x9415('0x29')],'resourceId':_0x216595['id'],'type':_0x9415('0x27'),'sectionId':_0x56fcb7['id']},{})['then'](function(){return _0x441752;});}else{return _0x441752;}})[_0x9415('0x44')](function(_0x5c01a2){logger[_0x9415('0x28')](_0x9415('0x52'),_0x5c01a2);throw _0x5c01a2;});}return _0x441752;})['then'](respondWithResult(_0x53e3c7,0xc9))[_0x9415('0x44')](handleError(_0x53e3c7,null));};exports[_0x9415('0x24')]=function(_0x4c35c3,_0x3cfe46){if(_0x4c35c3[_0x9415('0x49')]['id']){delete _0x4c35c3[_0x9415('0x49')]['id'];}return db[_0x9415('0x41')][_0x9415('0x47')]({'where':{'id':_0x4c35c3[_0x9415('0x46')]['id']}})[_0x9415('0x25')](handleEntityNotFound(_0x3cfe46,null))['then'](saveUpdates(_0x4c35c3[_0x9415('0x49')],null))['then'](respondWithResult(_0x3cfe46,null))[_0x9415('0x44')](handleError(_0x3cfe46,null));};exports[_0x9415('0x26')]=function(_0x1d5e86,_0x3a4325){return db['AnalyticCustomReport'][_0x9415('0x47')]({'where':{'id':_0x1d5e86['params']['id']}})[_0x9415('0x25')](handleEntityNotFound(_0x3a4325,null))[_0x9415('0x25')](removeEntity(_0x3a4325,null))[_0x9415('0x44')](handleError(_0x3a4325,null));};exports[_0x9415('0x53')]=function(_0x43602f,_0x1f6042){var _0x461794=0xa;var _0xcefce1=[_0x9415('0x54'),'left_join',_0x9415('0x55'),_0x9415('0x56')];var _0x57a877={'SUM':_0x9415('0x57'),'COUNT':'COUNT(%s)','COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x9415('0x58'),'MIN':'MIN(%s)','AVG':_0x9415('0x59'),'GROUP_CONCAT':_0x9415('0x5a'),'GROUP_CONCAT ASC':_0x9415('0x5b'),'GROUP_CONCAT DESC':_0x9415('0x5c')};var _0x648f24={'SEC_TO_TIME':_0x9415('0x5d'),'DATE':_0x9415('0x5e'),'HOUR':'HOUR(%s)','ROUND':_0x9415('0x5f'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x5c6ba8=function(_0x2c76cf){return!_['includes']([_0x9415('0x60'),_0x9415('0x61'),_0x9415('0x62'),_0x9415('0x63')],_0x2c76cf);};var _0x465b04=function(_0x5e11e6){if(!_0x5e11e6||!_0x5e11e6[_0x9415('0x64')][_0x9415('0x36')]){return'';}for(var _0x590f86='(',_0x4aef44=0x0;_0x4aef44<_0x5e11e6[_0x9415('0x64')][_0x9415('0x36')];_0x4aef44+=0x1){_0x4aef44>0x0&&(_0x590f86+='\x20'+_0x5e11e6['operator']+'\x20');_0x590f86+=_0x5e11e6[_0x9415('0x64')][_0x4aef44][_0x9415('0x65')]?_0x465b04(_0x5e11e6[_0x9415('0x64')][_0x4aef44]['group']):_0x5e11e6[_0x9415('0x64')][_0x4aef44][_0x9415('0x66')]+'\x20'+_0x5e11e6[_0x9415('0x64')][_0x4aef44][_0x9415('0x67')]+(_0x5c6ba8(_0x5e11e6[_0x9415('0x64')][_0x4aef44]['condition'])?'\x20'+_0x5e11e6[_0x9415('0x64')][_0x4aef44][_0x9415('0x68')]:'');}return _0x590f86+')';};var _0x15e6d1={'where':{'id':_0x43602f[_0x9415('0x46')]['id']}},_0x3234fb,_0x1231e6,_0x142116,_0x28e075,_0x4743c3;_0x15e6d1=_['merge']({},_0x15e6d1,_0x43602f[_0x9415('0x40')]);return db[_0x9415('0x41')]['find'](_0x15e6d1)[_0x9415('0x25')](function(_0x49c7d4){if(_0x49c7d4){_0x3234fb=_0x49c7d4;return _0x49c7d4['getFields']();}return null;})[_0x9415('0x25')](function(_0x2f2577){if(_0x2f2577){if(!_0x2f2577[_0x9415('0x36')]){throw new db[(_0x9415('0x69'))][(_0x9415('0x6a'))](_0x9415('0x6b'),0x193);}_0x1231e6=_0x2f2577;return db[_0x9415('0x6c')]['findAll']({'raw':!![]});}return null;})['then'](function(_0x23e7bd){if(_0x23e7bd){_0x142116=_[_0x9415('0x6d')](_0x23e7bd,'id');var _0x585b04;var _0x5173e1=squel[_0x9415('0x6e')]();_0x5173e1[_0x9415('0x6f')](_0x3234fb[_0x9415('0x70')]);for(var _0x31b0cf=0x0;_0x31b0cf<_0x1231e6[_0x9415('0x36')];_0x31b0cf+=0x1){_0x585b04=_0x1231e6[_0x31b0cf]['MetricId']?_0x142116[_0x1231e6[_0x31b0cf][_0x9415('0x71')]][_0x9415('0x72')]:_0x1231e6[_0x31b0cf][_0x9415('0x66')];_0x585b04=_0x1231e6[_0x31b0cf][_0x9415('0x73')]?_[_0x9415('0x74')](_0x57a877[_0x1231e6[_0x31b0cf][_0x9415('0x73')]],'%s',_0x585b04):_0x585b04;_0x585b04=_0x1231e6[_0x31b0cf][_0x9415('0x75')]?_[_0x9415('0x74')](_0x648f24[_0x1231e6[_0x31b0cf][_0x9415('0x75')]],'%s',_0x585b04):_0x585b04;if(_0x1231e6[_0x31b0cf]['groupBy']){_0x5173e1['group'](_0x585b04);}_0x1231e6[_0x31b0cf][_0x9415('0x76')]&&_0x5173e1[_0x9415('0x38')](_0x585b04,_0x1231e6[_0x31b0cf][_0x9415('0x76')]==='DESC'?![]:!![]);_0x5173e1[_0x9415('0x66')](_0x585b04,_0x1231e6[_0x31b0cf][_0x9415('0x77')]||_0x585b04);}if(_0x3234fb[_0x9415('0x78')]){_0x3234fb[_0x9415('0x78')]=JSON[_0x9415('0x79')](_0x3234fb[_0x9415('0x78')]);for(var _0x144a24=0x0;_0x144a24<_0x3234fb[_0x9415('0x78')]['length'];_0x144a24+=0x1){if(_0x3234fb[_0x9415('0x78')][_0x144a24]['type']&&_['includes'](_0xcefce1,_0x3234fb[_0x9415('0x78')][_0x144a24][_0x9415('0x2d')])&&_0x3234fb[_0x9415('0x78')][_0x144a24][_0x9415('0x7a')]&&_0x3234fb[_0x9415('0x78')][_0x144a24]['foreignTable']&&_0x3234fb['joins'][_0x144a24][_0x9415('0x7b')]){_0x5173e1[_0x3234fb['joins'][_0x144a24][_0x9415('0x2d')]](_0x3234fb[_0x9415('0x78')][_0x144a24][_0x9415('0x7c')],null,util[_0x9415('0x75')](_0x9415('0x7d'),_0x3234fb[_0x9415('0x70')],_0x3234fb[_0x9415('0x78')][_0x144a24][_0x9415('0x7a')],_0x3234fb[_0x9415('0x78')][_0x144a24][_0x9415('0x7c')],_0x3234fb[_0x9415('0x78')][_0x144a24]['foreignKey']));}}}if(_0x3234fb[_0x9415('0x7e')]){_0x3234fb['conditions']=JSON[_0x9415('0x79')](_0x3234fb[_0x9415('0x7e')]);_0x5173e1[_0x9415('0x3d')](_0x465b04(_0x3234fb['conditions'][_0x9415('0x65')]));}_0x4743c3=_0x5173e1[_0x9415('0x7f')]();_0x5173e1['limit'](_0x461794);_0x5173e1[_0x9415('0x1b')](0x0);logger[_0x9415('0x80')]('Limited\x20Query:',_0x5173e1[_0x9415('0x81')]());return dbH[_0x9415('0x82')][_0x9415('0x31')](_0x5173e1[_0x9415('0x81')](),{'type':dbH['sequelize'][_0x9415('0x83')][_0x9415('0x84')]});}})[_0x9415('0x25')](respondWithResult(_0x1f6042,null))['catch'](handleError(_0x1f6042,null));};function runReport(_0x8a2383,_0x13e2ed,_0x1b228e){var _0x280181=_0x13e2ed[_0x9415('0x29')];var _0xd16b87=0xa;var _0x4fea59=[_0x9415('0x54'),_0x9415('0x85'),_0x9415('0x55'),'cross_join'];var _0x58c13d={'SUM':_0x9415('0x57'),'COUNT':_0x9415('0x86'),'COUNT DISTINCT':_0x9415('0x87'),'MAX':_0x9415('0x58'),'MIN':'MIN(%s)','AVG':_0x9415('0x59'),'GROUP_CONCAT':_0x9415('0x5a'),'GROUP_CONCAT ASC':_0x9415('0x5b'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0xce6fb0={'SEC_TO_TIME':_0x9415('0x5d'),'DATE':_0x9415('0x5e'),'HOUR':_0x9415('0x88'),'ROUND':_0x9415('0x5f'),'UNIX_TIMESTAMP':_0x9415('0x89')};var _0x3eec3b=function(_0x297861){return!_[_0x9415('0x8a')]([_0x9415('0x60'),'IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY'],_0x297861);};var _0x419eee=function(_0x10a38d){if(!_0x10a38d||!_0x10a38d[_0x9415('0x64')][_0x9415('0x36')]){return'';}for(var _0x32b709='(',_0x4562a9=0x0;_0x4562a9<_0x10a38d[_0x9415('0x64')][_0x9415('0x36')];_0x4562a9+=0x1){_0x4562a9>0x0&&(_0x32b709+='\x20'+_0x10a38d[_0x9415('0x8b')]+'\x20');_0x32b709+=_0x10a38d[_0x9415('0x64')][_0x4562a9]['group']?_0x419eee(_0x10a38d[_0x9415('0x64')][_0x4562a9][_0x9415('0x65')]):_0x10a38d[_0x9415('0x64')][_0x4562a9]['field']+'\x20'+_0x10a38d[_0x9415('0x64')][_0x4562a9]['condition']+(_0x3eec3b(_0x10a38d['rules'][_0x4562a9][_0x9415('0x67')])?'\x20'+_0x10a38d['rules'][_0x4562a9][_0x9415('0x68')]:'');}return _0x32b709+')';};var _0x4c37f8={'where':{'id':_0x8a2383['id']}},_0x2f2638,_0x4487b5,_0x4245f8,_0x552f21,_0x5be4f0;_0x4c37f8=_[_0x9415('0x3e')]({},_0x4c37f8,_0x1b228e);return db['AnalyticCustomReport'][_0x9415('0x47')](_0x4c37f8)[_0x9415('0x25')](function(_0x28acc3){if(_0x28acc3){_0x2f2638=_0x28acc3;return _0x28acc3[_0x9415('0x8c')]();}return null;})['then'](function(_0x3ef552){if(_0x3ef552){if(!_0x3ef552[_0x9415('0x36')]){throw new db[(_0x9415('0x69'))][(_0x9415('0x6a'))](_0x9415('0x6b'),0x193);}_0x4487b5=_0x3ef552;return db[_0x9415('0x6c')]['findAll']({'raw':!![]});}return null;})[_0x9415('0x25')](function(_0x3934a0){if(_0x3934a0){_0x4245f8=_[_0x9415('0x6d')](_0x3934a0,'id');var _0x50cb1a;var _0x23d6ee=squel[_0x9415('0x6e')]();_0x23d6ee[_0x9415('0x6f')](_0x2f2638[_0x9415('0x70')]);for(var _0x41b494=0x0;_0x41b494<_0x4487b5['length'];_0x41b494+=0x1){_0x50cb1a=_0x4487b5[_0x41b494][_0x9415('0x71')]?_0x4245f8[_0x4487b5[_0x41b494][_0x9415('0x71')]][_0x9415('0x72')]:_0x4487b5[_0x41b494][_0x9415('0x66')];_0x50cb1a=_0x4487b5[_0x41b494][_0x9415('0x73')]?_[_0x9415('0x74')](_0x58c13d[_0x4487b5[_0x41b494]['function']],'%s',_0x50cb1a):_0x50cb1a;_0x50cb1a=_0x4487b5[_0x41b494][_0x9415('0x75')]?_[_0x9415('0x74')](_0xce6fb0[_0x4487b5[_0x41b494][_0x9415('0x75')]],'%s',_0x50cb1a):_0x50cb1a;if(_0x4487b5[_0x41b494][_0x9415('0x8d')]){_0x23d6ee[_0x9415('0x65')](_0x50cb1a);}_0x4487b5[_0x41b494][_0x9415('0x76')]&&_0x23d6ee[_0x9415('0x38')](_0x50cb1a,_0x4487b5[_0x41b494]['orderBy']==='DESC'?![]:!![]);_0x23d6ee[_0x9415('0x66')](_0x50cb1a,_0x4487b5[_0x41b494][_0x9415('0x77')]||_0x50cb1a);}if(_0x2f2638[_0x9415('0x78')]){_0x2f2638[_0x9415('0x78')]=JSON[_0x9415('0x79')](_0x2f2638[_0x9415('0x78')]);for(var _0x571ae2=0x0;_0x571ae2<_0x2f2638['joins'][_0x9415('0x36')];_0x571ae2+=0x1){if(_0x2f2638[_0x9415('0x78')][_0x571ae2][_0x9415('0x2d')]&&_[_0x9415('0x8a')](_0x4fea59,_0x2f2638['joins'][_0x571ae2]['type'])&&_0x2f2638[_0x9415('0x78')][_0x571ae2][_0x9415('0x7a')]&&_0x2f2638[_0x9415('0x78')][_0x571ae2][_0x9415('0x7c')]&&_0x2f2638[_0x9415('0x78')][_0x571ae2][_0x9415('0x7b')]){_0x23d6ee[_0x2f2638['joins'][_0x571ae2][_0x9415('0x2d')]](_0x2f2638['joins'][_0x571ae2][_0x9415('0x7c')],null,util[_0x9415('0x75')](_0x9415('0x7d'),_0x2f2638[_0x9415('0x70')],_0x2f2638['joins'][_0x571ae2]['parentKey'],_0x2f2638[_0x9415('0x78')][_0x571ae2]['foreignTable'],_0x2f2638[_0x9415('0x78')][_0x571ae2][_0x9415('0x7b')]));}}}if(_0x2f2638[_0x9415('0x7e')]){_0x2f2638[_0x9415('0x7e')]=JSON[_0x9415('0x79')](_0x2f2638[_0x9415('0x7e')]);_0x23d6ee[_0x9415('0x3d')](_0x419eee(_0x2f2638[_0x9415('0x7e')][_0x9415('0x65')]));}_0x5be4f0=_0x23d6ee['clone']();_0x23d6ee[_0x9415('0x1d')](_0xd16b87);_0x23d6ee['offset'](0x0);return;}})[_0x9415('0x25')](function(){if(_0x13e2ed[_0x9415('0x8e')]===_0x9415('0x8f')){return null;}var _0x5c6651=_[_0x9415('0x3e')](_0x13e2ed,{'name':_0x13e2ed[_0x9415('0x90')]||_0x13e2ed[_0x9415('0x29')]||_0x2f2638[_0x9415('0x29')],'basename':_0x280181,'savename':util[_0x9415('0x75')](_0x9415('0x91'),_0x13e2ed[_0x9415('0x29')]||_0x2f2638[_0x9415('0x29')],require('randomstring')[_0x9415('0x92')](0x4),_0x13e2ed[_0x9415('0x8e')]||_0x9415('0x93')),'reportId':_0x2f2638['id'],'reportType':_0x9415('0x94')});return db['AnalyticExtractedReport'][_0x9415('0x48')](_0x5c6651,{'raw':!![]});})['then'](function(_0x4ef66c){if(_0x2f2638['table']==='cdr'){_0x5be4f0[_0x9415('0x3d')](_0x2f2638[_0x9415('0x70')]+_0x9415('0x95'),_0x13e2ed['startDate'],_0x13e2ed[_0x9415('0x96')]);}else{_0x5be4f0['where'](_0x2f2638[_0x9415('0x70')]+_0x9415('0x97'),_0x13e2ed[_0x9415('0x98')],_0x13e2ed[_0x9415('0x96')]);}if(_0x4ef66c){logger[_0x9415('0x99')]('Run\x20Query:',_0x5be4f0[_0x9415('0x81')]());require(_0x9415('0x9a'))[_0x9415('0x9b')](path[_0x9415('0x54')](__dirname,_0x9415('0x9c'),_0x4ef66c[_0x9415('0x8e')]),[_0x4ef66c['id'],_0x5be4f0[_0x9415('0x81')](),path[_0x9415('0x54')](__dirname,_0x9415('0x9d'),_0x4ef66c['savename']),_0x280181]);return _0x4ef66c;}else{var _0x4cdf14=squel['select']();_0x4cdf14[_0x9415('0x6f')]('('+_0x5be4f0[_0x9415('0x81')]()+')','countTable');_0x4cdf14[_0x9415('0x66')](_0x9415('0x9e'),_0x9415('0x1e'));_0x5be4f0[_0x9415('0x1d')](_0x13e2ed['limit']||_0xd16b87);_0x5be4f0[_0x9415('0x1b')](_0x13e2ed['offset']||0x0);return dbH[_0x9415('0x82')][_0x9415('0x31')](_0x4cdf14['toString'](),{'type':dbH[_0x9415('0x82')][_0x9415('0x83')][_0x9415('0x84')]})[_0x9415('0x25')](function(_0x3583d9){if(!_0x3583d9[_0x9415('0x36')]){_0x552f21=0x0;}else{_0x552f21=_0x3583d9[0x0]['count']||0x0;}return dbH[_0x9415('0x82')][_0x9415('0x31')](_0x5be4f0[_0x9415('0x81')](),{'type':dbH[_0x9415('0x82')]['QueryTypes'][_0x9415('0x84')]});})['then'](function(_0x1b3679){return{'rows':_0x1b3679||[],'count':_0x552f21};});}});}exports[_0x9415('0x9f')]=function(_0xe0e521,_0x29f581){return runReport(_0xe0e521[_0x9415('0x46')],_0xe0e521[_0x9415('0x31')],_0xe0e521['options'])[_0x9415('0x25')](respondWithResult(_0x29f581,null))['catch'](handleError(_0x29f581,null));};exports[_0x9415('0xa0')]=runReport;exports[_0x9415('0x31')]=function(_0x4299bb,_0x1eaab0){var _0x13fed2=0xa;var _0x90a04=[_0x9415('0x54'),_0x9415('0x85'),_0x9415('0x55'),_0x9415('0x56')];var _0x112b24={'SUM':'SUM(%s)','COUNT':'COUNT(%s)','COUNT DISTINCT':_0x9415('0x87'),'MAX':_0x9415('0x58'),'MIN':_0x9415('0xa1'),'AVG':_0x9415('0x59'),'GROUP_CONCAT':_0x9415('0x5a'),'GROUP_CONCAT ASC':_0x9415('0x5b'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x27e3ab={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x9415('0x5e'),'HOUR':_0x9415('0x88'),'ROUND':_0x9415('0x5f'),'UNIX_TIMESTAMP':_0x9415('0x89')};var _0x408eeb=function(_0x3aeab2){return!_[_0x9415('0x8a')]([_0x9415('0x60'),_0x9415('0x61'),'IS\x20EMPTY','IS\x20NOT\x20EMPTY'],_0x3aeab2);};var _0x5b9df7=function(_0x478e1e){if(!_0x478e1e||!_0x478e1e[_0x9415('0x64')]['length']){return'';}for(var _0x579f87='(',_0x53128c=0x0;_0x53128c<_0x478e1e[_0x9415('0x64')][_0x9415('0x36')];_0x53128c+=0x1){_0x53128c>0x0&&(_0x579f87+='\x20'+_0x478e1e[_0x9415('0x8b')]+'\x20');_0x579f87+=_0x478e1e[_0x9415('0x64')][_0x53128c]['group']?_0x5b9df7(_0x478e1e[_0x9415('0x64')][_0x53128c][_0x9415('0x65')]):_0x478e1e[_0x9415('0x64')][_0x53128c][_0x9415('0x66')]+'\x20'+_0x478e1e[_0x9415('0x64')][_0x53128c][_0x9415('0x67')]+(_0x408eeb(_0x478e1e[_0x9415('0x64')][_0x53128c]['condition'])?'\x20'+_0x478e1e[_0x9415('0x64')][_0x53128c][_0x9415('0x68')]:'');}return _0x579f87+')';};var _0x2c5fae={'where':{'id':_0x4299bb[_0x9415('0x46')]['id']}},_0x1034f7,_0x41972b,_0x3513c7,_0x5e1af9,_0x506998;_0x2c5fae=_['merge']({},_0x2c5fae,_0x4299bb[_0x9415('0x40')]);return db['AnalyticCustomReport'][_0x9415('0x47')](_0x2c5fae)[_0x9415('0x25')](function(_0x2151a5){if(_0x2151a5){_0x1034f7=_0x2151a5;return _0x2151a5[_0x9415('0x8c')]();}return null;})['then'](function(_0x2f3258){if(_0x2f3258){if(!_0x2f3258[_0x9415('0x36')]){throw new db[(_0x9415('0x69'))][(_0x9415('0x6a'))](_0x9415('0x6b'),0x193);}_0x41972b=_0x2f3258;return db['AnalyticMetric'][_0x9415('0xa2')]({'raw':!![]});}return null;})[_0x9415('0x25')](function(_0x34b294){if(_0x34b294){_0x3513c7=_[_0x9415('0x6d')](_0x34b294,'id');var _0x2e656d;var _0x1d501d=squel[_0x9415('0x6e')]();_0x1d501d[_0x9415('0x6f')](_0x1034f7[_0x9415('0x70')]);for(var _0x59e4b7=0x0;_0x59e4b7<_0x41972b[_0x9415('0x36')];_0x59e4b7+=0x1){_0x2e656d=_0x41972b[_0x59e4b7][_0x9415('0x71')]?_0x3513c7[_0x41972b[_0x59e4b7][_0x9415('0x71')]]['metric']:_0x41972b[_0x59e4b7][_0x9415('0x66')];_0x2e656d=_0x41972b[_0x59e4b7][_0x9415('0x73')]?_[_0x9415('0x74')](_0x112b24[_0x41972b[_0x59e4b7]['function']],'%s',_0x2e656d):_0x2e656d;_0x2e656d=_0x41972b[_0x59e4b7]['format']?_['replace'](_0x27e3ab[_0x41972b[_0x59e4b7][_0x9415('0x75')]],'%s',_0x2e656d):_0x2e656d;if(_0x41972b[_0x59e4b7][_0x9415('0x8d')]){_0x1d501d[_0x9415('0x65')](_0x2e656d);}_0x41972b[_0x59e4b7]['orderBy']&&_0x1d501d[_0x9415('0x38')](_0x2e656d,_0x41972b[_0x59e4b7]['orderBy']===_0x9415('0xa3')?![]:!![]);_0x1d501d['field'](_0x2e656d,_0x41972b[_0x59e4b7]['alias']||_0x2e656d);}if(_0x1034f7['joins']){_0x1034f7[_0x9415('0x78')]=JSON[_0x9415('0x79')](_0x1034f7[_0x9415('0x78')]);for(var _0x1dfda9=0x0;_0x1dfda9<_0x1034f7[_0x9415('0x78')][_0x9415('0x36')];_0x1dfda9+=0x1){if(_0x1034f7[_0x9415('0x78')][_0x1dfda9][_0x9415('0x2d')]&&_['includes'](_0x90a04,_0x1034f7['joins'][_0x1dfda9][_0x9415('0x2d')])&&_0x1034f7[_0x9415('0x78')][_0x1dfda9]['parentKey']&&_0x1034f7[_0x9415('0x78')][_0x1dfda9][_0x9415('0x7c')]&&_0x1034f7[_0x9415('0x78')][_0x1dfda9][_0x9415('0x7b')]){_0x1d501d[_0x1034f7[_0x9415('0x78')][_0x1dfda9]['type']](_0x1034f7[_0x9415('0x78')][_0x1dfda9][_0x9415('0x7c')],null,util['format']('%s.%s\x20=\x20%s.%s',_0x1034f7[_0x9415('0x70')],_0x1034f7['joins'][_0x1dfda9][_0x9415('0x7a')],_0x1034f7[_0x9415('0x78')][_0x1dfda9]['foreignTable'],_0x1034f7['joins'][_0x1dfda9][_0x9415('0x7b')]));}}}if(_0x1034f7[_0x9415('0x7e')]){_0x1034f7[_0x9415('0x7e')]=JSON[_0x9415('0x79')](_0x1034f7[_0x9415('0x7e')]);_0x1d501d[_0x9415('0x3d')](_0x5b9df7(_0x1034f7['conditions'][_0x9415('0x65')]));}_0x506998=_0x1d501d['clone']();_0x1d501d[_0x9415('0x1d')](_0x13fed2);_0x1d501d[_0x9415('0x1b')](0x0);logger[_0x9415('0x80')](_0x9415('0xa4'),_0x1d501d['toString']());return dbH[_0x9415('0x82')][_0x9415('0x31')](_0x1d501d[_0x9415('0x81')](),{'type':dbH[_0x9415('0x82')][_0x9415('0x83')][_0x9415('0x84')]});}})['then'](function(){return{'sql':_0x506998[_0x9415('0x81')]()};})[_0x9415('0x25')](respondWithResult(_0x1eaab0,null))[_0x9415('0x44')](handleError(_0x1eaab0,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index 7af897b..2d6512c 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 _0xbb4f=['rimraf','../../config/environment','./analyticCustomReport.attributes','exports','define','AnalyticCustomReport','analytics_custom_reports','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x2a7b8f,_0x2a4c6a){var _0x467b8=function(_0x3c0cbc){while(--_0x3c0cbc){_0x2a7b8f['push'](_0x2a7b8f['shift']());}};_0x467b8(++_0x2a4c6a);}(_0xbb4f,0x10b));var _0xfbb4=function(_0x4e8210,_0x26f275){_0x4e8210=_0x4e8210-0x0;var _0x3edabc=_0xbb4f[_0x4e8210];return _0x3edabc;};'use strict';var _=require(_0xfbb4('0x0'));var util=require('util');var logger=require(_0xfbb4('0x1'))(_0xfbb4('0x2'));var moment=require(_0xfbb4('0x3'));var BPromise=require(_0xfbb4('0x4'));var rp=require(_0xfbb4('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xfbb4('0x6'));var config=require(_0xfbb4('0x7'));var attributes=require(_0xfbb4('0x8'));module[_0xfbb4('0x9')]=function(_0x1a8604,_0x44cc45){return _0x1a8604[_0xfbb4('0xa')](_0xfbb4('0xb'),attributes,{'tableName':_0xfbb4('0xc'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x96a6=['AnalyticCustomReport','analytics_custom_reports','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./analyticCustomReport.attributes','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x96a6,0x128));var _0x696a=function(_0x16d10f,_0x2ba2d5){_0x16d10f=_0x16d10f-0x0;var _0x50c823=_0x96a6[_0x16d10f];return _0x50c823;};'use strict';var _=require(_0x696a('0x0'));var util=require(_0x696a('0x1'));var logger=require(_0x696a('0x2'))(_0x696a('0x3'));var moment=require(_0x696a('0x4'));var BPromise=require(_0x696a('0x5'));var rp=require(_0x696a('0x6'));var fs=require('fs');var path=require(_0x696a('0x7'));var rimraf=require(_0x696a('0x8'));var config=require(_0x696a('0x9'));var attributes=require(_0x696a('0xa'));module[_0x696a('0xb')]=function(_0x469cc9,_0x309129){return _0x469cc9['define'](_0x696a('0xc'),attributes,{'tableName':_0x696a('0xd'),'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 5937918..9ece6f5 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 _0x2fd9=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','stringify','error','code','AnalyticCustomReport,\x20%s,\x20%s','message','result','bluebird','ioredis','../../mysqldb','../../config/utils'];(function(_0x324e86,_0x81b1cb){var _0x592846=function(_0x33439c){while(--_0x33439c){_0x324e86['push'](_0x324e86['shift']());}};_0x592846(++_0x81b1cb);}(_0x2fd9,0x114));var _0x92fd=function(_0x2bfd90,_0x102539){_0x2bfd90=_0x2bfd90-0x0;var _0x33e709=_0x2fd9[_0x2bfd90];return _0x33e709;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x92fd('0x0'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x92fd('0x1'));var db=require(_0x92fd('0x2'))['db'];var utils=require(_0x92fd('0x3'));var logger=require(_0x92fd('0x4'))(_0x92fd('0x5'));var config=require(_0x92fd('0x6'));var jayson=require(_0x92fd('0x7'));var client=jayson[_0x92fd('0x8')][_0x92fd('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x50533a,_0x52f35a,_0x2e4657){return new BPromise(function(_0x1c8271,_0x4a4b87){return client[_0x92fd('0xa')](_0x50533a,_0x2e4657)[_0x92fd('0xb')](function(_0x562957){logger['info']('AnalyticCustomReport,\x20%s,\x20%s',_0x52f35a,_0x92fd('0xc'));logger[_0x92fd('0xd')]('AnalyticCustomReport,\x20%s,\x20%s,\x20%s',_0x52f35a,_0x92fd('0xc'),JSON[_0x92fd('0xe')](_0x562957));if(_0x562957['error']){if(_0x562957[_0x92fd('0xf')][_0x92fd('0x10')]===0x1f4){logger[_0x92fd('0xf')](_0x92fd('0x11'),_0x52f35a,_0x562957[_0x92fd('0xf')][_0x92fd('0x12')]);return _0x4a4b87(_0x562957[_0x92fd('0xf')][_0x92fd('0x12')]);}logger[_0x92fd('0xf')](_0x92fd('0x11'),_0x52f35a,_0x562957[_0x92fd('0xf')]['message']);return _0x1c8271(_0x562957[_0x92fd('0xf')][_0x92fd('0x12')]);}else{logger['info'](_0x92fd('0x11'),_0x52f35a,'request\x20sent');_0x1c8271(_0x562957[_0x92fd('0x13')][_0x92fd('0x12')]);}})['catch'](function(_0x3fa5b9){logger[_0x92fd('0xf')]('AnalyticCustomReport,\x20%s,\x20%s',_0x52f35a,_0x3fa5b9);_0x4a4b87(_0x3fa5b9);});});} \ No newline at end of file +var _0xfd0c=['request\x20sent','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','AnalyticCustomReport,\x20%s,\x20%s'];(function(_0xce2d7e,_0x56dac4){var _0x3143d9=function(_0x52633b){while(--_0x52633b){_0xce2d7e['push'](_0xce2d7e['shift']());}};_0x3143d9(++_0x56dac4);}(_0xfd0c,0x179));var _0xcfd0=function(_0x46ef1d,_0x24926){_0x46ef1d=_0x46ef1d-0x0;var _0x49ce69=_0xfd0c[_0x46ef1d];return _0x49ce69;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xcfd0('0x0'));var BPromise=require(_0xcfd0('0x1'));var rs=require(_0xcfd0('0x2'));var fs=require('fs');var Redis=require(_0xcfd0('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xcfd0('0x4'));var logger=require(_0xcfd0('0x5'))(_0xcfd0('0x6'));var config=require(_0xcfd0('0x7'));var jayson=require(_0xcfd0('0x8'));var client=jayson[_0xcfd0('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2b16b1,_0xe0c6d7,_0xaed066){return new BPromise(function(_0x2113e7,_0x4cf61c){return client[_0xcfd0('0xa')](_0x2b16b1,_0xaed066)[_0xcfd0('0xb')](function(_0x3d3d25){logger[_0xcfd0('0xc')](_0xcfd0('0xd'),_0xe0c6d7,_0xcfd0('0xe'));logger[_0xcfd0('0xf')](_0xcfd0('0x10'),_0xe0c6d7,_0xcfd0('0xe'),JSON[_0xcfd0('0x11')](_0x3d3d25));if(_0x3d3d25[_0xcfd0('0x12')]){if(_0x3d3d25[_0xcfd0('0x12')][_0xcfd0('0x13')]===0x1f4){logger[_0xcfd0('0x12')]('AnalyticCustomReport,\x20%s,\x20%s',_0xe0c6d7,_0x3d3d25['error']['message']);return _0x4cf61c(_0x3d3d25['error']['message']);}logger[_0xcfd0('0x12')](_0xcfd0('0xd'),_0xe0c6d7,_0x3d3d25[_0xcfd0('0x12')][_0xcfd0('0x14')]);return _0x2113e7(_0x3d3d25[_0xcfd0('0x12')][_0xcfd0('0x14')]);}else{logger[_0xcfd0('0xc')]('AnalyticCustomReport,\x20%s,\x20%s',_0xe0c6d7,_0xcfd0('0xe'));_0x2113e7(_0x3d3d25[_0xcfd0('0x15')]['message']);}})[_0xcfd0('0x16')](function(_0x3cc2c3){logger['error']('AnalyticCustomReport,\x20%s,\x20%s',_0xe0c6d7,_0x3cc2c3);_0x4cf61c(_0x3cc2c3);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index 11bed6c..7cf70c4 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 _0x8297=['show','get','/:id/preview','preview','/:id/run','run','/:id/query','create','put','update','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticCustomReport.controller','isAuthenticated','/:id'];(function(_0x4bca31,_0x394def){var _0x49816d=function(_0xfe82d5){while(--_0xfe82d5){_0x4bca31['push'](_0x4bca31['shift']());}};_0x49816d(++_0x394def);}(_0x8297,0x18c));var _0x7829=function(_0x19b50b,_0x34d7ba){_0x19b50b=_0x19b50b-0x0;var _0x2ac4f3=_0x8297[_0x19b50b];return _0x2ac4f3;};'use strict';var multer=require(_0x7829('0x0'));var util=require(_0x7829('0x1'));var path=require(_0x7829('0x2'));var timeout=require(_0x7829('0x3'));var express=require('express');var router=express[_0x7829('0x4')]();var fs_extra=require(_0x7829('0x5'));var auth=require(_0x7829('0x6'));var interaction=require(_0x7829('0x7'));var config=require(_0x7829('0x8'));var controller=require(_0x7829('0x9'));router['get']('/',auth[_0x7829('0xa')](),controller['index']);router['get'](_0x7829('0xb'),auth[_0x7829('0xa')](),controller[_0x7829('0xc')]);router[_0x7829('0xd')](_0x7829('0xe'),auth[_0x7829('0xa')](),controller[_0x7829('0xf')]);router[_0x7829('0xd')](_0x7829('0x10'),auth[_0x7829('0xa')](),controller[_0x7829('0x11')]);router[_0x7829('0xd')](_0x7829('0x12'),auth[_0x7829('0xa')](),controller['query']);router['post']('/',auth[_0x7829('0xa')](),controller[_0x7829('0x13')]);router[_0x7829('0x14')](_0x7829('0xb'),auth['isAuthenticated'](),controller[_0x7829('0x15')]);router['delete'](_0x7829('0xb'),auth['isAuthenticated'](),controller[_0x7829('0x16')]);module[_0x7829('0x17')]=router; \ No newline at end of file +var _0x1d39=['create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./analyticCustomReport.controller','get','isAuthenticated','index','/:id','/:id/preview','preview','/:id/run','run','/:id/query','query','post'];(function(_0x5d4607,_0x6b5e7b){var _0x5e4a86=function(_0x46891a){while(--_0x46891a){_0x5d4607['push'](_0x5d4607['shift']());}};_0x5e4a86(++_0x6b5e7b);}(_0x1d39,0x72));var _0x91d3=function(_0x102f0a,_0x13474d){_0x102f0a=_0x102f0a-0x0;var _0x35e503=_0x1d39[_0x102f0a];return _0x35e503;};'use strict';var multer=require(_0x91d3('0x0'));var util=require(_0x91d3('0x1'));var path=require(_0x91d3('0x2'));var timeout=require(_0x91d3('0x3'));var express=require(_0x91d3('0x4'));var router=express[_0x91d3('0x5')]();var fs_extra=require(_0x91d3('0x6'));var auth=require(_0x91d3('0x7'));var interaction=require(_0x91d3('0x8'));var config=require('../../config/environment');var controller=require(_0x91d3('0x9'));router[_0x91d3('0xa')]('/',auth[_0x91d3('0xb')](),controller[_0x91d3('0xc')]);router[_0x91d3('0xa')](_0x91d3('0xd'),auth['isAuthenticated'](),controller['show']);router[_0x91d3('0xa')](_0x91d3('0xe'),auth[_0x91d3('0xb')](),controller[_0x91d3('0xf')]);router[_0x91d3('0xa')](_0x91d3('0x10'),auth[_0x91d3('0xb')](),controller[_0x91d3('0x11')]);router[_0x91d3('0xa')](_0x91d3('0x12'),auth[_0x91d3('0xb')](),controller[_0x91d3('0x13')]);router[_0x91d3('0x14')]('/',auth['isAuthenticated'](),controller[_0x91d3('0x15')]);router[_0x91d3('0x16')]('/:id',auth[_0x91d3('0xb')](),controller[_0x91d3('0x17')]);router[_0x91d3('0x18')]('/:id',auth[_0x91d3('0xb')](),controller[_0x91d3('0x19')]);module[_0x91d3('0x1a')]=router; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js index 926fd61..413735c 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 _0x33c5=['STRING','TEXT','exports'];(function(_0x419876,_0x2905d6){var _0xd7f3d8=function(_0xa2e0ca){while(--_0xa2e0ca){_0x419876['push'](_0x419876['shift']());}};_0xd7f3d8(++_0x2905d6);}(_0x33c5,0xe6));var _0x533c=function(_0xd5160a,_0x572c4b){_0xd5160a=_0xd5160a-0x0;var _0x576cf9=_0x33c5[_0xd5160a];return _0x576cf9;};'use strict';var Sequelize=require('sequelize');module[_0x533c('0x0')]={'name':{'type':Sequelize[_0x533c('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize[_0x533c('0x1')]},'table':{'type':Sequelize[_0x533c('0x1')]},'conditions':{'type':Sequelize[_0x533c('0x2')]},'joins':{'type':Sequelize[_0x533c('0x2')]}}; \ No newline at end of file +var _0x33c5=['STRING','TEXT','exports'];(function(_0x541a43,_0x1c647e){var _0x322b5e=function(_0x23a468){while(--_0x23a468){_0x541a43['push'](_0x541a43['shift']());}};_0x322b5e(++_0x1c647e);}(_0x33c5,0xe6));var _0x533c=function(_0x1a4cac,_0x116f47){_0x1a4cac=_0x1a4cac-0x0;var _0x142f2f=_0x33c5[_0x1a4cac];return _0x142f2f;};'use strict';var Sequelize=require('sequelize');module[_0x533c('0x0')]={'name':{'type':Sequelize[_0x533c('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize[_0x533c('0x1')]},'table':{'type':Sequelize[_0x533c('0x1')]},'conditions':{'type':Sequelize[_0x533c('0x2')]},'joins':{'type':Sequelize[_0x533c('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index dfe3d7a..bfbaafe 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 _0x5fab=['debug','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','COUNT(DISTINCT\x20%s)','from','function','order','output','web','fullPath','%s-%s.%s','randomstring','generate','csv','default','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','Run\x20Query:','child_process','fork','../../components/export/','../../files/reports','savename','countTable','run','params','runReport','AVG(%s)','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','dbH','status','end','limit','undefined','count','offset','Content-Range','apply','save','update','then','destroy','get','DefaultReports','UserProfileResource','sendStatus','error','stack','name','send','index','map','AnalyticDefaultReport','rawAttributes','type','keys','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','query','where','pick','filters','filter','VIRTUAL','merge','options','include','findAll','rows','catch','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','preview','join','left_join','right_join','cross_join','SUM(%s)','COUNT(%s)','MAX(%s)','MIN(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','value','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','table','MetricId','metric','replace','format','groupBy','orderBy','DESC','alias','joins','parentKey','foreignKey','foreignTable','%s.%s\x20=\x20%s.%s','conditions','parse','clone'];(function(_0x2bd263,_0x56818c){var _0x9e64d0=function(_0x503583){while(--_0x503583){_0x2bd263['push'](_0x2bd263['shift']());}};_0x9e64d0(++_0x56818c);}(_0x5fab,0x177));var _0xb5fa=function(_0x37b07c,_0x5941a1){_0x37b07c=_0x37b07c-0x0;var _0x264672=_0x5fab[_0x37b07c];return _0x264672;};'use strict';var emlformat=require(_0xb5fa('0x0'));var rimraf=require(_0xb5fa('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb5fa('0x2'));var rp=require(_0xb5fa('0x3'));var moment=require(_0xb5fa('0x4'));var BPromise=require(_0xb5fa('0x5'));var Mustache=require(_0xb5fa('0x6'));var util=require(_0xb5fa('0x7'));var path=require(_0xb5fa('0x8'));var sox=require(_0xb5fa('0x9'));var csv=require(_0xb5fa('0xa'));var ejs=require(_0xb5fa('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xb5fa('0xc'));var crypto=require(_0xb5fa('0xd'));var jsforce=require(_0xb5fa('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xb5fa('0xa'));var querystring=require(_0xb5fa('0xf'));var Papa=require(_0xb5fa('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xb5fa('0x11'));var as=require(_0xb5fa('0x12'));var hardwareService=require(_0xb5fa('0x13'));var logger=require(_0xb5fa('0x14'))(_0xb5fa('0x15'));var utils=require(_0xb5fa('0x16'));var config=require(_0xb5fa('0x17'));var licenseUtil=require(_0xb5fa('0x18'));var db=require(_0xb5fa('0x19'))['db'];var dbH=require('../../mysqldb')[_0xb5fa('0x1a')];function respondWithStatusCode(_0x3dad4d,_0x56e8b0){_0x56e8b0=_0x56e8b0||0xcc;return function(_0x116849){if(_0x116849){return _0x3dad4d['sendStatus'](_0x56e8b0);}return _0x3dad4d[_0xb5fa('0x1b')](_0x56e8b0)[_0xb5fa('0x1c')]();};}function respondWithResult(_0x40c914,_0xca8d82){_0xca8d82=_0xca8d82||0xc8;return function(_0x8e9d1c){if(_0x8e9d1c){return _0x40c914['status'](_0xca8d82)['json'](_0x8e9d1c);}};}function respondWithFilteredResult(_0x38e964,_0x587043){return function(_0x31f252){if(_0x31f252){var _0x27c8f7=typeof _0x587043['offset']==='undefined'&&typeof _0x587043[_0xb5fa('0x1d')]===_0xb5fa('0x1e');var _0x32e9e5=_0x31f252[_0xb5fa('0x1f')];var _0x324ba5=_0x27c8f7?0x0:_0x587043[_0xb5fa('0x20')];var _0x3b0f69=_0x27c8f7?_0x31f252[_0xb5fa('0x1f')]:_0x587043[_0xb5fa('0x20')]+_0x587043[_0xb5fa('0x1d')];var _0x3c8d53;if(_0x3b0f69>=_0x32e9e5){_0x3b0f69=_0x32e9e5;_0x3c8d53=0xc8;}else{_0x3c8d53=0xce;}_0x38e964[_0xb5fa('0x1b')](_0x3c8d53);return _0x38e964['set'](_0xb5fa('0x21'),_0x324ba5+'-'+_0x3b0f69+'/'+_0x32e9e5)['json'](_0x31f252);}return null;};}function patchUpdates(_0x37ae06){return function(_0x4a6c04){try{jsonpatch[_0xb5fa('0x22')](_0x4a6c04,_0x37ae06,!![]);}catch(_0x43c09f){return BPromise['reject'](_0x43c09f);}return _0x4a6c04[_0xb5fa('0x23')]();};}function saveUpdates(_0x3a2ab9,_0x283a56){return function(_0x47f71a){if(_0x47f71a){return _0x47f71a[_0xb5fa('0x24')](_0x3a2ab9)[_0xb5fa('0x25')](function(_0x444237){return _0x444237;});}return null;};}function removeEntity(_0x542348,_0x224ec8){return function(_0x5d55f7){if(_0x5d55f7){return _0x5d55f7[_0xb5fa('0x26')]()[_0xb5fa('0x25')](function(){var _0x11053a=_0x5d55f7[_0xb5fa('0x27')]({'plain':!![]});var _0x2dbd22=_0xb5fa('0x28');return db[_0xb5fa('0x29')][_0xb5fa('0x26')]({'where':{'type':_0x2dbd22,'resourceId':_0x11053a['id']}})['then'](function(){return _0x5d55f7;});})['then'](function(){_0x542348['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x28a350,_0x460b54){return function(_0x12c0d4){if(!_0x12c0d4){_0x28a350[_0xb5fa('0x2a')](0x194);}return _0x12c0d4;};}function handleError(_0x534884,_0x3506a4){_0x3506a4=_0x3506a4||0x1f4;return function(_0x358549){logger[_0xb5fa('0x2b')](_0x358549[_0xb5fa('0x2c')]);if(_0x358549[_0xb5fa('0x2d')]){delete _0x358549[_0xb5fa('0x2d')];}_0x534884[_0xb5fa('0x1b')](_0x3506a4)[_0xb5fa('0x2e')](_0x358549);};}exports[_0xb5fa('0x2f')]=function(_0xed02e,_0x116773){var _0x5a0152={},_0x3fd1fb={},_0x21fc7e={'count':0x0,'rows':[]};var _0x319c48=_[_0xb5fa('0x30')](db[_0xb5fa('0x31')][_0xb5fa('0x32')],function(_0x25fc7c){return{'name':_0x25fc7c['fieldName'],'type':_0x25fc7c[_0xb5fa('0x33')]['key']};});_0x3fd1fb['model']=_['map'](_0x319c48,_0xb5fa('0x2d'));_0x3fd1fb['query']=_[_0xb5fa('0x34')](_0xed02e['query']);_0x3fd1fb['filters']=_[_0xb5fa('0x35')](_0x3fd1fb[_0xb5fa('0x36')],_0x3fd1fb['query']);_0x5a0152['attributes']=_[_0xb5fa('0x35')](_0x3fd1fb[_0xb5fa('0x36')],qs[_0xb5fa('0x37')](_0xed02e['query'][_0xb5fa('0x37')]));_0x5a0152[_0xb5fa('0x38')]=_0x5a0152['attributes'][_0xb5fa('0x39')]?_0x5a0152[_0xb5fa('0x38')]:_0x3fd1fb[_0xb5fa('0x36')];if(!_0xed02e['query'][_0xb5fa('0x3a')](_0xb5fa('0x3b'))){_0x5a0152[_0xb5fa('0x1d')]=qs['limit'](_0xed02e[_0xb5fa('0x3c')][_0xb5fa('0x1d')]);_0x5a0152[_0xb5fa('0x20')]=qs[_0xb5fa('0x20')](_0xed02e['query']['offset']);}_0x5a0152['order']=qs['sort'](_0xed02e['query']['sort']);_0x5a0152[_0xb5fa('0x3d')]=qs['filters'](_[_0xb5fa('0x3e')](_0xed02e[_0xb5fa('0x3c')],_0x3fd1fb[_0xb5fa('0x3f')]),_0x319c48);if(_0xed02e[_0xb5fa('0x3c')][_0xb5fa('0x40')]){_0x5a0152[_0xb5fa('0x3d')]=_['merge'](_0x5a0152['where'],{'$or':_['map'](_0x319c48,function(_0x534b38){if(_0x534b38['type']!==_0xb5fa('0x41')){var _0x5addd5={};_0x5addd5[_0x534b38['name']]={'$like':'%'+_0xed02e[_0xb5fa('0x3c')][_0xb5fa('0x40')]+'%'};return _0x5addd5;}})});}_0x5a0152=_[_0xb5fa('0x42')]({},_0x5a0152,_0xed02e[_0xb5fa('0x43')]);var _0x5bc93f={'where':_0x5a0152[_0xb5fa('0x3d')]};return db[_0xb5fa('0x31')][_0xb5fa('0x1f')](_0x5bc93f)[_0xb5fa('0x25')](function(_0x402a68){_0x21fc7e['count']=_0x402a68;if(_0xed02e[_0xb5fa('0x3c')]['includeAll']){_0x5a0152[_0xb5fa('0x44')]=[{'all':!![]}];}return db[_0xb5fa('0x31')][_0xb5fa('0x45')](_0x5a0152);})[_0xb5fa('0x25')](function(_0x1c706b){_0x21fc7e[_0xb5fa('0x46')]=_0x1c706b;return _0x21fc7e;})[_0xb5fa('0x25')](respondWithFilteredResult(_0x116773,_0x5a0152))[_0xb5fa('0x47')](handleError(_0x116773,null));};exports['show']=function(_0x1c3c2c,_0xc03e44){var _0x59ae64={'raw':!![],'where':{'id':_0x1c3c2c['params']['id']}},_0x293c19={};_0x293c19[_0xb5fa('0x36')]=_[_0xb5fa('0x34')](db['AnalyticDefaultReport']['rawAttributes']);_0x293c19[_0xb5fa('0x3c')]=_[_0xb5fa('0x34')](_0x1c3c2c[_0xb5fa('0x3c')]);_0x293c19[_0xb5fa('0x3f')]=_[_0xb5fa('0x35')](_0x293c19[_0xb5fa('0x36')],_0x293c19[_0xb5fa('0x3c')]);_0x59ae64[_0xb5fa('0x38')]=_['intersection'](_0x293c19[_0xb5fa('0x36')],qs[_0xb5fa('0x37')](_0x1c3c2c['query'][_0xb5fa('0x37')]));_0x59ae64[_0xb5fa('0x38')]=_0x59ae64[_0xb5fa('0x38')][_0xb5fa('0x39')]?_0x59ae64[_0xb5fa('0x38')]:_0x293c19[_0xb5fa('0x36')];if(_0x1c3c2c[_0xb5fa('0x3c')][_0xb5fa('0x48')]){_0x59ae64[_0xb5fa('0x44')]=[{'all':!![]}];}_0x59ae64=_[_0xb5fa('0x42')]({},_0x59ae64,_0x1c3c2c[_0xb5fa('0x43')]);return db[_0xb5fa('0x31')][_0xb5fa('0x49')](_0x59ae64)[_0xb5fa('0x25')](handleEntityNotFound(_0xc03e44,null))[_0xb5fa('0x25')](respondWithResult(_0xc03e44,null))[_0xb5fa('0x47')](handleError(_0xc03e44,null));};exports['create']=function(_0x56dceb,_0x46194d){return db['AnalyticDefaultReport'][_0xb5fa('0x4a')](_0x56dceb[_0xb5fa('0x4b')],{})['then'](function(_0x4ef1d0){var _0x2931a7=_0x56dceb[_0xb5fa('0x4c')][_0xb5fa('0x27')]({'plain':!![]});if(!_0x2931a7)throw new Error(_0xb5fa('0x4d'));if(_0x2931a7[_0xb5fa('0x4e')]==='user'){var _0x27a651=_0x4ef1d0['get']({'plain':!![]});var _0x251d36=_0xb5fa('0x4f');return db[_0xb5fa('0x50')]['find']({'where':{'name':_0x251d36,'userProfileId':_0x2931a7[_0xb5fa('0x51')]},'raw':!![]})[_0xb5fa('0x25')](function(_0x4dea87){if(_0x4dea87&&_0x4dea87['autoAssociation']===0x0){return db[_0xb5fa('0x29')][_0xb5fa('0x4a')]({'name':_0x27a651[_0xb5fa('0x2d')],'resourceId':_0x27a651['id'],'type':_0xb5fa('0x28'),'sectionId':_0x4dea87['id']},{})[_0xb5fa('0x25')](function(){return _0x4ef1d0;});}else{return _0x4ef1d0;}})[_0xb5fa('0x47')](function(_0x31c91f){logger[_0xb5fa('0x2b')](_0xb5fa('0x52'),_0x31c91f);throw _0x31c91f;});}return _0x4ef1d0;})[_0xb5fa('0x25')](respondWithResult(_0x46194d,0xc9))[_0xb5fa('0x47')](handleError(_0x46194d,null));};exports[_0xb5fa('0x24')]=function(_0x3ccfd1,_0x2799e7){if(_0x3ccfd1[_0xb5fa('0x4b')]['id']){delete _0x3ccfd1[_0xb5fa('0x4b')]['id'];}return db[_0xb5fa('0x31')][_0xb5fa('0x49')]({'where':{'id':_0x3ccfd1['params']['id']}})[_0xb5fa('0x25')](handleEntityNotFound(_0x2799e7,null))[_0xb5fa('0x25')](saveUpdates(_0x3ccfd1[_0xb5fa('0x4b')],null))[_0xb5fa('0x25')](respondWithResult(_0x2799e7,null))[_0xb5fa('0x47')](handleError(_0x2799e7,null));};exports[_0xb5fa('0x26')]=function(_0x4224cf,_0x24117e){return db[_0xb5fa('0x31')][_0xb5fa('0x49')]({'where':{'id':_0x4224cf['params']['id']}})['then'](handleEntityNotFound(_0x24117e,null))[_0xb5fa('0x25')](removeEntity(_0x24117e,null))[_0xb5fa('0x47')](handleError(_0x24117e,null));};exports[_0xb5fa('0x53')]=function(_0x5caf84,_0x441c41){var _0x367f7a=0xa;var _0x1572fb=[_0xb5fa('0x54'),_0xb5fa('0x55'),_0xb5fa('0x56'),_0xb5fa('0x57')];var _0x4f82f0={'SUM':_0xb5fa('0x58'),'COUNT':_0xb5fa('0x59'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0xb5fa('0x5a'),'MIN':_0xb5fa('0x5b'),'AVG':'AVG(%s)','GROUP_CONCAT':_0xb5fa('0x5c'),'GROUP_CONCAT ASC':_0xb5fa('0x5d'),'GROUP_CONCAT DESC':_0xb5fa('0x5e')};var _0x2b9a45={'SEC_TO_TIME':_0xb5fa('0x5f'),'DATE':_0xb5fa('0x60'),'HOUR':_0xb5fa('0x61'),'ROUND':_0xb5fa('0x62'),'UNIX_TIMESTAMP':_0xb5fa('0x63')};var _0x1c24e3=function(_0xfb88cc){return!_[_0xb5fa('0x64')]([_0xb5fa('0x65'),_0xb5fa('0x66'),_0xb5fa('0x67'),_0xb5fa('0x68')],_0xfb88cc);};var _0x41cce9=function(_0x23fb01){if(!_0x23fb01||!_0x23fb01[_0xb5fa('0x69')][_0xb5fa('0x39')]){return'';}for(var _0x421a93='(',_0x36fc0f=0x0;_0x36fc0f<_0x23fb01['rules'][_0xb5fa('0x39')];_0x36fc0f+=0x1){_0x36fc0f>0x0&&(_0x421a93+='\x20'+_0x23fb01[_0xb5fa('0x6a')]+'\x20');_0x421a93+=_0x23fb01[_0xb5fa('0x69')][_0x36fc0f]['group']?_0x41cce9(_0x23fb01[_0xb5fa('0x69')][_0x36fc0f][_0xb5fa('0x6b')]):_0x23fb01['rules'][_0x36fc0f][_0xb5fa('0x6c')]+'\x20'+_0x23fb01[_0xb5fa('0x69')][_0x36fc0f][_0xb5fa('0x6d')]+(_0x1c24e3(_0x23fb01['rules'][_0x36fc0f]['condition'])?'\x20'+_0x23fb01[_0xb5fa('0x69')][_0x36fc0f][_0xb5fa('0x6e')]:'');}return _0x421a93+')';};var _0x432f04={'where':{'id':_0x5caf84['params']['id']}},_0x57d8b7,_0x597206,_0x30d53b,_0x199555,_0x12b0a2;_0x432f04=_['merge']({},_0x432f04,_0x5caf84['options']);return db[_0xb5fa('0x31')][_0xb5fa('0x49')](_0x432f04)[_0xb5fa('0x25')](function(_0x4ce1bd){if(_0x4ce1bd){_0x57d8b7=_0x4ce1bd;return _0x4ce1bd[_0xb5fa('0x6f')]();}return null;})[_0xb5fa('0x25')](function(_0x13ef3a){if(_0x13ef3a){if(!_0x13ef3a[_0xb5fa('0x39')]){throw new db[(_0xb5fa('0x70'))][(_0xb5fa('0x71'))](_0xb5fa('0x72'),0x193);}_0x597206=_0x13ef3a;return db[_0xb5fa('0x73')][_0xb5fa('0x45')]({'raw':!![]});}return null;})[_0xb5fa('0x25')](function(_0x3a1db9){if(_0x3a1db9){_0x30d53b=_[_0xb5fa('0x74')](_0x3a1db9,'id');var _0xecdff3;var _0x38faa6=squel[_0xb5fa('0x75')]();_0x38faa6['from'](_0x57d8b7[_0xb5fa('0x76')]);for(var _0x5a6f74=0x0;_0x5a6f74<_0x597206[_0xb5fa('0x39')];_0x5a6f74+=0x1){_0xecdff3=_0x597206[_0x5a6f74][_0xb5fa('0x77')]?_0x30d53b[_0x597206[_0x5a6f74][_0xb5fa('0x77')]][_0xb5fa('0x78')]:_0x597206[_0x5a6f74][_0xb5fa('0x6c')];_0xecdff3=_0x597206[_0x5a6f74]['function']?_[_0xb5fa('0x79')](_0x4f82f0[_0x597206[_0x5a6f74]['function']],'%s',_0xecdff3):_0xecdff3;_0xecdff3=_0x597206[_0x5a6f74][_0xb5fa('0x7a')]?_[_0xb5fa('0x79')](_0x2b9a45[_0x597206[_0x5a6f74][_0xb5fa('0x7a')]],'%s',_0xecdff3):_0xecdff3;if(_0x597206[_0x5a6f74][_0xb5fa('0x7b')]){_0x38faa6['group'](_0xecdff3);}_0x597206[_0x5a6f74]['orderBy']&&_0x38faa6['order'](_0xecdff3,_0x597206[_0x5a6f74][_0xb5fa('0x7c')]===_0xb5fa('0x7d')?![]:!![]);_0x38faa6[_0xb5fa('0x6c')](_0xecdff3,_0x597206[_0x5a6f74][_0xb5fa('0x7e')]||_0xecdff3);}if(_0x57d8b7[_0xb5fa('0x7f')]){_0x57d8b7[_0xb5fa('0x7f')]=JSON['parse'](_0x57d8b7[_0xb5fa('0x7f')]);for(var _0x5c08e1=0x0;_0x5c08e1<_0x57d8b7['joins'][_0xb5fa('0x39')];_0x5c08e1+=0x1){if(_0x57d8b7['joins'][_0x5c08e1]['type']&&_['includes'](_0x1572fb,_0x57d8b7[_0xb5fa('0x7f')][_0x5c08e1]['type'])&&_0x57d8b7[_0xb5fa('0x7f')][_0x5c08e1][_0xb5fa('0x80')]&&_0x57d8b7[_0xb5fa('0x7f')][_0x5c08e1]['foreignTable']&&_0x57d8b7['joins'][_0x5c08e1][_0xb5fa('0x81')]){_0x38faa6[_0x57d8b7[_0xb5fa('0x7f')][_0x5c08e1]['type']](_0x57d8b7[_0xb5fa('0x7f')][_0x5c08e1][_0xb5fa('0x82')],null,util[_0xb5fa('0x7a')](_0xb5fa('0x83'),_0x57d8b7['table'],_0x57d8b7[_0xb5fa('0x7f')][_0x5c08e1][_0xb5fa('0x80')],_0x57d8b7[_0xb5fa('0x7f')][_0x5c08e1][_0xb5fa('0x82')],_0x57d8b7[_0xb5fa('0x7f')][_0x5c08e1][_0xb5fa('0x81')]));}}}if(_0x57d8b7[_0xb5fa('0x84')]){_0x57d8b7['conditions']=JSON[_0xb5fa('0x85')](_0x57d8b7['conditions']);_0x38faa6[_0xb5fa('0x3d')](_0x41cce9(_0x57d8b7[_0xb5fa('0x84')]['group']));}_0x12b0a2=_0x38faa6[_0xb5fa('0x86')]();_0x38faa6[_0xb5fa('0x1d')](_0x367f7a);_0x38faa6[_0xb5fa('0x20')](0x0);logger[_0xb5fa('0x87')](_0xb5fa('0x88'),_0x38faa6[_0xb5fa('0x89')]());return dbH[_0xb5fa('0x8a')][_0xb5fa('0x3c')](_0x38faa6['toString'](),{'type':dbH[_0xb5fa('0x8a')][_0xb5fa('0x8b')][_0xb5fa('0x8c')]});}})[_0xb5fa('0x25')](respondWithResult(_0x441c41,null))['catch'](handleError(_0x441c41,null));};function runReport(_0x593386,_0x47d72b,_0x5557a3){var _0x1c60bd=_0x47d72b[_0xb5fa('0x2d')];var _0xff504d=0xa;var _0x188e66=['join','left_join',_0xb5fa('0x56'),'cross_join'];var _0x32eebd={'SUM':_0xb5fa('0x58'),'COUNT':_0xb5fa('0x59'),'COUNT DISTINCT':_0xb5fa('0x8d'),'MAX':'MAX(%s)','MIN':_0xb5fa('0x5b'),'AVG':'AVG(%s)','GROUP_CONCAT':_0xb5fa('0x5c'),'GROUP_CONCAT ASC':_0xb5fa('0x5d'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x5e6852={'SEC_TO_TIME':_0xb5fa('0x5f'),'DATE':_0xb5fa('0x60'),'HOUR':_0xb5fa('0x61'),'ROUND':_0xb5fa('0x62'),'UNIX_TIMESTAMP':_0xb5fa('0x63')};var _0xa7fd3b=function(_0x42e210){return!_[_0xb5fa('0x64')]([_0xb5fa('0x65'),_0xb5fa('0x66'),_0xb5fa('0x67'),_0xb5fa('0x68')],_0x42e210);};var _0x86dfe9=function(_0x53c7b5){if(!_0x53c7b5||!_0x53c7b5['rules'][_0xb5fa('0x39')]){return'';}for(var _0x52384b='(',_0x1cb113=0x0;_0x1cb113<_0x53c7b5[_0xb5fa('0x69')]['length'];_0x1cb113+=0x1){_0x1cb113>0x0&&(_0x52384b+='\x20'+_0x53c7b5[_0xb5fa('0x6a')]+'\x20');_0x52384b+=_0x53c7b5[_0xb5fa('0x69')][_0x1cb113]['group']?_0x86dfe9(_0x53c7b5[_0xb5fa('0x69')][_0x1cb113][_0xb5fa('0x6b')]):_0x53c7b5['rules'][_0x1cb113][_0xb5fa('0x6c')]+'\x20'+_0x53c7b5[_0xb5fa('0x69')][_0x1cb113][_0xb5fa('0x6d')]+(_0xa7fd3b(_0x53c7b5['rules'][_0x1cb113]['condition'])?'\x20'+_0x53c7b5[_0xb5fa('0x69')][_0x1cb113][_0xb5fa('0x6e')]:'');}return _0x52384b+')';};var _0x3b5e1d={'where':{'id':_0x593386['id']}},_0x3d18a9,_0x397830,_0x234d9d,_0x10222c,_0x1eec65;_0x3b5e1d=_[_0xb5fa('0x42')]({},_0x3b5e1d,_0x5557a3);return db[_0xb5fa('0x31')]['find'](_0x3b5e1d)['then'](function(_0x3c5563){if(_0x3c5563){_0x3d18a9=_0x3c5563;return _0x3c5563[_0xb5fa('0x6f')]();}return null;})[_0xb5fa('0x25')](function(_0x18498d){if(_0x18498d){if(!_0x18498d['length']){throw new db[(_0xb5fa('0x70'))][(_0xb5fa('0x71'))](_0xb5fa('0x72'),0x193);}_0x397830=_0x18498d;return db['AnalyticMetric'][_0xb5fa('0x45')]({'raw':!![]});}return null;})[_0xb5fa('0x25')](function(_0x109dd9){if(_0x109dd9){_0x234d9d=_[_0xb5fa('0x74')](_0x109dd9,'id');var _0x5ba2e7;var _0x1175da=squel[_0xb5fa('0x75')]();_0x1175da[_0xb5fa('0x8e')](_0x3d18a9[_0xb5fa('0x76')]);for(var _0x19717a=0x0;_0x19717a<_0x397830[_0xb5fa('0x39')];_0x19717a+=0x1){_0x5ba2e7=_0x397830[_0x19717a][_0xb5fa('0x77')]?_0x234d9d[_0x397830[_0x19717a][_0xb5fa('0x77')]][_0xb5fa('0x78')]:_0x397830[_0x19717a][_0xb5fa('0x6c')];_0x5ba2e7=_0x397830[_0x19717a][_0xb5fa('0x8f')]?_[_0xb5fa('0x79')](_0x32eebd[_0x397830[_0x19717a][_0xb5fa('0x8f')]],'%s',_0x5ba2e7):_0x5ba2e7;_0x5ba2e7=_0x397830[_0x19717a][_0xb5fa('0x7a')]?_[_0xb5fa('0x79')](_0x5e6852[_0x397830[_0x19717a]['format']],'%s',_0x5ba2e7):_0x5ba2e7;if(_0x397830[_0x19717a][_0xb5fa('0x7b')]){_0x1175da[_0xb5fa('0x6b')](_0x5ba2e7);}_0x397830[_0x19717a][_0xb5fa('0x7c')]&&_0x1175da[_0xb5fa('0x90')](_0x5ba2e7,_0x397830[_0x19717a][_0xb5fa('0x7c')]===_0xb5fa('0x7d')?![]:!![]);_0x1175da[_0xb5fa('0x6c')](_0x5ba2e7,_0x397830[_0x19717a][_0xb5fa('0x7e')]||_0x5ba2e7);}if(_0x3d18a9['joins']){_0x3d18a9['joins']=JSON[_0xb5fa('0x85')](_0x3d18a9['joins']);for(var _0x5d0ca8=0x0;_0x5d0ca8<_0x3d18a9[_0xb5fa('0x7f')][_0xb5fa('0x39')];_0x5d0ca8+=0x1){if(_0x3d18a9[_0xb5fa('0x7f')][_0x5d0ca8]['type']&&_[_0xb5fa('0x64')](_0x188e66,_0x3d18a9[_0xb5fa('0x7f')][_0x5d0ca8][_0xb5fa('0x33')])&&_0x3d18a9['joins'][_0x5d0ca8][_0xb5fa('0x80')]&&_0x3d18a9[_0xb5fa('0x7f')][_0x5d0ca8]['foreignTable']&&_0x3d18a9[_0xb5fa('0x7f')][_0x5d0ca8][_0xb5fa('0x81')]){_0x1175da[_0x3d18a9[_0xb5fa('0x7f')][_0x5d0ca8][_0xb5fa('0x33')]](_0x3d18a9[_0xb5fa('0x7f')][_0x5d0ca8][_0xb5fa('0x82')],null,util[_0xb5fa('0x7a')]('%s.%s\x20=\x20%s.%s',_0x3d18a9[_0xb5fa('0x76')],_0x3d18a9[_0xb5fa('0x7f')][_0x5d0ca8][_0xb5fa('0x80')],_0x3d18a9[_0xb5fa('0x7f')][_0x5d0ca8]['foreignTable'],_0x3d18a9['joins'][_0x5d0ca8][_0xb5fa('0x81')]));}}}if(_0x3d18a9[_0xb5fa('0x84')]){_0x3d18a9[_0xb5fa('0x84')]=JSON[_0xb5fa('0x85')](_0x3d18a9['conditions']);_0x1175da['where'](_0x86dfe9(_0x3d18a9['conditions']['group']));}_0x1eec65=_0x1175da[_0xb5fa('0x86')]();_0x1175da[_0xb5fa('0x1d')](_0xff504d);_0x1175da[_0xb5fa('0x20')](0x0);return;}})[_0xb5fa('0x25')](function(){if(_0x47d72b[_0xb5fa('0x91')]===_0xb5fa('0x92')){return null;}var _0x3c36a8=_[_0xb5fa('0x42')](_0x47d72b,{'name':_0x47d72b[_0xb5fa('0x93')]||_0x47d72b[_0xb5fa('0x2d')]||_0x3d18a9[_0xb5fa('0x2d')],'basename':_0x1c60bd,'savename':util['format'](_0xb5fa('0x94'),_0x47d72b[_0xb5fa('0x2d')]||_0x3d18a9['name'],require(_0xb5fa('0x95'))[_0xb5fa('0x96')](0x4),_0x47d72b['output']||_0xb5fa('0x97')),'reportId':_0x3d18a9['id'],'reportType':_0xb5fa('0x98')});return db[_0xb5fa('0x99')][_0xb5fa('0x4a')](_0x3c36a8,{'raw':!![]});})[_0xb5fa('0x25')](function(_0x2b449a){if(_0x3d18a9[_0xb5fa('0x76')]===_0xb5fa('0x9a')){_0x1eec65[_0xb5fa('0x3d')](_0x3d18a9['table']+_0xb5fa('0x9b'),_0x47d72b[_0xb5fa('0x9c')],_0x47d72b[_0xb5fa('0x9d')]);}else{_0x1eec65[_0xb5fa('0x3d')](_0x3d18a9[_0xb5fa('0x76')]+_0xb5fa('0x9e'),_0x47d72b[_0xb5fa('0x9c')],_0x47d72b[_0xb5fa('0x9d')]);}if(_0x2b449a){logger['info'](_0xb5fa('0x9f'),_0x1eec65['toString']());require(_0xb5fa('0xa0'))[_0xb5fa('0xa1')](path[_0xb5fa('0x54')](__dirname,_0xb5fa('0xa2'),_0x2b449a[_0xb5fa('0x91')]),[_0x2b449a['id'],_0x1eec65[_0xb5fa('0x89')](),path[_0xb5fa('0x54')](__dirname,_0xb5fa('0xa3'),_0x2b449a[_0xb5fa('0xa4')]),_0x1c60bd]);return _0x2b449a;}else{var _0x4bb9b4=squel['select']();_0x4bb9b4[_0xb5fa('0x8e')]('('+_0x1eec65[_0xb5fa('0x89')]()+')',_0xb5fa('0xa5'));_0x4bb9b4[_0xb5fa('0x6c')]('COUNT(*)',_0xb5fa('0x1f'));_0x1eec65['limit'](_0x47d72b[_0xb5fa('0x1d')]||_0xff504d);_0x1eec65[_0xb5fa('0x20')](_0x47d72b['offset']||0x0);return dbH[_0xb5fa('0x8a')]['query'](_0x4bb9b4[_0xb5fa('0x89')](),{'type':dbH['sequelize'][_0xb5fa('0x8b')][_0xb5fa('0x8c')]})[_0xb5fa('0x25')](function(_0x70e4ae){if(!_0x70e4ae[_0xb5fa('0x39')]){_0x10222c=0x0;}else{_0x10222c=_0x70e4ae[0x0][_0xb5fa('0x1f')]||0x0;}return dbH[_0xb5fa('0x8a')][_0xb5fa('0x3c')](_0x1eec65[_0xb5fa('0x89')](),{'type':dbH[_0xb5fa('0x8a')][_0xb5fa('0x8b')]['SELECT']});})[_0xb5fa('0x25')](function(_0x284b34){return{'rows':_0x284b34||[],'count':_0x10222c};});}});}exports[_0xb5fa('0xa6')]=function(_0x497931,_0x2145d8){return runReport(_0x497931[_0xb5fa('0xa7')],_0x497931[_0xb5fa('0x3c')],_0x497931[_0xb5fa('0x43')])[_0xb5fa('0x25')](respondWithResult(_0x2145d8,null))[_0xb5fa('0x47')](handleError(_0x2145d8,null));};exports[_0xb5fa('0xa8')]=runReport;exports[_0xb5fa('0x3c')]=function(_0x59fd75,_0x245ee1){var _0x5c1e1f=0xa;var _0x3ba723=[_0xb5fa('0x54'),_0xb5fa('0x55'),_0xb5fa('0x56'),_0xb5fa('0x57')];var _0x105c0f={'SUM':_0xb5fa('0x58'),'COUNT':_0xb5fa('0x59'),'COUNT DISTINCT':_0xb5fa('0x8d'),'MAX':_0xb5fa('0x5a'),'MIN':_0xb5fa('0x5b'),'AVG':_0xb5fa('0xa9'),'GROUP_CONCAT':_0xb5fa('0x5c'),'GROUP_CONCAT ASC':_0xb5fa('0x5d'),'GROUP_CONCAT DESC':_0xb5fa('0x5e')};var _0x41e086={'SEC_TO_TIME':_0xb5fa('0x5f'),'DATE':'DATE(%s)','HOUR':_0xb5fa('0x61'),'ROUND':_0xb5fa('0x62'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0xd34c31=function(_0x2e614e){return!_['includes'](['IS\x20NULL','IS\x20NOT\x20NULL',_0xb5fa('0x67'),_0xb5fa('0x68')],_0x2e614e);};var _0x1aae82=function(_0x474bb){if(!_0x474bb||!_0x474bb[_0xb5fa('0x69')][_0xb5fa('0x39')]){return'';}for(var _0x17ae50='(',_0x51c9ba=0x0;_0x51c9ba<_0x474bb['rules']['length'];_0x51c9ba+=0x1){_0x51c9ba>0x0&&(_0x17ae50+='\x20'+_0x474bb[_0xb5fa('0x6a')]+'\x20');_0x17ae50+=_0x474bb['rules'][_0x51c9ba]['group']?_0x1aae82(_0x474bb[_0xb5fa('0x69')][_0x51c9ba]['group']):_0x474bb[_0xb5fa('0x69')][_0x51c9ba][_0xb5fa('0x6c')]+'\x20'+_0x474bb[_0xb5fa('0x69')][_0x51c9ba][_0xb5fa('0x6d')]+(_0xd34c31(_0x474bb[_0xb5fa('0x69')][_0x51c9ba]['condition'])?'\x20'+_0x474bb[_0xb5fa('0x69')][_0x51c9ba][_0xb5fa('0x6e')]:'');}return _0x17ae50+')';};var _0x2fe715={'where':{'id':_0x59fd75[_0xb5fa('0xa7')]['id']}},_0x3c5ac4,_0x23b70f,_0x488818,_0x15b228,_0x42fd84;_0x2fe715=_[_0xb5fa('0x42')]({},_0x2fe715,_0x59fd75[_0xb5fa('0x43')]);return db[_0xb5fa('0x31')]['find'](_0x2fe715)[_0xb5fa('0x25')](function(_0x390043){if(_0x390043){_0x3c5ac4=_0x390043;return _0x390043[_0xb5fa('0x6f')]();}return null;})[_0xb5fa('0x25')](function(_0x32c191){if(_0x32c191){if(!_0x32c191[_0xb5fa('0x39')]){throw new db[(_0xb5fa('0x70'))][(_0xb5fa('0x71'))](_0xb5fa('0x72'),0x193);}_0x23b70f=_0x32c191;return db[_0xb5fa('0x73')][_0xb5fa('0x45')]({'raw':!![]});}return null;})[_0xb5fa('0x25')](function(_0x1d307c){if(_0x1d307c){_0x488818=_[_0xb5fa('0x74')](_0x1d307c,'id');var _0x3347eb;var _0x349e0b=squel[_0xb5fa('0x75')]();_0x349e0b[_0xb5fa('0x8e')](_0x3c5ac4[_0xb5fa('0x76')]);for(var _0x2b1c3f=0x0;_0x2b1c3f<_0x23b70f[_0xb5fa('0x39')];_0x2b1c3f+=0x1){_0x3347eb=_0x23b70f[_0x2b1c3f][_0xb5fa('0x77')]?_0x488818[_0x23b70f[_0x2b1c3f]['MetricId']]['metric']:_0x23b70f[_0x2b1c3f][_0xb5fa('0x6c')];_0x3347eb=_0x23b70f[_0x2b1c3f][_0xb5fa('0x8f')]?_[_0xb5fa('0x79')](_0x105c0f[_0x23b70f[_0x2b1c3f][_0xb5fa('0x8f')]],'%s',_0x3347eb):_0x3347eb;_0x3347eb=_0x23b70f[_0x2b1c3f][_0xb5fa('0x7a')]?_[_0xb5fa('0x79')](_0x41e086[_0x23b70f[_0x2b1c3f]['format']],'%s',_0x3347eb):_0x3347eb;if(_0x23b70f[_0x2b1c3f]['groupBy']){_0x349e0b['group'](_0x3347eb);}_0x23b70f[_0x2b1c3f][_0xb5fa('0x7c')]&&_0x349e0b[_0xb5fa('0x90')](_0x3347eb,_0x23b70f[_0x2b1c3f]['orderBy']===_0xb5fa('0x7d')?![]:!![]);_0x349e0b[_0xb5fa('0x6c')](_0x3347eb,_0x23b70f[_0x2b1c3f]['alias']||_0x3347eb);}if(_0x3c5ac4[_0xb5fa('0x7f')]){_0x3c5ac4[_0xb5fa('0x7f')]=JSON[_0xb5fa('0x85')](_0x3c5ac4[_0xb5fa('0x7f')]);for(var _0x10dbdf=0x0;_0x10dbdf<_0x3c5ac4[_0xb5fa('0x7f')][_0xb5fa('0x39')];_0x10dbdf+=0x1){if(_0x3c5ac4[_0xb5fa('0x7f')][_0x10dbdf]['type']&&_[_0xb5fa('0x64')](_0x3ba723,_0x3c5ac4['joins'][_0x10dbdf][_0xb5fa('0x33')])&&_0x3c5ac4[_0xb5fa('0x7f')][_0x10dbdf][_0xb5fa('0x80')]&&_0x3c5ac4[_0xb5fa('0x7f')][_0x10dbdf]['foreignTable']&&_0x3c5ac4[_0xb5fa('0x7f')][_0x10dbdf][_0xb5fa('0x81')]){_0x349e0b[_0x3c5ac4[_0xb5fa('0x7f')][_0x10dbdf][_0xb5fa('0x33')]](_0x3c5ac4['joins'][_0x10dbdf][_0xb5fa('0x82')],null,util[_0xb5fa('0x7a')](_0xb5fa('0x83'),_0x3c5ac4[_0xb5fa('0x76')],_0x3c5ac4[_0xb5fa('0x7f')][_0x10dbdf][_0xb5fa('0x80')],_0x3c5ac4[_0xb5fa('0x7f')][_0x10dbdf]['foreignTable'],_0x3c5ac4[_0xb5fa('0x7f')][_0x10dbdf]['foreignKey']));}}}if(_0x3c5ac4[_0xb5fa('0x84')]){_0x3c5ac4[_0xb5fa('0x84')]=JSON[_0xb5fa('0x85')](_0x3c5ac4[_0xb5fa('0x84')]);_0x349e0b[_0xb5fa('0x3d')](_0x1aae82(_0x3c5ac4[_0xb5fa('0x84')][_0xb5fa('0x6b')]));}_0x42fd84=_0x349e0b['clone']();_0x349e0b['limit'](_0x5c1e1f);_0x349e0b[_0xb5fa('0x20')](0x0);logger[_0xb5fa('0x87')](_0xb5fa('0x88'),_0x349e0b[_0xb5fa('0x89')]());return dbH[_0xb5fa('0x8a')][_0xb5fa('0x3c')](_0x349e0b[_0xb5fa('0x89')](),{'type':dbH[_0xb5fa('0x8a')]['QueryTypes'][_0xb5fa('0x8c')]});}})[_0xb5fa('0x25')](function(){return{'sql':_0x42fd84[_0xb5fa('0x89')]()};})[_0xb5fa('0x25')](respondWithResult(_0x245ee1,null))[_0xb5fa('0x47')](handleError(_0x245ee1,null));}; \ No newline at end of file +var _0x2675=['AnalyticDefaultReport','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','nolimit','sort','where','filters','pick','VIRTUAL','merge','options','includeAll','include','catch','params','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','Reports','UserProfileSection','find','userProfileId','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','preview','join','left_join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%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','operator','group','condition','value','getFields','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','findAll','select','table','MetricId','metric','field','function','replace','format','groupBy','order','orderBy','DESC','joins','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','conditions','parse','clone','toString','sequelize','QueryTypes','right_join','SEC_TO_TIME(%s)','IS\x20EMPTY','Sequelize','keyBy','from','alias','output','randomstring','generate','csv','default','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','info','Run\x20Query:','child_process','fork','../../files/reports','savename','COUNT(*)','SELECT','run','runReport','MIN(%s)','debug','eml-format','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','dbH','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','destroy','then','get','DefaultReports','name','map'];(function(_0x1683cf,_0x20b3cb){var _0x1159ad=function(_0x241e90){while(--_0x241e90){_0x1683cf['push'](_0x1683cf['shift']());}};_0x1159ad(++_0x20b3cb);}(_0x2675,0x75));var _0x5267=function(_0x196e4a,_0x2fbad1){_0x196e4a=_0x196e4a-0x0;var _0x3aa61d=_0x2675[_0x196e4a];return _0x3aa61d;};'use strict';var emlformat=require(_0x5267('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x5267('0x1'));var moment=require(_0x5267('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x5267('0x3'));var util=require(_0x5267('0x4'));var path=require('path');var sox=require(_0x5267('0x5'));var csv=require(_0x5267('0x6'));var ejs=require(_0x5267('0x7'));var fs=require('fs');var fs_extra=require(_0x5267('0x8'));var _=require(_0x5267('0x9'));var squel=require(_0x5267('0xa'));var crypto=require('crypto');var jsforce=require(_0x5267('0xb'));var deskjs=require(_0x5267('0xc'));var toCsv=require('to-csv');var querystring=require(_0x5267('0xd'));var Papa=require('papaparse');var Redis=require(_0x5267('0xe'));var authService=require(_0x5267('0xf'));var qs=require(_0x5267('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5267('0x11'));var logger=require('../../config/logger')(_0x5267('0x12'));var utils=require('../../config/utils');var config=require(_0x5267('0x13'));var licenseUtil=require(_0x5267('0x14'));var db=require(_0x5267('0x15'))['db'];var dbH=require(_0x5267('0x15'))[_0x5267('0x16')];function respondWithStatusCode(_0x1171b9,_0x20785c){_0x20785c=_0x20785c||0xcc;return function(_0x36dc17){if(_0x36dc17){return _0x1171b9[_0x5267('0x17')](_0x20785c);}return _0x1171b9[_0x5267('0x18')](_0x20785c)[_0x5267('0x19')]();};}function respondWithResult(_0x29349a,_0x3e2bab){_0x3e2bab=_0x3e2bab||0xc8;return function(_0x548040){if(_0x548040){return _0x29349a['status'](_0x3e2bab)[_0x5267('0x1a')](_0x548040);}};}function respondWithFilteredResult(_0x40d897,_0x38a147){return function(_0x3f5344){if(_0x3f5344){var _0x46b2c2=typeof _0x38a147[_0x5267('0x1b')]===_0x5267('0x1c')&&typeof _0x38a147[_0x5267('0x1d')]===_0x5267('0x1c');var _0xb1c97a=_0x3f5344[_0x5267('0x1e')];var _0x1ab03=_0x46b2c2?0x0:_0x38a147['offset'];var _0x18f32e=_0x46b2c2?_0x3f5344[_0x5267('0x1e')]:_0x38a147['offset']+_0x38a147[_0x5267('0x1d')];var _0x56733e;if(_0x18f32e>=_0xb1c97a){_0x18f32e=_0xb1c97a;_0x56733e=0xc8;}else{_0x56733e=0xce;}_0x40d897[_0x5267('0x18')](_0x56733e);return _0x40d897[_0x5267('0x1f')](_0x5267('0x20'),_0x1ab03+'-'+_0x18f32e+'/'+_0xb1c97a)[_0x5267('0x1a')](_0x3f5344);}return null;};}function patchUpdates(_0x5ca9c6){return function(_0x4dd637){try{jsonpatch[_0x5267('0x21')](_0x4dd637,_0x5ca9c6,!![]);}catch(_0x5aebdd){return BPromise[_0x5267('0x22')](_0x5aebdd);}return _0x4dd637[_0x5267('0x23')]();};}function saveUpdates(_0x3b53ac,_0x56dd95){return function(_0x499f19){if(_0x499f19){return _0x499f19['update'](_0x3b53ac)['then'](function(_0x5ea6a6){return _0x5ea6a6;});}return null;};}function removeEntity(_0x26c7f8,_0x399e64){return function(_0x2d761d){if(_0x2d761d){return _0x2d761d[_0x5267('0x24')]()[_0x5267('0x25')](function(){var _0x40d1be=_0x2d761d[_0x5267('0x26')]({'plain':!![]});var _0x220e03=_0x5267('0x27');return db['UserProfileResource']['destroy']({'where':{'type':_0x220e03,'resourceId':_0x40d1be['id']}})[_0x5267('0x25')](function(){return _0x2d761d;});})[_0x5267('0x25')](function(){_0x26c7f8['status'](0xcc)[_0x5267('0x19')]();});}};}function handleEntityNotFound(_0x52504e,_0x4d7c2a){return function(_0x43e7e7){if(!_0x43e7e7){_0x52504e[_0x5267('0x17')](0x194);}return _0x43e7e7;};}function handleError(_0x1f33b7,_0x2d2ace){_0x2d2ace=_0x2d2ace||0x1f4;return function(_0x33c431){logger['error'](_0x33c431['stack']);if(_0x33c431[_0x5267('0x28')]){delete _0x33c431[_0x5267('0x28')];}_0x1f33b7[_0x5267('0x18')](_0x2d2ace)['send'](_0x33c431);};}exports['index']=function(_0xbe7922,_0x3ef2a8){var _0x1fa725={},_0x5bec7e={},_0x59b091={'count':0x0,'rows':[]};var _0x2249a1=_[_0x5267('0x29')](db[_0x5267('0x2a')][_0x5267('0x2b')],function(_0x5bbb83){return{'name':_0x5bbb83[_0x5267('0x2c')],'type':_0x5bbb83[_0x5267('0x2d')][_0x5267('0x2e')]};});_0x5bec7e[_0x5267('0x2f')]=_[_0x5267('0x29')](_0x2249a1,_0x5267('0x28'));_0x5bec7e[_0x5267('0x30')]=_[_0x5267('0x31')](_0xbe7922['query']);_0x5bec7e['filters']=_[_0x5267('0x32')](_0x5bec7e['model'],_0x5bec7e[_0x5267('0x30')]);_0x1fa725[_0x5267('0x33')]=_[_0x5267('0x32')](_0x5bec7e[_0x5267('0x2f')],qs['fields'](_0xbe7922[_0x5267('0x30')][_0x5267('0x34')]));_0x1fa725[_0x5267('0x33')]=_0x1fa725[_0x5267('0x33')][_0x5267('0x35')]?_0x1fa725[_0x5267('0x33')]:_0x5bec7e[_0x5267('0x2f')];if(!_0xbe7922[_0x5267('0x30')]['hasOwnProperty'](_0x5267('0x36'))){_0x1fa725['limit']=qs[_0x5267('0x1d')](_0xbe7922[_0x5267('0x30')][_0x5267('0x1d')]);_0x1fa725[_0x5267('0x1b')]=qs[_0x5267('0x1b')](_0xbe7922[_0x5267('0x30')][_0x5267('0x1b')]);}_0x1fa725['order']=qs[_0x5267('0x37')](_0xbe7922[_0x5267('0x30')][_0x5267('0x37')]);_0x1fa725[_0x5267('0x38')]=qs[_0x5267('0x39')](_[_0x5267('0x3a')](_0xbe7922[_0x5267('0x30')],_0x5bec7e['filters']),_0x2249a1);if(_0xbe7922[_0x5267('0x30')]['filter']){_0x1fa725[_0x5267('0x38')]=_['merge'](_0x1fa725['where'],{'$or':_['map'](_0x2249a1,function(_0x46bfcc){if(_0x46bfcc['type']!==_0x5267('0x3b')){var _0x146476={};_0x146476[_0x46bfcc[_0x5267('0x28')]]={'$like':'%'+_0xbe7922[_0x5267('0x30')]['filter']+'%'};return _0x146476;}})});}_0x1fa725=_[_0x5267('0x3c')]({},_0x1fa725,_0xbe7922[_0x5267('0x3d')]);var _0x588edf={'where':_0x1fa725['where']};return db[_0x5267('0x2a')]['count'](_0x588edf)[_0x5267('0x25')](function(_0x1cf94a){_0x59b091[_0x5267('0x1e')]=_0x1cf94a;if(_0xbe7922[_0x5267('0x30')][_0x5267('0x3e')]){_0x1fa725[_0x5267('0x3f')]=[{'all':!![]}];}return db[_0x5267('0x2a')]['findAll'](_0x1fa725);})['then'](function(_0x28ea4a){_0x59b091['rows']=_0x28ea4a;return _0x59b091;})[_0x5267('0x25')](respondWithFilteredResult(_0x3ef2a8,_0x1fa725))[_0x5267('0x40')](handleError(_0x3ef2a8,null));};exports['show']=function(_0x1fa925,_0xc764cd){var _0x299a13={'raw':!![],'where':{'id':_0x1fa925[_0x5267('0x41')]['id']}},_0x161fed={};_0x161fed[_0x5267('0x2f')]=_[_0x5267('0x31')](db[_0x5267('0x2a')][_0x5267('0x2b')]);_0x161fed['query']=_[_0x5267('0x31')](_0x1fa925[_0x5267('0x30')]);_0x161fed[_0x5267('0x39')]=_[_0x5267('0x32')](_0x161fed[_0x5267('0x2f')],_0x161fed['query']);_0x299a13[_0x5267('0x33')]=_['intersection'](_0x161fed[_0x5267('0x2f')],qs['fields'](_0x1fa925['query'][_0x5267('0x34')]));_0x299a13['attributes']=_0x299a13[_0x5267('0x33')][_0x5267('0x35')]?_0x299a13[_0x5267('0x33')]:_0x161fed[_0x5267('0x2f')];if(_0x1fa925['query'][_0x5267('0x3e')]){_0x299a13['include']=[{'all':!![]}];}_0x299a13=_['merge']({},_0x299a13,_0x1fa925[_0x5267('0x3d')]);return db[_0x5267('0x2a')]['find'](_0x299a13)['then'](handleEntityNotFound(_0xc764cd,null))[_0x5267('0x25')](respondWithResult(_0xc764cd,null))[_0x5267('0x40')](handleError(_0xc764cd,null));};exports[_0x5267('0x42')]=function(_0x1b5a7e,_0x1c2803){return db[_0x5267('0x2a')][_0x5267('0x42')](_0x1b5a7e[_0x5267('0x43')],{})[_0x5267('0x25')](function(_0x2cfe09){var _0x21b040=_0x1b5a7e[_0x5267('0x44')][_0x5267('0x26')]({'plain':!![]});if(!_0x21b040)throw new Error(_0x5267('0x45'));if(_0x21b040['role']===_0x5267('0x44')){var _0x466d46=_0x2cfe09[_0x5267('0x26')]({'plain':!![]});var _0x4f0148=_0x5267('0x46');return db[_0x5267('0x47')][_0x5267('0x48')]({'where':{'name':_0x4f0148,'userProfileId':_0x21b040[_0x5267('0x49')]},'raw':!![]})[_0x5267('0x25')](function(_0x1457cf){if(_0x1457cf&&_0x1457cf['autoAssociation']===0x0){return db[_0x5267('0x4a')]['create']({'name':_0x466d46[_0x5267('0x28')],'resourceId':_0x466d46['id'],'type':_0x5267('0x27'),'sectionId':_0x1457cf['id']},{})[_0x5267('0x25')](function(){return _0x2cfe09;});}else{return _0x2cfe09;}})[_0x5267('0x40')](function(_0x91b932){logger[_0x5267('0x4b')](_0x5267('0x4c'),_0x91b932);throw _0x91b932;});}return _0x2cfe09;})['then'](respondWithResult(_0x1c2803,0xc9))['catch'](handleError(_0x1c2803,null));};exports[_0x5267('0x4d')]=function(_0x15b5c9,_0x566b6f){if(_0x15b5c9[_0x5267('0x43')]['id']){delete _0x15b5c9['body']['id'];}return db['AnalyticDefaultReport'][_0x5267('0x48')]({'where':{'id':_0x15b5c9[_0x5267('0x41')]['id']}})[_0x5267('0x25')](handleEntityNotFound(_0x566b6f,null))[_0x5267('0x25')](saveUpdates(_0x15b5c9[_0x5267('0x43')],null))[_0x5267('0x25')](respondWithResult(_0x566b6f,null))[_0x5267('0x40')](handleError(_0x566b6f,null));};exports[_0x5267('0x24')]=function(_0xf0b5a9,_0x43d254){return db['AnalyticDefaultReport'][_0x5267('0x48')]({'where':{'id':_0xf0b5a9[_0x5267('0x41')]['id']}})[_0x5267('0x25')](handleEntityNotFound(_0x43d254,null))[_0x5267('0x25')](removeEntity(_0x43d254,null))[_0x5267('0x40')](handleError(_0x43d254,null));};exports[_0x5267('0x4e')]=function(_0x552211,_0x195575){var _0x5ad1ce=0xa;var _0x1522d6=[_0x5267('0x4f'),_0x5267('0x50'),'right_join',_0x5267('0x51')];var _0x161dab={'SUM':_0x5267('0x52'),'COUNT':_0x5267('0x53'),'COUNT DISTINCT':_0x5267('0x54'),'MAX':_0x5267('0x55'),'MIN':'MIN(%s)','AVG':_0x5267('0x56'),'GROUP_CONCAT':_0x5267('0x57'),'GROUP_CONCAT ASC':_0x5267('0x58'),'GROUP_CONCAT DESC':_0x5267('0x59')};var _0x51220c={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x5267('0x5a'),'HOUR':'HOUR(%s)','ROUND':_0x5267('0x5b'),'UNIX_TIMESTAMP':_0x5267('0x5c')};var _0x4e3771=function(_0x489780){return!_[_0x5267('0x5d')]([_0x5267('0x5e'),_0x5267('0x5f'),'IS\x20EMPTY',_0x5267('0x60')],_0x489780);};var _0xc88193=function(_0x293e61){if(!_0x293e61||!_0x293e61[_0x5267('0x61')]['length']){return'';}for(var _0x5a87b5='(',_0x540ab8=0x0;_0x540ab8<_0x293e61[_0x5267('0x61')][_0x5267('0x35')];_0x540ab8+=0x1){_0x540ab8>0x0&&(_0x5a87b5+='\x20'+_0x293e61[_0x5267('0x62')]+'\x20');_0x5a87b5+=_0x293e61[_0x5267('0x61')][_0x540ab8][_0x5267('0x63')]?_0xc88193(_0x293e61[_0x5267('0x61')][_0x540ab8][_0x5267('0x63')]):_0x293e61[_0x5267('0x61')][_0x540ab8]['field']+'\x20'+_0x293e61[_0x5267('0x61')][_0x540ab8][_0x5267('0x64')]+(_0x4e3771(_0x293e61['rules'][_0x540ab8][_0x5267('0x64')])?'\x20'+_0x293e61[_0x5267('0x61')][_0x540ab8][_0x5267('0x65')]:'');}return _0x5a87b5+')';};var _0x1b6dd7={'where':{'id':_0x552211[_0x5267('0x41')]['id']}},_0x19adf5,_0xde1ecd,_0x4915f4,_0x2ca259,_0x726410;_0x1b6dd7=_[_0x5267('0x3c')]({},_0x1b6dd7,_0x552211[_0x5267('0x3d')]);return db[_0x5267('0x2a')]['find'](_0x1b6dd7)[_0x5267('0x25')](function(_0x87465){if(_0x87465){_0x19adf5=_0x87465;return _0x87465[_0x5267('0x66')]();}return null;})[_0x5267('0x25')](function(_0x1a4016){if(_0x1a4016){if(!_0x1a4016[_0x5267('0x35')]){throw new db['Sequelize'][(_0x5267('0x67'))](_0x5267('0x68'),0x193);}_0xde1ecd=_0x1a4016;return db[_0x5267('0x69')][_0x5267('0x6a')]({'raw':!![]});}return null;})['then'](function(_0x516e6e){if(_0x516e6e){_0x4915f4=_['keyBy'](_0x516e6e,'id');var _0x910f97;var _0x5cca85=squel[_0x5267('0x6b')]();_0x5cca85['from'](_0x19adf5[_0x5267('0x6c')]);for(var _0x1150ba=0x0;_0x1150ba<_0xde1ecd[_0x5267('0x35')];_0x1150ba+=0x1){_0x910f97=_0xde1ecd[_0x1150ba][_0x5267('0x6d')]?_0x4915f4[_0xde1ecd[_0x1150ba][_0x5267('0x6d')]][_0x5267('0x6e')]:_0xde1ecd[_0x1150ba][_0x5267('0x6f')];_0x910f97=_0xde1ecd[_0x1150ba][_0x5267('0x70')]?_['replace'](_0x161dab[_0xde1ecd[_0x1150ba]['function']],'%s',_0x910f97):_0x910f97;_0x910f97=_0xde1ecd[_0x1150ba]['format']?_[_0x5267('0x71')](_0x51220c[_0xde1ecd[_0x1150ba][_0x5267('0x72')]],'%s',_0x910f97):_0x910f97;if(_0xde1ecd[_0x1150ba][_0x5267('0x73')]){_0x5cca85[_0x5267('0x63')](_0x910f97);}_0xde1ecd[_0x1150ba]['orderBy']&&_0x5cca85[_0x5267('0x74')](_0x910f97,_0xde1ecd[_0x1150ba][_0x5267('0x75')]===_0x5267('0x76')?![]:!![]);_0x5cca85[_0x5267('0x6f')](_0x910f97,_0xde1ecd[_0x1150ba]['alias']||_0x910f97);}if(_0x19adf5[_0x5267('0x77')]){_0x19adf5[_0x5267('0x77')]=JSON['parse'](_0x19adf5[_0x5267('0x77')]);for(var _0x268805=0x0;_0x268805<_0x19adf5['joins']['length'];_0x268805+=0x1){if(_0x19adf5[_0x5267('0x77')][_0x268805][_0x5267('0x2d')]&&_['includes'](_0x1522d6,_0x19adf5['joins'][_0x268805][_0x5267('0x2d')])&&_0x19adf5[_0x5267('0x77')][_0x268805][_0x5267('0x78')]&&_0x19adf5[_0x5267('0x77')][_0x268805][_0x5267('0x79')]&&_0x19adf5['joins'][_0x268805][_0x5267('0x7a')]){_0x5cca85[_0x19adf5[_0x5267('0x77')][_0x268805]['type']](_0x19adf5[_0x5267('0x77')][_0x268805][_0x5267('0x79')],null,util[_0x5267('0x72')](_0x5267('0x7b'),_0x19adf5[_0x5267('0x6c')],_0x19adf5[_0x5267('0x77')][_0x268805][_0x5267('0x78')],_0x19adf5[_0x5267('0x77')][_0x268805]['foreignTable'],_0x19adf5['joins'][_0x268805][_0x5267('0x7a')]));}}}if(_0x19adf5[_0x5267('0x7c')]){_0x19adf5[_0x5267('0x7c')]=JSON[_0x5267('0x7d')](_0x19adf5['conditions']);_0x5cca85[_0x5267('0x38')](_0xc88193(_0x19adf5['conditions'][_0x5267('0x63')]));}_0x726410=_0x5cca85[_0x5267('0x7e')]();_0x5cca85[_0x5267('0x1d')](_0x5ad1ce);_0x5cca85[_0x5267('0x1b')](0x0);logger['debug']('Limited\x20Query:',_0x5cca85[_0x5267('0x7f')]());return dbH[_0x5267('0x80')][_0x5267('0x30')](_0x5cca85[_0x5267('0x7f')](),{'type':dbH[_0x5267('0x80')][_0x5267('0x81')]['SELECT']});}})[_0x5267('0x25')](respondWithResult(_0x195575,null))['catch'](handleError(_0x195575,null));};function runReport(_0x418a03,_0x5b8026,_0x2c2b95){var _0x20888d=_0x5b8026[_0x5267('0x28')];var _0x87aa90=0xa;var _0x164cc1=[_0x5267('0x4f'),_0x5267('0x50'),_0x5267('0x82'),_0x5267('0x51')];var _0x28e4b6={'SUM':_0x5267('0x52'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x5267('0x54'),'MAX':_0x5267('0x55'),'MIN':'MIN(%s)','AVG':_0x5267('0x56'),'GROUP_CONCAT':_0x5267('0x57'),'GROUP_CONCAT ASC':_0x5267('0x58'),'GROUP_CONCAT DESC':_0x5267('0x59')};var _0xd18795={'SEC_TO_TIME':_0x5267('0x83'),'DATE':_0x5267('0x5a'),'HOUR':'HOUR(%s)','ROUND':_0x5267('0x5b'),'UNIX_TIMESTAMP':_0x5267('0x5c')};var _0x2543a4=function(_0x2feea8){return!_[_0x5267('0x5d')](['IS\x20NULL','IS\x20NOT\x20NULL',_0x5267('0x84'),_0x5267('0x60')],_0x2feea8);};var _0x199ff6=function(_0xbf36fb){if(!_0xbf36fb||!_0xbf36fb['rules'][_0x5267('0x35')]){return'';}for(var _0x3cc775='(',_0x2630f2=0x0;_0x2630f2<_0xbf36fb[_0x5267('0x61')][_0x5267('0x35')];_0x2630f2+=0x1){_0x2630f2>0x0&&(_0x3cc775+='\x20'+_0xbf36fb[_0x5267('0x62')]+'\x20');_0x3cc775+=_0xbf36fb[_0x5267('0x61')][_0x2630f2][_0x5267('0x63')]?_0x199ff6(_0xbf36fb[_0x5267('0x61')][_0x2630f2][_0x5267('0x63')]):_0xbf36fb[_0x5267('0x61')][_0x2630f2][_0x5267('0x6f')]+'\x20'+_0xbf36fb[_0x5267('0x61')][_0x2630f2]['condition']+(_0x2543a4(_0xbf36fb[_0x5267('0x61')][_0x2630f2][_0x5267('0x64')])?'\x20'+_0xbf36fb[_0x5267('0x61')][_0x2630f2][_0x5267('0x65')]:'');}return _0x3cc775+')';};var _0x447b5f={'where':{'id':_0x418a03['id']}},_0x25ce90,_0x257c69,_0x160c9c,_0x42694a,_0x11a2f4;_0x447b5f=_[_0x5267('0x3c')]({},_0x447b5f,_0x2c2b95);return db[_0x5267('0x2a')][_0x5267('0x48')](_0x447b5f)[_0x5267('0x25')](function(_0x35c3b7){if(_0x35c3b7){_0x25ce90=_0x35c3b7;return _0x35c3b7[_0x5267('0x66')]();}return null;})[_0x5267('0x25')](function(_0x35a4a3){if(_0x35a4a3){if(!_0x35a4a3[_0x5267('0x35')]){throw new db[(_0x5267('0x85'))][(_0x5267('0x67'))](_0x5267('0x68'),0x193);}_0x257c69=_0x35a4a3;return db[_0x5267('0x69')]['findAll']({'raw':!![]});}return null;})[_0x5267('0x25')](function(_0x318393){if(_0x318393){_0x160c9c=_[_0x5267('0x86')](_0x318393,'id');var _0x405eb4;var _0x38f5b7=squel['select']();_0x38f5b7[_0x5267('0x87')](_0x25ce90[_0x5267('0x6c')]);for(var _0x4c68cd=0x0;_0x4c68cd<_0x257c69['length'];_0x4c68cd+=0x1){_0x405eb4=_0x257c69[_0x4c68cd]['MetricId']?_0x160c9c[_0x257c69[_0x4c68cd][_0x5267('0x6d')]]['metric']:_0x257c69[_0x4c68cd][_0x5267('0x6f')];_0x405eb4=_0x257c69[_0x4c68cd]['function']?_['replace'](_0x28e4b6[_0x257c69[_0x4c68cd][_0x5267('0x70')]],'%s',_0x405eb4):_0x405eb4;_0x405eb4=_0x257c69[_0x4c68cd][_0x5267('0x72')]?_[_0x5267('0x71')](_0xd18795[_0x257c69[_0x4c68cd][_0x5267('0x72')]],'%s',_0x405eb4):_0x405eb4;if(_0x257c69[_0x4c68cd][_0x5267('0x73')]){_0x38f5b7['group'](_0x405eb4);}_0x257c69[_0x4c68cd]['orderBy']&&_0x38f5b7[_0x5267('0x74')](_0x405eb4,_0x257c69[_0x4c68cd][_0x5267('0x75')]===_0x5267('0x76')?![]:!![]);_0x38f5b7[_0x5267('0x6f')](_0x405eb4,_0x257c69[_0x4c68cd][_0x5267('0x88')]||_0x405eb4);}if(_0x25ce90['joins']){_0x25ce90[_0x5267('0x77')]=JSON['parse'](_0x25ce90['joins']);for(var _0x3dfd8d=0x0;_0x3dfd8d<_0x25ce90['joins']['length'];_0x3dfd8d+=0x1){if(_0x25ce90[_0x5267('0x77')][_0x3dfd8d][_0x5267('0x2d')]&&_['includes'](_0x164cc1,_0x25ce90['joins'][_0x3dfd8d]['type'])&&_0x25ce90[_0x5267('0x77')][_0x3dfd8d]['parentKey']&&_0x25ce90[_0x5267('0x77')][_0x3dfd8d]['foreignTable']&&_0x25ce90[_0x5267('0x77')][_0x3dfd8d][_0x5267('0x7a')]){_0x38f5b7[_0x25ce90['joins'][_0x3dfd8d][_0x5267('0x2d')]](_0x25ce90[_0x5267('0x77')][_0x3dfd8d][_0x5267('0x79')],null,util[_0x5267('0x72')](_0x5267('0x7b'),_0x25ce90[_0x5267('0x6c')],_0x25ce90['joins'][_0x3dfd8d]['parentKey'],_0x25ce90[_0x5267('0x77')][_0x3dfd8d]['foreignTable'],_0x25ce90['joins'][_0x3dfd8d][_0x5267('0x7a')]));}}}if(_0x25ce90['conditions']){_0x25ce90[_0x5267('0x7c')]=JSON['parse'](_0x25ce90[_0x5267('0x7c')]);_0x38f5b7['where'](_0x199ff6(_0x25ce90[_0x5267('0x7c')][_0x5267('0x63')]));}_0x11a2f4=_0x38f5b7[_0x5267('0x7e')]();_0x38f5b7[_0x5267('0x1d')](_0x87aa90);_0x38f5b7[_0x5267('0x1b')](0x0);return;}})[_0x5267('0x25')](function(){if(_0x5b8026[_0x5267('0x89')]==='web'){return null;}var _0x4df99f=_[_0x5267('0x3c')](_0x5b8026,{'name':_0x5b8026['fullPath']||_0x5b8026['name']||_0x25ce90['name'],'basename':_0x20888d,'savename':util['format']('%s-%s.%s',_0x5b8026['name']||_0x25ce90[_0x5267('0x28')],require(_0x5267('0x8a'))[_0x5267('0x8b')](0x4),_0x5b8026[_0x5267('0x89')]||_0x5267('0x8c')),'reportId':_0x25ce90['id'],'reportType':_0x5267('0x8d')});return db[_0x5267('0x8e')][_0x5267('0x42')](_0x4df99f,{'raw':!![]});})['then'](function(_0x5df23d){if(_0x25ce90['table']===_0x5267('0x8f')){_0x11a2f4[_0x5267('0x38')](_0x25ce90['table']+_0x5267('0x90'),_0x5b8026[_0x5267('0x91')],_0x5b8026[_0x5267('0x92')]);}else{_0x11a2f4[_0x5267('0x38')](_0x25ce90['table']+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x5b8026[_0x5267('0x91')],_0x5b8026[_0x5267('0x92')]);}if(_0x5df23d){logger[_0x5267('0x93')](_0x5267('0x94'),_0x11a2f4[_0x5267('0x7f')]());require(_0x5267('0x95'))[_0x5267('0x96')](path['join'](__dirname,'../../components/export/',_0x5df23d['output']),[_0x5df23d['id'],_0x11a2f4[_0x5267('0x7f')](),path[_0x5267('0x4f')](__dirname,_0x5267('0x97'),_0x5df23d[_0x5267('0x98')]),_0x20888d]);return _0x5df23d;}else{var _0x190ef4=squel[_0x5267('0x6b')]();_0x190ef4['from']('('+_0x11a2f4[_0x5267('0x7f')]()+')','countTable');_0x190ef4[_0x5267('0x6f')](_0x5267('0x99'),_0x5267('0x1e'));_0x11a2f4[_0x5267('0x1d')](_0x5b8026[_0x5267('0x1d')]||_0x87aa90);_0x11a2f4['offset'](_0x5b8026[_0x5267('0x1b')]||0x0);return dbH[_0x5267('0x80')][_0x5267('0x30')](_0x190ef4['toString'](),{'type':dbH['sequelize']['QueryTypes'][_0x5267('0x9a')]})[_0x5267('0x25')](function(_0x1be763){if(!_0x1be763[_0x5267('0x35')]){_0x42694a=0x0;}else{_0x42694a=_0x1be763[0x0]['count']||0x0;}return dbH['sequelize'][_0x5267('0x30')](_0x11a2f4[_0x5267('0x7f')](),{'type':dbH['sequelize'][_0x5267('0x81')][_0x5267('0x9a')]});})['then'](function(_0x5005b3){return{'rows':_0x5005b3||[],'count':_0x42694a};});}});}exports[_0x5267('0x9b')]=function(_0x11a6f4,_0x5a16ee){return runReport(_0x11a6f4[_0x5267('0x41')],_0x11a6f4[_0x5267('0x30')],_0x11a6f4[_0x5267('0x3d')])[_0x5267('0x25')](respondWithResult(_0x5a16ee,null))[_0x5267('0x40')](handleError(_0x5a16ee,null));};exports[_0x5267('0x9c')]=runReport;exports[_0x5267('0x30')]=function(_0x1e9651,_0x66da7a){var _0x54b582=0xa;var _0x4e4724=[_0x5267('0x4f'),'left_join',_0x5267('0x82'),_0x5267('0x51')];var _0x2722f9={'SUM':_0x5267('0x52'),'COUNT':_0x5267('0x53'),'COUNT DISTINCT':_0x5267('0x54'),'MAX':_0x5267('0x55'),'MIN':_0x5267('0x9d'),'AVG':_0x5267('0x56'),'GROUP_CONCAT':_0x5267('0x57'),'GROUP_CONCAT ASC':_0x5267('0x58'),'GROUP_CONCAT DESC':_0x5267('0x59')};var _0x5909b3={'SEC_TO_TIME':_0x5267('0x83'),'DATE':'DATE(%s)','HOUR':'HOUR(%s)','ROUND':_0x5267('0x5b'),'UNIX_TIMESTAMP':_0x5267('0x5c')};var _0x1d7987=function(_0x59efe1){return!_[_0x5267('0x5d')]([_0x5267('0x5e'),_0x5267('0x5f'),_0x5267('0x84'),_0x5267('0x60')],_0x59efe1);};var _0x46c79e=function(_0xcfba51){if(!_0xcfba51||!_0xcfba51[_0x5267('0x61')][_0x5267('0x35')]){return'';}for(var _0x3c5516='(',_0x1e8367=0x0;_0x1e8367<_0xcfba51[_0x5267('0x61')]['length'];_0x1e8367+=0x1){_0x1e8367>0x0&&(_0x3c5516+='\x20'+_0xcfba51[_0x5267('0x62')]+'\x20');_0x3c5516+=_0xcfba51[_0x5267('0x61')][_0x1e8367]['group']?_0x46c79e(_0xcfba51[_0x5267('0x61')][_0x1e8367][_0x5267('0x63')]):_0xcfba51[_0x5267('0x61')][_0x1e8367][_0x5267('0x6f')]+'\x20'+_0xcfba51['rules'][_0x1e8367][_0x5267('0x64')]+(_0x1d7987(_0xcfba51[_0x5267('0x61')][_0x1e8367][_0x5267('0x64')])?'\x20'+_0xcfba51['rules'][_0x1e8367][_0x5267('0x65')]:'');}return _0x3c5516+')';};var _0x19935d={'where':{'id':_0x1e9651[_0x5267('0x41')]['id']}},_0x3102e0,_0x2d215e,_0xc0af94,_0x178080,_0x3485ab;_0x19935d=_[_0x5267('0x3c')]({},_0x19935d,_0x1e9651['options']);return db[_0x5267('0x2a')][_0x5267('0x48')](_0x19935d)['then'](function(_0x17d2d4){if(_0x17d2d4){_0x3102e0=_0x17d2d4;return _0x17d2d4['getFields']();}return null;})[_0x5267('0x25')](function(_0x4c5a26){if(_0x4c5a26){if(!_0x4c5a26[_0x5267('0x35')]){throw new db[(_0x5267('0x85'))]['ValidationErrorItem']('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x2d215e=_0x4c5a26;return db[_0x5267('0x69')][_0x5267('0x6a')]({'raw':!![]});}return null;})[_0x5267('0x25')](function(_0x1a0883){if(_0x1a0883){_0xc0af94=_[_0x5267('0x86')](_0x1a0883,'id');var _0x501da6;var _0x3dcf73=squel['select']();_0x3dcf73['from'](_0x3102e0['table']);for(var _0x1ded05=0x0;_0x1ded05<_0x2d215e[_0x5267('0x35')];_0x1ded05+=0x1){_0x501da6=_0x2d215e[_0x1ded05][_0x5267('0x6d')]?_0xc0af94[_0x2d215e[_0x1ded05][_0x5267('0x6d')]][_0x5267('0x6e')]:_0x2d215e[_0x1ded05][_0x5267('0x6f')];_0x501da6=_0x2d215e[_0x1ded05][_0x5267('0x70')]?_['replace'](_0x2722f9[_0x2d215e[_0x1ded05]['function']],'%s',_0x501da6):_0x501da6;_0x501da6=_0x2d215e[_0x1ded05][_0x5267('0x72')]?_[_0x5267('0x71')](_0x5909b3[_0x2d215e[_0x1ded05][_0x5267('0x72')]],'%s',_0x501da6):_0x501da6;if(_0x2d215e[_0x1ded05][_0x5267('0x73')]){_0x3dcf73[_0x5267('0x63')](_0x501da6);}_0x2d215e[_0x1ded05]['orderBy']&&_0x3dcf73[_0x5267('0x74')](_0x501da6,_0x2d215e[_0x1ded05][_0x5267('0x75')]===_0x5267('0x76')?![]:!![]);_0x3dcf73[_0x5267('0x6f')](_0x501da6,_0x2d215e[_0x1ded05][_0x5267('0x88')]||_0x501da6);}if(_0x3102e0['joins']){_0x3102e0[_0x5267('0x77')]=JSON[_0x5267('0x7d')](_0x3102e0[_0x5267('0x77')]);for(var _0x4bfafd=0x0;_0x4bfafd<_0x3102e0[_0x5267('0x77')]['length'];_0x4bfafd+=0x1){if(_0x3102e0[_0x5267('0x77')][_0x4bfafd][_0x5267('0x2d')]&&_['includes'](_0x4e4724,_0x3102e0[_0x5267('0x77')][_0x4bfafd]['type'])&&_0x3102e0[_0x5267('0x77')][_0x4bfafd][_0x5267('0x78')]&&_0x3102e0['joins'][_0x4bfafd][_0x5267('0x79')]&&_0x3102e0[_0x5267('0x77')][_0x4bfafd]['foreignKey']){_0x3dcf73[_0x3102e0[_0x5267('0x77')][_0x4bfafd][_0x5267('0x2d')]](_0x3102e0[_0x5267('0x77')][_0x4bfafd][_0x5267('0x79')],null,util[_0x5267('0x72')]('%s.%s\x20=\x20%s.%s',_0x3102e0['table'],_0x3102e0[_0x5267('0x77')][_0x4bfafd][_0x5267('0x78')],_0x3102e0['joins'][_0x4bfafd][_0x5267('0x79')],_0x3102e0['joins'][_0x4bfafd][_0x5267('0x7a')]));}}}if(_0x3102e0[_0x5267('0x7c')]){_0x3102e0[_0x5267('0x7c')]=JSON[_0x5267('0x7d')](_0x3102e0[_0x5267('0x7c')]);_0x3dcf73[_0x5267('0x38')](_0x46c79e(_0x3102e0[_0x5267('0x7c')][_0x5267('0x63')]));}_0x3485ab=_0x3dcf73[_0x5267('0x7e')]();_0x3dcf73[_0x5267('0x1d')](_0x54b582);_0x3dcf73[_0x5267('0x1b')](0x0);logger[_0x5267('0x9e')]('Limited\x20Query:',_0x3dcf73[_0x5267('0x7f')]());return dbH[_0x5267('0x80')][_0x5267('0x30')](_0x3dcf73[_0x5267('0x7f')](),{'type':dbH[_0x5267('0x80')][_0x5267('0x81')][_0x5267('0x9a')]});}})[_0x5267('0x25')](function(){return{'sql':_0x3485ab[_0x5267('0x7f')]()};})[_0x5267('0x25')](respondWithResult(_0x66da7a,null))[_0x5267('0x40')](handleError(_0x66da7a,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index 72276af..badca95 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 _0x9a61=['AnalyticDefaultReport','analytics_default_reports','lodash','api','moment','path','rimraf','./analyticDefaultReport.attributes','exports','define'];(function(_0x5b4915,_0x336b69){var _0x4eaaca=function(_0x5e9047){while(--_0x5e9047){_0x5b4915['push'](_0x5b4915['shift']());}};_0x4eaaca(++_0x336b69);}(_0x9a61,0x110));var _0x19a6=function(_0x2125d3,_0x599ffb){_0x2125d3=_0x2125d3-0x0;var _0x2f2cf5=_0x9a61[_0x2125d3];return _0x2f2cf5;};'use strict';var _=require(_0x19a6('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x19a6('0x1'));var moment=require(_0x19a6('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x19a6('0x3'));var rimraf=require(_0x19a6('0x4'));var config=require('../../config/environment');var attributes=require(_0x19a6('0x5'));module[_0x19a6('0x6')]=function(_0x717482,_0x39951e){return _0x717482[_0x19a6('0x7')](_0x19a6('0x8'),attributes,{'tableName':_0x19a6('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1381=['api','path','rimraf','../../config/environment','./analyticDefaultReport.attributes','exports','define','AnalyticDefaultReport','analytics_default_reports','lodash','util','../../config/logger'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1381,0xbd));var _0x1138=function(_0x3e5df4,_0x2c4d65){_0x3e5df4=_0x3e5df4-0x0;var _0x176426=_0x1381[_0x3e5df4];return _0x176426;};'use strict';var _=require(_0x1138('0x0'));var util=require(_0x1138('0x1'));var logger=require(_0x1138('0x2'))(_0x1138('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x1138('0x4'));var rimraf=require(_0x1138('0x5'));var config=require(_0x1138('0x6'));var attributes=require(_0x1138('0x7'));module[_0x1138('0x8')]=function(_0x1fa38d,_0x2ba82c){return _0x1fa38d[_0x1138('0x9')](_0x1138('0xa'),attributes,{'tableName':_0x1138('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.rpc.js b/server/api/analyticDefaultReport/analyticDefaultReport.rpc.js index 0d04483..a184edb 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 _0x3ff4=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','bluebird','randomstring'];(function(_0x27250c,_0x3e6637){var _0x7e3095=function(_0x1bbce7){while(--_0x1bbce7){_0x27250c['push'](_0x27250c['shift']());}};_0x7e3095(++_0x3e6637);}(_0x3ff4,0x1c5));var _0x43ff=function(_0x4ae6ef,_0xc2af80){_0x4ae6ef=_0x4ae6ef-0x0;var _0x3cbb4e=_0x3ff4[_0x4ae6ef];return _0x3cbb4e;};'use strict';var _=require(_0x43ff('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x43ff('0x1'));var rs=require(_0x43ff('0x2'));var fs=require('fs');var Redis=require(_0x43ff('0x3'));var db=require(_0x43ff('0x4'))['db'];var utils=require(_0x43ff('0x5'));var logger=require(_0x43ff('0x6'))(_0x43ff('0x7'));var config=require(_0x43ff('0x8'));var jayson=require(_0x43ff('0x9'));var client=jayson[_0x43ff('0xa')][_0x43ff('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4441ed,_0x3913e6,_0x250056){return new BPromise(function(_0x9f3b6a,_0xaaa72a){return client['request'](_0x4441ed,_0x250056)[_0x43ff('0xc')](function(_0x3d6c99){logger['info'](_0x43ff('0xd'),_0x3913e6,_0x43ff('0xe'));logger[_0x43ff('0xf')](_0x43ff('0x10'),_0x3913e6,_0x43ff('0xe'),JSON[_0x43ff('0x11')](_0x3d6c99));if(_0x3d6c99[_0x43ff('0x12')]){if(_0x3d6c99['error'][_0x43ff('0x13')]===0x1f4){logger[_0x43ff('0x12')](_0x43ff('0xd'),_0x3913e6,_0x3d6c99['error'][_0x43ff('0x14')]);return _0xaaa72a(_0x3d6c99['error']['message']);}logger[_0x43ff('0x12')](_0x43ff('0xd'),_0x3913e6,_0x3d6c99['error'][_0x43ff('0x14')]);return _0x9f3b6a(_0x3d6c99[_0x43ff('0x12')][_0x43ff('0x14')]);}else{logger[_0x43ff('0x15')](_0x43ff('0xd'),_0x3913e6,'request\x20sent');_0x9f3b6a(_0x3d6c99[_0x43ff('0x16')]['message']);}})[_0x43ff('0x17')](function(_0x591036){logger[_0x43ff('0x12')](_0x43ff('0xd'),_0x3913e6,_0x591036);_0xaaa72a(_0x591036);});});} \ No newline at end of file +var _0x6452=['message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','AnalyticDefaultReport,\x20%s,\x20%s','debug','error','code'];(function(_0x2c7dc6,_0x3c4ce0){var _0x10002b=function(_0x26f390){while(--_0x26f390){_0x2c7dc6['push'](_0x2c7dc6['shift']());}};_0x10002b(++_0x3c4ce0);}(_0x6452,0x114));var _0x2645=function(_0x263f9d,_0x3d854e){_0x263f9d=_0x263f9d-0x0;var _0x4c4efa=_0x6452[_0x263f9d];return _0x4c4efa;};'use strict';var _=require(_0x2645('0x0'));var util=require('util');var moment=require(_0x2645('0x1'));var BPromise=require(_0x2645('0x2'));var rs=require(_0x2645('0x3'));var fs=require('fs');var Redis=require(_0x2645('0x4'));var db=require(_0x2645('0x5'))['db'];var utils=require(_0x2645('0x6'));var logger=require(_0x2645('0x7'))('rpc');var config=require(_0x2645('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x2645('0x9')][_0x2645('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x424ed6,_0x41bb35,_0x2a6903){return new BPromise(function(_0x113e37,_0x20c92d){return client[_0x2645('0xb')](_0x424ed6,_0x2a6903)[_0x2645('0xc')](function(_0x4196e1){logger[_0x2645('0xd')](_0x2645('0xe'),_0x41bb35,'request\x20sent');logger[_0x2645('0xf')]('AnalyticDefaultReport,\x20%s,\x20%s,\x20%s',_0x41bb35,'request\x20sent',JSON['stringify'](_0x4196e1));if(_0x4196e1[_0x2645('0x10')]){if(_0x4196e1['error'][_0x2645('0x11')]===0x1f4){logger[_0x2645('0x10')](_0x2645('0xe'),_0x41bb35,_0x4196e1[_0x2645('0x10')]['message']);return _0x20c92d(_0x4196e1[_0x2645('0x10')][_0x2645('0x12')]);}logger['error'](_0x2645('0xe'),_0x41bb35,_0x4196e1[_0x2645('0x10')][_0x2645('0x12')]);return _0x113e37(_0x4196e1['error'][_0x2645('0x12')]);}else{logger[_0x2645('0xd')](_0x2645('0xe'),_0x41bb35,'request\x20sent');_0x113e37(_0x4196e1[_0x2645('0x13')]['message']);}})[_0x2645('0x14')](function(_0x433ca2){logger['error'](_0x2645('0xe'),_0x41bb35,_0x433ca2);_0x20c92d(_0x433ca2);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index b15a900..2f10a72 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 _0xe6ae=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','index','isAuthenticated','show','preview','/:id/run','run','/:id/query','query','post','create','/:id','update','destroy'];(function(_0x44976e,_0x311385){var _0x4852b2=function(_0xd57529){while(--_0xd57529){_0x44976e['push'](_0x44976e['shift']());}};_0x4852b2(++_0x311385);}(_0xe6ae,0x1e3));var _0xee6a=function(_0x4ba880,_0x3eada2){_0x4ba880=_0x4ba880-0x0;var _0x8055ff=_0xe6ae[_0x4ba880];return _0x8055ff;};'use strict';var multer=require(_0xee6a('0x0'));var util=require(_0xee6a('0x1'));var path=require(_0xee6a('0x2'));var timeout=require(_0xee6a('0x3'));var express=require(_0xee6a('0x4'));var router=express[_0xee6a('0x5')]();var fs_extra=require(_0xee6a('0x6'));var auth=require(_0xee6a('0x7'));var interaction=require(_0xee6a('0x8'));var config=require('../../config/environment');var controller=require('./analyticDefaultReport.controller');router[_0xee6a('0x9')]('/',auth['isAuthenticated'](),controller[_0xee6a('0xa')]);router[_0xee6a('0x9')]('/:id',auth[_0xee6a('0xb')](),controller[_0xee6a('0xc')]);router[_0xee6a('0x9')]('/:id/preview',auth['isAuthenticated'](),controller[_0xee6a('0xd')]);router[_0xee6a('0x9')](_0xee6a('0xe'),auth['isAuthenticated'](),controller[_0xee6a('0xf')]);router['get'](_0xee6a('0x10'),auth['isAuthenticated'](),controller[_0xee6a('0x11')]);router[_0xee6a('0x12')]('/',auth[_0xee6a('0xb')](),controller[_0xee6a('0x13')]);router['put'](_0xee6a('0x14'),auth[_0xee6a('0xb')](),controller[_0xee6a('0x15')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xee6a('0x16')]);module['exports']=router; \ No newline at end of file +var _0xefc9=['multer','util','path','connect-timeout','express','Router','../../components/auth/service','get','index','/:id','isAuthenticated','show','/:id/preview','preview','/:id/run','run','/:id/query','query','put','update','delete','destroy','exports'];(function(_0x4c0269,_0x361697){var _0xf38bbf=function(_0x579638){while(--_0x579638){_0x4c0269['push'](_0x4c0269['shift']());}};_0xf38bbf(++_0x361697);}(_0xefc9,0x170));var _0x9efc=function(_0x4a5859,_0x5c26f2){_0x4a5859=_0x4a5859-0x0;var _0x1d11d2=_0xefc9[_0x4a5859];return _0x1d11d2;};'use strict';var multer=require(_0x9efc('0x0'));var util=require(_0x9efc('0x1'));var path=require(_0x9efc('0x2'));var timeout=require(_0x9efc('0x3'));var express=require(_0x9efc('0x4'));var router=express[_0x9efc('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x9efc('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./analyticDefaultReport.controller');router[_0x9efc('0x7')]('/',auth['isAuthenticated'](),controller[_0x9efc('0x8')]);router['get'](_0x9efc('0x9'),auth[_0x9efc('0xa')](),controller[_0x9efc('0xb')]);router[_0x9efc('0x7')](_0x9efc('0xc'),auth['isAuthenticated'](),controller[_0x9efc('0xd')]);router['get'](_0x9efc('0xe'),auth[_0x9efc('0xa')](),controller[_0x9efc('0xf')]);router[_0x9efc('0x7')](_0x9efc('0x10'),auth['isAuthenticated'](),controller[_0x9efc('0x11')]);router['post']('/',auth[_0x9efc('0xa')](),controller['create']);router[_0x9efc('0x12')](_0x9efc('0x9'),auth[_0x9efc('0xa')](),controller[_0x9efc('0x13')]);router[_0x9efc('0x14')](_0x9efc('0x9'),auth[_0x9efc('0xa')](),controller[_0x9efc('0x15')]);module[_0x9efc('0x16')]=router; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js b/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js index 6420dbe..0d32c5b 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 _0xadf1=['csv','pdf','DATE','Loading','manual','INTEGER','UNSIGNED','moment','exports','STRING','ENUM'];(function(_0x2d1343,_0x1e519d){var _0x2c17f4=function(_0x5d97f6){while(--_0x5d97f6){_0x2d1343['push'](_0x2d1343['shift']());}};_0x2c17f4(++_0x1e519d);}(_0xadf1,0xe3));var _0x1adf=function(_0x2b1255,_0x4869da){_0x2b1255=_0x2b1255-0x0;var _0x44442d=_0xadf1[_0x2b1255];return _0x44442d;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x1adf('0x0'));module[_0x1adf('0x1')]={'name':{'type':Sequelize[_0x1adf('0x2')],'allowNull':![]},'basename':{'type':Sequelize[_0x1adf('0x2')],'allowNull':![]},'output':{'type':Sequelize[_0x1adf('0x3')](_0x1adf('0x4'),_0x1adf('0x5'),'xlsx'),'allowNull':![],'defaultValue':_0x1adf('0x4')},'savename':{'type':Sequelize[_0x1adf('0x2')],'allowNull':![]},'startDate':{'type':Sequelize[_0x1adf('0x6')]},'endDate':{'type':Sequelize[_0x1adf('0x6')]},'status':{'type':Sequelize['STRING'],'defaultValue':_0x1adf('0x7')},'type':{'type':Sequelize['ENUM']('manual','scheduled'),'allowNull':![],'defaultValue':_0x1adf('0x8')},'reportId':{'type':Sequelize[_0x1adf('0x9')](0xb)[_0x1adf('0xa')]},'reportType':{'type':Sequelize[_0x1adf('0x2')]}}; \ No newline at end of file +var _0xfdc1=['STRING','csv','DATE','Loading','ENUM','scheduled','manual','INTEGER','sequelize','moment'];(function(_0x28f160,_0x5c3761){var _0x42092a=function(_0x4e342d){while(--_0x4e342d){_0x28f160['push'](_0x28f160['shift']());}};_0x42092a(++_0x5c3761);}(_0xfdc1,0x166));var _0x1fdc=function(_0x2d8d69,_0x8e47ff){_0x2d8d69=_0x2d8d69-0x0;var _0x39ae22=_0xfdc1[_0x2d8d69];return _0x39ae22;};'use strict';var Sequelize=require(_0x1fdc('0x0'));var moment=require(_0x1fdc('0x1'));module['exports']={'name':{'type':Sequelize[_0x1fdc('0x2')],'allowNull':![]},'basename':{'type':Sequelize['STRING'],'allowNull':![]},'output':{'type':Sequelize['ENUM']('csv','pdf','xlsx'),'allowNull':![],'defaultValue':_0x1fdc('0x3')},'savename':{'type':Sequelize[_0x1fdc('0x2')],'allowNull':![]},'startDate':{'type':Sequelize[_0x1fdc('0x4')]},'endDate':{'type':Sequelize[_0x1fdc('0x4')]},'status':{'type':Sequelize[_0x1fdc('0x2')],'defaultValue':_0x1fdc('0x5')},'type':{'type':Sequelize[_0x1fdc('0x6')]('manual',_0x1fdc('0x7')),'allowNull':![],'defaultValue':_0x1fdc('0x8')},'reportId':{'type':Sequelize[_0x1fdc('0x9')](0xb)['UNSIGNED']},'reportType':{'type':Sequelize[_0x1fdc('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index 96bb1aa..f73f8e9 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 _0x6f71=['name','send','index','map','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','AnalyticExtractedReport','include','findAll','rows','catch','params','keys','includeAll','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','ExtractedReports','UserProfileSection','find','userProfileId','autoAssociation','error','download','savename','join','root','server/files/reports','Sequelize','ValidationError','exists','format','basename','output','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','get','UserProfileResource','sendStatus'];(function(_0x1fc936,_0x22fcc3){var _0xf45083=function(_0x23368a){while(--_0x23368a){_0x1fc936['push'](_0x1fc936['shift']());}};_0xf45083(++_0x22fcc3);}(_0x6f71,0x1a4));var _0x16f7=function(_0x386b69,_0x396f3a){_0x386b69=_0x386b69-0x0;var _0x159277=_0x6f71[_0x386b69];return _0x159277;};'use strict';var emlformat=require(_0x16f7('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x16f7('0x1'));var jsonpatch=require(_0x16f7('0x2'));var rp=require(_0x16f7('0x3'));var moment=require(_0x16f7('0x4'));var BPromise=require(_0x16f7('0x5'));var Mustache=require(_0x16f7('0x6'));var util=require(_0x16f7('0x7'));var path=require(_0x16f7('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x16f7('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x16f7('0xa'));var jsforce=require(_0x16f7('0xb'));var deskjs=require(_0x16f7('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x16f7('0xd'));var Redis=require(_0x16f7('0xe'));var authService=require(_0x16f7('0xf'));var qs=require(_0x16f7('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x16f7('0x11'));var logger=require(_0x16f7('0x12'))(_0x16f7('0x13'));var utils=require(_0x16f7('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x16f7('0x15'));var db=require(_0x16f7('0x16'))['db'];function respondWithStatusCode(_0x38e506,_0x267782){_0x267782=_0x267782||0xcc;return function(_0xf859af){if(_0xf859af){return _0x38e506['sendStatus'](_0x267782);}return _0x38e506[_0x16f7('0x17')](_0x267782)[_0x16f7('0x18')]();};}function respondWithResult(_0x5d85ea,_0x4e0bab){_0x4e0bab=_0x4e0bab||0xc8;return function(_0x6c7437){if(_0x6c7437){return _0x5d85ea['status'](_0x4e0bab)[_0x16f7('0x19')](_0x6c7437);}};}function respondWithFilteredResult(_0x384747,_0x69fb70){return function(_0xa7e713){if(_0xa7e713){var _0xc805e2=typeof _0x69fb70[_0x16f7('0x1a')]===_0x16f7('0x1b')&&typeof _0x69fb70[_0x16f7('0x1c')]==='undefined';var _0x43f05f=_0xa7e713[_0x16f7('0x1d')];var _0x5a88c8=_0xc805e2?0x0:_0x69fb70[_0x16f7('0x1a')];var _0x14f192=_0xc805e2?_0xa7e713[_0x16f7('0x1d')]:_0x69fb70[_0x16f7('0x1a')]+_0x69fb70[_0x16f7('0x1c')];var _0x3f5309;if(_0x14f192>=_0x43f05f){_0x14f192=_0x43f05f;_0x3f5309=0xc8;}else{_0x3f5309=0xce;}_0x384747[_0x16f7('0x17')](_0x3f5309);return _0x384747[_0x16f7('0x1e')](_0x16f7('0x1f'),_0x5a88c8+'-'+_0x14f192+'/'+_0x43f05f)[_0x16f7('0x19')](_0xa7e713);}return null;};}function patchUpdates(_0x5f329a){return function(_0x5e5c53){try{jsonpatch[_0x16f7('0x20')](_0x5e5c53,_0x5f329a,!![]);}catch(_0x537ec1){return BPromise[_0x16f7('0x21')](_0x537ec1);}return _0x5e5c53['save']();};}function saveUpdates(_0x150aff,_0x318983){return function(_0x12c84d){if(_0x12c84d){return _0x12c84d[_0x16f7('0x22')](_0x150aff)[_0x16f7('0x23')](function(_0xc6d313){return _0xc6d313;});}return null;};}function removeEntity(_0x2a28bd,_0x497b1c){return function(_0xca0191){if(_0xca0191){return _0xca0191[_0x16f7('0x24')]()['then'](function(){var _0x538ec7=_0xca0191[_0x16f7('0x25')]({'plain':!![]});var _0x4a8436='ExtractedReports';return db[_0x16f7('0x26')][_0x16f7('0x24')]({'where':{'type':_0x4a8436,'resourceId':_0x538ec7['id']}})[_0x16f7('0x23')](function(){return _0xca0191;});})[_0x16f7('0x23')](function(){_0x2a28bd[_0x16f7('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x15f23a,_0x408978){return function(_0x556e62){if(!_0x556e62){_0x15f23a[_0x16f7('0x27')](0x194);}return _0x556e62;};}function handleError(_0x30bc3d,_0x262011){_0x262011=_0x262011||0x1f4;return function(_0x11072a){logger['error'](_0x11072a['stack']);if(_0x11072a[_0x16f7('0x28')]){delete _0x11072a['name'];}_0x30bc3d[_0x16f7('0x17')](_0x262011)[_0x16f7('0x29')](_0x11072a);};}exports[_0x16f7('0x2a')]=function(_0x6b6317,_0x371935){var _0x123173={},_0x2818ad={},_0x14782f={'count':0x0,'rows':[]};var _0x774e40=_[_0x16f7('0x2b')](db['AnalyticExtractedReport'][_0x16f7('0x2c')],function(_0x3135cb){return{'name':_0x3135cb[_0x16f7('0x2d')],'type':_0x3135cb['type'][_0x16f7('0x2e')]};});_0x2818ad[_0x16f7('0x2f')]=_[_0x16f7('0x2b')](_0x774e40,_0x16f7('0x28'));_0x2818ad[_0x16f7('0x30')]=_['keys'](_0x6b6317[_0x16f7('0x30')]);_0x2818ad[_0x16f7('0x31')]=_[_0x16f7('0x32')](_0x2818ad[_0x16f7('0x2f')],_0x2818ad['query']);_0x123173[_0x16f7('0x33')]=_['intersection'](_0x2818ad[_0x16f7('0x2f')],qs[_0x16f7('0x34')](_0x6b6317[_0x16f7('0x30')][_0x16f7('0x34')]));_0x123173[_0x16f7('0x33')]=_0x123173[_0x16f7('0x33')][_0x16f7('0x35')]?_0x123173[_0x16f7('0x33')]:_0x2818ad[_0x16f7('0x2f')];if(!_0x6b6317[_0x16f7('0x30')][_0x16f7('0x36')](_0x16f7('0x37'))){_0x123173['limit']=qs[_0x16f7('0x1c')](_0x6b6317[_0x16f7('0x30')][_0x16f7('0x1c')]);_0x123173['offset']=qs['offset'](_0x6b6317[_0x16f7('0x30')][_0x16f7('0x1a')]);}_0x123173[_0x16f7('0x38')]=qs[_0x16f7('0x39')](_0x6b6317[_0x16f7('0x30')][_0x16f7('0x39')]);_0x123173[_0x16f7('0x3a')]=qs[_0x16f7('0x31')](_['pick'](_0x6b6317[_0x16f7('0x30')],_0x2818ad[_0x16f7('0x31')]),_0x774e40);if(_0x6b6317[_0x16f7('0x30')][_0x16f7('0x3b')]){_0x123173[_0x16f7('0x3a')]=_[_0x16f7('0x3c')](_0x123173[_0x16f7('0x3a')],{'$or':_[_0x16f7('0x2b')](_0x774e40,function(_0x4d5140){if(_0x4d5140['type']!==_0x16f7('0x3d')){var _0x2f3c33={};_0x2f3c33[_0x4d5140['name']]={'$like':'%'+_0x6b6317[_0x16f7('0x30')][_0x16f7('0x3b')]+'%'};return _0x2f3c33;}})});}_0x123173=_[_0x16f7('0x3c')]({},_0x123173,_0x6b6317[_0x16f7('0x3e')]);var _0x16830d={'where':_0x123173[_0x16f7('0x3a')]};return db[_0x16f7('0x3f')]['count'](_0x16830d)[_0x16f7('0x23')](function(_0x379f7a){_0x14782f[_0x16f7('0x1d')]=_0x379f7a;if(_0x6b6317[_0x16f7('0x30')]['includeAll']){_0x123173[_0x16f7('0x40')]=[{'all':!![]}];}return db[_0x16f7('0x3f')][_0x16f7('0x41')](_0x123173);})['then'](function(_0x1ae5be){_0x14782f[_0x16f7('0x42')]=_0x1ae5be;return _0x14782f;})['then'](respondWithFilteredResult(_0x371935,_0x123173))[_0x16f7('0x43')](handleError(_0x371935,null));};exports['show']=function(_0x54cfda,_0x3f9c71){var _0x4198f4={'raw':!![],'where':{'id':_0x54cfda[_0x16f7('0x44')]['id']}},_0x2b2dc4={};_0x2b2dc4[_0x16f7('0x2f')]=_[_0x16f7('0x45')](db[_0x16f7('0x3f')]['rawAttributes']);_0x2b2dc4['query']=_['keys'](_0x54cfda['query']);_0x2b2dc4[_0x16f7('0x31')]=_['intersection'](_0x2b2dc4[_0x16f7('0x2f')],_0x2b2dc4[_0x16f7('0x30')]);_0x4198f4[_0x16f7('0x33')]=_[_0x16f7('0x32')](_0x2b2dc4[_0x16f7('0x2f')],qs['fields'](_0x54cfda['query'][_0x16f7('0x34')]));_0x4198f4[_0x16f7('0x33')]=_0x4198f4[_0x16f7('0x33')][_0x16f7('0x35')]?_0x4198f4[_0x16f7('0x33')]:_0x2b2dc4[_0x16f7('0x2f')];if(_0x54cfda[_0x16f7('0x30')][_0x16f7('0x46')]){_0x4198f4[_0x16f7('0x40')]=[{'all':!![]}];}_0x4198f4=_[_0x16f7('0x3c')]({},_0x4198f4,_0x54cfda[_0x16f7('0x3e')]);return db[_0x16f7('0x3f')]['find'](_0x4198f4)[_0x16f7('0x23')](handleEntityNotFound(_0x3f9c71,null))['then'](respondWithResult(_0x3f9c71,null))[_0x16f7('0x43')](handleError(_0x3f9c71,null));};exports[_0x16f7('0x47')]=function(_0x22ecca,_0x5f462f){return db['AnalyticExtractedReport'][_0x16f7('0x47')](_0x22ecca[_0x16f7('0x48')],{})[_0x16f7('0x23')](function(_0x3448a4){var _0x2b9ac2=_0x22ecca['user'][_0x16f7('0x25')]({'plain':!![]});if(!_0x2b9ac2)throw new Error(_0x16f7('0x49'));if(_0x2b9ac2['role']===_0x16f7('0x4a')){var _0x161b87=_0x3448a4[_0x16f7('0x25')]({'plain':!![]});var _0x24b2a1=_0x16f7('0x4b');return db[_0x16f7('0x4c')][_0x16f7('0x4d')]({'where':{'name':_0x24b2a1,'userProfileId':_0x2b9ac2[_0x16f7('0x4e')]},'raw':!![]})[_0x16f7('0x23')](function(_0x3e95a0){if(_0x3e95a0&&_0x3e95a0[_0x16f7('0x4f')]===0x0){return db[_0x16f7('0x26')][_0x16f7('0x47')]({'name':_0x161b87['name'],'resourceId':_0x161b87['id'],'type':_0x3e95a0['name'],'sectionId':_0x3e95a0['id']},{})['then'](function(){return _0x3448a4;});}else{return _0x3448a4;}})[_0x16f7('0x43')](function(_0x140b88){logger[_0x16f7('0x50')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x140b88);throw _0x140b88;});}return _0x3448a4;})[_0x16f7('0x23')](respondWithResult(_0x5f462f,0xc9))[_0x16f7('0x43')](handleError(_0x5f462f,null));};exports[_0x16f7('0x22')]=function(_0x16446d,_0x25416d){if(_0x16446d[_0x16f7('0x48')]['id']){delete _0x16446d[_0x16f7('0x48')]['id'];}return db[_0x16f7('0x3f')]['find']({'where':{'id':_0x16446d[_0x16f7('0x44')]['id']}})[_0x16f7('0x23')](handleEntityNotFound(_0x25416d,null))['then'](saveUpdates(_0x16446d[_0x16f7('0x48')],null))['then'](respondWithResult(_0x25416d,null))[_0x16f7('0x43')](handleError(_0x25416d,null));};exports['destroy']=function(_0x565cf2,_0x4b6790){return db[_0x16f7('0x3f')][_0x16f7('0x4d')]({'where':{'id':_0x565cf2[_0x16f7('0x44')]['id']}})[_0x16f7('0x23')](handleEntityNotFound(_0x4b6790,null))[_0x16f7('0x23')](removeEntity(_0x4b6790,null))[_0x16f7('0x43')](handleError(_0x4b6790,null));};exports[_0x16f7('0x51')]=function(_0x1fae22,_0x3f9eca,_0x1b30f6){return db[_0x16f7('0x3f')][_0x16f7('0x4d')]({'where':{'id':_0x1fae22['params']['id']},'attributes':[_0x16f7('0x28'),'basename',_0x16f7('0x52'),'output'],'raw':!![]})[_0x16f7('0x23')](handleEntityNotFound(_0x3f9eca,null))[_0x16f7('0x23')](function(_0x27df65){if(_0x27df65){if(!fs['existsSync'](path[_0x16f7('0x53')](config[_0x16f7('0x54')],_0x16f7('0x55'),_0x27df65[_0x16f7('0x52')]))){throw new db[(_0x16f7('0x56'))][(_0x16f7('0x57'))]('Report\x20not\x20found\x20or\x20empty');}if(_0x1fae22[_0x16f7('0x30')][_0x16f7('0x58')]){return _0x3f9eca['sendStatus'](0xc8);}return _0x3f9eca[_0x16f7('0x51')](path[_0x16f7('0x53')](config[_0x16f7('0x54')],_0x16f7('0x55'),_0x27df65[_0x16f7('0x52')]),util[_0x16f7('0x59')]('%s.%s',_0x27df65[_0x16f7('0x5a')]||_0x27df65[_0x16f7('0x28')],_0x27df65[_0x16f7('0x5b')]['toLowerCase']()));}})[_0x16f7('0x43')](handleError(_0x3f9eca,null));}; \ No newline at end of file +var _0x2819=['ExtractedReports','error','stack','name','index','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','type','VIRTUAL','filter','options','AnalyticExtractedReport','includeAll','include','findAll','params','merge','find','catch','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','download','output','existsSync','root','server/files/reports','savename','Sequelize','Report\x20not\x20found\x20or\x20empty','exists','format','basename','toLowerCase','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','apply','then','destroy'];(function(_0x50aee6,_0x4cb5d7){var _0x30b530=function(_0x424aab){while(--_0x424aab){_0x50aee6['push'](_0x50aee6['shift']());}};_0x30b530(++_0x4cb5d7);}(_0x2819,0x14f));var _0x9281=function(_0xd9be0a,_0xa8dc94){_0xd9be0a=_0xd9be0a-0x0;var _0x2ecd86=_0x2819[_0xd9be0a];return _0x2ecd86;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x9281('0x0'));var jsonpatch=require(_0x9281('0x1'));var rp=require(_0x9281('0x2'));var moment=require(_0x9281('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x9281('0x4'));var util=require(_0x9281('0x5'));var path=require(_0x9281('0x6'));var sox=require(_0x9281('0x7'));var csv=require(_0x9281('0x8'));var ejs=require(_0x9281('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9281('0xa'));var squel=require(_0x9281('0xb'));var crypto=require(_0x9281('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x9281('0xd'));var toCsv=require(_0x9281('0x8'));var querystring=require(_0x9281('0xe'));var Papa=require('papaparse');var Redis=require(_0x9281('0xf'));var authService=require(_0x9281('0x10'));var qs=require(_0x9281('0x11'));var as=require(_0x9281('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9281('0x13'))(_0x9281('0x14'));var utils=require(_0x9281('0x15'));var config=require(_0x9281('0x16'));var licenseUtil=require(_0x9281('0x17'));var db=require(_0x9281('0x18'))['db'];function respondWithStatusCode(_0x26e0a5,_0x1e16b5){_0x1e16b5=_0x1e16b5||0xcc;return function(_0x5e5a2f){if(_0x5e5a2f){return _0x26e0a5[_0x9281('0x19')](_0x1e16b5);}return _0x26e0a5[_0x9281('0x1a')](_0x1e16b5)[_0x9281('0x1b')]();};}function respondWithResult(_0x1b49ce,_0x1728c4){_0x1728c4=_0x1728c4||0xc8;return function(_0x4126f9){if(_0x4126f9){return _0x1b49ce[_0x9281('0x1a')](_0x1728c4)[_0x9281('0x1c')](_0x4126f9);}};}function respondWithFilteredResult(_0x2c3eb8,_0x4cc7b0){return function(_0xe74414){if(_0xe74414){var _0x26c4c2=typeof _0x4cc7b0['offset']===_0x9281('0x1d')&&typeof _0x4cc7b0[_0x9281('0x1e')]==='undefined';var _0x184964=_0xe74414[_0x9281('0x1f')];var _0x126cc4=_0x26c4c2?0x0:_0x4cc7b0[_0x9281('0x20')];var _0x121cd4=_0x26c4c2?_0xe74414['count']:_0x4cc7b0[_0x9281('0x20')]+_0x4cc7b0['limit'];var _0x46df0c;if(_0x121cd4>=_0x184964){_0x121cd4=_0x184964;_0x46df0c=0xc8;}else{_0x46df0c=0xce;}_0x2c3eb8[_0x9281('0x1a')](_0x46df0c);return _0x2c3eb8[_0x9281('0x21')]('Content-Range',_0x126cc4+'-'+_0x121cd4+'/'+_0x184964)[_0x9281('0x1c')](_0xe74414);}return null;};}function patchUpdates(_0x38932e){return function(_0x1cc89e){try{jsonpatch[_0x9281('0x22')](_0x1cc89e,_0x38932e,!![]);}catch(_0x5820b9){return BPromise['reject'](_0x5820b9);}return _0x1cc89e['save']();};}function saveUpdates(_0x2b1771,_0x3bf9f0){return function(_0xb14ac0){if(_0xb14ac0){return _0xb14ac0['update'](_0x2b1771)[_0x9281('0x23')](function(_0x50596c){return _0x50596c;});}return null;};}function removeEntity(_0x121011,_0xafaa9d){return function(_0x2396c8){if(_0x2396c8){return _0x2396c8[_0x9281('0x24')]()[_0x9281('0x23')](function(){var _0x457428=_0x2396c8['get']({'plain':!![]});var _0x2d7d25=_0x9281('0x25');return db['UserProfileResource'][_0x9281('0x24')]({'where':{'type':_0x2d7d25,'resourceId':_0x457428['id']}})[_0x9281('0x23')](function(){return _0x2396c8;});})[_0x9281('0x23')](function(){_0x121011[_0x9281('0x1a')](0xcc)[_0x9281('0x1b')]();});}};}function handleEntityNotFound(_0x42cbcb,_0x1df6b5){return function(_0x248faf){if(!_0x248faf){_0x42cbcb[_0x9281('0x19')](0x194);}return _0x248faf;};}function handleError(_0xb7162d,_0x287000){_0x287000=_0x287000||0x1f4;return function(_0x421605){logger[_0x9281('0x26')](_0x421605[_0x9281('0x27')]);if(_0x421605[_0x9281('0x28')]){delete _0x421605[_0x9281('0x28')];}_0xb7162d[_0x9281('0x1a')](_0x287000)['send'](_0x421605);};}exports[_0x9281('0x29')]=function(_0x3db566,_0x55dae2){var _0x323fc9={},_0x49d5c9={},_0x39947={'count':0x0,'rows':[]};var _0x25ad25=_['map'](db['AnalyticExtractedReport'][_0x9281('0x2a')],function(_0x14a8f1){return{'name':_0x14a8f1[_0x9281('0x2b')],'type':_0x14a8f1['type'][_0x9281('0x2c')]};});_0x49d5c9[_0x9281('0x2d')]=_[_0x9281('0x2e')](_0x25ad25,'name');_0x49d5c9[_0x9281('0x2f')]=_[_0x9281('0x30')](_0x3db566['query']);_0x49d5c9[_0x9281('0x31')]=_[_0x9281('0x32')](_0x49d5c9[_0x9281('0x2d')],_0x49d5c9['query']);_0x323fc9['attributes']=_['intersection'](_0x49d5c9[_0x9281('0x2d')],qs[_0x9281('0x33')](_0x3db566[_0x9281('0x2f')][_0x9281('0x33')]));_0x323fc9[_0x9281('0x34')]=_0x323fc9[_0x9281('0x34')][_0x9281('0x35')]?_0x323fc9[_0x9281('0x34')]:_0x49d5c9[_0x9281('0x2d')];if(!_0x3db566['query'][_0x9281('0x36')](_0x9281('0x37'))){_0x323fc9[_0x9281('0x1e')]=qs[_0x9281('0x1e')](_0x3db566[_0x9281('0x2f')][_0x9281('0x1e')]);_0x323fc9[_0x9281('0x20')]=qs['offset'](_0x3db566[_0x9281('0x2f')][_0x9281('0x20')]);}_0x323fc9['order']=qs[_0x9281('0x38')](_0x3db566[_0x9281('0x2f')][_0x9281('0x38')]);_0x323fc9[_0x9281('0x39')]=qs['filters'](_[_0x9281('0x3a')](_0x3db566[_0x9281('0x2f')],_0x49d5c9['filters']),_0x25ad25);if(_0x3db566[_0x9281('0x2f')]['filter']){_0x323fc9[_0x9281('0x39')]=_['merge'](_0x323fc9[_0x9281('0x39')],{'$or':_[_0x9281('0x2e')](_0x25ad25,function(_0x36c93e){if(_0x36c93e[_0x9281('0x3b')]!==_0x9281('0x3c')){var _0x3754f0={};_0x3754f0[_0x36c93e[_0x9281('0x28')]]={'$like':'%'+_0x3db566['query'][_0x9281('0x3d')]+'%'};return _0x3754f0;}})});}_0x323fc9=_['merge']({},_0x323fc9,_0x3db566[_0x9281('0x3e')]);var _0x1b96c9={'where':_0x323fc9[_0x9281('0x39')]};return db[_0x9281('0x3f')][_0x9281('0x1f')](_0x1b96c9)[_0x9281('0x23')](function(_0x5cfc2d){_0x39947[_0x9281('0x1f')]=_0x5cfc2d;if(_0x3db566[_0x9281('0x2f')][_0x9281('0x40')]){_0x323fc9[_0x9281('0x41')]=[{'all':!![]}];}return db[_0x9281('0x3f')][_0x9281('0x42')](_0x323fc9);})[_0x9281('0x23')](function(_0x38fe70){_0x39947['rows']=_0x38fe70;return _0x39947;})[_0x9281('0x23')](respondWithFilteredResult(_0x55dae2,_0x323fc9))['catch'](handleError(_0x55dae2,null));};exports['show']=function(_0x30a9ae,_0x2276a2){var _0x2280f5={'raw':!![],'where':{'id':_0x30a9ae[_0x9281('0x43')]['id']}},_0x4d661d={};_0x4d661d[_0x9281('0x2d')]=_['keys'](db[_0x9281('0x3f')][_0x9281('0x2a')]);_0x4d661d[_0x9281('0x2f')]=_[_0x9281('0x30')](_0x30a9ae[_0x9281('0x2f')]);_0x4d661d[_0x9281('0x31')]=_[_0x9281('0x32')](_0x4d661d[_0x9281('0x2d')],_0x4d661d[_0x9281('0x2f')]);_0x2280f5['attributes']=_['intersection'](_0x4d661d[_0x9281('0x2d')],qs[_0x9281('0x33')](_0x30a9ae['query'][_0x9281('0x33')]));_0x2280f5[_0x9281('0x34')]=_0x2280f5[_0x9281('0x34')][_0x9281('0x35')]?_0x2280f5[_0x9281('0x34')]:_0x4d661d[_0x9281('0x2d')];if(_0x30a9ae['query'][_0x9281('0x40')]){_0x2280f5[_0x9281('0x41')]=[{'all':!![]}];}_0x2280f5=_[_0x9281('0x44')]({},_0x2280f5,_0x30a9ae[_0x9281('0x3e')]);return db[_0x9281('0x3f')][_0x9281('0x45')](_0x2280f5)['then'](handleEntityNotFound(_0x2276a2,null))['then'](respondWithResult(_0x2276a2,null))[_0x9281('0x46')](handleError(_0x2276a2,null));};exports[_0x9281('0x47')]=function(_0x16a3ba,_0x4857fe){return db[_0x9281('0x3f')][_0x9281('0x47')](_0x16a3ba[_0x9281('0x48')],{})['then'](function(_0x5be425){var _0x506330=_0x16a3ba[_0x9281('0x49')][_0x9281('0x4a')]({'plain':!![]});if(!_0x506330)throw new Error(_0x9281('0x4b'));if(_0x506330[_0x9281('0x4c')]===_0x9281('0x49')){var _0x3e2663=_0x5be425[_0x9281('0x4a')]({'plain':!![]});var _0x212dae=_0x9281('0x25');return db['UserProfileSection']['find']({'where':{'name':_0x212dae,'userProfileId':_0x506330[_0x9281('0x4d')]},'raw':!![]})[_0x9281('0x23')](function(_0x53807f){if(_0x53807f&&_0x53807f[_0x9281('0x4e')]===0x0){return db[_0x9281('0x4f')]['create']({'name':_0x3e2663[_0x9281('0x28')],'resourceId':_0x3e2663['id'],'type':_0x53807f[_0x9281('0x28')],'sectionId':_0x53807f['id']},{})['then'](function(){return _0x5be425;});}else{return _0x5be425;}})[_0x9281('0x46')](function(_0x5cbcd0){logger[_0x9281('0x26')](_0x9281('0x50'),_0x5cbcd0);throw _0x5cbcd0;});}return _0x5be425;})[_0x9281('0x23')](respondWithResult(_0x4857fe,0xc9))[_0x9281('0x46')](handleError(_0x4857fe,null));};exports['update']=function(_0x7ea4f4,_0x332f38){if(_0x7ea4f4[_0x9281('0x48')]['id']){delete _0x7ea4f4[_0x9281('0x48')]['id'];}return db[_0x9281('0x3f')][_0x9281('0x45')]({'where':{'id':_0x7ea4f4['params']['id']}})[_0x9281('0x23')](handleEntityNotFound(_0x332f38,null))[_0x9281('0x23')](saveUpdates(_0x7ea4f4[_0x9281('0x48')],null))['then'](respondWithResult(_0x332f38,null))[_0x9281('0x46')](handleError(_0x332f38,null));};exports[_0x9281('0x24')]=function(_0x305099,_0x29b227){return db[_0x9281('0x3f')][_0x9281('0x45')]({'where':{'id':_0x305099[_0x9281('0x43')]['id']}})[_0x9281('0x23')](handleEntityNotFound(_0x29b227,null))[_0x9281('0x23')](removeEntity(_0x29b227,null))['catch'](handleError(_0x29b227,null));};exports[_0x9281('0x51')]=function(_0x181bc6,_0x56ddbc,_0x481a98){return db[_0x9281('0x3f')][_0x9281('0x45')]({'where':{'id':_0x181bc6[_0x9281('0x43')]['id']},'attributes':['name','basename','savename',_0x9281('0x52')],'raw':!![]})[_0x9281('0x23')](handleEntityNotFound(_0x56ddbc,null))[_0x9281('0x23')](function(_0xa6e4e0){if(_0xa6e4e0){if(!fs[_0x9281('0x53')](path['join'](config[_0x9281('0x54')],_0x9281('0x55'),_0xa6e4e0[_0x9281('0x56')]))){throw new db[(_0x9281('0x57'))]['ValidationError'](_0x9281('0x58'));}if(_0x181bc6['query'][_0x9281('0x59')]){return _0x56ddbc[_0x9281('0x19')](0xc8);}return _0x56ddbc[_0x9281('0x51')](path['join'](config['root'],_0x9281('0x55'),_0xa6e4e0[_0x9281('0x56')]),util[_0x9281('0x5a')]('%s.%s',_0xa6e4e0[_0x9281('0x5b')]||_0xa6e4e0[_0x9281('0x28')],_0xa6e4e0[_0x9281('0x52')][_0x9281('0x5c')]()));}})[_0x9281('0x46')](handleError(_0x56ddbc,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index 0a4fa6c..fcdde82 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 _0x02b5=['analytics_extracted_reports','lodash','util','api','moment','rimraf','./analyticExtractedReport.attributes','define','AnalyticExtractedReport'];(function(_0x282700,_0x270bc0){var _0x178681=function(_0x1f97c9){while(--_0x1f97c9){_0x282700['push'](_0x282700['shift']());}};_0x178681(++_0x270bc0);}(_0x02b5,0xb5));var _0x502b=function(_0xabfdd,_0x3b1589){_0xabfdd=_0xabfdd-0x0;var _0x25c06c=_0x02b5[_0xabfdd];return _0x25c06c;};'use strict';var _=require(_0x502b('0x0'));var util=require(_0x502b('0x1'));var logger=require('../../config/logger')(_0x502b('0x2'));var moment=require(_0x502b('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x502b('0x4'));var config=require('../../config/environment');var attributes=require(_0x502b('0x5'));module['exports']=function(_0xf6b476,_0x4aad80){return _0xf6b476[_0x502b('0x6')](_0x502b('0x7'),attributes,{'tableName':_0x502b('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x11cb=['define','AnalyticExtractedReport','lodash','../../config/logger','api','path','rimraf','../../config/environment','exports'];(function(_0x126337,_0x391d14){var _0x162b45=function(_0x39cd9c){while(--_0x39cd9c){_0x126337['push'](_0x126337['shift']());}};_0x162b45(++_0x391d14);}(_0x11cb,0x1b2));var _0xb11c=function(_0x6d73cf,_0x3c0622){_0x6d73cf=_0x6d73cf-0x0;var _0x5bcc34=_0x11cb[_0x6d73cf];return _0x5bcc34;};'use strict';var _=require(_0xb11c('0x0'));var util=require('util');var logger=require(_0xb11c('0x1'))(_0xb11c('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xb11c('0x3'));var rimraf=require(_0xb11c('0x4'));var config=require(_0xb11c('0x5'));var attributes=require('./analyticExtractedReport.attributes');module[_0xb11c('0x6')]=function(_0x58f866,_0x3e596b){return _0x58f866[_0xb11c('0x7')](_0xb11c('0x8'),attributes,{'tableName':'analytics_extracted_reports','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.rpc.js b/server/api/analyticExtractedReport/analyticExtractedReport.rpc.js index 8fcc022..525f935 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 _0x3743=['code','AnalyticExtractedReport,\x20%s,\x20%s','message','result','catch','lodash','moment','randomstring','../../mysqldb','jayson/promise','client','then','info','request\x20sent','debug','stringify','error'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x3743,0xd1));var _0x3374=function(_0x46a671,_0x758e9a){_0x46a671=_0x46a671-0x0;var _0x526d75=_0x3743[_0x46a671];return _0x526d75;};'use strict';var _=require(_0x3374('0x0'));var util=require('util');var moment=require(_0x3374('0x1'));var BPromise=require('bluebird');var rs=require(_0x3374('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3374('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x3374('0x4'));var client=jayson[_0x3374('0x5')]['http']({'port':0x232a});function respondWithRpcPromise(_0x230a13,_0x58333f,_0xb537e6){return new BPromise(function(_0x2f6287,_0x12189f){return client['request'](_0x230a13,_0xb537e6)[_0x3374('0x6')](function(_0x5d3880){logger[_0x3374('0x7')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x58333f,_0x3374('0x8'));logger[_0x3374('0x9')]('AnalyticExtractedReport,\x20%s,\x20%s,\x20%s',_0x58333f,_0x3374('0x8'),JSON[_0x3374('0xa')](_0x5d3880));if(_0x5d3880[_0x3374('0xb')]){if(_0x5d3880[_0x3374('0xb')][_0x3374('0xc')]===0x1f4){logger['error'](_0x3374('0xd'),_0x58333f,_0x5d3880[_0x3374('0xb')][_0x3374('0xe')]);return _0x12189f(_0x5d3880['error']['message']);}logger[_0x3374('0xb')](_0x3374('0xd'),_0x58333f,_0x5d3880['error'][_0x3374('0xe')]);return _0x2f6287(_0x5d3880[_0x3374('0xb')]['message']);}else{logger[_0x3374('0x7')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x58333f,_0x3374('0x8'));_0x2f6287(_0x5d3880[_0x3374('0xf')][_0x3374('0xe')]);}})[_0x3374('0x10')](function(_0x3ce639){logger['error'](_0x3374('0xd'),_0x58333f,_0x3ce639);_0x12189f(_0x3ce639);});});} \ No newline at end of file +var _0x002b=['randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','message','AnalyticExtractedReport,\x20%s,\x20%s','result','lodash','util','bluebird'];(function(_0x273eec,_0x139927){var _0x5771d7=function(_0x2f1967){while(--_0x2f1967){_0x273eec['push'](_0x273eec['shift']());}};_0x5771d7(++_0x139927);}(_0x002b,0x138));var _0xb002=function(_0xb603f1,_0x31555a){_0xb603f1=_0xb603f1-0x0;var _0x5a77aa=_0x002b[_0xb603f1];return _0x5a77aa;};'use strict';var _=require(_0xb002('0x0'));var util=require(_0xb002('0x1'));var moment=require('moment');var BPromise=require(_0xb002('0x2'));var rs=require(_0xb002('0x3'));var fs=require('fs');var Redis=require(_0xb002('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xb002('0x5'));var logger=require(_0xb002('0x6'))('rpc');var config=require(_0xb002('0x7'));var jayson=require(_0xb002('0x8'));var client=jayson[_0xb002('0x9')][_0xb002('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x270026,_0x10453e,_0x290479){return new BPromise(function(_0x559803,_0x483a5c){return client[_0xb002('0xb')](_0x270026,_0x290479)[_0xb002('0xc')](function(_0x5ae886){logger[_0xb002('0xd')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x10453e,_0xb002('0xe'));logger[_0xb002('0xf')]('AnalyticExtractedReport,\x20%s,\x20%s,\x20%s',_0x10453e,'request\x20sent',JSON[_0xb002('0x10')](_0x5ae886));if(_0x5ae886[_0xb002('0x11')]){if(_0x5ae886[_0xb002('0x11')]['code']===0x1f4){logger[_0xb002('0x11')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x10453e,_0x5ae886[_0xb002('0x11')][_0xb002('0x12')]);return _0x483a5c(_0x5ae886[_0xb002('0x11')][_0xb002('0x12')]);}logger['error'](_0xb002('0x13'),_0x10453e,_0x5ae886[_0xb002('0x11')][_0xb002('0x12')]);return _0x559803(_0x5ae886[_0xb002('0x11')][_0xb002('0x12')]);}else{logger['info'](_0xb002('0x13'),_0x10453e,_0xb002('0xe'));_0x559803(_0x5ae886[_0xb002('0x14')]['message']);}})['catch'](function(_0x597b0a){logger[_0xb002('0x11')](_0xb002('0x13'),_0x10453e,_0x597b0a);_0x483a5c(_0x597b0a);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index ca83bd1..26c6ef4 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 _0x55dc=['util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id','/:id/download','download','post','create','put','update','exports'];(function(_0x56fbaa,_0x3bc5a6){var _0x49fbc1=function(_0x19b08b){while(--_0x19b08b){_0x56fbaa['push'](_0x56fbaa['shift']());}};_0x49fbc1(++_0x3bc5a6);}(_0x55dc,0x10e));var _0xc55d=function(_0xdaa031,_0x1b6b9d){_0xdaa031=_0xdaa031-0x0;var _0x17b754=_0x55dc[_0xdaa031];return _0x17b754;};'use strict';var multer=require('multer');var util=require(_0xc55d('0x0'));var path=require(_0xc55d('0x1'));var timeout=require(_0xc55d('0x2'));var express=require(_0xc55d('0x3'));var router=express['Router']();var fs_extra=require(_0xc55d('0x4'));var auth=require(_0xc55d('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xc55d('0x6'));var controller=require('./analyticExtractedReport.controller');router[_0xc55d('0x7')]('/',auth[_0xc55d('0x8')](),controller[_0xc55d('0x9')]);router[_0xc55d('0x7')](_0xc55d('0xa'),auth[_0xc55d('0x8')](),controller['show']);router[_0xc55d('0x7')](_0xc55d('0xb'),auth['isAuthenticated'](),controller[_0xc55d('0xc')]);router[_0xc55d('0xd')]('/',auth['isAuthenticated'](),controller[_0xc55d('0xe')]);router[_0xc55d('0xf')](_0xc55d('0xa'),auth['isAuthenticated'](),controller[_0xc55d('0x10')]);router['delete'](_0xc55d('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0xc55d('0x11')]=router; \ No newline at end of file +var _0x8f5d=['show','/:id/download','post','put','update','destroy','exports','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','/:id'];(function(_0x16337a,_0x4789a1){var _0x422365=function(_0x34f039){while(--_0x34f039){_0x16337a['push'](_0x16337a['shift']());}};_0x422365(++_0x4789a1);}(_0x8f5d,0xa9));var _0xd8f5=function(_0x1203f,_0x554bbc){_0x1203f=_0x1203f-0x0;var _0x365f0a=_0x8f5d[_0x1203f];return _0x365f0a;};'use strict';var multer=require('multer');var util=require(_0xd8f5('0x0'));var path=require(_0xd8f5('0x1'));var timeout=require('connect-timeout');var express=require(_0xd8f5('0x2'));var router=express[_0xd8f5('0x3')]();var fs_extra=require(_0xd8f5('0x4'));var auth=require(_0xd8f5('0x5'));var interaction=require(_0xd8f5('0x6'));var config=require(_0xd8f5('0x7'));var controller=require('./analyticExtractedReport.controller');router['get']('/',auth[_0xd8f5('0x8')](),controller['index']);router[_0xd8f5('0x9')](_0xd8f5('0xa'),auth[_0xd8f5('0x8')](),controller[_0xd8f5('0xb')]);router[_0xd8f5('0x9')](_0xd8f5('0xc'),auth[_0xd8f5('0x8')](),controller['download']);router[_0xd8f5('0xd')]('/',auth[_0xd8f5('0x8')](),controller['create']);router[_0xd8f5('0xe')]('/:id',auth['isAuthenticated'](),controller[_0xd8f5('0xf')]);router['delete'](_0xd8f5('0xa'),auth[_0xd8f5('0x8')](),controller[_0xd8f5('0x10')]);module[_0xd8f5('0x11')]=router; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.attributes.js b/server/api/analyticFieldReport/analyticFieldReport.attributes.js index dd4e090..90b1ef6 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 _0x78ed=['sequelize','exports','STRING','BOOLEAN'];(function(_0x4dbaad,_0x730318){var _0x226c72=function(_0x501972){while(--_0x501972){_0x4dbaad['push'](_0x4dbaad['shift']());}};_0x226c72(++_0x730318);}(_0x78ed,0xec));var _0xd78e=function(_0x21f75e,_0x3ccd22){_0x21f75e=_0x21f75e-0x0;var _0x5f2c0f=_0x78ed[_0x21f75e];return _0x5f2c0f;};'use strict';var Sequelize=require(_0xd78e('0x0'));module[_0xd78e('0x1')]={'field':{'type':Sequelize['TEXT']},'alias':{'type':Sequelize[_0xd78e('0x2')]},'function':{'type':Sequelize['STRING']},'format':{'type':Sequelize[_0xd78e('0x2')]},'groupBy':{'type':Sequelize[_0xd78e('0x3')],'defaultValue':![]},'orderBy':{'type':Sequelize['STRING']},'custom':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xe767=['STRING','BOOLEAN','sequelize','TEXT'];(function(_0x45fc6a,_0x166adb){var _0x14bcfd=function(_0x3ba718){while(--_0x3ba718){_0x45fc6a['push'](_0x45fc6a['shift']());}};_0x14bcfd(++_0x166adb);}(_0xe767,0x11a));var _0x7e76=function(_0x248031,_0xb67576){_0x248031=_0x248031-0x0;var _0x5d144d=_0xe767[_0x248031];return _0x5d144d;};'use strict';var Sequelize=require(_0x7e76('0x0'));module['exports']={'field':{'type':Sequelize[_0x7e76('0x1')]},'alias':{'type':Sequelize['STRING']},'function':{'type':Sequelize[_0x7e76('0x2')]},'format':{'type':Sequelize[_0x7e76('0x2')]},'groupBy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'orderBy':{'type':Sequelize['STRING']},'custom':{'type':Sequelize[_0x7e76('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.controller.js b/server/api/analyticFieldReport/analyticFieldReport.controller.js index 5f0beb1..6295cc3 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 _0x613e=['body','params','bulkDestroy','ids','addFields','transaction','CustomReportId','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','fs-extra','lodash','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','status','end','undefined','limit','count','offset','Content-Range','json','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','AnalyticFieldReport','rawAttributes','fieldName','type','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','VIRTUAL','filter','merge','options','includeAll','findAll','rows','catch','show','keys','include','find','create','bulkCreate'];(function(_0x391eb4,_0x5a855a){var _0x40079c=function(_0x125d66){while(--_0x125d66){_0x391eb4['push'](_0x391eb4['shift']());}};_0x40079c(++_0x5a855a);}(_0x613e,0xa7));var _0xe613=function(_0x15b552,_0x27f26b){_0x15b552=_0x15b552-0x0;var _0x3a9523=_0x613e[_0x15b552];return _0x3a9523;};'use strict';var emlformat=require(_0xe613('0x0'));var rimraf=require(_0xe613('0x1'));var zipdir=require(_0xe613('0x2'));var jsonpatch=require(_0xe613('0x3'));var rp=require(_0xe613('0x4'));var moment=require(_0xe613('0x5'));var BPromise=require(_0xe613('0x6'));var Mustache=require('mustache');var util=require(_0xe613('0x7'));var path=require(_0xe613('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe613('0x9'));var _=require(_0xe613('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xe613('0xb'));var deskjs=require(_0xe613('0xc'));var toCsv=require(_0xe613('0xd'));var querystring=require(_0xe613('0xe'));var Papa=require(_0xe613('0xf'));var Redis=require(_0xe613('0x10'));var authService=require(_0xe613('0x11'));var qs=require(_0xe613('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe613('0x13'));var logger=require(_0xe613('0x14'))('api');var utils=require(_0xe613('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xe613('0x16'))['db'];function respondWithStatusCode(_0x1c5188,_0x5b7af0){_0x5b7af0=_0x5b7af0||0xcc;return function(_0x477225){if(_0x477225){return _0x1c5188['sendStatus'](_0x5b7af0);}return _0x1c5188[_0xe613('0x17')](_0x5b7af0)[_0xe613('0x18')]();};}function respondWithResult(_0x373f28,_0x395502){_0x395502=_0x395502||0xc8;return function(_0x5c8f29){if(_0x5c8f29){return _0x373f28[_0xe613('0x17')](_0x395502)['json'](_0x5c8f29);}};}function respondWithFilteredResult(_0x100fc1,_0x4e024d){return function(_0x511cf8){if(_0x511cf8){var _0xc4ff83=typeof _0x4e024d['offset']===_0xe613('0x19')&&typeof _0x4e024d[_0xe613('0x1a')]==='undefined';var _0x5d7608=_0x511cf8[_0xe613('0x1b')];var _0x4dd212=_0xc4ff83?0x0:_0x4e024d[_0xe613('0x1c')];var _0x767989=_0xc4ff83?_0x511cf8['count']:_0x4e024d[_0xe613('0x1c')]+_0x4e024d[_0xe613('0x1a')];var _0x27842e;if(_0x767989>=_0x5d7608){_0x767989=_0x5d7608;_0x27842e=0xc8;}else{_0x27842e=0xce;}_0x100fc1['status'](_0x27842e);return _0x100fc1['set'](_0xe613('0x1d'),_0x4dd212+'-'+_0x767989+'/'+_0x5d7608)[_0xe613('0x1e')](_0x511cf8);}return null;};}function patchUpdates(_0x1ae539){return function(_0x283128){try{jsonpatch[_0xe613('0x1f')](_0x283128,_0x1ae539,!![]);}catch(_0x1fc67c){return BPromise[_0xe613('0x20')](_0x1fc67c);}return _0x283128[_0xe613('0x21')]();};}function saveUpdates(_0x744e7e,_0x56d677){return function(_0x46fe1d){if(_0x46fe1d){return _0x46fe1d[_0xe613('0x22')](_0x744e7e)[_0xe613('0x23')](function(_0x18ae16){return _0x18ae16;});}return null;};}function removeEntity(_0x56bc4d,_0x39b30e){return function(_0x3d7b1b){if(_0x3d7b1b){return _0x3d7b1b[_0xe613('0x24')]()[_0xe613('0x23')](function(){_0x56bc4d[_0xe613('0x17')](0xcc)[_0xe613('0x18')]();});}};}function handleEntityNotFound(_0x8735b1,_0x5da3d6){return function(_0x3fbc62){if(!_0x3fbc62){_0x8735b1[_0xe613('0x25')](0x194);}return _0x3fbc62;};}function handleError(_0x1af053,_0x2be5ca){_0x2be5ca=_0x2be5ca||0x1f4;return function(_0x1404fb){logger[_0xe613('0x26')](_0x1404fb[_0xe613('0x27')]);if(_0x1404fb[_0xe613('0x28')]){delete _0x1404fb[_0xe613('0x28')];}_0x1af053[_0xe613('0x17')](_0x2be5ca)['send'](_0x1404fb);};}exports['index']=function(_0x1edc4a,_0x410372){var _0x2798af={},_0x41b0eb={},_0x5a7281={'count':0x0,'rows':[]};var _0x19ad60=_['map'](db[_0xe613('0x29')][_0xe613('0x2a')],function(_0x3ffaf5){return{'name':_0x3ffaf5[_0xe613('0x2b')],'type':_0x3ffaf5[_0xe613('0x2c')]['key']};});_0x41b0eb[_0xe613('0x2d')]=_[_0xe613('0x2e')](_0x19ad60,_0xe613('0x28'));_0x41b0eb['query']=_['keys'](_0x1edc4a[_0xe613('0x2f')]);_0x41b0eb[_0xe613('0x30')]=_[_0xe613('0x31')](_0x41b0eb[_0xe613('0x2d')],_0x41b0eb['query']);_0x2798af[_0xe613('0x32')]=_['intersection'](_0x41b0eb[_0xe613('0x2d')],qs[_0xe613('0x33')](_0x1edc4a[_0xe613('0x2f')]['fields']));_0x2798af['attributes']=_0x2798af[_0xe613('0x32')][_0xe613('0x34')]?_0x2798af['attributes']:_0x41b0eb[_0xe613('0x2d')];if(!_0x1edc4a['query'][_0xe613('0x35')](_0xe613('0x36'))){_0x2798af[_0xe613('0x1a')]=qs[_0xe613('0x1a')](_0x1edc4a[_0xe613('0x2f')][_0xe613('0x1a')]);_0x2798af[_0xe613('0x1c')]=qs[_0xe613('0x1c')](_0x1edc4a['query'][_0xe613('0x1c')]);}_0x2798af[_0xe613('0x37')]=qs[_0xe613('0x38')](_0x1edc4a['query']['sort']);_0x2798af['where']=qs[_0xe613('0x30')](_[_0xe613('0x39')](_0x1edc4a[_0xe613('0x2f')],_0x41b0eb[_0xe613('0x30')]),_0x19ad60);if(_0x1edc4a[_0xe613('0x2f')]['filter']){_0x2798af[_0xe613('0x3a')]=_['merge'](_0x2798af[_0xe613('0x3a')],{'$or':_[_0xe613('0x2e')](_0x19ad60,function(_0x1e4a2b){if(_0x1e4a2b[_0xe613('0x2c')]!==_0xe613('0x3b')){var _0x14cb53={};_0x14cb53[_0x1e4a2b[_0xe613('0x28')]]={'$like':'%'+_0x1edc4a[_0xe613('0x2f')][_0xe613('0x3c')]+'%'};return _0x14cb53;}})});}_0x2798af=_[_0xe613('0x3d')]({},_0x2798af,_0x1edc4a[_0xe613('0x3e')]);var _0x1151f5={'where':_0x2798af[_0xe613('0x3a')]};return db[_0xe613('0x29')][_0xe613('0x1b')](_0x1151f5)[_0xe613('0x23')](function(_0x3c844){_0x5a7281['count']=_0x3c844;if(_0x1edc4a[_0xe613('0x2f')][_0xe613('0x3f')]){_0x2798af['include']=[{'all':!![]}];}return db[_0xe613('0x29')][_0xe613('0x40')](_0x2798af);})[_0xe613('0x23')](function(_0xa0634){_0x5a7281[_0xe613('0x41')]=_0xa0634;return _0x5a7281;})[_0xe613('0x23')](respondWithFilteredResult(_0x410372,_0x2798af))[_0xe613('0x42')](handleError(_0x410372,null));};exports[_0xe613('0x43')]=function(_0x5c2e56,_0x5542c4){var _0x5eda54={'raw':![],'where':{'id':_0x5c2e56['params']['id']}},_0x2266e8={};_0x2266e8[_0xe613('0x2d')]=_['keys'](db[_0xe613('0x29')][_0xe613('0x2a')]);_0x2266e8['query']=_[_0xe613('0x44')](_0x5c2e56[_0xe613('0x2f')]);_0x2266e8[_0xe613('0x30')]=_[_0xe613('0x31')](_0x2266e8[_0xe613('0x2d')],_0x2266e8['query']);_0x5eda54[_0xe613('0x32')]=_[_0xe613('0x31')](_0x2266e8[_0xe613('0x2d')],qs['fields'](_0x5c2e56[_0xe613('0x2f')][_0xe613('0x33')]));_0x5eda54[_0xe613('0x32')]=_0x5eda54['attributes']['length']?_0x5eda54['attributes']:_0x2266e8[_0xe613('0x2d')];if(_0x5c2e56['query'][_0xe613('0x3f')]){_0x5eda54[_0xe613('0x45')]=[{'all':!![]}];}_0x5eda54=_[_0xe613('0x3d')]({},_0x5eda54,_0x5c2e56[_0xe613('0x3e')]);return db['AnalyticFieldReport'][_0xe613('0x46')](_0x5eda54)[_0xe613('0x23')](handleEntityNotFound(_0x5542c4,null))[_0xe613('0x23')](respondWithResult(_0x5542c4,null))[_0xe613('0x42')](handleError(_0x5542c4,null));};exports[_0xe613('0x47')]=function(_0xd12708,_0x3affb1){return db[_0xe613('0x29')]['create'](_0xd12708['body'],{})[_0xe613('0x23')](respondWithResult(_0x3affb1,0xc9))['catch'](handleError(_0x3affb1,null));};exports[_0xe613('0x48')]=function(_0x5f4415,_0x53e86f){return db[_0xe613('0x29')][_0xe613('0x48')](_0x5f4415[_0xe613('0x49')],{'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x53e86f,0xc9))[_0xe613('0x42')](handleError(_0x53e86f,null));};exports['update']=function(_0x17ae16,_0x37839d){if(_0x17ae16[_0xe613('0x49')]['id']){delete _0x17ae16[_0xe613('0x49')]['id'];}return db[_0xe613('0x29')][_0xe613('0x46')]({'where':{'id':_0x17ae16['params']['id']}})[_0xe613('0x23')](handleEntityNotFound(_0x37839d,null))['then'](saveUpdates(_0x17ae16[_0xe613('0x49')],null))[_0xe613('0x23')](respondWithResult(_0x37839d,null))[_0xe613('0x42')](handleError(_0x37839d,null));};exports[_0xe613('0x24')]=function(_0x283bb2,_0x424ca6){return db['AnalyticFieldReport'][_0xe613('0x46')]({'where':{'id':_0x283bb2[_0xe613('0x4a')]['id']}})[_0xe613('0x23')](handleEntityNotFound(_0x424ca6,null))[_0xe613('0x23')](removeEntity(_0x424ca6,null))[_0xe613('0x42')](handleError(_0x424ca6,null));};exports[_0xe613('0x4b')]=function(_0x2f9e75,_0x27d62e){return db[_0xe613('0x29')][_0xe613('0x24')]({'where':{'id':_0x2f9e75[_0xe613('0x2f')][_0xe613('0x4c')]||[]},'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x27d62e,0xcc))[_0xe613('0x42')](handleError(_0x27d62e,null));};exports[_0xe613('0x4d')]=function(_0x923701,_0x2f9436,_0x261a3e){return db['AnalyticCustomReport']['findOne']({'where':{'id':_0x923701['params']['id']}})['then'](handleEntityNotFound(_0x2f9436,null))[_0xe613('0x23')](function(_0x4e9618){if(_0x4e9618){return db['sequelize'][_0xe613('0x4e')](function(_0x323864){return db[_0xe613('0x29')][_0xe613('0x24')]({'where':{'CustomReportId':_0x923701[_0xe613('0x4a')]['id']},'transaction':_0x323864})[_0xe613('0x23')](function(_0x2c0a0a){var _0x4d5ee1=_[_0xe613('0x2e')](_0x923701[_0xe613('0x49')],function(_0x4c29cb){delete _0x4c29cb['id'];_0x4c29cb[_0xe613('0x4f')]=_0x923701[_0xe613('0x4a')]['id'];return _0x4c29cb;});return db['AnalyticFieldReport']['bulkCreate'](_0x4d5ee1,{'transaction':_0x323864});});})[_0xe613('0x23')](function(){return db[_0xe613('0x29')][_0xe613('0x40')]({'where':{'CustomReportId':_0x923701['params']['id']}});});}})[_0xe613('0x23')](respondWithResult(_0x2f9436,null))['catch'](handleError(_0x2f9436,null));}; \ No newline at end of file +var _0x78eb=['params','find','create','body','bulkCreate','ids','addFields','findOne','transaction','CustomReportId','findAll','rimraf','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','AnalyticFieldReport','catch'];(function(_0x4ae6ef,_0xc2af80){var _0x3cbb4e=function(_0x569ad5){while(--_0x569ad5){_0x4ae6ef['push'](_0x4ae6ef['shift']());}};_0x3cbb4e(++_0xc2af80);}(_0x78eb,0x153));var _0xb78e=function(_0x2ba31b,_0x44b207){_0x2ba31b=_0x2ba31b-0x0;var _0x23d222=_0x78eb[_0x2ba31b];return _0x23d222;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb78e('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xb78e('0x1'));var moment=require(_0xb78e('0x2'));var BPromise=require(_0xb78e('0x3'));var Mustache=require(_0xb78e('0x4'));var util=require(_0xb78e('0x5'));var path=require(_0xb78e('0x6'));var sox=require('sox');var csv=require(_0xb78e('0x7'));var ejs=require(_0xb78e('0x8'));var fs=require('fs');var fs_extra=require(_0xb78e('0x9'));var _=require(_0xb78e('0xa'));var squel=require(_0xb78e('0xb'));var crypto=require(_0xb78e('0xc'));var jsforce=require(_0xb78e('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xb78e('0x7'));var querystring=require(_0xb78e('0xe'));var Papa=require(_0xb78e('0xf'));var Redis=require(_0xb78e('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xb78e('0x11'));var as=require(_0xb78e('0x12'));var hardwareService=require(_0xb78e('0x13'));var logger=require(_0xb78e('0x14'))('api');var utils=require(_0xb78e('0x15'));var config=require(_0xb78e('0x16'));var licenseUtil=require(_0xb78e('0x17'));var db=require(_0xb78e('0x18'))['db'];function respondWithStatusCode(_0x53ed2e,_0x5a625c){_0x5a625c=_0x5a625c||0xcc;return function(_0x5648a7){if(_0x5648a7){return _0x53ed2e['sendStatus'](_0x5a625c);}return _0x53ed2e[_0xb78e('0x19')](_0x5a625c)[_0xb78e('0x1a')]();};}function respondWithResult(_0x3cbf2a,_0x16c8da){_0x16c8da=_0x16c8da||0xc8;return function(_0x2cf88c){if(_0x2cf88c){return _0x3cbf2a['status'](_0x16c8da)['json'](_0x2cf88c);}};}function respondWithFilteredResult(_0x12549c,_0x315ac2){return function(_0xc178f8){if(_0xc178f8){var _0x3a9f87=typeof _0x315ac2[_0xb78e('0x1b')]===_0xb78e('0x1c')&&typeof _0x315ac2[_0xb78e('0x1d')]===_0xb78e('0x1c');var _0x5316d3=_0xc178f8['count'];var _0x3bd8e9=_0x3a9f87?0x0:_0x315ac2[_0xb78e('0x1b')];var _0x3ceca8=_0x3a9f87?_0xc178f8[_0xb78e('0x1e')]:_0x315ac2[_0xb78e('0x1b')]+_0x315ac2[_0xb78e('0x1d')];var _0x4a1a43;if(_0x3ceca8>=_0x5316d3){_0x3ceca8=_0x5316d3;_0x4a1a43=0xc8;}else{_0x4a1a43=0xce;}_0x12549c[_0xb78e('0x19')](_0x4a1a43);return _0x12549c[_0xb78e('0x1f')](_0xb78e('0x20'),_0x3bd8e9+'-'+_0x3ceca8+'/'+_0x5316d3)['json'](_0xc178f8);}return null;};}function patchUpdates(_0xa9bd30){return function(_0x49b8f7){try{jsonpatch[_0xb78e('0x21')](_0x49b8f7,_0xa9bd30,!![]);}catch(_0x1a3071){return BPromise[_0xb78e('0x22')](_0x1a3071);}return _0x49b8f7['save']();};}function saveUpdates(_0x1cab74,_0xe76b1){return function(_0x1bc524){if(_0x1bc524){return _0x1bc524[_0xb78e('0x23')](_0x1cab74)[_0xb78e('0x24')](function(_0x28a96e){return _0x28a96e;});}return null;};}function removeEntity(_0x141028,_0x1701ad){return function(_0x11792f){if(_0x11792f){return _0x11792f[_0xb78e('0x25')]()['then'](function(){_0x141028[_0xb78e('0x19')](0xcc)[_0xb78e('0x1a')]();});}};}function handleEntityNotFound(_0x123185,_0xb45429){return function(_0x5349c8){if(!_0x5349c8){_0x123185[_0xb78e('0x26')](0x194);}return _0x5349c8;};}function handleError(_0x19a797,_0x3aa958){_0x3aa958=_0x3aa958||0x1f4;return function(_0x135f89){logger[_0xb78e('0x27')](_0x135f89[_0xb78e('0x28')]);if(_0x135f89[_0xb78e('0x29')]){delete _0x135f89['name'];}_0x19a797[_0xb78e('0x19')](_0x3aa958)[_0xb78e('0x2a')](_0x135f89);};}exports[_0xb78e('0x2b')]=function(_0x2d5a95,_0x195363){var _0x95f9e9={},_0x1f4459={},_0x3efdac={'count':0x0,'rows':[]};var _0x16bc21=_[_0xb78e('0x2c')](db['AnalyticFieldReport'][_0xb78e('0x2d')],function(_0x42995c){return{'name':_0x42995c[_0xb78e('0x2e')],'type':_0x42995c[_0xb78e('0x2f')][_0xb78e('0x30')]};});_0x1f4459[_0xb78e('0x31')]=_[_0xb78e('0x2c')](_0x16bc21,'name');_0x1f4459[_0xb78e('0x32')]=_[_0xb78e('0x33')](_0x2d5a95[_0xb78e('0x32')]);_0x1f4459[_0xb78e('0x34')]=_[_0xb78e('0x35')](_0x1f4459[_0xb78e('0x31')],_0x1f4459[_0xb78e('0x32')]);_0x95f9e9['attributes']=_['intersection'](_0x1f4459[_0xb78e('0x31')],qs[_0xb78e('0x36')](_0x2d5a95['query'][_0xb78e('0x36')]));_0x95f9e9[_0xb78e('0x37')]=_0x95f9e9[_0xb78e('0x37')][_0xb78e('0x38')]?_0x95f9e9['attributes']:_0x1f4459[_0xb78e('0x31')];if(!_0x2d5a95['query'][_0xb78e('0x39')](_0xb78e('0x3a'))){_0x95f9e9['limit']=qs[_0xb78e('0x1d')](_0x2d5a95[_0xb78e('0x32')]['limit']);_0x95f9e9[_0xb78e('0x1b')]=qs['offset'](_0x2d5a95[_0xb78e('0x32')][_0xb78e('0x1b')]);}_0x95f9e9[_0xb78e('0x3b')]=qs[_0xb78e('0x3c')](_0x2d5a95[_0xb78e('0x32')][_0xb78e('0x3c')]);_0x95f9e9[_0xb78e('0x3d')]=qs[_0xb78e('0x34')](_[_0xb78e('0x3e')](_0x2d5a95[_0xb78e('0x32')],_0x1f4459[_0xb78e('0x34')]),_0x16bc21);if(_0x2d5a95[_0xb78e('0x32')][_0xb78e('0x3f')]){_0x95f9e9['where']=_[_0xb78e('0x40')](_0x95f9e9[_0xb78e('0x3d')],{'$or':_['map'](_0x16bc21,function(_0x709d7a){if(_0x709d7a['type']!==_0xb78e('0x41')){var _0x5b235b={};_0x5b235b[_0x709d7a[_0xb78e('0x29')]]={'$like':'%'+_0x2d5a95[_0xb78e('0x32')][_0xb78e('0x3f')]+'%'};return _0x5b235b;}})});}_0x95f9e9=_[_0xb78e('0x40')]({},_0x95f9e9,_0x2d5a95[_0xb78e('0x42')]);var _0x318b0a={'where':_0x95f9e9[_0xb78e('0x3d')]};return db['AnalyticFieldReport'][_0xb78e('0x1e')](_0x318b0a)['then'](function(_0x520b68){_0x3efdac['count']=_0x520b68;if(_0x2d5a95[_0xb78e('0x32')][_0xb78e('0x43')]){_0x95f9e9[_0xb78e('0x44')]=[{'all':!![]}];}return db[_0xb78e('0x45')]['findAll'](_0x95f9e9);})[_0xb78e('0x24')](function(_0x117776){_0x3efdac['rows']=_0x117776;return _0x3efdac;})[_0xb78e('0x24')](respondWithFilteredResult(_0x195363,_0x95f9e9))[_0xb78e('0x46')](handleError(_0x195363,null));};exports['show']=function(_0x57ea46,_0x22e1ce){var _0x40ef14={'raw':![],'where':{'id':_0x57ea46[_0xb78e('0x47')]['id']}},_0x5ce10c={};_0x5ce10c[_0xb78e('0x31')]=_[_0xb78e('0x33')](db[_0xb78e('0x45')][_0xb78e('0x2d')]);_0x5ce10c['query']=_[_0xb78e('0x33')](_0x57ea46[_0xb78e('0x32')]);_0x5ce10c[_0xb78e('0x34')]=_[_0xb78e('0x35')](_0x5ce10c[_0xb78e('0x31')],_0x5ce10c[_0xb78e('0x32')]);_0x40ef14[_0xb78e('0x37')]=_['intersection'](_0x5ce10c['model'],qs['fields'](_0x57ea46[_0xb78e('0x32')][_0xb78e('0x36')]));_0x40ef14[_0xb78e('0x37')]=_0x40ef14['attributes'][_0xb78e('0x38')]?_0x40ef14[_0xb78e('0x37')]:_0x5ce10c[_0xb78e('0x31')];if(_0x57ea46[_0xb78e('0x32')][_0xb78e('0x43')]){_0x40ef14[_0xb78e('0x44')]=[{'all':!![]}];}_0x40ef14=_['merge']({},_0x40ef14,_0x57ea46[_0xb78e('0x42')]);return db[_0xb78e('0x45')][_0xb78e('0x48')](_0x40ef14)[_0xb78e('0x24')](handleEntityNotFound(_0x22e1ce,null))[_0xb78e('0x24')](respondWithResult(_0x22e1ce,null))[_0xb78e('0x46')](handleError(_0x22e1ce,null));};exports[_0xb78e('0x49')]=function(_0x5a3f6b,_0x2f758d){return db[_0xb78e('0x45')][_0xb78e('0x49')](_0x5a3f6b[_0xb78e('0x4a')],{})[_0xb78e('0x24')](respondWithResult(_0x2f758d,0xc9))[_0xb78e('0x46')](handleError(_0x2f758d,null));};exports[_0xb78e('0x4b')]=function(_0x3a859f,_0x180dab){return db['AnalyticFieldReport']['bulkCreate'](_0x3a859f['body'],{'raw':![],'individualHooks':!![]})[_0xb78e('0x24')](respondWithResult(_0x180dab,0xc9))[_0xb78e('0x46')](handleError(_0x180dab,null));};exports[_0xb78e('0x23')]=function(_0x4ca402,_0x14cdf5){if(_0x4ca402[_0xb78e('0x4a')]['id']){delete _0x4ca402[_0xb78e('0x4a')]['id'];}return db[_0xb78e('0x45')][_0xb78e('0x48')]({'where':{'id':_0x4ca402['params']['id']}})[_0xb78e('0x24')](handleEntityNotFound(_0x14cdf5,null))['then'](saveUpdates(_0x4ca402[_0xb78e('0x4a')],null))[_0xb78e('0x24')](respondWithResult(_0x14cdf5,null))[_0xb78e('0x46')](handleError(_0x14cdf5,null));};exports[_0xb78e('0x25')]=function(_0x545070,_0x3d9888){return db[_0xb78e('0x45')][_0xb78e('0x48')]({'where':{'id':_0x545070[_0xb78e('0x47')]['id']}})[_0xb78e('0x24')](handleEntityNotFound(_0x3d9888,null))['then'](removeEntity(_0x3d9888,null))[_0xb78e('0x46')](handleError(_0x3d9888,null));};exports['bulkDestroy']=function(_0x374742,_0x4e8e5f){return db[_0xb78e('0x45')][_0xb78e('0x25')]({'where':{'id':_0x374742[_0xb78e('0x32')][_0xb78e('0x4c')]||[]},'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x4e8e5f,0xcc))[_0xb78e('0x46')](handleError(_0x4e8e5f,null));};exports[_0xb78e('0x4d')]=function(_0x288259,_0x471977,_0x501236){return db['AnalyticCustomReport'][_0xb78e('0x4e')]({'where':{'id':_0x288259[_0xb78e('0x47')]['id']}})[_0xb78e('0x24')](handleEntityNotFound(_0x471977,null))['then'](function(_0x16ea11){if(_0x16ea11){return db['sequelize'][_0xb78e('0x4f')](function(_0x40fe2d){return db[_0xb78e('0x45')][_0xb78e('0x25')]({'where':{'CustomReportId':_0x288259[_0xb78e('0x47')]['id']},'transaction':_0x40fe2d})[_0xb78e('0x24')](function(_0x39c51f){var _0x5d2ca9=_[_0xb78e('0x2c')](_0x288259[_0xb78e('0x4a')],function(_0x417203){delete _0x417203['id'];_0x417203[_0xb78e('0x50')]=_0x288259[_0xb78e('0x47')]['id'];return _0x417203;});return db[_0xb78e('0x45')][_0xb78e('0x4b')](_0x5d2ca9,{'transaction':_0x40fe2d});});})['then'](function(){return db[_0xb78e('0x45')][_0xb78e('0x51')]({'where':{'CustomReportId':_0x288259[_0xb78e('0x47')]['id']}});});}})[_0xb78e('0x24')](respondWithResult(_0x471977,null))['catch'](handleError(_0x471977,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index 551a45c..bf63d57 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 _0xd83d=['api','bluebird','request-promise','path','./analyticFieldReport.attributes','exports','define','lodash','util','../../config/logger'];(function(_0x29d94e,_0xf386d6){var _0x106237=function(_0x327501){while(--_0x327501){_0x29d94e['push'](_0x29d94e['shift']());}};_0x106237(++_0xf386d6);}(_0xd83d,0x7f));var _0xdd83=function(_0x4b0a6d,_0x3d4e91){_0x4b0a6d=_0x4b0a6d-0x0;var _0x2a60e2=_0xd83d[_0x4b0a6d];return _0x2a60e2;};'use strict';var _=require(_0xdd83('0x0'));var util=require(_0xdd83('0x1'));var logger=require(_0xdd83('0x2'))(_0xdd83('0x3'));var moment=require('moment');var BPromise=require(_0xdd83('0x4'));var rp=require(_0xdd83('0x5'));var fs=require('fs');var path=require(_0xdd83('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xdd83('0x7'));module[_0xdd83('0x8')]=function(_0x945361,_0x14b77e){return _0x945361[_0xdd83('0x9')]('AnalyticFieldReport',attributes,{'tableName':'analytics_report_fields','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xeb9a=['bluebird','path','../../config/environment','./analyticFieldReport.attributes','AnalyticFieldReport','analytics_report_fields','lodash','../../config/logger'];(function(_0x27e0c0,_0x35ae92){var _0xebc02b=function(_0x5a207c){while(--_0x5a207c){_0x27e0c0['push'](_0x27e0c0['shift']());}};_0xebc02b(++_0x35ae92);}(_0xeb9a,0x7e));var _0xaeb9=function(_0x4ae6ef,_0xc2af80){_0x4ae6ef=_0x4ae6ef-0x0;var _0x3cbb4e=_0xeb9a[_0x4ae6ef];return _0x3cbb4e;};'use strict';var _=require(_0xaeb9('0x0'));var util=require('util');var logger=require(_0xaeb9('0x1'))('api');var moment=require('moment');var BPromise=require(_0xaeb9('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xaeb9('0x3'));var rimraf=require('rimraf');var config=require(_0xaeb9('0x4'));var attributes=require(_0xaeb9('0x5'));module['exports']=function(_0x2fb9d7,_0x43ae9d){return _0x2fb9d7['define'](_0xaeb9('0x6'),attributes,{'tableName':_0xaeb9('0x7'),'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 ab38537..72316f2 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 _0x864f=['../../config/environment','client','http','then','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','stringify','error','code','AnalyticFieldReport,\x20%s,\x20%s','message','info','request\x20sent','result','catch','lodash','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x279d37,_0x14de3f){var _0x530173=function(_0x37fc79){while(--_0x37fc79){_0x279d37['push'](_0x279d37['shift']());}};_0x530173(++_0x14de3f);}(_0x864f,0x174));var _0xf864=function(_0x72dd8,_0x27ea2c){_0x72dd8=_0x72dd8-0x0;var _0x486f5c=_0x864f[_0x72dd8];return _0x486f5c;};'use strict';var _=require(_0xf864('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xf864('0x1'));var rs=require(_0xf864('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf864('0x3'))['db'];var utils=require(_0xf864('0x4'));var logger=require(_0xf864('0x5'))('rpc');var config=require(_0xf864('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xf864('0x7')][_0xf864('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x72cfcc,_0x1a356e,_0x4001af){return new BPromise(function(_0x3e69ca,_0x13da42){return client['request'](_0x72cfcc,_0x4001af)[_0xf864('0x9')](function(_0x477c80){logger['info']('AnalyticFieldReport,\x20%s,\x20%s',_0x1a356e,'request\x20sent');logger[_0xf864('0xa')](_0xf864('0xb'),_0x1a356e,'request\x20sent',JSON[_0xf864('0xc')](_0x477c80));if(_0x477c80[_0xf864('0xd')]){if(_0x477c80[_0xf864('0xd')][_0xf864('0xe')]===0x1f4){logger[_0xf864('0xd')](_0xf864('0xf'),_0x1a356e,_0x477c80['error'][_0xf864('0x10')]);return _0x13da42(_0x477c80[_0xf864('0xd')][_0xf864('0x10')]);}logger['error'](_0xf864('0xf'),_0x1a356e,_0x477c80[_0xf864('0xd')][_0xf864('0x10')]);return _0x3e69ca(_0x477c80['error'][_0xf864('0x10')]);}else{logger[_0xf864('0x11')](_0xf864('0xf'),_0x1a356e,_0xf864('0x12'));_0x3e69ca(_0x477c80[_0xf864('0x13')][_0xf864('0x10')]);}})[_0xf864('0x14')](function(_0x3abc96){logger[_0xf864('0xd')](_0xf864('0xf'),_0x1a356e,_0x3abc96);_0x13da42(_0x3abc96);});});} \ No newline at end of file +var _0x4255=['request','then','request\x20sent','debug','stringify','error','AnalyticFieldReport,\x20%s,\x20%s','message','info','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x2bb9b3,_0x1d2c25){var _0x601b6=function(_0x4f8d09){while(--_0x4f8d09){_0x2bb9b3['push'](_0x2bb9b3['shift']());}};_0x601b6(++_0x1d2c25);}(_0x4255,0x1a8));var _0x5425=function(_0x318840,_0x561b1e){_0x318840=_0x318840-0x0;var _0x223da4=_0x4255[_0x318840];return _0x223da4;};'use strict';var _=require(_0x5425('0x0'));var util=require(_0x5425('0x1'));var moment=require(_0x5425('0x2'));var BPromise=require(_0x5425('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5425('0x4'));var db=require(_0x5425('0x5'))['db'];var utils=require(_0x5425('0x6'));var logger=require(_0x5425('0x7'))(_0x5425('0x8'));var config=require(_0x5425('0x9'));var jayson=require(_0x5425('0xa'));var client=jayson[_0x5425('0xb')][_0x5425('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x257ac6,_0xf048d2,_0x4101f6){return new BPromise(function(_0x28a486,_0x1dd752){return client[_0x5425('0xd')](_0x257ac6,_0x4101f6)[_0x5425('0xe')](function(_0x5c7291){logger['info']('AnalyticFieldReport,\x20%s,\x20%s',_0xf048d2,_0x5425('0xf'));logger[_0x5425('0x10')]('AnalyticFieldReport,\x20%s,\x20%s,\x20%s',_0xf048d2,_0x5425('0xf'),JSON[_0x5425('0x11')](_0x5c7291));if(_0x5c7291[_0x5425('0x12')]){if(_0x5c7291[_0x5425('0x12')]['code']===0x1f4){logger[_0x5425('0x12')](_0x5425('0x13'),_0xf048d2,_0x5c7291['error'][_0x5425('0x14')]);return _0x1dd752(_0x5c7291[_0x5425('0x12')][_0x5425('0x14')]);}logger[_0x5425('0x12')]('AnalyticFieldReport,\x20%s,\x20%s',_0xf048d2,_0x5c7291[_0x5425('0x12')]['message']);return _0x28a486(_0x5c7291[_0x5425('0x12')][_0x5425('0x14')]);}else{logger[_0x5425('0x15')]('AnalyticFieldReport,\x20%s,\x20%s',_0xf048d2,_0x5425('0xf'));_0x28a486(_0x5c7291[_0x5425('0x16')][_0x5425('0x14')]);}})['catch'](function(_0x37c791){logger[_0x5425('0x12')](_0x5425('0x13'),_0xf048d2,_0x37c791);_0x1dd752(_0x37c791);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index 91488bd..fc32696 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(_0x2d3487,_0xa20979){var _0x27041d=function(_0x7133a7){while(--_0x7133a7){_0x2d3487['push'](_0x2d3487['shift']());}};_0x27041d(++_0xa20979);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf71120,_0x25b7f9){_0xf71120=_0xf71120-0x0;var _0xbe2fd3=_0xa9e0[_0xf71120];return _0xbe2fd3;};'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(_0x1c9f10,_0x168c27){var _0x5f1900=function(_0x123ac7){while(--_0x123ac7){_0x1c9f10['push'](_0x1c9f10['shift']());}};_0x5f1900(++_0x168c27);}(_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 diff --git a/server/api/analyticMetric/analyticMetric.attributes.js b/server/api/analyticMetric/analyticMetric.attributes.js index 8f054ce..e0d72aa 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 _0xffe1=['exports','name','TEXT','sequelize'];(function(_0x51ab33,_0x71a8a8){var _0x5e1298=function(_0x1bd8cf){while(--_0x1bd8cf){_0x51ab33['push'](_0x51ab33['shift']());}};_0x5e1298(++_0x71a8a8);}(_0xffe1,0x187));var _0x1ffe=function(_0x2050d9,_0xf739fe){_0x2050d9=_0x2050d9-0x0;var _0x3d368a=_0xffe1[_0x2050d9];return _0x3d368a;};'use strict';var Sequelize=require(_0x1ffe('0x0'));module[_0x1ffe('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x1ffe('0x2')},'table':{'type':Sequelize['STRING']},'metric':{'type':Sequelize[_0x1ffe('0x3')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x8482=['name','TEXT','exports','STRING'];(function(_0x297d2a,_0x2e6e66){var _0x5f411d=function(_0x54d6e8){while(--_0x54d6e8){_0x297d2a['push'](_0x297d2a['shift']());}};_0x5f411d(++_0x2e6e66);}(_0x8482,0x14e));var _0x2848=function(_0x1390ed,_0xee1253){_0x1390ed=_0x1390ed-0x0;var _0x26f4f8=_0x8482[_0x1390ed];return _0x26f4f8;};'use strict';var Sequelize=require('sequelize');module[_0x2848('0x0')]={'name':{'type':Sequelize[_0x2848('0x1')],'allowNull':![],'unique':_0x2848('0x2')},'table':{'type':Sequelize[_0x2848('0x1')]},'metric':{'type':Sequelize[_0x2848('0x3')]},'description':{'type':Sequelize[_0x2848('0x1')]}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index cddaf9e..2a15aaf 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 _0xdbf5=['../../components/parsers/advancedSearch','api','../../config/license/util','sendStatus','status','json','offset','undefined','count','set','Content-Range','save','update','then','destroy','get','Metrics','UserProfileResource','end','error','name','send','index','rawAttributes','fieldName','type','key','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','map','VIRTUAL','AnalyticMetric','includeAll','include','findAll','rows','catch','show','keys','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0xcc0a4d,_0xf9b91){var _0x510611=function(_0x3c0166){while(--_0x3c0166){_0xcc0a4d['push'](_0xcc0a4d['shift']());}};_0x510611(++_0xf9b91);}(_0xdbf5,0x18c));var _0x5dbf=function(_0xf0517d,_0x250d56){_0xf0517d=_0xf0517d-0x0;var _0x518dbf=_0xdbf5[_0xf0517d];return _0x518dbf;};'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(){var _0x226b93=_0x2d3e1b[_0x5dbf('0x22')]({'plain':!![]});var _0x20ab1b=_0x5dbf('0x23');return db[_0x5dbf('0x24')][_0x5dbf('0x21')]({'where':{'type':_0x20ab1b,'resourceId':_0x226b93['id']}})[_0x5dbf('0x20')](function(){return _0x2d3e1b;});})[_0x5dbf('0x20')](function(){_0x4027c3[_0x5dbf('0x17')](0xcc)[_0x5dbf('0x25')]();});}};}function handleEntityNotFound(_0x17f135,_0x466985){return function(_0x3f8341){if(!_0x3f8341){_0x17f135[_0x5dbf('0x16')](0x194);}return _0x3f8341;};}function handleError(_0x22ec42,_0x6a9757){_0x6a9757=_0x6a9757||0x1f4;return function(_0x471027){logger[_0x5dbf('0x26')](_0x471027['stack']);if(_0x471027[_0x5dbf('0x27')]){delete _0x471027[_0x5dbf('0x27')];}_0x22ec42[_0x5dbf('0x17')](_0x6a9757)[_0x5dbf('0x28')](_0x471027);};}exports[_0x5dbf('0x29')]=function(_0x6a276d,_0x2a65c5){var _0x31d57a={},_0x406ce6={},_0x273b63={'count':0x0,'rows':[]};var _0x294dd7=_['map'](db['AnalyticMetric'][_0x5dbf('0x2a')],function(_0x19015a){return{'name':_0x19015a[_0x5dbf('0x2b')],'type':_0x19015a[_0x5dbf('0x2c')][_0x5dbf('0x2d')]};});_0x406ce6['model']=_['map'](_0x294dd7,_0x5dbf('0x27'));_0x406ce6[_0x5dbf('0x2e')]=_['keys'](_0x6a276d[_0x5dbf('0x2e')]);_0x406ce6[_0x5dbf('0x2f')]=_[_0x5dbf('0x30')](_0x406ce6[_0x5dbf('0x31')],_0x406ce6[_0x5dbf('0x2e')]);_0x31d57a['attributes']=_[_0x5dbf('0x30')](_0x406ce6[_0x5dbf('0x31')],qs[_0x5dbf('0x32')](_0x6a276d[_0x5dbf('0x2e')][_0x5dbf('0x32')]));_0x31d57a['attributes']=_0x31d57a[_0x5dbf('0x33')][_0x5dbf('0x34')]?_0x31d57a[_0x5dbf('0x33')]:_0x406ce6[_0x5dbf('0x31')];if(!_0x6a276d['query'][_0x5dbf('0x35')](_0x5dbf('0x36'))){_0x31d57a[_0x5dbf('0x37')]=qs[_0x5dbf('0x37')](_0x6a276d[_0x5dbf('0x2e')][_0x5dbf('0x37')]);_0x31d57a[_0x5dbf('0x19')]=qs[_0x5dbf('0x19')](_0x6a276d[_0x5dbf('0x2e')][_0x5dbf('0x19')]);}_0x31d57a[_0x5dbf('0x38')]=qs['sort'](_0x6a276d[_0x5dbf('0x2e')][_0x5dbf('0x39')]);_0x31d57a[_0x5dbf('0x3a')]=qs['filters'](_[_0x5dbf('0x3b')](_0x6a276d[_0x5dbf('0x2e')],_0x406ce6[_0x5dbf('0x2f')]),_0x294dd7);if(_0x6a276d['query'][_0x5dbf('0x3c')]){_0x31d57a[_0x5dbf('0x3a')]=_[_0x5dbf('0x3d')](_0x31d57a['where'],{'$or':_[_0x5dbf('0x3e')](_0x294dd7,function(_0x29a62d){if(_0x29a62d[_0x5dbf('0x2c')]!==_0x5dbf('0x3f')){var _0x10537d={};_0x10537d[_0x29a62d[_0x5dbf('0x27')]]={'$like':'%'+_0x6a276d[_0x5dbf('0x2e')][_0x5dbf('0x3c')]+'%'};return _0x10537d;}})});}_0x31d57a=_['merge']({},_0x31d57a,_0x6a276d['options']);var _0x57ee72={'where':_0x31d57a['where']};return db[_0x5dbf('0x40')][_0x5dbf('0x1b')](_0x57ee72)['then'](function(_0x3ef0eb){_0x273b63[_0x5dbf('0x1b')]=_0x3ef0eb;if(_0x6a276d['query'][_0x5dbf('0x41')]){_0x31d57a[_0x5dbf('0x42')]=[{'all':!![]}];}return db[_0x5dbf('0x40')][_0x5dbf('0x43')](_0x31d57a);})[_0x5dbf('0x20')](function(_0x7c390d){_0x273b63[_0x5dbf('0x44')]=_0x7c390d;return _0x273b63;})[_0x5dbf('0x20')](respondWithFilteredResult(_0x2a65c5,_0x31d57a))[_0x5dbf('0x45')](handleError(_0x2a65c5,null));};exports[_0x5dbf('0x46')]=function(_0x50ac70,_0x78aef3){var _0x22f958={'raw':!![],'where':{'id':_0x50ac70['params']['id']}},_0xec1d28={};_0xec1d28[_0x5dbf('0x31')]=_[_0x5dbf('0x47')](db[_0x5dbf('0x40')][_0x5dbf('0x2a')]);_0xec1d28['query']=_[_0x5dbf('0x47')](_0x50ac70['query']);_0xec1d28[_0x5dbf('0x2f')]=_[_0x5dbf('0x30')](_0xec1d28[_0x5dbf('0x31')],_0xec1d28[_0x5dbf('0x2e')]);_0x22f958['attributes']=_['intersection'](_0xec1d28[_0x5dbf('0x31')],qs[_0x5dbf('0x32')](_0x50ac70[_0x5dbf('0x2e')]['fields']));_0x22f958[_0x5dbf('0x33')]=_0x22f958['attributes']['length']?_0x22f958['attributes']:_0xec1d28['model'];if(_0x50ac70[_0x5dbf('0x2e')][_0x5dbf('0x41')]){_0x22f958['include']=[{'all':!![]}];}_0x22f958=_[_0x5dbf('0x3d')]({},_0x22f958,_0x50ac70[_0x5dbf('0x48')]);return db['AnalyticMetric'][_0x5dbf('0x49')](_0x22f958)[_0x5dbf('0x20')](handleEntityNotFound(_0x78aef3,null))['then'](respondWithResult(_0x78aef3,null))[_0x5dbf('0x45')](handleError(_0x78aef3,null));};exports['create']=function(_0x5ab862,_0x337897){return db[_0x5dbf('0x40')][_0x5dbf('0x4a')](_0x5ab862['body'],{})['then'](function(_0x442a43){var _0x3e8612=_0x5ab862[_0x5dbf('0x4b')][_0x5dbf('0x22')]({'plain':!![]});if(!_0x3e8612)throw new Error(_0x5dbf('0x4c'));if(_0x3e8612[_0x5dbf('0x4d')]===_0x5dbf('0x4b')){var _0x319906=_0x442a43['get']({'plain':!![]});var _0x3f38a0=_0x5dbf('0x23');return db[_0x5dbf('0x4e')][_0x5dbf('0x49')]({'where':{'name':_0x3f38a0,'userProfileId':_0x3e8612[_0x5dbf('0x4f')]},'raw':!![]})[_0x5dbf('0x20')](function(_0x328dc5){if(_0x328dc5&&_0x328dc5['autoAssociation']===0x0){return db[_0x5dbf('0x24')]['create']({'name':_0x319906[_0x5dbf('0x27')],'resourceId':_0x319906['id'],'type':_0x328dc5[_0x5dbf('0x27')],'sectionId':_0x328dc5['id']},{})[_0x5dbf('0x20')](function(){return _0x442a43;});}else{return _0x442a43;}})[_0x5dbf('0x45')](function(_0x78ab84){logger[_0x5dbf('0x26')](_0x5dbf('0x50'),_0x78ab84);throw _0x78ab84;});}return _0x442a43;})['then'](respondWithResult(_0x337897,0xc9))['catch'](handleError(_0x337897,null));};exports['update']=function(_0x1e1876,_0xfdacc7){if(_0x1e1876[_0x5dbf('0x51')]['id']){delete _0x1e1876['body']['id'];}return db['AnalyticMetric'][_0x5dbf('0x49')]({'where':{'id':_0x1e1876[_0x5dbf('0x52')]['id']}})[_0x5dbf('0x20')](handleEntityNotFound(_0xfdacc7,null))['then'](saveUpdates(_0x1e1876[_0x5dbf('0x51')],null))['then'](respondWithResult(_0xfdacc7,null))[_0x5dbf('0x45')](handleError(_0xfdacc7,null));};exports[_0x5dbf('0x21')]=function(_0x2145ea,_0x5da14b){return db['AnalyticMetric'][_0x5dbf('0x49')]({'where':{'id':_0x2145ea[_0x5dbf('0x52')]['id']}})[_0x5dbf('0x20')](handleEntityNotFound(_0x5da14b,null))[_0x5dbf('0x20')](removeEntity(_0x5da14b,null))['catch'](handleError(_0x5da14b,null));}; \ No newline at end of file +var _0x6aa7=['json','apply','reject','save','update','then','destroy','get','Metrics','stack','name','send','index','map','AnalyticMetric','rawAttributes','fieldName','type','model','query','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','include','show','keys','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','autoAssociation','UserProfileResource','catch','error','params','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','undefined','count','offset','limit','set','Content-Range'];(function(_0x31d0c1,_0x58ce88){var _0x549610=function(_0x2d4240){while(--_0x2d4240){_0x31d0c1['push'](_0x31d0c1['shift']());}};_0x549610(++_0x58ce88);}(_0x6aa7,0x178));var _0x76aa=function(_0x36af89,_0x5c0018){_0x36af89=_0x36af89-0x0;var _0x118b16=_0x6aa7[_0x36af89];return _0x118b16;};'use strict';var emlformat=require(_0x76aa('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x76aa('0x1'));var jsonpatch=require(_0x76aa('0x2'));var rp=require(_0x76aa('0x3'));var moment=require(_0x76aa('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x76aa('0x5'));var util=require(_0x76aa('0x6'));var path=require(_0x76aa('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x76aa('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x76aa('0x9'));var squel=require(_0x76aa('0xa'));var crypto=require(_0x76aa('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x76aa('0xc'));var toCsv=require(_0x76aa('0xd'));var querystring=require(_0x76aa('0xe'));var Papa=require('papaparse');var Redis=require(_0x76aa('0xf'));var authService=require(_0x76aa('0x10'));var qs=require(_0x76aa('0x11'));var as=require(_0x76aa('0x12'));var hardwareService=require(_0x76aa('0x13'));var logger=require(_0x76aa('0x14'))(_0x76aa('0x15'));var utils=require(_0x76aa('0x16'));var config=require(_0x76aa('0x17'));var licenseUtil=require(_0x76aa('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x112c39,_0x5df49c){_0x5df49c=_0x5df49c||0xcc;return function(_0x226536){if(_0x226536){return _0x112c39[_0x76aa('0x19')](_0x5df49c);}return _0x112c39[_0x76aa('0x1a')](_0x5df49c)[_0x76aa('0x1b')]();};}function respondWithResult(_0x10432c,_0x4e309f){_0x4e309f=_0x4e309f||0xc8;return function(_0x5f5b59){if(_0x5f5b59){return _0x10432c[_0x76aa('0x1a')](_0x4e309f)['json'](_0x5f5b59);}};}function respondWithFilteredResult(_0x180d92,_0x319bf1){return function(_0x5cf594){if(_0x5cf594){var _0x2111c7=typeof _0x319bf1['offset']===_0x76aa('0x1c')&&typeof _0x319bf1['limit']===_0x76aa('0x1c');var _0x413cf6=_0x5cf594[_0x76aa('0x1d')];var _0x21c16d=_0x2111c7?0x0:_0x319bf1[_0x76aa('0x1e')];var _0x3ead3f=_0x2111c7?_0x5cf594['count']:_0x319bf1['offset']+_0x319bf1[_0x76aa('0x1f')];var _0x454dd3;if(_0x3ead3f>=_0x413cf6){_0x3ead3f=_0x413cf6;_0x454dd3=0xc8;}else{_0x454dd3=0xce;}_0x180d92[_0x76aa('0x1a')](_0x454dd3);return _0x180d92[_0x76aa('0x20')](_0x76aa('0x21'),_0x21c16d+'-'+_0x3ead3f+'/'+_0x413cf6)[_0x76aa('0x22')](_0x5cf594);}return null;};}function patchUpdates(_0x19af92){return function(_0x2eaf48){try{jsonpatch[_0x76aa('0x23')](_0x2eaf48,_0x19af92,!![]);}catch(_0x5990c1){return BPromise[_0x76aa('0x24')](_0x5990c1);}return _0x2eaf48[_0x76aa('0x25')]();};}function saveUpdates(_0x338a6b,_0x5b3f55){return function(_0x41463a){if(_0x41463a){return _0x41463a[_0x76aa('0x26')](_0x338a6b)[_0x76aa('0x27')](function(_0x2bd2c6){return _0x2bd2c6;});}return null;};}function removeEntity(_0x29c50c,_0xc1044c){return function(_0x3cd039){if(_0x3cd039){return _0x3cd039[_0x76aa('0x28')]()[_0x76aa('0x27')](function(){var _0x2cba6d=_0x3cd039[_0x76aa('0x29')]({'plain':!![]});var _0x26b75e=_0x76aa('0x2a');return db['UserProfileResource'][_0x76aa('0x28')]({'where':{'type':_0x26b75e,'resourceId':_0x2cba6d['id']}})[_0x76aa('0x27')](function(){return _0x3cd039;});})[_0x76aa('0x27')](function(){_0x29c50c[_0x76aa('0x1a')](0xcc)[_0x76aa('0x1b')]();});}};}function handleEntityNotFound(_0x2f9316,_0x25a803){return function(_0x282d0a){if(!_0x282d0a){_0x2f9316[_0x76aa('0x19')](0x194);}return _0x282d0a;};}function handleError(_0x1bdc3d,_0x545b06){_0x545b06=_0x545b06||0x1f4;return function(_0x3fcb7f){logger['error'](_0x3fcb7f[_0x76aa('0x2b')]);if(_0x3fcb7f[_0x76aa('0x2c')]){delete _0x3fcb7f[_0x76aa('0x2c')];}_0x1bdc3d[_0x76aa('0x1a')](_0x545b06)[_0x76aa('0x2d')](_0x3fcb7f);};}exports[_0x76aa('0x2e')]=function(_0x2ee0f9,_0x3827ec){var _0x19fd4f={},_0x3ea05a={},_0x5edcd8={'count':0x0,'rows':[]};var _0x430ad6=_[_0x76aa('0x2f')](db[_0x76aa('0x30')][_0x76aa('0x31')],function(_0x458ac3){return{'name':_0x458ac3[_0x76aa('0x32')],'type':_0x458ac3[_0x76aa('0x33')]['key']};});_0x3ea05a[_0x76aa('0x34')]=_[_0x76aa('0x2f')](_0x430ad6,'name');_0x3ea05a[_0x76aa('0x35')]=_['keys'](_0x2ee0f9[_0x76aa('0x35')]);_0x3ea05a['filters']=_[_0x76aa('0x36')](_0x3ea05a['model'],_0x3ea05a['query']);_0x19fd4f[_0x76aa('0x37')]=_[_0x76aa('0x36')](_0x3ea05a[_0x76aa('0x34')],qs[_0x76aa('0x38')](_0x2ee0f9['query']['fields']));_0x19fd4f[_0x76aa('0x37')]=_0x19fd4f[_0x76aa('0x37')][_0x76aa('0x39')]?_0x19fd4f[_0x76aa('0x37')]:_0x3ea05a[_0x76aa('0x34')];if(!_0x2ee0f9['query'][_0x76aa('0x3a')]('nolimit')){_0x19fd4f['limit']=qs[_0x76aa('0x1f')](_0x2ee0f9[_0x76aa('0x35')][_0x76aa('0x1f')]);_0x19fd4f[_0x76aa('0x1e')]=qs['offset'](_0x2ee0f9[_0x76aa('0x35')][_0x76aa('0x1e')]);}_0x19fd4f[_0x76aa('0x3b')]=qs['sort'](_0x2ee0f9[_0x76aa('0x35')][_0x76aa('0x3c')]);_0x19fd4f[_0x76aa('0x3d')]=qs[_0x76aa('0x3e')](_[_0x76aa('0x3f')](_0x2ee0f9[_0x76aa('0x35')],_0x3ea05a[_0x76aa('0x3e')]),_0x430ad6);if(_0x2ee0f9[_0x76aa('0x35')][_0x76aa('0x40')]){_0x19fd4f['where']=_[_0x76aa('0x41')](_0x19fd4f[_0x76aa('0x3d')],{'$or':_[_0x76aa('0x2f')](_0x430ad6,function(_0xa824e8){if(_0xa824e8[_0x76aa('0x33')]!==_0x76aa('0x42')){var _0x572fdb={};_0x572fdb[_0xa824e8['name']]={'$like':'%'+_0x2ee0f9[_0x76aa('0x35')][_0x76aa('0x40')]+'%'};return _0x572fdb;}})});}_0x19fd4f=_[_0x76aa('0x41')]({},_0x19fd4f,_0x2ee0f9[_0x76aa('0x43')]);var _0x50599f={'where':_0x19fd4f[_0x76aa('0x3d')]};return db[_0x76aa('0x30')][_0x76aa('0x1d')](_0x50599f)[_0x76aa('0x27')](function(_0x1138b5){_0x5edcd8['count']=_0x1138b5;if(_0x2ee0f9[_0x76aa('0x35')]['includeAll']){_0x19fd4f[_0x76aa('0x44')]=[{'all':!![]}];}return db['AnalyticMetric']['findAll'](_0x19fd4f);})['then'](function(_0x144f0a){_0x5edcd8['rows']=_0x144f0a;return _0x5edcd8;})['then'](respondWithFilteredResult(_0x3827ec,_0x19fd4f))['catch'](handleError(_0x3827ec,null));};exports[_0x76aa('0x45')]=function(_0x3fd153,_0x116dc5){var _0x2c0744={'raw':!![],'where':{'id':_0x3fd153['params']['id']}},_0x27a52e={};_0x27a52e[_0x76aa('0x34')]=_[_0x76aa('0x46')](db[_0x76aa('0x30')][_0x76aa('0x31')]);_0x27a52e[_0x76aa('0x35')]=_['keys'](_0x3fd153[_0x76aa('0x35')]);_0x27a52e[_0x76aa('0x3e')]=_['intersection'](_0x27a52e[_0x76aa('0x34')],_0x27a52e['query']);_0x2c0744[_0x76aa('0x37')]=_[_0x76aa('0x36')](_0x27a52e[_0x76aa('0x34')],qs[_0x76aa('0x38')](_0x3fd153[_0x76aa('0x35')][_0x76aa('0x38')]));_0x2c0744[_0x76aa('0x37')]=_0x2c0744[_0x76aa('0x37')][_0x76aa('0x39')]?_0x2c0744[_0x76aa('0x37')]:_0x27a52e['model'];if(_0x3fd153[_0x76aa('0x35')]['includeAll']){_0x2c0744[_0x76aa('0x44')]=[{'all':!![]}];}_0x2c0744=_[_0x76aa('0x41')]({},_0x2c0744,_0x3fd153[_0x76aa('0x43')]);return db[_0x76aa('0x30')]['find'](_0x2c0744)['then'](handleEntityNotFound(_0x116dc5,null))[_0x76aa('0x27')](respondWithResult(_0x116dc5,null))['catch'](handleError(_0x116dc5,null));};exports[_0x76aa('0x47')]=function(_0x302a0c,_0x4315b3){return db[_0x76aa('0x30')][_0x76aa('0x47')](_0x302a0c[_0x76aa('0x48')],{})['then'](function(_0x564546){var _0x2fcf8f=_0x302a0c[_0x76aa('0x49')][_0x76aa('0x29')]({'plain':!![]});if(!_0x2fcf8f)throw new Error(_0x76aa('0x4a'));if(_0x2fcf8f[_0x76aa('0x4b')]===_0x76aa('0x49')){var _0x4c52d5=_0x564546[_0x76aa('0x29')]({'plain':!![]});var _0x2d631e=_0x76aa('0x2a');return db['UserProfileSection'][_0x76aa('0x4c')]({'where':{'name':_0x2d631e,'userProfileId':_0x2fcf8f['userProfileId']},'raw':!![]})[_0x76aa('0x27')](function(_0x5e1d84){if(_0x5e1d84&&_0x5e1d84[_0x76aa('0x4d')]===0x0){return db[_0x76aa('0x4e')][_0x76aa('0x47')]({'name':_0x4c52d5[_0x76aa('0x2c')],'resourceId':_0x4c52d5['id'],'type':_0x5e1d84[_0x76aa('0x2c')],'sectionId':_0x5e1d84['id']},{})[_0x76aa('0x27')](function(){return _0x564546;});}else{return _0x564546;}})[_0x76aa('0x4f')](function(_0x4f2c2b){logger[_0x76aa('0x50')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4f2c2b);throw _0x4f2c2b;});}return _0x564546;})[_0x76aa('0x27')](respondWithResult(_0x4315b3,0xc9))[_0x76aa('0x4f')](handleError(_0x4315b3,null));};exports[_0x76aa('0x26')]=function(_0x53be10,_0x3fa7ec){if(_0x53be10[_0x76aa('0x48')]['id']){delete _0x53be10[_0x76aa('0x48')]['id'];}return db['AnalyticMetric'][_0x76aa('0x4c')]({'where':{'id':_0x53be10[_0x76aa('0x51')]['id']}})[_0x76aa('0x27')](handleEntityNotFound(_0x3fa7ec,null))[_0x76aa('0x27')](saveUpdates(_0x53be10['body'],null))[_0x76aa('0x27')](respondWithResult(_0x3fa7ec,null))[_0x76aa('0x4f')](handleError(_0x3fa7ec,null));};exports[_0x76aa('0x28')]=function(_0x410933,_0x2027f8){return db[_0x76aa('0x30')]['find']({'where':{'id':_0x410933[_0x76aa('0x51')]['id']}})[_0x76aa('0x27')](handleEntityNotFound(_0x2027f8,null))[_0x76aa('0x27')](removeEntity(_0x2027f8,null))[_0x76aa('0x4f')](handleError(_0x2027f8,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index f79ef63..b0c1cd3 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 _0xc1fc=['exports','define','AnalyticMetric','analytics_metrics','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./analyticMetric.attributes'];(function(_0x3d32df,_0x284b12){var _0xed3f9b=function(_0x3ddf87){while(--_0x3ddf87){_0x3d32df['push'](_0x3d32df['shift']());}};_0xed3f9b(++_0x284b12);}(_0xc1fc,0x93));var _0xcc1f=function(_0x76d683,_0xabab61){_0x76d683=_0x76d683-0x0;var _0x4b9df8=_0xc1fc[_0x76d683];return _0x4b9df8;};'use strict';var _=require('lodash');var util=require(_0xcc1f('0x0'));var logger=require(_0xcc1f('0x1'))('api');var moment=require(_0xcc1f('0x2'));var BPromise=require(_0xcc1f('0x3'));var rp=require(_0xcc1f('0x4'));var fs=require('fs');var path=require(_0xcc1f('0x5'));var rimraf=require(_0xcc1f('0x6'));var config=require(_0xcc1f('0x7'));var attributes=require(_0xcc1f('0x8'));module[_0xcc1f('0x9')]=function(_0x493a97,_0x5f448b){return _0x493a97[_0xcc1f('0xa')](_0xcc1f('0xb'),attributes,{'tableName':_0xcc1f('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9485=['request-promise','path','../../config/environment','./analyticMetric.attributes','exports','define','analytics_metrics','lodash','util','../../config/logger','api','bluebird'];(function(_0x519459,_0x327088){var _0x303f78=function(_0x49ba17){while(--_0x49ba17){_0x519459['push'](_0x519459['shift']());}};_0x303f78(++_0x327088);}(_0x9485,0x8b));var _0x5948=function(_0x476d80,_0x29e526){_0x476d80=_0x476d80-0x0;var _0x3d183d=_0x9485[_0x476d80];return _0x3d183d;};'use strict';var _=require(_0x5948('0x0'));var util=require(_0x5948('0x1'));var logger=require(_0x5948('0x2'))(_0x5948('0x3'));var moment=require('moment');var BPromise=require(_0x5948('0x4'));var rp=require(_0x5948('0x5'));var fs=require('fs');var path=require(_0x5948('0x6'));var rimraf=require('rimraf');var config=require(_0x5948('0x7'));var attributes=require(_0x5948('0x8'));module[_0x5948('0x9')]=function(_0x4312a8,_0x19ccdd){return _0x4312a8[_0x5948('0xa')]('AnalyticMetric',attributes,{'tableName':_0x5948('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.rpc.js b/server/api/analyticMetric/analyticMetric.rpc.js index 427d14a..d7140d4 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 _0x25f0=['http','request','info','AnalyticMetric,\x20%s,\x20%s','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','util','randomstring','ioredis','../../mysqldb','rpc'];(function(_0x2f8ed8,_0x37599b){var _0x5be602=function(_0x189b5f){while(--_0x189b5f){_0x2f8ed8['push'](_0x2f8ed8['shift']());}};_0x5be602(++_0x37599b);}(_0x25f0,0xc7));var _0x025f=function(_0x1b75d0,_0x514923){_0x1b75d0=_0x1b75d0-0x0;var _0x12f0c8=_0x25f0[_0x1b75d0];return _0x12f0c8;};'use strict';var _=require('lodash');var util=require(_0x025f('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x025f('0x1'));var fs=require('fs');var Redis=require(_0x025f('0x2'));var db=require(_0x025f('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x025f('0x4'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x025f('0x5')]({'port':0x232a});function respondWithRpcPromise(_0x5f5a6f,_0x3acf3c,_0x3c4496){return new BPromise(function(_0x31ad36,_0x33fcfb){return client[_0x025f('0x6')](_0x5f5a6f,_0x3c4496)['then'](function(_0x5534d3){logger[_0x025f('0x7')](_0x025f('0x8'),_0x3acf3c,'request\x20sent');logger[_0x025f('0x9')](_0x025f('0xa'),_0x3acf3c,_0x025f('0xb'),JSON[_0x025f('0xc')](_0x5534d3));if(_0x5534d3[_0x025f('0xd')]){if(_0x5534d3[_0x025f('0xd')]['code']===0x1f4){logger['error'](_0x025f('0x8'),_0x3acf3c,_0x5534d3[_0x025f('0xd')][_0x025f('0xe')]);return _0x33fcfb(_0x5534d3[_0x025f('0xd')]['message']);}logger[_0x025f('0xd')]('AnalyticMetric,\x20%s,\x20%s',_0x3acf3c,_0x5534d3[_0x025f('0xd')][_0x025f('0xe')]);return _0x31ad36(_0x5534d3[_0x025f('0xd')][_0x025f('0xe')]);}else{logger[_0x025f('0x7')](_0x025f('0x8'),_0x3acf3c,'request\x20sent');_0x31ad36(_0x5534d3[_0x025f('0xf')][_0x025f('0xe')]);}})[_0x025f('0x10')](function(_0xa1ed27){logger[_0x025f('0xd')](_0x025f('0x8'),_0x3acf3c,_0xa1ed27);_0x33fcfb(_0xa1ed27);});});} \ No newline at end of file +var _0x9327=['AnalyticMetric,\x20%s,\x20%s','request\x20sent','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','request','then','info'];(function(_0x388b47,_0x5cdac5){var _0x4859df=function(_0x466a16){while(--_0x466a16){_0x388b47['push'](_0x388b47['shift']());}};_0x4859df(++_0x5cdac5);}(_0x9327,0x1be));var _0x7932=function(_0x18ce11,_0x24c013){_0x18ce11=_0x18ce11-0x0;var _0x3ecc18=_0x9327[_0x18ce11];return _0x3ecc18;};'use strict';var _=require(_0x7932('0x0'));var util=require(_0x7932('0x1'));var moment=require(_0x7932('0x2'));var BPromise=require(_0x7932('0x3'));var rs=require(_0x7932('0x4'));var fs=require('fs');var Redis=require(_0x7932('0x5'));var db=require(_0x7932('0x6'))['db'];var utils=require(_0x7932('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x7932('0x8'));var jayson=require(_0x7932('0x9'));var client=jayson[_0x7932('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x29f683,_0x528003,_0x2158a7){return new BPromise(function(_0x4d4fd5,_0x58c986){return client[_0x7932('0xb')](_0x29f683,_0x2158a7)[_0x7932('0xc')](function(_0x365de0){logger[_0x7932('0xd')](_0x7932('0xe'),_0x528003,_0x7932('0xf'));logger[_0x7932('0x10')](_0x7932('0x11'),_0x528003,_0x7932('0xf'),JSON[_0x7932('0x12')](_0x365de0));if(_0x365de0[_0x7932('0x13')]){if(_0x365de0[_0x7932('0x13')]['code']===0x1f4){logger[_0x7932('0x13')](_0x7932('0xe'),_0x528003,_0x365de0[_0x7932('0x13')]['message']);return _0x58c986(_0x365de0[_0x7932('0x13')][_0x7932('0x14')]);}logger[_0x7932('0x13')](_0x7932('0xe'),_0x528003,_0x365de0['error'][_0x7932('0x14')]);return _0x4d4fd5(_0x365de0[_0x7932('0x13')][_0x7932('0x14')]);}else{logger[_0x7932('0xd')]('AnalyticMetric,\x20%s,\x20%s',_0x528003,_0x7932('0xf'));_0x4d4fd5(_0x365de0[_0x7932('0x15')][_0x7932('0x14')]);}})[_0x7932('0x16')](function(_0x112890){logger[_0x7932('0x13')](_0x7932('0xe'),_0x528003,_0x112890);_0x58c986(_0x112890);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index 07ced1a..0115527 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 _0x3663=['exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticMetric.controller','get','index','isAuthenticated','show','post','create','put','/:id','update','delete','destroy'];(function(_0x292423,_0x1759b7){var _0x2801cb=function(_0x23c821){while(--_0x23c821){_0x292423['push'](_0x292423['shift']());}};_0x2801cb(++_0x1759b7);}(_0x3663,0x1cf));var _0x3366=function(_0x58f911,_0x28ecb4){_0x58f911=_0x58f911-0x0;var _0x12b4ee=_0x3663[_0x58f911];return _0x12b4ee;};'use strict';var multer=require(_0x3366('0x0'));var util=require(_0x3366('0x1'));var path=require(_0x3366('0x2'));var timeout=require('connect-timeout');var express=require(_0x3366('0x3'));var router=express[_0x3366('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x3366('0x5'));var interaction=require(_0x3366('0x6'));var config=require(_0x3366('0x7'));var controller=require(_0x3366('0x8'));router[_0x3366('0x9')]('/',auth['isAuthenticated'](),controller[_0x3366('0xa')]);router[_0x3366('0x9')]('/:id',auth[_0x3366('0xb')](),controller[_0x3366('0xc')]);router[_0x3366('0xd')]('/',auth['isAuthenticated'](),controller[_0x3366('0xe')]);router[_0x3366('0xf')](_0x3366('0x10'),auth['isAuthenticated'](),controller[_0x3366('0x11')]);router[_0x3366('0x12')](_0x3366('0x10'),auth[_0x3366('0xb')](),controller[_0x3366('0x13')]);module[_0x3366('0x14')]=router; \ No newline at end of file +var _0x1ffe=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticMetric.controller','get','/:id','isAuthenticated','show','post','create','put','update','destroy','exports','multer','util','path'];(function(_0x5cfa2b,_0x5b9ee9){var _0x3bf9d2=function(_0x49f969){while(--_0x49f969){_0x5cfa2b['push'](_0x5cfa2b['shift']());}};_0x3bf9d2(++_0x5b9ee9);}(_0x1ffe,0xa5));var _0xe1ff=function(_0x40f881,_0x341766){_0x40f881=_0x40f881-0x0;var _0x1fc947=_0x1ffe[_0x40f881];return _0x1fc947;};'use strict';var multer=require(_0xe1ff('0x0'));var util=require(_0xe1ff('0x1'));var path=require(_0xe1ff('0x2'));var timeout=require(_0xe1ff('0x3'));var express=require(_0xe1ff('0x4'));var router=express[_0xe1ff('0x5')]();var fs_extra=require(_0xe1ff('0x6'));var auth=require(_0xe1ff('0x7'));var interaction=require(_0xe1ff('0x8'));var config=require(_0xe1ff('0x9'));var controller=require(_0xe1ff('0xa'));router[_0xe1ff('0xb')]('/',auth['isAuthenticated'](),controller['index']);router[_0xe1ff('0xb')](_0xe1ff('0xc'),auth[_0xe1ff('0xd')](),controller[_0xe1ff('0xe')]);router[_0xe1ff('0xf')]('/',auth[_0xe1ff('0xd')](),controller[_0xe1ff('0x10')]);router[_0xe1ff('0x11')](_0xe1ff('0xc'),auth[_0xe1ff('0xd')](),controller[_0xe1ff('0x12')]);router['delete'](_0xe1ff('0xc'),auth[_0xe1ff('0xd')](),controller[_0xe1ff('0x13')]);module[_0xe1ff('0x14')]=router; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.attributes.js b/server/api/analyticTreeReport/analyticTreeReport.attributes.js index 57ee5ff..2064b67 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 _0x477d=['exports','TEXT','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x477d,0x146));var _0xd477=function(_0x3169cd,_0x448d94){_0x3169cd=_0x3169cd-0x0;var _0xd24ac=_0x477d[_0x3169cd];return _0xd24ac;};'use strict';var Sequelize=require(_0xd477('0x0'));module[_0xd477('0x1')]={'tree':{'type':Sequelize[_0xd477('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x5197=['sequelize','exports','TEXT'];(function(_0x3afc52,_0x3d4196){var _0x4d0792=function(_0x412066){while(--_0x412066){_0x3afc52['push'](_0x3afc52['shift']());}};_0x4d0792(++_0x3d4196);}(_0x5197,0x19b));var _0x7519=function(_0x363ef8,_0x4ecb1a){_0x363ef8=_0x363ef8-0x0;var _0x148822=_0x5197[_0x363ef8];return _0x148822;};'use strict';var Sequelize=require(_0x7519('0x0'));module[_0x7519('0x1')]={'tree':{'type':Sequelize[_0x7519('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.controller.js b/server/api/analyticTreeReport/analyticTreeReport.controller.js index f044216..6c422ae 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 _0x83f9=['jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','end','error','stack','name','send','index','map','AnalyticTreeReport','rawAttributes','fieldName','type','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','find','create','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','crypto'];(function(_0xfce77c,_0x523d35){var _0x13345a=function(_0x53adcf){while(--_0x53adcf){_0xfce77c['push'](_0xfce77c['shift']());}};_0x13345a(++_0x523d35);}(_0x83f9,0x1c7));var _0x983f=function(_0x2430a6,_0x3303e9){_0x2430a6=_0x2430a6-0x0;var _0x4de8b3=_0x83f9[_0x2430a6];return _0x4de8b3;};'use strict';var emlformat=require(_0x983f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x983f('0x1'));var jsonpatch=require(_0x983f('0x2'));var rp=require(_0x983f('0x3'));var moment=require(_0x983f('0x4'));var BPromise=require(_0x983f('0x5'));var Mustache=require(_0x983f('0x6'));var util=require(_0x983f('0x7'));var path=require(_0x983f('0x8'));var sox=require('sox');var csv=require(_0x983f('0x9'));var ejs=require(_0x983f('0xa'));var fs=require('fs');var fs_extra=require(_0x983f('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x983f('0xc'));var jsforce=require(_0x983f('0xd'));var deskjs=require(_0x983f('0xe'));var toCsv=require('to-csv');var querystring=require(_0x983f('0xf'));var Papa=require(_0x983f('0x10'));var Redis=require(_0x983f('0x11'));var authService=require(_0x983f('0x12'));var qs=require(_0x983f('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x983f('0x14'));var logger=require(_0x983f('0x15'))('api');var utils=require(_0x983f('0x16'));var config=require(_0x983f('0x17'));var licenseUtil=require(_0x983f('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1b1f90,_0x348d7b){_0x348d7b=_0x348d7b||0xcc;return function(_0x11c986){if(_0x11c986){return _0x1b1f90[_0x983f('0x19')](_0x348d7b);}return _0x1b1f90[_0x983f('0x1a')](_0x348d7b)['end']();};}function respondWithResult(_0xa6e84a,_0x4406e5){_0x4406e5=_0x4406e5||0xc8;return function(_0x45fd6e){if(_0x45fd6e){return _0xa6e84a[_0x983f('0x1a')](_0x4406e5)[_0x983f('0x1b')](_0x45fd6e);}};}function respondWithFilteredResult(_0x3a50dc,_0x270821){return function(_0x1104e3){if(_0x1104e3){var _0x5a691a=typeof _0x270821[_0x983f('0x1c')]===_0x983f('0x1d')&&typeof _0x270821[_0x983f('0x1e')]===_0x983f('0x1d');var _0x413aed=_0x1104e3['count'];var _0x2d1b6b=_0x5a691a?0x0:_0x270821[_0x983f('0x1c')];var _0x4f0dcb=_0x5a691a?_0x1104e3[_0x983f('0x1f')]:_0x270821['offset']+_0x270821[_0x983f('0x1e')];var _0x41c41c;if(_0x4f0dcb>=_0x413aed){_0x4f0dcb=_0x413aed;_0x41c41c=0xc8;}else{_0x41c41c=0xce;}_0x3a50dc['status'](_0x41c41c);return _0x3a50dc[_0x983f('0x20')](_0x983f('0x21'),_0x2d1b6b+'-'+_0x4f0dcb+'/'+_0x413aed)[_0x983f('0x1b')](_0x1104e3);}return null;};}function patchUpdates(_0xcf9da9){return function(_0x18ef76){try{jsonpatch[_0x983f('0x22')](_0x18ef76,_0xcf9da9,!![]);}catch(_0xed423c){return BPromise[_0x983f('0x23')](_0xed423c);}return _0x18ef76[_0x983f('0x24')]();};}function saveUpdates(_0x4d763e,_0x526cbb){return function(_0x44c419){if(_0x44c419){return _0x44c419[_0x983f('0x25')](_0x4d763e)['then'](function(_0x4c91b3){return _0x4c91b3;});}return null;};}function removeEntity(_0x4bd279,_0x35f45f){return function(_0x380a86){if(_0x380a86){return _0x380a86[_0x983f('0x26')]()[_0x983f('0x27')](function(){_0x4bd279[_0x983f('0x1a')](0xcc)[_0x983f('0x28')]();});}};}function handleEntityNotFound(_0x43cfe3,_0x5217d2){return function(_0x23efea){if(!_0x23efea){_0x43cfe3[_0x983f('0x19')](0x194);}return _0x23efea;};}function handleError(_0x43c964,_0x495f73){_0x495f73=_0x495f73||0x1f4;return function(_0x262dab){logger[_0x983f('0x29')](_0x262dab[_0x983f('0x2a')]);if(_0x262dab[_0x983f('0x2b')]){delete _0x262dab[_0x983f('0x2b')];}_0x43c964[_0x983f('0x1a')](_0x495f73)[_0x983f('0x2c')](_0x262dab);};}exports[_0x983f('0x2d')]=function(_0x4ccb95,_0x404960){var _0x4b8004={},_0x18acdb={},_0x444161={'count':0x0,'rows':[]};var _0x1215ea=_[_0x983f('0x2e')](db[_0x983f('0x2f')][_0x983f('0x30')],function(_0x578078){return{'name':_0x578078[_0x983f('0x31')],'type':_0x578078[_0x983f('0x32')]['key']};});_0x18acdb[_0x983f('0x33')]=_['map'](_0x1215ea,_0x983f('0x2b'));_0x18acdb['query']=_[_0x983f('0x34')](_0x4ccb95['query']);_0x18acdb[_0x983f('0x35')]=_[_0x983f('0x36')](_0x18acdb[_0x983f('0x33')],_0x18acdb[_0x983f('0x37')]);_0x4b8004[_0x983f('0x38')]=_[_0x983f('0x36')](_0x18acdb[_0x983f('0x33')],qs[_0x983f('0x39')](_0x4ccb95[_0x983f('0x37')][_0x983f('0x39')]));_0x4b8004[_0x983f('0x38')]=_0x4b8004[_0x983f('0x38')][_0x983f('0x3a')]?_0x4b8004[_0x983f('0x38')]:_0x18acdb[_0x983f('0x33')];if(!_0x4ccb95[_0x983f('0x37')][_0x983f('0x3b')](_0x983f('0x3c'))){_0x4b8004[_0x983f('0x1e')]=qs[_0x983f('0x1e')](_0x4ccb95['query'][_0x983f('0x1e')]);_0x4b8004[_0x983f('0x1c')]=qs['offset'](_0x4ccb95['query'][_0x983f('0x1c')]);}_0x4b8004[_0x983f('0x3d')]=qs[_0x983f('0x3e')](_0x4ccb95[_0x983f('0x37')][_0x983f('0x3e')]);_0x4b8004[_0x983f('0x3f')]=qs[_0x983f('0x35')](_[_0x983f('0x40')](_0x4ccb95[_0x983f('0x37')],_0x18acdb[_0x983f('0x35')]),_0x1215ea);if(_0x4ccb95[_0x983f('0x37')][_0x983f('0x41')]){_0x4b8004[_0x983f('0x3f')]=_[_0x983f('0x42')](_0x4b8004[_0x983f('0x3f')],{'$or':_[_0x983f('0x2e')](_0x1215ea,function(_0x435918){if(_0x435918[_0x983f('0x32')]!==_0x983f('0x43')){var _0xef2b6e={};_0xef2b6e[_0x435918[_0x983f('0x2b')]]={'$like':'%'+_0x4ccb95[_0x983f('0x37')]['filter']+'%'};return _0xef2b6e;}})});}_0x4b8004=_[_0x983f('0x42')]({},_0x4b8004,_0x4ccb95[_0x983f('0x44')]);var _0x5624ed={'where':_0x4b8004[_0x983f('0x3f')]};return db['AnalyticTreeReport']['count'](_0x5624ed)['then'](function(_0x3a2ccb){_0x444161['count']=_0x3a2ccb;if(_0x4ccb95['query'][_0x983f('0x45')]){_0x4b8004[_0x983f('0x46')]=[{'all':!![]}];}return db[_0x983f('0x2f')]['findAll'](_0x4b8004);})['then'](function(_0x165bd7){_0x444161[_0x983f('0x47')]=_0x165bd7;return _0x444161;})['then'](respondWithFilteredResult(_0x404960,_0x4b8004))[_0x983f('0x48')](handleError(_0x404960,null));};exports[_0x983f('0x49')]=function(_0x14859e,_0x5585b9){var _0x2fe8db={'raw':!![],'where':{'id':_0x14859e[_0x983f('0x4a')]['id']}},_0x461e23={};_0x461e23[_0x983f('0x33')]=_[_0x983f('0x34')](db[_0x983f('0x2f')][_0x983f('0x30')]);_0x461e23['query']=_[_0x983f('0x34')](_0x14859e[_0x983f('0x37')]);_0x461e23[_0x983f('0x35')]=_[_0x983f('0x36')](_0x461e23[_0x983f('0x33')],_0x461e23[_0x983f('0x37')]);_0x2fe8db[_0x983f('0x38')]=_[_0x983f('0x36')](_0x461e23[_0x983f('0x33')],qs[_0x983f('0x39')](_0x14859e[_0x983f('0x37')]['fields']));_0x2fe8db['attributes']=_0x2fe8db[_0x983f('0x38')][_0x983f('0x3a')]?_0x2fe8db['attributes']:_0x461e23[_0x983f('0x33')];if(_0x14859e[_0x983f('0x37')]['includeAll']){_0x2fe8db[_0x983f('0x46')]=[{'all':!![]}];}_0x2fe8db=_[_0x983f('0x42')]({},_0x2fe8db,_0x14859e[_0x983f('0x44')]);return db[_0x983f('0x2f')][_0x983f('0x4b')](_0x2fe8db)[_0x983f('0x27')](handleEntityNotFound(_0x5585b9,null))[_0x983f('0x27')](respondWithResult(_0x5585b9,null))['catch'](handleError(_0x5585b9,null));};exports[_0x983f('0x4c')]=function(_0x5f11ab,_0x4012b9){return db[_0x983f('0x2f')][_0x983f('0x4c')](_0x5f11ab[_0x983f('0x4d')],{})[_0x983f('0x27')](respondWithResult(_0x4012b9,0xc9))[_0x983f('0x48')](handleError(_0x4012b9,null));};exports[_0x983f('0x25')]=function(_0x359c7a,_0x5ac2a5){if(_0x359c7a[_0x983f('0x4d')]['id']){delete _0x359c7a[_0x983f('0x4d')]['id'];}return db[_0x983f('0x2f')][_0x983f('0x4b')]({'where':{'id':_0x359c7a['params']['id']}})['then'](handleEntityNotFound(_0x5ac2a5,null))[_0x983f('0x27')](saveUpdates(_0x359c7a['body'],null))[_0x983f('0x27')](respondWithResult(_0x5ac2a5,null))[_0x983f('0x48')](handleError(_0x5ac2a5,null));};exports[_0x983f('0x26')]=function(_0x4614c4,_0x47ffcc){return db['AnalyticTreeReport'][_0x983f('0x4b')]({'where':{'id':_0x4614c4[_0x983f('0x4a')]['id']}})[_0x983f('0x27')](handleEntityNotFound(_0x47ffcc,null))[_0x983f('0x27')](removeEntity(_0x47ffcc,null))[_0x983f('0x48')](handleError(_0x47ffcc,null));}; \ No newline at end of file +var _0xa5a5=['filter','merge','VIRTUAL','options','AnalyticTreeReport','includeAll','include','findAll','rows','catch','show','params','find','create','update','body','eml-format','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','apply','save','then','destroy','error','name','send','map','rawAttributes','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick'];(function(_0x2fa32b,_0x181a36){var _0x25f18c=function(_0x4ec865){while(--_0x4ec865){_0x2fa32b['push'](_0x2fa32b['shift']());}};_0x25f18c(++_0x181a36);}(_0xa5a5,0xe5));var _0x5a5a=function(_0x4ff09b,_0x53f67d){_0x4ff09b=_0x4ff09b-0x0;var _0x3f5c2e=_0xa5a5[_0x4ff09b];return _0x3f5c2e;};'use strict';var emlformat=require(_0x5a5a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5a5a('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x5a5a('0x2'));var BPromise=require(_0x5a5a('0x3'));var Mustache=require(_0x5a5a('0x4'));var util=require(_0x5a5a('0x5'));var path=require(_0x5a5a('0x6'));var sox=require(_0x5a5a('0x7'));var csv=require(_0x5a5a('0x8'));var ejs=require(_0x5a5a('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5a5a('0xa'));var squel=require(_0x5a5a('0xb'));var crypto=require(_0x5a5a('0xc'));var jsforce=require(_0x5a5a('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x5a5a('0xe'));var Papa=require('papaparse');var Redis=require(_0x5a5a('0xf'));var authService=require(_0x5a5a('0x10'));var qs=require(_0x5a5a('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x5a5a('0x12'))(_0x5a5a('0x13'));var utils=require('../../config/utils');var config=require(_0x5a5a('0x14'));var licenseUtil=require(_0x5a5a('0x15'));var db=require(_0x5a5a('0x16'))['db'];function respondWithStatusCode(_0xc043a6,_0x1744e5){_0x1744e5=_0x1744e5||0xcc;return function(_0x19fbf4){if(_0x19fbf4){return _0xc043a6[_0x5a5a('0x17')](_0x1744e5);}return _0xc043a6[_0x5a5a('0x18')](_0x1744e5)[_0x5a5a('0x19')]();};}function respondWithResult(_0x592a26,_0x47ace5){_0x47ace5=_0x47ace5||0xc8;return function(_0x562b7f){if(_0x562b7f){return _0x592a26[_0x5a5a('0x18')](_0x47ace5)['json'](_0x562b7f);}};}function respondWithFilteredResult(_0x3d05ff,_0x166d1e){return function(_0xe84150){if(_0xe84150){var _0x44feb3=typeof _0x166d1e[_0x5a5a('0x1a')]==='undefined'&&typeof _0x166d1e[_0x5a5a('0x1b')]===_0x5a5a('0x1c');var _0x10ee18=_0xe84150[_0x5a5a('0x1d')];var _0x1b496=_0x44feb3?0x0:_0x166d1e[_0x5a5a('0x1a')];var _0x23fd1c=_0x44feb3?_0xe84150['count']:_0x166d1e[_0x5a5a('0x1a')]+_0x166d1e[_0x5a5a('0x1b')];var _0x223d4d;if(_0x23fd1c>=_0x10ee18){_0x23fd1c=_0x10ee18;_0x223d4d=0xc8;}else{_0x223d4d=0xce;}_0x3d05ff[_0x5a5a('0x18')](_0x223d4d);return _0x3d05ff[_0x5a5a('0x1e')](_0x5a5a('0x1f'),_0x1b496+'-'+_0x23fd1c+'/'+_0x10ee18)[_0x5a5a('0x20')](_0xe84150);}return null;};}function patchUpdates(_0x1ac5c4){return function(_0x4389f2){try{jsonpatch[_0x5a5a('0x21')](_0x4389f2,_0x1ac5c4,!![]);}catch(_0x330972){return BPromise['reject'](_0x330972);}return _0x4389f2[_0x5a5a('0x22')]();};}function saveUpdates(_0x199f1a,_0x38355b){return function(_0x3e06c5){if(_0x3e06c5){return _0x3e06c5['update'](_0x199f1a)[_0x5a5a('0x23')](function(_0x33a86c){return _0x33a86c;});}return null;};}function removeEntity(_0x21192c,_0x30da98){return function(_0x195a0c){if(_0x195a0c){return _0x195a0c[_0x5a5a('0x24')]()['then'](function(){_0x21192c['status'](0xcc)[_0x5a5a('0x19')]();});}};}function handleEntityNotFound(_0x4cd27f,_0x284478){return function(_0xab1d9e){if(!_0xab1d9e){_0x4cd27f['sendStatus'](0x194);}return _0xab1d9e;};}function handleError(_0x1a0a5b,_0x1ac391){_0x1ac391=_0x1ac391||0x1f4;return function(_0x5a538f){logger[_0x5a5a('0x25')](_0x5a538f['stack']);if(_0x5a538f[_0x5a5a('0x26')]){delete _0x5a538f[_0x5a5a('0x26')];}_0x1a0a5b['status'](_0x1ac391)[_0x5a5a('0x27')](_0x5a538f);};}exports['index']=function(_0x3326d2,_0x59d653){var _0x45f27a={},_0x3c4ea1={},_0xecabdf={'count':0x0,'rows':[]};var _0x4598a8=_[_0x5a5a('0x28')](db['AnalyticTreeReport'][_0x5a5a('0x29')],function(_0x4174fb){return{'name':_0x4174fb['fieldName'],'type':_0x4174fb['type']['key']};});_0x3c4ea1[_0x5a5a('0x2a')]=_['map'](_0x4598a8,'name');_0x3c4ea1[_0x5a5a('0x2b')]=_[_0x5a5a('0x2c')](_0x3326d2[_0x5a5a('0x2b')]);_0x3c4ea1[_0x5a5a('0x2d')]=_[_0x5a5a('0x2e')](_0x3c4ea1[_0x5a5a('0x2a')],_0x3c4ea1[_0x5a5a('0x2b')]);_0x45f27a['attributes']=_['intersection'](_0x3c4ea1[_0x5a5a('0x2a')],qs[_0x5a5a('0x2f')](_0x3326d2[_0x5a5a('0x2b')][_0x5a5a('0x2f')]));_0x45f27a['attributes']=_0x45f27a[_0x5a5a('0x30')][_0x5a5a('0x31')]?_0x45f27a['attributes']:_0x3c4ea1[_0x5a5a('0x2a')];if(!_0x3326d2[_0x5a5a('0x2b')]['hasOwnProperty'](_0x5a5a('0x32'))){_0x45f27a[_0x5a5a('0x1b')]=qs[_0x5a5a('0x1b')](_0x3326d2[_0x5a5a('0x2b')][_0x5a5a('0x1b')]);_0x45f27a[_0x5a5a('0x1a')]=qs[_0x5a5a('0x1a')](_0x3326d2[_0x5a5a('0x2b')][_0x5a5a('0x1a')]);}_0x45f27a[_0x5a5a('0x33')]=qs[_0x5a5a('0x34')](_0x3326d2[_0x5a5a('0x2b')]['sort']);_0x45f27a[_0x5a5a('0x35')]=qs[_0x5a5a('0x2d')](_[_0x5a5a('0x36')](_0x3326d2['query'],_0x3c4ea1[_0x5a5a('0x2d')]),_0x4598a8);if(_0x3326d2['query'][_0x5a5a('0x37')]){_0x45f27a[_0x5a5a('0x35')]=_[_0x5a5a('0x38')](_0x45f27a['where'],{'$or':_[_0x5a5a('0x28')](_0x4598a8,function(_0x2bb704){if(_0x2bb704['type']!==_0x5a5a('0x39')){var _0x5bc3fe={};_0x5bc3fe[_0x2bb704['name']]={'$like':'%'+_0x3326d2[_0x5a5a('0x2b')][_0x5a5a('0x37')]+'%'};return _0x5bc3fe;}})});}_0x45f27a=_[_0x5a5a('0x38')]({},_0x45f27a,_0x3326d2[_0x5a5a('0x3a')]);var _0x41044b={'where':_0x45f27a[_0x5a5a('0x35')]};return db[_0x5a5a('0x3b')]['count'](_0x41044b)[_0x5a5a('0x23')](function(_0x1aaa49){_0xecabdf[_0x5a5a('0x1d')]=_0x1aaa49;if(_0x3326d2[_0x5a5a('0x2b')][_0x5a5a('0x3c')]){_0x45f27a[_0x5a5a('0x3d')]=[{'all':!![]}];}return db[_0x5a5a('0x3b')][_0x5a5a('0x3e')](_0x45f27a);})[_0x5a5a('0x23')](function(_0x5d44e5){_0xecabdf[_0x5a5a('0x3f')]=_0x5d44e5;return _0xecabdf;})['then'](respondWithFilteredResult(_0x59d653,_0x45f27a))[_0x5a5a('0x40')](handleError(_0x59d653,null));};exports[_0x5a5a('0x41')]=function(_0x401aa4,_0x4941fb){var _0x4b206b={'raw':!![],'where':{'id':_0x401aa4[_0x5a5a('0x42')]['id']}},_0x1fd4fa={};_0x1fd4fa[_0x5a5a('0x2a')]=_[_0x5a5a('0x2c')](db[_0x5a5a('0x3b')][_0x5a5a('0x29')]);_0x1fd4fa[_0x5a5a('0x2b')]=_['keys'](_0x401aa4[_0x5a5a('0x2b')]);_0x1fd4fa[_0x5a5a('0x2d')]=_[_0x5a5a('0x2e')](_0x1fd4fa[_0x5a5a('0x2a')],_0x1fd4fa[_0x5a5a('0x2b')]);_0x4b206b[_0x5a5a('0x30')]=_[_0x5a5a('0x2e')](_0x1fd4fa[_0x5a5a('0x2a')],qs[_0x5a5a('0x2f')](_0x401aa4[_0x5a5a('0x2b')]['fields']));_0x4b206b[_0x5a5a('0x30')]=_0x4b206b[_0x5a5a('0x30')][_0x5a5a('0x31')]?_0x4b206b[_0x5a5a('0x30')]:_0x1fd4fa[_0x5a5a('0x2a')];if(_0x401aa4['query'][_0x5a5a('0x3c')]){_0x4b206b[_0x5a5a('0x3d')]=[{'all':!![]}];}_0x4b206b=_[_0x5a5a('0x38')]({},_0x4b206b,_0x401aa4[_0x5a5a('0x3a')]);return db['AnalyticTreeReport'][_0x5a5a('0x43')](_0x4b206b)[_0x5a5a('0x23')](handleEntityNotFound(_0x4941fb,null))[_0x5a5a('0x23')](respondWithResult(_0x4941fb,null))[_0x5a5a('0x40')](handleError(_0x4941fb,null));};exports[_0x5a5a('0x44')]=function(_0x22dde0,_0x4a917f){return db[_0x5a5a('0x3b')][_0x5a5a('0x44')](_0x22dde0['body'],{})[_0x5a5a('0x23')](respondWithResult(_0x4a917f,0xc9))['catch'](handleError(_0x4a917f,null));};exports[_0x5a5a('0x45')]=function(_0x2ac22c,_0x158ea1){if(_0x2ac22c[_0x5a5a('0x46')]['id']){delete _0x2ac22c['body']['id'];}return db[_0x5a5a('0x3b')][_0x5a5a('0x43')]({'where':{'id':_0x2ac22c[_0x5a5a('0x42')]['id']}})[_0x5a5a('0x23')](handleEntityNotFound(_0x158ea1,null))[_0x5a5a('0x23')](saveUpdates(_0x2ac22c['body'],null))['then'](respondWithResult(_0x158ea1,null))[_0x5a5a('0x40')](handleError(_0x158ea1,null));};exports[_0x5a5a('0x24')]=function(_0xe9f27e,_0x4c9d77){return db[_0x5a5a('0x3b')][_0x5a5a('0x43')]({'where':{'id':_0xe9f27e[_0x5a5a('0x42')]['id']}})[_0x5a5a('0x23')](handleEntityNotFound(_0x4c9d77,null))['then'](removeEntity(_0x4c9d77,null))[_0x5a5a('0x40')](handleError(_0x4c9d77,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index 376fe6a..3bda9f0 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 _0x06d2=['api','moment','request-promise','path','../../config/environment','./analyticTreeReport.attributes','exports','define','analytics_report_trees'];(function(_0x58462a,_0x1ce850){var _0x2931ef=function(_0x4a3185){while(--_0x4a3185){_0x58462a['push'](_0x58462a['shift']());}};_0x2931ef(++_0x1ce850);}(_0x06d2,0xb4));var _0x206d=function(_0x289673,_0x57183a){_0x289673=_0x289673-0x0;var _0x21274e=_0x06d2[_0x289673];return _0x21274e;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x206d('0x0'));var moment=require(_0x206d('0x1'));var BPromise=require('bluebird');var rp=require(_0x206d('0x2'));var fs=require('fs');var path=require(_0x206d('0x3'));var rimraf=require('rimraf');var config=require(_0x206d('0x4'));var attributes=require(_0x206d('0x5'));module[_0x206d('0x6')]=function(_0x20288e,_0x48e658){return _0x20288e[_0x206d('0x7')]('AnalyticTreeReport',attributes,{'tableName':_0x206d('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc85a=['exports','define','AnalyticTreeReport','analytics_report_trees','lodash','../../config/logger','api','request-promise','../../config/environment','./analyticTreeReport.attributes'];(function(_0x1e9993,_0x517a0d){var _0x1cb53b=function(_0xf1f206){while(--_0xf1f206){_0x1e9993['push'](_0x1e9993['shift']());}};_0x1cb53b(++_0x517a0d);}(_0xc85a,0xc2));var _0xac85=function(_0x41c3e5,_0x2cb474){_0x41c3e5=_0x41c3e5-0x0;var _0x58f28a=_0xc85a[_0x41c3e5];return _0x58f28a;};'use strict';var _=require(_0xac85('0x0'));var util=require('util');var logger=require(_0xac85('0x1'))(_0xac85('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xac85('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xac85('0x4'));var attributes=require(_0xac85('0x5'));module[_0xac85('0x6')]=function(_0x262bd2,_0xd98ee0){return _0x262bd2[_0xac85('0x7')](_0xac85('0x8'),attributes,{'tableName':_0xac85('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.rpc.js b/server/api/analyticTreeReport/analyticTreeReport.rpc.js index ce80f73..eb0af92 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 _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(_0x4b4290,_0x1726d9){var _0xbde1e0=function(_0x29ef39){while(--_0x29ef39){_0x4b4290['push'](_0x4b4290['shift']());}};_0xbde1e0(++_0x1726d9);}(_0x1261,0x144));var _0x1126=function(_0x42d1f8,_0x22e529){_0x42d1f8=_0x42d1f8-0x0;var _0x40d234=_0x1261[_0x42d1f8];return _0x40d234;};'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 +var _0x7a54=['info','AnalyticTreeReport,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x7a54,0x106));var _0x47a5=function(_0x4dd16d,_0x5e4f7b){_0x4dd16d=_0x4dd16d-0x0;var _0x1a1312=_0x7a54[_0x4dd16d];return _0x1a1312;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('AnalyticTreeReport,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file diff --git a/server/api/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index edb493d..d4bad67 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 _0x1e41=['index','/:id','post','create','put','delete','destroy','multer','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated'];(function(_0x2c8a0a,_0x5456a5){var _0x48a7d9=function(_0x2f360b){while(--_0x2f360b){_0x2c8a0a['push'](_0x2c8a0a['shift']());}};_0x48a7d9(++_0x5456a5);}(_0x1e41,0x151));var _0x11e4=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x1e41[_0x432682];return _0x463d05;};'use strict';var multer=require(_0x11e4('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x11e4('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x11e4('0x2'));var auth=require(_0x11e4('0x3'));var interaction=require(_0x11e4('0x4'));var config=require(_0x11e4('0x5'));var controller=require('./analyticTreeReport.controller');router[_0x11e4('0x6')]('/',auth[_0x11e4('0x7')](),controller[_0x11e4('0x8')]);router[_0x11e4('0x6')](_0x11e4('0x9'),auth[_0x11e4('0x7')](),controller['show']);router[_0x11e4('0xa')]('/',auth[_0x11e4('0x7')](),controller[_0x11e4('0xb')]);router[_0x11e4('0xc')](_0x11e4('0x9'),auth[_0x11e4('0x7')](),controller['update']);router[_0x11e4('0xd')](_0x11e4('0x9'),auth[_0x11e4('0x7')](),controller[_0x11e4('0xe')]);module['exports']=router; \ No newline at end of file +var _0xf656=['post','create','put','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show'];(function(_0x2d8e75,_0x2b0757){var _0x52c809=function(_0x36a2d1){while(--_0x36a2d1){_0x2d8e75['push'](_0x2d8e75['shift']());}};_0x52c809(++_0x2b0757);}(_0xf656,0x15b));var _0x6f65=function(_0x427ff0,_0x435d5a){_0x427ff0=_0x427ff0-0x0;var _0x5e9c09=_0xf656[_0x427ff0];return _0x5e9c09;};'use strict';var multer=require(_0x6f65('0x0'));var util=require(_0x6f65('0x1'));var path=require(_0x6f65('0x2'));var timeout=require('connect-timeout');var express=require(_0x6f65('0x3'));var router=express[_0x6f65('0x4')]();var fs_extra=require(_0x6f65('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x6f65('0x6'));var config=require(_0x6f65('0x7'));var controller=require('./analyticTreeReport.controller');router[_0x6f65('0x8')]('/',auth[_0x6f65('0x9')](),controller[_0x6f65('0xa')]);router[_0x6f65('0x8')](_0x6f65('0xb'),auth[_0x6f65('0x9')](),controller[_0x6f65('0xc')]);router[_0x6f65('0xd')]('/',auth[_0x6f65('0x9')](),controller[_0x6f65('0xe')]);router[_0x6f65('0xf')](_0x6f65('0xb'),auth[_0x6f65('0x9')](),controller[_0x6f65('0x10')]);router[_0x6f65('0x11')]('/:id',auth[_0x6f65('0x9')](),controller[_0x6f65('0x12')]);module[_0x6f65('0x13')]=router; \ No newline at end of file diff --git a/server/api/attachment/attachment.attributes.js b/server/api/attachment/attachment.attributes.js index 729eed7..75cda10 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 _0x818f=['sequelize','exports','STRING'];(function(_0x134ac5,_0x302c22){var _0x54893c=function(_0x30dc06){while(--_0x30dc06){_0x134ac5['push'](_0x134ac5['shift']());}};_0x54893c(++_0x302c22);}(_0x818f,0x1da));var _0xf818=function(_0x38a4a7,_0x40fb67){_0x38a4a7=_0x38a4a7-0x0;var _0x31e4a3=_0x818f[_0x38a4a7];return _0x31e4a3;};'use strict';var Sequelize=require(_0xf818('0x0'));module[_0xf818('0x1')]={'name':{'type':Sequelize[_0xf818('0x2')]},'basename':{'type':Sequelize[_0xf818('0x2')]},'type':{'type':Sequelize[_0xf818('0x2')]}}; \ No newline at end of file +var _0x8664=['sequelize','exports','STRING'];(function(_0x13a864,_0x25535e){var _0x536fa7=function(_0x336d8b){while(--_0x336d8b){_0x13a864['push'](_0x13a864['shift']());}};_0x536fa7(++_0x25535e);}(_0x8664,0x11a));var _0x4866=function(_0x9b0cac,_0x11caf8){_0x9b0cac=_0x9b0cac-0x0;var _0x1475a8=_0x8664[_0x9b0cac];return _0x1475a8;};'use strict';var Sequelize=require(_0x4866('0x0'));module[_0x4866('0x1')]={'name':{'type':Sequelize[_0x4866('0x2')]},'basename':{'type':Sequelize[_0x4866('0x2')]},'type':{'type':Sequelize[_0x4866('0x2')]}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index c5def51..1f6ff6a 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 _0x7069=['api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','apply','save','update','then','destroy','error','name','index','map','rawAttributes','key','query','keys','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','type','filter','Attachment','includeAll','include','findAll','rows','show','params','length','options','find','catch','get','omit','createdAt','updatedAt','body','create','file','originalname','basename','filename','mimetype','findOne','ChatOfflineMessageId','server/files/attachments/','offline-chat/','join','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware'];(function(_0x2279ad,_0x467d8d){var _0x5b51d9=function(_0x26e830){while(--_0x26e830){_0x2279ad['push'](_0x2279ad['shift']());}};_0x5b51d9(++_0x467d8d);}(_0x7069,0x9b));var _0x9706=function(_0x1d074e,_0x1a4cd3){_0x1d074e=_0x1d074e-0x0;var _0x2ff036=_0x7069[_0x1d074e];return _0x2ff036;};'use strict';var emlformat=require(_0x9706('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9706('0x1'));var jsonpatch=require(_0x9706('0x2'));var rp=require(_0x9706('0x3'));var moment=require(_0x9706('0x4'));var BPromise=require(_0x9706('0x5'));var Mustache=require(_0x9706('0x6'));var util=require('util');var path=require(_0x9706('0x7'));var sox=require(_0x9706('0x8'));var csv=require(_0x9706('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9706('0xa'));var _=require(_0x9706('0xb'));var squel=require(_0x9706('0xc'));var crypto=require(_0x9706('0xd'));var jsforce=require(_0x9706('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x9706('0x9'));var querystring=require(_0x9706('0xf'));var Papa=require(_0x9706('0x10'));var Redis=require(_0x9706('0x11'));var authService=require(_0x9706('0x12'));var qs=require(_0x9706('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9706('0x14'));var logger=require('../../config/logger')(_0x9706('0x15'));var utils=require(_0x9706('0x16'));var config=require(_0x9706('0x17'));var licenseUtil=require(_0x9706('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x373aa1,_0x2e652f){_0x2e652f=_0x2e652f||0xcc;return function(_0x14be07){if(_0x14be07){return _0x373aa1[_0x9706('0x19')](_0x2e652f);}return _0x373aa1[_0x9706('0x1a')](_0x2e652f)[_0x9706('0x1b')]();};}function respondWithResult(_0x5a63d1,_0x3bcb88){_0x3bcb88=_0x3bcb88||0xc8;return function(_0x3ed864){if(_0x3ed864){return _0x5a63d1[_0x9706('0x1a')](_0x3bcb88)[_0x9706('0x1c')](_0x3ed864);}};}function respondWithFilteredResult(_0xa5d4a3,_0x1e8110){return function(_0x13e0ba){if(_0x13e0ba){var _0x4152a9=typeof _0x1e8110['offset']===_0x9706('0x1d')&&typeof _0x1e8110[_0x9706('0x1e')]==='undefined';var _0x162a69=_0x13e0ba[_0x9706('0x1f')];var _0x462e2a=_0x4152a9?0x0:_0x1e8110[_0x9706('0x20')];var _0x3b252e=_0x4152a9?_0x13e0ba[_0x9706('0x1f')]:_0x1e8110['offset']+_0x1e8110[_0x9706('0x1e')];var _0x32ec98;if(_0x3b252e>=_0x162a69){_0x3b252e=_0x162a69;_0x32ec98=0xc8;}else{_0x32ec98=0xce;}_0xa5d4a3[_0x9706('0x1a')](_0x32ec98);return _0xa5d4a3['set'](_0x9706('0x21'),_0x462e2a+'-'+_0x3b252e+'/'+_0x162a69)['json'](_0x13e0ba);}return null;};}function patchUpdates(_0x488090){return function(_0x69271a){try{jsonpatch[_0x9706('0x22')](_0x69271a,_0x488090,!![]);}catch(_0x3ff053){return BPromise['reject'](_0x3ff053);}return _0x69271a[_0x9706('0x23')]();};}function saveUpdates(_0x31ef84,_0x191dbf){return function(_0x1839f8){if(_0x1839f8){return _0x1839f8[_0x9706('0x24')](_0x31ef84)[_0x9706('0x25')](function(_0x26be91){return _0x26be91;});}return null;};}function removeEntity(_0x34e111,_0x14a14a){return function(_0x3167be){if(_0x3167be){return _0x3167be[_0x9706('0x26')]()[_0x9706('0x25')](function(){_0x34e111['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2123c4,_0x1679c6){return function(_0x57b211){if(!_0x57b211){_0x2123c4[_0x9706('0x19')](0x194);}return _0x57b211;};}function handleError(_0x28b3e0,_0x8670f5){_0x8670f5=_0x8670f5||0x1f4;return function(_0x2f0c8a){logger[_0x9706('0x27')](_0x2f0c8a['stack']);if(_0x2f0c8a[_0x9706('0x28')]){delete _0x2f0c8a[_0x9706('0x28')];}_0x28b3e0[_0x9706('0x1a')](_0x8670f5)['send'](_0x2f0c8a);};}exports[_0x9706('0x29')]=function(_0x19dbe7,_0x6b7717){var _0x3ffaf2={},_0x57fe64={},_0x1f220e={'count':0x0,'rows':[]};var _0xd2f1f6=_[_0x9706('0x2a')](db['Attachment'][_0x9706('0x2b')],function(_0x3325b9){return{'name':_0x3325b9['fieldName'],'type':_0x3325b9['type'][_0x9706('0x2c')]};});_0x57fe64['model']=_[_0x9706('0x2a')](_0xd2f1f6,'name');_0x57fe64[_0x9706('0x2d')]=_[_0x9706('0x2e')](_0x19dbe7[_0x9706('0x2d')]);_0x57fe64['filters']=_[_0x9706('0x2f')](_0x57fe64[_0x9706('0x30')],_0x57fe64[_0x9706('0x2d')]);_0x3ffaf2[_0x9706('0x31')]=_[_0x9706('0x2f')](_0x57fe64['model'],qs[_0x9706('0x32')](_0x19dbe7['query']['fields']));_0x3ffaf2[_0x9706('0x31')]=_0x3ffaf2[_0x9706('0x31')]['length']?_0x3ffaf2['attributes']:_0x57fe64['model'];if(!_0x19dbe7[_0x9706('0x2d')][_0x9706('0x33')](_0x9706('0x34'))){_0x3ffaf2[_0x9706('0x1e')]=qs['limit'](_0x19dbe7['query'][_0x9706('0x1e')]);_0x3ffaf2['offset']=qs[_0x9706('0x20')](_0x19dbe7[_0x9706('0x2d')][_0x9706('0x20')]);}_0x3ffaf2[_0x9706('0x35')]=qs[_0x9706('0x36')](_0x19dbe7['query'][_0x9706('0x36')]);_0x3ffaf2[_0x9706('0x37')]=qs[_0x9706('0x38')](_[_0x9706('0x39')](_0x19dbe7[_0x9706('0x2d')],_0x57fe64[_0x9706('0x38')]),_0xd2f1f6);if(_0x19dbe7[_0x9706('0x2d')]['filter']){_0x3ffaf2[_0x9706('0x37')]=_[_0x9706('0x3a')](_0x3ffaf2[_0x9706('0x37')],{'$or':_[_0x9706('0x2a')](_0xd2f1f6,function(_0x21892e){if(_0x21892e[_0x9706('0x3b')]!=='VIRTUAL'){var _0x309675={};_0x309675[_0x21892e[_0x9706('0x28')]]={'$like':'%'+_0x19dbe7[_0x9706('0x2d')][_0x9706('0x3c')]+'%'};return _0x309675;}})});}_0x3ffaf2=_[_0x9706('0x3a')]({},_0x3ffaf2,_0x19dbe7['options']);var _0x149289={'where':_0x3ffaf2[_0x9706('0x37')]};return db[_0x9706('0x3d')][_0x9706('0x1f')](_0x149289)[_0x9706('0x25')](function(_0x4ac47e){_0x1f220e[_0x9706('0x1f')]=_0x4ac47e;if(_0x19dbe7[_0x9706('0x2d')][_0x9706('0x3e')]){_0x3ffaf2[_0x9706('0x3f')]=[{'all':!![]}];}return db['Attachment'][_0x9706('0x40')](_0x3ffaf2);})[_0x9706('0x25')](function(_0x504dc7){_0x1f220e[_0x9706('0x41')]=_0x504dc7;return _0x1f220e;})['then'](respondWithFilteredResult(_0x6b7717,_0x3ffaf2))['catch'](handleError(_0x6b7717,null));};exports[_0x9706('0x42')]=function(_0x1c66ab,_0x56406c){var _0x1274d6={'raw':!![],'where':{'id':_0x1c66ab[_0x9706('0x43')]['id']}},_0x3d9d5e={};_0x3d9d5e[_0x9706('0x30')]=_[_0x9706('0x2e')](db['Attachment']['rawAttributes']);_0x3d9d5e[_0x9706('0x2d')]=_[_0x9706('0x2e')](_0x1c66ab['query']);_0x3d9d5e[_0x9706('0x38')]=_[_0x9706('0x2f')](_0x3d9d5e[_0x9706('0x30')],_0x3d9d5e[_0x9706('0x2d')]);_0x1274d6[_0x9706('0x31')]=_['intersection'](_0x3d9d5e['model'],qs[_0x9706('0x32')](_0x1c66ab[_0x9706('0x2d')]['fields']));_0x1274d6[_0x9706('0x31')]=_0x1274d6[_0x9706('0x31')][_0x9706('0x44')]?_0x1274d6['attributes']:_0x3d9d5e[_0x9706('0x30')];if(_0x1c66ab['query']['includeAll']){_0x1274d6[_0x9706('0x3f')]=[{'all':!![]}];}_0x1274d6=_['merge']({},_0x1274d6,_0x1c66ab[_0x9706('0x45')]);return db['Attachment'][_0x9706('0x46')](_0x1274d6)['then'](handleEntityNotFound(_0x56406c,null))[_0x9706('0x25')](respondWithResult(_0x56406c,null))[_0x9706('0x47')](handleError(_0x56406c,null));};exports['clone']=function(_0x336d3b,_0x36c265){var _0x5b6488={'where':{'id':_0x336d3b[_0x9706('0x43')]['id']}},_0xc489a5={};_0xc489a5[_0x9706('0x30')]=_[_0x9706('0x2e')](db[_0x9706('0x3d')][_0x9706('0x2b')]);_0x5b6488[_0x9706('0x31')]=_['intersection'](_0xc489a5['model'],qs['fields'](_0x336d3b['query'][_0x9706('0x32')]));_0x5b6488['attributes']=_0x5b6488[_0x9706('0x31')][_0x9706('0x44')]?_0x5b6488[_0x9706('0x31')]:_0xc489a5[_0x9706('0x30')];if(_0x336d3b[_0x9706('0x2d')][_0x9706('0x3e')]){_0x5b6488[_0x9706('0x3f')]=[{'all':!![]}];}_0x5b6488=_['merge']({},_0x5b6488,_0x336d3b['options']);return db[_0x9706('0x3d')][_0x9706('0x46')](_0x5b6488)[_0x9706('0x25')](handleEntityNotFound(_0x36c265,null))[_0x9706('0x25')](function(_0x32c4d9){if(_0x32c4d9){var _0x42dccb=_0x32c4d9[_0x9706('0x48')]({'plain':!![]});_0x42dccb=qs[_0x9706('0x49')](_0x42dccb,['id',_0x9706('0x4a'),_0x9706('0x4b')]);_0x336d3b['body']=_['omit'](_0x336d3b[_0x9706('0x4c')],['id',_0x9706('0x4a'),'updatedAt']);return db['Attachment'][_0x9706('0x4d')](_[_0x9706('0x3a')](_0x42dccb,_0x336d3b[_0x9706('0x4c')]),{'include':_0x336d3b[_0x9706('0x2d')][_0x9706('0x3e')]?[{'all':!![]}]:undefined});}})[_0x9706('0x25')](respondWithResult(_0x36c265,0xc9))[_0x9706('0x47')](handleError(_0x36c265,null));};exports[_0x9706('0x24')]=function(_0x246435,_0x53c879){if(_0x246435[_0x9706('0x4c')]['id']){delete _0x246435[_0x9706('0x4c')]['id'];}return db[_0x9706('0x3d')][_0x9706('0x46')]({'where':{'id':_0x246435[_0x9706('0x43')]['id']}})[_0x9706('0x25')](handleEntityNotFound(_0x53c879,null))['then'](saveUpdates(_0x246435['body'],null))[_0x9706('0x25')](respondWithResult(_0x53c879,null))[_0x9706('0x47')](handleError(_0x53c879,null));};exports[_0x9706('0x26')]=function(_0x557428,_0x2fd10d){return db['Attachment'][_0x9706('0x46')]({'where':{'id':_0x557428[_0x9706('0x43')]['id']}})['then'](handleEntityNotFound(_0x2fd10d,null))[_0x9706('0x25')](removeEntity(_0x2fd10d,null))['catch'](handleError(_0x2fd10d,null));};exports[_0x9706('0x4d')]=function(_0x29b613,_0x5c5657,_0x1b8000){_0x29b613['body'][_0x9706('0x28')]=_0x29b613[_0x9706('0x4e')][_0x9706('0x4f')];_0x29b613['body'][_0x9706('0x50')]=_0x29b613[_0x9706('0x4e')][_0x9706('0x51')];_0x29b613[_0x9706('0x4c')]['type']=_0x29b613[_0x9706('0x4e')][_0x9706('0x52')];return db[_0x9706('0x3d')][_0x9706('0x4d')](_0x29b613[_0x9706('0x4c')])[_0x9706('0x25')](respondWithResult(_0x5c5657,0xc9))[_0x9706('0x47')](handleError(_0x5c5657,null));};exports['download']=function(_0x302924,_0x1d4255,_0x4713c3){return db['Attachment'][_0x9706('0x53')]({'where':{'id':_0x302924[_0x9706('0x43')]['id']},'raw':!![]})[_0x9706('0x25')](handleEntityNotFound(_0x1d4255,null))[_0x9706('0x25')](function(_0x2d2528){if(_0x2d2528){var _0x49b6cf=_0x2d2528[_0x9706('0x54')]!==null;var _0x2afc50=path['join'](config['root'],_0x9706('0x55'));if(_0x49b6cf){_0x2afc50=path['join'](_0x2afc50,_0x9706('0x56'));}var _0xbfc5f1=path[_0x9706('0x57')](_0x2afc50,_0x2d2528[_0x9706('0x50')]);return _0x1d4255['download'](_0xbfc5f1);}})['catch'](handleError(_0x1d4255,null));}; \ No newline at end of file +var _0xf8cf=['papaparse','../../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','apply','reject','save','then','error','stack','name','index','map','Attachment','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','show','keys','length','options','catch','clone','params','find','get','updatedAt','body','createdAt','create','update','file','filename','findOne','ChatOfflineMessageId','join','offline-chat/','basename','download','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring'];(function(_0x2ce39f,_0x38b640){var _0x4c5756=function(_0x14e29a){while(--_0x14e29a){_0x2ce39f['push'](_0x2ce39f['shift']());}};_0x4c5756(++_0x38b640);}(_0xf8cf,0x199));var _0xff8c=function(_0x3258d7,_0x24c14a){_0x3258d7=_0x3258d7-0x0;var _0x507314=_0xf8cf[_0x3258d7];return _0x507314;};'use strict';var emlformat=require(_0xff8c('0x0'));var rimraf=require(_0xff8c('0x1'));var zipdir=require(_0xff8c('0x2'));var jsonpatch=require(_0xff8c('0x3'));var rp=require(_0xff8c('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xff8c('0x5'));var util=require(_0xff8c('0x6'));var path=require(_0xff8c('0x7'));var sox=require(_0xff8c('0x8'));var csv=require(_0xff8c('0x9'));var ejs=require(_0xff8c('0xa'));var fs=require('fs');var fs_extra=require(_0xff8c('0xb'));var _=require(_0xff8c('0xc'));var squel=require(_0xff8c('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xff8c('0xe'));var toCsv=require('to-csv');var querystring=require(_0xff8c('0xf'));var Papa=require(_0xff8c('0x10'));var Redis=require('ioredis');var authService=require(_0xff8c('0x11'));var qs=require(_0xff8c('0x12'));var as=require(_0xff8c('0x13'));var hardwareService=require(_0xff8c('0x14'));var logger=require('../../config/logger')(_0xff8c('0x15'));var utils=require(_0xff8c('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xff8c('0x17'));var db=require(_0xff8c('0x18'))['db'];function respondWithStatusCode(_0x3769df,_0x22858a){_0x22858a=_0x22858a||0xcc;return function(_0xb47805){if(_0xb47805){return _0x3769df[_0xff8c('0x19')](_0x22858a);}return _0x3769df[_0xff8c('0x1a')](_0x22858a)[_0xff8c('0x1b')]();};}function respondWithResult(_0x46b750,_0x34fa04){_0x34fa04=_0x34fa04||0xc8;return function(_0x49cfaf){if(_0x49cfaf){return _0x46b750[_0xff8c('0x1a')](_0x34fa04)[_0xff8c('0x1c')](_0x49cfaf);}};}function respondWithFilteredResult(_0x18f490,_0x2a4503){return function(_0x46d420){if(_0x46d420){var _0x458e5b=typeof _0x2a4503[_0xff8c('0x1d')]===_0xff8c('0x1e')&&typeof _0x2a4503[_0xff8c('0x1f')]===_0xff8c('0x1e');var _0x2890ad=_0x46d420[_0xff8c('0x20')];var _0xd8461d=_0x458e5b?0x0:_0x2a4503[_0xff8c('0x1d')];var _0x268058=_0x458e5b?_0x46d420[_0xff8c('0x20')]:_0x2a4503[_0xff8c('0x1d')]+_0x2a4503[_0xff8c('0x1f')];var _0xf9b94d;if(_0x268058>=_0x2890ad){_0x268058=_0x2890ad;_0xf9b94d=0xc8;}else{_0xf9b94d=0xce;}_0x18f490['status'](_0xf9b94d);return _0x18f490['set']('Content-Range',_0xd8461d+'-'+_0x268058+'/'+_0x2890ad)['json'](_0x46d420);}return null;};}function patchUpdates(_0x293083){return function(_0x5dcb24){try{jsonpatch[_0xff8c('0x21')](_0x5dcb24,_0x293083,!![]);}catch(_0x20bce2){return BPromise[_0xff8c('0x22')](_0x20bce2);}return _0x5dcb24[_0xff8c('0x23')]();};}function saveUpdates(_0x405429,_0x40711c){return function(_0x19b1db){if(_0x19b1db){return _0x19b1db['update'](_0x405429)[_0xff8c('0x24')](function(_0x4c6368){return _0x4c6368;});}return null;};}function removeEntity(_0x414e0c,_0x59802f){return function(_0x1702b0){if(_0x1702b0){return _0x1702b0['destroy']()[_0xff8c('0x24')](function(){_0x414e0c['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x299139,_0x2e659d){return function(_0x1a2bf7){if(!_0x1a2bf7){_0x299139[_0xff8c('0x19')](0x194);}return _0x1a2bf7;};}function handleError(_0x35f494,_0x157271){_0x157271=_0x157271||0x1f4;return function(_0x1541d3){logger[_0xff8c('0x25')](_0x1541d3[_0xff8c('0x26')]);if(_0x1541d3[_0xff8c('0x27')]){delete _0x1541d3[_0xff8c('0x27')];}_0x35f494[_0xff8c('0x1a')](_0x157271)['send'](_0x1541d3);};}exports[_0xff8c('0x28')]=function(_0x1bdaf8,_0x2df16a){var _0x587235={},_0xebbc0f={},_0x1a5f12={'count':0x0,'rows':[]};var _0xf499c5=_[_0xff8c('0x29')](db[_0xff8c('0x2a')][_0xff8c('0x2b')],function(_0xe39923){return{'name':_0xe39923['fieldName'],'type':_0xe39923[_0xff8c('0x2c')][_0xff8c('0x2d')]};});_0xebbc0f[_0xff8c('0x2e')]=_[_0xff8c('0x29')](_0xf499c5,_0xff8c('0x27'));_0xebbc0f[_0xff8c('0x2f')]=_['keys'](_0x1bdaf8['query']);_0xebbc0f[_0xff8c('0x30')]=_[_0xff8c('0x31')](_0xebbc0f[_0xff8c('0x2e')],_0xebbc0f[_0xff8c('0x2f')]);_0x587235[_0xff8c('0x32')]=_[_0xff8c('0x31')](_0xebbc0f[_0xff8c('0x2e')],qs[_0xff8c('0x33')](_0x1bdaf8['query'][_0xff8c('0x33')]));_0x587235[_0xff8c('0x32')]=_0x587235['attributes']['length']?_0x587235[_0xff8c('0x32')]:_0xebbc0f[_0xff8c('0x2e')];if(!_0x1bdaf8[_0xff8c('0x2f')][_0xff8c('0x34')](_0xff8c('0x35'))){_0x587235[_0xff8c('0x1f')]=qs[_0xff8c('0x1f')](_0x1bdaf8[_0xff8c('0x2f')]['limit']);_0x587235[_0xff8c('0x1d')]=qs['offset'](_0x1bdaf8[_0xff8c('0x2f')][_0xff8c('0x1d')]);}_0x587235[_0xff8c('0x36')]=qs['sort'](_0x1bdaf8['query']['sort']);_0x587235[_0xff8c('0x37')]=qs['filters'](_[_0xff8c('0x38')](_0x1bdaf8[_0xff8c('0x2f')],_0xebbc0f[_0xff8c('0x30')]),_0xf499c5);if(_0x1bdaf8[_0xff8c('0x2f')][_0xff8c('0x39')]){_0x587235['where']=_[_0xff8c('0x3a')](_0x587235[_0xff8c('0x37')],{'$or':_[_0xff8c('0x29')](_0xf499c5,function(_0x3990c9){if(_0x3990c9['type']!==_0xff8c('0x3b')){var _0x2c41fe={};_0x2c41fe[_0x3990c9[_0xff8c('0x27')]]={'$like':'%'+_0x1bdaf8[_0xff8c('0x2f')][_0xff8c('0x39')]+'%'};return _0x2c41fe;}})});}_0x587235=_[_0xff8c('0x3a')]({},_0x587235,_0x1bdaf8['options']);var _0xe73e8={'where':_0x587235[_0xff8c('0x37')]};return db[_0xff8c('0x2a')]['count'](_0xe73e8)[_0xff8c('0x24')](function(_0xf4c18e){_0x1a5f12[_0xff8c('0x20')]=_0xf4c18e;if(_0x1bdaf8[_0xff8c('0x2f')][_0xff8c('0x3c')]){_0x587235[_0xff8c('0x3d')]=[{'all':!![]}];}return db[_0xff8c('0x2a')][_0xff8c('0x3e')](_0x587235);})[_0xff8c('0x24')](function(_0x2a1eb3){_0x1a5f12['rows']=_0x2a1eb3;return _0x1a5f12;})[_0xff8c('0x24')](respondWithFilteredResult(_0x2df16a,_0x587235))['catch'](handleError(_0x2df16a,null));};exports[_0xff8c('0x3f')]=function(_0x3fc815,_0x1dc626){var _0x20f4ef={'raw':!![],'where':{'id':_0x3fc815['params']['id']}},_0x15a152={};_0x15a152[_0xff8c('0x2e')]=_[_0xff8c('0x40')](db['Attachment']['rawAttributes']);_0x15a152[_0xff8c('0x2f')]=_[_0xff8c('0x40')](_0x3fc815[_0xff8c('0x2f')]);_0x15a152[_0xff8c('0x30')]=_[_0xff8c('0x31')](_0x15a152[_0xff8c('0x2e')],_0x15a152[_0xff8c('0x2f')]);_0x20f4ef[_0xff8c('0x32')]=_['intersection'](_0x15a152['model'],qs['fields'](_0x3fc815['query'][_0xff8c('0x33')]));_0x20f4ef[_0xff8c('0x32')]=_0x20f4ef[_0xff8c('0x32')][_0xff8c('0x41')]?_0x20f4ef[_0xff8c('0x32')]:_0x15a152['model'];if(_0x3fc815[_0xff8c('0x2f')]['includeAll']){_0x20f4ef[_0xff8c('0x3d')]=[{'all':!![]}];}_0x20f4ef=_['merge']({},_0x20f4ef,_0x3fc815[_0xff8c('0x42')]);return db[_0xff8c('0x2a')]['find'](_0x20f4ef)[_0xff8c('0x24')](handleEntityNotFound(_0x1dc626,null))[_0xff8c('0x24')](respondWithResult(_0x1dc626,null))[_0xff8c('0x43')](handleError(_0x1dc626,null));};exports[_0xff8c('0x44')]=function(_0x25a664,_0x123e8a){var _0x3fb54b={'where':{'id':_0x25a664[_0xff8c('0x45')]['id']}},_0x506e83={};_0x506e83[_0xff8c('0x2e')]=_[_0xff8c('0x40')](db[_0xff8c('0x2a')][_0xff8c('0x2b')]);_0x3fb54b[_0xff8c('0x32')]=_[_0xff8c('0x31')](_0x506e83[_0xff8c('0x2e')],qs[_0xff8c('0x33')](_0x25a664['query'][_0xff8c('0x33')]));_0x3fb54b[_0xff8c('0x32')]=_0x3fb54b['attributes'][_0xff8c('0x41')]?_0x3fb54b['attributes']:_0x506e83[_0xff8c('0x2e')];if(_0x25a664[_0xff8c('0x2f')][_0xff8c('0x3c')]){_0x3fb54b[_0xff8c('0x3d')]=[{'all':!![]}];}_0x3fb54b=_[_0xff8c('0x3a')]({},_0x3fb54b,_0x25a664[_0xff8c('0x42')]);return db[_0xff8c('0x2a')][_0xff8c('0x46')](_0x3fb54b)['then'](handleEntityNotFound(_0x123e8a,null))[_0xff8c('0x24')](function(_0x1005bb){if(_0x1005bb){var _0x5e3e8f=_0x1005bb[_0xff8c('0x47')]({'plain':!![]});_0x5e3e8f=qs['omit'](_0x5e3e8f,['id','createdAt',_0xff8c('0x48')]);_0x25a664[_0xff8c('0x49')]=_['omit'](_0x25a664[_0xff8c('0x49')],['id',_0xff8c('0x4a'),'updatedAt']);return db[_0xff8c('0x2a')][_0xff8c('0x4b')](_[_0xff8c('0x3a')](_0x5e3e8f,_0x25a664[_0xff8c('0x49')]),{'include':_0x25a664['query']['includeAll']?[{'all':!![]}]:undefined});}})[_0xff8c('0x24')](respondWithResult(_0x123e8a,0xc9))[_0xff8c('0x43')](handleError(_0x123e8a,null));};exports[_0xff8c('0x4c')]=function(_0x1dabd3,_0xb03957){if(_0x1dabd3[_0xff8c('0x49')]['id']){delete _0x1dabd3[_0xff8c('0x49')]['id'];}return db['Attachment'][_0xff8c('0x46')]({'where':{'id':_0x1dabd3['params']['id']}})[_0xff8c('0x24')](handleEntityNotFound(_0xb03957,null))[_0xff8c('0x24')](saveUpdates(_0x1dabd3[_0xff8c('0x49')],null))[_0xff8c('0x24')](respondWithResult(_0xb03957,null))[_0xff8c('0x43')](handleError(_0xb03957,null));};exports['destroy']=function(_0x193ec9,_0x684edc){return db[_0xff8c('0x2a')][_0xff8c('0x46')]({'where':{'id':_0x193ec9[_0xff8c('0x45')]['id']}})['then'](handleEntityNotFound(_0x684edc,null))[_0xff8c('0x24')](removeEntity(_0x684edc,null))[_0xff8c('0x43')](handleError(_0x684edc,null));};exports['create']=function(_0x2be596,_0x562d24,_0x558dd8){_0x2be596[_0xff8c('0x49')][_0xff8c('0x27')]=_0x2be596[_0xff8c('0x4d')]['originalname'];_0x2be596[_0xff8c('0x49')]['basename']=_0x2be596[_0xff8c('0x4d')][_0xff8c('0x4e')];_0x2be596['body'][_0xff8c('0x2c')]=_0x2be596['file']['mimetype'];return db[_0xff8c('0x2a')][_0xff8c('0x4b')](_0x2be596[_0xff8c('0x49')])['then'](respondWithResult(_0x562d24,0xc9))[_0xff8c('0x43')](handleError(_0x562d24,null));};exports['download']=function(_0x275f32,_0x28eb05,_0x52191a){return db[_0xff8c('0x2a')][_0xff8c('0x4f')]({'where':{'id':_0x275f32[_0xff8c('0x45')]['id']},'raw':!![]})[_0xff8c('0x24')](handleEntityNotFound(_0x28eb05,null))[_0xff8c('0x24')](function(_0x1069d9){if(_0x1069d9){var _0x5270d8=_0x1069d9[_0xff8c('0x50')]!==null;var _0x2e6d4c=path[_0xff8c('0x51')](config['root'],'server/files/attachments/');if(_0x5270d8){_0x2e6d4c=path[_0xff8c('0x51')](_0x2e6d4c,_0xff8c('0x52'));}var _0x149559=path['join'](_0x2e6d4c,_0x1069d9[_0xff8c('0x53')]);return _0x28eb05[_0xff8c('0x54')](_0x149559);}})[_0xff8c('0x43')](handleError(_0x28eb05,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index 8925214..8e137fa 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 _0x7c46=['../../config/environment','./attachment.attributes','Attachment','lodash','util','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x149145,_0x352f93){var _0x9db71b=function(_0x5df39f){while(--_0x5df39f){_0x149145['push'](_0x149145['shift']());}};_0x9db71b(++_0x352f93);}(_0x7c46,0x100));var _0x67c4=function(_0x31c70c,_0x145807){_0x31c70c=_0x31c70c-0x0;var _0x3fc86b=_0x7c46[_0x31c70c];return _0x3fc86b;};'use strict';var _=require(_0x67c4('0x0'));var util=require(_0x67c4('0x1'));var logger=require('../../config/logger')(_0x67c4('0x2'));var moment=require(_0x67c4('0x3'));var BPromise=require(_0x67c4('0x4'));var rp=require(_0x67c4('0x5'));var fs=require('fs');var path=require(_0x67c4('0x6'));var rimraf=require(_0x67c4('0x7'));var config=require(_0x67c4('0x8'));var attributes=require(_0x67c4('0x9'));module['exports']=function(_0x2647e4,_0x3500f9){return _0x2647e4['define'](_0x67c4('0xa'),attributes,{'tableName':'attachments','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6933=['define','Attachment','attachments','lodash','util','../../config/logger','api','moment','request-promise','path','../../config/environment','./attachment.attributes','exports'];(function(_0x49a942,_0x25068f){var _0x2835de=function(_0x2c349c){while(--_0x2c349c){_0x49a942['push'](_0x49a942['shift']());}};_0x2835de(++_0x25068f);}(_0x6933,0xc6));var _0x3693=function(_0x35268e,_0x4acfd1){_0x35268e=_0x35268e-0x0;var _0x28ba11=_0x6933[_0x35268e];return _0x28ba11;};'use strict';var _=require(_0x3693('0x0'));var util=require(_0x3693('0x1'));var logger=require(_0x3693('0x2'))(_0x3693('0x3'));var moment=require(_0x3693('0x4'));var BPromise=require('bluebird');var rp=require(_0x3693('0x5'));var fs=require('fs');var path=require(_0x3693('0x6'));var rimraf=require('rimraf');var config=require(_0x3693('0x7'));var attributes=require(_0x3693('0x8'));module[_0x3693('0x9')]=function(_0x32a877,_0x125d1d){return _0x32a877[_0x3693('0xa')](_0x3693('0xb'),attributes,{'tableName':_0x3693('0xc'),'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 6b67f00..ceecafd 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 _0xd49c=['body','options','raw','catch','util','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','Attachment,\x20%s,\x20%s','request\x20sent','debug','Attachment,\x20%s,\x20%s,\x20%s','stringify','error','code','message','CreateAttachment','create'];(function(_0x34843e,_0x4c4224){var _0x598f7f=function(_0x12a44c){while(--_0x12a44c){_0x34843e['push'](_0x34843e['shift']());}};_0x598f7f(++_0x4c4224);}(_0xd49c,0x1d8));var _0xcd49=function(_0x1766b6,_0x8052b0){_0x1766b6=_0x1766b6-0x0;var _0x11dc3d=_0xd49c[_0x1766b6];return _0x11dc3d;};'use strict';var _=require('lodash');var util=require(_0xcd49('0x0'));var moment=require('moment');var BPromise=require(_0xcd49('0x1'));var rs=require(_0xcd49('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xcd49('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xcd49('0x4'))('rpc');var config=require(_0xcd49('0x5'));var jayson=require(_0xcd49('0x6'));var client=jayson[_0xcd49('0x7')][_0xcd49('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x704584,_0x22f64b,_0x321013){return new BPromise(function(_0x17f26f,_0x3742e1){return client[_0xcd49('0x9')](_0x704584,_0x321013)[_0xcd49('0xa')](function(_0x4b7316){logger[_0xcd49('0xb')](_0xcd49('0xc'),_0x22f64b,_0xcd49('0xd'));logger[_0xcd49('0xe')](_0xcd49('0xf'),_0x22f64b,_0xcd49('0xd'),JSON[_0xcd49('0x10')](_0x4b7316));if(_0x4b7316[_0xcd49('0x11')]){if(_0x4b7316[_0xcd49('0x11')][_0xcd49('0x12')]===0x1f4){logger['error']('Attachment,\x20%s,\x20%s',_0x22f64b,_0x4b7316[_0xcd49('0x11')][_0xcd49('0x13')]);return _0x3742e1(_0x4b7316[_0xcd49('0x11')]['message']);}logger[_0xcd49('0x11')](_0xcd49('0xc'),_0x22f64b,_0x4b7316['error'][_0xcd49('0x13')]);return _0x17f26f(_0x4b7316[_0xcd49('0x11')][_0xcd49('0x13')]);}else{logger[_0xcd49('0xb')](_0xcd49('0xc'),_0x22f64b,_0xcd49('0xd'));_0x17f26f(_0x4b7316['result']['message']);}})['catch'](function(_0x4dabea){logger[_0xcd49('0x11')](_0xcd49('0xc'),_0x22f64b,_0x4dabea);_0x3742e1(_0x4dabea);});});}exports[_0xcd49('0x14')]=function(_0x484900){var _0x3074a4=this;return new Promise(function(_0x5f2ecb,_0x9c7262){return db['Attachment'][_0xcd49('0x15')](_0x484900[_0xcd49('0x16')],{'raw':_0x484900[_0xcd49('0x17')]?_0x484900[_0xcd49('0x17')][_0xcd49('0x18')]===undefined?!![]:![]:!![]})[_0xcd49('0xa')](function(_0x1c40a6){logger[_0xcd49('0xb')](_0xcd49('0x14'),_0x484900);logger['debug'](_0xcd49('0x14'),_0x484900,JSON[_0xcd49('0x10')](_0x1c40a6));_0x5f2ecb(_0x1c40a6);})[_0xcd49('0x19')](function(_0x5829d1){logger['error']('CreateAttachment',_0x5829d1[_0xcd49('0x13')],_0x484900);_0x9c7262(_0x3074a4[_0xcd49('0x11')](0x1f4,_0x5829d1['message']));});});}; \ No newline at end of file +var _0x00bb=['request\x20sent','debug','Attachment,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','Attachment','body','options','then','CreateAttachment','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','request','info','Attachment,\x20%s,\x20%s'];(function(_0x35863f,_0x4f3a04){var _0x35a567=function(_0x192d22){while(--_0x192d22){_0x35863f['push'](_0x35863f['shift']());}};_0x35a567(++_0x4f3a04);}(_0x00bb,0x1d8));var _0xb00b=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x00bb[_0x1ac595];return _0x455fff;};'use strict';var _=require(_0xb00b('0x0'));var util=require(_0xb00b('0x1'));var moment=require(_0xb00b('0x2'));var BPromise=require('bluebird');var rs=require(_0xb00b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb00b('0x4'))['db'];var utils=require(_0xb00b('0x5'));var logger=require('../../config/logger')(_0xb00b('0x6'));var config=require(_0xb00b('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x36e363,_0xf737d0,_0x41dfc9){return new BPromise(function(_0x37f07d,_0xfa4181){return client[_0xb00b('0x8')](_0x36e363,_0x41dfc9)['then'](function(_0x51d12b){logger[_0xb00b('0x9')](_0xb00b('0xa'),_0xf737d0,_0xb00b('0xb'));logger[_0xb00b('0xc')](_0xb00b('0xd'),_0xf737d0,'request\x20sent',JSON[_0xb00b('0xe')](_0x51d12b));if(_0x51d12b['error']){if(_0x51d12b['error']['code']===0x1f4){logger[_0xb00b('0xf')](_0xb00b('0xa'),_0xf737d0,_0x51d12b[_0xb00b('0xf')][_0xb00b('0x10')]);return _0xfa4181(_0x51d12b[_0xb00b('0xf')][_0xb00b('0x10')]);}logger['error'](_0xb00b('0xa'),_0xf737d0,_0x51d12b[_0xb00b('0xf')]['message']);return _0x37f07d(_0x51d12b[_0xb00b('0xf')][_0xb00b('0x10')]);}else{logger['info']('Attachment,\x20%s,\x20%s',_0xf737d0,_0xb00b('0xb'));_0x37f07d(_0x51d12b['result']['message']);}})[_0xb00b('0x11')](function(_0x638443){logger[_0xb00b('0xf')](_0xb00b('0xa'),_0xf737d0,_0x638443);_0xfa4181(_0x638443);});});}exports['CreateAttachment']=function(_0x2a7231){var _0x599347=this;return new Promise(function(_0x415f91,_0x5aa9a0){return db[_0xb00b('0x12')]['create'](_0x2a7231[_0xb00b('0x13')],{'raw':_0x2a7231[_0xb00b('0x14')]?_0x2a7231['options']['raw']===undefined?!![]:![]:!![]})[_0xb00b('0x15')](function(_0x4a334b){logger[_0xb00b('0x9')](_0xb00b('0x16'),_0x2a7231);logger[_0xb00b('0xc')](_0xb00b('0x16'),_0x2a7231,JSON['stringify'](_0x4a334b));_0x415f91(_0x4a334b);})[_0xb00b('0x11')](function(_0x4df284){logger[_0xb00b('0xf')](_0xb00b('0x16'),_0x4df284['message'],_0x2a7231);_0x5aa9a0(_0x599347[_0xb00b('0xf')](0x1f4,_0x4df284[_0xb00b('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index eb45a93..58fdc48 100644 --- a/server/api/attachment/index.js +++ b/server/api/attachment/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xadb5=['root','format','%s-%s','originalname','replace','file','put','update','delete','destroy','exports','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/download','download','post','/:id/clone'];(function(_0x7d0afd,_0x220310){var _0x112426=function(_0x2e85cb){while(--_0x2e85cb){_0x7d0afd['push'](_0x7d0afd['shift']());}};_0x112426(++_0x220310);}(_0xadb5,0xad));var _0x5adb=function(_0x1d81cd,_0x854c20){_0x1d81cd=_0x1d81cd-0x0;var _0xab87b5=_0xadb5[_0x1d81cd];return _0xab87b5;};'use strict';var multer=require('multer');var util=require(_0x5adb('0x0'));var path=require('path');var timeout=require(_0x5adb('0x1'));var express=require(_0x5adb('0x2'));var router=express[_0x5adb('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x5adb('0x4'));var interaction=require(_0x5adb('0x5'));var config=require(_0x5adb('0x6'));var controller=require('./attachment.controller');router[_0x5adb('0x7')]('/',auth[_0x5adb('0x8')](),controller[_0x5adb('0x9')]);router[_0x5adb('0x7')](_0x5adb('0xa'),auth[_0x5adb('0x8')](),controller[_0x5adb('0xb')]);router[_0x5adb('0x7')](_0x5adb('0xc'),auth[_0x5adb('0x8')](),controller[_0x5adb('0xd')]);router[_0x5adb('0xe')](_0x5adb('0xf'),auth[_0x5adb('0x8')](),controller['clone']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x1a8f66,_0x1ea238,_0x82e67e){_0x82e67e(null,path['join'](config[_0x5adb('0x10')],'server/files/attachments/'));},'filename':function(_0x2a0b70,_0x5433bf,_0x8cfcc6){_0x8cfcc6(null,util[_0x5adb('0x11')](_0x5adb('0x12'),Date['now'](),_0x5433bf[_0x5adb('0x13')][_0x5adb('0x14')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x5adb('0xe')]('/',upload['single'](_0x5adb('0x15')),controller['create']);router[_0x5adb('0x16')](_0x5adb('0xa'),auth[_0x5adb('0x8')](),controller[_0x5adb('0x17')]);router[_0x5adb('0x18')](_0x5adb('0xa'),auth[_0x5adb('0x8')](),controller[_0x5adb('0x19')]);module[_0x5adb('0x1a')]=router; \ No newline at end of file +var _0xadb5=['root','format','%s-%s','originalname','replace','file','put','update','delete','destroy','exports','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/download','download','post','/:id/clone'];(function(_0x48f637,_0x196f2){var _0x2aa226=function(_0x3367f4){while(--_0x3367f4){_0x48f637['push'](_0x48f637['shift']());}};_0x2aa226(++_0x196f2);}(_0xadb5,0xad));var _0x5adb=function(_0x4fd451,_0xcc0801){_0x4fd451=_0x4fd451-0x0;var _0x160342=_0xadb5[_0x4fd451];return _0x160342;};'use strict';var multer=require('multer');var util=require(_0x5adb('0x0'));var path=require('path');var timeout=require(_0x5adb('0x1'));var express=require(_0x5adb('0x2'));var router=express[_0x5adb('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x5adb('0x4'));var interaction=require(_0x5adb('0x5'));var config=require(_0x5adb('0x6'));var controller=require('./attachment.controller');router[_0x5adb('0x7')]('/',auth[_0x5adb('0x8')](),controller[_0x5adb('0x9')]);router[_0x5adb('0x7')](_0x5adb('0xa'),auth[_0x5adb('0x8')](),controller[_0x5adb('0xb')]);router[_0x5adb('0x7')](_0x5adb('0xc'),auth[_0x5adb('0x8')](),controller[_0x5adb('0xd')]);router[_0x5adb('0xe')](_0x5adb('0xf'),auth[_0x5adb('0x8')](),controller['clone']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x1a8f66,_0x1ea238,_0x82e67e){_0x82e67e(null,path['join'](config[_0x5adb('0x10')],'server/files/attachments/'));},'filename':function(_0x2a0b70,_0x5433bf,_0x8cfcc6){_0x8cfcc6(null,util[_0x5adb('0x11')](_0x5adb('0x12'),Date['now'](),_0x5433bf[_0x5adb('0x13')][_0x5adb('0x14')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x5adb('0xe')]('/',upload['single'](_0x5adb('0x15')),controller['create']);router[_0x5adb('0x16')](_0x5adb('0xa'),auth[_0x5adb('0x8')](),controller[_0x5adb('0x17')]);router[_0x5adb('0x18')](_0x5adb('0xa'),auth[_0x5adb('0x8')](),controller[_0x5adb('0x19')]);module[_0x5adb('0x1a')]=router; \ No newline at end of file diff --git a/server/api/authActiveDirectory/authActiveDirectory.controller.js b/server/api/authActiveDirectory/authActiveDirectory.controller.js index 9d6ee7b..19fd19e 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 _0x7649=['inspect','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','Error\x20authenticate\x20%s:\x20Wrong\x20credentials','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured','Setting','findOne','adSsoEnabled','blockDuration','then','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled','name','password','salt','role','blocked','admin','user','agent','disabled','blockedAt','add','minutes','getLicense','catch','status','send','message','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','online','use','User','passport','passport-local','Strategy','activedirectory2','util','../../mysqldb','../../components/auth/service','../../config/utils','../../config/environment','../../config/logger','api','activedirectory','undefined','baseDN','url','domain','authenticate','error','Error\x20authenticate\x20%s:\x20%s'];(function(_0x5d2840,_0x3233e3){var _0x5f3555=function(_0x5550d0){while(--_0x5550d0){_0x5d2840['push'](_0x5d2840['shift']());}};_0x5f3555(++_0x3233e3);}(_0x7649,0x11f));var _0x9764=function(_0x274989,_0x34a495){_0x274989=_0x274989-0x0;var _0x334ac5=_0x7649[_0x274989];return _0x334ac5;};'use strict';var passport=require(_0x9764('0x0'));var LocalStrategy=require(_0x9764('0x1'))[_0x9764('0x2')];var moment=require('moment');var ActiveDirectory=require(_0x9764('0x3'));var BPromise=require('bluebird');var util=require(_0x9764('0x4'));var db=require(_0x9764('0x5'))['db'];var authService=require(_0x9764('0x6'));var utils=require(_0x9764('0x7'));var config=require(_0x9764('0x8'));var logger=require(_0x9764('0x9'))(_0x9764('0xa'));function isActiveDirectoryConfigured(_0x41e071){var _0x4a1e07=![];if(typeof _0x41e071[_0x9764('0xb')]!==_0x9764('0xc')){_0x4a1e07=_0x41e071[_0x9764('0xb')][_0x9764('0xd')]&&_0x41e071[_0x9764('0xb')][_0x9764('0xe')]&&_0x41e071[_0x9764('0xb')][_0x9764('0xf')];}return _0x4a1e07;}function adAuthenticate(_0x3addca,_0x1b957c,_0x221d33){return new BPromise(function(_0xafef82,_0x343186){try{var _0x1a858f=new ActiveDirectory(_0x3addca);_0x1a858f[_0x9764('0x10')](_0x1b957c,_0x221d33,function(_0x208675,_0x5e7c01){if(_0x208675){logger[_0x9764('0x11')](_0x9764('0x12'),_0x1b957c,util[_0x9764('0x13')](_0x208675,{'showHidden':![],'depth':null}));_0x343186(_0x9764('0x14'));}else if(!_0x5e7c01){logger[_0x9764('0x11')](_0x9764('0x15'),_0x1b957c);_0x343186('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{_0xafef82(_0x5e7c01);}});}catch(_0x4f0ab9){_0x343186(_0x4f0ab9);}});}function ActiveDirectoryAuthenticate(_0x7a19d7,_0x110ff1,_0x5abb2d,_0x301c37){var _0x276fa8,_0x258705;if(!isActiveDirectoryConfigured(config)){logger[_0x9764('0x11')](_0x9764('0x16'),_0x110ff1);return _0x301c37(null,![],{'message':_0x9764('0x14')});}return db[_0x9764('0x17')][_0x9764('0x18')]({'where':{'id':0x1},'attributes':[_0x9764('0x19'),_0x9764('0x1a')],'raw':!![]})[_0x9764('0x1b')](function(_0x46bbd8){_0x276fa8=_0x46bbd8;if(!_0x276fa8['adSsoEnabled']){logger[_0x9764('0x11')](_0x9764('0x1c'),_0x110ff1);throw new Error(_0x9764('0x14'));}return _0x7a19d7[_0x9764('0x18')]({'attributes':['id',_0x9764('0x1d'),_0x9764('0x1e'),_0x9764('0x1f'),_0x9764('0x20'),'disabled',_0x9764('0x21'),'blockedAt','online'],'where':{'name':_0x110ff1,'role':{'$or':[_0x9764('0x22'),_0x9764('0x23'),_0x9764('0x24')]},'adSsoEnabled':!![]}});})['then'](function(_0x155d35){if(!_0x155d35||_0x155d35&&_0x155d35['name']!==_0x110ff1){throw new Error(_0x9764('0x14'));}_0x258705=_0x155d35;var _0x33a3c2=_0x258705[_0x9764('0x1d')]+'@'+config[_0x9764('0xb')]['domain'];return adAuthenticate(config[_0x9764('0xb')],_0x33a3c2,_0x5abb2d);})[_0x9764('0x1b')](function(_0x3223b3){if(_0x258705[_0x9764('0x25')]){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}if(_0x276fa8[_0x9764('0x1a')]>0x0){if(_0x258705[_0x9764('0x21')]){if(moment(_0x258705[_0x9764('0x26')])[_0x9764('0x27')](_0x276fa8[_0x9764('0x1a')],_0x9764('0x28'))>moment()){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}return utils['clearBlockUser'](_0x258705,0x0,![],null)[_0x9764('0x1b')](function(){return utils['getLicense'](_0x258705);})[_0x9764('0x1b')](function(){return _0x301c37(null,_0x258705);});}else{return utils[_0x9764('0x29')](_0x258705)['then'](function(){return _0x301c37(null,_0x258705);});}}else{return utils['getLicense'](_0x258705)[_0x9764('0x1b')](function(){return _0x301c37(null,_0x258705);});}})[_0x9764('0x2a')](function(_0x695359){return _0x301c37(null,![],_0x695359);});}function handleError(_0x363afb,_0x4ead44,_0x5ef3cd){return _0x363afb[_0x9764('0x2b')](_0x4ead44||0x1f4)[_0x9764('0x2c')]({'message':_0x5ef3cd?_0x5ef3cd[_0x9764('0x2d')]||_0x5ef3cd:''});}exports['login']=function(_0x100baf,_0x252e3b,_0x5ba766){passport['authenticate']('ad-login',function(_0x427050,_0x5956d3,_0x3b5596){var _0x48fb7a=_0x427050||_0x3b5596;if(_0x48fb7a){return handleError(_0x252e3b,0x191,_0x48fb7a);}if(!_0x5956d3){return handleError(_0x252e3b,0x194,{'message':_0x9764('0x2e')});}else{var _0x562611={'payload':{'id':_0x5956d3['id'],'role':_0x5956d3[_0x9764('0x20')]},'options':{'expiresIn':0x15180}};return authService[_0x9764('0x2f')](_0x562611)[_0x9764('0x1b')](function(_0x175da3){_0x252e3b['json']({'id':_0x5956d3['id'],'token':_0x175da3,'statusCall':'','isAlreadyLogged':_0x5956d3[_0x9764('0x30')]});});}})(_0x100baf,_0x252e3b,_0x5ba766);};passport[_0x9764('0x31')]('ad-login',new LocalStrategy({'usernameField':_0x9764('0x1d'),'passwordField':_0x9764('0x1e')},function(_0x304d23,_0x54a9f3,_0x34ec33){return ActiveDirectoryAuthenticate(db[_0x9764('0x32')],_0x304d23,_0x54a9f3,_0x34ec33);})); \ No newline at end of file +var _0x787c=['../../components/auth/service','../../config/utils','../../config/environment','../../config/logger','api','activedirectory','baseDN','url','domain','authenticate','inspect','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','error','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured','Setting','adSsoEnabled','blockDuration','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled','findOne','password','salt','role','disabled','blocked','blockedAt','online','admin','user','then','name','add','minutes','clearBlockUser','getLicense','catch','status','message','login','ad-login','signToken','json','use','User','passport','passport-local','moment','activedirectory2','bluebird','../../mysqldb'];(function(_0x1e8cb5,_0x2ecea0){var _0x969afb=function(_0x25b36c){while(--_0x25b36c){_0x1e8cb5['push'](_0x1e8cb5['shift']());}};_0x969afb(++_0x2ecea0);}(_0x787c,0xbe));var _0xc787=function(_0x106c55,_0x3bef8a){_0x106c55=_0x106c55-0x0;var _0x18cc48=_0x787c[_0x106c55];return _0x18cc48;};'use strict';var passport=require(_0xc787('0x0'));var LocalStrategy=require(_0xc787('0x1'))['Strategy'];var moment=require(_0xc787('0x2'));var ActiveDirectory=require(_0xc787('0x3'));var BPromise=require(_0xc787('0x4'));var util=require('util');var db=require(_0xc787('0x5'))['db'];var authService=require(_0xc787('0x6'));var utils=require(_0xc787('0x7'));var config=require(_0xc787('0x8'));var logger=require(_0xc787('0x9'))(_0xc787('0xa'));function isActiveDirectoryConfigured(_0x1865b9){var _0x5a3048=![];if(typeof _0x1865b9['activedirectory']!=='undefined'){_0x5a3048=_0x1865b9[_0xc787('0xb')][_0xc787('0xc')]&&_0x1865b9['activedirectory'][_0xc787('0xd')]&&_0x1865b9[_0xc787('0xb')][_0xc787('0xe')];}return _0x5a3048;}function adAuthenticate(_0x1771b9,_0xe75816,_0x1b5280){return new BPromise(function(_0x3e520d,_0xab38b3){try{var _0x38cd1e=new ActiveDirectory(_0x1771b9);_0x38cd1e[_0xc787('0xf')](_0xe75816,_0x1b5280,function(_0xd9baca,_0x4afaf3){if(_0xd9baca){logger['error']('Error\x20authenticate\x20%s:\x20%s',_0xe75816,util[_0xc787('0x10')](_0xd9baca,{'showHidden':![],'depth':null}));_0xab38b3(_0xc787('0x11'));}else if(!_0x4afaf3){logger[_0xc787('0x12')]('Error\x20authenticate\x20%s:\x20Wrong\x20credentials',_0xe75816);_0xab38b3(_0xc787('0x11'));}else{_0x3e520d(_0x4afaf3);}});}catch(_0xc23137){_0xab38b3(_0xc23137);}});}function ActiveDirectoryAuthenticate(_0x99b033,_0x499d8b,_0x2e3fbf,_0x1ffef0){var _0x4aea25,_0x3327b9;if(!isActiveDirectoryConfigured(config)){logger[_0xc787('0x12')](_0xc787('0x13'),_0x499d8b);return _0x1ffef0(null,![],{'message':_0xc787('0x11')});}return db[_0xc787('0x14')]['findOne']({'where':{'id':0x1},'attributes':[_0xc787('0x15'),_0xc787('0x16')],'raw':!![]})['then'](function(_0x367929){_0x4aea25=_0x367929;if(!_0x4aea25[_0xc787('0x15')]){logger[_0xc787('0x12')](_0xc787('0x17'),_0x499d8b);throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}return _0x99b033[_0xc787('0x18')]({'attributes':['id','name',_0xc787('0x19'),_0xc787('0x1a'),_0xc787('0x1b'),_0xc787('0x1c'),_0xc787('0x1d'),_0xc787('0x1e'),_0xc787('0x1f')],'where':{'name':_0x499d8b,'role':{'$or':[_0xc787('0x20'),_0xc787('0x21'),'agent']},'adSsoEnabled':!![]}});})[_0xc787('0x22')](function(_0x32dffc){if(!_0x32dffc||_0x32dffc&&_0x32dffc[_0xc787('0x23')]!==_0x499d8b){throw new Error(_0xc787('0x11'));}_0x3327b9=_0x32dffc;var _0x321dbf=_0x3327b9[_0xc787('0x23')]+'@'+config[_0xc787('0xb')][_0xc787('0xe')];return adAuthenticate(config[_0xc787('0xb')],_0x321dbf,_0x2e3fbf);})[_0xc787('0x22')](function(_0x58f0f8){if(_0x3327b9[_0xc787('0x1c')]){throw new Error(_0xc787('0x11'));}if(_0x4aea25[_0xc787('0x16')]>0x0){if(_0x3327b9[_0xc787('0x1d')]){if(moment(_0x3327b9[_0xc787('0x1e')])[_0xc787('0x24')](_0x4aea25[_0xc787('0x16')],_0xc787('0x25'))>moment()){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}return utils[_0xc787('0x26')](_0x3327b9,0x0,![],null)[_0xc787('0x22')](function(){return utils[_0xc787('0x27')](_0x3327b9);})['then'](function(){return _0x1ffef0(null,_0x3327b9);});}else{return utils['getLicense'](_0x3327b9)[_0xc787('0x22')](function(){return _0x1ffef0(null,_0x3327b9);});}}else{return utils['getLicense'](_0x3327b9)['then'](function(){return _0x1ffef0(null,_0x3327b9);});}})[_0xc787('0x28')](function(_0x575887){return _0x1ffef0(null,![],_0x575887);});}function handleError(_0xd60968,_0x5dbc6e,_0x2e8f10){return _0xd60968[_0xc787('0x29')](_0x5dbc6e||0x1f4)['send']({'message':_0x2e8f10?_0x2e8f10[_0xc787('0x2a')]||_0x2e8f10:''});}exports[_0xc787('0x2b')]=function(_0x3a5240,_0xabb96b,_0x41a450){passport[_0xc787('0xf')](_0xc787('0x2c'),function(_0xdb7944,_0x46c7f9,_0x471e57){var _0x42157e=_0xdb7944||_0x471e57;if(_0x42157e){return handleError(_0xabb96b,0x191,_0x42157e);}if(!_0x46c7f9){return handleError(_0xabb96b,0x194,{'message':'Something\x20went\x20wrong,\x20please\x20try\x20again.'});}else{var _0x248a62={'payload':{'id':_0x46c7f9['id'],'role':_0x46c7f9['role']},'options':{'expiresIn':0x15180}};return authService[_0xc787('0x2d')](_0x248a62)['then'](function(_0x16bee6){_0xabb96b[_0xc787('0x2e')]({'id':_0x46c7f9['id'],'token':_0x16bee6,'statusCall':'','isAlreadyLogged':_0x46c7f9['online']});});}})(_0x3a5240,_0xabb96b,_0x41a450);};passport[_0xc787('0x2f')](_0xc787('0x2c'),new LocalStrategy({'usernameField':_0xc787('0x23'),'passwordField':'password'},function(_0x292c8a,_0x261b5e,_0x207aa3){return ActiveDirectoryAuthenticate(db[_0xc787('0x30')],_0x292c8a,_0x261b5e,_0x207aa3);})); \ No newline at end of file diff --git a/server/api/authActiveDirectory/index.js b/server/api/authActiveDirectory/index.js index 11c60ec..894842e 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 _0x9c45=['post','login','Router','./authActiveDirectory.controller'];(function(_0x2b1a98,_0x4c9c43){var _0x457556=function(_0x4e2c1c){while(--_0x4e2c1c){_0x2b1a98['push'](_0x2b1a98['shift']());}};_0x457556(++_0x4c9c43);}(_0x9c45,0x12a));var _0x59c4=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9c45[_0x14add3];return _0x4a174f;};'use strict';var express=require('express');var router=express[_0x59c4('0x0')]();var controller=require(_0x59c4('0x1'));router[_0x59c4('0x2')]('/',controller[_0x59c4('0x3')]);module['exports']=router; \ No newline at end of file +var _0x5d07=['express','post','login','exports'];(function(_0x269ee8,_0x477226){var _0x4d98bd=function(_0x20d4c4){while(--_0x20d4c4){_0x269ee8['push'](_0x269ee8['shift']());}};_0x4d98bd(++_0x477226);}(_0x5d07,0xa0));var _0x75d0=function(_0x33c619,_0x4f7c37){_0x33c619=_0x33c619-0x0;var _0xde7647=_0x5d07[_0x33c619];return _0xde7647;};'use strict';var express=require(_0x75d0('0x0'));var router=express['Router']();var controller=require('./authActiveDirectory.controller');router[_0x75d0('0x1')]('/',controller[_0x75d0('0x2')]);module[_0x75d0('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 ead9bb6..98531cd 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(_0x24fb83,_0x18caba){var _0x445a66=function(_0x3e4a23){while(--_0x3e4a23){_0x24fb83['push'](_0x24fb83['shift']());}};_0x445a66(++_0x18caba);}(_0x9957,0x93));var _0x7995=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x9957[_0x2f5ac5];return _0x37c9a8;};'use strict';var _=require(_0x7995('0x0'));var passport=require(_0x7995('0x1'));var GoogleStrategy=require(_0x7995('0x2'))[_0x7995('0x3')];var moment=require('moment');var db=require(_0x7995('0x4'))['db'];var config=require(_0x7995('0x5'));var utils=require(_0x7995('0x6'));exports[_0x7995('0x7')]=passport['authenticate'](_0x7995('0x8'),{'failureRedirect':_0x7995('0x9'),'scope':[_0x7995('0xa'),_0x7995('0xb')],'session':![]});exports[_0x7995('0xc')]=passport[_0x7995('0xd')]('google',{'failureRedirect':_0x7995('0x9'),'session':![]});passport[_0x7995('0xe')](new GoogleStrategy({'clientID':config['google']?config[_0x7995('0x8')][_0x7995('0xf')]:'id','clientSecret':config[_0x7995('0x8')]?config[_0x7995('0x8')][_0x7995('0x10')]:_0x7995('0x11'),'callbackURL':config[_0x7995('0x8')]?config['google'][_0x7995('0x12')]:''},function(_0x41c652,_0x581f22,_0xb0c872,_0x2cb37a){var _0x19a27e,_0x385f00;return db[_0x7995('0x13')][_0x7995('0x14')]({'where':{'id':0x1},'attributes':[_0x7995('0x15'),'blockDuration'],'raw':!![]})['then'](function(_0x2b4e94){_0x19a27e=_0x2b4e94;return db[_0x7995('0x16')][_0x7995('0x17')]({'where':{'email':_[_0x7995('0x18')](_0xb0c872[_0x7995('0x19')],_0x7995('0x1a')),'role':{'$or':[_0x7995('0x1b'),_0x7995('0x1c'),'agent']}}});})[_0x7995('0x1d')](function(_0x565d97){_0x385f00=_0x565d97;if(_0x385f00){if(_0x385f00[_0x7995('0x1e')]){return _0x2cb37a(_0x7995('0x1f'));}else if(_0x19a27e[_0x7995('0x20')]>0x0){if(_0x385f00[_0x7995('0x21')]){if(moment(_0x385f00[_0x7995('0x22')])[_0x7995('0x23')](_0x19a27e['blockDuration'],'minutes')>moment()){return _0x2cb37a(_0x7995('0x1f'));}else{return utils['clearBlockUser'](_0x385f00,0x0,![],null)['then'](function(){return utils[_0x7995('0x24')](_0x385f00);})[_0x7995('0x1d')](function(){return _0x2cb37a(null,_0x385f00);});}}else{return utils['getLicense'](_0x385f00)[_0x7995('0x1d')](function(){return _0x2cb37a(null,_0x385f00);});}}else{return utils['getLicense'](_0x385f00)['then'](function(){return _0x2cb37a(null,_0x385f00);});}}return _0x2cb37a(_0x7995('0x1f'));})[_0x7995('0x25')](function(_0x350fd9){_0x2cb37a(_0x350fd9);});})); \ No newline at end of file +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(_0x1fc122,_0x5e2c17){var _0xa2cb13=function(_0x263b13){while(--_0x263b13){_0x1fc122['push'](_0x1fc122['shift']());}};_0xa2cb13(++_0x5e2c17);}(_0x7a54,0x106));var _0x47a5=function(_0x2e89fb,_0x3d3db6){_0x2e89fb=_0x2e89fb-0x0;var _0x1d07dc=_0x7a54[_0x2e89fb];return _0x1d07dc;};'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 037c734..9c4c39f 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 _0xf5be=['passport','Router','./authGoogle.controller','../user/user.controller.js','../../components/auth/service','login','get','/callback','callback','isMiddleware','setTokenCookie','express'];(function(_0x48475b,_0x4d3077){var _0x3b241a=function(_0x5c4a49){while(--_0x5c4a49){_0x48475b['push'](_0x48475b['shift']());}};_0x3b241a(++_0x4d3077);}(_0xf5be,0x107));var _0xef5b=function(_0x20e255,_0x1cf24a){_0x20e255=_0x20e255-0x0;var _0x4c9db6=_0xf5be[_0x20e255];return _0x4c9db6;};'use strict';var express=require(_0xef5b('0x0'));var passport=require(_0xef5b('0x1'));var router=express[_0xef5b('0x2')]();var controller=require(_0xef5b('0x3'));var userController=require(_0xef5b('0x4'));var authService=require(_0xef5b('0x5'));router['get']('/',controller[_0xef5b('0x6')]);router[_0xef5b('0x7')](_0xef5b('0x8'),controller[_0xef5b('0x9')],authService[_0xef5b('0xa')],userController[_0xef5b('0x6')],authService[_0xef5b('0xb')]);module['exports']=router; \ No newline at end of file +var _0xe0ad=['login','setTokenCookie','exports','express','passport','./authGoogle.controller','../user/user.controller.js','../../components/auth/service','get','/callback','callback','isMiddleware'];(function(_0x220865,_0x5726be){var _0x4eb39a=function(_0x274b5e){while(--_0x274b5e){_0x220865['push'](_0x220865['shift']());}};_0x4eb39a(++_0x5726be);}(_0xe0ad,0x10b));var _0xde0a=function(_0x3c3033,_0x2f5373){_0x3c3033=_0x3c3033-0x0;var _0x530524=_0xe0ad[_0x3c3033];return _0x530524;};'use strict';var express=require(_0xde0a('0x0'));var passport=require(_0xde0a('0x1'));var router=express['Router']();var controller=require(_0xde0a('0x2'));var userController=require(_0xde0a('0x3'));var authService=require(_0xde0a('0x4'));router[_0xde0a('0x5')]('/',controller['login']);router['get'](_0xde0a('0x6'),controller[_0xde0a('0x7')],authService[_0xde0a('0x8')],userController[_0xde0a('0x9')],authService[_0xde0a('0xa')]);module[_0xde0a('0xb')]=router; \ No newline at end of file diff --git a/server/api/authLocal/authLocal.controller.js b/server/api/authLocal/authLocal.controller.js index 9d28ac1..720cf85 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 _0x1b38=['find','Smtp','CloudProvider','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','getSmtpOptions','merge','\x22%s\x22\x20<%s>','email','request','error','format','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','stringify','status','send','login','local-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','online','body','generate','trim','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','now','save','xCally\x20Motion\x20Password\x20Reset','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','https://','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','Reset\x20Email\x20sent!','reset','User','params','token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','enforcePasswordHistory','passwordHistoryLimit','validatePasswordHistory','previousPasswords','Password\x20reset!','use','util','passport','passport-local','Strategy','lodash','randomstring','moment','../../mysqldb','../../components/auth/service','client','http','Setting','findOne','then','name','password','salt','role','blockedAt','loginAttempts','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','disabled','blocked','blockDuration','add','clearBlockUser','allowedLoginAttempts','minutes','getLicense','catch','MailAccount'];(function(_0x30e55c,_0x407005){var _0x1683c7=function(_0x4a1d46){while(--_0x4a1d46){_0x30e55c['push'](_0x30e55c['shift']());}};_0x1683c7(++_0x407005);}(_0x1b38,0x12d));var _0x81b3=function(_0x322c2f,_0x254da0){_0x322c2f=_0x322c2f-0x0;var _0x33994f=_0x1b38[_0x322c2f];return _0x33994f;};'use strict';var util=require(_0x81b3('0x0'));var passport=require(_0x81b3('0x1'));var LocalStrategy=require(_0x81b3('0x2'))[_0x81b3('0x3')];var jayson=require('jayson/promise');var _=require(_0x81b3('0x4'));var rs=require(_0x81b3('0x5'));var moment=require(_0x81b3('0x6'));var db=require(_0x81b3('0x7'))['db'];var authService=require(_0x81b3('0x8'));var utils=require('../../config/utils');var client=jayson[_0x81b3('0x9')][_0x81b3('0xa')]({'port':0x232b});function localAuthenticate(_0x4ce1f3,_0x47542d,_0x2d8eff,_0x1cdb80){var _0x5ee89c,_0x494f69;return db[_0x81b3('0xb')][_0x81b3('0xc')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts','blockDuration'],'raw':!![]})[_0x81b3('0xd')](function(_0x3749d7){_0x5ee89c=_0x3749d7;return _0x4ce1f3['findOne']({'attributes':['id',_0x81b3('0xe'),_0x81b3('0xf'),_0x81b3('0x10'),_0x81b3('0x11'),'disabled','blocked',_0x81b3('0x12'),_0x81b3('0x13')],'where':{'name':_0x47542d,'role':{'$or':[_0x81b3('0x14'),_0x81b3('0x15'),_0x81b3('0x16')]}}});})[_0x81b3('0xd')](function(_0x45a6f4){if(!_0x45a6f4||_0x45a6f4&&_0x45a6f4[_0x81b3('0xe')]!==_0x47542d){throw new Error(_0x81b3('0x17'));}else{_0x494f69=_0x45a6f4;return _0x494f69;}})[_0x81b3('0xd')](function(){_0x494f69[_0x81b3('0x18')](_0x2d8eff,function(_0x2a9d79,_0x520f29){var _0x1555f9=_0x494f69[_0x81b3('0x13')]+0x1;if(_0x2a9d79){return _0x1cdb80(_0x2a9d79);}else if(!_0x520f29){if(_0x494f69[_0x81b3('0x19')]){return _0x1cdb80(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0x5ee89c['allowedLoginAttempts']>0x0){if(_0x494f69[_0x81b3('0x1a')]){if(_0x5ee89c[_0x81b3('0x1b')]>0x0){if(moment(_0x494f69[_0x81b3('0x12')])[_0x81b3('0x1c')](_0x5ee89c[_0x81b3('0x1b')],'minutes')>moment()){return _0x1cdb80(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0x81b3('0x1d')](_0x494f69,_0x1555f9,![],null)[_0x81b3('0xd')](function(){return _0x1cdb80(null,![],{'message':_0x81b3('0x17')});});}}else{return _0x1cdb80(null,![],{'message':_0x81b3('0x17')});}}else{if(_0x1555f9>=_0x5ee89c[_0x81b3('0x1e')]){return utils[_0x81b3('0x1d')](_0x494f69,0x0,!![],moment())[_0x81b3('0xd')](function(){return _0x1cdb80(null,![],{'message':_0x81b3('0x17')});});}else{return utils[_0x81b3('0x1d')](_0x494f69,_0x1555f9,![],null)[_0x81b3('0xd')](function(){return _0x1cdb80(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}}else{return _0x1cdb80(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{if(_0x494f69[_0x81b3('0x19')]){return _0x1cdb80(null,![],{'message':_0x81b3('0x17')});}else if(_0x5ee89c[_0x81b3('0x1e')]>0x0){if(_0x494f69[_0x81b3('0x1a')]){if(_0x5ee89c[_0x81b3('0x1b')]>0x0){if(moment(_0x494f69[_0x81b3('0x12')])[_0x81b3('0x1c')](_0x5ee89c[_0x81b3('0x1b')],_0x81b3('0x1f'))>moment()){return _0x1cdb80(null,![],{'message':_0x81b3('0x17')});}else{return utils[_0x81b3('0x1d')](_0x494f69,0x0,![],null)[_0x81b3('0xd')](function(){return utils[_0x81b3('0x20')](_0x494f69);})[_0x81b3('0xd')](function(){return _0x1cdb80(null,_0x494f69);});}}else{return _0x1cdb80(null,![],{'message':_0x81b3('0x17')});}}else{return utils[_0x81b3('0x1d')](_0x494f69,0x0,![],null)['then'](function(){return utils[_0x81b3('0x20')](_0x494f69);})[_0x81b3('0xd')](function(){return _0x1cdb80(null,_0x494f69);})[_0x81b3('0x21')](function(_0x1b26ad){return _0x1cdb80(null,![],_0x1b26ad);});}}else{if(_0x494f69['blocked']){return _0x1cdb80(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0x81b3('0x20')](_0x494f69)[_0x81b3('0xd')](function(){return _0x1cdb80(null,_0x494f69);});}}}});})[_0x81b3('0x21')](function(_0x1f49f7){return _0x1cdb80(null,![],_0x1f49f7);});}function sendServiceMail(_0x1da86a){return db[_0x81b3('0x22')][_0x81b3('0x23')]({'where':{'service':!![]},'attributes':['id',_0x81b3('0xe'),'email'],'include':[{'model':db['MailServerOut'],'as':_0x81b3('0x24'),'include':[{'model':db['CloudProvider'],'as':_0x81b3('0x25')}]}]})[_0x81b3('0xd')](function(_0x190bcc){if(!_0x190bcc){throw new Error(_0x81b3('0x26'));}var _0x9dd9be=_0x190bcc[_0x81b3('0x27')]();var _0x1f5e88={'account':_0x9dd9be,'message':_[_0x81b3('0x28')]({'from':util['format'](_0x81b3('0x29'),_0x190bcc[_0x81b3('0xe')],_0x190bcc[_0x81b3('0x2a')]||_0x190bcc['Smtp'][_0x81b3('0x15')])},_0x1da86a)};return client[_0x81b3('0x2b')]('SendMail',_0x1f5e88);})[_0x81b3('0xd')](function(_0x26ca99){if(_0x26ca99[_0x81b3('0x2c')]){throw new Error(util[_0x81b3('0x2d')](_0x81b3('0x2e'),_0x26ca99[_0x81b3('0x2c')][_0x81b3('0x2f')]||JSON[_0x81b3('0x30')](_0x26ca99[_0x81b3('0x2c')])));}return!![];});}function handleError(_0x3d809e,_0x23ea2b,_0x384264){return _0x3d809e[_0x81b3('0x31')](_0x23ea2b||0x1f4)[_0x81b3('0x32')]({'message':_0x384264?_0x384264[_0x81b3('0x2f')]||_0x384264:''});}exports[_0x81b3('0x33')]=function(_0x1ec3d7,_0x1c4464,_0x5205af){passport[_0x81b3('0x18')](_0x81b3('0x34'),function(_0x217e2f,_0x5c6698,_0x5ccd05){var _0xe719e0=_0x217e2f||_0x5ccd05;if(_0xe719e0){return handleError(_0x1c4464,0x191,_0xe719e0);}if(!_0x5c6698){return handleError(_0x1c4464,0x194,{'message':_0x81b3('0x35')});}else{var _0x5469a2={'payload':{'id':_0x5c6698['id'],'role':_0x5c6698['role']},'options':{'expiresIn':0x15180}};return authService[_0x81b3('0x36')](_0x5469a2)[_0x81b3('0xd')](function(_0x4565d9){_0x1c4464['json']({'id':_0x5c6698['id'],'token':_0x4565d9,'statusCall':'','isAlreadyLogged':_0x5c6698[_0x81b3('0x37')]});});}})(_0x1ec3d7,_0x1c4464,_0x5205af);};exports['forgot']=function(_0x6a0891,_0x2cd792){if(!_0x6a0891[_0x81b3('0x38')][_0x81b3('0x2a')]){return handleError(_0x2cd792,0x1f4,{'message':'Email\x20parameter\x20is\x20missing'});}var _0x3ad444=rs[_0x81b3('0x39')]();_0x6a0891[_0x81b3('0x38')][_0x81b3('0x2a')]=_0x6a0891[_0x81b3('0x38')][_0x81b3('0x2a')][_0x81b3('0x3a')]()['toLowerCase']();var _0x5279c4;return db[_0x81b3('0xb')][_0x81b3('0xc')]({'where':{'id':0x1},'attributes':[_0x81b3('0x1e'),_0x81b3('0x1b')],'raw':!![]})[_0x81b3('0xd')](function(_0x43b13f){_0x5279c4=_0x43b13f;return db['User'][_0x81b3('0x23')]({'where':{'email':_0x6a0891[_0x81b3('0x38')][_0x81b3('0x2a')]}});})['then'](function(_0x3a9693){if(!_0x3a9693){throw new Error(_0x81b3('0x3b'));}if(_0x3a9693[_0x81b3('0x19')]){throw new Error(_0x81b3('0x3c'));}if(_0x3a9693[_0x81b3('0x1a')]){if(moment(_0x3a9693[_0x81b3('0x12')])[_0x81b3('0x1c')](_0x5279c4[_0x81b3('0x1b')],_0x81b3('0x1f'))>moment()){throw new Error(_0x81b3('0x3d'));}else{_0x3a9693[_0x81b3('0x1a')]=![];_0x3a9693[_0x81b3('0x12')]=null;}}_0x3a9693[_0x81b3('0x3e')]=_0x3ad444;_0x3a9693['resetPasswordExpires']=Date[_0x81b3('0x3f')]()+0x36ee80;return _0x3a9693[_0x81b3('0x40')]();})['then'](function(){return sendServiceMail({'to':_0x6a0891[_0x81b3('0x38')]['email'],'subject':_0x81b3('0x41'),'text':_0x81b3('0x42')+_0x81b3('0x43')+_0x81b3('0x44')+_0x6a0891['headers']['host']+_0x81b3('0x45')+_0x3ad444+'\x0a\x0a'+_0x81b3('0x46')});})['then'](function(){_0x2cd792[_0x81b3('0x31')](0xc8)[_0x81b3('0x32')]({'message':_0x81b3('0x47')});})['catch'](function(_0x5b2cda){return handleError(_0x2cd792,0x1f4,_0x5b2cda);});};exports[_0x81b3('0x48')]=function(_0x10a26d,_0x2a537b){return db[_0x81b3('0x49')]['find']({'where':{'resetPasswordToken':_0x10a26d[_0x81b3('0x4a')][_0x81b3('0x4b')],'resetPasswordExpires':{'$gt':Date[_0x81b3('0x3f')]()}}})[_0x81b3('0xd')](function(_0x26bfce){if(!_0x26bfce){throw new Error(_0x81b3('0x4c'));}return db[_0x81b3('0xb')][_0x81b3('0xc')]({'attributes':['id',_0x81b3('0x4d'),_0x81b3('0x4e'),_0x81b3('0x4f')]})[_0x81b3('0xd')](function(_0x5d2de4){if(_0x5d2de4[_0x81b3('0x4d')])authService['validatePasswordPattern'](_0x10a26d[_0x81b3('0x38')][_0x81b3('0xf')]);if(!_0x5d2de4[_0x81b3('0x4e')]||!_0x26bfce['previousPasswords'])return _0x26bfce;authService[_0x81b3('0x50')](_0x10a26d['body']['password'],_0x26bfce[_0x81b3('0x51')],_0x5d2de4['passwordHistoryLimit']);return _0x26bfce;})[_0x81b3('0xd')](function(){_0x26bfce[_0x81b3('0xf')]=_0x10a26d[_0x81b3('0x38')][_0x81b3('0xf')];_0x26bfce[_0x81b3('0x3e')]=null;_0x26bfce['resetPasswordExpires']=null;return _0x26bfce[_0x81b3('0x40')]();});})[_0x81b3('0xd')](function(){_0x2a537b[_0x81b3('0x31')](0xc8)[_0x81b3('0x32')]({'message':_0x81b3('0x52')});})['catch'](function(_0x175e15){return handleError(_0x2a537b,0x1f4,_0x175e15);});};passport[_0x81b3('0x53')](_0x81b3('0x34'),new LocalStrategy({'usernameField':_0x81b3('0xe'),'passwordField':_0x81b3('0xf')},function(_0x4cc439,_0x647e3d,_0x4547ff){return localAuthenticate(db['User'],_0x4cc439,_0x647e3d,_0x4547ff);})); \ No newline at end of file +var _0xaf50=['allowedLoginAttempts','blockedAt','clearBlockUser','add','catch','getLicense','MailAccount','find','email','Smtp','format','\x22%s\x22\x20<%s>','user','request','SendMail','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','stringify','status','send','login','local-login','json','online','forgot','body','Email\x20parameter\x20is\x20missing','generate','toLowerCase','User','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','resetPasswordExpires','now','save','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','https://','headers','host','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','Reset\x20Email\x20sent!','params','Setting','securePassword','enforcePasswordHistory','passwordHistoryLimit','previousPasswords','validatePasswordHistory','Password\x20reset!','use','util','passport-local','Strategy','jayson/promise','lodash','randomstring','../../mysqldb','../../components/auth/service','http','blockDuration','then','findOne','name','password','salt','role','disabled','blocked','loginAttempts','agent','authenticate','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'];(function(_0x38fafb,_0x1a3932){var _0x1c533d=function(_0x3b2c54){while(--_0x3b2c54){_0x38fafb['push'](_0x38fafb['shift']());}};_0x1c533d(++_0x1a3932);}(_0xaf50,0x116));var _0x0af5=function(_0x14ce42,_0x195d59){_0x14ce42=_0x14ce42-0x0;var _0x21327f=_0xaf50[_0x14ce42];return _0x21327f;};'use strict';var util=require(_0x0af5('0x0'));var passport=require('passport');var LocalStrategy=require(_0x0af5('0x1'))[_0x0af5('0x2')];var jayson=require(_0x0af5('0x3'));var _=require(_0x0af5('0x4'));var rs=require(_0x0af5('0x5'));var moment=require('moment');var db=require(_0x0af5('0x6'))['db'];var authService=require(_0x0af5('0x7'));var utils=require('../../config/utils');var client=jayson['client'][_0x0af5('0x8')]({'port':0x232b});function localAuthenticate(_0xbb4a69,_0x25660c,_0x147fa1,_0x3b0d83){var _0x521a89,_0x398c11;return db['Setting']['findOne']({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0x0af5('0x9')],'raw':!![]})[_0x0af5('0xa')](function(_0x35f590){_0x521a89=_0x35f590;return _0xbb4a69[_0x0af5('0xb')]({'attributes':['id',_0x0af5('0xc'),_0x0af5('0xd'),_0x0af5('0xe'),_0x0af5('0xf'),_0x0af5('0x10'),_0x0af5('0x11'),'blockedAt',_0x0af5('0x12')],'where':{'name':_0x25660c,'role':{'$or':['admin','user',_0x0af5('0x13')]}}});})['then'](function(_0x1c18e3){if(!_0x1c18e3||_0x1c18e3&&_0x1c18e3['name']!==_0x25660c){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{_0x398c11=_0x1c18e3;return _0x398c11;}})[_0x0af5('0xa')](function(){_0x398c11[_0x0af5('0x14')](_0x147fa1,function(_0x176d72,_0x28ad8d){var _0x57a8ed=_0x398c11['loginAttempts']+0x1;if(_0x176d72){return _0x3b0d83(_0x176d72);}else if(!_0x28ad8d){if(_0x398c11[_0x0af5('0x10')]){return _0x3b0d83(null,![],{'message':_0x0af5('0x15')});}else if(_0x521a89[_0x0af5('0x16')]>0x0){if(_0x398c11[_0x0af5('0x11')]){if(_0x521a89[_0x0af5('0x9')]>0x0){if(moment(_0x398c11[_0x0af5('0x17')])['add'](_0x521a89['blockDuration'],'minutes')>moment()){return _0x3b0d83(null,![],{'message':_0x0af5('0x15')});}else{return utils[_0x0af5('0x18')](_0x398c11,_0x57a8ed,![],null)[_0x0af5('0xa')](function(){return _0x3b0d83(null,![],{'message':_0x0af5('0x15')});});}}else{return _0x3b0d83(null,![],{'message':_0x0af5('0x15')});}}else{if(_0x57a8ed>=_0x521a89['allowedLoginAttempts']){return utils['clearBlockUser'](_0x398c11,0x0,!![],moment())['then'](function(){return _0x3b0d83(null,![],{'message':_0x0af5('0x15')});});}else{return utils[_0x0af5('0x18')](_0x398c11,_0x57a8ed,![],null)[_0x0af5('0xa')](function(){return _0x3b0d83(null,![],{'message':_0x0af5('0x15')});});}}}else{return _0x3b0d83(null,![],{'message':_0x0af5('0x15')});}}else{if(_0x398c11[_0x0af5('0x10')]){return _0x3b0d83(null,![],{'message':_0x0af5('0x15')});}else if(_0x521a89[_0x0af5('0x16')]>0x0){if(_0x398c11['blocked']){if(_0x521a89[_0x0af5('0x9')]>0x0){if(moment(_0x398c11[_0x0af5('0x17')])[_0x0af5('0x19')](_0x521a89[_0x0af5('0x9')],'minutes')>moment()){return _0x3b0d83(null,![],{'message':_0x0af5('0x15')});}else{return utils['clearBlockUser'](_0x398c11,0x0,![],null)['then'](function(){return utils['getLicense'](_0x398c11);})[_0x0af5('0xa')](function(){return _0x3b0d83(null,_0x398c11);});}}else{return _0x3b0d83(null,![],{'message':_0x0af5('0x15')});}}else{return utils['clearBlockUser'](_0x398c11,0x0,![],null)[_0x0af5('0xa')](function(){return utils['getLicense'](_0x398c11);})[_0x0af5('0xa')](function(){return _0x3b0d83(null,_0x398c11);})[_0x0af5('0x1a')](function(_0x2b3670){return _0x3b0d83(null,![],_0x2b3670);});}}else{if(_0x398c11[_0x0af5('0x11')]){return _0x3b0d83(null,![],{'message':_0x0af5('0x15')});}else{return utils[_0x0af5('0x1b')](_0x398c11)[_0x0af5('0xa')](function(){return _0x3b0d83(null,_0x398c11);});}}}});})['catch'](function(_0x118bda){return _0x3b0d83(null,![],_0x118bda);});}function sendServiceMail(_0x5e2044){return db[_0x0af5('0x1c')][_0x0af5('0x1d')]({'where':{'service':!![]},'attributes':['id',_0x0af5('0xc'),_0x0af5('0x1e')],'include':[{'model':db['MailServerOut'],'as':_0x0af5('0x1f'),'include':[{'model':db['CloudProvider'],'as':'CloudProvider'}]}]})['then'](function(_0x436109){if(!_0x436109){throw new Error('Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!');}var _0x3b31e3=_0x436109['getSmtpOptions']();var _0x11cd20={'account':_0x3b31e3,'message':_['merge']({'from':util[_0x0af5('0x20')](_0x0af5('0x21'),_0x436109[_0x0af5('0xc')],_0x436109[_0x0af5('0x1e')]||_0x436109[_0x0af5('0x1f')][_0x0af5('0x22')])},_0x5e2044)};return client[_0x0af5('0x23')](_0x0af5('0x24'),_0x11cd20);})[_0x0af5('0xa')](function(_0x31e791){if(_0x31e791[_0x0af5('0x25')]){throw new Error(util[_0x0af5('0x20')](_0x0af5('0x26'),_0x31e791[_0x0af5('0x25')]['message']||JSON[_0x0af5('0x27')](_0x31e791[_0x0af5('0x25')])));}return!![];});}function handleError(_0x15866f,_0x56f14e,_0x41ca95){return _0x15866f[_0x0af5('0x28')](_0x56f14e||0x1f4)[_0x0af5('0x29')]({'message':_0x41ca95?_0x41ca95['message']||_0x41ca95:''});}exports[_0x0af5('0x2a')]=function(_0x4368e3,_0x42d946,_0x3f193e){passport[_0x0af5('0x14')](_0x0af5('0x2b'),function(_0x4a7e51,_0x4a107e,_0x9b94e6){var _0x19edac=_0x4a7e51||_0x9b94e6;if(_0x19edac){return handleError(_0x42d946,0x191,_0x19edac);}if(!_0x4a107e){return handleError(_0x42d946,0x194,{'message':'Something\x20went\x20wrong,\x20please\x20try\x20again.'});}else{var _0x414c63={'payload':{'id':_0x4a107e['id'],'role':_0x4a107e[_0x0af5('0xf')]},'options':{'expiresIn':0x15180}};return authService['signToken'](_0x414c63)[_0x0af5('0xa')](function(_0x451281){_0x42d946[_0x0af5('0x2c')]({'id':_0x4a107e['id'],'token':_0x451281,'statusCall':'','isAlreadyLogged':_0x4a107e[_0x0af5('0x2d')]});});}})(_0x4368e3,_0x42d946,_0x3f193e);};exports[_0x0af5('0x2e')]=function(_0x5eb97e,_0x150a2e){if(!_0x5eb97e[_0x0af5('0x2f')][_0x0af5('0x1e')]){return handleError(_0x150a2e,0x1f4,{'message':_0x0af5('0x30')});}var _0x4ef993=rs[_0x0af5('0x31')]();_0x5eb97e[_0x0af5('0x2f')][_0x0af5('0x1e')]=_0x5eb97e['body'][_0x0af5('0x1e')]['trim']()[_0x0af5('0x32')]();var _0x3517f4;return db['Setting'][_0x0af5('0xb')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts','blockDuration'],'raw':!![]})['then'](function(_0xafb041){_0x3517f4=_0xafb041;return db[_0x0af5('0x33')][_0x0af5('0x1d')]({'where':{'email':_0x5eb97e['body']['email']}});})[_0x0af5('0xa')](function(_0x56b201){if(!_0x56b201){throw new Error(_0x0af5('0x34'));}if(_0x56b201['disabled']){throw new Error(_0x0af5('0x35'));}if(_0x56b201[_0x0af5('0x11')]){if(moment(_0x56b201[_0x0af5('0x17')])[_0x0af5('0x19')](_0x3517f4[_0x0af5('0x9')],'minutes')>moment()){throw new Error('The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.');}else{_0x56b201[_0x0af5('0x11')]=![];_0x56b201[_0x0af5('0x17')]=null;}}_0x56b201[_0x0af5('0x36')]=_0x4ef993;_0x56b201[_0x0af5('0x37')]=Date[_0x0af5('0x38')]()+0x36ee80;return _0x56b201[_0x0af5('0x39')]();})['then'](function(){return sendServiceMail({'to':_0x5eb97e[_0x0af5('0x2f')][_0x0af5('0x1e')],'subject':'xCally\x20Motion\x20Password\x20Reset','text':_0x0af5('0x3a')+_0x0af5('0x3b')+_0x0af5('0x3c')+_0x5eb97e[_0x0af5('0x3d')][_0x0af5('0x3e')]+_0x0af5('0x3f')+_0x4ef993+'\x0a\x0a'+_0x0af5('0x40')});})['then'](function(){_0x150a2e[_0x0af5('0x28')](0xc8)['send']({'message':_0x0af5('0x41')});})[_0x0af5('0x1a')](function(_0x5d819e){return handleError(_0x150a2e,0x1f4,_0x5d819e);});};exports['reset']=function(_0x12b7a8,_0x406f37){return db[_0x0af5('0x33')]['find']({'where':{'resetPasswordToken':_0x12b7a8[_0x0af5('0x42')]['token'],'resetPasswordExpires':{'$gt':Date['now']()}}})[_0x0af5('0xa')](function(_0xc3a5f7){if(!_0xc3a5f7){throw new Error('Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.');}return db[_0x0af5('0x43')][_0x0af5('0xb')]({'attributes':['id',_0x0af5('0x44'),_0x0af5('0x45'),_0x0af5('0x46')]})[_0x0af5('0xa')](function(_0x3a957f){if(_0x3a957f[_0x0af5('0x44')])authService['validatePasswordPattern'](_0x12b7a8['body']['password']);if(!_0x3a957f[_0x0af5('0x45')]||!_0xc3a5f7[_0x0af5('0x47')])return _0xc3a5f7;authService[_0x0af5('0x48')](_0x12b7a8[_0x0af5('0x2f')]['password'],_0xc3a5f7[_0x0af5('0x47')],_0x3a957f[_0x0af5('0x46')]);return _0xc3a5f7;})[_0x0af5('0xa')](function(){_0xc3a5f7[_0x0af5('0xd')]=_0x12b7a8[_0x0af5('0x2f')]['password'];_0xc3a5f7[_0x0af5('0x36')]=null;_0xc3a5f7[_0x0af5('0x37')]=null;return _0xc3a5f7[_0x0af5('0x39')]();});})[_0x0af5('0xa')](function(){_0x406f37['status'](0xc8)[_0x0af5('0x29')]({'message':_0x0af5('0x49')});})[_0x0af5('0x1a')](function(_0x1efb20){return handleError(_0x406f37,0x1f4,_0x1efb20);});};passport[_0x0af5('0x4a')](_0x0af5('0x2b'),new LocalStrategy({'usernameField':_0x0af5('0xc'),'passwordField':_0x0af5('0xd')},function(_0xe1e43,_0x75fed8,_0x3bcc27){return localAuthenticate(db['User'],_0xe1e43,_0x75fed8,_0x3bcc27);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index 8a1db0d..1e4de7a 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 _0x4a08=['./authLocal.controller','post','/forgot','/reset/:token','reset','Router'];(function(_0xd1d19a,_0x1933f0){var _0x52a79d=function(_0x5199e2){while(--_0x5199e2){_0xd1d19a['push'](_0xd1d19a['shift']());}};_0x52a79d(++_0x1933f0);}(_0x4a08,0xb3));var _0x84a0=function(_0x461d6e,_0x4e622c){_0x461d6e=_0x461d6e-0x0;var _0x4f2620=_0x4a08[_0x461d6e];return _0x4f2620;};'use strict';var express=require('express');var router=express[_0x84a0('0x0')]();var controller=require(_0x84a0('0x1'));router[_0x84a0('0x2')]('/',controller['login']);router[_0x84a0('0x2')](_0x84a0('0x3'),controller['forgot']);router[_0x84a0('0x2')](_0x84a0('0x4'),controller[_0x84a0('0x5')]);module['exports']=router; \ No newline at end of file +var _0x242d=['./authLocal.controller','post','login','/forgot','forgot','/reset/:token','exports','express','Router'];(function(_0x239109,_0x5e9534){var _0x3d40f7=function(_0x5e8efb){while(--_0x5e8efb){_0x239109['push'](_0x239109['shift']());}};_0x3d40f7(++_0x5e9534);}(_0x242d,0xdf));var _0xd242=function(_0xbddf5d,_0x442a60){_0xbddf5d=_0xbddf5d-0x0;var _0x227959=_0x242d[_0xbddf5d];return _0x227959;};'use strict';var express=require(_0xd242('0x0'));var router=express[_0xd242('0x1')]();var controller=require(_0xd242('0x2'));router[_0xd242('0x3')]('/',controller[_0xd242('0x4')]);router[_0xd242('0x3')](_0xd242('0x5'),controller[_0xd242('0x6')]);router['post'](_0xd242('0x7'),controller['reset']);module[_0xd242('0x8')]=router; \ No newline at end of file diff --git a/server/api/automation/automation.attributes.js b/server/api/automation/automation.attributes.js index a40dcbd..cf30e21 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 _0x7c93=['INTEGER','exports','STRING','BOOLEAN'];(function(_0xe0aa5d,_0x3ff8b7){var _0x5c27aa=function(_0x454deb){while(--_0x454deb){_0xe0aa5d['push'](_0xe0aa5d['shift']());}};_0x5c27aa(++_0x3ff8b7);}(_0x7c93,0xf5));var _0x37c9=function(_0x18e49a,_0x5bf163){_0x18e49a=_0x18e49a-0x0;var _0x1397b5=_0x7c93[_0x18e49a];return _0x1397b5;};'use strict';var Sequelize=require('sequelize');module[_0x37c9('0x0')]={'name':{'type':Sequelize[_0x37c9('0x1')],'allowNull':![]},'channel':{'type':Sequelize[_0x37c9('0x1')]},'description':{'type':Sequelize[_0x37c9('0x1')]},'status':{'type':Sequelize[_0x37c9('0x2')],'defaultValue':![]},'timeout':{'type':Sequelize[_0x37c9('0x3')],'defaultValue':0xa}}; \ No newline at end of file +var _0xe176=['INTEGER','sequelize','exports','STRING','BOOLEAN'];(function(_0x4c8134,_0x3e2348){var _0x587a11=function(_0x2016e9){while(--_0x2016e9){_0x4c8134['push'](_0x4c8134['shift']());}};_0x587a11(++_0x3e2348);}(_0xe176,0xf6));var _0x6e17=function(_0x17dab8,_0x19d0ec){_0x17dab8=_0x17dab8-0x0;var _0x336fb5=_0xe176[_0x17dab8];return _0x336fb5;};'use strict';var Sequelize=require(_0x6e17('0x0'));module[_0x6e17('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'channel':{'type':Sequelize[_0x6e17('0x2')]},'description':{'type':Sequelize[_0x6e17('0x2')]},'status':{'type':Sequelize[_0x6e17('0x3')],'defaultValue':![]},'timeout':{'type':Sequelize[_0x6e17('0x4')],'defaultValue':0xa}}; \ No newline at end of file diff --git a/server/api/automation/automation.controller.js b/server/api/automation/automation.controller.js index e7bc4fb..8c7aff9 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 _0xc4cd=['merge','options','find','create','body','destroy','addConditions','Condition','ids','omit','getConditions','findOne','hasOwnProperty','addActions','Action','getActions','rimraf','zip-dir','moment','bluebird','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','end','stack','send','index','map','Automation','rawAttributes','fieldName','type','key','model','name','keys','query','filters','intersection','attributes','length','nolimit','offset','order','sort','where','pick','filter','includeAll','include','findAll','rows','catch','show','params','fields'];(function(_0x47848c,_0x1c52f3){var _0x520324=function(_0x202798){while(--_0x202798){_0x47848c['push'](_0x47848c['shift']());}};_0x520324(++_0x1c52f3);}(_0xc4cd,0x106));var _0xdc4c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc4cd[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xdc4c('0x0'));var zipdir=require(_0xdc4c('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xdc4c('0x2'));var BPromise=require(_0xdc4c('0x3'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xdc4c('0x4'));var ejs=require(_0xdc4c('0x5'));var fs=require('fs');var fs_extra=require(_0xdc4c('0x6'));var _=require(_0xdc4c('0x7'));var squel=require(_0xdc4c('0x8'));var crypto=require(_0xdc4c('0x9'));var jsforce=require(_0xdc4c('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xdc4c('0x4'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xdc4c('0xb'));var authService=require(_0xdc4c('0xc'));var qs=require(_0xdc4c('0xd'));var as=require(_0xdc4c('0xe'));var hardwareService=require(_0xdc4c('0xf'));var logger=require(_0xdc4c('0x10'))('api');var utils=require('../../config/utils');var config=require(_0xdc4c('0x11'));var licenseUtil=require(_0xdc4c('0x12'));var db=require(_0xdc4c('0x13'))['db'];function respondWithStatusCode(_0x4b4e2c,_0x925ba2){_0x925ba2=_0x925ba2||0xcc;return function(_0x1f6530){if(_0x1f6530){return _0x4b4e2c[_0xdc4c('0x14')](_0x925ba2);}return _0x4b4e2c['status'](_0x925ba2)['end']();};}function respondWithResult(_0x2d4ce5,_0x44d75b){_0x44d75b=_0x44d75b||0xc8;return function(_0x4bdb0b){if(_0x4bdb0b){return _0x2d4ce5[_0xdc4c('0x15')](_0x44d75b)[_0xdc4c('0x16')](_0x4bdb0b);}};}function respondWithFilteredResult(_0x506777,_0x3ee2aa){return function(_0x56d6b4){if(_0x56d6b4){var _0xcca126=typeof _0x3ee2aa['offset']===_0xdc4c('0x17')&&typeof _0x3ee2aa[_0xdc4c('0x18')]===_0xdc4c('0x17');var _0x1c3910=_0x56d6b4[_0xdc4c('0x19')];var _0x2f22cf=_0xcca126?0x0:_0x3ee2aa['offset'];var _0x228c54=_0xcca126?_0x56d6b4[_0xdc4c('0x19')]:_0x3ee2aa['offset']+_0x3ee2aa[_0xdc4c('0x18')];var _0x457e77;if(_0x228c54>=_0x1c3910){_0x228c54=_0x1c3910;_0x457e77=0xc8;}else{_0x457e77=0xce;}_0x506777[_0xdc4c('0x15')](_0x457e77);return _0x506777[_0xdc4c('0x1a')](_0xdc4c('0x1b'),_0x2f22cf+'-'+_0x228c54+'/'+_0x1c3910)[_0xdc4c('0x16')](_0x56d6b4);}return null;};}function patchUpdates(_0x73df32){return function(_0x585286){try{jsonpatch[_0xdc4c('0x1c')](_0x585286,_0x73df32,!![]);}catch(_0x5afb1d){return BPromise[_0xdc4c('0x1d')](_0x5afb1d);}return _0x585286[_0xdc4c('0x1e')]();};}function saveUpdates(_0x42d926,_0x395909){return function(_0x36bf02){if(_0x36bf02){return _0x36bf02[_0xdc4c('0x1f')](_0x42d926)[_0xdc4c('0x20')](function(_0x40d28e){return _0x40d28e;});}return null;};}function removeEntity(_0x41aa06,_0x51472f){return function(_0x267568){if(_0x267568){return _0x267568['destroy']()['then'](function(){_0x41aa06['status'](0xcc)[_0xdc4c('0x21')]();});}};}function handleEntityNotFound(_0x1ab266,_0x75f27a){return function(_0x4d4905){if(!_0x4d4905){_0x1ab266[_0xdc4c('0x14')](0x194);}return _0x4d4905;};}function handleError(_0x52b0c0,_0x3d6910){_0x3d6910=_0x3d6910||0x1f4;return function(_0x43a114){logger['error'](_0x43a114[_0xdc4c('0x22')]);if(_0x43a114['name']){delete _0x43a114['name'];}_0x52b0c0[_0xdc4c('0x15')](_0x3d6910)[_0xdc4c('0x23')](_0x43a114);};}exports[_0xdc4c('0x24')]=function(_0x11b331,_0x3f1b87){var _0x2f9fa7={},_0x3949c7={},_0x18d7a4={'count':0x0,'rows':[]};var _0x4237f0=_[_0xdc4c('0x25')](db[_0xdc4c('0x26')][_0xdc4c('0x27')],function(_0x5c7720){return{'name':_0x5c7720[_0xdc4c('0x28')],'type':_0x5c7720[_0xdc4c('0x29')][_0xdc4c('0x2a')]};});_0x3949c7[_0xdc4c('0x2b')]=_[_0xdc4c('0x25')](_0x4237f0,_0xdc4c('0x2c'));_0x3949c7['query']=_[_0xdc4c('0x2d')](_0x11b331[_0xdc4c('0x2e')]);_0x3949c7[_0xdc4c('0x2f')]=_[_0xdc4c('0x30')](_0x3949c7[_0xdc4c('0x2b')],_0x3949c7[_0xdc4c('0x2e')]);_0x2f9fa7[_0xdc4c('0x31')]=_[_0xdc4c('0x30')](_0x3949c7[_0xdc4c('0x2b')],qs['fields'](_0x11b331[_0xdc4c('0x2e')]['fields']));_0x2f9fa7['attributes']=_0x2f9fa7[_0xdc4c('0x31')][_0xdc4c('0x32')]?_0x2f9fa7[_0xdc4c('0x31')]:_0x3949c7[_0xdc4c('0x2b')];if(!_0x11b331[_0xdc4c('0x2e')]['hasOwnProperty'](_0xdc4c('0x33'))){_0x2f9fa7[_0xdc4c('0x18')]=qs['limit'](_0x11b331[_0xdc4c('0x2e')]['limit']);_0x2f9fa7['offset']=qs[_0xdc4c('0x34')](_0x11b331[_0xdc4c('0x2e')][_0xdc4c('0x34')]);}_0x2f9fa7[_0xdc4c('0x35')]=qs[_0xdc4c('0x36')](_0x11b331['query']['sort']);_0x2f9fa7[_0xdc4c('0x37')]=qs['filters'](_[_0xdc4c('0x38')](_0x11b331[_0xdc4c('0x2e')],_0x3949c7['filters']),_0x4237f0);if(_0x11b331['query']['filter']){_0x2f9fa7[_0xdc4c('0x37')]=_['merge'](_0x2f9fa7['where'],{'$or':_[_0xdc4c('0x25')](_0x4237f0,function(_0x45f0a7){if(_0x45f0a7['type']!=='VIRTUAL'){var _0x3a753c={};_0x3a753c[_0x45f0a7[_0xdc4c('0x2c')]]={'$like':'%'+_0x11b331['query'][_0xdc4c('0x39')]+'%'};return _0x3a753c;}})});}_0x2f9fa7=_['merge']({},_0x2f9fa7,_0x11b331['options']);var _0x1d41b3={'where':_0x2f9fa7[_0xdc4c('0x37')]};return db[_0xdc4c('0x26')]['count'](_0x1d41b3)[_0xdc4c('0x20')](function(_0x167f8d){_0x18d7a4['count']=_0x167f8d;if(_0x11b331[_0xdc4c('0x2e')][_0xdc4c('0x3a')]){_0x2f9fa7[_0xdc4c('0x3b')]=[{'all':!![]}];}return db['Automation'][_0xdc4c('0x3c')](_0x2f9fa7);})[_0xdc4c('0x20')](function(_0x2c7f70){_0x18d7a4[_0xdc4c('0x3d')]=_0x2c7f70;return _0x18d7a4;})['then'](respondWithFilteredResult(_0x3f1b87,_0x2f9fa7))[_0xdc4c('0x3e')](handleError(_0x3f1b87,null));};exports[_0xdc4c('0x3f')]=function(_0x208b0c,_0x41afdc){var _0x362265={'raw':![],'where':{'id':_0x208b0c[_0xdc4c('0x40')]['id']}},_0x3b625e={};_0x3b625e['model']=_[_0xdc4c('0x2d')](db[_0xdc4c('0x26')][_0xdc4c('0x27')]);_0x3b625e[_0xdc4c('0x2e')]=_['keys'](_0x208b0c[_0xdc4c('0x2e')]);_0x3b625e[_0xdc4c('0x2f')]=_[_0xdc4c('0x30')](_0x3b625e[_0xdc4c('0x2b')],_0x3b625e[_0xdc4c('0x2e')]);_0x362265[_0xdc4c('0x31')]=_['intersection'](_0x3b625e[_0xdc4c('0x2b')],qs[_0xdc4c('0x41')](_0x208b0c['query'][_0xdc4c('0x41')]));_0x362265[_0xdc4c('0x31')]=_0x362265[_0xdc4c('0x31')][_0xdc4c('0x32')]?_0x362265['attributes']:_0x3b625e[_0xdc4c('0x2b')];if(_0x208b0c[_0xdc4c('0x2e')][_0xdc4c('0x3a')]){_0x362265[_0xdc4c('0x3b')]=[{'all':!![]}];}_0x362265=_[_0xdc4c('0x42')]({},_0x362265,_0x208b0c[_0xdc4c('0x43')]);return db['Automation'][_0xdc4c('0x44')](_0x362265)[_0xdc4c('0x20')](handleEntityNotFound(_0x41afdc,null))[_0xdc4c('0x20')](respondWithResult(_0x41afdc,null))[_0xdc4c('0x3e')](handleError(_0x41afdc,null));};exports[_0xdc4c('0x45')]=function(_0x25adc4,_0x4331e3){return db['Automation']['create'](_0x25adc4[_0xdc4c('0x46')],{})[_0xdc4c('0x20')](respondWithResult(_0x4331e3,0xc9))[_0xdc4c('0x3e')](handleError(_0x4331e3,null));};exports[_0xdc4c('0x1f')]=function(_0x39beea,_0x5db30a){if(_0x39beea['body']['id']){delete _0x39beea[_0xdc4c('0x46')]['id'];}return db[_0xdc4c('0x26')][_0xdc4c('0x44')]({'where':{'id':_0x39beea[_0xdc4c('0x40')]['id']}})[_0xdc4c('0x20')](handleEntityNotFound(_0x5db30a,null))[_0xdc4c('0x20')](saveUpdates(_0x39beea[_0xdc4c('0x46')],null))[_0xdc4c('0x20')](respondWithResult(_0x5db30a,null))[_0xdc4c('0x3e')](handleError(_0x5db30a,null));};exports[_0xdc4c('0x47')]=function(_0x4a81a5,_0x135f01){return db[_0xdc4c('0x26')][_0xdc4c('0x44')]({'where':{'id':_0x4a81a5[_0xdc4c('0x40')]['id']}})[_0xdc4c('0x20')](handleEntityNotFound(_0x135f01,null))['then'](removeEntity(_0x135f01,null))['catch'](handleError(_0x135f01,null));};exports[_0xdc4c('0x48')]=function(_0x591e75,_0x51a828,_0x54a225){return db[_0xdc4c('0x49')]['find']({'where':{'id':_0x591e75[_0xdc4c('0x40')]['id']}})['then'](handleEntityNotFound(_0x51a828,null))[_0xdc4c('0x20')](function(_0x2ad58f){if(_0x2ad58f){return _0x2ad58f[_0xdc4c('0x48')](_0x591e75['body'][_0xdc4c('0x4a')],_[_0xdc4c('0x4b')](_0x591e75[_0xdc4c('0x46')],['ids','id'])||{});}})[_0xdc4c('0x20')](respondWithResult(_0x51a828,null))[_0xdc4c('0x3e')](handleError(_0x51a828,null));};exports[_0xdc4c('0x4c')]=function(_0x4d888d,_0x54916e,_0x2bf0ee){var _0x2620ab={};var _0x385004={};var _0x1263fa;var _0x29ec6e;return db[_0xdc4c('0x26')][_0xdc4c('0x4d')]({'where':{'id':_0x4d888d[_0xdc4c('0x40')]['id']}})[_0xdc4c('0x20')](handleEntityNotFound(_0x54916e,null))['then'](function(_0x328da0){if(_0x328da0){_0x1263fa=_0x328da0;_0x385004[_0xdc4c('0x2b')]=_[_0xdc4c('0x2d')](db['Condition']['rawAttributes']);_0x385004['query']=_[_0xdc4c('0x2d')](_0x4d888d[_0xdc4c('0x2e')]);_0x385004[_0xdc4c('0x2f')]=_[_0xdc4c('0x30')](_0x385004['model'],_0x385004['query']);_0x2620ab['attributes']=_[_0xdc4c('0x30')](_0x385004[_0xdc4c('0x2b')],qs[_0xdc4c('0x41')](_0x4d888d['query'][_0xdc4c('0x41')]));_0x2620ab[_0xdc4c('0x31')]=_0x2620ab[_0xdc4c('0x31')][_0xdc4c('0x32')]?_0x2620ab[_0xdc4c('0x31')]:_0x385004[_0xdc4c('0x2b')];_0x2620ab[_0xdc4c('0x35')]=qs[_0xdc4c('0x36')](_0x4d888d[_0xdc4c('0x2e')][_0xdc4c('0x36')]);_0x2620ab['where']=qs[_0xdc4c('0x2f')](_[_0xdc4c('0x38')](_0x4d888d[_0xdc4c('0x2e')],_0x385004['filters']));if(_0x4d888d[_0xdc4c('0x2e')][_0xdc4c('0x39')]){_0x2620ab[_0xdc4c('0x37')]=_['merge'](_0x2620ab[_0xdc4c('0x37')],{'$or':_[_0xdc4c('0x25')](_0x2620ab[_0xdc4c('0x31')],function(_0x23da26){var _0x5e302e={};_0x5e302e[_0x23da26]={'$like':'%'+_0x4d888d[_0xdc4c('0x2e')]['filter']+'%'};return _0x5e302e;})});}_0x2620ab=_[_0xdc4c('0x42')]({},_0x2620ab,_0x4d888d['options']);return _0x1263fa['getConditions'](_0x2620ab);}})[_0xdc4c('0x20')](function(_0x6779a7){if(_0x6779a7){_0x29ec6e=_0x6779a7[_0xdc4c('0x32')];if(!_0x4d888d[_0xdc4c('0x2e')][_0xdc4c('0x4e')](_0xdc4c('0x33'))){_0x2620ab[_0xdc4c('0x18')]=qs[_0xdc4c('0x18')](_0x4d888d[_0xdc4c('0x2e')][_0xdc4c('0x18')]);_0x2620ab[_0xdc4c('0x34')]=qs['offset'](_0x4d888d[_0xdc4c('0x2e')][_0xdc4c('0x34')]);}return _0x1263fa[_0xdc4c('0x4c')](_0x2620ab);}})[_0xdc4c('0x20')](function(_0x2f0dca){if(_0x2f0dca){return _0x2f0dca?{'count':_0x29ec6e,'rows':_0x2f0dca}:null;}})['then'](respondWithResult(_0x54916e,null))[_0xdc4c('0x3e')](handleError(_0x54916e,null));};exports[_0xdc4c('0x4f')]=function(_0x2e3f05,_0x332462,_0x5c8f3f){return db[_0xdc4c('0x50')][_0xdc4c('0x44')]({'where':{'id':_0x2e3f05['params']['id']}})['then'](handleEntityNotFound(_0x332462,null))[_0xdc4c('0x20')](function(_0x33a50e){if(_0x33a50e){return _0x33a50e[_0xdc4c('0x4f')](_0x2e3f05[_0xdc4c('0x46')]['ids'],_[_0xdc4c('0x4b')](_0x2e3f05['body'],[_0xdc4c('0x4a'),'id'])||{});}})[_0xdc4c('0x20')](respondWithResult(_0x332462,null))[_0xdc4c('0x3e')](handleError(_0x332462,null));};exports['getActions']=function(_0x436b92,_0x5163ce,_0x1ed7a2){var _0x540781={};var _0x2411d3={};var _0x302899;var _0x59336c;return db[_0xdc4c('0x26')][_0xdc4c('0x4d')]({'where':{'id':_0x436b92[_0xdc4c('0x40')]['id']}})[_0xdc4c('0x20')](handleEntityNotFound(_0x5163ce,null))[_0xdc4c('0x20')](function(_0x530fde){if(_0x530fde){_0x302899=_0x530fde;_0x2411d3[_0xdc4c('0x2b')]=_[_0xdc4c('0x2d')](db[_0xdc4c('0x50')][_0xdc4c('0x27')]);_0x2411d3[_0xdc4c('0x2e')]=_[_0xdc4c('0x2d')](_0x436b92[_0xdc4c('0x2e')]);_0x2411d3['filters']=_[_0xdc4c('0x30')](_0x2411d3[_0xdc4c('0x2b')],_0x2411d3[_0xdc4c('0x2e')]);_0x540781[_0xdc4c('0x31')]=_[_0xdc4c('0x30')](_0x2411d3[_0xdc4c('0x2b')],qs[_0xdc4c('0x41')](_0x436b92[_0xdc4c('0x2e')]['fields']));_0x540781[_0xdc4c('0x31')]=_0x540781[_0xdc4c('0x31')][_0xdc4c('0x32')]?_0x540781[_0xdc4c('0x31')]:_0x2411d3[_0xdc4c('0x2b')];_0x540781[_0xdc4c('0x35')]=qs[_0xdc4c('0x36')](_0x436b92[_0xdc4c('0x2e')][_0xdc4c('0x36')]);_0x540781[_0xdc4c('0x37')]=qs['filters'](_['pick'](_0x436b92[_0xdc4c('0x2e')],_0x2411d3['filters']));if(_0x436b92['query'][_0xdc4c('0x39')]){_0x540781[_0xdc4c('0x37')]=_[_0xdc4c('0x42')](_0x540781[_0xdc4c('0x37')],{'$or':_[_0xdc4c('0x25')](_0x540781['attributes'],function(_0x661ce8){var _0x236194={};_0x236194[_0x661ce8]={'$like':'%'+_0x436b92[_0xdc4c('0x2e')][_0xdc4c('0x39')]+'%'};return _0x236194;})});}_0x540781=_['merge']({},_0x540781,_0x436b92[_0xdc4c('0x43')]);return _0x302899[_0xdc4c('0x51')](_0x540781);}})[_0xdc4c('0x20')](function(_0x24c336){if(_0x24c336){_0x59336c=_0x24c336[_0xdc4c('0x32')];if(!_0x436b92[_0xdc4c('0x2e')]['hasOwnProperty'](_0xdc4c('0x33'))){_0x540781['limit']=qs[_0xdc4c('0x18')](_0x436b92['query'][_0xdc4c('0x18')]);_0x540781['offset']=qs[_0xdc4c('0x34')](_0x436b92['query'][_0xdc4c('0x34')]);}return _0x302899[_0xdc4c('0x51')](_0x540781);}})[_0xdc4c('0x20')](function(_0x10021f){if(_0x10021f){return _0x10021f?{'count':_0x59336c,'rows':_0x10021f}:null;}})['then'](respondWithResult(_0x5163ce,null))[_0xdc4c('0x3e')](handleError(_0x5163ce,null));}; \ No newline at end of file +var _0x6186=['querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','end','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','Automation','includeAll','findAll','rows','catch','show','params','length','find','create','body','addConditions','Condition','ids','omit','findOne','getConditions','addActions','Action','getActions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','jsforce','desk.js'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x6186,0xa1));var _0x6618=function(_0x2ceba7,_0x451ce4){_0x2ceba7=_0x2ceba7-0x0;var _0x5348eb=_0x6186[_0x2ceba7];return _0x5348eb;};'use strict';var emlformat=require(_0x6618('0x0'));var rimraf=require(_0x6618('0x1'));var zipdir=require(_0x6618('0x2'));var jsonpatch=require(_0x6618('0x3'));var rp=require(_0x6618('0x4'));var moment=require(_0x6618('0x5'));var BPromise=require(_0x6618('0x6'));var Mustache=require(_0x6618('0x7'));var util=require('util');var path=require(_0x6618('0x8'));var sox=require(_0x6618('0x9'));var csv=require(_0x6618('0xa'));var ejs=require(_0x6618('0xb'));var fs=require('fs');var fs_extra=require(_0x6618('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x6618('0xd'));var deskjs=require(_0x6618('0xe'));var toCsv=require(_0x6618('0xa'));var querystring=require(_0x6618('0xf'));var Papa=require('papaparse');var Redis=require(_0x6618('0x10'));var authService=require(_0x6618('0x11'));var qs=require(_0x6618('0x12'));var as=require(_0x6618('0x13'));var hardwareService=require(_0x6618('0x14'));var logger=require(_0x6618('0x15'))(_0x6618('0x16'));var utils=require(_0x6618('0x17'));var config=require(_0x6618('0x18'));var licenseUtil=require(_0x6618('0x19'));var db=require(_0x6618('0x1a'))['db'];function respondWithStatusCode(_0x391d4e,_0x15ee30){_0x15ee30=_0x15ee30||0xcc;return function(_0x3867b4){if(_0x3867b4){return _0x391d4e[_0x6618('0x1b')](_0x15ee30);}return _0x391d4e[_0x6618('0x1c')](_0x15ee30)['end']();};}function respondWithResult(_0x332339,_0x30f82f){_0x30f82f=_0x30f82f||0xc8;return function(_0x43adb1){if(_0x43adb1){return _0x332339[_0x6618('0x1c')](_0x30f82f)[_0x6618('0x1d')](_0x43adb1);}};}function respondWithFilteredResult(_0x295293,_0x3a1e73){return function(_0x165cc2){if(_0x165cc2){var _0x3d8151=typeof _0x3a1e73[_0x6618('0x1e')]===_0x6618('0x1f')&&typeof _0x3a1e73[_0x6618('0x20')]===_0x6618('0x1f');var _0x65c83b=_0x165cc2[_0x6618('0x21')];var _0x3603f5=_0x3d8151?0x0:_0x3a1e73[_0x6618('0x1e')];var _0x2f5364=_0x3d8151?_0x165cc2[_0x6618('0x21')]:_0x3a1e73[_0x6618('0x1e')]+_0x3a1e73[_0x6618('0x20')];var _0x4d1e2d;if(_0x2f5364>=_0x65c83b){_0x2f5364=_0x65c83b;_0x4d1e2d=0xc8;}else{_0x4d1e2d=0xce;}_0x295293[_0x6618('0x1c')](_0x4d1e2d);return _0x295293[_0x6618('0x22')](_0x6618('0x23'),_0x3603f5+'-'+_0x2f5364+'/'+_0x65c83b)[_0x6618('0x1d')](_0x165cc2);}return null;};}function patchUpdates(_0x25c541){return function(_0x411885){try{jsonpatch[_0x6618('0x24')](_0x411885,_0x25c541,!![]);}catch(_0x540e97){return BPromise[_0x6618('0x25')](_0x540e97);}return _0x411885[_0x6618('0x26')]();};}function saveUpdates(_0x29c2ca,_0x1cebdf){return function(_0x2d5f37){if(_0x2d5f37){return _0x2d5f37[_0x6618('0x27')](_0x29c2ca)[_0x6618('0x28')](function(_0x278ac9){return _0x278ac9;});}return null;};}function removeEntity(_0x29da8b,_0x4aa963){return function(_0x180489){if(_0x180489){return _0x180489[_0x6618('0x29')]()['then'](function(){_0x29da8b[_0x6618('0x1c')](0xcc)[_0x6618('0x2a')]();});}};}function handleEntityNotFound(_0x284261,_0x36a433){return function(_0x414b28){if(!_0x414b28){_0x284261[_0x6618('0x1b')](0x194);}return _0x414b28;};}function handleError(_0x4b614e,_0x963d2b){_0x963d2b=_0x963d2b||0x1f4;return function(_0x38b7a2){logger['error'](_0x38b7a2[_0x6618('0x2b')]);if(_0x38b7a2['name']){delete _0x38b7a2[_0x6618('0x2c')];}_0x4b614e[_0x6618('0x1c')](_0x963d2b)[_0x6618('0x2d')](_0x38b7a2);};}exports[_0x6618('0x2e')]=function(_0x68eb6b,_0x3a960d){var _0x8c7444={},_0x47e6e5={},_0x460d6d={'count':0x0,'rows':[]};var _0x20d4f7=_[_0x6618('0x2f')](db['Automation'][_0x6618('0x30')],function(_0x351c43){return{'name':_0x351c43[_0x6618('0x31')],'type':_0x351c43[_0x6618('0x32')]['key']};});_0x47e6e5[_0x6618('0x33')]=_['map'](_0x20d4f7,_0x6618('0x2c'));_0x47e6e5[_0x6618('0x34')]=_[_0x6618('0x35')](_0x68eb6b[_0x6618('0x34')]);_0x47e6e5[_0x6618('0x36')]=_[_0x6618('0x37')](_0x47e6e5[_0x6618('0x33')],_0x47e6e5[_0x6618('0x34')]);_0x8c7444[_0x6618('0x38')]=_[_0x6618('0x37')](_0x47e6e5[_0x6618('0x33')],qs[_0x6618('0x39')](_0x68eb6b['query']['fields']));_0x8c7444['attributes']=_0x8c7444['attributes']['length']?_0x8c7444[_0x6618('0x38')]:_0x47e6e5['model'];if(!_0x68eb6b[_0x6618('0x34')][_0x6618('0x3a')](_0x6618('0x3b'))){_0x8c7444[_0x6618('0x20')]=qs[_0x6618('0x20')](_0x68eb6b[_0x6618('0x34')][_0x6618('0x20')]);_0x8c7444['offset']=qs[_0x6618('0x1e')](_0x68eb6b[_0x6618('0x34')][_0x6618('0x1e')]);}_0x8c7444[_0x6618('0x3c')]=qs[_0x6618('0x3d')](_0x68eb6b[_0x6618('0x34')][_0x6618('0x3d')]);_0x8c7444['where']=qs[_0x6618('0x36')](_[_0x6618('0x3e')](_0x68eb6b['query'],_0x47e6e5[_0x6618('0x36')]),_0x20d4f7);if(_0x68eb6b['query'][_0x6618('0x3f')]){_0x8c7444[_0x6618('0x40')]=_[_0x6618('0x41')](_0x8c7444['where'],{'$or':_['map'](_0x20d4f7,function(_0x3fbfa0){if(_0x3fbfa0[_0x6618('0x32')]!==_0x6618('0x42')){var _0x4e1862={};_0x4e1862[_0x3fbfa0['name']]={'$like':'%'+_0x68eb6b[_0x6618('0x34')][_0x6618('0x3f')]+'%'};return _0x4e1862;}})});}_0x8c7444=_[_0x6618('0x41')]({},_0x8c7444,_0x68eb6b[_0x6618('0x43')]);var _0x356da8={'where':_0x8c7444[_0x6618('0x40')]};return db[_0x6618('0x44')][_0x6618('0x21')](_0x356da8)[_0x6618('0x28')](function(_0x110507){_0x460d6d[_0x6618('0x21')]=_0x110507;if(_0x68eb6b[_0x6618('0x34')][_0x6618('0x45')]){_0x8c7444['include']=[{'all':!![]}];}return db[_0x6618('0x44')][_0x6618('0x46')](_0x8c7444);})['then'](function(_0x6885ce){_0x460d6d[_0x6618('0x47')]=_0x6885ce;return _0x460d6d;})[_0x6618('0x28')](respondWithFilteredResult(_0x3a960d,_0x8c7444))[_0x6618('0x48')](handleError(_0x3a960d,null));};exports[_0x6618('0x49')]=function(_0x25ac5b,_0x220725){var _0x24191d={'raw':![],'where':{'id':_0x25ac5b[_0x6618('0x4a')]['id']}},_0x58207b={};_0x58207b[_0x6618('0x33')]=_[_0x6618('0x35')](db['Automation'][_0x6618('0x30')]);_0x58207b['query']=_['keys'](_0x25ac5b[_0x6618('0x34')]);_0x58207b[_0x6618('0x36')]=_[_0x6618('0x37')](_0x58207b[_0x6618('0x33')],_0x58207b['query']);_0x24191d['attributes']=_['intersection'](_0x58207b[_0x6618('0x33')],qs[_0x6618('0x39')](_0x25ac5b[_0x6618('0x34')][_0x6618('0x39')]));_0x24191d[_0x6618('0x38')]=_0x24191d[_0x6618('0x38')][_0x6618('0x4b')]?_0x24191d[_0x6618('0x38')]:_0x58207b[_0x6618('0x33')];if(_0x25ac5b[_0x6618('0x34')]['includeAll']){_0x24191d['include']=[{'all':!![]}];}_0x24191d=_[_0x6618('0x41')]({},_0x24191d,_0x25ac5b[_0x6618('0x43')]);return db[_0x6618('0x44')][_0x6618('0x4c')](_0x24191d)[_0x6618('0x28')](handleEntityNotFound(_0x220725,null))[_0x6618('0x28')](respondWithResult(_0x220725,null))['catch'](handleError(_0x220725,null));};exports['create']=function(_0x2f4b0e,_0x4c8c16){return db[_0x6618('0x44')][_0x6618('0x4d')](_0x2f4b0e['body'],{})[_0x6618('0x28')](respondWithResult(_0x4c8c16,0xc9))[_0x6618('0x48')](handleError(_0x4c8c16,null));};exports[_0x6618('0x27')]=function(_0x5da09b,_0xdfbce){if(_0x5da09b[_0x6618('0x4e')]['id']){delete _0x5da09b[_0x6618('0x4e')]['id'];}return db[_0x6618('0x44')][_0x6618('0x4c')]({'where':{'id':_0x5da09b[_0x6618('0x4a')]['id']}})['then'](handleEntityNotFound(_0xdfbce,null))[_0x6618('0x28')](saveUpdates(_0x5da09b['body'],null))[_0x6618('0x28')](respondWithResult(_0xdfbce,null))['catch'](handleError(_0xdfbce,null));};exports[_0x6618('0x29')]=function(_0x4fbe83,_0x120e36){return db['Automation'][_0x6618('0x4c')]({'where':{'id':_0x4fbe83[_0x6618('0x4a')]['id']}})[_0x6618('0x28')](handleEntityNotFound(_0x120e36,null))['then'](removeEntity(_0x120e36,null))['catch'](handleError(_0x120e36,null));};exports[_0x6618('0x4f')]=function(_0x669ba2,_0x5588e3,_0x52d63d){return db[_0x6618('0x50')][_0x6618('0x4c')]({'where':{'id':_0x669ba2[_0x6618('0x4a')]['id']}})[_0x6618('0x28')](handleEntityNotFound(_0x5588e3,null))[_0x6618('0x28')](function(_0x369ed4){if(_0x369ed4){return _0x369ed4[_0x6618('0x4f')](_0x669ba2[_0x6618('0x4e')][_0x6618('0x51')],_[_0x6618('0x52')](_0x669ba2['body'],[_0x6618('0x51'),'id'])||{});}})[_0x6618('0x28')](respondWithResult(_0x5588e3,null))[_0x6618('0x48')](handleError(_0x5588e3,null));};exports['getConditions']=function(_0x4e5f05,_0x17d60d,_0xda6c91){var _0x5c3d61={};var _0x5a206d={};var _0x52a063;var _0x194f80;return db[_0x6618('0x44')][_0x6618('0x53')]({'where':{'id':_0x4e5f05['params']['id']}})[_0x6618('0x28')](handleEntityNotFound(_0x17d60d,null))[_0x6618('0x28')](function(_0x18d8fa){if(_0x18d8fa){_0x52a063=_0x18d8fa;_0x5a206d[_0x6618('0x33')]=_['keys'](db['Condition'][_0x6618('0x30')]);_0x5a206d[_0x6618('0x34')]=_[_0x6618('0x35')](_0x4e5f05[_0x6618('0x34')]);_0x5a206d['filters']=_[_0x6618('0x37')](_0x5a206d['model'],_0x5a206d[_0x6618('0x34')]);_0x5c3d61[_0x6618('0x38')]=_['intersection'](_0x5a206d[_0x6618('0x33')],qs['fields'](_0x4e5f05[_0x6618('0x34')][_0x6618('0x39')]));_0x5c3d61['attributes']=_0x5c3d61[_0x6618('0x38')][_0x6618('0x4b')]?_0x5c3d61[_0x6618('0x38')]:_0x5a206d[_0x6618('0x33')];_0x5c3d61['order']=qs['sort'](_0x4e5f05[_0x6618('0x34')][_0x6618('0x3d')]);_0x5c3d61[_0x6618('0x40')]=qs[_0x6618('0x36')](_[_0x6618('0x3e')](_0x4e5f05[_0x6618('0x34')],_0x5a206d[_0x6618('0x36')]));if(_0x4e5f05['query']['filter']){_0x5c3d61[_0x6618('0x40')]=_[_0x6618('0x41')](_0x5c3d61[_0x6618('0x40')],{'$or':_[_0x6618('0x2f')](_0x5c3d61['attributes'],function(_0x298179){var _0x39acda={};_0x39acda[_0x298179]={'$like':'%'+_0x4e5f05['query'][_0x6618('0x3f')]+'%'};return _0x39acda;})});}_0x5c3d61=_[_0x6618('0x41')]({},_0x5c3d61,_0x4e5f05[_0x6618('0x43')]);return _0x52a063[_0x6618('0x54')](_0x5c3d61);}})['then'](function(_0x11ef47){if(_0x11ef47){_0x194f80=_0x11ef47[_0x6618('0x4b')];if(!_0x4e5f05[_0x6618('0x34')][_0x6618('0x3a')]('nolimit')){_0x5c3d61['limit']=qs[_0x6618('0x20')](_0x4e5f05[_0x6618('0x34')][_0x6618('0x20')]);_0x5c3d61[_0x6618('0x1e')]=qs[_0x6618('0x1e')](_0x4e5f05[_0x6618('0x34')][_0x6618('0x1e')]);}return _0x52a063[_0x6618('0x54')](_0x5c3d61);}})['then'](function(_0x2c967c){if(_0x2c967c){return _0x2c967c?{'count':_0x194f80,'rows':_0x2c967c}:null;}})[_0x6618('0x28')](respondWithResult(_0x17d60d,null))[_0x6618('0x48')](handleError(_0x17d60d,null));};exports[_0x6618('0x55')]=function(_0x24d1e8,_0x76d709,_0x460d92){return db[_0x6618('0x56')][_0x6618('0x4c')]({'where':{'id':_0x24d1e8['params']['id']}})[_0x6618('0x28')](handleEntityNotFound(_0x76d709,null))[_0x6618('0x28')](function(_0x2be967){if(_0x2be967){return _0x2be967[_0x6618('0x55')](_0x24d1e8['body'][_0x6618('0x51')],_[_0x6618('0x52')](_0x24d1e8[_0x6618('0x4e')],[_0x6618('0x51'),'id'])||{});}})[_0x6618('0x28')](respondWithResult(_0x76d709,null))['catch'](handleError(_0x76d709,null));};exports[_0x6618('0x57')]=function(_0x2d8e90,_0x9e126c,_0x3a2e8b){var _0x5a3f99={};var _0x4c32d4={};var _0x58b4fc;var _0x9f9faf;return db[_0x6618('0x44')][_0x6618('0x53')]({'where':{'id':_0x2d8e90[_0x6618('0x4a')]['id']}})[_0x6618('0x28')](handleEntityNotFound(_0x9e126c,null))[_0x6618('0x28')](function(_0x59a59e){if(_0x59a59e){_0x58b4fc=_0x59a59e;_0x4c32d4[_0x6618('0x33')]=_['keys'](db[_0x6618('0x56')][_0x6618('0x30')]);_0x4c32d4[_0x6618('0x34')]=_[_0x6618('0x35')](_0x2d8e90[_0x6618('0x34')]);_0x4c32d4[_0x6618('0x36')]=_[_0x6618('0x37')](_0x4c32d4[_0x6618('0x33')],_0x4c32d4['query']);_0x5a3f99['attributes']=_[_0x6618('0x37')](_0x4c32d4[_0x6618('0x33')],qs[_0x6618('0x39')](_0x2d8e90[_0x6618('0x34')][_0x6618('0x39')]));_0x5a3f99[_0x6618('0x38')]=_0x5a3f99[_0x6618('0x38')][_0x6618('0x4b')]?_0x5a3f99['attributes']:_0x4c32d4[_0x6618('0x33')];_0x5a3f99[_0x6618('0x3c')]=qs[_0x6618('0x3d')](_0x2d8e90['query'][_0x6618('0x3d')]);_0x5a3f99[_0x6618('0x40')]=qs['filters'](_[_0x6618('0x3e')](_0x2d8e90['query'],_0x4c32d4[_0x6618('0x36')]));if(_0x2d8e90['query'][_0x6618('0x3f')]){_0x5a3f99[_0x6618('0x40')]=_[_0x6618('0x41')](_0x5a3f99[_0x6618('0x40')],{'$or':_[_0x6618('0x2f')](_0x5a3f99['attributes'],function(_0x140553){var _0x2e7b1={};_0x2e7b1[_0x140553]={'$like':'%'+_0x2d8e90[_0x6618('0x34')]['filter']+'%'};return _0x2e7b1;})});}_0x5a3f99=_[_0x6618('0x41')]({},_0x5a3f99,_0x2d8e90['options']);return _0x58b4fc[_0x6618('0x57')](_0x5a3f99);}})[_0x6618('0x28')](function(_0x3cef95){if(_0x3cef95){_0x9f9faf=_0x3cef95[_0x6618('0x4b')];if(!_0x2d8e90[_0x6618('0x34')][_0x6618('0x3a')]('nolimit')){_0x5a3f99[_0x6618('0x20')]=qs[_0x6618('0x20')](_0x2d8e90[_0x6618('0x34')][_0x6618('0x20')]);_0x5a3f99[_0x6618('0x1e')]=qs[_0x6618('0x1e')](_0x2d8e90[_0x6618('0x34')][_0x6618('0x1e')]);}return _0x58b4fc[_0x6618('0x57')](_0x5a3f99);}})[_0x6618('0x28')](function(_0x532f26){if(_0x532f26){return _0x532f26?{'count':_0x9f9faf,'rows':_0x532f26}:null;}})[_0x6618('0x28')](respondWithResult(_0x9e126c,null))[_0x6618('0x48')](handleError(_0x9e126c,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index 6d7765c..c8fb1d9 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 _0xb1d3=['bluebird','request-promise','../../config/environment','./automation.attributes','exports','define','Automation','tools_automations','util','../../config/logger','api'];(function(_0x4aa838,_0x4aa14f){var _0x3abff0=function(_0x402d55){while(--_0x402d55){_0x4aa838['push'](_0x4aa838['shift']());}};_0x3abff0(++_0x4aa14f);}(_0xb1d3,0x81));var _0x3b1d=function(_0xc724e5,_0x11fcdc){_0xc724e5=_0xc724e5-0x0;var _0x363065=_0xb1d3[_0xc724e5];return _0x363065;};'use strict';var _=require('lodash');var util=require(_0x3b1d('0x0'));var logger=require(_0x3b1d('0x1'))(_0x3b1d('0x2'));var moment=require('moment');var BPromise=require(_0x3b1d('0x3'));var rp=require(_0x3b1d('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x3b1d('0x5'));var attributes=require(_0x3b1d('0x6'));module[_0x3b1d('0x7')]=function(_0x308a19,_0xb65a78){return _0x308a19[_0x3b1d('0x8')](_0x3b1d('0x9'),attributes,{'tableName':_0x3b1d('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3709=['request-promise','path','rimraf','./automation.attributes','exports','define','Automation','tools_automations','lodash','util','../../config/logger','api','bluebird'];(function(_0x3cec8c,_0x3f6c1d){var _0x38032e=function(_0x4ef75b){while(--_0x4ef75b){_0x3cec8c['push'](_0x3cec8c['shift']());}};_0x38032e(++_0x3f6c1d);}(_0x3709,0xe5));var _0x9370=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x3709[_0x6131cd];return _0x47e916;};'use strict';var _=require(_0x9370('0x0'));var util=require(_0x9370('0x1'));var logger=require(_0x9370('0x2'))(_0x9370('0x3'));var moment=require('moment');var BPromise=require(_0x9370('0x4'));var rp=require(_0x9370('0x5'));var fs=require('fs');var path=require(_0x9370('0x6'));var rimraf=require(_0x9370('0x7'));var config=require('../../config/environment');var attributes=require(_0x9370('0x8'));module[_0x9370('0x9')]=function(_0x82ee63,_0x3ab958){return _0x82ee63[_0x9370('0xa')](_0x9370('0xb'),attributes,{'tableName':_0x9370('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 e146ede..7e97964 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 _0x3264=['jayson/promise','client','http','request','then','request\x20sent','debug','Automation,\x20%s,\x20%s,\x20%s','error','Automation,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','randomstring','../../config/utils','../../config/environment'];(function(_0x48f860,_0x495541){var _0x550734=function(_0x30f5e4){while(--_0x30f5e4){_0x48f860['push'](_0x48f860['shift']());}};_0x550734(++_0x495541);}(_0x3264,0x7f));var _0x4326=function(_0x1caf6a,_0x26a5bf){_0x1caf6a=_0x1caf6a-0x0;var _0x1bf493=_0x3264[_0x1caf6a];return _0x1bf493;};'use strict';var _=require('lodash');var util=require(_0x4326('0x0'));var moment=require(_0x4326('0x1'));var BPromise=require(_0x4326('0x2'));var rs=require(_0x4326('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x4326('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x4326('0x5'));var jayson=require(_0x4326('0x6'));var client=jayson[_0x4326('0x7')][_0x4326('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x56bcce,_0x3a7544,_0x2993a1){return new BPromise(function(_0x22071c,_0x129365){return client[_0x4326('0x9')](_0x56bcce,_0x2993a1)[_0x4326('0xa')](function(_0x1609f){logger['info']('Automation,\x20%s,\x20%s',_0x3a7544,_0x4326('0xb'));logger[_0x4326('0xc')](_0x4326('0xd'),_0x3a7544,_0x4326('0xb'),JSON['stringify'](_0x1609f));if(_0x1609f['error']){if(_0x1609f[_0x4326('0xe')]['code']===0x1f4){logger[_0x4326('0xe')](_0x4326('0xf'),_0x3a7544,_0x1609f[_0x4326('0xe')]['message']);return _0x129365(_0x1609f['error'][_0x4326('0x10')]);}logger['error']('Automation,\x20%s,\x20%s',_0x3a7544,_0x1609f[_0x4326('0xe')][_0x4326('0x10')]);return _0x22071c(_0x1609f[_0x4326('0xe')][_0x4326('0x10')]);}else{logger['info'](_0x4326('0xf'),_0x3a7544,_0x4326('0xb'));_0x22071c(_0x1609f[_0x4326('0x11')]['message']);}})[_0x4326('0x12')](function(_0x40c169){logger[_0x4326('0xe')](_0x4326('0xf'),_0x3a7544,_0x40c169);_0x129365(_0x40c169);});});} \ No newline at end of file +var _0xa958=['ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','Automation,\x20%s,\x20%s','request\x20sent','Automation,\x20%s,\x20%s,\x20%s','error','message','lodash','moment','bluebird','randomstring'];(function(_0x141a86,_0xefe6c0){var _0x5e7c1b=function(_0x276243){while(--_0x276243){_0x141a86['push'](_0x141a86['shift']());}};_0x5e7c1b(++_0xefe6c0);}(_0xa958,0x94));var _0x8a95=function(_0x5608a3,_0x5b33c5){_0x5608a3=_0x5608a3-0x0;var _0x1ed50a=_0xa958[_0x5608a3];return _0x1ed50a;};'use strict';var _=require(_0x8a95('0x0'));var util=require('util');var moment=require(_0x8a95('0x1'));var BPromise=require(_0x8a95('0x2'));var rs=require(_0x8a95('0x3'));var fs=require('fs');var Redis=require(_0x8a95('0x4'));var db=require(_0x8a95('0x5'))['db'];var utils=require(_0x8a95('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x8a95('0x7'));var jayson=require(_0x8a95('0x8'));var client=jayson[_0x8a95('0x9')][_0x8a95('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x387db4,_0xdd54e1,_0x161f00){return new BPromise(function(_0x49287d,_0xe03b31){return client[_0x8a95('0xb')](_0x387db4,_0x161f00)[_0x8a95('0xc')](function(_0x240b22){logger[_0x8a95('0xd')](_0x8a95('0xe'),_0xdd54e1,_0x8a95('0xf'));logger['debug'](_0x8a95('0x10'),_0xdd54e1,_0x8a95('0xf'),JSON['stringify'](_0x240b22));if(_0x240b22[_0x8a95('0x11')]){if(_0x240b22['error']['code']===0x1f4){logger[_0x8a95('0x11')]('Automation,\x20%s,\x20%s',_0xdd54e1,_0x240b22[_0x8a95('0x11')][_0x8a95('0x12')]);return _0xe03b31(_0x240b22['error'][_0x8a95('0x12')]);}logger[_0x8a95('0x11')]('Automation,\x20%s,\x20%s',_0xdd54e1,_0x240b22[_0x8a95('0x11')][_0x8a95('0x12')]);return _0x49287d(_0x240b22[_0x8a95('0x11')][_0x8a95('0x12')]);}else{logger[_0x8a95('0xd')](_0x8a95('0xe'),_0xdd54e1,_0x8a95('0xf'));_0x49287d(_0x240b22['result'][_0x8a95('0x12')]);}})['catch'](function(_0x334b18){logger['error'](_0x8a95('0xe'),_0xdd54e1,_0x334b18);_0xe03b31(_0x334b18);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index c0e0aad..bc2c501 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 _0x899a=['/:id/conditions','getConditions','/:id/actions','getActions','addConditions','post','addActions','put','update','delete','/:id','destroy','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show'];(function(_0x934425,_0x5af72f){var _0x31d596=function(_0x219869){while(--_0x219869){_0x934425['push'](_0x934425['shift']());}};_0x31d596(++_0x5af72f);}(_0x899a,0x1b6));var _0xa899=function(_0x582a71,_0x3594fa){_0x582a71=_0x582a71-0x0;var _0x1c0b81=_0x899a[_0x582a71];return _0x1c0b81;};'use strict';var multer=require(_0xa899('0x0'));var util=require(_0xa899('0x1'));var path=require('path');var timeout=require(_0xa899('0x2'));var express=require(_0xa899('0x3'));var router=express['Router']();var fs_extra=require(_0xa899('0x4'));var auth=require(_0xa899('0x5'));var interaction=require(_0xa899('0x6'));var config=require(_0xa899('0x7'));var controller=require('./automation.controller');router[_0xa899('0x8')]('/',auth[_0xa899('0x9')](),controller[_0xa899('0xa')]);router[_0xa899('0x8')]('/:id',auth[_0xa899('0x9')](),controller[_0xa899('0xb')]);router[_0xa899('0x8')](_0xa899('0xc'),auth[_0xa899('0x9')](),controller[_0xa899('0xd')]);router[_0xa899('0x8')](_0xa899('0xe'),auth[_0xa899('0x9')](),controller[_0xa899('0xf')]);router['post']('/',auth[_0xa899('0x9')](),controller['create']);router['post']('/:id/conditions',auth['isAuthenticated'](),controller[_0xa899('0x10')]);router[_0xa899('0x11')](_0xa899('0xe'),auth['isAuthenticated'](),controller[_0xa899('0x12')]);router[_0xa899('0x13')]('/:id',auth[_0xa899('0x9')](),controller[_0xa899('0x14')]);router[_0xa899('0x15')](_0xa899('0x16'),auth['isAuthenticated'](),controller[_0xa899('0x17')]);module[_0xa899('0x18')]=router; \ No newline at end of file +var _0x0d77=['fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/conditions','getConditions','/:id/actions','getActions','create','addConditions','post','addActions','put','update','exports','multer','util','path','express','Router'];(function(_0x392f8b,_0x121ff9){var _0x3bea2d=function(_0x25be3e){while(--_0x25be3e){_0x392f8b['push'](_0x392f8b['shift']());}};_0x3bea2d(++_0x121ff9);}(_0x0d77,0x8b));var _0x70d7=function(_0x1627ce,_0x9b92ed){_0x1627ce=_0x1627ce-0x0;var _0xb11196=_0x0d77[_0x1627ce];return _0xb11196;};'use strict';var multer=require(_0x70d7('0x0'));var util=require(_0x70d7('0x1'));var path=require(_0x70d7('0x2'));var timeout=require('connect-timeout');var express=require(_0x70d7('0x3'));var router=express[_0x70d7('0x4')]();var fs_extra=require(_0x70d7('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x70d7('0x6'));var config=require(_0x70d7('0x7'));var controller=require('./automation.controller');router[_0x70d7('0x8')]('/',auth[_0x70d7('0x9')](),controller[_0x70d7('0xa')]);router[_0x70d7('0x8')](_0x70d7('0xb'),auth['isAuthenticated'](),controller[_0x70d7('0xc')]);router['get'](_0x70d7('0xd'),auth['isAuthenticated'](),controller[_0x70d7('0xe')]);router['get'](_0x70d7('0xf'),auth[_0x70d7('0x9')](),controller[_0x70d7('0x10')]);router['post']('/',auth[_0x70d7('0x9')](),controller[_0x70d7('0x11')]);router['post']('/:id/conditions',auth[_0x70d7('0x9')](),controller[_0x70d7('0x12')]);router[_0x70d7('0x13')](_0x70d7('0xf'),auth[_0x70d7('0x9')](),controller[_0x70d7('0x14')]);router[_0x70d7('0x15')](_0x70d7('0xb'),auth[_0x70d7('0x9')](),controller[_0x70d7('0x16')]);router['delete'](_0x70d7('0xb'),auth[_0x70d7('0x9')](),controller['destroy']);module[_0x70d7('0x17')]=router; \ No newline at end of file diff --git a/server/api/campaign/campaign.attributes.js b/server/api/campaign/campaign.attributes.js index 6441ad6..025c245 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 _0x6d11=['AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','exports','STRING','ENUM','ivr','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)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','never','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Greeting','#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\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)'];(function(_0x164eca,_0x555e28){var _0x2ce562=function(_0x148ca6){while(--_0x148ca6){_0x164eca['push'](_0x164eca['shift']());}};_0x2ce562(++_0x555e28);}(_0x6d11,0xbf));var _0x16d1=function(_0xb381b2,_0x1d209f){_0xb381b2=_0xb381b2-0x0;var _0x3e24fd=_0x6d11[_0xb381b2];return _0x3e24fd;};'use strict';var Sequelize=require(_0x16d1('0x0'));module[_0x16d1('0x1')]={'name':{'type':Sequelize[_0x16d1('0x2')],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0x16d1('0x3')]('ivr'),'allowNull':![],'defaultValue':_0x16d1('0x4')},'description':{'type':Sequelize[_0x16d1('0x2')]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':'Active/Disactive\x20Campaign'},'limitCalls':{'type':Sequelize[_0x16d1('0x5')](0x4)[_0x16d1('0x6')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x16d1('0x7')},'dialOriginateCallerIdName':{'type':Sequelize[_0x16d1('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x16d1('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0x16d1('0x5')](0x3)[_0x16d1('0x6')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':'Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialCongestionMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x16d1('0x8')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x16d1('0x5')](0x5)[_0x16d1('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x16d1('0x9')},'dialBusyMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x16d1('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x16d1('0xa')},'dialBusyRetryFrequency':{'type':Sequelize[_0x16d1('0x5')](0x5)[_0x16d1('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x16d1('0xb')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x16d1('0x5')](0x3)[_0x16d1('0x6')],'defaultValue':0x3,'comment':_0x16d1('0xc')},'dialNoAnswerRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x16d1('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x16d1('0xd')},'dialGlobalMaxRetry':{'type':Sequelize[_0x16d1('0x5')](0x3)[_0x16d1('0x6')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x16d1('0xe')},'dialTimezone':{'type':Sequelize['STRING'],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x16d1('0x2')],'defaultValue':_0x16d1('0xf')},'dialCheckDuplicateType':{'type':Sequelize[_0x16d1('0x3')](_0x16d1('0x10'),_0x16d1('0x11'),_0x16d1('0x12')),'defaultValue':_0x16d1('0x10')},'dialAMDActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x16d1('0x13')},'dialAMDInitialSilence':{'type':Sequelize[_0x16d1('0x5')](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':'#AMD\x20Initial\x20Silence'},'dialAMDGreeting':{'type':Sequelize[_0x16d1('0x5')](0x9)['UNSIGNED'],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x16d1('0x14')},'dialAMDAfterGreetingSilence':{'type':Sequelize['INTEGER'](0x9)[_0x16d1('0x6')],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x16d1('0x5')](0x9)[_0x16d1('0x6')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Total\x20Analysis\x20Time'},'dialAMDMinWordLength':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x64,'validate':{'min':0x0},'comment':'#AMD\x20Min\x20Word\x20Length'},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x16d1('0x5')](0x9)['UNSIGNED'],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x16d1('0x15')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x16d1('0x5')](0x9)[_0x16d1('0x6')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x16d1('0x16')},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)[_0x16d1('0x6')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x16d1('0x17')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x16d1('0x5')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x16d1('0x18')},'dialOrderByScheduledAt':{'type':Sequelize[_0x16d1('0x3')](_0x16d1('0x19'),_0x16d1('0x1a')),'defaultValue':_0x16d1('0x19')},'dialPrefix':{'type':Sequelize[_0x16d1('0x2')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x16d1('0x5')](0x3)[_0x16d1('0x6')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x16d1('0x1b')},'dialCutDigit':{'type':Sequelize[_0x16d1('0x5')](0x3)[_0x16d1('0x6')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x16d1('0x1c')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x16d1('0x5')](0x3)[_0x16d1('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x16d1('0x1d')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x16d1('0x5')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x16d1('0x1e')},'dialDropMaxRetry':{'type':Sequelize[_0x16d1('0x5')](0x3)[_0x16d1('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Drop\x20Retry\x20(min:1,\x20max:999)'},'dialDropRetryFrequency':{'type':Sequelize[_0x16d1('0x5')](0x5)[_0x16d1('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x16d1('0x1f')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x16d1('0x5')](0x3)[_0x16d1('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x16d1('0x20')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x16d1('0x5')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x16d1('0x21')},'dialMachineMaxRetry':{'type':Sequelize[_0x16d1('0x5')](0x3)[_0x16d1('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x16d1('0x22')},'dialMachineRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x16d1('0x23')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x16d1('0x5')](0x3)[_0x16d1('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x16d1('0x24')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x16d1('0x5')](0x5)[_0x16d1('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x16d1('0x25')}}; \ No newline at end of file +var _0x1280=['NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','ENUM','always','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Maximum\x20Word\x20Length','ASC','DESC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','exports','STRING','name','ivr','BOOLEAN','Active/Disactive\x20Campaign','INTEGER','UNSIGNED','Max\x20200\x20calls.','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x1280,0x98));var _0x0128=function(_0x2bafde,_0x39326c){_0x2bafde=_0x2bafde-0x0;var _0x5733dc=_0x1280[_0x2bafde];return _0x5733dc;};'use strict';var Sequelize=require(_0x0128('0x0'));module[_0x0128('0x1')]={'name':{'type':Sequelize[_0x0128('0x2')],'unique':_0x0128('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize['ENUM'](_0x0128('0x4')),'allowNull':![],'defaultValue':_0x0128('0x4')},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0x0128('0x5')],'defaultValue':0x0,'comment':_0x0128('0x6')},'limitCalls':{'type':Sequelize[_0x0128('0x7')](0x4)[_0x0128('0x8')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x0128('0x9')},'dialOriginateCallerIdName':{'type':Sequelize[_0x0128('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize[_0x0128('0x7')](0x3)[_0x0128('0x8')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':'Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialCongestionMaxRetry':{'type':Sequelize[_0x0128('0x7')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize[_0x0128('0x7')](0x5)[_0x0128('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0128('0xa')},'dialBusyMaxRetry':{'type':Sequelize[_0x0128('0x7')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0128('0xb')},'dialBusyRetryFrequency':{'type':Sequelize[_0x0128('0x7')](0x5)[_0x0128('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x0128('0x8')],'defaultValue':0x3,'comment':_0x0128('0xc')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x0128('0x7')](0x5)[_0x0128('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0128('0xd')},'dialGlobalMaxRetry':{'type':Sequelize[_0x0128('0x7')](0x3)['UNSIGNED'],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':'#Global\x20Max\x20Retry\x20(min:1,\x20max:999)'},'dialTimezone':{'type':Sequelize[_0x0128('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x0128('0x2')],'defaultValue':'07:00-22:00,*,*,*'},'dialCheckDuplicateType':{'type':Sequelize[_0x0128('0xe')](_0x0128('0xf'),'never',_0x0128('0x10')),'defaultValue':'always'},'dialAMDActive':{'type':Sequelize[_0x0128('0x5')],'defaultValue':0x0,'comment':_0x0128('0x11')},'dialAMDInitialSilence':{'type':Sequelize[_0x0128('0x7')](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':'#AMD\x20Initial\x20Silence'},'dialAMDGreeting':{'type':Sequelize[_0x0128('0x7')](0x9)[_0x0128('0x8')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x0128('0x12')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x0128('0x7')](0x9)[_0x0128('0x8')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x0128('0x13')},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x0128('0x14')},'dialAMDMinWordLength':{'type':Sequelize[_0x0128('0x7')](0x9)[_0x0128('0x8')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x0128('0x15')},'dialAMDBetweenWordsSilence':{'type':Sequelize['INTEGER'](0x9)[_0x0128('0x8')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x0128('0x16')},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x0128('0x17')},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':'#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'},'dialAMDMaximumWordLength':{'type':Sequelize[_0x0128('0x7')](0x9)[_0x0128('0x8')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x0128('0x18')},'dialOrderByScheduledAt':{'type':Sequelize['ENUM']('DESC',_0x0128('0x19')),'defaultValue':_0x0128('0x1a')},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)[_0x0128('0x8')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x0128('0x1b')},'dialCutDigit':{'type':Sequelize[_0x0128('0x7')](0x3)[_0x0128('0x8')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x0128('0x7')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0128('0x1c')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0128('0x1d')},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x0128('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Drop\x20Retry\x20(min:1,\x20max:999)'},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAbandonedMaxRetry':{'type':Sequelize[_0x0128('0x7')](0x3)[_0x0128('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0128('0x1e')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x0128('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x0128('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize[_0x0128('0x7')](0x5)[_0x0128('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0128('0x1f')},'dialAgentRejectMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x0128('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#AgentReject\x20Retry\x20(min:1,\x20max:999)'},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x0128('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0128('0x20')}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index 1d69b59..b4688e7 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 _0x1c8a=['cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','select','COALESCE(phone,\x27\x27)','onlyIfOpen','fromQuery','ContactId','NOW()','CmListId','cm_hopper_additional_phones','cmHopperId','OrderBy','h.id','ci.item','ci.OrderBY','h.ContactId\x20=\x20ci.CmContactId','h.createdAt\x20=\x20?','sequelize','push','all','removeLists','getBlackLists','addBlackLists','spread','cm_hopper_black','removeBlackLists','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','get','IvrCampaigns','error','stack','send','map','rawAttributes','fieldName','type','key','model','name','query','keys','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','filters','merge','VIRTUAL','filter','options','Campaign','include','findAll','catch','show','params','length','includeAll','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','userProfileId','getHoppers','findOne','CmHopper','pick','CampaignId','rows','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','CmList','addLists','format','ids','dialCheckDuplicateType','always','insert','into','cm_hopper','phone','ListId','field','scheduledAt','toString','from'];(function(_0x16eb3d,_0x157803){var _0x31612a=function(_0xedbb00){while(--_0xedbb00){_0x16eb3d['push'](_0x16eb3d['shift']());}};_0x31612a(++_0x157803);}(_0x1c8a,0x140));var _0xa1c8=function(_0x47dd29,_0x5a47a8){_0x47dd29=_0x47dd29-0x0;var _0x5c1eab=_0x1c8a[_0x47dd29];return _0x5c1eab;};'use strict';var emlformat=require(_0xa1c8('0x0'));var rimraf=require(_0xa1c8('0x1'));var zipdir=require(_0xa1c8('0x2'));var jsonpatch=require(_0xa1c8('0x3'));var rp=require(_0xa1c8('0x4'));var moment=require('moment');var BPromise=require(_0xa1c8('0x5'));var Mustache=require('mustache');var util=require(_0xa1c8('0x6'));var path=require(_0xa1c8('0x7'));var sox=require(_0xa1c8('0x8'));var csv=require('to-csv');var ejs=require(_0xa1c8('0x9'));var fs=require('fs');var fs_extra=require(_0xa1c8('0xa'));var _=require(_0xa1c8('0xb'));var squel=require('squel');var crypto=require(_0xa1c8('0xc'));var jsforce=require(_0xa1c8('0xd'));var deskjs=require(_0xa1c8('0xe'));var toCsv=require('to-csv');var querystring=require(_0xa1c8('0xf'));var Papa=require(_0xa1c8('0x10'));var Redis=require(_0xa1c8('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xa1c8('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa1c8('0x13'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xa1c8('0x14'));var db=require(_0xa1c8('0x15'))['db'];function respondWithStatusCode(_0x2647fa,_0x707249){_0x707249=_0x707249||0xcc;return function(_0x644e9c){if(_0x644e9c){return _0x2647fa[_0xa1c8('0x16')](_0x707249);}return _0x2647fa['status'](_0x707249)[_0xa1c8('0x17')]();};}function respondWithResult(_0x282525,_0xcccc7b){_0xcccc7b=_0xcccc7b||0xc8;return function(_0x3797fe){if(_0x3797fe){return _0x282525[_0xa1c8('0x18')](_0xcccc7b)[_0xa1c8('0x19')](_0x3797fe);}};}function respondWithFilteredResult(_0x517130,_0x7f1128){return function(_0x51b1c3){if(_0x51b1c3){var _0x17d4d2=typeof _0x7f1128[_0xa1c8('0x1a')]===_0xa1c8('0x1b')&&typeof _0x7f1128['limit']===_0xa1c8('0x1b');var _0x59284a=_0x51b1c3['count'];var _0x1fe87f=_0x17d4d2?0x0:_0x7f1128[_0xa1c8('0x1a')];var _0x57fe23=_0x17d4d2?_0x51b1c3[_0xa1c8('0x1c')]:_0x7f1128[_0xa1c8('0x1a')]+_0x7f1128[_0xa1c8('0x1d')];var _0x4e967e;if(_0x57fe23>=_0x59284a){_0x57fe23=_0x59284a;_0x4e967e=0xc8;}else{_0x4e967e=0xce;}_0x517130[_0xa1c8('0x18')](_0x4e967e);return _0x517130[_0xa1c8('0x1e')](_0xa1c8('0x1f'),_0x1fe87f+'-'+_0x57fe23+'/'+_0x59284a)['json'](_0x51b1c3);}return null;};}function patchUpdates(_0x2eabb2){return function(_0x874b1f){try{jsonpatch['apply'](_0x874b1f,_0x2eabb2,!![]);}catch(_0x38008a){return BPromise[_0xa1c8('0x20')](_0x38008a);}return _0x874b1f[_0xa1c8('0x21')]();};}function saveUpdates(_0x2a7fa5,_0x19fe5a){return function(_0x23ff11){if(_0x23ff11){return _0x23ff11[_0xa1c8('0x22')](_0x2a7fa5)[_0xa1c8('0x23')](function(_0x40bb1d){return _0x40bb1d;});}return null;};}function removeEntity(_0x193077,_0x28473c){return function(_0x125047){if(_0x125047){return _0x125047[_0xa1c8('0x24')]()[_0xa1c8('0x23')](function(){var _0x3f929f=_0x125047[_0xa1c8('0x25')]({'plain':!![]});var _0x572362=_0xa1c8('0x26');return db['UserProfileResource'][_0xa1c8('0x24')]({'where':{'type':_0x572362,'resourceId':_0x3f929f['id']}})['then'](function(){return _0x125047;});})[_0xa1c8('0x23')](function(){_0x193077[_0xa1c8('0x18')](0xcc)[_0xa1c8('0x17')]();});}};}function handleEntityNotFound(_0x4eb627,_0x305148){return function(_0x914018){if(!_0x914018){_0x4eb627[_0xa1c8('0x16')](0x194);}return _0x914018;};}function handleError(_0xa067ae,_0x5d756d){_0x5d756d=_0x5d756d||0x1f4;return function(_0x23131b){logger[_0xa1c8('0x27')](_0x23131b[_0xa1c8('0x28')]);if(_0x23131b['name']){delete _0x23131b['name'];}_0xa067ae[_0xa1c8('0x18')](_0x5d756d)[_0xa1c8('0x29')](_0x23131b);};}exports['index']=function(_0x348356,_0x42326b){var _0xeadfdd={},_0x560b55={},_0x4bd7cf={'count':0x0,'rows':[]};var _0x5c78eb=_[_0xa1c8('0x2a')](db['Campaign'][_0xa1c8('0x2b')],function(_0x2cee8b){return{'name':_0x2cee8b[_0xa1c8('0x2c')],'type':_0x2cee8b[_0xa1c8('0x2d')][_0xa1c8('0x2e')]};});_0x560b55[_0xa1c8('0x2f')]=_['map'](_0x5c78eb,_0xa1c8('0x30'));_0x560b55[_0xa1c8('0x31')]=_[_0xa1c8('0x32')](_0x348356[_0xa1c8('0x31')]);_0x560b55['filters']=_['intersection'](_0x560b55[_0xa1c8('0x2f')],_0x560b55['query']);_0xeadfdd[_0xa1c8('0x33')]=_[_0xa1c8('0x34')](_0x560b55[_0xa1c8('0x2f')],qs[_0xa1c8('0x35')](_0x348356[_0xa1c8('0x31')][_0xa1c8('0x35')]));_0xeadfdd[_0xa1c8('0x33')]=_0xeadfdd[_0xa1c8('0x33')]['length']?_0xeadfdd[_0xa1c8('0x33')]:_0x560b55[_0xa1c8('0x2f')];if(!_0x348356[_0xa1c8('0x31')][_0xa1c8('0x36')](_0xa1c8('0x37'))){_0xeadfdd[_0xa1c8('0x1d')]=qs[_0xa1c8('0x1d')](_0x348356[_0xa1c8('0x31')][_0xa1c8('0x1d')]);_0xeadfdd[_0xa1c8('0x1a')]=qs[_0xa1c8('0x1a')](_0x348356[_0xa1c8('0x31')][_0xa1c8('0x1a')]);}_0xeadfdd[_0xa1c8('0x38')]=qs['sort'](_0x348356['query'][_0xa1c8('0x39')]);_0xeadfdd[_0xa1c8('0x3a')]=qs[_0xa1c8('0x3b')](_['pick'](_0x348356['query'],_0x560b55['filters']),_0x5c78eb);if(_0x348356[_0xa1c8('0x31')]['filter']){_0xeadfdd['where']=_[_0xa1c8('0x3c')](_0xeadfdd[_0xa1c8('0x3a')],{'$or':_[_0xa1c8('0x2a')](_0x5c78eb,function(_0x4d3899){if(_0x4d3899[_0xa1c8('0x2d')]!==_0xa1c8('0x3d')){var _0x585ba2={};_0x585ba2[_0x4d3899[_0xa1c8('0x30')]]={'$like':'%'+_0x348356[_0xa1c8('0x31')][_0xa1c8('0x3e')]+'%'};return _0x585ba2;}})});}_0xeadfdd=_['merge']({},_0xeadfdd,_0x348356[_0xa1c8('0x3f')]);var _0x947616={'where':_0xeadfdd[_0xa1c8('0x3a')]};return db[_0xa1c8('0x40')][_0xa1c8('0x1c')](_0x947616)['then'](function(_0x52aea5){_0x4bd7cf['count']=_0x52aea5;if(_0x348356['query']['includeAll']){_0xeadfdd[_0xa1c8('0x41')]=[{'all':!![]}];}return db[_0xa1c8('0x40')][_0xa1c8('0x42')](_0xeadfdd);})[_0xa1c8('0x23')](function(_0x3a5cd4){_0x4bd7cf['rows']=_0x3a5cd4;return _0x4bd7cf;})['then'](respondWithFilteredResult(_0x42326b,_0xeadfdd))[_0xa1c8('0x43')](handleError(_0x42326b,null));};exports[_0xa1c8('0x44')]=function(_0x1b0fad,_0x4d6e10){var _0x55d0e0={'raw':![],'where':{'id':_0x1b0fad[_0xa1c8('0x45')]['id']}},_0x45a913={};_0x45a913[_0xa1c8('0x2f')]=_[_0xa1c8('0x32')](db[_0xa1c8('0x40')][_0xa1c8('0x2b')]);_0x45a913[_0xa1c8('0x31')]=_['keys'](_0x1b0fad[_0xa1c8('0x31')]);_0x45a913['filters']=_[_0xa1c8('0x34')](_0x45a913[_0xa1c8('0x2f')],_0x45a913[_0xa1c8('0x31')]);_0x55d0e0['attributes']=_[_0xa1c8('0x34')](_0x45a913['model'],qs[_0xa1c8('0x35')](_0x1b0fad[_0xa1c8('0x31')][_0xa1c8('0x35')]));_0x55d0e0['attributes']=_0x55d0e0[_0xa1c8('0x33')][_0xa1c8('0x46')]?_0x55d0e0['attributes']:_0x45a913[_0xa1c8('0x2f')];if(_0x1b0fad[_0xa1c8('0x31')][_0xa1c8('0x47')]){_0x55d0e0[_0xa1c8('0x41')]=[{'all':!![]}];}_0x55d0e0=_[_0xa1c8('0x3c')]({},_0x55d0e0,_0x1b0fad[_0xa1c8('0x3f')]);return db[_0xa1c8('0x40')][_0xa1c8('0x48')](_0x55d0e0)[_0xa1c8('0x23')](handleEntityNotFound(_0x4d6e10,null))['then'](respondWithResult(_0x4d6e10,null))[_0xa1c8('0x43')](handleError(_0x4d6e10,null));};exports[_0xa1c8('0x49')]=function(_0x470479,_0xf29fc){return db['Campaign'][_0xa1c8('0x49')](_0x470479[_0xa1c8('0x4a')],{})[_0xa1c8('0x23')](function(_0x44580d){var _0x364b57=_0x470479['user'][_0xa1c8('0x25')]({'plain':!![]});if(!_0x364b57)throw new Error(_0xa1c8('0x4b'));if(_0x364b57[_0xa1c8('0x4c')]===_0xa1c8('0x4d')){var _0x14ce13=_0x44580d['get']({'plain':!![]});var _0x5bbef3=_0xa1c8('0x26');return db[_0xa1c8('0x4e')][_0xa1c8('0x48')]({'where':{'name':_0x5bbef3,'userProfileId':_0x364b57['userProfileId']},'raw':!![]})[_0xa1c8('0x23')](function(_0x475590){if(_0x475590&&_0x475590[_0xa1c8('0x4f')]===0x0){return db[_0xa1c8('0x50')][_0xa1c8('0x49')]({'name':_0x14ce13[_0xa1c8('0x30')],'resourceId':_0x14ce13['id'],'type':_0x475590[_0xa1c8('0x30')],'sectionId':_0x475590['id']},{})[_0xa1c8('0x23')](function(){return _0x44580d;});}else{return _0x44580d;}})[_0xa1c8('0x43')](function(_0xf13fa3){logger[_0xa1c8('0x27')](_0xa1c8('0x51'),_0xf13fa3);throw _0xf13fa3;});}return _0x44580d;})[_0xa1c8('0x23')](respondWithResult(_0xf29fc,0xc9))['catch'](handleError(_0xf29fc,null));};exports[_0xa1c8('0x52')]=function(_0x1a117a,_0x3fb365){var _0x3d35b4={'where':{'id':_0x1a117a[_0xa1c8('0x45')]['id']}},_0x56a38d={};_0x56a38d[_0xa1c8('0x2f')]=_[_0xa1c8('0x32')](db['Campaign'][_0xa1c8('0x2b')]);_0x3d35b4[_0xa1c8('0x33')]=_[_0xa1c8('0x34')](_0x56a38d[_0xa1c8('0x2f')],qs['fields'](_0x1a117a['query'][_0xa1c8('0x35')]));_0x3d35b4['attributes']=_0x3d35b4[_0xa1c8('0x33')][_0xa1c8('0x46')]?_0x3d35b4[_0xa1c8('0x33')]:_0x56a38d[_0xa1c8('0x2f')];if(_0x1a117a[_0xa1c8('0x31')][_0xa1c8('0x47')]){_0x3d35b4['include']=[{'all':!![]}];}_0x3d35b4=_[_0xa1c8('0x3c')]({},_0x3d35b4,_0x1a117a['options']);return db[_0xa1c8('0x40')]['find'](_0x3d35b4)[_0xa1c8('0x23')](handleEntityNotFound(_0x3fb365,null))[_0xa1c8('0x23')](function(_0x437ca8){if(_0x437ca8){var _0x1ccdd9=_0x437ca8['get']({'plain':!![]});_0x1ccdd9=qs[_0xa1c8('0x53')](_0x1ccdd9,['id',_0xa1c8('0x54'),_0xa1c8('0x55')]);_0x1a117a[_0xa1c8('0x4a')]=_[_0xa1c8('0x53')](_0x1a117a['body'],['id','createdAt',_0xa1c8('0x55')]);return db[_0xa1c8('0x40')]['create'](_[_0xa1c8('0x3c')](_0x1ccdd9,_0x1a117a['body']),{'include':_0x1a117a['query']['includeAll']?[{'all':!![]}]:undefined})[_0xa1c8('0x23')](function(_0x4df225){var _0x529182=_0x1a117a[_0xa1c8('0x4d')]['get']({'plain':!![]});if(!_0x529182)throw new Error(_0xa1c8('0x4b'));if(_0x529182['role']==='user'){var _0x419bbe=_0x4df225[_0xa1c8('0x25')]({'plain':!![]});var _0x2722a7='IvrCampaigns';return db[_0xa1c8('0x4e')][_0xa1c8('0x48')]({'where':{'name':_0x2722a7,'userProfileId':_0x529182[_0xa1c8('0x56')]},'raw':!![]})['then'](function(_0x458579){if(_0x458579&&_0x458579[_0xa1c8('0x4f')]===0x0){return db['UserProfileResource'][_0xa1c8('0x49')]({'name':_0x419bbe[_0xa1c8('0x30')],'resourceId':_0x419bbe['id'],'type':_0x458579[_0xa1c8('0x30')],'sectionId':_0x458579['id']},{})['then'](function(){return _0x4df225;});}else{return _0x4df225;}})[_0xa1c8('0x43')](function(_0x98355b){logger['error'](_0xa1c8('0x51'),_0x98355b);throw _0x98355b;});}return _0x4df225;});}})['then'](respondWithResult(_0x3fb365,0xc9))[_0xa1c8('0x43')](handleError(_0x3fb365,null));};exports['update']=function(_0x125cfb,_0x2938ed){if(_0x125cfb[_0xa1c8('0x4a')]['id']){delete _0x125cfb[_0xa1c8('0x4a')]['id'];}return db[_0xa1c8('0x40')][_0xa1c8('0x48')]({'where':{'id':_0x125cfb[_0xa1c8('0x45')]['id']}})[_0xa1c8('0x23')](handleEntityNotFound(_0x2938ed,null))['then'](saveUpdates(_0x125cfb[_0xa1c8('0x4a')],null))[_0xa1c8('0x23')](respondWithResult(_0x2938ed,null))[_0xa1c8('0x43')](handleError(_0x2938ed,null));};exports[_0xa1c8('0x24')]=function(_0xbe6d30,_0x809ee3){return db[_0xa1c8('0x40')][_0xa1c8('0x48')]({'where':{'id':_0xbe6d30[_0xa1c8('0x45')]['id']}})[_0xa1c8('0x23')](handleEntityNotFound(_0x809ee3,null))[_0xa1c8('0x23')](removeEntity(_0x809ee3,null))[_0xa1c8('0x43')](handleError(_0x809ee3,null));};exports[_0xa1c8('0x57')]=function(_0x42e30c,_0x2c62b2,_0x15321d){var _0x3dee79={'raw':!![],'where':{}};var _0x1630bc={};var _0x376f19={'count':0x0,'rows':[]};return db[_0xa1c8('0x40')][_0xa1c8('0x58')]({'where':{'id':_0x42e30c[_0xa1c8('0x45')]['id']}})[_0xa1c8('0x23')](handleEntityNotFound(_0x2c62b2,null))[_0xa1c8('0x23')](function(_0x7bce81){if(_0x7bce81){_0x1630bc['model']=_[_0xa1c8('0x32')](db[_0xa1c8('0x59')][_0xa1c8('0x2b')]);_0x1630bc[_0xa1c8('0x31')]=_['keys'](_0x42e30c[_0xa1c8('0x31')]);_0x1630bc['filters']=_[_0xa1c8('0x34')](_0x1630bc[_0xa1c8('0x2f')],_0x1630bc[_0xa1c8('0x31')]);_0x3dee79[_0xa1c8('0x33')]=_[_0xa1c8('0x34')](_0x1630bc[_0xa1c8('0x2f')],qs[_0xa1c8('0x35')](_0x42e30c[_0xa1c8('0x31')][_0xa1c8('0x35')]));_0x3dee79[_0xa1c8('0x33')]=_0x3dee79['attributes'][_0xa1c8('0x46')]?_0x3dee79[_0xa1c8('0x33')]:_0x1630bc[_0xa1c8('0x2f')];if(!_0x42e30c[_0xa1c8('0x31')][_0xa1c8('0x36')](_0xa1c8('0x37'))){_0x3dee79[_0xa1c8('0x1d')]=qs[_0xa1c8('0x1d')](_0x42e30c[_0xa1c8('0x31')]['limit']);_0x3dee79['offset']=qs[_0xa1c8('0x1a')](_0x42e30c[_0xa1c8('0x31')]['offset']);}_0x3dee79[_0xa1c8('0x38')]=qs['sort'](_0x42e30c['query'][_0xa1c8('0x39')]);_0x3dee79['where']=qs[_0xa1c8('0x3b')](_[_0xa1c8('0x5a')](_0x42e30c['query'],_0x1630bc['filters']));_0x3dee79[_0xa1c8('0x3a')][_0xa1c8('0x5b')]=_0x7bce81['id'];if(_0x42e30c['query']['filter']){_0x3dee79[_0xa1c8('0x3a')]=_[_0xa1c8('0x3c')](_0x3dee79[_0xa1c8('0x3a')],{'$or':_[_0xa1c8('0x2a')](_0x3dee79[_0xa1c8('0x33')],function(_0xaecf67){var _0x2c0a57={};_0x2c0a57[_0xaecf67]={'$like':'%'+_0x42e30c['query'][_0xa1c8('0x3e')]+'%'};return _0x2c0a57;})});}_0x3dee79=_[_0xa1c8('0x3c')]({},_0x3dee79,_0x42e30c[_0xa1c8('0x3f')]);return db[_0xa1c8('0x59')][_0xa1c8('0x1c')]({'where':_0x3dee79[_0xa1c8('0x3a')]})[_0xa1c8('0x23')](function(_0x15c664){_0x376f19[_0xa1c8('0x1c')]=_0x15c664;if(_0x42e30c[_0xa1c8('0x31')][_0xa1c8('0x47')]){_0x3dee79['include']=[{'all':!![]}];}return db['CmHopper'][_0xa1c8('0x42')](_0x3dee79);})[_0xa1c8('0x23')](function(_0x557dc3){_0x376f19[_0xa1c8('0x5c')]=_0x557dc3;return _0x376f19;});}})['then'](respondWithFilteredResult(_0x2c62b2,_0x3dee79))[_0xa1c8('0x43')](handleError(_0x2c62b2,null));};exports[_0xa1c8('0x5d')]=function(_0x54f3b9,_0x31c23f,_0x9397e7){var _0x467372={'raw':!![],'where':{}};var _0x36d508={};var _0x3bb064={'count':0x0,'rows':[]};return db[_0xa1c8('0x40')][_0xa1c8('0x58')]({'where':{'id':_0x54f3b9['params']['id']}})['then'](handleEntityNotFound(_0x31c23f,null))[_0xa1c8('0x23')](function(_0x4b829f){if(_0x4b829f){_0x36d508[_0xa1c8('0x2f')]=_[_0xa1c8('0x32')](db[_0xa1c8('0x5e')][_0xa1c8('0x2b')]);_0x36d508['query']=_['keys'](_0x54f3b9['query']);_0x36d508[_0xa1c8('0x3b')]=_[_0xa1c8('0x34')](_0x36d508[_0xa1c8('0x2f')],_0x36d508[_0xa1c8('0x31')]);_0x467372[_0xa1c8('0x33')]=_[_0xa1c8('0x34')](_0x36d508['model'],qs[_0xa1c8('0x35')](_0x54f3b9[_0xa1c8('0x31')][_0xa1c8('0x35')]));_0x467372[_0xa1c8('0x33')]=_0x467372['attributes']['length']?_0x467372[_0xa1c8('0x33')]:_0x36d508[_0xa1c8('0x2f')];if(!_0x54f3b9[_0xa1c8('0x31')][_0xa1c8('0x36')](_0xa1c8('0x37'))){_0x467372[_0xa1c8('0x1d')]=qs[_0xa1c8('0x1d')](_0x54f3b9[_0xa1c8('0x31')][_0xa1c8('0x1d')]);_0x467372[_0xa1c8('0x1a')]=qs[_0xa1c8('0x1a')](_0x54f3b9[_0xa1c8('0x31')][_0xa1c8('0x1a')]);}_0x467372[_0xa1c8('0x38')]=qs[_0xa1c8('0x39')](_0x54f3b9[_0xa1c8('0x31')]['sort']);_0x467372['where']=qs['filters'](_[_0xa1c8('0x5a')](_0x54f3b9[_0xa1c8('0x31')],_0x36d508[_0xa1c8('0x3b')]));_0x467372['where'][_0xa1c8('0x5b')]=_0x4b829f['id'];if(_0x54f3b9[_0xa1c8('0x31')][_0xa1c8('0x3e')]){_0x467372[_0xa1c8('0x3a')]=_[_0xa1c8('0x3c')](_0x467372['where'],{'$or':_[_0xa1c8('0x2a')](_0x467372[_0xa1c8('0x33')],function(_0x3d71fc){var _0x17ebe8={};_0x17ebe8[_0x3d71fc]={'$like':'%'+_0x54f3b9[_0xa1c8('0x31')]['filter']+'%'};return _0x17ebe8;})});}_0x467372=_[_0xa1c8('0x3c')]({},_0x467372,_0x54f3b9[_0xa1c8('0x3f')]);return db[_0xa1c8('0x5e')]['count']({'where':_0x467372[_0xa1c8('0x3a')]})[_0xa1c8('0x23')](function(_0x4797b3){_0x3bb064[_0xa1c8('0x1c')]=_0x4797b3;if(_0x54f3b9[_0xa1c8('0x31')]['includeAll']){_0x467372[_0xa1c8('0x41')]=[{'all':!![]}];}return db['CmHopperHistory'][_0xa1c8('0x42')](_0x467372);})['then'](function(_0x1e1128){_0x3bb064[_0xa1c8('0x5c')]=_0x1e1128;return _0x3bb064;});}})[_0xa1c8('0x23')](respondWithFilteredResult(_0x31c23f,_0x467372))[_0xa1c8('0x43')](handleError(_0x31c23f,null));};exports[_0xa1c8('0x5f')]=function(_0x5ee23c,_0x514d1f,_0x432c54){var _0x1eb4ac={'raw':!![],'where':{}};var _0x30c9e9={};var _0x369590={'count':0x0,'rows':[]};return db[_0xa1c8('0x40')][_0xa1c8('0x58')]({'where':{'id':_0x5ee23c[_0xa1c8('0x45')]['id']}})[_0xa1c8('0x23')](handleEntityNotFound(_0x514d1f,null))[_0xa1c8('0x23')](function(_0x5709cb){if(_0x5709cb){_0x30c9e9[_0xa1c8('0x2f')]=_[_0xa1c8('0x32')](db['CmHopperFinal'][_0xa1c8('0x2b')]);_0x30c9e9[_0xa1c8('0x31')]=_[_0xa1c8('0x32')](_0x5ee23c[_0xa1c8('0x31')]);_0x30c9e9[_0xa1c8('0x3b')]=_[_0xa1c8('0x34')](_0x30c9e9['model'],_0x30c9e9[_0xa1c8('0x31')]);_0x1eb4ac[_0xa1c8('0x33')]=_[_0xa1c8('0x34')](_0x30c9e9[_0xa1c8('0x2f')],qs['fields'](_0x5ee23c[_0xa1c8('0x31')][_0xa1c8('0x35')]));_0x1eb4ac['attributes']=_0x1eb4ac[_0xa1c8('0x33')]['length']?_0x1eb4ac[_0xa1c8('0x33')]:_0x30c9e9['model'];if(!_0x5ee23c['query'][_0xa1c8('0x36')](_0xa1c8('0x37'))){_0x1eb4ac['limit']=qs[_0xa1c8('0x1d')](_0x5ee23c[_0xa1c8('0x31')][_0xa1c8('0x1d')]);_0x1eb4ac[_0xa1c8('0x1a')]=qs[_0xa1c8('0x1a')](_0x5ee23c[_0xa1c8('0x31')][_0xa1c8('0x1a')]);}_0x1eb4ac[_0xa1c8('0x38')]=qs['sort'](_0x5ee23c[_0xa1c8('0x31')]['sort']);_0x1eb4ac['where']=qs[_0xa1c8('0x3b')](_[_0xa1c8('0x5a')](_0x5ee23c[_0xa1c8('0x31')],_0x30c9e9[_0xa1c8('0x3b')]));_0x1eb4ac[_0xa1c8('0x3a')][_0xa1c8('0x5b')]=_0x5709cb['id'];if(_0x5ee23c[_0xa1c8('0x31')]['filter']){_0x1eb4ac[_0xa1c8('0x3a')]=_[_0xa1c8('0x3c')](_0x1eb4ac[_0xa1c8('0x3a')],{'$or':_[_0xa1c8('0x2a')](_0x1eb4ac['attributes'],function(_0x50a1b6){var _0x470ef9={};_0x470ef9[_0x50a1b6]={'$like':'%'+_0x5ee23c[_0xa1c8('0x31')][_0xa1c8('0x3e')]+'%'};return _0x470ef9;})});}_0x1eb4ac=_[_0xa1c8('0x3c')]({},_0x1eb4ac,_0x5ee23c['options']);return db[_0xa1c8('0x60')][_0xa1c8('0x1c')]({'where':_0x1eb4ac[_0xa1c8('0x3a')]})[_0xa1c8('0x23')](function(_0x5dee1e){_0x369590[_0xa1c8('0x1c')]=_0x5dee1e;if(_0x5ee23c[_0xa1c8('0x31')]['includeAll']){_0x1eb4ac[_0xa1c8('0x41')]=[{'all':!![]}];}return db[_0xa1c8('0x60')]['findAll'](_0x1eb4ac);})['then'](function(_0x51e6da){_0x369590[_0xa1c8('0x5c')]=_0x51e6da;return _0x369590;});}})[_0xa1c8('0x23')](respondWithFilteredResult(_0x514d1f,_0x1eb4ac))['catch'](handleError(_0x514d1f,null));};exports[_0xa1c8('0x61')]=function(_0x179894,_0x24d2e6,_0xa08588){var _0x5819e0={'raw':!![],'where':{}};var _0x517145={};var _0x4c1297={'count':0x0,'rows':[]};return db[_0xa1c8('0x40')][_0xa1c8('0x58')]({'where':{'id':_0x179894[_0xa1c8('0x45')]['id']}})[_0xa1c8('0x23')](handleEntityNotFound(_0x24d2e6,null))[_0xa1c8('0x23')](function(_0x5ecd81){if(_0x5ecd81){_0x517145[_0xa1c8('0x2f')]=_[_0xa1c8('0x32')](db['CmHopperBlack']['rawAttributes']);_0x517145[_0xa1c8('0x31')]=_[_0xa1c8('0x32')](_0x179894[_0xa1c8('0x31')]);_0x517145[_0xa1c8('0x3b')]=_[_0xa1c8('0x34')](_0x517145[_0xa1c8('0x2f')],_0x517145[_0xa1c8('0x31')]);_0x5819e0[_0xa1c8('0x33')]=_['intersection'](_0x517145[_0xa1c8('0x2f')],qs[_0xa1c8('0x35')](_0x179894[_0xa1c8('0x31')]['fields']));_0x5819e0[_0xa1c8('0x33')]=_0x5819e0[_0xa1c8('0x33')]['length']?_0x5819e0[_0xa1c8('0x33')]:_0x517145[_0xa1c8('0x2f')];if(!_0x179894[_0xa1c8('0x31')][_0xa1c8('0x36')](_0xa1c8('0x37'))){_0x5819e0['limit']=qs[_0xa1c8('0x1d')](_0x179894[_0xa1c8('0x31')][_0xa1c8('0x1d')]);_0x5819e0[_0xa1c8('0x1a')]=qs['offset'](_0x179894[_0xa1c8('0x31')][_0xa1c8('0x1a')]);}_0x5819e0[_0xa1c8('0x38')]=qs['sort'](_0x179894[_0xa1c8('0x31')]['sort']);_0x5819e0['where']=qs[_0xa1c8('0x3b')](_['pick'](_0x179894[_0xa1c8('0x31')],_0x517145[_0xa1c8('0x3b')]));_0x5819e0['where'][_0xa1c8('0x5b')]=_0x5ecd81['id'];if(_0x179894[_0xa1c8('0x31')][_0xa1c8('0x3e')]){_0x5819e0[_0xa1c8('0x3a')]=_['merge'](_0x5819e0[_0xa1c8('0x3a')],{'$or':_['map'](_0x5819e0[_0xa1c8('0x33')],function(_0x43144d){var _0x384094={};_0x384094[_0x43144d]={'$like':'%'+_0x179894[_0xa1c8('0x31')][_0xa1c8('0x3e')]+'%'};return _0x384094;})});}_0x5819e0=_['merge']({},_0x5819e0,_0x179894[_0xa1c8('0x3f')]);return db[_0xa1c8('0x62')]['count']({'where':_0x5819e0[_0xa1c8('0x3a')]})[_0xa1c8('0x23')](function(_0x691df5){_0x4c1297[_0xa1c8('0x1c')]=_0x691df5;if(_0x179894[_0xa1c8('0x31')][_0xa1c8('0x47')]){_0x5819e0['include']=[{'all':!![]}];}return db[_0xa1c8('0x62')]['findAll'](_0x5819e0);})[_0xa1c8('0x23')](function(_0x4fc625){_0x4c1297['rows']=_0x4fc625;return _0x4c1297;});}})[_0xa1c8('0x23')](respondWithFilteredResult(_0x24d2e6,_0x5819e0))['catch'](handleError(_0x24d2e6,null));};exports[_0xa1c8('0x63')]=function(_0x263bb9,_0x1c5286,_0x502b29){var _0x241af7={};var _0x5e52cd={};var _0x58e7fb;var _0x500ba9;return db[_0xa1c8('0x40')][_0xa1c8('0x58')]({'where':{'id':_0x263bb9['params']['id']}})[_0xa1c8('0x23')](handleEntityNotFound(_0x1c5286,null))[_0xa1c8('0x23')](function(_0x8b3dc6){if(_0x8b3dc6){_0x58e7fb=_0x8b3dc6;_0x5e52cd['model']=_[_0xa1c8('0x32')](db[_0xa1c8('0x64')][_0xa1c8('0x2b')]);_0x5e52cd[_0xa1c8('0x31')]=_[_0xa1c8('0x32')](_0x263bb9[_0xa1c8('0x31')]);_0x5e52cd[_0xa1c8('0x3b')]=_['intersection'](_0x5e52cd[_0xa1c8('0x2f')],_0x5e52cd[_0xa1c8('0x31')]);_0x241af7[_0xa1c8('0x33')]=_['intersection'](_0x5e52cd[_0xa1c8('0x2f')],qs[_0xa1c8('0x35')](_0x263bb9[_0xa1c8('0x31')][_0xa1c8('0x35')]));_0x241af7[_0xa1c8('0x33')]=_0x241af7[_0xa1c8('0x33')][_0xa1c8('0x46')]?_0x241af7['attributes']:_0x5e52cd[_0xa1c8('0x2f')];_0x241af7[_0xa1c8('0x38')]=qs['sort'](_0x263bb9['query'][_0xa1c8('0x39')]);_0x241af7[_0xa1c8('0x3a')]=qs[_0xa1c8('0x3b')](_[_0xa1c8('0x5a')](_0x263bb9[_0xa1c8('0x31')],_0x5e52cd['filters']));if(_0x263bb9[_0xa1c8('0x31')][_0xa1c8('0x3e')]){_0x241af7[_0xa1c8('0x3a')]=_['merge'](_0x241af7['where'],{'$or':_[_0xa1c8('0x2a')](_0x241af7[_0xa1c8('0x33')],function(_0x40cbdb){var _0x39a2e5={};_0x39a2e5[_0x40cbdb]={'$like':'%'+_0x263bb9['query'][_0xa1c8('0x3e')]+'%'};return _0x39a2e5;})});}_0x241af7=_[_0xa1c8('0x3c')]({},_0x241af7,_0x263bb9['options']);return _0x58e7fb[_0xa1c8('0x63')](_0x241af7);}})['then'](function(_0x1b09a5){if(_0x1b09a5){_0x500ba9=_0x1b09a5[_0xa1c8('0x46')];if(!_0x263bb9[_0xa1c8('0x31')][_0xa1c8('0x36')](_0xa1c8('0x37'))){_0x241af7[_0xa1c8('0x1d')]=qs[_0xa1c8('0x1d')](_0x263bb9[_0xa1c8('0x31')][_0xa1c8('0x1d')]);_0x241af7[_0xa1c8('0x1a')]=qs[_0xa1c8('0x1a')](_0x263bb9[_0xa1c8('0x31')][_0xa1c8('0x1a')]);}return _0x58e7fb['getLists'](_0x241af7);}})[_0xa1c8('0x23')](function(_0x4f5a4e){if(_0x4f5a4e){return _0x4f5a4e?{'count':_0x500ba9,'rows':_0x4f5a4e}:null;}})[_0xa1c8('0x23')](respondWithResult(_0x1c5286,null))['catch'](handleError(_0x1c5286,null));};exports[_0xa1c8('0x65')]=function(_0x4f3382,_0x1b19ce,_0x3df5ee){var _0x5f3dd8,_0x253b86;var _0x5cd3c8=[];var _0x456956=moment()[_0xa1c8('0x66')]('YYYY-MM-DD\x20HH:mm:ss');return db['Campaign'][_0xa1c8('0x48')]({'where':{'id':_0x4f3382[_0xa1c8('0x45')]['id']}})[_0xa1c8('0x23')](handleEntityNotFound(_0x1b19ce,null))['then'](function(_0x26e7df){if(_0x26e7df){_0x253b86=_0x26e7df;return _0x26e7df['addLists'](_0x4f3382[_0xa1c8('0x4a')][_0xa1c8('0x67')],_[_0xa1c8('0x53')](_0x4f3382[_0xa1c8('0x4a')],[_0xa1c8('0x67'),'id'])||{});}return null;})['spread'](function(_0x52200a){var _0x18b6fd;var _0x615b5b;_0x5f3dd8=_0x52200a||[];var _0x3a19af=[];if(_0x52200a){for(var _0x3c8715=0x0;_0x3c8715<_0x52200a[_0xa1c8('0x46')];_0x3c8715+=0x1){var _0x135214=_0x52200a[_0x3c8715]['get']({'plain':!![]});_0x253b86['dialCheckDuplicateType']=_0x4f3382[_0xa1c8('0x4a')][_0xa1c8('0x68')]?_0x4f3382[_0xa1c8('0x4a')][_0xa1c8('0x68')]:_0x253b86[_0xa1c8('0x68')];switch(_0x253b86[_0xa1c8('0x68')]){case _0xa1c8('0x69'):_0x18b6fd=squel[_0xa1c8('0x6a')]()[_0xa1c8('0x6b')](_0xa1c8('0x6c'))['fromQuery']([_0xa1c8('0x6d'),'scheduledAt','ContactId',_0xa1c8('0x6e'),_0xa1c8('0x5b'),_0xa1c8('0x54'),_0xa1c8('0x55')],squel['select']()[_0xa1c8('0x6f')](_0xa1c8('0x6d'),_0xa1c8('0x6d'))[_0xa1c8('0x6f')]('NOW()',_0xa1c8('0x70'))['field']('id','ContactId')[_0xa1c8('0x6f')](_0x135214['CmListId'][_0xa1c8('0x71')](),_0xa1c8('0x6e'))[_0xa1c8('0x6f')](_0x4f3382['params']['id'][_0xa1c8('0x71')](),_0xa1c8('0x5b'))[_0xa1c8('0x6f')]('\x27'+_0x456956+'\x27',_0xa1c8('0x54'))[_0xa1c8('0x6f')]('\x27'+_0x456956+'\x27',_0xa1c8('0x55'))[_0xa1c8('0x72')](_0xa1c8('0x73'))[_0xa1c8('0x3a')](_0xa1c8('0x74'))[_0xa1c8('0x3a')](_0xa1c8('0x75'),_0x135214['CmListId']['toString']())['where'](_0xa1c8('0x76'))[_0xa1c8('0x3a')](_0xa1c8('0x77'),squel['select']()['field'](_0xa1c8('0x78'))[_0xa1c8('0x72')]('cm_hopper_final')[_0xa1c8('0x3a')]('CampaignId\x20=\x20?',_0x4f3382['params']['id'][_0xa1c8('0x71')]()))[_0xa1c8('0x3a')](_0xa1c8('0x77'),squel[_0xa1c8('0x79')]()[_0xa1c8('0x6f')](_0xa1c8('0x7a'))[_0xa1c8('0x72')]('cm_hopper')['where']('CampaignId\x20=\x20?',_0x4f3382['params']['id']['toString']())))[_0xa1c8('0x71')]();break;case _0xa1c8('0x7b'):_0x18b6fd=squel[_0xa1c8('0x6a')]()[_0xa1c8('0x6b')](_0xa1c8('0x6c'))[_0xa1c8('0x7c')]([_0xa1c8('0x6d'),_0xa1c8('0x70'),_0xa1c8('0x7d'),'ListId','CampaignId',_0xa1c8('0x54'),_0xa1c8('0x55')],squel['select']()[_0xa1c8('0x6f')](_0xa1c8('0x6d'),_0xa1c8('0x6d'))[_0xa1c8('0x6f')](_0xa1c8('0x7e'),'scheduledAt')[_0xa1c8('0x6f')]('id','ContactId')['field'](_0x135214[_0xa1c8('0x7f')][_0xa1c8('0x71')](),_0xa1c8('0x6e'))[_0xa1c8('0x6f')](_0x4f3382['params']['id']['toString'](),_0xa1c8('0x5b'))[_0xa1c8('0x6f')]('\x27'+_0x456956+'\x27',_0xa1c8('0x54'))[_0xa1c8('0x6f')]('\x27'+_0x456956+'\x27',_0xa1c8('0x55'))[_0xa1c8('0x72')](_0xa1c8('0x73'))['where'](_0xa1c8('0x74'))[_0xa1c8('0x3a')]('ListId\x20=\x20?',_0x135214[_0xa1c8('0x7f')][_0xa1c8('0x71')]())['where'](_0xa1c8('0x76'))['where'](_0xa1c8('0x77'),squel[_0xa1c8('0x79')]()[_0xa1c8('0x6f')](_0xa1c8('0x7a'))[_0xa1c8('0x72')]('cm_hopper')[_0xa1c8('0x3a')]('CampaignId\x20=\x20?',_0x4f3382[_0xa1c8('0x45')]['id']['toString']())))[_0xa1c8('0x71')]();break;default:_0x18b6fd=squel['insert']()['into']('cm_hopper')[_0xa1c8('0x7c')](['phone',_0xa1c8('0x70'),_0xa1c8('0x7d'),'ListId',_0xa1c8('0x5b'),_0xa1c8('0x54'),_0xa1c8('0x55')],squel['select']()['field']('phone','phone')[_0xa1c8('0x6f')](_0xa1c8('0x7e'),_0xa1c8('0x70'))[_0xa1c8('0x6f')]('id',_0xa1c8('0x7d'))[_0xa1c8('0x6f')](_0x135214[_0xa1c8('0x7f')][_0xa1c8('0x71')](),_0xa1c8('0x6e'))[_0xa1c8('0x6f')](_0x4f3382[_0xa1c8('0x45')]['id'][_0xa1c8('0x71')](),_0xa1c8('0x5b'))[_0xa1c8('0x6f')]('\x27'+_0x456956+'\x27','createdAt')[_0xa1c8('0x6f')]('\x27'+_0x456956+'\x27','updatedAt')['from']('cm_contacts')[_0xa1c8('0x3a')](_0xa1c8('0x74'))['where'](_0xa1c8('0x75'),_0x135214[_0xa1c8('0x7f')][_0xa1c8('0x71')]())[_0xa1c8('0x3a')](_0xa1c8('0x76')))['toString']();}_0x615b5b=squel['insert']()[_0xa1c8('0x6b')](_0xa1c8('0x80'))[_0xa1c8('0x7c')]([_0xa1c8('0x81'),_0xa1c8('0x70'),'phone',_0xa1c8('0x82'),_0xa1c8('0x54'),_0xa1c8('0x55')],squel[_0xa1c8('0x79')]()[_0xa1c8('0x6f')](_0xa1c8('0x83'),'id')[_0xa1c8('0x6f')](_0xa1c8('0x7e'),'scheduledAt')['field'](_0xa1c8('0x84'),_0xa1c8('0x6d'))[_0xa1c8('0x6f')](_0xa1c8('0x85'),'OrderBy')[_0xa1c8('0x6f')]('\x27'+_0x456956+'\x27',_0xa1c8('0x54'))[_0xa1c8('0x6f')]('\x27'+_0x456956+'\x27',_0xa1c8('0x55'))['from']('cm_contact_has_items','ci')['join'](_0xa1c8('0x6c'),'h',_0xa1c8('0x86'))['where']('h.ListId\x20=\x20?',_0x135214[_0xa1c8('0x7f')][_0xa1c8('0x71')]())[_0xa1c8('0x3a')]('h.CampaignId=?',_0x4f3382[_0xa1c8('0x45')]['id'][_0xa1c8('0x71')]())[_0xa1c8('0x3a')](_0xa1c8('0x87'),_0x456956))[_0xa1c8('0x71')]();_0x3a19af['push'](db[_0xa1c8('0x88')][_0xa1c8('0x31')](_0x18b6fd));_0x5cd3c8[_0xa1c8('0x89')](db[_0xa1c8('0x88')]['query'](_0x615b5b));}return BPromise[_0xa1c8('0x8a')](_0x3a19af);}})[_0xa1c8('0x23')](function(){return BPromise[_0xa1c8('0x8a')](_0x5cd3c8);})['then'](function(){return _0x5f3dd8;})[_0xa1c8('0x23')](respondWithResult(_0x1b19ce,null))[_0xa1c8('0x43')](handleError(_0x1b19ce,null));};exports['removeLists']=function(_0x19f9b1,_0x3375da,_0x52468d){return db[_0xa1c8('0x40')][_0xa1c8('0x48')]({'where':{'id':_0x19f9b1[_0xa1c8('0x45')]['id']}})[_0xa1c8('0x23')](handleEntityNotFound(_0x3375da,null))[_0xa1c8('0x23')](function(_0x1292e7){if(_0x1292e7){return _0x1292e7[_0xa1c8('0x8b')](_0x19f9b1['query']['ids']);}})[_0xa1c8('0x23')](function(_0x1f2ff3){if(_0x1f2ff3){return db[_0xa1c8('0x59')][_0xa1c8('0x24')]({'where':{'ListId':_0x19f9b1[_0xa1c8('0x31')][_0xa1c8('0x67')],'CampaignId':_0x19f9b1['params']['id']}})[_0xa1c8('0x23')](function(){return _0x1f2ff3;});}})[_0xa1c8('0x23')](respondWithStatusCode(_0x3375da,null))[_0xa1c8('0x43')](handleError(_0x3375da,null));};exports[_0xa1c8('0x8c')]=function(_0x4e188b,_0x39bd90,_0x51c8ac){var _0x522608={};var _0x399ddc={};var _0x147fce;var _0x1909bb;return db[_0xa1c8('0x40')][_0xa1c8('0x58')]({'where':{'id':_0x4e188b[_0xa1c8('0x45')]['id']}})[_0xa1c8('0x23')](handleEntityNotFound(_0x39bd90,null))[_0xa1c8('0x23')](function(_0x1f60e3){if(_0x1f60e3){_0x147fce=_0x1f60e3;_0x399ddc[_0xa1c8('0x2f')]=_[_0xa1c8('0x32')](db[_0xa1c8('0x64')][_0xa1c8('0x2b')]);_0x399ddc['query']=_[_0xa1c8('0x32')](_0x4e188b[_0xa1c8('0x31')]);_0x399ddc['filters']=_['intersection'](_0x399ddc[_0xa1c8('0x2f')],_0x399ddc[_0xa1c8('0x31')]);_0x522608[_0xa1c8('0x33')]=_[_0xa1c8('0x34')](_0x399ddc[_0xa1c8('0x2f')],qs[_0xa1c8('0x35')](_0x4e188b[_0xa1c8('0x31')]['fields']));_0x522608['attributes']=_0x522608[_0xa1c8('0x33')][_0xa1c8('0x46')]?_0x522608[_0xa1c8('0x33')]:_0x399ddc[_0xa1c8('0x2f')];_0x522608['order']=qs[_0xa1c8('0x39')](_0x4e188b[_0xa1c8('0x31')][_0xa1c8('0x39')]);_0x522608['where']=qs['filters'](_[_0xa1c8('0x5a')](_0x4e188b[_0xa1c8('0x31')],_0x399ddc[_0xa1c8('0x3b')]));if(_0x4e188b['query'][_0xa1c8('0x3e')]){_0x522608[_0xa1c8('0x3a')]=_[_0xa1c8('0x3c')](_0x522608[_0xa1c8('0x3a')],{'$or':_[_0xa1c8('0x2a')](_0x522608[_0xa1c8('0x33')],function(_0x1ec82f){var _0x1e63a6={};_0x1e63a6[_0x1ec82f]={'$like':'%'+_0x4e188b[_0xa1c8('0x31')][_0xa1c8('0x3e')]+'%'};return _0x1e63a6;})});}_0x522608=_[_0xa1c8('0x3c')]({},_0x522608,_0x4e188b[_0xa1c8('0x3f')]);return _0x147fce[_0xa1c8('0x8c')](_0x522608);}})['then'](function(_0x498a84){if(_0x498a84){_0x1909bb=_0x498a84['length'];if(!_0x4e188b[_0xa1c8('0x31')]['hasOwnProperty'](_0xa1c8('0x37'))){_0x522608[_0xa1c8('0x1d')]=qs[_0xa1c8('0x1d')](_0x4e188b[_0xa1c8('0x31')][_0xa1c8('0x1d')]);_0x522608[_0xa1c8('0x1a')]=qs['offset'](_0x4e188b[_0xa1c8('0x31')][_0xa1c8('0x1a')]);}return _0x147fce[_0xa1c8('0x8c')](_0x522608);}})['then'](function(_0x595f0a){if(_0x595f0a){return _0x595f0a?{'count':_0x1909bb,'rows':_0x595f0a}:null;}})[_0xa1c8('0x23')](respondWithResult(_0x39bd90,null))[_0xa1c8('0x43')](handleError(_0x39bd90,null));};exports[_0xa1c8('0x8d')]=function(_0x196c41,_0xca5f56,_0x3f495d){var _0x591183,_0x5b7e15;var _0x58ad36=[];var _0xab9b23=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');return db['Campaign'][_0xa1c8('0x48')]({'where':{'id':_0x196c41[_0xa1c8('0x45')]['id']}})[_0xa1c8('0x23')](handleEntityNotFound(_0xca5f56,null))[_0xa1c8('0x23')](function(_0x10bec3){if(_0x10bec3){_0x5b7e15=_0x10bec3;return _0x10bec3['addBlackLists'](_0x196c41[_0xa1c8('0x4a')][_0xa1c8('0x67')],_[_0xa1c8('0x53')](_0x196c41[_0xa1c8('0x4a')],[_0xa1c8('0x67'),'id'])||{});}return null;})[_0xa1c8('0x8e')](function(_0x420b49){var _0x1cc0ef;var _0x15c987;_0x591183=_0x420b49||[];var _0x32ab13=[];if(_0x420b49){for(var _0xc891a1=0x0;_0xc891a1<_0x420b49[_0xa1c8('0x46')];_0xc891a1+=0x1){var _0x57ca6f=_0x420b49[_0xc891a1][_0xa1c8('0x25')]({'plain':!![]});_0x1cc0ef=squel['insert']()[_0xa1c8('0x6b')](_0xa1c8('0x8f'))[_0xa1c8('0x7c')](['phone','ContactId','ListId',_0xa1c8('0x5b'),_0xa1c8('0x54'),_0xa1c8('0x55')],squel[_0xa1c8('0x79')]()[_0xa1c8('0x6f')](_0xa1c8('0x6d'),_0xa1c8('0x6d'))[_0xa1c8('0x6f')]('id',_0xa1c8('0x7d'))[_0xa1c8('0x6f')](_0x57ca6f[_0xa1c8('0x7f')]['toString'](),_0xa1c8('0x6e'))['field'](_0x196c41[_0xa1c8('0x45')]['id'][_0xa1c8('0x71')](),_0xa1c8('0x5b'))['field'](_0xa1c8('0x7e'),_0xa1c8('0x54'))['field']('NOW()',_0xa1c8('0x55'))[_0xa1c8('0x72')](_0xa1c8('0x73'))[_0xa1c8('0x3a')](_0xa1c8('0x74'))[_0xa1c8('0x3a')]('ListId\x20=\x20?',_0x57ca6f[_0xa1c8('0x7f')][_0xa1c8('0x71')]())['where'](_0xa1c8('0x76')))['toString']();_0x32ab13[_0xa1c8('0x89')](db[_0xa1c8('0x88')][_0xa1c8('0x31')](_0x1cc0ef));}return BPromise['all'](_0x32ab13);}})[_0xa1c8('0x23')](function(){return _0x591183;})[_0xa1c8('0x23')](respondWithResult(_0xca5f56,null))['catch'](handleError(_0xca5f56,null));};exports[_0xa1c8('0x90')]=function(_0x28ad90,_0x42eb01,_0x276439){return db['Campaign'][_0xa1c8('0x48')]({'where':{'id':_0x28ad90[_0xa1c8('0x45')]['id']}})[_0xa1c8('0x23')](handleEntityNotFound(_0x42eb01,null))[_0xa1c8('0x23')](function(_0x432ccd){if(_0x432ccd){return _0x432ccd[_0xa1c8('0x90')](_0x28ad90['query'][_0xa1c8('0x67')]);}})['then'](function(_0x4f1eb7){if(_0x4f1eb7){return db[_0xa1c8('0x62')][_0xa1c8('0x24')]({'where':{'ListId':_0x28ad90[_0xa1c8('0x31')][_0xa1c8('0x67')],'CampaignId':_0x28ad90[_0xa1c8('0x45')]['id']}})['then'](function(){return _0x4f1eb7;});}})['then'](respondWithStatusCode(_0x42eb01,null))[_0xa1c8('0x43')](handleError(_0x42eb01,null));}; \ No newline at end of file +var _0x4242=['field','NOW()','scheduledAt','toString','from','cm_contacts','deletedAt\x20IS\x20NULL','CmListId','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','CampaignId\x20=\x20?','COALESCE(phone,\x27\x27)','onlyIfOpen','fromQuery','phone\x20IS\x20NOT\x20NULL','ListId\x20=\x20?','insert','cm_hopper_additional_phones','OrderBy','h.id','ci.item','ci.OrderBY','join','h.ContactId\x20=\x20ci.CmContactId','h.ListId\x20=\x20?','h.CampaignId=?','push','sequelize','all','removeLists','getBlackLists','CmList','addBlackLists','cm_hopper_black','removeBlackLists','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','sendStatus','status','end','json','undefined','limit','count','set','apply','reject','save','update','then','get','IvrCampaigns','UserProfileResource','destroy','stack','name','send','index','map','Campaign','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','offset','order','sort','where','pick','filter','type','VIRTUAL','merge','includeAll','findAll','catch','show','params','length','include','options','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','omit','updatedAt','body','createdAt','UserProfileSection','userProfileId','autoAssociation','getHoppers','findOne','CampaignId','CmHopper','rows','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','format','YYYY-MM-DD\x20HH:mm:ss','addLists','ids','spread','into','cm_hopper','phone','ContactId','ListId','select'];(function(_0x380711,_0x274f90){var _0x23156e=function(_0x139b34){while(--_0x139b34){_0x380711['push'](_0x380711['shift']());}};_0x23156e(++_0x274f90);}(_0x4242,0xb5));var _0x2424=function(_0x41d268,_0x34ed51){_0x41d268=_0x41d268-0x0;var _0x14962d=_0x4242[_0x41d268];return _0x14962d;};'use strict';var emlformat=require(_0x2424('0x0'));var rimraf=require(_0x2424('0x1'));var zipdir=require(_0x2424('0x2'));var jsonpatch=require(_0x2424('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x2424('0x4'));var Mustache=require(_0x2424('0x5'));var util=require(_0x2424('0x6'));var path=require('path');var sox=require(_0x2424('0x7'));var csv=require(_0x2424('0x8'));var ejs=require(_0x2424('0x9'));var fs=require('fs');var fs_extra=require(_0x2424('0xa'));var _=require(_0x2424('0xb'));var squel=require('squel');var crypto=require(_0x2424('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x2424('0x8'));var querystring=require(_0x2424('0xd'));var Papa=require(_0x2424('0xe'));var Redis=require('ioredis');var authService=require(_0x2424('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x2424('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2424('0x11'))(_0x2424('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x2424('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xa18032,_0x35926e){_0x35926e=_0x35926e||0xcc;return function(_0x4a0d97){if(_0x4a0d97){return _0xa18032[_0x2424('0x14')](_0x35926e);}return _0xa18032[_0x2424('0x15')](_0x35926e)[_0x2424('0x16')]();};}function respondWithResult(_0x449b27,_0x6cbc4d){_0x6cbc4d=_0x6cbc4d||0xc8;return function(_0x28d9eb){if(_0x28d9eb){return _0x449b27['status'](_0x6cbc4d)[_0x2424('0x17')](_0x28d9eb);}};}function respondWithFilteredResult(_0x5922ef,_0x4af4c4){return function(_0x5b1ed9){if(_0x5b1ed9){var _0x9798ad=typeof _0x4af4c4['offset']===_0x2424('0x18')&&typeof _0x4af4c4[_0x2424('0x19')]===_0x2424('0x18');var _0x363a15=_0x5b1ed9[_0x2424('0x1a')];var _0x26a9ce=_0x9798ad?0x0:_0x4af4c4['offset'];var _0x2becd7=_0x9798ad?_0x5b1ed9['count']:_0x4af4c4['offset']+_0x4af4c4[_0x2424('0x19')];var _0x390b4c;if(_0x2becd7>=_0x363a15){_0x2becd7=_0x363a15;_0x390b4c=0xc8;}else{_0x390b4c=0xce;}_0x5922ef[_0x2424('0x15')](_0x390b4c);return _0x5922ef[_0x2424('0x1b')]('Content-Range',_0x26a9ce+'-'+_0x2becd7+'/'+_0x363a15)['json'](_0x5b1ed9);}return null;};}function patchUpdates(_0x4ebd68){return function(_0x5468e1){try{jsonpatch[_0x2424('0x1c')](_0x5468e1,_0x4ebd68,!![]);}catch(_0x14e96b){return BPromise[_0x2424('0x1d')](_0x14e96b);}return _0x5468e1[_0x2424('0x1e')]();};}function saveUpdates(_0x33346b,_0x176a05){return function(_0x4e7f2d){if(_0x4e7f2d){return _0x4e7f2d[_0x2424('0x1f')](_0x33346b)[_0x2424('0x20')](function(_0xf2352f){return _0xf2352f;});}return null;};}function removeEntity(_0x6de5a0,_0x155d6f){return function(_0x4787cc){if(_0x4787cc){return _0x4787cc['destroy']()[_0x2424('0x20')](function(){var _0x1c9b1e=_0x4787cc[_0x2424('0x21')]({'plain':!![]});var _0x346576=_0x2424('0x22');return db[_0x2424('0x23')][_0x2424('0x24')]({'where':{'type':_0x346576,'resourceId':_0x1c9b1e['id']}})[_0x2424('0x20')](function(){return _0x4787cc;});})[_0x2424('0x20')](function(){_0x6de5a0[_0x2424('0x15')](0xcc)[_0x2424('0x16')]();});}};}function handleEntityNotFound(_0x1e9f18,_0x32914c){return function(_0x3c32a5){if(!_0x3c32a5){_0x1e9f18[_0x2424('0x14')](0x194);}return _0x3c32a5;};}function handleError(_0x178458,_0x21e87e){_0x21e87e=_0x21e87e||0x1f4;return function(_0x4e5770){logger['error'](_0x4e5770[_0x2424('0x25')]);if(_0x4e5770[_0x2424('0x26')]){delete _0x4e5770[_0x2424('0x26')];}_0x178458['status'](_0x21e87e)[_0x2424('0x27')](_0x4e5770);};}exports[_0x2424('0x28')]=function(_0x359d0b,_0xc0bec2){var _0x41c9d1={},_0x355f8c={},_0x4f5318={'count':0x0,'rows':[]};var _0xc88f0=_[_0x2424('0x29')](db[_0x2424('0x2a')][_0x2424('0x2b')],function(_0x3a5fff){return{'name':_0x3a5fff[_0x2424('0x2c')],'type':_0x3a5fff['type'][_0x2424('0x2d')]};});_0x355f8c[_0x2424('0x2e')]=_[_0x2424('0x29')](_0xc88f0,_0x2424('0x26'));_0x355f8c[_0x2424('0x2f')]=_[_0x2424('0x30')](_0x359d0b[_0x2424('0x2f')]);_0x355f8c[_0x2424('0x31')]=_[_0x2424('0x32')](_0x355f8c[_0x2424('0x2e')],_0x355f8c[_0x2424('0x2f')]);_0x41c9d1[_0x2424('0x33')]=_[_0x2424('0x32')](_0x355f8c[_0x2424('0x2e')],qs[_0x2424('0x34')](_0x359d0b[_0x2424('0x2f')][_0x2424('0x34')]));_0x41c9d1[_0x2424('0x33')]=_0x41c9d1[_0x2424('0x33')]['length']?_0x41c9d1[_0x2424('0x33')]:_0x355f8c[_0x2424('0x2e')];if(!_0x359d0b[_0x2424('0x2f')][_0x2424('0x35')](_0x2424('0x36'))){_0x41c9d1[_0x2424('0x19')]=qs[_0x2424('0x19')](_0x359d0b['query'][_0x2424('0x19')]);_0x41c9d1[_0x2424('0x37')]=qs[_0x2424('0x37')](_0x359d0b[_0x2424('0x2f')][_0x2424('0x37')]);}_0x41c9d1[_0x2424('0x38')]=qs[_0x2424('0x39')](_0x359d0b[_0x2424('0x2f')]['sort']);_0x41c9d1[_0x2424('0x3a')]=qs[_0x2424('0x31')](_[_0x2424('0x3b')](_0x359d0b[_0x2424('0x2f')],_0x355f8c[_0x2424('0x31')]),_0xc88f0);if(_0x359d0b['query'][_0x2424('0x3c')]){_0x41c9d1[_0x2424('0x3a')]=_['merge'](_0x41c9d1[_0x2424('0x3a')],{'$or':_[_0x2424('0x29')](_0xc88f0,function(_0x34b67f){if(_0x34b67f[_0x2424('0x3d')]!==_0x2424('0x3e')){var _0x5ce73c={};_0x5ce73c[_0x34b67f[_0x2424('0x26')]]={'$like':'%'+_0x359d0b['query'][_0x2424('0x3c')]+'%'};return _0x5ce73c;}})});}_0x41c9d1=_[_0x2424('0x3f')]({},_0x41c9d1,_0x359d0b['options']);var _0x3765a4={'where':_0x41c9d1[_0x2424('0x3a')]};return db['Campaign'][_0x2424('0x1a')](_0x3765a4)[_0x2424('0x20')](function(_0xa3890c){_0x4f5318[_0x2424('0x1a')]=_0xa3890c;if(_0x359d0b['query'][_0x2424('0x40')]){_0x41c9d1['include']=[{'all':!![]}];}return db['Campaign'][_0x2424('0x41')](_0x41c9d1);})['then'](function(_0x2eb008){_0x4f5318['rows']=_0x2eb008;return _0x4f5318;})[_0x2424('0x20')](respondWithFilteredResult(_0xc0bec2,_0x41c9d1))[_0x2424('0x42')](handleError(_0xc0bec2,null));};exports[_0x2424('0x43')]=function(_0x1732af,_0x592fef){var _0x50cbad={'raw':![],'where':{'id':_0x1732af[_0x2424('0x44')]['id']}},_0xe497e9={};_0xe497e9[_0x2424('0x2e')]=_[_0x2424('0x30')](db[_0x2424('0x2a')][_0x2424('0x2b')]);_0xe497e9[_0x2424('0x2f')]=_[_0x2424('0x30')](_0x1732af[_0x2424('0x2f')]);_0xe497e9[_0x2424('0x31')]=_['intersection'](_0xe497e9[_0x2424('0x2e')],_0xe497e9[_0x2424('0x2f')]);_0x50cbad[_0x2424('0x33')]=_[_0x2424('0x32')](_0xe497e9[_0x2424('0x2e')],qs[_0x2424('0x34')](_0x1732af['query'][_0x2424('0x34')]));_0x50cbad[_0x2424('0x33')]=_0x50cbad[_0x2424('0x33')][_0x2424('0x45')]?_0x50cbad[_0x2424('0x33')]:_0xe497e9['model'];if(_0x1732af[_0x2424('0x2f')][_0x2424('0x40')]){_0x50cbad[_0x2424('0x46')]=[{'all':!![]}];}_0x50cbad=_[_0x2424('0x3f')]({},_0x50cbad,_0x1732af[_0x2424('0x47')]);return db[_0x2424('0x2a')]['find'](_0x50cbad)[_0x2424('0x20')](handleEntityNotFound(_0x592fef,null))['then'](respondWithResult(_0x592fef,null))['catch'](handleError(_0x592fef,null));};exports[_0x2424('0x48')]=function(_0x396545,_0x117b24){return db[_0x2424('0x2a')][_0x2424('0x48')](_0x396545['body'],{})[_0x2424('0x20')](function(_0x21aa9a){var _0x29cf75=_0x396545[_0x2424('0x49')][_0x2424('0x21')]({'plain':!![]});if(!_0x29cf75)throw new Error(_0x2424('0x4a'));if(_0x29cf75[_0x2424('0x4b')]===_0x2424('0x49')){var _0x2a2310=_0x21aa9a[_0x2424('0x21')]({'plain':!![]});var _0x103ce7=_0x2424('0x22');return db['UserProfileSection'][_0x2424('0x4c')]({'where':{'name':_0x103ce7,'userProfileId':_0x29cf75['userProfileId']},'raw':!![]})[_0x2424('0x20')](function(_0x41e97b){if(_0x41e97b&&_0x41e97b['autoAssociation']===0x0){return db[_0x2424('0x23')][_0x2424('0x48')]({'name':_0x2a2310[_0x2424('0x26')],'resourceId':_0x2a2310['id'],'type':_0x41e97b[_0x2424('0x26')],'sectionId':_0x41e97b['id']},{})[_0x2424('0x20')](function(){return _0x21aa9a;});}else{return _0x21aa9a;}})[_0x2424('0x42')](function(_0x25ed24){logger[_0x2424('0x4d')](_0x2424('0x4e'),_0x25ed24);throw _0x25ed24;});}return _0x21aa9a;})[_0x2424('0x20')](respondWithResult(_0x117b24,0xc9))['catch'](handleError(_0x117b24,null));};exports['clone']=function(_0x32c4d5,_0x17cc8b){var _0x22b37e={'where':{'id':_0x32c4d5[_0x2424('0x44')]['id']}},_0x3e7017={};_0x3e7017[_0x2424('0x2e')]=_[_0x2424('0x30')](db[_0x2424('0x2a')][_0x2424('0x2b')]);_0x22b37e[_0x2424('0x33')]=_[_0x2424('0x32')](_0x3e7017[_0x2424('0x2e')],qs[_0x2424('0x34')](_0x32c4d5[_0x2424('0x2f')][_0x2424('0x34')]));_0x22b37e[_0x2424('0x33')]=_0x22b37e[_0x2424('0x33')]['length']?_0x22b37e[_0x2424('0x33')]:_0x3e7017[_0x2424('0x2e')];if(_0x32c4d5['query'][_0x2424('0x40')]){_0x22b37e['include']=[{'all':!![]}];}_0x22b37e=_[_0x2424('0x3f')]({},_0x22b37e,_0x32c4d5[_0x2424('0x47')]);return db['Campaign']['find'](_0x22b37e)[_0x2424('0x20')](handleEntityNotFound(_0x17cc8b,null))['then'](function(_0x580b5e){if(_0x580b5e){var _0x47e1ec=_0x580b5e[_0x2424('0x21')]({'plain':!![]});_0x47e1ec=qs[_0x2424('0x4f')](_0x47e1ec,['id','createdAt',_0x2424('0x50')]);_0x32c4d5[_0x2424('0x51')]=_[_0x2424('0x4f')](_0x32c4d5['body'],['id',_0x2424('0x52'),_0x2424('0x50')]);return db[_0x2424('0x2a')]['create'](_[_0x2424('0x3f')](_0x47e1ec,_0x32c4d5['body']),{'include':_0x32c4d5[_0x2424('0x2f')][_0x2424('0x40')]?[{'all':!![]}]:undefined})[_0x2424('0x20')](function(_0x1ed445){var _0x49b040=_0x32c4d5['user'][_0x2424('0x21')]({'plain':!![]});if(!_0x49b040)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x49b040[_0x2424('0x4b')]===_0x2424('0x49')){var _0x49c2a8=_0x1ed445['get']({'plain':!![]});var _0x40b356=_0x2424('0x22');return db[_0x2424('0x53')][_0x2424('0x4c')]({'where':{'name':_0x40b356,'userProfileId':_0x49b040[_0x2424('0x54')]},'raw':!![]})[_0x2424('0x20')](function(_0x5bd6ac){if(_0x5bd6ac&&_0x5bd6ac[_0x2424('0x55')]===0x0){return db[_0x2424('0x23')]['create']({'name':_0x49c2a8[_0x2424('0x26')],'resourceId':_0x49c2a8['id'],'type':_0x5bd6ac[_0x2424('0x26')],'sectionId':_0x5bd6ac['id']},{})[_0x2424('0x20')](function(){return _0x1ed445;});}else{return _0x1ed445;}})['catch'](function(_0x31ce02){logger[_0x2424('0x4d')](_0x2424('0x4e'),_0x31ce02);throw _0x31ce02;});}return _0x1ed445;});}})[_0x2424('0x20')](respondWithResult(_0x17cc8b,0xc9))['catch'](handleError(_0x17cc8b,null));};exports[_0x2424('0x1f')]=function(_0x28c04c,_0x54b0c5){if(_0x28c04c['body']['id']){delete _0x28c04c['body']['id'];}return db[_0x2424('0x2a')][_0x2424('0x4c')]({'where':{'id':_0x28c04c[_0x2424('0x44')]['id']}})[_0x2424('0x20')](handleEntityNotFound(_0x54b0c5,null))[_0x2424('0x20')](saveUpdates(_0x28c04c[_0x2424('0x51')],null))[_0x2424('0x20')](respondWithResult(_0x54b0c5,null))['catch'](handleError(_0x54b0c5,null));};exports[_0x2424('0x24')]=function(_0xa22f3b,_0x43484b){return db[_0x2424('0x2a')][_0x2424('0x4c')]({'where':{'id':_0xa22f3b[_0x2424('0x44')]['id']}})[_0x2424('0x20')](handleEntityNotFound(_0x43484b,null))['then'](removeEntity(_0x43484b,null))[_0x2424('0x42')](handleError(_0x43484b,null));};exports[_0x2424('0x56')]=function(_0x1c1ce6,_0x23bb5f,_0x5a8377){var _0xc0c2ee={'raw':!![],'where':{}};var _0x3a3b76={};var _0x1a88b7={'count':0x0,'rows':[]};return db[_0x2424('0x2a')][_0x2424('0x57')]({'where':{'id':_0x1c1ce6['params']['id']}})[_0x2424('0x20')](handleEntityNotFound(_0x23bb5f,null))[_0x2424('0x20')](function(_0x2bb46e){if(_0x2bb46e){_0x3a3b76['model']=_[_0x2424('0x30')](db['CmHopper'][_0x2424('0x2b')]);_0x3a3b76[_0x2424('0x2f')]=_['keys'](_0x1c1ce6['query']);_0x3a3b76['filters']=_['intersection'](_0x3a3b76[_0x2424('0x2e')],_0x3a3b76[_0x2424('0x2f')]);_0xc0c2ee[_0x2424('0x33')]=_[_0x2424('0x32')](_0x3a3b76[_0x2424('0x2e')],qs['fields'](_0x1c1ce6[_0x2424('0x2f')]['fields']));_0xc0c2ee[_0x2424('0x33')]=_0xc0c2ee[_0x2424('0x33')][_0x2424('0x45')]?_0xc0c2ee[_0x2424('0x33')]:_0x3a3b76['model'];if(!_0x1c1ce6['query'][_0x2424('0x35')](_0x2424('0x36'))){_0xc0c2ee[_0x2424('0x19')]=qs[_0x2424('0x19')](_0x1c1ce6[_0x2424('0x2f')]['limit']);_0xc0c2ee['offset']=qs['offset'](_0x1c1ce6[_0x2424('0x2f')][_0x2424('0x37')]);}_0xc0c2ee[_0x2424('0x38')]=qs[_0x2424('0x39')](_0x1c1ce6[_0x2424('0x2f')][_0x2424('0x39')]);_0xc0c2ee['where']=qs['filters'](_['pick'](_0x1c1ce6[_0x2424('0x2f')],_0x3a3b76[_0x2424('0x31')]));_0xc0c2ee['where'][_0x2424('0x58')]=_0x2bb46e['id'];if(_0x1c1ce6[_0x2424('0x2f')][_0x2424('0x3c')]){_0xc0c2ee[_0x2424('0x3a')]=_[_0x2424('0x3f')](_0xc0c2ee[_0x2424('0x3a')],{'$or':_['map'](_0xc0c2ee[_0x2424('0x33')],function(_0x53efd3){var _0x4de1f8={};_0x4de1f8[_0x53efd3]={'$like':'%'+_0x1c1ce6[_0x2424('0x2f')][_0x2424('0x3c')]+'%'};return _0x4de1f8;})});}_0xc0c2ee=_['merge']({},_0xc0c2ee,_0x1c1ce6['options']);return db['CmHopper'][_0x2424('0x1a')]({'where':_0xc0c2ee[_0x2424('0x3a')]})['then'](function(_0x5329eb){_0x1a88b7['count']=_0x5329eb;if(_0x1c1ce6[_0x2424('0x2f')][_0x2424('0x40')]){_0xc0c2ee['include']=[{'all':!![]}];}return db[_0x2424('0x59')][_0x2424('0x41')](_0xc0c2ee);})[_0x2424('0x20')](function(_0x22b950){_0x1a88b7[_0x2424('0x5a')]=_0x22b950;return _0x1a88b7;});}})['then'](respondWithFilteredResult(_0x23bb5f,_0xc0c2ee))[_0x2424('0x42')](handleError(_0x23bb5f,null));};exports[_0x2424('0x5b')]=function(_0x2bd44e,_0x44cab1,_0x1a9e01){var _0x1bfa59={'raw':!![],'where':{}};var _0x36a853={};var _0x234d6f={'count':0x0,'rows':[]};return db[_0x2424('0x2a')]['findOne']({'where':{'id':_0x2bd44e[_0x2424('0x44')]['id']}})[_0x2424('0x20')](handleEntityNotFound(_0x44cab1,null))['then'](function(_0x559a9f){if(_0x559a9f){_0x36a853['model']=_[_0x2424('0x30')](db['CmHopperHistory'][_0x2424('0x2b')]);_0x36a853[_0x2424('0x2f')]=_['keys'](_0x2bd44e['query']);_0x36a853[_0x2424('0x31')]=_[_0x2424('0x32')](_0x36a853[_0x2424('0x2e')],_0x36a853[_0x2424('0x2f')]);_0x1bfa59[_0x2424('0x33')]=_[_0x2424('0x32')](_0x36a853[_0x2424('0x2e')],qs['fields'](_0x2bd44e['query'][_0x2424('0x34')]));_0x1bfa59[_0x2424('0x33')]=_0x1bfa59['attributes']['length']?_0x1bfa59[_0x2424('0x33')]:_0x36a853[_0x2424('0x2e')];if(!_0x2bd44e[_0x2424('0x2f')][_0x2424('0x35')](_0x2424('0x36'))){_0x1bfa59[_0x2424('0x19')]=qs['limit'](_0x2bd44e[_0x2424('0x2f')][_0x2424('0x19')]);_0x1bfa59[_0x2424('0x37')]=qs['offset'](_0x2bd44e[_0x2424('0x2f')][_0x2424('0x37')]);}_0x1bfa59[_0x2424('0x38')]=qs[_0x2424('0x39')](_0x2bd44e['query']['sort']);_0x1bfa59['where']=qs[_0x2424('0x31')](_[_0x2424('0x3b')](_0x2bd44e[_0x2424('0x2f')],_0x36a853[_0x2424('0x31')]));_0x1bfa59['where']['CampaignId']=_0x559a9f['id'];if(_0x2bd44e['query'][_0x2424('0x3c')]){_0x1bfa59[_0x2424('0x3a')]=_[_0x2424('0x3f')](_0x1bfa59[_0x2424('0x3a')],{'$or':_[_0x2424('0x29')](_0x1bfa59[_0x2424('0x33')],function(_0x2141fd){var _0x645a00={};_0x645a00[_0x2141fd]={'$like':'%'+_0x2bd44e[_0x2424('0x2f')][_0x2424('0x3c')]+'%'};return _0x645a00;})});}_0x1bfa59=_[_0x2424('0x3f')]({},_0x1bfa59,_0x2bd44e['options']);return db[_0x2424('0x5c')][_0x2424('0x1a')]({'where':_0x1bfa59[_0x2424('0x3a')]})['then'](function(_0x10a1a3){_0x234d6f[_0x2424('0x1a')]=_0x10a1a3;if(_0x2bd44e['query']['includeAll']){_0x1bfa59[_0x2424('0x46')]=[{'all':!![]}];}return db['CmHopperHistory']['findAll'](_0x1bfa59);})[_0x2424('0x20')](function(_0x5703ad){_0x234d6f[_0x2424('0x5a')]=_0x5703ad;return _0x234d6f;});}})[_0x2424('0x20')](respondWithFilteredResult(_0x44cab1,_0x1bfa59))['catch'](handleError(_0x44cab1,null));};exports[_0x2424('0x5d')]=function(_0x5cac35,_0x334eec,_0x216df9){var _0x3caa67={'raw':!![],'where':{}};var _0x1da12b={};var _0x4ceeac={'count':0x0,'rows':[]};return db[_0x2424('0x2a')][_0x2424('0x57')]({'where':{'id':_0x5cac35[_0x2424('0x44')]['id']}})['then'](handleEntityNotFound(_0x334eec,null))[_0x2424('0x20')](function(_0x9dc490){if(_0x9dc490){_0x1da12b[_0x2424('0x2e')]=_[_0x2424('0x30')](db[_0x2424('0x5e')]['rawAttributes']);_0x1da12b[_0x2424('0x2f')]=_[_0x2424('0x30')](_0x5cac35[_0x2424('0x2f')]);_0x1da12b[_0x2424('0x31')]=_[_0x2424('0x32')](_0x1da12b['model'],_0x1da12b[_0x2424('0x2f')]);_0x3caa67[_0x2424('0x33')]=_[_0x2424('0x32')](_0x1da12b[_0x2424('0x2e')],qs[_0x2424('0x34')](_0x5cac35[_0x2424('0x2f')]['fields']));_0x3caa67[_0x2424('0x33')]=_0x3caa67['attributes']['length']?_0x3caa67['attributes']:_0x1da12b[_0x2424('0x2e')];if(!_0x5cac35[_0x2424('0x2f')][_0x2424('0x35')](_0x2424('0x36'))){_0x3caa67[_0x2424('0x19')]=qs['limit'](_0x5cac35[_0x2424('0x2f')]['limit']);_0x3caa67['offset']=qs[_0x2424('0x37')](_0x5cac35['query'][_0x2424('0x37')]);}_0x3caa67[_0x2424('0x38')]=qs[_0x2424('0x39')](_0x5cac35[_0x2424('0x2f')][_0x2424('0x39')]);_0x3caa67[_0x2424('0x3a')]=qs[_0x2424('0x31')](_[_0x2424('0x3b')](_0x5cac35[_0x2424('0x2f')],_0x1da12b[_0x2424('0x31')]));_0x3caa67[_0x2424('0x3a')][_0x2424('0x58')]=_0x9dc490['id'];if(_0x5cac35[_0x2424('0x2f')][_0x2424('0x3c')]){_0x3caa67[_0x2424('0x3a')]=_[_0x2424('0x3f')](_0x3caa67['where'],{'$or':_['map'](_0x3caa67['attributes'],function(_0x151557){var _0x3b3a61={};_0x3b3a61[_0x151557]={'$like':'%'+_0x5cac35[_0x2424('0x2f')][_0x2424('0x3c')]+'%'};return _0x3b3a61;})});}_0x3caa67=_['merge']({},_0x3caa67,_0x5cac35[_0x2424('0x47')]);return db[_0x2424('0x5e')]['count']({'where':_0x3caa67[_0x2424('0x3a')]})[_0x2424('0x20')](function(_0xa59944){_0x4ceeac[_0x2424('0x1a')]=_0xa59944;if(_0x5cac35[_0x2424('0x2f')][_0x2424('0x40')]){_0x3caa67[_0x2424('0x46')]=[{'all':!![]}];}return db[_0x2424('0x5e')][_0x2424('0x41')](_0x3caa67);})[_0x2424('0x20')](function(_0x2b93ed){_0x4ceeac[_0x2424('0x5a')]=_0x2b93ed;return _0x4ceeac;});}})['then'](respondWithFilteredResult(_0x334eec,_0x3caa67))[_0x2424('0x42')](handleError(_0x334eec,null));};exports[_0x2424('0x5f')]=function(_0x3701da,_0x39118e,_0x42ae8b){var _0x370b3d={'raw':!![],'where':{}};var _0x31bb69={};var _0x156d08={'count':0x0,'rows':[]};return db[_0x2424('0x2a')][_0x2424('0x57')]({'where':{'id':_0x3701da['params']['id']}})['then'](handleEntityNotFound(_0x39118e,null))[_0x2424('0x20')](function(_0x15366a){if(_0x15366a){_0x31bb69[_0x2424('0x2e')]=_[_0x2424('0x30')](db[_0x2424('0x60')][_0x2424('0x2b')]);_0x31bb69[_0x2424('0x2f')]=_['keys'](_0x3701da[_0x2424('0x2f')]);_0x31bb69['filters']=_[_0x2424('0x32')](_0x31bb69[_0x2424('0x2e')],_0x31bb69[_0x2424('0x2f')]);_0x370b3d[_0x2424('0x33')]=_[_0x2424('0x32')](_0x31bb69['model'],qs[_0x2424('0x34')](_0x3701da[_0x2424('0x2f')][_0x2424('0x34')]));_0x370b3d[_0x2424('0x33')]=_0x370b3d[_0x2424('0x33')][_0x2424('0x45')]?_0x370b3d['attributes']:_0x31bb69[_0x2424('0x2e')];if(!_0x3701da['query'][_0x2424('0x35')]('nolimit')){_0x370b3d[_0x2424('0x19')]=qs['limit'](_0x3701da[_0x2424('0x2f')][_0x2424('0x19')]);_0x370b3d[_0x2424('0x37')]=qs['offset'](_0x3701da[_0x2424('0x2f')][_0x2424('0x37')]);}_0x370b3d[_0x2424('0x38')]=qs[_0x2424('0x39')](_0x3701da[_0x2424('0x2f')][_0x2424('0x39')]);_0x370b3d[_0x2424('0x3a')]=qs[_0x2424('0x31')](_['pick'](_0x3701da[_0x2424('0x2f')],_0x31bb69['filters']));_0x370b3d[_0x2424('0x3a')][_0x2424('0x58')]=_0x15366a['id'];if(_0x3701da[_0x2424('0x2f')][_0x2424('0x3c')]){_0x370b3d[_0x2424('0x3a')]=_['merge'](_0x370b3d[_0x2424('0x3a')],{'$or':_[_0x2424('0x29')](_0x370b3d['attributes'],function(_0x44ecbf){var _0xeab622={};_0xeab622[_0x44ecbf]={'$like':'%'+_0x3701da[_0x2424('0x2f')][_0x2424('0x3c')]+'%'};return _0xeab622;})});}_0x370b3d=_[_0x2424('0x3f')]({},_0x370b3d,_0x3701da[_0x2424('0x47')]);return db['CmHopperBlack']['count']({'where':_0x370b3d[_0x2424('0x3a')]})[_0x2424('0x20')](function(_0x2df43e){_0x156d08[_0x2424('0x1a')]=_0x2df43e;if(_0x3701da[_0x2424('0x2f')][_0x2424('0x40')]){_0x370b3d[_0x2424('0x46')]=[{'all':!![]}];}return db[_0x2424('0x60')]['findAll'](_0x370b3d);})[_0x2424('0x20')](function(_0x12386a){_0x156d08[_0x2424('0x5a')]=_0x12386a;return _0x156d08;});}})['then'](respondWithFilteredResult(_0x39118e,_0x370b3d))[_0x2424('0x42')](handleError(_0x39118e,null));};exports['getLists']=function(_0x6722fc,_0x476c51,_0x3d171a){var _0x11ecf2={};var _0x372797={};var _0x34a0bb;var _0x43c087;return db[_0x2424('0x2a')][_0x2424('0x57')]({'where':{'id':_0x6722fc['params']['id']}})[_0x2424('0x20')](handleEntityNotFound(_0x476c51,null))[_0x2424('0x20')](function(_0x5b3ab7){if(_0x5b3ab7){_0x34a0bb=_0x5b3ab7;_0x372797[_0x2424('0x2e')]=_[_0x2424('0x30')](db['CmList'][_0x2424('0x2b')]);_0x372797[_0x2424('0x2f')]=_['keys'](_0x6722fc[_0x2424('0x2f')]);_0x372797['filters']=_[_0x2424('0x32')](_0x372797[_0x2424('0x2e')],_0x372797[_0x2424('0x2f')]);_0x11ecf2[_0x2424('0x33')]=_[_0x2424('0x32')](_0x372797[_0x2424('0x2e')],qs[_0x2424('0x34')](_0x6722fc[_0x2424('0x2f')][_0x2424('0x34')]));_0x11ecf2['attributes']=_0x11ecf2[_0x2424('0x33')][_0x2424('0x45')]?_0x11ecf2[_0x2424('0x33')]:_0x372797[_0x2424('0x2e')];_0x11ecf2[_0x2424('0x38')]=qs['sort'](_0x6722fc['query']['sort']);_0x11ecf2[_0x2424('0x3a')]=qs[_0x2424('0x31')](_['pick'](_0x6722fc['query'],_0x372797[_0x2424('0x31')]));if(_0x6722fc['query'][_0x2424('0x3c')]){_0x11ecf2[_0x2424('0x3a')]=_[_0x2424('0x3f')](_0x11ecf2['where'],{'$or':_[_0x2424('0x29')](_0x11ecf2[_0x2424('0x33')],function(_0x150d7e){var _0x1cbad4={};_0x1cbad4[_0x150d7e]={'$like':'%'+_0x6722fc[_0x2424('0x2f')][_0x2424('0x3c')]+'%'};return _0x1cbad4;})});}_0x11ecf2=_[_0x2424('0x3f')]({},_0x11ecf2,_0x6722fc[_0x2424('0x47')]);return _0x34a0bb['getLists'](_0x11ecf2);}})[_0x2424('0x20')](function(_0x43c10f){if(_0x43c10f){_0x43c087=_0x43c10f[_0x2424('0x45')];if(!_0x6722fc['query'][_0x2424('0x35')](_0x2424('0x36'))){_0x11ecf2[_0x2424('0x19')]=qs[_0x2424('0x19')](_0x6722fc['query']['limit']);_0x11ecf2['offset']=qs[_0x2424('0x37')](_0x6722fc['query']['offset']);}return _0x34a0bb[_0x2424('0x61')](_0x11ecf2);}})[_0x2424('0x20')](function(_0x33fe81){if(_0x33fe81){return _0x33fe81?{'count':_0x43c087,'rows':_0x33fe81}:null;}})['then'](respondWithResult(_0x476c51,null))['catch'](handleError(_0x476c51,null));};exports['addLists']=function(_0x361fa6,_0x589d99,_0x2ae3dc){var _0x129ad9,_0x276a22;var _0x3238ad=[];var _0x51d857=moment()[_0x2424('0x62')](_0x2424('0x63'));return db[_0x2424('0x2a')]['find']({'where':{'id':_0x361fa6[_0x2424('0x44')]['id']}})[_0x2424('0x20')](handleEntityNotFound(_0x589d99,null))[_0x2424('0x20')](function(_0x384049){if(_0x384049){_0x276a22=_0x384049;return _0x384049[_0x2424('0x64')](_0x361fa6[_0x2424('0x51')][_0x2424('0x65')],_[_0x2424('0x4f')](_0x361fa6[_0x2424('0x51')],[_0x2424('0x65'),'id'])||{});}return null;})[_0x2424('0x66')](function(_0x413359){var _0x259e1a;var _0x58c7a6;_0x129ad9=_0x413359||[];var _0x50d55a=[];if(_0x413359){for(var _0x4fd595=0x0;_0x4fd595<_0x413359['length'];_0x4fd595+=0x1){var _0x4837ee=_0x413359[_0x4fd595][_0x2424('0x21')]({'plain':!![]});_0x276a22['dialCheckDuplicateType']=_0x361fa6[_0x2424('0x51')]['dialCheckDuplicateType']?_0x361fa6['body']['dialCheckDuplicateType']:_0x276a22['dialCheckDuplicateType'];switch(_0x276a22['dialCheckDuplicateType']){case'always':_0x259e1a=squel['insert']()[_0x2424('0x67')](_0x2424('0x68'))['fromQuery']([_0x2424('0x69'),'scheduledAt',_0x2424('0x6a'),_0x2424('0x6b'),'CampaignId',_0x2424('0x52'),_0x2424('0x50')],squel[_0x2424('0x6c')]()[_0x2424('0x6d')](_0x2424('0x69'),_0x2424('0x69'))['field'](_0x2424('0x6e'),_0x2424('0x6f'))[_0x2424('0x6d')]('id',_0x2424('0x6a'))[_0x2424('0x6d')](_0x4837ee['CmListId'][_0x2424('0x70')](),'ListId')[_0x2424('0x6d')](_0x361fa6[_0x2424('0x44')]['id'][_0x2424('0x70')](),_0x2424('0x58'))['field']('\x27'+_0x51d857+'\x27','createdAt')[_0x2424('0x6d')]('\x27'+_0x51d857+'\x27',_0x2424('0x50'))[_0x2424('0x71')](_0x2424('0x72'))[_0x2424('0x3a')](_0x2424('0x73'))[_0x2424('0x3a')]('ListId\x20=\x20?',_0x4837ee[_0x2424('0x74')]['toString']())[_0x2424('0x3a')]('phone\x20IS\x20NOT\x20NULL')[_0x2424('0x3a')](_0x2424('0x75'),squel[_0x2424('0x6c')]()[_0x2424('0x6d')](_0x2424('0x76'))['from'](_0x2424('0x77'))[_0x2424('0x3a')](_0x2424('0x78'),_0x361fa6['params']['id'][_0x2424('0x70')]()))[_0x2424('0x3a')]('phone\x20NOT\x20IN\x20(?)',squel['select']()[_0x2424('0x6d')](_0x2424('0x79'))[_0x2424('0x71')](_0x2424('0x68'))[_0x2424('0x3a')]('CampaignId\x20=\x20?',_0x361fa6[_0x2424('0x44')]['id']['toString']())))[_0x2424('0x70')]();break;case _0x2424('0x7a'):_0x259e1a=squel['insert']()['into'](_0x2424('0x68'))[_0x2424('0x7b')]([_0x2424('0x69'),_0x2424('0x6f'),_0x2424('0x6a'),'ListId',_0x2424('0x58'),_0x2424('0x52'),_0x2424('0x50')],squel['select']()[_0x2424('0x6d')](_0x2424('0x69'),'phone')[_0x2424('0x6d')](_0x2424('0x6e'),_0x2424('0x6f'))[_0x2424('0x6d')]('id',_0x2424('0x6a'))[_0x2424('0x6d')](_0x4837ee[_0x2424('0x74')][_0x2424('0x70')](),_0x2424('0x6b'))[_0x2424('0x6d')](_0x361fa6[_0x2424('0x44')]['id']['toString'](),_0x2424('0x58'))[_0x2424('0x6d')]('\x27'+_0x51d857+'\x27',_0x2424('0x52'))[_0x2424('0x6d')]('\x27'+_0x51d857+'\x27',_0x2424('0x50'))[_0x2424('0x71')](_0x2424('0x72'))[_0x2424('0x3a')](_0x2424('0x73'))[_0x2424('0x3a')]('ListId\x20=\x20?',_0x4837ee[_0x2424('0x74')][_0x2424('0x70')]())[_0x2424('0x3a')](_0x2424('0x7c'))[_0x2424('0x3a')](_0x2424('0x75'),squel[_0x2424('0x6c')]()[_0x2424('0x6d')]('COALESCE(phone,\x27\x27)')[_0x2424('0x71')]('cm_hopper')[_0x2424('0x3a')](_0x2424('0x78'),_0x361fa6[_0x2424('0x44')]['id'][_0x2424('0x70')]())))[_0x2424('0x70')]();break;default:_0x259e1a=squel['insert']()[_0x2424('0x67')](_0x2424('0x68'))[_0x2424('0x7b')]([_0x2424('0x69'),_0x2424('0x6f'),_0x2424('0x6a'),_0x2424('0x6b'),_0x2424('0x58'),_0x2424('0x52'),_0x2424('0x50')],squel['select']()[_0x2424('0x6d')]('phone','phone')[_0x2424('0x6d')](_0x2424('0x6e'),'scheduledAt')[_0x2424('0x6d')]('id',_0x2424('0x6a'))[_0x2424('0x6d')](_0x4837ee[_0x2424('0x74')][_0x2424('0x70')](),_0x2424('0x6b'))[_0x2424('0x6d')](_0x361fa6['params']['id'][_0x2424('0x70')](),_0x2424('0x58'))['field']('\x27'+_0x51d857+'\x27',_0x2424('0x52'))[_0x2424('0x6d')]('\x27'+_0x51d857+'\x27',_0x2424('0x50'))[_0x2424('0x71')](_0x2424('0x72'))[_0x2424('0x3a')]('deletedAt\x20IS\x20NULL')[_0x2424('0x3a')](_0x2424('0x7d'),_0x4837ee[_0x2424('0x74')]['toString']())[_0x2424('0x3a')](_0x2424('0x7c')))[_0x2424('0x70')]();}_0x58c7a6=squel[_0x2424('0x7e')]()['into'](_0x2424('0x7f'))['fromQuery'](['cmHopperId',_0x2424('0x6f'),_0x2424('0x69'),_0x2424('0x80'),_0x2424('0x52'),'updatedAt'],squel[_0x2424('0x6c')]()[_0x2424('0x6d')](_0x2424('0x81'),'id')[_0x2424('0x6d')]('NOW()',_0x2424('0x6f'))[_0x2424('0x6d')](_0x2424('0x82'),_0x2424('0x69'))['field'](_0x2424('0x83'),_0x2424('0x80'))[_0x2424('0x6d')]('\x27'+_0x51d857+'\x27','createdAt')['field']('\x27'+_0x51d857+'\x27',_0x2424('0x50'))[_0x2424('0x71')]('cm_contact_has_items','ci')[_0x2424('0x84')](_0x2424('0x68'),'h',_0x2424('0x85'))[_0x2424('0x3a')](_0x2424('0x86'),_0x4837ee['CmListId'][_0x2424('0x70')]())[_0x2424('0x3a')](_0x2424('0x87'),_0x361fa6['params']['id'][_0x2424('0x70')]())[_0x2424('0x3a')]('h.createdAt\x20=\x20?',_0x51d857))['toString']();_0x50d55a[_0x2424('0x88')](db[_0x2424('0x89')][_0x2424('0x2f')](_0x259e1a));_0x3238ad[_0x2424('0x88')](db[_0x2424('0x89')][_0x2424('0x2f')](_0x58c7a6));}return BPromise[_0x2424('0x8a')](_0x50d55a);}})[_0x2424('0x20')](function(){return BPromise[_0x2424('0x8a')](_0x3238ad);})[_0x2424('0x20')](function(){return _0x129ad9;})[_0x2424('0x20')](respondWithResult(_0x589d99,null))[_0x2424('0x42')](handleError(_0x589d99,null));};exports[_0x2424('0x8b')]=function(_0x5e6e6e,_0x3f01ba,_0xaf370b){return db[_0x2424('0x2a')]['find']({'where':{'id':_0x5e6e6e[_0x2424('0x44')]['id']}})[_0x2424('0x20')](handleEntityNotFound(_0x3f01ba,null))[_0x2424('0x20')](function(_0x4fb517){if(_0x4fb517){return _0x4fb517[_0x2424('0x8b')](_0x5e6e6e[_0x2424('0x2f')][_0x2424('0x65')]);}})[_0x2424('0x20')](function(_0x250169){if(_0x250169){return db[_0x2424('0x59')]['destroy']({'where':{'ListId':_0x5e6e6e[_0x2424('0x2f')][_0x2424('0x65')],'CampaignId':_0x5e6e6e['params']['id']}})['then'](function(){return _0x250169;});}})[_0x2424('0x20')](respondWithStatusCode(_0x3f01ba,null))[_0x2424('0x42')](handleError(_0x3f01ba,null));};exports[_0x2424('0x8c')]=function(_0x224cae,_0x3558ff,_0x32c856){var _0x4b0ee6={};var _0x2ee97d={};var _0x196790;var _0x19981f;return db[_0x2424('0x2a')][_0x2424('0x57')]({'where':{'id':_0x224cae['params']['id']}})['then'](handleEntityNotFound(_0x3558ff,null))[_0x2424('0x20')](function(_0x19d620){if(_0x19d620){_0x196790=_0x19d620;_0x2ee97d[_0x2424('0x2e')]=_[_0x2424('0x30')](db[_0x2424('0x8d')]['rawAttributes']);_0x2ee97d['query']=_[_0x2424('0x30')](_0x224cae[_0x2424('0x2f')]);_0x2ee97d[_0x2424('0x31')]=_[_0x2424('0x32')](_0x2ee97d[_0x2424('0x2e')],_0x2ee97d['query']);_0x4b0ee6[_0x2424('0x33')]=_[_0x2424('0x32')](_0x2ee97d[_0x2424('0x2e')],qs['fields'](_0x224cae[_0x2424('0x2f')][_0x2424('0x34')]));_0x4b0ee6[_0x2424('0x33')]=_0x4b0ee6[_0x2424('0x33')]['length']?_0x4b0ee6[_0x2424('0x33')]:_0x2ee97d[_0x2424('0x2e')];_0x4b0ee6[_0x2424('0x38')]=qs[_0x2424('0x39')](_0x224cae[_0x2424('0x2f')]['sort']);_0x4b0ee6[_0x2424('0x3a')]=qs['filters'](_[_0x2424('0x3b')](_0x224cae[_0x2424('0x2f')],_0x2ee97d['filters']));if(_0x224cae[_0x2424('0x2f')][_0x2424('0x3c')]){_0x4b0ee6[_0x2424('0x3a')]=_[_0x2424('0x3f')](_0x4b0ee6[_0x2424('0x3a')],{'$or':_['map'](_0x4b0ee6[_0x2424('0x33')],function(_0x17cb45){var _0x2e9ab6={};_0x2e9ab6[_0x17cb45]={'$like':'%'+_0x224cae[_0x2424('0x2f')]['filter']+'%'};return _0x2e9ab6;})});}_0x4b0ee6=_[_0x2424('0x3f')]({},_0x4b0ee6,_0x224cae[_0x2424('0x47')]);return _0x196790[_0x2424('0x8c')](_0x4b0ee6);}})[_0x2424('0x20')](function(_0x59a3d0){if(_0x59a3d0){_0x19981f=_0x59a3d0[_0x2424('0x45')];if(!_0x224cae['query'][_0x2424('0x35')](_0x2424('0x36'))){_0x4b0ee6[_0x2424('0x19')]=qs[_0x2424('0x19')](_0x224cae['query']['limit']);_0x4b0ee6[_0x2424('0x37')]=qs['offset'](_0x224cae[_0x2424('0x2f')][_0x2424('0x37')]);}return _0x196790[_0x2424('0x8c')](_0x4b0ee6);}})[_0x2424('0x20')](function(_0x31fd3b){if(_0x31fd3b){return _0x31fd3b?{'count':_0x19981f,'rows':_0x31fd3b}:null;}})['then'](respondWithResult(_0x3558ff,null))[_0x2424('0x42')](handleError(_0x3558ff,null));};exports[_0x2424('0x8e')]=function(_0x17e968,_0x51c062,_0x4ee736){var _0x1d62a1,_0x2628c5;var _0x5aa025=[];var _0x1ef05d=moment()[_0x2424('0x62')]('YYYY-MM-DD\x20HH:mm:ss');return db[_0x2424('0x2a')][_0x2424('0x4c')]({'where':{'id':_0x17e968['params']['id']}})[_0x2424('0x20')](handleEntityNotFound(_0x51c062,null))['then'](function(_0x23d83c){if(_0x23d83c){_0x2628c5=_0x23d83c;return _0x23d83c[_0x2424('0x8e')](_0x17e968['body'][_0x2424('0x65')],_[_0x2424('0x4f')](_0x17e968[_0x2424('0x51')],['ids','id'])||{});}return null;})[_0x2424('0x66')](function(_0x63955d){var _0x7b7ee8;var _0x53ac48;_0x1d62a1=_0x63955d||[];var _0x30ba78=[];if(_0x63955d){for(var _0x626faf=0x0;_0x626faf<_0x63955d[_0x2424('0x45')];_0x626faf+=0x1){var _0xd41693=_0x63955d[_0x626faf][_0x2424('0x21')]({'plain':!![]});_0x7b7ee8=squel[_0x2424('0x7e')]()[_0x2424('0x67')](_0x2424('0x8f'))['fromQuery']([_0x2424('0x69'),_0x2424('0x6a'),_0x2424('0x6b'),'CampaignId','createdAt','updatedAt'],squel[_0x2424('0x6c')]()[_0x2424('0x6d')](_0x2424('0x69'),_0x2424('0x69'))['field']('id',_0x2424('0x6a'))[_0x2424('0x6d')](_0xd41693[_0x2424('0x74')][_0x2424('0x70')](),_0x2424('0x6b'))['field'](_0x17e968[_0x2424('0x44')]['id'][_0x2424('0x70')](),_0x2424('0x58'))[_0x2424('0x6d')](_0x2424('0x6e'),'createdAt')[_0x2424('0x6d')](_0x2424('0x6e'),_0x2424('0x50'))[_0x2424('0x71')](_0x2424('0x72'))[_0x2424('0x3a')]('deletedAt\x20IS\x20NULL')[_0x2424('0x3a')]('ListId\x20=\x20?',_0xd41693[_0x2424('0x74')]['toString']())[_0x2424('0x3a')](_0x2424('0x7c')))['toString']();_0x30ba78[_0x2424('0x88')](db[_0x2424('0x89')][_0x2424('0x2f')](_0x7b7ee8));}return BPromise['all'](_0x30ba78);}})['then'](function(){return _0x1d62a1;})[_0x2424('0x20')](respondWithResult(_0x51c062,null))['catch'](handleError(_0x51c062,null));};exports[_0x2424('0x90')]=function(_0x135b4a,_0x11d42a,_0x305756){return db[_0x2424('0x2a')][_0x2424('0x4c')]({'where':{'id':_0x135b4a[_0x2424('0x44')]['id']}})[_0x2424('0x20')](handleEntityNotFound(_0x11d42a,null))['then'](function(_0x441d1e){if(_0x441d1e){return _0x441d1e[_0x2424('0x90')](_0x135b4a[_0x2424('0x2f')][_0x2424('0x65')]);}})[_0x2424('0x20')](function(_0x261f68){if(_0x261f68){return db[_0x2424('0x60')][_0x2424('0x24')]({'where':{'ListId':_0x135b4a[_0x2424('0x2f')][_0x2424('0x65')],'CampaignId':_0x135b4a[_0x2424('0x44')]['id']}})[_0x2424('0x20')](function(){return _0x261f68;});}})[_0x2424('0x20')](respondWithStatusCode(_0x11d42a,null))['catch'](handleError(_0x11d42a,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index e4e3a97..f31b6b7 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(_0x3ef4ce,_0x5b4e3e){var _0x414d9d=function(_0x28e388){while(--_0x28e388){_0x3ef4ce['push'](_0x3ef4ce['shift']());}};_0x414d9d(++_0x5b4e3e);}(_0x7a54,0x106));var _0x47a5=function(_0x54b5c6,_0x53fd66){_0x54b5c6=_0x54b5c6-0x0;var _0x428829=_0x7a54[_0x54b5c6];return _0x428829;};'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 _0x7a54=['../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./campaign.attributes','exports','Campaign','campaigns','lodash','util'];(function(_0x58f6fd,_0x8e6c3d){var _0x44dce4=function(_0x451ea8){while(--_0x451ea8){_0x58f6fd['push'](_0x58f6fd['shift']());}};_0x44dce4(++_0x8e6c3d);}(_0x7a54,0x106));var _0x47a5=function(_0x41300c,_0x5f471e){_0x41300c=_0x41300c-0x0;var _0x28ed92=_0x7a54[_0x41300c];return _0x28ed92;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/campaign/campaign.rpc.js b/server/api/campaign/campaign.rpc.js index 1b03fbd..456ff92 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 _0xbc17=['bluebird','randomstring','../../config/utils','../../config/logger','../../config/environment','client','http','request','info','Campaign,\x20%s,\x20%s','request\x20sent','Campaign,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetCampaign','Campaign','findAll','options','raw','where','attributes','limit','include','map','model','then','debug','lodash','util'];(function(_0x5acaba,_0x383a16){var _0x1bf657=function(_0x390901){while(--_0x390901){_0x5acaba['push'](_0x5acaba['shift']());}};_0x1bf657(++_0x383a16);}(_0xbc17,0x1ab));var _0x7bc1=function(_0x354b70,_0x2ee366){_0x354b70=_0x354b70-0x0;var _0x56a7e8=_0xbc17[_0x354b70];return _0x56a7e8;};'use strict';var _=require(_0x7bc1('0x0'));var util=require(_0x7bc1('0x1'));var moment=require('moment');var BPromise=require(_0x7bc1('0x2'));var rs=require(_0x7bc1('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x7bc1('0x4'));var logger=require(_0x7bc1('0x5'))('rpc');var config=require(_0x7bc1('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x7bc1('0x7')][_0x7bc1('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1b720f,_0x3aed05,_0x3fdce7){return new BPromise(function(_0x351340,_0x3c08dc){return client[_0x7bc1('0x9')](_0x1b720f,_0x3fdce7)['then'](function(_0x48454c){logger[_0x7bc1('0xa')](_0x7bc1('0xb'),_0x3aed05,_0x7bc1('0xc'));logger['debug'](_0x7bc1('0xd'),_0x3aed05,_0x7bc1('0xc'),JSON[_0x7bc1('0xe')](_0x48454c));if(_0x48454c[_0x7bc1('0xf')]){if(_0x48454c[_0x7bc1('0xf')][_0x7bc1('0x10')]===0x1f4){logger[_0x7bc1('0xf')](_0x7bc1('0xb'),_0x3aed05,_0x48454c[_0x7bc1('0xf')]['message']);return _0x3c08dc(_0x48454c[_0x7bc1('0xf')][_0x7bc1('0x11')]);}logger['error'](_0x7bc1('0xb'),_0x3aed05,_0x48454c[_0x7bc1('0xf')]['message']);return _0x351340(_0x48454c[_0x7bc1('0xf')][_0x7bc1('0x11')]);}else{logger['info'](_0x7bc1('0xb'),_0x3aed05,_0x7bc1('0xc'));_0x351340(_0x48454c[_0x7bc1('0x12')][_0x7bc1('0x11')]);}})[_0x7bc1('0x13')](function(_0x5a5a59){logger[_0x7bc1('0xf')]('Campaign,\x20%s,\x20%s',_0x3aed05,_0x5a5a59);_0x3c08dc(_0x5a5a59);});});}exports[_0x7bc1('0x14')]=function(_0x901465){var _0xdf994=this;return new Promise(function(_0x22e6fd,_0x20ce32){return db[_0x7bc1('0x15')][_0x7bc1('0x16')]({'raw':_0x901465[_0x7bc1('0x17')]?_0x901465['options'][_0x7bc1('0x18')]===undefined?!![]:![]:!![],'where':_0x901465[_0x7bc1('0x17')]?_0x901465[_0x7bc1('0x17')][_0x7bc1('0x19')]||null:null,'attributes':_0x901465[_0x7bc1('0x17')]?_0x901465['options'][_0x7bc1('0x1a')]||null:null,'limit':_0x901465['options']?_0x901465[_0x7bc1('0x17')][_0x7bc1('0x1b')]||null:null,'include':_0x901465[_0x7bc1('0x17')]?_0x901465[_0x7bc1('0x17')][_0x7bc1('0x1c')]?_['map'](_0x901465['options'][_0x7bc1('0x1c')],function(_0x306db7){return{'model':db[_0x306db7['model']],'as':_0x306db7['as'],'attributes':_0x306db7['attributes'],'include':_0x306db7[_0x7bc1('0x1c')]?_[_0x7bc1('0x1d')](_0x306db7['include'],function(_0x1e9b8a){return{'model':db[_0x1e9b8a[_0x7bc1('0x1e')]],'as':_0x1e9b8a['as'],'attributes':_0x1e9b8a[_0x7bc1('0x1a')],'include':_0x1e9b8a[_0x7bc1('0x1c')]?_[_0x7bc1('0x1d')](_0x1e9b8a[_0x7bc1('0x1c')],function(_0x25d3a9){return{'model':db[_0x25d3a9[_0x7bc1('0x1e')]],'as':_0x25d3a9['as'],'attributes':_0x25d3a9[_0x7bc1('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x7bc1('0x1f')](function(_0x3eb13b){logger[_0x7bc1('0xa')](_0x7bc1('0x14'),_0x901465);logger[_0x7bc1('0x20')]('GetCampaign',_0x901465,JSON[_0x7bc1('0xe')](_0x3eb13b));_0x22e6fd(_0x3eb13b);})[_0x7bc1('0x13')](function(_0x26bf05){logger[_0x7bc1('0xf')](_0x7bc1('0x14'),_0x26bf05[_0x7bc1('0x11')],_0x901465);_0x20ce32(_0xdf994[_0x7bc1('0xf')](0x1f4,_0x26bf05[_0x7bc1('0x11')]));});});}; \ No newline at end of file +var _0x20ce=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Campaign,\x20%s,\x20%s','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetCampaign','Campaign','options','raw','attributes','limit','include','model','map','lodash','util','moment'];(function(_0x4df771,_0x198e2f){var _0x1cfd83=function(_0x15b866){while(--_0x15b866){_0x4df771['push'](_0x4df771['shift']());}};_0x1cfd83(++_0x198e2f);}(_0x20ce,0x10d));var _0xe20c=function(_0x3b0c30,_0x488e87){_0x3b0c30=_0x3b0c30-0x0;var _0x55ba8c=_0x20ce[_0x3b0c30];return _0x55ba8c;};'use strict';var _=require(_0xe20c('0x0'));var util=require(_0xe20c('0x1'));var moment=require(_0xe20c('0x2'));var BPromise=require('bluebird');var rs=require(_0xe20c('0x3'));var fs=require('fs');var Redis=require(_0xe20c('0x4'));var db=require(_0xe20c('0x5'))['db'];var utils=require(_0xe20c('0x6'));var logger=require(_0xe20c('0x7'))(_0xe20c('0x8'));var config=require(_0xe20c('0x9'));var jayson=require(_0xe20c('0xa'));var client=jayson[_0xe20c('0xb')][_0xe20c('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x893e48,_0x26b9be,_0x2d88b5){return new BPromise(function(_0x8f79ad,_0x290fb5){return client[_0xe20c('0xd')](_0x893e48,_0x2d88b5)[_0xe20c('0xe')](function(_0x385d61){logger[_0xe20c('0xf')](_0xe20c('0x10'),_0x26b9be,_0xe20c('0x11'));logger[_0xe20c('0x12')](_0xe20c('0x13'),_0x26b9be,_0xe20c('0x11'),JSON['stringify'](_0x385d61));if(_0x385d61[_0xe20c('0x14')]){if(_0x385d61[_0xe20c('0x14')][_0xe20c('0x15')]===0x1f4){logger[_0xe20c('0x14')](_0xe20c('0x10'),_0x26b9be,_0x385d61['error'][_0xe20c('0x16')]);return _0x290fb5(_0x385d61[_0xe20c('0x14')]['message']);}logger[_0xe20c('0x14')](_0xe20c('0x10'),_0x26b9be,_0x385d61[_0xe20c('0x14')]['message']);return _0x8f79ad(_0x385d61[_0xe20c('0x14')][_0xe20c('0x16')]);}else{logger[_0xe20c('0xf')](_0xe20c('0x10'),_0x26b9be,'request\x20sent');_0x8f79ad(_0x385d61[_0xe20c('0x17')]['message']);}})[_0xe20c('0x18')](function(_0x4061ed){logger[_0xe20c('0x14')](_0xe20c('0x10'),_0x26b9be,_0x4061ed);_0x290fb5(_0x4061ed);});});}exports[_0xe20c('0x19')]=function(_0x2d58a7){var _0x2a4292=this;return new Promise(function(_0x3d8df5,_0x305f2f){return db[_0xe20c('0x1a')]['findAll']({'raw':_0x2d58a7[_0xe20c('0x1b')]?_0x2d58a7[_0xe20c('0x1b')][_0xe20c('0x1c')]===undefined?!![]:![]:!![],'where':_0x2d58a7[_0xe20c('0x1b')]?_0x2d58a7['options']['where']||null:null,'attributes':_0x2d58a7[_0xe20c('0x1b')]?_0x2d58a7[_0xe20c('0x1b')][_0xe20c('0x1d')]||null:null,'limit':_0x2d58a7['options']?_0x2d58a7['options'][_0xe20c('0x1e')]||null:null,'include':_0x2d58a7[_0xe20c('0x1b')]?_0x2d58a7[_0xe20c('0x1b')][_0xe20c('0x1f')]?_['map'](_0x2d58a7[_0xe20c('0x1b')]['include'],function(_0x13bf33){return{'model':db[_0x13bf33[_0xe20c('0x20')]],'as':_0x13bf33['as'],'attributes':_0x13bf33[_0xe20c('0x1d')],'include':_0x13bf33[_0xe20c('0x1f')]?_[_0xe20c('0x21')](_0x13bf33[_0xe20c('0x1f')],function(_0x12846c){return{'model':db[_0x12846c['model']],'as':_0x12846c['as'],'attributes':_0x12846c[_0xe20c('0x1d')],'include':_0x12846c[_0xe20c('0x1f')]?_[_0xe20c('0x21')](_0x12846c[_0xe20c('0x1f')],function(_0x2dd621){return{'model':db[_0x2dd621[_0xe20c('0x20')]],'as':_0x2dd621['as'],'attributes':_0x2dd621[_0xe20c('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xe20c('0xe')](function(_0x562e52){logger[_0xe20c('0xf')](_0xe20c('0x19'),_0x2d58a7);logger[_0xe20c('0x12')](_0xe20c('0x19'),_0x2d58a7,JSON['stringify'](_0x562e52));_0x3d8df5(_0x562e52);})[_0xe20c('0x18')](function(_0x54df97){logger['error'](_0xe20c('0x19'),_0x54df97[_0xe20c('0x16')],_0x2d58a7);_0x305f2f(_0x2a4292[_0xe20c('0x14')](0x1f4,_0x54df97['message']));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index f52a2bb..5801728 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 _0x0834=['get','index','/:id','isAuthenticated','show','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals','getHopperBlacks','/:id/lists','getLists','getBlackLists','create','post','/:id/clone','addLists','addBlackLists','put','delete','destroy','removeLists','/:id/blacklists','exports','path','connect-timeout','../../components/auth/service','../../components/interaction/service','./campaign.controller'];(function(_0x54aaf1,_0x21b5ba){var _0x1a9abe=function(_0x1ea09b){while(--_0x1ea09b){_0x54aaf1['push'](_0x54aaf1['shift']());}};_0x1a9abe(++_0x21b5ba);}(_0x0834,0x18e));var _0x4083=function(_0x21d97e,_0x3eb1de){_0x21d97e=_0x21d97e-0x0;var _0x2623eb=_0x0834[_0x21d97e];return _0x2623eb;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x4083('0x0'));var timeout=require(_0x4083('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x4083('0x2'));var interaction=require(_0x4083('0x3'));var config=require('../../config/environment');var controller=require(_0x4083('0x4'));router[_0x4083('0x5')]('/',auth['isAuthenticated'](),controller[_0x4083('0x6')]);router['get'](_0x4083('0x7'),auth[_0x4083('0x8')](),controller[_0x4083('0x9')]);router[_0x4083('0x5')](_0x4083('0xa'),auth[_0x4083('0x8')](),controller[_0x4083('0xb')]);router[_0x4083('0x5')](_0x4083('0xc'),auth[_0x4083('0x8')](),controller[_0x4083('0xd')]);router[_0x4083('0x5')](_0x4083('0xe'),auth[_0x4083('0x8')](),controller[_0x4083('0xf')]);router['get']('/:id/hopper_black',auth[_0x4083('0x8')](),controller[_0x4083('0x10')]);router['get'](_0x4083('0x11'),auth[_0x4083('0x8')](),controller[_0x4083('0x12')]);router['get']('/:id/blacklists',auth[_0x4083('0x8')](),controller[_0x4083('0x13')]);router['post']('/',auth[_0x4083('0x8')](),controller[_0x4083('0x14')]);router[_0x4083('0x15')](_0x4083('0x16'),auth[_0x4083('0x8')](),controller['clone']);router[_0x4083('0x15')](_0x4083('0x11'),auth[_0x4083('0x8')](),controller[_0x4083('0x17')]);router['post']('/:id/blacklists',auth['isAuthenticated'](),controller[_0x4083('0x18')]);router[_0x4083('0x19')]('/:id',auth[_0x4083('0x8')](),controller['update']);router[_0x4083('0x1a')](_0x4083('0x7'),auth[_0x4083('0x8')](),controller[_0x4083('0x1b')]);router['delete'](_0x4083('0x11'),auth['isAuthenticated'](),controller[_0x4083('0x1c')]);router[_0x4083('0x1a')](_0x4083('0x1d'),auth[_0x4083('0x8')](),controller['removeBlackLists']);module[_0x4083('0x1e')]=router; \ No newline at end of file +var _0x28ed=['clone','addLists','addBlackLists','put','delete','removeLists','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./campaign.controller','get','/:id','isAuthenticated','show','getHoppers','/:id/hopper_histories','/:id/hopper_finals','/:id/hopper_black','getHopperBlacks','/:id/lists','getLists','/:id/blacklists','post','/:id/clone'];(function(_0x21f089,_0x5ebacd){var _0x59c5e7=function(_0x2af336){while(--_0x2af336){_0x21f089['push'](_0x21f089['shift']());}};_0x59c5e7(++_0x5ebacd);}(_0x28ed,0x1b9));var _0xd28e=function(_0x289818,_0x43e99f){_0x289818=_0x289818-0x0;var _0x30e9cb=_0x28ed[_0x289818];return _0x30e9cb;};'use strict';var multer=require('multer');var util=require(_0xd28e('0x0'));var path=require('path');var timeout=require(_0xd28e('0x1'));var express=require(_0xd28e('0x2'));var router=express[_0xd28e('0x3')]();var fs_extra=require(_0xd28e('0x4'));var auth=require(_0xd28e('0x5'));var interaction=require(_0xd28e('0x6'));var config=require(_0xd28e('0x7'));var controller=require(_0xd28e('0x8'));router[_0xd28e('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0xd28e('0x9')](_0xd28e('0xa'),auth[_0xd28e('0xb')](),controller[_0xd28e('0xc')]);router[_0xd28e('0x9')]('/:id/hoppers',auth[_0xd28e('0xb')](),controller[_0xd28e('0xd')]);router['get'](_0xd28e('0xe'),auth['isAuthenticated'](),controller['getHopperHistories']);router[_0xd28e('0x9')](_0xd28e('0xf'),auth[_0xd28e('0xb')](),controller['getHopperFinals']);router[_0xd28e('0x9')](_0xd28e('0x10'),auth[_0xd28e('0xb')](),controller[_0xd28e('0x11')]);router['get'](_0xd28e('0x12'),auth[_0xd28e('0xb')](),controller[_0xd28e('0x13')]);router[_0xd28e('0x9')](_0xd28e('0x14'),auth[_0xd28e('0xb')](),controller['getBlackLists']);router[_0xd28e('0x15')]('/',auth[_0xd28e('0xb')](),controller['create']);router['post'](_0xd28e('0x16'),auth[_0xd28e('0xb')](),controller[_0xd28e('0x17')]);router['post'](_0xd28e('0x12'),auth[_0xd28e('0xb')](),controller[_0xd28e('0x18')]);router[_0xd28e('0x15')](_0xd28e('0x14'),auth[_0xd28e('0xb')](),controller[_0xd28e('0x19')]);router[_0xd28e('0x1a')]('/:id',auth[_0xd28e('0xb')](),controller['update']);router['delete'](_0xd28e('0xa'),auth[_0xd28e('0xb')](),controller['destroy']);router[_0xd28e('0x1b')]('/:id/lists',auth['isAuthenticated'](),controller[_0xd28e('0x1c')]);router[_0xd28e('0x1b')](_0xd28e('0x14'),auth[_0xd28e('0xb')](),controller['removeBlackLists']);module['exports']=router; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.attributes.js b/server/api/cannedAnswer/cannedAnswer.attributes.js index 2541c36..a2242b7 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 _0xd1a2=['sequelize','exports','STRING','medium','VIRTUAL','getDataValue'];(function(_0x1876c7,_0x379202){var _0x2b9572=function(_0x9bf2ff){while(--_0x9bf2ff){_0x1876c7['push'](_0x1876c7['shift']());}};_0x2b9572(++_0x379202);}(_0xd1a2,0x12c));var _0x2d1a=function(_0x1f7290,_0x3d4325){_0x1f7290=_0x1f7290-0x0;var _0x129d16=_0xd1a2[_0x1f7290];return _0x129d16;};'use strict';var Sequelize=require(_0x2d1a('0x0'));module[_0x2d1a('0x1')]={'key':{'type':Sequelize[_0x2d1a('0x2')],'allowNull':![]},'value':{'type':Sequelize['TEXT'],'length':_0x2d1a('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x2d1a('0x2')]},'name':{'type':Sequelize[_0x2d1a('0x4')],'get':function(){return this[_0x2d1a('0x5')]('key');}}}; \ No newline at end of file +var _0xa626=['key','sequelize','exports','STRING','TEXT','medium','VIRTUAL','getDataValue'];(function(_0x3965ce,_0x4dfc39){var _0x1528b5=function(_0x5b2cb1){while(--_0x5b2cb1){_0x3965ce['push'](_0x3965ce['shift']());}};_0x1528b5(++_0x4dfc39);}(_0xa626,0x89));var _0x6a62=function(_0x396e0f,_0x402bb2){_0x396e0f=_0x396e0f-0x0;var _0x300558=_0xa626[_0x396e0f];return _0x300558;};'use strict';var Sequelize=require(_0x6a62('0x0'));module[_0x6a62('0x1')]={'key':{'type':Sequelize[_0x6a62('0x2')],'allowNull':![]},'value':{'type':Sequelize[_0x6a62('0x3')],'length':_0x6a62('0x4'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize[_0x6a62('0x5')],'get':function(){return this[_0x6a62('0x6')](_0x6a62('0x7'));}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index 466991d..f9b0c35 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 _0x244b=['count','set','Content-Range','apply','reject','then','destroy','get','CannedAnswers','UserProfileResource','error','name','index','map','CannedAnswer','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','includeAll','include','rows','catch','params','length','find','update','body','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','offset','limit'];(function(_0x25b12d,_0x1551e9){var _0x5c38bb=function(_0x4867e1){while(--_0x4867e1){_0x25b12d['push'](_0x25b12d['shift']());}};_0x5c38bb(++_0x1551e9);}(_0x244b,0x12d));var _0xb244=function(_0x3c7605,_0x16de37){_0x3c7605=_0x3c7605-0x0;var _0x2a12ba=_0x244b[_0x3c7605];return _0x2a12ba;};'use strict';var emlformat=require(_0xb244('0x0'));var rimraf=require(_0xb244('0x1'));var zipdir=require(_0xb244('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb244('0x3'));var moment=require('moment');var BPromise=require(_0xb244('0x4'));var Mustache=require(_0xb244('0x5'));var util=require('util');var path=require(_0xb244('0x6'));var sox=require(_0xb244('0x7'));var csv=require('to-csv');var ejs=require(_0xb244('0x8'));var fs=require('fs');var fs_extra=require(_0xb244('0x9'));var _=require(_0xb244('0xa'));var squel=require(_0xb244('0xb'));var crypto=require('crypto');var jsforce=require(_0xb244('0xc'));var deskjs=require(_0xb244('0xd'));var toCsv=require(_0xb244('0xe'));var querystring=require(_0xb244('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xb244('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xb244('0x11'));var hardwareService=require(_0xb244('0x12'));var logger=require('../../config/logger')(_0xb244('0x13'));var utils=require(_0xb244('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xb244('0x15'));var db=require(_0xb244('0x16'))['db'];function respondWithStatusCode(_0x283050,_0x600fce){_0x600fce=_0x600fce||0xcc;return function(_0x2e13a7){if(_0x2e13a7){return _0x283050['sendStatus'](_0x600fce);}return _0x283050[_0xb244('0x17')](_0x600fce)[_0xb244('0x18')]();};}function respondWithResult(_0x534e15,_0x333d44){_0x333d44=_0x333d44||0xc8;return function(_0x1e0f43){if(_0x1e0f43){return _0x534e15[_0xb244('0x17')](_0x333d44)['json'](_0x1e0f43);}};}function respondWithFilteredResult(_0x4d052b,_0x2ae6e4){return function(_0x558c83){if(_0x558c83){var _0x1622cb=typeof _0x2ae6e4[_0xb244('0x19')]==='undefined'&&typeof _0x2ae6e4[_0xb244('0x1a')]==='undefined';var _0x43b910=_0x558c83['count'];var _0x2b5799=_0x1622cb?0x0:_0x2ae6e4[_0xb244('0x19')];var _0x5b23c5=_0x1622cb?_0x558c83[_0xb244('0x1b')]:_0x2ae6e4['offset']+_0x2ae6e4[_0xb244('0x1a')];var _0x5c6fce;if(_0x5b23c5>=_0x43b910){_0x5b23c5=_0x43b910;_0x5c6fce=0xc8;}else{_0x5c6fce=0xce;}_0x4d052b[_0xb244('0x17')](_0x5c6fce);return _0x4d052b[_0xb244('0x1c')](_0xb244('0x1d'),_0x2b5799+'-'+_0x5b23c5+'/'+_0x43b910)['json'](_0x558c83);}return null;};}function patchUpdates(_0x3ce98a){return function(_0x647fd7){try{jsonpatch[_0xb244('0x1e')](_0x647fd7,_0x3ce98a,!![]);}catch(_0x46ede3){return BPromise[_0xb244('0x1f')](_0x46ede3);}return _0x647fd7['save']();};}function saveUpdates(_0x3c1a44,_0x4a9fd9){return function(_0x885ec2){if(_0x885ec2){return _0x885ec2['update'](_0x3c1a44)[_0xb244('0x20')](function(_0x18283b){return _0x18283b;});}return null;};}function removeEntity(_0x369c50,_0x1542ab){return function(_0x3fdbb0){if(_0x3fdbb0){return _0x3fdbb0[_0xb244('0x21')]()[_0xb244('0x20')](function(){var _0x718873=_0x3fdbb0[_0xb244('0x22')]({'plain':!![]});var _0xa77a34=_0xb244('0x23');return db[_0xb244('0x24')]['destroy']({'where':{'type':_0xa77a34,'resourceId':_0x718873['id']}})[_0xb244('0x20')](function(){return _0x3fdbb0;});})[_0xb244('0x20')](function(){_0x369c50[_0xb244('0x17')](0xcc)[_0xb244('0x18')]();});}};}function handleEntityNotFound(_0x2db535,_0x3f63a0){return function(_0x539611){if(!_0x539611){_0x2db535['sendStatus'](0x194);}return _0x539611;};}function handleError(_0x5f4676,_0x20308b){_0x20308b=_0x20308b||0x1f4;return function(_0x2f900e){logger[_0xb244('0x25')](_0x2f900e['stack']);if(_0x2f900e[_0xb244('0x26')]){delete _0x2f900e['name'];}_0x5f4676['status'](_0x20308b)['send'](_0x2f900e);};}exports[_0xb244('0x27')]=function(_0x50eb37,_0x3f7bad){var _0x5d3d48={},_0x4b300a={},_0x1ae98d={'count':0x0,'rows':[]};var _0xd4e901=_[_0xb244('0x28')](db[_0xb244('0x29')][_0xb244('0x2a')],function(_0x2f82d0){return{'name':_0x2f82d0[_0xb244('0x2b')],'type':_0x2f82d0[_0xb244('0x2c')][_0xb244('0x2d')]};});_0x4b300a[_0xb244('0x2e')]=_[_0xb244('0x28')](_0xd4e901,_0xb244('0x26'));_0x4b300a[_0xb244('0x2f')]=_[_0xb244('0x30')](_0x50eb37[_0xb244('0x2f')]);_0x4b300a[_0xb244('0x31')]=_[_0xb244('0x32')](_0x4b300a[_0xb244('0x2e')],_0x4b300a[_0xb244('0x2f')]);_0x5d3d48['attributes']=_[_0xb244('0x32')](_0x4b300a[_0xb244('0x2e')],qs[_0xb244('0x33')](_0x50eb37[_0xb244('0x2f')]['fields']));_0x5d3d48[_0xb244('0x34')]=_0x5d3d48['attributes']['length']?_0x5d3d48[_0xb244('0x34')]:_0x4b300a['model'];if(!_0x50eb37[_0xb244('0x2f')][_0xb244('0x35')](_0xb244('0x36'))){_0x5d3d48[_0xb244('0x1a')]=qs[_0xb244('0x1a')](_0x50eb37[_0xb244('0x2f')][_0xb244('0x1a')]);_0x5d3d48[_0xb244('0x19')]=qs[_0xb244('0x19')](_0x50eb37[_0xb244('0x2f')]['offset']);}_0x5d3d48[_0xb244('0x37')]=qs[_0xb244('0x38')](_0x50eb37[_0xb244('0x2f')][_0xb244('0x38')]);_0x5d3d48[_0xb244('0x39')]=qs[_0xb244('0x31')](_['pick'](_0x50eb37[_0xb244('0x2f')],_0x4b300a[_0xb244('0x31')]),_0xd4e901);if(_0x50eb37['query'][_0xb244('0x3a')]){_0x5d3d48[_0xb244('0x39')]=_[_0xb244('0x3b')](_0x5d3d48['where'],{'$or':[{'key':{'$like':'%'+_0x50eb37[_0xb244('0x2f')][_0xb244('0x3a')]+'%'}},{'value':{'$like':'%'+_0x50eb37[_0xb244('0x2f')][_0xb244('0x3a')]+'%'}}]});}_0x5d3d48=_[_0xb244('0x3b')]({},_0x5d3d48,_0x50eb37[_0xb244('0x3c')]);var _0x155416={'where':_0x5d3d48[_0xb244('0x39')]};return db[_0xb244('0x29')][_0xb244('0x1b')](_0x155416)['then'](function(_0x4a11d1){_0x1ae98d[_0xb244('0x1b')]=_0x4a11d1;if(_0x50eb37[_0xb244('0x2f')][_0xb244('0x3d')]){_0x5d3d48[_0xb244('0x3e')]=[{'all':!![]}];}return db['CannedAnswer']['findAll'](_0x5d3d48);})[_0xb244('0x20')](function(_0x2e56d8){_0x1ae98d[_0xb244('0x3f')]=_0x2e56d8;return _0x1ae98d;})['then'](respondWithFilteredResult(_0x3f7bad,_0x5d3d48))[_0xb244('0x40')](handleError(_0x3f7bad,null));};exports['show']=function(_0x5acac2,_0x5a195d){var _0x4141c6={'raw':!![],'where':{'id':_0x5acac2[_0xb244('0x41')]['id']}},_0x3d406a={};_0x3d406a[_0xb244('0x2e')]=_[_0xb244('0x30')](db['CannedAnswer'][_0xb244('0x2a')]);_0x3d406a['query']=_[_0xb244('0x30')](_0x5acac2[_0xb244('0x2f')]);_0x3d406a[_0xb244('0x31')]=_[_0xb244('0x32')](_0x3d406a['model'],_0x3d406a[_0xb244('0x2f')]);_0x4141c6[_0xb244('0x34')]=_[_0xb244('0x32')](_0x3d406a['model'],qs[_0xb244('0x33')](_0x5acac2[_0xb244('0x2f')][_0xb244('0x33')]));_0x4141c6[_0xb244('0x34')]=_0x4141c6[_0xb244('0x34')][_0xb244('0x42')]?_0x4141c6['attributes']:_0x3d406a[_0xb244('0x2e')];if(_0x5acac2[_0xb244('0x2f')][_0xb244('0x3d')]){_0x4141c6[_0xb244('0x3e')]=[{'all':!![]}];}_0x4141c6=_['merge']({},_0x4141c6,_0x5acac2[_0xb244('0x3c')]);return db[_0xb244('0x29')][_0xb244('0x43')](_0x4141c6)[_0xb244('0x20')](handleEntityNotFound(_0x5a195d,null))['then'](respondWithResult(_0x5a195d,null))[_0xb244('0x40')](handleError(_0x5a195d,null));};exports[_0xb244('0x44')]=function(_0x18d9f6,_0x203678){if(_0x18d9f6[_0xb244('0x45')]['id']){delete _0x18d9f6[_0xb244('0x45')]['id'];}return db['CannedAnswer'][_0xb244('0x43')]({'where':{'id':_0x18d9f6[_0xb244('0x41')]['id']}})['then'](handleEntityNotFound(_0x203678,null))['then'](saveUpdates(_0x18d9f6[_0xb244('0x45')],null))[_0xb244('0x20')](respondWithResult(_0x203678,null))[_0xb244('0x40')](handleError(_0x203678,null));};exports[_0xb244('0x21')]=function(_0x5562cf,_0x18e538){return db['CannedAnswer'][_0xb244('0x43')]({'where':{'id':_0x5562cf['params']['id']}})['then'](handleEntityNotFound(_0x18e538,null))[_0xb244('0x20')](removeEntity(_0x18e538,null))[_0xb244('0x40')](handleError(_0x18e538,null));};exports[_0xb244('0x46')]=function(_0x109ccf,_0x528bf2){var _0xde6fb8={'key':_0x109ccf[_0xb244('0x45')][_0xb244('0x2d')]};if(_0x109ccf[_0xb244('0x45')][_0xb244('0x47')]){_0xde6fb8[_0xb244('0x47')]=_0x109ccf[_0xb244('0x45')][_0xb244('0x47')];}else if(_0x109ccf[_0xb244('0x45')][_0xb244('0x48')]){_0xde6fb8['SmsAccountId']=_0x109ccf[_0xb244('0x45')]['SmsAccountId'];}else if(_0x109ccf[_0xb244('0x45')][_0xb244('0x49')]){_0xde6fb8[_0xb244('0x49')]=_0x109ccf[_0xb244('0x45')]['OpenchannelAccountId'];}else if(_0x109ccf[_0xb244('0x45')][_0xb244('0x4a')]){_0xde6fb8[_0xb244('0x4a')]=_0x109ccf['body'][_0xb244('0x4a')];}return db[_0xb244('0x29')][_0xb244('0x43')]({'where':_0xde6fb8})[_0xb244('0x20')](function(_0x23ad14){if(_0x23ad14){throw new db['Sequelize']['ValidationError']('The\x20inserted\x20key\x20already\x20exists.');}return db['CannedAnswer'][_0xb244('0x46')](_0x109ccf[_0xb244('0x45')]);})[_0xb244('0x20')](function(_0x245e54){var _0x4fc916=_0x109ccf['user'][_0xb244('0x22')]({'plain':!![]});if(!_0x4fc916)throw new Error(_0xb244('0x4b'));if(_0x4fc916[_0xb244('0x4c')]===_0xb244('0x4d')){var _0x1b0f56=_0x245e54[_0xb244('0x22')]({'plain':!![]});return db[_0xb244('0x4e')][_0xb244('0x43')]({'where':{'name':'CannedAnswers','userProfileId':_0x4fc916[_0xb244('0x4f')]},'raw':!![]})[_0xb244('0x20')](function(_0x37190){if(_0x37190&&_0x37190[_0xb244('0x50')]===0x0){return db[_0xb244('0x24')][_0xb244('0x46')]({'name':_0x1b0f56[_0xb244('0x26')],'resourceId':_0x1b0f56['id'],'type':_0x37190[_0xb244('0x26')],'sectionId':_0x37190['id']},{})[_0xb244('0x20')](function(){return _0x245e54;});}else{return _0x245e54;}})[_0xb244('0x40')](function(_0x5dc07e){logger['error'](_0xb244('0x51'),_0x5dc07e);throw _0x5dc07e;});}return _0x245e54;})['then'](respondWithResult(_0x528bf2,0xc9))[_0xb244('0x40')](handleError(_0x528bf2,null));}; \ No newline at end of file +var _0x23a0=['querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','then','destroy','get','CannedAnswers','UserProfileResource','error','stack','name','send','map','CannedAnswer','fieldName','type','key','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','catch','params','rawAttributes','find','update','body','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','The\x20inserted\x20key\x20already\x20exists.','role','user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js'];(function(_0x3211fe,_0x61867f){var _0x20b1db=function(_0x21ee72){while(--_0x21ee72){_0x3211fe['push'](_0x3211fe['shift']());}};_0x20b1db(++_0x61867f);}(_0x23a0,0x1a4));var _0x023a=function(_0x4f431d,_0xd51a3b){_0x4f431d=_0x4f431d-0x0;var _0x4f31e1=_0x23a0[_0x4f431d];return _0x4f31e1;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x023a('0x0'));var zipdir=require(_0x023a('0x1'));var jsonpatch=require(_0x023a('0x2'));var rp=require(_0x023a('0x3'));var moment=require(_0x023a('0x4'));var BPromise=require(_0x023a('0x5'));var Mustache=require(_0x023a('0x6'));var util=require(_0x023a('0x7'));var path=require('path');var sox=require(_0x023a('0x8'));var csv=require(_0x023a('0x9'));var ejs=require(_0x023a('0xa'));var fs=require('fs');var fs_extra=require(_0x023a('0xb'));var _=require(_0x023a('0xc'));var squel=require('squel');var crypto=require(_0x023a('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x023a('0xe'));var toCsv=require(_0x023a('0x9'));var querystring=require(_0x023a('0xf'));var Papa=require(_0x023a('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x023a('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x023a('0x12'));var logger=require(_0x023a('0x13'))('api');var utils=require(_0x023a('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x023a('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x865d51,_0x454f89){_0x454f89=_0x454f89||0xcc;return function(_0x1a6531){if(_0x1a6531){return _0x865d51[_0x023a('0x16')](_0x454f89);}return _0x865d51[_0x023a('0x17')](_0x454f89)[_0x023a('0x18')]();};}function respondWithResult(_0x247e3b,_0x3c550d){_0x3c550d=_0x3c550d||0xc8;return function(_0x3d1d03){if(_0x3d1d03){return _0x247e3b[_0x023a('0x17')](_0x3c550d)[_0x023a('0x19')](_0x3d1d03);}};}function respondWithFilteredResult(_0x1c8a70,_0x258515){return function(_0x4ad98d){if(_0x4ad98d){var _0x290c73=typeof _0x258515[_0x023a('0x1a')]==='undefined'&&typeof _0x258515[_0x023a('0x1b')]===_0x023a('0x1c');var _0x156c4c=_0x4ad98d[_0x023a('0x1d')];var _0x2c7531=_0x290c73?0x0:_0x258515[_0x023a('0x1a')];var _0x4bd762=_0x290c73?_0x4ad98d[_0x023a('0x1d')]:_0x258515['offset']+_0x258515['limit'];var _0x23e1f8;if(_0x4bd762>=_0x156c4c){_0x4bd762=_0x156c4c;_0x23e1f8=0xc8;}else{_0x23e1f8=0xce;}_0x1c8a70['status'](_0x23e1f8);return _0x1c8a70[_0x023a('0x1e')](_0x023a('0x1f'),_0x2c7531+'-'+_0x4bd762+'/'+_0x156c4c)[_0x023a('0x19')](_0x4ad98d);}return null;};}function patchUpdates(_0x545447){return function(_0x493ba6){try{jsonpatch[_0x023a('0x20')](_0x493ba6,_0x545447,!![]);}catch(_0x45fc9a){return BPromise[_0x023a('0x21')](_0x45fc9a);}return _0x493ba6[_0x023a('0x22')]();};}function saveUpdates(_0x416b5f,_0x3da2e5){return function(_0x1109c5){if(_0x1109c5){return _0x1109c5['update'](_0x416b5f)[_0x023a('0x23')](function(_0x145e89){return _0x145e89;});}return null;};}function removeEntity(_0x14968e,_0x38092a){return function(_0x113190){if(_0x113190){return _0x113190[_0x023a('0x24')]()['then'](function(){var _0x159baf=_0x113190[_0x023a('0x25')]({'plain':!![]});var _0x58ddc9=_0x023a('0x26');return db[_0x023a('0x27')][_0x023a('0x24')]({'where':{'type':_0x58ddc9,'resourceId':_0x159baf['id']}})[_0x023a('0x23')](function(){return _0x113190;});})[_0x023a('0x23')](function(){_0x14968e[_0x023a('0x17')](0xcc)[_0x023a('0x18')]();});}};}function handleEntityNotFound(_0x50f0ea,_0x5010c3){return function(_0x5ebf94){if(!_0x5ebf94){_0x50f0ea[_0x023a('0x16')](0x194);}return _0x5ebf94;};}function handleError(_0x452956,_0xd92855){_0xd92855=_0xd92855||0x1f4;return function(_0x3e2a6a){logger[_0x023a('0x28')](_0x3e2a6a[_0x023a('0x29')]);if(_0x3e2a6a[_0x023a('0x2a')]){delete _0x3e2a6a[_0x023a('0x2a')];}_0x452956[_0x023a('0x17')](_0xd92855)[_0x023a('0x2b')](_0x3e2a6a);};}exports['index']=function(_0x167d34,_0x2ded17){var _0x161034={},_0x1924db={},_0xb26ff2={'count':0x0,'rows':[]};var _0x4a09a8=_[_0x023a('0x2c')](db[_0x023a('0x2d')]['rawAttributes'],function(_0x430558){return{'name':_0x430558[_0x023a('0x2e')],'type':_0x430558[_0x023a('0x2f')][_0x023a('0x30')]};});_0x1924db[_0x023a('0x31')]=_[_0x023a('0x2c')](_0x4a09a8,_0x023a('0x2a'));_0x1924db['query']=_[_0x023a('0x32')](_0x167d34[_0x023a('0x33')]);_0x1924db[_0x023a('0x34')]=_['intersection'](_0x1924db[_0x023a('0x31')],_0x1924db[_0x023a('0x33')]);_0x161034[_0x023a('0x35')]=_[_0x023a('0x36')](_0x1924db[_0x023a('0x31')],qs[_0x023a('0x37')](_0x167d34[_0x023a('0x33')][_0x023a('0x37')]));_0x161034['attributes']=_0x161034[_0x023a('0x35')][_0x023a('0x38')]?_0x161034[_0x023a('0x35')]:_0x1924db[_0x023a('0x31')];if(!_0x167d34['query'][_0x023a('0x39')](_0x023a('0x3a'))){_0x161034[_0x023a('0x1b')]=qs[_0x023a('0x1b')](_0x167d34[_0x023a('0x33')][_0x023a('0x1b')]);_0x161034['offset']=qs['offset'](_0x167d34[_0x023a('0x33')]['offset']);}_0x161034[_0x023a('0x3b')]=qs[_0x023a('0x3c')](_0x167d34['query'][_0x023a('0x3c')]);_0x161034[_0x023a('0x3d')]=qs['filters'](_[_0x023a('0x3e')](_0x167d34[_0x023a('0x33')],_0x1924db[_0x023a('0x34')]),_0x4a09a8);if(_0x167d34['query'][_0x023a('0x3f')]){_0x161034['where']=_[_0x023a('0x40')](_0x161034[_0x023a('0x3d')],{'$or':[{'key':{'$like':'%'+_0x167d34['query'][_0x023a('0x3f')]+'%'}},{'value':{'$like':'%'+_0x167d34[_0x023a('0x33')]['filter']+'%'}}]});}_0x161034=_[_0x023a('0x40')]({},_0x161034,_0x167d34[_0x023a('0x41')]);var _0x3dda67={'where':_0x161034[_0x023a('0x3d')]};return db['CannedAnswer'][_0x023a('0x1d')](_0x3dda67)['then'](function(_0x379b0f){_0xb26ff2[_0x023a('0x1d')]=_0x379b0f;if(_0x167d34[_0x023a('0x33')][_0x023a('0x42')]){_0x161034[_0x023a('0x43')]=[{'all':!![]}];}return db[_0x023a('0x2d')][_0x023a('0x44')](_0x161034);})[_0x023a('0x23')](function(_0x20421e){_0xb26ff2['rows']=_0x20421e;return _0xb26ff2;})['then'](respondWithFilteredResult(_0x2ded17,_0x161034))[_0x023a('0x45')](handleError(_0x2ded17,null));};exports['show']=function(_0x357e1f,_0x1b948d){var _0x5b58fe={'raw':!![],'where':{'id':_0x357e1f[_0x023a('0x46')]['id']}},_0x40892c={};_0x40892c[_0x023a('0x31')]=_[_0x023a('0x32')](db['CannedAnswer'][_0x023a('0x47')]);_0x40892c[_0x023a('0x33')]=_[_0x023a('0x32')](_0x357e1f['query']);_0x40892c['filters']=_[_0x023a('0x36')](_0x40892c[_0x023a('0x31')],_0x40892c[_0x023a('0x33')]);_0x5b58fe[_0x023a('0x35')]=_[_0x023a('0x36')](_0x40892c[_0x023a('0x31')],qs[_0x023a('0x37')](_0x357e1f[_0x023a('0x33')][_0x023a('0x37')]));_0x5b58fe[_0x023a('0x35')]=_0x5b58fe[_0x023a('0x35')][_0x023a('0x38')]?_0x5b58fe['attributes']:_0x40892c[_0x023a('0x31')];if(_0x357e1f[_0x023a('0x33')][_0x023a('0x42')]){_0x5b58fe[_0x023a('0x43')]=[{'all':!![]}];}_0x5b58fe=_[_0x023a('0x40')]({},_0x5b58fe,_0x357e1f[_0x023a('0x41')]);return db[_0x023a('0x2d')][_0x023a('0x48')](_0x5b58fe)[_0x023a('0x23')](handleEntityNotFound(_0x1b948d,null))['then'](respondWithResult(_0x1b948d,null))['catch'](handleError(_0x1b948d,null));};exports[_0x023a('0x49')]=function(_0x12eeed,_0x5c8b95){if(_0x12eeed[_0x023a('0x4a')]['id']){delete _0x12eeed[_0x023a('0x4a')]['id'];}return db[_0x023a('0x2d')][_0x023a('0x48')]({'where':{'id':_0x12eeed[_0x023a('0x46')]['id']}})[_0x023a('0x23')](handleEntityNotFound(_0x5c8b95,null))['then'](saveUpdates(_0x12eeed['body'],null))[_0x023a('0x23')](respondWithResult(_0x5c8b95,null))[_0x023a('0x45')](handleError(_0x5c8b95,null));};exports[_0x023a('0x24')]=function(_0x78a1c1,_0x38f8e3){return db[_0x023a('0x2d')][_0x023a('0x48')]({'where':{'id':_0x78a1c1['params']['id']}})[_0x023a('0x23')](handleEntityNotFound(_0x38f8e3,null))[_0x023a('0x23')](removeEntity(_0x38f8e3,null))[_0x023a('0x45')](handleError(_0x38f8e3,null));};exports[_0x023a('0x4b')]=function(_0x44413c,_0xbbd81){var _0x36df50={'key':_0x44413c['body'][_0x023a('0x30')]};if(_0x44413c[_0x023a('0x4a')][_0x023a('0x4c')]){_0x36df50[_0x023a('0x4c')]=_0x44413c[_0x023a('0x4a')]['MailAccountId'];}else if(_0x44413c[_0x023a('0x4a')]['SmsAccountId']){_0x36df50['SmsAccountId']=_0x44413c[_0x023a('0x4a')][_0x023a('0x4d')];}else if(_0x44413c[_0x023a('0x4a')][_0x023a('0x4e')]){_0x36df50[_0x023a('0x4e')]=_0x44413c[_0x023a('0x4a')][_0x023a('0x4e')];}else if(_0x44413c['body']['ChatWebsiteId']){_0x36df50[_0x023a('0x4f')]=_0x44413c[_0x023a('0x4a')][_0x023a('0x4f')];}return db[_0x023a('0x2d')][_0x023a('0x48')]({'where':_0x36df50})[_0x023a('0x23')](function(_0x24a162){if(_0x24a162){throw new db[(_0x023a('0x50'))]['ValidationError'](_0x023a('0x51'));}return db['CannedAnswer'][_0x023a('0x4b')](_0x44413c[_0x023a('0x4a')]);})[_0x023a('0x23')](function(_0x5f3aac){var _0x2bd696=_0x44413c['user'][_0x023a('0x25')]({'plain':!![]});if(!_0x2bd696)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2bd696[_0x023a('0x52')]===_0x023a('0x53')){var _0xa52dc3=_0x5f3aac['get']({'plain':!![]});return db['UserProfileSection'][_0x023a('0x48')]({'where':{'name':_0x023a('0x26'),'userProfileId':_0x2bd696[_0x023a('0x54')]},'raw':!![]})[_0x023a('0x23')](function(_0x3dec40){if(_0x3dec40&&_0x3dec40[_0x023a('0x55')]===0x0){return db[_0x023a('0x27')][_0x023a('0x4b')]({'name':_0xa52dc3[_0x023a('0x2a')],'resourceId':_0xa52dc3['id'],'type':_0x3dec40['name'],'sectionId':_0x3dec40['id']},{})['then'](function(){return _0x5f3aac;});}else{return _0x5f3aac;}})[_0x023a('0x45')](function(_0x46a92e){logger[_0x023a('0x28')](_0x023a('0x56'),_0x46a92e);throw _0x46a92e;});}return _0x5f3aac;})['then'](respondWithResult(_0xbbd81,0xc9))[_0x023a('0x45')](handleError(_0xbbd81,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index efa8d62..39b0444 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 _0x5228=['request-promise','path','../../config/environment','./cannedAnswer.attributes','exports','define','CannedAnswer','tools_canned_answers','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0xd0a847,_0x72562b){var _0x2536ec=function(_0x20e4db){while(--_0x20e4db){_0xd0a847['push'](_0xd0a847['shift']());}};_0x2536ec(++_0x72562b);}(_0x5228,0xcc));var _0x8522=function(_0x23427e,_0x3309f3){_0x23427e=_0x23427e-0x0;var _0x414ba3=_0x5228[_0x23427e];return _0x414ba3;};'use strict';var _=require(_0x8522('0x0'));var util=require(_0x8522('0x1'));var logger=require(_0x8522('0x2'))(_0x8522('0x3'));var moment=require(_0x8522('0x4'));var BPromise=require(_0x8522('0x5'));var rp=require(_0x8522('0x6'));var fs=require('fs');var path=require(_0x8522('0x7'));var rimraf=require('rimraf');var config=require(_0x8522('0x8'));var attributes=require(_0x8522('0x9'));module[_0x8522('0xa')]=function(_0x11d5fe,_0x53d658){return _0x11d5fe[_0x8522('0xb')](_0x8522('0xc'),attributes,{'tableName':_0x8522('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x8522('0xe')});}; \ No newline at end of file +var _0xb19d=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cannedAnswer.attributes','exports','CannedAnswer','tools_canned_answers','utf8mb4','utf8mb4_unicode_ci','lodash'];(function(_0x2ab731,_0xff00ef){var _0xe6fbcf=function(_0x931811){while(--_0x931811){_0x2ab731['push'](_0x2ab731['shift']());}};_0xe6fbcf(++_0xff00ef);}(_0xb19d,0x8b));var _0xdb19=function(_0xb0de07,_0x3ca2a0){_0xb0de07=_0xb0de07-0x0;var _0x4633d8=_0xb19d[_0xb0de07];return _0x4633d8;};'use strict';var _=require(_0xdb19('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xdb19('0x1'));var moment=require(_0xdb19('0x2'));var BPromise=require(_0xdb19('0x3'));var rp=require(_0xdb19('0x4'));var fs=require('fs');var path=require(_0xdb19('0x5'));var rimraf=require(_0xdb19('0x6'));var config=require(_0xdb19('0x7'));var attributes=require(_0xdb19('0x8'));module[_0xdb19('0x9')]=function(_0x54124f,_0x3d32ce){return _0x54124f['define'](_0xdb19('0xa'),attributes,{'tableName':_0xdb19('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xdb19('0xc'),'collate':_0xdb19('0xd')});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index ca6a166..093ffcc 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(_0xc25d,_0x9ec289){var _0x3aa213=function(_0x404f5f){while(--_0x404f5f){_0xc25d['push'](_0xc25d['shift']());}};_0x3aa213(++_0x9ec289);}(_0xa9e0,0x123));var _0x0a9e=function(_0x387777,_0x356171){_0x387777=_0x387777-0x0;var _0x3f84c0=_0xa9e0[_0x387777];return _0x3f84c0;};'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(_0x389147,_0x47145d){var _0xbdfea2=function(_0x320dc9){while(--_0x320dc9){_0x389147['push'](_0x389147['shift']());}};_0xbdfea2(++_0x47145d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2bf141,_0x31eac7){_0x2bf141=_0x2bf141-0x0;var _0x48277b=_0xa9e0[_0x2bf141];return _0x48277b;};'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 ad5c776..6f28875 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 _0x5574=['delete','destroy','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./cannedAnswer.controller','isAuthenticated','get','create','put','/:id'];(function(_0x2894e1,_0x46e6a0){var _0x5df491=function(_0x1eb4c2){while(--_0x1eb4c2){_0x2894e1['push'](_0x2894e1['shift']());}};_0x5df491(++_0x46e6a0);}(_0x5574,0xaa));var _0x4557=function(_0x439c35,_0x552da7){_0x439c35=_0x439c35-0x0;var _0xd68b45=_0x5574[_0x439c35];return _0xd68b45;};'use strict';var multer=require('multer');var util=require(_0x4557('0x0'));var path=require('path');var timeout=require(_0x4557('0x1'));var express=require(_0x4557('0x2'));var router=express[_0x4557('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x4557('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x4557('0x5'));var controller=require(_0x4557('0x6'));router['get']('/',auth[_0x4557('0x7')](),controller['index']);router[_0x4557('0x8')]('/:id',auth[_0x4557('0x7')](),controller['show']);router['post']('/',auth[_0x4557('0x7')](),controller[_0x4557('0x9')]);router[_0x4557('0xa')](_0x4557('0xb'),auth[_0x4557('0x7')](),controller['update']);router[_0x4557('0xc')](_0x4557('0xb'),auth[_0x4557('0x7')](),controller[_0x4557('0xd')]);module['exports']=router; \ No newline at end of file +var _0x8f78=['put','/:id','destroy','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cannedAnswer.controller','get','isAuthenticated','index','show','post','create'];(function(_0x57cc06,_0x25b1c7){var _0x1a35f6=function(_0x3ff448){while(--_0x3ff448){_0x57cc06['push'](_0x57cc06['shift']());}};_0x1a35f6(++_0x25b1c7);}(_0x8f78,0x6f));var _0x88f7=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x8f78[_0x618414];return _0x21c19a;};'use strict';var multer=require('multer');var util=require(_0x88f7('0x0'));var path=require(_0x88f7('0x1'));var timeout=require(_0x88f7('0x2'));var express=require(_0x88f7('0x3'));var router=express[_0x88f7('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x88f7('0x5'));var interaction=require(_0x88f7('0x6'));var config=require(_0x88f7('0x7'));var controller=require(_0x88f7('0x8'));router[_0x88f7('0x9')]('/',auth[_0x88f7('0xa')](),controller[_0x88f7('0xb')]);router[_0x88f7('0x9')]('/:id',auth[_0x88f7('0xa')](),controller[_0x88f7('0xc')]);router[_0x88f7('0xd')]('/',auth['isAuthenticated'](),controller[_0x88f7('0xe')]);router[_0x88f7('0xf')]('/:id',auth[_0x88f7('0xa')](),controller['update']);router['delete'](_0x88f7('0x10'),auth[_0x88f7('0xa')](),controller[_0x88f7('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cdr/cdr.attributes.js b/server/api/cdr/cdr.attributes.js index ea61d5b..91db337 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 _0xb584=['STRING','INTEGER','DATE'];(function(_0x1d9aa0,_0x272488){var _0x226868=function(_0x17127c){while(--_0x17127c){_0x1d9aa0['push'](_0x1d9aa0['shift']());}};_0x226868(++_0x272488);}(_0xb584,0x1c1));var _0x4b58=function(_0x3c7c71,_0x9c0c2){_0x3c7c71=_0x3c7c71-0x0;var _0x516df7=_0xb584[_0x3c7c71];return _0x516df7;};'use strict';var Sequelize=require('sequelize');module['exports']={'calldate':{'type':Sequelize[_0x4b58('0x0')],'allowNull':![],'defaultValue':'1970-01-01\x2000:00:01'},'clid':{'type':Sequelize[_0x4b58('0x1')]},'src':{'type':Sequelize['STRING']},'dst':{'type':Sequelize[_0x4b58('0x1')]},'dcontext':{'type':Sequelize[_0x4b58('0x1')]},'channel':{'type':Sequelize[_0x4b58('0x1')]},'dstchannel':{'type':Sequelize[_0x4b58('0x1')]},'lastapp':{'type':Sequelize[_0x4b58('0x1')]},'lastdata':{'type':Sequelize[_0x4b58('0x1')]},'duration':{'type':Sequelize[_0x4b58('0x2')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x4b58('0x2')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x4b58('0x1')]},'userfield':{'type':Sequelize[_0x4b58('0x1')]},'uniqueid':{'type':Sequelize[_0x4b58('0x1')]},'linkedid':{'type':Sequelize[_0x4b58('0x1')]},'sequence':{'type':Sequelize['STRING']},'peeraccount':{'type':Sequelize[_0x4b58('0x1')]},'type':{'type':Sequelize[_0x4b58('0x1')]},'tag':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xc68d=['STRING','INTEGER','exports','DATE'];(function(_0x29dc54,_0x2cc32e){var _0xaabea6=function(_0x172357){while(--_0x172357){_0x29dc54['push'](_0x29dc54['shift']());}};_0xaabea6(++_0x2cc32e);}(_0xc68d,0x17a));var _0xdc68=function(_0x3d51f8,_0x1d86e1){_0x3d51f8=_0x3d51f8-0x0;var _0x4fd7d1=_0xc68d[_0x3d51f8];return _0x4fd7d1;};'use strict';var Sequelize=require('sequelize');module[_0xdc68('0x0')]={'calldate':{'type':Sequelize[_0xdc68('0x1')],'allowNull':![],'defaultValue':'1970-01-01\x2000:00:01'},'clid':{'type':Sequelize['STRING']},'src':{'type':Sequelize[_0xdc68('0x2')]},'dst':{'type':Sequelize[_0xdc68('0x2')]},'dcontext':{'type':Sequelize[_0xdc68('0x2')]},'channel':{'type':Sequelize[_0xdc68('0x2')]},'dstchannel':{'type':Sequelize[_0xdc68('0x2')]},'lastapp':{'type':Sequelize[_0xdc68('0x2')]},'lastdata':{'type':Sequelize['STRING']},'duration':{'type':Sequelize[_0xdc68('0x3')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0xdc68('0x3')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xdc68('0x2')]},'amaflags':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0xdc68('0x2')]},'userfield':{'type':Sequelize[_0xdc68('0x2')]},'uniqueid':{'type':Sequelize[_0xdc68('0x2')]},'linkedid':{'type':Sequelize['STRING']},'sequence':{'type':Sequelize['STRING']},'peeraccount':{'type':Sequelize[_0xdc68('0x2')]},'type':{'type':Sequelize[_0xdc68('0x2')]},'tag':{'type':Sequelize[_0xdc68('0x2')]}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index 312c16c..d5a2cae 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 _0x24ca=['squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','save','destroy','then','error','send','index','map','Cdr','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','name','merge','options','includeAll','include','findAll','show','params','length','find','catch','create','update','body','describe','eml-format','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv'];(function(_0x21ee0e,_0x317447){var _0x3c180c=function(_0x1b3698){while(--_0x1b3698){_0x21ee0e['push'](_0x21ee0e['shift']());}};_0x3c180c(++_0x317447);}(_0x24ca,0x8c));var _0xa24c=function(_0x4bb145,_0x3e7d33){_0x4bb145=_0x4bb145-0x0;var _0x4db596=_0x24ca[_0x4bb145];return _0x4db596;};'use strict';var emlformat=require(_0xa24c('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xa24c('0x1'));var rp=require('request-promise');var moment=require(_0xa24c('0x2'));var BPromise=require(_0xa24c('0x3'));var Mustache=require(_0xa24c('0x4'));var util=require('util');var path=require(_0xa24c('0x5'));var sox=require(_0xa24c('0x6'));var csv=require(_0xa24c('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xa24c('0x8'));var crypto=require(_0xa24c('0x9'));var jsforce=require(_0xa24c('0xa'));var deskjs=require(_0xa24c('0xb'));var toCsv=require(_0xa24c('0x7'));var querystring=require(_0xa24c('0xc'));var Papa=require('papaparse');var Redis=require(_0xa24c('0xd'));var authService=require(_0xa24c('0xe'));var qs=require(_0xa24c('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xa24c('0x10'))(_0xa24c('0x11'));var utils=require(_0xa24c('0x12'));var config=require(_0xa24c('0x13'));var licenseUtil=require(_0xa24c('0x14'));var db=require(_0xa24c('0x15'))['db'];function respondWithStatusCode(_0x566313,_0x5bb631){_0x5bb631=_0x5bb631||0xcc;return function(_0x4907f6){if(_0x4907f6){return _0x566313[_0xa24c('0x16')](_0x5bb631);}return _0x566313[_0xa24c('0x17')](_0x5bb631)[_0xa24c('0x18')]();};}function respondWithResult(_0x9fe9e3,_0x4351a8){_0x4351a8=_0x4351a8||0xc8;return function(_0x4971af){if(_0x4971af){return _0x9fe9e3[_0xa24c('0x17')](_0x4351a8)['json'](_0x4971af);}};}function respondWithFilteredResult(_0x493bcb,_0x588acf){return function(_0x2e8dc9){if(_0x2e8dc9){var _0x2a4270=typeof _0x588acf[_0xa24c('0x19')]===_0xa24c('0x1a')&&typeof _0x588acf[_0xa24c('0x1b')]===_0xa24c('0x1a');var _0x2197da=_0x2e8dc9[_0xa24c('0x1c')];var _0x14f0aa=_0x2a4270?0x0:_0x588acf[_0xa24c('0x19')];var _0x1970fc=_0x2a4270?_0x2e8dc9[_0xa24c('0x1c')]:_0x588acf[_0xa24c('0x19')]+_0x588acf[_0xa24c('0x1b')];var _0x5276b6;if(_0x1970fc>=_0x2197da){_0x1970fc=_0x2197da;_0x5276b6=0xc8;}else{_0x5276b6=0xce;}_0x493bcb[_0xa24c('0x17')](_0x5276b6);return _0x493bcb['set'](_0xa24c('0x1d'),_0x14f0aa+'-'+_0x1970fc+'/'+_0x2197da)[_0xa24c('0x1e')](_0x2e8dc9);}return null;};}function patchUpdates(_0x8c3949){return function(_0x37e20e){try{jsonpatch[_0xa24c('0x1f')](_0x37e20e,_0x8c3949,!![]);}catch(_0x416dea){return BPromise[_0xa24c('0x20')](_0x416dea);}return _0x37e20e[_0xa24c('0x21')]();};}function saveUpdates(_0xba710,_0x2ec5ad){return function(_0x2b471a){if(_0x2b471a){return _0x2b471a['update'](_0xba710)['then'](function(_0x10fa25){return _0x10fa25;});}return null;};}function removeEntity(_0xdd32a8,_0x316a68){return function(_0x1a04ff){if(_0x1a04ff){return _0x1a04ff[_0xa24c('0x22')]()[_0xa24c('0x23')](function(){_0xdd32a8[_0xa24c('0x17')](0xcc)[_0xa24c('0x18')]();});}};}function handleEntityNotFound(_0x304d6c,_0x4dc3dc){return function(_0x2290e1){if(!_0x2290e1){_0x304d6c['sendStatus'](0x194);}return _0x2290e1;};}function handleError(_0x1f347b,_0x256fbc){_0x256fbc=_0x256fbc||0x1f4;return function(_0x471421){logger[_0xa24c('0x24')](_0x471421['stack']);if(_0x471421['name']){delete _0x471421['name'];}_0x1f347b['status'](_0x256fbc)[_0xa24c('0x25')](_0x471421);};}exports[_0xa24c('0x26')]=function(_0xab6197,_0x1cdee4){var _0x37cbd3={},_0x5361d4={},_0x5c8113={'count':0x0,'rows':[]};var _0x33c208=_[_0xa24c('0x27')](db[_0xa24c('0x28')][_0xa24c('0x29')],function(_0x4566dc){return{'name':_0x4566dc[_0xa24c('0x2a')],'type':_0x4566dc[_0xa24c('0x2b')][_0xa24c('0x2c')]};});_0x5361d4[_0xa24c('0x2d')]=_[_0xa24c('0x27')](_0x33c208,'name');_0x5361d4[_0xa24c('0x2e')]=_[_0xa24c('0x2f')](_0xab6197['query']);_0x5361d4[_0xa24c('0x30')]=_[_0xa24c('0x31')](_0x5361d4[_0xa24c('0x2d')],_0x5361d4[_0xa24c('0x2e')]);_0x37cbd3[_0xa24c('0x32')]=_[_0xa24c('0x31')](_0x5361d4[_0xa24c('0x2d')],qs[_0xa24c('0x33')](_0xab6197[_0xa24c('0x2e')][_0xa24c('0x33')]));_0x37cbd3['attributes']=_0x37cbd3['attributes']['length']?_0x37cbd3[_0xa24c('0x32')]:_0x5361d4['model'];if(!_0xab6197[_0xa24c('0x2e')][_0xa24c('0x34')](_0xa24c('0x35'))){_0x37cbd3['limit']=qs[_0xa24c('0x1b')](_0xab6197[_0xa24c('0x2e')][_0xa24c('0x1b')]);_0x37cbd3['offset']=qs[_0xa24c('0x19')](_0xab6197[_0xa24c('0x2e')]['offset']);}_0x37cbd3[_0xa24c('0x36')]=qs[_0xa24c('0x37')](_0xab6197[_0xa24c('0x2e')]['sort']);_0x37cbd3[_0xa24c('0x38')]=qs[_0xa24c('0x30')](_[_0xa24c('0x39')](_0xab6197[_0xa24c('0x2e')],_0x5361d4[_0xa24c('0x30')]),_0x33c208);if(_0xab6197['query'][_0xa24c('0x3a')]){_0x37cbd3[_0xa24c('0x38')]=_['merge'](_0x37cbd3[_0xa24c('0x38')],{'$or':_[_0xa24c('0x27')](_0x33c208,function(_0x2417d9){if(_0x2417d9['type']!=='VIRTUAL'){var _0x1f7535={};_0x1f7535[_0x2417d9[_0xa24c('0x3b')]]={'$like':'%'+_0xab6197[_0xa24c('0x2e')][_0xa24c('0x3a')]+'%'};return _0x1f7535;}})});}_0x37cbd3=_[_0xa24c('0x3c')]({},_0x37cbd3,_0xab6197[_0xa24c('0x3d')]);var _0x54ea40={'where':_0x37cbd3[_0xa24c('0x38')]};return db[_0xa24c('0x28')][_0xa24c('0x1c')](_0x54ea40)[_0xa24c('0x23')](function(_0x5f3cd4){_0x5c8113[_0xa24c('0x1c')]=_0x5f3cd4;if(_0xab6197[_0xa24c('0x2e')][_0xa24c('0x3e')]){_0x37cbd3[_0xa24c('0x3f')]=[{'all':!![]}];}return db[_0xa24c('0x28')][_0xa24c('0x40')](_0x37cbd3);})[_0xa24c('0x23')](function(_0x54939b){_0x5c8113['rows']=_0x54939b;return _0x5c8113;})[_0xa24c('0x23')](respondWithFilteredResult(_0x1cdee4,_0x37cbd3))['catch'](handleError(_0x1cdee4,null));};exports[_0xa24c('0x41')]=function(_0x4fae76,_0x32e151){var _0x214627={'raw':!![],'where':{'id':_0x4fae76[_0xa24c('0x42')]['id']}},_0x37372d={};_0x37372d[_0xa24c('0x2d')]=_[_0xa24c('0x2f')](db[_0xa24c('0x28')][_0xa24c('0x29')]);_0x37372d[_0xa24c('0x2e')]=_[_0xa24c('0x2f')](_0x4fae76[_0xa24c('0x2e')]);_0x37372d[_0xa24c('0x30')]=_[_0xa24c('0x31')](_0x37372d[_0xa24c('0x2d')],_0x37372d[_0xa24c('0x2e')]);_0x214627[_0xa24c('0x32')]=_['intersection'](_0x37372d[_0xa24c('0x2d')],qs[_0xa24c('0x33')](_0x4fae76[_0xa24c('0x2e')]['fields']));_0x214627[_0xa24c('0x32')]=_0x214627[_0xa24c('0x32')][_0xa24c('0x43')]?_0x214627[_0xa24c('0x32')]:_0x37372d['model'];if(_0x4fae76[_0xa24c('0x2e')][_0xa24c('0x3e')]){_0x214627[_0xa24c('0x3f')]=[{'all':!![]}];}_0x214627=_[_0xa24c('0x3c')]({},_0x214627,_0x4fae76[_0xa24c('0x3d')]);return db[_0xa24c('0x28')][_0xa24c('0x44')](_0x214627)[_0xa24c('0x23')](handleEntityNotFound(_0x32e151,null))[_0xa24c('0x23')](respondWithResult(_0x32e151,null))[_0xa24c('0x45')](handleError(_0x32e151,null));};exports[_0xa24c('0x46')]=function(_0xeac74f,_0x261c41){return db['Cdr'][_0xa24c('0x46')](_0xeac74f['body'],{})[_0xa24c('0x23')](respondWithResult(_0x261c41,0xc9))[_0xa24c('0x45')](handleError(_0x261c41,null));};exports[_0xa24c('0x47')]=function(_0x1641b8,_0xd4761e){if(_0x1641b8[_0xa24c('0x48')]['id']){delete _0x1641b8[_0xa24c('0x48')]['id'];}return db[_0xa24c('0x28')][_0xa24c('0x44')]({'where':{'id':_0x1641b8[_0xa24c('0x42')]['id']}})[_0xa24c('0x23')](handleEntityNotFound(_0xd4761e,null))[_0xa24c('0x23')](saveUpdates(_0x1641b8[_0xa24c('0x48')],null))['then'](respondWithResult(_0xd4761e,null))[_0xa24c('0x45')](handleError(_0xd4761e,null));};exports[_0xa24c('0x22')]=function(_0x3875fb,_0x456181){return db['Cdr'][_0xa24c('0x44')]({'where':{'id':_0x3875fb[_0xa24c('0x42')]['id']}})[_0xa24c('0x23')](handleEntityNotFound(_0x456181,null))['then'](removeEntity(_0x456181,null))['catch'](handleError(_0x456181,null));};exports[_0xa24c('0x49')]=function(_0x1c8980,_0x4992ee){return db[_0xa24c('0x28')][_0xa24c('0x49')]()['then'](respondWithResult(_0x4992ee,null))[_0xa24c('0x45')](handleError(_0x4992ee,null));}; \ No newline at end of file +var _0xe107=['Cdr','rawAttributes','fieldName','key','model','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','merge','type','VIRTUAL','filter','options','include','rows','catch','show','params','includeAll','create','body','find','describe','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','path','sox','to-csv','lodash','squel','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index'];(function(_0x214c08,_0x2e903a){var _0x67963a=function(_0x30334c){while(--_0x30334c){_0x214c08['push'](_0x214c08['shift']());}};_0x67963a(++_0x2e903a);}(_0xe107,0xb3));var _0x7e10=function(_0x179168,_0x8f4f27){_0x179168=_0x179168-0x0;var _0x4f0260=_0xe107[_0x179168];return _0x4f0260;};'use strict';var emlformat=require(_0x7e10('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7e10('0x1'));var jsonpatch=require(_0x7e10('0x2'));var rp=require(_0x7e10('0x3'));var moment=require('moment');var BPromise=require(_0x7e10('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x7e10('0x5'));var sox=require(_0x7e10('0x6'));var csv=require(_0x7e10('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7e10('0x8'));var squel=require(_0x7e10('0x9'));var crypto=require(_0x7e10('0xa'));var jsforce=require(_0x7e10('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x7e10('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x7e10('0xd'));var qs=require(_0x7e10('0xe'));var as=require(_0x7e10('0xf'));var hardwareService=require(_0x7e10('0x10'));var logger=require(_0x7e10('0x11'))('api');var utils=require(_0x7e10('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x7e10('0x13'));var db=require(_0x7e10('0x14'))['db'];function respondWithStatusCode(_0x2f4d72,_0x5434dd){_0x5434dd=_0x5434dd||0xcc;return function(_0xc2e42b){if(_0xc2e42b){return _0x2f4d72[_0x7e10('0x15')](_0x5434dd);}return _0x2f4d72[_0x7e10('0x16')](_0x5434dd)[_0x7e10('0x17')]();};}function respondWithResult(_0x119ff5,_0x1b4d9d){_0x1b4d9d=_0x1b4d9d||0xc8;return function(_0x1c2b22){if(_0x1c2b22){return _0x119ff5[_0x7e10('0x16')](_0x1b4d9d)['json'](_0x1c2b22);}};}function respondWithFilteredResult(_0x15e9e5,_0x433221){return function(_0x4bd78a){if(_0x4bd78a){var _0x48339f=typeof _0x433221[_0x7e10('0x18')]==='undefined'&&typeof _0x433221[_0x7e10('0x19')]===_0x7e10('0x1a');var _0xdbda1a=_0x4bd78a[_0x7e10('0x1b')];var _0x4fd639=_0x48339f?0x0:_0x433221[_0x7e10('0x18')];var _0x2b4850=_0x48339f?_0x4bd78a[_0x7e10('0x1b')]:_0x433221['offset']+_0x433221[_0x7e10('0x19')];var _0x36149a;if(_0x2b4850>=_0xdbda1a){_0x2b4850=_0xdbda1a;_0x36149a=0xc8;}else{_0x36149a=0xce;}_0x15e9e5[_0x7e10('0x16')](_0x36149a);return _0x15e9e5[_0x7e10('0x1c')](_0x7e10('0x1d'),_0x4fd639+'-'+_0x2b4850+'/'+_0xdbda1a)['json'](_0x4bd78a);}return null;};}function patchUpdates(_0x45a0cb){return function(_0x2c6227){try{jsonpatch['apply'](_0x2c6227,_0x45a0cb,!![]);}catch(_0x3c5629){return BPromise[_0x7e10('0x1e')](_0x3c5629);}return _0x2c6227[_0x7e10('0x1f')]();};}function saveUpdates(_0x482faa,_0x4a667b){return function(_0x415cb7){if(_0x415cb7){return _0x415cb7[_0x7e10('0x20')](_0x482faa)[_0x7e10('0x21')](function(_0x1c72df){return _0x1c72df;});}return null;};}function removeEntity(_0x35e7c9,_0x105a55){return function(_0x12c36d){if(_0x12c36d){return _0x12c36d[_0x7e10('0x22')]()['then'](function(){_0x35e7c9['status'](0xcc)[_0x7e10('0x17')]();});}};}function handleEntityNotFound(_0xe34c1e,_0x1bfe8a){return function(_0x13eeb3){if(!_0x13eeb3){_0xe34c1e['sendStatus'](0x194);}return _0x13eeb3;};}function handleError(_0x537365,_0x116446){_0x116446=_0x116446||0x1f4;return function(_0x12ba1b){logger[_0x7e10('0x23')](_0x12ba1b[_0x7e10('0x24')]);if(_0x12ba1b[_0x7e10('0x25')]){delete _0x12ba1b[_0x7e10('0x25')];}_0x537365[_0x7e10('0x16')](_0x116446)[_0x7e10('0x26')](_0x12ba1b);};}exports[_0x7e10('0x27')]=function(_0x3b020c,_0x5691f8){var _0x4e225d={},_0xbc509={},_0x884343={'count':0x0,'rows':[]};var _0x560460=_['map'](db[_0x7e10('0x28')][_0x7e10('0x29')],function(_0x537587){return{'name':_0x537587[_0x7e10('0x2a')],'type':_0x537587['type'][_0x7e10('0x2b')]};});_0xbc509[_0x7e10('0x2c')]=_[_0x7e10('0x2d')](_0x560460,_0x7e10('0x25'));_0xbc509[_0x7e10('0x2e')]=_[_0x7e10('0x2f')](_0x3b020c['query']);_0xbc509[_0x7e10('0x30')]=_['intersection'](_0xbc509[_0x7e10('0x2c')],_0xbc509[_0x7e10('0x2e')]);_0x4e225d[_0x7e10('0x31')]=_[_0x7e10('0x32')](_0xbc509[_0x7e10('0x2c')],qs[_0x7e10('0x33')](_0x3b020c[_0x7e10('0x2e')][_0x7e10('0x33')]));_0x4e225d[_0x7e10('0x31')]=_0x4e225d['attributes'][_0x7e10('0x34')]?_0x4e225d[_0x7e10('0x31')]:_0xbc509[_0x7e10('0x2c')];if(!_0x3b020c[_0x7e10('0x2e')][_0x7e10('0x35')]('nolimit')){_0x4e225d[_0x7e10('0x19')]=qs[_0x7e10('0x19')](_0x3b020c[_0x7e10('0x2e')][_0x7e10('0x19')]);_0x4e225d['offset']=qs['offset'](_0x3b020c[_0x7e10('0x2e')][_0x7e10('0x18')]);}_0x4e225d[_0x7e10('0x36')]=qs[_0x7e10('0x37')](_0x3b020c['query'][_0x7e10('0x37')]);_0x4e225d[_0x7e10('0x38')]=qs['filters'](_[_0x7e10('0x39')](_0x3b020c[_0x7e10('0x2e')],_0xbc509['filters']),_0x560460);if(_0x3b020c['query']['filter']){_0x4e225d[_0x7e10('0x38')]=_[_0x7e10('0x3a')](_0x4e225d[_0x7e10('0x38')],{'$or':_[_0x7e10('0x2d')](_0x560460,function(_0xd696d2){if(_0xd696d2[_0x7e10('0x3b')]!==_0x7e10('0x3c')){var _0x419085={};_0x419085[_0xd696d2['name']]={'$like':'%'+_0x3b020c[_0x7e10('0x2e')][_0x7e10('0x3d')]+'%'};return _0x419085;}})});}_0x4e225d=_[_0x7e10('0x3a')]({},_0x4e225d,_0x3b020c[_0x7e10('0x3e')]);var _0x4ebf4a={'where':_0x4e225d[_0x7e10('0x38')]};return db[_0x7e10('0x28')][_0x7e10('0x1b')](_0x4ebf4a)[_0x7e10('0x21')](function(_0x3ad2f0){_0x884343[_0x7e10('0x1b')]=_0x3ad2f0;if(_0x3b020c[_0x7e10('0x2e')]['includeAll']){_0x4e225d[_0x7e10('0x3f')]=[{'all':!![]}];}return db[_0x7e10('0x28')]['findAll'](_0x4e225d);})[_0x7e10('0x21')](function(_0x5c62ac){_0x884343[_0x7e10('0x40')]=_0x5c62ac;return _0x884343;})['then'](respondWithFilteredResult(_0x5691f8,_0x4e225d))[_0x7e10('0x41')](handleError(_0x5691f8,null));};exports[_0x7e10('0x42')]=function(_0x1940ff,_0x18e9b2){var _0x3c6a01={'raw':!![],'where':{'id':_0x1940ff[_0x7e10('0x43')]['id']}},_0x4c2946={};_0x4c2946[_0x7e10('0x2c')]=_[_0x7e10('0x2f')](db[_0x7e10('0x28')][_0x7e10('0x29')]);_0x4c2946['query']=_[_0x7e10('0x2f')](_0x1940ff[_0x7e10('0x2e')]);_0x4c2946['filters']=_['intersection'](_0x4c2946[_0x7e10('0x2c')],_0x4c2946[_0x7e10('0x2e')]);_0x3c6a01['attributes']=_[_0x7e10('0x32')](_0x4c2946['model'],qs[_0x7e10('0x33')](_0x1940ff['query'][_0x7e10('0x33')]));_0x3c6a01[_0x7e10('0x31')]=_0x3c6a01['attributes']['length']?_0x3c6a01['attributes']:_0x4c2946['model'];if(_0x1940ff['query'][_0x7e10('0x44')]){_0x3c6a01[_0x7e10('0x3f')]=[{'all':!![]}];}_0x3c6a01=_[_0x7e10('0x3a')]({},_0x3c6a01,_0x1940ff[_0x7e10('0x3e')]);return db[_0x7e10('0x28')]['find'](_0x3c6a01)[_0x7e10('0x21')](handleEntityNotFound(_0x18e9b2,null))['then'](respondWithResult(_0x18e9b2,null))[_0x7e10('0x41')](handleError(_0x18e9b2,null));};exports[_0x7e10('0x45')]=function(_0x43745a,_0x290f9c){return db['Cdr']['create'](_0x43745a[_0x7e10('0x46')],{})[_0x7e10('0x21')](respondWithResult(_0x290f9c,0xc9))['catch'](handleError(_0x290f9c,null));};exports['update']=function(_0x2ceaec,_0x3f0a05){if(_0x2ceaec[_0x7e10('0x46')]['id']){delete _0x2ceaec[_0x7e10('0x46')]['id'];}return db[_0x7e10('0x28')][_0x7e10('0x47')]({'where':{'id':_0x2ceaec[_0x7e10('0x43')]['id']}})[_0x7e10('0x21')](handleEntityNotFound(_0x3f0a05,null))['then'](saveUpdates(_0x2ceaec[_0x7e10('0x46')],null))['then'](respondWithResult(_0x3f0a05,null))[_0x7e10('0x41')](handleError(_0x3f0a05,null));};exports[_0x7e10('0x22')]=function(_0x29bd0d,_0x4fec7f){return db['Cdr'][_0x7e10('0x47')]({'where':{'id':_0x29bd0d[_0x7e10('0x43')]['id']}})[_0x7e10('0x21')](handleEntityNotFound(_0x4fec7f,null))[_0x7e10('0x21')](removeEntity(_0x4fec7f,null))[_0x7e10('0x41')](handleError(_0x4fec7f,null));};exports['describe']=function(_0x39c23d,_0x498ebf){return db['Cdr'][_0x7e10('0x48')]()[_0x7e10('0x21')](respondWithResult(_0x498ebf,null))['catch'](handleError(_0x498ebf,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index 279a350..e1565f6 100644 --- a/server/api/cdr/cdr.model.js +++ b/server/api/cdr/cdr.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['Cdr','cdr','accountcode','disposition','dst','src','uniqueid','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./cdr.attributes','exports'];(function(_0x1f0821,_0x3c6eff){var _0x382a17=function(_0x42911c){while(--_0x42911c){_0x1f0821['push'](_0x1f0821['shift']());}};_0x382a17(++_0x3c6eff);}(_0x7a54,0x106));var _0x47a5=function(_0x1145b1,_0x4041bf){_0x1145b1=_0x1145b1-0x0;var _0x733832=_0x7a54[_0x1145b1];return _0x733832;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[{'name':'accountcode','fields':[_0x47a5('0xc')]},{'name':'calldate','fields':['calldate']},{'name':'disposition','fields':[_0x47a5('0xd')]},{'name':_0x47a5('0xe'),'fields':['dst']},{'name':_0x47a5('0xf'),'fields':['src']},{'name':'uniqueid','fields':[_0x47a5('0x10')]}],'timestamps':![]});}; \ No newline at end of file +var _0x9957=['dst','src','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./cdr.attributes','exports','define','Cdr','accountcode','calldate','disposition'];(function(_0x48c100,_0x566f57){var _0x34dc16=function(_0x3133a7){while(--_0x3133a7){_0x48c100['push'](_0x48c100['shift']());}};_0x34dc16(++_0x566f57);}(_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':'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 c90288e..33672db 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 _0xfa35=['message','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info','Cdr,\x20%s,\x20%s','debug','Cdr,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x4e0f30,_0x296fc5){var _0x3cb81d=function(_0x245df7){while(--_0x245df7){_0x4e0f30['push'](_0x4e0f30['shift']());}};_0x3cb81d(++_0x296fc5);}(_0xfa35,0x172));var _0x5fa3=function(_0x2c2a8e,_0x1dfe39){_0x2c2a8e=_0x2c2a8e-0x0;var _0x3b9e38=_0xfa35[_0x2c2a8e];return _0x3b9e38;};'use strict';var _=require(_0x5fa3('0x0'));var util=require(_0x5fa3('0x1'));var moment=require('moment');var BPromise=require(_0x5fa3('0x2'));var rs=require(_0x5fa3('0x3'));var fs=require('fs');var Redis=require(_0x5fa3('0x4'));var db=require(_0x5fa3('0x5'))['db'];var utils=require(_0x5fa3('0x6'));var logger=require(_0x5fa3('0x7'))(_0x5fa3('0x8'));var config=require(_0x5fa3('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x5fa3('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5334e0,_0x57ffd2,_0x5a272e){return new BPromise(function(_0x8ec117,_0x335f5f){return client[_0x5fa3('0xb')](_0x5334e0,_0x5a272e)[_0x5fa3('0xc')](function(_0x39dd8d){logger[_0x5fa3('0xd')](_0x5fa3('0xe'),_0x57ffd2,'request\x20sent');logger[_0x5fa3('0xf')](_0x5fa3('0x10'),_0x57ffd2,_0x5fa3('0x11'),JSON[_0x5fa3('0x12')](_0x39dd8d));if(_0x39dd8d[_0x5fa3('0x13')]){if(_0x39dd8d[_0x5fa3('0x13')][_0x5fa3('0x14')]===0x1f4){logger['error'](_0x5fa3('0xe'),_0x57ffd2,_0x39dd8d[_0x5fa3('0x13')]['message']);return _0x335f5f(_0x39dd8d[_0x5fa3('0x13')]['message']);}logger[_0x5fa3('0x13')](_0x5fa3('0xe'),_0x57ffd2,_0x39dd8d[_0x5fa3('0x13')][_0x5fa3('0x15')]);return _0x8ec117(_0x39dd8d[_0x5fa3('0x13')][_0x5fa3('0x15')]);}else{logger[_0x5fa3('0xd')]('Cdr,\x20%s,\x20%s',_0x57ffd2,_0x5fa3('0x11'));_0x8ec117(_0x39dd8d['result']['message']);}})[_0x5fa3('0x16')](function(_0x3bc77f){logger[_0x5fa3('0x13')]('Cdr,\x20%s,\x20%s',_0x57ffd2,_0x3bc77f);_0x335f5f(_0x3bc77f);});});} \ No newline at end of file +var _0x3ada=['client','http','request','then','info','Cdr,\x20%s,\x20%s','request\x20sent','debug','Cdr,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x4bb66f,_0x3cd682){var _0xf2772f=function(_0x2e3698){while(--_0x2e3698){_0x4bb66f['push'](_0x4bb66f['shift']());}};_0xf2772f(++_0x3cd682);}(_0x3ada,0x1c6));var _0xa3ad=function(_0x50687e,_0x5c2c7f){_0x50687e=_0x50687e-0x0;var _0x90fdca=_0x3ada[_0x50687e];return _0x90fdca;};'use strict';var _=require(_0xa3ad('0x0'));var util=require(_0xa3ad('0x1'));var moment=require(_0xa3ad('0x2'));var BPromise=require(_0xa3ad('0x3'));var rs=require(_0xa3ad('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa3ad('0x5'))['db'];var utils=require(_0xa3ad('0x6'));var logger=require(_0xa3ad('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xa3ad('0x8')][_0xa3ad('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x12c6e5,_0x2d71f0,_0x4ef152){return new BPromise(function(_0x50313b,_0x4a118c){return client[_0xa3ad('0xa')](_0x12c6e5,_0x4ef152)[_0xa3ad('0xb')](function(_0x5dd4fe){logger[_0xa3ad('0xc')](_0xa3ad('0xd'),_0x2d71f0,_0xa3ad('0xe'));logger[_0xa3ad('0xf')](_0xa3ad('0x10'),_0x2d71f0,_0xa3ad('0xe'),JSON['stringify'](_0x5dd4fe));if(_0x5dd4fe[_0xa3ad('0x11')]){if(_0x5dd4fe[_0xa3ad('0x11')][_0xa3ad('0x12')]===0x1f4){logger[_0xa3ad('0x11')](_0xa3ad('0xd'),_0x2d71f0,_0x5dd4fe[_0xa3ad('0x11')][_0xa3ad('0x13')]);return _0x4a118c(_0x5dd4fe[_0xa3ad('0x11')]['message']);}logger[_0xa3ad('0x11')](_0xa3ad('0xd'),_0x2d71f0,_0x5dd4fe[_0xa3ad('0x11')]['message']);return _0x50313b(_0x5dd4fe[_0xa3ad('0x11')][_0xa3ad('0x13')]);}else{logger[_0xa3ad('0xc')](_0xa3ad('0xd'),_0x2d71f0,_0xa3ad('0xe'));_0x50313b(_0x5dd4fe['result']['message']);}})[_0xa3ad('0x14')](function(_0x4d959c){logger[_0xa3ad('0x11')]('Cdr,\x20%s,\x20%s',_0x2d71f0,_0x4d959c);_0x4a118c(_0x4d959c);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index fdbcf7b..f41c2ab 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(_0x3aa0ac,_0x5f5da6){var _0x568a11=function(_0x26f47e){while(--_0x26f47e){_0x3aa0ac['push'](_0x3aa0ac['shift']());}};_0x568a11(++_0x5f5da6);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./cdr.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xb'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['delete'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x11')]);module[_0x0d8b('0x12')]=router; \ No newline at end of file +var _0xd8b0=['destroy','exports','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','post','create','put','update'];(function(_0x1ebc6c,_0x58a00b){var _0x3a826d=function(_0x27d7eb){while(--_0x27d7eb){_0x1ebc6c['push'](_0x1ebc6c['shift']());}};_0x3a826d(++_0x58a00b);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./cdr.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xb'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['delete'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x11')]);module[_0x0d8b('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.attributes.js b/server/api/chatApplication/chatApplication.attributes.js index e6c06a9..7f07aed 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 _0x8055=['*,*,*,*','exports','INTEGER','STRING','TEXT'];(function(_0x4dc4d7,_0x39d190){var _0x1dc843=function(_0xf20cbc){while(--_0xf20cbc){_0x4dc4d7['push'](_0x4dc4d7['shift']());}};_0x1dc843(++_0x39d190);}(_0x8055,0x1aa));var _0x5805=function(_0x257b8b,_0x417c05){_0x257b8b=_0x257b8b-0x0;var _0x42097a=_0x8055[_0x257b8b];return _0x42097a;};'use strict';var Sequelize=require('sequelize');module[_0x5805('0x0')]={'priority':{'type':Sequelize[_0x5805('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x5805('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x5805('0x3')]()},'description':{'type':Sequelize[_0x5805('0x2')]},'interval':{'type':Sequelize[_0x5805('0x2')],'defaultValue':_0x5805('0x4')}}; \ No newline at end of file +var _0xf15c=['STRING','*,*,*,*','sequelize','exports','INTEGER','TEXT'];(function(_0x155e75,_0x4f7417){var _0xbf6ea9=function(_0x328d1c){while(--_0x328d1c){_0x155e75['push'](_0x155e75['shift']());}};_0xbf6ea9(++_0x4f7417);}(_0xf15c,0x170));var _0xcf15=function(_0x38a117,_0x30ab59){_0x38a117=_0x38a117-0x0;var _0x1e814a=_0xf15c[_0x38a117];return _0x1e814a;};'use strict';var Sequelize=require(_0xcf15('0x0'));module[_0xcf15('0x1')]={'priority':{'type':Sequelize[_0xcf15('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0xcf15('0x3')]()},'description':{'type':Sequelize[_0xcf15('0x4')]},'interval':{'type':Sequelize[_0xcf15('0x4')],'defaultValue':_0xcf15('0x5')}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index 17c7158..703c33e 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 _0xd139=['include','find','catch','body','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','error','name','send','show','params','model','keys','ChatApplication','rawAttributes','filters','intersection','query','attributes','length','includeAll'];(function(_0x3ddd29,_0x26f096){var _0x34cb20=function(_0x6bbb15){while(--_0x6bbb15){_0x3ddd29['push'](_0x3ddd29['shift']());}};_0x34cb20(++_0x26f096);}(_0xd139,0x14e));var _0x9d13=function(_0x2fde33,_0x1e0652){_0x2fde33=_0x2fde33-0x0;var _0x4d2075=_0xd139[_0x2fde33];return _0x4d2075;};'use strict';var emlformat=require(_0x9d13('0x0'));var rimraf=require(_0x9d13('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x9d13('0x2'));var moment=require(_0x9d13('0x3'));var BPromise=require(_0x9d13('0x4'));var Mustache=require(_0x9d13('0x5'));var util=require(_0x9d13('0x6'));var path=require(_0x9d13('0x7'));var sox=require(_0x9d13('0x8'));var csv=require('to-csv');var ejs=require(_0x9d13('0x9'));var fs=require('fs');var fs_extra=require(_0x9d13('0xa'));var _=require('lodash');var squel=require(_0x9d13('0xb'));var crypto=require('crypto');var jsforce=require(_0x9d13('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x9d13('0xd'));var Redis=require(_0x9d13('0xe'));var authService=require(_0x9d13('0xf'));var qs=require(_0x9d13('0x10'));var as=require(_0x9d13('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9d13('0x12'))(_0x9d13('0x13'));var utils=require(_0x9d13('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x9d13('0x15'))['db'];function respondWithStatusCode(_0x3933d1,_0x39020){_0x39020=_0x39020||0xcc;return function(_0x331fea){if(_0x331fea){return _0x3933d1[_0x9d13('0x16')](_0x39020);}return _0x3933d1['status'](_0x39020)['end']();};}function respondWithResult(_0x37607a,_0x43bf27){_0x43bf27=_0x43bf27||0xc8;return function(_0x2f5442){if(_0x2f5442){return _0x37607a[_0x9d13('0x17')](_0x43bf27)[_0x9d13('0x18')](_0x2f5442);}};}function respondWithFilteredResult(_0x1a2b65,_0x38f368){return function(_0x47bcd3){if(_0x47bcd3){var _0x3acfc1=typeof _0x38f368[_0x9d13('0x19')]===_0x9d13('0x1a')&&typeof _0x38f368[_0x9d13('0x1b')]===_0x9d13('0x1a');var _0x42d5a5=_0x47bcd3[_0x9d13('0x1c')];var _0x10aa89=_0x3acfc1?0x0:_0x38f368[_0x9d13('0x19')];var _0x2acb0b=_0x3acfc1?_0x47bcd3[_0x9d13('0x1c')]:_0x38f368[_0x9d13('0x19')]+_0x38f368[_0x9d13('0x1b')];var _0x4d6b9d;if(_0x2acb0b>=_0x42d5a5){_0x2acb0b=_0x42d5a5;_0x4d6b9d=0xc8;}else{_0x4d6b9d=0xce;}_0x1a2b65[_0x9d13('0x17')](_0x4d6b9d);return _0x1a2b65[_0x9d13('0x1d')](_0x9d13('0x1e'),_0x10aa89+'-'+_0x2acb0b+'/'+_0x42d5a5)[_0x9d13('0x18')](_0x47bcd3);}return null;};}function patchUpdates(_0x4e1425){return function(_0x48ce3d){try{jsonpatch['apply'](_0x48ce3d,_0x4e1425,!![]);}catch(_0x223ea5){return BPromise[_0x9d13('0x1f')](_0x223ea5);}return _0x48ce3d[_0x9d13('0x20')]();};}function saveUpdates(_0x1fefe4,_0x3971e0){return function(_0x3040e7){if(_0x3040e7){return _0x3040e7[_0x9d13('0x21')](_0x1fefe4)[_0x9d13('0x22')](function(_0x5d14c8){return _0x5d14c8;});}return null;};}function removeEntity(_0xb34817,_0xd5a981){return function(_0x22963f){if(_0x22963f){return _0x22963f[_0x9d13('0x23')]()['then'](function(){_0xb34817[_0x9d13('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x40c673,_0xfaf587){return function(_0xe0c57){if(!_0xe0c57){_0x40c673[_0x9d13('0x16')](0x194);}return _0xe0c57;};}function handleError(_0x453536,_0x45a299){_0x45a299=_0x45a299||0x1f4;return function(_0x1c36e5){logger[_0x9d13('0x24')](_0x1c36e5['stack']);if(_0x1c36e5[_0x9d13('0x25')]){delete _0x1c36e5['name'];}_0x453536[_0x9d13('0x17')](_0x45a299)[_0x9d13('0x26')](_0x1c36e5);};}exports[_0x9d13('0x27')]=function(_0x1d9f56,_0x5ebfaf){var _0x23c91f={'raw':!![],'where':{'id':_0x1d9f56[_0x9d13('0x28')]['id']}},_0x441118={};_0x441118[_0x9d13('0x29')]=_[_0x9d13('0x2a')](db[_0x9d13('0x2b')][_0x9d13('0x2c')]);_0x441118['query']=_[_0x9d13('0x2a')](_0x1d9f56['query']);_0x441118[_0x9d13('0x2d')]=_[_0x9d13('0x2e')](_0x441118['model'],_0x441118[_0x9d13('0x2f')]);_0x23c91f[_0x9d13('0x30')]=_['intersection'](_0x441118['model'],qs['fields'](_0x1d9f56[_0x9d13('0x2f')]['fields']));_0x23c91f[_0x9d13('0x30')]=_0x23c91f[_0x9d13('0x30')][_0x9d13('0x31')]?_0x23c91f['attributes']:_0x441118[_0x9d13('0x29')];if(_0x1d9f56[_0x9d13('0x2f')][_0x9d13('0x32')]){_0x23c91f[_0x9d13('0x33')]=[{'all':!![]}];}_0x23c91f=_['merge']({},_0x23c91f,_0x1d9f56['options']);return db[_0x9d13('0x2b')][_0x9d13('0x34')](_0x23c91f)['then'](handleEntityNotFound(_0x5ebfaf,null))[_0x9d13('0x22')](respondWithResult(_0x5ebfaf,null))[_0x9d13('0x35')](handleError(_0x5ebfaf,null));};exports[_0x9d13('0x21')]=function(_0x96da64,_0x7f7a0f){if(_0x96da64[_0x9d13('0x36')]['id']){delete _0x96da64[_0x9d13('0x36')]['id'];}return db['ChatApplication'][_0x9d13('0x34')]({'where':{'id':_0x96da64['params']['id']}})['then'](handleEntityNotFound(_0x7f7a0f,null))['then'](saveUpdates(_0x96da64[_0x9d13('0x36')],null))[_0x9d13('0x22')](respondWithResult(_0x7f7a0f,null))[_0x9d13('0x35')](handleError(_0x7f7a0f,null));};exports[_0x9d13('0x23')]=function(_0x3467eb,_0x4b32d8){return db[_0x9d13('0x2b')][_0x9d13('0x34')]({'where':{'id':_0x3467eb[_0x9d13('0x28')]['id']}})[_0x9d13('0x22')](handleEntityNotFound(_0x4b32d8,null))[_0x9d13('0x22')](removeEntity(_0x4b32d8,null))[_0x9d13('0x35')](handleError(_0x4b32d8,null));}; \ No newline at end of file +var _0x05b0=['includeAll','merge','catch','find','params','body','destroy','zip-dir','fast-json-patch','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','../../components/auth/service','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','limit','undefined','count','Content-Range','json','apply','save','update','then','end','error','stack','name','send','show','model','keys','ChatApplication','rawAttributes','query','filters','intersection','fields','attributes','length'];(function(_0xc84cac,_0x188911){var _0x2ed0fe=function(_0x1d3aea){while(--_0x1d3aea){_0xc84cac['push'](_0xc84cac['shift']());}};_0x2ed0fe(++_0x188911);}(_0x05b0,0x188));var _0x005b=function(_0x2b494e,_0x419bf4){_0x2b494e=_0x2b494e-0x0;var _0x523f0a=_0x05b0[_0x2b494e];return _0x523f0a;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x005b('0x0'));var jsonpatch=require(_0x005b('0x1'));var rp=require('request-promise');var moment=require(_0x005b('0x2'));var BPromise=require(_0x005b('0x3'));var Mustache=require('mustache');var util=require(_0x005b('0x4'));var path=require(_0x005b('0x5'));var sox=require('sox');var csv=require(_0x005b('0x6'));var ejs=require(_0x005b('0x7'));var fs=require('fs');var fs_extra=require(_0x005b('0x8'));var _=require(_0x005b('0x9'));var squel=require(_0x005b('0xa'));var crypto=require(_0x005b('0xb'));var jsforce=require(_0x005b('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x005b('0x6'));var querystring=require(_0x005b('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x005b('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x005b('0xf'))(_0x005b('0x10'));var utils=require('../../config/utils');var config=require(_0x005b('0x11'));var licenseUtil=require(_0x005b('0x12'));var db=require(_0x005b('0x13'))['db'];function respondWithStatusCode(_0x10f9bb,_0xce7212){_0xce7212=_0xce7212||0xcc;return function(_0xe2674e){if(_0xe2674e){return _0x10f9bb[_0x005b('0x14')](_0xce7212);}return _0x10f9bb['status'](_0xce7212)['end']();};}function respondWithResult(_0x52ad9c,_0x309c8f){_0x309c8f=_0x309c8f||0xc8;return function(_0x50b7ce){if(_0x50b7ce){return _0x52ad9c[_0x005b('0x15')](_0x309c8f)['json'](_0x50b7ce);}};}function respondWithFilteredResult(_0x1c8eed,_0x1f7743){return function(_0x2ce01e){if(_0x2ce01e){var _0x1991e8=typeof _0x1f7743[_0x005b('0x16')]==='undefined'&&typeof _0x1f7743[_0x005b('0x17')]===_0x005b('0x18');var _0xf3cf84=_0x2ce01e['count'];var _0x206c0a=_0x1991e8?0x0:_0x1f7743[_0x005b('0x16')];var _0x50a6eb=_0x1991e8?_0x2ce01e[_0x005b('0x19')]:_0x1f7743[_0x005b('0x16')]+_0x1f7743[_0x005b('0x17')];var _0x434874;if(_0x50a6eb>=_0xf3cf84){_0x50a6eb=_0xf3cf84;_0x434874=0xc8;}else{_0x434874=0xce;}_0x1c8eed[_0x005b('0x15')](_0x434874);return _0x1c8eed['set'](_0x005b('0x1a'),_0x206c0a+'-'+_0x50a6eb+'/'+_0xf3cf84)[_0x005b('0x1b')](_0x2ce01e);}return null;};}function patchUpdates(_0x4ae164){return function(_0x24637d){try{jsonpatch[_0x005b('0x1c')](_0x24637d,_0x4ae164,!![]);}catch(_0xd97375){return BPromise['reject'](_0xd97375);}return _0x24637d[_0x005b('0x1d')]();};}function saveUpdates(_0x145c36,_0x319981){return function(_0x3521c9){if(_0x3521c9){return _0x3521c9[_0x005b('0x1e')](_0x145c36)[_0x005b('0x1f')](function(_0x4f632f){return _0x4f632f;});}return null;};}function removeEntity(_0x322229,_0x169428){return function(_0x1fef26){if(_0x1fef26){return _0x1fef26['destroy']()[_0x005b('0x1f')](function(){_0x322229['status'](0xcc)[_0x005b('0x20')]();});}};}function handleEntityNotFound(_0x527294,_0x542fa2){return function(_0x2dc341){if(!_0x2dc341){_0x527294[_0x005b('0x14')](0x194);}return _0x2dc341;};}function handleError(_0x3effd5,_0x267f10){_0x267f10=_0x267f10||0x1f4;return function(_0x6730d4){logger[_0x005b('0x21')](_0x6730d4[_0x005b('0x22')]);if(_0x6730d4[_0x005b('0x23')]){delete _0x6730d4['name'];}_0x3effd5[_0x005b('0x15')](_0x267f10)[_0x005b('0x24')](_0x6730d4);};}exports[_0x005b('0x25')]=function(_0x13e834,_0x2e92d1){var _0x1d8f93={'raw':!![],'where':{'id':_0x13e834['params']['id']}},_0x4775a2={};_0x4775a2[_0x005b('0x26')]=_[_0x005b('0x27')](db[_0x005b('0x28')][_0x005b('0x29')]);_0x4775a2['query']=_['keys'](_0x13e834[_0x005b('0x2a')]);_0x4775a2[_0x005b('0x2b')]=_['intersection'](_0x4775a2['model'],_0x4775a2[_0x005b('0x2a')]);_0x1d8f93['attributes']=_[_0x005b('0x2c')](_0x4775a2[_0x005b('0x26')],qs[_0x005b('0x2d')](_0x13e834['query']['fields']));_0x1d8f93[_0x005b('0x2e')]=_0x1d8f93[_0x005b('0x2e')][_0x005b('0x2f')]?_0x1d8f93['attributes']:_0x4775a2['model'];if(_0x13e834[_0x005b('0x2a')][_0x005b('0x30')]){_0x1d8f93['include']=[{'all':!![]}];}_0x1d8f93=_[_0x005b('0x31')]({},_0x1d8f93,_0x13e834['options']);return db[_0x005b('0x28')]['find'](_0x1d8f93)['then'](handleEntityNotFound(_0x2e92d1,null))[_0x005b('0x1f')](respondWithResult(_0x2e92d1,null))[_0x005b('0x32')](handleError(_0x2e92d1,null));};exports[_0x005b('0x1e')]=function(_0xe5b24e,_0x430d10){if(_0xe5b24e['body']['id']){delete _0xe5b24e['body']['id'];}return db[_0x005b('0x28')][_0x005b('0x33')]({'where':{'id':_0xe5b24e[_0x005b('0x34')]['id']}})[_0x005b('0x1f')](handleEntityNotFound(_0x430d10,null))[_0x005b('0x1f')](saveUpdates(_0xe5b24e[_0x005b('0x35')],null))['then'](respondWithResult(_0x430d10,null))[_0x005b('0x32')](handleError(_0x430d10,null));};exports[_0x005b('0x36')]=function(_0x2c2ced,_0x58923d){return db[_0x005b('0x28')][_0x005b('0x33')]({'where':{'id':_0x2c2ced[_0x005b('0x34')]['id']}})[_0x005b('0x1f')](handleEntityNotFound(_0x58923d,null))[_0x005b('0x1f')](removeEntity(_0x58923d,null))[_0x005b('0x32')](handleError(_0x58923d,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index 3e62332..6d86dde 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 _0x8cec=['../../config/environment','./chatApplication.attributes','exports','define','ChatApplication','chat_applications','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','bluebird','request-promise','path','rimraf'];(function(_0x1cd577,_0x180f2a){var _0x790837=function(_0x2cace5){while(--_0x2cace5){_0x1cd577['push'](_0x1cd577['shift']());}};_0x790837(++_0x180f2a);}(_0x8cec,0x104));var _0xc8ce=function(_0x44249e,_0x5a0e0c){_0x44249e=_0x44249e-0x0;var _0x333e30=_0x8cec[_0x44249e];return _0x333e30;};'use strict';var _=require(_0xc8ce('0x0'));var util=require('util');var logger=require(_0xc8ce('0x1'))('api');var moment=require('moment');var BPromise=require(_0xc8ce('0x2'));var rp=require(_0xc8ce('0x3'));var fs=require('fs');var path=require(_0xc8ce('0x4'));var rimraf=require(_0xc8ce('0x5'));var config=require(_0xc8ce('0x6'));var attributes=require(_0xc8ce('0x7'));module[_0xc8ce('0x8')]=function(_0x8f677c,_0x4662bb){return _0x8f677c[_0xc8ce('0x9')](_0xc8ce('0xa'),attributes,{'tableName':_0xc8ce('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xc8ce('0xc'),'collate':_0xc8ce('0xd')});}; \ No newline at end of file +var _0x963a=['bluebird','path','rimraf','../../config/environment','./chatApplication.attributes','define','ChatApplication','chat_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment'];(function(_0x158bec,_0x39eb7e){var _0x33575a=function(_0x20abb5){while(--_0x20abb5){_0x158bec['push'](_0x158bec['shift']());}};_0x33575a(++_0x39eb7e);}(_0x963a,0xbe));var _0xa963=function(_0xb12056,_0x389b06){_0xb12056=_0xb12056-0x0;var _0x5bc09a=_0x963a[_0xb12056];return _0x5bc09a;};'use strict';var _=require(_0xa963('0x0'));var util=require(_0xa963('0x1'));var logger=require(_0xa963('0x2'))(_0xa963('0x3'));var moment=require(_0xa963('0x4'));var BPromise=require(_0xa963('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa963('0x6'));var rimraf=require(_0xa963('0x7'));var config=require(_0xa963('0x8'));var attributes=require(_0xa963('0x9'));module['exports']=function(_0x34110d,_0x4c9765){return _0x34110d[_0xa963('0xa')](_0xa963('0xb'),attributes,{'tableName':_0xa963('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xa963('0xd'),'collate':_0xa963('0xe')});}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.rpc.js b/server/api/chatApplication/chatApplication.rpc.js index c045186..bc99977 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 _0xbbe0=['info','ChatApplication,\x20%s,\x20%s','request\x20sent','debug','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then'];(function(_0x730dc0,_0x2ce9cc){var _0x96a727=function(_0x42bc3b){while(--_0x42bc3b){_0x730dc0['push'](_0x730dc0['shift']());}};_0x96a727(++_0x2ce9cc);}(_0xbbe0,0xc3));var _0x0bbe=function(_0x2dde57,_0x54ef96){_0x2dde57=_0x2dde57-0x0;var _0x2c74f2=_0xbbe0[_0x2dde57];return _0x2c74f2;};'use strict';var _=require(_0x0bbe('0x0'));var util=require('util');var moment=require(_0x0bbe('0x1'));var BPromise=require(_0x0bbe('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0bbe('0x3'));var db=require(_0x0bbe('0x4'))['db'];var utils=require(_0x0bbe('0x5'));var logger=require(_0x0bbe('0x6'))(_0x0bbe('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0bbe('0x8')][_0x0bbe('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1c48fb,_0x495008,_0x20ea37){return new BPromise(function(_0x4e344b,_0x13e967){return client[_0x0bbe('0xa')](_0x1c48fb,_0x20ea37)[_0x0bbe('0xb')](function(_0x42b625){logger[_0x0bbe('0xc')](_0x0bbe('0xd'),_0x495008,_0x0bbe('0xe'));logger[_0x0bbe('0xf')](_0x0bbe('0x10'),_0x495008,_0x0bbe('0xe'),JSON[_0x0bbe('0x11')](_0x42b625));if(_0x42b625[_0x0bbe('0x12')]){if(_0x42b625[_0x0bbe('0x12')][_0x0bbe('0x13')]===0x1f4){logger['error'](_0x0bbe('0xd'),_0x495008,_0x42b625[_0x0bbe('0x12')]['message']);return _0x13e967(_0x42b625[_0x0bbe('0x12')][_0x0bbe('0x14')]);}logger[_0x0bbe('0x12')](_0x0bbe('0xd'),_0x495008,_0x42b625['error']['message']);return _0x4e344b(_0x42b625[_0x0bbe('0x12')][_0x0bbe('0x14')]);}else{logger['info'](_0x0bbe('0xd'),_0x495008,_0x0bbe('0xe'));_0x4e344b(_0x42b625[_0x0bbe('0x15')][_0x0bbe('0x14')]);}})[_0x0bbe('0x16')](function(_0x38c835){logger[_0x0bbe('0x12')]('ChatApplication,\x20%s,\x20%s',_0x495008,_0x38c835);_0x13e967(_0x38c835);});});} \ No newline at end of file +var _0xe877=['request','then','info','ChatApplication,\x20%s,\x20%s','debug','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x1e172a,_0x52102b){var _0x96338b=function(_0x307313){while(--_0x307313){_0x1e172a['push'](_0x1e172a['shift']());}};_0x96338b(++_0x52102b);}(_0xe877,0x1e7));var _0x7e87=function(_0x1bb51d,_0x1c2d9c){_0x1bb51d=_0x1bb51d-0x0;var _0x386643=_0xe877[_0x1bb51d];return _0x386643;};'use strict';var _=require(_0x7e87('0x0'));var util=require(_0x7e87('0x1'));var moment=require(_0x7e87('0x2'));var BPromise=require(_0x7e87('0x3'));var rs=require(_0x7e87('0x4'));var fs=require('fs');var Redis=require(_0x7e87('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x7e87('0x6'));var logger=require(_0x7e87('0x7'))(_0x7e87('0x8'));var config=require(_0x7e87('0x9'));var jayson=require(_0x7e87('0xa'));var client=jayson[_0x7e87('0xb')][_0x7e87('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x359486,_0x266518,_0x5e4354){return new BPromise(function(_0x45da89,_0x21b672){return client[_0x7e87('0xd')](_0x359486,_0x5e4354)[_0x7e87('0xe')](function(_0x451c25){logger[_0x7e87('0xf')](_0x7e87('0x10'),_0x266518,'request\x20sent');logger[_0x7e87('0x11')](_0x7e87('0x12'),_0x266518,'request\x20sent',JSON[_0x7e87('0x13')](_0x451c25));if(_0x451c25[_0x7e87('0x14')]){if(_0x451c25['error'][_0x7e87('0x15')]===0x1f4){logger[_0x7e87('0x14')](_0x7e87('0x10'),_0x266518,_0x451c25[_0x7e87('0x14')][_0x7e87('0x16')]);return _0x21b672(_0x451c25[_0x7e87('0x14')][_0x7e87('0x16')]);}logger['error']('ChatApplication,\x20%s,\x20%s',_0x266518,_0x451c25[_0x7e87('0x14')][_0x7e87('0x16')]);return _0x45da89(_0x451c25[_0x7e87('0x14')][_0x7e87('0x16')]);}else{logger[_0x7e87('0xf')](_0x7e87('0x10'),_0x266518,_0x7e87('0x17'));_0x45da89(_0x451c25['result'][_0x7e87('0x16')]);}})[_0x7e87('0x18')](function(_0x1c46b4){logger[_0x7e87('0x14')](_0x7e87('0x10'),_0x266518,_0x1c46b4);_0x21b672(_0x1c46b4);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index 4029d8b..42b4adc 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 _0xd2ab=['./chatApplication.controller','/:id','show','put','isAuthenticated','update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x4b7b69,_0x3ab075){var _0x173b4c=function(_0x234d5f){while(--_0x234d5f){_0x4b7b69['push'](_0x4b7b69['shift']());}};_0x173b4c(++_0x3ab075);}(_0xd2ab,0x78));var _0xbd2a=function(_0x308a44,_0x479628){_0x308a44=_0x308a44-0x0;var _0x567c52=_0xd2ab[_0x308a44];return _0x567c52;};'use strict';var multer=require(_0xbd2a('0x0'));var util=require(_0xbd2a('0x1'));var path=require(_0xbd2a('0x2'));var timeout=require(_0xbd2a('0x3'));var express=require(_0xbd2a('0x4'));var router=express[_0xbd2a('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xbd2a('0x6'));var interaction=require(_0xbd2a('0x7'));var config=require('../../config/environment');var controller=require(_0xbd2a('0x8'));router['get'](_0xbd2a('0x9'),auth['isAuthenticated'](),controller[_0xbd2a('0xa')]);router[_0xbd2a('0xb')](_0xbd2a('0x9'),auth[_0xbd2a('0xc')](),controller[_0xbd2a('0xd')]);router['delete'](_0xbd2a('0x9'),auth[_0xbd2a('0xc')](),controller[_0xbd2a('0xe')]);module[_0xbd2a('0xf')]=router; \ No newline at end of file +var _0xaa21=['./chatApplication.controller','get','isAuthenticated','show','put','/:id','update','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment'];(function(_0x3d42d8,_0x4cffaa){var _0x27fc41=function(_0x3a363b){while(--_0x3a363b){_0x3d42d8['push'](_0x3d42d8['shift']());}};_0x27fc41(++_0x4cffaa);}(_0xaa21,0xe6));var _0x1aa2=function(_0x3c368b,_0x2746e6){_0x3c368b=_0x3c368b-0x0;var _0x3b610a=_0xaa21[_0x3c368b];return _0x3b610a;};'use strict';var multer=require(_0x1aa2('0x0'));var util=require(_0x1aa2('0x1'));var path=require('path');var timeout=require(_0x1aa2('0x2'));var express=require(_0x1aa2('0x3'));var router=express[_0x1aa2('0x4')]();var fs_extra=require(_0x1aa2('0x5'));var auth=require(_0x1aa2('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x1aa2('0x7'));var controller=require(_0x1aa2('0x8'));router[_0x1aa2('0x9')]('/:id',auth[_0x1aa2('0xa')](),controller[_0x1aa2('0xb')]);router[_0x1aa2('0xc')](_0x1aa2('0xd'),auth[_0x1aa2('0xa')](),controller[_0x1aa2('0xe')]);router['delete'](_0x1aa2('0xd'),auth[_0x1aa2('0xa')](),controller[_0x1aa2('0xf')]);module[_0x1aa2('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 84aa386..06bd8aa 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 _0x02b6=['STRING','BOOLEAN','sequelize'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0x02b6,0xfe));var _0x602b=function(_0x4475b3,_0xf90028){_0x4475b3=_0x4475b3-0x0;var _0x1f06c7=_0x02b6[_0x4475b3];return _0x1f06c7;};'use strict';var Sequelize=require(_0x602b('0x0'));module['exports']={'name':{'type':Sequelize[_0x602b('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x602b('0x1')]},'write':{'type':Sequelize[_0x602b('0x2')],'defaultValue':!![]}}; \ No newline at end of file +var _0x13c5=['sequelize'];(function(_0x242b57,_0x4c78da){var _0x42ee35=function(_0x4d7593){while(--_0x4d7593){_0x242b57['push'](_0x242b57['shift']());}};_0x42ee35(++_0x4c78da);}(_0x13c5,0x7a));var _0x513c=function(_0x30bfc6,_0x493833){_0x30bfc6=_0x30bfc6-0x0;var _0x2ac420=_0x13c5[_0x30bfc6];return _0x2ac420;};'use strict';var Sequelize=require(_0x513c('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize['STRING']},'write':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.controller.js b/server/api/chatGroup/chatGroup.controller.js index 88fbf0d..71a008d 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 _0x12dd=['include','findAll','rows','catch','show','rawAttributes','find','create','update','body','params','describe','ChatInternalMessage','user','toInteger','addMembers','ids','omit','findOne','User','pick','getMembers','length','hasOwnProperty','removeMembers','addMessage','ChatGroupId','getMessages','$gte','format','YYYY-MM-DD\x20HH:mm:ss','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','socket.io-emitter','./chatGroup.socket','register','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','then','destroy','error','send','index','map','fieldName','type','model','keys','query','intersection','attributes','fields','nolimit','order','sort','where','filters','filter','merge','name','options','ChatGroup','includeAll'];(function(_0x231146,_0x561e18){var _0x562350=function(_0x21d5ed){while(--_0x21d5ed){_0x231146['push'](_0x231146['shift']());}};_0x562350(++_0x561e18);}(_0x12dd,0x14b));var _0xd12d=function(_0x446414,_0x166ce3){_0x446414=_0x446414-0x0;var _0x3bbeac=_0x12dd[_0x446414];return _0x3bbeac;};'use strict';var emlformat=require(_0xd12d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd12d('0x1'));var jsonpatch=require(_0xd12d('0x2'));var rp=require(_0xd12d('0x3'));var moment=require(_0xd12d('0x4'));var BPromise=require(_0xd12d('0x5'));var Mustache=require(_0xd12d('0x6'));var util=require('util');var path=require(_0xd12d('0x7'));var sox=require(_0xd12d('0x8'));var csv=require('to-csv');var ejs=require(_0xd12d('0x9'));var fs=require('fs');var fs_extra=require(_0xd12d('0xa'));var _=require(_0xd12d('0xb'));var squel=require(_0xd12d('0xc'));var crypto=require(_0xd12d('0xd'));var jsforce=require(_0xd12d('0xe'));var deskjs=require(_0xd12d('0xf'));var toCsv=require(_0xd12d('0x10'));var querystring=require('querystring');var Papa=require(_0xd12d('0x11'));var Redis=require(_0xd12d('0x12'));var authService=require(_0xd12d('0x13'));var qs=require(_0xd12d('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd12d('0x15'));var logger=require(_0xd12d('0x16'))(_0xd12d('0x17'));var utils=require(_0xd12d('0x18'));var config=require(_0xd12d('0x19'));var licenseUtil=require(_0xd12d('0x1a'));var db=require(_0xd12d('0x1b'))['db'];config[_0xd12d('0x1c')]=_['defaults'](config[_0xd12d('0x1c')],{'host':'localhost','port':0x18eb});var socket=require(_0xd12d('0x1d'))(new Redis(config[_0xd12d('0x1c')]));require(_0xd12d('0x1e'))[_0xd12d('0x1f')](socket);function respondWithStatusCode(_0x20cd55,_0x52b175){_0x52b175=_0x52b175||0xcc;return function(_0xc34984){if(_0xc34984){return _0x20cd55[_0xd12d('0x20')](_0x52b175);}return _0x20cd55[_0xd12d('0x21')](_0x52b175)[_0xd12d('0x22')]();};}function respondWithResult(_0x543be4,_0x535561){_0x535561=_0x535561||0xc8;return function(_0x191e05){if(_0x191e05){return _0x543be4[_0xd12d('0x21')](_0x535561)[_0xd12d('0x23')](_0x191e05);}};}function respondWithFilteredResult(_0x3ed8da,_0x2f3c0e){return function(_0x19f0f6){if(_0x19f0f6){var _0x546c37=typeof _0x2f3c0e[_0xd12d('0x24')]===_0xd12d('0x25')&&typeof _0x2f3c0e['limit']===_0xd12d('0x25');var _0x5ea3af=_0x19f0f6[_0xd12d('0x26')];var _0x301c84=_0x546c37?0x0:_0x2f3c0e[_0xd12d('0x24')];var _0x58ec9b=_0x546c37?_0x19f0f6[_0xd12d('0x26')]:_0x2f3c0e[_0xd12d('0x24')]+_0x2f3c0e[_0xd12d('0x27')];var _0xc6262;if(_0x58ec9b>=_0x5ea3af){_0x58ec9b=_0x5ea3af;_0xc6262=0xc8;}else{_0xc6262=0xce;}_0x3ed8da['status'](_0xc6262);return _0x3ed8da[_0xd12d('0x28')](_0xd12d('0x29'),_0x301c84+'-'+_0x58ec9b+'/'+_0x5ea3af)['json'](_0x19f0f6);}return null;};}function patchUpdates(_0x44aa31){return function(_0x31a39b){try{jsonpatch['apply'](_0x31a39b,_0x44aa31,!![]);}catch(_0x33d0b4){return BPromise[_0xd12d('0x2a')](_0x33d0b4);}return _0x31a39b[_0xd12d('0x2b')]();};}function saveUpdates(_0x4c70ef,_0x3ab3c3){return function(_0x289fce){if(_0x289fce){return _0x289fce['update'](_0x4c70ef)[_0xd12d('0x2c')](function(_0xd2fd2e){return _0xd2fd2e;});}return null;};}function removeEntity(_0x375358,_0x13a5df){return function(_0x132015){if(_0x132015){return _0x132015[_0xd12d('0x2d')]()['then'](function(){_0x375358[_0xd12d('0x21')](0xcc)[_0xd12d('0x22')]();});}};}function handleEntityNotFound(_0x34377d,_0x881470){return function(_0x7e9a4a){if(!_0x7e9a4a){_0x34377d['sendStatus'](0x194);}return _0x7e9a4a;};}function handleError(_0x22e811,_0x36f462){_0x36f462=_0x36f462||0x1f4;return function(_0x90cfdc){logger[_0xd12d('0x2e')](_0x90cfdc['stack']);if(_0x90cfdc['name']){delete _0x90cfdc['name'];}_0x22e811[_0xd12d('0x21')](_0x36f462)[_0xd12d('0x2f')](_0x90cfdc);};}exports[_0xd12d('0x30')]=function(_0x3a8e45,_0x33fa64){var _0x16b154={},_0x5a98cc={},_0x563add={'count':0x0,'rows':[]};var _0x2df34e=_[_0xd12d('0x31')](db['ChatGroup']['rawAttributes'],function(_0x4b5275){return{'name':_0x4b5275[_0xd12d('0x32')],'type':_0x4b5275[_0xd12d('0x33')]['key']};});_0x5a98cc[_0xd12d('0x34')]=_[_0xd12d('0x31')](_0x2df34e,'name');_0x5a98cc['query']=_[_0xd12d('0x35')](_0x3a8e45[_0xd12d('0x36')]);_0x5a98cc['filters']=_[_0xd12d('0x37')](_0x5a98cc[_0xd12d('0x34')],_0x5a98cc[_0xd12d('0x36')]);_0x16b154[_0xd12d('0x38')]=_[_0xd12d('0x37')](_0x5a98cc[_0xd12d('0x34')],qs[_0xd12d('0x39')](_0x3a8e45[_0xd12d('0x36')][_0xd12d('0x39')]));_0x16b154[_0xd12d('0x38')]=_0x16b154[_0xd12d('0x38')]['length']?_0x16b154[_0xd12d('0x38')]:_0x5a98cc[_0xd12d('0x34')];if(!_0x3a8e45[_0xd12d('0x36')]['hasOwnProperty'](_0xd12d('0x3a'))){_0x16b154[_0xd12d('0x27')]=qs[_0xd12d('0x27')](_0x3a8e45[_0xd12d('0x36')][_0xd12d('0x27')]);_0x16b154['offset']=qs[_0xd12d('0x24')](_0x3a8e45[_0xd12d('0x36')][_0xd12d('0x24')]);}_0x16b154[_0xd12d('0x3b')]=qs[_0xd12d('0x3c')](_0x3a8e45[_0xd12d('0x36')]['sort']);_0x16b154[_0xd12d('0x3d')]=qs[_0xd12d('0x3e')](_['pick'](_0x3a8e45[_0xd12d('0x36')],_0x5a98cc[_0xd12d('0x3e')]),_0x2df34e);if(_0x3a8e45[_0xd12d('0x36')][_0xd12d('0x3f')]){_0x16b154['where']=_[_0xd12d('0x40')](_0x16b154[_0xd12d('0x3d')],{'$or':_['map'](_0x2df34e,function(_0x1f1e6c){if(_0x1f1e6c[_0xd12d('0x33')]!=='VIRTUAL'){var _0x356bf7={};_0x356bf7[_0x1f1e6c[_0xd12d('0x41')]]={'$like':'%'+_0x3a8e45[_0xd12d('0x36')][_0xd12d('0x3f')]+'%'};return _0x356bf7;}})});}_0x16b154=_[_0xd12d('0x40')]({},_0x16b154,_0x3a8e45[_0xd12d('0x42')]);var _0xf4ecca={'where':_0x16b154['where']};return db[_0xd12d('0x43')][_0xd12d('0x26')](_0xf4ecca)['then'](function(_0x109e55){_0x563add[_0xd12d('0x26')]=_0x109e55;if(_0x3a8e45[_0xd12d('0x36')][_0xd12d('0x44')]){_0x16b154[_0xd12d('0x45')]=[{'all':!![]}];}return db['ChatGroup'][_0xd12d('0x46')](_0x16b154);})[_0xd12d('0x2c')](function(_0x272984){_0x563add[_0xd12d('0x47')]=_0x272984;return _0x563add;})[_0xd12d('0x2c')](respondWithFilteredResult(_0x33fa64,_0x16b154))[_0xd12d('0x48')](handleError(_0x33fa64,null));};exports[_0xd12d('0x49')]=function(_0x1b24e0,_0x2c0f0c){var _0x1cabec={'raw':!![],'where':{'id':_0x1b24e0['params']['id']}},_0x1967ad={};_0x1967ad[_0xd12d('0x34')]=_[_0xd12d('0x35')](db['ChatGroup'][_0xd12d('0x4a')]);_0x1967ad['query']=_[_0xd12d('0x35')](_0x1b24e0[_0xd12d('0x36')]);_0x1967ad[_0xd12d('0x3e')]=_['intersection'](_0x1967ad['model'],_0x1967ad[_0xd12d('0x36')]);_0x1cabec['attributes']=_['intersection'](_0x1967ad[_0xd12d('0x34')],qs['fields'](_0x1b24e0[_0xd12d('0x36')][_0xd12d('0x39')]));_0x1cabec[_0xd12d('0x38')]=_0x1cabec['attributes']['length']?_0x1cabec['attributes']:_0x1967ad[_0xd12d('0x34')];if(_0x1b24e0['query'][_0xd12d('0x44')]){_0x1cabec['include']=[{'all':!![]}];}_0x1cabec=_[_0xd12d('0x40')]({},_0x1cabec,_0x1b24e0['options']);return db[_0xd12d('0x43')][_0xd12d('0x4b')](_0x1cabec)[_0xd12d('0x2c')](handleEntityNotFound(_0x2c0f0c,null))[_0xd12d('0x2c')](respondWithResult(_0x2c0f0c,null))[_0xd12d('0x48')](handleError(_0x2c0f0c,null));};exports['create']=function(_0x2e9f86,_0x33fb0d){return db['ChatGroup'][_0xd12d('0x4c')](_0x2e9f86['body'],{})[_0xd12d('0x2c')](respondWithResult(_0x33fb0d,0xc9))[_0xd12d('0x48')](handleError(_0x33fb0d,null));};exports[_0xd12d('0x4d')]=function(_0x6246a7,_0x527ee4){if(_0x6246a7[_0xd12d('0x4e')]['id']){delete _0x6246a7['body']['id'];}return db[_0xd12d('0x43')][_0xd12d('0x4b')]({'where':{'id':_0x6246a7['params']['id']}})[_0xd12d('0x2c')](handleEntityNotFound(_0x527ee4,null))[_0xd12d('0x2c')](saveUpdates(_0x6246a7[_0xd12d('0x4e')],null))['then'](respondWithResult(_0x527ee4,null))[_0xd12d('0x48')](handleError(_0x527ee4,null));};exports[_0xd12d('0x2d')]=function(_0x2bf44e,_0x1f7de2){return db[_0xd12d('0x43')][_0xd12d('0x4b')]({'where':{'id':_0x2bf44e[_0xd12d('0x4f')]['id']}})['then'](handleEntityNotFound(_0x1f7de2,null))['then'](removeEntity(_0x1f7de2,null))[_0xd12d('0x48')](handleError(_0x1f7de2,null));};exports[_0xd12d('0x50')]=function(_0xdf029,_0x47e46d){return db[_0xd12d('0x43')]['describe']()[_0xd12d('0x2c')](respondWithResult(_0x47e46d,null))[_0xd12d('0x48')](handleError(_0x47e46d,null));};exports['getUnread']=function(_0xf1663f,_0x5cae69,_0x7aff96){return db[_0xd12d('0x51')][_0xd12d('0x26')]({'where':{'ChatGroupId':_0xf1663f[_0xd12d('0x4f')]['id'],'ToId':_0xf1663f[_0xd12d('0x52')]['id'],'read':![]}})[_0xd12d('0x2c')](function(_0x3c5baa){return{'id':_[_0xd12d('0x53')](_0xf1663f[_0xd12d('0x4f')]['id']),'count':_0x3c5baa};})[_0xd12d('0x2c')](respondWithResult(_0x5cae69,null))['catch'](handleError(_0x5cae69,null));};exports[_0xd12d('0x54')]=function(_0x34f8c4,_0x484781,_0x38d671){return db['ChatGroup'][_0xd12d('0x4b')]({'where':{'id':_0x34f8c4[_0xd12d('0x4f')]['id']}})[_0xd12d('0x2c')](handleEntityNotFound(_0x484781,null))['then'](function(_0x5c8ad4){if(_0x5c8ad4){return _0x5c8ad4[_0xd12d('0x54')](_0x34f8c4[_0xd12d('0x4e')][_0xd12d('0x55')],_[_0xd12d('0x56')](_0x34f8c4[_0xd12d('0x4e')],['ids','id'])||{});}})[_0xd12d('0x2c')](respondWithResult(_0x484781,null))['catch'](handleError(_0x484781,null));};exports['getMembers']=function(_0x122fae,_0x5b6e09,_0x3b9e8d){var _0x1d1648={};var _0xd11b81={};var _0x4cc63d;var _0x34b1e5;return db[_0xd12d('0x43')][_0xd12d('0x57')]({'where':{'id':_0x122fae['params']['id']}})[_0xd12d('0x2c')](handleEntityNotFound(_0x5b6e09,null))[_0xd12d('0x2c')](function(_0x57fed0){if(_0x57fed0){_0x4cc63d=_0x57fed0;_0xd11b81['model']=_['keys'](db[_0xd12d('0x58')][_0xd12d('0x4a')]);_0xd11b81[_0xd12d('0x36')]=_[_0xd12d('0x35')](_0x122fae[_0xd12d('0x36')]);_0xd11b81[_0xd12d('0x3e')]=_[_0xd12d('0x37')](_0xd11b81[_0xd12d('0x34')],_0xd11b81[_0xd12d('0x36')]);_0x1d1648[_0xd12d('0x38')]=_[_0xd12d('0x37')](_0xd11b81[_0xd12d('0x34')],qs[_0xd12d('0x39')](_0x122fae[_0xd12d('0x36')][_0xd12d('0x39')]));_0x1d1648[_0xd12d('0x38')]=_0x1d1648[_0xd12d('0x38')]['length']?_0x1d1648[_0xd12d('0x38')]:_0xd11b81[_0xd12d('0x34')];_0x1d1648[_0xd12d('0x3b')]=qs['sort'](_0x122fae['query'][_0xd12d('0x3c')]);_0x1d1648[_0xd12d('0x3d')]=qs[_0xd12d('0x3e')](_[_0xd12d('0x59')](_0x122fae[_0xd12d('0x36')],_0xd11b81[_0xd12d('0x3e')]));if(_0x122fae[_0xd12d('0x36')]['filter']){_0x1d1648[_0xd12d('0x3d')]=_[_0xd12d('0x40')](_0x1d1648[_0xd12d('0x3d')],{'$or':_[_0xd12d('0x31')](_0x1d1648[_0xd12d('0x38')],function(_0x792ff){var _0x124074={};_0x124074[_0x792ff]={'$like':'%'+_0x122fae[_0xd12d('0x36')][_0xd12d('0x3f')]+'%'};return _0x124074;})});}_0x1d1648=_[_0xd12d('0x40')]({},_0x1d1648,_0x122fae[_0xd12d('0x42')]);return _0x4cc63d[_0xd12d('0x5a')](_0x1d1648);}})[_0xd12d('0x2c')](function(_0x6b954e){if(_0x6b954e){_0x34b1e5=_0x6b954e[_0xd12d('0x5b')];if(!_0x122fae[_0xd12d('0x36')][_0xd12d('0x5c')](_0xd12d('0x3a'))){_0x1d1648[_0xd12d('0x27')]=qs['limit'](_0x122fae[_0xd12d('0x36')][_0xd12d('0x27')]);_0x1d1648[_0xd12d('0x24')]=qs[_0xd12d('0x24')](_0x122fae['query'][_0xd12d('0x24')]);}return _0x4cc63d[_0xd12d('0x5a')](_0x1d1648);}})[_0xd12d('0x2c')](function(_0x4a4843){if(_0x4a4843){return _0x4a4843?{'count':_0x34b1e5,'rows':_0x4a4843}:null;}})[_0xd12d('0x2c')](respondWithResult(_0x5b6e09,null))[_0xd12d('0x48')](handleError(_0x5b6e09,null));};exports['removeMembers']=function(_0x49abf4,_0x487ecc,_0x342b4d){return db[_0xd12d('0x43')][_0xd12d('0x4b')]({'where':{'id':_0x49abf4['params']['id']}})['then'](handleEntityNotFound(_0x487ecc,null))[_0xd12d('0x2c')](function(_0x1694f9){if(_0x1694f9){return _0x1694f9[_0xd12d('0x5d')](_0x49abf4[_0xd12d('0x36')][_0xd12d('0x55')]);}})[_0xd12d('0x2c')](respondWithStatusCode(_0x487ecc,null))[_0xd12d('0x48')](handleError(_0x487ecc,null));};exports[_0xd12d('0x5e')]=function(_0x34135e,_0xd4d85c,_0x25c86c){if(_0x34135e[_0xd12d('0x4e')]['id']){delete _0x34135e[_0xd12d('0x4e')]['id'];}return db[_0xd12d('0x43')][_0xd12d('0x4b')]({'where':{'id':_0x34135e['params']['id']}})[_0xd12d('0x2c')](handleEntityNotFound(_0xd4d85c,null))[_0xd12d('0x2c')](function(_0x210541){if(_0x210541){_0x34135e[_0xd12d('0x4e')][_0xd12d('0x5f')]=_0x210541['id'];return db[_0xd12d('0x51')][_0xd12d('0x4c')](_0x34135e[_0xd12d('0x4e')]);}})[_0xd12d('0x2c')](respondWithResult(_0xd4d85c,null))['catch'](handleError(_0xd4d85c,null));};exports[_0xd12d('0x60')]=function(_0x1e22b7,_0x3527b2,_0x53b7f0){var _0x5f034a={};var _0x38be77={};var _0x4f46bc;var _0x43802e;return db[_0xd12d('0x43')]['findOne']({'where':{'id':_0x1e22b7[_0xd12d('0x4f')]['id']}})[_0xd12d('0x2c')](handleEntityNotFound(_0x3527b2,null))[_0xd12d('0x2c')](function(_0x56a7b6){if(_0x56a7b6){_0x4f46bc=_0x56a7b6;_0x38be77['model']=_[_0xd12d('0x35')](db['ChatInternalMessage'][_0xd12d('0x4a')]);_0x38be77[_0xd12d('0x36')]=_[_0xd12d('0x35')](_0x1e22b7['query']);_0x38be77[_0xd12d('0x3e')]=_[_0xd12d('0x37')](_0x38be77['model'],_0x38be77['query']);_0x5f034a[_0xd12d('0x38')]=_['intersection'](_0x38be77[_0xd12d('0x34')],qs[_0xd12d('0x39')](_0x1e22b7[_0xd12d('0x36')][_0xd12d('0x39')]));_0x5f034a[_0xd12d('0x38')]=_0x5f034a[_0xd12d('0x38')][_0xd12d('0x5b')]?_0x5f034a[_0xd12d('0x38')]:_0x38be77['model'];_0x5f034a['order']=qs['sort'](_0x1e22b7[_0xd12d('0x36')][_0xd12d('0x3c')]);_0x5f034a[_0xd12d('0x3d')]=qs['filters'](_['pick'](_0x1e22b7[_0xd12d('0x36')],_0x38be77[_0xd12d('0x3e')]));if(_0x1e22b7['query']['filter']){_0x5f034a[_0xd12d('0x3d')]=_[_0xd12d('0x40')](_0x5f034a[_0xd12d('0x3d')],{'$or':_[_0xd12d('0x31')](_0x5f034a[_0xd12d('0x38')],function(_0x4600f7){var _0x4e6f7b={};_0x4e6f7b[_0x4600f7]={'$like':'%'+_0x1e22b7['query'][_0xd12d('0x3f')]+'%'};return _0x4e6f7b;})});}if(_0x1e22b7[_0xd12d('0x36')][_0xd12d('0x61')]){var _0xea625d=_0x1e22b7[_0xd12d('0x36')][_0xd12d('0x61')]['split'](',');var _0x455748={};_0x455748[_0xea625d[0x0]]={'$gte':moment(_0xea625d[0x1])[_0xd12d('0x62')](_0xd12d('0x63'))};_0x5f034a[_0xd12d('0x3d')]=_['merge'](_0x5f034a[_0xd12d('0x3d')],_0x455748);}_0x5f034a=_[_0xd12d('0x40')]({},_0x5f034a,_0x1e22b7[_0xd12d('0x42')]);return _0x4f46bc[_0xd12d('0x60')](_0x5f034a);}})['then'](function(_0x52a426){if(_0x52a426){_0x43802e=_0x52a426[_0xd12d('0x5b')];if(!_0x1e22b7[_0xd12d('0x36')][_0xd12d('0x5c')](_0xd12d('0x3a'))){_0x5f034a[_0xd12d('0x27')]=qs['limit'](_0x1e22b7[_0xd12d('0x36')]['limit']);_0x5f034a[_0xd12d('0x24')]=qs[_0xd12d('0x24')](_0x1e22b7[_0xd12d('0x36')]['offset']);}return _0x4f46bc[_0xd12d('0x60')](_0x5f034a);}})[_0xd12d('0x2c')](function(_0x3c5c28){if(_0x3c5c28){return _0x3c5c28?{'count':_0x43802e,'rows':_0x3c5c28}:null;}})[_0xd12d('0x2c')](respondWithResult(_0x3527b2,null))[_0xd12d('0x48')](handleError(_0x3527b2,null));}; \ No newline at end of file +var _0xce1e=['getMessages','zip-dir','moment','bluebird','util','sox','ejs','fs-extra','lodash','crypto','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./chatGroup.socket','register','status','end','offset','undefined','count','limit','set','json','reject','save','then','destroy','sendStatus','error','stack','name','send','map','ChatGroup','rawAttributes','fieldName','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','params','create','body','update','find','describe','getUnread','user','toInteger','addMembers','ids','omit','getMembers','User','nolimit','removeMembers','addMessage','ChatGroupId','ChatInternalMessage','$gte','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x23a246,_0x4eb2c5){var _0x4684a9=function(_0xa064aa){while(--_0xa064aa){_0x23a246['push'](_0x23a246['shift']());}};_0x4684a9(++_0x4eb2c5);}(_0xce1e,0x1c3));var _0xece1=function(_0x2e1924,_0x391674){_0x2e1924=_0x2e1924-0x0;var _0x34cd54=_0xce1e[_0x2e1924];return _0x34cd54;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xece1('0x0'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xece1('0x1'));var BPromise=require(_0xece1('0x2'));var Mustache=require('mustache');var util=require(_0xece1('0x3'));var path=require('path');var sox=require(_0xece1('0x4'));var csv=require('to-csv');var ejs=require(_0xece1('0x5'));var fs=require('fs');var fs_extra=require(_0xece1('0x6'));var _=require(_0xece1('0x7'));var squel=require('squel');var crypto=require(_0xece1('0x8'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xece1('0x9'));var querystring=require(_0xece1('0xa'));var Papa=require(_0xece1('0xb'));var Redis=require(_0xece1('0xc'));var authService=require('../../components/auth/service');var qs=require(_0xece1('0xd'));var as=require(_0xece1('0xe'));var hardwareService=require(_0xece1('0xf'));var logger=require(_0xece1('0x10'))('api');var utils=require(_0xece1('0x11'));var config=require(_0xece1('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0xece1('0x13'))['db'];config['redis']=_[_0xece1('0x14')](config[_0xece1('0x15')],{'host':_0xece1('0x16'),'port':0x18eb});var socket=require(_0xece1('0x17'))(new Redis(config['redis']));require(_0xece1('0x18'))[_0xece1('0x19')](socket);function respondWithStatusCode(_0x4819d0,_0x369e1a){_0x369e1a=_0x369e1a||0xcc;return function(_0x1a004b){if(_0x1a004b){return _0x4819d0['sendStatus'](_0x369e1a);}return _0x4819d0[_0xece1('0x1a')](_0x369e1a)[_0xece1('0x1b')]();};}function respondWithResult(_0x4f713c,_0x18cf26){_0x18cf26=_0x18cf26||0xc8;return function(_0x34e08a){if(_0x34e08a){return _0x4f713c['status'](_0x18cf26)['json'](_0x34e08a);}};}function respondWithFilteredResult(_0x350980,_0x1c6227){return function(_0x2837f5){if(_0x2837f5){var _0x2d56e3=typeof _0x1c6227[_0xece1('0x1c')]==='undefined'&&typeof _0x1c6227['limit']===_0xece1('0x1d');var _0x213653=_0x2837f5['count'];var _0x11fc32=_0x2d56e3?0x0:_0x1c6227[_0xece1('0x1c')];var _0x58f6c6=_0x2d56e3?_0x2837f5[_0xece1('0x1e')]:_0x1c6227[_0xece1('0x1c')]+_0x1c6227[_0xece1('0x1f')];var _0x1f1cc1;if(_0x58f6c6>=_0x213653){_0x58f6c6=_0x213653;_0x1f1cc1=0xc8;}else{_0x1f1cc1=0xce;}_0x350980[_0xece1('0x1a')](_0x1f1cc1);return _0x350980[_0xece1('0x20')]('Content-Range',_0x11fc32+'-'+_0x58f6c6+'/'+_0x213653)[_0xece1('0x21')](_0x2837f5);}return null;};}function patchUpdates(_0x42258c){return function(_0x44c6ed){try{jsonpatch['apply'](_0x44c6ed,_0x42258c,!![]);}catch(_0x19e892){return BPromise[_0xece1('0x22')](_0x19e892);}return _0x44c6ed[_0xece1('0x23')]();};}function saveUpdates(_0x326ac4,_0x3d788a){return function(_0x37a6d5){if(_0x37a6d5){return _0x37a6d5['update'](_0x326ac4)[_0xece1('0x24')](function(_0x52bfbd){return _0x52bfbd;});}return null;};}function removeEntity(_0x3e6d67,_0x263283){return function(_0x5af9b5){if(_0x5af9b5){return _0x5af9b5[_0xece1('0x25')]()[_0xece1('0x24')](function(){_0x3e6d67[_0xece1('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3cbd63,_0x4c9e57){return function(_0x451a5d){if(!_0x451a5d){_0x3cbd63[_0xece1('0x26')](0x194);}return _0x451a5d;};}function handleError(_0x2d59a4,_0x1df1f8){_0x1df1f8=_0x1df1f8||0x1f4;return function(_0x498688){logger[_0xece1('0x27')](_0x498688[_0xece1('0x28')]);if(_0x498688[_0xece1('0x29')]){delete _0x498688[_0xece1('0x29')];}_0x2d59a4[_0xece1('0x1a')](_0x1df1f8)[_0xece1('0x2a')](_0x498688);};}exports['index']=function(_0x157928,_0x5f27ec){var _0x19b534={},_0x3636e6={},_0x260c94={'count':0x0,'rows':[]};var _0x1b03f2=_[_0xece1('0x2b')](db[_0xece1('0x2c')][_0xece1('0x2d')],function(_0x750eb2){return{'name':_0x750eb2[_0xece1('0x2e')],'type':_0x750eb2['type']['key']};});_0x3636e6[_0xece1('0x2f')]=_[_0xece1('0x2b')](_0x1b03f2,_0xece1('0x29'));_0x3636e6[_0xece1('0x30')]=_[_0xece1('0x31')](_0x157928['query']);_0x3636e6['filters']=_[_0xece1('0x32')](_0x3636e6[_0xece1('0x2f')],_0x3636e6[_0xece1('0x30')]);_0x19b534[_0xece1('0x33')]=_['intersection'](_0x3636e6[_0xece1('0x2f')],qs[_0xece1('0x34')](_0x157928[_0xece1('0x30')][_0xece1('0x34')]));_0x19b534[_0xece1('0x33')]=_0x19b534[_0xece1('0x33')][_0xece1('0x35')]?_0x19b534[_0xece1('0x33')]:_0x3636e6['model'];if(!_0x157928[_0xece1('0x30')][_0xece1('0x36')]('nolimit')){_0x19b534[_0xece1('0x1f')]=qs[_0xece1('0x1f')](_0x157928[_0xece1('0x30')][_0xece1('0x1f')]);_0x19b534[_0xece1('0x1c')]=qs[_0xece1('0x1c')](_0x157928[_0xece1('0x30')]['offset']);}_0x19b534[_0xece1('0x37')]=qs[_0xece1('0x38')](_0x157928[_0xece1('0x30')][_0xece1('0x38')]);_0x19b534[_0xece1('0x39')]=qs['filters'](_[_0xece1('0x3a')](_0x157928[_0xece1('0x30')],_0x3636e6[_0xece1('0x3b')]),_0x1b03f2);if(_0x157928[_0xece1('0x30')][_0xece1('0x3c')]){_0x19b534[_0xece1('0x39')]=_[_0xece1('0x3d')](_0x19b534['where'],{'$or':_[_0xece1('0x2b')](_0x1b03f2,function(_0x5a8c13){if(_0x5a8c13['type']!==_0xece1('0x3e')){var _0x13cb72={};_0x13cb72[_0x5a8c13[_0xece1('0x29')]]={'$like':'%'+_0x157928[_0xece1('0x30')][_0xece1('0x3c')]+'%'};return _0x13cb72;}})});}_0x19b534=_[_0xece1('0x3d')]({},_0x19b534,_0x157928[_0xece1('0x3f')]);var _0x2844c5={'where':_0x19b534['where']};return db[_0xece1('0x2c')][_0xece1('0x1e')](_0x2844c5)[_0xece1('0x24')](function(_0x20f274){_0x260c94[_0xece1('0x1e')]=_0x20f274;if(_0x157928['query'][_0xece1('0x40')]){_0x19b534['include']=[{'all':!![]}];}return db[_0xece1('0x2c')][_0xece1('0x41')](_0x19b534);})[_0xece1('0x24')](function(_0x40e1c2){_0x260c94[_0xece1('0x42')]=_0x40e1c2;return _0x260c94;})[_0xece1('0x24')](respondWithFilteredResult(_0x5f27ec,_0x19b534))[_0xece1('0x43')](handleError(_0x5f27ec,null));};exports['show']=function(_0x53fb7b,_0x5dba92){var _0x28e432={'raw':!![],'where':{'id':_0x53fb7b[_0xece1('0x44')]['id']}},_0x5b6699={};_0x5b6699['model']=_[_0xece1('0x31')](db[_0xece1('0x2c')][_0xece1('0x2d')]);_0x5b6699['query']=_[_0xece1('0x31')](_0x53fb7b['query']);_0x5b6699[_0xece1('0x3b')]=_[_0xece1('0x32')](_0x5b6699[_0xece1('0x2f')],_0x5b6699[_0xece1('0x30')]);_0x28e432[_0xece1('0x33')]=_[_0xece1('0x32')](_0x5b6699[_0xece1('0x2f')],qs[_0xece1('0x34')](_0x53fb7b[_0xece1('0x30')][_0xece1('0x34')]));_0x28e432[_0xece1('0x33')]=_0x28e432[_0xece1('0x33')][_0xece1('0x35')]?_0x28e432[_0xece1('0x33')]:_0x5b6699[_0xece1('0x2f')];if(_0x53fb7b[_0xece1('0x30')]['includeAll']){_0x28e432['include']=[{'all':!![]}];}_0x28e432=_['merge']({},_0x28e432,_0x53fb7b[_0xece1('0x3f')]);return db['ChatGroup']['find'](_0x28e432)[_0xece1('0x24')](handleEntityNotFound(_0x5dba92,null))[_0xece1('0x24')](respondWithResult(_0x5dba92,null))[_0xece1('0x43')](handleError(_0x5dba92,null));};exports[_0xece1('0x45')]=function(_0x622c6f,_0xa47ce2){return db[_0xece1('0x2c')][_0xece1('0x45')](_0x622c6f[_0xece1('0x46')],{})['then'](respondWithResult(_0xa47ce2,0xc9))[_0xece1('0x43')](handleError(_0xa47ce2,null));};exports[_0xece1('0x47')]=function(_0x1f1118,_0x521745){if(_0x1f1118[_0xece1('0x46')]['id']){delete _0x1f1118[_0xece1('0x46')]['id'];}return db['ChatGroup'][_0xece1('0x48')]({'where':{'id':_0x1f1118[_0xece1('0x44')]['id']}})['then'](handleEntityNotFound(_0x521745,null))[_0xece1('0x24')](saveUpdates(_0x1f1118['body'],null))[_0xece1('0x24')](respondWithResult(_0x521745,null))['catch'](handleError(_0x521745,null));};exports['destroy']=function(_0x3bfdad,_0xdc467b){return db[_0xece1('0x2c')][_0xece1('0x48')]({'where':{'id':_0x3bfdad[_0xece1('0x44')]['id']}})[_0xece1('0x24')](handleEntityNotFound(_0xdc467b,null))[_0xece1('0x24')](removeEntity(_0xdc467b,null))[_0xece1('0x43')](handleError(_0xdc467b,null));};exports[_0xece1('0x49')]=function(_0x22aa89,_0x40a523){return db[_0xece1('0x2c')][_0xece1('0x49')]()[_0xece1('0x24')](respondWithResult(_0x40a523,null))['catch'](handleError(_0x40a523,null));};exports[_0xece1('0x4a')]=function(_0x22b0f0,_0x41d16b,_0x23d22e){return db['ChatInternalMessage']['count']({'where':{'ChatGroupId':_0x22b0f0[_0xece1('0x44')]['id'],'ToId':_0x22b0f0[_0xece1('0x4b')]['id'],'read':![]}})[_0xece1('0x24')](function(_0x558910){return{'id':_[_0xece1('0x4c')](_0x22b0f0[_0xece1('0x44')]['id']),'count':_0x558910};})[_0xece1('0x24')](respondWithResult(_0x41d16b,null))[_0xece1('0x43')](handleError(_0x41d16b,null));};exports[_0xece1('0x4d')]=function(_0xecda99,_0x5cfee4,_0x293311){return db[_0xece1('0x2c')]['find']({'where':{'id':_0xecda99[_0xece1('0x44')]['id']}})[_0xece1('0x24')](handleEntityNotFound(_0x5cfee4,null))['then'](function(_0x513cb6){if(_0x513cb6){return _0x513cb6[_0xece1('0x4d')](_0xecda99[_0xece1('0x46')][_0xece1('0x4e')],_[_0xece1('0x4f')](_0xecda99[_0xece1('0x46')],[_0xece1('0x4e'),'id'])||{});}})[_0xece1('0x24')](respondWithResult(_0x5cfee4,null))[_0xece1('0x43')](handleError(_0x5cfee4,null));};exports[_0xece1('0x50')]=function(_0x5d843a,_0x15425c,_0x5daca1){var _0x50f272={};var _0x5d0406={};var _0x5bbdf1;var _0x3897d3;return db[_0xece1('0x2c')]['findOne']({'where':{'id':_0x5d843a[_0xece1('0x44')]['id']}})['then'](handleEntityNotFound(_0x15425c,null))['then'](function(_0x34da65){if(_0x34da65){_0x5bbdf1=_0x34da65;_0x5d0406['model']=_[_0xece1('0x31')](db[_0xece1('0x51')][_0xece1('0x2d')]);_0x5d0406['query']=_[_0xece1('0x31')](_0x5d843a['query']);_0x5d0406['filters']=_[_0xece1('0x32')](_0x5d0406['model'],_0x5d0406[_0xece1('0x30')]);_0x50f272[_0xece1('0x33')]=_['intersection'](_0x5d0406[_0xece1('0x2f')],qs[_0xece1('0x34')](_0x5d843a[_0xece1('0x30')]['fields']));_0x50f272['attributes']=_0x50f272[_0xece1('0x33')][_0xece1('0x35')]?_0x50f272[_0xece1('0x33')]:_0x5d0406[_0xece1('0x2f')];_0x50f272['order']=qs['sort'](_0x5d843a[_0xece1('0x30')][_0xece1('0x38')]);_0x50f272[_0xece1('0x39')]=qs[_0xece1('0x3b')](_['pick'](_0x5d843a[_0xece1('0x30')],_0x5d0406['filters']));if(_0x5d843a[_0xece1('0x30')][_0xece1('0x3c')]){_0x50f272[_0xece1('0x39')]=_['merge'](_0x50f272[_0xece1('0x39')],{'$or':_[_0xece1('0x2b')](_0x50f272['attributes'],function(_0x43ab16){var _0x1a4f2a={};_0x1a4f2a[_0x43ab16]={'$like':'%'+_0x5d843a[_0xece1('0x30')][_0xece1('0x3c')]+'%'};return _0x1a4f2a;})});}_0x50f272=_[_0xece1('0x3d')]({},_0x50f272,_0x5d843a[_0xece1('0x3f')]);return _0x5bbdf1[_0xece1('0x50')](_0x50f272);}})['then'](function(_0x2ffd86){if(_0x2ffd86){_0x3897d3=_0x2ffd86[_0xece1('0x35')];if(!_0x5d843a[_0xece1('0x30')][_0xece1('0x36')](_0xece1('0x52'))){_0x50f272['limit']=qs[_0xece1('0x1f')](_0x5d843a['query'][_0xece1('0x1f')]);_0x50f272[_0xece1('0x1c')]=qs[_0xece1('0x1c')](_0x5d843a[_0xece1('0x30')]['offset']);}return _0x5bbdf1[_0xece1('0x50')](_0x50f272);}})[_0xece1('0x24')](function(_0x1583c7){if(_0x1583c7){return _0x1583c7?{'count':_0x3897d3,'rows':_0x1583c7}:null;}})[_0xece1('0x24')](respondWithResult(_0x15425c,null))[_0xece1('0x43')](handleError(_0x15425c,null));};exports[_0xece1('0x53')]=function(_0x49e8ed,_0x5a9c9f,_0x5dc6ee){return db[_0xece1('0x2c')][_0xece1('0x48')]({'where':{'id':_0x49e8ed[_0xece1('0x44')]['id']}})[_0xece1('0x24')](handleEntityNotFound(_0x5a9c9f,null))[_0xece1('0x24')](function(_0x3f62f4){if(_0x3f62f4){return _0x3f62f4[_0xece1('0x53')](_0x49e8ed[_0xece1('0x30')][_0xece1('0x4e')]);}})['then'](respondWithStatusCode(_0x5a9c9f,null))[_0xece1('0x43')](handleError(_0x5a9c9f,null));};exports[_0xece1('0x54')]=function(_0x399690,_0x3e36f6,_0x519a62){if(_0x399690['body']['id']){delete _0x399690[_0xece1('0x46')]['id'];}return db[_0xece1('0x2c')][_0xece1('0x48')]({'where':{'id':_0x399690['params']['id']}})[_0xece1('0x24')](handleEntityNotFound(_0x3e36f6,null))[_0xece1('0x24')](function(_0x2720ea){if(_0x2720ea){_0x399690['body'][_0xece1('0x55')]=_0x2720ea['id'];return db[_0xece1('0x56')][_0xece1('0x45')](_0x399690[_0xece1('0x46')]);}})[_0xece1('0x24')](respondWithResult(_0x3e36f6,null))[_0xece1('0x43')](handleError(_0x3e36f6,null));};exports['getMessages']=function(_0x4494d2,_0x13af42,_0x3c85cc){var _0x5da0d3={};var _0xf9895e={};var _0x544bdd;var _0x3ad8f3;return db['ChatGroup']['findOne']({'where':{'id':_0x4494d2[_0xece1('0x44')]['id']}})[_0xece1('0x24')](handleEntityNotFound(_0x13af42,null))[_0xece1('0x24')](function(_0x32552e){if(_0x32552e){_0x544bdd=_0x32552e;_0xf9895e[_0xece1('0x2f')]=_['keys'](db[_0xece1('0x56')][_0xece1('0x2d')]);_0xf9895e[_0xece1('0x30')]=_[_0xece1('0x31')](_0x4494d2[_0xece1('0x30')]);_0xf9895e[_0xece1('0x3b')]=_[_0xece1('0x32')](_0xf9895e[_0xece1('0x2f')],_0xf9895e[_0xece1('0x30')]);_0x5da0d3[_0xece1('0x33')]=_['intersection'](_0xf9895e[_0xece1('0x2f')],qs[_0xece1('0x34')](_0x4494d2[_0xece1('0x30')][_0xece1('0x34')]));_0x5da0d3[_0xece1('0x33')]=_0x5da0d3[_0xece1('0x33')]['length']?_0x5da0d3[_0xece1('0x33')]:_0xf9895e[_0xece1('0x2f')];_0x5da0d3[_0xece1('0x37')]=qs['sort'](_0x4494d2[_0xece1('0x30')][_0xece1('0x38')]);_0x5da0d3['where']=qs[_0xece1('0x3b')](_[_0xece1('0x3a')](_0x4494d2[_0xece1('0x30')],_0xf9895e[_0xece1('0x3b')]));if(_0x4494d2[_0xece1('0x30')][_0xece1('0x3c')]){_0x5da0d3[_0xece1('0x39')]=_[_0xece1('0x3d')](_0x5da0d3[_0xece1('0x39')],{'$or':_['map'](_0x5da0d3[_0xece1('0x33')],function(_0x55e969){var _0x368fe6={};_0x368fe6[_0x55e969]={'$like':'%'+_0x4494d2[_0xece1('0x30')][_0xece1('0x3c')]+'%'};return _0x368fe6;})});}if(_0x4494d2[_0xece1('0x30')][_0xece1('0x57')]){var _0x5b31c4=_0x4494d2[_0xece1('0x30')]['$gte']['split'](',');var _0x3ec215={};_0x3ec215[_0x5b31c4[0x0]]={'$gte':moment(_0x5b31c4[0x1])['format'](_0xece1('0x58'))};_0x5da0d3[_0xece1('0x39')]=_['merge'](_0x5da0d3[_0xece1('0x39')],_0x3ec215);}_0x5da0d3=_['merge']({},_0x5da0d3,_0x4494d2['options']);return _0x544bdd['getMessages'](_0x5da0d3);}})[_0xece1('0x24')](function(_0x4383f4){if(_0x4383f4){_0x3ad8f3=_0x4383f4[_0xece1('0x35')];if(!_0x4494d2[_0xece1('0x30')][_0xece1('0x36')](_0xece1('0x52'))){_0x5da0d3[_0xece1('0x1f')]=qs['limit'](_0x4494d2['query'][_0xece1('0x1f')]);_0x5da0d3[_0xece1('0x1c')]=qs[_0xece1('0x1c')](_0x4494d2[_0xece1('0x30')][_0xece1('0x1c')]);}return _0x544bdd[_0xece1('0x59')](_0x5da0d3);}})['then'](function(_0x321c3c){if(_0x321c3c){return _0x321c3c?{'count':_0x3ad8f3,'rows':_0x321c3c}:null;}})[_0xece1('0x24')](respondWithResult(_0x13af42,null))[_0xece1('0x43')](handleError(_0x13af42,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index 7802af4..c78352d 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 _0x7e74=['events','ChatGroup','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x5930ba,_0x325f6f){var _0x4899a9=function(_0x125131){while(--_0x125131){_0x5930ba['push'](_0x5930ba['shift']());}};_0x4899a9(++_0x325f6f);}(_0x7e74,0xbd));var _0x47e7=function(_0x5a74d2,_0x23fe51){_0x5a74d2=_0x5a74d2-0x0;var _0x17d102=_0x7e74[_0x5a74d2];return _0x17d102;};'use strict';var EventEmitter=require(_0x47e7('0x0'));var ChatGroup=require('../../mysqldb')['db'][_0x47e7('0x1')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x47e7('0x2')](0x0);var events={'afterCreate':_0x47e7('0x3'),'afterUpdate':_0x47e7('0x4'),'afterDestroy':_0x47e7('0x5')};function emitEvent(_0x548d8b){return function(_0x2f084c,_0x75f99d,_0xb4dd0){ChatGroupEvents[_0x47e7('0x6')](_0x548d8b+':'+_0x2f084c['id'],_0x2f084c);ChatGroupEvents[_0x47e7('0x6')](_0x548d8b,_0x2f084c);_0xb4dd0(null);};}for(var e in events){if(events[_0x47e7('0x7')](e)){var event=events[e];ChatGroup[_0x47e7('0x8')](e,emitEvent(event));}}module['exports']=ChatGroupEvents; \ No newline at end of file +var _0x6440=['setMaxListeners','save','update','emit','hasOwnProperty','hook','events','../../mysqldb'];(function(_0x3cafb8,_0x32860e){var _0x4b7f85=function(_0x31b11d){while(--_0x31b11d){_0x3cafb8['push'](_0x3cafb8['shift']());}};_0x4b7f85(++_0x32860e);}(_0x6440,0x1de));var _0x0644=function(_0x1d6a82,_0x37c315){_0x1d6a82=_0x1d6a82-0x0;var _0x5834ac=_0x6440[_0x1d6a82];return _0x5834ac;};'use strict';var EventEmitter=require(_0x0644('0x0'));var ChatGroup=require(_0x0644('0x1'))['db']['ChatGroup'];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x0644('0x2')](0x0);var events={'afterCreate':_0x0644('0x3'),'afterUpdate':_0x0644('0x4'),'afterDestroy':'remove'};function emitEvent(_0x46b094){return function(_0x40db45,_0x15eb72,_0x3fba73){ChatGroupEvents[_0x0644('0x5')](_0x46b094+':'+_0x40db45['id'],_0x40db45);ChatGroupEvents[_0x0644('0x5')](_0x46b094,_0x40db45);_0x3fba73(null);};}for(var e in events){if(events[_0x0644('0x6')](e)){var event=events[e];ChatGroup[_0x0644('0x7')](e,emitEvent(event));}}module['exports']=ChatGroupEvents; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.model.js b/server/api/chatGroup/chatGroup.model.js index bf3ed81..ce153af 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 _0x4637=['lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatGroup.attributes','exports','define','ChatGroup'];(function(_0x6d76e8,_0x3a5b96){var _0x10a933=function(_0xcca43b){while(--_0xcca43b){_0x6d76e8['push'](_0x6d76e8['shift']());}};_0x10a933(++_0x3a5b96);}(_0x4637,0x114));var _0x7463=function(_0xc6be3a,_0x540e05){_0xc6be3a=_0xc6be3a-0x0;var _0x56a310=_0x4637[_0xc6be3a];return _0x56a310;};'use strict';var _=require(_0x7463('0x0'));var util=require('util');var logger=require(_0x7463('0x1'))('api');var moment=require(_0x7463('0x2'));var BPromise=require(_0x7463('0x3'));var rp=require(_0x7463('0x4'));var fs=require('fs');var path=require(_0x7463('0x5'));var rimraf=require(_0x7463('0x6'));var config=require(_0x7463('0x7'));var attributes=require(_0x7463('0x8'));module[_0x7463('0x9')]=function(_0x3d5a76,_0x4ec237){return _0x3d5a76[_0x7463('0xa')](_0x7463('0xb'),attributes,{'tableName':'chat_groups','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xde73=['../../config/environment','exports','define','ChatGroup','chat_groups','lodash','util','../../config/logger','moment','request-promise','path','rimraf'];(function(_0xa30026,_0x3136b6){var _0x2bb310=function(_0x8a3b65){while(--_0x8a3b65){_0xa30026['push'](_0xa30026['shift']());}};_0x2bb310(++_0x3136b6);}(_0xde73,0x185));var _0x3de7=function(_0x4e6b0b,_0x3f1de2){_0x4e6b0b=_0x4e6b0b-0x0;var _0x2c9f2f=_0xde73[_0x4e6b0b];return _0x2c9f2f;};'use strict';var _=require(_0x3de7('0x0'));var util=require(_0x3de7('0x1'));var logger=require(_0x3de7('0x2'))('api');var moment=require(_0x3de7('0x3'));var BPromise=require('bluebird');var rp=require(_0x3de7('0x4'));var fs=require('fs');var path=require(_0x3de7('0x5'));var rimraf=require(_0x3de7('0x6'));var config=require(_0x3de7('0x7'));var attributes=require('./chatGroup.attributes');module[_0x3de7('0x8')]=function(_0x572696,_0x271b02){return _0x572696[_0x3de7('0x9')](_0x3de7('0xa'),attributes,{'tableName':_0x3de7('0xb'),'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 456a2bc..ba6c33c 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 _0x536e=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','./chatGroup.socket','register','then','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0xdea41a,_0x552987){var _0x15d0d8=function(_0x1e0d0b){while(--_0x1e0d0b){_0xdea41a['push'](_0xdea41a['shift']());}};_0x15d0d8(++_0x552987);}(_0x536e,0x155));var _0xe536=function(_0x5b7696,_0x3ebd92){_0x5b7696=_0x5b7696-0x0;var _0x42d7b9=_0x536e[_0x5b7696];return _0x42d7b9;};'use strict';var _=require(_0xe536('0x0'));var util=require(_0xe536('0x1'));var moment=require(_0xe536('0x2'));var BPromise=require(_0xe536('0x3'));var rs=require(_0xe536('0x4'));var fs=require('fs');var Redis=require(_0xe536('0x5'));var db=require(_0xe536('0x6'))['db'];var utils=require(_0xe536('0x7'));var logger=require(_0xe536('0x8'))(_0xe536('0x9'));var config=require(_0xe536('0xa'));var jayson=require(_0xe536('0xb'));var client=jayson[_0xe536('0xc')][_0xe536('0xd')]({'port':0x232a});config['redis']=_['defaults'](config[_0xe536('0xe')],{'host':_0xe536('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe536('0xe')]));require(_0xe536('0x10'))[_0xe536('0x11')](socket);function respondWithRpcPromise(_0x1d9dcd,_0x2581df,_0x1df409){return new BPromise(function(_0xe08ef0,_0x507dad){return client['request'](_0x1d9dcd,_0x1df409)[_0xe536('0x12')](function(_0xbec6ca){logger['info'](_0xe536('0x13'),_0x2581df,_0xe536('0x14'));logger[_0xe536('0x15')](_0xe536('0x16'),_0x2581df,_0xe536('0x14'),JSON[_0xe536('0x17')](_0xbec6ca));if(_0xbec6ca['error']){if(_0xbec6ca[_0xe536('0x18')][_0xe536('0x19')]===0x1f4){logger[_0xe536('0x18')](_0xe536('0x13'),_0x2581df,_0xbec6ca[_0xe536('0x18')]['message']);return _0x507dad(_0xbec6ca[_0xe536('0x18')][_0xe536('0x1a')]);}logger[_0xe536('0x18')]('ChatGroup,\x20%s,\x20%s',_0x2581df,_0xbec6ca[_0xe536('0x18')][_0xe536('0x1a')]);return _0xe08ef0(_0xbec6ca[_0xe536('0x18')][_0xe536('0x1a')]);}else{logger['info']('ChatGroup,\x20%s,\x20%s',_0x2581df,_0xe536('0x14'));_0xe08ef0(_0xbec6ca[_0xe536('0x1b')][_0xe536('0x1a')]);}})[_0xe536('0x1c')](function(_0x4f6eb2){logger['error'](_0xe536('0x13'),_0x2581df,_0x4f6eb2);_0x507dad(_0x4f6eb2);});});} \ No newline at end of file +var _0x35e2=['ChatGroup,\x20%s,\x20%s','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','message','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info'];(function(_0x4282a7,_0x351556){var _0x5b7916=function(_0x216bac){while(--_0x216bac){_0x4282a7['push'](_0x4282a7['shift']());}};_0x5b7916(++_0x351556);}(_0x35e2,0x1ed));var _0x235e=function(_0x422905,_0x3bce3a){_0x422905=_0x422905-0x0;var _0x33dc6c=_0x35e2[_0x422905];return _0x33dc6c;};'use strict';var _=require(_0x235e('0x0'));var util=require('util');var moment=require(_0x235e('0x1'));var BPromise=require(_0x235e('0x2'));var rs=require(_0x235e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x235e('0x4'))['db'];var utils=require(_0x235e('0x5'));var logger=require(_0x235e('0x6'))(_0x235e('0x7'));var config=require(_0x235e('0x8'));var jayson=require(_0x235e('0x9'));var client=jayson[_0x235e('0xa')][_0x235e('0xb')]({'port':0x232a});config[_0x235e('0xc')]=_[_0x235e('0xd')](config[_0x235e('0xc')],{'host':_0x235e('0xe'),'port':0x18eb});var socket=require(_0x235e('0xf'))(new Redis(config['redis']));require('./chatGroup.socket')[_0x235e('0x10')](socket);function respondWithRpcPromise(_0x41f1c8,_0x4a3ec7,_0x40dc4d){return new BPromise(function(_0x22a10d,_0x247da6){return client[_0x235e('0x11')](_0x41f1c8,_0x40dc4d)[_0x235e('0x12')](function(_0x1a85f6){logger[_0x235e('0x13')](_0x235e('0x14'),_0x4a3ec7,_0x235e('0x15'));logger[_0x235e('0x16')](_0x235e('0x17'),_0x4a3ec7,_0x235e('0x15'),JSON[_0x235e('0x18')](_0x1a85f6));if(_0x1a85f6[_0x235e('0x19')]){if(_0x1a85f6['error']['code']===0x1f4){logger[_0x235e('0x19')](_0x235e('0x14'),_0x4a3ec7,_0x1a85f6[_0x235e('0x19')][_0x235e('0x1a')]);return _0x247da6(_0x1a85f6[_0x235e('0x19')][_0x235e('0x1a')]);}logger['error']('ChatGroup,\x20%s,\x20%s',_0x4a3ec7,_0x1a85f6[_0x235e('0x19')][_0x235e('0x1a')]);return _0x22a10d(_0x1a85f6[_0x235e('0x19')][_0x235e('0x1a')]);}else{logger[_0x235e('0x13')](_0x235e('0x14'),_0x4a3ec7,_0x235e('0x15'));_0x22a10d(_0x1a85f6['result'][_0x235e('0x1a')]);}})['catch'](function(_0x3b4ce9){logger[_0x235e('0x19')](_0x235e('0x14'),_0x4a3ec7,_0x3b4ce9);_0x247da6(_0x3b4ce9);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index 538d146..e256bb3 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 _0x57a9=['update','removeListener','register','length','chatGroup:','./chatGroup.events','save','remove'];(function(_0x5ace25,_0x536239){var _0x4ba17a=function(_0x1ee54e){while(--_0x1ee54e){_0x5ace25['push'](_0x5ace25['shift']());}};_0x4ba17a(++_0x536239);}(_0x57a9,0x1d5));var _0x957a=function(_0x4e8659,_0x8d6bc6){_0x4e8659=_0x4e8659-0x0;var _0x44d415=_0x57a9[_0x4e8659];return _0x44d415;};'use strict';var ChatGroupEvents=require(_0x957a('0x0'));var events=[_0x957a('0x1'),_0x957a('0x2'),_0x957a('0x3')];function createListener(_0x6d6b35,_0x4ac365){return function(_0x533099){_0x4ac365['emit'](_0x6d6b35,_0x533099);};}function removeListener(_0xc92e85,_0x46b7a7){return function(){ChatGroupEvents[_0x957a('0x4')](_0xc92e85,_0x46b7a7);};}exports[_0x957a('0x5')]=function(_0x34e441){for(var _0x491a34=0x0,_0x9766f=events[_0x957a('0x6')];_0x491a34<_0x9766f;_0x491a34++){var _0x281f42=events[_0x491a34];var _0x55d88f=createListener(_0x957a('0x7')+_0x281f42,_0x34e441);ChatGroupEvents['on'](_0x281f42,_0x55d88f);}}; \ No newline at end of file +var _0x3098=['length','chatGroup:','./chatGroup.events','update','emit','removeListener'];(function(_0xf4cdcd,_0x159fdb){var _0x1ab584=function(_0x161fae){while(--_0x161fae){_0xf4cdcd['push'](_0xf4cdcd['shift']());}};_0x1ab584(++_0x159fdb);}(_0x3098,0xd4));var _0x8309=function(_0x5bd4f6,_0xf4e45c){_0x5bd4f6=_0x5bd4f6-0x0;var _0x33a165=_0x3098[_0x5bd4f6];return _0x33a165;};'use strict';var ChatGroupEvents=require(_0x8309('0x0'));var events=['save','remove',_0x8309('0x1')];function createListener(_0x50364d,_0x43f999){return function(_0x4a05dc){_0x43f999[_0x8309('0x2')](_0x50364d,_0x4a05dc);};}function removeListener(_0x5646b7,_0x3dd970){return function(){ChatGroupEvents[_0x8309('0x3')](_0x5646b7,_0x3dd970);};}exports['register']=function(_0x9b911b){for(var _0x5ecd62=0x0,_0x409a82=events[_0x8309('0x4')];_0x5ecd62<_0x409a82;_0x5ecd62++){var _0x27dfe0=events[_0x5ecd62];var _0x472b7e=createListener(_0x8309('0x5')+_0x27dfe0,_0x9b911b);ChatGroupEvents['on'](_0x27dfe0,_0x472b7e);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index 8af2921..2852c86 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 _0x4059=['update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','/:id','show','/:id/unread','getUnread','/:id/members','getMembers','/:id/messages','post','put'];(function(_0x43da28,_0x223efe){var _0x2c26a5=function(_0x4724b7){while(--_0x4724b7){_0x43da28['push'](_0x43da28['shift']());}};_0x2c26a5(++_0x223efe);}(_0x4059,0x1be));var _0x9405=function(_0x4a8ab9,_0x5615d3){_0x4a8ab9=_0x4a8ab9-0x0;var _0x22ce40=_0x4059[_0x4a8ab9];return _0x22ce40;};'use strict';var multer=require(_0x9405('0x0'));var util=require(_0x9405('0x1'));var path=require(_0x9405('0x2'));var timeout=require(_0x9405('0x3'));var express=require(_0x9405('0x4'));var router=express['Router']();var fs_extra=require(_0x9405('0x5'));var auth=require(_0x9405('0x6'));var interaction=require(_0x9405('0x7'));var config=require(_0x9405('0x8'));var controller=require('./chatGroup.controller');router[_0x9405('0x9')]('/',auth[_0x9405('0xa')](),controller[_0x9405('0xb')]);router[_0x9405('0x9')](_0x9405('0xc'),auth[_0x9405('0xa')](),controller['describe']);router[_0x9405('0x9')](_0x9405('0xd'),auth[_0x9405('0xa')](),controller[_0x9405('0xe')]);router[_0x9405('0x9')](_0x9405('0xf'),auth[_0x9405('0xa')](),controller[_0x9405('0x10')]);router[_0x9405('0x9')](_0x9405('0x11'),auth[_0x9405('0xa')](),controller[_0x9405('0x12')]);router[_0x9405('0x9')](_0x9405('0x13'),auth[_0x9405('0xa')](),controller['getMessages']);router[_0x9405('0x14')]('/',auth[_0x9405('0xa')](),controller['create']);router['post'](_0x9405('0x11'),auth['isAuthenticated'](),controller['addMembers']);router[_0x9405('0x14')]('/:id/messages',auth[_0x9405('0xa')](),controller['addMessage']);router[_0x9405('0x15')](_0x9405('0xd'),auth[_0x9405('0xa')](),controller[_0x9405('0x16')]);router[_0x9405('0x17')]('/:id',auth[_0x9405('0xa')](),controller[_0x9405('0x18')]);router[_0x9405('0x17')](_0x9405('0x11'),auth[_0x9405('0xa')](),controller['removeMembers']);module[_0x9405('0x19')]=router; \ No newline at end of file +var _0x667e=['get','isAuthenticated','index','/describe','/:id','/:id/unread','getUnread','/:id/members','getMembers','/:id/messages','getMessages','create','post','addMembers','put','update','delete','removeMembers','exports','multer','connect-timeout','express','Router','fs-extra','./chatGroup.controller'];(function(_0x1db117,_0x40b195){var _0xd31170=function(_0x396a9a){while(--_0x396a9a){_0x1db117['push'](_0x1db117['shift']());}};_0xd31170(++_0x40b195);}(_0x667e,0x90));var _0xe667=function(_0x4fb992,_0x3a43f2){_0x4fb992=_0x4fb992-0x0;var _0x4271a5=_0x667e[_0x4fb992];return _0x4271a5;};'use strict';var multer=require(_0xe667('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xe667('0x1'));var express=require(_0xe667('0x2'));var router=express[_0xe667('0x3')]();var fs_extra=require(_0xe667('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xe667('0x5'));router[_0xe667('0x6')]('/',auth[_0xe667('0x7')](),controller[_0xe667('0x8')]);router[_0xe667('0x6')](_0xe667('0x9'),auth[_0xe667('0x7')](),controller['describe']);router[_0xe667('0x6')](_0xe667('0xa'),auth[_0xe667('0x7')](),controller['show']);router['get'](_0xe667('0xb'),auth['isAuthenticated'](),controller[_0xe667('0xc')]);router[_0xe667('0x6')](_0xe667('0xd'),auth[_0xe667('0x7')](),controller[_0xe667('0xe')]);router[_0xe667('0x6')](_0xe667('0xf'),auth[_0xe667('0x7')](),controller[_0xe667('0x10')]);router['post']('/',auth[_0xe667('0x7')](),controller[_0xe667('0x11')]);router[_0xe667('0x12')](_0xe667('0xd'),auth[_0xe667('0x7')](),controller[_0xe667('0x13')]);router[_0xe667('0x12')](_0xe667('0xf'),auth[_0xe667('0x7')](),controller['addMessage']);router[_0xe667('0x14')]('/:id',auth[_0xe667('0x7')](),controller[_0xe667('0x15')]);router['delete'](_0xe667('0xa'),auth[_0xe667('0x7')](),controller['destroy']);router[_0xe667('0x16')](_0xe667('0xd'),auth['isAuthenticated'](),controller[_0xe667('0x17')]);module[_0xe667('0x18')]=router; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.attributes.js b/server/api/chatInteraction/chatInteraction.attributes.js index 854c3d8..2f5587a 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 _0x2805=['DATE','long','out','INTEGER','exports','BOOLEAN','star','thumb','TEXT','STRING'];(function(_0xaa1b3e,_0x47d976){var _0x454d7d=function(_0x575b32){while(--_0x575b32){_0xaa1b3e['push'](_0xaa1b3e['shift']());}};_0x454d7d(++_0x47d976);}(_0x2805,0x13a));var _0x5280=function(_0x20589d,_0x55d5bf){_0x20589d=_0x20589d-0x0;var _0x422de9=_0x2805[_0x20589d];return _0x422de9;};'use strict';var Sequelize=require('sequelize');module[_0x5280('0x0')]={'closed':{'type':Sequelize[_0x5280('0x1')],'defaultValue':![]},'ratingValue':{'type':Sequelize['INTEGER']},'ratingType':{'type':Sequelize['ENUM'](_0x5280('0x2'),_0x5280('0x3')),'defaultValue':_0x5280('0x2')},'ratingMessage':{'type':Sequelize[_0x5280('0x4')]},'pathTranscript':{'type':Sequelize[_0x5280('0x4')]},'mailTranscript':{'type':Sequelize[_0x5280('0x5')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x5280('0x6')]},'disposition':{'type':Sequelize[_0x5280('0x5')]},'secondDisposition':{'type':Sequelize[_0x5280('0x5')]},'thirdDisposition':{'type':Sequelize[_0x5280('0x5')]},'note':{'type':Sequelize[_0x5280('0x5')]},'browserName':{'type':Sequelize['STRING']},'browserVersion':{'type':Sequelize[_0x5280('0x5')]},'osName':{'type':Sequelize[_0x5280('0x5')]},'osVersion':{'type':Sequelize[_0x5280('0x5')]},'deviceModel':{'type':Sequelize[_0x5280('0x5')]},'deviceVendor':{'type':Sequelize[_0x5280('0x5')]},'deviceType':{'type':Sequelize[_0x5280('0x5')]},'referer':{'type':Sequelize['TEXT']},'customerIp':{'type':Sequelize[_0x5280('0x5')]},'formData':{'type':Sequelize[_0x5280('0x4')](_0x5280('0x7'))},'read1stAt':{'type':Sequelize[_0x5280('0x6')]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x5280('0x8')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize['STRING']},'customerPort':{'type':Sequelize[_0x5280('0x5')]},'vidaooSessionId':{'type':Sequelize[_0x5280('0x4')]},'autoreplyExecuted':{'type':Sequelize[_0x5280('0x1')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x5280('0x9')]}}; \ No newline at end of file +var _0x1276=['thumb','TEXT','DATE','STRING','long','ENUM','out','BOOLEAN','sequelize','exports','INTEGER'];(function(_0x5c0374,_0x3f578c){var _0x514224=function(_0x905ec){while(--_0x905ec){_0x5c0374['push'](_0x5c0374['shift']());}};_0x514224(++_0x3f578c);}(_0x1276,0x131));var _0x6127=function(_0x2c12fa,_0x536777){_0x2c12fa=_0x2c12fa-0x0;var _0x78d795=_0x1276[_0x2c12fa];return _0x78d795;};'use strict';var Sequelize=require(_0x6127('0x0'));module[_0x6127('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x6127('0x2')]},'ratingType':{'type':Sequelize['ENUM']('star',_0x6127('0x3')),'defaultValue':'star'},'ratingMessage':{'type':Sequelize[_0x6127('0x4')]},'pathTranscript':{'type':Sequelize['TEXT']},'mailTranscript':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x6127('0x5')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x6127('0x6')]},'thirdDisposition':{'type':Sequelize[_0x6127('0x6')]},'note':{'type':Sequelize[_0x6127('0x6')]},'browserName':{'type':Sequelize['STRING']},'browserVersion':{'type':Sequelize['STRING']},'osName':{'type':Sequelize[_0x6127('0x6')]},'osVersion':{'type':Sequelize[_0x6127('0x6')]},'deviceModel':{'type':Sequelize[_0x6127('0x6')]},'deviceVendor':{'type':Sequelize[_0x6127('0x6')]},'deviceType':{'type':Sequelize['STRING']},'referer':{'type':Sequelize[_0x6127('0x4')]},'customerIp':{'type':Sequelize['STRING']},'formData':{'type':Sequelize[_0x6127('0x4')](_0x6127('0x7'))},'read1stAt':{'type':Sequelize[_0x6127('0x5')]},'lastMsgAt':{'type':Sequelize[_0x6127('0x5')]},'lastMsgDirection':{'type':Sequelize[_0x6127('0x8')]('in',_0x6127('0x9')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x6127('0x6')]},'customerPort':{'type':Sequelize[_0x6127('0x6')]},'vidaooSessionId':{'type':Sequelize[_0x6127('0x4')]},'autoreplyExecuted':{'type':Sequelize[_0x6127('0xa')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x6127('0x2')]}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index 226ea18..bffbf25 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 _0x03fa=['../../mysqldb','defaults','localhost','socket.io-emitter','redis','./chatInteraction.socket','register','jayson/promise','client','http','request','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','end','status','json','undefined','count','offset','limit','set','Content-Range','update','destroy','stack','name','send','render','body','agent','interaction','account','index','map','ChatInteraction','fieldName','type','key','findAll','chat','query','user','show','params','model','keys','rawAttributes','filters','intersection','attributes','fields','length','includeAll','merge','options','find','create','describe','createVidaooSession','findOne','ChatWebsiteId','vidaooEscalation','vidaooTopic','vidaooNote','vidaooMetadata','email','contact','POST','https://api-vidaoo.xcally.com/api/v1/meetings','vidaooApiKey','isNull','parse','metadata','Sequelize','ValidationError','join_url','out','ChatMessage','updateAttributes','customUpdate','CmContact','Contact','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','UserId','Interaction\x20already\x20assigned','closed','disposition','attachmentUpload','file','basename','filename','mimetype','Attachment','attachmentDownload','Unauthorized','join','root','server/files/attachments/','download','close','mailTranscript','server/files/chat/upload/','now','pathTranscript','User','ChatWebsite','ContactId','Messages','format','%s%d','agentAlias','System','agentIdentifier','website_alias','agent_alias','alias','fullname','agent_fullname','[%s]\x20%s:\x20%s\x0a','createdAt','MM/DD/YYYY\x20HH:mm:ss','direction','MailAccount','MailServerOut','Smtp','CloudProvider','getSmtpOptions','SendMail','sendMail','\x22%s\x22\x20<%s>','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ids','omit','getMessages','hasOwnProperty','nolimit','order','sort','where','pick','ChatInteractionId','filter','$gte','split','YYYY-MM-DD\x20HH:mm:ss','include','rows','getMyMessages','includeAgent','addTags','setTags','spread','Tag','emit','chatInteractionTags:save','removeTags','unix','files','tmp','attachments','transcript-%d-%s.zip','push','firstName','lastName','read','Owner','get','mkdirSync','Chat','Account','toString','closedAt','browserName','referer','customerIp','customerPort','N.A.','tail','existsSync','createReadStream','pipe','value','renderFile','transcript-','.pdf','err','unlinkSync','rimraf','zip-dir','moment','bluebird','mustache','util','ejs','ioredis','../../components/interaction/service','../../config/logger','api'];(function(_0x302c75,_0x3701e7){var _0x473a4d=function(_0x117dbb){while(--_0x117dbb){_0x302c75['push'](_0x302c75['shift']());}};_0x473a4d(++_0x3701e7);}(_0x03fa,0x199));var _0xa03f=function(_0x346097,_0xf7c47b){_0x346097=_0x346097-0x0;var _0x52065e=_0x03fa[_0x346097];return _0x52065e;};'use strict';var rimraf=require(_0xa03f('0x0'));var zipdir=require(_0xa03f('0x1'));var rp=require('request-promise');var moment=require(_0xa03f('0x2'));var BPromise=require(_0xa03f('0x3'));var Mustache=require(_0xa03f('0x4'));var util=require(_0xa03f('0x5'));var path=require('path');var ejs=require(_0xa03f('0x6'));var fs=require('fs');var _=require('lodash');var Redis=require(_0xa03f('0x7'));var interaction=require(_0xa03f('0x8'));var qs=require('../../components/parsers/qs');var pdf=require('../../components/export/pdf');var logger=require(_0xa03f('0x9'))(_0xa03f('0xa'));var config=require('../../config/environment');var db=require(_0xa03f('0xb'))['db'];config['redis']=_[_0xa03f('0xc')](config['redis'],{'host':_0xa03f('0xd'),'port':0x18eb});var socket=require(_0xa03f('0xe'))(new Redis(config[_0xa03f('0xf')]));require(_0xa03f('0x10'))[_0xa03f('0x11')](socket);var jayson=require(_0xa03f('0x12'));var client=jayson[_0xa03f('0x13')][_0xa03f('0x14')]({'port':0x232b});var client9004=jayson[_0xa03f('0x13')][_0xa03f('0x14')]({'port':0x232c});function respondWithRpcPromise(_0x1c7d2e,_0x31878b,_0x4fb1c2,_0x4ef29a){return new BPromise(function(_0x5ca89e,_0x4cf73f){var _0x365403=_0x4ef29a||client;return _0x365403[_0xa03f('0x15')](_0x1c7d2e,_0x4fb1c2)[_0xa03f('0x16')](function(_0x53785a){logger[_0xa03f('0x17')](_0xa03f('0x18'),_0x31878b,_0xa03f('0x19'));logger['debug'](_0xa03f('0x1a'),_0x31878b,_0xa03f('0x19'),JSON[_0xa03f('0x1b')](_0x53785a));if(_0x53785a[_0xa03f('0x1c')]){if(_0x53785a['error']['code']===0x1f4){logger[_0xa03f('0x1c')](_0xa03f('0x18'),_0x31878b,_0x53785a[_0xa03f('0x1c')][_0xa03f('0x1d')]);return _0x4cf73f(_0x53785a['error'][_0xa03f('0x1d')]);}logger[_0xa03f('0x1c')]('ChatInteraction,\x20%s,\x20%s',_0x31878b,_0x53785a[_0xa03f('0x1c')][_0xa03f('0x1d')]);return _0x5ca89e(_0x53785a['error'][_0xa03f('0x1d')]);}else{logger[_0xa03f('0x17')]('ChatInteraction,\x20%s,\x20%s',_0x31878b,_0xa03f('0x19'));_0x5ca89e(_0x53785a[_0xa03f('0x1e')][_0xa03f('0x1d')]);}})[_0xa03f('0x1f')](function(_0x43ac65){logger[_0xa03f('0x1c')]('ChatInteraction,\x20%s,\x20%s',_0x31878b,_0x43ac65);_0x4cf73f(_0x43ac65);});});}function respondWithStatusCode(_0xbbd263,_0x2b03f6){_0x2b03f6=_0x2b03f6||0xcc;return function(_0x22472c){if(_0x22472c){return _0xbbd263[_0xa03f('0x20')](_0x2b03f6);}return _0xbbd263['status'](_0x2b03f6)[_0xa03f('0x21')]();};}function respondWithResult(_0x5b0313,_0x3ee6eb){_0x3ee6eb=_0x3ee6eb||0xc8;return function(_0x4c9287){if(_0x4c9287){return _0x5b0313[_0xa03f('0x22')](_0x3ee6eb)[_0xa03f('0x23')](_0x4c9287);}};}function respondWithFilteredResult(_0x4e4d44,_0x6ed85e){return function(_0x36c817){if(_0x36c817){var _0xc158cf=typeof _0x6ed85e['offset']===_0xa03f('0x24')&&typeof _0x6ed85e['limit']===_0xa03f('0x24');var _0x589c5a=_0x36c817[_0xa03f('0x25')];var _0x84769c=_0xc158cf?0x0:_0x6ed85e[_0xa03f('0x26')];var _0x25a272=_0xc158cf?_0x36c817[_0xa03f('0x25')]:_0x6ed85e[_0xa03f('0x26')]+_0x6ed85e[_0xa03f('0x27')];var _0xa114b1;if(_0x25a272>=_0x589c5a){_0x25a272=_0x589c5a;_0xa114b1=0xc8;}else{_0xa114b1=0xce;}_0x4e4d44[_0xa03f('0x22')](_0xa114b1);return _0x4e4d44[_0xa03f('0x28')](_0xa03f('0x29'),_0x84769c+'-'+_0x25a272+'/'+_0x589c5a)[_0xa03f('0x23')](_0x36c817);}return null;};}function saveUpdates(_0x2ac4ec){return function(_0xe502ac){if(_0xe502ac){return _0xe502ac[_0xa03f('0x2a')](_0x2ac4ec)[_0xa03f('0x16')](function(_0x5f3207){return _0x5f3207;});}return null;};}function removeEntity(_0x11298d){return function(_0x6a57cd){if(_0x6a57cd){return _0x6a57cd[_0xa03f('0x2b')]()[_0xa03f('0x16')](function(){_0x11298d[_0xa03f('0x22')](0xcc)[_0xa03f('0x21')]();});}};}function handleEntityNotFound(_0x4f7fce){return function(_0x36eff6){if(!_0x36eff6){_0x4f7fce[_0xa03f('0x20')](0x194);}return _0x36eff6;};}function handleError(_0x22d5b3,_0x1c1b5e){_0x1c1b5e=_0x1c1b5e||0x1f4;return function(_0x10336d){logger[_0xa03f('0x1c')](_0x10336d[_0xa03f('0x2c')]);if(_0x10336d[_0xa03f('0x2d')]){delete _0x10336d[_0xa03f('0x2d')];}_0x22d5b3['status'](_0x1c1b5e)[_0xa03f('0x2e')](_0x10336d);};}function getMustacheRender(_0x1da92c,_0x53214a){return Mustache[_0xa03f('0x2f')](_0x1da92c,_['merge'](_0x53214a[_0xa03f('0x30')],{'contact':_0x53214a['contact'],'message':_0x53214a[_0xa03f('0x1d')],'agent':_0x53214a[_0xa03f('0x31')],'interaction':_0x53214a[_0xa03f('0x32')],'account':_0x53214a[_0xa03f('0x33')]}))||'';}exports[_0xa03f('0x34')]=function(_0xdb9cff,_0x22b56f){var _0x2083a3={};var _0x30a050=_[_0xa03f('0x35')](db[_0xa03f('0x36')]['rawAttributes'],function(_0x25114b){return{'name':_0x25114b[_0xa03f('0x37')],'type':_0x25114b[_0xa03f('0x38')][_0xa03f('0x39')]};});_0x2083a3=qs['getOptions'](_0x30a050,_0xdb9cff);return interaction[_0xa03f('0x3a')](_0xa03f('0x3b'),_0xdb9cff[_0xa03f('0x3c')],_0xdb9cff[_0xa03f('0x3d')],_0x2083a3,_0x30a050)[_0xa03f('0x16')](respondWithFilteredResult(_0x22b56f,_0x2083a3))['catch'](handleError(_0x22b56f,null));};exports[_0xa03f('0x3e')]=function(_0x552ba0,_0x297fca){var _0x12740a={'raw':![],'where':{'id':_0x552ba0[_0xa03f('0x3f')]['id']}},_0x10f354={};_0x10f354[_0xa03f('0x40')]=_[_0xa03f('0x41')](db[_0xa03f('0x36')][_0xa03f('0x42')]);_0x10f354[_0xa03f('0x3c')]=_['keys'](_0x552ba0['query']);_0x10f354[_0xa03f('0x43')]=_[_0xa03f('0x44')](_0x10f354[_0xa03f('0x40')],_0x10f354[_0xa03f('0x3c')]);_0x12740a[_0xa03f('0x45')]=_[_0xa03f('0x44')](_0x10f354[_0xa03f('0x40')],qs[_0xa03f('0x46')](_0x552ba0['query'][_0xa03f('0x46')]));_0x12740a[_0xa03f('0x45')]=_0x12740a['attributes'][_0xa03f('0x47')]?_0x12740a['attributes']:_0x10f354['model'];if(_0x552ba0[_0xa03f('0x3c')][_0xa03f('0x48')]){_0x12740a['include']=[{'all':!![]}];}_0x12740a=_[_0xa03f('0x49')]({},_0x12740a,_0x552ba0[_0xa03f('0x4a')]);return db[_0xa03f('0x36')][_0xa03f('0x4b')](_0x12740a)[_0xa03f('0x16')](handleEntityNotFound(_0x297fca,null))[_0xa03f('0x16')](respondWithResult(_0x297fca,null))[_0xa03f('0x1f')](handleError(_0x297fca,null));};exports[_0xa03f('0x4c')]=function(_0x51cf58,_0x1e1961){return db['ChatInteraction'][_0xa03f('0x4c')](_0x51cf58[_0xa03f('0x30')],{})[_0xa03f('0x16')](respondWithResult(_0x1e1961,0xc9))[_0xa03f('0x1f')](handleError(_0x1e1961,null));};exports['update']=function(_0x583449,_0x1211cc){if(_0x583449['body']['id']){delete _0x583449[_0xa03f('0x30')]['id'];}return db[_0xa03f('0x36')][_0xa03f('0x4b')]({'where':{'id':_0x583449[_0xa03f('0x3f')]['id']}})['then'](handleEntityNotFound(_0x1211cc,null))[_0xa03f('0x16')](saveUpdates(_0x583449[_0xa03f('0x30')],null))[_0xa03f('0x16')](respondWithResult(_0x1211cc,null))[_0xa03f('0x1f')](handleError(_0x1211cc,null));};exports['destroy']=function(_0x31145f,_0x8e4b13){return db[_0xa03f('0x36')]['find']({'where':{'id':_0x31145f[_0xa03f('0x3f')]['id']}})[_0xa03f('0x16')](handleEntityNotFound(_0x8e4b13,null))['then'](removeEntity(_0x8e4b13,null))[_0xa03f('0x1f')](handleError(_0x8e4b13,null));};exports[_0xa03f('0x4d')]=function(_0xfb610,_0x4272c2){return db[_0xa03f('0x36')][_0xa03f('0x4d')]()['then'](respondWithResult(_0x4272c2,null))['catch'](handleError(_0x4272c2,null));};exports[_0xa03f('0x4e')]=function(_0x3bec9e,_0x4ec390){var _0x173df4=_0x3bec9e[_0xa03f('0x3f')]['id'];var _0x3f8a2a;var _0x1b35b6;var _0xcd3ff1;return db['ChatInteraction'][_0xa03f('0x4f')]({'where':{'id':_0x173df4}})[_0xa03f('0x16')](function(_0x3bd8f6){_0x3f8a2a=_0x3bd8f6;return db['ChatWebsite'][_0xa03f('0x4f')]({'where':{'id':_0x3bd8f6[_0xa03f('0x50')]},'attributes':['id','vidaooApiKey',_0xa03f('0x51'),_0xa03f('0x52'),_0xa03f('0x53'),_0xa03f('0x54')],'raw':!![]});})[_0xa03f('0x16')](function(_0x37c6f4){if(_0x37c6f4&&_0x37c6f4['vidaooApiKey']&&_0x37c6f4[_0xa03f('0x51')]){_0x1b35b6=_0x37c6f4;var _0x5dd430={'interaction':{'id':_0x173df4},'agent':{'id':_0x3bec9e[_0xa03f('0x3d')]['id'],'name':_0x3bec9e[_0xa03f('0x3d')][_0xa03f('0x2d')],'fullname':_0x3bec9e[_0xa03f('0x3d')]['fullname'],'email':_0x3bec9e[_0xa03f('0x3d')][_0xa03f('0x55')]},'contact':_0x3bec9e[_0xa03f('0x30')][_0xa03f('0x56')],'account':_0x3bec9e[_0xa03f('0x30')]['account']};var _0x547d1f={'rejectUnauthorized':![],'method':_0xa03f('0x57'),'url':_0xa03f('0x58'),'headers':{'X-APIKEY':_0x37c6f4[_0xa03f('0x59')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x3bec9e['user'][_0xa03f('0x55')]],'buttons':null,'topic':_0x1b35b6['vidaooTopic'],'note':_[_0xa03f('0x5a')](_0x1b35b6[_0xa03f('0x53')])?null:getMustacheRender(_0x1b35b6['vidaooNote'],_0x5dd430),'metadata':null},'redirect':'follow','json':!![]};try{if(!_[_0xa03f('0x5a')](_0x1b35b6[_0xa03f('0x54')])){var _0x230a94=getMustacheRender(_0x1b35b6['vidaooMetadata'],_0x5dd430);var _0x30e95c=JSON[_0xa03f('0x5b')](_0x230a94);_0x547d1f[_0xa03f('0x30')][_0xa03f('0x5c')]=_0x30e95c;}}catch(_0x426ef7){throw new db[(_0xa03f('0x5d'))][(_0xa03f('0x5e'))]('Error\x20in\x20conversion\x20vidaooMetadata');}return rp(_0x547d1f);}else{throw new db[(_0xa03f('0x5d'))]['ValidationError']('Error\x20in\x20Vidaoo\x20configuration');}})['then'](function(_0x17967b){_0xcd3ff1=_0x17967b;if(_0xcd3ff1['id']){var _0x35986e={'body':_0xcd3ff1[_0xa03f('0x5f')],'ChatWebsiteId':_0x1b35b6['id'],'ChatInteractionId':_0x3f8a2a['id'],'direction':_0xa03f('0x60'),'UserId':_0x3bec9e['user']['id']};return db[_0xa03f('0x61')][_0xa03f('0x4c')](_0x35986e,{});}else{throw new db[(_0xa03f('0x5d'))][(_0xa03f('0x5e'))]('Unable\x20to\x20create\x20Vidaoo\x20session');}})['then'](function(){return _0x3f8a2a[_0xa03f('0x62')]({'vidaooSessionId':_0xcd3ff1['id']});})[_0xa03f('0x16')](respondWithResult(_0x4ec390,null))['catch'](handleError(_0x4ec390,null));};exports[_0xa03f('0x63')]=function(_0x16ce62,_0x25a831){if(_0x16ce62[_0xa03f('0x30')]['id']){delete _0x16ce62['body']['id'];}return db[_0xa03f('0x36')]['find']({'where':{'id':_0x16ce62['params']['id']},'include':[{'model':db[_0xa03f('0x64')],'as':_0xa03f('0x65')}]})[_0xa03f('0x16')](handleEntityNotFound(_0x25a831,null))[_0xa03f('0x16')](saveUpdates(_0x16ce62['body'],null))[_0xa03f('0x16')](respondWithResult(_0x25a831,null))[_0xa03f('0x1f')](handleError(_0x25a831,null));};exports[_0xa03f('0x66')]=function(_0x2e234c,_0x588b0a){if(_0x2e234c[_0xa03f('0x30')]['id']){delete _0x2e234c[_0xa03f('0x30')]['id'];}return db[_0xa03f('0x36')]['find']({'where':{'id':_0x2e234c[_0xa03f('0x3f')]['id']}})[_0xa03f('0x16')](function(_0x2b3cc5){if(!_0x2b3cc5){logger[_0xa03f('0x1c')](_0xa03f('0x67'),'abandon',0x194,'entity\x20not\x20found');_0x588b0a[_0xa03f('0x20')](0x194);}else{if(_0x2b3cc5[_0xa03f('0x68')]){throw new db[(_0xa03f('0x5d'))][(_0xa03f('0x5e'))](_0xa03f('0x69'));}}return _0x2b3cc5;})[_0xa03f('0x16')](function(_0x189044){if(_0x189044){return _0x189044[_0xa03f('0x2a')]({'closed':_0x2e234c[_0xa03f('0x30')][_0xa03f('0x6a')],'disposition':_0x2e234c['body'][_0xa03f('0x6b')]})[_0xa03f('0x16')](function(_0x2159b8){return _0x2159b8;});}})[_0xa03f('0x16')](function(){return respondWithRpcPromise('AbandonInteraction',_0xa03f('0x66'),_0x2e234c[_0xa03f('0x30')],client9004);})[_0xa03f('0x16')](respondWithResult(_0x588b0a,null))['catch'](handleError(_0x588b0a,null));};exports[_0xa03f('0x6c')]=function(_0x49e6fc,_0x35d137){_0x49e6fc[_0xa03f('0x30')][_0xa03f('0x2d')]=_0x49e6fc[_0xa03f('0x6d')]['originalname'];_0x49e6fc['body'][_0xa03f('0x6e')]=_0x49e6fc[_0xa03f('0x6d')][_0xa03f('0x6f')];_0x49e6fc[_0xa03f('0x30')]['type']=_0x49e6fc['file'][_0xa03f('0x70')];return db[_0xa03f('0x71')][_0xa03f('0x4c')](_0x49e6fc[_0xa03f('0x30')])[_0xa03f('0x16')](respondWithResult(_0x35d137,0xc9))[_0xa03f('0x1f')](handleError(_0x35d137,null));};exports[_0xa03f('0x72')]=function(_0x2007aa,_0x47e512){return db[_0xa03f('0x36')][_0xa03f('0x4f')]({'where':{'id':_0x2007aa[_0xa03f('0x3f')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x47e512,null))['then'](function(_0x4708a4){if(_0x4708a4){if(_0x4708a4['closed']){return _0x47e512['status'](0x193)[_0xa03f('0x23')]({'status':0x193,'message':_0xa03f('0x73')});}return db['Attachment'][_0xa03f('0x4f')]({'where':{'id':_0x2007aa[_0xa03f('0x3c')]['attachId']},'raw':!![]})[_0xa03f('0x16')](handleEntityNotFound(_0x47e512,null));}})[_0xa03f('0x16')](function(_0x556f7a){if(_0x556f7a){var _0x1a5bf6=_0x556f7a['ChatOfflineMessageId']!==null;var _0x1b83f0=path[_0xa03f('0x74')](config[_0xa03f('0x75')],_0xa03f('0x76'));if(_0x1a5bf6){_0x1b83f0=path[_0xa03f('0x74')](_0x1b83f0,'offline-chat/');}var _0x4b783d=path[_0xa03f('0x74')](_0x1b83f0,_0x556f7a['basename']);return _0x47e512[_0xa03f('0x77')](_0x4b783d);}})[_0xa03f('0x1f')](handleError(_0x47e512,null));};exports[_0xa03f('0x78')]=function(_0x4dfb95,_0x4bed41){var _0x3afed5=null;var _0x5b22d9=null;var _0x449764=null;if(_0x4dfb95[_0xa03f('0x30')]['id']){delete _0x4dfb95[_0xa03f('0x30')]['id'];}if(_0x4dfb95[_0xa03f('0x30')][_0xa03f('0x79')]){_0x449764=path[_0xa03f('0x74')](config['root'],_0xa03f('0x7a'),util['format']('transcript-%s.txt',Date[_0xa03f('0x7b')]()));_0x4dfb95[_0xa03f('0x30')][_0xa03f('0x7c')]=_0x449764;}return db[_0xa03f('0x36')]['find']({'where':{'id':_0x4dfb95[_0xa03f('0x3f')]['id']},'include':[{'model':db[_0xa03f('0x61')],'as':'Messages','include':[{'model':db[_0xa03f('0x7d')],'as':_0xa03f('0x7d')}]}]})[_0xa03f('0x16')](handleEntityNotFound(_0x4bed41,null))[_0xa03f('0x16')](saveUpdates(_0x4dfb95['body'],null))[_0xa03f('0x16')](function(_0x2c1d4f){if(_0x2c1d4f){_0x3afed5=_0x2c1d4f;return db[_0xa03f('0x7e')][_0xa03f('0x4b')]({'where':{'id':_0x3afed5[_0xa03f('0x50')]}});}})[_0xa03f('0x16')](function(_0x217aae){if(_0x217aae){_0x5b22d9=_0x217aae;return db['CmContact'][_0xa03f('0x4b')]({'where':{'id':_0x3afed5[_0xa03f('0x7f')]}});}})[_0xa03f('0x16')](function(_0x166d99){if(_0x166d99){if(_0x449764){var _0x31cad5=null;for(var _0x5ee519=0x1;_0x5ee519<_0x3afed5[_0xa03f('0x80')]['length'];++_0x5ee519){_0x31cad5=_0x3afed5[_0xa03f('0x80')][_0x5ee519];var _0x4e3fa2=_0x31cad5[_0xa03f('0x68')]?util[_0xa03f('0x81')](_0xa03f('0x82'),_0x5b22d9[_0xa03f('0x83')],_0x31cad5[_0xa03f('0x68')]):_0xa03f('0x84');var _0x4ff0e9=_0x4dfb95['body']['customer']||util[_0xa03f('0x81')](_0xa03f('0x82'),'Visitor',_0x31cad5[_0xa03f('0x7f')]);switch(_0x5b22d9[_0xa03f('0x85')]){case _0xa03f('0x86'):_0x4e3fa2=_0x31cad5[_0xa03f('0x68')]?util['format'](_0xa03f('0x82'),_0x5b22d9[_0xa03f('0x83')],_0x31cad5['UserId']):'System';break;case _0xa03f('0x87'):_0x4e3fa2=_0x31cad5['UserId']?_0x31cad5[_0xa03f('0x7d')][_0xa03f('0x88')]||_0x31cad5[_0xa03f('0x7d')][_0xa03f('0x89')]:_0xa03f('0x84');break;case _0xa03f('0x8a'):_0x4e3fa2=_0x31cad5['UserId']?_0x31cad5['User'][_0xa03f('0x89')]:_0xa03f('0x84');break;default:_0x4e3fa2=_0x31cad5['UserId']?util[_0xa03f('0x81')]('%s%d',_0x5b22d9[_0xa03f('0x83')],_0x31cad5[_0xa03f('0x68')]):_0xa03f('0x84');}var _0x5b36f5=util[_0xa03f('0x81')](_0xa03f('0x8b'),moment(_0x31cad5[_0xa03f('0x8c')])[_0xa03f('0x81')](_0xa03f('0x8d')),_0x31cad5[_0xa03f('0x8e')]==='in'?_0x4ff0e9:_0x4e3fa2,_0x31cad5['body']);if(!_0x31cad5['secret']){fs['appendFileSync'](_0x449764,_0x5b36f5);}}return db[_0xa03f('0x8f')]['findOne']({'where':{'service':!![]},'include':[{'model':db[_0xa03f('0x90')],'as':_0xa03f('0x91'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':_0xa03f('0x92'),'raw':!![]}]}]});}}})[_0xa03f('0x16')](function(_0x40af97){if(!_0x40af97||!_0x40af97[_0xa03f('0x91')]||!_0x4dfb95['body'])return _0x3afed5;var _0x331816=_0x40af97[_0xa03f('0x93')]();return respondWithRpcPromise(_0xa03f('0x94'),_0xa03f('0x95'),{'account':_0x331816,'message':{'from':util[_0xa03f('0x81')](_0xa03f('0x96'),_0x40af97['name'],_0x40af97[_0xa03f('0x55')]||_0x40af97[_0xa03f('0x91')][_0xa03f('0x3d')]),'to':_0x4dfb95[_0xa03f('0x30')][_0xa03f('0x79')],'subject':_0xa03f('0x97'),'text':util[_0xa03f('0x81')](_0xa03f('0x98'),_0x4dfb95[_0xa03f('0x30')][_0xa03f('0x79')]),'attachments':[{'path':_0x449764}]}})[_0xa03f('0x16')](function(){return _0x3afed5;})['catch'](function(_0x2d0c46){logger[_0xa03f('0x1c')](_0x2d0c46);});})[_0xa03f('0x16')](respondWithStatusCode(_0x4bed41,0xc8))[_0xa03f('0x1f')](handleError(_0x4bed41,null));};exports[_0xa03f('0x99')]=function(_0x378bbc,_0x437572){return db['ChatMessage'][_0xa03f('0x4b')]({'where':{'id':_0x378bbc[_0xa03f('0x3f')]['id']}})[_0xa03f('0x16')](handleEntityNotFound(_0x437572,null))['then'](function(_0x160ac7){if(_0x160ac7){return _0x160ac7['addMessage'](_0x378bbc['body'][_0xa03f('0x9a')],_[_0xa03f('0x9b')](_0x378bbc['body'],[_0xa03f('0x9a'),'id'])||{});}})[_0xa03f('0x16')](respondWithResult(_0x437572,null))['catch'](handleError(_0x437572,null));};exports[_0xa03f('0x9c')]=function(_0x10bd39,_0x4b1fdb){var _0x47124a={'raw':![],'where':{}};var _0x23f603={};var _0x4c8ca1={'count':0x0,'rows':[]};return db[_0xa03f('0x36')]['findOne']({'where':{'id':_0x10bd39[_0xa03f('0x3f')]['id']}})[_0xa03f('0x16')](handleEntityNotFound(_0x4b1fdb,null))['then'](function(_0x436e3e){if(_0x436e3e){_0x23f603[_0xa03f('0x40')]=_[_0xa03f('0x41')](db[_0xa03f('0x61')][_0xa03f('0x42')]);_0x23f603[_0xa03f('0x3c')]=_['keys'](_0x10bd39[_0xa03f('0x3c')]);_0x23f603[_0xa03f('0x43')]=_[_0xa03f('0x44')](_0x23f603['model'],_0x23f603[_0xa03f('0x3c')]);_0x47124a[_0xa03f('0x45')]=_[_0xa03f('0x44')](_0x23f603[_0xa03f('0x40')],qs['fields'](_0x10bd39[_0xa03f('0x3c')][_0xa03f('0x46')]));_0x47124a[_0xa03f('0x45')]=_0x47124a[_0xa03f('0x45')][_0xa03f('0x47')]?_0x47124a[_0xa03f('0x45')]:_0x23f603['model'];if(!_0x10bd39['query'][_0xa03f('0x9d')](_0xa03f('0x9e'))){_0x47124a['limit']=qs[_0xa03f('0x27')](_0x10bd39[_0xa03f('0x3c')]['limit']);_0x47124a[_0xa03f('0x26')]=qs['offset'](_0x10bd39[_0xa03f('0x3c')][_0xa03f('0x26')]);}_0x47124a[_0xa03f('0x9f')]=qs[_0xa03f('0xa0')](_0x10bd39[_0xa03f('0x3c')][_0xa03f('0xa0')]);_0x47124a[_0xa03f('0xa1')]=qs[_0xa03f('0x43')](_[_0xa03f('0xa2')](_0x10bd39[_0xa03f('0x3c')],_0x23f603[_0xa03f('0x43')]));_0x47124a[_0xa03f('0xa1')][_0xa03f('0xa3')]=_0x436e3e['id'];if(_0x10bd39[_0xa03f('0x3c')][_0xa03f('0xa4')]){_0x47124a['where']=_[_0xa03f('0x49')](_0x47124a['where'],{'$or':_[_0xa03f('0x35')](_0x47124a[_0xa03f('0x45')],function(_0x221517){var _0x1ec65b={};_0x1ec65b[_0x221517]={'$like':'%'+_0x10bd39['query']['filter']+'%'};return _0x1ec65b;})});}if(_0x10bd39['query'][_0xa03f('0xa5')]){var _0x1cb361=_0x10bd39[_0xa03f('0x3c')][_0xa03f('0xa5')][_0xa03f('0xa6')](',');var _0xb20b91={};_0xb20b91[_0x1cb361[0x0]]={'$gte':moment(_0x1cb361[0x1])[_0xa03f('0x81')](_0xa03f('0xa7'))};_0x47124a[_0xa03f('0xa1')]=_[_0xa03f('0x49')](_0x47124a[_0xa03f('0xa1')],_0xb20b91);}_0x47124a=_[_0xa03f('0x49')]({},_0x47124a,_0x10bd39[_0xa03f('0x4a')]);return db[_0xa03f('0x61')][_0xa03f('0x25')]({'where':_0x47124a['where']})[_0xa03f('0x16')](function(_0x19913e){_0x4c8ca1['count']=_0x19913e;if(_0x10bd39['query'][_0xa03f('0x48')]){_0x47124a[_0xa03f('0xa8')]=[{'all':!![]}];}return db[_0xa03f('0x61')][_0xa03f('0x3a')](_0x47124a);})['then'](function(_0x22dc6d){_0x4c8ca1[_0xa03f('0xa9')]=_0x22dc6d;return _0x4c8ca1;});}})['then'](respondWithFilteredResult(_0x4b1fdb,_0x47124a))[_0xa03f('0x1f')](handleError(_0x4b1fdb,null));};exports[_0xa03f('0xaa')]=function(_0x37d3cb,_0x4f392a){var _0x3da1fb={'where':{}},_0x102103={},_0x53efb8={'count':0x0,'rows':[]};return db[_0xa03f('0x36')]['findOne']({'where':{'id':_0x37d3cb['params']['id']}})[_0xa03f('0x16')](handleEntityNotFound(_0x4f392a,null))['then'](function(_0x53fbac){if(_0x53fbac){_0x102103[_0xa03f('0x40')]=_[_0xa03f('0x41')](db[_0xa03f('0x61')][_0xa03f('0x42')]);_0x102103[_0xa03f('0x3c')]=_['keys'](_0x37d3cb[_0xa03f('0x3c')]);_0x102103['filters']=_[_0xa03f('0x44')](_0x102103['model'],_0x102103[_0xa03f('0x3c')]);_0x3da1fb[_0xa03f('0x45')]=_[_0xa03f('0x44')](_0x102103[_0xa03f('0x40')],qs[_0xa03f('0x46')](_0x37d3cb[_0xa03f('0x3c')][_0xa03f('0x46')]));_0x3da1fb[_0xa03f('0x45')]=_0x3da1fb[_0xa03f('0x45')]['length']?_0x3da1fb[_0xa03f('0x45')]:_0x102103[_0xa03f('0x40')];if(!_0x37d3cb[_0xa03f('0x3c')][_0xa03f('0x9d')](_0xa03f('0x9e'))){_0x3da1fb['limit']=qs[_0xa03f('0x27')](_0x37d3cb[_0xa03f('0x3c')][_0xa03f('0x27')]);_0x3da1fb[_0xa03f('0x26')]=qs[_0xa03f('0x26')](_0x37d3cb[_0xa03f('0x3c')][_0xa03f('0x26')]);}_0x3da1fb[_0xa03f('0x9f')]=qs[_0xa03f('0xa0')](_0x37d3cb[_0xa03f('0x3c')]['sort']);_0x3da1fb[_0xa03f('0xa1')]=qs[_0xa03f('0x43')](_[_0xa03f('0xa2')](_0x37d3cb[_0xa03f('0x3c')],_0x102103[_0xa03f('0x43')]));_0x3da1fb['where'][_0xa03f('0xa3')]=_0x53fbac['id'];if(_0x37d3cb[_0xa03f('0x3c')][_0xa03f('0xa4')]){_0x3da1fb[_0xa03f('0xa1')]=_[_0xa03f('0x49')](_0x3da1fb[_0xa03f('0xa1')],{'$or':_['map'](_0x3da1fb[_0xa03f('0x45')],function(_0xeaa31e){var _0x36f6af={};_0x36f6af[_0xeaa31e]={'$like':'%'+_0x37d3cb[_0xa03f('0x3c')][_0xa03f('0xa4')]+'%'};return _0x36f6af;})});}_0x3da1fb[_0xa03f('0xa1')]['secret']=![];if(_0x37d3cb[_0xa03f('0x3c')]['id']){_0x3da1fb[_0xa03f('0xa1')]['id']={'$gt':_0x37d3cb['query']['id']};}_0x3da1fb=_[_0xa03f('0x49')]({},_0x3da1fb,_0x37d3cb[_0xa03f('0x4a')]);return db[_0xa03f('0x61')][_0xa03f('0x25')]({'where':_0x3da1fb[_0xa03f('0xa1')]})['then'](function(_0x80e591){_0x53efb8['count']=_0x80e591;_0x3da1fb[_0xa03f('0xa8')]=[];if(_0x37d3cb[_0xa03f('0x3c')][_0xa03f('0xab')]){_0x3da1fb[_0xa03f('0xa8')]['push']({'model':db[_0xa03f('0x7d')],'as':_0xa03f('0x7d'),'attributes':['id',_0xa03f('0x89'),'alias']});}if(_0x37d3cb[_0xa03f('0x3c')][_0xa03f('0x48')]){_0x3da1fb[_0xa03f('0xa8')]=[{'all':!![]}];}return db[_0xa03f('0x61')][_0xa03f('0x3a')](_0x3da1fb);})[_0xa03f('0x16')](function(_0x180fdc){_0x53efb8[_0xa03f('0xa9')]=_0x180fdc;return _0x53efb8;});}})[_0xa03f('0x16')](respondWithFilteredResult(_0x4f392a,_0x3da1fb))['catch'](handleError(_0x4f392a,null));};exports[_0xa03f('0xac')]=function(_0x5db843,_0x412a3e){return db['ChatInteraction'][_0xa03f('0x4b')]({'where':{'id':_0x5db843[_0xa03f('0x3f')]['id']}})['then'](handleEntityNotFound(_0x412a3e,null))[_0xa03f('0x16')](function(_0x5a3520){if(_0x5a3520){return _0x5a3520[_0xa03f('0xad')](_0x5db843[_0xa03f('0x30')][_0xa03f('0x9a')],_[_0xa03f('0x9b')](_0x5db843[_0xa03f('0x30')],[_0xa03f('0x9a'),'id'])||{})[_0xa03f('0xae')](function(){return db[_0xa03f('0xaf')][_0xa03f('0x3a')]({'attributes':['id',_0xa03f('0x2d'),'color'],'where':{'id':_0x5db843[_0xa03f('0x30')][_0xa03f('0x9a')]}});})['then'](function(_0x1dd0b6){socket[_0xa03f('0xb0')](_0xa03f('0xb1'),{'id':Number(_0x5db843[_0xa03f('0x3f')]['id']),'tags':_0x1dd0b6||[]});return{'id':Number(_0x5db843[_0xa03f('0x3f')]['id']),'tags':_0x1dd0b6||[]};});}})[_0xa03f('0x16')](respondWithResult(_0x412a3e,null))[_0xa03f('0x1f')](handleError(_0x412a3e,null));};exports[_0xa03f('0xb2')]=function(_0x38d390,_0x4108a6){return db[_0xa03f('0x36')][_0xa03f('0x4b')]({'where':{'id':_0x38d390[_0xa03f('0x3f')]['id']}})[_0xa03f('0x16')](handleEntityNotFound(_0x4108a6,null))[_0xa03f('0x16')](function(_0xf4a0de){if(_0xf4a0de){return _0xf4a0de['removeTags'](_0x38d390[_0xa03f('0x3c')][_0xa03f('0x9a')]);}})[_0xa03f('0x16')](respondWithStatusCode(_0x4108a6,null))[_0xa03f('0x1f')](handleError(_0x4108a6,null));};exports[_0xa03f('0x77')]=function(_0x596435,_0x583fdf){var _0x36d6eb=moment()[_0xa03f('0xb3')]()['toString']();var _0x1bc66e=path[_0xa03f('0x74')](config['root'],'server',_0xa03f('0xb4'),_0xa03f('0xb5'));var _0x372fe1=path[_0xa03f('0x74')](config[_0xa03f('0x75')],'server',_0xa03f('0xb4'),_0xa03f('0xb6'));var _0x28ef80=path['join'](_0x1bc66e,_0x36d6eb);var _0x504d44=util[_0xa03f('0x81')](_0xa03f('0xb7'),_0x596435[_0xa03f('0x3f')]['id'],_0x36d6eb);var _0x2713db=path['join'](_0x1bc66e,_0x504d44);var _0x209d70=[];_0x209d70[_0xa03f('0xb8')]({'model':db[_0xa03f('0x7d')],'as':_0xa03f('0x7d'),'attributes':['id',_0xa03f('0x89')],'raw':!![]});_0x209d70[_0xa03f('0xb8')]({'model':db[_0xa03f('0x64')],'as':'Contact','attributes':['id',_0xa03f('0xb9'),_0xa03f('0xba')],'raw':!![]});if(_0x596435[_0xa03f('0x3c')]['attachments']){_0x209d70['push']({'model':db[_0xa03f('0x71')],'as':'Attachment','raw':!![]});}var _0x3febb4=[{'model':db[_0xa03f('0x61')],'as':_0xa03f('0x80'),'attributes':['id',_0xa03f('0x30'),'createdAt',_0xa03f('0x8e'),'secret',_0xa03f('0xbb')],'include':_0x209d70}];_0x3febb4['push']({'model':db[_0xa03f('0x7e')],'as':'Account','attributes':['id','name']});_0x3febb4[_0xa03f('0xb8')]({'model':db[_0xa03f('0x7d')],'as':_0xa03f('0xbc'),'attributes':['id',_0xa03f('0x89')]});return db['ChatInteraction'][_0xa03f('0x4b')]({'where':{'id':_0x596435[_0xa03f('0x3f')]['id']},'include':_0x3febb4})[_0xa03f('0x16')](handleEntityNotFound(_0x583fdf,null))['then'](function(_0x55ea99){if(_0x55ea99){var _0x1060e3=_0x55ea99[_0xa03f('0xbd')]({'plain':!![]});fs[_0xa03f('0xbe')](_0x28ef80);var _0x507e45={'channel':_0xa03f('0xbf'),'account':_0x1060e3[_0xa03f('0xc0')][_0xa03f('0x2d')],'agent':_0x1060e3[_0xa03f('0xbc')]?_0x1060e3[_0xa03f('0xbc')][_0xa03f('0x89')]:'N.A.','createdAt':moment(_0x1060e3[_0xa03f('0x8c')])[_0xa03f('0x81')]('YYYY-MM-DD\x20HH:mm:ss')[_0xa03f('0xc1')](),'closedAt':_0x1060e3['closed']?moment(_0x1060e3[_0xa03f('0xc2')])[_0xa03f('0x81')](_0xa03f('0xa7'))[_0xa03f('0xc1')]():'','disposition':_0x1060e3['disposition'],'chatInfo':{'browser':_0x1060e3[_0xa03f('0xc3')],'os':_0x1060e3['osName'],'referer':_0x1060e3[_0xa03f('0xc4')],'customerIp':_0x1060e3[_0xa03f('0xc5')],'customerPort':_0x1060e3[_0xa03f('0xc6')]?_0x1060e3[_0xa03f('0xc6')]:_0xa03f('0xc7')},'messages':_(_0x1060e3[_0xa03f('0x80')])[_0xa03f('0xc8')]()[_0xa03f('0xa4')]({'secret':![]})[_0xa03f('0x35')](function(_0x35cd5f){if(_0x35cd5f[_0xa03f('0x71')]){var _0x3a013e=path[_0xa03f('0x74')](_0x372fe1,_0x35cd5f[_0xa03f('0x71')][_0xa03f('0x6e')]);if(fs[_0xa03f('0xc9')](_0x3a013e)){fs[_0xa03f('0xca')](_0x3a013e)[_0xa03f('0xcb')](fs['createWriteStream'](path[_0xa03f('0x74')](_0x28ef80,_0x35cd5f['Attachment'][_0xa03f('0x6e')])));}}return{'date':moment(_0x35cd5f['createdAt'])[_0xa03f('0x81')](_0xa03f('0xa7'))['toString'](),'sender':_0x35cd5f[_0xa03f('0x8e')]===_0xa03f('0x60')?_0x35cd5f['User']?_0x35cd5f[_0xa03f('0x7d')][_0xa03f('0x89')]:'System':_0x35cd5f['Contact']['firstName']+(_0x35cd5f[_0xa03f('0x65')][_0xa03f('0xba')]?'\x20'+_0x35cd5f[_0xa03f('0x65')][_0xa03f('0xba')]:''),'body':_0x35cd5f[_0xa03f('0x71')]?_0x35cd5f[_0xa03f('0x71')]['basename']:_0x35cd5f[_0xa03f('0x30')],'direction':_0x35cd5f[_0xa03f('0x8e')]===_0xa03f('0x60')?'A':'C','secret':_0x35cd5f['secret'],'read':_0x35cd5f['read'],'attachment':_0x35cd5f[_0xa03f('0x71')]};})[_0xa03f('0xcc')]()};return ejs[_0xa03f('0xcd')](path[_0xa03f('0x74')](config[_0xa03f('0x75')],'server','views','downloadInteraction.ejs'),{'interaction':_0x507e45})[_0xa03f('0x16')](function(_0x2e6295){var _0x10c333=path['join'](_0x28ef80,_0xa03f('0xce')+_0x1060e3['id']+'-'+_0x36d6eb+_0xa03f('0xcf'));var _0x202de1={'path':_0x10c333,'channel':_0xa03f('0xbf'),'interactionId':_0x1060e3['id']};return pdf['createPdfFromHTML'](_0x2e6295,_0x202de1);})[_0xa03f('0x16')](function(){return new Promise(function(_0x16e6ef,_0x46b7d2){zipdir(_0x28ef80,{'saveTo':_0x2713db},function(_0x2360fe,_0x16f53b){if(_0x2360fe)return _0x46b7d2(_0x2360fe);return _0x16e6ef(_0x16f53b);});})[_0xa03f('0x16')](function(){return new BPromise(function(_0x4e7878,_0x23b937){rimraf(_0x28ef80,function(_0x5e7733){if(_0x5e7733)_0x23b937(_0x5e7733);return _0x4e7878();});});})['then'](function(){return _0x583fdf[_0xa03f('0x77')](_0x2713db,_0x504d44,function(_0x48ee5e){if(_0x48ee5e){logger['error'](_0xa03f('0xd0'),_0x48ee5e);}else{fs[_0xa03f('0xd1')](_0x2713db);}});});});}else{return _0x583fdf['sendStatus'](0xc8);}})['catch'](handleError(_0x583fdf,null));}; \ No newline at end of file +var _0x96ee=['color','chatInteractionTags:save','removeTags','unix','toString','server','files','tmp','attachments','push','firstName','lastName','direction','read','Owner','get','mkdirSync','N.A.','closed','closedAt','disposition','browserName','osName','customerIp','customerPort','tail','createReadStream','pipe','value','renderFile','views','downloadInteraction.ejs','transcript-','Chat','createPdfFromHTML','err','rimraf','request-promise','mustache','util','path','ejs','ioredis','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./chatInteraction.socket','register','client','http','request','then','info','ChatInteraction,\x20%s,\x20%s','debug','stringify','error','message','request\x20sent','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','destroy','stack','name','send','render','merge','contact','agent','account','index','map','ChatInteraction','rawAttributes','fieldName','type','key','getOptions','query','show','params','model','keys','filters','intersection','attributes','fields','length','includeAll','include','find','create','body','update','describe','createVidaooSession','ChatWebsite','ChatWebsiteId','vidaooApiKey','vidaooTopic','vidaooNote','vidaooMetadata','vidaooEscalation','user','fullname','email','POST','https://api-vidaoo.xcally.com/api/v1/meetings','isNull','follow','metadata','Sequelize','ValidationError','Error\x20in\x20conversion\x20vidaooMetadata','join_url','out','ChatMessage','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','CmContact','Contact','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','UserId','Interaction\x20already\x20assigned','attachmentUpload','file','originalname','basename','mimetype','Attachment','attachmentDownload','findOne','Unauthorized','attachId','ChatOfflineMessageId','join','root','download','close','mailTranscript','server/files/chat/upload/','format','transcript-%s.txt','now','pathTranscript','Messages','User','ContactId','%s%d','System','customer','agentIdentifier','agent_alias','alias','agent_fullname','agentAlias','[%s]\x20%s:\x20%s\x0a','createdAt','MM/DD/YYYY\x20HH:mm:ss','appendFileSync','MailAccount','MailServerOut','CloudProvider','Smtp','getSmtpOptions','SendMail','sendMail','\x22%s\x22\x20<%s>','Mail\x20Transcript','addMessage','ids','omit','hasOwnProperty','nolimit','sort','pick','where','filter','$gte','split','YYYY-MM-DD\x20HH:mm:ss','options','findAll','rows','getMyMessages','ChatInteractionId','secret','includeAgent','addTags','spread','Tag'];(function(_0x1cef73,_0xa6d6a){var _0x2fae84=function(_0x2e3955){while(--_0x2e3955){_0x1cef73['push'](_0x1cef73['shift']());}};_0x2fae84(++_0xa6d6a);}(_0x96ee,0xf5));var _0xe96e=function(_0x590381,_0x5c3948){_0x590381=_0x590381-0x0;var _0xe300df=_0x96ee[_0x590381];return _0xe300df;};'use strict';var rimraf=require(_0xe96e('0x0'));var zipdir=require('zip-dir');var rp=require(_0xe96e('0x1'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xe96e('0x2'));var util=require(_0xe96e('0x3'));var path=require(_0xe96e('0x4'));var ejs=require(_0xe96e('0x5'));var fs=require('fs');var _=require('lodash');var Redis=require(_0xe96e('0x6'));var interaction=require('../../components/interaction/service');var qs=require(_0xe96e('0x7'));var pdf=require(_0xe96e('0x8'));var logger=require(_0xe96e('0x9'))(_0xe96e('0xa'));var config=require('../../config/environment');var db=require(_0xe96e('0xb'))['db'];config['redis']=_[_0xe96e('0xc')](config[_0xe96e('0xd')],{'host':_0xe96e('0xe'),'port':0x18eb});var socket=require(_0xe96e('0xf'))(new Redis(config[_0xe96e('0xd')]));require(_0xe96e('0x10'))[_0xe96e('0x11')](socket);var jayson=require('jayson/promise');var client=jayson[_0xe96e('0x12')][_0xe96e('0x13')]({'port':0x232b});var client9004=jayson[_0xe96e('0x12')][_0xe96e('0x13')]({'port':0x232c});function respondWithRpcPromise(_0x2f3307,_0x518d0f,_0x9c9186,_0xbfe6f9){return new BPromise(function(_0x36403d,_0x4278d2){var _0x4b91c5=_0xbfe6f9||client;return _0x4b91c5[_0xe96e('0x14')](_0x2f3307,_0x9c9186)[_0xe96e('0x15')](function(_0x1ad776){logger[_0xe96e('0x16')](_0xe96e('0x17'),_0x518d0f,'request\x20sent');logger[_0xe96e('0x18')]('ChatInteraction,\x20%s,\x20%s,\x20%s',_0x518d0f,'request\x20sent',JSON[_0xe96e('0x19')](_0x1ad776));if(_0x1ad776[_0xe96e('0x1a')]){if(_0x1ad776[_0xe96e('0x1a')]['code']===0x1f4){logger[_0xe96e('0x1a')](_0xe96e('0x17'),_0x518d0f,_0x1ad776[_0xe96e('0x1a')][_0xe96e('0x1b')]);return _0x4278d2(_0x1ad776[_0xe96e('0x1a')][_0xe96e('0x1b')]);}logger['error'](_0xe96e('0x17'),_0x518d0f,_0x1ad776[_0xe96e('0x1a')][_0xe96e('0x1b')]);return _0x36403d(_0x1ad776[_0xe96e('0x1a')][_0xe96e('0x1b')]);}else{logger['info']('ChatInteraction,\x20%s,\x20%s',_0x518d0f,_0xe96e('0x1c'));_0x36403d(_0x1ad776[_0xe96e('0x1d')]['message']);}})[_0xe96e('0x1e')](function(_0x2fe9c1){logger['error']('ChatInteraction,\x20%s,\x20%s',_0x518d0f,_0x2fe9c1);_0x4278d2(_0x2fe9c1);});});}function respondWithStatusCode(_0x3b076c,_0x2fd521){_0x2fd521=_0x2fd521||0xcc;return function(_0x3479d1){if(_0x3479d1){return _0x3b076c[_0xe96e('0x1f')](_0x2fd521);}return _0x3b076c[_0xe96e('0x20')](_0x2fd521)[_0xe96e('0x21')]();};}function respondWithResult(_0x38484f,_0x3a5ee7){_0x3a5ee7=_0x3a5ee7||0xc8;return function(_0x9ceb4b){if(_0x9ceb4b){return _0x38484f[_0xe96e('0x20')](_0x3a5ee7)[_0xe96e('0x22')](_0x9ceb4b);}};}function respondWithFilteredResult(_0x459c49,_0xf5d16){return function(_0x3b6206){if(_0x3b6206){var _0x440512=typeof _0xf5d16[_0xe96e('0x23')]===_0xe96e('0x24')&&typeof _0xf5d16[_0xe96e('0x25')]==='undefined';var _0x270985=_0x3b6206[_0xe96e('0x26')];var _0x5f17a5=_0x440512?0x0:_0xf5d16['offset'];var _0x94e258=_0x440512?_0x3b6206[_0xe96e('0x26')]:_0xf5d16[_0xe96e('0x23')]+_0xf5d16[_0xe96e('0x25')];var _0x2eee27;if(_0x94e258>=_0x270985){_0x94e258=_0x270985;_0x2eee27=0xc8;}else{_0x2eee27=0xce;}_0x459c49[_0xe96e('0x20')](_0x2eee27);return _0x459c49[_0xe96e('0x27')](_0xe96e('0x28'),_0x5f17a5+'-'+_0x94e258+'/'+_0x270985)['json'](_0x3b6206);}return null;};}function saveUpdates(_0x121a90){return function(_0xafeaa4){if(_0xafeaa4){return _0xafeaa4['update'](_0x121a90)['then'](function(_0x4b487d){return _0x4b487d;});}return null;};}function removeEntity(_0x400bd7){return function(_0x420297){if(_0x420297){return _0x420297[_0xe96e('0x29')]()['then'](function(){_0x400bd7[_0xe96e('0x20')](0xcc)[_0xe96e('0x21')]();});}};}function handleEntityNotFound(_0x43a5b5){return function(_0x36bc95){if(!_0x36bc95){_0x43a5b5[_0xe96e('0x1f')](0x194);}return _0x36bc95;};}function handleError(_0x3bca47,_0xa1b923){_0xa1b923=_0xa1b923||0x1f4;return function(_0xefe248){logger[_0xe96e('0x1a')](_0xefe248[_0xe96e('0x2a')]);if(_0xefe248[_0xe96e('0x2b')]){delete _0xefe248[_0xe96e('0x2b')];}_0x3bca47[_0xe96e('0x20')](_0xa1b923)[_0xe96e('0x2c')](_0xefe248);};}function getMustacheRender(_0x51b717,_0x2e6f15){return Mustache[_0xe96e('0x2d')](_0x51b717,_[_0xe96e('0x2e')](_0x2e6f15['body'],{'contact':_0x2e6f15[_0xe96e('0x2f')],'message':_0x2e6f15['message'],'agent':_0x2e6f15[_0xe96e('0x30')],'interaction':_0x2e6f15['interaction'],'account':_0x2e6f15[_0xe96e('0x31')]}))||'';}exports[_0xe96e('0x32')]=function(_0x246bab,_0xe3ac2a){var _0x5df22c={};var _0x378f11=_[_0xe96e('0x33')](db[_0xe96e('0x34')][_0xe96e('0x35')],function(_0x278fcb){return{'name':_0x278fcb[_0xe96e('0x36')],'type':_0x278fcb[_0xe96e('0x37')][_0xe96e('0x38')]};});_0x5df22c=qs[_0xe96e('0x39')](_0x378f11,_0x246bab);return interaction['findAll']('chat',_0x246bab[_0xe96e('0x3a')],_0x246bab['user'],_0x5df22c,_0x378f11)['then'](respondWithFilteredResult(_0xe3ac2a,_0x5df22c))[_0xe96e('0x1e')](handleError(_0xe3ac2a,null));};exports[_0xe96e('0x3b')]=function(_0x14d405,_0xb0ca4f){var _0x302ac2={'raw':![],'where':{'id':_0x14d405[_0xe96e('0x3c')]['id']}},_0x4ab390={};_0x4ab390[_0xe96e('0x3d')]=_['keys'](db[_0xe96e('0x34')]['rawAttributes']);_0x4ab390[_0xe96e('0x3a')]=_[_0xe96e('0x3e')](_0x14d405[_0xe96e('0x3a')]);_0x4ab390[_0xe96e('0x3f')]=_[_0xe96e('0x40')](_0x4ab390[_0xe96e('0x3d')],_0x4ab390[_0xe96e('0x3a')]);_0x302ac2[_0xe96e('0x41')]=_['intersection'](_0x4ab390[_0xe96e('0x3d')],qs[_0xe96e('0x42')](_0x14d405[_0xe96e('0x3a')][_0xe96e('0x42')]));_0x302ac2[_0xe96e('0x41')]=_0x302ac2['attributes'][_0xe96e('0x43')]?_0x302ac2[_0xe96e('0x41')]:_0x4ab390[_0xe96e('0x3d')];if(_0x14d405[_0xe96e('0x3a')][_0xe96e('0x44')]){_0x302ac2[_0xe96e('0x45')]=[{'all':!![]}];}_0x302ac2=_[_0xe96e('0x2e')]({},_0x302ac2,_0x14d405['options']);return db[_0xe96e('0x34')][_0xe96e('0x46')](_0x302ac2)[_0xe96e('0x15')](handleEntityNotFound(_0xb0ca4f,null))[_0xe96e('0x15')](respondWithResult(_0xb0ca4f,null))[_0xe96e('0x1e')](handleError(_0xb0ca4f,null));};exports['create']=function(_0x44917e,_0x3c1f63){return db[_0xe96e('0x34')][_0xe96e('0x47')](_0x44917e[_0xe96e('0x48')],{})['then'](respondWithResult(_0x3c1f63,0xc9))[_0xe96e('0x1e')](handleError(_0x3c1f63,null));};exports[_0xe96e('0x49')]=function(_0x1a9d84,_0x5e027b){if(_0x1a9d84['body']['id']){delete _0x1a9d84[_0xe96e('0x48')]['id'];}return db[_0xe96e('0x34')][_0xe96e('0x46')]({'where':{'id':_0x1a9d84[_0xe96e('0x3c')]['id']}})[_0xe96e('0x15')](handleEntityNotFound(_0x5e027b,null))[_0xe96e('0x15')](saveUpdates(_0x1a9d84[_0xe96e('0x48')],null))['then'](respondWithResult(_0x5e027b,null))[_0xe96e('0x1e')](handleError(_0x5e027b,null));};exports['destroy']=function(_0x52be25,_0x22d2f4){return db[_0xe96e('0x34')][_0xe96e('0x46')]({'where':{'id':_0x52be25['params']['id']}})[_0xe96e('0x15')](handleEntityNotFound(_0x22d2f4,null))[_0xe96e('0x15')](removeEntity(_0x22d2f4,null))['catch'](handleError(_0x22d2f4,null));};exports[_0xe96e('0x4a')]=function(_0x3b4436,_0x226ba8){return db['ChatInteraction'][_0xe96e('0x4a')]()[_0xe96e('0x15')](respondWithResult(_0x226ba8,null))['catch'](handleError(_0x226ba8,null));};exports[_0xe96e('0x4b')]=function(_0x585f9f,_0x1964d5){var _0x393a08=_0x585f9f[_0xe96e('0x3c')]['id'];var _0x30db48;var _0x1f4989;var _0x4777da;return db[_0xe96e('0x34')]['findOne']({'where':{'id':_0x393a08}})[_0xe96e('0x15')](function(_0x96e9ab){_0x30db48=_0x96e9ab;return db[_0xe96e('0x4c')]['findOne']({'where':{'id':_0x96e9ab[_0xe96e('0x4d')]},'attributes':['id',_0xe96e('0x4e'),'vidaooEscalation',_0xe96e('0x4f'),_0xe96e('0x50'),_0xe96e('0x51')],'raw':!![]});})[_0xe96e('0x15')](function(_0x358eae){if(_0x358eae&&_0x358eae['vidaooApiKey']&&_0x358eae[_0xe96e('0x52')]){_0x1f4989=_0x358eae;var _0x2b5c42={'interaction':{'id':_0x393a08},'agent':{'id':_0x585f9f[_0xe96e('0x53')]['id'],'name':_0x585f9f[_0xe96e('0x53')][_0xe96e('0x2b')],'fullname':_0x585f9f[_0xe96e('0x53')][_0xe96e('0x54')],'email':_0x585f9f[_0xe96e('0x53')][_0xe96e('0x55')]},'contact':_0x585f9f[_0xe96e('0x48')][_0xe96e('0x2f')],'account':_0x585f9f[_0xe96e('0x48')]['account']};var _0x2d41dc={'rejectUnauthorized':![],'method':_0xe96e('0x56'),'url':_0xe96e('0x57'),'headers':{'X-APIKEY':_0x358eae[_0xe96e('0x4e')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x585f9f[_0xe96e('0x53')][_0xe96e('0x55')]],'buttons':null,'topic':_0x1f4989['vidaooTopic'],'note':_[_0xe96e('0x58')](_0x1f4989[_0xe96e('0x50')])?null:getMustacheRender(_0x1f4989['vidaooNote'],_0x2b5c42),'metadata':null},'redirect':_0xe96e('0x59'),'json':!![]};try{if(!_['isNull'](_0x1f4989[_0xe96e('0x51')])){var _0x33d522=getMustacheRender(_0x1f4989[_0xe96e('0x51')],_0x2b5c42);var _0x17deab=JSON['parse'](_0x33d522);_0x2d41dc['body'][_0xe96e('0x5a')]=_0x17deab;}}catch(_0x2f0a6c){throw new db[(_0xe96e('0x5b'))][(_0xe96e('0x5c'))](_0xe96e('0x5d'));}return rp(_0x2d41dc);}else{throw new db[(_0xe96e('0x5b'))][(_0xe96e('0x5c'))]('Error\x20in\x20Vidaoo\x20configuration');}})[_0xe96e('0x15')](function(_0x4ffc04){_0x4777da=_0x4ffc04;if(_0x4777da['id']){var _0x420da7={'body':_0x4777da[_0xe96e('0x5e')],'ChatWebsiteId':_0x1f4989['id'],'ChatInteractionId':_0x30db48['id'],'direction':_0xe96e('0x5f'),'UserId':_0x585f9f['user']['id']};return db[_0xe96e('0x60')][_0xe96e('0x47')](_0x420da7,{});}else{throw new db[(_0xe96e('0x5b'))][(_0xe96e('0x5c'))](_0xe96e('0x61'));}})[_0xe96e('0x15')](function(){return _0x30db48[_0xe96e('0x62')]({'vidaooSessionId':_0x4777da['id']});})[_0xe96e('0x15')](respondWithResult(_0x1964d5,null))['catch'](handleError(_0x1964d5,null));};exports['customUpdate']=function(_0x2bb4f3,_0x42577c){if(_0x2bb4f3[_0xe96e('0x48')]['id']){delete _0x2bb4f3[_0xe96e('0x48')]['id'];}return db[_0xe96e('0x34')][_0xe96e('0x46')]({'where':{'id':_0x2bb4f3[_0xe96e('0x3c')]['id']},'include':[{'model':db[_0xe96e('0x63')],'as':_0xe96e('0x64')}]})['then'](handleEntityNotFound(_0x42577c,null))['then'](saveUpdates(_0x2bb4f3[_0xe96e('0x48')],null))[_0xe96e('0x15')](respondWithResult(_0x42577c,null))[_0xe96e('0x1e')](handleError(_0x42577c,null));};exports[_0xe96e('0x65')]=function(_0x373989,_0x1ee563){if(_0x373989[_0xe96e('0x48')]['id']){delete _0x373989[_0xe96e('0x48')]['id'];}return db[_0xe96e('0x34')][_0xe96e('0x46')]({'where':{'id':_0x373989[_0xe96e('0x3c')]['id']}})[_0xe96e('0x15')](function(_0x1ad969){if(!_0x1ad969){logger[_0xe96e('0x1a')](_0xe96e('0x66'),'abandon',0x194,_0xe96e('0x67'));_0x1ee563[_0xe96e('0x1f')](0x194);}else{if(_0x1ad969[_0xe96e('0x68')]){throw new db[(_0xe96e('0x5b'))][(_0xe96e('0x5c'))](_0xe96e('0x69'));}}return _0x1ad969;})[_0xe96e('0x15')](function(_0x5bbd94){if(_0x5bbd94){return _0x5bbd94[_0xe96e('0x49')]({'closed':_0x373989[_0xe96e('0x48')]['closed'],'disposition':_0x373989[_0xe96e('0x48')]['disposition']})[_0xe96e('0x15')](function(_0x3864a3){return _0x3864a3;});}})[_0xe96e('0x15')](function(){return respondWithRpcPromise('AbandonInteraction',_0xe96e('0x65'),_0x373989['body'],client9004);})[_0xe96e('0x15')](respondWithResult(_0x1ee563,null))['catch'](handleError(_0x1ee563,null));};exports[_0xe96e('0x6a')]=function(_0x13c2e3,_0xb51c71){_0x13c2e3[_0xe96e('0x48')][_0xe96e('0x2b')]=_0x13c2e3[_0xe96e('0x6b')][_0xe96e('0x6c')];_0x13c2e3[_0xe96e('0x48')][_0xe96e('0x6d')]=_0x13c2e3[_0xe96e('0x6b')]['filename'];_0x13c2e3[_0xe96e('0x48')]['type']=_0x13c2e3[_0xe96e('0x6b')][_0xe96e('0x6e')];return db[_0xe96e('0x6f')][_0xe96e('0x47')](_0x13c2e3[_0xe96e('0x48')])['then'](respondWithResult(_0xb51c71,0xc9))[_0xe96e('0x1e')](handleError(_0xb51c71,null));};exports[_0xe96e('0x70')]=function(_0x19c66f,_0x40e52c){return db[_0xe96e('0x34')][_0xe96e('0x71')]({'where':{'id':_0x19c66f[_0xe96e('0x3c')]['id']},'raw':!![]})[_0xe96e('0x15')](handleEntityNotFound(_0x40e52c,null))[_0xe96e('0x15')](function(_0x12e021){if(_0x12e021){if(_0x12e021['closed']){return _0x40e52c[_0xe96e('0x20')](0x193)[_0xe96e('0x22')]({'status':0x193,'message':_0xe96e('0x72')});}return db[_0xe96e('0x6f')][_0xe96e('0x71')]({'where':{'id':_0x19c66f[_0xe96e('0x3a')][_0xe96e('0x73')]},'raw':!![]})[_0xe96e('0x15')](handleEntityNotFound(_0x40e52c,null));}})['then'](function(_0x1adaea){if(_0x1adaea){var _0x47b73a=_0x1adaea[_0xe96e('0x74')]!==null;var _0x2f9543=path[_0xe96e('0x75')](config[_0xe96e('0x76')],'server/files/attachments/');if(_0x47b73a){_0x2f9543=path[_0xe96e('0x75')](_0x2f9543,'offline-chat/');}var _0x1f6759=path[_0xe96e('0x75')](_0x2f9543,_0x1adaea[_0xe96e('0x6d')]);return _0x40e52c[_0xe96e('0x77')](_0x1f6759);}})[_0xe96e('0x1e')](handleError(_0x40e52c,null));};exports[_0xe96e('0x78')]=function(_0xd6004f,_0x5169ae){var _0x533e29=null;var _0x54913e=null;var _0x287fce=null;if(_0xd6004f[_0xe96e('0x48')]['id']){delete _0xd6004f[_0xe96e('0x48')]['id'];}if(_0xd6004f['body'][_0xe96e('0x79')]){_0x287fce=path[_0xe96e('0x75')](config[_0xe96e('0x76')],_0xe96e('0x7a'),util[_0xe96e('0x7b')](_0xe96e('0x7c'),Date[_0xe96e('0x7d')]()));_0xd6004f[_0xe96e('0x48')][_0xe96e('0x7e')]=_0x287fce;}return db[_0xe96e('0x34')][_0xe96e('0x46')]({'where':{'id':_0xd6004f['params']['id']},'include':[{'model':db[_0xe96e('0x60')],'as':_0xe96e('0x7f'),'include':[{'model':db[_0xe96e('0x80')],'as':_0xe96e('0x80')}]}]})[_0xe96e('0x15')](handleEntityNotFound(_0x5169ae,null))[_0xe96e('0x15')](saveUpdates(_0xd6004f[_0xe96e('0x48')],null))[_0xe96e('0x15')](function(_0x3395a3){if(_0x3395a3){_0x533e29=_0x3395a3;return db[_0xe96e('0x4c')][_0xe96e('0x46')]({'where':{'id':_0x533e29[_0xe96e('0x4d')]}});}})[_0xe96e('0x15')](function(_0x503442){if(_0x503442){_0x54913e=_0x503442;return db[_0xe96e('0x63')][_0xe96e('0x46')]({'where':{'id':_0x533e29[_0xe96e('0x81')]}});}})[_0xe96e('0x15')](function(_0x2b94ff){if(_0x2b94ff){if(_0x287fce){var _0x33727e=null;for(var _0x1d0b4c=0x1;_0x1d0b4c<_0x533e29[_0xe96e('0x7f')][_0xe96e('0x43')];++_0x1d0b4c){_0x33727e=_0x533e29[_0xe96e('0x7f')][_0x1d0b4c];var _0x3d319f=_0x33727e[_0xe96e('0x68')]?util[_0xe96e('0x7b')](_0xe96e('0x82'),_0x54913e['agentAlias'],_0x33727e[_0xe96e('0x68')]):_0xe96e('0x83');var _0x584101=_0xd6004f[_0xe96e('0x48')][_0xe96e('0x84')]||util[_0xe96e('0x7b')]('%s%d','Visitor',_0x33727e[_0xe96e('0x81')]);switch(_0x54913e[_0xe96e('0x85')]){case'website_alias':_0x3d319f=_0x33727e[_0xe96e('0x68')]?util[_0xe96e('0x7b')](_0xe96e('0x82'),_0x54913e['agentAlias'],_0x33727e[_0xe96e('0x68')]):'System';break;case _0xe96e('0x86'):_0x3d319f=_0x33727e[_0xe96e('0x68')]?_0x33727e[_0xe96e('0x80')][_0xe96e('0x87')]||_0x33727e[_0xe96e('0x80')]['fullname']:_0xe96e('0x83');break;case _0xe96e('0x88'):_0x3d319f=_0x33727e[_0xe96e('0x68')]?_0x33727e['User'][_0xe96e('0x54')]:'System';break;default:_0x3d319f=_0x33727e[_0xe96e('0x68')]?util[_0xe96e('0x7b')](_0xe96e('0x82'),_0x54913e[_0xe96e('0x89')],_0x33727e[_0xe96e('0x68')]):_0xe96e('0x83');}var _0x322e26=util[_0xe96e('0x7b')](_0xe96e('0x8a'),moment(_0x33727e[_0xe96e('0x8b')])[_0xe96e('0x7b')](_0xe96e('0x8c')),_0x33727e['direction']==='in'?_0x584101:_0x3d319f,_0x33727e[_0xe96e('0x48')]);if(!_0x33727e['secret']){fs[_0xe96e('0x8d')](_0x287fce,_0x322e26);}}return db[_0xe96e('0x8e')][_0xe96e('0x71')]({'where':{'service':!![]},'include':[{'model':db[_0xe96e('0x8f')],'as':'Smtp','raw':!![],'include':[{'model':db['CloudProvider'],'as':_0xe96e('0x90'),'raw':!![]}]}]});}}})[_0xe96e('0x15')](function(_0x53c0b6){if(!_0x53c0b6||!_0x53c0b6[_0xe96e('0x91')]||!_0xd6004f[_0xe96e('0x48')])return _0x533e29;var _0xe3e71e=_0x53c0b6[_0xe96e('0x92')]();return respondWithRpcPromise(_0xe96e('0x93'),_0xe96e('0x94'),{'account':_0xe3e71e,'message':{'from':util[_0xe96e('0x7b')](_0xe96e('0x95'),_0x53c0b6['name'],_0x53c0b6[_0xe96e('0x55')]||_0x53c0b6['Smtp'][_0xe96e('0x53')]),'to':_0xd6004f[_0xe96e('0x48')][_0xe96e('0x79')],'subject':_0xe96e('0x96'),'text':util[_0xe96e('0x7b')]('Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a',_0xd6004f[_0xe96e('0x48')]['mailTranscript']),'attachments':[{'path':_0x287fce}]}})[_0xe96e('0x15')](function(){return _0x533e29;})[_0xe96e('0x1e')](function(_0x4e8612){logger[_0xe96e('0x1a')](_0x4e8612);});})[_0xe96e('0x15')](respondWithStatusCode(_0x5169ae,0xc8))['catch'](handleError(_0x5169ae,null));};exports['addMessage']=function(_0x1d6c82,_0x1c72de){return db['ChatMessage']['find']({'where':{'id':_0x1d6c82['params']['id']}})[_0xe96e('0x15')](handleEntityNotFound(_0x1c72de,null))[_0xe96e('0x15')](function(_0x204d41){if(_0x204d41){return _0x204d41[_0xe96e('0x97')](_0x1d6c82[_0xe96e('0x48')][_0xe96e('0x98')],_[_0xe96e('0x99')](_0x1d6c82[_0xe96e('0x48')],[_0xe96e('0x98'),'id'])||{});}})['then'](respondWithResult(_0x1c72de,null))[_0xe96e('0x1e')](handleError(_0x1c72de,null));};exports['getMessages']=function(_0x1b4e13,_0x104db5){var _0x4d93f4={'raw':![],'where':{}};var _0x236a05={};var _0x3c4487={'count':0x0,'rows':[]};return db[_0xe96e('0x34')][_0xe96e('0x71')]({'where':{'id':_0x1b4e13[_0xe96e('0x3c')]['id']}})['then'](handleEntityNotFound(_0x104db5,null))[_0xe96e('0x15')](function(_0x120001){if(_0x120001){_0x236a05[_0xe96e('0x3d')]=_[_0xe96e('0x3e')](db[_0xe96e('0x60')][_0xe96e('0x35')]);_0x236a05[_0xe96e('0x3a')]=_[_0xe96e('0x3e')](_0x1b4e13[_0xe96e('0x3a')]);_0x236a05[_0xe96e('0x3f')]=_['intersection'](_0x236a05[_0xe96e('0x3d')],_0x236a05[_0xe96e('0x3a')]);_0x4d93f4['attributes']=_[_0xe96e('0x40')](_0x236a05[_0xe96e('0x3d')],qs[_0xe96e('0x42')](_0x1b4e13[_0xe96e('0x3a')]['fields']));_0x4d93f4[_0xe96e('0x41')]=_0x4d93f4[_0xe96e('0x41')][_0xe96e('0x43')]?_0x4d93f4[_0xe96e('0x41')]:_0x236a05[_0xe96e('0x3d')];if(!_0x1b4e13[_0xe96e('0x3a')][_0xe96e('0x9a')](_0xe96e('0x9b'))){_0x4d93f4[_0xe96e('0x25')]=qs[_0xe96e('0x25')](_0x1b4e13[_0xe96e('0x3a')][_0xe96e('0x25')]);_0x4d93f4[_0xe96e('0x23')]=qs[_0xe96e('0x23')](_0x1b4e13[_0xe96e('0x3a')][_0xe96e('0x23')]);}_0x4d93f4['order']=qs[_0xe96e('0x9c')](_0x1b4e13['query'][_0xe96e('0x9c')]);_0x4d93f4['where']=qs[_0xe96e('0x3f')](_[_0xe96e('0x9d')](_0x1b4e13[_0xe96e('0x3a')],_0x236a05[_0xe96e('0x3f')]));_0x4d93f4[_0xe96e('0x9e')]['ChatInteractionId']=_0x120001['id'];if(_0x1b4e13['query'][_0xe96e('0x9f')]){_0x4d93f4[_0xe96e('0x9e')]=_['merge'](_0x4d93f4[_0xe96e('0x9e')],{'$or':_[_0xe96e('0x33')](_0x4d93f4[_0xe96e('0x41')],function(_0x33d216){var _0x5d4030={};_0x5d4030[_0x33d216]={'$like':'%'+_0x1b4e13[_0xe96e('0x3a')][_0xe96e('0x9f')]+'%'};return _0x5d4030;})});}if(_0x1b4e13['query'][_0xe96e('0xa0')]){var _0x59f6f9=_0x1b4e13[_0xe96e('0x3a')][_0xe96e('0xa0')][_0xe96e('0xa1')](',');var _0x2a88da={};_0x2a88da[_0x59f6f9[0x0]]={'$gte':moment(_0x59f6f9[0x1])['format'](_0xe96e('0xa2'))};_0x4d93f4[_0xe96e('0x9e')]=_[_0xe96e('0x2e')](_0x4d93f4[_0xe96e('0x9e')],_0x2a88da);}_0x4d93f4=_[_0xe96e('0x2e')]({},_0x4d93f4,_0x1b4e13[_0xe96e('0xa3')]);return db[_0xe96e('0x60')][_0xe96e('0x26')]({'where':_0x4d93f4[_0xe96e('0x9e')]})[_0xe96e('0x15')](function(_0x5e93f1){_0x3c4487[_0xe96e('0x26')]=_0x5e93f1;if(_0x1b4e13[_0xe96e('0x3a')][_0xe96e('0x44')]){_0x4d93f4[_0xe96e('0x45')]=[{'all':!![]}];}return db[_0xe96e('0x60')][_0xe96e('0xa4')](_0x4d93f4);})[_0xe96e('0x15')](function(_0x2df5f3){_0x3c4487[_0xe96e('0xa5')]=_0x2df5f3;return _0x3c4487;});}})['then'](respondWithFilteredResult(_0x104db5,_0x4d93f4))['catch'](handleError(_0x104db5,null));};exports[_0xe96e('0xa6')]=function(_0x2111d1,_0x4cf3a3){var _0x4abe37={'where':{}},_0x581016={},_0x383fe8={'count':0x0,'rows':[]};return db[_0xe96e('0x34')][_0xe96e('0x71')]({'where':{'id':_0x2111d1[_0xe96e('0x3c')]['id']}})[_0xe96e('0x15')](handleEntityNotFound(_0x4cf3a3,null))[_0xe96e('0x15')](function(_0x413697){if(_0x413697){_0x581016['model']=_[_0xe96e('0x3e')](db[_0xe96e('0x60')][_0xe96e('0x35')]);_0x581016[_0xe96e('0x3a')]=_['keys'](_0x2111d1['query']);_0x581016[_0xe96e('0x3f')]=_['intersection'](_0x581016[_0xe96e('0x3d')],_0x581016[_0xe96e('0x3a')]);_0x4abe37['attributes']=_['intersection'](_0x581016['model'],qs[_0xe96e('0x42')](_0x2111d1[_0xe96e('0x3a')][_0xe96e('0x42')]));_0x4abe37[_0xe96e('0x41')]=_0x4abe37[_0xe96e('0x41')][_0xe96e('0x43')]?_0x4abe37['attributes']:_0x581016[_0xe96e('0x3d')];if(!_0x2111d1[_0xe96e('0x3a')]['hasOwnProperty'](_0xe96e('0x9b'))){_0x4abe37[_0xe96e('0x25')]=qs[_0xe96e('0x25')](_0x2111d1[_0xe96e('0x3a')][_0xe96e('0x25')]);_0x4abe37[_0xe96e('0x23')]=qs[_0xe96e('0x23')](_0x2111d1[_0xe96e('0x3a')][_0xe96e('0x23')]);}_0x4abe37['order']=qs[_0xe96e('0x9c')](_0x2111d1['query'][_0xe96e('0x9c')]);_0x4abe37[_0xe96e('0x9e')]=qs[_0xe96e('0x3f')](_[_0xe96e('0x9d')](_0x2111d1[_0xe96e('0x3a')],_0x581016[_0xe96e('0x3f')]));_0x4abe37[_0xe96e('0x9e')][_0xe96e('0xa7')]=_0x413697['id'];if(_0x2111d1[_0xe96e('0x3a')][_0xe96e('0x9f')]){_0x4abe37[_0xe96e('0x9e')]=_[_0xe96e('0x2e')](_0x4abe37['where'],{'$or':_['map'](_0x4abe37[_0xe96e('0x41')],function(_0x4ca553){var _0xd40b59={};_0xd40b59[_0x4ca553]={'$like':'%'+_0x2111d1[_0xe96e('0x3a')]['filter']+'%'};return _0xd40b59;})});}_0x4abe37[_0xe96e('0x9e')][_0xe96e('0xa8')]=![];if(_0x2111d1[_0xe96e('0x3a')]['id']){_0x4abe37['where']['id']={'$gt':_0x2111d1[_0xe96e('0x3a')]['id']};}_0x4abe37=_[_0xe96e('0x2e')]({},_0x4abe37,_0x2111d1[_0xe96e('0xa3')]);return db[_0xe96e('0x60')][_0xe96e('0x26')]({'where':_0x4abe37[_0xe96e('0x9e')]})[_0xe96e('0x15')](function(_0xe1f2aa){_0x383fe8[_0xe96e('0x26')]=_0xe1f2aa;_0x4abe37[_0xe96e('0x45')]=[];if(_0x2111d1['query'][_0xe96e('0xa9')]){_0x4abe37['include']['push']({'model':db[_0xe96e('0x80')],'as':'User','attributes':['id','fullname','alias']});}if(_0x2111d1[_0xe96e('0x3a')]['includeAll']){_0x4abe37[_0xe96e('0x45')]=[{'all':!![]}];}return db['ChatMessage'][_0xe96e('0xa4')](_0x4abe37);})[_0xe96e('0x15')](function(_0x6e0bd4){_0x383fe8[_0xe96e('0xa5')]=_0x6e0bd4;return _0x383fe8;});}})[_0xe96e('0x15')](respondWithFilteredResult(_0x4cf3a3,_0x4abe37))['catch'](handleError(_0x4cf3a3,null));};exports[_0xe96e('0xaa')]=function(_0x3f1d4f,_0x37bb01){return db['ChatInteraction'][_0xe96e('0x46')]({'where':{'id':_0x3f1d4f[_0xe96e('0x3c')]['id']}})[_0xe96e('0x15')](handleEntityNotFound(_0x37bb01,null))[_0xe96e('0x15')](function(_0x5a0cd8){if(_0x5a0cd8){return _0x5a0cd8['setTags'](_0x3f1d4f[_0xe96e('0x48')][_0xe96e('0x98')],_['omit'](_0x3f1d4f['body'],['ids','id'])||{})[_0xe96e('0xab')](function(){return db[_0xe96e('0xac')][_0xe96e('0xa4')]({'attributes':['id',_0xe96e('0x2b'),_0xe96e('0xad')],'where':{'id':_0x3f1d4f['body'][_0xe96e('0x98')]}});})[_0xe96e('0x15')](function(_0x27aa9c){socket['emit'](_0xe96e('0xae'),{'id':Number(_0x3f1d4f[_0xe96e('0x3c')]['id']),'tags':_0x27aa9c||[]});return{'id':Number(_0x3f1d4f['params']['id']),'tags':_0x27aa9c||[]};});}})['then'](respondWithResult(_0x37bb01,null))[_0xe96e('0x1e')](handleError(_0x37bb01,null));};exports[_0xe96e('0xaf')]=function(_0xb8a649,_0x4ea8ae){return db[_0xe96e('0x34')][_0xe96e('0x46')]({'where':{'id':_0xb8a649['params']['id']}})[_0xe96e('0x15')](handleEntityNotFound(_0x4ea8ae,null))[_0xe96e('0x15')](function(_0x2a79ec){if(_0x2a79ec){return _0x2a79ec[_0xe96e('0xaf')](_0xb8a649[_0xe96e('0x3a')][_0xe96e('0x98')]);}})[_0xe96e('0x15')](respondWithStatusCode(_0x4ea8ae,null))[_0xe96e('0x1e')](handleError(_0x4ea8ae,null));};exports[_0xe96e('0x77')]=function(_0x4c275a,_0x4a3211){var _0x4decb6=moment()[_0xe96e('0xb0')]()[_0xe96e('0xb1')]();var _0x47dcc5=path[_0xe96e('0x75')](config['root'],_0xe96e('0xb2'),_0xe96e('0xb3'),_0xe96e('0xb4'));var _0x140ac5=path[_0xe96e('0x75')](config['root'],_0xe96e('0xb2'),_0xe96e('0xb3'),_0xe96e('0xb5'));var _0x414c49=path[_0xe96e('0x75')](_0x47dcc5,_0x4decb6);var _0x29dc15=util[_0xe96e('0x7b')]('transcript-%d-%s.zip',_0x4c275a[_0xe96e('0x3c')]['id'],_0x4decb6);var _0x39bcd9=path['join'](_0x47dcc5,_0x29dc15);var _0x5f240c=[];_0x5f240c[_0xe96e('0xb6')]({'model':db[_0xe96e('0x80')],'as':_0xe96e('0x80'),'attributes':['id','fullname'],'raw':!![]});_0x5f240c['push']({'model':db[_0xe96e('0x63')],'as':_0xe96e('0x64'),'attributes':['id',_0xe96e('0xb7'),_0xe96e('0xb8')],'raw':!![]});if(_0x4c275a['query'][_0xe96e('0xb5')]){_0x5f240c[_0xe96e('0xb6')]({'model':db['Attachment'],'as':_0xe96e('0x6f'),'raw':!![]});}var _0x2b6c77=[{'model':db[_0xe96e('0x60')],'as':_0xe96e('0x7f'),'attributes':['id','body',_0xe96e('0x8b'),_0xe96e('0xb9'),_0xe96e('0xa8'),_0xe96e('0xba')],'include':_0x5f240c}];_0x2b6c77['push']({'model':db[_0xe96e('0x4c')],'as':'Account','attributes':['id',_0xe96e('0x2b')]});_0x2b6c77[_0xe96e('0xb6')]({'model':db[_0xe96e('0x80')],'as':_0xe96e('0xbb'),'attributes':['id',_0xe96e('0x54')]});return db[_0xe96e('0x34')][_0xe96e('0x46')]({'where':{'id':_0x4c275a[_0xe96e('0x3c')]['id']},'include':_0x2b6c77})['then'](handleEntityNotFound(_0x4a3211,null))[_0xe96e('0x15')](function(_0xf4f2f3){if(_0xf4f2f3){var _0x35a58d=_0xf4f2f3[_0xe96e('0xbc')]({'plain':!![]});fs[_0xe96e('0xbd')](_0x414c49);var _0x2986e8={'channel':'Chat','account':_0x35a58d['Account']['name'],'agent':_0x35a58d[_0xe96e('0xbb')]?_0x35a58d[_0xe96e('0xbb')][_0xe96e('0x54')]:_0xe96e('0xbe'),'createdAt':moment(_0x35a58d['createdAt'])[_0xe96e('0x7b')]('YYYY-MM-DD\x20HH:mm:ss')[_0xe96e('0xb1')](),'closedAt':_0x35a58d[_0xe96e('0xbf')]?moment(_0x35a58d[_0xe96e('0xc0')])[_0xe96e('0x7b')](_0xe96e('0xa2'))[_0xe96e('0xb1')]():'','disposition':_0x35a58d[_0xe96e('0xc1')],'chatInfo':{'browser':_0x35a58d[_0xe96e('0xc2')],'os':_0x35a58d[_0xe96e('0xc3')],'referer':_0x35a58d['referer'],'customerIp':_0x35a58d[_0xe96e('0xc4')],'customerPort':_0x35a58d[_0xe96e('0xc5')]?_0x35a58d[_0xe96e('0xc5')]:_0xe96e('0xbe')},'messages':_(_0x35a58d[_0xe96e('0x7f')])[_0xe96e('0xc6')]()[_0xe96e('0x9f')]({'secret':![]})[_0xe96e('0x33')](function(_0x1831e3){if(_0x1831e3[_0xe96e('0x6f')]){var _0x3d3f49=path[_0xe96e('0x75')](_0x140ac5,_0x1831e3[_0xe96e('0x6f')]['basename']);if(fs['existsSync'](_0x3d3f49)){fs[_0xe96e('0xc7')](_0x3d3f49)[_0xe96e('0xc8')](fs['createWriteStream'](path[_0xe96e('0x75')](_0x414c49,_0x1831e3['Attachment'][_0xe96e('0x6d')])));}}return{'date':moment(_0x1831e3[_0xe96e('0x8b')])[_0xe96e('0x7b')](_0xe96e('0xa2'))[_0xe96e('0xb1')](),'sender':_0x1831e3['direction']===_0xe96e('0x5f')?_0x1831e3['User']?_0x1831e3['User'][_0xe96e('0x54')]:_0xe96e('0x83'):_0x1831e3[_0xe96e('0x64')][_0xe96e('0xb7')]+(_0x1831e3[_0xe96e('0x64')]['lastName']?'\x20'+_0x1831e3[_0xe96e('0x64')][_0xe96e('0xb8')]:''),'body':_0x1831e3['Attachment']?_0x1831e3['Attachment'][_0xe96e('0x6d')]:_0x1831e3[_0xe96e('0x48')],'direction':_0x1831e3[_0xe96e('0xb9')]===_0xe96e('0x5f')?'A':'C','secret':_0x1831e3[_0xe96e('0xa8')],'read':_0x1831e3[_0xe96e('0xba')],'attachment':_0x1831e3[_0xe96e('0x6f')]};})[_0xe96e('0xc9')]()};return ejs[_0xe96e('0xca')](path[_0xe96e('0x75')](config['root'],_0xe96e('0xb2'),_0xe96e('0xcb'),_0xe96e('0xcc')),{'interaction':_0x2986e8})[_0xe96e('0x15')](function(_0x826008){var _0x3d5cec=path[_0xe96e('0x75')](_0x414c49,_0xe96e('0xcd')+_0x35a58d['id']+'-'+_0x4decb6+'.pdf');var _0x31244c={'path':_0x3d5cec,'channel':_0xe96e('0xce'),'interactionId':_0x35a58d['id']};return pdf[_0xe96e('0xcf')](_0x826008,_0x31244c);})[_0xe96e('0x15')](function(){return new Promise(function(_0x3792b0,_0x178ed3){zipdir(_0x414c49,{'saveTo':_0x39bcd9},function(_0x1b464b,_0x4d55fa){if(_0x1b464b)return _0x178ed3(_0x1b464b);return _0x3792b0(_0x4d55fa);});})[_0xe96e('0x15')](function(){return new BPromise(function(_0xd121bb,_0x587609){rimraf(_0x414c49,function(_0x211e62){if(_0x211e62)_0x587609(_0x211e62);return _0xd121bb();});});})[_0xe96e('0x15')](function(){return _0x4a3211[_0xe96e('0x77')](_0x39bcd9,_0x29dc15,function(_0x214a83){if(_0x214a83){logger[_0xe96e('0x1a')](_0xe96e('0xd0'),_0x214a83);}else{fs['unlinkSync'](_0x39bcd9);}});});});}else{return _0x4a3211['sendStatus'](0xc8);}})['catch'](handleError(_0x4a3211,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index ba3abf8..467cabc 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 _0x9ee6=['../../mysqldb','ChatInteraction','ChatMessage','save','remove','getUsers','then','setDataValue','Users','map','emit','catch','hasOwnProperty','exports','events'];(function(_0xc7484e,_0x33d408){var _0x3a2ae7=function(_0xe774f7){while(--_0xe774f7){_0xc7484e['push'](_0xc7484e['shift']());}};_0x3a2ae7(++_0x33d408);}(_0x9ee6,0x11c));var _0x69ee=function(_0x37b3e5,_0x33b516){_0x37b3e5=_0x37b3e5-0x0;var _0x207f20=_0x9ee6[_0x37b3e5];return _0x207f20;};'use strict';var EventEmitter=require(_0x69ee('0x0'));var ChatInteraction=require(_0x69ee('0x1'))['db'][_0x69ee('0x2')];var ChatMessage=require('../../mysqldb')['db'][_0x69ee('0x3')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x69ee('0x4'),'afterUpdate':'update','afterDestroy':_0x69ee('0x5')};function emitEvent(_0x1b2db6){return function(_0x2f109e,_0x143bb2,_0x154891){_0x2f109e[_0x69ee('0x6')]({'attributes':['id'],'raw':!![]})[_0x69ee('0x7')](function(_0x5cd47a){_0x2f109e[_0x69ee('0x8')](_0x69ee('0x9'),_0x5cd47a[_0x69ee('0xa')](function(_0x49bdcb){return{'id':_0x49bdcb['id']};}));return ChatMessage['findAll']({'where':{'ChatInteractionId':_0x2f109e['id'],'direction':'in','read':![]},'raw':!![]});})[_0x69ee('0x7')](function(_0x451a18){_0x2f109e[_0x69ee('0x8')]('unreadMessages',_0x451a18['length']);ChatInteractionEvents[_0x69ee('0xb')](_0x1b2db6+':'+_0x2f109e['id'],_0x2f109e);ChatInteractionEvents[_0x69ee('0xb')](_0x1b2db6,_0x2f109e);_0x154891(null);})[_0x69ee('0xc')](_0x154891(null));};}for(var e in events){if(events[_0x69ee('0xd')](e)){var event=events[e];ChatInteraction['hook'](e,emitEvent(event));}}module[_0x69ee('0xe')]=ChatInteractionEvents; \ No newline at end of file +var _0x10e1=['ChatMessage','setMaxListeners','save','update','remove','getUsers','then','Users','map','findAll','setDataValue','unreadMessages','emit','catch','hasOwnProperty','hook','events','../../mysqldb','ChatInteraction'];(function(_0x1f36bb,_0x8af718){var _0xaf97fa=function(_0xeca489){while(--_0xeca489){_0x1f36bb['push'](_0x1f36bb['shift']());}};_0xaf97fa(++_0x8af718);}(_0x10e1,0x6f));var _0x110e=function(_0xaa1b3e,_0x47d976){_0xaa1b3e=_0xaa1b3e-0x0;var _0x454d7d=_0x10e1[_0xaa1b3e];return _0x454d7d;};'use strict';var EventEmitter=require(_0x110e('0x0'));var ChatInteraction=require(_0x110e('0x1'))['db'][_0x110e('0x2')];var ChatMessage=require(_0x110e('0x1'))['db'][_0x110e('0x3')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x110e('0x4')](0x0);var events={'afterCreate':_0x110e('0x5'),'afterUpdate':_0x110e('0x6'),'afterDestroy':_0x110e('0x7')};function emitEvent(_0x37fd08){return function(_0x330b98,_0x16ebab,_0x3f6a99){_0x330b98[_0x110e('0x8')]({'attributes':['id'],'raw':!![]})[_0x110e('0x9')](function(_0x5e1860){_0x330b98['setDataValue'](_0x110e('0xa'),_0x5e1860[_0x110e('0xb')](function(_0x3deffd){return{'id':_0x3deffd['id']};}));return ChatMessage[_0x110e('0xc')]({'where':{'ChatInteractionId':_0x330b98['id'],'direction':'in','read':![]},'raw':!![]});})[_0x110e('0x9')](function(_0x5c1799){_0x330b98[_0x110e('0xd')](_0x110e('0xe'),_0x5c1799['length']);ChatInteractionEvents[_0x110e('0xf')](_0x37fd08+':'+_0x330b98['id'],_0x330b98);ChatInteractionEvents[_0x110e('0xf')](_0x37fd08,_0x330b98);_0x3f6a99(null);})[_0x110e('0x10')](_0x3f6a99(null));};}for(var e in events){if(events[_0x110e('0x11')](e)){var event=events[e];ChatInteraction[_0x110e('0x12')](e,emitEvent(event));}}module['exports']=ChatInteractionEvents; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.model.js b/server/api/chatInteraction/chatInteraction.model.js index 50e701c..7ae2c60 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 _0x0454=['utf8mb4','util','api','moment','request-promise','path','rimraf','ChatInteraction','chat_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x27e208,_0x4d1182){var _0xcda460=function(_0x2b7f75){while(--_0x2b7f75){_0x27e208['push'](_0x27e208['shift']());}};_0xcda460(++_0x4d1182);}(_0x0454,0x1dd));var _0x4045=function(_0x552a93,_0x154d78){_0x552a93=_0x552a93-0x0;var _0x2a2fed=_0x0454[_0x552a93];return _0x2a2fed;};'use strict';var _=require('lodash');var util=require(_0x4045('0x0'));var logger=require('../../config/logger')(_0x4045('0x1'));var moment=require(_0x4045('0x2'));var BPromise=require('bluebird');var rp=require(_0x4045('0x3'));var fs=require('fs');var path=require(_0x4045('0x4'));var rimraf=require(_0x4045('0x5'));var config=require('../../config/environment');var attributes=require('./chatInteraction.attributes');module['exports']=function(_0x4d12e4,_0x269748){return _0x4d12e4['define'](_0x4045('0x6'),attributes,{'tableName':_0x4045('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2470c3,_0x19fcad,_0x2ab312){if(_0x2470c3[_0x4045('0x8')](_0x4045('0x9'))){_0x2470c3[_0x4045('0xa')]=moment()[_0x4045('0xb')](_0x4045('0xc'));}_0x2ab312(null,_0x2470c3);}},'charset':_0x4045('0xd'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x5eed=['../../config/environment','./chatInteraction.attributes','exports','ChatInteraction','chat_interactions','format','YYYY-MM-DD\x20HH:mm:ss','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment'];(function(_0x2c8a49,_0x483a66){var _0x5f4ec3=function(_0x381a42){while(--_0x381a42){_0x2c8a49['push'](_0x2c8a49['shift']());}};_0x5f4ec3(++_0x483a66);}(_0x5eed,0x134));var _0xd5ee=function(_0x20f322,_0x3631b2){_0x20f322=_0x20f322-0x0;var _0x57b28b=_0x5eed[_0x20f322];return _0x57b28b;};'use strict';var _=require(_0xd5ee('0x0'));var util=require(_0xd5ee('0x1'));var logger=require(_0xd5ee('0x2'))('api');var moment=require(_0xd5ee('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xd5ee('0x4'));var attributes=require(_0xd5ee('0x5'));module[_0xd5ee('0x6')]=function(_0x32f128,_0xcabcdf){return _0x32f128['define'](_0xd5ee('0x7'),attributes,{'tableName':_0xd5ee('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3751f6,_0x26c6f6,_0x4b6a26){if(_0x3751f6['changed']('closed')){_0x3751f6['closedAt']=moment()[_0xd5ee('0x9')](_0xd5ee('0xa'));}_0x4b6a26(null,_0x3751f6);}},'charset':_0xd5ee('0xb'),'collate':_0xd5ee('0xc')});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index 051c3b1..323fcf5 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 _0xedb3=['client','http','redis','defaults','localhost','register','request','then','info','ChatInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','ChatInteraction,\x20%s,\x20%s','message','result','catch','update','body','options','raw','where','attributes','limit','UpdateChatInteraction','debug','AddTagsToChatInteraction','ChatInteraction','find','addTags','ids','spread','AddTags','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise'];(function(_0x53e661,_0xc28ce3){var _0xb5873f=function(_0x3a2af5){while(--_0x3a2af5){_0x53e661['push'](_0x53e661['shift']());}};_0xb5873f(++_0xc28ce3);}(_0xedb3,0x1a5));var _0x3edb=function(_0x87b0ff,_0x314389){_0x87b0ff=_0x87b0ff-0x0;var _0x3bc0b2=_0xedb3[_0x87b0ff];return _0x3bc0b2;};'use strict';var _=require(_0x3edb('0x0'));var util=require('util');var moment=require(_0x3edb('0x1'));var BPromise=require(_0x3edb('0x2'));var rs=require(_0x3edb('0x3'));var fs=require('fs');var Redis=require(_0x3edb('0x4'));var db=require(_0x3edb('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x3edb('0x6'))(_0x3edb('0x7'));var config=require('../../config/environment');var jayson=require(_0x3edb('0x8'));var client=jayson[_0x3edb('0x9')][_0x3edb('0xa')]({'port':0x232a});config[_0x3edb('0xb')]=_[_0x3edb('0xc')](config[_0x3edb('0xb')],{'host':_0x3edb('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3edb('0xb')]));require('./chatInteraction.socket')[_0x3edb('0xe')](socket);function respondWithRpcPromise(_0x2d8eec,_0x3f07b3,_0xdc1591){return new BPromise(function(_0x465f51,_0x2aeb00){return client[_0x3edb('0xf')](_0x2d8eec,_0xdc1591)[_0x3edb('0x10')](function(_0x80ae06){logger[_0x3edb('0x11')]('ChatInteraction,\x20%s,\x20%s',_0x3f07b3,'request\x20sent');logger['debug'](_0x3edb('0x12'),_0x3f07b3,_0x3edb('0x13'),JSON[_0x3edb('0x14')](_0x80ae06));if(_0x80ae06[_0x3edb('0x15')]){if(_0x80ae06[_0x3edb('0x15')][_0x3edb('0x16')]===0x1f4){logger[_0x3edb('0x15')](_0x3edb('0x17'),_0x3f07b3,_0x80ae06[_0x3edb('0x15')][_0x3edb('0x18')]);return _0x2aeb00(_0x80ae06[_0x3edb('0x15')][_0x3edb('0x18')]);}logger[_0x3edb('0x15')]('ChatInteraction,\x20%s,\x20%s',_0x3f07b3,_0x80ae06[_0x3edb('0x15')][_0x3edb('0x18')]);return _0x465f51(_0x80ae06['error'][_0x3edb('0x18')]);}else{logger[_0x3edb('0x11')](_0x3edb('0x17'),_0x3f07b3,'request\x20sent');_0x465f51(_0x80ae06[_0x3edb('0x19')][_0x3edb('0x18')]);}})[_0x3edb('0x1a')](function(_0x5899da){logger[_0x3edb('0x15')]('ChatInteraction,\x20%s,\x20%s',_0x3f07b3,_0x5899da);_0x2aeb00(_0x5899da);});});}exports['UpdateChatInteraction']=function(_0x49e539){var _0x1515e9=this;return new Promise(function(_0x2616cd,_0x1ed4b2){return db['ChatInteraction'][_0x3edb('0x1b')](_0x49e539[_0x3edb('0x1c')],{'raw':_0x49e539[_0x3edb('0x1d')]?_0x49e539[_0x3edb('0x1d')][_0x3edb('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x49e539['options']?_0x49e539[_0x3edb('0x1d')][_0x3edb('0x1f')]||null:null,'attributes':_0x49e539[_0x3edb('0x1d')]?_0x49e539['options'][_0x3edb('0x20')]||null:null,'limit':_0x49e539[_0x3edb('0x1d')]?_0x49e539[_0x3edb('0x1d')][_0x3edb('0x21')]||null:null})[_0x3edb('0x10')](function(_0x39228e){logger[_0x3edb('0x11')](_0x3edb('0x22'),_0x49e539);logger[_0x3edb('0x23')](_0x3edb('0x22'),_0x49e539,JSON[_0x3edb('0x14')](_0x39228e));_0x2616cd(_0x39228e);})['catch'](function(_0xeef83f){logger[_0x3edb('0x15')](_0x3edb('0x22'),_0xeef83f[_0x3edb('0x18')],_0x49e539);_0x1ed4b2(_0x1515e9[_0x3edb('0x15')](0x1f4,_0xeef83f[_0x3edb('0x18')]));});});};exports[_0x3edb('0x24')]=function(_0x3f73ec){return new Promise(function(_0x3b4804,_0x49460e){return db[_0x3edb('0x25')][_0x3edb('0x26')]({'where':_0x3f73ec[_0x3edb('0x1d')]?_0x3f73ec[_0x3edb('0x1d')]['where']||null:null})[_0x3edb('0x10')](function(_0x12f397){if(_0x12f397){return _0x12f397[_0x3edb('0x27')](_0x3f73ec[_0x3edb('0x1c')][_0x3edb('0x28')],_['omit'](_0x3f73ec[_0x3edb('0x1c')],[_0x3edb('0x28'),'id'])||{});}})[_0x3edb('0x29')](function(_0x400dce){logger[_0x3edb('0x11')](_0x3edb('0x2a'),_0x3f73ec);logger[_0x3edb('0x23')]('AddTags',_0x3f73ec,JSON[_0x3edb('0x14')](_0x400dce));_0x3b4804(_0x400dce);})[_0x3edb('0x1a')](function(_0x58efdc){logger[_0x3edb('0x15')]('AddTags',_0x58efdc[_0x3edb('0x18')],_0x3f73ec);_0x49460e(_this[_0x3edb('0x15')](0x1f4,_0x58efdc['message']));});});}; \ No newline at end of file +var _0xc311=['error','code','message','catch','UpdateChatInteraction','ChatInteraction','body','options','raw','attributes','limit','AddTagsToChatInteraction','find','where','addTags','ids','omit','AddTags','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x1e2bed,_0x2be54b){var _0xcfab35=function(_0xf81f45){while(--_0xf81f45){_0x1e2bed['push'](_0x1e2bed['shift']());}};_0xcfab35(++_0x2be54b);}(_0xc311,0x1ac));var _0x1c31=function(_0x47deac,_0x229fd7){_0x47deac=_0x47deac-0x0;var _0x2e6b3d=_0xc311[_0x47deac];return _0x2e6b3d;};'use strict';var _=require(_0x1c31('0x0'));var util=require('util');var moment=require(_0x1c31('0x1'));var BPromise=require('bluebird');var rs=require(_0x1c31('0x2'));var fs=require('fs');var Redis=require(_0x1c31('0x3'));var db=require(_0x1c31('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x1c31('0x5'))(_0x1c31('0x6'));var config=require(_0x1c31('0x7'));var jayson=require(_0x1c31('0x8'));var client=jayson['client'][_0x1c31('0x9')]({'port':0x232a});config[_0x1c31('0xa')]=_[_0x1c31('0xb')](config[_0x1c31('0xa')],{'host':_0x1c31('0xc'),'port':0x18eb});var socket=require(_0x1c31('0xd'))(new Redis(config[_0x1c31('0xa')]));require('./chatInteraction.socket')[_0x1c31('0xe')](socket);function respondWithRpcPromise(_0x5d65bb,_0x576586,_0x5d182a){return new BPromise(function(_0x412615,_0x474d2d){return client[_0x1c31('0xf')](_0x5d65bb,_0x5d182a)[_0x1c31('0x10')](function(_0x3d26a3){logger[_0x1c31('0x11')](_0x1c31('0x12'),_0x576586,_0x1c31('0x13'));logger[_0x1c31('0x14')](_0x1c31('0x15'),_0x576586,_0x1c31('0x13'),JSON[_0x1c31('0x16')](_0x3d26a3));if(_0x3d26a3[_0x1c31('0x17')]){if(_0x3d26a3[_0x1c31('0x17')][_0x1c31('0x18')]===0x1f4){logger[_0x1c31('0x17')](_0x1c31('0x12'),_0x576586,_0x3d26a3[_0x1c31('0x17')][_0x1c31('0x19')]);return _0x474d2d(_0x3d26a3['error'][_0x1c31('0x19')]);}logger[_0x1c31('0x17')](_0x1c31('0x12'),_0x576586,_0x3d26a3[_0x1c31('0x17')]['message']);return _0x412615(_0x3d26a3[_0x1c31('0x17')][_0x1c31('0x19')]);}else{logger[_0x1c31('0x11')](_0x1c31('0x12'),_0x576586,_0x1c31('0x13'));_0x412615(_0x3d26a3['result'][_0x1c31('0x19')]);}})[_0x1c31('0x1a')](function(_0x342d21){logger[_0x1c31('0x17')]('ChatInteraction,\x20%s,\x20%s',_0x576586,_0x342d21);_0x474d2d(_0x342d21);});});}exports[_0x1c31('0x1b')]=function(_0x338809){var _0x1c17da=this;return new Promise(function(_0x35ce5e,_0x3c8dfc){return db[_0x1c31('0x1c')]['update'](_0x338809[_0x1c31('0x1d')],{'raw':_0x338809['options']?_0x338809[_0x1c31('0x1e')][_0x1c31('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x338809[_0x1c31('0x1e')]?_0x338809[_0x1c31('0x1e')]['where']||null:null,'attributes':_0x338809[_0x1c31('0x1e')]?_0x338809[_0x1c31('0x1e')][_0x1c31('0x20')]||null:null,'limit':_0x338809[_0x1c31('0x1e')]?_0x338809[_0x1c31('0x1e')][_0x1c31('0x21')]||null:null})['then'](function(_0xdfbdb1){logger[_0x1c31('0x11')](_0x1c31('0x1b'),_0x338809);logger['debug'](_0x1c31('0x1b'),_0x338809,JSON[_0x1c31('0x16')](_0xdfbdb1));_0x35ce5e(_0xdfbdb1);})[_0x1c31('0x1a')](function(_0x3b474f){logger[_0x1c31('0x17')]('UpdateChatInteraction',_0x3b474f[_0x1c31('0x19')],_0x338809);_0x3c8dfc(_0x1c17da[_0x1c31('0x17')](0x1f4,_0x3b474f[_0x1c31('0x19')]));});});};exports[_0x1c31('0x22')]=function(_0x35383b){return new Promise(function(_0x2cab5f,_0x31cc91){return db[_0x1c31('0x1c')][_0x1c31('0x23')]({'where':_0x35383b['options']?_0x35383b[_0x1c31('0x1e')][_0x1c31('0x24')]||null:null})[_0x1c31('0x10')](function(_0x4beb56){if(_0x4beb56){return _0x4beb56[_0x1c31('0x25')](_0x35383b[_0x1c31('0x1d')][_0x1c31('0x26')],_[_0x1c31('0x27')](_0x35383b[_0x1c31('0x1d')],['ids','id'])||{});}})['spread'](function(_0x3ba33e){logger[_0x1c31('0x11')](_0x1c31('0x28'),_0x35383b);logger[_0x1c31('0x14')](_0x1c31('0x28'),_0x35383b,JSON[_0x1c31('0x16')](_0x3ba33e));_0x2cab5f(_0x3ba33e);})[_0x1c31('0x1a')](function(_0x3a74a0){logger[_0x1c31('0x17')](_0x1c31('0x28'),_0x3a74a0[_0x1c31('0x19')],_0x35383b);_0x31cc91(_this['error'](0x1f4,_0x3a74a0['message']));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index ad84b5f..2f80698 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 _0x53d5=['removeListener','register','length','chatInteraction:','./chatInteraction.events','save','remove','update'];(function(_0x3eda00,_0x224b78){var _0x44b022=function(_0x377ef0){while(--_0x377ef0){_0x3eda00['push'](_0x3eda00['shift']());}};_0x44b022(++_0x224b78);}(_0x53d5,0x1cc));var _0x553d=function(_0x2ff5c6,_0x248fe2){_0x2ff5c6=_0x2ff5c6-0x0;var _0x5605f2=_0x53d5[_0x2ff5c6];return _0x5605f2;};'use strict';var ChatInteractionEvents=require(_0x553d('0x0'));var events=[_0x553d('0x1'),_0x553d('0x2'),_0x553d('0x3')];function createListener(_0x1036b6,_0x81eca2){return function(_0x36f940){_0x81eca2['emit'](_0x1036b6,_0x36f940);};}function removeListener(_0xd5d2f7,_0x9e2c06){return function(){ChatInteractionEvents[_0x553d('0x4')](_0xd5d2f7,_0x9e2c06);};}exports[_0x553d('0x5')]=function(_0x2936ad){for(var _0x5328ca=0x0,_0x1d5a5e=events[_0x553d('0x6')];_0x5328ca<_0x1d5a5e;_0x5328ca++){var _0x1c38b2=events[_0x5328ca];var _0x14ef22=createListener(_0x553d('0x7')+_0x1c38b2,_0x2936ad);ChatInteractionEvents['on'](_0x1c38b2,_0x14ef22);}}; \ No newline at end of file +var _0x0fd1=['remove','emit','removeListener','register','length','./chatInteraction.events','save'];(function(_0x39096d,_0x51f8a0){var _0x13da4f=function(_0x11e6b2){while(--_0x11e6b2){_0x39096d['push'](_0x39096d['shift']());}};_0x13da4f(++_0x51f8a0);}(_0x0fd1,0x12b));var _0x10fd=function(_0x1f9f37,_0x18776e){_0x1f9f37=_0x1f9f37-0x0;var _0x21c080=_0x0fd1[_0x1f9f37];return _0x21c080;};'use strict';var ChatInteractionEvents=require(_0x10fd('0x0'));var events=[_0x10fd('0x1'),_0x10fd('0x2'),'update'];function createListener(_0x17838b,_0x462192){return function(_0x463e65){_0x462192[_0x10fd('0x3')](_0x17838b,_0x463e65);};}function removeListener(_0x634117,_0x33b0ec){return function(){ChatInteractionEvents[_0x10fd('0x4')](_0x634117,_0x33b0ec);};}exports[_0x10fd('0x5')]=function(_0x48150b){for(var _0x35a74b=0x0,_0x1d8be4=events[_0x10fd('0x6')];_0x35a74b<_0x1d8be4;_0x35a74b++){var _0x28094f=events[_0x35a74b];var _0x362c75=createListener('chatInteraction:'+_0x28094f,_0x48150b);ChatInteractionEvents['on'](_0x28094f,_0x362c75);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index c319b98..b1df7fe 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 _0x7ec7=['/:id/attachment_download','/:id/messages','getMyMessages','/:id/download','post','create','/:id/vidaoo','createVidaooSession','join','root','server/files/attachments/','format','%s-%s','now','originalname','/:id/attachment_upload','single','file','attachmentUpload','addMessage','/:id/tags','tracked','chat','chatinteraction:addtags','addTags','put','chatinteraction:update','/:id/custom_update','customUpdate','/:id/abandon','abandon','/:id/close','close','delete','chatinteraction:destroy','destroy','removeTags','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInteraction.controller','isAuthenticated','index','/describe','describe','get','/:id','isChatInteractionAuthorized'];(function(_0x1b6186,_0x1ec7f2){var _0x186121=function(_0x1748a8){while(--_0x1748a8){_0x1b6186['push'](_0x1b6186['shift']());}};_0x186121(++_0x1ec7f2);}(_0x7ec7,0x1d6));var _0x77ec=function(_0x1be34d,_0x1c5537){_0x1be34d=_0x1be34d-0x0;var _0x449843=_0x7ec7[_0x1be34d];return _0x449843;};'use strict';var multer=require(_0x77ec('0x0'));var util=require(_0x77ec('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x77ec('0x2'));var router=express[_0x77ec('0x3')]();var fs_extra=require(_0x77ec('0x4'));var auth=require(_0x77ec('0x5'));var interaction=require(_0x77ec('0x6'));var config=require(_0x77ec('0x7'));var controller=require(_0x77ec('0x8'));router['get']('/',auth[_0x77ec('0x9')](),controller[_0x77ec('0xa')]);router['get'](_0x77ec('0xb'),auth[_0x77ec('0x9')](),controller[_0x77ec('0xc')]);router[_0x77ec('0xd')](_0x77ec('0xe'),auth[_0x77ec('0xf')](),controller['show']);router[_0x77ec('0xd')](_0x77ec('0x10'),auth[_0x77ec('0xf')](),controller['attachmentDownload']);router[_0x77ec('0xd')](_0x77ec('0x11'),auth[_0x77ec('0x9')](),controller['getMessages']);router['get']('/:id/my_messages',auth[_0x77ec('0xf')](),controller[_0x77ec('0x12')]);router[_0x77ec('0xd')](_0x77ec('0x13'),auth[_0x77ec('0x9')](),controller['download']);router[_0x77ec('0x14')]('/',auth[_0x77ec('0x9')](),controller[_0x77ec('0x15')]);router[_0x77ec('0x14')](_0x77ec('0x16'),auth[_0x77ec('0x9')](),controller[_0x77ec('0x17')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3b18c6,_0x28b260,_0x1f6523){_0x1f6523(null,path[_0x77ec('0x18')](config[_0x77ec('0x19')],_0x77ec('0x1a')));},'filename':function(_0x964f4e,_0x301815,_0x1ae428){_0x1ae428(null,util[_0x77ec('0x1b')](_0x77ec('0x1c'),Date[_0x77ec('0x1d')](),_0x301815[_0x77ec('0x1e')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x77ec('0x14')](_0x77ec('0x1f'),upload[_0x77ec('0x20')](_0x77ec('0x21')),controller[_0x77ec('0x22')]);router[_0x77ec('0x14')](_0x77ec('0x11'),auth['isChatInteractionAuthorized'](),controller[_0x77ec('0x23')]);router[_0x77ec('0x14')](_0x77ec('0x24'),auth[_0x77ec('0x9')](),interaction[_0x77ec('0x25')](_0x77ec('0x26'),_0x77ec('0x27')),controller[_0x77ec('0x28')]);router[_0x77ec('0x29')](_0x77ec('0xe'),auth['isAuthenticated'](),interaction[_0x77ec('0x25')]('chat',_0x77ec('0x2a')),controller['update']);router['put'](_0x77ec('0x2b'),controller[_0x77ec('0x2c')]);router[_0x77ec('0x29')](_0x77ec('0x2d'),auth[_0x77ec('0xf')](),controller[_0x77ec('0x2e')]);router[_0x77ec('0x29')](_0x77ec('0x2f'),controller[_0x77ec('0x30')]);router[_0x77ec('0x31')](_0x77ec('0xe'),auth[_0x77ec('0x9')](),interaction[_0x77ec('0x25')](_0x77ec('0x26'),_0x77ec('0x32')),controller[_0x77ec('0x33')]);router[_0x77ec('0x31')](_0x77ec('0x24'),auth['isAuthenticated'](),controller[_0x77ec('0x34')]);module[_0x77ec('0x35')]=router; \ No newline at end of file +var _0xf407=['isAuthenticated','index','/:id','/:id/attachment_download','isChatInteractionAuthorized','attachmentDownload','getMessages','/:id/my_messages','getMyMessages','download','post','create','/:id/vidaoo','createVidaooSession','join','root','format','%s-%s','now','originalname','/:id/attachment_upload','single','file','attachmentUpload','/:id/messages','addMessage','/:id/tags','tracked','chatinteraction:addtags','addTags','put','chatinteraction:update','update','/:id/custom_update','abandon','close','delete','chat','chatinteraction:destroy','destroy','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInteraction.controller','get'];(function(_0x37f94c,_0x474dd6){var _0x4452a4=function(_0x30da23){while(--_0x30da23){_0x37f94c['push'](_0x37f94c['shift']());}};_0x4452a4(++_0x474dd6);}(_0xf407,0xc2));var _0x7f40=function(_0x55b6e1,_0x37c619){_0x55b6e1=_0x55b6e1-0x0;var _0x410f04=_0xf407[_0x55b6e1];return _0x410f04;};'use strict';var multer=require('multer');var util=require(_0x7f40('0x0'));var path=require(_0x7f40('0x1'));var timeout=require(_0x7f40('0x2'));var express=require(_0x7f40('0x3'));var router=express['Router']();var fs_extra=require(_0x7f40('0x4'));var auth=require(_0x7f40('0x5'));var interaction=require(_0x7f40('0x6'));var config=require(_0x7f40('0x7'));var controller=require(_0x7f40('0x8'));router[_0x7f40('0x9')]('/',auth[_0x7f40('0xa')](),controller[_0x7f40('0xb')]);router[_0x7f40('0x9')]('/describe',auth[_0x7f40('0xa')](),controller['describe']);router['get'](_0x7f40('0xc'),auth['isChatInteractionAuthorized'](),controller['show']);router[_0x7f40('0x9')](_0x7f40('0xd'),auth[_0x7f40('0xe')](),controller[_0x7f40('0xf')]);router[_0x7f40('0x9')]('/:id/messages',auth['isAuthenticated'](),controller[_0x7f40('0x10')]);router[_0x7f40('0x9')](_0x7f40('0x11'),auth[_0x7f40('0xe')](),controller[_0x7f40('0x12')]);router[_0x7f40('0x9')]('/:id/download',auth[_0x7f40('0xa')](),controller[_0x7f40('0x13')]);router[_0x7f40('0x14')]('/',auth[_0x7f40('0xa')](),controller[_0x7f40('0x15')]);router[_0x7f40('0x14')](_0x7f40('0x16'),auth[_0x7f40('0xa')](),controller[_0x7f40('0x17')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x25a5b9,_0x531a87,_0x1fa906){_0x1fa906(null,path[_0x7f40('0x18')](config[_0x7f40('0x19')],'server/files/attachments/'));},'filename':function(_0x64c9fc,_0xe7c7ca,_0x2ae059){_0x2ae059(null,util[_0x7f40('0x1a')](_0x7f40('0x1b'),Date[_0x7f40('0x1c')](),_0xe7c7ca[_0x7f40('0x1d')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x7f40('0x14')](_0x7f40('0x1e'),upload[_0x7f40('0x1f')](_0x7f40('0x20')),controller[_0x7f40('0x21')]);router['post'](_0x7f40('0x22'),auth['isChatInteractionAuthorized'](),controller[_0x7f40('0x23')]);router[_0x7f40('0x14')](_0x7f40('0x24'),auth[_0x7f40('0xa')](),interaction[_0x7f40('0x25')]('chat',_0x7f40('0x26')),controller[_0x7f40('0x27')]);router[_0x7f40('0x28')](_0x7f40('0xc'),auth[_0x7f40('0xa')](),interaction[_0x7f40('0x25')]('chat',_0x7f40('0x29')),controller[_0x7f40('0x2a')]);router[_0x7f40('0x28')](_0x7f40('0x2b'),controller['customUpdate']);router[_0x7f40('0x28')]('/:id/abandon',auth[_0x7f40('0xe')](),controller[_0x7f40('0x2c')]);router[_0x7f40('0x28')]('/:id/close',controller[_0x7f40('0x2d')]);router[_0x7f40('0x2e')](_0x7f40('0xc'),auth[_0x7f40('0xa')](),interaction['tracked'](_0x7f40('0x2f'),_0x7f40('0x30')),controller[_0x7f40('0x31')]);router[_0x7f40('0x2e')]('/:id/tags',auth[_0x7f40('0xa')](),controller['removeTags']);module[_0x7f40('0x32')]=router; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.attributes.js b/server/api/chatInternalMessage/chatInternalMessage.attributes.js index aad828a..98b0d2b 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 _0x610e=['exports','medium','BOOLEAN','sequelize'];(function(_0x31fb32,_0x52dd18){var _0x3ee276=function(_0x4c53a6){while(--_0x4c53a6){_0x31fb32['push'](_0x31fb32['shift']());}};_0x3ee276(++_0x52dd18);}(_0x610e,0x73));var _0xe610=function(_0x3946f0,_0x50663c){_0x3946f0=_0x3946f0-0x0;var _0x5dfae0=_0x610e[_0x3946f0];return _0x5dfae0;};'use strict';var Sequelize=require(_0xe610('0x0'));module[_0xe610('0x1')]={'body':{'type':Sequelize['TEXT'](_0xe610('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xe610('0x3')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x5e39=['BOOLEAN','INTEGER','sequelize','TEXT'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x5e39,0x19e));var _0x95e3=function(_0x20e8d8,_0x4e5d66){_0x20e8d8=_0x20e8d8-0x0;var _0x3ed8dd=_0x5e39[_0x20e8d8];return _0x3ed8dd;};'use strict';var Sequelize=require(_0x95e3('0x0'));module['exports']={'body':{'type':Sequelize[_0x95e3('0x1')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x95e3('0x2')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x95e3('0x3')]}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index a5adc19..f7d78bf 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 _0x950a=['create','body','describe','get','messages','createdAt','lastMessage','lastMessageAt','format','YYYY-MM-DD\x20HH:mm:ss','getUsers','User','findAll','agent','user','fullname','userpic','online','showWebBar','-online','VoiceQueues','UserProfileSection','Agents','userProfileId','autoAssociation','UserProfileResource','isEmpty','length','role','resourceId','push','FromId','ToId','read','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./chatInternalMessage.socket','register','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','map','ChatInternalMessage','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','nolimit','sort','where','filter','merge','VIRTUAL','options','includeAll','include','catch','show','params','find'];(function(_0x1abad1,_0x54ec22){var _0x46639a=function(_0x284108){while(--_0x284108){_0x1abad1['push'](_0x1abad1['shift']());}};_0x46639a(++_0x54ec22);}(_0x950a,0x100));var _0xa950=function(_0x31d353,_0x438585){_0x31d353=_0x31d353-0x0;var _0x46ace9=_0x950a[_0x31d353];return _0x46ace9;};'use strict';var emlformat=require(_0xa950('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa950('0x1'));var jsonpatch=require(_0xa950('0x2'));var rp=require(_0xa950('0x3'));var moment=require(_0xa950('0x4'));var BPromise=require(_0xa950('0x5'));var Mustache=require(_0xa950('0x6'));var util=require(_0xa950('0x7'));var path=require(_0xa950('0x8'));var sox=require('sox');var csv=require(_0xa950('0x9'));var ejs=require(_0xa950('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa950('0xb'));var squel=require(_0xa950('0xc'));var crypto=require(_0xa950('0xd'));var jsforce=require(_0xa950('0xe'));var deskjs=require(_0xa950('0xf'));var toCsv=require(_0xa950('0x9'));var querystring=require(_0xa950('0x10'));var Papa=require(_0xa950('0x11'));var Redis=require(_0xa950('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xa950('0x13'));var as=require(_0xa950('0x14'));var hardwareService=require(_0xa950('0x15'));var logger=require(_0xa950('0x16'))(_0xa950('0x17'));var utils=require(_0xa950('0x18'));var config=require(_0xa950('0x19'));var licenseUtil=require(_0xa950('0x1a'));var db=require(_0xa950('0x1b'))['db'];config[_0xa950('0x1c')]=_[_0xa950('0x1d')](config[_0xa950('0x1c')],{'host':_0xa950('0x1e'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xa950('0x1f'))[_0xa950('0x20')](socket);function respondWithStatusCode(_0x19e8ef,_0x3922fc){_0x3922fc=_0x3922fc||0xcc;return function(_0x2c6575){if(_0x2c6575){return _0x19e8ef[_0xa950('0x21')](_0x3922fc);}return _0x19e8ef[_0xa950('0x22')](_0x3922fc)[_0xa950('0x23')]();};}function respondWithResult(_0x596fec,_0x557e77){_0x557e77=_0x557e77||0xc8;return function(_0x11a870){if(_0x11a870){return _0x596fec[_0xa950('0x22')](_0x557e77)[_0xa950('0x24')](_0x11a870);}};}function respondWithFilteredResult(_0x3737cb,_0x463a33){return function(_0x12c4cf){if(_0x12c4cf){var _0x5c2edd=typeof _0x463a33[_0xa950('0x25')]==='undefined'&&typeof _0x463a33[_0xa950('0x26')]===_0xa950('0x27');var _0x4e552e=_0x12c4cf[_0xa950('0x28')];var _0x568c96=_0x5c2edd?0x0:_0x463a33[_0xa950('0x25')];var _0x39c529=_0x5c2edd?_0x12c4cf[_0xa950('0x28')]:_0x463a33[_0xa950('0x25')]+_0x463a33[_0xa950('0x26')];var _0x47f9ae;if(_0x39c529>=_0x4e552e){_0x39c529=_0x4e552e;_0x47f9ae=0xc8;}else{_0x47f9ae=0xce;}_0x3737cb['status'](_0x47f9ae);return _0x3737cb['set'](_0xa950('0x29'),_0x568c96+'-'+_0x39c529+'/'+_0x4e552e)[_0xa950('0x24')](_0x12c4cf);}return null;};}function patchUpdates(_0x52ec4d){return function(_0x58db42){try{jsonpatch[_0xa950('0x2a')](_0x58db42,_0x52ec4d,!![]);}catch(_0x4aa1dd){return BPromise[_0xa950('0x2b')](_0x4aa1dd);}return _0x58db42[_0xa950('0x2c')]();};}function saveUpdates(_0x415b0a,_0x653ed7){return function(_0x5af40b){if(_0x5af40b){return _0x5af40b[_0xa950('0x2d')](_0x415b0a)[_0xa950('0x2e')](function(_0x306807){return _0x306807;});}return null;};}function removeEntity(_0x57582c,_0x1e1529){return function(_0x357f71){if(_0x357f71){return _0x357f71[_0xa950('0x2f')]()[_0xa950('0x2e')](function(){_0x57582c['status'](0xcc)[_0xa950('0x23')]();});}};}function handleEntityNotFound(_0x13dce0,_0x37008f){return function(_0xb14b4c){if(!_0xb14b4c){_0x13dce0['sendStatus'](0x194);}return _0xb14b4c;};}function handleError(_0x4543b7,_0x3e4824){_0x3e4824=_0x3e4824||0x1f4;return function(_0x116c24){logger['error'](_0x116c24[_0xa950('0x30')]);if(_0x116c24[_0xa950('0x31')]){delete _0x116c24[_0xa950('0x31')];}_0x4543b7[_0xa950('0x22')](_0x3e4824)[_0xa950('0x32')](_0x116c24);};}exports['index']=function(_0x152aaa,_0xfa0333){var _0x271e87={},_0x331989={},_0x1b6a2a={'count':0x0,'rows':[]};var _0x1e3157=_[_0xa950('0x33')](db[_0xa950('0x34')][_0xa950('0x35')],function(_0x9b8edb){return{'name':_0x9b8edb[_0xa950('0x36')],'type':_0x9b8edb[_0xa950('0x37')][_0xa950('0x38')]};});_0x331989[_0xa950('0x39')]=_['map'](_0x1e3157,_0xa950('0x31'));_0x331989['query']=_[_0xa950('0x3a')](_0x152aaa['query']);_0x331989[_0xa950('0x3b')]=_[_0xa950('0x3c')](_0x331989[_0xa950('0x39')],_0x331989[_0xa950('0x3d')]);_0x271e87[_0xa950('0x3e')]=_[_0xa950('0x3c')](_0x331989[_0xa950('0x39')],qs[_0xa950('0x3f')](_0x152aaa['query'][_0xa950('0x3f')]));_0x271e87['attributes']=_0x271e87[_0xa950('0x3e')]['length']?_0x271e87['attributes']:_0x331989[_0xa950('0x39')];if(!_0x152aaa[_0xa950('0x3d')]['hasOwnProperty'](_0xa950('0x40'))){_0x271e87[_0xa950('0x26')]=qs[_0xa950('0x26')](_0x152aaa[_0xa950('0x3d')][_0xa950('0x26')]);_0x271e87[_0xa950('0x25')]=qs[_0xa950('0x25')](_0x152aaa[_0xa950('0x3d')][_0xa950('0x25')]);}_0x271e87['order']=qs['sort'](_0x152aaa[_0xa950('0x3d')][_0xa950('0x41')]);_0x271e87[_0xa950('0x42')]=qs[_0xa950('0x3b')](_['pick'](_0x152aaa[_0xa950('0x3d')],_0x331989[_0xa950('0x3b')]),_0x1e3157);if(_0x152aaa['query'][_0xa950('0x43')]){_0x271e87[_0xa950('0x42')]=_[_0xa950('0x44')](_0x271e87['where'],{'$or':_[_0xa950('0x33')](_0x1e3157,function(_0x115b23){if(_0x115b23[_0xa950('0x37')]!==_0xa950('0x45')){var _0x1eb499={};_0x1eb499[_0x115b23[_0xa950('0x31')]]={'$like':'%'+_0x152aaa[_0xa950('0x3d')][_0xa950('0x43')]+'%'};return _0x1eb499;}})});}_0x271e87=_[_0xa950('0x44')]({},_0x271e87,_0x152aaa[_0xa950('0x46')]);var _0x2eec53={'where':_0x271e87['where']};return db[_0xa950('0x34')]['count'](_0x2eec53)['then'](function(_0x4643c6){_0x1b6a2a[_0xa950('0x28')]=_0x4643c6;if(_0x152aaa[_0xa950('0x3d')][_0xa950('0x47')]){_0x271e87[_0xa950('0x48')]=[{'all':!![]}];}return db[_0xa950('0x34')]['findAll'](_0x271e87);})[_0xa950('0x2e')](function(_0x15fa60){_0x1b6a2a['rows']=_0x15fa60;return _0x1b6a2a;})['then'](respondWithFilteredResult(_0xfa0333,_0x271e87))[_0xa950('0x49')](handleError(_0xfa0333,null));};exports[_0xa950('0x4a')]=function(_0xf40575,_0x4e2c23){var _0x2ffd19={'raw':!![],'where':{'id':_0xf40575[_0xa950('0x4b')]['id']}},_0x1e6ac7={};_0x1e6ac7[_0xa950('0x39')]=_[_0xa950('0x3a')](db[_0xa950('0x34')]['rawAttributes']);_0x1e6ac7[_0xa950('0x3d')]=_[_0xa950('0x3a')](_0xf40575[_0xa950('0x3d')]);_0x1e6ac7['filters']=_[_0xa950('0x3c')](_0x1e6ac7[_0xa950('0x39')],_0x1e6ac7[_0xa950('0x3d')]);_0x2ffd19[_0xa950('0x3e')]=_[_0xa950('0x3c')](_0x1e6ac7['model'],qs[_0xa950('0x3f')](_0xf40575[_0xa950('0x3d')][_0xa950('0x3f')]));_0x2ffd19[_0xa950('0x3e')]=_0x2ffd19['attributes']['length']?_0x2ffd19['attributes']:_0x1e6ac7[_0xa950('0x39')];if(_0xf40575[_0xa950('0x3d')]['includeAll']){_0x2ffd19[_0xa950('0x48')]=[{'all':!![]}];}_0x2ffd19=_['merge']({},_0x2ffd19,_0xf40575[_0xa950('0x46')]);return db['ChatInternalMessage'][_0xa950('0x4c')](_0x2ffd19)['then'](handleEntityNotFound(_0x4e2c23,null))[_0xa950('0x2e')](respondWithResult(_0x4e2c23,null))['catch'](handleError(_0x4e2c23,null));};exports[_0xa950('0x4d')]=function(_0x26e9c0,_0x3c600a){return db['ChatInternalMessage'][_0xa950('0x4d')](_0x26e9c0['body'],{})[_0xa950('0x2e')](respondWithResult(_0x3c600a,0xc9))['catch'](handleError(_0x3c600a,null));};exports[_0xa950('0x2d')]=function(_0x2f27a8,_0x291017){if(_0x2f27a8[_0xa950('0x4e')]['id']){delete _0x2f27a8['body']['id'];}return db[_0xa950('0x34')][_0xa950('0x4c')]({'where':{'id':_0x2f27a8['params']['id']}})[_0xa950('0x2e')](handleEntityNotFound(_0x291017,null))[_0xa950('0x2e')](saveUpdates(_0x2f27a8[_0xa950('0x4e')],null))[_0xa950('0x2e')](respondWithResult(_0x291017,null))[_0xa950('0x49')](handleError(_0x291017,null));};exports[_0xa950('0x2f')]=function(_0x51481a,_0x39c125){return db[_0xa950('0x34')][_0xa950('0x4c')]({'where':{'id':_0x51481a[_0xa950('0x4b')]['id']}})[_0xa950('0x2e')](handleEntityNotFound(_0x39c125,null))[_0xa950('0x2e')](removeEntity(_0x39c125,null))[_0xa950('0x49')](handleError(_0x39c125,null));};exports[_0xa950('0x4f')]=function(_0x5aaa84,_0x23a211){return db[_0xa950('0x34')][_0xa950('0x4f')]()[_0xa950('0x2e')](respondWithResult(_0x23a211,null))[_0xa950('0x49')](handleError(_0x23a211,null));};function wrapUser(_0x3d7e57){return function(_0x3e511c){var _0xf0a8a=_0x3d7e57[_0xa950('0x50')]({'plain':!![]});_0xf0a8a[_0xa950('0x51')]=[];if(_0x3e511c){_0xf0a8a['lastMessageAt']=_0x3e511c[_0xa950('0x52')];_0xf0a8a[_0xa950('0x53')]=_0x3e511c;}else{_0xf0a8a[_0xa950('0x54')]=moment(0x0)[_0xa950('0x55')](_0xa950('0x56'));_0xf0a8a[_0xa950('0x53')]={};}return _0xf0a8a;};}exports[_0xa950('0x57')]=function(_0x10fa02,_0x58fd84,_0x5c86c9){var _0x1db7ac=[];return db[_0xa950('0x58')][_0xa950('0x59')]({'where':{'role':[_0xa950('0x5a'),'admin',_0xa950('0x5b')]},'attributes':['id',_0xa950('0x5c'),_0xa950('0x31'),'role',_0xa950('0x5d'),'internal',_0xa950('0x5e'),'lastLoginAt','allowmessenger',_0xa950('0x5f')],'order':qs[_0xa950('0x41')](_0xa950('0x60')),'include':[{'model':db['VoiceQueue'],'as':_0xa950('0x61'),'attributes':['id','name',_0xa950('0x37')],'through':{'attributes':[]}}]})[_0xa950('0x2e')](function(_0x57ae0f){if(_0x57ae0f){var _0xee450=_0x10fa02[_0xa950('0x5b')][_0xa950('0x50')]({'plain':!![]});if(!_0xee450)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xee450['role']===_0xa950('0x5b')){return db[_0xa950('0x62')][_0xa950('0x4c')]({'where':{'name':_0xa950('0x63'),'userProfileId':_0xee450[_0xa950('0x64')]},'raw':!![]})['then'](function(_0x290162){if(_0x290162){if(_0x290162[_0xa950('0x65')]===0x0){return db[_0xa950('0x66')][_0xa950('0x59')]({'where':{'sectionId':_0x290162['id']},'raw':!![]})[_0xa950('0x2e')](function(_0xcf5da){var _0x301e88=[];if(_[_0xa950('0x67')](_0xcf5da)){_0x301e88=_[_0xa950('0x43')](_0x57ae0f,function(_0x347e9d){if(_0x347e9d['role']!=='agent'){return _0x347e9d;}});return _0x301e88;}else{for(var _0x4c4e6d=0x0;_0x4c4e6d<_0x57ae0f[_0xa950('0x68')];_0x4c4e6d++){var _0x56588d=_0x57ae0f[_0x4c4e6d];if(_0x56588d[_0xa950('0x69')]===_0xa950('0x5a')){var _0x11e25d=_['find'](_0xcf5da,function(_0x5cd86f){return _0x5cd86f[_0xa950('0x6a')]===_0x56588d['id'];});if(_0x11e25d)_0x301e88[_0xa950('0x6b')](_0x56588d);}else{_0x301e88[_0xa950('0x6b')](_0x56588d);}}return _0x301e88;}});}else{return _0x57ae0f;}}else{var _0x5c81a2=_['filter'](_0x57ae0f,function(_0x2ce80c){if(_0x2ce80c['role']!==_0xa950('0x5a')){return _0x2ce80c;}});return _0x5c81a2;}});}else{return _0x57ae0f;}}})[_0xa950('0x2e')](function(_0x17e710){var _0x115352=[];if(_0x17e710){_0x1db7ac=_0x17e710;for(var _0x5a6943=0x0;_0x5a6943<_0x17e710[_0xa950('0x68')];_0x5a6943+=0x1){_0x1db7ac[_0x5a6943][_0xa950('0x51')]=[];_0x115352['push'](db[_0xa950('0x34')][_0xa950('0x4c')]({'where':{'FromId':[_0x10fa02[_0xa950('0x5b')]['id'],_0x17e710[_0x5a6943]['id']],'ToId':[_0x10fa02[_0xa950('0x5b')]['id'],_0x17e710[_0x5a6943]['id']],'ChatGroupId':null},'attributes':['id',_0xa950('0x52'),_0xa950('0x6c'),_0xa950('0x6d'),_0xa950('0x6e'),_0xa950('0x4e')],'order':qs[_0xa950('0x41')]('-createdAt'),'limit':0x1,'offset':0x0,'raw':!![]})[_0xa950('0x2e')](wrapUser(_0x17e710[_0x5a6943])));}return BPromise['all'](_0x115352);}return[];})[_0xa950('0x2e')](function(_0x220b05){return{'rows':_0x220b05,'count':_0x220b05[_0xa950('0x68')]};})[_0xa950('0x2e')](respondWithResult(_0x58fd84,null))[_0xa950('0x49')](handleError(_0x58fd84,null));}; \ No newline at end of file +var _0x36f6=['nolimit','sort','pick','where','merge','VIRTUAL','filter','includeAll','include','findAll','rows','catch','options','create','body','update','find','params','describe','messages','lastMessageAt','createdAt','format','lastMessage','User','agent','role','userpic','internal','online','lastLoginAt','showWebBar','VoiceQueue','VoiceQueues','type','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','resourceId','push','FromId','ToId','all','rimraf','fast-json-patch','moment','bluebird','mustache','util','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','localhost','socket.io-emitter','redis','./chatInternalMessage.socket','register','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','reject','save','destroy','then','error','stack','name','send','map','ChatInternalMessage','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty'];(function(_0x4ec322,_0x4192ca){var _0x24aa83=function(_0x4f5f7a){while(--_0x4f5f7a){_0x4ec322['push'](_0x4ec322['shift']());}};_0x24aa83(++_0x4192ca);}(_0x36f6,0x103));var _0x636f=function(_0x2a9548,_0x2742f6){_0x2a9548=_0x2a9548-0x0;var _0xf55c55=_0x36f6[_0x2a9548];return _0xf55c55;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x636f('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x636f('0x1'));var rp=require('request-promise');var moment=require(_0x636f('0x2'));var BPromise=require(_0x636f('0x3'));var Mustache=require(_0x636f('0x4'));var util=require(_0x636f('0x5'));var path=require('path');var sox=require(_0x636f('0x6'));var csv=require('to-csv');var ejs=require(_0x636f('0x7'));var fs=require('fs');var fs_extra=require(_0x636f('0x8'));var _=require('lodash');var squel=require(_0x636f('0x9'));var crypto=require(_0x636f('0xa'));var jsforce=require(_0x636f('0xb'));var deskjs=require(_0x636f('0xc'));var toCsv=require(_0x636f('0xd'));var querystring=require(_0x636f('0xe'));var Papa=require('papaparse');var Redis=require(_0x636f('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x636f('0x10'));var hardwareService=require(_0x636f('0x11'));var logger=require('../../config/logger')(_0x636f('0x12'));var utils=require(_0x636f('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x636f('0x14'));var db=require(_0x636f('0x15'))['db'];config['redis']=_['defaults'](config['redis'],{'host':_0x636f('0x16'),'port':0x18eb});var socket=require(_0x636f('0x17'))(new Redis(config[_0x636f('0x18')]));require(_0x636f('0x19'))[_0x636f('0x1a')](socket);function respondWithStatusCode(_0x4e5b79,_0x29433b){_0x29433b=_0x29433b||0xcc;return function(_0x5297d2){if(_0x5297d2){return _0x4e5b79[_0x636f('0x1b')](_0x29433b);}return _0x4e5b79[_0x636f('0x1c')](_0x29433b)[_0x636f('0x1d')]();};}function respondWithResult(_0x2fb846,_0x5201f4){_0x5201f4=_0x5201f4||0xc8;return function(_0x190208){if(_0x190208){return _0x2fb846[_0x636f('0x1c')](_0x5201f4)[_0x636f('0x1e')](_0x190208);}};}function respondWithFilteredResult(_0x52cb39,_0x16d460){return function(_0xc8f2fd){if(_0xc8f2fd){var _0x33730c=typeof _0x16d460['offset']===_0x636f('0x1f')&&typeof _0x16d460[_0x636f('0x20')]===_0x636f('0x1f');var _0x190a58=_0xc8f2fd[_0x636f('0x21')];var _0x235b3a=_0x33730c?0x0:_0x16d460[_0x636f('0x22')];var _0x150983=_0x33730c?_0xc8f2fd[_0x636f('0x21')]:_0x16d460[_0x636f('0x22')]+_0x16d460[_0x636f('0x20')];var _0xd25ba9;if(_0x150983>=_0x190a58){_0x150983=_0x190a58;_0xd25ba9=0xc8;}else{_0xd25ba9=0xce;}_0x52cb39[_0x636f('0x1c')](_0xd25ba9);return _0x52cb39[_0x636f('0x23')](_0x636f('0x24'),_0x235b3a+'-'+_0x150983+'/'+_0x190a58)[_0x636f('0x1e')](_0xc8f2fd);}return null;};}function patchUpdates(_0x5b9cdd){return function(_0x599c7e){try{jsonpatch['apply'](_0x599c7e,_0x5b9cdd,!![]);}catch(_0x5ee310){return BPromise[_0x636f('0x25')](_0x5ee310);}return _0x599c7e[_0x636f('0x26')]();};}function saveUpdates(_0x1f51b5,_0x5eb4cb){return function(_0x16ff4b){if(_0x16ff4b){return _0x16ff4b['update'](_0x1f51b5)['then'](function(_0x1fbbb8){return _0x1fbbb8;});}return null;};}function removeEntity(_0x49d207,_0x30dd8d){return function(_0x3b35c2){if(_0x3b35c2){return _0x3b35c2[_0x636f('0x27')]()[_0x636f('0x28')](function(){_0x49d207[_0x636f('0x1c')](0xcc)[_0x636f('0x1d')]();});}};}function handleEntityNotFound(_0x60e9bb,_0x504391){return function(_0x1a488c){if(!_0x1a488c){_0x60e9bb['sendStatus'](0x194);}return _0x1a488c;};}function handleError(_0xc930eb,_0x48a5b8){_0x48a5b8=_0x48a5b8||0x1f4;return function(_0x32fc6a){logger[_0x636f('0x29')](_0x32fc6a[_0x636f('0x2a')]);if(_0x32fc6a[_0x636f('0x2b')]){delete _0x32fc6a[_0x636f('0x2b')];}_0xc930eb['status'](_0x48a5b8)[_0x636f('0x2c')](_0x32fc6a);};}exports['index']=function(_0x169342,_0x35416e){var _0x457113={},_0x13772a={},_0x40f256={'count':0x0,'rows':[]};var _0x2d7d67=_[_0x636f('0x2d')](db[_0x636f('0x2e')][_0x636f('0x2f')],function(_0xb20b20){return{'name':_0xb20b20[_0x636f('0x30')],'type':_0xb20b20['type'][_0x636f('0x31')]};});_0x13772a[_0x636f('0x32')]=_[_0x636f('0x2d')](_0x2d7d67,'name');_0x13772a[_0x636f('0x33')]=_[_0x636f('0x34')](_0x169342[_0x636f('0x33')]);_0x13772a[_0x636f('0x35')]=_[_0x636f('0x36')](_0x13772a[_0x636f('0x32')],_0x13772a[_0x636f('0x33')]);_0x457113[_0x636f('0x37')]=_[_0x636f('0x36')](_0x13772a[_0x636f('0x32')],qs[_0x636f('0x38')](_0x169342[_0x636f('0x33')]['fields']));_0x457113['attributes']=_0x457113[_0x636f('0x37')][_0x636f('0x39')]?_0x457113[_0x636f('0x37')]:_0x13772a['model'];if(!_0x169342['query'][_0x636f('0x3a')](_0x636f('0x3b'))){_0x457113[_0x636f('0x20')]=qs[_0x636f('0x20')](_0x169342[_0x636f('0x33')][_0x636f('0x20')]);_0x457113['offset']=qs[_0x636f('0x22')](_0x169342['query'][_0x636f('0x22')]);}_0x457113['order']=qs[_0x636f('0x3c')](_0x169342[_0x636f('0x33')][_0x636f('0x3c')]);_0x457113['where']=qs[_0x636f('0x35')](_[_0x636f('0x3d')](_0x169342['query'],_0x13772a['filters']),_0x2d7d67);if(_0x169342['query']['filter']){_0x457113[_0x636f('0x3e')]=_[_0x636f('0x3f')](_0x457113[_0x636f('0x3e')],{'$or':_[_0x636f('0x2d')](_0x2d7d67,function(_0x4a0bb2){if(_0x4a0bb2['type']!==_0x636f('0x40')){var _0x2e9654={};_0x2e9654[_0x4a0bb2['name']]={'$like':'%'+_0x169342[_0x636f('0x33')][_0x636f('0x41')]+'%'};return _0x2e9654;}})});}_0x457113=_[_0x636f('0x3f')]({},_0x457113,_0x169342['options']);var _0x537c16={'where':_0x457113[_0x636f('0x3e')]};return db[_0x636f('0x2e')][_0x636f('0x21')](_0x537c16)[_0x636f('0x28')](function(_0x17d552){_0x40f256[_0x636f('0x21')]=_0x17d552;if(_0x169342[_0x636f('0x33')][_0x636f('0x42')]){_0x457113[_0x636f('0x43')]=[{'all':!![]}];}return db[_0x636f('0x2e')][_0x636f('0x44')](_0x457113);})[_0x636f('0x28')](function(_0x2a38df){_0x40f256[_0x636f('0x45')]=_0x2a38df;return _0x40f256;})[_0x636f('0x28')](respondWithFilteredResult(_0x35416e,_0x457113))[_0x636f('0x46')](handleError(_0x35416e,null));};exports['show']=function(_0x504dd4,_0xeb1b69){var _0x3bee5c={'raw':!![],'where':{'id':_0x504dd4['params']['id']}},_0x193aa8={};_0x193aa8[_0x636f('0x32')]=_[_0x636f('0x34')](db[_0x636f('0x2e')][_0x636f('0x2f')]);_0x193aa8[_0x636f('0x33')]=_[_0x636f('0x34')](_0x504dd4['query']);_0x193aa8[_0x636f('0x35')]=_['intersection'](_0x193aa8[_0x636f('0x32')],_0x193aa8[_0x636f('0x33')]);_0x3bee5c[_0x636f('0x37')]=_[_0x636f('0x36')](_0x193aa8['model'],qs['fields'](_0x504dd4['query'][_0x636f('0x38')]));_0x3bee5c[_0x636f('0x37')]=_0x3bee5c[_0x636f('0x37')][_0x636f('0x39')]?_0x3bee5c[_0x636f('0x37')]:_0x193aa8['model'];if(_0x504dd4[_0x636f('0x33')][_0x636f('0x42')]){_0x3bee5c[_0x636f('0x43')]=[{'all':!![]}];}_0x3bee5c=_[_0x636f('0x3f')]({},_0x3bee5c,_0x504dd4[_0x636f('0x47')]);return db[_0x636f('0x2e')]['find'](_0x3bee5c)[_0x636f('0x28')](handleEntityNotFound(_0xeb1b69,null))[_0x636f('0x28')](respondWithResult(_0xeb1b69,null))[_0x636f('0x46')](handleError(_0xeb1b69,null));};exports[_0x636f('0x48')]=function(_0x4ca429,_0x4b07a5){return db['ChatInternalMessage']['create'](_0x4ca429[_0x636f('0x49')],{})['then'](respondWithResult(_0x4b07a5,0xc9))[_0x636f('0x46')](handleError(_0x4b07a5,null));};exports[_0x636f('0x4a')]=function(_0x45664f,_0x542365){if(_0x45664f[_0x636f('0x49')]['id']){delete _0x45664f['body']['id'];}return db[_0x636f('0x2e')][_0x636f('0x4b')]({'where':{'id':_0x45664f['params']['id']}})[_0x636f('0x28')](handleEntityNotFound(_0x542365,null))[_0x636f('0x28')](saveUpdates(_0x45664f[_0x636f('0x49')],null))[_0x636f('0x28')](respondWithResult(_0x542365,null))['catch'](handleError(_0x542365,null));};exports['destroy']=function(_0xcf7537,_0x13e7ea){return db[_0x636f('0x2e')][_0x636f('0x4b')]({'where':{'id':_0xcf7537[_0x636f('0x4c')]['id']}})[_0x636f('0x28')](handleEntityNotFound(_0x13e7ea,null))[_0x636f('0x28')](removeEntity(_0x13e7ea,null))[_0x636f('0x46')](handleError(_0x13e7ea,null));};exports['describe']=function(_0x13fb11,_0x367649){return db[_0x636f('0x2e')][_0x636f('0x4d')]()[_0x636f('0x28')](respondWithResult(_0x367649,null))[_0x636f('0x46')](handleError(_0x367649,null));};function wrapUser(_0x4b43d5){return function(_0x3c726a){var _0x5b44ef=_0x4b43d5['get']({'plain':!![]});_0x5b44ef[_0x636f('0x4e')]=[];if(_0x3c726a){_0x5b44ef[_0x636f('0x4f')]=_0x3c726a[_0x636f('0x50')];_0x5b44ef['lastMessage']=_0x3c726a;}else{_0x5b44ef['lastMessageAt']=moment(0x0)[_0x636f('0x51')]('YYYY-MM-DD\x20HH:mm:ss');_0x5b44ef[_0x636f('0x52')]={};}return _0x5b44ef;};}exports['getUsers']=function(_0x367443,_0x5a6218,_0x51bdc7){var _0x3b7629=[];return db[_0x636f('0x53')][_0x636f('0x44')]({'where':{'role':[_0x636f('0x54'),'admin','user']},'attributes':['id','fullname',_0x636f('0x2b'),_0x636f('0x55'),_0x636f('0x56'),_0x636f('0x57'),_0x636f('0x58'),_0x636f('0x59'),'allowmessenger',_0x636f('0x5a')],'order':qs[_0x636f('0x3c')]('-online'),'include':[{'model':db[_0x636f('0x5b')],'as':_0x636f('0x5c'),'attributes':['id',_0x636f('0x2b'),_0x636f('0x5d')],'through':{'attributes':[]}}]})[_0x636f('0x28')](function(_0x392225){if(_0x392225){var _0x5f0fa5=_0x367443['user'][_0x636f('0x5e')]({'plain':!![]});if(!_0x5f0fa5)throw new Error(_0x636f('0x5f'));if(_0x5f0fa5[_0x636f('0x55')]===_0x636f('0x60')){return db[_0x636f('0x61')][_0x636f('0x4b')]({'where':{'name':'Agents','userProfileId':_0x5f0fa5[_0x636f('0x62')]},'raw':!![]})[_0x636f('0x28')](function(_0x1a7dbe){if(_0x1a7dbe){if(_0x1a7dbe[_0x636f('0x63')]===0x0){return db[_0x636f('0x64')]['findAll']({'where':{'sectionId':_0x1a7dbe['id']},'raw':!![]})[_0x636f('0x28')](function(_0x506fe0){var _0x5c6a19=[];if(_['isEmpty'](_0x506fe0)){_0x5c6a19=_[_0x636f('0x41')](_0x392225,function(_0x1b6cbc){if(_0x1b6cbc['role']!==_0x636f('0x54')){return _0x1b6cbc;}});return _0x5c6a19;}else{for(var _0x65e34=0x0;_0x65e34<_0x392225[_0x636f('0x39')];_0x65e34++){var _0x418abf=_0x392225[_0x65e34];if(_0x418abf[_0x636f('0x55')]==='agent'){var _0x1f18af=_['find'](_0x506fe0,function(_0x28c77e){return _0x28c77e[_0x636f('0x65')]===_0x418abf['id'];});if(_0x1f18af)_0x5c6a19['push'](_0x418abf);}else{_0x5c6a19[_0x636f('0x66')](_0x418abf);}}return _0x5c6a19;}});}else{return _0x392225;}}else{var _0x2d55a0=_[_0x636f('0x41')](_0x392225,function(_0x2dec9e){if(_0x2dec9e['role']!==_0x636f('0x54')){return _0x2dec9e;}});return _0x2d55a0;}});}else{return _0x392225;}}})[_0x636f('0x28')](function(_0x50b730){var _0x370879=[];if(_0x50b730){_0x3b7629=_0x50b730;for(var _0x2649a3=0x0;_0x2649a3<_0x50b730[_0x636f('0x39')];_0x2649a3+=0x1){_0x3b7629[_0x2649a3][_0x636f('0x4e')]=[];_0x370879[_0x636f('0x66')](db['ChatInternalMessage'][_0x636f('0x4b')]({'where':{'FromId':[_0x367443['user']['id'],_0x50b730[_0x2649a3]['id']],'ToId':[_0x367443['user']['id'],_0x50b730[_0x2649a3]['id']],'ChatGroupId':null},'attributes':['id',_0x636f('0x50'),_0x636f('0x67'),_0x636f('0x68'),'read',_0x636f('0x49')],'order':qs[_0x636f('0x3c')]('-createdAt'),'limit':0x1,'offset':0x0,'raw':!![]})[_0x636f('0x28')](wrapUser(_0x50b730[_0x2649a3])));}return BPromise[_0x636f('0x69')](_0x370879);}return[];})[_0x636f('0x28')](function(_0x2124d4){return{'rows':_0x2124d4,'count':_0x2124d4[_0x636f('0x39')]};})[_0x636f('0x28')](respondWithResult(_0x5a6218,null))[_0x636f('0x46')](handleError(_0x5a6218,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index c0fed80..004c80e 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 _0xb126=['hook','events','../../mysqldb','ChatInternalMessage','setMaxListeners','remove','emit'];(function(_0x1ff8d7,_0x309a3b){var _0x22afc1=function(_0x309f38){while(--_0x309f38){_0x1ff8d7['push'](_0x1ff8d7['shift']());}};_0x22afc1(++_0x309a3b);}(_0xb126,0x127));var _0x6b12=function(_0x7ff018,_0x5719a6){_0x7ff018=_0x7ff018-0x0;var _0x470172=_0xb126[_0x7ff018];return _0x470172;};'use strict';var EventEmitter=require(_0x6b12('0x0'));var ChatInternalMessage=require(_0x6b12('0x1'))['db'][_0x6b12('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0x6b12('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x6b12('0x4')};function emitEvent(_0xcecb2){return function(_0x4bae8c,_0x4e0286,_0x12fbf2){ChatInternalMessageEvents[_0x6b12('0x5')](_0xcecb2+':'+_0x4bae8c['id'],_0x4bae8c);ChatInternalMessageEvents['emit'](_0xcecb2,_0x4bae8c);_0x12fbf2(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInternalMessage[_0x6b12('0x6')](e,emitEvent(event));}}module['exports']=ChatInternalMessageEvents; \ No newline at end of file +var _0x9370=['../../mysqldb','setMaxListeners','save','update','emit','hasOwnProperty','hook','exports'];(function(_0x30c552,_0x2b82e5){var _0x19b79c=function(_0x4a8e42){while(--_0x4a8e42){_0x30c552['push'](_0x30c552['shift']());}};_0x19b79c(++_0x2b82e5);}(_0x9370,0x158));var _0x0937=function(_0x242cf7,_0x45077c){_0x242cf7=_0x242cf7-0x0;var _0x2611d6=_0x9370[_0x242cf7];return _0x2611d6;};'use strict';var EventEmitter=require('events');var ChatInternalMessage=require(_0x0937('0x0'))['db']['ChatInternalMessage'];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0x0937('0x1')](0x0);var events={'afterCreate':_0x0937('0x2'),'afterUpdate':_0x0937('0x3'),'afterDestroy':'remove'};function emitEvent(_0x18af83){return function(_0x42bcab,_0x4577cb,_0x470d2a){ChatInternalMessageEvents[_0x0937('0x4')](_0x18af83+':'+_0x42bcab['id'],_0x42bcab);ChatInternalMessageEvents[_0x0937('0x4')](_0x18af83,_0x42bcab);_0x470d2a(null);};}for(var e in events){if(events[_0x0937('0x5')](e)){var event=events[e];ChatInternalMessage[_0x0937('0x6')](e,emitEvent(event));}}module[_0x0937('0x7')]=ChatInternalMessageEvents; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.model.js b/server/api/chatInternalMessage/chatInternalMessage.model.js index fdb94e2..c924062 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 _0x35fe=['utf8mb4_unicode_ci','lodash','util','api','path','rimraf','../../config/environment','./chatInternalMessage.attributes','define','ChatInternalMessage','chat_internal_messages','utf8mb4'];(function(_0x2a36ea,_0x312d3f){var _0x248369=function(_0x15401e){while(--_0x15401e){_0x2a36ea['push'](_0x2a36ea['shift']());}};_0x248369(++_0x312d3f);}(_0x35fe,0x85));var _0xe35f=function(_0x1a36a5,_0x746928){_0x1a36a5=_0x1a36a5-0x0;var _0x746243=_0x35fe[_0x1a36a5];return _0x746243;};'use strict';var _=require(_0xe35f('0x0'));var util=require(_0xe35f('0x1'));var logger=require('../../config/logger')(_0xe35f('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xe35f('0x3'));var rimraf=require(_0xe35f('0x4'));var config=require(_0xe35f('0x5'));var attributes=require(_0xe35f('0x6'));module['exports']=function(_0x19d8c4,_0x1a5e76){return _0x19d8c4[_0xe35f('0x7')](_0xe35f('0x8'),attributes,{'tableName':_0xe35f('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xe35f('0xa'),'collate':_0xe35f('0xb')});}; \ No newline at end of file +var _0x148a=['./chatInternalMessage.attributes','exports','chat_internal_messages','utf8mb4_unicode_ci','lodash','moment','bluebird','request-promise','../../config/environment'];(function(_0x193dd8,_0x4ad6c6){var _0x2ddafe=function(_0x348691){while(--_0x348691){_0x193dd8['push'](_0x193dd8['shift']());}};_0x2ddafe(++_0x4ad6c6);}(_0x148a,0xb8));var _0xa148=function(_0x440ad1,_0x329511){_0x440ad1=_0x440ad1-0x0;var _0x32cebd=_0x148a[_0x440ad1];return _0x32cebd;};'use strict';var _=require(_0xa148('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xa148('0x1'));var BPromise=require(_0xa148('0x2'));var rp=require(_0xa148('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xa148('0x4'));var attributes=require(_0xa148('0x5'));module[_0xa148('0x6')]=function(_0x1ee966,_0x49efd3){return _0x1ee966['define']('ChatInternalMessage',attributes,{'tableName':_0xa148('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xa148('0x8')});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index dadf410..21f7ef1 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 _0x4cad=['debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','register','info','ChatInternalMessage,\x20%s,\x20%s','request\x20sent'];(function(_0x22e535,_0x2344a7){var _0x2b8eac=function(_0xcea172){while(--_0xcea172){_0x22e535['push'](_0x22e535['shift']());}};_0x2b8eac(++_0x2344a7);}(_0x4cad,0xe7));var _0xd4ca=function(_0x536aea,_0x48e27d){_0x536aea=_0x536aea-0x0;var _0x275449=_0x4cad[_0x536aea];return _0x275449;};'use strict';var _=require(_0xd4ca('0x0'));var util=require(_0xd4ca('0x1'));var moment=require(_0xd4ca('0x2'));var BPromise=require(_0xd4ca('0x3'));var rs=require(_0xd4ca('0x4'));var fs=require('fs');var Redis=require(_0xd4ca('0x5'));var db=require(_0xd4ca('0x6'))['db'];var utils=require(_0xd4ca('0x7'));var logger=require(_0xd4ca('0x8'))(_0xd4ca('0x9'));var config=require(_0xd4ca('0xa'));var jayson=require(_0xd4ca('0xb'));var client=jayson[_0xd4ca('0xc')][_0xd4ca('0xd')]({'port':0x232a});config[_0xd4ca('0xe')]=_[_0xd4ca('0xf')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xd4ca('0x10'))(new Redis(config[_0xd4ca('0xe')]));require('./chatInternalMessage.socket')[_0xd4ca('0x11')](socket);function respondWithRpcPromise(_0x47855b,_0x428f88,_0x3d5781){return new BPromise(function(_0x19abf7,_0x1e66e6){return client['request'](_0x47855b,_0x3d5781)['then'](function(_0xb8ffbf){logger[_0xd4ca('0x12')](_0xd4ca('0x13'),_0x428f88,_0xd4ca('0x14'));logger[_0xd4ca('0x15')](_0xd4ca('0x16'),_0x428f88,'request\x20sent',JSON['stringify'](_0xb8ffbf));if(_0xb8ffbf[_0xd4ca('0x17')]){if(_0xb8ffbf['error'][_0xd4ca('0x18')]===0x1f4){logger[_0xd4ca('0x17')](_0xd4ca('0x13'),_0x428f88,_0xb8ffbf[_0xd4ca('0x17')][_0xd4ca('0x19')]);return _0x1e66e6(_0xb8ffbf[_0xd4ca('0x17')][_0xd4ca('0x19')]);}logger[_0xd4ca('0x17')]('ChatInternalMessage,\x20%s,\x20%s',_0x428f88,_0xb8ffbf[_0xd4ca('0x17')][_0xd4ca('0x19')]);return _0x19abf7(_0xb8ffbf[_0xd4ca('0x17')]['message']);}else{logger['info']('ChatInternalMessage,\x20%s,\x20%s',_0x428f88,_0xd4ca('0x14'));_0x19abf7(_0xb8ffbf[_0xd4ca('0x1a')][_0xd4ca('0x19')]);}})[_0xd4ca('0x1b')](function(_0x2fd3cb){logger[_0xd4ca('0x17')](_0xd4ca('0x13'),_0x428f88,_0x2fd3cb);_0x1e66e6(_0x2fd3cb);});});} \ No newline at end of file +var _0xef1c=['ChatInternalMessage,\x20%s,\x20%s','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','redis','localhost','socket.io-emitter','register','then'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xef1c,0x176));var _0xcef1=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0xef1c[_0x160c73];return _0xd9302;};'use strict';var _=require(_0xcef1('0x0'));var util=require(_0xcef1('0x1'));var moment=require('moment');var BPromise=require(_0xcef1('0x2'));var rs=require(_0xcef1('0x3'));var fs=require('fs');var Redis=require(_0xcef1('0x4'));var db=require(_0xcef1('0x5'))['db'];var utils=require(_0xcef1('0x6'));var logger=require(_0xcef1('0x7'))('rpc');var config=require(_0xcef1('0x8'));var jayson=require(_0xcef1('0x9'));var client=jayson[_0xcef1('0xa')]['http']({'port':0x232a});config[_0xcef1('0xb')]=_['defaults'](config[_0xcef1('0xb')],{'host':_0xcef1('0xc'),'port':0x18eb});var socket=require(_0xcef1('0xd'))(new Redis(config[_0xcef1('0xb')]));require('./chatInternalMessage.socket')[_0xcef1('0xe')](socket);function respondWithRpcPromise(_0x44bc05,_0x4fe666,_0x1352f4){return new BPromise(function(_0x12b227,_0x2a450b){return client['request'](_0x44bc05,_0x1352f4)[_0xcef1('0xf')](function(_0x5316dd){logger['info'](_0xcef1('0x10'),_0x4fe666,'request\x20sent');logger[_0xcef1('0x11')](_0xcef1('0x12'),_0x4fe666,_0xcef1('0x13'),JSON['stringify'](_0x5316dd));if(_0x5316dd[_0xcef1('0x14')]){if(_0x5316dd[_0xcef1('0x14')][_0xcef1('0x15')]===0x1f4){logger['error']('ChatInternalMessage,\x20%s,\x20%s',_0x4fe666,_0x5316dd[_0xcef1('0x14')]['message']);return _0x2a450b(_0x5316dd['error'][_0xcef1('0x16')]);}logger[_0xcef1('0x14')](_0xcef1('0x10'),_0x4fe666,_0x5316dd[_0xcef1('0x14')]['message']);return _0x12b227(_0x5316dd[_0xcef1('0x14')][_0xcef1('0x16')]);}else{logger[_0xcef1('0x17')](_0xcef1('0x10'),_0x4fe666,_0xcef1('0x13'));_0x12b227(_0x5316dd[_0xcef1('0x18')][_0xcef1('0x16')]);}})[_0xcef1('0x19')](function(_0x57f94a){logger[_0xcef1('0x14')](_0xcef1('0x10'),_0x4fe666,_0x57f94a);_0x2a450b(_0x57f94a);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index dedb097..fae3e7f 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 _0x9523=['register','length','chatInternalMessage:','./chatInternalMessage.events','save','update','removeListener'];(function(_0x52c71b,_0x4d8190){var _0x12fd26=function(_0x3dd283){while(--_0x3dd283){_0x52c71b['push'](_0x52c71b['shift']());}};_0x12fd26(++_0x4d8190);}(_0x9523,0x14c));var _0x3952=function(_0x20cb27,_0x13a7f){_0x20cb27=_0x20cb27-0x0;var _0xeee669=_0x9523[_0x20cb27];return _0xeee669;};'use strict';var ChatInternalMessageEvents=require(_0x3952('0x0'));var events=[_0x3952('0x1'),'remove',_0x3952('0x2')];function createListener(_0x5f04e2,_0x4097f1){return function(_0x48c613){_0x4097f1['emit'](_0x5f04e2,_0x48c613);};}function removeListener(_0x4bcca2,_0x345b8d){return function(){ChatInternalMessageEvents[_0x3952('0x3')](_0x4bcca2,_0x345b8d);};}exports[_0x3952('0x4')]=function(_0x29e194){for(var _0x1fd6e7=0x0,_0x21847e=events[_0x3952('0x5')];_0x1fd6e7<_0x21847e;_0x1fd6e7++){var _0x4a7d40=events[_0x1fd6e7];var _0x4d77ed=createListener(_0x3952('0x6')+_0x4a7d40,_0x29e194);ChatInternalMessageEvents['on'](_0x4a7d40,_0x4d77ed);}}; \ No newline at end of file +var _0x5c31=['emit','register','chatInternalMessage:','remove'];(function(_0x1c92b9,_0x4dfa28){var _0x32e602=function(_0x25e2ff){while(--_0x25e2ff){_0x1c92b9['push'](_0x1c92b9['shift']());}};_0x32e602(++_0x4dfa28);}(_0x5c31,0x107));var _0x15c3=function(_0x5964c8,_0x3b18a8){_0x5964c8=_0x5964c8-0x0;var _0x140b2d=_0x5c31[_0x5964c8];return _0x140b2d;};'use strict';var ChatInternalMessageEvents=require('./chatInternalMessage.events');var events=['save',_0x15c3('0x0'),'update'];function createListener(_0x3f0079,_0x53116c){return function(_0x40ae25){_0x53116c[_0x15c3('0x1')](_0x3f0079,_0x40ae25);};}function removeListener(_0x5a1a85,_0xea579c){return function(){ChatInternalMessageEvents['removeListener'](_0x5a1a85,_0xea579c);};}exports[_0x15c3('0x2')]=function(_0x299879){for(var _0x38f303=0x0,_0x57cc0f=events['length'];_0x38f303<_0x57cc0f;_0x38f303++){var _0x5635c1=events[_0x38f303];var _0x34f4ef=createListener(_0x15c3('0x3')+_0x5635c1,_0x299879);ChatInternalMessageEvents['on'](_0x5635c1,_0x34f4ef);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index 4e538a2..d38ebcd 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 _0x260e=['index','/describe','describe','/users','getUsers','/:id','show','create','put','update','destroy','multer','util','connect-timeout','express','Router','../../components/interaction/service','./chatInternalMessage.controller','get','isAuthenticated'];(function(_0x57cf34,_0x2cf8c5){var _0x378b6a=function(_0x423342){while(--_0x423342){_0x57cf34['push'](_0x57cf34['shift']());}};_0x378b6a(++_0x2cf8c5);}(_0x260e,0x1d7));var _0xe260=function(_0x1b8cb0,_0x148054){_0x1b8cb0=_0x1b8cb0-0x0;var _0x5cfe5a=_0x260e[_0x1b8cb0];return _0x5cfe5a;};'use strict';var multer=require(_0xe260('0x0'));var util=require(_0xe260('0x1'));var path=require('path');var timeout=require(_0xe260('0x2'));var express=require(_0xe260('0x3'));var router=express[_0xe260('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xe260('0x5'));var config=require('../../config/environment');var controller=require(_0xe260('0x6'));router[_0xe260('0x7')]('/',auth[_0xe260('0x8')](),controller[_0xe260('0x9')]);router[_0xe260('0x7')](_0xe260('0xa'),auth['isAuthenticated'](),controller[_0xe260('0xb')]);router[_0xe260('0x7')](_0xe260('0xc'),auth[_0xe260('0x8')](),controller[_0xe260('0xd')]);router[_0xe260('0x7')](_0xe260('0xe'),auth['isAuthenticated'](),controller[_0xe260('0xf')]);router['post']('/',auth[_0xe260('0x8')](),controller[_0xe260('0x10')]);router[_0xe260('0x11')](_0xe260('0xe'),controller[_0xe260('0x12')]);router['delete'](_0xe260('0xe'),auth[_0xe260('0x8')](),controller[_0xe260('0x13')]);module['exports']=router; \ No newline at end of file +var _0x0143=['util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInternalMessage.controller','get','index','/describe','isAuthenticated','describe','/users','getUsers','/:id','show','post','create','put','update','multer'];(function(_0x45c8e3,_0x4c2b9f){var _0x5068b3=function(_0x3e1c72){while(--_0x3e1c72){_0x45c8e3['push'](_0x45c8e3['shift']());}};_0x5068b3(++_0x4c2b9f);}(_0x0143,0x113));var _0x3014=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x0143[_0x5b644e];return _0x49c6bf;};'use strict';var multer=require(_0x3014('0x0'));var util=require(_0x3014('0x1'));var path=require(_0x3014('0x2'));var timeout=require('connect-timeout');var express=require(_0x3014('0x3'));var router=express[_0x3014('0x4')]();var fs_extra=require(_0x3014('0x5'));var auth=require(_0x3014('0x6'));var interaction=require(_0x3014('0x7'));var config=require(_0x3014('0x8'));var controller=require(_0x3014('0x9'));router[_0x3014('0xa')]('/',auth['isAuthenticated'](),controller[_0x3014('0xb')]);router['get'](_0x3014('0xc'),auth[_0x3014('0xd')](),controller[_0x3014('0xe')]);router[_0x3014('0xa')](_0x3014('0xf'),auth[_0x3014('0xd')](),controller[_0x3014('0x10')]);router['get'](_0x3014('0x11'),auth[_0x3014('0xd')](),controller[_0x3014('0x12')]);router[_0x3014('0x13')]('/',auth[_0x3014('0xd')](),controller[_0x3014('0x14')]);router[_0x3014('0x15')](_0x3014('0x11'),controller[_0x3014('0x16')]);router['delete'](_0x3014('0x11'),auth[_0x3014('0xd')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.attributes.js b/server/api/chatMessage/chatMessage.attributes.js index 56e7bc1..b4f311d 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 _0xd0e4=['out','DATE','STRING','sequelize','exports','TEXT','medium','ENUM'];(function(_0x3e36be,_0xf8506){var _0x107cbe=function(_0x3cab73){while(--_0x3cab73){_0x3e36be['push'](_0x3e36be['shift']());}};_0x107cbe(++_0xf8506);}(_0xd0e4,0x1d3));var _0x4d0e=function(_0x52017c,_0x393604){_0x52017c=_0x52017c-0x0;var _0xada67d=_0xd0e4[_0x52017c];return _0xada67d;};'use strict';var Sequelize=require(_0x4d0e('0x0'));module[_0x4d0e('0x1')]={'body':{'type':Sequelize[_0x4d0e('0x2')](_0x4d0e('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x4d0e('0x4')]('in',_0x4d0e('0x5')),'defaultValue':_0x4d0e('0x5'),'allowNull':![]},'readAt':{'type':Sequelize[_0x4d0e('0x6')]},'providerName':{'type':Sequelize[_0x4d0e('0x7')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x4213=['exports','TEXT','medium','BOOLEAN','ENUM','out','STRING','sequelize'];(function(_0x3ccd28,_0x4f37fc){var _0x50548c=function(_0x422f25){while(--_0x422f25){_0x3ccd28['push'](_0x3ccd28['shift']());}};_0x50548c(++_0x4f37fc);}(_0x4213,0x77));var _0x3421=function(_0x5a660a,_0x3a388f){_0x5a660a=_0x5a660a-0x0;var _0x53a90b=_0x4213[_0x5a660a];return _0x53a90b;};'use strict';var Sequelize=require(_0x3421('0x0'));module[_0x3421('0x1')]={'body':{'type':Sequelize[_0x3421('0x2')](_0x3421('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x3421('0x4')],'defaultValue':![]},'secret':{'type':Sequelize[_0x3421('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x3421('0x5')]('in','out'),'defaultValue':_0x3421('0x6'),'allowNull':![]},'readAt':{'type':Sequelize['DATE']},'providerName':{'type':Sequelize[_0x3421('0x7')]},'providerResponse':{'type':Sequelize[_0x3421('0x2')]}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index 9427827..0758d70 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 _0x7e74=['includeAll','include','findAll','rows','show','params','keys','find','create','body','describe','chat-interactions','accept','chat','read','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','ChatInteraction','ChatInteractionId','read1stAt','interaction','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','ContactId','Sequelize','QueryTypes','SELECT','contact','fullname','internal','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','parse','formData','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','email','rejectmessage','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','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','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatMessage.socket','jayson/promise','client','http','request','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','update','destroy','end','stack','name','send','index','map','ChatMessage','rawAttributes','fieldName','type','key','model','filters','intersection','query','attributes','fields','length','hasOwnProperty','order','sort','where','pick','VIRTUAL','filter','merge','options'];(function(_0xee76bb,_0x583e9b){var _0x35a5c1=function(_0x3f516b){while(--_0x3f516b){_0xee76bb['push'](_0xee76bb['shift']());}};_0x35a5c1(++_0x583e9b);}(_0x7e74,0xbd));var _0x47e7=function(_0x5d1ca7,_0x40be3c){_0x5d1ca7=_0x5d1ca7-0x0;var _0x1448f6=_0x7e74[_0x5d1ca7];return _0x1448f6;};'use strict';var emlformat=require(_0x47e7('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x47e7('0x1'));var jsonpatch=require(_0x47e7('0x2'));var rp=require(_0x47e7('0x3'));var moment=require(_0x47e7('0x4'));var BPromise=require(_0x47e7('0x5'));var Mustache=require('mustache');var util=require(_0x47e7('0x6'));var path=require(_0x47e7('0x7'));var sox=require(_0x47e7('0x8'));var csv=require(_0x47e7('0x9'));var ejs=require(_0x47e7('0xa'));var fs=require('fs');var fs_extra=require(_0x47e7('0xb'));var _=require(_0x47e7('0xc'));var squel=require('squel');var crypto=require(_0x47e7('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x47e7('0xe'));var toCsv=require(_0x47e7('0x9'));var querystring=require(_0x47e7('0xf'));var Papa=require(_0x47e7('0x10'));var Redis=require(_0x47e7('0x11'));var authService=require(_0x47e7('0x12'));var qs=require(_0x47e7('0x13'));var as=require(_0x47e7('0x14'));var hardwareService=require(_0x47e7('0x15'));var logger=require(_0x47e7('0x16'))(_0x47e7('0x17'));var utils=require(_0x47e7('0x18'));var config=require(_0x47e7('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x47e7('0x1a'))['db'];config[_0x47e7('0x1b')]=_[_0x47e7('0x1c')](config['redis'],{'host':_0x47e7('0x1d'),'port':0x18eb});var socket=require(_0x47e7('0x1e'))(new Redis(config[_0x47e7('0x1b')]));require(_0x47e7('0x1f'))['register'](socket);var jayson=require(_0x47e7('0x20'));var client=jayson[_0x47e7('0x21')][_0x47e7('0x22')]({'port':0x232c});var client9002=jayson[_0x47e7('0x21')][_0x47e7('0x22')]({'port':0x232a});function respondWithRpcPromise(_0x5369d4,_0x2e2aeb,_0x5d4801,_0x402ccc){return new BPromise(function(_0x8c320e,_0x14b43f){var _0x433705=_0x402ccc||client;return _0x433705[_0x47e7('0x23')](_0x5369d4,_0x5d4801)[_0x47e7('0x24')](function(_0x6a3682){logger[_0x47e7('0x25')](_0x47e7('0x26'),_0x2e2aeb,_0x47e7('0x27'));logger[_0x47e7('0x28')](_0x47e7('0x29'),_0x2e2aeb,_0x47e7('0x27'),JSON[_0x47e7('0x2a')](_0x6a3682));if(_0x6a3682['error']){if(_0x6a3682['error']['code']===0x1f4){logger['error'](_0x47e7('0x26'),_0x2e2aeb,_0x6a3682[_0x47e7('0x2b')][_0x47e7('0x2c')]);return _0x14b43f(_0x6a3682[_0x47e7('0x2b')]['message']);}logger['error'](_0x47e7('0x26'),_0x2e2aeb,_0x6a3682['error'][_0x47e7('0x2c')]);return _0x8c320e(_0x6a3682['error'][_0x47e7('0x2c')]);}else{logger[_0x47e7('0x25')](_0x47e7('0x26'),_0x2e2aeb,_0x47e7('0x27'));_0x8c320e(_0x6a3682['result']['message']);}})[_0x47e7('0x2d')](function(_0x25c0ca){logger[_0x47e7('0x2b')](_0x47e7('0x26'),_0x2e2aeb,_0x25c0ca);_0x14b43f(_0x25c0ca);});});}function respondWithStatusCode(_0x5b6736,_0x43fa51){_0x43fa51=_0x43fa51||0xcc;return function(_0x105add){if(_0x105add){return _0x5b6736[_0x47e7('0x2e')](_0x43fa51);}return _0x5b6736[_0x47e7('0x2f')](_0x43fa51)['end']();};}function respondWithResult(_0x2fb377,_0x1bdb4c){_0x1bdb4c=_0x1bdb4c||0xc8;return function(_0x301a68){if(_0x301a68){return _0x2fb377[_0x47e7('0x2f')](_0x1bdb4c)[_0x47e7('0x30')](_0x301a68);}};}function respondWithFilteredResult(_0x303ff6,_0x150c8b){return function(_0x55866e){if(_0x55866e){var _0x172c80=typeof _0x150c8b[_0x47e7('0x31')]===_0x47e7('0x32')&&typeof _0x150c8b[_0x47e7('0x33')]===_0x47e7('0x32');var _0x247515=_0x55866e['count'];var _0x2bc66d=_0x172c80?0x0:_0x150c8b[_0x47e7('0x31')];var _0x4078bd=_0x172c80?_0x55866e[_0x47e7('0x34')]:_0x150c8b[_0x47e7('0x31')]+_0x150c8b['limit'];var _0x47662b;if(_0x4078bd>=_0x247515){_0x4078bd=_0x247515;_0x47662b=0xc8;}else{_0x47662b=0xce;}_0x303ff6[_0x47e7('0x2f')](_0x47662b);return _0x303ff6[_0x47e7('0x35')](_0x47e7('0x36'),_0x2bc66d+'-'+_0x4078bd+'/'+_0x247515)[_0x47e7('0x30')](_0x55866e);}return null;};}function patchUpdates(_0x24f833){return function(_0x437b89){try{jsonpatch['apply'](_0x437b89,_0x24f833,!![]);}catch(_0x5dfae3){return BPromise[_0x47e7('0x37')](_0x5dfae3);}return _0x437b89['save']();};}function saveUpdates(_0x2d73c8,_0x6be695){return function(_0x5667fe){if(_0x5667fe){return _0x5667fe[_0x47e7('0x38')](_0x2d73c8)[_0x47e7('0x24')](function(_0x1f80e0){return _0x1f80e0;});}return null;};}function removeEntity(_0x526ad1,_0x58657f){return function(_0x2ad26d){if(_0x2ad26d){return _0x2ad26d[_0x47e7('0x39')]()['then'](function(){_0x526ad1[_0x47e7('0x2f')](0xcc)[_0x47e7('0x3a')]();});}};}function handleEntityNotFound(_0x3af095,_0x54542a){return function(_0x1fc445){if(!_0x1fc445){_0x3af095['sendStatus'](0x194);}return _0x1fc445;};}function handleError(_0x442081,_0x33c4f6){_0x33c4f6=_0x33c4f6||0x1f4;return function(_0x182cb9){logger['error'](_0x182cb9[_0x47e7('0x3b')]);if(_0x182cb9[_0x47e7('0x3c')]){delete _0x182cb9[_0x47e7('0x3c')];}_0x442081[_0x47e7('0x2f')](_0x33c4f6)[_0x47e7('0x3d')](_0x182cb9);};}exports[_0x47e7('0x3e')]=function(_0x4a551a,_0x5621ed){var _0x2b4994={},_0x4dabbb={},_0x16f2dd={'count':0x0,'rows':[]};var _0x3eb435=_[_0x47e7('0x3f')](db[_0x47e7('0x40')][_0x47e7('0x41')],function(_0x127bdc){return{'name':_0x127bdc[_0x47e7('0x42')],'type':_0x127bdc[_0x47e7('0x43')][_0x47e7('0x44')]};});_0x4dabbb[_0x47e7('0x45')]=_['map'](_0x3eb435,_0x47e7('0x3c'));_0x4dabbb['query']=_['keys'](_0x4a551a['query']);_0x4dabbb[_0x47e7('0x46')]=_[_0x47e7('0x47')](_0x4dabbb['model'],_0x4dabbb[_0x47e7('0x48')]);_0x2b4994[_0x47e7('0x49')]=_[_0x47e7('0x47')](_0x4dabbb[_0x47e7('0x45')],qs[_0x47e7('0x4a')](_0x4a551a['query'][_0x47e7('0x4a')]));_0x2b4994['attributes']=_0x2b4994[_0x47e7('0x49')][_0x47e7('0x4b')]?_0x2b4994[_0x47e7('0x49')]:_0x4dabbb['model'];if(!_0x4a551a[_0x47e7('0x48')][_0x47e7('0x4c')]('nolimit')){_0x2b4994['limit']=qs[_0x47e7('0x33')](_0x4a551a[_0x47e7('0x48')][_0x47e7('0x33')]);_0x2b4994['offset']=qs[_0x47e7('0x31')](_0x4a551a[_0x47e7('0x48')][_0x47e7('0x31')]);}_0x2b4994[_0x47e7('0x4d')]=qs[_0x47e7('0x4e')](_0x4a551a[_0x47e7('0x48')][_0x47e7('0x4e')]);_0x2b4994[_0x47e7('0x4f')]=qs[_0x47e7('0x46')](_[_0x47e7('0x50')](_0x4a551a[_0x47e7('0x48')],_0x4dabbb['filters']),_0x3eb435);if(_0x4a551a[_0x47e7('0x48')]['filter']){_0x2b4994[_0x47e7('0x4f')]=_['merge'](_0x2b4994[_0x47e7('0x4f')],{'$or':_['map'](_0x3eb435,function(_0x515665){if(_0x515665[_0x47e7('0x43')]!==_0x47e7('0x51')){var _0x594509={};_0x594509[_0x515665[_0x47e7('0x3c')]]={'$like':'%'+_0x4a551a[_0x47e7('0x48')][_0x47e7('0x52')]+'%'};return _0x594509;}})});}_0x2b4994=_[_0x47e7('0x53')]({},_0x2b4994,_0x4a551a[_0x47e7('0x54')]);var _0x8f2e5b={'where':_0x2b4994[_0x47e7('0x4f')]};return db[_0x47e7('0x40')][_0x47e7('0x34')](_0x8f2e5b)['then'](function(_0x18449a){_0x16f2dd['count']=_0x18449a;if(_0x4a551a['query'][_0x47e7('0x55')]){_0x2b4994[_0x47e7('0x56')]=[{'all':!![]}];}return db[_0x47e7('0x40')][_0x47e7('0x57')](_0x2b4994);})['then'](function(_0x59cc9a){_0x16f2dd[_0x47e7('0x58')]=_0x59cc9a;return _0x16f2dd;})[_0x47e7('0x24')](respondWithFilteredResult(_0x5621ed,_0x2b4994))[_0x47e7('0x2d')](handleError(_0x5621ed,null));};exports[_0x47e7('0x59')]=function(_0x5d0ad6,_0x926bc4){var _0x4db135={'raw':!![],'where':{'id':_0x5d0ad6[_0x47e7('0x5a')]['id']}},_0x5611fd={};_0x5611fd['model']=_[_0x47e7('0x5b')](db[_0x47e7('0x40')][_0x47e7('0x41')]);_0x5611fd[_0x47e7('0x48')]=_[_0x47e7('0x5b')](_0x5d0ad6[_0x47e7('0x48')]);_0x5611fd[_0x47e7('0x46')]=_[_0x47e7('0x47')](_0x5611fd[_0x47e7('0x45')],_0x5611fd[_0x47e7('0x48')]);_0x4db135[_0x47e7('0x49')]=_[_0x47e7('0x47')](_0x5611fd['model'],qs[_0x47e7('0x4a')](_0x5d0ad6['query'][_0x47e7('0x4a')]));_0x4db135[_0x47e7('0x49')]=_0x4db135[_0x47e7('0x49')][_0x47e7('0x4b')]?_0x4db135[_0x47e7('0x49')]:_0x5611fd[_0x47e7('0x45')];if(_0x5d0ad6[_0x47e7('0x48')][_0x47e7('0x55')]){_0x4db135[_0x47e7('0x56')]=[{'all':!![]}];}_0x4db135=_[_0x47e7('0x53')]({},_0x4db135,_0x5d0ad6[_0x47e7('0x54')]);return db[_0x47e7('0x40')][_0x47e7('0x5c')](_0x4db135)[_0x47e7('0x24')](handleEntityNotFound(_0x926bc4,null))[_0x47e7('0x24')](respondWithResult(_0x926bc4,null))['catch'](handleError(_0x926bc4,null));};exports['create']=function(_0x393a7e,_0x342ae3){return db['ChatMessage'][_0x47e7('0x5d')](_0x393a7e[_0x47e7('0x5e')],{})[_0x47e7('0x24')](respondWithResult(_0x342ae3,0xc9))['catch'](handleError(_0x342ae3,null));};exports[_0x47e7('0x38')]=function(_0x47d3fb,_0x4200c2){if(_0x47d3fb[_0x47e7('0x5e')]['id']){delete _0x47d3fb['body']['id'];}return db[_0x47e7('0x40')][_0x47e7('0x5c')]({'where':{'id':_0x47d3fb[_0x47e7('0x5a')]['id']}})[_0x47e7('0x24')](handleEntityNotFound(_0x4200c2,null))[_0x47e7('0x24')](saveUpdates(_0x47d3fb[_0x47e7('0x5e')],null))[_0x47e7('0x24')](respondWithResult(_0x4200c2,null))['catch'](handleError(_0x4200c2,null));};exports[_0x47e7('0x39')]=function(_0x12868c,_0x2da89c){return db[_0x47e7('0x40')]['find']({'where':{'id':_0x12868c[_0x47e7('0x5a')]['id']}})['then'](handleEntityNotFound(_0x2da89c,null))[_0x47e7('0x24')](removeEntity(_0x2da89c,null))['catch'](handleError(_0x2da89c,null));};exports[_0x47e7('0x5f')]=function(_0x5a953a,_0x192f8f){return db[_0x47e7('0x40')][_0x47e7('0x5f')]()[_0x47e7('0x24')](respondWithResult(_0x192f8f,null))[_0x47e7('0x2d')](handleError(_0x192f8f,null));};var interaction_log=require(_0x47e7('0x16'))(_0x47e7('0x60'));exports[_0x47e7('0x61')]=function(_0xb92a0b,_0x5c8213,_0x4f7aba){var _0x3788b8={'agent':{},'channel':_0x47e7('0x62')};if(_0xb92a0b['body']['id']){delete _0xb92a0b[_0x47e7('0x5e')]['id'];}_0xb92a0b[_0x47e7('0x5e')][_0x47e7('0x63')]=!![];_0xb92a0b[_0x47e7('0x5e')]['readAt']=moment()[_0x47e7('0x64')](_0x47e7('0x65'));_0xb92a0b[_0x47e7('0x5e')][_0x47e7('0x66')]=_0xb92a0b[_0x47e7('0x5e')][_0x47e7('0x66')]||_0xb92a0b[_0x47e7('0x67')]['id'];_0x3788b8[_0x47e7('0x68')]['id']=_0xb92a0b[_0x47e7('0x5e')]['UserId'];return db[_0x47e7('0x40')][_0x47e7('0x5c')]({'where':{'id':_0xb92a0b[_0x47e7('0x5a')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x5c8213,null))[_0x47e7('0x24')](saveUpdates(_0xb92a0b[_0x47e7('0x5e')],null))['then'](function(_0x52de0c){if(_0x52de0c){_0x3788b8[_0x47e7('0x2c')]=_0x52de0c[_0x47e7('0x69')]({'plain':!![]});return db[_0x47e7('0x6a')][_0x47e7('0x5c')]({'where':{'id':_0x52de0c[_0x47e7('0x6b')]}});}return null;})[_0x47e7('0x24')](handleEntityNotFound(_0x5c8213,null))['then'](function(_0x50df62){if(_0x50df62){return _0x50df62[_0x47e7('0x38')]({'UserId':_0xb92a0b[_0x47e7('0x5e')]['UserId'],'read1stAt':_['isNil'](_0x50df62[_0x47e7('0x6c')])?moment()[_0x47e7('0x64')](_0x47e7('0x65')):undefined});}return null;})['then'](function(_0x8c3fa6){if(_0x8c3fa6){_0x3788b8[_0x47e7('0x6d')]=_0x8c3fa6[_0x47e7('0x69')]({'plain':!![]});interaction_log['info'](_0x47e7('0x6e'),_0xb92a0b[_0x47e7('0x67')]['id'],_0xb92a0b[_0x47e7('0x67')][_0x47e7('0x3c')],_0xb92a0b[_0x47e7('0x67')]['role'],_0x3788b8[_0x47e7('0x6d')]['id'],_0xb92a0b['body']?JSON[_0x47e7('0x2a')](_0xb92a0b[_0x47e7('0x5e')]):_0x47e7('0x6f'));return respondWithRpcPromise('AcceptMessage','acceptMessage',_0x3788b8);}return null;})[_0x47e7('0x24')](function(_0x5ac619){var _0x5a33b2='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x5ac619['message'][_0x47e7('0x70')];return db['sequelize']['query'](_0x5a33b2,{'type':db[_0x47e7('0x71')][_0x47e7('0x72')][_0x47e7('0x73')],'raw':!![]})[_0x47e7('0x24')](function(_0x1e3cdb){return _0x1e3cdb;});})[_0x47e7('0x24')](function(_0x43ca43){if(_0x43ca43){_0x3788b8[_0x47e7('0x2c')][_0x47e7('0x74')]=_0x43ca43[0x0];if(!_0xb92a0b[_0x47e7('0x5e')][_0x47e7('0x66')])return;return db['User'][_0x47e7('0x5c')]({'where':{'id':_0xb92a0b[_0x47e7('0x5e')][_0x47e7('0x66')],'role':_0x47e7('0x68')},'attributes':['id',_0x47e7('0x3c'),_0x47e7('0x75'),'email',_0x47e7('0x76')],'raw':!![]});}return null;})[_0x47e7('0x24')](function(_0x5a5cfd){if(!_0x5a5cfd)return null;_0x3788b8[_0x47e7('0x2c')]['agent']=_0x5a5cfd;return _0x3788b8;})[_0x47e7('0x24')](function(_0x421efb){if(_0x421efb){if(_0xb92a0b[_0x47e7('0x5e')][_0x47e7('0x77')]){_0x3788b8['message'][_0x47e7('0x78')]=util[_0x47e7('0x64')](_0x47e7('0x79'),_0xb92a0b['user']['name']);_0x3788b8[_0x47e7('0x2c')]['channel']=_0x3788b8[_0x47e7('0x7a')];_0x3788b8[_0x47e7('0x2c')][_0x47e7('0x7b')]=_0x3788b8[_0x47e7('0x7a')];_0x3788b8['message'][_0x47e7('0x7c')]=_0x47e7('0x61');return respondWithRpcPromise(_0x47e7('0x7d'),_0x47e7('0x7d'),{'event':_0x47e7('0x7e'),'message':_[_0x47e7('0x53')](_0x3788b8[_0x47e7('0x2c')],JSON[_0x47e7('0x7f')](_0x3788b8['interaction'][_0x47e7('0x80')]))},client9002)[_0x47e7('0x24')](function(){return _0x3788b8;});}return _0x3788b8;}return null;})[_0x47e7('0x24')](respondWithResult(_0x5c8213,null))[_0x47e7('0x2d')](handleError(_0x5c8213,null));};var interaction_log=require(_0x47e7('0x16'))('chat-interactions');exports['reject']=function(_0x347ba9,_0x4916e1,_0x1ceed6){var _0x454d8c={'agent':{},'channel':_0x47e7('0x62')};if(_0x347ba9['body']['id']){delete _0x347ba9['body']['id'];}_0x347ba9[_0x47e7('0x5e')]['UserId']=_0x347ba9[_0x47e7('0x5e')][_0x47e7('0x66')]||_0x347ba9[_0x47e7('0x67')]['id'];_0x454d8c[_0x47e7('0x68')]['id']=_0x347ba9[_0x47e7('0x5e')][_0x47e7('0x66')];return db['ChatMessage'][_0x47e7('0x5c')]({'where':{'id':_0x347ba9[_0x47e7('0x5a')]['id'],'UserId':null}})[_0x47e7('0x24')](handleEntityNotFound(_0x4916e1,null))['then'](function(_0x3cba0d){if(_0x3cba0d){_0x454d8c['message']=_0x3cba0d[_0x47e7('0x69')]({'plain':!![]});return db[_0x47e7('0x6a')][_0x47e7('0x5c')]({'where':{'id':_0x3cba0d[_0x47e7('0x6b')]}});}return null;})[_0x47e7('0x24')](handleEntityNotFound(_0x4916e1,null))[_0x47e7('0x24')](function(_0x3d9f17){if(_0x3d9f17){_0x454d8c[_0x47e7('0x6d')]=_0x3d9f17['get']({'plain':!![]});interaction_log[_0x47e7('0x25')](_0x47e7('0x81'),_0x347ba9['user']['id'],_0x347ba9[_0x47e7('0x67')][_0x47e7('0x3c')],_0x347ba9['user'][_0x47e7('0x82')],_0x454d8c['interaction']['id'],_0x347ba9[_0x47e7('0x5e')]?JSON['stringify'](_0x347ba9[_0x47e7('0x5e')]):'null');return respondWithRpcPromise(_0x47e7('0x83'),_0x47e7('0x84'),_0x454d8c);}return null;})[_0x47e7('0x24')](function(_0x417da2){var _0x6f88fa=_0x47e7('0x85')+_0x417da2[_0x47e7('0x2c')][_0x47e7('0x70')];return db[_0x47e7('0x86')][_0x47e7('0x48')](_0x6f88fa,{'type':db[_0x47e7('0x71')][_0x47e7('0x72')][_0x47e7('0x73')],'raw':!![]})['then'](function(_0x58b318){return _0x58b318;});})[_0x47e7('0x24')](function(_0xd25b68){if(_0xd25b68){_0x454d8c[_0x47e7('0x2c')]['contact']=_0xd25b68[0x0];if(!_0x347ba9[_0x47e7('0x5e')]['UserId'])return;return db['User']['find']({'where':{'id':_0x347ba9['body'][_0x47e7('0x66')],'role':'agent'},'attributes':['id','name',_0x47e7('0x75'),_0x47e7('0x87'),'internal'],'raw':!![]});}return null;})[_0x47e7('0x24')](function(_0x149fe0){if(!_0x149fe0)return null;_0x454d8c[_0x47e7('0x2c')][_0x47e7('0x68')]=_0x149fe0;return _0x454d8c;})[_0x47e7('0x24')](function(_0x47b71d){if(_0x47b71d){_0x47b71d['message'][_0x47e7('0x78')]=util[_0x47e7('0x64')](_0x47e7('0x79'),_0x347ba9['user'][_0x47e7('0x3c')]);_0x47b71d[_0x47e7('0x2c')][_0x47e7('0x7a')]=_0x454d8c[_0x47e7('0x7a')];_0x47b71d[_0x47e7('0x2c')][_0x47e7('0x7b')]=_0x454d8c[_0x47e7('0x7a')];_0x47b71d[_0x47e7('0x2c')][_0x47e7('0x7c')]='reject';respondWithRpcPromise(_0x47e7('0x7d'),_0x47e7('0x7d'),{'event':_0x47e7('0x88'),'message':_[_0x47e7('0x53')](_0x454d8c[_0x47e7('0x2c')],JSON['parse'](_0x454d8c[_0x47e7('0x6d')]['formData']))},client9002);return _0x454d8c;}return null;})[_0x47e7('0x24')](respondWithResult(_0x4916e1,null))[_0x47e7('0x2d')](handleError(_0x4916e1,null));}; \ No newline at end of file +var _0x89a7=['stack','name','send','ChatMessage','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','options','includeAll','findAll','show','params','create','body','update','find','describe','chat','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','ChatInteraction','isNil','read1stAt','interaction','get','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','Sequelize','QueryTypes','SELECT','contact','User','email','internal','interface','SIP/%s','channel','motionChannel','event','accept','EventManager','acceptmessage','formData','chat-interactions','ChatInteractionId','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','ContactId','sequelize','parse','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','desk.js','to-csv','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./chatMessage.socket','register','client','http','request','then','info','ChatMessage,\x20%s,\x20%s','debug','ChatMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','catch','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','destroy','end'];(function(_0x3074f3,_0x4f2c03){var _0x53f112=function(_0x4a17af){while(--_0x4a17af){_0x3074f3['push'](_0x3074f3['shift']());}};_0x53f112(++_0x4f2c03);}(_0x89a7,0x1ea));var _0x789a=function(_0x35dbd1,_0x5d53b8){_0x35dbd1=_0x35dbd1-0x0;var _0x5ebe70=_0x89a7[_0x35dbd1];return _0x5ebe70;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x789a('0x0'));var zipdir=require(_0x789a('0x1'));var jsonpatch=require(_0x789a('0x2'));var rp=require(_0x789a('0x3'));var moment=require(_0x789a('0x4'));var BPromise=require(_0x789a('0x5'));var Mustache=require(_0x789a('0x6'));var util=require(_0x789a('0x7'));var path=require(_0x789a('0x8'));var sox=require(_0x789a('0x9'));var csv=require('to-csv');var ejs=require(_0x789a('0xa'));var fs=require('fs');var fs_extra=require(_0x789a('0xb'));var _=require(_0x789a('0xc'));var squel=require(_0x789a('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x789a('0xe'));var toCsv=require(_0x789a('0xf'));var querystring=require(_0x789a('0x10'));var Papa=require('papaparse');var Redis=require(_0x789a('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x789a('0x12'));var as=require(_0x789a('0x13'));var hardwareService=require(_0x789a('0x14'));var logger=require(_0x789a('0x15'))(_0x789a('0x16'));var utils=require(_0x789a('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x789a('0x18'));var db=require('../../mysqldb')['db'];config[_0x789a('0x19')]=_[_0x789a('0x1a')](config['redis'],{'host':_0x789a('0x1b'),'port':0x18eb});var socket=require(_0x789a('0x1c'))(new Redis(config[_0x789a('0x19')]));require(_0x789a('0x1d'))[_0x789a('0x1e')](socket);var jayson=require('jayson/promise');var client=jayson[_0x789a('0x1f')][_0x789a('0x20')]({'port':0x232c});var client9002=jayson[_0x789a('0x1f')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4622b0,_0x8bd795,_0xf6e08,_0xdb29e1){return new BPromise(function(_0x5565e6,_0x2e50c0){var _0x163a41=_0xdb29e1||client;return _0x163a41[_0x789a('0x21')](_0x4622b0,_0xf6e08)[_0x789a('0x22')](function(_0x47e981){logger[_0x789a('0x23')](_0x789a('0x24'),_0x8bd795,'request\x20sent');logger[_0x789a('0x25')](_0x789a('0x26'),_0x8bd795,_0x789a('0x27'),JSON['stringify'](_0x47e981));if(_0x47e981[_0x789a('0x28')]){if(_0x47e981[_0x789a('0x28')]['code']===0x1f4){logger[_0x789a('0x28')](_0x789a('0x24'),_0x8bd795,_0x47e981[_0x789a('0x28')]['message']);return _0x2e50c0(_0x47e981['error']['message']);}logger[_0x789a('0x28')](_0x789a('0x24'),_0x8bd795,_0x47e981[_0x789a('0x28')][_0x789a('0x29')]);return _0x5565e6(_0x47e981[_0x789a('0x28')][_0x789a('0x29')]);}else{logger[_0x789a('0x23')](_0x789a('0x24'),_0x8bd795,_0x789a('0x27'));_0x5565e6(_0x47e981[_0x789a('0x2a')]['message']);}})[_0x789a('0x2b')](function(_0x6046bf){logger[_0x789a('0x28')](_0x789a('0x24'),_0x8bd795,_0x6046bf);_0x2e50c0(_0x6046bf);});});}function respondWithStatusCode(_0x170205,_0x477431){_0x477431=_0x477431||0xcc;return function(_0x59e174){if(_0x59e174){return _0x170205[_0x789a('0x2c')](_0x477431);}return _0x170205['status'](_0x477431)['end']();};}function respondWithResult(_0x94113f,_0x507acc){_0x507acc=_0x507acc||0xc8;return function(_0x11fa40){if(_0x11fa40){return _0x94113f[_0x789a('0x2d')](_0x507acc)[_0x789a('0x2e')](_0x11fa40);}};}function respondWithFilteredResult(_0x8268d8,_0x13fa67){return function(_0x162ae3){if(_0x162ae3){var _0x3bd461=typeof _0x13fa67[_0x789a('0x2f')]===_0x789a('0x30')&&typeof _0x13fa67[_0x789a('0x31')]===_0x789a('0x30');var _0x4ae3fc=_0x162ae3['count'];var _0xe77aff=_0x3bd461?0x0:_0x13fa67[_0x789a('0x2f')];var _0x56bbfd=_0x3bd461?_0x162ae3[_0x789a('0x32')]:_0x13fa67[_0x789a('0x2f')]+_0x13fa67[_0x789a('0x31')];var _0x577c77;if(_0x56bbfd>=_0x4ae3fc){_0x56bbfd=_0x4ae3fc;_0x577c77=0xc8;}else{_0x577c77=0xce;}_0x8268d8['status'](_0x577c77);return _0x8268d8[_0x789a('0x33')](_0x789a('0x34'),_0xe77aff+'-'+_0x56bbfd+'/'+_0x4ae3fc)['json'](_0x162ae3);}return null;};}function patchUpdates(_0x2401d4){return function(_0x297201){try{jsonpatch[_0x789a('0x35')](_0x297201,_0x2401d4,!![]);}catch(_0x1445c1){return BPromise[_0x789a('0x36')](_0x1445c1);}return _0x297201[_0x789a('0x37')]();};}function saveUpdates(_0x3a2f72,_0x234d83){return function(_0xacbadc){if(_0xacbadc){return _0xacbadc['update'](_0x3a2f72)[_0x789a('0x22')](function(_0x3c6f69){return _0x3c6f69;});}return null;};}function removeEntity(_0x322b0d,_0x457fb0){return function(_0x2893fa){if(_0x2893fa){return _0x2893fa[_0x789a('0x38')]()['then'](function(){_0x322b0d['status'](0xcc)[_0x789a('0x39')]();});}};}function handleEntityNotFound(_0x1eed3e,_0x418b44){return function(_0x316b92){if(!_0x316b92){_0x1eed3e['sendStatus'](0x194);}return _0x316b92;};}function handleError(_0x216f17,_0x5b840f){_0x5b840f=_0x5b840f||0x1f4;return function(_0x3a26b2){logger[_0x789a('0x28')](_0x3a26b2[_0x789a('0x3a')]);if(_0x3a26b2[_0x789a('0x3b')]){delete _0x3a26b2['name'];}_0x216f17[_0x789a('0x2d')](_0x5b840f)[_0x789a('0x3c')](_0x3a26b2);};}exports['index']=function(_0x355b9b,_0x4ab5d3){var _0x153e8d={},_0x290687={},_0x48ae84={'count':0x0,'rows':[]};var _0x4c7362=_['map'](db[_0x789a('0x3d')][_0x789a('0x3e')],function(_0x3aadff){return{'name':_0x3aadff[_0x789a('0x3f')],'type':_0x3aadff[_0x789a('0x40')][_0x789a('0x41')]};});_0x290687[_0x789a('0x42')]=_[_0x789a('0x43')](_0x4c7362,_0x789a('0x3b'));_0x290687[_0x789a('0x44')]=_[_0x789a('0x45')](_0x355b9b[_0x789a('0x44')]);_0x290687[_0x789a('0x46')]=_[_0x789a('0x47')](_0x290687['model'],_0x290687[_0x789a('0x44')]);_0x153e8d['attributes']=_[_0x789a('0x47')](_0x290687[_0x789a('0x42')],qs[_0x789a('0x48')](_0x355b9b['query'][_0x789a('0x48')]));_0x153e8d[_0x789a('0x49')]=_0x153e8d[_0x789a('0x49')][_0x789a('0x4a')]?_0x153e8d[_0x789a('0x49')]:_0x290687[_0x789a('0x42')];if(!_0x355b9b[_0x789a('0x44')][_0x789a('0x4b')](_0x789a('0x4c'))){_0x153e8d['limit']=qs[_0x789a('0x31')](_0x355b9b[_0x789a('0x44')][_0x789a('0x31')]);_0x153e8d['offset']=qs[_0x789a('0x2f')](_0x355b9b[_0x789a('0x44')][_0x789a('0x2f')]);}_0x153e8d[_0x789a('0x4d')]=qs[_0x789a('0x4e')](_0x355b9b[_0x789a('0x44')][_0x789a('0x4e')]);_0x153e8d[_0x789a('0x4f')]=qs[_0x789a('0x46')](_[_0x789a('0x50')](_0x355b9b[_0x789a('0x44')],_0x290687['filters']),_0x4c7362);if(_0x355b9b[_0x789a('0x44')]['filter']){_0x153e8d[_0x789a('0x4f')]=_['merge'](_0x153e8d[_0x789a('0x4f')],{'$or':_['map'](_0x4c7362,function(_0x443e63){if(_0x443e63['type']!==_0x789a('0x51')){var _0x4edf9c={};_0x4edf9c[_0x443e63[_0x789a('0x3b')]]={'$like':'%'+_0x355b9b[_0x789a('0x44')][_0x789a('0x52')]+'%'};return _0x4edf9c;}})});}_0x153e8d=_[_0x789a('0x53')]({},_0x153e8d,_0x355b9b[_0x789a('0x54')]);var _0x1de307={'where':_0x153e8d[_0x789a('0x4f')]};return db['ChatMessage'][_0x789a('0x32')](_0x1de307)[_0x789a('0x22')](function(_0x2a778b){_0x48ae84[_0x789a('0x32')]=_0x2a778b;if(_0x355b9b['query'][_0x789a('0x55')]){_0x153e8d['include']=[{'all':!![]}];}return db[_0x789a('0x3d')][_0x789a('0x56')](_0x153e8d);})['then'](function(_0x2307fc){_0x48ae84['rows']=_0x2307fc;return _0x48ae84;})[_0x789a('0x22')](respondWithFilteredResult(_0x4ab5d3,_0x153e8d))[_0x789a('0x2b')](handleError(_0x4ab5d3,null));};exports[_0x789a('0x57')]=function(_0x34d1c3,_0x1e9994){var _0x1105c5={'raw':!![],'where':{'id':_0x34d1c3[_0x789a('0x58')]['id']}},_0x1a47dd={};_0x1a47dd['model']=_[_0x789a('0x45')](db['ChatMessage'][_0x789a('0x3e')]);_0x1a47dd[_0x789a('0x44')]=_['keys'](_0x34d1c3['query']);_0x1a47dd[_0x789a('0x46')]=_[_0x789a('0x47')](_0x1a47dd[_0x789a('0x42')],_0x1a47dd[_0x789a('0x44')]);_0x1105c5['attributes']=_[_0x789a('0x47')](_0x1a47dd['model'],qs[_0x789a('0x48')](_0x34d1c3['query'][_0x789a('0x48')]));_0x1105c5[_0x789a('0x49')]=_0x1105c5['attributes'][_0x789a('0x4a')]?_0x1105c5[_0x789a('0x49')]:_0x1a47dd['model'];if(_0x34d1c3[_0x789a('0x44')]['includeAll']){_0x1105c5['include']=[{'all':!![]}];}_0x1105c5=_[_0x789a('0x53')]({},_0x1105c5,_0x34d1c3['options']);return db['ChatMessage']['find'](_0x1105c5)[_0x789a('0x22')](handleEntityNotFound(_0x1e9994,null))[_0x789a('0x22')](respondWithResult(_0x1e9994,null))[_0x789a('0x2b')](handleError(_0x1e9994,null));};exports[_0x789a('0x59')]=function(_0x13f868,_0x50c861){return db[_0x789a('0x3d')][_0x789a('0x59')](_0x13f868[_0x789a('0x5a')],{})['then'](respondWithResult(_0x50c861,0xc9))['catch'](handleError(_0x50c861,null));};exports[_0x789a('0x5b')]=function(_0x4b1562,_0x4df20c){if(_0x4b1562['body']['id']){delete _0x4b1562[_0x789a('0x5a')]['id'];}return db[_0x789a('0x3d')][_0x789a('0x5c')]({'where':{'id':_0x4b1562['params']['id']}})['then'](handleEntityNotFound(_0x4df20c,null))[_0x789a('0x22')](saveUpdates(_0x4b1562[_0x789a('0x5a')],null))[_0x789a('0x22')](respondWithResult(_0x4df20c,null))[_0x789a('0x2b')](handleError(_0x4df20c,null));};exports[_0x789a('0x38')]=function(_0x5ec407,_0x496f09){return db[_0x789a('0x3d')][_0x789a('0x5c')]({'where':{'id':_0x5ec407[_0x789a('0x58')]['id']}})[_0x789a('0x22')](handleEntityNotFound(_0x496f09,null))[_0x789a('0x22')](removeEntity(_0x496f09,null))[_0x789a('0x2b')](handleError(_0x496f09,null));};exports[_0x789a('0x5d')]=function(_0x51b4d9,_0x36920e){return db[_0x789a('0x3d')][_0x789a('0x5d')]()[_0x789a('0x22')](respondWithResult(_0x36920e,null))[_0x789a('0x2b')](handleError(_0x36920e,null));};var interaction_log=require('../../config/logger')('chat-interactions');exports['accept']=function(_0x3bf3c6,_0x2fcd2b,_0x3c7175){var _0x2971ee={'agent':{},'channel':_0x789a('0x5e')};if(_0x3bf3c6[_0x789a('0x5a')]['id']){delete _0x3bf3c6['body']['id'];}_0x3bf3c6[_0x789a('0x5a')][_0x789a('0x5f')]=!![];_0x3bf3c6[_0x789a('0x5a')][_0x789a('0x60')]=moment()[_0x789a('0x61')](_0x789a('0x62'));_0x3bf3c6[_0x789a('0x5a')][_0x789a('0x63')]=_0x3bf3c6['body'][_0x789a('0x63')]||_0x3bf3c6[_0x789a('0x64')]['id'];_0x2971ee[_0x789a('0x65')]['id']=_0x3bf3c6['body'][_0x789a('0x63')];return db[_0x789a('0x3d')][_0x789a('0x5c')]({'where':{'id':_0x3bf3c6['params']['id'],'UserId':null}})[_0x789a('0x22')](handleEntityNotFound(_0x2fcd2b,null))[_0x789a('0x22')](saveUpdates(_0x3bf3c6[_0x789a('0x5a')],null))[_0x789a('0x22')](function(_0x4ee645){if(_0x4ee645){_0x2971ee[_0x789a('0x29')]=_0x4ee645['get']({'plain':!![]});return db[_0x789a('0x66')][_0x789a('0x5c')]({'where':{'id':_0x4ee645['ChatInteractionId']}});}return null;})[_0x789a('0x22')](handleEntityNotFound(_0x2fcd2b,null))[_0x789a('0x22')](function(_0x41c1c1){if(_0x41c1c1){return _0x41c1c1[_0x789a('0x5b')]({'UserId':_0x3bf3c6['body'][_0x789a('0x63')],'read1stAt':_[_0x789a('0x67')](_0x41c1c1[_0x789a('0x68')])?moment()[_0x789a('0x61')](_0x789a('0x62')):undefined});}return null;})[_0x789a('0x22')](function(_0x13a209){if(_0x13a209){_0x2971ee[_0x789a('0x69')]=_0x13a209[_0x789a('0x6a')]({'plain':!![]});interaction_log['info'](_0x789a('0x6b'),_0x3bf3c6[_0x789a('0x64')]['id'],_0x3bf3c6[_0x789a('0x64')][_0x789a('0x3b')],_0x3bf3c6['user'][_0x789a('0x6c')],_0x2971ee[_0x789a('0x69')]['id'],_0x3bf3c6[_0x789a('0x5a')]?JSON['stringify'](_0x3bf3c6[_0x789a('0x5a')]):_0x789a('0x6d'));return respondWithRpcPromise(_0x789a('0x6e'),_0x789a('0x6f'),_0x2971ee);}return null;})['then'](function(_0x575071){var _0x4a4fa4=_0x789a('0x70')+_0x575071[_0x789a('0x29')]['ContactId'];return db['sequelize'][_0x789a('0x44')](_0x4a4fa4,{'type':db[_0x789a('0x71')][_0x789a('0x72')][_0x789a('0x73')],'raw':!![]})[_0x789a('0x22')](function(_0x535aab){return _0x535aab;});})['then'](function(_0x53c228){if(_0x53c228){_0x2971ee[_0x789a('0x29')][_0x789a('0x74')]=_0x53c228[0x0];if(!_0x3bf3c6[_0x789a('0x5a')][_0x789a('0x63')])return;return db[_0x789a('0x75')]['find']({'where':{'id':_0x3bf3c6['body'][_0x789a('0x63')],'role':'agent'},'attributes':['id','name','fullname',_0x789a('0x76'),_0x789a('0x77')],'raw':!![]});}return null;})['then'](function(_0x18e4f9){if(!_0x18e4f9)return null;_0x2971ee[_0x789a('0x29')]['agent']=_0x18e4f9;return _0x2971ee;})[_0x789a('0x22')](function(_0x153c7e){if(_0x153c7e){if(_0x3bf3c6[_0x789a('0x5a')]['manual']){_0x2971ee[_0x789a('0x29')][_0x789a('0x78')]=util[_0x789a('0x61')](_0x789a('0x79'),_0x3bf3c6[_0x789a('0x64')][_0x789a('0x3b')]);_0x2971ee[_0x789a('0x29')][_0x789a('0x7a')]=_0x2971ee[_0x789a('0x7a')];_0x2971ee['message'][_0x789a('0x7b')]=_0x2971ee[_0x789a('0x7a')];_0x2971ee[_0x789a('0x29')][_0x789a('0x7c')]=_0x789a('0x7d');return respondWithRpcPromise(_0x789a('0x7e'),_0x789a('0x7e'),{'event':_0x789a('0x7f'),'message':_[_0x789a('0x53')](_0x2971ee[_0x789a('0x29')],JSON['parse'](_0x2971ee[_0x789a('0x69')][_0x789a('0x80')]))},client9002)[_0x789a('0x22')](function(){return _0x2971ee;});}return _0x2971ee;}return null;})[_0x789a('0x22')](respondWithResult(_0x2fcd2b,null))[_0x789a('0x2b')](handleError(_0x2fcd2b,null));};var interaction_log=require('../../config/logger')(_0x789a('0x81'));exports['reject']=function(_0x26caba,_0x461757,_0x1c3d84){var _0x1a3a2f={'agent':{},'channel':_0x789a('0x5e')};if(_0x26caba['body']['id']){delete _0x26caba[_0x789a('0x5a')]['id'];}_0x26caba['body'][_0x789a('0x63')]=_0x26caba[_0x789a('0x5a')][_0x789a('0x63')]||_0x26caba[_0x789a('0x64')]['id'];_0x1a3a2f[_0x789a('0x65')]['id']=_0x26caba[_0x789a('0x5a')][_0x789a('0x63')];return db['ChatMessage'][_0x789a('0x5c')]({'where':{'id':_0x26caba['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x461757,null))[_0x789a('0x22')](function(_0x23b9ac){if(_0x23b9ac){_0x1a3a2f[_0x789a('0x29')]=_0x23b9ac[_0x789a('0x6a')]({'plain':!![]});return db[_0x789a('0x66')][_0x789a('0x5c')]({'where':{'id':_0x23b9ac[_0x789a('0x82')]}});}return null;})[_0x789a('0x22')](handleEntityNotFound(_0x461757,null))[_0x789a('0x22')](function(_0x236e63){if(_0x236e63){_0x1a3a2f[_0x789a('0x69')]=_0x236e63[_0x789a('0x6a')]({'plain':!![]});interaction_log[_0x789a('0x23')](_0x789a('0x83'),_0x26caba[_0x789a('0x64')]['id'],_0x26caba[_0x789a('0x64')][_0x789a('0x3b')],_0x26caba[_0x789a('0x64')][_0x789a('0x6c')],_0x1a3a2f['interaction']['id'],_0x26caba['body']?JSON['stringify'](_0x26caba['body']):_0x789a('0x6d'));return respondWithRpcPromise(_0x789a('0x84'),_0x789a('0x85'),_0x1a3a2f);}return null;})['then'](function(_0x1ebb55){var _0x4ed710=_0x789a('0x70')+_0x1ebb55[_0x789a('0x29')][_0x789a('0x86')];return db[_0x789a('0x87')][_0x789a('0x44')](_0x4ed710,{'type':db[_0x789a('0x71')]['QueryTypes'][_0x789a('0x73')],'raw':!![]})['then'](function(_0x48dd09){return _0x48dd09;});})[_0x789a('0x22')](function(_0x154d02){if(_0x154d02){_0x1a3a2f['message'][_0x789a('0x74')]=_0x154d02[0x0];if(!_0x26caba[_0x789a('0x5a')][_0x789a('0x63')])return;return db[_0x789a('0x75')][_0x789a('0x5c')]({'where':{'id':_0x26caba[_0x789a('0x5a')][_0x789a('0x63')],'role':_0x789a('0x65')},'attributes':['id',_0x789a('0x3b'),'fullname','email','internal'],'raw':!![]});}return null;})[_0x789a('0x22')](function(_0x26cd2d){if(!_0x26cd2d)return null;_0x1a3a2f['message'][_0x789a('0x65')]=_0x26cd2d;return _0x1a3a2f;})[_0x789a('0x22')](function(_0x2e2de7){if(_0x2e2de7){_0x2e2de7[_0x789a('0x29')][_0x789a('0x78')]=util[_0x789a('0x61')](_0x789a('0x79'),_0x26caba[_0x789a('0x64')][_0x789a('0x3b')]);_0x2e2de7[_0x789a('0x29')][_0x789a('0x7a')]=_0x1a3a2f[_0x789a('0x7a')];_0x2e2de7['message'][_0x789a('0x7b')]=_0x1a3a2f['channel'];_0x2e2de7[_0x789a('0x29')][_0x789a('0x7c')]=_0x789a('0x36');respondWithRpcPromise(_0x789a('0x7e'),_0x789a('0x7e'),{'event':'rejectmessage','message':_[_0x789a('0x53')](_0x1a3a2f[_0x789a('0x29')],JSON[_0x789a('0x88')](_0x1a3a2f[_0x789a('0x69')][_0x789a('0x80')]))},client9002);return _0x1a3a2f;}return null;})[_0x789a('0x22')](respondWithResult(_0x461757,null))['catch'](handleError(_0x461757,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index 9df2b3e..25d8295 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 _0x044c=['exports','../../mysqldb','save','update','emit','hasOwnProperty','hook'];(function(_0x155a6a,_0xd1824e){var _0x2d8a38=function(_0x44bbd3){while(--_0x44bbd3){_0x155a6a['push'](_0x155a6a['shift']());}};_0x2d8a38(++_0xd1824e);}(_0x044c,0xd3));var _0xc044=function(_0x352fbb,_0x2a6bfa){_0x352fbb=_0x352fbb-0x0;var _0x2a14ab=_0x044c[_0x352fbb];return _0x2a14ab;};'use strict';var EventEmitter=require('events');var ChatMessage=require(_0xc044('0x0'))['db']['ChatMessage'];var ChatMessageEvents=new EventEmitter();ChatMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xc044('0x1'),'afterUpdate':_0xc044('0x2'),'afterDestroy':'remove'};function emitEvent(_0x451826){return function(_0x5cfc29,_0x3e64a2,_0x201a7d){ChatMessageEvents[_0xc044('0x3')](_0x451826+':'+_0x5cfc29['id'],_0x5cfc29);ChatMessageEvents['emit'](_0x451826,_0x5cfc29);_0x201a7d(null);};}for(var e in events){if(events[_0xc044('0x4')](e)){var event=events[e];ChatMessage[_0xc044('0x5')](e,emitEvent(event));}}module[_0xc044('0x6')]=ChatMessageEvents; \ No newline at end of file +var _0x18bc=['emit','hook','exports','../../mysqldb','ChatMessage','setMaxListeners','update','remove'];(function(_0x6afc9c,_0xf6b755){var _0x195d68=function(_0x48f1eb){while(--_0x48f1eb){_0x6afc9c['push'](_0x6afc9c['shift']());}};_0x195d68(++_0xf6b755);}(_0x18bc,0x13b));var _0xc18b=function(_0x3eff8f,_0x58a445){_0x3eff8f=_0x3eff8f-0x0;var _0x23eabd=_0x18bc[_0x3eff8f];return _0x23eabd;};'use strict';var EventEmitter=require('events');var ChatMessage=require(_0xc18b('0x0'))['db'][_0xc18b('0x1')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0xc18b('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xc18b('0x3'),'afterDestroy':_0xc18b('0x4')};function emitEvent(_0x466f19){return function(_0x3e3642,_0x5076e2,_0x185661){ChatMessageEvents[_0xc18b('0x5')](_0x466f19+':'+_0x3e3642['id'],_0x3e3642);ChatMessageEvents[_0xc18b('0x5')](_0x466f19,_0x3e3642);_0x185661(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatMessage[_0xc18b('0x6')](e,emitEvent(event));}}module[_0xc18b('0x7')]=ChatMessageEvents; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.model.js b/server/api/chatMessage/chatMessage.model.js index 720ab24..cc6e82d 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 _0xdbd0=['moment','request-promise','path','rimraf','./chatMessage.attributes','exports','chat_messages','fti_chat_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','isNil','UserId','ChatInteraction','ChatInteractionId','then','update','createdAt','catch','utf8mb4_unicode_ci','lodash','util','../../config/logger','api'];(function(_0x9cd4c3,_0x1c9b2c){var _0x4c9025=function(_0x25b3c6){while(--_0x25b3c6){_0x9cd4c3['push'](_0x9cd4c3['shift']());}};_0x4c9025(++_0x1c9b2c);}(_0xdbd0,0x88));var _0x0dbd=function(_0x464292,_0x33a95b){_0x464292=_0x464292-0x0;var _0x3c0e40=_0xdbd0[_0x464292];return _0x3c0e40;};'use strict';var _=require(_0x0dbd('0x0'));var util=require(_0x0dbd('0x1'));var logger=require(_0x0dbd('0x2'))(_0x0dbd('0x3'));var moment=require(_0x0dbd('0x4'));var BPromise=require('bluebird');var rp=require(_0x0dbd('0x5'));var fs=require('fs');var path=require(_0x0dbd('0x6'));var rimraf=require(_0x0dbd('0x7'));var config=require('../../config/environment');var attributes=require(_0x0dbd('0x8'));module[_0x0dbd('0x9')]=function(_0xcd515f,_0x3bd770){return _0xcd515f['define']('ChatMessage',attributes,{'tableName':_0x0dbd('0xa'),'paranoid':![],'indexes':[{'name':_0x0dbd('0xb'),'fields':[_0x0dbd('0xc')],'type':_0x0dbd('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x12057a,_0x453836,_0x5329e7){var _0x55f318=_0xcd515f[_0x0dbd('0xe')];var _0x1e0d57=_0x12057a[_0x0dbd('0xf')]({'plain':!![]});if(_0x1e0d57[_0x0dbd('0x10')][_0x0dbd('0x11')]()==='in'||_0x1e0d57[_0x0dbd('0x10')][_0x0dbd('0x11')]()===_0x0dbd('0x12')&&!_0x1e0d57['secret']&&!_[_0x0dbd('0x13')](_0x1e0d57[_0x0dbd('0x14')])){_0x55f318[_0x0dbd('0x15')]['findOne']({'where':{'id':_0x1e0d57[_0x0dbd('0x16')]}})[_0x0dbd('0x17')](function(_0x1a45d0){if(_0x1a45d0){_0x1a45d0[_0x0dbd('0x18')]({'lastMsgAt':_0x1e0d57[_0x0dbd('0x19')],'lastMsgDirection':_0x1e0d57[_0x0dbd('0x10')][_0x0dbd('0x11')]()});}})[_0x0dbd('0x1a')](function(_0x1b9134){console['error'](_0x1b9134);});}_0x5329e7();}},'charset':'utf8mb4','collate':_0x0dbd('0x1b')});}; \ No newline at end of file +var _0x25ab=['../../config/environment','./chatMessage.attributes','exports','define','ChatMessage','chat_messages','fti_chat_messages','body','FULLTEXT','models','get','toLowerCase','direction','out','ChatInteraction','ChatInteractionId','then','update','catch','error','utf8mb4','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x8b9e62,_0x173b44){var _0x31a9a0=function(_0x5cacf7){while(--_0x5cacf7){_0x8b9e62['push'](_0x8b9e62['shift']());}};_0x31a9a0(++_0x173b44);}(_0x25ab,0xe7));var _0xb25a=function(_0xed4502,_0x2852ed){_0xed4502=_0xed4502-0x0;var _0x155e33=_0x25ab[_0xed4502];return _0x155e33;};'use strict';var _=require(_0xb25a('0x0'));var util=require(_0xb25a('0x1'));var logger=require(_0xb25a('0x2'))(_0xb25a('0x3'));var moment=require(_0xb25a('0x4'));var BPromise=require(_0xb25a('0x5'));var rp=require(_0xb25a('0x6'));var fs=require('fs');var path=require(_0xb25a('0x7'));var rimraf=require(_0xb25a('0x8'));var config=require(_0xb25a('0x9'));var attributes=require(_0xb25a('0xa'));module[_0xb25a('0xb')]=function(_0x1d917f,_0x358e83){return _0x1d917f[_0xb25a('0xc')](_0xb25a('0xd'),attributes,{'tableName':_0xb25a('0xe'),'paranoid':![],'indexes':[{'name':_0xb25a('0xf'),'fields':[_0xb25a('0x10')],'type':_0xb25a('0x11')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x36bb4c,_0xfafb6a,_0x1a6cef){var _0x1ab887=_0x1d917f[_0xb25a('0x12')];var _0x20de0a=_0x36bb4c[_0xb25a('0x13')]({'plain':!![]});if(_0x20de0a['direction'][_0xb25a('0x14')]()==='in'||_0x20de0a[_0xb25a('0x15')][_0xb25a('0x14')]()===_0xb25a('0x16')&&!_0x20de0a['secret']&&!_['isNil'](_0x20de0a['UserId'])){_0x1ab887[_0xb25a('0x17')]['findOne']({'where':{'id':_0x20de0a[_0xb25a('0x18')]}})[_0xb25a('0x19')](function(_0x354e13){if(_0x354e13){_0x354e13[_0xb25a('0x1a')]({'lastMsgAt':_0x20de0a['createdAt'],'lastMsgDirection':_0x20de0a[_0xb25a('0x15')][_0xb25a('0x14')]()});}})[_0xb25a('0x1b')](function(_0x4f1c10){console[_0xb25a('0x1c')](_0x4f1c10);});}_0x1a6cef();}},'charset':_0xb25a('0x1d'),'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 e09f211..d7bbd56 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 _0x209e=['request\x20sent','debug','error','code','message','result','catch','CreateChatMessage','ChatMessage','create','options','raw','stringify','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','ChatMessage,\x20%s,\x20%s'];(function(_0x1f7839,_0x2a26e6){var _0x36b42e=function(_0x553222){while(--_0x553222){_0x1f7839['push'](_0x1f7839['shift']());}};_0x36b42e(++_0x2a26e6);}(_0x209e,0x70));var _0xe209=function(_0x504023,_0x8d76bc){_0x504023=_0x504023-0x0;var _0x36acf4=_0x209e[_0x504023];return _0x36acf4;};'use strict';var _=require(_0xe209('0x0'));var util=require(_0xe209('0x1'));var moment=require(_0xe209('0x2'));var BPromise=require(_0xe209('0x3'));var rs=require(_0xe209('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe209('0x5'))['db'];var utils=require(_0xe209('0x6'));var logger=require(_0xe209('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xe209('0x8'));var client=jayson[_0xe209('0x9')][_0xe209('0xa')]({'port':0x232a});config[_0xe209('0xb')]=_[_0xe209('0xc')](config[_0xe209('0xb')],{'host':_0xe209('0xd'),'port':0x18eb});var socket=require(_0xe209('0xe'))(new Redis(config[_0xe209('0xb')]));require('./chatMessage.socket')[_0xe209('0xf')](socket);function respondWithRpcPromise(_0x2c2437,_0x517e98,_0x8dd254){return new BPromise(function(_0x4511a9,_0x90f35e){return client[_0xe209('0x10')](_0x2c2437,_0x8dd254)[_0xe209('0x11')](function(_0x4fc971){logger[_0xe209('0x12')](_0xe209('0x13'),_0x517e98,_0xe209('0x14'));logger[_0xe209('0x15')]('ChatMessage,\x20%s,\x20%s,\x20%s',_0x517e98,_0xe209('0x14'),JSON['stringify'](_0x4fc971));if(_0x4fc971[_0xe209('0x16')]){if(_0x4fc971[_0xe209('0x16')][_0xe209('0x17')]===0x1f4){logger[_0xe209('0x16')](_0xe209('0x13'),_0x517e98,_0x4fc971[_0xe209('0x16')]['message']);return _0x90f35e(_0x4fc971[_0xe209('0x16')][_0xe209('0x18')]);}logger[_0xe209('0x16')](_0xe209('0x13'),_0x517e98,_0x4fc971['error'][_0xe209('0x18')]);return _0x4511a9(_0x4fc971[_0xe209('0x16')][_0xe209('0x18')]);}else{logger[_0xe209('0x12')](_0xe209('0x13'),_0x517e98,'request\x20sent');_0x4511a9(_0x4fc971[_0xe209('0x19')][_0xe209('0x18')]);}})[_0xe209('0x1a')](function(_0x1e927a){logger[_0xe209('0x16')](_0xe209('0x13'),_0x517e98,_0x1e927a);_0x90f35e(_0x1e927a);});});}exports[_0xe209('0x1b')]=function(_0x35b05c){var _0x5197ef=this;return new Promise(function(_0xde1346,_0x1e35ed){return db[_0xe209('0x1c')][_0xe209('0x1d')](_0x35b05c['body'],{'raw':_0x35b05c['options']?_0x35b05c[_0xe209('0x1e')][_0xe209('0x1f')]===undefined?!![]:![]:!![]})[_0xe209('0x11')](function(_0x9a7ee){logger[_0xe209('0x12')](_0xe209('0x1b'),_0x35b05c);logger['debug'](_0xe209('0x1b'),_0x35b05c,JSON[_0xe209('0x20')](_0x9a7ee));_0xde1346(_0x9a7ee);})[_0xe209('0x1a')](function(_0x173f4d){logger['error'](_0xe209('0x1b'),_0x173f4d[_0xe209('0x18')],_0x35b05c);_0x1e35ed(_0x5197ef[_0xe209('0x16')](0x1f4,_0x173f4d['message']));});});}; \ No newline at end of file +var _0xc83f=['bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','./chatMessage.socket','register','request','then','info','ChatMessage,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','result','catch','body','options','raw','CreateChatMessage','lodash','util'];(function(_0x57fd0d,_0x2630ea){var _0x4b57f6=function(_0x5d314c){while(--_0x5d314c){_0x57fd0d['push'](_0x57fd0d['shift']());}};_0x4b57f6(++_0x2630ea);}(_0xc83f,0xf6));var _0xfc83=function(_0x336221,_0x4e04de){_0x336221=_0x336221-0x0;var _0x2ad2a5=_0xc83f[_0x336221];return _0x2ad2a5;};'use strict';var _=require(_0xfc83('0x0'));var util=require(_0xfc83('0x1'));var moment=require('moment');var BPromise=require(_0xfc83('0x2'));var rs=require(_0xfc83('0x3'));var fs=require('fs');var Redis=require(_0xfc83('0x4'));var db=require(_0xfc83('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xfc83('0x6'))(_0xfc83('0x7'));var config=require(_0xfc83('0x8'));var jayson=require(_0xfc83('0x9'));var client=jayson[_0xfc83('0xa')][_0xfc83('0xb')]({'port':0x232a});config[_0xfc83('0xc')]=_['defaults'](config[_0xfc83('0xc')],{'host':_0xfc83('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xfc83('0xe'))[_0xfc83('0xf')](socket);function respondWithRpcPromise(_0x578dcc,_0x14e792,_0x12ee60){return new BPromise(function(_0xae5fd8,_0x4beed1){return client[_0xfc83('0x10')](_0x578dcc,_0x12ee60)[_0xfc83('0x11')](function(_0x1d0dd4){logger[_0xfc83('0x12')](_0xfc83('0x13'),_0x14e792,'request\x20sent');logger[_0xfc83('0x14')]('ChatMessage,\x20%s,\x20%s,\x20%s',_0x14e792,_0xfc83('0x15'),JSON[_0xfc83('0x16')](_0x1d0dd4));if(_0x1d0dd4['error']){if(_0x1d0dd4['error']['code']===0x1f4){logger[_0xfc83('0x17')](_0xfc83('0x13'),_0x14e792,_0x1d0dd4[_0xfc83('0x17')][_0xfc83('0x18')]);return _0x4beed1(_0x1d0dd4[_0xfc83('0x17')]['message']);}logger[_0xfc83('0x17')]('ChatMessage,\x20%s,\x20%s',_0x14e792,_0x1d0dd4['error'][_0xfc83('0x18')]);return _0xae5fd8(_0x1d0dd4[_0xfc83('0x17')][_0xfc83('0x18')]);}else{logger['info'](_0xfc83('0x13'),_0x14e792,_0xfc83('0x15'));_0xae5fd8(_0x1d0dd4[_0xfc83('0x19')][_0xfc83('0x18')]);}})[_0xfc83('0x1a')](function(_0x188c7e){logger[_0xfc83('0x17')](_0xfc83('0x13'),_0x14e792,_0x188c7e);_0x4beed1(_0x188c7e);});});}exports['CreateChatMessage']=function(_0xb2d9d4){var _0x45dd1b=this;return new Promise(function(_0x3cce2f,_0x54ff9c){return db['ChatMessage']['create'](_0xb2d9d4[_0xfc83('0x1b')],{'raw':_0xb2d9d4[_0xfc83('0x1c')]?_0xb2d9d4['options'][_0xfc83('0x1d')]===undefined?!![]:![]:!![]})[_0xfc83('0x11')](function(_0x173918){logger[_0xfc83('0x12')](_0xfc83('0x1e'),_0xb2d9d4);logger[_0xfc83('0x14')](_0xfc83('0x1e'),_0xb2d9d4,JSON[_0xfc83('0x16')](_0x173918));_0x3cce2f(_0x173918);})['catch'](function(_0x40c5f2){logger[_0xfc83('0x17')](_0xfc83('0x1e'),_0x40c5f2[_0xfc83('0x18')],_0xb2d9d4);_0x54ff9c(_0x45dd1b[_0xfc83('0x17')](0x1f4,_0x40c5f2[_0xfc83('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index 771cbe1..9b4ef2c 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 _0xaa3f=['register','length','chatMessage:','./chatMessage.events','save','remove','update','emit'];(function(_0x11bcbd,_0x4d39b3){var _0x58aa24=function(_0x7b15f3){while(--_0x7b15f3){_0x11bcbd['push'](_0x11bcbd['shift']());}};_0x58aa24(++_0x4d39b3);}(_0xaa3f,0xbb));var _0xfaa3=function(_0x503a45,_0x12312f){_0x503a45=_0x503a45-0x0;var _0x1a27d1=_0xaa3f[_0x503a45];return _0x1a27d1;};'use strict';var ChatMessageEvents=require(_0xfaa3('0x0'));var events=[_0xfaa3('0x1'),_0xfaa3('0x2'),_0xfaa3('0x3')];function createListener(_0x1ebbfb,_0x1da39b){return function(_0x408343){_0x1da39b[_0xfaa3('0x4')](_0x1ebbfb,_0x408343);};}function removeListener(_0x32f4e1,_0x5123a3){return function(){ChatMessageEvents['removeListener'](_0x32f4e1,_0x5123a3);};}exports[_0xfaa3('0x5')]=function(_0x4bac92){for(var _0x3d09aa=0x0,_0xeecce5=events[_0xfaa3('0x6')];_0x3d09aa<_0xeecce5;_0x3d09aa++){var _0xbf270c=events[_0x3d09aa];var _0x328d5f=createListener(_0xfaa3('0x7')+_0xbf270c,_0x4bac92);ChatMessageEvents['on'](_0xbf270c,_0x328d5f);}}; \ No newline at end of file +var _0xec39=['length','chatMessage:','./chatMessage.events','save','remove','update','removeListener'];(function(_0x108b66,_0x37db88){var _0x3ed76=function(_0x2a22c5){while(--_0x2a22c5){_0x108b66['push'](_0x108b66['shift']());}};_0x3ed76(++_0x37db88);}(_0xec39,0x19f));var _0x9ec3=function(_0x2fb75b,_0x2b327d){_0x2fb75b=_0x2fb75b-0x0;var _0x49e6ce=_0xec39[_0x2fb75b];return _0x49e6ce;};'use strict';var ChatMessageEvents=require(_0x9ec3('0x0'));var events=[_0x9ec3('0x1'),_0x9ec3('0x2'),_0x9ec3('0x3')];function createListener(_0x1fc7a7,_0xb3d117){return function(_0x3d481c){_0xb3d117['emit'](_0x1fc7a7,_0x3d481c);};}function removeListener(_0x1f43fb,_0x1c944d){return function(){ChatMessageEvents[_0x9ec3('0x4')](_0x1f43fb,_0x1c944d);};}exports['register']=function(_0x49ddff){for(var _0x55adba=0x0,_0x3742c5=events[_0x9ec3('0x5')];_0x55adba<_0x3742c5;_0x55adba++){var _0x29a6a2=events[_0x55adba];var _0x595e3a=createListener(_0x9ec3('0x6')+_0x29a6a2,_0x49ddff);ChatMessageEvents['on'](_0x29a6a2,_0x595e3a);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index 85f1ed6..fbbda93 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 _0x3c8a=['update','accept','/:id/reject','reject','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../config/environment','./chatMessage.controller','get','isAuthenticated','index','describe','/:id','post','tracked','chat','chatmessage:create','put'];(function(_0x5dafd0,_0x3bcbb6){var _0x364354=function(_0x5da31c){while(--_0x5da31c){_0x5dafd0['push'](_0x5dafd0['shift']());}};_0x364354(++_0x3bcbb6);}(_0x3c8a,0xb6));var _0xa3c8=function(_0x4e82ff,_0x3cbf4b){_0x4e82ff=_0x4e82ff-0x0;var _0x495205=_0x3c8a[_0x4e82ff];return _0x495205;};'use strict';var multer=require(_0xa3c8('0x0'));var util=require(_0xa3c8('0x1'));var path=require(_0xa3c8('0x2'));var timeout=require(_0xa3c8('0x3'));var express=require(_0xa3c8('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xa3c8('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xa3c8('0x6'));var controller=require(_0xa3c8('0x7'));router[_0xa3c8('0x8')]('/',auth[_0xa3c8('0x9')](),controller[_0xa3c8('0xa')]);router[_0xa3c8('0x8')]('/describe',auth[_0xa3c8('0x9')](),controller[_0xa3c8('0xb')]);router[_0xa3c8('0x8')](_0xa3c8('0xc'),auth[_0xa3c8('0x9')](),controller['show']);router[_0xa3c8('0xd')]('/',auth['isAuthenticated'](),interaction[_0xa3c8('0xe')](_0xa3c8('0xf'),_0xa3c8('0x10')),controller['create']);router[_0xa3c8('0x11')](_0xa3c8('0xc'),controller[_0xa3c8('0x12')]);router[_0xa3c8('0x11')]('/:id/accept',auth[_0xa3c8('0x9')](),controller[_0xa3c8('0x13')]);router[_0xa3c8('0x11')](_0xa3c8('0x14'),auth[_0xa3c8('0x9')](),controller[_0xa3c8('0x15')]);router[_0xa3c8('0x16')](_0xa3c8('0xc'),auth[_0xa3c8('0x9')](),controller[_0xa3c8('0x17')]);module[_0xa3c8('0x18')]=router; \ No newline at end of file +var _0x668b=['chat','chatmessage:create','create','put','update','/:id/accept','reject','delete','/:id','exports','multer','path','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','./chatMessage.controller','get','isAuthenticated','index','/describe','describe','tracked'];(function(_0x3e3cab,_0x246974){var _0x5ca183=function(_0x2422a5){while(--_0x2422a5){_0x3e3cab['push'](_0x3e3cab['shift']());}};_0x5ca183(++_0x246974);}(_0x668b,0x1a8));var _0xb668=function(_0x5b077b,_0x50b707){_0x5b077b=_0x5b077b-0x0;var _0x16faf7=_0x668b[_0x5b077b];return _0x16faf7;};'use strict';var multer=require(_0xb668('0x0'));var util=require('util');var path=require(_0xb668('0x1'));var timeout=require(_0xb668('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xb668('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xb668('0x4'));var config=require(_0xb668('0x5'));var controller=require(_0xb668('0x6'));router[_0xb668('0x7')]('/',auth[_0xb668('0x8')](),controller[_0xb668('0x9')]);router[_0xb668('0x7')](_0xb668('0xa'),auth[_0xb668('0x8')](),controller[_0xb668('0xb')]);router[_0xb668('0x7')]('/:id',auth[_0xb668('0x8')](),controller['show']);router['post']('/',auth[_0xb668('0x8')](),interaction[_0xb668('0xc')](_0xb668('0xd'),_0xb668('0xe')),controller[_0xb668('0xf')]);router[_0xb668('0x10')]('/:id',controller[_0xb668('0x11')]);router[_0xb668('0x10')](_0xb668('0x12'),auth[_0xb668('0x8')](),controller['accept']);router[_0xb668('0x10')]('/:id/reject',auth[_0xb668('0x8')](),controller[_0xb668('0x13')]);router[_0xb668('0x14')](_0xb668('0x15'),auth[_0xb668('0x8')](),controller['destroy']);module[_0xb668('0x16')]=router; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js index 86db0dd..8f11e87 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 _0x5f2f=['exports','TEXT','medium','sequelize'];(function(_0x263957,_0x39f977){var _0x55d0f9=function(_0x27f20a){while(--_0x27f20a){_0x263957['push'](_0x263957['shift']());}};_0x55d0f9(++_0x39f977);}(_0x5f2f,0x73));var _0xf5f2=function(_0x138293,_0x197e7f){_0x138293=_0x138293-0x0;var _0x34c4a2=_0x5f2f[_0x138293];return _0x34c4a2;};'use strict';var Sequelize=require(_0xf5f2('0x0'));module[_0xf5f2('0x1')]={'body':{'type':Sequelize[_0xf5f2('0x2')](_0xf5f2('0x3')),'allowNull':![]},'plainBody':{'type':Sequelize[_0xf5f2('0x2')](_0xf5f2('0x3')),'allowNull':![]}}; \ No newline at end of file +var _0x2032=['medium','exports','TEXT'];(function(_0x166e34,_0x38f5ab){var _0x15061b=function(_0x356112){while(--_0x356112){_0x166e34['push'](_0x166e34['shift']());}};_0x15061b(++_0x38f5ab);}(_0x2032,0xd9));var _0x2203=function(_0x1ed5d9,_0x52d183){_0x1ed5d9=_0x1ed5d9-0x0;var _0x326c59=_0x2032[_0x1ed5d9];return _0x326c59;};'use strict';var Sequelize=require('sequelize');module[_0x2203('0x0')]={'body':{'type':Sequelize[_0x2203('0x1')](_0x2203('0x2')),'allowNull':![]},'plainBody':{'type':Sequelize['TEXT'](_0x2203('0x2')),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js index 2c39eac..979732d 100644 --- a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js +++ b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['filter','VIRTUAL','includeAll','include','findAll','rows','show','params','length','merge','options','find','catch','body','Attachment','join','server','attachments','offline-chat','basename','remove','describe','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','ChatOfflineMessage','fieldName','type','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick'];(function(_0x2f3848,_0x48564d){var _0x102668=function(_0x5e32ab){while(--_0x5e32ab){_0x2f3848['push'](_0x2f3848['shift']());}};_0x102668(++_0x48564d);}(_0x7a54,0x106));var _0x47a5=function(_0x5ab49e,_0xcb5a13){_0x5ab49e=_0x5ab49e-0x0;var _0x233117=_0x7a54[_0x5ab49e];return _0x233117;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x29')]=function(_0x136b14,_0x16631f){var _0x361bfa={},_0x1127f8={},_0x11a4fa={'count':0x0,'rows':[]};var _0x3ad507=_['map'](db[_0x47a5('0x2a')]['rawAttributes'],function(_0x2ef875){return{'name':_0x2ef875[_0x47a5('0x2b')],'type':_0x2ef875[_0x47a5('0x2c')]['key']};});_0x1127f8[_0x47a5('0x2d')]=_[_0x47a5('0x2e')](_0x3ad507,_0x47a5('0x27'));_0x1127f8[_0x47a5('0x2f')]=_['keys'](_0x136b14['query']);_0x1127f8[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x1127f8['model'],_0x1127f8['query']);_0x361bfa[_0x47a5('0x32')]=_[_0x47a5('0x31')](_0x1127f8['model'],qs[_0x47a5('0x33')](_0x136b14['query'][_0x47a5('0x33')]));_0x361bfa[_0x47a5('0x32')]=_0x361bfa['attributes']['length']?_0x361bfa[_0x47a5('0x32')]:_0x1127f8['model'];if(!_0x136b14[_0x47a5('0x2f')][_0x47a5('0x34')](_0x47a5('0x35'))){_0x361bfa['limit']=qs[_0x47a5('0x1d')](_0x136b14['query']['limit']);_0x361bfa[_0x47a5('0x1a')]=qs['offset'](_0x136b14[_0x47a5('0x2f')]['offset']);}_0x361bfa[_0x47a5('0x36')]=qs[_0x47a5('0x37')](_0x136b14[_0x47a5('0x2f')][_0x47a5('0x37')]);_0x361bfa[_0x47a5('0x38')]=qs[_0x47a5('0x30')](_[_0x47a5('0x39')](_0x136b14[_0x47a5('0x2f')],_0x1127f8[_0x47a5('0x30')]),_0x3ad507);if(_0x136b14['query'][_0x47a5('0x3a')]){_0x361bfa[_0x47a5('0x38')]=_['merge'](_0x361bfa[_0x47a5('0x38')],{'$or':_[_0x47a5('0x2e')](_0x3ad507,function(_0x1d4348){if(_0x1d4348['type']!==_0x47a5('0x3b')){var _0x10f660={};_0x10f660[_0x1d4348['name']]={'$like':'%'+_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3a')]+'%'};return _0x10f660;}})});}_0x361bfa=_['merge']({},_0x361bfa,_0x136b14['options']);var _0x5ebd8c={'where':_0x361bfa[_0x47a5('0x38')]};return db['ChatOfflineMessage'][_0x47a5('0x1c')](_0x5ebd8c)[_0x47a5('0x23')](function(_0x301a85){_0x11a4fa[_0x47a5('0x1c')]=_0x301a85;if(_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x361bfa[_0x47a5('0x3d')]=[{'all':!![]}];}return db[_0x47a5('0x2a')][_0x47a5('0x3e')](_0x361bfa);})[_0x47a5('0x23')](function(_0x280500){_0x11a4fa[_0x47a5('0x3f')]=_0x280500;return _0x11a4fa;})[_0x47a5('0x23')](respondWithFilteredResult(_0x16631f,_0x361bfa))['catch'](handleError(_0x16631f,null));};exports[_0x47a5('0x40')]=function(_0x1c36fa,_0x331474){var _0x23bd8d={'raw':!![],'where':{'id':_0x1c36fa[_0x47a5('0x41')]['id']}},_0x586f4f={};_0x586f4f['model']=_['keys'](db['ChatOfflineMessage']['rawAttributes']);_0x586f4f[_0x47a5('0x2f')]=_['keys'](_0x1c36fa[_0x47a5('0x2f')]);_0x586f4f[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x586f4f['model'],_0x586f4f[_0x47a5('0x2f')]);_0x23bd8d[_0x47a5('0x32')]=_['intersection'](_0x586f4f['model'],qs[_0x47a5('0x33')](_0x1c36fa['query'][_0x47a5('0x33')]));_0x23bd8d[_0x47a5('0x32')]=_0x23bd8d[_0x47a5('0x32')][_0x47a5('0x42')]?_0x23bd8d[_0x47a5('0x32')]:_0x586f4f[_0x47a5('0x2d')];if(_0x1c36fa[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x23bd8d[_0x47a5('0x3d')]=[{'all':!![]}];}_0x23bd8d=_[_0x47a5('0x43')]({},_0x23bd8d,_0x1c36fa[_0x47a5('0x44')]);return db[_0x47a5('0x2a')][_0x47a5('0x45')](_0x23bd8d)[_0x47a5('0x23')](handleEntityNotFound(_0x331474,null))[_0x47a5('0x23')](respondWithResult(_0x331474,null))[_0x47a5('0x46')](handleError(_0x331474,null));};exports['create']=function(_0x2d38de,_0x23bb04){return db['ChatOfflineMessage']['create'](_0x2d38de[_0x47a5('0x47')],{})['then'](respondWithResult(_0x23bb04,0xc9))[_0x47a5('0x46')](handleError(_0x23bb04,null));};exports[_0x47a5('0x22')]=function(_0x54c35f,_0x4f62d3){if(_0x54c35f[_0x47a5('0x47')]['id']){delete _0x54c35f['body']['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x54c35f[_0x47a5('0x41')]['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x4f62d3,null))[_0x47a5('0x23')](saveUpdates(_0x54c35f[_0x47a5('0x47')],null))[_0x47a5('0x23')](respondWithResult(_0x4f62d3,null))['catch'](handleError(_0x4f62d3,null));};exports['destroy']=function(_0x2dd1db,_0x411230){return db[_0x47a5('0x48')][_0x47a5('0x3e')]({'where':{'ChatOfflineMessageId':_0x2dd1db[_0x47a5('0x41')]['id']},'raw':!![]})[_0x47a5('0x23')](function(_0x249de5){_0x249de5['forEach'](function(_0x45cca5){var _0x1c9a62=path[_0x47a5('0x49')](config['root'],_0x47a5('0x4a'),'files',_0x47a5('0x4b'),_0x47a5('0x4c'),_0x45cca5[_0x47a5('0x4d')]);var _0xf03bd5=fs['existsSync'](_0x1c9a62);if(_0xf03bd5)fs_extra[_0x47a5('0x4e')](_0x1c9a62);});})[_0x47a5('0x23')](function(){return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x2dd1db[_0x47a5('0x41')]['id']},'individualHooks':!![]});})[_0x47a5('0x23')](handleEntityNotFound(_0x411230,null))[_0x47a5('0x23')](removeEntity(_0x411230,null))['catch'](handleError(_0x411230,null));};exports[_0x47a5('0x4f')]=function(_0x43721b,_0x187d7e){return db[_0x47a5('0x2a')][_0x47a5('0x4f')]()[_0x47a5('0x23')](respondWithResult(_0x187d7e,null))['catch'](handleError(_0x187d7e,null));}; \ No newline at end of file +var _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(_0x205dc5,_0x191197){var _0x442e92=function(_0x13d30c){while(--_0x13d30c){_0x205dc5['push'](_0x205dc5['shift']());}};_0x442e92(++_0x191197);}(_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 diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.events.js b/server/api/chatOfflineMessage/chatOfflineMessage.events.js index ef0291c..14374a0 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 _0x299c=['ChatOfflineMessage','save','update','emit','hasOwnProperty','exports','events'];(function(_0x44b795,_0x8d7c1b){var _0x2bb91e=function(_0x4027f1){while(--_0x4027f1){_0x44b795['push'](_0x44b795['shift']());}};_0x2bb91e(++_0x8d7c1b);}(_0x299c,0x180));var _0xc299=function(_0x213c03,_0x22ba9d){_0x213c03=_0x213c03-0x0;var _0x478e2d=_0x299c[_0x213c03];return _0x478e2d;};'use strict';var EventEmitter=require(_0xc299('0x0'));var ChatOfflineMessage=require('../../mysqldb')['db'][_0xc299('0x1')];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xc299('0x2'),'afterUpdate':_0xc299('0x3'),'afterDestroy':'remove'};function emitEvent(_0x3550ec){return function(_0x17d6c5,_0x453b10,_0x577391){ChatOfflineMessageEvents[_0xc299('0x4')](_0x3550ec+':'+_0x17d6c5['id'],_0x17d6c5);ChatOfflineMessageEvents[_0xc299('0x4')](_0x3550ec,_0x17d6c5);_0x577391(null);};}for(var e in events){if(events[_0xc299('0x5')](e)){var event=events[e];ChatOfflineMessage['hook'](e,emitEvent(event));}}module[_0xc299('0x6')]=ChatOfflineMessageEvents; \ No newline at end of file +var _0xb0b4=['events','../../mysqldb','setMaxListeners','save','remove','emit','exports'];(function(_0x4f5c5c,_0x20088e){var _0x4e686c=function(_0x2aa945){while(--_0x2aa945){_0x4f5c5c['push'](_0x4f5c5c['shift']());}};_0x4e686c(++_0x20088e);}(_0xb0b4,0x134));var _0x4b0b=function(_0x47210c,_0x127cb3){_0x47210c=_0x47210c-0x0;var _0x24d779=_0xb0b4[_0x47210c];return _0x24d779;};'use strict';var EventEmitter=require(_0x4b0b('0x0'));var ChatOfflineMessage=require(_0x4b0b('0x1'))['db']['ChatOfflineMessage'];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents[_0x4b0b('0x2')](0x0);var events={'afterCreate':_0x4b0b('0x3'),'afterUpdate':'update','afterDestroy':_0x4b0b('0x4')};function emitEvent(_0x365ce2){return function(_0x2ec8b6,_0x1d66f1,_0x315e2d){ChatOfflineMessageEvents[_0x4b0b('0x5')](_0x365ce2+':'+_0x2ec8b6['id'],_0x2ec8b6);ChatOfflineMessageEvents[_0x4b0b('0x5')](_0x365ce2,_0x2ec8b6);_0x315e2d(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatOfflineMessage['hook'](e,emitEvent(event));}}module[_0x4b0b('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 99bd5ab..e1b889c 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 _0xb0a2=['exports','ChatOfflineMessage','chat_offline_messages','utf8mb4_unicode_ci','./chatOfflineMessage.attributes'];(function(_0x588e96,_0x3a4978){var _0x3683df=function(_0x1cbc4a){while(--_0x1cbc4a){_0x588e96['push'](_0x588e96['shift']());}};_0x3683df(++_0x3a4978);}(_0xb0a2,0x117));var _0x2b0a=function(_0x5aeedb,_0x2e9c48){_0x5aeedb=_0x5aeedb-0x0;var _0x3e5e60=_0xb0a2[_0x5aeedb];return _0x3e5e60;};'use strict';var attributes=require(_0x2b0a('0x0'));module[_0x2b0a('0x1')]=function(_0x3a3d1c){return _0x3a3d1c['define'](_0x2b0a('0x2'),attributes,{'tableName':_0x2b0a('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x2b0a('0x4')});}; \ No newline at end of file +var _0xd1d4=['./chatOfflineMessage.attributes','exports','define','chat_offline_messages','utf8mb4','utf8mb4_unicode_ci'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xd1d4,0x84));var _0x4d1d=function(_0x24259d,_0x64a194){_0x24259d=_0x24259d-0x0;var _0x5a701=_0xd1d4[_0x24259d];return _0x5a701;};'use strict';var attributes=require(_0x4d1d('0x0'));module[_0x4d1d('0x1')]=function(_0x27c02c){return _0x27c02c[_0x4d1d('0x2')]('ChatOfflineMessage',attributes,{'tableName':_0x4d1d('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x4d1d('0x4'),'collate':_0x4d1d('0x5')});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index feba091..a30c8e1 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 _0x1580=['../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','request','then','request\x20sent','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','stringify','error','ChatOfflineMessage,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x3f9f9d,_0x923a36){var _0x3f9fc9=function(_0x1b0e3d){while(--_0x1b0e3d){_0x3f9f9d['push'](_0x3f9f9d['shift']());}};_0x3f9fc9(++_0x923a36);}(_0x1580,0x15a));var _0x0158=function(_0x4e699b,_0x459659){_0x4e699b=_0x4e699b-0x0;var _0x59d53b=_0x1580[_0x4e699b];return _0x59d53b;};'use strict';var _=require(_0x0158('0x0'));var util=require(_0x0158('0x1'));var moment=require(_0x0158('0x2'));var BPromise=require(_0x0158('0x3'));var rs=require(_0x0158('0x4'));var fs=require('fs');var Redis=require(_0x0158('0x5'));var db=require(_0x0158('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x0158('0x7'))('rpc');var config=require(_0x0158('0x8'));var jayson=require(_0x0158('0x9'));var client=jayson['client'][_0x0158('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2b9af3,_0xecf81c,_0x2d7a30){return new BPromise(function(_0x3e885c,_0x4d5047){return client[_0x0158('0xb')](_0x2b9af3,_0x2d7a30)[_0x0158('0xc')](function(_0x4b5450){logger['info']('ChatOfflineMessage,\x20%s,\x20%s',_0xecf81c,_0x0158('0xd'));logger['debug'](_0x0158('0xe'),_0xecf81c,_0x0158('0xd'),JSON[_0x0158('0xf')](_0x4b5450));if(_0x4b5450[_0x0158('0x10')]){if(_0x4b5450[_0x0158('0x10')]['code']===0x1f4){logger[_0x0158('0x10')](_0x0158('0x11'),_0xecf81c,_0x4b5450['error'][_0x0158('0x12')]);return _0x4d5047(_0x4b5450[_0x0158('0x10')][_0x0158('0x12')]);}logger[_0x0158('0x10')](_0x0158('0x11'),_0xecf81c,_0x4b5450[_0x0158('0x10')][_0x0158('0x12')]);return _0x3e885c(_0x4b5450[_0x0158('0x10')][_0x0158('0x12')]);}else{logger[_0x0158('0x13')](_0x0158('0x11'),_0xecf81c,_0x0158('0xd'));_0x3e885c(_0x4b5450[_0x0158('0x14')][_0x0158('0x12')]);}})[_0x0158('0x15')](function(_0x52d6af){logger['error'](_0x0158('0x11'),_0xecf81c,_0x52d6af);_0x4d5047(_0x52d6af);});});} \ No newline at end of file +var _0x1e9d=['ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','then','info'];(function(_0x50c86a,_0x2fec99){var _0x53420a=function(_0x56bb66){while(--_0x56bb66){_0x50c86a['push'](_0x50c86a['shift']());}};_0x53420a(++_0x2fec99);}(_0x1e9d,0x1dd));var _0xd1e9=function(_0x36c06c,_0x208e85){_0x36c06c=_0x36c06c-0x0;var _0x2abf77=_0x1e9d[_0x36c06c];return _0x2abf77;};'use strict';var _=require(_0xd1e9('0x0'));var util=require('util');var moment=require(_0xd1e9('0x1'));var BPromise=require(_0xd1e9('0x2'));var rs=require(_0xd1e9('0x3'));var fs=require('fs');var Redis=require(_0xd1e9('0x4'));var db=require(_0xd1e9('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xd1e9('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x15061,_0x3dea6,_0x3a9acc){return new BPromise(function(_0x5aff45,_0x466da8){return client['request'](_0x15061,_0x3a9acc)[_0xd1e9('0x7')](function(_0x207bee){logger[_0xd1e9('0x8')](_0xd1e9('0x9'),_0x3dea6,_0xd1e9('0xa'));logger[_0xd1e9('0xb')](_0xd1e9('0xc'),_0x3dea6,_0xd1e9('0xa'),JSON[_0xd1e9('0xd')](_0x207bee));if(_0x207bee[_0xd1e9('0xe')]){if(_0x207bee[_0xd1e9('0xe')]['code']===0x1f4){logger[_0xd1e9('0xe')](_0xd1e9('0x9'),_0x3dea6,_0x207bee[_0xd1e9('0xe')][_0xd1e9('0xf')]);return _0x466da8(_0x207bee[_0xd1e9('0xe')]['message']);}logger[_0xd1e9('0xe')](_0xd1e9('0x9'),_0x3dea6,_0x207bee[_0xd1e9('0xe')][_0xd1e9('0xf')]);return _0x5aff45(_0x207bee['error']['message']);}else{logger['info'](_0xd1e9('0x9'),_0x3dea6,'request\x20sent');_0x5aff45(_0x207bee[_0xd1e9('0x10')][_0xd1e9('0xf')]);}})[_0xd1e9('0x11')](function(_0xc89082){logger[_0xd1e9('0xe')](_0xd1e9('0x9'),_0x3dea6,_0xc89082);_0x466da8(_0xc89082);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index 97d714a..5e24fa1 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 _0x9de4=['/:id','exports','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./chatOfflineMessage.controller','get','isAuthenticated','index','/describe','describe','show','post','create'];(function(_0x5a9c0c,_0x4ec485){var _0x53c77d=function(_0x1cf384){while(--_0x1cf384){_0x5a9c0c['push'](_0x5a9c0c['shift']());}};_0x53c77d(++_0x4ec485);}(_0x9de4,0x92));var _0x49de=function(_0x583ee5,_0x2acd9a){_0x583ee5=_0x583ee5-0x0;var _0x3f002a=_0x9de4[_0x583ee5];return _0x3f002a;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49de('0x0'));var timeout=require(_0x49de('0x1'));var express=require(_0x49de('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x49de('0x3'));var config=require(_0x49de('0x4'));var controller=require(_0x49de('0x5'));router[_0x49de('0x6')]('/',auth[_0x49de('0x7')](),controller[_0x49de('0x8')]);router[_0x49de('0x6')](_0x49de('0x9'),auth['isAuthenticated'](),controller[_0x49de('0xa')]);router[_0x49de('0x6')]('/:id',auth[_0x49de('0x7')](),controller[_0x49de('0xb')]);router[_0x49de('0xc')]('/',auth[_0x49de('0x7')](),controller[_0x49de('0xd')]);router['put'](_0x49de('0xe'),auth[_0x49de('0x7')](),controller['update']);router['delete'](_0x49de('0xe'),auth[_0x49de('0x7')](),controller['destroy']);module[_0x49de('0xf')]=router; \ No newline at end of file +var _0x219e=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatOfflineMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','delete','destroy','exports','util','path','connect-timeout','express'];(function(_0xaf280a,_0x3b0cdb){var _0x7453b=function(_0x24e59a){while(--_0x24e59a){_0xaf280a['push'](_0xaf280a['shift']());}};_0x7453b(++_0x3b0cdb);}(_0x219e,0x80));var _0xe219=function(_0xbd08b4,_0x4790ed){_0xbd08b4=_0xbd08b4-0x0;var _0x314f1e=_0x219e[_0xbd08b4];return _0x314f1e;};'use strict';var multer=require('multer');var util=require(_0xe219('0x0'));var path=require(_0xe219('0x1'));var timeout=require(_0xe219('0x2'));var express=require(_0xe219('0x3'));var router=express['Router']();var fs_extra=require(_0xe219('0x4'));var auth=require(_0xe219('0x5'));var interaction=require(_0xe219('0x6'));var config=require(_0xe219('0x7'));var controller=require(_0xe219('0x8'));router[_0xe219('0x9')]('/',auth[_0xe219('0xa')](),controller[_0xe219('0xb')]);router[_0xe219('0x9')](_0xe219('0xc'),auth[_0xe219('0xa')](),controller[_0xe219('0xd')]);router[_0xe219('0x9')](_0xe219('0xe'),auth['isAuthenticated'](),controller[_0xe219('0xf')]);router[_0xe219('0x10')]('/',auth['isAuthenticated'](),controller[_0xe219('0x11')]);router[_0xe219('0x12')]('/:id',auth[_0xe219('0xa')](),controller['update']);router[_0xe219('0x13')](_0xe219('0xe'),auth[_0xe219('0xa')](),controller[_0xe219('0x14')]);module[_0xe219('0x15')]=router; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.attributes.js b/server/api/chatProactiveAction/chatProactiveAction.attributes.js index a32c39f..1aa7041 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 _0xa20e=['STRING','ENUM','mouseOver','timeout','exports'];(function(_0xbb14db,_0x3ee8c6){var _0x36bed7=function(_0x16c478){while(--_0x16c478){_0xbb14db['push'](_0xbb14db['shift']());}};_0x36bed7(++_0x3ee8c6);}(_0xa20e,0x1a8));var _0xea20=function(_0x4369ef,_0x55cfbc){_0x4369ef=_0x4369ef-0x0;var _0x5b6913=_0xa20e[_0x4369ef];return _0x5b6913;};'use strict';var Sequelize=require('sequelize');module[_0xea20('0x0')]={'name':{'type':Sequelize[_0xea20('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0xea20('0x2')](_0xea20('0x3'),_0xea20('0x4')),'defaultValue':_0xea20('0x3')},'selector':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0xd3e1=['ENUM','timeout','mouseOver','sequelize','exports'];(function(_0x362195,_0x15100b){var _0x5c4054=function(_0x43c26){while(--_0x43c26){_0x362195['push'](_0x362195['shift']());}};_0x5c4054(++_0x15100b);}(_0xd3e1,0x18e));var _0x1d3e=function(_0x3109ee,_0x32a8c1){_0x3109ee=_0x3109ee-0x0;var _0x288424=_0xd3e1[_0x3109ee];return _0x288424;};'use strict';var Sequelize=require(_0x1d3e('0x0'));module[_0x1d3e('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x1d3e('0x2')]('mouseOver',_0x1d3e('0x3')),'defaultValue':_0x1d3e('0x4')},'selector':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index 65248b5..c7a9ed1 100644 --- a/server/api/chatProactiveAction/chatProactiveAction.controller.js +++ b/server/api/chatProactiveAction/chatProactiveAction.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3f27=['find','catch','create','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','Content-Range','json','reject','save','update','then','end','error','stack','name','send','params','model','keys','ChatProactiveAction','query','intersection','attributes','length','includeAll','include','options'];(function(_0x13b02f,_0x462a53){var _0x12e9a6=function(_0x187d57){while(--_0x187d57){_0x13b02f['push'](_0x13b02f['shift']());}};_0x12e9a6(++_0x462a53);}(_0x3f27,0x1f4));var _0x73f2=function(_0x31fa80,_0x506183){_0x31fa80=_0x31fa80-0x0;var _0x1cc1de=_0x3f27[_0x31fa80];return _0x1cc1de;};'use strict';var emlformat=require(_0x73f2('0x0'));var rimraf=require(_0x73f2('0x1'));var zipdir=require(_0x73f2('0x2'));var jsonpatch=require(_0x73f2('0x3'));var rp=require(_0x73f2('0x4'));var moment=require('moment');var BPromise=require(_0x73f2('0x5'));var Mustache=require(_0x73f2('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x73f2('0x7'));var ejs=require(_0x73f2('0x8'));var fs=require('fs');var fs_extra=require(_0x73f2('0x9'));var _=require(_0x73f2('0xa'));var squel=require(_0x73f2('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x73f2('0xc'));var toCsv=require(_0x73f2('0x7'));var querystring=require(_0x73f2('0xd'));var Papa=require(_0x73f2('0xe'));var Redis=require(_0x73f2('0xf'));var authService=require(_0x73f2('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x73f2('0x11'));var hardwareService=require(_0x73f2('0x12'));var logger=require(_0x73f2('0x13'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x73f2('0x14'));var db=require(_0x73f2('0x15'))['db'];function respondWithStatusCode(_0x20d4f3,_0x25e1bc){_0x25e1bc=_0x25e1bc||0xcc;return function(_0x454352){if(_0x454352){return _0x20d4f3[_0x73f2('0x16')](_0x25e1bc);}return _0x20d4f3[_0x73f2('0x17')](_0x25e1bc)['end']();};}function respondWithResult(_0x4d4bd2,_0x469686){_0x469686=_0x469686||0xc8;return function(_0x45e8e0){if(_0x45e8e0){return _0x4d4bd2['status'](_0x469686)['json'](_0x45e8e0);}};}function respondWithFilteredResult(_0x2c0720,_0x39feae){return function(_0x2a1ac6){if(_0x2a1ac6){var _0x262f51=typeof _0x39feae[_0x73f2('0x18')]===_0x73f2('0x19')&&typeof _0x39feae[_0x73f2('0x1a')]===_0x73f2('0x19');var _0x41e10c=_0x2a1ac6[_0x73f2('0x1b')];var _0x1dee61=_0x262f51?0x0:_0x39feae[_0x73f2('0x18')];var _0x2546a0=_0x262f51?_0x2a1ac6['count']:_0x39feae[_0x73f2('0x18')]+_0x39feae[_0x73f2('0x1a')];var _0x13c6ec;if(_0x2546a0>=_0x41e10c){_0x2546a0=_0x41e10c;_0x13c6ec=0xc8;}else{_0x13c6ec=0xce;}_0x2c0720[_0x73f2('0x17')](_0x13c6ec);return _0x2c0720['set'](_0x73f2('0x1c'),_0x1dee61+'-'+_0x2546a0+'/'+_0x41e10c)[_0x73f2('0x1d')](_0x2a1ac6);}return null;};}function patchUpdates(_0x416ead){return function(_0x2ae791){try{jsonpatch['apply'](_0x2ae791,_0x416ead,!![]);}catch(_0xd80727){return BPromise[_0x73f2('0x1e')](_0xd80727);}return _0x2ae791[_0x73f2('0x1f')]();};}function saveUpdates(_0x55416e,_0x4a723b){return function(_0x444b06){if(_0x444b06){return _0x444b06[_0x73f2('0x20')](_0x55416e)[_0x73f2('0x21')](function(_0x5e8f4c){return _0x5e8f4c;});}return null;};}function removeEntity(_0x4844df,_0x11a5da){return function(_0xd5bb3b){if(_0xd5bb3b){return _0xd5bb3b['destroy']()[_0x73f2('0x21')](function(){_0x4844df[_0x73f2('0x17')](0xcc)[_0x73f2('0x22')]();});}};}function handleEntityNotFound(_0x4ecdc7,_0x1b3f34){return function(_0x87e4e4){if(!_0x87e4e4){_0x4ecdc7[_0x73f2('0x16')](0x194);}return _0x87e4e4;};}function handleError(_0x5e06cb,_0x58bd99){_0x58bd99=_0x58bd99||0x1f4;return function(_0x5c52e3){logger[_0x73f2('0x23')](_0x5c52e3[_0x73f2('0x24')]);if(_0x5c52e3[_0x73f2('0x25')]){delete _0x5c52e3[_0x73f2('0x25')];}_0x5e06cb[_0x73f2('0x17')](_0x58bd99)[_0x73f2('0x26')](_0x5c52e3);};}exports['show']=function(_0x2840f0,_0xf0e828){var _0x4a90ac={'raw':!![],'where':{'id':_0x2840f0[_0x73f2('0x27')]['id']}},_0x21b18={};_0x21b18[_0x73f2('0x28')]=_[_0x73f2('0x29')](db[_0x73f2('0x2a')]['rawAttributes']);_0x21b18[_0x73f2('0x2b')]=_[_0x73f2('0x29')](_0x2840f0['query']);_0x21b18['filters']=_[_0x73f2('0x2c')](_0x21b18[_0x73f2('0x28')],_0x21b18[_0x73f2('0x2b')]);_0x4a90ac['attributes']=_['intersection'](_0x21b18['model'],qs['fields'](_0x2840f0[_0x73f2('0x2b')]['fields']));_0x4a90ac[_0x73f2('0x2d')]=_0x4a90ac[_0x73f2('0x2d')][_0x73f2('0x2e')]?_0x4a90ac[_0x73f2('0x2d')]:_0x21b18['model'];if(_0x2840f0[_0x73f2('0x2b')][_0x73f2('0x2f')]){_0x4a90ac[_0x73f2('0x30')]=[{'all':!![]}];}_0x4a90ac=_['merge']({},_0x4a90ac,_0x2840f0[_0x73f2('0x31')]);return db[_0x73f2('0x2a')][_0x73f2('0x32')](_0x4a90ac)['then'](handleEntityNotFound(_0xf0e828,null))[_0x73f2('0x21')](respondWithResult(_0xf0e828,null))[_0x73f2('0x33')](handleError(_0xf0e828,null));};exports[_0x73f2('0x34')]=function(_0x2ba1ec,_0x3f50b2){return db[_0x73f2('0x2a')][_0x73f2('0x34')](_0x2ba1ec[_0x73f2('0x35')],{})[_0x73f2('0x21')](respondWithResult(_0x3f50b2,0xc9))['catch'](handleError(_0x3f50b2,null));};exports['update']=function(_0x54a21f,_0x379cee){if(_0x54a21f[_0x73f2('0x35')]['id']){delete _0x54a21f[_0x73f2('0x35')]['id'];}return db['ChatProactiveAction'][_0x73f2('0x32')]({'where':{'id':_0x54a21f[_0x73f2('0x27')]['id']}})[_0x73f2('0x21')](handleEntityNotFound(_0x379cee,null))[_0x73f2('0x21')](saveUpdates(_0x54a21f[_0x73f2('0x35')],null))['then'](respondWithResult(_0x379cee,null))[_0x73f2('0x33')](handleError(_0x379cee,null));};exports[_0x73f2('0x36')]=function(_0xde2a1c,_0x42e3b5){return db[_0x73f2('0x2a')][_0x73f2('0x32')]({'where':{'id':_0xde2a1c['params']['id']}})[_0x73f2('0x21')](handleEntityNotFound(_0x42e3b5,null))['then'](removeEntity(_0x42e3b5,null))[_0x73f2('0x33')](handleError(_0x42e3b5,null));}; \ No newline at end of file +var _0x294b=['length','includeAll','include','options','ChatProactiveAction','find','create','body','catch','update','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','crypto','querystring','papaparse','ioredis','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','apply','save','then','sendStatus','error','name','send','show','params','model','query','keys','filters','intersection','attributes','fields'];(function(_0x1147fb,_0x57bfa2){var _0x4d8bbe=function(_0x55707b){while(--_0x55707b){_0x1147fb['push'](_0x1147fb['shift']());}};_0x4d8bbe(++_0x57bfa2);}(_0x294b,0xea));var _0xb294=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x294b[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xb294('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb294('0x1'));var jsonpatch=require(_0xb294('0x2'));var rp=require(_0xb294('0x3'));var moment=require(_0xb294('0x4'));var BPromise=require(_0xb294('0x5'));var Mustache=require(_0xb294('0x6'));var util=require('util');var path=require('path');var sox=require(_0xb294('0x7'));var csv=require(_0xb294('0x8'));var ejs=require(_0xb294('0x9'));var fs=require('fs');var fs_extra=require(_0xb294('0xa'));var _=require(_0xb294('0xb'));var squel=require('squel');var crypto=require(_0xb294('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xb294('0xd'));var Papa=require(_0xb294('0xe'));var Redis=require(_0xb294('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb294('0x10'));var logger=require(_0xb294('0x11'))(_0xb294('0x12'));var utils=require(_0xb294('0x13'));var config=require(_0xb294('0x14'));var licenseUtil=require(_0xb294('0x15'));var db=require(_0xb294('0x16'))['db'];function respondWithStatusCode(_0x13a3fc,_0x2b2bb5){_0x2b2bb5=_0x2b2bb5||0xcc;return function(_0x3e0fe5){if(_0x3e0fe5){return _0x13a3fc['sendStatus'](_0x2b2bb5);}return _0x13a3fc['status'](_0x2b2bb5)[_0xb294('0x17')]();};}function respondWithResult(_0x4c0959,_0x4b5996){_0x4b5996=_0x4b5996||0xc8;return function(_0x22beca){if(_0x22beca){return _0x4c0959[_0xb294('0x18')](_0x4b5996)[_0xb294('0x19')](_0x22beca);}};}function respondWithFilteredResult(_0x366f8f,_0x3f7323){return function(_0x2f3b62){if(_0x2f3b62){var _0x1a4089=typeof _0x3f7323[_0xb294('0x1a')]===_0xb294('0x1b')&&typeof _0x3f7323[_0xb294('0x1c')]===_0xb294('0x1b');var _0x51110b=_0x2f3b62[_0xb294('0x1d')];var _0x1ecc68=_0x1a4089?0x0:_0x3f7323['offset'];var _0x5e8ce6=_0x1a4089?_0x2f3b62[_0xb294('0x1d')]:_0x3f7323[_0xb294('0x1a')]+_0x3f7323[_0xb294('0x1c')];var _0x449e81;if(_0x5e8ce6>=_0x51110b){_0x5e8ce6=_0x51110b;_0x449e81=0xc8;}else{_0x449e81=0xce;}_0x366f8f[_0xb294('0x18')](_0x449e81);return _0x366f8f['set']('Content-Range',_0x1ecc68+'-'+_0x5e8ce6+'/'+_0x51110b)[_0xb294('0x19')](_0x2f3b62);}return null;};}function patchUpdates(_0x46b2ac){return function(_0x526914){try{jsonpatch[_0xb294('0x1e')](_0x526914,_0x46b2ac,!![]);}catch(_0x18e7dd){return BPromise['reject'](_0x18e7dd);}return _0x526914[_0xb294('0x1f')]();};}function saveUpdates(_0x21b9b2,_0x33c416){return function(_0x4afd48){if(_0x4afd48){return _0x4afd48['update'](_0x21b9b2)[_0xb294('0x20')](function(_0x5bdc68){return _0x5bdc68;});}return null;};}function removeEntity(_0x36b173,_0x5be6d5){return function(_0x101339){if(_0x101339){return _0x101339['destroy']()[_0xb294('0x20')](function(){_0x36b173['status'](0xcc)[_0xb294('0x17')]();});}};}function handleEntityNotFound(_0x405b66,_0x2d0c62){return function(_0xabcb26){if(!_0xabcb26){_0x405b66[_0xb294('0x21')](0x194);}return _0xabcb26;};}function handleError(_0x469647,_0x2fe3a9){_0x2fe3a9=_0x2fe3a9||0x1f4;return function(_0x52853){logger[_0xb294('0x22')](_0x52853['stack']);if(_0x52853['name']){delete _0x52853[_0xb294('0x23')];}_0x469647[_0xb294('0x18')](_0x2fe3a9)[_0xb294('0x24')](_0x52853);};}exports[_0xb294('0x25')]=function(_0x47fca9,_0x59fbde){var _0x1167e5={'raw':!![],'where':{'id':_0x47fca9[_0xb294('0x26')]['id']}},_0x3c2aa5={};_0x3c2aa5[_0xb294('0x27')]=_['keys'](db['ChatProactiveAction']['rawAttributes']);_0x3c2aa5[_0xb294('0x28')]=_[_0xb294('0x29')](_0x47fca9[_0xb294('0x28')]);_0x3c2aa5[_0xb294('0x2a')]=_[_0xb294('0x2b')](_0x3c2aa5[_0xb294('0x27')],_0x3c2aa5[_0xb294('0x28')]);_0x1167e5[_0xb294('0x2c')]=_[_0xb294('0x2b')](_0x3c2aa5[_0xb294('0x27')],qs[_0xb294('0x2d')](_0x47fca9[_0xb294('0x28')][_0xb294('0x2d')]));_0x1167e5['attributes']=_0x1167e5['attributes'][_0xb294('0x2e')]?_0x1167e5['attributes']:_0x3c2aa5[_0xb294('0x27')];if(_0x47fca9[_0xb294('0x28')][_0xb294('0x2f')]){_0x1167e5[_0xb294('0x30')]=[{'all':!![]}];}_0x1167e5=_['merge']({},_0x1167e5,_0x47fca9[_0xb294('0x31')]);return db[_0xb294('0x32')][_0xb294('0x33')](_0x1167e5)[_0xb294('0x20')](handleEntityNotFound(_0x59fbde,null))[_0xb294('0x20')](respondWithResult(_0x59fbde,null))['catch'](handleError(_0x59fbde,null));};exports['create']=function(_0x47fbf3,_0x324f8f){return db[_0xb294('0x32')][_0xb294('0x34')](_0x47fbf3[_0xb294('0x35')],{})[_0xb294('0x20')](respondWithResult(_0x324f8f,0xc9))[_0xb294('0x36')](handleError(_0x324f8f,null));};exports[_0xb294('0x37')]=function(_0x5df86d,_0x3f2e12){if(_0x5df86d[_0xb294('0x35')]['id']){delete _0x5df86d[_0xb294('0x35')]['id'];}return db[_0xb294('0x32')][_0xb294('0x33')]({'where':{'id':_0x5df86d[_0xb294('0x26')]['id']}})[_0xb294('0x20')](handleEntityNotFound(_0x3f2e12,null))[_0xb294('0x20')](saveUpdates(_0x5df86d['body'],null))['then'](respondWithResult(_0x3f2e12,null))[_0xb294('0x36')](handleError(_0x3f2e12,null));};exports['destroy']=function(_0x26af32,_0x565546){return db[_0xb294('0x32')][_0xb294('0x33')]({'where':{'id':_0x26af32[_0xb294('0x26')]['id']}})[_0xb294('0x20')](handleEntityNotFound(_0x565546,null))[_0xb294('0x20')](removeEntity(_0x565546,null))['catch'](handleError(_0x565546,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index ed95d8e..04f5601 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 _0xdc5f=['request-promise','path','rimraf','./chatProactiveAction.attributes','exports','ChatProactiveAction','chat_proactive_actions','lodash','util','../../config/logger','api','moment'];(function(_0x187184,_0x13aadf){var _0x390763=function(_0x49f325){while(--_0x49f325){_0x187184['push'](_0x187184['shift']());}};_0x390763(++_0x13aadf);}(_0xdc5f,0xaf));var _0xfdc5=function(_0x36eaaa,_0x326732){_0x36eaaa=_0x36eaaa-0x0;var _0x461349=_0xdc5f[_0x36eaaa];return _0x461349;};'use strict';var _=require(_0xfdc5('0x0'));var util=require(_0xfdc5('0x1'));var logger=require(_0xfdc5('0x2'))(_0xfdc5('0x3'));var moment=require(_0xfdc5('0x4'));var BPromise=require('bluebird');var rp=require(_0xfdc5('0x5'));var fs=require('fs');var path=require(_0xfdc5('0x6'));var rimraf=require(_0xfdc5('0x7'));var config=require('../../config/environment');var attributes=require(_0xfdc5('0x8'));module[_0xfdc5('0x9')]=function(_0x2ec582,_0x5ee63c){return _0x2ec582['define'](_0xfdc5('0xa'),attributes,{'tableName':_0xfdc5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbd8e=['path','rimraf','./chatProactiveAction.attributes','exports','ChatProactiveAction','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0xca11fe,_0x33eb73){var _0x55bcd0=function(_0x582433){while(--_0x582433){_0xca11fe['push'](_0xca11fe['shift']());}};_0x55bcd0(++_0x33eb73);}(_0xbd8e,0x1e9));var _0xebd8=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0xbd8e[_0x21a9d9];return _0x46adce;};'use strict';var _=require(_0xebd8('0x0'));var util=require(_0xebd8('0x1'));var logger=require(_0xebd8('0x2'))(_0xebd8('0x3'));var moment=require(_0xebd8('0x4'));var BPromise=require('bluebird');var rp=require(_0xebd8('0x5'));var fs=require('fs');var path=require(_0xebd8('0x6'));var rimraf=require(_0xebd8('0x7'));var config=require('../../config/environment');var attributes=require(_0xebd8('0x8'));module[_0xebd8('0x9')]=function(_0xcaf978,_0x340a79){return _0xcaf978['define'](_0xebd8('0xa'),attributes,{'tableName':'chat_proactive_actions','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 976ad32..64d01bf 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 _0xb0fb=['jayson/promise','client','http','request','then','info','ChatProactiveAction,\x20%s,\x20%s','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xb0fb,0x15e));var _0xbb0f=function(_0x5d2803,_0xf375bd){_0x5d2803=_0x5d2803-0x0;var _0xdcad2c=_0xb0fb[_0x5d2803];return _0xdcad2c;};'use strict';var _=require('lodash');var util=require(_0xbb0f('0x0'));var moment=require(_0xbb0f('0x1'));var BPromise=require('bluebird');var rs=require(_0xbb0f('0x2'));var fs=require('fs');var Redis=require(_0xbb0f('0x3'));var db=require(_0xbb0f('0x4'))['db'];var utils=require(_0xbb0f('0x5'));var logger=require(_0xbb0f('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xbb0f('0x7'));var client=jayson[_0xbb0f('0x8')][_0xbb0f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xaa1c5f,_0x43cd28,_0x2d10d3){return new BPromise(function(_0x596f10,_0xd7d346){return client[_0xbb0f('0xa')](_0xaa1c5f,_0x2d10d3)[_0xbb0f('0xb')](function(_0x17f95b){logger[_0xbb0f('0xc')](_0xbb0f('0xd'),_0x43cd28,'request\x20sent');logger[_0xbb0f('0xe')](_0xbb0f('0xf'),_0x43cd28,_0xbb0f('0x10'),JSON['stringify'](_0x17f95b));if(_0x17f95b[_0xbb0f('0x11')]){if(_0x17f95b[_0xbb0f('0x11')]['code']===0x1f4){logger[_0xbb0f('0x11')](_0xbb0f('0xd'),_0x43cd28,_0x17f95b[_0xbb0f('0x11')][_0xbb0f('0x12')]);return _0xd7d346(_0x17f95b[_0xbb0f('0x11')]['message']);}logger[_0xbb0f('0x11')](_0xbb0f('0xd'),_0x43cd28,_0x17f95b[_0xbb0f('0x11')]['message']);return _0x596f10(_0x17f95b[_0xbb0f('0x11')]['message']);}else{logger[_0xbb0f('0xc')](_0xbb0f('0xd'),_0x43cd28,_0xbb0f('0x10'));_0x596f10(_0x17f95b[_0xbb0f('0x13')][_0xbb0f('0x12')]);}})[_0xbb0f('0x14')](function(_0x3efe1a){logger['error'](_0xbb0f('0xd'),_0x43cd28,_0x3efe1a);_0xd7d346(_0x3efe1a);});});} \ No newline at end of file +var _0x96ce=['result','catch','lodash','util','moment','bluebird','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info'];(function(_0x25d7ab,_0x21f44b){var _0x513242=function(_0x536fda){while(--_0x536fda){_0x25d7ab['push'](_0x25d7ab['shift']());}};_0x513242(++_0x21f44b);}(_0x96ce,0x144));var _0xe96c=function(_0x4b2a8f,_0x5277ac){_0x4b2a8f=_0x4b2a8f-0x0;var _0x311556=_0x96ce[_0x4b2a8f];return _0x311556;};'use strict';var _=require(_0xe96c('0x0'));var util=require(_0xe96c('0x1'));var moment=require(_0xe96c('0x2'));var BPromise=require(_0xe96c('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xe96c('0x4'));var logger=require(_0xe96c('0x5'))(_0xe96c('0x6'));var config=require(_0xe96c('0x7'));var jayson=require(_0xe96c('0x8'));var client=jayson[_0xe96c('0x9')][_0xe96c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x14e91a,_0x4d9203,_0x3ae7c5){return new BPromise(function(_0x2b5cae,_0x45b7c8){return client[_0xe96c('0xb')](_0x14e91a,_0x3ae7c5)['then'](function(_0x38a8b1){logger['info'](_0xe96c('0xc'),_0x4d9203,_0xe96c('0xd'));logger[_0xe96c('0xe')](_0xe96c('0xf'),_0x4d9203,_0xe96c('0xd'),JSON[_0xe96c('0x10')](_0x38a8b1));if(_0x38a8b1[_0xe96c('0x11')]){if(_0x38a8b1[_0xe96c('0x11')][_0xe96c('0x12')]===0x1f4){logger[_0xe96c('0x11')]('ChatProactiveAction,\x20%s,\x20%s',_0x4d9203,_0x38a8b1[_0xe96c('0x11')][_0xe96c('0x13')]);return _0x45b7c8(_0x38a8b1[_0xe96c('0x11')][_0xe96c('0x13')]);}logger[_0xe96c('0x11')](_0xe96c('0xc'),_0x4d9203,_0x38a8b1[_0xe96c('0x11')][_0xe96c('0x13')]);return _0x2b5cae(_0x38a8b1[_0xe96c('0x11')][_0xe96c('0x13')]);}else{logger[_0xe96c('0x14')]('ChatProactiveAction,\x20%s,\x20%s',_0x4d9203,_0xe96c('0xd'));_0x2b5cae(_0x38a8b1[_0xe96c('0x15')][_0xe96c('0x13')]);}})[_0xe96c('0x16')](function(_0x51d852){logger[_0xe96c('0x11')](_0xe96c('0xc'),_0x4d9203,_0x51d852);_0x45b7c8(_0x51d852);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index d56c5df..7933199 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 _0xa630=['/:id','show','post','isAuthenticated','create','put','update','delete','destroy','exports','multer','util','express','fs-extra','../../components/interaction/service','../../config/environment','./chatProactiveAction.controller','get'];(function(_0x582028,_0x5c1dc0){var _0xc3f006=function(_0x16624a){while(--_0x16624a){_0x582028['push'](_0x582028['shift']());}};_0xc3f006(++_0x5c1dc0);}(_0xa630,0xbe));var _0x0a63=function(_0x3fa127,_0x557c3d){_0x3fa127=_0x3fa127-0x0;var _0x4c32d5=_0xa630[_0x3fa127];return _0x4c32d5;};'use strict';var multer=require(_0x0a63('0x0'));var util=require(_0x0a63('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x0a63('0x2'));var router=express['Router']();var fs_extra=require(_0x0a63('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x0a63('0x4'));var config=require(_0x0a63('0x5'));var controller=require(_0x0a63('0x6'));router[_0x0a63('0x7')](_0x0a63('0x8'),auth['isAuthenticated'](),controller[_0x0a63('0x9')]);router[_0x0a63('0xa')]('/',auth[_0x0a63('0xb')](),controller[_0x0a63('0xc')]);router[_0x0a63('0xd')](_0x0a63('0x8'),auth['isAuthenticated'](),controller[_0x0a63('0xe')]);router[_0x0a63('0xf')](_0x0a63('0x8'),auth[_0x0a63('0xb')](),controller[_0x0a63('0x10')]);module[_0x0a63('0x11')]=router; \ No newline at end of file +var _0xb4c7=['update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatProactiveAction.controller','/:id','isAuthenticated','show','create'];(function(_0x2abc3d,_0x48edca){var _0x252745=function(_0x32bb6f){while(--_0x32bb6f){_0x2abc3d['push'](_0x2abc3d['shift']());}};_0x252745(++_0x48edca);}(_0xb4c7,0x1ea));var _0x7b4c=function(_0xcabd19,_0x55efa6){_0xcabd19=_0xcabd19-0x0;var _0x387a0d=_0xb4c7[_0xcabd19];return _0x387a0d;};'use strict';var multer=require(_0x7b4c('0x0'));var util=require(_0x7b4c('0x1'));var path=require(_0x7b4c('0x2'));var timeout=require(_0x7b4c('0x3'));var express=require(_0x7b4c('0x4'));var router=express['Router']();var fs_extra=require(_0x7b4c('0x5'));var auth=require(_0x7b4c('0x6'));var interaction=require(_0x7b4c('0x7'));var config=require(_0x7b4c('0x8'));var controller=require(_0x7b4c('0x9'));router['get'](_0x7b4c('0xa'),auth[_0x7b4c('0xb')](),controller[_0x7b4c('0xc')]);router['post']('/',auth[_0x7b4c('0xb')](),controller[_0x7b4c('0xd')]);router['put'](_0x7b4c('0xa'),auth[_0x7b4c('0xb')](),controller[_0x7b4c('0xe')]);router[_0x7b4c('0xf')](_0x7b4c('0xa'),auth[_0x7b4c('0xb')](),controller[_0x7b4c('0x10')]);module[_0x7b4c('0x11')]=router; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.attributes.js b/server/api/chatQueue/chatQueue.attributes.js index 1b9d4c8..979d6aa 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 _0x6d09=['exports','STRING','name','INTEGER','ENUM','rrmemory','roundrobin','sequelize'];(function(_0x2f5c3a,_0x30dbe0){var _0x363a19=function(_0x29110b){while(--_0x29110b){_0x2f5c3a['push'](_0x2f5c3a['shift']());}};_0x363a19(++_0x30dbe0);}(_0x6d09,0x13f));var _0x96d0=function(_0x1dbb50,_0x5a4d06){_0x1dbb50=_0x1dbb50-0x0;var _0x4ccd44=_0x6d09[_0x1dbb50];return _0x4ccd44;};'use strict';var Sequelize=require(_0x96d0('0x0'));module[_0x96d0('0x1')]={'name':{'type':Sequelize[_0x96d0('0x2')],'unique':_0x96d0('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x96d0('0x2')]},'timeout':{'type':Sequelize[_0x96d0('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x96d0('0x5')](_0x96d0('0x6'),'beepall',_0x96d0('0x7'))}}; \ No newline at end of file +var _0xb9b6=['ENUM','beepall','roundrobin','sequelize','exports','STRING'];(function(_0x29db4e,_0x323087){var _0xa264bc=function(_0x4d7f84){while(--_0x4d7f84){_0x29db4e['push'](_0x29db4e['shift']());}};_0xa264bc(++_0x323087);}(_0xb9b6,0x1bf));var _0x6b9b=function(_0x24392f,_0x15a3e5){_0x24392f=_0x24392f-0x0;var _0x591e33=_0xb9b6[_0x24392f];return _0x591e33;};'use strict';var Sequelize=require(_0x6b9b('0x0'));module[_0x6b9b('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x6b9b('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x6b9b('0x3')]('rrmemory',_0x6b9b('0x4'),_0x6b9b('0x5'))}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index 35aab2d..e5b312f 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 _0x8a25=['rows','catch','show','model','keys','intersection','fields','attributes','merge','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','getMembers','findOne','length','nolimit','order','sort','filters','pick','UserChatQueue','findAndCountAll','agent','chatPause','createdAt','%s/%s','SIP','updatedAt','getTeams','Team','filter','ids','User','Agents','voicePause','interface','flatMap','sequelize','addTeams','each','findOrCreate','userChatQueue:save','removeTeams','field','tq.TeamId','from','ChatQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','QueryTypes','SELECT','every','TeamId','includes','all','union','transaction','isEmpty','removeAgents','emit','userChatQueue:remove','omit','spread','isArray','getAgents','bluebird','util','lodash','squel','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./chatQueue.socket','sendStatus','status','offset','undefined','count','limit','set','then','destroy','get','ChatQueues','UserProfileResource','end','error','stack','name','send','map','ChatQueue','rawAttributes','fieldName','type','key','getOptions','where','include','query','findAll'];(function(_0x2573ca,_0x550022){var _0x220656=function(_0x1ac82c){while(--_0x1ac82c){_0x2573ca['push'](_0x2573ca['shift']());}};_0x220656(++_0x550022);}(_0x8a25,0x12f));var _0x58a2=function(_0x4b75e7,_0xdb714a){_0x4b75e7=_0x4b75e7-0x0;var _0x1ea0d8=_0x8a25[_0x4b75e7];return _0x1ea0d8;};'use strict';var BPromise=require(_0x58a2('0x0'));var util=require(_0x58a2('0x1'));var _=require(_0x58a2('0x2'));var squel=require(_0x58a2('0x3'));var Redis=require(_0x58a2('0x4'));var qs=require(_0x58a2('0x5'));var logger=require(_0x58a2('0x6'))(_0x58a2('0x7'));var config=require(_0x58a2('0x8'));var db=require(_0x58a2('0x9'))['db'];config[_0x58a2('0xa')]=_[_0x58a2('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x58a2('0xc'))(new Redis(config[_0x58a2('0xa')]));require(_0x58a2('0xd'))['register'](socket);function respondWithStatusCode(_0x5d9d60,_0x2fadfd){_0x2fadfd=_0x2fadfd||0xcc;return function(_0x2d3318){if(_0x2d3318){return _0x5d9d60[_0x58a2('0xe')](_0x2fadfd);}return _0x5d9d60[_0x58a2('0xf')](_0x2fadfd)['end']();};}function respondWithResult(_0x4664b6,_0x15e75d){_0x15e75d=_0x15e75d||0xc8;return function(_0x3f6b2c){if(_0x3f6b2c){return _0x4664b6[_0x58a2('0xf')](_0x15e75d)['json'](_0x3f6b2c);}};}function respondWithFilteredResult(_0x486c89,_0x2d9497){return function(_0x40c476){if(_0x40c476){var _0xc728fb=typeof _0x2d9497[_0x58a2('0x10')]===_0x58a2('0x11')&&typeof _0x2d9497['limit']===_0x58a2('0x11');var _0x12d102=_0x40c476['count'];var _0x27f897=_0xc728fb?0x0:_0x2d9497[_0x58a2('0x10')];var _0x2a7422=_0xc728fb?_0x40c476[_0x58a2('0x12')]:_0x2d9497['offset']+_0x2d9497[_0x58a2('0x13')];var _0x337d25;if(_0x2a7422>=_0x12d102){_0x2a7422=_0x12d102;_0x337d25=0xc8;}else{_0x337d25=0xce;}_0x486c89[_0x58a2('0xf')](_0x337d25);return _0x486c89[_0x58a2('0x14')]('Content-Range',_0x27f897+'-'+_0x2a7422+'/'+_0x12d102)['json'](_0x40c476);}return null;};}function saveUpdates(_0x11abe4){return function(_0x5cf5f){if(_0x5cf5f){return _0x5cf5f['update'](_0x11abe4)[_0x58a2('0x15')](function(_0x53b834){return _0x53b834;});}return null;};}function removeEntity(_0x9401d5){return function(_0x3d8cbe){if(_0x3d8cbe){return _0x3d8cbe[_0x58a2('0x16')]()[_0x58a2('0x15')](function(){var _0x46937e=_0x3d8cbe[_0x58a2('0x17')]({'plain':!![]});var _0x2491f5=_0x58a2('0x18');return db[_0x58a2('0x19')][_0x58a2('0x16')]({'where':{'type':_0x2491f5,'resourceId':_0x46937e['id']}})[_0x58a2('0x15')](function(){return _0x3d8cbe;});})['then'](function(){_0x9401d5[_0x58a2('0xf')](0xcc)[_0x58a2('0x1a')]();});}};}function handleEntityNotFound(_0x49529f){return function(_0x50198b){if(!_0x50198b){_0x49529f['sendStatus'](0x194);}return _0x50198b;};}function handleError(_0x2fc2bc,_0x3da2b1){_0x3da2b1=_0x3da2b1||0x1f4;return function(_0x4f7df6){logger[_0x58a2('0x1b')](_0x4f7df6[_0x58a2('0x1c')]);if(_0x4f7df6[_0x58a2('0x1d')]){delete _0x4f7df6[_0x58a2('0x1d')];}_0x2fc2bc[_0x58a2('0xf')](_0x3da2b1)[_0x58a2('0x1e')](_0x4f7df6);};}exports['index']=function(_0x3c7b9a,_0x5308e2){var _0x276194={};var _0x25d705={'count':0x0,'rows':[]};var _0x34b7d9=_[_0x58a2('0x1f')](db[_0x58a2('0x20')][_0x58a2('0x21')],function(_0x1226cc){return{'name':_0x1226cc[_0x58a2('0x22')],'type':_0x1226cc[_0x58a2('0x23')][_0x58a2('0x24')]};});_0x276194=qs[_0x58a2('0x25')](_0x34b7d9,_0x3c7b9a);var _0x4bff13={'where':_0x276194[_0x58a2('0x26')]};return db[_0x58a2('0x20')][_0x58a2('0x12')](_0x4bff13)[_0x58a2('0x15')](function(_0x1f59d0){_0x25d705[_0x58a2('0x12')]=_0x1f59d0;_0x276194[_0x58a2('0x27')]=qs[_0x58a2('0x27')](_0x3c7b9a[_0x58a2('0x28')]);return db['ChatQueue'][_0x58a2('0x29')](_0x276194);})[_0x58a2('0x15')](function(_0x575a97){_0x25d705[_0x58a2('0x2a')]=_0x575a97;return _0x25d705;})['then'](respondWithFilteredResult(_0x5308e2,_0x276194))[_0x58a2('0x2b')](handleError(_0x5308e2,null));};exports[_0x58a2('0x2c')]=function(_0x423feb,_0x175a4d){var _0x508374={'raw':!![],'where':{'id':_0x423feb['params']['id']}},_0x123ef3={};_0x123ef3[_0x58a2('0x2d')]=_[_0x58a2('0x2e')](db['ChatQueue']['rawAttributes']);_0x123ef3[_0x58a2('0x28')]=_[_0x58a2('0x2e')](_0x423feb[_0x58a2('0x28')]);_0x123ef3['filters']=_['intersection'](_0x123ef3[_0x58a2('0x2d')],_0x123ef3[_0x58a2('0x28')]);_0x508374['attributes']=_[_0x58a2('0x2f')](_0x123ef3['model'],qs[_0x58a2('0x30')](_0x423feb['query']['fields']));_0x508374[_0x58a2('0x31')]=_0x508374[_0x58a2('0x31')]['length']?_0x508374[_0x58a2('0x31')]:_0x123ef3['model'];if(_0x423feb['query']['includeAll']){_0x508374[_0x58a2('0x27')]=[{'all':!![]}];}_0x508374=_[_0x58a2('0x32')]({},_0x508374,_0x423feb[_0x58a2('0x33')]);return db[_0x58a2('0x20')][_0x58a2('0x34')](_0x508374)[_0x58a2('0x15')](handleEntityNotFound(_0x175a4d,null))[_0x58a2('0x15')](respondWithResult(_0x175a4d,null))[_0x58a2('0x2b')](handleError(_0x175a4d,null));};exports[_0x58a2('0x35')]=function(_0xee6ac6,_0x4d0c86){return db[_0x58a2('0x20')]['create'](_0xee6ac6[_0x58a2('0x36')],{})[_0x58a2('0x15')](function(_0x377aa1){var _0x3eacc0=_0xee6ac6['user'][_0x58a2('0x17')]({'plain':!![]});if(!_0x3eacc0)throw new Error(_0x58a2('0x37'));if(_0x3eacc0[_0x58a2('0x38')]===_0x58a2('0x39')){var _0x584899=_0x377aa1[_0x58a2('0x17')]({'plain':!![]});var _0x5a9215='ChatQueues';return db[_0x58a2('0x3a')][_0x58a2('0x34')]({'where':{'name':_0x5a9215,'userProfileId':_0x3eacc0[_0x58a2('0x3b')]},'raw':!![]})[_0x58a2('0x15')](function(_0x3387a2){if(_0x3387a2&&_0x3387a2['autoAssociation']===0x0){return db[_0x58a2('0x19')][_0x58a2('0x35')]({'name':_0x584899['name'],'resourceId':_0x584899['id'],'type':_0x3387a2['name'],'sectionId':_0x3387a2['id']},{})[_0x58a2('0x15')](function(){return _0x377aa1;});}else{return _0x377aa1;}})['catch'](function(_0x58d4e8){logger['error'](_0x58a2('0x3c'),_0x58d4e8);throw _0x58d4e8;});}return _0x377aa1;})[_0x58a2('0x15')](respondWithResult(_0x4d0c86,0xc9))[_0x58a2('0x2b')](handleError(_0x4d0c86,null));};exports['update']=function(_0x1edab5,_0xfc281b){if(_0x1edab5[_0x58a2('0x36')]['id']){delete _0x1edab5['body']['id'];}return db[_0x58a2('0x20')]['find']({'where':{'id':_0x1edab5[_0x58a2('0x3d')]['id']}})[_0x58a2('0x15')](handleEntityNotFound(_0xfc281b,null))[_0x58a2('0x15')](saveUpdates(_0x1edab5[_0x58a2('0x36')],null))['then'](respondWithResult(_0xfc281b,null))['catch'](handleError(_0xfc281b,null));};exports[_0x58a2('0x16')]=function(_0x47f8df,_0x20a731){return db['ChatQueue'][_0x58a2('0x34')]({'where':{'id':_0x47f8df[_0x58a2('0x3d')]['id']}})['then'](handleEntityNotFound(_0x20a731,null))[_0x58a2('0x15')](removeEntity(_0x20a731,null))[_0x58a2('0x2b')](handleError(_0x20a731,null));};exports['describe']=function(_0x4917f8,_0x7903c9){return db['ChatQueue']['describe']()[_0x58a2('0x15')](respondWithResult(_0x7903c9,null))[_0x58a2('0x2b')](handleError(_0x7903c9,null));};exports[_0x58a2('0x3e')]=function(_0x20ee69,_0x3058cd){var _0x2220c8={'raw':!![],'where':{}},_0x168454={},_0xd1b879;return db[_0x58a2('0x20')][_0x58a2('0x3f')]({'where':{'id':_0x20ee69[_0x58a2('0x3d')]['id']}})[_0x58a2('0x15')](handleEntityNotFound(_0x3058cd,null))[_0x58a2('0x15')](function(_0x193836){if(_0x193836){_0xd1b879=_0x193836[_0x58a2('0x17')]({'plain':!![]});_0x168454[_0x58a2('0x2d')]=_[_0x58a2('0x2e')](db['UserChatQueue']['rawAttributes']);_0x168454[_0x58a2('0x28')]=_[_0x58a2('0x2e')](_0x20ee69[_0x58a2('0x28')]);_0x168454['filters']=_[_0x58a2('0x2f')](_0x168454[_0x58a2('0x2d')],_0x168454[_0x58a2('0x28')]);_0x2220c8[_0x58a2('0x31')]=_[_0x58a2('0x2f')](_0x168454[_0x58a2('0x2d')],qs[_0x58a2('0x30')](_0x20ee69[_0x58a2('0x28')][_0x58a2('0x30')]));_0x2220c8['attributes']=_0x2220c8[_0x58a2('0x31')][_0x58a2('0x40')]?_0x2220c8['attributes']:_0x168454[_0x58a2('0x2d')];if(!_0x20ee69['query']['hasOwnProperty'](_0x58a2('0x41'))){_0x2220c8[_0x58a2('0x13')]=qs['limit'](_0x20ee69[_0x58a2('0x28')][_0x58a2('0x13')]);_0x2220c8[_0x58a2('0x10')]=qs[_0x58a2('0x10')](_0x20ee69['query']['offset']);}_0x2220c8[_0x58a2('0x42')]=qs[_0x58a2('0x43')](_0x20ee69['query'][_0x58a2('0x43')]);_0x2220c8[_0x58a2('0x26')]=qs[_0x58a2('0x44')](_[_0x58a2('0x45')](_0x20ee69[_0x58a2('0x28')],_0x168454[_0x58a2('0x44')]));_0x2220c8[_0x58a2('0x26')]['ChatQueueId']=_0x193836['id'];if(_0x20ee69[_0x58a2('0x28')]['filter']){_0x2220c8['where']=_[_0x58a2('0x32')](_0x2220c8[_0x58a2('0x26')],{'$or':_[_0x58a2('0x1f')](_0x2220c8['attributes'],function(_0x402d5b){var _0x278f55={};_0x278f55[_0x402d5b]={'$like':'%'+_0x20ee69[_0x58a2('0x28')]['filter']+'%'};return _0x278f55;})});}_0x2220c8=_[_0x58a2('0x32')]({},_0x2220c8,_0x20ee69[_0x58a2('0x33')]);return db[_0x58a2('0x46')][_0x58a2('0x29')](_0x2220c8);}})[_0x58a2('0x15')](function(_0x366175){if(_0x366175){return db['User'][_0x58a2('0x47')]({'where':{'id':_['map'](_0x366175,'UserId'),'role':_0x58a2('0x48')},'attributes':['id',_0x58a2('0x1d'),_0x58a2('0x49'),'updatedAt',_0x58a2('0x4a')]});}})[_0x58a2('0x15')](function(_0x5f5d55){if(_0x5f5d55){return{'count':_0x5f5d55[_0x58a2('0x12')],'rows':_[_0x58a2('0x1f')](_0x5f5d55[_0x58a2('0x2a')],function(_0x4fd85a){return{'membername':_0x4fd85a[_0x58a2('0x1d')],'UserId':_0x4fd85a['id'],'queue_name':_0xd1b879[_0x58a2('0x1d')],'ChatQueueId':_0xd1b879['id'],'interface':util['format'](_0x58a2('0x4b'),_0x58a2('0x4c'),_0x4fd85a[_0x58a2('0x1d')]),'penalty':0x0,'paused':_0x4fd85a[_0x58a2('0x49')],'createdAt':_0x4fd85a[_0x58a2('0x4a')],'updatedAt':_0x4fd85a[_0x58a2('0x4d')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x3058cd,_0x2220c8))[_0x58a2('0x2b')](handleError(_0x3058cd,null));};exports[_0x58a2('0x4e')]=function(_0x383316,_0x5da002){var _0x5c4598={};var _0x4ac150={};var _0x2519a8;var _0x2b7637;return db['ChatQueue'][_0x58a2('0x3f')]({'where':{'id':_0x383316[_0x58a2('0x3d')]['id']}})['then'](handleEntityNotFound(_0x5da002,null))[_0x58a2('0x15')](function(_0x5d6550){if(_0x5d6550){_0x2519a8=_0x5d6550;_0x4ac150['model']=_[_0x58a2('0x2e')](db[_0x58a2('0x4f')][_0x58a2('0x21')]);_0x4ac150[_0x58a2('0x28')]=_[_0x58a2('0x2e')](_0x383316[_0x58a2('0x28')]);_0x4ac150[_0x58a2('0x44')]=_[_0x58a2('0x2f')](_0x4ac150[_0x58a2('0x2d')],_0x4ac150[_0x58a2('0x28')]);_0x5c4598[_0x58a2('0x31')]=_[_0x58a2('0x2f')](_0x4ac150[_0x58a2('0x2d')],qs[_0x58a2('0x30')](_0x383316[_0x58a2('0x28')][_0x58a2('0x30')]));_0x5c4598[_0x58a2('0x31')]=_0x5c4598[_0x58a2('0x31')][_0x58a2('0x40')]?_0x5c4598['attributes']:_0x4ac150[_0x58a2('0x2d')];_0x5c4598['order']=qs[_0x58a2('0x43')](_0x383316[_0x58a2('0x28')][_0x58a2('0x43')]);_0x5c4598[_0x58a2('0x26')]=qs['filters'](_['pick'](_0x383316['query'],_0x4ac150[_0x58a2('0x44')]));if(_0x383316[_0x58a2('0x28')]['filter']){_0x5c4598[_0x58a2('0x26')]=_[_0x58a2('0x32')](_0x5c4598[_0x58a2('0x26')],{'$or':_[_0x58a2('0x1f')](_0x5c4598[_0x58a2('0x31')],function(_0x1dab55){var _0x5b6166={};_0x5b6166[_0x1dab55]={'$like':'%'+_0x383316['query'][_0x58a2('0x50')]+'%'};return _0x5b6166;})});}_0x5c4598=_[_0x58a2('0x32')]({},_0x5c4598,_0x383316[_0x58a2('0x33')]);return _0x2519a8[_0x58a2('0x4e')](_0x5c4598);}})[_0x58a2('0x15')](function(_0x241163){if(_0x241163){_0x2b7637=_0x241163['length'];if(!_0x383316[_0x58a2('0x28')]['hasOwnProperty'](_0x58a2('0x41'))){_0x5c4598[_0x58a2('0x13')]=qs['limit'](_0x383316['query']['limit']);_0x5c4598[_0x58a2('0x10')]=qs[_0x58a2('0x10')](_0x383316[_0x58a2('0x28')][_0x58a2('0x10')]);}return _0x2519a8['getTeams'](_0x5c4598);}})['then'](function(_0x16c1ec){if(_0x16c1ec){return _0x16c1ec?{'count':_0x2b7637,'rows':_0x16c1ec}:null;}})['then'](respondWithResult(_0x5da002,null))[_0x58a2('0x2b')](handleError(_0x5da002,null));};exports['addTeams']=function(_0xa1f741,_0x2f0d0e){var _0x400fd2=_0xa1f741[_0x58a2('0x36')][_0x58a2('0x51')];return db['Team'][_0x58a2('0x29')]({'where':{'id':_0x400fd2},'attributes':['id'],'include':[{'model':db[_0x58a2('0x52')],'as':_0x58a2('0x53'),'attributes':['id','name','online',_0x58a2('0x54'),_0x58a2('0x55')],'raw':!![]}]})[_0x58a2('0x15')](function(_0x45879d){if(_0x45879d){var _0x1077a5=_[_0x58a2('0x56')](_0x45879d,function(_0xc99838){var _0x31e992=_0xc99838[_0x58a2('0x17')]({'plain':!![]});return _0x31e992[_0x58a2('0x53')];});return db[_0x58a2('0x20')]['find']({'where':{'id':_0xa1f741[_0x58a2('0x3d')]['id']}})[_0x58a2('0x15')](function(_0x343d0a){return db[_0x58a2('0x57')]['transaction'](function(_0x408ffc){return _0x343d0a[_0x58a2('0x58')](_0x400fd2,{'transaction':_0x408ffc})[_0x58a2('0x15')](function(){return BPromise[_0x58a2('0x59')](_0x1077a5,function(_0x24ab2b){return db['UserChatQueue'][_0x58a2('0x5a')]({'where':{'UserId':_0x24ab2b['id'],'ChatQueueId':_0xa1f741['params']['id']},'transaction':_0x408ffc});});})[_0x58a2('0x15')](function(){_0x1077a5['forEach'](function(_0x5e2a9c){socket['emit'](_0x58a2('0x5b'),{'UserId':_0x5e2a9c['id'],'ChatQueueId':_0x343d0a['id']});});});});});}})[_0x58a2('0x15')](respondWithStatusCode(_0x2f0d0e,null))['catch'](handleError(_0x2f0d0e,null));};exports[_0x58a2('0x5c')]=function(_0x3da9fc,_0x47efb4){return db[_0x58a2('0x4f')]['findAll']({'where':{'id':_0x3da9fc[_0x58a2('0x28')][_0x58a2('0x51')]},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x58a2('0x15')](handleEntityNotFound(_0x47efb4,null))[_0x58a2('0x15')](function(_0x3b03f6){var _0x51a593=_[_0x58a2('0x1f')](_0x3b03f6,'id');var _0xed6d92=[];var _0x301afd=[];var _0x993553=squel['select']();_0x993553[_0x58a2('0x5d')](_0x58a2('0x5e'))[_0x58a2('0x5f')]('team_has_chat_queues','tq')['join']('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')['where'](_0x58a2('0x60'),_0x3da9fc[_0x58a2('0x3d')]['id']);for(var _0x103ca0=0x0;_0x103ca0<_0x3b03f6[_0x58a2('0x40')];_0x103ca0+=0x1){let _0x4371fc=_0x3b03f6[_0x103ca0];for(var _0x1958a7=0x0;_0x1958a7<_0x4371fc[_0x58a2('0x53')][_0x58a2('0x40')];_0x1958a7+=0x1){let _0x48d0e1=_0x4371fc[_0x58a2('0x53')][_0x1958a7];var _0x15642b=_0x993553['clone']();_0x15642b[_0x58a2('0x26')](_0x58a2('0x61'),_0x48d0e1['id']);_0x301afd[_0x58a2('0x62')](db[_0x58a2('0x57')][_0x58a2('0x28')](_0x15642b['toString'](),{'type':db[_0x58a2('0x57')][_0x58a2('0x63')][_0x58a2('0x64')]})[_0x58a2('0x15')](function(_0x106ba3){if(_0x106ba3[_0x58a2('0x40')]===0x1){return _0x48d0e1['id'];}else{var _0x4c623b=_[_0x58a2('0x65')](_[_0x58a2('0x1f')](_0x106ba3,_0x58a2('0x66')),function(_0x1704aa){return _[_0x58a2('0x67')](_0x51a593,_0x1704aa);});if(_0x4c623b){return _0x48d0e1['id'];}}}));}}return BPromise[_0x58a2('0x68')](_0x301afd)[_0x58a2('0x15')](function(_0x2b381f){_0xed6d92=_(_0xed6d92)[_0x58a2('0x69')](_0x2b381f)['compact']()['value']();return db[_0x58a2('0x20')][_0x58a2('0x34')]({'where':{'id':_0x3da9fc['params']['id']}})['then'](function(_0xf3b157){return db[_0x58a2('0x57')][_0x58a2('0x6a')](function(_0x4483e5){return _0xf3b157[_0x58a2('0x5c')](_0x3da9fc[_0x58a2('0x28')][_0x58a2('0x51')],{'transaction':_0x4483e5})['then'](function(){if(!_[_0x58a2('0x6b')](_0xed6d92)){return _0xf3b157[_0x58a2('0x6c')](_0xed6d92,{'transaction':_0x4483e5});}})[_0x58a2('0x15')](function(){_0xed6d92['forEach'](function(_0x1b0ec7){socket[_0x58a2('0x6d')](_0x58a2('0x6e'),{'UserId':_0x1b0ec7,'ChatQueueId':_0xf3b157['id']});});});});});});})[_0x58a2('0x15')](respondWithStatusCode(_0x47efb4,null))[_0x58a2('0x2b')](handleError(_0x47efb4,null));};exports['addAgents']=function(_0x510463,_0x33e19a){return db['ChatQueue']['find']({'where':{'id':_0x510463[_0x58a2('0x3d')]['id']}})[_0x58a2('0x15')](handleEntityNotFound(_0x33e19a,null))['then'](function(_0x200108){if(_0x200108){return _0x200108['addAgents'](_0x510463[_0x58a2('0x36')][_0x58a2('0x51')],_[_0x58a2('0x6f')](_0x510463[_0x58a2('0x36')],['ids','id'])||{})[_0x58a2('0x70')](function(_0x713134){for(var _0x2bb710=0x0;_0x2bb710<_0x510463['body'][_0x58a2('0x51')]['length'];_0x2bb710+=0x1){socket[_0x58a2('0x6d')](_0x58a2('0x5b'),{'UserId':Number(_0x510463[_0x58a2('0x36')][_0x58a2('0x51')][_0x2bb710]),'ChatQueueId':Number(_0x510463[_0x58a2('0x3d')]['id'])});}return _0x713134;});}})['then'](respondWithResult(_0x33e19a,null))[_0x58a2('0x2b')](handleError(_0x33e19a,null));};exports[_0x58a2('0x6c')]=function(_0x1da349,_0x3f6905){return db[_0x58a2('0x20')]['find']({'where':{'id':_0x1da349[_0x58a2('0x3d')]['id']}})[_0x58a2('0x15')](handleEntityNotFound(_0x3f6905,null))[_0x58a2('0x15')](function(_0x426f93){if(_0x426f93){return _0x426f93[_0x58a2('0x6c')](_0x1da349[_0x58a2('0x28')]['ids'])['then'](function(){if(_[_0x58a2('0x71')](_0x1da349[_0x58a2('0x28')][_0x58a2('0x51')])){for(var _0x3dd624=0x0;_0x3dd624<_0x1da349['query'][_0x58a2('0x51')][_0x58a2('0x40')];_0x3dd624+=0x1){socket[_0x58a2('0x6d')](_0x58a2('0x6e'),{'UserId':Number(_0x1da349[_0x58a2('0x28')][_0x58a2('0x51')][_0x3dd624]),'ChatQueueId':Number(_0x1da349[_0x58a2('0x3d')]['id'])});}}else{socket[_0x58a2('0x6d')](_0x58a2('0x6e'),{'UserId':Number(_0x1da349[_0x58a2('0x28')][_0x58a2('0x51')]),'ChatQueueId':Number(_0x1da349[_0x58a2('0x3d')]['id'])});}});}})[_0x58a2('0x15')](respondWithStatusCode(_0x3f6905,null))[_0x58a2('0x2b')](handleError(_0x3f6905,null));};exports[_0x58a2('0x72')]=function(_0x59866c,_0x49f3e0){var _0x3c020e={};var _0x257131={};var _0x28f0d7;var _0x3e3757;return db[_0x58a2('0x20')][_0x58a2('0x3f')]({'where':{'id':_0x59866c[_0x58a2('0x3d')]['id']}})[_0x58a2('0x15')](handleEntityNotFound(_0x49f3e0,null))[_0x58a2('0x15')](function(_0x238396){if(_0x238396){_0x28f0d7=_0x238396;_0x257131[_0x58a2('0x2d')]=_[_0x58a2('0x2e')](db[_0x58a2('0x52')][_0x58a2('0x21')]);_0x257131[_0x58a2('0x28')]=_[_0x58a2('0x2e')](_0x59866c[_0x58a2('0x28')]);_0x257131[_0x58a2('0x44')]=_[_0x58a2('0x2f')](_0x257131[_0x58a2('0x2d')],_0x257131[_0x58a2('0x28')]);_0x3c020e[_0x58a2('0x31')]=_[_0x58a2('0x2f')](_0x257131[_0x58a2('0x2d')],qs[_0x58a2('0x30')](_0x59866c['query']['fields']));_0x3c020e[_0x58a2('0x31')]=_0x3c020e[_0x58a2('0x31')][_0x58a2('0x40')]?_0x3c020e[_0x58a2('0x31')]:_0x257131[_0x58a2('0x2d')];_0x3c020e[_0x58a2('0x42')]=qs[_0x58a2('0x43')](_0x59866c[_0x58a2('0x28')]['sort']);_0x3c020e[_0x58a2('0x26')]=qs['filters'](_[_0x58a2('0x45')](_0x59866c['query'],_0x257131[_0x58a2('0x44')]));if(_0x59866c[_0x58a2('0x28')]['filter']){_0x3c020e['where']=_[_0x58a2('0x32')](_0x3c020e['where'],{'$or':_[_0x58a2('0x1f')](_0x3c020e[_0x58a2('0x31')],function(_0x5cbfb){var _0xe08006={};_0xe08006[_0x5cbfb]={'$like':'%'+_0x59866c['query'][_0x58a2('0x50')]+'%'};return _0xe08006;})});}_0x3c020e=_[_0x58a2('0x32')]({},_0x3c020e,_0x59866c[_0x58a2('0x33')]);return _0x28f0d7[_0x58a2('0x72')](_0x3c020e);}})[_0x58a2('0x15')](function(_0x5dc26c){if(_0x5dc26c){_0x3e3757=_0x5dc26c[_0x58a2('0x40')];if(!_0x59866c[_0x58a2('0x28')]['hasOwnProperty'](_0x58a2('0x41'))){_0x3c020e[_0x58a2('0x13')]=qs[_0x58a2('0x13')](_0x59866c['query']['limit']);_0x3c020e[_0x58a2('0x10')]=qs[_0x58a2('0x10')](_0x59866c[_0x58a2('0x28')][_0x58a2('0x10')]);}return _0x28f0d7[_0x58a2('0x72')](_0x3c020e);}})[_0x58a2('0x15')](function(_0x2fb75c){if(_0x2fb75c){return _0x2fb75c?{'count':_0x3e3757,'rows':_0x2fb75c}:null;}})[_0x58a2('0x15')](respondWithResult(_0x49f3e0,null))['catch'](handleError(_0x49f3e0,null));}; \ No newline at end of file +var _0x879c=['sendStatus','error','stack','name','index','map','fieldName','type','key','getOptions','where','ChatQueue','count','include','query','findAll','rows','catch','show','params','model','keys','rawAttributes','intersection','attributes','fields','length','includeAll','merge','options','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','describe','getMembers','findOne','UserChatQueue','filters','hasOwnProperty','nolimit','limit','order','sort','pick','ChatQueueId','filter','findAndCountAll','UserId','agent','chatPause','updatedAt','createdAt','Team','getTeams','addTeams','ids','User','online','interface','flatMap','Agents','sequelize','transaction','each','forEach','userChatQueue:save','removeTeams','select','field','from','user_has_teams','ChatQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','value','isEmpty','removeAgents','userChatQueue:remove','addAgents','omit','spread','emit','getAgents','bluebird','util','squel','ioredis','../../components/parsers/qs','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','end','undefined','offset','status','set','Content-Range','json','update','then','destroy','ChatQueues','UserProfileResource'];(function(_0x390fa7,_0xb1b52c){var _0x3dddbe=function(_0x5aa8e6){while(--_0x5aa8e6){_0x390fa7['push'](_0x390fa7['shift']());}};_0x3dddbe(++_0xb1b52c);}(_0x879c,0x153));var _0xc879=function(_0x3ccc28,_0x5036d5){_0x3ccc28=_0x3ccc28-0x0;var _0x47dd45=_0x879c[_0x3ccc28];return _0x47dd45;};'use strict';var BPromise=require(_0xc879('0x0'));var util=require(_0xc879('0x1'));var _=require('lodash');var squel=require(_0xc879('0x2'));var Redis=require(_0xc879('0x3'));var qs=require(_0xc879('0x4'));var logger=require('../../config/logger')('api');var config=require(_0xc879('0x5'));var db=require(_0xc879('0x6'))['db'];config[_0xc879('0x7')]=_[_0xc879('0x8')](config[_0xc879('0x7')],{'host':_0xc879('0x9'),'port':0x18eb});var socket=require(_0xc879('0xa'))(new Redis(config[_0xc879('0x7')]));require('./chatQueue.socket')[_0xc879('0xb')](socket);function respondWithStatusCode(_0x18a3d2,_0x157f6c){_0x157f6c=_0x157f6c||0xcc;return function(_0x3700ce){if(_0x3700ce){return _0x18a3d2['sendStatus'](_0x157f6c);}return _0x18a3d2['status'](_0x157f6c)[_0xc879('0xc')]();};}function respondWithResult(_0x38715a,_0x1c6263){_0x1c6263=_0x1c6263||0xc8;return function(_0x1f13b9){if(_0x1f13b9){return _0x38715a['status'](_0x1c6263)['json'](_0x1f13b9);}};}function respondWithFilteredResult(_0x2e5829,_0x375941){return function(_0x2c2653){if(_0x2c2653){var _0x5478b2=typeof _0x375941['offset']==='undefined'&&typeof _0x375941['limit']===_0xc879('0xd');var _0x6f9cab=_0x2c2653['count'];var _0x483ba6=_0x5478b2?0x0:_0x375941[_0xc879('0xe')];var _0x31c9ed=_0x5478b2?_0x2c2653['count']:_0x375941[_0xc879('0xe')]+_0x375941['limit'];var _0x4841c4;if(_0x31c9ed>=_0x6f9cab){_0x31c9ed=_0x6f9cab;_0x4841c4=0xc8;}else{_0x4841c4=0xce;}_0x2e5829[_0xc879('0xf')](_0x4841c4);return _0x2e5829[_0xc879('0x10')](_0xc879('0x11'),_0x483ba6+'-'+_0x31c9ed+'/'+_0x6f9cab)[_0xc879('0x12')](_0x2c2653);}return null;};}function saveUpdates(_0x21b975){return function(_0x8631c3){if(_0x8631c3){return _0x8631c3[_0xc879('0x13')](_0x21b975)[_0xc879('0x14')](function(_0x50fe4a){return _0x50fe4a;});}return null;};}function removeEntity(_0x19d6b7){return function(_0x4aca43){if(_0x4aca43){return _0x4aca43[_0xc879('0x15')]()[_0xc879('0x14')](function(){var _0x324ff3=_0x4aca43['get']({'plain':!![]});var _0x460655=_0xc879('0x16');return db[_0xc879('0x17')]['destroy']({'where':{'type':_0x460655,'resourceId':_0x324ff3['id']}})[_0xc879('0x14')](function(){return _0x4aca43;});})[_0xc879('0x14')](function(){_0x19d6b7['status'](0xcc)[_0xc879('0xc')]();});}};}function handleEntityNotFound(_0x31301c){return function(_0x5a1968){if(!_0x5a1968){_0x31301c[_0xc879('0x18')](0x194);}return _0x5a1968;};}function handleError(_0x2044ce,_0x58c9dc){_0x58c9dc=_0x58c9dc||0x1f4;return function(_0x183ae5){logger[_0xc879('0x19')](_0x183ae5[_0xc879('0x1a')]);if(_0x183ae5[_0xc879('0x1b')]){delete _0x183ae5[_0xc879('0x1b')];}_0x2044ce[_0xc879('0xf')](_0x58c9dc)['send'](_0x183ae5);};}exports[_0xc879('0x1c')]=function(_0xb61693,_0x3243ce){var _0x31e0d5={};var _0x19b2df={'count':0x0,'rows':[]};var _0xfdda72=_[_0xc879('0x1d')](db['ChatQueue']['rawAttributes'],function(_0x1a6165){return{'name':_0x1a6165[_0xc879('0x1e')],'type':_0x1a6165[_0xc879('0x1f')][_0xc879('0x20')]};});_0x31e0d5=qs[_0xc879('0x21')](_0xfdda72,_0xb61693);var _0x5a2b91={'where':_0x31e0d5[_0xc879('0x22')]};return db[_0xc879('0x23')][_0xc879('0x24')](_0x5a2b91)['then'](function(_0x4eed06){_0x19b2df[_0xc879('0x24')]=_0x4eed06;_0x31e0d5[_0xc879('0x25')]=qs[_0xc879('0x25')](_0xb61693[_0xc879('0x26')]);return db[_0xc879('0x23')][_0xc879('0x27')](_0x31e0d5);})[_0xc879('0x14')](function(_0x25a8a5){_0x19b2df[_0xc879('0x28')]=_0x25a8a5;return _0x19b2df;})[_0xc879('0x14')](respondWithFilteredResult(_0x3243ce,_0x31e0d5))[_0xc879('0x29')](handleError(_0x3243ce,null));};exports[_0xc879('0x2a')]=function(_0x2c16b1,_0x507968){var _0x1a5359={'raw':!![],'where':{'id':_0x2c16b1[_0xc879('0x2b')]['id']}},_0x451e31={};_0x451e31[_0xc879('0x2c')]=_[_0xc879('0x2d')](db[_0xc879('0x23')][_0xc879('0x2e')]);_0x451e31[_0xc879('0x26')]=_[_0xc879('0x2d')](_0x2c16b1[_0xc879('0x26')]);_0x451e31['filters']=_[_0xc879('0x2f')](_0x451e31[_0xc879('0x2c')],_0x451e31['query']);_0x1a5359[_0xc879('0x30')]=_[_0xc879('0x2f')](_0x451e31[_0xc879('0x2c')],qs[_0xc879('0x31')](_0x2c16b1['query'][_0xc879('0x31')]));_0x1a5359[_0xc879('0x30')]=_0x1a5359['attributes'][_0xc879('0x32')]?_0x1a5359['attributes']:_0x451e31['model'];if(_0x2c16b1[_0xc879('0x26')][_0xc879('0x33')]){_0x1a5359['include']=[{'all':!![]}];}_0x1a5359=_[_0xc879('0x34')]({},_0x1a5359,_0x2c16b1[_0xc879('0x35')]);return db[_0xc879('0x23')][_0xc879('0x36')](_0x1a5359)['then'](handleEntityNotFound(_0x507968,null))[_0xc879('0x14')](respondWithResult(_0x507968,null))[_0xc879('0x29')](handleError(_0x507968,null));};exports[_0xc879('0x37')]=function(_0x129f85,_0x105d4c){return db[_0xc879('0x23')][_0xc879('0x37')](_0x129f85[_0xc879('0x38')],{})['then'](function(_0x5d3cce){var _0x2591b2=_0x129f85[_0xc879('0x39')][_0xc879('0x3a')]({'plain':!![]});if(!_0x2591b2)throw new Error(_0xc879('0x3b'));if(_0x2591b2[_0xc879('0x3c')]===_0xc879('0x39')){var _0x16fb1a=_0x5d3cce[_0xc879('0x3a')]({'plain':!![]});var _0x19210e=_0xc879('0x16');return db[_0xc879('0x3d')]['find']({'where':{'name':_0x19210e,'userProfileId':_0x2591b2[_0xc879('0x3e')]},'raw':!![]})[_0xc879('0x14')](function(_0x501ce6){if(_0x501ce6&&_0x501ce6['autoAssociation']===0x0){return db[_0xc879('0x17')]['create']({'name':_0x16fb1a['name'],'resourceId':_0x16fb1a['id'],'type':_0x501ce6[_0xc879('0x1b')],'sectionId':_0x501ce6['id']},{})[_0xc879('0x14')](function(){return _0x5d3cce;});}else{return _0x5d3cce;}})[_0xc879('0x29')](function(_0x42b378){logger[_0xc879('0x19')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x42b378);throw _0x42b378;});}return _0x5d3cce;})[_0xc879('0x14')](respondWithResult(_0x105d4c,0xc9))[_0xc879('0x29')](handleError(_0x105d4c,null));};exports['update']=function(_0x237cb3,_0x24a9f4){if(_0x237cb3['body']['id']){delete _0x237cb3[_0xc879('0x38')]['id'];}return db[_0xc879('0x23')]['find']({'where':{'id':_0x237cb3[_0xc879('0x2b')]['id']}})[_0xc879('0x14')](handleEntityNotFound(_0x24a9f4,null))[_0xc879('0x14')](saveUpdates(_0x237cb3['body'],null))[_0xc879('0x14')](respondWithResult(_0x24a9f4,null))[_0xc879('0x29')](handleError(_0x24a9f4,null));};exports[_0xc879('0x15')]=function(_0x1ba7cc,_0x4abe70){return db[_0xc879('0x23')][_0xc879('0x36')]({'where':{'id':_0x1ba7cc['params']['id']}})[_0xc879('0x14')](handleEntityNotFound(_0x4abe70,null))[_0xc879('0x14')](removeEntity(_0x4abe70,null))[_0xc879('0x29')](handleError(_0x4abe70,null));};exports['describe']=function(_0x2c99ce,_0x461857){return db['ChatQueue'][_0xc879('0x3f')]()[_0xc879('0x14')](respondWithResult(_0x461857,null))[_0xc879('0x29')](handleError(_0x461857,null));};exports[_0xc879('0x40')]=function(_0x39a6b5,_0x4ff21d){var _0x2c70ae={'raw':!![],'where':{}},_0x3f7d89={},_0x46a3f0;return db[_0xc879('0x23')][_0xc879('0x41')]({'where':{'id':_0x39a6b5[_0xc879('0x2b')]['id']}})[_0xc879('0x14')](handleEntityNotFound(_0x4ff21d,null))[_0xc879('0x14')](function(_0x3f2db1){if(_0x3f2db1){_0x46a3f0=_0x3f2db1[_0xc879('0x3a')]({'plain':!![]});_0x3f7d89[_0xc879('0x2c')]=_[_0xc879('0x2d')](db[_0xc879('0x42')][_0xc879('0x2e')]);_0x3f7d89['query']=_[_0xc879('0x2d')](_0x39a6b5[_0xc879('0x26')]);_0x3f7d89[_0xc879('0x43')]=_[_0xc879('0x2f')](_0x3f7d89['model'],_0x3f7d89[_0xc879('0x26')]);_0x2c70ae[_0xc879('0x30')]=_[_0xc879('0x2f')](_0x3f7d89[_0xc879('0x2c')],qs['fields'](_0x39a6b5['query'][_0xc879('0x31')]));_0x2c70ae[_0xc879('0x30')]=_0x2c70ae[_0xc879('0x30')][_0xc879('0x32')]?_0x2c70ae[_0xc879('0x30')]:_0x3f7d89[_0xc879('0x2c')];if(!_0x39a6b5[_0xc879('0x26')][_0xc879('0x44')](_0xc879('0x45'))){_0x2c70ae[_0xc879('0x46')]=qs[_0xc879('0x46')](_0x39a6b5[_0xc879('0x26')][_0xc879('0x46')]);_0x2c70ae['offset']=qs[_0xc879('0xe')](_0x39a6b5[_0xc879('0x26')][_0xc879('0xe')]);}_0x2c70ae[_0xc879('0x47')]=qs[_0xc879('0x48')](_0x39a6b5['query'][_0xc879('0x48')]);_0x2c70ae[_0xc879('0x22')]=qs[_0xc879('0x43')](_[_0xc879('0x49')](_0x39a6b5[_0xc879('0x26')],_0x3f7d89[_0xc879('0x43')]));_0x2c70ae[_0xc879('0x22')][_0xc879('0x4a')]=_0x3f2db1['id'];if(_0x39a6b5[_0xc879('0x26')][_0xc879('0x4b')]){_0x2c70ae['where']=_[_0xc879('0x34')](_0x2c70ae[_0xc879('0x22')],{'$or':_[_0xc879('0x1d')](_0x2c70ae[_0xc879('0x30')],function(_0x21ae3e){var _0x81349e={};_0x81349e[_0x21ae3e]={'$like':'%'+_0x39a6b5[_0xc879('0x26')][_0xc879('0x4b')]+'%'};return _0x81349e;})});}_0x2c70ae=_[_0xc879('0x34')]({},_0x2c70ae,_0x39a6b5[_0xc879('0x35')]);return db[_0xc879('0x42')][_0xc879('0x27')](_0x2c70ae);}})['then'](function(_0x4d23bc){if(_0x4d23bc){return db['User'][_0xc879('0x4c')]({'where':{'id':_['map'](_0x4d23bc,_0xc879('0x4d')),'role':_0xc879('0x4e')},'attributes':['id',_0xc879('0x1b'),_0xc879('0x4f'),_0xc879('0x50'),_0xc879('0x51')]});}})[_0xc879('0x14')](function(_0x17a4f9){if(_0x17a4f9){return{'count':_0x17a4f9[_0xc879('0x24')],'rows':_[_0xc879('0x1d')](_0x17a4f9[_0xc879('0x28')],function(_0x376290){return{'membername':_0x376290['name'],'UserId':_0x376290['id'],'queue_name':_0x46a3f0[_0xc879('0x1b')],'ChatQueueId':_0x46a3f0['id'],'interface':util['format']('%s/%s','SIP',_0x376290[_0xc879('0x1b')]),'penalty':0x0,'paused':_0x376290[_0xc879('0x4f')],'createdAt':_0x376290['createdAt'],'updatedAt':_0x376290[_0xc879('0x50')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xc879('0x14')](respondWithFilteredResult(_0x4ff21d,_0x2c70ae))['catch'](handleError(_0x4ff21d,null));};exports['getTeams']=function(_0x47fbfb,_0x1ffdc9){var _0x38bb30={};var _0x391f3e={};var _0xdeeeaa;var _0x459452;return db['ChatQueue'][_0xc879('0x41')]({'where':{'id':_0x47fbfb[_0xc879('0x2b')]['id']}})['then'](handleEntityNotFound(_0x1ffdc9,null))[_0xc879('0x14')](function(_0x5b1cee){if(_0x5b1cee){_0xdeeeaa=_0x5b1cee;_0x391f3e[_0xc879('0x2c')]=_[_0xc879('0x2d')](db[_0xc879('0x52')][_0xc879('0x2e')]);_0x391f3e[_0xc879('0x26')]=_['keys'](_0x47fbfb['query']);_0x391f3e['filters']=_[_0xc879('0x2f')](_0x391f3e[_0xc879('0x2c')],_0x391f3e[_0xc879('0x26')]);_0x38bb30[_0xc879('0x30')]=_[_0xc879('0x2f')](_0x391f3e[_0xc879('0x2c')],qs['fields'](_0x47fbfb[_0xc879('0x26')][_0xc879('0x31')]));_0x38bb30[_0xc879('0x30')]=_0x38bb30[_0xc879('0x30')][_0xc879('0x32')]?_0x38bb30[_0xc879('0x30')]:_0x391f3e[_0xc879('0x2c')];_0x38bb30[_0xc879('0x47')]=qs[_0xc879('0x48')](_0x47fbfb[_0xc879('0x26')][_0xc879('0x48')]);_0x38bb30[_0xc879('0x22')]=qs[_0xc879('0x43')](_[_0xc879('0x49')](_0x47fbfb[_0xc879('0x26')],_0x391f3e[_0xc879('0x43')]));if(_0x47fbfb[_0xc879('0x26')][_0xc879('0x4b')]){_0x38bb30[_0xc879('0x22')]=_[_0xc879('0x34')](_0x38bb30[_0xc879('0x22')],{'$or':_[_0xc879('0x1d')](_0x38bb30[_0xc879('0x30')],function(_0x26a4d){var _0x4eff4c={};_0x4eff4c[_0x26a4d]={'$like':'%'+_0x47fbfb['query'][_0xc879('0x4b')]+'%'};return _0x4eff4c;})});}_0x38bb30=_[_0xc879('0x34')]({},_0x38bb30,_0x47fbfb[_0xc879('0x35')]);return _0xdeeeaa['getTeams'](_0x38bb30);}})[_0xc879('0x14')](function(_0x4cd76c){if(_0x4cd76c){_0x459452=_0x4cd76c[_0xc879('0x32')];if(!_0x47fbfb[_0xc879('0x26')][_0xc879('0x44')](_0xc879('0x45'))){_0x38bb30[_0xc879('0x46')]=qs[_0xc879('0x46')](_0x47fbfb[_0xc879('0x26')]['limit']);_0x38bb30['offset']=qs['offset'](_0x47fbfb[_0xc879('0x26')]['offset']);}return _0xdeeeaa[_0xc879('0x53')](_0x38bb30);}})[_0xc879('0x14')](function(_0x615d6f){if(_0x615d6f){return _0x615d6f?{'count':_0x459452,'rows':_0x615d6f}:null;}})[_0xc879('0x14')](respondWithResult(_0x1ffdc9,null))[_0xc879('0x29')](handleError(_0x1ffdc9,null));};exports[_0xc879('0x54')]=function(_0x3eeeee,_0x21d876){var _0xf97f1f=_0x3eeeee['body'][_0xc879('0x55')];return db[_0xc879('0x52')][_0xc879('0x27')]({'where':{'id':_0xf97f1f},'attributes':['id'],'include':[{'model':db[_0xc879('0x56')],'as':'Agents','attributes':['id',_0xc879('0x1b'),_0xc879('0x57'),'voicePause',_0xc879('0x58')],'raw':!![]}]})[_0xc879('0x14')](function(_0x5f06a6){if(_0x5f06a6){var _0x2c5fb6=_[_0xc879('0x59')](_0x5f06a6,function(_0x15af03){var _0x4f4e31=_0x15af03[_0xc879('0x3a')]({'plain':!![]});return _0x4f4e31[_0xc879('0x5a')];});return db[_0xc879('0x23')][_0xc879('0x36')]({'where':{'id':_0x3eeeee[_0xc879('0x2b')]['id']}})[_0xc879('0x14')](function(_0x166db5){return db[_0xc879('0x5b')][_0xc879('0x5c')](function(_0x55332b){return _0x166db5[_0xc879('0x54')](_0xf97f1f,{'transaction':_0x55332b})['then'](function(){return BPromise[_0xc879('0x5d')](_0x2c5fb6,function(_0x1868fa){return db[_0xc879('0x42')]['findOrCreate']({'where':{'UserId':_0x1868fa['id'],'ChatQueueId':_0x3eeeee[_0xc879('0x2b')]['id']},'transaction':_0x55332b});});})[_0xc879('0x14')](function(){_0x2c5fb6[_0xc879('0x5e')](function(_0x5afa40){socket['emit'](_0xc879('0x5f'),{'UserId':_0x5afa40['id'],'ChatQueueId':_0x166db5['id']});});});});});}})[_0xc879('0x14')](respondWithStatusCode(_0x21d876,null))[_0xc879('0x29')](handleError(_0x21d876,null));};exports[_0xc879('0x60')]=function(_0x3bcdf2,_0x3a625a){return db[_0xc879('0x52')][_0xc879('0x27')]({'where':{'id':_0x3bcdf2[_0xc879('0x26')][_0xc879('0x55')]},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xc879('0x14')](handleEntityNotFound(_0x3a625a,null))['then'](function(_0x1b9b46){var _0x3cbf87=_[_0xc879('0x1d')](_0x1b9b46,'id');var _0x56870f=[];var _0x160ed5=[];var _0x4ec3af=squel[_0xc879('0x61')]();_0x4ec3af[_0xc879('0x62')]('tq.TeamId')[_0xc879('0x63')]('team_has_chat_queues','tq')['join'](_0xc879('0x64'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0xc879('0x22')](_0xc879('0x65'),_0x3bcdf2[_0xc879('0x2b')]['id']);for(var _0x86455e=0x0;_0x86455e<_0x1b9b46[_0xc879('0x32')];_0x86455e+=0x1){let _0x23d53c=_0x1b9b46[_0x86455e];for(var _0xc0bbc1=0x0;_0xc0bbc1<_0x23d53c[_0xc879('0x5a')][_0xc879('0x32')];_0xc0bbc1+=0x1){let _0x3f830c=_0x23d53c[_0xc879('0x5a')][_0xc0bbc1];var _0x18aebb=_0x4ec3af[_0xc879('0x66')]();_0x18aebb[_0xc879('0x22')](_0xc879('0x67'),_0x3f830c['id']);_0x160ed5['push'](db[_0xc879('0x5b')][_0xc879('0x26')](_0x18aebb['toString'](),{'type':db[_0xc879('0x5b')][_0xc879('0x68')][_0xc879('0x69')]})[_0xc879('0x14')](function(_0x51fa7f){if(_0x51fa7f[_0xc879('0x32')]===0x1){return _0x3f830c['id'];}else{var _0x4a5042=_[_0xc879('0x6a')](_[_0xc879('0x1d')](_0x51fa7f,_0xc879('0x6b')),function(_0x5ec0aa){return _[_0xc879('0x6c')](_0x3cbf87,_0x5ec0aa);});if(_0x4a5042){return _0x3f830c['id'];}}}));}}return BPromise[_0xc879('0x6d')](_0x160ed5)['then'](function(_0x3cb142){_0x56870f=_(_0x56870f)[_0xc879('0x6e')](_0x3cb142)[_0xc879('0x6f')]()[_0xc879('0x70')]();return db[_0xc879('0x23')][_0xc879('0x36')]({'where':{'id':_0x3bcdf2['params']['id']}})[_0xc879('0x14')](function(_0x48fb57){return db[_0xc879('0x5b')][_0xc879('0x5c')](function(_0x1366bc){return _0x48fb57['removeTeams'](_0x3bcdf2['query'][_0xc879('0x55')],{'transaction':_0x1366bc})[_0xc879('0x14')](function(){if(!_[_0xc879('0x71')](_0x56870f)){return _0x48fb57[_0xc879('0x72')](_0x56870f,{'transaction':_0x1366bc});}})[_0xc879('0x14')](function(){_0x56870f[_0xc879('0x5e')](function(_0x208c3a){socket['emit'](_0xc879('0x73'),{'UserId':_0x208c3a,'ChatQueueId':_0x48fb57['id']});});});});});});})[_0xc879('0x14')](respondWithStatusCode(_0x3a625a,null))['catch'](handleError(_0x3a625a,null));};exports[_0xc879('0x74')]=function(_0x18572f,_0x527029){return db[_0xc879('0x23')]['find']({'where':{'id':_0x18572f[_0xc879('0x2b')]['id']}})[_0xc879('0x14')](handleEntityNotFound(_0x527029,null))[_0xc879('0x14')](function(_0x4da649){if(_0x4da649){return _0x4da649['addAgents'](_0x18572f['body']['ids'],_[_0xc879('0x75')](_0x18572f[_0xc879('0x38')],[_0xc879('0x55'),'id'])||{})[_0xc879('0x76')](function(_0x14ef02){for(var _0x45f866=0x0;_0x45f866<_0x18572f['body'][_0xc879('0x55')][_0xc879('0x32')];_0x45f866+=0x1){socket[_0xc879('0x77')](_0xc879('0x5f'),{'UserId':Number(_0x18572f[_0xc879('0x38')]['ids'][_0x45f866]),'ChatQueueId':Number(_0x18572f['params']['id'])});}return _0x14ef02;});}})[_0xc879('0x14')](respondWithResult(_0x527029,null))[_0xc879('0x29')](handleError(_0x527029,null));};exports[_0xc879('0x72')]=function(_0x5b4814,_0x1cbae7){return db['ChatQueue']['find']({'where':{'id':_0x5b4814[_0xc879('0x2b')]['id']}})[_0xc879('0x14')](handleEntityNotFound(_0x1cbae7,null))[_0xc879('0x14')](function(_0x2244d3){if(_0x2244d3){return _0x2244d3['removeAgents'](_0x5b4814[_0xc879('0x26')][_0xc879('0x55')])[_0xc879('0x14')](function(){if(_['isArray'](_0x5b4814['query'][_0xc879('0x55')])){for(var _0xee6d61=0x0;_0xee6d61<_0x5b4814[_0xc879('0x26')][_0xc879('0x55')]['length'];_0xee6d61+=0x1){socket['emit'](_0xc879('0x73'),{'UserId':Number(_0x5b4814[_0xc879('0x26')][_0xc879('0x55')][_0xee6d61]),'ChatQueueId':Number(_0x5b4814['params']['id'])});}}else{socket[_0xc879('0x77')](_0xc879('0x73'),{'UserId':Number(_0x5b4814[_0xc879('0x26')][_0xc879('0x55')]),'ChatQueueId':Number(_0x5b4814[_0xc879('0x2b')]['id'])});}});}})[_0xc879('0x14')](respondWithStatusCode(_0x1cbae7,null))[_0xc879('0x29')](handleError(_0x1cbae7,null));};exports['getAgents']=function(_0xd5adc4,_0x447dc){var _0x488897={};var _0x1483d9={};var _0x1df534;var _0x172452;return db['ChatQueue']['findOne']({'where':{'id':_0xd5adc4[_0xc879('0x2b')]['id']}})['then'](handleEntityNotFound(_0x447dc,null))[_0xc879('0x14')](function(_0x4ecfba){if(_0x4ecfba){_0x1df534=_0x4ecfba;_0x1483d9[_0xc879('0x2c')]=_['keys'](db[_0xc879('0x56')][_0xc879('0x2e')]);_0x1483d9['query']=_[_0xc879('0x2d')](_0xd5adc4[_0xc879('0x26')]);_0x1483d9['filters']=_['intersection'](_0x1483d9[_0xc879('0x2c')],_0x1483d9[_0xc879('0x26')]);_0x488897[_0xc879('0x30')]=_[_0xc879('0x2f')](_0x1483d9['model'],qs['fields'](_0xd5adc4[_0xc879('0x26')][_0xc879('0x31')]));_0x488897[_0xc879('0x30')]=_0x488897[_0xc879('0x30')][_0xc879('0x32')]?_0x488897[_0xc879('0x30')]:_0x1483d9[_0xc879('0x2c')];_0x488897[_0xc879('0x47')]=qs['sort'](_0xd5adc4['query'][_0xc879('0x48')]);_0x488897['where']=qs[_0xc879('0x43')](_[_0xc879('0x49')](_0xd5adc4['query'],_0x1483d9['filters']));if(_0xd5adc4[_0xc879('0x26')][_0xc879('0x4b')]){_0x488897[_0xc879('0x22')]=_['merge'](_0x488897[_0xc879('0x22')],{'$or':_['map'](_0x488897[_0xc879('0x30')],function(_0x370840){var _0x5689ea={};_0x5689ea[_0x370840]={'$like':'%'+_0xd5adc4['query'][_0xc879('0x4b')]+'%'};return _0x5689ea;})});}_0x488897=_['merge']({},_0x488897,_0xd5adc4[_0xc879('0x35')]);return _0x1df534[_0xc879('0x78')](_0x488897);}})[_0xc879('0x14')](function(_0x51a092){if(_0x51a092){_0x172452=_0x51a092[_0xc879('0x32')];if(!_0xd5adc4[_0xc879('0x26')][_0xc879('0x44')]('nolimit')){_0x488897['limit']=qs[_0xc879('0x46')](_0xd5adc4['query'][_0xc879('0x46')]);_0x488897[_0xc879('0xe')]=qs[_0xc879('0xe')](_0xd5adc4[_0xc879('0x26')][_0xc879('0xe')]);}return _0x1df534[_0xc879('0x78')](_0x488897);}})[_0xc879('0x14')](function(_0x358cb2){if(_0x358cb2){return _0x358cb2?{'count':_0x172452,'rows':_0x358cb2}:null;}})[_0xc879('0x14')](respondWithResult(_0x447dc,null))[_0xc879('0x29')](handleError(_0x447dc,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index c2972a2..c07d08e 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 _0xa001=['events','../../mysqldb','setMaxListeners','update','emit','hook','exports'];(function(_0x2f8cd9,_0x3c07da){var _0x21554b=function(_0x10e2d5){while(--_0x10e2d5){_0x2f8cd9['push'](_0x2f8cd9['shift']());}};_0x21554b(++_0x3c07da);}(_0xa001,0x93));var _0x1a00=function(_0xdf58ed,_0x1de90e){_0xdf58ed=_0xdf58ed-0x0;var _0x374120=_0xa001[_0xdf58ed];return _0x374120;};'use strict';var EventEmitter=require(_0x1a00('0x0'));var ChatQueue=require(_0x1a00('0x1'))['db']['ChatQueue'];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0x1a00('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x1a00('0x3'),'afterDestroy':'remove'};function emitEvent(_0x50afe8){return function(_0x52b9df,_0x17d4e9,_0x4ca9cc){ChatQueueEvents[_0x1a00('0x4')](_0x50afe8+':'+_0x52b9df['id'],_0x52b9df);ChatQueueEvents['emit'](_0x50afe8,_0x52b9df);_0x4ca9cc(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatQueue[_0x1a00('0x5')](e,emitEvent(event));}}module[_0x1a00('0x6')]=ChatQueueEvents; \ No newline at end of file +var _0x4566=['hook','exports','events','setMaxListeners','save','emit','hasOwnProperty'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x4566,0x80));var _0x6456=function(_0x30bf06,_0x5a6c0b){_0x30bf06=_0x30bf06-0x0;var _0x11f9e2=_0x4566[_0x30bf06];return _0x11f9e2;};'use strict';var EventEmitter=require(_0x6456('0x0'));var ChatQueue=require('../../mysqldb')['db']['ChatQueue'];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0x6456('0x1')](0x0);var events={'afterCreate':_0x6456('0x2'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x3dc644){return function(_0x5b9137,_0x1cec40,_0x28a80c){ChatQueueEvents[_0x6456('0x3')](_0x3dc644+':'+_0x5b9137['id'],_0x5b9137);ChatQueueEvents[_0x6456('0x3')](_0x3dc644,_0x5b9137);_0x28a80c(null);};}for(var e in events){if(events[_0x6456('0x4')](e)){var event=events[e];ChatQueue[_0x6456('0x5')](e,emitEvent(event));}}module[_0x6456('0x6')]=ChatQueueEvents; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.model.js b/server/api/chatQueue/chatQueue.model.js index 069bb88..2418f73 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 _0xc791=['chat_queues','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatQueue.attributes','exports'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0xc791,0x1e1));var _0x1c79=function(_0x27c741,_0x4bab7c){_0x27c741=_0x27c741-0x0;var _0x353e2b=_0xc791[_0x27c741];return _0x353e2b;};'use strict';var _=require(_0x1c79('0x0'));var util=require(_0x1c79('0x1'));var logger=require('../../config/logger')(_0x1c79('0x2'));var moment=require(_0x1c79('0x3'));var BPromise=require(_0x1c79('0x4'));var rp=require(_0x1c79('0x5'));var fs=require('fs');var path=require(_0x1c79('0x6'));var rimraf=require(_0x1c79('0x7'));var config=require(_0x1c79('0x8'));var attributes=require(_0x1c79('0x9'));module[_0x1c79('0xa')]=function(_0x3b50ec,_0x5d12a8){return _0x3b50ec['define']('ChatQueue',attributes,{'tableName':_0x1c79('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd92a=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatQueue.attributes','exports','define','ChatQueue','chat_queues','lodash'];(function(_0x400f6d,_0x488583){var _0x57ee04=function(_0x53c4b8){while(--_0x53c4b8){_0x400f6d['push'](_0x400f6d['shift']());}};_0x57ee04(++_0x488583);}(_0xd92a,0x12b));var _0xad92=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xd92a[_0x17d9e3];return _0x14192d;};'use strict';var _=require(_0xad92('0x0'));var util=require(_0xad92('0x1'));var logger=require(_0xad92('0x2'))(_0xad92('0x3'));var moment=require(_0xad92('0x4'));var BPromise=require(_0xad92('0x5'));var rp=require(_0xad92('0x6'));var fs=require('fs');var path=require(_0xad92('0x7'));var rimraf=require(_0xad92('0x8'));var config=require(_0xad92('0x9'));var attributes=require(_0xad92('0xa'));module[_0xad92('0xb')]=function(_0x59172c,_0x2c15e4){return _0x59172c[_0xad92('0xc')](_0xad92('0xd'),attributes,{'tableName':_0xad92('0xe'),'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 bd74cda..d943e23 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 _0x404d=['register','request','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','ChatQueue','findAll','options','raw','where','attributes','limit','include','map','model','GetChatQueue','find','ShowChatQueue','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter'];(function(_0x34273d,_0x4cee59){var _0xd7efeb=function(_0x1491c0){while(--_0x1491c0){_0x34273d['push'](_0x34273d['shift']());}};_0xd7efeb(++_0x4cee59);}(_0x404d,0x1e9));var _0xd404=function(_0x4a652a,_0x20a238){_0x4a652a=_0x4a652a-0x0;var _0x13a67e=_0x404d[_0x4a652a];return _0x13a67e;};'use strict';var _=require(_0xd404('0x0'));var util=require(_0xd404('0x1'));var moment=require(_0xd404('0x2'));var BPromise=require(_0xd404('0x3'));var rs=require(_0xd404('0x4'));var fs=require('fs');var Redis=require(_0xd404('0x5'));var db=require(_0xd404('0x6'))['db'];var utils=require(_0xd404('0x7'));var logger=require(_0xd404('0x8'))('rpc');var config=require(_0xd404('0x9'));var jayson=require(_0xd404('0xa'));var client=jayson['client'][_0xd404('0xb')]({'port':0x232a});config[_0xd404('0xc')]=_['defaults'](config['redis'],{'host':_0xd404('0xd'),'port':0x18eb});var socket=require(_0xd404('0xe'))(new Redis(config['redis']));require('./chatQueue.socket')[_0xd404('0xf')](socket);function respondWithRpcPromise(_0x1b99d2,_0x3a1a89,_0xb018fc){return new BPromise(function(_0x5d3faf,_0x4b60f2){return client[_0xd404('0x10')](_0x1b99d2,_0xb018fc)[_0xd404('0x11')](function(_0x569542){logger[_0xd404('0x12')](_0xd404('0x13'),_0x3a1a89,_0xd404('0x14'));logger[_0xd404('0x15')](_0xd404('0x16'),_0x3a1a89,_0xd404('0x14'),JSON[_0xd404('0x17')](_0x569542));if(_0x569542[_0xd404('0x18')]){if(_0x569542[_0xd404('0x18')][_0xd404('0x19')]===0x1f4){logger[_0xd404('0x18')](_0xd404('0x13'),_0x3a1a89,_0x569542[_0xd404('0x18')][_0xd404('0x1a')]);return _0x4b60f2(_0x569542[_0xd404('0x18')][_0xd404('0x1a')]);}logger[_0xd404('0x18')](_0xd404('0x13'),_0x3a1a89,_0x569542[_0xd404('0x18')][_0xd404('0x1a')]);return _0x5d3faf(_0x569542[_0xd404('0x18')]['message']);}else{logger[_0xd404('0x12')](_0xd404('0x13'),_0x3a1a89,'request\x20sent');_0x5d3faf(_0x569542[_0xd404('0x1b')][_0xd404('0x1a')]);}})['catch'](function(_0x209a6b){logger[_0xd404('0x18')](_0xd404('0x13'),_0x3a1a89,_0x209a6b);_0x4b60f2(_0x209a6b);});});}exports['GetChatQueue']=function(_0x2fd888){var _0x399a06=this;return new Promise(function(_0x27d9a1,_0x3e8183){return db[_0xd404('0x1c')][_0xd404('0x1d')]({'raw':_0x2fd888[_0xd404('0x1e')]?_0x2fd888['options'][_0xd404('0x1f')]===undefined?!![]:![]:!![],'where':_0x2fd888[_0xd404('0x1e')]?_0x2fd888['options'][_0xd404('0x20')]||null:null,'attributes':_0x2fd888['options']?_0x2fd888['options'][_0xd404('0x21')]||null:null,'limit':_0x2fd888[_0xd404('0x1e')]?_0x2fd888[_0xd404('0x1e')][_0xd404('0x22')]||null:null,'include':_0x2fd888['options']?_0x2fd888[_0xd404('0x1e')][_0xd404('0x23')]?_[_0xd404('0x24')](_0x2fd888['options']['include'],function(_0x3e706a){return{'model':db[_0x3e706a[_0xd404('0x25')]],'as':_0x3e706a['as'],'attributes':_0x3e706a[_0xd404('0x21')],'include':_0x3e706a[_0xd404('0x23')]?_[_0xd404('0x24')](_0x3e706a[_0xd404('0x23')],function(_0x256277){return{'model':db[_0x256277[_0xd404('0x25')]],'as':_0x256277['as'],'attributes':_0x256277['attributes'],'include':_0x256277['include']?_[_0xd404('0x24')](_0x256277['include'],function(_0x2b14ec){return{'model':db[_0x2b14ec['model']],'as':_0x2b14ec['as'],'attributes':_0x2b14ec[_0xd404('0x21')]};}):[]};}):[]};}):[]:[]})[_0xd404('0x11')](function(_0x3e746e){logger[_0xd404('0x12')](_0xd404('0x26'),_0x2fd888);logger[_0xd404('0x15')](_0xd404('0x26'),_0x2fd888,JSON['stringify'](_0x3e746e));_0x27d9a1(_0x3e746e);})['catch'](function(_0xc60d87){logger['error']('GetChatQueue',_0xc60d87[_0xd404('0x1a')],_0x2fd888);_0x3e8183(_0x399a06[_0xd404('0x18')](0x1f4,_0xc60d87[_0xd404('0x1a')]));});});};exports['ShowChatQueue']=function(_0x63430e){var _0x54f0c5=this;return new Promise(function(_0x2ee9b3,_0x1de7b9){return db['ChatQueue'][_0xd404('0x27')]({'raw':_0x63430e[_0xd404('0x1e')]?_0x63430e[_0xd404('0x1e')][_0xd404('0x1f')]===undefined?!![]:![]:!![],'where':_0x63430e[_0xd404('0x1e')]?_0x63430e['options'][_0xd404('0x20')]||null:null,'attributes':_0x63430e[_0xd404('0x1e')]?_0x63430e[_0xd404('0x1e')]['attributes']||null:null,'include':_0x63430e[_0xd404('0x1e')]?_0x63430e[_0xd404('0x1e')][_0xd404('0x23')]?_[_0xd404('0x24')](_0x63430e['options']['include'],function(_0x2551b5){return{'model':db[_0x2551b5[_0xd404('0x25')]],'as':_0x2551b5['as'],'attributes':_0x2551b5[_0xd404('0x21')],'include':_0x2551b5[_0xd404('0x23')]?_[_0xd404('0x24')](_0x2551b5[_0xd404('0x23')],function(_0x50d8ef){return{'model':db[_0x50d8ef[_0xd404('0x25')]],'as':_0x50d8ef['as'],'attributes':_0x50d8ef[_0xd404('0x21')],'include':_0x50d8ef[_0xd404('0x23')]?_['map'](_0x50d8ef[_0xd404('0x23')],function(_0x2e0786){return{'model':db[_0x2e0786[_0xd404('0x25')]],'as':_0x2e0786['as'],'attributes':_0x2e0786['attributes']};}):[]};}):[]};}):[]:[]})[_0xd404('0x11')](function(_0x21111e){logger[_0xd404('0x12')]('ShowChatQueue',_0x63430e);logger[_0xd404('0x15')](_0xd404('0x28'),_0x63430e,JSON['stringify'](_0x21111e));_0x2ee9b3(_0x21111e);})[_0xd404('0x29')](function(_0x128da0){logger[_0xd404('0x18')](_0xd404('0x28'),_0x128da0[_0xd404('0x1a')],_0x63430e);_0x1de7b9(_0x54f0c5[_0xd404('0x18')](0x1f4,_0x128da0[_0xd404('0x1a')]));});});}; \ No newline at end of file +var _0xe8a1=['result','catch','GetChatQueue','raw','options','where','attributes','include','model','map','then','info','stringify','ShowChatQueue','ChatQueue','find','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','redis','defaults','register','request','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','code','error','message'];(function(_0x4632a9,_0x11306d){var _0x2cfe3f=function(_0x4b0530){while(--_0x4b0530){_0x4632a9['push'](_0x4632a9['shift']());}};_0x2cfe3f(++_0x11306d);}(_0xe8a1,0x1d8));var _0x1e8a=function(_0x44223c,_0x43a1e4){_0x44223c=_0x44223c-0x0;var _0x2314ce=_0xe8a1[_0x44223c];return _0x2314ce;};'use strict';var _=require(_0x1e8a('0x0'));var util=require(_0x1e8a('0x1'));var moment=require(_0x1e8a('0x2'));var BPromise=require('bluebird');var rs=require(_0x1e8a('0x3'));var fs=require('fs');var Redis=require(_0x1e8a('0x4'));var db=require(_0x1e8a('0x5'))['db'];var utils=require(_0x1e8a('0x6'));var logger=require(_0x1e8a('0x7'))(_0x1e8a('0x8'));var config=require(_0x1e8a('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1e8a('0xa')]({'port':0x232a});config[_0x1e8a('0xb')]=_[_0x1e8a('0xc')](config[_0x1e8a('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1e8a('0xb')]));require('./chatQueue.socket')[_0x1e8a('0xd')](socket);function respondWithRpcPromise(_0x271b82,_0x4ac6b6,_0x5793af){return new BPromise(function(_0x439024,_0x170fc4){return client[_0x1e8a('0xe')](_0x271b82,_0x5793af)['then'](function(_0xaf3fee){logger['info'](_0x1e8a('0xf'),_0x4ac6b6,_0x1e8a('0x10'));logger[_0x1e8a('0x11')](_0x1e8a('0x12'),_0x4ac6b6,'request\x20sent',JSON['stringify'](_0xaf3fee));if(_0xaf3fee['error']){if(_0xaf3fee['error'][_0x1e8a('0x13')]===0x1f4){logger[_0x1e8a('0x14')](_0x1e8a('0xf'),_0x4ac6b6,_0xaf3fee['error']['message']);return _0x170fc4(_0xaf3fee[_0x1e8a('0x14')][_0x1e8a('0x15')]);}logger['error'](_0x1e8a('0xf'),_0x4ac6b6,_0xaf3fee[_0x1e8a('0x14')][_0x1e8a('0x15')]);return _0x439024(_0xaf3fee[_0x1e8a('0x14')][_0x1e8a('0x15')]);}else{logger['info'](_0x1e8a('0xf'),_0x4ac6b6,'request\x20sent');_0x439024(_0xaf3fee[_0x1e8a('0x16')]['message']);}})[_0x1e8a('0x17')](function(_0x4d0e63){logger['error']('ChatQueue,\x20%s,\x20%s',_0x4ac6b6,_0x4d0e63);_0x170fc4(_0x4d0e63);});});}exports[_0x1e8a('0x18')]=function(_0x2a9e0e){var _0x1e7d2e=this;return new Promise(function(_0x482b9b,_0xc9c032){return db['ChatQueue']['findAll']({'raw':_0x2a9e0e['options']?_0x2a9e0e['options'][_0x1e8a('0x19')]===undefined?!![]:![]:!![],'where':_0x2a9e0e[_0x1e8a('0x1a')]?_0x2a9e0e['options'][_0x1e8a('0x1b')]||null:null,'attributes':_0x2a9e0e[_0x1e8a('0x1a')]?_0x2a9e0e[_0x1e8a('0x1a')][_0x1e8a('0x1c')]||null:null,'limit':_0x2a9e0e[_0x1e8a('0x1a')]?_0x2a9e0e[_0x1e8a('0x1a')]['limit']||null:null,'include':_0x2a9e0e[_0x1e8a('0x1a')]?_0x2a9e0e['options'][_0x1e8a('0x1d')]?_['map'](_0x2a9e0e['options']['include'],function(_0xd4a087){return{'model':db[_0xd4a087[_0x1e8a('0x1e')]],'as':_0xd4a087['as'],'attributes':_0xd4a087[_0x1e8a('0x1c')],'include':_0xd4a087[_0x1e8a('0x1d')]?_[_0x1e8a('0x1f')](_0xd4a087[_0x1e8a('0x1d')],function(_0x2b0197){return{'model':db[_0x2b0197[_0x1e8a('0x1e')]],'as':_0x2b0197['as'],'attributes':_0x2b0197[_0x1e8a('0x1c')],'include':_0x2b0197[_0x1e8a('0x1d')]?_[_0x1e8a('0x1f')](_0x2b0197[_0x1e8a('0x1d')],function(_0x5eea6c){return{'model':db[_0x5eea6c[_0x1e8a('0x1e')]],'as':_0x5eea6c['as'],'attributes':_0x5eea6c[_0x1e8a('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x1e8a('0x20')](function(_0x1d2d48){logger[_0x1e8a('0x21')](_0x1e8a('0x18'),_0x2a9e0e);logger['debug'](_0x1e8a('0x18'),_0x2a9e0e,JSON[_0x1e8a('0x22')](_0x1d2d48));_0x482b9b(_0x1d2d48);})[_0x1e8a('0x17')](function(_0x33d056){logger[_0x1e8a('0x14')](_0x1e8a('0x18'),_0x33d056[_0x1e8a('0x15')],_0x2a9e0e);_0xc9c032(_0x1e7d2e[_0x1e8a('0x14')](0x1f4,_0x33d056[_0x1e8a('0x15')]));});});};exports[_0x1e8a('0x23')]=function(_0xccb74f){var _0x264d8f=this;return new Promise(function(_0x52d2fe,_0x2ee088){return db[_0x1e8a('0x24')][_0x1e8a('0x25')]({'raw':_0xccb74f[_0x1e8a('0x1a')]?_0xccb74f[_0x1e8a('0x1a')][_0x1e8a('0x19')]===undefined?!![]:![]:!![],'where':_0xccb74f['options']?_0xccb74f[_0x1e8a('0x1a')][_0x1e8a('0x1b')]||null:null,'attributes':_0xccb74f[_0x1e8a('0x1a')]?_0xccb74f[_0x1e8a('0x1a')]['attributes']||null:null,'include':_0xccb74f[_0x1e8a('0x1a')]?_0xccb74f[_0x1e8a('0x1a')][_0x1e8a('0x1d')]?_[_0x1e8a('0x1f')](_0xccb74f[_0x1e8a('0x1a')][_0x1e8a('0x1d')],function(_0x151a62){return{'model':db[_0x151a62['model']],'as':_0x151a62['as'],'attributes':_0x151a62[_0x1e8a('0x1c')],'include':_0x151a62['include']?_['map'](_0x151a62['include'],function(_0x574796){return{'model':db[_0x574796[_0x1e8a('0x1e')]],'as':_0x574796['as'],'attributes':_0x574796['attributes'],'include':_0x574796[_0x1e8a('0x1d')]?_[_0x1e8a('0x1f')](_0x574796[_0x1e8a('0x1d')],function(_0x4b2737){return{'model':db[_0x4b2737['model']],'as':_0x4b2737['as'],'attributes':_0x4b2737[_0x1e8a('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x1e8a('0x20')](function(_0x57edb1){logger[_0x1e8a('0x21')](_0x1e8a('0x23'),_0xccb74f);logger['debug'](_0x1e8a('0x23'),_0xccb74f,JSON[_0x1e8a('0x22')](_0x57edb1));_0x52d2fe(_0x57edb1);})[_0x1e8a('0x17')](function(_0x519628){logger['error'](_0x1e8a('0x23'),_0x519628['message'],_0xccb74f);_0x2ee088(_0x264d8f[_0x1e8a('0x14')](0x1f4,_0x519628[_0x1e8a('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index c534b3b..dee3df4 100644 --- a/server/api/chatQueue/chatQueue.socket.js +++ b/server/api/chatQueue/chatQueue.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9b9b=['save','emit','removeListener','register','length','chatQueue:'];(function(_0x43a327,_0xb19748){var _0x4a6d7e=function(_0x219643){while(--_0x219643){_0x43a327['push'](_0x43a327['shift']());}};_0x4a6d7e(++_0xb19748);}(_0x9b9b,0x114));var _0xb9b9=function(_0x2675da,_0x5a250e){_0x2675da=_0x2675da-0x0;var _0x5e6153=_0x9b9b[_0x2675da];return _0x5e6153;};'use strict';var ChatQueueEvents=require('./chatQueue.events');var events=[_0xb9b9('0x0'),'remove','update'];function createListener(_0x2ae8a0,_0x153734){return function(_0x1adf50){_0x153734[_0xb9b9('0x1')](_0x2ae8a0,_0x1adf50);};}function removeListener(_0x1d6ab6,_0x43c8ff){return function(){ChatQueueEvents[_0xb9b9('0x2')](_0x1d6ab6,_0x43c8ff);};}exports[_0xb9b9('0x3')]=function(_0x79dd){for(var _0x3d1a95=0x0,_0x85eec=events[_0xb9b9('0x4')];_0x3d1a95<_0x85eec;_0x3d1a95++){var _0x5be5bc=events[_0x3d1a95];var _0x297cb6=createListener(_0xb9b9('0x5')+_0x5be5bc,_0x79dd);ChatQueueEvents['on'](_0x5be5bc,_0x297cb6);}}; \ No newline at end of file +var _0xac31=['remove','update','length','chatQueue:','./chatQueue.events','save'];(function(_0x4f4757,_0x44241a){var _0x549c37=function(_0x3c3cfb){while(--_0x3c3cfb){_0x4f4757['push'](_0x4f4757['shift']());}};_0x549c37(++_0x44241a);}(_0xac31,0xca));var _0x1ac3=function(_0x2b4863,_0x5811ee){_0x2b4863=_0x2b4863-0x0;var _0x3733f1=_0xac31[_0x2b4863];return _0x3733f1;};'use strict';var ChatQueueEvents=require(_0x1ac3('0x0'));var events=[_0x1ac3('0x1'),_0x1ac3('0x2'),_0x1ac3('0x3')];function createListener(_0xd6934,_0x11dd6d){return function(_0x95548d){_0x11dd6d['emit'](_0xd6934,_0x95548d);};}function removeListener(_0x33b5ab,_0x434b5e){return function(){ChatQueueEvents['removeListener'](_0x33b5ab,_0x434b5e);};}exports['register']=function(_0xbe22b7){for(var _0x20027f=0x0,_0x2bf9b1=events[_0x1ac3('0x4')];_0x20027f<_0x2bf9b1;_0x20027f++){var _0x157604=events[_0x20027f];var _0x57893c=createListener(_0x1ac3('0x5')+_0x157604,_0xbe22b7);ChatQueueEvents['on'](_0x157604,_0x57893c);}}; \ No newline at end of file diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index 64f9ed1..3a2e5ec 100644 --- a/server/api/chatQueue/index.js +++ b/server/api/chatQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x55ca=['post','addAgents','update','delete','destroy','removeTeams','removeAgents','exports','multer','util','Router','fs-extra','../../components/interaction/service','../../config/environment','./chatQueue.controller','get','isAuthenticated','index','describe','/:id','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','addTeams'];(function(_0x935c9c,_0x56f0b7){var _0x10dfad=function(_0x54af8e){while(--_0x54af8e){_0x935c9c['push'](_0x935c9c['shift']());}};_0x10dfad(++_0x56f0b7);}(_0x55ca,0x126));var _0xa55c=function(_0x3b2369,_0x4c68b9){_0x3b2369=_0x3b2369-0x0;var _0x5a1367=_0x55ca[_0x3b2369];return _0x5a1367;};'use strict';var multer=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa55c('0x2')]();var fs_extra=require(_0xa55c('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xa55c('0x4'));var config=require(_0xa55c('0x5'));var controller=require(_0xa55c('0x6'));router[_0xa55c('0x7')]('/',auth[_0xa55c('0x8')](),controller[_0xa55c('0x9')]);router[_0xa55c('0x7')]('/describe',auth[_0xa55c('0x8')](),controller[_0xa55c('0xa')]);router['get'](_0xa55c('0xb'),auth[_0xa55c('0x8')](),controller['show']);router['get'](_0xa55c('0xc'),auth[_0xa55c('0x8')](),controller[_0xa55c('0xd')]);router[_0xa55c('0x7')](_0xa55c('0xe'),auth[_0xa55c('0x8')](),controller[_0xa55c('0xf')]);router[_0xa55c('0x7')](_0xa55c('0x10'),auth[_0xa55c('0x8')](),controller['getAgents']);router['post']('/',auth[_0xa55c('0x8')](),controller['create']);router['post']('/:id/teams',auth[_0xa55c('0x8')](),controller[_0xa55c('0x11')]);router[_0xa55c('0x12')](_0xa55c('0x10'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x13')]);router['put'](_0xa55c('0xb'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x14')]);router[_0xa55c('0x15')](_0xa55c('0xb'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x16')]);router[_0xa55c('0x15')](_0xa55c('0xe'),auth['isAuthenticated'](),controller[_0xa55c('0x17')]);router[_0xa55c('0x15')](_0xa55c('0x10'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x18')]);module[_0xa55c('0x19')]=router; \ No newline at end of file +var _0x814b=['/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','update','delete','removeTeams','removeAgents','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatQueue.controller','get','isAuthenticated','/describe','describe','/:id','show'];(function(_0x44d42a,_0xe76ad8){var _0x172b8f=function(_0x4560b1){while(--_0x4560b1){_0x44d42a['push'](_0x44d42a['shift']());}};_0x172b8f(++_0xe76ad8);}(_0x814b,0x1a2));var _0xb814=function(_0xc87d08,_0x59c9be){_0xc87d08=_0xc87d08-0x0;var _0x30a714=_0x814b[_0xc87d08];return _0x30a714;};'use strict';var multer=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var path=require(_0xb814('0x2'));var timeout=require(_0xb814('0x3'));var express=require(_0xb814('0x4'));var router=express[_0xb814('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xb814('0x6'));var interaction=require(_0xb814('0x7'));var config=require(_0xb814('0x8'));var controller=require(_0xb814('0x9'));router[_0xb814('0xa')]('/',auth[_0xb814('0xb')](),controller['index']);router[_0xb814('0xa')](_0xb814('0xc'),auth['isAuthenticated'](),controller[_0xb814('0xd')]);router[_0xb814('0xa')](_0xb814('0xe'),auth[_0xb814('0xb')](),controller[_0xb814('0xf')]);router[_0xb814('0xa')](_0xb814('0x10'),auth[_0xb814('0xb')](),controller[_0xb814('0x11')]);router[_0xb814('0xa')](_0xb814('0x12'),auth['isAuthenticated'](),controller[_0xb814('0x13')]);router['get'](_0xb814('0x14'),auth[_0xb814('0xb')](),controller[_0xb814('0x15')]);router[_0xb814('0x16')]('/',auth[_0xb814('0xb')](),controller[_0xb814('0x17')]);router[_0xb814('0x16')](_0xb814('0x12'),auth[_0xb814('0xb')](),controller[_0xb814('0x18')]);router[_0xb814('0x16')](_0xb814('0x14'),auth[_0xb814('0xb')](),controller[_0xb814('0x19')]);router[_0xb814('0x1a')](_0xb814('0xe'),auth[_0xb814('0xb')](),controller[_0xb814('0x1b')]);router[_0xb814('0x1c')](_0xb814('0xe'),auth[_0xb814('0xb')](),controller['destroy']);router[_0xb814('0x1c')]('/:id/teams',auth[_0xb814('0xb')](),controller[_0xb814('0x1d')]);router['delete']('/:id/users',auth['isAuthenticated'](),controller[_0xb814('0x1e')]);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 289d7ae..3cc4641 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 _0x2c19=['exports','STRING','DATE','moment','sequelize'];(function(_0x591875,_0x195f1d){var _0x51778e=function(_0x3c28b0){while(--_0x3c28b0){_0x591875['push'](_0x591875['shift']());}};_0x51778e(++_0x195f1d);}(_0x2c19,0x17a));var _0x92c1=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x2c19[_0x2b4411];return _0x8e41ef;};'use strict';var moment=require(_0x92c1('0x0'));var Sequelize=require(_0x92c1('0x1'));module[_0x92c1('0x2')]={'uniqueid':{'type':Sequelize[_0x92c1('0x3')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x92c1('0x4')]},'acceptAt':{'type':Sequelize[_0x92c1('0x4')]},'exitAt':{'type':Sequelize[_0x92c1('0x4')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x45a8=['sequelize','exports','STRING','DATE','moment'];(function(_0x182700,_0x87ffd5){var _0x1bb3b2=function(_0x1296ee){while(--_0x1296ee){_0x182700['push'](_0x182700['shift']());}};_0x1bb3b2(++_0x87ffd5);}(_0x45a8,0x112));var _0x845a=function(_0x11d10f,_0x275d65){_0x11d10f=_0x11d10f-0x0;var _0x4f3a86=_0x45a8[_0x11d10f];return _0x4f3a86;};'use strict';var moment=require(_0x845a('0x0'));var Sequelize=require(_0x845a('0x1'));module[_0x845a('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x845a('0x3')]},'joinAt':{'type':Sequelize[_0x845a('0x4')]},'leaveAt':{'type':Sequelize[_0x845a('0x4')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x845a('0x4')]},'reason':{'type':Sequelize[_0x845a('0x3')]}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index d423ad8..5f4a680 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 _0x00cd=['find','catch','create','body','update','destroy','describe','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','error','stack','name','send','index','map','ChatQueueReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','rows','show','params'];(function(_0x37aece,_0xdbfe91){var _0x34dd0b=function(_0x4533ec){while(--_0x4533ec){_0x37aece['push'](_0x37aece['shift']());}};_0x34dd0b(++_0xdbfe91);}(_0x00cd,0xee));var _0xd00c=function(_0x16a223,_0x31b6e8){_0x16a223=_0x16a223-0x0;var _0x5ded66=_0x00cd[_0x16a223];return _0x5ded66;};'use strict';var emlformat=require(_0xd00c('0x0'));var rimraf=require(_0xd00c('0x1'));var zipdir=require(_0xd00c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xd00c('0x3'));var BPromise=require(_0xd00c('0x4'));var Mustache=require(_0xd00c('0x5'));var util=require(_0xd00c('0x6'));var path=require(_0xd00c('0x7'));var sox=require('sox');var csv=require(_0xd00c('0x8'));var ejs=require(_0xd00c('0x9'));var fs=require('fs');var fs_extra=require(_0xd00c('0xa'));var _=require(_0xd00c('0xb'));var squel=require(_0xd00c('0xc'));var crypto=require(_0xd00c('0xd'));var jsforce=require(_0xd00c('0xe'));var deskjs=require(_0xd00c('0xf'));var toCsv=require(_0xd00c('0x8'));var querystring=require(_0xd00c('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xd00c('0x11'));var qs=require(_0xd00c('0x12'));var as=require(_0xd00c('0x13'));var hardwareService=require(_0xd00c('0x14'));var logger=require('../../config/logger')(_0xd00c('0x15'));var utils=require('../../config/utils');var config=require(_0xd00c('0x16'));var licenseUtil=require(_0xd00c('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x49238e,_0x51f391){_0x51f391=_0x51f391||0xcc;return function(_0x4afd7d){if(_0x4afd7d){return _0x49238e[_0xd00c('0x18')](_0x51f391);}return _0x49238e[_0xd00c('0x19')](_0x51f391)[_0xd00c('0x1a')]();};}function respondWithResult(_0x4c0c0f,_0x24c12b){_0x24c12b=_0x24c12b||0xc8;return function(_0x5ed7e7){if(_0x5ed7e7){return _0x4c0c0f[_0xd00c('0x19')](_0x24c12b)[_0xd00c('0x1b')](_0x5ed7e7);}};}function respondWithFilteredResult(_0x3dc54d,_0x4a52b0){return function(_0x50b22e){if(_0x50b22e){var _0x41f67c=typeof _0x4a52b0[_0xd00c('0x1c')]===_0xd00c('0x1d')&&typeof _0x4a52b0[_0xd00c('0x1e')]===_0xd00c('0x1d');var _0x2a5531=_0x50b22e[_0xd00c('0x1f')];var _0x3864a9=_0x41f67c?0x0:_0x4a52b0['offset'];var _0x2b167a=_0x41f67c?_0x50b22e[_0xd00c('0x1f')]:_0x4a52b0[_0xd00c('0x1c')]+_0x4a52b0['limit'];var _0x541174;if(_0x2b167a>=_0x2a5531){_0x2b167a=_0x2a5531;_0x541174=0xc8;}else{_0x541174=0xce;}_0x3dc54d[_0xd00c('0x19')](_0x541174);return _0x3dc54d[_0xd00c('0x20')](_0xd00c('0x21'),_0x3864a9+'-'+_0x2b167a+'/'+_0x2a5531)[_0xd00c('0x1b')](_0x50b22e);}return null;};}function patchUpdates(_0xbced81){return function(_0x40a352){try{jsonpatch[_0xd00c('0x22')](_0x40a352,_0xbced81,!![]);}catch(_0x4ef9f8){return BPromise[_0xd00c('0x23')](_0x4ef9f8);}return _0x40a352[_0xd00c('0x24')]();};}function saveUpdates(_0x3a0b2f,_0x3807fb){return function(_0x10d08d){if(_0x10d08d){return _0x10d08d['update'](_0x3a0b2f)['then'](function(_0x27c892){return _0x27c892;});}return null;};}function removeEntity(_0x22b914,_0x5bcf19){return function(_0x4a6c84){if(_0x4a6c84){return _0x4a6c84['destroy']()[_0xd00c('0x25')](function(){_0x22b914['status'](0xcc)[_0xd00c('0x1a')]();});}};}function handleEntityNotFound(_0x4a918f,_0x25300a){return function(_0x276eef){if(!_0x276eef){_0x4a918f['sendStatus'](0x194);}return _0x276eef;};}function handleError(_0x4c78e9,_0x24f5c8){_0x24f5c8=_0x24f5c8||0x1f4;return function(_0x32e998){logger[_0xd00c('0x26')](_0x32e998[_0xd00c('0x27')]);if(_0x32e998['name']){delete _0x32e998[_0xd00c('0x28')];}_0x4c78e9[_0xd00c('0x19')](_0x24f5c8)[_0xd00c('0x29')](_0x32e998);};}exports[_0xd00c('0x2a')]=function(_0x4987c5,_0x17e58d){var _0x5bb7c4={},_0x3e7e2c={},_0x127a0b={'count':0x0,'rows':[]};var _0x291b71=_[_0xd00c('0x2b')](db[_0xd00c('0x2c')][_0xd00c('0x2d')],function(_0xbbbf0e){return{'name':_0xbbbf0e[_0xd00c('0x2e')],'type':_0xbbbf0e[_0xd00c('0x2f')][_0xd00c('0x30')]};});_0x3e7e2c[_0xd00c('0x31')]=_[_0xd00c('0x2b')](_0x291b71,_0xd00c('0x28'));_0x3e7e2c[_0xd00c('0x32')]=_[_0xd00c('0x33')](_0x4987c5[_0xd00c('0x32')]);_0x3e7e2c[_0xd00c('0x34')]=_[_0xd00c('0x35')](_0x3e7e2c['model'],_0x3e7e2c['query']);_0x5bb7c4[_0xd00c('0x36')]=_['intersection'](_0x3e7e2c[_0xd00c('0x31')],qs[_0xd00c('0x37')](_0x4987c5[_0xd00c('0x32')][_0xd00c('0x37')]));_0x5bb7c4[_0xd00c('0x36')]=_0x5bb7c4['attributes'][_0xd00c('0x38')]?_0x5bb7c4[_0xd00c('0x36')]:_0x3e7e2c['model'];if(!_0x4987c5[_0xd00c('0x32')][_0xd00c('0x39')](_0xd00c('0x3a'))){_0x5bb7c4[_0xd00c('0x1e')]=qs[_0xd00c('0x1e')](_0x4987c5[_0xd00c('0x32')]['limit']);_0x5bb7c4[_0xd00c('0x1c')]=qs['offset'](_0x4987c5[_0xd00c('0x32')]['offset']);}_0x5bb7c4['order']=qs['sort'](_0x4987c5[_0xd00c('0x32')][_0xd00c('0x3b')]);_0x5bb7c4[_0xd00c('0x3c')]=qs['filters'](_[_0xd00c('0x3d')](_0x4987c5[_0xd00c('0x32')],_0x3e7e2c[_0xd00c('0x34')]),_0x291b71);if(_0x4987c5['query'][_0xd00c('0x3e')]){_0x5bb7c4[_0xd00c('0x3c')]=_[_0xd00c('0x3f')](_0x5bb7c4[_0xd00c('0x3c')],{'$or':_[_0xd00c('0x2b')](_0x291b71,function(_0xfb7519){if(_0xfb7519[_0xd00c('0x2f')]!==_0xd00c('0x40')){var _0x1fdc4d={};_0x1fdc4d[_0xfb7519[_0xd00c('0x28')]]={'$like':'%'+_0x4987c5['query'][_0xd00c('0x3e')]+'%'};return _0x1fdc4d;}})});}_0x5bb7c4=_[_0xd00c('0x3f')]({},_0x5bb7c4,_0x4987c5['options']);var _0x1e565f={'where':_0x5bb7c4[_0xd00c('0x3c')]};return db['ChatQueueReport'][_0xd00c('0x1f')](_0x1e565f)[_0xd00c('0x25')](function(_0x3d31a7){_0x127a0b[_0xd00c('0x1f')]=_0x3d31a7;if(_0x4987c5[_0xd00c('0x32')][_0xd00c('0x41')]){_0x5bb7c4[_0xd00c('0x42')]=[{'all':!![]}];}return db[_0xd00c('0x2c')]['findAll'](_0x5bb7c4);})[_0xd00c('0x25')](function(_0x193117){_0x127a0b[_0xd00c('0x43')]=_0x193117;return _0x127a0b;})[_0xd00c('0x25')](respondWithFilteredResult(_0x17e58d,_0x5bb7c4))['catch'](handleError(_0x17e58d,null));};exports[_0xd00c('0x44')]=function(_0x6bcc79,_0x5b0b2b){var _0x923db0={'raw':!![],'where':{'id':_0x6bcc79[_0xd00c('0x45')]['id']}},_0x640a87={};_0x640a87['model']=_[_0xd00c('0x33')](db['ChatQueueReport']['rawAttributes']);_0x640a87[_0xd00c('0x32')]=_['keys'](_0x6bcc79[_0xd00c('0x32')]);_0x640a87[_0xd00c('0x34')]=_[_0xd00c('0x35')](_0x640a87[_0xd00c('0x31')],_0x640a87[_0xd00c('0x32')]);_0x923db0[_0xd00c('0x36')]=_[_0xd00c('0x35')](_0x640a87[_0xd00c('0x31')],qs[_0xd00c('0x37')](_0x6bcc79[_0xd00c('0x32')][_0xd00c('0x37')]));_0x923db0['attributes']=_0x923db0[_0xd00c('0x36')][_0xd00c('0x38')]?_0x923db0[_0xd00c('0x36')]:_0x640a87['model'];if(_0x6bcc79[_0xd00c('0x32')][_0xd00c('0x41')]){_0x923db0['include']=[{'all':!![]}];}_0x923db0=_['merge']({},_0x923db0,_0x6bcc79['options']);return db[_0xd00c('0x2c')][_0xd00c('0x46')](_0x923db0)[_0xd00c('0x25')](handleEntityNotFound(_0x5b0b2b,null))[_0xd00c('0x25')](respondWithResult(_0x5b0b2b,null))[_0xd00c('0x47')](handleError(_0x5b0b2b,null));};exports[_0xd00c('0x48')]=function(_0x3bc7e6,_0x1efbda){return db['ChatQueueReport'][_0xd00c('0x48')](_0x3bc7e6[_0xd00c('0x49')],{})[_0xd00c('0x25')](respondWithResult(_0x1efbda,0xc9))[_0xd00c('0x47')](handleError(_0x1efbda,null));};exports[_0xd00c('0x4a')]=function(_0x207cbc,_0x20ed7c){if(_0x207cbc[_0xd00c('0x49')]['id']){delete _0x207cbc[_0xd00c('0x49')]['id'];}return db[_0xd00c('0x2c')][_0xd00c('0x46')]({'where':{'id':_0x207cbc[_0xd00c('0x45')]['id']}})[_0xd00c('0x25')](handleEntityNotFound(_0x20ed7c,null))[_0xd00c('0x25')](saveUpdates(_0x207cbc['body'],null))[_0xd00c('0x25')](respondWithResult(_0x20ed7c,null))[_0xd00c('0x47')](handleError(_0x20ed7c,null));};exports[_0xd00c('0x4b')]=function(_0x380147,_0x1f7d40){return db[_0xd00c('0x2c')]['find']({'where':{'id':_0x380147[_0xd00c('0x45')]['id']}})[_0xd00c('0x25')](handleEntityNotFound(_0x1f7d40,null))[_0xd00c('0x25')](removeEntity(_0x1f7d40,null))['catch'](handleError(_0x1f7d40,null));};exports[_0xd00c('0x4c')]=function(_0x3c237c,_0x28d8ff){return db['ChatQueueReport']['describe']()[_0xd00c('0x25')](respondWithResult(_0x28d8ff,null))[_0xd00c('0x47')](handleError(_0x28d8ff,null));}; \ No newline at end of file +var _0xcac3=['fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','destroy','then','error','stack','name','send','index','map','ChatQueueReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','update','describe','rimraf','zip-dir'];(function(_0x14d956,_0x569303){var _0xc46c95=function(_0x37468b){while(--_0x37468b){_0x14d956['push'](_0x14d956['shift']());}};_0xc46c95(++_0x569303);}(_0xcac3,0x193));var _0x3cac=function(_0x4c03ea,_0x3465be){_0x4c03ea=_0x4c03ea-0x0;var _0x7a6922=_0xcac3[_0x4c03ea];return _0x7a6922;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3cac('0x0'));var zipdir=require(_0x3cac('0x1'));var jsonpatch=require(_0x3cac('0x2'));var rp=require(_0x3cac('0x3'));var moment=require(_0x3cac('0x4'));var BPromise=require(_0x3cac('0x5'));var Mustache=require(_0x3cac('0x6'));var util=require(_0x3cac('0x7'));var path=require(_0x3cac('0x8'));var sox=require(_0x3cac('0x9'));var csv=require(_0x3cac('0xa'));var ejs=require(_0x3cac('0xb'));var fs=require('fs');var fs_extra=require(_0x3cac('0xc'));var _=require(_0x3cac('0xd'));var squel=require(_0x3cac('0xe'));var crypto=require(_0x3cac('0xf'));var jsforce=require(_0x3cac('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x3cac('0xa'));var querystring=require(_0x3cac('0x11'));var Papa=require(_0x3cac('0x12'));var Redis=require(_0x3cac('0x13'));var authService=require(_0x3cac('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x3cac('0x15'));var hardwareService=require(_0x3cac('0x16'));var logger=require(_0x3cac('0x17'))(_0x3cac('0x18'));var utils=require(_0x3cac('0x19'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x3cac('0x1a'))['db'];function respondWithStatusCode(_0xfc7684,_0x2d3ca6){_0x2d3ca6=_0x2d3ca6||0xcc;return function(_0x134b95){if(_0x134b95){return _0xfc7684[_0x3cac('0x1b')](_0x2d3ca6);}return _0xfc7684[_0x3cac('0x1c')](_0x2d3ca6)[_0x3cac('0x1d')]();};}function respondWithResult(_0x4bee52,_0x37a3b1){_0x37a3b1=_0x37a3b1||0xc8;return function(_0x2db008){if(_0x2db008){return _0x4bee52[_0x3cac('0x1c')](_0x37a3b1)[_0x3cac('0x1e')](_0x2db008);}};}function respondWithFilteredResult(_0x4680aa,_0x8d8927){return function(_0x202437){if(_0x202437){var _0x37e529=typeof _0x8d8927[_0x3cac('0x1f')]===_0x3cac('0x20')&&typeof _0x8d8927[_0x3cac('0x21')]===_0x3cac('0x20');var _0x2c1766=_0x202437[_0x3cac('0x22')];var _0x1b1007=_0x37e529?0x0:_0x8d8927[_0x3cac('0x1f')];var _0x752c5b=_0x37e529?_0x202437[_0x3cac('0x22')]:_0x8d8927[_0x3cac('0x1f')]+_0x8d8927[_0x3cac('0x21')];var _0x1a2e7e;if(_0x752c5b>=_0x2c1766){_0x752c5b=_0x2c1766;_0x1a2e7e=0xc8;}else{_0x1a2e7e=0xce;}_0x4680aa[_0x3cac('0x1c')](_0x1a2e7e);return _0x4680aa['set'](_0x3cac('0x23'),_0x1b1007+'-'+_0x752c5b+'/'+_0x2c1766)[_0x3cac('0x1e')](_0x202437);}return null;};}function patchUpdates(_0x5af4b9){return function(_0x1d5d41){try{jsonpatch[_0x3cac('0x24')](_0x1d5d41,_0x5af4b9,!![]);}catch(_0x40a088){return BPromise[_0x3cac('0x25')](_0x40a088);}return _0x1d5d41[_0x3cac('0x26')]();};}function saveUpdates(_0x147d3b,_0x530057){return function(_0x19010f){if(_0x19010f){return _0x19010f['update'](_0x147d3b)['then'](function(_0x5a78ed){return _0x5a78ed;});}return null;};}function removeEntity(_0xf63f1d,_0x842c3d){return function(_0x2fe8a9){if(_0x2fe8a9){return _0x2fe8a9[_0x3cac('0x27')]()[_0x3cac('0x28')](function(){_0xf63f1d[_0x3cac('0x1c')](0xcc)[_0x3cac('0x1d')]();});}};}function handleEntityNotFound(_0x3f79b6,_0x303d05){return function(_0x456883){if(!_0x456883){_0x3f79b6[_0x3cac('0x1b')](0x194);}return _0x456883;};}function handleError(_0x407e8b,_0x5c60df){_0x5c60df=_0x5c60df||0x1f4;return function(_0x24c4fb){logger[_0x3cac('0x29')](_0x24c4fb[_0x3cac('0x2a')]);if(_0x24c4fb[_0x3cac('0x2b')]){delete _0x24c4fb[_0x3cac('0x2b')];}_0x407e8b[_0x3cac('0x1c')](_0x5c60df)[_0x3cac('0x2c')](_0x24c4fb);};}exports[_0x3cac('0x2d')]=function(_0xbc5721,_0x2d7847){var _0x2b7caf={},_0x391412={},_0x2019c0={'count':0x0,'rows':[]};var _0x29c896=_[_0x3cac('0x2e')](db[_0x3cac('0x2f')][_0x3cac('0x30')],function(_0xa08a6){return{'name':_0xa08a6[_0x3cac('0x31')],'type':_0xa08a6[_0x3cac('0x32')][_0x3cac('0x33')]};});_0x391412[_0x3cac('0x34')]=_[_0x3cac('0x2e')](_0x29c896,'name');_0x391412[_0x3cac('0x35')]=_[_0x3cac('0x36')](_0xbc5721[_0x3cac('0x35')]);_0x391412[_0x3cac('0x37')]=_[_0x3cac('0x38')](_0x391412['model'],_0x391412['query']);_0x2b7caf[_0x3cac('0x39')]=_[_0x3cac('0x38')](_0x391412['model'],qs[_0x3cac('0x3a')](_0xbc5721['query']['fields']));_0x2b7caf[_0x3cac('0x39')]=_0x2b7caf[_0x3cac('0x39')]['length']?_0x2b7caf[_0x3cac('0x39')]:_0x391412[_0x3cac('0x34')];if(!_0xbc5721[_0x3cac('0x35')][_0x3cac('0x3b')](_0x3cac('0x3c'))){_0x2b7caf[_0x3cac('0x21')]=qs[_0x3cac('0x21')](_0xbc5721[_0x3cac('0x35')][_0x3cac('0x21')]);_0x2b7caf['offset']=qs['offset'](_0xbc5721[_0x3cac('0x35')][_0x3cac('0x1f')]);}_0x2b7caf[_0x3cac('0x3d')]=qs[_0x3cac('0x3e')](_0xbc5721[_0x3cac('0x35')][_0x3cac('0x3e')]);_0x2b7caf[_0x3cac('0x3f')]=qs[_0x3cac('0x37')](_['pick'](_0xbc5721[_0x3cac('0x35')],_0x391412[_0x3cac('0x37')]),_0x29c896);if(_0xbc5721['query'][_0x3cac('0x40')]){_0x2b7caf[_0x3cac('0x3f')]=_[_0x3cac('0x41')](_0x2b7caf['where'],{'$or':_['map'](_0x29c896,function(_0x22e17b){if(_0x22e17b[_0x3cac('0x32')]!==_0x3cac('0x42')){var _0xc9b8c2={};_0xc9b8c2[_0x22e17b[_0x3cac('0x2b')]]={'$like':'%'+_0xbc5721[_0x3cac('0x35')][_0x3cac('0x40')]+'%'};return _0xc9b8c2;}})});}_0x2b7caf=_[_0x3cac('0x41')]({},_0x2b7caf,_0xbc5721[_0x3cac('0x43')]);var _0x2cb2c0={'where':_0x2b7caf[_0x3cac('0x3f')]};return db[_0x3cac('0x2f')][_0x3cac('0x22')](_0x2cb2c0)['then'](function(_0x25b897){_0x2019c0['count']=_0x25b897;if(_0xbc5721[_0x3cac('0x35')][_0x3cac('0x44')]){_0x2b7caf[_0x3cac('0x45')]=[{'all':!![]}];}return db[_0x3cac('0x2f')][_0x3cac('0x46')](_0x2b7caf);})['then'](function(_0x135a22){_0x2019c0[_0x3cac('0x47')]=_0x135a22;return _0x2019c0;})[_0x3cac('0x28')](respondWithFilteredResult(_0x2d7847,_0x2b7caf))[_0x3cac('0x48')](handleError(_0x2d7847,null));};exports[_0x3cac('0x49')]=function(_0x455487,_0x1f46ce){var _0x25f972={'raw':!![],'where':{'id':_0x455487[_0x3cac('0x4a')]['id']}},_0x1fb9be={};_0x1fb9be[_0x3cac('0x34')]=_[_0x3cac('0x36')](db['ChatQueueReport']['rawAttributes']);_0x1fb9be[_0x3cac('0x35')]=_[_0x3cac('0x36')](_0x455487['query']);_0x1fb9be[_0x3cac('0x37')]=_[_0x3cac('0x38')](_0x1fb9be['model'],_0x1fb9be[_0x3cac('0x35')]);_0x25f972[_0x3cac('0x39')]=_[_0x3cac('0x38')](_0x1fb9be[_0x3cac('0x34')],qs[_0x3cac('0x3a')](_0x455487[_0x3cac('0x35')][_0x3cac('0x3a')]));_0x25f972[_0x3cac('0x39')]=_0x25f972['attributes'][_0x3cac('0x4b')]?_0x25f972['attributes']:_0x1fb9be['model'];if(_0x455487[_0x3cac('0x35')][_0x3cac('0x44')]){_0x25f972['include']=[{'all':!![]}];}_0x25f972=_[_0x3cac('0x41')]({},_0x25f972,_0x455487[_0x3cac('0x43')]);return db[_0x3cac('0x2f')][_0x3cac('0x4c')](_0x25f972)[_0x3cac('0x28')](handleEntityNotFound(_0x1f46ce,null))['then'](respondWithResult(_0x1f46ce,null))[_0x3cac('0x48')](handleError(_0x1f46ce,null));};exports[_0x3cac('0x4d')]=function(_0x550a9c,_0x3f26d1){return db[_0x3cac('0x2f')][_0x3cac('0x4d')](_0x550a9c[_0x3cac('0x4e')],{})['then'](respondWithResult(_0x3f26d1,0xc9))[_0x3cac('0x48')](handleError(_0x3f26d1,null));};exports[_0x3cac('0x4f')]=function(_0x1827ba,_0xab4339){if(_0x1827ba[_0x3cac('0x4e')]['id']){delete _0x1827ba['body']['id'];}return db[_0x3cac('0x2f')][_0x3cac('0x4c')]({'where':{'id':_0x1827ba[_0x3cac('0x4a')]['id']}})['then'](handleEntityNotFound(_0xab4339,null))[_0x3cac('0x28')](saveUpdates(_0x1827ba[_0x3cac('0x4e')],null))[_0x3cac('0x28')](respondWithResult(_0xab4339,null))[_0x3cac('0x48')](handleError(_0xab4339,null));};exports['destroy']=function(_0x22b140,_0x39c044){return db['ChatQueueReport'][_0x3cac('0x4c')]({'where':{'id':_0x22b140['params']['id']}})[_0x3cac('0x28')](handleEntityNotFound(_0x39c044,null))[_0x3cac('0x28')](removeEntity(_0x39c044,null))[_0x3cac('0x48')](handleError(_0x39c044,null));};exports['describe']=function(_0x503fca,_0x568c7b){return db[_0x3cac('0x2f')][_0x3cac('0x50')]()['then'](respondWithResult(_0x568c7b,null))[_0x3cac('0x48')](handleError(_0x568c7b,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index 66e76f7..f5b7dd0 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 _0xe706=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatQueueReport.attributes','exports','define','ChatQueueReport','report_chat_queue','uniqueid','lodash','util'];(function(_0x187499,_0x5e416a){var _0x2965fe=function(_0xc6645e){while(--_0xc6645e){_0x187499['push'](_0x187499['shift']());}};_0x2965fe(++_0x5e416a);}(_0xe706,0xa3));var _0x6e70=function(_0x3f553b,_0x49a9c2){_0x3f553b=_0x3f553b-0x0;var _0x183c4e=_0xe706[_0x3f553b];return _0x183c4e;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var logger=require(_0x6e70('0x2'))('api');var moment=require(_0x6e70('0x3'));var BPromise=require(_0x6e70('0x4'));var rp=require(_0x6e70('0x5'));var fs=require('fs');var path=require(_0x6e70('0x6'));var rimraf=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var attributes=require(_0x6e70('0x9'));module[_0x6e70('0xa')]=function(_0x1b0389,_0x4381d1){return _0x1b0389[_0x6e70('0xb')](_0x6e70('0xc'),attributes,{'tableName':_0x6e70('0xd'),'paranoid':![],'indexes':[{'name':_0x6e70('0xe'),'fields':[_0x6e70('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb10b=['../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./chatQueueReport.attributes','exports','define','report_chat_queue','uniqueid','lodash'];(function(_0x2f8805,_0x2f1d21){var _0xa16375=function(_0x1c5bcc){while(--_0x1c5bcc){_0x2f8805['push'](_0x2f8805['shift']());}};_0xa16375(++_0x2f1d21);}(_0xb10b,0x12a));var _0xbb10=function(_0x1de01d,_0xeb122c){_0x1de01d=_0x1de01d-0x0;var _0x2865ef=_0xb10b[_0x1de01d];return _0x2865ef;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var logger=require(_0xbb10('0x1'))(_0xbb10('0x2'));var moment=require(_0xbb10('0x3'));var BPromise=require('bluebird');var rp=require(_0xbb10('0x4'));var fs=require('fs');var path=require(_0xbb10('0x5'));var rimraf=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var attributes=require(_0xbb10('0x8'));module[_0xbb10('0x9')]=function(_0x481979,_0x328583){return _0x481979[_0xbb10('0xa')]('ChatQueueReport',attributes,{'tableName':_0xbb10('0xb'),'paranoid':![],'indexes':[{'name':_0xbb10('0xc'),'fields':[_0xbb10('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.rpc.js b/server/api/chatQueueReport/chatQueueReport.rpc.js index 43b182d..31b38d0 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 _0xaad5=['error','code','message','result','ChatQueueReport','create','options','raw','catch','CreateChatQueueReport','UpdateChatQueueReport','update','body','attributes','limit','lodash','util','moment','ioredis','../../config/logger','rpc','../../config/environment','http','request','then','info','ChatQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify'];(function(_0x1ae951,_0x28d675){var _0x3570aa=function(_0x458cb5){while(--_0x458cb5){_0x1ae951['push'](_0x1ae951['shift']());}};_0x3570aa(++_0x28d675);}(_0xaad5,0x177));var _0x5aad=function(_0x3e2fcf,_0x579110){_0x3e2fcf=_0x3e2fcf-0x0;var _0x497db7=_0xaad5[_0x3e2fcf];return _0x497db7;};'use strict';var _=require(_0x5aad('0x0'));var util=require(_0x5aad('0x1'));var moment=require(_0x5aad('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5aad('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x5aad('0x4'))(_0x5aad('0x5'));var config=require(_0x5aad('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x5aad('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x3b02e4,_0x59aef4,_0x57e1ed){return new BPromise(function(_0x3f7a73,_0x2dc9d4){return client[_0x5aad('0x8')](_0x3b02e4,_0x57e1ed)[_0x5aad('0x9')](function(_0x543d05){logger[_0x5aad('0xa')](_0x5aad('0xb'),_0x59aef4,_0x5aad('0xc'));logger[_0x5aad('0xd')]('ChatQueueReport,\x20%s,\x20%s,\x20%s',_0x59aef4,_0x5aad('0xc'),JSON[_0x5aad('0xe')](_0x543d05));if(_0x543d05[_0x5aad('0xf')]){if(_0x543d05[_0x5aad('0xf')][_0x5aad('0x10')]===0x1f4){logger[_0x5aad('0xf')]('ChatQueueReport,\x20%s,\x20%s',_0x59aef4,_0x543d05['error'][_0x5aad('0x11')]);return _0x2dc9d4(_0x543d05[_0x5aad('0xf')][_0x5aad('0x11')]);}logger[_0x5aad('0xf')](_0x5aad('0xb'),_0x59aef4,_0x543d05[_0x5aad('0xf')]['message']);return _0x3f7a73(_0x543d05[_0x5aad('0xf')][_0x5aad('0x11')]);}else{logger[_0x5aad('0xa')]('ChatQueueReport,\x20%s,\x20%s',_0x59aef4,'request\x20sent');_0x3f7a73(_0x543d05[_0x5aad('0x12')][_0x5aad('0x11')]);}})['catch'](function(_0x3d5720){logger['error'](_0x5aad('0xb'),_0x59aef4,_0x3d5720);_0x2dc9d4(_0x3d5720);});});}exports['CreateChatQueueReport']=function(_0x26d226){var _0x194b2c=this;return new Promise(function(_0x5e4ca3,_0x108464){return db[_0x5aad('0x13')][_0x5aad('0x14')](_0x26d226['body'],{'raw':_0x26d226[_0x5aad('0x15')]?_0x26d226[_0x5aad('0x15')][_0x5aad('0x16')]===undefined?!![]:![]:!![]})[_0x5aad('0x9')](function(_0x42a98b){logger['info']('CreateChatQueueReport',_0x26d226);logger[_0x5aad('0xd')]('CreateChatQueueReport',_0x26d226,JSON[_0x5aad('0xe')](_0x42a98b));_0x5e4ca3(_0x42a98b);})[_0x5aad('0x17')](function(_0x3ceb52){logger[_0x5aad('0xf')](_0x5aad('0x18'),_0x3ceb52['message'],_0x26d226);_0x108464(_0x194b2c[_0x5aad('0xf')](0x1f4,_0x3ceb52[_0x5aad('0x11')]));});});};exports[_0x5aad('0x19')]=function(_0x19e67a){var _0x5ad3fe=this;return new Promise(function(_0x48f075,_0x233a36){return db[_0x5aad('0x13')][_0x5aad('0x1a')](_0x19e67a[_0x5aad('0x1b')],{'raw':_0x19e67a[_0x5aad('0x15')]?_0x19e67a[_0x5aad('0x15')][_0x5aad('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x19e67a[_0x5aad('0x15')]?_0x19e67a[_0x5aad('0x15')]['where']||null:null,'attributes':_0x19e67a[_0x5aad('0x15')]?_0x19e67a[_0x5aad('0x15')][_0x5aad('0x1c')]||null:null,'limit':_0x19e67a[_0x5aad('0x15')]?_0x19e67a[_0x5aad('0x15')][_0x5aad('0x1d')]||null:null})['then'](function(_0x29a9e9){logger[_0x5aad('0xa')](_0x5aad('0x19'),_0x19e67a);logger[_0x5aad('0xd')](_0x5aad('0x19'),_0x19e67a,JSON[_0x5aad('0xe')](_0x29a9e9));_0x48f075(_0x29a9e9);})['catch'](function(_0x59e7c6){logger[_0x5aad('0xf')]('UpdateChatQueueReport',_0x59e7c6[_0x5aad('0x11')],_0x19e67a);_0x233a36(_0x5ad3fe[_0x5aad('0xf')](0x1f4,_0x59e7c6[_0x5aad('0x11')]));});});}; \ No newline at end of file +var _0xccde=['ChatQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','result','ChatQueueReport','create','options','raw','info','CreateChatQueueReport','catch','UpdateChatQueueReport','update','body','where','limit','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','ChatQueueReport,\x20%s,\x20%s','debug'];(function(_0x2e4e19,_0x493b50){var _0x9ba20b=function(_0x2f6456){while(--_0x2f6456){_0x2e4e19['push'](_0x2e4e19['shift']());}};_0x9ba20b(++_0x493b50);}(_0xccde,0x113));var _0xeccd=function(_0x4099ee,_0x38495a){_0x4099ee=_0x4099ee-0x0;var _0x1b7bfc=_0xccde[_0x4099ee];return _0x1b7bfc;};'use strict';var _=require('lodash');var util=require(_0xeccd('0x0'));var moment=require('moment');var BPromise=require(_0xeccd('0x1'));var rs=require(_0xeccd('0x2'));var fs=require('fs');var Redis=require(_0xeccd('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xeccd('0x4'));var logger=require(_0xeccd('0x5'))('rpc');var config=require(_0xeccd('0x6'));var jayson=require(_0xeccd('0x7'));var client=jayson[_0xeccd('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1b6f0e,_0x4beb0a,_0x25f064){return new BPromise(function(_0x34be82,_0x47fa75){return client[_0xeccd('0x9')](_0x1b6f0e,_0x25f064)[_0xeccd('0xa')](function(_0x31fda3){logger['info'](_0xeccd('0xb'),_0x4beb0a,'request\x20sent');logger[_0xeccd('0xc')](_0xeccd('0xd'),_0x4beb0a,_0xeccd('0xe'),JSON[_0xeccd('0xf')](_0x31fda3));if(_0x31fda3['error']){if(_0x31fda3['error'][_0xeccd('0x10')]===0x1f4){logger['error'](_0xeccd('0xb'),_0x4beb0a,_0x31fda3[_0xeccd('0x11')][_0xeccd('0x12')]);return _0x47fa75(_0x31fda3[_0xeccd('0x11')][_0xeccd('0x12')]);}logger[_0xeccd('0x11')](_0xeccd('0xb'),_0x4beb0a,_0x31fda3[_0xeccd('0x11')][_0xeccd('0x12')]);return _0x34be82(_0x31fda3[_0xeccd('0x11')][_0xeccd('0x12')]);}else{logger['info'](_0xeccd('0xb'),_0x4beb0a,'request\x20sent');_0x34be82(_0x31fda3[_0xeccd('0x13')][_0xeccd('0x12')]);}})['catch'](function(_0x38a381){logger[_0xeccd('0x11')](_0xeccd('0xb'),_0x4beb0a,_0x38a381);_0x47fa75(_0x38a381);});});}exports['CreateChatQueueReport']=function(_0x575cef){var _0x4da23c=this;return new Promise(function(_0x393825,_0x156370){return db[_0xeccd('0x14')][_0xeccd('0x15')](_0x575cef['body'],{'raw':_0x575cef[_0xeccd('0x16')]?_0x575cef[_0xeccd('0x16')][_0xeccd('0x17')]===undefined?!![]:![]:!![]})[_0xeccd('0xa')](function(_0x4d2d06){logger[_0xeccd('0x18')](_0xeccd('0x19'),_0x575cef);logger[_0xeccd('0xc')](_0xeccd('0x19'),_0x575cef,JSON[_0xeccd('0xf')](_0x4d2d06));_0x393825(_0x4d2d06);})[_0xeccd('0x1a')](function(_0x2f35c1){logger[_0xeccd('0x11')](_0xeccd('0x19'),_0x2f35c1[_0xeccd('0x12')],_0x575cef);_0x156370(_0x4da23c['error'](0x1f4,_0x2f35c1[_0xeccd('0x12')]));});});};exports[_0xeccd('0x1b')]=function(_0x1ff48a){var _0xa09a02=this;return new Promise(function(_0x48b655,_0x1a9af4){return db[_0xeccd('0x14')][_0xeccd('0x1c')](_0x1ff48a[_0xeccd('0x1d')],{'raw':_0x1ff48a[_0xeccd('0x16')]?_0x1ff48a[_0xeccd('0x16')][_0xeccd('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1ff48a['options']?_0x1ff48a[_0xeccd('0x16')][_0xeccd('0x1e')]||null:null,'attributes':_0x1ff48a[_0xeccd('0x16')]?_0x1ff48a[_0xeccd('0x16')]['attributes']||null:null,'limit':_0x1ff48a[_0xeccd('0x16')]?_0x1ff48a[_0xeccd('0x16')][_0xeccd('0x1f')]||null:null})[_0xeccd('0xa')](function(_0x266096){logger[_0xeccd('0x18')]('UpdateChatQueueReport',_0x1ff48a);logger[_0xeccd('0xc')](_0xeccd('0x1b'),_0x1ff48a,JSON['stringify'](_0x266096));_0x48b655(_0x266096);})[_0xeccd('0x1a')](function(_0x39424b){logger['error'](_0xeccd('0x1b'),_0x39424b[_0xeccd('0x12')],_0x1ff48a);_0x1a9af4(_0xa09a02[_0xeccd('0x11')](0x1f4,_0x39424b[_0xeccd('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index d44763e..0b320b0 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 _0x9d5c=['create','delete','destroy','exports','multer','util','path','connect-timeout','express','../../config/environment','./chatQueueReport.controller','get','isAuthenticated','describe','/:id','post'];(function(_0x375f69,_0x53535f){var _0x34ffba=function(_0x1709c1){while(--_0x1709c1){_0x375f69['push'](_0x375f69['shift']());}};_0x34ffba(++_0x53535f);}(_0x9d5c,0x64));var _0xc9d5=function(_0x1a1055,_0x36ed21){_0x1a1055=_0x1a1055-0x0;var _0x1abd1b=_0x9d5c[_0x1a1055];return _0x1abd1b;};'use strict';var multer=require(_0xc9d5('0x0'));var util=require(_0xc9d5('0x1'));var path=require(_0xc9d5('0x2'));var timeout=require(_0xc9d5('0x3'));var express=require(_0xc9d5('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(_0xc9d5('0x5'));var controller=require(_0xc9d5('0x6'));router[_0xc9d5('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0xc9d5('0x7')]('/describe',auth[_0xc9d5('0x8')](),controller[_0xc9d5('0x9')]);router[_0xc9d5('0x7')](_0xc9d5('0xa'),auth[_0xc9d5('0x8')](),controller['show']);router[_0xc9d5('0xb')]('/',auth[_0xc9d5('0x8')](),controller[_0xc9d5('0xc')]);router['put']('/:id',auth[_0xc9d5('0x8')](),controller['update']);router[_0xc9d5('0xd')]('/:id',auth['isAuthenticated'](),controller[_0xc9d5('0xe')]);module[_0xc9d5('0xf')]=router; \ No newline at end of file +var _0x2c78=['get','isAuthenticated','index','describe','create','put','/:id','update','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatQueueReport.controller'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x2c78,0x6e));var _0x82c7=function(_0x4eb662,_0x540e40){_0x4eb662=_0x4eb662-0x0;var _0x2d7889=_0x2c78[_0x4eb662];return _0x2d7889;};'use strict';var multer=require(_0x82c7('0x0'));var util=require(_0x82c7('0x1'));var path=require(_0x82c7('0x2'));var timeout=require('connect-timeout');var express=require(_0x82c7('0x3'));var router=express[_0x82c7('0x4')]();var fs_extra=require(_0x82c7('0x5'));var auth=require(_0x82c7('0x6'));var interaction=require(_0x82c7('0x7'));var config=require(_0x82c7('0x8'));var controller=require(_0x82c7('0x9'));router[_0x82c7('0xa')]('/',auth[_0x82c7('0xb')](),controller[_0x82c7('0xc')]);router[_0x82c7('0xa')]('/describe',auth[_0x82c7('0xb')](),controller[_0x82c7('0xd')]);router['get']('/:id',auth['isAuthenticated'](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x82c7('0xe')]);router[_0x82c7('0xf')](_0x82c7('0x10'),auth['isAuthenticated'](),controller[_0x82c7('0x11')]);router['delete']('/:id',auth[_0x82c7('0xb')](),controller[_0x82c7('0x12')]);module[_0x82c7('0x13')]=router; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.attributes.js b/server/api/chatTransferReport/chatTransferReport.attributes.js index 37dc448..381e088 100644 --- a/server/api/chatTransferReport/chatTransferReport.attributes.js +++ b/server/api/chatTransferReport/chatTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['NOW','moment','sequelize','exports','ENUM','account','agent','queue','DATE'];(function(_0x29f720,_0x13226d){var _0x47519d=function(_0x123858){while(--_0x123858){_0x29f720['push'](_0x29f720['shift']());}};_0x47519d(++_0x13226d);}(_0xe706,0xa3));var _0x6e70=function(_0x36a997,_0x288f0b){_0x36a997=_0x36a997-0x0;var _0x561b1b=_0xe706[_0x36a997];return _0x561b1b;};'use strict';var moment=require(_0x6e70('0x0'));var Sequelize=require(_0x6e70('0x1'));module[_0x6e70('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x6e70('0x3')](_0x6e70('0x4'),_0x6e70('0x5'),_0x6e70('0x6')),'allowNull':![],'defaultValue':_0x6e70('0x6')},'transferredAt':{'type':Sequelize[_0x6e70('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x6e70('0x8')]}}; \ No newline at end of file +var _0xa9e0=['account','queue','DATE','NOW','moment','sequelize','exports'];(function(_0x4d3681,_0x136f19){var _0x22c7ac=function(_0x3c6120){while(--_0x3c6120){_0x4d3681['push'](_0x4d3681['shift']());}};_0x22c7ac(++_0x136f19);}(_0xa9e0,0x123));var _0x0a9e=function(_0x37bd26,_0x5ad346){_0x37bd26=_0x37bd26-0x0;var _0xe83dc4=_0xa9e0[_0x37bd26];return _0xe83dc4;};'use strict';var moment=require(_0x0a9e('0x0'));var Sequelize=require(_0x0a9e('0x1'));module[_0x0a9e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x0a9e('0x3'),'agent',_0x0a9e('0x4')),'allowNull':![],'defaultValue':_0x0a9e('0x4')},'transferredAt':{'type':Sequelize[_0x0a9e('0x5')],'allowNull':![],'defaultValue':Sequelize[_0x0a9e('0x6')]}}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index 11228ef..3422a24 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 _0x7918=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','sendStatus','end','status','json','count','offset','limit','set','Content-Range','reject','update','then','error','stack','name','index','map','ChatTransferReport','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','nolimit','order','filters','pick','filter','merge','where','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','squel','crypto','querystring','papaparse','ioredis'];(function(_0x2acd7e,_0x4a5f48){var _0x5a6790=function(_0x52e03c){while(--_0x52e03c){_0x2acd7e['push'](_0x2acd7e['shift']());}};_0x5a6790(++_0x4a5f48);}(_0x7918,0x1e1));var _0x8791=function(_0x10ea94,_0x45b5f1){_0x10ea94=_0x10ea94-0x0;var _0x87c1bf=_0x7918[_0x10ea94];return _0x87c1bf;};'use strict';var emlformat=require(_0x8791('0x0'));var rimraf=require(_0x8791('0x1'));var zipdir=require(_0x8791('0x2'));var jsonpatch=require(_0x8791('0x3'));var rp=require(_0x8791('0x4'));var moment=require(_0x8791('0x5'));var BPromise=require(_0x8791('0x6'));var Mustache=require(_0x8791('0x7'));var util=require('util');var path=require(_0x8791('0x8'));var sox=require(_0x8791('0x9'));var csv=require(_0x8791('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x8791('0xb'));var crypto=require(_0x8791('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x8791('0xd'));var Papa=require(_0x8791('0xe'));var Redis=require(_0x8791('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x8791('0x10'));var as=require(_0x8791('0x11'));var hardwareService=require(_0x8791('0x12'));var logger=require('../../config/logger')(_0x8791('0x13'));var utils=require('../../config/utils');var config=require(_0x8791('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x20b190,_0x42000e){_0x42000e=_0x42000e||0xcc;return function(_0x313273){if(_0x313273){return _0x20b190[_0x8791('0x15')](_0x42000e);}return _0x20b190['status'](_0x42000e)[_0x8791('0x16')]();};}function respondWithResult(_0x2b42db,_0x32d001){_0x32d001=_0x32d001||0xc8;return function(_0x5cb392){if(_0x5cb392){return _0x2b42db[_0x8791('0x17')](_0x32d001)[_0x8791('0x18')](_0x5cb392);}};}function respondWithFilteredResult(_0xc74b91,_0x58b131){return function(_0x53600b){if(_0x53600b){var _0xc85c60=typeof _0x58b131['offset']==='undefined'&&typeof _0x58b131['limit']==='undefined';var _0x33c9db=_0x53600b[_0x8791('0x19')];var _0x1db2e1=_0xc85c60?0x0:_0x58b131['offset'];var _0x2f8672=_0xc85c60?_0x53600b[_0x8791('0x19')]:_0x58b131[_0x8791('0x1a')]+_0x58b131[_0x8791('0x1b')];var _0x61b79a;if(_0x2f8672>=_0x33c9db){_0x2f8672=_0x33c9db;_0x61b79a=0xc8;}else{_0x61b79a=0xce;}_0xc74b91[_0x8791('0x17')](_0x61b79a);return _0xc74b91[_0x8791('0x1c')](_0x8791('0x1d'),_0x1db2e1+'-'+_0x2f8672+'/'+_0x33c9db)[_0x8791('0x18')](_0x53600b);}return null;};}function patchUpdates(_0x1003f9){return function(_0xb37712){try{jsonpatch['apply'](_0xb37712,_0x1003f9,!![]);}catch(_0x58326f){return BPromise[_0x8791('0x1e')](_0x58326f);}return _0xb37712['save']();};}function saveUpdates(_0x5e25de,_0x5eade7){return function(_0x9d6d90){if(_0x9d6d90){return _0x9d6d90[_0x8791('0x1f')](_0x5e25de)[_0x8791('0x20')](function(_0x13d92e){return _0x13d92e;});}return null;};}function removeEntity(_0x19a75d,_0x17b090){return function(_0x17329f){if(_0x17329f){return _0x17329f['destroy']()[_0x8791('0x20')](function(){_0x19a75d['status'](0xcc)[_0x8791('0x16')]();});}};}function handleEntityNotFound(_0x372fa2,_0x492b1d){return function(_0x411ffe){if(!_0x411ffe){_0x372fa2[_0x8791('0x15')](0x194);}return _0x411ffe;};}function handleError(_0x1de0bc,_0x51edbd){_0x51edbd=_0x51edbd||0x1f4;return function(_0x2e400b){logger[_0x8791('0x21')](_0x2e400b[_0x8791('0x22')]);if(_0x2e400b[_0x8791('0x23')]){delete _0x2e400b['name'];}_0x1de0bc[_0x8791('0x17')](_0x51edbd)['send'](_0x2e400b);};}exports[_0x8791('0x24')]=function(_0x306e3a,_0x1aa4ef){var _0x5b13e1={},_0x546636={},_0x5dc91f={'count':0x0,'rows':[]};var _0x257d0e=_[_0x8791('0x25')](db[_0x8791('0x26')][_0x8791('0x27')],function(_0x3f410c){return{'name':_0x3f410c[_0x8791('0x28')],'type':_0x3f410c[_0x8791('0x29')][_0x8791('0x2a')]};});_0x546636[_0x8791('0x2b')]=_['map'](_0x257d0e,'name');_0x546636[_0x8791('0x2c')]=_[_0x8791('0x2d')](_0x306e3a[_0x8791('0x2c')]);_0x546636['filters']=_[_0x8791('0x2e')](_0x546636['model'],_0x546636[_0x8791('0x2c')]);_0x5b13e1['attributes']=_['intersection'](_0x546636[_0x8791('0x2b')],qs['fields'](_0x306e3a[_0x8791('0x2c')][_0x8791('0x2f')]));_0x5b13e1[_0x8791('0x30')]=_0x5b13e1[_0x8791('0x30')][_0x8791('0x31')]?_0x5b13e1[_0x8791('0x30')]:_0x546636[_0x8791('0x2b')];if(!_0x306e3a[_0x8791('0x2c')]['hasOwnProperty'](_0x8791('0x32'))){_0x5b13e1[_0x8791('0x1b')]=qs[_0x8791('0x1b')](_0x306e3a[_0x8791('0x2c')][_0x8791('0x1b')]);_0x5b13e1[_0x8791('0x1a')]=qs[_0x8791('0x1a')](_0x306e3a['query'][_0x8791('0x1a')]);}_0x5b13e1[_0x8791('0x33')]=qs['sort'](_0x306e3a['query']['sort']);_0x5b13e1['where']=qs[_0x8791('0x34')](_[_0x8791('0x35')](_0x306e3a['query'],_0x546636[_0x8791('0x34')]),_0x257d0e);if(_0x306e3a[_0x8791('0x2c')][_0x8791('0x36')]){_0x5b13e1['where']=_[_0x8791('0x37')](_0x5b13e1[_0x8791('0x38')],{'$or':_['map'](_0x257d0e,function(_0x13eb4b){if(_0x13eb4b[_0x8791('0x29')]!==_0x8791('0x39')){var _0x9372a1={};_0x9372a1[_0x13eb4b['name']]={'$like':'%'+_0x306e3a[_0x8791('0x2c')]['filter']+'%'};return _0x9372a1;}})});}_0x5b13e1=_[_0x8791('0x37')]({},_0x5b13e1,_0x306e3a['options']);var _0x127547={'where':_0x5b13e1[_0x8791('0x38')]};return db[_0x8791('0x26')][_0x8791('0x19')](_0x127547)[_0x8791('0x20')](function(_0x1fe837){_0x5dc91f['count']=_0x1fe837;if(_0x306e3a[_0x8791('0x2c')][_0x8791('0x3a')]){_0x5b13e1[_0x8791('0x3b')]=[{'all':!![]}];}return db[_0x8791('0x26')][_0x8791('0x3c')](_0x5b13e1);})[_0x8791('0x20')](function(_0x30b988){_0x5dc91f[_0x8791('0x3d')]=_0x30b988;return _0x5dc91f;})[_0x8791('0x20')](respondWithFilteredResult(_0x1aa4ef,_0x5b13e1))[_0x8791('0x3e')](handleError(_0x1aa4ef,null));};exports[_0x8791('0x3f')]=function(_0x5bc630,_0x15b2de){var _0x477edf={'raw':!![],'where':{'id':_0x5bc630[_0x8791('0x40')]['id']}},_0x3220e4={};_0x3220e4[_0x8791('0x2b')]=_[_0x8791('0x2d')](db[_0x8791('0x26')][_0x8791('0x27')]);_0x3220e4[_0x8791('0x2c')]=_[_0x8791('0x2d')](_0x5bc630['query']);_0x3220e4['filters']=_[_0x8791('0x2e')](_0x3220e4[_0x8791('0x2b')],_0x3220e4[_0x8791('0x2c')]);_0x477edf[_0x8791('0x30')]=_[_0x8791('0x2e')](_0x3220e4[_0x8791('0x2b')],qs['fields'](_0x5bc630[_0x8791('0x2c')][_0x8791('0x2f')]));_0x477edf[_0x8791('0x30')]=_0x477edf[_0x8791('0x30')][_0x8791('0x31')]?_0x477edf[_0x8791('0x30')]:_0x3220e4[_0x8791('0x2b')];if(_0x5bc630[_0x8791('0x2c')][_0x8791('0x3a')]){_0x477edf[_0x8791('0x3b')]=[{'all':!![]}];}_0x477edf=_[_0x8791('0x37')]({},_0x477edf,_0x5bc630[_0x8791('0x41')]);return db['ChatTransferReport'][_0x8791('0x42')](_0x477edf)[_0x8791('0x20')](handleEntityNotFound(_0x15b2de,null))[_0x8791('0x20')](respondWithResult(_0x15b2de,null))[_0x8791('0x3e')](handleError(_0x15b2de,null));};exports[_0x8791('0x43')]=function(_0x4b9d2d,_0x4894f9){return db[_0x8791('0x26')]['create'](_0x4b9d2d[_0x8791('0x44')],{})[_0x8791('0x20')](respondWithResult(_0x4894f9,0xc9))[_0x8791('0x3e')](handleError(_0x4894f9,null));};exports['update']=function(_0x197525,_0x1cab3){if(_0x197525['body']['id']){delete _0x197525[_0x8791('0x44')]['id'];}return db[_0x8791('0x26')]['find']({'where':{'id':_0x197525[_0x8791('0x40')]['id']}})[_0x8791('0x20')](handleEntityNotFound(_0x1cab3,null))[_0x8791('0x20')](saveUpdates(_0x197525[_0x8791('0x44')],null))[_0x8791('0x20')](respondWithResult(_0x1cab3,null))['catch'](handleError(_0x1cab3,null));};exports[_0x8791('0x45')]=function(_0x164d0e,_0x30f5f8){return db[_0x8791('0x26')][_0x8791('0x42')]({'where':{'id':_0x164d0e[_0x8791('0x40')]['id']}})[_0x8791('0x20')](handleEntityNotFound(_0x30f5f8,null))[_0x8791('0x20')](removeEntity(_0x30f5f8,null))[_0x8791('0x3e')](handleError(_0x30f5f8,null));};exports['describe']=function(_0x5a7791,_0x331785){return db[_0x8791('0x26')][_0x8791('0x46')]()[_0x8791('0x20')](respondWithResult(_0x331785,null))['catch'](handleError(_0x331785,null));}; \ No newline at end of file +var _0x05df=['offset','undefined','count','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','ChatTransferReport','rawAttributes','fieldName','type','key','model','map','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','filter','merge','options','includeAll','findAll','rows','catch','show','params','keys','include','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','to-csv','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/license/util','status','end','json'];(function(_0xa21cbf,_0x551394){var _0xed2632=function(_0x31f41e){while(--_0x31f41e){_0xa21cbf['push'](_0xa21cbf['shift']());}};_0xed2632(++_0x551394);}(_0x05df,0x101));var _0xf05d=function(_0x63fecc,_0x318df4){_0x63fecc=_0x63fecc-0x0;var _0x17936c=_0x05df[_0x63fecc];return _0x17936c;};'use strict';var emlformat=require(_0xf05d('0x0'));var rimraf=require(_0xf05d('0x1'));var zipdir=require(_0xf05d('0x2'));var jsonpatch=require(_0xf05d('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xf05d('0x4'));var Mustache=require(_0xf05d('0x5'));var util=require(_0xf05d('0x6'));var path=require(_0xf05d('0x7'));var sox=require('sox');var csv=require(_0xf05d('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf05d('0x9'));var squel=require('squel');var crypto=require(_0xf05d('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xf05d('0xb'));var toCsv=require('to-csv');var querystring=require(_0xf05d('0xc'));var Papa=require(_0xf05d('0xd'));var Redis=require(_0xf05d('0xe'));var authService=require(_0xf05d('0xf'));var qs=require(_0xf05d('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf05d('0x11'));var logger=require('../../config/logger')(_0xf05d('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xf05d('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x10f652,_0x192871){_0x192871=_0x192871||0xcc;return function(_0x111fde){if(_0x111fde){return _0x10f652['sendStatus'](_0x192871);}return _0x10f652[_0xf05d('0x14')](_0x192871)[_0xf05d('0x15')]();};}function respondWithResult(_0x46f79e,_0x314140){_0x314140=_0x314140||0xc8;return function(_0x271815){if(_0x271815){return _0x46f79e['status'](_0x314140)[_0xf05d('0x16')](_0x271815);}};}function respondWithFilteredResult(_0x49a010,_0x3ac901){return function(_0x106297){if(_0x106297){var _0x2b97c0=typeof _0x3ac901[_0xf05d('0x17')]===_0xf05d('0x18')&&typeof _0x3ac901['limit']===_0xf05d('0x18');var _0x3697c3=_0x106297[_0xf05d('0x19')];var _0x22e3ad=_0x2b97c0?0x0:_0x3ac901[_0xf05d('0x17')];var _0x4d59d3=_0x2b97c0?_0x106297['count']:_0x3ac901[_0xf05d('0x17')]+_0x3ac901['limit'];var _0x5522e4;if(_0x4d59d3>=_0x3697c3){_0x4d59d3=_0x3697c3;_0x5522e4=0xc8;}else{_0x5522e4=0xce;}_0x49a010[_0xf05d('0x14')](_0x5522e4);return _0x49a010['set']('Content-Range',_0x22e3ad+'-'+_0x4d59d3+'/'+_0x3697c3)[_0xf05d('0x16')](_0x106297);}return null;};}function patchUpdates(_0x5ad4fe){return function(_0x21941b){try{jsonpatch[_0xf05d('0x1a')](_0x21941b,_0x5ad4fe,!![]);}catch(_0x4024bc){return BPromise[_0xf05d('0x1b')](_0x4024bc);}return _0x21941b[_0xf05d('0x1c')]();};}function saveUpdates(_0x4dfcfe,_0xc8c4e1){return function(_0x41296e){if(_0x41296e){return _0x41296e[_0xf05d('0x1d')](_0x4dfcfe)[_0xf05d('0x1e')](function(_0x34fee9){return _0x34fee9;});}return null;};}function removeEntity(_0x20c706,_0x29321b){return function(_0x1b84ea){if(_0x1b84ea){return _0x1b84ea[_0xf05d('0x1f')]()[_0xf05d('0x1e')](function(){_0x20c706[_0xf05d('0x14')](0xcc)[_0xf05d('0x15')]();});}};}function handleEntityNotFound(_0x5829dd,_0x2d1a41){return function(_0x433e02){if(!_0x433e02){_0x5829dd[_0xf05d('0x20')](0x194);}return _0x433e02;};}function handleError(_0x329330,_0x43161e){_0x43161e=_0x43161e||0x1f4;return function(_0x1039e4){logger[_0xf05d('0x21')](_0x1039e4[_0xf05d('0x22')]);if(_0x1039e4[_0xf05d('0x23')]){delete _0x1039e4[_0xf05d('0x23')];}_0x329330[_0xf05d('0x14')](_0x43161e)[_0xf05d('0x24')](_0x1039e4);};}exports['index']=function(_0x1a585c,_0x5bcb99){var _0x341ec0={},_0x2ec064={},_0x388596={'count':0x0,'rows':[]};var _0x2f7436=_['map'](db[_0xf05d('0x25')][_0xf05d('0x26')],function(_0x45f3ce){return{'name':_0x45f3ce[_0xf05d('0x27')],'type':_0x45f3ce[_0xf05d('0x28')][_0xf05d('0x29')]};});_0x2ec064[_0xf05d('0x2a')]=_[_0xf05d('0x2b')](_0x2f7436,_0xf05d('0x23'));_0x2ec064[_0xf05d('0x2c')]=_['keys'](_0x1a585c[_0xf05d('0x2c')]);_0x2ec064['filters']=_[_0xf05d('0x2d')](_0x2ec064[_0xf05d('0x2a')],_0x2ec064[_0xf05d('0x2c')]);_0x341ec0[_0xf05d('0x2e')]=_[_0xf05d('0x2d')](_0x2ec064[_0xf05d('0x2a')],qs[_0xf05d('0x2f')](_0x1a585c[_0xf05d('0x2c')][_0xf05d('0x2f')]));_0x341ec0[_0xf05d('0x2e')]=_0x341ec0[_0xf05d('0x2e')][_0xf05d('0x30')]?_0x341ec0[_0xf05d('0x2e')]:_0x2ec064[_0xf05d('0x2a')];if(!_0x1a585c[_0xf05d('0x2c')][_0xf05d('0x31')](_0xf05d('0x32'))){_0x341ec0['limit']=qs['limit'](_0x1a585c[_0xf05d('0x2c')][_0xf05d('0x33')]);_0x341ec0[_0xf05d('0x17')]=qs[_0xf05d('0x17')](_0x1a585c[_0xf05d('0x2c')]['offset']);}_0x341ec0[_0xf05d('0x34')]=qs['sort'](_0x1a585c[_0xf05d('0x2c')][_0xf05d('0x35')]);_0x341ec0[_0xf05d('0x36')]=qs[_0xf05d('0x37')](_['pick'](_0x1a585c[_0xf05d('0x2c')],_0x2ec064[_0xf05d('0x37')]),_0x2f7436);if(_0x1a585c[_0xf05d('0x2c')][_0xf05d('0x38')]){_0x341ec0['where']=_[_0xf05d('0x39')](_0x341ec0[_0xf05d('0x36')],{'$or':_[_0xf05d('0x2b')](_0x2f7436,function(_0x3f171f){if(_0x3f171f[_0xf05d('0x28')]!=='VIRTUAL'){var _0x112fa5={};_0x112fa5[_0x3f171f[_0xf05d('0x23')]]={'$like':'%'+_0x1a585c[_0xf05d('0x2c')][_0xf05d('0x38')]+'%'};return _0x112fa5;}})});}_0x341ec0=_['merge']({},_0x341ec0,_0x1a585c[_0xf05d('0x3a')]);var _0x220968={'where':_0x341ec0[_0xf05d('0x36')]};return db[_0xf05d('0x25')][_0xf05d('0x19')](_0x220968)['then'](function(_0x133989){_0x388596[_0xf05d('0x19')]=_0x133989;if(_0x1a585c[_0xf05d('0x2c')][_0xf05d('0x3b')]){_0x341ec0['include']=[{'all':!![]}];}return db[_0xf05d('0x25')][_0xf05d('0x3c')](_0x341ec0);})[_0xf05d('0x1e')](function(_0x592abc){_0x388596[_0xf05d('0x3d')]=_0x592abc;return _0x388596;})[_0xf05d('0x1e')](respondWithFilteredResult(_0x5bcb99,_0x341ec0))[_0xf05d('0x3e')](handleError(_0x5bcb99,null));};exports[_0xf05d('0x3f')]=function(_0x1a66ef,_0x2a02d4){var _0xe17bcf={'raw':!![],'where':{'id':_0x1a66ef[_0xf05d('0x40')]['id']}},_0x2f3c89={};_0x2f3c89[_0xf05d('0x2a')]=_[_0xf05d('0x41')](db[_0xf05d('0x25')][_0xf05d('0x26')]);_0x2f3c89[_0xf05d('0x2c')]=_[_0xf05d('0x41')](_0x1a66ef['query']);_0x2f3c89[_0xf05d('0x37')]=_[_0xf05d('0x2d')](_0x2f3c89['model'],_0x2f3c89[_0xf05d('0x2c')]);_0xe17bcf[_0xf05d('0x2e')]=_[_0xf05d('0x2d')](_0x2f3c89[_0xf05d('0x2a')],qs[_0xf05d('0x2f')](_0x1a66ef[_0xf05d('0x2c')][_0xf05d('0x2f')]));_0xe17bcf[_0xf05d('0x2e')]=_0xe17bcf[_0xf05d('0x2e')][_0xf05d('0x30')]?_0xe17bcf[_0xf05d('0x2e')]:_0x2f3c89[_0xf05d('0x2a')];if(_0x1a66ef[_0xf05d('0x2c')][_0xf05d('0x3b')]){_0xe17bcf[_0xf05d('0x42')]=[{'all':!![]}];}_0xe17bcf=_['merge']({},_0xe17bcf,_0x1a66ef['options']);return db[_0xf05d('0x25')][_0xf05d('0x43')](_0xe17bcf)[_0xf05d('0x1e')](handleEntityNotFound(_0x2a02d4,null))['then'](respondWithResult(_0x2a02d4,null))['catch'](handleError(_0x2a02d4,null));};exports[_0xf05d('0x44')]=function(_0x166e72,_0x32336f){return db[_0xf05d('0x25')][_0xf05d('0x44')](_0x166e72[_0xf05d('0x45')],{})[_0xf05d('0x1e')](respondWithResult(_0x32336f,0xc9))[_0xf05d('0x3e')](handleError(_0x32336f,null));};exports['update']=function(_0x37f345,_0x1f328e){if(_0x37f345['body']['id']){delete _0x37f345[_0xf05d('0x45')]['id'];}return db['ChatTransferReport'][_0xf05d('0x43')]({'where':{'id':_0x37f345[_0xf05d('0x40')]['id']}})[_0xf05d('0x1e')](handleEntityNotFound(_0x1f328e,null))[_0xf05d('0x1e')](saveUpdates(_0x37f345[_0xf05d('0x45')],null))[_0xf05d('0x1e')](respondWithResult(_0x1f328e,null))[_0xf05d('0x3e')](handleError(_0x1f328e,null));};exports[_0xf05d('0x1f')]=function(_0x594090,_0x118e41){return db[_0xf05d('0x25')][_0xf05d('0x43')]({'where':{'id':_0x594090['params']['id']}})[_0xf05d('0x1e')](handleEntityNotFound(_0x118e41,null))[_0xf05d('0x1e')](removeEntity(_0x118e41,null))['catch'](handleError(_0x118e41,null));};exports['describe']=function(_0x2a0d20,_0x1ef603){return db[_0xf05d('0x25')]['describe']()[_0xf05d('0x1e')](respondWithResult(_0x1ef603,null))[_0xf05d('0x3e')](handleError(_0x1ef603,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index a313e35..2024a25 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 _0x4a54=['request-promise','path','rimraf','./chatTransferReport.attributes','ChatTransferReport','report_chat_transfer','uniqueid','lodash','util','../../config/logger','api','moment'];(function(_0x14d06a,_0x4fa706){var _0x580485=function(_0x286fa3){while(--_0x286fa3){_0x14d06a['push'](_0x14d06a['shift']());}};_0x580485(++_0x4fa706);}(_0x4a54,0x133));var _0x44a5=function(_0x58ef64,_0x47c44e){_0x58ef64=_0x58ef64-0x0;var _0x51584b=_0x4a54[_0x58ef64];return _0x51584b;};'use strict';var _=require(_0x44a5('0x0'));var util=require(_0x44a5('0x1'));var logger=require(_0x44a5('0x2'))(_0x44a5('0x3'));var moment=require(_0x44a5('0x4'));var BPromise=require('bluebird');var rp=require(_0x44a5('0x5'));var fs=require('fs');var path=require(_0x44a5('0x6'));var rimraf=require(_0x44a5('0x7'));var config=require('../../config/environment');var attributes=require(_0x44a5('0x8'));module['exports']=function(_0x4f1ff3,_0x45cbe5){return _0x4f1ff3['define'](_0x44a5('0x9'),attributes,{'tableName':_0x44a5('0xa'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x44a5('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x57e4=['report_chat_transfer','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./chatTransferReport.attributes','exports','define','ChatTransferReport'];(function(_0x47fd36,_0x41535d){var _0x21a0fc=function(_0x44c07c){while(--_0x44c07c){_0x47fd36['push'](_0x47fd36['shift']());}};_0x21a0fc(++_0x41535d);}(_0x57e4,0x197));var _0x457e=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x57e4[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x457e('0x0'));var util=require(_0x457e('0x1'));var logger=require(_0x457e('0x2'))(_0x457e('0x3'));var moment=require('moment');var BPromise=require(_0x457e('0x4'));var rp=require(_0x457e('0x5'));var fs=require('fs');var path=require(_0x457e('0x6'));var rimraf=require(_0x457e('0x7'));var config=require(_0x457e('0x8'));var attributes=require(_0x457e('0x9'));module[_0x457e('0xa')]=function(_0x21de0e,_0x22cca9){return _0x21de0e[_0x457e('0xb')](_0x457e('0xc'),attributes,{'tableName':_0x457e('0xd'),'paranoid':![],'indexes':[{'name':_0x457e('0xe'),'fields':[_0x457e('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.rpc.js b/server/api/chatTransferReport/chatTransferReport.rpc.js index d3fb934..50190c3 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 _0x1ef8=['then','info','ChatTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','ChatTransferReport,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x11e2d1,_0x1edb96){var _0x51fb77=function(_0x246a1d){while(--_0x246a1d){_0x11e2d1['push'](_0x11e2d1['shift']());}};_0x51fb77(++_0x1edb96);}(_0x1ef8,0x137));var _0x81ef=function(_0x38c8c0,_0x52678b){_0x38c8c0=_0x38c8c0-0x0;var _0x397bd5=_0x1ef8[_0x38c8c0];return _0x397bd5;};'use strict';var _=require(_0x81ef('0x0'));var util=require(_0x81ef('0x1'));var moment=require(_0x81ef('0x2'));var BPromise=require(_0x81ef('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x81ef('0x4'));var db=require(_0x81ef('0x5'))['db'];var utils=require(_0x81ef('0x6'));var logger=require(_0x81ef('0x7'))(_0x81ef('0x8'));var config=require(_0x81ef('0x9'));var jayson=require(_0x81ef('0xa'));var client=jayson[_0x81ef('0xb')][_0x81ef('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x16bc33,_0x468d55,_0x1c6e46){return new BPromise(function(_0x39235f,_0x19c253){return client[_0x81ef('0xd')](_0x16bc33,_0x1c6e46)[_0x81ef('0xe')](function(_0x19ef26){logger[_0x81ef('0xf')]('ChatTransferReport,\x20%s,\x20%s',_0x468d55,'request\x20sent');logger['debug'](_0x81ef('0x10'),_0x468d55,_0x81ef('0x11'),JSON[_0x81ef('0x12')](_0x19ef26));if(_0x19ef26['error']){if(_0x19ef26['error'][_0x81ef('0x13')]===0x1f4){logger[_0x81ef('0x14')](_0x81ef('0x15'),_0x468d55,_0x19ef26[_0x81ef('0x14')]['message']);return _0x19c253(_0x19ef26[_0x81ef('0x14')][_0x81ef('0x16')]);}logger['error']('ChatTransferReport,\x20%s,\x20%s',_0x468d55,_0x19ef26['error'][_0x81ef('0x16')]);return _0x39235f(_0x19ef26['error'][_0x81ef('0x16')]);}else{logger['info'](_0x81ef('0x15'),_0x468d55,_0x81ef('0x11'));_0x39235f(_0x19ef26[_0x81ef('0x17')][_0x81ef('0x16')]);}})[_0x81ef('0x18')](function(_0x5bd731){logger[_0x81ef('0x14')](_0x81ef('0x15'),_0x468d55,_0x5bd731);_0x19c253(_0x5bd731);});});} \ No newline at end of file +var _0xe802=['client','http','request','then','info','ChatTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','lodash','bluebird','randomstring','../../config/environment','jayson/promise'];(function(_0x275caa,_0x166d5e){var _0x28d670=function(_0x2a20e1){while(--_0x2a20e1){_0x275caa['push'](_0x275caa['shift']());}};_0x28d670(++_0x166d5e);}(_0xe802,0x8b));var _0x2e80=function(_0x1de352,_0x5e2970){_0x1de352=_0x1de352-0x0;var _0x2e80fd=_0xe802[_0x1de352];return _0x2e80fd;};'use strict';var _=require(_0x2e80('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x2e80('0x1'));var rs=require(_0x2e80('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x2e80('0x3'));var jayson=require(_0x2e80('0x4'));var client=jayson[_0x2e80('0x5')][_0x2e80('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x405e81,_0x277072,_0x3b9aa7){return new BPromise(function(_0x54ea09,_0x402768){return client[_0x2e80('0x7')](_0x405e81,_0x3b9aa7)[_0x2e80('0x8')](function(_0x4bd762){logger[_0x2e80('0x9')](_0x2e80('0xa'),_0x277072,_0x2e80('0xb'));logger[_0x2e80('0xc')]('ChatTransferReport,\x20%s,\x20%s,\x20%s',_0x277072,'request\x20sent',JSON[_0x2e80('0xd')](_0x4bd762));if(_0x4bd762[_0x2e80('0xe')]){if(_0x4bd762[_0x2e80('0xe')][_0x2e80('0xf')]===0x1f4){logger[_0x2e80('0xe')]('ChatTransferReport,\x20%s,\x20%s',_0x277072,_0x4bd762[_0x2e80('0xe')][_0x2e80('0x10')]);return _0x402768(_0x4bd762[_0x2e80('0xe')][_0x2e80('0x10')]);}logger[_0x2e80('0xe')](_0x2e80('0xa'),_0x277072,_0x4bd762['error'][_0x2e80('0x10')]);return _0x54ea09(_0x4bd762['error']['message']);}else{logger[_0x2e80('0x9')](_0x2e80('0xa'),_0x277072,_0x2e80('0xb'));_0x54ea09(_0x4bd762[_0x2e80('0x11')][_0x2e80('0x10')]);}})['catch'](function(_0x4ac39c){logger[_0x2e80('0xe')]('ChatTransferReport,\x20%s,\x20%s',_0x277072,_0x4ac39c);_0x402768(_0x4ac39c);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index 42e2389..483f338 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 _0x5889=['../../components/interaction/service','../../config/environment','./chatTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','update','delete','multer','connect-timeout','express','../../components/auth/service'];(function(_0x310990,_0x245984){var _0x648534=function(_0xd320e5){while(--_0xd320e5){_0x310990['push'](_0x310990['shift']());}};_0x648534(++_0x245984);}(_0x5889,0x1e2));var _0x9588=function(_0x3714ae,_0x2b7ddd){_0x3714ae=_0x3714ae-0x0;var _0x23aa06=_0x5889[_0x3714ae];return _0x23aa06;};'use strict';var multer=require(_0x9588('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x9588('0x1'));var express=require(_0x9588('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x9588('0x3'));var interaction=require(_0x9588('0x4'));var config=require(_0x9588('0x5'));var controller=require(_0x9588('0x6'));router[_0x9588('0x7')]('/',auth[_0x9588('0x8')](),controller[_0x9588('0x9')]);router['get'](_0x9588('0xa'),auth[_0x9588('0x8')](),controller[_0x9588('0xb')]);router[_0x9588('0x7')](_0x9588('0xc'),auth[_0x9588('0x8')](),controller[_0x9588('0xd')]);router[_0x9588('0xe')]('/',auth[_0x9588('0x8')](),controller[_0x9588('0xf')]);router['put'](_0x9588('0xc'),auth['isAuthenticated'](),controller[_0x9588('0x10')]);router[_0x9588('0x11')](_0x9588('0xc'),auth[_0x9588('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x99ec=['../../config/environment','./chatTransferReport.controller','isAuthenticated','index','/describe','describe','get','/:id','post','create','put','delete','destroy','exports','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x557b4a,_0x5c3929){var _0x59fa97=function(_0x24694f){while(--_0x24694f){_0x557b4a['push'](_0x557b4a['shift']());}};_0x59fa97(++_0x5c3929);}(_0x99ec,0x176));var _0xc99e=function(_0xb984a7,_0x564ef9){_0xb984a7=_0xb984a7-0x0;var _0x247044=_0x99ec[_0xb984a7];return _0x247044;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xc99e('0x0'));var express=require(_0xc99e('0x1'));var router=express[_0xc99e('0x2')]();var fs_extra=require(_0xc99e('0x3'));var auth=require(_0xc99e('0x4'));var interaction=require(_0xc99e('0x5'));var config=require(_0xc99e('0x6'));var controller=require(_0xc99e('0x7'));router['get']('/',auth[_0xc99e('0x8')](),controller[_0xc99e('0x9')]);router['get'](_0xc99e('0xa'),auth[_0xc99e('0x8')](),controller[_0xc99e('0xb')]);router[_0xc99e('0xc')](_0xc99e('0xd'),auth[_0xc99e('0x8')](),controller['show']);router[_0xc99e('0xe')]('/',auth[_0xc99e('0x8')](),controller[_0xc99e('0xf')]);router[_0xc99e('0x10')](_0xc99e('0xd'),auth[_0xc99e('0x8')](),controller['update']);router[_0xc99e('0x11')](_0xc99e('0xd'),auth[_0xc99e('0x8')](),controller[_0xc99e('0x12')]);module[_0xc99e('0x13')]=router; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.attributes.js b/server/api/chatWebsite/chatWebsite.attributes.js index a140f5a..62ce960 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 _0xdfea=['Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','CHAT','alternate','#fafafa','System','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','Generated\x20by\x20XCALLY\x20Motion','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','sequelize','randomstring','exports','STRING','address','email','Agent','#011F6A','#ffffff','BOOLEAN','ENUM','rounded','squared','We\x20are\x20here!','Send','Contact\x20us','Powered\x20by\x20xCALLY','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Form\x20submission\x20error','Note','Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!','Skip','star','thumb','INTEGER','stringify','input','name','getDataValue','onlineForm','setDataValue','textarea','offlineForm','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.'];(function(_0x4efc87,_0x17a7d1){var _0x191fc4=function(_0x19dda1){while(--_0x19dda1){_0x4efc87['push'](_0x4efc87['shift']());}};_0x191fc4(++_0x17a7d1);}(_0xdfea,0x12f));var _0xadfe=function(_0x38a1b6,_0x652988){_0x38a1b6=_0x38a1b6-0x0;var _0xfbd3d2=_0xdfea[_0x38a1b6];return _0xfbd3d2;};'use strict';var Sequelize=require(_0xadfe('0x0'));var rs=require(_0xadfe('0x1'));module[_0xadfe('0x2')]={'name':{'type':Sequelize[_0xadfe('0x3')],'allowNull':![]},'address':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xadfe('0x4')},'description':{'type':Sequelize[_0xadfe('0x3')]},'mapKey':{'type':Sequelize['STRING'],'defaultValue':_0xadfe('0x5')},'mapKeyOffline':{'type':Sequelize[_0xadfe('0x3')],'defaultValue':_0xadfe('0x5')},'key':{'type':Sequelize['STRING'],'allowNull':![]},'agentAlias':{'type':Sequelize['STRING'],'defaultValue':_0xadfe('0x6')},'customerAlias':{'type':Sequelize[_0xadfe('0x3')],'defaultValue':'Me'},'color':{'type':Sequelize[_0xadfe('0x3')],'allowNull':![],'defaultValue':_0xadfe('0x7'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0xadfe('0x3')],'allowNull':![],'defaultValue':_0xadfe('0x8'),'validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xf},'remote':{'type':Sequelize[_0xadfe('0x3')]},'animation':{'type':Sequelize[_0xadfe('0x9')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0xadfe('0xa')](_0xadfe('0xb'),_0xadfe('0xc')),'defaultValue':_0xadfe('0xb')},'header_online':{'type':Sequelize[_0xadfe('0x3')],'defaultValue':_0xadfe('0xd')},'start_chat_button':{'type':Sequelize[_0xadfe('0x3')],'defaultValue':'Chat'},'offline_chat_button':{'type':Sequelize['STRING'],'defaultValue':_0xadfe('0xe')},'header_offline':{'type':Sequelize[_0xadfe('0x3')],'defaultValue':_0xadfe('0xf')},'download_transcript':{'type':Sequelize[_0xadfe('0x9')],'defaultValue':!![]},'timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0xadfe('0x3')],'defaultValue':_0xadfe('0x10')},'defaultWhiteLabel':{'type':Sequelize[_0xadfe('0x9')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0xadfe('0x11')]},'closingQuestion':{'type':Sequelize[_0xadfe('0x3')],'defaultValue':_0xadfe('0x12')},'formSubmitSuccessMessage':{'type':Sequelize[_0xadfe('0x3')],'defaultValue':_0xadfe('0x13')},'formSubmitFailureMessage':{'type':Sequelize[_0xadfe('0x3')],'defaultValue':_0xadfe('0x14')},'noteTitle':{'type':Sequelize[_0xadfe('0x3')],'defaultValue':_0xadfe('0x15')},'placeholderMessage':{'type':Sequelize[_0xadfe('0x3')],'defaultValue':_0xadfe('0x16')},'closingMessage':{'type':Sequelize[_0xadfe('0x3')],'defaultValue':_0xadfe('0x17')},'closingMessageButton':{'type':Sequelize['STRING'],'defaultValue':'Send'},'skipMessageButton':{'type':Sequelize[_0xadfe('0x3')],'defaultValue':_0xadfe('0x18')},'conditionAgreement':{'type':Sequelize[_0xadfe('0x9')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0xadfe('0x9')],'defaultValue':![]},'enableFeedback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0xadfe('0x9')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize['STRING'],'defaultValue':'Feedback'},'ratingType':{'type':Sequelize[_0xadfe('0xa')](_0xadfe('0x19'),_0xadfe('0x1a')),'defaultValue':_0xadfe('0x19')},'ratingStarsNumber':{'type':Sequelize[_0xadfe('0x1b')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0xadfe('0x11')],'defaultValue':function(){return JSON[_0xadfe('0x1c')]({'items':[{'type':_0xadfe('0x1d'),'variable':null,'config':{'placeholder':_0xadfe('0x1e'),'type':'text','required':!![]},'props':{'title':_0xadfe('0x1e'),'helpText':''}},{'type':_0xadfe('0x1d'),'props':{'title':_0xadfe('0x5'),'helpText':''},'config':{'required':!![],'placeholder':_0xadfe('0x5'),'type':_0xadfe('0x5')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0xadfe('0x1f')](_0xadfe('0x20'))?JSON['parse'](this['getDataValue'](_0xadfe('0x20'))):{};},'set':function(_0x3996e6){return this[_0xadfe('0x21')](_0xadfe('0x20'),JSON[_0xadfe('0x1c')](_0x3996e6));}},'offlineForm':{'type':Sequelize[_0xadfe('0x11')],'defaultValue':function(){return JSON[_0xadfe('0x1c')]({'items':[{'type':_0xadfe('0x1d'),'props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':_0xadfe('0x5'),'type':_0xadfe('0x5')},'variable':null},{'type':_0xadfe('0x22'),'config':{'placeholder':'Comments'},'props':{'title':'Comments','helpText':'Leave\x20your\x20comments'}}],'fromKey':0x0});},'get':function(){return this[_0xadfe('0x1f')](_0xadfe('0x23'))?JSON['parse'](this[_0xadfe('0x1f')](_0xadfe('0x23'))):{};},'set':function(_0x162aec){return this[_0xadfe('0x21')]('offlineForm',JSON[_0xadfe('0x1c')](_0x162aec));}},'token':{'type':Sequelize[_0xadfe('0x3')],'defaultValue':function(){return rs['generate']();}},'autoclose':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0xadfe('0x9')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0xadfe('0x9')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0xadfe('0x3')]},'forwardOffline':{'type':Sequelize[_0xadfe('0x9')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0xadfe('0x3')]},'waitingTitle':{'type':Sequelize[_0xadfe('0x3')],'defaultValue':_0xadfe('0x24')},'waitingMessage':{'type':Sequelize[_0xadfe('0x3')],'defaultValue':_0xadfe('0x25')},'offlineMessageSubject':{'type':Sequelize[_0xadfe('0x3')],'defaultValue':_0xadfe('0x26')},'offlineMessageBody':{'type':Sequelize[_0xadfe('0x3')],'defaultValue':'You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:'},'enableUnmanagedNote':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0xadfe('0x3')],'defaultValue':_0xadfe('0x27')},'skipUnmanaged':{'type':Sequelize[_0xadfe('0x3')],'defaultValue':_0xadfe('0x18')},'sendUnmanaged':{'type':Sequelize['STRING'],'defaultValue':_0xadfe('0xe')},'enableCustomerAttachment':{'type':Sequelize[_0xadfe('0x9')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0xadfe('0x9')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0xadfe('0x11')]},'showAgentAvatar':{'type':Sequelize[_0xadfe('0x9')],'defaultValue':![]},'timezone':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0xadfe('0x28');}},'notificationSound':{'type':Sequelize[_0xadfe('0x9')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xadfe('0x9')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0xadfe('0x9')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0xadfe('0x3')],'defaultValue':_0xadfe('0x29')},'waitForTheAssignedAgent':{'type':Sequelize[_0xadfe('0x1b')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xadfe('0x1b')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize['STRING'],'defaultValue':'bottom_right'},'verticalAlignment':{'type':Sequelize['INTEGER'],'defaultValue':0x1e},'labelText':{'type':Sequelize[_0xadfe('0x3')],'defaultValue':_0xadfe('0x2a')},'messagesAlignment':{'type':Sequelize[_0xadfe('0x3')],'defaultValue':_0xadfe('0x2b')},'defaultTitle':{'type':Sequelize[_0xadfe('0x3')]},'customerAvatar':{'type':Sequelize[_0xadfe('0x11')]},'showCustomerAvatar':{'type':Sequelize[_0xadfe('0x9')],'defaultValue':![]},'messageFontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0xadfe('0x3')],'allowNull':![],'defaultValue':_0xadfe('0x2c'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0xadfe('0x9')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xadfe('0x9')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xadfe('0x1b')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0xadfe('0x3')],'defaultValue':_0xadfe('0x2d')},'systemAvatar':{'type':Sequelize[_0xadfe('0x11')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0xadfe('0x1b')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0xadfe('0x9')],'defaultValue':![],'comment':_0xadfe('0x2e'),'set':function(_0x339465){if(!_0x339465)this[_0xadfe('0x21')]('mandatoryDispositionPauseId',null);this[_0xadfe('0x21')]('mandatoryDisposition',_0x339465);}},'vidaooEscalation':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize['STRING']},'vidaooTopic':{'type':Sequelize[_0xadfe('0x3')],'allowNull':![],'defaultValue':_0xadfe('0x2f')},'vidaooNote':{'type':Sequelize[_0xadfe('0x3')],'defaultValue':function(){return _0xadfe('0x30');}},'vidaooMetadata':{'type':Sequelize['TEXT'],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0xadfe('0x9')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0xadfe('0x11')]}}; \ No newline at end of file +var _0x0b8b=['parse','generate','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Your\x20request\x20has\x20not\x20been\x20processed.','website_alias','bottom_right','CHAT','alternate','#fafafa','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','Generated\x20by\x20XCALLY\x20Motion','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','sequelize','randomstring','exports','STRING','email','#011F6A','#ffffff','INTEGER','BOOLEAN','ENUM','rounded','squared','We\x20are\x20here!','Chat','Send','Contact\x20us','Powered\x20by\x20xCALLY','TEXT','Form\x20properly\x20submitted','Thanks\x20you\x20for\x20your\x20time!','Skip','Feedback','star','thumb','stringify','input','name','onlineForm','setDataValue','textarea','Comments','Leave\x20your\x20comments','getDataValue','offlineForm'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0b8b,0x116));var _0xb0b8=function(_0x498bdd,_0x470eeb){_0x498bdd=_0x498bdd-0x0;var _0x392cb7=_0x0b8b[_0x498bdd];return _0x392cb7;};'use strict';var Sequelize=require(_0xb0b8('0x0'));var rs=require(_0xb0b8('0x1'));module[_0xb0b8('0x2')]={'name':{'type':Sequelize[_0xb0b8('0x3')],'allowNull':![]},'address':{'type':Sequelize[_0xb0b8('0x3')],'allowNull':![],'unique':'address'},'description':{'type':Sequelize['STRING']},'mapKey':{'type':Sequelize[_0xb0b8('0x3')],'defaultValue':_0xb0b8('0x4')},'mapKeyOffline':{'type':Sequelize[_0xb0b8('0x3')],'defaultValue':_0xb0b8('0x4')},'key':{'type':Sequelize[_0xb0b8('0x3')],'allowNull':![]},'agentAlias':{'type':Sequelize['STRING'],'defaultValue':'Agent'},'customerAlias':{'type':Sequelize[_0xb0b8('0x3')],'defaultValue':'Me'},'color':{'type':Sequelize[_0xb0b8('0x3')],'allowNull':![],'defaultValue':_0xb0b8('0x5'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0xb0b8('0x3')],'allowNull':![],'defaultValue':_0xb0b8('0x5'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0xb0b8('0x3')],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize[_0xb0b8('0x3')],'allowNull':![],'defaultValue':_0xb0b8('0x6'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0xb0b8('0x7')],'defaultValue':0xf},'remote':{'type':Sequelize[_0xb0b8('0x3')]},'animation':{'type':Sequelize[_0xb0b8('0x8')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0xb0b8('0x9')](_0xb0b8('0xa'),_0xb0b8('0xb')),'defaultValue':_0xb0b8('0xa')},'header_online':{'type':Sequelize[_0xb0b8('0x3')],'defaultValue':_0xb0b8('0xc')},'start_chat_button':{'type':Sequelize[_0xb0b8('0x3')],'defaultValue':_0xb0b8('0xd')},'offline_chat_button':{'type':Sequelize[_0xb0b8('0x3')],'defaultValue':_0xb0b8('0xe')},'header_offline':{'type':Sequelize[_0xb0b8('0x3')],'defaultValue':_0xb0b8('0xf')},'download_transcript':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'timeout':{'type':Sequelize[_0xb0b8('0x7')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0xb0b8('0x3')],'defaultValue':_0xb0b8('0x10')},'defaultWhiteLabel':{'type':Sequelize[_0xb0b8('0x8')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0xb0b8('0x11')]},'closingQuestion':{'type':Sequelize['STRING'],'defaultValue':'Do\x20you\x20want\x20to\x20close\x20the\x20interaction?'},'formSubmitSuccessMessage':{'type':Sequelize['STRING'],'defaultValue':_0xb0b8('0x12')},'formSubmitFailureMessage':{'type':Sequelize['STRING'],'defaultValue':'Form\x20submission\x20error'},'noteTitle':{'type':Sequelize[_0xb0b8('0x3')],'defaultValue':'Note'},'placeholderMessage':{'type':Sequelize[_0xb0b8('0x3')],'defaultValue':'Type\x20a\x20message'},'closingMessage':{'type':Sequelize['STRING'],'defaultValue':_0xb0b8('0x13')},'closingMessageButton':{'type':Sequelize[_0xb0b8('0x3')],'defaultValue':'Send'},'skipMessageButton':{'type':Sequelize[_0xb0b8('0x3')],'defaultValue':_0xb0b8('0x14')},'conditionAgreement':{'type':Sequelize[_0xb0b8('0x8')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0xb0b8('0x8')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0xb0b8('0x8')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0xb0b8('0x8')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0xb0b8('0x3')],'defaultValue':_0xb0b8('0x15')},'ratingType':{'type':Sequelize[_0xb0b8('0x9')](_0xb0b8('0x16'),_0xb0b8('0x17')),'defaultValue':_0xb0b8('0x16')},'ratingStarsNumber':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0xb0b8('0x11')],'defaultValue':function(){return JSON[_0xb0b8('0x18')]({'items':[{'type':_0xb0b8('0x19'),'variable':null,'config':{'placeholder':_0xb0b8('0x1a'),'type':'text','required':!![]},'props':{'title':_0xb0b8('0x1a'),'helpText':''}},{'type':'input','props':{'title':_0xb0b8('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0xb0b8('0x4'),'type':_0xb0b8('0x4')},'variable':null}],'fromKey':0x1});},'get':function(){return this['getDataValue'](_0xb0b8('0x1b'))?JSON['parse'](this['getDataValue'](_0xb0b8('0x1b'))):{};},'set':function(_0x549c23){return this[_0xb0b8('0x1c')](_0xb0b8('0x1b'),JSON[_0xb0b8('0x18')](_0x549c23));}},'offlineForm':{'type':Sequelize[_0xb0b8('0x11')],'defaultValue':function(){return JSON[_0xb0b8('0x18')]({'items':[{'type':'input','props':{'title':_0xb0b8('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0xb0b8('0x4'),'type':_0xb0b8('0x4')},'variable':null},{'type':_0xb0b8('0x1d'),'config':{'placeholder':_0xb0b8('0x1e')},'props':{'title':_0xb0b8('0x1e'),'helpText':_0xb0b8('0x1f')}}],'fromKey':0x0});},'get':function(){return this[_0xb0b8('0x20')](_0xb0b8('0x21'))?JSON[_0xb0b8('0x22')](this[_0xb0b8('0x20')]('offlineForm')):{};},'set':function(_0x495bf3){return this[_0xb0b8('0x1c')](_0xb0b8('0x21'),JSON[_0xb0b8('0x18')](_0x495bf3));}},'token':{'type':Sequelize[_0xb0b8('0x3')],'defaultValue':function(){return rs[_0xb0b8('0x23')]();}},'autoclose':{'type':Sequelize[_0xb0b8('0x8')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0xb0b8('0x8')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0xb0b8('0x8')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0xb0b8('0x3')]},'forwardOffline':{'type':Sequelize[_0xb0b8('0x8')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize['STRING']},'waitingTitle':{'type':Sequelize[_0xb0b8('0x3')],'defaultValue':_0xb0b8('0x24')},'waitingMessage':{'type':Sequelize['STRING'],'defaultValue':_0xb0b8('0x25')},'offlineMessageSubject':{'type':Sequelize[_0xb0b8('0x3')],'defaultValue':'New\x20offline\x20message\x20from\x20websiteName'},'offlineMessageBody':{'type':Sequelize[_0xb0b8('0x3')],'defaultValue':_0xb0b8('0x26')},'enableUnmanagedNote':{'type':Sequelize[_0xb0b8('0x8')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize['STRING'],'defaultValue':_0xb0b8('0x27')},'skipUnmanaged':{'type':Sequelize[_0xb0b8('0x3')],'defaultValue':_0xb0b8('0x14')},'sendUnmanaged':{'type':Sequelize[_0xb0b8('0x3')],'defaultValue':_0xb0b8('0xe')},'enableCustomerAttachment':{'type':Sequelize[_0xb0b8('0x8')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0xb0b8('0x8')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0xb0b8('0x11')]},'showAgentAvatar':{'type':Sequelize[_0xb0b8('0x8')],'defaultValue':![]},'timezone':{'type':Sequelize[_0xb0b8('0x3')]},'notificationTemplate':{'type':Sequelize[_0xb0b8('0x11')],'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['BOOLEAN'],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0xb0b8('0x8')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize['STRING'],'defaultValue':_0xb0b8('0x28')},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0xb0b8('0x3')],'defaultValue':_0xb0b8('0x29')},'verticalAlignment':{'type':Sequelize[_0xb0b8('0x7')],'defaultValue':0x1e},'labelText':{'type':Sequelize[_0xb0b8('0x3')],'defaultValue':_0xb0b8('0x2a')},'messagesAlignment':{'type':Sequelize[_0xb0b8('0x3')],'defaultValue':_0xb0b8('0x2b')},'defaultTitle':{'type':Sequelize[_0xb0b8('0x3')]},'customerAvatar':{'type':Sequelize[_0xb0b8('0x11')]},'showCustomerAvatar':{'type':Sequelize[_0xb0b8('0x8')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0xb0b8('0x7')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0xb0b8('0x3')],'allowNull':![],'defaultValue':_0xb0b8('0x2c'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xb0b8('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xb0b8('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xb0b8('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0xb0b8('0x3')],'defaultValue':_0xb0b8('0x2d')},'systemAvatar':{'type':Sequelize[_0xb0b8('0x11')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0xb0b8('0x7')],'comment':_0xb0b8('0x2e')},'mandatoryDisposition':{'type':Sequelize[_0xb0b8('0x8')],'defaultValue':![],'comment':_0xb0b8('0x2f'),'set':function(_0x3d94b8){if(!_0x3d94b8)this[_0xb0b8('0x1c')](_0xb0b8('0x30'),null);this[_0xb0b8('0x1c')](_0xb0b8('0x31'),_0x3d94b8);}},'vidaooEscalation':{'type':Sequelize[_0xb0b8('0x8')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0xb0b8('0x3')]},'vidaooTopic':{'type':Sequelize[_0xb0b8('0x3')],'allowNull':![],'defaultValue':_0xb0b8('0x32')},'vidaooNote':{'type':Sequelize['STRING'],'defaultValue':function(){return _0xb0b8('0x33');}},'vidaooMetadata':{'type':Sequelize[_0xb0b8('0x11')],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0xb0b8('0x8')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0xb0b8('0x11')]}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index 6b95dd2..df55292 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 _0x5ca6=['created','autoclose','close','ChatMessage','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','*,*,*,*','forcedOwnership','ChatQueue','queue','waitForTheAssignedQueue','Start','startRouting','EventManager','offline','difference','send','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','readFileSync','server/files/templates/chatOfflineMessage.ejs','render','toPairs','offlineMessageBody','ChatOfflineMessage','fromString','originalname','mimetype','server','files','attachments','offline-chat','basename','openNewInteraction','sequelize','transaction','Attachment','bulkCreate','Smtp','CloudProvider','forwardOffline','forwardOfflineAddress','SendMail','email','MailAccountId','subjectOffline','offlineMessageSubject','NotifyMailAccount','notifyMail','remove','Could\x20not\x20remove\x20attachment\x20file','addInteraction','omit','getInteractions','Owner','fullname','internal','Tags','tag','getProactiveActions','getLicense','virtual','increment','utf8','URL','3.5.0','remote','x-real-ip','remoteAddress','referer','replace','alignment','labelText','textColor','textButtonColor','hideWhenOffline','IntervalId','Transaction','ISOLATION_LEVELS','READ_COMMITTED','finally','getApplications','addProactiveActions','ChatProactiveAction','false','offlineForm','items','fromKey','getOfflineMessages','Contact','Attachments','addAgents','emit','userChatWebsite:save','removeAgents','userChatWebsite:remove','getAgents','mustache','path','ejs','fs-extra','lodash','querystring','html-to-text','url','../../components/parsers/qs','api','../../config/environment','../../errors/api','APIOutOfIntervalError','APINotFoundError','../../mysqldb','redis','register','client','http','request','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','status','end','json','offset','limit','count','Content-Range','update','destroy','get','ChatWebsites','sendStatus','stack','name','timezone','interval','true','ONLINE','OFFLINE','No\x20timezone','map','Intervals','some','user-agent-parser','user-agent','getResult','customerIp','cf-connecting-ip','x-forwarded-for','split','lastName','browser','version','format','unknown','%s\x20%s','model','device','vendor','Pause','rawAttributes','fieldName','query','filters','intersection','fields','attributes','length','nolimit','sort','pick','filter','where','merge','VIRTUAL','options','ChatWebsite','include','findAll','rows','params','mandatoryDispositionPause','keys','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','describe','addDisposition','ChatWebsiteId','Disposition','findOne','hasOwnProperty','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','order','removeAnswers','addLogo','filename','addAvatar','agentAvatar','file','addCustomerAvatar','customerAvatar','getLogo','join','root','server/files/images/logos/default_logo.svg','sitepic','custom','isNil','existsSync','download','getAvatar','server/files/images/avatars/default_avatar.png','server/files/images/avatars/','getCustomerAvatar','showCustomerAvatar','getSystemAvatar','server/files/images/avatars/system_avatar.png','systemAvatar','notify','ValidationError','createdAt','updatedAt','CompanyId','from','from\x20is\x20mandatory','Sequelize','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','CmContact','Contacts','ChatApplication','Applications','Interval','Chat\x20Website\x20with\x20id\x20%s\x20not\x20found','spread','account','list','applications','orderBy','priority','asc','defaults','ListId','headers','threadId','ChatInteraction','externalUrl','ContactId','interaction','contact','firstName','messageId'];(function(_0x2ac4af,_0x288c53){var _0x3a36df=function(_0x271b11){while(--_0x271b11){_0x2ac4af['push'](_0x2ac4af['shift']());}};_0x3a36df(++_0x288c53);}(_0x5ca6,0x181));var _0x65ca=function(_0x5d6e30,_0xc21d51){_0x5d6e30=_0x5d6e30-0x0;var _0x3d3f3b=_0x5ca6[_0x5d6e30];return _0x3d3f3b;};'use strict';var Mustache=require(_0x65ca('0x0'));var util=require('util');var path=require(_0x65ca('0x1'));var ejs=require(_0x65ca('0x2'));var fs=require('fs');var fs_extra=require(_0x65ca('0x3'));var _=require(_0x65ca('0x4'));var querystring=require(_0x65ca('0x5'));var htmlToText=require(_0x65ca('0x6'));var Redis=require('ioredis');var jayson=require('jayson/promise');var url=require(_0x65ca('0x7'));var qs=require(_0x65ca('0x8'));var logger=require('../../config/logger')(_0x65ca('0x9'));var config=require(_0x65ca('0xa'));var APIOutOfIntervalError=require(_0x65ca('0xb'))[_0x65ca('0xc')];var APINotFoundError=require(_0x65ca('0xb'))[_0x65ca('0xd')];var APIHandleError=require('../../errors/api')['handleError'];var db=require(_0x65ca('0xe'))['db'];config['redis']=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x65ca('0xf')]));require('./chatWebsite.socket')[_0x65ca('0x10')](socket);var client=jayson[_0x65ca('0x11')][_0x65ca('0x12')]({'port':0x232c});var client9002=jayson[_0x65ca('0x11')]['http']({'port':0x232a});var client9003=jayson[_0x65ca('0x11')][_0x65ca('0x12')]({'port':0x232b});var client9001=jayson[_0x65ca('0x11')][_0x65ca('0x12')]({'port':0x2329});function respondWithRpcPromise(_0x782230,_0x189a32,_0x18adc0,_0x6c7a94){return new Promise(function(_0x89ed0f,_0x2cc491){var _0x5d6e20=_0x6c7a94||client;return _0x5d6e20[_0x65ca('0x13')](_0x782230,_0x18adc0)[_0x65ca('0x14')](function(_0x2708c7){logger[_0x65ca('0x15')](_0x65ca('0x16'),_0x189a32,_0x65ca('0x17'));logger['debug']('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x189a32,'request\x20sent',JSON[_0x65ca('0x18')](_0x2708c7));if(_0x2708c7[_0x65ca('0x19')]){if(_0x2708c7['error'][_0x65ca('0x1a')]===0x1f4){logger[_0x65ca('0x19')]('ChatWebsite,\x20%s,\x20%s',_0x189a32,_0x2708c7[_0x65ca('0x19')][_0x65ca('0x1b')]);return _0x2cc491(_0x2708c7[_0x65ca('0x19')][_0x65ca('0x1b')]);}logger[_0x65ca('0x19')](_0x65ca('0x16'),_0x189a32,_0x2708c7['error'][_0x65ca('0x1b')]);return _0x89ed0f(_0x2708c7[_0x65ca('0x19')][_0x65ca('0x1b')]);}else{logger[_0x65ca('0x15')](_0x65ca('0x16'),_0x189a32,_0x65ca('0x17'));_0x89ed0f(_0x2708c7[_0x65ca('0x1c')][_0x65ca('0x1b')]);}})[_0x65ca('0x1d')](function(_0x333a4f){logger['error'](_0x65ca('0x16'),_0x189a32,_0x333a4f);_0x2cc491(_0x333a4f);});});}function respondWithStatusCode(_0x4fe67f,_0x3a99c9){_0x3a99c9=_0x3a99c9||0xcc;return function(_0x4e389c){if(_0x4e389c){return _0x4fe67f['sendStatus'](_0x3a99c9);}return _0x4fe67f[_0x65ca('0x1e')](_0x3a99c9)[_0x65ca('0x1f')]();};}function respondWithResult(_0x295015,_0x4be997){_0x4be997=_0x4be997||0xc8;return function(_0x19d189){if(_0x19d189){return _0x295015['status'](_0x4be997)[_0x65ca('0x20')](_0x19d189);}};}function respondWithFilteredResult(_0x539045,_0x21dc45){return function(_0x2156c0){if(_0x2156c0){var _0x1cb000=typeof _0x21dc45[_0x65ca('0x21')]==='undefined'&&typeof _0x21dc45[_0x65ca('0x22')]==='undefined';var _0x197f47=_0x2156c0['count'];var _0xb2726c=_0x1cb000?0x0:_0x21dc45[_0x65ca('0x21')];var _0x43a25b=_0x1cb000?_0x2156c0[_0x65ca('0x23')]:_0x21dc45[_0x65ca('0x21')]+_0x21dc45[_0x65ca('0x22')];var _0x1de895;if(_0x43a25b>=_0x197f47){_0x43a25b=_0x197f47;_0x1de895=0xc8;}else{_0x1de895=0xce;}_0x539045['status'](_0x1de895);return _0x539045['set'](_0x65ca('0x24'),_0xb2726c+'-'+_0x43a25b+'/'+_0x197f47)['json'](_0x2156c0);}return null;};}function saveUpdates(_0x51dba2){return function(_0x53b815){if(_0x53b815){return _0x53b815[_0x65ca('0x25')](_0x51dba2)[_0x65ca('0x14')](function(_0x4ab7dc){return _0x4ab7dc;});}return null;};}function removeEntity(_0x387910){return function(_0x14ad15){if(_0x14ad15){return _0x14ad15[_0x65ca('0x26')]()[_0x65ca('0x14')](function(){var _0xc74c7c=_0x14ad15[_0x65ca('0x27')]({'plain':!![]});var _0x3f3fd8=_0x65ca('0x28');return db['UserProfileResource'][_0x65ca('0x26')]({'where':{'type':_0x3f3fd8,'resourceId':_0xc74c7c['id']}})['then'](function(){return _0x14ad15;});})[_0x65ca('0x14')](function(){_0x387910['status'](0xcc)[_0x65ca('0x1f')]();});}};}function handleEntityNotFound(_0x1dd335){return function(_0x34374a){if(!_0x34374a){_0x1dd335[_0x65ca('0x29')](0x194);}return _0x34374a;};}function handleError(_0xbf92b5,_0x12fe28){_0x12fe28=_0x12fe28||0x1f4;return function(_0x50dcb7){logger[_0x65ca('0x19')](_0x50dcb7[_0x65ca('0x2a')]);if(_0x50dcb7[_0x65ca('0x2b')]){delete _0x50dcb7[_0x65ca('0x2b')];}_0xbf92b5['status'](_0x12fe28)['send'](_0x50dcb7);};}function iftimePromise(_0x1a912a,_0x46b66f){return respondWithRpcPromise('Command','getSnippet',{'command':_0x46b66f[_0x65ca('0x2c')]?util['format']('iftime\x20%s,%s',_0x1a912a[_0x65ca('0x2d')],_0x46b66f[_0x65ca('0x2c')]):util['format']('iftime\x20%s',_0x1a912a['interval'])},client9002)[_0x65ca('0x14')](function(_0x18040e){var _0x4f2ba6=_0x18040e&&_0x18040e['indexOf'](_0x65ca('0x2e'))>=0x0?!![]:![];logger[_0x65ca('0x15')]('[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)',_0x46b66f['id'],_0x1a912a['id'],_0x1a912a[_0x65ca('0x2d')],_0x4f2ba6?_0x65ca('0x2f'):_0x65ca('0x30'),_0x46b66f['timezone']?_0x46b66f[_0x65ca('0x2c')]:'No\x20timezone');return _0x4f2ba6;})[_0x65ca('0x1d')](function(_0x56b303){logger[_0x65ca('0x19')]('[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)',_0x46b66f['id'],_0x1a912a['id'],_0x1a912a[_0x65ca('0x2d')],util['inspect'](_0x56b303,{'showHidden':![],'depth':null}),_0x46b66f[_0x65ca('0x2c')]?_0x46b66f['timezone']:_0x65ca('0x31'));return![];});}function checkWebsiteIntervals(_0x1ee098){var _0x51bba3=_[_0x65ca('0x32')](_0x1ee098['Interval'][_0x65ca('0x33')],function(_0x44a80f){var _0xfa72c3=_0x44a80f[_0x65ca('0x27')]({'plain':!![]});return iftimePromise(_0xfa72c3,_0x1ee098);});return Promise['all'](_0x51bba3)[_0x65ca('0x14')](function(_0xbca68d){return _[_0x65ca('0x34')](_0xbca68d);});}function createInteractionObject(_0x877020,_0x21a900,_0x4627c9,_0x481699){var _0x1a559e=require(_0x65ca('0x35'));var _0x28aa66=new _0x1a559e();var _0x31b83a=_0x28aa66['setUA'](_0x4627c9[_0x65ca('0x36')])[_0x65ca('0x37')]();var _0x5ea32d=_0x21a900[_0x65ca('0x38')];if(_0x4627c9[_0x65ca('0x39')]){_0x5ea32d=_0x4627c9[_0x65ca('0x39')];}else if(_0x4627c9[_0x65ca('0x3a')]){_0x5ea32d=_['first'](_0x4627c9[_0x65ca('0x3a')][_0x65ca('0x3b')](','));}return{'ContactId':_0x481699['id'],'ChatWebsiteId':_0x877020,'from':(_0x481699['firstName']||'')+'\x20'+(_0x481699[_0x65ca('0x3c')]||''),'customerIp':_0x5ea32d,'customerPort':_0x4627c9['x-real-port']?_0x4627c9['x-real-port']:null,'referer':_0x21a900['referer'],'browserName':_0x31b83a['browser'][_0x65ca('0x2b')]&&_0x31b83a[_0x65ca('0x3d')][_0x65ca('0x3e')]?util[_0x65ca('0x3f')]('%s\x20%s',_0x31b83a[_0x65ca('0x3d')][_0x65ca('0x2b')],_0x31b83a[_0x65ca('0x3d')][_0x65ca('0x3e')]):_0x65ca('0x40'),'browserVersion':_0x31b83a[_0x65ca('0x3d')][_0x65ca('0x3e')]||'unknown','osName':util['format'](_0x65ca('0x41'),_0x31b83a['os'][_0x65ca('0x2b')],_0x31b83a['os']['version']),'osVersion':_0x31b83a['os'][_0x65ca('0x3e')],'deviceModel':_0x31b83a['device'][_0x65ca('0x42')]&&_0x31b83a[_0x65ca('0x43')][_0x65ca('0x44')]?util[_0x65ca('0x3f')]('%s\x20%s\x20%s',_0x31b83a[_0x65ca('0x43')]['model'],_0x31b83a[_0x65ca('0x43')][_0x65ca('0x44')],_0x31b83a['device']['type']):null,'deviceVendor':_0x31b83a[_0x65ca('0x43')][_0x65ca('0x44')],'deviceType':_0x31b83a[_0x65ca('0x43')]['type'],'formData':JSON['stringify'](_0x21a900)};}exports['index']=function(_0x6969de,_0x45456d){var _0x5e555f={'include':[{'model':db[_0x65ca('0x45')],'as':'mandatoryDispositionPause'}]},_0x3e1b77={},_0x509037={'count':0x0,'rows':[]};var _0x271289=_[_0x65ca('0x32')](db['ChatWebsite'][_0x65ca('0x46')],function(_0x53c33c){return{'name':_0x53c33c[_0x65ca('0x47')],'type':_0x53c33c['type']['key']};});_0x3e1b77['model']=_[_0x65ca('0x32')](_0x271289,_0x65ca('0x2b'));_0x3e1b77[_0x65ca('0x48')]=_['keys'](_0x6969de[_0x65ca('0x48')]);_0x3e1b77[_0x65ca('0x49')]=_[_0x65ca('0x4a')](_0x3e1b77[_0x65ca('0x42')],_0x3e1b77[_0x65ca('0x48')]);_0x5e555f['attributes']=_[_0x65ca('0x4a')](_0x3e1b77['model'],qs['fields'](_0x6969de[_0x65ca('0x48')][_0x65ca('0x4b')]));_0x5e555f[_0x65ca('0x4c')]=_0x5e555f[_0x65ca('0x4c')][_0x65ca('0x4d')]?_0x5e555f[_0x65ca('0x4c')]:_0x3e1b77[_0x65ca('0x42')];if(!_0x6969de[_0x65ca('0x48')]['hasOwnProperty'](_0x65ca('0x4e'))){_0x5e555f[_0x65ca('0x22')]=qs[_0x65ca('0x22')](_0x6969de[_0x65ca('0x48')][_0x65ca('0x22')]);_0x5e555f['offset']=qs[_0x65ca('0x21')](_0x6969de[_0x65ca('0x48')]['offset']);}_0x5e555f['order']=qs['sort'](_0x6969de['query'][_0x65ca('0x4f')]);_0x5e555f['where']=qs['filters'](_[_0x65ca('0x50')](_0x6969de[_0x65ca('0x48')],_0x3e1b77[_0x65ca('0x49')]),_0x271289);if(_0x6969de[_0x65ca('0x48')][_0x65ca('0x51')]){_0x5e555f[_0x65ca('0x52')]=_[_0x65ca('0x53')](_0x5e555f[_0x65ca('0x52')],{'$or':_[_0x65ca('0x32')](_0x271289,function(_0x4c3036){if(_0x4c3036['type']!==_0x65ca('0x54')){var _0x3d22e5={};_0x3d22e5[_0x4c3036[_0x65ca('0x2b')]]={'$like':'%'+_0x6969de[_0x65ca('0x48')][_0x65ca('0x51')]+'%'};return _0x3d22e5;}})});}_0x5e555f=_[_0x65ca('0x53')]({},_0x5e555f,_0x6969de[_0x65ca('0x55')]);var _0x4c05e9={'where':_0x5e555f[_0x65ca('0x52')]};return db[_0x65ca('0x56')][_0x65ca('0x23')](_0x4c05e9)[_0x65ca('0x14')](function(_0x45819a){_0x509037['count']=_0x45819a;if(_0x6969de[_0x65ca('0x48')]['includeAll']){_0x5e555f[_0x65ca('0x57')]=[{'all':!![]}];}return db[_0x65ca('0x56')][_0x65ca('0x58')](_0x5e555f);})[_0x65ca('0x14')](function(_0x133d78){_0x509037[_0x65ca('0x59')]=_0x133d78;return _0x509037;})['then'](respondWithFilteredResult(_0x45456d,_0x5e555f))['catch'](handleError(_0x45456d,null));};exports['show']=function(_0x55fee2,_0x2d1fb4){var _0x4db809={'raw':![],'where':{'id':_0x55fee2[_0x65ca('0x5a')]['id']},'include':[{'model':db[_0x65ca('0x45')],'as':_0x65ca('0x5b')}]},_0x1d7a0a={};_0x1d7a0a[_0x65ca('0x42')]=_['keys'](db[_0x65ca('0x56')][_0x65ca('0x46')]);_0x1d7a0a[_0x65ca('0x48')]=_[_0x65ca('0x5c')](_0x55fee2[_0x65ca('0x48')]);_0x1d7a0a[_0x65ca('0x49')]=_[_0x65ca('0x4a')](_0x1d7a0a[_0x65ca('0x42')],_0x1d7a0a[_0x65ca('0x48')]);_0x4db809['attributes']=_['intersection'](_0x1d7a0a[_0x65ca('0x42')],qs[_0x65ca('0x4b')](_0x55fee2['query']['fields']));_0x4db809[_0x65ca('0x4c')]=_0x4db809['attributes'][_0x65ca('0x4d')]?_0x4db809[_0x65ca('0x4c')]:_0x1d7a0a[_0x65ca('0x42')];if(_0x55fee2[_0x65ca('0x48')][_0x65ca('0x5d')]){_0x4db809['include']=[{'all':!![]}];}_0x4db809=_['merge']({},_0x4db809,_0x55fee2[_0x65ca('0x55')]);return db[_0x65ca('0x56')][_0x65ca('0x5e')](_0x4db809)[_0x65ca('0x14')](handleEntityNotFound(_0x2d1fb4,null))['then'](respondWithResult(_0x2d1fb4,null))[_0x65ca('0x1d')](handleError(_0x2d1fb4,null));};exports[_0x65ca('0x5f')]=function(_0x42b216,_0x5688d2){return db[_0x65ca('0x56')][_0x65ca('0x5f')](_0x42b216[_0x65ca('0x60')],{})[_0x65ca('0x14')](function(_0x14f91b){var _0x4c0932=_0x42b216[_0x65ca('0x61')][_0x65ca('0x27')]({'plain':!![]});if(!_0x4c0932)throw new Error(_0x65ca('0x62'));if(_0x4c0932['role']===_0x65ca('0x61')){var _0x2c6f73=_0x14f91b['get']({'plain':!![]});var _0x438ca5=_0x65ca('0x28');return db[_0x65ca('0x63')][_0x65ca('0x5e')]({'where':{'name':_0x438ca5,'userProfileId':_0x4c0932[_0x65ca('0x64')]},'raw':!![]})['then'](function(_0x5c31bf){if(_0x5c31bf&&_0x5c31bf[_0x65ca('0x65')]===0x0){return db[_0x65ca('0x66')]['create']({'name':_0x2c6f73[_0x65ca('0x2b')],'resourceId':_0x2c6f73['id'],'type':_0x5c31bf[_0x65ca('0x2b')],'sectionId':_0x5c31bf['id']},{})[_0x65ca('0x14')](function(){return _0x14f91b;});}else{return _0x14f91b;}})[_0x65ca('0x1d')](function(_0x7d769e){logger[_0x65ca('0x19')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x7d769e);throw _0x7d769e;});}return _0x14f91b;})[_0x65ca('0x14')](respondWithResult(_0x5688d2,0xc9))['catch'](handleError(_0x5688d2,null));};exports[_0x65ca('0x25')]=function(_0x14dec6,_0xa323a2){if(_0x14dec6['body']['id']){delete _0x14dec6[_0x65ca('0x60')]['id'];}return db[_0x65ca('0x56')][_0x65ca('0x5e')]({'where':{'id':_0x14dec6[_0x65ca('0x5a')]['id']},'include':[{'model':db['Pause'],'as':_0x65ca('0x5b')}]})[_0x65ca('0x14')](handleEntityNotFound(_0xa323a2,null))['then'](saveUpdates(_0x14dec6[_0x65ca('0x60')],null))['then'](respondWithResult(_0xa323a2,null))[_0x65ca('0x1d')](handleError(_0xa323a2,null));};exports['destroy']=function(_0x36c132,_0x25c39f){return db[_0x65ca('0x56')][_0x65ca('0x5e')]({'where':{'id':_0x36c132[_0x65ca('0x5a')]['id']}})[_0x65ca('0x14')](handleEntityNotFound(_0x25c39f,null))[_0x65ca('0x14')](removeEntity(_0x25c39f,null))['catch'](handleError(_0x25c39f,null));};exports['describe']=function(_0x5c4718,_0x49712f){return db['ChatWebsite'][_0x65ca('0x67')]()[_0x65ca('0x14')](respondWithResult(_0x49712f,null))[_0x65ca('0x1d')](handleError(_0x49712f,null));};exports[_0x65ca('0x68')]=function(_0x5cd4d1,_0x112ce4){if(_0x5cd4d1['body']['id']){delete _0x5cd4d1['body']['id'];}return db[_0x65ca('0x56')][_0x65ca('0x5e')]({'where':{'id':_0x5cd4d1[_0x65ca('0x5a')]['id']}})[_0x65ca('0x14')](handleEntityNotFound(_0x112ce4,null))[_0x65ca('0x14')](function(_0x8716fd){if(_0x8716fd){_0x5cd4d1[_0x65ca('0x60')][_0x65ca('0x69')]=_0x8716fd['id'];return db[_0x65ca('0x6a')][_0x65ca('0x5f')](_0x5cd4d1['body']);}})[_0x65ca('0x14')](respondWithResult(_0x112ce4,null))['catch'](handleError(_0x112ce4,null));};exports['getDispositions']=function(_0x45e31a,_0x38c5a3){var _0x219b9a={'raw':![],'where':{}};var _0x3ffc24={};var _0x52abc2={'count':0x0,'rows':[]};return db['ChatWebsite'][_0x65ca('0x6b')]({'where':{'id':_0x45e31a[_0x65ca('0x5a')]['id']}})[_0x65ca('0x14')](handleEntityNotFound(_0x38c5a3,null))['then'](function(_0x19ff90){if(_0x19ff90){_0x3ffc24[_0x65ca('0x42')]=_[_0x65ca('0x5c')](db[_0x65ca('0x6a')][_0x65ca('0x46')]);_0x3ffc24[_0x65ca('0x48')]=_[_0x65ca('0x5c')](_0x45e31a['query']);_0x3ffc24[_0x65ca('0x49')]=_[_0x65ca('0x4a')](_0x3ffc24[_0x65ca('0x42')],_0x3ffc24[_0x65ca('0x48')]);_0x219b9a[_0x65ca('0x4c')]=_[_0x65ca('0x4a')](_0x3ffc24[_0x65ca('0x42')],qs[_0x65ca('0x4b')](_0x45e31a[_0x65ca('0x48')][_0x65ca('0x4b')]));_0x219b9a['attributes']=_0x219b9a['attributes'][_0x65ca('0x4d')]?_0x219b9a[_0x65ca('0x4c')]:_0x3ffc24[_0x65ca('0x42')];if(!_0x45e31a[_0x65ca('0x48')][_0x65ca('0x6c')](_0x65ca('0x4e'))){_0x219b9a[_0x65ca('0x22')]=qs[_0x65ca('0x22')](_0x45e31a['query'][_0x65ca('0x22')]);_0x219b9a[_0x65ca('0x21')]=qs[_0x65ca('0x21')](_0x45e31a[_0x65ca('0x48')][_0x65ca('0x21')]);}_0x219b9a['order']=qs[_0x65ca('0x4f')](_0x45e31a[_0x65ca('0x48')][_0x65ca('0x4f')]);_0x219b9a[_0x65ca('0x52')]=qs['filters'](_[_0x65ca('0x50')](_0x45e31a[_0x65ca('0x48')],_0x3ffc24[_0x65ca('0x49')]));_0x219b9a['where'][_0x65ca('0x69')]=_0x19ff90['id'];if(_0x45e31a[_0x65ca('0x48')][_0x65ca('0x51')]){_0x219b9a[_0x65ca('0x52')]=_[_0x65ca('0x53')](_0x219b9a[_0x65ca('0x52')],{'$or':_[_0x65ca('0x32')](_0x219b9a['attributes'],function(_0xcfaf1d){var _0x9d63cd={};_0x9d63cd[_0xcfaf1d]={'$like':'%'+_0x45e31a[_0x65ca('0x48')]['filter']+'%'};return _0x9d63cd;})});}_0x219b9a=_[_0x65ca('0x53')]({},_0x219b9a,_0x45e31a[_0x65ca('0x55')]);return db['Disposition'][_0x65ca('0x23')]({'where':_0x219b9a[_0x65ca('0x52')]})[_0x65ca('0x14')](function(_0x153ae8){_0x52abc2[_0x65ca('0x23')]=_0x153ae8;if(_0x45e31a[_0x65ca('0x48')][_0x65ca('0x5d')]){_0x219b9a[_0x65ca('0x57')]=[{'all':!![]}];}return db[_0x65ca('0x6a')]['findAll'](_0x219b9a);})['then'](function(_0x56feaf){_0x52abc2['rows']=_0x56feaf;return _0x52abc2;});}})['then'](respondWithFilteredResult(_0x38c5a3,_0x219b9a))[_0x65ca('0x1d')](handleError(_0x38c5a3,null));};exports['removeDispositions']=function(_0x977f32,_0x5e25de){return db[_0x65ca('0x56')]['find']({'where':{'id':_0x977f32[_0x65ca('0x5a')]['id']}})[_0x65ca('0x14')](handleEntityNotFound(_0x5e25de,null))[_0x65ca('0x14')](function(_0x1a577a){if(_0x1a577a){return _0x1a577a[_0x65ca('0x6d')](_0x977f32['query'][_0x65ca('0x6e')]);}})[_0x65ca('0x14')](respondWithStatusCode(_0x5e25de,null))['catch'](handleError(_0x5e25de,null));};exports[_0x65ca('0x6f')]=function(_0x22fab6,_0x4826d3){if(_0x22fab6[_0x65ca('0x60')]['id']){delete _0x22fab6[_0x65ca('0x60')]['id'];}return db['ChatWebsite'][_0x65ca('0x5e')]({'where':{'id':_0x22fab6[_0x65ca('0x5a')]['id']}})[_0x65ca('0x14')](handleEntityNotFound(_0x4826d3,null))[_0x65ca('0x14')](function(_0x930e51){if(_0x930e51){_0x22fab6[_0x65ca('0x60')][_0x65ca('0x69')]=_0x930e51['id'];return db[_0x65ca('0x70')]['create'](_0x22fab6[_0x65ca('0x60')]);}})['then'](respondWithResult(_0x4826d3,null))['catch'](handleError(_0x4826d3,null));};exports[_0x65ca('0x71')]=function(_0x540e2c,_0x545514){var _0x51fcae={'raw':![],'where':{}};var _0x222f4f={};var _0xea3cd2={'count':0x0,'rows':[]};return db[_0x65ca('0x56')][_0x65ca('0x6b')]({'where':{'id':_0x540e2c[_0x65ca('0x5a')]['id']}})[_0x65ca('0x14')](handleEntityNotFound(_0x545514,null))[_0x65ca('0x14')](function(_0x5d52e6){if(_0x5d52e6){_0x222f4f[_0x65ca('0x42')]=_['keys'](db['CannedAnswer'][_0x65ca('0x46')]);_0x222f4f[_0x65ca('0x48')]=_[_0x65ca('0x5c')](_0x540e2c[_0x65ca('0x48')]);_0x222f4f[_0x65ca('0x49')]=_[_0x65ca('0x4a')](_0x222f4f['model'],_0x222f4f[_0x65ca('0x48')]);_0x51fcae['attributes']=_[_0x65ca('0x4a')](_0x222f4f[_0x65ca('0x42')],qs[_0x65ca('0x4b')](_0x540e2c['query'][_0x65ca('0x4b')]));_0x51fcae[_0x65ca('0x4c')]=_0x51fcae[_0x65ca('0x4c')][_0x65ca('0x4d')]?_0x51fcae[_0x65ca('0x4c')]:_0x222f4f[_0x65ca('0x42')];if(!_0x540e2c[_0x65ca('0x48')][_0x65ca('0x6c')]('nolimit')){_0x51fcae[_0x65ca('0x22')]=qs[_0x65ca('0x22')](_0x540e2c[_0x65ca('0x48')][_0x65ca('0x22')]);_0x51fcae['offset']=qs['offset'](_0x540e2c['query'][_0x65ca('0x21')]);}_0x51fcae[_0x65ca('0x72')]=qs[_0x65ca('0x4f')](_0x540e2c[_0x65ca('0x48')][_0x65ca('0x4f')]);_0x51fcae[_0x65ca('0x52')]=qs['filters'](_[_0x65ca('0x50')](_0x540e2c[_0x65ca('0x48')],_0x222f4f['filters']));_0x51fcae[_0x65ca('0x52')][_0x65ca('0x69')]=_0x5d52e6['id'];if(_0x540e2c[_0x65ca('0x48')][_0x65ca('0x51')]){_0x51fcae[_0x65ca('0x52')]=_[_0x65ca('0x53')](_0x51fcae['where'],{'$or':_['map'](_0x51fcae[_0x65ca('0x4c')],function(_0x3054ab){var _0x3ba20b={};_0x3ba20b[_0x3054ab]={'$like':'%'+_0x540e2c[_0x65ca('0x48')][_0x65ca('0x51')]+'%'};return _0x3ba20b;})});}_0x51fcae=_['merge']({},_0x51fcae,_0x540e2c[_0x65ca('0x55')]);return db[_0x65ca('0x70')]['count']({'where':_0x51fcae[_0x65ca('0x52')]})[_0x65ca('0x14')](function(_0x20f5ba){_0xea3cd2[_0x65ca('0x23')]=_0x20f5ba;if(_0x540e2c[_0x65ca('0x48')][_0x65ca('0x5d')]){_0x51fcae[_0x65ca('0x57')]=[{'all':!![]}];}return db[_0x65ca('0x70')]['findAll'](_0x51fcae);})[_0x65ca('0x14')](function(_0x3c9dce){_0xea3cd2[_0x65ca('0x59')]=_0x3c9dce;return _0xea3cd2;});}})[_0x65ca('0x14')](respondWithFilteredResult(_0x545514,_0x51fcae))[_0x65ca('0x1d')](handleError(_0x545514,null));};exports[_0x65ca('0x73')]=function(_0x314217,_0x24c2e9){return db[_0x65ca('0x56')]['find']({'where':{'id':_0x314217[_0x65ca('0x5a')]['id']}})[_0x65ca('0x14')](handleEntityNotFound(_0x24c2e9,null))['then'](function(_0x5a74c8){if(_0x5a74c8){return _0x5a74c8[_0x65ca('0x73')](_0x314217[_0x65ca('0x48')]['ids']);}})[_0x65ca('0x14')](respondWithStatusCode(_0x24c2e9,null))[_0x65ca('0x1d')](handleError(_0x24c2e9,null));};exports[_0x65ca('0x74')]=function(_0x27a9d7,_0x1ddc42){_0x27a9d7[_0x65ca('0x60')]['sitepic']=_0x27a9d7['file'][_0x65ca('0x75')];return db[_0x65ca('0x56')][_0x65ca('0x5e')]({'where':{'id':_0x27a9d7[_0x65ca('0x5a')]['id']}})['then'](handleEntityNotFound(_0x1ddc42,null))[_0x65ca('0x14')](saveUpdates(_0x27a9d7[_0x65ca('0x60')],null))['then'](respondWithResult(_0x1ddc42,null))[_0x65ca('0x1d')](handleError(_0x1ddc42,null));};exports[_0x65ca('0x76')]=function(_0x5cb5d3,_0x4b56c0){_0x5cb5d3[_0x65ca('0x60')][_0x65ca('0x77')]=_0x5cb5d3[_0x65ca('0x78')][_0x65ca('0x75')];return db[_0x65ca('0x56')][_0x65ca('0x5e')]({'where':{'id':_0x5cb5d3[_0x65ca('0x5a')]['id']}})[_0x65ca('0x14')](handleEntityNotFound(_0x4b56c0,null))['then'](saveUpdates(_0x5cb5d3[_0x65ca('0x60')],null))[_0x65ca('0x14')](respondWithResult(_0x4b56c0,null))['catch'](handleError(_0x4b56c0,null));};exports[_0x65ca('0x79')]=function(_0x24627c,_0x1809e0){_0x24627c['body'][_0x65ca('0x7a')]=_0x24627c['file'][_0x65ca('0x75')];return db['ChatWebsite']['find']({'where':{'id':_0x24627c[_0x65ca('0x5a')]['id']}})[_0x65ca('0x14')](handleEntityNotFound(_0x1809e0,null))[_0x65ca('0x14')](saveUpdates(_0x24627c[_0x65ca('0x60')],null))['then'](respondWithResult(_0x1809e0,null))['catch'](handleError(_0x1809e0,null));};exports['addSystemAvatar']=function(_0xf649fd,_0x5e474f){_0xf649fd[_0x65ca('0x60')]['systemAvatar']=_0xf649fd[_0x65ca('0x78')][_0x65ca('0x75')];return db[_0x65ca('0x56')][_0x65ca('0x5e')]({'where':{'id':_0xf649fd[_0x65ca('0x5a')]['id']}})[_0x65ca('0x14')](handleEntityNotFound(_0x5e474f,null))[_0x65ca('0x14')](saveUpdates(_0xf649fd[_0x65ca('0x60')],null))[_0x65ca('0x14')](respondWithResult(_0x5e474f,null))[_0x65ca('0x1d')](handleError(_0x5e474f,null));};exports[_0x65ca('0x7b')]=function(_0x2b0e7b,_0x4fe8f3){var _0x45d47b=path[_0x65ca('0x7c')](config[_0x65ca('0x7d')],_0x65ca('0x7e'));var _0x497880={'where':{'id':_0x2b0e7b[_0x65ca('0x5a')]['id']},'attributes':['id',_0x65ca('0x7f')],'raw':!![]};var _0xbad6ef=![];return require('../../config/license/util')['getLicense']()[_0x65ca('0x14')](function(_0x59b9e2){if(_0x59b9e2){_0xbad6ef=_0x59b9e2[_0x65ca('0x80')];}})[_0x65ca('0x14')](function(){return db[_0x65ca('0x56')]['find'](_0x497880);})[_0x65ca('0x14')](handleEntityNotFound(_0x4fe8f3,null))[_0x65ca('0x14')](function(_0x2b31f2){if(_0x2b31f2){if(!_[_0x65ca('0x81')](_0x2b31f2['sitepic'])){if(fs[_0x65ca('0x82')](path[_0x65ca('0x7c')](config[_0x65ca('0x7d')],'server/files/images/logos/',_0x2b31f2[_0x65ca('0x7f')]))&&_0xbad6ef){_0x45d47b=path[_0x65ca('0x7c')](config['root'],'server/files/images/logos/',_0x2b31f2[_0x65ca('0x7f')]);}}return _0x4fe8f3[_0x65ca('0x83')](_0x45d47b);}})['catch'](handleError(_0x4fe8f3,null));};exports[_0x65ca('0x84')]=function(_0x535634,_0x3c30ab){var _0x3109e5=path[_0x65ca('0x7c')](config[_0x65ca('0x7d')],_0x65ca('0x85'));var _0x4549eb={'where':{'id':_0x535634[_0x65ca('0x5a')]['id']},'attributes':['id',_0x65ca('0x77')],'raw':!![]};return db[_0x65ca('0x56')][_0x65ca('0x5e')](_0x4549eb)[_0x65ca('0x14')](handleEntityNotFound(_0x3c30ab,null))[_0x65ca('0x14')](function(_0x3bc765){if(_0x3bc765){if(!_[_0x65ca('0x81')](_0x3bc765[_0x65ca('0x77')])){if(fs[_0x65ca('0x82')](path[_0x65ca('0x7c')](config[_0x65ca('0x7d')],_0x65ca('0x86'),_0x3bc765[_0x65ca('0x77')]))){_0x3109e5=path[_0x65ca('0x7c')](config['root'],_0x65ca('0x86'),_0x3bc765[_0x65ca('0x77')]);}}return _0x3c30ab[_0x65ca('0x83')](_0x3109e5);}})[_0x65ca('0x1d')](handleError(_0x3c30ab,null));};exports[_0x65ca('0x87')]=function(_0x3a1ad5,_0x51910c){var _0x383cbc=path[_0x65ca('0x7c')](config['root'],'server/files/images/avatars/customer_avatar.png');var _0xfcda7e={'where':{'id':_0x3a1ad5['params']['id']},'attributes':['id',_0x65ca('0x7a'),'showCustomerAvatar'],'raw':!![]};return db[_0x65ca('0x56')][_0x65ca('0x5e')](_0xfcda7e)[_0x65ca('0x14')](handleEntityNotFound(_0x51910c,null))['then'](function(_0x1e735c){if(_0x1e735c){if(!_[_0x65ca('0x81')](_0x1e735c[_0x65ca('0x7a')])){if(fs[_0x65ca('0x82')](path[_0x65ca('0x7c')](config[_0x65ca('0x7d')],_0x65ca('0x86'),_0x1e735c[_0x65ca('0x7a')]))&&_0x1e735c[_0x65ca('0x88')]){_0x383cbc=path[_0x65ca('0x7c')](config[_0x65ca('0x7d')],_0x65ca('0x86'),_0x1e735c[_0x65ca('0x7a')]);}}return _0x51910c[_0x65ca('0x83')](_0x383cbc);}})['catch'](handleError(_0x51910c,null));};exports[_0x65ca('0x89')]=function(_0x30bfa3,_0x4903bf){var _0x222649=path[_0x65ca('0x7c')](config[_0x65ca('0x7d')],_0x65ca('0x8a'));var _0x331093={'where':{'id':_0x30bfa3['params']['id']},'attributes':['id','systemAvatar'],'raw':!![]};return db[_0x65ca('0x56')][_0x65ca('0x5e')](_0x331093)[_0x65ca('0x14')](handleEntityNotFound(_0x4903bf,null))['then'](function(_0x5bbc7a){if(_0x5bbc7a){if(!_[_0x65ca('0x81')](_0x5bbc7a[_0x65ca('0x8b')])){if(fs[_0x65ca('0x82')](path['join'](config[_0x65ca('0x7d')],'server/files/images/avatars/',_0x5bbc7a[_0x65ca('0x8b')]))){_0x222649=path[_0x65ca('0x7c')](config[_0x65ca('0x7d')],'server/files/images/avatars/',_0x5bbc7a['systemAvatar']);}}return _0x4903bf['download'](_0x222649);}})['catch'](handleError(_0x4903bf,null));};exports[_0x65ca('0x8c')]=function(_0x1768d1,_0x5e5c3b){var _0xd1aac={'body':_0x1768d1[_0x65ca('0x60')],'channel':'chat'};var _0x525f3e=[];var _0x4db97b=[];var _0x13dcb6={};var _0x2eda1a=![];return db['CmContact'][_0x65ca('0x67')]()[_0x65ca('0x14')](function(_0x117389){if(!_0x117389){throw new db['Sequelize'][(_0x65ca('0x8d'))]('no\x20available\x20attributes');}_0x525f3e=_['difference'](_[_0x65ca('0x5c')](_0x117389),[_0x65ca('0x8e'),_0x65ca('0x8f')]);_0x4db97b=_['difference'](_[_0x65ca('0x5c')](_0x117389),[_0x65ca('0x8e'),_0x65ca('0x8f'),_0x65ca('0x90'),'ListId']);if(_0x1768d1[_0x65ca('0x60')]['id']){delete _0x1768d1[_0x65ca('0x60')]['id'];}if(_[_0x65ca('0x81')](_0x1768d1[_0x65ca('0x60')][_0x65ca('0x91')])){throw new db['Sequelize'][(_0x65ca('0x8d'))](_0x65ca('0x92'));}if(_[_0x65ca('0x81')](_0x1768d1[_0x65ca('0x60')][_0x65ca('0x60')])||_0x1768d1[_0x65ca('0x60')][_0x65ca('0x60')]===''){throw new db[(_0x65ca('0x93'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x1768d1['body'][_0x65ca('0x94')])){throw new db[(_0x65ca('0x93'))][(_0x65ca('0x8d'))](_0x65ca('0x95')+_0x4db97b);}if(!_['includes'](_0x4db97b,_0x1768d1[_0x65ca('0x60')][_0x65ca('0x94')])){throw new db['Sequelize']['ValidationError'](_0x65ca('0x96')+_0x4db97b);}_0x13dcb6[_0x1768d1[_0x65ca('0x60')][_0x65ca('0x94')]]=_0x1768d1[_0x65ca('0x60')][_0x65ca('0x91')];})['then'](function(){return db['ChatWebsite']['find']({'where':{'id':_0x1768d1[_0x65ca('0x5a')]['id']},'include':[{'model':db[_0x65ca('0x97')],'as':_0x65ca('0x98'),'include':[{'model':db[_0x65ca('0x99')],'as':_0x65ca('0x9a'),'where':_0x13dcb6,'limit':0x1,'order':[[_0x65ca('0x8f'),'DESC']]}]},{'model':db[_0x65ca('0x9b')],'as':_0x65ca('0x9c')},{'model':db['Interval'],'as':_0x65ca('0x9d'),'include':[{'model':db[_0x65ca('0x9d')],'as':'Intervals','attributes':['id',_0x65ca('0x2d')],'raw':!![]}]}]});})['then'](function(_0x3f0eaf){if(!_0x3f0eaf)throw new APINotFoundError(util[_0x65ca('0x3f')](_0x65ca('0x9e'),_0x1768d1[_0x65ca('0x5a')]['id']));if(!_0x3f0eaf['Interval']||!_0x3f0eaf['Interval'][_0x65ca('0x33')])return[_0x3f0eaf,!![]];return[_0x3f0eaf,checkWebsiteIntervals(_0x3f0eaf)];})[_0x65ca('0x9f')](function(_0x4700c7,_0x3782fc){if(!_0x3782fc)throw new APIOutOfIntervalError();if(!_0x4700c7[_0x65ca('0x98')])return;_0xd1aac[_0x65ca('0xa0')]=_0x4700c7;_0xd1aac[_0x65ca('0xa1')]=_0x4700c7['List'];_0xd1aac[_0x65ca('0xa2')]=_[_0x65ca('0xa3')](_0x4700c7[_0x65ca('0x9c')],[_0x65ca('0xa4')],[_0x65ca('0xa5')]);if(_0xd1aac[_0x65ca('0xa0')][_0x65ca('0x9c')]){delete _0xd1aac[_0x65ca('0xa0')][_0x65ca('0x9c')];}if(_0xd1aac['account'][_0x65ca('0x98')]&&_0xd1aac[_0x65ca('0xa0')]['List'][_0x65ca('0x9a')][_0x65ca('0x4d')]){return _0xd1aac[_0x65ca('0xa0')][_0x65ca('0x98')][_0x65ca('0x9a')][0x0];}var _0x4a7cf0=_[_0x65ca('0xa6')](_0x1768d1['body'],{'firstName':_0x1768d1[_0x65ca('0x60')][_0x65ca('0x91')],'ListId':_0x4700c7[_0x65ca('0xa7')]});_0x4a7cf0[_0x1768d1[_0x65ca('0x60')]['mapKey']]=_0x1768d1[_0x65ca('0x60')][_0x65ca('0x91')];return db[_0x65ca('0x99')][_0x65ca('0x5f')](_0x4a7cf0,{'fields':_0x525f3e,'raw':!![]});})[_0x65ca('0x14')](function(_0x3fcbbb){_0xd1aac['contact']=_0x3fcbbb;var _0x53ad5b=createInteractionObject(_0x1768d1[_0x65ca('0x5a')]['id'],_0x1768d1[_0x65ca('0x60')],_0x1768d1[_0x65ca('0xa8')],_0x3fcbbb);var _0x29db8c={'ChatWebsiteId':_0x1768d1[_0x65ca('0x5a')]['id'],'closed':![]};if(_0x1768d1[_0x65ca('0x60')][_0x65ca('0xa9')]){_0x29db8c[_0x65ca('0xa9')]=_0x1768d1[_0x65ca('0x60')][_0x65ca('0xa9')];return db[_0x65ca('0xaa')][_0x65ca('0x5e')]({'where':_0x29db8c})[_0x65ca('0x14')](function(_0x408ed4){if(_0x408ed4){_0x2eda1a=!![];return _0x408ed4;}_0x53ad5b[_0x65ca('0xa9')]=_0x1768d1['body'][_0x65ca('0xa9')];_0x53ad5b[_0x65ca('0xab')]=_0x1768d1[_0x65ca('0x60')][_0x65ca('0xab')];return db['ChatInteraction'][_0x65ca('0x5f')](_0x53ad5b);});}_0x29db8c[_0x65ca('0xac')]=_0x3fcbbb['id'];if(_0x1768d1[_0x65ca('0x60')][_0x65ca('0xad')]&&_0x1768d1[_0x65ca('0x60')][_0x65ca('0xad')]['id']){_0x29db8c['id']=_0x1768d1[_0x65ca('0x60')]['interaction']['id'];return db['ChatInteraction']['find']({'where':_0x29db8c})['then'](function(_0xff95a5){if(_0xff95a5){_0x2eda1a=!![];return _0xff95a5;}return db[_0x65ca('0xaa')][_0x65ca('0x5f')](_0x53ad5b);});}return db['ChatInteraction'][_0x65ca('0x5f')](_0x53ad5b);})['then'](function(_0x13245b){if(!_0x2eda1a)return _0x13245b;var _0x4345d7={'from':(_0xd1aac[_0x65ca('0xae')][_0x65ca('0xaf')]||'')+'\x20'+(_0xd1aac[_0x65ca('0xae')]['lastName']||'')};if(_0x1768d1[_0x65ca('0x60')][_0x65ca('0xa9')]&&_0x1768d1[_0x65ca('0x60')][_0x65ca('0xb0')]&&_0x1768d1[_0x65ca('0x60')][_0x65ca('0xa9')]!=_0x1768d1[_0x65ca('0x60')][_0x65ca('0xb0')]){_0x4345d7[_0x65ca('0xa9')]=_0x1768d1['body'][_0x65ca('0xb0')];}return _0x13245b[_0x65ca('0x25')](_0x4345d7);})[_0x65ca('0x14')](function(_0x3edb11){_0xd1aac[_0x65ca('0xad')]=_0x3edb11[_0x65ca('0x27')]({'plain':!![]});_0xd1aac[_0x65ca('0xad')][_0x65ca('0xb1')]=!_0x2eda1a;if(_0xd1aac[_0x65ca('0xad')][_0x65ca('0xb1')]){if(_0xd1aac['account'][_0x65ca('0xb2')]){_0xd1aac['applications']['push']({'id':0x0,'priority':_0xd1aac['applications'][_0x65ca('0x4d')]+0x1,'app':_0x65ca('0xb3'),'appdata':'unmanaged','interval':'*,*,*,*'});}}return db[_0x65ca('0xb4')][_0x65ca('0x5f')]({'body':_0x1768d1[_0x65ca('0x60')][_0x65ca('0x60')],'ChatWebsiteId':_0x1768d1['params']['id'],'ChatInteractionId':_0x3edb11['id'],'direction':'in','ContactId':_0xd1aac[_0x65ca('0xae')]['id'],'AttachmentId':_0x1768d1[_0x65ca('0x60')][_0x65ca('0xb5')]});})[_0x65ca('0x14')](function(_0x29f9a8){_0xd1aac[_0x65ca('0x1b')]=_0x29f9a8;if(!_0xd1aac[_0x65ca('0xad')][_0x65ca('0xb6')]){return;}return db[_0x65ca('0xb7')][_0x65ca('0x5e')]({'attributes':['id',_0x65ca('0x2b')],'where':{'id':_0xd1aac[_0x65ca('0xad')][_0x65ca('0xb6')]}});})[_0x65ca('0x14')](function(_0x57218d){if(_0x57218d){_0xd1aac[_0x65ca('0xa2')][_0x65ca('0xb8')]({'id':0x0,'priority':0x0,'app':_0x65ca('0xb9'),'appdata':_0x57218d['name']+','+(_0xd1aac[_0x65ca('0xa0')][_0x65ca('0xba')]||0xa),'interval':_0x65ca('0xbb')});_0xd1aac[_0x65ca('0xbc')]=!![];}if(!_0xd1aac[_0x65ca('0xad')]['queueId']){return;}return db[_0x65ca('0xbd')][_0x65ca('0x5e')]({'attributes':['id',_0x65ca('0x2b')],'where':{'id':_0xd1aac['interaction']['queueId']}});})[_0x65ca('0x14')](function(_0x2b0b0b){if(_0x2b0b0b){_0xd1aac[_0x65ca('0xa2')][_0x65ca('0xb8')]({'id':0x0,'priority':0x1,'app':_0x65ca('0xbe'),'appdata':_0x2b0b0b[_0x65ca('0x2b')]+','+(_0xd1aac[_0x65ca('0xa0')][_0x65ca('0xbf')]||0x12c),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x65ca('0xc0'),_0x65ca('0xc1'),_0xd1aac);})[_0x65ca('0x14')](function(_0x2ce01d){respondWithRpcPromise(_0x65ca('0xc2'),_0x65ca('0xc2'),{'event':_0x65ca('0x8c'),'message':_0x2ce01d},client9002);return _0x2ce01d;})[_0x65ca('0x14')](respondWithResult(_0x5e5c3b,null))[_0x65ca('0x1d')](APIHandleError(_0x5e5c3b));};exports[_0x65ca('0xc3')]=function(_0x3c4d6c,_0x109db6){var _0x58d483,_0x495df0,_0x575f1d;var _0xd33a5f=[];var _0x8e4505={};var _0x4a371f=_0x3c4d6c['files']||[];var _0x4e9e53=[];var _0x428263;return db[_0x65ca('0x99')][_0x65ca('0x67')]()[_0x65ca('0x14')](function(_0x17e65e){if(!_0x17e65e){throw new db[(_0x65ca('0x93'))]['ValidationError']('no\x20available\x20attributes');}_0xd33a5f=_[_0x65ca('0xc4')](_[_0x65ca('0x5c')](_0x17e65e),['createdAt','updatedAt',_0x65ca('0x90'),_0x65ca('0xa7')]);if(_0x3c4d6c['body']['id']){delete _0x3c4d6c[_0x65ca('0x60')]['id'];}if(_[_0x65ca('0x81')](_0x3c4d6c['body'][_0x65ca('0x91')])){throw _0x109db6[_0x65ca('0x1e')](0x1f4)[_0x65ca('0xc5')](new db['Sequelize'][(_0x65ca('0x8d'))](_0x65ca('0x92')));}if(_[_0x65ca('0x81')](_0x3c4d6c['body'][_0x65ca('0x60')])||_0x3c4d6c[_0x65ca('0x60')][_0x65ca('0x60')]===''){throw _0x109db6[_0x65ca('0x1e')](0x1f4)[_0x65ca('0xc5')](new db[(_0x65ca('0x93'))][(_0x65ca('0x8d'))](_0x65ca('0xc6')));}if(_[_0x65ca('0x81')](_0x3c4d6c[_0x65ca('0x60')]['mapKeyOffline'])){throw _0x109db6[_0x65ca('0x1e')](0x1f4)[_0x65ca('0xc5')](new db[(_0x65ca('0x93'))][(_0x65ca('0x8d'))](_0x65ca('0xc7')+_0xd33a5f));}if(!_['includes'](_0xd33a5f,_0x3c4d6c[_0x65ca('0x60')][_0x65ca('0xc8')])){throw _0x109db6[_0x65ca('0x1e')](0x1f4)[_0x65ca('0xc5')](new db[(_0x65ca('0x93'))][(_0x65ca('0x8d'))](_0x65ca('0xc9')+_0xd33a5f));}_0x8e4505[_0x3c4d6c[_0x65ca('0x60')][_0x65ca('0xc8')]]=_0x3c4d6c[_0x65ca('0x60')][_0x65ca('0x91')];})[_0x65ca('0x14')](function(){return db[_0x65ca('0x56')][_0x65ca('0x5e')]({'where':{'id':_0x3c4d6c[_0x65ca('0x5a')]['id']},'include':[{'model':db[_0x65ca('0x97')],'as':_0x65ca('0x98')},{'model':db[_0x65ca('0xca')],'as':_0x65ca('0xca')}]});})['then'](handleEntityNotFound(_0x109db6,null))['then'](function(_0x37accc){if(_0x37accc&&_0x37accc[_0x65ca('0x98')]){_0x495df0=_0x37accc;var _0xf1a60a=_[_0x65ca('0xa6')](_0x3c4d6c[_0x65ca('0x60')],{'firstName':_0x3c4d6c[_0x65ca('0x60')]['from'],'phone':_0x3c4d6c[_0x65ca('0x60')][_0x65ca('0x91')],'ListId':_0x37accc[_0x65ca('0xa7')]});_0xf1a60a[_0x3c4d6c[_0x65ca('0x60')][_0x65ca('0xc8')]]=_0x3c4d6c[_0x65ca('0x60')][_0x65ca('0x91')];return db[_0x65ca('0x99')]['findOrCreate']({'where':_0x8e4505,'defaults':_0xf1a60a});}})[_0x65ca('0x9f')](function(_0x438a21){if(_0x438a21){_0x575f1d=_0x438a21;var _0x24135e=fs[_0x65ca('0xcb')](path['join'](config[_0x65ca('0x7d')],_0x65ca('0xcc')),'utf8');var _0x178c63=ejs[_0x65ca('0xcd')](_0x24135e,{'body':_[_0x65ca('0xce')](_0x3c4d6c[_0x65ca('0x60')][_0x65ca('0x60')]),'bodyTitle':_0x495df0[_0x65ca('0xcf')]});return db[_0x65ca('0xd0')][_0x65ca('0x5f')]({'body':_0x178c63,'plainBody':htmlToText[_0x65ca('0xd1')](_0x178c63),'ContactId':_0x438a21['id'],'ChatWebsiteId':_0x495df0['id']});}})[_0x65ca('0x14')](function(_0x44cd94){_0x428263=_0x44cd94;if(_0x4a371f[_0x65ca('0x4d')]){var _0x5ea09b=_0x4a371f[_0x65ca('0x32')](function(_0x5b5e45){return{'name':_0x5b5e45[_0x65ca('0xd2')],'basename':_0x5b5e45[_0x65ca('0x75')],'type':_0x5b5e45[_0x65ca('0xd3')],'ChatOfflineMessageId':_0x44cd94['id']};});_0x4e9e53=_0x5ea09b[_0x65ca('0x32')](_0x15dae9=>{var _0x42689b={'filename':_0x15dae9[_0x65ca('0x2b')],'path':path[_0x65ca('0x7c')](config[_0x65ca('0x7d')],_0x65ca('0xd4'),_0x65ca('0xd5'),_0x65ca('0xd6'),_0x65ca('0xd7'),_0x15dae9[_0x65ca('0xd8')])};return _0x42689b;});if(!_0x495df0[_0x65ca('0xd9')]){return db[_0x65ca('0xda')][_0x65ca('0xdb')](function(_0x1aa96b){return db[_0x65ca('0xdc')][_0x65ca('0xdd')](_0x5ea09b,{'transaction':_0x1aa96b});});}}})['then'](function(){if(_0x428263){_0x58d483=_0x428263;return db[_0x65ca('0xca')][_0x65ca('0x6b')]({'where':{'service':!![]},'include':[{'model':db['MailServerOut'],'as':_0x65ca('0xde'),'raw':!![],'include':[{'model':db[_0x65ca('0xdf')],'as':'CloudProvider','raw':!![]}]}]});}})[_0x65ca('0x14')](function(_0x3a1938){if(_0x3a1938&&_0x3a1938[_0x65ca('0xde')]&&_0x495df0[_0x65ca('0xe0')]&&_0x495df0[_0x65ca('0xe1')]){var _0x45b23a=_0x3a1938['getSmtpOptions']();return respondWithRpcPromise(_0x65ca('0xe2'),'sendMail',{'account':_0x45b23a,'message':{'from':util[_0x65ca('0x3f')]('\x22%s\x22\x20<%s>',_0x3a1938[_0x65ca('0x2b')],_0x3a1938[_0x65ca('0xe3')]||_0x3a1938[_0x65ca('0xde')][_0x65ca('0x61')]),'to':_0x495df0[_0x65ca('0xe1')],'subject':_0x495df0['offlineMessageSubject'],'html':_0x58d483[_0x65ca('0x60')],'attachments':_0x4e9e53}},client9003)[_0x65ca('0x14')](function(){return _0x58d483;})[_0x65ca('0x1d')](function(_0x34f660){logger['error'](_0x34f660);});}})[_0x65ca('0x14')](function(){if(_0x495df0&&_0x495df0[_0x65ca('0xd9')]&&_0x495df0[_0x65ca('0xe4')]){var _0x52ccec=[];if(_0x4a371f[_0x65ca('0x4d')]){_0x52ccec=_0x4a371f[_0x65ca('0x32')](function(_0xf51ca6){return{'name':_0xf51ca6[_0x65ca('0xd2')],'basename':_0xf51ca6['filename'],'type':_0xf51ca6[_0x65ca('0xd3')],'ChatOfflineMessageId':_0x428263['id']};});}var _0x5a557f;if(!_[_0x65ca('0x81')](_0x495df0['subjectOffline'])){var _0x31abbf=_['map'](_0x3c4d6c[_0x65ca('0x60')],function(_0xf24f07){return _0xf24f07;});var _0x2857b8=_['toPairsIn'](_0x31abbf)[0x0];var _0x2190a5=_['mapValues'](_0x2857b8,function(_0x338901){return _0x338901;});_0x5a557f=_0x2190a5[0x1][_0x495df0[_0x65ca('0xe5')]];}var _0x1c3688={'from':_0x575f1d[_0x65ca('0xe3')],'firstName':_0x575f1d[_0x65ca('0xaf')],'lastName':_0x575f1d['lastName'],'mapKey':_0x65ca('0xe3'),'message':{'from':_0x575f1d['email'],'to':_0x495df0[_0x65ca('0xca')]['email'],'cc':'','subject':_[_0x65ca('0x81')](_0x5a557f)?_0x495df0[_0x65ca('0xe6')]:_0x5a557f,'messageId':'','sentAt':new Date(),'attach':_0x52ccec[_0x65ca('0x4d')],'attachments':_0x52ccec,'originChannel':'Chat','ChatWebsiteId':_0x495df0['id'],'ChatOfflineMessageId':_0x58d483['id'],'originTo':_0x495df0[_0x65ca('0xca')][_0x65ca('0xe3')]},'body':_0x58d483[_0x65ca('0x60')]};var _0x3a200d={'account':{'id':_0x495df0['MailAccountId']},'body':_0x1c3688,'log':_0x65ca('0xe7')};return respondWithRpcPromise(_0x65ca('0xe7'),_0x65ca('0xe8'),_0x3a200d,client9001)['then'](function(){return _0x58d483;})[_0x65ca('0x1d')](function(_0x905625){logger[_0x65ca('0x19')](_0x905625);});}return;})[_0x65ca('0x14')](function(){if(_0x58d483){return _0x58d483;}})['then'](respondWithResult(_0x109db6,null))[_0x65ca('0x1d')](function(){for(var _0x31ba50 of _0x4a371f){var _0x4a0957=path[_0x65ca('0x7c')](config[_0x65ca('0x7d')],'server',_0x65ca('0xd5'),_0x65ca('0xd6'),_0x65ca('0xd7'),_0x31ba50[_0x65ca('0x75')]);fs_extra[_0x65ca('0xe9')](_0x4a0957)[_0x65ca('0x1d')](function(_0x10e2f4){logger[_0x65ca('0x19')](_0x65ca('0xea'),_0x4a0957,_0x10e2f4);});}});};exports['addInteraction']=function(_0x104eff,_0x1d97c7){return db[_0x65ca('0xaa')]['find']({'where':{'id':_0x104eff['params']['id']}})[_0x65ca('0x14')](handleEntityNotFound(_0x1d97c7,null))['then'](function(_0x2f3158){if(_0x2f3158){return _0x2f3158[_0x65ca('0xeb')](_0x104eff['body'][_0x65ca('0x6e')],_[_0x65ca('0xec')](_0x104eff[_0x65ca('0x60')],[_0x65ca('0x6e'),'id'])||{});}})[_0x65ca('0x14')](respondWithResult(_0x1d97c7,null))['catch'](handleError(_0x1d97c7,null));};exports[_0x65ca('0xed')]=function(_0x545935,_0x4952f9){var _0x4ac9e1={'raw':![],'where':{}};var _0x110640={};var _0x23fcfe={'count':0x0,'rows':[]};return db[_0x65ca('0x56')]['findOne']({'where':{'id':_0x545935[_0x65ca('0x5a')]['id']}})[_0x65ca('0x14')](handleEntityNotFound(_0x4952f9,null))[_0x65ca('0x14')](function(_0x3778cb){if(_0x3778cb){_0x110640[_0x65ca('0x42')]=_[_0x65ca('0x5c')](db[_0x65ca('0xaa')][_0x65ca('0x46')]);_0x110640[_0x65ca('0x48')]=_[_0x65ca('0x5c')](_0x545935['query']);_0x110640[_0x65ca('0x49')]=_[_0x65ca('0x4a')](_0x110640[_0x65ca('0x42')],_0x110640['query']);_0x4ac9e1[_0x65ca('0x4c')]=_[_0x65ca('0x4a')](_0x110640[_0x65ca('0x42')],qs['fields'](_0x545935['query'][_0x65ca('0x4b')]));_0x4ac9e1['attributes']=_0x4ac9e1['attributes']['length']?_0x4ac9e1[_0x65ca('0x4c')]:_0x110640[_0x65ca('0x42')];if(!_0x545935[_0x65ca('0x48')][_0x65ca('0x6c')]('nolimit')){_0x4ac9e1[_0x65ca('0x22')]=qs['limit'](_0x545935[_0x65ca('0x48')][_0x65ca('0x22')]);_0x4ac9e1[_0x65ca('0x21')]=qs[_0x65ca('0x21')](_0x545935[_0x65ca('0x48')][_0x65ca('0x21')]);}_0x4ac9e1[_0x65ca('0x72')]=qs[_0x65ca('0x4f')](_0x545935[_0x65ca('0x48')][_0x65ca('0x4f')]);_0x4ac9e1[_0x65ca('0x52')]=qs[_0x65ca('0x49')](_[_0x65ca('0x50')](_0x545935[_0x65ca('0x48')],_0x110640[_0x65ca('0x49')]));_0x4ac9e1['where'][_0x65ca('0x69')]=_0x3778cb['id'];if(_0x545935['query']['filter']){_0x4ac9e1[_0x65ca('0x52')]=_[_0x65ca('0x53')](_0x4ac9e1['where'],{'$or':_['map'](_0x4ac9e1[_0x65ca('0x4c')],function(_0x120cb3){var _0x4f7c6d={};_0x4f7c6d[_0x120cb3]={'$like':'%'+_0x545935[_0x65ca('0x48')][_0x65ca('0x51')]+'%'};return _0x4f7c6d;})});}_0x4ac9e1=_[_0x65ca('0x53')]({},_0x4ac9e1,_0x545935[_0x65ca('0x55')]);return db['ChatInteraction']['count']({'where':_0x4ac9e1['where']})[_0x65ca('0x14')](function(_0x5d5556){_0x23fcfe[_0x65ca('0x23')]=_0x5d5556;if(_0x545935[_0x65ca('0x48')][_0x65ca('0x5d')]){_0x4ac9e1['include']=[{'model':db[_0x65ca('0x99')],'as':'Contact','required':![]},{'model':db['User'],'as':_0x65ca('0xee'),'attributes':[_0x65ca('0x2b'),_0x65ca('0xef'),_0x65ca('0xf0')],'required':![]},{'model':db['Tag'],'as':_0x65ca('0xf1'),'attributes':['id',_0x65ca('0x2b'),'color'],'where':_0x545935[_0x65ca('0x48')][_0x65ca('0xf2')]?{'id':_0x545935[_0x65ca('0x48')][_0x65ca('0xf2')]}:undefined,'required':_0x545935[_0x65ca('0x48')][_0x65ca('0xf2')]?!![]:![]}];}return db['ChatInteraction'][_0x65ca('0x58')](_0x4ac9e1);})[_0x65ca('0x14')](function(_0x442f08){_0x23fcfe[_0x65ca('0x59')]=_0x442f08;return _0x23fcfe;});}})['then'](respondWithFilteredResult(_0x4952f9,_0x4ac9e1))[_0x65ca('0x1d')](handleError(_0x4952f9,null));};exports['getSnippet']=function(_0x3077e0,_0x5dfbf4){var _0x90752e=0x0;var _0xb5afcd=0x0;var _0x5a16b3=![];var _0x54cd6f;var _0x2215b4;return db['ChatWebsite'][_0x65ca('0x5e')]({'where':{'id':_0x3077e0[_0x65ca('0x5a')]['id']},'include':[{'model':db[_0x65ca('0x9d')],'as':_0x65ca('0x9d'),'include':[{'model':db[_0x65ca('0x9d')],'as':_0x65ca('0x33'),'attributes':['id',_0x65ca('0x2d')]}]}]})[_0x65ca('0x14')](handleEntityNotFound(_0x5dfbf4,null))[_0x65ca('0x14')](function(_0x5469b0){if(_0x5469b0){_0x54cd6f=_0x5469b0;return _0x5469b0[_0x65ca('0xf3')]({'raw':!![]});}})[_0x65ca('0x14')](function(_0x28df01){if(_0x54cd6f){if(_0x28df01){_0x2215b4=_0x28df01;}}return require('../../config/license/util')[_0x65ca('0xf4')]();})[_0x65ca('0x14')](function(_0x183979){if(_0x183979){_0xb5afcd=_0x183979[_0x65ca('0xf5')];_0x5a16b3=_0x183979['custom'];}})['then'](function(){return db[_0x65ca('0xaa')]['count']({'where':{'closed':![]}});})[_0x65ca('0x14')](function(_0x1543bf){_0x90752e=_0x1543bf;if(_0xb5afcd&&_0x1543bf>_0xb5afcd){return db['License'][_0x65ca('0x6b')]({'where':{'id':0x1}})[_0x65ca('0x14')](function(_0x4373a9){if(_0x4373a9){_0x4373a9[_0x65ca('0xf6')]('chatLicenseExceeded');}});}})['then'](function(){if(!_0x54cd6f[_0x65ca('0x9d')]||!_0x54cd6f['Interval'][_0x65ca('0x33')])return!![];return checkWebsiteIntervals(_0x54cd6f);})['then'](function(_0xc7c019){var _0x4eed0f=fs['readFileSync'](path[_0x65ca('0x7c')](config[_0x65ca('0x7d')],'server/files/chat/iframe.ejs'),_0x65ca('0xf7'));var _0x4004bd=new url[(_0x65ca('0xf8'))](_0x54cd6f['address'])['origin'];var _0x4d4f48=_0x65ca('0xf9');var _0x49be28=![];var _0xfe3576={'chatVersion':_0x4d4f48,'chatWebsiteAddressOrigin':_0x4004bd,'remote':_0x54cd6f[_0x65ca('0xfa')],'query':querystring[_0x65ca('0x18')](_[_0x65ca('0x53')](_0x54cd6f[_0x65ca('0x27')]({'plain':!![]}),{'customerIp':_0x3077e0['headers'][_0x65ca('0x3a')]||_0x3077e0[_0x65ca('0xa8')][_0x65ca('0xfb')]||_0x3077e0['connection'][_0x65ca('0xfc')]||_0x3077e0['ip'],'referer':_0x3077e0[_0x65ca('0xa8')][_0x65ca('0xfd')],'openedInteractions':_0x90752e,'maxInteractions':_0xb5afcd,'virtual':_0x5a16b3[_0x65ca('0xf5')],'online':_0xc7c019,'custom':_0x5a16b3}))[_0x65ca('0xfe')](/'/g,'\x5c\x27')};_0x5dfbf4[_0x65ca('0xc5')](ejs[_0x65ca('0xcd')](Mustache[_0x65ca('0xcd')](_0x4eed0f,_0xfe3576),{'proactiveActions':_0x2215b4,'alignment':_0x54cd6f[_0x65ca('0xff')],'verticalAlignment':_0x54cd6f['verticalAlignment'],'div_color':_0x54cd6f['color'],'labelText':_0x54cd6f[_0x65ca('0x100')],'text_color':_0x54cd6f[_0x65ca('0x101')],'text_button_color':_0x54cd6f[_0x65ca('0x102')],'button_color':_0x54cd6f['color_button'],'background_color':_0x54cd6f['backgroundColor'],'hideWhenOffline':_0x54cd6f[_0x65ca('0x103')],'intervalId':_0x54cd6f[_0x65ca('0x104')],'isDevelopment':_0x49be28,'chatVersion':_0x4d4f48}));})[_0x65ca('0x1d')](handleError(_0x5dfbf4,null));};exports['addApplications']=function(_0x1d7d66,_0x258ea6){var _0x30954d=_0x1d7d66[_0x65ca('0x5a')]['id'];var _0x317ef8=_0x1d7d66[_0x65ca('0x60')];var _0x550ebc=0xc8;var _0x13a2b2=null;return db[_0x65ca('0xda')][_0x65ca('0xdb')]({'isolationLevel':db[_0x65ca('0xda')][_0x65ca('0x105')][_0x65ca('0x106')][_0x65ca('0x107')]},function(_0x1409ca){return db[_0x65ca('0x56')]['findOne']({'where':{'id':_0x30954d},'transaction':_0x1409ca})['then'](function(_0x579a33){if(_0x579a33){return db[_0x65ca('0x9b')][_0x65ca('0x26')]({'where':{'ChatWebsiteId':_0x30954d},'transaction':_0x1409ca})[_0x65ca('0x14')](function(){var _0x48672d=_[_0x65ca('0x32')](_0x317ef8,function(_0x239487){_0x239487[_0x65ca('0x69')]=_0x30954d;return _0x239487;});return db['ChatApplication'][_0x65ca('0xdd')](_0x48672d,{'transaction':_0x1409ca});});}else{_0x550ebc=0x194;_0x13a2b2=[];}});})[_0x65ca('0x14')](function(){if(_0x550ebc!==0x194){return db[_0x65ca('0x9b')]['findAndCountAll']({'where':{'ChatWebsiteId':_0x30954d},'order':_0x65ca('0xa4')})[_0x65ca('0x14')](function(_0x3e1ada){_0x13a2b2=_0x3e1ada;});}})[_0x65ca('0x1d')](function(_0x2ef69f){_0x550ebc=0x1f4;logger[_0x65ca('0x19')](_0x2ef69f[_0x65ca('0x2a')]);if(_0x2ef69f[_0x65ca('0x2b')]){delete _0x2ef69f[_0x65ca('0x2b')];}_0x13a2b2=_0x2ef69f;})[_0x65ca('0x108')](function(){if(_0x13a2b2===null){_0x258ea6['sendStatus'](_0x550ebc);}else{if(_0x550ebc===0x1f4){_0x258ea6[_0x65ca('0x1e')](_0x550ebc)[_0x65ca('0xc5')](_0x13a2b2);}else{_0x258ea6[_0x65ca('0x1e')](_0x550ebc)['json'](_0x13a2b2);}}});};exports[_0x65ca('0x109')]=function(_0x3ff6dc,_0x4c5093){var _0x2066fe={};var _0x164317={};var _0x11b39b;var _0x455ef7;return db[_0x65ca('0x56')][_0x65ca('0x6b')]({'where':{'id':_0x3ff6dc[_0x65ca('0x5a')]['id']}})[_0x65ca('0x14')](handleEntityNotFound(_0x4c5093,null))['then'](function(_0x2b6297){if(_0x2b6297){_0x11b39b=_0x2b6297;_0x164317['model']=_[_0x65ca('0x5c')](db['ChatApplication'][_0x65ca('0x46')]);_0x164317[_0x65ca('0x48')]=_[_0x65ca('0x5c')](_0x3ff6dc[_0x65ca('0x48')]);_0x164317[_0x65ca('0x49')]=_['intersection'](_0x164317['model'],_0x164317['query']);_0x2066fe[_0x65ca('0x4c')]=_['intersection'](_0x164317[_0x65ca('0x42')],qs[_0x65ca('0x4b')](_0x3ff6dc['query'][_0x65ca('0x4b')]));_0x2066fe[_0x65ca('0x4c')]=_0x2066fe[_0x65ca('0x4c')][_0x65ca('0x4d')]?_0x2066fe['attributes']:_0x164317[_0x65ca('0x42')];_0x2066fe[_0x65ca('0x72')]=qs[_0x65ca('0x4f')](_0x3ff6dc[_0x65ca('0x48')]['sort']);_0x2066fe[_0x65ca('0x52')]=qs[_0x65ca('0x49')](_[_0x65ca('0x50')](_0x3ff6dc['query'],_0x164317[_0x65ca('0x49')]));if(_0x3ff6dc[_0x65ca('0x48')][_0x65ca('0x51')]){_0x2066fe['where']=_[_0x65ca('0x53')](_0x2066fe['where'],{'$or':_[_0x65ca('0x32')](_0x2066fe[_0x65ca('0x4c')],function(_0x339ce0){var _0x2539cf={};_0x2539cf[_0x339ce0]={'$like':'%'+_0x3ff6dc[_0x65ca('0x48')][_0x65ca('0x51')]+'%'};return _0x2539cf;})});}_0x2066fe=_[_0x65ca('0x53')]({},_0x2066fe,_0x3ff6dc[_0x65ca('0x55')]);return _0x11b39b['getApplications'](_0x2066fe);}})[_0x65ca('0x14')](function(_0x23a85d){if(_0x23a85d){_0x455ef7=_0x23a85d[_0x65ca('0x4d')];if(!_0x3ff6dc[_0x65ca('0x48')][_0x65ca('0x6c')]('nolimit')){_0x2066fe['limit']=qs[_0x65ca('0x22')](_0x3ff6dc[_0x65ca('0x48')][_0x65ca('0x22')]);_0x2066fe[_0x65ca('0x21')]=qs[_0x65ca('0x21')](_0x3ff6dc['query'][_0x65ca('0x21')]);}return _0x11b39b[_0x65ca('0x109')](_0x2066fe);}})[_0x65ca('0x14')](function(_0x121959){if(_0x121959){return _0x121959?{'count':_0x455ef7,'rows':_0x121959}:null;}})['then'](respondWithResult(_0x4c5093,null))[_0x65ca('0x1d')](handleError(_0x4c5093,null));};exports[_0x65ca('0x10a')]=function(_0x1b34a5,_0x29a56a){return db['chatProactiveAction'][_0x65ca('0x5e')]({'where':{'id':_0x1b34a5['params']['id']}})[_0x65ca('0x14')](handleEntityNotFound(_0x29a56a,null))[_0x65ca('0x14')](function(_0x58f852){if(_0x58f852){return _0x58f852[_0x65ca('0x10a')](_0x1b34a5[_0x65ca('0x60')][_0x65ca('0x6e')],_['omit'](_0x1b34a5['body'],[_0x65ca('0x6e'),'id'])||{});}})[_0x65ca('0x14')](respondWithResult(_0x29a56a,null))['catch'](handleError(_0x29a56a,null));};exports[_0x65ca('0xf3')]=function(_0x4cbf4a,_0x196769){var _0x397c14={};var _0x578c54={};var _0x3c08d3;var _0xcf9335;return db[_0x65ca('0x56')][_0x65ca('0x6b')]({'where':{'id':_0x4cbf4a[_0x65ca('0x5a')]['id']}})[_0x65ca('0x14')](handleEntityNotFound(_0x196769,null))[_0x65ca('0x14')](function(_0x3833fc){if(_0x3833fc){_0x3c08d3=_0x3833fc;_0x578c54[_0x65ca('0x42')]=_[_0x65ca('0x5c')](db[_0x65ca('0x10b')][_0x65ca('0x46')]);_0x578c54[_0x65ca('0x48')]=_[_0x65ca('0x5c')](_0x4cbf4a[_0x65ca('0x48')]);_0x578c54[_0x65ca('0x49')]=_[_0x65ca('0x4a')](_0x578c54[_0x65ca('0x42')],_0x578c54[_0x65ca('0x48')]);_0x397c14[_0x65ca('0x4c')]=_['intersection'](_0x578c54['model'],qs[_0x65ca('0x4b')](_0x4cbf4a['query'][_0x65ca('0x4b')]));_0x397c14[_0x65ca('0x4c')]=_0x397c14['attributes'][_0x65ca('0x4d')]?_0x397c14[_0x65ca('0x4c')]:_0x578c54[_0x65ca('0x42')];_0x397c14[_0x65ca('0x72')]=qs['sort'](_0x4cbf4a[_0x65ca('0x48')][_0x65ca('0x4f')]);_0x397c14[_0x65ca('0x52')]=qs[_0x65ca('0x49')](_[_0x65ca('0x50')](_0x4cbf4a[_0x65ca('0x48')],_0x578c54[_0x65ca('0x49')]));if(_0x4cbf4a[_0x65ca('0x48')]['filter']){_0x397c14[_0x65ca('0x52')]=_[_0x65ca('0x53')](_0x397c14[_0x65ca('0x52')],{'$or':_['map'](_0x397c14['attributes'],function(_0x19bf8a){var _0x121224={};_0x121224[_0x19bf8a]={'$like':'%'+_0x4cbf4a['query'][_0x65ca('0x51')]+'%'};return _0x121224;})});}_0x397c14=_[_0x65ca('0x53')]({},_0x397c14,_0x4cbf4a[_0x65ca('0x55')]);return _0x3c08d3[_0x65ca('0xf3')](_0x397c14);}})[_0x65ca('0x14')](function(_0x2bc40a){if(_0x2bc40a){_0xcf9335=_0x2bc40a[_0x65ca('0x4d')];if(!_0x4cbf4a[_0x65ca('0x48')][_0x65ca('0x6c')](_0x65ca('0x4e'))){_0x397c14[_0x65ca('0x22')]=qs[_0x65ca('0x22')](_0x4cbf4a[_0x65ca('0x48')][_0x65ca('0x22')]);_0x397c14['offset']=qs[_0x65ca('0x21')](_0x4cbf4a['query'][_0x65ca('0x21')]);}return _0x3c08d3['getProactiveActions'](_0x397c14);}})[_0x65ca('0x14')](function(_0x3013c6){if(_0x3013c6){return _0x3013c6?{'count':_0xcf9335,'rows':_0x3013c6}:null;}})[_0x65ca('0x14')](respondWithResult(_0x196769,null))[_0x65ca('0x1d')](handleError(_0x196769,null));};exports['getFields']=function(_0x225412,_0x3199b3){var _0x23a14f=_0x225412[_0x65ca('0x48')]['online']===_0x65ca('0x10c')?_0x65ca('0x10d'):'onlineForm';return db[_0x65ca('0x56')][_0x65ca('0x5e')]({'attributes':['id',_0x23a14f],'where':{'id':_0x225412[_0x65ca('0x5a')]['id']}})[_0x65ca('0x14')](handleEntityNotFound(_0x3199b3,null))[_0x65ca('0x14')](function(_0x1589c9){if(_0x1589c9){var _0x4b6c1f=_0x1589c9[_0x23a14f];var _0x29f953=_0x4b6c1f&&_0x4b6c1f['items']?_0x4b6c1f[_0x65ca('0x10e')]:[];_0x3199b3[_0x65ca('0xc5')]({'fromKey':_['isNil'](_0x4b6c1f[_0x65ca('0x10f')])?undefined:_0x4b6c1f['fromKey'],'count':_0x29f953['length'],'rows':_0x29f953});}})[_0x65ca('0x1d')](handleError(_0x3199b3,null));};exports[_0x65ca('0x110')]=function(_0x2bd1b4,_0x10468b){var _0x14c8e4={'raw':![],'where':{}};var _0x5887a0={};var _0x314dd3={'count':0x0,'rows':[]};return db[_0x65ca('0x56')][_0x65ca('0x6b')]({'where':{'id':_0x2bd1b4[_0x65ca('0x5a')]['id']}})[_0x65ca('0x14')](handleEntityNotFound(_0x10468b,null))[_0x65ca('0x14')](function(_0x33da7b){if(_0x33da7b){_0x5887a0[_0x65ca('0x42')]=_[_0x65ca('0x5c')](db['ChatOfflineMessage'][_0x65ca('0x46')]);_0x5887a0[_0x65ca('0x48')]=_[_0x65ca('0x5c')](_0x2bd1b4[_0x65ca('0x48')]);_0x5887a0['filters']=_[_0x65ca('0x4a')](_0x5887a0[_0x65ca('0x42')],_0x5887a0[_0x65ca('0x48')]);_0x14c8e4[_0x65ca('0x4c')]=_[_0x65ca('0x4a')](_0x5887a0[_0x65ca('0x42')],qs['fields'](_0x2bd1b4['query'][_0x65ca('0x4b')]));_0x14c8e4['attributes']=_0x14c8e4[_0x65ca('0x4c')]['length']?_0x14c8e4[_0x65ca('0x4c')]:_0x5887a0[_0x65ca('0x42')];if(!_0x2bd1b4[_0x65ca('0x48')][_0x65ca('0x6c')]('nolimit')){_0x14c8e4['limit']=qs[_0x65ca('0x22')](_0x2bd1b4['query'][_0x65ca('0x22')]);_0x14c8e4[_0x65ca('0x21')]=qs[_0x65ca('0x21')](_0x2bd1b4[_0x65ca('0x48')][_0x65ca('0x21')]);}_0x14c8e4[_0x65ca('0x72')]=qs[_0x65ca('0x4f')](_0x2bd1b4[_0x65ca('0x48')][_0x65ca('0x4f')]);_0x14c8e4[_0x65ca('0x52')]=qs[_0x65ca('0x49')](_[_0x65ca('0x50')](_0x2bd1b4[_0x65ca('0x48')],_0x5887a0[_0x65ca('0x49')]));_0x14c8e4[_0x65ca('0x52')][_0x65ca('0x69')]=_0x33da7b['id'];if(_0x2bd1b4[_0x65ca('0x48')][_0x65ca('0x51')]){_0x14c8e4['where']=_[_0x65ca('0x53')](_0x14c8e4[_0x65ca('0x52')],{'$or':_['map'](_0x14c8e4[_0x65ca('0x4c')],function(_0x506328){var _0x301d5d={};_0x301d5d[_0x506328]={'$like':'%'+_0x2bd1b4['query']['filter']+'%'};return _0x301d5d;})});}_0x14c8e4=_[_0x65ca('0x53')]({},_0x14c8e4,_0x2bd1b4[_0x65ca('0x55')]);return db['ChatOfflineMessage'][_0x65ca('0x23')]({'where':_0x14c8e4[_0x65ca('0x52')]})[_0x65ca('0x14')](function(_0x5755db){_0x314dd3[_0x65ca('0x23')]=_0x5755db;if(_0x2bd1b4[_0x65ca('0x48')][_0x65ca('0x5d')]){_0x14c8e4[_0x65ca('0x57')]=[{'all':!![]}];}else{_0x14c8e4[_0x65ca('0x57')]=[{'model':db[_0x65ca('0x99')],'as':_0x65ca('0x111'),'required':![]},{'model':db[_0x65ca('0xdc')],'as':_0x65ca('0x112'),'required':![]}];}return db[_0x65ca('0xd0')][_0x65ca('0x58')](_0x14c8e4);})['then'](function(_0x3a2047){_0x314dd3['rows']=_0x3a2047;return _0x314dd3;});}})['then'](respondWithFilteredResult(_0x10468b,_0x14c8e4))[_0x65ca('0x1d')](handleError(_0x10468b,null));};exports[_0x65ca('0x113')]=function(_0x4399db,_0x53bdc5){return db[_0x65ca('0x56')]['find']({'where':{'id':_0x4399db[_0x65ca('0x5a')]['id']}})[_0x65ca('0x14')](handleEntityNotFound(_0x53bdc5,null))[_0x65ca('0x14')](function(_0x209d58){if(_0x209d58){return _0x209d58[_0x65ca('0x113')](_0x4399db['body']['ids'],_[_0x65ca('0xec')](_0x4399db[_0x65ca('0x60')],['ids','id'])||{})['spread'](function(_0x157569){for(var _0x3a3954=0x0;_0x3a3954<_0x4399db[_0x65ca('0x60')]['ids'][_0x65ca('0x4d')];_0x3a3954+=0x1){socket[_0x65ca('0x114')](_0x65ca('0x115'),{'UserId':Number(_0x4399db[_0x65ca('0x60')][_0x65ca('0x6e')][_0x3a3954]),'ChatWebsiteId':Number(_0x4399db['params']['id'])});}return _0x157569;});}})[_0x65ca('0x14')](respondWithResult(_0x53bdc5,null))['catch'](handleError(_0x53bdc5,null));};exports[_0x65ca('0x116')]=function(_0x5ecd25,_0x143293){return db['ChatWebsite'][_0x65ca('0x5e')]({'where':{'id':_0x5ecd25[_0x65ca('0x5a')]['id']}})['then'](handleEntityNotFound(_0x143293,null))[_0x65ca('0x14')](function(_0x157fa3){if(_0x157fa3){return _0x157fa3[_0x65ca('0x116')](_0x5ecd25[_0x65ca('0x48')][_0x65ca('0x6e')])[_0x65ca('0x14')](function(){if(_['isArray'](_0x5ecd25['query'][_0x65ca('0x6e')])){for(var _0x1d2180=0x0;_0x1d2180<_0x5ecd25[_0x65ca('0x48')]['ids'][_0x65ca('0x4d')];_0x1d2180+=0x1){socket['emit'](_0x65ca('0x117'),{'UserId':Number(_0x5ecd25[_0x65ca('0x48')]['ids'][_0x1d2180]),'ChatWebsiteId':Number(_0x5ecd25[_0x65ca('0x5a')]['id'])});}}else{socket[_0x65ca('0x114')](_0x65ca('0x117'),{'UserId':Number(_0x5ecd25[_0x65ca('0x48')][_0x65ca('0x6e')]),'ChatWebsiteId':Number(_0x5ecd25[_0x65ca('0x5a')]['id'])});}});}})['then'](respondWithStatusCode(_0x143293,null))[_0x65ca('0x1d')](handleError(_0x143293,null));};exports['getAgents']=function(_0x183aa3,_0x505356){var _0x3bc0c2={};var _0x55772e={};var _0x176bd6;var _0x3a807b;return db[_0x65ca('0x56')]['findOne']({'where':{'id':_0x183aa3['params']['id']}})[_0x65ca('0x14')](handleEntityNotFound(_0x505356,null))['then'](function(_0x187eea){if(_0x187eea){_0x176bd6=_0x187eea;_0x55772e[_0x65ca('0x42')]=_[_0x65ca('0x5c')](db['User'][_0x65ca('0x46')]);_0x55772e[_0x65ca('0x48')]=_[_0x65ca('0x5c')](_0x183aa3[_0x65ca('0x48')]);_0x55772e[_0x65ca('0x49')]=_[_0x65ca('0x4a')](_0x55772e['model'],_0x55772e[_0x65ca('0x48')]);_0x3bc0c2[_0x65ca('0x4c')]=_[_0x65ca('0x4a')](_0x55772e[_0x65ca('0x42')],qs['fields'](_0x183aa3['query'][_0x65ca('0x4b')]));_0x3bc0c2[_0x65ca('0x4c')]=_0x3bc0c2[_0x65ca('0x4c')][_0x65ca('0x4d')]?_0x3bc0c2[_0x65ca('0x4c')]:_0x55772e[_0x65ca('0x42')];_0x3bc0c2[_0x65ca('0x72')]=qs[_0x65ca('0x4f')](_0x183aa3[_0x65ca('0x48')][_0x65ca('0x4f')]);_0x3bc0c2[_0x65ca('0x52')]=qs['filters'](_[_0x65ca('0x50')](_0x183aa3[_0x65ca('0x48')],_0x55772e[_0x65ca('0x49')]));if(_0x183aa3['query'][_0x65ca('0x51')]){_0x3bc0c2[_0x65ca('0x52')]=_[_0x65ca('0x53')](_0x3bc0c2[_0x65ca('0x52')],{'$or':_[_0x65ca('0x32')](_0x3bc0c2[_0x65ca('0x4c')],function(_0x66c77b){var _0x331be7={};_0x331be7[_0x66c77b]={'$like':'%'+_0x183aa3['query'][_0x65ca('0x51')]+'%'};return _0x331be7;})});}_0x3bc0c2=_[_0x65ca('0x53')]({},_0x3bc0c2,_0x183aa3[_0x65ca('0x55')]);return _0x176bd6[_0x65ca('0x118')](_0x3bc0c2);}})[_0x65ca('0x14')](function(_0x39f851){if(_0x39f851){_0x3a807b=_0x39f851[_0x65ca('0x4d')];if(!_0x183aa3[_0x65ca('0x48')][_0x65ca('0x6c')](_0x65ca('0x4e'))){_0x3bc0c2[_0x65ca('0x22')]=qs['limit'](_0x183aa3[_0x65ca('0x48')][_0x65ca('0x22')]);_0x3bc0c2[_0x65ca('0x21')]=qs['offset'](_0x183aa3['query']['offset']);}return _0x176bd6[_0x65ca('0x118')](_0x3bc0c2);}})['then'](function(_0xc0d25){if(_0xc0d25){return _0xc0d25?{'count':_0x3a807b,'rows':_0xc0d25}:null;}})[_0x65ca('0x14')](respondWithResult(_0x505356,null))[_0x65ca('0x1d')](handleError(_0x505356,null));}; \ No newline at end of file +var _0x5611=['Contacts','DESC','ChatApplication','Applications','Chat\x20Website\x20with\x20id\x20%s\x20not\x20found','spread','List','applications','orderBy','priority','asc','account','contact','headers','threadId','ChatInteraction','externalUrl','interaction','messageId','created','autoclose','push','unmanaged','*,*,*,*','ChatMessage','AttachmentId','User','UserId','unshift','agent','waitForTheAssignedAgent','forcedOwnership','queueId','queue','waitForTheAssignedQueue','Start','startRouting','EventManager','offline','files','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','findOrCreate','readFileSync','server/files/templates/chatOfflineMessage.ejs','render','toPairs','offlineMessageBody','ChatOfflineMessage','fromString','originalname','mimetype','server','attachments','offline-chat','openNewInteraction','sequelize','transaction','Attachment','bulkCreate','MailServerOut','CloudProvider','forwardOfflineAddress','getSmtpOptions','SendMail','email','Smtp','offlineMessageSubject','MailAccountId','subjectOffline','mapValues','Chat','NotifyMailAccount','Could\x20not\x20remove\x20attachment\x20file','addInteraction','fullname','Tag','Tags','color','tag','getSnippet','getProactiveActions','virtual','License','increment','chatLicenseExceeded','URL','address','remote','x-real-ip','connection','referer','alignment','verticalAlignment','labelText','textColor','textButtonColor','color_button','backgroundColor','hideWhenOffline','IntervalId','addApplications','Transaction','ISOLATION_LEVELS','READ_COMMITTED','findAndCountAll','finally','getApplications','addProactiveActions','ChatProactiveAction','getFields','offlineForm','items','fromKey','Contact','Attachments','addAgents','omit','userChatWebsite:save','removeAgents','emit','userChatWebsite:remove','getAgents','mustache','util','path','lodash','html-to-text','jayson/promise','url','../../config/logger','api','../../config/environment','../../errors/api','APIOutOfIntervalError','APINotFoundError','handleError','../../mysqldb','defaults','localhost','socket.io-emitter','./chatWebsite.socket','register','client','http','request','then','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','update','ChatWebsites','UserProfileResource','destroy','stack','name','send','Command','timezone','format','iftime\x20%s,%s','interval','iftime\x20%s','indexOf','true','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','ONLINE','OFFLINE','No\x20timezone','map','Interval','Intervals','get','all','user-agent-parser','setUA','user-agent','getResult','cf-connecting-ip','first','x-forwarded-for','split','firstName','lastName','browser','version','unknown','%s\x20%s','device','%s\x20%s\x20%s','model','vendor','type','index','mandatoryDispositionPause','rawAttributes','fieldName','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','pick','filter','where','merge','options','ChatWebsite','includeAll','findAll','params','Pause','include','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','addDisposition','getDispositions','findOne','sort','ChatWebsiteId','Disposition','rows','removeDispositions','addAnswer','CannedAnswer','getAnswers','nolimit','removeAnswers','ids','addLogo','sitepic','file','filename','addAvatar','agentAvatar','addCustomerAvatar','customerAvatar','addSystemAvatar','systemAvatar','getLogo','join','root','../../config/license/util','getLicense','custom','isNil','existsSync','server/files/images/logos/','download','getAvatar','showCustomerAvatar','server/files/images/avatars/','notify','CmContact','describe','Sequelize','no\x20available\x20attributes','updatedAt','difference','createdAt','CompanyId','ListId','from','ValidationError','from\x20is\x20mandatory','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList'];(function(_0x299ec9,_0x1992db){var _0x4402fe=function(_0x5c75c9){while(--_0x5c75c9){_0x299ec9['push'](_0x299ec9['shift']());}};_0x4402fe(++_0x1992db);}(_0x5611,0x7c));var _0x1561=function(_0xd34b6e,_0x4ba79c){_0xd34b6e=_0xd34b6e-0x0;var _0x51f242=_0x5611[_0xd34b6e];return _0x51f242;};'use strict';var Mustache=require(_0x1561('0x0'));var util=require(_0x1561('0x1'));var path=require(_0x1561('0x2'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1561('0x3'));var querystring=require('querystring');var htmlToText=require(_0x1561('0x4'));var Redis=require('ioredis');var jayson=require(_0x1561('0x5'));var url=require(_0x1561('0x6'));var qs=require('../../components/parsers/qs');var logger=require(_0x1561('0x7'))(_0x1561('0x8'));var config=require(_0x1561('0x9'));var APIOutOfIntervalError=require(_0x1561('0xa'))[_0x1561('0xb')];var APINotFoundError=require('../../errors/api')[_0x1561('0xc')];var APIHandleError=require(_0x1561('0xa'))[_0x1561('0xd')];var db=require(_0x1561('0xe'))['db'];config['redis']=_[_0x1561('0xf')](config['redis'],{'host':_0x1561('0x10'),'port':0x18eb});var socket=require(_0x1561('0x11'))(new Redis(config['redis']));require(_0x1561('0x12'))[_0x1561('0x13')](socket);var client=jayson[_0x1561('0x14')][_0x1561('0x15')]({'port':0x232c});var client9002=jayson[_0x1561('0x14')][_0x1561('0x15')]({'port':0x232a});var client9003=jayson[_0x1561('0x14')][_0x1561('0x15')]({'port':0x232b});var client9001=jayson[_0x1561('0x14')][_0x1561('0x15')]({'port':0x2329});function respondWithRpcPromise(_0x4798c9,_0x558fc0,_0x14c41b,_0x25f8cb){return new Promise(function(_0x3400e8,_0x19e3f3){var _0x157ebc=_0x25f8cb||client;return _0x157ebc[_0x1561('0x16')](_0x4798c9,_0x14c41b)[_0x1561('0x17')](function(_0x2d9fa8){logger['info'](_0x1561('0x18'),_0x558fc0,_0x1561('0x19'));logger[_0x1561('0x1a')](_0x1561('0x1b'),_0x558fc0,_0x1561('0x19'),JSON[_0x1561('0x1c')](_0x2d9fa8));if(_0x2d9fa8[_0x1561('0x1d')]){if(_0x2d9fa8['error'][_0x1561('0x1e')]===0x1f4){logger[_0x1561('0x1d')](_0x1561('0x18'),_0x558fc0,_0x2d9fa8[_0x1561('0x1d')]['message']);return _0x19e3f3(_0x2d9fa8[_0x1561('0x1d')][_0x1561('0x1f')]);}logger[_0x1561('0x1d')](_0x1561('0x18'),_0x558fc0,_0x2d9fa8['error'][_0x1561('0x1f')]);return _0x3400e8(_0x2d9fa8[_0x1561('0x1d')][_0x1561('0x1f')]);}else{logger[_0x1561('0x20')]('ChatWebsite,\x20%s,\x20%s',_0x558fc0,_0x1561('0x19'));_0x3400e8(_0x2d9fa8[_0x1561('0x21')]['message']);}})[_0x1561('0x22')](function(_0x209c8d){logger[_0x1561('0x1d')](_0x1561('0x18'),_0x558fc0,_0x209c8d);_0x19e3f3(_0x209c8d);});});}function respondWithStatusCode(_0x1324ff,_0x4a01a3){_0x4a01a3=_0x4a01a3||0xcc;return function(_0x1a4b32){if(_0x1a4b32){return _0x1324ff[_0x1561('0x23')](_0x4a01a3);}return _0x1324ff[_0x1561('0x24')](_0x4a01a3)[_0x1561('0x25')]();};}function respondWithResult(_0x4d8e5e,_0x118931){_0x118931=_0x118931||0xc8;return function(_0x276905){if(_0x276905){return _0x4d8e5e['status'](_0x118931)[_0x1561('0x26')](_0x276905);}};}function respondWithFilteredResult(_0x7a0c2f,_0x336189){return function(_0x26337c){if(_0x26337c){var _0x118d05=typeof _0x336189[_0x1561('0x27')]===_0x1561('0x28')&&typeof _0x336189[_0x1561('0x29')]===_0x1561('0x28');var _0x20e8fd=_0x26337c[_0x1561('0x2a')];var _0x5d6ab2=_0x118d05?0x0:_0x336189[_0x1561('0x27')];var _0x780404=_0x118d05?_0x26337c[_0x1561('0x2a')]:_0x336189[_0x1561('0x27')]+_0x336189['limit'];var _0x50adf5;if(_0x780404>=_0x20e8fd){_0x780404=_0x20e8fd;_0x50adf5=0xc8;}else{_0x50adf5=0xce;}_0x7a0c2f[_0x1561('0x24')](_0x50adf5);return _0x7a0c2f['set'](_0x1561('0x2b'),_0x5d6ab2+'-'+_0x780404+'/'+_0x20e8fd)[_0x1561('0x26')](_0x26337c);}return null;};}function saveUpdates(_0x4272b7){return function(_0x51cb3f){if(_0x51cb3f){return _0x51cb3f[_0x1561('0x2c')](_0x4272b7)['then'](function(_0x10efe8){return _0x10efe8;});}return null;};}function removeEntity(_0x2fdb32){return function(_0x4b005b){if(_0x4b005b){return _0x4b005b['destroy']()['then'](function(){var _0x5ec5c9=_0x4b005b['get']({'plain':!![]});var _0x3e602a=_0x1561('0x2d');return db[_0x1561('0x2e')][_0x1561('0x2f')]({'where':{'type':_0x3e602a,'resourceId':_0x5ec5c9['id']}})['then'](function(){return _0x4b005b;});})[_0x1561('0x17')](function(){_0x2fdb32[_0x1561('0x24')](0xcc)[_0x1561('0x25')]();});}};}function handleEntityNotFound(_0x4b4bca){return function(_0x2ddcd3){if(!_0x2ddcd3){_0x4b4bca['sendStatus'](0x194);}return _0x2ddcd3;};}function handleError(_0x489383,_0x4847f4){_0x4847f4=_0x4847f4||0x1f4;return function(_0x3f35bd){logger['error'](_0x3f35bd[_0x1561('0x30')]);if(_0x3f35bd[_0x1561('0x31')]){delete _0x3f35bd[_0x1561('0x31')];}_0x489383['status'](_0x4847f4)[_0x1561('0x32')](_0x3f35bd);};}function iftimePromise(_0x1df4db,_0x422a42){return respondWithRpcPromise(_0x1561('0x33'),'getSnippet',{'command':_0x422a42[_0x1561('0x34')]?util[_0x1561('0x35')](_0x1561('0x36'),_0x1df4db[_0x1561('0x37')],_0x422a42['timezone']):util[_0x1561('0x35')](_0x1561('0x38'),_0x1df4db[_0x1561('0x37')])},client9002)['then'](function(_0x2232ad){var _0x2244d7=_0x2232ad&&_0x2232ad[_0x1561('0x39')](_0x1561('0x3a'))>=0x0?!![]:![];logger[_0x1561('0x20')](_0x1561('0x3b'),_0x422a42['id'],_0x1df4db['id'],_0x1df4db[_0x1561('0x37')],_0x2244d7?_0x1561('0x3c'):_0x1561('0x3d'),_0x422a42[_0x1561('0x34')]?_0x422a42[_0x1561('0x34')]:'No\x20timezone');return _0x2244d7;})['catch'](function(_0x5e6248){logger[_0x1561('0x1d')]('[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)',_0x422a42['id'],_0x1df4db['id'],_0x1df4db['interval'],util['inspect'](_0x5e6248,{'showHidden':![],'depth':null}),_0x422a42[_0x1561('0x34')]?_0x422a42['timezone']:_0x1561('0x3e'));return![];});}function checkWebsiteIntervals(_0x332551){var _0x6bd523=_[_0x1561('0x3f')](_0x332551[_0x1561('0x40')][_0x1561('0x41')],function(_0x4e26ae){var _0x4ff0c3=_0x4e26ae[_0x1561('0x42')]({'plain':!![]});return iftimePromise(_0x4ff0c3,_0x332551);});return Promise[_0x1561('0x43')](_0x6bd523)[_0x1561('0x17')](function(_0x54685f){return _['some'](_0x54685f);});}function createInteractionObject(_0x1f2055,_0xc564b,_0x28d772,_0x1ea721){var _0x280f5b=require(_0x1561('0x44'));var _0x14e7d1=new _0x280f5b();var _0x371dab=_0x14e7d1[_0x1561('0x45')](_0x28d772[_0x1561('0x46')])[_0x1561('0x47')]();var _0x3b93b5=_0xc564b['customerIp'];if(_0x28d772['cf-connecting-ip']){_0x3b93b5=_0x28d772[_0x1561('0x48')];}else if(_0x28d772['x-forwarded-for']){_0x3b93b5=_[_0x1561('0x49')](_0x28d772[_0x1561('0x4a')][_0x1561('0x4b')](','));}return{'ContactId':_0x1ea721['id'],'ChatWebsiteId':_0x1f2055,'from':(_0x1ea721[_0x1561('0x4c')]||'')+'\x20'+(_0x1ea721[_0x1561('0x4d')]||''),'customerIp':_0x3b93b5,'customerPort':_0x28d772['x-real-port']?_0x28d772['x-real-port']:null,'referer':_0xc564b['referer'],'browserName':_0x371dab[_0x1561('0x4e')][_0x1561('0x31')]&&_0x371dab[_0x1561('0x4e')][_0x1561('0x4f')]?util[_0x1561('0x35')]('%s\x20%s',_0x371dab[_0x1561('0x4e')][_0x1561('0x31')],_0x371dab[_0x1561('0x4e')][_0x1561('0x4f')]):_0x1561('0x50'),'browserVersion':_0x371dab['browser'][_0x1561('0x4f')]||_0x1561('0x50'),'osName':util[_0x1561('0x35')](_0x1561('0x51'),_0x371dab['os']['name'],_0x371dab['os'][_0x1561('0x4f')]),'osVersion':_0x371dab['os']['version'],'deviceModel':_0x371dab[_0x1561('0x52')]['model']&&_0x371dab[_0x1561('0x52')]['vendor']?util['format'](_0x1561('0x53'),_0x371dab[_0x1561('0x52')][_0x1561('0x54')],_0x371dab['device'][_0x1561('0x55')],_0x371dab[_0x1561('0x52')][_0x1561('0x56')]):null,'deviceVendor':_0x371dab[_0x1561('0x52')][_0x1561('0x55')],'deviceType':_0x371dab[_0x1561('0x52')][_0x1561('0x56')],'formData':JSON[_0x1561('0x1c')](_0xc564b)};}exports[_0x1561('0x57')]=function(_0x2f6eec,_0x1da955){var _0x163d3d={'include':[{'model':db['Pause'],'as':_0x1561('0x58')}]},_0x38e8f6={},_0xb4d577={'count':0x0,'rows':[]};var _0x56f74e=_[_0x1561('0x3f')](db['ChatWebsite'][_0x1561('0x59')],function(_0x3fbb38){return{'name':_0x3fbb38[_0x1561('0x5a')],'type':_0x3fbb38['type']['key']};});_0x38e8f6['model']=_[_0x1561('0x3f')](_0x56f74e,_0x1561('0x31'));_0x38e8f6[_0x1561('0x5b')]=_[_0x1561('0x5c')](_0x2f6eec[_0x1561('0x5b')]);_0x38e8f6[_0x1561('0x5d')]=_[_0x1561('0x5e')](_0x38e8f6[_0x1561('0x54')],_0x38e8f6[_0x1561('0x5b')]);_0x163d3d['attributes']=_[_0x1561('0x5e')](_0x38e8f6[_0x1561('0x54')],qs[_0x1561('0x5f')](_0x2f6eec[_0x1561('0x5b')][_0x1561('0x5f')]));_0x163d3d[_0x1561('0x60')]=_0x163d3d[_0x1561('0x60')][_0x1561('0x61')]?_0x163d3d[_0x1561('0x60')]:_0x38e8f6['model'];if(!_0x2f6eec['query'][_0x1561('0x62')]('nolimit')){_0x163d3d['limit']=qs[_0x1561('0x29')](_0x2f6eec[_0x1561('0x5b')][_0x1561('0x29')]);_0x163d3d[_0x1561('0x27')]=qs[_0x1561('0x27')](_0x2f6eec['query'][_0x1561('0x27')]);}_0x163d3d[_0x1561('0x63')]=qs['sort'](_0x2f6eec['query']['sort']);_0x163d3d['where']=qs['filters'](_[_0x1561('0x64')](_0x2f6eec[_0x1561('0x5b')],_0x38e8f6['filters']),_0x56f74e);if(_0x2f6eec[_0x1561('0x5b')][_0x1561('0x65')]){_0x163d3d[_0x1561('0x66')]=_[_0x1561('0x67')](_0x163d3d[_0x1561('0x66')],{'$or':_[_0x1561('0x3f')](_0x56f74e,function(_0x2d8f76){if(_0x2d8f76[_0x1561('0x56')]!=='VIRTUAL'){var _0x52fd60={};_0x52fd60[_0x2d8f76[_0x1561('0x31')]]={'$like':'%'+_0x2f6eec[_0x1561('0x5b')][_0x1561('0x65')]+'%'};return _0x52fd60;}})});}_0x163d3d=_[_0x1561('0x67')]({},_0x163d3d,_0x2f6eec[_0x1561('0x68')]);var _0x418ca5={'where':_0x163d3d[_0x1561('0x66')]};return db[_0x1561('0x69')]['count'](_0x418ca5)[_0x1561('0x17')](function(_0x9bad5a){_0xb4d577[_0x1561('0x2a')]=_0x9bad5a;if(_0x2f6eec[_0x1561('0x5b')][_0x1561('0x6a')]){_0x163d3d['include']=[{'all':!![]}];}return db['ChatWebsite'][_0x1561('0x6b')](_0x163d3d);})[_0x1561('0x17')](function(_0x2fb70e){_0xb4d577['rows']=_0x2fb70e;return _0xb4d577;})['then'](respondWithFilteredResult(_0x1da955,_0x163d3d))[_0x1561('0x22')](handleError(_0x1da955,null));};exports['show']=function(_0x19ac9a,_0x3bd2f6){var _0x5d96ad={'raw':![],'where':{'id':_0x19ac9a[_0x1561('0x6c')]['id']},'include':[{'model':db[_0x1561('0x6d')],'as':_0x1561('0x58')}]},_0x50e4bf={};_0x50e4bf['model']=_[_0x1561('0x5c')](db[_0x1561('0x69')][_0x1561('0x59')]);_0x50e4bf[_0x1561('0x5b')]=_[_0x1561('0x5c')](_0x19ac9a[_0x1561('0x5b')]);_0x50e4bf[_0x1561('0x5d')]=_['intersection'](_0x50e4bf[_0x1561('0x54')],_0x50e4bf[_0x1561('0x5b')]);_0x5d96ad[_0x1561('0x60')]=_[_0x1561('0x5e')](_0x50e4bf[_0x1561('0x54')],qs['fields'](_0x19ac9a[_0x1561('0x5b')][_0x1561('0x5f')]));_0x5d96ad[_0x1561('0x60')]=_0x5d96ad[_0x1561('0x60')][_0x1561('0x61')]?_0x5d96ad[_0x1561('0x60')]:_0x50e4bf[_0x1561('0x54')];if(_0x19ac9a[_0x1561('0x5b')][_0x1561('0x6a')]){_0x5d96ad[_0x1561('0x6e')]=[{'all':!![]}];}_0x5d96ad=_[_0x1561('0x67')]({},_0x5d96ad,_0x19ac9a[_0x1561('0x68')]);return db[_0x1561('0x69')][_0x1561('0x6f')](_0x5d96ad)[_0x1561('0x17')](handleEntityNotFound(_0x3bd2f6,null))[_0x1561('0x17')](respondWithResult(_0x3bd2f6,null))[_0x1561('0x22')](handleError(_0x3bd2f6,null));};exports[_0x1561('0x70')]=function(_0xc185dc,_0x2ab30d){return db[_0x1561('0x69')][_0x1561('0x70')](_0xc185dc['body'],{})['then'](function(_0x11b478){var _0x27757a=_0xc185dc[_0x1561('0x71')]['get']({'plain':!![]});if(!_0x27757a)throw new Error(_0x1561('0x72'));if(_0x27757a[_0x1561('0x73')]===_0x1561('0x71')){var _0x43b698=_0x11b478[_0x1561('0x42')]({'plain':!![]});var _0x3ea798='ChatWebsites';return db['UserProfileSection'][_0x1561('0x6f')]({'where':{'name':_0x3ea798,'userProfileId':_0x27757a[_0x1561('0x74')]},'raw':!![]})[_0x1561('0x17')](function(_0x1d5dbe){if(_0x1d5dbe&&_0x1d5dbe[_0x1561('0x75')]===0x0){return db[_0x1561('0x2e')][_0x1561('0x70')]({'name':_0x43b698[_0x1561('0x31')],'resourceId':_0x43b698['id'],'type':_0x1d5dbe[_0x1561('0x31')],'sectionId':_0x1d5dbe['id']},{})[_0x1561('0x17')](function(){return _0x11b478;});}else{return _0x11b478;}})[_0x1561('0x22')](function(_0x6ef25f){logger['error'](_0x1561('0x76'),_0x6ef25f);throw _0x6ef25f;});}return _0x11b478;})['then'](respondWithResult(_0x2ab30d,0xc9))[_0x1561('0x22')](handleError(_0x2ab30d,null));};exports[_0x1561('0x2c')]=function(_0x14e31e,_0xf4b317){if(_0x14e31e[_0x1561('0x77')]['id']){delete _0x14e31e[_0x1561('0x77')]['id'];}return db[_0x1561('0x69')][_0x1561('0x6f')]({'where':{'id':_0x14e31e['params']['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]})['then'](handleEntityNotFound(_0xf4b317,null))[_0x1561('0x17')](saveUpdates(_0x14e31e['body'],null))[_0x1561('0x17')](respondWithResult(_0xf4b317,null))[_0x1561('0x22')](handleError(_0xf4b317,null));};exports[_0x1561('0x2f')]=function(_0x228235,_0x2a6cd4){return db['ChatWebsite'][_0x1561('0x6f')]({'where':{'id':_0x228235['params']['id']}})[_0x1561('0x17')](handleEntityNotFound(_0x2a6cd4,null))[_0x1561('0x17')](removeEntity(_0x2a6cd4,null))['catch'](handleError(_0x2a6cd4,null));};exports['describe']=function(_0x4e060b,_0x3eb78d){return db[_0x1561('0x69')]['describe']()[_0x1561('0x17')](respondWithResult(_0x3eb78d,null))[_0x1561('0x22')](handleError(_0x3eb78d,null));};exports[_0x1561('0x78')]=function(_0x336954,_0x35c92e){if(_0x336954['body']['id']){delete _0x336954['body']['id'];}return db['ChatWebsite'][_0x1561('0x6f')]({'where':{'id':_0x336954[_0x1561('0x6c')]['id']}})['then'](handleEntityNotFound(_0x35c92e,null))[_0x1561('0x17')](function(_0x4f3397){if(_0x4f3397){_0x336954['body']['ChatWebsiteId']=_0x4f3397['id'];return db['Disposition'][_0x1561('0x70')](_0x336954[_0x1561('0x77')]);}})[_0x1561('0x17')](respondWithResult(_0x35c92e,null))[_0x1561('0x22')](handleError(_0x35c92e,null));};exports[_0x1561('0x79')]=function(_0xb50dae,_0x5a0143){var _0x4c33b9={'raw':![],'where':{}};var _0x4bee5d={};var _0x5bba97={'count':0x0,'rows':[]};return db['ChatWebsite'][_0x1561('0x7a')]({'where':{'id':_0xb50dae[_0x1561('0x6c')]['id']}})[_0x1561('0x17')](handleEntityNotFound(_0x5a0143,null))['then'](function(_0x22b8b3){if(_0x22b8b3){_0x4bee5d['model']=_[_0x1561('0x5c')](db['Disposition'][_0x1561('0x59')]);_0x4bee5d['query']=_['keys'](_0xb50dae[_0x1561('0x5b')]);_0x4bee5d[_0x1561('0x5d')]=_['intersection'](_0x4bee5d[_0x1561('0x54')],_0x4bee5d[_0x1561('0x5b')]);_0x4c33b9[_0x1561('0x60')]=_[_0x1561('0x5e')](_0x4bee5d[_0x1561('0x54')],qs[_0x1561('0x5f')](_0xb50dae[_0x1561('0x5b')][_0x1561('0x5f')]));_0x4c33b9[_0x1561('0x60')]=_0x4c33b9['attributes'][_0x1561('0x61')]?_0x4c33b9[_0x1561('0x60')]:_0x4bee5d['model'];if(!_0xb50dae['query'][_0x1561('0x62')]('nolimit')){_0x4c33b9[_0x1561('0x29')]=qs[_0x1561('0x29')](_0xb50dae['query']['limit']);_0x4c33b9['offset']=qs[_0x1561('0x27')](_0xb50dae[_0x1561('0x5b')][_0x1561('0x27')]);}_0x4c33b9[_0x1561('0x63')]=qs[_0x1561('0x7b')](_0xb50dae['query'][_0x1561('0x7b')]);_0x4c33b9[_0x1561('0x66')]=qs['filters'](_[_0x1561('0x64')](_0xb50dae['query'],_0x4bee5d[_0x1561('0x5d')]));_0x4c33b9[_0x1561('0x66')][_0x1561('0x7c')]=_0x22b8b3['id'];if(_0xb50dae[_0x1561('0x5b')][_0x1561('0x65')]){_0x4c33b9[_0x1561('0x66')]=_[_0x1561('0x67')](_0x4c33b9[_0x1561('0x66')],{'$or':_[_0x1561('0x3f')](_0x4c33b9[_0x1561('0x60')],function(_0x58d7aa){var _0x4f7966={};_0x4f7966[_0x58d7aa]={'$like':'%'+_0xb50dae[_0x1561('0x5b')][_0x1561('0x65')]+'%'};return _0x4f7966;})});}_0x4c33b9=_[_0x1561('0x67')]({},_0x4c33b9,_0xb50dae[_0x1561('0x68')]);return db[_0x1561('0x7d')][_0x1561('0x2a')]({'where':_0x4c33b9[_0x1561('0x66')]})[_0x1561('0x17')](function(_0x2a2ca4){_0x5bba97[_0x1561('0x2a')]=_0x2a2ca4;if(_0xb50dae['query'][_0x1561('0x6a')]){_0x4c33b9[_0x1561('0x6e')]=[{'all':!![]}];}return db[_0x1561('0x7d')][_0x1561('0x6b')](_0x4c33b9);})[_0x1561('0x17')](function(_0x4ee1dd){_0x5bba97[_0x1561('0x7e')]=_0x4ee1dd;return _0x5bba97;});}})[_0x1561('0x17')](respondWithFilteredResult(_0x5a0143,_0x4c33b9))[_0x1561('0x22')](handleError(_0x5a0143,null));};exports[_0x1561('0x7f')]=function(_0x2395a2,_0x45a96e){return db[_0x1561('0x69')][_0x1561('0x6f')]({'where':{'id':_0x2395a2[_0x1561('0x6c')]['id']}})['then'](handleEntityNotFound(_0x45a96e,null))[_0x1561('0x17')](function(_0x30e7f4){if(_0x30e7f4){return _0x30e7f4[_0x1561('0x7f')](_0x2395a2['query']['ids']);}})[_0x1561('0x17')](respondWithStatusCode(_0x45a96e,null))[_0x1561('0x22')](handleError(_0x45a96e,null));};exports[_0x1561('0x80')]=function(_0x517c21,_0x313c96){if(_0x517c21[_0x1561('0x77')]['id']){delete _0x517c21[_0x1561('0x77')]['id'];}return db[_0x1561('0x69')]['find']({'where':{'id':_0x517c21[_0x1561('0x6c')]['id']}})[_0x1561('0x17')](handleEntityNotFound(_0x313c96,null))[_0x1561('0x17')](function(_0x1d5096){if(_0x1d5096){_0x517c21[_0x1561('0x77')][_0x1561('0x7c')]=_0x1d5096['id'];return db[_0x1561('0x81')][_0x1561('0x70')](_0x517c21[_0x1561('0x77')]);}})[_0x1561('0x17')](respondWithResult(_0x313c96,null))[_0x1561('0x22')](handleError(_0x313c96,null));};exports[_0x1561('0x82')]=function(_0x21aff2,_0x3a15e5){var _0x3485c4={'raw':![],'where':{}};var _0x481c7d={};var _0x37ac38={'count':0x0,'rows':[]};return db['ChatWebsite'][_0x1561('0x7a')]({'where':{'id':_0x21aff2[_0x1561('0x6c')]['id']}})['then'](handleEntityNotFound(_0x3a15e5,null))[_0x1561('0x17')](function(_0x56d943){if(_0x56d943){_0x481c7d[_0x1561('0x54')]=_['keys'](db['CannedAnswer']['rawAttributes']);_0x481c7d[_0x1561('0x5b')]=_[_0x1561('0x5c')](_0x21aff2[_0x1561('0x5b')]);_0x481c7d['filters']=_[_0x1561('0x5e')](_0x481c7d['model'],_0x481c7d['query']);_0x3485c4[_0x1561('0x60')]=_[_0x1561('0x5e')](_0x481c7d[_0x1561('0x54')],qs['fields'](_0x21aff2[_0x1561('0x5b')][_0x1561('0x5f')]));_0x3485c4['attributes']=_0x3485c4['attributes']['length']?_0x3485c4[_0x1561('0x60')]:_0x481c7d[_0x1561('0x54')];if(!_0x21aff2['query']['hasOwnProperty'](_0x1561('0x83'))){_0x3485c4[_0x1561('0x29')]=qs[_0x1561('0x29')](_0x21aff2['query'][_0x1561('0x29')]);_0x3485c4['offset']=qs[_0x1561('0x27')](_0x21aff2['query']['offset']);}_0x3485c4['order']=qs['sort'](_0x21aff2[_0x1561('0x5b')][_0x1561('0x7b')]);_0x3485c4[_0x1561('0x66')]=qs['filters'](_[_0x1561('0x64')](_0x21aff2['query'],_0x481c7d[_0x1561('0x5d')]));_0x3485c4[_0x1561('0x66')][_0x1561('0x7c')]=_0x56d943['id'];if(_0x21aff2['query'][_0x1561('0x65')]){_0x3485c4[_0x1561('0x66')]=_[_0x1561('0x67')](_0x3485c4[_0x1561('0x66')],{'$or':_['map'](_0x3485c4[_0x1561('0x60')],function(_0x56ff77){var _0x3a8cd0={};_0x3a8cd0[_0x56ff77]={'$like':'%'+_0x21aff2[_0x1561('0x5b')][_0x1561('0x65')]+'%'};return _0x3a8cd0;})});}_0x3485c4=_[_0x1561('0x67')]({},_0x3485c4,_0x21aff2[_0x1561('0x68')]);return db[_0x1561('0x81')][_0x1561('0x2a')]({'where':_0x3485c4[_0x1561('0x66')]})[_0x1561('0x17')](function(_0x4d8364){_0x37ac38['count']=_0x4d8364;if(_0x21aff2[_0x1561('0x5b')][_0x1561('0x6a')]){_0x3485c4[_0x1561('0x6e')]=[{'all':!![]}];}return db[_0x1561('0x81')][_0x1561('0x6b')](_0x3485c4);})['then'](function(_0x19b8b1){_0x37ac38['rows']=_0x19b8b1;return _0x37ac38;});}})['then'](respondWithFilteredResult(_0x3a15e5,_0x3485c4))['catch'](handleError(_0x3a15e5,null));};exports[_0x1561('0x84')]=function(_0x796fe8,_0xc323a7){return db[_0x1561('0x69')][_0x1561('0x6f')]({'where':{'id':_0x796fe8[_0x1561('0x6c')]['id']}})[_0x1561('0x17')](handleEntityNotFound(_0xc323a7,null))[_0x1561('0x17')](function(_0x5dc259){if(_0x5dc259){return _0x5dc259[_0x1561('0x84')](_0x796fe8[_0x1561('0x5b')][_0x1561('0x85')]);}})[_0x1561('0x17')](respondWithStatusCode(_0xc323a7,null))['catch'](handleError(_0xc323a7,null));};exports[_0x1561('0x86')]=function(_0x147748,_0x1de350){_0x147748[_0x1561('0x77')][_0x1561('0x87')]=_0x147748[_0x1561('0x88')][_0x1561('0x89')];return db[_0x1561('0x69')]['find']({'where':{'id':_0x147748[_0x1561('0x6c')]['id']}})[_0x1561('0x17')](handleEntityNotFound(_0x1de350,null))[_0x1561('0x17')](saveUpdates(_0x147748[_0x1561('0x77')],null))[_0x1561('0x17')](respondWithResult(_0x1de350,null))[_0x1561('0x22')](handleError(_0x1de350,null));};exports[_0x1561('0x8a')]=function(_0x3cdfef,_0x5405bc){_0x3cdfef[_0x1561('0x77')][_0x1561('0x8b')]=_0x3cdfef['file'][_0x1561('0x89')];return db[_0x1561('0x69')]['find']({'where':{'id':_0x3cdfef[_0x1561('0x6c')]['id']}})[_0x1561('0x17')](handleEntityNotFound(_0x5405bc,null))[_0x1561('0x17')](saveUpdates(_0x3cdfef[_0x1561('0x77')],null))[_0x1561('0x17')](respondWithResult(_0x5405bc,null))[_0x1561('0x22')](handleError(_0x5405bc,null));};exports[_0x1561('0x8c')]=function(_0x5282b0,_0x47c93a){_0x5282b0[_0x1561('0x77')][_0x1561('0x8d')]=_0x5282b0['file']['filename'];return db['ChatWebsite']['find']({'where':{'id':_0x5282b0[_0x1561('0x6c')]['id']}})[_0x1561('0x17')](handleEntityNotFound(_0x47c93a,null))[_0x1561('0x17')](saveUpdates(_0x5282b0[_0x1561('0x77')],null))[_0x1561('0x17')](respondWithResult(_0x47c93a,null))[_0x1561('0x22')](handleError(_0x47c93a,null));};exports[_0x1561('0x8e')]=function(_0x33fe37,_0x17d3a5){_0x33fe37['body'][_0x1561('0x8f')]=_0x33fe37[_0x1561('0x88')][_0x1561('0x89')];return db[_0x1561('0x69')]['find']({'where':{'id':_0x33fe37['params']['id']}})[_0x1561('0x17')](handleEntityNotFound(_0x17d3a5,null))[_0x1561('0x17')](saveUpdates(_0x33fe37[_0x1561('0x77')],null))[_0x1561('0x17')](respondWithResult(_0x17d3a5,null))[_0x1561('0x22')](handleError(_0x17d3a5,null));};exports[_0x1561('0x90')]=function(_0x494ee7,_0xc79403){var _0x192e78=path[_0x1561('0x91')](config[_0x1561('0x92')],'server/files/images/logos/default_logo.svg');var _0x2dcb71={'where':{'id':_0x494ee7[_0x1561('0x6c')]['id']},'attributes':['id',_0x1561('0x87')],'raw':!![]};var _0x4e4565=![];return require(_0x1561('0x93'))[_0x1561('0x94')]()[_0x1561('0x17')](function(_0x1ab77e){if(_0x1ab77e){_0x4e4565=_0x1ab77e[_0x1561('0x95')];}})['then'](function(){return db[_0x1561('0x69')][_0x1561('0x6f')](_0x2dcb71);})[_0x1561('0x17')](handleEntityNotFound(_0xc79403,null))[_0x1561('0x17')](function(_0x55e0fd){if(_0x55e0fd){if(!_[_0x1561('0x96')](_0x55e0fd[_0x1561('0x87')])){if(fs[_0x1561('0x97')](path[_0x1561('0x91')](config[_0x1561('0x92')],_0x1561('0x98'),_0x55e0fd[_0x1561('0x87')]))&&_0x4e4565){_0x192e78=path[_0x1561('0x91')](config['root'],_0x1561('0x98'),_0x55e0fd[_0x1561('0x87')]);}}return _0xc79403[_0x1561('0x99')](_0x192e78);}})[_0x1561('0x22')](handleError(_0xc79403,null));};exports[_0x1561('0x9a')]=function(_0x33b318,_0x5cbce0){var _0x23e0d8=path[_0x1561('0x91')](config[_0x1561('0x92')],'server/files/images/avatars/default_avatar.png');var _0x400859={'where':{'id':_0x33b318['params']['id']},'attributes':['id',_0x1561('0x8b')],'raw':!![]};return db[_0x1561('0x69')][_0x1561('0x6f')](_0x400859)[_0x1561('0x17')](handleEntityNotFound(_0x5cbce0,null))[_0x1561('0x17')](function(_0x34c621){if(_0x34c621){if(!_[_0x1561('0x96')](_0x34c621[_0x1561('0x8b')])){if(fs[_0x1561('0x97')](path[_0x1561('0x91')](config['root'],'server/files/images/avatars/',_0x34c621['agentAvatar']))){_0x23e0d8=path[_0x1561('0x91')](config['root'],'server/files/images/avatars/',_0x34c621[_0x1561('0x8b')]);}}return _0x5cbce0[_0x1561('0x99')](_0x23e0d8);}})['catch'](handleError(_0x5cbce0,null));};exports['getCustomerAvatar']=function(_0x2e99f8,_0x206df1){var _0x10fc33=path[_0x1561('0x91')](config[_0x1561('0x92')],'server/files/images/avatars/customer_avatar.png');var _0x162af2={'where':{'id':_0x2e99f8[_0x1561('0x6c')]['id']},'attributes':['id',_0x1561('0x8d'),_0x1561('0x9b')],'raw':!![]};return db[_0x1561('0x69')]['find'](_0x162af2)['then'](handleEntityNotFound(_0x206df1,null))[_0x1561('0x17')](function(_0x3d9a95){if(_0x3d9a95){if(!_['isNil'](_0x3d9a95[_0x1561('0x8d')])){if(fs[_0x1561('0x97')](path[_0x1561('0x91')](config[_0x1561('0x92')],_0x1561('0x9c'),_0x3d9a95[_0x1561('0x8d')]))&&_0x3d9a95[_0x1561('0x9b')]){_0x10fc33=path[_0x1561('0x91')](config[_0x1561('0x92')],'server/files/images/avatars/',_0x3d9a95[_0x1561('0x8d')]);}}return _0x206df1[_0x1561('0x99')](_0x10fc33);}})[_0x1561('0x22')](handleError(_0x206df1,null));};exports['getSystemAvatar']=function(_0x1fc423,_0x9b9863){var _0x46ee01=path[_0x1561('0x91')](config[_0x1561('0x92')],'server/files/images/avatars/system_avatar.png');var _0x58aaf5={'where':{'id':_0x1fc423[_0x1561('0x6c')]['id']},'attributes':['id',_0x1561('0x8f')],'raw':!![]};return db[_0x1561('0x69')]['find'](_0x58aaf5)['then'](handleEntityNotFound(_0x9b9863,null))['then'](function(_0x2885e0){if(_0x2885e0){if(!_[_0x1561('0x96')](_0x2885e0[_0x1561('0x8f')])){if(fs[_0x1561('0x97')](path[_0x1561('0x91')](config[_0x1561('0x92')],_0x1561('0x9c'),_0x2885e0[_0x1561('0x8f')]))){_0x46ee01=path[_0x1561('0x91')](config[_0x1561('0x92')],_0x1561('0x9c'),_0x2885e0[_0x1561('0x8f')]);}}return _0x9b9863['download'](_0x46ee01);}})[_0x1561('0x22')](handleError(_0x9b9863,null));};exports[_0x1561('0x9d')]=function(_0x2ff53c,_0xdcac39){var _0x3f3642={'body':_0x2ff53c[_0x1561('0x77')],'channel':'chat'};var _0xfa2a50=[];var _0x95b3ad=[];var _0x548ccd={};var _0x59d7e8=![];return db[_0x1561('0x9e')][_0x1561('0x9f')]()[_0x1561('0x17')](function(_0x20c34a){if(!_0x20c34a){throw new db[(_0x1561('0xa0'))]['ValidationError'](_0x1561('0xa1'));}_0xfa2a50=_['difference'](_['keys'](_0x20c34a),['createdAt',_0x1561('0xa2')]);_0x95b3ad=_[_0x1561('0xa3')](_[_0x1561('0x5c')](_0x20c34a),[_0x1561('0xa4'),_0x1561('0xa2'),_0x1561('0xa5'),_0x1561('0xa6')]);if(_0x2ff53c[_0x1561('0x77')]['id']){delete _0x2ff53c['body']['id'];}if(_[_0x1561('0x96')](_0x2ff53c['body'][_0x1561('0xa7')])){throw new db[(_0x1561('0xa0'))][(_0x1561('0xa8'))](_0x1561('0xa9'));}if(_[_0x1561('0x96')](_0x2ff53c[_0x1561('0x77')][_0x1561('0x77')])||_0x2ff53c['body']['body']===''){throw new db[(_0x1561('0xa0'))][(_0x1561('0xa8'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x2ff53c[_0x1561('0x77')][_0x1561('0xaa')])){throw new db[(_0x1561('0xa0'))][(_0x1561('0xa8'))](_0x1561('0xab')+_0x95b3ad);}if(!_[_0x1561('0xac')](_0x95b3ad,_0x2ff53c['body'][_0x1561('0xaa')])){throw new db[(_0x1561('0xa0'))]['ValidationError'](_0x1561('0xad')+_0x95b3ad);}_0x548ccd[_0x2ff53c[_0x1561('0x77')][_0x1561('0xaa')]]=_0x2ff53c['body'][_0x1561('0xa7')];})[_0x1561('0x17')](function(){return db[_0x1561('0x69')][_0x1561('0x6f')]({'where':{'id':_0x2ff53c[_0x1561('0x6c')]['id']},'include':[{'model':db[_0x1561('0xae')],'as':'List','include':[{'model':db[_0x1561('0x9e')],'as':_0x1561('0xaf'),'where':_0x548ccd,'limit':0x1,'order':[[_0x1561('0xa2'),_0x1561('0xb0')]]}]},{'model':db[_0x1561('0xb1')],'as':_0x1561('0xb2')},{'model':db[_0x1561('0x40')],'as':_0x1561('0x40'),'include':[{'model':db[_0x1561('0x40')],'as':'Intervals','attributes':['id',_0x1561('0x37')],'raw':!![]}]}]});})[_0x1561('0x17')](function(_0x1e45c8){if(!_0x1e45c8)throw new APINotFoundError(util[_0x1561('0x35')](_0x1561('0xb3'),_0x2ff53c['params']['id']));if(!_0x1e45c8[_0x1561('0x40')]||!_0x1e45c8[_0x1561('0x40')][_0x1561('0x41')])return[_0x1e45c8,!![]];return[_0x1e45c8,checkWebsiteIntervals(_0x1e45c8)];})[_0x1561('0xb4')](function(_0x1b6008,_0x318ab4){if(!_0x318ab4)throw new APIOutOfIntervalError();if(!_0x1b6008[_0x1561('0xb5')])return;_0x3f3642['account']=_0x1b6008;_0x3f3642['list']=_0x1b6008[_0x1561('0xb5')];_0x3f3642[_0x1561('0xb6')]=_[_0x1561('0xb7')](_0x1b6008[_0x1561('0xb2')],[_0x1561('0xb8')],[_0x1561('0xb9')]);if(_0x3f3642[_0x1561('0xba')]['Applications']){delete _0x3f3642['account']['Applications'];}if(_0x3f3642['account'][_0x1561('0xb5')]&&_0x3f3642[_0x1561('0xba')][_0x1561('0xb5')][_0x1561('0xaf')]['length']){return _0x3f3642['account'][_0x1561('0xb5')][_0x1561('0xaf')][0x0];}var _0x9ba11c=_[_0x1561('0xf')](_0x2ff53c[_0x1561('0x77')],{'firstName':_0x2ff53c[_0x1561('0x77')]['from'],'ListId':_0x1b6008[_0x1561('0xa6')]});_0x9ba11c[_0x2ff53c[_0x1561('0x77')][_0x1561('0xaa')]]=_0x2ff53c[_0x1561('0x77')]['from'];return db[_0x1561('0x9e')]['create'](_0x9ba11c,{'fields':_0xfa2a50,'raw':!![]});})[_0x1561('0x17')](function(_0x11716f){_0x3f3642[_0x1561('0xbb')]=_0x11716f;var _0x43c516=createInteractionObject(_0x2ff53c['params']['id'],_0x2ff53c[_0x1561('0x77')],_0x2ff53c[_0x1561('0xbc')],_0x11716f);var _0x47f469={'ChatWebsiteId':_0x2ff53c[_0x1561('0x6c')]['id'],'closed':![]};if(_0x2ff53c[_0x1561('0x77')][_0x1561('0xbd')]){_0x47f469[_0x1561('0xbd')]=_0x2ff53c[_0x1561('0x77')][_0x1561('0xbd')];return db[_0x1561('0xbe')][_0x1561('0x6f')]({'where':_0x47f469})[_0x1561('0x17')](function(_0x1cfabd){if(_0x1cfabd){_0x59d7e8=!![];return _0x1cfabd;}_0x43c516['threadId']=_0x2ff53c[_0x1561('0x77')][_0x1561('0xbd')];_0x43c516['externalUrl']=_0x2ff53c['body'][_0x1561('0xbf')];return db[_0x1561('0xbe')]['create'](_0x43c516);});}_0x47f469['ContactId']=_0x11716f['id'];if(_0x2ff53c[_0x1561('0x77')]['interaction']&&_0x2ff53c['body'][_0x1561('0xc0')]['id']){_0x47f469['id']=_0x2ff53c[_0x1561('0x77')][_0x1561('0xc0')]['id'];return db[_0x1561('0xbe')][_0x1561('0x6f')]({'where':_0x47f469})[_0x1561('0x17')](function(_0x59b465){if(_0x59b465){_0x59d7e8=!![];return _0x59b465;}return db[_0x1561('0xbe')]['create'](_0x43c516);});}return db['ChatInteraction']['create'](_0x43c516);})[_0x1561('0x17')](function(_0x4bfe55){if(!_0x59d7e8)return _0x4bfe55;var _0x4144b4={'from':(_0x3f3642[_0x1561('0xbb')][_0x1561('0x4c')]||'')+'\x20'+(_0x3f3642['contact'][_0x1561('0x4d')]||'')};if(_0x2ff53c[_0x1561('0x77')][_0x1561('0xbd')]&&_0x2ff53c[_0x1561('0x77')][_0x1561('0xc1')]&&_0x2ff53c['body']['threadId']!=_0x2ff53c[_0x1561('0x77')][_0x1561('0xc1')]){_0x4144b4[_0x1561('0xbd')]=_0x2ff53c['body'][_0x1561('0xc1')];}return _0x4bfe55[_0x1561('0x2c')](_0x4144b4);})[_0x1561('0x17')](function(_0x43537d){_0x3f3642[_0x1561('0xc0')]=_0x43537d[_0x1561('0x42')]({'plain':!![]});_0x3f3642['interaction'][_0x1561('0xc2')]=!_0x59d7e8;if(_0x3f3642[_0x1561('0xc0')][_0x1561('0xc2')]){if(_0x3f3642[_0x1561('0xba')][_0x1561('0xc3')]){_0x3f3642[_0x1561('0xb6')][_0x1561('0xc4')]({'id':0x0,'priority':_0x3f3642[_0x1561('0xb6')][_0x1561('0x61')]+0x1,'app':'close','appdata':_0x1561('0xc5'),'interval':_0x1561('0xc6')});}}return db[_0x1561('0xc7')]['create']({'body':_0x2ff53c['body'][_0x1561('0x77')],'ChatWebsiteId':_0x2ff53c[_0x1561('0x6c')]['id'],'ChatInteractionId':_0x43537d['id'],'direction':'in','ContactId':_0x3f3642[_0x1561('0xbb')]['id'],'AttachmentId':_0x2ff53c[_0x1561('0x77')][_0x1561('0xc8')]});})['then'](function(_0x355b79){_0x3f3642['message']=_0x355b79;if(!_0x3f3642['interaction']['UserId']){return;}return db[_0x1561('0xc9')][_0x1561('0x6f')]({'attributes':['id',_0x1561('0x31')],'where':{'id':_0x3f3642[_0x1561('0xc0')][_0x1561('0xca')]}});})[_0x1561('0x17')](function(_0x487526){if(_0x487526){_0x3f3642[_0x1561('0xb6')][_0x1561('0xcb')]({'id':0x0,'priority':0x0,'app':_0x1561('0xcc'),'appdata':_0x487526['name']+','+(_0x3f3642['account'][_0x1561('0xcd')]||0xa),'interval':'*,*,*,*'});_0x3f3642[_0x1561('0xce')]=!![];}if(!_0x3f3642[_0x1561('0xc0')][_0x1561('0xcf')]){return;}return db['ChatQueue'][_0x1561('0x6f')]({'attributes':['id',_0x1561('0x31')],'where':{'id':_0x3f3642[_0x1561('0xc0')][_0x1561('0xcf')]}});})[_0x1561('0x17')](function(_0x14d5a9){if(_0x14d5a9){_0x3f3642['applications']['unshift']({'id':0x0,'priority':0x1,'app':_0x1561('0xd0'),'appdata':_0x14d5a9[_0x1561('0x31')]+','+(_0x3f3642[_0x1561('0xba')][_0x1561('0xd1')]||0x12c),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x1561('0xd2'),_0x1561('0xd3'),_0x3f3642);})[_0x1561('0x17')](function(_0x344b52){respondWithRpcPromise(_0x1561('0xd4'),_0x1561('0xd4'),{'event':'notify','message':_0x344b52},client9002);return _0x344b52;})[_0x1561('0x17')](respondWithResult(_0xdcac39,null))[_0x1561('0x22')](APIHandleError(_0xdcac39));};exports[_0x1561('0xd5')]=function(_0x57f605,_0x33fc53){var _0x303c43,_0x144ffa,_0x1c15e9;var _0x888327=[];var _0x5b89b6={};var _0x4c1885=_0x57f605[_0x1561('0xd6')]||[];var _0x3dd49e=[];var _0x1dccb9;return db[_0x1561('0x9e')][_0x1561('0x9f')]()[_0x1561('0x17')](function(_0x229ebe){if(!_0x229ebe){throw new db[(_0x1561('0xa0'))][(_0x1561('0xa8'))](_0x1561('0xa1'));}_0x888327=_[_0x1561('0xa3')](_[_0x1561('0x5c')](_0x229ebe),['createdAt',_0x1561('0xa2'),_0x1561('0xa5'),_0x1561('0xa6')]);if(_0x57f605[_0x1561('0x77')]['id']){delete _0x57f605[_0x1561('0x77')]['id'];}if(_[_0x1561('0x96')](_0x57f605['body'][_0x1561('0xa7')])){throw _0x33fc53[_0x1561('0x24')](0x1f4)[_0x1561('0x32')](new db[(_0x1561('0xa0'))][(_0x1561('0xa8'))](_0x1561('0xa9')));}if(_[_0x1561('0x96')](_0x57f605[_0x1561('0x77')][_0x1561('0x77')])||_0x57f605[_0x1561('0x77')][_0x1561('0x77')]===''){throw _0x33fc53[_0x1561('0x24')](0x1f4)[_0x1561('0x32')](new db['Sequelize'][(_0x1561('0xa8'))]('body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_['isNil'](_0x57f605[_0x1561('0x77')][_0x1561('0xd7')])){throw _0x33fc53[_0x1561('0x24')](0x1f4)[_0x1561('0x32')](new db[(_0x1561('0xa0'))]['ValidationError'](_0x1561('0xd8')+_0x888327));}if(!_[_0x1561('0xac')](_0x888327,_0x57f605['body'][_0x1561('0xd7')])){throw _0x33fc53['status'](0x1f4)[_0x1561('0x32')](new db[(_0x1561('0xa0'))]['ValidationError']('mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x888327));}_0x5b89b6[_0x57f605['body'][_0x1561('0xd7')]]=_0x57f605['body'][_0x1561('0xa7')];})[_0x1561('0x17')](function(){return db[_0x1561('0x69')][_0x1561('0x6f')]({'where':{'id':_0x57f605['params']['id']},'include':[{'model':db['CmList'],'as':_0x1561('0xb5')},{'model':db[_0x1561('0xd9')],'as':_0x1561('0xd9')}]});})[_0x1561('0x17')](handleEntityNotFound(_0x33fc53,null))[_0x1561('0x17')](function(_0x25d8f9){if(_0x25d8f9&&_0x25d8f9['List']){_0x144ffa=_0x25d8f9;var _0x13a3e7=_[_0x1561('0xf')](_0x57f605['body'],{'firstName':_0x57f605[_0x1561('0x77')][_0x1561('0xa7')],'phone':_0x57f605[_0x1561('0x77')]['from'],'ListId':_0x25d8f9[_0x1561('0xa6')]});_0x13a3e7[_0x57f605['body'][_0x1561('0xd7')]]=_0x57f605[_0x1561('0x77')][_0x1561('0xa7')];return db[_0x1561('0x9e')][_0x1561('0xda')]({'where':_0x5b89b6,'defaults':_0x13a3e7});}})[_0x1561('0xb4')](function(_0x1d9548){if(_0x1d9548){_0x1c15e9=_0x1d9548;var _0x48bf6d=fs[_0x1561('0xdb')](path['join'](config['root'],_0x1561('0xdc')),'utf8');var _0x109f59=ejs[_0x1561('0xdd')](_0x48bf6d,{'body':_[_0x1561('0xde')](_0x57f605['body'][_0x1561('0x77')]),'bodyTitle':_0x144ffa[_0x1561('0xdf')]});return db[_0x1561('0xe0')][_0x1561('0x70')]({'body':_0x109f59,'plainBody':htmlToText[_0x1561('0xe1')](_0x109f59),'ContactId':_0x1d9548['id'],'ChatWebsiteId':_0x144ffa['id']});}})['then'](function(_0x3bdd05){_0x1dccb9=_0x3bdd05;if(_0x4c1885['length']){var _0x100ece=_0x4c1885[_0x1561('0x3f')](function(_0x59ed43){return{'name':_0x59ed43[_0x1561('0xe2')],'basename':_0x59ed43[_0x1561('0x89')],'type':_0x59ed43[_0x1561('0xe3')],'ChatOfflineMessageId':_0x3bdd05['id']};});_0x3dd49e=_0x100ece[_0x1561('0x3f')](_0x2e1210=>{var _0x1ba24d={'filename':_0x2e1210['name'],'path':path[_0x1561('0x91')](config[_0x1561('0x92')],_0x1561('0xe4'),'files',_0x1561('0xe5'),_0x1561('0xe6'),_0x2e1210['basename'])};return _0x1ba24d;});if(!_0x144ffa[_0x1561('0xe7')]){return db[_0x1561('0xe8')][_0x1561('0xe9')](function(_0x1a5258){return db[_0x1561('0xea')][_0x1561('0xeb')](_0x100ece,{'transaction':_0x1a5258});});}}})[_0x1561('0x17')](function(){if(_0x1dccb9){_0x303c43=_0x1dccb9;return db[_0x1561('0xd9')][_0x1561('0x7a')]({'where':{'service':!![]},'include':[{'model':db[_0x1561('0xec')],'as':'Smtp','raw':!![],'include':[{'model':db[_0x1561('0xed')],'as':_0x1561('0xed'),'raw':!![]}]}]});}})[_0x1561('0x17')](function(_0x2b44cc){if(_0x2b44cc&&_0x2b44cc['Smtp']&&_0x144ffa['forwardOffline']&&_0x144ffa[_0x1561('0xee')]){var _0x52eb8c=_0x2b44cc[_0x1561('0xef')]();return respondWithRpcPromise(_0x1561('0xf0'),'sendMail',{'account':_0x52eb8c,'message':{'from':util[_0x1561('0x35')]('\x22%s\x22\x20<%s>',_0x2b44cc[_0x1561('0x31')],_0x2b44cc[_0x1561('0xf1')]||_0x2b44cc[_0x1561('0xf2')]['user']),'to':_0x144ffa[_0x1561('0xee')],'subject':_0x144ffa[_0x1561('0xf3')],'html':_0x303c43[_0x1561('0x77')],'attachments':_0x3dd49e}},client9003)[_0x1561('0x17')](function(){return _0x303c43;})[_0x1561('0x22')](function(_0xa67f15){logger[_0x1561('0x1d')](_0xa67f15);});}})[_0x1561('0x17')](function(){if(_0x144ffa&&_0x144ffa[_0x1561('0xe7')]&&_0x144ffa[_0x1561('0xf4')]){var _0x38329b=[];if(_0x4c1885[_0x1561('0x61')]){_0x38329b=_0x4c1885[_0x1561('0x3f')](function(_0x15bf97){return{'name':_0x15bf97[_0x1561('0xe2')],'basename':_0x15bf97[_0x1561('0x89')],'type':_0x15bf97[_0x1561('0xe3')],'ChatOfflineMessageId':_0x1dccb9['id']};});}var _0x3530f8;if(!_[_0x1561('0x96')](_0x144ffa[_0x1561('0xf5')])){var _0x4ea266=_[_0x1561('0x3f')](_0x57f605[_0x1561('0x77')],function(_0x2f52b5){return _0x2f52b5;});var _0x24c71f=_['toPairsIn'](_0x4ea266)[0x0];var _0x4364e9=_[_0x1561('0xf6')](_0x24c71f,function(_0x1bdbdd){return _0x1bdbdd;});_0x3530f8=_0x4364e9[0x1][_0x144ffa['subjectOffline']];}var _0x4b03c6={'from':_0x1c15e9[_0x1561('0xf1')],'firstName':_0x1c15e9[_0x1561('0x4c')],'lastName':_0x1c15e9['lastName'],'mapKey':_0x1561('0xf1'),'message':{'from':_0x1c15e9[_0x1561('0xf1')],'to':_0x144ffa['MailAccount'][_0x1561('0xf1')],'cc':'','subject':_['isNil'](_0x3530f8)?_0x144ffa[_0x1561('0xf3')]:_0x3530f8,'messageId':'','sentAt':new Date(),'attach':_0x38329b[_0x1561('0x61')],'attachments':_0x38329b,'originChannel':_0x1561('0xf7'),'ChatWebsiteId':_0x144ffa['id'],'ChatOfflineMessageId':_0x303c43['id'],'originTo':_0x144ffa[_0x1561('0xd9')]['email']},'body':_0x303c43[_0x1561('0x77')]};var _0x52a961={'account':{'id':_0x144ffa[_0x1561('0xf4')]},'body':_0x4b03c6,'log':_0x1561('0xf8')};return respondWithRpcPromise(_0x1561('0xf8'),'notifyMail',_0x52a961,client9001)[_0x1561('0x17')](function(){return _0x303c43;})[_0x1561('0x22')](function(_0x4859e6){logger[_0x1561('0x1d')](_0x4859e6);});}return;})[_0x1561('0x17')](function(){if(_0x303c43){return _0x303c43;}})[_0x1561('0x17')](respondWithResult(_0x33fc53,null))[_0x1561('0x22')](function(){for(var _0x31c465 of _0x4c1885){var _0x2108d0=path[_0x1561('0x91')](config[_0x1561('0x92')],_0x1561('0xe4'),_0x1561('0xd6'),_0x1561('0xe5'),_0x1561('0xe6'),_0x31c465[_0x1561('0x89')]);fs_extra['remove'](_0x2108d0)[_0x1561('0x22')](function(_0x316b0c){logger[_0x1561('0x1d')](_0x1561('0xf9'),_0x2108d0,_0x316b0c);});}});};exports[_0x1561('0xfa')]=function(_0x3388a3,_0x533113){return db[_0x1561('0xbe')][_0x1561('0x6f')]({'where':{'id':_0x3388a3['params']['id']}})[_0x1561('0x17')](handleEntityNotFound(_0x533113,null))[_0x1561('0x17')](function(_0x59619a){if(_0x59619a){return _0x59619a[_0x1561('0xfa')](_0x3388a3['body'][_0x1561('0x85')],_['omit'](_0x3388a3[_0x1561('0x77')],[_0x1561('0x85'),'id'])||{});}})[_0x1561('0x17')](respondWithResult(_0x533113,null))['catch'](handleError(_0x533113,null));};exports['getInteractions']=function(_0x4af397,_0x326da2){var _0x1d0707={'raw':![],'where':{}};var _0x7fc646={};var _0x420dfb={'count':0x0,'rows':[]};return db['ChatWebsite'][_0x1561('0x7a')]({'where':{'id':_0x4af397[_0x1561('0x6c')]['id']}})[_0x1561('0x17')](handleEntityNotFound(_0x326da2,null))[_0x1561('0x17')](function(_0x33cd80){if(_0x33cd80){_0x7fc646[_0x1561('0x54')]=_[_0x1561('0x5c')](db[_0x1561('0xbe')][_0x1561('0x59')]);_0x7fc646['query']=_['keys'](_0x4af397[_0x1561('0x5b')]);_0x7fc646[_0x1561('0x5d')]=_[_0x1561('0x5e')](_0x7fc646[_0x1561('0x54')],_0x7fc646['query']);_0x1d0707[_0x1561('0x60')]=_[_0x1561('0x5e')](_0x7fc646[_0x1561('0x54')],qs[_0x1561('0x5f')](_0x4af397['query'][_0x1561('0x5f')]));_0x1d0707[_0x1561('0x60')]=_0x1d0707[_0x1561('0x60')][_0x1561('0x61')]?_0x1d0707[_0x1561('0x60')]:_0x7fc646[_0x1561('0x54')];if(!_0x4af397[_0x1561('0x5b')][_0x1561('0x62')](_0x1561('0x83'))){_0x1d0707[_0x1561('0x29')]=qs[_0x1561('0x29')](_0x4af397[_0x1561('0x5b')][_0x1561('0x29')]);_0x1d0707[_0x1561('0x27')]=qs['offset'](_0x4af397[_0x1561('0x5b')][_0x1561('0x27')]);}_0x1d0707['order']=qs[_0x1561('0x7b')](_0x4af397[_0x1561('0x5b')][_0x1561('0x7b')]);_0x1d0707[_0x1561('0x66')]=qs[_0x1561('0x5d')](_[_0x1561('0x64')](_0x4af397['query'],_0x7fc646['filters']));_0x1d0707[_0x1561('0x66')][_0x1561('0x7c')]=_0x33cd80['id'];if(_0x4af397[_0x1561('0x5b')][_0x1561('0x65')]){_0x1d0707['where']=_[_0x1561('0x67')](_0x1d0707['where'],{'$or':_[_0x1561('0x3f')](_0x1d0707[_0x1561('0x60')],function(_0xe7fdf9){var _0x311bd1={};_0x311bd1[_0xe7fdf9]={'$like':'%'+_0x4af397[_0x1561('0x5b')][_0x1561('0x65')]+'%'};return _0x311bd1;})});}_0x1d0707=_[_0x1561('0x67')]({},_0x1d0707,_0x4af397[_0x1561('0x68')]);return db[_0x1561('0xbe')][_0x1561('0x2a')]({'where':_0x1d0707['where']})[_0x1561('0x17')](function(_0x4c4913){_0x420dfb[_0x1561('0x2a')]=_0x4c4913;if(_0x4af397[_0x1561('0x5b')][_0x1561('0x6a')]){_0x1d0707[_0x1561('0x6e')]=[{'model':db['CmContact'],'as':'Contact','required':![]},{'model':db[_0x1561('0xc9')],'as':'Owner','attributes':[_0x1561('0x31'),_0x1561('0xfb'),'internal'],'required':![]},{'model':db[_0x1561('0xfc')],'as':_0x1561('0xfd'),'attributes':['id',_0x1561('0x31'),_0x1561('0xfe')],'where':_0x4af397[_0x1561('0x5b')][_0x1561('0xff')]?{'id':_0x4af397[_0x1561('0x5b')]['tag']}:undefined,'required':_0x4af397['query'][_0x1561('0xff')]?!![]:![]}];}return db[_0x1561('0xbe')][_0x1561('0x6b')](_0x1d0707);})[_0x1561('0x17')](function(_0xbb4a14){_0x420dfb[_0x1561('0x7e')]=_0xbb4a14;return _0x420dfb;});}})[_0x1561('0x17')](respondWithFilteredResult(_0x326da2,_0x1d0707))[_0x1561('0x22')](handleError(_0x326da2,null));};exports[_0x1561('0x100')]=function(_0x290042,_0x53cc1b){var _0x4a06a3=0x0;var _0x2a8ecf=0x0;var _0x2d7223=![];var _0x6fb213;var _0x5d7afe;return db['ChatWebsite'][_0x1561('0x6f')]({'where':{'id':_0x290042['params']['id']},'include':[{'model':db[_0x1561('0x40')],'as':_0x1561('0x40'),'include':[{'model':db['Interval'],'as':_0x1561('0x41'),'attributes':['id',_0x1561('0x37')]}]}]})['then'](handleEntityNotFound(_0x53cc1b,null))['then'](function(_0x552415){if(_0x552415){_0x6fb213=_0x552415;return _0x552415[_0x1561('0x101')]({'raw':!![]});}})['then'](function(_0x527177){if(_0x6fb213){if(_0x527177){_0x5d7afe=_0x527177;}}return require(_0x1561('0x93'))[_0x1561('0x94')]();})[_0x1561('0x17')](function(_0x58acdd){if(_0x58acdd){_0x2a8ecf=_0x58acdd[_0x1561('0x102')];_0x2d7223=_0x58acdd[_0x1561('0x95')];}})['then'](function(){return db['ChatInteraction']['count']({'where':{'closed':![]}});})['then'](function(_0x10eb0c){_0x4a06a3=_0x10eb0c;if(_0x2a8ecf&&_0x10eb0c>_0x2a8ecf){return db[_0x1561('0x103')][_0x1561('0x7a')]({'where':{'id':0x1}})['then'](function(_0x5e3cb9){if(_0x5e3cb9){_0x5e3cb9[_0x1561('0x104')](_0x1561('0x105'));}});}})[_0x1561('0x17')](function(){if(!_0x6fb213[_0x1561('0x40')]||!_0x6fb213[_0x1561('0x40')]['Intervals'])return!![];return checkWebsiteIntervals(_0x6fb213);})['then'](function(_0x44f1aa){var _0xce3ca8=fs[_0x1561('0xdb')](path[_0x1561('0x91')](config['root'],'server/files/chat/iframe.ejs'),'utf8');var _0x4f49aa=new url[(_0x1561('0x106'))](_0x6fb213[_0x1561('0x107')])['origin'];var _0x1e21a6='3.5.0';var _0x6cfa1=![];var _0x476c34={'chatVersion':_0x1e21a6,'chatWebsiteAddressOrigin':_0x4f49aa,'remote':_0x6fb213[_0x1561('0x108')],'query':querystring[_0x1561('0x1c')](_['merge'](_0x6fb213[_0x1561('0x42')]({'plain':!![]}),{'customerIp':_0x290042[_0x1561('0xbc')]['x-forwarded-for']||_0x290042['headers'][_0x1561('0x109')]||_0x290042[_0x1561('0x10a')]['remoteAddress']||_0x290042['ip'],'referer':_0x290042[_0x1561('0xbc')][_0x1561('0x10b')],'openedInteractions':_0x4a06a3,'maxInteractions':_0x2a8ecf,'virtual':_0x2d7223[_0x1561('0x102')],'online':_0x44f1aa,'custom':_0x2d7223}))['replace'](/'/g,'\x5c\x27')};_0x53cc1b[_0x1561('0x32')](ejs[_0x1561('0xdd')](Mustache[_0x1561('0xdd')](_0xce3ca8,_0x476c34),{'proactiveActions':_0x5d7afe,'alignment':_0x6fb213[_0x1561('0x10c')],'verticalAlignment':_0x6fb213[_0x1561('0x10d')],'div_color':_0x6fb213['color'],'labelText':_0x6fb213[_0x1561('0x10e')],'text_color':_0x6fb213[_0x1561('0x10f')],'text_button_color':_0x6fb213[_0x1561('0x110')],'button_color':_0x6fb213[_0x1561('0x111')],'background_color':_0x6fb213[_0x1561('0x112')],'hideWhenOffline':_0x6fb213[_0x1561('0x113')],'intervalId':_0x6fb213[_0x1561('0x114')],'isDevelopment':_0x6cfa1,'chatVersion':_0x1e21a6}));})[_0x1561('0x22')](handleError(_0x53cc1b,null));};exports[_0x1561('0x115')]=function(_0x326614,_0x2e0575){var _0x346693=_0x326614[_0x1561('0x6c')]['id'];var _0x2d6cf9=_0x326614[_0x1561('0x77')];var _0x5354f5=0xc8;var _0x65cd36=null;return db[_0x1561('0xe8')][_0x1561('0xe9')]({'isolationLevel':db['sequelize'][_0x1561('0x116')][_0x1561('0x117')][_0x1561('0x118')]},function(_0x2dec8f){return db['ChatWebsite'][_0x1561('0x7a')]({'where':{'id':_0x346693},'transaction':_0x2dec8f})['then'](function(_0x116b22){if(_0x116b22){return db[_0x1561('0xb1')][_0x1561('0x2f')]({'where':{'ChatWebsiteId':_0x346693},'transaction':_0x2dec8f})[_0x1561('0x17')](function(){var _0x2be6a4=_[_0x1561('0x3f')](_0x2d6cf9,function(_0x449a01){_0x449a01[_0x1561('0x7c')]=_0x346693;return _0x449a01;});return db[_0x1561('0xb1')][_0x1561('0xeb')](_0x2be6a4,{'transaction':_0x2dec8f});});}else{_0x5354f5=0x194;_0x65cd36=[];}});})[_0x1561('0x17')](function(){if(_0x5354f5!==0x194){return db['ChatApplication'][_0x1561('0x119')]({'where':{'ChatWebsiteId':_0x346693},'order':'priority'})['then'](function(_0x3eb9b5){_0x65cd36=_0x3eb9b5;});}})[_0x1561('0x22')](function(_0x1484eb){_0x5354f5=0x1f4;logger[_0x1561('0x1d')](_0x1484eb[_0x1561('0x30')]);if(_0x1484eb[_0x1561('0x31')]){delete _0x1484eb[_0x1561('0x31')];}_0x65cd36=_0x1484eb;})[_0x1561('0x11a')](function(){if(_0x65cd36===null){_0x2e0575[_0x1561('0x23')](_0x5354f5);}else{if(_0x5354f5===0x1f4){_0x2e0575['status'](_0x5354f5)['send'](_0x65cd36);}else{_0x2e0575[_0x1561('0x24')](_0x5354f5)[_0x1561('0x26')](_0x65cd36);}}});};exports['getApplications']=function(_0x46c063,_0x351a8b){var _0x5a85c8={};var _0x150ea2={};var _0x3af1e9;var _0x32e464;return db[_0x1561('0x69')][_0x1561('0x7a')]({'where':{'id':_0x46c063[_0x1561('0x6c')]['id']}})[_0x1561('0x17')](handleEntityNotFound(_0x351a8b,null))['then'](function(_0x68bd68){if(_0x68bd68){_0x3af1e9=_0x68bd68;_0x150ea2[_0x1561('0x54')]=_[_0x1561('0x5c')](db[_0x1561('0xb1')]['rawAttributes']);_0x150ea2[_0x1561('0x5b')]=_[_0x1561('0x5c')](_0x46c063[_0x1561('0x5b')]);_0x150ea2[_0x1561('0x5d')]=_['intersection'](_0x150ea2['model'],_0x150ea2[_0x1561('0x5b')]);_0x5a85c8[_0x1561('0x60')]=_[_0x1561('0x5e')](_0x150ea2[_0x1561('0x54')],qs[_0x1561('0x5f')](_0x46c063[_0x1561('0x5b')][_0x1561('0x5f')]));_0x5a85c8[_0x1561('0x60')]=_0x5a85c8[_0x1561('0x60')][_0x1561('0x61')]?_0x5a85c8[_0x1561('0x60')]:_0x150ea2[_0x1561('0x54')];_0x5a85c8[_0x1561('0x63')]=qs[_0x1561('0x7b')](_0x46c063['query']['sort']);_0x5a85c8[_0x1561('0x66')]=qs[_0x1561('0x5d')](_['pick'](_0x46c063[_0x1561('0x5b')],_0x150ea2[_0x1561('0x5d')]));if(_0x46c063[_0x1561('0x5b')][_0x1561('0x65')]){_0x5a85c8['where']=_[_0x1561('0x67')](_0x5a85c8['where'],{'$or':_[_0x1561('0x3f')](_0x5a85c8['attributes'],function(_0x91e005){var _0x2048c7={};_0x2048c7[_0x91e005]={'$like':'%'+_0x46c063['query'][_0x1561('0x65')]+'%'};return _0x2048c7;})});}_0x5a85c8=_[_0x1561('0x67')]({},_0x5a85c8,_0x46c063[_0x1561('0x68')]);return _0x3af1e9[_0x1561('0x11b')](_0x5a85c8);}})[_0x1561('0x17')](function(_0x464f34){if(_0x464f34){_0x32e464=_0x464f34[_0x1561('0x61')];if(!_0x46c063['query']['hasOwnProperty']('nolimit')){_0x5a85c8['limit']=qs['limit'](_0x46c063[_0x1561('0x5b')][_0x1561('0x29')]);_0x5a85c8[_0x1561('0x27')]=qs[_0x1561('0x27')](_0x46c063[_0x1561('0x5b')][_0x1561('0x27')]);}return _0x3af1e9[_0x1561('0x11b')](_0x5a85c8);}})[_0x1561('0x17')](function(_0x1846d1){if(_0x1846d1){return _0x1846d1?{'count':_0x32e464,'rows':_0x1846d1}:null;}})[_0x1561('0x17')](respondWithResult(_0x351a8b,null))[_0x1561('0x22')](handleError(_0x351a8b,null));};exports['addProactiveActions']=function(_0x48d72e,_0x3edc49){return db['chatProactiveAction'][_0x1561('0x6f')]({'where':{'id':_0x48d72e['params']['id']}})[_0x1561('0x17')](handleEntityNotFound(_0x3edc49,null))['then'](function(_0x5eaa93){if(_0x5eaa93){return _0x5eaa93[_0x1561('0x11c')](_0x48d72e[_0x1561('0x77')][_0x1561('0x85')],_['omit'](_0x48d72e[_0x1561('0x77')],[_0x1561('0x85'),'id'])||{});}})['then'](respondWithResult(_0x3edc49,null))[_0x1561('0x22')](handleError(_0x3edc49,null));};exports[_0x1561('0x101')]=function(_0x368cda,_0x15d78e){var _0x5d8a7c={};var _0x117297={};var _0x26876d;var _0x156145;return db[_0x1561('0x69')][_0x1561('0x7a')]({'where':{'id':_0x368cda[_0x1561('0x6c')]['id']}})[_0x1561('0x17')](handleEntityNotFound(_0x15d78e,null))[_0x1561('0x17')](function(_0x301e17){if(_0x301e17){_0x26876d=_0x301e17;_0x117297[_0x1561('0x54')]=_[_0x1561('0x5c')](db[_0x1561('0x11d')]['rawAttributes']);_0x117297[_0x1561('0x5b')]=_[_0x1561('0x5c')](_0x368cda[_0x1561('0x5b')]);_0x117297[_0x1561('0x5d')]=_['intersection'](_0x117297[_0x1561('0x54')],_0x117297[_0x1561('0x5b')]);_0x5d8a7c[_0x1561('0x60')]=_[_0x1561('0x5e')](_0x117297[_0x1561('0x54')],qs[_0x1561('0x5f')](_0x368cda[_0x1561('0x5b')][_0x1561('0x5f')]));_0x5d8a7c[_0x1561('0x60')]=_0x5d8a7c[_0x1561('0x60')][_0x1561('0x61')]?_0x5d8a7c[_0x1561('0x60')]:_0x117297[_0x1561('0x54')];_0x5d8a7c[_0x1561('0x63')]=qs[_0x1561('0x7b')](_0x368cda[_0x1561('0x5b')][_0x1561('0x7b')]);_0x5d8a7c[_0x1561('0x66')]=qs['filters'](_['pick'](_0x368cda[_0x1561('0x5b')],_0x117297[_0x1561('0x5d')]));if(_0x368cda['query'][_0x1561('0x65')]){_0x5d8a7c[_0x1561('0x66')]=_[_0x1561('0x67')](_0x5d8a7c[_0x1561('0x66')],{'$or':_[_0x1561('0x3f')](_0x5d8a7c[_0x1561('0x60')],function(_0x5e32bd){var _0x4fd881={};_0x4fd881[_0x5e32bd]={'$like':'%'+_0x368cda[_0x1561('0x5b')][_0x1561('0x65')]+'%'};return _0x4fd881;})});}_0x5d8a7c=_[_0x1561('0x67')]({},_0x5d8a7c,_0x368cda[_0x1561('0x68')]);return _0x26876d['getProactiveActions'](_0x5d8a7c);}})[_0x1561('0x17')](function(_0x2df266){if(_0x2df266){_0x156145=_0x2df266[_0x1561('0x61')];if(!_0x368cda[_0x1561('0x5b')]['hasOwnProperty'](_0x1561('0x83'))){_0x5d8a7c[_0x1561('0x29')]=qs['limit'](_0x368cda[_0x1561('0x5b')][_0x1561('0x29')]);_0x5d8a7c[_0x1561('0x27')]=qs['offset'](_0x368cda[_0x1561('0x5b')][_0x1561('0x27')]);}return _0x26876d['getProactiveActions'](_0x5d8a7c);}})[_0x1561('0x17')](function(_0x179c07){if(_0x179c07){return _0x179c07?{'count':_0x156145,'rows':_0x179c07}:null;}})[_0x1561('0x17')](respondWithResult(_0x15d78e,null))['catch'](handleError(_0x15d78e,null));};exports[_0x1561('0x11e')]=function(_0x4cb41c,_0x13f759){var _0x47c714=_0x4cb41c['query']['online']==='false'?_0x1561('0x11f'):'onlineForm';return db[_0x1561('0x69')][_0x1561('0x6f')]({'attributes':['id',_0x47c714],'where':{'id':_0x4cb41c['params']['id']}})[_0x1561('0x17')](handleEntityNotFound(_0x13f759,null))['then'](function(_0x46b060){if(_0x46b060){var _0x30ebe6=_0x46b060[_0x47c714];var _0x25352d=_0x30ebe6&&_0x30ebe6['items']?_0x30ebe6[_0x1561('0x120')]:[];_0x13f759['send']({'fromKey':_['isNil'](_0x30ebe6[_0x1561('0x121')])?undefined:_0x30ebe6[_0x1561('0x121')],'count':_0x25352d[_0x1561('0x61')],'rows':_0x25352d});}})[_0x1561('0x22')](handleError(_0x13f759,null));};exports['getOfflineMessages']=function(_0x4c079c,_0x18006a){var _0x41d00d={'raw':![],'where':{}};var _0x4b360e={};var _0x4b2b5a={'count':0x0,'rows':[]};return db[_0x1561('0x69')][_0x1561('0x7a')]({'where':{'id':_0x4c079c[_0x1561('0x6c')]['id']}})[_0x1561('0x17')](handleEntityNotFound(_0x18006a,null))['then'](function(_0x4557a1){if(_0x4557a1){_0x4b360e[_0x1561('0x54')]=_[_0x1561('0x5c')](db[_0x1561('0xe0')][_0x1561('0x59')]);_0x4b360e[_0x1561('0x5b')]=_['keys'](_0x4c079c[_0x1561('0x5b')]);_0x4b360e['filters']=_[_0x1561('0x5e')](_0x4b360e[_0x1561('0x54')],_0x4b360e[_0x1561('0x5b')]);_0x41d00d[_0x1561('0x60')]=_[_0x1561('0x5e')](_0x4b360e[_0x1561('0x54')],qs[_0x1561('0x5f')](_0x4c079c[_0x1561('0x5b')]['fields']));_0x41d00d[_0x1561('0x60')]=_0x41d00d[_0x1561('0x60')][_0x1561('0x61')]?_0x41d00d[_0x1561('0x60')]:_0x4b360e[_0x1561('0x54')];if(!_0x4c079c['query']['hasOwnProperty'](_0x1561('0x83'))){_0x41d00d[_0x1561('0x29')]=qs[_0x1561('0x29')](_0x4c079c[_0x1561('0x5b')][_0x1561('0x29')]);_0x41d00d[_0x1561('0x27')]=qs[_0x1561('0x27')](_0x4c079c[_0x1561('0x5b')][_0x1561('0x27')]);}_0x41d00d[_0x1561('0x63')]=qs[_0x1561('0x7b')](_0x4c079c['query'][_0x1561('0x7b')]);_0x41d00d[_0x1561('0x66')]=qs[_0x1561('0x5d')](_[_0x1561('0x64')](_0x4c079c[_0x1561('0x5b')],_0x4b360e[_0x1561('0x5d')]));_0x41d00d['where'][_0x1561('0x7c')]=_0x4557a1['id'];if(_0x4c079c[_0x1561('0x5b')]['filter']){_0x41d00d[_0x1561('0x66')]=_[_0x1561('0x67')](_0x41d00d[_0x1561('0x66')],{'$or':_[_0x1561('0x3f')](_0x41d00d[_0x1561('0x60')],function(_0x18bc69){var _0x5d2a01={};_0x5d2a01[_0x18bc69]={'$like':'%'+_0x4c079c[_0x1561('0x5b')]['filter']+'%'};return _0x5d2a01;})});}_0x41d00d=_[_0x1561('0x67')]({},_0x41d00d,_0x4c079c[_0x1561('0x68')]);return db[_0x1561('0xe0')]['count']({'where':_0x41d00d['where']})[_0x1561('0x17')](function(_0x49977e){_0x4b2b5a['count']=_0x49977e;if(_0x4c079c[_0x1561('0x5b')][_0x1561('0x6a')]){_0x41d00d[_0x1561('0x6e')]=[{'all':!![]}];}else{_0x41d00d[_0x1561('0x6e')]=[{'model':db[_0x1561('0x9e')],'as':_0x1561('0x122'),'required':![]},{'model':db[_0x1561('0xea')],'as':_0x1561('0x123'),'required':![]}];}return db[_0x1561('0xe0')][_0x1561('0x6b')](_0x41d00d);})[_0x1561('0x17')](function(_0x37a62e){_0x4b2b5a[_0x1561('0x7e')]=_0x37a62e;return _0x4b2b5a;});}})[_0x1561('0x17')](respondWithFilteredResult(_0x18006a,_0x41d00d))[_0x1561('0x22')](handleError(_0x18006a,null));};exports[_0x1561('0x124')]=function(_0x415f38,_0x30557b){return db[_0x1561('0x69')][_0x1561('0x6f')]({'where':{'id':_0x415f38[_0x1561('0x6c')]['id']}})[_0x1561('0x17')](handleEntityNotFound(_0x30557b,null))[_0x1561('0x17')](function(_0x183858){if(_0x183858){return _0x183858[_0x1561('0x124')](_0x415f38[_0x1561('0x77')][_0x1561('0x85')],_[_0x1561('0x125')](_0x415f38[_0x1561('0x77')],[_0x1561('0x85'),'id'])||{})['spread'](function(_0x3f2aa6){for(var _0x4fb287=0x0;_0x4fb287<_0x415f38[_0x1561('0x77')]['ids'][_0x1561('0x61')];_0x4fb287+=0x1){socket['emit'](_0x1561('0x126'),{'UserId':Number(_0x415f38['body'][_0x1561('0x85')][_0x4fb287]),'ChatWebsiteId':Number(_0x415f38[_0x1561('0x6c')]['id'])});}return _0x3f2aa6;});}})[_0x1561('0x17')](respondWithResult(_0x30557b,null))[_0x1561('0x22')](handleError(_0x30557b,null));};exports[_0x1561('0x127')]=function(_0x446e53,_0x1f9e3e){return db[_0x1561('0x69')][_0x1561('0x6f')]({'where':{'id':_0x446e53[_0x1561('0x6c')]['id']}})['then'](handleEntityNotFound(_0x1f9e3e,null))[_0x1561('0x17')](function(_0xae2f9c){if(_0xae2f9c){return _0xae2f9c[_0x1561('0x127')](_0x446e53[_0x1561('0x5b')][_0x1561('0x85')])[_0x1561('0x17')](function(){if(_['isArray'](_0x446e53[_0x1561('0x5b')][_0x1561('0x85')])){for(var _0x1665dc=0x0;_0x1665dc<_0x446e53[_0x1561('0x5b')]['ids']['length'];_0x1665dc+=0x1){socket[_0x1561('0x128')](_0x1561('0x129'),{'UserId':Number(_0x446e53[_0x1561('0x5b')]['ids'][_0x1665dc]),'ChatWebsiteId':Number(_0x446e53['params']['id'])});}}else{socket[_0x1561('0x128')](_0x1561('0x129'),{'UserId':Number(_0x446e53[_0x1561('0x5b')][_0x1561('0x85')]),'ChatWebsiteId':Number(_0x446e53[_0x1561('0x6c')]['id'])});}});}})[_0x1561('0x17')](respondWithStatusCode(_0x1f9e3e,null))[_0x1561('0x22')](handleError(_0x1f9e3e,null));};exports[_0x1561('0x12a')]=function(_0x21d007,_0x3f62b0){var _0x17d13b={};var _0x194cb4={};var _0x2070a6;var _0x2f95ef;return db[_0x1561('0x69')]['findOne']({'where':{'id':_0x21d007[_0x1561('0x6c')]['id']}})['then'](handleEntityNotFound(_0x3f62b0,null))[_0x1561('0x17')](function(_0x262f76){if(_0x262f76){_0x2070a6=_0x262f76;_0x194cb4[_0x1561('0x54')]=_['keys'](db['User'][_0x1561('0x59')]);_0x194cb4['query']=_['keys'](_0x21d007[_0x1561('0x5b')]);_0x194cb4[_0x1561('0x5d')]=_[_0x1561('0x5e')](_0x194cb4[_0x1561('0x54')],_0x194cb4[_0x1561('0x5b')]);_0x17d13b['attributes']=_[_0x1561('0x5e')](_0x194cb4[_0x1561('0x54')],qs[_0x1561('0x5f')](_0x21d007['query'][_0x1561('0x5f')]));_0x17d13b[_0x1561('0x60')]=_0x17d13b[_0x1561('0x60')]['length']?_0x17d13b[_0x1561('0x60')]:_0x194cb4['model'];_0x17d13b[_0x1561('0x63')]=qs['sort'](_0x21d007[_0x1561('0x5b')]['sort']);_0x17d13b[_0x1561('0x66')]=qs[_0x1561('0x5d')](_['pick'](_0x21d007[_0x1561('0x5b')],_0x194cb4[_0x1561('0x5d')]));if(_0x21d007[_0x1561('0x5b')]['filter']){_0x17d13b[_0x1561('0x66')]=_[_0x1561('0x67')](_0x17d13b[_0x1561('0x66')],{'$or':_['map'](_0x17d13b[_0x1561('0x60')],function(_0x12eea0){var _0x2265cf={};_0x2265cf[_0x12eea0]={'$like':'%'+_0x21d007[_0x1561('0x5b')][_0x1561('0x65')]+'%'};return _0x2265cf;})});}_0x17d13b=_['merge']({},_0x17d13b,_0x21d007['options']);return _0x2070a6[_0x1561('0x12a')](_0x17d13b);}})[_0x1561('0x17')](function(_0xefddf8){if(_0xefddf8){_0x2f95ef=_0xefddf8[_0x1561('0x61')];if(!_0x21d007[_0x1561('0x5b')]['hasOwnProperty'](_0x1561('0x83'))){_0x17d13b[_0x1561('0x29')]=qs[_0x1561('0x29')](_0x21d007['query'][_0x1561('0x29')]);_0x17d13b[_0x1561('0x27')]=qs[_0x1561('0x27')](_0x21d007['query'][_0x1561('0x27')]);}return _0x2070a6[_0x1561('0x12a')](_0x17d13b);}})[_0x1561('0x17')](function(_0x2a3f85){if(_0x2a3f85){return _0x2a3f85?{'count':_0x2f95ef,'rows':_0x2a3f85}:null;}})[_0x1561('0x17')](respondWithResult(_0x3f62b0,null))[_0x1561('0x22')](handleError(_0x3f62b0,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index f5475eb..5a0c09d 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 _0xb7a8=['hook','exports','../../mysqldb','ChatWebsite','save','update','remove','emit','hasOwnProperty'];(function(_0x2eee25,_0x53460d){var _0x1cb8c4=function(_0x4dad56){while(--_0x4dad56){_0x2eee25['push'](_0x2eee25['shift']());}};_0x1cb8c4(++_0x53460d);}(_0xb7a8,0xec));var _0x8b7a=function(_0x3c5752,_0x4df06b){_0x3c5752=_0x3c5752-0x0;var _0x1a98c7=_0xb7a8[_0x3c5752];return _0x1a98c7;};'use strict';var EventEmitter=require('events');var ChatWebsite=require(_0x8b7a('0x0'))['db'][_0x8b7a('0x1')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x8b7a('0x2'),'afterUpdate':_0x8b7a('0x3'),'afterDestroy':_0x8b7a('0x4')};function emitEvent(_0x5b033a){return function(_0x3847b8,_0x2c7217,_0x1185b9){ChatWebsiteEvents[_0x8b7a('0x5')](_0x5b033a+':'+_0x3847b8['id'],_0x3847b8);ChatWebsiteEvents[_0x8b7a('0x5')](_0x5b033a,_0x3847b8);_0x1185b9(null);};}for(var e in events){if(events[_0x8b7a('0x6')](e)){var event=events[e];ChatWebsite[_0x8b7a('0x7')](e,emitEvent(event));}}module[_0x8b7a('0x8')]=ChatWebsiteEvents; \ No newline at end of file +var _0x979e=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatWebsite','setMaxListeners','update'];(function(_0x2ed85c,_0x388634){var _0x4d37e1=function(_0x66e27d){while(--_0x66e27d){_0x2ed85c['push'](_0x2ed85c['shift']());}};_0x4d37e1(++_0x388634);}(_0x979e,0x195));var _0xe979=function(_0x553881,_0x44aecc){_0x553881=_0x553881-0x0;var _0x3378fc=_0x979e[_0x553881];return _0x3378fc;};'use strict';var EventEmitter=require(_0xe979('0x0'));var ChatWebsite=require(_0xe979('0x1'))['db'][_0xe979('0x2')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0xe979('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xe979('0x4'),'afterDestroy':_0xe979('0x5')};function emitEvent(_0x386036){return function(_0x3b4b06,_0x2d62dd,_0x5afb7f){ChatWebsiteEvents[_0xe979('0x6')](_0x386036+':'+_0x3b4b06['id'],_0x3b4b06);ChatWebsiteEvents['emit'](_0x386036,_0x3b4b06);_0x5afb7f(null);};}for(var e in events){if(events[_0xe979('0x7')](e)){var event=events[e];ChatWebsite[_0xe979('0x8')](e,emitEvent(event));}}module[_0xe979('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 cba2de3..053beba 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 _0x9c74=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','chat_websites','lodash'];(function(_0x1377da,_0x116f21){var _0x4acefe=function(_0x3bb55e){while(--_0x3bb55e){_0x1377da['push'](_0x1377da['shift']());}};_0x4acefe(++_0x116f21);}(_0x9c74,0x167));var _0x49c7=function(_0x368563,_0x1720cb){_0x368563=_0x368563-0x0;var _0x50a723=_0x9c74[_0x368563];return _0x50a723;};'use strict';var _=require(_0x49c7('0x0'));var util=require(_0x49c7('0x1'));var logger=require(_0x49c7('0x2'))(_0x49c7('0x3'));var moment=require(_0x49c7('0x4'));var BPromise=require(_0x49c7('0x5'));var rp=require(_0x49c7('0x6'));var fs=require('fs');var path=require(_0x49c7('0x7'));var rimraf=require(_0x49c7('0x8'));var config=require(_0x49c7('0x9'));var attributes=require('./chatWebsite.attributes');module[_0x49c7('0xa')]=function(_0x490f2e,_0xed0bb0){return _0x490f2e['define']('ChatWebsite',attributes,{'tableName':_0x49c7('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6f9d=['moment','path','rimraf','../../config/environment','./chatWebsite.attributes','exports','define','ChatWebsite','chat_websites','lodash','util'];(function(_0x20e8bd,_0x353719){var _0x1db780=function(_0x179db8){while(--_0x179db8){_0x20e8bd['push'](_0x20e8bd['shift']());}};_0x1db780(++_0x353719);}(_0x6f9d,0x98));var _0xd6f9=function(_0x59f691,_0x1b656d){_0x59f691=_0x59f691-0x0;var _0x1f80bb=_0x6f9d[_0x59f691];return _0x1f80bb;};'use strict';var _=require(_0xd6f9('0x0'));var util=require(_0xd6f9('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xd6f9('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xd6f9('0x3'));var rimraf=require(_0xd6f9('0x4'));var config=require(_0xd6f9('0x5'));var attributes=require(_0xd6f9('0x6'));module[_0xd6f9('0x7')]=function(_0xe27204,_0x148444){return _0xe27204[_0xd6f9('0x8')](_0xd6f9('0x9'),attributes,{'tableName':_0xd6f9('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.rpc.js b/server/api/chatWebsite/chatWebsite.rpc.js index 40a54d8..71727e9 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 _0x1e1f=['result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','socket.io-emitter','register','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','stringify','code','error','message'];(function(_0xfbca3,_0xfba1fd){var _0x2c3fa1=function(_0x47d5bd){while(--_0x47d5bd){_0xfbca3['push'](_0xfbca3['shift']());}};_0x2c3fa1(++_0xfba1fd);}(_0x1e1f,0x1c4));var _0xf1e1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1e1f[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xf1e1('0x0'));var util=require('util');var moment=require(_0xf1e1('0x1'));var BPromise=require('bluebird');var rs=require(_0xf1e1('0x2'));var fs=require('fs');var Redis=require(_0xf1e1('0x3'));var db=require(_0xf1e1('0x4'))['db'];var utils=require(_0xf1e1('0x5'));var logger=require(_0xf1e1('0x6'))(_0xf1e1('0x7'));var config=require(_0xf1e1('0x8'));var jayson=require(_0xf1e1('0x9'));var client=jayson['client'][_0xf1e1('0xa')]({'port':0x232a});config[_0xf1e1('0xb')]=_[_0xf1e1('0xc')](config[_0xf1e1('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xf1e1('0xd'))(new Redis(config['redis']));require('./chatWebsite.socket')[_0xf1e1('0xe')](socket);function respondWithRpcPromise(_0x1a54e6,_0x2cdccf,_0x2f7c3d){return new BPromise(function(_0xa30826,_0x208cd2){return client['request'](_0x1a54e6,_0x2f7c3d)[_0xf1e1('0xf')](function(_0x5544be){logger[_0xf1e1('0x10')](_0xf1e1('0x11'),_0x2cdccf,'request\x20sent');logger['debug']('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x2cdccf,_0xf1e1('0x12'),JSON[_0xf1e1('0x13')](_0x5544be));if(_0x5544be['error']){if(_0x5544be['error'][_0xf1e1('0x14')]===0x1f4){logger[_0xf1e1('0x15')](_0xf1e1('0x11'),_0x2cdccf,_0x5544be[_0xf1e1('0x15')][_0xf1e1('0x16')]);return _0x208cd2(_0x5544be[_0xf1e1('0x15')][_0xf1e1('0x16')]);}logger[_0xf1e1('0x15')](_0xf1e1('0x11'),_0x2cdccf,_0x5544be[_0xf1e1('0x15')]['message']);return _0xa30826(_0x5544be[_0xf1e1('0x15')][_0xf1e1('0x16')]);}else{logger[_0xf1e1('0x10')]('ChatWebsite,\x20%s,\x20%s',_0x2cdccf,_0xf1e1('0x12'));_0xa30826(_0x5544be[_0xf1e1('0x17')][_0xf1e1('0x16')]);}})[_0xf1e1('0x18')](function(_0x46bdad){logger[_0xf1e1('0x15')](_0xf1e1('0x11'),_0x2cdccf,_0x46bdad);_0x208cd2(_0x46bdad);});});} \ No newline at end of file +var _0x15f1=['redis','defaults','localhost','socket.io-emitter','register','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','http'];(function(_0x538e20,_0x374aed){var _0x2d969e=function(_0x282d4c){while(--_0x282d4c){_0x538e20['push'](_0x538e20['shift']());}};_0x2d969e(++_0x374aed);}(_0x15f1,0x9e));var _0x115f=function(_0x2837ae,_0x2c47ca){_0x2837ae=_0x2837ae-0x0;var _0xf8f847=_0x15f1[_0x2837ae];return _0xf8f847;};'use strict';var _=require(_0x115f('0x0'));var util=require(_0x115f('0x1'));var moment=require(_0x115f('0x2'));var BPromise=require(_0x115f('0x3'));var rs=require(_0x115f('0x4'));var fs=require('fs');var Redis=require(_0x115f('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x115f('0x6'))(_0x115f('0x7'));var config=require(_0x115f('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x115f('0x9')]({'port':0x232a});config[_0x115f('0xa')]=_[_0x115f('0xb')](config[_0x115f('0xa')],{'host':_0x115f('0xc'),'port':0x18eb});var socket=require(_0x115f('0xd'))(new Redis(config[_0x115f('0xa')]));require('./chatWebsite.socket')[_0x115f('0xe')](socket);function respondWithRpcPromise(_0x4affb9,_0x1c9bf8,_0x37c19a){return new BPromise(function(_0x4f7860,_0xd1c42b){return client['request'](_0x4affb9,_0x37c19a)['then'](function(_0x4f64d5){logger[_0x115f('0xf')](_0x115f('0x10'),_0x1c9bf8,_0x115f('0x11'));logger[_0x115f('0x12')](_0x115f('0x13'),_0x1c9bf8,_0x115f('0x11'),JSON[_0x115f('0x14')](_0x4f64d5));if(_0x4f64d5[_0x115f('0x15')]){if(_0x4f64d5[_0x115f('0x15')][_0x115f('0x16')]===0x1f4){logger['error'](_0x115f('0x10'),_0x1c9bf8,_0x4f64d5[_0x115f('0x15')][_0x115f('0x17')]);return _0xd1c42b(_0x4f64d5['error'][_0x115f('0x17')]);}logger[_0x115f('0x15')](_0x115f('0x10'),_0x1c9bf8,_0x4f64d5['error'][_0x115f('0x17')]);return _0x4f7860(_0x4f64d5[_0x115f('0x15')]['message']);}else{logger[_0x115f('0xf')]('ChatWebsite,\x20%s,\x20%s',_0x1c9bf8,'request\x20sent');_0x4f7860(_0x4f64d5['result'][_0x115f('0x17')]);}})['catch'](function(_0x37768b){logger[_0x115f('0x15')](_0x115f('0x10'),_0x1c9bf8,_0x37768b);_0xd1c42b(_0x37768b);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index 0fd9d03..da4ba4e 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 _0x2e0f=['removeListener','register','length','chatWebsite:','./chatWebsite.events','save','remove','update'];(function(_0xc35608,_0x6f0a34){var _0x4be993=function(_0x424f6c){while(--_0x424f6c){_0xc35608['push'](_0xc35608['shift']());}};_0x4be993(++_0x6f0a34);}(_0x2e0f,0x17c));var _0xf2e0=function(_0x4b32d1,_0xd8ac22){_0x4b32d1=_0x4b32d1-0x0;var _0xcd942d=_0x2e0f[_0x4b32d1];return _0xcd942d;};'use strict';var ChatWebsiteEvents=require(_0xf2e0('0x0'));var events=[_0xf2e0('0x1'),_0xf2e0('0x2'),_0xf2e0('0x3')];function createListener(_0x41ea3b,_0x41af33){return function(_0x4df069){_0x41af33['emit'](_0x41ea3b,_0x4df069);};}function removeListener(_0x25eeeb,_0x493d2c){return function(){ChatWebsiteEvents[_0xf2e0('0x4')](_0x25eeeb,_0x493d2c);};}exports[_0xf2e0('0x5')]=function(_0x24a61b){for(var _0x495fa3=0x0,_0xf40ad9=events[_0xf2e0('0x6')];_0x495fa3<_0xf40ad9;_0x495fa3++){var _0xaa48fc=events[_0x495fa3];var _0x949231=createListener(_0xf2e0('0x7')+_0xaa48fc,_0x24a61b);ChatWebsiteEvents['on'](_0xaa48fc,_0x949231);}}; \ No newline at end of file +var _0x99cb=['remove','update','emit','removeListener','register','chatWebsite:','save'];(function(_0x4f8e6c,_0x66370f){var _0x1f6937=function(_0x27cb53){while(--_0x27cb53){_0x4f8e6c['push'](_0x4f8e6c['shift']());}};_0x1f6937(++_0x66370f);}(_0x99cb,0xd8));var _0xb99c=function(_0x339b9e,_0x5d0bbc){_0x339b9e=_0x339b9e-0x0;var _0x2a669e=_0x99cb[_0x339b9e];return _0x2a669e;};'use strict';var ChatWebsiteEvents=require('./chatWebsite.events');var events=[_0xb99c('0x0'),_0xb99c('0x1'),_0xb99c('0x2')];function createListener(_0x45ee85,_0xe4b0bd){return function(_0x715376){_0xe4b0bd[_0xb99c('0x3')](_0x45ee85,_0x715376);};}function removeListener(_0x2a1f60,_0x406455){return function(){ChatWebsiteEvents[_0xb99c('0x4')](_0x2a1f60,_0x406455);};}exports[_0xb99c('0x5')]=function(_0x4b9790){for(var _0x1226d5=0x0,_0x189c0a=events['length'];_0x1226d5<_0x189c0a;_0x1226d5++){var _0x6783a7=events[_0x1226d5];var _0xa94de=createListener(_0xb99c('0x6')+_0x6783a7,_0x4b9790);ChatWebsiteEvents['on'](_0x6783a7,_0xa94de);}}; \ No newline at end of file diff --git a/server/api/chatWebsite/index.js b/server/api/chatWebsite/index.js index c57da56..d40e2d5 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 _0x008f=['/:id/avatar','getAvatar','/:id/customer_avatar','getCustomerAvatar','/:id/system_avatar','getSystemAvatar','getInteractions','/:id/snippet','getApplications','/:id/proactive_actions','getFields','/:id/offline_messages','getOfflineMessages','/:id/users','getAgents','post','create','addAnswer','diskStorage','join','root','server/files/images/logos/','format','now','originalname','file','server/files/images/avatars/','single','addAvatar','addCustomerAvatar','%s-%s','addSystemAvatar','/:id/notify','notify','server/files','attachments','offline-chat','ensureDir','replace','/:id/offline','addInteraction','/:id/applications','addApplications','addProactiveActions','addAgents','put','update','delete','destroy','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatWebsite.controller','isAuthenticated','index','get','/describe','describe','/:id','/:id/dispositions','getDispositions','/:id/canned_answers','/:id/logo'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x008f,0x10c));var _0xf008=function(_0x3b04ce,_0x1030f8){_0x3b04ce=_0x3b04ce-0x0;var _0x4fe066=_0x008f[_0x3b04ce];return _0x4fe066;};'use strict';var multer=require(_0xf008('0x0'));var util=require(_0xf008('0x1'));var path=require(_0xf008('0x2'));var timeout=require(_0xf008('0x3'));var express=require('express');var router=express[_0xf008('0x4')]();var fs_extra=require(_0xf008('0x5'));var auth=require(_0xf008('0x6'));var interaction=require(_0xf008('0x7'));var config=require(_0xf008('0x8'));var controller=require(_0xf008('0x9'));router['get']('/',auth[_0xf008('0xa')](),controller[_0xf008('0xb')]);router[_0xf008('0xc')](_0xf008('0xd'),auth['isAuthenticated'](),controller[_0xf008('0xe')]);router[_0xf008('0xc')](_0xf008('0xf'),auth[_0xf008('0xa')](),controller['show']);router[_0xf008('0xc')](_0xf008('0x10'),auth[_0xf008('0xa')](),controller[_0xf008('0x11')]);router[_0xf008('0xc')](_0xf008('0x12'),auth[_0xf008('0xa')](),controller['getAnswers']);router[_0xf008('0xc')](_0xf008('0x13'),controller['getLogo']);router['get'](_0xf008('0x14'),controller[_0xf008('0x15')]);router['get'](_0xf008('0x16'),controller[_0xf008('0x17')]);router['get'](_0xf008('0x18'),controller[_0xf008('0x19')]);router[_0xf008('0xc')]('/:id/interactions',auth[_0xf008('0xa')](),controller[_0xf008('0x1a')]);router[_0xf008('0xc')](_0xf008('0x1b'),controller['getSnippet']);router['get']('/:id/applications',auth[_0xf008('0xa')](),controller[_0xf008('0x1c')]);router[_0xf008('0xc')](_0xf008('0x1d'),auth[_0xf008('0xa')](),controller['getProactiveActions']);router[_0xf008('0xc')]('/:id/fields',controller[_0xf008('0x1e')]);router[_0xf008('0xc')](_0xf008('0x1f'),auth[_0xf008('0xa')](),controller[_0xf008('0x20')]);router[_0xf008('0xc')](_0xf008('0x21'),auth[_0xf008('0xa')](),controller[_0xf008('0x22')]);router[_0xf008('0x23')]('/',auth[_0xf008('0xa')](),controller[_0xf008('0x24')]);router[_0xf008('0x23')](_0xf008('0x10'),auth[_0xf008('0xa')](),controller['addDisposition']);router[_0xf008('0x23')](_0xf008('0x12'),auth[_0xf008('0xa')](),controller[_0xf008('0x25')]);var upload=multer({'storage':multer[_0xf008('0x26')]({'destination':function(_0x319f05,_0x42033a,_0xb03eaf){_0xb03eaf(null,path[_0xf008('0x27')](config[_0xf008('0x28')],_0xf008('0x29')));},'filename':function(_0x19919b,_0x316b01,_0x439bd0){_0x439bd0(null,util[_0xf008('0x2a')]('%s-%s',Date[_0xf008('0x2b')](),_0x316b01[_0xf008('0x2c')]));}})});router[_0xf008('0x23')](_0xf008('0x13'),upload['single'](_0xf008('0x2d')),controller['addLogo']);var upload=multer({'storage':multer[_0xf008('0x26')]({'destination':function(_0x60abc4,_0x43c193,_0x1bcfee){_0x1bcfee(null,path[_0xf008('0x27')](config['root'],_0xf008('0x2e')));},'filename':function(_0x591848,_0x11d849,_0x4cf232){_0x4cf232(null,util[_0xf008('0x2a')]('%s-%s',Date[_0xf008('0x2b')](),_0x11d849[_0xf008('0x2c')]));}})});router[_0xf008('0x23')](_0xf008('0x14'),upload[_0xf008('0x2f')](_0xf008('0x2d')),controller[_0xf008('0x30')]);var upload=multer({'storage':multer[_0xf008('0x26')]({'destination':function(_0x463d69,_0x2ad02f,_0xf3f325){_0xf3f325(null,path[_0xf008('0x27')](config[_0xf008('0x28')],_0xf008('0x2e')));},'filename':function(_0x29efc4,_0x115806,_0xb007f3){_0xb007f3(null,util[_0xf008('0x2a')]('%s-%s',Date[_0xf008('0x2b')](),_0x115806[_0xf008('0x2c')]));}})});router[_0xf008('0x23')](_0xf008('0x16'),upload[_0xf008('0x2f')](_0xf008('0x2d')),controller[_0xf008('0x31')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0xd509d5,_0x4394ea,_0x3f5884){_0x3f5884(null,path['join'](config[_0xf008('0x28')],_0xf008('0x2e')));},'filename':function(_0x52bbdd,_0x1ac458,_0x243d9d){_0x243d9d(null,util['format'](_0xf008('0x32'),Date['now'](),_0x1ac458[_0xf008('0x2c')]));}})});router[_0xf008('0x23')](_0xf008('0x18'),upload['single']('file'),controller[_0xf008('0x33')]);router[_0xf008('0x23')](_0xf008('0x34'),controller[_0xf008('0x35')]);const offlineUploadMulter=multer({'storage':multer[_0xf008('0x26')]({'destination':function(_0x340f9a,_0x10738a,_0x18be09){const _0x5e16ea=path[_0xf008('0x27')](config['root'],_0xf008('0x36'),_0xf008('0x37'),_0xf008('0x38'));fs_extra[_0xf008('0x39')](_0x5e16ea,function(){_0x18be09(null,_0x5e16ea);});},'filename':function(_0x4848ca,_0x531720,_0x7e7443){const _0x4f7e14=_0x531720[_0xf008('0x2c')][_0xf008('0x3a')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x1410ee=path['extname'](_0x4f7e14);const _0x49dc2b=Date['now']()+'-'+_0x4f7e14[_0xf008('0x3a')](_0x1410ee,'')+_0x1410ee;_0x7e7443(null,_0x49dc2b);}})});router[_0xf008('0x23')](_0xf008('0x3b'),offlineUploadMulter['any'](),controller['offline']);router['post']('/:id/interactions',auth[_0xf008('0xa')](),controller[_0xf008('0x3c')]);router['post'](_0xf008('0x3d'),auth['isAuthenticated'](),controller[_0xf008('0x3e')]);router[_0xf008('0x23')](_0xf008('0x1d'),auth[_0xf008('0xa')](),controller[_0xf008('0x3f')]);router[_0xf008('0x23')](_0xf008('0x21'),auth[_0xf008('0xa')](),controller[_0xf008('0x40')]);router[_0xf008('0x41')](_0xf008('0xf'),auth[_0xf008('0xa')](),controller[_0xf008('0x42')]);router[_0xf008('0x43')](_0xf008('0xf'),auth[_0xf008('0xa')](),controller[_0xf008('0x44')]);router[_0xf008('0x43')]('/:id/dispositions',auth['isAuthenticated'](),controller['removeDispositions']);router[_0xf008('0x43')](_0xf008('0x12'),auth[_0xf008('0xa')](),controller[_0xf008('0x45')]);router[_0xf008('0x43')](_0xf008('0x21'),auth[_0xf008('0xa')](),controller[_0xf008('0x46')]);module[_0xf008('0x47')]=router; \ No newline at end of file +var _0x505e=['show','/:id/dispositions','getDispositions','/:id/canned_answers','getLogo','/:id/avatar','getAvatar','/:id/customer_avatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','getInteractions','/:id/snippet','getApplications','/:id/proactive_actions','getProactiveActions','/:id/fields','getFields','getOfflineMessages','getAgents','post','create','addDisposition','addAnswer','diskStorage','join','server/files/images/logos/','format','now','single','file','addLogo','root','server/files/images/avatars/','%s-%s','originalname','addAvatar','addCustomerAvatar','notify','attachments','offline-chat','ensureDir','replace','extname','/:id/offline','addInteraction','addApplications','update','delete','destroy','removeDispositions','removeAgents','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatWebsite.controller','get','isAuthenticated','index','/:id'];(function(_0x5edd83,_0x53c99d){var _0x203431=function(_0xb11787){while(--_0xb11787){_0x5edd83['push'](_0x5edd83['shift']());}};_0x203431(++_0x53c99d);}(_0x505e,0x77));var _0xe505=function(_0x3cc9d9,_0x69ed38){_0x3cc9d9=_0x3cc9d9-0x0;var _0x1a425d=_0x505e[_0x3cc9d9];return _0x1a425d;};'use strict';var multer=require(_0xe505('0x0'));var util=require(_0xe505('0x1'));var path=require('path');var timeout=require(_0xe505('0x2'));var express=require(_0xe505('0x3'));var router=express['Router']();var fs_extra=require(_0xe505('0x4'));var auth=require(_0xe505('0x5'));var interaction=require(_0xe505('0x6'));var config=require(_0xe505('0x7'));var controller=require(_0xe505('0x8'));router[_0xe505('0x9')]('/',auth[_0xe505('0xa')](),controller[_0xe505('0xb')]);router['get']('/describe',auth[_0xe505('0xa')](),controller['describe']);router['get'](_0xe505('0xc'),auth[_0xe505('0xa')](),controller[_0xe505('0xd')]);router[_0xe505('0x9')](_0xe505('0xe'),auth['isAuthenticated'](),controller[_0xe505('0xf')]);router[_0xe505('0x9')](_0xe505('0x10'),auth[_0xe505('0xa')](),controller['getAnswers']);router[_0xe505('0x9')]('/:id/logo',controller[_0xe505('0x11')]);router[_0xe505('0x9')](_0xe505('0x12'),controller[_0xe505('0x13')]);router[_0xe505('0x9')](_0xe505('0x14'),controller['getCustomerAvatar']);router[_0xe505('0x9')](_0xe505('0x15'),controller[_0xe505('0x16')]);router[_0xe505('0x9')](_0xe505('0x17'),auth[_0xe505('0xa')](),controller[_0xe505('0x18')]);router['get'](_0xe505('0x19'),controller['getSnippet']);router[_0xe505('0x9')]('/:id/applications',auth['isAuthenticated'](),controller[_0xe505('0x1a')]);router['get'](_0xe505('0x1b'),auth[_0xe505('0xa')](),controller[_0xe505('0x1c')]);router[_0xe505('0x9')](_0xe505('0x1d'),controller[_0xe505('0x1e')]);router[_0xe505('0x9')]('/:id/offline_messages',auth[_0xe505('0xa')](),controller[_0xe505('0x1f')]);router['get']('/:id/users',auth['isAuthenticated'](),controller[_0xe505('0x20')]);router[_0xe505('0x21')]('/',auth['isAuthenticated'](),controller[_0xe505('0x22')]);router['post'](_0xe505('0xe'),auth[_0xe505('0xa')](),controller[_0xe505('0x23')]);router[_0xe505('0x21')](_0xe505('0x10'),auth[_0xe505('0xa')](),controller[_0xe505('0x24')]);var upload=multer({'storage':multer[_0xe505('0x25')]({'destination':function(_0x5b0a69,_0x9a618f,_0x2559bb){_0x2559bb(null,path[_0xe505('0x26')](config['root'],_0xe505('0x27')));},'filename':function(_0x54befc,_0xa96285,_0x21df52){_0x21df52(null,util[_0xe505('0x28')]('%s-%s',Date[_0xe505('0x29')](),_0xa96285['originalname']));}})});router[_0xe505('0x21')]('/:id/logo',upload[_0xe505('0x2a')](_0xe505('0x2b')),controller[_0xe505('0x2c')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x117a4f,_0x569f2d,_0xb34df3){_0xb34df3(null,path[_0xe505('0x26')](config[_0xe505('0x2d')],_0xe505('0x2e')));},'filename':function(_0x156b6f,_0x2667e0,_0x2d7d2a){_0x2d7d2a(null,util[_0xe505('0x28')](_0xe505('0x2f'),Date[_0xe505('0x29')](),_0x2667e0[_0xe505('0x30')]));}})});router[_0xe505('0x21')](_0xe505('0x12'),upload['single'](_0xe505('0x2b')),controller[_0xe505('0x31')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x49b512,_0x5b7dc5,_0x22413b){_0x22413b(null,path['join'](config['root'],_0xe505('0x2e')));},'filename':function(_0x3e6c3f,_0x296296,_0x1830b8){_0x1830b8(null,util['format'](_0xe505('0x2f'),Date[_0xe505('0x29')](),_0x296296[_0xe505('0x30')]));}})});router[_0xe505('0x21')](_0xe505('0x14'),upload[_0xe505('0x2a')](_0xe505('0x2b')),controller[_0xe505('0x32')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x536e27,_0x1fd5d4,_0x3acf47){_0x3acf47(null,path[_0xe505('0x26')](config['root'],_0xe505('0x2e')));},'filename':function(_0x58e57e,_0x104300,_0x1eb522){_0x1eb522(null,util[_0xe505('0x28')](_0xe505('0x2f'),Date[_0xe505('0x29')](),_0x104300[_0xe505('0x30')]));}})});router['post'](_0xe505('0x15'),upload[_0xe505('0x2a')]('file'),controller['addSystemAvatar']);router[_0xe505('0x21')]('/:id/notify',controller[_0xe505('0x33')]);const offlineUploadMulter=multer({'storage':multer[_0xe505('0x25')]({'destination':function(_0x232abf,_0x3f2c21,_0x3e595e){const _0x35590b=path[_0xe505('0x26')](config[_0xe505('0x2d')],'server/files',_0xe505('0x34'),_0xe505('0x35'));fs_extra[_0xe505('0x36')](_0x35590b,function(){_0x3e595e(null,_0x35590b);});},'filename':function(_0x5581b7,_0x1e5119,_0x12e771){const _0x4e8e03=_0x1e5119[_0xe505('0x30')][_0xe505('0x37')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x39e49b=path[_0xe505('0x38')](_0x4e8e03);const _0x4a1080=Date['now']()+'-'+_0x4e8e03[_0xe505('0x37')](_0x39e49b,'')+_0x39e49b;_0x12e771(null,_0x4a1080);}})});router['post'](_0xe505('0x39'),offlineUploadMulter['any'](),controller['offline']);router[_0xe505('0x21')](_0xe505('0x17'),auth['isAuthenticated'](),controller[_0xe505('0x3a')]);router['post']('/:id/applications',auth[_0xe505('0xa')](),controller[_0xe505('0x3b')]);router[_0xe505('0x21')](_0xe505('0x1b'),auth['isAuthenticated'](),controller['addProactiveActions']);router[_0xe505('0x21')]('/:id/users',auth[_0xe505('0xa')](),controller['addAgents']);router['put'](_0xe505('0xc'),auth[_0xe505('0xa')](),controller[_0xe505('0x3c')]);router[_0xe505('0x3d')](_0xe505('0xc'),auth[_0xe505('0xa')](),controller[_0xe505('0x3e')]);router['delete'](_0xe505('0xe'),auth['isAuthenticated'](),controller[_0xe505('0x3f')]);router[_0xe505('0x3d')](_0xe505('0x10'),auth[_0xe505('0xa')](),controller['removeAnswers']);router['delete']('/:id/users',auth[_0xe505('0xa')](),controller[_0xe505('0x40')]);module[_0xe505('0x41')]=router; \ No newline at end of file diff --git a/server/api/client-side-logs.js b/server/api/client-side-logs.js index 75bfe4b..0ded495 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 _0x6d8a=['exports','beaver-logger/server','../components/auth/service','env','production','app','get','client-side-logger','expressEndpoint','use'];(function(_0x523adf,_0x3e1620){var _0x283870=function(_0xa0e816){while(--_0xa0e816){_0x523adf['push'](_0x523adf['shift']());}};_0x283870(++_0x3e1620);}(_0x6d8a,0x1a5));var _0xa6d8=function(_0x1196bd,_0xba4aea){_0x1196bd=_0x1196bd-0x0;var _0x26014f=_0x6d8a[_0x1196bd];return _0x26014f;};var beaverLogger=require(_0xa6d8('0x0'));var express=require('express');var auth=require(_0xa6d8('0x1'));var config=require('../config/environment');var router=express['Router']();var isProduction=config[_0xa6d8('0x2')]===_0xa6d8('0x3')||![];function clientSideLogs(_0x53f40,_0x202397,_0x5f19be){var _0x545d72=_0x53f40[_0xa6d8('0x4')][_0xa6d8('0x5')](_0xa6d8('0x6'));if(!_0x545d72){throw new Error('Client-Side\x20logger\x20not\x20found!');}return beaverLogger[_0xa6d8('0x7')]({'uri':'/client-logs','logger':_0x545d72,'enableCors':!isProduction})(_0x53f40,_0x202397,_0x5f19be);}router[_0xa6d8('0x8')](auth['isAuthenticated'](),clientSideLogs);module[_0xa6d8('0x9')]=router; \ No newline at end of file +var _0x0ea4=['Client-Side\x20logger\x20not\x20found!','expressEndpoint','use','isAuthenticated','exports','beaver-logger/server','env','app','get','client-side-logger'];(function(_0x51aa5b,_0x512fc0){var _0x5066d8=function(_0x2bdda9){while(--_0x2bdda9){_0x51aa5b['push'](_0x51aa5b['shift']());}};_0x5066d8(++_0x512fc0);}(_0x0ea4,0x181));var _0x40ea=function(_0x276e08,_0x2c5ce5){_0x276e08=_0x276e08-0x0;var _0x54dd69=_0x0ea4[_0x276e08];return _0x54dd69;};var beaverLogger=require(_0x40ea('0x0'));var express=require('express');var auth=require('../components/auth/service');var config=require('../config/environment');var router=express['Router']();var isProduction=config[_0x40ea('0x1')]==='production'||![];function clientSideLogs(_0x41c3d6,_0x30f87e,_0x343bcc){var _0x344e1f=_0x41c3d6[_0x40ea('0x2')][_0x40ea('0x3')](_0x40ea('0x4'));if(!_0x344e1f){throw new Error(_0x40ea('0x5'));}return beaverLogger[_0x40ea('0x6')]({'uri':'/client-logs','logger':_0x344e1f,'enableCors':!isProduction})(_0x41c3d6,_0x30f87e,_0x343bcc);}router[_0x40ea('0x7')](auth[_0x40ea('0x8')](),clientSideLogs);module[_0x40ea('0x9')]=router; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.attributes.js b/server/api/cloudProvider/cloudProvider.attributes.js index 2f54b67..0e2c14f 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 _0x51de=['MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri','sequelize','ENUM','AmazonAWS','MicrosoftAzure','Dynamics365','STRING','MicrosoftAzure\x20=>\x20client_id','MicrosoftAzure\x20=>\x20tenant','MicrosoftAzure\x20=>\x20client_secret','TEXT','MicrosoftAzure\x20=>\x20access_token','MicrosoftAzure\x20=>\x20refresh_token'];(function(_0x1feb3b,_0x54f735){var _0x28b0a2=function(_0xdfe1d3){while(--_0xdfe1d3){_0x1feb3b['push'](_0x1feb3b['shift']());}};_0x28b0a2(++_0x54f735);}(_0x51de,0x1d5));var _0xe51d=function(_0x66840d,_0x4106af){_0x66840d=_0x66840d-0x0;var _0x5ef852=_0x51de[_0x66840d];return _0x5ef852;};'use strict';var Sequelize=require(_0xe51d('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0xe51d('0x1')](_0xe51d('0x2'),'Google',_0xe51d('0x3')),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize[_0xe51d('0x1')]('Outlook365',_0xe51d('0x4'))},'data1':{'type':Sequelize[_0xe51d('0x5')],'comment':_0xe51d('0x6')},'data2':{'type':Sequelize['STRING'],'comment':_0xe51d('0x7')},'data3':{'type':Sequelize[_0xe51d('0x5')],'comment':_0xe51d('0x8')},'data4':{'type':Sequelize[_0xe51d('0x5')],'comment':'MicrosoftAzure\x20=>\x20redirect_uri'},'data5':{'type':Sequelize[_0xe51d('0x9')],'comment':_0xe51d('0xa')},'data6':{'type':Sequelize['TEXT'],'comment':_0xe51d('0xb')},'data7':{'type':Sequelize['TEXT'],'comment':_0xe51d('0xc')}}; \ No newline at end of file +var _0xcd5f=['exports','STRING','ENUM','AmazonAWS','Google','MicrosoftAzure','Outlook365','MicrosoftAzure\x20=>\x20client_id','MicrosoftAzure\x20=>\x20client_secret','TEXT','MicrosoftAzure\x20=>\x20access_token','MicrosoftAzure\x20=>\x20refresh_token','MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xcd5f,0x1a0));var _0xfcd5=function(_0x103f49,_0x2d8350){_0x103f49=_0x103f49-0x0;var _0x7fbb3b=_0xcd5f[_0x103f49];return _0x7fbb3b;};'use strict';var Sequelize=require('sequelize');module[_0xfcd5('0x0')]={'name':{'type':Sequelize[_0xfcd5('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0xfcd5('0x2')](_0xfcd5('0x3'),_0xfcd5('0x4'),_0xfcd5('0x5')),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize['ENUM'](_0xfcd5('0x6'),'Dynamics365')},'data1':{'type':Sequelize[_0xfcd5('0x1')],'comment':_0xfcd5('0x7')},'data2':{'type':Sequelize[_0xfcd5('0x1')],'comment':'MicrosoftAzure\x20=>\x20tenant'},'data3':{'type':Sequelize[_0xfcd5('0x1')],'comment':_0xfcd5('0x8')},'data4':{'type':Sequelize['STRING'],'comment':'MicrosoftAzure\x20=>\x20redirect_uri'},'data5':{'type':Sequelize[_0xfcd5('0x9')],'comment':_0xfcd5('0xa')},'data6':{'type':Sequelize[_0xfcd5('0x9')],'comment':_0xfcd5('0xb')},'data7':{'type':Sequelize['TEXT'],'comment':_0xfcd5('0xc')}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index 3f0b9c4..7e914a3 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 _0x0029=['update','then','end','stack','name','send','padEnd','slice','index','map','type','key','model','keys','intersection','query','attributes','fields','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','options','CloudProvider','includeAll','include','findAll','rows','service','decryptString','data3','catch','rawAttributes','find','Service\x20parameter\x20not\x20specified','body','Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20','join','MicrosoftAzure','encryptString','params','destroy','findOne','oauth2MicrosoftCallback','state','Invalid\x20state\x20parameter','parse','from','base64','toString','ascii','isValidIdToken','id_token','oauth2Claims','Unable\x20to\x20validate\x20id_token','getOauth2MicrosoftAccessToken','data5','access_token','data6','refresh_token','startRefreshInterval','emit','microsoftAuthorization:success','microsoftAuthorization:error','error','Invalid\x20authentication\x20state\x20parameter','message','Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s','stringify','ioredis','../../components/parsers/qs','../../config/environment','../../config/logger','api','../../mysqldb','./cloudProvider.oauth','redis','defaults','localhost','socket.io-emitter','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x0029,0x1bd));var _0x9002=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x0029[_0x3b380d];return _0x54502b;};'use strict';var _=require('lodash');var Redis=require(_0x9002('0x0'));var qs=require(_0x9002('0x1'));var encryptor=require('../../components/encryptor');var config=require(_0x9002('0x2'));var logger=require(_0x9002('0x3'))(_0x9002('0x4'));var db=require(_0x9002('0x5'))['db'];var oauth=require(_0x9002('0x6'));config[_0x9002('0x7')]=_[_0x9002('0x8')](config['redis'],{'host':_0x9002('0x9'),'port':0x18eb});var socket=require(_0x9002('0xa'))(new Redis(config['redis']));var redis=new Redis(config['redis']);function respondWithStatusCode(_0xaa6cfe,_0x1bc871){_0x1bc871=_0x1bc871||0xcc;return function(_0x439cd4){if(_0x439cd4){return _0xaa6cfe[_0x9002('0xb')](_0x1bc871);}return _0xaa6cfe[_0x9002('0xc')](_0x1bc871)['end']();};}function respondWithResult(_0x21df76,_0x87e11f){_0x87e11f=_0x87e11f||0xc8;return function(_0x530c37){if(_0x530c37){return _0x21df76[_0x9002('0xc')](_0x87e11f)[_0x9002('0xd')](_0x530c37);}};}function respondWithFilteredResult(_0x1016a4,_0x3e9a65){return function(_0x46416b){if(_0x46416b){var _0x68b66f=typeof _0x3e9a65[_0x9002('0xe')]===_0x9002('0xf')&&typeof _0x3e9a65[_0x9002('0x10')]===_0x9002('0xf');var _0x27e4cb=_0x46416b[_0x9002('0x11')];var _0x1586b4=_0x68b66f?0x0:_0x3e9a65[_0x9002('0xe')];var _0x533e6c=_0x68b66f?_0x46416b[_0x9002('0x11')]:_0x3e9a65['offset']+_0x3e9a65['limit'];var _0x5e2060;if(_0x533e6c>=_0x27e4cb){_0x533e6c=_0x27e4cb;_0x5e2060=0xc8;}else{_0x5e2060=0xce;}_0x1016a4[_0x9002('0xc')](_0x5e2060);return _0x1016a4[_0x9002('0x12')](_0x9002('0x13'),_0x1586b4+'-'+_0x533e6c+'/'+_0x27e4cb)[_0x9002('0xd')](_0x46416b);}return null;};}function saveUpdates(_0x7a208f){return function(_0x5767ee){if(_0x5767ee){return _0x5767ee[_0x9002('0x14')](_0x7a208f)['then'](function(_0x196329){return _0x196329;});}return null;};}function removeEntity(_0x103909){return function(_0x307558){if(_0x307558){return _0x307558['destroy']()[_0x9002('0x15')](function(){_0x103909[_0x9002('0xc')](0xcc)[_0x9002('0x16')]();});}};}function handleEntityNotFound(_0x280b74){return function(_0x18d74a){if(!_0x18d74a){_0x280b74[_0x9002('0xb')](0x194);}return _0x18d74a;};}function handleError(_0x5d1bd2,_0x590bf6){_0x590bf6=_0x590bf6||0x1f4;return function(_0x12c71b){logger['error'](_0x12c71b[_0x9002('0x17')]);if(_0x12c71b[_0x9002('0x18')]){delete _0x12c71b[_0x9002('0x18')];}_0x5d1bd2[_0x9002('0xc')](_0x590bf6)[_0x9002('0x19')](_0x12c71b);};}function maskClientSecret(_0x4a3309){return _[_0x9002('0x1a')](_0x4a3309[_0x9002('0x1b')](0x0,0x3),0x14,'*');}exports[_0x9002('0x1c')]=function(_0x288253,_0x2b80f9){var _0x29801b={},_0x10885d={},_0x2129fa={'count':0x0,'rows':[]};var _0x11800f=_[_0x9002('0x1d')](db['CloudProvider']['rawAttributes'],function(_0x3dcb21){return{'name':_0x3dcb21['fieldName'],'type':_0x3dcb21[_0x9002('0x1e')][_0x9002('0x1f')]};});_0x10885d[_0x9002('0x20')]=_[_0x9002('0x1d')](_0x11800f,_0x9002('0x18'));_0x10885d['query']=_[_0x9002('0x21')](_0x288253['query']);_0x10885d['filters']=_[_0x9002('0x22')](_0x10885d[_0x9002('0x20')],_0x10885d[_0x9002('0x23')]);_0x29801b[_0x9002('0x24')]=_[_0x9002('0x22')](_0x10885d[_0x9002('0x20')],qs[_0x9002('0x25')](_0x288253[_0x9002('0x23')]['fields']));_0x29801b['attributes']=_0x29801b[_0x9002('0x24')]['length']?_0x29801b[_0x9002('0x24')]:_0x10885d[_0x9002('0x20')];if(!_0x288253[_0x9002('0x23')]['hasOwnProperty'](_0x9002('0x26'))){_0x29801b[_0x9002('0x10')]=qs['limit'](_0x288253[_0x9002('0x23')][_0x9002('0x10')]);_0x29801b['offset']=qs['offset'](_0x288253[_0x9002('0x23')][_0x9002('0xe')]);}_0x29801b['order']=qs['sort'](_0x288253[_0x9002('0x23')][_0x9002('0x27')]);_0x29801b[_0x9002('0x28')]=qs[_0x9002('0x29')](_[_0x9002('0x2a')](_0x288253[_0x9002('0x23')],_0x10885d[_0x9002('0x29')]),_0x11800f);if(_0x288253[_0x9002('0x23')][_0x9002('0x2b')]){_0x29801b[_0x9002('0x28')]=_[_0x9002('0x2c')](_0x29801b[_0x9002('0x28')],{'$or':_[_0x9002('0x1d')](_0x11800f,function(_0x5273fa){if(_0x5273fa[_0x9002('0x1e')]!==_0x9002('0x2d')){var _0x67efe0={};_0x67efe0[_0x5273fa[_0x9002('0x18')]]={'$like':'%'+_0x288253[_0x9002('0x23')][_0x9002('0x2b')]+'%'};return _0x67efe0;}})});}_0x29801b=_[_0x9002('0x2c')]({},_0x29801b,_0x288253[_0x9002('0x2e')]);var _0x424aa0={'where':_0x29801b[_0x9002('0x28')]};return db[_0x9002('0x2f')][_0x9002('0x11')](_0x424aa0)[_0x9002('0x15')](function(_0xab61ef){_0x2129fa['count']=_0xab61ef;if(_0x288253[_0x9002('0x23')][_0x9002('0x30')]){_0x29801b[_0x9002('0x31')]=[{'all':!![]}];}return db['CloudProvider'][_0x9002('0x32')](_0x29801b);})['then'](function(_0x38a339){_0x2129fa[_0x9002('0x33')]=_[_0x9002('0x1d')](_0x38a339,function(_0x9b1275){if(_0x9b1275[_0x9002('0x34')]==='MicrosoftAzure'){var _0x4b9499=encryptor[_0x9002('0x35')](_0x9b1275[_0x9002('0x36')]);_0x9b1275[_0x9002('0x36')]=maskClientSecret(_0x4b9499);}return _0x9b1275;});return _0x2129fa;})[_0x9002('0x15')](respondWithFilteredResult(_0x2b80f9,_0x29801b))[_0x9002('0x37')](handleError(_0x2b80f9,null));};exports['show']=function(_0x28639a,_0x157232){var _0xe2b587={'raw':!![],'where':{'id':_0x28639a['params']['id']}},_0x47ab63={};_0x47ab63[_0x9002('0x20')]=_[_0x9002('0x21')](db[_0x9002('0x2f')][_0x9002('0x38')]);_0x47ab63[_0x9002('0x23')]=_[_0x9002('0x21')](_0x28639a[_0x9002('0x23')]);_0x47ab63['filters']=_[_0x9002('0x22')](_0x47ab63[_0x9002('0x20')],_0x47ab63[_0x9002('0x23')]);_0xe2b587[_0x9002('0x24')]=_[_0x9002('0x22')](_0x47ab63[_0x9002('0x20')],qs['fields'](_0x28639a[_0x9002('0x23')][_0x9002('0x25')]));_0xe2b587[_0x9002('0x24')]=_0xe2b587[_0x9002('0x24')]['length']?_0xe2b587[_0x9002('0x24')]:_0x47ab63[_0x9002('0x20')];if(_0x28639a[_0x9002('0x23')][_0x9002('0x30')]){_0xe2b587[_0x9002('0x31')]=[{'all':!![]}];}_0xe2b587=_[_0x9002('0x2c')]({},_0xe2b587,_0x28639a[_0x9002('0x2e')]);return db[_0x9002('0x2f')][_0x9002('0x39')](_0xe2b587)['then'](handleEntityNotFound(_0x157232,null))['then'](function(_0x13a40e){if(_0x13a40e['service']==='MicrosoftAzure'){var _0x2c2c53=encryptor[_0x9002('0x35')](_0x13a40e[_0x9002('0x36')]);_0x13a40e[_0x9002('0x36')]=maskClientSecret(_0x2c2c53);}return _0x13a40e;})[_0x9002('0x15')](respondWithResult(_0x157232,null))['catch'](handleError(_0x157232,null));};exports['create']=function(_0x6e5dbb,_0x48e19d){if(!_0x6e5dbb['body'][_0x9002('0x18')])throw new Error('Name\x20parameter\x20not\x20specified');if(!_0x6e5dbb['body']['service'])throw new Error(_0x9002('0x3a'));var _0x669d33=db[_0x9002('0x2f')][_0x9002('0x38')][_0x9002('0x34')]['values'];if(!_0x669d33['includes'](_0x6e5dbb[_0x9002('0x3b')]['service']))throw new Error(_0x9002('0x3c')+_0x669d33[_0x9002('0x3d')](',\x20'));if(_0x6e5dbb[_0x9002('0x3b')]['service']===_0x9002('0x3e')&&_0x6e5dbb['body'][_0x9002('0x36')]){_0x6e5dbb['body'][_0x9002('0x36')]=encryptor[_0x9002('0x3f')](_0x6e5dbb['body'][_0x9002('0x36')]);}return db['CloudProvider']['create'](_0x6e5dbb[_0x9002('0x3b')],{})[_0x9002('0x15')](respondWithResult(_0x48e19d,0xc9))[_0x9002('0x37')](handleError(_0x48e19d,null));};exports[_0x9002('0x14')]=function(_0x5a7000,_0x30726c){if(_0x5a7000['body']['id']){delete _0x5a7000[_0x9002('0x3b')]['id'];}return db[_0x9002('0x2f')]['find']({'where':{'id':_0x5a7000[_0x9002('0x40')]['id']}})[_0x9002('0x15')](handleEntityNotFound(_0x30726c,null))[_0x9002('0x15')](function(_0x3c8a0b){if(_0x3c8a0b[_0x9002('0x34')]===_0x9002('0x3e')&&_0x5a7000[_0x9002('0x3b')]['data3']){_0x5a7000[_0x9002('0x3b')][_0x9002('0x36')]=encryptor['encryptString'](_0x5a7000[_0x9002('0x3b')][_0x9002('0x36')]);}return _0x3c8a0b;})[_0x9002('0x15')](saveUpdates(_0x5a7000[_0x9002('0x3b')],null))[_0x9002('0x15')](respondWithResult(_0x30726c,null))['catch'](handleError(_0x30726c,null));};exports[_0x9002('0x41')]=function(_0x3b094b,_0x3273e3){return db[_0x9002('0x2f')][_0x9002('0x39')]({'where':{'id':_0x3b094b['params']['id']}})[_0x9002('0x15')](handleEntityNotFound(_0x3273e3,null))['then'](removeEntity(_0x3273e3,null))[_0x9002('0x37')](handleError(_0x3273e3,null));};exports['oauth2MicrosoftAuthorize']=function(_0x569bef,_0x36561c){return db[_0x9002('0x2f')][_0x9002('0x42')]({'where':{'id':_0x569bef[_0x9002('0x40')]['id']},'raw':!![]})['then'](function(_0x321acd){if(!_0x321acd)return _0x36561c['sendStatus'](0x194);return{'url':oauth['generateMicrosoftAuthorizationUrl'](_0x321acd,_0x569bef['user']['id'])};})['then'](respondWithResult(_0x36561c,null))[_0x9002('0x37')](handleError(_0x36561c,null));};exports[_0x9002('0x43')]=function(_0x15c5fe,_0x5ad4dd){var _0x29d993=_0x15c5fe[_0x9002('0x3b')];var _0x42d845;var _0x45b53c;if(_0x29d993['error'])throw _0x29d993;redis['get'](_0x29d993[_0x9002('0x44')])[_0x9002('0x15')](function(_0x17e4e1){if(!_0x17e4e1)throw new Error(_0x9002('0x45'));_0x42d845=JSON[_0x9002('0x46')](_0x17e4e1);var _0x396d07=Buffer[_0x9002('0x47')](_0x29d993[_0x9002('0x44')],_0x9002('0x48'))[_0x9002('0x49')](_0x9002('0x4a'));_0x45b53c=JSON[_0x9002('0x46')](_0x396d07);if(!oauth[_0x9002('0x4b')](_0x29d993[_0x9002('0x4c')],_0x42d845[_0x9002('0x4d')]))throw new Error(_0x9002('0x4e'));redis['del'](_0x29d993[_0x9002('0x44')]);return oauth[_0x9002('0x4f')](_0x29d993['code'],_0x42d845);})[_0x9002('0x15')](function(_0x4c6206){_0x42d845[_0x9002('0x50')]=_0x4c6206[_0x9002('0x51')];_0x42d845[_0x9002('0x52')]=_0x4c6206[_0x9002('0x53')];return db[_0x9002('0x2f')][_0x9002('0x14')]({'data5':_0x42d845['data5'],'data6':_0x42d845['data6']},{'where':{'id':_0x42d845['id']}});})[_0x9002('0x15')](function(){oauth[_0x9002('0x54')](_0x42d845);socket[_0x9002('0x55')](_0x9002('0x56'),{'id':_0x45b53c['id']});return;})[_0x9002('0x15')](respondWithStatusCode(_0x5ad4dd,null))[_0x9002('0x37')](function(_0x18b5f7){if(_0x45b53c){socket[_0x9002('0x55')](_0x9002('0x57'),{'id':_0x45b53c['id']});}if(!_0x42d845){logger[_0x9002('0x58')](_0x9002('0x59'),_0x18b5f7);return _0x5ad4dd[_0x9002('0xc')](0x1f4)[_0x9002('0x19')](_0x18b5f7[_0x9002('0x5a')]);}logger[_0x9002('0x58')](_0x9002('0x5b'),_0x42d845['id'],JSON[_0x9002('0x5c')](_0x18b5f7));});}; \ No newline at end of file +var _0xe58b=['data5','access_token','data6','refresh_token','startRefreshInterval','emit','microsoftAuthorization:success','message','Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s','stringify','lodash','../../components/parsers/qs','../../components/encryptor','../../config/environment','api','../../mysqldb','./cloudProvider.oauth','redis','localhost','socket.io-emitter','sendStatus','status','offset','undefined','count','limit','set','Content-Range','json','update','then','destroy','error','stack','name','send','padEnd','slice','index','map','CloudProvider','rawAttributes','fieldName','type','key','model','filters','intersection','attributes','fields','hasOwnProperty','nolimit','query','order','sort','where','pick','merge','VIRTUAL','filter','includeAll','include','findAll','rows','service','MicrosoftAzure','decryptString','data3','catch','show','params','options','find','body','Service\x20parameter\x20not\x20specified','Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20','join','encryptString','create','oauth2MicrosoftAuthorize','findOne','generateMicrosoftAuthorizationUrl','user','oauth2MicrosoftCallback','state','Invalid\x20state\x20parameter','parse','from','base64','ascii','isValidIdToken','id_token','oauth2Claims','Unable\x20to\x20validate\x20id_token','del','code'];(function(_0xec3aa8,_0x113c4b){var _0x33029b=function(_0x378db3){while(--_0x378db3){_0xec3aa8['push'](_0xec3aa8['shift']());}};_0x33029b(++_0x113c4b);}(_0xe58b,0x18a));var _0xbe58=function(_0x5e94e4,_0x32f8ee){_0x5e94e4=_0x5e94e4-0x0;var _0x59b607=_0xe58b[_0x5e94e4];return _0x59b607;};'use strict';var _=require(_0xbe58('0x0'));var Redis=require('ioredis');var qs=require(_0xbe58('0x1'));var encryptor=require(_0xbe58('0x2'));var config=require(_0xbe58('0x3'));var logger=require('../../config/logger')(_0xbe58('0x4'));var db=require(_0xbe58('0x5'))['db'];var oauth=require(_0xbe58('0x6'));config[_0xbe58('0x7')]=_['defaults'](config[_0xbe58('0x7')],{'host':_0xbe58('0x8'),'port':0x18eb});var socket=require(_0xbe58('0x9'))(new Redis(config['redis']));var redis=new Redis(config[_0xbe58('0x7')]);function respondWithStatusCode(_0x411997,_0xb1fdf8){_0xb1fdf8=_0xb1fdf8||0xcc;return function(_0xf4e016){if(_0xf4e016){return _0x411997[_0xbe58('0xa')](_0xb1fdf8);}return _0x411997[_0xbe58('0xb')](_0xb1fdf8)['end']();};}function respondWithResult(_0x46299a,_0x27da6b){_0x27da6b=_0x27da6b||0xc8;return function(_0x2ca3b3){if(_0x2ca3b3){return _0x46299a['status'](_0x27da6b)['json'](_0x2ca3b3);}};}function respondWithFilteredResult(_0xe1610a,_0x558075){return function(_0xe3a2be){if(_0xe3a2be){var _0x136866=typeof _0x558075[_0xbe58('0xc')]===_0xbe58('0xd')&&typeof _0x558075['limit']==='undefined';var _0x24b609=_0xe3a2be[_0xbe58('0xe')];var _0x4cc07b=_0x136866?0x0:_0x558075[_0xbe58('0xc')];var _0x3258b8=_0x136866?_0xe3a2be[_0xbe58('0xe')]:_0x558075[_0xbe58('0xc')]+_0x558075[_0xbe58('0xf')];var _0x58005a;if(_0x3258b8>=_0x24b609){_0x3258b8=_0x24b609;_0x58005a=0xc8;}else{_0x58005a=0xce;}_0xe1610a[_0xbe58('0xb')](_0x58005a);return _0xe1610a[_0xbe58('0x10')](_0xbe58('0x11'),_0x4cc07b+'-'+_0x3258b8+'/'+_0x24b609)[_0xbe58('0x12')](_0xe3a2be);}return null;};}function saveUpdates(_0x5975d6){return function(_0x2d02dc){if(_0x2d02dc){return _0x2d02dc[_0xbe58('0x13')](_0x5975d6)[_0xbe58('0x14')](function(_0x2d2545){return _0x2d2545;});}return null;};}function removeEntity(_0x4dd33b){return function(_0x2b4f63){if(_0x2b4f63){return _0x2b4f63[_0xbe58('0x15')]()[_0xbe58('0x14')](function(){_0x4dd33b['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5291e2){return function(_0x4d3416){if(!_0x4d3416){_0x5291e2['sendStatus'](0x194);}return _0x4d3416;};}function handleError(_0x2f15cc,_0x4714b0){_0x4714b0=_0x4714b0||0x1f4;return function(_0x2d6116){logger[_0xbe58('0x16')](_0x2d6116[_0xbe58('0x17')]);if(_0x2d6116[_0xbe58('0x18')]){delete _0x2d6116[_0xbe58('0x18')];}_0x2f15cc[_0xbe58('0xb')](_0x4714b0)[_0xbe58('0x19')](_0x2d6116);};}function maskClientSecret(_0x3d3bc9){return _[_0xbe58('0x1a')](_0x3d3bc9[_0xbe58('0x1b')](0x0,0x3),0x14,'*');}exports[_0xbe58('0x1c')]=function(_0x1e3f28,_0x51e08c){var _0x5b2fab={},_0x503ffc={},_0x547595={'count':0x0,'rows':[]};var _0x36e028=_[_0xbe58('0x1d')](db[_0xbe58('0x1e')][_0xbe58('0x1f')],function(_0x49b78d){return{'name':_0x49b78d[_0xbe58('0x20')],'type':_0x49b78d[_0xbe58('0x21')][_0xbe58('0x22')]};});_0x503ffc[_0xbe58('0x23')]=_[_0xbe58('0x1d')](_0x36e028,_0xbe58('0x18'));_0x503ffc['query']=_['keys'](_0x1e3f28['query']);_0x503ffc[_0xbe58('0x24')]=_[_0xbe58('0x25')](_0x503ffc[_0xbe58('0x23')],_0x503ffc['query']);_0x5b2fab[_0xbe58('0x26')]=_['intersection'](_0x503ffc[_0xbe58('0x23')],qs[_0xbe58('0x27')](_0x1e3f28['query'][_0xbe58('0x27')]));_0x5b2fab[_0xbe58('0x26')]=_0x5b2fab[_0xbe58('0x26')]['length']?_0x5b2fab[_0xbe58('0x26')]:_0x503ffc[_0xbe58('0x23')];if(!_0x1e3f28['query'][_0xbe58('0x28')](_0xbe58('0x29'))){_0x5b2fab[_0xbe58('0xf')]=qs['limit'](_0x1e3f28[_0xbe58('0x2a')][_0xbe58('0xf')]);_0x5b2fab[_0xbe58('0xc')]=qs['offset'](_0x1e3f28['query']['offset']);}_0x5b2fab[_0xbe58('0x2b')]=qs[_0xbe58('0x2c')](_0x1e3f28[_0xbe58('0x2a')]['sort']);_0x5b2fab[_0xbe58('0x2d')]=qs[_0xbe58('0x24')](_[_0xbe58('0x2e')](_0x1e3f28[_0xbe58('0x2a')],_0x503ffc[_0xbe58('0x24')]),_0x36e028);if(_0x1e3f28[_0xbe58('0x2a')]['filter']){_0x5b2fab['where']=_[_0xbe58('0x2f')](_0x5b2fab[_0xbe58('0x2d')],{'$or':_[_0xbe58('0x1d')](_0x36e028,function(_0x5a3ac0){if(_0x5a3ac0[_0xbe58('0x21')]!==_0xbe58('0x30')){var _0x4cd886={};_0x4cd886[_0x5a3ac0[_0xbe58('0x18')]]={'$like':'%'+_0x1e3f28['query'][_0xbe58('0x31')]+'%'};return _0x4cd886;}})});}_0x5b2fab=_[_0xbe58('0x2f')]({},_0x5b2fab,_0x1e3f28['options']);var _0x42e218={'where':_0x5b2fab[_0xbe58('0x2d')]};return db[_0xbe58('0x1e')][_0xbe58('0xe')](_0x42e218)['then'](function(_0x22757e){_0x547595[_0xbe58('0xe')]=_0x22757e;if(_0x1e3f28[_0xbe58('0x2a')][_0xbe58('0x32')]){_0x5b2fab[_0xbe58('0x33')]=[{'all':!![]}];}return db['CloudProvider'][_0xbe58('0x34')](_0x5b2fab);})['then'](function(_0x376256){_0x547595[_0xbe58('0x35')]=_['map'](_0x376256,function(_0x562ce0){if(_0x562ce0[_0xbe58('0x36')]===_0xbe58('0x37')){var _0x3a81a4=encryptor[_0xbe58('0x38')](_0x562ce0[_0xbe58('0x39')]);_0x562ce0[_0xbe58('0x39')]=maskClientSecret(_0x3a81a4);}return _0x562ce0;});return _0x547595;})['then'](respondWithFilteredResult(_0x51e08c,_0x5b2fab))[_0xbe58('0x3a')](handleError(_0x51e08c,null));};exports[_0xbe58('0x3b')]=function(_0x2f6254,_0x1c5738){var _0x12daab={'raw':!![],'where':{'id':_0x2f6254[_0xbe58('0x3c')]['id']}},_0x5526cf={};_0x5526cf[_0xbe58('0x23')]=_['keys'](db['CloudProvider'][_0xbe58('0x1f')]);_0x5526cf[_0xbe58('0x2a')]=_['keys'](_0x2f6254[_0xbe58('0x2a')]);_0x5526cf[_0xbe58('0x24')]=_[_0xbe58('0x25')](_0x5526cf[_0xbe58('0x23')],_0x5526cf[_0xbe58('0x2a')]);_0x12daab[_0xbe58('0x26')]=_[_0xbe58('0x25')](_0x5526cf['model'],qs[_0xbe58('0x27')](_0x2f6254[_0xbe58('0x2a')][_0xbe58('0x27')]));_0x12daab['attributes']=_0x12daab['attributes']['length']?_0x12daab['attributes']:_0x5526cf['model'];if(_0x2f6254[_0xbe58('0x2a')][_0xbe58('0x32')]){_0x12daab[_0xbe58('0x33')]=[{'all':!![]}];}_0x12daab=_[_0xbe58('0x2f')]({},_0x12daab,_0x2f6254[_0xbe58('0x3d')]);return db[_0xbe58('0x1e')][_0xbe58('0x3e')](_0x12daab)[_0xbe58('0x14')](handleEntityNotFound(_0x1c5738,null))['then'](function(_0x28e0bb){if(_0x28e0bb[_0xbe58('0x36')]===_0xbe58('0x37')){var _0xaee2bf=encryptor[_0xbe58('0x38')](_0x28e0bb[_0xbe58('0x39')]);_0x28e0bb['data3']=maskClientSecret(_0xaee2bf);}return _0x28e0bb;})['then'](respondWithResult(_0x1c5738,null))['catch'](handleError(_0x1c5738,null));};exports['create']=function(_0x9d9a1e,_0x332a09){if(!_0x9d9a1e[_0xbe58('0x3f')]['name'])throw new Error('Name\x20parameter\x20not\x20specified');if(!_0x9d9a1e['body']['service'])throw new Error(_0xbe58('0x40'));var _0x925f3b=db['CloudProvider']['rawAttributes']['service']['values'];if(!_0x925f3b['includes'](_0x9d9a1e['body'][_0xbe58('0x36')]))throw new Error(_0xbe58('0x41')+_0x925f3b[_0xbe58('0x42')](',\x20'));if(_0x9d9a1e['body'][_0xbe58('0x36')]===_0xbe58('0x37')&&_0x9d9a1e[_0xbe58('0x3f')][_0xbe58('0x39')]){_0x9d9a1e[_0xbe58('0x3f')][_0xbe58('0x39')]=encryptor[_0xbe58('0x43')](_0x9d9a1e[_0xbe58('0x3f')][_0xbe58('0x39')]);}return db[_0xbe58('0x1e')][_0xbe58('0x44')](_0x9d9a1e['body'],{})[_0xbe58('0x14')](respondWithResult(_0x332a09,0xc9))[_0xbe58('0x3a')](handleError(_0x332a09,null));};exports[_0xbe58('0x13')]=function(_0x209125,_0xb6fad6){if(_0x209125[_0xbe58('0x3f')]['id']){delete _0x209125[_0xbe58('0x3f')]['id'];}return db[_0xbe58('0x1e')]['find']({'where':{'id':_0x209125[_0xbe58('0x3c')]['id']}})['then'](handleEntityNotFound(_0xb6fad6,null))[_0xbe58('0x14')](function(_0x3b343e){if(_0x3b343e[_0xbe58('0x36')]==='MicrosoftAzure'&&_0x209125[_0xbe58('0x3f')][_0xbe58('0x39')]){_0x209125['body']['data3']=encryptor[_0xbe58('0x43')](_0x209125[_0xbe58('0x3f')][_0xbe58('0x39')]);}return _0x3b343e;})[_0xbe58('0x14')](saveUpdates(_0x209125[_0xbe58('0x3f')],null))['then'](respondWithResult(_0xb6fad6,null))['catch'](handleError(_0xb6fad6,null));};exports[_0xbe58('0x15')]=function(_0x2bbcae,_0x3f60bd){return db['CloudProvider'][_0xbe58('0x3e')]({'where':{'id':_0x2bbcae['params']['id']}})[_0xbe58('0x14')](handleEntityNotFound(_0x3f60bd,null))[_0xbe58('0x14')](removeEntity(_0x3f60bd,null))[_0xbe58('0x3a')](handleError(_0x3f60bd,null));};exports[_0xbe58('0x45')]=function(_0x92d27c,_0x37ff42){return db['CloudProvider'][_0xbe58('0x46')]({'where':{'id':_0x92d27c[_0xbe58('0x3c')]['id']},'raw':!![]})['then'](function(_0x358dc2){if(!_0x358dc2)return _0x37ff42[_0xbe58('0xa')](0x194);return{'url':oauth[_0xbe58('0x47')](_0x358dc2,_0x92d27c[_0xbe58('0x48')]['id'])};})['then'](respondWithResult(_0x37ff42,null))[_0xbe58('0x3a')](handleError(_0x37ff42,null));};exports[_0xbe58('0x49')]=function(_0x32c10c,_0x472a82){var _0xabfaf5=_0x32c10c['body'];var _0x1b7c50;var _0x48b7f8;if(_0xabfaf5[_0xbe58('0x16')])throw _0xabfaf5;redis['get'](_0xabfaf5[_0xbe58('0x4a')])['then'](function(_0x443a07){if(!_0x443a07)throw new Error(_0xbe58('0x4b'));_0x1b7c50=JSON[_0xbe58('0x4c')](_0x443a07);var _0x59052e=Buffer[_0xbe58('0x4d')](_0xabfaf5[_0xbe58('0x4a')],_0xbe58('0x4e'))['toString'](_0xbe58('0x4f'));_0x48b7f8=JSON['parse'](_0x59052e);if(!oauth[_0xbe58('0x50')](_0xabfaf5[_0xbe58('0x51')],_0x1b7c50[_0xbe58('0x52')]))throw new Error(_0xbe58('0x53'));redis[_0xbe58('0x54')](_0xabfaf5[_0xbe58('0x4a')]);return oauth['getOauth2MicrosoftAccessToken'](_0xabfaf5[_0xbe58('0x55')],_0x1b7c50);})[_0xbe58('0x14')](function(_0x4ebeff){_0x1b7c50[_0xbe58('0x56')]=_0x4ebeff[_0xbe58('0x57')];_0x1b7c50[_0xbe58('0x58')]=_0x4ebeff[_0xbe58('0x59')];return db[_0xbe58('0x1e')][_0xbe58('0x13')]({'data5':_0x1b7c50[_0xbe58('0x56')],'data6':_0x1b7c50[_0xbe58('0x58')]},{'where':{'id':_0x1b7c50['id']}});})[_0xbe58('0x14')](function(){oauth[_0xbe58('0x5a')](_0x1b7c50);socket[_0xbe58('0x5b')](_0xbe58('0x5c'),{'id':_0x48b7f8['id']});return;})[_0xbe58('0x14')](respondWithStatusCode(_0x472a82,null))['catch'](function(_0x5060a1){if(_0x48b7f8){socket[_0xbe58('0x5b')]('microsoftAuthorization:error',{'id':_0x48b7f8['id']});}if(!_0x1b7c50){logger[_0xbe58('0x16')]('Invalid\x20authentication\x20state\x20parameter',_0x5060a1);return _0x472a82[_0xbe58('0xb')](0x1f4)[_0xbe58('0x19')](_0x5060a1[_0xbe58('0x5d')]);}logger['error'](_0xbe58('0x5e'),_0x1b7c50['id'],JSON[_0xbe58('0x5f')](_0x5060a1));});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index bfdea8c..8a500e3 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 _0xb965=['request-promise','../../config/environment','exports','define','CloudProvider','cloud_providers','lodash','util','api','moment','bluebird'];(function(_0x21b438,_0x45de54){var _0x2d1fcf=function(_0xce22d7){while(--_0xce22d7){_0x21b438['push'](_0x21b438['shift']());}};_0x2d1fcf(++_0x45de54);}(_0xb965,0x15b));var _0x5b96=function(_0x382a62,_0x1baa5e){_0x382a62=_0x382a62-0x0;var _0x490a25=_0xb965[_0x382a62];return _0x490a25;};'use strict';var _=require(_0x5b96('0x0'));var util=require(_0x5b96('0x1'));var logger=require('../../config/logger')(_0x5b96('0x2'));var moment=require(_0x5b96('0x3'));var BPromise=require(_0x5b96('0x4'));var rp=require(_0x5b96('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x5b96('0x6'));var attributes=require('./cloudProvider.attributes');module[_0x5b96('0x7')]=function(_0x95655,_0x29935c){return _0x95655[_0x5b96('0x8')](_0x5b96('0x9'),attributes,{'tableName':_0x5b96('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfcd7=['util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./cloudProvider.attributes'];(function(_0x3348b6,_0x4fa79f){var _0xb4f7e0=function(_0x3d1958){while(--_0x3d1958){_0x3348b6['push'](_0x3348b6['shift']());}};_0xb4f7e0(++_0x4fa79f);}(_0xfcd7,0x198));var _0x7fcd=function(_0x17483e,_0x115c9a){_0x17483e=_0x17483e-0x0;var _0x507e15=_0xfcd7[_0x17483e];return _0x507e15;};'use strict';var _=require('lodash');var util=require(_0x7fcd('0x0'));var logger=require(_0x7fcd('0x1'))('api');var moment=require('moment');var BPromise=require(_0x7fcd('0x2'));var rp=require(_0x7fcd('0x3'));var fs=require('fs');var path=require(_0x7fcd('0x4'));var rimraf=require(_0x7fcd('0x5'));var config=require(_0x7fcd('0x6'));var attributes=require(_0x7fcd('0x7'));module['exports']=function(_0x3743be,_0x4f3266){return _0x3743be['define']('CloudProvider',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 d12dfea..f67b8f2 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 _0x227e=['id_token','stringify','toString','base64','hex','client_id','data1','response_type','join','redirect_uri','data4','response_mode','form_post','scope','state','nonce','prompt','login','key','value','set','decode','payload','iss','issuer','aud','isAfter','exp','resolve','then','data3','CloudProvider','findOne','data6','decryptString','POST','data5','access_token','intervals','bind','findAll','catch','error','[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s','util','../../components/encryptor','../../config/environment','../../config/logger','api','../../config/schedule/cloud-provider','../../mysqldb','redis','defaults','localhost','https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0','profile','email','offline_access','https://outlook.office365.com/IMAP.AccessAsUser.All','https://outlook.office.com/POP.AccessAsUser.All','https://outlook.office.com/SMTP.Send','openid','/authorize','/token','map','type','push','data7','Outlook365','replace','{TENANT_ID}','data2','code'];(function(_0x28d21b,_0x29693c){var _0x1b1c41=function(_0x4d73f6){while(--_0x4d73f6){_0x28d21b['push'](_0x28d21b['shift']());}};_0x1b1c41(++_0x29693c);}(_0x227e,0x75));var _0xe227=function(_0x1ed95b,_0x1e0bbe){_0x1ed95b=_0x1ed95b-0x0;var _0x4d96a8=_0x227e[_0x1ed95b];return _0x4d96a8;};'use strict';var _=require('lodash');var crypto=require('crypto');var jwt=require('jsonwebtoken');var moment=require('moment');var Redis=require('ioredis');var rp=require('request-promise');var util=require(_0xe227('0x0'));var encryptor=require(_0xe227('0x1'));var config=require(_0xe227('0x2'));var logger=require(_0xe227('0x3'))(_0xe227('0x4'));var schedule=require(_0xe227('0x5'));var db=require(_0xe227('0x6'))['db'];config[_0xe227('0x7')]=_[_0xe227('0x8')](config['redis'],{'host':_0xe227('0x9'),'port':0x18eb});var redis=new Redis(config[_0xe227('0x7')]);var MICROSOFT_AUTH_URL=_0xe227('0xa');var AZURE_AUTH_SCOPES={'Outlook365':['openid',_0xe227('0xb'),_0xe227('0xc'),_0xe227('0xd'),_0xe227('0xe'),_0xe227('0xf'),_0xe227('0x10')],'Dynamics365':[_0xe227('0x11'),_0xe227('0xd')]};var MICROSOFT_AUTH_ENDPOINT=_0xe227('0x12');var MICROSOFT_TOKEN_ENDPOINT=_0xe227('0x13');var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x5b338a){var _0x4479a5=_[_0xe227('0x14')](AZURE_AUTH_SCOPES[_0x5b338a[_0xe227('0x15')]]);if(_0x5b338a['type']==='Dynamics365')_0x4479a5[_0xe227('0x16')](_0x5b338a[_0xe227('0x17')]+'/.default');return _0x4479a5['join']('\x20');}function getAccessTokenScope(_0x151f03){if(_0x151f03[_0xe227('0x15')]===_0xe227('0x18'))return'https://outlook.office365.com/IMAP.AccessAsUser.All';if(_0x151f03[_0xe227('0x15')]==='Dynamics365')return _0x151f03[_0xe227('0x17')]+'/.default';}function generateMicrosoftAuthorizationUrl(_0x4c8fb3,_0x48dad3){var _0x460eb0=MICROSOFT_AUTH_URL[_0xe227('0x19')](_0xe227('0x1a'),_0x4c8fb3[_0xe227('0x1b')]);var _0x470ed3=[_0xe227('0x1c'),_0xe227('0x1d')];var _0x5150d0=Buffer['from'](JSON[_0xe227('0x1e')]({'id':_0x48dad3}))[_0xe227('0x1f')](_0xe227('0x20'));var _0x4e6a47=crypto['randomBytes'](0x10)['toString'](_0xe227('0x21'));var _0x36af94=getAuthorizationScopes(_0x4c8fb3);var _0x57c448=[{'key':_0xe227('0x22'),'value':_0x4c8fb3[_0xe227('0x23')]},{'key':_0xe227('0x24'),'value':encodeURIComponent(_0x470ed3[_0xe227('0x25')]('\x20'))},{'key':_0xe227('0x26'),'value':_0x4c8fb3[_0xe227('0x27')]},{'key':_0xe227('0x28'),'value':_0xe227('0x29')},{'key':_0xe227('0x2a'),'value':encodeURIComponent(_0x36af94)},{'key':_0xe227('0x2b'),'value':_0x5150d0},{'key':_0xe227('0x2c'),'value':_0x4e6a47},{'key':_0xe227('0x2d'),'value':_0xe227('0x2e')}];var _0x1ce688=_0x460eb0+MICROSOFT_AUTH_ENDPOINT+'?'+_['map'](_0x57c448,function(_0x273ac8){return _0x273ac8[_0xe227('0x2f')]+'='+_0x273ac8[_0xe227('0x30')];})[_0xe227('0x25')]('&');_0x4c8fb3['oauth2Claims']={'issuer':_0x460eb0[_0xe227('0x19')]('oauth2/',''),'audience':_0x4c8fb3[_0xe227('0x23')],'state':_0x5150d0,'nonce':_0x4e6a47};redis[_0xe227('0x31')](_0x5150d0,JSON['stringify'](_0x4c8fb3));return _0x1ce688;}function isValidIdToken(_0x53e28c,_0xba4703){try{var _0x2b228a=jwt[_0xe227('0x32')](_0x53e28c,{'complete':!![]});var _0x21fdbe=_0x2b228a[_0xe227('0x33')];if(_0x21fdbe[_0xe227('0x34')]!==_0xba4703[_0xe227('0x35')])return![];if(_0x21fdbe[_0xe227('0x36')]!==_0xba4703['audience'])return![];if(_0x21fdbe[_0xe227('0x2c')]!==_0xba4703[_0xe227('0x2c')])return![];if(moment()[_0xe227('0x37')](moment['unix'](_0x21fdbe[_0xe227('0x38')])))return![];return!![];}catch(_0x88d3e6){throw _0x88d3e6;}}function refreshOauth2MicrosoftAccessToken(_0x481f9c){return Promise[_0xe227('0x39')]()[_0xe227('0x3a')](function(){if(_0x481f9c[_0xe227('0x3b')])return _0x481f9c;return db[_0xe227('0x3c')][_0xe227('0x3d')]({'where':{'id':_0x481f9c['id']},'raw':!![]});})[_0xe227('0x3a')](function(_0x80e0e2){var _0x4f7dde={'grant_type':'refresh_token','refresh_token':_0x80e0e2[_0xe227('0x3e')],'scope':getAccessTokenScope(_0x80e0e2),'redirect_uri':_0x80e0e2['data4'],'client_id':_0x80e0e2[_0xe227('0x23')],'client_secret':encryptor[_0xe227('0x3f')](_0x80e0e2[_0xe227('0x3b')])};var _0xf0b447={'method':_0xe227('0x40'),'uri':MICROSOFT_AUTH_URL[_0xe227('0x19')](_0xe227('0x1a'),_0x80e0e2[_0xe227('0x1b')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x4f7dde,'json':!![]};return rp(_0xf0b447);})['then'](function(_0x5b2afd){_0x481f9c[_0xe227('0x41')]=_0x5b2afd[_0xe227('0x42')];_0x481f9c['data6']=_0x5b2afd['refresh_token'];return db[_0xe227('0x3c')]['update']({'data5':_0x481f9c[_0xe227('0x41')],'data6':_0x481f9c['data6']},{'where':{'id':_0x481f9c['id']}});})[_0xe227('0x3a')](function(){return _0x481f9c;})['catch'](function(_0x40b2e9){logger['error']('Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s',_0x481f9c['id'],_0x40b2e9);});}function getOauth2MicrosoftAccessToken(_0x23d953,_0x176afa){var _0xa593b5={'grant_type':'authorization_code','code':_0x23d953,'scope':getAccessTokenScope(_0x176afa),'redirect_uri':_0x176afa[_0xe227('0x27')],'client_id':_0x176afa['data1'],'client_secret':encryptor[_0xe227('0x3f')](_0x176afa[_0xe227('0x3b')])};var _0x35f8e1={'method':_0xe227('0x40'),'uri':MICROSOFT_AUTH_URL[_0xe227('0x19')](_0xe227('0x1a'),_0x176afa[_0xe227('0x1b')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0xa593b5,'json':!![]};return rp(_0x35f8e1);}function startRefreshInterval(_0x3bbaa7){var _0x30c6d7=schedule[_0xe227('0x43')];if(_0x30c6d7[_0x3bbaa7['id']])clearInterval(_0x30c6d7[_0x3bbaa7['id']]);_0x30c6d7[_0x3bbaa7['id']]=setInterval(refreshOauth2MicrosoftAccessToken[_0xe227('0x44')](this,{'id':_0x3bbaa7['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule[_0xe227('0x43')]=_0x30c6d7;}function startAllRefreshIntervals(){return db[_0xe227('0x3c')][_0xe227('0x45')]({'where':{'data6':{'$ne':null}},'raw':!![]})[_0xe227('0x3a')](function(_0x5a6399){var _0x2b825f=_0x5a6399[_0xe227('0x14')](function(_0x35f9b8){return refreshOauth2MicrosoftAccessToken(_0x35f9b8)[_0xe227('0x3a')](function(_0x529847){startRefreshInterval(_0x529847);});});return Promise['all'](_0x2b825f);})[_0xe227('0x46')](function(_0x12614d){var _0x525040=_0x12614d?util['inspect'](_0x12614d,{'showHidden':![],'depth':null}):'';logger[_0xe227('0x47')](_0xe227('0x48'),_0x525040);});}module['exports']={'generateMicrosoftAuthorizationUrl':generateMicrosoftAuthorizationUrl,'getOauth2MicrosoftAccessToken':getOauth2MicrosoftAccessToken,'isValidIdToken':isValidIdToken,'startAllRefreshIntervals':startAllRefreshIntervals,'refreshOauth2MicrosoftAccessToken':refreshOauth2MicrosoftAccessToken,'startRefreshInterval':startRefreshInterval}; \ No newline at end of file +var _0x3118=['data4','form_post','scope','state','nonce','prompt','login','map','key','value','oauth2Claims','oauth2/','set','stringify','decode','iss','issuer','aud','audience','isAfter','unix','exp','then','data3','CloudProvider','findOne','refresh_token','{TENANT_ID}','data2','access_token','data6','update','data5','catch','error','Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s','authorization_code','decryptString','POST','intervals','bind','findAll','all','inspect','[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s','exports','lodash','crypto','jsonwebtoken','util','../../config/environment','../../config/logger','api','../../config/schedule/cloud-provider','../../mysqldb','defaults','redis','localhost','https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0','profile','email','offline_access','https://outlook.office365.com/IMAP.AccessAsUser.All','openid','/authorize','/token','type','data7','/.default','join','Dynamics365','replace','from','toString','base64','hex','client_id','data1','response_type','redirect_uri'];(function(_0x32faea,_0x3235d7){var _0x152fe9=function(_0x2f83e7){while(--_0x2f83e7){_0x32faea['push'](_0x32faea['shift']());}};_0x152fe9(++_0x3235d7);}(_0x3118,0x7e));var _0x8311=function(_0x50007c,_0x1cbf11){_0x50007c=_0x50007c-0x0;var _0x5c1ec7=_0x3118[_0x50007c];return _0x5c1ec7;};'use strict';var _=require(_0x8311('0x0'));var crypto=require(_0x8311('0x1'));var jwt=require(_0x8311('0x2'));var moment=require('moment');var Redis=require('ioredis');var rp=require('request-promise');var util=require(_0x8311('0x3'));var encryptor=require('../../components/encryptor');var config=require(_0x8311('0x4'));var logger=require(_0x8311('0x5'))(_0x8311('0x6'));var schedule=require(_0x8311('0x7'));var db=require(_0x8311('0x8'))['db'];config['redis']=_[_0x8311('0x9')](config[_0x8311('0xa')],{'host':_0x8311('0xb'),'port':0x18eb});var redis=new Redis(config[_0x8311('0xa')]);var MICROSOFT_AUTH_URL=_0x8311('0xc');var AZURE_AUTH_SCOPES={'Outlook365':['openid',_0x8311('0xd'),_0x8311('0xe'),_0x8311('0xf'),_0x8311('0x10'),'https://outlook.office.com/POP.AccessAsUser.All','https://outlook.office.com/SMTP.Send'],'Dynamics365':[_0x8311('0x11'),_0x8311('0xf')]};var MICROSOFT_AUTH_ENDPOINT=_0x8311('0x12');var MICROSOFT_TOKEN_ENDPOINT=_0x8311('0x13');var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x32f6e8){var _0x564e42=_['map'](AZURE_AUTH_SCOPES[_0x32f6e8[_0x8311('0x14')]]);if(_0x32f6e8[_0x8311('0x14')]==='Dynamics365')_0x564e42['push'](_0x32f6e8[_0x8311('0x15')]+_0x8311('0x16'));return _0x564e42[_0x8311('0x17')]('\x20');}function getAccessTokenScope(_0x47a059){if(_0x47a059['type']==='Outlook365')return _0x8311('0x10');if(_0x47a059[_0x8311('0x14')]===_0x8311('0x18'))return _0x47a059[_0x8311('0x15')]+_0x8311('0x16');}function generateMicrosoftAuthorizationUrl(_0x3f6157,_0x4f904b){var _0x50b927=MICROSOFT_AUTH_URL[_0x8311('0x19')]('{TENANT_ID}',_0x3f6157['data2']);var _0x1ed1da=['code','id_token'];var _0x548850=Buffer[_0x8311('0x1a')](JSON['stringify']({'id':_0x4f904b}))[_0x8311('0x1b')](_0x8311('0x1c'));var _0x45d11a=crypto['randomBytes'](0x10)[_0x8311('0x1b')](_0x8311('0x1d'));var _0x82491b=getAuthorizationScopes(_0x3f6157);var _0x1e1518=[{'key':_0x8311('0x1e'),'value':_0x3f6157[_0x8311('0x1f')]},{'key':_0x8311('0x20'),'value':encodeURIComponent(_0x1ed1da[_0x8311('0x17')]('\x20'))},{'key':_0x8311('0x21'),'value':_0x3f6157[_0x8311('0x22')]},{'key':'response_mode','value':_0x8311('0x23')},{'key':_0x8311('0x24'),'value':encodeURIComponent(_0x82491b)},{'key':_0x8311('0x25'),'value':_0x548850},{'key':_0x8311('0x26'),'value':_0x45d11a},{'key':_0x8311('0x27'),'value':_0x8311('0x28')}];var _0x2b5cc6=_0x50b927+MICROSOFT_AUTH_ENDPOINT+'?'+_[_0x8311('0x29')](_0x1e1518,function(_0x3c8549){return _0x3c8549[_0x8311('0x2a')]+'='+_0x3c8549[_0x8311('0x2b')];})[_0x8311('0x17')]('&');_0x3f6157[_0x8311('0x2c')]={'issuer':_0x50b927[_0x8311('0x19')](_0x8311('0x2d'),''),'audience':_0x3f6157[_0x8311('0x1f')],'state':_0x548850,'nonce':_0x45d11a};redis[_0x8311('0x2e')](_0x548850,JSON[_0x8311('0x2f')](_0x3f6157));return _0x2b5cc6;}function isValidIdToken(_0x158a6d,_0x6c6aeb){try{var _0x5460a9=jwt[_0x8311('0x30')](_0x158a6d,{'complete':!![]});var _0x16d446=_0x5460a9['payload'];if(_0x16d446[_0x8311('0x31')]!==_0x6c6aeb[_0x8311('0x32')])return![];if(_0x16d446[_0x8311('0x33')]!==_0x6c6aeb[_0x8311('0x34')])return![];if(_0x16d446['nonce']!==_0x6c6aeb[_0x8311('0x26')])return![];if(moment()[_0x8311('0x35')](moment[_0x8311('0x36')](_0x16d446[_0x8311('0x37')])))return![];return!![];}catch(_0x4a3eaf){throw _0x4a3eaf;}}function refreshOauth2MicrosoftAccessToken(_0x3abc07){return Promise['resolve']()[_0x8311('0x38')](function(){if(_0x3abc07[_0x8311('0x39')])return _0x3abc07;return db[_0x8311('0x3a')][_0x8311('0x3b')]({'where':{'id':_0x3abc07['id']},'raw':!![]});})[_0x8311('0x38')](function(_0xf1073a){var _0x24726e={'grant_type':_0x8311('0x3c'),'refresh_token':_0xf1073a['data6'],'scope':getAccessTokenScope(_0xf1073a),'redirect_uri':_0xf1073a[_0x8311('0x22')],'client_id':_0xf1073a['data1'],'client_secret':encryptor['decryptString'](_0xf1073a[_0x8311('0x39')])};var _0x162d46={'method':'POST','uri':MICROSOFT_AUTH_URL[_0x8311('0x19')](_0x8311('0x3d'),_0xf1073a[_0x8311('0x3e')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x24726e,'json':!![]};return rp(_0x162d46);})[_0x8311('0x38')](function(_0x32e10a){_0x3abc07['data5']=_0x32e10a[_0x8311('0x3f')];_0x3abc07[_0x8311('0x40')]=_0x32e10a[_0x8311('0x3c')];return db[_0x8311('0x3a')][_0x8311('0x41')]({'data5':_0x3abc07[_0x8311('0x42')],'data6':_0x3abc07[_0x8311('0x40')]},{'where':{'id':_0x3abc07['id']}});})[_0x8311('0x38')](function(){return _0x3abc07;})[_0x8311('0x43')](function(_0x599bb3){logger[_0x8311('0x44')](_0x8311('0x45'),_0x3abc07['id'],_0x599bb3);});}function getOauth2MicrosoftAccessToken(_0x5502e4,_0x258ed1){var _0x302313={'grant_type':_0x8311('0x46'),'code':_0x5502e4,'scope':getAccessTokenScope(_0x258ed1),'redirect_uri':_0x258ed1[_0x8311('0x22')],'client_id':_0x258ed1[_0x8311('0x1f')],'client_secret':encryptor[_0x8311('0x47')](_0x258ed1[_0x8311('0x39')])};var _0x119e4d={'method':_0x8311('0x48'),'uri':MICROSOFT_AUTH_URL[_0x8311('0x19')](_0x8311('0x3d'),_0x258ed1[_0x8311('0x3e')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x302313,'json':!![]};return rp(_0x119e4d);}function startRefreshInterval(_0x5591e8){var _0xa9d474=schedule[_0x8311('0x49')];if(_0xa9d474[_0x5591e8['id']])clearInterval(_0xa9d474[_0x5591e8['id']]);_0xa9d474[_0x5591e8['id']]=setInterval(refreshOauth2MicrosoftAccessToken[_0x8311('0x4a')](this,{'id':_0x5591e8['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule['intervals']=_0xa9d474;}function startAllRefreshIntervals(){return db[_0x8311('0x3a')][_0x8311('0x4b')]({'where':{'data6':{'$ne':null}},'raw':!![]})[_0x8311('0x38')](function(_0x340a2f){var _0x3300de=_0x340a2f[_0x8311('0x29')](function(_0x529ba6){return refreshOauth2MicrosoftAccessToken(_0x529ba6)[_0x8311('0x38')](function(_0xbdc990){startRefreshInterval(_0xbdc990);});});return Promise[_0x8311('0x4c')](_0x3300de);})[_0x8311('0x43')](function(_0x4be096){var _0x33a302=_0x4be096?util[_0x8311('0x4d')](_0x4be096,{'showHidden':![],'depth':null}):'';logger[_0x8311('0x44')](_0x8311('0x4e'),_0x33a302);});}module[_0x8311('0x4f')]={'generateMicrosoftAuthorizationUrl':generateMicrosoftAuthorizationUrl,'getOauth2MicrosoftAccessToken':getOauth2MicrosoftAccessToken,'isValidIdToken':isValidIdToken,'startAllRefreshIntervals':startAllRefreshIntervals,'refreshOauth2MicrosoftAccessToken':refreshOauth2MicrosoftAccessToken,'startRefreshInterval':startRefreshInterval}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.rpc.js b/server/api/cloudProvider/cloudProvider.rpc.js index 5987229..d4d72bc 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 _0x26c2=['request\x20sent','debug','CloudProvider,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','CloudProvider,\x20%s,\x20%s'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x26c2,0x1d6));var _0x226c=function(_0x3a54b1,_0x2a93cd){_0x3a54b1=_0x3a54b1-0x0;var _0x5b451b=_0x26c2[_0x3a54b1];return _0x5b451b;};'use strict';var _=require('lodash');var util=require(_0x226c('0x0'));var moment=require(_0x226c('0x1'));var BPromise=require(_0x226c('0x2'));var rs=require(_0x226c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x226c('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x226c('0x5'))(_0x226c('0x6'));var config=require(_0x226c('0x7'));var jayson=require(_0x226c('0x8'));var client=jayson[_0x226c('0x9')][_0x226c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x23ccdb,_0x50654d,_0x58ebd8){return new BPromise(function(_0x53fc4f,_0x10cae2){return client[_0x226c('0xb')](_0x23ccdb,_0x58ebd8)['then'](function(_0x475e09){logger[_0x226c('0xc')](_0x226c('0xd'),_0x50654d,_0x226c('0xe'));logger[_0x226c('0xf')](_0x226c('0x10'),_0x50654d,_0x226c('0xe'),JSON['stringify'](_0x475e09));if(_0x475e09['error']){if(_0x475e09[_0x226c('0x11')][_0x226c('0x12')]===0x1f4){logger[_0x226c('0x11')](_0x226c('0xd'),_0x50654d,_0x475e09['error']['message']);return _0x10cae2(_0x475e09[_0x226c('0x11')][_0x226c('0x13')]);}logger[_0x226c('0x11')](_0x226c('0xd'),_0x50654d,_0x475e09[_0x226c('0x11')]['message']);return _0x53fc4f(_0x475e09[_0x226c('0x11')][_0x226c('0x13')]);}else{logger[_0x226c('0xc')]('CloudProvider,\x20%s,\x20%s',_0x50654d,_0x226c('0xe'));_0x53fc4f(_0x475e09[_0x226c('0x14')][_0x226c('0x13')]);}})[_0x226c('0x15')](function(_0x3b6d9a){logger[_0x226c('0x11')](_0x226c('0xd'),_0x50654d,_0x3b6d9a);_0x10cae2(_0x3b6d9a);});});} \ No newline at end of file +var _0x1c77=['randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','request\x20sent','debug','CloudProvider,\x20%s,\x20%s,\x20%s','stringify','error','code','CloudProvider,\x20%s,\x20%s','message','info','result','catch','util','moment','bluebird'];(function(_0x179b7b,_0x57b44d){var _0x5eea20=function(_0x5582aa){while(--_0x5582aa){_0x179b7b['push'](_0x179b7b['shift']());}};_0x5eea20(++_0x57b44d);}(_0x1c77,0xed));var _0x71c7=function(_0x207811,_0x3420a6){_0x207811=_0x207811-0x0;var _0x170d56=_0x1c77[_0x207811];return _0x170d56;};'use strict';var _=require('lodash');var util=require(_0x71c7('0x0'));var moment=require(_0x71c7('0x1'));var BPromise=require(_0x71c7('0x2'));var rs=require(_0x71c7('0x3'));var fs=require('fs');var Redis=require(_0x71c7('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x71c7('0x5'));var logger=require(_0x71c7('0x6'))(_0x71c7('0x7'));var config=require(_0x71c7('0x8'));var jayson=require(_0x71c7('0x9'));var client=jayson[_0x71c7('0xa')][_0x71c7('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x57fb10,_0x57bbb6,_0x2c25a4){return new BPromise(function(_0x244867,_0x229b00){return client[_0x71c7('0xc')](_0x57fb10,_0x2c25a4)['then'](function(_0x1f5fc9){logger['info']('CloudProvider,\x20%s,\x20%s',_0x57bbb6,_0x71c7('0xd'));logger[_0x71c7('0xe')](_0x71c7('0xf'),_0x57bbb6,_0x71c7('0xd'),JSON[_0x71c7('0x10')](_0x1f5fc9));if(_0x1f5fc9['error']){if(_0x1f5fc9[_0x71c7('0x11')][_0x71c7('0x12')]===0x1f4){logger[_0x71c7('0x11')](_0x71c7('0x13'),_0x57bbb6,_0x1f5fc9['error'][_0x71c7('0x14')]);return _0x229b00(_0x1f5fc9[_0x71c7('0x11')][_0x71c7('0x14')]);}logger[_0x71c7('0x11')](_0x71c7('0x13'),_0x57bbb6,_0x1f5fc9[_0x71c7('0x11')]['message']);return _0x244867(_0x1f5fc9['error'][_0x71c7('0x14')]);}else{logger[_0x71c7('0x15')](_0x71c7('0x13'),_0x57bbb6,_0x71c7('0xd'));_0x244867(_0x1f5fc9[_0x71c7('0x16')][_0x71c7('0x14')]);}})[_0x71c7('0x17')](function(_0x115262){logger['error'](_0x71c7('0x13'),_0x57bbb6,_0x115262);_0x229b00(_0x115262);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index 6a708ef..96a3747 100644 --- a/server/api/cloudProvider/index.js +++ b/server/api/cloudProvider/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f2f=['exports','express','Router','../../components/auth/service','./cloudProvider.controller','get','isAuthenticated','index','show','post','create','put','/:id','update','delete','destroy','/:id/oauth2/microsoft/authorize/','oauth2MicrosoftAuthorize','oauth2MicrosoftCallback'];(function(_0x35ef6b,_0x202c42){var _0x3ad145=function(_0x3092de){while(--_0x3092de){_0x35ef6b['push'](_0x35ef6b['shift']());}};_0x3ad145(++_0x202c42);}(_0x5f2f,0x73));var _0xf5f2=function(_0x214c21,_0x545f27){_0x214c21=_0x214c21-0x0;var _0x34b2cf=_0x5f2f[_0x214c21];return _0x34b2cf;};'use strict';var express=require(_0xf5f2('0x0'));var router=express[_0xf5f2('0x1')]();var auth=require(_0xf5f2('0x2'));var controller=require(_0xf5f2('0x3'));router[_0xf5f2('0x4')]('/',auth[_0xf5f2('0x5')](),controller[_0xf5f2('0x6')]);router[_0xf5f2('0x4')]('/:id',auth['isAuthenticated'](),controller[_0xf5f2('0x7')]);router[_0xf5f2('0x8')]('/',auth[_0xf5f2('0x5')](),controller[_0xf5f2('0x9')]);router[_0xf5f2('0xa')](_0xf5f2('0xb'),auth['isAuthenticated'](),controller[_0xf5f2('0xc')]);router[_0xf5f2('0xd')](_0xf5f2('0xb'),auth['isAuthenticated'](),controller[_0xf5f2('0xe')]);router[_0xf5f2('0x4')](_0xf5f2('0xf'),auth['isAuthenticated'](),controller[_0xf5f2('0x10')]);router['post']('/oauth2/microsoft/callback',controller[_0xf5f2('0x11')]);module[_0xf5f2('0x12')]=router; \ No newline at end of file +var _0x7a54=['isAuthenticated','/:id','show','post','create','delete','/:id/oauth2/microsoft/authorize/','oauth2MicrosoftAuthorize','oauth2MicrosoftCallback','exports','express','Router','../../components/auth/service','get'];(function(_0x484e36,_0x4482d8){var _0xafc85d=function(_0xaba9c8){while(--_0xaba9c8){_0x484e36['push'](_0x484e36['shift']());}};_0xafc85d(++_0x4482d8);}(_0x7a54,0x106));var _0x47a5=function(_0x150930,_0x22a97b){_0x150930=_0x150930-0x0;var _0x3dce60=_0x7a54[_0x150930];return _0x3dce60;};'use strict';var express=require(_0x47a5('0x0'));var router=express[_0x47a5('0x1')]();var auth=require(_0x47a5('0x2'));var controller=require('./cloudProvider.controller');router[_0x47a5('0x3')]('/',auth[_0x47a5('0x4')](),controller['index']);router[_0x47a5('0x3')](_0x47a5('0x5'),auth[_0x47a5('0x4')](),controller[_0x47a5('0x6')]);router[_0x47a5('0x7')]('/',auth['isAuthenticated'](),controller[_0x47a5('0x8')]);router['put'](_0x47a5('0x5'),auth[_0x47a5('0x4')](),controller['update']);router[_0x47a5('0x9')]('/:id',auth['isAuthenticated'](),controller['destroy']);router[_0x47a5('0x3')](_0x47a5('0xa'),auth['isAuthenticated'](),controller[_0x47a5('0xb')]);router['post']('/oauth2/microsoft/callback',controller[_0x47a5('0xc')]);module[_0x47a5('0xd')]=router; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.attributes.js b/server/api/cmCompany/cmCompany.attributes.js index 162d2e4..01a586b 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 _0x4172=['sequelize','STRING','name'];(function(_0x541095,_0x582b30){var _0x5a2c40=function(_0xb7650f){while(--_0xb7650f){_0x541095['push'](_0x541095['shift']());}};_0x5a2c40(++_0x582b30);}(_0x4172,0x1aa));var _0x2417=function(_0x1293dc,_0x285c24){_0x1293dc=_0x1293dc-0x0;var _0x3f8089=_0x4172[_0x1293dc];return _0x3f8089;};'use strict';var Sequelize=require(_0x2417('0x0'));module['exports']={'name':{'type':Sequelize[_0x2417('0x1')],'unique':_0x2417('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x2417('0x1')]},'companyId':{'type':Sequelize[_0x2417('0x1')]},'website':{'type':Sequelize[_0x2417('0x1')]},'phone':{'type':Sequelize['STRING']},'fax':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x2417('0x1')]},'street':{'type':Sequelize[_0x2417('0x1')]},'postalCode':{'type':Sequelize[_0x2417('0x1')]},'city':{'type':Sequelize[_0x2417('0x1')]},'country':{'type':Sequelize[_0x2417('0x1')]},'email':{'type':Sequelize[_0x2417('0x1')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0x2417('0x1')]},'sStreet':{'type':Sequelize['STRING']},'sPostalCode':{'type':Sequelize[_0x2417('0x1')]},'sCity':{'type':Sequelize[_0x2417('0x1')]},'sCountry':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x2417('0x1')]}}; \ No newline at end of file +var _0xbf22=['sequelize','exports','name','STRING'];(function(_0x3a5ac2,_0x4c9440){var _0x3df059=function(_0x5c04a4){while(--_0x5c04a4){_0x3a5ac2['push'](_0x3a5ac2['shift']());}};_0x3df059(++_0x4c9440);}(_0xbf22,0x11c));var _0x2bf2=function(_0x293fc0,_0x6e53d9){_0x293fc0=_0x293fc0-0x0;var _0x1e1a7c=_0xbf22[_0x293fc0];return _0x1e1a7c;};'use strict';var Sequelize=require(_0x2bf2('0x0'));module[_0x2bf2('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x2bf2('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize['STRING']},'companyId':{'type':Sequelize[_0x2bf2('0x3')]},'website':{'type':Sequelize[_0x2bf2('0x3')]},'phone':{'type':Sequelize[_0x2bf2('0x3')]},'fax':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x2bf2('0x3')]},'street':{'type':Sequelize[_0x2bf2('0x3')]},'postalCode':{'type':Sequelize[_0x2bf2('0x3')]},'city':{'type':Sequelize[_0x2bf2('0x3')]},'country':{'type':Sequelize[_0x2bf2('0x3')]},'email':{'type':Sequelize[_0x2bf2('0x3')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize['STRING']},'sStreet':{'type':Sequelize[_0x2bf2('0x3')]},'sPostalCode':{'type':Sequelize[_0x2bf2('0x3')]},'sCity':{'type':Sequelize[_0x2bf2('0x3')]},'sCountry':{'type':Sequelize[_0x2bf2('0x3')]},'description':{'type':Sequelize[_0x2bf2('0x3')]}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index d2dc0a8..4daf7a7 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 _0xb10d=['send','index','CmCompany','describe','model','keys','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','merge','options','includeAll','include','findAll','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addContacts','ids','omit','getContacts','findOne','CmContact','pick','filter','map','eml-format','rimraf','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','destroy','then','get','Companies','UserProfileResource','error','stack','name'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0xb10d,0x132));var _0xdb10=function(_0x10b466,_0x18194f){_0x10b466=_0x10b466-0x0;var _0x2e860a=_0xb10d[_0x10b466];return _0x2e860a;};'use strict';var emlformat=require(_0xdb10('0x0'));var rimraf=require(_0xdb10('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xdb10('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xdb10('0x3'));var Mustache=require(_0xdb10('0x4'));var util=require(_0xdb10('0x5'));var path=require(_0xdb10('0x6'));var sox=require(_0xdb10('0x7'));var csv=require(_0xdb10('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xdb10('0x9'));var _=require('lodash');var squel=require(_0xdb10('0xa'));var crypto=require(_0xdb10('0xb'));var jsforce=require(_0xdb10('0xc'));var deskjs=require(_0xdb10('0xd'));var toCsv=require(_0xdb10('0x8'));var querystring=require('querystring');var Papa=require(_0xdb10('0xe'));var Redis=require('ioredis');var authService=require(_0xdb10('0xf'));var qs=require(_0xdb10('0x10'));var as=require(_0xdb10('0x11'));var hardwareService=require(_0xdb10('0x12'));var logger=require(_0xdb10('0x13'))(_0xdb10('0x14'));var utils=require(_0xdb10('0x15'));var config=require(_0xdb10('0x16'));var licenseUtil=require(_0xdb10('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x39fa93,_0x1df989){_0x1df989=_0x1df989||0xcc;return function(_0x3401e0){if(_0x3401e0){return _0x39fa93[_0xdb10('0x18')](_0x1df989);}return _0x39fa93[_0xdb10('0x19')](_0x1df989)[_0xdb10('0x1a')]();};}function respondWithResult(_0x25bbed,_0x2c8df9){_0x2c8df9=_0x2c8df9||0xc8;return function(_0x4dc75d){if(_0x4dc75d){return _0x25bbed[_0xdb10('0x19')](_0x2c8df9)[_0xdb10('0x1b')](_0x4dc75d);}};}function respondWithFilteredResult(_0x168f30,_0x508824){return function(_0x5f58c0){if(_0x5f58c0){var _0x388441=typeof _0x508824['offset']===_0xdb10('0x1c')&&typeof _0x508824[_0xdb10('0x1d')]===_0xdb10('0x1c');var _0x3ef485=_0x5f58c0[_0xdb10('0x1e')];var _0x263170=_0x388441?0x0:_0x508824[_0xdb10('0x1f')];var _0x1f5f47=_0x388441?_0x5f58c0['count']:_0x508824['offset']+_0x508824[_0xdb10('0x1d')];var _0x4b3b19;if(_0x1f5f47>=_0x3ef485){_0x1f5f47=_0x3ef485;_0x4b3b19=0xc8;}else{_0x4b3b19=0xce;}_0x168f30[_0xdb10('0x19')](_0x4b3b19);return _0x168f30[_0xdb10('0x20')](_0xdb10('0x21'),_0x263170+'-'+_0x1f5f47+'/'+_0x3ef485)[_0xdb10('0x1b')](_0x5f58c0);}return null;};}function patchUpdates(_0x93883){return function(_0x44b880){try{jsonpatch[_0xdb10('0x22')](_0x44b880,_0x93883,!![]);}catch(_0x58216f){return BPromise[_0xdb10('0x23')](_0x58216f);}return _0x44b880[_0xdb10('0x24')]();};}function saveUpdates(_0x4709b4,_0x445919){return function(_0x134cfc){if(_0x134cfc){return _0x134cfc[_0xdb10('0x25')](_0x4709b4)['then'](function(_0x491161){return _0x491161;});}return null;};}function removeEntity(_0x2b31c7,_0x250810){return function(_0x577e95){if(_0x577e95){return _0x577e95[_0xdb10('0x26')]()[_0xdb10('0x27')](function(){var _0x2185b2=_0x577e95[_0xdb10('0x28')]({'plain':!![]});var _0x1e7cc7=_0xdb10('0x29');return db[_0xdb10('0x2a')][_0xdb10('0x26')]({'where':{'type':_0x1e7cc7,'resourceId':_0x2185b2['id']}})[_0xdb10('0x27')](function(){return _0x577e95;});})[_0xdb10('0x27')](function(){_0x2b31c7[_0xdb10('0x19')](0xcc)[_0xdb10('0x1a')]();});}};}function handleEntityNotFound(_0x2d6998,_0x5f0d47){return function(_0x5995cc){if(!_0x5995cc){_0x2d6998['sendStatus'](0x194);}return _0x5995cc;};}function handleError(_0x3582d5,_0x3b6d77){_0x3b6d77=_0x3b6d77||0x1f4;return function(_0x47c633){logger[_0xdb10('0x2b')](_0x47c633[_0xdb10('0x2c')]);if(_0x47c633[_0xdb10('0x2d')]){delete _0x47c633[_0xdb10('0x2d')];}_0x3582d5['status'](_0x3b6d77)[_0xdb10('0x2e')](_0x47c633);};}exports[_0xdb10('0x2f')]=function(_0x4caefd,_0x46a728){var _0x1f04b0={},_0x59e77b={},_0x2468eb={'count':0x0,'rows':[]};return db[_0xdb10('0x30')][_0xdb10('0x31')]()[_0xdb10('0x27')](function(_0x11bcb9){_0x59e77b[_0xdb10('0x32')]=_[_0xdb10('0x33')](_0x11bcb9);_0x59e77b[_0xdb10('0x34')]=_[_0xdb10('0x33')](_0x4caefd['query']);_0x59e77b['filters']=_[_0xdb10('0x35')](_0x59e77b[_0xdb10('0x32')],_0x59e77b['query']);_0x1f04b0['attributes']=_['intersection'](_0x59e77b[_0xdb10('0x32')],qs['fields'](_0x4caefd['query'][_0xdb10('0x36')]));_0x1f04b0[_0xdb10('0x37')]=_0x1f04b0[_0xdb10('0x37')][_0xdb10('0x38')]?_0x1f04b0[_0xdb10('0x37')]:_0x59e77b['model'];if(!_0x4caefd[_0xdb10('0x34')][_0xdb10('0x39')](_0xdb10('0x3a'))){_0x1f04b0[_0xdb10('0x1d')]=qs[_0xdb10('0x1d')](_0x4caefd[_0xdb10('0x34')][_0xdb10('0x1d')]);_0x1f04b0['offset']=qs[_0xdb10('0x1f')](_0x4caefd[_0xdb10('0x34')][_0xdb10('0x1f')]);}_0x1f04b0[_0xdb10('0x3b')]=qs[_0xdb10('0x3c')](_0x4caefd[_0xdb10('0x34')][_0xdb10('0x3c')]);_0x1f04b0[_0xdb10('0x3d')]=qs[_0xdb10('0x3e')](_['pick'](_0x4caefd[_0xdb10('0x34')],_0x59e77b['filters']),_0x11bcb9);if(_0x4caefd[_0xdb10('0x34')]['filter']){_0x1f04b0[_0xdb10('0x3d')]=_[_0xdb10('0x3f')](_0x1f04b0['where'],{'$or':_['map'](_0x1f04b0['attributes'],function(_0x5b338a){var _0x1bb60e={};_0x1bb60e[_0x5b338a]={'$like':'%'+_0x4caefd[_0xdb10('0x34')]['filter']+'%'};return _0x1bb60e;})});}_0x1f04b0=_[_0xdb10('0x3f')]({},_0x1f04b0,_0x4caefd[_0xdb10('0x40')]);var _0x20261b={'where':_0x1f04b0[_0xdb10('0x3d')]};return db[_0xdb10('0x30')][_0xdb10('0x1e')](_0x20261b)['then'](function(_0x3f3009){_0x2468eb['count']=_0x3f3009;if(_0x4caefd[_0xdb10('0x34')][_0xdb10('0x41')]){_0x1f04b0[_0xdb10('0x42')]=[{'all':!![]}];}return db[_0xdb10('0x30')][_0xdb10('0x43')](_0x1f04b0);})['then'](function(_0x2d3561){_0x2468eb['rows']=_0x2d3561;return _0x2468eb;})[_0xdb10('0x27')](respondWithFilteredResult(_0x46a728,_0x1f04b0))[_0xdb10('0x44')](handleError(_0x46a728,null));})[_0xdb10('0x44')](handleError(_0x46a728,null));};exports[_0xdb10('0x45')]=function(_0x52cdc2,_0x19996d){var _0x4d2d4f={'raw':![],'where':{'id':_0x52cdc2[_0xdb10('0x46')]['id']}},_0x40ce47={};_0x40ce47[_0xdb10('0x32')]=_[_0xdb10('0x33')](db[_0xdb10('0x30')]['rawAttributes']);_0x40ce47[_0xdb10('0x34')]=_[_0xdb10('0x33')](_0x52cdc2[_0xdb10('0x34')]);_0x40ce47[_0xdb10('0x3e')]=_[_0xdb10('0x35')](_0x40ce47[_0xdb10('0x32')],_0x40ce47['query']);_0x4d2d4f['attributes']=_[_0xdb10('0x35')](_0x40ce47[_0xdb10('0x32')],qs[_0xdb10('0x36')](_0x52cdc2['query'][_0xdb10('0x36')]));_0x4d2d4f[_0xdb10('0x37')]=_0x4d2d4f[_0xdb10('0x37')]['length']?_0x4d2d4f[_0xdb10('0x37')]:_0x40ce47['model'];if(_0x52cdc2[_0xdb10('0x34')][_0xdb10('0x41')]){_0x4d2d4f[_0xdb10('0x42')]=[{'all':!![]}];}_0x4d2d4f=_[_0xdb10('0x3f')]({},_0x4d2d4f,_0x52cdc2[_0xdb10('0x40')]);return db[_0xdb10('0x30')][_0xdb10('0x47')](_0x4d2d4f)[_0xdb10('0x27')](handleEntityNotFound(_0x19996d,null))[_0xdb10('0x27')](respondWithResult(_0x19996d,null))[_0xdb10('0x44')](handleError(_0x19996d,null));};exports[_0xdb10('0x48')]=function(_0xe83e07,_0x4553c4){return db['CmCompany'][_0xdb10('0x48')](_0xe83e07[_0xdb10('0x49')],{})[_0xdb10('0x27')](function(_0x54ae80){var _0x2c0d47=_0xe83e07[_0xdb10('0x4a')][_0xdb10('0x28')]({'plain':!![]});if(!_0x2c0d47)throw new Error(_0xdb10('0x4b'));if(_0x2c0d47[_0xdb10('0x4c')]==='user'){var _0x168148=_0x54ae80[_0xdb10('0x28')]({'plain':!![]});var _0x497a18=_0xdb10('0x29');return db['UserProfileSection']['find']({'where':{'name':_0x497a18,'userProfileId':_0x2c0d47[_0xdb10('0x4d')]},'raw':!![]})['then'](function(_0x1eaafd){if(_0x1eaafd&&_0x1eaafd['autoAssociation']===0x0){return db[_0xdb10('0x2a')]['create']({'name':_0x168148['name'],'resourceId':_0x168148['id'],'type':_0x1eaafd[_0xdb10('0x2d')],'sectionId':_0x1eaafd['id']},{})['then'](function(){return _0x54ae80;});}else{return _0x54ae80;}})[_0xdb10('0x44')](function(_0x298687){logger[_0xdb10('0x2b')](_0xdb10('0x4e'),_0x298687);throw _0x298687;});}return _0x54ae80;})[_0xdb10('0x27')](respondWithResult(_0x4553c4,0xc9))[_0xdb10('0x44')](handleError(_0x4553c4,null));};exports['update']=function(_0x422424,_0x180e93){if(_0x422424[_0xdb10('0x49')]['id']){delete _0x422424[_0xdb10('0x49')]['id'];}return db['CmCompany'][_0xdb10('0x47')]({'where':{'id':_0x422424[_0xdb10('0x46')]['id']}})['then'](handleEntityNotFound(_0x180e93,null))['then'](saveUpdates(_0x422424[_0xdb10('0x49')],null))[_0xdb10('0x27')](respondWithResult(_0x180e93,null))['catch'](handleError(_0x180e93,null));};exports['destroy']=function(_0x5f30d1,_0x1a3f35){return db['CmCompany'][_0xdb10('0x47')]({'where':{'id':_0x5f30d1[_0xdb10('0x46')]['id']}})['then'](handleEntityNotFound(_0x1a3f35,null))[_0xdb10('0x27')](removeEntity(_0x1a3f35,null))[_0xdb10('0x44')](handleError(_0x1a3f35,null));};exports['describe']=function(_0x226bf7,_0xf03bb0){return db[_0xdb10('0x30')][_0xdb10('0x31')]()[_0xdb10('0x27')](respondWithResult(_0xf03bb0,null))[_0xdb10('0x44')](handleError(_0xf03bb0,null));};exports[_0xdb10('0x4f')]=function(_0x55e66f,_0x7df24f,_0x454c29){return db['CmContact']['find']({'where':{'id':_0x55e66f[_0xdb10('0x46')]['id']}})[_0xdb10('0x27')](handleEntityNotFound(_0x7df24f,null))[_0xdb10('0x27')](function(_0x40a7f1){if(_0x40a7f1){return _0x40a7f1[_0xdb10('0x4f')](_0x55e66f[_0xdb10('0x49')][_0xdb10('0x50')],_[_0xdb10('0x51')](_0x55e66f[_0xdb10('0x49')],[_0xdb10('0x50'),'id'])||{});}})['then'](respondWithResult(_0x7df24f,null))[_0xdb10('0x44')](handleError(_0x7df24f,null));};exports[_0xdb10('0x52')]=function(_0xf2e7e3,_0x3a9825,_0x311812){var _0x309cea={};var _0x398685={};var _0x3bff88;var _0x9a22a5;return db[_0xdb10('0x30')][_0xdb10('0x53')]({'where':{'id':_0xf2e7e3['params']['id']}})[_0xdb10('0x27')](handleEntityNotFound(_0x3a9825,null))['then'](function(_0x5390bc){if(_0x5390bc){_0x3bff88=_0x5390bc;_0x398685['model']=_[_0xdb10('0x33')](db[_0xdb10('0x54')]['rawAttributes']);_0x398685[_0xdb10('0x34')]=_[_0xdb10('0x33')](_0xf2e7e3[_0xdb10('0x34')]);_0x398685[_0xdb10('0x3e')]=_[_0xdb10('0x35')](_0x398685[_0xdb10('0x32')],_0x398685[_0xdb10('0x34')]);_0x309cea[_0xdb10('0x37')]=_[_0xdb10('0x35')](_0x398685[_0xdb10('0x32')],qs[_0xdb10('0x36')](_0xf2e7e3[_0xdb10('0x34')]['fields']));_0x309cea['attributes']=_0x309cea[_0xdb10('0x37')][_0xdb10('0x38')]?_0x309cea[_0xdb10('0x37')]:_0x398685[_0xdb10('0x32')];_0x309cea[_0xdb10('0x3b')]=qs[_0xdb10('0x3c')](_0xf2e7e3[_0xdb10('0x34')][_0xdb10('0x3c')]);_0x309cea[_0xdb10('0x3d')]=qs['filters'](_[_0xdb10('0x55')](_0xf2e7e3[_0xdb10('0x34')],_0x398685[_0xdb10('0x3e')]));if(_0xf2e7e3[_0xdb10('0x34')][_0xdb10('0x56')]){_0x309cea[_0xdb10('0x3d')]=_[_0xdb10('0x3f')](_0x309cea[_0xdb10('0x3d')],{'$or':_[_0xdb10('0x57')](_0x309cea['attributes'],function(_0x9d0161){var _0x59e5f2={};_0x59e5f2[_0x9d0161]={'$like':'%'+_0xf2e7e3[_0xdb10('0x34')][_0xdb10('0x56')]+'%'};return _0x59e5f2;})});}_0x309cea=_[_0xdb10('0x3f')]({},_0x309cea,_0xf2e7e3[_0xdb10('0x40')]);return _0x3bff88[_0xdb10('0x52')](_0x309cea);}})['then'](function(_0x58d648){if(_0x58d648){_0x9a22a5=_0x58d648[_0xdb10('0x38')];if(!_0xf2e7e3[_0xdb10('0x34')][_0xdb10('0x39')](_0xdb10('0x3a'))){_0x309cea['limit']=qs[_0xdb10('0x1d')](_0xf2e7e3[_0xdb10('0x34')]['limit']);_0x309cea[_0xdb10('0x1f')]=qs[_0xdb10('0x1f')](_0xf2e7e3[_0xdb10('0x34')][_0xdb10('0x1f')]);}return _0x3bff88['getContacts'](_0x309cea);}})[_0xdb10('0x27')](function(_0x45e689){if(_0x45e689){return _0x45e689?{'count':_0x9a22a5,'rows':_0x45e689}:null;}})[_0xdb10('0x27')](respondWithResult(_0x3a9825,null))[_0xdb10('0x44')](handleError(_0x3a9825,null));}; \ No newline at end of file +var _0x189f=['findAll','rows','catch','show','params','rawAttributes','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','update','addContacts','CmContact','ids','getContacts','findOne','sort','map','eml-format','fast-json-patch','moment','bluebird','util','path','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','then','destroy','get','Companies','UserProfileResource','error','stack','name','send','index','describe','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','filter','merge','options','includeAll','include','CmCompany'];(function(_0x14b741,_0x5caa3a){var _0x45b689=function(_0x349326){while(--_0x349326){_0x14b741['push'](_0x14b741['shift']());}};_0x45b689(++_0x5caa3a);}(_0x189f,0xd0));var _0xf189=function(_0x13f601,_0x4dc50f){_0x13f601=_0x13f601-0x0;var _0xad44c0=_0x189f[_0x13f601];return _0xad44c0;};'use strict';var emlformat=require(_0xf189('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xf189('0x1'));var rp=require('request-promise');var moment=require(_0xf189('0x2'));var BPromise=require(_0xf189('0x3'));var Mustache=require('mustache');var util=require(_0xf189('0x4'));var path=require(_0xf189('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf189('0x6'));var _=require(_0xf189('0x7'));var squel=require(_0xf189('0x8'));var crypto=require('crypto');var jsforce=require(_0xf189('0x9'));var deskjs=require(_0xf189('0xa'));var toCsv=require(_0xf189('0xb'));var querystring=require(_0xf189('0xc'));var Papa=require(_0xf189('0xd'));var Redis=require(_0xf189('0xe'));var authService=require(_0xf189('0xf'));var qs=require(_0xf189('0x10'));var as=require(_0xf189('0x11'));var hardwareService=require(_0xf189('0x12'));var logger=require(_0xf189('0x13'))(_0xf189('0x14'));var utils=require(_0xf189('0x15'));var config=require(_0xf189('0x16'));var licenseUtil=require(_0xf189('0x17'));var db=require(_0xf189('0x18'))['db'];function respondWithStatusCode(_0x4d1a7e,_0x2d14e5){_0x2d14e5=_0x2d14e5||0xcc;return function(_0x303575){if(_0x303575){return _0x4d1a7e[_0xf189('0x19')](_0x2d14e5);}return _0x4d1a7e[_0xf189('0x1a')](_0x2d14e5)[_0xf189('0x1b')]();};}function respondWithResult(_0x12dfcf,_0x36dfc0){_0x36dfc0=_0x36dfc0||0xc8;return function(_0xcd6f8f){if(_0xcd6f8f){return _0x12dfcf[_0xf189('0x1a')](_0x36dfc0)[_0xf189('0x1c')](_0xcd6f8f);}};}function respondWithFilteredResult(_0xefe15a,_0x25e646){return function(_0xe00868){if(_0xe00868){var _0x341b6f=typeof _0x25e646[_0xf189('0x1d')]===_0xf189('0x1e')&&typeof _0x25e646['limit']===_0xf189('0x1e');var _0x23e301=_0xe00868[_0xf189('0x1f')];var _0x2fab10=_0x341b6f?0x0:_0x25e646[_0xf189('0x1d')];var _0x30f8e7=_0x341b6f?_0xe00868[_0xf189('0x1f')]:_0x25e646[_0xf189('0x1d')]+_0x25e646[_0xf189('0x20')];var _0x23941f;if(_0x30f8e7>=_0x23e301){_0x30f8e7=_0x23e301;_0x23941f=0xc8;}else{_0x23941f=0xce;}_0xefe15a[_0xf189('0x1a')](_0x23941f);return _0xefe15a[_0xf189('0x21')](_0xf189('0x22'),_0x2fab10+'-'+_0x30f8e7+'/'+_0x23e301)[_0xf189('0x1c')](_0xe00868);}return null;};}function patchUpdates(_0x37b227){return function(_0x52f511){try{jsonpatch[_0xf189('0x23')](_0x52f511,_0x37b227,!![]);}catch(_0x5513d0){return BPromise[_0xf189('0x24')](_0x5513d0);}return _0x52f511[_0xf189('0x25')]();};}function saveUpdates(_0x32056d,_0x5e8c75){return function(_0x40e061){if(_0x40e061){return _0x40e061['update'](_0x32056d)[_0xf189('0x26')](function(_0x20d44f){return _0x20d44f;});}return null;};}function removeEntity(_0x13e872,_0x47df8e){return function(_0x52aeeb){if(_0x52aeeb){return _0x52aeeb[_0xf189('0x27')]()[_0xf189('0x26')](function(){var _0x1b7736=_0x52aeeb[_0xf189('0x28')]({'plain':!![]});var _0x273525=_0xf189('0x29');return db[_0xf189('0x2a')]['destroy']({'where':{'type':_0x273525,'resourceId':_0x1b7736['id']}})[_0xf189('0x26')](function(){return _0x52aeeb;});})[_0xf189('0x26')](function(){_0x13e872['status'](0xcc)[_0xf189('0x1b')]();});}};}function handleEntityNotFound(_0x9106b0,_0x4af020){return function(_0x50f4e1){if(!_0x50f4e1){_0x9106b0[_0xf189('0x19')](0x194);}return _0x50f4e1;};}function handleError(_0x54e8e2,_0x5a8083){_0x5a8083=_0x5a8083||0x1f4;return function(_0x3876fb){logger[_0xf189('0x2b')](_0x3876fb[_0xf189('0x2c')]);if(_0x3876fb[_0xf189('0x2d')]){delete _0x3876fb['name'];}_0x54e8e2[_0xf189('0x1a')](_0x5a8083)[_0xf189('0x2e')](_0x3876fb);};}exports[_0xf189('0x2f')]=function(_0x1f9155,_0x2389ce){var _0x1c63b6={},_0x352977={},_0x4c3157={'count':0x0,'rows':[]};return db['CmCompany'][_0xf189('0x30')]()['then'](function(_0xb9c9ed){_0x352977['model']=_['keys'](_0xb9c9ed);_0x352977['query']=_[_0xf189('0x31')](_0x1f9155[_0xf189('0x32')]);_0x352977[_0xf189('0x33')]=_[_0xf189('0x34')](_0x352977[_0xf189('0x35')],_0x352977[_0xf189('0x32')]);_0x1c63b6[_0xf189('0x36')]=_[_0xf189('0x34')](_0x352977['model'],qs[_0xf189('0x37')](_0x1f9155[_0xf189('0x32')][_0xf189('0x37')]));_0x1c63b6[_0xf189('0x36')]=_0x1c63b6[_0xf189('0x36')][_0xf189('0x38')]?_0x1c63b6[_0xf189('0x36')]:_0x352977[_0xf189('0x35')];if(!_0x1f9155[_0xf189('0x32')][_0xf189('0x39')](_0xf189('0x3a'))){_0x1c63b6[_0xf189('0x20')]=qs[_0xf189('0x20')](_0x1f9155[_0xf189('0x32')]['limit']);_0x1c63b6['offset']=qs['offset'](_0x1f9155[_0xf189('0x32')][_0xf189('0x1d')]);}_0x1c63b6[_0xf189('0x3b')]=qs['sort'](_0x1f9155[_0xf189('0x32')]['sort']);_0x1c63b6[_0xf189('0x3c')]=qs['filters'](_[_0xf189('0x3d')](_0x1f9155[_0xf189('0x32')],_0x352977[_0xf189('0x33')]),_0xb9c9ed);if(_0x1f9155['query'][_0xf189('0x3e')]){_0x1c63b6['where']=_['merge'](_0x1c63b6[_0xf189('0x3c')],{'$or':_['map'](_0x1c63b6[_0xf189('0x36')],function(_0x2d2d28){var _0x3e86ff={};_0x3e86ff[_0x2d2d28]={'$like':'%'+_0x1f9155['query'][_0xf189('0x3e')]+'%'};return _0x3e86ff;})});}_0x1c63b6=_[_0xf189('0x3f')]({},_0x1c63b6,_0x1f9155[_0xf189('0x40')]);var _0x35b2a1={'where':_0x1c63b6[_0xf189('0x3c')]};return db['CmCompany'][_0xf189('0x1f')](_0x35b2a1)[_0xf189('0x26')](function(_0xf9bfb7){_0x4c3157[_0xf189('0x1f')]=_0xf9bfb7;if(_0x1f9155[_0xf189('0x32')][_0xf189('0x41')]){_0x1c63b6[_0xf189('0x42')]=[{'all':!![]}];}return db[_0xf189('0x43')][_0xf189('0x44')](_0x1c63b6);})['then'](function(_0x3ae77d){_0x4c3157[_0xf189('0x45')]=_0x3ae77d;return _0x4c3157;})[_0xf189('0x26')](respondWithFilteredResult(_0x2389ce,_0x1c63b6))[_0xf189('0x46')](handleError(_0x2389ce,null));})[_0xf189('0x46')](handleError(_0x2389ce,null));};exports[_0xf189('0x47')]=function(_0x5dd99a,_0x1131d7){var _0x7386b5={'raw':![],'where':{'id':_0x5dd99a[_0xf189('0x48')]['id']}},_0x335f52={};_0x335f52[_0xf189('0x35')]=_['keys'](db[_0xf189('0x43')][_0xf189('0x49')]);_0x335f52['query']=_[_0xf189('0x31')](_0x5dd99a[_0xf189('0x32')]);_0x335f52[_0xf189('0x33')]=_['intersection'](_0x335f52['model'],_0x335f52[_0xf189('0x32')]);_0x7386b5['attributes']=_[_0xf189('0x34')](_0x335f52[_0xf189('0x35')],qs[_0xf189('0x37')](_0x5dd99a[_0xf189('0x32')][_0xf189('0x37')]));_0x7386b5[_0xf189('0x36')]=_0x7386b5['attributes'][_0xf189('0x38')]?_0x7386b5[_0xf189('0x36')]:_0x335f52[_0xf189('0x35')];if(_0x5dd99a[_0xf189('0x32')][_0xf189('0x41')]){_0x7386b5[_0xf189('0x42')]=[{'all':!![]}];}_0x7386b5=_[_0xf189('0x3f')]({},_0x7386b5,_0x5dd99a[_0xf189('0x40')]);return db[_0xf189('0x43')][_0xf189('0x4a')](_0x7386b5)[_0xf189('0x26')](handleEntityNotFound(_0x1131d7,null))[_0xf189('0x26')](respondWithResult(_0x1131d7,null))[_0xf189('0x46')](handleError(_0x1131d7,null));};exports[_0xf189('0x4b')]=function(_0x460bcf,_0x5e1c11){return db['CmCompany'][_0xf189('0x4b')](_0x460bcf[_0xf189('0x4c')],{})[_0xf189('0x26')](function(_0x15ec49){var _0x4231f0=_0x460bcf[_0xf189('0x4d')][_0xf189('0x28')]({'plain':!![]});if(!_0x4231f0)throw new Error(_0xf189('0x4e'));if(_0x4231f0[_0xf189('0x4f')]==='user'){var _0x259433=_0x15ec49[_0xf189('0x28')]({'plain':!![]});var _0x5a321b=_0xf189('0x29');return db[_0xf189('0x50')]['find']({'where':{'name':_0x5a321b,'userProfileId':_0x4231f0[_0xf189('0x51')]},'raw':!![]})[_0xf189('0x26')](function(_0x7d2f62){if(_0x7d2f62&&_0x7d2f62[_0xf189('0x52')]===0x0){return db['UserProfileResource'][_0xf189('0x4b')]({'name':_0x259433[_0xf189('0x2d')],'resourceId':_0x259433['id'],'type':_0x7d2f62[_0xf189('0x2d')],'sectionId':_0x7d2f62['id']},{})[_0xf189('0x26')](function(){return _0x15ec49;});}else{return _0x15ec49;}})[_0xf189('0x46')](function(_0x390e28){logger[_0xf189('0x2b')](_0xf189('0x53'),_0x390e28);throw _0x390e28;});}return _0x15ec49;})[_0xf189('0x26')](respondWithResult(_0x5e1c11,0xc9))[_0xf189('0x46')](handleError(_0x5e1c11,null));};exports[_0xf189('0x54')]=function(_0x5643f7,_0x21bafd){if(_0x5643f7[_0xf189('0x4c')]['id']){delete _0x5643f7['body']['id'];}return db[_0xf189('0x43')]['find']({'where':{'id':_0x5643f7[_0xf189('0x48')]['id']}})[_0xf189('0x26')](handleEntityNotFound(_0x21bafd,null))['then'](saveUpdates(_0x5643f7[_0xf189('0x4c')],null))[_0xf189('0x26')](respondWithResult(_0x21bafd,null))[_0xf189('0x46')](handleError(_0x21bafd,null));};exports[_0xf189('0x27')]=function(_0x383d11,_0x5639d5){return db['CmCompany'][_0xf189('0x4a')]({'where':{'id':_0x383d11[_0xf189('0x48')]['id']}})[_0xf189('0x26')](handleEntityNotFound(_0x5639d5,null))['then'](removeEntity(_0x5639d5,null))[_0xf189('0x46')](handleError(_0x5639d5,null));};exports[_0xf189('0x30')]=function(_0x228ff1,_0x5b682c){return db[_0xf189('0x43')]['describe']()[_0xf189('0x26')](respondWithResult(_0x5b682c,null))[_0xf189('0x46')](handleError(_0x5b682c,null));};exports[_0xf189('0x55')]=function(_0x3363e1,_0x545117,_0x5b2dea){return db[_0xf189('0x56')][_0xf189('0x4a')]({'where':{'id':_0x3363e1[_0xf189('0x48')]['id']}})[_0xf189('0x26')](handleEntityNotFound(_0x545117,null))[_0xf189('0x26')](function(_0x363cad){if(_0x363cad){return _0x363cad[_0xf189('0x55')](_0x3363e1[_0xf189('0x4c')][_0xf189('0x57')],_['omit'](_0x3363e1[_0xf189('0x4c')],['ids','id'])||{});}})[_0xf189('0x26')](respondWithResult(_0x545117,null))[_0xf189('0x46')](handleError(_0x545117,null));};exports[_0xf189('0x58')]=function(_0x2c76fc,_0x417c9b,_0x3eee11){var _0x3e9ad0={};var _0xcb775e={};var _0x4aaf70;var _0x235bf9;return db['CmCompany'][_0xf189('0x59')]({'where':{'id':_0x2c76fc[_0xf189('0x48')]['id']}})[_0xf189('0x26')](handleEntityNotFound(_0x417c9b,null))[_0xf189('0x26')](function(_0x51beb5){if(_0x51beb5){_0x4aaf70=_0x51beb5;_0xcb775e[_0xf189('0x35')]=_[_0xf189('0x31')](db[_0xf189('0x56')]['rawAttributes']);_0xcb775e[_0xf189('0x32')]=_[_0xf189('0x31')](_0x2c76fc[_0xf189('0x32')]);_0xcb775e[_0xf189('0x33')]=_[_0xf189('0x34')](_0xcb775e[_0xf189('0x35')],_0xcb775e[_0xf189('0x32')]);_0x3e9ad0['attributes']=_[_0xf189('0x34')](_0xcb775e['model'],qs['fields'](_0x2c76fc[_0xf189('0x32')][_0xf189('0x37')]));_0x3e9ad0[_0xf189('0x36')]=_0x3e9ad0[_0xf189('0x36')]['length']?_0x3e9ad0[_0xf189('0x36')]:_0xcb775e[_0xf189('0x35')];_0x3e9ad0[_0xf189('0x3b')]=qs[_0xf189('0x5a')](_0x2c76fc[_0xf189('0x32')][_0xf189('0x5a')]);_0x3e9ad0[_0xf189('0x3c')]=qs[_0xf189('0x33')](_[_0xf189('0x3d')](_0x2c76fc[_0xf189('0x32')],_0xcb775e[_0xf189('0x33')]));if(_0x2c76fc[_0xf189('0x32')][_0xf189('0x3e')]){_0x3e9ad0[_0xf189('0x3c')]=_[_0xf189('0x3f')](_0x3e9ad0[_0xf189('0x3c')],{'$or':_[_0xf189('0x5b')](_0x3e9ad0[_0xf189('0x36')],function(_0x6863da){var _0x5945fa={};_0x5945fa[_0x6863da]={'$like':'%'+_0x2c76fc[_0xf189('0x32')]['filter']+'%'};return _0x5945fa;})});}_0x3e9ad0=_[_0xf189('0x3f')]({},_0x3e9ad0,_0x2c76fc['options']);return _0x4aaf70[_0xf189('0x58')](_0x3e9ad0);}})[_0xf189('0x26')](function(_0x329256){if(_0x329256){_0x235bf9=_0x329256[_0xf189('0x38')];if(!_0x2c76fc[_0xf189('0x32')][_0xf189('0x39')]('nolimit')){_0x3e9ad0[_0xf189('0x20')]=qs['limit'](_0x2c76fc[_0xf189('0x32')]['limit']);_0x3e9ad0[_0xf189('0x1d')]=qs[_0xf189('0x1d')](_0x2c76fc[_0xf189('0x32')][_0xf189('0x1d')]);}return _0x4aaf70[_0xf189('0x58')](_0x3e9ad0);}})[_0xf189('0x26')](function(_0x17e3cc){if(_0x17e3cc){return _0x17e3cc?{'count':_0x235bf9,'rows':_0x17e3cc}:null;}})[_0xf189('0x26')](respondWithResult(_0x417c9b,null))[_0xf189('0x46')](handleError(_0x417c9b,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index cb81716..305ca54 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 _0x3446=['CmCompany','cm_companies','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','exports'];(function(_0x26c11f,_0x196f33){var _0x4ca44b=function(_0x215c31){while(--_0x215c31){_0x26c11f['push'](_0x26c11f['shift']());}};_0x4ca44b(++_0x196f33);}(_0x3446,0x152));var _0x6344=function(_0x2a98fa,_0x3ce464){_0x2a98fa=_0x2a98fa-0x0;var _0x92da7f=_0x3446[_0x2a98fa];return _0x92da7f;};'use strict';var _=require(_0x6344('0x0'));var util=require(_0x6344('0x1'));var logger=require(_0x6344('0x2'))(_0x6344('0x3'));var moment=require(_0x6344('0x4'));var BPromise=require(_0x6344('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6344('0x6'));var rimraf=require(_0x6344('0x7'));var config=require(_0x6344('0x8'));var attributes=require('./cmCompany.attributes');module[_0x6344('0x9')]=function(_0x5a70ba,_0x135c16){return _0x5a70ba['define'](_0x6344('0xa'),attributes,{'tableName':_0x6344('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc7c1=['../../config/environment','./cmCompany.attributes','exports','CmCompany','cm_companies','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x1b701d,_0xa83eac){var _0x271fd7=function(_0x54fdce){while(--_0x54fdce){_0x1b701d['push'](_0x1b701d['shift']());}};_0x271fd7(++_0xa83eac);}(_0xc7c1,0x1e6));var _0x1c7c=function(_0x156b37,_0x442e2e){_0x156b37=_0x156b37-0x0;var _0x12ae4c=_0xc7c1[_0x156b37];return _0x12ae4c;};'use strict';var _=require(_0x1c7c('0x0'));var util=require(_0x1c7c('0x1'));var logger=require(_0x1c7c('0x2'))('api');var moment=require(_0x1c7c('0x3'));var BPromise=require(_0x1c7c('0x4'));var rp=require(_0x1c7c('0x5'));var fs=require('fs');var path=require(_0x1c7c('0x6'));var rimraf=require(_0x1c7c('0x7'));var config=require(_0x1c7c('0x8'));var attributes=require(_0x1c7c('0x9'));module[_0x1c7c('0xa')]=function(_0x1f2b09,_0xbf22ab){return _0x1f2b09['define'](_0x1c7c('0xb'),attributes,{'tableName':_0x1c7c('0xc'),'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 3d87399..37128e1 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 _0x4166=['http','request','then','info','CmCompany,\x20%s,\x20%s','request\x20sent','CmCompany,\x20%s,\x20%s,\x20%s','error','message','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client'];(function(_0x38841c,_0x1af0bf){var _0x500610=function(_0x225955){while(--_0x225955){_0x38841c['push'](_0x38841c['shift']());}};_0x500610(++_0x1af0bf);}(_0x4166,0x82));var _0x6416=function(_0x2cad67,_0x30a165){_0x2cad67=_0x2cad67-0x0;var _0x557943=_0x4166[_0x2cad67];return _0x557943;};'use strict';var _=require(_0x6416('0x0'));var util=require('util');var moment=require(_0x6416('0x1'));var BPromise=require(_0x6416('0x2'));var rs=require(_0x6416('0x3'));var fs=require('fs');var Redis=require(_0x6416('0x4'));var db=require(_0x6416('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x6416('0x6'))(_0x6416('0x7'));var config=require(_0x6416('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x6416('0x9')][_0x6416('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x54a683,_0x5169ea,_0x180660){return new BPromise(function(_0x2e68ef,_0x99a990){return client[_0x6416('0xb')](_0x54a683,_0x180660)[_0x6416('0xc')](function(_0x2e72a3){logger[_0x6416('0xd')](_0x6416('0xe'),_0x5169ea,_0x6416('0xf'));logger['debug'](_0x6416('0x10'),_0x5169ea,_0x6416('0xf'),JSON['stringify'](_0x2e72a3));if(_0x2e72a3[_0x6416('0x11')]){if(_0x2e72a3['error']['code']===0x1f4){logger[_0x6416('0x11')](_0x6416('0xe'),_0x5169ea,_0x2e72a3[_0x6416('0x11')]['message']);return _0x99a990(_0x2e72a3[_0x6416('0x11')]['message']);}logger[_0x6416('0x11')](_0x6416('0xe'),_0x5169ea,_0x2e72a3[_0x6416('0x11')][_0x6416('0x12')]);return _0x2e68ef(_0x2e72a3[_0x6416('0x11')][_0x6416('0x12')]);}else{logger[_0x6416('0xd')](_0x6416('0xe'),_0x5169ea,_0x6416('0xf'));_0x2e68ef(_0x2e72a3['result'][_0x6416('0x12')]);}})[_0x6416('0x13')](function(_0x382a0d){logger[_0x6416('0x11')]('CmCompany,\x20%s,\x20%s',_0x5169ea,_0x382a0d);_0x99a990(_0x382a0d);});});} \ No newline at end of file +var _0x6ac0=['http','request','then','info','request\x20sent','debug','CmCompany,\x20%s,\x20%s,\x20%s','stringify','error','CmCompany,\x20%s,\x20%s','message','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0xb24a3e,_0x4a3594){var _0x4038d7=function(_0x1ea3c3){while(--_0x1ea3c3){_0xb24a3e['push'](_0xb24a3e['shift']());}};_0x4038d7(++_0x4a3594);}(_0x6ac0,0x17c));var _0x06ac=function(_0x199318,_0x217869){_0x199318=_0x199318-0x0;var _0x171a8d=_0x6ac0[_0x199318];return _0x171a8d;};'use strict';var _=require(_0x06ac('0x0'));var util=require(_0x06ac('0x1'));var moment=require(_0x06ac('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x06ac('0x3'));var db=require(_0x06ac('0x4'))['db'];var utils=require(_0x06ac('0x5'));var logger=require(_0x06ac('0x6'))(_0x06ac('0x7'));var config=require(_0x06ac('0x8'));var jayson=require(_0x06ac('0x9'));var client=jayson[_0x06ac('0xa')][_0x06ac('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5497f3,_0x4754e8,_0x1891b6){return new BPromise(function(_0x2e195c,_0x1c1441){return client[_0x06ac('0xc')](_0x5497f3,_0x1891b6)[_0x06ac('0xd')](function(_0x202068){logger[_0x06ac('0xe')]('CmCompany,\x20%s,\x20%s',_0x4754e8,_0x06ac('0xf'));logger[_0x06ac('0x10')](_0x06ac('0x11'),_0x4754e8,_0x06ac('0xf'),JSON[_0x06ac('0x12')](_0x202068));if(_0x202068['error']){if(_0x202068[_0x06ac('0x13')]['code']===0x1f4){logger[_0x06ac('0x13')](_0x06ac('0x14'),_0x4754e8,_0x202068[_0x06ac('0x13')][_0x06ac('0x15')]);return _0x1c1441(_0x202068['error'][_0x06ac('0x15')]);}logger[_0x06ac('0x13')](_0x06ac('0x14'),_0x4754e8,_0x202068[_0x06ac('0x13')][_0x06ac('0x15')]);return _0x2e195c(_0x202068[_0x06ac('0x13')][_0x06ac('0x15')]);}else{logger[_0x06ac('0xe')](_0x06ac('0x14'),_0x4754e8,_0x06ac('0xf'));_0x2e195c(_0x202068['result'][_0x06ac('0x15')]);}})[_0x06ac('0x16')](function(_0xb077c3){logger[_0x06ac('0x13')](_0x06ac('0x14'),_0x4754e8,_0xb077c3);_0x1c1441(_0xb077c3);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index d966745..2b85603 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 _0xa551=['isAuthenticated','describe','show','/:id/contacts','post','addContacts','put','/:id','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCompany.controller','get','/describe'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0xa551,0x16a));var _0x1a55=function(_0x308b8e,_0x3de00c){_0x308b8e=_0x308b8e-0x0;var _0x308324=_0xa551[_0x308b8e];return _0x308324;};'use strict';var multer=require(_0x1a55('0x0'));var util=require(_0x1a55('0x1'));var path=require('path');var timeout=require(_0x1a55('0x2'));var express=require(_0x1a55('0x3'));var router=express[_0x1a55('0x4')]();var fs_extra=require(_0x1a55('0x5'));var auth=require(_0x1a55('0x6'));var interaction=require(_0x1a55('0x7'));var config=require(_0x1a55('0x8'));var controller=require(_0x1a55('0x9'));router[_0x1a55('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0x1a55('0xa')](_0x1a55('0xb'),auth[_0x1a55('0xc')](),controller[_0x1a55('0xd')]);router[_0x1a55('0xa')]('/:id',auth[_0x1a55('0xc')](),controller[_0x1a55('0xe')]);router[_0x1a55('0xa')](_0x1a55('0xf'),auth[_0x1a55('0xc')](),controller['getContacts']);router[_0x1a55('0x10')]('/',auth['isAuthenticated'](),controller['create']);router['post'](_0x1a55('0xf'),auth['isAuthenticated'](),controller[_0x1a55('0x11')]);router[_0x1a55('0x12')](_0x1a55('0x13'),auth[_0x1a55('0xc')](),controller['update']);router['delete'](_0x1a55('0x13'),auth['isAuthenticated'](),controller[_0x1a55('0x14')]);module[_0x1a55('0x15')]=router; \ No newline at end of file +var _0x8d4d=['../../components/auth/service','../../components/interaction/service','./cmCompany.controller','isAuthenticated','describe','get','/:id','getContacts','/:id/contacts','addContacts','put','update','multer','path','connect-timeout','express','Router'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x8d4d,0x94));var _0xd8d4=function(_0x115497,_0x3e7156){_0x115497=_0x115497-0x0;var _0xccd20f=_0x8d4d[_0x115497];return _0xccd20f;};'use strict';var multer=require(_0xd8d4('0x0'));var util=require('util');var path=require(_0xd8d4('0x1'));var timeout=require(_0xd8d4('0x2'));var express=require(_0xd8d4('0x3'));var router=express[_0xd8d4('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xd8d4('0x5'));var interaction=require(_0xd8d4('0x6'));var config=require('../../config/environment');var controller=require(_0xd8d4('0x7'));router['get']('/',auth[_0xd8d4('0x8')](),controller['index']);router['get']('/describe',auth[_0xd8d4('0x8')](),controller[_0xd8d4('0x9')]);router[_0xd8d4('0xa')](_0xd8d4('0xb'),auth[_0xd8d4('0x8')](),controller['show']);router[_0xd8d4('0xa')]('/:id/contacts',auth[_0xd8d4('0x8')](),controller[_0xd8d4('0xc')]);router['post']('/',auth[_0xd8d4('0x8')](),controller['create']);router['post'](_0xd8d4('0xd'),auth[_0xd8d4('0x8')](),controller[_0xd8d4('0xe')]);router[_0xd8d4('0xf')](_0xd8d4('0xb'),auth['isAuthenticated'](),controller[_0xd8d4('0x10')]);router['delete'](_0xd8d4('0xb'),auth[_0xd8d4('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.attributes.js b/server/api/cmContact/cmContact.attributes.js index bae8f72..083d9ae 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 _0x54da=['UNSIGNED','NOW','INTEGER','sequelize','exports','STRING','TEXT'];(function(_0x511b76,_0x4727fa){var _0x5424ff=function(_0x24b7c0){while(--_0x24b7c0){_0x511b76['push'](_0x511b76['shift']());}};_0x5424ff(++_0x4727fa);}(_0x54da,0x106));var _0xa54d=function(_0x5699e7,_0xb9ca23){_0x5699e7=_0x5699e7-0x0;var _0x1e8559=_0x54da[_0x5699e7];return _0x1e8559;};'use strict';var _=require('lodash');var Sequelize=require(_0xa54d('0x0'));module[_0xa54d('0x1')]={'firstName':{'type':Sequelize[_0xa54d('0x2')],'allowNull':![]},'lastName':{'type':Sequelize[_0xa54d('0x2')]},'street':{'type':Sequelize[_0xa54d('0x2')]},'postalCode':{'type':Sequelize[_0xa54d('0x2')]},'city':{'type':Sequelize[_0xa54d('0x2')]},'country':{'type':Sequelize[_0xa54d('0x2')]},'dateOfBirth':{'type':Sequelize[_0xa54d('0x2')]},'description':{'type':Sequelize[_0xa54d('0x3')]},'phone':{'type':Sequelize[_0xa54d('0x2')]},'mobile':{'type':Sequelize[_0xa54d('0x2')]},'fax':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0xa54d('0x2')]},'url':{'type':Sequelize[_0xa54d('0x2')]},'facebook':{'type':Sequelize[_0xa54d('0x2')]},'fb_data':{'type':Sequelize[_0xa54d('0x2')]},'twitter':{'type':Sequelize[_0xa54d('0x2')]},'skype':{'type':Sequelize[_0xa54d('0x2')]},'teams':{'type':Sequelize[_0xa54d('0x2')]},'viber':{'type':Sequelize[_0xa54d('0x2')]},'line':{'type':Sequelize[_0xa54d('0x2')]},'wechat':{'type':Sequelize['STRING']},'telegram':{'type':Sequelize[_0xa54d('0x2')]},'UserId':{'type':Sequelize['INTEGER']},'AdditionalPhones':{'type':Sequelize['STRING']},'priority':{'type':Sequelize['INTEGER'](0x2)[_0xa54d('0x4')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':Sequelize[_0xa54d('0x5')]},'dialTimezone':{'type':Sequelize[_0xa54d('0x2')]},'utcOffset':{'type':Sequelize[_0xa54d('0x6')]}}; \ No newline at end of file +var _0x1071=['TEXT','INTEGER','UNSIGNED','DATE','NOW','lodash','exports','STRING'];(function(_0x3c6ff6,_0x4e136a){var _0x4ac5ba=function(_0x1da29e){while(--_0x1da29e){_0x3c6ff6['push'](_0x3c6ff6['shift']());}};_0x4ac5ba(++_0x4e136a);}(_0x1071,0x75));var _0x1107=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x1071[_0x3947c9];return _0x2e7871;};'use strict';var _=require(_0x1107('0x0'));var Sequelize=require('sequelize');module[_0x1107('0x1')]={'firstName':{'type':Sequelize[_0x1107('0x2')],'allowNull':![]},'lastName':{'type':Sequelize[_0x1107('0x2')]},'street':{'type':Sequelize[_0x1107('0x2')]},'postalCode':{'type':Sequelize[_0x1107('0x2')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0x1107('0x2')]},'dateOfBirth':{'type':Sequelize[_0x1107('0x2')]},'description':{'type':Sequelize[_0x1107('0x3')]},'phone':{'type':Sequelize[_0x1107('0x2')]},'mobile':{'type':Sequelize[_0x1107('0x2')]},'fax':{'type':Sequelize[_0x1107('0x2')]},'email':{'type':Sequelize[_0x1107('0x2')]},'url':{'type':Sequelize[_0x1107('0x2')]},'facebook':{'type':Sequelize[_0x1107('0x2')]},'fb_data':{'type':Sequelize[_0x1107('0x2')]},'twitter':{'type':Sequelize[_0x1107('0x2')]},'skype':{'type':Sequelize[_0x1107('0x2')]},'teams':{'type':Sequelize[_0x1107('0x2')]},'viber':{'type':Sequelize[_0x1107('0x2')]},'line':{'type':Sequelize['STRING']},'wechat':{'type':Sequelize[_0x1107('0x2')]},'telegram':{'type':Sequelize['STRING']},'UserId':{'type':Sequelize[_0x1107('0x4')]},'AdditionalPhones':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x1107('0x4')](0x2)[_0x1107('0x5')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x1107('0x6')],'defaultValue':Sequelize[_0x1107('0x7')]},'dialTimezone':{'type':Sequelize[_0x1107('0x2')]},'utcOffset':{'type':Sequelize[_0x1107('0x4')]}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index f145c5e..ff71bf8 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 _0xa8fa=['OpenchannelInteraction','CmContactHasItem','CmHopperFinal','ReportAgentPreview','VoiceCallReport','ChatQueueReport','SmsQueueReport','JscriptySessionReport','WhatsappInteraction','WhatsappMessage','WhatsappQueueReport','isArray','isNil','dialTimezone','timezones','utcOffset','additionalPhones','bulkCreate','duplicates','$or','push','where','ListId','findOrCreate','spread','hasOwnProperty','all','find','color','Phones','ContactItemType','ItemType','literal','Phones.OrderBy','$and','omit','format','cf_%d','isEmpty','table','toParam','sequelize','phone','getTags','findOne','model','rawAttributes','intersection','attributes','fields','sort','filters','pick','filter','map','nolimit','setTags','ids','items','item_types','ItemTypeId','description','OrderBy','PHONE','item','`ItemType`.OrderBy','CmHopperId','ItemType.OrderBy','CmHopperAdditionalPhone','duplicateAdditionalPhones','fromContactId','CmContactId','toContactId','rescheduleAdditionalPhones','hopperId','getHoppers','order','ContactId','options','includeAll','rows','getHopperHistories','CmHopperHistory','include','getHopperFinals','getJscriptySessions','uploadCsv','No\x20ListId\x20specified','binding_keys','No\x20association\x20keys\x20specified!','binding_values','socket_timestamp','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','split','zipObject','No\x20phone\x20column\x20specified','firstName','server/files/tmp','file','chmodSync','0777','fork','CompanyId','pid','upload','parse','meta','import','User','agent','binding','No\x20firstName\x20column\x20specified','child_process','stringify','message','exit','error\x20child\x20process','importUpdates','../../components/import/cm/csvUpdates','start\x20child\x20process\x20correctly!','getJourney','mail','sms','fax','voice','resolve','channel','includes','toLowerCase','Invalid\x20channel','range','Invalid\x20date\x20for\x20range\x20from\x20filter','isValid','Invalid\x20date\x20for\x20range\x20to\x20filter','Invalid\x20createdAt\x20filter','uniqueid','source','destination','callerid','starttime','endtime','duration','note','createdAt','userDisposition','userSecondDisposition','userThirdDisposition','UserId','findAndCountAll','fullname','startCase','chat','Account','closed','closedAt','secondDisposition','Owner','Tag','Tags','browserName','customerPort','deviceModel','osName','ratingMessage','ratingType','ratingValue','referer','subject','substatus','openchannel','externalUrl','threadId','Interaction','flatten','reverse','slice','moment','util','path','lodash','ioredis','../../components/contacts','../../components/parsers/qs','../../config/logger','../../config/environment','../../config/environment/shared','../../mysqldb','redis','localhost','status','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','end','sendStatus','name','index','describe','getOptions','findAll','user','catch','params','CmContact','tags','keys','length','startsWith','cf_','columnName','displayName','query','CmCustomField','alias','custom','type','values','info','Custom\x20field\x20%s\x20not\x20found\x20on\x20cm_contacts\x20table','forEach','merge','body','from','get','mergeWith','join','[CmContact][merge]\x20to\x20%s\x20from\x20%s','CmHopper','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','create','ChatInteraction','ChatMessage','ChatOfflineMessage','SmsMessage','FaxInteraction','FaxMessage'];(function(_0x560900,_0xefaf5a){var _0x399414=function(_0x388c9f){while(--_0x388c9f){_0x560900['push'](_0x560900['shift']());}};_0x399414(++_0xefaf5a);}(_0xa8fa,0x1a5));var _0xaa8f=function(_0x26cbe2,_0x21f2d3){_0x26cbe2=_0x26cbe2-0x0;var _0x231423=_0xa8fa[_0x26cbe2];return _0x231423;};'use strict';var moment=require(_0xaa8f('0x0'));var BPromise=require('bluebird');var util=require(_0xaa8f('0x1'));var path=require(_0xaa8f('0x2'));var fs=require('fs');var _=require(_0xaa8f('0x3'));var squel=require('squel');var Papa=require('papaparse');var Redis=require(_0xaa8f('0x4'));var contacts=require(_0xaa8f('0x5'));var qs=require(_0xaa8f('0x6'));var logger=require(_0xaa8f('0x7'))('api');var config=require(_0xaa8f('0x8'));var shared=require(_0xaa8f('0x9'));var db=require(_0xaa8f('0xa'))['db'];config[_0xaa8f('0xb')]=_['defaults'](config[_0xaa8f('0xb')],{'host':_0xaa8f('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xaa8f('0xb')]));require('./cmContact.socket')['register'](socket);function respondWithResult(_0xa4102d,_0x21cabe){_0x21cabe=_0x21cabe||0xc8;return function(_0x7665a3){if(_0x7665a3){return _0xa4102d[_0xaa8f('0xd')](_0x21cabe)[_0xaa8f('0xe')](_0x7665a3);}};}function respondWithFilteredResult(_0x27cb56,_0x5deb31){return function(_0x1864eb){if(_0x1864eb){var _0x145c99=typeof _0x5deb31[_0xaa8f('0xf')]===_0xaa8f('0x10')&&typeof _0x5deb31[_0xaa8f('0x11')]==='undefined';var _0x14c2d3=_0x1864eb['count'];var _0x2b018c=_0x145c99?0x0:_0x5deb31[_0xaa8f('0xf')];var _0x52ec27=_0x145c99?_0x1864eb[_0xaa8f('0x12')]:_0x5deb31[_0xaa8f('0xf')]+_0x5deb31[_0xaa8f('0x11')];var _0x67606e;if(_0x52ec27>=_0x14c2d3){_0x52ec27=_0x14c2d3;_0x67606e=0xc8;}else{_0x67606e=0xce;}_0x27cb56['status'](_0x67606e);return _0x27cb56[_0xaa8f('0x13')](_0xaa8f('0x14'),_0x2b018c+'-'+_0x52ec27+'/'+_0x14c2d3)[_0xaa8f('0xe')](_0x1864eb);}return null;};}function saveUpdates(_0x23deb4){return function(_0x4d3e43){if(_0x4d3e43){return _0x4d3e43[_0xaa8f('0x15')](_0x23deb4)[_0xaa8f('0x16')](function(_0x287947){return _0x287947;});}return null;};}function removeEntity(_0x336ac5){return function(_0x18cf9f){if(_0x18cf9f){return _0x18cf9f[_0xaa8f('0x17')]()[_0xaa8f('0x16')](function(){_0x336ac5['status'](0xcc)[_0xaa8f('0x18')]();});}};}function handleEntityNotFound(_0x38f7e8){return function(_0x5c7228){if(!_0x5c7228){_0x38f7e8[_0xaa8f('0x19')](0x194);}return _0x5c7228;};}function handleError(_0x4ec3e8,_0x2a72fd){_0x2a72fd=_0x2a72fd||0x1f4;return function(_0x3a17cf){logger['error'](_0x3a17cf['stack']);if(_0x3a17cf[_0xaa8f('0x1a')]){delete _0x3a17cf['name'];}_0x4ec3e8['status'](_0x2a72fd)['send'](_0x3a17cf);};}exports[_0xaa8f('0x1b')]=function(_0x172aa6,_0x1c069f){var _0x2c97a8={};return contacts[_0xaa8f('0x1c')]()[_0xaa8f('0x16')](function(_0xe6b3d8){_0x2c97a8=qs[_0xaa8f('0x1d')](_0xe6b3d8,_0x172aa6);return contacts[_0xaa8f('0x1e')](_0x172aa6['query'],_0x172aa6[_0xaa8f('0x1f')],_0x2c97a8,_0xe6b3d8);})[_0xaa8f('0x16')](respondWithFilteredResult(_0x1c069f,_0x2c97a8))[_0xaa8f('0x20')](handleError(_0x1c069f,null));};exports['destroy']=function(_0x2dad2a,_0xce5d2f){return db['CmContact']['find']({'where':{'id':_0x2dad2a[_0xaa8f('0x21')]['id']}})[_0xaa8f('0x16')](handleEntityNotFound(_0xce5d2f,null))[_0xaa8f('0x16')](removeEntity(_0xce5d2f,null))[_0xaa8f('0x20')](handleError(_0xce5d2f,null));};exports[_0xaa8f('0x1c')]=function(_0x3794b5,_0x298fd9){return db[_0xaa8f('0x22')][_0xaa8f('0x1c')]()[_0xaa8f('0x16')](function(_0x9a4b54){delete _0x9a4b54[_0xaa8f('0x23')];for(var _0x59c53d=0x0;_0x59c53d0x0){return new Promise(function(_0x8f0753){var _0x13bf88=[];for(var _0x1f0b3b=0x0;_0x1f0b3b<_0x2bb822[_0xaa8f('0x25')];_0x1f0b3b++){_0x13bf88[_0xaa8f('0x59')](insertAdditionalPhones(_0x2bb822[_0x1f0b3b]['contact'],_0x2bb822[_0x1f0b3b][_0xaa8f('0x55')]));}Promise[_0xaa8f('0x5f')](_0x13bf88)[_0xaa8f('0x16')](function(){_0x8f0753(0x1);});})[_0xaa8f('0x16')](function(){return{'success':_0x1b0c72,'failure':_0x343141,'duplicates':_0x29d60b};});}else{return{'success':_0x1b0c72,'failure':_0x343141,'duplicates':_0x29d60b};}}})[_0xaa8f('0x16')](respondWithResult(_0x205527,0xc9))['catch'](handleError(_0x205527,null));};exports['show']=function(_0xf4aea6,_0x50e103){var _0x3adc03;return db[_0xaa8f('0x22')]['describe']()[_0xaa8f('0x16')](function(_0x352ff9){return db['CmContact'][_0xaa8f('0x60')]({'where':{'id':_0xf4aea6['params']['id']},'include':[{'model':db['Tag'],'as':'Tags','attributes':['id',_0xaa8f('0x1a'),_0xaa8f('0x61')],'required':_0xf4aea6[_0xaa8f('0x2a')]['tag']?!![]:![]},{'model':db[_0xaa8f('0x46')],'as':_0xaa8f('0x62'),'where':{'CmContactId':_0xf4aea6[_0xaa8f('0x21')]['id']},'required':![],'include':[{'model':db[_0xaa8f('0x63')],'as':_0xaa8f('0x64')}]}],'order':[db['sequelize'][_0xaa8f('0x65')](_0xaa8f('0x66'))],'attributes':_['keys'](_0x352ff9)});})[_0xaa8f('0x16')](function(_0x290e1f){if(!_[_0xaa8f('0x51')](_0x290e1f)){_0x3adc03=_0x290e1f[_0xaa8f('0x36')]({'plain':!![]});var _0x2b8b41={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x290e1f&&_0x290e1f['ListId']){if(_0x290e1f[_0xaa8f('0x5b')]){_0x2b8b41[_0xaa8f('0x5a')][_0xaa8f('0x67')][_0xaa8f('0x59')]({'ListId':{'$ne':_0x290e1f[_0xaa8f('0x5b')]}});}}return db[_0xaa8f('0x2b')][_0xaa8f('0x1e')](_0x2b8b41);}})[_0xaa8f('0x16')](function(_0x54fca1){if(!_[_0xaa8f('0x51')](_0x54fca1)){return _[_0xaa8f('0x68')](_0x3adc03,_['map'](_0x54fca1,function(_0x40aa67){return util[_0xaa8f('0x69')](_0xaa8f('0x6a'),_0x40aa67['id']);}));}})[_0xaa8f('0x16')](handleEntityNotFound(_0x50e103,null))[_0xaa8f('0x16')](respondWithResult(_0x50e103,null))[_0xaa8f('0x20')](handleError(_0x50e103,null));};exports['update']=function(_0xc7cd09,_0x12c9c6){var _0xbfc7b;if(_0xc7cd09[_0xaa8f('0x34')]['id']){delete _0xc7cd09['body']['id'];}if(!_['isNil'](_0xc7cd09['body'][_0xaa8f('0x52')])){var _0x120896=_0xc7cd09[_0xaa8f('0x34')][_0xaa8f('0x52')];if(!_[_0xaa8f('0x51')](shared[_0xaa8f('0x53')][_0x120896]))_0xc7cd09[_0xaa8f('0x34')][_0xaa8f('0x54')]=shared[_0xaa8f('0x53')][_0x120896]['utcOffset'];}return db['CmContact'][_0xaa8f('0x60')]({'where':{'id':_0xc7cd09[_0xaa8f('0x21')]['id']}})[_0xaa8f('0x16')](handleEntityNotFound(_0x12c9c6,null))[_0xaa8f('0x16')](saveUpdates(_0xc7cd09[_0xaa8f('0x34')],null))[_0xaa8f('0x16')](function(_0xb07658){_0xbfc7b=_0xb07658;var _0x1c4fc2={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0xb07658&&_0xb07658['ListId']){if(_0xb07658[_0xaa8f('0x5b')]){_0x1c4fc2['where'][_0xaa8f('0x67')][_0xaa8f('0x59')]({'ListId':{'$ne':_0xb07658[_0xaa8f('0x5b')]}});}}return db[_0xaa8f('0x2b')][_0xaa8f('0x1e')](_0x1c4fc2);})['then'](function(_0x5a8e57){if(_0x5a8e57){return _[_0xaa8f('0x68')](_['pickBy'](_0xc7cd09[_0xaa8f('0x34')],function(_0xdfcf8d,_0x4a67ef){return _['startsWith'](_0x4a67ef,_0xaa8f('0x27'));}),_['map'](_0x5a8e57,function(_0x24f301){return util['format'](_0xaa8f('0x6a'),_0x24f301['id']);}));}})[_0xaa8f('0x16')](function(_0xbd81a3){if(_0xbd81a3&&!_[_0xaa8f('0x6b')](_0xbd81a3)){var _0x2f2e24=squel[_0xaa8f('0x15')]()[_0xaa8f('0x6c')]('cm_contacts')['setFields'](_0xbd81a3)[_0xaa8f('0x5a')]('id\x20=\x20?',_0xc7cd09[_0xaa8f('0x21')]['id'])[_0xaa8f('0x6d')]();return db[_0xaa8f('0x6e')][_0xaa8f('0x2a')](_0x2f2e24['text'],{'replacements':_0x2f2e24[_0xaa8f('0x2f')]});}})[_0xaa8f('0x16')](function(){if(_0xc7cd09[_0xaa8f('0x34')][_0xaa8f('0x6f')]&&_0xbfc7b){return db[_0xaa8f('0x3a')][_0xaa8f('0x15')]({'phone':_0xc7cd09[_0xaa8f('0x34')]['phone'],'OrderBy':0x0},{'where':{'ContactId':_0xbfc7b['id']}});}})[_0xaa8f('0x16')](function(){return _0xbfc7b;})[_0xaa8f('0x16')](respondWithResult(_0x12c9c6,null))['catch'](handleError(_0x12c9c6,null));};exports[_0xaa8f('0x70')]=function(_0x425bd7,_0x1cee4a){var _0x569431={};var _0x3126ac={};var _0x557df2;var _0x531219;return db[_0xaa8f('0x22')][_0xaa8f('0x71')]({'where':{'id':_0x425bd7[_0xaa8f('0x21')]['id']}})[_0xaa8f('0x16')](handleEntityNotFound(_0x1cee4a,null))[_0xaa8f('0x16')](function(_0x661874){if(_0x661874){_0x557df2=_0x661874;_0x3126ac[_0xaa8f('0x72')]=_[_0xaa8f('0x24')](db['Tag'][_0xaa8f('0x73')]);_0x3126ac[_0xaa8f('0x2a')]=_['keys'](_0x425bd7['query']);_0x3126ac['filters']=_[_0xaa8f('0x74')](_0x3126ac['model'],_0x3126ac[_0xaa8f('0x2a')]);_0x569431[_0xaa8f('0x75')]=_[_0xaa8f('0x74')](_0x3126ac[_0xaa8f('0x72')],qs['fields'](_0x425bd7[_0xaa8f('0x2a')][_0xaa8f('0x76')]));_0x569431[_0xaa8f('0x75')]=_0x569431[_0xaa8f('0x75')][_0xaa8f('0x25')]?_0x569431[_0xaa8f('0x75')]:_0x3126ac[_0xaa8f('0x72')];_0x569431['order']=qs[_0xaa8f('0x77')](_0x425bd7['query'][_0xaa8f('0x77')]);_0x569431[_0xaa8f('0x5a')]=qs[_0xaa8f('0x78')](_[_0xaa8f('0x79')](_0x425bd7[_0xaa8f('0x2a')],_0x3126ac[_0xaa8f('0x78')]));if(_0x425bd7[_0xaa8f('0x2a')][_0xaa8f('0x7a')]){_0x569431[_0xaa8f('0x5a')]=_[_0xaa8f('0x33')](_0x569431[_0xaa8f('0x5a')],{'$or':_[_0xaa8f('0x7b')](_0x569431[_0xaa8f('0x75')],function(_0x753611){var _0x38e644={};_0x38e644[_0x753611]={'$like':'%'+_0x425bd7['query'][_0xaa8f('0x7a')]+'%'};return _0x38e644;})});}_0x569431=_['merge']({},_0x569431,_0x425bd7['options']);return _0x557df2['getTags'](_0x569431);}})[_0xaa8f('0x16')](function(_0x510070){if(_0x510070){_0x531219=_0x510070[_0xaa8f('0x25')];if(!_0x425bd7[_0xaa8f('0x2a')][_0xaa8f('0x5e')](_0xaa8f('0x7c'))){_0x569431['limit']=qs[_0xaa8f('0x11')](_0x425bd7[_0xaa8f('0x2a')]['limit']);_0x569431[_0xaa8f('0xf')]=qs[_0xaa8f('0xf')](_0x425bd7[_0xaa8f('0x2a')][_0xaa8f('0xf')]);}return _0x557df2[_0xaa8f('0x70')](_0x569431);}})[_0xaa8f('0x16')](function(_0x2d6070){if(_0x2d6070){return _0x2d6070?{'count':_0x531219,'rows':_0x2d6070}:null;}})[_0xaa8f('0x16')](respondWithResult(_0x1cee4a,null))[_0xaa8f('0x20')](handleError(_0x1cee4a,null));};exports[_0xaa8f('0x7d')]=function(_0xb4f77e,_0x5cd6df){if(_0xb4f77e[_0xaa8f('0x34')]['id']){delete _0xb4f77e[_0xaa8f('0x34')]['id'];}return db[_0xaa8f('0x22')][_0xaa8f('0x71')]({'where':{'id':_0xb4f77e[_0xaa8f('0x21')]['id']}})[_0xaa8f('0x16')](handleEntityNotFound(_0x5cd6df,null))[_0xaa8f('0x16')](function(_0x2b1218){if(_0x2b1218){return _0x2b1218['setTags'](_0xb4f77e[_0xaa8f('0x34')][_0xaa8f('0x7e')]||[]);}return null;})[_0xaa8f('0x16')](respondWithResult(_0x5cd6df,null))['catch'](handleError(_0x5cd6df,null));};exports['setAdditionalPhones']=function(_0x3275fa,_0x131c3a){var _0x4cd75a=[];_0x4cd75a[_0xaa8f('0x59')](addAdditionalPhones(_0x3275fa[_0xaa8f('0x34')]));Promise[_0xaa8f('0x5f')](_0x4cd75a)['then'](function(){_0x4cd75a=[];_0x4cd75a[_0xaa8f('0x59')](deleteCmHopperPhones(_0x3275fa[_0xaa8f('0x34')]['id']));_0x4cd75a[_0xaa8f('0x59')](addCmHopperPhones(_0x3275fa[_0xaa8f('0x34')]['id']));Promise[_0xaa8f('0x5f')](_0x4cd75a)[_0xaa8f('0x16')](function(){return[0x1];})[_0xaa8f('0x16')](respondWithResult(_0x131c3a,null));});};function addAdditionalPhones(_0x23cd6c){var _0x361532;return new Promise(function(_0x9a42b3){return db[_0xaa8f('0x46')][_0xaa8f('0x17')]({'where':{'CmContactId':_0x23cd6c['id']}})[_0xaa8f('0x16')](function(){db['ContactItemType'][_0xaa8f('0x1e')]({'raw':!![],'attributes':['id','OrderBy']})[_0xaa8f('0x16')](function(_0x324057){var _0x5995d9=[];for(var _0x5cbbe7=0x0;_0x5cbbe7<_0x23cd6c[_0xaa8f('0x7f')]['length'];_0x5cbbe7++){var _0x55a755=_0x23cd6c[_0xaa8f('0x80')]?_[_0xaa8f('0x51')](_0x23cd6c[_0xaa8f('0x80')][_0x5cbbe7])?'':_0x23cd6c[_0xaa8f('0x80')][_0x5cbbe7]:_0x23cd6c[_0xaa8f('0x7f')][_0x5cbbe7][_0xaa8f('0x81')]?_0x23cd6c[_0xaa8f('0x7f')][_0x5cbbe7][_0xaa8f('0x81')]:'';var _0x2173b0=_[_0xaa8f('0x51')](_0x23cd6c[_0xaa8f('0x7f')][_0x5cbbe7][_0xaa8f('0x82')])?'':_0x23cd6c[_0xaa8f('0x7f')][_0x5cbbe7][_0xaa8f('0x82')];var _0x323fbd=_0x55a755+':'+_0x23cd6c[_0xaa8f('0x7f')][_0x5cbbe7][_0xaa8f('0x6f')]+'§'+_0x2173b0;if(_['isNil'](_0x361532))_0x361532=_0x323fbd;else _0x361532+=';'+_0x323fbd;var _0x4238e5=null;var _0x5f5115=null;if(_0x23cd6c['item_types']){if(!_[_0xaa8f('0x51')](_0x23cd6c[_0xaa8f('0x80')][_0x5cbbe7])){_0x5f5115=_[_0xaa8f('0x60')](_0x324057,function(_0x8b16a8){return _0x8b16a8['id']===_0x23cd6c['item_types'][_0x5cbbe7];});if(!_[_0xaa8f('0x51')](_0x5f5115)){_0x4238e5=_0x5f5115[_0xaa8f('0x83')];}}}else{if(!_[_0xaa8f('0x51')](_0x23cd6c[_0xaa8f('0x7f')][_0x5cbbe7])){_0x5f5115=_[_0xaa8f('0x60')](_0x324057,function(_0x349084){return _0x349084['id']===_0x23cd6c[_0xaa8f('0x7f')][_0x5cbbe7][_0xaa8f('0x81')];});if(!_['isNil'](_0x5f5115)){_0x4238e5=_0x5cbbe7;}}}if(_[_0xaa8f('0x51')](_0x4238e5)){_0x4238e5=0x64;}_0x5995d9[_0xaa8f('0x59')](addAdditionalPhone(_0x23cd6c['id'],_0x23cd6c[_0xaa8f('0x7f')][_0x5cbbe7][_0xaa8f('0x6f')],_0x23cd6c[_0xaa8f('0x80')]?_[_0xaa8f('0x51')](_0x23cd6c[_0xaa8f('0x80')][_0x5cbbe7])?null:_0x23cd6c['item_types'][_0x5cbbe7]:_0x23cd6c[_0xaa8f('0x7f')][_0x5cbbe7][_0xaa8f('0x81')]?_0x23cd6c[_0xaa8f('0x7f')][_0x5cbbe7][_0xaa8f('0x81')]:null,_0x4238e5,_0x2173b0));}Promise['all'](_0x5995d9)[_0xaa8f('0x16')](function(){db['CmContact']['update']({'AdditionalPhones':_0x361532},{'where':{'id':_0x23cd6c['id']}})[_0xaa8f('0x16')](function(){_0x9a42b3(0x1);});});});});});}function addAdditionalPhone(_0x4af32a,_0x176b36,_0x34a1b8,_0x3a7996,_0x104419){return db[_0xaa8f('0x46')][_0xaa8f('0x60')]({'where':{'CmContactId':_0x4af32a,'item':_0x176b36}})[_0xaa8f('0x16')](function(_0x47a278){if(_0x47a278)logger['info']('contact\x20phone\x20exists',_0x47a278);else{db[_0xaa8f('0x46')][_0xaa8f('0x3e')]({'CmContactId':_0x4af32a,'item':_0x176b36,'ItemTypeId':_0x34a1b8,'OrderBy':_0x3a7996,'ItemClass':_0xaa8f('0x84'),'description':_0x104419});}});}function deleteCmHopperPhones(_0x2580fb){return new Promise(function(_0x4f653a){return db[_0xaa8f('0x3a')][_0xaa8f('0x1e')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x2580fb}})['then'](function(_0x2d1782){db['CmHopperAdditionalPhone'][_0xaa8f('0x17')]({'where':{'CmHopperId':{'$in':_[_0xaa8f('0x7b')](_0x2d1782,'id')}}});})[_0xaa8f('0x16')](function(){_0x4f653a(0x1);});});}function addCmHopperPhones(_0x1a4c13){return new Promise(function(_0x19bf6a){return db[_0xaa8f('0x3a')][_0xaa8f('0x1e')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x1a4c13}})['then'](function(_0xb7db73){var _0x4c3658=[];_[_0xaa8f('0x7b')](_0xb7db73,function(_0x528fc2){_0x4c3658[_0xaa8f('0x59')](createCmHopperPhone(_0x1a4c13,_0x528fc2['id']));});Promise[_0xaa8f('0x5f')](_0x4c3658)[_0xaa8f('0x16')](function(){_0x19bf6a(0x1);});});});}function createCmHopperPhone(_0x3dc39e,_0x3d758a){return new Promise(function(_0x4ea95e){db[_0xaa8f('0x46')][_0xaa8f('0x1e')]({'raw':!![],'attributes':[_0xaa8f('0x85'),_0xaa8f('0x83')],'where':{'CmContactId':_0x3dc39e,'ItemClass':_0xaa8f('0x84')},'include':[{'model':db['ContactItemType'],'attributes':['OrderBy'],'as':'ItemType'}],'order':[_0xaa8f('0x83'),db[_0xaa8f('0x6e')]['literal'](_0xaa8f('0x86'))]})['then'](function(_0x357a19){var _0x2b92e3=0x1;var _0xfecb2d=_[_0xaa8f('0x7b')](_0x357a19,function(_0x3aa0f4){_0x3aa0f4[_0xaa8f('0x87')]=_0x3d758a;_0x3aa0f4[_0xaa8f('0x6f')]=_0x3aa0f4['item'];_0x3aa0f4['OrderBy']=_0x2b92e3;delete _0x3aa0f4[_0xaa8f('0x88')];_0x2b92e3=_0x2b92e3+0x1;return _0x3aa0f4;});return db[_0xaa8f('0x89')][_0xaa8f('0x56')](_0xfecb2d,{});})['then'](function(){_0x4ea95e(0x1);});});}function insertAdditionalPhones(_0x2e7fa5,_0x3ac47a){return new Promise(function(_0x57d406){var _0xcef321=[];for(var _0x116485=0x0;_0x116485<_0x3ac47a['length'];_0x116485++){var _0x214b08=_0x3ac47a[_0x116485];_0xcef321[_0xaa8f('0x59')](parseContactItemType(_0x214b08));}Promise[_0xaa8f('0x5f')](_0xcef321)['then'](function(){var _0x451dfd={'id':_0x2e7fa5['id'],'items':_0x3ac47a};return addAdditionalPhones(_0x451dfd)[_0xaa8f('0x16')](function(){return addCmHopperPhones(_0x2e7fa5['id']);});})['then'](function(){_0x57d406(_0x2e7fa5);});});}function parseContactItemType(_0x32865d){return new Promise(function(_0x3751b6){if(_0x32865d[_0xaa8f('0x5e')]('ItemTypeId')){_0x3751b6(_0x32865d);}else{return db['ContactItemType'][_0xaa8f('0x60')]({'where':{'name':_0x32865d[_0xaa8f('0x64')]}})['then'](function(_0x197d6c){if(_[_0xaa8f('0x51')](_0x197d6c))_0x32865d['ItemTypeId']=null;else _0x32865d['ItemTypeId']=_0x197d6c['id'];_0x3751b6(_0x32865d);});}});}exports['getAdditionalPhones']=function(_0x568744,_0x1bdfb4){return db[_0xaa8f('0x46')][_0xaa8f('0x1e')]({'raw':!![],'where':{'CmContactId':_0x568744[_0xaa8f('0x21')]['id'],'ItemClass':'PHONE'},'include':[{'model':db[_0xaa8f('0x63')],'as':_0xaa8f('0x64')}],'order':[[_0xaa8f('0x83')],[db[_0xaa8f('0x6e')][_0xaa8f('0x65')](_0xaa8f('0x86'))]]})[_0xaa8f('0x16')](function(_0x2ef7d0){return _0x2ef7d0;})['then'](respondWithResult(_0x1bdfb4,null))['catch'](handleError(_0x1bdfb4,null));};exports[_0xaa8f('0x8a')]=function(_0x398bb6,_0x28e887){return db[_0xaa8f('0x46')]['findAll']({'raw':!![],'where':{'CmContactId':_0x398bb6[_0xaa8f('0x34')][_0xaa8f('0x8b')]}})[_0xaa8f('0x16')](function(_0x39a957){var _0x20feb7=_[_0xaa8f('0x7b')](_0x39a957,function(_0x32eb22){_0x32eb22[_0xaa8f('0x8c')]=_0x398bb6[_0xaa8f('0x34')][_0xaa8f('0x8d')];return _0x32eb22;});return db[_0xaa8f('0x46')][_0xaa8f('0x56')](_0x20feb7,{});})[_0xaa8f('0x16')](function(){return addCmHopperPhones(_0x398bb6[_0xaa8f('0x34')][_0xaa8f('0x8d')]);})[_0xaa8f('0x16')](function(){return['ok'];})[_0xaa8f('0x16')](respondWithResult(_0x28e887,null))[_0xaa8f('0x20')](handleError(_0x28e887,null));};exports[_0xaa8f('0x8e')]=function(_0x2a386e,_0x3c32f0){var _0x2ff321=[];_0x2ff321[_0xaa8f('0x59')](createCmHopperPhone(_0x2a386e['body']['id'],_0x2a386e[_0xaa8f('0x34')][_0xaa8f('0x8f')]));Promise[_0xaa8f('0x5f')](_0x2ff321)[_0xaa8f('0x16')](function(){return[0x1];})[_0xaa8f('0x16')](respondWithResult(_0x3c32f0,null));};exports[_0xaa8f('0x90')]=function(_0x19925f,_0x4f6070){var _0x133433={'raw':![],'where':{}};var _0x29598b={};var _0x1bbb84={'count':0x0,'rows':[]};return db[_0xaa8f('0x22')]['findOne']({'where':{'id':_0x19925f[_0xaa8f('0x21')]['id']}})[_0xaa8f('0x16')](handleEntityNotFound(_0x4f6070,null))['then'](function(_0x38ece2){if(_0x38ece2){_0x29598b[_0xaa8f('0x72')]=_[_0xaa8f('0x24')](db['CmHopper']['rawAttributes']);_0x29598b[_0xaa8f('0x2a')]=_[_0xaa8f('0x24')](_0x19925f[_0xaa8f('0x2a')]);_0x29598b[_0xaa8f('0x78')]=_['intersection'](_0x29598b['model'],_0x29598b[_0xaa8f('0x2a')]);_0x133433[_0xaa8f('0x75')]=_[_0xaa8f('0x74')](_0x29598b[_0xaa8f('0x72')],qs[_0xaa8f('0x76')](_0x19925f['query'][_0xaa8f('0x76')]));_0x133433[_0xaa8f('0x75')]=_0x133433[_0xaa8f('0x75')]['length']?_0x133433[_0xaa8f('0x75')]:_0x29598b[_0xaa8f('0x72')];if(!_0x19925f[_0xaa8f('0x2a')][_0xaa8f('0x5e')](_0xaa8f('0x7c'))){_0x133433[_0xaa8f('0x11')]=qs[_0xaa8f('0x11')](_0x19925f[_0xaa8f('0x2a')][_0xaa8f('0x11')]);_0x133433['offset']=qs[_0xaa8f('0xf')](_0x19925f[_0xaa8f('0x2a')]['offset']);}_0x133433[_0xaa8f('0x91')]=qs['sort'](_0x19925f[_0xaa8f('0x2a')][_0xaa8f('0x77')]);_0x133433[_0xaa8f('0x5a')]=qs[_0xaa8f('0x78')](_[_0xaa8f('0x79')](_0x19925f[_0xaa8f('0x2a')],_0x29598b[_0xaa8f('0x78')]));_0x133433['where'][_0xaa8f('0x92')]=_0x38ece2['id'];if(_0x19925f['query'][_0xaa8f('0x7a')]){_0x133433[_0xaa8f('0x5a')]=_['merge'](_0x133433[_0xaa8f('0x5a')],{'$or':_[_0xaa8f('0x7b')](_0x133433[_0xaa8f('0x75')],function(_0x8ab994){var _0x143995={};_0x143995[_0x8ab994]={'$like':'%'+_0x19925f[_0xaa8f('0x2a')][_0xaa8f('0x7a')]+'%'};return _0x143995;})});}_0x133433=_[_0xaa8f('0x33')]({},_0x133433,_0x19925f[_0xaa8f('0x93')]);return db['CmHopper'][_0xaa8f('0x12')]({'where':_0x133433[_0xaa8f('0x5a')]})['then'](function(_0x3a0780){_0x1bbb84[_0xaa8f('0x12')]=_0x3a0780;if(_0x19925f['query'][_0xaa8f('0x94')]){_0x133433['include']=[{'all':!![]}];}return db[_0xaa8f('0x3a')][_0xaa8f('0x1e')](_0x133433);})[_0xaa8f('0x16')](function(_0x410b84){_0x1bbb84[_0xaa8f('0x95')]=_0x410b84;return _0x1bbb84;});}})['then'](respondWithFilteredResult(_0x4f6070,_0x133433))[_0xaa8f('0x20')](handleError(_0x4f6070,null));};exports[_0xaa8f('0x96')]=function(_0x4c8808,_0x4b92f3){var _0x1917a1={'raw':!![],'where':{}};var _0x3ad120={};var _0x115a24={'count':0x0,'rows':[]};return db[_0xaa8f('0x22')][_0xaa8f('0x71')]({'where':{'id':_0x4c8808['params']['id']}})[_0xaa8f('0x16')](handleEntityNotFound(_0x4b92f3,null))['then'](function(_0x34425e){if(_0x34425e){_0x3ad120['model']=_[_0xaa8f('0x24')](db[_0xaa8f('0x97')][_0xaa8f('0x73')]);_0x3ad120[_0xaa8f('0x2a')]=_['keys'](_0x4c8808[_0xaa8f('0x2a')]);_0x3ad120[_0xaa8f('0x78')]=_[_0xaa8f('0x74')](_0x3ad120[_0xaa8f('0x72')],_0x3ad120['query']);_0x1917a1['attributes']=_[_0xaa8f('0x74')](_0x3ad120[_0xaa8f('0x72')],qs['fields'](_0x4c8808[_0xaa8f('0x2a')][_0xaa8f('0x76')]));_0x1917a1[_0xaa8f('0x75')]=_0x1917a1['attributes']['length']?_0x1917a1[_0xaa8f('0x75')]:_0x3ad120['model'];if(!_0x4c8808[_0xaa8f('0x2a')][_0xaa8f('0x5e')](_0xaa8f('0x7c'))){_0x1917a1[_0xaa8f('0x11')]=qs[_0xaa8f('0x11')](_0x4c8808[_0xaa8f('0x2a')][_0xaa8f('0x11')]);_0x1917a1['offset']=qs[_0xaa8f('0xf')](_0x4c8808[_0xaa8f('0x2a')][_0xaa8f('0xf')]);}_0x1917a1[_0xaa8f('0x91')]=qs[_0xaa8f('0x77')](_0x4c8808[_0xaa8f('0x2a')][_0xaa8f('0x77')]);_0x1917a1['where']=qs[_0xaa8f('0x78')](_[_0xaa8f('0x79')](_0x4c8808[_0xaa8f('0x2a')],_0x3ad120[_0xaa8f('0x78')]));_0x1917a1[_0xaa8f('0x5a')]['ContactId']=_0x34425e['id'];if(_0x4c8808[_0xaa8f('0x2a')][_0xaa8f('0x7a')]){_0x1917a1[_0xaa8f('0x5a')]=_[_0xaa8f('0x33')](_0x1917a1[_0xaa8f('0x5a')],{'$or':_[_0xaa8f('0x7b')](_0x1917a1[_0xaa8f('0x75')],function(_0x26fb9f){var _0x536a59={};_0x536a59[_0x26fb9f]={'$like':'%'+_0x4c8808['query'][_0xaa8f('0x7a')]+'%'};return _0x536a59;})});}_0x1917a1=_[_0xaa8f('0x33')]({},_0x1917a1,_0x4c8808[_0xaa8f('0x93')]);return db[_0xaa8f('0x97')]['count']({'where':_0x1917a1[_0xaa8f('0x5a')]})[_0xaa8f('0x16')](function(_0x271c47){_0x115a24[_0xaa8f('0x12')]=_0x271c47;if(_0x4c8808['query'][_0xaa8f('0x94')]){_0x1917a1[_0xaa8f('0x98')]=[{'all':!![]}];}return db[_0xaa8f('0x97')][_0xaa8f('0x1e')](_0x1917a1);})[_0xaa8f('0x16')](function(_0x4b3d22){_0x115a24[_0xaa8f('0x95')]=_0x4b3d22;return _0x115a24;});}})[_0xaa8f('0x16')](respondWithFilteredResult(_0x4b92f3,_0x1917a1))[_0xaa8f('0x20')](handleError(_0x4b92f3,null));};exports[_0xaa8f('0x99')]=function(_0x53a72c,_0x37939d){var _0x2a19f5={'raw':!![],'where':{}};var _0x588ccf={};var _0x182154={'count':0x0,'rows':[]};return db[_0xaa8f('0x22')][_0xaa8f('0x71')]({'where':{'id':_0x53a72c['params']['id']}})[_0xaa8f('0x16')](handleEntityNotFound(_0x37939d,null))['then'](function(_0x249d12){if(_0x249d12){_0x588ccf[_0xaa8f('0x72')]=_[_0xaa8f('0x24')](db[_0xaa8f('0x47')][_0xaa8f('0x73')]);_0x588ccf[_0xaa8f('0x2a')]=_[_0xaa8f('0x24')](_0x53a72c[_0xaa8f('0x2a')]);_0x588ccf['filters']=_['intersection'](_0x588ccf['model'],_0x588ccf[_0xaa8f('0x2a')]);_0x2a19f5['attributes']=_['intersection'](_0x588ccf['model'],qs[_0xaa8f('0x76')](_0x53a72c[_0xaa8f('0x2a')][_0xaa8f('0x76')]));_0x2a19f5[_0xaa8f('0x75')]=_0x2a19f5['attributes'][_0xaa8f('0x25')]?_0x2a19f5[_0xaa8f('0x75')]:_0x588ccf[_0xaa8f('0x72')];if(!_0x53a72c[_0xaa8f('0x2a')][_0xaa8f('0x5e')](_0xaa8f('0x7c'))){_0x2a19f5['limit']=qs['limit'](_0x53a72c[_0xaa8f('0x2a')][_0xaa8f('0x11')]);_0x2a19f5['offset']=qs[_0xaa8f('0xf')](_0x53a72c[_0xaa8f('0x2a')][_0xaa8f('0xf')]);}_0x2a19f5[_0xaa8f('0x91')]=qs[_0xaa8f('0x77')](_0x53a72c['query']['sort']);_0x2a19f5[_0xaa8f('0x5a')]=qs[_0xaa8f('0x78')](_['pick'](_0x53a72c[_0xaa8f('0x2a')],_0x588ccf['filters']));_0x2a19f5[_0xaa8f('0x5a')][_0xaa8f('0x92')]=_0x249d12['id'];if(_0x53a72c[_0xaa8f('0x2a')]['filter']){_0x2a19f5['where']=_[_0xaa8f('0x33')](_0x2a19f5['where'],{'$or':_[_0xaa8f('0x7b')](_0x2a19f5['attributes'],function(_0x396e50){var _0x4abee6={};_0x4abee6[_0x396e50]={'$like':'%'+_0x53a72c[_0xaa8f('0x2a')][_0xaa8f('0x7a')]+'%'};return _0x4abee6;})});}_0x2a19f5=_[_0xaa8f('0x33')]({},_0x2a19f5,_0x53a72c[_0xaa8f('0x93')]);return db[_0xaa8f('0x47')][_0xaa8f('0x12')]({'where':_0x2a19f5[_0xaa8f('0x5a')]})[_0xaa8f('0x16')](function(_0x19aa07){_0x182154[_0xaa8f('0x12')]=_0x19aa07;if(_0x53a72c['query'][_0xaa8f('0x94')]){_0x2a19f5[_0xaa8f('0x98')]=[{'all':!![]}];}return db['CmHopperFinal'][_0xaa8f('0x1e')](_0x2a19f5);})[_0xaa8f('0x16')](function(_0x50b9df){_0x182154[_0xaa8f('0x95')]=_0x50b9df;return _0x182154;});}})['then'](respondWithFilteredResult(_0x37939d,_0x2a19f5))['catch'](handleError(_0x37939d,null));};exports[_0xaa8f('0x9a')]=function(_0x24634e,_0x4e2a2d){var _0x53f01c={'raw':!![],'where':{}};var _0x1e15eb={};var _0x3d583e={'count':0x0,'rows':[]};return db['CmContact']['findOne']({'where':{'id':_0x24634e[_0xaa8f('0x21')]['id']}})[_0xaa8f('0x16')](handleEntityNotFound(_0x4e2a2d,null))[_0xaa8f('0x16')](function(_0x1c3141){if(_0x1c3141){_0x1e15eb[_0xaa8f('0x72')]=_[_0xaa8f('0x24')](db[_0xaa8f('0x4c')][_0xaa8f('0x73')]);_0x1e15eb[_0xaa8f('0x2a')]=_[_0xaa8f('0x24')](_0x24634e[_0xaa8f('0x2a')]);_0x1e15eb['filters']=_[_0xaa8f('0x74')](_0x1e15eb[_0xaa8f('0x72')],_0x1e15eb[_0xaa8f('0x2a')]);_0x53f01c[_0xaa8f('0x75')]=_[_0xaa8f('0x74')](_0x1e15eb[_0xaa8f('0x72')],qs[_0xaa8f('0x76')](_0x24634e[_0xaa8f('0x2a')][_0xaa8f('0x76')]));_0x53f01c[_0xaa8f('0x75')]=_0x53f01c[_0xaa8f('0x75')][_0xaa8f('0x25')]?_0x53f01c[_0xaa8f('0x75')]:_0x1e15eb[_0xaa8f('0x72')];if(!_0x24634e[_0xaa8f('0x2a')][_0xaa8f('0x5e')](_0xaa8f('0x7c'))){_0x53f01c[_0xaa8f('0x11')]=qs[_0xaa8f('0x11')](_0x24634e[_0xaa8f('0x2a')][_0xaa8f('0x11')]);_0x53f01c[_0xaa8f('0xf')]=qs[_0xaa8f('0xf')](_0x24634e[_0xaa8f('0x2a')][_0xaa8f('0xf')]);}_0x53f01c[_0xaa8f('0x91')]=qs[_0xaa8f('0x77')](_0x24634e[_0xaa8f('0x2a')][_0xaa8f('0x77')]);_0x53f01c[_0xaa8f('0x5a')]=qs['filters'](_[_0xaa8f('0x79')](_0x24634e[_0xaa8f('0x2a')],_0x1e15eb[_0xaa8f('0x78')]));_0x53f01c['where'][_0xaa8f('0x92')]=_0x1c3141['id'];if(_0x24634e['query']['filter']){_0x53f01c[_0xaa8f('0x5a')]=_[_0xaa8f('0x33')](_0x53f01c[_0xaa8f('0x5a')],{'$or':_[_0xaa8f('0x7b')](_0x53f01c[_0xaa8f('0x75')],function(_0x32b627){var _0x10ea51={};_0x10ea51[_0x32b627]={'$like':'%'+_0x24634e[_0xaa8f('0x2a')][_0xaa8f('0x7a')]+'%'};return _0x10ea51;})});}_0x53f01c=_['merge']({},_0x53f01c,_0x24634e[_0xaa8f('0x93')]);return db[_0xaa8f('0x4c')][_0xaa8f('0x12')]({'where':_0x53f01c[_0xaa8f('0x5a')]})[_0xaa8f('0x16')](function(_0x3c3bdf){_0x3d583e[_0xaa8f('0x12')]=_0x3c3bdf;if(_0x24634e[_0xaa8f('0x2a')][_0xaa8f('0x94')]){_0x53f01c['include']=[{'all':!![]}];}return db[_0xaa8f('0x4c')]['findAll'](_0x53f01c);})[_0xaa8f('0x16')](function(_0x543461){_0x3d583e[_0xaa8f('0x95')]=_0x543461;return _0x3d583e;});}})[_0xaa8f('0x16')](respondWithFilteredResult(_0x4e2a2d,_0x53f01c))['catch'](handleError(_0x4e2a2d,null));};exports[_0xaa8f('0x9b')]=function(_0x47201b,_0x107af4){try{if(!_0x47201b[_0xaa8f('0x34')]['ListId']){throw new Error(_0xaa8f('0x9c'));}if(!_0x47201b[_0xaa8f('0x34')][_0xaa8f('0x9d')]){throw new Error(_0xaa8f('0x9e'));}if(!_0x47201b[_0xaa8f('0x34')][_0xaa8f('0x9f')]){throw new Error('No\x20association\x20values\x20specified!');}if(!_0x47201b[_0xaa8f('0x34')][_0xaa8f('0xa0')]){throw new Error(_0xaa8f('0xa1'));}var _0x57a8bc=_0x47201b[_0xaa8f('0x34')]['binding_keys'][_0xaa8f('0xa2')](',');var _0x334031=_0x47201b['body']['binding_values'][_0xaa8f('0xa2')](',');if(!_0x57a8bc['length']||!_0x334031[_0xaa8f('0x25')]||_0x57a8bc['length']!==_0x334031[_0xaa8f('0x25')]){throw new Error('Incorrect\x20binding\x20parameters\x20passed!');}_0x47201b[_0xaa8f('0x34')][_0xaa8f('0x76')]=_[_0xaa8f('0xa3')](_0x57a8bc,_0x334031);if(!_0x47201b[_0xaa8f('0x34')]['fields'][_0xaa8f('0x6f')]){throw new Error(_0xaa8f('0xa4'));}if(!_0x47201b[_0xaa8f('0x34')][_0xaa8f('0x76')][_0xaa8f('0xa5')]){throw new Error('No\x20firstName\x20column\x20specified');}var _0x2e839f=path[_0xaa8f('0x38')](config['root'],_0xaa8f('0xa6'),_0x47201b[_0xaa8f('0xa7')]['filename']);fs[_0xaa8f('0xa8')](_0x2e839f,parseInt(_0xaa8f('0xa9'),0x8));var _0x3545ac=require('child_process')[_0xaa8f('0xaa')](path[_0xaa8f('0x38')](__dirname,'../../components/import/cm/csv'),[_0x2e839f,_0x47201b[_0xaa8f('0x34')][_0xaa8f('0x9d')],_0x47201b[_0xaa8f('0x34')]['binding_values'],_0x47201b['body'][_0xaa8f('0x5b')],_0x47201b[_0xaa8f('0x34')][_0xaa8f('0xab')],_0x47201b[_0xaa8f('0x34')]['duplicates'],_0x47201b['body'][_0xaa8f('0xa0')]]);return _0x107af4[_0xaa8f('0xd')](0xc8)[_0xaa8f('0xe')]({'message':'File\x20uploaded\x20correctly!','pid':_0x3545ac[_0xaa8f('0xac')]});}catch(_0x4f8cc4){return _0x107af4[_0xaa8f('0xd')](0x1f4)['send'](_0x4f8cc4);}};exports[_0xaa8f('0xad')]=function(_0x189713,_0x172223){var _0x5aa596=fs['createReadStream'](_0x189713[_0xaa8f('0xa7')][_0xaa8f('0x2')]);Papa[_0xaa8f('0xae')](_0x5aa596,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x156c3b){return _0x172223[_0xaa8f('0xd')](0xc8)[_0xaa8f('0xe')]({'file':_0x189713[_0xaa8f('0xa7')],'fields':_0x156c3b[_0xaa8f('0xaf')]['fields']});}});};exports[_0xaa8f('0xb0')]=function(_0x368344,_0x19b539){return db[_0xaa8f('0xb1')]['findAll']({'raw':!![],'attributes':['id'],'where':{'role':_0xaa8f('0xb2')}})[_0xaa8f('0x16')](function(_0x4b427f){var _0x27dc53=![];if(!_0x368344['body']['ListId']){throw new Error(_0xaa8f('0x9c'));}if(!_0x368344[_0xaa8f('0x34')]['binding'][_0xaa8f('0x6f')]){throw new Error(_0xaa8f('0xa4'));}if(!_0x368344[_0xaa8f('0x34')][_0xaa8f('0xb3')]['firstName']){throw new Error(_0xaa8f('0xb4'));}if(!_0x368344['body']['socket_timestamp']){throw new Error(_0xaa8f('0xa1'));}var _0x394615=require(_0xaa8f('0xb5'))['fork'](path[_0xaa8f('0x38')](__dirname,'../../components/import/cm/csv2'),[_0x368344[_0xaa8f('0x21')]['id'],JSON[_0xaa8f('0xb6')](_0x368344['body']),JSON['stringify'](_0x4b427f)]);_0x394615['on'](_0xaa8f('0xb7'),function(){_0x27dc53=!![];return _0x19b539['status'](0xc8)[_0xaa8f('0xe')]({'message':'start\x20child\x20process\x20correctly!','pid':_0x394615[_0xaa8f('0xac')]});});_0x394615['on'](_0xaa8f('0xb8'),function(_0x359cf5){if(_0x359cf5&&!_0x27dc53){return _0x19b539['status'](0x1f4)[_0xaa8f('0xe')]({'message':_0xaa8f('0xb9'),'pid':_0x394615['pid']});}});})[_0xaa8f('0x20')](handleError(_0x19b539,null));};exports[_0xaa8f('0xba')]=function(_0x184565,_0x55702e){return db['User'][_0xaa8f('0x1e')]({'raw':!![],'attributes':['id'],'where':{'role':_0xaa8f('0xb2')}})[_0xaa8f('0x16')](function(_0x588ce0){var _0x15ba51=![];if(!_0x184565[_0xaa8f('0x34')]['ListId']){throw new Error(_0xaa8f('0x9c'));}if(!_0x184565[_0xaa8f('0x34')][_0xaa8f('0xb3')][_0xaa8f('0x6f')]){throw new Error(_0xaa8f('0xa4'));}if(!_0x184565[_0xaa8f('0x34')][_0xaa8f('0xb3')][_0xaa8f('0xa5')]){throw new Error(_0xaa8f('0xb4'));}if(!_0x184565[_0xaa8f('0x34')][_0xaa8f('0xa0')]){throw new Error(_0xaa8f('0xa1'));}var _0xefb854=require(_0xaa8f('0xb5'))['fork'](path[_0xaa8f('0x38')](__dirname,_0xaa8f('0xbb')),[_0x184565[_0xaa8f('0x21')]['id'],JSON['stringify'](_0x184565[_0xaa8f('0x34')]),JSON[_0xaa8f('0xb6')](_0x588ce0)]);_0xefb854['on']('message',function(){_0x15ba51=!![];return _0x55702e[_0xaa8f('0xd')](0xc8)[_0xaa8f('0xe')]({'message':_0xaa8f('0xbc'),'pid':_0xefb854[_0xaa8f('0xac')]});});_0xefb854['on'](_0xaa8f('0xb8'),function(_0x98d1d1){if(_0x98d1d1&&!_0x15ba51){return _0x55702e[_0xaa8f('0xd')](0x1f4)['json']({'message':_0xaa8f('0xb9'),'pid':_0xefb854[_0xaa8f('0xac')]});}});})['catch'](handleError(_0x55702e,null));};exports[_0xaa8f('0xbd')]=function(_0x3d21b8,_0x9901bf){var _0xada6c0=[_0xaa8f('0xbe'),'chat',_0xaa8f('0xbf'),'openchannel',_0xaa8f('0xc0'),'whatsapp',_0xaa8f('0xc1')];var _0xbf5363={'offset':0x0,'order':qs[_0xaa8f('0x77')]('-createdAt')},_0x2e558f={'count':0x0,'rows':[]};Promise[_0xaa8f('0xc2')]()['then'](function(){if(_0x3d21b8[_0xaa8f('0x2a')][_0xaa8f('0xc3')]){if(!_[_0xaa8f('0xc4')](_0xada6c0,_0x3d21b8[_0xaa8f('0x2a')][_0xaa8f('0xc3')][_0xaa8f('0xc5')]())){throw new Error(_0xaa8f('0xc6'));}_0xada6c0=[_0x3d21b8['query'][_0xaa8f('0xc3')][_0xaa8f('0xc5')]()];}if(_0x3d21b8[_0xaa8f('0x2a')][_0xaa8f('0xc7')]){try{var _0x3c84f3=JSON['parse'](_0x3d21b8[_0xaa8f('0x2a')][_0xaa8f('0xc7')]);if(!moment(_0x3c84f3[_0xaa8f('0x35')])['isValid']()){throw new Error(_0xaa8f('0xc8'));}if(!moment(_0x3c84f3['to'])[_0xaa8f('0xc9')]()){throw new Error(_0xaa8f('0xca'));}}catch(_0x48a73e){throw new Error(_0xaa8f('0xcb'));}}if(!_0x3d21b8[_0xaa8f('0x2a')]['hasOwnProperty'](_0xaa8f('0x7c'))){_0xbf5363['limit']=qs['limit'](_0x3d21b8['query'][_0xaa8f('0x11')]||0xa);_0xbf5363[_0xaa8f('0xf')]=qs[_0xaa8f('0xf')](_0x3d21b8[_0xaa8f('0x2a')]['offset']);}var _0x5196c0=_0xada6c0[_0xaa8f('0x7b')](function(_0x2c4582){if(_0x2c4582===_0xaa8f('0xc1')){var _0x26966f={'attributes':['id',_0xaa8f('0xcc'),_0xaa8f('0x2e'),_0xaa8f('0xcd'),_0xaa8f('0xce'),_0xaa8f('0xcf'),_0xaa8f('0xd0'),_0xaa8f('0xd1'),_0xaa8f('0xd2'),_0xaa8f('0xd3'),_0xaa8f('0xd4'),_0xaa8f('0xd5'),_0xaa8f('0xd6'),_0xaa8f('0xd7'),_0xaa8f('0xd8')],'where':{'ContactId':_0x3d21b8[_0xaa8f('0x21')]['id']},'include':[{'model':db['User'],'as':_0xaa8f('0xb1'),'attributes':['id',_0xaa8f('0x1a'),'fullname','alias']}],'order':[[_0xaa8f('0xd4'),'DESC']]};if(_0x3d21b8[_0xaa8f('0x2a')][_0xaa8f('0xc7')]){_0x26966f[_0xaa8f('0x5a')][_0xaa8f('0xd4')]={'$gte':_0x3c84f3[_0xaa8f('0x35')],'$lte':_0x3c84f3['to']};}return db[_0xaa8f('0x49')][_0xaa8f('0xd9')](_0x26966f)['then'](function(_0x530d84){_0x2e558f[_0xaa8f('0x12')]+=_0x530d84[_0xaa8f('0x12')];return _['map'](_0x530d84[_0xaa8f('0x95')],function(_0x1d22ca){var _0x2f6708=_0x1d22ca[_0xaa8f('0x36')]({'plain':!![]});_0x2f6708[_0xaa8f('0xc3')]=_0x2c4582;if(_0x2f6708[_0xaa8f('0xb1')]){_0x2f6708['User']={'id':_0x2f6708[_0xaa8f('0xb1')]['id'],'name':_0x2f6708[_0xaa8f('0xb1')][_0xaa8f('0x1a')],'fullname':_0x2f6708['User'][_0xaa8f('0xda')],'alias':_0x2f6708[_0xaa8f('0xb1')]['alias']};}return _0x2f6708;});});}else{var _0x2a7d34=_[_0xaa8f('0xdb')](_0x2c4582)+(_0x2c4582===_0xaa8f('0xdc')?'Website':_0xaa8f('0xdd'));var _0x1b5a75={'attributes':['id',_0xaa8f('0xde'),_0xaa8f('0xdf'),_0xaa8f('0xd4'),_0xaa8f('0xd3'),'disposition',_0xaa8f('0xe0'),'thirdDisposition','UserId',_0x2a7d34+'Id'],'where':{'ContactId':_0x3d21b8[_0xaa8f('0x21')]['id']},'include':[{'model':db[_0x2a7d34],'as':'Account','attributes':['id','name','key']},{'model':db[_0xaa8f('0xb1')],'as':_0xaa8f('0xe1'),'attributes':['id',_0xaa8f('0x1a'),_0xaa8f('0xda')]},{'model':db[_0xaa8f('0xe2')],'as':_0xaa8f('0xe3'),'attributes':['id',_0xaa8f('0x1a'),_0xaa8f('0x61')],'through':{'attributes':[]}}],'order':[[_0xaa8f('0xd4'),'DESC']]};if(_0x3d21b8[_0xaa8f('0x2a')][_0xaa8f('0xc7')]){_0x1b5a75['where'][_0xaa8f('0xd4')]={'$gte':_0x3c84f3['from'],'$lte':_0x3c84f3['to']};}switch(_0x2c4582){case _0xaa8f('0xdc'):_0x1b5a75[_0xaa8f('0x75')][_0xaa8f('0x59')](_0xaa8f('0xe4'),'customerIp',_0xaa8f('0xe5'),_0xaa8f('0xe6'),_0xaa8f('0xe7'),_0xaa8f('0xe8'),_0xaa8f('0xe9'),_0xaa8f('0xea'),_0xaa8f('0xeb'));break;case _0xaa8f('0xbe'):_0x1b5a75['attributes']['push'](_0xaa8f('0xec'),_0xaa8f('0xed'));break;case _0xaa8f('0xee'):_0x1b5a75[_0xaa8f('0x75')]['push'](_0xaa8f('0xef'),_0xaa8f('0xf0'));break;}return db[_[_0xaa8f('0xdb')](_0x2c4582)+_0xaa8f('0xf1')][_0xaa8f('0xd9')](_0x1b5a75)[_0xaa8f('0x16')](function(_0x1bd20a){_0x2e558f[_0xaa8f('0x12')]+=_0x1bd20a['count'];return _[_0xaa8f('0x7b')](_0x1bd20a[_0xaa8f('0x95')],function(_0x44c5c6){var _0x541695=_0x44c5c6[_0xaa8f('0x36')]({'plain':!![]});_0x541695[_0xaa8f('0xc3')]=_0x2c4582;if(_0x541695['Owner']){_0x541695[_0xaa8f('0xe1')]={'id':_0x541695['Owner']['id'],'name':_0x541695[_0xaa8f('0xe1')][_0xaa8f('0x1a')],'fullname':_0x541695[_0xaa8f('0xe1')][_0xaa8f('0xda')]};}return _0x541695;});});}});return Promise[_0xaa8f('0x5f')](_0x5196c0);})[_0xaa8f('0x16')](function(_0x12362b){return _(_0x12362b)[_0xaa8f('0xf2')]()['sortBy']('createdAt')[_0xaa8f('0xf3')]()['value']();})[_0xaa8f('0x16')](function(_0x4d3ae0){_0x2e558f[_0xaa8f('0x95')]=_0xbf5363[_0xaa8f('0x11')]?_0x4d3ae0[_0xaa8f('0xf4')](_0xbf5363[_0xaa8f('0xf')],_0xbf5363[_0xaa8f('0xf')]+_0xbf5363[_0xaa8f('0x11')]):_0x4d3ae0;return _0x2e558f;})[_0xaa8f('0x16')](respondWithFilteredResult(_0x9901bf,_0xbf5363))[_0xaa8f('0x20')](handleError(_0x9901bf,null));}; \ No newline at end of file +var _0xe8e7=['omit','map','format','cf_%d','pickBy','isEmpty','table','cm_contacts','id\x20=\x20?','toParam','text','phone','CmHopper','getTags','findOne','model','rawAttributes','filters','intersection','attributes','fields','sort','filter','options','nolimit','setTags','ids','setAdditionalPhones','ContactItemType','OrderBy','items','item_types','ItemTypeId','description','contact\x20phone\x20exists','PHONE','CmHopperAdditionalPhone','`ItemType`.OrderBy','CmHopperId','item','ItemType.OrderBy','getAdditionalPhones','duplicateAdditionalPhones','fromContactId','CmContactId','toContactId','rescheduleAdditionalPhones','hopperId','getHoppers','order','pick','ContactId','includeAll','include','rows','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','uploadCsv','No\x20ListId\x20specified','binding_values','No\x20association\x20values\x20specified!','socket_timestamp','binding_keys','Incorrect\x20binding\x20parameters\x20passed!','No\x20phone\x20column\x20specified','firstName','No\x20firstName\x20column\x20specified','root','server/files/tmp','filename','chmodSync','child_process','CompanyId','pid','send','upload','file','parse','import','agent','binding','fork','../../components/import/cm/csv2','stringify','start\x20child\x20process\x20correctly!','error\x20child\x20process','importUpdates','User','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','../../components/import/cm/csvUpdates','message','exit','mail','chat','sms','voice','-createdAt','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','userSecondDisposition','userThirdDisposition','UserId','fullname','alias','DESC','findAndCountAll','startCase','Website','Account','closed','thirdDisposition','key','Owner','Tags','color','browserName','customerIp','customerPort','deviceModel','osName','ratingMessage','ratingValue','referer','subject','openchannel','externalUrl','flatten','sortBy','reverse','value','slice','moment','util','path','lodash','papaparse','../../components/contacts','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../config/environment/shared','../../mysqldb','redis','defaults','socket.io-emitter','./cmContact.socket','status','json','offset','undefined','count','limit','set','Content-Range','update','then','destroy','end','sendStatus','error','stack','name','index','describe','findAll','query','user','catch','CmContact','find','params','tags','length','startsWith','cf_','columnName','displayName','analytics','CmCustomField','custom','type','values','info','Custom\x20field\x20%s\x20not\x20found\x20on\x20cm_contacts\x20table','forEach','hasOwnProperty','merge','body','get','mergeWith','isArray','join','from','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','create','ChatInteraction','ChatOfflineMessage','MailInteraction','MailMessage','SmsInteraction','SmsMessage','FaxInteraction','FaxMessage','OpenchannelInteraction','OpenchannelMessage','CmContactHasItem','ReportAgentPreview','VoiceCallReport','ChatQueueReport','FaxQueueReport','MailQueueReport','JscriptySessionReport','WhatsappMessage','WhatsappQueueReport','dialTimezone','isNil','timezones','utcOffset','additionalPhones','bulkCreate','keys','duplicates','$or','where','ListId','spread','push','contact','all','show','Tag','tag','ItemType','sequelize','literal','Phones.OrderBy','$and'];(function(_0x4ff80a,_0x4eb5d6){var _0x347ad8=function(_0x3461b0){while(--_0x3461b0){_0x4ff80a['push'](_0x4ff80a['shift']());}};_0x347ad8(++_0x4eb5d6);}(_0xe8e7,0x95));var _0x7e8e=function(_0x36fbb3,_0xeacb78){_0x36fbb3=_0x36fbb3-0x0;var _0x25416a=_0xe8e7[_0x36fbb3];return _0x25416a;};'use strict';var moment=require(_0x7e8e('0x0'));var BPromise=require('bluebird');var util=require(_0x7e8e('0x1'));var path=require(_0x7e8e('0x2'));var fs=require('fs');var _=require(_0x7e8e('0x3'));var squel=require('squel');var Papa=require(_0x7e8e('0x4'));var Redis=require('ioredis');var contacts=require(_0x7e8e('0x5'));var qs=require(_0x7e8e('0x6'));var logger=require(_0x7e8e('0x7'))(_0x7e8e('0x8'));var config=require(_0x7e8e('0x9'));var shared=require(_0x7e8e('0xa'));var db=require(_0x7e8e('0xb'))['db'];config[_0x7e8e('0xc')]=_[_0x7e8e('0xd')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x7e8e('0xe'))(new Redis(config[_0x7e8e('0xc')]));require(_0x7e8e('0xf'))['register'](socket);function respondWithResult(_0x1d17b4,_0x200668){_0x200668=_0x200668||0xc8;return function(_0x311481){if(_0x311481){return _0x1d17b4[_0x7e8e('0x10')](_0x200668)[_0x7e8e('0x11')](_0x311481);}};}function respondWithFilteredResult(_0x3ab3f6,_0x1ab139){return function(_0x37b87c){if(_0x37b87c){var _0x1e8f37=typeof _0x1ab139[_0x7e8e('0x12')]==='undefined'&&typeof _0x1ab139['limit']===_0x7e8e('0x13');var _0xa4aaa3=_0x37b87c[_0x7e8e('0x14')];var _0x294bb8=_0x1e8f37?0x0:_0x1ab139[_0x7e8e('0x12')];var _0x19dc7e=_0x1e8f37?_0x37b87c[_0x7e8e('0x14')]:_0x1ab139[_0x7e8e('0x12')]+_0x1ab139[_0x7e8e('0x15')];var _0x3fe86c;if(_0x19dc7e>=_0xa4aaa3){_0x19dc7e=_0xa4aaa3;_0x3fe86c=0xc8;}else{_0x3fe86c=0xce;}_0x3ab3f6[_0x7e8e('0x10')](_0x3fe86c);return _0x3ab3f6[_0x7e8e('0x16')](_0x7e8e('0x17'),_0x294bb8+'-'+_0x19dc7e+'/'+_0xa4aaa3)['json'](_0x37b87c);}return null;};}function saveUpdates(_0x3a80a0){return function(_0x443805){if(_0x443805){return _0x443805[_0x7e8e('0x18')](_0x3a80a0)[_0x7e8e('0x19')](function(_0x545feb){return _0x545feb;});}return null;};}function removeEntity(_0x3435be){return function(_0x58b2a1){if(_0x58b2a1){return _0x58b2a1[_0x7e8e('0x1a')]()['then'](function(){_0x3435be[_0x7e8e('0x10')](0xcc)[_0x7e8e('0x1b')]();});}};}function handleEntityNotFound(_0x1a21f5){return function(_0x2db748){if(!_0x2db748){_0x1a21f5[_0x7e8e('0x1c')](0x194);}return _0x2db748;};}function handleError(_0x1d3f26,_0x172bc1){_0x172bc1=_0x172bc1||0x1f4;return function(_0x4292d1){logger[_0x7e8e('0x1d')](_0x4292d1[_0x7e8e('0x1e')]);if(_0x4292d1['name']){delete _0x4292d1[_0x7e8e('0x1f')];}_0x1d3f26[_0x7e8e('0x10')](_0x172bc1)['send'](_0x4292d1);};}exports[_0x7e8e('0x20')]=function(_0x2cb8b6,_0x1c6b87){var _0xe41b3c={};return contacts[_0x7e8e('0x21')]()[_0x7e8e('0x19')](function(_0x38850d){_0xe41b3c=qs['getOptions'](_0x38850d,_0x2cb8b6);return contacts[_0x7e8e('0x22')](_0x2cb8b6[_0x7e8e('0x23')],_0x2cb8b6[_0x7e8e('0x24')],_0xe41b3c,_0x38850d);})[_0x7e8e('0x19')](respondWithFilteredResult(_0x1c6b87,_0xe41b3c))[_0x7e8e('0x25')](handleError(_0x1c6b87,null));};exports[_0x7e8e('0x1a')]=function(_0x212cc8,_0x13b6ef){return db[_0x7e8e('0x26')][_0x7e8e('0x27')]({'where':{'id':_0x212cc8[_0x7e8e('0x28')]['id']}})[_0x7e8e('0x19')](handleEntityNotFound(_0x13b6ef,null))[_0x7e8e('0x19')](removeEntity(_0x13b6ef,null))[_0x7e8e('0x25')](handleError(_0x13b6ef,null));};exports['describe']=function(_0x178381,_0x3a2ae7){return db[_0x7e8e('0x26')][_0x7e8e('0x21')]()[_0x7e8e('0x19')](function(_0x2d057e){delete _0x2d057e[_0x7e8e('0x29')];for(var _0x3c167e=0x0;_0x3c167e0x0){return new Promise(function(_0x3204ba){var _0x3eaa84=[];for(var _0x479a49=0x0;_0x479a49<_0x16694f['length'];_0x479a49++){_0x3eaa84[_0x7e8e('0x62')](insertAdditionalPhones(_0x16694f[_0x479a49][_0x7e8e('0x63')],_0x16694f[_0x479a49][_0x7e8e('0x5a')]));}Promise[_0x7e8e('0x64')](_0x3eaa84)[_0x7e8e('0x19')](function(){_0x3204ba(0x1);});})[_0x7e8e('0x19')](function(){return{'success':_0x4045e1,'failure':_0x3c546a,'duplicates':_0x5541c5};});}else{return{'success':_0x4045e1,'failure':_0x3c546a,'duplicates':_0x5541c5};}}})[_0x7e8e('0x19')](respondWithResult(_0x49af18,0xc9))['catch'](handleError(_0x49af18,null));};exports[_0x7e8e('0x65')]=function(_0x2350bd,_0x5dc4c9){var _0x20771b;return db[_0x7e8e('0x26')][_0x7e8e('0x21')]()[_0x7e8e('0x19')](function(_0x596386){return db['CmContact'][_0x7e8e('0x27')]({'where':{'id':_0x2350bd['params']['id']},'include':[{'model':db[_0x7e8e('0x66')],'as':'Tags','attributes':['id',_0x7e8e('0x1f'),'color'],'required':_0x2350bd[_0x7e8e('0x23')][_0x7e8e('0x67')]?!![]:![]},{'model':db[_0x7e8e('0x4d')],'as':'Phones','where':{'CmContactId':_0x2350bd[_0x7e8e('0x28')]['id']},'required':![],'include':[{'model':db['ContactItemType'],'as':_0x7e8e('0x68')}]}],'order':[db[_0x7e8e('0x69')][_0x7e8e('0x6a')](_0x7e8e('0x6b'))],'attributes':_['keys'](_0x596386)});})[_0x7e8e('0x19')](function(_0x3d1041){if(!_[_0x7e8e('0x57')](_0x3d1041)){_0x20771b=_0x3d1041[_0x7e8e('0x3a')]({'plain':!![]});var _0x1d6023={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x3d1041&&_0x3d1041[_0x7e8e('0x60')]){if(_0x3d1041[_0x7e8e('0x60')]){_0x1d6023[_0x7e8e('0x5f')][_0x7e8e('0x6c')][_0x7e8e('0x62')]({'ListId':{'$ne':_0x3d1041[_0x7e8e('0x60')]}});}}return db[_0x7e8e('0x30')][_0x7e8e('0x22')](_0x1d6023);}})['then'](function(_0x24f3d0){if(!_[_0x7e8e('0x57')](_0x24f3d0)){return _[_0x7e8e('0x6d')](_0x20771b,_[_0x7e8e('0x6e')](_0x24f3d0,function(_0x3dc1e0){return util[_0x7e8e('0x6f')](_0x7e8e('0x70'),_0x3dc1e0['id']);}));}})[_0x7e8e('0x19')](handleEntityNotFound(_0x5dc4c9,null))[_0x7e8e('0x19')](respondWithResult(_0x5dc4c9,null))['catch'](handleError(_0x5dc4c9,null));};exports['update']=function(_0x3eb78c,_0x8f757e){var _0x23437e;if(_0x3eb78c['body']['id']){delete _0x3eb78c[_0x7e8e('0x39')]['id'];}if(!_[_0x7e8e('0x57')](_0x3eb78c['body'][_0x7e8e('0x56')])){var _0x23302e=_0x3eb78c[_0x7e8e('0x39')]['dialTimezone'];if(!_['isNil'](shared[_0x7e8e('0x58')][_0x23302e]))_0x3eb78c[_0x7e8e('0x39')]['utcOffset']=shared['timezones'][_0x23302e][_0x7e8e('0x59')];}return db[_0x7e8e('0x26')]['find']({'where':{'id':_0x3eb78c[_0x7e8e('0x28')]['id']}})[_0x7e8e('0x19')](handleEntityNotFound(_0x8f757e,null))[_0x7e8e('0x19')](saveUpdates(_0x3eb78c[_0x7e8e('0x39')],null))[_0x7e8e('0x19')](function(_0x221609){_0x23437e=_0x221609;var _0xca99e9={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x221609&&_0x221609[_0x7e8e('0x60')]){if(_0x221609[_0x7e8e('0x60')]){_0xca99e9[_0x7e8e('0x5f')][_0x7e8e('0x6c')][_0x7e8e('0x62')]({'ListId':{'$ne':_0x221609[_0x7e8e('0x60')]}});}}return db[_0x7e8e('0x30')][_0x7e8e('0x22')](_0xca99e9);})[_0x7e8e('0x19')](function(_0x219f55){if(_0x219f55){return _['omit'](_[_0x7e8e('0x71')](_0x3eb78c[_0x7e8e('0x39')],function(_0x55c3a2,_0x2bb726){return _[_0x7e8e('0x2b')](_0x2bb726,_0x7e8e('0x2c'));}),_[_0x7e8e('0x6e')](_0x219f55,function(_0x2a9a55){return util[_0x7e8e('0x6f')](_0x7e8e('0x70'),_0x2a9a55['id']);}));}})[_0x7e8e('0x19')](function(_0x1bf47d){if(_0x1bf47d&&!_[_0x7e8e('0x72')](_0x1bf47d)){var _0x41a731=squel[_0x7e8e('0x18')]()[_0x7e8e('0x73')](_0x7e8e('0x74'))['setFields'](_0x1bf47d)[_0x7e8e('0x5f')](_0x7e8e('0x75'),_0x3eb78c['params']['id'])[_0x7e8e('0x76')]();return db[_0x7e8e('0x69')]['query'](_0x41a731[_0x7e8e('0x77')],{'replacements':_0x41a731[_0x7e8e('0x33')]});}})[_0x7e8e('0x19')](function(){if(_0x3eb78c[_0x7e8e('0x39')][_0x7e8e('0x78')]&&_0x23437e){return db[_0x7e8e('0x79')][_0x7e8e('0x18')]({'phone':_0x3eb78c[_0x7e8e('0x39')][_0x7e8e('0x78')],'OrderBy':0x0},{'where':{'ContactId':_0x23437e['id']}});}})[_0x7e8e('0x19')](function(){return _0x23437e;})['then'](respondWithResult(_0x8f757e,null))[_0x7e8e('0x25')](handleError(_0x8f757e,null));};exports[_0x7e8e('0x7a')]=function(_0x7ac79d,_0x254f62){var _0x244435={};var _0x3d609={};var _0x2919f6;var _0x3ebbbb;return db[_0x7e8e('0x26')][_0x7e8e('0x7b')]({'where':{'id':_0x7ac79d[_0x7e8e('0x28')]['id']}})[_0x7e8e('0x19')](handleEntityNotFound(_0x254f62,null))[_0x7e8e('0x19')](function(_0x55d44b){if(_0x55d44b){_0x2919f6=_0x55d44b;_0x3d609[_0x7e8e('0x7c')]=_[_0x7e8e('0x5c')](db[_0x7e8e('0x66')][_0x7e8e('0x7d')]);_0x3d609[_0x7e8e('0x23')]=_[_0x7e8e('0x5c')](_0x7ac79d['query']);_0x3d609[_0x7e8e('0x7e')]=_[_0x7e8e('0x7f')](_0x3d609[_0x7e8e('0x7c')],_0x3d609['query']);_0x244435[_0x7e8e('0x80')]=_[_0x7e8e('0x7f')](_0x3d609[_0x7e8e('0x7c')],qs[_0x7e8e('0x81')](_0x7ac79d[_0x7e8e('0x23')]['fields']));_0x244435[_0x7e8e('0x80')]=_0x244435['attributes'][_0x7e8e('0x2a')]?_0x244435[_0x7e8e('0x80')]:_0x3d609[_0x7e8e('0x7c')];_0x244435['order']=qs[_0x7e8e('0x82')](_0x7ac79d[_0x7e8e('0x23')]['sort']);_0x244435['where']=qs[_0x7e8e('0x7e')](_['pick'](_0x7ac79d[_0x7e8e('0x23')],_0x3d609[_0x7e8e('0x7e')]));if(_0x7ac79d['query'][_0x7e8e('0x83')]){_0x244435['where']=_['merge'](_0x244435[_0x7e8e('0x5f')],{'$or':_[_0x7e8e('0x6e')](_0x244435[_0x7e8e('0x80')],function(_0x5075f1){var _0x27bd24={};_0x27bd24[_0x5075f1]={'$like':'%'+_0x7ac79d[_0x7e8e('0x23')][_0x7e8e('0x83')]+'%'};return _0x27bd24;})});}_0x244435=_[_0x7e8e('0x38')]({},_0x244435,_0x7ac79d[_0x7e8e('0x84')]);return _0x2919f6[_0x7e8e('0x7a')](_0x244435);}})[_0x7e8e('0x19')](function(_0x4839a6){if(_0x4839a6){_0x3ebbbb=_0x4839a6['length'];if(!_0x7ac79d[_0x7e8e('0x23')]['hasOwnProperty'](_0x7e8e('0x85'))){_0x244435['limit']=qs[_0x7e8e('0x15')](_0x7ac79d[_0x7e8e('0x23')][_0x7e8e('0x15')]);_0x244435[_0x7e8e('0x12')]=qs[_0x7e8e('0x12')](_0x7ac79d[_0x7e8e('0x23')]['offset']);}return _0x2919f6['getTags'](_0x244435);}})[_0x7e8e('0x19')](function(_0xe28a48){if(_0xe28a48){return _0xe28a48?{'count':_0x3ebbbb,'rows':_0xe28a48}:null;}})[_0x7e8e('0x19')](respondWithResult(_0x254f62,null))['catch'](handleError(_0x254f62,null));};exports[_0x7e8e('0x86')]=function(_0x41c53e,_0x58f5c4){if(_0x41c53e[_0x7e8e('0x39')]['id']){delete _0x41c53e[_0x7e8e('0x39')]['id'];}return db[_0x7e8e('0x26')][_0x7e8e('0x7b')]({'where':{'id':_0x41c53e[_0x7e8e('0x28')]['id']}})[_0x7e8e('0x19')](handleEntityNotFound(_0x58f5c4,null))['then'](function(_0x2de53d){if(_0x2de53d){return _0x2de53d[_0x7e8e('0x86')](_0x41c53e[_0x7e8e('0x39')][_0x7e8e('0x87')]||[]);}return null;})[_0x7e8e('0x19')](respondWithResult(_0x58f5c4,null))['catch'](handleError(_0x58f5c4,null));};exports[_0x7e8e('0x88')]=function(_0x40b549,_0x536a2f){var _0x1533bd=[];_0x1533bd['push'](addAdditionalPhones(_0x40b549[_0x7e8e('0x39')]));Promise[_0x7e8e('0x64')](_0x1533bd)[_0x7e8e('0x19')](function(){_0x1533bd=[];_0x1533bd[_0x7e8e('0x62')](deleteCmHopperPhones(_0x40b549[_0x7e8e('0x39')]['id']));_0x1533bd[_0x7e8e('0x62')](addCmHopperPhones(_0x40b549[_0x7e8e('0x39')]['id']));Promise['all'](_0x1533bd)['then'](function(){return[0x1];})[_0x7e8e('0x19')](respondWithResult(_0x536a2f,null));});};function addAdditionalPhones(_0x2b6b30){var _0xc89528;return new Promise(function(_0x2db050){return db[_0x7e8e('0x4d')][_0x7e8e('0x1a')]({'where':{'CmContactId':_0x2b6b30['id']}})[_0x7e8e('0x19')](function(){db[_0x7e8e('0x89')][_0x7e8e('0x22')]({'raw':!![],'attributes':['id',_0x7e8e('0x8a')]})[_0x7e8e('0x19')](function(_0x52d558){var _0x5dc8f1=[];for(var _0x17ff9b=0x0;_0x17ff9b<_0x2b6b30[_0x7e8e('0x8b')][_0x7e8e('0x2a')];_0x17ff9b++){var _0x3c2830=_0x2b6b30[_0x7e8e('0x8c')]?_[_0x7e8e('0x57')](_0x2b6b30['item_types'][_0x17ff9b])?'':_0x2b6b30[_0x7e8e('0x8c')][_0x17ff9b]:_0x2b6b30[_0x7e8e('0x8b')][_0x17ff9b][_0x7e8e('0x8d')]?_0x2b6b30[_0x7e8e('0x8b')][_0x17ff9b][_0x7e8e('0x8d')]:'';var _0x252538=_['isNil'](_0x2b6b30[_0x7e8e('0x8b')][_0x17ff9b]['description'])?'':_0x2b6b30[_0x7e8e('0x8b')][_0x17ff9b][_0x7e8e('0x8e')];var _0x2d3e7a=_0x3c2830+':'+_0x2b6b30[_0x7e8e('0x8b')][_0x17ff9b]['phone']+'§'+_0x252538;if(_[_0x7e8e('0x57')](_0xc89528))_0xc89528=_0x2d3e7a;else _0xc89528+=';'+_0x2d3e7a;var _0x5bb119=null;var _0x3f42fa=null;if(_0x2b6b30['item_types']){if(!_['isNil'](_0x2b6b30[_0x7e8e('0x8c')][_0x17ff9b])){_0x3f42fa=_[_0x7e8e('0x27')](_0x52d558,function(_0x535a3d){return _0x535a3d['id']===_0x2b6b30[_0x7e8e('0x8c')][_0x17ff9b];});if(!_[_0x7e8e('0x57')](_0x3f42fa)){_0x5bb119=_0x3f42fa[_0x7e8e('0x8a')];}}}else{if(!_[_0x7e8e('0x57')](_0x2b6b30[_0x7e8e('0x8b')][_0x17ff9b])){_0x3f42fa=_['find'](_0x52d558,function(_0x5e528b){return _0x5e528b['id']===_0x2b6b30[_0x7e8e('0x8b')][_0x17ff9b][_0x7e8e('0x8d')];});if(!_[_0x7e8e('0x57')](_0x3f42fa)){_0x5bb119=_0x17ff9b;}}}if(_[_0x7e8e('0x57')](_0x5bb119)){_0x5bb119=0x64;}_0x5dc8f1['push'](addAdditionalPhone(_0x2b6b30['id'],_0x2b6b30[_0x7e8e('0x8b')][_0x17ff9b]['phone'],_0x2b6b30[_0x7e8e('0x8c')]?_[_0x7e8e('0x57')](_0x2b6b30['item_types'][_0x17ff9b])?null:_0x2b6b30['item_types'][_0x17ff9b]:_0x2b6b30[_0x7e8e('0x8b')][_0x17ff9b][_0x7e8e('0x8d')]?_0x2b6b30[_0x7e8e('0x8b')][_0x17ff9b][_0x7e8e('0x8d')]:null,_0x5bb119,_0x252538));}Promise[_0x7e8e('0x64')](_0x5dc8f1)[_0x7e8e('0x19')](function(){db['CmContact']['update']({'AdditionalPhones':_0xc89528},{'where':{'id':_0x2b6b30['id']}})[_0x7e8e('0x19')](function(){_0x2db050(0x1);});});});});});}function addAdditionalPhone(_0x261120,_0x1a8113,_0x3b7ec5,_0xc60f70,_0x513ada){return db[_0x7e8e('0x4d')][_0x7e8e('0x27')]({'where':{'CmContactId':_0x261120,'item':_0x1a8113}})['then'](function(_0x5397d5){if(_0x5397d5)logger['info'](_0x7e8e('0x8f'),_0x5397d5);else{db[_0x7e8e('0x4d')]['create']({'CmContactId':_0x261120,'item':_0x1a8113,'ItemTypeId':_0x3b7ec5,'OrderBy':_0xc60f70,'ItemClass':_0x7e8e('0x90'),'description':_0x513ada});}});}function deleteCmHopperPhones(_0x50cd2b){return new Promise(function(_0x11ef02){return db[_0x7e8e('0x79')][_0x7e8e('0x22')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x50cd2b}})[_0x7e8e('0x19')](function(_0x1e8f26){db[_0x7e8e('0x91')][_0x7e8e('0x1a')]({'where':{'CmHopperId':{'$in':_[_0x7e8e('0x6e')](_0x1e8f26,'id')}}});})['then'](function(){_0x11ef02(0x1);});});}function addCmHopperPhones(_0x44a1c2){return new Promise(function(_0x15620f){return db[_0x7e8e('0x79')][_0x7e8e('0x22')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x44a1c2}})[_0x7e8e('0x19')](function(_0x22a886){var _0x77554a=[];_[_0x7e8e('0x6e')](_0x22a886,function(_0x1d901b){_0x77554a['push'](createCmHopperPhone(_0x44a1c2,_0x1d901b['id']));});Promise[_0x7e8e('0x64')](_0x77554a)[_0x7e8e('0x19')](function(){_0x15620f(0x1);});});});}function createCmHopperPhone(_0x103dfe,_0x3ff1ab){return new Promise(function(_0x5adc3b){db[_0x7e8e('0x4d')][_0x7e8e('0x22')]({'raw':!![],'attributes':['item',_0x7e8e('0x8a')],'where':{'CmContactId':_0x103dfe,'ItemClass':_0x7e8e('0x90')},'include':[{'model':db[_0x7e8e('0x89')],'attributes':[_0x7e8e('0x8a')],'as':_0x7e8e('0x68')}],'order':[_0x7e8e('0x8a'),db['sequelize'][_0x7e8e('0x6a')](_0x7e8e('0x92'))]})['then'](function(_0x1ecf84){var _0x1b5caf=0x1;var _0x2ccf0e=_[_0x7e8e('0x6e')](_0x1ecf84,function(_0x419ded){_0x419ded[_0x7e8e('0x93')]=_0x3ff1ab;_0x419ded[_0x7e8e('0x78')]=_0x419ded[_0x7e8e('0x94')];_0x419ded[_0x7e8e('0x8a')]=_0x1b5caf;delete _0x419ded[_0x7e8e('0x95')];_0x1b5caf=_0x1b5caf+0x1;return _0x419ded;});return db[_0x7e8e('0x91')][_0x7e8e('0x5b')](_0x2ccf0e,{});})['then'](function(){_0x5adc3b(0x1);});});}function insertAdditionalPhones(_0x20fdba,_0x236c33){return new Promise(function(_0x159ca9){var _0x226c56=[];for(var _0x2e7595=0x0;_0x2e7595<_0x236c33[_0x7e8e('0x2a')];_0x2e7595++){var _0x3885da=_0x236c33[_0x2e7595];_0x226c56[_0x7e8e('0x62')](parseContactItemType(_0x3885da));}Promise['all'](_0x226c56)[_0x7e8e('0x19')](function(){var _0x423a0e={'id':_0x20fdba['id'],'items':_0x236c33};return addAdditionalPhones(_0x423a0e)[_0x7e8e('0x19')](function(){return addCmHopperPhones(_0x20fdba['id']);});})[_0x7e8e('0x19')](function(){_0x159ca9(_0x20fdba);});});}function parseContactItemType(_0x5577d1){return new Promise(function(_0x3d6975){if(_0x5577d1[_0x7e8e('0x37')](_0x7e8e('0x8d'))){_0x3d6975(_0x5577d1);}else{return db[_0x7e8e('0x89')][_0x7e8e('0x27')]({'where':{'name':_0x5577d1[_0x7e8e('0x68')]}})[_0x7e8e('0x19')](function(_0x14cf46){if(_['isNil'](_0x14cf46))_0x5577d1[_0x7e8e('0x8d')]=null;else _0x5577d1[_0x7e8e('0x8d')]=_0x14cf46['id'];_0x3d6975(_0x5577d1);});}});}exports[_0x7e8e('0x96')]=function(_0x2ca5a7,_0x52e884){return db[_0x7e8e('0x4d')][_0x7e8e('0x22')]({'raw':!![],'where':{'CmContactId':_0x2ca5a7[_0x7e8e('0x28')]['id'],'ItemClass':_0x7e8e('0x90')},'include':[{'model':db[_0x7e8e('0x89')],'as':_0x7e8e('0x68')}],'order':[[_0x7e8e('0x8a')],[db[_0x7e8e('0x69')]['literal'](_0x7e8e('0x92'))]]})[_0x7e8e('0x19')](function(_0x20ce71){return _0x20ce71;})[_0x7e8e('0x19')](respondWithResult(_0x52e884,null))[_0x7e8e('0x25')](handleError(_0x52e884,null));};exports[_0x7e8e('0x97')]=function(_0x314cb9,_0x2415fa){return db['CmContactHasItem']['findAll']({'raw':!![],'where':{'CmContactId':_0x314cb9[_0x7e8e('0x39')][_0x7e8e('0x98')]}})[_0x7e8e('0x19')](function(_0x3c0dc8){var _0xf8fed1=_[_0x7e8e('0x6e')](_0x3c0dc8,function(_0xc36fc3){_0xc36fc3[_0x7e8e('0x99')]=_0x314cb9[_0x7e8e('0x39')][_0x7e8e('0x9a')];return _0xc36fc3;});return db['CmContactHasItem'][_0x7e8e('0x5b')](_0xf8fed1,{});})[_0x7e8e('0x19')](function(){return addCmHopperPhones(_0x314cb9[_0x7e8e('0x39')][_0x7e8e('0x9a')]);})[_0x7e8e('0x19')](function(){return['ok'];})[_0x7e8e('0x19')](respondWithResult(_0x2415fa,null))['catch'](handleError(_0x2415fa,null));};exports[_0x7e8e('0x9b')]=function(_0x3cc76a,_0x5e6e75){var _0x5ea0ca=[];_0x5ea0ca[_0x7e8e('0x62')](createCmHopperPhone(_0x3cc76a[_0x7e8e('0x39')]['id'],_0x3cc76a['body'][_0x7e8e('0x9c')]));Promise[_0x7e8e('0x64')](_0x5ea0ca)[_0x7e8e('0x19')](function(){return[0x1];})[_0x7e8e('0x19')](respondWithResult(_0x5e6e75,null));};exports[_0x7e8e('0x9d')]=function(_0x209985,_0x5c3dd0){var _0x2920be={'raw':![],'where':{}};var _0x883651={};var _0x173413={'count':0x0,'rows':[]};return db[_0x7e8e('0x26')][_0x7e8e('0x7b')]({'where':{'id':_0x209985[_0x7e8e('0x28')]['id']}})[_0x7e8e('0x19')](handleEntityNotFound(_0x5c3dd0,null))[_0x7e8e('0x19')](function(_0x16c194){if(_0x16c194){_0x883651['model']=_[_0x7e8e('0x5c')](db[_0x7e8e('0x79')][_0x7e8e('0x7d')]);_0x883651[_0x7e8e('0x23')]=_[_0x7e8e('0x5c')](_0x209985[_0x7e8e('0x23')]);_0x883651[_0x7e8e('0x7e')]=_[_0x7e8e('0x7f')](_0x883651[_0x7e8e('0x7c')],_0x883651['query']);_0x2920be[_0x7e8e('0x80')]=_[_0x7e8e('0x7f')](_0x883651[_0x7e8e('0x7c')],qs[_0x7e8e('0x81')](_0x209985[_0x7e8e('0x23')][_0x7e8e('0x81')]));_0x2920be[_0x7e8e('0x80')]=_0x2920be['attributes'][_0x7e8e('0x2a')]?_0x2920be[_0x7e8e('0x80')]:_0x883651['model'];if(!_0x209985[_0x7e8e('0x23')][_0x7e8e('0x37')]('nolimit')){_0x2920be['limit']=qs[_0x7e8e('0x15')](_0x209985['query'][_0x7e8e('0x15')]);_0x2920be['offset']=qs[_0x7e8e('0x12')](_0x209985[_0x7e8e('0x23')][_0x7e8e('0x12')]);}_0x2920be[_0x7e8e('0x9e')]=qs[_0x7e8e('0x82')](_0x209985[_0x7e8e('0x23')]['sort']);_0x2920be[_0x7e8e('0x5f')]=qs['filters'](_[_0x7e8e('0x9f')](_0x209985['query'],_0x883651['filters']));_0x2920be['where'][_0x7e8e('0xa0')]=_0x16c194['id'];if(_0x209985[_0x7e8e('0x23')]['filter']){_0x2920be[_0x7e8e('0x5f')]=_['merge'](_0x2920be['where'],{'$or':_[_0x7e8e('0x6e')](_0x2920be[_0x7e8e('0x80')],function(_0xc68b1c){var _0x4d0129={};_0x4d0129[_0xc68b1c]={'$like':'%'+_0x209985[_0x7e8e('0x23')][_0x7e8e('0x83')]+'%'};return _0x4d0129;})});}_0x2920be=_[_0x7e8e('0x38')]({},_0x2920be,_0x209985['options']);return db[_0x7e8e('0x79')][_0x7e8e('0x14')]({'where':_0x2920be[_0x7e8e('0x5f')]})['then'](function(_0x40ce14){_0x173413['count']=_0x40ce14;if(_0x209985[_0x7e8e('0x23')][_0x7e8e('0xa1')]){_0x2920be[_0x7e8e('0xa2')]=[{'all':!![]}];}return db[_0x7e8e('0x79')][_0x7e8e('0x22')](_0x2920be);})[_0x7e8e('0x19')](function(_0x4d1d53){_0x173413[_0x7e8e('0xa3')]=_0x4d1d53;return _0x173413;});}})['then'](respondWithFilteredResult(_0x5c3dd0,_0x2920be))['catch'](handleError(_0x5c3dd0,null));};exports[_0x7e8e('0xa4')]=function(_0x111bb9,_0x3dbea0){var _0x393eba={'raw':!![],'where':{}};var _0x1978cd={};var _0x31079f={'count':0x0,'rows':[]};return db[_0x7e8e('0x26')]['findOne']({'where':{'id':_0x111bb9[_0x7e8e('0x28')]['id']}})[_0x7e8e('0x19')](handleEntityNotFound(_0x3dbea0,null))[_0x7e8e('0x19')](function(_0x1cca23){if(_0x1cca23){_0x1978cd[_0x7e8e('0x7c')]=_['keys'](db['CmHopperHistory']['rawAttributes']);_0x1978cd[_0x7e8e('0x23')]=_[_0x7e8e('0x5c')](_0x111bb9[_0x7e8e('0x23')]);_0x1978cd['filters']=_['intersection'](_0x1978cd[_0x7e8e('0x7c')],_0x1978cd[_0x7e8e('0x23')]);_0x393eba[_0x7e8e('0x80')]=_[_0x7e8e('0x7f')](_0x1978cd['model'],qs[_0x7e8e('0x81')](_0x111bb9[_0x7e8e('0x23')][_0x7e8e('0x81')]));_0x393eba[_0x7e8e('0x80')]=_0x393eba['attributes'][_0x7e8e('0x2a')]?_0x393eba[_0x7e8e('0x80')]:_0x1978cd[_0x7e8e('0x7c')];if(!_0x111bb9[_0x7e8e('0x23')]['hasOwnProperty']('nolimit')){_0x393eba[_0x7e8e('0x15')]=qs[_0x7e8e('0x15')](_0x111bb9[_0x7e8e('0x23')][_0x7e8e('0x15')]);_0x393eba[_0x7e8e('0x12')]=qs[_0x7e8e('0x12')](_0x111bb9[_0x7e8e('0x23')][_0x7e8e('0x12')]);}_0x393eba[_0x7e8e('0x9e')]=qs[_0x7e8e('0x82')](_0x111bb9[_0x7e8e('0x23')][_0x7e8e('0x82')]);_0x393eba[_0x7e8e('0x5f')]=qs[_0x7e8e('0x7e')](_[_0x7e8e('0x9f')](_0x111bb9[_0x7e8e('0x23')],_0x1978cd[_0x7e8e('0x7e')]));_0x393eba[_0x7e8e('0x5f')][_0x7e8e('0xa0')]=_0x1cca23['id'];if(_0x111bb9['query'][_0x7e8e('0x83')]){_0x393eba[_0x7e8e('0x5f')]=_[_0x7e8e('0x38')](_0x393eba[_0x7e8e('0x5f')],{'$or':_[_0x7e8e('0x6e')](_0x393eba[_0x7e8e('0x80')],function(_0x38c461){var _0x19b64e={};_0x19b64e[_0x38c461]={'$like':'%'+_0x111bb9[_0x7e8e('0x23')][_0x7e8e('0x83')]+'%'};return _0x19b64e;})});}_0x393eba=_[_0x7e8e('0x38')]({},_0x393eba,_0x111bb9[_0x7e8e('0x84')]);return db[_0x7e8e('0xa5')][_0x7e8e('0x14')]({'where':_0x393eba[_0x7e8e('0x5f')]})[_0x7e8e('0x19')](function(_0x47d208){_0x31079f[_0x7e8e('0x14')]=_0x47d208;if(_0x111bb9[_0x7e8e('0x23')][_0x7e8e('0xa1')]){_0x393eba['include']=[{'all':!![]}];}return db[_0x7e8e('0xa5')][_0x7e8e('0x22')](_0x393eba);})[_0x7e8e('0x19')](function(_0xa8ef9){_0x31079f[_0x7e8e('0xa3')]=_0xa8ef9;return _0x31079f;});}})[_0x7e8e('0x19')](respondWithFilteredResult(_0x3dbea0,_0x393eba))['catch'](handleError(_0x3dbea0,null));};exports[_0x7e8e('0xa6')]=function(_0x2ff4e6,_0x3e782d){var _0x37c6a8={'raw':!![],'where':{}};var _0x24c87b={};var _0x1871e1={'count':0x0,'rows':[]};return db[_0x7e8e('0x26')]['findOne']({'where':{'id':_0x2ff4e6[_0x7e8e('0x28')]['id']}})[_0x7e8e('0x19')](handleEntityNotFound(_0x3e782d,null))[_0x7e8e('0x19')](function(_0xb20294){if(_0xb20294){_0x24c87b[_0x7e8e('0x7c')]=_[_0x7e8e('0x5c')](db[_0x7e8e('0xa7')]['rawAttributes']);_0x24c87b[_0x7e8e('0x23')]=_[_0x7e8e('0x5c')](_0x2ff4e6[_0x7e8e('0x23')]);_0x24c87b[_0x7e8e('0x7e')]=_['intersection'](_0x24c87b[_0x7e8e('0x7c')],_0x24c87b['query']);_0x37c6a8['attributes']=_[_0x7e8e('0x7f')](_0x24c87b['model'],qs[_0x7e8e('0x81')](_0x2ff4e6[_0x7e8e('0x23')][_0x7e8e('0x81')]));_0x37c6a8[_0x7e8e('0x80')]=_0x37c6a8[_0x7e8e('0x80')][_0x7e8e('0x2a')]?_0x37c6a8[_0x7e8e('0x80')]:_0x24c87b['model'];if(!_0x2ff4e6[_0x7e8e('0x23')][_0x7e8e('0x37')](_0x7e8e('0x85'))){_0x37c6a8['limit']=qs[_0x7e8e('0x15')](_0x2ff4e6[_0x7e8e('0x23')]['limit']);_0x37c6a8[_0x7e8e('0x12')]=qs[_0x7e8e('0x12')](_0x2ff4e6[_0x7e8e('0x23')]['offset']);}_0x37c6a8['order']=qs['sort'](_0x2ff4e6[_0x7e8e('0x23')][_0x7e8e('0x82')]);_0x37c6a8[_0x7e8e('0x5f')]=qs[_0x7e8e('0x7e')](_['pick'](_0x2ff4e6[_0x7e8e('0x23')],_0x24c87b[_0x7e8e('0x7e')]));_0x37c6a8[_0x7e8e('0x5f')][_0x7e8e('0xa0')]=_0xb20294['id'];if(_0x2ff4e6['query'][_0x7e8e('0x83')]){_0x37c6a8[_0x7e8e('0x5f')]=_[_0x7e8e('0x38')](_0x37c6a8['where'],{'$or':_[_0x7e8e('0x6e')](_0x37c6a8[_0x7e8e('0x80')],function(_0x3e473e){var _0x256b2b={};_0x256b2b[_0x3e473e]={'$like':'%'+_0x2ff4e6[_0x7e8e('0x23')]['filter']+'%'};return _0x256b2b;})});}_0x37c6a8=_[_0x7e8e('0x38')]({},_0x37c6a8,_0x2ff4e6['options']);return db[_0x7e8e('0xa7')]['count']({'where':_0x37c6a8[_0x7e8e('0x5f')]})['then'](function(_0x480c01){_0x1871e1['count']=_0x480c01;if(_0x2ff4e6[_0x7e8e('0x23')][_0x7e8e('0xa1')]){_0x37c6a8[_0x7e8e('0xa2')]=[{'all':!![]}];}return db['CmHopperFinal'][_0x7e8e('0x22')](_0x37c6a8);})['then'](function(_0x34392a){_0x1871e1[_0x7e8e('0xa3')]=_0x34392a;return _0x1871e1;});}})[_0x7e8e('0x19')](respondWithFilteredResult(_0x3e782d,_0x37c6a8))[_0x7e8e('0x25')](handleError(_0x3e782d,null));};exports['getJscriptySessions']=function(_0x33a703,_0x32618f){var _0x177412={'raw':!![],'where':{}};var _0x1c6fe0={};var _0x3f865d={'count':0x0,'rows':[]};return db[_0x7e8e('0x26')][_0x7e8e('0x7b')]({'where':{'id':_0x33a703['params']['id']}})['then'](handleEntityNotFound(_0x32618f,null))['then'](function(_0xb06475){if(_0xb06475){_0x1c6fe0[_0x7e8e('0x7c')]=_[_0x7e8e('0x5c')](db[_0x7e8e('0x53')][_0x7e8e('0x7d')]);_0x1c6fe0['query']=_[_0x7e8e('0x5c')](_0x33a703['query']);_0x1c6fe0['filters']=_['intersection'](_0x1c6fe0[_0x7e8e('0x7c')],_0x1c6fe0[_0x7e8e('0x23')]);_0x177412['attributes']=_['intersection'](_0x1c6fe0['model'],qs[_0x7e8e('0x81')](_0x33a703[_0x7e8e('0x23')]['fields']));_0x177412[_0x7e8e('0x80')]=_0x177412['attributes']['length']?_0x177412[_0x7e8e('0x80')]:_0x1c6fe0[_0x7e8e('0x7c')];if(!_0x33a703[_0x7e8e('0x23')]['hasOwnProperty'](_0x7e8e('0x85'))){_0x177412[_0x7e8e('0x15')]=qs['limit'](_0x33a703['query'][_0x7e8e('0x15')]);_0x177412[_0x7e8e('0x12')]=qs[_0x7e8e('0x12')](_0x33a703['query']['offset']);}_0x177412[_0x7e8e('0x9e')]=qs['sort'](_0x33a703[_0x7e8e('0x23')][_0x7e8e('0x82')]);_0x177412[_0x7e8e('0x5f')]=qs[_0x7e8e('0x7e')](_[_0x7e8e('0x9f')](_0x33a703[_0x7e8e('0x23')],_0x1c6fe0['filters']));_0x177412[_0x7e8e('0x5f')][_0x7e8e('0xa0')]=_0xb06475['id'];if(_0x33a703[_0x7e8e('0x23')][_0x7e8e('0x83')]){_0x177412[_0x7e8e('0x5f')]=_[_0x7e8e('0x38')](_0x177412[_0x7e8e('0x5f')],{'$or':_[_0x7e8e('0x6e')](_0x177412[_0x7e8e('0x80')],function(_0x57fcdf){var _0x43a3f7={};_0x43a3f7[_0x57fcdf]={'$like':'%'+_0x33a703[_0x7e8e('0x23')][_0x7e8e('0x83')]+'%'};return _0x43a3f7;})});}_0x177412=_[_0x7e8e('0x38')]({},_0x177412,_0x33a703[_0x7e8e('0x84')]);return db[_0x7e8e('0x53')]['count']({'where':_0x177412[_0x7e8e('0x5f')]})['then'](function(_0x261324){_0x3f865d[_0x7e8e('0x14')]=_0x261324;if(_0x33a703[_0x7e8e('0x23')][_0x7e8e('0xa1')]){_0x177412['include']=[{'all':!![]}];}return db['JscriptySessionReport'][_0x7e8e('0x22')](_0x177412);})[_0x7e8e('0x19')](function(_0xdd9b46){_0x3f865d[_0x7e8e('0xa3')]=_0xdd9b46;return _0x3f865d;});}})[_0x7e8e('0x19')](respondWithFilteredResult(_0x32618f,_0x177412))[_0x7e8e('0x25')](handleError(_0x32618f,null));};exports[_0x7e8e('0xa8')]=function(_0x12548f,_0x39e63f){try{if(!_0x12548f[_0x7e8e('0x39')][_0x7e8e('0x60')]){throw new Error(_0x7e8e('0xa9'));}if(!_0x12548f[_0x7e8e('0x39')]['binding_keys']){throw new Error('No\x20association\x20keys\x20specified!');}if(!_0x12548f[_0x7e8e('0x39')][_0x7e8e('0xaa')]){throw new Error(_0x7e8e('0xab'));}if(!_0x12548f['body'][_0x7e8e('0xac')]){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x575b89=_0x12548f[_0x7e8e('0x39')][_0x7e8e('0xad')]['split'](',');var _0x1d3e27=_0x12548f[_0x7e8e('0x39')][_0x7e8e('0xaa')]['split'](',');if(!_0x575b89[_0x7e8e('0x2a')]||!_0x1d3e27['length']||_0x575b89['length']!==_0x1d3e27['length']){throw new Error(_0x7e8e('0xae'));}_0x12548f[_0x7e8e('0x39')][_0x7e8e('0x81')]=_['zipObject'](_0x575b89,_0x1d3e27);if(!_0x12548f['body'][_0x7e8e('0x81')][_0x7e8e('0x78')]){throw new Error(_0x7e8e('0xaf'));}if(!_0x12548f[_0x7e8e('0x39')][_0x7e8e('0x81')][_0x7e8e('0xb0')]){throw new Error(_0x7e8e('0xb1'));}var _0x1c5e5a=path['join'](config[_0x7e8e('0xb2')],_0x7e8e('0xb3'),_0x12548f['file'][_0x7e8e('0xb4')]);fs[_0x7e8e('0xb5')](_0x1c5e5a,parseInt('0777',0x8));var _0x21bd0e=require(_0x7e8e('0xb6'))['fork'](path[_0x7e8e('0x3d')](__dirname,'../../components/import/cm/csv'),[_0x1c5e5a,_0x12548f['body'][_0x7e8e('0xad')],_0x12548f[_0x7e8e('0x39')][_0x7e8e('0xaa')],_0x12548f[_0x7e8e('0x39')][_0x7e8e('0x60')],_0x12548f[_0x7e8e('0x39')][_0x7e8e('0xb7')],_0x12548f[_0x7e8e('0x39')][_0x7e8e('0x5d')],_0x12548f[_0x7e8e('0x39')][_0x7e8e('0xac')]]);return _0x39e63f[_0x7e8e('0x10')](0xc8)['json']({'message':'File\x20uploaded\x20correctly!','pid':_0x21bd0e[_0x7e8e('0xb8')]});}catch(_0x2d21fd){return _0x39e63f['status'](0x1f4)[_0x7e8e('0xb9')](_0x2d21fd);}};exports[_0x7e8e('0xba')]=function(_0x856a52,_0x287ec8){var _0x525183=fs['createReadStream'](_0x856a52[_0x7e8e('0xbb')][_0x7e8e('0x2')]);Papa[_0x7e8e('0xbc')](_0x525183,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x2897ad){return _0x287ec8[_0x7e8e('0x10')](0xc8)[_0x7e8e('0x11')]({'file':_0x856a52['file'],'fields':_0x2897ad['meta'][_0x7e8e('0x81')]});}});};exports[_0x7e8e('0xbd')]=function(_0xdb9cc9,_0x6a0895){return db['User'][_0x7e8e('0x22')]({'raw':!![],'attributes':['id'],'where':{'role':_0x7e8e('0xbe')}})[_0x7e8e('0x19')](function(_0x171177){var _0x22ebab=![];if(!_0xdb9cc9['body'][_0x7e8e('0x60')]){throw new Error(_0x7e8e('0xa9'));}if(!_0xdb9cc9[_0x7e8e('0x39')][_0x7e8e('0xbf')]['phone']){throw new Error(_0x7e8e('0xaf'));}if(!_0xdb9cc9[_0x7e8e('0x39')][_0x7e8e('0xbf')][_0x7e8e('0xb0')]){throw new Error(_0x7e8e('0xb1'));}if(!_0xdb9cc9[_0x7e8e('0x39')][_0x7e8e('0xac')]){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x3dc55b=require(_0x7e8e('0xb6'))[_0x7e8e('0xc0')](path['join'](__dirname,_0x7e8e('0xc1')),[_0xdb9cc9[_0x7e8e('0x28')]['id'],JSON[_0x7e8e('0xc2')](_0xdb9cc9[_0x7e8e('0x39')]),JSON[_0x7e8e('0xc2')](_0x171177)]);_0x3dc55b['on']('message',function(){_0x22ebab=!![];return _0x6a0895[_0x7e8e('0x10')](0xc8)[_0x7e8e('0x11')]({'message':_0x7e8e('0xc3'),'pid':_0x3dc55b['pid']});});_0x3dc55b['on']('exit',function(_0x133813){if(_0x133813&&!_0x22ebab){return _0x6a0895[_0x7e8e('0x10')](0x1f4)['json']({'message':_0x7e8e('0xc4'),'pid':_0x3dc55b[_0x7e8e('0xb8')]});}});})['catch'](handleError(_0x6a0895,null));};exports[_0x7e8e('0xc5')]=function(_0x43974b,_0x326c1d){return db[_0x7e8e('0xc6')][_0x7e8e('0x22')]({'raw':!![],'attributes':['id'],'where':{'role':_0x7e8e('0xbe')}})[_0x7e8e('0x19')](function(_0x5d6efb){var _0x340142=![];if(!_0x43974b['body'][_0x7e8e('0x60')]){throw new Error('No\x20ListId\x20specified');}if(!_0x43974b[_0x7e8e('0x39')][_0x7e8e('0xbf')][_0x7e8e('0x78')]){throw new Error(_0x7e8e('0xaf'));}if(!_0x43974b[_0x7e8e('0x39')]['binding'][_0x7e8e('0xb0')]){throw new Error(_0x7e8e('0xb1'));}if(!_0x43974b[_0x7e8e('0x39')][_0x7e8e('0xac')]){throw new Error(_0x7e8e('0xc7'));}var _0x2cfda8=require('child_process')[_0x7e8e('0xc0')](path[_0x7e8e('0x3d')](__dirname,_0x7e8e('0xc8')),[_0x43974b[_0x7e8e('0x28')]['id'],JSON[_0x7e8e('0xc2')](_0x43974b[_0x7e8e('0x39')]),JSON[_0x7e8e('0xc2')](_0x5d6efb)]);_0x2cfda8['on'](_0x7e8e('0xc9'),function(){_0x340142=!![];return _0x326c1d['status'](0xc8)[_0x7e8e('0x11')]({'message':_0x7e8e('0xc3'),'pid':_0x2cfda8['pid']});});_0x2cfda8['on'](_0x7e8e('0xca'),function(_0x96f858){if(_0x96f858&&!_0x340142){return _0x326c1d[_0x7e8e('0x10')](0x1f4)[_0x7e8e('0x11')]({'message':_0x7e8e('0xc4'),'pid':_0x2cfda8[_0x7e8e('0xb8')]});}});})['catch'](handleError(_0x326c1d,null));};exports['getJourney']=function(_0x1958e1,_0x3f3fc0){var _0x2b915a=[_0x7e8e('0xcb'),_0x7e8e('0xcc'),_0x7e8e('0xcd'),'openchannel','fax','whatsapp',_0x7e8e('0xce')];var _0x1a1c0d={'offset':0x0,'order':qs[_0x7e8e('0x82')](_0x7e8e('0xcf'))},_0x9c6fef={'count':0x0,'rows':[]};Promise['resolve']()[_0x7e8e('0x19')](function(){if(_0x1958e1[_0x7e8e('0x23')][_0x7e8e('0xd0')]){if(!_[_0x7e8e('0xd1')](_0x2b915a,_0x1958e1[_0x7e8e('0x23')][_0x7e8e('0xd0')][_0x7e8e('0xd2')]())){throw new Error(_0x7e8e('0xd3'));}_0x2b915a=[_0x1958e1['query'][_0x7e8e('0xd0')]['toLowerCase']()];}if(_0x1958e1['query'][_0x7e8e('0xd4')]){try{var _0x382706=JSON[_0x7e8e('0xbc')](_0x1958e1[_0x7e8e('0x23')]['range']);if(!moment(_0x382706[_0x7e8e('0x3e')])[_0x7e8e('0xd5')]()){throw new Error(_0x7e8e('0xd6'));}if(!moment(_0x382706['to'])[_0x7e8e('0xd5')]()){throw new Error(_0x7e8e('0xd7'));}}catch(_0x5cfbd8){throw new Error(_0x7e8e('0xd8'));}}if(!_0x1958e1[_0x7e8e('0x23')][_0x7e8e('0x37')](_0x7e8e('0x85'))){_0x1a1c0d['limit']=qs[_0x7e8e('0x15')](_0x1958e1[_0x7e8e('0x23')][_0x7e8e('0x15')]||0xa);_0x1a1c0d[_0x7e8e('0x12')]=qs[_0x7e8e('0x12')](_0x1958e1[_0x7e8e('0x23')]['offset']);}var _0xe54ceb=_0x2b915a[_0x7e8e('0x6e')](function(_0x4e10b3){if(_0x4e10b3===_0x7e8e('0xce')){var _0x6b6a71={'attributes':['id',_0x7e8e('0xd9'),_0x7e8e('0x32'),_0x7e8e('0xda'),_0x7e8e('0xdb'),_0x7e8e('0xdc'),_0x7e8e('0xdd'),_0x7e8e('0xde'),_0x7e8e('0xdf'),_0x7e8e('0xe0'),_0x7e8e('0xe1'),'userDisposition',_0x7e8e('0xe2'),_0x7e8e('0xe3'),_0x7e8e('0xe4')],'where':{'ContactId':_0x1958e1[_0x7e8e('0x28')]['id']},'include':[{'model':db[_0x7e8e('0xc6')],'as':_0x7e8e('0xc6'),'attributes':['id',_0x7e8e('0x1f'),_0x7e8e('0xe5'),_0x7e8e('0xe6')]}],'order':[[_0x7e8e('0xe1'),_0x7e8e('0xe7')]]};if(_0x1958e1[_0x7e8e('0x23')]['range']){_0x6b6a71[_0x7e8e('0x5f')][_0x7e8e('0xe1')]={'$gte':_0x382706['from'],'$lte':_0x382706['to']};}return db[_0x7e8e('0x4f')][_0x7e8e('0xe8')](_0x6b6a71)[_0x7e8e('0x19')](function(_0x125d84){_0x9c6fef[_0x7e8e('0x14')]+=_0x125d84[_0x7e8e('0x14')];return _[_0x7e8e('0x6e')](_0x125d84[_0x7e8e('0xa3')],function(_0x1984f8){var _0x49d3d7=_0x1984f8['get']({'plain':!![]});_0x49d3d7[_0x7e8e('0xd0')]=_0x4e10b3;if(_0x49d3d7[_0x7e8e('0xc6')]){_0x49d3d7[_0x7e8e('0xc6')]={'id':_0x49d3d7[_0x7e8e('0xc6')]['id'],'name':_0x49d3d7['User'][_0x7e8e('0x1f')],'fullname':_0x49d3d7[_0x7e8e('0xc6')][_0x7e8e('0xe5')],'alias':_0x49d3d7[_0x7e8e('0xc6')][_0x7e8e('0xe6')]};}return _0x49d3d7;});});}else{var _0x28e071=_[_0x7e8e('0xe9')](_0x4e10b3)+(_0x4e10b3==='chat'?_0x7e8e('0xea'):_0x7e8e('0xeb'));var _0x59e98d={'attributes':['id',_0x7e8e('0xec'),'closedAt',_0x7e8e('0xe1'),'note','disposition','secondDisposition',_0x7e8e('0xed'),'UserId',_0x28e071+'Id'],'where':{'ContactId':_0x1958e1[_0x7e8e('0x28')]['id']},'include':[{'model':db[_0x28e071],'as':'Account','attributes':['id',_0x7e8e('0x1f'),_0x7e8e('0xee')]},{'model':db['User'],'as':_0x7e8e('0xef'),'attributes':['id',_0x7e8e('0x1f'),'fullname']},{'model':db[_0x7e8e('0x66')],'as':_0x7e8e('0xf0'),'attributes':['id',_0x7e8e('0x1f'),_0x7e8e('0xf1')],'through':{'attributes':[]}}],'order':[['createdAt','DESC']]};if(_0x1958e1[_0x7e8e('0x23')][_0x7e8e('0xd4')]){_0x59e98d[_0x7e8e('0x5f')][_0x7e8e('0xe1')]={'$gte':_0x382706['from'],'$lte':_0x382706['to']};}switch(_0x4e10b3){case _0x7e8e('0xcc'):_0x59e98d['attributes'][_0x7e8e('0x62')](_0x7e8e('0xf2'),_0x7e8e('0xf3'),_0x7e8e('0xf4'),_0x7e8e('0xf5'),_0x7e8e('0xf6'),_0x7e8e('0xf7'),'ratingType',_0x7e8e('0xf8'),_0x7e8e('0xf9'));break;case _0x7e8e('0xcb'):_0x59e98d[_0x7e8e('0x80')]['push'](_0x7e8e('0xfa'),'substatus');break;case _0x7e8e('0xfb'):_0x59e98d[_0x7e8e('0x80')][_0x7e8e('0x62')](_0x7e8e('0xfc'),'threadId');break;}return db[_['startCase'](_0x4e10b3)+'Interaction'][_0x7e8e('0xe8')](_0x59e98d)['then'](function(_0x4f984b){_0x9c6fef[_0x7e8e('0x14')]+=_0x4f984b[_0x7e8e('0x14')];return _[_0x7e8e('0x6e')](_0x4f984b['rows'],function(_0x3fbaa6){var _0x1d17cb=_0x3fbaa6[_0x7e8e('0x3a')]({'plain':!![]});_0x1d17cb[_0x7e8e('0xd0')]=_0x4e10b3;if(_0x1d17cb['Owner']){_0x1d17cb[_0x7e8e('0xef')]={'id':_0x1d17cb[_0x7e8e('0xef')]['id'],'name':_0x1d17cb[_0x7e8e('0xef')][_0x7e8e('0x1f')],'fullname':_0x1d17cb[_0x7e8e('0xef')][_0x7e8e('0xe5')]};}return _0x1d17cb;});});}});return Promise['all'](_0xe54ceb);})[_0x7e8e('0x19')](function(_0x2876ce){return _(_0x2876ce)[_0x7e8e('0xfd')]()[_0x7e8e('0xfe')]('createdAt')[_0x7e8e('0xff')]()[_0x7e8e('0x100')]();})['then'](function(_0xe1244c){_0x9c6fef[_0x7e8e('0xa3')]=_0x1a1c0d[_0x7e8e('0x15')]?_0xe1244c[_0x7e8e('0x101')](_0x1a1c0d['offset'],_0x1a1c0d['offset']+_0x1a1c0d['limit']):_0xe1244c;return _0x9c6fef;})[_0x7e8e('0x19')](respondWithFilteredResult(_0x3f3fc0,_0x1a1c0d))[_0x7e8e('0x25')](handleError(_0x3f3fc0,null));}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.events.js b/server/api/cmContact/cmContact.events.js index ac74b4f..f374120 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 _0x33d7=['update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','CmContact','setMaxListeners','save'];(function(_0x2134a3,_0x44d4c4){var _0x2f4660=function(_0x4ae57c){while(--_0x4ae57c){_0x2134a3['push'](_0x2134a3['shift']());}};_0x2f4660(++_0x44d4c4);}(_0x33d7,0x1d4));var _0x733d=function(_0x1112d6,_0x5e5fcf){_0x1112d6=_0x1112d6-0x0;var _0x1188d7=_0x33d7[_0x1112d6];return _0x1188d7;};'use strict';var EventEmitter=require(_0x733d('0x0'));var CmContact=require(_0x733d('0x1'))['db'][_0x733d('0x2')];var CmContactEvents=new EventEmitter();CmContactEvents[_0x733d('0x3')](0x0);var events={'afterCreate':_0x733d('0x4'),'afterUpdate':_0x733d('0x5'),'afterDestroy':_0x733d('0x6')};function emitEvent(_0x52ba8b){return function(_0x2f56dc,_0x3710f6,_0x54fa77){CmContactEvents[_0x733d('0x7')](_0x52ba8b+':'+_0x2f56dc['id'],_0x2f56dc);CmContactEvents[_0x733d('0x7')](_0x52ba8b,_0x2f56dc);_0x54fa77(null);};}for(var e in events){if(events[_0x733d('0x8')](e)){var event=events[e];CmContact[_0x733d('0x9')](e,emitEvent(event));}}module[_0x733d('0xa')]=CmContactEvents; \ No newline at end of file +var _0x0bb2=['../../mysqldb','CmContact','setMaxListeners','save','update','remove','emit','hasOwnProperty','exports'];(function(_0x4a1efa,_0x3e9587){var _0x57f83a=function(_0x373bd7){while(--_0x373bd7){_0x4a1efa['push'](_0x4a1efa['shift']());}};_0x57f83a(++_0x3e9587);}(_0x0bb2,0x1dd));var _0x20bb=function(_0x2c7ce7,_0x8d34cf){_0x2c7ce7=_0x2c7ce7-0x0;var _0x59c1bf=_0x0bb2[_0x2c7ce7];return _0x59c1bf;};'use strict';var EventEmitter=require('events');var CmContact=require(_0x20bb('0x0'))['db'][_0x20bb('0x1')];var CmContactEvents=new EventEmitter();CmContactEvents[_0x20bb('0x2')](0x0);var events={'afterCreate':_0x20bb('0x3'),'afterUpdate':_0x20bb('0x4'),'afterDestroy':_0x20bb('0x5')};function emitEvent(_0x5bb2bd){return function(_0x2756cc,_0x27bd9c,_0x4923c3){CmContactEvents['emit'](_0x5bb2bd+':'+_0x2756cc['id'],_0x2756cc);CmContactEvents[_0x20bb('0x6')](_0x5bb2bd,_0x2756cc);_0x4923c3(null);};}for(var e in events){if(events[_0x20bb('0x7')](e)){var event=events[e];CmContact['hook'](e,emitEvent(event));}}module[_0x20bb('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 ec1405c..8f9d12a 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 _0x6ccb=['inspect','scheduledat','format','isNil','dialTimezone','findOne','then','timezones','utcOffset','add','minutes','YYYY-MM-DD\x20HH:mm:ss','ret','cmContact,\x20afterCreate\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','CmHopper','create','ListId','priority','callbackUniqueid','catch','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','CmHopperFinal','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20VoiceQueue\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20Campaign\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20Campaign\x20','cmContact,\x20afterCreate,\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20Campaign\x20','VoiceQueue','findAll','outbound','dialCheckDuplicateType','CmList','Lists','always','onlyIfOpen','BlackLists','length','message','Campaign','CmHopperBlack','cmContact,\x20%s,\x20%s','List\x20not\x20found','isEmpty','ContactId','VoiceQueueId','CampaignId','push','info','[CmContact][afterDestroy][Succesfull]','[CmContact][afterDestroy][Error]','lodash','util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','../../config/environment/shared','./cmContact.attributes','exports','define','CmContact','cm_contacts','phone','firstName','mobile','email','FULLTEXT','utf8mb4_unicode_ci','models','get','error','cmContact','afterCreate'];(function(_0x352853,_0x4b2ccf){var _0x487b0c=function(_0x22e247){while(--_0x22e247){_0x352853['push'](_0x352853['shift']());}};_0x487b0c(++_0x4b2ccf);}(_0x6ccb,0xcb));var _0xb6cc=function(_0x52aa4a,_0x5781e9){_0x52aa4a=_0x52aa4a-0x0;var _0x4a0704=_0x6ccb[_0x52aa4a];return _0x4a0704;};'use strict';var _=require(_0xb6cc('0x0'));var util=require(_0xb6cc('0x1'));var logger=require(_0xb6cc('0x2'))(_0xb6cc('0x3'));var moment=require(_0xb6cc('0x4'));var BPromise=require(_0xb6cc('0x5'));var rp=require(_0xb6cc('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xb6cc('0x7'));var shared=require(_0xb6cc('0x8'));var attributes=require(_0xb6cc('0x9'));module[_0xb6cc('0xa')]=function(_0xe9fc99,_0xfe6d67){return _0xe9fc99[_0xb6cc('0xb')](_0xb6cc('0xc'),attributes,{'tableName':_0xb6cc('0xd'),'paranoid':!![],'indexes':[{'name':'phone','fields':[_0xb6cc('0xe')]},{'name':'fti_cm_contacts','fields':[_0xb6cc('0xf'),'lastName',_0xb6cc('0xe'),_0xb6cc('0x10'),'fax',_0xb6cc('0x11')],'type':_0xb6cc('0x12')}],'timestamps':!![],'charset':'utf8mb4','collate':_0xb6cc('0x13'),'hooks':{'afterCreate':function(_0x38a8aa,_0x11e837,_0x2e8534){var _0x17d28e=_0xe9fc99[_0xb6cc('0x14')];var _0x3c60ec=_0x38a8aa[_0xb6cc('0x15')]({'plain':!![]});function _0x26c328(){return function(_0x26449a){logger[_0xb6cc('0x16')](_0xb6cc('0x17'),_0xb6cc('0x18'),util[_0xb6cc('0x19')](_0x26449a,{'showHidden':![],'depth':null}));};}function _0x2b66a3(_0x3dc711,_0x578be8){var _0x475244=_0x578be8['scheduledat']?_0x578be8[_0xb6cc('0x1a')]:moment()[_0xb6cc('0x1b')]('YYYY-MM-DD\x20HH:mm:ss');return new BPromise(function(_0x336e01,_0x39aec3){if(_[_0xb6cc('0x1c')](_0x578be8[_0xb6cc('0x1d')])){_0x336e01({'ret':_0x475244});}else{_0x17d28e['VoiceQueue'][_0xb6cc('0x1e')]({'where':{'id':_0x3dc711['id']}})[_0xb6cc('0x1f')](function(_0x208517){if(!_[_0xb6cc('0x1c')](_0x208517)){var _0x55a388=_0x208517[_0xb6cc('0x1d')];if(!_['isNil'](_0x55a388)){var _0x38018d=shared[_0xb6cc('0x20')];var _0x48fb25=_0x38018d[_0x55a388];var _0x1b2698=_0x38018d[_0x578be8['dialTimezone']];if(!_['isNil'](_0x48fb25)&&!_['isNil'](_0x1b2698)){var _0x50c4d1=_0x48fb25[_0xb6cc('0x21')]-_0x1b2698['utcOffset'];_0x475244=_0x578be8['scheduledat']?_0x578be8[_0xb6cc('0x1a')]:moment();var _0x2509dc=moment(_0x475244)[_0xb6cc('0x22')](_0x50c4d1,_0xb6cc('0x23'));_0x336e01({'ret':_0x2509dc[_0xb6cc('0x1b')](_0xb6cc('0x24'))});}else _0x336e01({'ret':_0x475244});}else _0x336e01({'ret':_0x475244});}else{_0x336e01({'ret':_0x475244});}});}});return 0xa;}var _0x3f8fc7=function(_0x48b349){return new BPromise(function(_0x16e68f,_0x2d7e14){_0x2b66a3(_0x48b349,_0x3c60ec)[_0xb6cc('0x1f')](function(_0x2fb04b){_0x3c60ec[_0xb6cc('0x1a')]=_0x2fb04b[_0xb6cc('0x25')];_0x17d28e['CmHopper'][_0xb6cc('0x1e')]({'where':{'phone':_0x3c60ec['phone'],'VoiceQueueId':_0x48b349['id']}})['then'](function(_0x3c2eca){if(!_['isNil'](_0x3c2eca)){throw new Error(_0xb6cc('0x26')+_0x3c60ec[_0xb6cc('0xe')]+_0xb6cc('0x27')+_0x48b349['id']);}return _0x17d28e[_0xb6cc('0x28')][_0xb6cc('0x29')]({'phone':_0x3c60ec[_0xb6cc('0xe')],'ContactId':_0x3c60ec['id'],'ListId':_0x3c60ec[_0xb6cc('0x2a')],'priority':_0x3c60ec[_0xb6cc('0x2b')]?_0x3c60ec['priority']:0x2,'scheduledat':_0x3c60ec[_0xb6cc('0x1a')]?_0x3c60ec[_0xb6cc('0x1a')]:moment()['format'](_0xb6cc('0x24')),'callback':_0x3c60ec[_0xb6cc('0x2c')]?!![]:![],'callbackuniqueid':_0x3c60ec[_0xb6cc('0x2c')]?_0x3c60ec[_0xb6cc('0x2c')]:undefined,'callbackat':_0x3c60ec[_0xb6cc('0x2c')]?moment()[_0xb6cc('0x1b')](_0xb6cc('0x24')):undefined,'VoiceQueueId':_0x48b349['id']});})[_0xb6cc('0x2d')](function(_0x47b8bf){_0x2d7e14(_0x47b8bf);});});});};var _0x37ba5e=function(_0x4a6a3b){return new BPromise(function(_0x5b291f,_0x3e77ca){_0x2b66a3(_0x4a6a3b,_0x3c60ec)[_0xb6cc('0x1f')](function(_0x3f5139){_0x3c60ec['scheduledat']=_0x3f5139[_0xb6cc('0x25')];_0x17d28e[_0xb6cc('0x28')]['findOne']({'where':{'phone':_0x3c60ec['phone'],'VoiceQueueId':_0x4a6a3b['id']}})[_0xb6cc('0x1f')](function(_0x4c3eff){if(!_[_0xb6cc('0x1c')](_0x4c3eff)){throw new Error(_0xb6cc('0x26')+_0x3c60ec[_0xb6cc('0xe')]+_0xb6cc('0x2e')+_0x4a6a3b['id']);}return _0x17d28e[_0xb6cc('0x2f')]['findOne']({'where':{'calleridnum':_0x3c60ec[_0xb6cc('0xe')],'VoiceQueueId':_0x4a6a3b['id']}});})[_0xb6cc('0x1f')](function(_0x33b5cf){if(!_[_0xb6cc('0x1c')](_0x33b5cf)){throw new Error('cmContact,\x20afterCreate,\x20'+_0x3c60ec[_0xb6cc('0xe')]+_0xb6cc('0x30')+_0x4a6a3b['id']);}return _0x17d28e[_0xb6cc('0x28')][_0xb6cc('0x29')]({'phone':_0x3c60ec['phone'],'ContactId':_0x3c60ec['id'],'ListId':_0x3c60ec[_0xb6cc('0x2a')],'priority':_0x3c60ec[_0xb6cc('0x2b')]?_0x3c60ec[_0xb6cc('0x2b')]:0x2,'scheduledat':_0x3c60ec[_0xb6cc('0x1a')]?_0x3c60ec['scheduledat']:moment()[_0xb6cc('0x1b')](_0xb6cc('0x24')),'callback':_0x3c60ec['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x3c60ec[_0xb6cc('0x2c')]?_0x3c60ec[_0xb6cc('0x2c')]:undefined,'callbackat':_0x3c60ec[_0xb6cc('0x2c')]?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined,'VoiceQueueId':_0x4a6a3b['id']});})[_0xb6cc('0x2d')](function(_0x3d6071){_0x3e77ca(_0x3d6071);});});});};function _0x30bb55(){return function(_0x585560){logger[_0xb6cc('0x16')]('cmContact','afterCreate',util[_0xb6cc('0x19')](_0x585560,{'showHidden':![],'depth':null}));};}function _0x1df249(_0x11df4e,_0x23ad28){var _0x4ec3a7=_0x23ad28[_0xb6cc('0x1a')]?_0x23ad28['scheduledat']:moment()['format'](_0xb6cc('0x24'));return new BPromise(function(_0x373013,_0x4f97e1){if(_[_0xb6cc('0x1c')](_0x23ad28['dialTimezone'])){_0x373013({'ret':_0x4ec3a7});}else{_0x17d28e['Campaign']['findOne']({'where':{'id':_0x11df4e['id']}})['then'](function(_0x1bbef9){if(!_['isNil'](_0x1bbef9)){var _0x25c9de=_0x1bbef9[_0xb6cc('0x1d')];if(!_['isNil'](_0x25c9de)){var _0x558cf9=shared[_0xb6cc('0x20')];var _0x332f32=_0x558cf9[_0x25c9de];var _0x1ece15=_0x558cf9[_0x23ad28[_0xb6cc('0x1d')]];if(!_[_0xb6cc('0x1c')](_0x332f32)&&!_[_0xb6cc('0x1c')](_0x1ece15)){var _0x3690ea=_0x332f32[_0xb6cc('0x21')]-_0x1ece15[_0xb6cc('0x21')];_0x4ec3a7=_0x23ad28['scheduledat']?_0x23ad28[_0xb6cc('0x1a')]:moment();var _0x28af47=moment(_0x4ec3a7)[_0xb6cc('0x22')](_0x3690ea,_0xb6cc('0x23'));_0x373013({'ret':_0x28af47[_0xb6cc('0x1b')](_0xb6cc('0x24'))});}else _0x373013({'ret':_0x4ec3a7});}else _0x373013({'ret':_0x4ec3a7});}else{_0x373013({'ret':_0x4ec3a7});}});}});return 0xa;}var _0x3a3cac=function(_0x31d8ca){return new BPromise(function(_0x2b6601,_0x28746c){_0x1df249(_0x31d8ca,_0x3c60ec)[_0xb6cc('0x1f')](function(_0x228584){_0x3c60ec[_0xb6cc('0x1a')]=_0x228584[_0xb6cc('0x25')];_0x17d28e[_0xb6cc('0x28')][_0xb6cc('0x1e')]({'where':{'phone':_0x3c60ec[_0xb6cc('0xe')],'CampaignId':_0x31d8ca['id']}})['then'](function(_0x2afb07){if(!_[_0xb6cc('0x1c')](_0x2afb07)){throw new Error('cmContact,\x20afterCreate\x20'+_0x3c60ec['phone']+_0xb6cc('0x31')+_0x31d8ca['id']);}return _0x17d28e[_0xb6cc('0x28')][_0xb6cc('0x29')]({'phone':_0x3c60ec[_0xb6cc('0xe')],'ContactId':_0x3c60ec['id'],'ListId':_0x3c60ec[_0xb6cc('0x2a')],'priority':_0x3c60ec['priority']?_0x3c60ec[_0xb6cc('0x2b')]:0x2,'scheduledat':_0x3c60ec[_0xb6cc('0x1a')]?_0x3c60ec[_0xb6cc('0x1a')]:moment()[_0xb6cc('0x1b')](_0xb6cc('0x24')),'callback':_0x3c60ec[_0xb6cc('0x2c')]?!![]:![],'callbackuniqueid':_0x3c60ec[_0xb6cc('0x2c')]?_0x3c60ec['callbackUniqueid']:undefined,'callbackat':_0x3c60ec[_0xb6cc('0x2c')]?moment()[_0xb6cc('0x1b')](_0xb6cc('0x24')):undefined,'CampaignId':_0x31d8ca['id']});})[_0xb6cc('0x2d')](function(_0x1c571f){_0x28746c(_0x1c571f);});});});};var _0x17daba=function(_0x2424e4){return new BPromise(function(_0x47b96e,_0x784b10){_0x1df249(_0x2424e4,_0x3c60ec)[_0xb6cc('0x1f')](function(_0x3f8b36){_0x3c60ec[_0xb6cc('0x1a')]=_0x3f8b36['ret'];_0x17d28e[_0xb6cc('0x28')]['findOne']({'where':{'phone':_0x3c60ec[_0xb6cc('0xe')],'CampaignId':_0x2424e4['id']}})[_0xb6cc('0x1f')](function(_0x3f7cea){if(!_['isNil'](_0x3f7cea)){throw new Error(_0xb6cc('0x26')+_0x3c60ec[_0xb6cc('0xe')]+_0xb6cc('0x32')+_0x2424e4['id']);}return _0x17d28e['CmHopperFinal'][_0xb6cc('0x1e')]({'where':{'calleridnum':_0x3c60ec['phone'],'CampaignId':_0x2424e4['id']}});})[_0xb6cc('0x1f')](function(_0x53119c){if(!_[_0xb6cc('0x1c')](_0x53119c)){throw new Error(_0xb6cc('0x33')+_0x3c60ec['phone']+_0xb6cc('0x34')+_0x2424e4['id']);}return _0x17d28e[_0xb6cc('0x28')][_0xb6cc('0x29')]({'phone':_0x3c60ec['phone'],'ContactId':_0x3c60ec['id'],'ListId':_0x3c60ec[_0xb6cc('0x2a')],'priority':_0x3c60ec['priority']?_0x3c60ec[_0xb6cc('0x2b')]:0x2,'scheduledat':_0x3c60ec[_0xb6cc('0x1a')]?_0x3c60ec[_0xb6cc('0x1a')]:moment()[_0xb6cc('0x1b')](_0xb6cc('0x24')),'callback':_0x3c60ec[_0xb6cc('0x2c')]?!![]:![],'callbackuniqueid':_0x3c60ec[_0xb6cc('0x2c')]?_0x3c60ec[_0xb6cc('0x2c')]:undefined,'callbackat':_0x3c60ec[_0xb6cc('0x2c')]?moment()[_0xb6cc('0x1b')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'CampaignId':_0x2424e4['id']});})[_0xb6cc('0x2d')](function(_0x3d8f6f){_0x784b10(_0x3d8f6f);});});});};if(_0x3c60ec[_0xb6cc('0x2a')]){_0x17d28e[_0xb6cc('0x35')][_0xb6cc('0x36')]({'where':{'type':_0xb6cc('0x37')},'attributes':['id',_0xb6cc('0x38'),'dialTimezone'],'include':[{'model':_0x17d28e[_0xb6cc('0x39')],'as':_0xb6cc('0x3a'),'where':{'id':_0x3c60ec[_0xb6cc('0x2a')]}}]})[_0xb6cc('0x1f')](function(_0x238fee){if(_0x238fee){var _0x36b4c0=[];for(var _0x20f629=0x0,_0x41cdc5;_0x20f629<_0x238fee['length'];_0x20f629+=0x1){_0x41cdc5=_0x238fee[_0x20f629]['get']({'plain':!![]});switch(_0x41cdc5[_0xb6cc('0x38')]){case _0xb6cc('0x3b'):_0x37ba5e(_0x41cdc5)['catch'](_0x26c328());break;case _0xb6cc('0x3c'):_0x3f8fc7(_0x41cdc5)[_0xb6cc('0x2d')](_0x26c328());break;default:_0x1df249(_0x41cdc5,_0x3c60ec)['then'](function(_0x1ddcc8){_0x3c60ec[_0xb6cc('0x1a')]=_0x1ddcc8[_0xb6cc('0x25')];_0x17d28e[_0xb6cc('0x28')][_0xb6cc('0x29')]({'phone':_0x3c60ec[_0xb6cc('0xe')],'ContactId':_0x3c60ec['id'],'ListId':_0x3c60ec[_0xb6cc('0x2a')],'scheduledat':_0x3c60ec['scheduledat']?_0x3c60ec[_0xb6cc('0x1a')]:moment()[_0xb6cc('0x1b')](_0xb6cc('0x24')),'priority':_0x3c60ec[_0xb6cc('0x2b')]?_0x3c60ec[_0xb6cc('0x2b')]:0x2,'callback':_0x3c60ec[_0xb6cc('0x2c')]?!![]:![],'callbackuniqueid':_0x3c60ec[_0xb6cc('0x2c')]?_0x3c60ec[_0xb6cc('0x2c')]:undefined,'callbackat':_0x3c60ec[_0xb6cc('0x2c')]?moment()[_0xb6cc('0x1b')](_0xb6cc('0x24')):undefined,'VoiceQueueId':_0x41cdc5['id']})[_0xb6cc('0x2d')](_0x26c328());});}}}})[_0xb6cc('0x1f')](function(){return _0x17d28e[_0xb6cc('0x35')]['findAll']({'where':{'type':_0xb6cc('0x37')},'attributes':['id'],'include':[{'model':_0x17d28e['CmList'],'as':_0xb6cc('0x3d'),'where':{'id':_0x3c60ec[_0xb6cc('0x2a')]}}]})[_0xb6cc('0x1f')](function(_0xb586ed){if(_0xb586ed){var _0x450e30=[];for(var _0x45928d=0x0,_0x63c9a9;_0x45928d<_0xb586ed[_0xb6cc('0x3e')];_0x45928d+=0x1){_0x63c9a9=_0xb586ed[_0x45928d][_0xb6cc('0x15')]({'plain':!![]});_0x17d28e['CmHopperBlack'][_0xb6cc('0x29')]({'phone':_0x3c60ec[_0xb6cc('0xe')],'ContactId':_0x3c60ec['id'],'ListId':_0x3c60ec[_0xb6cc('0x2a')],'VoiceQueueId':_0x63c9a9['id']})[_0xb6cc('0x2d')](function(_0x1501c5){logger[_0xb6cc('0x16')]('cmContact,\x20%s,\x20%s',_0xb6cc('0x18'),_0x1501c5[_0xb6cc('0x3f')]);});}}});})[_0xb6cc('0x1f')](function(){return _0x17d28e['Campaign'][_0xb6cc('0x36')]({'attributes':['id',_0xb6cc('0x38'),_0xb6cc('0x1d')],'include':[{'model':_0x17d28e[_0xb6cc('0x39')],'as':_0xb6cc('0x3a'),'where':{'id':_0x3c60ec[_0xb6cc('0x2a')]}}]})[_0xb6cc('0x1f')](function(_0x16a5ca){if(_0x16a5ca){var _0x3eb89d=[];for(var _0xbbe28e=0x0,_0x3ea690;_0xbbe28e<_0x16a5ca['length'];_0xbbe28e+=0x1){_0x3ea690=_0x16a5ca[_0xbbe28e][_0xb6cc('0x15')]({'plain':!![]});switch(_0x3ea690[_0xb6cc('0x38')]){case'always':_0x17daba(_0x3ea690)['catch'](_0x30bb55());break;case'onlyIfOpen':_0x3a3cac(_0x3ea690)[_0xb6cc('0x2d')](_0x30bb55());break;default:_0x17d28e[_0xb6cc('0x28')][_0xb6cc('0x29')]({'phone':_0x3c60ec[_0xb6cc('0xe')],'ContactId':_0x3c60ec['id'],'ListId':_0x3c60ec[_0xb6cc('0x2a')],'scheduledat':_0x3c60ec[_0xb6cc('0x1a')]?_0x3c60ec[_0xb6cc('0x1a')]:moment()[_0xb6cc('0x1b')](_0xb6cc('0x24')),'priority':_0x3c60ec[_0xb6cc('0x2b')]?_0x3c60ec[_0xb6cc('0x2b')]:0x2,'callback':_0x3c60ec[_0xb6cc('0x2c')]?!![]:![],'callbackuniqueid':_0x3c60ec['callbackUniqueid']?_0x3c60ec[_0xb6cc('0x2c')]:undefined,'callbackat':_0x3c60ec[_0xb6cc('0x2c')]?moment()[_0xb6cc('0x1b')](_0xb6cc('0x24')):undefined,'CampaignId':_0x3ea690['id']})[_0xb6cc('0x2d')](_0x30bb55());}}}});})[_0xb6cc('0x1f')](function(){return _0x17d28e[_0xb6cc('0x40')][_0xb6cc('0x36')]({'attributes':['id'],'include':[{'model':_0x17d28e[_0xb6cc('0x39')],'as':_0xb6cc('0x3d'),'where':{'id':_0x3c60ec[_0xb6cc('0x2a')]}}]})['then'](function(_0x2d7567){if(_0x2d7567){var _0xfc4771=[];for(var _0x4ea750=0x0,_0x5978e9;_0x4ea750<_0x2d7567[_0xb6cc('0x3e')];_0x4ea750+=0x1){_0x5978e9=_0x2d7567[_0x4ea750]['get']({'plain':!![]});_0x17d28e[_0xb6cc('0x41')][_0xb6cc('0x29')]({'phone':_0x3c60ec['phone'],'ContactId':_0x3c60ec['id'],'ListId':_0x3c60ec['ListId'],'CampaignId':_0x5978e9['id']})['catch'](function(_0x53e23e){logger[_0xb6cc('0x16')](_0xb6cc('0x42'),'afterCreate',_0x53e23e['message']);});}}});})[_0xb6cc('0x1f')](function(){_0x2e8534();})[_0xb6cc('0x2d')](function(_0x198bea){logger[_0xb6cc('0x16')]('cmContact,\x20%s,\x20%s',_0xb6cc('0x18'),_0x198bea[_0xb6cc('0x3f')]);_0x2e8534(_0x198bea);});}else{_0x2e8534(new Error(_0xb6cc('0x43')));}},'afterDestroy':function(_0x51ad68,_0x3d05c4,_0x3881b6){var _0x1336c9=_0xe9fc99['models'];var _0x502cf6=_0x51ad68[_0xb6cc('0x15')]({'plain':!![]});return _0x1336c9[_0xb6cc('0x28')][_0xb6cc('0x36')]({'raw':!![],'where':{'ListId':_0x502cf6[_0xb6cc('0x2a')],'ContactId':_0x502cf6['id']}})['then'](function(_0x4e63a0){if(!_[_0xb6cc('0x44')](_0x4e63a0)){var _0x3d8afd=[];for(var _0x57e739=0x0;_0x57e739<_0x4e63a0['length'];_0x57e739+=0x1){var _0x4333cc=_0x1336c9[_0xb6cc('0x28')]['destroy']({'where':{'ListId':_0x4e63a0[_0x57e739][_0xb6cc('0x2a')],'ContactId':_0x4e63a0[_0x57e739][_0xb6cc('0x45')],'VoiceQueueId':_0x4e63a0[_0x57e739][_0xb6cc('0x46')],'CampaignId':_0x4e63a0[_0x57e739][_0xb6cc('0x47')]}});_0x3d8afd[_0xb6cc('0x48')](_0x4333cc);}return BPromise['all'](_0x3d8afd);}})[_0xb6cc('0x1f')](function(_0x484012){logger[_0xb6cc('0x49')](_0xb6cc('0x4a'),util[_0xb6cc('0x19')](_0x484012,{'showHidden':![],'depth':null}));_0x3881b6();})[_0xb6cc('0x2d')](function(_0x2e8121){logger[_0xb6cc('0x16')](_0xb6cc('0x4b'),util[_0xb6cc('0x19')](_0x2e8121,{'showHidden':![],'depth':null}));_0x3881b6(_0x2e8121);});}}});}; \ No newline at end of file +var _0xd7a6=['lastName','email','FULLTEXT','utf8mb4','utf8mb4_unicode_ci','models','error','afterCreate','inspect','scheduledat','format','dialTimezone','VoiceQueue','isNil','utcOffset','add','minutes','then','ret','CmHopper','cmContact,\x20afterCreate\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','create','ListId','priority','callbackUniqueid','YYYY-MM-DD\x20HH:mm:ss','catch','CmHopperFinal','cmContact,\x20afterCreate,\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20VoiceQueue\x20','Campaign','findOne','timezones','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20Campaign\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20Campaign\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20Campaign\x20','findAll','outbound','dialCheckDuplicateType','CmList','Lists','length','get','always','onlyIfOpen','CmHopperBlack','message','BlackLists','cmContact,\x20%s,\x20%s','List\x20not\x20found','isEmpty','destroy','ContactId','CampaignId','all','[CmContact][afterDestroy][Succesfull]','[CmContact][afterDestroy][Error]','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment/shared','./cmContact.attributes','exports','define','CmContact','cm_contacts','phone','fti_cm_contacts','firstName'];(function(_0x3c3d77,_0x35896c){var _0x323fe1=function(_0x34ef7b){while(--_0x34ef7b){_0x3c3d77['push'](_0x3c3d77['shift']());}};_0x323fe1(++_0x35896c);}(_0xd7a6,0x1b1));var _0x6d7a=function(_0x343ab5,_0x246140){_0x343ab5=_0x343ab5-0x0;var _0x21d0e6=_0xd7a6[_0x343ab5];return _0x21d0e6;};'use strict';var _=require(_0x6d7a('0x0'));var util=require('util');var logger=require(_0x6d7a('0x1'))(_0x6d7a('0x2'));var moment=require(_0x6d7a('0x3'));var BPromise=require(_0x6d7a('0x4'));var rp=require(_0x6d7a('0x5'));var fs=require('fs');var path=require(_0x6d7a('0x6'));var rimraf=require(_0x6d7a('0x7'));var config=require('../../config/environment');var shared=require(_0x6d7a('0x8'));var attributes=require(_0x6d7a('0x9'));module[_0x6d7a('0xa')]=function(_0x47663c,_0x87a1db){return _0x47663c[_0x6d7a('0xb')](_0x6d7a('0xc'),attributes,{'tableName':_0x6d7a('0xd'),'paranoid':!![],'indexes':[{'name':_0x6d7a('0xe'),'fields':[_0x6d7a('0xe')]},{'name':_0x6d7a('0xf'),'fields':[_0x6d7a('0x10'),_0x6d7a('0x11'),_0x6d7a('0xe'),'mobile','fax',_0x6d7a('0x12')],'type':_0x6d7a('0x13')}],'timestamps':!![],'charset':_0x6d7a('0x14'),'collate':_0x6d7a('0x15'),'hooks':{'afterCreate':function(_0x3d432d,_0x1b7653,_0x99e5cb){var _0x10d074=_0x47663c[_0x6d7a('0x16')];var _0x45d5b5=_0x3d432d['get']({'plain':!![]});function _0x50ee1e(){return function(_0x5ff070){logger[_0x6d7a('0x17')]('cmContact',_0x6d7a('0x18'),util[_0x6d7a('0x19')](_0x5ff070,{'showHidden':![],'depth':null}));};}function _0x40445a(_0x404fc3,_0x57d028){var _0x4702c8=_0x57d028[_0x6d7a('0x1a')]?_0x57d028[_0x6d7a('0x1a')]:moment()[_0x6d7a('0x1b')]('YYYY-MM-DD\x20HH:mm:ss');return new BPromise(function(_0x29345d,_0x2d60c6){if(_['isNil'](_0x57d028[_0x6d7a('0x1c')])){_0x29345d({'ret':_0x4702c8});}else{_0x10d074[_0x6d7a('0x1d')]['findOne']({'where':{'id':_0x404fc3['id']}})['then'](function(_0x5549ff){if(!_[_0x6d7a('0x1e')](_0x5549ff)){var _0x380002=_0x5549ff[_0x6d7a('0x1c')];if(!_[_0x6d7a('0x1e')](_0x380002)){var _0xff68a6=shared['timezones'];var _0x129f42=_0xff68a6[_0x380002];var _0x4365a7=_0xff68a6[_0x57d028[_0x6d7a('0x1c')]];if(!_[_0x6d7a('0x1e')](_0x129f42)&&!_[_0x6d7a('0x1e')](_0x4365a7)){var _0x294f7a=_0x129f42['utcOffset']-_0x4365a7[_0x6d7a('0x1f')];_0x4702c8=_0x57d028[_0x6d7a('0x1a')]?_0x57d028['scheduledat']:moment();var _0x115996=moment(_0x4702c8)[_0x6d7a('0x20')](_0x294f7a,_0x6d7a('0x21'));_0x29345d({'ret':_0x115996[_0x6d7a('0x1b')]('YYYY-MM-DD\x20HH:mm:ss')});}else _0x29345d({'ret':_0x4702c8});}else _0x29345d({'ret':_0x4702c8});}else{_0x29345d({'ret':_0x4702c8});}});}});return 0xa;}var _0xf8f269=function(_0x3b4d8d){return new BPromise(function(_0x2b4737,_0x292a3e){_0x40445a(_0x3b4d8d,_0x45d5b5)[_0x6d7a('0x22')](function(_0x5341f5){_0x45d5b5[_0x6d7a('0x1a')]=_0x5341f5[_0x6d7a('0x23')];_0x10d074[_0x6d7a('0x24')]['findOne']({'where':{'phone':_0x45d5b5['phone'],'VoiceQueueId':_0x3b4d8d['id']}})[_0x6d7a('0x22')](function(_0x5d3144){if(!_[_0x6d7a('0x1e')](_0x5d3144)){throw new Error(_0x6d7a('0x25')+_0x45d5b5[_0x6d7a('0xe')]+_0x6d7a('0x26')+_0x3b4d8d['id']);}return _0x10d074[_0x6d7a('0x24')][_0x6d7a('0x27')]({'phone':_0x45d5b5[_0x6d7a('0xe')],'ContactId':_0x45d5b5['id'],'ListId':_0x45d5b5[_0x6d7a('0x28')],'priority':_0x45d5b5[_0x6d7a('0x29')]?_0x45d5b5[_0x6d7a('0x29')]:0x2,'scheduledat':_0x45d5b5[_0x6d7a('0x1a')]?_0x45d5b5[_0x6d7a('0x1a')]:moment()[_0x6d7a('0x1b')]('YYYY-MM-DD\x20HH:mm:ss'),'callback':_0x45d5b5['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x45d5b5[_0x6d7a('0x2a')]?_0x45d5b5[_0x6d7a('0x2a')]:undefined,'callbackat':_0x45d5b5['callbackUniqueid']?moment()[_0x6d7a('0x1b')](_0x6d7a('0x2b')):undefined,'VoiceQueueId':_0x3b4d8d['id']});})[_0x6d7a('0x2c')](function(_0x5857f2){_0x292a3e(_0x5857f2);});});});};var _0x4abe7a=function(_0x5cc373){return new BPromise(function(_0x340d5a,_0x4e441d){_0x40445a(_0x5cc373,_0x45d5b5)[_0x6d7a('0x22')](function(_0x311fdf){_0x45d5b5[_0x6d7a('0x1a')]=_0x311fdf[_0x6d7a('0x23')];_0x10d074[_0x6d7a('0x24')]['findOne']({'where':{'phone':_0x45d5b5[_0x6d7a('0xe')],'VoiceQueueId':_0x5cc373['id']}})[_0x6d7a('0x22')](function(_0x207e33){if(!_[_0x6d7a('0x1e')](_0x207e33)){throw new Error(_0x6d7a('0x25')+_0x45d5b5[_0x6d7a('0xe')]+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20VoiceQueue\x20'+_0x5cc373['id']);}return _0x10d074[_0x6d7a('0x2d')]['findOne']({'where':{'calleridnum':_0x45d5b5[_0x6d7a('0xe')],'VoiceQueueId':_0x5cc373['id']}});})[_0x6d7a('0x22')](function(_0x23a348){if(!_[_0x6d7a('0x1e')](_0x23a348)){throw new Error(_0x6d7a('0x2e')+_0x45d5b5['phone']+_0x6d7a('0x2f')+_0x5cc373['id']);}return _0x10d074[_0x6d7a('0x24')][_0x6d7a('0x27')]({'phone':_0x45d5b5[_0x6d7a('0xe')],'ContactId':_0x45d5b5['id'],'ListId':_0x45d5b5[_0x6d7a('0x28')],'priority':_0x45d5b5[_0x6d7a('0x29')]?_0x45d5b5[_0x6d7a('0x29')]:0x2,'scheduledat':_0x45d5b5['scheduledat']?_0x45d5b5[_0x6d7a('0x1a')]:moment()[_0x6d7a('0x1b')](_0x6d7a('0x2b')),'callback':_0x45d5b5[_0x6d7a('0x2a')]?!![]:![],'callbackuniqueid':_0x45d5b5[_0x6d7a('0x2a')]?_0x45d5b5['callbackUniqueid']:undefined,'callbackat':_0x45d5b5[_0x6d7a('0x2a')]?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined,'VoiceQueueId':_0x5cc373['id']});})[_0x6d7a('0x2c')](function(_0xb1f58f){_0x4e441d(_0xb1f58f);});});});};function _0x425fab(){return function(_0x38ae4e){logger[_0x6d7a('0x17')]('cmContact',_0x6d7a('0x18'),util[_0x6d7a('0x19')](_0x38ae4e,{'showHidden':![],'depth':null}));};}function _0x3efdd2(_0x3cc3b5,_0x46d852){var _0x3860cf=_0x46d852[_0x6d7a('0x1a')]?_0x46d852['scheduledat']:moment()['format']('YYYY-MM-DD\x20HH:mm:ss');return new BPromise(function(_0x421ec4,_0x40b22e){if(_[_0x6d7a('0x1e')](_0x46d852[_0x6d7a('0x1c')])){_0x421ec4({'ret':_0x3860cf});}else{_0x10d074[_0x6d7a('0x30')][_0x6d7a('0x31')]({'where':{'id':_0x3cc3b5['id']}})[_0x6d7a('0x22')](function(_0x9eed96){if(!_[_0x6d7a('0x1e')](_0x9eed96)){var _0x5bbd2e=_0x9eed96[_0x6d7a('0x1c')];if(!_['isNil'](_0x5bbd2e)){var _0x473616=shared[_0x6d7a('0x32')];var _0x3f5f00=_0x473616[_0x5bbd2e];var _0x3fdc72=_0x473616[_0x46d852['dialTimezone']];if(!_[_0x6d7a('0x1e')](_0x3f5f00)&&!_['isNil'](_0x3fdc72)){var _0x256bde=_0x3f5f00[_0x6d7a('0x1f')]-_0x3fdc72['utcOffset'];_0x3860cf=_0x46d852['scheduledat']?_0x46d852['scheduledat']:moment();var _0x171380=moment(_0x3860cf)[_0x6d7a('0x20')](_0x256bde,_0x6d7a('0x21'));_0x421ec4({'ret':_0x171380[_0x6d7a('0x1b')](_0x6d7a('0x2b'))});}else _0x421ec4({'ret':_0x3860cf});}else _0x421ec4({'ret':_0x3860cf});}else{_0x421ec4({'ret':_0x3860cf});}});}});return 0xa;}var _0x5c0be2=function(_0x20117e){return new BPromise(function(_0x1b14bb,_0x20e309){_0x3efdd2(_0x20117e,_0x45d5b5)[_0x6d7a('0x22')](function(_0x532b03){_0x45d5b5[_0x6d7a('0x1a')]=_0x532b03['ret'];_0x10d074['CmHopper'][_0x6d7a('0x31')]({'where':{'phone':_0x45d5b5[_0x6d7a('0xe')],'CampaignId':_0x20117e['id']}})['then'](function(_0x5735d8){if(!_[_0x6d7a('0x1e')](_0x5735d8)){throw new Error('cmContact,\x20afterCreate\x20'+_0x45d5b5[_0x6d7a('0xe')]+_0x6d7a('0x33')+_0x20117e['id']);}return _0x10d074[_0x6d7a('0x24')]['create']({'phone':_0x45d5b5[_0x6d7a('0xe')],'ContactId':_0x45d5b5['id'],'ListId':_0x45d5b5[_0x6d7a('0x28')],'priority':_0x45d5b5[_0x6d7a('0x29')]?_0x45d5b5[_0x6d7a('0x29')]:0x2,'scheduledat':_0x45d5b5[_0x6d7a('0x1a')]?_0x45d5b5[_0x6d7a('0x1a')]:moment()[_0x6d7a('0x1b')](_0x6d7a('0x2b')),'callback':_0x45d5b5[_0x6d7a('0x2a')]?!![]:![],'callbackuniqueid':_0x45d5b5[_0x6d7a('0x2a')]?_0x45d5b5[_0x6d7a('0x2a')]:undefined,'callbackat':_0x45d5b5['callbackUniqueid']?moment()[_0x6d7a('0x1b')](_0x6d7a('0x2b')):undefined,'CampaignId':_0x20117e['id']});})[_0x6d7a('0x2c')](function(_0x2a5462){_0x20e309(_0x2a5462);});});});};var _0x9fbe25=function(_0x1bf02a){return new BPromise(function(_0x2b8adb,_0x26b40f){_0x3efdd2(_0x1bf02a,_0x45d5b5)[_0x6d7a('0x22')](function(_0x197741){_0x45d5b5[_0x6d7a('0x1a')]=_0x197741[_0x6d7a('0x23')];_0x10d074[_0x6d7a('0x24')][_0x6d7a('0x31')]({'where':{'phone':_0x45d5b5[_0x6d7a('0xe')],'CampaignId':_0x1bf02a['id']}})['then'](function(_0x2db7ee){if(!_[_0x6d7a('0x1e')](_0x2db7ee)){throw new Error(_0x6d7a('0x25')+_0x45d5b5[_0x6d7a('0xe')]+_0x6d7a('0x34')+_0x1bf02a['id']);}return _0x10d074[_0x6d7a('0x2d')][_0x6d7a('0x31')]({'where':{'calleridnum':_0x45d5b5['phone'],'CampaignId':_0x1bf02a['id']}});})[_0x6d7a('0x22')](function(_0x133cd5){if(!_[_0x6d7a('0x1e')](_0x133cd5)){throw new Error('cmContact,\x20afterCreate,\x20'+_0x45d5b5[_0x6d7a('0xe')]+_0x6d7a('0x35')+_0x1bf02a['id']);}return _0x10d074[_0x6d7a('0x24')][_0x6d7a('0x27')]({'phone':_0x45d5b5[_0x6d7a('0xe')],'ContactId':_0x45d5b5['id'],'ListId':_0x45d5b5[_0x6d7a('0x28')],'priority':_0x45d5b5[_0x6d7a('0x29')]?_0x45d5b5[_0x6d7a('0x29')]:0x2,'scheduledat':_0x45d5b5[_0x6d7a('0x1a')]?_0x45d5b5[_0x6d7a('0x1a')]:moment()[_0x6d7a('0x1b')](_0x6d7a('0x2b')),'callback':_0x45d5b5[_0x6d7a('0x2a')]?!![]:![],'callbackuniqueid':_0x45d5b5[_0x6d7a('0x2a')]?_0x45d5b5[_0x6d7a('0x2a')]:undefined,'callbackat':_0x45d5b5[_0x6d7a('0x2a')]?moment()[_0x6d7a('0x1b')](_0x6d7a('0x2b')):undefined,'CampaignId':_0x1bf02a['id']});})[_0x6d7a('0x2c')](function(_0x46a8c2){_0x26b40f(_0x46a8c2);});});});};if(_0x45d5b5[_0x6d7a('0x28')]){_0x10d074[_0x6d7a('0x1d')][_0x6d7a('0x36')]({'where':{'type':_0x6d7a('0x37')},'attributes':['id',_0x6d7a('0x38'),'dialTimezone'],'include':[{'model':_0x10d074[_0x6d7a('0x39')],'as':_0x6d7a('0x3a'),'where':{'id':_0x45d5b5[_0x6d7a('0x28')]}}]})['then'](function(_0x4b4664){if(_0x4b4664){var _0x1fde38=[];for(var _0x73d701=0x0,_0x39599a;_0x73d701<_0x4b4664[_0x6d7a('0x3b')];_0x73d701+=0x1){_0x39599a=_0x4b4664[_0x73d701][_0x6d7a('0x3c')]({'plain':!![]});switch(_0x39599a[_0x6d7a('0x38')]){case _0x6d7a('0x3d'):_0x4abe7a(_0x39599a)[_0x6d7a('0x2c')](_0x50ee1e());break;case _0x6d7a('0x3e'):_0xf8f269(_0x39599a)[_0x6d7a('0x2c')](_0x50ee1e());break;default:_0x3efdd2(_0x39599a,_0x45d5b5)[_0x6d7a('0x22')](function(_0x4bed5b){_0x45d5b5[_0x6d7a('0x1a')]=_0x4bed5b[_0x6d7a('0x23')];_0x10d074[_0x6d7a('0x24')]['create']({'phone':_0x45d5b5[_0x6d7a('0xe')],'ContactId':_0x45d5b5['id'],'ListId':_0x45d5b5[_0x6d7a('0x28')],'scheduledat':_0x45d5b5[_0x6d7a('0x1a')]?_0x45d5b5[_0x6d7a('0x1a')]:moment()[_0x6d7a('0x1b')]('YYYY-MM-DD\x20HH:mm:ss'),'priority':_0x45d5b5['priority']?_0x45d5b5[_0x6d7a('0x29')]:0x2,'callback':_0x45d5b5['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x45d5b5[_0x6d7a('0x2a')]?_0x45d5b5[_0x6d7a('0x2a')]:undefined,'callbackat':_0x45d5b5[_0x6d7a('0x2a')]?moment()['format'](_0x6d7a('0x2b')):undefined,'VoiceQueueId':_0x39599a['id']})[_0x6d7a('0x2c')](_0x50ee1e());});}}}})[_0x6d7a('0x22')](function(){return _0x10d074[_0x6d7a('0x1d')][_0x6d7a('0x36')]({'where':{'type':_0x6d7a('0x37')},'attributes':['id'],'include':[{'model':_0x10d074['CmList'],'as':'BlackLists','where':{'id':_0x45d5b5[_0x6d7a('0x28')]}}]})['then'](function(_0xf837a8){if(_0xf837a8){var _0x3ab61e=[];for(var _0x5ec8cd=0x0,_0x1a242e;_0x5ec8cd<_0xf837a8[_0x6d7a('0x3b')];_0x5ec8cd+=0x1){_0x1a242e=_0xf837a8[_0x5ec8cd][_0x6d7a('0x3c')]({'plain':!![]});_0x10d074[_0x6d7a('0x3f')][_0x6d7a('0x27')]({'phone':_0x45d5b5[_0x6d7a('0xe')],'ContactId':_0x45d5b5['id'],'ListId':_0x45d5b5['ListId'],'VoiceQueueId':_0x1a242e['id']})[_0x6d7a('0x2c')](function(_0xeb4d2b){logger['error']('cmContact,\x20%s,\x20%s','afterCreate',_0xeb4d2b[_0x6d7a('0x40')]);});}}});})[_0x6d7a('0x22')](function(){return _0x10d074[_0x6d7a('0x30')]['findAll']({'attributes':['id',_0x6d7a('0x38'),_0x6d7a('0x1c')],'include':[{'model':_0x10d074[_0x6d7a('0x39')],'as':_0x6d7a('0x3a'),'where':{'id':_0x45d5b5['ListId']}}]})[_0x6d7a('0x22')](function(_0x5453eb){if(_0x5453eb){var _0x252cad=[];for(var _0x26cea3=0x0,_0x119ae7;_0x26cea3<_0x5453eb['length'];_0x26cea3+=0x1){_0x119ae7=_0x5453eb[_0x26cea3][_0x6d7a('0x3c')]({'plain':!![]});switch(_0x119ae7[_0x6d7a('0x38')]){case _0x6d7a('0x3d'):_0x9fbe25(_0x119ae7)[_0x6d7a('0x2c')](_0x425fab());break;case _0x6d7a('0x3e'):_0x5c0be2(_0x119ae7)[_0x6d7a('0x2c')](_0x425fab());break;default:_0x10d074['CmHopper']['create']({'phone':_0x45d5b5[_0x6d7a('0xe')],'ContactId':_0x45d5b5['id'],'ListId':_0x45d5b5['ListId'],'scheduledat':_0x45d5b5[_0x6d7a('0x1a')]?_0x45d5b5['scheduledat']:moment()[_0x6d7a('0x1b')]('YYYY-MM-DD\x20HH:mm:ss'),'priority':_0x45d5b5[_0x6d7a('0x29')]?_0x45d5b5[_0x6d7a('0x29')]:0x2,'callback':_0x45d5b5['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x45d5b5[_0x6d7a('0x2a')]?_0x45d5b5['callbackUniqueid']:undefined,'callbackat':_0x45d5b5[_0x6d7a('0x2a')]?moment()[_0x6d7a('0x1b')](_0x6d7a('0x2b')):undefined,'CampaignId':_0x119ae7['id']})[_0x6d7a('0x2c')](_0x425fab());}}}});})[_0x6d7a('0x22')](function(){return _0x10d074[_0x6d7a('0x30')][_0x6d7a('0x36')]({'attributes':['id'],'include':[{'model':_0x10d074[_0x6d7a('0x39')],'as':_0x6d7a('0x41'),'where':{'id':_0x45d5b5[_0x6d7a('0x28')]}}]})[_0x6d7a('0x22')](function(_0x7b1c75){if(_0x7b1c75){var _0x4b6c52=[];for(var _0x4f3147=0x0,_0xc30f65;_0x4f3147<_0x7b1c75[_0x6d7a('0x3b')];_0x4f3147+=0x1){_0xc30f65=_0x7b1c75[_0x4f3147]['get']({'plain':!![]});_0x10d074[_0x6d7a('0x3f')][_0x6d7a('0x27')]({'phone':_0x45d5b5['phone'],'ContactId':_0x45d5b5['id'],'ListId':_0x45d5b5[_0x6d7a('0x28')],'CampaignId':_0xc30f65['id']})['catch'](function(_0x57147c){logger[_0x6d7a('0x17')](_0x6d7a('0x42'),'afterCreate',_0x57147c['message']);});}}});})['then'](function(){_0x99e5cb();})['catch'](function(_0x360a5c){logger['error']('cmContact,\x20%s,\x20%s',_0x6d7a('0x18'),_0x360a5c['message']);_0x99e5cb(_0x360a5c);});}else{_0x99e5cb(new Error(_0x6d7a('0x43')));}},'afterDestroy':function(_0x21accb,_0x2d3c53,_0xeb867c){var _0x4f5308=_0x47663c['models'];var _0x564c17=_0x21accb[_0x6d7a('0x3c')]({'plain':!![]});return _0x4f5308[_0x6d7a('0x24')][_0x6d7a('0x36')]({'raw':!![],'where':{'ListId':_0x564c17[_0x6d7a('0x28')],'ContactId':_0x564c17['id']}})[_0x6d7a('0x22')](function(_0x3e2582){if(!_[_0x6d7a('0x44')](_0x3e2582)){var _0x1079bd=[];for(var _0x236289=0x0;_0x236289<_0x3e2582[_0x6d7a('0x3b')];_0x236289+=0x1){var _0x18f721=_0x4f5308[_0x6d7a('0x24')][_0x6d7a('0x45')]({'where':{'ListId':_0x3e2582[_0x236289][_0x6d7a('0x28')],'ContactId':_0x3e2582[_0x236289][_0x6d7a('0x46')],'VoiceQueueId':_0x3e2582[_0x236289]['VoiceQueueId'],'CampaignId':_0x3e2582[_0x236289][_0x6d7a('0x47')]}});_0x1079bd['push'](_0x18f721);}return BPromise[_0x6d7a('0x48')](_0x1079bd);}})[_0x6d7a('0x22')](function(_0x12eb1c){logger['info'](_0x6d7a('0x49'),util[_0x6d7a('0x19')](_0x12eb1c,{'showHidden':![],'depth':null}));_0xeb867c();})[_0x6d7a('0x2c')](function(_0x1f2226){logger['error'](_0x6d7a('0x4a'),util[_0x6d7a('0x19')](_0x1f2226,{'showHidden':![],'depth':null}));_0xeb867c(_0x1f2226);});}}});}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.rpc.js b/server/api/cmContact/cmContact.rpc.js index 207f363..d770ac1 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(_0x47bd4b,_0x422b04){var _0x3a99b7=function(_0x44962d){while(--_0x44962d){_0x47bd4b['push'](_0x47bd4b['shift']());}};_0x3a99b7(++_0x422b04);}(_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 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(_0x532d5b,_0x4b6047){var _0x523f05=function(_0x130c20){while(--_0x130c20){_0x532d5b['push'](_0x532d5b['shift']());}};_0x523f05(++_0x4b6047);}(_0xa9e0,0x123));var _0x0a9e=function(_0x934425,_0x5af72f){_0x934425=_0x934425-0x0;var _0x31d596=_0xa9e0[_0x934425];return _0x31d596;};'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 c98e453..ae3ce9e 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 _0xa0bc=['STRING','PHONE','exports','INTEGER'];(function(_0x2af777,_0x4ec97d){var _0x655683=function(_0x195fc2){while(--_0x195fc2){_0x2af777['push'](_0x2af777['shift']());}};_0x655683(++_0x4ec97d);}(_0xa0bc,0x1b6));var _0xca0b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa0bc[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0xca0b('0x0')]={'CmContactId':{'type':Sequelize[_0xca0b('0x1')],'primaryKey':!![]},'item':{'type':Sequelize['STRING'],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0xca0b('0x1')],'defaultValue':null},'ItemClass':{'type':Sequelize[_0xca0b('0x2')],'defaultValue':_0xca0b('0x3')},'OrderBy':{'type':Sequelize[_0xca0b('0x1')],'defaultValue':null},'description':{'type':Sequelize[_0xca0b('0x2')],'defaultValue':null}}; \ No newline at end of file +var _0xde64=['sequelize','exports','INTEGER','STRING'];(function(_0x203e10,_0x57832f){var _0x1f8e7a=function(_0x5d3d62){while(--_0x5d3d62){_0x203e10['push'](_0x203e10['shift']());}};_0x1f8e7a(++_0x57832f);}(_0xde64,0x17c));var _0x4de6=function(_0x5668dc,_0x241126){_0x5668dc=_0x5668dc-0x0;var _0xd8a94c=_0xde64[_0x5668dc];return _0xd8a94c;};'use strict';var Sequelize=require(_0x4de6('0x0'));module[_0x4de6('0x1')]={'CmContactId':{'type':Sequelize[_0x4de6('0x2')],'primaryKey':!![]},'item':{'type':Sequelize[_0x4de6('0x3')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0x4de6('0x2')],'defaultValue':null},'ItemClass':{'type':Sequelize[_0x4de6('0x3')],'defaultValue':'PHONE'},'OrderBy':{'type':Sequelize[_0x4de6('0x2')],'defaultValue':null},'description':{'type':Sequelize[_0x4de6('0x3')],'defaultValue':null}}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.controller.js b/server/api/cmContactHasItem/cmContactHasItem.controller.js index 8ef0761..b7e3e2c 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 _0xcfa6=['query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','options','includeAll','CmContactHasItem','findAll','rows','show','params','length','include','merge','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','ejs','lodash','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','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','save','update','then','destroy','get','CmContactHasItems','error','stack','name','send','map','rawAttributes','fieldName','type','key'];(function(_0x2a6809,_0x44edde){var _0x11c371=function(_0x1a4888){while(--_0x1a4888){_0x2a6809['push'](_0x2a6809['shift']());}};_0x11c371(++_0x44edde);}(_0xcfa6,0x177));var _0x6cfa=function(_0x33f6be,_0x2864a6){_0x33f6be=_0x33f6be-0x0;var _0x3de6ac=_0xcfa6[_0x33f6be];return _0x3de6ac;};'use strict';var emlformat=require(_0x6cfa('0x0'));var rimraf=require(_0x6cfa('0x1'));var zipdir=require(_0x6cfa('0x2'));var jsonpatch=require(_0x6cfa('0x3'));var rp=require(_0x6cfa('0x4'));var moment=require('moment');var BPromise=require(_0x6cfa('0x5'));var Mustache=require(_0x6cfa('0x6'));var util=require('util');var path=require(_0x6cfa('0x7'));var sox=require(_0x6cfa('0x8'));var csv=require('to-csv');var ejs=require(_0x6cfa('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6cfa('0xa'));var squel=require('squel');var crypto=require(_0x6cfa('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x6cfa('0xc'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x6cfa('0xd'));var authService=require(_0x6cfa('0xe'));var qs=require(_0x6cfa('0xf'));var as=require(_0x6cfa('0x10'));var hardwareService=require(_0x6cfa('0x11'));var logger=require(_0x6cfa('0x12'))(_0x6cfa('0x13'));var utils=require(_0x6cfa('0x14'));var config=require(_0x6cfa('0x15'));var licenseUtil=require(_0x6cfa('0x16'));var db=require(_0x6cfa('0x17'))['db'];function respondWithStatusCode(_0x4b4f69,_0x3fed7a){_0x3fed7a=_0x3fed7a||0xcc;return function(_0xde8cb2){if(_0xde8cb2){return _0x4b4f69[_0x6cfa('0x18')](_0x3fed7a);}return _0x4b4f69[_0x6cfa('0x19')](_0x3fed7a)[_0x6cfa('0x1a')]();};}function respondWithResult(_0x1b29fe,_0xda6476){_0xda6476=_0xda6476||0xc8;return function(_0x4d6ee4){if(_0x4d6ee4){return _0x1b29fe[_0x6cfa('0x19')](_0xda6476)['json'](_0x4d6ee4);}};}function respondWithFilteredResult(_0x4facb3,_0x513bb0){return function(_0x5a7895){if(_0x5a7895){var _0x297dc1=typeof _0x513bb0[_0x6cfa('0x1b')]===_0x6cfa('0x1c')&&typeof _0x513bb0[_0x6cfa('0x1d')]===_0x6cfa('0x1c');var _0x183481=_0x5a7895[_0x6cfa('0x1e')];var _0x35a7e7=_0x297dc1?0x0:_0x513bb0[_0x6cfa('0x1b')];var _0x1df6b5=_0x297dc1?_0x5a7895[_0x6cfa('0x1e')]:_0x513bb0['offset']+_0x513bb0[_0x6cfa('0x1d')];var _0x957195;if(_0x1df6b5>=_0x183481){_0x1df6b5=_0x183481;_0x957195=0xc8;}else{_0x957195=0xce;}_0x4facb3[_0x6cfa('0x19')](_0x957195);return _0x4facb3[_0x6cfa('0x1f')](_0x6cfa('0x20'),_0x35a7e7+'-'+_0x1df6b5+'/'+_0x183481)[_0x6cfa('0x21')](_0x5a7895);}return null;};}function patchUpdates(_0x10232c){return function(_0x8700a6){try{jsonpatch[_0x6cfa('0x22')](_0x8700a6,_0x10232c,!![]);}catch(_0x22d087){return BPromise['reject'](_0x22d087);}return _0x8700a6[_0x6cfa('0x23')]();};}function saveUpdates(_0x59e285,_0x4431ef){return function(_0x468ef7){if(_0x468ef7){return _0x468ef7[_0x6cfa('0x24')](_0x59e285)[_0x6cfa('0x25')](function(_0x4a773a){return _0x4a773a;});}return null;};}function removeEntity(_0x12cfbd,_0x3edad4){return function(_0x4075b8){if(_0x4075b8){return _0x4075b8[_0x6cfa('0x26')]()['then'](function(){var _0x4a6f0e=_0x4075b8[_0x6cfa('0x27')]({'plain':!![]});var _0x5ccd=_0x6cfa('0x28');return db['UserProfileResource']['destroy']({'where':{'type':_0x5ccd,'resourceId':_0x4a6f0e['id']}})['then'](function(){return _0x4075b8;});})[_0x6cfa('0x25')](function(){_0x12cfbd['status'](0xcc)[_0x6cfa('0x1a')]();});}};}function handleEntityNotFound(_0xcabfc,_0x111269){return function(_0x528dbc){if(!_0x528dbc){_0xcabfc[_0x6cfa('0x18')](0x194);}return _0x528dbc;};}function handleError(_0x2c94c9,_0x1377df){_0x1377df=_0x1377df||0x1f4;return function(_0x1f25dd){logger[_0x6cfa('0x29')](_0x1f25dd[_0x6cfa('0x2a')]);if(_0x1f25dd[_0x6cfa('0x2b')]){delete _0x1f25dd[_0x6cfa('0x2b')];}_0x2c94c9['status'](_0x1377df)[_0x6cfa('0x2c')](_0x1f25dd);};}exports['index']=function(_0x4095ab,_0x1e6304){var _0x3c3424={},_0x4640c0={},_0x43e12f={'count':0x0,'rows':[]};var _0x5758cf=_[_0x6cfa('0x2d')](db['CmContactHasItem'][_0x6cfa('0x2e')],function(_0x2c9c3e){return{'name':_0x2c9c3e[_0x6cfa('0x2f')],'type':_0x2c9c3e[_0x6cfa('0x30')][_0x6cfa('0x31')]};});_0x4640c0['model']=_[_0x6cfa('0x2d')](_0x5758cf,_0x6cfa('0x2b'));_0x4640c0[_0x6cfa('0x32')]=_[_0x6cfa('0x33')](_0x4095ab['query']);_0x4640c0[_0x6cfa('0x34')]=_[_0x6cfa('0x35')](_0x4640c0[_0x6cfa('0x36')],_0x4640c0[_0x6cfa('0x32')]);_0x3c3424[_0x6cfa('0x37')]=_[_0x6cfa('0x35')](_0x4640c0['model'],qs['fields'](_0x4095ab[_0x6cfa('0x32')][_0x6cfa('0x38')]));_0x3c3424[_0x6cfa('0x37')]=_0x3c3424[_0x6cfa('0x37')]['length']?_0x3c3424['attributes']:_0x4640c0[_0x6cfa('0x36')];if(!_0x4095ab[_0x6cfa('0x32')][_0x6cfa('0x39')](_0x6cfa('0x3a'))){_0x3c3424[_0x6cfa('0x1d')]=qs[_0x6cfa('0x1d')](_0x4095ab[_0x6cfa('0x32')][_0x6cfa('0x1d')]);_0x3c3424[_0x6cfa('0x1b')]=qs[_0x6cfa('0x1b')](_0x4095ab['query'][_0x6cfa('0x1b')]);}_0x3c3424[_0x6cfa('0x3b')]=qs['sort'](_0x4095ab[_0x6cfa('0x32')][_0x6cfa('0x3c')]);_0x3c3424[_0x6cfa('0x3d')]=qs['filters'](_[_0x6cfa('0x3e')](_0x4095ab[_0x6cfa('0x32')],_0x4640c0[_0x6cfa('0x34')]),_0x5758cf);if(_0x4095ab[_0x6cfa('0x32')][_0x6cfa('0x3f')]){_0x3c3424[_0x6cfa('0x3d')]=_['merge'](_0x3c3424['where'],{'$or':_[_0x6cfa('0x2d')](_0x5758cf,function(_0x16d28a){if(_0x16d28a[_0x6cfa('0x30')]!==_0x6cfa('0x40')){var _0x3bc0a3={};_0x3bc0a3[_0x16d28a[_0x6cfa('0x2b')]]={'$like':'%'+_0x4095ab[_0x6cfa('0x32')][_0x6cfa('0x3f')]+'%'};return _0x3bc0a3;}})});}_0x3c3424=_['merge']({},_0x3c3424,_0x4095ab[_0x6cfa('0x41')]);var _0x4e00cb={'where':_0x3c3424[_0x6cfa('0x3d')]};return db['CmContactHasItem']['count'](_0x4e00cb)[_0x6cfa('0x25')](function(_0x4fd9cc){_0x43e12f['count']=_0x4fd9cc;if(_0x4095ab['query'][_0x6cfa('0x42')]){_0x3c3424['include']=[{'all':!![]}];}return db[_0x6cfa('0x43')][_0x6cfa('0x44')](_0x3c3424);})[_0x6cfa('0x25')](function(_0x148288){_0x43e12f[_0x6cfa('0x45')]=_0x148288;return _0x43e12f;})['then'](respondWithFilteredResult(_0x1e6304,_0x3c3424))['catch'](handleError(_0x1e6304,null));};exports[_0x6cfa('0x46')]=function(_0x282632,_0x120f2f){var _0x52a74a={'raw':!![],'where':{'id':_0x282632[_0x6cfa('0x47')]['id']}},_0x2bbdc5={};_0x2bbdc5[_0x6cfa('0x36')]=_['keys'](db[_0x6cfa('0x43')][_0x6cfa('0x2e')]);_0x2bbdc5['query']=_[_0x6cfa('0x33')](_0x282632[_0x6cfa('0x32')]);_0x2bbdc5['filters']=_[_0x6cfa('0x35')](_0x2bbdc5[_0x6cfa('0x36')],_0x2bbdc5[_0x6cfa('0x32')]);_0x52a74a['attributes']=_[_0x6cfa('0x35')](_0x2bbdc5['model'],qs['fields'](_0x282632[_0x6cfa('0x32')][_0x6cfa('0x38')]));_0x52a74a['attributes']=_0x52a74a['attributes'][_0x6cfa('0x48')]?_0x52a74a[_0x6cfa('0x37')]:_0x2bbdc5[_0x6cfa('0x36')];if(_0x282632['query'][_0x6cfa('0x42')]){_0x52a74a[_0x6cfa('0x49')]=[{'all':!![]}];}_0x52a74a=_[_0x6cfa('0x4a')]({},_0x52a74a,_0x282632['options']);return db[_0x6cfa('0x43')][_0x6cfa('0x4b')](_0x52a74a)[_0x6cfa('0x25')](handleEntityNotFound(_0x120f2f,null))[_0x6cfa('0x25')](respondWithResult(_0x120f2f,null))[_0x6cfa('0x4c')](handleError(_0x120f2f,null));};exports[_0x6cfa('0x4d')]=function(_0x1c5ecf,_0x1110b7){return db[_0x6cfa('0x43')][_0x6cfa('0x4d')](_0x1c5ecf[_0x6cfa('0x4e')],{})['then'](function(_0xc187f7){var _0x16800c=_0x1c5ecf[_0x6cfa('0x4f')]['get']({'plain':!![]});if(!_0x16800c)throw new Error(_0x6cfa('0x50'));if(_0x16800c[_0x6cfa('0x51')]===_0x6cfa('0x4f')){var _0x1276f5=_0xc187f7['get']({'plain':!![]});var _0x5d057b='CmContactHasItems';return db[_0x6cfa('0x52')][_0x6cfa('0x4b')]({'where':{'name':_0x5d057b,'userProfileId':_0x16800c[_0x6cfa('0x53')]},'raw':!![]})['then'](function(_0x3a15ab){if(_0x3a15ab&&_0x3a15ab['autoAssociation']===0x0){return db['UserProfileResource'][_0x6cfa('0x4d')]({'name':_0x1276f5[_0x6cfa('0x2b')],'resourceId':_0x1276f5['id'],'type':_0x3a15ab[_0x6cfa('0x2b')],'sectionId':_0x3a15ab['id']},{})[_0x6cfa('0x25')](function(){return _0xc187f7;});}else{return _0xc187f7;}})[_0x6cfa('0x4c')](function(_0x23e742){logger[_0x6cfa('0x29')](_0x6cfa('0x54'),_0x23e742);throw _0x23e742;});}return _0xc187f7;})[_0x6cfa('0x25')](respondWithResult(_0x1110b7,0xc9))['catch'](handleError(_0x1110b7,null));};exports[_0x6cfa('0x24')]=function(_0x466ee5,_0x1e3675){if(_0x466ee5[_0x6cfa('0x4e')]['id']){delete _0x466ee5[_0x6cfa('0x4e')]['id'];}return db[_0x6cfa('0x43')]['find']({'where':{'id':_0x466ee5['params']['id']}})[_0x6cfa('0x25')](handleEntityNotFound(_0x1e3675,null))['then'](saveUpdates(_0x466ee5[_0x6cfa('0x4e')],null))[_0x6cfa('0x25')](respondWithResult(_0x1e3675,null))['catch'](handleError(_0x1e3675,null));};exports[_0x6cfa('0x26')]=function(_0x7d3bd1,_0x3fb088){return db[_0x6cfa('0x43')][_0x6cfa('0x4b')]({'where':{'id':_0x7d3bd1[_0x6cfa('0x47')]['id']}})[_0x6cfa('0x25')](handleEntityNotFound(_0x3fb088,null))[_0x6cfa('0x25')](removeEntity(_0x3fb088,null))[_0x6cfa('0x4c')](handleError(_0x3fb088,null));}; \ No newline at end of file +var _0x11af=['send','index','map','CmContactHasItem','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','nolimit','sort','where','pick','filter','merge','VIRTUAL','include','findAll','catch','show','keys','includeAll','options','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','get','CmContactHasItems','UserProfileResource','error','name'];(function(_0x52b7b9,_0x43ed4b){var _0x5b5d30=function(_0x4a5b9c){while(--_0x4a5b9c){_0x52b7b9['push'](_0x52b7b9['shift']());}};_0x5b5d30(++_0x43ed4b);}(_0x11af,0x184));var _0xf11a=function(_0x1ecd20,_0x3f7f6f){_0x1ecd20=_0x1ecd20-0x0;var _0x312a78=_0x11af[_0x1ecd20];return _0x312a78;};'use strict';var emlformat=require(_0xf11a('0x0'));var rimraf=require(_0xf11a('0x1'));var zipdir=require(_0xf11a('0x2'));var jsonpatch=require(_0xf11a('0x3'));var rp=require(_0xf11a('0x4'));var moment=require(_0xf11a('0x5'));var BPromise=require(_0xf11a('0x6'));var Mustache=require(_0xf11a('0x7'));var util=require(_0xf11a('0x8'));var path=require(_0xf11a('0x9'));var sox=require('sox');var csv=require(_0xf11a('0xa'));var ejs=require(_0xf11a('0xb'));var fs=require('fs');var fs_extra=require(_0xf11a('0xc'));var _=require(_0xf11a('0xd'));var squel=require(_0xf11a('0xe'));var crypto=require(_0xf11a('0xf'));var jsforce=require('jsforce');var deskjs=require(_0xf11a('0x10'));var toCsv=require(_0xf11a('0xa'));var querystring=require(_0xf11a('0x11'));var Papa=require('papaparse');var Redis=require(_0xf11a('0x12'));var authService=require(_0xf11a('0x13'));var qs=require(_0xf11a('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf11a('0x15'));var logger=require(_0xf11a('0x16'))(_0xf11a('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xf11a('0x18'));var db=require(_0xf11a('0x19'))['db'];function respondWithStatusCode(_0x31b3a5,_0x4234f8){_0x4234f8=_0x4234f8||0xcc;return function(_0x315131){if(_0x315131){return _0x31b3a5[_0xf11a('0x1a')](_0x4234f8);}return _0x31b3a5[_0xf11a('0x1b')](_0x4234f8)[_0xf11a('0x1c')]();};}function respondWithResult(_0x3d0f81,_0x1f2f57){_0x1f2f57=_0x1f2f57||0xc8;return function(_0x595020){if(_0x595020){return _0x3d0f81[_0xf11a('0x1b')](_0x1f2f57)[_0xf11a('0x1d')](_0x595020);}};}function respondWithFilteredResult(_0x40c762,_0x5eda80){return function(_0x2ee0cc){if(_0x2ee0cc){var _0x1c3214=typeof _0x5eda80[_0xf11a('0x1e')]==='undefined'&&typeof _0x5eda80[_0xf11a('0x1f')]===_0xf11a('0x20');var _0x43fc1c=_0x2ee0cc[_0xf11a('0x21')];var _0x2e0a22=_0x1c3214?0x0:_0x5eda80[_0xf11a('0x1e')];var _0x2cd908=_0x1c3214?_0x2ee0cc['count']:_0x5eda80[_0xf11a('0x1e')]+_0x5eda80['limit'];var _0x1a2b79;if(_0x2cd908>=_0x43fc1c){_0x2cd908=_0x43fc1c;_0x1a2b79=0xc8;}else{_0x1a2b79=0xce;}_0x40c762[_0xf11a('0x1b')](_0x1a2b79);return _0x40c762[_0xf11a('0x22')](_0xf11a('0x23'),_0x2e0a22+'-'+_0x2cd908+'/'+_0x43fc1c)[_0xf11a('0x1d')](_0x2ee0cc);}return null;};}function patchUpdates(_0x82511){return function(_0x50cdcb){try{jsonpatch[_0xf11a('0x24')](_0x50cdcb,_0x82511,!![]);}catch(_0x1584c8){return BPromise[_0xf11a('0x25')](_0x1584c8);}return _0x50cdcb[_0xf11a('0x26')]();};}function saveUpdates(_0x26a644,_0x249267){return function(_0x3f68a1){if(_0x3f68a1){return _0x3f68a1[_0xf11a('0x27')](_0x26a644)[_0xf11a('0x28')](function(_0x1cfdef){return _0x1cfdef;});}return null;};}function removeEntity(_0x56ba1c,_0x5b0de7){return function(_0x47bfe1){if(_0x47bfe1){return _0x47bfe1[_0xf11a('0x29')]()[_0xf11a('0x28')](function(){var _0x3ffe8b=_0x47bfe1[_0xf11a('0x2a')]({'plain':!![]});var _0xb7948b=_0xf11a('0x2b');return db[_0xf11a('0x2c')][_0xf11a('0x29')]({'where':{'type':_0xb7948b,'resourceId':_0x3ffe8b['id']}})['then'](function(){return _0x47bfe1;});})[_0xf11a('0x28')](function(){_0x56ba1c[_0xf11a('0x1b')](0xcc)[_0xf11a('0x1c')]();});}};}function handleEntityNotFound(_0x3a1149,_0x180003){return function(_0x1ff67d){if(!_0x1ff67d){_0x3a1149['sendStatus'](0x194);}return _0x1ff67d;};}function handleError(_0x2e791e,_0x196787){_0x196787=_0x196787||0x1f4;return function(_0x44c9e5){logger[_0xf11a('0x2d')](_0x44c9e5['stack']);if(_0x44c9e5[_0xf11a('0x2e')]){delete _0x44c9e5[_0xf11a('0x2e')];}_0x2e791e[_0xf11a('0x1b')](_0x196787)[_0xf11a('0x2f')](_0x44c9e5);};}exports[_0xf11a('0x30')]=function(_0x400309,_0x21267){var _0x11b513={},_0x4de448={},_0x15c868={'count':0x0,'rows':[]};var _0x12b847=_[_0xf11a('0x31')](db[_0xf11a('0x32')][_0xf11a('0x33')],function(_0x406dc2){return{'name':_0x406dc2[_0xf11a('0x34')],'type':_0x406dc2[_0xf11a('0x35')][_0xf11a('0x36')]};});_0x4de448['model']=_[_0xf11a('0x31')](_0x12b847,'name');_0x4de448['query']=_['keys'](_0x400309[_0xf11a('0x37')]);_0x4de448[_0xf11a('0x38')]=_[_0xf11a('0x39')](_0x4de448[_0xf11a('0x3a')],_0x4de448[_0xf11a('0x37')]);_0x11b513[_0xf11a('0x3b')]=_[_0xf11a('0x39')](_0x4de448[_0xf11a('0x3a')],qs[_0xf11a('0x3c')](_0x400309[_0xf11a('0x37')][_0xf11a('0x3c')]));_0x11b513['attributes']=_0x11b513[_0xf11a('0x3b')][_0xf11a('0x3d')]?_0x11b513[_0xf11a('0x3b')]:_0x4de448[_0xf11a('0x3a')];if(!_0x400309[_0xf11a('0x37')]['hasOwnProperty'](_0xf11a('0x3e'))){_0x11b513[_0xf11a('0x1f')]=qs[_0xf11a('0x1f')](_0x400309[_0xf11a('0x37')][_0xf11a('0x1f')]);_0x11b513['offset']=qs[_0xf11a('0x1e')](_0x400309[_0xf11a('0x37')][_0xf11a('0x1e')]);}_0x11b513['order']=qs[_0xf11a('0x3f')](_0x400309['query']['sort']);_0x11b513[_0xf11a('0x40')]=qs[_0xf11a('0x38')](_[_0xf11a('0x41')](_0x400309['query'],_0x4de448[_0xf11a('0x38')]),_0x12b847);if(_0x400309[_0xf11a('0x37')][_0xf11a('0x42')]){_0x11b513['where']=_[_0xf11a('0x43')](_0x11b513['where'],{'$or':_[_0xf11a('0x31')](_0x12b847,function(_0x67e37e){if(_0x67e37e['type']!==_0xf11a('0x44')){var _0x121d30={};_0x121d30[_0x67e37e[_0xf11a('0x2e')]]={'$like':'%'+_0x400309[_0xf11a('0x37')][_0xf11a('0x42')]+'%'};return _0x121d30;}})});}_0x11b513=_[_0xf11a('0x43')]({},_0x11b513,_0x400309['options']);var _0x46704e={'where':_0x11b513[_0xf11a('0x40')]};return db[_0xf11a('0x32')][_0xf11a('0x21')](_0x46704e)[_0xf11a('0x28')](function(_0x194480){_0x15c868['count']=_0x194480;if(_0x400309[_0xf11a('0x37')]['includeAll']){_0x11b513[_0xf11a('0x45')]=[{'all':!![]}];}return db[_0xf11a('0x32')][_0xf11a('0x46')](_0x11b513);})['then'](function(_0x5f59c3){_0x15c868['rows']=_0x5f59c3;return _0x15c868;})[_0xf11a('0x28')](respondWithFilteredResult(_0x21267,_0x11b513))[_0xf11a('0x47')](handleError(_0x21267,null));};exports[_0xf11a('0x48')]=function(_0x867a5e,_0x504042){var _0x288e17={'raw':!![],'where':{'id':_0x867a5e['params']['id']}},_0x20ed97={};_0x20ed97['model']=_[_0xf11a('0x49')](db['CmContactHasItem'][_0xf11a('0x33')]);_0x20ed97['query']=_[_0xf11a('0x49')](_0x867a5e['query']);_0x20ed97[_0xf11a('0x38')]=_[_0xf11a('0x39')](_0x20ed97[_0xf11a('0x3a')],_0x20ed97[_0xf11a('0x37')]);_0x288e17['attributes']=_[_0xf11a('0x39')](_0x20ed97[_0xf11a('0x3a')],qs[_0xf11a('0x3c')](_0x867a5e[_0xf11a('0x37')][_0xf11a('0x3c')]));_0x288e17[_0xf11a('0x3b')]=_0x288e17[_0xf11a('0x3b')]['length']?_0x288e17[_0xf11a('0x3b')]:_0x20ed97[_0xf11a('0x3a')];if(_0x867a5e[_0xf11a('0x37')][_0xf11a('0x4a')]){_0x288e17[_0xf11a('0x45')]=[{'all':!![]}];}_0x288e17=_[_0xf11a('0x43')]({},_0x288e17,_0x867a5e[_0xf11a('0x4b')]);return db[_0xf11a('0x32')]['find'](_0x288e17)[_0xf11a('0x28')](handleEntityNotFound(_0x504042,null))['then'](respondWithResult(_0x504042,null))[_0xf11a('0x47')](handleError(_0x504042,null));};exports['create']=function(_0x4dff0a,_0x5a219c){return db[_0xf11a('0x32')]['create'](_0x4dff0a[_0xf11a('0x4c')],{})['then'](function(_0x4ab8cf){var _0x50e207=_0x4dff0a[_0xf11a('0x4d')]['get']({'plain':!![]});if(!_0x50e207)throw new Error(_0xf11a('0x4e'));if(_0x50e207[_0xf11a('0x4f')]===_0xf11a('0x4d')){var _0x3ca767=_0x4ab8cf['get']({'plain':!![]});var _0x5b9ea1=_0xf11a('0x2b');return db[_0xf11a('0x50')][_0xf11a('0x51')]({'where':{'name':_0x5b9ea1,'userProfileId':_0x50e207[_0xf11a('0x52')]},'raw':!![]})[_0xf11a('0x28')](function(_0x5a40d7){if(_0x5a40d7&&_0x5a40d7[_0xf11a('0x53')]===0x0){return db['UserProfileResource'][_0xf11a('0x54')]({'name':_0x3ca767['name'],'resourceId':_0x3ca767['id'],'type':_0x5a40d7['name'],'sectionId':_0x5a40d7['id']},{})['then'](function(){return _0x4ab8cf;});}else{return _0x4ab8cf;}})['catch'](function(_0x17ae6f){logger[_0xf11a('0x2d')](_0xf11a('0x55'),_0x17ae6f);throw _0x17ae6f;});}return _0x4ab8cf;})[_0xf11a('0x28')](respondWithResult(_0x5a219c,0xc9))[_0xf11a('0x47')](handleError(_0x5a219c,null));};exports[_0xf11a('0x27')]=function(_0x3d5463,_0x4a7fdb){if(_0x3d5463[_0xf11a('0x4c')]['id']){delete _0x3d5463[_0xf11a('0x4c')]['id'];}return db[_0xf11a('0x32')][_0xf11a('0x51')]({'where':{'id':_0x3d5463[_0xf11a('0x56')]['id']}})['then'](handleEntityNotFound(_0x4a7fdb,null))['then'](saveUpdates(_0x3d5463[_0xf11a('0x4c')],null))[_0xf11a('0x28')](respondWithResult(_0x4a7fdb,null))[_0xf11a('0x47')](handleError(_0x4a7fdb,null));};exports['destroy']=function(_0x59c6e6,_0x2f65c8){return db[_0xf11a('0x32')][_0xf11a('0x51')]({'where':{'id':_0x59c6e6['params']['id']}})[_0xf11a('0x28')](handleEntityNotFound(_0x2f65c8,null))['then'](removeEntity(_0x2f65c8,null))['catch'](handleError(_0x2f65c8,null));}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.model.js b/server/api/cmContactHasItem/cmContactHasItem.model.js index 224f10f..18a131c 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 _0x42fb=['api','request-promise','path','./cmContactHasItem.attributes','exports','CmContactHasItem','cm_contact_has_items','lodash','util','../../config/logger'];(function(_0x223611,_0x31b708){var _0x53ccaa=function(_0x49787e){while(--_0x49787e){_0x223611['push'](_0x223611['shift']());}};_0x53ccaa(++_0x31b708);}(_0x42fb,0xe3));var _0xb42f=function(_0x3b7b79,_0x35cb05){_0x3b7b79=_0x3b7b79-0x0;var _0x3e0ed0=_0x42fb[_0x3b7b79];return _0x3e0ed0;};'use strict';var _=require(_0xb42f('0x0'));var util=require(_0xb42f('0x1'));var logger=require(_0xb42f('0x2'))(_0xb42f('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xb42f('0x4'));var fs=require('fs');var path=require(_0xb42f('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xb42f('0x6'));module[_0xb42f('0x7')]=function(_0x854ea3,_0x1235c1){return _0x854ea3['define'](_0xb42f('0x8'),attributes,{'tableName':_0xb42f('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2c38=['cm_contact_has_items','lodash','util','moment','bluebird','request-promise','rimraf','../../config/environment','./cmContactHasItem.attributes','exports','CmContactHasItem'];(function(_0x121b17,_0x3f519b){var _0x2e587a=function(_0x388752){while(--_0x388752){_0x121b17['push'](_0x121b17['shift']());}};_0x2e587a(++_0x3f519b);}(_0x2c38,0x109));var _0x82c3=function(_0x3575ed,_0x3294bb){_0x3575ed=_0x3575ed-0x0;var _0x36cb29=_0x2c38[_0x3575ed];return _0x36cb29;};'use strict';var _=require(_0x82c3('0x0'));var util=require(_0x82c3('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x82c3('0x2'));var BPromise=require(_0x82c3('0x3'));var rp=require(_0x82c3('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x82c3('0x5'));var config=require(_0x82c3('0x6'));var attributes=require(_0x82c3('0x7'));module[_0x82c3('0x8')]=function(_0x72ba87,_0x1c760f){return _0x72ba87['define'](_0x82c3('0x9'),attributes,{'tableName':_0x82c3('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.rpc.js b/server/api/cmContactHasItem/cmContactHasItem.rpc.js index cf2bc30..b943147 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 _0x4ecb=['error','code','message','CmContactHasItem,\x20%s,\x20%s','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','rpc','jayson/promise','client','http','info','CmContactHasItem,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x42a570,_0x23d19b){var _0x3eb4d9=function(_0x4537c3){while(--_0x4537c3){_0x42a570['push'](_0x42a570['shift']());}};_0x3eb4d9(++_0x23d19b);}(_0x4ecb,0x1ba));var _0xb4ec=function(_0xac151d,_0x4ea1d2){_0xac151d=_0xac151d-0x0;var _0x111dba=_0x4ecb[_0xac151d];return _0x111dba;};'use strict';var _=require(_0xb4ec('0x0'));var util=require(_0xb4ec('0x1'));var moment=require('moment');var BPromise=require(_0xb4ec('0x2'));var rs=require(_0xb4ec('0x3'));var fs=require('fs');var Redis=require(_0xb4ec('0x4'));var db=require(_0xb4ec('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xb4ec('0x6'));var config=require('../../config/environment');var jayson=require(_0xb4ec('0x7'));var client=jayson[_0xb4ec('0x8')][_0xb4ec('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x205a9a,_0x501480,_0xc7594c){return new BPromise(function(_0x17233d,_0x1bfb09){return client['request'](_0x205a9a,_0xc7594c)['then'](function(_0x3c1fbc){logger[_0xb4ec('0xa')]('CmContactHasItem,\x20%s,\x20%s',_0x501480,'request\x20sent');logger['debug'](_0xb4ec('0xb'),_0x501480,_0xb4ec('0xc'),JSON[_0xb4ec('0xd')](_0x3c1fbc));if(_0x3c1fbc[_0xb4ec('0xe')]){if(_0x3c1fbc['error'][_0xb4ec('0xf')]===0x1f4){logger[_0xb4ec('0xe')]('CmContactHasItem,\x20%s,\x20%s',_0x501480,_0x3c1fbc[_0xb4ec('0xe')][_0xb4ec('0x10')]);return _0x1bfb09(_0x3c1fbc[_0xb4ec('0xe')][_0xb4ec('0x10')]);}logger['error']('CmContactHasItem,\x20%s,\x20%s',_0x501480,_0x3c1fbc[_0xb4ec('0xe')][_0xb4ec('0x10')]);return _0x17233d(_0x3c1fbc[_0xb4ec('0xe')]['message']);}else{logger[_0xb4ec('0xa')](_0xb4ec('0x11'),_0x501480,'request\x20sent');_0x17233d(_0x3c1fbc['result'][_0xb4ec('0x10')]);}})[_0xb4ec('0x12')](function(_0x3bb9a9){logger[_0xb4ec('0xe')](_0xb4ec('0x11'),_0x501480,_0x3bb9a9);_0x1bfb09(_0x3bb9a9);});});} \ No newline at end of file +var _0x5cb0=['info','CmContactHasItem,\x20%s,\x20%s','debug','CmContactHasItem,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','rpc','../../config/environment','client','http','request'];(function(_0x43f4c2,_0x1055c1){var _0x4bd654=function(_0x529e52){while(--_0x529e52){_0x43f4c2['push'](_0x43f4c2['shift']());}};_0x4bd654(++_0x1055c1);}(_0x5cb0,0x106));var _0x05cb=function(_0x2b9cbc,_0x4209b0){_0x2b9cbc=_0x2b9cbc-0x0;var _0xc91b75=_0x5cb0[_0x2b9cbc];return _0xc91b75;};'use strict';var _=require(_0x05cb('0x0'));var util=require(_0x05cb('0x1'));var moment=require(_0x05cb('0x2'));var BPromise=require(_0x05cb('0x3'));var rs=require(_0x05cb('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x05cb('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x05cb('0x6'));var config=require(_0x05cb('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x05cb('0x8')][_0x05cb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x14dd9a,_0x4830cd,_0x580d4a){return new BPromise(function(_0x5137f8,_0x177645){return client[_0x05cb('0xa')](_0x14dd9a,_0x580d4a)['then'](function(_0x14edf0){logger[_0x05cb('0xb')](_0x05cb('0xc'),_0x4830cd,'request\x20sent');logger[_0x05cb('0xd')](_0x05cb('0xe'),_0x4830cd,_0x05cb('0xf'),JSON['stringify'](_0x14edf0));if(_0x14edf0[_0x05cb('0x10')]){if(_0x14edf0['error'][_0x05cb('0x11')]===0x1f4){logger[_0x05cb('0x10')]('CmContactHasItem,\x20%s,\x20%s',_0x4830cd,_0x14edf0['error'][_0x05cb('0x12')]);return _0x177645(_0x14edf0['error']['message']);}logger[_0x05cb('0x10')](_0x05cb('0xc'),_0x4830cd,_0x14edf0['error']['message']);return _0x5137f8(_0x14edf0[_0x05cb('0x10')][_0x05cb('0x12')]);}else{logger[_0x05cb('0xb')](_0x05cb('0xc'),_0x4830cd,'request\x20sent');_0x5137f8(_0x14edf0[_0x05cb('0x13')][_0x05cb('0x12')]);}})[_0x05cb('0x14')](function(_0x113832){logger[_0x05cb('0x10')](_0x05cb('0xc'),_0x4830cd,_0x113832);_0x177645(_0x113832);});});} \ No newline at end of file diff --git a/server/api/cmContactHasItem/index.js b/server/api/cmContactHasItem/index.js index 72780bb..4e34ca1 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 _0x5454=['isAuthenticated','index','get','/:id','show','post','create','put','update','destroy','exports','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmContactHasItem.controller'];(function(_0x4e7b46,_0x1e5718){var _0x309599=function(_0x549658){while(--_0x549658){_0x4e7b46['push'](_0x4e7b46['shift']());}};_0x309599(++_0x1e5718);}(_0x5454,0x15b));var _0x4545=function(_0x257e9c,_0x5cb237){_0x257e9c=_0x257e9c-0x0;var _0x16031c=_0x5454[_0x257e9c];return _0x16031c;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x4545('0x0'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x4545('0x1'));var interaction=require(_0x4545('0x2'));var config=require(_0x4545('0x3'));var controller=require(_0x4545('0x4'));router['get']('/',auth[_0x4545('0x5')](),controller[_0x4545('0x6')]);router[_0x4545('0x7')](_0x4545('0x8'),auth[_0x4545('0x5')](),controller[_0x4545('0x9')]);router[_0x4545('0xa')]('/',auth[_0x4545('0x5')](),controller[_0x4545('0xb')]);router[_0x4545('0xc')](_0x4545('0x8'),auth[_0x4545('0x5')](),controller[_0x4545('0xd')]);router['delete'](_0x4545('0x8'),auth[_0x4545('0x5')](),controller[_0x4545('0xe')]);module[_0x4545('0xf')]=router; \ No newline at end of file +var _0x0630=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','isAuthenticated','post','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x32f0e0,_0x29f539){var _0x50fe85=function(_0x3aae04){while(--_0x3aae04){_0x32f0e0['push'](_0x32f0e0['shift']());}};_0x50fe85(++_0x29f539);}(_0x0630,0xde));var _0x0063=function(_0x271e89,_0x288cbf){_0x271e89=_0x271e89-0x0;var _0x4d5750=_0x0630[_0x271e89];return _0x4d5750;};'use strict';var multer=require(_0x0063('0x0'));var util=require(_0x0063('0x1'));var path=require(_0x0063('0x2'));var timeout=require(_0x0063('0x3'));var express=require(_0x0063('0x4'));var router=express[_0x0063('0x5')]();var fs_extra=require(_0x0063('0x6'));var auth=require(_0x0063('0x7'));var interaction=require(_0x0063('0x8'));var config=require(_0x0063('0x9'));var controller=require('./cmContactHasItem.controller');router[_0x0063('0xa')]('/',auth['isAuthenticated'](),controller[_0x0063('0xb')]);router['get']('/:id',auth[_0x0063('0xc')](),controller['show']);router[_0x0063('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x0063('0xe'),auth[_0x0063('0xc')](),controller[_0x0063('0xf')]);router[_0x0063('0x10')](_0x0063('0xe'),auth['isAuthenticated'](),controller[_0x0063('0x11')]);module[_0x0063('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 9d8d5c0..e742ac6 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 _0x82da=['parse','values','isArray','stringify','BOOLEAN','ENUM','sequelize','lodash','exports','alias','STRING','setDataValue','getDataValue','name','TEXT','select'];(function(_0x1b5a05,_0x2c80de){var _0x347931=function(_0xd39454){while(--_0xd39454){_0x1b5a05['push'](_0x1b5a05['shift']());}};_0x347931(++_0x2c80de);}(_0x82da,0xe6));var _0xa82d=function(_0x456fb1,_0x859a1d){_0x456fb1=_0x456fb1-0x0;var _0x4083d6=_0x82da[_0x456fb1];return _0x4083d6;};'use strict';var Sequelize=require(_0xa82d('0x0'));var _=require(_0xa82d('0x1'));module[_0xa82d('0x2')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x3f49b4){return this['getDataValue'](_0xa82d('0x3'));}},'alias':{'type':Sequelize[_0xa82d('0x4')],'allowNull':![],'set':function(_0x3ef8d3){this[_0xa82d('0x5')](_0xa82d('0x3'),_0x3ef8d3?_0x3ef8d3:this[_0xa82d('0x6')](_0xa82d('0x7')));}},'type':{'type':Sequelize[_0xa82d('0x4')],'allowNull':![]},'values':{'type':Sequelize[_0xa82d('0x8')]('long'),'get':function(){if(this[_0xa82d('0x6')]('type')===_0xa82d('0x9')){return JSON[_0xa82d('0xa')](this['getDataValue'](_0xa82d('0xb')));}else{return this[_0xa82d('0x6')]('values');}},'set':function(_0x3774a5){if(Array[_0xa82d('0xc')](_0x3774a5)){this[_0xa82d('0x5')](_0xa82d('0xb'),JSON[_0xa82d('0xd')](_0x3774a5));}else{this['setDataValue'](_0xa82d('0xb'),_0x3774a5);}}},'required':{'type':Sequelize[_0xa82d('0xe')],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0xa82d('0xe')],'defaultValue':![]},'actionType':{'type':Sequelize[_0xa82d('0xf')]('voice')}}; \ No newline at end of file +var _0x2d3e=['BOOLEAN','ENUM','sequelize','lodash','exports','VIRTUAL','setDataValue','alias','getDataValue','name','STRING','TEXT','type','select','values'];(function(_0x2825ae,_0x47550e){var _0x4601fe=function(_0x5c2346){while(--_0x5c2346){_0x2825ae['push'](_0x2825ae['shift']());}};_0x4601fe(++_0x47550e);}(_0x2d3e,0x14c));var _0xe2d3=function(_0x47698f,_0x416d75){_0x47698f=_0x47698f-0x0;var _0x1b73b0=_0x2d3e[_0x47698f];return _0x1b73b0;};'use strict';var Sequelize=require(_0xe2d3('0x0'));var _=require(_0xe2d3('0x1'));module[_0xe2d3('0x2')]={'name':{'type':Sequelize[_0xe2d3('0x3')],'get':function(_0x55e8a2){return this['getDataValue']('alias');}},'alias':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x3b4ab9){this[_0xe2d3('0x4')](_0xe2d3('0x5'),_0x3b4ab9?_0x3b4ab9:this[_0xe2d3('0x6')](_0xe2d3('0x7')));}},'type':{'type':Sequelize[_0xe2d3('0x8')],'allowNull':![]},'values':{'type':Sequelize[_0xe2d3('0x9')]('long'),'get':function(){if(this['getDataValue'](_0xe2d3('0xa'))===_0xe2d3('0xb')){return JSON['parse'](this[_0xe2d3('0x6')](_0xe2d3('0xc')));}else{return this['getDataValue'](_0xe2d3('0xc'));}},'set':function(_0x2f39b5){if(Array['isArray'](_0x2f39b5)){this[_0xe2d3('0x4')](_0xe2d3('0xc'),JSON['stringify'](_0x2f39b5));}else{this[_0xe2d3('0x4')](_0xe2d3('0xc'),_0x2f39b5);}}},'required':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0xe2d3('0xd')],'defaultValue':![]},'actionType':{'type':Sequelize[_0xe2d3('0xe')]('voice')}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index 6c38135..c7adf69 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 _0xa7bc=['querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','Content-Range','apply','reject','save','update','destroy','then','stack','name','send','index','map','CmCustomField','rawAttributes','type','key','model','differenceBy','query','keys','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','filters','merge','options','count','includeAll','include','findAll','rows','catch','show','find','body','params','create','sequelize','transaction','TEXT','text','Sequelize','number','INTEGER','BOOLEAN','defaultValue','queryInterface','addColumn','cm_contacts','format','cf_%d','rimraf','moment','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv'];(function(_0x3fe2c3,_0x455082){var _0xcff74c=function(_0x2fde3d){while(--_0x2fde3d){_0x3fe2c3['push'](_0x3fe2c3['shift']());}};_0xcff74c(++_0x455082);}(_0xa7bc,0x147));var _0xca7b=function(_0x5df93f,_0x175c69){_0x5df93f=_0x5df93f-0x0;var _0x37312e=_0xa7bc[_0x5df93f];return _0x37312e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xca7b('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xca7b('0x1'));var BPromise=require('bluebird');var Mustache=require(_0xca7b('0x2'));var util=require(_0xca7b('0x3'));var path=require(_0xca7b('0x4'));var sox=require(_0xca7b('0x5'));var csv=require('to-csv');var ejs=require(_0xca7b('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xca7b('0x7'));var squel=require(_0xca7b('0x8'));var crypto=require(_0xca7b('0x9'));var jsforce=require(_0xca7b('0xa'));var deskjs=require(_0xca7b('0xb'));var toCsv=require(_0xca7b('0xc'));var querystring=require(_0xca7b('0xd'));var Papa=require(_0xca7b('0xe'));var Redis=require('ioredis');var authService=require(_0xca7b('0xf'));var qs=require(_0xca7b('0x10'));var as=require(_0xca7b('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xca7b('0x12'))('api');var utils=require('../../config/utils');var config=require(_0xca7b('0x13'));var licenseUtil=require(_0xca7b('0x14'));var db=require(_0xca7b('0x15'))['db'];function respondWithStatusCode(_0x11a599,_0x4bb20b){_0x4bb20b=_0x4bb20b||0xcc;return function(_0x1bf18a){if(_0x1bf18a){return _0x11a599[_0xca7b('0x16')](_0x4bb20b);}return _0x11a599[_0xca7b('0x17')](_0x4bb20b)[_0xca7b('0x18')]();};}function respondWithResult(_0x4ecadc,_0x2214f3){_0x2214f3=_0x2214f3||0xc8;return function(_0xec3801){if(_0xec3801){return _0x4ecadc[_0xca7b('0x17')](_0x2214f3)[_0xca7b('0x19')](_0xec3801);}};}function respondWithFilteredResult(_0x1c8e7a,_0x25ed00){return function(_0x1ec46f){if(_0x1ec46f){var _0x28bce0=typeof _0x25ed00[_0xca7b('0x1a')]===_0xca7b('0x1b')&&typeof _0x25ed00[_0xca7b('0x1c')]===_0xca7b('0x1b');var _0x43549a=_0x1ec46f['count'];var _0x140fc5=_0x28bce0?0x0:_0x25ed00['offset'];var _0x3ba24a=_0x28bce0?_0x1ec46f['count']:_0x25ed00['offset']+_0x25ed00[_0xca7b('0x1c')];var _0x21f3a4;if(_0x3ba24a>=_0x43549a){_0x3ba24a=_0x43549a;_0x21f3a4=0xc8;}else{_0x21f3a4=0xce;}_0x1c8e7a['status'](_0x21f3a4);return _0x1c8e7a['set'](_0xca7b('0x1d'),_0x140fc5+'-'+_0x3ba24a+'/'+_0x43549a)[_0xca7b('0x19')](_0x1ec46f);}return null;};}function patchUpdates(_0x576d88){return function(_0x2e6d89){try{jsonpatch[_0xca7b('0x1e')](_0x2e6d89,_0x576d88,!![]);}catch(_0x538125){return BPromise[_0xca7b('0x1f')](_0x538125);}return _0x2e6d89[_0xca7b('0x20')]();};}function saveUpdates(_0xe8b01d,_0x519b09){return function(_0x471faa){if(_0x471faa){return _0x471faa[_0xca7b('0x21')](_0xe8b01d)['then'](function(_0x19146a){return _0x19146a;});}return null;};}function removeEntity(_0x1305a8,_0x48c27b){return function(_0x370aaf){if(_0x370aaf){return _0x370aaf[_0xca7b('0x22')]()[_0xca7b('0x23')](function(){_0x1305a8[_0xca7b('0x17')](0xcc)[_0xca7b('0x18')]();});}};}function handleEntityNotFound(_0x46e579,_0x1b56b0){return function(_0x109240){if(!_0x109240){_0x46e579[_0xca7b('0x16')](0x194);}return _0x109240;};}function handleError(_0x419b90,_0x17c644){_0x17c644=_0x17c644||0x1f4;return function(_0x2138a9){logger['error'](_0x2138a9[_0xca7b('0x24')]);if(_0x2138a9['name']){delete _0x2138a9[_0xca7b('0x25')];}_0x419b90[_0xca7b('0x17')](_0x17c644)[_0xca7b('0x26')](_0x2138a9);};}exports[_0xca7b('0x27')]=function(_0x163226,_0x5b2968){var _0x3fa904={},_0x3a76b4={},_0x5a6e06={'count':0x0,'rows':[]};var _0x431714=_[_0xca7b('0x28')](db[_0xca7b('0x29')][_0xca7b('0x2a')],function(_0x30798c){return{'name':_0x30798c['fieldName'],'type':_0x30798c[_0xca7b('0x2b')][_0xca7b('0x2c')]};});_0x3a76b4[_0xca7b('0x2d')]=_[_0xca7b('0x2e')](_[_0xca7b('0x28')](_0x431714,_0xca7b('0x25')),[_0xca7b('0x25')]);_0x3a76b4[_0xca7b('0x2f')]=_[_0xca7b('0x30')](_0x163226[_0xca7b('0x2f')]);_0x3a76b4['filters']=_['intersection'](_0x3a76b4['model'],_0x3a76b4['query']);_0x3fa904[_0xca7b('0x31')]=_[_0xca7b('0x32')](_0x3a76b4[_0xca7b('0x2d')],qs[_0xca7b('0x33')](_0x163226[_0xca7b('0x2f')][_0xca7b('0x33')]));_0x3fa904['attributes']=_0x3fa904[_0xca7b('0x31')][_0xca7b('0x34')]?_0x3fa904[_0xca7b('0x31')]:_0x3a76b4['model'];if(!_0x163226[_0xca7b('0x2f')][_0xca7b('0x35')]('nolimit')){_0x3fa904[_0xca7b('0x1c')]=qs[_0xca7b('0x1c')](_0x163226[_0xca7b('0x2f')][_0xca7b('0x1c')]);_0x3fa904[_0xca7b('0x1a')]=qs[_0xca7b('0x1a')](_0x163226[_0xca7b('0x2f')][_0xca7b('0x1a')]);}_0x3fa904[_0xca7b('0x36')]=qs['sort'](_0x163226[_0xca7b('0x2f')][_0xca7b('0x37')]);_0x3fa904[_0xca7b('0x38')]=qs[_0xca7b('0x39')](_['pick'](_0x163226['query'],_0x3a76b4['filters']),_0x431714);if(_0x163226['query']['filter']){_0x3fa904['where']=_['merge'](_0x3fa904[_0xca7b('0x38')],{'$or':_[_0xca7b('0x28')](_0x431714,function(_0x5430e9){if(_0x5430e9['type']!=='VIRTUAL'){var _0x1def74={};_0x1def74[_0x5430e9[_0xca7b('0x25')]]={'$like':'%'+_0x163226[_0xca7b('0x2f')]['filter']+'%'};return _0x1def74;}})});}_0x3fa904=_[_0xca7b('0x3a')]({},_0x3fa904,_0x163226[_0xca7b('0x3b')]);var _0x225132={'where':_0x3fa904['where']};return db[_0xca7b('0x29')][_0xca7b('0x3c')](_0x225132)[_0xca7b('0x23')](function(_0x46ebb0){_0x5a6e06['count']=_0x46ebb0;if(_0x163226['query'][_0xca7b('0x3d')]){_0x3fa904[_0xca7b('0x3e')]=[{'all':!![]}];}return db[_0xca7b('0x29')][_0xca7b('0x3f')](_0x3fa904);})[_0xca7b('0x23')](function(_0x36955f){_0x5a6e06[_0xca7b('0x40')]=_0x36955f;return _0x5a6e06;})[_0xca7b('0x23')](respondWithFilteredResult(_0x5b2968,_0x3fa904))[_0xca7b('0x41')](handleError(_0x5b2968,null));};exports[_0xca7b('0x42')]=function(_0x405fab,_0x34a9af){var _0x2e8540={'raw':!![],'where':{'id':_0x405fab['params']['id']}},_0x1fe819={};_0x1fe819[_0xca7b('0x2d')]=_[_0xca7b('0x30')](db[_0xca7b('0x29')][_0xca7b('0x2a')]);_0x1fe819['query']=_['keys'](_0x405fab[_0xca7b('0x2f')]);_0x1fe819[_0xca7b('0x39')]=_[_0xca7b('0x32')](_0x1fe819[_0xca7b('0x2d')],_0x1fe819[_0xca7b('0x2f')]);_0x2e8540[_0xca7b('0x31')]=_[_0xca7b('0x32')](_0x1fe819[_0xca7b('0x2d')],qs[_0xca7b('0x33')](_0x405fab[_0xca7b('0x2f')][_0xca7b('0x33')]));_0x2e8540[_0xca7b('0x31')]=_0x2e8540[_0xca7b('0x31')][_0xca7b('0x34')]?_0x2e8540['attributes']:_0x1fe819[_0xca7b('0x2d')];if(_0x405fab['query'][_0xca7b('0x3d')]){_0x2e8540[_0xca7b('0x3e')]=[{'all':!![]}];}_0x2e8540=_[_0xca7b('0x3a')]({},_0x2e8540,_0x405fab[_0xca7b('0x3b')]);return db['CmCustomField'][_0xca7b('0x43')](_0x2e8540)['then'](handleEntityNotFound(_0x34a9af,null))[_0xca7b('0x23')](respondWithResult(_0x34a9af,null))[_0xca7b('0x41')](handleError(_0x34a9af,null));};exports[_0xca7b('0x21')]=function(_0x27f5e2,_0xd06390){if(_0x27f5e2['body']['id']){delete _0x27f5e2[_0xca7b('0x44')]['id'];}return db[_0xca7b('0x29')][_0xca7b('0x43')]({'where':{'id':_0x27f5e2[_0xca7b('0x45')]['id']}})[_0xca7b('0x23')](handleEntityNotFound(_0xd06390,null))[_0xca7b('0x23')](saveUpdates(_0x27f5e2[_0xca7b('0x44')],null))[_0xca7b('0x23')](respondWithResult(_0xd06390,null))['catch'](handleError(_0xd06390,null));};exports[_0xca7b('0x22')]=function(_0x626221,_0x59e7e3){return db[_0xca7b('0x29')][_0xca7b('0x43')]({'where':{'id':_0x626221['params']['id']}})[_0xca7b('0x23')](handleEntityNotFound(_0x59e7e3,null))[_0xca7b('0x23')](removeEntity(_0x59e7e3,null))['catch'](handleError(_0x59e7e3,null));};exports[_0xca7b('0x46')]=function(_0x5d0b16,_0x1b9bca){var _0x362765;return db[_0xca7b('0x47')][_0xca7b('0x48')](function(_0x50ec6d){return db[_0xca7b('0x29')][_0xca7b('0x46')](_0x5d0b16['body'],{'transaction':_0x50ec6d})[_0xca7b('0x23')](function(_0x49eb1e){_0x362765=_0x49eb1e;var _0xa0678b={'type':db['Sequelize'][_0xca7b('0x49')],'transaction':_0x50ec6d};switch(_0x5d0b16['body'][_0xca7b('0x2b')]){case _0xca7b('0x4a'):_0xa0678b['type']=db[_0xca7b('0x4b')]['TEXT'];break;case _0xca7b('0x4c'):_0xa0678b['type']=db[_0xca7b('0x4b')][_0xca7b('0x4d')];break;case'switch':_0xa0678b[_0xca7b('0x2b')]=db[_0xca7b('0x4b')][_0xca7b('0x4e')];_0xa0678b[_0xca7b('0x4f')]=![];break;default:}return db[_0xca7b('0x47')][_0xca7b('0x50')][_0xca7b('0x51')](_0xca7b('0x52'),util[_0xca7b('0x53')](_0xca7b('0x54'),_0x362765['id']),_0xa0678b);})['then'](function(){return _0x362765;});})[_0xca7b('0x23')](respondWithResult(_0x1b9bca,0xc9))[_0xca7b('0x41')](handleError(_0x1b9bca,null));}; \ No newline at end of file +var _0x09a7=['findAll','rows','catch','show','params','includeAll','find','body','create','sequelize','transaction','Sequelize','TEXT','number','switch','BOOLEAN','defaultValue','queryInterface','addColumn','cm_contacts','format','cf_%d','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','save','update','then','destroy','stack','name','send','map','CmCustomField','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','include'];(function(_0x168272,_0x1a6e2c){var _0x178fa3=function(_0x474037){while(--_0x474037){_0x168272['push'](_0x168272['shift']());}};_0x178fa3(++_0x1a6e2c);}(_0x09a7,0x176));var _0x709a=function(_0x26ac57,_0x3b5ea6){_0x26ac57=_0x26ac57-0x0;var _0x4ca455=_0x09a7[_0x26ac57];return _0x4ca455;};'use strict';var emlformat=require(_0x709a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x709a('0x1'));var jsonpatch=require(_0x709a('0x2'));var rp=require(_0x709a('0x3'));var moment=require(_0x709a('0x4'));var BPromise=require(_0x709a('0x5'));var Mustache=require(_0x709a('0x6'));var util=require(_0x709a('0x7'));var path=require(_0x709a('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x709a('0x9'));var fs=require('fs');var fs_extra=require(_0x709a('0xa'));var _=require(_0x709a('0xb'));var squel=require(_0x709a('0xc'));var crypto=require(_0x709a('0xd'));var jsforce=require(_0x709a('0xe'));var deskjs=require(_0x709a('0xf'));var toCsv=require(_0x709a('0x10'));var querystring=require(_0x709a('0x11'));var Papa=require(_0x709a('0x12'));var Redis=require(_0x709a('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x709a('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x709a('0x15'))(_0x709a('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x709a('0x17'));var db=require(_0x709a('0x18'))['db'];function respondWithStatusCode(_0x4321c6,_0xabd59f){_0xabd59f=_0xabd59f||0xcc;return function(_0x4c9fa1){if(_0x4c9fa1){return _0x4321c6[_0x709a('0x19')](_0xabd59f);}return _0x4321c6[_0x709a('0x1a')](_0xabd59f)[_0x709a('0x1b')]();};}function respondWithResult(_0x3febfd,_0x591463){_0x591463=_0x591463||0xc8;return function(_0x22d13a){if(_0x22d13a){return _0x3febfd['status'](_0x591463)[_0x709a('0x1c')](_0x22d13a);}};}function respondWithFilteredResult(_0xe8c7eb,_0x5730e4){return function(_0x5825f3){if(_0x5825f3){var _0x4ffe89=typeof _0x5730e4[_0x709a('0x1d')]===_0x709a('0x1e')&&typeof _0x5730e4[_0x709a('0x1f')]===_0x709a('0x1e');var _0x3ca366=_0x5825f3[_0x709a('0x20')];var _0x16d739=_0x4ffe89?0x0:_0x5730e4[_0x709a('0x1d')];var _0x234f06=_0x4ffe89?_0x5825f3[_0x709a('0x20')]:_0x5730e4[_0x709a('0x1d')]+_0x5730e4['limit'];var _0xfcb93c;if(_0x234f06>=_0x3ca366){_0x234f06=_0x3ca366;_0xfcb93c=0xc8;}else{_0xfcb93c=0xce;}_0xe8c7eb[_0x709a('0x1a')](_0xfcb93c);return _0xe8c7eb['set'](_0x709a('0x21'),_0x16d739+'-'+_0x234f06+'/'+_0x3ca366)['json'](_0x5825f3);}return null;};}function patchUpdates(_0x2d0740){return function(_0x2950f6){try{jsonpatch[_0x709a('0x22')](_0x2950f6,_0x2d0740,!![]);}catch(_0x1f21e8){return BPromise['reject'](_0x1f21e8);}return _0x2950f6[_0x709a('0x23')]();};}function saveUpdates(_0x24ee36,_0x5d558b){return function(_0x26fc24){if(_0x26fc24){return _0x26fc24[_0x709a('0x24')](_0x24ee36)[_0x709a('0x25')](function(_0x2c3882){return _0x2c3882;});}return null;};}function removeEntity(_0x3ff44f,_0x5ec2c8){return function(_0x1026f1){if(_0x1026f1){return _0x1026f1[_0x709a('0x26')]()['then'](function(){_0x3ff44f['status'](0xcc)[_0x709a('0x1b')]();});}};}function handleEntityNotFound(_0x2c2926,_0x406f25){return function(_0x38f8e0){if(!_0x38f8e0){_0x2c2926[_0x709a('0x19')](0x194);}return _0x38f8e0;};}function handleError(_0x21e4b6,_0x510c58){_0x510c58=_0x510c58||0x1f4;return function(_0xd2edd0){logger['error'](_0xd2edd0[_0x709a('0x27')]);if(_0xd2edd0[_0x709a('0x28')]){delete _0xd2edd0[_0x709a('0x28')];}_0x21e4b6[_0x709a('0x1a')](_0x510c58)[_0x709a('0x29')](_0xd2edd0);};}exports['index']=function(_0x125502,_0x573db3){var _0x3d626a={},_0x1c7974={},_0x352e77={'count':0x0,'rows':[]};var _0x4e11e2=_[_0x709a('0x2a')](db[_0x709a('0x2b')][_0x709a('0x2c')],function(_0x5c1c49){return{'name':_0x5c1c49[_0x709a('0x2d')],'type':_0x5c1c49[_0x709a('0x2e')][_0x709a('0x2f')]};});_0x1c7974[_0x709a('0x30')]=_['differenceBy'](_[_0x709a('0x2a')](_0x4e11e2,_0x709a('0x28')),[_0x709a('0x28')]);_0x1c7974[_0x709a('0x31')]=_[_0x709a('0x32')](_0x125502['query']);_0x1c7974[_0x709a('0x33')]=_['intersection'](_0x1c7974[_0x709a('0x30')],_0x1c7974[_0x709a('0x31')]);_0x3d626a[_0x709a('0x34')]=_[_0x709a('0x35')](_0x1c7974[_0x709a('0x30')],qs['fields'](_0x125502[_0x709a('0x31')][_0x709a('0x36')]));_0x3d626a[_0x709a('0x34')]=_0x3d626a[_0x709a('0x34')][_0x709a('0x37')]?_0x3d626a[_0x709a('0x34')]:_0x1c7974['model'];if(!_0x125502[_0x709a('0x31')][_0x709a('0x38')]('nolimit')){_0x3d626a['limit']=qs[_0x709a('0x1f')](_0x125502[_0x709a('0x31')][_0x709a('0x1f')]);_0x3d626a[_0x709a('0x1d')]=qs['offset'](_0x125502[_0x709a('0x31')][_0x709a('0x1d')]);}_0x3d626a[_0x709a('0x39')]=qs['sort'](_0x125502['query'][_0x709a('0x3a')]);_0x3d626a[_0x709a('0x3b')]=qs[_0x709a('0x33')](_[_0x709a('0x3c')](_0x125502[_0x709a('0x31')],_0x1c7974[_0x709a('0x33')]),_0x4e11e2);if(_0x125502[_0x709a('0x31')][_0x709a('0x3d')]){_0x3d626a[_0x709a('0x3b')]=_[_0x709a('0x3e')](_0x3d626a[_0x709a('0x3b')],{'$or':_[_0x709a('0x2a')](_0x4e11e2,function(_0x48746f){if(_0x48746f[_0x709a('0x2e')]!==_0x709a('0x3f')){var _0x37a252={};_0x37a252[_0x48746f[_0x709a('0x28')]]={'$like':'%'+_0x125502[_0x709a('0x31')][_0x709a('0x3d')]+'%'};return _0x37a252;}})});}_0x3d626a=_[_0x709a('0x3e')]({},_0x3d626a,_0x125502[_0x709a('0x40')]);var _0x32a5be={'where':_0x3d626a[_0x709a('0x3b')]};return db[_0x709a('0x2b')][_0x709a('0x20')](_0x32a5be)[_0x709a('0x25')](function(_0x1685d0){_0x352e77[_0x709a('0x20')]=_0x1685d0;if(_0x125502['query']['includeAll']){_0x3d626a[_0x709a('0x41')]=[{'all':!![]}];}return db[_0x709a('0x2b')][_0x709a('0x42')](_0x3d626a);})[_0x709a('0x25')](function(_0x5e670c){_0x352e77[_0x709a('0x43')]=_0x5e670c;return _0x352e77;})[_0x709a('0x25')](respondWithFilteredResult(_0x573db3,_0x3d626a))[_0x709a('0x44')](handleError(_0x573db3,null));};exports[_0x709a('0x45')]=function(_0x4db7b2,_0x3afd32){var _0x540803={'raw':!![],'where':{'id':_0x4db7b2[_0x709a('0x46')]['id']}},_0x5fd786={};_0x5fd786[_0x709a('0x30')]=_[_0x709a('0x32')](db[_0x709a('0x2b')][_0x709a('0x2c')]);_0x5fd786['query']=_[_0x709a('0x32')](_0x4db7b2[_0x709a('0x31')]);_0x5fd786[_0x709a('0x33')]=_[_0x709a('0x35')](_0x5fd786[_0x709a('0x30')],_0x5fd786[_0x709a('0x31')]);_0x540803[_0x709a('0x34')]=_[_0x709a('0x35')](_0x5fd786[_0x709a('0x30')],qs[_0x709a('0x36')](_0x4db7b2[_0x709a('0x31')]['fields']));_0x540803['attributes']=_0x540803[_0x709a('0x34')][_0x709a('0x37')]?_0x540803['attributes']:_0x5fd786[_0x709a('0x30')];if(_0x4db7b2[_0x709a('0x31')][_0x709a('0x47')]){_0x540803[_0x709a('0x41')]=[{'all':!![]}];}_0x540803=_[_0x709a('0x3e')]({},_0x540803,_0x4db7b2[_0x709a('0x40')]);return db[_0x709a('0x2b')][_0x709a('0x48')](_0x540803)['then'](handleEntityNotFound(_0x3afd32,null))[_0x709a('0x25')](respondWithResult(_0x3afd32,null))[_0x709a('0x44')](handleError(_0x3afd32,null));};exports['update']=function(_0x1adf38,_0x4f82a7){if(_0x1adf38[_0x709a('0x49')]['id']){delete _0x1adf38[_0x709a('0x49')]['id'];}return db['CmCustomField']['find']({'where':{'id':_0x1adf38[_0x709a('0x46')]['id']}})[_0x709a('0x25')](handleEntityNotFound(_0x4f82a7,null))[_0x709a('0x25')](saveUpdates(_0x1adf38[_0x709a('0x49')],null))[_0x709a('0x25')](respondWithResult(_0x4f82a7,null))['catch'](handleError(_0x4f82a7,null));};exports['destroy']=function(_0x5ab8f8,_0x515cc3){return db[_0x709a('0x2b')][_0x709a('0x48')]({'where':{'id':_0x5ab8f8[_0x709a('0x46')]['id']}})[_0x709a('0x25')](handleEntityNotFound(_0x515cc3,null))[_0x709a('0x25')](removeEntity(_0x515cc3,null))[_0x709a('0x44')](handleError(_0x515cc3,null));};exports[_0x709a('0x4a')]=function(_0x4815c7,_0x237b96){var _0x35395e;return db[_0x709a('0x4b')][_0x709a('0x4c')](function(_0x52c3c5){return db[_0x709a('0x2b')][_0x709a('0x4a')](_0x4815c7[_0x709a('0x49')],{'transaction':_0x52c3c5})['then'](function(_0x313fb4){_0x35395e=_0x313fb4;var _0x5c9e9e={'type':db[_0x709a('0x4d')][_0x709a('0x4e')],'transaction':_0x52c3c5};switch(_0x4815c7[_0x709a('0x49')]['type']){case'text':_0x5c9e9e['type']=db[_0x709a('0x4d')][_0x709a('0x4e')];break;case _0x709a('0x4f'):_0x5c9e9e[_0x709a('0x2e')]=db[_0x709a('0x4d')]['INTEGER'];break;case _0x709a('0x50'):_0x5c9e9e['type']=db['Sequelize'][_0x709a('0x51')];_0x5c9e9e[_0x709a('0x52')]=![];break;default:}return db[_0x709a('0x4b')][_0x709a('0x53')][_0x709a('0x54')](_0x709a('0x55'),util[_0x709a('0x56')](_0x709a('0x57'),_0x35395e['id']),_0x5c9e9e);})['then'](function(){return _0x35395e;});})[_0x709a('0x25')](respondWithResult(_0x237b96,0xc9))['catch'](handleError(_0x237b96,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index cc993aa..3029b04 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 _0x9290=['define','CmCustomField','cm_custom_fields','lodash','util','../../config/logger','api','bluebird','request-promise','path','./cmCustomField.attributes','exports'];(function(_0x2003ca,_0x327d9b){var _0xeaa6c9=function(_0x707dd5){while(--_0x707dd5){_0x2003ca['push'](_0x2003ca['shift']());}};_0xeaa6c9(++_0x327d9b);}(_0x9290,0x117));var _0x0929=function(_0x210718,_0x247b55){_0x210718=_0x210718-0x0;var _0x541bfc=_0x9290[_0x210718];return _0x541bfc;};'use strict';var _=require(_0x0929('0x0'));var util=require(_0x0929('0x1'));var logger=require(_0x0929('0x2'))(_0x0929('0x3'));var moment=require('moment');var BPromise=require(_0x0929('0x4'));var rp=require(_0x0929('0x5'));var fs=require('fs');var path=require(_0x0929('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x0929('0x7'));module[_0x0929('0x8')]=function(_0x12f527,_0x24adcb){return _0x12f527[_0x0929('0x9')](_0x0929('0xa'),attributes,{'tableName':_0x0929('0xb'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x79c3=['request-promise','../../config/environment','./cmCustomField.attributes','exports','define','CmCustomField','lodash','util','../../config/logger','moment'];(function(_0x28e9d4,_0x2dcb17){var _0x3e9390=function(_0x50dde8){while(--_0x50dde8){_0x28e9d4['push'](_0x28e9d4['shift']());}};_0x3e9390(++_0x2dcb17);}(_0x79c3,0x9c));var _0x379c=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x79c3[_0x5b644e];return _0x49c6bf;};'use strict';var _=require(_0x379c('0x0'));var util=require(_0x379c('0x1'));var logger=require(_0x379c('0x2'))('api');var moment=require(_0x379c('0x3'));var BPromise=require('bluebird');var rp=require(_0x379c('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x379c('0x5'));var attributes=require(_0x379c('0x6'));module[_0x379c('0x7')]=function(_0x26c02a,_0x1ca193){return _0x26c02a[_0x379c('0x8')](_0x379c('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 6b1dd9e..060cd3c 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 _0xafec=['debug','request\x20sent','error','code','CmCustomField,\x20%s,\x20%s','message','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','then'];(function(_0x4c666f,_0x39fbdb){var _0x565d46=function(_0x54cb30){while(--_0x54cb30){_0x4c666f['push'](_0x4c666f['shift']());}};_0x565d46(++_0x39fbdb);}(_0xafec,0x86));var _0xcafe=function(_0x4f3412,_0xd570b7){_0x4f3412=_0x4f3412-0x0;var _0x4231e4=_0xafec[_0x4f3412];return _0x4231e4;};'use strict';var _=require(_0xcafe('0x0'));var util=require(_0xcafe('0x1'));var moment=require(_0xcafe('0x2'));var BPromise=require(_0xcafe('0x3'));var rs=require(_0xcafe('0x4'));var fs=require('fs');var Redis=require(_0xcafe('0x5'));var db=require(_0xcafe('0x6'))['db'];var utils=require(_0xcafe('0x7'));var logger=require('../../config/logger')(_0xcafe('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x38c477,_0x3c1ce7,_0x3cdedc){return new BPromise(function(_0x20286d,_0x1cdc1f){return client['request'](_0x38c477,_0x3cdedc)[_0xcafe('0x9')](function(_0x5dfa8b){logger['info']('CmCustomField,\x20%s,\x20%s',_0x3c1ce7,'request\x20sent');logger[_0xcafe('0xa')]('CmCustomField,\x20%s,\x20%s,\x20%s',_0x3c1ce7,_0xcafe('0xb'),JSON['stringify'](_0x5dfa8b));if(_0x5dfa8b[_0xcafe('0xc')]){if(_0x5dfa8b[_0xcafe('0xc')][_0xcafe('0xd')]===0x1f4){logger[_0xcafe('0xc')](_0xcafe('0xe'),_0x3c1ce7,_0x5dfa8b[_0xcafe('0xc')]['message']);return _0x1cdc1f(_0x5dfa8b[_0xcafe('0xc')][_0xcafe('0xf')]);}logger[_0xcafe('0xc')]('CmCustomField,\x20%s,\x20%s',_0x3c1ce7,_0x5dfa8b['error']['message']);return _0x20286d(_0x5dfa8b['error'][_0xcafe('0xf')]);}else{logger['info'](_0xcafe('0xe'),_0x3c1ce7,'request\x20sent');_0x20286d(_0x5dfa8b['result'][_0xcafe('0xf')]);}})['catch'](function(_0x17ee16){logger[_0xcafe('0xc')](_0xcafe('0xe'),_0x3c1ce7,_0x17ee16);_0x1cdc1f(_0x17ee16);});});} \ No newline at end of file +var _0x7659=['moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','CmCustomField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','util'];(function(_0x334841,_0x2bbc4c){var _0x5beb4b=function(_0x4bea72){while(--_0x4bea72){_0x334841['push'](_0x334841['shift']());}};_0x5beb4b(++_0x2bbc4c);}(_0x7659,0xc7));var _0x9765=function(_0x30c5fa,_0x432824){_0x30c5fa=_0x30c5fa-0x0;var _0x5aa188=_0x7659[_0x30c5fa];return _0x5aa188;};'use strict';var _=require('lodash');var util=require(_0x9765('0x0'));var moment=require(_0x9765('0x1'));var BPromise=require(_0x9765('0x2'));var rs=require(_0x9765('0x3'));var fs=require('fs');var Redis=require(_0x9765('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x9765('0x5'));var logger=require('../../config/logger')(_0x9765('0x6'));var config=require(_0x9765('0x7'));var jayson=require(_0x9765('0x8'));var client=jayson[_0x9765('0x9')][_0x9765('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x571aa1,_0x2529d6,_0x333f9d){return new BPromise(function(_0x4ee19b,_0x34ed9d){return client[_0x9765('0xb')](_0x571aa1,_0x333f9d)[_0x9765('0xc')](function(_0x4cf69c){logger[_0x9765('0xd')](_0x9765('0xe'),_0x2529d6,_0x9765('0xf'));logger[_0x9765('0x10')]('CmCustomField,\x20%s,\x20%s,\x20%s',_0x2529d6,_0x9765('0xf'),JSON[_0x9765('0x11')](_0x4cf69c));if(_0x4cf69c[_0x9765('0x12')]){if(_0x4cf69c['error']['code']===0x1f4){logger[_0x9765('0x12')](_0x9765('0xe'),_0x2529d6,_0x4cf69c[_0x9765('0x12')][_0x9765('0x13')]);return _0x34ed9d(_0x4cf69c[_0x9765('0x12')][_0x9765('0x13')]);}logger['error'](_0x9765('0xe'),_0x2529d6,_0x4cf69c[_0x9765('0x12')][_0x9765('0x13')]);return _0x4ee19b(_0x4cf69c['error'][_0x9765('0x13')]);}else{logger['info'](_0x9765('0xe'),_0x2529d6,_0x9765('0xf'));_0x4ee19b(_0x4cf69c['result'][_0x9765('0x13')]);}})['catch'](function(_0x5eee31){logger[_0x9765('0x12')](_0x9765('0xe'),_0x2529d6,_0x5eee31);_0x34ed9d(_0x5eee31);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index 5a2989f..34ffe2b 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 _0xdd41=['update','delete','exports','multer','util','path','connect-timeout','Router','fs-extra','../../config/environment','./cmCustomField.controller','isAuthenticated','index','/:id','create'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdd41,0x1f2));var _0x1dd4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xdd41[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x1dd4('0x0'));var util=require(_0x1dd4('0x1'));var path=require(_0x1dd4('0x2'));var timeout=require(_0x1dd4('0x3'));var express=require('express');var router=express[_0x1dd4('0x4')]();var fs_extra=require(_0x1dd4('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x1dd4('0x6'));var controller=require(_0x1dd4('0x7'));router['get']('/',auth[_0x1dd4('0x8')](),controller[_0x1dd4('0x9')]);router['get'](_0x1dd4('0xa'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x1dd4('0xb')]);router['put'](_0x1dd4('0xa'),auth[_0x1dd4('0x8')](),controller[_0x1dd4('0xc')]);router[_0x1dd4('0xd')]('/:id',auth[_0x1dd4('0x8')](),controller['destroy']);module[_0x1dd4('0xe')]=router; \ No newline at end of file +var _0x03e2=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','post','put','update','delete','destroy','exports','util','path','connect-timeout','express'];(function(_0x2cbf22,_0x674af7){var _0x228403=function(_0x39156c){while(--_0x39156c){_0x2cbf22['push'](_0x2cbf22['shift']());}};_0x228403(++_0x674af7);}(_0x03e2,0x119));var _0x203e=function(_0x1a0738,_0x584dc5){_0x1a0738=_0x1a0738-0x0;var _0x4f9ef3=_0x03e2[_0x1a0738];return _0x4f9ef3;};'use strict';var multer=require('multer');var util=require(_0x203e('0x0'));var path=require(_0x203e('0x1'));var timeout=require(_0x203e('0x2'));var express=require(_0x203e('0x3'));var router=express[_0x203e('0x4')]();var fs_extra=require(_0x203e('0x5'));var auth=require(_0x203e('0x6'));var interaction=require(_0x203e('0x7'));var config=require(_0x203e('0x8'));var controller=require('./cmCustomField.controller');router[_0x203e('0x9')]('/',auth[_0x203e('0xa')](),controller['index']);router[_0x203e('0x9')](_0x203e('0xb'),auth['isAuthenticated'](),controller[_0x203e('0xc')]);router[_0x203e('0xd')]('/',auth[_0x203e('0xa')](),controller['create']);router[_0x203e('0xe')](_0x203e('0xb'),auth[_0x203e('0xa')](),controller[_0x203e('0xf')]);router[_0x203e('0x10')]('/:id',auth[_0x203e('0xa')](),controller[_0x203e('0x11')]);module[_0x203e('0x12')]=router; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.attributes.js b/server/api/cmHopper/cmHopper.attributes.js index 81f017b..fbf8246 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 _0x4141=['INTEGER','BOOLEAN','UNSIGNED','contactListQueue','moment','sequelize','STRING','DATE'];(function(_0x2046dd,_0x40a9ab){var _0x2eb055=function(_0x1c65e8){while(--_0x1c65e8){_0x2046dd['push'](_0x2046dd['shift']());}};_0x2eb055(++_0x40a9ab);}(_0x4141,0x1f4));var _0x1414=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x4141[_0x57b54c];return _0x59cc19;};'use strict';var moment=require(_0x1414('0x0'));var Sequelize=require(_0x1414('0x1'));module['exports']={'phone':{'type':Sequelize[_0x1414('0x2')],'allowNull':![]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0x1414('0x3')],'defaultValue':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')},'countbusyretry':{'type':Sequelize[_0x1414('0x4')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x1414('0x4')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x1414('0x4')],'defaultValue':0x0},'callback':{'type':Sequelize[_0x1414('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x1414('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'priority':{'type':Sequelize['INTEGER'](0x2)[_0x1414('0x6')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0x1414('0x5')],'defaultValue':![]},'ContactId':{'type':Sequelize['INTEGER'],'unique':_0x1414('0x7')},'ListId':{'type':Sequelize[_0x1414('0x4')],'unique':_0x1414('0x7')},'UserId':{'type':Sequelize['INTEGER']},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':_0x1414('0x7')},'CampaignId':{'type':Sequelize['INTEGER']},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x1414('0x4')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x1414('0x4')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x1414('0x4')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'OrderBy':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x1414('0x2')]},'recallmeNotifiedDate':{'type':Sequelize[_0x1414('0x3')],'allowNull':!![],'defaultValue':null}}; \ No newline at end of file +var _0x8b84=['YYYY-MM-DD\x20HH:mm:ss','INTEGER','BOOLEAN','DATE','UNSIGNED','contactListQueue','moment','sequelize','STRING','format'];(function(_0x193096,_0x1a2447){var _0x3b3308=function(_0x5a8ae7){while(--_0x5a8ae7){_0x193096['push'](_0x193096['shift']());}};_0x3b3308(++_0x1a2447);}(_0x8b84,0x196));var _0x48b8=function(_0x13b02f,_0x462a53){_0x13b02f=_0x13b02f-0x0;var _0x12e9a6=_0x8b84[_0x13b02f];return _0x12e9a6;};'use strict';var moment=require(_0x48b8('0x0'));var Sequelize=require(_0x48b8('0x1'));module['exports']={'phone':{'type':Sequelize[_0x48b8('0x2')],'allowNull':![]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':moment()[_0x48b8('0x3')](_0x48b8('0x4'))},'countbusyretry':{'type':Sequelize[_0x48b8('0x5')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x48b8('0x5')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x48b8('0x5')],'defaultValue':0x0},'callback':{'type':Sequelize[_0x48b8('0x6')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x48b8('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x48b8('0x7')]},'priority':{'type':Sequelize[_0x48b8('0x5')](0x2)[_0x48b8('0x8')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0x48b8('0x6')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0x48b8('0x5')],'unique':_0x48b8('0x9')},'ListId':{'type':Sequelize[_0x48b8('0x5')],'unique':'contactListQueue'},'UserId':{'type':Sequelize[_0x48b8('0x5')]},'VoiceQueueId':{'type':Sequelize[_0x48b8('0x5')],'unique':_0x48b8('0x9')},'CampaignId':{'type':Sequelize[_0x48b8('0x5')]},'countnosuchnumberretry':{'type':Sequelize[_0x48b8('0x5')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x48b8('0x5')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x48b8('0x5')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x48b8('0x5')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x48b8('0x5')],'defaultValue':0x0},'OrderBy':{'type':Sequelize[_0x48b8('0x5')],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize['STRING']},'recallmeNotifiedDate':{'type':Sequelize[_0x48b8('0x7')],'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 431f80a..722c41e 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 _0xab86=['calleridname','finally','CmHopperFinal','CmHopperAdditionalPhone','end','getPreview','CmContact','getVoiceQueues','outbound','preview','dialPreviewAutoRecallMe','value','direction','prev','isEmpty','hopperIds','ASC','scheduledAt','sequelize','literal','priority','DESC','dialOrderByScheduledAt','COALESCE(CmHopper.UserId,\x200)\x20DESC','scheduledat','phone','recallme','LOCK','UPDATE','Contact','CmCompany','CmList','List','Queue','update','getPreviewRecall','transaction','findOne','Company','dialActive','getOpenContacts','isNumber','CmHopper,\x20%s,\x20%s,\x20%s','timezones','push','utcOffset','moment','lodash','../../components/parsers/qs','../../config/environment','status','json','offset','undefined','limit','count','set','Content-Range','then','sendStatus','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','filters','intersection','$and','$or','$gte','$lt','$lte','$ne','$eq','$not','$between','$notBetween','$like','$iLike','$notILike','$any','attributes','fields','length','order','sort','where','pick','filter','VIRTUAL','merge','CmHopper','includeAll','findAll','rows','catch','show','keys','include','options','find','create','body','params','describe','destroy','VoiceQueueId','CampaignId','VoiceQueue','Campaign','omit','dataValues','createdAt','updatedAt','state','statedesc','campaign','user','UserId','deleted','deletedat','format','YYYY-MM-DD\x20HH:mm:ss','calleridnum','campaigntype','queue','ivr','ContactId','firstName','lastName','isNil'];(function(_0xa20086,_0x3978a9){var _0x121c6e=function(_0x16a848){while(--_0x16a848){_0xa20086['push'](_0xa20086['shift']());}};_0x121c6e(++_0x3978a9);}(_0xab86,0x13e));var _0x6ab8=function(_0xf3b525,_0x419b48){_0xf3b525=_0xf3b525-0x0;var _0x1f98b3=_0xab86[_0xf3b525];return _0x1f98b3;};'use strict';var moment=require(_0x6ab8('0x0'));var _=require(_0x6ab8('0x1'));var qs=require(_0x6ab8('0x2'));var logger=require('../../config/logger')('api');var shared=require(_0x6ab8('0x3'));var db=require('../../mysqldb')['db'];function respondWithResult(_0x1193a1,_0x48cb6a){_0x48cb6a=_0x48cb6a||0xc8;return function(_0xf27ba7){if(_0xf27ba7){return _0x1193a1[_0x6ab8('0x4')](_0x48cb6a)[_0x6ab8('0x5')](_0xf27ba7);}};}function respondWithFilteredResult(_0x154d17,_0x6f41f){return function(_0x265771){if(_0x265771){var _0x2b6295=typeof _0x6f41f[_0x6ab8('0x6')]===_0x6ab8('0x7')&&typeof _0x6f41f[_0x6ab8('0x8')]===_0x6ab8('0x7');var _0x20f27b=_0x265771[_0x6ab8('0x9')];var _0x5127eb=_0x2b6295?0x0:_0x6f41f['offset'];var _0x383594=_0x2b6295?_0x265771['count']:_0x6f41f[_0x6ab8('0x6')]+_0x6f41f[_0x6ab8('0x8')];var _0x139c0f;if(_0x383594>=_0x20f27b){_0x383594=_0x20f27b;_0x139c0f=0xc8;}else{_0x139c0f=0xce;}_0x154d17['status'](_0x139c0f);return _0x154d17[_0x6ab8('0xa')](_0x6ab8('0xb'),_0x5127eb+'-'+_0x383594+'/'+_0x20f27b)['json'](_0x265771);}return null;};}function saveUpdates(_0x44d1d9,_0x1b9b34){return function(_0x408ce1){if(_0x408ce1){return _0x408ce1['update'](_0x44d1d9)[_0x6ab8('0xc')](function(_0x42b74e){return _0x42b74e;});}return null;};}function handleEntityNotFound(_0x60b50,_0x968bac){return function(_0x1c83a1){if(!_0x1c83a1){_0x60b50[_0x6ab8('0xd')](0x194);}return _0x1c83a1;};}function handleError(_0x1c6402,_0x2043bb){_0x2043bb=_0x2043bb||0x1f4;return function(_0x293389){logger['error'](_0x293389[_0x6ab8('0xe')]);if(_0x293389[_0x6ab8('0xf')]){delete _0x293389[_0x6ab8('0xf')];}_0x1c6402['status'](_0x2043bb)[_0x6ab8('0x10')](_0x293389);};}exports[_0x6ab8('0x11')]=function(_0x50cd9f,_0x543726){var _0x35e92f={},_0x57cd18={},_0x41792d={'count':0x0,'rows':[]};var _0x292b36=_[_0x6ab8('0x12')](db['CmHopper'][_0x6ab8('0x13')],function(_0x3de5b3){return{'name':_0x3de5b3[_0x6ab8('0x14')],'type':_0x3de5b3[_0x6ab8('0x15')]['key']};});_0x57cd18[_0x6ab8('0x16')]=_[_0x6ab8('0x12')](_0x292b36,'name');_0x57cd18['query']=_['keys'](_0x50cd9f[_0x6ab8('0x17')]);_0x57cd18[_0x6ab8('0x18')]=_[_0x6ab8('0x19')](_0x57cd18['model'],_0x57cd18[_0x6ab8('0x17')]);_0x57cd18[_0x6ab8('0x18')]=_['concat'](_0x57cd18['filters'],[_0x6ab8('0x1a'),_0x6ab8('0x1b'),'$gt',_0x6ab8('0x1c'),_0x6ab8('0x1d'),_0x6ab8('0x1e'),_0x6ab8('0x1f'),_0x6ab8('0x20'),_0x6ab8('0x21'),_0x6ab8('0x22'),_0x6ab8('0x23'),'$in','$notIn',_0x6ab8('0x24'),'$notLike',_0x6ab8('0x25'),_0x6ab8('0x26'),_0x6ab8('0x24'),'$overlap','$contains','$contained',_0x6ab8('0x27')]);_0x35e92f[_0x6ab8('0x28')]=_[_0x6ab8('0x19')](_0x57cd18[_0x6ab8('0x16')],qs[_0x6ab8('0x29')](_0x50cd9f[_0x6ab8('0x17')][_0x6ab8('0x29')]));_0x35e92f[_0x6ab8('0x28')]=_0x35e92f[_0x6ab8('0x28')][_0x6ab8('0x2a')]?_0x35e92f[_0x6ab8('0x28')]:_0x57cd18[_0x6ab8('0x16')];if(!_0x50cd9f[_0x6ab8('0x17')]['hasOwnProperty']('nolimit')){_0x35e92f[_0x6ab8('0x8')]=qs['limit'](_0x50cd9f['query'][_0x6ab8('0x8')]);_0x35e92f[_0x6ab8('0x6')]=qs['offset'](_0x50cd9f[_0x6ab8('0x17')]['offset']);}_0x35e92f[_0x6ab8('0x2b')]=qs[_0x6ab8('0x2c')](_0x50cd9f['query']['sort']);_0x35e92f[_0x6ab8('0x2d')]=qs[_0x6ab8('0x18')](_[_0x6ab8('0x2e')](_0x50cd9f[_0x6ab8('0x17')],_0x57cd18[_0x6ab8('0x18')]),_0x292b36);if(_0x50cd9f[_0x6ab8('0x17')][_0x6ab8('0x2f')]){_0x35e92f[_0x6ab8('0x2d')]=_['merge'](_0x35e92f[_0x6ab8('0x2d')],{'$or':_[_0x6ab8('0x12')](_0x292b36,function(_0x3e6761){if(_0x3e6761[_0x6ab8('0x15')]!==_0x6ab8('0x30')){var _0x26f699={};_0x26f699[_0x3e6761['name']]={'$like':'%'+_0x50cd9f[_0x6ab8('0x17')][_0x6ab8('0x2f')]+'%'};return _0x26f699;}})});}_0x35e92f=_[_0x6ab8('0x31')]({},_0x35e92f,_0x50cd9f['options']);var _0x51111d={'where':_0x35e92f[_0x6ab8('0x2d')]};return db[_0x6ab8('0x32')][_0x6ab8('0x9')](_0x51111d)[_0x6ab8('0xc')](function(_0x14fdc5){_0x41792d['count']=_0x14fdc5;if(_0x50cd9f['query'][_0x6ab8('0x33')]){_0x35e92f['include']=[{'all':!![]}];}return db[_0x6ab8('0x32')][_0x6ab8('0x34')](_0x35e92f);})['then'](function(_0x47c9f9){_0x41792d[_0x6ab8('0x35')]=_0x47c9f9;return _0x41792d;})[_0x6ab8('0xc')](respondWithFilteredResult(_0x543726,_0x35e92f))[_0x6ab8('0x36')](handleError(_0x543726,null));};exports[_0x6ab8('0x37')]=function(_0x2e7fc9,_0x319ada){var _0xef0ce5={'raw':!![],'where':{'id':_0x2e7fc9['params']['id']}},_0x5aa6e5={};_0x5aa6e5[_0x6ab8('0x16')]=_[_0x6ab8('0x38')](db[_0x6ab8('0x32')][_0x6ab8('0x13')]);_0x5aa6e5['query']=_[_0x6ab8('0x38')](_0x2e7fc9['query']);_0x5aa6e5['filters']=_[_0x6ab8('0x19')](_0x5aa6e5[_0x6ab8('0x16')],_0x5aa6e5[_0x6ab8('0x17')]);_0xef0ce5[_0x6ab8('0x28')]=_[_0x6ab8('0x19')](_0x5aa6e5[_0x6ab8('0x16')],qs[_0x6ab8('0x29')](_0x2e7fc9[_0x6ab8('0x17')][_0x6ab8('0x29')]));_0xef0ce5[_0x6ab8('0x28')]=_0xef0ce5[_0x6ab8('0x28')][_0x6ab8('0x2a')]?_0xef0ce5['attributes']:_0x5aa6e5[_0x6ab8('0x16')];if(_0x2e7fc9[_0x6ab8('0x17')][_0x6ab8('0x33')]){_0xef0ce5[_0x6ab8('0x39')]=[{'all':!![]}];}_0xef0ce5=_['merge']({},_0xef0ce5,_0x2e7fc9[_0x6ab8('0x3a')]);return db['CmHopper'][_0x6ab8('0x3b')](_0xef0ce5)[_0x6ab8('0xc')](handleEntityNotFound(_0x319ada,null))['then'](respondWithResult(_0x319ada,null))[_0x6ab8('0x36')](handleError(_0x319ada,null));};exports[_0x6ab8('0x3c')]=function(_0x4b6593,_0x328a19){return db[_0x6ab8('0x32')][_0x6ab8('0x3c')](_0x4b6593[_0x6ab8('0x3d')],{})[_0x6ab8('0xc')](respondWithResult(_0x328a19,0xc9))['catch'](handleError(_0x328a19,null));};exports['update']=function(_0x51a764,_0x408886){if(_0x51a764[_0x6ab8('0x3d')]['id']){delete _0x51a764['body']['id'];}return db[_0x6ab8('0x32')][_0x6ab8('0x3b')]({'where':{'id':_0x51a764[_0x6ab8('0x3e')]['id']}})[_0x6ab8('0xc')](handleEntityNotFound(_0x408886,null))[_0x6ab8('0xc')](saveUpdates(_0x51a764[_0x6ab8('0x3d')],null))['then'](respondWithResult(_0x408886,null))[_0x6ab8('0x36')](handleError(_0x408886,null));};exports[_0x6ab8('0x3f')]=function(_0x4b00cc,_0x266026){return db[_0x6ab8('0x32')][_0x6ab8('0x3f')]()['then'](respondWithResult(_0x266026,null))['catch'](handleError(_0x266026,null));};exports[_0x6ab8('0x40')]=function(_0x4c27fa,_0x31965e){var _0x5270c3;var _0x214b8e=_0x4c27fa[_0x6ab8('0x3e')]['id'];return db[_0x6ab8('0x32')][_0x6ab8('0x3b')]({'where':{'id':_0x4c27fa[_0x6ab8('0x3e')]['id']}})[_0x6ab8('0xc')](handleEntityNotFound(_0x31965e,null))['then'](function(_0x5e63ec){if(_0x5e63ec){return _0x5e63ec['destroy']()[_0x6ab8('0xc')](function(_0x54708b){return _0x54708b;});}})[_0x6ab8('0xc')](function(_0x3cacb8){_0x5270c3=_0x3cacb8;if(_0x3cacb8){if(_0x3cacb8[_0x6ab8('0x41')]||_0x3cacb8[_0x6ab8('0x42')]){return db[_0x3cacb8[_0x6ab8('0x41')]?_0x6ab8('0x43'):_0x6ab8('0x44')][_0x6ab8('0x3b')]({'where':{'id':_0x3cacb8['VoiceQueueId']?_0x3cacb8[_0x6ab8('0x41')]:_0x3cacb8[_0x6ab8('0x42')]},'attributes':['id',_0x6ab8('0xf')],'raw':!![]});}}})[_0x6ab8('0xc')](function(_0x5af74c){var _0x619b55={};if(_0x5af74c){_[_0x6ab8('0x31')](_0x619b55,_[_0x6ab8('0x45')](_0x5270c3[_0x6ab8('0x46')],[_0x6ab8('0x47'),_0x6ab8('0x48'),'id']));_0x619b55[_0x6ab8('0x49')]=0x15;_0x619b55[_0x6ab8('0x4a')]='deleted';_0x619b55[_0x6ab8('0x4b')]=_0x5af74c[_0x6ab8('0xf')];_0x619b55['membername']=_0x4c27fa[_0x6ab8('0x4c')][_0x6ab8('0xf')];_0x619b55[_0x6ab8('0x4d')]=_0x4c27fa[_0x6ab8('0x4c')]['id'];_0x619b55[_0x6ab8('0x4e')]=!![];_0x619b55[_0x6ab8('0x4f')]=moment()[_0x6ab8('0x50')](_0x6ab8('0x51'));_0x619b55[_0x6ab8('0x52')]=_0x5270c3['phone'];_0x619b55[_0x6ab8('0x53')]=_0x5270c3[_0x6ab8('0x41')]?_0x6ab8('0x54'):_0x6ab8('0x55');return db['CmContact']['find']({'where':{'id':_0x619b55[_0x6ab8('0x56')]},'attributes':[_0x6ab8('0x57'),_0x6ab8('0x58')]})[_0x6ab8('0xc')](function(_0x17afee){if(!_[_0x6ab8('0x59')](_0x31965e)&&!_[_0x6ab8('0x59')](_0x17afee[_0x6ab8('0x57')])){_0x619b55[_0x6ab8('0x5a')]=_0x17afee[_0x6ab8('0x57')];if(!_['isNil'](_0x17afee['lastName'])){_0x619b55['calleridname']+='\x20'+_0x17afee[_0x6ab8('0x58')];}}})[_0x6ab8('0x5b')](function(){return db[_0x6ab8('0x5c')]['create'](_0x619b55);});}})[_0x6ab8('0xc')](function(_0x399537){return db[_0x6ab8('0x5d')][_0x6ab8('0x40')]({'where':{'CmHopperId':_0x214b8e}});})[_0x6ab8('0xc')](function(){return _0x31965e['status'](0xcc)[_0x6ab8('0x5e')]();})['catch'](handleError(_0x31965e,null));};exports[_0x6ab8('0x5f')]=function(_0x209d12,_0x2ea704){var _0x5ab635=[];return db[_0x6ab8('0x60')][_0x6ab8('0x3f')]()[_0x6ab8('0xc')](function(_0xd4519c){_0x5ab635=_['keys'](_0xd4519c);return _0x209d12[_0x6ab8('0x4c')][_0x6ab8('0x61')]({'where':{'type':_0x6ab8('0x62'),'dialActive':!![],'dialMethod':_0x6ab8('0x63')},'attributes':['id','dialOrderByScheduledAt',_0x6ab8('0x64')],'raw':!![]});})[_0x6ab8('0xc')](function(_0x4c5cee){if(_0x4c5cee&&_0x4c5cee[_0x6ab8('0x2a')]){return db['sequelize']['transaction'](function(_0x35da58){var _0x3d81d3={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x6ab8('0x50')](_0x6ab8('0x51'))},'VoiceQueueId':{'$in':_['map'](_0x4c5cee,'id')},'$or':[{'UserId':null},{'UserId':_0x209d12[_0x6ab8('0x4c')]['id']}]};var _0x47fbcb={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x4c5cee)[_0x6ab8('0x2f')]([_0x6ab8('0x64'),0x0])[_0x6ab8('0x12')]('id')[_0x6ab8('0x65')]()},'$or':[{'UserId':null},{'UserId':_0x209d12[_0x6ab8('0x4c')]['id']}]};var _0x2af78f={'$or':[_0x3d81d3,_0x47fbcb]};var _0x2cde24=[];if(_0x209d12['body'][_0x6ab8('0x66')]&&_0x209d12['body'][_0x6ab8('0x66')]===_0x6ab8('0x67')){if(!_[_0x6ab8('0x68')](_0x209d12[_0x6ab8('0x3d')][_0x6ab8('0x69')])){_0x2af78f['id']={'$in':_0x209d12['body'][_0x6ab8('0x69')]};}_0x2cde24=[['priority',_0x6ab8('0x6a')],[_0x6ab8('0x6b'),_0x4c5cee[0x0]['dialOrderByScheduledAt']==='ASC'?'DESC':'ASC'],db[_0x6ab8('0x6c')][_0x6ab8('0x6d')]('COALESCE(CmHopper.UserId,\x200)\x20ASC'),['id','DESC']];}else{if(!_[_0x6ab8('0x68')](_0x209d12['body']['hopperIds'])){_0x2af78f['id']={'$notIn':_0x209d12[_0x6ab8('0x3d')][_0x6ab8('0x69')]};}_0x2cde24=[[_0x6ab8('0x6e'),_0x6ab8('0x6f')],[_0x6ab8('0x6b'),_0x4c5cee[0x0][_0x6ab8('0x70')]],db[_0x6ab8('0x6c')][_0x6ab8('0x6d')](_0x6ab8('0x71')),['id','ASC']];}return db[_0x6ab8('0x32')]['findOne']({'attributes':['id',_0x6ab8('0x72'),_0x6ab8('0x73'),_0x6ab8('0x74')],'where':_0x2af78f,'order':_0x2cde24,'transaction':_0x35da58,'lock':_0x35da58[_0x6ab8('0x75')][_0x6ab8('0x76')],'include':[{'model':db['CmContact'],'as':_0x6ab8('0x77'),'attributes':_0x5ab635,'include':[{'model':db[_0x6ab8('0x78')],'as':'Company','attributes':['id','name']}]},{'model':db[_0x6ab8('0x79')],'as':_0x6ab8('0x7a'),'attributes':['id',_0x6ab8('0xf')]},{'model':db[_0x6ab8('0x43')],'as':_0x6ab8('0x7b'),'attributes':['id','name','dialActive']}]})['then'](function(_0x202a9b){if(_0x202a9b){return _0x202a9b[_0x6ab8('0x7c')]({'UserId':_0x209d12[_0x6ab8('0x4c')]['id']},{'transaction':_0x35da58});}});});}})['then'](handleEntityNotFound(_0x2ea704,null))[_0x6ab8('0xc')](respondWithResult(_0x2ea704,null))[_0x6ab8('0x36')](handleError(_0x2ea704,null));};exports[_0x6ab8('0x7d')]=function(_0x248205,_0x4f82d5,_0x47ad06){var _0x2c4aab=[];var _0x17fde9=_0x248205[_0x6ab8('0x3e')]['id'];var _0x4ddc94=_0x248205[_0x6ab8('0x4c')]['id'];return db['CmContact'][_0x6ab8('0x3f')]()['then'](function(_0x598ca5){_0x2c4aab=_['keys'](_0x598ca5);return db['sequelize'][_0x6ab8('0x7e')](function(_0x16a6e4){const _0x51abcd={'id':_0x17fde9};return db['CmHopper'][_0x6ab8('0x7f')]({'attributes':['id','scheduledat',_0x6ab8('0x74')],'where':_0x51abcd,'transaction':_0x16a6e4,'lock':_0x16a6e4[_0x6ab8('0x75')][_0x6ab8('0x76')],'include':[{'model':db['CmContact'],'as':_0x6ab8('0x77'),'attributes':_0x2c4aab,'include':[{'model':db[_0x6ab8('0x78')],'as':_0x6ab8('0x80'),'attributes':['id',_0x6ab8('0xf')]}]},{'model':db[_0x6ab8('0x79')],'as':_0x6ab8('0x7a'),'attributes':['id',_0x6ab8('0xf')]},{'model':db[_0x6ab8('0x43')],'as':_0x6ab8('0x7b'),'attributes':['id','name',_0x6ab8('0x81')]}]})[_0x6ab8('0xc')](function(_0x237fed){if(_0x237fed){return _0x237fed[_0x6ab8('0x7c')]({'UserId':_0x4ddc94},{'transaction':_0x16a6e4});}});});})[_0x6ab8('0xc')](handleEntityNotFound(_0x4f82d5,null))[_0x6ab8('0xc')](respondWithResult(_0x4f82d5,null))[_0x6ab8('0x36')](handleError(_0x4f82d5,null));};exports[_0x6ab8('0x82')]=function(_0x3b1c90,_0x48ceea){return _0x3b1c90[_0x6ab8('0x4c')][_0x6ab8('0x61')]({'where':{'type':_0x6ab8('0x62'),'dialActive':!![],'dialMethod':_0x6ab8('0x63')},'attributes':['id'],'raw':!![]})['then'](function(_0x4f53c2){if(_0x4f53c2&&_0x4f53c2['length']){return db[_0x6ab8('0x32')][_0x6ab8('0x9')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x6ab8('0x50')](_0x6ab8('0x51'))},'VoiceQueueId':{'$in':_[_0x6ab8('0x12')](_0x4f53c2,'id')},'$or':[{'UserId':null},{'UserId':_0x3b1c90[_0x6ab8('0x4c')]['id']}]}});}return 0x0;})[_0x6ab8('0xc')](function(_0x3ce36c){if(!_[_0x6ab8('0x59')](_0x3ce36c)&&_[_0x6ab8('0x83')](_0x3ce36c)){return _0x48ceea[_0x6ab8('0x4')](0xc8)[_0x6ab8('0x5')]({'contacts':_0x3ce36c});}else{logger['error'](_0x6ab8('0x84'),'getOpenContacts',0x194,'entity\x20not\x20found');_0x48ceea['sendStatus'](0x194);}})[_0x6ab8('0x36')](handleError(_0x48ceea,null));};exports['getTimezones']=function(_0x35045f,_0x40276f){var _0x5e30d0=shared[_0x6ab8('0x85')];var _0x17c6ea=[];_[_0x6ab8('0x12')](_0x5e30d0,function(_0x126714){_0x17c6ea[_0x6ab8('0x86')]({'id':_0x126714[_0x6ab8('0xf')],'name':_0x126714[_0x6ab8('0xf')],'utcOffset':_0x126714[_0x6ab8('0x87')]});});return _0x40276f[_0x6ab8('0x4')](0xc8)[_0x6ab8('0x5')]({'tz':_0x17c6ea});};exports['getTimezone']=function(_0x2f8c09,_0x58ba1b){var _0x2b07af=shared[_0x6ab8('0x85')];var _0x5984cd={};if(!_[_0x6ab8('0x59')](_0x2b07af[_0x2f8c09[_0x6ab8('0x3d')]['id']]))_0x5984cd=_0x2b07af[_0x2f8c09[_0x6ab8('0x3d')]['id']];return _0x58ba1b[_0x6ab8('0x4')](0xc8)[_0x6ab8('0x5')](_0x5984cd);}; \ No newline at end of file +var _0x3c94=['describe','destroy','VoiceQueueId','CampaignId','VoiceQueue','omit','createdAt','updatedAt','state','statedesc','membername','user','UserId','deleted','deletedat','format','phone','campaigntype','ivr','CmContact','firstName','lastName','isNil','calleridname','finally','CmHopperFinal','CmHopperAdditionalPhone','end','getPreview','getVoiceQueues','outbound','dialOrderByScheduledAt','sequelize','dialPreviewAutoRecallMe','value','prev','isEmpty','hopperIds','priority','ASC','scheduledAt','DESC','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','recallme','LOCK','CmCompany','Company','CmList','Queue','dialActive','transaction','UPDATE','Contact','getOpenContacts','preview','YYYY-MM-DD\x20HH:mm:ss','isNumber','error','CmHopper,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','timezones','push','utcOffset','getTimezone','moment','lodash','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','status','json','offset','undefined','limit','count','set','Content-Range','update','then','sendStatus','name','send','map','CmHopper','rawAttributes','fieldName','key','model','query','keys','intersection','filters','$and','$or','$gte','$lt','$lte','$ne','$eq','$between','$notBetween','$in','$notIn','$like','$notLike','$iLike','$notILike','$overlap','$contained','$any','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body'];(function(_0x42d956,_0x506ccb){var _0x22c3fe=function(_0x32f22d){while(--_0x32f22d){_0x42d956['push'](_0x42d956['shift']());}};_0x22c3fe(++_0x506ccb);}(_0x3c94,0xcd));var _0x43c9=function(_0x579baf,_0x4aaafa){_0x579baf=_0x579baf-0x0;var _0x4c601a=_0x3c94[_0x579baf];return _0x4c601a;};'use strict';var moment=require(_0x43c9('0x0'));var _=require(_0x43c9('0x1'));var qs=require(_0x43c9('0x2'));var logger=require(_0x43c9('0x3'))(_0x43c9('0x4'));var shared=require(_0x43c9('0x5'));var db=require(_0x43c9('0x6'))['db'];function respondWithResult(_0x18159f,_0x170a0d){_0x170a0d=_0x170a0d||0xc8;return function(_0x44fc3){if(_0x44fc3){return _0x18159f[_0x43c9('0x7')](_0x170a0d)[_0x43c9('0x8')](_0x44fc3);}};}function respondWithFilteredResult(_0x4fdfc2,_0x39c220){return function(_0xf03007){if(_0xf03007){var _0x695b4f=typeof _0x39c220[_0x43c9('0x9')]===_0x43c9('0xa')&&typeof _0x39c220[_0x43c9('0xb')]===_0x43c9('0xa');var _0x4725aa=_0xf03007[_0x43c9('0xc')];var _0x4b113f=_0x695b4f?0x0:_0x39c220[_0x43c9('0x9')];var _0x18a5c9=_0x695b4f?_0xf03007[_0x43c9('0xc')]:_0x39c220[_0x43c9('0x9')]+_0x39c220[_0x43c9('0xb')];var _0x6ff1f9;if(_0x18a5c9>=_0x4725aa){_0x18a5c9=_0x4725aa;_0x6ff1f9=0xc8;}else{_0x6ff1f9=0xce;}_0x4fdfc2[_0x43c9('0x7')](_0x6ff1f9);return _0x4fdfc2[_0x43c9('0xd')](_0x43c9('0xe'),_0x4b113f+'-'+_0x18a5c9+'/'+_0x4725aa)[_0x43c9('0x8')](_0xf03007);}return null;};}function saveUpdates(_0x62bb3b,_0x31faa1){return function(_0x11fe24){if(_0x11fe24){return _0x11fe24[_0x43c9('0xf')](_0x62bb3b)[_0x43c9('0x10')](function(_0x45546d){return _0x45546d;});}return null;};}function handleEntityNotFound(_0x275b2b,_0x569fa9){return function(_0x37932f){if(!_0x37932f){_0x275b2b[_0x43c9('0x11')](0x194);}return _0x37932f;};}function handleError(_0x398b37,_0xe02707){_0xe02707=_0xe02707||0x1f4;return function(_0x3f908d){logger['error'](_0x3f908d['stack']);if(_0x3f908d[_0x43c9('0x12')]){delete _0x3f908d[_0x43c9('0x12')];}_0x398b37[_0x43c9('0x7')](_0xe02707)[_0x43c9('0x13')](_0x3f908d);};}exports['index']=function(_0x1d63cf,_0x1da149){var _0x38fe46={},_0x22bf3d={},_0xc14827={'count':0x0,'rows':[]};var _0x2ab239=_[_0x43c9('0x14')](db[_0x43c9('0x15')][_0x43c9('0x16')],function(_0x2a7b78){return{'name':_0x2a7b78[_0x43c9('0x17')],'type':_0x2a7b78['type'][_0x43c9('0x18')]};});_0x22bf3d[_0x43c9('0x19')]=_[_0x43c9('0x14')](_0x2ab239,'name');_0x22bf3d[_0x43c9('0x1a')]=_[_0x43c9('0x1b')](_0x1d63cf[_0x43c9('0x1a')]);_0x22bf3d['filters']=_[_0x43c9('0x1c')](_0x22bf3d[_0x43c9('0x19')],_0x22bf3d[_0x43c9('0x1a')]);_0x22bf3d['filters']=_['concat'](_0x22bf3d[_0x43c9('0x1d')],[_0x43c9('0x1e'),_0x43c9('0x1f'),'$gt',_0x43c9('0x20'),_0x43c9('0x21'),_0x43c9('0x22'),_0x43c9('0x23'),_0x43c9('0x24'),'$not',_0x43c9('0x25'),_0x43c9('0x26'),_0x43c9('0x27'),_0x43c9('0x28'),_0x43c9('0x29'),_0x43c9('0x2a'),_0x43c9('0x2b'),_0x43c9('0x2c'),_0x43c9('0x29'),_0x43c9('0x2d'),'$contains',_0x43c9('0x2e'),_0x43c9('0x2f')]);_0x38fe46[_0x43c9('0x30')]=_['intersection'](_0x22bf3d[_0x43c9('0x19')],qs[_0x43c9('0x31')](_0x1d63cf['query'][_0x43c9('0x31')]));_0x38fe46['attributes']=_0x38fe46[_0x43c9('0x30')][_0x43c9('0x32')]?_0x38fe46[_0x43c9('0x30')]:_0x22bf3d[_0x43c9('0x19')];if(!_0x1d63cf['query'][_0x43c9('0x33')](_0x43c9('0x34'))){_0x38fe46[_0x43c9('0xb')]=qs['limit'](_0x1d63cf[_0x43c9('0x1a')]['limit']);_0x38fe46[_0x43c9('0x9')]=qs[_0x43c9('0x9')](_0x1d63cf[_0x43c9('0x1a')][_0x43c9('0x9')]);}_0x38fe46['order']=qs[_0x43c9('0x35')](_0x1d63cf[_0x43c9('0x1a')][_0x43c9('0x35')]);_0x38fe46[_0x43c9('0x36')]=qs['filters'](_[_0x43c9('0x37')](_0x1d63cf[_0x43c9('0x1a')],_0x22bf3d[_0x43c9('0x1d')]),_0x2ab239);if(_0x1d63cf[_0x43c9('0x1a')][_0x43c9('0x38')]){_0x38fe46[_0x43c9('0x36')]=_[_0x43c9('0x39')](_0x38fe46[_0x43c9('0x36')],{'$or':_['map'](_0x2ab239,function(_0x1923bf){if(_0x1923bf[_0x43c9('0x3a')]!==_0x43c9('0x3b')){var _0x2a4302={};_0x2a4302[_0x1923bf[_0x43c9('0x12')]]={'$like':'%'+_0x1d63cf[_0x43c9('0x1a')][_0x43c9('0x38')]+'%'};return _0x2a4302;}})});}_0x38fe46=_[_0x43c9('0x39')]({},_0x38fe46,_0x1d63cf[_0x43c9('0x3c')]);var _0x4a62b2={'where':_0x38fe46[_0x43c9('0x36')]};return db['CmHopper'][_0x43c9('0xc')](_0x4a62b2)[_0x43c9('0x10')](function(_0x2d4700){_0xc14827[_0x43c9('0xc')]=_0x2d4700;if(_0x1d63cf[_0x43c9('0x1a')][_0x43c9('0x3d')]){_0x38fe46[_0x43c9('0x3e')]=[{'all':!![]}];}return db[_0x43c9('0x15')][_0x43c9('0x3f')](_0x38fe46);})['then'](function(_0x3e6b15){_0xc14827[_0x43c9('0x40')]=_0x3e6b15;return _0xc14827;})['then'](respondWithFilteredResult(_0x1da149,_0x38fe46))[_0x43c9('0x41')](handleError(_0x1da149,null));};exports[_0x43c9('0x42')]=function(_0x309fea,_0x52c316){var _0xb01a6e={'raw':!![],'where':{'id':_0x309fea[_0x43c9('0x43')]['id']}},_0x33f293={};_0x33f293[_0x43c9('0x19')]=_[_0x43c9('0x1b')](db[_0x43c9('0x15')][_0x43c9('0x16')]);_0x33f293[_0x43c9('0x1a')]=_[_0x43c9('0x1b')](_0x309fea[_0x43c9('0x1a')]);_0x33f293[_0x43c9('0x1d')]=_[_0x43c9('0x1c')](_0x33f293['model'],_0x33f293[_0x43c9('0x1a')]);_0xb01a6e[_0x43c9('0x30')]=_[_0x43c9('0x1c')](_0x33f293[_0x43c9('0x19')],qs['fields'](_0x309fea[_0x43c9('0x1a')][_0x43c9('0x31')]));_0xb01a6e['attributes']=_0xb01a6e[_0x43c9('0x30')][_0x43c9('0x32')]?_0xb01a6e[_0x43c9('0x30')]:_0x33f293[_0x43c9('0x19')];if(_0x309fea[_0x43c9('0x1a')][_0x43c9('0x3d')]){_0xb01a6e[_0x43c9('0x3e')]=[{'all':!![]}];}_0xb01a6e=_[_0x43c9('0x39')]({},_0xb01a6e,_0x309fea[_0x43c9('0x3c')]);return db['CmHopper'][_0x43c9('0x44')](_0xb01a6e)['then'](handleEntityNotFound(_0x52c316,null))[_0x43c9('0x10')](respondWithResult(_0x52c316,null))[_0x43c9('0x41')](handleError(_0x52c316,null));};exports[_0x43c9('0x45')]=function(_0x45de19,_0x55e0df){return db[_0x43c9('0x15')][_0x43c9('0x45')](_0x45de19['body'],{})[_0x43c9('0x10')](respondWithResult(_0x55e0df,0xc9))[_0x43c9('0x41')](handleError(_0x55e0df,null));};exports['update']=function(_0x16a020,_0x1ca85f){if(_0x16a020[_0x43c9('0x46')]['id']){delete _0x16a020['body']['id'];}return db[_0x43c9('0x15')]['find']({'where':{'id':_0x16a020['params']['id']}})[_0x43c9('0x10')](handleEntityNotFound(_0x1ca85f,null))[_0x43c9('0x10')](saveUpdates(_0x16a020[_0x43c9('0x46')],null))[_0x43c9('0x10')](respondWithResult(_0x1ca85f,null))[_0x43c9('0x41')](handleError(_0x1ca85f,null));};exports[_0x43c9('0x47')]=function(_0x1f966e,_0x31c766){return db[_0x43c9('0x15')][_0x43c9('0x47')]()[_0x43c9('0x10')](respondWithResult(_0x31c766,null))[_0x43c9('0x41')](handleError(_0x31c766,null));};exports[_0x43c9('0x48')]=function(_0x5082e9,_0xc57086){var _0x204068;var _0x4deed0=_0x5082e9[_0x43c9('0x43')]['id'];return db[_0x43c9('0x15')][_0x43c9('0x44')]({'where':{'id':_0x5082e9[_0x43c9('0x43')]['id']}})[_0x43c9('0x10')](handleEntityNotFound(_0xc57086,null))[_0x43c9('0x10')](function(_0x21adfe){if(_0x21adfe){return _0x21adfe[_0x43c9('0x48')]()[_0x43c9('0x10')](function(_0x508b62){return _0x508b62;});}})[_0x43c9('0x10')](function(_0x34c4c6){_0x204068=_0x34c4c6;if(_0x34c4c6){if(_0x34c4c6[_0x43c9('0x49')]||_0x34c4c6[_0x43c9('0x4a')]){return db[_0x34c4c6[_0x43c9('0x49')]?_0x43c9('0x4b'):'Campaign'][_0x43c9('0x44')]({'where':{'id':_0x34c4c6[_0x43c9('0x49')]?_0x34c4c6[_0x43c9('0x49')]:_0x34c4c6[_0x43c9('0x4a')]},'attributes':['id',_0x43c9('0x12')],'raw':!![]});}}})[_0x43c9('0x10')](function(_0x2439b3){var _0x6c638={};if(_0x2439b3){_['merge'](_0x6c638,_[_0x43c9('0x4c')](_0x204068['dataValues'],[_0x43c9('0x4d'),_0x43c9('0x4e'),'id']));_0x6c638[_0x43c9('0x4f')]=0x15;_0x6c638[_0x43c9('0x50')]='deleted';_0x6c638['campaign']=_0x2439b3['name'];_0x6c638[_0x43c9('0x51')]=_0x5082e9[_0x43c9('0x52')][_0x43c9('0x12')];_0x6c638[_0x43c9('0x53')]=_0x5082e9[_0x43c9('0x52')]['id'];_0x6c638[_0x43c9('0x54')]=!![];_0x6c638[_0x43c9('0x55')]=moment()[_0x43c9('0x56')]('YYYY-MM-DD\x20HH:mm:ss');_0x6c638['calleridnum']=_0x204068[_0x43c9('0x57')];_0x6c638[_0x43c9('0x58')]=_0x204068['VoiceQueueId']?'queue':_0x43c9('0x59');return db[_0x43c9('0x5a')][_0x43c9('0x44')]({'where':{'id':_0x6c638['ContactId']},'attributes':[_0x43c9('0x5b'),_0x43c9('0x5c')]})[_0x43c9('0x10')](function(_0x3bb411){if(!_[_0x43c9('0x5d')](_0xc57086)&&!_[_0x43c9('0x5d')](_0x3bb411[_0x43c9('0x5b')])){_0x6c638[_0x43c9('0x5e')]=_0x3bb411[_0x43c9('0x5b')];if(!_[_0x43c9('0x5d')](_0x3bb411['lastName'])){_0x6c638[_0x43c9('0x5e')]+='\x20'+_0x3bb411[_0x43c9('0x5c')];}}})[_0x43c9('0x5f')](function(){return db[_0x43c9('0x60')][_0x43c9('0x45')](_0x6c638);});}})[_0x43c9('0x10')](function(_0x51938e){return db[_0x43c9('0x61')][_0x43c9('0x48')]({'where':{'CmHopperId':_0x4deed0}});})[_0x43c9('0x10')](function(){return _0xc57086[_0x43c9('0x7')](0xcc)[_0x43c9('0x62')]();})[_0x43c9('0x41')](handleError(_0xc57086,null));};exports[_0x43c9('0x63')]=function(_0x4b4b93,_0xd7f56b){var _0x4d4bf4=[];return db[_0x43c9('0x5a')][_0x43c9('0x47')]()[_0x43c9('0x10')](function(_0x4dc6a1){_0x4d4bf4=_['keys'](_0x4dc6a1);return _0x4b4b93[_0x43c9('0x52')][_0x43c9('0x64')]({'where':{'type':_0x43c9('0x65'),'dialActive':!![],'dialMethod':'preview'},'attributes':['id',_0x43c9('0x66'),'dialPreviewAutoRecallMe'],'raw':!![]});})[_0x43c9('0x10')](function(_0x2ad37f){if(_0x2ad37f&&_0x2ad37f['length']){return db[_0x43c9('0x67')]['transaction'](function(_0x186038){var _0x6e13f={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x43c9('0x56')]('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_['map'](_0x2ad37f,'id')},'$or':[{'UserId':null},{'UserId':_0x4b4b93['user']['id']}]};var _0x2658b8={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x2ad37f)[_0x43c9('0x38')]([_0x43c9('0x68'),0x0])[_0x43c9('0x14')]('id')[_0x43c9('0x69')]()},'$or':[{'UserId':null},{'UserId':_0x4b4b93[_0x43c9('0x52')]['id']}]};var _0x1a4da5={'$or':[_0x6e13f,_0x2658b8]};var _0x27d0ca=[];if(_0x4b4b93[_0x43c9('0x46')]['direction']&&_0x4b4b93[_0x43c9('0x46')]['direction']===_0x43c9('0x6a')){if(!_[_0x43c9('0x6b')](_0x4b4b93[_0x43c9('0x46')][_0x43c9('0x6c')])){_0x1a4da5['id']={'$in':_0x4b4b93[_0x43c9('0x46')][_0x43c9('0x6c')]};}_0x27d0ca=[[_0x43c9('0x6d'),_0x43c9('0x6e')],[_0x43c9('0x6f'),_0x2ad37f[0x0][_0x43c9('0x66')]===_0x43c9('0x6e')?_0x43c9('0x70'):'ASC'],db[_0x43c9('0x67')][_0x43c9('0x71')](_0x43c9('0x72')),['id',_0x43c9('0x70')]];}else{if(!_[_0x43c9('0x6b')](_0x4b4b93[_0x43c9('0x46')][_0x43c9('0x6c')])){_0x1a4da5['id']={'$notIn':_0x4b4b93['body'][_0x43c9('0x6c')]};}_0x27d0ca=[[_0x43c9('0x6d'),'DESC'],[_0x43c9('0x6f'),_0x2ad37f[0x0][_0x43c9('0x66')]],db[_0x43c9('0x67')][_0x43c9('0x71')](_0x43c9('0x73')),['id',_0x43c9('0x6e')]];}return db[_0x43c9('0x15')][_0x43c9('0x74')]({'attributes':['id','scheduledat',_0x43c9('0x57'),_0x43c9('0x75')],'where':_0x1a4da5,'order':_0x27d0ca,'transaction':_0x186038,'lock':_0x186038[_0x43c9('0x76')]['UPDATE'],'include':[{'model':db['CmContact'],'as':'Contact','attributes':_0x4d4bf4,'include':[{'model':db[_0x43c9('0x77')],'as':_0x43c9('0x78'),'attributes':['id','name']}]},{'model':db[_0x43c9('0x79')],'as':'List','attributes':['id',_0x43c9('0x12')]},{'model':db[_0x43c9('0x4b')],'as':_0x43c9('0x7a'),'attributes':['id',_0x43c9('0x12'),_0x43c9('0x7b')]}]})[_0x43c9('0x10')](function(_0x3a9aba){if(_0x3a9aba){return _0x3a9aba[_0x43c9('0xf')]({'UserId':_0x4b4b93['user']['id']},{'transaction':_0x186038});}});});}})[_0x43c9('0x10')](handleEntityNotFound(_0xd7f56b,null))[_0x43c9('0x10')](respondWithResult(_0xd7f56b,null))[_0x43c9('0x41')](handleError(_0xd7f56b,null));};exports['getPreviewRecall']=function(_0x329dd2,_0x52612a,_0x566b51){var _0x3df13b=[];var _0x40151f=_0x329dd2['params']['id'];var _0x113297=_0x329dd2['user']['id'];return db['CmContact'][_0x43c9('0x47')]()['then'](function(_0x1624c9){_0x3df13b=_[_0x43c9('0x1b')](_0x1624c9);return db['sequelize'][_0x43c9('0x7c')](function(_0x4b00ce){const _0x3e8a54={'id':_0x40151f};return db[_0x43c9('0x15')]['findOne']({'attributes':['id','scheduledat','recallme'],'where':_0x3e8a54,'transaction':_0x4b00ce,'lock':_0x4b00ce[_0x43c9('0x76')][_0x43c9('0x7d')],'include':[{'model':db[_0x43c9('0x5a')],'as':_0x43c9('0x7e'),'attributes':_0x3df13b,'include':[{'model':db[_0x43c9('0x77')],'as':'Company','attributes':['id',_0x43c9('0x12')]}]},{'model':db['CmList'],'as':'List','attributes':['id','name']},{'model':db[_0x43c9('0x4b')],'as':_0x43c9('0x7a'),'attributes':['id',_0x43c9('0x12'),_0x43c9('0x7b')]}]})[_0x43c9('0x10')](function(_0x44e538){if(_0x44e538){return _0x44e538[_0x43c9('0xf')]({'UserId':_0x113297},{'transaction':_0x4b00ce});}});});})['then'](handleEntityNotFound(_0x52612a,null))['then'](respondWithResult(_0x52612a,null))[_0x43c9('0x41')](handleError(_0x52612a,null));};exports[_0x43c9('0x7f')]=function(_0x11cb72,_0x170f84){return _0x11cb72[_0x43c9('0x52')][_0x43c9('0x64')]({'where':{'type':_0x43c9('0x65'),'dialActive':!![],'dialMethod':_0x43c9('0x80')},'attributes':['id'],'raw':!![]})[_0x43c9('0x10')](function(_0x341f60){if(_0x341f60&&_0x341f60[_0x43c9('0x32')]){return db['CmHopper'][_0x43c9('0xc')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x43c9('0x56')](_0x43c9('0x81'))},'VoiceQueueId':{'$in':_['map'](_0x341f60,'id')},'$or':[{'UserId':null},{'UserId':_0x11cb72[_0x43c9('0x52')]['id']}]}});}return 0x0;})[_0x43c9('0x10')](function(_0x135ab1){if(!_['isNil'](_0x135ab1)&&_[_0x43c9('0x82')](_0x135ab1)){return _0x170f84[_0x43c9('0x7')](0xc8)[_0x43c9('0x8')]({'contacts':_0x135ab1});}else{logger[_0x43c9('0x83')](_0x43c9('0x84'),_0x43c9('0x7f'),0x194,_0x43c9('0x85'));_0x170f84['sendStatus'](0x194);}})[_0x43c9('0x41')](handleError(_0x170f84,null));};exports['getTimezones']=function(_0x49a536,_0x3a99c7){var _0x5e5cc2=shared[_0x43c9('0x86')];var _0xe80086=[];_[_0x43c9('0x14')](_0x5e5cc2,function(_0x48ade5){_0xe80086[_0x43c9('0x87')]({'id':_0x48ade5['name'],'name':_0x48ade5[_0x43c9('0x12')],'utcOffset':_0x48ade5[_0x43c9('0x88')]});});return _0x3a99c7[_0x43c9('0x7')](0xc8)[_0x43c9('0x8')]({'tz':_0xe80086});};exports[_0x43c9('0x89')]=function(_0x3d80f0,_0x28e816){var _0x1ecfbe=shared[_0x43c9('0x86')];var _0x21acd5={};if(!_[_0x43c9('0x5d')](_0x1ecfbe[_0x3d80f0[_0x43c9('0x46')]['id']]))_0x21acd5=_0x1ecfbe[_0x3d80f0[_0x43c9('0x46')]['id']];return _0x28e816[_0x43c9('0x7')](0xc8)[_0x43c9('0x8')](_0x21acd5);}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index 51b858c..a021fb0 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 _0x9536=['../../config/environment','./cmHopper.attributes','exports','define','CmHopper','cm_hopper','scheduledat','phone','priority','lodash','util','../../config/logger','api','bluebird','path','rimraf'];(function(_0x4c7fb5,_0x2548ef){var _0x2e10ac=function(_0xf7e27c){while(--_0xf7e27c){_0x4c7fb5['push'](_0x4c7fb5['shift']());}};_0x2e10ac(++_0x2548ef);}(_0x9536,0x179));var _0x6953=function(_0x3da612,_0x332456){_0x3da612=_0x3da612-0x0;var _0x1a9d1d=_0x9536[_0x3da612];return _0x1a9d1d;};'use strict';var _=require(_0x6953('0x0'));var util=require(_0x6953('0x1'));var logger=require(_0x6953('0x2'))(_0x6953('0x3'));var moment=require('moment');var BPromise=require(_0x6953('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6953('0x5'));var rimraf=require(_0x6953('0x6'));var config=require(_0x6953('0x7'));var attributes=require(_0x6953('0x8'));module[_0x6953('0x9')]=function(_0x494ac2,_0x2b273e){return _0x494ac2[_0x6953('0xa')](_0x6953('0xb'),attributes,{'tableName':_0x6953('0xc'),'paranoid':![],'indexes':[{'name':_0x6953('0xd'),'fields':['scheduledat']},{'name':_0x6953('0xe'),'fields':[_0x6953('0xe')]},{'name':_0x6953('0xf'),'fields':['priority']}],'timestamps':!![]});}; \ No newline at end of file +var _0x53ec=['moment','bluebird','path','../../config/environment','./cmHopper.attributes','define','CmHopper','scheduledat','phone','priority','lodash','util','../../config/logger','api'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x53ec,0x192));var _0xc53e=function(_0x1b857f,_0x286e31){_0x1b857f=_0x1b857f-0x0;var _0x5582e9=_0x53ec[_0x1b857f];return _0x5582e9;};'use strict';var _=require(_0xc53e('0x0'));var util=require(_0xc53e('0x1'));var logger=require(_0xc53e('0x2'))(_0xc53e('0x3'));var moment=require(_0xc53e('0x4'));var BPromise=require(_0xc53e('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc53e('0x6'));var rimraf=require('rimraf');var config=require(_0xc53e('0x7'));var attributes=require(_0xc53e('0x8'));module['exports']=function(_0x2f1414,_0x4f989b){return _0x2f1414[_0xc53e('0x9')](_0xc53e('0xa'),attributes,{'tableName':'cm_hopper','paranoid':![],'indexes':[{'name':_0xc53e('0xb'),'fields':[_0xc53e('0xb')]},{'name':_0xc53e('0xc'),'fields':[_0xc53e('0xc')]},{'name':_0xc53e('0xd'),'fields':[_0xc53e('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.rpc.js b/server/api/cmHopper/cmHopper.rpc.js index ea25719..0d7db75 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 _0x54ad=['MoveContactManagedDialer','transaction','CmHopperFinal','MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','CountReScheduled','COUNT','`scheduledat`\x20>=\x20','format','\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','GetContactRecallMe','GetCmHopperPreview','GetContactByPhone','findOne','phone','dialTimezone','DESC','getContactByPhone','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','interval','availableAgentsIds','literal','NOW()\x20+\x20INTERVAL\x20','\x20MINUTE','CmList','List','NOW()','util','bluebird','../../mysqldb','rpc','GetCmHopper','CmHopper','findAll','options','raw','where','model','attributes','include','map','info','debug','stringify','error','message','find','then','ShowCmHopper','CreateCmHopper','create','body','catch','UpdateCmHopper','update','limit','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','active','DestroyCmHopper','destroy','GetContactDialer','CmContact','describe','sequelize','order','LOCK','UPDATE','Contact','keys','User','Agent','name','voicePause','UserId','push','includes','all','length','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','dataValues'];(function(_0x4c4547,_0x460e32){var _0x565c3a=function(_0x140227){while(--_0x140227){_0x4c4547['push'](_0x4c4547['shift']());}};_0x565c3a(++_0x460e32);}(_0x54ad,0x165));var _0xd54a=function(_0x25a3ef,_0x2936de){_0x25a3ef=_0x25a3ef-0x0;var _0x2b64bc=_0x54ad[_0x25a3ef];return _0x2b64bc;};'use strict';var _=require('lodash');var util=require(_0xd54a('0x0'));var moment=require('moment');var BPromise=require(_0xd54a('0x1'));var db=require(_0xd54a('0x2'))['db'];var logger=require('../../config/logger')(_0xd54a('0x3'));exports[_0xd54a('0x4')]=function(_0x4cb1ab){var _0x1cefea=this;return new Promise(function(_0x44a9d6,_0x3e03d6){return db[_0xd54a('0x5')][_0xd54a('0x6')]({'raw':_0x4cb1ab[_0xd54a('0x7')]?_0x4cb1ab['options'][_0xd54a('0x8')]===undefined?!![]:![]:!![],'where':_0x4cb1ab[_0xd54a('0x7')]?_0x4cb1ab['options'][_0xd54a('0x9')]||null:null,'attributes':_0x4cb1ab['options']?_0x4cb1ab['options']['attributes']||null:null,'limit':_0x4cb1ab['options']?_0x4cb1ab[_0xd54a('0x7')]['limit']||null:null,'include':_0x4cb1ab[_0xd54a('0x7')]?_0x4cb1ab[_0xd54a('0x7')]['include']?_['map'](_0x4cb1ab[_0xd54a('0x7')]['include'],function(_0x1260ad){return{'model':db[_0x1260ad[_0xd54a('0xa')]],'as':_0x1260ad['as'],'attributes':_0x1260ad[_0xd54a('0xb')],'include':_0x1260ad[_0xd54a('0xc')]?_['map'](_0x1260ad['include'],function(_0x5d8df0){return{'model':db[_0x5d8df0[_0xd54a('0xa')]],'as':_0x5d8df0['as'],'attributes':_0x5d8df0[_0xd54a('0xb')],'include':_0x5d8df0[_0xd54a('0xc')]?_[_0xd54a('0xd')](_0x5d8df0[_0xd54a('0xc')],function(_0x36b52c){return{'model':db[_0x36b52c[_0xd54a('0xa')]],'as':_0x36b52c['as'],'attributes':_0x36b52c['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x4c12be){logger[_0xd54a('0xe')](_0xd54a('0x4'),_0x4cb1ab);logger[_0xd54a('0xf')](_0xd54a('0x4'),_0x4cb1ab,JSON[_0xd54a('0x10')](_0x4c12be));_0x44a9d6(_0x4c12be);})['catch'](function(_0x595726){logger[_0xd54a('0x11')](_0xd54a('0x4'),_0x595726['message'],_0x4cb1ab);_0x3e03d6(_0x1cefea[_0xd54a('0x11')](0x1f4,_0x595726[_0xd54a('0x12')]));});});};exports['ShowCmHopper']=function(_0x351a09){var _0x2dee16=this;return new Promise(function(_0x353804,_0x8771cc){return db[_0xd54a('0x5')][_0xd54a('0x13')]({'raw':_0x351a09[_0xd54a('0x7')]?_0x351a09['options'][_0xd54a('0x8')]===undefined?!![]:![]:!![],'where':_0x351a09[_0xd54a('0x7')]?_0x351a09[_0xd54a('0x7')][_0xd54a('0x9')]||null:null,'attributes':_0x351a09[_0xd54a('0x7')]?_0x351a09[_0xd54a('0x7')]['attributes']||null:null,'include':_0x351a09[_0xd54a('0x7')]?_0x351a09[_0xd54a('0x7')][_0xd54a('0xc')]?_['map'](_0x351a09[_0xd54a('0x7')][_0xd54a('0xc')],function(_0x22806d){return{'model':db[_0x22806d[_0xd54a('0xa')]],'as':_0x22806d['as'],'attributes':_0x22806d['attributes'],'include':_0x22806d[_0xd54a('0xc')]?_[_0xd54a('0xd')](_0x22806d['include'],function(_0x5b5ae2){return{'model':db[_0x5b5ae2[_0xd54a('0xa')]],'as':_0x5b5ae2['as'],'attributes':_0x5b5ae2['attributes'],'include':_0x5b5ae2['include']?_[_0xd54a('0xd')](_0x5b5ae2[_0xd54a('0xc')],function(_0x1d6ec9){return{'model':db[_0x1d6ec9[_0xd54a('0xa')]],'as':_0x1d6ec9['as'],'attributes':_0x1d6ec9['attributes']};}):[]};}):[]};}):[]:[]})[_0xd54a('0x14')](function(_0x130d27){logger[_0xd54a('0xe')](_0xd54a('0x15'),_0x351a09);logger[_0xd54a('0xf')](_0xd54a('0x15'),_0x351a09,JSON[_0xd54a('0x10')](_0x130d27));_0x353804(_0x130d27);})['catch'](function(_0x165900){logger[_0xd54a('0x11')](_0xd54a('0x15'),_0x165900[_0xd54a('0x12')],_0x351a09);_0x8771cc(_0x2dee16[_0xd54a('0x11')](0x1f4,_0x165900[_0xd54a('0x12')]));});});};exports[_0xd54a('0x16')]=function(_0x4a39df){var _0x596b4f=this;return new Promise(function(_0x3b382d,_0x1c2803){return db[_0xd54a('0x5')][_0xd54a('0x17')](_0x4a39df[_0xd54a('0x18')],{'raw':_0x4a39df[_0xd54a('0x7')]?_0x4a39df['options']['raw']===undefined?!![]:![]:!![]})[_0xd54a('0x14')](function(_0x1d6dd7){logger[_0xd54a('0xe')](_0xd54a('0x16'),_0x4a39df);logger[_0xd54a('0xf')]('CreateCmHopper',_0x4a39df,JSON[_0xd54a('0x10')](_0x1d6dd7));_0x3b382d(_0x1d6dd7);})[_0xd54a('0x19')](function(_0x42b406){logger[_0xd54a('0x11')]('CreateCmHopper',_0x42b406[_0xd54a('0x12')],_0x4a39df);_0x1c2803(_0x596b4f['error'](0x1f4,_0x42b406[_0xd54a('0x12')]));});});};exports[_0xd54a('0x1a')]=function(_0x16a7d4){var _0xf20de8=this;return new Promise(function(_0x5b7b88,_0x29d958){return db[_0xd54a('0x5')][_0xd54a('0x1b')](_0x16a7d4[_0xd54a('0x18')],{'raw':_0x16a7d4[_0xd54a('0x7')]?_0x16a7d4[_0xd54a('0x7')][_0xd54a('0x8')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x16a7d4[_0xd54a('0x7')]?_0x16a7d4[_0xd54a('0x7')][_0xd54a('0x9')]||null:null,'attributes':_0x16a7d4['options']?_0x16a7d4['options'][_0xd54a('0xb')]||null:null,'limit':_0x16a7d4[_0xd54a('0x7')]?_0x16a7d4[_0xd54a('0x7')][_0xd54a('0x1c')]||null:null})[_0xd54a('0x14')](function(_0x37933b){logger[_0xd54a('0xe')]('UpdateCmHopper',_0x16a7d4);logger['info'](_0xd54a('0x1d'),JSON[_0xd54a('0x10')](_0x16a7d4['options'][_0xd54a('0x9')]),_0x16a7d4[_0xd54a('0x18')][_0xd54a('0x1e')]);logger['debug'](_0xd54a('0x1a'),_0x16a7d4,JSON[_0xd54a('0x10')](_0x37933b));_0x5b7b88(_0x37933b);})[_0xd54a('0x19')](function(_0x1c7368){logger['error']('UpdateCmHopper',_0x1c7368['message'],_0x16a7d4);_0x29d958(_0xf20de8[_0xd54a('0x11')](0x1f4,_0x1c7368[_0xd54a('0x12')]));});});};exports[_0xd54a('0x1f')]=function(_0x25a4d6){var _0x2d7689=this;return new Promise(function(_0x1d279a,_0x161349){return db['CmHopper'][_0xd54a('0x20')]({'where':_0x25a4d6['options']?_0x25a4d6['options'][_0xd54a('0x9')]||null:null})[_0xd54a('0x14')](function(_0x190194){logger[_0xd54a('0xe')](_0xd54a('0x1f'),_0x25a4d6);logger[_0xd54a('0xf')](_0xd54a('0x1f'),_0x25a4d6,JSON[_0xd54a('0x10')](_0x190194));_0x1d279a(_0x190194);})[_0xd54a('0x19')](function(_0x2b8b98){logger[_0xd54a('0x11')](_0xd54a('0x1f'),_0x2b8b98['message'],_0x25a4d6);_0x161349(_0x2d7689[_0xd54a('0x11')](0x1f4,_0x2b8b98[_0xd54a('0x12')]));});});};exports[_0xd54a('0x21')]=function(_0x2088bb){var _0x40c008=this;return new Promise(function(_0x3cc240,_0x50bb71){return db[_0xd54a('0x22')][_0xd54a('0x23')]()[_0xd54a('0x14')](function(_0xce7a0f){return db[_0xd54a('0x24')]['transaction'](function(_0x277349){return db[_0xd54a('0x5')][_0xd54a('0x6')]({'where':_0x2088bb[_0xd54a('0x7')]?_0x2088bb['options'][_0xd54a('0x9')]||null:null,'attributes':_0x2088bb[_0xd54a('0x7')]?_0x2088bb[_0xd54a('0x7')][_0xd54a('0xb')]||null:null,'limit':_0x2088bb[_0xd54a('0x7')]?_0x2088bb[_0xd54a('0x7')][_0xd54a('0x1c')]||null:null,'order':_0x2088bb[_0xd54a('0x7')]?_0x2088bb[_0xd54a('0x7')][_0xd54a('0x25')]||null:null,'transaction':_0x277349,'lock':_0x277349[_0xd54a('0x26')][_0xd54a('0x27')],'include':[{'model':db[_0xd54a('0x22')],'as':_0xd54a('0x28'),'attributes':_[_0xd54a('0x29')](_0xce7a0f)},{'model':db[_0xd54a('0x2a')],'as':_0xd54a('0x2b'),'attributes':['id',_0xd54a('0x2c'),_0xd54a('0x2d')]}]})[_0xd54a('0x14')](function(_0x35a33d){var _0x1a0017=[];var _0x378aa2=[];for(var _0x735cf9=0x0;_0x735cf9<_0x35a33d['length'];_0x735cf9+=0x1){var _0x123494=_0x35a33d[_0x735cf9][_0xd54a('0x2e')];if(_0x123494===null){_0x1a0017[_0xd54a('0x2f')](_0x35a33d[_0x735cf9][_0xd54a('0x1b')](_0x2088bb['body'],{'transaction':_0x277349}));}else if(!_0x378aa2[_0xd54a('0x30')](_0x123494)){_0x378aa2[_0xd54a('0x2f')](_0x123494);_0x1a0017[_0xd54a('0x2f')](_0x35a33d[_0x735cf9]['update'](_0x2088bb['body'],{'transaction':_0x277349}));}}return BPromise[_0xd54a('0x31')](_0x1a0017);});})[_0xd54a('0x14')](function(_0x92efcb){logger['info'](_0xd54a('0x21'),_0x2088bb);if(_0x92efcb[_0xd54a('0x32')]>0x0){logger[_0xd54a('0xe')](_0xd54a('0x33'),_0x92efcb[0x0]['dataValues']['id'],_0x92efcb[0x0][_0xd54a('0x34')]['ContactId'],_0x92efcb[0x0][_0xd54a('0x34')][_0xd54a('0x1e')]);}logger[_0xd54a('0xf')](_0xd54a('0x21'),_0x2088bb,JSON['stringify'](_0x92efcb));_0x3cc240(_0x92efcb);})[_0xd54a('0x19')](function(_0x3e7784){logger[_0xd54a('0x11')](_0xd54a('0x21'),_0x3e7784[_0xd54a('0x12')],_0x2088bb);_0x50bb71(_0x40c008[_0xd54a('0x11')](0x1f4,_0x3e7784[_0xd54a('0x12')]));});});});};exports[_0xd54a('0x35')]=function(_0x2ebed5){var _0x316fdf=this;return new Promise(function(_0x44cf8c,_0x2821c5){return db['sequelize'][_0xd54a('0x36')](function(_0x518867){return db[_0xd54a('0x37')]['create'](_0x2ebed5[_0xd54a('0x18')],{'raw':_0x2ebed5[_0xd54a('0x7')]?_0x2ebed5['options']['raw']===undefined?!![]:![]:!![],'transaction':_0x518867})[_0xd54a('0x14')](function(){logger['info'](_0xd54a('0x38'),JSON[_0xd54a('0x10')](_0x2ebed5['options']['where']),_0x2ebed5[_0xd54a('0x7')][_0xd54a('0x9')]['active']);return db[_0xd54a('0x5')]['destroy']({'where':_0x2ebed5['options']?_0x2ebed5['options']['where']||null:null,'transaction':_0x518867});});})[_0xd54a('0x14')](function(_0x79fa7c){logger[_0xd54a('0xe')]('MoveContactManagedDialer',_0x2ebed5);logger[_0xd54a('0xf')](_0xd54a('0x35'),_0x2ebed5,JSON['stringify'](_0x79fa7c));_0x44cf8c(_0x79fa7c);})[_0xd54a('0x19')](function(_0x1589ab){logger[_0xd54a('0x11')](_0xd54a('0x35'),_0x1589ab[_0xd54a('0x12')],_0x2ebed5);_0x2821c5(_0x316fdf['error'](0x1f4,_0x1589ab[_0xd54a('0x12')]));});});};exports[_0xd54a('0x39')]=function(_0x42135c){var _0x537b7b=this;return new Promise(function(_0x37c6cb,_0x1fe18a){return db['CmHopper'][_0xd54a('0x6')]({'raw':_0x42135c['options']?_0x42135c[_0xd54a('0x7')][_0xd54a('0x8')]===undefined?!![]:![]:!![],'where':_0x42135c[_0xd54a('0x7')]?_0x42135c[_0xd54a('0x7')][_0xd54a('0x9')]||null:null,'attributes':[[db[_0xd54a('0x24')]['fn'](_0xd54a('0x3a'),db['sequelize']['fn']('IF',db[_0xd54a('0x24')]['literal'](_0xd54a('0x3b')+util[_0xd54a('0x3c')](_0xd54a('0x3d'),moment()[_0xd54a('0x3c')](_0xd54a('0x3e')))+_0xd54a('0x3f')))),'contactsRescheduled']]})[_0xd54a('0x14')](function(_0x4d4c52){logger[_0xd54a('0xe')](_0xd54a('0x39'),_0x42135c);logger[_0xd54a('0xf')](_0xd54a('0x39'),_0x42135c,JSON['stringify'](_0x4d4c52));_0x37c6cb(_0x4d4c52);})['catch'](function(_0x3a3605){logger[_0xd54a('0x11')](_0xd54a('0x39'),_0x3a3605[_0xd54a('0x12')],_0x42135c);_0x1fe18a(_0x537b7b[_0xd54a('0x11')](0x1f4,_0x3a3605[_0xd54a('0x12')]));});});};exports[_0xd54a('0x40')]=function(_0x21c806){var _0x57d92b=this;return new Promise(function(_0x5cd662,_0x11dfe0){return db['CmContact'][_0xd54a('0x23')]()[_0xd54a('0x14')](function(){return db[_0xd54a('0x24')]['transaction'](function(_0x123c7d){return db[_0xd54a('0x5')][_0xd54a('0x6')]({'where':_0x21c806[_0xd54a('0x7')]?_0x21c806[_0xd54a('0x7')][_0xd54a('0x9')]||null:null,'attributes':_0x21c806[_0xd54a('0x7')]?_0x21c806[_0xd54a('0x7')][_0xd54a('0xb')]||null:null,'limit':0x1,'order':_0x21c806[_0xd54a('0x7')]?_0x21c806[_0xd54a('0x7')][_0xd54a('0x25')]||null:null,'group':db['CmHopper'][_0xd54a('0x2e')],'transaction':_0x123c7d,'lock':_0x123c7d[_0xd54a('0x26')][_0xd54a('0x27')],'include':_0x21c806['options']?_0x21c806[_0xd54a('0x7')][_0xd54a('0xc')]?_[_0xd54a('0xd')](_0x21c806[_0xd54a('0x7')]['include'],function(_0x5f336b){return{'model':db[_0x5f336b[_0xd54a('0xa')]],'as':_0x5f336b['as'],'attributes':_0x5f336b[_0xd54a('0xb')],'include':_0x5f336b['include']?_[_0xd54a('0xd')](_0x5f336b[_0xd54a('0xc')],function(_0x35a0fa){return{'model':db[_0x35a0fa[_0xd54a('0xa')]],'as':_0x35a0fa['as'],'attributes':_0x35a0fa[_0xd54a('0xb')],'include':_0x35a0fa[_0xd54a('0xc')]?_[_0xd54a('0xd')](_0x35a0fa['include'],function(_0x1dba23){return{'model':db[_0x1dba23['model']],'as':_0x1dba23['as'],'attributes':_0x1dba23[_0xd54a('0xb')]};}):[]};}):[]};}):[]:[]})[_0xd54a('0x14')](function(_0x547abd){var _0x40155d=[];for(var _0x1fb03d=0x0;_0x1fb03d<_0x547abd['length'];_0x1fb03d+=0x1){_0x40155d[_0xd54a('0x2f')](_0x547abd[_0x1fb03d]['update'](_0x21c806[_0xd54a('0x18')],{'transaction':_0x123c7d}));}return BPromise[_0xd54a('0x31')](_0x40155d);});})['then'](function(_0x3c53f9){logger[_0xd54a('0xe')]('GetContactRecallMe',_0x21c806);logger[_0xd54a('0xf')](_0xd54a('0x40'),_0x21c806,JSON['stringify'](_0x3c53f9));_0x5cd662(_0x3c53f9);})['catch'](function(_0x1e4de9){logger[_0xd54a('0x11')](_0xd54a('0x40'),_0x1e4de9[_0xd54a('0x12')],_0x21c806);_0x11dfe0(_0x57d92b[_0xd54a('0x11')](0x1f4,_0x1e4de9[_0xd54a('0x12')]));});});});};exports[_0xd54a('0x41')]=function(_0x916e7b){var _0xa3b250=this;return new Promise(function(_0x28bb75,_0x494040){db[_0xd54a('0x22')][_0xd54a('0x23')]()[_0xd54a('0x14')](function(_0x2038a3){return db[_0xd54a('0x5')]['findAll']({'raw':_0x916e7b[_0xd54a('0x7')]?_0x916e7b[_0xd54a('0x7')][_0xd54a('0x8')]===undefined?!![]:![]:!![],'where':_0x916e7b['options']?_0x916e7b[_0xd54a('0x7')][_0xd54a('0x9')]||null:null,'attributes':_0x916e7b['options']?_0x916e7b['options']['attributes']||null:null,'limit':_0x916e7b['options']?_0x916e7b['options'][_0xd54a('0x1c')]||null:null,'include':_0x916e7b[_0xd54a('0x7')]?_0x916e7b[_0xd54a('0x7')][_0xd54a('0xc')]?_[_0xd54a('0xd')](_0x916e7b[_0xd54a('0x7')][_0xd54a('0xc')],function(_0x5f5c89){return{'model':db[_0x5f5c89['model']],'as':_0x5f5c89['as'],'attributes':_0x5f5c89['as']==='Contact'?_[_0xd54a('0x29')](_0x2038a3):_0x5f5c89[_0xd54a('0xb')],'include':_0x5f5c89[_0xd54a('0xc')]?_[_0xd54a('0xd')](_0x5f5c89[_0xd54a('0xc')],function(_0x4ac7c6){return{'model':db[_0x4ac7c6[_0xd54a('0xa')]],'as':_0x4ac7c6['as'],'attributes':_0x4ac7c6[_0xd54a('0xb')],'include':_0x4ac7c6[_0xd54a('0xc')]?_[_0xd54a('0xd')](_0x4ac7c6['include'],function(_0x1a8cec){return{'model':db[_0x1a8cec['model']],'as':_0x1a8cec['as'],'attributes':_0x1a8cec[_0xd54a('0xb')]};}):[]};}):[]};}):[]:[]})[_0xd54a('0x14')](function(_0xeb2a3e){logger['info'](_0xd54a('0x4'),_0x916e7b);logger['debug'](_0xd54a('0x4'),_0x916e7b,JSON[_0xd54a('0x10')](_0xeb2a3e));_0x28bb75(_0xeb2a3e);})[_0xd54a('0x19')](function(_0x3b927c){logger[_0xd54a('0x11')]('GetCmHopper',_0x3b927c[_0xd54a('0x12')],_0x916e7b);_0x494040(_0xa3b250['error'](0x1f4,_0x3b927c['message']));});});});};exports[_0xd54a('0x42')]=function(_0x2fab85){var _0x2ca386=this;return new Promise(function(_0x84fe62,_0x4798fa){return db[_0xd54a('0x22')][_0xd54a('0x43')]({'raw':!![],'where':{'phone':_0x2fab85['options'][_0xd54a('0x9')][_0xd54a('0x44')]},'attributes':['id',_0xd54a('0x45')],'order':[['id',_0xd54a('0x46')]]})[_0xd54a('0x14')](function(_0x384fd5){logger[_0xd54a('0xe')](_0xd54a('0x47'),_0x2fab85);logger[_0xd54a('0xf')](_0xd54a('0x47'),_0x2fab85,JSON['stringify'](_0x384fd5));_0x84fe62(_0x384fd5);})['catch'](function(_0x5b4ed4){logger[_0xd54a('0x11')](_0xd54a('0x47'),_0x5b4ed4[_0xd54a('0x12')],_0x2fab85);_0x4798fa(_0x2ca386['error'](0x1f4,_0x5b4ed4[_0xd54a('0x12')]));});});};exports['ResetActiveCalls']=function(_0x1c89d1){var _0x479a56=this;return new Promise(function(_0x158c97,_0x4ef5e8){return db[_0xd54a('0x24')][_0xd54a('0x36')](function(_0x1a15cc){var _0x438b82=_0x1c89d1[_0xd54a('0x7')]&&_0x1c89d1[_0xd54a('0x7')][_0xd54a('0x9')]?_0x1c89d1[_0xd54a('0x7')][_0xd54a('0x9')]:{};return db['CmHopper'][_0xd54a('0x1b')](_0x1c89d1[_0xd54a('0x18')],{'where':_0x438b82,'transaction':_0x1a15cc})[_0xd54a('0x14')](function(_0x599d08){logger[_0xd54a('0xe')](_0xd54a('0x48'),_0x1c89d1);logger['debug']('ResetActiveCalls',_0x1c89d1,JSON[_0xd54a('0x10')](_0x599d08));_0x158c97(_0x599d08);})[_0xd54a('0x19')](function(_0x505686){logger[_0xd54a('0x11')](_0xd54a('0x48'),_0x505686[_0xd54a('0x12')],_0x1c89d1);_0x4ef5e8(_0x479a56[_0xd54a('0x11')](0x1f4,_0x505686[_0xd54a('0x12')]));});});});};exports[_0xd54a('0x49')]=function(_0x573ed9){var _0x423aa7=this;var _0x443930=_0x573ed9[_0xd54a('0x18')][_0xd54a('0x9')]['voiceQueueIds'];var _0x3b7228=_0x573ed9[_0xd54a('0x18')][_0xd54a('0x9')][_0xd54a('0x4a')];var _0x386a49=_0x573ed9['body'][_0xd54a('0x9')][_0xd54a('0x4b')];return new Promise(function(_0x42292a,_0x14a468){return db[_0xd54a('0x5')]['findAll']({'where':{'voiceQueueId':{'$in':_0x443930},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db[_0xd54a('0x24')][_0xd54a('0x4c')](_0xd54a('0x4d')+_0x3b7228+_0xd54a('0x4e')),'$gt':db[_0xd54a('0x24')][_0xd54a('0x4c')]('NOW()')}},'UserId':{'$in':_0x386a49}},'include':[{'model':db['CmContact'],'as':_0xd54a('0x28')},{'model':db[_0xd54a('0x2a')],'as':_0xd54a('0x2b'),'attributes':['id',_0xd54a('0x2c'),'voicePause']},{'model':db[_0xd54a('0x4f')],'as':_0xd54a('0x50')}]})[_0xd54a('0x14')](function(_0x124047){if(_0x124047[_0xd54a('0x32')]>0x0){return db[_0xd54a('0x24')][_0xd54a('0x36')](function(_0x4a0001){return db[_0xd54a('0x5')][_0xd54a('0x1b')]({'recallmeNotifiedDate':db[_0xd54a('0x24')]['literal'](_0xd54a('0x51'))},{'where':{'id':{'$in':_[_0xd54a('0xd')](_0x124047,'id')}},'transaction':_0x4a0001})['then'](function(){_0x42292a(_0x124047);})[_0xd54a('0x19')](function(_0x3e48cb){logger[_0xd54a('0x11')](_0xd54a('0x49'),_0x3e48cb['message'],_0x573ed9);_0x14a468(_0x423aa7[_0xd54a('0x11')](0x1f4,_0x3e48cb[_0xd54a('0x12')]));});})[_0xd54a('0x19')](function(_0x120787){logger[_0xd54a('0x11')](_0xd54a('0x49'),_0x120787[_0xd54a('0x12')],_0x573ed9);_0x14a468(_0x423aa7[_0xd54a('0x11')](0x1f4,_0x120787[_0xd54a('0x12')]));});}else{_0x42292a(_0x124047);}});});}; \ No newline at end of file +var _0x3c8b=['COUNT','literal','`scheduledat`\x20>=\x20','format','YYYY-MM-DD\x20HH:mm:ss','contactsRescheduled','GetContactRecallMe','GetCmHopperPreview','Contact','GetContactByPhone','phone','dialTimezone','getContactByPhone','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','interval','NOW()\x20+\x20INTERVAL\x20','NOW()','CmList','List','util','bluebird','../../mysqldb','../../config/logger','GetCmHopper','CmHopper','findAll','options','raw','where','limit','include','map','attributes','then','debug','stringify','catch','error','message','ShowCmHopper','model','info','body','CreateCmHopper','update','UpdateCmHopper','active','DestroyCmHopper','sequelize','transaction','order','LOCK','UPDATE','CmContact','keys','User','Agent','name','voicePause','length','UserId','push','includes','all','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','dataValues','ContactId','GetContactDialer','MoveContactManagedDialer','CmHopperFinal','create','MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','destroy','CountReScheduled'];(function(_0x45783c,_0x49c56d){var _0x1161da=function(_0x3c5d41){while(--_0x3c5d41){_0x45783c['push'](_0x45783c['shift']());}};_0x1161da(++_0x49c56d);}(_0x3c8b,0x18b));var _0xb3c8=function(_0x39996a,_0x1b42f3){_0x39996a=_0x39996a-0x0;var _0x118f51=_0x3c8b[_0x39996a];return _0x118f51;};'use strict';var _=require('lodash');var util=require(_0xb3c8('0x0'));var moment=require('moment');var BPromise=require(_0xb3c8('0x1'));var db=require(_0xb3c8('0x2'))['db'];var logger=require(_0xb3c8('0x3'))('rpc');exports[_0xb3c8('0x4')]=function(_0x4691d0){var _0x3bc283=this;return new Promise(function(_0x45e091,_0x41b492){return db[_0xb3c8('0x5')][_0xb3c8('0x6')]({'raw':_0x4691d0[_0xb3c8('0x7')]?_0x4691d0['options'][_0xb3c8('0x8')]===undefined?!![]:![]:!![],'where':_0x4691d0['options']?_0x4691d0[_0xb3c8('0x7')][_0xb3c8('0x9')]||null:null,'attributes':_0x4691d0['options']?_0x4691d0['options']['attributes']||null:null,'limit':_0x4691d0[_0xb3c8('0x7')]?_0x4691d0[_0xb3c8('0x7')][_0xb3c8('0xa')]||null:null,'include':_0x4691d0['options']?_0x4691d0[_0xb3c8('0x7')][_0xb3c8('0xb')]?_[_0xb3c8('0xc')](_0x4691d0[_0xb3c8('0x7')]['include'],function(_0x1048ae){return{'model':db[_0x1048ae['model']],'as':_0x1048ae['as'],'attributes':_0x1048ae[_0xb3c8('0xd')],'include':_0x1048ae['include']?_[_0xb3c8('0xc')](_0x1048ae[_0xb3c8('0xb')],function(_0x34d866){return{'model':db[_0x34d866['model']],'as':_0x34d866['as'],'attributes':_0x34d866['attributes'],'include':_0x34d866[_0xb3c8('0xb')]?_[_0xb3c8('0xc')](_0x34d866[_0xb3c8('0xb')],function(_0x48a430){return{'model':db[_0x48a430['model']],'as':_0x48a430['as'],'attributes':_0x48a430[_0xb3c8('0xd')]};}):[]};}):[]};}):[]:[]})[_0xb3c8('0xe')](function(_0x124ab6){logger['info'](_0xb3c8('0x4'),_0x4691d0);logger[_0xb3c8('0xf')](_0xb3c8('0x4'),_0x4691d0,JSON[_0xb3c8('0x10')](_0x124ab6));_0x45e091(_0x124ab6);})[_0xb3c8('0x11')](function(_0x98399d){logger[_0xb3c8('0x12')](_0xb3c8('0x4'),_0x98399d[_0xb3c8('0x13')],_0x4691d0);_0x41b492(_0x3bc283['error'](0x1f4,_0x98399d['message']));});});};exports[_0xb3c8('0x14')]=function(_0x5390cc){var _0x4d4bda=this;return new Promise(function(_0x433549,_0x4df53e){return db[_0xb3c8('0x5')]['find']({'raw':_0x5390cc['options']?_0x5390cc[_0xb3c8('0x7')]['raw']===undefined?!![]:![]:!![],'where':_0x5390cc[_0xb3c8('0x7')]?_0x5390cc[_0xb3c8('0x7')][_0xb3c8('0x9')]||null:null,'attributes':_0x5390cc['options']?_0x5390cc[_0xb3c8('0x7')]['attributes']||null:null,'include':_0x5390cc[_0xb3c8('0x7')]?_0x5390cc[_0xb3c8('0x7')][_0xb3c8('0xb')]?_[_0xb3c8('0xc')](_0x5390cc[_0xb3c8('0x7')][_0xb3c8('0xb')],function(_0x27c593){return{'model':db[_0x27c593[_0xb3c8('0x15')]],'as':_0x27c593['as'],'attributes':_0x27c593[_0xb3c8('0xd')],'include':_0x27c593['include']?_[_0xb3c8('0xc')](_0x27c593['include'],function(_0x1765b9){return{'model':db[_0x1765b9[_0xb3c8('0x15')]],'as':_0x1765b9['as'],'attributes':_0x1765b9[_0xb3c8('0xd')],'include':_0x1765b9[_0xb3c8('0xb')]?_['map'](_0x1765b9[_0xb3c8('0xb')],function(_0x657ae1){return{'model':db[_0x657ae1[_0xb3c8('0x15')]],'as':_0x657ae1['as'],'attributes':_0x657ae1[_0xb3c8('0xd')]};}):[]};}):[]};}):[]:[]})[_0xb3c8('0xe')](function(_0x24de08){logger[_0xb3c8('0x16')]('ShowCmHopper',_0x5390cc);logger[_0xb3c8('0xf')](_0xb3c8('0x14'),_0x5390cc,JSON['stringify'](_0x24de08));_0x433549(_0x24de08);})[_0xb3c8('0x11')](function(_0xdc197e){logger[_0xb3c8('0x12')](_0xb3c8('0x14'),_0xdc197e[_0xb3c8('0x13')],_0x5390cc);_0x4df53e(_0x4d4bda[_0xb3c8('0x12')](0x1f4,_0xdc197e[_0xb3c8('0x13')]));});});};exports['CreateCmHopper']=function(_0x30ee51){var _0x29eb72=this;return new Promise(function(_0x31691e,_0x320e3f){return db[_0xb3c8('0x5')]['create'](_0x30ee51[_0xb3c8('0x17')],{'raw':_0x30ee51[_0xb3c8('0x7')]?_0x30ee51[_0xb3c8('0x7')][_0xb3c8('0x8')]===undefined?!![]:![]:!![]})[_0xb3c8('0xe')](function(_0x255409){logger[_0xb3c8('0x16')](_0xb3c8('0x18'),_0x30ee51);logger[_0xb3c8('0xf')]('CreateCmHopper',_0x30ee51,JSON[_0xb3c8('0x10')](_0x255409));_0x31691e(_0x255409);})['catch'](function(_0x33e1eb){logger[_0xb3c8('0x12')](_0xb3c8('0x18'),_0x33e1eb[_0xb3c8('0x13')],_0x30ee51);_0x320e3f(_0x29eb72[_0xb3c8('0x12')](0x1f4,_0x33e1eb[_0xb3c8('0x13')]));});});};exports['UpdateCmHopper']=function(_0x1fe1bb){var _0x4a7c9d=this;return new Promise(function(_0x3e825d,_0xbccb32){return db[_0xb3c8('0x5')][_0xb3c8('0x19')](_0x1fe1bb['body'],{'raw':_0x1fe1bb[_0xb3c8('0x7')]?_0x1fe1bb[_0xb3c8('0x7')][_0xb3c8('0x8')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1fe1bb[_0xb3c8('0x7')]?_0x1fe1bb[_0xb3c8('0x7')][_0xb3c8('0x9')]||null:null,'attributes':_0x1fe1bb['options']?_0x1fe1bb[_0xb3c8('0x7')][_0xb3c8('0xd')]||null:null,'limit':_0x1fe1bb[_0xb3c8('0x7')]?_0x1fe1bb[_0xb3c8('0x7')][_0xb3c8('0xa')]||null:null})['then'](function(_0x4bcac9){logger[_0xb3c8('0x16')](_0xb3c8('0x1a'),_0x1fe1bb);logger[_0xb3c8('0x16')]('UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]',JSON[_0xb3c8('0x10')](_0x1fe1bb['options'][_0xb3c8('0x9')]),_0x1fe1bb[_0xb3c8('0x17')][_0xb3c8('0x1b')]);logger['debug'](_0xb3c8('0x1a'),_0x1fe1bb,JSON[_0xb3c8('0x10')](_0x4bcac9));_0x3e825d(_0x4bcac9);})[_0xb3c8('0x11')](function(_0x24cdf4){logger[_0xb3c8('0x12')](_0xb3c8('0x1a'),_0x24cdf4[_0xb3c8('0x13')],_0x1fe1bb);_0xbccb32(_0x4a7c9d[_0xb3c8('0x12')](0x1f4,_0x24cdf4[_0xb3c8('0x13')]));});});};exports[_0xb3c8('0x1c')]=function(_0x4f97af){var _0x3dbfe1=this;return new Promise(function(_0x102cd8,_0xb4aab3){return db[_0xb3c8('0x5')]['destroy']({'where':_0x4f97af['options']?_0x4f97af[_0xb3c8('0x7')][_0xb3c8('0x9')]||null:null})[_0xb3c8('0xe')](function(_0x59d5e2){logger[_0xb3c8('0x16')](_0xb3c8('0x1c'),_0x4f97af);logger[_0xb3c8('0xf')](_0xb3c8('0x1c'),_0x4f97af,JSON[_0xb3c8('0x10')](_0x59d5e2));_0x102cd8(_0x59d5e2);})['catch'](function(_0x350583){logger[_0xb3c8('0x12')](_0xb3c8('0x1c'),_0x350583['message'],_0x4f97af);_0xb4aab3(_0x3dbfe1['error'](0x1f4,_0x350583[_0xb3c8('0x13')]));});});};exports['GetContactDialer']=function(_0xba8c6c){var _0xe3af73=this;return new Promise(function(_0x46cb74,_0x395ed9){return db['CmContact']['describe']()[_0xb3c8('0xe')](function(_0x29010c){return db[_0xb3c8('0x1d')][_0xb3c8('0x1e')](function(_0x51b6e3){return db['CmHopper']['findAll']({'where':_0xba8c6c[_0xb3c8('0x7')]?_0xba8c6c[_0xb3c8('0x7')][_0xb3c8('0x9')]||null:null,'attributes':_0xba8c6c[_0xb3c8('0x7')]?_0xba8c6c[_0xb3c8('0x7')]['attributes']||null:null,'limit':_0xba8c6c[_0xb3c8('0x7')]?_0xba8c6c[_0xb3c8('0x7')][_0xb3c8('0xa')]||null:null,'order':_0xba8c6c[_0xb3c8('0x7')]?_0xba8c6c[_0xb3c8('0x7')][_0xb3c8('0x1f')]||null:null,'transaction':_0x51b6e3,'lock':_0x51b6e3[_0xb3c8('0x20')][_0xb3c8('0x21')],'include':[{'model':db[_0xb3c8('0x22')],'as':'Contact','attributes':_[_0xb3c8('0x23')](_0x29010c)},{'model':db[_0xb3c8('0x24')],'as':_0xb3c8('0x25'),'attributes':['id',_0xb3c8('0x26'),_0xb3c8('0x27')]}]})['then'](function(_0x3da4a3){var _0x53e414=[];var _0x21f072=[];for(var _0xd67544=0x0;_0xd67544<_0x3da4a3[_0xb3c8('0x28')];_0xd67544+=0x1){var _0xf742b5=_0x3da4a3[_0xd67544][_0xb3c8('0x29')];if(_0xf742b5===null){_0x53e414[_0xb3c8('0x2a')](_0x3da4a3[_0xd67544][_0xb3c8('0x19')](_0xba8c6c[_0xb3c8('0x17')],{'transaction':_0x51b6e3}));}else if(!_0x21f072[_0xb3c8('0x2b')](_0xf742b5)){_0x21f072[_0xb3c8('0x2a')](_0xf742b5);_0x53e414[_0xb3c8('0x2a')](_0x3da4a3[_0xd67544][_0xb3c8('0x19')](_0xba8c6c['body'],{'transaction':_0x51b6e3}));}}return BPromise[_0xb3c8('0x2c')](_0x53e414);});})[_0xb3c8('0xe')](function(_0x189bc0){logger[_0xb3c8('0x16')]('GetContactDialer',_0xba8c6c);if(_0x189bc0[_0xb3c8('0x28')]>0x0){logger['info'](_0xb3c8('0x2d'),_0x189bc0[0x0][_0xb3c8('0x2e')]['id'],_0x189bc0[0x0]['dataValues'][_0xb3c8('0x2f')],_0x189bc0[0x0]['dataValues'][_0xb3c8('0x1b')]);}logger[_0xb3c8('0xf')](_0xb3c8('0x30'),_0xba8c6c,JSON[_0xb3c8('0x10')](_0x189bc0));_0x46cb74(_0x189bc0);})[_0xb3c8('0x11')](function(_0x195224){logger[_0xb3c8('0x12')](_0xb3c8('0x30'),_0x195224['message'],_0xba8c6c);_0x395ed9(_0xe3af73[_0xb3c8('0x12')](0x1f4,_0x195224[_0xb3c8('0x13')]));});});});};exports[_0xb3c8('0x31')]=function(_0x2cf96d){var _0x319aea=this;return new Promise(function(_0x116d30,_0x2f19bc){return db[_0xb3c8('0x1d')][_0xb3c8('0x1e')](function(_0x495955){return db[_0xb3c8('0x32')][_0xb3c8('0x33')](_0x2cf96d['body'],{'raw':_0x2cf96d[_0xb3c8('0x7')]?_0x2cf96d[_0xb3c8('0x7')]['raw']===undefined?!![]:![]:!![],'transaction':_0x495955})[_0xb3c8('0xe')](function(){logger[_0xb3c8('0x16')](_0xb3c8('0x34'),JSON[_0xb3c8('0x10')](_0x2cf96d[_0xb3c8('0x7')]['where']),_0x2cf96d[_0xb3c8('0x7')][_0xb3c8('0x9')][_0xb3c8('0x1b')]);return db[_0xb3c8('0x5')][_0xb3c8('0x35')]({'where':_0x2cf96d[_0xb3c8('0x7')]?_0x2cf96d[_0xb3c8('0x7')][_0xb3c8('0x9')]||null:null,'transaction':_0x495955});});})[_0xb3c8('0xe')](function(_0xf3311d){logger[_0xb3c8('0x16')](_0xb3c8('0x31'),_0x2cf96d);logger[_0xb3c8('0xf')](_0xb3c8('0x31'),_0x2cf96d,JSON[_0xb3c8('0x10')](_0xf3311d));_0x116d30(_0xf3311d);})[_0xb3c8('0x11')](function(_0x528474){logger[_0xb3c8('0x12')](_0xb3c8('0x31'),_0x528474[_0xb3c8('0x13')],_0x2cf96d);_0x2f19bc(_0x319aea['error'](0x1f4,_0x528474['message']));});});};exports[_0xb3c8('0x36')]=function(_0x2b3856){var _0x955807=this;return new Promise(function(_0x92c13a,_0x2c51dd){return db[_0xb3c8('0x5')][_0xb3c8('0x6')]({'raw':_0x2b3856[_0xb3c8('0x7')]?_0x2b3856['options'][_0xb3c8('0x8')]===undefined?!![]:![]:!![],'where':_0x2b3856['options']?_0x2b3856['options'][_0xb3c8('0x9')]||null:null,'attributes':[[db[_0xb3c8('0x1d')]['fn'](_0xb3c8('0x37'),db[_0xb3c8('0x1d')]['fn']('IF',db[_0xb3c8('0x1d')][_0xb3c8('0x38')](_0xb3c8('0x39')+util[_0xb3c8('0x3a')]('\x22%s\x22',moment()[_0xb3c8('0x3a')](_0xb3c8('0x3b')))+'\x20,\x201,\x20null'))),_0xb3c8('0x3c')]]})['then'](function(_0x22f843){logger[_0xb3c8('0x16')](_0xb3c8('0x36'),_0x2b3856);logger['debug']('CountReScheduled',_0x2b3856,JSON['stringify'](_0x22f843));_0x92c13a(_0x22f843);})[_0xb3c8('0x11')](function(_0x100fd2){logger[_0xb3c8('0x12')]('CountReScheduled',_0x100fd2['message'],_0x2b3856);_0x2c51dd(_0x955807[_0xb3c8('0x12')](0x1f4,_0x100fd2[_0xb3c8('0x13')]));});});};exports[_0xb3c8('0x3d')]=function(_0x8376a3){var _0x387c38=this;return new Promise(function(_0x10273b,_0x45996a){return db[_0xb3c8('0x22')]['describe']()[_0xb3c8('0xe')](function(){return db['sequelize']['transaction'](function(_0x334400){return db[_0xb3c8('0x5')][_0xb3c8('0x6')]({'where':_0x8376a3[_0xb3c8('0x7')]?_0x8376a3[_0xb3c8('0x7')][_0xb3c8('0x9')]||null:null,'attributes':_0x8376a3[_0xb3c8('0x7')]?_0x8376a3[_0xb3c8('0x7')]['attributes']||null:null,'limit':0x1,'order':_0x8376a3[_0xb3c8('0x7')]?_0x8376a3[_0xb3c8('0x7')][_0xb3c8('0x1f')]||null:null,'group':db[_0xb3c8('0x5')][_0xb3c8('0x29')],'transaction':_0x334400,'lock':_0x334400[_0xb3c8('0x20')][_0xb3c8('0x21')],'include':_0x8376a3['options']?_0x8376a3['options'][_0xb3c8('0xb')]?_[_0xb3c8('0xc')](_0x8376a3[_0xb3c8('0x7')][_0xb3c8('0xb')],function(_0x57257d){return{'model':db[_0x57257d[_0xb3c8('0x15')]],'as':_0x57257d['as'],'attributes':_0x57257d[_0xb3c8('0xd')],'include':_0x57257d[_0xb3c8('0xb')]?_['map'](_0x57257d['include'],function(_0x23fb94){return{'model':db[_0x23fb94[_0xb3c8('0x15')]],'as':_0x23fb94['as'],'attributes':_0x23fb94[_0xb3c8('0xd')],'include':_0x23fb94[_0xb3c8('0xb')]?_[_0xb3c8('0xc')](_0x23fb94['include'],function(_0x3c1bef){return{'model':db[_0x3c1bef[_0xb3c8('0x15')]],'as':_0x3c1bef['as'],'attributes':_0x3c1bef[_0xb3c8('0xd')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2cd743){var _0x54b139=[];for(var _0x1a3d43=0x0;_0x1a3d43<_0x2cd743[_0xb3c8('0x28')];_0x1a3d43+=0x1){_0x54b139[_0xb3c8('0x2a')](_0x2cd743[_0x1a3d43][_0xb3c8('0x19')](_0x8376a3[_0xb3c8('0x17')],{'transaction':_0x334400}));}return BPromise[_0xb3c8('0x2c')](_0x54b139);});})[_0xb3c8('0xe')](function(_0x1509cb){logger[_0xb3c8('0x16')](_0xb3c8('0x3d'),_0x8376a3);logger[_0xb3c8('0xf')]('GetContactRecallMe',_0x8376a3,JSON[_0xb3c8('0x10')](_0x1509cb));_0x10273b(_0x1509cb);})['catch'](function(_0x1ecb2d){logger['error'](_0xb3c8('0x3d'),_0x1ecb2d[_0xb3c8('0x13')],_0x8376a3);_0x45996a(_0x387c38[_0xb3c8('0x12')](0x1f4,_0x1ecb2d[_0xb3c8('0x13')]));});});});};exports[_0xb3c8('0x3e')]=function(_0x41562c){var _0x1fe40e=this;return new Promise(function(_0x422993,_0x354f84){db[_0xb3c8('0x22')]['describe']()[_0xb3c8('0xe')](function(_0x5257a6){return db['CmHopper']['findAll']({'raw':_0x41562c['options']?_0x41562c[_0xb3c8('0x7')][_0xb3c8('0x8')]===undefined?!![]:![]:!![],'where':_0x41562c[_0xb3c8('0x7')]?_0x41562c['options']['where']||null:null,'attributes':_0x41562c[_0xb3c8('0x7')]?_0x41562c[_0xb3c8('0x7')][_0xb3c8('0xd')]||null:null,'limit':_0x41562c[_0xb3c8('0x7')]?_0x41562c[_0xb3c8('0x7')][_0xb3c8('0xa')]||null:null,'include':_0x41562c[_0xb3c8('0x7')]?_0x41562c['options']['include']?_[_0xb3c8('0xc')](_0x41562c[_0xb3c8('0x7')][_0xb3c8('0xb')],function(_0x36db3a){return{'model':db[_0x36db3a[_0xb3c8('0x15')]],'as':_0x36db3a['as'],'attributes':_0x36db3a['as']===_0xb3c8('0x3f')?_['keys'](_0x5257a6):_0x36db3a[_0xb3c8('0xd')],'include':_0x36db3a['include']?_[_0xb3c8('0xc')](_0x36db3a[_0xb3c8('0xb')],function(_0x42e40c){return{'model':db[_0x42e40c[_0xb3c8('0x15')]],'as':_0x42e40c['as'],'attributes':_0x42e40c[_0xb3c8('0xd')],'include':_0x42e40c[_0xb3c8('0xb')]?_[_0xb3c8('0xc')](_0x42e40c['include'],function(_0x2235f5){return{'model':db[_0x2235f5[_0xb3c8('0x15')]],'as':_0x2235f5['as'],'attributes':_0x2235f5[_0xb3c8('0xd')]};}):[]};}):[]};}):[]:[]})[_0xb3c8('0xe')](function(_0x1ad01a){logger[_0xb3c8('0x16')](_0xb3c8('0x4'),_0x41562c);logger[_0xb3c8('0xf')](_0xb3c8('0x4'),_0x41562c,JSON[_0xb3c8('0x10')](_0x1ad01a));_0x422993(_0x1ad01a);})[_0xb3c8('0x11')](function(_0x76fda1){logger[_0xb3c8('0x12')]('GetCmHopper',_0x76fda1['message'],_0x41562c);_0x354f84(_0x1fe40e[_0xb3c8('0x12')](0x1f4,_0x76fda1['message']));});});});};exports[_0xb3c8('0x40')]=function(_0x433a0d){var _0x3e7e5a=this;return new Promise(function(_0x13789c,_0x3fca4f){return db['CmContact']['findOne']({'raw':!![],'where':{'phone':_0x433a0d[_0xb3c8('0x7')][_0xb3c8('0x9')][_0xb3c8('0x41')]},'attributes':['id',_0xb3c8('0x42')],'order':[['id','DESC']]})[_0xb3c8('0xe')](function(_0x5bdb6b){logger[_0xb3c8('0x16')](_0xb3c8('0x43'),_0x433a0d);logger['debug'](_0xb3c8('0x43'),_0x433a0d,JSON['stringify'](_0x5bdb6b));_0x13789c(_0x5bdb6b);})['catch'](function(_0x5107dc){logger[_0xb3c8('0x12')](_0xb3c8('0x43'),_0x5107dc[_0xb3c8('0x13')],_0x433a0d);_0x3fca4f(_0x3e7e5a[_0xb3c8('0x12')](0x1f4,_0x5107dc['message']));});});};exports[_0xb3c8('0x44')]=function(_0x21f58e){var _0x58550a=this;return new Promise(function(_0x309f07,_0x4ac1fa){return db[_0xb3c8('0x1d')][_0xb3c8('0x1e')](function(_0x7601d6){var _0x598418=_0x21f58e[_0xb3c8('0x7')]&&_0x21f58e[_0xb3c8('0x7')][_0xb3c8('0x9')]?_0x21f58e[_0xb3c8('0x7')]['where']:{};return db['CmHopper'][_0xb3c8('0x19')](_0x21f58e['body'],{'where':_0x598418,'transaction':_0x7601d6})['then'](function(_0x2bd086){logger[_0xb3c8('0x16')](_0xb3c8('0x44'),_0x21f58e);logger[_0xb3c8('0xf')](_0xb3c8('0x44'),_0x21f58e,JSON[_0xb3c8('0x10')](_0x2bd086));_0x309f07(_0x2bd086);})[_0xb3c8('0x11')](function(_0x2f973a){logger[_0xb3c8('0x12')](_0xb3c8('0x44'),_0x2f973a[_0xb3c8('0x13')],_0x21f58e);_0x4ac1fa(_0x58550a[_0xb3c8('0x12')](0x1f4,_0x2f973a[_0xb3c8('0x13')]));});});});};exports[_0xb3c8('0x45')]=function(_0x1dd1c7){var _0x545c73=this;var _0x4e8723=_0x1dd1c7[_0xb3c8('0x17')][_0xb3c8('0x9')]['voiceQueueIds'];var _0x58c949=_0x1dd1c7[_0xb3c8('0x17')][_0xb3c8('0x9')][_0xb3c8('0x46')];var _0x1bed72=_0x1dd1c7[_0xb3c8('0x17')][_0xb3c8('0x9')]['availableAgentsIds'];return new Promise(function(_0x4ea664,_0x258721){return db[_0xb3c8('0x5')][_0xb3c8('0x6')]({'where':{'voiceQueueId':{'$in':_0x4e8723},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db['sequelize'][_0xb3c8('0x38')](_0xb3c8('0x47')+_0x58c949+'\x20MINUTE'),'$gt':db[_0xb3c8('0x1d')]['literal'](_0xb3c8('0x48'))}},'UserId':{'$in':_0x1bed72}},'include':[{'model':db[_0xb3c8('0x22')],'as':_0xb3c8('0x3f')},{'model':db[_0xb3c8('0x24')],'as':_0xb3c8('0x25'),'attributes':['id',_0xb3c8('0x26'),_0xb3c8('0x27')]},{'model':db[_0xb3c8('0x49')],'as':_0xb3c8('0x4a')}]})[_0xb3c8('0xe')](function(_0x48cd37){if(_0x48cd37[_0xb3c8('0x28')]>0x0){return db[_0xb3c8('0x1d')]['transaction'](function(_0x1db0c0){return db[_0xb3c8('0x5')][_0xb3c8('0x19')]({'recallmeNotifiedDate':db[_0xb3c8('0x1d')]['literal'](_0xb3c8('0x48'))},{'where':{'id':{'$in':_[_0xb3c8('0xc')](_0x48cd37,'id')}},'transaction':_0x1db0c0})['then'](function(){_0x4ea664(_0x48cd37);})['catch'](function(_0x1798ba){logger[_0xb3c8('0x12')]('CmHopperHandlePreviewRecallNotifications',_0x1798ba[_0xb3c8('0x13')],_0x1dd1c7);_0x258721(_0x545c73['error'](0x1f4,_0x1798ba[_0xb3c8('0x13')]));});})[_0xb3c8('0x11')](function(_0xd6364e){logger[_0xb3c8('0x12')](_0xb3c8('0x45'),_0xd6364e[_0xb3c8('0x13')],_0x1dd1c7);_0x258721(_0x545c73[_0xb3c8('0x12')](0x1f4,_0xd6364e['message']));});}else{_0x4ea664(_0x48cd37);}});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index 83aea14..f6bc570 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 _0x0c12=['exports','Router','../../components/auth/service','./cmHopper.controller','get','isAuthenticated','/describe','/opencontacts','getOpenContacts','getTimezones','/:id','show','getPreviewRecall','post','/preview','getPreview','/timezone','getTimezone','put','update','destroy'];(function(_0x2f0ee3,_0x177e5f){var _0x4cf23a=function(_0x139006){while(--_0x139006){_0x2f0ee3['push'](_0x2f0ee3['shift']());}};_0x4cf23a(++_0x177e5f);}(_0x0c12,0xd3));var _0x20c1=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x0c12[_0x40a045];return _0x1a687c;};'use strict';var express=require('express');var router=express[_0x20c1('0x0')]();var auth=require(_0x20c1('0x1'));var controller=require(_0x20c1('0x2'));router[_0x20c1('0x3')]('/',auth[_0x20c1('0x4')](),controller['index']);router[_0x20c1('0x3')](_0x20c1('0x5'),auth[_0x20c1('0x4')](),controller['describe']);router['get'](_0x20c1('0x6'),auth['isAuthenticated'](),controller[_0x20c1('0x7')]);router[_0x20c1('0x3')]('/timezones',auth['isAuthenticated'](),controller[_0x20c1('0x8')]);router['get'](_0x20c1('0x9'),auth[_0x20c1('0x4')](),controller[_0x20c1('0xa')]);router[_0x20c1('0x3')]('/:id/previewrecall',auth[_0x20c1('0x4')](),controller[_0x20c1('0xb')]);router['post']('/',auth[_0x20c1('0x4')](),controller['create']);router[_0x20c1('0xc')](_0x20c1('0xd'),auth[_0x20c1('0x4')](),controller[_0x20c1('0xe')]);router[_0x20c1('0xc')](_0x20c1('0xf'),auth['isAuthenticated'](),controller[_0x20c1('0x10')]);router[_0x20c1('0x11')](_0x20c1('0x9'),auth[_0x20c1('0x4')](),controller[_0x20c1('0x12')]);router['delete'](_0x20c1('0x9'),auth[_0x20c1('0x4')](),controller[_0x20c1('0x13')]);module[_0x20c1('0x14')]=router; \ No newline at end of file +var _0x1f83=['getPreview','/timezone','getTimezone','put','delete','destroy','exports','../../components/auth/service','get','index','/describe','isAuthenticated','/opencontacts','getOpenContacts','/timezones','getTimezones','/:id','show','/:id/previewrecall','getPreviewRecall','post','/preview'];(function(_0x26bb7d,_0x476b43){var _0x14f17f=function(_0x1b5ccb){while(--_0x1b5ccb){_0x26bb7d['push'](_0x26bb7d['shift']());}};_0x14f17f(++_0x476b43);}(_0x1f83,0xa1));var _0x31f8=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x1f83[_0x3ab51d];return _0x29a04e;};'use strict';var express=require('express');var router=express['Router']();var auth=require(_0x31f8('0x0'));var controller=require('./cmHopper.controller');router[_0x31f8('0x1')]('/',auth['isAuthenticated'](),controller[_0x31f8('0x2')]);router[_0x31f8('0x1')](_0x31f8('0x3'),auth[_0x31f8('0x4')](),controller['describe']);router[_0x31f8('0x1')](_0x31f8('0x5'),auth['isAuthenticated'](),controller[_0x31f8('0x6')]);router[_0x31f8('0x1')](_0x31f8('0x7'),auth[_0x31f8('0x4')](),controller[_0x31f8('0x8')]);router[_0x31f8('0x1')](_0x31f8('0x9'),auth[_0x31f8('0x4')](),controller[_0x31f8('0xa')]);router[_0x31f8('0x1')](_0x31f8('0xb'),auth['isAuthenticated'](),controller[_0x31f8('0xc')]);router[_0x31f8('0xd')]('/',auth[_0x31f8('0x4')](),controller['create']);router[_0x31f8('0xd')](_0x31f8('0xe'),auth[_0x31f8('0x4')](),controller[_0x31f8('0xf')]);router['post'](_0x31f8('0x10'),auth[_0x31f8('0x4')](),controller[_0x31f8('0x11')]);router[_0x31f8('0x12')](_0x31f8('0x9'),auth[_0x31f8('0x4')](),controller['update']);router[_0x31f8('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x31f8('0x14')]);module[_0x31f8('0x15')]=router; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js index 01bc53e..9a35f27 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 _0x9b20=['YYYY-MM-DD\x20HH:mm:ss','moment','sequelize','INTEGER','STRING','DATE','format'];(function(_0x102155,_0x5f4c9f){var _0x2c6bd2=function(_0x566cd1){while(--_0x566cd1){_0x102155['push'](_0x102155['shift']());}};_0x2c6bd2(++_0x5f4c9f);}(_0x9b20,0x112));var _0x09b2=function(_0x27a4e0,_0x4816f5){_0x27a4e0=_0x27a4e0-0x0;var _0x2b57c7=_0x9b20[_0x27a4e0];return _0x2b57c7;};'use strict';var moment=require(_0x09b2('0x0'));var Sequelize=require(_0x09b2('0x1'));module['exports']={'CmHopperId':{'type':Sequelize[_0x09b2('0x2')]},'phone':{'type':Sequelize[_0x09b2('0x3')],'allowNull':![]},'OrderBy':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0x09b2('0x4')],'defaultValue':moment()[_0x09b2('0x5')](_0x09b2('0x6'))},'countbusyretry':{'type':Sequelize[_0x09b2('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x09b2('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0x09b2('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x09b2('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x09b2('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x09b2('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xa448=['moment','sequelize','STRING','INTEGER','DATE','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x1007d9,_0x2ca7a2){var _0x3515d3=function(_0x14730f){while(--_0x14730f){_0x1007d9['push'](_0x1007d9['shift']());}};_0x3515d3(++_0x2ca7a2);}(_0xa448,0x7e));var _0x8a44=function(_0x3ded30,_0xd630ad){_0x3ded30=_0x3ded30-0x0;var _0x471895=_0xa448[_0x3ded30];return _0x471895;};'use strict';var moment=require(_0x8a44('0x0'));var Sequelize=require(_0x8a44('0x1'));module['exports']={'CmHopperId':{'type':Sequelize['INTEGER']},'phone':{'type':Sequelize[_0x8a44('0x2')],'allowNull':![]},'OrderBy':{'type':Sequelize[_0x8a44('0x3')],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0x8a44('0x4')],'defaultValue':moment()[_0x8a44('0x5')](_0x8a44('0x6'))},'countbusyretry':{'type':Sequelize[_0x8a44('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x8a44('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x8a44('0x3')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0x8a44('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x8a44('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x8a44('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x8a44('0x3')],'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 cd18dd0..153a077 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 _0x9727=['filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','type','VIRTUAL','merge','options','CmHopperAdditionalPhone','includeAll','rows','catch','show','params','keys','include','find','create','body','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','moment','bluebird','mustache','util','path','sox','to-csv','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','json','offset','undefined','limit','count','status','set','Content-Range','apply','reject','update','then','destroy','get','CmHopperAdditionalPhones','end','sendStatus','error','stack','name','send','index','fieldName','key','model','map','query'];(function(_0x632b76,_0x245607){var _0x13b7e9=function(_0x178fec){while(--_0x178fec){_0x632b76['push'](_0x632b76['shift']());}};_0x13b7e9(++_0x245607);}(_0x9727,0x105));var _0x7972=function(_0x291aaf,_0x4c6d8d){_0x291aaf=_0x291aaf-0x0;var _0x5571e6=_0x9727[_0x291aaf];return _0x5571e6;};'use strict';var emlformat=require(_0x7972('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x7972('0x1'));var BPromise=require(_0x7972('0x2'));var Mustache=require(_0x7972('0x3'));var util=require(_0x7972('0x4'));var path=require(_0x7972('0x5'));var sox=require(_0x7972('0x6'));var csv=require(_0x7972('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x7972('0x8'));var jsforce=require(_0x7972('0x9'));var deskjs=require(_0x7972('0xa'));var toCsv=require(_0x7972('0x7'));var querystring=require(_0x7972('0xb'));var Papa=require(_0x7972('0xc'));var Redis=require('ioredis');var authService=require(_0x7972('0xd'));var qs=require(_0x7972('0xe'));var as=require(_0x7972('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7972('0x10'))(_0x7972('0x11'));var utils=require(_0x7972('0x12'));var config=require(_0x7972('0x13'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x377c09,_0x5ae95f){_0x5ae95f=_0x5ae95f||0xcc;return function(_0x4ac45e){if(_0x4ac45e){return _0x377c09['sendStatus'](_0x5ae95f);}return _0x377c09['status'](_0x5ae95f)['end']();};}function respondWithResult(_0x4f1118,_0x513a54){_0x513a54=_0x513a54||0xc8;return function(_0x420c2d){if(_0x420c2d){return _0x4f1118['status'](_0x513a54)[_0x7972('0x14')](_0x420c2d);}};}function respondWithFilteredResult(_0x46abb2,_0x56653c){return function(_0x57bdae){if(_0x57bdae){var _0x1bbcae=typeof _0x56653c[_0x7972('0x15')]===_0x7972('0x16')&&typeof _0x56653c[_0x7972('0x17')]===_0x7972('0x16');var _0xa43d4f=_0x57bdae[_0x7972('0x18')];var _0x4d9aad=_0x1bbcae?0x0:_0x56653c[_0x7972('0x15')];var _0xb7a3a1=_0x1bbcae?_0x57bdae[_0x7972('0x18')]:_0x56653c['offset']+_0x56653c[_0x7972('0x17')];var _0x2f194c;if(_0xb7a3a1>=_0xa43d4f){_0xb7a3a1=_0xa43d4f;_0x2f194c=0xc8;}else{_0x2f194c=0xce;}_0x46abb2[_0x7972('0x19')](_0x2f194c);return _0x46abb2[_0x7972('0x1a')](_0x7972('0x1b'),_0x4d9aad+'-'+_0xb7a3a1+'/'+_0xa43d4f)[_0x7972('0x14')](_0x57bdae);}return null;};}function patchUpdates(_0x19bae2){return function(_0x597322){try{jsonpatch[_0x7972('0x1c')](_0x597322,_0x19bae2,!![]);}catch(_0x111e2d){return BPromise[_0x7972('0x1d')](_0x111e2d);}return _0x597322['save']();};}function saveUpdates(_0x4501f2,_0x16194a){return function(_0x59c03c){if(_0x59c03c){return _0x59c03c[_0x7972('0x1e')](_0x4501f2)[_0x7972('0x1f')](function(_0x3bf598){return _0x3bf598;});}return null;};}function removeEntity(_0x51df08,_0x40033d){return function(_0x378dc0){if(_0x378dc0){return _0x378dc0[_0x7972('0x20')]()[_0x7972('0x1f')](function(){var _0x50617a=_0x378dc0[_0x7972('0x21')]({'plain':!![]});var _0x357ef1=_0x7972('0x22');return db['UserProfileResource'][_0x7972('0x20')]({'where':{'type':_0x357ef1,'resourceId':_0x50617a['id']}})['then'](function(){return _0x378dc0;});})[_0x7972('0x1f')](function(){_0x51df08[_0x7972('0x19')](0xcc)[_0x7972('0x23')]();});}};}function handleEntityNotFound(_0xa53006,_0x222da4){return function(_0x3dc436){if(!_0x3dc436){_0xa53006[_0x7972('0x24')](0x194);}return _0x3dc436;};}function handleError(_0x29013b,_0x5054b4){_0x5054b4=_0x5054b4||0x1f4;return function(_0x47bdbb){logger[_0x7972('0x25')](_0x47bdbb[_0x7972('0x26')]);if(_0x47bdbb[_0x7972('0x27')]){delete _0x47bdbb[_0x7972('0x27')];}_0x29013b[_0x7972('0x19')](_0x5054b4)[_0x7972('0x28')](_0x47bdbb);};}exports[_0x7972('0x29')]=function(_0x277765,_0x59d2e4){var _0xfda0ac={},_0xa4ac38={},_0x3b9ad6={'count':0x0,'rows':[]};var _0x24a965=_['map'](db['CmHopperAdditionalPhone']['rawAttributes'],function(_0x4c0de4){return{'name':_0x4c0de4[_0x7972('0x2a')],'type':_0x4c0de4['type'][_0x7972('0x2b')]};});_0xa4ac38[_0x7972('0x2c')]=_[_0x7972('0x2d')](_0x24a965,'name');_0xa4ac38[_0x7972('0x2e')]=_['keys'](_0x277765[_0x7972('0x2e')]);_0xa4ac38[_0x7972('0x2f')]=_[_0x7972('0x30')](_0xa4ac38[_0x7972('0x2c')],_0xa4ac38['query']);_0xfda0ac['attributes']=_[_0x7972('0x30')](_0xa4ac38[_0x7972('0x2c')],qs[_0x7972('0x31')](_0x277765[_0x7972('0x2e')]['fields']));_0xfda0ac[_0x7972('0x32')]=_0xfda0ac[_0x7972('0x32')][_0x7972('0x33')]?_0xfda0ac[_0x7972('0x32')]:_0xa4ac38[_0x7972('0x2c')];if(!_0x277765[_0x7972('0x2e')][_0x7972('0x34')](_0x7972('0x35'))){_0xfda0ac[_0x7972('0x17')]=qs[_0x7972('0x17')](_0x277765[_0x7972('0x2e')][_0x7972('0x17')]);_0xfda0ac[_0x7972('0x15')]=qs[_0x7972('0x15')](_0x277765[_0x7972('0x2e')]['offset']);}_0xfda0ac[_0x7972('0x36')]=qs[_0x7972('0x37')](_0x277765[_0x7972('0x2e')][_0x7972('0x37')]);_0xfda0ac[_0x7972('0x38')]=qs[_0x7972('0x2f')](_['pick'](_0x277765[_0x7972('0x2e')],_0xa4ac38['filters']),_0x24a965);if(_0x277765[_0x7972('0x2e')][_0x7972('0x39')]){_0xfda0ac['where']=_['merge'](_0xfda0ac[_0x7972('0x38')],{'$or':_[_0x7972('0x2d')](_0x24a965,function(_0x3f46fe){if(_0x3f46fe[_0x7972('0x3a')]!==_0x7972('0x3b')){var _0x5b4d8e={};_0x5b4d8e[_0x3f46fe[_0x7972('0x27')]]={'$like':'%'+_0x277765['query'][_0x7972('0x39')]+'%'};return _0x5b4d8e;}})});}_0xfda0ac=_[_0x7972('0x3c')]({},_0xfda0ac,_0x277765[_0x7972('0x3d')]);var _0x27a2a7={'where':_0xfda0ac[_0x7972('0x38')]};return db[_0x7972('0x3e')][_0x7972('0x18')](_0x27a2a7)[_0x7972('0x1f')](function(_0xef4440){_0x3b9ad6[_0x7972('0x18')]=_0xef4440;if(_0x277765['query'][_0x7972('0x3f')]){_0xfda0ac['include']=[{'all':!![]}];}return db[_0x7972('0x3e')]['findAll'](_0xfda0ac);})[_0x7972('0x1f')](function(_0x33bc37){_0x3b9ad6[_0x7972('0x40')]=_0x33bc37;return _0x3b9ad6;})[_0x7972('0x1f')](respondWithFilteredResult(_0x59d2e4,_0xfda0ac))[_0x7972('0x41')](handleError(_0x59d2e4,null));};exports[_0x7972('0x42')]=function(_0xdca41e,_0x1a0be9){var _0x402abf={'raw':!![],'where':{'id':_0xdca41e[_0x7972('0x43')]['id']}},_0x531983={};_0x531983['model']=_[_0x7972('0x44')](db[_0x7972('0x3e')]['rawAttributes']);_0x531983['query']=_[_0x7972('0x44')](_0xdca41e['query']);_0x531983[_0x7972('0x2f')]=_[_0x7972('0x30')](_0x531983[_0x7972('0x2c')],_0x531983[_0x7972('0x2e')]);_0x402abf[_0x7972('0x32')]=_[_0x7972('0x30')](_0x531983['model'],qs[_0x7972('0x31')](_0xdca41e[_0x7972('0x2e')][_0x7972('0x31')]));_0x402abf[_0x7972('0x32')]=_0x402abf[_0x7972('0x32')][_0x7972('0x33')]?_0x402abf[_0x7972('0x32')]:_0x531983[_0x7972('0x2c')];if(_0xdca41e[_0x7972('0x2e')][_0x7972('0x3f')]){_0x402abf[_0x7972('0x45')]=[{'all':!![]}];}_0x402abf=_[_0x7972('0x3c')]({},_0x402abf,_0xdca41e['options']);return db[_0x7972('0x3e')][_0x7972('0x46')](_0x402abf)[_0x7972('0x1f')](handleEntityNotFound(_0x1a0be9,null))['then'](respondWithResult(_0x1a0be9,null))[_0x7972('0x41')](handleError(_0x1a0be9,null));};exports[_0x7972('0x47')]=function(_0x1969b6,_0x378b87){return db[_0x7972('0x3e')]['create'](_0x1969b6[_0x7972('0x48')],{})['then'](function(_0x560372){var _0x11a400=_0x1969b6['user']['get']({'plain':!![]});if(!_0x11a400)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x11a400['role']==='user'){var _0x31ed29=_0x560372[_0x7972('0x21')]({'plain':!![]});var _0xbd6b9='CmHopperAdditionalPhones';return db[_0x7972('0x49')][_0x7972('0x46')]({'where':{'name':_0xbd6b9,'userProfileId':_0x11a400[_0x7972('0x4a')]},'raw':!![]})[_0x7972('0x1f')](function(_0x3ece9f){if(_0x3ece9f&&_0x3ece9f[_0x7972('0x4b')]===0x0){return db['UserProfileResource'][_0x7972('0x47')]({'name':_0x31ed29['name'],'resourceId':_0x31ed29['id'],'type':_0x3ece9f[_0x7972('0x27')],'sectionId':_0x3ece9f['id']},{})[_0x7972('0x1f')](function(){return _0x560372;});}else{return _0x560372;}})['catch'](function(_0x4a9626){logger[_0x7972('0x25')](_0x7972('0x4c'),_0x4a9626);throw _0x4a9626;});}return _0x560372;})[_0x7972('0x1f')](respondWithResult(_0x378b87,0xc9))[_0x7972('0x41')](handleError(_0x378b87,null));};exports[_0x7972('0x1e')]=function(_0x358390,_0x15159e){if(_0x358390['body']['id']){delete _0x358390['body']['id'];}return db[_0x7972('0x3e')][_0x7972('0x46')]({'where':{'id':_0x358390['params']['id']}})[_0x7972('0x1f')](handleEntityNotFound(_0x15159e,null))[_0x7972('0x1f')](saveUpdates(_0x358390[_0x7972('0x48')],null))[_0x7972('0x1f')](respondWithResult(_0x15159e,null))[_0x7972('0x41')](handleError(_0x15159e,null));};exports[_0x7972('0x20')]=function(_0x44b08b,_0x2e54ea){return db[_0x7972('0x3e')][_0x7972('0x46')]({'where':{'id':_0x44b08b[_0x7972('0x43')]['id']}})[_0x7972('0x1f')](handleEntityNotFound(_0x2e54ea,null))[_0x7972('0x1f')](removeEntity(_0x2e54ea,null))[_0x7972('0x41')](handleError(_0x2e54ea,null));}; \ No newline at end of file +var _0x9402=['stack','name','map','CmHopperAdditionalPhone','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','options','findAll','rows','catch','show','params','keys','rawAttributes','include','merge','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','CmHopperAdditionalPhones','UserProfileSection','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','undefined','count','Content-Range','save','update','then','destroy','UserProfileResource'];(function(_0x493030,_0x29ec7e){var _0x56f5e4=function(_0xb929a1){while(--_0xb929a1){_0x493030['push'](_0x493030['shift']());}};_0x56f5e4(++_0x29ec7e);}(_0x9402,0x165));var _0x2940=function(_0x402c13,_0x3da1a4){_0x402c13=_0x402c13-0x0;var _0x19662f=_0x9402[_0x402c13];return _0x19662f;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x2940('0x0'));var jsonpatch=require(_0x2940('0x1'));var rp=require(_0x2940('0x2'));var moment=require(_0x2940('0x3'));var BPromise=require(_0x2940('0x4'));var Mustache=require(_0x2940('0x5'));var util=require('util');var path=require(_0x2940('0x6'));var sox=require(_0x2940('0x7'));var csv=require(_0x2940('0x8'));var ejs=require(_0x2940('0x9'));var fs=require('fs');var fs_extra=require(_0x2940('0xa'));var _=require(_0x2940('0xb'));var squel=require(_0x2940('0xc'));var crypto=require(_0x2940('0xd'));var jsforce=require(_0x2940('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x2940('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x2940('0xf'));var qs=require(_0x2940('0x10'));var as=require(_0x2940('0x11'));var hardwareService=require(_0x2940('0x12'));var logger=require('../../config/logger')(_0x2940('0x13'));var utils=require(_0x2940('0x14'));var config=require(_0x2940('0x15'));var licenseUtil=require(_0x2940('0x16'));var db=require(_0x2940('0x17'))['db'];function respondWithStatusCode(_0x54c395,_0x2bef7e){_0x2bef7e=_0x2bef7e||0xcc;return function(_0x13a733){if(_0x13a733){return _0x54c395[_0x2940('0x18')](_0x2bef7e);}return _0x54c395['status'](_0x2bef7e)[_0x2940('0x19')]();};}function respondWithResult(_0x1aa1fb,_0x575647){_0x575647=_0x575647||0xc8;return function(_0x5f947){if(_0x5f947){return _0x1aa1fb[_0x2940('0x1a')](_0x575647)[_0x2940('0x1b')](_0x5f947);}};}function respondWithFilteredResult(_0x437efc,_0x20bec0){return function(_0x3967d0){if(_0x3967d0){var _0xec21f2=typeof _0x20bec0[_0x2940('0x1c')]==='undefined'&&typeof _0x20bec0[_0x2940('0x1d')]===_0x2940('0x1e');var _0x5ee0ea=_0x3967d0[_0x2940('0x1f')];var _0x2adc01=_0xec21f2?0x0:_0x20bec0[_0x2940('0x1c')];var _0x3e116f=_0xec21f2?_0x3967d0[_0x2940('0x1f')]:_0x20bec0[_0x2940('0x1c')]+_0x20bec0[_0x2940('0x1d')];var _0x52106d;if(_0x3e116f>=_0x5ee0ea){_0x3e116f=_0x5ee0ea;_0x52106d=0xc8;}else{_0x52106d=0xce;}_0x437efc[_0x2940('0x1a')](_0x52106d);return _0x437efc['set'](_0x2940('0x20'),_0x2adc01+'-'+_0x3e116f+'/'+_0x5ee0ea)['json'](_0x3967d0);}return null;};}function patchUpdates(_0x38dd40){return function(_0x526aa8){try{jsonpatch['apply'](_0x526aa8,_0x38dd40,!![]);}catch(_0xf9d66e){return BPromise['reject'](_0xf9d66e);}return _0x526aa8[_0x2940('0x21')]();};}function saveUpdates(_0x5177df,_0x44bca5){return function(_0x1101c6){if(_0x1101c6){return _0x1101c6[_0x2940('0x22')](_0x5177df)[_0x2940('0x23')](function(_0x44486f){return _0x44486f;});}return null;};}function removeEntity(_0x2895a3,_0xbb80b4){return function(_0x3201ea){if(_0x3201ea){return _0x3201ea[_0x2940('0x24')]()[_0x2940('0x23')](function(){var _0x2f406c=_0x3201ea['get']({'plain':!![]});var _0x273617='CmHopperAdditionalPhones';return db[_0x2940('0x25')]['destroy']({'where':{'type':_0x273617,'resourceId':_0x2f406c['id']}})[_0x2940('0x23')](function(){return _0x3201ea;});})['then'](function(){_0x2895a3['status'](0xcc)[_0x2940('0x19')]();});}};}function handleEntityNotFound(_0x3d7a0d,_0x46b041){return function(_0x8d22ae){if(!_0x8d22ae){_0x3d7a0d[_0x2940('0x18')](0x194);}return _0x8d22ae;};}function handleError(_0x4d3baa,_0x4b97c8){_0x4b97c8=_0x4b97c8||0x1f4;return function(_0x327550){logger['error'](_0x327550[_0x2940('0x26')]);if(_0x327550[_0x2940('0x27')]){delete _0x327550[_0x2940('0x27')];}_0x4d3baa[_0x2940('0x1a')](_0x4b97c8)['send'](_0x327550);};}exports['index']=function(_0x518294,_0x324bef){var _0x5992ca={},_0x425c03={},_0x5c0ee2={'count':0x0,'rows':[]};var _0x54ac39=_[_0x2940('0x28')](db[_0x2940('0x29')]['rawAttributes'],function(_0xfc4a60){return{'name':_0xfc4a60[_0x2940('0x2a')],'type':_0xfc4a60[_0x2940('0x2b')][_0x2940('0x2c')]};});_0x425c03[_0x2940('0x2d')]=_[_0x2940('0x28')](_0x54ac39,_0x2940('0x27'));_0x425c03[_0x2940('0x2e')]=_['keys'](_0x518294[_0x2940('0x2e')]);_0x425c03[_0x2940('0x2f')]=_[_0x2940('0x30')](_0x425c03['model'],_0x425c03[_0x2940('0x2e')]);_0x5992ca['attributes']=_['intersection'](_0x425c03[_0x2940('0x2d')],qs[_0x2940('0x31')](_0x518294[_0x2940('0x2e')][_0x2940('0x31')]));_0x5992ca[_0x2940('0x32')]=_0x5992ca[_0x2940('0x32')][_0x2940('0x33')]?_0x5992ca[_0x2940('0x32')]:_0x425c03[_0x2940('0x2d')];if(!_0x518294['query'][_0x2940('0x34')](_0x2940('0x35'))){_0x5992ca[_0x2940('0x1d')]=qs[_0x2940('0x1d')](_0x518294[_0x2940('0x2e')][_0x2940('0x1d')]);_0x5992ca[_0x2940('0x1c')]=qs['offset'](_0x518294['query']['offset']);}_0x5992ca[_0x2940('0x36')]=qs[_0x2940('0x37')](_0x518294['query'][_0x2940('0x37')]);_0x5992ca[_0x2940('0x38')]=qs[_0x2940('0x2f')](_[_0x2940('0x39')](_0x518294[_0x2940('0x2e')],_0x425c03[_0x2940('0x2f')]),_0x54ac39);if(_0x518294[_0x2940('0x2e')][_0x2940('0x3a')]){_0x5992ca[_0x2940('0x38')]=_['merge'](_0x5992ca[_0x2940('0x38')],{'$or':_[_0x2940('0x28')](_0x54ac39,function(_0x561b2c){if(_0x561b2c[_0x2940('0x2b')]!==_0x2940('0x3b')){var _0x52aad7={};_0x52aad7[_0x561b2c['name']]={'$like':'%'+_0x518294['query'][_0x2940('0x3a')]+'%'};return _0x52aad7;}})});}_0x5992ca=_['merge']({},_0x5992ca,_0x518294[_0x2940('0x3c')]);var _0x530d76={'where':_0x5992ca['where']};return db[_0x2940('0x29')][_0x2940('0x1f')](_0x530d76)['then'](function(_0x58b3ad){_0x5c0ee2[_0x2940('0x1f')]=_0x58b3ad;if(_0x518294[_0x2940('0x2e')]['includeAll']){_0x5992ca['include']=[{'all':!![]}];}return db[_0x2940('0x29')][_0x2940('0x3d')](_0x5992ca);})[_0x2940('0x23')](function(_0x35f017){_0x5c0ee2[_0x2940('0x3e')]=_0x35f017;return _0x5c0ee2;})['then'](respondWithFilteredResult(_0x324bef,_0x5992ca))[_0x2940('0x3f')](handleError(_0x324bef,null));};exports[_0x2940('0x40')]=function(_0x4bb98f,_0x2ee7ea){var _0x390e0f={'raw':!![],'where':{'id':_0x4bb98f[_0x2940('0x41')]['id']}},_0x506122={};_0x506122['model']=_[_0x2940('0x42')](db[_0x2940('0x29')][_0x2940('0x43')]);_0x506122[_0x2940('0x2e')]=_['keys'](_0x4bb98f[_0x2940('0x2e')]);_0x506122[_0x2940('0x2f')]=_[_0x2940('0x30')](_0x506122[_0x2940('0x2d')],_0x506122['query']);_0x390e0f[_0x2940('0x32')]=_[_0x2940('0x30')](_0x506122['model'],qs['fields'](_0x4bb98f['query'][_0x2940('0x31')]));_0x390e0f[_0x2940('0x32')]=_0x390e0f[_0x2940('0x32')][_0x2940('0x33')]?_0x390e0f[_0x2940('0x32')]:_0x506122[_0x2940('0x2d')];if(_0x4bb98f[_0x2940('0x2e')]['includeAll']){_0x390e0f[_0x2940('0x44')]=[{'all':!![]}];}_0x390e0f=_[_0x2940('0x45')]({},_0x390e0f,_0x4bb98f[_0x2940('0x3c')]);return db[_0x2940('0x29')]['find'](_0x390e0f)['then'](handleEntityNotFound(_0x2ee7ea,null))[_0x2940('0x23')](respondWithResult(_0x2ee7ea,null))[_0x2940('0x3f')](handleError(_0x2ee7ea,null));};exports[_0x2940('0x46')]=function(_0x20e0e8,_0x1f85ea){return db[_0x2940('0x29')][_0x2940('0x46')](_0x20e0e8[_0x2940('0x47')],{})['then'](function(_0x1dbd6a){var _0x9a95a=_0x20e0e8['user']['get']({'plain':!![]});if(!_0x9a95a)throw new Error(_0x2940('0x48'));if(_0x9a95a['role']==='user'){var _0x554294=_0x1dbd6a['get']({'plain':!![]});var _0x2a1c48=_0x2940('0x49');return db[_0x2940('0x4a')]['find']({'where':{'name':_0x2a1c48,'userProfileId':_0x9a95a[_0x2940('0x4b')]},'raw':!![]})['then'](function(_0x4e7163){if(_0x4e7163&&_0x4e7163['autoAssociation']===0x0){return db[_0x2940('0x25')][_0x2940('0x46')]({'name':_0x554294[_0x2940('0x27')],'resourceId':_0x554294['id'],'type':_0x4e7163[_0x2940('0x27')],'sectionId':_0x4e7163['id']},{})[_0x2940('0x23')](function(){return _0x1dbd6a;});}else{return _0x1dbd6a;}})['catch'](function(_0x42c8d3){logger[_0x2940('0x4c')](_0x2940('0x4d'),_0x42c8d3);throw _0x42c8d3;});}return _0x1dbd6a;})[_0x2940('0x23')](respondWithResult(_0x1f85ea,0xc9))[_0x2940('0x3f')](handleError(_0x1f85ea,null));};exports[_0x2940('0x22')]=function(_0x42c902,_0xf75b40){if(_0x42c902[_0x2940('0x47')]['id']){delete _0x42c902[_0x2940('0x47')]['id'];}return db[_0x2940('0x29')][_0x2940('0x4e')]({'where':{'id':_0x42c902[_0x2940('0x41')]['id']}})[_0x2940('0x23')](handleEntityNotFound(_0xf75b40,null))['then'](saveUpdates(_0x42c902['body'],null))[_0x2940('0x23')](respondWithResult(_0xf75b40,null))[_0x2940('0x3f')](handleError(_0xf75b40,null));};exports['destroy']=function(_0x358bfc,_0x129944){return db['CmHopperAdditionalPhone'][_0x2940('0x4e')]({'where':{'id':_0x358bfc['params']['id']}})[_0x2940('0x23')](handleEntityNotFound(_0x129944,null))[_0x2940('0x23')](removeEntity(_0x129944,null))['catch'](handleError(_0x129944,null));}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js index c188e4f..85a1fb8 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 _0x2e77=['request-promise','path','rimraf','../../config/environment','./cmHopperAdditionalPhone.attributes','exports','define','CmHopperAdditionalPhone','cm_hopper_additional_phones','lodash','util','api','moment'];(function(_0x319af4,_0x19cce9){var _0x187817=function(_0x28a263){while(--_0x28a263){_0x319af4['push'](_0x319af4['shift']());}};_0x187817(++_0x19cce9);}(_0x2e77,0x19c));var _0x72e7=function(_0x11e8c3,_0x32976c){_0x11e8c3=_0x11e8c3-0x0;var _0x2e7d36=_0x2e77[_0x11e8c3];return _0x2e7d36;};'use strict';var _=require(_0x72e7('0x0'));var util=require(_0x72e7('0x1'));var logger=require('../../config/logger')(_0x72e7('0x2'));var moment=require(_0x72e7('0x3'));var BPromise=require('bluebird');var rp=require(_0x72e7('0x4'));var fs=require('fs');var path=require(_0x72e7('0x5'));var rimraf=require(_0x72e7('0x6'));var config=require(_0x72e7('0x7'));var attributes=require(_0x72e7('0x8'));module[_0x72e7('0x9')]=function(_0x1c09ca,_0x3e0f24){return _0x1c09ca[_0x72e7('0xa')](_0x72e7('0xb'),attributes,{'tableName':_0x72e7('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x337e=['../../config/environment','./cmHopperAdditionalPhone.attributes','exports','CmHopperAdditionalPhone','cm_hopper_additional_phones','lodash','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x27dc6d,_0x2091e2){var _0x1cd394=function(_0x24660c){while(--_0x24660c){_0x27dc6d['push'](_0x27dc6d['shift']());}};_0x1cd394(++_0x2091e2);}(_0x337e,0x179));var _0xe337=function(_0x1b9d38,_0x51e834){_0x1b9d38=_0x1b9d38-0x0;var _0x582a3d=_0x337e[_0x1b9d38];return _0x582a3d;};'use strict';var _=require(_0xe337('0x0'));var util=require('util');var logger=require(_0xe337('0x1'))(_0xe337('0x2'));var moment=require(_0xe337('0x3'));var BPromise=require(_0xe337('0x4'));var rp=require(_0xe337('0x5'));var fs=require('fs');var path=require(_0xe337('0x6'));var rimraf=require('rimraf');var config=require(_0xe337('0x7'));var attributes=require(_0xe337('0x8'));module[_0xe337('0x9')]=function(_0x33e56e,_0x56f8a4){return _0x33e56e['define'](_0xe337('0xa'),attributes,{'tableName':_0xe337('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 03bb2da..27bede7 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 _0xa0c8=['countnoanswerretry','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','entity','duration','waitTime','scheduledat','add','minutes','isNil','phone','createdAt','updatedAt','countabandonedretry','sequelize','update','activateAdditionalPhone','IncrementPreviewCounters','field','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','info','CmHopperAdditionalPhone,\x20%s,\x20%s','debug','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','VerifyAdditionalPhones','CmHopper','findOne','body','ContactId','ListId','VoiceQueueId','CampaignId','then','CmHopperAdditionalPhone','OrderBy','ASC','countbusyretry','countcongestionretry'];(function(_0x1644e5,_0x31ac5f){var _0x5bc914=function(_0x2302a1){while(--_0x2302a1){_0x1644e5['push'](_0x1644e5['shift']());}};_0x5bc914(++_0x31ac5f);}(_0xa0c8,0x1dd));var _0x8a0c=function(_0x5581ba,_0x268887){_0x5581ba=_0x5581ba-0x0;var _0x1e927f=_0xa0c8[_0x5581ba];return _0x1e927f;};'use strict';var _=require(_0x8a0c('0x0'));var util=require(_0x8a0c('0x1'));var moment=require(_0x8a0c('0x2'));var BPromise=require(_0x8a0c('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8a0c('0x4'));var db=require(_0x8a0c('0x5'))['db'];var utils=require(_0x8a0c('0x6'));var logger=require(_0x8a0c('0x7'))('rpc');var config=require(_0x8a0c('0x8'));var jayson=require(_0x8a0c('0x9'));var client=jayson['client'][_0x8a0c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x267d7a,_0xe21dcc,_0xe5486e){return new BPromise(function(_0x5cdf68,_0x44e597){return client[_0x8a0c('0xb')](_0x267d7a,_0xe5486e)['then'](function(_0x2b0b70){logger[_0x8a0c('0xc')](_0x8a0c('0xd'),_0xe21dcc,'request\x20sent');logger[_0x8a0c('0xe')](_0x8a0c('0xf'),_0xe21dcc,_0x8a0c('0x10'),JSON['stringify'](_0x2b0b70));if(_0x2b0b70[_0x8a0c('0x11')]){if(_0x2b0b70[_0x8a0c('0x11')][_0x8a0c('0x12')]===0x1f4){logger[_0x8a0c('0x11')](_0x8a0c('0xd'),_0xe21dcc,_0x2b0b70[_0x8a0c('0x11')][_0x8a0c('0x13')]);return _0x44e597(_0x2b0b70[_0x8a0c('0x11')]['message']);}logger['error'](_0x8a0c('0xd'),_0xe21dcc,_0x2b0b70[_0x8a0c('0x11')][_0x8a0c('0x13')]);return _0x5cdf68(_0x2b0b70[_0x8a0c('0x11')]['message']);}else{logger[_0x8a0c('0xc')](_0x8a0c('0xd'),_0xe21dcc,'request\x20sent');_0x5cdf68(_0x2b0b70[_0x8a0c('0x14')][_0x8a0c('0x13')]);}})[_0x8a0c('0x15')](function(_0x40bcbd){logger[_0x8a0c('0x11')](_0x8a0c('0xd'),_0xe21dcc,_0x40bcbd);_0x44e597(_0x40bcbd);});});}exports[_0x8a0c('0x16')]=function(_0x198efc){var _0x55246e=this;return new Promise(function(_0x2d4b67,_0xe415c3){return db[_0x8a0c('0x17')][_0x8a0c('0x18')]({'raw':!![],'where':{'ContactId':_0x198efc[_0x8a0c('0x19')][_0x8a0c('0x1a')],'ListId':_0x198efc[_0x8a0c('0x19')][_0x8a0c('0x1b')],'VoiceQueueId':_0x198efc[_0x8a0c('0x19')]['VoiceQueueId']===undefined?null:_0x198efc[_0x8a0c('0x19')][_0x8a0c('0x1c')],'CampaignId':_0x198efc[_0x8a0c('0x19')][_0x8a0c('0x1d')]===undefined?null:_0x198efc['body'][_0x8a0c('0x1d')]}})[_0x8a0c('0x1e')](function(_0x3a1a4f){if(_0x3a1a4f!=null){return db[_0x8a0c('0x1f')]['findOne']({'raw':!![],'where':{'CmHopperId':_0x3a1a4f['id'],'OrderBy':{'$gt':_0x3a1a4f[_0x8a0c('0x20')]}},'order':[[_0x8a0c('0x20'),_0x8a0c('0x21')]]})[_0x8a0c('0x1e')](function(_0x403e37){var _0x3e7ec2=0x0;if(_0x403e37){if(_0x403e37[_0x8a0c('0x22')]+_0x403e37[_0x8a0c('0x23')]+_0x403e37[_0x8a0c('0x24')]+_0x403e37[_0x8a0c('0x25')]+_0x403e37[_0x8a0c('0x26')]+_0x403e37['countabandonedretry']+_0x403e37[_0x8a0c('0x27')]+_0x403e37[_0x8a0c('0x28')]<_0x198efc[_0x8a0c('0x29')]['dialGlobalMaxRetry'])_0x3e7ec2=0x1;_0x2d4b67({'additional':_0x3e7ec2});}else{return db[_0x8a0c('0x1f')][_0x8a0c('0x18')]({'raw':!![],'where':{'CmHopperId':_0x3a1a4f['id']},'order':[[_0x8a0c('0x20'),_0x8a0c('0x21')]]})['then'](function(_0x8521f7){var _0x4db898=0x0;if(_0x8521f7){if(_0x8521f7['countbusyretry']+_0x8521f7[_0x8a0c('0x23')]+_0x8521f7[_0x8a0c('0x24')]+_0x8521f7[_0x8a0c('0x25')]+_0x8521f7[_0x8a0c('0x26')]+_0x8521f7['countabandonedretry']+_0x8521f7['countmachineretry']+_0x8521f7['countagentrejectretry']<_0x198efc[_0x8a0c('0x29')]['dialGlobalMaxRetry'])_0x4db898=0x1;_0x2d4b67({'additional':_0x4db898});}else{_0x2d4b67({'additional':0x0});}})[_0x8a0c('0x15')](function(_0x1c4b2d){logger['error'](_0x8a0c('0x16'),_0x1c4b2d['message']);_0xe415c3(_0x55246e['error'](0x1f4,_0x1c4b2d[_0x8a0c('0x13')]));});}})['catch'](function(_0xcd1446){logger[_0x8a0c('0x11')](_0x8a0c('0x16'),_0xcd1446[_0x8a0c('0x13')]);_0xe415c3(_0x55246e[_0x8a0c('0x11')](0x1f4,_0xcd1446[_0x8a0c('0x13')]));});}else _0x2d4b67({'additional':0x0});});});};exports['SwapAdditionalPhones']=function(_0x87ed45){var _0x2bd1e=this;return new Promise(function(_0xd7d5d3,_0x37e9cc){return db[_0x8a0c('0x17')][_0x8a0c('0x18')]({'raw':!![],'where':{'ContactId':_0x87ed45['body'][_0x8a0c('0x1a')],'ListId':_0x87ed45[_0x8a0c('0x19')]['ListId'],'VoiceQueueId':_0x87ed45[_0x8a0c('0x19')][_0x8a0c('0x1c')]===undefined?null:_0x87ed45[_0x8a0c('0x19')][_0x8a0c('0x1c')],'CampaignId':_0x87ed45[_0x8a0c('0x19')][_0x8a0c('0x1d')]===undefined?null:_0x87ed45[_0x8a0c('0x19')][_0x8a0c('0x1d')]}})['then'](function(_0x37df8b){if(_0x37df8b!=null){return db[_0x8a0c('0x1f')]['findOne']({'raw':!![],'where':{'CmHopperId':_0x37df8b['id'],'OrderBy':{'$gte':_0x37df8b[_0x8a0c('0x20')]}},'order':[['OrderBy',_0x8a0c('0x21')]]})['then'](function(_0x24473d){if(_0x24473d)return activateAdditionalPhone(_0x37df8b,_0x87ed45[_0x8a0c('0x19')],_0x24473d,_0x87ed45[_0x8a0c('0x2a')],_0x87ed45[_0x8a0c('0x2b')])[_0x8a0c('0x1e')](function(_0x57f6b8){_0xd7d5d3(_0x57f6b8);});else{return db[_0x8a0c('0x1f')]['findOne']({'raw':!![],'where':{'CmHopperId':_0x37df8b['id']},'order':[['OrderBy','ASC']]})[_0x8a0c('0x1e')](function(_0x584684){if(_0x584684)return activateAdditionalPhone(_0x37df8b,_0x87ed45['body'],_0x584684,_0x87ed45['duration'],_0x87ed45[_0x8a0c('0x2b')])[_0x8a0c('0x1e')](function(_0x5569aa){_0xd7d5d3(_0x5569aa);});else{_0xd7d5d3({'id':_0x37df8b['id'],'phone':''});}})[_0x8a0c('0x15')](function(_0x130ea5){logger[_0x8a0c('0x11')]('VerifyAdditionalPhones',_0x130ea5['message']);_0x37e9cc(_0x2bd1e['error'](0x1f4,_0x130ea5[_0x8a0c('0x13')]));});}})[_0x8a0c('0x15')](function(_0x72b97a){logger['error'](_0x8a0c('0x16'),_0x72b97a[_0x8a0c('0x13')]);_0x37e9cc(_0x2bd1e[_0x8a0c('0x11')](0x1f4,_0x72b97a[_0x8a0c('0x13')]));});}else _0xd7d5d3(0x1);});});};function activateAdditionalPhone(_0x137226,_0x2a2000,_0x460271,_0x313bcb,_0x51d93f){return new Promise(function(_0x54e67d,_0x1501d8){var _0x9d33c7;if(_['isNil'](_0x460271[_0x8a0c('0x2c')])){_0x460271[_0x8a0c('0x2c')]=moment();}if(moment()>moment(_0x460271['scheduledat'])){_0x9d33c7=moment()[_0x8a0c('0x2d')](_0x51d93f||0x3,_0x8a0c('0x2e'));}else{if(_0x460271['OrderBy']==0x0){_0x9d33c7=moment(_0x460271[_0x8a0c('0x2c')]);}else{_0x9d33c7=moment()[_0x8a0c('0x2d')](_0x51d93f||0x3,_0x8a0c('0x2e'));}}if(_[_0x8a0c('0x2f')](_0x9d33c7)){_0x9d33c7=moment()[_0x8a0c('0x2d')](_0x51d93f||0x3,'minutes');}var _0xe7d535={'phone':_0x137226[_0x8a0c('0x30')],'active':0x0,'OrderBy':_[_0x8a0c('0x2f')](_0x137226[_0x8a0c('0x20')])?0x0:_0x137226['OrderBy'],'scheduledat':moment()[_0x8a0c('0x2d')](_0x313bcb||0x1,_0x8a0c('0x2e')),'countbusyretry':_0x2a2000[_0x8a0c('0x22')],'countcongestionretry':_0x2a2000[_0x8a0c('0x23')],'countnoanswerretry':_0x2a2000[_0x8a0c('0x24')],'countnosuchnumberretry':_0x2a2000['countnosuchnumberretry'],'countdropretry':_0x2a2000[_0x8a0c('0x26')],'countabandonedretry':_0x2a2000['countabandonedretry'],'countmachineretry':_0x2a2000[_0x8a0c('0x27')],'countagentrejectretry':_0x2a2000[_0x8a0c('0x28')],'createdAt':_0x2a2000[_0x8a0c('0x31')],'updatedAt':_0x2a2000[_0x8a0c('0x32')]};var _0x40bfdc={'CmHopperId':_0x137226['id'],'phone':_0x460271['phone'],'active':0x0,'OrderBy':_['isNil'](_0x460271[_0x8a0c('0x20')])?0x0:_0x460271['OrderBy'],'scheduledat':_0x9d33c7,'countbusyretry':_0x460271[_0x8a0c('0x22')],'countcongestionretry':_0x460271[_0x8a0c('0x23')],'countnoanswerretry':_0x460271[_0x8a0c('0x24')],'countnosuchnumberretry':_0x460271['countnosuchnumberretry'],'countdropretry':_0x460271['countdropretry'],'countabandonedretry':_0x460271[_0x8a0c('0x33')],'countmachineretry':_0x460271[_0x8a0c('0x27')],'countagentrejectretry':_0x460271[_0x8a0c('0x28')],'createdAt':_0x460271['createdAt'],'updatedAt':_0x460271[_0x8a0c('0x32')]};return db[_0x8a0c('0x34')]['transaction'](function(_0x289f51){return db[_0x8a0c('0x1f')][_0x8a0c('0x35')](_0xe7d535,{'where':{'id':_0x460271['id']}},{'transaction':_0x289f51})[_0x8a0c('0x1e')](function(){return db[_0x8a0c('0x17')][_0x8a0c('0x35')](_0x40bfdc,{'where':{'id':_0x137226['id']}},{'transaction':_0x289f51});});})[_0x8a0c('0x1e')](function(_0x39322e){_0x54e67d({'id':_0x137226['id'],'phone':_0x460271[_0x8a0c('0x30')]});})[_0x8a0c('0x15')](function(_0x2b1c01){logger[_0x8a0c('0x11')](_0x8a0c('0x36'),_0x2b1c01[_0x8a0c('0x13')]);_0x1501d8({'error':_0x2b1c01[_0x8a0c('0x13')]});});});}exports[_0x8a0c('0x37')]=function(_0x19c9b6){var _0x2c8abe=this;return new Promise(function(_0x1107f7,_0x11b41f){return db['CmHopper'][_0x8a0c('0x35')](_0x19c9b6[_0x8a0c('0x19')][_0x8a0c('0x38')],{'where':{'id':_0x19c9b6[_0x8a0c('0x19')]['id']}})[_0x8a0c('0x1e')](function(_0x5d58d6){_0x1107f7(_0x5d58d6);})['catch'](function(_0x5b8071){logger['error'](_0x8a0c('0x37'),_0x5b8071[_0x8a0c('0x13')]);_0x11b41f(_0x2c8abe[_0x8a0c('0x11')](0x1f4,_0x5b8071[_0x8a0c('0x13')]));});});}; \ No newline at end of file +var _0xdbc7=['countcongestionretry','countnoanswerretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','entity','dialGlobalMaxRetry','OrderBy','countnosuchnumberretry','catch','SwapAdditionalPhones','duration','waitTime','isNil','scheduledat','add','minutes','phone','createdAt','updatedAt','sequelize','update','activateAdditionalPhone','field','IncrementPreviewCounters','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','CmHopperAdditionalPhone,\x20%s,\x20%s','request\x20sent','debug','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','VerifyAdditionalPhones','CmHopper','body','ContactId','ListId','VoiceQueueId','CampaignId','then','CmHopperAdditionalPhone','findOne','ASC','countbusyretry'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xdbc7,0x1c5));var _0x7dbc=function(_0x5179a5,_0x419746){_0x5179a5=_0x5179a5-0x0;var _0x15c8ce=_0xdbc7[_0x5179a5];return _0x15c8ce;};'use strict';var _=require(_0x7dbc('0x0'));var util=require(_0x7dbc('0x1'));var moment=require(_0x7dbc('0x2'));var BPromise=require(_0x7dbc('0x3'));var rs=require(_0x7dbc('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7dbc('0x5'))['db'];var utils=require(_0x7dbc('0x6'));var logger=require(_0x7dbc('0x7'))(_0x7dbc('0x8'));var config=require(_0x7dbc('0x9'));var jayson=require(_0x7dbc('0xa'));var client=jayson[_0x7dbc('0xb')][_0x7dbc('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x22b6dd,_0x354aac,_0x1f994b){return new BPromise(function(_0x23edac,_0x48123f){return client[_0x7dbc('0xd')](_0x22b6dd,_0x1f994b)['then'](function(_0x54cfa0){logger['info'](_0x7dbc('0xe'),_0x354aac,_0x7dbc('0xf'));logger[_0x7dbc('0x10')](_0x7dbc('0x11'),_0x354aac,_0x7dbc('0xf'),JSON[_0x7dbc('0x12')](_0x54cfa0));if(_0x54cfa0[_0x7dbc('0x13')]){if(_0x54cfa0[_0x7dbc('0x13')][_0x7dbc('0x14')]===0x1f4){logger[_0x7dbc('0x13')](_0x7dbc('0xe'),_0x354aac,_0x54cfa0[_0x7dbc('0x13')][_0x7dbc('0x15')]);return _0x48123f(_0x54cfa0[_0x7dbc('0x13')][_0x7dbc('0x15')]);}logger[_0x7dbc('0x13')](_0x7dbc('0xe'),_0x354aac,_0x54cfa0[_0x7dbc('0x13')][_0x7dbc('0x15')]);return _0x23edac(_0x54cfa0[_0x7dbc('0x13')][_0x7dbc('0x15')]);}else{logger['info']('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x354aac,_0x7dbc('0xf'));_0x23edac(_0x54cfa0[_0x7dbc('0x16')][_0x7dbc('0x15')]);}})['catch'](function(_0xb1b07){logger['error'](_0x7dbc('0xe'),_0x354aac,_0xb1b07);_0x48123f(_0xb1b07);});});}exports[_0x7dbc('0x17')]=function(_0x5f20ae){var _0x4a6792=this;return new Promise(function(_0x59659e,_0x3a63d4){return db[_0x7dbc('0x18')]['findOne']({'raw':!![],'where':{'ContactId':_0x5f20ae[_0x7dbc('0x19')][_0x7dbc('0x1a')],'ListId':_0x5f20ae[_0x7dbc('0x19')][_0x7dbc('0x1b')],'VoiceQueueId':_0x5f20ae['body']['VoiceQueueId']===undefined?null:_0x5f20ae[_0x7dbc('0x19')][_0x7dbc('0x1c')],'CampaignId':_0x5f20ae[_0x7dbc('0x19')][_0x7dbc('0x1d')]===undefined?null:_0x5f20ae['body'][_0x7dbc('0x1d')]}})[_0x7dbc('0x1e')](function(_0x180baf){if(_0x180baf!=null){return db[_0x7dbc('0x1f')][_0x7dbc('0x20')]({'raw':!![],'where':{'CmHopperId':_0x180baf['id'],'OrderBy':{'$gt':_0x180baf['OrderBy']}},'order':[['OrderBy',_0x7dbc('0x21')]]})[_0x7dbc('0x1e')](function(_0x21e7b7){var _0x4e96d7=0x0;if(_0x21e7b7){if(_0x21e7b7[_0x7dbc('0x22')]+_0x21e7b7[_0x7dbc('0x23')]+_0x21e7b7[_0x7dbc('0x24')]+_0x21e7b7['countnosuchnumberretry']+_0x21e7b7[_0x7dbc('0x25')]+_0x21e7b7[_0x7dbc('0x26')]+_0x21e7b7[_0x7dbc('0x27')]+_0x21e7b7[_0x7dbc('0x28')]<_0x5f20ae[_0x7dbc('0x29')][_0x7dbc('0x2a')])_0x4e96d7=0x1;_0x59659e({'additional':_0x4e96d7});}else{return db['CmHopperAdditionalPhone']['findOne']({'raw':!![],'where':{'CmHopperId':_0x180baf['id']},'order':[[_0x7dbc('0x2b'),_0x7dbc('0x21')]]})['then'](function(_0x4a5a15){var _0x181575=0x0;if(_0x4a5a15){if(_0x4a5a15[_0x7dbc('0x22')]+_0x4a5a15['countcongestionretry']+_0x4a5a15[_0x7dbc('0x24')]+_0x4a5a15[_0x7dbc('0x2c')]+_0x4a5a15[_0x7dbc('0x25')]+_0x4a5a15[_0x7dbc('0x26')]+_0x4a5a15['countmachineretry']+_0x4a5a15[_0x7dbc('0x28')]<_0x5f20ae[_0x7dbc('0x29')][_0x7dbc('0x2a')])_0x181575=0x1;_0x59659e({'additional':_0x181575});}else{_0x59659e({'additional':0x0});}})['catch'](function(_0x55dfdf){logger[_0x7dbc('0x13')]('VerifyAdditionalPhones',_0x55dfdf[_0x7dbc('0x15')]);_0x3a63d4(_0x4a6792[_0x7dbc('0x13')](0x1f4,_0x55dfdf[_0x7dbc('0x15')]));});}})[_0x7dbc('0x2d')](function(_0x282830){logger['error'](_0x7dbc('0x17'),_0x282830[_0x7dbc('0x15')]);_0x3a63d4(_0x4a6792[_0x7dbc('0x13')](0x1f4,_0x282830[_0x7dbc('0x15')]));});}else _0x59659e({'additional':0x0});});});};exports[_0x7dbc('0x2e')]=function(_0x2fce6b){var _0x1dfc69=this;return new Promise(function(_0x3859ea,_0x6c70fa){return db['CmHopper'][_0x7dbc('0x20')]({'raw':!![],'where':{'ContactId':_0x2fce6b['body'][_0x7dbc('0x1a')],'ListId':_0x2fce6b[_0x7dbc('0x19')][_0x7dbc('0x1b')],'VoiceQueueId':_0x2fce6b['body'][_0x7dbc('0x1c')]===undefined?null:_0x2fce6b['body'][_0x7dbc('0x1c')],'CampaignId':_0x2fce6b[_0x7dbc('0x19')][_0x7dbc('0x1d')]===undefined?null:_0x2fce6b[_0x7dbc('0x19')][_0x7dbc('0x1d')]}})['then'](function(_0x5ba227){if(_0x5ba227!=null){return db[_0x7dbc('0x1f')][_0x7dbc('0x20')]({'raw':!![],'where':{'CmHopperId':_0x5ba227['id'],'OrderBy':{'$gte':_0x5ba227[_0x7dbc('0x2b')]}},'order':[[_0x7dbc('0x2b'),_0x7dbc('0x21')]]})[_0x7dbc('0x1e')](function(_0x13e41a){if(_0x13e41a)return activateAdditionalPhone(_0x5ba227,_0x2fce6b[_0x7dbc('0x19')],_0x13e41a,_0x2fce6b[_0x7dbc('0x2f')],_0x2fce6b[_0x7dbc('0x30')])[_0x7dbc('0x1e')](function(_0x2adbfa){_0x3859ea(_0x2adbfa);});else{return db[_0x7dbc('0x1f')][_0x7dbc('0x20')]({'raw':!![],'where':{'CmHopperId':_0x5ba227['id']},'order':[[_0x7dbc('0x2b'),'ASC']]})[_0x7dbc('0x1e')](function(_0x19e791){if(_0x19e791)return activateAdditionalPhone(_0x5ba227,_0x2fce6b[_0x7dbc('0x19')],_0x19e791,_0x2fce6b[_0x7dbc('0x2f')],_0x2fce6b[_0x7dbc('0x30')])[_0x7dbc('0x1e')](function(_0x19c057){_0x3859ea(_0x19c057);});else{_0x3859ea({'id':_0x5ba227['id'],'phone':''});}})[_0x7dbc('0x2d')](function(_0x1aea7b){logger['error'](_0x7dbc('0x17'),_0x1aea7b[_0x7dbc('0x15')]);_0x6c70fa(_0x1dfc69[_0x7dbc('0x13')](0x1f4,_0x1aea7b[_0x7dbc('0x15')]));});}})[_0x7dbc('0x2d')](function(_0x349159){logger['error']('VerifyAdditionalPhones',_0x349159[_0x7dbc('0x15')]);_0x6c70fa(_0x1dfc69[_0x7dbc('0x13')](0x1f4,_0x349159[_0x7dbc('0x15')]));});}else _0x3859ea(0x1);});});};function activateAdditionalPhone(_0x269b7a,_0x4ae26c,_0x31a023,_0x129289,_0x53ee86){return new Promise(function(_0x1543f6,_0x3583d7){var _0x36c0dd;if(_[_0x7dbc('0x31')](_0x31a023[_0x7dbc('0x32')])){_0x31a023[_0x7dbc('0x32')]=moment();}if(moment()>moment(_0x31a023[_0x7dbc('0x32')])){_0x36c0dd=moment()[_0x7dbc('0x33')](_0x53ee86||0x3,'minutes');}else{if(_0x31a023[_0x7dbc('0x2b')]==0x0){_0x36c0dd=moment(_0x31a023[_0x7dbc('0x32')]);}else{_0x36c0dd=moment()['add'](_0x53ee86||0x3,'minutes');}}if(_[_0x7dbc('0x31')](_0x36c0dd)){_0x36c0dd=moment()[_0x7dbc('0x33')](_0x53ee86||0x3,_0x7dbc('0x34'));}var _0x3eacbb={'phone':_0x269b7a[_0x7dbc('0x35')],'active':0x0,'OrderBy':_[_0x7dbc('0x31')](_0x269b7a['OrderBy'])?0x0:_0x269b7a[_0x7dbc('0x2b')],'scheduledat':moment()[_0x7dbc('0x33')](_0x129289||0x1,_0x7dbc('0x34')),'countbusyretry':_0x4ae26c[_0x7dbc('0x22')],'countcongestionretry':_0x4ae26c[_0x7dbc('0x23')],'countnoanswerretry':_0x4ae26c[_0x7dbc('0x24')],'countnosuchnumberretry':_0x4ae26c['countnosuchnumberretry'],'countdropretry':_0x4ae26c['countdropretry'],'countabandonedretry':_0x4ae26c['countabandonedretry'],'countmachineretry':_0x4ae26c['countmachineretry'],'countagentrejectretry':_0x4ae26c['countagentrejectretry'],'createdAt':_0x4ae26c[_0x7dbc('0x36')],'updatedAt':_0x4ae26c[_0x7dbc('0x37')]};var _0x50e746={'CmHopperId':_0x269b7a['id'],'phone':_0x31a023['phone'],'active':0x0,'OrderBy':_[_0x7dbc('0x31')](_0x31a023[_0x7dbc('0x2b')])?0x0:_0x31a023['OrderBy'],'scheduledat':_0x36c0dd,'countbusyretry':_0x31a023[_0x7dbc('0x22')],'countcongestionretry':_0x31a023[_0x7dbc('0x23')],'countnoanswerretry':_0x31a023['countnoanswerretry'],'countnosuchnumberretry':_0x31a023['countnosuchnumberretry'],'countdropretry':_0x31a023[_0x7dbc('0x25')],'countabandonedretry':_0x31a023['countabandonedretry'],'countmachineretry':_0x31a023[_0x7dbc('0x27')],'countagentrejectretry':_0x31a023['countagentrejectretry'],'createdAt':_0x31a023[_0x7dbc('0x36')],'updatedAt':_0x31a023[_0x7dbc('0x37')]};return db[_0x7dbc('0x38')]['transaction'](function(_0x4c8616){return db[_0x7dbc('0x1f')][_0x7dbc('0x39')](_0x3eacbb,{'where':{'id':_0x31a023['id']}},{'transaction':_0x4c8616})['then'](function(){return db[_0x7dbc('0x18')][_0x7dbc('0x39')](_0x50e746,{'where':{'id':_0x269b7a['id']}},{'transaction':_0x4c8616});});})[_0x7dbc('0x1e')](function(_0x3d23a3){_0x1543f6({'id':_0x269b7a['id'],'phone':_0x31a023['phone']});})[_0x7dbc('0x2d')](function(_0x35c354){logger[_0x7dbc('0x13')](_0x7dbc('0x3a'),_0x35c354[_0x7dbc('0x15')]);_0x3583d7({'error':_0x35c354[_0x7dbc('0x15')]});});});}exports['IncrementPreviewCounters']=function(_0x1ac4f7){var _0x8a2a10=this;return new Promise(function(_0x1ac6c3,_0x44060a){return db[_0x7dbc('0x18')][_0x7dbc('0x39')](_0x1ac4f7['body'][_0x7dbc('0x3b')],{'where':{'id':_0x1ac4f7[_0x7dbc('0x19')]['id']}})['then'](function(_0x1d428e){_0x1ac6c3(_0x1d428e);})[_0x7dbc('0x2d')](function(_0x1389d1){logger['error'](_0x7dbc('0x3c'),_0x1389d1[_0x7dbc('0x15')]);_0x44060a(_0x8a2a10['error'](0x1f4,_0x1389d1[_0x7dbc('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/index.js b/server/api/cmHopperAdditionalPhone/index.js index ff4f907..de36918 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 _0x76d2=['connect-timeout','fs-extra','../../components/auth/service','get','isAuthenticated','show','post','create','put','/:id','update','delete','destroy','exports','util','path'];(function(_0x5bce9f,_0x47fe07){var _0x3dbd8e=function(_0x1942bf){while(--_0x1942bf){_0x5bce9f['push'](_0x5bce9f['shift']());}};_0x3dbd8e(++_0x47fe07);}(_0x76d2,0x6e));var _0x276d=function(_0x3c3d6b,_0x24dd55){_0x3c3d6b=_0x3c3d6b-0x0;var _0x3c9779=_0x76d2[_0x3c3d6b];return _0x3c9779;};'use strict';var multer=require('multer');var util=require(_0x276d('0x0'));var path=require(_0x276d('0x1'));var timeout=require(_0x276d('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x276d('0x3'));var auth=require(_0x276d('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./cmHopperAdditionalPhone.controller');router[_0x276d('0x5')]('/',auth[_0x276d('0x6')](),controller['index']);router['get']('/:id',auth[_0x276d('0x6')](),controller[_0x276d('0x7')]);router[_0x276d('0x8')]('/',auth[_0x276d('0x6')](),controller[_0x276d('0x9')]);router[_0x276d('0xa')](_0x276d('0xb'),auth[_0x276d('0x6')](),controller[_0x276d('0xc')]);router[_0x276d('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x276d('0xe')]);module[_0x276d('0xf')]=router; \ No newline at end of file +var _0x3149=['/:id','isAuthenticated','show','put','update','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperAdditionalPhone.controller','get','index'];(function(_0x367c41,_0x101f42){var _0x451270=function(_0x2fcbb3){while(--_0x2fcbb3){_0x367c41['push'](_0x367c41['shift']());}};_0x451270(++_0x101f42);}(_0x3149,0x181));var _0x9314=function(_0x13a9f5,_0x570c70){_0x13a9f5=_0x13a9f5-0x0;var _0xa1860a=_0x3149[_0x13a9f5];return _0xa1860a;};'use strict';var multer=require(_0x9314('0x0'));var util=require('util');var path=require(_0x9314('0x1'));var timeout=require(_0x9314('0x2'));var express=require(_0x9314('0x3'));var router=express[_0x9314('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x9314('0x5'));var interaction=require(_0x9314('0x6'));var config=require(_0x9314('0x7'));var controller=require(_0x9314('0x8'));router[_0x9314('0x9')]('/',auth['isAuthenticated'](),controller[_0x9314('0xa')]);router[_0x9314('0x9')](_0x9314('0xb'),auth[_0x9314('0xc')](),controller[_0x9314('0xd')]);router['post']('/',auth[_0x9314('0xc')](),controller['create']);router[_0x9314('0xe')]('/:id',auth[_0x9314('0xc')](),controller[_0x9314('0xf')]);router['delete'](_0x9314('0xb'),auth['isAuthenticated'](),controller[_0x9314('0x10')]);module[_0x9314('0x11')]=router; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.attributes.js b/server/api/cmHopperBlack/cmHopperBlack.attributes.js index cf4ae18..22d11b9 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 _0x9ed1=['exports','STRING','INTEGER','moment','sequelize'];(function(_0x3f9584,_0x5ab12c){var _0x9d54c=function(_0x2882df){while(--_0x2882df){_0x3f9584['push'](_0x3f9584['shift']());}};_0x9d54c(++_0x5ab12c);}(_0x9ed1,0x107));var _0x19ed=function(_0x4226a5,_0x27e279){_0x4226a5=_0x4226a5-0x0;var _0x64480e=_0x9ed1[_0x4226a5];return _0x64480e;};'use strict';var moment=require(_0x19ed('0x0'));var Sequelize=require(_0x19ed('0x1'));module[_0x19ed('0x2')]={'phone':{'type':Sequelize[_0x19ed('0x3')],'allowNull':![]},'ContactId':{'type':Sequelize[_0x19ed('0x4')],'unique':'contactListQueue'},'ListId':{'type':Sequelize[_0x19ed('0x4')],'unique':'contactListQueue'},'VoiceQueueId':{'type':Sequelize[_0x19ed('0x4')],'unique':'contactListQueue'}}; \ No newline at end of file +var _0xe367=['exports','INTEGER','contactListQueue','moment','sequelize'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xe367,0x116));var _0x7e36=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xe367[_0x321bb2];return _0x9c12ed;};'use strict';var moment=require(_0x7e36('0x0'));var Sequelize=require(_0x7e36('0x1'));module[_0x7e36('0x2')]={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'ContactId':{'type':Sequelize[_0x7e36('0x3')],'unique':_0x7e36('0x4')},'ListId':{'type':Sequelize[_0x7e36('0x3')],'unique':_0x7e36('0x4')},'VoiceQueueId':{'type':Sequelize[_0x7e36('0x3')],'unique':_0x7e36('0x4')}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index a5cb640..8cd0e98 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 _0xb9f7=['../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','json','offset','count','set','apply','reject','save','update','then','destroy','status','sendStatus','stack','name','index','map','CmHopperBlack','type','key','model','query','keys','filters','attributes','intersection','fields','length','nolimit','limit','sort','filter','where','merge','VIRTUAL','options','includeAll','include','rows','show','params','catch','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','jsforce','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs'];(function(_0x3a1602,_0xfbce10){var _0xeeb50f=function(_0x515304){while(--_0x515304){_0x3a1602['push'](_0x3a1602['shift']());}};_0xeeb50f(++_0xfbce10);}(_0xb9f7,0x18b));var _0x7b9f=function(_0xf79bae,_0x263b2a){_0xf79bae=_0xf79bae-0x0;var _0x5d2cb7=_0xb9f7[_0xf79bae];return _0x5d2cb7;};'use strict';var emlformat=require(_0x7b9f('0x0'));var rimraf=require(_0x7b9f('0x1'));var zipdir=require(_0x7b9f('0x2'));var jsonpatch=require(_0x7b9f('0x3'));var rp=require('request-promise');var moment=require(_0x7b9f('0x4'));var BPromise=require(_0x7b9f('0x5'));var Mustache=require(_0x7b9f('0x6'));var util=require(_0x7b9f('0x7'));var path=require(_0x7b9f('0x8'));var sox=require(_0x7b9f('0x9'));var csv=require('to-csv');var ejs=require(_0x7b9f('0xa'));var fs=require('fs');var fs_extra=require(_0x7b9f('0xb'));var _=require(_0x7b9f('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x7b9f('0xd'));var deskjs=require(_0x7b9f('0xe'));var toCsv=require(_0x7b9f('0xf'));var querystring=require(_0x7b9f('0x10'));var Papa=require(_0x7b9f('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x7b9f('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x7b9f('0x13'))('api');var utils=require(_0x7b9f('0x14'));var config=require(_0x7b9f('0x15'));var licenseUtil=require(_0x7b9f('0x16'));var db=require(_0x7b9f('0x17'))['db'];function respondWithStatusCode(_0x303ec9,_0x322dbe){_0x322dbe=_0x322dbe||0xcc;return function(_0x4b5f3e){if(_0x4b5f3e){return _0x303ec9['sendStatus'](_0x322dbe);}return _0x303ec9['status'](_0x322dbe)[_0x7b9f('0x18')]();};}function respondWithResult(_0x367053,_0x533071){_0x533071=_0x533071||0xc8;return function(_0x4d3999){if(_0x4d3999){return _0x367053['status'](_0x533071)[_0x7b9f('0x19')](_0x4d3999);}};}function respondWithFilteredResult(_0x2159e8,_0x33c449){return function(_0x41eef4){if(_0x41eef4){var _0x47e906=typeof _0x33c449[_0x7b9f('0x1a')]==='undefined'&&typeof _0x33c449['limit']==='undefined';var _0x58accf=_0x41eef4[_0x7b9f('0x1b')];var _0x535afa=_0x47e906?0x0:_0x33c449[_0x7b9f('0x1a')];var _0x2d66ff=_0x47e906?_0x41eef4[_0x7b9f('0x1b')]:_0x33c449[_0x7b9f('0x1a')]+_0x33c449['limit'];var _0x2b582a;if(_0x2d66ff>=_0x58accf){_0x2d66ff=_0x58accf;_0x2b582a=0xc8;}else{_0x2b582a=0xce;}_0x2159e8['status'](_0x2b582a);return _0x2159e8[_0x7b9f('0x1c')]('Content-Range',_0x535afa+'-'+_0x2d66ff+'/'+_0x58accf)[_0x7b9f('0x19')](_0x41eef4);}return null;};}function patchUpdates(_0x380420){return function(_0x783869){try{jsonpatch[_0x7b9f('0x1d')](_0x783869,_0x380420,!![]);}catch(_0x30711b){return BPromise[_0x7b9f('0x1e')](_0x30711b);}return _0x783869[_0x7b9f('0x1f')]();};}function saveUpdates(_0x54475e,_0x804d3d){return function(_0x281c05){if(_0x281c05){return _0x281c05[_0x7b9f('0x20')](_0x54475e)[_0x7b9f('0x21')](function(_0x280e73){return _0x280e73;});}return null;};}function removeEntity(_0x287bfa,_0x59d7b9){return function(_0x3e07c5){if(_0x3e07c5){return _0x3e07c5[_0x7b9f('0x22')]()[_0x7b9f('0x21')](function(){_0x287bfa[_0x7b9f('0x23')](0xcc)[_0x7b9f('0x18')]();});}};}function handleEntityNotFound(_0x5dbffa,_0x38ac91){return function(_0x474880){if(!_0x474880){_0x5dbffa[_0x7b9f('0x24')](0x194);}return _0x474880;};}function handleError(_0x362355,_0x49e455){_0x49e455=_0x49e455||0x1f4;return function(_0x38af88){logger['error'](_0x38af88[_0x7b9f('0x25')]);if(_0x38af88['name']){delete _0x38af88[_0x7b9f('0x26')];}_0x362355[_0x7b9f('0x23')](_0x49e455)['send'](_0x38af88);};}exports[_0x7b9f('0x27')]=function(_0x3ec6bc,_0xcc9f19){var _0x48e924={},_0x180ba7={},_0xf92d84={'count':0x0,'rows':[]};var _0x4cf0c1=_[_0x7b9f('0x28')](db[_0x7b9f('0x29')]['rawAttributes'],function(_0x4f65b3){return{'name':_0x4f65b3['fieldName'],'type':_0x4f65b3[_0x7b9f('0x2a')][_0x7b9f('0x2b')]};});_0x180ba7[_0x7b9f('0x2c')]=_[_0x7b9f('0x28')](_0x4cf0c1,_0x7b9f('0x26'));_0x180ba7[_0x7b9f('0x2d')]=_[_0x7b9f('0x2e')](_0x3ec6bc[_0x7b9f('0x2d')]);_0x180ba7[_0x7b9f('0x2f')]=_['intersection'](_0x180ba7[_0x7b9f('0x2c')],_0x180ba7['query']);_0x48e924[_0x7b9f('0x30')]=_[_0x7b9f('0x31')](_0x180ba7[_0x7b9f('0x2c')],qs[_0x7b9f('0x32')](_0x3ec6bc[_0x7b9f('0x2d')]['fields']));_0x48e924[_0x7b9f('0x30')]=_0x48e924[_0x7b9f('0x30')][_0x7b9f('0x33')]?_0x48e924['attributes']:_0x180ba7['model'];if(!_0x3ec6bc[_0x7b9f('0x2d')]['hasOwnProperty'](_0x7b9f('0x34'))){_0x48e924[_0x7b9f('0x35')]=qs[_0x7b9f('0x35')](_0x3ec6bc[_0x7b9f('0x2d')][_0x7b9f('0x35')]);_0x48e924[_0x7b9f('0x1a')]=qs[_0x7b9f('0x1a')](_0x3ec6bc[_0x7b9f('0x2d')][_0x7b9f('0x1a')]);}_0x48e924['order']=qs['sort'](_0x3ec6bc[_0x7b9f('0x2d')][_0x7b9f('0x36')]);_0x48e924['where']=qs['filters'](_['pick'](_0x3ec6bc[_0x7b9f('0x2d')],_0x180ba7[_0x7b9f('0x2f')]),_0x4cf0c1);if(_0x3ec6bc[_0x7b9f('0x2d')][_0x7b9f('0x37')]){_0x48e924[_0x7b9f('0x38')]=_[_0x7b9f('0x39')](_0x48e924[_0x7b9f('0x38')],{'$or':_[_0x7b9f('0x28')](_0x4cf0c1,function(_0x2756bf){if(_0x2756bf[_0x7b9f('0x2a')]!==_0x7b9f('0x3a')){var _0x2ce5f1={};_0x2ce5f1[_0x2756bf['name']]={'$like':'%'+_0x3ec6bc[_0x7b9f('0x2d')][_0x7b9f('0x37')]+'%'};return _0x2ce5f1;}})});}_0x48e924=_['merge']({},_0x48e924,_0x3ec6bc[_0x7b9f('0x3b')]);var _0x2f77c7={'where':_0x48e924[_0x7b9f('0x38')]};return db[_0x7b9f('0x29')]['count'](_0x2f77c7)[_0x7b9f('0x21')](function(_0x133f9c){_0xf92d84[_0x7b9f('0x1b')]=_0x133f9c;if(_0x3ec6bc[_0x7b9f('0x2d')][_0x7b9f('0x3c')]){_0x48e924[_0x7b9f('0x3d')]=[{'all':!![]}];}return db[_0x7b9f('0x29')]['findAll'](_0x48e924);})[_0x7b9f('0x21')](function(_0x96a19a){_0xf92d84[_0x7b9f('0x3e')]=_0x96a19a;return _0xf92d84;})['then'](respondWithFilteredResult(_0xcc9f19,_0x48e924))['catch'](handleError(_0xcc9f19,null));};exports[_0x7b9f('0x3f')]=function(_0x42eebf,_0x1cf94c){var _0x40053c={'raw':!![],'where':{'id':_0x42eebf[_0x7b9f('0x40')]['id']}},_0x162a73={};_0x162a73['model']=_['keys'](db[_0x7b9f('0x29')]['rawAttributes']);_0x162a73[_0x7b9f('0x2d')]=_['keys'](_0x42eebf[_0x7b9f('0x2d')]);_0x162a73[_0x7b9f('0x2f')]=_['intersection'](_0x162a73[_0x7b9f('0x2c')],_0x162a73[_0x7b9f('0x2d')]);_0x40053c[_0x7b9f('0x30')]=_[_0x7b9f('0x31')](_0x162a73[_0x7b9f('0x2c')],qs['fields'](_0x42eebf[_0x7b9f('0x2d')][_0x7b9f('0x32')]));_0x40053c['attributes']=_0x40053c[_0x7b9f('0x30')][_0x7b9f('0x33')]?_0x40053c[_0x7b9f('0x30')]:_0x162a73[_0x7b9f('0x2c')];if(_0x42eebf['query']['includeAll']){_0x40053c[_0x7b9f('0x3d')]=[{'all':!![]}];}_0x40053c=_[_0x7b9f('0x39')]({},_0x40053c,_0x42eebf['options']);return db[_0x7b9f('0x29')]['find'](_0x40053c)[_0x7b9f('0x21')](handleEntityNotFound(_0x1cf94c,null))[_0x7b9f('0x21')](respondWithResult(_0x1cf94c,null))[_0x7b9f('0x41')](handleError(_0x1cf94c,null));};exports[_0x7b9f('0x20')]=function(_0x5854c8,_0xad1167){if(_0x5854c8[_0x7b9f('0x42')]['id']){delete _0x5854c8['body']['id'];}return db[_0x7b9f('0x29')]['find']({'where':{'id':_0x5854c8['params']['id']}})[_0x7b9f('0x21')](handleEntityNotFound(_0xad1167,null))['then'](saveUpdates(_0x5854c8[_0x7b9f('0x42')],null))[_0x7b9f('0x21')](respondWithResult(_0xad1167,null))[_0x7b9f('0x41')](handleError(_0xad1167,null));};exports[_0x7b9f('0x22')]=function(_0x11db80,_0x290f80){return db[_0x7b9f('0x29')][_0x7b9f('0x43')]({'where':{'id':_0x11db80[_0x7b9f('0x40')]['id']}})['then'](handleEntityNotFound(_0x290f80,null))[_0x7b9f('0x21')](removeEntity(_0x290f80,null))['catch'](handleError(_0x290f80,null));};exports['describe']=function(_0x154729,_0x3d871a){return db[_0x7b9f('0x29')][_0x7b9f('0x44')]()['then'](respondWithResult(_0x3d871a,null))[_0x7b9f('0x41')](handleError(_0x3d871a,null));}; \ No newline at end of file +var _0xb329=['params','merge','find','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','end','error','stack','name','send','index','map','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','filter','where','options','CmHopperBlack','includeAll','include','findAll','rows','catch','show'];(function(_0x47a7d0,_0x4e182d){var _0xb9bd08=function(_0x588ee2){while(--_0x588ee2){_0x47a7d0['push'](_0x47a7d0['shift']());}};_0xb9bd08(++_0x4e182d);}(_0xb329,0x119));var _0x9b32=function(_0x4eaa4c,_0x2f7422){_0x4eaa4c=_0x4eaa4c-0x0;var _0x15aec6=_0xb329[_0x4eaa4c];return _0x15aec6;};'use strict';var emlformat=require(_0x9b32('0x0'));var rimraf=require(_0x9b32('0x1'));var zipdir=require(_0x9b32('0x2'));var jsonpatch=require(_0x9b32('0x3'));var rp=require(_0x9b32('0x4'));var moment=require(_0x9b32('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x9b32('0x6'));var path=require('path');var sox=require(_0x9b32('0x7'));var csv=require(_0x9b32('0x8'));var ejs=require(_0x9b32('0x9'));var fs=require('fs');var fs_extra=require(_0x9b32('0xa'));var _=require(_0x9b32('0xb'));var squel=require(_0x9b32('0xc'));var crypto=require(_0x9b32('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x9b32('0x8'));var querystring=require(_0x9b32('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x9b32('0xf'));var qs=require(_0x9b32('0x10'));var as=require(_0x9b32('0x11'));var hardwareService=require(_0x9b32('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x9b32('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x9b32('0x14'))['db'];function respondWithStatusCode(_0x4e5539,_0x2f7d61){_0x2f7d61=_0x2f7d61||0xcc;return function(_0x132a41){if(_0x132a41){return _0x4e5539[_0x9b32('0x15')](_0x2f7d61);}return _0x4e5539[_0x9b32('0x16')](_0x2f7d61)['end']();};}function respondWithResult(_0x1dc1ae,_0x5597d1){_0x5597d1=_0x5597d1||0xc8;return function(_0x48c105){if(_0x48c105){return _0x1dc1ae[_0x9b32('0x16')](_0x5597d1)[_0x9b32('0x17')](_0x48c105);}};}function respondWithFilteredResult(_0x2124e1,_0x1402f7){return function(_0x2dce8c){if(_0x2dce8c){var _0x4a0720=typeof _0x1402f7[_0x9b32('0x18')]===_0x9b32('0x19')&&typeof _0x1402f7[_0x9b32('0x1a')]===_0x9b32('0x19');var _0x1da61a=_0x2dce8c[_0x9b32('0x1b')];var _0x4c7018=_0x4a0720?0x0:_0x1402f7['offset'];var _0x5d0648=_0x4a0720?_0x2dce8c[_0x9b32('0x1b')]:_0x1402f7[_0x9b32('0x18')]+_0x1402f7[_0x9b32('0x1a')];var _0x142861;if(_0x5d0648>=_0x1da61a){_0x5d0648=_0x1da61a;_0x142861=0xc8;}else{_0x142861=0xce;}_0x2124e1[_0x9b32('0x16')](_0x142861);return _0x2124e1[_0x9b32('0x1c')](_0x9b32('0x1d'),_0x4c7018+'-'+_0x5d0648+'/'+_0x1da61a)[_0x9b32('0x17')](_0x2dce8c);}return null;};}function patchUpdates(_0x307c15){return function(_0x14bae8){try{jsonpatch[_0x9b32('0x1e')](_0x14bae8,_0x307c15,!![]);}catch(_0x32e5f4){return BPromise[_0x9b32('0x1f')](_0x32e5f4);}return _0x14bae8['save']();};}function saveUpdates(_0x335d1f,_0x1b5c71){return function(_0x1ac8a1){if(_0x1ac8a1){return _0x1ac8a1[_0x9b32('0x20')](_0x335d1f)[_0x9b32('0x21')](function(_0x4da9c8){return _0x4da9c8;});}return null;};}function removeEntity(_0x70c0af,_0x25fc31){return function(_0x869d47){if(_0x869d47){return _0x869d47[_0x9b32('0x22')]()[_0x9b32('0x21')](function(){_0x70c0af[_0x9b32('0x16')](0xcc)[_0x9b32('0x23')]();});}};}function handleEntityNotFound(_0x4747ff,_0x593cd7){return function(_0x52b34e){if(!_0x52b34e){_0x4747ff[_0x9b32('0x15')](0x194);}return _0x52b34e;};}function handleError(_0x5f7d54,_0xbcfb59){_0xbcfb59=_0xbcfb59||0x1f4;return function(_0x1f5314){logger[_0x9b32('0x24')](_0x1f5314[_0x9b32('0x25')]);if(_0x1f5314[_0x9b32('0x26')]){delete _0x1f5314[_0x9b32('0x26')];}_0x5f7d54[_0x9b32('0x16')](_0xbcfb59)[_0x9b32('0x27')](_0x1f5314);};}exports[_0x9b32('0x28')]=function(_0x49bca2,_0xaf461){var _0x5b0a95={},_0x32ca0f={},_0x24c579={'count':0x0,'rows':[]};var _0x5b12e0=_[_0x9b32('0x29')](db['CmHopperBlack']['rawAttributes'],function(_0x58503a){return{'name':_0x58503a['fieldName'],'type':_0x58503a[_0x9b32('0x2a')][_0x9b32('0x2b')]};});_0x32ca0f[_0x9b32('0x2c')]=_['map'](_0x5b12e0,'name');_0x32ca0f[_0x9b32('0x2d')]=_[_0x9b32('0x2e')](_0x49bca2[_0x9b32('0x2d')]);_0x32ca0f[_0x9b32('0x2f')]=_[_0x9b32('0x30')](_0x32ca0f[_0x9b32('0x2c')],_0x32ca0f['query']);_0x5b0a95[_0x9b32('0x31')]=_[_0x9b32('0x30')](_0x32ca0f[_0x9b32('0x2c')],qs[_0x9b32('0x32')](_0x49bca2['query']['fields']));_0x5b0a95['attributes']=_0x5b0a95['attributes'][_0x9b32('0x33')]?_0x5b0a95['attributes']:_0x32ca0f[_0x9b32('0x2c')];if(!_0x49bca2[_0x9b32('0x2d')]['hasOwnProperty'](_0x9b32('0x34'))){_0x5b0a95[_0x9b32('0x1a')]=qs[_0x9b32('0x1a')](_0x49bca2[_0x9b32('0x2d')][_0x9b32('0x1a')]);_0x5b0a95[_0x9b32('0x18')]=qs['offset'](_0x49bca2[_0x9b32('0x2d')][_0x9b32('0x18')]);}_0x5b0a95['order']=qs[_0x9b32('0x35')](_0x49bca2[_0x9b32('0x2d')][_0x9b32('0x35')]);_0x5b0a95['where']=qs[_0x9b32('0x2f')](_['pick'](_0x49bca2[_0x9b32('0x2d')],_0x32ca0f[_0x9b32('0x2f')]),_0x5b12e0);if(_0x49bca2[_0x9b32('0x2d')][_0x9b32('0x36')]){_0x5b0a95[_0x9b32('0x37')]=_['merge'](_0x5b0a95[_0x9b32('0x37')],{'$or':_[_0x9b32('0x29')](_0x5b12e0,function(_0x28437c){if(_0x28437c[_0x9b32('0x2a')]!=='VIRTUAL'){var _0x375539={};_0x375539[_0x28437c[_0x9b32('0x26')]]={'$like':'%'+_0x49bca2[_0x9b32('0x2d')]['filter']+'%'};return _0x375539;}})});}_0x5b0a95=_['merge']({},_0x5b0a95,_0x49bca2[_0x9b32('0x38')]);var _0x203034={'where':_0x5b0a95['where']};return db[_0x9b32('0x39')]['count'](_0x203034)[_0x9b32('0x21')](function(_0x357ccd){_0x24c579[_0x9b32('0x1b')]=_0x357ccd;if(_0x49bca2[_0x9b32('0x2d')][_0x9b32('0x3a')]){_0x5b0a95[_0x9b32('0x3b')]=[{'all':!![]}];}return db[_0x9b32('0x39')][_0x9b32('0x3c')](_0x5b0a95);})[_0x9b32('0x21')](function(_0x10290b){_0x24c579[_0x9b32('0x3d')]=_0x10290b;return _0x24c579;})[_0x9b32('0x21')](respondWithFilteredResult(_0xaf461,_0x5b0a95))[_0x9b32('0x3e')](handleError(_0xaf461,null));};exports[_0x9b32('0x3f')]=function(_0x2ecafb,_0x11956f){var _0x1fd44b={'raw':!![],'where':{'id':_0x2ecafb[_0x9b32('0x40')]['id']}},_0x32bf29={};_0x32bf29[_0x9b32('0x2c')]=_[_0x9b32('0x2e')](db[_0x9b32('0x39')]['rawAttributes']);_0x32bf29[_0x9b32('0x2d')]=_[_0x9b32('0x2e')](_0x2ecafb['query']);_0x32bf29[_0x9b32('0x2f')]=_[_0x9b32('0x30')](_0x32bf29[_0x9b32('0x2c')],_0x32bf29['query']);_0x1fd44b[_0x9b32('0x31')]=_['intersection'](_0x32bf29[_0x9b32('0x2c')],qs[_0x9b32('0x32')](_0x2ecafb['query'][_0x9b32('0x32')]));_0x1fd44b[_0x9b32('0x31')]=_0x1fd44b['attributes'][_0x9b32('0x33')]?_0x1fd44b[_0x9b32('0x31')]:_0x32bf29[_0x9b32('0x2c')];if(_0x2ecafb[_0x9b32('0x2d')][_0x9b32('0x3a')]){_0x1fd44b[_0x9b32('0x3b')]=[{'all':!![]}];}_0x1fd44b=_[_0x9b32('0x41')]({},_0x1fd44b,_0x2ecafb[_0x9b32('0x38')]);return db[_0x9b32('0x39')][_0x9b32('0x42')](_0x1fd44b)[_0x9b32('0x21')](handleEntityNotFound(_0x11956f,null))[_0x9b32('0x21')](respondWithResult(_0x11956f,null))[_0x9b32('0x3e')](handleError(_0x11956f,null));};exports[_0x9b32('0x20')]=function(_0x33151a,_0x2ba506){if(_0x33151a[_0x9b32('0x43')]['id']){delete _0x33151a[_0x9b32('0x43')]['id'];}return db[_0x9b32('0x39')][_0x9b32('0x42')]({'where':{'id':_0x33151a[_0x9b32('0x40')]['id']}})['then'](handleEntityNotFound(_0x2ba506,null))[_0x9b32('0x21')](saveUpdates(_0x33151a['body'],null))['then'](respondWithResult(_0x2ba506,null))[_0x9b32('0x3e')](handleError(_0x2ba506,null));};exports[_0x9b32('0x22')]=function(_0x3ff304,_0x116c42){return db[_0x9b32('0x39')][_0x9b32('0x42')]({'where':{'id':_0x3ff304['params']['id']}})[_0x9b32('0x21')](handleEntityNotFound(_0x116c42,null))[_0x9b32('0x21')](removeEntity(_0x116c42,null))[_0x9b32('0x3e')](handleError(_0x116c42,null));};exports['describe']=function(_0x5d0a19,_0xd21ed4){return db['CmHopperBlack'][_0x9b32('0x44')]()['then'](respondWithResult(_0xd21ed4,null))[_0x9b32('0x3e')](handleError(_0xd21ed4,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index 3a73e7e..9fc7f73 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 _0xe55e=['request-promise','path','rimraf','../../config/environment','./cmHopperBlack.attributes','exports','define','CmHopperBlack','cm_hopper_black','util','../../config/logger','api','moment','bluebird'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe55e,0x79));var _0xee55=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xe55e[_0x57b54c];return _0x59cc19;};'use strict';var _=require('lodash');var util=require(_0xee55('0x0'));var logger=require(_0xee55('0x1'))(_0xee55('0x2'));var moment=require(_0xee55('0x3'));var BPromise=require(_0xee55('0x4'));var rp=require(_0xee55('0x5'));var fs=require('fs');var path=require(_0xee55('0x6'));var rimraf=require(_0xee55('0x7'));var config=require(_0xee55('0x8'));var attributes=require(_0xee55('0x9'));module[_0xee55('0xa')]=function(_0x386025,_0x37386c){return _0x386025[_0xee55('0xb')](_0xee55('0xc'),attributes,{'tableName':_0xee55('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x61fa=['bluebird','request-promise','rimraf','../../config/environment','./cmHopperBlack.attributes','exports','define','CmHopperBlack','cm_hopper_black','lodash','util','../../config/logger','api','moment'];(function(_0x492b15,_0x1757e2){var _0x5325a0=function(_0x740fcc){while(--_0x740fcc){_0x492b15['push'](_0x492b15['shift']());}};_0x5325a0(++_0x1757e2);}(_0x61fa,0x1d7));var _0xa61f=function(_0x55fa10,_0x555718){_0x55fa10=_0x55fa10-0x0;var _0x4155ca=_0x61fa[_0x55fa10];return _0x4155ca;};'use strict';var _=require(_0xa61f('0x0'));var util=require(_0xa61f('0x1'));var logger=require(_0xa61f('0x2'))(_0xa61f('0x3'));var moment=require(_0xa61f('0x4'));var BPromise=require(_0xa61f('0x5'));var rp=require(_0xa61f('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa61f('0x7'));var config=require(_0xa61f('0x8'));var attributes=require(_0xa61f('0x9'));module[_0xa61f('0xa')]=function(_0x2f0452,_0x3b1ae8){return _0x2f0452[_0xa61f('0xb')](_0xa61f('0xc'),attributes,{'tableName':_0xa61f('0xd'),'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 12bfa3b..ede6556 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 _0x290c=['info','CmHopperBlack,\x20%s,\x20%s','request\x20sent','CmHopperBlack,\x20%s,\x20%s,\x20%s','stringify','error','code','message','CmHopperBlack','findAll','options','raw','where','attributes','limit','include','map','debug','GetCmHopperBlack','UpdateCmHopperBlack','update','body','DestroyCmHopperBlack','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','client','http','then'];(function(_0x3f70b2,_0x573060){var _0x5a10fb=function(_0x11ec79){while(--_0x11ec79){_0x3f70b2['push'](_0x3f70b2['shift']());}};_0x5a10fb(++_0x573060);}(_0x290c,0x7e));var _0xc290=function(_0xb63d67,_0x574a19){_0xb63d67=_0xb63d67-0x0;var _0x4f64dc=_0x290c[_0xb63d67];return _0x4f64dc;};'use strict';var _=require('lodash');var util=require(_0xc290('0x0'));var moment=require(_0xc290('0x1'));var BPromise=require(_0xc290('0x2'));var rs=require(_0xc290('0x3'));var fs=require('fs');var Redis=require(_0xc290('0x4'));var db=require(_0xc290('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xc290('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xc290('0x7')][_0xc290('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xe7c908,_0x2c95e2,_0x5c3a9c){return new BPromise(function(_0x50db98,_0x583b46){return client['request'](_0xe7c908,_0x5c3a9c)[_0xc290('0x9')](function(_0x47dfeb){logger[_0xc290('0xa')](_0xc290('0xb'),_0x2c95e2,_0xc290('0xc'));logger['debug'](_0xc290('0xd'),_0x2c95e2,_0xc290('0xc'),JSON[_0xc290('0xe')](_0x47dfeb));if(_0x47dfeb[_0xc290('0xf')]){if(_0x47dfeb[_0xc290('0xf')][_0xc290('0x10')]===0x1f4){logger['error'](_0xc290('0xb'),_0x2c95e2,_0x47dfeb[_0xc290('0xf')][_0xc290('0x11')]);return _0x583b46(_0x47dfeb[_0xc290('0xf')]['message']);}logger['error']('CmHopperBlack,\x20%s,\x20%s',_0x2c95e2,_0x47dfeb['error']['message']);return _0x50db98(_0x47dfeb['error'][_0xc290('0x11')]);}else{logger[_0xc290('0xa')](_0xc290('0xb'),_0x2c95e2,_0xc290('0xc'));_0x50db98(_0x47dfeb['result'][_0xc290('0x11')]);}})['catch'](function(_0x3063c2){logger[_0xc290('0xf')](_0xc290('0xb'),_0x2c95e2,_0x3063c2);_0x583b46(_0x3063c2);});});}exports['GetCmHopperBlack']=function(_0x1efd28){var _0x4d5f0d=this;return new Promise(function(_0x497534,_0x74e96c){return db[_0xc290('0x12')][_0xc290('0x13')]({'raw':_0x1efd28[_0xc290('0x14')]?_0x1efd28[_0xc290('0x14')][_0xc290('0x15')]===undefined?!![]:![]:!![],'where':_0x1efd28[_0xc290('0x14')]?_0x1efd28[_0xc290('0x14')][_0xc290('0x16')]||null:null,'attributes':_0x1efd28[_0xc290('0x14')]?_0x1efd28[_0xc290('0x14')][_0xc290('0x17')]||null:null,'limit':_0x1efd28['options']?_0x1efd28[_0xc290('0x14')][_0xc290('0x18')]||null:null,'include':_0x1efd28['options']?_0x1efd28[_0xc290('0x14')][_0xc290('0x19')]?_[_0xc290('0x1a')](_0x1efd28[_0xc290('0x14')][_0xc290('0x19')],function(_0x410079){return{'model':db[_0x410079['model']],'as':_0x410079['as'],'attributes':_0x410079['attributes'],'include':_0x410079[_0xc290('0x19')]?_[_0xc290('0x1a')](_0x410079['include'],function(_0xd33045){return{'model':db[_0xd33045['model']],'as':_0xd33045['as'],'attributes':_0xd33045['attributes'],'include':_0xd33045[_0xc290('0x19')]?_['map'](_0xd33045[_0xc290('0x19')],function(_0x4c5620){return{'model':db[_0x4c5620['model']],'as':_0x4c5620['as'],'attributes':_0x4c5620[_0xc290('0x17')]};}):[]};}):[]};}):[]:[]})[_0xc290('0x9')](function(_0x7b63e2){logger[_0xc290('0xa')]('GetCmHopperBlack',_0x1efd28);logger[_0xc290('0x1b')](_0xc290('0x1c'),_0x1efd28,JSON[_0xc290('0xe')](_0x7b63e2));_0x497534(_0x7b63e2);})['catch'](function(_0x2c815a){logger['error'](_0xc290('0x1c'),_0x2c815a[_0xc290('0x11')],_0x1efd28);_0x74e96c(_0x4d5f0d[_0xc290('0xf')](0x1f4,_0x2c815a[_0xc290('0x11')]));});});};exports[_0xc290('0x1d')]=function(_0x56bbac){var _0x1ff048=this;return new Promise(function(_0x276abb,_0x36d840){return db['CmHopperBlack'][_0xc290('0x1e')](_0x56bbac[_0xc290('0x1f')],{'raw':_0x56bbac['options']?_0x56bbac[_0xc290('0x14')][_0xc290('0x15')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x56bbac[_0xc290('0x14')]?_0x56bbac['options'][_0xc290('0x16')]||null:null,'attributes':_0x56bbac[_0xc290('0x14')]?_0x56bbac['options']['attributes']||null:null,'limit':_0x56bbac[_0xc290('0x14')]?_0x56bbac['options']['limit']||null:null})[_0xc290('0x9')](function(_0x4d9947){logger[_0xc290('0xa')]('UpdateCmHopperBlack',_0x56bbac);logger[_0xc290('0x1b')](_0xc290('0x1d'),_0x56bbac,JSON[_0xc290('0xe')](_0x4d9947));_0x276abb(_0x4d9947);})['catch'](function(_0x16744d){logger[_0xc290('0xf')]('UpdateCmHopperBlack',_0x16744d[_0xc290('0x11')],_0x56bbac);_0x36d840(_0x1ff048[_0xc290('0xf')](0x1f4,_0x16744d['message']));});});};exports[_0xc290('0x20')]=function(_0x384a63){var _0x432eea=this;return new Promise(function(_0x34a2c2,_0x48a11e){return db[_0xc290('0x12')]['destroy']({'where':_0x384a63['options']?_0x384a63[_0xc290('0x14')][_0xc290('0x16')]||null:null})[_0xc290('0x9')](function(_0xc65a97){logger[_0xc290('0xa')](_0xc290('0x20'),_0x384a63);logger[_0xc290('0x1b')](_0xc290('0x20'),_0x384a63,JSON['stringify'](_0xc65a97));_0x34a2c2(_0xc65a97);})[_0xc290('0x21')](function(_0x2ee7a8){logger[_0xc290('0xf')]('DestroyCmHopperBlack',_0x2ee7a8[_0xc290('0x11')],_0x384a63);_0x48a11e(_0x432eea['error'](0x1f4,_0x2ee7a8['message']));});});}; \ No newline at end of file +var _0x2eb6=['../../config/logger','rpc','client','http','request','info','CmHopperBlack,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetCmHopperBlack','findAll','options','where','attributes','map','include','model','then','CmHopperBlack','update','body','limit','UpdateCmHopperBlack','debug','destroy','DestroyCmHopperBlack','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils'];(function(_0x4fd57e,_0x154b79){var _0x782aa7=function(_0x22ba64){while(--_0x22ba64){_0x4fd57e['push'](_0x4fd57e['shift']());}};_0x782aa7(++_0x154b79);}(_0x2eb6,0xb7));var _0x62eb=function(_0x55c81e,_0x522143){_0x55c81e=_0x55c81e-0x0;var _0x2f1ffc=_0x2eb6[_0x55c81e];return _0x2f1ffc;};'use strict';var _=require(_0x62eb('0x0'));var util=require(_0x62eb('0x1'));var moment=require(_0x62eb('0x2'));var BPromise=require(_0x62eb('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x62eb('0x4'));var db=require(_0x62eb('0x5'))['db'];var utils=require(_0x62eb('0x6'));var logger=require(_0x62eb('0x7'))(_0x62eb('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x62eb('0x9')][_0x62eb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2ad0f0,_0x29ff77,_0xdc8448){return new BPromise(function(_0x50d33e,_0x528bdd){return client[_0x62eb('0xb')](_0x2ad0f0,_0xdc8448)['then'](function(_0x37348d){logger[_0x62eb('0xc')](_0x62eb('0xd'),_0x29ff77,_0x62eb('0xe'));logger['debug']('CmHopperBlack,\x20%s,\x20%s,\x20%s',_0x29ff77,_0x62eb('0xe'),JSON[_0x62eb('0xf')](_0x37348d));if(_0x37348d[_0x62eb('0x10')]){if(_0x37348d[_0x62eb('0x10')][_0x62eb('0x11')]===0x1f4){logger['error'](_0x62eb('0xd'),_0x29ff77,_0x37348d[_0x62eb('0x10')][_0x62eb('0x12')]);return _0x528bdd(_0x37348d[_0x62eb('0x10')][_0x62eb('0x12')]);}logger[_0x62eb('0x10')](_0x62eb('0xd'),_0x29ff77,_0x37348d['error'][_0x62eb('0x12')]);return _0x50d33e(_0x37348d[_0x62eb('0x10')]['message']);}else{logger['info'](_0x62eb('0xd'),_0x29ff77,_0x62eb('0xe'));_0x50d33e(_0x37348d[_0x62eb('0x13')]['message']);}})[_0x62eb('0x14')](function(_0x1cf65a){logger[_0x62eb('0x10')](_0x62eb('0xd'),_0x29ff77,_0x1cf65a);_0x528bdd(_0x1cf65a);});});}exports[_0x62eb('0x15')]=function(_0x264084){var _0x331abc=this;return new Promise(function(_0xd766b,_0x3cca84){return db['CmHopperBlack'][_0x62eb('0x16')]({'raw':_0x264084[_0x62eb('0x17')]?_0x264084['options']['raw']===undefined?!![]:![]:!![],'where':_0x264084['options']?_0x264084[_0x62eb('0x17')][_0x62eb('0x18')]||null:null,'attributes':_0x264084[_0x62eb('0x17')]?_0x264084[_0x62eb('0x17')][_0x62eb('0x19')]||null:null,'limit':_0x264084['options']?_0x264084['options']['limit']||null:null,'include':_0x264084['options']?_0x264084[_0x62eb('0x17')]['include']?_[_0x62eb('0x1a')](_0x264084[_0x62eb('0x17')][_0x62eb('0x1b')],function(_0x47b71a){return{'model':db[_0x47b71a[_0x62eb('0x1c')]],'as':_0x47b71a['as'],'attributes':_0x47b71a[_0x62eb('0x19')],'include':_0x47b71a[_0x62eb('0x1b')]?_['map'](_0x47b71a['include'],function(_0x35b7aa){return{'model':db[_0x35b7aa[_0x62eb('0x1c')]],'as':_0x35b7aa['as'],'attributes':_0x35b7aa[_0x62eb('0x19')],'include':_0x35b7aa[_0x62eb('0x1b')]?_[_0x62eb('0x1a')](_0x35b7aa[_0x62eb('0x1b')],function(_0x168393){return{'model':db[_0x168393[_0x62eb('0x1c')]],'as':_0x168393['as'],'attributes':_0x168393[_0x62eb('0x19')]};}):[]};}):[]};}):[]:[]})[_0x62eb('0x1d')](function(_0x4eb0d0){logger[_0x62eb('0xc')](_0x62eb('0x15'),_0x264084);logger['debug']('GetCmHopperBlack',_0x264084,JSON['stringify'](_0x4eb0d0));_0xd766b(_0x4eb0d0);})['catch'](function(_0x324941){logger['error'](_0x62eb('0x15'),_0x324941[_0x62eb('0x12')],_0x264084);_0x3cca84(_0x331abc['error'](0x1f4,_0x324941[_0x62eb('0x12')]));});});};exports['UpdateCmHopperBlack']=function(_0x4902e5){var _0x55e98a=this;return new Promise(function(_0x15b11b,_0x51b8bb){return db[_0x62eb('0x1e')][_0x62eb('0x1f')](_0x4902e5[_0x62eb('0x20')],{'raw':_0x4902e5[_0x62eb('0x17')]?_0x4902e5[_0x62eb('0x17')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4902e5[_0x62eb('0x17')]?_0x4902e5[_0x62eb('0x17')][_0x62eb('0x18')]||null:null,'attributes':_0x4902e5[_0x62eb('0x17')]?_0x4902e5[_0x62eb('0x17')]['attributes']||null:null,'limit':_0x4902e5[_0x62eb('0x17')]?_0x4902e5[_0x62eb('0x17')][_0x62eb('0x21')]||null:null})[_0x62eb('0x1d')](function(_0x1e8482){logger[_0x62eb('0xc')](_0x62eb('0x22'),_0x4902e5);logger[_0x62eb('0x23')](_0x62eb('0x22'),_0x4902e5,JSON['stringify'](_0x1e8482));_0x15b11b(_0x1e8482);})[_0x62eb('0x14')](function(_0x4349b6){logger[_0x62eb('0x10')](_0x62eb('0x22'),_0x4349b6[_0x62eb('0x12')],_0x4902e5);_0x51b8bb(_0x55e98a['error'](0x1f4,_0x4349b6[_0x62eb('0x12')]));});});};exports['DestroyCmHopperBlack']=function(_0x459983){var _0x5e63cb=this;return new Promise(function(_0x3805a7,_0xb2a46a){return db[_0x62eb('0x1e')][_0x62eb('0x24')]({'where':_0x459983['options']?_0x459983[_0x62eb('0x17')][_0x62eb('0x18')]||null:null})[_0x62eb('0x1d')](function(_0x52d1ad){logger['info'](_0x62eb('0x25'),_0x459983);logger[_0x62eb('0x23')](_0x62eb('0x25'),_0x459983,JSON[_0x62eb('0xf')](_0x52d1ad));_0x3805a7(_0x52d1ad);})[_0x62eb('0x14')](function(_0x53446e){logger[_0x62eb('0x10')]('DestroyCmHopperBlack',_0x53446e[_0x62eb('0x12')],_0x459983);_0xb2a46a(_0x5e63cb[_0x62eb('0x10')](0x1f4,_0x53446e[_0x62eb('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index f97dfc6..bf3762b 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 _0x11e5=['update','delete','destroy','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','put'];(function(_0x2712cb,_0x5ea1ac){var _0x7b6f47=function(_0x2d36d8){while(--_0x2d36d8){_0x2712cb['push'](_0x2712cb['shift']());}};_0x7b6f47(++_0x5ea1ac);}(_0x11e5,0x8b));var _0x511e=function(_0x52a58c,_0x102224){_0x52a58c=_0x52a58c-0x0;var _0x3e826a=_0x11e5[_0x52a58c];return _0x3e826a;};'use strict';var multer=require(_0x511e('0x0'));var util=require('util');var path=require(_0x511e('0x1'));var timeout=require(_0x511e('0x2'));var express=require('express');var router=express[_0x511e('0x3')]();var fs_extra=require(_0x511e('0x4'));var auth=require(_0x511e('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x511e('0x6'));var controller=require('./cmHopperBlack.controller');router['get']('/',auth[_0x511e('0x7')](),controller[_0x511e('0x8')]);router[_0x511e('0x9')]('/describe',auth['isAuthenticated'](),controller[_0x511e('0xa')]);router[_0x511e('0x9')](_0x511e('0xb'),auth[_0x511e('0x7')](),controller[_0x511e('0xc')]);router[_0x511e('0xd')](_0x511e('0xb'),auth[_0x511e('0x7')](),controller[_0x511e('0xe')]);router[_0x511e('0xf')](_0x511e('0xb'),auth['isAuthenticated'](),controller[_0x511e('0x10')]);module['exports']=router; \ No newline at end of file +var _0x53ec=['../../components/auth/service','../../config/environment','./cmHopperBlack.controller','isAuthenticated','get','/describe','describe','/:id','show','put','update','multer','util','path','connect-timeout','express','Router'];(function(_0x53a1be,_0x42dff2){var _0x38ae84=function(_0x51fa5c){while(--_0x51fa5c){_0x53a1be['push'](_0x53a1be['shift']());}};_0x38ae84(++_0x42dff2);}(_0x53ec,0x192));var _0xc53e=function(_0x9b14ee,_0x574340){_0x9b14ee=_0x9b14ee-0x0;var _0xc3fa3c=_0x53ec[_0x9b14ee];return _0xc3fa3c;};'use strict';var multer=require(_0xc53e('0x0'));var util=require(_0xc53e('0x1'));var path=require(_0xc53e('0x2'));var timeout=require(_0xc53e('0x3'));var express=require(_0xc53e('0x4'));var router=express[_0xc53e('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xc53e('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xc53e('0x7'));var controller=require(_0xc53e('0x8'));router['get']('/',auth[_0xc53e('0x9')](),controller['index']);router[_0xc53e('0xa')](_0xc53e('0xb'),auth['isAuthenticated'](),controller[_0xc53e('0xc')]);router[_0xc53e('0xa')](_0xc53e('0xd'),auth[_0xc53e('0x9')](),controller[_0xc53e('0xe')]);router[_0xc53e('0xf')](_0xc53e('0xd'),auth[_0xc53e('0x9')](),controller[_0xc53e('0x10')]);router['delete']('/:id',auth[_0xc53e('0x9')](),controller['destroy']);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 957755e..57ac547 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 _0xc885=['getDataValue','endtime','setDataValue','diff','seconds','BOOLEAN','sequelize','exports','INTEGER','STRING','DATE'];(function(_0xf48cce,_0x3531e4){var _0x2a5c38=function(_0x22a454){while(--_0x22a454){_0xf48cce['push'](_0xf48cce['shift']());}};_0x2a5c38(++_0x3531e4);}(_0xc885,0x1d4));var _0x5c88=function(_0x231562,_0xab9705){_0x231562=_0x231562-0x0;var _0x3df715=_0xc885[_0x231562];return _0x3df715;};'use strict';var Sequelize=require(_0x5c88('0x0'));var moment=require('moment');module[_0x5c88('0x1')]={'state':{'type':Sequelize[_0x5c88('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x5c88('0x3')]},'scheduledat':{'type':Sequelize[_0x5c88('0x4')]},'countbusyretry':{'type':Sequelize[_0x5c88('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x5c88('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x5c88('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x5c88('0x3')]},'originatecalleridnum':{'type':Sequelize[_0x5c88('0x3')]},'originatecalleridname':{'type':Sequelize[_0x5c88('0x3')]},'calleridnum':{'type':Sequelize[_0x5c88('0x3')]},'calleridname':{'type':Sequelize[_0x5c88('0x3')]},'starttime':{'type':Sequelize[_0x5c88('0x4')]},'responsetime':{'type':Sequelize[_0x5c88('0x4')]},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize[_0x5c88('0x4')]},'endtime':{'type':Sequelize[_0x5c88('0x4')]},'ringtime':{'type':Sequelize[_0x5c88('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x5c88('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x5c88('0x3')]},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0x5c88('0x3')]},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize[_0x5c88('0x3')]},'disposition':{'type':Sequelize[_0x5c88('0x3')]},'secondDisposition':{'type':Sequelize[_0x5c88('0x3')]},'thirdDisposition':{'type':Sequelize[_0x5c88('0x3')]},'dispositionat':{'type':Sequelize[_0x5c88('0x4')],'set':function(_0x6a6e88){var _0x1408cb=this[_0x5c88('0x5')](_0x5c88('0x6'));if(_0x1408cb&&_0x6a6e88){this[_0x5c88('0x7')]('followuptime',moment(_0x6a6e88)[_0x5c88('0x8')](moment(_0x1408cb),_0x5c88('0x9')));}}},'amd':{'type':Sequelize[_0x5c88('0xa')],'defaultValue':![]},'fax':{'type':Sequelize[_0x5c88('0xa')],'defaultValue':![]},'blacklist':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x5c88('0xa')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0x5c88('0x4')]},'callback':{'type':Sequelize[_0x5c88('0xa')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x5c88('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x5c88('0x4')]},'deleted':{'type':Sequelize[_0x5c88('0x3')],'defaultValue':null},'deletedat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize[_0x5c88('0xa')],'defaultValue':![]},'agiafterat':{'type':Sequelize['DATE']},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x5c88('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x5c88('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x5c88('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x331f=['exports','DATE','INTEGER','STRING','getDataValue','endtime','setDataValue','followuptime','diff','seconds','BOOLEAN','sequelize','moment'];(function(_0x10bf39,_0x3cd4bc){var _0x2ccd63=function(_0x24cf85){while(--_0x24cf85){_0x10bf39['push'](_0x10bf39['shift']());}};_0x2ccd63(++_0x3cd4bc);}(_0x331f,0x1b8));var _0xf331=function(_0x3c04bb,_0x171aee){_0x3c04bb=_0x3c04bb-0x0;var _0x57070e=_0x331f[_0x3c04bb];return _0x57070e;};'use strict';var Sequelize=require(_0xf331('0x0'));var moment=require(_0xf331('0x1'));module[_0xf331('0x2')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0xf331('0x3')]},'countbusyretry':{'type':Sequelize[_0xf331('0x4')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xf331('0x4')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xf331('0x4')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xf331('0x5')]},'originatecalleridnum':{'type':Sequelize[_0xf331('0x5')]},'originatecalleridname':{'type':Sequelize[_0xf331('0x5')]},'calleridnum':{'type':Sequelize[_0xf331('0x5')]},'calleridname':{'type':Sequelize[_0xf331('0x5')]},'starttime':{'type':Sequelize[_0xf331('0x3')]},'responsetime':{'type':Sequelize[_0xf331('0x3')]},'answertime':{'type':Sequelize[_0xf331('0x3')]},'droptime':{'type':Sequelize[_0xf331('0x3')]},'endtime':{'type':Sequelize[_0xf331('0x3')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xf331('0x4')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xf331('0x4')],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xf331('0x5')]},'campaign':{'type':Sequelize[_0xf331('0x5')]},'campaigntype':{'type':Sequelize[_0xf331('0x5')]},'membername':{'type':Sequelize[_0xf331('0x5')]},'reason':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize[_0xf331('0x5')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize['STRING']},'dispositionat':{'type':Sequelize['DATE'],'set':function(_0x4af28c){var _0x297c18=this[_0xf331('0x6')](_0xf331('0x7'));if(_0x297c18&&_0x4af28c){this[_0xf331('0x8')](_0xf331('0x9'),moment(_0x4af28c)[_0xf331('0xa')](moment(_0x297c18),_0xf331('0xb')));}}},'amd':{'type':Sequelize[_0xf331('0xc')],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'blacklist':{'type':Sequelize[_0xf331('0xc')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0xf331('0xc')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0xf331('0x3')]},'callback':{'type':Sequelize[_0xf331('0xc')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xf331('0x5')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xf331('0x3')]},'deleted':{'type':Sequelize['STRING'],'defaultValue':null},'deletedat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize[_0xf331('0xc')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0xf331('0x3')]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xf331('0x4')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xf331('0x4')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xf331('0x4')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xf331('0x4')],'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 c273f60..ce751b6 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 _0x524e=['destroy','name','send','index','map','rawAttributes','key','model','keys','filters','intersection','attributes','fields','query','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','CmHopperFinal','then','includeAll','include','findAll','rows','catch','show','length','find','describe','body','uniqueid','params','sequelize','COUNT','`state`\x20=\x200,\x201,\x20null','noSuchContacts','literal','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','`state`\x20=\x205,\x201,\x20null','busyContacts','`state`\x20=\x208,\x201,\x20null','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','`state`\x20=\x2022,\x201,\x20null','countContactsIvrCampaignHopperFinal','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','reCallContacts','`state`\x20=\x2019,\x201,\x20null','answeringMachine','moveContactsQueueCampaignHopperFinal','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ListId','VoiceQueueId','createdAt','select','field','NOW()','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','ANY_VALUE(VoiceQueueId)','updatedAt','from','cm_hopper_final','toString','state','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','VoiceQueueId\x20=\x20?','group','Campaign','ContactId','ANY_VALUE(calleridnum)','CampaignId','CampaignId\x20=\x20?','state\x20=\x20?','calleridnum','CmHopper','findOne','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','count','set','apply','reject','save','update'];(function(_0x35da42,_0x5c2610){var _0x370035=function(_0x546db5){while(--_0x546db5){_0x35da42['push'](_0x35da42['shift']());}};_0x370035(++_0x5c2610);}(_0x524e,0x15e));var _0xe524=function(_0x115c2f,_0x5c15cc){_0x115c2f=_0x115c2f-0x0;var _0x1990ed=_0x524e[_0x115c2f];return _0x1990ed;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xe524('0x0'));var jsonpatch=require(_0xe524('0x1'));var rp=require(_0xe524('0x2'));var moment=require(_0xe524('0x3'));var BPromise=require(_0xe524('0x4'));var Mustache=require(_0xe524('0x5'));var util=require(_0xe524('0x6'));var path=require(_0xe524('0x7'));var sox=require(_0xe524('0x8'));var csv=require(_0xe524('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe524('0xa'));var _=require(_0xe524('0xb'));var squel=require(_0xe524('0xc'));var crypto=require('crypto');var jsforce=require(_0xe524('0xd'));var deskjs=require(_0xe524('0xe'));var toCsv=require(_0xe524('0x9'));var querystring=require(_0xe524('0xf'));var Papa=require(_0xe524('0x10'));var Redis=require(_0xe524('0x11'));var authService=require(_0xe524('0x12'));var qs=require(_0xe524('0x13'));var as=require(_0xe524('0x14'));var hardwareService=require(_0xe524('0x15'));var logger=require(_0xe524('0x16'))(_0xe524('0x17'));var utils=require(_0xe524('0x18'));var config=require(_0xe524('0x19'));var licenseUtil=require(_0xe524('0x1a'));var db=require(_0xe524('0x1b'))['db'];function respondWithStatusCode(_0x5077c1,_0x4b0f51){_0x4b0f51=_0x4b0f51||0xcc;return function(_0xfdc2a5){if(_0xfdc2a5){return _0x5077c1[_0xe524('0x1c')](_0x4b0f51);}return _0x5077c1[_0xe524('0x1d')](_0x4b0f51)[_0xe524('0x1e')]();};}function respondWithResult(_0x20a852,_0x57c1b6){_0x57c1b6=_0x57c1b6||0xc8;return function(_0x12ff75){if(_0x12ff75){return _0x20a852['status'](_0x57c1b6)[_0xe524('0x1f')](_0x12ff75);}};}function respondWithFilteredResult(_0x1b0af6,_0x48165e){return function(_0x569660){if(_0x569660){var _0x488fce=typeof _0x48165e[_0xe524('0x20')]==='undefined'&&typeof _0x48165e[_0xe524('0x21')]==='undefined';var _0x5c8736=_0x569660['count'];var _0x3a4027=_0x488fce?0x0:_0x48165e['offset'];var _0x11b2a1=_0x488fce?_0x569660[_0xe524('0x22')]:_0x48165e[_0xe524('0x20')]+_0x48165e[_0xe524('0x21')];var _0x5d7b17;if(_0x11b2a1>=_0x5c8736){_0x11b2a1=_0x5c8736;_0x5d7b17=0xc8;}else{_0x5d7b17=0xce;}_0x1b0af6[_0xe524('0x1d')](_0x5d7b17);return _0x1b0af6[_0xe524('0x23')]('Content-Range',_0x3a4027+'-'+_0x11b2a1+'/'+_0x5c8736)[_0xe524('0x1f')](_0x569660);}return null;};}function patchUpdates(_0x309f85){return function(_0x43a4f9){try{jsonpatch[_0xe524('0x24')](_0x43a4f9,_0x309f85,!![]);}catch(_0x1c4194){return BPromise[_0xe524('0x25')](_0x1c4194);}return _0x43a4f9[_0xe524('0x26')]();};}function saveUpdates(_0x375219,_0x7dfe97){return function(_0x5c4d21){if(_0x5c4d21){return _0x5c4d21[_0xe524('0x27')](_0x375219)['then'](function(_0x577d1f){return _0x577d1f;});}return null;};}function removeEntity(_0x2d2f83,_0x23df5e){return function(_0x1ad106){if(_0x1ad106){return _0x1ad106[_0xe524('0x28')]()['then'](function(){_0x2d2f83[_0xe524('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x17e245,_0xcf5db){return function(_0xd62772){if(!_0xd62772){_0x17e245[_0xe524('0x1c')](0x194);}return _0xd62772;};}function handleError(_0x4102d9,_0xfd5965){_0xfd5965=_0xfd5965||0x1f4;return function(_0x2141db){logger['error'](_0x2141db['stack']);if(_0x2141db[_0xe524('0x29')]){delete _0x2141db[_0xe524('0x29')];}_0x4102d9[_0xe524('0x1d')](_0xfd5965)[_0xe524('0x2a')](_0x2141db);};}exports[_0xe524('0x2b')]=function(_0x5405e4,_0x52f140){var _0x4b1ff={},_0x25e7a7={},_0x3aedd9={'count':0x0,'rows':[]};var _0x8070e4=_[_0xe524('0x2c')](db['CmHopperFinal'][_0xe524('0x2d')],function(_0x9a7e98){return{'name':_0x9a7e98['fieldName'],'type':_0x9a7e98['type'][_0xe524('0x2e')]};});_0x25e7a7[_0xe524('0x2f')]=_['map'](_0x8070e4,_0xe524('0x29'));_0x25e7a7['query']=_[_0xe524('0x30')](_0x5405e4['query']);_0x25e7a7[_0xe524('0x31')]=_[_0xe524('0x32')](_0x25e7a7[_0xe524('0x2f')],_0x25e7a7['query']);_0x4b1ff[_0xe524('0x33')]=_['intersection'](_0x25e7a7[_0xe524('0x2f')],qs[_0xe524('0x34')](_0x5405e4[_0xe524('0x35')]['fields']));_0x4b1ff[_0xe524('0x33')]=_0x4b1ff[_0xe524('0x33')]['length']?_0x4b1ff[_0xe524('0x33')]:_0x25e7a7[_0xe524('0x2f')];if(!_0x5405e4[_0xe524('0x35')][_0xe524('0x36')]('nolimit')){_0x4b1ff[_0xe524('0x21')]=qs[_0xe524('0x21')](_0x5405e4[_0xe524('0x35')][_0xe524('0x21')]);_0x4b1ff[_0xe524('0x20')]=qs[_0xe524('0x20')](_0x5405e4[_0xe524('0x35')][_0xe524('0x20')]);}_0x4b1ff['order']=qs[_0xe524('0x37')](_0x5405e4['query'][_0xe524('0x37')]);_0x4b1ff[_0xe524('0x38')]=qs['filters'](_[_0xe524('0x39')](_0x5405e4['query'],_0x25e7a7[_0xe524('0x31')]),_0x8070e4);if(_0x5405e4[_0xe524('0x35')][_0xe524('0x3a')]){_0x4b1ff[_0xe524('0x38')]=_[_0xe524('0x3b')](_0x4b1ff[_0xe524('0x38')],{'$or':_[_0xe524('0x2c')](_0x8070e4,function(_0x13762c){if(_0x13762c['type']!==_0xe524('0x3c')){var _0x940c05={};_0x940c05[_0x13762c[_0xe524('0x29')]]={'$like':'%'+_0x5405e4[_0xe524('0x35')][_0xe524('0x3a')]+'%'};return _0x940c05;}})});}_0x4b1ff=_[_0xe524('0x3b')]({},_0x4b1ff,_0x5405e4[_0xe524('0x3d')]);var _0x158d45={'where':_0x4b1ff['where']};return db[_0xe524('0x3e')][_0xe524('0x22')](_0x158d45)[_0xe524('0x3f')](function(_0x59781b){_0x3aedd9[_0xe524('0x22')]=_0x59781b;if(_0x5405e4['query'][_0xe524('0x40')]){_0x4b1ff[_0xe524('0x41')]=[{'all':!![]}];}return db[_0xe524('0x3e')][_0xe524('0x42')](_0x4b1ff);})[_0xe524('0x3f')](function(_0x4746cd){_0x3aedd9[_0xe524('0x43')]=_0x4746cd;return _0x3aedd9;})['then'](respondWithFilteredResult(_0x52f140,_0x4b1ff))[_0xe524('0x44')](handleError(_0x52f140,null));};exports[_0xe524('0x45')]=function(_0x13c54c,_0x376505){var _0x438962={'raw':!![],'where':{'id':_0x13c54c['params']['id']}},_0x1ae283={};_0x1ae283[_0xe524('0x2f')]=_[_0xe524('0x30')](db[_0xe524('0x3e')]['rawAttributes']);_0x1ae283[_0xe524('0x35')]=_['keys'](_0x13c54c['query']);_0x1ae283[_0xe524('0x31')]=_[_0xe524('0x32')](_0x1ae283['model'],_0x1ae283[_0xe524('0x35')]);_0x438962[_0xe524('0x33')]=_[_0xe524('0x32')](_0x1ae283[_0xe524('0x2f')],qs['fields'](_0x13c54c['query'][_0xe524('0x34')]));_0x438962[_0xe524('0x33')]=_0x438962['attributes'][_0xe524('0x46')]?_0x438962['attributes']:_0x1ae283[_0xe524('0x2f')];if(_0x13c54c[_0xe524('0x35')][_0xe524('0x40')]){_0x438962[_0xe524('0x41')]=[{'all':!![]}];}_0x438962=_[_0xe524('0x3b')]({},_0x438962,_0x13c54c[_0xe524('0x3d')]);return db[_0xe524('0x3e')][_0xe524('0x47')](_0x438962)[_0xe524('0x3f')](handleEntityNotFound(_0x376505,null))[_0xe524('0x3f')](respondWithResult(_0x376505,null))[_0xe524('0x44')](handleError(_0x376505,null));};exports[_0xe524('0x48')]=function(_0x3d7ab7,_0x33b1c8){return db[_0xe524('0x3e')]['describe']()[_0xe524('0x3f')](respondWithResult(_0x33b1c8,null))['catch'](handleError(_0x33b1c8,null));};exports['update']=function(_0x24f313,_0x59fe6b){if(_0x24f313[_0xe524('0x49')][_0xe524('0x4a')]){delete _0x24f313['body'][_0xe524('0x4a')];}return db['CmHopperFinal']['find']({'where':{'uniqueid':_0x24f313[_0xe524('0x4b')]['id']}})[_0xe524('0x3f')](handleEntityNotFound(_0x59fe6b,null))[_0xe524('0x3f')](saveUpdates(_0x24f313['body'],null))['then'](respondWithResult(_0x59fe6b,null))['catch'](handleError(_0x59fe6b,null));};exports['countContactsQueueCampaignHopperFinal']=function(_0x4f7a64,_0x5477ca,_0x45f504){return db[_0xe524('0x3e')]['findAll']({'raw':![],'where':{'VoiceQueueId':_0x4f7a64[_0xe524('0x4b')]['id']},'attributes':[[db[_0xe524('0x4c')]['fn'](_0xe524('0x4d'),db[_0xe524('0x4c')]['fn']('IF',db[_0xe524('0x4c')]['literal'](_0xe524('0x4e')))),_0xe524('0x4f')],[db[_0xe524('0x4c')]['fn']('COUNT',db[_0xe524('0x4c')]['fn']('IF',db['sequelize'][_0xe524('0x50')](_0xe524('0x51')))),_0xe524('0x52')],[db[_0xe524('0x4c')]['fn'](_0xe524('0x4d'),db[_0xe524('0x4c')]['fn']('IF',db[_0xe524('0x4c')][_0xe524('0x50')](_0xe524('0x53')))),_0xe524('0x54')],[db[_0xe524('0x4c')]['fn'](_0xe524('0x4d'),db['sequelize']['fn']('IF',db['sequelize']['literal'](_0xe524('0x55')))),_0xe524('0x56')],[db[_0xe524('0x4c')]['fn'](_0xe524('0x4d'),db[_0xe524('0x4c')]['fn']('IF',db[_0xe524('0x4c')][_0xe524('0x50')](_0xe524('0x57')))),_0xe524('0x58')],[db[_0xe524('0x4c')]['fn'](_0xe524('0x4d'),db['sequelize']['fn']('IF',db[_0xe524('0x4c')][_0xe524('0x50')]('`state`\x20=\x2011\x20,\x201,\x20null'))),'abandonedContacts'],[db['sequelize']['fn']('COUNT',db[_0xe524('0x4c')]['fn']('IF',db[_0xe524('0x4c')][_0xe524('0x50')](_0xe524('0x59')))),'reCallContacts'],[db[_0xe524('0x4c')]['fn'](_0xe524('0x4d'),db[_0xe524('0x4c')]['fn']('IF',db[_0xe524('0x4c')]['literal']('`state`\x20=\x2019,\x201,\x20null'))),'answeringMachine']]})[_0xe524('0x3f')](handleEntityNotFound(_0x5477ca,null))['then'](respondWithResult(_0x5477ca,null))[_0xe524('0x44')](handleError(_0x5477ca,null));};exports[_0xe524('0x5a')]=function(_0x3f4201,_0x287ab8,_0x2b2a0e){return db['CmHopperFinal']['findAll']({'raw':![],'where':{'CampaignId':_0x3f4201[_0xe524('0x4b')]['id']},'attributes':[[db[_0xe524('0x4c')]['fn'](_0xe524('0x4d'),db[_0xe524('0x4c')]['fn']('IF',db[_0xe524('0x4c')][_0xe524('0x50')]('`state`\x20=\x200,\x201,\x20null'))),_0xe524('0x4f')],[db[_0xe524('0x4c')]['fn'](_0xe524('0x4d'),db['sequelize']['fn']('IF',db[_0xe524('0x4c')][_0xe524('0x50')](_0xe524('0x51')))),'noAnswerContacts'],[db['sequelize']['fn'](_0xe524('0x4d'),db[_0xe524('0x4c')]['fn']('IF',db[_0xe524('0x4c')][_0xe524('0x50')](_0xe524('0x53')))),'busyContacts'],[db[_0xe524('0x4c')]['fn'](_0xe524('0x4d'),db[_0xe524('0x4c')]['fn']('IF',db[_0xe524('0x4c')][_0xe524('0x50')](_0xe524('0x55')))),_0xe524('0x56')],[db[_0xe524('0x4c')]['fn'](_0xe524('0x4d'),db[_0xe524('0x4c')]['fn']('IF',db[_0xe524('0x4c')]['literal'](_0xe524('0x57')))),_0xe524('0x58')],[db[_0xe524('0x4c')]['fn'](_0xe524('0x4d'),db[_0xe524('0x4c')]['fn']('IF',db['sequelize'][_0xe524('0x50')](_0xe524('0x5b')))),_0xe524('0x5c')],[db[_0xe524('0x4c')]['fn'](_0xe524('0x4d'),db[_0xe524('0x4c')]['fn']('IF',db[_0xe524('0x4c')]['literal'](_0xe524('0x59')))),_0xe524('0x5d')],[db[_0xe524('0x4c')]['fn'](_0xe524('0x4d'),db['sequelize']['fn']('IF',db[_0xe524('0x4c')]['literal'](_0xe524('0x5e')))),_0xe524('0x5f')]]})[_0xe524('0x3f')](handleEntityNotFound(_0x287ab8,null))['then'](respondWithResult(_0x287ab8,null))[_0xe524('0x44')](handleError(_0x287ab8,null));};exports[_0xe524('0x60')]=function(_0x43d125,_0x13905f,_0x4514d4){return db['VoiceQueue'][_0xe524('0x47')]({'where':{'id':_0x43d125[_0xe524('0x4b')]['id']}})[_0xe524('0x3f')](handleEntityNotFound(_0x13905f,null))[_0xe524('0x3f')](function(_0x109da1){var _0x57b6bb;if(_0x109da1){_0x57b6bb=squel[_0xe524('0x61')]()[_0xe524('0x62')](_0xe524('0x63'))[_0xe524('0x64')]([_0xe524('0x65'),_0xe524('0x66'),'ContactId',_0xe524('0x67'),_0xe524('0x68'),_0xe524('0x69'),'updatedAt'],squel[_0xe524('0x6a')]()[_0xe524('0x6b')]('ANY_VALUE(calleridnum)',_0xe524('0x65'))[_0xe524('0x6b')](_0xe524('0x6c'),_0xe524('0x66'))[_0xe524('0x6b')](_0xe524('0x6d'),'ContactId')[_0xe524('0x6b')](_0xe524('0x6e'),_0xe524('0x67'))[_0xe524('0x6b')](_0xe524('0x6f'),_0xe524('0x68'))[_0xe524('0x6b')](_0xe524('0x6c'),_0xe524('0x69'))[_0xe524('0x6b')](_0xe524('0x6c'),_0xe524('0x70'))[_0xe524('0x71')](_0xe524('0x72'))[_0xe524('0x38')]('VoiceQueueId\x20=\x20?',_0x43d125[_0xe524('0x4b')]['id'][_0xe524('0x73')]())[_0xe524('0x38')]('state\x20=\x20?',_0x43d125[_0xe524('0x49')][_0xe524('0x74')]['toString']())['where'](_0xe524('0x75'))['where'](_0xe524('0x76'),squel['select']()[_0xe524('0x6b')](_0xe524('0x65'))[_0xe524('0x71')](_0xe524('0x63'))['where']('VoiceQueueId\x20=\x20?',_0x43d125[_0xe524('0x4b')]['id'][_0xe524('0x73')]()))['where'](_0xe524('0x76'),squel[_0xe524('0x6a')]()[_0xe524('0x6b')]('calleridnum')[_0xe524('0x71')](_0xe524('0x72'))[_0xe524('0x38')](_0xe524('0x77'),_0x43d125[_0xe524('0x4b')]['id'][_0xe524('0x73')]())['where']('state\x20=\x204'))[_0xe524('0x78')]('ContactId'))[_0xe524('0x73')]();return db[_0xe524('0x4c')][_0xe524('0x35')](_0x57b6bb);}return[];})['then'](respondWithResult(_0x13905f,null))[_0xe524('0x44')](handleError(_0x13905f,null));};exports['moveContactsIvrCampaignHopperFinal']=function(_0x1681c5,_0x41e693,_0xfc62e5){return db[_0xe524('0x79')][_0xe524('0x47')]({'where':{'id':_0x1681c5[_0xe524('0x4b')]['id']}})['then'](handleEntityNotFound(_0x41e693,null))[_0xe524('0x3f')](function(_0x35d0f4){var _0xa8334;if(_0x35d0f4){_0xa8334=squel['insert']()[_0xe524('0x62')](_0xe524('0x63'))['fromQuery']([_0xe524('0x65'),_0xe524('0x66'),_0xe524('0x7a'),_0xe524('0x67'),'CampaignId',_0xe524('0x69'),_0xe524('0x70')],squel[_0xe524('0x6a')]()['field'](_0xe524('0x7b'),'phone')[_0xe524('0x6b')](_0xe524('0x6c'),_0xe524('0x66'))['field'](_0xe524('0x6d'),_0xe524('0x7a'))[_0xe524('0x6b')]('ANY_VALUE(ListId)','ListId')[_0xe524('0x6b')]('ANY_VALUE(CampaignId)',_0xe524('0x7c'))['field'](_0xe524('0x6c'),_0xe524('0x69'))['field'](_0xe524('0x6c'),_0xe524('0x70'))['from']('cm_hopper_final')[_0xe524('0x38')](_0xe524('0x7d'),_0x1681c5[_0xe524('0x4b')]['id']['toString']())[_0xe524('0x38')](_0xe524('0x7e'),_0x1681c5[_0xe524('0x49')][_0xe524('0x74')][_0xe524('0x73')]())[_0xe524('0x38')]('calleridnum\x20IS\x20NOT\x20NULL')[_0xe524('0x38')](_0xe524('0x76'),squel['select']()['field'](_0xe524('0x65'))[_0xe524('0x71')](_0xe524('0x63'))[_0xe524('0x38')]('CampaignId\x20=\x20?',_0x1681c5[_0xe524('0x4b')]['id'][_0xe524('0x73')]()))['where']('calleridnum\x20NOT\x20IN\x20(?)',squel[_0xe524('0x6a')]()[_0xe524('0x6b')](_0xe524('0x7f'))[_0xe524('0x71')](_0xe524('0x72'))[_0xe524('0x38')]('CampaignId\x20=\x20?',_0x1681c5['params']['id'][_0xe524('0x73')]())[_0xe524('0x38')]('state\x20=\x204'))['group'](_0xe524('0x7a')))[_0xe524('0x73')]();return db[_0xe524('0x4c')][_0xe524('0x35')](_0xa8334);}return[];})[_0xe524('0x3f')](respondWithResult(_0x41e693,null))[_0xe524('0x44')](handleError(_0x41e693,null));};exports['checkContactHopper']=function(_0x555801,_0x3e8668,_0x390093){return db[_0xe524('0x80')][_0xe524('0x81')]({'where':{'VoiceQueueId':_0x555801[_0xe524('0x49')][_0xe524('0x68')],'CampaignId':_0x555801[_0xe524('0x49')][_0xe524('0x7c')],'ContactId':_0x555801['body'][_0xe524('0x7a')]}})[_0xe524('0x3f')](handleEntityNotFound(_0x3e8668,null))[_0xe524('0x3f')](function(_0x5242b7){if(_0x5242b7){return _0x5242b7;}return null;})['then'](respondWithResult(_0x3e8668,null))[_0xe524('0x44')](handleError(_0x3e8668,null));}; \ No newline at end of file +var _0x31f0=['sequelize','COUNT','`state`\x20=\x200,\x201,\x20null','literal','noAnswerContacts','`state`\x20=\x205,\x201,\x20null','congestionContacts','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','reCallContacts','`state`\x20=\x2019,\x201,\x20null','answeringMachine','noSuchContacts','`state`\x20=\x203,\x201,\x20null','busyContacts','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','VoiceQueue','insert','into','cm_hopper','fromQuery','phone','ListId','createdAt','select','field','ANY_VALUE(calleridnum)','scheduledAt','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','ANY_VALUE(VoiceQueueId)','NOW()','from','cm_hopper_final','VoiceQueueId\x20=\x20?','toString','state\x20=\x20?','state','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','calleridnum','state\x20=\x204','group','ContactId','Campaign','CampaignId','updatedAt','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','CmHopper','findOne','eml-format','zip-dir','request-promise','moment','bluebird','mustache','path','sox','lodash','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','limit','undefined','count','set','Content-Range','json','apply','reject','update','destroy','then','stack','name','send','index','map','CmHopperFinal','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','describe','body','uniqueid','countContactsQueueCampaignHopperFinal'];(function(_0x2aecb2,_0x343312){var _0x3ebb80=function(_0x19fab3){while(--_0x19fab3){_0x2aecb2['push'](_0x2aecb2['shift']());}};_0x3ebb80(++_0x343312);}(_0x31f0,0xb7));var _0x031f=function(_0x5669c9,_0x19cd09){_0x5669c9=_0x5669c9-0x0;var _0x313174=_0x31f0[_0x5669c9];return _0x313174;};'use strict';var emlformat=require(_0x031f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x031f('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x031f('0x2'));var moment=require(_0x031f('0x3'));var BPromise=require(_0x031f('0x4'));var Mustache=require(_0x031f('0x5'));var util=require('util');var path=require(_0x031f('0x6'));var sox=require(_0x031f('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x031f('0x8'));var squel=require('squel');var crypto=require(_0x031f('0x9'));var jsforce=require(_0x031f('0xa'));var deskjs=require(_0x031f('0xb'));var toCsv=require(_0x031f('0xc'));var querystring=require('querystring');var Papa=require(_0x031f('0xd'));var Redis=require(_0x031f('0xe'));var authService=require(_0x031f('0xf'));var qs=require(_0x031f('0x10'));var as=require(_0x031f('0x11'));var hardwareService=require(_0x031f('0x12'));var logger=require(_0x031f('0x13'))(_0x031f('0x14'));var utils=require('../../config/utils');var config=require(_0x031f('0x15'));var licenseUtil=require(_0x031f('0x16'));var db=require(_0x031f('0x17'))['db'];function respondWithStatusCode(_0x351052,_0x3819bb){_0x3819bb=_0x3819bb||0xcc;return function(_0x405896){if(_0x405896){return _0x351052[_0x031f('0x18')](_0x3819bb);}return _0x351052['status'](_0x3819bb)[_0x031f('0x19')]();};}function respondWithResult(_0x23b40c,_0x17a699){_0x17a699=_0x17a699||0xc8;return function(_0x2e3dfe){if(_0x2e3dfe){return _0x23b40c[_0x031f('0x1a')](_0x17a699)['json'](_0x2e3dfe);}};}function respondWithFilteredResult(_0x4b7011,_0x1f08db){return function(_0x3a10aa){if(_0x3a10aa){var _0xe4fc1d=typeof _0x1f08db[_0x031f('0x1b')]==='undefined'&&typeof _0x1f08db[_0x031f('0x1c')]===_0x031f('0x1d');var _0x5d0c70=_0x3a10aa[_0x031f('0x1e')];var _0x535e70=_0xe4fc1d?0x0:_0x1f08db[_0x031f('0x1b')];var _0x5f2199=_0xe4fc1d?_0x3a10aa[_0x031f('0x1e')]:_0x1f08db[_0x031f('0x1b')]+_0x1f08db[_0x031f('0x1c')];var _0x26cb5e;if(_0x5f2199>=_0x5d0c70){_0x5f2199=_0x5d0c70;_0x26cb5e=0xc8;}else{_0x26cb5e=0xce;}_0x4b7011[_0x031f('0x1a')](_0x26cb5e);return _0x4b7011[_0x031f('0x1f')](_0x031f('0x20'),_0x535e70+'-'+_0x5f2199+'/'+_0x5d0c70)[_0x031f('0x21')](_0x3a10aa);}return null;};}function patchUpdates(_0x29dd6e){return function(_0x48a76e){try{jsonpatch[_0x031f('0x22')](_0x48a76e,_0x29dd6e,!![]);}catch(_0x33926c){return BPromise[_0x031f('0x23')](_0x33926c);}return _0x48a76e['save']();};}function saveUpdates(_0x5c4184,_0xa11a2b){return function(_0x4d0f92){if(_0x4d0f92){return _0x4d0f92[_0x031f('0x24')](_0x5c4184)['then'](function(_0x54d054){return _0x54d054;});}return null;};}function removeEntity(_0x47d639,_0x971691){return function(_0x12c406){if(_0x12c406){return _0x12c406[_0x031f('0x25')]()[_0x031f('0x26')](function(){_0x47d639['status'](0xcc)[_0x031f('0x19')]();});}};}function handleEntityNotFound(_0x5a64c0,_0x40cb1c){return function(_0x1f5a14){if(!_0x1f5a14){_0x5a64c0[_0x031f('0x18')](0x194);}return _0x1f5a14;};}function handleError(_0x567666,_0x35af16){_0x35af16=_0x35af16||0x1f4;return function(_0x3b2a51){logger['error'](_0x3b2a51[_0x031f('0x27')]);if(_0x3b2a51[_0x031f('0x28')]){delete _0x3b2a51[_0x031f('0x28')];}_0x567666['status'](_0x35af16)[_0x031f('0x29')](_0x3b2a51);};}exports[_0x031f('0x2a')]=function(_0xb6ed6c,_0xaf5bea){var _0xfaa36={},_0x301bd2={},_0x52b544={'count':0x0,'rows':[]};var _0x1f62eb=_[_0x031f('0x2b')](db[_0x031f('0x2c')][_0x031f('0x2d')],function(_0x428ec4){return{'name':_0x428ec4[_0x031f('0x2e')],'type':_0x428ec4[_0x031f('0x2f')][_0x031f('0x30')]};});_0x301bd2[_0x031f('0x31')]=_[_0x031f('0x2b')](_0x1f62eb,_0x031f('0x28'));_0x301bd2['query']=_[_0x031f('0x32')](_0xb6ed6c[_0x031f('0x33')]);_0x301bd2[_0x031f('0x34')]=_[_0x031f('0x35')](_0x301bd2[_0x031f('0x31')],_0x301bd2[_0x031f('0x33')]);_0xfaa36[_0x031f('0x36')]=_[_0x031f('0x35')](_0x301bd2[_0x031f('0x31')],qs[_0x031f('0x37')](_0xb6ed6c[_0x031f('0x33')][_0x031f('0x37')]));_0xfaa36[_0x031f('0x36')]=_0xfaa36['attributes'][_0x031f('0x38')]?_0xfaa36[_0x031f('0x36')]:_0x301bd2['model'];if(!_0xb6ed6c[_0x031f('0x33')][_0x031f('0x39')]('nolimit')){_0xfaa36[_0x031f('0x1c')]=qs[_0x031f('0x1c')](_0xb6ed6c[_0x031f('0x33')][_0x031f('0x1c')]);_0xfaa36['offset']=qs['offset'](_0xb6ed6c[_0x031f('0x33')]['offset']);}_0xfaa36[_0x031f('0x3a')]=qs[_0x031f('0x3b')](_0xb6ed6c[_0x031f('0x33')]['sort']);_0xfaa36['where']=qs[_0x031f('0x34')](_['pick'](_0xb6ed6c['query'],_0x301bd2[_0x031f('0x34')]),_0x1f62eb);if(_0xb6ed6c[_0x031f('0x33')][_0x031f('0x3c')]){_0xfaa36[_0x031f('0x3d')]=_[_0x031f('0x3e')](_0xfaa36[_0x031f('0x3d')],{'$or':_[_0x031f('0x2b')](_0x1f62eb,function(_0x55c85f){if(_0x55c85f[_0x031f('0x2f')]!==_0x031f('0x3f')){var _0xb3b188={};_0xb3b188[_0x55c85f[_0x031f('0x28')]]={'$like':'%'+_0xb6ed6c['query'][_0x031f('0x3c')]+'%'};return _0xb3b188;}})});}_0xfaa36=_[_0x031f('0x3e')]({},_0xfaa36,_0xb6ed6c[_0x031f('0x40')]);var _0x5895f6={'where':_0xfaa36[_0x031f('0x3d')]};return db[_0x031f('0x2c')]['count'](_0x5895f6)[_0x031f('0x26')](function(_0x268dc7){_0x52b544['count']=_0x268dc7;if(_0xb6ed6c['query'][_0x031f('0x41')]){_0xfaa36[_0x031f('0x42')]=[{'all':!![]}];}return db[_0x031f('0x2c')][_0x031f('0x43')](_0xfaa36);})[_0x031f('0x26')](function(_0xf0fb95){_0x52b544[_0x031f('0x44')]=_0xf0fb95;return _0x52b544;})['then'](respondWithFilteredResult(_0xaf5bea,_0xfaa36))[_0x031f('0x45')](handleError(_0xaf5bea,null));};exports[_0x031f('0x46')]=function(_0x4d701e,_0x12279a){var _0x505e93={'raw':!![],'where':{'id':_0x4d701e[_0x031f('0x47')]['id']}},_0x456a98={};_0x456a98['model']=_[_0x031f('0x32')](db[_0x031f('0x2c')][_0x031f('0x2d')]);_0x456a98['query']=_[_0x031f('0x32')](_0x4d701e[_0x031f('0x33')]);_0x456a98[_0x031f('0x34')]=_[_0x031f('0x35')](_0x456a98[_0x031f('0x31')],_0x456a98[_0x031f('0x33')]);_0x505e93[_0x031f('0x36')]=_[_0x031f('0x35')](_0x456a98[_0x031f('0x31')],qs['fields'](_0x4d701e[_0x031f('0x33')][_0x031f('0x37')]));_0x505e93[_0x031f('0x36')]=_0x505e93[_0x031f('0x36')][_0x031f('0x38')]?_0x505e93[_0x031f('0x36')]:_0x456a98[_0x031f('0x31')];if(_0x4d701e[_0x031f('0x33')][_0x031f('0x41')]){_0x505e93['include']=[{'all':!![]}];}_0x505e93=_[_0x031f('0x3e')]({},_0x505e93,_0x4d701e['options']);return db['CmHopperFinal'][_0x031f('0x48')](_0x505e93)[_0x031f('0x26')](handleEntityNotFound(_0x12279a,null))[_0x031f('0x26')](respondWithResult(_0x12279a,null))[_0x031f('0x45')](handleError(_0x12279a,null));};exports[_0x031f('0x49')]=function(_0x553f01,_0x309642){return db[_0x031f('0x2c')][_0x031f('0x49')]()['then'](respondWithResult(_0x309642,null))[_0x031f('0x45')](handleError(_0x309642,null));};exports[_0x031f('0x24')]=function(_0x2dba78,_0x318829){if(_0x2dba78[_0x031f('0x4a')][_0x031f('0x4b')]){delete _0x2dba78['body']['uniqueid'];}return db[_0x031f('0x2c')]['find']({'where':{'uniqueid':_0x2dba78[_0x031f('0x47')]['id']}})[_0x031f('0x26')](handleEntityNotFound(_0x318829,null))['then'](saveUpdates(_0x2dba78[_0x031f('0x4a')],null))['then'](respondWithResult(_0x318829,null))['catch'](handleError(_0x318829,null));};exports[_0x031f('0x4c')]=function(_0x48ca85,_0x16bade,_0x57e9dc){return db[_0x031f('0x2c')][_0x031f('0x43')]({'raw':![],'where':{'VoiceQueueId':_0x48ca85['params']['id']},'attributes':[[db[_0x031f('0x4d')]['fn'](_0x031f('0x4e'),db['sequelize']['fn']('IF',db[_0x031f('0x4d')]['literal'](_0x031f('0x4f')))),'noSuchContacts'],[db[_0x031f('0x4d')]['fn'](_0x031f('0x4e'),db[_0x031f('0x4d')]['fn']('IF',db[_0x031f('0x4d')][_0x031f('0x50')]('`state`\x20=\x203,\x201,\x20null'))),_0x031f('0x51')],[db['sequelize']['fn'](_0x031f('0x4e'),db[_0x031f('0x4d')]['fn']('IF',db['sequelize'][_0x031f('0x50')](_0x031f('0x52')))),'busyContacts'],[db[_0x031f('0x4d')]['fn'](_0x031f('0x4e'),db[_0x031f('0x4d')]['fn']('IF',db['sequelize'][_0x031f('0x50')]('`state`\x20=\x208,\x201,\x20null'))),_0x031f('0x53')],[db['sequelize']['fn'](_0x031f('0x4e'),db['sequelize']['fn']('IF',db[_0x031f('0x4d')][_0x031f('0x50')]('`state`\x20=\x2010\x20,\x201,\x20null'))),'dropContacts'],[db[_0x031f('0x4d')]['fn'](_0x031f('0x4e'),db['sequelize']['fn']('IF',db[_0x031f('0x4d')][_0x031f('0x50')](_0x031f('0x54')))),_0x031f('0x55')],[db[_0x031f('0x4d')]['fn'](_0x031f('0x4e'),db[_0x031f('0x4d')]['fn']('IF',db[_0x031f('0x4d')]['literal'](_0x031f('0x56')))),_0x031f('0x57')],[db[_0x031f('0x4d')]['fn']('COUNT',db[_0x031f('0x4d')]['fn']('IF',db[_0x031f('0x4d')]['literal'](_0x031f('0x58')))),_0x031f('0x59')]]})[_0x031f('0x26')](handleEntityNotFound(_0x16bade,null))[_0x031f('0x26')](respondWithResult(_0x16bade,null))['catch'](handleError(_0x16bade,null));};exports['countContactsIvrCampaignHopperFinal']=function(_0x4b5db9,_0x4e2d0d,_0x9f76f3){return db[_0x031f('0x2c')]['findAll']({'raw':![],'where':{'CampaignId':_0x4b5db9[_0x031f('0x47')]['id']},'attributes':[[db[_0x031f('0x4d')]['fn']('COUNT',db[_0x031f('0x4d')]['fn']('IF',db[_0x031f('0x4d')][_0x031f('0x50')](_0x031f('0x4f')))),_0x031f('0x5a')],[db[_0x031f('0x4d')]['fn'](_0x031f('0x4e'),db[_0x031f('0x4d')]['fn']('IF',db[_0x031f('0x4d')]['literal'](_0x031f('0x5b')))),'noAnswerContacts'],[db[_0x031f('0x4d')]['fn'](_0x031f('0x4e'),db[_0x031f('0x4d')]['fn']('IF',db['sequelize']['literal'](_0x031f('0x52')))),_0x031f('0x5c')],[db[_0x031f('0x4d')]['fn'](_0x031f('0x4e'),db['sequelize']['fn']('IF',db[_0x031f('0x4d')]['literal']('`state`\x20=\x208,\x201,\x20null'))),_0x031f('0x53')],[db['sequelize']['fn']('COUNT',db[_0x031f('0x4d')]['fn']('IF',db[_0x031f('0x4d')][_0x031f('0x50')](_0x031f('0x5d')))),_0x031f('0x5e')],[db['sequelize']['fn']('COUNT',db[_0x031f('0x4d')]['fn']('IF',db['sequelize'][_0x031f('0x50')](_0x031f('0x54')))),'abandonedContacts'],[db[_0x031f('0x4d')]['fn'](_0x031f('0x4e'),db[_0x031f('0x4d')]['fn']('IF',db[_0x031f('0x4d')][_0x031f('0x50')](_0x031f('0x56')))),'reCallContacts'],[db['sequelize']['fn'](_0x031f('0x4e'),db[_0x031f('0x4d')]['fn']('IF',db[_0x031f('0x4d')][_0x031f('0x50')](_0x031f('0x58')))),_0x031f('0x59')]]})[_0x031f('0x26')](handleEntityNotFound(_0x4e2d0d,null))['then'](respondWithResult(_0x4e2d0d,null))['catch'](handleError(_0x4e2d0d,null));};exports['moveContactsQueueCampaignHopperFinal']=function(_0x5ddf46,_0x2e3582,_0x14b33e){return db[_0x031f('0x5f')]['find']({'where':{'id':_0x5ddf46[_0x031f('0x47')]['id']}})[_0x031f('0x26')](handleEntityNotFound(_0x2e3582,null))['then'](function(_0x76253){var _0x2c15f4;if(_0x76253){_0x2c15f4=squel[_0x031f('0x60')]()[_0x031f('0x61')](_0x031f('0x62'))[_0x031f('0x63')]([_0x031f('0x64'),'scheduledAt','ContactId',_0x031f('0x65'),'VoiceQueueId',_0x031f('0x66'),'updatedAt'],squel[_0x031f('0x67')]()[_0x031f('0x68')](_0x031f('0x69'),'phone')[_0x031f('0x68')]('NOW()',_0x031f('0x6a'))[_0x031f('0x68')](_0x031f('0x6b'),'ContactId')[_0x031f('0x68')](_0x031f('0x6c'),_0x031f('0x65'))[_0x031f('0x68')](_0x031f('0x6d'),'VoiceQueueId')['field'](_0x031f('0x6e'),_0x031f('0x66'))['field'](_0x031f('0x6e'),'updatedAt')[_0x031f('0x6f')](_0x031f('0x70'))[_0x031f('0x3d')](_0x031f('0x71'),_0x5ddf46['params']['id'][_0x031f('0x72')]())[_0x031f('0x3d')](_0x031f('0x73'),_0x5ddf46['body'][_0x031f('0x74')][_0x031f('0x72')]())['where'](_0x031f('0x75'))[_0x031f('0x3d')](_0x031f('0x76'),squel[_0x031f('0x67')]()[_0x031f('0x68')](_0x031f('0x64'))[_0x031f('0x6f')]('cm_hopper')[_0x031f('0x3d')](_0x031f('0x71'),_0x5ddf46[_0x031f('0x47')]['id']['toString']()))['where'](_0x031f('0x76'),squel['select']()['field'](_0x031f('0x77'))[_0x031f('0x6f')](_0x031f('0x70'))[_0x031f('0x3d')](_0x031f('0x71'),_0x5ddf46[_0x031f('0x47')]['id'][_0x031f('0x72')]())[_0x031f('0x3d')](_0x031f('0x78')))[_0x031f('0x79')](_0x031f('0x7a')))['toString']();return db[_0x031f('0x4d')][_0x031f('0x33')](_0x2c15f4);}return[];})[_0x031f('0x26')](respondWithResult(_0x2e3582,null))[_0x031f('0x45')](handleError(_0x2e3582,null));};exports['moveContactsIvrCampaignHopperFinal']=function(_0x6970f5,_0x5329c2,_0x4a40ad){return db[_0x031f('0x7b')][_0x031f('0x48')]({'where':{'id':_0x6970f5['params']['id']}})['then'](handleEntityNotFound(_0x5329c2,null))[_0x031f('0x26')](function(_0x62016){var _0x1c4561;if(_0x62016){_0x1c4561=squel[_0x031f('0x60')]()[_0x031f('0x61')](_0x031f('0x62'))['fromQuery']([_0x031f('0x64'),_0x031f('0x6a'),'ContactId',_0x031f('0x65'),_0x031f('0x7c'),_0x031f('0x66'),_0x031f('0x7d')],squel[_0x031f('0x67')]()[_0x031f('0x68')](_0x031f('0x69'),'phone')[_0x031f('0x68')]('NOW()',_0x031f('0x6a'))[_0x031f('0x68')](_0x031f('0x6b'),'ContactId')['field']('ANY_VALUE(ListId)',_0x031f('0x65'))[_0x031f('0x68')](_0x031f('0x7e'),_0x031f('0x7c'))[_0x031f('0x68')](_0x031f('0x6e'),_0x031f('0x66'))['field']('NOW()',_0x031f('0x7d'))[_0x031f('0x6f')]('cm_hopper_final')[_0x031f('0x3d')]('CampaignId\x20=\x20?',_0x6970f5[_0x031f('0x47')]['id'][_0x031f('0x72')]())['where'](_0x031f('0x73'),_0x6970f5[_0x031f('0x4a')]['state'][_0x031f('0x72')]())[_0x031f('0x3d')](_0x031f('0x75'))['where'](_0x031f('0x76'),squel[_0x031f('0x67')]()[_0x031f('0x68')](_0x031f('0x64'))[_0x031f('0x6f')](_0x031f('0x62'))['where'](_0x031f('0x7f'),_0x6970f5[_0x031f('0x47')]['id'][_0x031f('0x72')]()))[_0x031f('0x3d')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x031f('0x67')]()[_0x031f('0x68')]('calleridnum')[_0x031f('0x6f')](_0x031f('0x70'))[_0x031f('0x3d')](_0x031f('0x7f'),_0x6970f5[_0x031f('0x47')]['id'][_0x031f('0x72')]())[_0x031f('0x3d')](_0x031f('0x78')))[_0x031f('0x79')](_0x031f('0x7a')))[_0x031f('0x72')]();return db[_0x031f('0x4d')][_0x031f('0x33')](_0x1c4561);}return[];})[_0x031f('0x26')](respondWithResult(_0x5329c2,null))[_0x031f('0x45')](handleError(_0x5329c2,null));};exports['checkContactHopper']=function(_0x1b8494,_0x4368d6,_0xa0c51f){return db[_0x031f('0x80')][_0x031f('0x81')]({'where':{'VoiceQueueId':_0x1b8494[_0x031f('0x4a')]['VoiceQueueId'],'CampaignId':_0x1b8494['body']['CampaignId'],'ContactId':_0x1b8494[_0x031f('0x4a')][_0x031f('0x7a')]}})['then'](handleEntityNotFound(_0x4368d6,null))[_0x031f('0x26')](function(_0x303cfa){if(_0x303cfa){return _0x303cfa;}return null;})[_0x031f('0x26')](respondWithResult(_0x4368d6,null))[_0x031f('0x45')](handleError(_0x4368d6,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index 6bea38f..33565f3 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 _0x288d=['exports','CmHopperFinal','cm_hopper_final','calleridnum','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopperFinal.attributes'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x288d,0x105));var _0xd288=function(_0x1cdb11,_0x102d5c){_0x1cdb11=_0x1cdb11-0x0;var _0x4acaef=_0x288d[_0x1cdb11];return _0x4acaef;};'use strict';var _=require(_0xd288('0x0'));var util=require(_0xd288('0x1'));var logger=require(_0xd288('0x2'))(_0xd288('0x3'));var moment=require(_0xd288('0x4'));var BPromise=require(_0xd288('0x5'));var rp=require(_0xd288('0x6'));var fs=require('fs');var path=require(_0xd288('0x7'));var rimraf=require(_0xd288('0x8'));var config=require(_0xd288('0x9'));var attributes=require(_0xd288('0xa'));module[_0xd288('0xb')]=function(_0x484104,_0x47d17f){return _0x484104['define'](_0xd288('0xc'),attributes,{'tableName':_0xd288('0xd'),'paranoid':![],'indexes':[{'name':_0xd288('0xe'),'fields':[_0xd288('0xe')]},{'name':_0xd288('0xf'),'fields':[_0xd288('0xf')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb934=['calleridnum','uniqueid','lodash','util','../../config/logger','bluebird','request-promise','rimraf','exports','CmHopperFinal','cm_hopper_final'];(function(_0x53c370,_0x50d593){var _0xf2ab09=function(_0x3ac148){while(--_0x3ac148){_0x53c370['push'](_0x53c370['shift']());}};_0xf2ab09(++_0x50d593);}(_0xb934,0x136));var _0x4b93=function(_0x5035bb,_0x412987){_0x5035bb=_0x5035bb-0x0;var _0x3a3ad4=_0xb934[_0x5035bb];return _0x3a3ad4;};'use strict';var _=require(_0x4b93('0x0'));var util=require(_0x4b93('0x1'));var logger=require(_0x4b93('0x2'))('api');var moment=require('moment');var BPromise=require(_0x4b93('0x3'));var rp=require(_0x4b93('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4b93('0x5'));var config=require('../../config/environment');var attributes=require('./cmHopperFinal.attributes');module[_0x4b93('0x6')]=function(_0x13a438,_0x403949){return _0x13a438['define'](_0x4b93('0x7'),attributes,{'tableName':_0x4b93('0x8'),'paranoid':![],'indexes':[{'name':_0x4b93('0x9'),'fields':['calleridnum']},{'name':_0x4b93('0xa'),'fields':[_0x4b93('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.rpc.js b/server/api/cmHopperFinal/cmHopperFinal.rpc.js index a703f7b..76f454d 100644 --- a/server/api/cmHopperFinal/cmHopperFinal.rpc.js +++ b/server/api/cmHopperFinal/cmHopperFinal.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['debug','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','CmHopperFinal,\x20%s,\x20%s','CmHopperFinal,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','CreateCmHopperFinal','CmHopperFinal','create','options','raw'];(function(_0x1c2eaf,_0x34a30a){var _0x492f3c=function(_0x580a51){while(--_0x580a51){_0x1c2eaf['push'](_0x1c2eaf['shift']());}};_0x492f3c(++_0x34a30a);}(_0xb10b,0x12a));var _0xbb10=function(_0x1f2941,_0x3544ce){_0x1f2941=_0x1f2941-0x0;var _0x31e313=_0xb10b[_0x1f2941];return _0x31e313;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')](_0x378da8['body'],{'raw':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![]})[_0xbb10('0xc')](function(_0xdf237d){logger[_0xbb10('0xd')]('CreateCmHopperFinal',_0x378da8);logger[_0xbb10('0x1a')](_0xbb10('0x15'),_0x378da8,JSON['stringify'](_0xdf237d));_0x575cca(_0xdf237d);})['catch'](function(_0x8e2b97){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x8e2b97[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x8e2b97[_0xbb10('0x13')]));});});}; \ No newline at end of file +var _0x7a54=['../../config/environment','jayson/promise','http','info','CmHopperFinal,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','CmHopperFinal','create','body','options','raw','CreateCmHopperFinal','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x10445f,_0x2dc1a6){var _0x5c74f7=function(_0x4e3b8a){while(--_0x4e3b8a){_0x10445f['push'](_0x10445f['shift']());}};_0x5c74f7(++_0x2dc1a6);}(_0x7a54,0x106));var _0x47a5=function(_0x440ddd,_0x22ac49){_0x440ddd=_0x440ddd-0x0;var _0x22a37a=_0x7a54[_0x440ddd];return _0x22a37a;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('CmHopperFinal,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['CreateCmHopperFinal']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')](_0x5247fd[_0x47a5('0x17')],{'raw':_0x5247fd[_0x47a5('0x18')]?_0x5247fd[_0x47a5('0x18')][_0x47a5('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x1570bc){logger[_0x47a5('0xb')]('CreateCmHopperFinal',_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1a'),_0x5247fd,JSON[_0x47a5('0xe')](_0x1570bc));_0xaf70a6(_0x1570bc);})['catch'](function(_0xb8ae6c){logger[_0x47a5('0xf')](_0x47a5('0x1a'),_0xb8ae6c[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81['error'](0x1f4,_0xb8ae6c[_0x47a5('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/index.js b/server/api/cmHopperFinal/index.js index 66cd9d4..e68b692 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 _0x47cb=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./cmHopperFinal.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','post','moveContactsQueueCampaignHopperFinal','moveContactsIvrCampaignHopperFinal','/checkContactHopper','checkContactHopper','put','update','exports'];(function(_0x2c0b01,_0x3aaa36){var _0x1a3668=function(_0x3a64d1){while(--_0x3a64d1){_0x2c0b01['push'](_0x2c0b01['shift']());}};_0x1a3668(++_0x3aaa36);}(_0x47cb,0x74));var _0xb47c=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x47cb[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0xb47c('0x0'));var util=require(_0xb47c('0x1'));var path=require(_0xb47c('0x2'));var timeout=require(_0xb47c('0x3'));var express=require(_0xb47c('0x4'));var router=express[_0xb47c('0x5')]();var fs_extra=require(_0xb47c('0x6'));var auth=require(_0xb47c('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xb47c('0x8'));var controller=require(_0xb47c('0x9'));router[_0xb47c('0xa')]('/',auth[_0xb47c('0xb')](),controller[_0xb47c('0xc')]);router[_0xb47c('0xa')](_0xb47c('0xd'),auth[_0xb47c('0xb')](),controller[_0xb47c('0xe')]);router[_0xb47c('0xa')](_0xb47c('0xf'),auth[_0xb47c('0xb')](),controller[_0xb47c('0x10')]);router[_0xb47c('0xa')](_0xb47c('0x11'),auth['isAuthenticated'](),controller[_0xb47c('0x12')]);router[_0xb47c('0xa')](_0xb47c('0x13'),auth['isAuthenticated'](),controller[_0xb47c('0x14')]);router[_0xb47c('0x15')]('/voice/queue/moveContacts/:id',auth[_0xb47c('0xb')](),controller[_0xb47c('0x16')]);router[_0xb47c('0x15')]('/voice/campaign/moveContacts/:id',auth[_0xb47c('0xb')](),controller[_0xb47c('0x17')]);router[_0xb47c('0x15')](_0xb47c('0x18'),auth[_0xb47c('0xb')](),controller[_0xb47c('0x19')]);router[_0xb47c('0x1a')](_0xb47c('0xf'),auth[_0xb47c('0xb')](),controller[_0xb47c('0x1b')]);module[_0xb47c('0x1c')]=router; \ No newline at end of file +var _0xb271=['/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','checkContactHopper','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./cmHopperFinal.controller','get','isAuthenticated','index','/describe','describe','show','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','post','/voice/queue/moveContacts/:id'];(function(_0x266062,_0x142489){var _0x415647=function(_0xeac22c){while(--_0xeac22c){_0x266062['push'](_0x266062['shift']());}};_0x415647(++_0x142489);}(_0xb271,0xf6));var _0x1b27=function(_0x374fae,_0x3e1595){_0x374fae=_0x374fae-0x0;var _0x55b675=_0xb271[_0x374fae];return _0x55b675;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1b27('0x0'));var timeout=require(_0x1b27('0x1'));var express=require(_0x1b27('0x2'));var router=express[_0x1b27('0x3')]();var fs_extra=require(_0x1b27('0x4'));var auth=require(_0x1b27('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x1b27('0x6'));router[_0x1b27('0x7')]('/',auth[_0x1b27('0x8')](),controller[_0x1b27('0x9')]);router[_0x1b27('0x7')](_0x1b27('0xa'),auth[_0x1b27('0x8')](),controller[_0x1b27('0xb')]);router[_0x1b27('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x1b27('0xc')]);router[_0x1b27('0x7')]('/voice/queue/countAttributes/:id',auth[_0x1b27('0x8')](),controller[_0x1b27('0xd')]);router[_0x1b27('0x7')](_0x1b27('0xe'),auth[_0x1b27('0x8')](),controller[_0x1b27('0xf')]);router[_0x1b27('0x10')](_0x1b27('0x11'),auth[_0x1b27('0x8')](),controller['moveContactsQueueCampaignHopperFinal']);router[_0x1b27('0x10')](_0x1b27('0x12'),auth[_0x1b27('0x8')](),controller[_0x1b27('0x13')]);router[_0x1b27('0x10')]('/checkContactHopper',auth[_0x1b27('0x8')](),controller[_0x1b27('0x14')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);module[_0x1b27('0x15')]=router; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.attributes.js b/server/api/cmHopperHistory/cmHopperHistory.attributes.js index a0907ec..d13a9ff 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 _0xb098=['STRING','BOOLEAN','sequelize','exports','DATE','INTEGER'];(function(_0x3950d9,_0x46980c){var _0x52171b=function(_0x576f38){while(--_0x576f38){_0x3950d9['push'](_0x3950d9['shift']());}};_0x52171b(++_0x46980c);}(_0xb098,0x1c4));var _0x8b09=function(_0x46b64d,_0x2a0223){_0x46b64d=_0x46b64d-0x0;var _0x19222e=_0xb098[_0x46b64d];return _0x19222e;};'use strict';var Sequelize=require(_0x8b09('0x0'));module[_0x8b09('0x1')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0x8b09('0x2')]},'countbusyretry':{'type':Sequelize[_0x8b09('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x8b09('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x8b09('0x3')],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x8b09('0x4')]},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize[_0x8b09('0x4')]},'calleridnum':{'type':Sequelize[_0x8b09('0x4')]},'calleridname':{'type':Sequelize[_0x8b09('0x4')]},'starttime':{'type':Sequelize[_0x8b09('0x2')]},'responsetime':{'type':Sequelize[_0x8b09('0x2')]},'answertime':{'type':Sequelize[_0x8b09('0x2')]},'droptime':{'type':Sequelize[_0x8b09('0x2')]},'endtime':{'type':Sequelize[_0x8b09('0x2')]},'ringtime':{'type':Sequelize[_0x8b09('0x3')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x8b09('0x3')],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x8b09('0x3')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x8b09('0x4')]},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0x8b09('0x4')]},'membername':{'type':Sequelize[_0x8b09('0x4')]},'reason':{'type':Sequelize[_0x8b09('0x4')]},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize[_0x8b09('0x5')],'defaultValue':![]},'callback':{'type':Sequelize[_0x8b09('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize[_0x8b09('0x5')],'defaultValue':![]},'editedat':{'type':Sequelize[_0x8b09('0x2')]},'edited':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0x8b09('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x8b09('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x8b09('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x8b09('0x3')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x8b09('0x4')]}}; \ No newline at end of file +var _0x1c01=['INTEGER','STRING','DATE','BOOLEAN','sequelize','exports'];(function(_0x39d185,_0x170cfc){var _0x19643c=function(_0x5d2197){while(--_0x5d2197){_0x39d185['push'](_0x39d185['shift']());}};_0x19643c(++_0x170cfc);}(_0x1c01,0x190));var _0x11c0=function(_0x2c27b2,_0x4b8209){_0x2c27b2=_0x2c27b2-0x0;var _0xb5306a=_0x1c01[_0x2c27b2];return _0xb5306a;};'use strict';var Sequelize=require(_0x11c0('0x0'));module[_0x11c0('0x1')]={'state':{'type':Sequelize[_0x11c0('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x11c0('0x3')]},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize[_0x11c0('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x11c0('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x11c0('0x3')]},'originatecalleridnum':{'type':Sequelize[_0x11c0('0x3')]},'originatecalleridname':{'type':Sequelize[_0x11c0('0x3')]},'calleridnum':{'type':Sequelize[_0x11c0('0x3')]},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0x11c0('0x4')]},'responsetime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0x11c0('0x4')]},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x11c0('0x4')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x11c0('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x11c0('0x3')]},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0x11c0('0x3')]},'membername':{'type':Sequelize[_0x11c0('0x3')]},'reason':{'type':Sequelize[_0x11c0('0x3')]},'amd':{'type':Sequelize[_0x11c0('0x5')],'defaultValue':![]},'fax':{'type':Sequelize[_0x11c0('0x5')],'defaultValue':![]},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x11c0('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x11c0('0x4')]},'recallme':{'type':Sequelize[_0x11c0('0x5')],'defaultValue':![]},'editedat':{'type':Sequelize[_0x11c0('0x4')]},'edited':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x11c0('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x11c0('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x11c0('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x11c0('0x2')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x11c0('0x3')]}}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.controller.js b/server/api/cmHopperHistory/cmHopperHistory.controller.js index e48f53f..88fa436 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 _0x025d=['nolimit','sort','where','pick','filter','merge','options','includeAll','findAll','catch','show','params','include','find','create','body','describe','uniqueid','eml-format','rimraf','zip-dir','request-promise','bluebird','sox','to-csv','ejs','fs-extra','crypto','desk.js','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','update','then','end','stack','name','CmHopperHistory','rawAttributes','fieldName','type','key','model','map','keys','filters','intersection','query','fields','attributes','length'];(function(_0x345083,_0x3c2710){var _0x9a76ee=function(_0x594a89){while(--_0x594a89){_0x345083['push'](_0x345083['shift']());}};_0x9a76ee(++_0x3c2710);}(_0x025d,0x1c4));var _0xd025=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x025d[_0x2c91e9];return _0x13f0ff;};'use strict';var emlformat=require(_0xd025('0x0'));var rimraf=require(_0xd025('0x1'));var zipdir=require(_0xd025('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd025('0x3'));var moment=require('moment');var BPromise=require(_0xd025('0x4'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xd025('0x5'));var csv=require(_0xd025('0x6'));var ejs=require(_0xd025('0x7'));var fs=require('fs');var fs_extra=require(_0xd025('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xd025('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xd025('0xa'));var toCsv=require(_0xd025('0x6'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xd025('0xb'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xd025('0xc'));var utils=require(_0xd025('0xd'));var config=require(_0xd025('0xe'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4e2b13,_0x5c9e21){_0x5c9e21=_0x5c9e21||0xcc;return function(_0x44b415){if(_0x44b415){return _0x4e2b13[_0xd025('0xf')](_0x5c9e21);}return _0x4e2b13[_0xd025('0x10')](_0x5c9e21)['end']();};}function respondWithResult(_0x5a3502,_0x52d526){_0x52d526=_0x52d526||0xc8;return function(_0x267a26){if(_0x267a26){return _0x5a3502[_0xd025('0x10')](_0x52d526)[_0xd025('0x11')](_0x267a26);}};}function respondWithFilteredResult(_0x39afbd,_0x4beb4d){return function(_0x22b6b7){if(_0x22b6b7){var _0x79d7c4=typeof _0x4beb4d[_0xd025('0x12')]===_0xd025('0x13')&&typeof _0x4beb4d[_0xd025('0x14')]===_0xd025('0x13');var _0x2d9e0d=_0x22b6b7[_0xd025('0x15')];var _0x272268=_0x79d7c4?0x0:_0x4beb4d[_0xd025('0x12')];var _0x261b80=_0x79d7c4?_0x22b6b7[_0xd025('0x15')]:_0x4beb4d[_0xd025('0x12')]+_0x4beb4d['limit'];var _0x2e60b8;if(_0x261b80>=_0x2d9e0d){_0x261b80=_0x2d9e0d;_0x2e60b8=0xc8;}else{_0x2e60b8=0xce;}_0x39afbd[_0xd025('0x10')](_0x2e60b8);return _0x39afbd[_0xd025('0x16')](_0xd025('0x17'),_0x272268+'-'+_0x261b80+'/'+_0x2d9e0d)[_0xd025('0x11')](_0x22b6b7);}return null;};}function patchUpdates(_0x472577){return function(_0x3b8291){try{jsonpatch[_0xd025('0x18')](_0x3b8291,_0x472577,!![]);}catch(_0x347f19){return BPromise['reject'](_0x347f19);}return _0x3b8291['save']();};}function saveUpdates(_0x22c23a,_0x105893){return function(_0x30beb7){if(_0x30beb7){return _0x30beb7[_0xd025('0x19')](_0x22c23a)[_0xd025('0x1a')](function(_0x292448){return _0x292448;});}return null;};}function removeEntity(_0x1adcac,_0x59c360){return function(_0x366aed){if(_0x366aed){return _0x366aed['destroy']()[_0xd025('0x1a')](function(){_0x1adcac[_0xd025('0x10')](0xcc)[_0xd025('0x1b')]();});}};}function handleEntityNotFound(_0x4c5fad,_0x3b351a){return function(_0x1afcb1){if(!_0x1afcb1){_0x4c5fad[_0xd025('0xf')](0x194);}return _0x1afcb1;};}function handleError(_0x141d5b,_0x941bb0){_0x941bb0=_0x941bb0||0x1f4;return function(_0x178c21){logger['error'](_0x178c21[_0xd025('0x1c')]);if(_0x178c21[_0xd025('0x1d')]){delete _0x178c21[_0xd025('0x1d')];}_0x141d5b[_0xd025('0x10')](_0x941bb0)['send'](_0x178c21);};}exports['index']=function(_0x63ff42,_0x440f38){var _0x5f0d6f={},_0x2ee356={},_0x3a4d6c={'count':0x0,'rows':[]};var _0x57780b=_['map'](db[_0xd025('0x1e')][_0xd025('0x1f')],function(_0xb84483){return{'name':_0xb84483[_0xd025('0x20')],'type':_0xb84483[_0xd025('0x21')][_0xd025('0x22')]};});_0x2ee356[_0xd025('0x23')]=_[_0xd025('0x24')](_0x57780b,_0xd025('0x1d'));_0x2ee356['query']=_[_0xd025('0x25')](_0x63ff42['query']);_0x2ee356[_0xd025('0x26')]=_[_0xd025('0x27')](_0x2ee356[_0xd025('0x23')],_0x2ee356[_0xd025('0x28')]);_0x5f0d6f['attributes']=_['intersection'](_0x2ee356[_0xd025('0x23')],qs[_0xd025('0x29')](_0x63ff42[_0xd025('0x28')][_0xd025('0x29')]));_0x5f0d6f[_0xd025('0x2a')]=_0x5f0d6f[_0xd025('0x2a')][_0xd025('0x2b')]?_0x5f0d6f[_0xd025('0x2a')]:_0x2ee356[_0xd025('0x23')];if(!_0x63ff42[_0xd025('0x28')]['hasOwnProperty'](_0xd025('0x2c'))){_0x5f0d6f['limit']=qs['limit'](_0x63ff42[_0xd025('0x28')][_0xd025('0x14')]);_0x5f0d6f[_0xd025('0x12')]=qs['offset'](_0x63ff42[_0xd025('0x28')][_0xd025('0x12')]);}_0x5f0d6f['order']=qs[_0xd025('0x2d')](_0x63ff42[_0xd025('0x28')][_0xd025('0x2d')]);_0x5f0d6f[_0xd025('0x2e')]=qs[_0xd025('0x26')](_[_0xd025('0x2f')](_0x63ff42[_0xd025('0x28')],_0x2ee356[_0xd025('0x26')]),_0x57780b);if(_0x63ff42['query'][_0xd025('0x30')]){_0x5f0d6f[_0xd025('0x2e')]=_[_0xd025('0x31')](_0x5f0d6f[_0xd025('0x2e')],{'$or':_[_0xd025('0x24')](_0x57780b,function(_0x12e28a){if(_0x12e28a[_0xd025('0x21')]!=='VIRTUAL'){var _0x37b77b={};_0x37b77b[_0x12e28a[_0xd025('0x1d')]]={'$like':'%'+_0x63ff42[_0xd025('0x28')]['filter']+'%'};return _0x37b77b;}})});}_0x5f0d6f=_['merge']({},_0x5f0d6f,_0x63ff42[_0xd025('0x32')]);var _0x57caad={'where':_0x5f0d6f['where']};return db['CmHopperHistory']['count'](_0x57caad)[_0xd025('0x1a')](function(_0x5ad5b0){_0x3a4d6c[_0xd025('0x15')]=_0x5ad5b0;if(_0x63ff42[_0xd025('0x28')][_0xd025('0x33')]){_0x5f0d6f['include']=[{'all':!![]}];}return db[_0xd025('0x1e')][_0xd025('0x34')](_0x5f0d6f);})['then'](function(_0x51d2ca){_0x3a4d6c['rows']=_0x51d2ca;return _0x3a4d6c;})['then'](respondWithFilteredResult(_0x440f38,_0x5f0d6f))[_0xd025('0x35')](handleError(_0x440f38,null));};exports[_0xd025('0x36')]=function(_0x1457a8,_0x3f761b){var _0x5b8457={'raw':!![],'where':{'id':_0x1457a8[_0xd025('0x37')]['id']}},_0x30259f={};_0x30259f[_0xd025('0x23')]=_[_0xd025('0x25')](db[_0xd025('0x1e')][_0xd025('0x1f')]);_0x30259f['query']=_[_0xd025('0x25')](_0x1457a8[_0xd025('0x28')]);_0x30259f[_0xd025('0x26')]=_['intersection'](_0x30259f[_0xd025('0x23')],_0x30259f[_0xd025('0x28')]);_0x5b8457[_0xd025('0x2a')]=_[_0xd025('0x27')](_0x30259f[_0xd025('0x23')],qs['fields'](_0x1457a8[_0xd025('0x28')][_0xd025('0x29')]));_0x5b8457[_0xd025('0x2a')]=_0x5b8457[_0xd025('0x2a')][_0xd025('0x2b')]?_0x5b8457[_0xd025('0x2a')]:_0x30259f[_0xd025('0x23')];if(_0x1457a8[_0xd025('0x28')][_0xd025('0x33')]){_0x5b8457[_0xd025('0x38')]=[{'all':!![]}];}_0x5b8457=_[_0xd025('0x31')]({},_0x5b8457,_0x1457a8[_0xd025('0x32')]);return db['CmHopperHistory'][_0xd025('0x39')](_0x5b8457)['then'](handleEntityNotFound(_0x3f761b,null))[_0xd025('0x1a')](respondWithResult(_0x3f761b,null))[_0xd025('0x35')](handleError(_0x3f761b,null));};exports[_0xd025('0x3a')]=function(_0x3094e7,_0x507ce6){return db[_0xd025('0x1e')][_0xd025('0x3a')](_0x3094e7[_0xd025('0x3b')],{})[_0xd025('0x1a')](respondWithResult(_0x507ce6,0xc9))['catch'](handleError(_0x507ce6,null));};exports[_0xd025('0x3c')]=function(_0x3ca9bc,_0x3e9648){return db['CmHopperHistory']['describe']()[_0xd025('0x1a')](respondWithResult(_0x3e9648,null))[_0xd025('0x35')](handleError(_0x3e9648,null));};exports[_0xd025('0x19')]=function(_0x484715,_0x24f0cd){if(_0x484715[_0xd025('0x3b')][_0xd025('0x3d')]){delete _0x484715[_0xd025('0x3b')][_0xd025('0x3d')];}return db[_0xd025('0x1e')]['find']({'where':{'uniqueid':_0x484715['params']['id']}})['then'](handleEntityNotFound(_0x24f0cd,null))[_0xd025('0x1a')](saveUpdates(_0x484715[_0xd025('0x3b')],null))['then'](respondWithResult(_0x24f0cd,null))['catch'](handleError(_0x24f0cd,null));}; \ No newline at end of file +var _0x78eb=['params','find','catch','create','describe','update','body','uniqueid','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','save','then','destroy','error','name','send','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','options','CmHopperHistory','includeAll','include','findAll','rows'];(function(_0x513300,_0x73c54b){var _0x142826=function(_0x2e1ad6){while(--_0x2e1ad6){_0x513300['push'](_0x513300['shift']());}};_0x142826(++_0x73c54b);}(_0x78eb,0xa4));var _0xb78e=function(_0x85100d,_0x26d703){_0x85100d=_0x85100d-0x0;var _0x5886b2=_0x78eb[_0x85100d];return _0x5886b2;};'use strict';var emlformat=require(_0xb78e('0x0'));var rimraf=require(_0xb78e('0x1'));var zipdir=require(_0xb78e('0x2'));var jsonpatch=require(_0xb78e('0x3'));var rp=require(_0xb78e('0x4'));var moment=require(_0xb78e('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xb78e('0x6'));var util=require(_0xb78e('0x7'));var path=require(_0xb78e('0x8'));var sox=require(_0xb78e('0x9'));var csv=require(_0xb78e('0xa'));var ejs=require(_0xb78e('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb78e('0xc'));var squel=require(_0xb78e('0xd'));var crypto=require(_0xb78e('0xe'));var jsforce=require(_0xb78e('0xf'));var deskjs=require(_0xb78e('0x10'));var toCsv=require('to-csv');var querystring=require(_0xb78e('0x11'));var Papa=require(_0xb78e('0x12'));var Redis=require(_0xb78e('0x13'));var authService=require(_0xb78e('0x14'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xb78e('0x15'))(_0xb78e('0x16'));var utils=require(_0xb78e('0x17'));var config=require(_0xb78e('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xb78e('0x19'))['db'];function respondWithStatusCode(_0x3182ed,_0x12fe25){_0x12fe25=_0x12fe25||0xcc;return function(_0x13ee3){if(_0x13ee3){return _0x3182ed[_0xb78e('0x1a')](_0x12fe25);}return _0x3182ed[_0xb78e('0x1b')](_0x12fe25)[_0xb78e('0x1c')]();};}function respondWithResult(_0x229410,_0x2c48be){_0x2c48be=_0x2c48be||0xc8;return function(_0x394709){if(_0x394709){return _0x229410['status'](_0x2c48be)[_0xb78e('0x1d')](_0x394709);}};}function respondWithFilteredResult(_0xf944dd,_0x109862){return function(_0x2ab32a){if(_0x2ab32a){var _0x4f7248=typeof _0x109862['offset']===_0xb78e('0x1e')&&typeof _0x109862[_0xb78e('0x1f')]===_0xb78e('0x1e');var _0x323ee9=_0x2ab32a[_0xb78e('0x20')];var _0x3a14e0=_0x4f7248?0x0:_0x109862[_0xb78e('0x21')];var _0x2bd401=_0x4f7248?_0x2ab32a[_0xb78e('0x20')]:_0x109862[_0xb78e('0x21')]+_0x109862[_0xb78e('0x1f')];var _0x259a8b;if(_0x2bd401>=_0x323ee9){_0x2bd401=_0x323ee9;_0x259a8b=0xc8;}else{_0x259a8b=0xce;}_0xf944dd[_0xb78e('0x1b')](_0x259a8b);return _0xf944dd[_0xb78e('0x22')](_0xb78e('0x23'),_0x3a14e0+'-'+_0x2bd401+'/'+_0x323ee9)[_0xb78e('0x1d')](_0x2ab32a);}return null;};}function patchUpdates(_0x2fd4ab){return function(_0x532338){try{jsonpatch[_0xb78e('0x24')](_0x532338,_0x2fd4ab,!![]);}catch(_0x310435){return BPromise['reject'](_0x310435);}return _0x532338[_0xb78e('0x25')]();};}function saveUpdates(_0x4608a7,_0x4e755a){return function(_0x57cde3){if(_0x57cde3){return _0x57cde3['update'](_0x4608a7)[_0xb78e('0x26')](function(_0x362439){return _0x362439;});}return null;};}function removeEntity(_0x52a6b3,_0x4943c0){return function(_0x231f5f){if(_0x231f5f){return _0x231f5f[_0xb78e('0x27')]()['then'](function(){_0x52a6b3[_0xb78e('0x1b')](0xcc)[_0xb78e('0x1c')]();});}};}function handleEntityNotFound(_0xc12fc4,_0x5d5340){return function(_0x45ee1e){if(!_0x45ee1e){_0xc12fc4[_0xb78e('0x1a')](0x194);}return _0x45ee1e;};}function handleError(_0x520f85,_0x24863a){_0x24863a=_0x24863a||0x1f4;return function(_0x26cdcb){logger[_0xb78e('0x28')](_0x26cdcb['stack']);if(_0x26cdcb[_0xb78e('0x29')]){delete _0x26cdcb[_0xb78e('0x29')];}_0x520f85['status'](_0x24863a)[_0xb78e('0x2a')](_0x26cdcb);};}exports['index']=function(_0x59c03f,_0x37200b){var _0x49f918={},_0x9db0c1={},_0x3d051e={'count':0x0,'rows':[]};var _0x2f0303=_['map'](db['CmHopperHistory'][_0xb78e('0x2b')],function(_0x4bbccd){return{'name':_0x4bbccd[_0xb78e('0x2c')],'type':_0x4bbccd[_0xb78e('0x2d')][_0xb78e('0x2e')]};});_0x9db0c1[_0xb78e('0x2f')]=_[_0xb78e('0x30')](_0x2f0303,'name');_0x9db0c1[_0xb78e('0x31')]=_[_0xb78e('0x32')](_0x59c03f[_0xb78e('0x31')]);_0x9db0c1[_0xb78e('0x33')]=_[_0xb78e('0x34')](_0x9db0c1[_0xb78e('0x2f')],_0x9db0c1[_0xb78e('0x31')]);_0x49f918[_0xb78e('0x35')]=_['intersection'](_0x9db0c1[_0xb78e('0x2f')],qs[_0xb78e('0x36')](_0x59c03f[_0xb78e('0x31')][_0xb78e('0x36')]));_0x49f918[_0xb78e('0x35')]=_0x49f918['attributes'][_0xb78e('0x37')]?_0x49f918[_0xb78e('0x35')]:_0x9db0c1[_0xb78e('0x2f')];if(!_0x59c03f['query'][_0xb78e('0x38')](_0xb78e('0x39'))){_0x49f918[_0xb78e('0x1f')]=qs[_0xb78e('0x1f')](_0x59c03f[_0xb78e('0x31')][_0xb78e('0x1f')]);_0x49f918[_0xb78e('0x21')]=qs[_0xb78e('0x21')](_0x59c03f[_0xb78e('0x31')][_0xb78e('0x21')]);}_0x49f918[_0xb78e('0x3a')]=qs[_0xb78e('0x3b')](_0x59c03f['query'][_0xb78e('0x3b')]);_0x49f918[_0xb78e('0x3c')]=qs[_0xb78e('0x33')](_[_0xb78e('0x3d')](_0x59c03f[_0xb78e('0x31')],_0x9db0c1[_0xb78e('0x33')]),_0x2f0303);if(_0x59c03f[_0xb78e('0x31')]['filter']){_0x49f918[_0xb78e('0x3c')]=_[_0xb78e('0x3e')](_0x49f918[_0xb78e('0x3c')],{'$or':_['map'](_0x2f0303,function(_0x193dcf){if(_0x193dcf[_0xb78e('0x2d')]!=='VIRTUAL'){var _0x3fdaad={};_0x3fdaad[_0x193dcf['name']]={'$like':'%'+_0x59c03f['query'][_0xb78e('0x3f')]+'%'};return _0x3fdaad;}})});}_0x49f918=_[_0xb78e('0x3e')]({},_0x49f918,_0x59c03f[_0xb78e('0x40')]);var _0x52fbab={'where':_0x49f918['where']};return db[_0xb78e('0x41')]['count'](_0x52fbab)['then'](function(_0x57162b){_0x3d051e[_0xb78e('0x20')]=_0x57162b;if(_0x59c03f[_0xb78e('0x31')][_0xb78e('0x42')]){_0x49f918[_0xb78e('0x43')]=[{'all':!![]}];}return db[_0xb78e('0x41')][_0xb78e('0x44')](_0x49f918);})[_0xb78e('0x26')](function(_0x4606d5){_0x3d051e[_0xb78e('0x45')]=_0x4606d5;return _0x3d051e;})['then'](respondWithFilteredResult(_0x37200b,_0x49f918))['catch'](handleError(_0x37200b,null));};exports['show']=function(_0xcecf59,_0x43a0e6){var _0x223cef={'raw':!![],'where':{'id':_0xcecf59[_0xb78e('0x46')]['id']}},_0x2ed18b={};_0x2ed18b[_0xb78e('0x2f')]=_[_0xb78e('0x32')](db[_0xb78e('0x41')][_0xb78e('0x2b')]);_0x2ed18b[_0xb78e('0x31')]=_[_0xb78e('0x32')](_0xcecf59[_0xb78e('0x31')]);_0x2ed18b[_0xb78e('0x33')]=_[_0xb78e('0x34')](_0x2ed18b[_0xb78e('0x2f')],_0x2ed18b[_0xb78e('0x31')]);_0x223cef['attributes']=_['intersection'](_0x2ed18b[_0xb78e('0x2f')],qs[_0xb78e('0x36')](_0xcecf59['query']['fields']));_0x223cef[_0xb78e('0x35')]=_0x223cef[_0xb78e('0x35')][_0xb78e('0x37')]?_0x223cef['attributes']:_0x2ed18b[_0xb78e('0x2f')];if(_0xcecf59['query']['includeAll']){_0x223cef['include']=[{'all':!![]}];}_0x223cef=_[_0xb78e('0x3e')]({},_0x223cef,_0xcecf59['options']);return db[_0xb78e('0x41')][_0xb78e('0x47')](_0x223cef)[_0xb78e('0x26')](handleEntityNotFound(_0x43a0e6,null))[_0xb78e('0x26')](respondWithResult(_0x43a0e6,null))[_0xb78e('0x48')](handleError(_0x43a0e6,null));};exports['create']=function(_0x500805,_0x18395a){return db[_0xb78e('0x41')][_0xb78e('0x49')](_0x500805['body'],{})[_0xb78e('0x26')](respondWithResult(_0x18395a,0xc9))[_0xb78e('0x48')](handleError(_0x18395a,null));};exports[_0xb78e('0x4a')]=function(_0x277c36,_0x417bb1){return db[_0xb78e('0x41')][_0xb78e('0x4a')]()['then'](respondWithResult(_0x417bb1,null))[_0xb78e('0x48')](handleError(_0x417bb1,null));};exports[_0xb78e('0x4b')]=function(_0x22b47c,_0x4502d0){if(_0x22b47c[_0xb78e('0x4c')][_0xb78e('0x4d')]){delete _0x22b47c[_0xb78e('0x4c')][_0xb78e('0x4d')];}return db['CmHopperHistory']['find']({'where':{'uniqueid':_0x22b47c[_0xb78e('0x46')]['id']}})['then'](handleEntityNotFound(_0x4502d0,null))[_0xb78e('0x26')](saveUpdates(_0x22b47c['body'],null))[_0xb78e('0x26')](respondWithResult(_0x4502d0,null))[_0xb78e('0x48')](handleError(_0x4502d0,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index beefa95..60e19e1 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 _0x8561=['define','endtime','util','../../config/logger','moment','request-promise','rimraf','./cmHopperHistory.attributes','exports'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0x8561,0x1b2));var _0x1856=function(_0x3d247a,_0x25d35e){_0x3d247a=_0x3d247a-0x0;var _0x40d987=_0x8561[_0x3d247a];return _0x40d987;};'use strict';var _=require('lodash');var util=require(_0x1856('0x0'));var logger=require(_0x1856('0x1'))('api');var moment=require(_0x1856('0x2'));var BPromise=require('bluebird');var rp=require(_0x1856('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1856('0x4'));var config=require('../../config/environment');var attributes=require(_0x1856('0x5'));module[_0x1856('0x6')]=function(_0x4cb57e,_0x5c39bd){return _0x4cb57e[_0x1856('0x7')]('CmHopperHistory',attributes,{'tableName':'cm_hopper_history','paranoid':![],'indexes':[{'name':_0x1856('0x8'),'fields':['endtime']},{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xe558=['rimraf','./cmHopperHistory.attributes','exports','define','CmHopperHistory','endtime','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x5bdf88,_0xe67737){var _0x261864=function(_0x3b36b2){while(--_0x3b36b2){_0x5bdf88['push'](_0x5bdf88['shift']());}};_0x261864(++_0xe67737);}(_0xe558,0x70));var _0x8e55=function(_0x60831,_0x1df549){_0x60831=_0x60831-0x0;var _0x81e704=_0xe558[_0x60831];return _0x81e704;};'use strict';var _=require(_0x8e55('0x0'));var util=require(_0x8e55('0x1'));var logger=require(_0x8e55('0x2'))(_0x8e55('0x3'));var moment=require(_0x8e55('0x4'));var BPromise=require(_0x8e55('0x5'));var rp=require(_0x8e55('0x6'));var fs=require('fs');var path=require(_0x8e55('0x7'));var rimraf=require(_0x8e55('0x8'));var config=require('../../config/environment');var attributes=require(_0x8e55('0x9'));module[_0x8e55('0xa')]=function(_0x34d4ec,_0x3dff04){return _0x34d4ec[_0x8e55('0xb')](_0x8e55('0xc'),attributes,{'tableName':'cm_hopper_history','paranoid':![],'indexes':[{'name':_0x8e55('0xd'),'fields':[_0x8e55('0xd')]},{'name':'uniqueid','fields':[_0x8e55('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.rpc.js b/server/api/cmHopperHistory/cmHopperHistory.rpc.js index 4b326a7..da5e99c 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 _0xe7c2=['http','then','info','CmHopperHistory,\x20%s,\x20%s','request\x20sent','CmHopperHistory,\x20%s,\x20%s,\x20%s','error','message','result','catch','CmHopperHistory','create','options','raw','CreateCmHopperHistory','AvgHandleTime','findAll','where','sequelize','COUNT','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','literal','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','stringify','GetVoiceQueueHopperHistory','name','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','GetCampaignHopperHistory','campaign','col','ivrTotalCallsDays','`state`\x20=\x204,\x201,\x20null','ivrAnswerCallsDay','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise'];(function(_0x5129e5,_0x104363){var _0x1731d5=function(_0x23759e){while(--_0x23759e){_0x5129e5['push'](_0x5129e5['shift']());}};_0x1731d5(++_0x104363);}(_0xe7c2,0xc8));var _0x2e7c=function(_0x29af46,_0x29d1d7){_0x29af46=_0x29af46-0x0;var _0xd5d03a=_0xe7c2[_0x29af46];return _0xd5d03a;};'use strict';var _=require(_0x2e7c('0x0'));var util=require(_0x2e7c('0x1'));var moment=require(_0x2e7c('0x2'));var BPromise=require(_0x2e7c('0x3'));var rs=require(_0x2e7c('0x4'));var fs=require('fs');var Redis=require(_0x2e7c('0x5'));var db=require(_0x2e7c('0x6'))['db'];var utils=require(_0x2e7c('0x7'));var logger=require(_0x2e7c('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0x2e7c('0x9'));var client=jayson['client'][_0x2e7c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x375302,_0x3b45e1,_0x5bbaaa){return new BPromise(function(_0x2bbbbc,_0x205aec){return client['request'](_0x375302,_0x5bbaaa)[_0x2e7c('0xb')](function(_0x4a96cb){logger[_0x2e7c('0xc')](_0x2e7c('0xd'),_0x3b45e1,_0x2e7c('0xe'));logger['debug'](_0x2e7c('0xf'),_0x3b45e1,_0x2e7c('0xe'),JSON['stringify'](_0x4a96cb));if(_0x4a96cb[_0x2e7c('0x10')]){if(_0x4a96cb[_0x2e7c('0x10')]['code']===0x1f4){logger[_0x2e7c('0x10')](_0x2e7c('0xd'),_0x3b45e1,_0x4a96cb[_0x2e7c('0x10')][_0x2e7c('0x11')]);return _0x205aec(_0x4a96cb[_0x2e7c('0x10')][_0x2e7c('0x11')]);}logger[_0x2e7c('0x10')](_0x2e7c('0xd'),_0x3b45e1,_0x4a96cb[_0x2e7c('0x10')][_0x2e7c('0x11')]);return _0x2bbbbc(_0x4a96cb['error'][_0x2e7c('0x11')]);}else{logger[_0x2e7c('0xc')]('CmHopperHistory,\x20%s,\x20%s',_0x3b45e1,_0x2e7c('0xe'));_0x2bbbbc(_0x4a96cb[_0x2e7c('0x12')][_0x2e7c('0x11')]);}})[_0x2e7c('0x13')](function(_0x3c31ed){logger[_0x2e7c('0x10')]('CmHopperHistory,\x20%s,\x20%s',_0x3b45e1,_0x3c31ed);_0x205aec(_0x3c31ed);});});}exports['CreateCmHopperHistory']=function(_0x2d56a2){var _0x336ffc=this;return new Promise(function(_0x22cac0,_0x23dfa4){return db[_0x2e7c('0x14')][_0x2e7c('0x15')](_0x2d56a2['body'],{'raw':_0x2d56a2[_0x2e7c('0x16')]?_0x2d56a2[_0x2e7c('0x16')][_0x2e7c('0x17')]===undefined?!![]:![]:!![]})[_0x2e7c('0xb')](function(_0xfc24de){logger[_0x2e7c('0xc')](_0x2e7c('0x18'),_0x2d56a2);logger['debug'](_0x2e7c('0x18'),_0x2d56a2,JSON['stringify'](_0xfc24de));_0x22cac0(_0xfc24de);})['catch'](function(_0xaf7af2){logger[_0x2e7c('0x10')]('CreateCmHopperHistory',_0xaf7af2['message'],_0x2d56a2);_0x23dfa4(_0x336ffc['error'](0x1f4,_0xaf7af2[_0x2e7c('0x11')]));});});};exports[_0x2e7c('0x19')]=function(_0x28950c){var _0x2fd23d=this;return new Promise(function(_0x3169b7,_0x113ae6){return db['CmHopperHistory'][_0x2e7c('0x1a')]({'raw':_0x28950c[_0x2e7c('0x16')]?_0x28950c[_0x2e7c('0x16')][_0x2e7c('0x17')]===undefined?!![]:![]:!![],'where':_0x28950c[_0x2e7c('0x16')]?_0x28950c[_0x2e7c('0x16')][_0x2e7c('0x1b')]||null:null,'attributes':[[db[_0x2e7c('0x1c')]['fn'](_0x2e7c('0x1d'),db[_0x2e7c('0x1c')]['col']('id')),_0x2e7c('0x1e')],[db['sequelize']['fn'](_0x2e7c('0x1d'),db[_0x2e7c('0x1c')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x204,\x201,\x20null'))),_0x2e7c('0x1f')],[db[_0x2e7c('0x1c')]['fn']('COUNT',db[_0x2e7c('0x1c')]['fn']('IF',db[_0x2e7c('0x1c')][_0x2e7c('0x20')](_0x2e7c('0x21')))),_0x2e7c('0x22')],[db[_0x2e7c('0x1c')]['fn']('COUNT',db[_0x2e7c('0x1c')]['fn']('IF',db['sequelize'][_0x2e7c('0x20')](_0x2e7c('0x23')))),_0x2e7c('0x24')],[db['sequelize']['fn'](_0x2e7c('0x25'),db[_0x2e7c('0x1c')]['fn']('IF',db[_0x2e7c('0x1c')][_0x2e7c('0x20')](_0x2e7c('0x26')))),'predictiveIntervalAvgHoldtime'],[db[_0x2e7c('0x1c')]['fn']('AVG',db['sequelize']['fn']('IF',db[_0x2e7c('0x1c')]['literal'](_0x2e7c('0x27')))),_0x2e7c('0x28')]]})[_0x2e7c('0xb')](function(_0x1092e4){logger[_0x2e7c('0xc')](_0x2e7c('0x19'),_0x28950c);logger['debug'](_0x2e7c('0x19'),_0x28950c,JSON[_0x2e7c('0x29')](_0x1092e4));_0x3169b7(_0x1092e4);})[_0x2e7c('0x13')](function(_0x3a2e68){logger['error'](_0x2e7c('0x19'),_0x3a2e68[_0x2e7c('0x11')],_0x28950c);_0x113ae6(_0x2fd23d['error'](0x1f4,_0x3a2e68[_0x2e7c('0x11')]));});});};exports[_0x2e7c('0x2a')]=function(_0x1a0313){var _0x292eeb=this;return new Promise(function(_0xfa3194,_0x172be2){return db[_0x2e7c('0x14')][_0x2e7c('0x1a')]({'raw':_0x1a0313[_0x2e7c('0x16')]?_0x1a0313[_0x2e7c('0x16')][_0x2e7c('0x17')]===undefined?!![]:![]:!![],'where':_0x1a0313[_0x2e7c('0x16')]?_0x1a0313[_0x2e7c('0x16')][_0x2e7c('0x1b')]||null:null,'attributes':[['campaign',_0x2e7c('0x2b')],[db['sequelize']['fn'](_0x2e7c('0x1d'),db[_0x2e7c('0x1c')]['fn']('IF',db[_0x2e7c('0x1c')][_0x2e7c('0x20')](_0x2e7c('0x2c')))),_0x2e7c('0x2d')],[db[_0x2e7c('0x1c')]['fn'](_0x2e7c('0x1d'),db[_0x2e7c('0x1c')]['fn']('IF',db[_0x2e7c('0x1c')][_0x2e7c('0x20')](_0x2e7c('0x2e')))),_0x2e7c('0x2f')],[db[_0x2e7c('0x1c')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x2e7c('0x1c')][_0x2e7c('0x20')]('`state`\x20=\x204,\x201,\x20null'))),_0x2e7c('0x30')],[db[_0x2e7c('0x1c')]['fn'](_0x2e7c('0x1d'),db[_0x2e7c('0x1c')]['fn']('IF',db[_0x2e7c('0x1c')][_0x2e7c('0x20')](_0x2e7c('0x31')))),_0x2e7c('0x32')],[db[_0x2e7c('0x1c')]['fn']('COUNT',db[_0x2e7c('0x1c')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x208,\x201,\x20null'))),'outboundCongestionCallsDay'],[db[_0x2e7c('0x1c')]['fn'](_0x2e7c('0x1d'),db[_0x2e7c('0x1c')]['fn']('IF',db[_0x2e7c('0x1c')][_0x2e7c('0x20')](_0x2e7c('0x33')))),_0x2e7c('0x34')],[db[_0x2e7c('0x1c')]['fn'](_0x2e7c('0x1d'),db[_0x2e7c('0x1c')]['fn']('IF',db[_0x2e7c('0x1c')]['literal'](_0x2e7c('0x35')))),'outboundDropCallsDayCallersExit'],[db[_0x2e7c('0x1c')]['fn'](_0x2e7c('0x1d'),db['sequelize']['fn']('IF',db['sequelize']['literal'](_0x2e7c('0x36')))),_0x2e7c('0x37')],[db['sequelize']['fn'](_0x2e7c('0x1d'),db[_0x2e7c('0x1c')]['fn']('IF',db[_0x2e7c('0x1c')][_0x2e7c('0x20')]('`state`\x20=\x2013,\x201,\x20null'))),_0x2e7c('0x38')],[db[_0x2e7c('0x1c')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x2e7c('0x1c')][_0x2e7c('0x20')]('`state`\x20=\x2014,\x201,\x20null'))),_0x2e7c('0x39')],[db[_0x2e7c('0x1c')]['fn'](_0x2e7c('0x1d'),db[_0x2e7c('0x1c')]['fn']('IF',db[_0x2e7c('0x1c')][_0x2e7c('0x20')](_0x2e7c('0x3a')))),_0x2e7c('0x3b')],[db[_0x2e7c('0x1c')]['fn'](_0x2e7c('0x1d'),db[_0x2e7c('0x1c')]['fn']('IF',db['sequelize'][_0x2e7c('0x20')](_0x2e7c('0x3c')))),_0x2e7c('0x3d')],[db[_0x2e7c('0x1c')]['fn'](_0x2e7c('0x1d'),db[_0x2e7c('0x1c')]['fn']('IF',db[_0x2e7c('0x1c')][_0x2e7c('0x20')](_0x2e7c('0x3e')))),'outboundRejectCallsDay'],[db[_0x2e7c('0x1c')]['fn'](_0x2e7c('0x1d'),db[_0x2e7c('0x1c')]['fn']('IF',db[_0x2e7c('0x1c')][_0x2e7c('0x20')]('`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null'))),'outboundReCallsDay']],'group':['campaign']})['then'](function(_0x4eefa5){logger[_0x2e7c('0xc')]('GetVoiceQueueHopperHistory',_0x1a0313);logger['debug'](_0x2e7c('0x2a'),_0x1a0313,JSON[_0x2e7c('0x29')](_0x4eefa5));_0xfa3194(_0x4eefa5);})['catch'](function(_0x3cbf29){logger[_0x2e7c('0x10')](_0x2e7c('0x2a'),_0x3cbf29[_0x2e7c('0x11')],_0x1a0313);_0x172be2(_0x292eeb[_0x2e7c('0x10')](0x1f4,_0x3cbf29[_0x2e7c('0x11')]));});});};exports[_0x2e7c('0x3f')]=function(_0x4b3435){var _0x23546d=this;return new Promise(function(_0x51187d,_0x256098){return db[_0x2e7c('0x14')][_0x2e7c('0x1a')]({'raw':_0x4b3435[_0x2e7c('0x16')]?_0x4b3435['options'][_0x2e7c('0x17')]===undefined?!![]:![]:!![],'where':_0x4b3435[_0x2e7c('0x16')]?_0x4b3435[_0x2e7c('0x16')][_0x2e7c('0x1b')]||null:null,'attributes':[[_0x2e7c('0x40'),_0x2e7c('0x2b')],[db[_0x2e7c('0x1c')]['fn'](_0x2e7c('0x1d'),db[_0x2e7c('0x1c')][_0x2e7c('0x41')]('id')),_0x2e7c('0x42')],[db[_0x2e7c('0x1c')]['fn'](_0x2e7c('0x1d'),db['sequelize']['fn']('IF',db[_0x2e7c('0x1c')][_0x2e7c('0x20')](_0x2e7c('0x43')))),_0x2e7c('0x44')]],'group':[_0x2e7c('0x40')]})[_0x2e7c('0xb')](function(_0x131be0){logger['info'](_0x2e7c('0x3f'),_0x4b3435);logger[_0x2e7c('0x45')](_0x2e7c('0x3f'),_0x4b3435,JSON['stringify'](_0x131be0));_0x51187d(_0x131be0);})[_0x2e7c('0x13')](function(_0xe30315){logger[_0x2e7c('0x10')](_0x2e7c('0x3f'),_0xe30315[_0x2e7c('0x11')],_0x4b3435);_0x256098(_0x23546d[_0x2e7c('0x10')](0x1f4,_0xe30315['message']));});});}; \ No newline at end of file +var _0xd9dc=['options','raw','stringify','catch','AvgHandleTime','findAll','where','sequelize','COUNT','predictiveIntervalTotalCalls','literal','predictiveIntervalAnsweredCalls','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','GetVoiceQueueHopperHistory','campaign','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','`state`\x20=\x204,\x201,\x20null','outboundAnswerCallsDay','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','`state`\x20=\x2011\x20,\x201,\x20null','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','outboundReCallsDay','GetCampaignHopperHistory','name','ivrTotalCallsDays','ivrAnswerCallsDay','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','CmHopperHistory,\x20%s,\x20%s','request\x20sent','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','error','code','message','CreateCmHopperHistory','CmHopperHistory','create','body'];(function(_0x5b0aec,_0x5f0fd0){var _0x59c564=function(_0x4adbf2){while(--_0x4adbf2){_0x5b0aec['push'](_0x5b0aec['shift']());}};_0x59c564(++_0x5f0fd0);}(_0xd9dc,0x1be));var _0xcd9d=function(_0x4d6338,_0x2b44bb){_0x4d6338=_0x4d6338-0x0;var _0xbb9b7c=_0xd9dc[_0x4d6338];return _0xbb9b7c;};'use strict';var _=require('lodash');var util=require(_0xcd9d('0x0'));var moment=require(_0xcd9d('0x1'));var BPromise=require('bluebird');var rs=require(_0xcd9d('0x2'));var fs=require('fs');var Redis=require(_0xcd9d('0x3'));var db=require(_0xcd9d('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xcd9d('0x5'))(_0xcd9d('0x6'));var config=require(_0xcd9d('0x7'));var jayson=require(_0xcd9d('0x8'));var client=jayson[_0xcd9d('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x288482,_0x425858,_0x1d8770){return new BPromise(function(_0x285e75,_0x45130c){return client['request'](_0x288482,_0x1d8770)[_0xcd9d('0xa')](function(_0x114a7c){logger[_0xcd9d('0xb')](_0xcd9d('0xc'),_0x425858,_0xcd9d('0xd'));logger[_0xcd9d('0xe')](_0xcd9d('0xf'),_0x425858,_0xcd9d('0xd'),JSON['stringify'](_0x114a7c));if(_0x114a7c[_0xcd9d('0x10')]){if(_0x114a7c['error'][_0xcd9d('0x11')]===0x1f4){logger['error'](_0xcd9d('0xc'),_0x425858,_0x114a7c[_0xcd9d('0x10')][_0xcd9d('0x12')]);return _0x45130c(_0x114a7c['error'][_0xcd9d('0x12')]);}logger['error'](_0xcd9d('0xc'),_0x425858,_0x114a7c[_0xcd9d('0x10')][_0xcd9d('0x12')]);return _0x285e75(_0x114a7c['error'][_0xcd9d('0x12')]);}else{logger[_0xcd9d('0xb')]('CmHopperHistory,\x20%s,\x20%s',_0x425858,_0xcd9d('0xd'));_0x285e75(_0x114a7c['result'][_0xcd9d('0x12')]);}})['catch'](function(_0x3e5e23){logger[_0xcd9d('0x10')](_0xcd9d('0xc'),_0x425858,_0x3e5e23);_0x45130c(_0x3e5e23);});});}exports[_0xcd9d('0x13')]=function(_0x438169){var _0x4381e2=this;return new Promise(function(_0x24959b,_0x3c544d){return db[_0xcd9d('0x14')][_0xcd9d('0x15')](_0x438169[_0xcd9d('0x16')],{'raw':_0x438169['options']?_0x438169[_0xcd9d('0x17')][_0xcd9d('0x18')]===undefined?!![]:![]:!![]})[_0xcd9d('0xa')](function(_0x594bd8){logger[_0xcd9d('0xb')](_0xcd9d('0x13'),_0x438169);logger[_0xcd9d('0xe')](_0xcd9d('0x13'),_0x438169,JSON[_0xcd9d('0x19')](_0x594bd8));_0x24959b(_0x594bd8);})[_0xcd9d('0x1a')](function(_0x1e7d4d){logger[_0xcd9d('0x10')]('CreateCmHopperHistory',_0x1e7d4d['message'],_0x438169);_0x3c544d(_0x4381e2[_0xcd9d('0x10')](0x1f4,_0x1e7d4d[_0xcd9d('0x12')]));});});};exports[_0xcd9d('0x1b')]=function(_0x474bb4){var _0x58b632=this;return new Promise(function(_0x73420,_0x2ecff5){return db[_0xcd9d('0x14')][_0xcd9d('0x1c')]({'raw':_0x474bb4[_0xcd9d('0x17')]?_0x474bb4[_0xcd9d('0x17')][_0xcd9d('0x18')]===undefined?!![]:![]:!![],'where':_0x474bb4[_0xcd9d('0x17')]?_0x474bb4[_0xcd9d('0x17')][_0xcd9d('0x1d')]||null:null,'attributes':[[db[_0xcd9d('0x1e')]['fn'](_0xcd9d('0x1f'),db[_0xcd9d('0x1e')]['col']('id')),_0xcd9d('0x20')],[db[_0xcd9d('0x1e')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xcd9d('0x1e')][_0xcd9d('0x21')]('`state`\x20=\x204,\x201,\x20null'))),_0xcd9d('0x22')],[db[_0xcd9d('0x1e')]['fn'](_0xcd9d('0x1f'),db[_0xcd9d('0x1e')]['fn']('IF',db[_0xcd9d('0x1e')]['literal'](_0xcd9d('0x23')))),_0xcd9d('0x24')],[db[_0xcd9d('0x1e')]['fn']('COUNT',db[_0xcd9d('0x1e')]['fn']('IF',db[_0xcd9d('0x1e')][_0xcd9d('0x21')]('`state`\x20=\x2011,\x201,\x20null'))),_0xcd9d('0x25')],[db[_0xcd9d('0x1e')]['fn'](_0xcd9d('0x26'),db[_0xcd9d('0x1e')]['fn']('IF',db['sequelize']['literal'](_0xcd9d('0x27')))),'predictiveIntervalAvgHoldtime'],[db['sequelize']['fn'](_0xcd9d('0x26'),db[_0xcd9d('0x1e')]['fn']('IF',db[_0xcd9d('0x1e')][_0xcd9d('0x21')]('`state`\x20=\x204,\x20`talktime`,\x20null'))),'predictiveIntervalAvgTalktime']]})[_0xcd9d('0xa')](function(_0x8e354c){logger[_0xcd9d('0xb')]('AvgHandleTime',_0x474bb4);logger[_0xcd9d('0xe')](_0xcd9d('0x1b'),_0x474bb4,JSON[_0xcd9d('0x19')](_0x8e354c));_0x73420(_0x8e354c);})[_0xcd9d('0x1a')](function(_0x37314d){logger[_0xcd9d('0x10')](_0xcd9d('0x1b'),_0x37314d[_0xcd9d('0x12')],_0x474bb4);_0x2ecff5(_0x58b632[_0xcd9d('0x10')](0x1f4,_0x37314d[_0xcd9d('0x12')]));});});};exports[_0xcd9d('0x28')]=function(_0x3a815d){var _0x52cb2c=this;return new Promise(function(_0x2f6eff,_0x383c1d){return db['CmHopperHistory']['findAll']({'raw':_0x3a815d[_0xcd9d('0x17')]?_0x3a815d['options']['raw']===undefined?!![]:![]:!![],'where':_0x3a815d[_0xcd9d('0x17')]?_0x3a815d[_0xcd9d('0x17')][_0xcd9d('0x1d')]||null:null,'attributes':[[_0xcd9d('0x29'),'name'],[db[_0xcd9d('0x1e')]['fn'](_0xcd9d('0x1f'),db['sequelize']['fn']('IF',db[_0xcd9d('0x1e')][_0xcd9d('0x21')](_0xcd9d('0x2a')))),_0xcd9d('0x2b')],[db['sequelize']['fn']('COUNT',db[_0xcd9d('0x1e')]['fn']('IF',db['sequelize'][_0xcd9d('0x21')](_0xcd9d('0x2c')))),_0xcd9d('0x2d')],[db['sequelize']['fn'](_0xcd9d('0x1f'),db[_0xcd9d('0x1e')]['fn']('IF',db[_0xcd9d('0x1e')][_0xcd9d('0x21')](_0xcd9d('0x2e')))),_0xcd9d('0x2f')],[db[_0xcd9d('0x1e')]['fn'](_0xcd9d('0x1f'),db[_0xcd9d('0x1e')]['fn']('IF',db[_0xcd9d('0x1e')][_0xcd9d('0x21')]('`state`\x20=\x205,\x201,\x20null'))),'outboundBusyCallsDay'],[db['sequelize']['fn'](_0xcd9d('0x1f'),db[_0xcd9d('0x1e')]['fn']('IF',db[_0xcd9d('0x1e')]['literal'](_0xcd9d('0x30')))),_0xcd9d('0x31')],[db['sequelize']['fn'](_0xcd9d('0x1f'),db['sequelize']['fn']('IF',db[_0xcd9d('0x1e')][_0xcd9d('0x21')]('`state`\x20=\x2010\x20,\x201,\x20null'))),'outboundDropCallsDayTimeout'],[db[_0xcd9d('0x1e')]['fn'](_0xcd9d('0x1f'),db[_0xcd9d('0x1e')]['fn']('IF',db[_0xcd9d('0x1e')][_0xcd9d('0x21')](_0xcd9d('0x32')))),'outboundDropCallsDayCallersExit'],[db['sequelize']['fn']('COUNT',db[_0xcd9d('0x1e')]['fn']('IF',db[_0xcd9d('0x1e')]['literal'](_0xcd9d('0x33')))),_0xcd9d('0x34')],[db[_0xcd9d('0x1e')]['fn'](_0xcd9d('0x1f'),db[_0xcd9d('0x1e')]['fn']('IF',db[_0xcd9d('0x1e')][_0xcd9d('0x21')](_0xcd9d('0x35')))),_0xcd9d('0x36')],[db[_0xcd9d('0x1e')]['fn']('COUNT',db[_0xcd9d('0x1e')]['fn']('IF',db[_0xcd9d('0x1e')][_0xcd9d('0x21')](_0xcd9d('0x37')))),_0xcd9d('0x38')],[db[_0xcd9d('0x1e')]['fn'](_0xcd9d('0x1f'),db[_0xcd9d('0x1e')]['fn']('IF',db['sequelize'][_0xcd9d('0x21')](_0xcd9d('0x39')))),_0xcd9d('0x3a')],[db['sequelize']['fn'](_0xcd9d('0x1f'),db[_0xcd9d('0x1e')]['fn']('IF',db[_0xcd9d('0x1e')][_0xcd9d('0x21')](_0xcd9d('0x3b')))),_0xcd9d('0x3c')],[db[_0xcd9d('0x1e')]['fn'](_0xcd9d('0x1f'),db['sequelize']['fn']('IF',db[_0xcd9d('0x1e')][_0xcd9d('0x21')](_0xcd9d('0x3d')))),_0xcd9d('0x3a')],[db['sequelize']['fn'](_0xcd9d('0x1f'),db[_0xcd9d('0x1e')]['fn']('IF',db[_0xcd9d('0x1e')][_0xcd9d('0x21')]('`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null'))),_0xcd9d('0x3e')]],'group':[_0xcd9d('0x29')]})[_0xcd9d('0xa')](function(_0x425e86){logger[_0xcd9d('0xb')]('GetVoiceQueueHopperHistory',_0x3a815d);logger[_0xcd9d('0xe')](_0xcd9d('0x28'),_0x3a815d,JSON['stringify'](_0x425e86));_0x2f6eff(_0x425e86);})[_0xcd9d('0x1a')](function(_0x3c3d0e){logger['error'](_0xcd9d('0x28'),_0x3c3d0e[_0xcd9d('0x12')],_0x3a815d);_0x383c1d(_0x52cb2c[_0xcd9d('0x10')](0x1f4,_0x3c3d0e[_0xcd9d('0x12')]));});});};exports[_0xcd9d('0x3f')]=function(_0x1db78c){var _0x5ebe93=this;return new Promise(function(_0x5eb7b4,_0x58264e){return db[_0xcd9d('0x14')][_0xcd9d('0x1c')]({'raw':_0x1db78c[_0xcd9d('0x17')]?_0x1db78c['options'][_0xcd9d('0x18')]===undefined?!![]:![]:!![],'where':_0x1db78c[_0xcd9d('0x17')]?_0x1db78c['options'][_0xcd9d('0x1d')]||null:null,'attributes':[[_0xcd9d('0x29'),_0xcd9d('0x40')],[db['sequelize']['fn'](_0xcd9d('0x1f'),db[_0xcd9d('0x1e')]['col']('id')),_0xcd9d('0x41')],[db['sequelize']['fn'](_0xcd9d('0x1f'),db[_0xcd9d('0x1e')]['fn']('IF',db[_0xcd9d('0x1e')]['literal'](_0xcd9d('0x2e')))),_0xcd9d('0x42')]],'group':[_0xcd9d('0x29')]})[_0xcd9d('0xa')](function(_0xbd5461){logger[_0xcd9d('0xb')](_0xcd9d('0x3f'),_0x1db78c);logger[_0xcd9d('0xe')](_0xcd9d('0x3f'),_0x1db78c,JSON['stringify'](_0xbd5461));_0x5eb7b4(_0xbd5461);})[_0xcd9d('0x1a')](function(_0x28c759){logger[_0xcd9d('0x10')]('GetCampaignHopperHistory',_0x28c759[_0xcd9d('0x12')],_0x1db78c);_0x58264e(_0x5ebe93[_0xcd9d('0x10')](0x1f4,_0x28c759[_0xcd9d('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index dd22376..e9a9d0b 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 _0xcb8a=['update','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperHistory.controller','isAuthenticated','index','describe','get','/:id','show','post'];(function(_0x3dba94,_0x1ba94a){var _0x2151cc=function(_0x238b24){while(--_0x238b24){_0x3dba94['push'](_0x3dba94['shift']());}};_0x2151cc(++_0x1ba94a);}(_0xcb8a,0x8e));var _0xacb8=function(_0x21d7c4,_0x1ee1ed){_0x21d7c4=_0x21d7c4-0x0;var _0x5665b8=_0xcb8a[_0x21d7c4];return _0x5665b8;};'use strict';var multer=require(_0xacb8('0x0'));var util=require(_0xacb8('0x1'));var path=require(_0xacb8('0x2'));var timeout=require(_0xacb8('0x3'));var express=require(_0xacb8('0x4'));var router=express[_0xacb8('0x5')]();var fs_extra=require(_0xacb8('0x6'));var auth=require(_0xacb8('0x7'));var interaction=require(_0xacb8('0x8'));var config=require(_0xacb8('0x9'));var controller=require(_0xacb8('0xa'));router['get']('/',auth[_0xacb8('0xb')](),controller[_0xacb8('0xc')]);router['get']('/describe',auth[_0xacb8('0xb')](),controller[_0xacb8('0xd')]);router[_0xacb8('0xe')](_0xacb8('0xf'),auth[_0xacb8('0xb')](),controller[_0xacb8('0x10')]);router[_0xacb8('0x11')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0xacb8('0xf'),auth[_0xacb8('0xb')](),controller[_0xacb8('0x12')]);module[_0xacb8('0x13')]=router; \ No newline at end of file +var _0xbb3f=['/:id','create','put','util','connect-timeout','../../components/auth/service','../../components/interaction/service','./cmHopperHistory.controller','get','isAuthenticated','index','describe'];(function(_0x4d886a,_0x1980d3){var _0x3fa895=function(_0x3731f8){while(--_0x3731f8){_0x4d886a['push'](_0x4d886a['shift']());}};_0x3fa895(++_0x1980d3);}(_0xbb3f,0x153));var _0xfbb3=function(_0x2941ff,_0x5e720f){_0x2941ff=_0x2941ff-0x0;var _0x2f6f05=_0xbb3f[_0x2941ff];return _0x2f6f05;};'use strict';var multer=require('multer');var util=require(_0xfbb3('0x0'));var path=require('path');var timeout=require(_0xfbb3('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xfbb3('0x2'));var interaction=require(_0xfbb3('0x3'));var config=require('../../config/environment');var controller=require(_0xfbb3('0x4'));router[_0xfbb3('0x5')]('/',auth[_0xfbb3('0x6')](),controller[_0xfbb3('0x7')]);router[_0xfbb3('0x5')]('/describe',auth[_0xfbb3('0x6')](),controller[_0xfbb3('0x8')]);router[_0xfbb3('0x5')](_0xfbb3('0x9'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0xfbb3('0x6')](),controller[_0xfbb3('0xa')]);router[_0xfbb3('0xb')]('/:id',auth[_0xfbb3('0x6')](),controller['update']);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmList/cmList.attributes.js b/server/api/cmList/cmList.attributes.js index 9ea0e5b..853c99e 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 _0x1052=['sequelize','exports','STRING','name'];(function(_0x3ff085,_0x27c92e){var _0x2b68c3=function(_0x37811e){while(--_0x37811e){_0x3ff085['push'](_0x3ff085['shift']());}};_0x2b68c3(++_0x27c92e);}(_0x1052,0xf4));var _0x2105=function(_0xda501a,_0x159d6a){_0xda501a=_0xda501a-0x0;var _0x44be3a=_0x1052[_0xda501a];return _0x44be3a;};'use strict';var Sequelize=require(_0x2105('0x0'));module[_0x2105('0x1')]={'name':{'type':Sequelize[_0x2105('0x2')],'unique':_0x2105('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x2105('0x2')]},'dialPrefix':{'type':Sequelize[_0x2105('0x2')]}}; \ No newline at end of file +var _0xde6c=['STRING','sequelize','exports','name'];(function(_0x12d6de,_0xccc040){var _0x32923b=function(_0x1b150f){while(--_0x1b150f){_0x12d6de['push'](_0x12d6de['shift']());}};_0x32923b(++_0xccc040);}(_0xde6c,0x119));var _0xcde6=function(_0xab9f3d,_0xb336fa){_0xab9f3d=_0xab9f3d-0x0;var _0x5283bf=_0xde6c[_0xab9f3d];return _0x5283bf;};'use strict';var Sequelize=require(_0xcde6('0x0'));module[_0xcde6('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xcde6('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xcde6('0x3')]},'dialPrefix':{'type':Sequelize[_0xcde6('0x3')]}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index 832afae..771dcaa 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 _0xa9f4=['addAgents','emit','userCmList:save','removeAgents','userCmList:remove','getAgents','User','info','spread','message','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./cmList.socket','register','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','Lists','UserProfileResource','stack','name','send','index','map','fieldName','key','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','merge','filter','options','CmList','includeAll','findAll','rows','catch','keys','rawAttributes','length','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','get','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','destroy','describe','addDisposition','Disposition','getDispositions','findOne','pick','removeDispositions','ids','addContacts','CmContact','tags','join','isArray','push','each','omit','success','errors','Malformed\x20request\x20syntax','CmCustomField','CustomFields','concat','cf_%d','getContactsCsv','ContactItemType','OrderBy','alias','from','cm_contacts','c.ListId\x20=\x20?','field','c.cf_','select','item','ItemTypeId\x20=\x20?','CmContactId\x20=\x20c.id','additionalPhone_','cm_contact_has_items','description_additionalPhone_','toString','isEmpty','now','format','setHeader','attachment;\x20filename=','Content-type','text/csv','download','/tmp/list_%d_%s.csv','addCustomField','sequelize','transaction','Sequelize','type','text','TEXT','number','INTEGER','switch','BOOLEAN','defaultValue','queryInterface','addColumn','cf_%s','findAndCountAll','getGlobalCustomFields'];(function(_0x47f07d,_0x195757){var _0x3fbb32=function(_0xcc9fb8){while(--_0xcc9fb8){_0x47f07d['push'](_0x47f07d['shift']());}};_0x3fbb32(++_0x195757);}(_0xa9f4,0x158));var _0x4a9f=function(_0x4d5bc6,_0xf02808){_0x4d5bc6=_0x4d5bc6-0x0;var _0x5dd7ba=_0xa9f4[_0x4d5bc6];return _0x5dd7ba;};'use strict';var emlformat=require(_0x4a9f('0x0'));var rimraf=require(_0x4a9f('0x1'));var zipdir=require(_0x4a9f('0x2'));var jsonpatch=require(_0x4a9f('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x4a9f('0x4'));var Mustache=require(_0x4a9f('0x5'));var util=require(_0x4a9f('0x6'));var path=require(_0x4a9f('0x7'));var sox=require(_0x4a9f('0x8'));var csv=require(_0x4a9f('0x9'));var ejs=require(_0x4a9f('0xa'));var fs=require('fs');var fs_extra=require(_0x4a9f('0xb'));var _=require(_0x4a9f('0xc'));var squel=require(_0x4a9f('0xd'));var crypto=require(_0x4a9f('0xe'));var jsforce=require(_0x4a9f('0xf'));var deskjs=require(_0x4a9f('0x10'));var toCsv=require(_0x4a9f('0x9'));var querystring=require(_0x4a9f('0x11'));var Papa=require(_0x4a9f('0x12'));var Redis=require(_0x4a9f('0x13'));var authService=require(_0x4a9f('0x14'));var qs=require(_0x4a9f('0x15'));var as=require(_0x4a9f('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x4a9f('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x4a9f('0x18'))['db'];var csv_results;config[_0x4a9f('0x19')]=_[_0x4a9f('0x1a')](config[_0x4a9f('0x19')],{'host':_0x4a9f('0x1b'),'port':0x18eb});var socket=require(_0x4a9f('0x1c'))(new Redis(config['redis']));require(_0x4a9f('0x1d'))[_0x4a9f('0x1e')](socket);function respondWithStatusCode(_0x508395,_0x51c6a6){_0x51c6a6=_0x51c6a6||0xcc;return function(_0x34be7e){if(_0x34be7e){return _0x508395[_0x4a9f('0x1f')](_0x51c6a6);}return _0x508395[_0x4a9f('0x20')](_0x51c6a6)[_0x4a9f('0x21')]();};}function respondWithResult(_0x363248,_0x2b815f){_0x2b815f=_0x2b815f||0xc8;return function(_0x1e3fb9){if(_0x1e3fb9){return _0x363248[_0x4a9f('0x20')](_0x2b815f)['json'](_0x1e3fb9);}};}function respondWithFilteredResult(_0x1ef894,_0x2df0b6){return function(_0x3e9d71){if(_0x3e9d71){var _0x335783=typeof _0x2df0b6[_0x4a9f('0x22')]===_0x4a9f('0x23')&&typeof _0x2df0b6[_0x4a9f('0x24')]===_0x4a9f('0x23');var _0x5f1acd=_0x3e9d71['count'];var _0x3bb821=_0x335783?0x0:_0x2df0b6['offset'];var _0x4aacb4=_0x335783?_0x3e9d71[_0x4a9f('0x25')]:_0x2df0b6[_0x4a9f('0x22')]+_0x2df0b6[_0x4a9f('0x24')];var _0x3b5070;if(_0x4aacb4>=_0x5f1acd){_0x4aacb4=_0x5f1acd;_0x3b5070=0xc8;}else{_0x3b5070=0xce;}_0x1ef894[_0x4a9f('0x20')](_0x3b5070);return _0x1ef894[_0x4a9f('0x26')](_0x4a9f('0x27'),_0x3bb821+'-'+_0x4aacb4+'/'+_0x5f1acd)[_0x4a9f('0x28')](_0x3e9d71);}return null;};}function patchUpdates(_0x31a5c0){return function(_0x38ac8b){try{jsonpatch[_0x4a9f('0x29')](_0x38ac8b,_0x31a5c0,!![]);}catch(_0x267961){return BPromise[_0x4a9f('0x2a')](_0x267961);}return _0x38ac8b[_0x4a9f('0x2b')]();};}function saveUpdates(_0xa47835,_0xa1e6c4){return function(_0x6c75eb){if(_0x6c75eb){return _0x6c75eb[_0x4a9f('0x2c')](_0xa47835)[_0x4a9f('0x2d')](function(_0x17dcb0){return _0x17dcb0;});}return null;};}function removeEntity(_0x3ace9d,_0x4933db){return function(_0x5ef871){if(_0x5ef871){return _0x5ef871['destroy']()['then'](function(){var _0x4f5ef7=_0x5ef871['get']({'plain':!![]});var _0x226ba8=_0x4a9f('0x2e');return db[_0x4a9f('0x2f')]['destroy']({'where':{'type':_0x226ba8,'resourceId':_0x4f5ef7['id']}})['then'](function(){return _0x5ef871;});})[_0x4a9f('0x2d')](function(){_0x3ace9d[_0x4a9f('0x20')](0xcc)[_0x4a9f('0x21')]();});}};}function handleEntityNotFound(_0x362ef8,_0x42fcee){return function(_0x44cb0c){if(!_0x44cb0c){_0x362ef8[_0x4a9f('0x1f')](0x194);}return _0x44cb0c;};}function handleError(_0x182dc4,_0x15140f){_0x15140f=_0x15140f||0x1f4;return function(_0x147390){logger['error'](_0x147390[_0x4a9f('0x30')]);if(_0x147390[_0x4a9f('0x31')]){delete _0x147390[_0x4a9f('0x31')];}_0x182dc4['status'](_0x15140f)[_0x4a9f('0x32')](_0x147390);};}exports[_0x4a9f('0x33')]=function(_0x5c8eba,_0x74f71e){var _0x2f3ebb={},_0x45f2d0={},_0x459128={'count':0x0,'rows':[]};var _0x4db040=_[_0x4a9f('0x34')](db['CmList']['rawAttributes'],function(_0x15b867){return{'name':_0x15b867[_0x4a9f('0x35')],'type':_0x15b867['type'][_0x4a9f('0x36')]};});_0x45f2d0[_0x4a9f('0x37')]=_[_0x4a9f('0x34')](_0x4db040,'name');_0x45f2d0[_0x4a9f('0x38')]=_['keys'](_0x5c8eba[_0x4a9f('0x38')]);_0x45f2d0[_0x4a9f('0x39')]=_[_0x4a9f('0x3a')](_0x45f2d0['model'],_0x45f2d0['query']);_0x2f3ebb['attributes']=_[_0x4a9f('0x3a')](_0x45f2d0['model'],qs[_0x4a9f('0x3b')](_0x5c8eba['query'][_0x4a9f('0x3b')]));_0x2f3ebb[_0x4a9f('0x3c')]=_0x2f3ebb[_0x4a9f('0x3c')]['length']?_0x2f3ebb[_0x4a9f('0x3c')]:_0x45f2d0[_0x4a9f('0x37')];if(!_0x5c8eba[_0x4a9f('0x38')][_0x4a9f('0x3d')](_0x4a9f('0x3e'))){_0x2f3ebb['limit']=qs[_0x4a9f('0x24')](_0x5c8eba[_0x4a9f('0x38')][_0x4a9f('0x24')]);_0x2f3ebb[_0x4a9f('0x22')]=qs['offset'](_0x5c8eba[_0x4a9f('0x38')][_0x4a9f('0x22')]);}_0x2f3ebb[_0x4a9f('0x3f')]=qs[_0x4a9f('0x40')](_0x5c8eba[_0x4a9f('0x38')][_0x4a9f('0x40')]);_0x2f3ebb[_0x4a9f('0x41')]=qs[_0x4a9f('0x39')](_['pick'](_0x5c8eba[_0x4a9f('0x38')],_0x45f2d0[_0x4a9f('0x39')]),_0x4db040);if(_0x5c8eba['query']['filter']){_0x2f3ebb[_0x4a9f('0x41')]=_[_0x4a9f('0x42')](_0x2f3ebb['where'],{'$or':_['map'](_0x4db040,function(_0x1aa4b4){if(_0x1aa4b4['type']!=='VIRTUAL'){var _0x31d19f={};_0x31d19f[_0x1aa4b4[_0x4a9f('0x31')]]={'$like':'%'+_0x5c8eba[_0x4a9f('0x38')][_0x4a9f('0x43')]+'%'};return _0x31d19f;}})});}_0x2f3ebb=_['merge']({},_0x2f3ebb,_0x5c8eba[_0x4a9f('0x44')]);var _0x2d3cba={'where':_0x2f3ebb[_0x4a9f('0x41')]};return db[_0x4a9f('0x45')][_0x4a9f('0x25')](_0x2d3cba)[_0x4a9f('0x2d')](function(_0x4e5556){_0x459128[_0x4a9f('0x25')]=_0x4e5556;if(_0x5c8eba['query'][_0x4a9f('0x46')]){_0x2f3ebb['include']=[{'all':!![]}];}return db['CmList'][_0x4a9f('0x47')](_0x2f3ebb);})[_0x4a9f('0x2d')](function(_0x41b4c1){_0x459128[_0x4a9f('0x48')]=_0x41b4c1;return _0x459128;})[_0x4a9f('0x2d')](respondWithFilteredResult(_0x74f71e,_0x2f3ebb))[_0x4a9f('0x49')](handleError(_0x74f71e,null));};exports['show']=function(_0x5a5ae0,_0x12bacb){var _0x3be41e={'raw':![],'where':{'id':_0x5a5ae0['params']['id']}},_0x421dfe={};_0x421dfe[_0x4a9f('0x37')]=_[_0x4a9f('0x4a')](db['CmList'][_0x4a9f('0x4b')]);_0x421dfe[_0x4a9f('0x38')]=_['keys'](_0x5a5ae0[_0x4a9f('0x38')]);_0x421dfe[_0x4a9f('0x39')]=_[_0x4a9f('0x3a')](_0x421dfe[_0x4a9f('0x37')],_0x421dfe[_0x4a9f('0x38')]);_0x3be41e[_0x4a9f('0x3c')]=_['intersection'](_0x421dfe[_0x4a9f('0x37')],qs['fields'](_0x5a5ae0[_0x4a9f('0x38')][_0x4a9f('0x3b')]));_0x3be41e[_0x4a9f('0x3c')]=_0x3be41e[_0x4a9f('0x3c')][_0x4a9f('0x4c')]?_0x3be41e[_0x4a9f('0x3c')]:_0x421dfe['model'];if(_0x5a5ae0[_0x4a9f('0x38')][_0x4a9f('0x46')]){_0x3be41e[_0x4a9f('0x4d')]=[{'all':!![]}];}_0x3be41e=_[_0x4a9f('0x42')]({},_0x3be41e,_0x5a5ae0[_0x4a9f('0x44')]);return db['CmList'][_0x4a9f('0x4e')](_0x3be41e)[_0x4a9f('0x2d')](handleEntityNotFound(_0x12bacb,null))[_0x4a9f('0x2d')](respondWithResult(_0x12bacb,null))['catch'](handleError(_0x12bacb,null));};exports[_0x4a9f('0x4f')]=function(_0x3a9ab9,_0x3e0560){return db['CmList'][_0x4a9f('0x4f')](_0x3a9ab9[_0x4a9f('0x50')],{})[_0x4a9f('0x2d')](function(_0x8c9727){var _0x4f40ec=_0x3a9ab9[_0x4a9f('0x51')]['get']({'plain':!![]});if(!_0x4f40ec)throw new Error(_0x4a9f('0x52'));if(_0x4f40ec['role']===_0x4a9f('0x51')){var _0x4ef450=_0x8c9727[_0x4a9f('0x53')]({'plain':!![]});var _0x312881=_0x4a9f('0x2e');return db[_0x4a9f('0x54')][_0x4a9f('0x4e')]({'where':{'name':_0x312881,'userProfileId':_0x4f40ec[_0x4a9f('0x55')]},'raw':!![]})[_0x4a9f('0x2d')](function(_0x23144c){if(_0x23144c&&_0x23144c[_0x4a9f('0x56')]===0x0){return db[_0x4a9f('0x2f')][_0x4a9f('0x4f')]({'name':_0x4ef450['name'],'resourceId':_0x4ef450['id'],'type':_0x23144c[_0x4a9f('0x31')],'sectionId':_0x23144c['id']},{})['then'](function(){return _0x8c9727;});}else{return _0x8c9727;}})['catch'](function(_0x28fb9a){logger[_0x4a9f('0x57')](_0x4a9f('0x58'),_0x28fb9a);throw _0x28fb9a;});}return _0x8c9727;})['then'](respondWithResult(_0x3e0560,0xc9))['catch'](handleError(_0x3e0560,null));};exports[_0x4a9f('0x2c')]=function(_0x56284c,_0x5db3c8){if(_0x56284c['body']['id']){delete _0x56284c['body']['id'];}return db[_0x4a9f('0x45')][_0x4a9f('0x4e')]({'where':{'id':_0x56284c[_0x4a9f('0x59')]['id']}})[_0x4a9f('0x2d')](handleEntityNotFound(_0x5db3c8,null))[_0x4a9f('0x2d')](saveUpdates(_0x56284c[_0x4a9f('0x50')],null))[_0x4a9f('0x2d')](respondWithResult(_0x5db3c8,null))[_0x4a9f('0x49')](handleError(_0x5db3c8,null));};exports[_0x4a9f('0x5a')]=function(_0x486cf1,_0x672f5c){return db[_0x4a9f('0x45')]['find']({'where':{'id':_0x486cf1[_0x4a9f('0x59')]['id']}})[_0x4a9f('0x2d')](handleEntityNotFound(_0x672f5c,null))['then'](removeEntity(_0x672f5c,null))['catch'](handleError(_0x672f5c,null));};exports[_0x4a9f('0x5b')]=function(_0x39457c,_0x3bc123){return db['CmList'][_0x4a9f('0x5b')]()[_0x4a9f('0x2d')](respondWithResult(_0x3bc123,null))[_0x4a9f('0x49')](handleError(_0x3bc123,null));};exports[_0x4a9f('0x5c')]=function(_0x4429f9,_0x15b671,_0xbd71cf){if(_0x4429f9[_0x4a9f('0x50')]['id']){delete _0x4429f9[_0x4a9f('0x50')]['id'];}return db[_0x4a9f('0x45')]['find']({'where':{'id':_0x4429f9[_0x4a9f('0x59')]['id']}})[_0x4a9f('0x2d')](handleEntityNotFound(_0x15b671,null))[_0x4a9f('0x2d')](function(_0x4d9434){if(_0x4d9434){_0x4429f9[_0x4a9f('0x50')]['ListId']=_0x4d9434['id'];return db[_0x4a9f('0x5d')]['create'](_0x4429f9[_0x4a9f('0x50')]);}})[_0x4a9f('0x2d')](respondWithResult(_0x15b671,null))['catch'](handleError(_0x15b671,null));};exports[_0x4a9f('0x5e')]=function(_0x52689b,_0x38913a,_0x51fbeb){var _0x13d74f={'raw':![],'where':{}};var _0x388322={};var _0x3e0b5d={'count':0x0,'rows':[]};return db[_0x4a9f('0x45')][_0x4a9f('0x5f')]({'where':{'id':_0x52689b[_0x4a9f('0x59')]['id']}})['then'](handleEntityNotFound(_0x38913a,null))[_0x4a9f('0x2d')](function(_0x48a049){if(_0x48a049){_0x388322[_0x4a9f('0x37')]=_['keys'](db[_0x4a9f('0x5d')][_0x4a9f('0x4b')]);_0x388322[_0x4a9f('0x38')]=_[_0x4a9f('0x4a')](_0x52689b['query']);_0x388322[_0x4a9f('0x39')]=_[_0x4a9f('0x3a')](_0x388322[_0x4a9f('0x37')],_0x388322[_0x4a9f('0x38')]);_0x13d74f[_0x4a9f('0x3c')]=_[_0x4a9f('0x3a')](_0x388322['model'],qs[_0x4a9f('0x3b')](_0x52689b['query'][_0x4a9f('0x3b')]));_0x13d74f['attributes']=_0x13d74f[_0x4a9f('0x3c')]['length']?_0x13d74f[_0x4a9f('0x3c')]:_0x388322[_0x4a9f('0x37')];if(!_0x52689b[_0x4a9f('0x38')][_0x4a9f('0x3d')]('nolimit')){_0x13d74f[_0x4a9f('0x24')]=qs[_0x4a9f('0x24')](_0x52689b[_0x4a9f('0x38')][_0x4a9f('0x24')]);_0x13d74f[_0x4a9f('0x22')]=qs[_0x4a9f('0x22')](_0x52689b[_0x4a9f('0x38')][_0x4a9f('0x22')]);}_0x13d74f[_0x4a9f('0x3f')]=qs[_0x4a9f('0x40')](_0x52689b[_0x4a9f('0x38')][_0x4a9f('0x40')]);_0x13d74f[_0x4a9f('0x41')]=qs[_0x4a9f('0x39')](_[_0x4a9f('0x60')](_0x52689b['query'],_0x388322[_0x4a9f('0x39')]));_0x13d74f[_0x4a9f('0x41')]['ListId']=_0x48a049['id'];if(_0x52689b[_0x4a9f('0x38')][_0x4a9f('0x43')]){_0x13d74f[_0x4a9f('0x41')]=_[_0x4a9f('0x42')](_0x13d74f[_0x4a9f('0x41')],{'$or':_[_0x4a9f('0x34')](_0x13d74f[_0x4a9f('0x3c')],function(_0x4d04ea){var _0x262d46={};_0x262d46[_0x4d04ea]={'$like':'%'+_0x52689b[_0x4a9f('0x38')][_0x4a9f('0x43')]+'%'};return _0x262d46;})});}_0x13d74f=_['merge']({},_0x13d74f,_0x52689b[_0x4a9f('0x44')]);return db[_0x4a9f('0x5d')]['count']({'where':_0x13d74f[_0x4a9f('0x41')]})[_0x4a9f('0x2d')](function(_0x2750b6){_0x3e0b5d[_0x4a9f('0x25')]=_0x2750b6;if(_0x52689b[_0x4a9f('0x38')][_0x4a9f('0x46')]){_0x13d74f[_0x4a9f('0x4d')]=[{'all':!![]}];}return db['Disposition'][_0x4a9f('0x47')](_0x13d74f);})[_0x4a9f('0x2d')](function(_0x3eda1c){_0x3e0b5d[_0x4a9f('0x48')]=_0x3eda1c;return _0x3e0b5d;});}})[_0x4a9f('0x2d')](respondWithFilteredResult(_0x38913a,_0x13d74f))[_0x4a9f('0x49')](handleError(_0x38913a,null));};exports[_0x4a9f('0x61')]=function(_0x573641,_0x4a7e18,_0xedb9be){return db[_0x4a9f('0x45')][_0x4a9f('0x4e')]({'where':{'id':_0x573641[_0x4a9f('0x59')]['id']}})[_0x4a9f('0x2d')](handleEntityNotFound(_0x4a7e18,null))[_0x4a9f('0x2d')](function(_0x45d6a1){if(_0x45d6a1){return _0x45d6a1['removeDispositions'](_0x573641[_0x4a9f('0x38')][_0x4a9f('0x62')]);}})[_0x4a9f('0x2d')](respondWithStatusCode(_0x4a7e18,null))[_0x4a9f('0x49')](handleError(_0x4a7e18,null));};exports[_0x4a9f('0x63')]=function(_0x994ecf,_0x4b7ffe,_0x183843){return db[_0x4a9f('0x45')]['find']({'where':{'id':_0x994ecf[_0x4a9f('0x59')]['id']}})['then'](handleEntityNotFound(_0x4b7ffe,null))[_0x4a9f('0x2d')](function(_0x4f5f82){if(_0x4f5f82){var _0xd7ea0a=[];var _0x593494={'success':[],'errors':[]};return db[_0x4a9f('0x64')][_0x4a9f('0x5b')]()['then'](function(_0xe22ec9){if(_0x994ecf[_0x4a9f('0x50')]['tags']&&_['isArray'](_0x994ecf[_0x4a9f('0x50')][_0x4a9f('0x65')])){if(_0x994ecf['body'][_0x4a9f('0x65')][_0x4a9f('0x4c')]){_0x994ecf['body'][_0x4a9f('0x65')]=_0x994ecf[_0x4a9f('0x50')]['tags'][_0x4a9f('0x66')](';')+';';}else{_0x994ecf[_0x4a9f('0x50')][_0x4a9f('0x65')]=null;}}else{_0x994ecf[_0x4a9f('0x50')][_0x4a9f('0x65')]=null;}if(_0x994ecf[_0x4a9f('0x50')]&&_[_0x4a9f('0x67')](_0x994ecf[_0x4a9f('0x50')])){for(var _0x14af1e=0x0;_0x14af1e<_0x994ecf[_0x4a9f('0x50')]['length'];_0x14af1e+=0x1){_0x994ecf[_0x4a9f('0x50')][_0x14af1e]['ListId']=_0x994ecf[_0x4a9f('0x59')]['id'];_0xd7ea0a[_0x4a9f('0x68')](_0x994ecf['body'][_0x14af1e]);}return BPromise[_0x4a9f('0x69')](_0xd7ea0a,function(_0xe10db2){return db[_0x4a9f('0x64')][_0x4a9f('0x4f')](_[_0x4a9f('0x6a')](_0xe10db2,[_0x4a9f('0x62'),'id'])||{},{'fields':_[_0x4a9f('0x4a')](_0xe22ec9),'raw':!![]})[_0x4a9f('0x2d')](function(_0x4652c3){_0x593494[_0x4a9f('0x6b')][_0x4a9f('0x68')](_0x4652c3['dataValues']);})[_0x4a9f('0x49')](function(_0x1d2a71){_0x593494[_0x4a9f('0x6c')][_0x4a9f('0x68')]({'data':_0xe10db2,'error':_0x1d2a71['message']});});})[_0x4a9f('0x2d')](function(_0x52497e){return _0x593494;})['catch'](function(_0x3af7cf){return _0x3af7cf;});}else{_0x4b7ffe['status'](0x190)[_0x4a9f('0x28')]({'message':_0x4a9f('0x6d')});}});}})['then'](respondWithResult(_0x4b7ffe,null))[_0x4a9f('0x49')](handleError(_0x4b7ffe,null));};exports['getContacts']=function(_0x5c6524,_0xcd3db,_0x3b6000){var _0x29ce23;return db[_0x4a9f('0x45')][_0x4a9f('0x4e')]({'where':{'id':_0x5c6524[_0x4a9f('0x59')]['id']},'include':[{'model':db[_0x4a9f('0x6e')],'as':_0x4a9f('0x6f')}]})[_0x4a9f('0x2d')](handleEntityNotFound(_0xcd3db,null))[_0x4a9f('0x2d')](function(_0x18ff8c){if(_0x18ff8c){_0x29ce23=_0x18ff8c;return db[_0x4a9f('0x64')]['rawAttributes'];}})[_0x4a9f('0x2d')](function(_0x2fd432){if(_0x2fd432){var _0x50f9af={};var _0x41535c={};_0x41535c[_0x4a9f('0x37')]=_[_0x4a9f('0x70')](_[_0x4a9f('0x4a')](_0x2fd432),_[_0x4a9f('0x34')](_0x29ce23['CustomFields'],function(_0x2b1256){return util['format'](_0x4a9f('0x71'),_0x2b1256['id']);}));_0x41535c[_0x4a9f('0x38')]=_[_0x4a9f('0x4a')](_0x5c6524[_0x4a9f('0x38')]);_0x41535c[_0x4a9f('0x39')]=_['intersection'](_0x41535c[_0x4a9f('0x37')],_0x41535c['query']);_0x50f9af['attributes']=_[_0x4a9f('0x3a')](_0x41535c['model'],qs[_0x4a9f('0x3b')](_0x5c6524[_0x4a9f('0x38')][_0x4a9f('0x3b')]));_0x50f9af[_0x4a9f('0x3c')]=_0x50f9af[_0x4a9f('0x3c')][_0x4a9f('0x4c')]?_0x50f9af['attributes']:_0x41535c['model'];if(!_0x5c6524[_0x4a9f('0x38')][_0x4a9f('0x3d')](_0x4a9f('0x3e'))){_0x50f9af['limit']=qs[_0x4a9f('0x24')](_0x5c6524[_0x4a9f('0x38')]['limit']);_0x50f9af[_0x4a9f('0x22')]=qs[_0x4a9f('0x22')](_0x5c6524[_0x4a9f('0x38')][_0x4a9f('0x22')]);}_0x50f9af[_0x4a9f('0x3f')]=qs[_0x4a9f('0x40')](_0x5c6524[_0x4a9f('0x38')][_0x4a9f('0x40')]);_0x50f9af[_0x4a9f('0x41')]=qs[_0x4a9f('0x39')](_['pick'](_0x5c6524['query'],_0x41535c['filters']));_0x50f9af['raw']=!![];if(_0x5c6524[_0x4a9f('0x38')][_0x4a9f('0x43')]){_0x50f9af[_0x4a9f('0x41')]=_[_0x4a9f('0x42')](_0x50f9af[_0x4a9f('0x41')],{'$or':_[_0x4a9f('0x34')](_0x50f9af['attributes'],function(_0xc6083a){var _0x55c5d4={};_0x55c5d4[_0xc6083a]={'$like':'%'+_0x5c6524[_0x4a9f('0x38')][_0x4a9f('0x43')]+'%'};return _0x55c5d4;})});}_0x50f9af=_[_0x4a9f('0x42')]({},_0x50f9af,_0x5c6524[_0x4a9f('0x44')]);return _0x29ce23['getContacts'](_0x50f9af);}})[_0x4a9f('0x2d')](respondWithResult(_0xcd3db,null))[_0x4a9f('0x49')](handleError(_0xcd3db,null));};exports[_0x4a9f('0x72')]=function(_0x1330f1,_0x2b0218,_0x58f843){var _0x450890;var _0x491f52;var _0x141951;var _0x240cd2=_0x1330f1[_0x4a9f('0x59')]['id'];csv_results=[];return db[_0x4a9f('0x73')][_0x4a9f('0x47')]({'attributes':['id',_0x4a9f('0x31')],'raw':!![],'order':[_0x4a9f('0x74')]})['then'](function(_0x5092e4){_0x450890=_0x5092e4;var _0x25eaa2=_[_0x4a9f('0x4a')](db['CmContact'][_0x4a9f('0x4b')]);return db[_0x4a9f('0x6e')][_0x4a9f('0x47')]({'raw':!![],'attributes':['id',_0x4a9f('0x75')]})['then'](function(_0x1514bc){_0x491f52=_0x1514bc;var _0x445ca5=squel['select']()[_0x4a9f('0x3b')](_0x25eaa2)[_0x4a9f('0x76')](_0x4a9f('0x77'),'c')[_0x4a9f('0x41')](_0x4a9f('0x78'),_0x240cd2)[_0x4a9f('0x41')]('c.deletedAt\x20is\x20null')['distinct']();for(var _0x4ee8b6=0x0;_0x4ee8b6<_0x491f52['length'];_0x4ee8b6++){_0x445ca5[_0x4a9f('0x79')](_0x4a9f('0x7a')+_0x491f52[_0x4ee8b6]['id'],'customField_'+_0x491f52[_0x4ee8b6]['alias']);}for(var _0x4ee8b6=0x0;_0x4ee8b6<_0x450890[_0x4a9f('0x4c')];_0x4ee8b6++){_0x445ca5[_0x4a9f('0x79')](squel[_0x4a9f('0x7b')]()[_0x4a9f('0x79')](_0x4a9f('0x7c'))[_0x4a9f('0x76')]('cm_contact_has_items')['where'](_0x4a9f('0x7d'),_0x450890[_0x4ee8b6]['id'])[_0x4a9f('0x41')](_0x4a9f('0x7e')),_0x4a9f('0x7f')+_0x450890[_0x4ee8b6][_0x4a9f('0x31')]);_0x445ca5[_0x4a9f('0x79')](squel[_0x4a9f('0x7b')]()[_0x4a9f('0x79')]('description')[_0x4a9f('0x76')](_0x4a9f('0x80'))[_0x4a9f('0x41')](_0x4a9f('0x7d'),_0x450890[_0x4ee8b6]['id'])[_0x4a9f('0x41')](_0x4a9f('0x7e')),_0x4a9f('0x81')+_0x450890[_0x4ee8b6][_0x4a9f('0x31')]);}var _0x47b799=[];_0x47b799['push'](_0x445ca5[_0x4a9f('0x82')]());BPromise[_0x4a9f('0x69')](_0x47b799,handleQuery)[_0x4a9f('0x2d')](function(_0x212a0f){handleQuery(_0x445ca5['toString']());var _0x36db09=csv_results[0x0];if(!_[_0x4a9f('0x83')](_0x36db09)){var _0x2fd7c7=toCsv(_0x36db09);var _0x5d5755=Date[_0x4a9f('0x84')]();fs['writeFileSync'](util[_0x4a9f('0x85')]('/tmp/list_%d_%s.csv',_0x240cd2,_0x5d5755),_0x2fd7c7);_0x2b0218[_0x4a9f('0x86')]('Content-disposition',_0x4a9f('0x87')+util['format']('list_%d_%s.csv',_0x240cd2,_0x5d5755));_0x2b0218['setHeader'](_0x4a9f('0x88'),_0x4a9f('0x89'));return _0x2b0218[_0x4a9f('0x8a')](util[_0x4a9f('0x85')](_0x4a9f('0x8b'),_0x240cd2,_0x5d5755));}else{return _0x2b0218[_0x4a9f('0x1f')](0xcc);}});});});};exports[_0x4a9f('0x8c')]=function(_0x4cbe1c,_0x2c19bf,_0x1e1386){var _0x573f78;delete _0x4cbe1c[_0x4a9f('0x50')]['id'];return db[_0x4a9f('0x45')][_0x4a9f('0x5f')]({'where':{'id':_0x4cbe1c[_0x4a9f('0x59')]['id']}})[_0x4a9f('0x2d')](handleEntityNotFound(_0x2c19bf,null))[_0x4a9f('0x2d')](function(_0xc5ff4f){if(_0xc5ff4f){return db[_0x4a9f('0x8d')][_0x4a9f('0x8e')](function(_0x4f6245){return db[_0x4a9f('0x6e')]['create'](_0x4cbe1c[_0x4a9f('0x50')],{'transaction':_0x4f6245})[_0x4a9f('0x2d')](function(_0x2c76b4){_0x573f78=_0x2c76b4;return _0xc5ff4f['addCustomFields'](_0x2c76b4,{'transaction':_0x4f6245});})['then'](function(){var _0x31a684={'type':db[_0x4a9f('0x8f')]['TEXT'],'transaction':_0x4f6245};switch(_0x4cbe1c['body'][_0x4a9f('0x90')]){case _0x4a9f('0x91'):_0x31a684[_0x4a9f('0x90')]=db['Sequelize'][_0x4a9f('0x92')];break;case _0x4a9f('0x93'):_0x31a684[_0x4a9f('0x90')]=db[_0x4a9f('0x8f')][_0x4a9f('0x94')];break;case _0x4a9f('0x95'):_0x31a684[_0x4a9f('0x90')]=db[_0x4a9f('0x8f')][_0x4a9f('0x96')];_0x31a684[_0x4a9f('0x97')]=![];break;default:}return db[_0x4a9f('0x8d')][_0x4a9f('0x98')][_0x4a9f('0x99')](_0x4a9f('0x77'),util[_0x4a9f('0x85')](_0x4a9f('0x9a'),_0x573f78['id']),_0x31a684);})[_0x4a9f('0x2d')](function(){return _0x573f78;});});}})[_0x4a9f('0x2d')](respondWithResult(_0x2c19bf,null))[_0x4a9f('0x49')](handleError(_0x2c19bf,null));};exports['getCustomFields']=function(_0x35aabc,_0x12a27b,_0x1f4df6){var _0x331211={};var _0x3e264e={};var _0x318f39;var _0x1e184c;return db[_0x4a9f('0x45')]['findOne']({'where':{'id':_0x35aabc[_0x4a9f('0x59')]['id']}})[_0x4a9f('0x2d')](handleEntityNotFound(_0x12a27b,null))[_0x4a9f('0x2d')](function(_0x201a05){if(_0x201a05){_0x318f39=_0x201a05;_0x3e264e['model']=_['keys'](db[_0x4a9f('0x6e')]['rawAttributes']);_0x3e264e[_0x4a9f('0x38')]=_[_0x4a9f('0x4a')](_0x35aabc[_0x4a9f('0x38')]);_0x3e264e[_0x4a9f('0x39')]=_[_0x4a9f('0x3a')](_0x3e264e[_0x4a9f('0x37')],_0x3e264e[_0x4a9f('0x38')]);_0x331211[_0x4a9f('0x3c')]=_[_0x4a9f('0x3a')](_0x3e264e['model'],qs[_0x4a9f('0x3b')](_0x35aabc['query']['fields']));_0x331211[_0x4a9f('0x3c')]=_0x331211[_0x4a9f('0x3c')][_0x4a9f('0x4c')]?_0x331211[_0x4a9f('0x3c')]:_0x3e264e['model'];_0x331211[_0x4a9f('0x3f')]=qs['sort'](_0x35aabc[_0x4a9f('0x38')][_0x4a9f('0x40')]);_0x331211[_0x4a9f('0x41')]=qs['filters'](_[_0x4a9f('0x60')](_0x35aabc[_0x4a9f('0x38')],_0x3e264e[_0x4a9f('0x39')]));_0x331211['where']=_[_0x4a9f('0x42')](_0x331211[_0x4a9f('0x41')],{'$or':[{'ListId':_0x201a05['id']},{'ListId':null}]});if(_0x35aabc['query'][_0x4a9f('0x43')]){_0x331211[_0x4a9f('0x41')]=_[_0x4a9f('0x42')](_0x331211[_0x4a9f('0x41')],{'$or':_[_0x4a9f('0x34')](_0x331211[_0x4a9f('0x3c')],function(_0x256be8){var _0x28ee88={};_0x28ee88[_0x256be8]={'$like':'%'+_0x35aabc[_0x4a9f('0x38')][_0x4a9f('0x43')]+'%'};return _0x28ee88;})});}_0x331211=_[_0x4a9f('0x42')]({},_0x331211,_0x35aabc[_0x4a9f('0x44')]);return db[_0x4a9f('0x6e')][_0x4a9f('0x9b')](_0x331211);}})[_0x4a9f('0x2d')](respondWithResult(_0x12a27b,null))[_0x4a9f('0x49')](handleError(_0x12a27b,null));};exports[_0x4a9f('0x9c')]=function(_0x4769da,_0x37b30e){return db[_0x4a9f('0x6e')][_0x4a9f('0x9b')]({'where':{'ListId':null}})[_0x4a9f('0x2d')](handleEntityNotFound(_0x37b30e,null))[_0x4a9f('0x2d')](function(_0x302761){return _0x302761;})[_0x4a9f('0x2d')](respondWithResult(_0x37b30e,null))[_0x4a9f('0x49')](handleError(_0x37b30e,null));};exports['addAgents']=function(_0x35fc13,_0x361bb4,_0x281c71){return db['CmList'][_0x4a9f('0x4e')]({'where':{'id':_0x35fc13[_0x4a9f('0x59')]['id']}})[_0x4a9f('0x2d')](handleEntityNotFound(_0x361bb4,null))['then'](function(_0x104071){if(_0x104071){return _0x104071[_0x4a9f('0x9d')](_0x35fc13[_0x4a9f('0x50')][_0x4a9f('0x62')],_['omit'](_0x35fc13[_0x4a9f('0x50')],[_0x4a9f('0x62'),'id'])||{})['spread'](function(_0x5715ac){for(var _0x3ce878=0x0;_0x3ce878<_0x35fc13[_0x4a9f('0x50')][_0x4a9f('0x62')]['length'];_0x3ce878+=0x1){socket[_0x4a9f('0x9e')](_0x4a9f('0x9f'),{'UserId':Number(_0x35fc13[_0x4a9f('0x50')][_0x4a9f('0x62')][_0x3ce878]),'CmListId':Number(_0x35fc13[_0x4a9f('0x59')]['id'])});}return _0x5715ac;});}})[_0x4a9f('0x2d')](respondWithResult(_0x361bb4,null))[_0x4a9f('0x49')](handleError(_0x361bb4,null));};exports[_0x4a9f('0xa0')]=function(_0x5742ba,_0x547c26,_0xd89bf8){return db[_0x4a9f('0x45')][_0x4a9f('0x4e')]({'where':{'id':_0x5742ba[_0x4a9f('0x59')]['id']}})['then'](handleEntityNotFound(_0x547c26,null))['then'](function(_0x5a2cdf){if(_0x5a2cdf){return _0x5a2cdf[_0x4a9f('0xa0')](_0x5742ba[_0x4a9f('0x38')][_0x4a9f('0x62')])[_0x4a9f('0x2d')](function(){if(_[_0x4a9f('0x67')](_0x5742ba[_0x4a9f('0x38')][_0x4a9f('0x62')])){for(var _0x34f1cb=0x0;_0x34f1cb<_0x5742ba['query'][_0x4a9f('0x62')][_0x4a9f('0x4c')];_0x34f1cb+=0x1){socket['emit'](_0x4a9f('0xa1'),{'UserId':Number(_0x5742ba[_0x4a9f('0x38')]['ids'][_0x34f1cb]),'CmListId':Number(_0x5742ba[_0x4a9f('0x59')]['id'])});}}else{socket['emit']('userCmList:remove',{'UserId':Number(_0x5742ba[_0x4a9f('0x38')][_0x4a9f('0x62')]),'CmListId':Number(_0x5742ba[_0x4a9f('0x59')]['id'])});}});}})[_0x4a9f('0x2d')](respondWithStatusCode(_0x547c26,null))['catch'](handleError(_0x547c26,null));};exports[_0x4a9f('0xa2')]=function(_0x35ea62,_0x5d7166,_0x4d4ef1){var _0x577200={};var _0x5c6242={};var _0x1431ea;var _0x1354e4;return db[_0x4a9f('0x45')][_0x4a9f('0x5f')]({'where':{'id':_0x35ea62[_0x4a9f('0x59')]['id']}})[_0x4a9f('0x2d')](handleEntityNotFound(_0x5d7166,null))[_0x4a9f('0x2d')](function(_0xb22d07){if(_0xb22d07){_0x1431ea=_0xb22d07;_0x5c6242[_0x4a9f('0x37')]=_['keys'](db[_0x4a9f('0xa3')][_0x4a9f('0x4b')]);_0x5c6242['query']=_['keys'](_0x35ea62[_0x4a9f('0x38')]);_0x5c6242[_0x4a9f('0x39')]=_['intersection'](_0x5c6242['model'],_0x5c6242['query']);_0x577200['attributes']=_[_0x4a9f('0x3a')](_0x5c6242[_0x4a9f('0x37')],qs[_0x4a9f('0x3b')](_0x35ea62[_0x4a9f('0x38')][_0x4a9f('0x3b')]));_0x577200['attributes']=_0x577200[_0x4a9f('0x3c')][_0x4a9f('0x4c')]?_0x577200[_0x4a9f('0x3c')]:_0x5c6242[_0x4a9f('0x37')];_0x577200[_0x4a9f('0x3f')]=qs[_0x4a9f('0x40')](_0x35ea62[_0x4a9f('0x38')]['sort']);_0x577200[_0x4a9f('0x41')]=qs[_0x4a9f('0x39')](_[_0x4a9f('0x60')](_0x35ea62[_0x4a9f('0x38')],_0x5c6242[_0x4a9f('0x39')]));if(_0x35ea62[_0x4a9f('0x38')]['filter']){_0x577200['where']=_[_0x4a9f('0x42')](_0x577200[_0x4a9f('0x41')],{'$or':_[_0x4a9f('0x34')](_0x577200[_0x4a9f('0x3c')],function(_0x383fa8){var _0x68199={};_0x68199[_0x383fa8]={'$like':'%'+_0x35ea62['query']['filter']+'%'};return _0x68199;})});}_0x577200=_['merge']({},_0x577200,_0x35ea62['options']);return _0x1431ea['getAgents'](_0x577200);}})[_0x4a9f('0x2d')](function(_0x1a114a){if(_0x1a114a){_0x1354e4=_0x1a114a[_0x4a9f('0x4c')];if(!_0x35ea62[_0x4a9f('0x38')][_0x4a9f('0x3d')](_0x4a9f('0x3e'))){_0x577200['limit']=qs[_0x4a9f('0x24')](_0x35ea62['query'][_0x4a9f('0x24')]);_0x577200[_0x4a9f('0x22')]=qs[_0x4a9f('0x22')](_0x35ea62[_0x4a9f('0x38')][_0x4a9f('0x22')]);}return _0x1431ea['getAgents'](_0x577200);}})[_0x4a9f('0x2d')](function(_0x43beb6){if(_0x43beb6){return _0x43beb6?{'count':_0x1354e4,'rows':_0x43beb6}:null;}})[_0x4a9f('0x2d')](respondWithResult(_0x5d7166,null))[_0x4a9f('0x49')](handleError(_0x5d7166,null));};function handleQuery(_0x1ba961){logger[_0x4a9f('0xa4')](_0x1ba961);return db[_0x4a9f('0x8d')][_0x4a9f('0x38')](_0x1ba961)[_0x4a9f('0xa5')](function(_0x1cbf00){csv_results[_0x4a9f('0x68')](_0x1cbf00);})['catch'](function(_0x111084){logger[_0x4a9f('0x57')](_0x111084[_0x4a9f('0xa6')]);});} \ No newline at end of file +var _0x481f=['fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','./cmList.socket','register','sendStatus','status','offset','undefined','limit','count','set','json','apply','reject','save','update','then','destroy','get','Lists','UserProfileResource','end','stack','name','map','CmList','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','length','find','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','create','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','ListId','Disposition','getDispositions','findOne','includeAll','removeDispositions','ids','CmContact','isArray','tags','join','push','omit','success','dataValues','message','CustomFields','concat','format','raw','ContactItemType','OrderBy','CmCustomField','alias','select','from','cm_contacts','c.ListId\x20=\x20?','c.deletedAt\x20is\x20null','distinct','customField_','field','item','cm_contact_has_items','CmContactId\x20=\x20c.id','additionalPhone_','description','description_additionalPhone_','toString','each','now','writeFileSync','/tmp/list_%d_%s.csv','setHeader','attachment;\x20filename=','list_%d_%s.csv','text/csv','addCustomField','transaction','Sequelize','TEXT','number','INTEGER','BOOLEAN','sequelize','queryInterface','cf_%s','getCustomFields','getGlobalCustomFields','findAndCountAll','addAgents','spread','emit','userCmList:save','removeAgents','userCmList:remove','getAgents','User','info','eml-format','rimraf'];(function(_0x503641,_0x33a3cf){var _0x17757d=function(_0xc2ba4e){while(--_0xc2ba4e){_0x503641['push'](_0x503641['shift']());}};_0x17757d(++_0x33a3cf);}(_0x481f,0x1ea));var _0xf481=function(_0x2a4428,_0xd1f091){_0x2a4428=_0x2a4428-0x0;var _0x44b336=_0x481f[_0x2a4428];return _0x44b336;};'use strict';var emlformat=require(_0xf481('0x0'));var rimraf=require(_0xf481('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf481('0x2'));var rp=require(_0xf481('0x3'));var moment=require(_0xf481('0x4'));var BPromise=require(_0xf481('0x5'));var Mustache=require('mustache');var util=require(_0xf481('0x6'));var path=require(_0xf481('0x7'));var sox=require(_0xf481('0x8'));var csv=require(_0xf481('0x9'));var ejs=require(_0xf481('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf481('0xb'));var squel=require(_0xf481('0xc'));var crypto=require(_0xf481('0xd'));var jsforce=require(_0xf481('0xe'));var deskjs=require(_0xf481('0xf'));var toCsv=require(_0xf481('0x9'));var querystring=require(_0xf481('0x10'));var Papa=require(_0xf481('0x11'));var Redis=require(_0xf481('0x12'));var authService=require(_0xf481('0x13'));var qs=require(_0xf481('0x14'));var as=require(_0xf481('0x15'));var hardwareService=require(_0xf481('0x16'));var logger=require(_0xf481('0x17'))(_0xf481('0x18'));var utils=require(_0xf481('0x19'));var config=require(_0xf481('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0xf481('0x1b'))['db'];var csv_results;config[_0xf481('0x1c')]=_[_0xf481('0x1d')](config[_0xf481('0x1c')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf481('0x1c')]));require(_0xf481('0x1e'))[_0xf481('0x1f')](socket);function respondWithStatusCode(_0x106bd3,_0x51d5a5){_0x51d5a5=_0x51d5a5||0xcc;return function(_0x4fa933){if(_0x4fa933){return _0x106bd3[_0xf481('0x20')](_0x51d5a5);}return _0x106bd3[_0xf481('0x21')](_0x51d5a5)['end']();};}function respondWithResult(_0x1ec062,_0x38c562){_0x38c562=_0x38c562||0xc8;return function(_0x2c853f){if(_0x2c853f){return _0x1ec062[_0xf481('0x21')](_0x38c562)['json'](_0x2c853f);}};}function respondWithFilteredResult(_0x59ef1b,_0x5e7f74){return function(_0x55e0f2){if(_0x55e0f2){var _0x51064a=typeof _0x5e7f74[_0xf481('0x22')]===_0xf481('0x23')&&typeof _0x5e7f74[_0xf481('0x24')]===_0xf481('0x23');var _0x3a4aa4=_0x55e0f2[_0xf481('0x25')];var _0x1f0d8d=_0x51064a?0x0:_0x5e7f74['offset'];var _0xb5e777=_0x51064a?_0x55e0f2[_0xf481('0x25')]:_0x5e7f74[_0xf481('0x22')]+_0x5e7f74[_0xf481('0x24')];var _0x5ade48;if(_0xb5e777>=_0x3a4aa4){_0xb5e777=_0x3a4aa4;_0x5ade48=0xc8;}else{_0x5ade48=0xce;}_0x59ef1b['status'](_0x5ade48);return _0x59ef1b[_0xf481('0x26')]('Content-Range',_0x1f0d8d+'-'+_0xb5e777+'/'+_0x3a4aa4)[_0xf481('0x27')](_0x55e0f2);}return null;};}function patchUpdates(_0x3375d0){return function(_0x4d0f5e){try{jsonpatch[_0xf481('0x28')](_0x4d0f5e,_0x3375d0,!![]);}catch(_0xfc66b0){return BPromise[_0xf481('0x29')](_0xfc66b0);}return _0x4d0f5e[_0xf481('0x2a')]();};}function saveUpdates(_0x42b37b,_0x256604){return function(_0x283447){if(_0x283447){return _0x283447[_0xf481('0x2b')](_0x42b37b)[_0xf481('0x2c')](function(_0x3612c4){return _0x3612c4;});}return null;};}function removeEntity(_0x319f0d,_0x1dad36){return function(_0x25576b){if(_0x25576b){return _0x25576b[_0xf481('0x2d')]()[_0xf481('0x2c')](function(){var _0x451ef7=_0x25576b[_0xf481('0x2e')]({'plain':!![]});var _0x2678e8=_0xf481('0x2f');return db[_0xf481('0x30')]['destroy']({'where':{'type':_0x2678e8,'resourceId':_0x451ef7['id']}})[_0xf481('0x2c')](function(){return _0x25576b;});})[_0xf481('0x2c')](function(){_0x319f0d[_0xf481('0x21')](0xcc)[_0xf481('0x31')]();});}};}function handleEntityNotFound(_0x531630,_0x774f75){return function(_0x4662a4){if(!_0x4662a4){_0x531630[_0xf481('0x20')](0x194);}return _0x4662a4;};}function handleError(_0x2e9168,_0x54b56f){_0x54b56f=_0x54b56f||0x1f4;return function(_0x4bb3f8){logger['error'](_0x4bb3f8[_0xf481('0x32')]);if(_0x4bb3f8[_0xf481('0x33')]){delete _0x4bb3f8[_0xf481('0x33')];}_0x2e9168[_0xf481('0x21')](_0x54b56f)['send'](_0x4bb3f8);};}exports['index']=function(_0x4e7b3f,_0x1965ca){var _0xbcbda1={},_0x4b46a2={},_0x5f22b4={'count':0x0,'rows':[]};var _0x27fc19=_[_0xf481('0x34')](db[_0xf481('0x35')][_0xf481('0x36')],function(_0x11a84e){return{'name':_0x11a84e[_0xf481('0x37')],'type':_0x11a84e[_0xf481('0x38')][_0xf481('0x39')]};});_0x4b46a2[_0xf481('0x3a')]=_[_0xf481('0x34')](_0x27fc19,_0xf481('0x33'));_0x4b46a2[_0xf481('0x3b')]=_[_0xf481('0x3c')](_0x4e7b3f[_0xf481('0x3b')]);_0x4b46a2[_0xf481('0x3d')]=_[_0xf481('0x3e')](_0x4b46a2[_0xf481('0x3a')],_0x4b46a2['query']);_0xbcbda1[_0xf481('0x3f')]=_[_0xf481('0x3e')](_0x4b46a2[_0xf481('0x3a')],qs['fields'](_0x4e7b3f[_0xf481('0x3b')][_0xf481('0x40')]));_0xbcbda1[_0xf481('0x3f')]=_0xbcbda1[_0xf481('0x3f')]['length']?_0xbcbda1[_0xf481('0x3f')]:_0x4b46a2['model'];if(!_0x4e7b3f[_0xf481('0x3b')][_0xf481('0x41')](_0xf481('0x42'))){_0xbcbda1[_0xf481('0x24')]=qs[_0xf481('0x24')](_0x4e7b3f['query'][_0xf481('0x24')]);_0xbcbda1['offset']=qs[_0xf481('0x22')](_0x4e7b3f[_0xf481('0x3b')][_0xf481('0x22')]);}_0xbcbda1[_0xf481('0x43')]=qs[_0xf481('0x44')](_0x4e7b3f[_0xf481('0x3b')][_0xf481('0x44')]);_0xbcbda1[_0xf481('0x45')]=qs[_0xf481('0x3d')](_[_0xf481('0x46')](_0x4e7b3f['query'],_0x4b46a2['filters']),_0x27fc19);if(_0x4e7b3f[_0xf481('0x3b')][_0xf481('0x47')]){_0xbcbda1[_0xf481('0x45')]=_[_0xf481('0x48')](_0xbcbda1[_0xf481('0x45')],{'$or':_[_0xf481('0x34')](_0x27fc19,function(_0x3c5629){if(_0x3c5629[_0xf481('0x38')]!==_0xf481('0x49')){var _0x327902={};_0x327902[_0x3c5629[_0xf481('0x33')]]={'$like':'%'+_0x4e7b3f[_0xf481('0x3b')][_0xf481('0x47')]+'%'};return _0x327902;}})});}_0xbcbda1=_[_0xf481('0x48')]({},_0xbcbda1,_0x4e7b3f[_0xf481('0x4a')]);var _0x607170={'where':_0xbcbda1['where']};return db[_0xf481('0x35')][_0xf481('0x25')](_0x607170)['then'](function(_0x359940){_0x5f22b4[_0xf481('0x25')]=_0x359940;if(_0x4e7b3f[_0xf481('0x3b')]['includeAll']){_0xbcbda1[_0xf481('0x4b')]=[{'all':!![]}];}return db[_0xf481('0x35')][_0xf481('0x4c')](_0xbcbda1);})[_0xf481('0x2c')](function(_0x4b08ce){_0x5f22b4[_0xf481('0x4d')]=_0x4b08ce;return _0x5f22b4;})[_0xf481('0x2c')](respondWithFilteredResult(_0x1965ca,_0xbcbda1))[_0xf481('0x4e')](handleError(_0x1965ca,null));};exports[_0xf481('0x4f')]=function(_0x55eb92,_0x628961){var _0x276a2f={'raw':![],'where':{'id':_0x55eb92[_0xf481('0x50')]['id']}},_0x279b15={};_0x279b15[_0xf481('0x3a')]=_['keys'](db[_0xf481('0x35')][_0xf481('0x36')]);_0x279b15['query']=_[_0xf481('0x3c')](_0x55eb92[_0xf481('0x3b')]);_0x279b15['filters']=_[_0xf481('0x3e')](_0x279b15[_0xf481('0x3a')],_0x279b15[_0xf481('0x3b')]);_0x276a2f[_0xf481('0x3f')]=_['intersection'](_0x279b15[_0xf481('0x3a')],qs[_0xf481('0x40')](_0x55eb92[_0xf481('0x3b')][_0xf481('0x40')]));_0x276a2f[_0xf481('0x3f')]=_0x276a2f['attributes'][_0xf481('0x51')]?_0x276a2f[_0xf481('0x3f')]:_0x279b15[_0xf481('0x3a')];if(_0x55eb92[_0xf481('0x3b')]['includeAll']){_0x276a2f[_0xf481('0x4b')]=[{'all':!![]}];}_0x276a2f=_[_0xf481('0x48')]({},_0x276a2f,_0x55eb92[_0xf481('0x4a')]);return db['CmList'][_0xf481('0x52')](_0x276a2f)[_0xf481('0x2c')](handleEntityNotFound(_0x628961,null))['then'](respondWithResult(_0x628961,null))[_0xf481('0x4e')](handleError(_0x628961,null));};exports['create']=function(_0x19726f,_0xcae7fa){return db[_0xf481('0x35')]['create'](_0x19726f[_0xf481('0x53')],{})[_0xf481('0x2c')](function(_0x5eff89){var _0x4b3f61=_0x19726f[_0xf481('0x54')]['get']({'plain':!![]});if(!_0x4b3f61)throw new Error(_0xf481('0x55'));if(_0x4b3f61[_0xf481('0x56')]===_0xf481('0x54')){var _0x3384ab=_0x5eff89[_0xf481('0x2e')]({'plain':!![]});var _0x1c2e03=_0xf481('0x2f');return db[_0xf481('0x57')][_0xf481('0x52')]({'where':{'name':_0x1c2e03,'userProfileId':_0x4b3f61[_0xf481('0x58')]},'raw':!![]})[_0xf481('0x2c')](function(_0x5c8b2a){if(_0x5c8b2a&&_0x5c8b2a[_0xf481('0x59')]===0x0){return db[_0xf481('0x30')][_0xf481('0x5a')]({'name':_0x3384ab['name'],'resourceId':_0x3384ab['id'],'type':_0x5c8b2a['name'],'sectionId':_0x5c8b2a['id']},{})[_0xf481('0x2c')](function(){return _0x5eff89;});}else{return _0x5eff89;}})[_0xf481('0x4e')](function(_0x5483be){logger[_0xf481('0x5b')](_0xf481('0x5c'),_0x5483be);throw _0x5483be;});}return _0x5eff89;})[_0xf481('0x2c')](respondWithResult(_0xcae7fa,0xc9))['catch'](handleError(_0xcae7fa,null));};exports[_0xf481('0x2b')]=function(_0x3a084f,_0x3f5c0a){if(_0x3a084f[_0xf481('0x53')]['id']){delete _0x3a084f[_0xf481('0x53')]['id'];}return db[_0xf481('0x35')][_0xf481('0x52')]({'where':{'id':_0x3a084f[_0xf481('0x50')]['id']}})[_0xf481('0x2c')](handleEntityNotFound(_0x3f5c0a,null))[_0xf481('0x2c')](saveUpdates(_0x3a084f[_0xf481('0x53')],null))['then'](respondWithResult(_0x3f5c0a,null))[_0xf481('0x4e')](handleError(_0x3f5c0a,null));};exports[_0xf481('0x2d')]=function(_0x25b743,_0x5a7e74){return db[_0xf481('0x35')]['find']({'where':{'id':_0x25b743[_0xf481('0x50')]['id']}})[_0xf481('0x2c')](handleEntityNotFound(_0x5a7e74,null))[_0xf481('0x2c')](removeEntity(_0x5a7e74,null))['catch'](handleError(_0x5a7e74,null));};exports['describe']=function(_0x228ef4,_0x374591){return db[_0xf481('0x35')][_0xf481('0x5d')]()[_0xf481('0x2c')](respondWithResult(_0x374591,null))[_0xf481('0x4e')](handleError(_0x374591,null));};exports[_0xf481('0x5e')]=function(_0xb0ee1b,_0x56d04a,_0x2eb609){if(_0xb0ee1b[_0xf481('0x53')]['id']){delete _0xb0ee1b[_0xf481('0x53')]['id'];}return db[_0xf481('0x35')][_0xf481('0x52')]({'where':{'id':_0xb0ee1b[_0xf481('0x50')]['id']}})[_0xf481('0x2c')](handleEntityNotFound(_0x56d04a,null))[_0xf481('0x2c')](function(_0x3c1c2c){if(_0x3c1c2c){_0xb0ee1b[_0xf481('0x53')][_0xf481('0x5f')]=_0x3c1c2c['id'];return db[_0xf481('0x60')][_0xf481('0x5a')](_0xb0ee1b[_0xf481('0x53')]);}})[_0xf481('0x2c')](respondWithResult(_0x56d04a,null))[_0xf481('0x4e')](handleError(_0x56d04a,null));};exports[_0xf481('0x61')]=function(_0x5b44cf,_0x303f62,_0x363cca){var _0x241658={'raw':![],'where':{}};var _0x5278be={};var _0x539e7b={'count':0x0,'rows':[]};return db[_0xf481('0x35')][_0xf481('0x62')]({'where':{'id':_0x5b44cf[_0xf481('0x50')]['id']}})[_0xf481('0x2c')](handleEntityNotFound(_0x303f62,null))['then'](function(_0x2f6091){if(_0x2f6091){_0x5278be['model']=_[_0xf481('0x3c')](db[_0xf481('0x60')][_0xf481('0x36')]);_0x5278be[_0xf481('0x3b')]=_[_0xf481('0x3c')](_0x5b44cf[_0xf481('0x3b')]);_0x5278be['filters']=_[_0xf481('0x3e')](_0x5278be['model'],_0x5278be[_0xf481('0x3b')]);_0x241658[_0xf481('0x3f')]=_['intersection'](_0x5278be['model'],qs[_0xf481('0x40')](_0x5b44cf[_0xf481('0x3b')][_0xf481('0x40')]));_0x241658['attributes']=_0x241658[_0xf481('0x3f')]['length']?_0x241658[_0xf481('0x3f')]:_0x5278be[_0xf481('0x3a')];if(!_0x5b44cf['query'][_0xf481('0x41')]('nolimit')){_0x241658[_0xf481('0x24')]=qs[_0xf481('0x24')](_0x5b44cf['query']['limit']);_0x241658[_0xf481('0x22')]=qs['offset'](_0x5b44cf['query'][_0xf481('0x22')]);}_0x241658[_0xf481('0x43')]=qs[_0xf481('0x44')](_0x5b44cf['query'][_0xf481('0x44')]);_0x241658[_0xf481('0x45')]=qs['filters'](_[_0xf481('0x46')](_0x5b44cf[_0xf481('0x3b')],_0x5278be[_0xf481('0x3d')]));_0x241658[_0xf481('0x45')][_0xf481('0x5f')]=_0x2f6091['id'];if(_0x5b44cf['query'][_0xf481('0x47')]){_0x241658['where']=_[_0xf481('0x48')](_0x241658[_0xf481('0x45')],{'$or':_['map'](_0x241658[_0xf481('0x3f')],function(_0x5c5ea0){var _0x4b299f={};_0x4b299f[_0x5c5ea0]={'$like':'%'+_0x5b44cf[_0xf481('0x3b')][_0xf481('0x47')]+'%'};return _0x4b299f;})});}_0x241658=_[_0xf481('0x48')]({},_0x241658,_0x5b44cf['options']);return db[_0xf481('0x60')][_0xf481('0x25')]({'where':_0x241658[_0xf481('0x45')]})[_0xf481('0x2c')](function(_0x38d5ce){_0x539e7b[_0xf481('0x25')]=_0x38d5ce;if(_0x5b44cf[_0xf481('0x3b')][_0xf481('0x63')]){_0x241658['include']=[{'all':!![]}];}return db[_0xf481('0x60')][_0xf481('0x4c')](_0x241658);})[_0xf481('0x2c')](function(_0x50b192){_0x539e7b[_0xf481('0x4d')]=_0x50b192;return _0x539e7b;});}})[_0xf481('0x2c')](respondWithFilteredResult(_0x303f62,_0x241658))[_0xf481('0x4e')](handleError(_0x303f62,null));};exports[_0xf481('0x64')]=function(_0x30f97e,_0x2d657e,_0x39b202){return db[_0xf481('0x35')][_0xf481('0x52')]({'where':{'id':_0x30f97e[_0xf481('0x50')]['id']}})[_0xf481('0x2c')](handleEntityNotFound(_0x2d657e,null))['then'](function(_0x76aa99){if(_0x76aa99){return _0x76aa99[_0xf481('0x64')](_0x30f97e['query'][_0xf481('0x65')]);}})[_0xf481('0x2c')](respondWithStatusCode(_0x2d657e,null))[_0xf481('0x4e')](handleError(_0x2d657e,null));};exports['addContacts']=function(_0x298793,_0x137055,_0x13a51d){return db[_0xf481('0x35')][_0xf481('0x52')]({'where':{'id':_0x298793['params']['id']}})[_0xf481('0x2c')](handleEntityNotFound(_0x137055,null))[_0xf481('0x2c')](function(_0x47c4dd){if(_0x47c4dd){var _0x25053b=[];var _0x7d0f28={'success':[],'errors':[]};return db[_0xf481('0x66')][_0xf481('0x5d')]()['then'](function(_0x12511e){if(_0x298793[_0xf481('0x53')]['tags']&&_[_0xf481('0x67')](_0x298793[_0xf481('0x53')]['tags'])){if(_0x298793[_0xf481('0x53')][_0xf481('0x68')][_0xf481('0x51')]){_0x298793[_0xf481('0x53')]['tags']=_0x298793[_0xf481('0x53')][_0xf481('0x68')][_0xf481('0x69')](';')+';';}else{_0x298793[_0xf481('0x53')][_0xf481('0x68')]=null;}}else{_0x298793[_0xf481('0x53')][_0xf481('0x68')]=null;}if(_0x298793[_0xf481('0x53')]&&_[_0xf481('0x67')](_0x298793[_0xf481('0x53')])){for(var _0x5035dd=0x0;_0x5035dd<_0x298793[_0xf481('0x53')]['length'];_0x5035dd+=0x1){_0x298793[_0xf481('0x53')][_0x5035dd]['ListId']=_0x298793[_0xf481('0x50')]['id'];_0x25053b[_0xf481('0x6a')](_0x298793[_0xf481('0x53')][_0x5035dd]);}return BPromise['each'](_0x25053b,function(_0x49339d){return db[_0xf481('0x66')][_0xf481('0x5a')](_[_0xf481('0x6b')](_0x49339d,[_0xf481('0x65'),'id'])||{},{'fields':_['keys'](_0x12511e),'raw':!![]})['then'](function(_0x1c7626){_0x7d0f28[_0xf481('0x6c')][_0xf481('0x6a')](_0x1c7626[_0xf481('0x6d')]);})['catch'](function(_0x4e0f8a){_0x7d0f28['errors'][_0xf481('0x6a')]({'data':_0x49339d,'error':_0x4e0f8a[_0xf481('0x6e')]});});})[_0xf481('0x2c')](function(_0x408447){return _0x7d0f28;})[_0xf481('0x4e')](function(_0x3b4ce4){return _0x3b4ce4;});}else{_0x137055[_0xf481('0x21')](0x190)[_0xf481('0x27')]({'message':'Malformed\x20request\x20syntax'});}});}})[_0xf481('0x2c')](respondWithResult(_0x137055,null))[_0xf481('0x4e')](handleError(_0x137055,null));};exports['getContacts']=function(_0x181f2c,_0xd1e9f8,_0x51f9ae){var _0x7ab9ed;return db[_0xf481('0x35')][_0xf481('0x52')]({'where':{'id':_0x181f2c[_0xf481('0x50')]['id']},'include':[{'model':db['CmCustomField'],'as':_0xf481('0x6f')}]})[_0xf481('0x2c')](handleEntityNotFound(_0xd1e9f8,null))[_0xf481('0x2c')](function(_0x55d7f7){if(_0x55d7f7){_0x7ab9ed=_0x55d7f7;return db[_0xf481('0x66')]['rawAttributes'];}})['then'](function(_0x4d1a58){if(_0x4d1a58){var _0x38df59={};var _0x4f55f7={};_0x4f55f7[_0xf481('0x3a')]=_[_0xf481('0x70')](_[_0xf481('0x3c')](_0x4d1a58),_[_0xf481('0x34')](_0x7ab9ed[_0xf481('0x6f')],function(_0x291230){return util[_0xf481('0x71')]('cf_%d',_0x291230['id']);}));_0x4f55f7[_0xf481('0x3b')]=_['keys'](_0x181f2c['query']);_0x4f55f7[_0xf481('0x3d')]=_[_0xf481('0x3e')](_0x4f55f7[_0xf481('0x3a')],_0x4f55f7[_0xf481('0x3b')]);_0x38df59['attributes']=_[_0xf481('0x3e')](_0x4f55f7[_0xf481('0x3a')],qs[_0xf481('0x40')](_0x181f2c['query']['fields']));_0x38df59['attributes']=_0x38df59[_0xf481('0x3f')][_0xf481('0x51')]?_0x38df59[_0xf481('0x3f')]:_0x4f55f7[_0xf481('0x3a')];if(!_0x181f2c[_0xf481('0x3b')][_0xf481('0x41')](_0xf481('0x42'))){_0x38df59[_0xf481('0x24')]=qs['limit'](_0x181f2c[_0xf481('0x3b')]['limit']);_0x38df59[_0xf481('0x22')]=qs['offset'](_0x181f2c[_0xf481('0x3b')][_0xf481('0x22')]);}_0x38df59[_0xf481('0x43')]=qs[_0xf481('0x44')](_0x181f2c[_0xf481('0x3b')][_0xf481('0x44')]);_0x38df59[_0xf481('0x45')]=qs['filters'](_[_0xf481('0x46')](_0x181f2c[_0xf481('0x3b')],_0x4f55f7['filters']));_0x38df59[_0xf481('0x72')]=!![];if(_0x181f2c[_0xf481('0x3b')][_0xf481('0x47')]){_0x38df59[_0xf481('0x45')]=_[_0xf481('0x48')](_0x38df59[_0xf481('0x45')],{'$or':_[_0xf481('0x34')](_0x38df59['attributes'],function(_0x30bc8a){var _0x554d74={};_0x554d74[_0x30bc8a]={'$like':'%'+_0x181f2c[_0xf481('0x3b')]['filter']+'%'};return _0x554d74;})});}_0x38df59=_[_0xf481('0x48')]({},_0x38df59,_0x181f2c[_0xf481('0x4a')]);return _0x7ab9ed['getContacts'](_0x38df59);}})[_0xf481('0x2c')](respondWithResult(_0xd1e9f8,null))[_0xf481('0x4e')](handleError(_0xd1e9f8,null));};exports['getContactsCsv']=function(_0x407197,_0x4c8b5a,_0x570c5a){var _0x399a33;var _0x5b0647;var _0x129d80;var _0x3e65ae=_0x407197[_0xf481('0x50')]['id'];csv_results=[];return db[_0xf481('0x73')][_0xf481('0x4c')]({'attributes':['id',_0xf481('0x33')],'raw':!![],'order':[_0xf481('0x74')]})[_0xf481('0x2c')](function(_0x5182b3){_0x399a33=_0x5182b3;var _0x51fbca=_[_0xf481('0x3c')](db[_0xf481('0x66')][_0xf481('0x36')]);return db[_0xf481('0x75')]['findAll']({'raw':!![],'attributes':['id',_0xf481('0x76')]})['then'](function(_0x1c076e){_0x5b0647=_0x1c076e;var _0x25a10c=squel[_0xf481('0x77')]()[_0xf481('0x40')](_0x51fbca)[_0xf481('0x78')](_0xf481('0x79'),'c')['where'](_0xf481('0x7a'),_0x3e65ae)[_0xf481('0x45')](_0xf481('0x7b'))[_0xf481('0x7c')]();for(var _0x5ac2a9=0x0;_0x5ac2a9<_0x5b0647[_0xf481('0x51')];_0x5ac2a9++){_0x25a10c['field']('c.cf_'+_0x5b0647[_0x5ac2a9]['id'],_0xf481('0x7d')+_0x5b0647[_0x5ac2a9][_0xf481('0x76')]);}for(var _0x5ac2a9=0x0;_0x5ac2a9<_0x399a33[_0xf481('0x51')];_0x5ac2a9++){_0x25a10c[_0xf481('0x7e')](squel[_0xf481('0x77')]()[_0xf481('0x7e')](_0xf481('0x7f'))[_0xf481('0x78')](_0xf481('0x80'))[_0xf481('0x45')]('ItemTypeId\x20=\x20?',_0x399a33[_0x5ac2a9]['id'])['where'](_0xf481('0x81')),_0xf481('0x82')+_0x399a33[_0x5ac2a9][_0xf481('0x33')]);_0x25a10c['field'](squel['select']()[_0xf481('0x7e')](_0xf481('0x83'))['from']('cm_contact_has_items')['where']('ItemTypeId\x20=\x20?',_0x399a33[_0x5ac2a9]['id'])[_0xf481('0x45')](_0xf481('0x81')),_0xf481('0x84')+_0x399a33[_0x5ac2a9][_0xf481('0x33')]);}var _0x4a5ae0=[];_0x4a5ae0[_0xf481('0x6a')](_0x25a10c[_0xf481('0x85')]());BPromise[_0xf481('0x86')](_0x4a5ae0,handleQuery)[_0xf481('0x2c')](function(_0x59cf7c){handleQuery(_0x25a10c[_0xf481('0x85')]());var _0x6ed2a3=csv_results[0x0];if(!_['isEmpty'](_0x6ed2a3)){var _0x4a85fa=toCsv(_0x6ed2a3);var _0x4669cf=Date[_0xf481('0x87')]();fs[_0xf481('0x88')](util[_0xf481('0x71')](_0xf481('0x89'),_0x3e65ae,_0x4669cf),_0x4a85fa);_0x4c8b5a[_0xf481('0x8a')]('Content-disposition',_0xf481('0x8b')+util['format'](_0xf481('0x8c'),_0x3e65ae,_0x4669cf));_0x4c8b5a['setHeader']('Content-type',_0xf481('0x8d'));return _0x4c8b5a['download'](util['format'](_0xf481('0x89'),_0x3e65ae,_0x4669cf));}else{return _0x4c8b5a[_0xf481('0x20')](0xcc);}});});});};exports[_0xf481('0x8e')]=function(_0x310026,_0x2973fc,_0x11a0c8){var _0x470259;delete _0x310026[_0xf481('0x53')]['id'];return db[_0xf481('0x35')][_0xf481('0x62')]({'where':{'id':_0x310026['params']['id']}})[_0xf481('0x2c')](handleEntityNotFound(_0x2973fc,null))[_0xf481('0x2c')](function(_0x2ca6af){if(_0x2ca6af){return db['sequelize'][_0xf481('0x8f')](function(_0x3a8a8f){return db[_0xf481('0x75')][_0xf481('0x5a')](_0x310026[_0xf481('0x53')],{'transaction':_0x3a8a8f})[_0xf481('0x2c')](function(_0x2caa36){_0x470259=_0x2caa36;return _0x2ca6af['addCustomFields'](_0x2caa36,{'transaction':_0x3a8a8f});})[_0xf481('0x2c')](function(){var _0x15b6fc={'type':db[_0xf481('0x90')]['TEXT'],'transaction':_0x3a8a8f};switch(_0x310026[_0xf481('0x53')][_0xf481('0x38')]){case'text':_0x15b6fc[_0xf481('0x38')]=db[_0xf481('0x90')][_0xf481('0x91')];break;case _0xf481('0x92'):_0x15b6fc[_0xf481('0x38')]=db[_0xf481('0x90')][_0xf481('0x93')];break;case'switch':_0x15b6fc['type']=db[_0xf481('0x90')][_0xf481('0x94')];_0x15b6fc['defaultValue']=![];break;default:}return db[_0xf481('0x95')][_0xf481('0x96')]['addColumn'](_0xf481('0x79'),util[_0xf481('0x71')](_0xf481('0x97'),_0x470259['id']),_0x15b6fc);})[_0xf481('0x2c')](function(){return _0x470259;});});}})[_0xf481('0x2c')](respondWithResult(_0x2973fc,null))[_0xf481('0x4e')](handleError(_0x2973fc,null));};exports[_0xf481('0x98')]=function(_0x48cbac,_0x34937d,_0x19f2fa){var _0x27fec8={};var _0x39af2c={};var _0x5c35e0;var _0x3ddb01;return db['CmList']['findOne']({'where':{'id':_0x48cbac[_0xf481('0x50')]['id']}})[_0xf481('0x2c')](handleEntityNotFound(_0x34937d,null))[_0xf481('0x2c')](function(_0x11d916){if(_0x11d916){_0x5c35e0=_0x11d916;_0x39af2c['model']=_[_0xf481('0x3c')](db[_0xf481('0x75')]['rawAttributes']);_0x39af2c[_0xf481('0x3b')]=_[_0xf481('0x3c')](_0x48cbac['query']);_0x39af2c[_0xf481('0x3d')]=_[_0xf481('0x3e')](_0x39af2c['model'],_0x39af2c['query']);_0x27fec8[_0xf481('0x3f')]=_['intersection'](_0x39af2c['model'],qs[_0xf481('0x40')](_0x48cbac[_0xf481('0x3b')][_0xf481('0x40')]));_0x27fec8['attributes']=_0x27fec8[_0xf481('0x3f')]['length']?_0x27fec8[_0xf481('0x3f')]:_0x39af2c['model'];_0x27fec8[_0xf481('0x43')]=qs[_0xf481('0x44')](_0x48cbac['query'][_0xf481('0x44')]);_0x27fec8[_0xf481('0x45')]=qs['filters'](_[_0xf481('0x46')](_0x48cbac[_0xf481('0x3b')],_0x39af2c[_0xf481('0x3d')]));_0x27fec8[_0xf481('0x45')]=_[_0xf481('0x48')](_0x27fec8[_0xf481('0x45')],{'$or':[{'ListId':_0x11d916['id']},{'ListId':null}]});if(_0x48cbac[_0xf481('0x3b')][_0xf481('0x47')]){_0x27fec8[_0xf481('0x45')]=_[_0xf481('0x48')](_0x27fec8['where'],{'$or':_[_0xf481('0x34')](_0x27fec8[_0xf481('0x3f')],function(_0x96f30c){var _0x39acbc={};_0x39acbc[_0x96f30c]={'$like':'%'+_0x48cbac[_0xf481('0x3b')][_0xf481('0x47')]+'%'};return _0x39acbc;})});}_0x27fec8=_[_0xf481('0x48')]({},_0x27fec8,_0x48cbac[_0xf481('0x4a')]);return db[_0xf481('0x75')]['findAndCountAll'](_0x27fec8);}})[_0xf481('0x2c')](respondWithResult(_0x34937d,null))[_0xf481('0x4e')](handleError(_0x34937d,null));};exports[_0xf481('0x99')]=function(_0x29ec0b,_0x2a5bf1){return db[_0xf481('0x75')][_0xf481('0x9a')]({'where':{'ListId':null}})[_0xf481('0x2c')](handleEntityNotFound(_0x2a5bf1,null))[_0xf481('0x2c')](function(_0x233363){return _0x233363;})[_0xf481('0x2c')](respondWithResult(_0x2a5bf1,null))[_0xf481('0x4e')](handleError(_0x2a5bf1,null));};exports[_0xf481('0x9b')]=function(_0x16aa5c,_0x211098,_0x1bf1ed){return db[_0xf481('0x35')][_0xf481('0x52')]({'where':{'id':_0x16aa5c['params']['id']}})['then'](handleEntityNotFound(_0x211098,null))[_0xf481('0x2c')](function(_0x526bd7){if(_0x526bd7){return _0x526bd7[_0xf481('0x9b')](_0x16aa5c[_0xf481('0x53')]['ids'],_[_0xf481('0x6b')](_0x16aa5c[_0xf481('0x53')],['ids','id'])||{})[_0xf481('0x9c')](function(_0x56e23b){for(var _0x52be31=0x0;_0x52be31<_0x16aa5c[_0xf481('0x53')][_0xf481('0x65')][_0xf481('0x51')];_0x52be31+=0x1){socket[_0xf481('0x9d')](_0xf481('0x9e'),{'UserId':Number(_0x16aa5c[_0xf481('0x53')]['ids'][_0x52be31]),'CmListId':Number(_0x16aa5c[_0xf481('0x50')]['id'])});}return _0x56e23b;});}})[_0xf481('0x2c')](respondWithResult(_0x211098,null))[_0xf481('0x4e')](handleError(_0x211098,null));};exports['removeAgents']=function(_0x534283,_0xfd7067,_0x44e61b){return db[_0xf481('0x35')][_0xf481('0x52')]({'where':{'id':_0x534283['params']['id']}})['then'](handleEntityNotFound(_0xfd7067,null))[_0xf481('0x2c')](function(_0x91ba99){if(_0x91ba99){return _0x91ba99[_0xf481('0x9f')](_0x534283['query']['ids'])['then'](function(){if(_[_0xf481('0x67')](_0x534283[_0xf481('0x3b')][_0xf481('0x65')])){for(var _0x4e7e5e=0x0;_0x4e7e5e<_0x534283[_0xf481('0x3b')][_0xf481('0x65')][_0xf481('0x51')];_0x4e7e5e+=0x1){socket[_0xf481('0x9d')](_0xf481('0xa0'),{'UserId':Number(_0x534283[_0xf481('0x3b')][_0xf481('0x65')][_0x4e7e5e]),'CmListId':Number(_0x534283['params']['id'])});}}else{socket[_0xf481('0x9d')](_0xf481('0xa0'),{'UserId':Number(_0x534283['query'][_0xf481('0x65')]),'CmListId':Number(_0x534283[_0xf481('0x50')]['id'])});}});}})[_0xf481('0x2c')](respondWithStatusCode(_0xfd7067,null))[_0xf481('0x4e')](handleError(_0xfd7067,null));};exports[_0xf481('0xa1')]=function(_0x17e88f,_0x42123d,_0xdb5f7e){var _0xff43e={};var _0x4cf8e6={};var _0x21c2a0;var _0x2286d0;return db[_0xf481('0x35')][_0xf481('0x62')]({'where':{'id':_0x17e88f[_0xf481('0x50')]['id']}})[_0xf481('0x2c')](handleEntityNotFound(_0x42123d,null))['then'](function(_0x4fb59e){if(_0x4fb59e){_0x21c2a0=_0x4fb59e;_0x4cf8e6['model']=_[_0xf481('0x3c')](db[_0xf481('0xa2')][_0xf481('0x36')]);_0x4cf8e6[_0xf481('0x3b')]=_[_0xf481('0x3c')](_0x17e88f[_0xf481('0x3b')]);_0x4cf8e6[_0xf481('0x3d')]=_[_0xf481('0x3e')](_0x4cf8e6[_0xf481('0x3a')],_0x4cf8e6[_0xf481('0x3b')]);_0xff43e['attributes']=_['intersection'](_0x4cf8e6['model'],qs[_0xf481('0x40')](_0x17e88f[_0xf481('0x3b')][_0xf481('0x40')]));_0xff43e[_0xf481('0x3f')]=_0xff43e[_0xf481('0x3f')]['length']?_0xff43e['attributes']:_0x4cf8e6['model'];_0xff43e[_0xf481('0x43')]=qs[_0xf481('0x44')](_0x17e88f['query'][_0xf481('0x44')]);_0xff43e[_0xf481('0x45')]=qs[_0xf481('0x3d')](_[_0xf481('0x46')](_0x17e88f[_0xf481('0x3b')],_0x4cf8e6[_0xf481('0x3d')]));if(_0x17e88f[_0xf481('0x3b')][_0xf481('0x47')]){_0xff43e[_0xf481('0x45')]=_[_0xf481('0x48')](_0xff43e[_0xf481('0x45')],{'$or':_[_0xf481('0x34')](_0xff43e['attributes'],function(_0x41c1d1){var _0x26ca63={};_0x26ca63[_0x41c1d1]={'$like':'%'+_0x17e88f[_0xf481('0x3b')][_0xf481('0x47')]+'%'};return _0x26ca63;})});}_0xff43e=_['merge']({},_0xff43e,_0x17e88f[_0xf481('0x4a')]);return _0x21c2a0[_0xf481('0xa1')](_0xff43e);}})['then'](function(_0x264897){if(_0x264897){_0x2286d0=_0x264897['length'];if(!_0x17e88f[_0xf481('0x3b')]['hasOwnProperty'](_0xf481('0x42'))){_0xff43e[_0xf481('0x24')]=qs['limit'](_0x17e88f[_0xf481('0x3b')][_0xf481('0x24')]);_0xff43e[_0xf481('0x22')]=qs[_0xf481('0x22')](_0x17e88f[_0xf481('0x3b')][_0xf481('0x22')]);}return _0x21c2a0['getAgents'](_0xff43e);}})[_0xf481('0x2c')](function(_0x177752){if(_0x177752){return _0x177752?{'count':_0x2286d0,'rows':_0x177752}:null;}})[_0xf481('0x2c')](respondWithResult(_0x42123d,null))[_0xf481('0x4e')](handleError(_0x42123d,null));};function handleQuery(_0x14152d){logger[_0xf481('0xa3')](_0x14152d);return db['sequelize']['query'](_0x14152d)[_0xf481('0x9c')](function(_0x40f64a){csv_results[_0xf481('0x6a')](_0x40f64a);})[_0xf481('0x4e')](function(_0x3f444b){logger[_0xf481('0x5b')](_0x3f444b[_0xf481('0x6e')]);});} \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index f5d8c23..cac474c 100644 --- a/server/api/cmList/cmList.events.js +++ b/server/api/cmList/cmList.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe14b=['hasOwnProperty','hook','exports','events','../../mysqldb','save','update','emit'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xe14b,0x93));var _0xbe14=function(_0xb4bb28,_0x26ae09){_0xb4bb28=_0xb4bb28-0x0;var _0x49a874=_0xe14b[_0xb4bb28];return _0x49a874;};'use strict';var EventEmitter=require(_0xbe14('0x0'));var CmList=require(_0xbe14('0x1'))['db']['CmList'];var CmListEvents=new EventEmitter();CmListEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xbe14('0x2'),'afterUpdate':_0xbe14('0x3'),'afterDestroy':'remove'};function emitEvent(_0x7d3665){return function(_0x5ce8fb,_0x496c04,_0x1833e3){CmListEvents[_0xbe14('0x4')](_0x7d3665+':'+_0x5ce8fb['id'],_0x5ce8fb);CmListEvents[_0xbe14('0x4')](_0x7d3665,_0x5ce8fb);_0x1833e3(null);};}for(var e in events){if(events[_0xbe14('0x5')](e)){var event=events[e];CmList[_0xbe14('0x6')](e,emitEvent(event));}}module[_0xbe14('0x7')]=CmListEvents; \ No newline at end of file +var _0x814b=['update','emit','hook','exports','events','../../mysqldb','CmList','setMaxListeners','save'];(function(_0x339c23,_0x541ff6){var _0x5bf134=function(_0x46c91d){while(--_0x46c91d){_0x339c23['push'](_0x339c23['shift']());}};_0x5bf134(++_0x541ff6);}(_0x814b,0x1a2));var _0xb814=function(_0x5bd626,_0xdbf46d){_0x5bd626=_0x5bd626-0x0;var _0x2661ca=_0x814b[_0x5bd626];return _0x2661ca;};'use strict';var EventEmitter=require(_0xb814('0x0'));var CmList=require(_0xb814('0x1'))['db'][_0xb814('0x2')];var CmListEvents=new EventEmitter();CmListEvents[_0xb814('0x3')](0x0);var events={'afterCreate':_0xb814('0x4'),'afterUpdate':_0xb814('0x5'),'afterDestroy':'remove'};function emitEvent(_0x38c21a){return function(_0x3e1e9,_0x258866,_0x4237bc){CmListEvents[_0xb814('0x6')](_0x38c21a+':'+_0x3e1e9['id'],_0x3e1e9);CmListEvents[_0xb814('0x6')](_0x38c21a,_0x3e1e9);_0x4237bc(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];CmList[_0xb814('0x7')](e,emitEvent(event));}}module[_0xb814('0x8')]=CmListEvents; \ No newline at end of file diff --git a/server/api/cmList/cmList.model.js b/server/api/cmList/cmList.model.js index 78cda13..eb0ca28 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 _0x22fb=['define','CmList','../../config/logger','moment','bluebird','request-promise','path','rimraf','./cmList.attributes','exports'];(function(_0x4ba229,_0x3d7231){var _0x355980=function(_0x537a1e){while(--_0x537a1e){_0x4ba229['push'](_0x4ba229['shift']());}};_0x355980(++_0x3d7231);}(_0x22fb,0x192));var _0xb22f=function(_0x5b652e,_0x2ee5d8){_0x5b652e=_0x5b652e-0x0;var _0x583519=_0x22fb[_0x5b652e];return _0x583519;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xb22f('0x0'))('api');var moment=require(_0xb22f('0x1'));var BPromise=require(_0xb22f('0x2'));var rp=require(_0xb22f('0x3'));var fs=require('fs');var path=require(_0xb22f('0x4'));var rimraf=require(_0xb22f('0x5'));var config=require('../../config/environment');var attributes=require(_0xb22f('0x6'));module[_0xb22f('0x7')]=function(_0x2d1fb3,_0xc3ffcc){return _0x2d1fb3[_0xb22f('0x8')](_0xb22f('0x9'),attributes,{'tableName':'cm_lists','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3c81=['moment','../../config/environment','./cmList.attributes','exports','define','CmList','lodash','util','api'];(function(_0x4d7f56,_0x441449){var _0x386fb2=function(_0x439d47){while(--_0x439d47){_0x4d7f56['push'](_0x4d7f56['shift']());}};_0x386fb2(++_0x441449);}(_0x3c81,0x102));var _0x13c8=function(_0x2814d5,_0x5afdf0){_0x2814d5=_0x2814d5-0x0;var _0x39ce11=_0x3c81[_0x2814d5];return _0x39ce11;};'use strict';var _=require(_0x13c8('0x0'));var util=require(_0x13c8('0x1'));var logger=require('../../config/logger')(_0x13c8('0x2'));var moment=require(_0x13c8('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x13c8('0x4'));var attributes=require(_0x13c8('0x5'));module[_0x13c8('0x6')]=function(_0x1c16f1,_0x2a4d66){return _0x1c16f1[_0x13c8('0x7')](_0x13c8('0x8'),attributes,{'tableName':'cm_lists','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmList/cmList.rpc.js b/server/api/cmList/cmList.rpc.js index 110549b..a05a6cd 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 _0x2826=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./cmList.socket','register','request','info','CmList,\x20%s,\x20%s','request\x20sent','debug','CmList,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2826,0x99));var _0x6282=function(_0x59481b,_0x4c7624){_0x59481b=_0x59481b-0x0;var _0x55e559=_0x2826[_0x59481b];return _0x55e559;};'use strict';var _=require(_0x6282('0x0'));var util=require(_0x6282('0x1'));var moment=require(_0x6282('0x2'));var BPromise=require(_0x6282('0x3'));var rs=require(_0x6282('0x4'));var fs=require('fs');var Redis=require(_0x6282('0x5'));var db=require(_0x6282('0x6'))['db'];var utils=require(_0x6282('0x7'));var logger=require(_0x6282('0x8'))(_0x6282('0x9'));var config=require(_0x6282('0xa'));var jayson=require(_0x6282('0xb'));var client=jayson['client'][_0x6282('0xc')]({'port':0x232a});config[_0x6282('0xd')]=_[_0x6282('0xe')](config['redis'],{'host':_0x6282('0xf'),'port':0x18eb});var socket=require(_0x6282('0x10'))(new Redis(config[_0x6282('0xd')]));require(_0x6282('0x11'))[_0x6282('0x12')](socket);function respondWithRpcPromise(_0xb743f7,_0x211afe,_0x1142f8){return new BPromise(function(_0x404990,_0x4577a6){return client[_0x6282('0x13')](_0xb743f7,_0x1142f8)['then'](function(_0x2c69c6){logger[_0x6282('0x14')](_0x6282('0x15'),_0x211afe,_0x6282('0x16'));logger[_0x6282('0x17')](_0x6282('0x18'),_0x211afe,_0x6282('0x16'),JSON[_0x6282('0x19')](_0x2c69c6));if(_0x2c69c6[_0x6282('0x1a')]){if(_0x2c69c6[_0x6282('0x1a')][_0x6282('0x1b')]===0x1f4){logger[_0x6282('0x1a')]('CmList,\x20%s,\x20%s',_0x211afe,_0x2c69c6[_0x6282('0x1a')][_0x6282('0x1c')]);return _0x4577a6(_0x2c69c6[_0x6282('0x1a')]['message']);}logger[_0x6282('0x1a')](_0x6282('0x15'),_0x211afe,_0x2c69c6[_0x6282('0x1a')][_0x6282('0x1c')]);return _0x404990(_0x2c69c6['error'][_0x6282('0x1c')]);}else{logger[_0x6282('0x14')](_0x6282('0x15'),_0x211afe,_0x6282('0x16'));_0x404990(_0x2c69c6[_0x6282('0x1d')][_0x6282('0x1c')]);}})[_0x6282('0x1e')](function(_0x13b3e8){logger['error'](_0x6282('0x15'),_0x211afe,_0x13b3e8);_0x4577a6(_0x13b3e8);});});} \ No newline at end of file +var _0x1103=['socket.io-emitter','./cmList.socket','register','then','info','CmList,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost'];(function(_0x4292a6,_0x793564){var _0x2a1133=function(_0x212c6c){while(--_0x212c6c){_0x4292a6['push'](_0x4292a6['shift']());}};_0x2a1133(++_0x793564);}(_0x1103,0xf8));var _0x3110=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x1103[_0xa464c9];return _0x3d73c4;};'use strict';var _=require('lodash');var util=require(_0x3110('0x0'));var moment=require(_0x3110('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3110('0x2'))['db'];var utils=require(_0x3110('0x3'));var logger=require(_0x3110('0x4'))(_0x3110('0x5'));var config=require(_0x3110('0x6'));var jayson=require(_0x3110('0x7'));var client=jayson[_0x3110('0x8')][_0x3110('0x9')]({'port':0x232a});config[_0x3110('0xa')]=_['defaults'](config[_0x3110('0xa')],{'host':_0x3110('0xb'),'port':0x18eb});var socket=require(_0x3110('0xc'))(new Redis(config[_0x3110('0xa')]));require(_0x3110('0xd'))[_0x3110('0xe')](socket);function respondWithRpcPromise(_0x49d951,_0x161bd4,_0x24db9e){return new BPromise(function(_0x531678,_0x2d4e07){return client['request'](_0x49d951,_0x24db9e)[_0x3110('0xf')](function(_0x52c60c){logger[_0x3110('0x10')](_0x3110('0x11'),_0x161bd4,_0x3110('0x12'));logger[_0x3110('0x13')]('CmList,\x20%s,\x20%s,\x20%s',_0x161bd4,_0x3110('0x12'),JSON[_0x3110('0x14')](_0x52c60c));if(_0x52c60c[_0x3110('0x15')]){if(_0x52c60c[_0x3110('0x15')][_0x3110('0x16')]===0x1f4){logger[_0x3110('0x15')](_0x3110('0x11'),_0x161bd4,_0x52c60c['error'][_0x3110('0x17')]);return _0x2d4e07(_0x52c60c[_0x3110('0x15')][_0x3110('0x17')]);}logger[_0x3110('0x15')](_0x3110('0x11'),_0x161bd4,_0x52c60c[_0x3110('0x15')][_0x3110('0x17')]);return _0x531678(_0x52c60c['error']['message']);}else{logger[_0x3110('0x10')]('CmList,\x20%s,\x20%s',_0x161bd4,_0x3110('0x12'));_0x531678(_0x52c60c[_0x3110('0x18')][_0x3110('0x17')]);}})[_0x3110('0x19')](function(_0x414e87){logger[_0x3110('0x15')](_0x3110('0x11'),_0x161bd4,_0x414e87);_0x2d4e07(_0x414e87);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index 2be8891..666ca15 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 _0x9584=['register','length','cmList:','./cmList.events','save','remove','emit','removeListener'];(function(_0x3af681,_0x25f332){var _0x5d26b2=function(_0x4fefa1){while(--_0x4fefa1){_0x3af681['push'](_0x3af681['shift']());}};_0x5d26b2(++_0x25f332);}(_0x9584,0x1cb));var _0x4958=function(_0x12e24d,_0x480bfa){_0x12e24d=_0x12e24d-0x0;var _0x22a6cb=_0x9584[_0x12e24d];return _0x22a6cb;};'use strict';var CmListEvents=require(_0x4958('0x0'));var events=[_0x4958('0x1'),_0x4958('0x2'),'update'];function createListener(_0x3414c7,_0x46cafa){return function(_0x468bb8){_0x46cafa[_0x4958('0x3')](_0x3414c7,_0x468bb8);};}function removeListener(_0x5023cc,_0x5f36a0){return function(){CmListEvents[_0x4958('0x4')](_0x5023cc,_0x5f36a0);};}exports[_0x4958('0x5')]=function(_0x4c28ea){for(var _0x3749a0=0x0,_0x2a902c=events[_0x4958('0x6')];_0x3749a0<_0x2a902c;_0x3749a0++){var _0x3c32fb=events[_0x3749a0];var _0x55574e=createListener(_0x4958('0x7')+_0x3c32fb,_0x4c28ea);CmListEvents['on'](_0x3c32fb,_0x55574e);}}; \ No newline at end of file +var _0x1838=['emit','register','length','remove','update'];(function(_0xda464c,_0x26e47d){var _0x19e222=function(_0x1ec605){while(--_0x1ec605){_0xda464c['push'](_0xda464c['shift']());}};_0x19e222(++_0x26e47d);}(_0x1838,0xb7));var _0x8183=function(_0x43795b,_0x174d6c){_0x43795b=_0x43795b-0x0;var _0x2a0df7=_0x1838[_0x43795b];return _0x2a0df7;};'use strict';var CmListEvents=require('./cmList.events');var events=['save',_0x8183('0x0'),_0x8183('0x1')];function createListener(_0x4e6b59,_0xc4bdc6){return function(_0x3256e7){_0xc4bdc6[_0x8183('0x2')](_0x4e6b59,_0x3256e7);};}function removeListener(_0x423efe,_0x340f8c){return function(){CmListEvents['removeListener'](_0x423efe,_0x340f8c);};}exports[_0x8183('0x3')]=function(_0x1d55dc){for(var _0x4b6468=0x0,_0x37b38d=events[_0x8183('0x4')];_0x4b6468<_0x37b38d;_0x4b6468++){var _0x5aa06c=events[_0x4b6468];var _0x598c9a=createListener('cmList:'+_0x5aa06c,_0x1d55dc);CmListEvents['on'](_0x5aa06c,_0x598c9a);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index 497b340..05c33dc 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 _0x28c8=['/:id/fields','getCustomFields','/:id/users','getAgents','post','/:id/dispositions','addDisposition','addContacts','addCustomField','addAgents','put','update','removeDispositions','delete','removeAgents','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmList.controller','get','isAuthenticated','index','/describe','describe','/global_fields','getGlobalCustomFields','/:id','show','getDispositions','/:id/contacts','getContacts','/:id/contacts/csv','getContactsCsv'];(function(_0x357a01,_0x1e57d0){var _0x252c1f=function(_0x53c71f){while(--_0x53c71f){_0x357a01['push'](_0x357a01['shift']());}};_0x252c1f(++_0x1e57d0);}(_0x28c8,0x119));var _0x828c=function(_0x361d3f,_0x3be2aa){_0x361d3f=_0x361d3f-0x0;var _0x320229=_0x28c8[_0x361d3f];return _0x320229;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x828c('0x0'));var timeout=require(_0x828c('0x1'));var express=require(_0x828c('0x2'));var router=express[_0x828c('0x3')]();var fs_extra=require(_0x828c('0x4'));var auth=require(_0x828c('0x5'));var interaction=require(_0x828c('0x6'));var config=require(_0x828c('0x7'));var controller=require(_0x828c('0x8'));router[_0x828c('0x9')]('/',auth[_0x828c('0xa')](),controller[_0x828c('0xb')]);router[_0x828c('0x9')](_0x828c('0xc'),auth['isAuthenticated'](),controller[_0x828c('0xd')]);router[_0x828c('0x9')](_0x828c('0xe'),auth[_0x828c('0xa')](),controller[_0x828c('0xf')]);router['get'](_0x828c('0x10'),auth[_0x828c('0xa')](),controller[_0x828c('0x11')]);router[_0x828c('0x9')]('/:id/dispositions',auth[_0x828c('0xa')](),controller[_0x828c('0x12')]);router[_0x828c('0x9')](_0x828c('0x13'),auth[_0x828c('0xa')](),controller[_0x828c('0x14')]);router['get'](_0x828c('0x15'),auth[_0x828c('0xa')](),controller[_0x828c('0x16')]);router[_0x828c('0x9')](_0x828c('0x17'),auth['isAuthenticated'](),controller[_0x828c('0x18')]);router[_0x828c('0x9')](_0x828c('0x19'),auth[_0x828c('0xa')](),controller[_0x828c('0x1a')]);router[_0x828c('0x1b')]('/',auth[_0x828c('0xa')](),controller['create']);router[_0x828c('0x1b')](_0x828c('0x1c'),auth[_0x828c('0xa')](),controller[_0x828c('0x1d')]);router[_0x828c('0x1b')]('/:id/contacts',auth[_0x828c('0xa')](),controller[_0x828c('0x1e')]);router[_0x828c('0x1b')]('/:id/fields',auth[_0x828c('0xa')](),controller[_0x828c('0x1f')]);router['post']('/:id/users',auth['isAuthenticated'](),controller[_0x828c('0x20')]);router[_0x828c('0x21')]('/:id',auth[_0x828c('0xa')](),controller[_0x828c('0x22')]);router['delete']('/:id',auth[_0x828c('0xa')](),controller['destroy']);router['delete']('/:id/dispositions',auth['isAuthenticated'](),controller[_0x828c('0x23')]);router[_0x828c('0x24')](_0x828c('0x19'),auth[_0x828c('0xa')](),controller[_0x828c('0x25')]);module['exports']=router; \ No newline at end of file +var _0x8dd9=['post','create','addDisposition','addContacts','addAgents','put','/:id','update','delete','destroy','removeDispositions','removeAgents','exports','multer','util','path','express','Router','../../components/interaction/service','../../config/environment','./cmList.controller','isAuthenticated','index','get','/global_fields','show','/:id/dispositions','getDispositions','/:id/contacts','getContacts','/:id/contacts/csv','getContactsCsv','/:id/fields','getCustomFields','/:id/users'];(function(_0x1928c9,_0x13a6d1){var _0x51b5fb=function(_0x24cf70){while(--_0x24cf70){_0x1928c9['push'](_0x1928c9['shift']());}};_0x51b5fb(++_0x13a6d1);}(_0x8dd9,0x16b));var _0x98dd=function(_0xecad50,_0x463809){_0xecad50=_0xecad50-0x0;var _0x5cba84=_0x8dd9[_0xecad50];return _0x5cba84;};'use strict';var multer=require(_0x98dd('0x0'));var util=require(_0x98dd('0x1'));var path=require(_0x98dd('0x2'));var timeout=require('connect-timeout');var express=require(_0x98dd('0x3'));var router=express[_0x98dd('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x98dd('0x5'));var config=require(_0x98dd('0x6'));var controller=require(_0x98dd('0x7'));router['get']('/',auth[_0x98dd('0x8')](),controller[_0x98dd('0x9')]);router[_0x98dd('0xa')]('/describe',auth[_0x98dd('0x8')](),controller['describe']);router['get'](_0x98dd('0xb'),auth[_0x98dd('0x8')](),controller['getGlobalCustomFields']);router['get']('/:id',auth['isAuthenticated'](),controller[_0x98dd('0xc')]);router[_0x98dd('0xa')](_0x98dd('0xd'),auth[_0x98dd('0x8')](),controller[_0x98dd('0xe')]);router[_0x98dd('0xa')](_0x98dd('0xf'),auth[_0x98dd('0x8')](),controller[_0x98dd('0x10')]);router[_0x98dd('0xa')](_0x98dd('0x11'),auth[_0x98dd('0x8')](),controller[_0x98dd('0x12')]);router[_0x98dd('0xa')](_0x98dd('0x13'),auth['isAuthenticated'](),controller[_0x98dd('0x14')]);router[_0x98dd('0xa')](_0x98dd('0x15'),auth[_0x98dd('0x8')](),controller['getAgents']);router[_0x98dd('0x16')]('/',auth['isAuthenticated'](),controller[_0x98dd('0x17')]);router[_0x98dd('0x16')](_0x98dd('0xd'),auth['isAuthenticated'](),controller[_0x98dd('0x18')]);router[_0x98dd('0x16')](_0x98dd('0xf'),auth[_0x98dd('0x8')](),controller[_0x98dd('0x19')]);router[_0x98dd('0x16')](_0x98dd('0x13'),auth[_0x98dd('0x8')](),controller['addCustomField']);router['post'](_0x98dd('0x15'),auth[_0x98dd('0x8')](),controller[_0x98dd('0x1a')]);router[_0x98dd('0x1b')](_0x98dd('0x1c'),auth[_0x98dd('0x8')](),controller[_0x98dd('0x1d')]);router[_0x98dd('0x1e')](_0x98dd('0x1c'),auth[_0x98dd('0x8')](),controller[_0x98dd('0x1f')]);router['delete'](_0x98dd('0xd'),auth['isAuthenticated'](),controller[_0x98dd('0x20')]);router[_0x98dd('0x1e')]('/:id/users',auth[_0x98dd('0x8')](),controller[_0x98dd('0x21')]);module[_0x98dd('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 a1be92f..af00773 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 _0x3a00=['exports','VIRTUAL','getDataValue','field','STRING','sequelize'];(function(_0x390733,_0x1e3d32){var _0x33beb9=function(_0x4491a3){while(--_0x4491a3){_0x390733['push'](_0x390733['shift']());}};_0x33beb9(++_0x1e3d32);}(_0x3a00,0x17f));var _0x03a0=function(_0x29d94e,_0xf386d6){_0x29d94e=_0x29d94e-0x0;var _0x106237=_0x3a00[_0x29d94e];return _0x106237;};'use strict';var Sequelize=require(_0x03a0('0x0'));module[_0x03a0('0x1')]={'name':{'type':Sequelize[_0x03a0('0x2')],'get':function(_0x58dc4b){return this[_0x03a0('0x3')](_0x03a0('0x4'));}},'field':{'type':Sequelize[_0x03a0('0x5')],'allowNull':![]},'operator':{'type':Sequelize[_0x03a0('0x5')],'allowNull':![]},'value':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0x0da9=['STRING','sequelize','exports','getDataValue','field'];(function(_0x53d7eb,_0x5ca99a){var _0x2002de=function(_0x365b6c){while(--_0x365b6c){_0x53d7eb['push'](_0x53d7eb['shift']());}};_0x2002de(++_0x5ca99a);}(_0x0da9,0xfb));var _0x90da=function(_0x7ea9e0,_0x3e2a22){_0x7ea9e0=_0x7ea9e0-0x0;var _0x191073=_0x0da9[_0x7ea9e0];return _0x191073;};'use strict';var Sequelize=require(_0x90da('0x0'));module[_0x90da('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x228564){return this[_0x90da('0x2')](_0x90da('0x3'));}},'field':{'type':Sequelize[_0x90da('0x4')],'allowNull':![]},'operator':{'type':Sequelize[_0x90da('0x4')],'allowNull':![]},'value':{'type':Sequelize[_0x90da('0x4')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/condition/condition.controller.js b/server/api/condition/condition.controller.js index 60013b0..091caf1 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(_0x46b6fc,_0x2b7412){var _0x4c5cd3=function(_0x8dcfd8){while(--_0x8dcfd8){_0x46b6fc['push'](_0x46b6fc['shift']());}};_0x4c5cd3(++_0x2b7412);}(_0x7a54,0x106));var _0x47a5=function(_0x24de12,_0x56b68c){_0x24de12=_0x24de12-0x0;var _0x2747a5=_0x7a54[_0x24de12];return _0x2747a5;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x22')]=function(_0x136b14,_0x16631f){if(_0x136b14[_0x47a5('0x29')]['id']){delete _0x136b14[_0x47a5('0x29')]['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x136b14['params']['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x16631f,null))['then'](saveUpdates(_0x136b14[_0x47a5('0x29')],null))[_0x47a5('0x23')](respondWithResult(_0x16631f,null))[_0x47a5('0x2c')](handleError(_0x16631f,null));};exports['destroy']=function(_0x256650,_0x625952){return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x256650['params']['id']}})['then'](handleEntityNotFound(_0x625952,null))[_0x47a5('0x23')](removeEntity(_0x625952,null))[_0x47a5('0x2c')](handleError(_0x625952,null));}; \ No newline at end of file +var _0x9957=['eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','name','send','update','body','Condition','find','catch','params'];(function(_0x5f2dc4,_0x4c81a6){var _0x5b7333=function(_0x2ef0df){while(--_0x2ef0df){_0x5f2dc4['push'](_0x5f2dc4['shift']());}};_0x5b7333(++_0x4c81a6);}(_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){if(_0x4b6f99['body']['id']){delete _0x4b6f99[_0x7995('0x2c')]['id'];}return db[_0x7995('0x2d')][_0x7995('0x2e')]({'where':{'id':_0x4b6f99['params']['id']}})['then'](handleEntityNotFound(_0x9b2a15,null))['then'](saveUpdates(_0x4b6f99[_0x7995('0x2c')],null))[_0x7995('0x26')](respondWithResult(_0x9b2a15,null))[_0x7995('0x2f')](handleError(_0x9b2a15,null));};exports[_0x7995('0x27')]=function(_0x2e3493,_0x1ca460){return db['Condition']['find']({'where':{'id':_0x2e3493[_0x7995('0x30')]['id']}})['then'](handleEntityNotFound(_0x1ca460,null))[_0x7995('0x26')](removeEntity(_0x1ca460,null))[_0x7995('0x2f')](handleError(_0x1ca460,null));}; \ No newline at end of file diff --git a/server/api/condition/condition.model.js b/server/api/condition/condition.model.js index 42ff83e..1b502b2 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 _0x3a85=['bluebird','request-promise','path','rimraf','../../config/environment','./condition.attributes','exports','define','Condition','tools_conditions','util','api'];(function(_0x4694a0,_0x35b97f){var _0x38a2dc=function(_0x298039){while(--_0x298039){_0x4694a0['push'](_0x4694a0['shift']());}};_0x38a2dc(++_0x35b97f);}(_0x3a85,0x6a));var _0x53a8=function(_0x3767e7,_0x24ffc5){_0x3767e7=_0x3767e7-0x0;var _0x5742a4=_0x3a85[_0x3767e7];return _0x5742a4;};'use strict';var _=require('lodash');var util=require(_0x53a8('0x0'));var logger=require('../../config/logger')(_0x53a8('0x1'));var moment=require('moment');var BPromise=require(_0x53a8('0x2'));var rp=require(_0x53a8('0x3'));var fs=require('fs');var path=require(_0x53a8('0x4'));var rimraf=require(_0x53a8('0x5'));var config=require(_0x53a8('0x6'));var attributes=require(_0x53a8('0x7'));module[_0x53a8('0x8')]=function(_0x38ae94,_0x176388){return _0x38ae94[_0x53a8('0x9')](_0x53a8('0xa'),attributes,{'tableName':_0x53a8('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3ed0=['../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./condition.attributes','exports','define','Condition','lodash','util'];(function(_0x451492,_0x6272fb){var _0x163af3=function(_0x37be32){while(--_0x37be32){_0x451492['push'](_0x451492['shift']());}};_0x163af3(++_0x6272fb);}(_0x3ed0,0x136));var _0x03ed=function(_0x3d2e4b,_0x1f6653){_0x3d2e4b=_0x3d2e4b-0x0;var _0x509e78=_0x3ed0[_0x3d2e4b];return _0x509e78;};'use strict';var _=require(_0x03ed('0x0'));var util=require(_0x03ed('0x1'));var logger=require(_0x03ed('0x2'))('api');var moment=require(_0x03ed('0x3'));var BPromise=require(_0x03ed('0x4'));var rp=require(_0x03ed('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x03ed('0x6'));var config=require(_0x03ed('0x7'));var attributes=require(_0x03ed('0x8'));module[_0x03ed('0x9')]=function(_0x315caf,_0x1fcae9){return _0x315caf[_0x03ed('0xa')](_0x03ed('0xb'),attributes,{'tableName':'tools_conditions','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 65c19ee..1e1a14d 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 _0x978f=['debug','Condition,\x20%s,\x20%s,\x20%s','stringify','error','code','Condition,\x20%s,\x20%s','message','lodash','util','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','request\x20sent'];(function(_0x44c81f,_0xdb5984){var _0x1d7083=function(_0xf374b8){while(--_0xf374b8){_0x44c81f['push'](_0x44c81f['shift']());}};_0x1d7083(++_0xdb5984);}(_0x978f,0x147));var _0xf978=function(_0x1b0565,_0x318694){_0x1b0565=_0x1b0565-0x0;var _0xa87ea7=_0x978f[_0x1b0565];return _0xa87ea7;};'use strict';var _=require(_0xf978('0x0'));var util=require(_0xf978('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xf978('0x2'));var fs=require('fs');var Redis=require(_0xf978('0x3'));var db=require(_0xf978('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xf978('0x5'))(_0xf978('0x6'));var config=require(_0xf978('0x7'));var jayson=require(_0xf978('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3fc016,_0xd2299b,_0x375dbb){return new BPromise(function(_0xac1ca9,_0x2534de){return client[_0xf978('0x9')](_0x3fc016,_0x375dbb)[_0xf978('0xa')](function(_0x4ce8b0){logger[_0xf978('0xb')]('Condition,\x20%s,\x20%s',_0xd2299b,_0xf978('0xc'));logger[_0xf978('0xd')](_0xf978('0xe'),_0xd2299b,_0xf978('0xc'),JSON[_0xf978('0xf')](_0x4ce8b0));if(_0x4ce8b0[_0xf978('0x10')]){if(_0x4ce8b0[_0xf978('0x10')][_0xf978('0x11')]===0x1f4){logger[_0xf978('0x10')](_0xf978('0x12'),_0xd2299b,_0x4ce8b0[_0xf978('0x10')][_0xf978('0x13')]);return _0x2534de(_0x4ce8b0['error']['message']);}logger[_0xf978('0x10')]('Condition,\x20%s,\x20%s',_0xd2299b,_0x4ce8b0[_0xf978('0x10')][_0xf978('0x13')]);return _0xac1ca9(_0x4ce8b0['error'][_0xf978('0x13')]);}else{logger['info']('Condition,\x20%s,\x20%s',_0xd2299b,_0xf978('0xc'));_0xac1ca9(_0x4ce8b0['result'][_0xf978('0x13')]);}})['catch'](function(_0x4f9d52){logger[_0xf978('0x10')](_0xf978('0x12'),_0xd2299b,_0x4f9d52);_0x2534de(_0x4f9d52);});});} \ No newline at end of file +var _0x7d38=['debug','Condition,\x20%s,\x20%s,\x20%s','error','message','Condition,\x20%s,\x20%s','result','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','info','request\x20sent'];(function(_0x23463d,_0x2606e5){var _0x576a24=function(_0x3809fe){while(--_0x3809fe){_0x23463d['push'](_0x23463d['shift']());}};_0x576a24(++_0x2606e5);}(_0x7d38,0x8b));var _0x87d3=function(_0x2e6b0f,_0x1ff96d){_0x2e6b0f=_0x2e6b0f-0x0;var _0x49d011=_0x7d38[_0x2e6b0f];return _0x49d011;};'use strict';var _=require(_0x87d3('0x0'));var util=require(_0x87d3('0x1'));var moment=require(_0x87d3('0x2'));var BPromise=require(_0x87d3('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x87d3('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x87d3('0x5'));var logger=require(_0x87d3('0x6'))(_0x87d3('0x7'));var config=require('../../config/environment');var jayson=require(_0x87d3('0x8'));var client=jayson['client'][_0x87d3('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x19b185,_0x6eb5fa,_0x55e73b){return new BPromise(function(_0x4b45c8,_0x160174){return client[_0x87d3('0xa')](_0x19b185,_0x55e73b)['then'](function(_0x50f82d){logger[_0x87d3('0xb')]('Condition,\x20%s,\x20%s',_0x6eb5fa,_0x87d3('0xc'));logger[_0x87d3('0xd')](_0x87d3('0xe'),_0x6eb5fa,_0x87d3('0xc'),JSON['stringify'](_0x50f82d));if(_0x50f82d[_0x87d3('0xf')]){if(_0x50f82d['error']['code']===0x1f4){logger[_0x87d3('0xf')]('Condition,\x20%s,\x20%s',_0x6eb5fa,_0x50f82d[_0x87d3('0xf')][_0x87d3('0x10')]);return _0x160174(_0x50f82d[_0x87d3('0xf')]['message']);}logger[_0x87d3('0xf')](_0x87d3('0x11'),_0x6eb5fa,_0x50f82d['error'][_0x87d3('0x10')]);return _0x4b45c8(_0x50f82d['error']['message']);}else{logger[_0x87d3('0xb')](_0x87d3('0x11'),_0x6eb5fa,_0x87d3('0xc'));_0x4b45c8(_0x50f82d[_0x87d3('0x12')][_0x87d3('0x10')]);}})['catch'](function(_0x417f52){logger['error']('Condition,\x20%s,\x20%s',_0x6eb5fa,_0x417f52);_0x160174(_0x417f52);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index f1b149f..be46963 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 _0x6a7a=['delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./condition.controller','isAuthenticated','update'];(function(_0x1eac8a,_0x2ac819){var _0xab067b=function(_0x1ca27f){while(--_0x1ca27f){_0x1eac8a['push'](_0x1eac8a['shift']());}};_0xab067b(++_0x2ac819);}(_0x6a7a,0xb9));var _0xa6a7=function(_0x9c36e9,_0x5154e6){_0x9c36e9=_0x9c36e9-0x0;var _0x5a393f=_0x6a7a[_0x9c36e9];return _0x5a393f;};'use strict';var multer=require('multer');var util=require(_0xa6a7('0x0'));var path=require(_0xa6a7('0x1'));var timeout=require(_0xa6a7('0x2'));var express=require(_0xa6a7('0x3'));var router=express[_0xa6a7('0x4')]();var fs_extra=require(_0xa6a7('0x5'));var auth=require(_0xa6a7('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xa6a7('0x7'));router['put']('/:id',auth[_0xa6a7('0x8')](),controller[_0xa6a7('0x9')]);router[_0xa6a7('0xa')]('/:id',auth[_0xa6a7('0x8')](),controller[_0xa6a7('0xb')]);module[_0xa6a7('0xc')]=router; \ No newline at end of file +var _0xcd12=['util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./condition.controller','put','isAuthenticated','update','delete','/:id','destroy','exports'];(function(_0x34325b,_0x5e5afe){var _0x3da348=function(_0x3bf709){while(--_0x3bf709){_0x34325b['push'](_0x34325b['shift']());}};_0x3da348(++_0x5e5afe);}(_0xcd12,0x150));var _0x2cd1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcd12[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0x2cd1('0x0'));var path=require('path');var timeout=require(_0x2cd1('0x1'));var express=require(_0x2cd1('0x2'));var router=express[_0x2cd1('0x3')]();var fs_extra=require(_0x2cd1('0x4'));var auth=require(_0x2cd1('0x5'));var interaction=require(_0x2cd1('0x6'));var config=require(_0x2cd1('0x7'));var controller=require(_0x2cd1('0x8'));router[_0x2cd1('0x9')]('/:id',auth[_0x2cd1('0xa')](),controller[_0x2cd1('0xb')]);router[_0x2cd1('0xc')](_0x2cd1('0xd'),auth[_0x2cd1('0xa')](),controller[_0x2cd1('0xe')]);module[_0x2cd1('0xf')]=router; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.attributes.js b/server/api/contactItemType/contactItemType.attributes.js index 5fe8c82..9e993fe 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 _0xc8d6=['exports','STRING'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xc8d6,0x18a));var _0x6c8d=function(_0x55b2ac,_0x5f5628){_0x55b2ac=_0x55b2ac-0x0;var _0x4303d8=_0xc8d6[_0x55b2ac];return _0x4303d8;};'use strict';var Sequelize=require('sequelize');module[_0x6c8d('0x0')]={'name':{'type':Sequelize[_0x6c8d('0x1')],'allowNull':![],'unique':'name'},'OrderBy':{'type':Sequelize['INTEGER'],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file +var _0x6149=['sequelize','exports','STRING','name','INTEGER'];(function(_0x1b89ba,_0x550bed){var _0x1b14b8=function(_0x354465){while(--_0x354465){_0x1b89ba['push'](_0x1b89ba['shift']());}};_0x1b14b8(++_0x550bed);}(_0x6149,0xaa));var _0x9614=function(_0x4d24f5,_0x2b0651){_0x4d24f5=_0x4d24f5-0x0;var _0x517ae3=_0x6149[_0x4d24f5];return _0x517ae3;};'use strict';var Sequelize=require(_0x9614('0x0'));module[_0x9614('0x1')]={'name':{'type':Sequelize[_0x9614('0x2')],'allowNull':![],'unique':_0x9614('0x3')},'OrderBy':{'type':Sequelize[_0x9614('0x4')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0x9614('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 5afc8fb..76693c1 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 _0x6d11=['intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','role','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','apply','reject','then','destroy','get','ContactItemTypes','UserProfileResource','error','stack','name','send','index','map','ContactItemType','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes'];(function(_0x2c8de4,_0x48ecd7){var _0xa5f1d5=function(_0x521b2a){while(--_0x521b2a){_0x2c8de4['push'](_0x2c8de4['shift']());}};_0xa5f1d5(++_0x48ecd7);}(_0x6d11,0xbf));var _0x16d1=function(_0x3270fd,_0x404d6f){_0x3270fd=_0x3270fd-0x0;var _0x4ccb51=_0x6d11[_0x3270fd];return _0x4ccb51;};'use strict';var emlformat=require(_0x16d1('0x0'));var rimraf=require(_0x16d1('0x1'));var zipdir=require(_0x16d1('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x16d1('0x3'));var moment=require('moment');var BPromise=require(_0x16d1('0x4'));var Mustache=require(_0x16d1('0x5'));var util=require('util');var path=require('path');var sox=require(_0x16d1('0x6'));var csv=require(_0x16d1('0x7'));var ejs=require(_0x16d1('0x8'));var fs=require('fs');var fs_extra=require(_0x16d1('0x9'));var _=require(_0x16d1('0xa'));var squel=require(_0x16d1('0xb'));var crypto=require(_0x16d1('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x16d1('0xd'));var Papa=require(_0x16d1('0xe'));var Redis=require(_0x16d1('0xf'));var authService=require(_0x16d1('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x16d1('0x11'));var hardwareService=require(_0x16d1('0x12'));var logger=require(_0x16d1('0x13'))(_0x16d1('0x14'));var utils=require(_0x16d1('0x15'));var config=require(_0x16d1('0x16'));var licenseUtil=require(_0x16d1('0x17'));var db=require(_0x16d1('0x18'))['db'];function respondWithStatusCode(_0x4de260,_0x32fa68){_0x32fa68=_0x32fa68||0xcc;return function(_0x2e71fa){if(_0x2e71fa){return _0x4de260[_0x16d1('0x19')](_0x32fa68);}return _0x4de260[_0x16d1('0x1a')](_0x32fa68)[_0x16d1('0x1b')]();};}function respondWithResult(_0x5a1429,_0xc034b7){_0xc034b7=_0xc034b7||0xc8;return function(_0x1b71d3){if(_0x1b71d3){return _0x5a1429[_0x16d1('0x1a')](_0xc034b7)[_0x16d1('0x1c')](_0x1b71d3);}};}function respondWithFilteredResult(_0x29ebba,_0x173e16){return function(_0x2d7e8a){if(_0x2d7e8a){var _0x4ee46c=typeof _0x173e16[_0x16d1('0x1d')]===_0x16d1('0x1e')&&typeof _0x173e16['limit']==='undefined';var _0x1a9ec8=_0x2d7e8a['count'];var _0x46a25e=_0x4ee46c?0x0:_0x173e16['offset'];var _0x1da1b8=_0x4ee46c?_0x2d7e8a['count']:_0x173e16[_0x16d1('0x1d')]+_0x173e16[_0x16d1('0x1f')];var _0x48cd70;if(_0x1da1b8>=_0x1a9ec8){_0x1da1b8=_0x1a9ec8;_0x48cd70=0xc8;}else{_0x48cd70=0xce;}_0x29ebba['status'](_0x48cd70);return _0x29ebba['set']('Content-Range',_0x46a25e+'-'+_0x1da1b8+'/'+_0x1a9ec8)[_0x16d1('0x1c')](_0x2d7e8a);}return null;};}function patchUpdates(_0x55a0e0){return function(_0x34b88f){try{jsonpatch[_0x16d1('0x20')](_0x34b88f,_0x55a0e0,!![]);}catch(_0x1f6add){return BPromise[_0x16d1('0x21')](_0x1f6add);}return _0x34b88f['save']();};}function saveUpdates(_0x2c7825,_0x58a03b){return function(_0x2a897d){if(_0x2a897d){return _0x2a897d['update'](_0x2c7825)[_0x16d1('0x22')](function(_0x8c7266){return _0x8c7266;});}return null;};}function removeEntity(_0x17e038,_0x47cad4){return function(_0x215c23){if(_0x215c23){return _0x215c23[_0x16d1('0x23')]()[_0x16d1('0x22')](function(){var _0x21e122=_0x215c23[_0x16d1('0x24')]({'plain':!![]});var _0x335c24=_0x16d1('0x25');return db[_0x16d1('0x26')][_0x16d1('0x23')]({'where':{'type':_0x335c24,'resourceId':_0x21e122['id']}})[_0x16d1('0x22')](function(){return _0x215c23;});})[_0x16d1('0x22')](function(){_0x17e038[_0x16d1('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x25ae4e,_0x440a47){return function(_0x4257f1){if(!_0x4257f1){_0x25ae4e['sendStatus'](0x194);}return _0x4257f1;};}function handleError(_0x28837c,_0x1deb1e){_0x1deb1e=_0x1deb1e||0x1f4;return function(_0x364bf7){logger[_0x16d1('0x27')](_0x364bf7[_0x16d1('0x28')]);if(_0x364bf7[_0x16d1('0x29')]){delete _0x364bf7[_0x16d1('0x29')];}_0x28837c['status'](_0x1deb1e)[_0x16d1('0x2a')](_0x364bf7);};}exports[_0x16d1('0x2b')]=function(_0x31c4e9,_0x30cd8f){var _0x55c021={},_0x4b27f6={},_0x2f16ee={'count':0x0,'rows':[]};var _0x4ab3d4=_[_0x16d1('0x2c')](db[_0x16d1('0x2d')][_0x16d1('0x2e')],function(_0x2b4dbd){return{'name':_0x2b4dbd[_0x16d1('0x2f')],'type':_0x2b4dbd[_0x16d1('0x30')][_0x16d1('0x31')]};});_0x4b27f6[_0x16d1('0x32')]=_[_0x16d1('0x2c')](_0x4ab3d4,_0x16d1('0x29'));_0x4b27f6[_0x16d1('0x33')]=_[_0x16d1('0x34')](_0x31c4e9['query']);_0x4b27f6[_0x16d1('0x35')]=_['intersection'](_0x4b27f6[_0x16d1('0x32')],_0x4b27f6[_0x16d1('0x33')]);_0x55c021[_0x16d1('0x36')]=_[_0x16d1('0x37')](_0x4b27f6[_0x16d1('0x32')],qs[_0x16d1('0x38')](_0x31c4e9['query']['fields']));_0x55c021['attributes']=_0x55c021[_0x16d1('0x36')][_0x16d1('0x39')]?_0x55c021[_0x16d1('0x36')]:_0x4b27f6[_0x16d1('0x32')];if(!_0x31c4e9['query'][_0x16d1('0x3a')](_0x16d1('0x3b'))){_0x55c021['limit']=qs['limit'](_0x31c4e9['query'][_0x16d1('0x1f')]);_0x55c021[_0x16d1('0x1d')]=qs[_0x16d1('0x1d')](_0x31c4e9['query'][_0x16d1('0x1d')]);}_0x55c021[_0x16d1('0x3c')]=qs[_0x16d1('0x3d')](_0x31c4e9[_0x16d1('0x33')][_0x16d1('0x3d')]);_0x55c021[_0x16d1('0x3e')]=qs[_0x16d1('0x35')](_['pick'](_0x31c4e9['query'],_0x4b27f6['filters']),_0x4ab3d4);if(_0x31c4e9[_0x16d1('0x33')][_0x16d1('0x3f')]){_0x55c021[_0x16d1('0x3e')]=_[_0x16d1('0x40')](_0x55c021[_0x16d1('0x3e')],{'$or':_[_0x16d1('0x2c')](_0x4ab3d4,function(_0x364c39){if(_0x364c39[_0x16d1('0x30')]!=='VIRTUAL'){var _0x180f55={};_0x180f55[_0x364c39['name']]={'$like':'%'+_0x31c4e9['query'][_0x16d1('0x3f')]+'%'};return _0x180f55;}})});}_0x55c021=_[_0x16d1('0x40')]({},_0x55c021,_0x31c4e9[_0x16d1('0x41')]);var _0x3a0343={'where':_0x55c021[_0x16d1('0x3e')]};return db[_0x16d1('0x2d')]['count'](_0x3a0343)[_0x16d1('0x22')](function(_0x525212){_0x2f16ee['count']=_0x525212;if(_0x31c4e9['query']['includeAll']){_0x55c021[_0x16d1('0x42')]=[{'all':!![]}];}return db[_0x16d1('0x2d')][_0x16d1('0x43')](_0x55c021);})[_0x16d1('0x22')](function(_0x53de06){_0x2f16ee[_0x16d1('0x44')]=_0x53de06;return _0x2f16ee;})['then'](respondWithFilteredResult(_0x30cd8f,_0x55c021))[_0x16d1('0x45')](handleError(_0x30cd8f,null));};exports[_0x16d1('0x46')]=function(_0x19ac7c,_0x2e4971){var _0x1a109d={'raw':!![],'where':{'id':_0x19ac7c[_0x16d1('0x47')]['id']}},_0x116f51={};_0x116f51[_0x16d1('0x32')]=_[_0x16d1('0x34')](db[_0x16d1('0x2d')][_0x16d1('0x2e')]);_0x116f51[_0x16d1('0x33')]=_[_0x16d1('0x34')](_0x19ac7c[_0x16d1('0x33')]);_0x116f51[_0x16d1('0x35')]=_['intersection'](_0x116f51['model'],_0x116f51[_0x16d1('0x33')]);_0x1a109d[_0x16d1('0x36')]=_[_0x16d1('0x37')](_0x116f51[_0x16d1('0x32')],qs[_0x16d1('0x38')](_0x19ac7c[_0x16d1('0x33')]['fields']));_0x1a109d[_0x16d1('0x36')]=_0x1a109d[_0x16d1('0x36')][_0x16d1('0x39')]?_0x1a109d['attributes']:_0x116f51['model'];if(_0x19ac7c[_0x16d1('0x33')][_0x16d1('0x48')]){_0x1a109d['include']=[{'all':!![]}];}_0x1a109d=_[_0x16d1('0x40')]({},_0x1a109d,_0x19ac7c['options']);return db[_0x16d1('0x2d')][_0x16d1('0x49')](_0x1a109d)[_0x16d1('0x22')](handleEntityNotFound(_0x2e4971,null))[_0x16d1('0x22')](respondWithResult(_0x2e4971,null))['catch'](handleError(_0x2e4971,null));};exports['create']=function(_0x1d92cd,_0x8bb0c1){return db['ContactItemType'][_0x16d1('0x4a')](_0x1d92cd[_0x16d1('0x4b')],{})[_0x16d1('0x22')](function(_0x117da5){var _0x3b77db=_0x1d92cd['user'][_0x16d1('0x24')]({'plain':!![]});if(!_0x3b77db)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3b77db[_0x16d1('0x4c')]===_0x16d1('0x4d')){var _0x5d384c=_0x117da5[_0x16d1('0x24')]({'plain':!![]});var _0xd3a7f8=_0x16d1('0x25');return db[_0x16d1('0x4e')]['find']({'where':{'name':_0xd3a7f8,'userProfileId':_0x3b77db['userProfileId']},'raw':!![]})['then'](function(_0x34e266){if(_0x34e266&&_0x34e266[_0x16d1('0x4f')]===0x0){return db[_0x16d1('0x26')][_0x16d1('0x4a')]({'name':_0x5d384c['name'],'resourceId':_0x5d384c['id'],'type':_0x34e266[_0x16d1('0x29')],'sectionId':_0x34e266['id']},{})[_0x16d1('0x22')](function(){return _0x117da5;});}else{return _0x117da5;}})['catch'](function(_0x1e1bbc){logger[_0x16d1('0x27')](_0x16d1('0x50'),_0x1e1bbc);throw _0x1e1bbc;});}return _0x117da5;})[_0x16d1('0x22')](respondWithResult(_0x8bb0c1,0xc9))['catch'](handleError(_0x8bb0c1,null));};exports[_0x16d1('0x51')]=function(_0x2b0aa7,_0xb9fb43){if(_0x2b0aa7['body']['id']){delete _0x2b0aa7['body']['id'];}return db[_0x16d1('0x2d')][_0x16d1('0x49')]({'where':{'id':_0x2b0aa7['params']['id']}})[_0x16d1('0x22')](handleEntityNotFound(_0xb9fb43,null))[_0x16d1('0x22')](saveUpdates(_0x2b0aa7[_0x16d1('0x4b')],null))['then'](respondWithResult(_0xb9fb43,null))[_0x16d1('0x45')](handleError(_0xb9fb43,null));};exports[_0x16d1('0x23')]=function(_0x11209f,_0x4b3079){return db[_0x16d1('0x2d')][_0x16d1('0x49')]({'where':{'id':_0x11209f['params']['id']}})[_0x16d1('0x22')](handleEntityNotFound(_0x4b3079,null))[_0x16d1('0x22')](db['CmContactHasItem'][_0x16d1('0x51')]({'ItemTypeId':null},{'where':{'ItemTypeId':_0x11209f[_0x16d1('0x47')]['id']}}))[_0x16d1('0x22')](removeEntity(_0x4b3079,null))[_0x16d1('0x45')](handleError(_0x4b3079,null));}; \ No newline at end of file +var _0xe511=['save','update','then','get','ContactItemTypes','error','name','send','map','ContactItemType','rawAttributes','fieldName','type','key','query','keys','intersection','attributes','fields','length','model','hasOwnProperty','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','find','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','UserProfileResource','create','catch','body','destroy','CmContactHasItem','eml-format','rimraf','fast-json-patch','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','count','set','Content-Range'];(function(_0x52acb,_0x19c7c1){var _0x3c4226=function(_0x317772){while(--_0x317772){_0x52acb['push'](_0x52acb['shift']());}};_0x3c4226(++_0x19c7c1);}(_0xe511,0x16f));var _0x1e51=function(_0x3cb300,_0x4d7a99){_0x3cb300=_0x3cb300-0x0;var _0x3e0cd9=_0xe511[_0x3cb300];return _0x3e0cd9;};'use strict';var emlformat=require(_0x1e51('0x0'));var rimraf=require(_0x1e51('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1e51('0x2'));var rp=require('request-promise');var moment=require(_0x1e51('0x3'));var BPromise=require(_0x1e51('0x4'));var Mustache=require('mustache');var util=require(_0x1e51('0x5'));var path=require(_0x1e51('0x6'));var sox=require(_0x1e51('0x7'));var csv=require(_0x1e51('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1e51('0x9'));var _=require(_0x1e51('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x1e51('0xb'));var deskjs=require(_0x1e51('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x1e51('0xd'));var Redis=require(_0x1e51('0xe'));var authService=require(_0x1e51('0xf'));var qs=require(_0x1e51('0x10'));var as=require(_0x1e51('0x11'));var hardwareService=require(_0x1e51('0x12'));var logger=require('../../config/logger')(_0x1e51('0x13'));var utils=require(_0x1e51('0x14'));var config=require(_0x1e51('0x15'));var licenseUtil=require(_0x1e51('0x16'));var db=require(_0x1e51('0x17'))['db'];function respondWithStatusCode(_0x3c5330,_0x5544eb){_0x5544eb=_0x5544eb||0xcc;return function(_0x408a77){if(_0x408a77){return _0x3c5330[_0x1e51('0x18')](_0x5544eb);}return _0x3c5330[_0x1e51('0x19')](_0x5544eb)[_0x1e51('0x1a')]();};}function respondWithResult(_0x21bcbd,_0x32945d){_0x32945d=_0x32945d||0xc8;return function(_0x441c70){if(_0x441c70){return _0x21bcbd[_0x1e51('0x19')](_0x32945d)[_0x1e51('0x1b')](_0x441c70);}};}function respondWithFilteredResult(_0xd76fba,_0x5a5c07){return function(_0x3b01b7){if(_0x3b01b7){var _0x24db4f=typeof _0x5a5c07[_0x1e51('0x1c')]==='undefined'&&typeof _0x5a5c07[_0x1e51('0x1d')]==='undefined';var _0x53d222=_0x3b01b7[_0x1e51('0x1e')];var _0x27dcad=_0x24db4f?0x0:_0x5a5c07[_0x1e51('0x1c')];var _0x4785a5=_0x24db4f?_0x3b01b7[_0x1e51('0x1e')]:_0x5a5c07[_0x1e51('0x1c')]+_0x5a5c07['limit'];var _0x39449b;if(_0x4785a5>=_0x53d222){_0x4785a5=_0x53d222;_0x39449b=0xc8;}else{_0x39449b=0xce;}_0xd76fba['status'](_0x39449b);return _0xd76fba[_0x1e51('0x1f')](_0x1e51('0x20'),_0x27dcad+'-'+_0x4785a5+'/'+_0x53d222)[_0x1e51('0x1b')](_0x3b01b7);}return null;};}function patchUpdates(_0x183a95){return function(_0x506f40){try{jsonpatch['apply'](_0x506f40,_0x183a95,!![]);}catch(_0x4e6a49){return BPromise['reject'](_0x4e6a49);}return _0x506f40[_0x1e51('0x21')]();};}function saveUpdates(_0x4f1f56,_0x3f7340){return function(_0x28aacb){if(_0x28aacb){return _0x28aacb[_0x1e51('0x22')](_0x4f1f56)[_0x1e51('0x23')](function(_0x23c85a){return _0x23c85a;});}return null;};}function removeEntity(_0xf9298,_0x270adf){return function(_0x461d3d){if(_0x461d3d){return _0x461d3d['destroy']()['then'](function(){var _0x43f5c5=_0x461d3d[_0x1e51('0x24')]({'plain':!![]});var _0x2e42b1=_0x1e51('0x25');return db['UserProfileResource']['destroy']({'where':{'type':_0x2e42b1,'resourceId':_0x43f5c5['id']}})['then'](function(){return _0x461d3d;});})[_0x1e51('0x23')](function(){_0xf9298[_0x1e51('0x19')](0xcc)[_0x1e51('0x1a')]();});}};}function handleEntityNotFound(_0x5412bc,_0x1e7a96){return function(_0x49c507){if(!_0x49c507){_0x5412bc['sendStatus'](0x194);}return _0x49c507;};}function handleError(_0x3349f0,_0x5c5bbd){_0x5c5bbd=_0x5c5bbd||0x1f4;return function(_0x170ec6){logger[_0x1e51('0x26')](_0x170ec6['stack']);if(_0x170ec6[_0x1e51('0x27')]){delete _0x170ec6[_0x1e51('0x27')];}_0x3349f0[_0x1e51('0x19')](_0x5c5bbd)[_0x1e51('0x28')](_0x170ec6);};}exports['index']=function(_0x4cf046,_0x4f67d3){var _0x20eb9b={},_0x288b50={},_0x1ba84a={'count':0x0,'rows':[]};var _0x36dabe=_[_0x1e51('0x29')](db[_0x1e51('0x2a')][_0x1e51('0x2b')],function(_0x34701c){return{'name':_0x34701c[_0x1e51('0x2c')],'type':_0x34701c[_0x1e51('0x2d')][_0x1e51('0x2e')]};});_0x288b50['model']=_[_0x1e51('0x29')](_0x36dabe,_0x1e51('0x27'));_0x288b50[_0x1e51('0x2f')]=_[_0x1e51('0x30')](_0x4cf046[_0x1e51('0x2f')]);_0x288b50['filters']=_[_0x1e51('0x31')](_0x288b50['model'],_0x288b50[_0x1e51('0x2f')]);_0x20eb9b[_0x1e51('0x32')]=_[_0x1e51('0x31')](_0x288b50['model'],qs[_0x1e51('0x33')](_0x4cf046['query'][_0x1e51('0x33')]));_0x20eb9b['attributes']=_0x20eb9b['attributes'][_0x1e51('0x34')]?_0x20eb9b[_0x1e51('0x32')]:_0x288b50[_0x1e51('0x35')];if(!_0x4cf046['query'][_0x1e51('0x36')]('nolimit')){_0x20eb9b[_0x1e51('0x1d')]=qs[_0x1e51('0x1d')](_0x4cf046['query'][_0x1e51('0x1d')]);_0x20eb9b[_0x1e51('0x1c')]=qs[_0x1e51('0x1c')](_0x4cf046[_0x1e51('0x2f')][_0x1e51('0x1c')]);}_0x20eb9b[_0x1e51('0x37')]=qs['sort'](_0x4cf046['query'][_0x1e51('0x38')]);_0x20eb9b['where']=qs[_0x1e51('0x39')](_[_0x1e51('0x3a')](_0x4cf046[_0x1e51('0x2f')],_0x288b50[_0x1e51('0x39')]),_0x36dabe);if(_0x4cf046[_0x1e51('0x2f')][_0x1e51('0x3b')]){_0x20eb9b[_0x1e51('0x3c')]=_[_0x1e51('0x3d')](_0x20eb9b[_0x1e51('0x3c')],{'$or':_[_0x1e51('0x29')](_0x36dabe,function(_0x45d5fe){if(_0x45d5fe['type']!==_0x1e51('0x3e')){var _0x5818be={};_0x5818be[_0x45d5fe[_0x1e51('0x27')]]={'$like':'%'+_0x4cf046[_0x1e51('0x2f')][_0x1e51('0x3b')]+'%'};return _0x5818be;}})});}_0x20eb9b=_[_0x1e51('0x3d')]({},_0x20eb9b,_0x4cf046[_0x1e51('0x3f')]);var _0x2f8fd9={'where':_0x20eb9b[_0x1e51('0x3c')]};return db[_0x1e51('0x2a')][_0x1e51('0x1e')](_0x2f8fd9)[_0x1e51('0x23')](function(_0xc40fce){_0x1ba84a['count']=_0xc40fce;if(_0x4cf046['query'][_0x1e51('0x40')]){_0x20eb9b[_0x1e51('0x41')]=[{'all':!![]}];}return db[_0x1e51('0x2a')][_0x1e51('0x42')](_0x20eb9b);})[_0x1e51('0x23')](function(_0x1a9e0d){_0x1ba84a[_0x1e51('0x43')]=_0x1a9e0d;return _0x1ba84a;})[_0x1e51('0x23')](respondWithFilteredResult(_0x4f67d3,_0x20eb9b))['catch'](handleError(_0x4f67d3,null));};exports[_0x1e51('0x44')]=function(_0x30eba9,_0x1750b3){var _0x41ca21={'raw':!![],'where':{'id':_0x30eba9[_0x1e51('0x45')]['id']}},_0xfd96a0={};_0xfd96a0[_0x1e51('0x35')]=_['keys'](db[_0x1e51('0x2a')][_0x1e51('0x2b')]);_0xfd96a0['query']=_[_0x1e51('0x30')](_0x30eba9[_0x1e51('0x2f')]);_0xfd96a0[_0x1e51('0x39')]=_['intersection'](_0xfd96a0[_0x1e51('0x35')],_0xfd96a0[_0x1e51('0x2f')]);_0x41ca21[_0x1e51('0x32')]=_[_0x1e51('0x31')](_0xfd96a0[_0x1e51('0x35')],qs[_0x1e51('0x33')](_0x30eba9[_0x1e51('0x2f')][_0x1e51('0x33')]));_0x41ca21[_0x1e51('0x32')]=_0x41ca21['attributes'][_0x1e51('0x34')]?_0x41ca21[_0x1e51('0x32')]:_0xfd96a0['model'];if(_0x30eba9[_0x1e51('0x2f')][_0x1e51('0x40')]){_0x41ca21[_0x1e51('0x41')]=[{'all':!![]}];}_0x41ca21=_['merge']({},_0x41ca21,_0x30eba9[_0x1e51('0x3f')]);return db[_0x1e51('0x2a')][_0x1e51('0x46')](_0x41ca21)['then'](handleEntityNotFound(_0x1750b3,null))[_0x1e51('0x23')](respondWithResult(_0x1750b3,null))['catch'](handleError(_0x1750b3,null));};exports['create']=function(_0x54688b,_0x169e6c){return db[_0x1e51('0x2a')]['create'](_0x54688b['body'],{})[_0x1e51('0x23')](function(_0x7ffc42){var _0x2a43dd=_0x54688b[_0x1e51('0x47')][_0x1e51('0x24')]({'plain':!![]});if(!_0x2a43dd)throw new Error(_0x1e51('0x48'));if(_0x2a43dd['role']===_0x1e51('0x47')){var _0x48a2d0=_0x7ffc42[_0x1e51('0x24')]({'plain':!![]});var _0x43589a='ContactItemTypes';return db['UserProfileSection']['find']({'where':{'name':_0x43589a,'userProfileId':_0x2a43dd[_0x1e51('0x49')]},'raw':!![]})[_0x1e51('0x23')](function(_0x31a37a){if(_0x31a37a&&_0x31a37a['autoAssociation']===0x0){return db[_0x1e51('0x4a')][_0x1e51('0x4b')]({'name':_0x48a2d0[_0x1e51('0x27')],'resourceId':_0x48a2d0['id'],'type':_0x31a37a[_0x1e51('0x27')],'sectionId':_0x31a37a['id']},{})[_0x1e51('0x23')](function(){return _0x7ffc42;});}else{return _0x7ffc42;}})[_0x1e51('0x4c')](function(_0x32fe1f){logger[_0x1e51('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x32fe1f);throw _0x32fe1f;});}return _0x7ffc42;})[_0x1e51('0x23')](respondWithResult(_0x169e6c,0xc9))[_0x1e51('0x4c')](handleError(_0x169e6c,null));};exports[_0x1e51('0x22')]=function(_0x213edb,_0x177b63){if(_0x213edb[_0x1e51('0x4d')]['id']){delete _0x213edb['body']['id'];}return db[_0x1e51('0x2a')]['find']({'where':{'id':_0x213edb['params']['id']}})['then'](handleEntityNotFound(_0x177b63,null))[_0x1e51('0x23')](saveUpdates(_0x213edb[_0x1e51('0x4d')],null))[_0x1e51('0x23')](respondWithResult(_0x177b63,null))['catch'](handleError(_0x177b63,null));};exports[_0x1e51('0x4e')]=function(_0x133576,_0x36c981){return db['ContactItemType'][_0x1e51('0x46')]({'where':{'id':_0x133576[_0x1e51('0x45')]['id']}})[_0x1e51('0x23')](handleEntityNotFound(_0x36c981,null))['then'](db[_0x1e51('0x4f')][_0x1e51('0x22')]({'ItemTypeId':null},{'where':{'ItemTypeId':_0x133576[_0x1e51('0x45')]['id']}}))[_0x1e51('0x23')](removeEntity(_0x36c981,null))[_0x1e51('0x4c')](handleError(_0x36c981,null));}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.model.js b/server/api/contactItemType/contactItemType.model.js index 3611123..57f928e 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 _0x862d=['define','ContactItemType','tools_contact_item_types','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','./contactItemType.attributes','exports'];(function(_0x333d0f,_0x5e49a2){var _0x14cdce=function(_0x44de74){while(--_0x44de74){_0x333d0f['push'](_0x333d0f['shift']());}};_0x14cdce(++_0x5e49a2);}(_0x862d,0x148));var _0xd862=function(_0x8550ba,_0x57c10d){_0x8550ba=_0x8550ba-0x0;var _0x432399=_0x862d[_0x8550ba];return _0x432399;};'use strict';var _=require(_0xd862('0x0'));var util=require(_0xd862('0x1'));var logger=require(_0xd862('0x2'))(_0xd862('0x3'));var moment=require(_0xd862('0x4'));var BPromise=require('bluebird');var rp=require(_0xd862('0x5'));var fs=require('fs');var path=require(_0xd862('0x6'));var rimraf=require(_0xd862('0x7'));var config=require('../../config/environment');var attributes=require(_0xd862('0x8'));module[_0xd862('0x9')]=function(_0x4acf0e,_0x30c587){return _0x4acf0e[_0xd862('0xa')](_0xd862('0xb'),attributes,{'tableName':_0xd862('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7920=['path','rimraf','../../config/environment','exports','define','lodash','util','request-promise'];(function(_0xaa7a74,_0x389361){var _0xa11920=function(_0x5dafe5){while(--_0x5dafe5){_0xaa7a74['push'](_0xaa7a74['shift']());}};_0xa11920(++_0x389361);}(_0x7920,0x195));var _0x0792=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x7920[_0x432682];return _0x463d05;};'use strict';var _=require(_0x0792('0x0'));var util=require(_0x0792('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x0792('0x2'));var fs=require('fs');var path=require(_0x0792('0x3'));var rimraf=require(_0x0792('0x4'));var config=require(_0x0792('0x5'));var attributes=require('./contactItemType.attributes');module[_0x0792('0x6')]=function(_0x2fd288,_0x44cd27){return _0x2fd288[_0x0792('0x7')]('ContactItemType',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 8b72384..db57103 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 _0x22d8=['message','info','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','ContactItemType,\x20%s,\x20%s','request\x20sent','debug','ContactItemType,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x54e230,_0x567e3d){var _0x4e88d4=function(_0x256d40){while(--_0x256d40){_0x54e230['push'](_0x54e230['shift']());}};_0x4e88d4(++_0x567e3d);}(_0x22d8,0x19c));var _0x822d=function(_0x597e5d,_0x2954d5){_0x597e5d=_0x597e5d-0x0;var _0x6a6659=_0x22d8[_0x597e5d];return _0x6a6659;};'use strict';var _=require(_0x822d('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x822d('0x1'));var rs=require(_0x822d('0x2'));var fs=require('fs');var Redis=require(_0x822d('0x3'));var db=require(_0x822d('0x4'))['db'];var utils=require(_0x822d('0x5'));var logger=require(_0x822d('0x6'))(_0x822d('0x7'));var config=require(_0x822d('0x8'));var jayson=require(_0x822d('0x9'));var client=jayson['client'][_0x822d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3a3085,_0x2df8e1,_0x399ce7){return new BPromise(function(_0x5121dd,_0x31266d){return client[_0x822d('0xb')](_0x3a3085,_0x399ce7)[_0x822d('0xc')](function(_0x23e63c){logger['info'](_0x822d('0xd'),_0x2df8e1,_0x822d('0xe'));logger[_0x822d('0xf')](_0x822d('0x10'),_0x2df8e1,_0x822d('0xe'),JSON[_0x822d('0x11')](_0x23e63c));if(_0x23e63c['error']){if(_0x23e63c[_0x822d('0x12')][_0x822d('0x13')]===0x1f4){logger[_0x822d('0x12')]('ContactItemType,\x20%s,\x20%s',_0x2df8e1,_0x23e63c['error']['message']);return _0x31266d(_0x23e63c[_0x822d('0x12')][_0x822d('0x14')]);}logger['error'](_0x822d('0xd'),_0x2df8e1,_0x23e63c['error'][_0x822d('0x14')]);return _0x5121dd(_0x23e63c[_0x822d('0x12')]['message']);}else{logger[_0x822d('0x15')](_0x822d('0xd'),_0x2df8e1,_0x822d('0xe'));_0x5121dd(_0x23e63c[_0x822d('0x16')][_0x822d('0x14')]);}})[_0x822d('0x17')](function(_0x242aa4){logger['error']('ContactItemType,\x20%s,\x20%s',_0x2df8e1,_0x242aa4);_0x31266d(_0x242aa4);});});} \ No newline at end of file +var _0xdcb9=['rpc','../../config/environment','jayson/promise','client','request','request\x20sent','debug','ContactItemType,\x20%s,\x20%s,\x20%s','stringify','error','ContactItemType,\x20%s,\x20%s','message','info','result','catch','lodash','moment','bluebird','ioredis'];(function(_0x35b627,_0x255bb4){var _0x393751=function(_0x5e4f00){while(--_0x5e4f00){_0x35b627['push'](_0x35b627['shift']());}};_0x393751(++_0x255bb4);}(_0xdcb9,0xa7));var _0x9dcb=function(_0xdbc03e,_0x5aea54){_0xdbc03e=_0xdbc03e-0x0;var _0x37d688=_0xdcb9[_0xdbc03e];return _0x37d688;};'use strict';var _=require(_0x9dcb('0x0'));var util=require('util');var moment=require(_0x9dcb('0x1'));var BPromise=require(_0x9dcb('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9dcb('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x9dcb('0x4'));var config=require(_0x9dcb('0x5'));var jayson=require(_0x9dcb('0x6'));var client=jayson[_0x9dcb('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1a364f,_0x542073,_0x25f844){return new BPromise(function(_0x578700,_0x11c535){return client[_0x9dcb('0x8')](_0x1a364f,_0x25f844)['then'](function(_0x133d87){logger['info']('ContactItemType,\x20%s,\x20%s',_0x542073,_0x9dcb('0x9'));logger[_0x9dcb('0xa')](_0x9dcb('0xb'),_0x542073,'request\x20sent',JSON[_0x9dcb('0xc')](_0x133d87));if(_0x133d87[_0x9dcb('0xd')]){if(_0x133d87[_0x9dcb('0xd')]['code']===0x1f4){logger[_0x9dcb('0xd')](_0x9dcb('0xe'),_0x542073,_0x133d87[_0x9dcb('0xd')][_0x9dcb('0xf')]);return _0x11c535(_0x133d87[_0x9dcb('0xd')][_0x9dcb('0xf')]);}logger[_0x9dcb('0xd')](_0x9dcb('0xe'),_0x542073,_0x133d87[_0x9dcb('0xd')]['message']);return _0x578700(_0x133d87[_0x9dcb('0xd')]['message']);}else{logger[_0x9dcb('0x10')]('ContactItemType,\x20%s,\x20%s',_0x542073,_0x9dcb('0x9'));_0x578700(_0x133d87[_0x9dcb('0x11')][_0x9dcb('0xf')]);}})[_0x9dcb('0x12')](function(_0x16608d){logger[_0x9dcb('0xd')]('ContactItemType,\x20%s,\x20%s',_0x542073,_0x16608d);_0x11c535(_0x16608d);});});} \ No newline at end of file diff --git a/server/api/contactItemType/index.js b/server/api/contactItemType/index.js index 57a322e..e007cad 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 _0x09d5=['../../config/environment','./contactItemType.controller','get','isAuthenticated','index','show','post','put','/:id','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x5bd8db,_0x2a895a){var _0x167b4c=function(_0x4fda7a){while(--_0x4fda7a){_0x5bd8db['push'](_0x5bd8db['shift']());}};_0x167b4c(++_0x2a895a);}(_0x09d5,0x15c));var _0x509d=function(_0x275694,_0x1f971a){_0x275694=_0x275694-0x0;var _0x371055=_0x09d5[_0x275694];return _0x371055;};'use strict';var multer=require(_0x509d('0x0'));var util=require(_0x509d('0x1'));var path=require(_0x509d('0x2'));var timeout=require(_0x509d('0x3'));var express=require(_0x509d('0x4'));var router=express[_0x509d('0x5')]();var fs_extra=require(_0x509d('0x6'));var auth=require(_0x509d('0x7'));var interaction=require(_0x509d('0x8'));var config=require(_0x509d('0x9'));var controller=require(_0x509d('0xa'));router[_0x509d('0xb')]('/',auth[_0x509d('0xc')](),controller[_0x509d('0xd')]);router['get']('/:id',auth[_0x509d('0xc')](),controller[_0x509d('0xe')]);router[_0x509d('0xf')]('/',auth[_0x509d('0xc')](),controller['create']);router[_0x509d('0x10')](_0x509d('0x11'),auth[_0x509d('0xc')](),controller[_0x509d('0x12')]);router[_0x509d('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x509d('0x14')]);module['exports']=router; \ No newline at end of file +var _0xbab2=['/:id','show','post','create','put','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index'];(function(_0x4d8be0,_0x612288){var _0x43ffdd=function(_0x28e69f){while(--_0x28e69f){_0x4d8be0['push'](_0x4d8be0['shift']());}};_0x43ffdd(++_0x612288);}(_0xbab2,0xbb));var _0x2bab=function(_0xf759a4,_0x1c0a4b){_0xf759a4=_0xf759a4-0x0;var _0x4220dc=_0xbab2[_0xf759a4];return _0x4220dc;};'use strict';var multer=require(_0x2bab('0x0'));var util=require(_0x2bab('0x1'));var path=require(_0x2bab('0x2'));var timeout=require(_0x2bab('0x3'));var express=require('express');var router=express[_0x2bab('0x4')]();var fs_extra=require(_0x2bab('0x5'));var auth=require(_0x2bab('0x6'));var interaction=require(_0x2bab('0x7'));var config=require('../../config/environment');var controller=require('./contactItemType.controller');router[_0x2bab('0x8')]('/',auth[_0x2bab('0x9')](),controller[_0x2bab('0xa')]);router[_0x2bab('0x8')](_0x2bab('0xb'),auth[_0x2bab('0x9')](),controller[_0x2bab('0xc')]);router[_0x2bab('0xd')]('/',auth['isAuthenticated'](),controller[_0x2bab('0xe')]);router[_0x2bab('0xf')]('/:id',auth[_0x2bab('0x9')](),controller['update']);router['delete']('/:id',auth[_0x2bab('0x9')](),controller[_0x2bab('0x10')]);module[_0x2bab('0x11')]=router; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.attributes.js b/server/api/dashboard/dashboard.attributes.js index 785b76c..4af37b6 100644 --- a/server/api/dashboard/dashboard.attributes.js +++ b/server/api/dashboard/dashboard.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb7e7=['STRING','sequelize'];(function(_0x1f36bb,_0x8af718){var _0xaf97fa=function(_0xeca489){while(--_0xeca489){_0x1f36bb['push'](_0x1f36bb['shift']());}};_0xaf97fa(++_0x8af718);}(_0xb7e7,0x121));var _0x7b7e=function(_0x1beef3,_0x57c4b8){_0x1beef3=_0x1beef3-0x0;var _0x5af964=_0xb7e7[_0x1beef3];return _0x5af964;};'use strict';var Sequelize=require(_0x7b7e('0x0'));module['exports']={'name':{'type':Sequelize[_0x7b7e('0x1')],'allowNull':![],'unique':'name'},'description':{'type':Sequelize[_0x7b7e('0x1')]}}; \ No newline at end of file +var _0x2032=['name','exports','STRING'];(function(_0x513606,_0x1c0003){var _0x4e32a3=function(_0xabcacf){while(--_0xabcacf){_0x513606['push'](_0x513606['shift']());}};_0x4e32a3(++_0x1c0003);}(_0x2032,0xd9));var _0x2203=function(_0x195483,_0x43e1fd){_0x195483=_0x195483-0x0;var _0xcd84fc=_0x2032[_0x195483];return _0xcd84fc;};'use strict';var Sequelize=require('sequelize');module[_0x2203('0x0')]={'name':{'type':Sequelize[_0x2203('0x1')],'allowNull':![],'unique':_0x2203('0x2')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.controller.js b/server/api/dashboard/dashboard.controller.js index 7044dc1..075fecf 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 _0x4a17=['map','Dashboard','fieldName','type','key','model','keys','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','options','includeAll','findAll','rows','catch','rawAttributes','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','CustomDashboards','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','length','createdAt','omit','updatedAt','update','destroy','iframe','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','multibar-chart','attrSerie1','total','attrSerie2','attrSerie3','attrChatWebsites','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','addItem','DashboardId','DashboardItem','getItems','findOne','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./dashboard.socket','register','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','then','get','UserProfileResource','sendStatus','error','stack','name','send'];(function(_0x551754,_0x542785){var _0x22869d=function(_0x3ad6eb){while(--_0x3ad6eb){_0x551754['push'](_0x551754['shift']());}};_0x22869d(++_0x542785);}(_0x4a17,0x1d8));var _0x74a1=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x4a17[_0x17d9e3];return _0x14192d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x74a1('0x0'));var zipdir=require(_0x74a1('0x1'));var jsonpatch=require(_0x74a1('0x2'));var rp=require(_0x74a1('0x3'));var moment=require(_0x74a1('0x4'));var BPromise=require(_0x74a1('0x5'));var Mustache=require(_0x74a1('0x6'));var util=require(_0x74a1('0x7'));var path=require(_0x74a1('0x8'));var sox=require(_0x74a1('0x9'));var csv=require('to-csv');var ejs=require(_0x74a1('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x74a1('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x74a1('0xc'));var deskjs=require(_0x74a1('0xd'));var toCsv=require(_0x74a1('0xe'));var querystring=require(_0x74a1('0xf'));var Papa=require(_0x74a1('0x10'));var Redis=require(_0x74a1('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x74a1('0x12'));var as=require(_0x74a1('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x74a1('0x14'))('api');var utils=require(_0x74a1('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x74a1('0x16'))['db'];config[_0x74a1('0x17')]=_[_0x74a1('0x18')](config[_0x74a1('0x17')],{'host':_0x74a1('0x19'),'port':0x18eb});var socket=require(_0x74a1('0x1a'))(new Redis(config['redis']));require(_0x74a1('0x1b'))[_0x74a1('0x1c')](socket);function respondWithStatusCode(_0x29652a,_0x10f43c){_0x10f43c=_0x10f43c||0xcc;return function(_0x1cde3d){if(_0x1cde3d){return _0x29652a['sendStatus'](_0x10f43c);}return _0x29652a[_0x74a1('0x1d')](_0x10f43c)[_0x74a1('0x1e')]();};}function respondWithResult(_0x205276,_0x323017){_0x323017=_0x323017||0xc8;return function(_0x134ab8){if(_0x134ab8){return _0x205276['status'](_0x323017)[_0x74a1('0x1f')](_0x134ab8);}};}function respondWithFilteredResult(_0x181273,_0x130b13){return function(_0x140166){if(_0x140166){var _0x4b6845=typeof _0x130b13[_0x74a1('0x20')]===_0x74a1('0x21')&&typeof _0x130b13[_0x74a1('0x22')]==='undefined';var _0x59fcfa=_0x140166[_0x74a1('0x23')];var _0x32354f=_0x4b6845?0x0:_0x130b13['offset'];var _0xc32bf4=_0x4b6845?_0x140166['count']:_0x130b13[_0x74a1('0x20')]+_0x130b13[_0x74a1('0x22')];var _0x3244a7;if(_0xc32bf4>=_0x59fcfa){_0xc32bf4=_0x59fcfa;_0x3244a7=0xc8;}else{_0x3244a7=0xce;}_0x181273[_0x74a1('0x1d')](_0x3244a7);return _0x181273[_0x74a1('0x24')](_0x74a1('0x25'),_0x32354f+'-'+_0xc32bf4+'/'+_0x59fcfa)['json'](_0x140166);}return null;};}function patchUpdates(_0x261b44){return function(_0x46bd1c){try{jsonpatch[_0x74a1('0x26')](_0x46bd1c,_0x261b44,!![]);}catch(_0x4b3c39){return BPromise[_0x74a1('0x27')](_0x4b3c39);}return _0x46bd1c['save']();};}function saveUpdates(_0x21ed54,_0x1c84fe){return function(_0x320caa){if(_0x320caa){return _0x320caa['update'](_0x21ed54)[_0x74a1('0x28')](function(_0x3fa990){return _0x3fa990;});}return null;};}function removeEntity(_0x491d44,_0x3616b6){return function(_0x28e174){if(_0x28e174){return _0x28e174['destroy']()[_0x74a1('0x28')](function(){var _0x1edfce=_0x28e174[_0x74a1('0x29')]({'plain':!![]});var _0x57eba1='CustomDashboards';return db[_0x74a1('0x2a')]['destroy']({'where':{'type':_0x57eba1,'resourceId':_0x1edfce['id']}})[_0x74a1('0x28')](function(){return _0x28e174;});})['then'](function(){_0x491d44[_0x74a1('0x1d')](0xcc)[_0x74a1('0x1e')]();});}};}function handleEntityNotFound(_0x706db1,_0x523b06){return function(_0x7b414c){if(!_0x7b414c){_0x706db1[_0x74a1('0x2b')](0x194);}return _0x7b414c;};}function handleError(_0x40a6e3,_0x4b7770){_0x4b7770=_0x4b7770||0x1f4;return function(_0x545aaa){logger[_0x74a1('0x2c')](_0x545aaa[_0x74a1('0x2d')]);if(_0x545aaa[_0x74a1('0x2e')]){delete _0x545aaa[_0x74a1('0x2e')];}_0x40a6e3[_0x74a1('0x1d')](_0x4b7770)[_0x74a1('0x2f')](_0x545aaa);};}exports['index']=function(_0x12a9f2,_0x26182d){var _0x23bd74={},_0x2d1118={},_0x4ee173={'count':0x0,'rows':[]};var _0xb88641=_[_0x74a1('0x30')](db[_0x74a1('0x31')]['rawAttributes'],function(_0x2f1609){return{'name':_0x2f1609[_0x74a1('0x32')],'type':_0x2f1609[_0x74a1('0x33')][_0x74a1('0x34')]};});_0x2d1118[_0x74a1('0x35')]=_['map'](_0xb88641,'name');_0x2d1118['query']=_[_0x74a1('0x36')](_0x12a9f2[_0x74a1('0x37')]);_0x2d1118['filters']=_[_0x74a1('0x38')](_0x2d1118['model'],_0x2d1118[_0x74a1('0x37')]);_0x23bd74[_0x74a1('0x39')]=_[_0x74a1('0x38')](_0x2d1118[_0x74a1('0x35')],qs[_0x74a1('0x3a')](_0x12a9f2[_0x74a1('0x37')][_0x74a1('0x3a')]));_0x23bd74[_0x74a1('0x39')]=_0x23bd74[_0x74a1('0x39')]['length']?_0x23bd74['attributes']:_0x2d1118['model'];if(!_0x12a9f2[_0x74a1('0x37')][_0x74a1('0x3b')](_0x74a1('0x3c'))){_0x23bd74['limit']=qs[_0x74a1('0x22')](_0x12a9f2[_0x74a1('0x37')]['limit']);_0x23bd74[_0x74a1('0x20')]=qs['offset'](_0x12a9f2[_0x74a1('0x37')][_0x74a1('0x20')]);}_0x23bd74[_0x74a1('0x3d')]=qs['sort'](_0x12a9f2[_0x74a1('0x37')][_0x74a1('0x3e')]);_0x23bd74['where']=qs[_0x74a1('0x3f')](_[_0x74a1('0x40')](_0x12a9f2[_0x74a1('0x37')],_0x2d1118['filters']),_0xb88641);if(_0x12a9f2[_0x74a1('0x37')][_0x74a1('0x41')]){_0x23bd74[_0x74a1('0x42')]=_[_0x74a1('0x43')](_0x23bd74[_0x74a1('0x42')],{'$or':_[_0x74a1('0x30')](_0xb88641,function(_0x1a19ea){if(_0x1a19ea['type']!=='VIRTUAL'){var _0x455fa8={};_0x455fa8[_0x1a19ea[_0x74a1('0x2e')]]={'$like':'%'+_0x12a9f2['query']['filter']+'%'};return _0x455fa8;}})});}_0x23bd74=_[_0x74a1('0x43')]({},_0x23bd74,_0x12a9f2[_0x74a1('0x44')]);var _0x2cace3={'where':_0x23bd74['where']};return db['Dashboard'][_0x74a1('0x23')](_0x2cace3)[_0x74a1('0x28')](function(_0x28f53b){_0x4ee173[_0x74a1('0x23')]=_0x28f53b;if(_0x12a9f2['query'][_0x74a1('0x45')]){_0x23bd74['include']=[{'all':!![]}];}return db['Dashboard'][_0x74a1('0x46')](_0x23bd74);})['then'](function(_0x32b22d){_0x4ee173[_0x74a1('0x47')]=_0x32b22d;return _0x4ee173;})[_0x74a1('0x28')](respondWithFilteredResult(_0x26182d,_0x23bd74))[_0x74a1('0x48')](handleError(_0x26182d,null));};exports['show']=function(_0x44f04c,_0xc1ca43){var _0x1793a9={'raw':![],'where':{'id':_0x44f04c['params']['id']}},_0x185bb6={};_0x185bb6[_0x74a1('0x35')]=_[_0x74a1('0x36')](db[_0x74a1('0x31')][_0x74a1('0x49')]);_0x185bb6[_0x74a1('0x37')]=_['keys'](_0x44f04c[_0x74a1('0x37')]);_0x185bb6['filters']=_['intersection'](_0x185bb6[_0x74a1('0x35')],_0x185bb6[_0x74a1('0x37')]);_0x1793a9[_0x74a1('0x39')]=_['intersection'](_0x185bb6[_0x74a1('0x35')],qs[_0x74a1('0x3a')](_0x44f04c['query'][_0x74a1('0x3a')]));_0x1793a9['attributes']=_0x1793a9[_0x74a1('0x39')]['length']?_0x1793a9[_0x74a1('0x39')]:_0x185bb6[_0x74a1('0x35')];if(_0x44f04c[_0x74a1('0x37')]['includeAll']){_0x1793a9['include']=[{'all':!![]}];}_0x1793a9=_['merge']({},_0x1793a9,_0x44f04c[_0x74a1('0x44')]);return db[_0x74a1('0x31')][_0x74a1('0x4a')](_0x1793a9)[_0x74a1('0x28')](handleEntityNotFound(_0xc1ca43,null))[_0x74a1('0x28')](respondWithResult(_0xc1ca43,null))[_0x74a1('0x48')](handleError(_0xc1ca43,null));};exports[_0x74a1('0x4b')]=function(_0x1a16ca,_0x556e13){return db[_0x74a1('0x31')][_0x74a1('0x4b')](_0x1a16ca[_0x74a1('0x4c')],{})[_0x74a1('0x28')](function(_0x546fc4){var _0x342f6e=_0x1a16ca[_0x74a1('0x4d')][_0x74a1('0x29')]({'plain':!![]});if(!_0x342f6e)throw new Error(_0x74a1('0x4e'));if(_0x342f6e[_0x74a1('0x4f')]===_0x74a1('0x4d')){var _0x2f0b=_0x546fc4[_0x74a1('0x29')]({'plain':!![]});var _0x3d7891=_0x74a1('0x50');return db[_0x74a1('0x51')]['find']({'where':{'name':_0x3d7891,'userProfileId':_0x342f6e[_0x74a1('0x52')]},'raw':!![]})[_0x74a1('0x28')](function(_0x1c6a87){if(_0x1c6a87&&_0x1c6a87[_0x74a1('0x53')]===0x0){return db[_0x74a1('0x2a')][_0x74a1('0x4b')]({'name':_0x2f0b[_0x74a1('0x2e')],'resourceId':_0x2f0b['id'],'type':_0x1c6a87['name'],'sectionId':_0x1c6a87['id']},{})[_0x74a1('0x28')](function(){return _0x546fc4;});}else{return _0x546fc4;}})['catch'](function(_0x15075e){logger[_0x74a1('0x2c')](_0x74a1('0x54'),_0x15075e);throw _0x15075e;});}return _0x546fc4;})[_0x74a1('0x28')](respondWithResult(_0x556e13,0xc9))[_0x74a1('0x48')](handleError(_0x556e13,null));};exports['clone']=function(_0x464026,_0x4bbd39){var _0x90885d={'where':{'id':_0x464026[_0x74a1('0x55')]['id']}},_0x254e5b={};_0x254e5b[_0x74a1('0x35')]=_[_0x74a1('0x36')](db[_0x74a1('0x31')][_0x74a1('0x49')]);_0x90885d[_0x74a1('0x39')]=_[_0x74a1('0x38')](_0x254e5b['model'],qs['fields'](_0x464026['query'][_0x74a1('0x3a')]));_0x90885d[_0x74a1('0x39')]=_0x90885d[_0x74a1('0x39')][_0x74a1('0x56')]?_0x90885d[_0x74a1('0x39')]:_0x254e5b[_0x74a1('0x35')];if(_0x464026['query'][_0x74a1('0x45')]){_0x90885d['include']=[{'all':!![]}];}_0x90885d=_['merge']({},_0x90885d,_0x464026[_0x74a1('0x44')]);return db[_0x74a1('0x31')][_0x74a1('0x4a')](_0x90885d)[_0x74a1('0x28')](handleEntityNotFound(_0x4bbd39,null))[_0x74a1('0x28')](function(_0x59b1c5){if(_0x59b1c5){var _0x18532d=_0x59b1c5[_0x74a1('0x29')]({'plain':!![]});_0x18532d=qs['omit'](_0x18532d,['id',_0x74a1('0x57'),'updatedAt']);_0x464026[_0x74a1('0x4c')]=_[_0x74a1('0x58')](_0x464026[_0x74a1('0x4c')],['id',_0x74a1('0x57'),_0x74a1('0x59')]);return db[_0x74a1('0x31')][_0x74a1('0x4b')](_[_0x74a1('0x43')](_0x18532d,_0x464026['body']),{'include':_0x464026[_0x74a1('0x37')][_0x74a1('0x45')]?[{'all':!![]}]:undefined})[_0x74a1('0x28')](function(_0x77053c){var _0x334d24=_0x464026['user'][_0x74a1('0x29')]({'plain':!![]});if(!_0x334d24)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x334d24[_0x74a1('0x4f')]===_0x74a1('0x4d')){var _0x451887=_0x77053c[_0x74a1('0x29')]({'plain':!![]});var _0x116bc4='CustomDashboards';return db['UserProfileSection'][_0x74a1('0x4a')]({'where':{'name':_0x116bc4,'userProfileId':_0x334d24[_0x74a1('0x52')]},'raw':!![]})[_0x74a1('0x28')](function(_0x15ffa5){if(_0x15ffa5&&_0x15ffa5['autoAssociation']===0x0){return db[_0x74a1('0x2a')][_0x74a1('0x4b')]({'name':_0x451887[_0x74a1('0x2e')],'resourceId':_0x451887['id'],'type':_0x15ffa5['name'],'sectionId':_0x15ffa5['id']},{})[_0x74a1('0x28')](function(){return _0x77053c;});}else{return _0x77053c;}})[_0x74a1('0x48')](function(_0x5dae4e){logger['error'](_0x74a1('0x54'),_0x5dae4e);throw _0x5dae4e;});}return _0x77053c;});}})[_0x74a1('0x28')](respondWithResult(_0x4bbd39,0xc9))[_0x74a1('0x48')](handleError(_0x4bbd39,null));};exports[_0x74a1('0x5a')]=function(_0x2f2ecf,_0x254b41){if(_0x2f2ecf[_0x74a1('0x4c')]['id']){delete _0x2f2ecf[_0x74a1('0x4c')]['id'];}return db[_0x74a1('0x31')][_0x74a1('0x4a')]({'where':{'id':_0x2f2ecf[_0x74a1('0x55')]['id']}})[_0x74a1('0x28')](handleEntityNotFound(_0x254b41,null))[_0x74a1('0x28')](saveUpdates(_0x2f2ecf['body'],null))['then'](respondWithResult(_0x254b41,null))[_0x74a1('0x48')](handleError(_0x254b41,null));};exports[_0x74a1('0x5b')]=function(_0x5c7bb3,_0x468a4d){return db[_0x74a1('0x31')][_0x74a1('0x4a')]({'where':{'id':_0x5c7bb3[_0x74a1('0x55')]['id']}})['then'](handleEntityNotFound(_0x468a4d,null))[_0x74a1('0x28')](removeEntity(_0x468a4d,null))[_0x74a1('0x48')](handleError(_0x468a4d,null));};function widgetAttributes(_0x46208f){try{switch(_0x46208f['type']){case _0x74a1('0x5c'):return[{'name':_0x74a1('0x5d'),'value':_0x46208f['attrUrl']||(_0x46208f['attrs']&&_0x46208f['attrs'][0x0]?_0x46208f[_0x74a1('0x5e')][0x0][_0x74a1('0x5f')]:undefined)||_0x74a1('0x60')}];case _0x74a1('0x61'):return[{'name':_0x74a1('0x62'),'value':_0x46208f[_0x74a1('0x62')]||(_0x46208f[_0x74a1('0x5e')]&&_0x46208f[_0x74a1('0x5e')][0x0]?_0x46208f[_0x74a1('0x5e')][0x0][_0x74a1('0x5f')]:undefined)||''}];case _0x74a1('0x63'):return[{'name':_0x74a1('0x64'),'value':_0x46208f[_0x74a1('0x64')]||(_0x46208f[_0x74a1('0x5e')]&&_0x46208f[_0x74a1('0x5e')][0x0]?_0x46208f['attrs'][0x0][_0x74a1('0x5f')]:undefined)||_0x74a1('0x65')},{'name':_0x74a1('0x66'),'value':_0x46208f['attrTimezone']||(_0x46208f[_0x74a1('0x5e')]&&_0x46208f[_0x74a1('0x5e')][0x1]?_0x46208f[_0x74a1('0x5e')][0x1][_0x74a1('0x5f')]:undefined)||_0x74a1('0x67')},{'name':'attrFontSize','value':_0x46208f[_0x74a1('0x68')]||(_0x46208f[_0x74a1('0x5e')]&&_0x46208f[_0x74a1('0x5e')][0x2]?_0x46208f[_0x74a1('0x5e')][0x2][_0x74a1('0x5f')]:undefined)||0xc}];case _0x74a1('0x69'):return[{'name':'attrMetric','value':_0x46208f[_0x74a1('0x6a')]||(_0x46208f[_0x74a1('0x5e')]&&_0x46208f[_0x74a1('0x5e')][0x0]?_0x46208f[_0x74a1('0x5e')][0x0][_0x74a1('0x5f')]:undefined)||'total'},{'name':_0x74a1('0x6b'),'value':_0x46208f[_0x74a1('0x6b')]||(_0x46208f[_0x74a1('0x5e')]&&_0x46208f[_0x74a1('0x5e')][0x1]?_0x46208f[_0x74a1('0x5e')][0x1][_0x74a1('0x5f')]:undefined)||[]},{'name':_0x74a1('0x68'),'value':_0x46208f[_0x74a1('0x68')]||(_0x46208f['attrs']&&_0x46208f['attrs'][0x2]?_0x46208f['attrs'][0x2][_0x74a1('0x5f')]:undefined)||0x14},{'name':_0x74a1('0x6c'),'value':_0x46208f[_0x74a1('0x6c')]||(_0x46208f['attrs']&&_0x46208f[_0x74a1('0x5e')][0x3]?_0x46208f[_0x74a1('0x5e')][0x3][_0x74a1('0x5f')]:undefined)||_0x74a1('0x6d')},{'name':'attrEmailAccounts','value':_0x46208f[_0x74a1('0x6e')]||(_0x46208f[_0x74a1('0x5e')]&&_0x46208f[_0x74a1('0x5e')][0x4]?_0x46208f[_0x74a1('0x5e')][0x4]['value']:undefined)||''},{'name':_0x74a1('0x6f'),'value':_0x46208f['attrFaxAccounts']||(_0x46208f[_0x74a1('0x5e')]&&_0x46208f['attrs'][0x5]?_0x46208f['attrs'][0x5][_0x74a1('0x5f')]:undefined)||''},{'name':'attrSmsAccounts','value':_0x46208f[_0x74a1('0x70')]||(_0x46208f['attrs']&&_0x46208f['attrs'][0x6]?_0x46208f[_0x74a1('0x5e')][0x6]['value']:undefined)||''},{'name':_0x74a1('0x71'),'value':_0x46208f[_0x74a1('0x71')]||(_0x46208f['attrs']&&_0x46208f[_0x74a1('0x5e')][0x7]?_0x46208f[_0x74a1('0x5e')][0x7]['value']:undefined)||''},{'name':_0x74a1('0x72'),'value':_0x46208f['attrWhatsappAccounts']||(_0x46208f[_0x74a1('0x5e')]&&_0x46208f[_0x74a1('0x5e')][0x8]?_0x46208f[_0x74a1('0x5e')][0x8]['value']:undefined)||''},{'name':'attrChatWebsites','value':_0x46208f['attrChatWebsites']||(_0x46208f['attrs']&&_0x46208f[_0x74a1('0x5e')][0x9]?_0x46208f['attrs'][0x9]['value']:undefined)||''}];case _0x74a1('0x73'):case'pie-chart':return[{'name':_0x74a1('0x74'),'value':_0x46208f[_0x74a1('0x74')]||(_0x46208f[_0x74a1('0x5e')]&&_0x46208f['attrs'][0x0]?_0x46208f['attrs'][0x0]['value']:undefined)||_0x74a1('0x75')},{'name':_0x74a1('0x76'),'value':_0x46208f['attrSerie2']||(_0x46208f[_0x74a1('0x5e')]&&_0x46208f['attrs'][0x1]?_0x46208f[_0x74a1('0x5e')][0x1][_0x74a1('0x5f')]:undefined)||null},{'name':_0x74a1('0x77'),'value':_0x46208f[_0x74a1('0x77')]||(_0x46208f[_0x74a1('0x5e')]&&_0x46208f[_0x74a1('0x5e')][0x2]?_0x46208f[_0x74a1('0x5e')][0x2]['value']:undefined)||null},{'name':_0x74a1('0x6b'),'value':_0x46208f['attrVoiceQueues']||(_0x46208f[_0x74a1('0x5e')]&&_0x46208f[_0x74a1('0x5e')][0x3]?_0x46208f['attrs'][0x3]['value']:undefined)||[]},{'name':_0x74a1('0x6c'),'value':_0x46208f[_0x74a1('0x6c')]||(_0x46208f[_0x74a1('0x5e')]&&_0x46208f[_0x74a1('0x5e')][0x4]?_0x46208f[_0x74a1('0x5e')][0x4][_0x74a1('0x5f')]:undefined)||'voice'},{'name':'attrEmailAccounts','value':_0x46208f[_0x74a1('0x6e')]||(_0x46208f[_0x74a1('0x5e')]&&_0x46208f[_0x74a1('0x5e')][0x5]?_0x46208f[_0x74a1('0x5e')][0x5][_0x74a1('0x5f')]:undefined)||''},{'name':'attrFaxAccounts','value':_0x46208f[_0x74a1('0x6f')]||(_0x46208f[_0x74a1('0x5e')]&&_0x46208f[_0x74a1('0x5e')][0x6]?_0x46208f[_0x74a1('0x5e')][0x6][_0x74a1('0x5f')]:undefined)||''},{'name':'attrSmsAccounts','value':_0x46208f[_0x74a1('0x70')]||(_0x46208f[_0x74a1('0x5e')]&&_0x46208f[_0x74a1('0x5e')][0x7]?_0x46208f[_0x74a1('0x5e')][0x7]['value']:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x46208f[_0x74a1('0x71')]||(_0x46208f[_0x74a1('0x5e')]&&_0x46208f[_0x74a1('0x5e')][0x8]?_0x46208f[_0x74a1('0x5e')][0x8][_0x74a1('0x5f')]:undefined)||''},{'name':_0x74a1('0x72'),'value':_0x46208f[_0x74a1('0x72')]||(_0x46208f[_0x74a1('0x5e')]&&_0x46208f[_0x74a1('0x5e')][0x9]?_0x46208f[_0x74a1('0x5e')][0x9][_0x74a1('0x5f')]:undefined)||''},{'name':_0x74a1('0x78'),'value':_0x46208f[_0x74a1('0x78')]||(_0x46208f[_0x74a1('0x5e')]&&_0x46208f[_0x74a1('0x5e')][0xa]?_0x46208f[_0x74a1('0x5e')][0xa][_0x74a1('0x5f')]:undefined)||''}];case'web-report':return[{'name':_0x74a1('0x79'),'type':_0x46208f[_0x74a1('0x7a')]||(_0x46208f[_0x74a1('0x5e')]&&_0x46208f[_0x74a1('0x5e')][0x0]?_0x46208f[_0x74a1('0x5e')][0x0][_0x74a1('0x33')]:undefined)||null,'value':_0x46208f[_0x74a1('0x79')]||(_0x46208f[_0x74a1('0x5e')]&&_0x46208f[_0x74a1('0x5e')][0x0]?_0x46208f[_0x74a1('0x5e')][0x0][_0x74a1('0x5f')]:undefined)||null},{'name':_0x74a1('0x7b'),'value':_0x46208f[_0x74a1('0x7b')]||(_0x46208f[_0x74a1('0x5e')]&&_0x46208f[_0x74a1('0x5e')][0x1]?_0x46208f[_0x74a1('0x5e')][0x1][_0x74a1('0x5f')]:undefined)||0x0}];default:return[];}}catch(_0xdab7c4){logger['error'](_0x74a1('0x7c'),JSON['stringify'](_0xdab7c4));return[];}}exports[_0x74a1('0x7d')]=function(_0x45eedb,_0x5a6798,_0x4e6949){if(_0x45eedb[_0x74a1('0x4c')]['id']){delete _0x45eedb[_0x74a1('0x4c')]['id'];}return db[_0x74a1('0x31')]['find']({'where':{'id':_0x45eedb['params']['id']}})['then'](handleEntityNotFound(_0x5a6798,null))[_0x74a1('0x28')](function(_0x1127bd){if(_0x1127bd){_0x45eedb[_0x74a1('0x4c')][_0x74a1('0x7e')]=_0x1127bd['id'];_0x45eedb[_0x74a1('0x4c')][_0x74a1('0x5e')]=widgetAttributes(_0x45eedb['body']);return db[_0x74a1('0x7f')][_0x74a1('0x4b')](_0x45eedb[_0x74a1('0x4c')]);}})['then'](respondWithResult(_0x5a6798,null))[_0x74a1('0x48')](handleError(_0x5a6798,null));};exports[_0x74a1('0x80')]=function(_0x5e260f,_0x59eb0b,_0x144001){var _0x4f6059={};var _0x26f32c={};var _0x4f816a;var _0x2315a;return db['Dashboard'][_0x74a1('0x81')]({'where':{'id':_0x5e260f[_0x74a1('0x55')]['id']}})[_0x74a1('0x28')](handleEntityNotFound(_0x59eb0b,null))[_0x74a1('0x28')](function(_0x3b7d85){if(_0x3b7d85){_0x4f816a=_0x3b7d85;_0x26f32c[_0x74a1('0x35')]=_[_0x74a1('0x36')](db[_0x74a1('0x7f')]['rawAttributes']);_0x26f32c[_0x74a1('0x37')]=_[_0x74a1('0x36')](_0x5e260f['query']);_0x26f32c[_0x74a1('0x3f')]=_[_0x74a1('0x38')](_0x26f32c[_0x74a1('0x35')],_0x26f32c[_0x74a1('0x37')]);_0x4f6059['attributes']=_[_0x74a1('0x38')](_0x26f32c[_0x74a1('0x35')],qs[_0x74a1('0x3a')](_0x5e260f[_0x74a1('0x37')][_0x74a1('0x3a')]));_0x4f6059[_0x74a1('0x39')]=_0x4f6059[_0x74a1('0x39')][_0x74a1('0x56')]?_0x4f6059[_0x74a1('0x39')]:_0x26f32c[_0x74a1('0x35')];_0x4f6059['order']=qs[_0x74a1('0x3e')](_0x5e260f['query']['sort']);_0x4f6059[_0x74a1('0x42')]=qs[_0x74a1('0x3f')](_[_0x74a1('0x40')](_0x5e260f[_0x74a1('0x37')],_0x26f32c['filters']));if(_0x5e260f[_0x74a1('0x37')][_0x74a1('0x41')]){_0x4f6059[_0x74a1('0x42')]=_['merge'](_0x4f6059[_0x74a1('0x42')],{'$or':_['map'](_0x4f6059[_0x74a1('0x39')],function(_0x1f2760){var _0x25a7d8={};_0x25a7d8[_0x1f2760]={'$like':'%'+_0x5e260f[_0x74a1('0x37')][_0x74a1('0x41')]+'%'};return _0x25a7d8;})});}_0x4f6059=_[_0x74a1('0x43')]({},_0x4f6059,_0x5e260f[_0x74a1('0x44')]);return _0x4f816a[_0x74a1('0x80')](_0x4f6059);}})[_0x74a1('0x28')](function(_0x5b6ff4){if(_0x5b6ff4){_0x2315a=_0x5b6ff4[_0x74a1('0x56')];if(!_0x5e260f[_0x74a1('0x37')][_0x74a1('0x3b')](_0x74a1('0x3c'))){_0x4f6059[_0x74a1('0x22')]=qs['limit'](_0x5e260f[_0x74a1('0x37')][_0x74a1('0x22')]);_0x4f6059[_0x74a1('0x20')]=qs[_0x74a1('0x20')](_0x5e260f[_0x74a1('0x37')][_0x74a1('0x20')]);}return _0x4f816a[_0x74a1('0x80')](_0x4f6059);}})[_0x74a1('0x28')](function(_0x108e14){if(_0x108e14){return _0x108e14?{'count':_0x2315a,'rows':_0x108e14}:null;}})[_0x74a1('0x28')](respondWithResult(_0x59eb0b,null))[_0x74a1('0x48')](handleError(_0x59eb0b,null));}; \ No newline at end of file +var _0x70a4=['attrMetric','total','attrVoiceQueues','attrChannel','voice','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','pie-chart','attrSerie1','attrSerie2','attrSerie3','attrEmailAccounts','web-report','attrReport','reportType','attrRefresh','stringify','DashboardId','DashboardItem','findOne','filter','getItems','eml-format','rimraf','zip-dir','moment','bluebird','mustache','path','sox','to-csv','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./dashboard.socket','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','then','destroy','get','UserProfileResource','error','name','send','index','map','type','key','model','query','keys','filters','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','merge','options','Dashboard','includeAll','include','findAll','rows','catch','params','rawAttributes','intersection','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','CustomDashboards','userProfileId','autoAssociation','clone','omit','createdAt','updatedAt','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','iframe','attrUrl','attrs','value','custom','attrPath','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter'];(function(_0x761fcf,_0x2e5fe7){var _0x46bc5e=function(_0x58c774){while(--_0x58c774){_0x761fcf['push'](_0x761fcf['shift']());}};_0x46bc5e(++_0x2e5fe7);}(_0x70a4,0x9a));var _0x470a=function(_0x45387f,_0x5c6a0b){_0x45387f=_0x45387f-0x0;var _0x240983=_0x70a4[_0x45387f];return _0x240983;};'use strict';var emlformat=require(_0x470a('0x0'));var rimraf=require(_0x470a('0x1'));var zipdir=require(_0x470a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x470a('0x3'));var BPromise=require(_0x470a('0x4'));var Mustache=require(_0x470a('0x5'));var util=require('util');var path=require(_0x470a('0x6'));var sox=require(_0x470a('0x7'));var csv=require(_0x470a('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x470a('0x9'));var crypto=require('crypto');var jsforce=require(_0x470a('0xa'));var deskjs=require(_0x470a('0xb'));var toCsv=require(_0x470a('0x8'));var querystring=require(_0x470a('0xc'));var Papa=require(_0x470a('0xd'));var Redis=require(_0x470a('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x470a('0xf'));var as=require(_0x470a('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x470a('0x11'))(_0x470a('0x12'));var utils=require('../../config/utils');var config=require(_0x470a('0x13'));var licenseUtil=require(_0x470a('0x14'));var db=require(_0x470a('0x15'))['db'];config[_0x470a('0x16')]=_[_0x470a('0x17')](config[_0x470a('0x16')],{'host':_0x470a('0x18'),'port':0x18eb});var socket=require(_0x470a('0x19'))(new Redis(config['redis']));require(_0x470a('0x1a'))['register'](socket);function respondWithStatusCode(_0x267399,_0x116a8d){_0x116a8d=_0x116a8d||0xcc;return function(_0xb78e01){if(_0xb78e01){return _0x267399[_0x470a('0x1b')](_0x116a8d);}return _0x267399[_0x470a('0x1c')](_0x116a8d)[_0x470a('0x1d')]();};}function respondWithResult(_0x29e17b,_0x43bf55){_0x43bf55=_0x43bf55||0xc8;return function(_0x3b0eb2){if(_0x3b0eb2){return _0x29e17b['status'](_0x43bf55)[_0x470a('0x1e')](_0x3b0eb2);}};}function respondWithFilteredResult(_0xdf9304,_0x2ea14a){return function(_0x301e29){if(_0x301e29){var _0x1061a8=typeof _0x2ea14a['offset']===_0x470a('0x1f')&&typeof _0x2ea14a[_0x470a('0x20')]===_0x470a('0x1f');var _0x1b1569=_0x301e29[_0x470a('0x21')];var _0x430e0d=_0x1061a8?0x0:_0x2ea14a[_0x470a('0x22')];var _0x4d27e3=_0x1061a8?_0x301e29[_0x470a('0x21')]:_0x2ea14a['offset']+_0x2ea14a[_0x470a('0x20')];var _0x1a81e2;if(_0x4d27e3>=_0x1b1569){_0x4d27e3=_0x1b1569;_0x1a81e2=0xc8;}else{_0x1a81e2=0xce;}_0xdf9304[_0x470a('0x1c')](_0x1a81e2);return _0xdf9304[_0x470a('0x23')](_0x470a('0x24'),_0x430e0d+'-'+_0x4d27e3+'/'+_0x1b1569)[_0x470a('0x1e')](_0x301e29);}return null;};}function patchUpdates(_0x54a897){return function(_0x1e8ae0){try{jsonpatch[_0x470a('0x25')](_0x1e8ae0,_0x54a897,!![]);}catch(_0x1da4e1){return BPromise[_0x470a('0x26')](_0x1da4e1);}return _0x1e8ae0[_0x470a('0x27')]();};}function saveUpdates(_0x4cd214,_0x1e2824){return function(_0x4b9558){if(_0x4b9558){return _0x4b9558['update'](_0x4cd214)[_0x470a('0x28')](function(_0x521b99){return _0x521b99;});}return null;};}function removeEntity(_0x2eac00,_0x4da46f){return function(_0x3925da){if(_0x3925da){return _0x3925da[_0x470a('0x29')]()['then'](function(){var _0x1f4cb5=_0x3925da[_0x470a('0x2a')]({'plain':!![]});var _0x33bfea='CustomDashboards';return db[_0x470a('0x2b')]['destroy']({'where':{'type':_0x33bfea,'resourceId':_0x1f4cb5['id']}})['then'](function(){return _0x3925da;});})[_0x470a('0x28')](function(){_0x2eac00['status'](0xcc)[_0x470a('0x1d')]();});}};}function handleEntityNotFound(_0x257a89,_0x889071){return function(_0x3c9658){if(!_0x3c9658){_0x257a89[_0x470a('0x1b')](0x194);}return _0x3c9658;};}function handleError(_0x4b36db,_0x3835cd){_0x3835cd=_0x3835cd||0x1f4;return function(_0x2fc1c6){logger[_0x470a('0x2c')](_0x2fc1c6['stack']);if(_0x2fc1c6[_0x470a('0x2d')]){delete _0x2fc1c6['name'];}_0x4b36db[_0x470a('0x1c')](_0x3835cd)[_0x470a('0x2e')](_0x2fc1c6);};}exports[_0x470a('0x2f')]=function(_0x403e38,_0x5660a2){var _0x441f33={},_0x30ef97={},_0x86bc83={'count':0x0,'rows':[]};var _0x25f1af=_[_0x470a('0x30')](db['Dashboard']['rawAttributes'],function(_0x3f965c){return{'name':_0x3f965c['fieldName'],'type':_0x3f965c[_0x470a('0x31')][_0x470a('0x32')]};});_0x30ef97[_0x470a('0x33')]=_[_0x470a('0x30')](_0x25f1af,_0x470a('0x2d'));_0x30ef97[_0x470a('0x34')]=_[_0x470a('0x35')](_0x403e38[_0x470a('0x34')]);_0x30ef97[_0x470a('0x36')]=_['intersection'](_0x30ef97[_0x470a('0x33')],_0x30ef97['query']);_0x441f33['attributes']=_['intersection'](_0x30ef97[_0x470a('0x33')],qs[_0x470a('0x37')](_0x403e38[_0x470a('0x34')][_0x470a('0x37')]));_0x441f33[_0x470a('0x38')]=_0x441f33[_0x470a('0x38')][_0x470a('0x39')]?_0x441f33[_0x470a('0x38')]:_0x30ef97['model'];if(!_0x403e38[_0x470a('0x34')][_0x470a('0x3a')](_0x470a('0x3b'))){_0x441f33[_0x470a('0x20')]=qs[_0x470a('0x20')](_0x403e38[_0x470a('0x34')][_0x470a('0x20')]);_0x441f33[_0x470a('0x22')]=qs['offset'](_0x403e38[_0x470a('0x34')]['offset']);}_0x441f33[_0x470a('0x3c')]=qs[_0x470a('0x3d')](_0x403e38['query'][_0x470a('0x3d')]);_0x441f33[_0x470a('0x3e')]=qs[_0x470a('0x36')](_[_0x470a('0x3f')](_0x403e38[_0x470a('0x34')],_0x30ef97[_0x470a('0x36')]),_0x25f1af);if(_0x403e38[_0x470a('0x34')]['filter']){_0x441f33['where']=_['merge'](_0x441f33[_0x470a('0x3e')],{'$or':_[_0x470a('0x30')](_0x25f1af,function(_0x4b182e){if(_0x4b182e[_0x470a('0x31')]!==_0x470a('0x40')){var _0x12b7c0={};_0x12b7c0[_0x4b182e['name']]={'$like':'%'+_0x403e38[_0x470a('0x34')]['filter']+'%'};return _0x12b7c0;}})});}_0x441f33=_[_0x470a('0x41')]({},_0x441f33,_0x403e38[_0x470a('0x42')]);var _0x32a352={'where':_0x441f33[_0x470a('0x3e')]};return db[_0x470a('0x43')][_0x470a('0x21')](_0x32a352)['then'](function(_0x36c83c){_0x86bc83[_0x470a('0x21')]=_0x36c83c;if(_0x403e38[_0x470a('0x34')][_0x470a('0x44')]){_0x441f33[_0x470a('0x45')]=[{'all':!![]}];}return db[_0x470a('0x43')][_0x470a('0x46')](_0x441f33);})[_0x470a('0x28')](function(_0x57a566){_0x86bc83[_0x470a('0x47')]=_0x57a566;return _0x86bc83;})[_0x470a('0x28')](respondWithFilteredResult(_0x5660a2,_0x441f33))[_0x470a('0x48')](handleError(_0x5660a2,null));};exports['show']=function(_0x1753ba,_0x251ee6){var _0x437e7a={'raw':![],'where':{'id':_0x1753ba[_0x470a('0x49')]['id']}},_0x2c6dc4={};_0x2c6dc4[_0x470a('0x33')]=_[_0x470a('0x35')](db[_0x470a('0x43')][_0x470a('0x4a')]);_0x2c6dc4[_0x470a('0x34')]=_[_0x470a('0x35')](_0x1753ba[_0x470a('0x34')]);_0x2c6dc4[_0x470a('0x36')]=_[_0x470a('0x4b')](_0x2c6dc4['model'],_0x2c6dc4[_0x470a('0x34')]);_0x437e7a[_0x470a('0x38')]=_['intersection'](_0x2c6dc4[_0x470a('0x33')],qs[_0x470a('0x37')](_0x1753ba['query'][_0x470a('0x37')]));_0x437e7a[_0x470a('0x38')]=_0x437e7a[_0x470a('0x38')][_0x470a('0x39')]?_0x437e7a['attributes']:_0x2c6dc4[_0x470a('0x33')];if(_0x1753ba[_0x470a('0x34')]['includeAll']){_0x437e7a[_0x470a('0x45')]=[{'all':!![]}];}_0x437e7a=_['merge']({},_0x437e7a,_0x1753ba[_0x470a('0x42')]);return db[_0x470a('0x43')][_0x470a('0x4c')](_0x437e7a)[_0x470a('0x28')](handleEntityNotFound(_0x251ee6,null))[_0x470a('0x28')](respondWithResult(_0x251ee6,null))[_0x470a('0x48')](handleError(_0x251ee6,null));};exports[_0x470a('0x4d')]=function(_0x3fdde7,_0x3b9ff7){return db[_0x470a('0x43')][_0x470a('0x4d')](_0x3fdde7[_0x470a('0x4e')],{})[_0x470a('0x28')](function(_0x49bb06){var _0x15c352=_0x3fdde7[_0x470a('0x4f')][_0x470a('0x2a')]({'plain':!![]});if(!_0x15c352)throw new Error(_0x470a('0x50'));if(_0x15c352[_0x470a('0x51')]===_0x470a('0x4f')){var _0x47e81c=_0x49bb06[_0x470a('0x2a')]({'plain':!![]});var _0x32c1ea=_0x470a('0x52');return db['UserProfileSection'][_0x470a('0x4c')]({'where':{'name':_0x32c1ea,'userProfileId':_0x15c352[_0x470a('0x53')]},'raw':!![]})['then'](function(_0x5eac35){if(_0x5eac35&&_0x5eac35[_0x470a('0x54')]===0x0){return db[_0x470a('0x2b')][_0x470a('0x4d')]({'name':_0x47e81c[_0x470a('0x2d')],'resourceId':_0x47e81c['id'],'type':_0x5eac35[_0x470a('0x2d')],'sectionId':_0x5eac35['id']},{})[_0x470a('0x28')](function(){return _0x49bb06;});}else{return _0x49bb06;}})[_0x470a('0x48')](function(_0x32ac77){logger[_0x470a('0x2c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x32ac77);throw _0x32ac77;});}return _0x49bb06;})[_0x470a('0x28')](respondWithResult(_0x3b9ff7,0xc9))[_0x470a('0x48')](handleError(_0x3b9ff7,null));};exports[_0x470a('0x55')]=function(_0x26d2f9,_0x49e4a1){var _0x2a3fb7={'where':{'id':_0x26d2f9[_0x470a('0x49')]['id']}},_0x2c329a={};_0x2c329a[_0x470a('0x33')]=_[_0x470a('0x35')](db[_0x470a('0x43')]['rawAttributes']);_0x2a3fb7[_0x470a('0x38')]=_[_0x470a('0x4b')](_0x2c329a[_0x470a('0x33')],qs[_0x470a('0x37')](_0x26d2f9[_0x470a('0x34')][_0x470a('0x37')]));_0x2a3fb7[_0x470a('0x38')]=_0x2a3fb7[_0x470a('0x38')][_0x470a('0x39')]?_0x2a3fb7['attributes']:_0x2c329a['model'];if(_0x26d2f9['query']['includeAll']){_0x2a3fb7['include']=[{'all':!![]}];}_0x2a3fb7=_[_0x470a('0x41')]({},_0x2a3fb7,_0x26d2f9[_0x470a('0x42')]);return db['Dashboard'][_0x470a('0x4c')](_0x2a3fb7)[_0x470a('0x28')](handleEntityNotFound(_0x49e4a1,null))[_0x470a('0x28')](function(_0x331f9d){if(_0x331f9d){var _0x3c87bc=_0x331f9d[_0x470a('0x2a')]({'plain':!![]});_0x3c87bc=qs[_0x470a('0x56')](_0x3c87bc,['id',_0x470a('0x57'),_0x470a('0x58')]);_0x26d2f9[_0x470a('0x4e')]=_[_0x470a('0x56')](_0x26d2f9[_0x470a('0x4e')],['id',_0x470a('0x57'),_0x470a('0x58')]);return db['Dashboard'][_0x470a('0x4d')](_[_0x470a('0x41')](_0x3c87bc,_0x26d2f9[_0x470a('0x4e')]),{'include':_0x26d2f9[_0x470a('0x34')][_0x470a('0x44')]?[{'all':!![]}]:undefined})['then'](function(_0x292cf7){var _0x14d061=_0x26d2f9[_0x470a('0x4f')][_0x470a('0x2a')]({'plain':!![]});if(!_0x14d061)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x14d061[_0x470a('0x51')]===_0x470a('0x4f')){var _0x3bc617=_0x292cf7[_0x470a('0x2a')]({'plain':!![]});var _0x1cfd6b='CustomDashboards';return db[_0x470a('0x59')][_0x470a('0x4c')]({'where':{'name':_0x1cfd6b,'userProfileId':_0x14d061[_0x470a('0x53')]},'raw':!![]})[_0x470a('0x28')](function(_0x53f0cf){if(_0x53f0cf&&_0x53f0cf[_0x470a('0x54')]===0x0){return db['UserProfileResource'][_0x470a('0x4d')]({'name':_0x3bc617[_0x470a('0x2d')],'resourceId':_0x3bc617['id'],'type':_0x53f0cf[_0x470a('0x2d')],'sectionId':_0x53f0cf['id']},{})['then'](function(){return _0x292cf7;});}else{return _0x292cf7;}})[_0x470a('0x48')](function(_0x5e2487){logger['error'](_0x470a('0x5a'),_0x5e2487);throw _0x5e2487;});}return _0x292cf7;});}})[_0x470a('0x28')](respondWithResult(_0x49e4a1,0xc9))[_0x470a('0x48')](handleError(_0x49e4a1,null));};exports[_0x470a('0x5b')]=function(_0x4c6f88,_0x2edcad){if(_0x4c6f88['body']['id']){delete _0x4c6f88[_0x470a('0x4e')]['id'];}return db[_0x470a('0x43')][_0x470a('0x4c')]({'where':{'id':_0x4c6f88[_0x470a('0x49')]['id']}})[_0x470a('0x28')](handleEntityNotFound(_0x2edcad,null))['then'](saveUpdates(_0x4c6f88[_0x470a('0x4e')],null))['then'](respondWithResult(_0x2edcad,null))[_0x470a('0x48')](handleError(_0x2edcad,null));};exports[_0x470a('0x29')]=function(_0x3d3afe,_0xfd5c14){return db[_0x470a('0x43')][_0x470a('0x4c')]({'where':{'id':_0x3d3afe[_0x470a('0x49')]['id']}})[_0x470a('0x28')](handleEntityNotFound(_0xfd5c14,null))[_0x470a('0x28')](removeEntity(_0xfd5c14,null))['catch'](handleError(_0xfd5c14,null));};function widgetAttributes(_0x2fa4f8){try{switch(_0x2fa4f8[_0x470a('0x31')]){case _0x470a('0x5c'):return[{'name':_0x470a('0x5d'),'value':_0x2fa4f8['attrUrl']||(_0x2fa4f8[_0x470a('0x5e')]&&_0x2fa4f8[_0x470a('0x5e')][0x0]?_0x2fa4f8[_0x470a('0x5e')][0x0][_0x470a('0x5f')]:undefined)||'https://'}];case _0x470a('0x60'):return[{'name':_0x470a('0x61'),'value':_0x2fa4f8[_0x470a('0x61')]||(_0x2fa4f8[_0x470a('0x5e')]&&_0x2fa4f8[_0x470a('0x5e')][0x0]?_0x2fa4f8[_0x470a('0x5e')][0x0][_0x470a('0x5f')]:undefined)||''}];case'clock':return[{'name':_0x470a('0x62'),'value':_0x2fa4f8[_0x470a('0x62')]||(_0x2fa4f8[_0x470a('0x5e')]&&_0x2fa4f8[_0x470a('0x5e')][0x0]?_0x2fa4f8['attrs'][0x0][_0x470a('0x5f')]:undefined)||_0x470a('0x63')},{'name':'attrTimezone','value':_0x2fa4f8[_0x470a('0x64')]||(_0x2fa4f8[_0x470a('0x5e')]&&_0x2fa4f8[_0x470a('0x5e')][0x1]?_0x2fa4f8[_0x470a('0x5e')][0x1][_0x470a('0x5f')]:undefined)||_0x470a('0x65')},{'name':_0x470a('0x66'),'value':_0x2fa4f8['attrFontSize']||(_0x2fa4f8[_0x470a('0x5e')]&&_0x2fa4f8[_0x470a('0x5e')][0x2]?_0x2fa4f8[_0x470a('0x5e')][0x2][_0x470a('0x5f')]:undefined)||0xc}];case _0x470a('0x67'):return[{'name':_0x470a('0x68'),'value':_0x2fa4f8[_0x470a('0x68')]||(_0x2fa4f8[_0x470a('0x5e')]&&_0x2fa4f8['attrs'][0x0]?_0x2fa4f8[_0x470a('0x5e')][0x0][_0x470a('0x5f')]:undefined)||_0x470a('0x69')},{'name':'attrVoiceQueues','value':_0x2fa4f8[_0x470a('0x6a')]||(_0x2fa4f8[_0x470a('0x5e')]&&_0x2fa4f8[_0x470a('0x5e')][0x1]?_0x2fa4f8[_0x470a('0x5e')][0x1][_0x470a('0x5f')]:undefined)||[]},{'name':_0x470a('0x66'),'value':_0x2fa4f8[_0x470a('0x66')]||(_0x2fa4f8[_0x470a('0x5e')]&&_0x2fa4f8['attrs'][0x2]?_0x2fa4f8['attrs'][0x2]['value']:undefined)||0x14},{'name':_0x470a('0x6b'),'value':_0x2fa4f8[_0x470a('0x6b')]||(_0x2fa4f8['attrs']&&_0x2fa4f8['attrs'][0x3]?_0x2fa4f8[_0x470a('0x5e')][0x3][_0x470a('0x5f')]:undefined)||_0x470a('0x6c')},{'name':'attrEmailAccounts','value':_0x2fa4f8['attrEmailAccounts']||(_0x2fa4f8[_0x470a('0x5e')]&&_0x2fa4f8[_0x470a('0x5e')][0x4]?_0x2fa4f8[_0x470a('0x5e')][0x4]['value']:undefined)||''},{'name':_0x470a('0x6d'),'value':_0x2fa4f8[_0x470a('0x6d')]||(_0x2fa4f8[_0x470a('0x5e')]&&_0x2fa4f8['attrs'][0x5]?_0x2fa4f8[_0x470a('0x5e')][0x5]['value']:undefined)||''},{'name':_0x470a('0x6e'),'value':_0x2fa4f8[_0x470a('0x6e')]||(_0x2fa4f8[_0x470a('0x5e')]&&_0x2fa4f8['attrs'][0x6]?_0x2fa4f8[_0x470a('0x5e')][0x6][_0x470a('0x5f')]:undefined)||''},{'name':_0x470a('0x6f'),'value':_0x2fa4f8[_0x470a('0x6f')]||(_0x2fa4f8['attrs']&&_0x2fa4f8[_0x470a('0x5e')][0x7]?_0x2fa4f8['attrs'][0x7][_0x470a('0x5f')]:undefined)||''},{'name':_0x470a('0x70'),'value':_0x2fa4f8[_0x470a('0x70')]||(_0x2fa4f8[_0x470a('0x5e')]&&_0x2fa4f8['attrs'][0x8]?_0x2fa4f8[_0x470a('0x5e')][0x8][_0x470a('0x5f')]:undefined)||''},{'name':_0x470a('0x71'),'value':_0x2fa4f8['attrChatWebsites']||(_0x2fa4f8['attrs']&&_0x2fa4f8[_0x470a('0x5e')][0x9]?_0x2fa4f8[_0x470a('0x5e')][0x9][_0x470a('0x5f')]:undefined)||''}];case'multibar-chart':case _0x470a('0x72'):return[{'name':_0x470a('0x73'),'value':_0x2fa4f8['attrSerie1']||(_0x2fa4f8['attrs']&&_0x2fa4f8[_0x470a('0x5e')][0x0]?_0x2fa4f8['attrs'][0x0]['value']:undefined)||'total'},{'name':_0x470a('0x74'),'value':_0x2fa4f8[_0x470a('0x74')]||(_0x2fa4f8[_0x470a('0x5e')]&&_0x2fa4f8['attrs'][0x1]?_0x2fa4f8[_0x470a('0x5e')][0x1][_0x470a('0x5f')]:undefined)||null},{'name':_0x470a('0x75'),'value':_0x2fa4f8[_0x470a('0x75')]||(_0x2fa4f8['attrs']&&_0x2fa4f8['attrs'][0x2]?_0x2fa4f8['attrs'][0x2]['value']:undefined)||null},{'name':_0x470a('0x6a'),'value':_0x2fa4f8[_0x470a('0x6a')]||(_0x2fa4f8[_0x470a('0x5e')]&&_0x2fa4f8[_0x470a('0x5e')][0x3]?_0x2fa4f8['attrs'][0x3][_0x470a('0x5f')]:undefined)||[]},{'name':_0x470a('0x6b'),'value':_0x2fa4f8[_0x470a('0x6b')]||(_0x2fa4f8[_0x470a('0x5e')]&&_0x2fa4f8[_0x470a('0x5e')][0x4]?_0x2fa4f8[_0x470a('0x5e')][0x4][_0x470a('0x5f')]:undefined)||'voice'},{'name':'attrEmailAccounts','value':_0x2fa4f8[_0x470a('0x76')]||(_0x2fa4f8[_0x470a('0x5e')]&&_0x2fa4f8[_0x470a('0x5e')][0x5]?_0x2fa4f8[_0x470a('0x5e')][0x5][_0x470a('0x5f')]:undefined)||''},{'name':_0x470a('0x6d'),'value':_0x2fa4f8[_0x470a('0x6d')]||(_0x2fa4f8[_0x470a('0x5e')]&&_0x2fa4f8[_0x470a('0x5e')][0x6]?_0x2fa4f8[_0x470a('0x5e')][0x6][_0x470a('0x5f')]:undefined)||''},{'name':_0x470a('0x6e'),'value':_0x2fa4f8[_0x470a('0x6e')]||(_0x2fa4f8[_0x470a('0x5e')]&&_0x2fa4f8[_0x470a('0x5e')][0x7]?_0x2fa4f8[_0x470a('0x5e')][0x7][_0x470a('0x5f')]:undefined)||''},{'name':_0x470a('0x6f'),'value':_0x2fa4f8[_0x470a('0x6f')]||(_0x2fa4f8[_0x470a('0x5e')]&&_0x2fa4f8[_0x470a('0x5e')][0x8]?_0x2fa4f8['attrs'][0x8][_0x470a('0x5f')]:undefined)||''},{'name':_0x470a('0x70'),'value':_0x2fa4f8['attrWhatsappAccounts']||(_0x2fa4f8['attrs']&&_0x2fa4f8[_0x470a('0x5e')][0x9]?_0x2fa4f8['attrs'][0x9]['value']:undefined)||''},{'name':_0x470a('0x71'),'value':_0x2fa4f8[_0x470a('0x71')]||(_0x2fa4f8[_0x470a('0x5e')]&&_0x2fa4f8[_0x470a('0x5e')][0xa]?_0x2fa4f8[_0x470a('0x5e')][0xa][_0x470a('0x5f')]:undefined)||''}];case _0x470a('0x77'):return[{'name':_0x470a('0x78'),'type':_0x2fa4f8[_0x470a('0x79')]||(_0x2fa4f8[_0x470a('0x5e')]&&_0x2fa4f8[_0x470a('0x5e')][0x0]?_0x2fa4f8[_0x470a('0x5e')][0x0][_0x470a('0x31')]:undefined)||null,'value':_0x2fa4f8[_0x470a('0x78')]||(_0x2fa4f8[_0x470a('0x5e')]&&_0x2fa4f8['attrs'][0x0]?_0x2fa4f8['attrs'][0x0]['value']:undefined)||null},{'name':_0x470a('0x7a'),'value':_0x2fa4f8[_0x470a('0x7a')]||(_0x2fa4f8[_0x470a('0x5e')]&&_0x2fa4f8[_0x470a('0x5e')][0x1]?_0x2fa4f8[_0x470a('0x5e')][0x1][_0x470a('0x5f')]:undefined)||0x0}];default:return[];}}catch(_0x56ca33){logger[_0x470a('0x2c')]('widgetAttributes:\x20%s',JSON[_0x470a('0x7b')](_0x56ca33));return[];}}exports['addItem']=function(_0x59e008,_0x191fe7,_0x226875){if(_0x59e008[_0x470a('0x4e')]['id']){delete _0x59e008['body']['id'];}return db[_0x470a('0x43')]['find']({'where':{'id':_0x59e008[_0x470a('0x49')]['id']}})[_0x470a('0x28')](handleEntityNotFound(_0x191fe7,null))[_0x470a('0x28')](function(_0xe965cf){if(_0xe965cf){_0x59e008[_0x470a('0x4e')][_0x470a('0x7c')]=_0xe965cf['id'];_0x59e008[_0x470a('0x4e')][_0x470a('0x5e')]=widgetAttributes(_0x59e008[_0x470a('0x4e')]);return db[_0x470a('0x7d')][_0x470a('0x4d')](_0x59e008['body']);}})[_0x470a('0x28')](respondWithResult(_0x191fe7,null))[_0x470a('0x48')](handleError(_0x191fe7,null));};exports['getItems']=function(_0x4f0025,_0x38ecd7,_0x376006){var _0x42845a={};var _0x51cf2a={};var _0xf52dd1;var _0x3b1855;return db[_0x470a('0x43')][_0x470a('0x7e')]({'where':{'id':_0x4f0025[_0x470a('0x49')]['id']}})[_0x470a('0x28')](handleEntityNotFound(_0x38ecd7,null))[_0x470a('0x28')](function(_0x48c5f3){if(_0x48c5f3){_0xf52dd1=_0x48c5f3;_0x51cf2a[_0x470a('0x33')]=_['keys'](db['DashboardItem'][_0x470a('0x4a')]);_0x51cf2a['query']=_[_0x470a('0x35')](_0x4f0025[_0x470a('0x34')]);_0x51cf2a[_0x470a('0x36')]=_[_0x470a('0x4b')](_0x51cf2a[_0x470a('0x33')],_0x51cf2a[_0x470a('0x34')]);_0x42845a[_0x470a('0x38')]=_['intersection'](_0x51cf2a[_0x470a('0x33')],qs[_0x470a('0x37')](_0x4f0025[_0x470a('0x34')][_0x470a('0x37')]));_0x42845a['attributes']=_0x42845a[_0x470a('0x38')][_0x470a('0x39')]?_0x42845a['attributes']:_0x51cf2a['model'];_0x42845a[_0x470a('0x3c')]=qs[_0x470a('0x3d')](_0x4f0025[_0x470a('0x34')][_0x470a('0x3d')]);_0x42845a[_0x470a('0x3e')]=qs[_0x470a('0x36')](_[_0x470a('0x3f')](_0x4f0025[_0x470a('0x34')],_0x51cf2a[_0x470a('0x36')]));if(_0x4f0025[_0x470a('0x34')][_0x470a('0x7f')]){_0x42845a[_0x470a('0x3e')]=_['merge'](_0x42845a[_0x470a('0x3e')],{'$or':_[_0x470a('0x30')](_0x42845a[_0x470a('0x38')],function(_0x3d82e8){var _0x1b106f={};_0x1b106f[_0x3d82e8]={'$like':'%'+_0x4f0025[_0x470a('0x34')]['filter']+'%'};return _0x1b106f;})});}_0x42845a=_['merge']({},_0x42845a,_0x4f0025[_0x470a('0x42')]);return _0xf52dd1['getItems'](_0x42845a);}})[_0x470a('0x28')](function(_0x3d0917){if(_0x3d0917){_0x3b1855=_0x3d0917[_0x470a('0x39')];if(!_0x4f0025[_0x470a('0x34')][_0x470a('0x3a')](_0x470a('0x3b'))){_0x42845a[_0x470a('0x20')]=qs[_0x470a('0x20')](_0x4f0025[_0x470a('0x34')][_0x470a('0x20')]);_0x42845a[_0x470a('0x22')]=qs[_0x470a('0x22')](_0x4f0025[_0x470a('0x34')][_0x470a('0x22')]);}return _0xf52dd1[_0x470a('0x80')](_0x42845a);}})[_0x470a('0x28')](function(_0x2beb66){if(_0x2beb66){return _0x2beb66?{'count':_0x3b1855,'rows':_0x2beb66}:null;}})['then'](respondWithResult(_0x38ecd7,null))[_0x470a('0x48')](handleError(_0x38ecd7,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index fc89496..e21cf62 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 _0x4baf=['events','Dashboard','setMaxListeners','save','update','remove','emit','hook','exports'];(function(_0x5a65ce,_0x446901){var _0x3af041=function(_0x25d617){while(--_0x25d617){_0x5a65ce['push'](_0x5a65ce['shift']());}};_0x3af041(++_0x446901);}(_0x4baf,0xb4));var _0xf4ba=function(_0x33c0fc,_0xde9566){_0x33c0fc=_0x33c0fc-0x0;var _0x1df548=_0x4baf[_0x33c0fc];return _0x1df548;};'use strict';var EventEmitter=require(_0xf4ba('0x0'));var Dashboard=require('../../mysqldb')['db'][_0xf4ba('0x1')];var DashboardEvents=new EventEmitter();DashboardEvents[_0xf4ba('0x2')](0x0);var events={'afterCreate':_0xf4ba('0x3'),'afterUpdate':_0xf4ba('0x4'),'afterDestroy':_0xf4ba('0x5')};function emitEvent(_0x99dfe0){return function(_0x1e16aa,_0x1bac1a,_0x23e730){DashboardEvents['emit'](_0x99dfe0+':'+_0x1e16aa['id'],_0x1e16aa);DashboardEvents[_0xf4ba('0x6')](_0x99dfe0,_0x1e16aa);_0x23e730(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Dashboard[_0xf4ba('0x7')](e,emitEvent(event));}}module[_0xf4ba('0x8')]=DashboardEvents; \ No newline at end of file +var _0x70c8=['update','remove','emit','hasOwnProperty','hook','events','../../mysqldb','Dashboard','setMaxListeners','save'];(function(_0x1869e6,_0x51a581){var _0x2742b9=function(_0x153561){while(--_0x153561){_0x1869e6['push'](_0x1869e6['shift']());}};_0x2742b9(++_0x51a581);}(_0x70c8,0x7d));var _0x870c=function(_0x2db2e7,_0xff9a99){_0x2db2e7=_0x2db2e7-0x0;var _0xb321cd=_0x70c8[_0x2db2e7];return _0xb321cd;};'use strict';var EventEmitter=require(_0x870c('0x0'));var Dashboard=require(_0x870c('0x1'))['db'][_0x870c('0x2')];var DashboardEvents=new EventEmitter();DashboardEvents[_0x870c('0x3')](0x0);var events={'afterCreate':_0x870c('0x4'),'afterUpdate':_0x870c('0x5'),'afterDestroy':_0x870c('0x6')};function emitEvent(_0x3740dc){return function(_0x3c45b9,_0x59ba7a,_0x1b300b){DashboardEvents[_0x870c('0x7')](_0x3740dc+':'+_0x3c45b9['id'],_0x3c45b9);DashboardEvents['emit'](_0x3740dc,_0x3c45b9);_0x1b300b(null);};}for(var e in events){if(events[_0x870c('0x8')](e)){var event=events[e];Dashboard[_0x870c('0x9')](e,emitEvent(event));}}module['exports']=DashboardEvents; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.model.js b/server/api/dashboard/dashboard.model.js index 2c1d5be..7fef24a 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 _0x6691=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./dashboard.attributes','exports','define','Dashboard','dashboards'];(function(_0x3ed4b5,_0x17cff5){var _0x2aa0ea=function(_0x10ade6){while(--_0x10ade6){_0x3ed4b5['push'](_0x3ed4b5['shift']());}};_0x2aa0ea(++_0x17cff5);}(_0x6691,0x134));var _0x1669=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x6691[_0x3bf83f];return _0x22c4a9;};'use strict';var _=require(_0x1669('0x0'));var util=require(_0x1669('0x1'));var logger=require(_0x1669('0x2'))(_0x1669('0x3'));var moment=require(_0x1669('0x4'));var BPromise=require(_0x1669('0x5'));var rp=require(_0x1669('0x6'));var fs=require('fs');var path=require(_0x1669('0x7'));var rimraf=require('rimraf');var config=require(_0x1669('0x8'));var attributes=require(_0x1669('0x9'));module[_0x1669('0xa')]=function(_0x2e2764,_0x467e24){return _0x2e2764[_0x1669('0xb')](_0x1669('0xc'),attributes,{'tableName':_0x1669('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc00a=['util','api','moment','bluebird','path','../../config/environment','./dashboard.attributes','define','Dashboard','lodash'];(function(_0x43071b,_0x1ce820){var _0x5553ff=function(_0x1727b4){while(--_0x1727b4){_0x43071b['push'](_0x43071b['shift']());}};_0x5553ff(++_0x1ce820);}(_0xc00a,0x1f3));var _0xac00=function(_0x12b859,_0x40804e){_0x12b859=_0x12b859-0x0;var _0x867976=_0xc00a[_0x12b859];return _0x867976;};'use strict';var _=require(_0xac00('0x0'));var util=require(_0xac00('0x1'));var logger=require('../../config/logger')(_0xac00('0x2'));var moment=require(_0xac00('0x3'));var BPromise=require(_0xac00('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xac00('0x5'));var rimraf=require('rimraf');var config=require(_0xac00('0x6'));var attributes=require(_0xac00('0x7'));module['exports']=function(_0x1487dd,_0x1344d0){return _0x1487dd[_0xac00('0x8')](_0xac00('0x9'),attributes,{'tableName':'dashboards','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.rpc.js b/server/api/dashboard/dashboard.rpc.js index 8f6a2f5..c0c3b06 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 _0xaa73=['catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','http','defaults','redis','socket.io-emitter','register','request','info','Dashboard,\x20%s,\x20%s','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s','stringify','error','message','result'];(function(_0x18e9d2,_0x29ac3e){var _0x1da75e=function(_0x481ed5){while(--_0x481ed5){_0x18e9d2['push'](_0x18e9d2['shift']());}};_0x1da75e(++_0x29ac3e);}(_0xaa73,0xe2));var _0x3aa7=function(_0x37441f,_0x31498b){_0x37441f=_0x37441f-0x0;var _0x786ac1=_0xaa73[_0x37441f];return _0x786ac1;};'use strict';var _=require(_0x3aa7('0x0'));var util=require(_0x3aa7('0x1'));var moment=require(_0x3aa7('0x2'));var BPromise=require('bluebird');var rs=require(_0x3aa7('0x3'));var fs=require('fs');var Redis=require(_0x3aa7('0x4'));var db=require(_0x3aa7('0x5'))['db'];var utils=require(_0x3aa7('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x3aa7('0x7'));var jayson=require(_0x3aa7('0x8'));var client=jayson['client'][_0x3aa7('0x9')]({'port':0x232a});config['redis']=_[_0x3aa7('0xa')](config[_0x3aa7('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x3aa7('0xc'))(new Redis(config[_0x3aa7('0xb')]));require('./dashboard.socket')[_0x3aa7('0xd')](socket);function respondWithRpcPromise(_0x4b61b9,_0x117dfc,_0x1ae3e2){return new BPromise(function(_0x42eccc,_0x2d2b4f){return client[_0x3aa7('0xe')](_0x4b61b9,_0x1ae3e2)['then'](function(_0x498724){logger[_0x3aa7('0xf')](_0x3aa7('0x10'),_0x117dfc,_0x3aa7('0x11'));logger[_0x3aa7('0x12')](_0x3aa7('0x13'),_0x117dfc,_0x3aa7('0x11'),JSON[_0x3aa7('0x14')](_0x498724));if(_0x498724[_0x3aa7('0x15')]){if(_0x498724[_0x3aa7('0x15')]['code']===0x1f4){logger['error'](_0x3aa7('0x10'),_0x117dfc,_0x498724[_0x3aa7('0x15')]['message']);return _0x2d2b4f(_0x498724[_0x3aa7('0x15')][_0x3aa7('0x16')]);}logger['error'](_0x3aa7('0x10'),_0x117dfc,_0x498724[_0x3aa7('0x15')][_0x3aa7('0x16')]);return _0x42eccc(_0x498724[_0x3aa7('0x15')]['message']);}else{logger[_0x3aa7('0xf')](_0x3aa7('0x10'),_0x117dfc,_0x3aa7('0x11'));_0x42eccc(_0x498724[_0x3aa7('0x17')]['message']);}})[_0x3aa7('0x18')](function(_0x1169b2){logger[_0x3aa7('0x15')](_0x3aa7('0x10'),_0x117dfc,_0x1169b2);_0x2d2b4f(_0x1169b2);});});} \ No newline at end of file +var _0x6334=['then','info','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s','error','code','message','Dashboard,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','localhost','socket.io-emitter','./dashboard.socket','register','request'];(function(_0x26c8e0,_0x1eb33d){var _0x1de4d4=function(_0x67fae4){while(--_0x67fae4){_0x26c8e0['push'](_0x26c8e0['shift']());}};_0x1de4d4(++_0x1eb33d);}(_0x6334,0x119));var _0x4633=function(_0x872f6f,_0x5efe7b){_0x872f6f=_0x872f6f-0x0;var _0x59a5f4=_0x6334[_0x872f6f];return _0x59a5f4;};'use strict';var _=require(_0x4633('0x0'));var util=require(_0x4633('0x1'));var moment=require(_0x4633('0x2'));var BPromise=require(_0x4633('0x3'));var rs=require(_0x4633('0x4'));var fs=require('fs');var Redis=require(_0x4633('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x4633('0x6'));var logger=require(_0x4633('0x7'))(_0x4633('0x8'));var config=require(_0x4633('0x9'));var jayson=require(_0x4633('0xa'));var client=jayson[_0x4633('0xb')][_0x4633('0xc')]({'port':0x232a});config['redis']=_[_0x4633('0xd')](config['redis'],{'host':_0x4633('0xe'),'port':0x18eb});var socket=require(_0x4633('0xf'))(new Redis(config['redis']));require(_0x4633('0x10'))[_0x4633('0x11')](socket);function respondWithRpcPromise(_0x4018ba,_0x591266,_0x45a590){return new BPromise(function(_0x2f07fa,_0x5157a7){return client[_0x4633('0x12')](_0x4018ba,_0x45a590)[_0x4633('0x13')](function(_0x42fe10){logger[_0x4633('0x14')]('Dashboard,\x20%s,\x20%s',_0x591266,_0x4633('0x15'));logger[_0x4633('0x16')](_0x4633('0x17'),_0x591266,'request\x20sent',JSON['stringify'](_0x42fe10));if(_0x42fe10['error']){if(_0x42fe10[_0x4633('0x18')][_0x4633('0x19')]===0x1f4){logger['error']('Dashboard,\x20%s,\x20%s',_0x591266,_0x42fe10[_0x4633('0x18')]['message']);return _0x5157a7(_0x42fe10[_0x4633('0x18')][_0x4633('0x1a')]);}logger[_0x4633('0x18')](_0x4633('0x1b'),_0x591266,_0x42fe10['error'][_0x4633('0x1a')]);return _0x2f07fa(_0x42fe10[_0x4633('0x18')][_0x4633('0x1a')]);}else{logger['info'](_0x4633('0x1b'),_0x591266,_0x4633('0x15'));_0x2f07fa(_0x42fe10[_0x4633('0x1c')][_0x4633('0x1a')]);}})[_0x4633('0x1d')](function(_0x5953b8){logger[_0x4633('0x18')](_0x4633('0x1b'),_0x591266,_0x5953b8);_0x5157a7(_0x5953b8);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index cdecaa7..9657490 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 _0xd697=['dashboard:','save','remove','update','emit','removeListener','register'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0xd697,0x71));var _0x7d69=function(_0x31ea67,_0x2ae326){_0x31ea67=_0x31ea67-0x0;var _0x423462=_0xd697[_0x31ea67];return _0x423462;};'use strict';var DashboardEvents=require('./dashboard.events');var events=[_0x7d69('0x0'),_0x7d69('0x1'),_0x7d69('0x2')];function createListener(_0x542b28,_0x4a1dcc){return function(_0x25eba1){_0x4a1dcc[_0x7d69('0x3')](_0x542b28,_0x25eba1);};}function removeListener(_0x2f390f,_0x2877c8){return function(){DashboardEvents[_0x7d69('0x4')](_0x2f390f,_0x2877c8);};}exports[_0x7d69('0x5')]=function(_0x53d403){for(var _0x5c014d=0x0,_0x243b5f=events['length'];_0x5c014d<_0x243b5f;_0x5c014d++){var _0x582eb8=events[_0x5c014d];var _0x832712=createListener(_0x7d69('0x6')+_0x582eb8,_0x53d403);DashboardEvents['on'](_0x582eb8,_0x832712);}}; \ No newline at end of file +var _0xdae4=['save','update','emit','removeListener','register','length','dashboard:','./dashboard.events'];(function(_0x20d5d3,_0x23693a){var _0x2f0a5a=function(_0x3002ee){while(--_0x3002ee){_0x20d5d3['push'](_0x20d5d3['shift']());}};_0x2f0a5a(++_0x23693a);}(_0xdae4,0x77));var _0x4dae=function(_0x7f3ee7,_0x5705e7){_0x7f3ee7=_0x7f3ee7-0x0;var _0x54dc76=_0xdae4[_0x7f3ee7];return _0x54dc76;};'use strict';var DashboardEvents=require(_0x4dae('0x0'));var events=[_0x4dae('0x1'),'remove',_0x4dae('0x2')];function createListener(_0x5b744d,_0x48148c){return function(_0x4031a2){_0x48148c[_0x4dae('0x3')](_0x5b744d,_0x4031a2);};}function removeListener(_0x47412e,_0xc5ce28){return function(){DashboardEvents[_0x4dae('0x4')](_0x47412e,_0xc5ce28);};}exports[_0x4dae('0x5')]=function(_0x5426fd){for(var _0x4fa078=0x0,_0x57b860=events[_0x4dae('0x6')];_0x4fa078<_0x57b860;_0x4fa078++){var _0x568485=events[_0x4fa078];var _0x1a4e45=createListener(_0x4dae('0x7')+_0x568485,_0x5426fd);DashboardEvents['on'](_0x568485,_0x1a4e45);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index 39a4dae..d2516ee 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 _0x701d=['/:id/items','getItems','create','/:id/clone','clone','post','put','update','destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./dashboard.controller','get','isAuthenticated','/:id','show'];(function(_0x2b4852,_0x3ed245){var _0x5eafac=function(_0x536bb7){while(--_0x536bb7){_0x2b4852['push'](_0x2b4852['shift']());}};_0x5eafac(++_0x3ed245);}(_0x701d,0xd0));var _0xd701=function(_0x1b6966,_0xdebb79){_0x1b6966=_0x1b6966-0x0;var _0x28ceff=_0x701d[_0x1b6966];return _0x28ceff;};'use strict';var multer=require(_0xd701('0x0'));var util=require('util');var path=require(_0xd701('0x1'));var timeout=require(_0xd701('0x2'));var express=require('express');var router=express[_0xd701('0x3')]();var fs_extra=require(_0xd701('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xd701('0x5'));var config=require(_0xd701('0x6'));var controller=require(_0xd701('0x7'));router[_0xd701('0x8')]('/',auth[_0xd701('0x9')](),controller['index']);router[_0xd701('0x8')](_0xd701('0xa'),auth[_0xd701('0x9')](),controller[_0xd701('0xb')]);router[_0xd701('0x8')](_0xd701('0xc'),auth['isAuthenticated'](),controller[_0xd701('0xd')]);router['post']('/',auth[_0xd701('0x9')](),controller[_0xd701('0xe')]);router['post'](_0xd701('0xf'),auth[_0xd701('0x9')](),controller[_0xd701('0x10')]);router[_0xd701('0x11')]('/:id/items',auth[_0xd701('0x9')](),controller['addItem']);router[_0xd701('0x12')](_0xd701('0xa'),auth[_0xd701('0x9')](),controller[_0xd701('0x13')]);router['delete'](_0xd701('0xa'),auth[_0xd701('0x9')](),controller[_0xd701('0x14')]);module[_0xd701('0x15')]=router; \ No newline at end of file +var _0xca16=['index','show','/:id/items','getItems','post','create','clone','put','/:id','delete','destroy','exports','multer','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboard.controller','get','isAuthenticated'];(function(_0xa22054,_0x464303){var _0x4bee13=function(_0x26b6d7){while(--_0x26b6d7){_0xa22054['push'](_0xa22054['shift']());}};_0x4bee13(++_0x464303);}(_0xca16,0xd2));var _0x6ca1=function(_0x5cc572,_0x4feeb2){_0x5cc572=_0x5cc572-0x0;var _0x394365=_0xca16[_0x5cc572];return _0x394365;};'use strict';var multer=require(_0x6ca1('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x6ca1('0x1'));var express=require('express');var router=express[_0x6ca1('0x2')]();var fs_extra=require(_0x6ca1('0x3'));var auth=require(_0x6ca1('0x4'));var interaction=require(_0x6ca1('0x5'));var config=require(_0x6ca1('0x6'));var controller=require(_0x6ca1('0x7'));router[_0x6ca1('0x8')]('/',auth[_0x6ca1('0x9')](),controller[_0x6ca1('0xa')]);router['get']('/:id',auth[_0x6ca1('0x9')](),controller[_0x6ca1('0xb')]);router[_0x6ca1('0x8')](_0x6ca1('0xc'),auth[_0x6ca1('0x9')](),controller[_0x6ca1('0xd')]);router[_0x6ca1('0xe')]('/',auth[_0x6ca1('0x9')](),controller[_0x6ca1('0xf')]);router[_0x6ca1('0xe')]('/:id/clone',auth[_0x6ca1('0x9')](),controller[_0x6ca1('0x10')]);router[_0x6ca1('0xe')]('/:id/items',auth[_0x6ca1('0x9')](),controller['addItem']);router[_0x6ca1('0x11')](_0x6ca1('0x12'),auth['isAuthenticated'](),controller['update']);router[_0x6ca1('0x13')](_0x6ca1('0x12'),auth[_0x6ca1('0x9')](),controller[_0x6ca1('0x14')]);module[_0x6ca1('0x15')]=router; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.attributes.js b/server/api/dashboardItem/dashboardItem.attributes.js index 8444728..eb2303f 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 _0x5fab=['STRING','TEXT','long','parse','getDataValue','attrs','stringify','setDataValue','INTEGER','#ffffff','#2196f3','sequelize','squel','exports'];(function(_0x18cf67,_0x40b5b4){var _0x19089e=function(_0x1ba3c0){while(--_0x1ba3c0){_0x18cf67['push'](_0x18cf67['shift']());}};_0x19089e(++_0x40b5b4);}(_0x5fab,0x177));var _0xb5fa=function(_0x2c26a0,_0x2b9577){_0x2c26a0=_0x2c26a0-0x0;var _0x3e26d2=_0x5fab[_0x2c26a0];return _0x3e26d2;};'use strict';var Sequelize=require(_0xb5fa('0x0'));var squel=require(_0xb5fa('0x1'));var _=require('lodash');module[_0xb5fa('0x2')]={'title':{'type':Sequelize[_0xb5fa('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xb5fa('0x3')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0xb5fa('0x4')](_0xb5fa('0x5')),'get':function(){try{return JSON[_0xb5fa('0x6')](this[_0xb5fa('0x7')](_0xb5fa('0x8')));}catch(_0x10361d){return[];}},'set':function(_0x44df89){try{this['setDataValue']('attrs',JSON[_0xb5fa('0x9')](_0x44df89));}catch(_0x1aec3e){this[_0xb5fa('0xa')]('attrs',JSON[_0xb5fa('0x9')]([]));}}},'sizeX':{'type':Sequelize[_0xb5fa('0xb')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0xb5fa('0xb')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize['INTEGER']},'col':{'type':Sequelize['INTEGER']},'background':{'type':Sequelize[_0xb5fa('0x3')],'allowNull':![],'defaultValue':_0xb5fa('0xc'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0xb5fa('0x3')],'allowNull':![],'defaultValue':_0xb5fa('0xd'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0xb5fa('0x3')]},'titleFontSize':{'type':Sequelize[_0xb5fa('0xb')],'defaultValue':0xc}}; \ No newline at end of file +var _0xf494=['squel','lodash','STRING','TEXT','long','parse','getDataValue','attrs','setDataValue','stringify','INTEGER','#2196f3','sequelize'];(function(_0x2f3848,_0x48564d){var _0x102668=function(_0x5e32ab){while(--_0x5e32ab){_0x2f3848['push'](_0x2f3848['shift']());}};_0x102668(++_0x48564d);}(_0xf494,0x1c6));var _0x4f49=function(_0x446eac,_0x29f115){_0x446eac=_0x446eac-0x0;var _0x2d0614=_0xf494[_0x446eac];return _0x2d0614;};'use strict';var Sequelize=require(_0x4f49('0x0'));var squel=require(_0x4f49('0x1'));var _=require(_0x4f49('0x2'));module['exports']={'title':{'type':Sequelize[_0x4f49('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x4f49('0x3')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x4f49('0x4')](_0x4f49('0x5')),'get':function(){try{return JSON[_0x4f49('0x6')](this[_0x4f49('0x7')](_0x4f49('0x8')));}catch(_0x790e8b){return[];}},'set':function(_0xc5e778){try{this[_0x4f49('0x9')](_0x4f49('0x8'),JSON['stringify'](_0xc5e778));}catch(_0x58e9a0){this[_0x4f49('0x9')](_0x4f49('0x8'),JSON[_0x4f49('0xa')]([]));}}},'sizeX':{'type':Sequelize[_0x4f49('0xb')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x4f49('0xb')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x4f49('0xb')]},'col':{'type':Sequelize[_0x4f49('0xb')]},'background':{'type':Sequelize[_0x4f49('0x3')],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0x4f49('0x3')],'allowNull':![],'defaultValue':_0x4f49('0xc'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize['STRING']},'titleFontSize':{'type':Sequelize[_0x4f49('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 77a60ce..1ef2bbf 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 _0xd3e3=['find','type','attrUrl','attrs','https://','custom','attrPath','value','clock','attrHourFormat','HH:mm:ss','attrTimezone','attrFontSize','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','pie-chart','attrSerie1','attrSerie2','attrSerie3','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','create','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./dashboardItem.socket','register','sendStatus','end','json','offset','undefined','count','status','set','Content-Range','apply','update','then','error','stack','name','send','params','keys','query','filters','intersection','model','attributes','fields','includeAll','options','DashboardItem','catch'];(function(_0x4cb272,_0x52c0e9){var _0x57b4aa=function(_0x1efefb){while(--_0x1efefb){_0x4cb272['push'](_0x4cb272['shift']());}};_0x57b4aa(++_0x52c0e9);}(_0xd3e3,0xdd));var _0x3d3e=function(_0x12cdfb,_0x72a29e){_0x12cdfb=_0x12cdfb-0x0;var _0x2d68c0=_0xd3e3[_0x12cdfb];return _0x2d68c0;};'use strict';var emlformat=require(_0x3d3e('0x0'));var rimraf=require(_0x3d3e('0x1'));var zipdir=require(_0x3d3e('0x2'));var jsonpatch=require(_0x3d3e('0x3'));var rp=require('request-promise');var moment=require(_0x3d3e('0x4'));var BPromise=require(_0x3d3e('0x5'));var Mustache=require('mustache');var util=require(_0x3d3e('0x6'));var path=require(_0x3d3e('0x7'));var sox=require('sox');var csv=require(_0x3d3e('0x8'));var ejs=require(_0x3d3e('0x9'));var fs=require('fs');var fs_extra=require(_0x3d3e('0xa'));var _=require(_0x3d3e('0xb'));var squel=require(_0x3d3e('0xc'));var crypto=require('crypto');var jsforce=require(_0x3d3e('0xd'));var deskjs=require(_0x3d3e('0xe'));var toCsv=require(_0x3d3e('0x8'));var querystring=require('querystring');var Papa=require(_0x3d3e('0xf'));var Redis=require(_0x3d3e('0x10'));var authService=require(_0x3d3e('0x11'));var qs=require(_0x3d3e('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3d3e('0x13'));var logger=require('../../config/logger')(_0x3d3e('0x14'));var utils=require(_0x3d3e('0x15'));var config=require(_0x3d3e('0x16'));var licenseUtil=require(_0x3d3e('0x17'));var db=require('../../mysqldb')['db'];config[_0x3d3e('0x18')]=_[_0x3d3e('0x19')](config['redis'],{'host':_0x3d3e('0x1a'),'port':0x18eb});var socket=require(_0x3d3e('0x1b'))(new Redis(config[_0x3d3e('0x18')]));require(_0x3d3e('0x1c'))[_0x3d3e('0x1d')](socket);function respondWithStatusCode(_0x27ac04,_0xf013f9){_0xf013f9=_0xf013f9||0xcc;return function(_0x260bf8){if(_0x260bf8){return _0x27ac04[_0x3d3e('0x1e')](_0xf013f9);}return _0x27ac04['status'](_0xf013f9)[_0x3d3e('0x1f')]();};}function respondWithResult(_0x2e664b,_0x2c5127){_0x2c5127=_0x2c5127||0xc8;return function(_0x47d8ff){if(_0x47d8ff){return _0x2e664b['status'](_0x2c5127)[_0x3d3e('0x20')](_0x47d8ff);}};}function respondWithFilteredResult(_0x5c19bf,_0x16c799){return function(_0x3f661c){if(_0x3f661c){var _0x317242=typeof _0x16c799[_0x3d3e('0x21')]==='undefined'&&typeof _0x16c799['limit']===_0x3d3e('0x22');var _0x27c782=_0x3f661c['count'];var _0x456e18=_0x317242?0x0:_0x16c799[_0x3d3e('0x21')];var _0x1f90ec=_0x317242?_0x3f661c[_0x3d3e('0x23')]:_0x16c799[_0x3d3e('0x21')]+_0x16c799['limit'];var _0x4a1354;if(_0x1f90ec>=_0x27c782){_0x1f90ec=_0x27c782;_0x4a1354=0xc8;}else{_0x4a1354=0xce;}_0x5c19bf[_0x3d3e('0x24')](_0x4a1354);return _0x5c19bf[_0x3d3e('0x25')](_0x3d3e('0x26'),_0x456e18+'-'+_0x1f90ec+'/'+_0x27c782)[_0x3d3e('0x20')](_0x3f661c);}return null;};}function patchUpdates(_0x434949){return function(_0x986c1e){try{jsonpatch[_0x3d3e('0x27')](_0x986c1e,_0x434949,!![]);}catch(_0x18efd3){return BPromise['reject'](_0x18efd3);}return _0x986c1e['save']();};}function saveUpdates(_0x5b9037,_0x38ce30){return function(_0x2df495){if(_0x2df495){return _0x2df495[_0x3d3e('0x28')](_0x5b9037)[_0x3d3e('0x29')](function(_0x1e4116){return _0x1e4116;});}return null;};}function removeEntity(_0x3860d6,_0x42bd39){return function(_0x2ceb74){if(_0x2ceb74){return _0x2ceb74['destroy']()[_0x3d3e('0x29')](function(){_0x3860d6[_0x3d3e('0x24')](0xcc)[_0x3d3e('0x1f')]();});}};}function handleEntityNotFound(_0x67f196,_0xd3eb2e){return function(_0x466471){if(!_0x466471){_0x67f196[_0x3d3e('0x1e')](0x194);}return _0x466471;};}function handleError(_0x58b5f2,_0x3bcbf3){_0x3bcbf3=_0x3bcbf3||0x1f4;return function(_0x470030){logger[_0x3d3e('0x2a')](_0x470030[_0x3d3e('0x2b')]);if(_0x470030[_0x3d3e('0x2c')]){delete _0x470030['name'];}_0x58b5f2[_0x3d3e('0x24')](_0x3bcbf3)[_0x3d3e('0x2d')](_0x470030);};}exports['show']=function(_0xafdb65,_0x2b643b){var _0x9b1912={'raw':![],'where':{'id':_0xafdb65[_0x3d3e('0x2e')]['id']}},_0x3ac596={};_0x3ac596['model']=_[_0x3d3e('0x2f')](db['DashboardItem']['rawAttributes']);_0x3ac596[_0x3d3e('0x30')]=_[_0x3d3e('0x2f')](_0xafdb65[_0x3d3e('0x30')]);_0x3ac596[_0x3d3e('0x31')]=_[_0x3d3e('0x32')](_0x3ac596[_0x3d3e('0x33')],_0x3ac596['query']);_0x9b1912[_0x3d3e('0x34')]=_[_0x3d3e('0x32')](_0x3ac596[_0x3d3e('0x33')],qs['fields'](_0xafdb65[_0x3d3e('0x30')][_0x3d3e('0x35')]));_0x9b1912['attributes']=_0x9b1912[_0x3d3e('0x34')]['length']?_0x9b1912['attributes']:_0x3ac596['model'];if(_0xafdb65[_0x3d3e('0x30')][_0x3d3e('0x36')]){_0x9b1912['include']=[{'all':!![]}];}_0x9b1912=_['merge']({},_0x9b1912,_0xafdb65[_0x3d3e('0x37')]);return db[_0x3d3e('0x38')]['find'](_0x9b1912)['then'](handleEntityNotFound(_0x2b643b,null))['then'](respondWithResult(_0x2b643b,null))[_0x3d3e('0x39')](handleError(_0x2b643b,null));};exports['destroy']=function(_0x3767e1,_0x366de3){return db[_0x3d3e('0x38')][_0x3d3e('0x3a')]({'where':{'id':_0x3767e1['params']['id']}})[_0x3d3e('0x29')](handleEntityNotFound(_0x366de3,null))[_0x3d3e('0x29')](removeEntity(_0x366de3,null))[_0x3d3e('0x39')](handleError(_0x366de3,null));};function widgetAttributes(_0x437535){try{switch(_0x437535[_0x3d3e('0x3b')]){case'iframe':return[{'name':_0x3d3e('0x3c'),'value':_0x437535[_0x3d3e('0x3c')]||(_0x437535[_0x3d3e('0x3d')]&&_0x437535[_0x3d3e('0x3d')][0x0]?_0x437535['attrs'][0x0]['value']:undefined)||_0x3d3e('0x3e')}];case _0x3d3e('0x3f'):return[{'name':'attrPath','value':_0x437535[_0x3d3e('0x40')]||(_0x437535['attrs']&&_0x437535[_0x3d3e('0x3d')][0x0]?_0x437535[_0x3d3e('0x3d')][0x0][_0x3d3e('0x41')]:undefined)||''}];case _0x3d3e('0x42'):return[{'name':'attrHourFormat','value':_0x437535[_0x3d3e('0x43')]||(_0x437535[_0x3d3e('0x3d')]&&_0x437535[_0x3d3e('0x3d')][0x0]?_0x437535[_0x3d3e('0x3d')][0x0]['value']:undefined)||_0x3d3e('0x44')},{'name':_0x3d3e('0x45'),'value':_0x437535[_0x3d3e('0x45')]||(_0x437535[_0x3d3e('0x3d')]&&_0x437535[_0x3d3e('0x3d')][0x1]?_0x437535[_0x3d3e('0x3d')][0x1][_0x3d3e('0x41')]:undefined)||'0.00'},{'name':_0x3d3e('0x46'),'value':_0x437535['attrFontSize']||(_0x437535[_0x3d3e('0x3d')]&&_0x437535[_0x3d3e('0x3d')][0x2]?_0x437535[_0x3d3e('0x3d')][0x2][_0x3d3e('0x41')]:undefined)||0xc}];case'counter':return[{'name':_0x3d3e('0x47'),'value':_0x437535['attrMetric']||(_0x437535[_0x3d3e('0x3d')]&&_0x437535[_0x3d3e('0x3d')][0x0]?_0x437535['attrs'][0x0]['value']:undefined)||_0x3d3e('0x48')},{'name':_0x3d3e('0x49'),'value':_0x437535[_0x3d3e('0x49')]||(_0x437535['attrs']&&_0x437535[_0x3d3e('0x3d')][0x1]?_0x437535['attrs'][0x1][_0x3d3e('0x41')]:undefined)||[]},{'name':_0x3d3e('0x46'),'value':_0x437535['attrFontSize']||(_0x437535['attrs']&&_0x437535['attrs'][0x2]?_0x437535[_0x3d3e('0x3d')][0x2][_0x3d3e('0x41')]:undefined)||0x14},{'name':_0x3d3e('0x4a'),'value':_0x437535[_0x3d3e('0x4a')]||(_0x437535[_0x3d3e('0x3d')]&&_0x437535['attrs'][0x3]?_0x437535[_0x3d3e('0x3d')][0x3][_0x3d3e('0x41')]:undefined)||_0x3d3e('0x4b')},{'name':_0x3d3e('0x4c'),'value':_0x437535[_0x3d3e('0x4c')]||(_0x437535[_0x3d3e('0x3d')]&&_0x437535[_0x3d3e('0x3d')][0x4]?_0x437535[_0x3d3e('0x3d')][0x4]['value']:undefined)||''},{'name':_0x3d3e('0x4d'),'value':_0x437535[_0x3d3e('0x4d')]||(_0x437535[_0x3d3e('0x3d')]&&_0x437535['attrs'][0x5]?_0x437535[_0x3d3e('0x3d')][0x5]['value']:undefined)||''},{'name':_0x3d3e('0x4e'),'value':_0x437535['attrSmsAccounts']||(_0x437535[_0x3d3e('0x3d')]&&_0x437535[_0x3d3e('0x3d')][0x6]?_0x437535['attrs'][0x6][_0x3d3e('0x41')]:undefined)||''},{'name':_0x3d3e('0x4f'),'value':_0x437535[_0x3d3e('0x4f')]||(_0x437535[_0x3d3e('0x3d')]&&_0x437535[_0x3d3e('0x3d')][0x7]?_0x437535[_0x3d3e('0x3d')][0x7][_0x3d3e('0x41')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x437535[_0x3d3e('0x50')]||(_0x437535[_0x3d3e('0x3d')]&&_0x437535[_0x3d3e('0x3d')][0x8]?_0x437535['attrs'][0x8]['value']:undefined)||''},{'name':'attrChatWebsites','value':_0x437535[_0x3d3e('0x51')]||(_0x437535[_0x3d3e('0x3d')]&&_0x437535[_0x3d3e('0x3d')][0x9]?_0x437535['attrs'][0x9][_0x3d3e('0x41')]:undefined)||''}];case'multibar-chart':case _0x3d3e('0x52'):return[{'name':'attrSerie1','value':_0x437535[_0x3d3e('0x53')]||(_0x437535[_0x3d3e('0x3d')]&&_0x437535[_0x3d3e('0x3d')][0x0]?_0x437535[_0x3d3e('0x3d')][0x0][_0x3d3e('0x41')]:undefined)||'total'},{'name':_0x3d3e('0x54'),'value':_0x437535[_0x3d3e('0x54')]||(_0x437535[_0x3d3e('0x3d')]&&_0x437535[_0x3d3e('0x3d')][0x1]?_0x437535[_0x3d3e('0x3d')][0x1][_0x3d3e('0x41')]:undefined)||null},{'name':_0x3d3e('0x55'),'value':_0x437535[_0x3d3e('0x55')]||(_0x437535['attrs']&&_0x437535[_0x3d3e('0x3d')][0x2]?_0x437535[_0x3d3e('0x3d')][0x2][_0x3d3e('0x41')]:undefined)||null},{'name':_0x3d3e('0x49'),'value':_0x437535[_0x3d3e('0x49')]||(_0x437535['attrs']&&_0x437535['attrs'][0x3]?_0x437535[_0x3d3e('0x3d')][0x3][_0x3d3e('0x41')]:undefined)||[]},{'name':_0x3d3e('0x4a'),'value':_0x437535[_0x3d3e('0x4a')]||(_0x437535[_0x3d3e('0x3d')]&&_0x437535[_0x3d3e('0x3d')][0x4]?_0x437535[_0x3d3e('0x3d')][0x4][_0x3d3e('0x41')]:undefined)||_0x3d3e('0x4b')},{'name':_0x3d3e('0x4c'),'value':_0x437535[_0x3d3e('0x4c')]||(_0x437535[_0x3d3e('0x3d')]&&_0x437535['attrs'][0x5]?_0x437535[_0x3d3e('0x3d')][0x5][_0x3d3e('0x41')]:undefined)||''},{'name':'attrFaxAccounts','value':_0x437535[_0x3d3e('0x4d')]||(_0x437535[_0x3d3e('0x3d')]&&_0x437535['attrs'][0x6]?_0x437535[_0x3d3e('0x3d')][0x6][_0x3d3e('0x41')]:undefined)||''},{'name':_0x3d3e('0x4e'),'value':_0x437535[_0x3d3e('0x4e')]||(_0x437535[_0x3d3e('0x3d')]&&_0x437535['attrs'][0x7]?_0x437535[_0x3d3e('0x3d')][0x7]['value']:undefined)||''},{'name':_0x3d3e('0x4f'),'value':_0x437535[_0x3d3e('0x4f')]||(_0x437535['attrs']&&_0x437535[_0x3d3e('0x3d')][0x8]?_0x437535[_0x3d3e('0x3d')][0x8][_0x3d3e('0x41')]:undefined)||''},{'name':_0x3d3e('0x50'),'value':_0x437535[_0x3d3e('0x50')]||(_0x437535[_0x3d3e('0x3d')]&&_0x437535[_0x3d3e('0x3d')][0x9]?_0x437535['attrs'][0x9][_0x3d3e('0x41')]:undefined)||''},{'name':'attrChatWebsites','value':_0x437535['attrChatWebsites']||(_0x437535[_0x3d3e('0x3d')]&&_0x437535[_0x3d3e('0x3d')][0xa]?_0x437535[_0x3d3e('0x3d')][0xa][_0x3d3e('0x41')]:undefined)||''}];case'web-report':return[{'name':_0x3d3e('0x56'),'type':_0x437535[_0x3d3e('0x57')]||(_0x437535['attrs']&&_0x437535[_0x3d3e('0x3d')][0x0]?_0x437535[_0x3d3e('0x3d')][0x0]['type']:undefined)||null,'value':_0x437535[_0x3d3e('0x56')]||(_0x437535[_0x3d3e('0x3d')]&&_0x437535['attrs'][0x0]?_0x437535['attrs'][0x0][_0x3d3e('0x41')]:undefined)||null},{'name':_0x3d3e('0x58'),'value':_0x437535[_0x3d3e('0x58')]||(_0x437535[_0x3d3e('0x3d')]&&_0x437535['attrs'][0x1]?_0x437535['attrs'][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x18a2ab){logger[_0x3d3e('0x2a')](_0x3d3e('0x59'),JSON[_0x3d3e('0x5a')](_0x18a2ab));return[];}}exports[_0x3d3e('0x5b')]=function(_0x4cab2d,_0x170495){if(_0x4cab2d[_0x3d3e('0x5c')]){_0x4cab2d['body'][_0x3d3e('0x3d')]=widgetAttributes(_0x4cab2d[_0x3d3e('0x5c')]);}return db[_0x3d3e('0x38')][_0x3d3e('0x5b')](_0x4cab2d[_0x3d3e('0x5c')],{})['then'](respondWithResult(_0x170495,0xc9))[_0x3d3e('0x39')](handleError(_0x170495,null));};exports[_0x3d3e('0x28')]=function(_0x16c046,_0x16c9de){if(_0x16c046[_0x3d3e('0x5c')]['id']){delete _0x16c046[_0x3d3e('0x5c')]['id'];}_0x16c046['body'][_0x3d3e('0x3d')]=widgetAttributes(_0x16c046[_0x3d3e('0x5c')]);return db[_0x3d3e('0x38')][_0x3d3e('0x3a')]({'where':{'id':_0x16c046[_0x3d3e('0x2e')]['id']}})[_0x3d3e('0x29')](handleEntityNotFound(_0x16c9de,null))['then'](saveUpdates(_0x16c046[_0x3d3e('0x5c')],null))[_0x3d3e('0x29')](respondWithResult(_0x16c9de,null))['catch'](handleError(_0x16c9de,null));}; \ No newline at end of file +var _0xc963=['ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./dashboardItem.socket','register','sendStatus','status','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','end','error','stack','name','send','show','model','keys','DashboardItem','query','filters','intersection','attributes','fields','includeAll','include','merge','options','find','catch','params','iframe','attrUrl','attrs','value','https://','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','attrMetric','total','attrVoiceQueues','attrChannel','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','attrSerie1','attrSerie2','attrSerie3','voice','attrReport','reportType','type','attrRefresh','widgetAttributes:\x20%s','create','body','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xc963,0x17f));var _0x3c96=function(_0x56916d,_0x37b935){_0x56916d=_0x56916d-0x0;var _0x2b7f1f=_0xc963[_0x56916d];return _0x2b7f1f;};'use strict';var emlformat=require(_0x3c96('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x3c96('0x1'));var rp=require(_0x3c96('0x2'));var moment=require(_0x3c96('0x3'));var BPromise=require(_0x3c96('0x4'));var Mustache=require(_0x3c96('0x5'));var util=require('util');var path=require(_0x3c96('0x6'));var sox=require(_0x3c96('0x7'));var csv=require(_0x3c96('0x8'));var ejs=require(_0x3c96('0x9'));var fs=require('fs');var fs_extra=require(_0x3c96('0xa'));var _=require('lodash');var squel=require(_0x3c96('0xb'));var crypto=require(_0x3c96('0xc'));var jsforce=require(_0x3c96('0xd'));var deskjs=require(_0x3c96('0xe'));var toCsv=require(_0x3c96('0x8'));var querystring=require(_0x3c96('0xf'));var Papa=require(_0x3c96('0x10'));var Redis=require(_0x3c96('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x3c96('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3c96('0x13'));var logger=require(_0x3c96('0x14'))('api');var utils=require(_0x3c96('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x3c96('0x16'))['db'];config[_0x3c96('0x17')]=_[_0x3c96('0x18')](config[_0x3c96('0x17')],{'host':_0x3c96('0x19'),'port':0x18eb});var socket=require(_0x3c96('0x1a'))(new Redis(config[_0x3c96('0x17')]));require(_0x3c96('0x1b'))[_0x3c96('0x1c')](socket);function respondWithStatusCode(_0xd79802,_0x4637b0){_0x4637b0=_0x4637b0||0xcc;return function(_0x10ea6d){if(_0x10ea6d){return _0xd79802[_0x3c96('0x1d')](_0x4637b0);}return _0xd79802[_0x3c96('0x1e')](_0x4637b0)['end']();};}function respondWithResult(_0x3720a3,_0x1bc526){_0x1bc526=_0x1bc526||0xc8;return function(_0x5bfb66){if(_0x5bfb66){return _0x3720a3[_0x3c96('0x1e')](_0x1bc526)[_0x3c96('0x1f')](_0x5bfb66);}};}function respondWithFilteredResult(_0x3ba1e4,_0xa10667){return function(_0x4cc321){if(_0x4cc321){var _0x4a3600=typeof _0xa10667[_0x3c96('0x20')]===_0x3c96('0x21')&&typeof _0xa10667[_0x3c96('0x22')]===_0x3c96('0x21');var _0xc4a84d=_0x4cc321[_0x3c96('0x23')];var _0x15aa1d=_0x4a3600?0x0:_0xa10667[_0x3c96('0x20')];var _0x4eca85=_0x4a3600?_0x4cc321[_0x3c96('0x23')]:_0xa10667[_0x3c96('0x20')]+_0xa10667[_0x3c96('0x22')];var _0x3daaf8;if(_0x4eca85>=_0xc4a84d){_0x4eca85=_0xc4a84d;_0x3daaf8=0xc8;}else{_0x3daaf8=0xce;}_0x3ba1e4[_0x3c96('0x1e')](_0x3daaf8);return _0x3ba1e4[_0x3c96('0x24')]('Content-Range',_0x15aa1d+'-'+_0x4eca85+'/'+_0xc4a84d)[_0x3c96('0x1f')](_0x4cc321);}return null;};}function patchUpdates(_0x2bc43d){return function(_0x51bebb){try{jsonpatch[_0x3c96('0x25')](_0x51bebb,_0x2bc43d,!![]);}catch(_0x2e6aed){return BPromise[_0x3c96('0x26')](_0x2e6aed);}return _0x51bebb[_0x3c96('0x27')]();};}function saveUpdates(_0x24c88d,_0x4f91cb){return function(_0x4f2e0){if(_0x4f2e0){return _0x4f2e0[_0x3c96('0x28')](_0x24c88d)[_0x3c96('0x29')](function(_0x3a95f7){return _0x3a95f7;});}return null;};}function removeEntity(_0x446c10,_0x3d8900){return function(_0x1771d9){if(_0x1771d9){return _0x1771d9[_0x3c96('0x2a')]()[_0x3c96('0x29')](function(){_0x446c10['status'](0xcc)[_0x3c96('0x2b')]();});}};}function handleEntityNotFound(_0x48f72d,_0x30180b){return function(_0x521350){if(!_0x521350){_0x48f72d['sendStatus'](0x194);}return _0x521350;};}function handleError(_0x253cf0,_0x3a237e){_0x3a237e=_0x3a237e||0x1f4;return function(_0x76c23c){logger[_0x3c96('0x2c')](_0x76c23c[_0x3c96('0x2d')]);if(_0x76c23c[_0x3c96('0x2e')]){delete _0x76c23c[_0x3c96('0x2e')];}_0x253cf0[_0x3c96('0x1e')](_0x3a237e)[_0x3c96('0x2f')](_0x76c23c);};}exports[_0x3c96('0x30')]=function(_0x7a44ed,_0x1a64e7){var _0xebaa9e={'raw':![],'where':{'id':_0x7a44ed['params']['id']}},_0x369170={};_0x369170[_0x3c96('0x31')]=_[_0x3c96('0x32')](db[_0x3c96('0x33')]['rawAttributes']);_0x369170[_0x3c96('0x34')]=_[_0x3c96('0x32')](_0x7a44ed['query']);_0x369170[_0x3c96('0x35')]=_[_0x3c96('0x36')](_0x369170['model'],_0x369170[_0x3c96('0x34')]);_0xebaa9e[_0x3c96('0x37')]=_[_0x3c96('0x36')](_0x369170[_0x3c96('0x31')],qs[_0x3c96('0x38')](_0x7a44ed[_0x3c96('0x34')][_0x3c96('0x38')]));_0xebaa9e[_0x3c96('0x37')]=_0xebaa9e[_0x3c96('0x37')]['length']?_0xebaa9e[_0x3c96('0x37')]:_0x369170[_0x3c96('0x31')];if(_0x7a44ed[_0x3c96('0x34')][_0x3c96('0x39')]){_0xebaa9e[_0x3c96('0x3a')]=[{'all':!![]}];}_0xebaa9e=_[_0x3c96('0x3b')]({},_0xebaa9e,_0x7a44ed[_0x3c96('0x3c')]);return db['DashboardItem'][_0x3c96('0x3d')](_0xebaa9e)[_0x3c96('0x29')](handleEntityNotFound(_0x1a64e7,null))[_0x3c96('0x29')](respondWithResult(_0x1a64e7,null))[_0x3c96('0x3e')](handleError(_0x1a64e7,null));};exports[_0x3c96('0x2a')]=function(_0x31556e,_0x1ea7a8){return db[_0x3c96('0x33')][_0x3c96('0x3d')]({'where':{'id':_0x31556e[_0x3c96('0x3f')]['id']}})[_0x3c96('0x29')](handleEntityNotFound(_0x1ea7a8,null))[_0x3c96('0x29')](removeEntity(_0x1ea7a8,null))['catch'](handleError(_0x1ea7a8,null));};function widgetAttributes(_0x2ed687){try{switch(_0x2ed687['type']){case _0x3c96('0x40'):return[{'name':_0x3c96('0x41'),'value':_0x2ed687[_0x3c96('0x41')]||(_0x2ed687[_0x3c96('0x42')]&&_0x2ed687[_0x3c96('0x42')][0x0]?_0x2ed687[_0x3c96('0x42')][0x0][_0x3c96('0x43')]:undefined)||_0x3c96('0x44')}];case'custom':return[{'name':_0x3c96('0x45'),'value':_0x2ed687[_0x3c96('0x45')]||(_0x2ed687['attrs']&&_0x2ed687[_0x3c96('0x42')][0x0]?_0x2ed687[_0x3c96('0x42')][0x0][_0x3c96('0x43')]:undefined)||''}];case _0x3c96('0x46'):return[{'name':_0x3c96('0x47'),'value':_0x2ed687['attrHourFormat']||(_0x2ed687[_0x3c96('0x42')]&&_0x2ed687[_0x3c96('0x42')][0x0]?_0x2ed687['attrs'][0x0][_0x3c96('0x43')]:undefined)||_0x3c96('0x48')},{'name':_0x3c96('0x49'),'value':_0x2ed687[_0x3c96('0x49')]||(_0x2ed687[_0x3c96('0x42')]&&_0x2ed687[_0x3c96('0x42')][0x1]?_0x2ed687['attrs'][0x1][_0x3c96('0x43')]:undefined)||_0x3c96('0x4a')},{'name':_0x3c96('0x4b'),'value':_0x2ed687['attrFontSize']||(_0x2ed687[_0x3c96('0x42')]&&_0x2ed687[_0x3c96('0x42')][0x2]?_0x2ed687['attrs'][0x2][_0x3c96('0x43')]:undefined)||0xc}];case'counter':return[{'name':_0x3c96('0x4c'),'value':_0x2ed687['attrMetric']||(_0x2ed687[_0x3c96('0x42')]&&_0x2ed687['attrs'][0x0]?_0x2ed687[_0x3c96('0x42')][0x0][_0x3c96('0x43')]:undefined)||_0x3c96('0x4d')},{'name':'attrVoiceQueues','value':_0x2ed687[_0x3c96('0x4e')]||(_0x2ed687[_0x3c96('0x42')]&&_0x2ed687['attrs'][0x1]?_0x2ed687[_0x3c96('0x42')][0x1][_0x3c96('0x43')]:undefined)||[]},{'name':_0x3c96('0x4b'),'value':_0x2ed687[_0x3c96('0x4b')]||(_0x2ed687[_0x3c96('0x42')]&&_0x2ed687[_0x3c96('0x42')][0x2]?_0x2ed687['attrs'][0x2][_0x3c96('0x43')]:undefined)||0x14},{'name':_0x3c96('0x4f'),'value':_0x2ed687[_0x3c96('0x4f')]||(_0x2ed687['attrs']&&_0x2ed687[_0x3c96('0x42')][0x3]?_0x2ed687[_0x3c96('0x42')][0x3][_0x3c96('0x43')]:undefined)||'voice'},{'name':_0x3c96('0x50'),'value':_0x2ed687[_0x3c96('0x50')]||(_0x2ed687['attrs']&&_0x2ed687[_0x3c96('0x42')][0x4]?_0x2ed687['attrs'][0x4][_0x3c96('0x43')]:undefined)||''},{'name':_0x3c96('0x51'),'value':_0x2ed687['attrFaxAccounts']||(_0x2ed687[_0x3c96('0x42')]&&_0x2ed687['attrs'][0x5]?_0x2ed687[_0x3c96('0x42')][0x5][_0x3c96('0x43')]:undefined)||''},{'name':_0x3c96('0x52'),'value':_0x2ed687[_0x3c96('0x52')]||(_0x2ed687[_0x3c96('0x42')]&&_0x2ed687[_0x3c96('0x42')][0x6]?_0x2ed687[_0x3c96('0x42')][0x6][_0x3c96('0x43')]:undefined)||''},{'name':_0x3c96('0x53'),'value':_0x2ed687['attrOpenchannelAccounts']||(_0x2ed687[_0x3c96('0x42')]&&_0x2ed687[_0x3c96('0x42')][0x7]?_0x2ed687[_0x3c96('0x42')][0x7][_0x3c96('0x43')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x2ed687[_0x3c96('0x54')]||(_0x2ed687[_0x3c96('0x42')]&&_0x2ed687[_0x3c96('0x42')][0x8]?_0x2ed687[_0x3c96('0x42')][0x8][_0x3c96('0x43')]:undefined)||''},{'name':_0x3c96('0x55'),'value':_0x2ed687[_0x3c96('0x55')]||(_0x2ed687[_0x3c96('0x42')]&&_0x2ed687[_0x3c96('0x42')][0x9]?_0x2ed687['attrs'][0x9]['value']:undefined)||''}];case _0x3c96('0x56'):case'pie-chart':return[{'name':_0x3c96('0x57'),'value':_0x2ed687[_0x3c96('0x57')]||(_0x2ed687[_0x3c96('0x42')]&&_0x2ed687[_0x3c96('0x42')][0x0]?_0x2ed687[_0x3c96('0x42')][0x0][_0x3c96('0x43')]:undefined)||'total'},{'name':_0x3c96('0x58'),'value':_0x2ed687['attrSerie2']||(_0x2ed687[_0x3c96('0x42')]&&_0x2ed687[_0x3c96('0x42')][0x1]?_0x2ed687[_0x3c96('0x42')][0x1]['value']:undefined)||null},{'name':'attrSerie3','value':_0x2ed687[_0x3c96('0x59')]||(_0x2ed687['attrs']&&_0x2ed687[_0x3c96('0x42')][0x2]?_0x2ed687['attrs'][0x2][_0x3c96('0x43')]:undefined)||null},{'name':_0x3c96('0x4e'),'value':_0x2ed687[_0x3c96('0x4e')]||(_0x2ed687[_0x3c96('0x42')]&&_0x2ed687[_0x3c96('0x42')][0x3]?_0x2ed687[_0x3c96('0x42')][0x3][_0x3c96('0x43')]:undefined)||[]},{'name':_0x3c96('0x4f'),'value':_0x2ed687[_0x3c96('0x4f')]||(_0x2ed687[_0x3c96('0x42')]&&_0x2ed687[_0x3c96('0x42')][0x4]?_0x2ed687[_0x3c96('0x42')][0x4][_0x3c96('0x43')]:undefined)||_0x3c96('0x5a')},{'name':_0x3c96('0x50'),'value':_0x2ed687[_0x3c96('0x50')]||(_0x2ed687[_0x3c96('0x42')]&&_0x2ed687[_0x3c96('0x42')][0x5]?_0x2ed687['attrs'][0x5]['value']:undefined)||''},{'name':_0x3c96('0x51'),'value':_0x2ed687[_0x3c96('0x51')]||(_0x2ed687['attrs']&&_0x2ed687[_0x3c96('0x42')][0x6]?_0x2ed687[_0x3c96('0x42')][0x6]['value']:undefined)||''},{'name':_0x3c96('0x52'),'value':_0x2ed687[_0x3c96('0x52')]||(_0x2ed687[_0x3c96('0x42')]&&_0x2ed687[_0x3c96('0x42')][0x7]?_0x2ed687[_0x3c96('0x42')][0x7][_0x3c96('0x43')]:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x2ed687['attrOpenchannelAccounts']||(_0x2ed687['attrs']&&_0x2ed687[_0x3c96('0x42')][0x8]?_0x2ed687[_0x3c96('0x42')][0x8][_0x3c96('0x43')]:undefined)||''},{'name':_0x3c96('0x54'),'value':_0x2ed687['attrWhatsappAccounts']||(_0x2ed687[_0x3c96('0x42')]&&_0x2ed687[_0x3c96('0x42')][0x9]?_0x2ed687[_0x3c96('0x42')][0x9][_0x3c96('0x43')]:undefined)||''},{'name':_0x3c96('0x55'),'value':_0x2ed687['attrChatWebsites']||(_0x2ed687['attrs']&&_0x2ed687[_0x3c96('0x42')][0xa]?_0x2ed687[_0x3c96('0x42')][0xa][_0x3c96('0x43')]:undefined)||''}];case'web-report':return[{'name':_0x3c96('0x5b'),'type':_0x2ed687[_0x3c96('0x5c')]||(_0x2ed687[_0x3c96('0x42')]&&_0x2ed687[_0x3c96('0x42')][0x0]?_0x2ed687[_0x3c96('0x42')][0x0][_0x3c96('0x5d')]:undefined)||null,'value':_0x2ed687[_0x3c96('0x5b')]||(_0x2ed687[_0x3c96('0x42')]&&_0x2ed687[_0x3c96('0x42')][0x0]?_0x2ed687[_0x3c96('0x42')][0x0][_0x3c96('0x43')]:undefined)||null},{'name':_0x3c96('0x5e'),'value':_0x2ed687[_0x3c96('0x5e')]||(_0x2ed687[_0x3c96('0x42')]&&_0x2ed687['attrs'][0x1]?_0x2ed687[_0x3c96('0x42')][0x1][_0x3c96('0x43')]:undefined)||0x0}];default:return[];}}catch(_0x3823a6){logger['error'](_0x3c96('0x5f'),JSON['stringify'](_0x3823a6));return[];}}exports[_0x3c96('0x60')]=function(_0x585cb3,_0x276e00){if(_0x585cb3[_0x3c96('0x61')]){_0x585cb3[_0x3c96('0x61')][_0x3c96('0x42')]=widgetAttributes(_0x585cb3['body']);}return db[_0x3c96('0x33')][_0x3c96('0x60')](_0x585cb3['body'],{})['then'](respondWithResult(_0x276e00,0xc9))[_0x3c96('0x3e')](handleError(_0x276e00,null));};exports[_0x3c96('0x28')]=function(_0x7afe73,_0x53442d){if(_0x7afe73[_0x3c96('0x61')]['id']){delete _0x7afe73['body']['id'];}_0x7afe73[_0x3c96('0x61')][_0x3c96('0x42')]=widgetAttributes(_0x7afe73[_0x3c96('0x61')]);return db[_0x3c96('0x33')]['find']({'where':{'id':_0x7afe73[_0x3c96('0x3f')]['id']}})[_0x3c96('0x29')](handleEntityNotFound(_0x53442d,null))['then'](saveUpdates(_0x7afe73[_0x3c96('0x61')],null))[_0x3c96('0x29')](respondWithResult(_0x53442d,null))['catch'](handleError(_0x53442d,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index 7be9582..54d8185 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 _0x3b77=['events','../../mysqldb','DashboardItem','setMaxListeners','save','update','exports'];(function(_0x37e845,_0x219f9f){var _0x59e55b=function(_0x5dc6c8){while(--_0x5dc6c8){_0x37e845['push'](_0x37e845['shift']());}};_0x59e55b(++_0x219f9f);}(_0x3b77,0x188));var _0x73b7=function(_0x434a81,_0x3e0b4b){_0x434a81=_0x434a81-0x0;var _0x4a488f=_0x3b77[_0x434a81];return _0x4a488f;};'use strict';var EventEmitter=require(_0x73b7('0x0'));var DashboardItem=require(_0x73b7('0x1'))['db'][_0x73b7('0x2')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x73b7('0x3')](0x0);var events={'afterCreate':_0x73b7('0x4'),'afterUpdate':_0x73b7('0x5'),'afterDestroy':'remove'};function emitEvent(_0x56ec6d){return function(_0x27a327,_0x881f24,_0x227c90){DashboardItemEvents['emit'](_0x56ec6d+':'+_0x27a327['id'],_0x27a327);DashboardItemEvents['emit'](_0x56ec6d,_0x27a327);_0x227c90(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];DashboardItem['hook'](e,emitEvent(event));}}module[_0x73b7('0x6')]=DashboardItemEvents; \ No newline at end of file +var _0xbd5f=['DashboardItem','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','events'];(function(_0x470b0a,_0x2889d6){var _0x4463f6=function(_0x2b5f0e){while(--_0x2b5f0e){_0x470b0a['push'](_0x470b0a['shift']());}};_0x4463f6(++_0x2889d6);}(_0xbd5f,0xce));var _0xfbd5=function(_0x474e07,_0x223d57){_0x474e07=_0x474e07-0x0;var _0x53f32b=_0xbd5f[_0x474e07];return _0x53f32b;};'use strict';var EventEmitter=require(_0xfbd5('0x0'));var DashboardItem=require('../../mysqldb')['db'][_0xfbd5('0x1')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0xfbd5('0x2')](0x0);var events={'afterCreate':_0xfbd5('0x3'),'afterUpdate':_0xfbd5('0x4'),'afterDestroy':_0xfbd5('0x5')};function emitEvent(_0x31d1af){return function(_0x57b814,_0x995667,_0x131798){DashboardItemEvents[_0xfbd5('0x6')](_0x31d1af+':'+_0x57b814['id'],_0x57b814);DashboardItemEvents[_0xfbd5('0x6')](_0x31d1af,_0x57b814);_0x131798(null);};}for(var e in events){if(events[_0xfbd5('0x7')](e)){var event=events[e];DashboardItem[_0xfbd5('0x8')](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 b61fdc4..ff509c4 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 _0xb37f=['util','../../config/logger','bluebird','request-promise','../../config/environment','./dashboardItem.attributes','define','DashboardItem','dashboard_items'];(function(_0x5c59d6,_0x456d50){var _0x3f9abe=function(_0x14f373){while(--_0x14f373){_0x5c59d6['push'](_0x5c59d6['shift']());}};_0x3f9abe(++_0x456d50);}(_0xb37f,0x1ef));var _0xfb37=function(_0x49b207,_0x408ade){_0x49b207=_0x49b207-0x0;var _0x2dc8fa=_0xb37f[_0x49b207];return _0x2dc8fa;};'use strict';var _=require('lodash');var util=require(_0xfb37('0x0'));var logger=require(_0xfb37('0x1'))('api');var moment=require('moment');var BPromise=require(_0xfb37('0x2'));var rp=require(_0xfb37('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xfb37('0x4'));var attributes=require(_0xfb37('0x5'));module['exports']=function(_0x5e8e33,_0x2570f9){return _0x5e8e33[_0xfb37('0x6')](_0xfb37('0x7'),attributes,{'tableName':_0xfb37('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x67f0=['lodash','util','../../config/logger','bluebird','request-promise','rimraf','../../config/environment','./dashboardItem.attributes','exports','define','DashboardItem','dashboard_items'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x67f0,0x1b0));var _0x067f=function(_0x3826ad,_0x49a30d){_0x3826ad=_0x3826ad-0x0;var _0x17b900=_0x67f0[_0x3826ad];return _0x17b900;};'use strict';var _=require(_0x067f('0x0'));var util=require(_0x067f('0x1'));var logger=require(_0x067f('0x2'))('api');var moment=require('moment');var BPromise=require(_0x067f('0x3'));var rp=require(_0x067f('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x067f('0x5'));var config=require(_0x067f('0x6'));var attributes=require(_0x067f('0x7'));module[_0x067f('0x8')]=function(_0x2d64d9,_0x5f1c12){return _0x2d64d9[_0x067f('0x9')](_0x067f('0xa'),attributes,{'tableName':_0x067f('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 29f9009..faf0314 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 _0x4588=['redis','defaults','localhost','socket.io-emitter','./dashboardItem.socket','request','then','info','DashboardItem,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http'];(function(_0x19b84f,_0x48765e){var _0x18067b=function(_0x1c69aa){while(--_0x1c69aa){_0x19b84f['push'](_0x19b84f['shift']());}};_0x18067b(++_0x48765e);}(_0x4588,0x162));var _0x8458=function(_0x29c261,_0x3af39a){_0x29c261=_0x29c261-0x0;var _0x1a9335=_0x4588[_0x29c261];return _0x1a9335;};'use strict';var _=require(_0x8458('0x0'));var util=require(_0x8458('0x1'));var moment=require(_0x8458('0x2'));var BPromise=require('bluebird');var rs=require(_0x8458('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8458('0x4'))['db'];var utils=require(_0x8458('0x5'));var logger=require('../../config/logger')(_0x8458('0x6'));var config=require(_0x8458('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x8458('0x8')][_0x8458('0x9')]({'port':0x232a});config[_0x8458('0xa')]=_[_0x8458('0xb')](config[_0x8458('0xa')],{'host':_0x8458('0xc'),'port':0x18eb});var socket=require(_0x8458('0xd'))(new Redis(config[_0x8458('0xa')]));require(_0x8458('0xe'))['register'](socket);function respondWithRpcPromise(_0x209eab,_0x40b00a,_0x16a7b1){return new BPromise(function(_0x492548,_0x25d0d3){return client[_0x8458('0xf')](_0x209eab,_0x16a7b1)[_0x8458('0x10')](function(_0x190dfa){logger[_0x8458('0x11')](_0x8458('0x12'),_0x40b00a,'request\x20sent');logger[_0x8458('0x13')]('DashboardItem,\x20%s,\x20%s,\x20%s',_0x40b00a,_0x8458('0x14'),JSON[_0x8458('0x15')](_0x190dfa));if(_0x190dfa[_0x8458('0x16')]){if(_0x190dfa[_0x8458('0x16')]['code']===0x1f4){logger['error'](_0x8458('0x12'),_0x40b00a,_0x190dfa[_0x8458('0x16')][_0x8458('0x17')]);return _0x25d0d3(_0x190dfa[_0x8458('0x16')][_0x8458('0x17')]);}logger['error'](_0x8458('0x12'),_0x40b00a,_0x190dfa[_0x8458('0x16')][_0x8458('0x17')]);return _0x492548(_0x190dfa[_0x8458('0x16')]['message']);}else{logger[_0x8458('0x11')](_0x8458('0x12'),_0x40b00a,_0x8458('0x14'));_0x492548(_0x190dfa[_0x8458('0x18')][_0x8458('0x17')]);}})[_0x8458('0x19')](function(_0x2bbb9f){logger[_0x8458('0x16')](_0x8458('0x12'),_0x40b00a,_0x2bbb9f);_0x25d0d3(_0x2bbb9f);});});} \ No newline at end of file +var _0x2be1=['result','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','redis','defaults','socket.io-emitter','register','request','then','info','DashboardItem,\x20%s,\x20%s','debug','DashboardItem,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message'];(function(_0x4c12ec,_0x2e9103){var _0x3ae42c=function(_0x5a728f){while(--_0x5a728f){_0x4c12ec['push'](_0x4c12ec['shift']());}};_0x3ae42c(++_0x2e9103);}(_0x2be1,0x1ab));var _0x12be=function(_0x273c39,_0x1052e6){_0x273c39=_0x273c39-0x0;var _0x46d6b5=_0x2be1[_0x273c39];return _0x46d6b5;};'use strict';var _=require('lodash');var util=require(_0x12be('0x0'));var moment=require(_0x12be('0x1'));var BPromise=require(_0x12be('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x12be('0x3'));var db=require(_0x12be('0x4'))['db'];var utils=require(_0x12be('0x5'));var logger=require(_0x12be('0x6'))('rpc');var config=require(_0x12be('0x7'));var jayson=require(_0x12be('0x8'));var client=jayson['client']['http']({'port':0x232a});config[_0x12be('0x9')]=_[_0x12be('0xa')](config[_0x12be('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x12be('0xb'))(new Redis(config[_0x12be('0x9')]));require('./dashboardItem.socket')[_0x12be('0xc')](socket);function respondWithRpcPromise(_0x3fa93e,_0xae8939,_0x554e01){return new BPromise(function(_0x473f0a,_0x2040ae){return client[_0x12be('0xd')](_0x3fa93e,_0x554e01)[_0x12be('0xe')](function(_0x484efa){logger[_0x12be('0xf')](_0x12be('0x10'),_0xae8939,'request\x20sent');logger[_0x12be('0x11')](_0x12be('0x12'),_0xae8939,_0x12be('0x13'),JSON[_0x12be('0x14')](_0x484efa));if(_0x484efa['error']){if(_0x484efa['error']['code']===0x1f4){logger[_0x12be('0x15')](_0x12be('0x10'),_0xae8939,_0x484efa['error'][_0x12be('0x16')]);return _0x2040ae(_0x484efa[_0x12be('0x15')]['message']);}logger[_0x12be('0x15')]('DashboardItem,\x20%s,\x20%s',_0xae8939,_0x484efa['error'][_0x12be('0x16')]);return _0x473f0a(_0x484efa[_0x12be('0x15')][_0x12be('0x16')]);}else{logger[_0x12be('0xf')](_0x12be('0x10'),_0xae8939,'request\x20sent');_0x473f0a(_0x484efa[_0x12be('0x17')][_0x12be('0x16')]);}})[_0x12be('0x18')](function(_0x508f33){logger[_0x12be('0x15')]('DashboardItem,\x20%s,\x20%s',_0xae8939,_0x508f33);_0x2040ae(_0x508f33);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index 140f1d5..75a6fb6 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 _0x9816=['removeListener','register','length','dashboardItem:','save','update','emit'];(function(_0xbb1111,_0x3e6b8e){var _0x3a65d9=function(_0x2462be){while(--_0x2462be){_0xbb1111['push'](_0xbb1111['shift']());}};_0x3a65d9(++_0x3e6b8e);}(_0x9816,0xf9));var _0x6981=function(_0x2578fa,_0x2670af){_0x2578fa=_0x2578fa-0x0;var _0x3ff843=_0x9816[_0x2578fa];return _0x3ff843;};'use strict';var DashboardItemEvents=require('./dashboardItem.events');var events=[_0x6981('0x0'),'remove',_0x6981('0x1')];function createListener(_0xeae6ea,_0xb9b20e){return function(_0x3aff79){_0xb9b20e[_0x6981('0x2')](_0xeae6ea,_0x3aff79);};}function removeListener(_0x1c8293,_0x1d7508){return function(){DashboardItemEvents[_0x6981('0x3')](_0x1c8293,_0x1d7508);};}exports[_0x6981('0x4')]=function(_0x5db7f5){for(var _0x45c85d=0x0,_0x37e60d=events[_0x6981('0x5')];_0x45c85d<_0x37e60d;_0x45c85d++){var _0xd1e3d5=events[_0x45c85d];var _0x594514=createListener(_0x6981('0x6')+_0xd1e3d5,_0x5db7f5);DashboardItemEvents['on'](_0xd1e3d5,_0x594514);}}; \ No newline at end of file +var _0xa46a=['save','remove','register','length','./dashboardItem.events'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0xa46a,0x185));var _0xaa46=function(_0x49e454,_0x22328f){_0x49e454=_0x49e454-0x0;var _0x21d045=_0xa46a[_0x49e454];return _0x21d045;};'use strict';var DashboardItemEvents=require(_0xaa46('0x0'));var events=[_0xaa46('0x1'),_0xaa46('0x2'),'update'];function createListener(_0x149443,_0x15b07c){return function(_0x21fa9f){_0x15b07c['emit'](_0x149443,_0x21fa9f);};}function removeListener(_0x47456d,_0x292c57){return function(){DashboardItemEvents['removeListener'](_0x47456d,_0x292c57);};}exports[_0xaa46('0x3')]=function(_0xa1409d){for(var _0xca7842=0x0,_0x488fb5=events[_0xaa46('0x4')];_0xca7842<_0x488fb5;_0xca7842++){var _0x25d18e=events[_0xca7842];var _0x4aca2a=createListener('dashboardItem:'+_0x25d18e,_0xa1409d);DashboardItemEvents['on'](_0x25d18e,_0x4aca2a);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index 5827fd7..64c8fe5 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 _0x98d0=['put','update','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./dashboardItem.controller','get','/:id','isAuthenticated','show','post','create'];(function(_0x555ed9,_0x2fce76){var _0x4dec3b=function(_0x3f68a8){while(--_0x3f68a8){_0x555ed9['push'](_0x555ed9['shift']());}};_0x4dec3b(++_0x2fce76);}(_0x98d0,0x113));var _0x098d=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x98d0[_0x14add3];return _0x4a174f;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x098d('0x0'));var timeout=require(_0x098d('0x1'));var express=require(_0x098d('0x2'));var router=express[_0x098d('0x3')]();var fs_extra=require(_0x098d('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x098d('0x5'));var config=require('../../config/environment');var controller=require(_0x098d('0x6'));router[_0x098d('0x7')](_0x098d('0x8'),auth[_0x098d('0x9')](),controller[_0x098d('0xa')]);router[_0x098d('0xb')]('/',auth[_0x098d('0x9')](),controller[_0x098d('0xc')]);router[_0x098d('0xd')](_0x098d('0x8'),auth[_0x098d('0x9')](),controller[_0x098d('0xe')]);router[_0x098d('0xf')](_0x098d('0x8'),auth[_0x098d('0x9')](),controller[_0x098d('0x10')]);module[_0x098d('0x11')]=router; \ No newline at end of file +var _0x2fb3=['../../config/environment','./dashboardItem.controller','get','/:id','isAuthenticated','show','update','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x2a553f,_0x4c9c9c){var _0x22813b=function(_0x536a6f){while(--_0x536a6f){_0x2a553f['push'](_0x2a553f['shift']());}};_0x22813b(++_0x4c9c9c);}(_0x2fb3,0x1ac));var _0x32fb=function(_0x234d61,_0x4db79d){_0x234d61=_0x234d61-0x0;var _0x736d50=_0x2fb3[_0x234d61];return _0x736d50;};'use strict';var multer=require(_0x32fb('0x0'));var util=require(_0x32fb('0x1'));var path=require(_0x32fb('0x2'));var timeout=require(_0x32fb('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x32fb('0x4'));var auth=require(_0x32fb('0x5'));var interaction=require(_0x32fb('0x6'));var config=require(_0x32fb('0x7'));var controller=require(_0x32fb('0x8'));router[_0x32fb('0x9')](_0x32fb('0xa'),auth[_0x32fb('0xb')](),controller[_0x32fb('0xc')]);router['post']('/',auth[_0x32fb('0xb')](),controller['create']);router['put'](_0x32fb('0xa'),auth[_0x32fb('0xb')](),controller[_0x32fb('0xd')]);router['delete']('/:id',auth[_0x32fb('0xb')](),controller['destroy']);module[_0x32fb('0xe')]=router; \ No newline at end of file diff --git a/server/api/disposition/disposition.attributes.js b/server/api/disposition/disposition.attributes.js index 23b0060..71f63cc 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 _0xb797=['second','third','sequelize','exports','STRING','first'];(function(_0x3131e0,_0x194e1c){var _0x376301=function(_0x1c544b){while(--_0x1c544b){_0x3131e0['push'](_0x3131e0['shift']());}};_0x376301(++_0x194e1c);}(_0xb797,0x128));var _0x7b79=function(_0x385024,_0x39a084){_0x385024=_0x385024-0x0;var _0x39927a=_0xb797[_0x385024];return _0x39927a;};'use strict';var Sequelize=require(_0x7b79('0x0'));module[_0x7b79('0x1')]={'name':{'type':Sequelize[_0x7b79('0x2')],'allowNull':![]},'level':{'type':Sequelize['ENUM'](_0x7b79('0x3'),_0x7b79('0x4'),_0x7b79('0x5')),'allowNull':![],'defaultValue':_0x7b79('0x3')},'description':{'type':Sequelize[_0x7b79('0x2')]}}; \ No newline at end of file +var _0x75c1=['second','third','STRING','sequelize','exports','first'];(function(_0x2c9b38,_0x32bf30){var _0x511531=function(_0x2b7ade){while(--_0x2b7ade){_0x2c9b38['push'](_0x2c9b38['shift']());}};_0x511531(++_0x32bf30);}(_0x75c1,0x105));var _0x175c=function(_0x1e3386,_0x2e9745){_0x1e3386=_0x1e3386-0x0;var _0x5eb847=_0x75c1[_0x1e3386];return _0x5eb847;};'use strict';var Sequelize=require(_0x175c('0x0'));module[_0x175c('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'level':{'type':Sequelize['ENUM'](_0x175c('0x2'),_0x175c('0x3'),_0x175c('0x4')),'allowNull':![],'defaultValue':_0x175c('0x2')},'description':{'type':Sequelize[_0x175c('0x5')]}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index f7bf2f5..ba6ed46 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 _0x02ca=['path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','get','error','stack','name','send','map','Disposition','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','filter','includeAll','findAll','rows','params','include','find','catch','create','body','role','Dispositions','UserProfileSection','userProfileId','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util'];(function(_0x3b7562,_0x2af0c6){var _0x5e331f=function(_0x3a92ba){while(--_0x3a92ba){_0x3b7562['push'](_0x3b7562['shift']());}};_0x5e331f(++_0x2af0c6);}(_0x02ca,0x97));var _0xa02c=function(_0x2f8a98,_0x4f426e){_0x2f8a98=_0x2f8a98-0x0;var _0x21179d=_0x02ca[_0x2f8a98];return _0x21179d;};'use strict';var emlformat=require(_0xa02c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa02c('0x1'));var jsonpatch=require(_0xa02c('0x2'));var rp=require(_0xa02c('0x3'));var moment=require(_0xa02c('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xa02c('0x5'));var util=require(_0xa02c('0x6'));var path=require(_0xa02c('0x7'));var sox=require(_0xa02c('0x8'));var csv=require(_0xa02c('0x9'));var ejs=require(_0xa02c('0xa'));var fs=require('fs');var fs_extra=require(_0xa02c('0xb'));var _=require(_0xa02c('0xc'));var squel=require(_0xa02c('0xd'));var crypto=require(_0xa02c('0xe'));var jsforce=require(_0xa02c('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xa02c('0x9'));var querystring=require(_0xa02c('0x10'));var Papa=require(_0xa02c('0x11'));var Redis=require(_0xa02c('0x12'));var authService=require(_0xa02c('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xa02c('0x14'));var utils=require(_0xa02c('0x15'));var config=require(_0xa02c('0x16'));var licenseUtil=require(_0xa02c('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x456fd5,_0x3719d4){_0x3719d4=_0x3719d4||0xcc;return function(_0x9cb7ba){if(_0x9cb7ba){return _0x456fd5[_0xa02c('0x18')](_0x3719d4);}return _0x456fd5['status'](_0x3719d4)[_0xa02c('0x19')]();};}function respondWithResult(_0xefaee9,_0x3b24e5){_0x3b24e5=_0x3b24e5||0xc8;return function(_0x546729){if(_0x546729){return _0xefaee9[_0xa02c('0x1a')](_0x3b24e5)[_0xa02c('0x1b')](_0x546729);}};}function respondWithFilteredResult(_0x5eeece,_0x35f533){return function(_0x2a3604){if(_0x2a3604){var _0x4bc36d=typeof _0x35f533[_0xa02c('0x1c')]===_0xa02c('0x1d')&&typeof _0x35f533[_0xa02c('0x1e')]==='undefined';var _0x3c1bba=_0x2a3604['count'];var _0x4d7cb5=_0x4bc36d?0x0:_0x35f533['offset'];var _0x3fcc66=_0x4bc36d?_0x2a3604[_0xa02c('0x1f')]:_0x35f533[_0xa02c('0x1c')]+_0x35f533['limit'];var _0x12688a;if(_0x3fcc66>=_0x3c1bba){_0x3fcc66=_0x3c1bba;_0x12688a=0xc8;}else{_0x12688a=0xce;}_0x5eeece['status'](_0x12688a);return _0x5eeece[_0xa02c('0x20')](_0xa02c('0x21'),_0x4d7cb5+'-'+_0x3fcc66+'/'+_0x3c1bba)[_0xa02c('0x1b')](_0x2a3604);}return null;};}function patchUpdates(_0x476777){return function(_0x56406d){try{jsonpatch[_0xa02c('0x22')](_0x56406d,_0x476777,!![]);}catch(_0x4fb1db){return BPromise[_0xa02c('0x23')](_0x4fb1db);}return _0x56406d[_0xa02c('0x24')]();};}function saveUpdates(_0x45f7b0,_0x5b10b4){return function(_0x4787c7){if(_0x4787c7){return _0x4787c7['update'](_0x45f7b0)[_0xa02c('0x25')](function(_0x2ee242){return _0x2ee242;});}return null;};}function removeEntity(_0x2e4e9d,_0x514ef1){return function(_0x4ba050){if(_0x4ba050){return _0x4ba050[_0xa02c('0x26')]()[_0xa02c('0x25')](function(){var _0x41e4ab=_0x4ba050[_0xa02c('0x27')]({'plain':!![]});var _0x437308='Dispositions';return db['UserProfileResource'][_0xa02c('0x26')]({'where':{'type':_0x437308,'resourceId':_0x41e4ab['id']}})[_0xa02c('0x25')](function(){return _0x4ba050;});})[_0xa02c('0x25')](function(){_0x2e4e9d[_0xa02c('0x1a')](0xcc)[_0xa02c('0x19')]();});}};}function handleEntityNotFound(_0x3f4e0d,_0x279d79){return function(_0x419037){if(!_0x419037){_0x3f4e0d['sendStatus'](0x194);}return _0x419037;};}function handleError(_0x3c8391,_0x1e3d9d){_0x1e3d9d=_0x1e3d9d||0x1f4;return function(_0x31b520){logger[_0xa02c('0x28')](_0x31b520[_0xa02c('0x29')]);if(_0x31b520[_0xa02c('0x2a')]){delete _0x31b520[_0xa02c('0x2a')];}_0x3c8391[_0xa02c('0x1a')](_0x1e3d9d)[_0xa02c('0x2b')](_0x31b520);};}exports['index']=function(_0x116baa,_0xb9f91){var _0x279410={},_0x4de1ac={},_0x58542a={'count':0x0,'rows':[]};var _0x186fe9=_[_0xa02c('0x2c')](db[_0xa02c('0x2d')][_0xa02c('0x2e')],function(_0x7a3b21){return{'name':_0x7a3b21[_0xa02c('0x2f')],'type':_0x7a3b21[_0xa02c('0x30')][_0xa02c('0x31')]};});_0x4de1ac[_0xa02c('0x32')]=_[_0xa02c('0x2c')](_0x186fe9,'name');_0x4de1ac['query']=_[_0xa02c('0x33')](_0x116baa[_0xa02c('0x34')]);_0x4de1ac[_0xa02c('0x35')]=_[_0xa02c('0x36')](_0x4de1ac[_0xa02c('0x32')],_0x4de1ac[_0xa02c('0x34')]);_0x279410[_0xa02c('0x37')]=_[_0xa02c('0x36')](_0x4de1ac[_0xa02c('0x32')],qs[_0xa02c('0x38')](_0x116baa[_0xa02c('0x34')]['fields']));_0x279410[_0xa02c('0x37')]=_0x279410[_0xa02c('0x37')][_0xa02c('0x39')]?_0x279410[_0xa02c('0x37')]:_0x4de1ac['model'];if(!_0x116baa['query'][_0xa02c('0x3a')](_0xa02c('0x3b'))){_0x279410['limit']=qs['limit'](_0x116baa['query']['limit']);_0x279410[_0xa02c('0x1c')]=qs[_0xa02c('0x1c')](_0x116baa[_0xa02c('0x34')][_0xa02c('0x1c')]);}_0x279410['order']=qs[_0xa02c('0x3c')](_0x116baa[_0xa02c('0x34')][_0xa02c('0x3c')]);_0x279410[_0xa02c('0x3d')]=qs[_0xa02c('0x35')](_[_0xa02c('0x3e')](_0x116baa[_0xa02c('0x34')],_0x4de1ac[_0xa02c('0x35')]),_0x186fe9);if(_0x116baa['query']['filter']){_0x279410[_0xa02c('0x3d')]=_[_0xa02c('0x3f')](_0x279410[_0xa02c('0x3d')],{'$or':_[_0xa02c('0x2c')](_0x186fe9,function(_0x1f32f3){if(_0x1f32f3[_0xa02c('0x30')]!==_0xa02c('0x40')){var _0x4bfccc={};_0x4bfccc[_0x1f32f3[_0xa02c('0x2a')]]={'$like':'%'+_0x116baa[_0xa02c('0x34')][_0xa02c('0x41')]+'%'};return _0x4bfccc;}})});}_0x279410=_[_0xa02c('0x3f')]({},_0x279410,_0x116baa['options']);var _0x589b2f={'where':_0x279410[_0xa02c('0x3d')]};return db[_0xa02c('0x2d')][_0xa02c('0x1f')](_0x589b2f)['then'](function(_0x5d2ca0){_0x58542a[_0xa02c('0x1f')]=_0x5d2ca0;if(_0x116baa['query'][_0xa02c('0x42')]){_0x279410['include']=[{'all':!![]}];}return db[_0xa02c('0x2d')][_0xa02c('0x43')](_0x279410);})['then'](function(_0x4a84c4){_0x58542a[_0xa02c('0x44')]=_0x4a84c4;return _0x58542a;})['then'](respondWithFilteredResult(_0xb9f91,_0x279410))['catch'](handleError(_0xb9f91,null));};exports['show']=function(_0x12406f,_0x5da342){var _0x56a375={'raw':!![],'where':{'id':_0x12406f[_0xa02c('0x45')]['id']}},_0x3a19da={};_0x3a19da[_0xa02c('0x32')]=_[_0xa02c('0x33')](db[_0xa02c('0x2d')]['rawAttributes']);_0x3a19da[_0xa02c('0x34')]=_[_0xa02c('0x33')](_0x12406f[_0xa02c('0x34')]);_0x3a19da[_0xa02c('0x35')]=_['intersection'](_0x3a19da[_0xa02c('0x32')],_0x3a19da[_0xa02c('0x34')]);_0x56a375[_0xa02c('0x37')]=_[_0xa02c('0x36')](_0x3a19da['model'],qs[_0xa02c('0x38')](_0x12406f[_0xa02c('0x34')]['fields']));_0x56a375[_0xa02c('0x37')]=_0x56a375[_0xa02c('0x37')][_0xa02c('0x39')]?_0x56a375['attributes']:_0x3a19da[_0xa02c('0x32')];if(_0x12406f[_0xa02c('0x34')][_0xa02c('0x42')]){_0x56a375[_0xa02c('0x46')]=[{'all':!![]}];}_0x56a375=_[_0xa02c('0x3f')]({},_0x56a375,_0x12406f['options']);return db['Disposition'][_0xa02c('0x47')](_0x56a375)[_0xa02c('0x25')](handleEntityNotFound(_0x5da342,null))[_0xa02c('0x25')](respondWithResult(_0x5da342,null))[_0xa02c('0x48')](handleError(_0x5da342,null));};exports[_0xa02c('0x49')]=function(_0x128a87,_0x538df7){return db[_0xa02c('0x2d')][_0xa02c('0x49')](_0x128a87[_0xa02c('0x4a')],{})[_0xa02c('0x25')](function(_0x3e4d59){var _0x131c95=_0x128a87['user']['get']({'plain':!![]});if(!_0x131c95)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x131c95[_0xa02c('0x4b')]==='user'){var _0x115c9f=_0x3e4d59[_0xa02c('0x27')]({'plain':!![]});var _0xb4292e=_0xa02c('0x4c');return db[_0xa02c('0x4d')][_0xa02c('0x47')]({'where':{'name':_0xb4292e,'userProfileId':_0x131c95[_0xa02c('0x4e')]},'raw':!![]})['then'](function(_0x393b36){if(_0x393b36&&_0x393b36['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x115c9f[_0xa02c('0x2a')],'resourceId':_0x115c9f['id'],'type':_0x393b36['name'],'sectionId':_0x393b36['id']},{})[_0xa02c('0x25')](function(){return _0x3e4d59;});}else{return _0x3e4d59;}})['catch'](function(_0x313d77){logger[_0xa02c('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x313d77);throw _0x313d77;});}return _0x3e4d59;})[_0xa02c('0x25')](respondWithResult(_0x538df7,0xc9))['catch'](handleError(_0x538df7,null));};exports['update']=function(_0xf9b510,_0x3b2bdd){if(_0xf9b510[_0xa02c('0x4a')]['id']){delete _0xf9b510['body']['id'];}return db['Disposition'][_0xa02c('0x47')]({'where':{'id':_0xf9b510[_0xa02c('0x45')]['id']}})[_0xa02c('0x25')](handleEntityNotFound(_0x3b2bdd,null))[_0xa02c('0x25')](saveUpdates(_0xf9b510['body'],null))[_0xa02c('0x25')](respondWithResult(_0x3b2bdd,null))['catch'](handleError(_0x3b2bdd,null));};exports['destroy']=function(_0x4389d7,_0x3038c0){return db[_0xa02c('0x2d')][_0xa02c('0x47')]({'where':{'id':_0x4389d7[_0xa02c('0x45')]['id']}})[_0xa02c('0x25')](handleEntityNotFound(_0x3038c0,null))[_0xa02c('0x25')](removeEntity(_0x3038c0,null))[_0xa02c('0x48')](handleError(_0x3038c0,null));}; \ No newline at end of file +var _0x4330=['../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','get','Dispositions','UserProfileResource','stack','name','send','index','map','Disposition','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','length','attributes','sort','where','pick','filter','merge','include','findAll','rows','catch','show','params','includeAll','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','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'];(function(_0x36eaaa,_0x326732){var _0x461349=function(_0x4e4180){while(--_0x4e4180){_0x36eaaa['push'](_0x36eaaa['shift']());}};_0x461349(++_0x326732);}(_0x4330,0x13d));var _0x0433=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0x4330[_0xae7c2f];return _0x5d7001;};'use strict';var emlformat=require(_0x0433('0x0'));var rimraf=require(_0x0433('0x1'));var zipdir=require(_0x0433('0x2'));var jsonpatch=require(_0x0433('0x3'));var rp=require(_0x0433('0x4'));var moment=require(_0x0433('0x5'));var BPromise=require(_0x0433('0x6'));var Mustache=require(_0x0433('0x7'));var util=require(_0x0433('0x8'));var path=require(_0x0433('0x9'));var sox=require(_0x0433('0xa'));var csv=require(_0x0433('0xb'));var ejs=require(_0x0433('0xc'));var fs=require('fs');var fs_extra=require(_0x0433('0xd'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x0433('0xe'));var jsforce=require(_0x0433('0xf'));var deskjs=require(_0x0433('0x10'));var toCsv=require(_0x0433('0xb'));var querystring=require(_0x0433('0x11'));var Papa=require('papaparse');var Redis=require(_0x0433('0x12'));var authService=require(_0x0433('0x13'));var qs=require(_0x0433('0x14'));var as=require(_0x0433('0x15'));var hardwareService=require(_0x0433('0x16'));var logger=require(_0x0433('0x17'))('api');var utils=require(_0x0433('0x18'));var config=require(_0x0433('0x19'));var licenseUtil=require(_0x0433('0x1a'));var db=require(_0x0433('0x1b'))['db'];function respondWithStatusCode(_0x49a14e,_0x5a1edc){_0x5a1edc=_0x5a1edc||0xcc;return function(_0x5b629e){if(_0x5b629e){return _0x49a14e[_0x0433('0x1c')](_0x5a1edc);}return _0x49a14e[_0x0433('0x1d')](_0x5a1edc)[_0x0433('0x1e')]();};}function respondWithResult(_0x562a4e,_0x2203f4){_0x2203f4=_0x2203f4||0xc8;return function(_0x219cde){if(_0x219cde){return _0x562a4e[_0x0433('0x1d')](_0x2203f4)[_0x0433('0x1f')](_0x219cde);}};}function respondWithFilteredResult(_0x3cb569,_0x343c5a){return function(_0x10ab77){if(_0x10ab77){var _0x3cf0e8=typeof _0x343c5a[_0x0433('0x20')]===_0x0433('0x21')&&typeof _0x343c5a[_0x0433('0x22')]===_0x0433('0x21');var _0x4ab561=_0x10ab77[_0x0433('0x23')];var _0x5accf5=_0x3cf0e8?0x0:_0x343c5a['offset'];var _0x2dccbc=_0x3cf0e8?_0x10ab77[_0x0433('0x23')]:_0x343c5a[_0x0433('0x20')]+_0x343c5a['limit'];var _0x11002e;if(_0x2dccbc>=_0x4ab561){_0x2dccbc=_0x4ab561;_0x11002e=0xc8;}else{_0x11002e=0xce;}_0x3cb569[_0x0433('0x1d')](_0x11002e);return _0x3cb569[_0x0433('0x24')](_0x0433('0x25'),_0x5accf5+'-'+_0x2dccbc+'/'+_0x4ab561)['json'](_0x10ab77);}return null;};}function patchUpdates(_0x3e09cd){return function(_0x30bca5){try{jsonpatch[_0x0433('0x26')](_0x30bca5,_0x3e09cd,!![]);}catch(_0x38d1d4){return BPromise[_0x0433('0x27')](_0x38d1d4);}return _0x30bca5['save']();};}function saveUpdates(_0x5048a1,_0x55bdba){return function(_0x7577b0){if(_0x7577b0){return _0x7577b0[_0x0433('0x28')](_0x5048a1)[_0x0433('0x29')](function(_0x272b91){return _0x272b91;});}return null;};}function removeEntity(_0x956d,_0x32e035){return function(_0x36bd8b){if(_0x36bd8b){return _0x36bd8b[_0x0433('0x2a')]()[_0x0433('0x29')](function(){var _0x24f1e2=_0x36bd8b[_0x0433('0x2b')]({'plain':!![]});var _0x5007a9=_0x0433('0x2c');return db[_0x0433('0x2d')]['destroy']({'where':{'type':_0x5007a9,'resourceId':_0x24f1e2['id']}})['then'](function(){return _0x36bd8b;});})[_0x0433('0x29')](function(){_0x956d[_0x0433('0x1d')](0xcc)[_0x0433('0x1e')]();});}};}function handleEntityNotFound(_0x2237da,_0x14cf16){return function(_0x18b840){if(!_0x18b840){_0x2237da[_0x0433('0x1c')](0x194);}return _0x18b840;};}function handleError(_0x2d08cf,_0x3b6f39){_0x3b6f39=_0x3b6f39||0x1f4;return function(_0x3ae499){logger['error'](_0x3ae499[_0x0433('0x2e')]);if(_0x3ae499[_0x0433('0x2f')]){delete _0x3ae499[_0x0433('0x2f')];}_0x2d08cf['status'](_0x3b6f39)[_0x0433('0x30')](_0x3ae499);};}exports[_0x0433('0x31')]=function(_0x3df239,_0x2d47b8){var _0x338c4e={},_0xc2aa92={},_0x115c72={'count':0x0,'rows':[]};var _0x18dc44=_[_0x0433('0x32')](db[_0x0433('0x33')][_0x0433('0x34')],function(_0x21da5d){return{'name':_0x21da5d[_0x0433('0x35')],'type':_0x21da5d[_0x0433('0x36')][_0x0433('0x37')]};});_0xc2aa92[_0x0433('0x38')]=_['map'](_0x18dc44,_0x0433('0x2f'));_0xc2aa92['query']=_[_0x0433('0x39')](_0x3df239[_0x0433('0x3a')]);_0xc2aa92[_0x0433('0x3b')]=_['intersection'](_0xc2aa92[_0x0433('0x38')],_0xc2aa92[_0x0433('0x3a')]);_0x338c4e['attributes']=_[_0x0433('0x3c')](_0xc2aa92['model'],qs['fields'](_0x3df239[_0x0433('0x3a')][_0x0433('0x3d')]));_0x338c4e['attributes']=_0x338c4e['attributes'][_0x0433('0x3e')]?_0x338c4e[_0x0433('0x3f')]:_0xc2aa92[_0x0433('0x38')];if(!_0x3df239[_0x0433('0x3a')]['hasOwnProperty']('nolimit')){_0x338c4e[_0x0433('0x22')]=qs[_0x0433('0x22')](_0x3df239[_0x0433('0x3a')][_0x0433('0x22')]);_0x338c4e['offset']=qs[_0x0433('0x20')](_0x3df239[_0x0433('0x3a')][_0x0433('0x20')]);}_0x338c4e['order']=qs[_0x0433('0x40')](_0x3df239[_0x0433('0x3a')][_0x0433('0x40')]);_0x338c4e[_0x0433('0x41')]=qs[_0x0433('0x3b')](_[_0x0433('0x42')](_0x3df239[_0x0433('0x3a')],_0xc2aa92['filters']),_0x18dc44);if(_0x3df239[_0x0433('0x3a')][_0x0433('0x43')]){_0x338c4e[_0x0433('0x41')]=_['merge'](_0x338c4e[_0x0433('0x41')],{'$or':_[_0x0433('0x32')](_0x18dc44,function(_0x30851b){if(_0x30851b['type']!=='VIRTUAL'){var _0x192f5c={};_0x192f5c[_0x30851b['name']]={'$like':'%'+_0x3df239[_0x0433('0x3a')][_0x0433('0x43')]+'%'};return _0x192f5c;}})});}_0x338c4e=_[_0x0433('0x44')]({},_0x338c4e,_0x3df239['options']);var _0x4f45e5={'where':_0x338c4e[_0x0433('0x41')]};return db[_0x0433('0x33')][_0x0433('0x23')](_0x4f45e5)[_0x0433('0x29')](function(_0xd628b7){_0x115c72[_0x0433('0x23')]=_0xd628b7;if(_0x3df239[_0x0433('0x3a')]['includeAll']){_0x338c4e[_0x0433('0x45')]=[{'all':!![]}];}return db['Disposition'][_0x0433('0x46')](_0x338c4e);})[_0x0433('0x29')](function(_0x582187){_0x115c72[_0x0433('0x47')]=_0x582187;return _0x115c72;})[_0x0433('0x29')](respondWithFilteredResult(_0x2d47b8,_0x338c4e))[_0x0433('0x48')](handleError(_0x2d47b8,null));};exports[_0x0433('0x49')]=function(_0x4ac64b,_0x5c0a49){var _0x232f28={'raw':!![],'where':{'id':_0x4ac64b[_0x0433('0x4a')]['id']}},_0x1ac739={};_0x1ac739[_0x0433('0x38')]=_[_0x0433('0x39')](db[_0x0433('0x33')][_0x0433('0x34')]);_0x1ac739['query']=_['keys'](_0x4ac64b[_0x0433('0x3a')]);_0x1ac739[_0x0433('0x3b')]=_[_0x0433('0x3c')](_0x1ac739['model'],_0x1ac739[_0x0433('0x3a')]);_0x232f28[_0x0433('0x3f')]=_[_0x0433('0x3c')](_0x1ac739[_0x0433('0x38')],qs['fields'](_0x4ac64b['query'][_0x0433('0x3d')]));_0x232f28[_0x0433('0x3f')]=_0x232f28[_0x0433('0x3f')][_0x0433('0x3e')]?_0x232f28[_0x0433('0x3f')]:_0x1ac739[_0x0433('0x38')];if(_0x4ac64b[_0x0433('0x3a')][_0x0433('0x4b')]){_0x232f28[_0x0433('0x45')]=[{'all':!![]}];}_0x232f28=_[_0x0433('0x44')]({},_0x232f28,_0x4ac64b[_0x0433('0x4c')]);return db['Disposition']['find'](_0x232f28)[_0x0433('0x29')](handleEntityNotFound(_0x5c0a49,null))[_0x0433('0x29')](respondWithResult(_0x5c0a49,null))[_0x0433('0x48')](handleError(_0x5c0a49,null));};exports['create']=function(_0x3df294,_0x58fbc4){return db[_0x0433('0x33')][_0x0433('0x4d')](_0x3df294[_0x0433('0x4e')],{})[_0x0433('0x29')](function(_0xcb250d){var _0x464248=_0x3df294[_0x0433('0x4f')]['get']({'plain':!![]});if(!_0x464248)throw new Error(_0x0433('0x50'));if(_0x464248[_0x0433('0x51')]===_0x0433('0x4f')){var _0x1c82cc=_0xcb250d[_0x0433('0x2b')]({'plain':!![]});var _0x7d7b66=_0x0433('0x2c');return db[_0x0433('0x52')][_0x0433('0x53')]({'where':{'name':_0x7d7b66,'userProfileId':_0x464248['userProfileId']},'raw':!![]})[_0x0433('0x29')](function(_0x1f5a70){if(_0x1f5a70&&_0x1f5a70['autoAssociation']===0x0){return db[_0x0433('0x2d')][_0x0433('0x4d')]({'name':_0x1c82cc['name'],'resourceId':_0x1c82cc['id'],'type':_0x1f5a70['name'],'sectionId':_0x1f5a70['id']},{})[_0x0433('0x29')](function(){return _0xcb250d;});}else{return _0xcb250d;}})['catch'](function(_0x5afb79){logger[_0x0433('0x54')](_0x0433('0x55'),_0x5afb79);throw _0x5afb79;});}return _0xcb250d;})[_0x0433('0x29')](respondWithResult(_0x58fbc4,0xc9))[_0x0433('0x48')](handleError(_0x58fbc4,null));};exports[_0x0433('0x28')]=function(_0x137960,_0x131a48){if(_0x137960['body']['id']){delete _0x137960[_0x0433('0x4e')]['id'];}return db[_0x0433('0x33')][_0x0433('0x53')]({'where':{'id':_0x137960[_0x0433('0x4a')]['id']}})[_0x0433('0x29')](handleEntityNotFound(_0x131a48,null))[_0x0433('0x29')](saveUpdates(_0x137960[_0x0433('0x4e')],null))['then'](respondWithResult(_0x131a48,null))[_0x0433('0x48')](handleError(_0x131a48,null));};exports[_0x0433('0x2a')]=function(_0x113c13,_0xb31d86){return db[_0x0433('0x33')]['find']({'where':{'id':_0x113c13[_0x0433('0x4a')]['id']}})['then'](handleEntityNotFound(_0xb31d86,null))['then'](removeEntity(_0xb31d86,null))[_0x0433('0x48')](handleError(_0xb31d86,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index cee2724..530ee57 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 _0x7025=['FaxAccountId','name_openchannel','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./disposition.attributes','exports','define','tools_dispositions','name_voice','name','ListId','ChatWebsiteId','name_mail','MailAccountId','name_sms','SmsAccountId','name_fax'];(function(_0x4b0180,_0x50af2a){var _0x387e80=function(_0x1607f0){while(--_0x1607f0){_0x4b0180['push'](_0x4b0180['shift']());}};_0x387e80(++_0x50af2a);}(_0x7025,0x182));var _0x5702=function(_0x4dd245,_0x1f4e37){_0x4dd245=_0x4dd245-0x0;var _0xa4c74=_0x7025[_0x4dd245];return _0xa4c74;};'use strict';var _=require(_0x5702('0x0'));var util=require(_0x5702('0x1'));var logger=require(_0x5702('0x2'))('api');var moment=require(_0x5702('0x3'));var BPromise=require(_0x5702('0x4'));var rp=require(_0x5702('0x5'));var fs=require('fs');var path=require(_0x5702('0x6'));var rimraf=require(_0x5702('0x7'));var config=require(_0x5702('0x8'));var attributes=require(_0x5702('0x9'));module[_0x5702('0xa')]=function(_0x148929,_0x21b2ce){return _0x148929[_0x5702('0xb')]('Disposition',attributes,{'tableName':_0x5702('0xc'),'paranoid':![],'indexes':[{'unique':!![],'name':_0x5702('0xd'),'fields':[_0x5702('0xe'),_0x5702('0xf')]},{'unique':!![],'name':'name_chat','fields':[_0x5702('0xe'),_0x5702('0x10')]},{'unique':!![],'name':_0x5702('0x11'),'fields':['name',_0x5702('0x12')]},{'unique':!![],'name':_0x5702('0x13'),'fields':['name',_0x5702('0x14')]},{'unique':!![],'name':_0x5702('0x15'),'fields':[_0x5702('0xe'),_0x5702('0x16')]},{'unique':!![],'name':_0x5702('0x17'),'fields':[_0x5702('0xe'),'OpenchannelAccountId']},{'unique':!![],'name':'name_whatsapp','fields':[_0x5702('0xe'),'WhatsappAccountId']}],'timestamps':!![]});}; \ No newline at end of file +var _0x0068=['name_sms','name_fax','FaxAccountId','name_openchannel','OpenchannelAccountId','name_whatsapp','WhatsappAccountId','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./disposition.attributes','exports','define','Disposition','tools_dispositions','name_voice','name_chat','ChatWebsiteId','name_mail','name'];(function(_0x15942a,_0x13b58c){var _0x36a9fb=function(_0x549c27){while(--_0x549c27){_0x15942a['push'](_0x15942a['shift']());}};_0x36a9fb(++_0x13b58c);}(_0x0068,0x14c));var _0x8006=function(_0x4064b9,_0x11a61c){_0x4064b9=_0x4064b9-0x0;var _0x2e28d6=_0x0068[_0x4064b9];return _0x2e28d6;};'use strict';var _=require(_0x8006('0x0'));var util=require('util');var logger=require(_0x8006('0x1'))('api');var moment=require(_0x8006('0x2'));var BPromise=require(_0x8006('0x3'));var rp=require(_0x8006('0x4'));var fs=require('fs');var path=require(_0x8006('0x5'));var rimraf=require(_0x8006('0x6'));var config=require(_0x8006('0x7'));var attributes=require(_0x8006('0x8'));module[_0x8006('0x9')]=function(_0x5e1149,_0x4086d6){return _0x5e1149[_0x8006('0xa')](_0x8006('0xb'),attributes,{'tableName':_0x8006('0xc'),'paranoid':![],'indexes':[{'unique':!![],'name':_0x8006('0xd'),'fields':['name','ListId']},{'unique':!![],'name':_0x8006('0xe'),'fields':['name',_0x8006('0xf')]},{'unique':!![],'name':_0x8006('0x10'),'fields':[_0x8006('0x11'),'MailAccountId']},{'unique':!![],'name':_0x8006('0x12'),'fields':['name','SmsAccountId']},{'unique':!![],'name':_0x8006('0x13'),'fields':['name',_0x8006('0x14')]},{'unique':!![],'name':_0x8006('0x15'),'fields':[_0x8006('0x11'),_0x8006('0x16')]},{'unique':!![],'name':_0x8006('0x17'),'fields':[_0x8006('0x11'),_0x8006('0x18')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index 100efb7..0a1023a 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(_0x30511f,_0x251f02){var _0xf678ec=function(_0x2b16b6){while(--_0x2b16b6){_0x30511f['push'](_0x30511f['shift']());}};_0xf678ec(++_0x251f02);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4b7b62,_0x4920a9){_0x4b7b62=_0x4b7b62-0x0;var _0x2280df=_0xa9e0[_0x4b7b62];return _0x2280df;};'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(_0x56443e,_0x5320f6){var _0x29b28d=function(_0x3adfbc){while(--_0x3adfbc){_0x56443e['push'](_0x56443e['shift']());}};_0x29b28d(++_0x5320f6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0xa9e0[_0x2b10c6];return _0x3789d2;};'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 7c55add..d85b4c1 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 _0x8d02=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','post','create','exports','multer','path'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x8d02,0x85));var _0x28d0=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x8d02[_0x1facfa];return _0x9ec701;};'use strict';var multer=require(_0x28d0('0x0'));var util=require('util');var path=require(_0x28d0('0x1'));var timeout=require(_0x28d0('0x2'));var express=require(_0x28d0('0x3'));var router=express[_0x28d0('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x28d0('0x5'));var interaction=require(_0x28d0('0x6'));var config=require(_0x28d0('0x7'));var controller=require('./disposition.controller');router[_0x28d0('0x8')]('/',auth[_0x28d0('0x9')](),controller['index']);router['get'](_0x28d0('0xa'),auth[_0x28d0('0x9')](),controller[_0x28d0('0xb')]);router[_0x28d0('0xc')]('/',auth[_0x28d0('0x9')](),controller[_0x28d0('0xd')]);router['put'](_0x28d0('0xa'),auth[_0x28d0('0x9')](),controller['update']);router['delete'](_0x28d0('0xa'),auth[_0x28d0('0x9')](),controller['destroy']);module[_0x28d0('0xe')]=router; \ No newline at end of file +var _0x3d35=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./disposition.controller','get','isAuthenticated','index','show','create','/:id','update','delete','destroy','exports','util','path','connect-timeout','express','Router'];(function(_0x4c7266,_0x4d10c4){var _0x415107=function(_0x4e1067){while(--_0x4e1067){_0x4c7266['push'](_0x4c7266['shift']());}};_0x415107(++_0x4d10c4);}(_0x3d35,0x1ef));var _0x53d3=function(_0x15f426,_0x3eaae4){_0x15f426=_0x15f426-0x0;var _0x1318e6=_0x3d35[_0x15f426];return _0x1318e6;};'use strict';var multer=require('multer');var util=require(_0x53d3('0x0'));var path=require(_0x53d3('0x1'));var timeout=require(_0x53d3('0x2'));var express=require(_0x53d3('0x3'));var router=express[_0x53d3('0x4')]();var fs_extra=require(_0x53d3('0x5'));var auth=require(_0x53d3('0x6'));var interaction=require(_0x53d3('0x7'));var config=require(_0x53d3('0x8'));var controller=require(_0x53d3('0x9'));router[_0x53d3('0xa')]('/',auth[_0x53d3('0xb')](),controller[_0x53d3('0xc')]);router[_0x53d3('0xa')]('/:id',auth[_0x53d3('0xb')](),controller[_0x53d3('0xd')]);router['post']('/',auth[_0x53d3('0xb')](),controller[_0x53d3('0xe')]);router['put'](_0x53d3('0xf'),auth['isAuthenticated'](),controller[_0x53d3('0x10')]);router[_0x53d3('0x11')](_0x53d3('0xf'),auth[_0x53d3('0xb')](),controller[_0x53d3('0x12')]);module[_0x53d3('0x13')]=router; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.attributes.js b/server/api/faxAccount/faxAccount.attributes.js index 7c643df..dd4aecf 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 _0xbd10=['setDataValue','sequelize','exports','STRING','ENUM','yes','xCALLY\x20Motion\x20Fax','localstationid','2400','4800','9600','14400','7200','12000','INTEGER','SIP','IAX','KHOMP','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xbd10,0x85));var _0x0bd1=function(_0x1e3a15,_0x246053){_0x1e3a15=_0x1e3a15-0x0;var _0x5bf0d6=_0xbd10[_0x1e3a15];return _0x5bf0d6;};'use strict';var Sequelize=require(_0x0bd1('0x0'));module[_0x0bd1('0x1')]={'name':{'type':Sequelize[_0x0bd1('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']},'ecm':{'type':Sequelize[_0x0bd1('0x3')](_0x0bd1('0x4'),'no'),'defaultValue':_0x0bd1('0x4')},'headerinfo':{'type':Sequelize['STRING'],'defaultValue':_0x0bd1('0x5')},'localstationid':{'type':Sequelize[_0x0bd1('0x2')],'unique':_0x0bd1('0x6')},'minrate':{'type':Sequelize[_0x0bd1('0x3')](_0x0bd1('0x7'),_0x0bd1('0x8'),'7200',_0x0bd1('0x9'),'12000',_0x0bd1('0xa')),'defaultValue':_0x0bd1('0x8')},'maxrate':{'type':Sequelize[_0x0bd1('0x3')](_0x0bd1('0x7'),'4800',_0x0bd1('0xb'),_0x0bd1('0x9'),_0x0bd1('0xc'),_0x0bd1('0xa')),'defaultValue':_0x0bd1('0xa')},'modem':{'type':Sequelize[_0x0bd1('0x2')],'defaultValue':'v17,v27,v29'},'gateway':{'type':Sequelize[_0x0bd1('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x0bd1('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0x0bd1('0xd')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x0bd1('0x3')](_0x0bd1('0xe'),_0x0bd1('0xf'),'DADHI',_0x0bd1('0x10')),'defaultValue':_0x0bd1('0xe')},'key':{'type':Sequelize[_0x0bd1('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x0bd1('0x11')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x0bd1('0x11')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x0bd1('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x0bd1('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x0bd1('0x11')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x0bd1('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0x0bd1('0x12')},'mandatoryDisposition':{'type':Sequelize[_0x0bd1('0x11')],'defaultValue':![],'comment':_0x0bd1('0x13'),'set':function(_0x3042c6){if(!_0x3042c6)this['setDataValue'](_0x0bd1('0x14'),null);this[_0x0bd1('0x15')]('mandatoryDisposition',_0x3042c6);}}}; \ No newline at end of file +var _0x41fe=['2400','4800','7200','9600','12000','14400','INTEGER','SIP','IAX','DADHI','KHOMP','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','setDataValue','mandatoryDisposition','sequelize','exports','STRING','ENUM','yes','xCALLY\x20Motion\x20Fax','localstationid'];(function(_0x265aa2,_0x220072){var _0x447a3a=function(_0x1512cc){while(--_0x1512cc){_0x265aa2['push'](_0x265aa2['shift']());}};_0x447a3a(++_0x220072);}(_0x41fe,0xd1));var _0xe41f=function(_0x5f3f88,_0x562baf){_0x5f3f88=_0x5f3f88-0x0;var _0xd08119=_0x41fe[_0x5f3f88];return _0xd08119;};'use strict';var Sequelize=require(_0xe41f('0x0'));module[_0xe41f('0x1')]={'name':{'type':Sequelize[_0xe41f('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xe41f('0x2')]},'ecm':{'type':Sequelize[_0xe41f('0x3')](_0xe41f('0x4'),'no'),'defaultValue':_0xe41f('0x4')},'headerinfo':{'type':Sequelize[_0xe41f('0x2')],'defaultValue':_0xe41f('0x5')},'localstationid':{'type':Sequelize[_0xe41f('0x2')],'unique':_0xe41f('0x6')},'minrate':{'type':Sequelize[_0xe41f('0x3')](_0xe41f('0x7'),_0xe41f('0x8'),_0xe41f('0x9'),_0xe41f('0xa'),_0xe41f('0xb'),'14400'),'defaultValue':_0xe41f('0x8')},'maxrate':{'type':Sequelize[_0xe41f('0x3')]('2400',_0xe41f('0x8'),'7200','9600','12000',_0xe41f('0xc')),'defaultValue':'14400'},'modem':{'type':Sequelize['STRING'],'defaultValue':'v17,v27,v29'},'gateway':{'type':Sequelize[_0xe41f('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0xe41f('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0xe41f('0xd')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0xe41f('0x3')](_0xe41f('0xe'),_0xe41f('0xf'),_0xe41f('0x10'),_0xe41f('0x11')),'defaultValue':_0xe41f('0xe')},'key':{'type':Sequelize[_0xe41f('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0xe41f('0x12');}},'notificationSound':{'type':Sequelize[_0xe41f('0x13')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xe41f('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xe41f('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xe41f('0x13')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xe41f('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xe41f('0x13')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xe41f('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xe41f('0xd')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xe41f('0x14'),'set':function(_0x5e59e2){if(!_0x5e59e2)this['setDataValue'](_0xe41f('0x15'),null);this[_0xe41f('0x16')](_0xe41f('0x17'),_0x5e59e2);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index 8f0d293..61fa53c 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 _0x2005=['merge','options','rows','catch','rawAttributes','includeAll','include','create','body','user','get','role','UserProfileSection','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','addDisposition','FaxAccountId','Disposition','getDispositions','findOne','findAll','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','nolimit','addInteraction','FaxInteraction','omit','getInteractions','User','Owner','internal','Tag','Tags','color','tag','addApplications','transaction','READ_COMMITTED','FaxApplication','findAndCountAll','priority','finally','getApplications','context','from-voip-provider','exten','localstationid','app','type','system','Fax\x20Extension','Answer','CDR(type)=inbound-fax','Set','ecm','gateway','maxrate','minrate','modem','t38timeout','push','Wait','ReceiveFax','addAccountApplications','sequelize','VoiceExtension','bulkCreate','createdAt','updatedAt','TrunkId','getMessages','FaxMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','List','CmContact','Contacts','DESC','attachments','join','server/files/attachments','basename','CheckAfterSend','isNil','from','\x22%s\x22\x20<%s>','ListId','List\x20not\x20found','Send\x20Fax\x20failed','out','filename','Messages','Contact\x20not\x20found','spread','ContactId','dataValues','SendFax','SendFaxRpc,\x20%s','userFaxAccount:save','removeAgents','isArray','emit','userFaxAccount:remove','getAgents','eml-format','rimraf','zip-dir','path','sox','to-csv','ejs','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxAccount.socket','register','jayson/promise','client','then','info','FaxAccount,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','save','update','destroy','FaxAccounts','UserProfileResource','stack','name','send','index','Pause','mandatoryDispositionPause','map','FaxAccount','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter'];(function(_0x5ca8c0,_0x20b3f0){var _0x18e7d1=function(_0x17a6c8){while(--_0x17a6c8){_0x5ca8c0['push'](_0x5ca8c0['shift']());}};_0x18e7d1(++_0x20b3f0);}(_0x2005,0x70));var _0x5200=function(_0x3e79a7,_0x5c6fa7){_0x3e79a7=_0x3e79a7-0x0;var _0x11d050=_0x2005[_0x3e79a7];return _0x11d050;};'use strict';var emlformat=require(_0x5200('0x0'));var rimraf=require(_0x5200('0x1'));var zipdir=require(_0x5200('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('util');var path=require(_0x5200('0x3'));var sox=require(_0x5200('0x4'));var csv=require(_0x5200('0x5'));var ejs=require(_0x5200('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x5200('0x7'));var jsforce=require('jsforce');var deskjs=require(_0x5200('0x8'));var toCsv=require(_0x5200('0x5'));var querystring=require(_0x5200('0x9'));var Papa=require(_0x5200('0xa'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x5200('0xb'));var as=require(_0x5200('0xc'));var hardwareService=require(_0x5200('0xd'));var logger=require(_0x5200('0xe'))(_0x5200('0xf'));var utils=require('../../config/utils');var config=require(_0x5200('0x10'));var licenseUtil=require(_0x5200('0x11'));var db=require(_0x5200('0x12'))['db'];config[_0x5200('0x13')]=_[_0x5200('0x14')](config[_0x5200('0x13')],{'host':_0x5200('0x15'),'port':0x18eb});var socket=require(_0x5200('0x16'))(new Redis(config[_0x5200('0x13')]));require(_0x5200('0x17'))[_0x5200('0x18')](socket);var jayson=require(_0x5200('0x19'));var client=jayson[_0x5200('0x1a')]['http']({'port':0x232c});var client9002=jayson[_0x5200('0x1a')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1a5594,_0x9cfe5f,_0x1ae55f,_0x402160){return new BPromise(function(_0x59e788,_0xc35db5){var _0x2412f6=_0x402160||client;return _0x2412f6['request'](_0x1a5594,_0x1ae55f)[_0x5200('0x1b')](function(_0x6882b7){logger[_0x5200('0x1c')](_0x5200('0x1d'),_0x9cfe5f,'request\x20sent');logger[_0x5200('0x1e')]('FaxAccount,\x20%s,\x20%s,\x20%s',_0x9cfe5f,_0x5200('0x1f'),JSON[_0x5200('0x20')](_0x6882b7));if(_0x6882b7['error']){if(_0x6882b7[_0x5200('0x21')][_0x5200('0x22')]===0x1f4){logger[_0x5200('0x21')](_0x5200('0x1d'),_0x9cfe5f,_0x6882b7[_0x5200('0x21')]['message']);return _0xc35db5(_0x6882b7['error'][_0x5200('0x23')]);}logger[_0x5200('0x21')](_0x5200('0x1d'),_0x9cfe5f,_0x6882b7[_0x5200('0x21')][_0x5200('0x23')]);return _0x59e788(_0x6882b7[_0x5200('0x21')][_0x5200('0x23')]);}else{logger[_0x5200('0x1c')]('FaxAccount,\x20%s,\x20%s',_0x9cfe5f,_0x5200('0x1f'));_0x59e788(_0x6882b7[_0x5200('0x24')]['message']);}})['catch'](function(_0x49e85a){logger['error'](_0x5200('0x1d'),_0x9cfe5f,_0x49e85a);_0xc35db5(_0x49e85a);});});}function respondWithStatusCode(_0x3b1482,_0x3f2e0b){_0x3f2e0b=_0x3f2e0b||0xcc;return function(_0x160bf3){if(_0x160bf3){return _0x3b1482[_0x5200('0x25')](_0x3f2e0b);}return _0x3b1482[_0x5200('0x26')](_0x3f2e0b)[_0x5200('0x27')]();};}function respondWithResult(_0x59d2c3,_0x30aef8){_0x30aef8=_0x30aef8||0xc8;return function(_0x4f6126){if(_0x4f6126){return _0x59d2c3[_0x5200('0x26')](_0x30aef8)[_0x5200('0x28')](_0x4f6126);}};}function respondWithFilteredResult(_0x30f1f3,_0x3618e6){return function(_0x4eb0ed){if(_0x4eb0ed){var _0x49e31a=typeof _0x3618e6[_0x5200('0x29')]===_0x5200('0x2a')&&typeof _0x3618e6[_0x5200('0x2b')]===_0x5200('0x2a');var _0x1b5b0a=_0x4eb0ed[_0x5200('0x2c')];var _0x3e3b23=_0x49e31a?0x0:_0x3618e6['offset'];var _0x4dd85f=_0x49e31a?_0x4eb0ed['count']:_0x3618e6[_0x5200('0x29')]+_0x3618e6[_0x5200('0x2b')];var _0x5bff43;if(_0x4dd85f>=_0x1b5b0a){_0x4dd85f=_0x1b5b0a;_0x5bff43=0xc8;}else{_0x5bff43=0xce;}_0x30f1f3[_0x5200('0x26')](_0x5bff43);return _0x30f1f3[_0x5200('0x2d')](_0x5200('0x2e'),_0x3e3b23+'-'+_0x4dd85f+'/'+_0x1b5b0a)[_0x5200('0x28')](_0x4eb0ed);}return null;};}function patchUpdates(_0x290548){return function(_0x42f978){try{jsonpatch['apply'](_0x42f978,_0x290548,!![]);}catch(_0x5b005b){return BPromise['reject'](_0x5b005b);}return _0x42f978[_0x5200('0x2f')]();};}function saveUpdates(_0x423940,_0x348728){return function(_0x207d2b){if(_0x207d2b){return _0x207d2b[_0x5200('0x30')](_0x423940)[_0x5200('0x1b')](function(_0x2662d2){return _0x2662d2;});}return null;};}function removeEntity(_0x285705,_0x515b11){return function(_0x2190cb){if(_0x2190cb){return _0x2190cb[_0x5200('0x31')]()[_0x5200('0x1b')](function(){var _0x5c14be=_0x2190cb['get']({'plain':!![]});var _0x268837=_0x5200('0x32');return db[_0x5200('0x33')][_0x5200('0x31')]({'where':{'type':_0x268837,'resourceId':_0x5c14be['id']}})['then'](function(){return _0x2190cb;});})[_0x5200('0x1b')](function(){_0x285705[_0x5200('0x26')](0xcc)['end']();});}};}function handleEntityNotFound(_0x507efd,_0x5dc311){return function(_0x4f9d73){if(!_0x4f9d73){_0x507efd[_0x5200('0x25')](0x194);}return _0x4f9d73;};}function handleError(_0xb34711,_0x26a0dc){_0x26a0dc=_0x26a0dc||0x1f4;return function(_0x4fbe5d){logger[_0x5200('0x21')](_0x4fbe5d[_0x5200('0x34')]);if(_0x4fbe5d[_0x5200('0x35')]){delete _0x4fbe5d['name'];}_0xb34711[_0x5200('0x26')](_0x26a0dc)[_0x5200('0x36')](_0x4fbe5d);};}exports[_0x5200('0x37')]=function(_0x1c365a,_0x577a07){var _0x5cb4c8={'include':[{'model':db[_0x5200('0x38')],'as':_0x5200('0x39')}]},_0x1d1c72={},_0x4fbb54={'count':0x0,'rows':[]};var _0x222bc8=_[_0x5200('0x3a')](db[_0x5200('0x3b')]['rawAttributes'],function(_0x50f40e){return{'name':_0x50f40e[_0x5200('0x3c')],'type':_0x50f40e['type'][_0x5200('0x3d')]};});_0x1d1c72[_0x5200('0x3e')]=_[_0x5200('0x3a')](_0x222bc8,_0x5200('0x35'));_0x1d1c72[_0x5200('0x3f')]=_[_0x5200('0x40')](_0x1c365a[_0x5200('0x3f')]);_0x1d1c72[_0x5200('0x41')]=_[_0x5200('0x42')](_0x1d1c72['model'],_0x1d1c72[_0x5200('0x3f')]);_0x5cb4c8[_0x5200('0x43')]=_['intersection'](_0x1d1c72[_0x5200('0x3e')],qs[_0x5200('0x44')](_0x1c365a[_0x5200('0x3f')]['fields']));_0x5cb4c8[_0x5200('0x43')]=_0x5cb4c8[_0x5200('0x43')][_0x5200('0x45')]?_0x5cb4c8[_0x5200('0x43')]:_0x1d1c72[_0x5200('0x3e')];if(!_0x1c365a[_0x5200('0x3f')][_0x5200('0x46')]('nolimit')){_0x5cb4c8['limit']=qs[_0x5200('0x2b')](_0x1c365a[_0x5200('0x3f')][_0x5200('0x2b')]);_0x5cb4c8[_0x5200('0x29')]=qs[_0x5200('0x29')](_0x1c365a[_0x5200('0x3f')][_0x5200('0x29')]);}_0x5cb4c8[_0x5200('0x47')]=qs[_0x5200('0x48')](_0x1c365a['query']['sort']);_0x5cb4c8[_0x5200('0x49')]=qs[_0x5200('0x41')](_[_0x5200('0x4a')](_0x1c365a[_0x5200('0x3f')],_0x1d1c72[_0x5200('0x41')]),_0x222bc8);if(_0x1c365a[_0x5200('0x3f')][_0x5200('0x4b')]){_0x5cb4c8[_0x5200('0x49')]=_[_0x5200('0x4c')](_0x5cb4c8[_0x5200('0x49')],{'$or':_[_0x5200('0x3a')](_0x222bc8,function(_0x29fee8){if(_0x29fee8['type']!=='VIRTUAL'){var _0x3194c1={};_0x3194c1[_0x29fee8[_0x5200('0x35')]]={'$like':'%'+_0x1c365a[_0x5200('0x3f')][_0x5200('0x4b')]+'%'};return _0x3194c1;}})});}_0x5cb4c8=_['merge']({},_0x5cb4c8,_0x1c365a[_0x5200('0x4d')]);var _0x86d57f={'where':_0x5cb4c8['where']};return db[_0x5200('0x3b')][_0x5200('0x2c')](_0x86d57f)[_0x5200('0x1b')](function(_0x2b8322){_0x4fbb54[_0x5200('0x2c')]=_0x2b8322;if(_0x1c365a[_0x5200('0x3f')]['includeAll']){_0x5cb4c8['include']=[{'all':!![]}];}return db[_0x5200('0x3b')]['findAll'](_0x5cb4c8);})[_0x5200('0x1b')](function(_0x528e18){_0x4fbb54[_0x5200('0x4e')]=_0x528e18;return _0x4fbb54;})[_0x5200('0x1b')](respondWithFilteredResult(_0x577a07,_0x5cb4c8))[_0x5200('0x4f')](handleError(_0x577a07,null));};exports['show']=function(_0x3d96e6,_0x164da4){var _0x3bac05={'raw':![],'where':{'id':_0x3d96e6['params']['id']},'include':[{'model':db['Pause'],'as':_0x5200('0x39')}]},_0x5af0a2={};_0x5af0a2['model']=_[_0x5200('0x40')](db['FaxAccount'][_0x5200('0x50')]);_0x5af0a2['query']=_[_0x5200('0x40')](_0x3d96e6['query']);_0x5af0a2[_0x5200('0x41')]=_[_0x5200('0x42')](_0x5af0a2[_0x5200('0x3e')],_0x5af0a2[_0x5200('0x3f')]);_0x3bac05[_0x5200('0x43')]=_['intersection'](_0x5af0a2[_0x5200('0x3e')],qs[_0x5200('0x44')](_0x3d96e6['query'][_0x5200('0x44')]));_0x3bac05['attributes']=_0x3bac05[_0x5200('0x43')]['length']?_0x3bac05[_0x5200('0x43')]:_0x5af0a2[_0x5200('0x3e')];if(_0x3d96e6['query'][_0x5200('0x51')]){_0x3bac05[_0x5200('0x52')]=[{'all':!![]}];}_0x3bac05=_[_0x5200('0x4c')]({},_0x3bac05,_0x3d96e6[_0x5200('0x4d')]);return db[_0x5200('0x3b')]['find'](_0x3bac05)[_0x5200('0x1b')](handleEntityNotFound(_0x164da4,null))['then'](respondWithResult(_0x164da4,null))['catch'](handleError(_0x164da4,null));};exports[_0x5200('0x53')]=function(_0x23a6a8,_0x45818d){return db[_0x5200('0x3b')][_0x5200('0x53')](_0x23a6a8[_0x5200('0x54')],{})[_0x5200('0x1b')](function(_0x3020be){var _0xa9e2d5=_0x23a6a8[_0x5200('0x55')][_0x5200('0x56')]({'plain':!![]});if(!_0xa9e2d5)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xa9e2d5[_0x5200('0x57')]===_0x5200('0x55')){var _0x2b5611=_0x3020be[_0x5200('0x56')]({'plain':!![]});var _0x61fdb0=_0x5200('0x32');return db[_0x5200('0x58')][_0x5200('0x59')]({'where':{'name':_0x61fdb0,'userProfileId':_0xa9e2d5['userProfileId']},'raw':!![]})['then'](function(_0x55397d){if(_0x55397d&&_0x55397d[_0x5200('0x5a')]===0x0){return db['UserProfileResource'][_0x5200('0x53')]({'name':_0x2b5611['name'],'resourceId':_0x2b5611['id'],'type':_0x55397d[_0x5200('0x35')],'sectionId':_0x55397d['id']},{})[_0x5200('0x1b')](function(){return _0x3020be;});}else{return _0x3020be;}})['catch'](function(_0xd87ed5){logger[_0x5200('0x21')](_0x5200('0x5b'),_0xd87ed5);throw _0xd87ed5;});}return _0x3020be;})['then'](respondWithResult(_0x45818d,0xc9))[_0x5200('0x4f')](handleError(_0x45818d,null));};exports[_0x5200('0x30')]=function(_0x37b12d,_0x2e8027){if(_0x37b12d['body']['id']){delete _0x37b12d['body']['id'];}return db[_0x5200('0x3b')][_0x5200('0x59')]({'where':{'id':_0x37b12d[_0x5200('0x5c')]['id']},'include':[{'model':db[_0x5200('0x38')],'as':'mandatoryDispositionPause'}]})[_0x5200('0x1b')](handleEntityNotFound(_0x2e8027,null))[_0x5200('0x1b')](saveUpdates(_0x37b12d['body'],null))[_0x5200('0x1b')](respondWithResult(_0x2e8027,null))[_0x5200('0x4f')](handleError(_0x2e8027,null));};exports[_0x5200('0x31')]=function(_0xee479,_0x50a728){return db[_0x5200('0x3b')]['find']({'where':{'id':_0xee479[_0x5200('0x5c')]['id']}})[_0x5200('0x1b')](handleEntityNotFound(_0x50a728,null))[_0x5200('0x1b')](removeEntity(_0x50a728,null))[_0x5200('0x4f')](handleError(_0x50a728,null));};exports[_0x5200('0x5d')]=function(_0x41aeba,_0x5789b1){return db[_0x5200('0x3b')][_0x5200('0x5d')]()[_0x5200('0x1b')](respondWithResult(_0x5789b1,null))[_0x5200('0x4f')](handleError(_0x5789b1,null));};exports[_0x5200('0x5e')]=function(_0x58cb7e,_0x3b957d,_0x5e30c9){if(_0x58cb7e[_0x5200('0x54')]['id']){delete _0x58cb7e['body']['id'];}return db[_0x5200('0x3b')][_0x5200('0x59')]({'where':{'id':_0x58cb7e['params']['id']}})[_0x5200('0x1b')](handleEntityNotFound(_0x3b957d,null))[_0x5200('0x1b')](function(_0x5af735){if(_0x5af735){_0x58cb7e[_0x5200('0x54')][_0x5200('0x5f')]=_0x5af735['id'];return db[_0x5200('0x60')]['create'](_0x58cb7e[_0x5200('0x54')]);}})['then'](respondWithResult(_0x3b957d,null))['catch'](handleError(_0x3b957d,null));};exports[_0x5200('0x61')]=function(_0x2622aa,_0x4605f4,_0x263470){var _0x392f7d={'raw':![],'where':{}};var _0x263c32={};var _0x381e52={'count':0x0,'rows':[]};return db[_0x5200('0x3b')][_0x5200('0x62')]({'where':{'id':_0x2622aa[_0x5200('0x5c')]['id']}})[_0x5200('0x1b')](handleEntityNotFound(_0x4605f4,null))[_0x5200('0x1b')](function(_0xab3862){if(_0xab3862){_0x263c32[_0x5200('0x3e')]=_[_0x5200('0x40')](db[_0x5200('0x60')][_0x5200('0x50')]);_0x263c32[_0x5200('0x3f')]=_[_0x5200('0x40')](_0x2622aa['query']);_0x263c32[_0x5200('0x41')]=_['intersection'](_0x263c32[_0x5200('0x3e')],_0x263c32[_0x5200('0x3f')]);_0x392f7d[_0x5200('0x43')]=_[_0x5200('0x42')](_0x263c32[_0x5200('0x3e')],qs[_0x5200('0x44')](_0x2622aa[_0x5200('0x3f')][_0x5200('0x44')]));_0x392f7d[_0x5200('0x43')]=_0x392f7d[_0x5200('0x43')][_0x5200('0x45')]?_0x392f7d['attributes']:_0x263c32[_0x5200('0x3e')];if(!_0x2622aa['query']['hasOwnProperty']('nolimit')){_0x392f7d[_0x5200('0x2b')]=qs[_0x5200('0x2b')](_0x2622aa['query'][_0x5200('0x2b')]);_0x392f7d[_0x5200('0x29')]=qs['offset'](_0x2622aa['query'][_0x5200('0x29')]);}_0x392f7d['order']=qs[_0x5200('0x48')](_0x2622aa['query'][_0x5200('0x48')]);_0x392f7d['where']=qs[_0x5200('0x41')](_[_0x5200('0x4a')](_0x2622aa['query'],_0x263c32[_0x5200('0x41')]));_0x392f7d[_0x5200('0x49')][_0x5200('0x5f')]=_0xab3862['id'];if(_0x2622aa[_0x5200('0x3f')][_0x5200('0x4b')]){_0x392f7d[_0x5200('0x49')]=_[_0x5200('0x4c')](_0x392f7d[_0x5200('0x49')],{'$or':_[_0x5200('0x3a')](_0x392f7d[_0x5200('0x43')],function(_0x68451e){var _0x1c77d2={};_0x1c77d2[_0x68451e]={'$like':'%'+_0x2622aa[_0x5200('0x3f')][_0x5200('0x4b')]+'%'};return _0x1c77d2;})});}_0x392f7d=_[_0x5200('0x4c')]({},_0x392f7d,_0x2622aa[_0x5200('0x4d')]);return db[_0x5200('0x60')][_0x5200('0x2c')]({'where':_0x392f7d[_0x5200('0x49')]})[_0x5200('0x1b')](function(_0xeb865a){_0x381e52[_0x5200('0x2c')]=_0xeb865a;if(_0x2622aa[_0x5200('0x3f')]['includeAll']){_0x392f7d[_0x5200('0x52')]=[{'all':!![]}];}return db['Disposition'][_0x5200('0x63')](_0x392f7d);})[_0x5200('0x1b')](function(_0xeafdb1){_0x381e52[_0x5200('0x4e')]=_0xeafdb1;return _0x381e52;});}})['then'](respondWithFilteredResult(_0x4605f4,_0x392f7d))['catch'](handleError(_0x4605f4,null));};exports[_0x5200('0x64')]=function(_0x291af1,_0x4941f8,_0x26441b){return db[_0x5200('0x3b')][_0x5200('0x59')]({'where':{'id':_0x291af1[_0x5200('0x5c')]['id']}})[_0x5200('0x1b')](handleEntityNotFound(_0x4941f8,null))[_0x5200('0x1b')](function(_0x267082){if(_0x267082){return _0x267082['removeDispositions'](_0x291af1['query'][_0x5200('0x65')]);}})[_0x5200('0x1b')](respondWithStatusCode(_0x4941f8,null))[_0x5200('0x4f')](handleError(_0x4941f8,null));};exports[_0x5200('0x66')]=function(_0x589e98,_0x580350,_0x5e7562){if(_0x589e98[_0x5200('0x54')]['id']){delete _0x589e98[_0x5200('0x54')]['id'];}return db[_0x5200('0x3b')]['find']({'where':{'id':_0x589e98[_0x5200('0x5c')]['id']}})[_0x5200('0x1b')](handleEntityNotFound(_0x580350,null))[_0x5200('0x1b')](function(_0x33fdc3){if(_0x33fdc3){_0x589e98['body']['FaxAccountId']=_0x33fdc3['id'];return db[_0x5200('0x67')][_0x5200('0x53')](_0x589e98[_0x5200('0x54')]);}})[_0x5200('0x1b')](respondWithResult(_0x580350,null))[_0x5200('0x4f')](handleError(_0x580350,null));};exports[_0x5200('0x68')]=function(_0x26d9d8,_0x43791f,_0x39268d){var _0x186c87={'raw':![],'where':{}};var _0x1e159c={};var _0x25c25c={'count':0x0,'rows':[]};return db[_0x5200('0x3b')][_0x5200('0x62')]({'where':{'id':_0x26d9d8[_0x5200('0x5c')]['id']}})['then'](handleEntityNotFound(_0x43791f,null))[_0x5200('0x1b')](function(_0x1dbd61){if(_0x1dbd61){_0x1e159c['model']=_[_0x5200('0x40')](db[_0x5200('0x67')]['rawAttributes']);_0x1e159c[_0x5200('0x3f')]=_[_0x5200('0x40')](_0x26d9d8[_0x5200('0x3f')]);_0x1e159c['filters']=_[_0x5200('0x42')](_0x1e159c[_0x5200('0x3e')],_0x1e159c['query']);_0x186c87[_0x5200('0x43')]=_['intersection'](_0x1e159c[_0x5200('0x3e')],qs[_0x5200('0x44')](_0x26d9d8['query'][_0x5200('0x44')]));_0x186c87['attributes']=_0x186c87[_0x5200('0x43')][_0x5200('0x45')]?_0x186c87['attributes']:_0x1e159c[_0x5200('0x3e')];if(!_0x26d9d8[_0x5200('0x3f')][_0x5200('0x46')](_0x5200('0x69'))){_0x186c87['limit']=qs['limit'](_0x26d9d8[_0x5200('0x3f')][_0x5200('0x2b')]);_0x186c87[_0x5200('0x29')]=qs[_0x5200('0x29')](_0x26d9d8[_0x5200('0x3f')][_0x5200('0x29')]);}_0x186c87[_0x5200('0x47')]=qs[_0x5200('0x48')](_0x26d9d8[_0x5200('0x3f')][_0x5200('0x48')]);_0x186c87[_0x5200('0x49')]=qs[_0x5200('0x41')](_['pick'](_0x26d9d8[_0x5200('0x3f')],_0x1e159c[_0x5200('0x41')]));_0x186c87['where'][_0x5200('0x5f')]=_0x1dbd61['id'];if(_0x26d9d8[_0x5200('0x3f')][_0x5200('0x4b')]){_0x186c87[_0x5200('0x49')]=_['merge'](_0x186c87['where'],{'$or':_['map'](_0x186c87[_0x5200('0x43')],function(_0x1379b6){var _0x168ae4={};_0x168ae4[_0x1379b6]={'$like':'%'+_0x26d9d8[_0x5200('0x3f')][_0x5200('0x4b')]+'%'};return _0x168ae4;})});}_0x186c87=_[_0x5200('0x4c')]({},_0x186c87,_0x26d9d8[_0x5200('0x4d')]);return db[_0x5200('0x67')][_0x5200('0x2c')]({'where':_0x186c87[_0x5200('0x49')]})[_0x5200('0x1b')](function(_0xe60032){_0x25c25c[_0x5200('0x2c')]=_0xe60032;if(_0x26d9d8[_0x5200('0x3f')][_0x5200('0x51')]){_0x186c87[_0x5200('0x52')]=[{'all':!![]}];}return db[_0x5200('0x67')]['findAll'](_0x186c87);})[_0x5200('0x1b')](function(_0x31c7b5){_0x25c25c[_0x5200('0x4e')]=_0x31c7b5;return _0x25c25c;});}})[_0x5200('0x1b')](respondWithFilteredResult(_0x43791f,_0x186c87))['catch'](handleError(_0x43791f,null));};exports['removeAnswers']=function(_0x5792ec,_0x212fed,_0x1b0713){return db[_0x5200('0x3b')][_0x5200('0x59')]({'where':{'id':_0x5792ec[_0x5200('0x5c')]['id']}})[_0x5200('0x1b')](handleEntityNotFound(_0x212fed,null))[_0x5200('0x1b')](function(_0x772917){if(_0x772917){return _0x772917['removeAnswers'](_0x5792ec[_0x5200('0x3f')][_0x5200('0x65')]);}})[_0x5200('0x1b')](respondWithStatusCode(_0x212fed,null))[_0x5200('0x4f')](handleError(_0x212fed,null));};exports[_0x5200('0x6a')]=function(_0x599b44,_0x3165a5,_0x2eb64e){return db[_0x5200('0x6b')][_0x5200('0x59')]({'where':{'id':_0x599b44[_0x5200('0x5c')]['id']}})['then'](handleEntityNotFound(_0x3165a5,null))[_0x5200('0x1b')](function(_0x48c93a){if(_0x48c93a){return _0x48c93a[_0x5200('0x6a')](_0x599b44['body']['ids'],_[_0x5200('0x6c')](_0x599b44[_0x5200('0x54')],['ids','id'])||{});}})[_0x5200('0x1b')](respondWithResult(_0x3165a5,null))[_0x5200('0x4f')](handleError(_0x3165a5,null));};exports[_0x5200('0x6d')]=function(_0x54a252,_0x16f994,_0x5a0599){var _0x18cc87={'raw':![],'where':{}};var _0x52861b={};var _0xcc6953={'count':0x0,'rows':[]};return db[_0x5200('0x3b')][_0x5200('0x62')]({'where':{'id':_0x54a252[_0x5200('0x5c')]['id']}})[_0x5200('0x1b')](handleEntityNotFound(_0x16f994,null))['then'](function(_0x24bfe0){if(_0x24bfe0){_0x52861b['model']=_[_0x5200('0x40')](db[_0x5200('0x6b')][_0x5200('0x50')]);_0x52861b[_0x5200('0x3f')]=_[_0x5200('0x40')](_0x54a252[_0x5200('0x3f')]);_0x52861b[_0x5200('0x41')]=_[_0x5200('0x42')](_0x52861b[_0x5200('0x3e')],_0x52861b[_0x5200('0x3f')]);_0x18cc87[_0x5200('0x43')]=_[_0x5200('0x42')](_0x52861b[_0x5200('0x3e')],qs[_0x5200('0x44')](_0x54a252[_0x5200('0x3f')][_0x5200('0x44')]));_0x18cc87[_0x5200('0x43')]=_0x18cc87[_0x5200('0x43')]['length']?_0x18cc87['attributes']:_0x52861b['model'];if(!_0x54a252[_0x5200('0x3f')][_0x5200('0x46')](_0x5200('0x69'))){_0x18cc87[_0x5200('0x2b')]=qs[_0x5200('0x2b')](_0x54a252[_0x5200('0x3f')][_0x5200('0x2b')]);_0x18cc87[_0x5200('0x29')]=qs[_0x5200('0x29')](_0x54a252[_0x5200('0x3f')][_0x5200('0x29')]);}_0x18cc87[_0x5200('0x47')]=qs[_0x5200('0x48')](_0x54a252['query']['sort']);_0x18cc87[_0x5200('0x49')]=qs[_0x5200('0x41')](_[_0x5200('0x4a')](_0x54a252[_0x5200('0x3f')],_0x52861b['filters']));_0x18cc87[_0x5200('0x49')][_0x5200('0x5f')]=_0x24bfe0['id'];if(_0x54a252[_0x5200('0x3f')]['filter']){_0x18cc87['where']=_[_0x5200('0x4c')](_0x18cc87[_0x5200('0x49')],{'$or':_[_0x5200('0x3a')](_0x18cc87[_0x5200('0x43')],function(_0x19bde1){var _0x13b010={};_0x13b010[_0x19bde1]={'$like':'%'+_0x54a252[_0x5200('0x3f')][_0x5200('0x4b')]+'%'};return _0x13b010;})});}_0x18cc87=_[_0x5200('0x4c')]({},_0x18cc87,_0x54a252[_0x5200('0x4d')]);return db[_0x5200('0x6b')][_0x5200('0x2c')]({'where':_0x18cc87[_0x5200('0x49')]})['then'](function(_0x466e7c){_0xcc6953[_0x5200('0x2c')]=_0x466e7c;if(_0x54a252['query'][_0x5200('0x51')]){_0x18cc87[_0x5200('0x52')]=[{'model':db['CmContact'],'as':'Contact','required':![]},{'model':db[_0x5200('0x6e')],'as':_0x5200('0x6f'),'attributes':[_0x5200('0x35'),'fullname',_0x5200('0x70')],'required':![]},{'model':db[_0x5200('0x71')],'as':_0x5200('0x72'),'attributes':['id',_0x5200('0x35'),_0x5200('0x73')],'where':_0x54a252[_0x5200('0x3f')][_0x5200('0x74')]?{'id':_0x54a252[_0x5200('0x3f')][_0x5200('0x74')]}:undefined,'required':_0x54a252[_0x5200('0x3f')][_0x5200('0x74')]?!![]:![]}];}return db[_0x5200('0x6b')]['findAll'](_0x18cc87);})[_0x5200('0x1b')](function(_0xcd5938){_0xcc6953[_0x5200('0x4e')]=_0xcd5938;return _0xcc6953;});}})[_0x5200('0x1b')](respondWithFilteredResult(_0x16f994,_0x18cc87))[_0x5200('0x4f')](handleError(_0x16f994,null));};exports[_0x5200('0x75')]=function(_0x71c82e,_0x365eb2){var _0x4e207d=_0x71c82e[_0x5200('0x5c')]['id'];var _0x558ca7=_0x71c82e['body'];var _0x536aeb=0xc8;var _0x133d01=null;return db['sequelize'][_0x5200('0x76')]({'isolationLevel':db['sequelize']['Transaction']['ISOLATION_LEVELS'][_0x5200('0x77')]},function(_0x9626dc){return db['FaxAccount'][_0x5200('0x62')]({'where':{'id':_0x4e207d},'transaction':_0x9626dc})[_0x5200('0x1b')](function(_0x3a864e){if(_0x3a864e){return db['FaxApplication'][_0x5200('0x31')]({'where':{'FaxAccountId':_0x4e207d},'transaction':_0x9626dc})[_0x5200('0x1b')](function(){var _0x37cf7d=_[_0x5200('0x3a')](_0x558ca7,function(_0x335dba){_0x335dba[_0x5200('0x5f')]=_0x4e207d;return _0x335dba;});return db['FaxApplication']['bulkCreate'](_0x37cf7d,{'transaction':_0x9626dc});});}else{_0x536aeb=0x194;_0x133d01=[];}});})[_0x5200('0x1b')](function(){if(_0x536aeb!==0x194){return db[_0x5200('0x78')][_0x5200('0x79')]({'where':{'FaxAccountId':_0x4e207d},'order':_0x5200('0x7a')})[_0x5200('0x1b')](function(_0x3556ec){_0x133d01=_0x3556ec;});}})['catch'](function(_0x46520e){_0x536aeb=0x1f4;logger[_0x5200('0x21')](_0x46520e[_0x5200('0x34')]);if(_0x46520e[_0x5200('0x35')]){delete _0x46520e[_0x5200('0x35')];}_0x133d01=_0x46520e;})[_0x5200('0x7b')](function(){if(_0x133d01===null){_0x365eb2[_0x5200('0x25')](_0x536aeb);}else{if(_0x536aeb===0x1f4){_0x365eb2[_0x5200('0x26')](_0x536aeb)[_0x5200('0x36')](_0x133d01);}else{_0x365eb2[_0x5200('0x26')](_0x536aeb)[_0x5200('0x28')](_0x133d01);}}});};exports[_0x5200('0x7c')]=function(_0x233013,_0x52c4f5,_0x255f36){var _0xf6421f={};var _0x2b36ce={};var _0x177b67;var _0x379429;return db[_0x5200('0x3b')]['findOne']({'where':{'id':_0x233013[_0x5200('0x5c')]['id']}})[_0x5200('0x1b')](handleEntityNotFound(_0x52c4f5,null))['then'](function(_0x58c5ff){if(_0x58c5ff){_0x177b67=_0x58c5ff;_0x2b36ce[_0x5200('0x3e')]=_['keys'](db[_0x5200('0x78')][_0x5200('0x50')]);_0x2b36ce['query']=_['keys'](_0x233013[_0x5200('0x3f')]);_0x2b36ce[_0x5200('0x41')]=_[_0x5200('0x42')](_0x2b36ce[_0x5200('0x3e')],_0x2b36ce[_0x5200('0x3f')]);_0xf6421f[_0x5200('0x43')]=_[_0x5200('0x42')](_0x2b36ce[_0x5200('0x3e')],qs[_0x5200('0x44')](_0x233013['query'][_0x5200('0x44')]));_0xf6421f[_0x5200('0x43')]=_0xf6421f[_0x5200('0x43')][_0x5200('0x45')]?_0xf6421f[_0x5200('0x43')]:_0x2b36ce['model'];_0xf6421f[_0x5200('0x47')]=qs[_0x5200('0x48')](_0x233013[_0x5200('0x3f')][_0x5200('0x48')]);_0xf6421f[_0x5200('0x49')]=qs[_0x5200('0x41')](_[_0x5200('0x4a')](_0x233013[_0x5200('0x3f')],_0x2b36ce[_0x5200('0x41')]));if(_0x233013[_0x5200('0x3f')][_0x5200('0x4b')]){_0xf6421f[_0x5200('0x49')]=_[_0x5200('0x4c')](_0xf6421f['where'],{'$or':_[_0x5200('0x3a')](_0xf6421f[_0x5200('0x43')],function(_0x4c0c78){var _0x5c2c98={};_0x5c2c98[_0x4c0c78]={'$like':'%'+_0x233013[_0x5200('0x3f')][_0x5200('0x4b')]+'%'};return _0x5c2c98;})});}_0xf6421f=_[_0x5200('0x4c')]({},_0xf6421f,_0x233013[_0x5200('0x4d')]);return _0x177b67[_0x5200('0x7c')](_0xf6421f);}})[_0x5200('0x1b')](function(_0x3013e3){if(_0x3013e3){_0x379429=_0x3013e3['length'];if(!_0x233013['query']['hasOwnProperty'](_0x5200('0x69'))){_0xf6421f[_0x5200('0x2b')]=qs[_0x5200('0x2b')](_0x233013[_0x5200('0x3f')]['limit']);_0xf6421f[_0x5200('0x29')]=qs[_0x5200('0x29')](_0x233013[_0x5200('0x3f')][_0x5200('0x29')]);}return _0x177b67['getApplications'](_0xf6421f);}})[_0x5200('0x1b')](function(_0x2597d8){if(_0x2597d8){return _0x2597d8?{'count':_0x379429,'rows':_0x2597d8}:null;}})['then'](respondWithResult(_0x52c4f5,null))[_0x5200('0x4f')](handleError(_0x52c4f5,null));};function Extension(_0x19b632,_0x3668b0,_0x17e239,_0x478e48){this[_0x5200('0x7d')]=_0x5200('0x7e');this[_0x5200('0x7f')]=_0x19b632[_0x5200('0x80')];this[_0x5200('0x81')]=_0x478e48;this[_0x5200('0x82')]=_0x5200('0x83');this['description']=_0x5200('0x84');this[_0x5200('0x5f')]=_0x19b632['id'];this['priority']=_0x3668b0;this['appdata']=_0x17e239;}function createExtensionsReciveFax(_0x382e8d){var _0x386030=0x1;var _0x118419=[];_0x118419['push'](new Extension(_0x382e8d,_0x386030,'',_0x5200('0x85')));_0x386030+=0x1;_0x118419['push'](new Extension(_0x382e8d,_0x386030,_0x5200('0x86'),_0x5200('0x87')));_0x386030+=0x1;for(var _0x4a42d7 in _0x382e8d){if(_0x382e8d[_0x5200('0x46')](_0x4a42d7)&&(_0x4a42d7===_0x5200('0x88')||_0x4a42d7===_0x5200('0x80')||_0x4a42d7===_0x5200('0x89')||_0x4a42d7==='faxdetect'||_0x4a42d7==='headerinfo'||_0x4a42d7===_0x5200('0x8a')||_0x4a42d7===_0x5200('0x8b')||_0x4a42d7===_0x5200('0x8c')||_0x4a42d7===_0x5200('0x8d'))){_0x118419['push'](new Extension(_0x382e8d,_0x386030,'FAXOPT('+_0x4a42d7+')='+_0x382e8d[_0x4a42d7],_0x5200('0x87')));_0x386030+=0x1;}}_0x118419[_0x5200('0x8e')](new Extension(_0x382e8d,_0x386030,'6',_0x5200('0x8f')));_0x386030+=0x1;_0x118419[_0x5200('0x8e')](new Extension(_0x382e8d,_0x386030,'/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',_0x5200('0x90')));_0x386030=0x0;return _0x118419;}exports[_0x5200('0x91')]=function(_0x200281,_0x366d56,_0x2aa12c){var _0x3bc036;return db[_0x5200('0x92')][_0x5200('0x76')](function(_0x352cad){return db[_0x5200('0x3b')]['create'](_0x200281[_0x5200('0x54')],{'transaction':_0x352cad})[_0x5200('0x1b')](function(_0x7f2564){_0x3bc036=_0x7f2564[_0x5200('0x56')]({'plain':!![]});return db[_0x5200('0x93')][_0x5200('0x94')](createExtensionsReciveFax(_0x3bc036),{'transaction':_0x352cad});});})['then'](function(){return _0x3bc036;})[_0x5200('0x1b')](respondWithResult(_0x366d56,null))[_0x5200('0x4f')](handleError(_0x366d56,null));};exports['updateAccountApplications']=function(_0x11b73c,_0x5b9685,_0x22e54e){var _0x40532c;return db[_0x5200('0x92')][_0x5200('0x76')](function(_0x404ca5){return db[_0x5200('0x3b')][_0x5200('0x30')](_0x11b73c[_0x5200('0x54')],{'where':{'id':_0x11b73c[_0x5200('0x54')]['id']},'transaction':_0x404ca5})[_0x5200('0x1b')](function(_0x4c52d6){return db[_0x5200('0x93')]['destroy']({'where':{'FaxAccountId':_0x11b73c['body']['id']},'transaction':_0x404ca5})['then'](function(_0x321ab2){return db[_0x5200('0x93')][_0x5200('0x94')](createExtensionsReciveFax(_[_0x5200('0x6c')](_0x11b73c[_0x5200('0x54')],['tech',_0x5200('0x3d'),_0x5200('0x95'),_0x5200('0x96'),_0x5200('0x97'),'ListId'])),{'transaction':_0x404ca5});});});})['then'](function(){return db[_0x5200('0x3b')]['findById'](_0x11b73c['body']['id']);})[_0x5200('0x1b')](respondWithResult(_0x5b9685,null))['catch'](handleError(_0x5b9685,null));};exports[_0x5200('0x98')]=function(_0xae9cbc,_0x5af1b2,_0x320b4e){var _0x3c2e8a={'raw':!![],'where':{}};var _0x97277={};var _0x2ced90={'count':0x0,'rows':[]};return db[_0x5200('0x3b')][_0x5200('0x62')]({'where':{'id':_0xae9cbc[_0x5200('0x5c')]['id']}})[_0x5200('0x1b')](handleEntityNotFound(_0x5af1b2,null))[_0x5200('0x1b')](function(_0x446033){if(_0x446033){_0x97277[_0x5200('0x3e')]=_['keys'](db[_0x5200('0x99')][_0x5200('0x50')]);_0x97277[_0x5200('0x3f')]=_['keys'](_0xae9cbc[_0x5200('0x3f')]);_0x97277[_0x5200('0x41')]=_['intersection'](_0x97277[_0x5200('0x3e')],_0x97277[_0x5200('0x3f')]);_0x3c2e8a[_0x5200('0x43')]=_['intersection'](_0x97277[_0x5200('0x3e')],qs[_0x5200('0x44')](_0xae9cbc['query'][_0x5200('0x44')]));_0x3c2e8a[_0x5200('0x43')]=_0x3c2e8a['attributes'][_0x5200('0x45')]?_0x3c2e8a[_0x5200('0x43')]:_0x97277[_0x5200('0x3e')];if(!_0xae9cbc[_0x5200('0x3f')][_0x5200('0x46')](_0x5200('0x69'))){_0x3c2e8a[_0x5200('0x2b')]=qs[_0x5200('0x2b')](_0xae9cbc[_0x5200('0x3f')][_0x5200('0x2b')]);_0x3c2e8a['offset']=qs[_0x5200('0x29')](_0xae9cbc[_0x5200('0x3f')]['offset']);}_0x3c2e8a[_0x5200('0x47')]=qs[_0x5200('0x48')](_0xae9cbc[_0x5200('0x3f')][_0x5200('0x48')]);_0x3c2e8a[_0x5200('0x49')]=qs['filters'](_[_0x5200('0x4a')](_0xae9cbc[_0x5200('0x3f')],_0x97277[_0x5200('0x41')]));_0x3c2e8a[_0x5200('0x49')][_0x5200('0x5f')]=_0x446033['id'];if(_0xae9cbc[_0x5200('0x3f')][_0x5200('0x4b')]){_0x3c2e8a[_0x5200('0x49')]=_[_0x5200('0x4c')](_0x3c2e8a[_0x5200('0x49')],{'$or':_['map'](_0x3c2e8a[_0x5200('0x43')],function(_0x483021){var _0x3be83d={};_0x3be83d[_0x483021]={'$like':'%'+_0xae9cbc['query'][_0x5200('0x4b')]+'%'};return _0x3be83d;})});}if(_0xae9cbc[_0x5200('0x3f')]['$gte']){var _0x301646=_0xae9cbc[_0x5200('0x3f')][_0x5200('0x9a')][_0x5200('0x9b')](',');var _0x2a302f={};_0x2a302f[_0x301646[0x0]]={'$gte':moment(_0x301646[0x1])[_0x5200('0x9c')](_0x5200('0x9d'))};_0x3c2e8a[_0x5200('0x49')]=_[_0x5200('0x4c')](_0x3c2e8a[_0x5200('0x49')],_0x2a302f);}_0x3c2e8a=_[_0x5200('0x4c')]({},_0x3c2e8a,_0xae9cbc['options']);return db[_0x5200('0x99')][_0x5200('0x2c')]({'where':_0x3c2e8a[_0x5200('0x49')]})[_0x5200('0x1b')](function(_0x330db5){_0x2ced90[_0x5200('0x2c')]=_0x330db5;if(_0xae9cbc[_0x5200('0x3f')][_0x5200('0x51')]){_0x3c2e8a[_0x5200('0x52')]=[{'all':!![]}];}return db[_0x5200('0x99')][_0x5200('0x63')](_0x3c2e8a);})[_0x5200('0x1b')](function(_0x85d32f){_0x2ced90[_0x5200('0x4e')]=_0x85d32f;return _0x2ced90;});}})[_0x5200('0x1b')](respondWithFilteredResult(_0x5af1b2,_0x3c2e8a))[_0x5200('0x4f')](handleError(_0x5af1b2,null));};exports[_0x5200('0x36')]=function(_0x1e4ba8,_0x2e2d85,_0x34d0d8){var _0x4f370b,_0x4c9ca={},_0x31ed3b;if(_0x1e4ba8[_0x5200('0x54')]['to']){_0x31ed3b=_0x1e4ba8['body']['to'][0x0];}return db[_0x5200('0x3b')][_0x5200('0x59')]({'where':{'id':_0x1e4ba8['params']['id']},'include':[{'model':db['CmList'],'as':_0x5200('0x9e'),'include':[{'model':db[_0x5200('0x9f')],'as':_0x5200('0xa0'),'where':{'fax':_0x31ed3b},'limit':0x1,'order':[[_0x5200('0x96'),_0x5200('0xa1')]]}]}]})['then'](handleEntityNotFound(_0x2e2d85,null))[_0x5200('0x1b')](function(_0x4fffa0){_0x4f370b=_0x4fffa0;if(_0x1e4ba8[_0x5200('0x54')][_0x5200('0xa2')]&&_0x1e4ba8['body'][_0x5200('0xa2')][_0x5200('0x45')]){for(var _0x10f9e1=0x0;_0x10f9e1<_0x1e4ba8[_0x5200('0x54')][_0x5200('0xa2')][_0x5200('0x45')];_0x10f9e1+=0x1){_0x1e4ba8['body'][_0x5200('0xa2')][_0x10f9e1]={'filename':_0x1e4ba8[_0x5200('0x54')]['attachments'][_0x10f9e1]['name'],'id':_0x1e4ba8[_0x5200('0x54')]['attachments'][_0x10f9e1]['id'],'path':path[_0x5200('0xa3')](config['root'],_0x5200('0xa4'),_0x1e4ba8[_0x5200('0x54')]['attachments'][_0x10f9e1][_0x5200('0xa5')])};}}return respondWithRpcPromise(_0x5200('0xa6'),'CheckAfterSend',{'FaxAccountId':_['isNil'](_0x1e4ba8[_0x5200('0x5c')]['id'])?undefined:_0x1e4ba8[_0x5200('0x5c')]['id'],'path':_[_0x5200('0xa7')](_0x1e4ba8[_0x5200('0x54')][_0x5200('0xa2')][0x0][_0x5200('0x3')])?undefined:_0x1e4ba8['body'][_0x5200('0xa2')][0x0][_0x5200('0x3')],'fax':_[_0x5200('0xa7')](_0x1e4ba8[_0x5200('0x54')]['to'][0x0])?undefined:_0x1e4ba8['body']['to'][0x0]},client9002);})[_0x5200('0x1b')](function(){if(_0x4f370b){if(_[_0x5200('0xa7')](_0x1e4ba8['body']['from'])){_0x1e4ba8[_0x5200('0x54')][_0x5200('0xa8')]=util[_0x5200('0x9c')](_0x5200('0xa9'),_0x4f370b['name'],_0x4f370b['fax']);}if(_0x4f370b[_0x5200('0x9e')]){if(_0x4f370b[_0x5200('0x9e')][_0x5200('0xa0')][_0x5200('0x45')]){return _0x4f370b[_0x5200('0x9e')][_0x5200('0xa0')][0x0];}else{return db[_0x5200('0x9f')][_0x5200('0x53')](_[_0x5200('0x14')](_0x1e4ba8[_0x5200('0x54')],{'firstName':_0x1e4ba8[_0x5200('0x54')]['to'][0x0],'phone':_0x1e4ba8[_0x5200('0x54')]['to'][0x0],'fax':_0x1e4ba8[_0x5200('0x54')]['to'][0x0],'ListId':_0x4f370b[_0x5200('0xaa')]}));}}else{throw new Error(_0x5200('0xab'));}}else{throw new Error(_0x5200('0xac'));}})[_0x5200('0x1b')](function(_0x3e7644){if(_0x3e7644){return db[_0x5200('0x6b')]['find']({'where':{'ContactId':_0x3e7644['id'],'closed':![],'FaxAccountId':_0x4f370b['id']}})[_0x5200('0x1b')](function(_0xfba00b){if(_0xfba00b){return[_0xfba00b,![]];}return db[_0x5200('0x6b')][_0x5200('0x53')]({'UserId':_0x1e4ba8[_0x5200('0x55')]['id'],'ContactId':_0x3e7644['id'],'FaxAccountId':_0x4f370b['id'],'fax':_0x1e4ba8[_0x5200('0x54')]['to'][0x0],'firstMsgDirection':_0x5200('0xad'),'Messages':[_[_0x5200('0x4c')](_0x1e4ba8[_0x5200('0x54')],{'read':![],'body':_0x1e4ba8['body'][_0x5200('0xa2')][0x0][_0x5200('0xae')],'FaxAccountId':_0x4f370b['id'],'UserId':_0x1e4ba8['user']['id'],'ContactId':_0x3e7644['id'],'AttachmentId':_0x1e4ba8[_0x5200('0x54')][_0x5200('0xa2')][0x0]['id']})]},{'include':[{'model':db['FaxMessage'],'as':_0x5200('0xaf')}]})['then'](function(_0x1efe1d){return[_0x1efe1d,!![]];});});}else{throw new Error(_0x5200('0xb0'));}})[_0x5200('0xb1')](function(_0x8cd8f4,_0x3b1dd5){if(_0x3b1dd5){return _0x8cd8f4;}return db[_0x5200('0x99')][_0x5200('0x53')]({'direction':'out','read':![],'body':_0x1e4ba8[_0x5200('0x54')][_0x5200('0xa2')][0x0]['filename'],'FaxAccountId':_0x4f370b['id'],'FaxInteractionId':_0x8cd8f4['id'],'UserId':_0x1e4ba8[_0x5200('0x55')]['id'],'ContactId':_0x8cd8f4[_0x5200('0xb2')],'AttachmentId':_0x1e4ba8[_0x5200('0x54')][_0x5200('0xa2')][0x0]['id']})[_0x5200('0x1b')](function(_0x592eea){_0x8cd8f4['dataValues'][_0x5200('0xaf')]=[];_0x8cd8f4[_0x5200('0xb3')]['Messages'][_0x5200('0x8e')](_0x592eea[_0x5200('0xb3')]);return _0x8cd8f4;});})[_0x5200('0x1b')](function(_0x366468){respondWithRpcPromise('SendFax',_0x5200('0xb4'),{'FaxAccountId':_[_0x5200('0xa7')](_0x1e4ba8[_0x5200('0x5c')]['id'])?undefined:_0x1e4ba8[_0x5200('0x5c')]['id'],'path':_['isNil'](_0x1e4ba8[_0x5200('0x54')][_0x5200('0xa2')][0x0]['path'])?undefined:_0x1e4ba8['body'][_0x5200('0xa2')][0x0][_0x5200('0x3')],'fax':_[_0x5200('0xa7')](_0x1e4ba8[_0x5200('0x54')]['to'][0x0])?undefined:_0x1e4ba8[_0x5200('0x54')]['to'][0x0],'AttachmentId':_0x1e4ba8[_0x5200('0x54')][_0x5200('0xa2')][0x0]['id']},client9002)[_0x5200('0x1b')](function(_0x132fae){logger[_0x5200('0x1c')](_0x5200('0xb5'),_0x132fae);})[_0x5200('0x4f')](function(_0x16d25c){logger[_0x5200('0x1c')](_0x5200('0xb5'),_0x16d25c);});return _0x366468;})[_0x5200('0x1b')](respondWithResult(_0x2e2d85,null))[_0x5200('0x4f')](handleError(_0x2e2d85,null));};exports['addAgents']=function(_0x313cf9,_0x2bad7e,_0x1c4a65){return db[_0x5200('0x3b')][_0x5200('0x59')]({'where':{'id':_0x313cf9['params']['id']}})['then'](handleEntityNotFound(_0x2bad7e,null))[_0x5200('0x1b')](function(_0x14155b){if(_0x14155b){return _0x14155b['addAgents'](_0x313cf9[_0x5200('0x54')][_0x5200('0x65')],_[_0x5200('0x6c')](_0x313cf9[_0x5200('0x54')],[_0x5200('0x65'),'id'])||{})[_0x5200('0xb1')](function(_0x5d0abd){for(var _0x433148=0x0;_0x433148<_0x313cf9[_0x5200('0x54')][_0x5200('0x65')][_0x5200('0x45')];_0x433148+=0x1){socket['emit'](_0x5200('0xb6'),{'UserId':Number(_0x313cf9[_0x5200('0x54')][_0x5200('0x65')][_0x433148]),'FaxAccountId':Number(_0x313cf9['params']['id'])});}return _0x5d0abd;});}})[_0x5200('0x1b')](respondWithResult(_0x2bad7e,null))[_0x5200('0x4f')](handleError(_0x2bad7e,null));};exports[_0x5200('0xb7')]=function(_0x118894,_0x30e0fc,_0x21a673){return db[_0x5200('0x3b')]['find']({'where':{'id':_0x118894['params']['id']}})['then'](handleEntityNotFound(_0x30e0fc,null))[_0x5200('0x1b')](function(_0x4a9ead){if(_0x4a9ead){return _0x4a9ead[_0x5200('0xb7')](_0x118894[_0x5200('0x3f')][_0x5200('0x65')])[_0x5200('0x1b')](function(){if(_[_0x5200('0xb8')](_0x118894[_0x5200('0x3f')]['ids'])){for(var _0x1816f1=0x0;_0x1816f1<_0x118894[_0x5200('0x3f')][_0x5200('0x65')][_0x5200('0x45')];_0x1816f1+=0x1){socket[_0x5200('0xb9')](_0x5200('0xba'),{'UserId':Number(_0x118894[_0x5200('0x3f')]['ids'][_0x1816f1]),'FaxAccountId':Number(_0x118894[_0x5200('0x5c')]['id'])});}}else{socket['emit'](_0x5200('0xba'),{'UserId':Number(_0x118894[_0x5200('0x3f')][_0x5200('0x65')]),'FaxAccountId':Number(_0x118894[_0x5200('0x5c')]['id'])});}});}})[_0x5200('0x1b')](respondWithStatusCode(_0x30e0fc,null))[_0x5200('0x4f')](handleError(_0x30e0fc,null));};exports['getAgents']=function(_0x23ae33,_0x5353b2,_0x41b3ee){var _0x1c466c={};var _0x434718={};var _0x233489;var _0x18c362;return db[_0x5200('0x3b')][_0x5200('0x62')]({'where':{'id':_0x23ae33['params']['id']}})[_0x5200('0x1b')](handleEntityNotFound(_0x5353b2,null))[_0x5200('0x1b')](function(_0x44962d){if(_0x44962d){_0x233489=_0x44962d;_0x434718['model']=_[_0x5200('0x40')](db[_0x5200('0x6e')][_0x5200('0x50')]);_0x434718['query']=_[_0x5200('0x40')](_0x23ae33[_0x5200('0x3f')]);_0x434718[_0x5200('0x41')]=_[_0x5200('0x42')](_0x434718[_0x5200('0x3e')],_0x434718['query']);_0x1c466c[_0x5200('0x43')]=_[_0x5200('0x42')](_0x434718['model'],qs[_0x5200('0x44')](_0x23ae33[_0x5200('0x3f')]['fields']));_0x1c466c[_0x5200('0x43')]=_0x1c466c[_0x5200('0x43')][_0x5200('0x45')]?_0x1c466c[_0x5200('0x43')]:_0x434718[_0x5200('0x3e')];_0x1c466c[_0x5200('0x47')]=qs[_0x5200('0x48')](_0x23ae33['query'][_0x5200('0x48')]);_0x1c466c[_0x5200('0x49')]=qs[_0x5200('0x41')](_[_0x5200('0x4a')](_0x23ae33[_0x5200('0x3f')],_0x434718[_0x5200('0x41')]));if(_0x23ae33[_0x5200('0x3f')][_0x5200('0x4b')]){_0x1c466c[_0x5200('0x49')]=_[_0x5200('0x4c')](_0x1c466c['where'],{'$or':_[_0x5200('0x3a')](_0x1c466c[_0x5200('0x43')],function(_0x441a8d){var _0x536edf={};_0x536edf[_0x441a8d]={'$like':'%'+_0x23ae33['query']['filter']+'%'};return _0x536edf;})});}_0x1c466c=_[_0x5200('0x4c')]({},_0x1c466c,_0x23ae33['options']);return _0x233489['getAgents'](_0x1c466c);}})[_0x5200('0x1b')](function(_0xadf76f){if(_0xadf76f){_0x18c362=_0xadf76f[_0x5200('0x45')];if(!_0x23ae33[_0x5200('0x3f')]['hasOwnProperty'](_0x5200('0x69'))){_0x1c466c['limit']=qs[_0x5200('0x2b')](_0x23ae33[_0x5200('0x3f')][_0x5200('0x2b')]);_0x1c466c['offset']=qs[_0x5200('0x29')](_0x23ae33[_0x5200('0x3f')][_0x5200('0x29')]);}return _0x233489[_0x5200('0xbb')](_0x1c466c);}})['then'](function(_0x22513a){if(_0x22513a){return _0x22513a?{'count':_0x18c362,'rows':_0x22513a}:null;}})[_0x5200('0x1b')](respondWithResult(_0x5353b2,null))[_0x5200('0x4f')](handleError(_0x5353b2,null));}; \ No newline at end of file +var _0x4e3d=['info','SendFaxRpc,\x20%s','addAgents','emit','userFaxAccount:save','removeAgents','userFaxAccount:remove','getAgents','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','localhost','./faxAccount.socket','register','jayson/promise','client','request','then','FaxAccount,\x20%s,\x20%s','request\x20sent','FaxAccount,\x20%s,\x20%s,\x20%s','error','message','sendStatus','status','json','offset','undefined','limit','count','set','apply','save','update','destroy','get','UserProfileResource','end','stack','name','send','index','Pause','mandatoryDispositionPause','map','FaxAccount','rawAttributes','key','query','keys','filters','intersection','model','attributes','fields','length','nolimit','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','show','params','find','create','body','user','FaxAccounts','UserProfileSection','userProfileId','autoAssociation','catch','describe','addDisposition','FaxAccountId','Disposition','hasOwnProperty','order','sort','removeDispositions','ids','addAnswer','findOne','CannedAnswer','removeAnswers','omit','getInteractions','FaxInteraction','CmContact','User','Owner','internal','Tag','color','tag','addApplications','sequelize','transaction','FaxApplication','bulkCreate','findAndCountAll','priority','getApplications','from-voip-provider','exten','localstationid','app','description','Fax\x20Extension','appdata','push','Answer','CDR(type)=inbound-fax','Set','gateway','faxdetect','headerinfo','maxrate','modem','t38timeout','addAccountApplications','VoiceExtension','createdAt','updatedAt','ListId','getMessages','FaxMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','Contacts','DESC','attachments','join','root','server/files/attachments','basename','CheckAfterSend','isNil','from','\x22%s\x22\x20<%s>','fax','List','defaults','List\x20not\x20found','Send\x20Fax\x20failed','out','filename','Messages','spread','ContactId','dataValues','SendFax'];(function(_0x75aad9,_0x4433f3){var _0x461c58=function(_0x3482f6){while(--_0x3482f6){_0x75aad9['push'](_0x75aad9['shift']());}};_0x461c58(++_0x4433f3);}(_0x4e3d,0x174));var _0xd4e3=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x4e3d[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0xd4e3('0x0'));var rimraf=require(_0xd4e3('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xd4e3('0x2'));var moment=require(_0xd4e3('0x3'));var BPromise=require(_0xd4e3('0x4'));var Mustache=require(_0xd4e3('0x5'));var util=require(_0xd4e3('0x6'));var path=require(_0xd4e3('0x7'));var sox=require(_0xd4e3('0x8'));var csv=require(_0xd4e3('0x9'));var ejs=require(_0xd4e3('0xa'));var fs=require('fs');var fs_extra=require(_0xd4e3('0xb'));var _=require(_0xd4e3('0xc'));var squel=require('squel');var crypto=require(_0xd4e3('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xd4e3('0xe'));var toCsv=require('to-csv');var querystring=require(_0xd4e3('0xf'));var Papa=require(_0xd4e3('0x10'));var Redis=require(_0xd4e3('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xd4e3('0x12'));var as=require(_0xd4e3('0x13'));var hardwareService=require(_0xd4e3('0x14'));var logger=require(_0xd4e3('0x15'))(_0xd4e3('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xd4e3('0x17'))['db'];config['redis']=_['defaults'](config['redis'],{'host':_0xd4e3('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xd4e3('0x19'))[_0xd4e3('0x1a')](socket);var jayson=require(_0xd4e3('0x1b'));var client=jayson[_0xd4e3('0x1c')]['http']({'port':0x232c});var client9002=jayson[_0xd4e3('0x1c')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2de6fb,_0x1e0787,_0x3182f0,_0x42d6ba){return new BPromise(function(_0x671820,_0x3a6c1e){var _0x264350=_0x42d6ba||client;return _0x264350[_0xd4e3('0x1d')](_0x2de6fb,_0x3182f0)[_0xd4e3('0x1e')](function(_0x140174){logger['info'](_0xd4e3('0x1f'),_0x1e0787,_0xd4e3('0x20'));logger['debug'](_0xd4e3('0x21'),_0x1e0787,_0xd4e3('0x20'),JSON['stringify'](_0x140174));if(_0x140174[_0xd4e3('0x22')]){if(_0x140174[_0xd4e3('0x22')]['code']===0x1f4){logger['error'](_0xd4e3('0x1f'),_0x1e0787,_0x140174[_0xd4e3('0x22')][_0xd4e3('0x23')]);return _0x3a6c1e(_0x140174[_0xd4e3('0x22')][_0xd4e3('0x23')]);}logger[_0xd4e3('0x22')](_0xd4e3('0x1f'),_0x1e0787,_0x140174['error'][_0xd4e3('0x23')]);return _0x671820(_0x140174[_0xd4e3('0x22')][_0xd4e3('0x23')]);}else{logger['info']('FaxAccount,\x20%s,\x20%s',_0x1e0787,_0xd4e3('0x20'));_0x671820(_0x140174['result'][_0xd4e3('0x23')]);}})['catch'](function(_0x57d0c1){logger[_0xd4e3('0x22')](_0xd4e3('0x1f'),_0x1e0787,_0x57d0c1);_0x3a6c1e(_0x57d0c1);});});}function respondWithStatusCode(_0x12bb19,_0x498879){_0x498879=_0x498879||0xcc;return function(_0x46c5ac){if(_0x46c5ac){return _0x12bb19[_0xd4e3('0x24')](_0x498879);}return _0x12bb19[_0xd4e3('0x25')](_0x498879)['end']();};}function respondWithResult(_0x22eca1,_0x18c5cf){_0x18c5cf=_0x18c5cf||0xc8;return function(_0x15aa50){if(_0x15aa50){return _0x22eca1[_0xd4e3('0x25')](_0x18c5cf)[_0xd4e3('0x26')](_0x15aa50);}};}function respondWithFilteredResult(_0x5aeead,_0x596b5e){return function(_0x3644ae){if(_0x3644ae){var _0xef03f1=typeof _0x596b5e[_0xd4e3('0x27')]===_0xd4e3('0x28')&&typeof _0x596b5e[_0xd4e3('0x29')]===_0xd4e3('0x28');var _0x129bd0=_0x3644ae[_0xd4e3('0x2a')];var _0x15e454=_0xef03f1?0x0:_0x596b5e['offset'];var _0x57b3d2=_0xef03f1?_0x3644ae[_0xd4e3('0x2a')]:_0x596b5e[_0xd4e3('0x27')]+_0x596b5e['limit'];var _0x57d733;if(_0x57b3d2>=_0x129bd0){_0x57b3d2=_0x129bd0;_0x57d733=0xc8;}else{_0x57d733=0xce;}_0x5aeead[_0xd4e3('0x25')](_0x57d733);return _0x5aeead[_0xd4e3('0x2b')]('Content-Range',_0x15e454+'-'+_0x57b3d2+'/'+_0x129bd0)[_0xd4e3('0x26')](_0x3644ae);}return null;};}function patchUpdates(_0x51dde3){return function(_0xeb6c50){try{jsonpatch[_0xd4e3('0x2c')](_0xeb6c50,_0x51dde3,!![]);}catch(_0x337666){return BPromise['reject'](_0x337666);}return _0xeb6c50[_0xd4e3('0x2d')]();};}function saveUpdates(_0x5e84b5,_0x1378e7){return function(_0x16991b){if(_0x16991b){return _0x16991b[_0xd4e3('0x2e')](_0x5e84b5)['then'](function(_0x3a9681){return _0x3a9681;});}return null;};}function removeEntity(_0x448c8c,_0x1407f4){return function(_0x258621){if(_0x258621){return _0x258621[_0xd4e3('0x2f')]()[_0xd4e3('0x1e')](function(){var _0x4816f8=_0x258621[_0xd4e3('0x30')]({'plain':!![]});var _0x4f5f90='FaxAccounts';return db[_0xd4e3('0x31')]['destroy']({'where':{'type':_0x4f5f90,'resourceId':_0x4816f8['id']}})[_0xd4e3('0x1e')](function(){return _0x258621;});})[_0xd4e3('0x1e')](function(){_0x448c8c['status'](0xcc)[_0xd4e3('0x32')]();});}};}function handleEntityNotFound(_0x4340be,_0x45e7c0){return function(_0xa7a838){if(!_0xa7a838){_0x4340be[_0xd4e3('0x24')](0x194);}return _0xa7a838;};}function handleError(_0x3fcdec,_0x2cf747){_0x2cf747=_0x2cf747||0x1f4;return function(_0x5c88f9){logger[_0xd4e3('0x22')](_0x5c88f9[_0xd4e3('0x33')]);if(_0x5c88f9[_0xd4e3('0x34')]){delete _0x5c88f9['name'];}_0x3fcdec[_0xd4e3('0x25')](_0x2cf747)[_0xd4e3('0x35')](_0x5c88f9);};}exports[_0xd4e3('0x36')]=function(_0x203f64,_0x4d7787){var _0x1707e6={'include':[{'model':db[_0xd4e3('0x37')],'as':_0xd4e3('0x38')}]},_0x6985fe={},_0x225ab7={'count':0x0,'rows':[]};var _0x212d84=_[_0xd4e3('0x39')](db[_0xd4e3('0x3a')][_0xd4e3('0x3b')],function(_0x58c191){return{'name':_0x58c191['fieldName'],'type':_0x58c191['type'][_0xd4e3('0x3c')]};});_0x6985fe['model']=_['map'](_0x212d84,_0xd4e3('0x34'));_0x6985fe[_0xd4e3('0x3d')]=_[_0xd4e3('0x3e')](_0x203f64[_0xd4e3('0x3d')]);_0x6985fe[_0xd4e3('0x3f')]=_[_0xd4e3('0x40')](_0x6985fe[_0xd4e3('0x41')],_0x6985fe[_0xd4e3('0x3d')]);_0x1707e6[_0xd4e3('0x42')]=_[_0xd4e3('0x40')](_0x6985fe[_0xd4e3('0x41')],qs[_0xd4e3('0x43')](_0x203f64['query'][_0xd4e3('0x43')]));_0x1707e6[_0xd4e3('0x42')]=_0x1707e6[_0xd4e3('0x42')][_0xd4e3('0x44')]?_0x1707e6[_0xd4e3('0x42')]:_0x6985fe[_0xd4e3('0x41')];if(!_0x203f64[_0xd4e3('0x3d')]['hasOwnProperty'](_0xd4e3('0x45'))){_0x1707e6[_0xd4e3('0x29')]=qs[_0xd4e3('0x29')](_0x203f64[_0xd4e3('0x3d')]['limit']);_0x1707e6[_0xd4e3('0x27')]=qs[_0xd4e3('0x27')](_0x203f64['query'][_0xd4e3('0x27')]);}_0x1707e6['order']=qs['sort'](_0x203f64['query']['sort']);_0x1707e6[_0xd4e3('0x46')]=qs[_0xd4e3('0x3f')](_[_0xd4e3('0x47')](_0x203f64[_0xd4e3('0x3d')],_0x6985fe[_0xd4e3('0x3f')]),_0x212d84);if(_0x203f64[_0xd4e3('0x3d')][_0xd4e3('0x48')]){_0x1707e6[_0xd4e3('0x46')]=_[_0xd4e3('0x49')](_0x1707e6[_0xd4e3('0x46')],{'$or':_[_0xd4e3('0x39')](_0x212d84,function(_0x176369){if(_0x176369[_0xd4e3('0x4a')]!==_0xd4e3('0x4b')){var _0x580274={};_0x580274[_0x176369['name']]={'$like':'%'+_0x203f64[_0xd4e3('0x3d')][_0xd4e3('0x48')]+'%'};return _0x580274;}})});}_0x1707e6=_[_0xd4e3('0x49')]({},_0x1707e6,_0x203f64[_0xd4e3('0x4c')]);var _0x44f3c7={'where':_0x1707e6[_0xd4e3('0x46')]};return db[_0xd4e3('0x3a')][_0xd4e3('0x2a')](_0x44f3c7)[_0xd4e3('0x1e')](function(_0x5e29ee){_0x225ab7['count']=_0x5e29ee;if(_0x203f64[_0xd4e3('0x3d')][_0xd4e3('0x4d')]){_0x1707e6[_0xd4e3('0x4e')]=[{'all':!![]}];}return db['FaxAccount'][_0xd4e3('0x4f')](_0x1707e6);})[_0xd4e3('0x1e')](function(_0x3f23a2){_0x225ab7[_0xd4e3('0x50')]=_0x3f23a2;return _0x225ab7;})[_0xd4e3('0x1e')](respondWithFilteredResult(_0x4d7787,_0x1707e6))['catch'](handleError(_0x4d7787,null));};exports[_0xd4e3('0x51')]=function(_0xc7b656,_0x436682){var _0x56f581={'raw':![],'where':{'id':_0xc7b656[_0xd4e3('0x52')]['id']},'include':[{'model':db[_0xd4e3('0x37')],'as':_0xd4e3('0x38')}]},_0x522683={};_0x522683[_0xd4e3('0x41')]=_['keys'](db[_0xd4e3('0x3a')][_0xd4e3('0x3b')]);_0x522683[_0xd4e3('0x3d')]=_[_0xd4e3('0x3e')](_0xc7b656['query']);_0x522683[_0xd4e3('0x3f')]=_[_0xd4e3('0x40')](_0x522683[_0xd4e3('0x41')],_0x522683['query']);_0x56f581[_0xd4e3('0x42')]=_[_0xd4e3('0x40')](_0x522683[_0xd4e3('0x41')],qs['fields'](_0xc7b656[_0xd4e3('0x3d')][_0xd4e3('0x43')]));_0x56f581[_0xd4e3('0x42')]=_0x56f581[_0xd4e3('0x42')][_0xd4e3('0x44')]?_0x56f581[_0xd4e3('0x42')]:_0x522683['model'];if(_0xc7b656['query'][_0xd4e3('0x4d')]){_0x56f581['include']=[{'all':!![]}];}_0x56f581=_[_0xd4e3('0x49')]({},_0x56f581,_0xc7b656[_0xd4e3('0x4c')]);return db[_0xd4e3('0x3a')][_0xd4e3('0x53')](_0x56f581)[_0xd4e3('0x1e')](handleEntityNotFound(_0x436682,null))[_0xd4e3('0x1e')](respondWithResult(_0x436682,null))['catch'](handleError(_0x436682,null));};exports['create']=function(_0x58baac,_0x25487e){return db[_0xd4e3('0x3a')][_0xd4e3('0x54')](_0x58baac[_0xd4e3('0x55')],{})['then'](function(_0x298ab1){var _0xd2d46f=_0x58baac[_0xd4e3('0x56')][_0xd4e3('0x30')]({'plain':!![]});if(!_0xd2d46f)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xd2d46f['role']===_0xd4e3('0x56')){var _0x7caa0a=_0x298ab1[_0xd4e3('0x30')]({'plain':!![]});var _0x334043=_0xd4e3('0x57');return db[_0xd4e3('0x58')][_0xd4e3('0x53')]({'where':{'name':_0x334043,'userProfileId':_0xd2d46f[_0xd4e3('0x59')]},'raw':!![]})[_0xd4e3('0x1e')](function(_0x13ae87){if(_0x13ae87&&_0x13ae87[_0xd4e3('0x5a')]===0x0){return db[_0xd4e3('0x31')]['create']({'name':_0x7caa0a[_0xd4e3('0x34')],'resourceId':_0x7caa0a['id'],'type':_0x13ae87[_0xd4e3('0x34')],'sectionId':_0x13ae87['id']},{})[_0xd4e3('0x1e')](function(){return _0x298ab1;});}else{return _0x298ab1;}})[_0xd4e3('0x5b')](function(_0x29315a){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x29315a);throw _0x29315a;});}return _0x298ab1;})[_0xd4e3('0x1e')](respondWithResult(_0x25487e,0xc9))[_0xd4e3('0x5b')](handleError(_0x25487e,null));};exports['update']=function(_0x680a2d,_0x4ec56e){if(_0x680a2d[_0xd4e3('0x55')]['id']){delete _0x680a2d['body']['id'];}return db['FaxAccount']['find']({'where':{'id':_0x680a2d[_0xd4e3('0x52')]['id']},'include':[{'model':db[_0xd4e3('0x37')],'as':_0xd4e3('0x38')}]})[_0xd4e3('0x1e')](handleEntityNotFound(_0x4ec56e,null))[_0xd4e3('0x1e')](saveUpdates(_0x680a2d[_0xd4e3('0x55')],null))[_0xd4e3('0x1e')](respondWithResult(_0x4ec56e,null))['catch'](handleError(_0x4ec56e,null));};exports[_0xd4e3('0x2f')]=function(_0x451d79,_0x5e1789){return db[_0xd4e3('0x3a')][_0xd4e3('0x53')]({'where':{'id':_0x451d79[_0xd4e3('0x52')]['id']}})[_0xd4e3('0x1e')](handleEntityNotFound(_0x5e1789,null))['then'](removeEntity(_0x5e1789,null))[_0xd4e3('0x5b')](handleError(_0x5e1789,null));};exports[_0xd4e3('0x5c')]=function(_0x4cd869,_0x2e4ed6){return db[_0xd4e3('0x3a')]['describe']()['then'](respondWithResult(_0x2e4ed6,null))['catch'](handleError(_0x2e4ed6,null));};exports[_0xd4e3('0x5d')]=function(_0x1b09a1,_0x1052cf,_0x21275e){if(_0x1b09a1[_0xd4e3('0x55')]['id']){delete _0x1b09a1['body']['id'];}return db[_0xd4e3('0x3a')][_0xd4e3('0x53')]({'where':{'id':_0x1b09a1[_0xd4e3('0x52')]['id']}})[_0xd4e3('0x1e')](handleEntityNotFound(_0x1052cf,null))[_0xd4e3('0x1e')](function(_0x294e30){if(_0x294e30){_0x1b09a1[_0xd4e3('0x55')][_0xd4e3('0x5e')]=_0x294e30['id'];return db[_0xd4e3('0x5f')][_0xd4e3('0x54')](_0x1b09a1[_0xd4e3('0x55')]);}})[_0xd4e3('0x1e')](respondWithResult(_0x1052cf,null))['catch'](handleError(_0x1052cf,null));};exports['getDispositions']=function(_0x40592e,_0x4e58c9,_0x57e71b){var _0x179015={'raw':![],'where':{}};var _0x167812={};var _0x635569={'count':0x0,'rows':[]};return db[_0xd4e3('0x3a')]['findOne']({'where':{'id':_0x40592e[_0xd4e3('0x52')]['id']}})['then'](handleEntityNotFound(_0x4e58c9,null))[_0xd4e3('0x1e')](function(_0x5abd86){if(_0x5abd86){_0x167812['model']=_['keys'](db[_0xd4e3('0x5f')]['rawAttributes']);_0x167812['query']=_[_0xd4e3('0x3e')](_0x40592e[_0xd4e3('0x3d')]);_0x167812[_0xd4e3('0x3f')]=_[_0xd4e3('0x40')](_0x167812[_0xd4e3('0x41')],_0x167812[_0xd4e3('0x3d')]);_0x179015[_0xd4e3('0x42')]=_[_0xd4e3('0x40')](_0x167812[_0xd4e3('0x41')],qs['fields'](_0x40592e[_0xd4e3('0x3d')][_0xd4e3('0x43')]));_0x179015[_0xd4e3('0x42')]=_0x179015['attributes']['length']?_0x179015['attributes']:_0x167812[_0xd4e3('0x41')];if(!_0x40592e['query'][_0xd4e3('0x60')](_0xd4e3('0x45'))){_0x179015[_0xd4e3('0x29')]=qs[_0xd4e3('0x29')](_0x40592e[_0xd4e3('0x3d')]['limit']);_0x179015[_0xd4e3('0x27')]=qs[_0xd4e3('0x27')](_0x40592e[_0xd4e3('0x3d')][_0xd4e3('0x27')]);}_0x179015[_0xd4e3('0x61')]=qs[_0xd4e3('0x62')](_0x40592e[_0xd4e3('0x3d')]['sort']);_0x179015[_0xd4e3('0x46')]=qs[_0xd4e3('0x3f')](_[_0xd4e3('0x47')](_0x40592e[_0xd4e3('0x3d')],_0x167812['filters']));_0x179015[_0xd4e3('0x46')][_0xd4e3('0x5e')]=_0x5abd86['id'];if(_0x40592e[_0xd4e3('0x3d')]['filter']){_0x179015[_0xd4e3('0x46')]=_['merge'](_0x179015[_0xd4e3('0x46')],{'$or':_['map'](_0x179015[_0xd4e3('0x42')],function(_0x4129c0){var _0x4e36c0={};_0x4e36c0[_0x4129c0]={'$like':'%'+_0x40592e[_0xd4e3('0x3d')]['filter']+'%'};return _0x4e36c0;})});}_0x179015=_[_0xd4e3('0x49')]({},_0x179015,_0x40592e[_0xd4e3('0x4c')]);return db[_0xd4e3('0x5f')]['count']({'where':_0x179015[_0xd4e3('0x46')]})[_0xd4e3('0x1e')](function(_0x45b829){_0x635569[_0xd4e3('0x2a')]=_0x45b829;if(_0x40592e[_0xd4e3('0x3d')]['includeAll']){_0x179015[_0xd4e3('0x4e')]=[{'all':!![]}];}return db[_0xd4e3('0x5f')][_0xd4e3('0x4f')](_0x179015);})[_0xd4e3('0x1e')](function(_0x3e14f9){_0x635569[_0xd4e3('0x50')]=_0x3e14f9;return _0x635569;});}})['then'](respondWithFilteredResult(_0x4e58c9,_0x179015))[_0xd4e3('0x5b')](handleError(_0x4e58c9,null));};exports[_0xd4e3('0x63')]=function(_0x32026e,_0xc9a7d6,_0x442f3f){return db['FaxAccount'][_0xd4e3('0x53')]({'where':{'id':_0x32026e[_0xd4e3('0x52')]['id']}})[_0xd4e3('0x1e')](handleEntityNotFound(_0xc9a7d6,null))[_0xd4e3('0x1e')](function(_0x454739){if(_0x454739){return _0x454739['removeDispositions'](_0x32026e[_0xd4e3('0x3d')][_0xd4e3('0x64')]);}})['then'](respondWithStatusCode(_0xc9a7d6,null))[_0xd4e3('0x5b')](handleError(_0xc9a7d6,null));};exports[_0xd4e3('0x65')]=function(_0x25c039,_0x3663b5,_0x34c051){if(_0x25c039['body']['id']){delete _0x25c039[_0xd4e3('0x55')]['id'];}return db['FaxAccount']['find']({'where':{'id':_0x25c039[_0xd4e3('0x52')]['id']}})[_0xd4e3('0x1e')](handleEntityNotFound(_0x3663b5,null))[_0xd4e3('0x1e')](function(_0x2ba94c){if(_0x2ba94c){_0x25c039['body'][_0xd4e3('0x5e')]=_0x2ba94c['id'];return db['CannedAnswer'][_0xd4e3('0x54')](_0x25c039['body']);}})[_0xd4e3('0x1e')](respondWithResult(_0x3663b5,null))['catch'](handleError(_0x3663b5,null));};exports['getAnswers']=function(_0x3fb7fb,_0x18111e,_0x5c9b8a){var _0x5b4951={'raw':![],'where':{}};var _0x55b69f={};var _0x26a9ee={'count':0x0,'rows':[]};return db[_0xd4e3('0x3a')][_0xd4e3('0x66')]({'where':{'id':_0x3fb7fb[_0xd4e3('0x52')]['id']}})[_0xd4e3('0x1e')](handleEntityNotFound(_0x18111e,null))[_0xd4e3('0x1e')](function(_0x3c50cb){if(_0x3c50cb){_0x55b69f[_0xd4e3('0x41')]=_['keys'](db[_0xd4e3('0x67')][_0xd4e3('0x3b')]);_0x55b69f[_0xd4e3('0x3d')]=_[_0xd4e3('0x3e')](_0x3fb7fb[_0xd4e3('0x3d')]);_0x55b69f[_0xd4e3('0x3f')]=_[_0xd4e3('0x40')](_0x55b69f['model'],_0x55b69f[_0xd4e3('0x3d')]);_0x5b4951[_0xd4e3('0x42')]=_['intersection'](_0x55b69f['model'],qs[_0xd4e3('0x43')](_0x3fb7fb[_0xd4e3('0x3d')][_0xd4e3('0x43')]));_0x5b4951[_0xd4e3('0x42')]=_0x5b4951[_0xd4e3('0x42')][_0xd4e3('0x44')]?_0x5b4951['attributes']:_0x55b69f['model'];if(!_0x3fb7fb[_0xd4e3('0x3d')][_0xd4e3('0x60')](_0xd4e3('0x45'))){_0x5b4951[_0xd4e3('0x29')]=qs[_0xd4e3('0x29')](_0x3fb7fb['query']['limit']);_0x5b4951[_0xd4e3('0x27')]=qs[_0xd4e3('0x27')](_0x3fb7fb[_0xd4e3('0x3d')][_0xd4e3('0x27')]);}_0x5b4951[_0xd4e3('0x61')]=qs[_0xd4e3('0x62')](_0x3fb7fb['query'][_0xd4e3('0x62')]);_0x5b4951[_0xd4e3('0x46')]=qs[_0xd4e3('0x3f')](_['pick'](_0x3fb7fb[_0xd4e3('0x3d')],_0x55b69f[_0xd4e3('0x3f')]));_0x5b4951[_0xd4e3('0x46')][_0xd4e3('0x5e')]=_0x3c50cb['id'];if(_0x3fb7fb[_0xd4e3('0x3d')][_0xd4e3('0x48')]){_0x5b4951['where']=_[_0xd4e3('0x49')](_0x5b4951[_0xd4e3('0x46')],{'$or':_['map'](_0x5b4951['attributes'],function(_0x490a6f){var _0x10c81e={};_0x10c81e[_0x490a6f]={'$like':'%'+_0x3fb7fb[_0xd4e3('0x3d')][_0xd4e3('0x48')]+'%'};return _0x10c81e;})});}_0x5b4951=_[_0xd4e3('0x49')]({},_0x5b4951,_0x3fb7fb[_0xd4e3('0x4c')]);return db[_0xd4e3('0x67')]['count']({'where':_0x5b4951['where']})[_0xd4e3('0x1e')](function(_0x3d388c){_0x26a9ee[_0xd4e3('0x2a')]=_0x3d388c;if(_0x3fb7fb[_0xd4e3('0x3d')][_0xd4e3('0x4d')]){_0x5b4951[_0xd4e3('0x4e')]=[{'all':!![]}];}return db['CannedAnswer'][_0xd4e3('0x4f')](_0x5b4951);})[_0xd4e3('0x1e')](function(_0xc992f3){_0x26a9ee[_0xd4e3('0x50')]=_0xc992f3;return _0x26a9ee;});}})['then'](respondWithFilteredResult(_0x18111e,_0x5b4951))[_0xd4e3('0x5b')](handleError(_0x18111e,null));};exports[_0xd4e3('0x68')]=function(_0x4624ca,_0x2b425a,_0x5640a2){return db[_0xd4e3('0x3a')][_0xd4e3('0x53')]({'where':{'id':_0x4624ca[_0xd4e3('0x52')]['id']}})[_0xd4e3('0x1e')](handleEntityNotFound(_0x2b425a,null))[_0xd4e3('0x1e')](function(_0x42fec9){if(_0x42fec9){return _0x42fec9[_0xd4e3('0x68')](_0x4624ca['query'][_0xd4e3('0x64')]);}})[_0xd4e3('0x1e')](respondWithStatusCode(_0x2b425a,null))['catch'](handleError(_0x2b425a,null));};exports['addInteraction']=function(_0x32b6ff,_0x2fdb73,_0x12f847){return db['FaxInteraction']['find']({'where':{'id':_0x32b6ff['params']['id']}})['then'](handleEntityNotFound(_0x2fdb73,null))[_0xd4e3('0x1e')](function(_0x4ac26d){if(_0x4ac26d){return _0x4ac26d['addInteraction'](_0x32b6ff['body'][_0xd4e3('0x64')],_[_0xd4e3('0x69')](_0x32b6ff[_0xd4e3('0x55')],[_0xd4e3('0x64'),'id'])||{});}})[_0xd4e3('0x1e')](respondWithResult(_0x2fdb73,null))[_0xd4e3('0x5b')](handleError(_0x2fdb73,null));};exports[_0xd4e3('0x6a')]=function(_0x2761ea,_0x28dfcc,_0x25dee5){var _0x2b589a={'raw':![],'where':{}};var _0x88f87a={};var _0xdd0ea1={'count':0x0,'rows':[]};return db[_0xd4e3('0x3a')]['findOne']({'where':{'id':_0x2761ea[_0xd4e3('0x52')]['id']}})[_0xd4e3('0x1e')](handleEntityNotFound(_0x28dfcc,null))[_0xd4e3('0x1e')](function(_0x1e3fa7){if(_0x1e3fa7){_0x88f87a[_0xd4e3('0x41')]=_[_0xd4e3('0x3e')](db[_0xd4e3('0x6b')][_0xd4e3('0x3b')]);_0x88f87a[_0xd4e3('0x3d')]=_[_0xd4e3('0x3e')](_0x2761ea[_0xd4e3('0x3d')]);_0x88f87a[_0xd4e3('0x3f')]=_[_0xd4e3('0x40')](_0x88f87a['model'],_0x88f87a[_0xd4e3('0x3d')]);_0x2b589a[_0xd4e3('0x42')]=_[_0xd4e3('0x40')](_0x88f87a[_0xd4e3('0x41')],qs[_0xd4e3('0x43')](_0x2761ea['query']['fields']));_0x2b589a[_0xd4e3('0x42')]=_0x2b589a[_0xd4e3('0x42')][_0xd4e3('0x44')]?_0x2b589a[_0xd4e3('0x42')]:_0x88f87a[_0xd4e3('0x41')];if(!_0x2761ea[_0xd4e3('0x3d')][_0xd4e3('0x60')]('nolimit')){_0x2b589a[_0xd4e3('0x29')]=qs[_0xd4e3('0x29')](_0x2761ea[_0xd4e3('0x3d')][_0xd4e3('0x29')]);_0x2b589a['offset']=qs[_0xd4e3('0x27')](_0x2761ea['query'][_0xd4e3('0x27')]);}_0x2b589a['order']=qs[_0xd4e3('0x62')](_0x2761ea[_0xd4e3('0x3d')]['sort']);_0x2b589a['where']=qs['filters'](_[_0xd4e3('0x47')](_0x2761ea[_0xd4e3('0x3d')],_0x88f87a[_0xd4e3('0x3f')]));_0x2b589a[_0xd4e3('0x46')][_0xd4e3('0x5e')]=_0x1e3fa7['id'];if(_0x2761ea[_0xd4e3('0x3d')][_0xd4e3('0x48')]){_0x2b589a['where']=_[_0xd4e3('0x49')](_0x2b589a['where'],{'$or':_[_0xd4e3('0x39')](_0x2b589a[_0xd4e3('0x42')],function(_0x229489){var _0x4d056c={};_0x4d056c[_0x229489]={'$like':'%'+_0x2761ea[_0xd4e3('0x3d')][_0xd4e3('0x48')]+'%'};return _0x4d056c;})});}_0x2b589a=_[_0xd4e3('0x49')]({},_0x2b589a,_0x2761ea[_0xd4e3('0x4c')]);return db[_0xd4e3('0x6b')][_0xd4e3('0x2a')]({'where':_0x2b589a[_0xd4e3('0x46')]})[_0xd4e3('0x1e')](function(_0x8587e8){_0xdd0ea1[_0xd4e3('0x2a')]=_0x8587e8;if(_0x2761ea[_0xd4e3('0x3d')]['includeAll']){_0x2b589a[_0xd4e3('0x4e')]=[{'model':db[_0xd4e3('0x6c')],'as':'Contact','required':![]},{'model':db[_0xd4e3('0x6d')],'as':_0xd4e3('0x6e'),'attributes':[_0xd4e3('0x34'),'fullname',_0xd4e3('0x6f')],'required':![]},{'model':db[_0xd4e3('0x70')],'as':'Tags','attributes':['id',_0xd4e3('0x34'),_0xd4e3('0x71')],'where':_0x2761ea[_0xd4e3('0x3d')]['tag']?{'id':_0x2761ea[_0xd4e3('0x3d')][_0xd4e3('0x72')]}:undefined,'required':_0x2761ea[_0xd4e3('0x3d')][_0xd4e3('0x72')]?!![]:![]}];}return db[_0xd4e3('0x6b')][_0xd4e3('0x4f')](_0x2b589a);})[_0xd4e3('0x1e')](function(_0x359d13){_0xdd0ea1[_0xd4e3('0x50')]=_0x359d13;return _0xdd0ea1;});}})[_0xd4e3('0x1e')](respondWithFilteredResult(_0x28dfcc,_0x2b589a))[_0xd4e3('0x5b')](handleError(_0x28dfcc,null));};exports[_0xd4e3('0x73')]=function(_0x233ec8,_0x3efb0d){var _0x34ade4=_0x233ec8[_0xd4e3('0x52')]['id'];var _0x367ed3=_0x233ec8[_0xd4e3('0x55')];var _0x1bafc5=0xc8;var _0x1c355c=null;return db[_0xd4e3('0x74')][_0xd4e3('0x75')]({'isolationLevel':db['sequelize']['Transaction']['ISOLATION_LEVELS']['READ_COMMITTED']},function(_0x39798d){return db[_0xd4e3('0x3a')][_0xd4e3('0x66')]({'where':{'id':_0x34ade4},'transaction':_0x39798d})['then'](function(_0x2781c4){if(_0x2781c4){return db['FaxApplication'][_0xd4e3('0x2f')]({'where':{'FaxAccountId':_0x34ade4},'transaction':_0x39798d})[_0xd4e3('0x1e')](function(){var _0x24ae55=_['map'](_0x367ed3,function(_0x40a001){_0x40a001[_0xd4e3('0x5e')]=_0x34ade4;return _0x40a001;});return db[_0xd4e3('0x76')][_0xd4e3('0x77')](_0x24ae55,{'transaction':_0x39798d});});}else{_0x1bafc5=0x194;_0x1c355c=[];}});})[_0xd4e3('0x1e')](function(){if(_0x1bafc5!==0x194){return db[_0xd4e3('0x76')][_0xd4e3('0x78')]({'where':{'FaxAccountId':_0x34ade4},'order':_0xd4e3('0x79')})[_0xd4e3('0x1e')](function(_0x3e3e7f){_0x1c355c=_0x3e3e7f;});}})['catch'](function(_0x5e05dc){_0x1bafc5=0x1f4;logger['error'](_0x5e05dc[_0xd4e3('0x33')]);if(_0x5e05dc['name']){delete _0x5e05dc[_0xd4e3('0x34')];}_0x1c355c=_0x5e05dc;})['finally'](function(){if(_0x1c355c===null){_0x3efb0d[_0xd4e3('0x24')](_0x1bafc5);}else{if(_0x1bafc5===0x1f4){_0x3efb0d[_0xd4e3('0x25')](_0x1bafc5)[_0xd4e3('0x35')](_0x1c355c);}else{_0x3efb0d[_0xd4e3('0x25')](_0x1bafc5)[_0xd4e3('0x26')](_0x1c355c);}}});};exports[_0xd4e3('0x7a')]=function(_0x33aa84,_0x580ad5,_0x23a078){var _0x151982={};var _0x5ce5b4={};var _0x1df233;var _0x32b89b;return db[_0xd4e3('0x3a')]['findOne']({'where':{'id':_0x33aa84[_0xd4e3('0x52')]['id']}})[_0xd4e3('0x1e')](handleEntityNotFound(_0x580ad5,null))[_0xd4e3('0x1e')](function(_0x1970aa){if(_0x1970aa){_0x1df233=_0x1970aa;_0x5ce5b4[_0xd4e3('0x41')]=_['keys'](db[_0xd4e3('0x76')]['rawAttributes']);_0x5ce5b4[_0xd4e3('0x3d')]=_[_0xd4e3('0x3e')](_0x33aa84[_0xd4e3('0x3d')]);_0x5ce5b4[_0xd4e3('0x3f')]=_[_0xd4e3('0x40')](_0x5ce5b4[_0xd4e3('0x41')],_0x5ce5b4['query']);_0x151982[_0xd4e3('0x42')]=_['intersection'](_0x5ce5b4[_0xd4e3('0x41')],qs['fields'](_0x33aa84[_0xd4e3('0x3d')][_0xd4e3('0x43')]));_0x151982[_0xd4e3('0x42')]=_0x151982[_0xd4e3('0x42')]['length']?_0x151982['attributes']:_0x5ce5b4[_0xd4e3('0x41')];_0x151982[_0xd4e3('0x61')]=qs[_0xd4e3('0x62')](_0x33aa84[_0xd4e3('0x3d')][_0xd4e3('0x62')]);_0x151982[_0xd4e3('0x46')]=qs[_0xd4e3('0x3f')](_['pick'](_0x33aa84['query'],_0x5ce5b4[_0xd4e3('0x3f')]));if(_0x33aa84[_0xd4e3('0x3d')]['filter']){_0x151982[_0xd4e3('0x46')]=_[_0xd4e3('0x49')](_0x151982[_0xd4e3('0x46')],{'$or':_[_0xd4e3('0x39')](_0x151982[_0xd4e3('0x42')],function(_0x53c065){var _0x21e855={};_0x21e855[_0x53c065]={'$like':'%'+_0x33aa84[_0xd4e3('0x3d')][_0xd4e3('0x48')]+'%'};return _0x21e855;})});}_0x151982=_['merge']({},_0x151982,_0x33aa84[_0xd4e3('0x4c')]);return _0x1df233['getApplications'](_0x151982);}})[_0xd4e3('0x1e')](function(_0x16aa7a){if(_0x16aa7a){_0x32b89b=_0x16aa7a[_0xd4e3('0x44')];if(!_0x33aa84[_0xd4e3('0x3d')][_0xd4e3('0x60')](_0xd4e3('0x45'))){_0x151982[_0xd4e3('0x29')]=qs[_0xd4e3('0x29')](_0x33aa84[_0xd4e3('0x3d')]['limit']);_0x151982[_0xd4e3('0x27')]=qs[_0xd4e3('0x27')](_0x33aa84['query']['offset']);}return _0x1df233[_0xd4e3('0x7a')](_0x151982);}})[_0xd4e3('0x1e')](function(_0x5cf249){if(_0x5cf249){return _0x5cf249?{'count':_0x32b89b,'rows':_0x5cf249}:null;}})[_0xd4e3('0x1e')](respondWithResult(_0x580ad5,null))[_0xd4e3('0x5b')](handleError(_0x580ad5,null));};function Extension(_0xd5d85,_0x577575,_0x11ab7b,_0x32a0db){this['context']=_0xd4e3('0x7b');this[_0xd4e3('0x7c')]=_0xd5d85[_0xd4e3('0x7d')];this[_0xd4e3('0x7e')]=_0x32a0db;this[_0xd4e3('0x4a')]='system';this[_0xd4e3('0x7f')]=_0xd4e3('0x80');this[_0xd4e3('0x5e')]=_0xd5d85['id'];this[_0xd4e3('0x79')]=_0x577575;this[_0xd4e3('0x81')]=_0x11ab7b;}function createExtensionsReciveFax(_0xb6d284){var _0x2746a2=0x1;var _0x58802c=[];_0x58802c[_0xd4e3('0x82')](new Extension(_0xb6d284,_0x2746a2,'',_0xd4e3('0x83')));_0x2746a2+=0x1;_0x58802c[_0xd4e3('0x82')](new Extension(_0xb6d284,_0x2746a2,_0xd4e3('0x84'),_0xd4e3('0x85')));_0x2746a2+=0x1;for(var _0x4e75b9 in _0xb6d284){if(_0xb6d284['hasOwnProperty'](_0x4e75b9)&&(_0x4e75b9==='ecm'||_0x4e75b9===_0xd4e3('0x7d')||_0x4e75b9===_0xd4e3('0x86')||_0x4e75b9===_0xd4e3('0x87')||_0x4e75b9===_0xd4e3('0x88')||_0x4e75b9===_0xd4e3('0x89')||_0x4e75b9==='minrate'||_0x4e75b9===_0xd4e3('0x8a')||_0x4e75b9===_0xd4e3('0x8b'))){_0x58802c[_0xd4e3('0x82')](new Extension(_0xb6d284,_0x2746a2,'FAXOPT('+_0x4e75b9+')='+_0xb6d284[_0x4e75b9],_0xd4e3('0x85')));_0x2746a2+=0x1;}}_0x58802c[_0xd4e3('0x82')](new Extension(_0xb6d284,_0x2746a2,'6','Wait'));_0x2746a2+=0x1;_0x58802c[_0xd4e3('0x82')](new Extension(_0xb6d284,_0x2746a2,'/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'));_0x2746a2=0x0;return _0x58802c;}exports[_0xd4e3('0x8c')]=function(_0x4a8516,_0x4c750b,_0x4f4e66){var _0x4dd495;return db[_0xd4e3('0x74')]['transaction'](function(_0x40386b){return db[_0xd4e3('0x3a')][_0xd4e3('0x54')](_0x4a8516[_0xd4e3('0x55')],{'transaction':_0x40386b})['then'](function(_0x1aa1fd){_0x4dd495=_0x1aa1fd['get']({'plain':!![]});return db['VoiceExtension'][_0xd4e3('0x77')](createExtensionsReciveFax(_0x4dd495),{'transaction':_0x40386b});});})[_0xd4e3('0x1e')](function(){return _0x4dd495;})[_0xd4e3('0x1e')](respondWithResult(_0x4c750b,null))[_0xd4e3('0x5b')](handleError(_0x4c750b,null));};exports['updateAccountApplications']=function(_0x322ffb,_0x646d00,_0x2ccada){var _0x81778f;return db[_0xd4e3('0x74')]['transaction'](function(_0x105ea6){return db['FaxAccount'][_0xd4e3('0x2e')](_0x322ffb[_0xd4e3('0x55')],{'where':{'id':_0x322ffb['body']['id']},'transaction':_0x105ea6})[_0xd4e3('0x1e')](function(_0x4ab9d3){return db[_0xd4e3('0x8d')][_0xd4e3('0x2f')]({'where':{'FaxAccountId':_0x322ffb[_0xd4e3('0x55')]['id']},'transaction':_0x105ea6})[_0xd4e3('0x1e')](function(_0x425087){return db[_0xd4e3('0x8d')][_0xd4e3('0x77')](createExtensionsReciveFax(_['omit'](_0x322ffb[_0xd4e3('0x55')],['tech',_0xd4e3('0x3c'),_0xd4e3('0x8e'),_0xd4e3('0x8f'),'TrunkId',_0xd4e3('0x90')])),{'transaction':_0x105ea6});});});})[_0xd4e3('0x1e')](function(){return db['FaxAccount']['findById'](_0x322ffb[_0xd4e3('0x55')]['id']);})['then'](respondWithResult(_0x646d00,null))[_0xd4e3('0x5b')](handleError(_0x646d00,null));};exports[_0xd4e3('0x91')]=function(_0x35a1ab,_0x902e87,_0x2c6156){var _0x2f6873={'raw':!![],'where':{}};var _0x4371c6={};var _0x241039={'count':0x0,'rows':[]};return db[_0xd4e3('0x3a')][_0xd4e3('0x66')]({'where':{'id':_0x35a1ab[_0xd4e3('0x52')]['id']}})[_0xd4e3('0x1e')](handleEntityNotFound(_0x902e87,null))[_0xd4e3('0x1e')](function(_0x363b1e){if(_0x363b1e){_0x4371c6[_0xd4e3('0x41')]=_[_0xd4e3('0x3e')](db[_0xd4e3('0x92')][_0xd4e3('0x3b')]);_0x4371c6[_0xd4e3('0x3d')]=_['keys'](_0x35a1ab[_0xd4e3('0x3d')]);_0x4371c6[_0xd4e3('0x3f')]=_['intersection'](_0x4371c6[_0xd4e3('0x41')],_0x4371c6[_0xd4e3('0x3d')]);_0x2f6873['attributes']=_[_0xd4e3('0x40')](_0x4371c6[_0xd4e3('0x41')],qs[_0xd4e3('0x43')](_0x35a1ab[_0xd4e3('0x3d')][_0xd4e3('0x43')]));_0x2f6873['attributes']=_0x2f6873[_0xd4e3('0x42')][_0xd4e3('0x44')]?_0x2f6873[_0xd4e3('0x42')]:_0x4371c6[_0xd4e3('0x41')];if(!_0x35a1ab[_0xd4e3('0x3d')][_0xd4e3('0x60')]('nolimit')){_0x2f6873[_0xd4e3('0x29')]=qs[_0xd4e3('0x29')](_0x35a1ab[_0xd4e3('0x3d')]['limit']);_0x2f6873['offset']=qs[_0xd4e3('0x27')](_0x35a1ab[_0xd4e3('0x3d')][_0xd4e3('0x27')]);}_0x2f6873[_0xd4e3('0x61')]=qs[_0xd4e3('0x62')](_0x35a1ab[_0xd4e3('0x3d')]['sort']);_0x2f6873[_0xd4e3('0x46')]=qs['filters'](_['pick'](_0x35a1ab['query'],_0x4371c6['filters']));_0x2f6873[_0xd4e3('0x46')][_0xd4e3('0x5e')]=_0x363b1e['id'];if(_0x35a1ab['query'][_0xd4e3('0x48')]){_0x2f6873[_0xd4e3('0x46')]=_['merge'](_0x2f6873['where'],{'$or':_['map'](_0x2f6873[_0xd4e3('0x42')],function(_0x5d5338){var _0x14ca7c={};_0x14ca7c[_0x5d5338]={'$like':'%'+_0x35a1ab[_0xd4e3('0x3d')]['filter']+'%'};return _0x14ca7c;})});}if(_0x35a1ab['query'][_0xd4e3('0x93')]){var _0x6556a6=_0x35a1ab[_0xd4e3('0x3d')][_0xd4e3('0x93')][_0xd4e3('0x94')](',');var _0x1a27ba={};_0x1a27ba[_0x6556a6[0x0]]={'$gte':moment(_0x6556a6[0x1])[_0xd4e3('0x95')](_0xd4e3('0x96'))};_0x2f6873[_0xd4e3('0x46')]=_[_0xd4e3('0x49')](_0x2f6873[_0xd4e3('0x46')],_0x1a27ba);}_0x2f6873=_['merge']({},_0x2f6873,_0x35a1ab[_0xd4e3('0x4c')]);return db[_0xd4e3('0x92')][_0xd4e3('0x2a')]({'where':_0x2f6873[_0xd4e3('0x46')]})['then'](function(_0x331e5a){_0x241039[_0xd4e3('0x2a')]=_0x331e5a;if(_0x35a1ab[_0xd4e3('0x3d')][_0xd4e3('0x4d')]){_0x2f6873[_0xd4e3('0x4e')]=[{'all':!![]}];}return db[_0xd4e3('0x92')][_0xd4e3('0x4f')](_0x2f6873);})['then'](function(_0x528601){_0x241039[_0xd4e3('0x50')]=_0x528601;return _0x241039;});}})[_0xd4e3('0x1e')](respondWithFilteredResult(_0x902e87,_0x2f6873))[_0xd4e3('0x5b')](handleError(_0x902e87,null));};exports[_0xd4e3('0x35')]=function(_0x3179e8,_0x47b412,_0x3f3ad4){var _0x5c6fdb,_0x38c352={},_0x54c15f;if(_0x3179e8[_0xd4e3('0x55')]['to']){_0x54c15f=_0x3179e8[_0xd4e3('0x55')]['to'][0x0];}return db[_0xd4e3('0x3a')][_0xd4e3('0x53')]({'where':{'id':_0x3179e8['params']['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0xd4e3('0x6c')],'as':_0xd4e3('0x97'),'where':{'fax':_0x54c15f},'limit':0x1,'order':[[_0xd4e3('0x8f'),_0xd4e3('0x98')]]}]}]})[_0xd4e3('0x1e')](handleEntityNotFound(_0x47b412,null))[_0xd4e3('0x1e')](function(_0x3cf845){_0x5c6fdb=_0x3cf845;if(_0x3179e8['body']['attachments']&&_0x3179e8[_0xd4e3('0x55')]['attachments'][_0xd4e3('0x44')]){for(var _0x114bb8=0x0;_0x114bb8<_0x3179e8[_0xd4e3('0x55')][_0xd4e3('0x99')][_0xd4e3('0x44')];_0x114bb8+=0x1){_0x3179e8[_0xd4e3('0x55')]['attachments'][_0x114bb8]={'filename':_0x3179e8[_0xd4e3('0x55')][_0xd4e3('0x99')][_0x114bb8]['name'],'id':_0x3179e8[_0xd4e3('0x55')][_0xd4e3('0x99')][_0x114bb8]['id'],'path':path[_0xd4e3('0x9a')](config[_0xd4e3('0x9b')],_0xd4e3('0x9c'),_0x3179e8[_0xd4e3('0x55')]['attachments'][_0x114bb8][_0xd4e3('0x9d')])};}}return respondWithRpcPromise(_0xd4e3('0x9e'),_0xd4e3('0x9e'),{'FaxAccountId':_['isNil'](_0x3179e8[_0xd4e3('0x52')]['id'])?undefined:_0x3179e8[_0xd4e3('0x52')]['id'],'path':_[_0xd4e3('0x9f')](_0x3179e8[_0xd4e3('0x55')][_0xd4e3('0x99')][0x0][_0xd4e3('0x7')])?undefined:_0x3179e8[_0xd4e3('0x55')][_0xd4e3('0x99')][0x0][_0xd4e3('0x7')],'fax':_['isNil'](_0x3179e8[_0xd4e3('0x55')]['to'][0x0])?undefined:_0x3179e8['body']['to'][0x0]},client9002);})[_0xd4e3('0x1e')](function(){if(_0x5c6fdb){if(_[_0xd4e3('0x9f')](_0x3179e8[_0xd4e3('0x55')][_0xd4e3('0xa0')])){_0x3179e8[_0xd4e3('0x55')]['from']=util[_0xd4e3('0x95')](_0xd4e3('0xa1'),_0x5c6fdb['name'],_0x5c6fdb[_0xd4e3('0xa2')]);}if(_0x5c6fdb[_0xd4e3('0xa3')]){if(_0x5c6fdb['List'][_0xd4e3('0x97')][_0xd4e3('0x44')]){return _0x5c6fdb[_0xd4e3('0xa3')][_0xd4e3('0x97')][0x0];}else{return db[_0xd4e3('0x6c')]['create'](_[_0xd4e3('0xa4')](_0x3179e8[_0xd4e3('0x55')],{'firstName':_0x3179e8[_0xd4e3('0x55')]['to'][0x0],'phone':_0x3179e8[_0xd4e3('0x55')]['to'][0x0],'fax':_0x3179e8[_0xd4e3('0x55')]['to'][0x0],'ListId':_0x5c6fdb[_0xd4e3('0x90')]}));}}else{throw new Error(_0xd4e3('0xa5'));}}else{throw new Error(_0xd4e3('0xa6'));}})[_0xd4e3('0x1e')](function(_0x5a2ea0){if(_0x5a2ea0){return db[_0xd4e3('0x6b')][_0xd4e3('0x53')]({'where':{'ContactId':_0x5a2ea0['id'],'closed':![],'FaxAccountId':_0x5c6fdb['id']}})[_0xd4e3('0x1e')](function(_0xfb28f2){if(_0xfb28f2){return[_0xfb28f2,![]];}return db[_0xd4e3('0x6b')][_0xd4e3('0x54')]({'UserId':_0x3179e8['user']['id'],'ContactId':_0x5a2ea0['id'],'FaxAccountId':_0x5c6fdb['id'],'fax':_0x3179e8[_0xd4e3('0x55')]['to'][0x0],'firstMsgDirection':_0xd4e3('0xa7'),'Messages':[_[_0xd4e3('0x49')](_0x3179e8[_0xd4e3('0x55')],{'read':![],'body':_0x3179e8[_0xd4e3('0x55')]['attachments'][0x0][_0xd4e3('0xa8')],'FaxAccountId':_0x5c6fdb['id'],'UserId':_0x3179e8[_0xd4e3('0x56')]['id'],'ContactId':_0x5a2ea0['id'],'AttachmentId':_0x3179e8[_0xd4e3('0x55')][_0xd4e3('0x99')][0x0]['id']})]},{'include':[{'model':db[_0xd4e3('0x92')],'as':_0xd4e3('0xa9')}]})[_0xd4e3('0x1e')](function(_0x54fa8a){return[_0x54fa8a,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0xd4e3('0xaa')](function(_0x2ca292,_0x5461f0){if(_0x5461f0){return _0x2ca292;}return db[_0xd4e3('0x92')][_0xd4e3('0x54')]({'direction':_0xd4e3('0xa7'),'read':![],'body':_0x3179e8[_0xd4e3('0x55')][_0xd4e3('0x99')][0x0][_0xd4e3('0xa8')],'FaxAccountId':_0x5c6fdb['id'],'FaxInteractionId':_0x2ca292['id'],'UserId':_0x3179e8[_0xd4e3('0x56')]['id'],'ContactId':_0x2ca292[_0xd4e3('0xab')],'AttachmentId':_0x3179e8[_0xd4e3('0x55')][_0xd4e3('0x99')][0x0]['id']})[_0xd4e3('0x1e')](function(_0x34223a){_0x2ca292[_0xd4e3('0xac')][_0xd4e3('0xa9')]=[];_0x2ca292[_0xd4e3('0xac')]['Messages'][_0xd4e3('0x82')](_0x34223a[_0xd4e3('0xac')]);return _0x2ca292;});})[_0xd4e3('0x1e')](function(_0x1a1cba){respondWithRpcPromise(_0xd4e3('0xad'),_0xd4e3('0xad'),{'FaxAccountId':_[_0xd4e3('0x9f')](_0x3179e8[_0xd4e3('0x52')]['id'])?undefined:_0x3179e8[_0xd4e3('0x52')]['id'],'path':_[_0xd4e3('0x9f')](_0x3179e8[_0xd4e3('0x55')][_0xd4e3('0x99')][0x0]['path'])?undefined:_0x3179e8[_0xd4e3('0x55')][_0xd4e3('0x99')][0x0][_0xd4e3('0x7')],'fax':_[_0xd4e3('0x9f')](_0x3179e8[_0xd4e3('0x55')]['to'][0x0])?undefined:_0x3179e8[_0xd4e3('0x55')]['to'][0x0],'AttachmentId':_0x3179e8['body'][_0xd4e3('0x99')][0x0]['id']},client9002)[_0xd4e3('0x1e')](function(_0x15f17c){logger[_0xd4e3('0xae')](_0xd4e3('0xaf'),_0x15f17c);})[_0xd4e3('0x5b')](function(_0x3aaf11){logger[_0xd4e3('0xae')](_0xd4e3('0xaf'),_0x3aaf11);});return _0x1a1cba;})[_0xd4e3('0x1e')](respondWithResult(_0x47b412,null))[_0xd4e3('0x5b')](handleError(_0x47b412,null));};exports['addAgents']=function(_0x5b0c81,_0x2d02de,_0x4ea5be){return db['FaxAccount'][_0xd4e3('0x53')]({'where':{'id':_0x5b0c81['params']['id']}})[_0xd4e3('0x1e')](handleEntityNotFound(_0x2d02de,null))[_0xd4e3('0x1e')](function(_0x29e519){if(_0x29e519){return _0x29e519[_0xd4e3('0xb0')](_0x5b0c81['body'][_0xd4e3('0x64')],_[_0xd4e3('0x69')](_0x5b0c81[_0xd4e3('0x55')],[_0xd4e3('0x64'),'id'])||{})[_0xd4e3('0xaa')](function(_0x13427d){for(var _0x755ac=0x0;_0x755ac<_0x5b0c81['body'][_0xd4e3('0x64')][_0xd4e3('0x44')];_0x755ac+=0x1){socket[_0xd4e3('0xb1')](_0xd4e3('0xb2'),{'UserId':Number(_0x5b0c81[_0xd4e3('0x55')][_0xd4e3('0x64')][_0x755ac]),'FaxAccountId':Number(_0x5b0c81['params']['id'])});}return _0x13427d;});}})[_0xd4e3('0x1e')](respondWithResult(_0x2d02de,null))[_0xd4e3('0x5b')](handleError(_0x2d02de,null));};exports[_0xd4e3('0xb3')]=function(_0x1a9b62,_0x18f371,_0x2b5767){return db[_0xd4e3('0x3a')][_0xd4e3('0x53')]({'where':{'id':_0x1a9b62[_0xd4e3('0x52')]['id']}})['then'](handleEntityNotFound(_0x18f371,null))[_0xd4e3('0x1e')](function(_0x3b5ee6){if(_0x3b5ee6){return _0x3b5ee6[_0xd4e3('0xb3')](_0x1a9b62['query']['ids'])[_0xd4e3('0x1e')](function(){if(_['isArray'](_0x1a9b62[_0xd4e3('0x3d')][_0xd4e3('0x64')])){for(var _0x407b60=0x0;_0x407b60<_0x1a9b62['query']['ids'][_0xd4e3('0x44')];_0x407b60+=0x1){socket[_0xd4e3('0xb1')](_0xd4e3('0xb4'),{'UserId':Number(_0x1a9b62['query']['ids'][_0x407b60]),'FaxAccountId':Number(_0x1a9b62['params']['id'])});}}else{socket[_0xd4e3('0xb1')]('userFaxAccount:remove',{'UserId':Number(_0x1a9b62[_0xd4e3('0x3d')]['ids']),'FaxAccountId':Number(_0x1a9b62[_0xd4e3('0x52')]['id'])});}});}})[_0xd4e3('0x1e')](respondWithStatusCode(_0x18f371,null))[_0xd4e3('0x5b')](handleError(_0x18f371,null));};exports[_0xd4e3('0xb5')]=function(_0x8bb7ff,_0x105ad0,_0x476551){var _0x2991b1={};var _0x567ec3={};var _0x1a4310;var _0x2d8842;return db[_0xd4e3('0x3a')][_0xd4e3('0x66')]({'where':{'id':_0x8bb7ff[_0xd4e3('0x52')]['id']}})[_0xd4e3('0x1e')](handleEntityNotFound(_0x105ad0,null))[_0xd4e3('0x1e')](function(_0xd9c6f6){if(_0xd9c6f6){_0x1a4310=_0xd9c6f6;_0x567ec3['model']=_['keys'](db[_0xd4e3('0x6d')][_0xd4e3('0x3b')]);_0x567ec3[_0xd4e3('0x3d')]=_[_0xd4e3('0x3e')](_0x8bb7ff[_0xd4e3('0x3d')]);_0x567ec3[_0xd4e3('0x3f')]=_[_0xd4e3('0x40')](_0x567ec3[_0xd4e3('0x41')],_0x567ec3['query']);_0x2991b1[_0xd4e3('0x42')]=_[_0xd4e3('0x40')](_0x567ec3[_0xd4e3('0x41')],qs[_0xd4e3('0x43')](_0x8bb7ff['query'][_0xd4e3('0x43')]));_0x2991b1[_0xd4e3('0x42')]=_0x2991b1[_0xd4e3('0x42')][_0xd4e3('0x44')]?_0x2991b1['attributes']:_0x567ec3[_0xd4e3('0x41')];_0x2991b1['order']=qs[_0xd4e3('0x62')](_0x8bb7ff[_0xd4e3('0x3d')][_0xd4e3('0x62')]);_0x2991b1[_0xd4e3('0x46')]=qs[_0xd4e3('0x3f')](_[_0xd4e3('0x47')](_0x8bb7ff['query'],_0x567ec3[_0xd4e3('0x3f')]));if(_0x8bb7ff['query'][_0xd4e3('0x48')]){_0x2991b1[_0xd4e3('0x46')]=_[_0xd4e3('0x49')](_0x2991b1[_0xd4e3('0x46')],{'$or':_[_0xd4e3('0x39')](_0x2991b1['attributes'],function(_0x26815){var _0x5ab369={};_0x5ab369[_0x26815]={'$like':'%'+_0x8bb7ff[_0xd4e3('0x3d')]['filter']+'%'};return _0x5ab369;})});}_0x2991b1=_[_0xd4e3('0x49')]({},_0x2991b1,_0x8bb7ff[_0xd4e3('0x4c')]);return _0x1a4310[_0xd4e3('0xb5')](_0x2991b1);}})[_0xd4e3('0x1e')](function(_0x5a414b){if(_0x5a414b){_0x2d8842=_0x5a414b['length'];if(!_0x8bb7ff['query']['hasOwnProperty'](_0xd4e3('0x45'))){_0x2991b1['limit']=qs['limit'](_0x8bb7ff['query'][_0xd4e3('0x29')]);_0x2991b1[_0xd4e3('0x27')]=qs[_0xd4e3('0x27')](_0x8bb7ff[_0xd4e3('0x3d')][_0xd4e3('0x27')]);}return _0x1a4310[_0xd4e3('0xb5')](_0x2991b1);}})[_0xd4e3('0x1e')](function(_0x32ba68){if(_0x32ba68){return _0x32ba68?{'count':_0x2d8842,'rows':_0x32ba68}:null;}})[_0xd4e3('0x1e')](respondWithResult(_0x105ad0,null))['catch'](handleError(_0x105ad0,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index 89761c5..5725c99 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 _0xa81d=['../../mysqldb','setMaxListeners','update','remove','hasOwnProperty','exports','events'];(function(_0x36c5b0,_0x5001da){var _0xf19333=function(_0x1e880a){while(--_0x1e880a){_0x36c5b0['push'](_0x36c5b0['shift']());}};_0xf19333(++_0x5001da);}(_0xa81d,0x11e));var _0xda81=function(_0x3c834d,_0x4f9feb){_0x3c834d=_0x3c834d-0x0;var _0x508ff4=_0xa81d[_0x3c834d];return _0x508ff4;};'use strict';var EventEmitter=require(_0xda81('0x0'));var FaxAccount=require(_0xda81('0x1'))['db']['FaxAccount'];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0xda81('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xda81('0x3'),'afterDestroy':_0xda81('0x4')};function emitEvent(_0x74cbca){return function(_0x1c3649,_0x3d07ad,_0x380972){FaxAccountEvents['emit'](_0x74cbca+':'+_0x1c3649['id'],_0x1c3649);FaxAccountEvents['emit'](_0x74cbca,_0x1c3649);_0x380972(null);};}for(var e in events){if(events[_0xda81('0x5')](e)){var event=events[e];FaxAccount['hook'](e,emitEvent(event));}}module[_0xda81('0x6')]=FaxAccountEvents; \ No newline at end of file +var _0x53f7=['setMaxListeners','save','update','emit','hook','exports','events','FaxAccount'];(function(_0x58df3b,_0x182132){var _0x1c82d6=function(_0x48b1a2){while(--_0x48b1a2){_0x58df3b['push'](_0x58df3b['shift']());}};_0x1c82d6(++_0x182132);}(_0x53f7,0x126));var _0x753f=function(_0x56e80c,_0xd0f2eb){_0x56e80c=_0x56e80c-0x0;var _0x2ece80=_0x53f7[_0x56e80c];return _0x2ece80;};'use strict';var EventEmitter=require(_0x753f('0x0'));var FaxAccount=require('../../mysqldb')['db'][_0x753f('0x1')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x753f('0x2')](0x0);var events={'afterCreate':_0x753f('0x3'),'afterUpdate':_0x753f('0x4'),'afterDestroy':'remove'};function emitEvent(_0x41785e){return function(_0x1daa6c,_0x2e3c28,_0x498a55){FaxAccountEvents[_0x753f('0x5')](_0x41785e+':'+_0x1daa6c['id'],_0x1daa6c);FaxAccountEvents[_0x753f('0x5')](_0x41785e,_0x1daa6c);_0x498a55(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxAccount[_0x753f('0x6')](e,emitEvent(event));}}module[_0x753f('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 c19c6ad..5b66819 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 _0xd910=['../../config/logger','api','bluebird','request-promise','path','rimraf','./faxAccount.attributes','exports','FaxAccount','fax_accounts','lodash','util'];(function(_0x3ebc85,_0x59be56){var _0x2f24df=function(_0x49054f){while(--_0x49054f){_0x3ebc85['push'](_0x3ebc85['shift']());}};_0x2f24df(++_0x59be56);}(_0xd910,0x166));var _0x0d91=function(_0x33e589,_0x4d48d3){_0x33e589=_0x33e589-0x0;var _0x117a6b=_0xd910[_0x33e589];return _0x117a6b;};'use strict';var _=require(_0x0d91('0x0'));var util=require(_0x0d91('0x1'));var logger=require(_0x0d91('0x2'))(_0x0d91('0x3'));var moment=require('moment');var BPromise=require(_0x0d91('0x4'));var rp=require(_0x0d91('0x5'));var fs=require('fs');var path=require(_0x0d91('0x6'));var rimraf=require(_0x0d91('0x7'));var config=require('../../config/environment');var attributes=require(_0x0d91('0x8'));module[_0x0d91('0x9')]=function(_0x5cc879,_0x5e4717){return _0x5cc879['define'](_0x0d91('0xa'),attributes,{'tableName':_0x0d91('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa6d0=['request-promise','path','rimraf','../../config/environment','define','FaxAccount','lodash','../../config/logger','api'];(function(_0x28014d,_0x383e2f){var _0x2572cc=function(_0x17aabd){while(--_0x17aabd){_0x28014d['push'](_0x28014d['shift']());}};_0x2572cc(++_0x383e2f);}(_0xa6d0,0x192));var _0x0a6d=function(_0x233e66,_0x4063b7){_0x233e66=_0x233e66-0x0;var _0x144bf2=_0xa6d0[_0x233e66];return _0x144bf2;};'use strict';var _=require(_0x0a6d('0x0'));var util=require('util');var logger=require(_0x0a6d('0x1'))(_0x0a6d('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x0a6d('0x3'));var fs=require('fs');var path=require(_0x0a6d('0x4'));var rimraf=require(_0x0a6d('0x5'));var config=require(_0x0a6d('0x6'));var attributes=require('./faxAccount.attributes');module['exports']=function(_0x580997,_0x28e2f3){return _0x580997[_0x0a6d('0x7')](_0x0a6d('0x8'),attributes,{'tableName':'fax_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.rpc.js b/server/api/faxAccount/faxAccount.rpc.js index 2f64d68..a653d33 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 _0x546c=['FaxAccount','options','raw','where','attributes','include','model','map','NotifyFaxAccount','body','CmContact','describe','Sequelize','ValidationError','no\x20available\x20attributes','keys','createdAt','updatedAt','difference','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','isNil','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','find','List','Contacts','DESC','FaxApplication','Applications','get','list','applications','priority','account','length','defaults','ListId','contact','fax','FaxInteraction','create','spread','autoclose','close','unmanaged','created','interaction','FaxMessage','AttachmentId','UserId','name','unshift','agent','*,*,*,*','FaxQueue','queueId','Start','startRouting','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','./faxAccount.socket','request','then','info','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxAccount,\x20%s,\x20%s','message','GetFaxAccount'];(function(_0x34fe14,_0x36f526){var _0x3dd3b7=function(_0x5a669f){while(--_0x5a669f){_0x34fe14['push'](_0x34fe14['shift']());}};_0x3dd3b7(++_0x36f526);}(_0x546c,0x94));var _0xc546=function(_0x416528,_0x101c25){_0x416528=_0x416528-0x0;var _0x581955=_0x546c[_0x416528];return _0x581955;};'use strict';var _=require(_0xc546('0x0'));var util=require(_0xc546('0x1'));var moment=require('moment');var BPromise=require(_0xc546('0x2'));var rs=require(_0xc546('0x3'));var fs=require('fs');var Redis=require(_0xc546('0x4'));var db=require(_0xc546('0x5'))['db'];var utils=require(_0xc546('0x6'));var logger=require(_0xc546('0x7'))(_0xc546('0x8'));var config=require(_0xc546('0x9'));var jayson=require(_0xc546('0xa'));var client=jayson[_0xc546('0xb')]['http']({'port':0x232c});config[_0xc546('0xc')]=_['defaults'](config[_0xc546('0xc')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc546('0xc')]));require(_0xc546('0xd'))['register'](socket);function respondWithRpcPromise(_0x5e0502,_0x239513,_0x46be21){return new BPromise(function(_0x402f0e,_0x28a553){return client[_0xc546('0xe')](_0x5e0502,_0x46be21)[_0xc546('0xf')](function(_0x50fddd){logger[_0xc546('0x10')]('FaxAccount,\x20%s,\x20%s',_0x239513,_0xc546('0x11'));logger[_0xc546('0x12')](_0xc546('0x13'),_0x239513,_0xc546('0x11'),JSON[_0xc546('0x14')](_0x50fddd));if(_0x50fddd[_0xc546('0x15')]){if(_0x50fddd[_0xc546('0x15')][_0xc546('0x16')]===0x1f4){logger[_0xc546('0x15')](_0xc546('0x17'),_0x239513,_0x50fddd[_0xc546('0x15')]['message']);return _0x28a553(_0x50fddd[_0xc546('0x15')][_0xc546('0x18')]);}logger[_0xc546('0x15')]('FaxAccount,\x20%s,\x20%s',_0x239513,_0x50fddd['error'][_0xc546('0x18')]);return _0x402f0e(_0x50fddd[_0xc546('0x15')]['message']);}else{logger[_0xc546('0x10')]('FaxAccount,\x20%s,\x20%s',_0x239513,_0xc546('0x11'));_0x402f0e(_0x50fddd['result'][_0xc546('0x18')]);}})['catch'](function(_0x50d076){logger['error'](_0xc546('0x17'),_0x239513,_0x50d076);_0x28a553(_0x50d076);});});}exports[_0xc546('0x19')]=function(_0x5cb541){var _0x173692=this;return new Promise(function(_0x4ea11b,_0x3d71f5){return db[_0xc546('0x1a')]['findAll']({'raw':_0x5cb541[_0xc546('0x1b')]?_0x5cb541[_0xc546('0x1b')][_0xc546('0x1c')]===undefined?!![]:![]:!![],'where':_0x5cb541['options']?_0x5cb541[_0xc546('0x1b')][_0xc546('0x1d')]||null:null,'attributes':_0x5cb541[_0xc546('0x1b')]?_0x5cb541[_0xc546('0x1b')][_0xc546('0x1e')]||null:null,'limit':_0x5cb541['options']?_0x5cb541[_0xc546('0x1b')]['limit']||null:null,'include':_0x5cb541[_0xc546('0x1b')]?_0x5cb541[_0xc546('0x1b')][_0xc546('0x1f')]?_['map'](_0x5cb541['options'][_0xc546('0x1f')],function(_0x29d9b1){return{'model':db[_0x29d9b1[_0xc546('0x20')]],'as':_0x29d9b1['as'],'attributes':_0x29d9b1[_0xc546('0x1e')],'include':_0x29d9b1[_0xc546('0x1f')]?_['map'](_0x29d9b1['include'],function(_0x575bfa){return{'model':db[_0x575bfa[_0xc546('0x20')]],'as':_0x575bfa['as'],'attributes':_0x575bfa[_0xc546('0x1e')],'include':_0x575bfa[_0xc546('0x1f')]?_[_0xc546('0x21')](_0x575bfa['include'],function(_0x14b4bb){return{'model':db[_0x14b4bb[_0xc546('0x20')]],'as':_0x14b4bb['as'],'attributes':_0x14b4bb[_0xc546('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xc546('0xf')](function(_0x3baeca){logger[_0xc546('0x10')](_0xc546('0x19'),_0x5cb541);logger[_0xc546('0x12')](_0xc546('0x19'),_0x5cb541,JSON[_0xc546('0x14')](_0x3baeca));_0x4ea11b(_0x3baeca);})['catch'](function(_0x5406e7){logger[_0xc546('0x15')]('GetFaxAccount',_0x5406e7['message'],_0x5cb541);_0x3d71f5(_0x173692['error'](0x1f4,_0x5406e7[_0xc546('0x18')]));});});};exports[_0xc546('0x22')]=function(_0x3a4a91,_0x280e3f,_0x154bf0){var _0x3ab178=this;return new Promise(function(_0x33df0f,_0xa90c97){var _0x1eb792={'body':_0x3a4a91[_0xc546('0x23')],'channel':'fax'};var _0x299c69=[];var _0x501231=[];var _0x22a6f8={};return db[_0xc546('0x24')][_0xc546('0x25')]()[_0xc546('0xf')](function(_0x30ba4a){if(!_0x30ba4a){throw new db[(_0xc546('0x26'))][(_0xc546('0x27'))](_0xc546('0x28'));}_0x299c69=_['difference'](_[_0xc546('0x29')](_0x30ba4a),[_0xc546('0x2a'),_0xc546('0x2b')]);_0x501231=_[_0xc546('0x2c')](_[_0xc546('0x29')](_0x30ba4a),[_0xc546('0x2a'),_0xc546('0x2b'),'CompanyId','ListId']);if(_0x3a4a91[_0xc546('0x23')]['id']){delete _0x3a4a91['body']['id'];}if(_['isNil'](_0x3a4a91[_0xc546('0x23')][_0xc546('0x2d')])){throw new db[(_0xc546('0x26'))][(_0xc546('0x27'))](_0xc546('0x2e'));}if(_['isNil'](_0x3a4a91[_0xc546('0x23')]['body'])||_0x3a4a91['body'][_0xc546('0x23')]===''){throw new db['Sequelize'][(_0xc546('0x27'))](_0xc546('0x2f'));}if(_[_0xc546('0x30')](_0x3a4a91['body']['mapKey'])){throw new db['Sequelize'][(_0xc546('0x27'))](_0xc546('0x31')+_0x501231);}if(!_[_0xc546('0x32')](_0x501231,_0x3a4a91[_0xc546('0x23')][_0xc546('0x33')])){throw new db['Sequelize'][(_0xc546('0x27'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x501231);}_0x22a6f8[_0x3a4a91['body'][_0xc546('0x33')]]=_0x3a4a91[_0xc546('0x23')][_0xc546('0x2d')];})[_0xc546('0xf')](function(){return db[_0xc546('0x1a')][_0xc546('0x34')]({'where':{'id':_0x3a4a91['account']['id']},'include':[{'model':db['CmList'],'as':_0xc546('0x35'),'include':[{'model':db[_0xc546('0x24')],'as':_0xc546('0x36'),'where':_0x22a6f8,'limit':0x1,'order':[[_0xc546('0x2b'),_0xc546('0x37')]]}]},{'model':db[_0xc546('0x38')],'as':_0xc546('0x39')}]});})[_0xc546('0xf')](function(_0x483e6b){if(_0x483e6b&&_0x483e6b[_0xc546('0x35')]){var _0x544e74=_0x483e6b[_0xc546('0x3a')]({'plain':!![]});_0x1eb792['account']=_0x544e74;_0x1eb792['applications']=_0x544e74[_0xc546('0x39')];_0x1eb792[_0xc546('0x3b')]=_0x544e74['List'];_0x1eb792[_0xc546('0x3c')]=_['orderBy'](_0x1eb792[_0xc546('0x3c')],[_0xc546('0x3d')],['asc']);if(_0x1eb792[_0xc546('0x3e')][_0xc546('0x39')]){delete _0x1eb792['account']['Applications'];}if(_0x1eb792[_0xc546('0x3e')][_0xc546('0x35')]&&_0x1eb792[_0xc546('0x3e')]['List'][_0xc546('0x36')][_0xc546('0x3f')]){return _0x1eb792[_0xc546('0x3e')][_0xc546('0x35')]['Contacts'][0x0];}var _0x2a0f11=_[_0xc546('0x40')](_0x3a4a91['body'],{'firstName':_0x3a4a91[_0xc546('0x23')]['from'],'ListId':_0x544e74[_0xc546('0x41')]});_0x2a0f11[_0x3a4a91[_0xc546('0x23')][_0xc546('0x33')]]=_0x3a4a91[_0xc546('0x23')]['from'];return db[_0xc546('0x24')]['create'](_0x2a0f11,{'fields':_0x299c69,'raw':!![]});}})[_0xc546('0xf')](function(_0x5697da){_0x1eb792[_0xc546('0x42')]=_0x5697da;if(_0x5697da){var _0x402dae={'ContactId':_0x5697da['id'],'FaxAccountId':_0x3a4a91[_0xc546('0x3e')]['id'],'fax':_0x5697da[_0xc546('0x43')]};return db[_0xc546('0x44')][_0xc546('0x34')]({'where':{'ContactId':_0x5697da['id'],'closed':![],'FaxAccountId':_0x3a4a91['account']['id']}})[_0xc546('0xf')](function(_0x795763){if(_0x795763){return[_0x795763,![]];}return db[_0xc546('0x44')][_0xc546('0x45')](_0x402dae)['then'](function(_0x24270c){return[_0x24270c,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0xc546('0x46')](function(_0x52842f,_0x194415){var _0x6eb013=_0x52842f[_0xc546('0x3a')]({'plain':!![]});if(_0x194415){if(_0x1eb792[_0xc546('0x3e')][_0xc546('0x47')]){_0x1eb792[_0xc546('0x3c')]['push']({'id':0x0,'priority':_0x1eb792['applications']['length']+0x1,'app':_0xc546('0x48'),'appdata':_0xc546('0x49'),'interval':'*,*,*,*'});}_0x6eb013[_0xc546('0x4a')]=!![];}else{_0x6eb013[_0xc546('0x4a')]=![];}_0x1eb792[_0xc546('0x4b')]=_0x6eb013;return db[_0xc546('0x4c')]['create']({'body':_0x3a4a91[_0xc546('0x23')][_0xc546('0x23')],'FaxAccountId':_0x3a4a91['account']['id'],'FaxInteractionId':_0x52842f['id'],'direction':'in','ContactId':_0x52842f['ContactId'],'AttachmentId':_0x3a4a91['body'][_0xc546('0x4d')]});})['then'](function(_0x1c2e6f){_0x1eb792[_0xc546('0x18')]=_0x1c2e6f;if(!_0x1eb792[_0xc546('0x4b')][_0xc546('0x4e')])return;return db['User'][_0xc546('0x34')]({'attributes':['id',_0xc546('0x4f')],'where':{'id':_0x1eb792[_0xc546('0x4b')][_0xc546('0x4e')]}});})['then'](function(_0x4036d0){if(_0x4036d0){_0x1eb792['applications'][_0xc546('0x50')]({'id':0x0,'priority':0x0,'app':_0xc546('0x51'),'appdata':_0x4036d0['name']+','+(_0x1eb792[_0xc546('0x3e')]['waitForTheAssignedAgent']||0xa),'interval':_0xc546('0x52')});}if(!_0x1eb792[_0xc546('0x4b')]['queueId'])return;return db[_0xc546('0x53')][_0xc546('0x34')]({'attributes':['id',_0xc546('0x4f')],'where':{'id':_0x1eb792[_0xc546('0x4b')][_0xc546('0x54')]}});})['then'](function(_0x25df9e){if(_0x25df9e){_0x1eb792[_0xc546('0x3c')][_0xc546('0x50')]({'id':0x0,'priority':0x1,'app':'queue','appdata':_0x25df9e['name']+','+(_0x1eb792[_0xc546('0x3e')]['waitForTheAssignedQueue']||0x12c),'interval':_0xc546('0x52')});}return respondWithRpcPromise(_0xc546('0x55'),_0xc546('0x56'),_0x1eb792);})[_0xc546('0xf')](function(_0x487a97){_0x33df0f(_0x487a97);})['catch'](function(_0x199627){_0xa90c97(_0x3ab178[_0xc546('0x15')](0x1f4,_0x199627[_0xc546('0x18')]));});});}; \ No newline at end of file +var _0x2cdc=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','localhost','socket.io-emitter','./faxAccount.socket','request','then','info','debug','FaxAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','FaxAccount,\x20%s,\x20%s','message','result','catch','findAll','options','raw','where','limit','map','include','model','attributes','GetFaxAccount','stringify','NotifyFaxAccount','body','fax','describe','Sequelize','no\x20available\x20attributes','difference','keys','createdAt','updatedAt','CompanyId','ListId','isNil','ValidationError','from\x20is\x20mandatory','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','FaxAccount','account','CmList','CmContact','DESC','FaxApplication','Applications','get','applications','list','List','orderBy','priority','asc','Contacts','from','find','create','Contact\x20not\x20found','spread','push','unmanaged','created','interaction','FaxMessage','AttachmentId','UserId','User','unshift','agent','*,*,*,*','queueId','FaxQueue','name','queue','waitForTheAssignedQueue','Start','lodash'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x2cdc,0xbd));var _0xc2cd=function(_0x2d8fc2,_0x1c461d){_0x2d8fc2=_0x2d8fc2-0x0;var _0x3a9e53=_0x2cdc[_0x2d8fc2];return _0x3a9e53;};'use strict';var _=require(_0xc2cd('0x0'));var util=require(_0xc2cd('0x1'));var moment=require(_0xc2cd('0x2'));var BPromise=require(_0xc2cd('0x3'));var rs=require(_0xc2cd('0x4'));var fs=require('fs');var Redis=require(_0xc2cd('0x5'));var db=require(_0xc2cd('0x6'))['db'];var utils=require(_0xc2cd('0x7'));var logger=require(_0xc2cd('0x8'))(_0xc2cd('0x9'));var config=require(_0xc2cd('0xa'));var jayson=require(_0xc2cd('0xb'));var client=jayson[_0xc2cd('0xc')]['http']({'port':0x232c});config[_0xc2cd('0xd')]=_['defaults'](config[_0xc2cd('0xd')],{'host':_0xc2cd('0xe'),'port':0x18eb});var socket=require(_0xc2cd('0xf'))(new Redis(config['redis']));require(_0xc2cd('0x10'))['register'](socket);function respondWithRpcPromise(_0x50b46c,_0x4d794c,_0x18e25e){return new BPromise(function(_0x702e02,_0x3fb4c7){return client[_0xc2cd('0x11')](_0x50b46c,_0x18e25e)[_0xc2cd('0x12')](function(_0x21a6ec){logger[_0xc2cd('0x13')]('FaxAccount,\x20%s,\x20%s',_0x4d794c,'request\x20sent');logger[_0xc2cd('0x14')](_0xc2cd('0x15'),_0x4d794c,_0xc2cd('0x16'),JSON['stringify'](_0x21a6ec));if(_0x21a6ec[_0xc2cd('0x17')]){if(_0x21a6ec[_0xc2cd('0x17')][_0xc2cd('0x18')]===0x1f4){logger[_0xc2cd('0x17')](_0xc2cd('0x19'),_0x4d794c,_0x21a6ec[_0xc2cd('0x17')][_0xc2cd('0x1a')]);return _0x3fb4c7(_0x21a6ec[_0xc2cd('0x17')][_0xc2cd('0x1a')]);}logger['error'](_0xc2cd('0x19'),_0x4d794c,_0x21a6ec[_0xc2cd('0x17')][_0xc2cd('0x1a')]);return _0x702e02(_0x21a6ec[_0xc2cd('0x17')]['message']);}else{logger[_0xc2cd('0x13')](_0xc2cd('0x19'),_0x4d794c,'request\x20sent');_0x702e02(_0x21a6ec[_0xc2cd('0x1b')][_0xc2cd('0x1a')]);}})[_0xc2cd('0x1c')](function(_0x2a46f7){logger[_0xc2cd('0x17')](_0xc2cd('0x19'),_0x4d794c,_0x2a46f7);_0x3fb4c7(_0x2a46f7);});});}exports['GetFaxAccount']=function(_0x466921){var _0x4cc9ce=this;return new Promise(function(_0xb8a44,_0x32ed19){return db['FaxAccount'][_0xc2cd('0x1d')]({'raw':_0x466921[_0xc2cd('0x1e')]?_0x466921[_0xc2cd('0x1e')][_0xc2cd('0x1f')]===undefined?!![]:![]:!![],'where':_0x466921[_0xc2cd('0x1e')]?_0x466921[_0xc2cd('0x1e')][_0xc2cd('0x20')]||null:null,'attributes':_0x466921[_0xc2cd('0x1e')]?_0x466921['options']['attributes']||null:null,'limit':_0x466921[_0xc2cd('0x1e')]?_0x466921[_0xc2cd('0x1e')][_0xc2cd('0x21')]||null:null,'include':_0x466921[_0xc2cd('0x1e')]?_0x466921['options']['include']?_[_0xc2cd('0x22')](_0x466921[_0xc2cd('0x1e')][_0xc2cd('0x23')],function(_0x462de1){return{'model':db[_0x462de1[_0xc2cd('0x24')]],'as':_0x462de1['as'],'attributes':_0x462de1['attributes'],'include':_0x462de1['include']?_['map'](_0x462de1[_0xc2cd('0x23')],function(_0x429f0a){return{'model':db[_0x429f0a[_0xc2cd('0x24')]],'as':_0x429f0a['as'],'attributes':_0x429f0a[_0xc2cd('0x25')],'include':_0x429f0a['include']?_[_0xc2cd('0x22')](_0x429f0a[_0xc2cd('0x23')],function(_0x44378c){return{'model':db[_0x44378c['model']],'as':_0x44378c['as'],'attributes':_0x44378c[_0xc2cd('0x25')]};}):[]};}):[]};}):[]:[]})[_0xc2cd('0x12')](function(_0x5947b8){logger[_0xc2cd('0x13')](_0xc2cd('0x26'),_0x466921);logger[_0xc2cd('0x14')]('GetFaxAccount',_0x466921,JSON[_0xc2cd('0x27')](_0x5947b8));_0xb8a44(_0x5947b8);})[_0xc2cd('0x1c')](function(_0x4d3638){logger[_0xc2cd('0x17')](_0xc2cd('0x26'),_0x4d3638[_0xc2cd('0x1a')],_0x466921);_0x32ed19(_0x4cc9ce[_0xc2cd('0x17')](0x1f4,_0x4d3638[_0xc2cd('0x1a')]));});});};exports[_0xc2cd('0x28')]=function(_0x48e0f9,_0x59c6d1,_0x1b0b8e){var _0x25a71c=this;return new Promise(function(_0x5efd4d,_0xbb7cd7){var _0x5effba={'body':_0x48e0f9[_0xc2cd('0x29')],'channel':_0xc2cd('0x2a')};var _0x73b17d=[];var _0x503e90=[];var _0x4390f9={};return db['CmContact'][_0xc2cd('0x2b')]()[_0xc2cd('0x12')](function(_0xd6b188){if(!_0xd6b188){throw new db[(_0xc2cd('0x2c'))]['ValidationError'](_0xc2cd('0x2d'));}_0x73b17d=_[_0xc2cd('0x2e')](_[_0xc2cd('0x2f')](_0xd6b188),[_0xc2cd('0x30'),_0xc2cd('0x31')]);_0x503e90=_[_0xc2cd('0x2e')](_[_0xc2cd('0x2f')](_0xd6b188),[_0xc2cd('0x30'),_0xc2cd('0x31'),_0xc2cd('0x32'),_0xc2cd('0x33')]);if(_0x48e0f9[_0xc2cd('0x29')]['id']){delete _0x48e0f9['body']['id'];}if(_[_0xc2cd('0x34')](_0x48e0f9[_0xc2cd('0x29')]['from'])){throw new db[(_0xc2cd('0x2c'))][(_0xc2cd('0x35'))](_0xc2cd('0x36'));}if(_[_0xc2cd('0x34')](_0x48e0f9[_0xc2cd('0x29')][_0xc2cd('0x29')])||_0x48e0f9['body'][_0xc2cd('0x29')]===''){throw new db[(_0xc2cd('0x2c'))][(_0xc2cd('0x35'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xc2cd('0x34')](_0x48e0f9[_0xc2cd('0x29')][_0xc2cd('0x37')])){throw new db[(_0xc2cd('0x2c'))]['ValidationError']('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x503e90);}if(!_[_0xc2cd('0x38')](_0x503e90,_0x48e0f9['body']['mapKey'])){throw new db[(_0xc2cd('0x2c'))][(_0xc2cd('0x35'))](_0xc2cd('0x39')+_0x503e90);}_0x4390f9[_0x48e0f9[_0xc2cd('0x29')][_0xc2cd('0x37')]]=_0x48e0f9['body']['from'];})[_0xc2cd('0x12')](function(){return db[_0xc2cd('0x3a')]['find']({'where':{'id':_0x48e0f9[_0xc2cd('0x3b')]['id']},'include':[{'model':db[_0xc2cd('0x3c')],'as':'List','include':[{'model':db[_0xc2cd('0x3d')],'as':'Contacts','where':_0x4390f9,'limit':0x1,'order':[[_0xc2cd('0x31'),_0xc2cd('0x3e')]]}]},{'model':db[_0xc2cd('0x3f')],'as':_0xc2cd('0x40')}]});})['then'](function(_0xec797c){if(_0xec797c&&_0xec797c['List']){var _0x1b7c57=_0xec797c[_0xc2cd('0x41')]({'plain':!![]});_0x5effba[_0xc2cd('0x3b')]=_0x1b7c57;_0x5effba[_0xc2cd('0x42')]=_0x1b7c57[_0xc2cd('0x40')];_0x5effba[_0xc2cd('0x43')]=_0x1b7c57[_0xc2cd('0x44')];_0x5effba[_0xc2cd('0x42')]=_[_0xc2cd('0x45')](_0x5effba[_0xc2cd('0x42')],[_0xc2cd('0x46')],[_0xc2cd('0x47')]);if(_0x5effba[_0xc2cd('0x3b')]['Applications']){delete _0x5effba[_0xc2cd('0x3b')]['Applications'];}if(_0x5effba[_0xc2cd('0x3b')]['List']&&_0x5effba[_0xc2cd('0x3b')][_0xc2cd('0x44')]['Contacts']['length']){return _0x5effba[_0xc2cd('0x3b')][_0xc2cd('0x44')][_0xc2cd('0x48')][0x0];}var _0x2c931a=_['defaults'](_0x48e0f9[_0xc2cd('0x29')],{'firstName':_0x48e0f9['body'][_0xc2cd('0x49')],'ListId':_0x1b7c57[_0xc2cd('0x33')]});_0x2c931a[_0x48e0f9['body'][_0xc2cd('0x37')]]=_0x48e0f9[_0xc2cd('0x29')]['from'];return db['CmContact']['create'](_0x2c931a,{'fields':_0x73b17d,'raw':!![]});}})[_0xc2cd('0x12')](function(_0x176ca1){_0x5effba['contact']=_0x176ca1;if(_0x176ca1){var _0x4b3855={'ContactId':_0x176ca1['id'],'FaxAccountId':_0x48e0f9[_0xc2cd('0x3b')]['id'],'fax':_0x176ca1[_0xc2cd('0x2a')]};return db['FaxInteraction'][_0xc2cd('0x4a')]({'where':{'ContactId':_0x176ca1['id'],'closed':![],'FaxAccountId':_0x48e0f9[_0xc2cd('0x3b')]['id']}})[_0xc2cd('0x12')](function(_0x348558){if(_0x348558){return[_0x348558,![]];}return db['FaxInteraction'][_0xc2cd('0x4b')](_0x4b3855)[_0xc2cd('0x12')](function(_0x530814){return[_0x530814,!![]];});});}else{throw new Error(_0xc2cd('0x4c'));}})[_0xc2cd('0x4d')](function(_0x436a4d,_0x5caed1){var _0x5092f0=_0x436a4d[_0xc2cd('0x41')]({'plain':!![]});if(_0x5caed1){if(_0x5effba[_0xc2cd('0x3b')]['autoclose']){_0x5effba[_0xc2cd('0x42')][_0xc2cd('0x4e')]({'id':0x0,'priority':_0x5effba[_0xc2cd('0x42')]['length']+0x1,'app':'close','appdata':_0xc2cd('0x4f'),'interval':'*,*,*,*'});}_0x5092f0[_0xc2cd('0x50')]=!![];}else{_0x5092f0['created']=![];}_0x5effba[_0xc2cd('0x51')]=_0x5092f0;return db[_0xc2cd('0x52')][_0xc2cd('0x4b')]({'body':_0x48e0f9[_0xc2cd('0x29')][_0xc2cd('0x29')],'FaxAccountId':_0x48e0f9[_0xc2cd('0x3b')]['id'],'FaxInteractionId':_0x436a4d['id'],'direction':'in','ContactId':_0x436a4d['ContactId'],'AttachmentId':_0x48e0f9['body'][_0xc2cd('0x53')]});})[_0xc2cd('0x12')](function(_0x5608fe){_0x5effba[_0xc2cd('0x1a')]=_0x5608fe;if(!_0x5effba['interaction'][_0xc2cd('0x54')])return;return db[_0xc2cd('0x55')]['find']({'attributes':['id','name'],'where':{'id':_0x5effba['interaction'][_0xc2cd('0x54')]}});})[_0xc2cd('0x12')](function(_0xba542){if(_0xba542){_0x5effba[_0xc2cd('0x42')][_0xc2cd('0x56')]({'id':0x0,'priority':0x0,'app':_0xc2cd('0x57'),'appdata':_0xba542['name']+','+(_0x5effba['account']['waitForTheAssignedAgent']||0xa),'interval':_0xc2cd('0x58')});}if(!_0x5effba[_0xc2cd('0x51')][_0xc2cd('0x59')])return;return db[_0xc2cd('0x5a')]['find']({'attributes':['id',_0xc2cd('0x5b')],'where':{'id':_0x5effba['interaction'][_0xc2cd('0x59')]}});})[_0xc2cd('0x12')](function(_0x3c32db){if(_0x3c32db){_0x5effba['applications'][_0xc2cd('0x56')]({'id':0x0,'priority':0x1,'app':_0xc2cd('0x5c'),'appdata':_0x3c32db[_0xc2cd('0x5b')]+','+(_0x5effba[_0xc2cd('0x3b')][_0xc2cd('0x5d')]||0x12c),'interval':_0xc2cd('0x58')});}return respondWithRpcPromise(_0xc2cd('0x5e'),'startRouting',_0x5effba);})[_0xc2cd('0x12')](function(_0x2f7355){_0x5efd4d(_0x2f7355);})[_0xc2cd('0x1c')](function(_0x42473f){_0xbb7cd7(_0x25a71c[_0xc2cd('0x17')](0x1f4,_0x42473f[_0xc2cd('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index babcbb8..5bd06f1 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 _0x8acf=['emit','register','length','faxAccount:','./faxAccount.events','remove'];(function(_0x238119,_0x14f6f0){var _0x55c3ca=function(_0x12d256){while(--_0x12d256){_0x238119['push'](_0x238119['shift']());}};_0x55c3ca(++_0x14f6f0);}(_0x8acf,0x1d8));var _0xf8ac=function(_0x12d951,_0x249808){_0x12d951=_0x12d951-0x0;var _0x44de17=_0x8acf[_0x12d951];return _0x44de17;};'use strict';var FaxAccountEvents=require(_0xf8ac('0x0'));var events=['save',_0xf8ac('0x1'),'update'];function createListener(_0x3a2d3c,_0x5add35){return function(_0x55677d){_0x5add35[_0xf8ac('0x2')](_0x3a2d3c,_0x55677d);};}function removeListener(_0x54bccd,_0x40918a){return function(){FaxAccountEvents['removeListener'](_0x54bccd,_0x40918a);};}exports[_0xf8ac('0x3')]=function(_0x114365){for(var _0x1bb380=0x0,_0x5c41e6=events[_0xf8ac('0x4')];_0x1bb380<_0x5c41e6;_0x1bb380++){var _0x107e7b=events[_0x1bb380];var _0x1a8829=createListener(_0xf8ac('0x5')+_0x107e7b,_0x114365);FaxAccountEvents['on'](_0x107e7b,_0x1a8829);}}; \ No newline at end of file +var _0xa8d2=['remove','update','emit','removeListener','register','length','faxAccount:','./faxAccount.events','save'];(function(_0x503df1,_0x2c0fcd){var _0x2ae00e=function(_0x3b54ca){while(--_0x3b54ca){_0x503df1['push'](_0x503df1['shift']());}};_0x2ae00e(++_0x2c0fcd);}(_0xa8d2,0x178));var _0x2a8d=function(_0x5b7005,_0x3d864d){_0x5b7005=_0x5b7005-0x0;var _0x5dc9a3=_0xa8d2[_0x5b7005];return _0x5dc9a3;};'use strict';var FaxAccountEvents=require(_0x2a8d('0x0'));var events=[_0x2a8d('0x1'),_0x2a8d('0x2'),_0x2a8d('0x3')];function createListener(_0x4eca25,_0x198b0b){return function(_0x565f95){_0x198b0b[_0x2a8d('0x4')](_0x4eca25,_0x565f95);};}function removeListener(_0x293d01,_0x1a0702){return function(){FaxAccountEvents[_0x2a8d('0x5')](_0x293d01,_0x1a0702);};}exports[_0x2a8d('0x6')]=function(_0x2d29d9){for(var _0x3cfda2=0x0,_0x3dac22=events[_0x2a8d('0x7')];_0x3cfda2<_0x3dac22;_0x3cfda2++){var _0x46b19f=events[_0x3cfda2];var _0x275de4=createListener(_0x2a8d('0x8')+_0x46b19f,_0x2d29d9);FaxAccountEvents['on'](_0x46b19f,_0x275de4);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index 41b95ab..3f3bbc4 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 _0x3510=['../../config/environment','./faxAccount.controller','isAuthenticated','index','get','/describe','/:id/dispositions','/:id/interactions','getInteractions','getApplications','/:id/messages','getMessages','/:id/users','getAgents','post','addDisposition','/:id/canned_answers','addAnswer','addInteraction','addApplications','/addaccountapplications','addAccountApplications','/updateaccountapplications','updateAccountApplications','/:id/send','send','addAgents','put','/:id','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0xe45bfc,_0x5e1b01){var _0x151dd9=function(_0xfb6238){while(--_0xfb6238){_0xe45bfc['push'](_0xe45bfc['shift']());}};_0x151dd9(++_0x5e1b01);}(_0x3510,0xa8));var _0x0351=function(_0x411add,_0x1aed38){_0x411add=_0x411add-0x0;var _0x238242=_0x3510[_0x411add];return _0x238242;};'use strict';var multer=require(_0x0351('0x0'));var util=require(_0x0351('0x1'));var path=require(_0x0351('0x2'));var timeout=require(_0x0351('0x3'));var express=require(_0x0351('0x4'));var router=express['Router']();var fs_extra=require(_0x0351('0x5'));var auth=require(_0x0351('0x6'));var interaction=require(_0x0351('0x7'));var config=require(_0x0351('0x8'));var controller=require(_0x0351('0x9'));router['get']('/',auth[_0x0351('0xa')](),controller[_0x0351('0xb')]);router[_0x0351('0xc')](_0x0351('0xd'),auth[_0x0351('0xa')](),controller['describe']);router[_0x0351('0xc')]('/:id',auth['isAuthenticated'](),controller['show']);router['get'](_0x0351('0xe'),auth['isAuthenticated'](),controller['getDispositions']);router[_0x0351('0xc')]('/:id/canned_answers',auth[_0x0351('0xa')](),controller['getAnswers']);router[_0x0351('0xc')](_0x0351('0xf'),auth['isAuthenticated'](),controller[_0x0351('0x10')]);router[_0x0351('0xc')]('/:id/applications',auth['isAuthenticated'](),controller[_0x0351('0x11')]);router[_0x0351('0xc')](_0x0351('0x12'),auth['isAuthenticated'](),controller[_0x0351('0x13')]);router[_0x0351('0xc')](_0x0351('0x14'),auth['isAuthenticated'](),controller[_0x0351('0x15')]);router['post']('/',auth[_0x0351('0xa')](),controller['create']);router[_0x0351('0x16')](_0x0351('0xe'),auth[_0x0351('0xa')](),controller[_0x0351('0x17')]);router['post'](_0x0351('0x18'),auth[_0x0351('0xa')](),controller[_0x0351('0x19')]);router[_0x0351('0x16')](_0x0351('0xf'),auth[_0x0351('0xa')](),controller[_0x0351('0x1a')]);router[_0x0351('0x16')]('/:id/applications',auth[_0x0351('0xa')](),controller[_0x0351('0x1b')]);router[_0x0351('0x16')](_0x0351('0x1c'),auth[_0x0351('0xa')](),controller[_0x0351('0x1d')]);router[_0x0351('0x16')](_0x0351('0x1e'),auth[_0x0351('0xa')](),controller[_0x0351('0x1f')]);router[_0x0351('0x16')](_0x0351('0x20'),auth['isAuthenticated'](),controller[_0x0351('0x21')]);router[_0x0351('0x16')](_0x0351('0x14'),auth[_0x0351('0xa')](),controller[_0x0351('0x22')]);router[_0x0351('0x23')](_0x0351('0x24'),auth[_0x0351('0xa')](),controller[_0x0351('0x25')]);router[_0x0351('0x26')](_0x0351('0x24'),auth[_0x0351('0xa')](),controller[_0x0351('0x27')]);router[_0x0351('0x26')](_0x0351('0xe'),auth[_0x0351('0xa')](),controller[_0x0351('0x28')]);router['delete'](_0x0351('0x18'),auth['isAuthenticated'](),controller[_0x0351('0x29')]);router[_0x0351('0x26')]('/:id/users',auth[_0x0351('0xa')](),controller[_0x0351('0x2a')]);module[_0x0351('0x2b')]=router; \ No newline at end of file +var _0xb36e=['multer','util','path','../../components/auth/service','../../components/interaction/service','./faxAccount.controller','get','isAuthenticated','index','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/interactions','getInteractions','/:id/applications','getApplications','/:id/messages','getMessages','/:id/users','getAgents','post','create','addAnswer','addInteraction','addApplications','/addaccountapplications','addAccountApplications','/updateaccountapplications','/:id/send','send','addAgents','update','delete','removeDispositions','removeAnswers','exports'];(function(_0xaf025d,_0x586d7a){var _0x1c77cb=function(_0x560b3a){while(--_0x560b3a){_0xaf025d['push'](_0xaf025d['shift']());}};_0x1c77cb(++_0x586d7a);}(_0xb36e,0x140));var _0xeb36=function(_0xe4486c,_0x454251){_0xe4486c=_0xe4486c-0x0;var _0x517b1a=_0xb36e[_0xe4486c];return _0x517b1a;};'use strict';var multer=require(_0xeb36('0x0'));var util=require(_0xeb36('0x1'));var path=require(_0xeb36('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xeb36('0x3'));var interaction=require(_0xeb36('0x4'));var config=require('../../config/environment');var controller=require(_0xeb36('0x5'));router[_0xeb36('0x6')]('/',auth[_0xeb36('0x7')](),controller[_0xeb36('0x8')]);router[_0xeb36('0x6')]('/describe',auth[_0xeb36('0x7')](),controller[_0xeb36('0x9')]);router['get'](_0xeb36('0xa'),auth[_0xeb36('0x7')](),controller[_0xeb36('0xb')]);router[_0xeb36('0x6')](_0xeb36('0xc'),auth['isAuthenticated'](),controller[_0xeb36('0xd')]);router['get'](_0xeb36('0xe'),auth[_0xeb36('0x7')](),controller[_0xeb36('0xf')]);router[_0xeb36('0x6')](_0xeb36('0x10'),auth[_0xeb36('0x7')](),controller[_0xeb36('0x11')]);router[_0xeb36('0x6')](_0xeb36('0x12'),auth[_0xeb36('0x7')](),controller[_0xeb36('0x13')]);router[_0xeb36('0x6')](_0xeb36('0x14'),auth['isAuthenticated'](),controller[_0xeb36('0x15')]);router[_0xeb36('0x6')](_0xeb36('0x16'),auth[_0xeb36('0x7')](),controller[_0xeb36('0x17')]);router[_0xeb36('0x18')]('/',auth[_0xeb36('0x7')](),controller[_0xeb36('0x19')]);router[_0xeb36('0x18')](_0xeb36('0xc'),auth[_0xeb36('0x7')](),controller['addDisposition']);router['post']('/:id/canned_answers',auth[_0xeb36('0x7')](),controller[_0xeb36('0x1a')]);router['post'](_0xeb36('0x10'),auth[_0xeb36('0x7')](),controller[_0xeb36('0x1b')]);router[_0xeb36('0x18')](_0xeb36('0x12'),auth[_0xeb36('0x7')](),controller[_0xeb36('0x1c')]);router[_0xeb36('0x18')](_0xeb36('0x1d'),auth[_0xeb36('0x7')](),controller[_0xeb36('0x1e')]);router['post'](_0xeb36('0x1f'),auth[_0xeb36('0x7')](),controller['updateAccountApplications']);router[_0xeb36('0x18')](_0xeb36('0x20'),auth[_0xeb36('0x7')](),controller[_0xeb36('0x21')]);router[_0xeb36('0x18')](_0xeb36('0x16'),auth[_0xeb36('0x7')](),controller[_0xeb36('0x22')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xeb36('0x23')]);router[_0xeb36('0x24')](_0xeb36('0xa'),auth['isAuthenticated'](),controller['destroy']);router['delete']('/:id/dispositions',auth['isAuthenticated'](),controller[_0xeb36('0x25')]);router[_0xeb36('0x24')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0xeb36('0x26')]);router[_0xeb36('0x24')](_0xeb36('0x16'),auth['isAuthenticated'](),controller['removeAgents']);module[_0xeb36('0x27')]=router; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.attributes.js b/server/api/faxApplication/faxApplication.attributes.js index dea71fa..998d797 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 _0x3bb4=['sequelize','exports','STRING','noop','*,*,*,*'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x3bb4,0x87));var _0x43bb=function(_0x34da1f,_0x37a259){_0x34da1f=_0x34da1f-0x0;var _0x4897cc=_0x3bb4[_0x34da1f];return _0x4897cc;};'use strict';var Sequelize=require(_0x43bb('0x0'));module[_0x43bb('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x43bb('0x2')],'allowNull':![],'defaultValue':_0x43bb('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x43bb('0x2')]},'interval':{'type':Sequelize[_0x43bb('0x2')],'defaultValue':_0x43bb('0x4')}}; \ No newline at end of file +var _0x0f86=['TEXT','sequelize','INTEGER','noop'];(function(_0x4183a3,_0x2a0f1f){var _0x44c7aa=function(_0x444a74){while(--_0x444a74){_0x4183a3['push'](_0x4183a3['shift']());}};_0x44c7aa(++_0x2a0f1f);}(_0x0f86,0x195));var _0x60f8=function(_0xf9119c,_0x5b1579){_0xf9119c=_0xf9119c-0x0;var _0xf87f3a=_0x0f86[_0xf9119c];return _0xf87f3a;};'use strict';var Sequelize=require(_0x60f8('0x0'));module['exports']={'priority':{'type':Sequelize[_0x60f8('0x1')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x60f8('0x2')},'appdata':{'type':Sequelize[_0x60f8('0x3')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index d7df007..5e6b5aa 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 _0xae9e=['bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','offset','set','reject','save','then','destroy','stack','name','index','FaxApplication','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','rows','show','params','include','catch','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x4ed3d8,_0x50bcfd){var _0x440d93=function(_0x532264){while(--_0x532264){_0x4ed3d8['push'](_0x4ed3d8['shift']());}};_0x440d93(++_0x50bcfd);}(_0xae9e,0x127));var _0xeae9=function(_0x540dac,_0x4a12dd){_0x540dac=_0x540dac-0x0;var _0x1f7862=_0xae9e[_0x540dac];return _0x1f7862;};'use strict';var emlformat=require(_0xeae9('0x0'));var rimraf=require(_0xeae9('0x1'));var zipdir=require(_0xeae9('0x2'));var jsonpatch=require(_0xeae9('0x3'));var rp=require(_0xeae9('0x4'));var moment=require('moment');var BPromise=require(_0xeae9('0x5'));var Mustache=require(_0xeae9('0x6'));var util=require(_0xeae9('0x7'));var path=require(_0xeae9('0x8'));var sox=require('sox');var csv=require(_0xeae9('0x9'));var ejs=require(_0xeae9('0xa'));var fs=require('fs');var fs_extra=require(_0xeae9('0xb'));var _=require(_0xeae9('0xc'));var squel=require(_0xeae9('0xd'));var crypto=require(_0xeae9('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xeae9('0xf'));var toCsv=require('to-csv');var querystring=require(_0xeae9('0x10'));var Papa=require(_0xeae9('0x11'));var Redis=require(_0xeae9('0x12'));var authService=require(_0xeae9('0x13'));var qs=require(_0xeae9('0x14'));var as=require(_0xeae9('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xeae9('0x16'))(_0xeae9('0x17'));var utils=require(_0xeae9('0x18'));var config=require(_0xeae9('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xeae9('0x1a'))['db'];function respondWithStatusCode(_0x30ea0e,_0x362f76){_0x362f76=_0x362f76||0xcc;return function(_0x349a3d){if(_0x349a3d){return _0x30ea0e[_0xeae9('0x1b')](_0x362f76);}return _0x30ea0e['status'](_0x362f76)[_0xeae9('0x1c')]();};}function respondWithResult(_0x202ebb,_0x1f1841){_0x1f1841=_0x1f1841||0xc8;return function(_0x34da8e){if(_0x34da8e){return _0x202ebb[_0xeae9('0x1d')](_0x1f1841)[_0xeae9('0x1e')](_0x34da8e);}};}function respondWithFilteredResult(_0x5995c1,_0x5d76ca){return function(_0x3ca17e){if(_0x3ca17e){var _0x4fb0dc=typeof _0x5d76ca['offset']===_0xeae9('0x1f')&&typeof _0x5d76ca[_0xeae9('0x20')]==='undefined';var _0x44313b=_0x3ca17e[_0xeae9('0x21')];var _0x1e5f02=_0x4fb0dc?0x0:_0x5d76ca[_0xeae9('0x22')];var _0x100844=_0x4fb0dc?_0x3ca17e['count']:_0x5d76ca[_0xeae9('0x22')]+_0x5d76ca[_0xeae9('0x20')];var _0x433287;if(_0x100844>=_0x44313b){_0x100844=_0x44313b;_0x433287=0xc8;}else{_0x433287=0xce;}_0x5995c1[_0xeae9('0x1d')](_0x433287);return _0x5995c1[_0xeae9('0x23')]('Content-Range',_0x1e5f02+'-'+_0x100844+'/'+_0x44313b)[_0xeae9('0x1e')](_0x3ca17e);}return null;};}function patchUpdates(_0x4b8156){return function(_0x372b0e){try{jsonpatch['apply'](_0x372b0e,_0x4b8156,!![]);}catch(_0x12d108){return BPromise[_0xeae9('0x24')](_0x12d108);}return _0x372b0e[_0xeae9('0x25')]();};}function saveUpdates(_0x1333dd,_0x5ee8f7){return function(_0x590e73){if(_0x590e73){return _0x590e73['update'](_0x1333dd)[_0xeae9('0x26')](function(_0x389c12){return _0x389c12;});}return null;};}function removeEntity(_0x25bab2,_0x1dc5c9){return function(_0x3f127b){if(_0x3f127b){return _0x3f127b[_0xeae9('0x27')]()['then'](function(){_0x25bab2[_0xeae9('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x10a111,_0x2661a3){return function(_0x4789ba){if(!_0x4789ba){_0x10a111[_0xeae9('0x1b')](0x194);}return _0x4789ba;};}function handleError(_0x59453c,_0x254391){_0x254391=_0x254391||0x1f4;return function(_0x1bb567){logger['error'](_0x1bb567[_0xeae9('0x28')]);if(_0x1bb567[_0xeae9('0x29')]){delete _0x1bb567['name'];}_0x59453c[_0xeae9('0x1d')](_0x254391)['send'](_0x1bb567);};}exports[_0xeae9('0x2a')]=function(_0x4881bb,_0x33f67e){var _0x609a6f={},_0xcef44f={},_0x21e705={'count':0x0,'rows':[]};var _0x29bfa1=_['map'](db[_0xeae9('0x2b')][_0xeae9('0x2c')],function(_0x3e029a){return{'name':_0x3e029a[_0xeae9('0x2d')],'type':_0x3e029a[_0xeae9('0x2e')][_0xeae9('0x2f')]};});_0xcef44f[_0xeae9('0x30')]=_[_0xeae9('0x31')](_0x29bfa1,_0xeae9('0x29'));_0xcef44f['query']=_['keys'](_0x4881bb[_0xeae9('0x32')]);_0xcef44f[_0xeae9('0x33')]=_[_0xeae9('0x34')](_0xcef44f[_0xeae9('0x30')],_0xcef44f[_0xeae9('0x32')]);_0x609a6f[_0xeae9('0x35')]=_[_0xeae9('0x34')](_0xcef44f[_0xeae9('0x30')],qs[_0xeae9('0x36')](_0x4881bb[_0xeae9('0x32')][_0xeae9('0x36')]));_0x609a6f['attributes']=_0x609a6f[_0xeae9('0x35')][_0xeae9('0x37')]?_0x609a6f[_0xeae9('0x35')]:_0xcef44f[_0xeae9('0x30')];if(!_0x4881bb[_0xeae9('0x32')][_0xeae9('0x38')](_0xeae9('0x39'))){_0x609a6f[_0xeae9('0x20')]=qs[_0xeae9('0x20')](_0x4881bb[_0xeae9('0x32')][_0xeae9('0x20')]);_0x609a6f[_0xeae9('0x22')]=qs[_0xeae9('0x22')](_0x4881bb['query'][_0xeae9('0x22')]);}_0x609a6f[_0xeae9('0x3a')]=qs[_0xeae9('0x3b')](_0x4881bb['query'][_0xeae9('0x3b')]);_0x609a6f[_0xeae9('0x3c')]=qs[_0xeae9('0x33')](_[_0xeae9('0x3d')](_0x4881bb[_0xeae9('0x32')],_0xcef44f[_0xeae9('0x33')]),_0x29bfa1);if(_0x4881bb[_0xeae9('0x32')][_0xeae9('0x3e')]){_0x609a6f[_0xeae9('0x3c')]=_[_0xeae9('0x3f')](_0x609a6f[_0xeae9('0x3c')],{'$or':_[_0xeae9('0x31')](_0x29bfa1,function(_0x1207d1){if(_0x1207d1['type']!==_0xeae9('0x40')){var _0x2f1590={};_0x2f1590[_0x1207d1[_0xeae9('0x29')]]={'$like':'%'+_0x4881bb[_0xeae9('0x32')]['filter']+'%'};return _0x2f1590;}})});}_0x609a6f=_['merge']({},_0x609a6f,_0x4881bb[_0xeae9('0x41')]);var _0x472e1f={'where':_0x609a6f[_0xeae9('0x3c')]};return db['FaxApplication'][_0xeae9('0x21')](_0x472e1f)[_0xeae9('0x26')](function(_0x548576){_0x21e705[_0xeae9('0x21')]=_0x548576;if(_0x4881bb['query'][_0xeae9('0x42')]){_0x609a6f['include']=[{'all':!![]}];}return db[_0xeae9('0x2b')]['findAll'](_0x609a6f);})[_0xeae9('0x26')](function(_0x3989a2){_0x21e705[_0xeae9('0x43')]=_0x3989a2;return _0x21e705;})[_0xeae9('0x26')](respondWithFilteredResult(_0x33f67e,_0x609a6f))['catch'](handleError(_0x33f67e,null));};exports[_0xeae9('0x44')]=function(_0x107b29,_0x8f16f){var _0x34eb17={'raw':!![],'where':{'id':_0x107b29[_0xeae9('0x45')]['id']}},_0x3579d0={};_0x3579d0[_0xeae9('0x30')]=_['keys'](db[_0xeae9('0x2b')][_0xeae9('0x2c')]);_0x3579d0[_0xeae9('0x32')]=_['keys'](_0x107b29[_0xeae9('0x32')]);_0x3579d0['filters']=_[_0xeae9('0x34')](_0x3579d0[_0xeae9('0x30')],_0x3579d0[_0xeae9('0x32')]);_0x34eb17[_0xeae9('0x35')]=_[_0xeae9('0x34')](_0x3579d0[_0xeae9('0x30')],qs[_0xeae9('0x36')](_0x107b29[_0xeae9('0x32')]['fields']));_0x34eb17[_0xeae9('0x35')]=_0x34eb17[_0xeae9('0x35')][_0xeae9('0x37')]?_0x34eb17['attributes']:_0x3579d0[_0xeae9('0x30')];if(_0x107b29[_0xeae9('0x32')]['includeAll']){_0x34eb17[_0xeae9('0x46')]=[{'all':!![]}];}_0x34eb17=_['merge']({},_0x34eb17,_0x107b29[_0xeae9('0x41')]);return db[_0xeae9('0x2b')]['find'](_0x34eb17)[_0xeae9('0x26')](handleEntityNotFound(_0x8f16f,null))[_0xeae9('0x26')](respondWithResult(_0x8f16f,null))[_0xeae9('0x47')](handleError(_0x8f16f,null));};exports[_0xeae9('0x48')]=function(_0x33947f,_0x394e86){return db['FaxApplication'][_0xeae9('0x48')](_0x33947f['body'],{})[_0xeae9('0x26')](respondWithResult(_0x394e86,0xc9))[_0xeae9('0x47')](handleError(_0x394e86,null));};exports['update']=function(_0x91de40,_0x1e0387){if(_0x91de40['body']['id']){delete _0x91de40[_0xeae9('0x49')]['id'];}return db[_0xeae9('0x2b')][_0xeae9('0x4a')]({'where':{'id':_0x91de40[_0xeae9('0x45')]['id']}})['then'](handleEntityNotFound(_0x1e0387,null))[_0xeae9('0x26')](saveUpdates(_0x91de40['body'],null))[_0xeae9('0x26')](respondWithResult(_0x1e0387,null))[_0xeae9('0x47')](handleError(_0x1e0387,null));};exports[_0xeae9('0x27')]=function(_0x41e348,_0x23894a){return db['FaxApplication'][_0xeae9('0x4a')]({'where':{'id':_0x41e348[_0xeae9('0x45')]['id']}})[_0xeae9('0x26')](handleEntityNotFound(_0x23894a,null))[_0xeae9('0x26')](removeEntity(_0x23894a,null))[_0xeae9('0x47')](handleError(_0x23894a,null));}; \ No newline at end of file +var _0xfd71=['catch','show','rawAttributes','includeAll','include','find','create','body','update','params','eml-format','rimraf','fast-json-patch','request-promise','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','status','end','offset','undefined','limit','count','set','Content-Range','json','reject','save','then','destroy','sendStatus','error','stack','name','index','FaxApplication','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','merge','map','options','findAll'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xfd71,0x163));var _0x1fd7=function(_0xa92013,_0x3b2577){_0xa92013=_0xa92013-0x0;var _0x49fdfa=_0xfd71[_0xa92013];return _0x49fdfa;};'use strict';var emlformat=require(_0x1fd7('0x0'));var rimraf=require(_0x1fd7('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1fd7('0x2'));var rp=require(_0x1fd7('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x1fd7('0x4'));var util=require(_0x1fd7('0x5'));var path=require('path');var sox=require(_0x1fd7('0x6'));var csv=require(_0x1fd7('0x7'));var ejs=require(_0x1fd7('0x8'));var fs=require('fs');var fs_extra=require(_0x1fd7('0x9'));var _=require(_0x1fd7('0xa'));var squel=require(_0x1fd7('0xb'));var crypto=require(_0x1fd7('0xc'));var jsforce=require(_0x1fd7('0xd'));var deskjs=require(_0x1fd7('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x1fd7('0xf'));var authService=require(_0x1fd7('0x10'));var qs=require(_0x1fd7('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x1fd7('0x12'))(_0x1fd7('0x13'));var utils=require('../../config/utils');var config=require(_0x1fd7('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x129313,_0x2842c9){_0x2842c9=_0x2842c9||0xcc;return function(_0x3fcb89){if(_0x3fcb89){return _0x129313['sendStatus'](_0x2842c9);}return _0x129313[_0x1fd7('0x15')](_0x2842c9)[_0x1fd7('0x16')]();};}function respondWithResult(_0x42ec8e,_0x17ca8a){_0x17ca8a=_0x17ca8a||0xc8;return function(_0x2ba8b2){if(_0x2ba8b2){return _0x42ec8e[_0x1fd7('0x15')](_0x17ca8a)['json'](_0x2ba8b2);}};}function respondWithFilteredResult(_0x15166a,_0x2dae21){return function(_0x2f5785){if(_0x2f5785){var _0x6af74a=typeof _0x2dae21[_0x1fd7('0x17')]===_0x1fd7('0x18')&&typeof _0x2dae21[_0x1fd7('0x19')]===_0x1fd7('0x18');var _0x226c87=_0x2f5785[_0x1fd7('0x1a')];var _0x12d67b=_0x6af74a?0x0:_0x2dae21['offset'];var _0x1e96ea=_0x6af74a?_0x2f5785[_0x1fd7('0x1a')]:_0x2dae21[_0x1fd7('0x17')]+_0x2dae21[_0x1fd7('0x19')];var _0x3008d2;if(_0x1e96ea>=_0x226c87){_0x1e96ea=_0x226c87;_0x3008d2=0xc8;}else{_0x3008d2=0xce;}_0x15166a['status'](_0x3008d2);return _0x15166a[_0x1fd7('0x1b')](_0x1fd7('0x1c'),_0x12d67b+'-'+_0x1e96ea+'/'+_0x226c87)[_0x1fd7('0x1d')](_0x2f5785);}return null;};}function patchUpdates(_0x219847){return function(_0x196caf){try{jsonpatch['apply'](_0x196caf,_0x219847,!![]);}catch(_0x23a252){return BPromise[_0x1fd7('0x1e')](_0x23a252);}return _0x196caf[_0x1fd7('0x1f')]();};}function saveUpdates(_0x2b48b7,_0x497e1c){return function(_0x17a6fd){if(_0x17a6fd){return _0x17a6fd['update'](_0x2b48b7)[_0x1fd7('0x20')](function(_0xe8893){return _0xe8893;});}return null;};}function removeEntity(_0x4c2aea,_0x27b765){return function(_0x8f44a3){if(_0x8f44a3){return _0x8f44a3[_0x1fd7('0x21')]()[_0x1fd7('0x20')](function(){_0x4c2aea[_0x1fd7('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x43d3b8,_0x48c881){return function(_0x540cba){if(!_0x540cba){_0x43d3b8[_0x1fd7('0x22')](0x194);}return _0x540cba;};}function handleError(_0x5b50aa,_0x269c92){_0x269c92=_0x269c92||0x1f4;return function(_0x39b39a){logger[_0x1fd7('0x23')](_0x39b39a[_0x1fd7('0x24')]);if(_0x39b39a['name']){delete _0x39b39a[_0x1fd7('0x25')];}_0x5b50aa[_0x1fd7('0x15')](_0x269c92)['send'](_0x39b39a);};}exports[_0x1fd7('0x26')]=function(_0x8087cd,_0x4d843c){var _0x2d2358={},_0x5cfe47={},_0x3b698b={'count':0x0,'rows':[]};var _0x586f3b=_['map'](db[_0x1fd7('0x27')]['rawAttributes'],function(_0x21cbc3){return{'name':_0x21cbc3['fieldName'],'type':_0x21cbc3[_0x1fd7('0x28')][_0x1fd7('0x29')]};});_0x5cfe47[_0x1fd7('0x2a')]=_['map'](_0x586f3b,'name');_0x5cfe47[_0x1fd7('0x2b')]=_[_0x1fd7('0x2c')](_0x8087cd[_0x1fd7('0x2b')]);_0x5cfe47[_0x1fd7('0x2d')]=_[_0x1fd7('0x2e')](_0x5cfe47['model'],_0x5cfe47[_0x1fd7('0x2b')]);_0x2d2358[_0x1fd7('0x2f')]=_[_0x1fd7('0x2e')](_0x5cfe47[_0x1fd7('0x2a')],qs[_0x1fd7('0x30')](_0x8087cd[_0x1fd7('0x2b')][_0x1fd7('0x30')]));_0x2d2358[_0x1fd7('0x2f')]=_0x2d2358[_0x1fd7('0x2f')][_0x1fd7('0x31')]?_0x2d2358[_0x1fd7('0x2f')]:_0x5cfe47['model'];if(!_0x8087cd[_0x1fd7('0x2b')]['hasOwnProperty'](_0x1fd7('0x32'))){_0x2d2358['limit']=qs[_0x1fd7('0x19')](_0x8087cd[_0x1fd7('0x2b')][_0x1fd7('0x19')]);_0x2d2358['offset']=qs[_0x1fd7('0x17')](_0x8087cd[_0x1fd7('0x2b')][_0x1fd7('0x17')]);}_0x2d2358[_0x1fd7('0x33')]=qs[_0x1fd7('0x34')](_0x8087cd[_0x1fd7('0x2b')][_0x1fd7('0x34')]);_0x2d2358[_0x1fd7('0x35')]=qs[_0x1fd7('0x2d')](_['pick'](_0x8087cd[_0x1fd7('0x2b')],_0x5cfe47['filters']),_0x586f3b);if(_0x8087cd[_0x1fd7('0x2b')][_0x1fd7('0x36')]){_0x2d2358[_0x1fd7('0x35')]=_[_0x1fd7('0x37')](_0x2d2358[_0x1fd7('0x35')],{'$or':_[_0x1fd7('0x38')](_0x586f3b,function(_0x4b1e60){if(_0x4b1e60[_0x1fd7('0x28')]!=='VIRTUAL'){var _0x34c222={};_0x34c222[_0x4b1e60['name']]={'$like':'%'+_0x8087cd[_0x1fd7('0x2b')]['filter']+'%'};return _0x34c222;}})});}_0x2d2358=_['merge']({},_0x2d2358,_0x8087cd[_0x1fd7('0x39')]);var _0x14efa2={'where':_0x2d2358['where']};return db[_0x1fd7('0x27')][_0x1fd7('0x1a')](_0x14efa2)[_0x1fd7('0x20')](function(_0x3fd66d){_0x3b698b[_0x1fd7('0x1a')]=_0x3fd66d;if(_0x8087cd[_0x1fd7('0x2b')]['includeAll']){_0x2d2358['include']=[{'all':!![]}];}return db[_0x1fd7('0x27')][_0x1fd7('0x3a')](_0x2d2358);})[_0x1fd7('0x20')](function(_0x848a61){_0x3b698b['rows']=_0x848a61;return _0x3b698b;})[_0x1fd7('0x20')](respondWithFilteredResult(_0x4d843c,_0x2d2358))[_0x1fd7('0x3b')](handleError(_0x4d843c,null));};exports[_0x1fd7('0x3c')]=function(_0x24e52e,_0x113818){var _0x118ca0={'raw':!![],'where':{'id':_0x24e52e['params']['id']}},_0x350800={};_0x350800[_0x1fd7('0x2a')]=_['keys'](db['FaxApplication'][_0x1fd7('0x3d')]);_0x350800[_0x1fd7('0x2b')]=_[_0x1fd7('0x2c')](_0x24e52e['query']);_0x350800[_0x1fd7('0x2d')]=_[_0x1fd7('0x2e')](_0x350800['model'],_0x350800[_0x1fd7('0x2b')]);_0x118ca0[_0x1fd7('0x2f')]=_[_0x1fd7('0x2e')](_0x350800[_0x1fd7('0x2a')],qs[_0x1fd7('0x30')](_0x24e52e[_0x1fd7('0x2b')][_0x1fd7('0x30')]));_0x118ca0['attributes']=_0x118ca0[_0x1fd7('0x2f')][_0x1fd7('0x31')]?_0x118ca0['attributes']:_0x350800['model'];if(_0x24e52e['query'][_0x1fd7('0x3e')]){_0x118ca0[_0x1fd7('0x3f')]=[{'all':!![]}];}_0x118ca0=_['merge']({},_0x118ca0,_0x24e52e[_0x1fd7('0x39')]);return db['FaxApplication'][_0x1fd7('0x40')](_0x118ca0)[_0x1fd7('0x20')](handleEntityNotFound(_0x113818,null))[_0x1fd7('0x20')](respondWithResult(_0x113818,null))[_0x1fd7('0x3b')](handleError(_0x113818,null));};exports[_0x1fd7('0x41')]=function(_0x4946d8,_0x43e650){return db[_0x1fd7('0x27')][_0x1fd7('0x41')](_0x4946d8[_0x1fd7('0x42')],{})[_0x1fd7('0x20')](respondWithResult(_0x43e650,0xc9))[_0x1fd7('0x3b')](handleError(_0x43e650,null));};exports[_0x1fd7('0x43')]=function(_0x250846,_0x3f5e67){if(_0x250846[_0x1fd7('0x42')]['id']){delete _0x250846[_0x1fd7('0x42')]['id'];}return db[_0x1fd7('0x27')]['find']({'where':{'id':_0x250846[_0x1fd7('0x44')]['id']}})[_0x1fd7('0x20')](handleEntityNotFound(_0x3f5e67,null))[_0x1fd7('0x20')](saveUpdates(_0x250846[_0x1fd7('0x42')],null))[_0x1fd7('0x20')](respondWithResult(_0x3f5e67,null))[_0x1fd7('0x3b')](handleError(_0x3f5e67,null));};exports[_0x1fd7('0x21')]=function(_0x50905a,_0xab0bc9){return db[_0x1fd7('0x27')][_0x1fd7('0x40')]({'where':{'id':_0x50905a[_0x1fd7('0x44')]['id']}})[_0x1fd7('0x20')](handleEntityNotFound(_0xab0bc9,null))[_0x1fd7('0x20')](removeEntity(_0xab0bc9,null))['catch'](handleError(_0xab0bc9,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index 57c9b97..75b5388 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 _0xbe5e=['bluebird','request-promise','path','rimraf','./faxApplication.attributes','define','utf8mb4','lodash','util','api','moment'];(function(_0x1f8fe3,_0x3ecd11){var _0x4d7e3a=function(_0x4e90c0){while(--_0x4e90c0){_0x1f8fe3['push'](_0x1f8fe3['shift']());}};_0x4d7e3a(++_0x3ecd11);}(_0xbe5e,0xf9));var _0xebe5=function(_0xa774f1,_0x29c896){_0xa774f1=_0xa774f1-0x0;var _0x1ca101=_0xbe5e[_0xa774f1];return _0x1ca101;};'use strict';var _=require(_0xebe5('0x0'));var util=require(_0xebe5('0x1'));var logger=require('../../config/logger')(_0xebe5('0x2'));var moment=require(_0xebe5('0x3'));var BPromise=require(_0xebe5('0x4'));var rp=require(_0xebe5('0x5'));var fs=require('fs');var path=require(_0xebe5('0x6'));var rimraf=require(_0xebe5('0x7'));var config=require('../../config/environment');var attributes=require(_0xebe5('0x8'));module['exports']=function(_0x2c586b,_0x586777){return _0x2c586b[_0xebe5('0x9')]('FaxApplication',attributes,{'tableName':'fax_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xebe5('0xa'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x61f6=['utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','path','../../config/environment','./faxApplication.attributes','exports','define','FaxApplication','fax_applications','utf8mb4'];(function(_0x56c78f,_0x541845){var _0x143dbe=function(_0x55134b){while(--_0x55134b){_0x56c78f['push'](_0x56c78f['shift']());}};_0x143dbe(++_0x541845);}(_0x61f6,0x151));var _0x661f=function(_0xf72786,_0x1a0ddd){_0xf72786=_0xf72786-0x0;var _0x113f3e=_0x61f6[_0xf72786];return _0x113f3e;};'use strict';var _=require(_0x661f('0x0'));var util=require('util');var logger=require(_0x661f('0x1'))(_0x661f('0x2'));var moment=require(_0x661f('0x3'));var BPromise=require(_0x661f('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x661f('0x5'));var rimraf=require('rimraf');var config=require(_0x661f('0x6'));var attributes=require(_0x661f('0x7'));module[_0x661f('0x8')]=function(_0x293153,_0x50ba3d){return _0x293153[_0x661f('0x9')](_0x661f('0xa'),attributes,{'tableName':_0x661f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x661f('0xc'),'collate':_0x661f('0xd')});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index 2237001..0adaf3f 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 _0x5341=['UpdateFaxApplication','update','options','raw','where','limit','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','info','FaxApplication,\x20%s,\x20%s','request\x20sent','debug','FaxApplication,\x20%s,\x20%s,\x20%s','error','code','message','result','catch'];(function(_0x506262,_0x54295a){var _0x4828f5=function(_0x3441a7){while(--_0x3441a7){_0x506262['push'](_0x506262['shift']());}};_0x4828f5(++_0x54295a);}(_0x5341,0xbb));var _0x1534=function(_0x6002a0,_0x521485){_0x6002a0=_0x6002a0-0x0;var _0x1c92f2=_0x5341[_0x6002a0];return _0x1c92f2;};'use strict';var _=require(_0x1534('0x0'));var util=require(_0x1534('0x1'));var moment=require(_0x1534('0x2'));var BPromise=require(_0x1534('0x3'));var rs=require(_0x1534('0x4'));var fs=require('fs');var Redis=require(_0x1534('0x5'));var db=require(_0x1534('0x6'))['db'];var utils=require(_0x1534('0x7'));var logger=require('../../config/logger')(_0x1534('0x8'));var config=require('../../config/environment');var jayson=require(_0x1534('0x9'));var client=jayson[_0x1534('0xa')][_0x1534('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1cdde6,_0x105587,_0x5966b2){return new BPromise(function(_0x1a526d,_0x52ff7b){return client[_0x1534('0xc')](_0x1cdde6,_0x5966b2)['then'](function(_0xff330b){logger[_0x1534('0xd')](_0x1534('0xe'),_0x105587,_0x1534('0xf'));logger[_0x1534('0x10')](_0x1534('0x11'),_0x105587,_0x1534('0xf'),JSON['stringify'](_0xff330b));if(_0xff330b[_0x1534('0x12')]){if(_0xff330b[_0x1534('0x12')][_0x1534('0x13')]===0x1f4){logger[_0x1534('0x12')](_0x1534('0xe'),_0x105587,_0xff330b['error'][_0x1534('0x14')]);return _0x52ff7b(_0xff330b[_0x1534('0x12')][_0x1534('0x14')]);}logger['error']('FaxApplication,\x20%s,\x20%s',_0x105587,_0xff330b[_0x1534('0x12')][_0x1534('0x14')]);return _0x1a526d(_0xff330b[_0x1534('0x12')][_0x1534('0x14')]);}else{logger['info'](_0x1534('0xe'),_0x105587,_0x1534('0xf'));_0x1a526d(_0xff330b[_0x1534('0x15')][_0x1534('0x14')]);}})[_0x1534('0x16')](function(_0x3e9816){logger['error'](_0x1534('0xe'),_0x105587,_0x3e9816);_0x52ff7b(_0x3e9816);});});}exports[_0x1534('0x17')]=function(_0x31c5f9){var _0x39d5cb=this;return new Promise(function(_0x38dc45,_0x212445){return db['FaxApplication'][_0x1534('0x18')](_0x31c5f9['body'],{'raw':_0x31c5f9[_0x1534('0x19')]?_0x31c5f9['options'][_0x1534('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x31c5f9[_0x1534('0x19')]?_0x31c5f9[_0x1534('0x19')][_0x1534('0x1b')]||null:null,'attributes':_0x31c5f9[_0x1534('0x19')]?_0x31c5f9[_0x1534('0x19')]['attributes']||null:null,'limit':_0x31c5f9[_0x1534('0x19')]?_0x31c5f9[_0x1534('0x19')][_0x1534('0x1c')]||null:null})['then'](function(_0x2003d7){logger[_0x1534('0xd')](_0x1534('0x17'),_0x31c5f9);logger[_0x1534('0x10')](_0x1534('0x17'),_0x31c5f9,JSON[_0x1534('0x1d')](_0x2003d7));_0x38dc45(_0x2003d7);})[_0x1534('0x16')](function(_0x408d34){logger[_0x1534('0x12')](_0x1534('0x17'),_0x408d34[_0x1534('0x14')],_0x31c5f9);_0x212445(_0x39d5cb[_0x1534('0x12')](0x1f4,_0x408d34[_0x1534('0x14')]));});});}; \ No newline at end of file +var _0x1a1c=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','info','request\x20sent','debug','stringify','error','code','FaxApplication,\x20%s,\x20%s','message','result','catch','UpdateFaxApplication','FaxApplication','update','body','options','raw','where','attributes','limit','then','lodash','util'];(function(_0x5783f4,_0x4a9e0a){var _0x28e380=function(_0x1ffc49){while(--_0x1ffc49){_0x5783f4['push'](_0x5783f4['shift']());}};_0x28e380(++_0x4a9e0a);}(_0x1a1c,0xfe));var _0xc1a1=function(_0x399cb5,_0x3f7202){_0x399cb5=_0x399cb5-0x0;var _0x57ec09=_0x1a1c[_0x399cb5];return _0x57ec09;};'use strict';var _=require(_0xc1a1('0x0'));var util=require(_0xc1a1('0x1'));var moment=require(_0xc1a1('0x2'));var BPromise=require(_0xc1a1('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc1a1('0x4'));var db=require(_0xc1a1('0x5'))['db'];var utils=require(_0xc1a1('0x6'));var logger=require(_0xc1a1('0x7'))(_0xc1a1('0x8'));var config=require(_0xc1a1('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0xc1a1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x161761,_0xca636,_0x576214){return new BPromise(function(_0x41ce8a,_0x126025){return client[_0xc1a1('0xb')](_0x161761,_0x576214)['then'](function(_0x416e91){logger[_0xc1a1('0xc')]('FaxApplication,\x20%s,\x20%s',_0xca636,_0xc1a1('0xd'));logger[_0xc1a1('0xe')]('FaxApplication,\x20%s,\x20%s,\x20%s',_0xca636,'request\x20sent',JSON[_0xc1a1('0xf')](_0x416e91));if(_0x416e91[_0xc1a1('0x10')]){if(_0x416e91[_0xc1a1('0x10')][_0xc1a1('0x11')]===0x1f4){logger[_0xc1a1('0x10')](_0xc1a1('0x12'),_0xca636,_0x416e91[_0xc1a1('0x10')][_0xc1a1('0x13')]);return _0x126025(_0x416e91[_0xc1a1('0x10')][_0xc1a1('0x13')]);}logger[_0xc1a1('0x10')](_0xc1a1('0x12'),_0xca636,_0x416e91[_0xc1a1('0x10')][_0xc1a1('0x13')]);return _0x41ce8a(_0x416e91[_0xc1a1('0x10')][_0xc1a1('0x13')]);}else{logger[_0xc1a1('0xc')](_0xc1a1('0x12'),_0xca636,_0xc1a1('0xd'));_0x41ce8a(_0x416e91[_0xc1a1('0x14')][_0xc1a1('0x13')]);}})[_0xc1a1('0x15')](function(_0x3f35a9){logger['error'](_0xc1a1('0x12'),_0xca636,_0x3f35a9);_0x126025(_0x3f35a9);});});}exports[_0xc1a1('0x16')]=function(_0x22baaf){var _0x193c83=this;return new Promise(function(_0x9653dd,_0x336bd1){return db[_0xc1a1('0x17')][_0xc1a1('0x18')](_0x22baaf[_0xc1a1('0x19')],{'raw':_0x22baaf[_0xc1a1('0x1a')]?_0x22baaf[_0xc1a1('0x1a')][_0xc1a1('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x22baaf[_0xc1a1('0x1a')]?_0x22baaf[_0xc1a1('0x1a')][_0xc1a1('0x1c')]||null:null,'attributes':_0x22baaf[_0xc1a1('0x1a')]?_0x22baaf[_0xc1a1('0x1a')][_0xc1a1('0x1d')]||null:null,'limit':_0x22baaf[_0xc1a1('0x1a')]?_0x22baaf['options'][_0xc1a1('0x1e')]||null:null})[_0xc1a1('0x1f')](function(_0x5ce696){logger[_0xc1a1('0xc')](_0xc1a1('0x16'),_0x22baaf);logger[_0xc1a1('0xe')](_0xc1a1('0x16'),_0x22baaf,JSON[_0xc1a1('0xf')](_0x5ce696));_0x9653dd(_0x5ce696);})[_0xc1a1('0x15')](function(_0x6bce1c){logger[_0xc1a1('0x10')](_0xc1a1('0x16'),_0x6bce1c[_0xc1a1('0x13')],_0x22baaf);_0x336bd1(_0x193c83[_0xc1a1('0x10')](0x1f4,_0x6bce1c[_0xc1a1('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index ac7eb93..b0f4d02 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 _0x0b0e=['./faxApplication.controller','get','isAuthenticated','index','show','post','create','/:id','delete','destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x3485f8,_0x1b66cf){var _0x1fbba7=function(_0x135b73){while(--_0x135b73){_0x3485f8['push'](_0x3485f8['shift']());}};_0x1fbba7(++_0x1b66cf);}(_0x0b0e,0x187));var _0xe0b0=function(_0x3d8d0a,_0x11bb87){_0x3d8d0a=_0x3d8d0a-0x0;var _0x5b9df5=_0x0b0e[_0x3d8d0a];return _0x5b9df5;};'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('0xd')]('/',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0xe')]);router['put'](_0xe0b0('0xf'),auth[_0xe0b0('0xa')](),controller['update']);router[_0xe0b0('0x10')](_0xe0b0('0xf'),auth['isAuthenticated'](),controller[_0xe0b0('0x11')]);module[_0xe0b0('0x12')]=router; \ No newline at end of file +var _0x4024=['express','fs-extra','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','update','destroy','exports','multer','util','connect-timeout'];(function(_0x227d36,_0x2adbc0){var _0x48cf8f=function(_0x5c16b2){while(--_0x5c16b2){_0x227d36['push'](_0x227d36['shift']());}};_0x48cf8f(++_0x2adbc0);}(_0x4024,0x89));var _0x4402=function(_0x542d66,_0x48f89a){_0x542d66=_0x542d66-0x0;var _0x5e0b13=_0x4024[_0x542d66];return _0x5e0b13;};'use strict';var multer=require(_0x4402('0x0'));var util=require(_0x4402('0x1'));var path=require('path');var timeout=require(_0x4402('0x2'));var express=require(_0x4402('0x3'));var router=express['Router']();var fs_extra=require(_0x4402('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x4402('0x5'));var config=require(_0x4402('0x6'));var controller=require('./faxApplication.controller');router['get']('/',auth[_0x4402('0x7')](),controller[_0x4402('0x8')]);router[_0x4402('0x9')]('/:id',auth[_0x4402('0x7')](),controller['show']);router['post']('/',auth[_0x4402('0x7')](),controller['create']);router['put'](_0x4402('0xa'),auth['isAuthenticated'](),controller[_0x4402('0xb')]);router['delete'](_0x4402('0xa'),auth['isAuthenticated'](),controller[_0x4402('0xc')]);module[_0x4402('0xd')]=router; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.attributes.js b/server/api/faxInteraction/faxInteraction.attributes.js index d33c66b..5ca889b 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 _0x8aad=['ENUM','out','sequelize','exports','DATE','STRING'];(function(_0x3913ff,_0x167ae0){var _0x41cb3b=function(_0x12f3c3){while(--_0x12f3c3){_0x3913ff['push'](_0x3913ff['shift']());}};_0x41cb3b(++_0x167ae0);}(_0x8aad,0x146));var _0xd8aa=function(_0x5b0cdf,_0x43746a){_0x5b0cdf=_0x5b0cdf-0x0;var _0x403183=_0x8aad[_0x5b0cdf];return _0x403183;};'use strict';var Sequelize=require(_0xd8aa('0x0'));module[_0xd8aa('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xd8aa('0x2')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xd8aa('0x3')]},'thirdDisposition':{'type':Sequelize[_0xd8aa('0x3')]},'note':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize['DATE']},'fax':{'type':Sequelize[_0xd8aa('0x3')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xd8aa('0x2')]},'lastMsgDirection':{'type':Sequelize[_0xd8aa('0x4')]('in',_0xd8aa('0x5')),'defaultValue':'in','allowNull':![]},'queueId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x7b84=['STRING','ENUM','out','INTEGER','sequelize','exports','BOOLEAN','DATE'];(function(_0xea8947,_0x1b573d){var _0x2455e9=function(_0x18771e){while(--_0x18771e){_0xea8947['push'](_0xea8947['shift']());}};_0x2455e9(++_0x1b573d);}(_0x7b84,0x17c));var _0x47b8=function(_0x4e50ff,_0x5ed966){_0x4e50ff=_0x4e50ff-0x0;var _0x384a9f=_0x7b84[_0x4e50ff];return _0x384a9f;};'use strict';var Sequelize=require(_0x47b8('0x0'));module[_0x47b8('0x1')]={'closed':{'type':Sequelize[_0x47b8('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x47b8('0x3')]},'disposition':{'type':Sequelize[_0x47b8('0x4')]},'secondDisposition':{'type':Sequelize[_0x47b8('0x4')]},'thirdDisposition':{'type':Sequelize[_0x47b8('0x4')]},'note':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x47b8('0x3')]},'fax':{'type':Sequelize[_0x47b8('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x47b8('0x5')]('in',_0x47b8('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x47b8('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x47b8('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'queueId':{'type':Sequelize[_0x47b8('0x7')]}}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.controller.js b/server/api/faxInteraction/faxInteraction.controller.js index 105da43..6e5f369 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 _0xf2d6=['util','path','lodash','../../components/interaction/service','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','defaults','redis','localhost','./faxInteraction.socket','register','status','json','offset','limit','undefined','count','destroy','then','end','error','stack','name','send','index','map','rawAttributes','type','key','findAll','fax','user','catch','show','params','FaxInteraction','keys','query','filters','intersection','attributes','fields','length','model','include','options','find','create','body','update','describe','addMessage','FaxMessage','ids','findOne','hasOwnProperty','nolimit','sort','where','pick','merge','filter','$gte','split','YYYY-MM-DD\x20HH:mm:ss','includeAll','rows','addTags','setTags','spread','Tag','color','emit','faxInteractionTags:save','removeTags','toString','join','root','server','files','format','transcript-%d-%s.zip','push','Attachment','Messages','createdAt','get','basename','existsSync','pipe','createWriteStream','resolve','download','err','sendStatus','rimraf','zip-dir','moment'];(function(_0x2c0d65,_0x132871){var _0x533b01=function(_0xdaa9d5){while(--_0xdaa9d5){_0x2c0d65['push'](_0x2c0d65['shift']());}};_0x533b01(++_0x132871);}(_0xf2d6,0xc5));var _0x6f2d=function(_0x5d0206,_0xecf9a3){_0x5d0206=_0x5d0206-0x0;var _0x419f0e=_0xf2d6[_0x5d0206];return _0x419f0e;};'use strict';var rimraf=require(_0x6f2d('0x0'));var zipdir=require(_0x6f2d('0x1'));var moment=require(_0x6f2d('0x2'));var BPromise=require('bluebird');var util=require(_0x6f2d('0x3'));var path=require(_0x6f2d('0x4'));var fs=require('fs');var _=require(_0x6f2d('0x5'));var Redis=require('ioredis');var interaction=require(_0x6f2d('0x6'));var qs=require(_0x6f2d('0x7'));var logger=require(_0x6f2d('0x8'))('api');var config=require(_0x6f2d('0x9'));var db=require(_0x6f2d('0xa'))['db'];config['redis']=_[_0x6f2d('0xb')](config[_0x6f2d('0xc')],{'host':_0x6f2d('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x6f2d('0xe'))[_0x6f2d('0xf')](socket);function respondWithStatusCode(_0x32401d,_0x4fd559){_0x4fd559=_0x4fd559||0xcc;return function(_0x3af24b){if(_0x3af24b){return _0x32401d['sendStatus'](_0x4fd559);}return _0x32401d['status'](_0x4fd559)['end']();};}function respondWithResult(_0x2b41b3,_0x276f2e){_0x276f2e=_0x276f2e||0xc8;return function(_0x262a19){if(_0x262a19){return _0x2b41b3[_0x6f2d('0x10')](_0x276f2e)[_0x6f2d('0x11')](_0x262a19);}};}function respondWithFilteredResult(_0x3ee6d1,_0x40327a){return function(_0x4f33d4){if(_0x4f33d4){var _0x41973d=typeof _0x40327a[_0x6f2d('0x12')]==='undefined'&&typeof _0x40327a[_0x6f2d('0x13')]===_0x6f2d('0x14');var _0x39fcaa=_0x4f33d4[_0x6f2d('0x15')];var _0x3ca493=_0x41973d?0x0:_0x40327a['offset'];var _0x2ed946=_0x41973d?_0x4f33d4[_0x6f2d('0x15')]:_0x40327a['offset']+_0x40327a[_0x6f2d('0x13')];var _0x54c9e0;if(_0x2ed946>=_0x39fcaa){_0x2ed946=_0x39fcaa;_0x54c9e0=0xc8;}else{_0x54c9e0=0xce;}_0x3ee6d1[_0x6f2d('0x10')](_0x54c9e0);return _0x3ee6d1['set']('Content-Range',_0x3ca493+'-'+_0x2ed946+'/'+_0x39fcaa)[_0x6f2d('0x11')](_0x4f33d4);}return null;};}function saveUpdates(_0x2e0b8a){return function(_0xbdf0f0){if(_0xbdf0f0){return _0xbdf0f0['update'](_0x2e0b8a)['then'](function(_0x4cbc4c){return _0x4cbc4c;});}return null;};}function removeEntity(_0x41225a){return function(_0x573930){if(_0x573930){return _0x573930[_0x6f2d('0x16')]()[_0x6f2d('0x17')](function(){_0x41225a[_0x6f2d('0x10')](0xcc)[_0x6f2d('0x18')]();});}};}function handleEntityNotFound(_0x6a35e6){return function(_0x44b146){if(!_0x44b146){_0x6a35e6['sendStatus'](0x194);}return _0x44b146;};}function handleError(_0x4cac43,_0x367e08){_0x367e08=_0x367e08||0x1f4;return function(_0x5768db){logger[_0x6f2d('0x19')](_0x5768db[_0x6f2d('0x1a')]);if(_0x5768db['name']){delete _0x5768db[_0x6f2d('0x1b')];}_0x4cac43[_0x6f2d('0x10')](_0x367e08)[_0x6f2d('0x1c')](_0x5768db);};}exports[_0x6f2d('0x1d')]=function(_0x350a71,_0x375984){var _0x3d6f5b={};var _0x5f4688=_[_0x6f2d('0x1e')](db['FaxInteraction'][_0x6f2d('0x1f')],function(_0x4277e2){return{'name':_0x4277e2['fieldName'],'type':_0x4277e2[_0x6f2d('0x20')][_0x6f2d('0x21')]};});_0x3d6f5b=qs['getOptions'](_0x5f4688,_0x350a71);return interaction[_0x6f2d('0x22')](_0x6f2d('0x23'),_0x350a71['query'],_0x350a71[_0x6f2d('0x24')],_0x3d6f5b,_0x5f4688)[_0x6f2d('0x17')](respondWithFilteredResult(_0x375984,_0x3d6f5b))[_0x6f2d('0x25')](handleError(_0x375984,null));};exports[_0x6f2d('0x26')]=function(_0x204796,_0x1c472a){var _0x21598e={'raw':![],'where':{'id':_0x204796[_0x6f2d('0x27')]['id']}},_0x4bc53c={};_0x4bc53c['model']=_['keys'](db[_0x6f2d('0x28')][_0x6f2d('0x1f')]);_0x4bc53c['query']=_[_0x6f2d('0x29')](_0x204796[_0x6f2d('0x2a')]);_0x4bc53c[_0x6f2d('0x2b')]=_[_0x6f2d('0x2c')](_0x4bc53c['model'],_0x4bc53c[_0x6f2d('0x2a')]);_0x21598e[_0x6f2d('0x2d')]=_['intersection'](_0x4bc53c['model'],qs[_0x6f2d('0x2e')](_0x204796['query'][_0x6f2d('0x2e')]));_0x21598e[_0x6f2d('0x2d')]=_0x21598e[_0x6f2d('0x2d')][_0x6f2d('0x2f')]?_0x21598e[_0x6f2d('0x2d')]:_0x4bc53c[_0x6f2d('0x30')];if(_0x204796[_0x6f2d('0x2a')]['includeAll']){_0x21598e[_0x6f2d('0x31')]=[{'all':!![]}];}_0x21598e=_['merge']({},_0x21598e,_0x204796[_0x6f2d('0x32')]);return db[_0x6f2d('0x28')][_0x6f2d('0x33')](_0x21598e)['then'](handleEntityNotFound(_0x1c472a,null))[_0x6f2d('0x17')](respondWithResult(_0x1c472a,null))[_0x6f2d('0x25')](handleError(_0x1c472a,null));};exports['create']=function(_0x34c8f9,_0x31d081){return db[_0x6f2d('0x28')][_0x6f2d('0x34')](_0x34c8f9[_0x6f2d('0x35')],{})[_0x6f2d('0x17')](respondWithResult(_0x31d081,0xc9))['catch'](handleError(_0x31d081,null));};exports[_0x6f2d('0x36')]=function(_0x696805,_0x3fc101){if(_0x696805['body']['id']){delete _0x696805[_0x6f2d('0x35')]['id'];}return db['FaxInteraction'][_0x6f2d('0x33')]({'where':{'id':_0x696805[_0x6f2d('0x27')]['id']}})[_0x6f2d('0x17')](handleEntityNotFound(_0x3fc101,null))[_0x6f2d('0x17')](saveUpdates(_0x696805['body'],null))[_0x6f2d('0x17')](respondWithResult(_0x3fc101,null))['catch'](handleError(_0x3fc101,null));};exports[_0x6f2d('0x16')]=function(_0x3c99f2,_0x2d935e){return db[_0x6f2d('0x28')][_0x6f2d('0x33')]({'where':{'id':_0x3c99f2['params']['id']}})[_0x6f2d('0x17')](handleEntityNotFound(_0x2d935e,null))[_0x6f2d('0x17')](removeEntity(_0x2d935e,null))[_0x6f2d('0x25')](handleError(_0x2d935e,null));};exports[_0x6f2d('0x37')]=function(_0x352574,_0x45f831){return db[_0x6f2d('0x28')]['describe']()[_0x6f2d('0x17')](respondWithResult(_0x45f831,null))[_0x6f2d('0x25')](handleError(_0x45f831,null));};exports[_0x6f2d('0x38')]=function(_0x48de04,_0x5352c0){return db[_0x6f2d('0x39')][_0x6f2d('0x33')]({'where':{'id':_0x48de04['params']['id']}})[_0x6f2d('0x17')](handleEntityNotFound(_0x5352c0,null))[_0x6f2d('0x17')](function(_0x5d0bcc){if(_0x5d0bcc){return _0x5d0bcc['addMessage'](_0x48de04['body'][_0x6f2d('0x3a')],_['omit'](_0x48de04[_0x6f2d('0x35')],[_0x6f2d('0x3a'),'id'])||{});}})[_0x6f2d('0x17')](respondWithResult(_0x5352c0,null))['catch'](handleError(_0x5352c0,null));};exports['getMessages']=function(_0x2721ac,_0x1deacd){var _0x1e1c22={'raw':![],'where':{}};var _0x36980a={};var _0xb9a933={'count':0x0,'rows':[]};return db[_0x6f2d('0x28')][_0x6f2d('0x3b')]({'where':{'id':_0x2721ac['params']['id']}})[_0x6f2d('0x17')](handleEntityNotFound(_0x1deacd,null))[_0x6f2d('0x17')](function(_0xef21b3){if(_0xef21b3){_0x36980a[_0x6f2d('0x30')]=_[_0x6f2d('0x29')](db[_0x6f2d('0x39')][_0x6f2d('0x1f')]);_0x36980a[_0x6f2d('0x2a')]=_[_0x6f2d('0x29')](_0x2721ac[_0x6f2d('0x2a')]);_0x36980a[_0x6f2d('0x2b')]=_[_0x6f2d('0x2c')](_0x36980a[_0x6f2d('0x30')],_0x36980a[_0x6f2d('0x2a')]);_0x1e1c22[_0x6f2d('0x2d')]=_[_0x6f2d('0x2c')](_0x36980a['model'],qs[_0x6f2d('0x2e')](_0x2721ac[_0x6f2d('0x2a')][_0x6f2d('0x2e')]));_0x1e1c22[_0x6f2d('0x2d')]=_0x1e1c22[_0x6f2d('0x2d')]['length']?_0x1e1c22[_0x6f2d('0x2d')]:_0x36980a[_0x6f2d('0x30')];if(!_0x2721ac[_0x6f2d('0x2a')][_0x6f2d('0x3c')](_0x6f2d('0x3d'))){_0x1e1c22[_0x6f2d('0x13')]=qs['limit'](_0x2721ac[_0x6f2d('0x2a')][_0x6f2d('0x13')]);_0x1e1c22[_0x6f2d('0x12')]=qs['offset'](_0x2721ac[_0x6f2d('0x2a')][_0x6f2d('0x12')]);}_0x1e1c22['order']=qs[_0x6f2d('0x3e')](_0x2721ac[_0x6f2d('0x2a')][_0x6f2d('0x3e')]);_0x1e1c22[_0x6f2d('0x3f')]=qs['filters'](_[_0x6f2d('0x40')](_0x2721ac[_0x6f2d('0x2a')],_0x36980a[_0x6f2d('0x2b')]));_0x1e1c22['where']['FaxInteractionId']=_0xef21b3['id'];if(_0x2721ac[_0x6f2d('0x2a')]['filter']){_0x1e1c22[_0x6f2d('0x3f')]=_[_0x6f2d('0x41')](_0x1e1c22[_0x6f2d('0x3f')],{'$or':_[_0x6f2d('0x1e')](_0x1e1c22[_0x6f2d('0x2d')],function(_0x43995a){var _0xe3155={};_0xe3155[_0x43995a]={'$like':'%'+_0x2721ac[_0x6f2d('0x2a')][_0x6f2d('0x42')]+'%'};return _0xe3155;})});}if(_0x2721ac['query']['$gte']){var _0x8771c=_0x2721ac[_0x6f2d('0x2a')][_0x6f2d('0x43')][_0x6f2d('0x44')](',');var _0x3f022c={};_0x3f022c[_0x8771c[0x0]]={'$gte':moment(_0x8771c[0x1])['format'](_0x6f2d('0x45'))};_0x1e1c22['where']=_[_0x6f2d('0x41')](_0x1e1c22[_0x6f2d('0x3f')],_0x3f022c);}_0x1e1c22=_[_0x6f2d('0x41')]({},_0x1e1c22,_0x2721ac[_0x6f2d('0x32')]);return db[_0x6f2d('0x39')][_0x6f2d('0x15')]({'where':_0x1e1c22[_0x6f2d('0x3f')]})['then'](function(_0x119351){_0xb9a933[_0x6f2d('0x15')]=_0x119351;if(_0x2721ac[_0x6f2d('0x2a')][_0x6f2d('0x46')]){_0x1e1c22[_0x6f2d('0x31')]=[{'all':!![]}];}return db[_0x6f2d('0x39')][_0x6f2d('0x22')](_0x1e1c22);})[_0x6f2d('0x17')](function(_0x560f9a){_0xb9a933[_0x6f2d('0x47')]=_0x560f9a;return _0xb9a933;});}})[_0x6f2d('0x17')](respondWithFilteredResult(_0x1deacd,_0x1e1c22))[_0x6f2d('0x25')](handleError(_0x1deacd,null));};exports[_0x6f2d('0x48')]=function(_0x412ce7,_0x5e8777){return db[_0x6f2d('0x28')][_0x6f2d('0x33')]({'where':{'id':_0x412ce7[_0x6f2d('0x27')]['id']}})[_0x6f2d('0x17')](handleEntityNotFound(_0x5e8777,null))[_0x6f2d('0x17')](function(_0x46cf32){if(_0x46cf32){return _0x46cf32[_0x6f2d('0x49')](_0x412ce7['body'][_0x6f2d('0x3a')],_['omit'](_0x412ce7[_0x6f2d('0x35')],[_0x6f2d('0x3a'),'id'])||{})[_0x6f2d('0x4a')](function(){return db[_0x6f2d('0x4b')][_0x6f2d('0x22')]({'attributes':['id',_0x6f2d('0x1b'),_0x6f2d('0x4c')],'where':{'id':_0x412ce7[_0x6f2d('0x35')][_0x6f2d('0x3a')]}});})[_0x6f2d('0x17')](function(_0x1be5c8){socket[_0x6f2d('0x4d')](_0x6f2d('0x4e'),{'id':Number(_0x412ce7[_0x6f2d('0x27')]['id']),'tags':_0x1be5c8||[]});return{'id':Number(_0x412ce7['params']['id']),'tags':_0x1be5c8||[]};});}})[_0x6f2d('0x17')](respondWithResult(_0x5e8777,null))[_0x6f2d('0x25')](handleError(_0x5e8777,null));};exports['removeTags']=function(_0x531776,_0x4fc1a4){return db[_0x6f2d('0x28')][_0x6f2d('0x33')]({'where':{'id':_0x531776['params']['id']}})[_0x6f2d('0x17')](handleEntityNotFound(_0x4fc1a4,null))[_0x6f2d('0x17')](function(_0x1e2b48){if(_0x1e2b48){return _0x1e2b48[_0x6f2d('0x4f')](_0x531776[_0x6f2d('0x2a')][_0x6f2d('0x3a')]);}})[_0x6f2d('0x17')](respondWithStatusCode(_0x4fc1a4,null))[_0x6f2d('0x25')](handleError(_0x4fc1a4,null));};exports['download']=function(_0x28439a,_0x4d781b){var _0x1bac28=moment()['unix']()[_0x6f2d('0x50')]();var _0x11e261=path[_0x6f2d('0x51')](config[_0x6f2d('0x52')],_0x6f2d('0x53'),'files','tmp');var _0x4ebed9=path['join'](config['root'],_0x6f2d('0x53'),_0x6f2d('0x54'),'attachments');var _0x451b72=path[_0x6f2d('0x51')](_0x11e261,_0x1bac28);var _0x54fdb5=util[_0x6f2d('0x55')](_0x6f2d('0x56'),_0x28439a[_0x6f2d('0x27')]['id'],_0x1bac28);var _0x3fc0e9=path[_0x6f2d('0x51')](_0x11e261,_0x54fdb5);var _0xf515b1=[];_0xf515b1[_0x6f2d('0x57')]({'model':db[_0x6f2d('0x58')],'as':_0x6f2d('0x58'),'raw':!![]});var _0x56d31e=[{'model':db[_0x6f2d('0x39')],'as':_0x6f2d('0x59'),'attributes':['id',_0x6f2d('0x35'),_0x6f2d('0x5a')],'include':_0xf515b1}];return db[_0x6f2d('0x28')][_0x6f2d('0x33')]({'where':{'id':_0x28439a[_0x6f2d('0x27')]['id']},'include':_0x56d31e})[_0x6f2d('0x17')](handleEntityNotFound(_0x4d781b,null))[_0x6f2d('0x17')](function(_0x245262){if(_0x245262&&_0x245262[_0x6f2d('0x59')]){var _0x5eb787=_0x245262[_0x6f2d('0x5b')]({'plain':!![]});fs['mkdirSync'](_0x451b72);for(var _0x10a444=0x0;_0x10a444<_0x5eb787[_0x6f2d('0x59')][_0x6f2d('0x2f')];_0x10a444++){var _0x3d8290=_0x5eb787[_0x6f2d('0x59')][_0x10a444][_0x6f2d('0x58')];if(_0x3d8290){var _0x2476c3=path[_0x6f2d('0x51')](_0x4ebed9,_0x3d8290[_0x6f2d('0x5c')]);if(fs[_0x6f2d('0x5d')](_0x2476c3)){fs['createReadStream'](_0x2476c3)[_0x6f2d('0x5e')](fs[_0x6f2d('0x5f')](path[_0x6f2d('0x51')](_0x451b72,_0x3d8290['basename'])));}}}return BPromise[_0x6f2d('0x60')]()[_0x6f2d('0x17')](function(){return new BPromise(function(_0x29c0e1,_0x1e4f9a){zipdir(_0x451b72,{'saveTo':_0x3fc0e9},function(_0x241705,_0x4605bb){if(_0x241705)return _0x1e4f9a(_0x241705);return _0x29c0e1(_0x4605bb);});})[_0x6f2d('0x17')](function(){return new BPromise(function(_0x2a0e88,_0x116ed1){rimraf(_0x451b72,function(_0x424e98){if(_0x424e98)_0x116ed1(_0x424e98);return _0x2a0e88();});});})[_0x6f2d('0x17')](function(){return _0x4d781b[_0x6f2d('0x61')](_0x3fc0e9,_0x54fdb5,function(_0x6b1593){if(_0x6b1593){console['log'](_0x6f2d('0x62'),_0x6b1593);}else{fs['unlinkSync'](_0x3fc0e9);}});});});}else{return _0x4d781b[_0x6f2d('0x63')](0xc8);}})[_0x6f2d('0x25')](handleError(_0x4d781b,null));}; \ No newline at end of file +var _0x4c38=['log','err','sendStatus','zip-dir','moment','bluebird','util','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./faxInteraction.socket','register','status','end','json','offset','undefined','limit','count','set','Content-Range','update','destroy','then','error','stack','name','send','index','FaxInteraction','rawAttributes','type','key','catch','show','params','model','keys','query','intersection','attributes','fields','length','include','find','create','body','describe','addMessage','FaxMessage','ids','findOne','filters','nolimit','order','sort','where','pick','FaxInteractionId','filter','merge','map','$gte','split','format','options','includeAll','rows','addTags','setTags','omit','Tag','findAll','color','emit','faxInteractionTags:save','removeTags','toString','join','root','server','files','attachments','transcript-%d-%s.zip','push','Attachment','createdAt','get','mkdirSync','Messages','existsSync','createReadStream','pipe','createWriteStream','basename','resolve','download'];(function(_0x5ecadc,_0x1cf9f1){var _0x565037=function(_0x22908b){while(--_0x22908b){_0x5ecadc['push'](_0x5ecadc['shift']());}};_0x565037(++_0x1cf9f1);}(_0x4c38,0x13b));var _0x84c3=function(_0x20025e,_0x44c8e1){_0x20025e=_0x20025e-0x0;var _0x4a5ac4=_0x4c38[_0x20025e];return _0x4a5ac4;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0x84c3('0x0'));var moment=require(_0x84c3('0x1'));var BPromise=require(_0x84c3('0x2'));var util=require(_0x84c3('0x3'));var path=require('path');var fs=require('fs');var _=require('lodash');var Redis=require(_0x84c3('0x4'));var interaction=require('../../components/interaction/service');var qs=require(_0x84c3('0x5'));var logger=require(_0x84c3('0x6'))(_0x84c3('0x7'));var config=require(_0x84c3('0x8'));var db=require(_0x84c3('0x9'))['db'];config['redis']=_[_0x84c3('0xa')](config[_0x84c3('0xb')],{'host':_0x84c3('0xc'),'port':0x18eb});var socket=require(_0x84c3('0xd'))(new Redis(config[_0x84c3('0xb')]));require(_0x84c3('0xe'))[_0x84c3('0xf')](socket);function respondWithStatusCode(_0xe89d1,_0x46639d){_0x46639d=_0x46639d||0xcc;return function(_0x59d33b){if(_0x59d33b){return _0xe89d1['sendStatus'](_0x46639d);}return _0xe89d1[_0x84c3('0x10')](_0x46639d)[_0x84c3('0x11')]();};}function respondWithResult(_0x137578,_0x182dd9){_0x182dd9=_0x182dd9||0xc8;return function(_0x51d360){if(_0x51d360){return _0x137578[_0x84c3('0x10')](_0x182dd9)[_0x84c3('0x12')](_0x51d360);}};}function respondWithFilteredResult(_0x12ffcd,_0x4bf401){return function(_0x5acc96){if(_0x5acc96){var _0x37fe2a=typeof _0x4bf401[_0x84c3('0x13')]===_0x84c3('0x14')&&typeof _0x4bf401[_0x84c3('0x15')]===_0x84c3('0x14');var _0x1d511e=_0x5acc96[_0x84c3('0x16')];var _0x2db34a=_0x37fe2a?0x0:_0x4bf401[_0x84c3('0x13')];var _0x4db3d0=_0x37fe2a?_0x5acc96[_0x84c3('0x16')]:_0x4bf401['offset']+_0x4bf401[_0x84c3('0x15')];var _0x248778;if(_0x4db3d0>=_0x1d511e){_0x4db3d0=_0x1d511e;_0x248778=0xc8;}else{_0x248778=0xce;}_0x12ffcd[_0x84c3('0x10')](_0x248778);return _0x12ffcd[_0x84c3('0x17')](_0x84c3('0x18'),_0x2db34a+'-'+_0x4db3d0+'/'+_0x1d511e)[_0x84c3('0x12')](_0x5acc96);}return null;};}function saveUpdates(_0x51db99){return function(_0x4cdd77){if(_0x4cdd77){return _0x4cdd77[_0x84c3('0x19')](_0x51db99)['then'](function(_0x5745ad){return _0x5745ad;});}return null;};}function removeEntity(_0x2d6b7e){return function(_0x1a92ea){if(_0x1a92ea){return _0x1a92ea[_0x84c3('0x1a')]()[_0x84c3('0x1b')](function(){_0x2d6b7e[_0x84c3('0x10')](0xcc)[_0x84c3('0x11')]();});}};}function handleEntityNotFound(_0x58e44e){return function(_0x203424){if(!_0x203424){_0x58e44e['sendStatus'](0x194);}return _0x203424;};}function handleError(_0x62f551,_0x51501f){_0x51501f=_0x51501f||0x1f4;return function(_0x226ddb){logger[_0x84c3('0x1c')](_0x226ddb[_0x84c3('0x1d')]);if(_0x226ddb[_0x84c3('0x1e')]){delete _0x226ddb['name'];}_0x62f551[_0x84c3('0x10')](_0x51501f)[_0x84c3('0x1f')](_0x226ddb);};}exports[_0x84c3('0x20')]=function(_0x5245d2,_0x557624){var _0x39b5ca={};var _0x3a23c4=_['map'](db[_0x84c3('0x21')][_0x84c3('0x22')],function(_0x2241e3){return{'name':_0x2241e3['fieldName'],'type':_0x2241e3[_0x84c3('0x23')][_0x84c3('0x24')]};});_0x39b5ca=qs['getOptions'](_0x3a23c4,_0x5245d2);return interaction['findAll']('fax',_0x5245d2['query'],_0x5245d2['user'],_0x39b5ca,_0x3a23c4)[_0x84c3('0x1b')](respondWithFilteredResult(_0x557624,_0x39b5ca))[_0x84c3('0x25')](handleError(_0x557624,null));};exports[_0x84c3('0x26')]=function(_0x5d7630,_0x257980){var _0x36bb7f={'raw':![],'where':{'id':_0x5d7630[_0x84c3('0x27')]['id']}},_0x57e04d={};_0x57e04d[_0x84c3('0x28')]=_[_0x84c3('0x29')](db['FaxInteraction'][_0x84c3('0x22')]);_0x57e04d[_0x84c3('0x2a')]=_[_0x84c3('0x29')](_0x5d7630[_0x84c3('0x2a')]);_0x57e04d['filters']=_[_0x84c3('0x2b')](_0x57e04d[_0x84c3('0x28')],_0x57e04d[_0x84c3('0x2a')]);_0x36bb7f[_0x84c3('0x2c')]=_[_0x84c3('0x2b')](_0x57e04d[_0x84c3('0x28')],qs[_0x84c3('0x2d')](_0x5d7630[_0x84c3('0x2a')][_0x84c3('0x2d')]));_0x36bb7f[_0x84c3('0x2c')]=_0x36bb7f['attributes'][_0x84c3('0x2e')]?_0x36bb7f[_0x84c3('0x2c')]:_0x57e04d[_0x84c3('0x28')];if(_0x5d7630[_0x84c3('0x2a')]['includeAll']){_0x36bb7f[_0x84c3('0x2f')]=[{'all':!![]}];}_0x36bb7f=_['merge']({},_0x36bb7f,_0x5d7630['options']);return db[_0x84c3('0x21')][_0x84c3('0x30')](_0x36bb7f)['then'](handleEntityNotFound(_0x257980,null))[_0x84c3('0x1b')](respondWithResult(_0x257980,null))['catch'](handleError(_0x257980,null));};exports['create']=function(_0x42133f,_0x4cf9d3){return db[_0x84c3('0x21')][_0x84c3('0x31')](_0x42133f['body'],{})[_0x84c3('0x1b')](respondWithResult(_0x4cf9d3,0xc9))['catch'](handleError(_0x4cf9d3,null));};exports['update']=function(_0x1ba93d,_0x41b226){if(_0x1ba93d[_0x84c3('0x32')]['id']){delete _0x1ba93d[_0x84c3('0x32')]['id'];}return db[_0x84c3('0x21')][_0x84c3('0x30')]({'where':{'id':_0x1ba93d[_0x84c3('0x27')]['id']}})[_0x84c3('0x1b')](handleEntityNotFound(_0x41b226,null))[_0x84c3('0x1b')](saveUpdates(_0x1ba93d[_0x84c3('0x32')],null))[_0x84c3('0x1b')](respondWithResult(_0x41b226,null))[_0x84c3('0x25')](handleError(_0x41b226,null));};exports[_0x84c3('0x1a')]=function(_0x5c5f2b,_0x4dc0e8){return db[_0x84c3('0x21')][_0x84c3('0x30')]({'where':{'id':_0x5c5f2b[_0x84c3('0x27')]['id']}})['then'](handleEntityNotFound(_0x4dc0e8,null))['then'](removeEntity(_0x4dc0e8,null))[_0x84c3('0x25')](handleError(_0x4dc0e8,null));};exports[_0x84c3('0x33')]=function(_0x3c9d88,_0x789f7){return db[_0x84c3('0x21')][_0x84c3('0x33')]()[_0x84c3('0x1b')](respondWithResult(_0x789f7,null))[_0x84c3('0x25')](handleError(_0x789f7,null));};exports[_0x84c3('0x34')]=function(_0x188e32,_0x2f0758){return db[_0x84c3('0x35')][_0x84c3('0x30')]({'where':{'id':_0x188e32[_0x84c3('0x27')]['id']}})[_0x84c3('0x1b')](handleEntityNotFound(_0x2f0758,null))['then'](function(_0x50a27b){if(_0x50a27b){return _0x50a27b[_0x84c3('0x34')](_0x188e32['body'][_0x84c3('0x36')],_['omit'](_0x188e32[_0x84c3('0x32')],[_0x84c3('0x36'),'id'])||{});}})[_0x84c3('0x1b')](respondWithResult(_0x2f0758,null))[_0x84c3('0x25')](handleError(_0x2f0758,null));};exports['getMessages']=function(_0x2f6d00,_0x23236a){var _0x497bc1={'raw':![],'where':{}};var _0x2ce0e7={};var _0x2037f5={'count':0x0,'rows':[]};return db['FaxInteraction'][_0x84c3('0x37')]({'where':{'id':_0x2f6d00['params']['id']}})[_0x84c3('0x1b')](handleEntityNotFound(_0x23236a,null))[_0x84c3('0x1b')](function(_0x257ae4){if(_0x257ae4){_0x2ce0e7['model']=_[_0x84c3('0x29')](db['FaxMessage'][_0x84c3('0x22')]);_0x2ce0e7[_0x84c3('0x2a')]=_['keys'](_0x2f6d00['query']);_0x2ce0e7[_0x84c3('0x38')]=_[_0x84c3('0x2b')](_0x2ce0e7['model'],_0x2ce0e7[_0x84c3('0x2a')]);_0x497bc1['attributes']=_[_0x84c3('0x2b')](_0x2ce0e7[_0x84c3('0x28')],qs[_0x84c3('0x2d')](_0x2f6d00['query']['fields']));_0x497bc1[_0x84c3('0x2c')]=_0x497bc1[_0x84c3('0x2c')][_0x84c3('0x2e')]?_0x497bc1['attributes']:_0x2ce0e7[_0x84c3('0x28')];if(!_0x2f6d00[_0x84c3('0x2a')]['hasOwnProperty'](_0x84c3('0x39'))){_0x497bc1['limit']=qs[_0x84c3('0x15')](_0x2f6d00[_0x84c3('0x2a')][_0x84c3('0x15')]);_0x497bc1['offset']=qs[_0x84c3('0x13')](_0x2f6d00['query']['offset']);}_0x497bc1[_0x84c3('0x3a')]=qs[_0x84c3('0x3b')](_0x2f6d00[_0x84c3('0x2a')]['sort']);_0x497bc1[_0x84c3('0x3c')]=qs['filters'](_[_0x84c3('0x3d')](_0x2f6d00['query'],_0x2ce0e7['filters']));_0x497bc1[_0x84c3('0x3c')][_0x84c3('0x3e')]=_0x257ae4['id'];if(_0x2f6d00['query'][_0x84c3('0x3f')]){_0x497bc1[_0x84c3('0x3c')]=_[_0x84c3('0x40')](_0x497bc1[_0x84c3('0x3c')],{'$or':_[_0x84c3('0x41')](_0x497bc1[_0x84c3('0x2c')],function(_0x598111){var _0x3e4f36={};_0x3e4f36[_0x598111]={'$like':'%'+_0x2f6d00[_0x84c3('0x2a')]['filter']+'%'};return _0x3e4f36;})});}if(_0x2f6d00[_0x84c3('0x2a')][_0x84c3('0x42')]){var _0x21cfd6=_0x2f6d00[_0x84c3('0x2a')]['$gte'][_0x84c3('0x43')](',');var _0x454239={};_0x454239[_0x21cfd6[0x0]]={'$gte':moment(_0x21cfd6[0x1])[_0x84c3('0x44')]('YYYY-MM-DD\x20HH:mm:ss')};_0x497bc1['where']=_[_0x84c3('0x40')](_0x497bc1[_0x84c3('0x3c')],_0x454239);}_0x497bc1=_[_0x84c3('0x40')]({},_0x497bc1,_0x2f6d00[_0x84c3('0x45')]);return db['FaxMessage'][_0x84c3('0x16')]({'where':_0x497bc1['where']})[_0x84c3('0x1b')](function(_0xd3bc89){_0x2037f5[_0x84c3('0x16')]=_0xd3bc89;if(_0x2f6d00[_0x84c3('0x2a')][_0x84c3('0x46')]){_0x497bc1[_0x84c3('0x2f')]=[{'all':!![]}];}return db['FaxMessage']['findAll'](_0x497bc1);})[_0x84c3('0x1b')](function(_0x564ee0){_0x2037f5[_0x84c3('0x47')]=_0x564ee0;return _0x2037f5;});}})['then'](respondWithFilteredResult(_0x23236a,_0x497bc1))[_0x84c3('0x25')](handleError(_0x23236a,null));};exports[_0x84c3('0x48')]=function(_0xe241e3,_0x41cb11){return db[_0x84c3('0x21')][_0x84c3('0x30')]({'where':{'id':_0xe241e3[_0x84c3('0x27')]['id']}})['then'](handleEntityNotFound(_0x41cb11,null))[_0x84c3('0x1b')](function(_0x1f9b96){if(_0x1f9b96){return _0x1f9b96[_0x84c3('0x49')](_0xe241e3['body']['ids'],_[_0x84c3('0x4a')](_0xe241e3[_0x84c3('0x32')],['ids','id'])||{})['spread'](function(){return db[_0x84c3('0x4b')][_0x84c3('0x4c')]({'attributes':['id',_0x84c3('0x1e'),_0x84c3('0x4d')],'where':{'id':_0xe241e3[_0x84c3('0x32')][_0x84c3('0x36')]}});})[_0x84c3('0x1b')](function(_0x35c187){socket[_0x84c3('0x4e')](_0x84c3('0x4f'),{'id':Number(_0xe241e3[_0x84c3('0x27')]['id']),'tags':_0x35c187||[]});return{'id':Number(_0xe241e3['params']['id']),'tags':_0x35c187||[]};});}})[_0x84c3('0x1b')](respondWithResult(_0x41cb11,null))[_0x84c3('0x25')](handleError(_0x41cb11,null));};exports[_0x84c3('0x50')]=function(_0x2eb148,_0x238643){return db[_0x84c3('0x21')][_0x84c3('0x30')]({'where':{'id':_0x2eb148['params']['id']}})['then'](handleEntityNotFound(_0x238643,null))[_0x84c3('0x1b')](function(_0x2fa5e2){if(_0x2fa5e2){return _0x2fa5e2[_0x84c3('0x50')](_0x2eb148[_0x84c3('0x2a')][_0x84c3('0x36')]);}})[_0x84c3('0x1b')](respondWithStatusCode(_0x238643,null))[_0x84c3('0x25')](handleError(_0x238643,null));};exports['download']=function(_0x3390db,_0x33e447){var _0x5fd841=moment()['unix']()[_0x84c3('0x51')]();var _0x33d882=path[_0x84c3('0x52')](config[_0x84c3('0x53')],_0x84c3('0x54'),'files','tmp');var _0x1e755f=path['join'](config['root'],'server',_0x84c3('0x55'),_0x84c3('0x56'));var _0x48e12f=path[_0x84c3('0x52')](_0x33d882,_0x5fd841);var _0x1d1ff0=util[_0x84c3('0x44')](_0x84c3('0x57'),_0x3390db[_0x84c3('0x27')]['id'],_0x5fd841);var _0x19ce5b=path[_0x84c3('0x52')](_0x33d882,_0x1d1ff0);var _0x4621bf=[];_0x4621bf[_0x84c3('0x58')]({'model':db['Attachment'],'as':_0x84c3('0x59'),'raw':!![]});var _0x5387ec=[{'model':db['FaxMessage'],'as':'Messages','attributes':['id',_0x84c3('0x32'),_0x84c3('0x5a')],'include':_0x4621bf}];return db[_0x84c3('0x21')][_0x84c3('0x30')]({'where':{'id':_0x3390db[_0x84c3('0x27')]['id']},'include':_0x5387ec})[_0x84c3('0x1b')](handleEntityNotFound(_0x33e447,null))[_0x84c3('0x1b')](function(_0xcc1189){if(_0xcc1189&&_0xcc1189['Messages']){var _0x462fc6=_0xcc1189[_0x84c3('0x5b')]({'plain':!![]});fs[_0x84c3('0x5c')](_0x48e12f);for(var _0x13dc16=0x0;_0x13dc16<_0x462fc6[_0x84c3('0x5d')][_0x84c3('0x2e')];_0x13dc16++){var _0x576486=_0x462fc6[_0x84c3('0x5d')][_0x13dc16]['Attachment'];if(_0x576486){var _0x37f343=path[_0x84c3('0x52')](_0x1e755f,_0x576486['basename']);if(fs[_0x84c3('0x5e')](_0x37f343)){fs[_0x84c3('0x5f')](_0x37f343)[_0x84c3('0x60')](fs[_0x84c3('0x61')](path[_0x84c3('0x52')](_0x48e12f,_0x576486[_0x84c3('0x62')])));}}}return BPromise[_0x84c3('0x63')]()['then'](function(){return new BPromise(function(_0x4dbcde,_0x4bc604){zipdir(_0x48e12f,{'saveTo':_0x19ce5b},function(_0x1c2f79,_0x3d6a2d){if(_0x1c2f79)return _0x4bc604(_0x1c2f79);return _0x4dbcde(_0x3d6a2d);});})[_0x84c3('0x1b')](function(){return new BPromise(function(_0x4d7b7a,_0x3cb3f5){rimraf(_0x48e12f,function(_0x60759d){if(_0x60759d)_0x3cb3f5(_0x60759d);return _0x4d7b7a();});});})[_0x84c3('0x1b')](function(){return _0x33e447[_0x84c3('0x64')](_0x19ce5b,_0x1d1ff0,function(_0x5e6f06){if(_0x5e6f06){console[_0x84c3('0x65')](_0x84c3('0x66'),_0x5e6f06);}else{fs['unlinkSync'](_0x19ce5b);}});});});}else{return _0x33e447[_0x84c3('0x67')](0xc8);}})[_0x84c3('0x25')](handleError(_0x33e447,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index 54041aa..7b043c3 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 _0x94c8=['FaxInteraction','FaxMessage','setMaxListeners','save','update','remove','then','Users','map','findAll','setDataValue','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','../../mysqldb'];(function(_0x42d1cc,_0x515c4a){var _0x1adc04=function(_0x478195){while(--_0x478195){_0x42d1cc['push'](_0x42d1cc['shift']());}};_0x1adc04(++_0x515c4a);}(_0x94c8,0x1a1));var _0x894c=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x94c8[_0x2641f9];return _0x585741;};'use strict';var EventEmitter=require('events');var FaxInteraction=require(_0x894c('0x0'))['db'][_0x894c('0x1')];var FaxMessage=require('../../mysqldb')['db'][_0x894c('0x2')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x894c('0x3')](0x0);var events={'afterCreate':_0x894c('0x4'),'afterUpdate':_0x894c('0x5'),'afterDestroy':_0x894c('0x6')};function emitEvent(_0x3ce47c){return function(_0x3dc143,_0x4671a4,_0x21c12a){_0x3dc143['getUsers']({'attributes':['id'],'raw':!![]})[_0x894c('0x7')](function(_0x10007b){_0x3dc143['setDataValue'](_0x894c('0x8'),_0x10007b[_0x894c('0x9')](function(_0x41a12a){return{'id':_0x41a12a['id']};}));return FaxMessage[_0x894c('0xa')]({'where':{'FaxInteractionId':_0x3dc143['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x520c79){_0x3dc143[_0x894c('0xb')](_0x894c('0xc'),_0x520c79[_0x894c('0xd')]);FaxInteractionEvents[_0x894c('0xe')](_0x3ce47c+':'+_0x3dc143['id'],_0x3dc143);FaxInteractionEvents[_0x894c('0xe')](_0x3ce47c,_0x3dc143);_0x21c12a(null);})[_0x894c('0xf')](_0x21c12a(null));};}for(var e in events){if(events[_0x894c('0x10')](e)){var event=events[e];FaxInteraction[_0x894c('0x11')](e,emitEvent(event));}}module[_0x894c('0x12')]=FaxInteractionEvents; \ No newline at end of file +var _0x2416=['events','FaxInteraction','../../mysqldb','FaxMessage','setMaxListeners','save','update','remove','getUsers','then','setDataValue','Users','findAll','length','emit','hasOwnProperty','exports'];(function(_0x2c0be1,_0x1e88f2){var _0x3d4bd2=function(_0x2b5497){while(--_0x2b5497){_0x2c0be1['push'](_0x2c0be1['shift']());}};_0x3d4bd2(++_0x1e88f2);}(_0x2416,0xdd));var _0x6241=function(_0x1c10a6,_0x31caac){_0x1c10a6=_0x1c10a6-0x0;var _0x59b95c=_0x2416[_0x1c10a6];return _0x59b95c;};'use strict';var EventEmitter=require(_0x6241('0x0'));var FaxInteraction=require('../../mysqldb')['db'][_0x6241('0x1')];var FaxMessage=require(_0x6241('0x2'))['db'][_0x6241('0x3')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x6241('0x4')](0x0);var events={'afterCreate':_0x6241('0x5'),'afterUpdate':_0x6241('0x6'),'afterDestroy':_0x6241('0x7')};function emitEvent(_0x914da9){return function(_0x934053,_0x458872,_0x402049){_0x934053[_0x6241('0x8')]({'attributes':['id'],'raw':!![]})[_0x6241('0x9')](function(_0x41c3f6){_0x934053[_0x6241('0xa')](_0x6241('0xb'),_0x41c3f6['map'](function(_0x302e85){return{'id':_0x302e85['id']};}));return FaxMessage[_0x6241('0xc')]({'where':{'FaxInteractionId':_0x934053['id'],'direction':'in','read':![]},'raw':!![]});})[_0x6241('0x9')](function(_0xcfe6d2){_0x934053['setDataValue']('unreadMessages',_0xcfe6d2[_0x6241('0xd')]);FaxInteractionEvents[_0x6241('0xe')](_0x914da9+':'+_0x934053['id'],_0x934053);FaxInteractionEvents[_0x6241('0xe')](_0x914da9,_0x934053);_0x402049(null);})['catch'](_0x402049(null));};}for(var e in events){if(events[_0x6241('0xf')](e)){var event=events[e];FaxInteraction['hook'](e,emitEvent(event));}}module[_0x6241('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 ca0101a..d3c029f 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 _0x6931=['path','../../config/environment','./faxInteraction.attributes','exports','FaxInteraction','fax_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x2ec461,_0x5f588a){var _0x28603d=function(_0x21114b){while(--_0x21114b){_0x2ec461['push'](_0x2ec461['shift']());}};_0x28603d(++_0x5f588a);}(_0x6931,0x1a9));var _0x1693=function(_0x5d6c60,_0x45334e){_0x5d6c60=_0x5d6c60-0x0;var _0x85c104=_0x6931[_0x5d6c60];return _0x85c104;};'use strict';var _=require(_0x1693('0x0'));var util=require(_0x1693('0x1'));var logger=require(_0x1693('0x2'))(_0x1693('0x3'));var moment=require(_0x1693('0x4'));var BPromise=require(_0x1693('0x5'));var rp=require(_0x1693('0x6'));var fs=require('fs');var path=require(_0x1693('0x7'));var rimraf=require('rimraf');var config=require(_0x1693('0x8'));var attributes=require(_0x1693('0x9'));module[_0x1693('0xa')]=function(_0x455646,_0x379d6c){return _0x455646['define'](_0x1693('0xb'),attributes,{'tableName':_0x1693('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x18e32e,_0x579434,_0xc66466){if(_0x18e32e[_0x1693('0xd')](_0x1693('0xe'))){_0x18e32e[_0x1693('0xf')]=moment()[_0x1693('0x10')](_0x1693('0x11'));}_0xc66466(null,_0x18e32e);}}});}; \ No newline at end of file +var _0x3d3d=['path','rimraf','../../config/environment','./faxInteraction.attributes','exports','FaxInteraction','fax_interactions','changed','closed','closedAt','format','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x2a9212,_0x25b0b6){var _0xefda72=function(_0x7b6286){while(--_0x7b6286){_0x2a9212['push'](_0x2a9212['shift']());}};_0xefda72(++_0x25b0b6);}(_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 logger=require(_0xd3d3('0x1'))('api');var moment=require(_0xd3d3('0x2'));var BPromise=require(_0xd3d3('0x3'));var rp=require(_0xd3d3('0x4'));var fs=require('fs');var path=require(_0xd3d3('0x5'));var rimraf=require(_0xd3d3('0x6'));var config=require(_0xd3d3('0x7'));var attributes=require(_0xd3d3('0x8'));module[_0xd3d3('0x9')]=function(_0x2d36ba,_0x1e9338){return _0x2d36ba['define'](_0xd3d3('0xa'),attributes,{'tableName':_0xd3d3('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3fe58e,_0x2ed96f,_0x578050){if(_0x3fe58e[_0xd3d3('0xc')](_0xd3d3('0xd'))){_0x3fe58e[_0xd3d3('0xe')]=moment()[_0xd3d3('0xf')]('YYYY-MM-DD\x20HH:mm:ss');}_0x578050(null,_0x3fe58e);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index 0dcc29b..019a5dc 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 _0x99ea=['message','result','catch','UpdateFaxInteraction','FaxInteraction','options','raw','where','attributes','limit','addTags','body','ids','omit','AddTags','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','localhost','socket.io-emitter','request','then','info','FaxInteraction,\x20%s,\x20%s','request\x20sent','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x24ac7c,_0x111c73){var _0x4b4413=function(_0x47f9bb){while(--_0x47f9bb){_0x24ac7c['push'](_0x24ac7c['shift']());}};_0x4b4413(++_0x111c73);}(_0x99ea,0x1d7));var _0xa99e=function(_0xc69f39,_0x2ce0cf){_0xc69f39=_0xc69f39-0x0;var _0x93be41=_0x99ea[_0xc69f39];return _0x93be41;};'use strict';var _=require('lodash');var util=require(_0xa99e('0x0'));var moment=require('moment');var BPromise=require(_0xa99e('0x1'));var rs=require(_0xa99e('0x2'));var fs=require('fs');var Redis=require(_0xa99e('0x3'));var db=require(_0xa99e('0x4'))['db'];var utils=require(_0xa99e('0x5'));var logger=require(_0xa99e('0x6'))(_0xa99e('0x7'));var config=require(_0xa99e('0x8'));var jayson=require(_0xa99e('0x9'));var client=jayson[_0xa99e('0xa')]['http']({'port':0x232a});config['redis']=_['defaults'](config[_0xa99e('0xb')],{'host':_0xa99e('0xc'),'port':0x18eb});var socket=require(_0xa99e('0xd'))(new Redis(config[_0xa99e('0xb')]));require('./faxInteraction.socket')['register'](socket);function respondWithRpcPromise(_0xea8b33,_0xe902c5,_0x465898){return new BPromise(function(_0x14a6fa,_0xe3fd72){return client[_0xa99e('0xe')](_0xea8b33,_0x465898)[_0xa99e('0xf')](function(_0x5a9f5c){logger[_0xa99e('0x10')](_0xa99e('0x11'),_0xe902c5,_0xa99e('0x12'));logger[_0xa99e('0x13')](_0xa99e('0x14'),_0xe902c5,_0xa99e('0x12'),JSON[_0xa99e('0x15')](_0x5a9f5c));if(_0x5a9f5c[_0xa99e('0x16')]){if(_0x5a9f5c[_0xa99e('0x16')]['code']===0x1f4){logger['error'](_0xa99e('0x11'),_0xe902c5,_0x5a9f5c[_0xa99e('0x16')][_0xa99e('0x17')]);return _0xe3fd72(_0x5a9f5c[_0xa99e('0x16')][_0xa99e('0x17')]);}logger['error'](_0xa99e('0x11'),_0xe902c5,_0x5a9f5c[_0xa99e('0x16')]['message']);return _0x14a6fa(_0x5a9f5c[_0xa99e('0x16')][_0xa99e('0x17')]);}else{logger['info'](_0xa99e('0x11'),_0xe902c5,'request\x20sent');_0x14a6fa(_0x5a9f5c[_0xa99e('0x18')][_0xa99e('0x17')]);}})[_0xa99e('0x19')](function(_0x4395bb){logger[_0xa99e('0x16')](_0xa99e('0x11'),_0xe902c5,_0x4395bb);_0xe3fd72(_0x4395bb);});});}exports[_0xa99e('0x1a')]=function(_0x17304f){var _0x12a920=this;return new Promise(function(_0x3f5cb7,_0x34d4d6){return db[_0xa99e('0x1b')]['update'](_0x17304f['body'],{'raw':_0x17304f['options']?_0x17304f[_0xa99e('0x1c')][_0xa99e('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x17304f[_0xa99e('0x1c')]?_0x17304f[_0xa99e('0x1c')][_0xa99e('0x1e')]||null:null,'attributes':_0x17304f[_0xa99e('0x1c')]?_0x17304f['options'][_0xa99e('0x1f')]||null:null,'limit':_0x17304f[_0xa99e('0x1c')]?_0x17304f['options'][_0xa99e('0x20')]||null:null})['then'](function(_0x4eaabe){logger['info']('UpdateFaxInteraction',_0x17304f);logger['debug'](_0xa99e('0x1a'),_0x17304f,JSON[_0xa99e('0x15')](_0x4eaabe));_0x3f5cb7(_0x4eaabe);})[_0xa99e('0x19')](function(_0x4b4eb9){logger[_0xa99e('0x16')](_0xa99e('0x1a'),_0x4b4eb9['message'],_0x17304f);_0x34d4d6(_0x12a920[_0xa99e('0x16')](0x1f4,_0x4b4eb9[_0xa99e('0x17')]));});});};exports['AddTagsToFaxInteraction']=function(_0x2b76a2){return new Promise(function(_0x304eed,_0x372c4d){return db[_0xa99e('0x1b')]['find']({'where':_0x2b76a2[_0xa99e('0x1c')]?_0x2b76a2[_0xa99e('0x1c')][_0xa99e('0x1e')]||null:null})[_0xa99e('0xf')](function(_0x26e016){if(_0x26e016){return _0x26e016[_0xa99e('0x21')](_0x2b76a2[_0xa99e('0x22')][_0xa99e('0x23')],_[_0xa99e('0x24')](_0x2b76a2['body'],[_0xa99e('0x23'),'id'])||{});}})['spread'](function(_0x397199){logger[_0xa99e('0x10')](_0xa99e('0x25'),_0x2b76a2);logger[_0xa99e('0x13')](_0xa99e('0x25'),_0x2b76a2,JSON[_0xa99e('0x15')](_0x397199));_0x304eed(_0x397199);})['catch'](function(_0x7397b2){logger['error'](_0xa99e('0x25'),_0x7397b2[_0xa99e('0x17')],_0x2b76a2);_0x372c4d(_this[_0xa99e('0x16')](0x1f4,_0x7397b2[_0xa99e('0x17')]));});});}; \ No newline at end of file +var _0xbd1e=['update','body','options','raw','where','limit','AddTagsToFaxInteraction','FaxInteraction','addTags','ids','omit','spread','AddTags','debug','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./faxInteraction.socket','register','then','info','request\x20sent','FaxInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxInteraction,\x20%s,\x20%s','message','result','catch','UpdateFaxInteraction'];(function(_0x225a53,_0x591ff9){var _0x36626c=function(_0x587bc7){while(--_0x587bc7){_0x225a53['push'](_0x225a53['shift']());}};_0x36626c(++_0x591ff9);}(_0xbd1e,0x1bc));var _0xebd1=function(_0x587dd0,_0x273922){_0x587dd0=_0x587dd0-0x0;var _0x56f153=_0xbd1e[_0x587dd0];return _0x56f153;};'use strict';var _=require('lodash');var util=require(_0xebd1('0x0'));var moment=require('moment');var BPromise=require(_0xebd1('0x1'));var rs=require(_0xebd1('0x2'));var fs=require('fs');var Redis=require(_0xebd1('0x3'));var db=require(_0xebd1('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xebd1('0x5'))(_0xebd1('0x6'));var config=require(_0xebd1('0x7'));var jayson=require(_0xebd1('0x8'));var client=jayson[_0xebd1('0x9')][_0xebd1('0xa')]({'port':0x232a});config[_0xebd1('0xb')]=_[_0xebd1('0xc')](config[_0xebd1('0xb')],{'host':_0xebd1('0xd'),'port':0x18eb});var socket=require(_0xebd1('0xe'))(new Redis(config[_0xebd1('0xb')]));require(_0xebd1('0xf'))[_0xebd1('0x10')](socket);function respondWithRpcPromise(_0x4f7677,_0x114e30,_0xcd9a5c){return new BPromise(function(_0x415b3d,_0x1da275){return client['request'](_0x4f7677,_0xcd9a5c)[_0xebd1('0x11')](function(_0x2ae775){logger[_0xebd1('0x12')]('FaxInteraction,\x20%s,\x20%s',_0x114e30,_0xebd1('0x13'));logger['debug'](_0xebd1('0x14'),_0x114e30,_0xebd1('0x13'),JSON[_0xebd1('0x15')](_0x2ae775));if(_0x2ae775[_0xebd1('0x16')]){if(_0x2ae775[_0xebd1('0x16')][_0xebd1('0x17')]===0x1f4){logger['error'](_0xebd1('0x18'),_0x114e30,_0x2ae775[_0xebd1('0x16')][_0xebd1('0x19')]);return _0x1da275(_0x2ae775[_0xebd1('0x16')][_0xebd1('0x19')]);}logger[_0xebd1('0x16')](_0xebd1('0x18'),_0x114e30,_0x2ae775[_0xebd1('0x16')][_0xebd1('0x19')]);return _0x415b3d(_0x2ae775['error']['message']);}else{logger[_0xebd1('0x12')](_0xebd1('0x18'),_0x114e30,_0xebd1('0x13'));_0x415b3d(_0x2ae775[_0xebd1('0x1a')][_0xebd1('0x19')]);}})[_0xebd1('0x1b')](function(_0xa5b8a0){logger[_0xebd1('0x16')](_0xebd1('0x18'),_0x114e30,_0xa5b8a0);_0x1da275(_0xa5b8a0);});});}exports[_0xebd1('0x1c')]=function(_0x261ec3){var _0x564676=this;return new Promise(function(_0x23d486,_0x3a3776){return db['FaxInteraction'][_0xebd1('0x1d')](_0x261ec3[_0xebd1('0x1e')],{'raw':_0x261ec3[_0xebd1('0x1f')]?_0x261ec3[_0xebd1('0x1f')][_0xebd1('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x261ec3['options']?_0x261ec3[_0xebd1('0x1f')][_0xebd1('0x21')]||null:null,'attributes':_0x261ec3[_0xebd1('0x1f')]?_0x261ec3[_0xebd1('0x1f')]['attributes']||null:null,'limit':_0x261ec3[_0xebd1('0x1f')]?_0x261ec3[_0xebd1('0x1f')][_0xebd1('0x22')]||null:null})['then'](function(_0x3ed286){logger[_0xebd1('0x12')](_0xebd1('0x1c'),_0x261ec3);logger['debug'](_0xebd1('0x1c'),_0x261ec3,JSON[_0xebd1('0x15')](_0x3ed286));_0x23d486(_0x3ed286);})[_0xebd1('0x1b')](function(_0x34f07e){logger[_0xebd1('0x16')](_0xebd1('0x1c'),_0x34f07e[_0xebd1('0x19')],_0x261ec3);_0x3a3776(_0x564676[_0xebd1('0x16')](0x1f4,_0x34f07e['message']));});});};exports[_0xebd1('0x23')]=function(_0x1086b2){return new Promise(function(_0x1db4b4,_0x3a290c){return db[_0xebd1('0x24')]['find']({'where':_0x1086b2[_0xebd1('0x1f')]?_0x1086b2['options']['where']||null:null})[_0xebd1('0x11')](function(_0x30e5be){if(_0x30e5be){return _0x30e5be[_0xebd1('0x25')](_0x1086b2['body'][_0xebd1('0x26')],_[_0xebd1('0x27')](_0x1086b2[_0xebd1('0x1e')],[_0xebd1('0x26'),'id'])||{});}})[_0xebd1('0x28')](function(_0x2a0f71){logger[_0xebd1('0x12')](_0xebd1('0x29'),_0x1086b2);logger[_0xebd1('0x2a')](_0xebd1('0x29'),_0x1086b2,JSON[_0xebd1('0x15')](_0x2a0f71));_0x1db4b4(_0x2a0f71);})[_0xebd1('0x1b')](function(_0x5cd969){logger[_0xebd1('0x16')](_0xebd1('0x29'),_0x5cd969[_0xebd1('0x19')],_0x1086b2);_0x3a290c(_this['error'](0x1f4,_0x5cd969[_0xebd1('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index 5c28419..4261076 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 _0x92d3=['removeListener','register','length','faxInteraction:','./faxInteraction.events','save','remove'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x92d3,0xcf));var _0x392d=function(_0x62c958,_0x2bfdbc){_0x62c958=_0x62c958-0x0;var _0x57ec61=_0x92d3[_0x62c958];return _0x57ec61;};'use strict';var FaxInteractionEvents=require(_0x392d('0x0'));var events=[_0x392d('0x1'),_0x392d('0x2'),'update'];function createListener(_0xd3554d,_0x291fd4){return function(_0x54d59c){_0x291fd4['emit'](_0xd3554d,_0x54d59c);};}function removeListener(_0xf072aa,_0x55c069){return function(){FaxInteractionEvents[_0x392d('0x3')](_0xf072aa,_0x55c069);};}exports[_0x392d('0x4')]=function(_0xc53413){for(var _0x4d9142=0x0,_0x1c9055=events[_0x392d('0x5')];_0x4d9142<_0x1c9055;_0x4d9142++){var _0x54455a=events[_0x4d9142];var _0x440074=createListener(_0x392d('0x6')+_0x54455a,_0xc53413);FaxInteractionEvents['on'](_0x54455a,_0x440074);}}; \ No newline at end of file +var _0x85ed=['save','update','emit','removeListener','register','length','faxInteraction:','./faxInteraction.events'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0x85ed,0x1df));var _0xd85e=function(_0x2a7b8e,_0x50ffce){_0x2a7b8e=_0x2a7b8e-0x0;var _0x29b5c8=_0x85ed[_0x2a7b8e];return _0x29b5c8;};'use strict';var FaxInteractionEvents=require(_0xd85e('0x0'));var events=[_0xd85e('0x1'),'remove',_0xd85e('0x2')];function createListener(_0x4e7d7b,_0x26f1a5){return function(_0x3fcadf){_0x26f1a5[_0xd85e('0x3')](_0x4e7d7b,_0x3fcadf);};}function removeListener(_0x52b7b4,_0x138055){return function(){FaxInteractionEvents[_0xd85e('0x4')](_0x52b7b4,_0x138055);};}exports[_0xd85e('0x5')]=function(_0x11573a){for(var _0x55ecbb=0x0,_0x178807=events[_0xd85e('0x6')];_0x55ecbb<_0x178807;_0x55ecbb++){var _0x12122d=events[_0x55ecbb];var _0x15a5f2=createListener(_0xd85e('0x7')+_0x12122d,_0x11573a);FaxInteractionEvents['on'](_0x12122d,_0x15a5f2);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index 72dd4f0..2b05a4c 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 _0x4c55=['fax','faxinteraction:addtags','addTags','put','faxinteraction:update','update','delete','faxinteraction:destroy','removeTags','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./faxInteraction.controller','isAuthenticated','/describe','describe','get','/:id','show','/:id/messages','getMessages','/:id/download','post','create','/:id/tags','tracked'];(function(_0x354422,_0x383c8f){var _0x411173=function(_0x3b5edf){while(--_0x3b5edf){_0x354422['push'](_0x354422['shift']());}};_0x411173(++_0x383c8f);}(_0x4c55,0xc4));var _0x54c5=function(_0xa9a245,_0x2a0387){_0xa9a245=_0xa9a245-0x0;var _0x2d0eaa=_0x4c55[_0xa9a245];return _0x2d0eaa;};'use strict';var multer=require(_0x54c5('0x0'));var util=require(_0x54c5('0x1'));var path=require(_0x54c5('0x2'));var timeout=require(_0x54c5('0x3'));var express=require('express');var router=express[_0x54c5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x54c5('0x5'));var interaction=require(_0x54c5('0x6'));var config=require('../../config/environment');var controller=require(_0x54c5('0x7'));router['get']('/',auth[_0x54c5('0x8')](),controller['index']);router['get'](_0x54c5('0x9'),auth[_0x54c5('0x8')](),controller[_0x54c5('0xa')]);router[_0x54c5('0xb')](_0x54c5('0xc'),auth[_0x54c5('0x8')](),controller[_0x54c5('0xd')]);router['get'](_0x54c5('0xe'),auth[_0x54c5('0x8')](),controller[_0x54c5('0xf')]);router[_0x54c5('0xb')](_0x54c5('0x10'),auth[_0x54c5('0x8')](),controller['download']);router[_0x54c5('0x11')]('/',auth[_0x54c5('0x8')](),controller[_0x54c5('0x12')]);router[_0x54c5('0x11')](_0x54c5('0xe'),auth[_0x54c5('0x8')](),controller['addMessage']);router['post'](_0x54c5('0x13'),auth['isAuthenticated'](),interaction[_0x54c5('0x14')](_0x54c5('0x15'),_0x54c5('0x16')),controller[_0x54c5('0x17')]);router[_0x54c5('0x18')](_0x54c5('0xc'),auth[_0x54c5('0x8')](),interaction[_0x54c5('0x14')]('fax',_0x54c5('0x19')),controller[_0x54c5('0x1a')]);router[_0x54c5('0x1b')](_0x54c5('0xc'),auth['isAuthenticated'](),interaction[_0x54c5('0x14')](_0x54c5('0x15'),_0x54c5('0x1c')),controller['destroy']);router[_0x54c5('0x1b')](_0x54c5('0x13'),auth[_0x54c5('0x8')](),controller[_0x54c5('0x1d')]);module[_0x54c5('0x1e')]=router; \ No newline at end of file +var _0xe0f0=['../../config/environment','./faxInteraction.controller','isAuthenticated','index','get','/describe','describe','/:id','show','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','fax','faxinteraction:addtags','addTags','put','tracked','faxinteraction:destroy','destroy','delete','/:id/tags','removeTags','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0xf71120,_0x25b7f9){var _0xbe2fd3=function(_0x1acbdd){while(--_0x1acbdd){_0xf71120['push'](_0xf71120['shift']());}};_0xbe2fd3(++_0x25b7f9);}(_0xe0f0,0x9e));var _0x0e0f=function(_0x17f4c8,_0x3aa345){_0x17f4c8=_0x17f4c8-0x0;var _0x288b47=_0xe0f0[_0x17f4c8];return _0x288b47;};'use strict';var multer=require(_0x0e0f('0x0'));var util=require(_0x0e0f('0x1'));var path=require('path');var timeout=require(_0x0e0f('0x2'));var express=require(_0x0e0f('0x3'));var router=express[_0x0e0f('0x4')]();var fs_extra=require(_0x0e0f('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0e0f('0x6'));var config=require(_0x0e0f('0x7'));var controller=require(_0x0e0f('0x8'));router['get']('/',auth[_0x0e0f('0x9')](),controller[_0x0e0f('0xa')]);router[_0x0e0f('0xb')](_0x0e0f('0xc'),auth['isAuthenticated'](),controller[_0x0e0f('0xd')]);router[_0x0e0f('0xb')](_0x0e0f('0xe'),auth[_0x0e0f('0x9')](),controller[_0x0e0f('0xf')]);router[_0x0e0f('0xb')](_0x0e0f('0x10'),auth[_0x0e0f('0x9')](),controller[_0x0e0f('0x11')]);router['get'](_0x0e0f('0x12'),auth[_0x0e0f('0x9')](),controller[_0x0e0f('0x13')]);router[_0x0e0f('0x14')]('/',auth[_0x0e0f('0x9')](),controller[_0x0e0f('0x15')]);router['post']('/:id/messages',auth[_0x0e0f('0x9')](),controller[_0x0e0f('0x16')]);router[_0x0e0f('0x14')]('/:id/tags',auth[_0x0e0f('0x9')](),interaction['tracked'](_0x0e0f('0x17'),_0x0e0f('0x18')),controller[_0x0e0f('0x19')]);router[_0x0e0f('0x1a')](_0x0e0f('0xe'),auth[_0x0e0f('0x9')](),interaction[_0x0e0f('0x1b')](_0x0e0f('0x17'),'faxinteraction:update'),controller['update']);router['delete'](_0x0e0f('0xe'),auth[_0x0e0f('0x9')](),interaction['tracked'](_0x0e0f('0x17'),_0x0e0f('0x1c')),controller[_0x0e0f('0x1d')]);router[_0x0e0f('0x1e')](_0x0e0f('0x1f'),auth['isAuthenticated'](),controller[_0x0e0f('0x20')]);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 fe51994..fb5a44c 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 _0x5455=['TEXT','medium','BOOLEAN','ENUM','out','exports'];(function(_0x23ec04,_0x3733c0){var _0x4e3285=function(_0x511275){while(--_0x511275){_0x23ec04['push'](_0x23ec04['shift']());}};_0x4e3285(++_0x3733c0);}(_0x5455,0x197));var _0x5545=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x5455[_0x4b369d];return _0x571a98;};'use strict';var Sequelize=require('sequelize');module[_0x5545('0x0')]={'body':{'type':Sequelize[_0x5545('0x1')](_0x5545('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x5545('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x5545('0x4')]('in',_0x5545('0x5')),'defaultValue':_0x5545('0x5'),'allowNull':![]},'failMessage':{'type':Sequelize['TEXT'],'defaultValue':null},'readAt':{'type':Sequelize['DATE']}}; \ No newline at end of file +var _0x8b7c=['DATE','sequelize','exports','TEXT','medium','BOOLEAN','ENUM','out'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x8b7c,0x119));var _0xc8b7=function(_0x2bf466,_0x4929a5){_0x2bf466=_0x2bf466-0x0;var _0x856885=_0x8b7c[_0x2bf466];return _0x856885;};'use strict';var Sequelize=require(_0xc8b7('0x0'));module[_0xc8b7('0x1')]={'body':{'type':Sequelize[_0xc8b7('0x2')](_0xc8b7('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xc8b7('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0xc8b7('0x5')]('in',_0xc8b7('0x6')),'defaultValue':_0xc8b7('0x6'),'allowNull':![]},'failMessage':{'type':Sequelize['TEXT'],'defaultValue':null},'readAt':{'type':Sequelize[_0xc8b7('0x7')]}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index 6bb6cfc..8d6584a 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 _0x29e9=['readAt','format','YYYY-MM-DD\x20HH:mm:ss','agent','UserId','FaxInteraction','FaxInteractionId','isNil','read1stAt','interaction','get','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','null','AcceptMessage','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','fullname','email','internal','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','fax-interactions','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','User','rejectmessage','create','CmContact','findOne','AttachmentId','SendFax','/var/opt/motion2/server/files/attachments/%s','basename','join','root','server','attachments','Attachment','download','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','client','http','request','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','offset','limit','undefined','count','set','reject','destroy','stack','name','send','index','map','FaxMessage','type','query','keys','filters','model','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','rawAttributes','update','body','find','describe','accept','fax','read'];(function(_0x55fcfe,_0x55fc30){var _0x170825=function(_0x11d637){while(--_0x11d637){_0x55fcfe['push'](_0x55fcfe['shift']());}};_0x170825(++_0x55fc30);}(_0x29e9,0x1de));var _0x929e=function(_0x20aa8f,_0x50ebe3){_0x20aa8f=_0x20aa8f-0x0;var _0x96ed1f=_0x29e9[_0x20aa8f];return _0x96ed1f;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x929e('0x0'));var rp=require(_0x929e('0x1'));var moment=require(_0x929e('0x2'));var BPromise=require(_0x929e('0x3'));var Mustache=require(_0x929e('0x4'));var util=require(_0x929e('0x5'));var path=require('path');var sox=require(_0x929e('0x6'));var csv=require(_0x929e('0x7'));var ejs=require(_0x929e('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x929e('0x9'));var squel=require(_0x929e('0xa'));var crypto=require(_0x929e('0xb'));var jsforce=require(_0x929e('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x929e('0xd'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x929e('0xe'));var hardwareService=require(_0x929e('0xf'));var logger=require(_0x929e('0x10'))(_0x929e('0x11'));var utils=require(_0x929e('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x929e('0x13'));var db=require(_0x929e('0x14'))['db'];config[_0x929e('0x15')]=_[_0x929e('0x16')](config['redis'],{'host':_0x929e('0x17'),'port':0x18eb});var socket=require(_0x929e('0x18'))(new Redis(config[_0x929e('0x15')]));require('./faxMessage.socket')[_0x929e('0x19')](socket);var jayson=require(_0x929e('0x1a'));var client=jayson[_0x929e('0x1b')][_0x929e('0x1c')]({'port':0x232c});var client9002=jayson['client'][_0x929e('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x8a38d1,_0x5a75a4,_0x6822f2,_0x3ef0e9){return new BPromise(function(_0x1942a6,_0x2338f3){var _0x4a3b1a=_0x3ef0e9||client;return _0x4a3b1a[_0x929e('0x1d')](_0x8a38d1,_0x6822f2)[_0x929e('0x1e')](function(_0x4f0ce5){logger[_0x929e('0x1f')](_0x929e('0x20'),_0x5a75a4,_0x929e('0x21'));logger[_0x929e('0x22')](_0x929e('0x23'),_0x5a75a4,'request\x20sent',JSON[_0x929e('0x24')](_0x4f0ce5));if(_0x4f0ce5[_0x929e('0x25')]){if(_0x4f0ce5[_0x929e('0x25')][_0x929e('0x26')]===0x1f4){logger[_0x929e('0x25')]('FaxMessage,\x20%s,\x20%s',_0x5a75a4,_0x4f0ce5[_0x929e('0x25')][_0x929e('0x27')]);return _0x2338f3(_0x4f0ce5[_0x929e('0x25')][_0x929e('0x27')]);}logger['error'](_0x929e('0x20'),_0x5a75a4,_0x4f0ce5['error'][_0x929e('0x27')]);return _0x1942a6(_0x4f0ce5[_0x929e('0x25')]['message']);}else{logger[_0x929e('0x1f')](_0x929e('0x20'),_0x5a75a4,_0x929e('0x21'));_0x1942a6(_0x4f0ce5[_0x929e('0x28')][_0x929e('0x27')]);}})[_0x929e('0x29')](function(_0x204bf0){logger[_0x929e('0x25')]('FaxMessage,\x20%s,\x20%s',_0x5a75a4,_0x204bf0);_0x2338f3(_0x204bf0);});});}function respondWithStatusCode(_0x2d91d4,_0x403419){_0x403419=_0x403419||0xcc;return function(_0x49fd08){if(_0x49fd08){return _0x2d91d4[_0x929e('0x2a')](_0x403419);}return _0x2d91d4[_0x929e('0x2b')](_0x403419)[_0x929e('0x2c')]();};}function respondWithResult(_0x235e00,_0x36d8d9){_0x36d8d9=_0x36d8d9||0xc8;return function(_0xfea770){if(_0xfea770){return _0x235e00[_0x929e('0x2b')](_0x36d8d9)['json'](_0xfea770);}};}function respondWithFilteredResult(_0x2fa032,_0x1b9e14){return function(_0x2edabd){if(_0x2edabd){var _0x32d862=typeof _0x1b9e14[_0x929e('0x2d')]==='undefined'&&typeof _0x1b9e14[_0x929e('0x2e')]===_0x929e('0x2f');var _0x22d8ee=_0x2edabd[_0x929e('0x30')];var _0x393966=_0x32d862?0x0:_0x1b9e14['offset'];var _0x5d7c2a=_0x32d862?_0x2edabd[_0x929e('0x30')]:_0x1b9e14[_0x929e('0x2d')]+_0x1b9e14[_0x929e('0x2e')];var _0x34fb24;if(_0x5d7c2a>=_0x22d8ee){_0x5d7c2a=_0x22d8ee;_0x34fb24=0xc8;}else{_0x34fb24=0xce;}_0x2fa032['status'](_0x34fb24);return _0x2fa032[_0x929e('0x31')]('Content-Range',_0x393966+'-'+_0x5d7c2a+'/'+_0x22d8ee)['json'](_0x2edabd);}return null;};}function patchUpdates(_0x6f4aa8){return function(_0xfbf6ed){try{jsonpatch['apply'](_0xfbf6ed,_0x6f4aa8,!![]);}catch(_0xdf7f4a){return BPromise[_0x929e('0x32')](_0xdf7f4a);}return _0xfbf6ed['save']();};}function saveUpdates(_0x1b8306,_0x52e681){return function(_0xb2014c){if(_0xb2014c){return _0xb2014c['update'](_0x1b8306)[_0x929e('0x1e')](function(_0x1dea19){return _0x1dea19;});}return null;};}function removeEntity(_0x3a1619,_0x5ac216){return function(_0xf7cfba){if(_0xf7cfba){return _0xf7cfba[_0x929e('0x33')]()[_0x929e('0x1e')](function(){_0x3a1619[_0x929e('0x2b')](0xcc)[_0x929e('0x2c')]();});}};}function handleEntityNotFound(_0xcc6ca1,_0x476692){return function(_0x72336a){if(!_0x72336a){_0xcc6ca1['sendStatus'](0x194);}return _0x72336a;};}function handleError(_0x5e361e,_0x191391){_0x191391=_0x191391||0x1f4;return function(_0x21570d){logger[_0x929e('0x25')](_0x21570d[_0x929e('0x34')]);if(_0x21570d[_0x929e('0x35')]){delete _0x21570d[_0x929e('0x35')];}_0x5e361e[_0x929e('0x2b')](_0x191391)[_0x929e('0x36')](_0x21570d);};}exports[_0x929e('0x37')]=function(_0x3164bf,_0x2b2a7d){var _0x1ac736={},_0x26b7c6={},_0x3674a4={'count':0x0,'rows':[]};var _0x2cbe0b=_[_0x929e('0x38')](db[_0x929e('0x39')]['rawAttributes'],function(_0x4b836a){return{'name':_0x4b836a['fieldName'],'type':_0x4b836a[_0x929e('0x3a')]['key']};});_0x26b7c6['model']=_[_0x929e('0x38')](_0x2cbe0b,'name');_0x26b7c6[_0x929e('0x3b')]=_[_0x929e('0x3c')](_0x3164bf[_0x929e('0x3b')]);_0x26b7c6[_0x929e('0x3d')]=_['intersection'](_0x26b7c6[_0x929e('0x3e')],_0x26b7c6[_0x929e('0x3b')]);_0x1ac736['attributes']=_[_0x929e('0x3f')](_0x26b7c6[_0x929e('0x3e')],qs[_0x929e('0x40')](_0x3164bf[_0x929e('0x3b')]['fields']));_0x1ac736[_0x929e('0x41')]=_0x1ac736[_0x929e('0x41')][_0x929e('0x42')]?_0x1ac736[_0x929e('0x41')]:_0x26b7c6[_0x929e('0x3e')];if(!_0x3164bf[_0x929e('0x3b')][_0x929e('0x43')](_0x929e('0x44'))){_0x1ac736['limit']=qs[_0x929e('0x2e')](_0x3164bf[_0x929e('0x3b')][_0x929e('0x2e')]);_0x1ac736['offset']=qs['offset'](_0x3164bf['query']['offset']);}_0x1ac736['order']=qs[_0x929e('0x45')](_0x3164bf[_0x929e('0x3b')][_0x929e('0x45')]);_0x1ac736[_0x929e('0x46')]=qs[_0x929e('0x3d')](_[_0x929e('0x47')](_0x3164bf['query'],_0x26b7c6[_0x929e('0x3d')]),_0x2cbe0b);if(_0x3164bf[_0x929e('0x3b')][_0x929e('0x48')]){_0x1ac736[_0x929e('0x46')]=_[_0x929e('0x49')](_0x1ac736[_0x929e('0x46')],{'$or':_[_0x929e('0x38')](_0x2cbe0b,function(_0x152201){if(_0x152201[_0x929e('0x3a')]!==_0x929e('0x4a')){var _0x488981={};_0x488981[_0x152201['name']]={'$like':'%'+_0x3164bf[_0x929e('0x3b')][_0x929e('0x48')]+'%'};return _0x488981;}})});}_0x1ac736=_[_0x929e('0x49')]({},_0x1ac736,_0x3164bf[_0x929e('0x4b')]);var _0x89a4a0={'where':_0x1ac736[_0x929e('0x46')]};return db[_0x929e('0x39')][_0x929e('0x30')](_0x89a4a0)[_0x929e('0x1e')](function(_0x904101){_0x3674a4[_0x929e('0x30')]=_0x904101;if(_0x3164bf['query'][_0x929e('0x4c')]){_0x1ac736[_0x929e('0x4d')]=[{'all':!![]}];}return db[_0x929e('0x39')][_0x929e('0x4e')](_0x1ac736);})[_0x929e('0x1e')](function(_0x255448){_0x3674a4[_0x929e('0x4f')]=_0x255448;return _0x3674a4;})['then'](respondWithFilteredResult(_0x2b2a7d,_0x1ac736))[_0x929e('0x29')](handleError(_0x2b2a7d,null));};exports[_0x929e('0x50')]=function(_0xcf533b,_0x492cbb){var _0x3b0816={'raw':!![],'where':{'id':_0xcf533b[_0x929e('0x51')]['id']}},_0x589d56={};_0x589d56[_0x929e('0x3e')]=_[_0x929e('0x3c')](db[_0x929e('0x39')][_0x929e('0x52')]);_0x589d56[_0x929e('0x3b')]=_['keys'](_0xcf533b[_0x929e('0x3b')]);_0x589d56[_0x929e('0x3d')]=_[_0x929e('0x3f')](_0x589d56[_0x929e('0x3e')],_0x589d56[_0x929e('0x3b')]);_0x3b0816[_0x929e('0x41')]=_['intersection'](_0x589d56[_0x929e('0x3e')],qs[_0x929e('0x40')](_0xcf533b['query'][_0x929e('0x40')]));_0x3b0816[_0x929e('0x41')]=_0x3b0816[_0x929e('0x41')][_0x929e('0x42')]?_0x3b0816[_0x929e('0x41')]:_0x589d56[_0x929e('0x3e')];if(_0xcf533b[_0x929e('0x3b')][_0x929e('0x4c')]){_0x3b0816[_0x929e('0x4d')]=[{'all':!![]}];}_0x3b0816=_[_0x929e('0x49')]({},_0x3b0816,_0xcf533b[_0x929e('0x4b')]);return db['FaxMessage']['find'](_0x3b0816)[_0x929e('0x1e')](handleEntityNotFound(_0x492cbb,null))[_0x929e('0x1e')](respondWithResult(_0x492cbb,null))[_0x929e('0x29')](handleError(_0x492cbb,null));};exports[_0x929e('0x53')]=function(_0x3a63a2,_0x18bb8d){if(_0x3a63a2[_0x929e('0x54')]['id']){delete _0x3a63a2[_0x929e('0x54')]['id'];}return db[_0x929e('0x39')][_0x929e('0x55')]({'where':{'id':_0x3a63a2[_0x929e('0x51')]['id']}})[_0x929e('0x1e')](handleEntityNotFound(_0x18bb8d,null))['then'](saveUpdates(_0x3a63a2[_0x929e('0x54')],null))[_0x929e('0x1e')](respondWithResult(_0x18bb8d,null))[_0x929e('0x29')](handleError(_0x18bb8d,null));};exports[_0x929e('0x33')]=function(_0x317a11,_0x51600b){return db[_0x929e('0x39')][_0x929e('0x55')]({'where':{'id':_0x317a11[_0x929e('0x51')]['id']}})['then'](handleEntityNotFound(_0x51600b,null))[_0x929e('0x1e')](removeEntity(_0x51600b,null))[_0x929e('0x29')](handleError(_0x51600b,null));};exports[_0x929e('0x56')]=function(_0x2c8a38,_0x33319d){return db[_0x929e('0x39')][_0x929e('0x56')]()[_0x929e('0x1e')](respondWithResult(_0x33319d,null))[_0x929e('0x29')](handleError(_0x33319d,null));};var interaction_log=require('../../config/logger')('fax-interactions');exports[_0x929e('0x57')]=function(_0x24f803,_0x1ebfcc,_0x53690b){var _0x2e937c={'agent':{},'channel':_0x929e('0x58')};if(_0x24f803[_0x929e('0x54')]['id']){delete _0x24f803[_0x929e('0x54')]['id'];}_0x24f803[_0x929e('0x54')][_0x929e('0x59')]=!![];_0x24f803['body'][_0x929e('0x5a')]=moment()[_0x929e('0x5b')](_0x929e('0x5c'));_0x24f803['body']['UserId']=_0x24f803['body']['UserId']||_0x24f803['user']['id'];_0x2e937c[_0x929e('0x5d')]['id']=_0x24f803[_0x929e('0x54')][_0x929e('0x5e')];return db[_0x929e('0x39')][_0x929e('0x55')]({'where':{'id':_0x24f803['params']['id'],'UserId':null}})[_0x929e('0x1e')](handleEntityNotFound(_0x1ebfcc,null))[_0x929e('0x1e')](saveUpdates(_0x24f803[_0x929e('0x54')],null))[_0x929e('0x1e')](function(_0x1d1999){if(_0x1d1999){_0x2e937c[_0x929e('0x27')]=_0x1d1999['get']({'plain':!![]});return db[_0x929e('0x5f')][_0x929e('0x55')]({'where':{'id':_0x1d1999[_0x929e('0x60')]}});}return null;})[_0x929e('0x1e')](handleEntityNotFound(_0x1ebfcc,null))['then'](function(_0x41c11e){if(_0x41c11e){return _0x41c11e[_0x929e('0x53')]({'UserId':_0x24f803[_0x929e('0x54')][_0x929e('0x5e')],'read1stAt':_[_0x929e('0x61')](_0x41c11e[_0x929e('0x62')])?moment()[_0x929e('0x5b')](_0x929e('0x5c')):undefined});}return null;})[_0x929e('0x1e')](function(_0x29471b){if(_0x29471b){_0x2e937c[_0x929e('0x63')]=_0x29471b[_0x929e('0x64')]({'plain':!![]});interaction_log[_0x929e('0x1f')](_0x929e('0x65'),_0x24f803[_0x929e('0x66')]['id'],_0x24f803[_0x929e('0x66')][_0x929e('0x35')],_0x24f803['user'][_0x929e('0x67')],_0x2e937c['interaction']['id'],_0x24f803['body']?JSON[_0x929e('0x24')](_0x24f803[_0x929e('0x54')]):_0x929e('0x68'));return respondWithRpcPromise(_0x929e('0x69'),'acceptMessage',_0x2e937c);}return null;})[_0x929e('0x1e')](function(_0x5caad9){var _0x5c352d='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x5caad9[_0x929e('0x27')][_0x929e('0x6a')];return db[_0x929e('0x6b')]['query'](_0x5c352d,{'type':db[_0x929e('0x6c')][_0x929e('0x6d')][_0x929e('0x6e')],'raw':!![]})[_0x929e('0x1e')](function(_0x24608a){return _0x24608a;});})[_0x929e('0x1e')](function(_0x550eb6){if(_0x550eb6){_0x2e937c[_0x929e('0x27')][_0x929e('0x6f')]=_0x550eb6[0x0];if(!_0x24f803[_0x929e('0x54')]['UserId'])return;return db['User'][_0x929e('0x55')]({'where':{'id':_0x24f803['body'][_0x929e('0x5e')],'role':_0x929e('0x5d')},'attributes':['id','name',_0x929e('0x70'),_0x929e('0x71'),_0x929e('0x72')],'raw':!![]});}return null;})['then'](function(_0x5ed24a){if(!_0x5ed24a)return null;_0x2e937c[_0x929e('0x27')][_0x929e('0x5d')]=_0x5ed24a;return _0x2e937c;})[_0x929e('0x1e')](function(_0x46370e){if(_0x46370e){if(_0x24f803[_0x929e('0x54')][_0x929e('0x73')]){_0x2e937c[_0x929e('0x27')][_0x929e('0x74')]=util[_0x929e('0x5b')](_0x929e('0x75'),_0x24f803[_0x929e('0x66')][_0x929e('0x35')]);_0x2e937c[_0x929e('0x27')]['channel']=_0x2e937c[_0x929e('0x76')];_0x2e937c[_0x929e('0x27')][_0x929e('0x77')]=_0x2e937c['channel'];_0x2e937c[_0x929e('0x27')][_0x929e('0x78')]=_0x929e('0x57');return respondWithRpcPromise(_0x929e('0x79'),_0x929e('0x79'),{'event':'acceptmessage','message':_0x2e937c[_0x929e('0x27')]},client9002)[_0x929e('0x1e')](function(){return _0x2e937c;});}return _0x2e937c;}return null;})['then'](respondWithResult(_0x1ebfcc,null))[_0x929e('0x29')](handleError(_0x1ebfcc,null));};var interaction_log=require(_0x929e('0x10'))(_0x929e('0x7a'));exports['reject']=function(_0x274865,_0x47c0c3,_0xa0a588){var _0x29eff3={'agent':{},'channel':'fax'};if(_0x274865[_0x929e('0x54')]['id']){delete _0x274865[_0x929e('0x54')]['id'];}_0x274865[_0x929e('0x54')][_0x929e('0x5e')]=_0x274865[_0x929e('0x54')][_0x929e('0x5e')]||_0x274865[_0x929e('0x66')]['id'];_0x29eff3[_0x929e('0x5d')]['id']=_0x274865[_0x929e('0x54')][_0x929e('0x5e')];return db[_0x929e('0x39')][_0x929e('0x55')]({'where':{'id':_0x274865[_0x929e('0x51')]['id'],'UserId':null}})[_0x929e('0x1e')](handleEntityNotFound(_0x47c0c3,null))[_0x929e('0x1e')](function(_0x1183aa){if(_0x1183aa){_0x29eff3[_0x929e('0x27')]=_0x1183aa[_0x929e('0x64')]({'plain':!![]});return db[_0x929e('0x5f')][_0x929e('0x55')]({'where':{'id':_0x1183aa[_0x929e('0x60')]}});}return null;})[_0x929e('0x1e')](handleEntityNotFound(_0x47c0c3,null))[_0x929e('0x1e')](function(_0x3060cd){if(_0x3060cd){_0x29eff3['interaction']=_0x3060cd[_0x929e('0x64')]({'plain':!![]});interaction_log[_0x929e('0x1f')](_0x929e('0x7b'),_0x274865[_0x929e('0x66')]['id'],_0x274865[_0x929e('0x66')]['name'],_0x274865[_0x929e('0x66')]['role'],_0x29eff3[_0x929e('0x63')]['id'],_0x274865['body']?JSON[_0x929e('0x24')](_0x274865[_0x929e('0x54')]):'null');return respondWithRpcPromise(_0x929e('0x7c'),_0x929e('0x7d'),_0x29eff3);}return null;})[_0x929e('0x1e')](function(_0x317b75){var _0x34394b=_0x929e('0x7e')+_0x317b75['message']['ContactId'];return db[_0x929e('0x6b')][_0x929e('0x3b')](_0x34394b,{'type':db[_0x929e('0x6c')][_0x929e('0x6d')][_0x929e('0x6e')],'raw':!![]})['then'](function(_0x377150){return _0x377150;});})['then'](function(_0x4d7eb1){if(_0x4d7eb1){_0x29eff3['message'][_0x929e('0x6f')]=_0x4d7eb1[0x0];if(!_0x274865[_0x929e('0x54')][_0x929e('0x5e')])return;return db[_0x929e('0x7f')][_0x929e('0x55')]({'where':{'id':_0x274865['body'][_0x929e('0x5e')],'role':_0x929e('0x5d')},'attributes':['id',_0x929e('0x35'),'fullname',_0x929e('0x71'),_0x929e('0x72')],'raw':!![]});}return null;})[_0x929e('0x1e')](function(_0x56fcc4){if(!_0x56fcc4)return null;_0x29eff3[_0x929e('0x27')][_0x929e('0x5d')]=_0x56fcc4;return _0x29eff3;})[_0x929e('0x1e')](function(_0xf8c1c3){if(_0xf8c1c3){_0xf8c1c3[_0x929e('0x27')]['interface']=util[_0x929e('0x5b')](_0x929e('0x75'),_0x274865[_0x929e('0x66')][_0x929e('0x35')]);_0xf8c1c3['message']['channel']=_0x29eff3['channel'];_0xf8c1c3['message'][_0x929e('0x77')]=_0x29eff3[_0x929e('0x76')];_0xf8c1c3[_0x929e('0x27')][_0x929e('0x78')]=_0x929e('0x32');respondWithRpcPromise(_0x929e('0x79'),'EventManager',{'event':_0x929e('0x80'),'message':_0xf8c1c3[_0x929e('0x27')]},client9002);return _0x29eff3;}return null;})[_0x929e('0x1e')](respondWithResult(_0x47c0c3,null))[_0x929e('0x29')](handleError(_0x47c0c3,null));};exports[_0x929e('0x81')]=function(_0x19e807,_0x425af9){var _0x27b899;return db[_0x929e('0x39')]['create'](_0x19e807['body'],{})[_0x929e('0x1e')](function(_0x19a980){_0x27b899=_0x19a980;return db[_0x929e('0x82')]['findOne']({'where':{'id':_0x27b899[_0x929e('0x6a')]}});})['then'](function(_0x375520){if(_[_0x929e('0x61')](_0x375520)){return;}else{_0x27b899[_0x929e('0x58')]=_0x375520[_0x929e('0x58')];return db['Attachment'][_0x929e('0x83')]({'where':{'id':_0x27b899[_0x929e('0x84')]}});}})[_0x929e('0x1e')](function(_0x5a08f5){return respondWithRpcPromise(_0x929e('0x85'),_0x929e('0x85'),{'FaxAccountId':_['isNil'](_0x19e807[_0x929e('0x54')])?undefined:_0x19e807[_0x929e('0x54')]['FaxAccountId'],'path':_[_0x929e('0x61')](_0x5a08f5)?undefined:util['format'](_0x929e('0x86'),_0x5a08f5[_0x929e('0x87')]),'fax':_[_0x929e('0x61')](_0x27b899['fax'])?undefined:_0x27b899[_0x929e('0x58')],'AttachmentId':_0x27b899['AttachmentId']},client9002);})['then'](respondWithResult(_0x425af9,0xc9))[_0x929e('0x29')](handleError(_0x425af9,null));};exports['download']=function(_0x1537ef,_0x4cf3de){var _0x4a0a10=path[_0x929e('0x88')](config[_0x929e('0x89')],_0x929e('0x8a'),'files',_0x929e('0x8b'));return db[_0x929e('0x39')][_0x929e('0x55')]({'where':{'id':_0x1537ef['params']['id']},'include':[{'model':db[_0x929e('0x8c')],'as':_0x929e('0x8c')}]})['then'](handleEntityNotFound(_0x4cf3de,null))[_0x929e('0x1e')](function(_0x138715){if(_0x138715){return _0x4cf3de[_0x929e('0x8d')](path[_0x929e('0x88')](_0x4a0a10,_0x138715[_0x929e('0x8c')][_0x929e('0x87')]));}})[_0x929e('0x29')](handleError(_0x4cf3de,null));}; \ No newline at end of file +var _0xbedf=['order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','rows','params','find','describe','fax-interactions','body','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','FaxInteraction','update','isNil','read1stAt','info','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','acceptMessage','ContactId','sequelize','QueryTypes','contact','email','internal','interface','channel','motionChannel','accept','acceptmessage','reject','fax','FaxInteractionId','interaction','role','null','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','SELECT','User','fullname','event','EventManager','create','findOne','SendFax','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','basename','AttachmentId','download','root','server','files','attachments','Attachment','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','redis','localhost','socket.io-emitter','./faxMessage.socket','register','jayson/promise','client','http','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','sendStatus','status','json','offset','limit','count','set','Content-Range','apply','save','then','destroy','end','stack','name','send','index','map','FaxMessage','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty'];(function(_0x241424,_0x25eb5d){var _0x3da798=function(_0x415153){while(--_0x415153){_0x241424['push'](_0x241424['shift']());}};_0x3da798(++_0x25eb5d);}(_0xbedf,0x164));var _0xfbed=function(_0x32ff1d,_0x3e29bb){_0x32ff1d=_0x32ff1d-0x0;var _0x50489e=_0xbedf[_0x32ff1d];return _0x50489e;};'use strict';var emlformat=require(_0xfbed('0x0'));var rimraf=require(_0xfbed('0x1'));var zipdir=require(_0xfbed('0x2'));var jsonpatch=require(_0xfbed('0x3'));var rp=require(_0xfbed('0x4'));var moment=require(_0xfbed('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xfbed('0x6'));var util=require(_0xfbed('0x7'));var path=require(_0xfbed('0x8'));var sox=require('sox');var csv=require(_0xfbed('0x9'));var ejs=require(_0xfbed('0xa'));var fs=require('fs');var fs_extra=require(_0xfbed('0xb'));var _=require(_0xfbed('0xc'));var squel=require('squel');var crypto=require(_0xfbed('0xd'));var jsforce=require(_0xfbed('0xe'));var deskjs=require(_0xfbed('0xf'));var toCsv=require(_0xfbed('0x9'));var querystring=require(_0xfbed('0x10'));var Papa=require(_0xfbed('0x11'));var Redis=require(_0xfbed('0x12'));var authService=require(_0xfbed('0x13'));var qs=require(_0xfbed('0x14'));var as=require(_0xfbed('0x15'));var hardwareService=require(_0xfbed('0x16'));var logger=require(_0xfbed('0x17'))(_0xfbed('0x18'));var utils=require('../../config/utils');var config=require(_0xfbed('0x19'));var licenseUtil=require(_0xfbed('0x1a'));var db=require('../../mysqldb')['db'];config[_0xfbed('0x1b')]=_['defaults'](config['redis'],{'host':_0xfbed('0x1c'),'port':0x18eb});var socket=require(_0xfbed('0x1d'))(new Redis(config[_0xfbed('0x1b')]));require(_0xfbed('0x1e'))[_0xfbed('0x1f')](socket);var jayson=require(_0xfbed('0x20'));var client=jayson[_0xfbed('0x21')][_0xfbed('0x22')]({'port':0x232c});var client9002=jayson['client'][_0xfbed('0x22')]({'port':0x232a});function respondWithRpcPromise(_0x4e2e8b,_0x2126ef,_0x2e7733,_0x53ec63){return new BPromise(function(_0x536498,_0x272f8f){var _0x11ff12=_0x53ec63||client;return _0x11ff12['request'](_0x4e2e8b,_0x2e7733)['then'](function(_0x3efbbd){logger['info'](_0xfbed('0x23'),_0x2126ef,_0xfbed('0x24'));logger[_0xfbed('0x25')]('FaxMessage,\x20%s,\x20%s,\x20%s',_0x2126ef,_0xfbed('0x24'),JSON[_0xfbed('0x26')](_0x3efbbd));if(_0x3efbbd[_0xfbed('0x27')]){if(_0x3efbbd[_0xfbed('0x27')][_0xfbed('0x28')]===0x1f4){logger[_0xfbed('0x27')]('FaxMessage,\x20%s,\x20%s',_0x2126ef,_0x3efbbd['error'][_0xfbed('0x29')]);return _0x272f8f(_0x3efbbd['error'][_0xfbed('0x29')]);}logger[_0xfbed('0x27')](_0xfbed('0x23'),_0x2126ef,_0x3efbbd['error'][_0xfbed('0x29')]);return _0x536498(_0x3efbbd[_0xfbed('0x27')][_0xfbed('0x29')]);}else{logger['info'](_0xfbed('0x23'),_0x2126ef,_0xfbed('0x24'));_0x536498(_0x3efbbd[_0xfbed('0x2a')]['message']);}})[_0xfbed('0x2b')](function(_0x1c17b2){logger[_0xfbed('0x27')](_0xfbed('0x23'),_0x2126ef,_0x1c17b2);_0x272f8f(_0x1c17b2);});});}function respondWithStatusCode(_0x3453c8,_0x3bcd14){_0x3bcd14=_0x3bcd14||0xcc;return function(_0x56b5fd){if(_0x56b5fd){return _0x3453c8[_0xfbed('0x2c')](_0x3bcd14);}return _0x3453c8['status'](_0x3bcd14)['end']();};}function respondWithResult(_0x52e06b,_0x2bd8fa){_0x2bd8fa=_0x2bd8fa||0xc8;return function(_0x574228){if(_0x574228){return _0x52e06b[_0xfbed('0x2d')](_0x2bd8fa)[_0xfbed('0x2e')](_0x574228);}};}function respondWithFilteredResult(_0x1c81ac,_0x4be3e6){return function(_0x447230){if(_0x447230){var _0x2dbb33=typeof _0x4be3e6[_0xfbed('0x2f')]==='undefined'&&typeof _0x4be3e6[_0xfbed('0x30')]==='undefined';var _0x15b0f1=_0x447230['count'];var _0x2d7e39=_0x2dbb33?0x0:_0x4be3e6[_0xfbed('0x2f')];var _0x5bfd68=_0x2dbb33?_0x447230[_0xfbed('0x31')]:_0x4be3e6[_0xfbed('0x2f')]+_0x4be3e6[_0xfbed('0x30')];var _0x357f1e;if(_0x5bfd68>=_0x15b0f1){_0x5bfd68=_0x15b0f1;_0x357f1e=0xc8;}else{_0x357f1e=0xce;}_0x1c81ac[_0xfbed('0x2d')](_0x357f1e);return _0x1c81ac[_0xfbed('0x32')](_0xfbed('0x33'),_0x2d7e39+'-'+_0x5bfd68+'/'+_0x15b0f1)['json'](_0x447230);}return null;};}function patchUpdates(_0x13b66d){return function(_0x5795d5){try{jsonpatch[_0xfbed('0x34')](_0x5795d5,_0x13b66d,!![]);}catch(_0x104b99){return BPromise['reject'](_0x104b99);}return _0x5795d5[_0xfbed('0x35')]();};}function saveUpdates(_0x36d777,_0x16d3cf){return function(_0x1dc6e3){if(_0x1dc6e3){return _0x1dc6e3['update'](_0x36d777)[_0xfbed('0x36')](function(_0x113d7f){return _0x113d7f;});}return null;};}function removeEntity(_0xce5c3d,_0x1cac36){return function(_0x4cff42){if(_0x4cff42){return _0x4cff42[_0xfbed('0x37')]()[_0xfbed('0x36')](function(){_0xce5c3d[_0xfbed('0x2d')](0xcc)[_0xfbed('0x38')]();});}};}function handleEntityNotFound(_0xf4b321,_0x4953a6){return function(_0x32321a){if(!_0x32321a){_0xf4b321[_0xfbed('0x2c')](0x194);}return _0x32321a;};}function handleError(_0x54ec00,_0x40d496){_0x40d496=_0x40d496||0x1f4;return function(_0x344b97){logger[_0xfbed('0x27')](_0x344b97[_0xfbed('0x39')]);if(_0x344b97[_0xfbed('0x3a')]){delete _0x344b97['name'];}_0x54ec00[_0xfbed('0x2d')](_0x40d496)[_0xfbed('0x3b')](_0x344b97);};}exports[_0xfbed('0x3c')]=function(_0x3111b9,_0x19195b){var _0x35ae2b={},_0x53f36d={},_0x19f1eb={'count':0x0,'rows':[]};var _0x2511e0=_[_0xfbed('0x3d')](db[_0xfbed('0x3e')][_0xfbed('0x3f')],function(_0xef2fba){return{'name':_0xef2fba[_0xfbed('0x40')],'type':_0xef2fba[_0xfbed('0x41')][_0xfbed('0x42')]};});_0x53f36d[_0xfbed('0x43')]=_[_0xfbed('0x3d')](_0x2511e0,_0xfbed('0x3a'));_0x53f36d[_0xfbed('0x44')]=_[_0xfbed('0x45')](_0x3111b9[_0xfbed('0x44')]);_0x53f36d[_0xfbed('0x46')]=_[_0xfbed('0x47')](_0x53f36d[_0xfbed('0x43')],_0x53f36d[_0xfbed('0x44')]);_0x35ae2b[_0xfbed('0x48')]=_[_0xfbed('0x47')](_0x53f36d['model'],qs[_0xfbed('0x49')](_0x3111b9[_0xfbed('0x44')][_0xfbed('0x49')]));_0x35ae2b[_0xfbed('0x48')]=_0x35ae2b[_0xfbed('0x48')][_0xfbed('0x4a')]?_0x35ae2b[_0xfbed('0x48')]:_0x53f36d[_0xfbed('0x43')];if(!_0x3111b9[_0xfbed('0x44')][_0xfbed('0x4b')]('nolimit')){_0x35ae2b[_0xfbed('0x30')]=qs[_0xfbed('0x30')](_0x3111b9[_0xfbed('0x44')][_0xfbed('0x30')]);_0x35ae2b[_0xfbed('0x2f')]=qs[_0xfbed('0x2f')](_0x3111b9[_0xfbed('0x44')][_0xfbed('0x2f')]);}_0x35ae2b[_0xfbed('0x4c')]=qs[_0xfbed('0x4d')](_0x3111b9[_0xfbed('0x44')][_0xfbed('0x4d')]);_0x35ae2b[_0xfbed('0x4e')]=qs[_0xfbed('0x46')](_[_0xfbed('0x4f')](_0x3111b9[_0xfbed('0x44')],_0x53f36d[_0xfbed('0x46')]),_0x2511e0);if(_0x3111b9[_0xfbed('0x44')][_0xfbed('0x50')]){_0x35ae2b['where']=_[_0xfbed('0x51')](_0x35ae2b['where'],{'$or':_[_0xfbed('0x3d')](_0x2511e0,function(_0x3c3437){if(_0x3c3437[_0xfbed('0x41')]!==_0xfbed('0x52')){var _0x59b470={};_0x59b470[_0x3c3437['name']]={'$like':'%'+_0x3111b9['query'][_0xfbed('0x50')]+'%'};return _0x59b470;}})});}_0x35ae2b=_[_0xfbed('0x51')]({},_0x35ae2b,_0x3111b9[_0xfbed('0x53')]);var _0x57da41={'where':_0x35ae2b[_0xfbed('0x4e')]};return db[_0xfbed('0x3e')]['count'](_0x57da41)[_0xfbed('0x36')](function(_0xe3591){_0x19f1eb['count']=_0xe3591;if(_0x3111b9['query'][_0xfbed('0x54')]){_0x35ae2b['include']=[{'all':!![]}];}return db[_0xfbed('0x3e')]['findAll'](_0x35ae2b);})['then'](function(_0x459781){_0x19f1eb[_0xfbed('0x55')]=_0x459781;return _0x19f1eb;})[_0xfbed('0x36')](respondWithFilteredResult(_0x19195b,_0x35ae2b))[_0xfbed('0x2b')](handleError(_0x19195b,null));};exports['show']=function(_0x51a07d,_0x222e1d){var _0x5dce46={'raw':!![],'where':{'id':_0x51a07d[_0xfbed('0x56')]['id']}},_0x4131df={};_0x4131df[_0xfbed('0x43')]=_[_0xfbed('0x45')](db['FaxMessage'][_0xfbed('0x3f')]);_0x4131df[_0xfbed('0x44')]=_['keys'](_0x51a07d[_0xfbed('0x44')]);_0x4131df['filters']=_[_0xfbed('0x47')](_0x4131df[_0xfbed('0x43')],_0x4131df[_0xfbed('0x44')]);_0x5dce46[_0xfbed('0x48')]=_['intersection'](_0x4131df['model'],qs[_0xfbed('0x49')](_0x51a07d[_0xfbed('0x44')]['fields']));_0x5dce46[_0xfbed('0x48')]=_0x5dce46['attributes'][_0xfbed('0x4a')]?_0x5dce46['attributes']:_0x4131df[_0xfbed('0x43')];if(_0x51a07d['query'][_0xfbed('0x54')]){_0x5dce46['include']=[{'all':!![]}];}_0x5dce46=_[_0xfbed('0x51')]({},_0x5dce46,_0x51a07d[_0xfbed('0x53')]);return db[_0xfbed('0x3e')][_0xfbed('0x57')](_0x5dce46)[_0xfbed('0x36')](handleEntityNotFound(_0x222e1d,null))[_0xfbed('0x36')](respondWithResult(_0x222e1d,null))['catch'](handleError(_0x222e1d,null));};exports['update']=function(_0xda6647,_0x2311a6){if(_0xda6647['body']['id']){delete _0xda6647['body']['id'];}return db[_0xfbed('0x3e')][_0xfbed('0x57')]({'where':{'id':_0xda6647[_0xfbed('0x56')]['id']}})[_0xfbed('0x36')](handleEntityNotFound(_0x2311a6,null))[_0xfbed('0x36')](saveUpdates(_0xda6647['body'],null))[_0xfbed('0x36')](respondWithResult(_0x2311a6,null))[_0xfbed('0x2b')](handleError(_0x2311a6,null));};exports[_0xfbed('0x37')]=function(_0x2376e6,_0x3a7bd6){return db[_0xfbed('0x3e')][_0xfbed('0x57')]({'where':{'id':_0x2376e6['params']['id']}})[_0xfbed('0x36')](handleEntityNotFound(_0x3a7bd6,null))[_0xfbed('0x36')](removeEntity(_0x3a7bd6,null))['catch'](handleError(_0x3a7bd6,null));};exports[_0xfbed('0x58')]=function(_0x1773fa,_0xa6a1e2){return db[_0xfbed('0x3e')]['describe']()[_0xfbed('0x36')](respondWithResult(_0xa6a1e2,null))[_0xfbed('0x2b')](handleError(_0xa6a1e2,null));};var interaction_log=require(_0xfbed('0x17'))(_0xfbed('0x59'));exports['accept']=function(_0x2706d8,_0x56f112,_0x343866){var _0x27e248={'agent':{},'channel':'fax'};if(_0x2706d8[_0xfbed('0x5a')]['id']){delete _0x2706d8[_0xfbed('0x5a')]['id'];}_0x2706d8[_0xfbed('0x5a')][_0xfbed('0x5b')]=!![];_0x2706d8['body'][_0xfbed('0x5c')]=moment()[_0xfbed('0x5d')](_0xfbed('0x5e'));_0x2706d8[_0xfbed('0x5a')][_0xfbed('0x5f')]=_0x2706d8[_0xfbed('0x5a')][_0xfbed('0x5f')]||_0x2706d8[_0xfbed('0x60')]['id'];_0x27e248[_0xfbed('0x61')]['id']=_0x2706d8[_0xfbed('0x5a')][_0xfbed('0x5f')];return db[_0xfbed('0x3e')][_0xfbed('0x57')]({'where':{'id':_0x2706d8[_0xfbed('0x56')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x56f112,null))['then'](saveUpdates(_0x2706d8[_0xfbed('0x5a')],null))[_0xfbed('0x36')](function(_0x3b3b96){if(_0x3b3b96){_0x27e248[_0xfbed('0x29')]=_0x3b3b96[_0xfbed('0x62')]({'plain':!![]});return db[_0xfbed('0x63')][_0xfbed('0x57')]({'where':{'id':_0x3b3b96['FaxInteractionId']}});}return null;})[_0xfbed('0x36')](handleEntityNotFound(_0x56f112,null))['then'](function(_0x4223bf){if(_0x4223bf){return _0x4223bf[_0xfbed('0x64')]({'UserId':_0x2706d8['body'][_0xfbed('0x5f')],'read1stAt':_[_0xfbed('0x65')](_0x4223bf[_0xfbed('0x66')])?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})['then'](function(_0x298dfc){if(_0x298dfc){_0x27e248['interaction']=_0x298dfc[_0xfbed('0x62')]({'plain':!![]});interaction_log[_0xfbed('0x67')](_0xfbed('0x68'),_0x2706d8[_0xfbed('0x60')]['id'],_0x2706d8[_0xfbed('0x60')][_0xfbed('0x3a')],_0x2706d8[_0xfbed('0x60')]['role'],_0x27e248['interaction']['id'],_0x2706d8['body']?JSON[_0xfbed('0x26')](_0x2706d8[_0xfbed('0x5a')]):'null');return respondWithRpcPromise('AcceptMessage',_0xfbed('0x69'),_0x27e248);}return null;})[_0xfbed('0x36')](function(_0x5eab25){var _0xbf5720='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x5eab25[_0xfbed('0x29')][_0xfbed('0x6a')];return db[_0xfbed('0x6b')][_0xfbed('0x44')](_0xbf5720,{'type':db['Sequelize'][_0xfbed('0x6c')]['SELECT'],'raw':!![]})[_0xfbed('0x36')](function(_0x276e59){return _0x276e59;});})['then'](function(_0x2a8f9d){if(_0x2a8f9d){_0x27e248[_0xfbed('0x29')][_0xfbed('0x6d')]=_0x2a8f9d[0x0];if(!_0x2706d8[_0xfbed('0x5a')][_0xfbed('0x5f')])return;return db['User'][_0xfbed('0x57')]({'where':{'id':_0x2706d8['body'][_0xfbed('0x5f')],'role':_0xfbed('0x61')},'attributes':['id',_0xfbed('0x3a'),'fullname',_0xfbed('0x6e'),_0xfbed('0x6f')],'raw':!![]});}return null;})[_0xfbed('0x36')](function(_0x17d5a0){if(!_0x17d5a0)return null;_0x27e248[_0xfbed('0x29')][_0xfbed('0x61')]=_0x17d5a0;return _0x27e248;})['then'](function(_0x1f3741){if(_0x1f3741){if(_0x2706d8[_0xfbed('0x5a')]['manual']){_0x27e248[_0xfbed('0x29')][_0xfbed('0x70')]=util[_0xfbed('0x5d')]('SIP/%s',_0x2706d8[_0xfbed('0x60')][_0xfbed('0x3a')]);_0x27e248[_0xfbed('0x29')][_0xfbed('0x71')]=_0x27e248[_0xfbed('0x71')];_0x27e248[_0xfbed('0x29')][_0xfbed('0x72')]=_0x27e248['channel'];_0x27e248[_0xfbed('0x29')]['event']=_0xfbed('0x73');return respondWithRpcPromise('EventManager','EventManager',{'event':_0xfbed('0x74'),'message':_0x27e248[_0xfbed('0x29')]},client9002)[_0xfbed('0x36')](function(){return _0x27e248;});}return _0x27e248;}return null;})['then'](respondWithResult(_0x56f112,null))[_0xfbed('0x2b')](handleError(_0x56f112,null));};var interaction_log=require(_0xfbed('0x17'))(_0xfbed('0x59'));exports[_0xfbed('0x75')]=function(_0x481b85,_0x182d9d,_0x3ed87a){var _0x254a84={'agent':{},'channel':_0xfbed('0x76')};if(_0x481b85[_0xfbed('0x5a')]['id']){delete _0x481b85[_0xfbed('0x5a')]['id'];}_0x481b85[_0xfbed('0x5a')][_0xfbed('0x5f')]=_0x481b85['body']['UserId']||_0x481b85['user']['id'];_0x254a84[_0xfbed('0x61')]['id']=_0x481b85[_0xfbed('0x5a')][_0xfbed('0x5f')];return db[_0xfbed('0x3e')][_0xfbed('0x57')]({'where':{'id':_0x481b85[_0xfbed('0x56')]['id'],'UserId':null}})[_0xfbed('0x36')](handleEntityNotFound(_0x182d9d,null))[_0xfbed('0x36')](function(_0xd87794){if(_0xd87794){_0x254a84[_0xfbed('0x29')]=_0xd87794['get']({'plain':!![]});return db[_0xfbed('0x63')][_0xfbed('0x57')]({'where':{'id':_0xd87794[_0xfbed('0x77')]}});}return null;})[_0xfbed('0x36')](handleEntityNotFound(_0x182d9d,null))[_0xfbed('0x36')](function(_0x1f332d){if(_0x1f332d){_0x254a84[_0xfbed('0x78')]=_0x1f332d['get']({'plain':!![]});interaction_log[_0xfbed('0x67')]('[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x481b85[_0xfbed('0x60')]['id'],_0x481b85[_0xfbed('0x60')]['name'],_0x481b85['user'][_0xfbed('0x79')],_0x254a84[_0xfbed('0x78')]['id'],_0x481b85[_0xfbed('0x5a')]?JSON[_0xfbed('0x26')](_0x481b85['body']):_0xfbed('0x7a'));return respondWithRpcPromise(_0xfbed('0x7b'),_0xfbed('0x7c'),_0x254a84);}return null;})[_0xfbed('0x36')](function(_0x45e056){var _0x6d3d0b=_0xfbed('0x7d')+_0x45e056[_0xfbed('0x29')][_0xfbed('0x6a')];return db['sequelize'][_0xfbed('0x44')](_0x6d3d0b,{'type':db['Sequelize'][_0xfbed('0x6c')][_0xfbed('0x7e')],'raw':!![]})[_0xfbed('0x36')](function(_0x5765b9){return _0x5765b9;});})[_0xfbed('0x36')](function(_0x4e462f){if(_0x4e462f){_0x254a84[_0xfbed('0x29')][_0xfbed('0x6d')]=_0x4e462f[0x0];if(!_0x481b85[_0xfbed('0x5a')][_0xfbed('0x5f')])return;return db[_0xfbed('0x7f')]['find']({'where':{'id':_0x481b85['body'][_0xfbed('0x5f')],'role':_0xfbed('0x61')},'attributes':['id','name',_0xfbed('0x80'),_0xfbed('0x6e'),'internal'],'raw':!![]});}return null;})[_0xfbed('0x36')](function(_0x528738){if(!_0x528738)return null;_0x254a84['message']['agent']=_0x528738;return _0x254a84;})['then'](function(_0x4797a7){if(_0x4797a7){_0x4797a7[_0xfbed('0x29')]['interface']=util[_0xfbed('0x5d')]('SIP/%s',_0x481b85[_0xfbed('0x60')][_0xfbed('0x3a')]);_0x4797a7[_0xfbed('0x29')][_0xfbed('0x71')]=_0x254a84[_0xfbed('0x71')];_0x4797a7[_0xfbed('0x29')][_0xfbed('0x72')]=_0x254a84['channel'];_0x4797a7['message'][_0xfbed('0x81')]=_0xfbed('0x75');respondWithRpcPromise(_0xfbed('0x82'),_0xfbed('0x82'),{'event':'rejectmessage','message':_0x4797a7[_0xfbed('0x29')]},client9002);return _0x254a84;}return null;})[_0xfbed('0x36')](respondWithResult(_0x182d9d,null))['catch'](handleError(_0x182d9d,null));};exports[_0xfbed('0x83')]=function(_0x2a0376,_0x3aa2d4){var _0x5e5db8;return db[_0xfbed('0x3e')][_0xfbed('0x83')](_0x2a0376[_0xfbed('0x5a')],{})[_0xfbed('0x36')](function(_0x5b0f4a){_0x5e5db8=_0x5b0f4a;return db['CmContact']['findOne']({'where':{'id':_0x5e5db8[_0xfbed('0x6a')]}});})[_0xfbed('0x36')](function(_0x27d010){if(_[_0xfbed('0x65')](_0x27d010)){return;}else{_0x5e5db8[_0xfbed('0x76')]=_0x27d010['fax'];return db['Attachment'][_0xfbed('0x84')]({'where':{'id':_0x5e5db8['AttachmentId']}});}})[_0xfbed('0x36')](function(_0x3b577f){return respondWithRpcPromise(_0xfbed('0x85'),_0xfbed('0x85'),{'FaxAccountId':_['isNil'](_0x2a0376[_0xfbed('0x5a')])?undefined:_0x2a0376[_0xfbed('0x5a')][_0xfbed('0x86')],'path':_[_0xfbed('0x65')](_0x3b577f)?undefined:util['format'](_0xfbed('0x87'),_0x3b577f[_0xfbed('0x88')]),'fax':_[_0xfbed('0x65')](_0x5e5db8[_0xfbed('0x76')])?undefined:_0x5e5db8[_0xfbed('0x76')],'AttachmentId':_0x5e5db8[_0xfbed('0x89')]},client9002);})['then'](respondWithResult(_0x3aa2d4,0xc9))[_0xfbed('0x2b')](handleError(_0x3aa2d4,null));};exports[_0xfbed('0x8a')]=function(_0x5ed38f,_0x56794d){var _0x2836cd=path['join'](config[_0xfbed('0x8b')],_0xfbed('0x8c'),_0xfbed('0x8d'),_0xfbed('0x8e'));return db[_0xfbed('0x3e')][_0xfbed('0x57')]({'where':{'id':_0x5ed38f['params']['id']},'include':[{'model':db['Attachment'],'as':'Attachment'}]})['then'](handleEntityNotFound(_0x56794d,null))[_0xfbed('0x36')](function(_0x560b7e){if(_0x560b7e){return _0x56794d[_0xfbed('0x8a')](path['join'](_0x2836cd,_0x560b7e[_0xfbed('0x8f')][_0xfbed('0x88')]));}})[_0xfbed('0x2b')](handleError(_0x56794d,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index e8a7334..525204a 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 _0x44fe=['FaxMessage','setMaxListeners','save','update','remove','hasOwnProperty','hook','events','../../mysqldb'];(function(_0x10b48a,_0x1a0a3f){var _0x2c4533=function(_0x5e4be6){while(--_0x5e4be6){_0x10b48a['push'](_0x10b48a['shift']());}};_0x2c4533(++_0x1a0a3f);}(_0x44fe,0x16f));var _0xe44f=function(_0x9dce5c,_0x5e835e){_0x9dce5c=_0x9dce5c-0x0;var _0x39dfb6=_0x44fe[_0x9dce5c];return _0x39dfb6;};'use strict';var EventEmitter=require(_0xe44f('0x0'));var FaxMessage=require(_0xe44f('0x1'))['db'][_0xe44f('0x2')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0xe44f('0x3')](0x0);var events={'afterCreate':_0xe44f('0x4'),'afterUpdate':_0xe44f('0x5'),'afterDestroy':_0xe44f('0x6')};function emitEvent(_0x3f66c9){return function(_0x1e14a5,_0x44b438,_0x2e1d0a){FaxMessageEvents['emit'](_0x3f66c9+':'+_0x1e14a5['id'],_0x1e14a5);FaxMessageEvents['emit'](_0x3f66c9,_0x1e14a5);_0x2e1d0a(null);};}for(var e in events){if(events[_0xe44f('0x7')](e)){var event=events[e];FaxMessage[_0xe44f('0x8')](e,emitEvent(event));}}module['exports']=FaxMessageEvents; \ No newline at end of file +var _0x6132=['../../mysqldb','FaxMessage','setMaxListeners','update','remove','hasOwnProperty','hook','exports','events'];(function(_0x34528b,_0x52583d){var _0x400919=function(_0x42d60f){while(--_0x42d60f){_0x34528b['push'](_0x34528b['shift']());}};_0x400919(++_0x52583d);}(_0x6132,0x13a));var _0x2613=function(_0x49fba7,_0x37d4d5){_0x49fba7=_0x49fba7-0x0;var _0xbbbc8e=_0x6132[_0x49fba7];return _0xbbbc8e;};'use strict';var EventEmitter=require(_0x2613('0x0'));var FaxMessage=require(_0x2613('0x1'))['db'][_0x2613('0x2')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0x2613('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x2613('0x4'),'afterDestroy':_0x2613('0x5')};function emitEvent(_0x2890f9){return function(_0x35c979,_0x555746,_0x8d00d8){FaxMessageEvents['emit'](_0x2890f9+':'+_0x35c979['id'],_0x35c979);FaxMessageEvents['emit'](_0x2890f9,_0x35c979);_0x8d00d8(null);};}for(var e in events){if(events[_0x2613('0x6')](e)){var event=events[e];FaxMessage[_0x2613('0x7')](e,emitEvent(event));}}module[_0x2613('0x8')]=FaxMessageEvents; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.model.js b/server/api/faxMessage/faxMessage.model.js index c64eea5..4c6a268 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 _0xe99d=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','define','FaxMessage','fax_messages','body','models','get','toLowerCase','out','secret','isNil','FaxInteraction','findOne','FaxInteractionId','update','createdAt','direction','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash'];(function(_0x33c41b,_0x5c8fbe){var _0xa19c5=function(_0x314ba9){while(--_0x314ba9){_0x33c41b['push'](_0x33c41b['shift']());}};_0xa19c5(++_0x5c8fbe);}(_0xe99d,0x15b));var _0xde99=function(_0x5e1762,_0x35541a){_0x5e1762=_0x5e1762-0x0;var _0x5b7c4a=_0xe99d[_0x5e1762];return _0x5b7c4a;};'use strict';var _=require(_0xde99('0x0'));var util=require('util');var logger=require(_0xde99('0x1'))(_0xde99('0x2'));var moment=require(_0xde99('0x3'));var BPromise=require(_0xde99('0x4'));var rp=require(_0xde99('0x5'));var fs=require('fs');var path=require(_0xde99('0x6'));var rimraf=require(_0xde99('0x7'));var config=require(_0xde99('0x8'));var attributes=require('./faxMessage.attributes');module['exports']=function(_0x3f147f,_0x384e72){return _0x3f147f[_0xde99('0x9')](_0xde99('0xa'),attributes,{'tableName':_0xde99('0xb'),'paranoid':![],'indexes':[{'name':'fti_fax_messages','fields':[_0xde99('0xc')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x3e4146,_0x122b58,_0xd7a093){var _0x3f30fe=_0x3f147f[_0xde99('0xd')];var _0x12e5fa=_0x3e4146[_0xde99('0xe')]({'plain':!![]});if(_0x12e5fa['direction']['toLowerCase']()==='in'||_0x12e5fa['direction'][_0xde99('0xf')]()===_0xde99('0x10')&&!_0x12e5fa[_0xde99('0x11')]&&!_[_0xde99('0x12')](_0x12e5fa['UserId'])){_0x3f30fe[_0xde99('0x13')][_0xde99('0x14')]({'where':{'id':_0x12e5fa[_0xde99('0x15')]}})['then'](function(_0x1bf7b1){if(_0x1bf7b1){_0x1bf7b1[_0xde99('0x16')]({'lastMsgAt':_0x12e5fa[_0xde99('0x17')],'lastMsgDirection':_0x12e5fa[_0xde99('0x18')][_0xde99('0xf')]()});}})[_0xde99('0x19')](function(_0x286bf2){console[_0xde99('0x1a')](_0x286bf2);});}_0xd7a093();}},'charset':_0xde99('0x1b'),'collate':_0xde99('0x1c')});}; \ No newline at end of file +var _0xb4c3=['catch','utf8mb4','lodash','../../config/logger','api','moment','bluebird','path','./faxMessage.attributes','exports','define','fax_messages','body','FULLTEXT','get','direction','toLowerCase','out','isNil','UserId','FaxInteraction','findOne','FaxInteractionId','update'];(function(_0x14ce33,_0x46699d){var _0x10e50e=function(_0x12b8b2){while(--_0x12b8b2){_0x14ce33['push'](_0x14ce33['shift']());}};_0x10e50e(++_0x46699d);}(_0xb4c3,0x7a));var _0x3b4c=function(_0x256798,_0x5cca6f){_0x256798=_0x256798-0x0;var _0x10c175=_0xb4c3[_0x256798];return _0x10c175;};'use strict';var _=require(_0x3b4c('0x0'));var util=require('util');var logger=require(_0x3b4c('0x1'))(_0x3b4c('0x2'));var moment=require(_0x3b4c('0x3'));var BPromise=require(_0x3b4c('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3b4c('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x3b4c('0x6'));module[_0x3b4c('0x7')]=function(_0x15224d,_0x365a46){return _0x15224d[_0x3b4c('0x8')]('FaxMessage',attributes,{'tableName':_0x3b4c('0x9'),'paranoid':![],'indexes':[{'name':'fti_fax_messages','fields':[_0x3b4c('0xa')],'type':_0x3b4c('0xb')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x3c1dcc,_0x19f489,_0x550fd3){var _0x4b90cc=_0x15224d['models'];var _0x55c390=_0x3c1dcc[_0x3b4c('0xc')]({'plain':!![]});if(_0x55c390[_0x3b4c('0xd')]['toLowerCase']()==='in'||_0x55c390[_0x3b4c('0xd')][_0x3b4c('0xe')]()===_0x3b4c('0xf')&&!_0x55c390['secret']&&!_[_0x3b4c('0x10')](_0x55c390[_0x3b4c('0x11')])){_0x4b90cc[_0x3b4c('0x12')][_0x3b4c('0x13')]({'where':{'id':_0x55c390[_0x3b4c('0x14')]}})['then'](function(_0x406a74){if(_0x406a74){_0x406a74[_0x3b4c('0x15')]({'lastMsgAt':_0x55c390['createdAt'],'lastMsgDirection':_0x55c390['direction'][_0x3b4c('0xe')]()});}})[_0x3b4c('0x16')](function(_0x4e1bd9){console['error'](_0x4e1bd9);});}_0x550fd3();}},'charset':_0x3b4c('0x17'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.rpc.js b/server/api/faxMessage/faxMessage.rpc.js index 7f707b1..745384a 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 _0xd6d6=['lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','then','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxMessage,\x20%s,\x20%s','message','result','catch','FaxMessage','create','body','options','raw','info','CreateFaxMessage','update','where','limit','UpdateFaxMessage'];(function(_0xae7072,_0x625cc4){var _0x55414e=function(_0x4bb456){while(--_0x4bb456){_0xae7072['push'](_0xae7072['shift']());}};_0x55414e(++_0x625cc4);}(_0xd6d6,0xbe));var _0x6d6d=function(_0x24c2a9,_0x5bb58e){_0x24c2a9=_0x24c2a9-0x0;var _0x53a2a2=_0xd6d6[_0x24c2a9];return _0x53a2a2;};'use strict';var _=require(_0x6d6d('0x0'));var util=require(_0x6d6d('0x1'));var moment=require(_0x6d6d('0x2'));var BPromise=require(_0x6d6d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6d6d('0x4'));var db=require(_0x6d6d('0x5'))['db'];var utils=require(_0x6d6d('0x6'));var logger=require(_0x6d6d('0x7'))(_0x6d6d('0x8'));var config=require(_0x6d6d('0x9'));var jayson=require(_0x6d6d('0xa'));var client=jayson['client'][_0x6d6d('0xb')]({'port':0x232a});config[_0x6d6d('0xc')]=_[_0x6d6d('0xd')](config[_0x6d6d('0xc')],{'host':_0x6d6d('0xe'),'port':0x18eb});var socket=require(_0x6d6d('0xf'))(new Redis(config[_0x6d6d('0xc')]));require('./faxMessage.socket')['register'](socket);function respondWithRpcPromise(_0x404c88,_0x1fa46d,_0x23b18a){return new BPromise(function(_0x290dfb,_0xf84314){return client['request'](_0x404c88,_0x23b18a)[_0x6d6d('0x10')](function(_0x158f82){logger['info']('FaxMessage,\x20%s,\x20%s',_0x1fa46d,_0x6d6d('0x11'));logger[_0x6d6d('0x12')](_0x6d6d('0x13'),_0x1fa46d,_0x6d6d('0x11'),JSON[_0x6d6d('0x14')](_0x158f82));if(_0x158f82[_0x6d6d('0x15')]){if(_0x158f82[_0x6d6d('0x15')][_0x6d6d('0x16')]===0x1f4){logger['error'](_0x6d6d('0x17'),_0x1fa46d,_0x158f82[_0x6d6d('0x15')][_0x6d6d('0x18')]);return _0xf84314(_0x158f82[_0x6d6d('0x15')][_0x6d6d('0x18')]);}logger['error'](_0x6d6d('0x17'),_0x1fa46d,_0x158f82['error'][_0x6d6d('0x18')]);return _0x290dfb(_0x158f82[_0x6d6d('0x15')][_0x6d6d('0x18')]);}else{logger['info']('FaxMessage,\x20%s,\x20%s',_0x1fa46d,_0x6d6d('0x11'));_0x290dfb(_0x158f82[_0x6d6d('0x19')][_0x6d6d('0x18')]);}})[_0x6d6d('0x1a')](function(_0x51fff6){logger['error'](_0x6d6d('0x17'),_0x1fa46d,_0x51fff6);_0xf84314(_0x51fff6);});});}exports['CreateFaxMessage']=function(_0x26f631){var _0xb8590d=this;return new Promise(function(_0x30d87d,_0x450352){return db[_0x6d6d('0x1b')][_0x6d6d('0x1c')](_0x26f631[_0x6d6d('0x1d')],{'raw':_0x26f631[_0x6d6d('0x1e')]?_0x26f631[_0x6d6d('0x1e')][_0x6d6d('0x1f')]===undefined?!![]:![]:!![]})[_0x6d6d('0x10')](function(_0x6e58e3){logger[_0x6d6d('0x20')](_0x6d6d('0x21'),_0x26f631);logger[_0x6d6d('0x12')](_0x6d6d('0x21'),_0x26f631,JSON[_0x6d6d('0x14')](_0x6e58e3));_0x30d87d(_0x6e58e3);})['catch'](function(_0x3b73e5){logger[_0x6d6d('0x15')](_0x6d6d('0x21'),_0x3b73e5[_0x6d6d('0x18')],_0x26f631);_0x450352(_0xb8590d[_0x6d6d('0x15')](0x1f4,_0x3b73e5[_0x6d6d('0x18')]));});});};exports['UpdateFaxMessage']=function(_0x2851dd){var _0x2b5e31=this;return new Promise(function(_0x235451,_0x126ac8){return db[_0x6d6d('0x1b')][_0x6d6d('0x22')](_0x2851dd[_0x6d6d('0x1d')],{'raw':_0x2851dd['options']?_0x2851dd[_0x6d6d('0x1e')][_0x6d6d('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2851dd['options']?_0x2851dd['options'][_0x6d6d('0x23')]||null:null,'attributes':_0x2851dd[_0x6d6d('0x1e')]?_0x2851dd[_0x6d6d('0x1e')]['attributes']||null:null,'limit':_0x2851dd[_0x6d6d('0x1e')]?_0x2851dd[_0x6d6d('0x1e')][_0x6d6d('0x24')]||null:null})[_0x6d6d('0x10')](function(_0x64d1f7){logger[_0x6d6d('0x20')](_0x6d6d('0x25'),_0x2851dd);logger[_0x6d6d('0x12')](_0x6d6d('0x25'),_0x2851dd,JSON[_0x6d6d('0x14')](_0x64d1f7));_0x235451(_0x64d1f7);})['catch'](function(_0x1f9469){logger['error'](_0x6d6d('0x25'),_0x1f9469[_0x6d6d('0x18')],_0x2851dd);_0x126ac8(_0x2b5e31[_0x6d6d('0x15')](0x1f4,_0x1f9469[_0x6d6d('0x18')]));});});}; \ No newline at end of file +var _0x4c4e=['localhost','socket.io-emitter','request','info','FaxMessage,\x20%s,\x20%s','request\x20sent','FaxMessage,\x20%s,\x20%s,\x20%s','error','message','result','catch','CreateFaxMessage','FaxMessage','create','body','options','raw','then','debug','stringify','attributes','limit','UpdateFaxMessage','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','redis','defaults'];(function(_0x5bdebe,_0x4b317d){var _0x59f511=function(_0x5aa117){while(--_0x5aa117){_0x5bdebe['push'](_0x5bdebe['shift']());}};_0x59f511(++_0x4b317d);}(_0x4c4e,0x152));var _0xe4c4=function(_0xcecaa9,_0x460b08){_0xcecaa9=_0xcecaa9-0x0;var _0xc2a7cb=_0x4c4e[_0xcecaa9];return _0xc2a7cb;};'use strict';var _=require(_0xe4c4('0x0'));var util=require('util');var moment=require(_0xe4c4('0x1'));var BPromise=require(_0xe4c4('0x2'));var rs=require(_0xe4c4('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe4c4('0x4'))['db'];var utils=require(_0xe4c4('0x5'));var logger=require(_0xe4c4('0x6'))('rpc');var config=require(_0xe4c4('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xe4c4('0x8')][_0xe4c4('0x9')]({'port':0x232a});config[_0xe4c4('0xa')]=_[_0xe4c4('0xb')](config[_0xe4c4('0xa')],{'host':_0xe4c4('0xc'),'port':0x18eb});var socket=require(_0xe4c4('0xd'))(new Redis(config[_0xe4c4('0xa')]));require('./faxMessage.socket')['register'](socket);function respondWithRpcPromise(_0x31f879,_0x6f2545,_0x27ad42){return new BPromise(function(_0x1bc786,_0x333c08){return client[_0xe4c4('0xe')](_0x31f879,_0x27ad42)['then'](function(_0x303d89){logger[_0xe4c4('0xf')](_0xe4c4('0x10'),_0x6f2545,_0xe4c4('0x11'));logger['debug'](_0xe4c4('0x12'),_0x6f2545,_0xe4c4('0x11'),JSON['stringify'](_0x303d89));if(_0x303d89[_0xe4c4('0x13')]){if(_0x303d89[_0xe4c4('0x13')]['code']===0x1f4){logger[_0xe4c4('0x13')](_0xe4c4('0x10'),_0x6f2545,_0x303d89['error'][_0xe4c4('0x14')]);return _0x333c08(_0x303d89[_0xe4c4('0x13')][_0xe4c4('0x14')]);}logger[_0xe4c4('0x13')](_0xe4c4('0x10'),_0x6f2545,_0x303d89[_0xe4c4('0x13')][_0xe4c4('0x14')]);return _0x1bc786(_0x303d89[_0xe4c4('0x13')][_0xe4c4('0x14')]);}else{logger[_0xe4c4('0xf')](_0xe4c4('0x10'),_0x6f2545,_0xe4c4('0x11'));_0x1bc786(_0x303d89[_0xe4c4('0x15')][_0xe4c4('0x14')]);}})[_0xe4c4('0x16')](function(_0x5a32b5){logger[_0xe4c4('0x13')](_0xe4c4('0x10'),_0x6f2545,_0x5a32b5);_0x333c08(_0x5a32b5);});});}exports[_0xe4c4('0x17')]=function(_0x317cc8){var _0x5da165=this;return new Promise(function(_0x3d5856,_0x1cad5d){return db[_0xe4c4('0x18')][_0xe4c4('0x19')](_0x317cc8[_0xe4c4('0x1a')],{'raw':_0x317cc8[_0xe4c4('0x1b')]?_0x317cc8[_0xe4c4('0x1b')][_0xe4c4('0x1c')]===undefined?!![]:![]:!![]})[_0xe4c4('0x1d')](function(_0x1a7690){logger[_0xe4c4('0xf')](_0xe4c4('0x17'),_0x317cc8);logger[_0xe4c4('0x1e')](_0xe4c4('0x17'),_0x317cc8,JSON[_0xe4c4('0x1f')](_0x1a7690));_0x3d5856(_0x1a7690);})['catch'](function(_0x49cadc){logger[_0xe4c4('0x13')]('CreateFaxMessage',_0x49cadc[_0xe4c4('0x14')],_0x317cc8);_0x1cad5d(_0x5da165['error'](0x1f4,_0x49cadc[_0xe4c4('0x14')]));});});};exports['UpdateFaxMessage']=function(_0x34d667){var _0x583393=this;return new Promise(function(_0xba53ef,_0x4a0199){return db['FaxMessage']['update'](_0x34d667['body'],{'raw':_0x34d667[_0xe4c4('0x1b')]?_0x34d667['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x34d667[_0xe4c4('0x1b')]?_0x34d667[_0xe4c4('0x1b')]['where']||null:null,'attributes':_0x34d667['options']?_0x34d667[_0xe4c4('0x1b')][_0xe4c4('0x20')]||null:null,'limit':_0x34d667['options']?_0x34d667[_0xe4c4('0x1b')][_0xe4c4('0x21')]||null:null})[_0xe4c4('0x1d')](function(_0x48060e){logger['info'](_0xe4c4('0x22'),_0x34d667);logger[_0xe4c4('0x1e')](_0xe4c4('0x22'),_0x34d667,JSON[_0xe4c4('0x1f')](_0x48060e));_0xba53ef(_0x48060e);})['catch'](function(_0x49c913){logger[_0xe4c4('0x13')](_0xe4c4('0x22'),_0x49c913['message'],_0x34d667);_0x4a0199(_0x583393[_0xe4c4('0x13')](0x1f4,_0x49c913[_0xe4c4('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index d0b456c..3b1c784 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 _0x87f2=['length','faxMessage:','./faxMessage.events','save','remove','update','emit'];(function(_0x30a2cd,_0x4261d9){var _0x386733=function(_0x2b73c7){while(--_0x2b73c7){_0x30a2cd['push'](_0x30a2cd['shift']());}};_0x386733(++_0x4261d9);}(_0x87f2,0x87));var _0x287f=function(_0x58c6f6,_0x4ddb62){_0x58c6f6=_0x58c6f6-0x0;var _0x4a37ff=_0x87f2[_0x58c6f6];return _0x4a37ff;};'use strict';var FaxMessageEvents=require(_0x287f('0x0'));var events=[_0x287f('0x1'),_0x287f('0x2'),_0x287f('0x3')];function createListener(_0x3af52c,_0x6d0b67){return function(_0x2b7c69){_0x6d0b67[_0x287f('0x4')](_0x3af52c,_0x2b7c69);};}function removeListener(_0x57e5d1,_0xeb23b){return function(){FaxMessageEvents['removeListener'](_0x57e5d1,_0xeb23b);};}exports['register']=function(_0x30e822){for(var _0x4950c2=0x0,_0x1b835d=events[_0x287f('0x5')];_0x4950c2<_0x1b835d;_0x4950c2++){var _0x3cde4f=events[_0x4950c2];var _0x42ccdc=createListener(_0x287f('0x6')+_0x3cde4f,_0x30e822);FaxMessageEvents['on'](_0x3cde4f,_0x42ccdc);}}; \ No newline at end of file +var _0x3a20=['save','update','register','faxMessage:'];(function(_0x332b2c,_0x526aec){var _0x24e2b8=function(_0x5b35e0){while(--_0x5b35e0){_0x332b2c['push'](_0x332b2c['shift']());}};_0x24e2b8(++_0x526aec);}(_0x3a20,0xd0));var _0x03a2=function(_0x19054c,_0x4e0287){_0x19054c=_0x19054c-0x0;var _0xfaa27=_0x3a20[_0x19054c];return _0xfaa27;};'use strict';var FaxMessageEvents=require('./faxMessage.events');var events=[_0x03a2('0x0'),'remove',_0x03a2('0x1')];function createListener(_0x546a49,_0xb8442){return function(_0x525720){_0xb8442['emit'](_0x546a49,_0x525720);};}function removeListener(_0x48afbd,_0x1bc8b4){return function(){FaxMessageEvents['removeListener'](_0x48afbd,_0x1bc8b4);};}exports[_0x03a2('0x2')]=function(_0x1d066d){for(var _0x5c275d=0x0,_0x1f124f=events['length'];_0x5c275d<_0x1f124f;_0x5c275d++){var _0x1e43c1=events[_0x5c275d];var _0x1e1a86=createListener(_0x03a2('0x3')+_0x1e43c1,_0x1d066d);FaxMessageEvents['on'](_0x1e43c1,_0x1e1a86);}}; \ No newline at end of file diff --git a/server/api/faxMessage/index.js b/server/api/faxMessage/index.js index 545a997..037dc0c 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 _0x593e=['../../components/auth/service','../../config/environment','./faxMessage.controller','get','isAuthenticated','index','/describe','describe','show','download','post','fax','faxmessage:create','create','put','/:id','update','/:id/accept','/:id/reject','reject','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x20275f,_0x4528c5){var _0x5a5457=function(_0x2bd2cc){while(--_0x2bd2cc){_0x20275f['push'](_0x20275f['shift']());}};_0x5a5457(++_0x4528c5);}(_0x593e,0xcb));var _0xe593=function(_0x555774,_0x400a0a){_0x555774=_0x555774-0x0;var _0x1f84f9=_0x593e[_0x555774];return _0x1f84f9;};'use strict';var multer=require(_0xe593('0x0'));var util=require(_0xe593('0x1'));var path=require(_0xe593('0x2'));var timeout=require(_0xe593('0x3'));var express=require(_0xe593('0x4'));var router=express[_0xe593('0x5')]();var fs_extra=require(_0xe593('0x6'));var auth=require(_0xe593('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xe593('0x8'));var controller=require(_0xe593('0x9'));router[_0xe593('0xa')]('/',auth[_0xe593('0xb')](),controller[_0xe593('0xc')]);router[_0xe593('0xa')](_0xe593('0xd'),auth[_0xe593('0xb')](),controller[_0xe593('0xe')]);router[_0xe593('0xa')]('/:id',auth[_0xe593('0xb')](),controller[_0xe593('0xf')]);router[_0xe593('0xa')]('/:id/download',auth['isAuthenticated'](),controller[_0xe593('0x10')]);router[_0xe593('0x11')]('/',auth[_0xe593('0xb')](),interaction['tracked'](_0xe593('0x12'),_0xe593('0x13')),controller[_0xe593('0x14')]);router[_0xe593('0x15')](_0xe593('0x16'),auth[_0xe593('0xb')](),controller[_0xe593('0x17')]);router[_0xe593('0x15')](_0xe593('0x18'),auth[_0xe593('0xb')](),controller['accept']);router[_0xe593('0x15')](_0xe593('0x19'),auth['isAuthenticated'](),controller[_0xe593('0x1a')]);router[_0xe593('0x1b')]('/:id',auth[_0xe593('0xb')](),controller[_0xe593('0x1c')]);module[_0xe593('0x1d')]=router; \ No newline at end of file +var _0xc788=['describe','/:id','show','post','fax','faxmessage:create','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xc788,0xc4));var _0x8c78=function(_0x50a19b,_0x80c4d0){_0x50a19b=_0x50a19b-0x0;var _0x19b42d=_0xc788[_0x50a19b];return _0x19b42d;};'use strict';var multer=require(_0x8c78('0x0'));var util=require(_0x8c78('0x1'));var path=require(_0x8c78('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x8c78('0x3')]();var fs_extra=require(_0x8c78('0x4'));var auth=require(_0x8c78('0x5'));var interaction=require(_0x8c78('0x6'));var config=require(_0x8c78('0x7'));var controller=require('./faxMessage.controller');router[_0x8c78('0x8')]('/',auth[_0x8c78('0x9')](),controller[_0x8c78('0xa')]);router[_0x8c78('0x8')](_0x8c78('0xb'),auth['isAuthenticated'](),controller[_0x8c78('0xc')]);router[_0x8c78('0x8')](_0x8c78('0xd'),auth[_0x8c78('0x9')](),controller[_0x8c78('0xe')]);router[_0x8c78('0x8')]('/:id/download',auth[_0x8c78('0x9')](),controller['download']);router[_0x8c78('0xf')]('/',auth[_0x8c78('0x9')](),interaction['tracked'](_0x8c78('0x10'),_0x8c78('0x11')),controller['create']);router[_0x8c78('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x8c78('0x13')]);router[_0x8c78('0x12')](_0x8c78('0x14'),auth[_0x8c78('0x9')](),controller[_0x8c78('0x15')]);router[_0x8c78('0x12')](_0x8c78('0x16'),auth[_0x8c78('0x9')](),controller[_0x8c78('0x17')]);router[_0x8c78('0x18')]('/:id',auth[_0x8c78('0x9')](),controller[_0x8c78('0x19')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.attributes.js b/server/api/faxQueue/faxQueue.attributes.js index b1b3777..859ddc3 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 _0x11d1=['rrmemory','beepall','INTEGER','sequelize','STRING','name','ENUM'];(function(_0x38841c,_0x1af0bf){var _0x500610=function(_0x225955){while(--_0x225955){_0x38841c['push'](_0x38841c['shift']());}};_0x500610(++_0x1af0bf);}(_0x11d1,0x184));var _0x111d=function(_0x454f5b,_0x286ba1){_0x454f5b=_0x454f5b-0x0;var _0x5dcb77=_0x11d1[_0x454f5b];return _0x5dcb77;};'use strict';var Sequelize=require(_0x111d('0x0'));module['exports']={'name':{'type':Sequelize[_0x111d('0x1')],'unique':_0x111d('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x111d('0x1')]},'timeout':{'type':Sequelize['INTEGER'],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x111d('0x3')](_0x111d('0x4'),_0x111d('0x5'),'roundrobin'),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x111d('0x6')],'defaultValue':0x0}}; \ No newline at end of file +var _0xdedd=['beepall','sequelize','exports','STRING','name','INTEGER','ENUM','rrmemory'];(function(_0x423eb1,_0x566da4){var _0x2b01e3=function(_0x409cdd){while(--_0x409cdd){_0x423eb1['push'](_0x423eb1['shift']());}};_0x2b01e3(++_0x566da4);}(_0xdedd,0x1a1));var _0xdded=function(_0x2962c6,_0x1214c0){_0x2962c6=_0x2962c6-0x0;var _0x423e8a=_0xdedd[_0x2962c6];return _0x423e8a;};'use strict';var Sequelize=require(_0xdded('0x0'));module[_0xdded('0x1')]={'name':{'type':Sequelize[_0xdded('0x2')],'unique':_0xdded('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0xdded('0x4')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xdded('0x5')](_0xdded('0x6'),_0xdded('0x7'),'roundrobin'),'allowNull':![]},'lastAgent':{'type':Sequelize['INTEGER'],'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 bb187f1..9c73b15 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 _0xc1db=['UserFaxQueue','intersection','hasOwnProperty','nolimit','sort','pick','FaxQueueId','filter','options','User','findAndCountAll','UserId','faxPause','updatedAt','createdAt','format','%s/%s','Team','order','getTeams','addTeams','Agents','online','voicePause','flatMap','transaction','findOrCreate','emit','userFaxQueue:save','removeTeams','ids','select','field','tq.TeamId','from','team_has_fax_queues','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','sequelize','QueryTypes','SELECT','every','includes','union','isEmpty','removeAgents','forEach','addAgents','spread','isArray','userFaxQueue:remove','getAgents','bluebird','lodash','squel','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','redis','localhost','./faxQueue.socket','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','then','get','UserProfileResource','destroy','stack','name','index','map','FaxQueue','fieldName','type','key','getOptions','where','include','query','findAll','rows','catch','show','params','model','rawAttributes','keys','filters','attributes','fields','length','includeAll','merge','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','userProfileId','autoAssociation','error','update','describe','findOne'];(function(_0x4741fc,_0x38cf62){var _0x275437=function(_0x244956){while(--_0x244956){_0x4741fc['push'](_0x4741fc['shift']());}};_0x275437(++_0x38cf62);}(_0xc1db,0x120));var _0xbc1d=function(_0x1b40ae,_0x262405){_0x1b40ae=_0x1b40ae-0x0;var _0x2ac87c=_0xc1db[_0x1b40ae];return _0x2ac87c;};'use strict';var BPromise=require(_0xbc1d('0x0'));var util=require('util');var _=require(_0xbc1d('0x1'));var squel=require(_0xbc1d('0x2'));var Redis=require(_0xbc1d('0x3'));var qs=require(_0xbc1d('0x4'));var logger=require(_0xbc1d('0x5'))('api');var config=require(_0xbc1d('0x6'));var db=require(_0xbc1d('0x7'))['db'];config[_0xbc1d('0x8')]=_['defaults'](config['redis'],{'host':_0xbc1d('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xbc1d('0xa'))['register'](socket);function respondWithStatusCode(_0x268200,_0x451e8d){_0x451e8d=_0x451e8d||0xcc;return function(_0x4c2d30){if(_0x4c2d30){return _0x268200[_0xbc1d('0xb')](_0x451e8d);}return _0x268200['status'](_0x451e8d)[_0xbc1d('0xc')]();};}function respondWithResult(_0x23176d,_0x51282b){_0x51282b=_0x51282b||0xc8;return function(_0x1c211f){if(_0x1c211f){return _0x23176d[_0xbc1d('0xd')](_0x51282b)[_0xbc1d('0xe')](_0x1c211f);}};}function respondWithFilteredResult(_0x23f1b4,_0x5e19f3){return function(_0x2d6f04){if(_0x2d6f04){var _0x4e9cee=typeof _0x5e19f3[_0xbc1d('0xf')]===_0xbc1d('0x10')&&typeof _0x5e19f3['limit']===_0xbc1d('0x10');var _0x242428=_0x2d6f04['count'];var _0x373f20=_0x4e9cee?0x0:_0x5e19f3[_0xbc1d('0xf')];var _0x58e7f4=_0x4e9cee?_0x2d6f04[_0xbc1d('0x11')]:_0x5e19f3['offset']+_0x5e19f3[_0xbc1d('0x12')];var _0x238c0d;if(_0x58e7f4>=_0x242428){_0x58e7f4=_0x242428;_0x238c0d=0xc8;}else{_0x238c0d=0xce;}_0x23f1b4[_0xbc1d('0xd')](_0x238c0d);return _0x23f1b4[_0xbc1d('0x13')](_0xbc1d('0x14'),_0x373f20+'-'+_0x58e7f4+'/'+_0x242428)[_0xbc1d('0xe')](_0x2d6f04);}return null;};}function saveUpdates(_0x5bddda){return function(_0x30360e){if(_0x30360e){return _0x30360e['update'](_0x5bddda)[_0xbc1d('0x15')](function(_0x225310){return _0x225310;});}return null;};}function removeEntity(_0x57de11){return function(_0x58c56e){if(_0x58c56e){return _0x58c56e['destroy']()[_0xbc1d('0x15')](function(){var _0x403afc=_0x58c56e[_0xbc1d('0x16')]({'plain':!![]});var _0x1bd6d7='FaxQueues';return db[_0xbc1d('0x17')][_0xbc1d('0x18')]({'where':{'type':_0x1bd6d7,'resourceId':_0x403afc['id']}})[_0xbc1d('0x15')](function(){return _0x58c56e;});})[_0xbc1d('0x15')](function(){_0x57de11['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x33fc05){return function(_0x497eba){if(!_0x497eba){_0x33fc05[_0xbc1d('0xb')](0x194);}return _0x497eba;};}function handleError(_0x52c7c9,_0x1b065e){_0x1b065e=_0x1b065e||0x1f4;return function(_0x1c1e0e){logger['error'](_0x1c1e0e[_0xbc1d('0x19')]);if(_0x1c1e0e[_0xbc1d('0x1a')]){delete _0x1c1e0e[_0xbc1d('0x1a')];}_0x52c7c9['status'](_0x1b065e)['send'](_0x1c1e0e);};}exports[_0xbc1d('0x1b')]=function(_0x497df8,_0x1f6217){var _0x13ce62={};var _0x59fd2e={'count':0x0,'rows':[]};var _0x4d959a=_[_0xbc1d('0x1c')](db[_0xbc1d('0x1d')]['rawAttributes'],function(_0x7b37c3){return{'name':_0x7b37c3[_0xbc1d('0x1e')],'type':_0x7b37c3[_0xbc1d('0x1f')][_0xbc1d('0x20')]};});_0x13ce62=qs[_0xbc1d('0x21')](_0x4d959a,_0x497df8);var _0x2b5c55={'where':_0x13ce62[_0xbc1d('0x22')]};return db['FaxQueue'][_0xbc1d('0x11')](_0x2b5c55)['then'](function(_0x584fa5){_0x59fd2e[_0xbc1d('0x11')]=_0x584fa5;_0x13ce62[_0xbc1d('0x23')]=qs[_0xbc1d('0x23')](_0x497df8[_0xbc1d('0x24')]);return db['FaxQueue'][_0xbc1d('0x25')](_0x13ce62);})[_0xbc1d('0x15')](function(_0x586007){_0x59fd2e[_0xbc1d('0x26')]=_0x586007;return _0x59fd2e;})[_0xbc1d('0x15')](respondWithFilteredResult(_0x1f6217,_0x13ce62))[_0xbc1d('0x27')](handleError(_0x1f6217,null));};exports[_0xbc1d('0x28')]=function(_0x18ca96,_0x21705d){var _0x3fd527={'raw':!![],'where':{'id':_0x18ca96[_0xbc1d('0x29')]['id']}},_0x403e0b={};_0x403e0b[_0xbc1d('0x2a')]=_['keys'](db[_0xbc1d('0x1d')][_0xbc1d('0x2b')]);_0x403e0b[_0xbc1d('0x24')]=_[_0xbc1d('0x2c')](_0x18ca96[_0xbc1d('0x24')]);_0x403e0b[_0xbc1d('0x2d')]=_['intersection'](_0x403e0b[_0xbc1d('0x2a')],_0x403e0b[_0xbc1d('0x24')]);_0x3fd527[_0xbc1d('0x2e')]=_['intersection'](_0x403e0b[_0xbc1d('0x2a')],qs[_0xbc1d('0x2f')](_0x18ca96[_0xbc1d('0x24')]['fields']));_0x3fd527[_0xbc1d('0x2e')]=_0x3fd527[_0xbc1d('0x2e')][_0xbc1d('0x30')]?_0x3fd527[_0xbc1d('0x2e')]:_0x403e0b['model'];if(_0x18ca96['query'][_0xbc1d('0x31')]){_0x3fd527[_0xbc1d('0x23')]=[{'all':!![]}];}_0x3fd527=_[_0xbc1d('0x32')]({},_0x3fd527,_0x18ca96['options']);return db['FaxQueue']['find'](_0x3fd527)['then'](handleEntityNotFound(_0x21705d,null))[_0xbc1d('0x15')](respondWithResult(_0x21705d,null))[_0xbc1d('0x27')](handleError(_0x21705d,null));};exports[_0xbc1d('0x33')]=function(_0x267713,_0x4009ef){return db[_0xbc1d('0x1d')]['create'](_0x267713[_0xbc1d('0x34')],{})['then'](function(_0x2ac3f2){var _0x560a7c=_0x267713[_0xbc1d('0x35')][_0xbc1d('0x16')]({'plain':!![]});if(!_0x560a7c)throw new Error(_0xbc1d('0x36'));if(_0x560a7c['role']===_0xbc1d('0x35')){var _0x7ca90c=_0x2ac3f2[_0xbc1d('0x16')]({'plain':!![]});var _0x1df5fe='FaxQueues';return db[_0xbc1d('0x37')][_0xbc1d('0x38')]({'where':{'name':_0x1df5fe,'userProfileId':_0x560a7c[_0xbc1d('0x39')]},'raw':!![]})[_0xbc1d('0x15')](function(_0x107e00){if(_0x107e00&&_0x107e00[_0xbc1d('0x3a')]===0x0){return db[_0xbc1d('0x17')][_0xbc1d('0x33')]({'name':_0x7ca90c['name'],'resourceId':_0x7ca90c['id'],'type':_0x107e00[_0xbc1d('0x1a')],'sectionId':_0x107e00['id']},{})[_0xbc1d('0x15')](function(){return _0x2ac3f2;});}else{return _0x2ac3f2;}})['catch'](function(_0xbf378){logger[_0xbc1d('0x3b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xbf378);throw _0xbf378;});}return _0x2ac3f2;})['then'](respondWithResult(_0x4009ef,0xc9))[_0xbc1d('0x27')](handleError(_0x4009ef,null));};exports[_0xbc1d('0x3c')]=function(_0x3e09f9,_0x4a9006){if(_0x3e09f9[_0xbc1d('0x34')]['id']){delete _0x3e09f9[_0xbc1d('0x34')]['id'];}return db[_0xbc1d('0x1d')][_0xbc1d('0x38')]({'where':{'id':_0x3e09f9['params']['id']}})[_0xbc1d('0x15')](handleEntityNotFound(_0x4a9006,null))['then'](saveUpdates(_0x3e09f9[_0xbc1d('0x34')],null))[_0xbc1d('0x15')](respondWithResult(_0x4a9006,null))['catch'](handleError(_0x4a9006,null));};exports[_0xbc1d('0x18')]=function(_0x3c06f3,_0x1832df){return db[_0xbc1d('0x1d')]['find']({'where':{'id':_0x3c06f3[_0xbc1d('0x29')]['id']}})['then'](handleEntityNotFound(_0x1832df,null))[_0xbc1d('0x15')](removeEntity(_0x1832df,null))['catch'](handleError(_0x1832df,null));};exports[_0xbc1d('0x3d')]=function(_0x59dfd6,_0x247653){return db[_0xbc1d('0x1d')][_0xbc1d('0x3d')]()[_0xbc1d('0x15')](respondWithResult(_0x247653,null))[_0xbc1d('0x27')](handleError(_0x247653,null));};exports['getMembers']=function(_0x2de552,_0x4f4aeb){var _0x5c6e4e={'raw':!![],'where':{}},_0x398f1a={},_0x3b8ac5;return db[_0xbc1d('0x1d')][_0xbc1d('0x3e')]({'where':{'id':_0x2de552[_0xbc1d('0x29')]['id']}})['then'](handleEntityNotFound(_0x4f4aeb,null))['then'](function(_0x1c4e23){if(_0x1c4e23){_0x3b8ac5=_0x1c4e23[_0xbc1d('0x16')]({'plain':!![]});_0x398f1a['model']=_[_0xbc1d('0x2c')](db[_0xbc1d('0x3f')][_0xbc1d('0x2b')]);_0x398f1a[_0xbc1d('0x24')]=_[_0xbc1d('0x2c')](_0x2de552[_0xbc1d('0x24')]);_0x398f1a[_0xbc1d('0x2d')]=_[_0xbc1d('0x40')](_0x398f1a[_0xbc1d('0x2a')],_0x398f1a[_0xbc1d('0x24')]);_0x5c6e4e[_0xbc1d('0x2e')]=_[_0xbc1d('0x40')](_0x398f1a[_0xbc1d('0x2a')],qs[_0xbc1d('0x2f')](_0x2de552[_0xbc1d('0x24')][_0xbc1d('0x2f')]));_0x5c6e4e[_0xbc1d('0x2e')]=_0x5c6e4e[_0xbc1d('0x2e')]['length']?_0x5c6e4e[_0xbc1d('0x2e')]:_0x398f1a[_0xbc1d('0x2a')];if(!_0x2de552[_0xbc1d('0x24')][_0xbc1d('0x41')](_0xbc1d('0x42'))){_0x5c6e4e[_0xbc1d('0x12')]=qs[_0xbc1d('0x12')](_0x2de552['query']['limit']);_0x5c6e4e[_0xbc1d('0xf')]=qs[_0xbc1d('0xf')](_0x2de552[_0xbc1d('0x24')][_0xbc1d('0xf')]);}_0x5c6e4e['order']=qs[_0xbc1d('0x43')](_0x2de552[_0xbc1d('0x24')][_0xbc1d('0x43')]);_0x5c6e4e[_0xbc1d('0x22')]=qs[_0xbc1d('0x2d')](_[_0xbc1d('0x44')](_0x2de552['query'],_0x398f1a[_0xbc1d('0x2d')]));_0x5c6e4e[_0xbc1d('0x22')][_0xbc1d('0x45')]=_0x1c4e23['id'];if(_0x2de552[_0xbc1d('0x24')][_0xbc1d('0x46')]){_0x5c6e4e[_0xbc1d('0x22')]=_[_0xbc1d('0x32')](_0x5c6e4e[_0xbc1d('0x22')],{'$or':_[_0xbc1d('0x1c')](_0x5c6e4e['attributes'],function(_0x182334){var _0x271a2b={};_0x271a2b[_0x182334]={'$like':'%'+_0x2de552[_0xbc1d('0x24')][_0xbc1d('0x46')]+'%'};return _0x271a2b;})});}_0x5c6e4e=_[_0xbc1d('0x32')]({},_0x5c6e4e,_0x2de552[_0xbc1d('0x47')]);return db[_0xbc1d('0x3f')][_0xbc1d('0x25')](_0x5c6e4e);}})[_0xbc1d('0x15')](function(_0x3a3e03){if(_0x3a3e03){return db[_0xbc1d('0x48')][_0xbc1d('0x49')]({'where':{'id':_[_0xbc1d('0x1c')](_0x3a3e03,_0xbc1d('0x4a')),'role':'agent'},'attributes':['id',_0xbc1d('0x1a'),_0xbc1d('0x4b'),_0xbc1d('0x4c'),_0xbc1d('0x4d')]});}})['then'](function(_0x541461){if(_0x541461){return{'count':_0x541461[_0xbc1d('0x11')],'rows':_[_0xbc1d('0x1c')](_0x541461[_0xbc1d('0x26')],function(_0x426aa4){return{'membername':_0x426aa4[_0xbc1d('0x1a')],'UserId':_0x426aa4['id'],'queue_name':_0x3b8ac5[_0xbc1d('0x1a')],'FaxQueueId':_0x3b8ac5['id'],'interface':util[_0xbc1d('0x4e')](_0xbc1d('0x4f'),'SIP',_0x426aa4['name']),'penalty':0x0,'paused':_0x426aa4[_0xbc1d('0x4b')],'createdAt':_0x426aa4[_0xbc1d('0x4d')],'updatedAt':_0x426aa4[_0xbc1d('0x4c')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x4f4aeb,_0x5c6e4e))[_0xbc1d('0x27')](handleError(_0x4f4aeb,null));};exports['getTeams']=function(_0x3d4e92,_0x26fdc6){var _0x29d919={};var _0x15f5a9={};var _0x51b4cd;var _0x1a6848;return db[_0xbc1d('0x1d')][_0xbc1d('0x3e')]({'where':{'id':_0x3d4e92[_0xbc1d('0x29')]['id']}})[_0xbc1d('0x15')](handleEntityNotFound(_0x26fdc6,null))[_0xbc1d('0x15')](function(_0xee6d22){if(_0xee6d22){_0x51b4cd=_0xee6d22;_0x15f5a9['model']=_[_0xbc1d('0x2c')](db[_0xbc1d('0x50')][_0xbc1d('0x2b')]);_0x15f5a9[_0xbc1d('0x24')]=_[_0xbc1d('0x2c')](_0x3d4e92['query']);_0x15f5a9[_0xbc1d('0x2d')]=_[_0xbc1d('0x40')](_0x15f5a9[_0xbc1d('0x2a')],_0x15f5a9[_0xbc1d('0x24')]);_0x29d919[_0xbc1d('0x2e')]=_[_0xbc1d('0x40')](_0x15f5a9[_0xbc1d('0x2a')],qs[_0xbc1d('0x2f')](_0x3d4e92[_0xbc1d('0x24')][_0xbc1d('0x2f')]));_0x29d919['attributes']=_0x29d919[_0xbc1d('0x2e')][_0xbc1d('0x30')]?_0x29d919['attributes']:_0x15f5a9[_0xbc1d('0x2a')];_0x29d919[_0xbc1d('0x51')]=qs[_0xbc1d('0x43')](_0x3d4e92[_0xbc1d('0x24')][_0xbc1d('0x43')]);_0x29d919[_0xbc1d('0x22')]=qs[_0xbc1d('0x2d')](_['pick'](_0x3d4e92[_0xbc1d('0x24')],_0x15f5a9[_0xbc1d('0x2d')]));if(_0x3d4e92['query'][_0xbc1d('0x46')]){_0x29d919['where']=_[_0xbc1d('0x32')](_0x29d919[_0xbc1d('0x22')],{'$or':_[_0xbc1d('0x1c')](_0x29d919[_0xbc1d('0x2e')],function(_0x126e83){var _0x5a628d={};_0x5a628d[_0x126e83]={'$like':'%'+_0x3d4e92[_0xbc1d('0x24')]['filter']+'%'};return _0x5a628d;})});}_0x29d919=_[_0xbc1d('0x32')]({},_0x29d919,_0x3d4e92['options']);return _0x51b4cd[_0xbc1d('0x52')](_0x29d919);}})['then'](function(_0x4d571c){if(_0x4d571c){_0x1a6848=_0x4d571c[_0xbc1d('0x30')];if(!_0x3d4e92['query'][_0xbc1d('0x41')]('nolimit')){_0x29d919['limit']=qs[_0xbc1d('0x12')](_0x3d4e92['query'][_0xbc1d('0x12')]);_0x29d919['offset']=qs['offset'](_0x3d4e92['query'][_0xbc1d('0xf')]);}return _0x51b4cd['getTeams'](_0x29d919);}})[_0xbc1d('0x15')](function(_0x4ecbfd){if(_0x4ecbfd){return _0x4ecbfd?{'count':_0x1a6848,'rows':_0x4ecbfd}:null;}})[_0xbc1d('0x15')](respondWithResult(_0x26fdc6,null))[_0xbc1d('0x27')](handleError(_0x26fdc6,null));};exports[_0xbc1d('0x53')]=function(_0xb624e1,_0x1188c9){var _0x27992a=_0xb624e1[_0xbc1d('0x34')]['ids'];return db[_0xbc1d('0x50')][_0xbc1d('0x25')]({'where':{'id':_0x27992a},'attributes':['id'],'include':[{'model':db[_0xbc1d('0x48')],'as':_0xbc1d('0x54'),'attributes':['id',_0xbc1d('0x1a'),_0xbc1d('0x55'),_0xbc1d('0x56'),'interface'],'raw':!![]}]})[_0xbc1d('0x15')](function(_0x3e7f35){if(_0x3e7f35){var _0x44c748=_[_0xbc1d('0x57')](_0x3e7f35,function(_0x371962){var _0x2db400=_0x371962[_0xbc1d('0x16')]({'plain':!![]});return _0x2db400[_0xbc1d('0x54')];});return db[_0xbc1d('0x1d')][_0xbc1d('0x38')]({'where':{'id':_0xb624e1[_0xbc1d('0x29')]['id']}})[_0xbc1d('0x15')](function(_0x4b0a44){return db['sequelize'][_0xbc1d('0x58')](function(_0x2e2698){return _0x4b0a44[_0xbc1d('0x53')](_0x27992a,{'transaction':_0x2e2698})[_0xbc1d('0x15')](function(){return BPromise['each'](_0x44c748,function(_0xee2ad7){return db[_0xbc1d('0x3f')][_0xbc1d('0x59')]({'where':{'UserId':_0xee2ad7['id'],'FaxQueueId':_0xb624e1['params']['id']},'transaction':_0x2e2698});});})[_0xbc1d('0x15')](function(){_0x44c748['forEach'](function(_0xfaac23){socket[_0xbc1d('0x5a')](_0xbc1d('0x5b'),{'UserId':_0xfaac23['id'],'FaxQueueId':_0x4b0a44['id']});});});});});}})['then'](respondWithStatusCode(_0x1188c9,null))[_0xbc1d('0x27')](handleError(_0x1188c9,null));};exports[_0xbc1d('0x5c')]=function(_0x58c01a,_0x4b682d){return db[_0xbc1d('0x50')][_0xbc1d('0x25')]({'where':{'id':_0x58c01a[_0xbc1d('0x24')][_0xbc1d('0x5d')]},'attributes':['id'],'include':[{'model':db[_0xbc1d('0x48')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xbc1d('0x15')](handleEntityNotFound(_0x4b682d,null))[_0xbc1d('0x15')](function(_0x17ab8f){var _0x51eec1=_[_0xbc1d('0x1c')](_0x17ab8f,'id');var _0x25a3a1=[];var _0x1d57b0=[];var _0x104402=squel[_0xbc1d('0x5e')]();_0x104402[_0xbc1d('0x5f')](_0xbc1d('0x60'))[_0xbc1d('0x61')](_0xbc1d('0x62'),'tq')['join']('user_has_teams','ut',_0xbc1d('0x63'))['where'](_0xbc1d('0x64'),_0x58c01a[_0xbc1d('0x29')]['id']);for(var _0x2efd25=0x0;_0x2efd25<_0x17ab8f['length'];_0x2efd25+=0x1){let _0x5e0182=_0x17ab8f[_0x2efd25];for(var _0x1bf1b2=0x0;_0x1bf1b2<_0x5e0182[_0xbc1d('0x54')][_0xbc1d('0x30')];_0x1bf1b2+=0x1){let _0x4e4389=_0x5e0182[_0xbc1d('0x54')][_0x1bf1b2];var _0x5f3ad6=_0x104402['clone']();_0x5f3ad6[_0xbc1d('0x22')](_0xbc1d('0x65'),_0x4e4389['id']);_0x1d57b0[_0xbc1d('0x66')](db[_0xbc1d('0x67')][_0xbc1d('0x24')](_0x5f3ad6['toString'](),{'type':db[_0xbc1d('0x67')][_0xbc1d('0x68')][_0xbc1d('0x69')]})[_0xbc1d('0x15')](function(_0x48a590){if(_0x48a590[_0xbc1d('0x30')]===0x1){return _0x4e4389['id'];}else{var _0x374d29=_[_0xbc1d('0x6a')](_['map'](_0x48a590,'TeamId'),function(_0x209c37){return _[_0xbc1d('0x6b')](_0x51eec1,_0x209c37);});if(_0x374d29){return _0x4e4389['id'];}}}));}}return BPromise['all'](_0x1d57b0)[_0xbc1d('0x15')](function(_0x20cabe){_0x25a3a1=_(_0x25a3a1)[_0xbc1d('0x6c')](_0x20cabe)['compact']()['value']();return db[_0xbc1d('0x1d')][_0xbc1d('0x38')]({'where':{'id':_0x58c01a['params']['id']}})[_0xbc1d('0x15')](function(_0x35870b){return db['sequelize'][_0xbc1d('0x58')](function(_0x328786){return _0x35870b[_0xbc1d('0x5c')](_0x58c01a['query'][_0xbc1d('0x5d')],{'transaction':_0x328786})[_0xbc1d('0x15')](function(){if(!_[_0xbc1d('0x6d')](_0x25a3a1)){return _0x35870b[_0xbc1d('0x6e')](_0x25a3a1,{'transaction':_0x328786});}})['then'](function(){_0x25a3a1[_0xbc1d('0x6f')](function(_0xe95686){socket[_0xbc1d('0x5a')]('userFaxQueue:remove',{'UserId':_0xe95686,'FaxQueueId':_0x35870b['id']});});});});});});})['then'](respondWithStatusCode(_0x4b682d,null))[_0xbc1d('0x27')](handleError(_0x4b682d,null));};exports[_0xbc1d('0x70')]=function(_0x4bbac2,_0x350a82){return db['FaxQueue'][_0xbc1d('0x38')]({'where':{'id':_0x4bbac2[_0xbc1d('0x29')]['id']}})[_0xbc1d('0x15')](handleEntityNotFound(_0x350a82,null))[_0xbc1d('0x15')](function(_0xb60aba){if(_0xb60aba){return _0xb60aba[_0xbc1d('0x70')](_0x4bbac2['body']['ids'],_['omit'](_0x4bbac2[_0xbc1d('0x34')],[_0xbc1d('0x5d'),'id'])||{})[_0xbc1d('0x71')](function(_0x4834c2){for(var _0x164dcb=0x0;_0x164dcb<_0x4bbac2[_0xbc1d('0x34')][_0xbc1d('0x5d')][_0xbc1d('0x30')];_0x164dcb+=0x1){socket[_0xbc1d('0x5a')](_0xbc1d('0x5b'),{'UserId':Number(_0x4bbac2[_0xbc1d('0x34')][_0xbc1d('0x5d')][_0x164dcb]),'FaxQueueId':Number(_0x4bbac2[_0xbc1d('0x29')]['id'])});}return _0x4834c2;});}})['then'](respondWithResult(_0x350a82,null))[_0xbc1d('0x27')](handleError(_0x350a82,null));};exports[_0xbc1d('0x6e')]=function(_0x18ad2e,_0x55f5f4){return db[_0xbc1d('0x1d')][_0xbc1d('0x38')]({'where':{'id':_0x18ad2e[_0xbc1d('0x29')]['id']}})[_0xbc1d('0x15')](handleEntityNotFound(_0x55f5f4,null))[_0xbc1d('0x15')](function(_0x10c8d1){if(_0x10c8d1){return _0x10c8d1[_0xbc1d('0x6e')](_0x18ad2e[_0xbc1d('0x24')][_0xbc1d('0x5d')])['then'](function(){if(_[_0xbc1d('0x72')](_0x18ad2e[_0xbc1d('0x24')][_0xbc1d('0x5d')])){for(var _0x12b3a0=0x0;_0x12b3a0<_0x18ad2e[_0xbc1d('0x24')][_0xbc1d('0x5d')][_0xbc1d('0x30')];_0x12b3a0+=0x1){socket[_0xbc1d('0x5a')](_0xbc1d('0x73'),{'UserId':Number(_0x18ad2e[_0xbc1d('0x24')][_0xbc1d('0x5d')][_0x12b3a0]),'FaxQueueId':Number(_0x18ad2e[_0xbc1d('0x29')]['id'])});}}else{socket[_0xbc1d('0x5a')](_0xbc1d('0x73'),{'UserId':Number(_0x18ad2e['query'][_0xbc1d('0x5d')]),'FaxQueueId':Number(_0x18ad2e['params']['id'])});}});}})[_0xbc1d('0x15')](respondWithStatusCode(_0x55f5f4,null))[_0xbc1d('0x27')](handleError(_0x55f5f4,null));};exports['getAgents']=function(_0x1e8910,_0x2febf6){var _0x51be9c={};var _0x4855be={};var _0x5001a3;var _0x56998a;return db[_0xbc1d('0x1d')]['findOne']({'where':{'id':_0x1e8910[_0xbc1d('0x29')]['id']}})[_0xbc1d('0x15')](handleEntityNotFound(_0x2febf6,null))['then'](function(_0x36332e){if(_0x36332e){_0x5001a3=_0x36332e;_0x4855be[_0xbc1d('0x2a')]=_['keys'](db[_0xbc1d('0x48')][_0xbc1d('0x2b')]);_0x4855be[_0xbc1d('0x24')]=_[_0xbc1d('0x2c')](_0x1e8910['query']);_0x4855be[_0xbc1d('0x2d')]=_[_0xbc1d('0x40')](_0x4855be[_0xbc1d('0x2a')],_0x4855be[_0xbc1d('0x24')]);_0x51be9c[_0xbc1d('0x2e')]=_[_0xbc1d('0x40')](_0x4855be[_0xbc1d('0x2a')],qs[_0xbc1d('0x2f')](_0x1e8910['query'][_0xbc1d('0x2f')]));_0x51be9c[_0xbc1d('0x2e')]=_0x51be9c[_0xbc1d('0x2e')][_0xbc1d('0x30')]?_0x51be9c[_0xbc1d('0x2e')]:_0x4855be[_0xbc1d('0x2a')];_0x51be9c['order']=qs[_0xbc1d('0x43')](_0x1e8910['query'][_0xbc1d('0x43')]);_0x51be9c[_0xbc1d('0x22')]=qs[_0xbc1d('0x2d')](_[_0xbc1d('0x44')](_0x1e8910[_0xbc1d('0x24')],_0x4855be[_0xbc1d('0x2d')]));if(_0x1e8910['query'][_0xbc1d('0x46')]){_0x51be9c['where']=_[_0xbc1d('0x32')](_0x51be9c['where'],{'$or':_[_0xbc1d('0x1c')](_0x51be9c[_0xbc1d('0x2e')],function(_0x3147d6){var _0x167757={};_0x167757[_0x3147d6]={'$like':'%'+_0x1e8910[_0xbc1d('0x24')][_0xbc1d('0x46')]+'%'};return _0x167757;})});}_0x51be9c=_[_0xbc1d('0x32')]({},_0x51be9c,_0x1e8910[_0xbc1d('0x47')]);return _0x5001a3[_0xbc1d('0x74')](_0x51be9c);}})[_0xbc1d('0x15')](function(_0x2b615d){if(_0x2b615d){_0x56998a=_0x2b615d[_0xbc1d('0x30')];if(!_0x1e8910[_0xbc1d('0x24')]['hasOwnProperty'](_0xbc1d('0x42'))){_0x51be9c[_0xbc1d('0x12')]=qs[_0xbc1d('0x12')](_0x1e8910[_0xbc1d('0x24')][_0xbc1d('0x12')]);_0x51be9c['offset']=qs[_0xbc1d('0xf')](_0x1e8910[_0xbc1d('0x24')][_0xbc1d('0xf')]);}return _0x5001a3[_0xbc1d('0x74')](_0x51be9c);}})['then'](function(_0x4d5c17){if(_0x4d5c17){return _0x4d5c17?{'count':_0x56998a,'rows':_0x4d5c17}:null;}})[_0xbc1d('0x15')](respondWithResult(_0x2febf6,null))[_0xbc1d('0x27')](handleError(_0x2febf6,null));}; \ No newline at end of file +var _0x3837=['redis','localhost','socket.io-emitter','./faxQueue.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','update','destroy','then','get','FaxQueues','UserProfileResource','error','name','send','index','map','FaxQueue','rawAttributes','fieldName','key','getOptions','where','include','query','rows','catch','show','params','model','keys','filters','intersection','fields','attributes','length','includeAll','merge','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserFaxQueue','hasOwnProperty','nolimit','order','sort','pick','filter','User','findAndCountAll','UserId','%s/%s','faxPause','createdAt','getTeams','Team','addTeams','ids','online','voicePause','sequelize','each','findOrCreate','forEach','emit','removeTeams','findAll','Agents','select','field','tq.TeamId','from','team_has_fax_queues','join','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','clone','push','QueryTypes','SELECT','TeamId','includes','all','compact','value','transaction','isEmpty','removeAgents','userFaxQueue:remove','addAgents','omit','spread','getAgents','util','squel','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3837,0x1d1));var _0x7383=function(_0x1bcf95,_0x2dc284){_0x1bcf95=_0x1bcf95-0x0;var _0x6affd0=_0x3837[_0x1bcf95];return _0x6affd0;};'use strict';var BPromise=require('bluebird');var util=require(_0x7383('0x0'));var _=require('lodash');var squel=require(_0x7383('0x1'));var Redis=require('ioredis');var qs=require(_0x7383('0x2'));var logger=require(_0x7383('0x3'))(_0x7383('0x4'));var config=require(_0x7383('0x5'));var db=require(_0x7383('0x6'))['db'];config['redis']=_['defaults'](config[_0x7383('0x7')],{'host':_0x7383('0x8'),'port':0x18eb});var socket=require(_0x7383('0x9'))(new Redis(config[_0x7383('0x7')]));require(_0x7383('0xa'))[_0x7383('0xb')](socket);function respondWithStatusCode(_0x1dc05a,_0x4b3303){_0x4b3303=_0x4b3303||0xcc;return function(_0x922b0){if(_0x922b0){return _0x1dc05a[_0x7383('0xc')](_0x4b3303);}return _0x1dc05a[_0x7383('0xd')](_0x4b3303)[_0x7383('0xe')]();};}function respondWithResult(_0x3d2d47,_0x2dcdc9){_0x2dcdc9=_0x2dcdc9||0xc8;return function(_0x19f134){if(_0x19f134){return _0x3d2d47['status'](_0x2dcdc9)[_0x7383('0xf')](_0x19f134);}};}function respondWithFilteredResult(_0x5ba02f,_0x1d2221){return function(_0x3c29dc){if(_0x3c29dc){var _0x3f135b=typeof _0x1d2221[_0x7383('0x10')]===_0x7383('0x11')&&typeof _0x1d2221[_0x7383('0x12')]===_0x7383('0x11');var _0x24be15=_0x3c29dc[_0x7383('0x13')];var _0x5b018f=_0x3f135b?0x0:_0x1d2221[_0x7383('0x10')];var _0x3a2c78=_0x3f135b?_0x3c29dc[_0x7383('0x13')]:_0x1d2221[_0x7383('0x10')]+_0x1d2221['limit'];var _0x566949;if(_0x3a2c78>=_0x24be15){_0x3a2c78=_0x24be15;_0x566949=0xc8;}else{_0x566949=0xce;}_0x5ba02f['status'](_0x566949);return _0x5ba02f['set'](_0x7383('0x14'),_0x5b018f+'-'+_0x3a2c78+'/'+_0x24be15)[_0x7383('0xf')](_0x3c29dc);}return null;};}function saveUpdates(_0x320cf5){return function(_0x5ae49f){if(_0x5ae49f){return _0x5ae49f[_0x7383('0x15')](_0x320cf5)['then'](function(_0x1cf7bb){return _0x1cf7bb;});}return null;};}function removeEntity(_0x2db022){return function(_0x1c7645){if(_0x1c7645){return _0x1c7645[_0x7383('0x16')]()[_0x7383('0x17')](function(){var _0x29cab0=_0x1c7645[_0x7383('0x18')]({'plain':!![]});var _0xc491c1=_0x7383('0x19');return db[_0x7383('0x1a')]['destroy']({'where':{'type':_0xc491c1,'resourceId':_0x29cab0['id']}})[_0x7383('0x17')](function(){return _0x1c7645;});})[_0x7383('0x17')](function(){_0x2db022[_0x7383('0xd')](0xcc)['end']();});}};}function handleEntityNotFound(_0x183ccb){return function(_0xff5467){if(!_0xff5467){_0x183ccb['sendStatus'](0x194);}return _0xff5467;};}function handleError(_0x316204,_0x57420d){_0x57420d=_0x57420d||0x1f4;return function(_0x1e2e79){logger[_0x7383('0x1b')](_0x1e2e79['stack']);if(_0x1e2e79[_0x7383('0x1c')]){delete _0x1e2e79[_0x7383('0x1c')];}_0x316204[_0x7383('0xd')](_0x57420d)[_0x7383('0x1d')](_0x1e2e79);};}exports[_0x7383('0x1e')]=function(_0x523525,_0x313cb0){var _0x5eaf6a={};var _0x4c3e40={'count':0x0,'rows':[]};var _0x388964=_[_0x7383('0x1f')](db[_0x7383('0x20')][_0x7383('0x21')],function(_0x4a1840){return{'name':_0x4a1840[_0x7383('0x22')],'type':_0x4a1840['type'][_0x7383('0x23')]};});_0x5eaf6a=qs[_0x7383('0x24')](_0x388964,_0x523525);var _0x15717e={'where':_0x5eaf6a[_0x7383('0x25')]};return db[_0x7383('0x20')][_0x7383('0x13')](_0x15717e)[_0x7383('0x17')](function(_0x43f7a5){_0x4c3e40[_0x7383('0x13')]=_0x43f7a5;_0x5eaf6a[_0x7383('0x26')]=qs['include'](_0x523525[_0x7383('0x27')]);return db[_0x7383('0x20')]['findAll'](_0x5eaf6a);})['then'](function(_0x4bdff3){_0x4c3e40[_0x7383('0x28')]=_0x4bdff3;return _0x4c3e40;})[_0x7383('0x17')](respondWithFilteredResult(_0x313cb0,_0x5eaf6a))[_0x7383('0x29')](handleError(_0x313cb0,null));};exports[_0x7383('0x2a')]=function(_0x2a61d7,_0x265298){var _0x1cb868={'raw':!![],'where':{'id':_0x2a61d7[_0x7383('0x2b')]['id']}},_0x8b3817={};_0x8b3817[_0x7383('0x2c')]=_[_0x7383('0x2d')](db[_0x7383('0x20')][_0x7383('0x21')]);_0x8b3817[_0x7383('0x27')]=_[_0x7383('0x2d')](_0x2a61d7[_0x7383('0x27')]);_0x8b3817[_0x7383('0x2e')]=_[_0x7383('0x2f')](_0x8b3817[_0x7383('0x2c')],_0x8b3817[_0x7383('0x27')]);_0x1cb868['attributes']=_[_0x7383('0x2f')](_0x8b3817[_0x7383('0x2c')],qs['fields'](_0x2a61d7[_0x7383('0x27')][_0x7383('0x30')]));_0x1cb868[_0x7383('0x31')]=_0x1cb868[_0x7383('0x31')][_0x7383('0x32')]?_0x1cb868['attributes']:_0x8b3817[_0x7383('0x2c')];if(_0x2a61d7[_0x7383('0x27')][_0x7383('0x33')]){_0x1cb868[_0x7383('0x26')]=[{'all':!![]}];}_0x1cb868=_[_0x7383('0x34')]({},_0x1cb868,_0x2a61d7[_0x7383('0x35')]);return db[_0x7383('0x20')]['find'](_0x1cb868)['then'](handleEntityNotFound(_0x265298,null))['then'](respondWithResult(_0x265298,null))[_0x7383('0x29')](handleError(_0x265298,null));};exports[_0x7383('0x36')]=function(_0x212d5b,_0x3d71dc){return db[_0x7383('0x20')][_0x7383('0x36')](_0x212d5b[_0x7383('0x37')],{})[_0x7383('0x17')](function(_0x320cde){var _0x4f307a=_0x212d5b[_0x7383('0x38')][_0x7383('0x18')]({'plain':!![]});if(!_0x4f307a)throw new Error(_0x7383('0x39'));if(_0x4f307a[_0x7383('0x3a')]===_0x7383('0x38')){var _0x34f585=_0x320cde['get']({'plain':!![]});var _0x32a9a7='FaxQueues';return db['UserProfileSection'][_0x7383('0x3b')]({'where':{'name':_0x32a9a7,'userProfileId':_0x4f307a[_0x7383('0x3c')]},'raw':!![]})[_0x7383('0x17')](function(_0x3f14a6){if(_0x3f14a6&&_0x3f14a6[_0x7383('0x3d')]===0x0){return db['UserProfileResource']['create']({'name':_0x34f585[_0x7383('0x1c')],'resourceId':_0x34f585['id'],'type':_0x3f14a6[_0x7383('0x1c')],'sectionId':_0x3f14a6['id']},{})['then'](function(){return _0x320cde;});}else{return _0x320cde;}})['catch'](function(_0x271cd5){logger[_0x7383('0x1b')](_0x7383('0x3e'),_0x271cd5);throw _0x271cd5;});}return _0x320cde;})[_0x7383('0x17')](respondWithResult(_0x3d71dc,0xc9))[_0x7383('0x29')](handleError(_0x3d71dc,null));};exports['update']=function(_0x141728,_0x5d9085){if(_0x141728[_0x7383('0x37')]['id']){delete _0x141728[_0x7383('0x37')]['id'];}return db[_0x7383('0x20')][_0x7383('0x3b')]({'where':{'id':_0x141728['params']['id']}})[_0x7383('0x17')](handleEntityNotFound(_0x5d9085,null))[_0x7383('0x17')](saveUpdates(_0x141728[_0x7383('0x37')],null))[_0x7383('0x17')](respondWithResult(_0x5d9085,null))['catch'](handleError(_0x5d9085,null));};exports[_0x7383('0x16')]=function(_0x308a0f,_0xf5e74d){return db[_0x7383('0x20')][_0x7383('0x3b')]({'where':{'id':_0x308a0f[_0x7383('0x2b')]['id']}})[_0x7383('0x17')](handleEntityNotFound(_0xf5e74d,null))[_0x7383('0x17')](removeEntity(_0xf5e74d,null))[_0x7383('0x29')](handleError(_0xf5e74d,null));};exports[_0x7383('0x3f')]=function(_0x3efb4e,_0x2ca610){return db[_0x7383('0x20')]['describe']()[_0x7383('0x17')](respondWithResult(_0x2ca610,null))['catch'](handleError(_0x2ca610,null));};exports[_0x7383('0x40')]=function(_0x322af1,_0x40b29a){var _0x577526={'raw':!![],'where':{}},_0x163343={},_0x2c0e53;return db['FaxQueue'][_0x7383('0x41')]({'where':{'id':_0x322af1['params']['id']}})[_0x7383('0x17')](handleEntityNotFound(_0x40b29a,null))['then'](function(_0x39fe70){if(_0x39fe70){_0x2c0e53=_0x39fe70['get']({'plain':!![]});_0x163343[_0x7383('0x2c')]=_[_0x7383('0x2d')](db[_0x7383('0x42')]['rawAttributes']);_0x163343[_0x7383('0x27')]=_[_0x7383('0x2d')](_0x322af1[_0x7383('0x27')]);_0x163343['filters']=_['intersection'](_0x163343[_0x7383('0x2c')],_0x163343[_0x7383('0x27')]);_0x577526[_0x7383('0x31')]=_[_0x7383('0x2f')](_0x163343[_0x7383('0x2c')],qs[_0x7383('0x30')](_0x322af1[_0x7383('0x27')][_0x7383('0x30')]));_0x577526[_0x7383('0x31')]=_0x577526[_0x7383('0x31')]['length']?_0x577526[_0x7383('0x31')]:_0x163343[_0x7383('0x2c')];if(!_0x322af1[_0x7383('0x27')][_0x7383('0x43')](_0x7383('0x44'))){_0x577526['limit']=qs[_0x7383('0x12')](_0x322af1[_0x7383('0x27')]['limit']);_0x577526[_0x7383('0x10')]=qs[_0x7383('0x10')](_0x322af1[_0x7383('0x27')][_0x7383('0x10')]);}_0x577526[_0x7383('0x45')]=qs[_0x7383('0x46')](_0x322af1[_0x7383('0x27')][_0x7383('0x46')]);_0x577526[_0x7383('0x25')]=qs[_0x7383('0x2e')](_[_0x7383('0x47')](_0x322af1[_0x7383('0x27')],_0x163343[_0x7383('0x2e')]));_0x577526[_0x7383('0x25')]['FaxQueueId']=_0x39fe70['id'];if(_0x322af1[_0x7383('0x27')]['filter']){_0x577526[_0x7383('0x25')]=_[_0x7383('0x34')](_0x577526['where'],{'$or':_[_0x7383('0x1f')](_0x577526[_0x7383('0x31')],function(_0x1188c8){var _0x56abd5={};_0x56abd5[_0x1188c8]={'$like':'%'+_0x322af1[_0x7383('0x27')][_0x7383('0x48')]+'%'};return _0x56abd5;})});}_0x577526=_[_0x7383('0x34')]({},_0x577526,_0x322af1['options']);return db[_0x7383('0x42')]['findAll'](_0x577526);}})[_0x7383('0x17')](function(_0x5b3431){if(_0x5b3431){return db[_0x7383('0x49')][_0x7383('0x4a')]({'where':{'id':_[_0x7383('0x1f')](_0x5b3431,_0x7383('0x4b')),'role':'agent'},'attributes':['id',_0x7383('0x1c'),'faxPause','updatedAt','createdAt']});}})[_0x7383('0x17')](function(_0x3c00b7){if(_0x3c00b7){return{'count':_0x3c00b7[_0x7383('0x13')],'rows':_[_0x7383('0x1f')](_0x3c00b7[_0x7383('0x28')],function(_0xb3cc23){return{'membername':_0xb3cc23[_0x7383('0x1c')],'UserId':_0xb3cc23['id'],'queue_name':_0x2c0e53['name'],'FaxQueueId':_0x2c0e53['id'],'interface':util['format'](_0x7383('0x4c'),'SIP',_0xb3cc23[_0x7383('0x1c')]),'penalty':0x0,'paused':_0xb3cc23[_0x7383('0x4d')],'createdAt':_0xb3cc23[_0x7383('0x4e')],'updatedAt':_0xb3cc23['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x40b29a,_0x577526))[_0x7383('0x29')](handleError(_0x40b29a,null));};exports[_0x7383('0x4f')]=function(_0x36dee6,_0x2796b7){var _0x3965f8={};var _0x2d888f={};var _0x1676f8;var _0x397b41;return db['FaxQueue'][_0x7383('0x41')]({'where':{'id':_0x36dee6[_0x7383('0x2b')]['id']}})[_0x7383('0x17')](handleEntityNotFound(_0x2796b7,null))[_0x7383('0x17')](function(_0x35d228){if(_0x35d228){_0x1676f8=_0x35d228;_0x2d888f[_0x7383('0x2c')]=_[_0x7383('0x2d')](db[_0x7383('0x50')][_0x7383('0x21')]);_0x2d888f[_0x7383('0x27')]=_[_0x7383('0x2d')](_0x36dee6[_0x7383('0x27')]);_0x2d888f[_0x7383('0x2e')]=_[_0x7383('0x2f')](_0x2d888f['model'],_0x2d888f[_0x7383('0x27')]);_0x3965f8[_0x7383('0x31')]=_[_0x7383('0x2f')](_0x2d888f[_0x7383('0x2c')],qs[_0x7383('0x30')](_0x36dee6[_0x7383('0x27')][_0x7383('0x30')]));_0x3965f8[_0x7383('0x31')]=_0x3965f8['attributes'][_0x7383('0x32')]?_0x3965f8[_0x7383('0x31')]:_0x2d888f['model'];_0x3965f8[_0x7383('0x45')]=qs[_0x7383('0x46')](_0x36dee6[_0x7383('0x27')][_0x7383('0x46')]);_0x3965f8['where']=qs[_0x7383('0x2e')](_[_0x7383('0x47')](_0x36dee6['query'],_0x2d888f[_0x7383('0x2e')]));if(_0x36dee6[_0x7383('0x27')][_0x7383('0x48')]){_0x3965f8['where']=_[_0x7383('0x34')](_0x3965f8[_0x7383('0x25')],{'$or':_[_0x7383('0x1f')](_0x3965f8[_0x7383('0x31')],function(_0x44578c){var _0x1c00f8={};_0x1c00f8[_0x44578c]={'$like':'%'+_0x36dee6[_0x7383('0x27')][_0x7383('0x48')]+'%'};return _0x1c00f8;})});}_0x3965f8=_[_0x7383('0x34')]({},_0x3965f8,_0x36dee6['options']);return _0x1676f8[_0x7383('0x4f')](_0x3965f8);}})[_0x7383('0x17')](function(_0x15aab7){if(_0x15aab7){_0x397b41=_0x15aab7['length'];if(!_0x36dee6[_0x7383('0x27')][_0x7383('0x43')](_0x7383('0x44'))){_0x3965f8[_0x7383('0x12')]=qs[_0x7383('0x12')](_0x36dee6['query']['limit']);_0x3965f8['offset']=qs['offset'](_0x36dee6[_0x7383('0x27')][_0x7383('0x10')]);}return _0x1676f8[_0x7383('0x4f')](_0x3965f8);}})[_0x7383('0x17')](function(_0x44de91){if(_0x44de91){return _0x44de91?{'count':_0x397b41,'rows':_0x44de91}:null;}})[_0x7383('0x17')](respondWithResult(_0x2796b7,null))['catch'](handleError(_0x2796b7,null));};exports[_0x7383('0x51')]=function(_0x3b777c,_0x2b032f){var _0x3dd528=_0x3b777c[_0x7383('0x37')][_0x7383('0x52')];return db[_0x7383('0x50')]['findAll']({'where':{'id':_0x3dd528},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id',_0x7383('0x1c'),_0x7383('0x53'),_0x7383('0x54'),'interface'],'raw':!![]}]})[_0x7383('0x17')](function(_0x234f3b){if(_0x234f3b){var _0x333d72=_['flatMap'](_0x234f3b,function(_0x351c8a){var _0x34d614=_0x351c8a[_0x7383('0x18')]({'plain':!![]});return _0x34d614['Agents'];});return db[_0x7383('0x20')][_0x7383('0x3b')]({'where':{'id':_0x3b777c[_0x7383('0x2b')]['id']}})[_0x7383('0x17')](function(_0x3633ae){return db[_0x7383('0x55')]['transaction'](function(_0x3d6aa7){return _0x3633ae[_0x7383('0x51')](_0x3dd528,{'transaction':_0x3d6aa7})['then'](function(){return BPromise[_0x7383('0x56')](_0x333d72,function(_0x438028){return db['UserFaxQueue'][_0x7383('0x57')]({'where':{'UserId':_0x438028['id'],'FaxQueueId':_0x3b777c[_0x7383('0x2b')]['id']},'transaction':_0x3d6aa7});});})[_0x7383('0x17')](function(){_0x333d72[_0x7383('0x58')](function(_0x3f7130){socket[_0x7383('0x59')]('userFaxQueue:save',{'UserId':_0x3f7130['id'],'FaxQueueId':_0x3633ae['id']});});});});});}})['then'](respondWithStatusCode(_0x2b032f,null))[_0x7383('0x29')](handleError(_0x2b032f,null));};exports[_0x7383('0x5a')]=function(_0x39be07,_0x1102be){return db[_0x7383('0x50')][_0x7383('0x5b')]({'where':{'id':_0x39be07[_0x7383('0x27')]['ids']},'attributes':['id'],'include':[{'model':db[_0x7383('0x49')],'as':_0x7383('0x5c'),'attributes':['id'],'raw':!![]}]})[_0x7383('0x17')](handleEntityNotFound(_0x1102be,null))['then'](function(_0x3b444a){var _0x1c5f94=_[_0x7383('0x1f')](_0x3b444a,'id');var _0x3b569f=[];var _0x165841=[];var _0x2b4804=squel[_0x7383('0x5d')]();_0x2b4804[_0x7383('0x5e')](_0x7383('0x5f'))[_0x7383('0x60')](_0x7383('0x61'),'tq')[_0x7383('0x62')]('user_has_teams','ut',_0x7383('0x63'))[_0x7383('0x25')](_0x7383('0x64'),_0x39be07[_0x7383('0x2b')]['id']);for(var _0x407a06=0x0;_0x407a06<_0x3b444a[_0x7383('0x32')];_0x407a06+=0x1){let _0x1ddbbb=_0x3b444a[_0x407a06];for(var _0x164008=0x0;_0x164008<_0x1ddbbb['Agents'][_0x7383('0x32')];_0x164008+=0x1){let _0x37ed30=_0x1ddbbb['Agents'][_0x164008];var _0x18da01=_0x2b4804[_0x7383('0x65')]();_0x18da01['where']('ut.UserId\x20=\x20?',_0x37ed30['id']);_0x165841[_0x7383('0x66')](db[_0x7383('0x55')]['query'](_0x18da01['toString'](),{'type':db[_0x7383('0x55')][_0x7383('0x67')][_0x7383('0x68')]})['then'](function(_0x5b17a9){if(_0x5b17a9[_0x7383('0x32')]===0x1){return _0x37ed30['id'];}else{var _0x5543d8=_['every'](_[_0x7383('0x1f')](_0x5b17a9,_0x7383('0x69')),function(_0x4d9afb){return _[_0x7383('0x6a')](_0x1c5f94,_0x4d9afb);});if(_0x5543d8){return _0x37ed30['id'];}}}));}}return BPromise[_0x7383('0x6b')](_0x165841)[_0x7383('0x17')](function(_0x2b3b1d){_0x3b569f=_(_0x3b569f)['union'](_0x2b3b1d)[_0x7383('0x6c')]()[_0x7383('0x6d')]();return db[_0x7383('0x20')][_0x7383('0x3b')]({'where':{'id':_0x39be07[_0x7383('0x2b')]['id']}})['then'](function(_0x187555){return db[_0x7383('0x55')][_0x7383('0x6e')](function(_0x3c3fde){return _0x187555[_0x7383('0x5a')](_0x39be07[_0x7383('0x27')][_0x7383('0x52')],{'transaction':_0x3c3fde})[_0x7383('0x17')](function(){if(!_[_0x7383('0x6f')](_0x3b569f)){return _0x187555[_0x7383('0x70')](_0x3b569f,{'transaction':_0x3c3fde});}})[_0x7383('0x17')](function(){_0x3b569f[_0x7383('0x58')](function(_0x126d7b){socket['emit'](_0x7383('0x71'),{'UserId':_0x126d7b,'FaxQueueId':_0x187555['id']});});});});});});})[_0x7383('0x17')](respondWithStatusCode(_0x1102be,null))['catch'](handleError(_0x1102be,null));};exports[_0x7383('0x72')]=function(_0x3d5f5c,_0xafcae){return db['FaxQueue']['find']({'where':{'id':_0x3d5f5c[_0x7383('0x2b')]['id']}})[_0x7383('0x17')](handleEntityNotFound(_0xafcae,null))[_0x7383('0x17')](function(_0x150ea6){if(_0x150ea6){return _0x150ea6[_0x7383('0x72')](_0x3d5f5c[_0x7383('0x37')][_0x7383('0x52')],_[_0x7383('0x73')](_0x3d5f5c[_0x7383('0x37')],[_0x7383('0x52'),'id'])||{})[_0x7383('0x74')](function(_0x29e347){for(var _0x4c635b=0x0;_0x4c635b<_0x3d5f5c[_0x7383('0x37')][_0x7383('0x52')][_0x7383('0x32')];_0x4c635b+=0x1){socket[_0x7383('0x59')]('userFaxQueue:save',{'UserId':Number(_0x3d5f5c[_0x7383('0x37')]['ids'][_0x4c635b]),'FaxQueueId':Number(_0x3d5f5c[_0x7383('0x2b')]['id'])});}return _0x29e347;});}})[_0x7383('0x17')](respondWithResult(_0xafcae,null))[_0x7383('0x29')](handleError(_0xafcae,null));};exports[_0x7383('0x70')]=function(_0x9974d3,_0x66aef3){return db[_0x7383('0x20')][_0x7383('0x3b')]({'where':{'id':_0x9974d3['params']['id']}})[_0x7383('0x17')](handleEntityNotFound(_0x66aef3,null))['then'](function(_0x1cbd71){if(_0x1cbd71){return _0x1cbd71[_0x7383('0x70')](_0x9974d3['query'][_0x7383('0x52')])[_0x7383('0x17')](function(){if(_['isArray'](_0x9974d3['query'][_0x7383('0x52')])){for(var _0xd40792=0x0;_0xd40792<_0x9974d3[_0x7383('0x27')][_0x7383('0x52')]['length'];_0xd40792+=0x1){socket[_0x7383('0x59')](_0x7383('0x71'),{'UserId':Number(_0x9974d3['query']['ids'][_0xd40792]),'FaxQueueId':Number(_0x9974d3[_0x7383('0x2b')]['id'])});}}else{socket['emit'](_0x7383('0x71'),{'UserId':Number(_0x9974d3[_0x7383('0x27')][_0x7383('0x52')]),'FaxQueueId':Number(_0x9974d3[_0x7383('0x2b')]['id'])});}});}})[_0x7383('0x17')](respondWithStatusCode(_0x66aef3,null))['catch'](handleError(_0x66aef3,null));};exports['getAgents']=function(_0x50f878,_0x431647){var _0x17f379={};var _0x3a0f3b={};var _0x516b2c;var _0x280634;return db[_0x7383('0x20')][_0x7383('0x41')]({'where':{'id':_0x50f878['params']['id']}})[_0x7383('0x17')](handleEntityNotFound(_0x431647,null))[_0x7383('0x17')](function(_0x488515){if(_0x488515){_0x516b2c=_0x488515;_0x3a0f3b[_0x7383('0x2c')]=_[_0x7383('0x2d')](db[_0x7383('0x49')]['rawAttributes']);_0x3a0f3b[_0x7383('0x27')]=_[_0x7383('0x2d')](_0x50f878['query']);_0x3a0f3b['filters']=_[_0x7383('0x2f')](_0x3a0f3b[_0x7383('0x2c')],_0x3a0f3b['query']);_0x17f379[_0x7383('0x31')]=_['intersection'](_0x3a0f3b[_0x7383('0x2c')],qs['fields'](_0x50f878['query'][_0x7383('0x30')]));_0x17f379['attributes']=_0x17f379[_0x7383('0x31')][_0x7383('0x32')]?_0x17f379[_0x7383('0x31')]:_0x3a0f3b[_0x7383('0x2c')];_0x17f379[_0x7383('0x45')]=qs['sort'](_0x50f878[_0x7383('0x27')]['sort']);_0x17f379[_0x7383('0x25')]=qs[_0x7383('0x2e')](_[_0x7383('0x47')](_0x50f878[_0x7383('0x27')],_0x3a0f3b[_0x7383('0x2e')]));if(_0x50f878[_0x7383('0x27')]['filter']){_0x17f379[_0x7383('0x25')]=_['merge'](_0x17f379[_0x7383('0x25')],{'$or':_['map'](_0x17f379[_0x7383('0x31')],function(_0x25eb8a){var _0x1b9ffb={};_0x1b9ffb[_0x25eb8a]={'$like':'%'+_0x50f878[_0x7383('0x27')][_0x7383('0x48')]+'%'};return _0x1b9ffb;})});}_0x17f379=_[_0x7383('0x34')]({},_0x17f379,_0x50f878[_0x7383('0x35')]);return _0x516b2c['getAgents'](_0x17f379);}})[_0x7383('0x17')](function(_0x5ea04b){if(_0x5ea04b){_0x280634=_0x5ea04b['length'];if(!_0x50f878[_0x7383('0x27')][_0x7383('0x43')](_0x7383('0x44'))){_0x17f379['limit']=qs[_0x7383('0x12')](_0x50f878[_0x7383('0x27')][_0x7383('0x12')]);_0x17f379['offset']=qs['offset'](_0x50f878[_0x7383('0x27')][_0x7383('0x10')]);}return _0x516b2c[_0x7383('0x75')](_0x17f379);}})[_0x7383('0x17')](function(_0x466319){if(_0x466319){return _0x466319?{'count':_0x280634,'rows':_0x466319}:null;}})[_0x7383('0x17')](respondWithResult(_0x431647,null))[_0x7383('0x29')](handleError(_0x431647,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index 93618fa..a5999f4 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 _0x75d6=['hook','exports','../../mysqldb','FaxQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x75d6,0x188));var _0x675d=function(_0x400b43,_0x55da4e){_0x400b43=_0x400b43-0x0;var _0x3c330f=_0x75d6[_0x400b43];return _0x3c330f;};'use strict';var EventEmitter=require('events');var FaxQueue=require(_0x675d('0x0'))['db'][_0x675d('0x1')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x675d('0x2')](0x0);var events={'afterCreate':_0x675d('0x3'),'afterUpdate':_0x675d('0x4'),'afterDestroy':_0x675d('0x5')};function emitEvent(_0x320e57){return function(_0x8137cc,_0x4a1d5f,_0x366147){FaxQueueEvents[_0x675d('0x6')](_0x320e57+':'+_0x8137cc['id'],_0x8137cc);FaxQueueEvents[_0x675d('0x6')](_0x320e57,_0x8137cc);_0x366147(null);};}for(var e in events){if(events[_0x675d('0x7')](e)){var event=events[e];FaxQueue[_0x675d('0x8')](e,emitEvent(event));}}module[_0x675d('0x9')]=FaxQueueEvents; \ No newline at end of file +var _0x7303=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','update'];(function(_0x500a85,_0x355900){var _0xa10cee=function(_0x49dada){while(--_0x49dada){_0x500a85['push'](_0x500a85['shift']());}};_0xa10cee(++_0x355900);}(_0x7303,0x17f));var _0x3730=function(_0x57dbf2,_0xc07a4e){_0x57dbf2=_0x57dbf2-0x0;var _0x587ce2=_0x7303[_0x57dbf2];return _0x587ce2;};'use strict';var EventEmitter=require(_0x3730('0x0'));var FaxQueue=require(_0x3730('0x1'))['db']['FaxQueue'];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x3730('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x3730('0x3'),'afterDestroy':_0x3730('0x4')};function emitEvent(_0x164050){return function(_0x20da5a,_0x297675,_0x4c3e83){FaxQueueEvents[_0x3730('0x5')](_0x164050+':'+_0x20da5a['id'],_0x20da5a);FaxQueueEvents[_0x3730('0x5')](_0x164050,_0x20da5a);_0x4c3e83(null);};}for(var e in events){if(events[_0x3730('0x6')](e)){var event=events[e];FaxQueue[_0x3730('0x7')](e,emitEvent(event));}}module[_0x3730('0x8')]=FaxQueueEvents; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.model.js b/server/api/faxQueue/faxQueue.model.js index f96bb6e..e5b25c8 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 _0x6345=['define','FaxQueue','fax_queues','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./faxQueue.attributes'];(function(_0x4ae6da,_0x2e67c7){var _0x2e4a5f=function(_0x53d109){while(--_0x53d109){_0x4ae6da['push'](_0x4ae6da['shift']());}};_0x2e4a5f(++_0x2e67c7);}(_0x6345,0x1e3));var _0x5634=function(_0x31796e,_0x281e0a){_0x31796e=_0x31796e-0x0;var _0x22d91f=_0x6345[_0x31796e];return _0x22d91f;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x5634('0x0'))(_0x5634('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x5634('0x2'));var fs=require('fs');var path=require(_0x5634('0x3'));var rimraf=require(_0x5634('0x4'));var config=require(_0x5634('0x5'));var attributes=require(_0x5634('0x6'));module['exports']=function(_0x1367cd,_0x7a793c){return _0x1367cd[_0x5634('0x7')](_0x5634('0x8'),attributes,{'tableName':_0x5634('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe369=['define','FaxQueue','fax_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xe369,0x153));var _0x9e36=function(_0x1716b9,_0x43319c){_0x1716b9=_0x1716b9-0x0;var _0x2da359=_0xe369[_0x1716b9];return _0x2da359;};'use strict';var _=require(_0x9e36('0x0'));var util=require(_0x9e36('0x1'));var logger=require(_0x9e36('0x2'))(_0x9e36('0x3'));var moment=require(_0x9e36('0x4'));var BPromise=require(_0x9e36('0x5'));var rp=require(_0x9e36('0x6'));var fs=require('fs');var path=require(_0x9e36('0x7'));var rimraf=require(_0x9e36('0x8'));var config=require(_0x9e36('0x9'));var attributes=require('./faxQueue.attributes');module[_0x9e36('0xa')]=function(_0x2871ed,_0x1a1ab4){return _0x2871ed[_0x9e36('0xb')](_0x9e36('0xc'),attributes,{'tableName':_0x9e36('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.rpc.js b/server/api/faxQueue/faxQueue.rpc.js index ca67f9d..928f420 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 _0xebce=['message','result','catch','FaxQueue','findAll','options','raw','where','attributes','include','map','model','GetFaxQueue','ShowFaxQueue','find','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./faxQueue.socket','register','then','info','FaxQueue,\x20%s,\x20%s','request\x20sent','debug','FaxQueue,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x55109a,_0x18cd54){var _0x5eeb68=function(_0x4bf976){while(--_0x4bf976){_0x55109a['push'](_0x55109a['shift']());}};_0x5eeb68(++_0x18cd54);}(_0xebce,0x127));var _0xeebc=function(_0x239b5e,_0x208a3f){_0x239b5e=_0x239b5e-0x0;var _0x577f3d=_0xebce[_0x239b5e];return _0x577f3d;};'use strict';var _=require(_0xeebc('0x0'));var util=require(_0xeebc('0x1'));var moment=require('moment');var BPromise=require(_0xeebc('0x2'));var rs=require(_0xeebc('0x3'));var fs=require('fs');var Redis=require(_0xeebc('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xeebc('0x5'));var logger=require(_0xeebc('0x6'))(_0xeebc('0x7'));var config=require(_0xeebc('0x8'));var jayson=require(_0xeebc('0x9'));var client=jayson[_0xeebc('0xa')]['http']({'port':0x232a});config[_0xeebc('0xb')]=_[_0xeebc('0xc')](config[_0xeebc('0xb')],{'host':_0xeebc('0xd'),'port':0x18eb});var socket=require(_0xeebc('0xe'))(new Redis(config[_0xeebc('0xb')]));require(_0xeebc('0xf'))[_0xeebc('0x10')](socket);function respondWithRpcPromise(_0x5e238a,_0x1f7d16,_0x2b1233){return new BPromise(function(_0x35555b,_0x527a0d){return client['request'](_0x5e238a,_0x2b1233)[_0xeebc('0x11')](function(_0x4347fb){logger[_0xeebc('0x12')](_0xeebc('0x13'),_0x1f7d16,_0xeebc('0x14'));logger[_0xeebc('0x15')](_0xeebc('0x16'),_0x1f7d16,_0xeebc('0x14'),JSON[_0xeebc('0x17')](_0x4347fb));if(_0x4347fb[_0xeebc('0x18')]){if(_0x4347fb['error']['code']===0x1f4){logger['error'](_0xeebc('0x13'),_0x1f7d16,_0x4347fb[_0xeebc('0x18')][_0xeebc('0x19')]);return _0x527a0d(_0x4347fb[_0xeebc('0x18')][_0xeebc('0x19')]);}logger[_0xeebc('0x18')](_0xeebc('0x13'),_0x1f7d16,_0x4347fb[_0xeebc('0x18')]['message']);return _0x35555b(_0x4347fb[_0xeebc('0x18')]['message']);}else{logger[_0xeebc('0x12')](_0xeebc('0x13'),_0x1f7d16,_0xeebc('0x14'));_0x35555b(_0x4347fb[_0xeebc('0x1a')]['message']);}})[_0xeebc('0x1b')](function(_0xac4159){logger[_0xeebc('0x18')](_0xeebc('0x13'),_0x1f7d16,_0xac4159);_0x527a0d(_0xac4159);});});}exports['GetFaxQueue']=function(_0x130815){var _0x1b86b0=this;return new Promise(function(_0x388766,_0x20796a){return db[_0xeebc('0x1c')][_0xeebc('0x1d')]({'raw':_0x130815[_0xeebc('0x1e')]?_0x130815[_0xeebc('0x1e')][_0xeebc('0x1f')]===undefined?!![]:![]:!![],'where':_0x130815[_0xeebc('0x1e')]?_0x130815[_0xeebc('0x1e')][_0xeebc('0x20')]||null:null,'attributes':_0x130815[_0xeebc('0x1e')]?_0x130815['options'][_0xeebc('0x21')]||null:null,'limit':_0x130815['options']?_0x130815[_0xeebc('0x1e')]['limit']||null:null,'include':_0x130815[_0xeebc('0x1e')]?_0x130815[_0xeebc('0x1e')][_0xeebc('0x22')]?_[_0xeebc('0x23')](_0x130815[_0xeebc('0x1e')]['include'],function(_0x5ba2bd){return{'model':db[_0x5ba2bd[_0xeebc('0x24')]],'as':_0x5ba2bd['as'],'attributes':_0x5ba2bd[_0xeebc('0x21')],'include':_0x5ba2bd[_0xeebc('0x22')]?_['map'](_0x5ba2bd[_0xeebc('0x22')],function(_0xf81d){return{'model':db[_0xf81d[_0xeebc('0x24')]],'as':_0xf81d['as'],'attributes':_0xf81d[_0xeebc('0x21')],'include':_0xf81d[_0xeebc('0x22')]?_['map'](_0xf81d[_0xeebc('0x22')],function(_0x38e2db){return{'model':db[_0x38e2db[_0xeebc('0x24')]],'as':_0x38e2db['as'],'attributes':_0x38e2db[_0xeebc('0x21')]};}):[]};}):[]};}):[]:[]})[_0xeebc('0x11')](function(_0x3a012f){logger[_0xeebc('0x12')]('GetFaxQueue',_0x130815);logger[_0xeebc('0x15')]('GetFaxQueue',_0x130815,JSON['stringify'](_0x3a012f));_0x388766(_0x3a012f);})[_0xeebc('0x1b')](function(_0x3bb898){logger[_0xeebc('0x18')](_0xeebc('0x25'),_0x3bb898['message'],_0x130815);_0x20796a(_0x1b86b0[_0xeebc('0x18')](0x1f4,_0x3bb898['message']));});});};exports[_0xeebc('0x26')]=function(_0x56794d){var _0x17824c=this;return new Promise(function(_0x3bf906,_0x30b697){return db[_0xeebc('0x1c')][_0xeebc('0x27')]({'raw':_0x56794d['options']?_0x56794d[_0xeebc('0x1e')][_0xeebc('0x1f')]===undefined?!![]:![]:!![],'where':_0x56794d[_0xeebc('0x1e')]?_0x56794d[_0xeebc('0x1e')][_0xeebc('0x20')]||null:null,'attributes':_0x56794d[_0xeebc('0x1e')]?_0x56794d[_0xeebc('0x1e')][_0xeebc('0x21')]||null:null,'include':_0x56794d['options']?_0x56794d['options'][_0xeebc('0x22')]?_[_0xeebc('0x23')](_0x56794d[_0xeebc('0x1e')][_0xeebc('0x22')],function(_0x131781){return{'model':db[_0x131781[_0xeebc('0x24')]],'as':_0x131781['as'],'attributes':_0x131781[_0xeebc('0x21')],'include':_0x131781[_0xeebc('0x22')]?_['map'](_0x131781[_0xeebc('0x22')],function(_0x1a32e0){return{'model':db[_0x1a32e0[_0xeebc('0x24')]],'as':_0x1a32e0['as'],'attributes':_0x1a32e0[_0xeebc('0x21')],'include':_0x1a32e0['include']?_[_0xeebc('0x23')](_0x1a32e0[_0xeebc('0x22')],function(_0x5bbf8b){return{'model':db[_0x5bbf8b[_0xeebc('0x24')]],'as':_0x5bbf8b['as'],'attributes':_0x5bbf8b[_0xeebc('0x21')]};}):[]};}):[]};}):[]:[]})[_0xeebc('0x11')](function(_0x3cb539){logger[_0xeebc('0x12')]('ShowFaxQueue',_0x56794d);logger[_0xeebc('0x15')]('ShowFaxQueue',_0x56794d,JSON[_0xeebc('0x17')](_0x3cb539));_0x3bf906(_0x3cb539);})[_0xeebc('0x1b')](function(_0x317a91){logger[_0xeebc('0x18')](_0xeebc('0x26'),_0x317a91[_0xeebc('0x19')],_0x56794d);_0x30b697(_0x17824c['error'](0x1f4,_0x317a91[_0xeebc('0x19')]));});});}; \ No newline at end of file +var _0xfed6=['then','info','FaxQueue,\x20%s,\x20%s','request\x20sent','FaxQueue,\x20%s,\x20%s,\x20%s','error','message','result','FaxQueue','options','raw','where','attributes','limit','include','map','model','catch','GetFaxQueue','ShowFaxQueue','find','debug','stringify','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','./faxQueue.socket','register','request'];(function(_0x1884bb,_0x81af41){var _0xf2176d=function(_0x5181ab){while(--_0x5181ab){_0x1884bb['push'](_0x1884bb['shift']());}};_0xf2176d(++_0x81af41);}(_0xfed6,0xb7));var _0x6fed=function(_0x10427a,_0x1dfe34){_0x10427a=_0x10427a-0x0;var _0x45e8e2=_0xfed6[_0x10427a];return _0x45e8e2;};'use strict';var _=require(_0x6fed('0x0'));var util=require('util');var moment=require(_0x6fed('0x1'));var BPromise=require(_0x6fed('0x2'));var rs=require(_0x6fed('0x3'));var fs=require('fs');var Redis=require(_0x6fed('0x4'));var db=require(_0x6fed('0x5'))['db'];var utils=require(_0x6fed('0x6'));var logger=require('../../config/logger')(_0x6fed('0x7'));var config=require(_0x6fed('0x8'));var jayson=require(_0x6fed('0x9'));var client=jayson[_0x6fed('0xa')][_0x6fed('0xb')]({'port':0x232a});config['redis']=_['defaults'](config[_0x6fed('0xc')],{'host':_0x6fed('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6fed('0xc')]));require(_0x6fed('0xe'))[_0x6fed('0xf')](socket);function respondWithRpcPromise(_0x5e96ad,_0x1fe62e,_0xaf327c){return new BPromise(function(_0x2c9738,_0x3ac557){return client[_0x6fed('0x10')](_0x5e96ad,_0xaf327c)[_0x6fed('0x11')](function(_0x45786b){logger[_0x6fed('0x12')](_0x6fed('0x13'),_0x1fe62e,_0x6fed('0x14'));logger['debug'](_0x6fed('0x15'),_0x1fe62e,'request\x20sent',JSON['stringify'](_0x45786b));if(_0x45786b['error']){if(_0x45786b[_0x6fed('0x16')]['code']===0x1f4){logger[_0x6fed('0x16')]('FaxQueue,\x20%s,\x20%s',_0x1fe62e,_0x45786b[_0x6fed('0x16')]['message']);return _0x3ac557(_0x45786b[_0x6fed('0x16')][_0x6fed('0x17')]);}logger[_0x6fed('0x16')](_0x6fed('0x13'),_0x1fe62e,_0x45786b['error'][_0x6fed('0x17')]);return _0x2c9738(_0x45786b['error']['message']);}else{logger[_0x6fed('0x12')](_0x6fed('0x13'),_0x1fe62e,_0x6fed('0x14'));_0x2c9738(_0x45786b[_0x6fed('0x18')][_0x6fed('0x17')]);}})['catch'](function(_0x2a548b){logger[_0x6fed('0x16')]('FaxQueue,\x20%s,\x20%s',_0x1fe62e,_0x2a548b);_0x3ac557(_0x2a548b);});});}exports['GetFaxQueue']=function(_0xb7b090){var _0x202267=this;return new Promise(function(_0x12d08e,_0x53bb7c){return db[_0x6fed('0x19')]['findAll']({'raw':_0xb7b090[_0x6fed('0x1a')]?_0xb7b090['options'][_0x6fed('0x1b')]===undefined?!![]:![]:!![],'where':_0xb7b090[_0x6fed('0x1a')]?_0xb7b090['options'][_0x6fed('0x1c')]||null:null,'attributes':_0xb7b090['options']?_0xb7b090['options'][_0x6fed('0x1d')]||null:null,'limit':_0xb7b090[_0x6fed('0x1a')]?_0xb7b090[_0x6fed('0x1a')][_0x6fed('0x1e')]||null:null,'include':_0xb7b090[_0x6fed('0x1a')]?_0xb7b090[_0x6fed('0x1a')][_0x6fed('0x1f')]?_[_0x6fed('0x20')](_0xb7b090[_0x6fed('0x1a')][_0x6fed('0x1f')],function(_0x239c97){return{'model':db[_0x239c97[_0x6fed('0x21')]],'as':_0x239c97['as'],'attributes':_0x239c97[_0x6fed('0x1d')],'include':_0x239c97[_0x6fed('0x1f')]?_[_0x6fed('0x20')](_0x239c97[_0x6fed('0x1f')],function(_0x3ee2ee){return{'model':db[_0x3ee2ee[_0x6fed('0x21')]],'as':_0x3ee2ee['as'],'attributes':_0x3ee2ee[_0x6fed('0x1d')],'include':_0x3ee2ee[_0x6fed('0x1f')]?_['map'](_0x3ee2ee[_0x6fed('0x1f')],function(_0x1bd024){return{'model':db[_0x1bd024[_0x6fed('0x21')]],'as':_0x1bd024['as'],'attributes':_0x1bd024['attributes']};}):[]};}):[]};}):[]:[]})[_0x6fed('0x11')](function(_0x4c1465){logger[_0x6fed('0x12')]('GetFaxQueue',_0xb7b090);logger['debug']('GetFaxQueue',_0xb7b090,JSON['stringify'](_0x4c1465));_0x12d08e(_0x4c1465);})[_0x6fed('0x22')](function(_0x891cdd){logger[_0x6fed('0x16')](_0x6fed('0x23'),_0x891cdd[_0x6fed('0x17')],_0xb7b090);_0x53bb7c(_0x202267['error'](0x1f4,_0x891cdd[_0x6fed('0x17')]));});});};exports[_0x6fed('0x24')]=function(_0x422f45){var _0xef23af=this;return new Promise(function(_0x5f2152,_0x954c96){return db[_0x6fed('0x19')][_0x6fed('0x25')]({'raw':_0x422f45[_0x6fed('0x1a')]?_0x422f45[_0x6fed('0x1a')][_0x6fed('0x1b')]===undefined?!![]:![]:!![],'where':_0x422f45['options']?_0x422f45[_0x6fed('0x1a')]['where']||null:null,'attributes':_0x422f45['options']?_0x422f45['options'][_0x6fed('0x1d')]||null:null,'include':_0x422f45[_0x6fed('0x1a')]?_0x422f45['options'][_0x6fed('0x1f')]?_[_0x6fed('0x20')](_0x422f45['options'][_0x6fed('0x1f')],function(_0x5ae87a){return{'model':db[_0x5ae87a[_0x6fed('0x21')]],'as':_0x5ae87a['as'],'attributes':_0x5ae87a[_0x6fed('0x1d')],'include':_0x5ae87a[_0x6fed('0x1f')]?_[_0x6fed('0x20')](_0x5ae87a[_0x6fed('0x1f')],function(_0x1e885){return{'model':db[_0x1e885[_0x6fed('0x21')]],'as':_0x1e885['as'],'attributes':_0x1e885[_0x6fed('0x1d')],'include':_0x1e885['include']?_[_0x6fed('0x20')](_0x1e885['include'],function(_0xe17b2e){return{'model':db[_0xe17b2e[_0x6fed('0x21')]],'as':_0xe17b2e['as'],'attributes':_0xe17b2e[_0x6fed('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x19f2a1){logger[_0x6fed('0x12')]('ShowFaxQueue',_0x422f45);logger[_0x6fed('0x26')](_0x6fed('0x24'),_0x422f45,JSON[_0x6fed('0x27')](_0x19f2a1));_0x5f2152(_0x19f2a1);})['catch'](function(_0x51f7ba){logger[_0x6fed('0x16')](_0x6fed('0x24'),_0x51f7ba[_0x6fed('0x17')],_0x422f45);_0x954c96(_0xef23af['error'](0x1f4,_0x51f7ba[_0x6fed('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index c8dc7e9..db5f2c1 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 _0xaf08=['removeListener','register','length','./faxQueue.events','remove','update','emit'];(function(_0x2bcb75,_0x5789a7){var _0x175345=function(_0x3a7d41){while(--_0x3a7d41){_0x2bcb75['push'](_0x2bcb75['shift']());}};_0x175345(++_0x5789a7);}(_0xaf08,0x1a0));var _0x8af0=function(_0x1d0aee,_0x2c4454){_0x1d0aee=_0x1d0aee-0x0;var _0x34ee2c=_0xaf08[_0x1d0aee];return _0x34ee2c;};'use strict';var FaxQueueEvents=require(_0x8af0('0x0'));var events=['save',_0x8af0('0x1'),_0x8af0('0x2')];function createListener(_0xe538b0,_0x3e046e){return function(_0x2a8142){_0x3e046e[_0x8af0('0x3')](_0xe538b0,_0x2a8142);};}function removeListener(_0x2b81d7,_0x15c260){return function(){FaxQueueEvents[_0x8af0('0x4')](_0x2b81d7,_0x15c260);};}exports[_0x8af0('0x5')]=function(_0x4ffce3){for(var _0x3e81f2=0x0,_0x15e23d=events[_0x8af0('0x6')];_0x3e81f2<_0x15e23d;_0x3e81f2++){var _0x37136a=events[_0x3e81f2];var _0x3bc4e7=createListener('faxQueue:'+_0x37136a,_0x4ffce3);FaxQueueEvents['on'](_0x37136a,_0x3bc4e7);}}; \ No newline at end of file +var _0x1fa3=['remove','update','removeListener','register','./faxQueue.events','save'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x1fa3,0xc4));var _0x31fa=function(_0x52c13d,_0x5e31c4){_0x52c13d=_0x52c13d-0x0;var _0x5a7aad=_0x1fa3[_0x52c13d];return _0x5a7aad;};'use strict';var FaxQueueEvents=require(_0x31fa('0x0'));var events=[_0x31fa('0x1'),_0x31fa('0x2'),_0x31fa('0x3')];function createListener(_0x53b172,_0xeb1d3e){return function(_0x46ee1a){_0xeb1d3e['emit'](_0x53b172,_0x46ee1a);};}function removeListener(_0x519060,_0x49815c){return function(){FaxQueueEvents[_0x31fa('0x4')](_0x519060,_0x49815c);};}exports[_0x31fa('0x5')]=function(_0x28f6bc){for(var _0x4fb10a=0x0,_0x2619f3=events['length'];_0x4fb10a<_0x2619f3;_0x4fb10a++){var _0x256b76=events[_0x4fb10a];var _0x34f073=createListener('faxQueue:'+_0x256b76,_0x28f6bc);FaxQueueEvents['on'](_0x256b76,_0x34f073);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index 58f3a57..12b4c11 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 _0x39e6=['getTeams','/:id/users','getAgents','post','/:id/teams','addTeams','addAgents','put','delete','destroy','removeTeams','removeAgents','exports','multer','path','Router','fs-extra','../../components/interaction/service','../../config/environment','./faxQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','getMembers'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x39e6,0x9e));var _0x639e=function(_0x473457,_0x3b9135){_0x473457=_0x473457-0x0;var _0x1e8cd1=_0x39e6[_0x473457];return _0x1e8cd1;};'use strict';var multer=require(_0x639e('0x0'));var util=require('util');var path=require(_0x639e('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x639e('0x2')]();var fs_extra=require(_0x639e('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x639e('0x4'));var config=require(_0x639e('0x5'));var controller=require(_0x639e('0x6'));router[_0x639e('0x7')]('/',auth[_0x639e('0x8')](),controller[_0x639e('0x9')]);router[_0x639e('0x7')](_0x639e('0xa'),auth[_0x639e('0x8')](),controller[_0x639e('0xb')]);router[_0x639e('0x7')](_0x639e('0xc'),auth[_0x639e('0x8')](),controller[_0x639e('0xd')]);router[_0x639e('0x7')](_0x639e('0xe'),auth[_0x639e('0x8')](),controller[_0x639e('0xf')]);router['get']('/:id/teams',auth[_0x639e('0x8')](),controller[_0x639e('0x10')]);router[_0x639e('0x7')](_0x639e('0x11'),auth[_0x639e('0x8')](),controller[_0x639e('0x12')]);router[_0x639e('0x13')]('/',auth['isAuthenticated'](),controller['create']);router[_0x639e('0x13')](_0x639e('0x14'),auth[_0x639e('0x8')](),controller[_0x639e('0x15')]);router[_0x639e('0x13')](_0x639e('0x11'),auth['isAuthenticated'](),controller[_0x639e('0x16')]);router[_0x639e('0x17')](_0x639e('0xc'),auth[_0x639e('0x8')](),controller['update']);router[_0x639e('0x18')]('/:id',auth[_0x639e('0x8')](),controller[_0x639e('0x19')]);router[_0x639e('0x18')](_0x639e('0x14'),auth[_0x639e('0x8')](),controller[_0x639e('0x1a')]);router['delete'](_0x639e('0x11'),auth[_0x639e('0x8')](),controller[_0x639e('0x1b')]);module[_0x639e('0x1c')]=router; \ No newline at end of file +var _0x3914=['../../components/auth/service','../../components/interaction/service','./faxQueue.controller','get','index','/describe','describe','show','/:id/members','getMembers','/:id/teams','isAuthenticated','/:id/users','getAgents','post','create','addTeams','addAgents','/:id','update','delete','destroy','removeTeams','removeAgents','exports','multer','util','connect-timeout','express','fs-extra'];(function(_0x27d9e7,_0x24c4ad){var _0x3f371e=function(_0x142ec2){while(--_0x142ec2){_0x27d9e7['push'](_0x27d9e7['shift']());}};_0x3f371e(++_0x24c4ad);}(_0x3914,0xeb));var _0x4391=function(_0x34eb31,_0x8f0f70){_0x34eb31=_0x34eb31-0x0;var _0x254994=_0x3914[_0x34eb31];return _0x254994;};'use strict';var multer=require(_0x4391('0x0'));var util=require(_0x4391('0x1'));var path=require('path');var timeout=require(_0x4391('0x2'));var express=require(_0x4391('0x3'));var router=express['Router']();var fs_extra=require(_0x4391('0x4'));var auth=require(_0x4391('0x5'));var interaction=require(_0x4391('0x6'));var config=require('../../config/environment');var controller=require(_0x4391('0x7'));router[_0x4391('0x8')]('/',auth['isAuthenticated'](),controller[_0x4391('0x9')]);router['get'](_0x4391('0xa'),auth['isAuthenticated'](),controller[_0x4391('0xb')]);router[_0x4391('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x4391('0xc')]);router[_0x4391('0x8')](_0x4391('0xd'),auth['isAuthenticated'](),controller[_0x4391('0xe')]);router[_0x4391('0x8')](_0x4391('0xf'),auth[_0x4391('0x10')](),controller['getTeams']);router[_0x4391('0x8')](_0x4391('0x11'),auth[_0x4391('0x10')](),controller[_0x4391('0x12')]);router[_0x4391('0x13')]('/',auth[_0x4391('0x10')](),controller[_0x4391('0x14')]);router[_0x4391('0x13')]('/:id/teams',auth[_0x4391('0x10')](),controller[_0x4391('0x15')]);router[_0x4391('0x13')](_0x4391('0x11'),auth['isAuthenticated'](),controller[_0x4391('0x16')]);router['put'](_0x4391('0x17'),auth[_0x4391('0x10')](),controller[_0x4391('0x18')]);router[_0x4391('0x19')](_0x4391('0x17'),auth[_0x4391('0x10')](),controller[_0x4391('0x1a')]);router[_0x4391('0x19')]('/:id/teams',auth['isAuthenticated'](),controller[_0x4391('0x1b')]);router['delete'](_0x4391('0x11'),auth[_0x4391('0x10')](),controller[_0x4391('0x1c')]);module[_0x4391('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 a88e530..0d411e5 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 _0xf24b=['moment','sequelize','exports','STRING','DATE'];(function(_0x815307,_0x3b6e6f){var _0x3261bf=function(_0x42f703){while(--_0x42f703){_0x815307['push'](_0x815307['shift']());}};_0x3261bf(++_0x3b6e6f);}(_0xf24b,0xff));var _0xbf24=function(_0x50fda9,_0x5ee44b){_0x50fda9=_0x50fda9-0x0;var _0x36b92b=_0xf24b[_0x50fda9];return _0x36b92b;};'use strict';var moment=require(_0xbf24('0x0'));var Sequelize=require(_0xbf24('0x1'));module[_0xbf24('0x2')]={'uniqueid':{'type':Sequelize[_0xbf24('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0xbf24('0x3')]},'joinAt':{'type':Sequelize[_0xbf24('0x4')]},'leaveAt':{'type':Sequelize[_0xbf24('0x4')]},'acceptAt':{'type':Sequelize[_0xbf24('0x4')]},'exitAt':{'type':Sequelize[_0xbf24('0x4')]},'reason':{'type':Sequelize[_0xbf24('0x3')]}}; \ No newline at end of file +var _0xb4c7=['moment','sequelize','exports','DATE'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xb4c7,0x19c));var _0x7b4c=function(_0xf2f8a2,_0x580880){_0xf2f8a2=_0xf2f8a2-0x0;var _0x10b046=_0xb4c7[_0xf2f8a2];return _0x10b046;};'use strict';var moment=require(_0x7b4c('0x0'));var Sequelize=require(_0x7b4c('0x1'));module[_0x7b4c('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x7b4c('0x3')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index deee38c..7782306 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 _0xf323=['merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','keys','length','find','catch','create','body','describe','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','limit','undefined','offset','count','set','Content-Range','json','reject','update','destroy','then','end','error','stack','name','index','map','FaxQueueReport','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','order','sort','where','pick'];(function(_0x10393a,_0x2371f2){var _0x4eba0b=function(_0x49d3e0){while(--_0x49d3e0){_0x10393a['push'](_0x10393a['shift']());}};_0x4eba0b(++_0x2371f2);}(_0xf323,0x1c6));var _0x3f32=function(_0x5150e1,_0x91cff0){_0x5150e1=_0x5150e1-0x0;var _0x2b5175=_0xf323[_0x5150e1];return _0x2b5175;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x3f32('0x0'));var jsonpatch=require(_0x3f32('0x1'));var rp=require('request-promise');var moment=require(_0x3f32('0x2'));var BPromise=require(_0x3f32('0x3'));var Mustache=require(_0x3f32('0x4'));var util=require(_0x3f32('0x5'));var path=require(_0x3f32('0x6'));var sox=require('sox');var csv=require(_0x3f32('0x7'));var ejs=require(_0x3f32('0x8'));var fs=require('fs');var fs_extra=require(_0x3f32('0x9'));var _=require(_0x3f32('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x3f32('0xb'));var deskjs=require(_0x3f32('0xc'));var toCsv=require(_0x3f32('0x7'));var querystring=require(_0x3f32('0xd'));var Papa=require(_0x3f32('0xe'));var Redis=require(_0x3f32('0xf'));var authService=require(_0x3f32('0x10'));var qs=require(_0x3f32('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3f32('0x12'));var logger=require(_0x3f32('0x13'))(_0x3f32('0x14'));var utils=require('../../config/utils');var config=require(_0x3f32('0x15'));var licenseUtil=require(_0x3f32('0x16'));var db=require(_0x3f32('0x17'))['db'];function respondWithStatusCode(_0x2b1aa3,_0x5c876b){_0x5c876b=_0x5c876b||0xcc;return function(_0x4d7e41){if(_0x4d7e41){return _0x2b1aa3[_0x3f32('0x18')](_0x5c876b);}return _0x2b1aa3[_0x3f32('0x19')](_0x5c876b)['end']();};}function respondWithResult(_0x4097b4,_0x22b00){_0x22b00=_0x22b00||0xc8;return function(_0xc68dd5){if(_0xc68dd5){return _0x4097b4['status'](_0x22b00)['json'](_0xc68dd5);}};}function respondWithFilteredResult(_0x360b1b,_0x1de24c){return function(_0x1adaa5){if(_0x1adaa5){var _0x219d91=typeof _0x1de24c['offset']==='undefined'&&typeof _0x1de24c[_0x3f32('0x1a')]===_0x3f32('0x1b');var _0x3a8e7b=_0x1adaa5['count'];var _0x5c36d9=_0x219d91?0x0:_0x1de24c[_0x3f32('0x1c')];var _0x19ec90=_0x219d91?_0x1adaa5[_0x3f32('0x1d')]:_0x1de24c[_0x3f32('0x1c')]+_0x1de24c[_0x3f32('0x1a')];var _0x517e49;if(_0x19ec90>=_0x3a8e7b){_0x19ec90=_0x3a8e7b;_0x517e49=0xc8;}else{_0x517e49=0xce;}_0x360b1b[_0x3f32('0x19')](_0x517e49);return _0x360b1b[_0x3f32('0x1e')](_0x3f32('0x1f'),_0x5c36d9+'-'+_0x19ec90+'/'+_0x3a8e7b)[_0x3f32('0x20')](_0x1adaa5);}return null;};}function patchUpdates(_0xbc366b){return function(_0x2e698a){try{jsonpatch['apply'](_0x2e698a,_0xbc366b,!![]);}catch(_0x1e2d85){return BPromise[_0x3f32('0x21')](_0x1e2d85);}return _0x2e698a['save']();};}function saveUpdates(_0x1874e4,_0x21cf2e){return function(_0x3ddf25){if(_0x3ddf25){return _0x3ddf25[_0x3f32('0x22')](_0x1874e4)['then'](function(_0x1ea58b){return _0x1ea58b;});}return null;};}function removeEntity(_0x20f7d1,_0x4eb2ad){return function(_0x416015){if(_0x416015){return _0x416015[_0x3f32('0x23')]()[_0x3f32('0x24')](function(){_0x20f7d1[_0x3f32('0x19')](0xcc)[_0x3f32('0x25')]();});}};}function handleEntityNotFound(_0x11f4ab,_0x28bff4){return function(_0x38de66){if(!_0x38de66){_0x11f4ab[_0x3f32('0x18')](0x194);}return _0x38de66;};}function handleError(_0x3130de,_0x30ef37){_0x30ef37=_0x30ef37||0x1f4;return function(_0x5b5e9d){logger[_0x3f32('0x26')](_0x5b5e9d[_0x3f32('0x27')]);if(_0x5b5e9d['name']){delete _0x5b5e9d[_0x3f32('0x28')];}_0x3130de['status'](_0x30ef37)['send'](_0x5b5e9d);};}exports[_0x3f32('0x29')]=function(_0x785270,_0x1ee79e){var _0x320972={},_0x20b333={},_0x36623c={'count':0x0,'rows':[]};var _0x293c05=_[_0x3f32('0x2a')](db[_0x3f32('0x2b')][_0x3f32('0x2c')],function(_0x448bf7){return{'name':_0x448bf7['fieldName'],'type':_0x448bf7[_0x3f32('0x2d')][_0x3f32('0x2e')]};});_0x20b333[_0x3f32('0x2f')]=_[_0x3f32('0x2a')](_0x293c05,'name');_0x20b333['query']=_['keys'](_0x785270[_0x3f32('0x30')]);_0x20b333[_0x3f32('0x31')]=_[_0x3f32('0x32')](_0x20b333[_0x3f32('0x2f')],_0x20b333[_0x3f32('0x30')]);_0x320972[_0x3f32('0x33')]=_[_0x3f32('0x32')](_0x20b333[_0x3f32('0x2f')],qs[_0x3f32('0x34')](_0x785270['query'][_0x3f32('0x34')]));_0x320972[_0x3f32('0x33')]=_0x320972['attributes']['length']?_0x320972[_0x3f32('0x33')]:_0x20b333[_0x3f32('0x2f')];if(!_0x785270[_0x3f32('0x30')]['hasOwnProperty']('nolimit')){_0x320972[_0x3f32('0x1a')]=qs[_0x3f32('0x1a')](_0x785270[_0x3f32('0x30')][_0x3f32('0x1a')]);_0x320972['offset']=qs[_0x3f32('0x1c')](_0x785270['query'][_0x3f32('0x1c')]);}_0x320972[_0x3f32('0x35')]=qs['sort'](_0x785270[_0x3f32('0x30')][_0x3f32('0x36')]);_0x320972[_0x3f32('0x37')]=qs[_0x3f32('0x31')](_[_0x3f32('0x38')](_0x785270[_0x3f32('0x30')],_0x20b333[_0x3f32('0x31')]),_0x293c05);if(_0x785270[_0x3f32('0x30')]['filter']){_0x320972['where']=_[_0x3f32('0x39')](_0x320972[_0x3f32('0x37')],{'$or':_[_0x3f32('0x2a')](_0x293c05,function(_0x1e0e9a){if(_0x1e0e9a[_0x3f32('0x2d')]!==_0x3f32('0x3a')){var _0x28bd51={};_0x28bd51[_0x1e0e9a[_0x3f32('0x28')]]={'$like':'%'+_0x785270[_0x3f32('0x30')]['filter']+'%'};return _0x28bd51;}})});}_0x320972=_[_0x3f32('0x39')]({},_0x320972,_0x785270[_0x3f32('0x3b')]);var _0x3210a5={'where':_0x320972['where']};return db[_0x3f32('0x2b')][_0x3f32('0x1d')](_0x3210a5)['then'](function(_0xfaed17){_0x36623c[_0x3f32('0x1d')]=_0xfaed17;if(_0x785270[_0x3f32('0x30')][_0x3f32('0x3c')]){_0x320972[_0x3f32('0x3d')]=[{'all':!![]}];}return db[_0x3f32('0x2b')][_0x3f32('0x3e')](_0x320972);})['then'](function(_0x5831fe){_0x36623c[_0x3f32('0x3f')]=_0x5831fe;return _0x36623c;})[_0x3f32('0x24')](respondWithFilteredResult(_0x1ee79e,_0x320972))['catch'](handleError(_0x1ee79e,null));};exports[_0x3f32('0x40')]=function(_0x35701f,_0x25a4ce){var _0x23b773={'raw':!![],'where':{'id':_0x35701f[_0x3f32('0x41')]['id']}},_0x21a803={};_0x21a803[_0x3f32('0x2f')]=_['keys'](db[_0x3f32('0x2b')][_0x3f32('0x2c')]);_0x21a803[_0x3f32('0x30')]=_[_0x3f32('0x42')](_0x35701f[_0x3f32('0x30')]);_0x21a803[_0x3f32('0x31')]=_[_0x3f32('0x32')](_0x21a803[_0x3f32('0x2f')],_0x21a803[_0x3f32('0x30')]);_0x23b773['attributes']=_[_0x3f32('0x32')](_0x21a803[_0x3f32('0x2f')],qs[_0x3f32('0x34')](_0x35701f[_0x3f32('0x30')][_0x3f32('0x34')]));_0x23b773['attributes']=_0x23b773['attributes'][_0x3f32('0x43')]?_0x23b773[_0x3f32('0x33')]:_0x21a803[_0x3f32('0x2f')];if(_0x35701f['query'][_0x3f32('0x3c')]){_0x23b773['include']=[{'all':!![]}];}_0x23b773=_[_0x3f32('0x39')]({},_0x23b773,_0x35701f[_0x3f32('0x3b')]);return db[_0x3f32('0x2b')][_0x3f32('0x44')](_0x23b773)[_0x3f32('0x24')](handleEntityNotFound(_0x25a4ce,null))['then'](respondWithResult(_0x25a4ce,null))[_0x3f32('0x45')](handleError(_0x25a4ce,null));};exports[_0x3f32('0x46')]=function(_0x2158c2,_0x4a0870){return db['FaxQueueReport'][_0x3f32('0x46')](_0x2158c2['body'],{})[_0x3f32('0x24')](respondWithResult(_0x4a0870,0xc9))[_0x3f32('0x45')](handleError(_0x4a0870,null));};exports[_0x3f32('0x22')]=function(_0x2753eb,_0x80bffd){if(_0x2753eb['body']['id']){delete _0x2753eb[_0x3f32('0x47')]['id'];}return db[_0x3f32('0x2b')][_0x3f32('0x44')]({'where':{'id':_0x2753eb[_0x3f32('0x41')]['id']}})[_0x3f32('0x24')](handleEntityNotFound(_0x80bffd,null))['then'](saveUpdates(_0x2753eb[_0x3f32('0x47')],null))[_0x3f32('0x24')](respondWithResult(_0x80bffd,null))['catch'](handleError(_0x80bffd,null));};exports[_0x3f32('0x23')]=function(_0x422da0,_0x2c6160){return db[_0x3f32('0x2b')]['find']({'where':{'id':_0x422da0[_0x3f32('0x41')]['id']}})[_0x3f32('0x24')](handleEntityNotFound(_0x2c6160,null))[_0x3f32('0x24')](removeEntity(_0x2c6160,null))[_0x3f32('0x45')](handleError(_0x2c6160,null));};exports[_0x3f32('0x48')]=function(_0x38107f,_0x9f14d8){return db['FaxQueueReport']['describe']()[_0x3f32('0x24')](respondWithResult(_0x9f14d8,null))[_0x3f32('0x45')](handleError(_0x9f14d8,null));}; \ No newline at end of file +var _0x8d97=['../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','then','destroy','error','name','index','map','FaxQueueReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','update','describe','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service'];(function(_0x15e2ae,_0x5f2abb){var _0x47e5ec=function(_0x45e7f1){while(--_0x45e7f1){_0x15e2ae['push'](_0x15e2ae['shift']());}};_0x47e5ec(++_0x5f2abb);}(_0x8d97,0x82));var _0x78d9=function(_0x3eeae0,_0xbdd72){_0x3eeae0=_0x3eeae0-0x0;var _0x231f77=_0x8d97[_0x3eeae0];return _0x231f77;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x78d9('0x0'));var zipdir=require(_0x78d9('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x78d9('0x2'));var moment=require(_0x78d9('0x3'));var BPromise=require(_0x78d9('0x4'));var Mustache=require(_0x78d9('0x5'));var util=require(_0x78d9('0x6'));var path=require('path');var sox=require(_0x78d9('0x7'));var csv=require(_0x78d9('0x8'));var ejs=require(_0x78d9('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x78d9('0xa'));var jsforce=require(_0x78d9('0xb'));var deskjs=require(_0x78d9('0xc'));var toCsv=require(_0x78d9('0x8'));var querystring=require(_0x78d9('0xd'));var Papa=require(_0x78d9('0xe'));var Redis=require('ioredis');var authService=require(_0x78d9('0xf'));var qs=require(_0x78d9('0x10'));var as=require(_0x78d9('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x78d9('0x12'));var utils=require(_0x78d9('0x13'));var config=require(_0x78d9('0x14'));var licenseUtil=require(_0x78d9('0x15'));var db=require(_0x78d9('0x16'))['db'];function respondWithStatusCode(_0x22d36f,_0x528746){_0x528746=_0x528746||0xcc;return function(_0x8186eb){if(_0x8186eb){return _0x22d36f[_0x78d9('0x17')](_0x528746);}return _0x22d36f[_0x78d9('0x18')](_0x528746)[_0x78d9('0x19')]();};}function respondWithResult(_0x1db1b1,_0x2928a8){_0x2928a8=_0x2928a8||0xc8;return function(_0x2b27a9){if(_0x2b27a9){return _0x1db1b1[_0x78d9('0x18')](_0x2928a8)[_0x78d9('0x1a')](_0x2b27a9);}};}function respondWithFilteredResult(_0x21cee0,_0x826882){return function(_0x38aa28){if(_0x38aa28){var _0x45934d=typeof _0x826882[_0x78d9('0x1b')]===_0x78d9('0x1c')&&typeof _0x826882[_0x78d9('0x1d')]===_0x78d9('0x1c');var _0x5e8122=_0x38aa28[_0x78d9('0x1e')];var _0x3b4dde=_0x45934d?0x0:_0x826882[_0x78d9('0x1b')];var _0x8d0153=_0x45934d?_0x38aa28[_0x78d9('0x1e')]:_0x826882[_0x78d9('0x1b')]+_0x826882[_0x78d9('0x1d')];var _0x2969fa;if(_0x8d0153>=_0x5e8122){_0x8d0153=_0x5e8122;_0x2969fa=0xc8;}else{_0x2969fa=0xce;}_0x21cee0[_0x78d9('0x18')](_0x2969fa);return _0x21cee0[_0x78d9('0x1f')](_0x78d9('0x20'),_0x3b4dde+'-'+_0x8d0153+'/'+_0x5e8122)[_0x78d9('0x1a')](_0x38aa28);}return null;};}function patchUpdates(_0x36bcf9){return function(_0x148e30){try{jsonpatch[_0x78d9('0x21')](_0x148e30,_0x36bcf9,!![]);}catch(_0x1d8d3c){return BPromise['reject'](_0x1d8d3c);}return _0x148e30[_0x78d9('0x22')]();};}function saveUpdates(_0x4285d4,_0x24d236){return function(_0x18bb18){if(_0x18bb18){return _0x18bb18['update'](_0x4285d4)[_0x78d9('0x23')](function(_0x41f732){return _0x41f732;});}return null;};}function removeEntity(_0x45b6f6,_0x51549d){return function(_0x51c4ce){if(_0x51c4ce){return _0x51c4ce[_0x78d9('0x24')]()['then'](function(){_0x45b6f6['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x28b7e1,_0x1fa9a1){return function(_0x361a5e){if(!_0x361a5e){_0x28b7e1[_0x78d9('0x17')](0x194);}return _0x361a5e;};}function handleError(_0x18f58d,_0x17db22){_0x17db22=_0x17db22||0x1f4;return function(_0x4e87cf){logger[_0x78d9('0x25')](_0x4e87cf['stack']);if(_0x4e87cf[_0x78d9('0x26')]){delete _0x4e87cf[_0x78d9('0x26')];}_0x18f58d[_0x78d9('0x18')](_0x17db22)['send'](_0x4e87cf);};}exports[_0x78d9('0x27')]=function(_0x337816,_0x59b9d2){var _0x47f189={},_0x55617c={},_0x4fce54={'count':0x0,'rows':[]};var _0x1e4f67=_[_0x78d9('0x28')](db[_0x78d9('0x29')][_0x78d9('0x2a')],function(_0x40a789){return{'name':_0x40a789[_0x78d9('0x2b')],'type':_0x40a789[_0x78d9('0x2c')][_0x78d9('0x2d')]};});_0x55617c[_0x78d9('0x2e')]=_[_0x78d9('0x28')](_0x1e4f67,'name');_0x55617c[_0x78d9('0x2f')]=_['keys'](_0x337816['query']);_0x55617c[_0x78d9('0x30')]=_[_0x78d9('0x31')](_0x55617c[_0x78d9('0x2e')],_0x55617c[_0x78d9('0x2f')]);_0x47f189[_0x78d9('0x32')]=_[_0x78d9('0x31')](_0x55617c[_0x78d9('0x2e')],qs['fields'](_0x337816[_0x78d9('0x2f')][_0x78d9('0x33')]));_0x47f189[_0x78d9('0x32')]=_0x47f189[_0x78d9('0x32')]['length']?_0x47f189[_0x78d9('0x32')]:_0x55617c['model'];if(!_0x337816['query']['hasOwnProperty']('nolimit')){_0x47f189[_0x78d9('0x1d')]=qs[_0x78d9('0x1d')](_0x337816[_0x78d9('0x2f')][_0x78d9('0x1d')]);_0x47f189[_0x78d9('0x1b')]=qs[_0x78d9('0x1b')](_0x337816[_0x78d9('0x2f')][_0x78d9('0x1b')]);}_0x47f189[_0x78d9('0x34')]=qs[_0x78d9('0x35')](_0x337816[_0x78d9('0x2f')][_0x78d9('0x35')]);_0x47f189[_0x78d9('0x36')]=qs[_0x78d9('0x30')](_[_0x78d9('0x37')](_0x337816[_0x78d9('0x2f')],_0x55617c[_0x78d9('0x30')]),_0x1e4f67);if(_0x337816[_0x78d9('0x2f')]['filter']){_0x47f189['where']=_[_0x78d9('0x38')](_0x47f189[_0x78d9('0x36')],{'$or':_[_0x78d9('0x28')](_0x1e4f67,function(_0x390ecb){if(_0x390ecb[_0x78d9('0x2c')]!==_0x78d9('0x39')){var _0x48e07c={};_0x48e07c[_0x390ecb[_0x78d9('0x26')]]={'$like':'%'+_0x337816[_0x78d9('0x2f')][_0x78d9('0x3a')]+'%'};return _0x48e07c;}})});}_0x47f189=_[_0x78d9('0x38')]({},_0x47f189,_0x337816[_0x78d9('0x3b')]);var _0x5f58ba={'where':_0x47f189[_0x78d9('0x36')]};return db[_0x78d9('0x29')][_0x78d9('0x1e')](_0x5f58ba)[_0x78d9('0x23')](function(_0x50f765){_0x4fce54[_0x78d9('0x1e')]=_0x50f765;if(_0x337816[_0x78d9('0x2f')][_0x78d9('0x3c')]){_0x47f189[_0x78d9('0x3d')]=[{'all':!![]}];}return db[_0x78d9('0x29')][_0x78d9('0x3e')](_0x47f189);})[_0x78d9('0x23')](function(_0x381ed5){_0x4fce54[_0x78d9('0x3f')]=_0x381ed5;return _0x4fce54;})['then'](respondWithFilteredResult(_0x59b9d2,_0x47f189))[_0x78d9('0x40')](handleError(_0x59b9d2,null));};exports[_0x78d9('0x41')]=function(_0x5c7854,_0xc4e054){var _0x2ddb1e={'raw':!![],'where':{'id':_0x5c7854[_0x78d9('0x42')]['id']}},_0x2d4c80={};_0x2d4c80[_0x78d9('0x2e')]=_[_0x78d9('0x43')](db[_0x78d9('0x29')][_0x78d9('0x2a')]);_0x2d4c80['query']=_['keys'](_0x5c7854[_0x78d9('0x2f')]);_0x2d4c80[_0x78d9('0x30')]=_['intersection'](_0x2d4c80[_0x78d9('0x2e')],_0x2d4c80[_0x78d9('0x2f')]);_0x2ddb1e[_0x78d9('0x32')]=_[_0x78d9('0x31')](_0x2d4c80[_0x78d9('0x2e')],qs[_0x78d9('0x33')](_0x5c7854[_0x78d9('0x2f')][_0x78d9('0x33')]));_0x2ddb1e[_0x78d9('0x32')]=_0x2ddb1e[_0x78d9('0x32')]['length']?_0x2ddb1e[_0x78d9('0x32')]:_0x2d4c80[_0x78d9('0x2e')];if(_0x5c7854[_0x78d9('0x2f')][_0x78d9('0x3c')]){_0x2ddb1e[_0x78d9('0x3d')]=[{'all':!![]}];}_0x2ddb1e=_['merge']({},_0x2ddb1e,_0x5c7854['options']);return db[_0x78d9('0x29')][_0x78d9('0x44')](_0x2ddb1e)['then'](handleEntityNotFound(_0xc4e054,null))['then'](respondWithResult(_0xc4e054,null))[_0x78d9('0x40')](handleError(_0xc4e054,null));};exports['create']=function(_0x21495f,_0x62dd38){return db[_0x78d9('0x29')][_0x78d9('0x45')](_0x21495f[_0x78d9('0x46')],{})[_0x78d9('0x23')](respondWithResult(_0x62dd38,0xc9))[_0x78d9('0x40')](handleError(_0x62dd38,null));};exports[_0x78d9('0x47')]=function(_0x404a60,_0x3cec0a){if(_0x404a60[_0x78d9('0x46')]['id']){delete _0x404a60['body']['id'];}return db[_0x78d9('0x29')]['find']({'where':{'id':_0x404a60[_0x78d9('0x42')]['id']}})[_0x78d9('0x23')](handleEntityNotFound(_0x3cec0a,null))[_0x78d9('0x23')](saveUpdates(_0x404a60[_0x78d9('0x46')],null))['then'](respondWithResult(_0x3cec0a,null))[_0x78d9('0x40')](handleError(_0x3cec0a,null));};exports['destroy']=function(_0x4923fa,_0x579c3b){return db[_0x78d9('0x29')][_0x78d9('0x44')]({'where':{'id':_0x4923fa[_0x78d9('0x42')]['id']}})[_0x78d9('0x23')](handleEntityNotFound(_0x579c3b,null))[_0x78d9('0x23')](removeEntity(_0x579c3b,null))['catch'](handleError(_0x579c3b,null));};exports[_0x78d9('0x48')]=function(_0x5c15d5,_0x351d4a){return db[_0x78d9('0x29')][_0x78d9('0x48')]()[_0x78d9('0x23')](respondWithResult(_0x351d4a,null))['catch'](handleError(_0x351d4a,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index 823611d..8c908a4 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 _0x1cb9=['api','moment','bluebird','path','rimraf','./faxQueueReport.attributes','exports','define','FaxQueueReport','uniqueid','lodash','../../config/logger'];(function(_0x43d16c,_0x2b5447){var _0x208cce=function(_0x371720){while(--_0x371720){_0x43d16c['push'](_0x43d16c['shift']());}};_0x208cce(++_0x2b5447);}(_0x1cb9,0x14e));var _0x91cb=function(_0x265f57,_0x5100e6){_0x265f57=_0x265f57-0x0;var _0x549c53=_0x1cb9[_0x265f57];return _0x549c53;};'use strict';var _=require(_0x91cb('0x0'));var util=require('util');var logger=require(_0x91cb('0x1'))(_0x91cb('0x2'));var moment=require(_0x91cb('0x3'));var BPromise=require(_0x91cb('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x91cb('0x5'));var rimraf=require(_0x91cb('0x6'));var config=require('../../config/environment');var attributes=require(_0x91cb('0x7'));module[_0x91cb('0x8')]=function(_0x186dc3,_0x28543e){return _0x186dc3[_0x91cb('0x9')](_0x91cb('0xa'),attributes,{'tableName':'report_fax_queue','paranoid':![],'indexes':[{'name':_0x91cb('0xb'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x4975=['path','rimraf','../../config/environment','./faxQueueReport.attributes','exports','FaxQueueReport','report_fax_queue','uniqueid','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x24a6fe,_0x387ad5){var _0x56f7fa=function(_0x5ca1a0){while(--_0x5ca1a0){_0x24a6fe['push'](_0x24a6fe['shift']());}};_0x56f7fa(++_0x387ad5);}(_0x4975,0x86));var _0x5497=function(_0x4fac74,_0x5454a9){_0x4fac74=_0x4fac74-0x0;var _0x213483=_0x4975[_0x4fac74];return _0x213483;};'use strict';var _=require(_0x5497('0x0'));var util=require('util');var logger=require(_0x5497('0x1'))(_0x5497('0x2'));var moment=require(_0x5497('0x3'));var BPromise=require(_0x5497('0x4'));var rp=require(_0x5497('0x5'));var fs=require('fs');var path=require(_0x5497('0x6'));var rimraf=require(_0x5497('0x7'));var config=require(_0x5497('0x8'));var attributes=require(_0x5497('0x9'));module[_0x5497('0xa')]=function(_0x539a27,_0x37e48d){return _0x539a27['define'](_0x5497('0xb'),attributes,{'tableName':_0x5497('0xc'),'paranoid':![],'indexes':[{'name':_0x5497('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.rpc.js b/server/api/faxQueueReport/faxQueueReport.rpc.js index ec7e48b..87cd395 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 _0xb99f=['util','../../mysqldb','../../config/utils','rpc','../../config/environment','client','request','then','info','FaxQueueReport,\x20%s,\x20%s','request\x20sent','FaxQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateFaxQueueReport','FaxQueueReport','options','debug','UpdateFaxQueueReport','update','body','raw','where','attributes'];(function(_0x1d4420,_0x314978){var _0x4c3dcc=function(_0x33b259){while(--_0x33b259){_0x1d4420['push'](_0x1d4420['shift']());}};_0x4c3dcc(++_0x314978);}(_0xb99f,0x70));var _0xfb99=function(_0xc0a3d3,_0x2c8d00){_0xc0a3d3=_0xc0a3d3-0x0;var _0x3386e8=_0xb99f[_0xc0a3d3];return _0x3386e8;};'use strict';var _=require('lodash');var util=require(_0xfb99('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfb99('0x1'))['db'];var utils=require(_0xfb99('0x2'));var logger=require('../../config/logger')(_0xfb99('0x3'));var config=require(_0xfb99('0x4'));var jayson=require('jayson/promise');var client=jayson[_0xfb99('0x5')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4cb26c,_0x24216d,_0x35907d){return new BPromise(function(_0x5ce159,_0x5eb1f6){return client[_0xfb99('0x6')](_0x4cb26c,_0x35907d)[_0xfb99('0x7')](function(_0x2d30e4){logger[_0xfb99('0x8')](_0xfb99('0x9'),_0x24216d,_0xfb99('0xa'));logger['debug'](_0xfb99('0xb'),_0x24216d,_0xfb99('0xa'),JSON[_0xfb99('0xc')](_0x2d30e4));if(_0x2d30e4[_0xfb99('0xd')]){if(_0x2d30e4[_0xfb99('0xd')][_0xfb99('0xe')]===0x1f4){logger[_0xfb99('0xd')](_0xfb99('0x9'),_0x24216d,_0x2d30e4[_0xfb99('0xd')][_0xfb99('0xf')]);return _0x5eb1f6(_0x2d30e4[_0xfb99('0xd')]['message']);}logger[_0xfb99('0xd')](_0xfb99('0x9'),_0x24216d,_0x2d30e4[_0xfb99('0xd')][_0xfb99('0xf')]);return _0x5ce159(_0x2d30e4[_0xfb99('0xd')][_0xfb99('0xf')]);}else{logger['info'](_0xfb99('0x9'),_0x24216d,_0xfb99('0xa'));_0x5ce159(_0x2d30e4[_0xfb99('0x10')][_0xfb99('0xf')]);}})[_0xfb99('0x11')](function(_0x48a396){logger[_0xfb99('0xd')](_0xfb99('0x9'),_0x24216d,_0x48a396);_0x5eb1f6(_0x48a396);});});}exports[_0xfb99('0x12')]=function(_0x37e4c6){var _0xabebe=this;return new Promise(function(_0x29bc30,_0x5619d5){return db[_0xfb99('0x13')]['create'](_0x37e4c6['body'],{'raw':_0x37e4c6[_0xfb99('0x14')]?_0x37e4c6['options']['raw']===undefined?!![]:![]:!![]})[_0xfb99('0x7')](function(_0x29194e){logger[_0xfb99('0x8')](_0xfb99('0x12'),_0x37e4c6);logger[_0xfb99('0x15')](_0xfb99('0x12'),_0x37e4c6,JSON[_0xfb99('0xc')](_0x29194e));_0x29bc30(_0x29194e);})[_0xfb99('0x11')](function(_0x1c2ca5){logger['error']('CreateFaxQueueReport',_0x1c2ca5[_0xfb99('0xf')],_0x37e4c6);_0x5619d5(_0xabebe['error'](0x1f4,_0x1c2ca5[_0xfb99('0xf')]));});});};exports[_0xfb99('0x16')]=function(_0x4504c9){var _0x179d69=this;return new Promise(function(_0x322aee,_0x50c743){return db[_0xfb99('0x13')][_0xfb99('0x17')](_0x4504c9[_0xfb99('0x18')],{'raw':_0x4504c9[_0xfb99('0x14')]?_0x4504c9['options'][_0xfb99('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4504c9[_0xfb99('0x14')]?_0x4504c9[_0xfb99('0x14')][_0xfb99('0x1a')]||null:null,'attributes':_0x4504c9[_0xfb99('0x14')]?_0x4504c9[_0xfb99('0x14')][_0xfb99('0x1b')]||null:null,'limit':_0x4504c9['options']?_0x4504c9[_0xfb99('0x14')]['limit']||null:null})[_0xfb99('0x7')](function(_0x1ca0da){logger[_0xfb99('0x8')](_0xfb99('0x16'),_0x4504c9);logger[_0xfb99('0x15')](_0xfb99('0x16'),_0x4504c9,JSON[_0xfb99('0xc')](_0x1ca0da));_0x322aee(_0x1ca0da);})[_0xfb99('0x11')](function(_0xae398b){logger[_0xfb99('0xd')](_0xfb99('0x16'),_0xae398b['message'],_0x4504c9);_0x50c743(_0x179d69[_0xfb99('0xd')](0x1f4,_0xae398b[_0xfb99('0xf')]));});});}; \ No newline at end of file +var _0xd535=['error','code','FaxQueueReport,\x20%s,\x20%s','message','info','CreateFaxQueueReport','FaxQueueReport','create','body','options','raw','stringify','catch','UpdateFaxQueueReport','update','where','attributes','limit','bluebird','ioredis','../../config/logger','rpc','../../config/environment','http','request','then','request\x20sent','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xd535,0x134));var _0x5d53=function(_0x3e8e9e,_0x20e530){_0x3e8e9e=_0x3e8e9e-0x0;var _0xb4ee22=_0xd535[_0x3e8e9e];return _0xb4ee22;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x5d53('0x0'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5d53('0x1'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x5d53('0x2'))(_0x5d53('0x3'));var config=require(_0x5d53('0x4'));var jayson=require('jayson/promise');var client=jayson['client'][_0x5d53('0x5')]({'port':0x232a});function respondWithRpcPromise(_0x2b3d58,_0x4138b4,_0x39d8ff){return new BPromise(function(_0x41a7fd,_0x2a7836){return client[_0x5d53('0x6')](_0x2b3d58,_0x39d8ff)[_0x5d53('0x7')](function(_0x26cf43){logger['info']('FaxQueueReport,\x20%s,\x20%s',_0x4138b4,_0x5d53('0x8'));logger[_0x5d53('0x9')](_0x5d53('0xa'),_0x4138b4,_0x5d53('0x8'),JSON['stringify'](_0x26cf43));if(_0x26cf43[_0x5d53('0xb')]){if(_0x26cf43[_0x5d53('0xb')][_0x5d53('0xc')]===0x1f4){logger[_0x5d53('0xb')](_0x5d53('0xd'),_0x4138b4,_0x26cf43[_0x5d53('0xb')][_0x5d53('0xe')]);return _0x2a7836(_0x26cf43['error'][_0x5d53('0xe')]);}logger[_0x5d53('0xb')](_0x5d53('0xd'),_0x4138b4,_0x26cf43[_0x5d53('0xb')][_0x5d53('0xe')]);return _0x41a7fd(_0x26cf43[_0x5d53('0xb')]['message']);}else{logger[_0x5d53('0xf')]('FaxQueueReport,\x20%s,\x20%s',_0x4138b4,_0x5d53('0x8'));_0x41a7fd(_0x26cf43['result'][_0x5d53('0xe')]);}})['catch'](function(_0x3f4505){logger[_0x5d53('0xb')](_0x5d53('0xd'),_0x4138b4,_0x3f4505);_0x2a7836(_0x3f4505);});});}exports[_0x5d53('0x10')]=function(_0x17b6f8){var _0x111036=this;return new Promise(function(_0x1010fb,_0x161dc3){return db[_0x5d53('0x11')][_0x5d53('0x12')](_0x17b6f8[_0x5d53('0x13')],{'raw':_0x17b6f8[_0x5d53('0x14')]?_0x17b6f8[_0x5d53('0x14')][_0x5d53('0x15')]===undefined?!![]:![]:!![]})[_0x5d53('0x7')](function(_0x431c89){logger['info']('CreateFaxQueueReport',_0x17b6f8);logger[_0x5d53('0x9')](_0x5d53('0x10'),_0x17b6f8,JSON[_0x5d53('0x16')](_0x431c89));_0x1010fb(_0x431c89);})[_0x5d53('0x17')](function(_0x2fe496){logger[_0x5d53('0xb')](_0x5d53('0x10'),_0x2fe496[_0x5d53('0xe')],_0x17b6f8);_0x161dc3(_0x111036[_0x5d53('0xb')](0x1f4,_0x2fe496[_0x5d53('0xe')]));});});};exports[_0x5d53('0x18')]=function(_0x16aa60){var _0x544162=this;return new Promise(function(_0x2a9239,_0x3597da){return db[_0x5d53('0x11')][_0x5d53('0x19')](_0x16aa60[_0x5d53('0x13')],{'raw':_0x16aa60[_0x5d53('0x14')]?_0x16aa60[_0x5d53('0x14')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x16aa60[_0x5d53('0x14')]?_0x16aa60[_0x5d53('0x14')][_0x5d53('0x1a')]||null:null,'attributes':_0x16aa60[_0x5d53('0x14')]?_0x16aa60[_0x5d53('0x14')][_0x5d53('0x1b')]||null:null,'limit':_0x16aa60[_0x5d53('0x14')]?_0x16aa60[_0x5d53('0x14')][_0x5d53('0x1c')]||null:null})[_0x5d53('0x7')](function(_0x2e421d){logger[_0x5d53('0xf')]('UpdateFaxQueueReport',_0x16aa60);logger['debug'](_0x5d53('0x18'),_0x16aa60,JSON[_0x5d53('0x16')](_0x2e421d));_0x2a9239(_0x2e421d);})[_0x5d53('0x17')](function(_0x47bea0){logger[_0x5d53('0xb')](_0x5d53('0x18'),_0x47bea0[_0x5d53('0xe')],_0x16aa60);_0x3597da(_0x544162['error'](0x1f4,_0x47bea0[_0x5d53('0xe')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index 68ef200..b9a0c5f 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 _0x5e58=['show','create','delete','destroy','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueueReport.controller','get','isAuthenticated','index','describe','/:id'];(function(_0x5a13de,_0x156d86){var _0x58304d=function(_0x1ef25e){while(--_0x1ef25e){_0x5a13de['push'](_0x5a13de['shift']());}};_0x58304d(++_0x156d86);}(_0x5e58,0x1be));var _0x85e5=function(_0xbb4325,_0x293598){_0xbb4325=_0xbb4325-0x0;var _0xf7423a=_0x5e58[_0xbb4325];return _0xf7423a;};'use strict';var multer=require(_0x85e5('0x0'));var util=require('util');var path=require(_0x85e5('0x1'));var timeout=require('connect-timeout');var express=require(_0x85e5('0x2'));var router=express[_0x85e5('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x85e5('0x4'));var interaction=require(_0x85e5('0x5'));var config=require(_0x85e5('0x6'));var controller=require(_0x85e5('0x7'));router[_0x85e5('0x8')]('/',auth[_0x85e5('0x9')](),controller[_0x85e5('0xa')]);router['get']('/describe',auth[_0x85e5('0x9')](),controller[_0x85e5('0xb')]);router[_0x85e5('0x8')](_0x85e5('0xc'),auth[_0x85e5('0x9')](),controller[_0x85e5('0xd')]);router['post']('/',auth[_0x85e5('0x9')](),controller[_0x85e5('0xe')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router[_0x85e5('0xf')]('/:id',auth[_0x85e5('0x9')](),controller[_0x85e5('0x10')]);module['exports']=router; \ No newline at end of file +var _0xc468=['/describe','/:id','show','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./faxQueueReport.controller','get','isAuthenticated','index'];(function(_0xf58718,_0x33541a){var _0x5aea10=function(_0x16f386){while(--_0x16f386){_0xf58718['push'](_0xf58718['shift']());}};_0x5aea10(++_0x33541a);}(_0xc468,0xcf));var _0x8c46=function(_0x29613b,_0x4ecc1c){_0x29613b=_0x29613b-0x0;var _0x200b13=_0xc468[_0x29613b];return _0x200b13;};'use strict';var multer=require(_0x8c46('0x0'));var util=require(_0x8c46('0x1'));var path=require(_0x8c46('0x2'));var timeout=require(_0x8c46('0x3'));var express=require(_0x8c46('0x4'));var router=express[_0x8c46('0x5')]();var fs_extra=require(_0x8c46('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x8c46('0x7'));var config=require(_0x8c46('0x8'));var controller=require(_0x8c46('0x9'));router[_0x8c46('0xa')]('/',auth[_0x8c46('0xb')](),controller[_0x8c46('0xc')]);router[_0x8c46('0xa')](_0x8c46('0xd'),auth['isAuthenticated'](),controller['describe']);router[_0x8c46('0xa')](_0x8c46('0xe'),auth[_0x8c46('0xb')](),controller[_0x8c46('0xf')]);router['post']('/',auth[_0x8c46('0xb')](),controller['create']);router[_0x8c46('0x10')](_0x8c46('0xe'),auth[_0x8c46('0xb')](),controller[_0x8c46('0x11')]);router['delete'](_0x8c46('0xe'),auth['isAuthenticated'](),controller[_0x8c46('0x12')]);module[_0x8c46('0x13')]=router; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.attributes.js b/server/api/faxTransferReport/faxTransferReport.attributes.js index af00789..2e8cf75 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 _0x70e0=['NOW','moment','sequelize','exports','account','agent','queue'];(function(_0x1dce30,_0x5a776c){var _0x49bd71=function(_0x351020){while(--_0x351020){_0x1dce30['push'](_0x1dce30['shift']());}};_0x49bd71(++_0x5a776c);}(_0x70e0,0x17b));var _0x070e=function(_0x34874f,_0xb4f7f1){_0x34874f=_0x34874f-0x0;var _0x56b834=_0x70e0[_0x34874f];return _0x56b834;};'use strict';var moment=require(_0x070e('0x0'));var Sequelize=require(_0x070e('0x1'));module[_0x070e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x070e('0x3'),_0x070e('0x4'),_0x070e('0x5')),'allowNull':![],'defaultValue':_0x070e('0x5')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x070e('0x6')]}}; \ No newline at end of file +var _0x008c=['ENUM','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0x428cd4,_0x2fe3ff){var _0x208cdb=function(_0x2a7662){while(--_0x2a7662){_0x428cd4['push'](_0x428cd4['shift']());}};_0x208cdb(++_0x2fe3ff);}(_0x008c,0x188));var _0xc008=function(_0x59e862,_0x477bf2){_0x59e862=_0x59e862-0x0;var _0x1a25ee=_0x008c[_0x59e862];return _0x1a25ee;};'use strict';var moment=require(_0xc008('0x0'));var Sequelize=require(_0xc008('0x1'));module[_0xc008('0x2')]={'uniqueid':{'type':Sequelize[_0xc008('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xc008('0x4')]('account',_0xc008('0x5'),_0xc008('0x6')),'allowNull':![],'defaultValue':_0xc008('0x6')},'transferredAt':{'type':Sequelize[_0xc008('0x7')],'allowNull':![],'defaultValue':Sequelize[_0xc008('0x8')]}}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index 05eb59f..49c9f63 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 _0x6683=['hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','options','count','include','rows','catch','show','params','keys','rawAttributes','includeAll','create','body','update','find','describe','eml-format','rimraf','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','undefined','set','Content-Range','apply','reject','then','destroy','error','stack','name','send','map','FaxTransferReport','fieldName','type','key','model','query','intersection','attributes','fields','length'];(function(_0x564a3a,_0x49d35c){var _0x8193f9=function(_0x3dfe7d){while(--_0x3dfe7d){_0x564a3a['push'](_0x564a3a['shift']());}};_0x8193f9(++_0x49d35c);}(_0x6683,0x154));var _0x3668=function(_0x2bbc07,_0x1e2168){_0x2bbc07=_0x2bbc07-0x0;var _0x6879e4=_0x6683[_0x2bbc07];return _0x6879e4;};'use strict';var emlformat=require(_0x3668('0x0'));var rimraf=require(_0x3668('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x3668('0x2'));var moment=require(_0x3668('0x3'));var BPromise=require(_0x3668('0x4'));var Mustache=require('mustache');var util=require(_0x3668('0x5'));var path=require(_0x3668('0x6'));var sox=require(_0x3668('0x7'));var csv=require(_0x3668('0x8'));var ejs=require(_0x3668('0x9'));var fs=require('fs');var fs_extra=require(_0x3668('0xa'));var _=require(_0x3668('0xb'));var squel=require(_0x3668('0xc'));var crypto=require(_0x3668('0xd'));var jsforce=require(_0x3668('0xe'));var deskjs=require(_0x3668('0xf'));var toCsv=require(_0x3668('0x8'));var querystring=require(_0x3668('0x10'));var Papa=require(_0x3668('0x11'));var Redis=require(_0x3668('0x12'));var authService=require(_0x3668('0x13'));var qs=require(_0x3668('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3668('0x15'));var logger=require(_0x3668('0x16'))(_0x3668('0x17'));var utils=require(_0x3668('0x18'));var config=require(_0x3668('0x19'));var licenseUtil=require(_0x3668('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x465453,_0x272401){_0x272401=_0x272401||0xcc;return function(_0x1fc1a3){if(_0x1fc1a3){return _0x465453[_0x3668('0x1b')](_0x272401);}return _0x465453[_0x3668('0x1c')](_0x272401)[_0x3668('0x1d')]();};}function respondWithResult(_0x5f9e67,_0x51b1ad){_0x51b1ad=_0x51b1ad||0xc8;return function(_0x4da748){if(_0x4da748){return _0x5f9e67[_0x3668('0x1c')](_0x51b1ad)[_0x3668('0x1e')](_0x4da748);}};}function respondWithFilteredResult(_0x43a094,_0x518d3e){return function(_0x21de31){if(_0x21de31){var _0x236f1e=typeof _0x518d3e[_0x3668('0x1f')]==='undefined'&&typeof _0x518d3e[_0x3668('0x20')]===_0x3668('0x21');var _0x40eec6=_0x21de31['count'];var _0x4d9083=_0x236f1e?0x0:_0x518d3e[_0x3668('0x1f')];var _0x4ae3f3=_0x236f1e?_0x21de31['count']:_0x518d3e[_0x3668('0x1f')]+_0x518d3e['limit'];var _0x548deb;if(_0x4ae3f3>=_0x40eec6){_0x4ae3f3=_0x40eec6;_0x548deb=0xc8;}else{_0x548deb=0xce;}_0x43a094[_0x3668('0x1c')](_0x548deb);return _0x43a094[_0x3668('0x22')](_0x3668('0x23'),_0x4d9083+'-'+_0x4ae3f3+'/'+_0x40eec6)[_0x3668('0x1e')](_0x21de31);}return null;};}function patchUpdates(_0x398c2a){return function(_0x16f7b2){try{jsonpatch[_0x3668('0x24')](_0x16f7b2,_0x398c2a,!![]);}catch(_0x3ed688){return BPromise[_0x3668('0x25')](_0x3ed688);}return _0x16f7b2['save']();};}function saveUpdates(_0x557777,_0x376920){return function(_0x211310){if(_0x211310){return _0x211310['update'](_0x557777)[_0x3668('0x26')](function(_0xefe0de){return _0xefe0de;});}return null;};}function removeEntity(_0x47b720,_0x276faa){return function(_0x2c7347){if(_0x2c7347){return _0x2c7347[_0x3668('0x27')]()[_0x3668('0x26')](function(){_0x47b720[_0x3668('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3d0569,_0xea4717){return function(_0x674c60){if(!_0x674c60){_0x3d0569[_0x3668('0x1b')](0x194);}return _0x674c60;};}function handleError(_0x343f0d,_0x292e77){_0x292e77=_0x292e77||0x1f4;return function(_0xe1bbfd){logger[_0x3668('0x28')](_0xe1bbfd[_0x3668('0x29')]);if(_0xe1bbfd[_0x3668('0x2a')]){delete _0xe1bbfd['name'];}_0x343f0d[_0x3668('0x1c')](_0x292e77)[_0x3668('0x2b')](_0xe1bbfd);};}exports['index']=function(_0x1e9088,_0x26ea8f){var _0x5039bc={},_0x4e91d5={},_0x4bd200={'count':0x0,'rows':[]};var _0x3e64fd=_[_0x3668('0x2c')](db[_0x3668('0x2d')]['rawAttributes'],function(_0x1106a8){return{'name':_0x1106a8[_0x3668('0x2e')],'type':_0x1106a8[_0x3668('0x2f')][_0x3668('0x30')]};});_0x4e91d5[_0x3668('0x31')]=_['map'](_0x3e64fd,_0x3668('0x2a'));_0x4e91d5[_0x3668('0x32')]=_['keys'](_0x1e9088[_0x3668('0x32')]);_0x4e91d5['filters']=_[_0x3668('0x33')](_0x4e91d5[_0x3668('0x31')],_0x4e91d5['query']);_0x5039bc[_0x3668('0x34')]=_[_0x3668('0x33')](_0x4e91d5['model'],qs[_0x3668('0x35')](_0x1e9088[_0x3668('0x32')]['fields']));_0x5039bc[_0x3668('0x34')]=_0x5039bc[_0x3668('0x34')][_0x3668('0x36')]?_0x5039bc['attributes']:_0x4e91d5[_0x3668('0x31')];if(!_0x1e9088[_0x3668('0x32')][_0x3668('0x37')](_0x3668('0x38'))){_0x5039bc[_0x3668('0x20')]=qs[_0x3668('0x20')](_0x1e9088['query'][_0x3668('0x20')]);_0x5039bc['offset']=qs[_0x3668('0x1f')](_0x1e9088['query'][_0x3668('0x1f')]);}_0x5039bc[_0x3668('0x39')]=qs[_0x3668('0x3a')](_0x1e9088['query'][_0x3668('0x3a')]);_0x5039bc[_0x3668('0x3b')]=qs[_0x3668('0x3c')](_[_0x3668('0x3d')](_0x1e9088[_0x3668('0x32')],_0x4e91d5['filters']),_0x3e64fd);if(_0x1e9088[_0x3668('0x32')][_0x3668('0x3e')]){_0x5039bc[_0x3668('0x3b')]=_[_0x3668('0x3f')](_0x5039bc[_0x3668('0x3b')],{'$or':_[_0x3668('0x2c')](_0x3e64fd,function(_0x35261d){if(_0x35261d[_0x3668('0x2f')]!=='VIRTUAL'){var _0x2cad95={};_0x2cad95[_0x35261d['name']]={'$like':'%'+_0x1e9088[_0x3668('0x32')][_0x3668('0x3e')]+'%'};return _0x2cad95;}})});}_0x5039bc=_['merge']({},_0x5039bc,_0x1e9088[_0x3668('0x40')]);var _0x12dd0e={'where':_0x5039bc[_0x3668('0x3b')]};return db[_0x3668('0x2d')][_0x3668('0x41')](_0x12dd0e)[_0x3668('0x26')](function(_0x1a6e02){_0x4bd200[_0x3668('0x41')]=_0x1a6e02;if(_0x1e9088[_0x3668('0x32')]['includeAll']){_0x5039bc[_0x3668('0x42')]=[{'all':!![]}];}return db[_0x3668('0x2d')]['findAll'](_0x5039bc);})[_0x3668('0x26')](function(_0x4f8ef9){_0x4bd200[_0x3668('0x43')]=_0x4f8ef9;return _0x4bd200;})[_0x3668('0x26')](respondWithFilteredResult(_0x26ea8f,_0x5039bc))[_0x3668('0x44')](handleError(_0x26ea8f,null));};exports[_0x3668('0x45')]=function(_0x219bd0,_0x366673){var _0x2c7904={'raw':!![],'where':{'id':_0x219bd0[_0x3668('0x46')]['id']}},_0xe40ec3={};_0xe40ec3[_0x3668('0x31')]=_[_0x3668('0x47')](db[_0x3668('0x2d')][_0x3668('0x48')]);_0xe40ec3['query']=_[_0x3668('0x47')](_0x219bd0['query']);_0xe40ec3[_0x3668('0x3c')]=_[_0x3668('0x33')](_0xe40ec3['model'],_0xe40ec3[_0x3668('0x32')]);_0x2c7904[_0x3668('0x34')]=_['intersection'](_0xe40ec3[_0x3668('0x31')],qs[_0x3668('0x35')](_0x219bd0[_0x3668('0x32')][_0x3668('0x35')]));_0x2c7904[_0x3668('0x34')]=_0x2c7904[_0x3668('0x34')][_0x3668('0x36')]?_0x2c7904[_0x3668('0x34')]:_0xe40ec3[_0x3668('0x31')];if(_0x219bd0[_0x3668('0x32')][_0x3668('0x49')]){_0x2c7904[_0x3668('0x42')]=[{'all':!![]}];}_0x2c7904=_[_0x3668('0x3f')]({},_0x2c7904,_0x219bd0['options']);return db['FaxTransferReport']['find'](_0x2c7904)[_0x3668('0x26')](handleEntityNotFound(_0x366673,null))[_0x3668('0x26')](respondWithResult(_0x366673,null))[_0x3668('0x44')](handleError(_0x366673,null));};exports[_0x3668('0x4a')]=function(_0x327d7c,_0xf52b1a){return db[_0x3668('0x2d')][_0x3668('0x4a')](_0x327d7c[_0x3668('0x4b')],{})[_0x3668('0x26')](respondWithResult(_0xf52b1a,0xc9))[_0x3668('0x44')](handleError(_0xf52b1a,null));};exports[_0x3668('0x4c')]=function(_0x15b685,_0x59cf26){if(_0x15b685[_0x3668('0x4b')]['id']){delete _0x15b685['body']['id'];}return db[_0x3668('0x2d')][_0x3668('0x4d')]({'where':{'id':_0x15b685['params']['id']}})['then'](handleEntityNotFound(_0x59cf26,null))['then'](saveUpdates(_0x15b685[_0x3668('0x4b')],null))[_0x3668('0x26')](respondWithResult(_0x59cf26,null))[_0x3668('0x44')](handleError(_0x59cf26,null));};exports[_0x3668('0x27')]=function(_0x3b96d1,_0x161947){return db[_0x3668('0x2d')][_0x3668('0x4d')]({'where':{'id':_0x3b96d1['params']['id']}})[_0x3668('0x26')](handleEntityNotFound(_0x161947,null))[_0x3668('0x26')](removeEntity(_0x161947,null))['catch'](handleError(_0x161947,null));};exports['describe']=function(_0x2fe788,_0x54736d){return db[_0x3668('0x2d')][_0x3668('0x4e')]()[_0x3668('0x26')](respondWithResult(_0x54736d,null))[_0x3668('0x44')](handleError(_0x54736d,null));}; \ No newline at end of file +var _0x1356=['offset','undefined','limit','count','set','Content-Range','apply','save','then','name','send','index','rawAttributes','fieldName','type','key','map','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','FaxTransferReport','findAll','rows','catch','show','params','keys','includeAll','include','find','create','body','update','destroy','describe','zip-dir','fast-json-patch','request-promise','moment','mustache','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json'];(function(_0x4a9d04,_0x1e6666){var _0x47a604=function(_0x270623){while(--_0x270623){_0x4a9d04['push'](_0x4a9d04['shift']());}};_0x47a604(++_0x1e6666);}(_0x1356,0x19d));var _0x6135=function(_0x2a74f4,_0x5e93c4){_0x2a74f4=_0x2a74f4-0x0;var _0x394917=_0x1356[_0x2a74f4];return _0x394917;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x6135('0x0'));var jsonpatch=require(_0x6135('0x1'));var rp=require(_0x6135('0x2'));var moment=require(_0x6135('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x6135('0x4'));var util=require('util');var path=require('path');var sox=require(_0x6135('0x5'));var csv=require(_0x6135('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6135('0x7'));var _=require(_0x6135('0x8'));var squel=require(_0x6135('0x9'));var crypto=require(_0x6135('0xa'));var jsforce=require(_0x6135('0xb'));var deskjs=require(_0x6135('0xc'));var toCsv=require(_0x6135('0x6'));var querystring=require('querystring');var Papa=require(_0x6135('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x6135('0xe'));var hardwareService=require(_0x6135('0xf'));var logger=require(_0x6135('0x10'))(_0x6135('0x11'));var utils=require('../../config/utils');var config=require(_0x6135('0x12'));var licenseUtil=require(_0x6135('0x13'));var db=require(_0x6135('0x14'))['db'];function respondWithStatusCode(_0x480955,_0x54af16){_0x54af16=_0x54af16||0xcc;return function(_0x1f5143){if(_0x1f5143){return _0x480955[_0x6135('0x15')](_0x54af16);}return _0x480955[_0x6135('0x16')](_0x54af16)[_0x6135('0x17')]();};}function respondWithResult(_0x38575f,_0x17c23d){_0x17c23d=_0x17c23d||0xc8;return function(_0x4065a7){if(_0x4065a7){return _0x38575f['status'](_0x17c23d)[_0x6135('0x18')](_0x4065a7);}};}function respondWithFilteredResult(_0x146292,_0xd7e407){return function(_0x1dee5b){if(_0x1dee5b){var _0x37d1b0=typeof _0xd7e407[_0x6135('0x19')]===_0x6135('0x1a')&&typeof _0xd7e407[_0x6135('0x1b')]==='undefined';var _0x48eb63=_0x1dee5b[_0x6135('0x1c')];var _0x115b11=_0x37d1b0?0x0:_0xd7e407[_0x6135('0x19')];var _0x528dc5=_0x37d1b0?_0x1dee5b[_0x6135('0x1c')]:_0xd7e407[_0x6135('0x19')]+_0xd7e407[_0x6135('0x1b')];var _0x2c2c75;if(_0x528dc5>=_0x48eb63){_0x528dc5=_0x48eb63;_0x2c2c75=0xc8;}else{_0x2c2c75=0xce;}_0x146292[_0x6135('0x16')](_0x2c2c75);return _0x146292[_0x6135('0x1d')](_0x6135('0x1e'),_0x115b11+'-'+_0x528dc5+'/'+_0x48eb63)[_0x6135('0x18')](_0x1dee5b);}return null;};}function patchUpdates(_0x42218b){return function(_0xcab579){try{jsonpatch[_0x6135('0x1f')](_0xcab579,_0x42218b,!![]);}catch(_0x1d3029){return BPromise['reject'](_0x1d3029);}return _0xcab579[_0x6135('0x20')]();};}function saveUpdates(_0x53459b,_0x3e3164){return function(_0x6d82cb){if(_0x6d82cb){return _0x6d82cb['update'](_0x53459b)[_0x6135('0x21')](function(_0x140be5){return _0x140be5;});}return null;};}function removeEntity(_0x30cd71,_0x4ba410){return function(_0x21db13){if(_0x21db13){return _0x21db13['destroy']()['then'](function(){_0x30cd71[_0x6135('0x16')](0xcc)[_0x6135('0x17')]();});}};}function handleEntityNotFound(_0x4ce4b6,_0x117da0){return function(_0x1bc6f8){if(!_0x1bc6f8){_0x4ce4b6[_0x6135('0x15')](0x194);}return _0x1bc6f8;};}function handleError(_0x268a58,_0x26650a){_0x26650a=_0x26650a||0x1f4;return function(_0x27b944){logger['error'](_0x27b944['stack']);if(_0x27b944[_0x6135('0x22')]){delete _0x27b944[_0x6135('0x22')];}_0x268a58[_0x6135('0x16')](_0x26650a)[_0x6135('0x23')](_0x27b944);};}exports[_0x6135('0x24')]=function(_0x233a0a,_0x4516f2){var _0x628a6d={},_0x46ed6e={},_0xaa449b={'count':0x0,'rows':[]};var _0x17d245=_['map'](db['FaxTransferReport'][_0x6135('0x25')],function(_0x8691ad){return{'name':_0x8691ad[_0x6135('0x26')],'type':_0x8691ad[_0x6135('0x27')][_0x6135('0x28')]};});_0x46ed6e['model']=_[_0x6135('0x29')](_0x17d245,_0x6135('0x22'));_0x46ed6e['query']=_['keys'](_0x233a0a[_0x6135('0x2a')]);_0x46ed6e[_0x6135('0x2b')]=_[_0x6135('0x2c')](_0x46ed6e[_0x6135('0x2d')],_0x46ed6e[_0x6135('0x2a')]);_0x628a6d[_0x6135('0x2e')]=_['intersection'](_0x46ed6e['model'],qs[_0x6135('0x2f')](_0x233a0a[_0x6135('0x2a')][_0x6135('0x2f')]));_0x628a6d[_0x6135('0x2e')]=_0x628a6d[_0x6135('0x2e')][_0x6135('0x30')]?_0x628a6d[_0x6135('0x2e')]:_0x46ed6e['model'];if(!_0x233a0a['query'][_0x6135('0x31')](_0x6135('0x32'))){_0x628a6d[_0x6135('0x1b')]=qs['limit'](_0x233a0a[_0x6135('0x2a')]['limit']);_0x628a6d[_0x6135('0x19')]=qs[_0x6135('0x19')](_0x233a0a[_0x6135('0x2a')][_0x6135('0x19')]);}_0x628a6d[_0x6135('0x33')]=qs[_0x6135('0x34')](_0x233a0a[_0x6135('0x2a')][_0x6135('0x34')]);_0x628a6d[_0x6135('0x35')]=qs[_0x6135('0x2b')](_['pick'](_0x233a0a[_0x6135('0x2a')],_0x46ed6e[_0x6135('0x2b')]),_0x17d245);if(_0x233a0a[_0x6135('0x2a')][_0x6135('0x36')]){_0x628a6d[_0x6135('0x35')]=_[_0x6135('0x37')](_0x628a6d[_0x6135('0x35')],{'$or':_[_0x6135('0x29')](_0x17d245,function(_0x313b71){if(_0x313b71[_0x6135('0x27')]!==_0x6135('0x38')){var _0xbe4921={};_0xbe4921[_0x313b71[_0x6135('0x22')]]={'$like':'%'+_0x233a0a[_0x6135('0x2a')]['filter']+'%'};return _0xbe4921;}})});}_0x628a6d=_[_0x6135('0x37')]({},_0x628a6d,_0x233a0a[_0x6135('0x39')]);var _0x500b5c={'where':_0x628a6d[_0x6135('0x35')]};return db[_0x6135('0x3a')]['count'](_0x500b5c)[_0x6135('0x21')](function(_0x324211){_0xaa449b[_0x6135('0x1c')]=_0x324211;if(_0x233a0a[_0x6135('0x2a')]['includeAll']){_0x628a6d['include']=[{'all':!![]}];}return db['FaxTransferReport'][_0x6135('0x3b')](_0x628a6d);})['then'](function(_0x4f9852){_0xaa449b[_0x6135('0x3c')]=_0x4f9852;return _0xaa449b;})['then'](respondWithFilteredResult(_0x4516f2,_0x628a6d))[_0x6135('0x3d')](handleError(_0x4516f2,null));};exports[_0x6135('0x3e')]=function(_0x5e8c89,_0x2309f8){var _0x4aa6ef={'raw':!![],'where':{'id':_0x5e8c89[_0x6135('0x3f')]['id']}},_0x3dab04={};_0x3dab04[_0x6135('0x2d')]=_[_0x6135('0x40')](db[_0x6135('0x3a')][_0x6135('0x25')]);_0x3dab04[_0x6135('0x2a')]=_[_0x6135('0x40')](_0x5e8c89[_0x6135('0x2a')]);_0x3dab04[_0x6135('0x2b')]=_[_0x6135('0x2c')](_0x3dab04[_0x6135('0x2d')],_0x3dab04[_0x6135('0x2a')]);_0x4aa6ef[_0x6135('0x2e')]=_[_0x6135('0x2c')](_0x3dab04[_0x6135('0x2d')],qs[_0x6135('0x2f')](_0x5e8c89[_0x6135('0x2a')][_0x6135('0x2f')]));_0x4aa6ef['attributes']=_0x4aa6ef[_0x6135('0x2e')]['length']?_0x4aa6ef[_0x6135('0x2e')]:_0x3dab04[_0x6135('0x2d')];if(_0x5e8c89[_0x6135('0x2a')][_0x6135('0x41')]){_0x4aa6ef[_0x6135('0x42')]=[{'all':!![]}];}_0x4aa6ef=_[_0x6135('0x37')]({},_0x4aa6ef,_0x5e8c89[_0x6135('0x39')]);return db['FaxTransferReport'][_0x6135('0x43')](_0x4aa6ef)[_0x6135('0x21')](handleEntityNotFound(_0x2309f8,null))[_0x6135('0x21')](respondWithResult(_0x2309f8,null))[_0x6135('0x3d')](handleError(_0x2309f8,null));};exports[_0x6135('0x44')]=function(_0x4dd9ce,_0x5cf647){return db[_0x6135('0x3a')][_0x6135('0x44')](_0x4dd9ce[_0x6135('0x45')],{})['then'](respondWithResult(_0x5cf647,0xc9))[_0x6135('0x3d')](handleError(_0x5cf647,null));};exports[_0x6135('0x46')]=function(_0x490916,_0x21538b){if(_0x490916[_0x6135('0x45')]['id']){delete _0x490916[_0x6135('0x45')]['id'];}return db[_0x6135('0x3a')][_0x6135('0x43')]({'where':{'id':_0x490916['params']['id']}})[_0x6135('0x21')](handleEntityNotFound(_0x21538b,null))[_0x6135('0x21')](saveUpdates(_0x490916[_0x6135('0x45')],null))[_0x6135('0x21')](respondWithResult(_0x21538b,null))[_0x6135('0x3d')](handleError(_0x21538b,null));};exports[_0x6135('0x47')]=function(_0x14cf4c,_0x1cb976){return db['FaxTransferReport'][_0x6135('0x43')]({'where':{'id':_0x14cf4c[_0x6135('0x3f')]['id']}})[_0x6135('0x21')](handleEntityNotFound(_0x1cb976,null))[_0x6135('0x21')](removeEntity(_0x1cb976,null))[_0x6135('0x3d')](handleError(_0x1cb976,null));};exports[_0x6135('0x48')]=function(_0x4a4790,_0x3004f3){return db[_0x6135('0x3a')]['describe']()[_0x6135('0x21')](respondWithResult(_0x3004f3,null))[_0x6135('0x3d')](handleError(_0x3004f3,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index 85c73fe..7cc2488 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 _0xfd14=['path','../../config/environment','define','report_fax_transfer','uniqueid','../../config/logger','api','request-promise'];(function(_0x3b5e02,_0x535469){var _0x59464c=function(_0x2d11cb){while(--_0x2d11cb){_0x3b5e02['push'](_0x3b5e02['shift']());}};_0x59464c(++_0x535469);}(_0xfd14,0x195));var _0x4fd1=function(_0x46ad37,_0x8e795){_0x46ad37=_0x46ad37-0x0;var _0x6927e3=_0xfd14[_0x46ad37];return _0x6927e3;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x4fd1('0x0'))(_0x4fd1('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x4fd1('0x2'));var fs=require('fs');var path=require(_0x4fd1('0x3'));var rimraf=require('rimraf');var config=require(_0x4fd1('0x4'));var attributes=require('./faxTransferReport.attributes');module['exports']=function(_0x294a09,_0x4ab501){return _0x294a09[_0x4fd1('0x5')]('FaxTransferReport',attributes,{'tableName':_0x4fd1('0x6'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x4fd1('0x7')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe34f=['request-promise','path','rimraf','../../config/environment','./faxTransferReport.attributes','define','FaxTransferReport','report_fax_transfer','moment','bluebird'];(function(_0x15f892,_0x2139c3){var _0x188630=function(_0x591c79){while(--_0x591c79){_0x15f892['push'](_0x15f892['shift']());}};_0x188630(++_0x2139c3);}(_0xe34f,0xbc));var _0xfe34=function(_0x4f3b87,_0x388c4a){_0x4f3b87=_0x4f3b87-0x0;var _0x5a8062=_0xe34f[_0x4f3b87];return _0x5a8062;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xfe34('0x0'));var BPromise=require(_0xfe34('0x1'));var rp=require(_0xfe34('0x2'));var fs=require('fs');var path=require(_0xfe34('0x3'));var rimraf=require(_0xfe34('0x4'));var config=require(_0xfe34('0x5'));var attributes=require(_0xfe34('0x6'));module['exports']=function(_0x1a3c2b,_0x24e8cb){return _0x1a3c2b[_0xfe34('0x7')](_0xfe34('0x8'),attributes,{'tableName':_0xfe34('0x9'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.rpc.js b/server/api/faxTransferReport/faxTransferReport.rpc.js index 74df6bd..1034ef6 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 _0x5e92=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','FaxTransferReport,\x20%s,\x20%s','request\x20sent','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x39f559,_0x2ad5bc){var _0x359a88=function(_0x54598e){while(--_0x54598e){_0x39f559['push'](_0x39f559['shift']());}};_0x359a88(++_0x2ad5bc);}(_0x5e92,0xbb));var _0x25e9=function(_0x177e76,_0x58849b){_0x177e76=_0x177e76-0x0;var _0x30d292=_0x5e92[_0x177e76];return _0x30d292;};'use strict';var _=require(_0x25e9('0x0'));var util=require(_0x25e9('0x1'));var moment=require(_0x25e9('0x2'));var BPromise=require(_0x25e9('0x3'));var rs=require(_0x25e9('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x25e9('0x5'))['db'];var utils=require(_0x25e9('0x6'));var logger=require(_0x25e9('0x7'))(_0x25e9('0x8'));var config=require(_0x25e9('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x25e9('0xa')][_0x25e9('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x249805,_0x406d8c,_0x2ca23d){return new BPromise(function(_0x4d175e,_0x4dde4c){return client[_0x25e9('0xc')](_0x249805,_0x2ca23d)[_0x25e9('0xd')](function(_0x49016d){logger[_0x25e9('0xe')](_0x25e9('0xf'),_0x406d8c,_0x25e9('0x10'));logger[_0x25e9('0x11')](_0x25e9('0x12'),_0x406d8c,_0x25e9('0x10'),JSON[_0x25e9('0x13')](_0x49016d));if(_0x49016d[_0x25e9('0x14')]){if(_0x49016d[_0x25e9('0x14')]['code']===0x1f4){logger[_0x25e9('0x14')](_0x25e9('0xf'),_0x406d8c,_0x49016d[_0x25e9('0x14')][_0x25e9('0x15')]);return _0x4dde4c(_0x49016d[_0x25e9('0x14')][_0x25e9('0x15')]);}logger[_0x25e9('0x14')](_0x25e9('0xf'),_0x406d8c,_0x49016d[_0x25e9('0x14')][_0x25e9('0x15')]);return _0x4d175e(_0x49016d[_0x25e9('0x14')][_0x25e9('0x15')]);}else{logger['info'](_0x25e9('0xf'),_0x406d8c,_0x25e9('0x10'));_0x4d175e(_0x49016d[_0x25e9('0x16')][_0x25e9('0x15')]);}})[_0x25e9('0x17')](function(_0x1bfa1a){logger[_0x25e9('0x14')]('FaxTransferReport,\x20%s,\x20%s',_0x406d8c,_0x1bfa1a);_0x4dde4c(_0x1bfa1a);});});} \ No newline at end of file +var _0x7223=['error','code','message','info','result','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','FaxTransferReport,\x20%s,\x20%s','request\x20sent','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x1d18c3,_0x2c5378){var _0x2ce341=function(_0x5db4a6){while(--_0x5db4a6){_0x1d18c3['push'](_0x1d18c3['shift']());}};_0x2ce341(++_0x2c5378);}(_0x7223,0x18c));var _0x3722=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x7223[_0x21a9d9];return _0x46adce;};'use strict';var _=require(_0x3722('0x0'));var util=require(_0x3722('0x1'));var moment=require('moment');var BPromise=require(_0x3722('0x2'));var rs=require(_0x3722('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3722('0x4'))['db'];var utils=require(_0x3722('0x5'));var logger=require(_0x3722('0x6'))(_0x3722('0x7'));var config=require(_0x3722('0x8'));var jayson=require(_0x3722('0x9'));var client=jayson[_0x3722('0xa')][_0x3722('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x282747,_0x5eb448,_0x5ee11c){return new BPromise(function(_0x3e8a25,_0x27308f){return client[_0x3722('0xc')](_0x282747,_0x5ee11c)['then'](function(_0x11c690){logger['info'](_0x3722('0xd'),_0x5eb448,_0x3722('0xe'));logger[_0x3722('0xf')](_0x3722('0x10'),_0x5eb448,_0x3722('0xe'),JSON[_0x3722('0x11')](_0x11c690));if(_0x11c690[_0x3722('0x12')]){if(_0x11c690[_0x3722('0x12')][_0x3722('0x13')]===0x1f4){logger[_0x3722('0x12')](_0x3722('0xd'),_0x5eb448,_0x11c690[_0x3722('0x12')][_0x3722('0x14')]);return _0x27308f(_0x11c690[_0x3722('0x12')]['message']);}logger[_0x3722('0x12')](_0x3722('0xd'),_0x5eb448,_0x11c690[_0x3722('0x12')][_0x3722('0x14')]);return _0x3e8a25(_0x11c690['error'][_0x3722('0x14')]);}else{logger[_0x3722('0x15')](_0x3722('0xd'),_0x5eb448,_0x3722('0xe'));_0x3e8a25(_0x11c690[_0x3722('0x16')][_0x3722('0x14')]);}})['catch'](function(_0x36ab1b){logger[_0x3722('0x12')]('FaxTransferReport,\x20%s,\x20%s',_0x5eb448,_0x36ab1b);_0x27308f(_0x36ab1b);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index 1f792bc..cbaa12b 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 _0x7f7f=['express','Router','fs-extra','../../components/auth/service','./faxTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','post','delete','exports','util','connect-timeout'];(function(_0x3b208d,_0x414cf8){var _0x2a968f=function(_0x243a4b){while(--_0x243a4b){_0x3b208d['push'](_0x3b208d['shift']());}};_0x2a968f(++_0x414cf8);}(_0x7f7f,0xfe));var _0xf7f7=function(_0x36b761,_0x3388c4){_0x36b761=_0x36b761-0x0;var _0x1cbe82=_0x7f7f[_0x36b761];return _0x1cbe82;};'use strict';var multer=require('multer');var util=require(_0xf7f7('0x0'));var path=require('path');var timeout=require(_0xf7f7('0x1'));var express=require(_0xf7f7('0x2'));var router=express[_0xf7f7('0x3')]();var fs_extra=require(_0xf7f7('0x4'));var auth=require(_0xf7f7('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xf7f7('0x6'));router[_0xf7f7('0x7')]('/',auth[_0xf7f7('0x8')](),controller[_0xf7f7('0x9')]);router['get'](_0xf7f7('0xa'),auth[_0xf7f7('0x8')](),controller[_0xf7f7('0xb')]);router['get'](_0xf7f7('0xc'),auth[_0xf7f7('0x8')](),controller['show']);router[_0xf7f7('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0xf7f7('0xc'),auth['isAuthenticated'](),controller['update']);router[_0xf7f7('0xe')](_0xf7f7('0xc'),auth[_0xf7f7('0x8')](),controller['destroy']);module[_0xf7f7('0xf')]=router; \ No newline at end of file +var _0x456d=['put','update','delete','destroy','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./faxTransferReport.controller','index','get','/describe','describe','/:id','isAuthenticated','show','post','create'];(function(_0x369ee0,_0x57a15c){var _0x493a06=function(_0x570aaf){while(--_0x570aaf){_0x369ee0['push'](_0x369ee0['shift']());}};_0x493a06(++_0x57a15c);}(_0x456d,0x97));var _0xd456=function(_0x118af1,_0x2cdca2){_0x118af1=_0x118af1-0x0;var _0x4d1955=_0x456d[_0x118af1];return _0x4d1955;};'use strict';var multer=require('multer');var util=require(_0xd456('0x0'));var path=require('path');var timeout=require(_0xd456('0x1'));var express=require(_0xd456('0x2'));var router=express[_0xd456('0x3')]();var fs_extra=require(_0xd456('0x4'));var auth=require(_0xd456('0x5'));var interaction=require(_0xd456('0x6'));var config=require('../../config/environment');var controller=require(_0xd456('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0xd456('0x8')]);router[_0xd456('0x9')](_0xd456('0xa'),auth['isAuthenticated'](),controller[_0xd456('0xb')]);router[_0xd456('0x9')](_0xd456('0xc'),auth[_0xd456('0xd')](),controller[_0xd456('0xe')]);router[_0xd456('0xf')]('/',auth[_0xd456('0xd')](),controller[_0xd456('0x10')]);router[_0xd456('0x11')]('/:id',auth[_0xd456('0xd')](),controller[_0xd456('0x12')]);router[_0xd456('0x13')](_0xd456('0xc'),auth[_0xd456('0xd')](),controller[_0xd456('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index e5f509e..1b506c4 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 _0x7ec0=['isAuthenticated','index','show','/:id/configurations','getConfigurations','getFields','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','./intDeskAccount.controller','get'];(function(_0x4caeab,_0x5177c9){var _0x1ed98d=function(_0x5d404d){while(--_0x5d404d){_0x4caeab['push'](_0x4caeab['shift']());}};_0x1ed98d(++_0x5177c9);}(_0x7ec0,0xca));var _0x07ec=function(_0x527a09,_0x1f8707){_0x527a09=_0x527a09-0x0;var _0x247ba4=_0x7ec0[_0x527a09];return _0x247ba4;};'use strict';var multer=require(_0x07ec('0x0'));var util=require(_0x07ec('0x1'));var path=require(_0x07ec('0x2'));var timeout=require(_0x07ec('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x07ec('0x4'));var interaction=require(_0x07ec('0x5'));var config=require('../../config/environment');var controller=require(_0x07ec('0x6'));router[_0x07ec('0x7')]('/',auth[_0x07ec('0x8')](),controller[_0x07ec('0x9')]);router['get']('/:id',auth[_0x07ec('0x8')](),controller[_0x07ec('0xa')]);router[_0x07ec('0x7')](_0x07ec('0xb'),auth[_0x07ec('0x8')](),controller[_0x07ec('0xc')]);router[_0x07ec('0x7')]('/:id/fields',auth[_0x07ec('0x8')](),controller[_0x07ec('0xd')]);router[_0x07ec('0xe')]('/',auth['isAuthenticated'](),controller[_0x07ec('0xf')]);router[_0x07ec('0xe')](_0x07ec('0xb'),auth[_0x07ec('0x8')](),controller['addConfiguration']);router[_0x07ec('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x07ec('0x11')]);router[_0x07ec('0x12')]('/:id',auth[_0x07ec('0x8')](),controller[_0x07ec('0x13')]);module[_0x07ec('0x14')]=router; \ No newline at end of file +var _0x62b4=['/:id/configurations','getConfigurations','post','addConfiguration','put','update','delete','destroy','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskAccount.controller','isAuthenticated','index','get','/:id','show'];(function(_0x2e7d01,_0x5777be){var _0x5b0265=function(_0x3ee6b9){while(--_0x3ee6b9){_0x2e7d01['push'](_0x2e7d01['shift']());}};_0x5b0265(++_0x5777be);}(_0x62b4,0xd0));var _0x462b=function(_0x348d2e,_0x2b7b9b){_0x348d2e=_0x348d2e-0x0;var _0x143ca5=_0x62b4[_0x348d2e];return _0x143ca5;};'use strict';var multer=require('multer');var util=require(_0x462b('0x0'));var path=require('path');var timeout=require(_0x462b('0x1'));var express=require('express');var router=express[_0x462b('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x462b('0x3'));var interaction=require(_0x462b('0x4'));var config=require(_0x462b('0x5'));var controller=require(_0x462b('0x6'));router['get']('/',auth[_0x462b('0x7')](),controller[_0x462b('0x8')]);router[_0x462b('0x9')](_0x462b('0xa'),auth[_0x462b('0x7')](),controller[_0x462b('0xb')]);router[_0x462b('0x9')](_0x462b('0xc'),auth[_0x462b('0x7')](),controller[_0x462b('0xd')]);router[_0x462b('0x9')]('/:id/fields',auth[_0x462b('0x7')](),controller['getFields']);router[_0x462b('0xe')]('/',auth[_0x462b('0x7')](),controller['create']);router['post'](_0x462b('0xc'),auth[_0x462b('0x7')](),controller[_0x462b('0xf')]);router[_0x462b('0x10')](_0x462b('0xa'),auth[_0x462b('0x7')](),controller[_0x462b('0x11')]);router[_0x462b('0x12')](_0x462b('0xa'),auth[_0x462b('0x7')](),controller[_0x462b('0x13')]);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 e9a1c98..ea2a46b 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 _0x4b26=['ENUM','basic','integrationTab','newTab','sequelize','STRING'];(function(_0x3651fb,_0x4e40ca){var _0x57ff19=function(_0x3c172b){while(--_0x3c172b){_0x3651fb['push'](_0x3651fb['shift']());}};_0x57ff19(++_0x4e40ca);}(_0x4b26,0x142));var _0x64b2=function(_0x33223a,_0x2fff49){_0x33223a=_0x33223a-0x0;var _0x56906a=_0x4b26[_0x33223a];return _0x56906a;};'use strict';var Sequelize=require(_0x64b2('0x0'));module['exports']={'name':{'type':Sequelize[_0x64b2('0x1')]},'description':{'type':Sequelize[_0x64b2('0x1')]},'username':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x64b2('0x1')]},'authType':{'type':Sequelize[_0x64b2('0x2')](_0x64b2('0x3')),'defaultValue':_0x64b2('0x3')},'password':{'type':Sequelize['STRING']},'consumerKey':{'type':Sequelize['STRING']},'consumerSecret':{'type':Sequelize[_0x64b2('0x1')]},'token':{'type':Sequelize['STRING']},'tokenSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0x64b2('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x64b2('0x4'),_0x64b2('0x5')),'defaultValue':'integrationTab'}}; \ No newline at end of file +var _0x9862=['integrationTab','STRING','ENUM','basic'];(function(_0x4abd58,_0x523c62){var _0x3608a8=function(_0xa5878){while(--_0xa5878){_0x4abd58['push'](_0x4abd58['shift']());}};_0x3608a8(++_0x523c62);}(_0x9862,0x151));var _0x2986=function(_0x517a82,_0x2c4dde){_0x517a82=_0x517a82-0x0;var _0x8fd0d2=_0x9862[_0x517a82];return _0x8fd0d2;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x2986('0x0')]},'description':{'type':Sequelize[_0x2986('0x0')]},'username':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x2986('0x0')]},'authType':{'type':Sequelize[_0x2986('0x1')]('basic'),'defaultValue':_0x2986('0x2')},'password':{'type':Sequelize[_0x2986('0x0')]},'consumerKey':{'type':Sequelize[_0x2986('0x0')]},'consumerSecret':{'type':Sequelize[_0x2986('0x0')]},'token':{'type':Sequelize[_0x2986('0x0')]},'tokenSecret':{'type':Sequelize[_0x2986('0x0')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x2986('0x3'),'newTab'),'defaultValue':'integrationTab'}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index 4116cd1..b96d441 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 _0x2f5c=['undefined','limit','count','set','Content-Range','json','reject','save','update','then','error','stack','name','send','index','map','DeskAccount','fieldName','type','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','includeAll','include','findAll','catch','show','rawAttributes','options','find','create','body','params','destroy','getConfigurations','findOne','addConfiguration','Subjects','getSubjects','channel','Descriptions','getDescriptions','DeskConfiguration','DeskField','getFields','priority','remoteUri','username','consumerKey','token','tokenSecret','GET','format','%s/custom_fields','application/json','authType','headers','Authorization','Basic\x20%s','%s:%s','password','concat','_embedded','label','test','statusCode','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','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','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset'];(function(_0x502096,_0x61ad2f){var _0x4a86f4=function(_0xbae5c3){while(--_0xbae5c3){_0x502096['push'](_0x502096['shift']());}};_0x4a86f4(++_0x61ad2f);}(_0x2f5c,0x1a7));var _0xc2f5=function(_0xe519fc,_0x4b3e34){_0xe519fc=_0xe519fc-0x0;var _0x25811d=_0x2f5c[_0xe519fc];return _0x25811d;};'use strict';var emlformat=require(_0xc2f5('0x0'));var rimraf=require(_0xc2f5('0x1'));var zipdir=require(_0xc2f5('0x2'));var jsonpatch=require(_0xc2f5('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xc2f5('0x4'));var Mustache=require(_0xc2f5('0x5'));var util=require(_0xc2f5('0x6'));var path=require(_0xc2f5('0x7'));var sox=require(_0xc2f5('0x8'));var csv=require(_0xc2f5('0x9'));var ejs=require(_0xc2f5('0xa'));var fs=require('fs');var fs_extra=require(_0xc2f5('0xb'));var _=require('lodash');var squel=require(_0xc2f5('0xc'));var crypto=require(_0xc2f5('0xd'));var jsforce=require(_0xc2f5('0xe'));var deskjs=require(_0xc2f5('0xf'));var toCsv=require(_0xc2f5('0x9'));var querystring=require(_0xc2f5('0x10'));var Papa=require(_0xc2f5('0x11'));var Redis=require(_0xc2f5('0x12'));var authService=require(_0xc2f5('0x13'));var qs=require(_0xc2f5('0x14'));var as=require(_0xc2f5('0x15'));var hardwareService=require(_0xc2f5('0x16'));var logger=require(_0xc2f5('0x17'))(_0xc2f5('0x18'));var utils=require(_0xc2f5('0x19'));var config=require(_0xc2f5('0x1a'));var licenseUtil=require(_0xc2f5('0x1b'));var db=require(_0xc2f5('0x1c'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x10d968,_0x1ca55b){_0x1ca55b=_0x1ca55b||0xcc;return function(_0x1adc14){if(_0x1adc14){return _0x10d968[_0xc2f5('0x1d')](_0x1ca55b);}return _0x10d968[_0xc2f5('0x1e')](_0x1ca55b)[_0xc2f5('0x1f')]();};}function respondWithResult(_0x107dc6,_0xf7c95d){_0xf7c95d=_0xf7c95d||0xc8;return function(_0xdbf0a5){if(_0xdbf0a5){return _0x107dc6['status'](_0xf7c95d)['json'](_0xdbf0a5);}};}function respondWithFilteredResult(_0x185f5c,_0x71cdff){return function(_0x5c2e0a){if(_0x5c2e0a){var _0x1f8122=typeof _0x71cdff[_0xc2f5('0x20')]===_0xc2f5('0x21')&&typeof _0x71cdff[_0xc2f5('0x22')]==='undefined';var _0x496c1f=_0x5c2e0a[_0xc2f5('0x23')];var _0x49b50a=_0x1f8122?0x0:_0x71cdff['offset'];var _0x1c0435=_0x1f8122?_0x5c2e0a[_0xc2f5('0x23')]:_0x71cdff['offset']+_0x71cdff[_0xc2f5('0x22')];var _0x38d6bf;if(_0x1c0435>=_0x496c1f){_0x1c0435=_0x496c1f;_0x38d6bf=0xc8;}else{_0x38d6bf=0xce;}_0x185f5c['status'](_0x38d6bf);return _0x185f5c[_0xc2f5('0x24')](_0xc2f5('0x25'),_0x49b50a+'-'+_0x1c0435+'/'+_0x496c1f)[_0xc2f5('0x26')](_0x5c2e0a);}return null;};}function patchUpdates(_0x4b2ca6){return function(_0x57f01d){try{jsonpatch['apply'](_0x57f01d,_0x4b2ca6,!![]);}catch(_0x5350e1){return BPromise[_0xc2f5('0x27')](_0x5350e1);}return _0x57f01d[_0xc2f5('0x28')]();};}function saveUpdates(_0x1375ce,_0x5a725f){return function(_0x233fc3){if(_0x233fc3){return _0x233fc3[_0xc2f5('0x29')](_0x1375ce)[_0xc2f5('0x2a')](function(_0x3da358){return _0x3da358;});}return null;};}function removeEntity(_0x44086d,_0x2570c1){return function(_0x5b6d5e){if(_0x5b6d5e){return _0x5b6d5e['destroy']()[_0xc2f5('0x2a')](function(){_0x44086d['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x151964,_0x1668ef){return function(_0x3477cf){if(!_0x3477cf){_0x151964[_0xc2f5('0x1d')](0x194);}return _0x3477cf;};}function handleError(_0x5b2231,_0x13e205){_0x13e205=_0x13e205||0x1f4;return function(_0x561e2f){logger[_0xc2f5('0x2b')](_0x561e2f[_0xc2f5('0x2c')]);if(_0x561e2f[_0xc2f5('0x2d')]){delete _0x561e2f[_0xc2f5('0x2d')];}_0x5b2231['status'](_0x13e205)[_0xc2f5('0x2e')](_0x561e2f);};}exports[_0xc2f5('0x2f')]=function(_0x4bdd1a,_0x33c4f5){var _0x456ed4={},_0x558c8e={},_0x34d372={'count':0x0,'rows':[]};var _0x351ddd=_[_0xc2f5('0x30')](db[_0xc2f5('0x31')]['rawAttributes'],function(_0x13ebfd){return{'name':_0x13ebfd[_0xc2f5('0x32')],'type':_0x13ebfd[_0xc2f5('0x33')][_0xc2f5('0x34')]};});_0x558c8e[_0xc2f5('0x35')]=_[_0xc2f5('0x30')](_0x351ddd,_0xc2f5('0x2d'));_0x558c8e[_0xc2f5('0x36')]=_[_0xc2f5('0x37')](_0x4bdd1a['query']);_0x558c8e['filters']=_['intersection'](_0x558c8e['model'],_0x558c8e['query']);_0x456ed4[_0xc2f5('0x38')]=_[_0xc2f5('0x39')](_0x558c8e[_0xc2f5('0x35')],qs[_0xc2f5('0x3a')](_0x4bdd1a[_0xc2f5('0x36')]['fields']));_0x456ed4[_0xc2f5('0x38')]=_0x456ed4[_0xc2f5('0x38')][_0xc2f5('0x3b')]?_0x456ed4[_0xc2f5('0x38')]:_0x558c8e[_0xc2f5('0x35')];if(!_0x4bdd1a[_0xc2f5('0x36')][_0xc2f5('0x3c')](_0xc2f5('0x3d'))){_0x456ed4[_0xc2f5('0x22')]=qs[_0xc2f5('0x22')](_0x4bdd1a['query'][_0xc2f5('0x22')]);_0x456ed4[_0xc2f5('0x20')]=qs[_0xc2f5('0x20')](_0x4bdd1a[_0xc2f5('0x36')]['offset']);}_0x456ed4[_0xc2f5('0x3e')]=qs[_0xc2f5('0x3f')](_0x4bdd1a[_0xc2f5('0x36')][_0xc2f5('0x3f')]);_0x456ed4[_0xc2f5('0x40')]=qs[_0xc2f5('0x41')](_[_0xc2f5('0x42')](_0x4bdd1a[_0xc2f5('0x36')],_0x558c8e[_0xc2f5('0x41')]),_0x351ddd);if(_0x4bdd1a['query'][_0xc2f5('0x43')]){_0x456ed4[_0xc2f5('0x40')]=_['merge'](_0x456ed4[_0xc2f5('0x40')],{'$or':_[_0xc2f5('0x30')](_0x351ddd,function(_0x3cf1ff){if(_0x3cf1ff[_0xc2f5('0x33')]!=='VIRTUAL'){var _0x47c58b={};_0x47c58b[_0x3cf1ff[_0xc2f5('0x2d')]]={'$like':'%'+_0x4bdd1a[_0xc2f5('0x36')][_0xc2f5('0x43')]+'%'};return _0x47c58b;}})});}_0x456ed4=_[_0xc2f5('0x44')]({},_0x456ed4,_0x4bdd1a['options']);var _0x26be43={'where':_0x456ed4['where']};return db[_0xc2f5('0x31')][_0xc2f5('0x23')](_0x26be43)[_0xc2f5('0x2a')](function(_0x4d074a){_0x34d372[_0xc2f5('0x23')]=_0x4d074a;if(_0x4bdd1a[_0xc2f5('0x36')][_0xc2f5('0x45')]){_0x456ed4[_0xc2f5('0x46')]=[{'all':!![]}];}return db[_0xc2f5('0x31')][_0xc2f5('0x47')](_0x456ed4);})[_0xc2f5('0x2a')](function(_0x57c56a){_0x34d372['rows']=_0x57c56a;return _0x34d372;})[_0xc2f5('0x2a')](respondWithFilteredResult(_0x33c4f5,_0x456ed4))[_0xc2f5('0x48')](handleError(_0x33c4f5,null));};exports[_0xc2f5('0x49')]=function(_0x6c14b2,_0x4da524){var _0x2f966b={'raw':![],'where':{'id':_0x6c14b2['params']['id']}},_0x16ddc4={};_0x16ddc4[_0xc2f5('0x35')]=_[_0xc2f5('0x37')](db[_0xc2f5('0x31')][_0xc2f5('0x4a')]);_0x16ddc4[_0xc2f5('0x36')]=_[_0xc2f5('0x37')](_0x6c14b2[_0xc2f5('0x36')]);_0x16ddc4[_0xc2f5('0x41')]=_[_0xc2f5('0x39')](_0x16ddc4[_0xc2f5('0x35')],_0x16ddc4[_0xc2f5('0x36')]);_0x2f966b['attributes']=_[_0xc2f5('0x39')](_0x16ddc4['model'],qs[_0xc2f5('0x3a')](_0x6c14b2['query'][_0xc2f5('0x3a')]));_0x2f966b[_0xc2f5('0x38')]=_0x2f966b[_0xc2f5('0x38')][_0xc2f5('0x3b')]?_0x2f966b[_0xc2f5('0x38')]:_0x16ddc4['model'];if(_0x6c14b2['query'][_0xc2f5('0x45')]){_0x2f966b[_0xc2f5('0x46')]=[{'all':!![]}];}_0x2f966b=_[_0xc2f5('0x44')]({},_0x2f966b,_0x6c14b2[_0xc2f5('0x4b')]);return db[_0xc2f5('0x31')][_0xc2f5('0x4c')](_0x2f966b)['then'](handleEntityNotFound(_0x4da524,null))[_0xc2f5('0x2a')](respondWithResult(_0x4da524,null))[_0xc2f5('0x48')](handleError(_0x4da524,null));};exports[_0xc2f5('0x4d')]=function(_0x2fc91b,_0x476b7f){return db[_0xc2f5('0x31')][_0xc2f5('0x4d')](_0x2fc91b[_0xc2f5('0x4e')],{})[_0xc2f5('0x2a')](respondWithResult(_0x476b7f,0xc9))['catch'](handleError(_0x476b7f,null));};exports['update']=function(_0x3d5abc,_0x2a5325){if(_0x3d5abc[_0xc2f5('0x4e')]['id']){delete _0x3d5abc[_0xc2f5('0x4e')]['id'];}return db['DeskAccount'][_0xc2f5('0x4c')]({'where':{'id':_0x3d5abc[_0xc2f5('0x4f')]['id']}})[_0xc2f5('0x2a')](handleEntityNotFound(_0x2a5325,null))[_0xc2f5('0x2a')](saveUpdates(_0x3d5abc['body'],null))[_0xc2f5('0x2a')](respondWithResult(_0x2a5325,null))[_0xc2f5('0x48')](handleError(_0x2a5325,null));};exports[_0xc2f5('0x50')]=function(_0x10f3e9,_0x49dadc){return db[_0xc2f5('0x31')][_0xc2f5('0x4c')]({'where':{'id':_0x10f3e9[_0xc2f5('0x4f')]['id']}})[_0xc2f5('0x2a')](handleEntityNotFound(_0x49dadc,null))['then'](removeEntity(_0x49dadc,null))['catch'](handleError(_0x49dadc,null));};exports[_0xc2f5('0x51')]=function(_0x43c06d,_0x6179e0,_0x334932){var _0x307daa={};var _0x56baff={};var _0x3e73d6;var _0x39917d;return db[_0xc2f5('0x31')][_0xc2f5('0x52')]({'where':{'id':_0x43c06d[_0xc2f5('0x4f')]['id']}})['then'](handleEntityNotFound(_0x6179e0,null))[_0xc2f5('0x2a')](function(_0x19d05d){if(_0x19d05d){_0x3e73d6=_0x19d05d;_0x56baff[_0xc2f5('0x35')]=_['keys'](db['DeskConfiguration'][_0xc2f5('0x4a')]);_0x56baff[_0xc2f5('0x36')]=_[_0xc2f5('0x37')](_0x43c06d['query']);_0x56baff[_0xc2f5('0x41')]=_[_0xc2f5('0x39')](_0x56baff[_0xc2f5('0x35')],_0x56baff[_0xc2f5('0x36')]);_0x307daa[_0xc2f5('0x38')]=_[_0xc2f5('0x39')](_0x56baff[_0xc2f5('0x35')],qs[_0xc2f5('0x3a')](_0x43c06d[_0xc2f5('0x36')][_0xc2f5('0x3a')]));_0x307daa[_0xc2f5('0x38')]=_0x307daa[_0xc2f5('0x38')]['length']?_0x307daa[_0xc2f5('0x38')]:_0x56baff[_0xc2f5('0x35')];_0x307daa['order']=qs[_0xc2f5('0x3f')](_0x43c06d['query'][_0xc2f5('0x3f')]);_0x307daa[_0xc2f5('0x40')]=qs['filters'](_[_0xc2f5('0x42')](_0x43c06d[_0xc2f5('0x36')],_0x56baff[_0xc2f5('0x41')]));if(_0x43c06d[_0xc2f5('0x36')][_0xc2f5('0x43')]){_0x307daa['where']=_[_0xc2f5('0x44')](_0x307daa['where'],{'$or':_[_0xc2f5('0x30')](_0x307daa['attributes'],function(_0x5a0aef){var _0x23fc90={};_0x23fc90[_0x5a0aef]={'$like':'%'+_0x43c06d[_0xc2f5('0x36')][_0xc2f5('0x43')]+'%'};return _0x23fc90;})});}_0x307daa=_[_0xc2f5('0x44')]({},_0x307daa,_0x43c06d[_0xc2f5('0x4b')]);return _0x3e73d6[_0xc2f5('0x51')](_0x307daa);}})['then'](function(_0x63b5a0){if(_0x63b5a0){_0x39917d=_0x63b5a0[_0xc2f5('0x3b')];if(!_0x43c06d[_0xc2f5('0x36')][_0xc2f5('0x3c')](_0xc2f5('0x3d'))){_0x307daa[_0xc2f5('0x22')]=qs['limit'](_0x43c06d[_0xc2f5('0x36')][_0xc2f5('0x22')]);_0x307daa['offset']=qs[_0xc2f5('0x20')](_0x43c06d[_0xc2f5('0x36')][_0xc2f5('0x20')]);}return _0x3e73d6[_0xc2f5('0x51')](_0x307daa);}})[_0xc2f5('0x2a')](function(_0x7d139f){if(_0x7d139f){return _0x7d139f?{'count':_0x39917d,'rows':_0x7d139f}:null;}})[_0xc2f5('0x2a')](respondWithResult(_0x6179e0,null))[_0xc2f5('0x48')](handleError(_0x6179e0,null));};exports[_0xc2f5('0x53')]=function(_0x22b4c5,_0x42d06d,_0x4fd6c7){if(_0x22b4c5[_0xc2f5('0x4e')]['id']){delete _0x22b4c5[_0xc2f5('0x4e')]['id'];}return db[_0xc2f5('0x31')][_0xc2f5('0x52')]({'where':{'id':_0x22b4c5[_0xc2f5('0x4f')]['id']}})[_0xc2f5('0x2a')](handleEntityNotFound(_0x42d06d,null))[_0xc2f5('0x2a')](function(_0x2806d7){if(_0x2806d7){_0x22b4c5[_0xc2f5('0x4e')]['AccountId']=_0x2806d7['id'];_0x22b4c5[_0xc2f5('0x4e')][_0xc2f5('0x54')]=integrations[_0xc2f5('0x55')](_0x22b4c5[_0xc2f5('0x4e')][_0xc2f5('0x56')],_0x22b4c5[_0xc2f5('0x4e')]['type']);_0x22b4c5[_0xc2f5('0x4e')][_0xc2f5('0x57')]=integrations[_0xc2f5('0x58')](_0x22b4c5[_0xc2f5('0x4e')][_0xc2f5('0x56')],_0x22b4c5[_0xc2f5('0x4e')][_0xc2f5('0x33')]);return db[_0xc2f5('0x59')][_0xc2f5('0x4d')](_0x22b4c5[_0xc2f5('0x4e')],{'include':[{'model':db[_0xc2f5('0x5a')],'as':'Subjects'},{'model':db[_0xc2f5('0x5a')],'as':'Descriptions'}]});}return null;})[_0xc2f5('0x2a')](respondWithResult(_0x42d06d,null))['catch'](handleError(_0x42d06d,null));};exports[_0xc2f5('0x5b')]=function(_0x502291,_0x2d3e38,_0x46e101){var _0x10a24b=[{'name':_0xc2f5('0x5c'),'label':_0xc2f5('0x5c'),'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 _0x4f784d='';return db[_0xc2f5('0x31')][_0xc2f5('0x52')]({'where':{'id':_0x502291[_0xc2f5('0x4f')]['id']},'attributes':['id',_0xc2f5('0x5d'),'authType',_0xc2f5('0x5e'),'password',_0xc2f5('0x5f'),'consumerSecret',_0xc2f5('0x60'),_0xc2f5('0x61')]})[_0xc2f5('0x2a')](handleEntityNotFound(_0x2d3e38,null))[_0xc2f5('0x2a')](function(_0xe83bea){if(_0xe83bea){_0x4f784d=_0xe83bea[_0xc2f5('0x5d')];var _0x185dbb=_0x4f784d['slice'](-0x1);if(_0x185dbb==='/'){_0x4f784d=_0x4f784d['substring'](0x0,_0x4f784d['lastIndexOf'](_0x185dbb));}var _0xfb166c={'method':_0xc2f5('0x62'),'uri':util[_0xc2f5('0x63')](_0xc2f5('0x64'),_0x4f784d),'headers':{'Content-Type':_0xc2f5('0x65'),'Accept':_0xc2f5('0x65')},'json':!![]};if(_0xe83bea[_0xc2f5('0x66')]==='basic'){_0xfb166c[_0xc2f5('0x67')][_0xc2f5('0x68')]=util[_0xc2f5('0x63')](_0xc2f5('0x69'),new Buffer(util[_0xc2f5('0x63')](_0xc2f5('0x6a'),_0xe83bea[_0xc2f5('0x5e')],_0xe83bea[_0xc2f5('0x6b')]))['toString']('base64'));}return rp(_0xfb166c)[_0xc2f5('0x2a')](function(_0xaf529f){return _0x10a24b[_0xc2f5('0x6c')](_['map'](_0xaf529f[_0xc2f5('0x6d')]['entries'],function(_0x19e629){return{'id':_0x19e629[_0xc2f5('0x2d')],'name':_0x19e629[_0xc2f5('0x2d')],'type':_0x19e629[_0xc2f5('0x33')],'active':_0x19e629['active'],'label':_0x19e629[_0xc2f5('0x6e')],'custom':!![]};}));});}})[_0xc2f5('0x2a')](function(_0x5b1d60){return{'count':_0x5b1d60[_0xc2f5('0x3b')],'rows':_0x5b1d60};})[_0xc2f5('0x2a')](respondWithResult(_0x2d3e38,null))[_0xc2f5('0x48')](function(_0x247fac){var _0x37325d=_0x502291['query'][_0xc2f5('0x6f')]?0x1f4:_0x247fac[_0xc2f5('0x70')]||0x1f4;logger[_0xc2f5('0x2b')]('getFields,\x20%s,\x20%s,\x20%s',_0xc2f5('0x5b'),_0x37325d,JSON['stringify'](_0x247fac));delete _0x247fac[_0xc2f5('0x2d')];if(_0x37325d===0x191){_0x37325d=0x190;}_0x2d3e38[_0xc2f5('0x1e')](_0x37325d)[_0xc2f5('0x2e')](_0x502291[_0xc2f5('0x36')][_0xc2f5('0x6f')]?{'message':_0xc2f5('0x71'),'statusCode':_0x247fac[_0xc2f5('0x70')]}:_0x247fac);});}; \ No newline at end of file +var _0x5088=['ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','then','error','stack','name','send','index','map','DeskAccount','rawAttributes','type','key','query','filters','attributes','intersection','model','nolimit','order','sort','where','filter','merge','includeAll','rows','show','keys','fields','length','include','options','find','catch','create','update','body','destroy','params','getConfigurations','findOne','pick','hasOwnProperty','AccountId','Subjects','getSubjects','channel','Descriptions','DeskConfiguration','DeskField','getFields','priority','authType','username','password','consumerSecret','token','tokenSecret','substring','GET','format','%s/custom_fields','application/json','basic','headers','Authorization','%s:%s','toString','base64','concat','_embedded','entries','label','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv'];(function(_0x182255,_0x25f595){var _0x3528f9=function(_0x508c1b){while(--_0x508c1b){_0x182255['push'](_0x182255['shift']());}};_0x3528f9(++_0x25f595);}(_0x5088,0x1bd));var _0x8508=function(_0x19a7f6,_0x3abadc){_0x19a7f6=_0x19a7f6-0x0;var _0x5831b8=_0x5088[_0x19a7f6];return _0x5831b8;};'use strict';var emlformat=require(_0x8508('0x0'));var rimraf=require(_0x8508('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8508('0x2'));var rp=require(_0x8508('0x3'));var moment=require(_0x8508('0x4'));var BPromise=require(_0x8508('0x5'));var Mustache=require(_0x8508('0x6'));var util=require(_0x8508('0x7'));var path=require(_0x8508('0x8'));var sox=require(_0x8508('0x9'));var csv=require(_0x8508('0xa'));var ejs=require(_0x8508('0xb'));var fs=require('fs');var fs_extra=require(_0x8508('0xc'));var _=require(_0x8508('0xd'));var squel=require(_0x8508('0xe'));var crypto=require(_0x8508('0xf'));var jsforce=require(_0x8508('0x10'));var deskjs=require(_0x8508('0x11'));var toCsv=require(_0x8508('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x8508('0x12'));var qs=require(_0x8508('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8508('0x14'));var logger=require(_0x8508('0x15'))(_0x8508('0x16'));var utils=require(_0x8508('0x17'));var config=require(_0x8508('0x18'));var licenseUtil=require(_0x8508('0x19'));var db=require('../../mysqldb')['db'];var integrations=require(_0x8508('0x1a'));function respondWithStatusCode(_0x2c59fc,_0x793be1){_0x793be1=_0x793be1||0xcc;return function(_0x53c4dc){if(_0x53c4dc){return _0x2c59fc[_0x8508('0x1b')](_0x793be1);}return _0x2c59fc[_0x8508('0x1c')](_0x793be1)[_0x8508('0x1d')]();};}function respondWithResult(_0x1b9ff4,_0x126385){_0x126385=_0x126385||0xc8;return function(_0x1136a8){if(_0x1136a8){return _0x1b9ff4[_0x8508('0x1c')](_0x126385)[_0x8508('0x1e')](_0x1136a8);}};}function respondWithFilteredResult(_0x589003,_0x407d06){return function(_0xef780e){if(_0xef780e){var _0x62327a=typeof _0x407d06[_0x8508('0x1f')]===_0x8508('0x20')&&typeof _0x407d06[_0x8508('0x21')]===_0x8508('0x20');var _0x5aff6c=_0xef780e['count'];var _0x453fbd=_0x62327a?0x0:_0x407d06['offset'];var _0x1a288d=_0x62327a?_0xef780e[_0x8508('0x22')]:_0x407d06[_0x8508('0x1f')]+_0x407d06[_0x8508('0x21')];var _0x206f2d;if(_0x1a288d>=_0x5aff6c){_0x1a288d=_0x5aff6c;_0x206f2d=0xc8;}else{_0x206f2d=0xce;}_0x589003['status'](_0x206f2d);return _0x589003[_0x8508('0x23')]('Content-Range',_0x453fbd+'-'+_0x1a288d+'/'+_0x5aff6c)[_0x8508('0x1e')](_0xef780e);}return null;};}function patchUpdates(_0x134a86){return function(_0xaf77e4){try{jsonpatch[_0x8508('0x24')](_0xaf77e4,_0x134a86,!![]);}catch(_0x53841b){return BPromise[_0x8508('0x25')](_0x53841b);}return _0xaf77e4[_0x8508('0x26')]();};}function saveUpdates(_0x347aed,_0xf673c0){return function(_0x5e2b66){if(_0x5e2b66){return _0x5e2b66['update'](_0x347aed)[_0x8508('0x27')](function(_0xbfc43b){return _0xbfc43b;});}return null;};}function removeEntity(_0x3f546b,_0x59366c){return function(_0x16a92a){if(_0x16a92a){return _0x16a92a['destroy']()[_0x8508('0x27')](function(){_0x3f546b['status'](0xcc)[_0x8508('0x1d')]();});}};}function handleEntityNotFound(_0x4670d1,_0x112698){return function(_0x1c5090){if(!_0x1c5090){_0x4670d1[_0x8508('0x1b')](0x194);}return _0x1c5090;};}function handleError(_0x49e8e7,_0x88220e){_0x88220e=_0x88220e||0x1f4;return function(_0x285516){logger[_0x8508('0x28')](_0x285516[_0x8508('0x29')]);if(_0x285516['name']){delete _0x285516[_0x8508('0x2a')];}_0x49e8e7[_0x8508('0x1c')](_0x88220e)[_0x8508('0x2b')](_0x285516);};}exports[_0x8508('0x2c')]=function(_0x206429,_0x5cea3b){var _0x348739={},_0x304b8e={},_0x2554d2={'count':0x0,'rows':[]};var _0x1598e6=_[_0x8508('0x2d')](db[_0x8508('0x2e')][_0x8508('0x2f')],function(_0x483415){return{'name':_0x483415['fieldName'],'type':_0x483415[_0x8508('0x30')][_0x8508('0x31')]};});_0x304b8e['model']=_['map'](_0x1598e6,_0x8508('0x2a'));_0x304b8e['query']=_['keys'](_0x206429[_0x8508('0x32')]);_0x304b8e[_0x8508('0x33')]=_['intersection'](_0x304b8e['model'],_0x304b8e[_0x8508('0x32')]);_0x348739[_0x8508('0x34')]=_[_0x8508('0x35')](_0x304b8e['model'],qs['fields'](_0x206429[_0x8508('0x32')]['fields']));_0x348739[_0x8508('0x34')]=_0x348739[_0x8508('0x34')]['length']?_0x348739['attributes']:_0x304b8e[_0x8508('0x36')];if(!_0x206429[_0x8508('0x32')]['hasOwnProperty'](_0x8508('0x37'))){_0x348739[_0x8508('0x21')]=qs[_0x8508('0x21')](_0x206429[_0x8508('0x32')][_0x8508('0x21')]);_0x348739[_0x8508('0x1f')]=qs[_0x8508('0x1f')](_0x206429['query'][_0x8508('0x1f')]);}_0x348739[_0x8508('0x38')]=qs[_0x8508('0x39')](_0x206429['query']['sort']);_0x348739[_0x8508('0x3a')]=qs[_0x8508('0x33')](_['pick'](_0x206429[_0x8508('0x32')],_0x304b8e['filters']),_0x1598e6);if(_0x206429[_0x8508('0x32')][_0x8508('0x3b')]){_0x348739[_0x8508('0x3a')]=_[_0x8508('0x3c')](_0x348739[_0x8508('0x3a')],{'$or':_[_0x8508('0x2d')](_0x1598e6,function(_0x536768){if(_0x536768[_0x8508('0x30')]!=='VIRTUAL'){var _0x3ee25e={};_0x3ee25e[_0x536768[_0x8508('0x2a')]]={'$like':'%'+_0x206429[_0x8508('0x32')]['filter']+'%'};return _0x3ee25e;}})});}_0x348739=_[_0x8508('0x3c')]({},_0x348739,_0x206429['options']);var _0x2be83a={'where':_0x348739[_0x8508('0x3a')]};return db['DeskAccount'][_0x8508('0x22')](_0x2be83a)['then'](function(_0x41a47a){_0x2554d2[_0x8508('0x22')]=_0x41a47a;if(_0x206429['query'][_0x8508('0x3d')]){_0x348739['include']=[{'all':!![]}];}return db[_0x8508('0x2e')]['findAll'](_0x348739);})[_0x8508('0x27')](function(_0x21a5c6){_0x2554d2[_0x8508('0x3e')]=_0x21a5c6;return _0x2554d2;})[_0x8508('0x27')](respondWithFilteredResult(_0x5cea3b,_0x348739))['catch'](handleError(_0x5cea3b,null));};exports[_0x8508('0x3f')]=function(_0x41b90b,_0x182aaf){var _0x39b556={'raw':![],'where':{'id':_0x41b90b['params']['id']}},_0x22c94b={};_0x22c94b[_0x8508('0x36')]=_[_0x8508('0x40')](db['DeskAccount']['rawAttributes']);_0x22c94b['query']=_[_0x8508('0x40')](_0x41b90b['query']);_0x22c94b[_0x8508('0x33')]=_[_0x8508('0x35')](_0x22c94b[_0x8508('0x36')],_0x22c94b['query']);_0x39b556[_0x8508('0x34')]=_[_0x8508('0x35')](_0x22c94b[_0x8508('0x36')],qs[_0x8508('0x41')](_0x41b90b[_0x8508('0x32')][_0x8508('0x41')]));_0x39b556[_0x8508('0x34')]=_0x39b556[_0x8508('0x34')][_0x8508('0x42')]?_0x39b556['attributes']:_0x22c94b['model'];if(_0x41b90b[_0x8508('0x32')][_0x8508('0x3d')]){_0x39b556[_0x8508('0x43')]=[{'all':!![]}];}_0x39b556=_[_0x8508('0x3c')]({},_0x39b556,_0x41b90b[_0x8508('0x44')]);return db[_0x8508('0x2e')][_0x8508('0x45')](_0x39b556)[_0x8508('0x27')](handleEntityNotFound(_0x182aaf,null))[_0x8508('0x27')](respondWithResult(_0x182aaf,null))[_0x8508('0x46')](handleError(_0x182aaf,null));};exports['create']=function(_0x55cf56,_0x2bb9e0){return db['DeskAccount'][_0x8508('0x47')](_0x55cf56['body'],{})[_0x8508('0x27')](respondWithResult(_0x2bb9e0,0xc9))[_0x8508('0x46')](handleError(_0x2bb9e0,null));};exports[_0x8508('0x48')]=function(_0x931ccb,_0x1cf62a){if(_0x931ccb[_0x8508('0x49')]['id']){delete _0x931ccb[_0x8508('0x49')]['id'];}return db['DeskAccount'][_0x8508('0x45')]({'where':{'id':_0x931ccb['params']['id']}})[_0x8508('0x27')](handleEntityNotFound(_0x1cf62a,null))[_0x8508('0x27')](saveUpdates(_0x931ccb['body'],null))[_0x8508('0x27')](respondWithResult(_0x1cf62a,null))[_0x8508('0x46')](handleError(_0x1cf62a,null));};exports[_0x8508('0x4a')]=function(_0x3a08a1,_0x5dfc76){return db[_0x8508('0x2e')]['find']({'where':{'id':_0x3a08a1[_0x8508('0x4b')]['id']}})['then'](handleEntityNotFound(_0x5dfc76,null))[_0x8508('0x27')](removeEntity(_0x5dfc76,null))[_0x8508('0x46')](handleError(_0x5dfc76,null));};exports[_0x8508('0x4c')]=function(_0x3ee189,_0x40aca2,_0x2bb3b4){var _0x20835c={};var _0xbcb1ac={};var _0x287812;var _0x867c81;return db['DeskAccount'][_0x8508('0x4d')]({'where':{'id':_0x3ee189[_0x8508('0x4b')]['id']}})[_0x8508('0x27')](handleEntityNotFound(_0x40aca2,null))['then'](function(_0x23faa1){if(_0x23faa1){_0x287812=_0x23faa1;_0xbcb1ac[_0x8508('0x36')]=_[_0x8508('0x40')](db['DeskConfiguration'][_0x8508('0x2f')]);_0xbcb1ac[_0x8508('0x32')]=_['keys'](_0x3ee189['query']);_0xbcb1ac['filters']=_[_0x8508('0x35')](_0xbcb1ac[_0x8508('0x36')],_0xbcb1ac[_0x8508('0x32')]);_0x20835c[_0x8508('0x34')]=_[_0x8508('0x35')](_0xbcb1ac[_0x8508('0x36')],qs[_0x8508('0x41')](_0x3ee189[_0x8508('0x32')]['fields']));_0x20835c[_0x8508('0x34')]=_0x20835c[_0x8508('0x34')][_0x8508('0x42')]?_0x20835c[_0x8508('0x34')]:_0xbcb1ac[_0x8508('0x36')];_0x20835c[_0x8508('0x38')]=qs[_0x8508('0x39')](_0x3ee189[_0x8508('0x32')]['sort']);_0x20835c[_0x8508('0x3a')]=qs[_0x8508('0x33')](_[_0x8508('0x4e')](_0x3ee189['query'],_0xbcb1ac[_0x8508('0x33')]));if(_0x3ee189[_0x8508('0x32')][_0x8508('0x3b')]){_0x20835c['where']=_['merge'](_0x20835c[_0x8508('0x3a')],{'$or':_['map'](_0x20835c[_0x8508('0x34')],function(_0x1e996c){var _0x1e2b96={};_0x1e2b96[_0x1e996c]={'$like':'%'+_0x3ee189[_0x8508('0x32')][_0x8508('0x3b')]+'%'};return _0x1e2b96;})});}_0x20835c=_[_0x8508('0x3c')]({},_0x20835c,_0x3ee189[_0x8508('0x44')]);return _0x287812[_0x8508('0x4c')](_0x20835c);}})[_0x8508('0x27')](function(_0x419bbf){if(_0x419bbf){_0x867c81=_0x419bbf['length'];if(!_0x3ee189[_0x8508('0x32')][_0x8508('0x4f')]('nolimit')){_0x20835c[_0x8508('0x21')]=qs[_0x8508('0x21')](_0x3ee189[_0x8508('0x32')]['limit']);_0x20835c[_0x8508('0x1f')]=qs['offset'](_0x3ee189[_0x8508('0x32')]['offset']);}return _0x287812['getConfigurations'](_0x20835c);}})[_0x8508('0x27')](function(_0x514956){if(_0x514956){return _0x514956?{'count':_0x867c81,'rows':_0x514956}:null;}})['then'](respondWithResult(_0x40aca2,null))[_0x8508('0x46')](handleError(_0x40aca2,null));};exports['addConfiguration']=function(_0x451a60,_0x39541c,_0x2dba22){if(_0x451a60[_0x8508('0x49')]['id']){delete _0x451a60[_0x8508('0x49')]['id'];}return db[_0x8508('0x2e')][_0x8508('0x4d')]({'where':{'id':_0x451a60[_0x8508('0x4b')]['id']}})[_0x8508('0x27')](handleEntityNotFound(_0x39541c,null))[_0x8508('0x27')](function(_0x2eb8dc){if(_0x2eb8dc){_0x451a60[_0x8508('0x49')][_0x8508('0x50')]=_0x2eb8dc['id'];_0x451a60[_0x8508('0x49')][_0x8508('0x51')]=integrations[_0x8508('0x52')](_0x451a60[_0x8508('0x49')][_0x8508('0x53')],_0x451a60[_0x8508('0x49')][_0x8508('0x30')]);_0x451a60[_0x8508('0x49')][_0x8508('0x54')]=integrations['getDescriptions'](_0x451a60[_0x8508('0x49')][_0x8508('0x53')],_0x451a60[_0x8508('0x49')][_0x8508('0x30')]);return db[_0x8508('0x55')]['create'](_0x451a60[_0x8508('0x49')],{'include':[{'model':db[_0x8508('0x56')],'as':_0x8508('0x51')},{'model':db[_0x8508('0x56')],'as':'Descriptions'}]});}return null;})[_0x8508('0x27')](respondWithResult(_0x39541c,null))[_0x8508('0x46')](handleError(_0x39541c,null));};exports[_0x8508('0x57')]=function(_0x36a07f,_0x2da11c,_0x56273e){var _0x5277a2=[{'name':'priority','label':_0x8508('0x58'),'custom':![],'options':[{'name':0x1,'value':0x1},{'name':0x2,'value':0x2},{'name':0x3,'value':0x3},{'name':0x4,'value':0x4},{'name':0x5,'value':0x5},{'name':0x6,'value':0x6},{'name':0x7,'value':0x7},{'name':0x8,'value':0x8},{'name':0x9,'value':0x9},{'name':0xa,'value':0xa}]}];var _0x24893a='';return db['DeskAccount']['findOne']({'where':{'id':_0x36a07f[_0x8508('0x4b')]['id']},'attributes':['id','remoteUri',_0x8508('0x59'),_0x8508('0x5a'),_0x8508('0x5b'),'consumerKey',_0x8508('0x5c'),_0x8508('0x5d'),_0x8508('0x5e')]})[_0x8508('0x27')](handleEntityNotFound(_0x2da11c,null))[_0x8508('0x27')](function(_0x21123f){if(_0x21123f){_0x24893a=_0x21123f['remoteUri'];var _0x3d59d5=_0x24893a['slice'](-0x1);if(_0x3d59d5==='/'){_0x24893a=_0x24893a[_0x8508('0x5f')](0x0,_0x24893a['lastIndexOf'](_0x3d59d5));}var _0x45a46d={'method':_0x8508('0x60'),'uri':util[_0x8508('0x61')](_0x8508('0x62'),_0x24893a),'headers':{'Content-Type':_0x8508('0x63'),'Accept':'application/json'},'json':!![]};if(_0x21123f[_0x8508('0x59')]===_0x8508('0x64')){_0x45a46d[_0x8508('0x65')][_0x8508('0x66')]=util['format']('Basic\x20%s',new Buffer(util[_0x8508('0x61')](_0x8508('0x67'),_0x21123f['username'],_0x21123f[_0x8508('0x5b')]))[_0x8508('0x68')](_0x8508('0x69')));}return rp(_0x45a46d)[_0x8508('0x27')](function(_0x29b3f5){return _0x5277a2[_0x8508('0x6a')](_[_0x8508('0x2d')](_0x29b3f5[_0x8508('0x6b')][_0x8508('0x6c')],function(_0x4264f4){return{'id':_0x4264f4[_0x8508('0x2a')],'name':_0x4264f4[_0x8508('0x2a')],'type':_0x4264f4[_0x8508('0x30')],'active':_0x4264f4['active'],'label':_0x4264f4[_0x8508('0x6d')],'custom':!![]};}));});}})['then'](function(_0x56006a){return{'count':_0x56006a[_0x8508('0x42')],'rows':_0x56006a};})[_0x8508('0x27')](respondWithResult(_0x2da11c,null))[_0x8508('0x46')](function(_0x594c84){var _0x7035e7=_0x36a07f['query'][_0x8508('0x6e')]?0x1f4:_0x594c84[_0x8508('0x6f')]||0x1f4;logger[_0x8508('0x28')](_0x8508('0x70'),_0x8508('0x57'),_0x7035e7,JSON['stringify'](_0x594c84));delete _0x594c84['name'];if(_0x7035e7===0x191){_0x7035e7=0x190;}_0x2da11c[_0x8508('0x1c')](_0x7035e7)[_0x8508('0x2b')](_0x36a07f[_0x8508('0x32')][_0x8508('0x6e')]?{'message':_0x8508('0x71'),'statusCode':_0x594c84[_0x8508('0x6f')]}:_0x594c84);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index 9bb89ad..cb36a41 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 _0x4b35=['exports','define','DeskAccount','lodash','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./intDeskAccount.attributes'];(function(_0x2f45ea,_0x15c656){var _0x485a84=function(_0x4a1fe3){while(--_0x4a1fe3){_0x2f45ea['push'](_0x2f45ea['shift']());}};_0x485a84(++_0x15c656);}(_0x4b35,0xdb));var _0x54b3=function(_0x568eca,_0x549174){_0x568eca=_0x568eca-0x0;var _0x767192=_0x4b35[_0x568eca];return _0x767192;};'use strict';var _=require(_0x54b3('0x0'));var util=require('util');var logger=require(_0x54b3('0x1'))(_0x54b3('0x2'));var moment=require(_0x54b3('0x3'));var BPromise=require('bluebird');var rp=require(_0x54b3('0x4'));var fs=require('fs');var path=require(_0x54b3('0x5'));var rimraf=require(_0x54b3('0x6'));var config=require(_0x54b3('0x7'));var attributes=require(_0x54b3('0x8'));var integrations=require('../../components/integrations/configuration');module[_0x54b3('0x9')]=function(_0x41e1b3,_0x36eca4){return _0x41e1b3[_0x54b3('0xa')](_0x54b3('0xb'),attributes,{'tableName':'int_desk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb46b=['path','rimraf','../../config/environment','./intDeskAccount.attributes','../../components/integrations/configuration','exports','DeskAccount','int_desk_accounts','lodash','../../config/logger','api','moment','request-promise'];(function(_0x5f1d4c,_0x513301){var _0x234479=function(_0x594d37){while(--_0x594d37){_0x5f1d4c['push'](_0x5f1d4c['shift']());}};_0x234479(++_0x513301);}(_0xb46b,0xd8));var _0xbb46=function(_0x5882d8,_0x29dde4){_0x5882d8=_0x5882d8-0x0;var _0x5a4c71=_0xb46b[_0x5882d8];return _0x5a4c71;};'use strict';var _=require(_0xbb46('0x0'));var util=require('util');var logger=require(_0xbb46('0x1'))(_0xbb46('0x2'));var moment=require(_0xbb46('0x3'));var BPromise=require('bluebird');var rp=require(_0xbb46('0x4'));var fs=require('fs');var path=require(_0xbb46('0x5'));var rimraf=require(_0xbb46('0x6'));var config=require(_0xbb46('0x7'));var attributes=require(_0xbb46('0x8'));var integrations=require(_0xbb46('0x9'));module[_0xbb46('0xa')]=function(_0x3aee3b,_0x55391f){return _0x3aee3b['define'](_0xbb46('0xb'),attributes,{'tableName':_0xbb46('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.rpc.js b/server/api/intDeskAccount/intDeskAccount.rpc.js index b1ddb6d..35ec3cb 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 _0xc1fa=['message','info','catch','GetDeskAccount','options','raw','attributes','limit','include','model','map','debug','ShowDeskAccount','find','where','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','DeskAccount,\x20%s,\x20%s','DeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x318de8,_0x5ac51e){var _0x31b14a=function(_0x225ff9){while(--_0x225ff9){_0x318de8['push'](_0x318de8['shift']());}};_0x31b14a(++_0x5ac51e);}(_0xc1fa,0x11f));var _0xac1f=function(_0x49d19d,_0x245cf5){_0x49d19d=_0x49d19d-0x0;var _0x4ebef1=_0xc1fa[_0x49d19d];return _0x4ebef1;};'use strict';var _=require('lodash');var util=require(_0xac1f('0x0'));var moment=require(_0xac1f('0x1'));var BPromise=require(_0xac1f('0x2'));var rs=require(_0xac1f('0x3'));var fs=require('fs');var Redis=require(_0xac1f('0x4'));var db=require(_0xac1f('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xac1f('0x6'));var config=require(_0xac1f('0x7'));var jayson=require(_0xac1f('0x8'));var client=jayson[_0xac1f('0x9')][_0xac1f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x39e51a,_0x4b8f14,_0x2c1309){return new BPromise(function(_0x3c0593,_0x25147c){return client[_0xac1f('0xb')](_0x39e51a,_0x2c1309)[_0xac1f('0xc')](function(_0x53211a){logger['info'](_0xac1f('0xd'),_0x4b8f14,'request\x20sent');logger['debug'](_0xac1f('0xe'),_0x4b8f14,_0xac1f('0xf'),JSON[_0xac1f('0x10')](_0x53211a));if(_0x53211a['error']){if(_0x53211a[_0xac1f('0x11')][_0xac1f('0x12')]===0x1f4){logger['error']('DeskAccount,\x20%s,\x20%s',_0x4b8f14,_0x53211a[_0xac1f('0x11')][_0xac1f('0x13')]);return _0x25147c(_0x53211a[_0xac1f('0x11')][_0xac1f('0x13')]);}logger['error'](_0xac1f('0xd'),_0x4b8f14,_0x53211a[_0xac1f('0x11')]['message']);return _0x3c0593(_0x53211a[_0xac1f('0x11')]['message']);}else{logger[_0xac1f('0x14')](_0xac1f('0xd'),_0x4b8f14,_0xac1f('0xf'));_0x3c0593(_0x53211a['result'][_0xac1f('0x13')]);}})[_0xac1f('0x15')](function(_0x55db15){logger[_0xac1f('0x11')](_0xac1f('0xd'),_0x4b8f14,_0x55db15);_0x25147c(_0x55db15);});});}exports[_0xac1f('0x16')]=function(_0x20ce0a){var _0x38f9c4=this;return new Promise(function(_0x1e1b80,_0x19375c){return db['DeskAccount']['findAll']({'raw':_0x20ce0a[_0xac1f('0x17')]?_0x20ce0a[_0xac1f('0x17')][_0xac1f('0x18')]===undefined?!![]:![]:!![],'where':_0x20ce0a['options']?_0x20ce0a[_0xac1f('0x17')]['where']||null:null,'attributes':_0x20ce0a[_0xac1f('0x17')]?_0x20ce0a[_0xac1f('0x17')][_0xac1f('0x19')]||null:null,'limit':_0x20ce0a[_0xac1f('0x17')]?_0x20ce0a[_0xac1f('0x17')][_0xac1f('0x1a')]||null:null,'include':_0x20ce0a[_0xac1f('0x17')]?_0x20ce0a['options'][_0xac1f('0x1b')]?_['map'](_0x20ce0a[_0xac1f('0x17')][_0xac1f('0x1b')],function(_0x10bd4e){return{'model':db[_0x10bd4e[_0xac1f('0x1c')]],'as':_0x10bd4e['as'],'attributes':_0x10bd4e[_0xac1f('0x19')],'include':_0x10bd4e['include']?_['map'](_0x10bd4e[_0xac1f('0x1b')],function(_0xa6d05a){return{'model':db[_0xa6d05a[_0xac1f('0x1c')]],'as':_0xa6d05a['as'],'attributes':_0xa6d05a[_0xac1f('0x19')],'include':_0xa6d05a['include']?_[_0xac1f('0x1d')](_0xa6d05a['include'],function(_0x538a70){return{'model':db[_0x538a70['model']],'as':_0x538a70['as'],'attributes':_0x538a70[_0xac1f('0x19')]};}):[]};}):[]};}):[]:[]})[_0xac1f('0xc')](function(_0x8da77a){logger[_0xac1f('0x14')](_0xac1f('0x16'),_0x20ce0a);logger[_0xac1f('0x1e')]('GetDeskAccount',_0x20ce0a,JSON[_0xac1f('0x10')](_0x8da77a));_0x1e1b80(_0x8da77a);})['catch'](function(_0x9c689a){logger[_0xac1f('0x11')](_0xac1f('0x16'),_0x9c689a[_0xac1f('0x13')],_0x20ce0a);_0x19375c(_0x38f9c4[_0xac1f('0x11')](0x1f4,_0x9c689a[_0xac1f('0x13')]));});});};exports[_0xac1f('0x1f')]=function(_0x16417e){var _0x16f681=this;return new Promise(function(_0x35697b,_0x226b55){return db['DeskAccount'][_0xac1f('0x20')]({'raw':_0x16417e[_0xac1f('0x17')]?_0x16417e[_0xac1f('0x17')][_0xac1f('0x18')]===undefined?!![]:![]:!![],'where':_0x16417e[_0xac1f('0x17')]?_0x16417e['options'][_0xac1f('0x21')]||null:null,'attributes':_0x16417e[_0xac1f('0x17')]?_0x16417e[_0xac1f('0x17')]['attributes']||null:null,'include':_0x16417e[_0xac1f('0x17')]?_0x16417e[_0xac1f('0x17')]['include']?_[_0xac1f('0x1d')](_0x16417e[_0xac1f('0x17')][_0xac1f('0x1b')],function(_0x583309){return{'model':db[_0x583309[_0xac1f('0x1c')]],'as':_0x583309['as'],'attributes':_0x583309[_0xac1f('0x19')],'include':_0x583309[_0xac1f('0x1b')]?_[_0xac1f('0x1d')](_0x583309[_0xac1f('0x1b')],function(_0x40ae42){return{'model':db[_0x40ae42[_0xac1f('0x1c')]],'as':_0x40ae42['as'],'attributes':_0x40ae42[_0xac1f('0x19')],'include':_0x40ae42['include']?_[_0xac1f('0x1d')](_0x40ae42[_0xac1f('0x1b')],function(_0x9356ec){return{'model':db[_0x9356ec[_0xac1f('0x1c')]],'as':_0x9356ec['as'],'attributes':_0x9356ec['attributes']};}):[]};}):[]};}):[]:[]})[_0xac1f('0xc')](function(_0x55b00c){logger[_0xac1f('0x14')](_0xac1f('0x1f'),_0x16417e);logger[_0xac1f('0x1e')]('ShowDeskAccount',_0x16417e,JSON[_0xac1f('0x10')](_0x55b00c));_0x35697b(_0x55b00c);})[_0xac1f('0x15')](function(_0x5eceef){logger[_0xac1f('0x11')]('ShowDeskAccount',_0x5eceef[_0xac1f('0x13')],_0x16417e);_0x226b55(_0x16f681[_0xac1f('0x11')](0x1f4,_0x5eceef[_0xac1f('0x13')]));});});}; \ No newline at end of file +var _0xe964=['code','DeskAccount,\x20%s,\x20%s','message','result','catch','DeskAccount','findAll','options','raw','where','attributes','limit','map','include','model','then','GetDeskAccount','ShowDeskAccount','find','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','info','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe964,0x1b7));var _0x4e96=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe964[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x4e96('0x0'));var util=require(_0x4e96('0x1'));var moment=require('moment');var BPromise=require(_0x4e96('0x2'));var rs=require(_0x4e96('0x3'));var fs=require('fs');var Redis=require(_0x4e96('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x4e96('0x5'));var logger=require(_0x4e96('0x6'))('rpc');var config=require(_0x4e96('0x7'));var jayson=require(_0x4e96('0x8'));var client=jayson[_0x4e96('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x410bd4,_0xcabfb0,_0x159780){return new BPromise(function(_0x4da030,_0x520e6d){return client['request'](_0x410bd4,_0x159780)['then'](function(_0x56b951){logger[_0x4e96('0xa')]('DeskAccount,\x20%s,\x20%s',_0xcabfb0,_0x4e96('0xb'));logger[_0x4e96('0xc')](_0x4e96('0xd'),_0xcabfb0,_0x4e96('0xb'),JSON[_0x4e96('0xe')](_0x56b951));if(_0x56b951[_0x4e96('0xf')]){if(_0x56b951[_0x4e96('0xf')][_0x4e96('0x10')]===0x1f4){logger[_0x4e96('0xf')](_0x4e96('0x11'),_0xcabfb0,_0x56b951[_0x4e96('0xf')][_0x4e96('0x12')]);return _0x520e6d(_0x56b951['error'][_0x4e96('0x12')]);}logger[_0x4e96('0xf')](_0x4e96('0x11'),_0xcabfb0,_0x56b951[_0x4e96('0xf')][_0x4e96('0x12')]);return _0x4da030(_0x56b951['error'][_0x4e96('0x12')]);}else{logger[_0x4e96('0xa')](_0x4e96('0x11'),_0xcabfb0,'request\x20sent');_0x4da030(_0x56b951[_0x4e96('0x13')][_0x4e96('0x12')]);}})[_0x4e96('0x14')](function(_0x35ee1f){logger['error']('DeskAccount,\x20%s,\x20%s',_0xcabfb0,_0x35ee1f);_0x520e6d(_0x35ee1f);});});}exports['GetDeskAccount']=function(_0x332f1d){var _0x288130=this;return new Promise(function(_0x1539d7,_0x4a5b98){return db[_0x4e96('0x15')][_0x4e96('0x16')]({'raw':_0x332f1d[_0x4e96('0x17')]?_0x332f1d['options'][_0x4e96('0x18')]===undefined?!![]:![]:!![],'where':_0x332f1d['options']?_0x332f1d[_0x4e96('0x17')][_0x4e96('0x19')]||null:null,'attributes':_0x332f1d[_0x4e96('0x17')]?_0x332f1d['options'][_0x4e96('0x1a')]||null:null,'limit':_0x332f1d[_0x4e96('0x17')]?_0x332f1d[_0x4e96('0x17')][_0x4e96('0x1b')]||null:null,'include':_0x332f1d['options']?_0x332f1d['options']['include']?_[_0x4e96('0x1c')](_0x332f1d[_0x4e96('0x17')][_0x4e96('0x1d')],function(_0x4272c5){return{'model':db[_0x4272c5[_0x4e96('0x1e')]],'as':_0x4272c5['as'],'attributes':_0x4272c5[_0x4e96('0x1a')],'include':_0x4272c5['include']?_[_0x4e96('0x1c')](_0x4272c5[_0x4e96('0x1d')],function(_0x17b434){return{'model':db[_0x17b434[_0x4e96('0x1e')]],'as':_0x17b434['as'],'attributes':_0x17b434[_0x4e96('0x1a')],'include':_0x17b434[_0x4e96('0x1d')]?_[_0x4e96('0x1c')](_0x17b434['include'],function(_0x3537bb){return{'model':db[_0x3537bb['model']],'as':_0x3537bb['as'],'attributes':_0x3537bb[_0x4e96('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x4e96('0x1f')](function(_0x218d7b){logger[_0x4e96('0xa')](_0x4e96('0x20'),_0x332f1d);logger['debug']('GetDeskAccount',_0x332f1d,JSON[_0x4e96('0xe')](_0x218d7b));_0x1539d7(_0x218d7b);})[_0x4e96('0x14')](function(_0x503b21){logger[_0x4e96('0xf')]('GetDeskAccount',_0x503b21[_0x4e96('0x12')],_0x332f1d);_0x4a5b98(_0x288130['error'](0x1f4,_0x503b21[_0x4e96('0x12')]));});});};exports[_0x4e96('0x21')]=function(_0x198bc2){var _0x5d3292=this;return new Promise(function(_0x36dcbf,_0x140251){return db[_0x4e96('0x15')][_0x4e96('0x22')]({'raw':_0x198bc2['options']?_0x198bc2[_0x4e96('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x198bc2[_0x4e96('0x17')]?_0x198bc2[_0x4e96('0x17')][_0x4e96('0x19')]||null:null,'attributes':_0x198bc2[_0x4e96('0x17')]?_0x198bc2['options'][_0x4e96('0x1a')]||null:null,'include':_0x198bc2[_0x4e96('0x17')]?_0x198bc2[_0x4e96('0x17')][_0x4e96('0x1d')]?_[_0x4e96('0x1c')](_0x198bc2['options'][_0x4e96('0x1d')],function(_0x251c8e){return{'model':db[_0x251c8e['model']],'as':_0x251c8e['as'],'attributes':_0x251c8e['attributes'],'include':_0x251c8e[_0x4e96('0x1d')]?_[_0x4e96('0x1c')](_0x251c8e[_0x4e96('0x1d')],function(_0x5b8afe){return{'model':db[_0x5b8afe[_0x4e96('0x1e')]],'as':_0x5b8afe['as'],'attributes':_0x5b8afe[_0x4e96('0x1a')],'include':_0x5b8afe[_0x4e96('0x1d')]?_[_0x4e96('0x1c')](_0x5b8afe[_0x4e96('0x1d')],function(_0x24236a){return{'model':db[_0x24236a[_0x4e96('0x1e')]],'as':_0x24236a['as'],'attributes':_0x24236a['attributes']};}):[]};}):[]};}):[]:[]})[_0x4e96('0x1f')](function(_0x21f362){logger[_0x4e96('0xa')](_0x4e96('0x21'),_0x198bc2);logger[_0x4e96('0xc')](_0x4e96('0x21'),_0x198bc2,JSON[_0x4e96('0xe')](_0x21f362));_0x36dcbf(_0x21f362);})[_0x4e96('0x14')](function(_0x281865){logger['error'](_0x4e96('0x21'),_0x281865['message'],_0x198bc2);_0x140251(_0x5d3292[_0x4e96('0xf')](0x1f4,_0x281865[_0x4e96('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index 4691e01..96dc900 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(_0x964b6e,_0x4cfa24){var _0x5d5406=function(_0x240333){while(--_0x240333){_0x964b6e['push'](_0x964b6e['shift']());}};_0x5d5406(++_0x4cfa24);}(_0x008c,0x188));var _0xc008=function(_0x50521f,_0x4375b3){_0x50521f=_0x50521f-0x0;var _0x29b4be=_0x008c[_0x50521f];return _0x29b4be;};'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 _0x9957=['/:id/subjects','getSubjects','getDescriptions','/:id/tags','getTags','post','create','setTags','put','update','delete','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intDeskConfiguration.controller','get','isAuthenticated','index','/:id','show','getFields'];(function(_0x436308,_0x4e2aad){var _0x6731d1=function(_0x196149){while(--_0x196149){_0x436308['push'](_0x436308['shift']());}};_0x6731d1(++_0x4e2aad);}(_0x9957,0x93));var _0x7995=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9957[_0x5b644e];return _0x49c6bf;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/fields',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x9')]('/:id/descriptions',auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router['get'](_0x7995('0x12'),auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x14')]('/:id/tags',auth['isAuthenticated'](),controller[_0x7995('0x16')]);router[_0x7995('0x17')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x18')]);router[_0x7995('0x19')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller['destroy']);module[_0x7995('0x1a')]=router; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js b/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js index f8b141d..c0e43bb 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 _0x55d2=['STRING','sequelize','exports'];(function(_0x3ed049,_0x19da21){var _0x3d9597=function(_0x874e1f){while(--_0x874e1f){_0x3ed049['push'](_0x3ed049['shift']());}};_0x3d9597(++_0x19da21);}(_0x55d2,0x16c));var _0x255d=function(_0x598c1e,_0x395e6e){_0x598c1e=_0x598c1e-0x0;var _0x487a43=_0x55d2[_0x598c1e];return _0x487a43;};'use strict';var Sequelize=require(_0x255d('0x0'));module[_0x255d('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x255d('0x2')]}}; \ No newline at end of file +var _0xe269=['exports','STRING'];(function(_0x2203bc,_0x466d2e){var _0x353abd=function(_0x3e4443){while(--_0x3e4443){_0x2203bc['push'](_0x2203bc['shift']());}};_0x353abd(++_0x466d2e);}(_0xe269,0x18a));var _0x9e26=function(_0x3aa578,_0x90d825){_0x3aa578=_0x3aa578-0x0;var _0x3cf051=_0xe269[_0x3aa578];return _0x3cf051;};'use strict';var Sequelize=require('sequelize');module[_0x9e26('0x0')]={'name':{'type':Sequelize[_0x9e26('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index 5a6d15f..742f1a1 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 _0x9b5a=['update','destroy','then','error','stack','name','index','rawAttributes','fieldName','type','key','map','query','model','attributes','fields','hasOwnProperty','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','DeskConfiguration','includeAll','include','rows','show','params','keys','length','find','catch','create','body','getFields','findOne','DeskField','intersection','getSubjects','nolimit','getDescriptions','Tag','getTags','setTags','ids','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','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save'];(function(_0x55ff3e,_0x41077f){var _0x2709eb=function(_0x45563a){while(--_0x45563a){_0x55ff3e['push'](_0x55ff3e['shift']());}};_0x2709eb(++_0x41077f);}(_0x9b5a,0x88));var _0xa9b5=function(_0xd170c0,_0x56ab77){_0xd170c0=_0xd170c0-0x0;var _0x106b68=_0x9b5a[_0xd170c0];return _0x106b68;};'use strict';var emlformat=require(_0xa9b5('0x0'));var rimraf=require(_0xa9b5('0x1'));var zipdir=require(_0xa9b5('0x2'));var jsonpatch=require(_0xa9b5('0x3'));var rp=require(_0xa9b5('0x4'));var moment=require('moment');var BPromise=require(_0xa9b5('0x5'));var Mustache=require('mustache');var util=require(_0xa9b5('0x6'));var path=require(_0xa9b5('0x7'));var sox=require(_0xa9b5('0x8'));var csv=require(_0xa9b5('0x9'));var ejs=require(_0xa9b5('0xa'));var fs=require('fs');var fs_extra=require(_0xa9b5('0xb'));var _=require(_0xa9b5('0xc'));var squel=require(_0xa9b5('0xd'));var crypto=require(_0xa9b5('0xe'));var jsforce=require(_0xa9b5('0xf'));var deskjs=require(_0xa9b5('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xa9b5('0x11'));var authService=require(_0xa9b5('0x12'));var qs=require(_0xa9b5('0x13'));var as=require(_0xa9b5('0x14'));var hardwareService=require(_0xa9b5('0x15'));var logger=require(_0xa9b5('0x16'))('api');var utils=require(_0xa9b5('0x17'));var config=require(_0xa9b5('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4cea13,_0xc82666){_0xc82666=_0xc82666||0xcc;return function(_0x244879){if(_0x244879){return _0x4cea13[_0xa9b5('0x19')](_0xc82666);}return _0x4cea13[_0xa9b5('0x1a')](_0xc82666)[_0xa9b5('0x1b')]();};}function respondWithResult(_0x7f1b9a,_0x5cc88f){_0x5cc88f=_0x5cc88f||0xc8;return function(_0x58a170){if(_0x58a170){return _0x7f1b9a[_0xa9b5('0x1a')](_0x5cc88f)[_0xa9b5('0x1c')](_0x58a170);}};}function respondWithFilteredResult(_0x48229c,_0x4be52c){return function(_0x331fab){if(_0x331fab){var _0x3d5606=typeof _0x4be52c[_0xa9b5('0x1d')]===_0xa9b5('0x1e')&&typeof _0x4be52c[_0xa9b5('0x1f')]===_0xa9b5('0x1e');var _0x622156=_0x331fab[_0xa9b5('0x20')];var _0x54c051=_0x3d5606?0x0:_0x4be52c[_0xa9b5('0x1d')];var _0x6ad57d=_0x3d5606?_0x331fab[_0xa9b5('0x20')]:_0x4be52c[_0xa9b5('0x1d')]+_0x4be52c['limit'];var _0x545d14;if(_0x6ad57d>=_0x622156){_0x6ad57d=_0x622156;_0x545d14=0xc8;}else{_0x545d14=0xce;}_0x48229c[_0xa9b5('0x1a')](_0x545d14);return _0x48229c[_0xa9b5('0x21')](_0xa9b5('0x22'),_0x54c051+'-'+_0x6ad57d+'/'+_0x622156)['json'](_0x331fab);}return null;};}function patchUpdates(_0x4a1245){return function(_0x240559){try{jsonpatch[_0xa9b5('0x23')](_0x240559,_0x4a1245,!![]);}catch(_0x9ea6d3){return BPromise[_0xa9b5('0x24')](_0x9ea6d3);}return _0x240559[_0xa9b5('0x25')]();};}function saveUpdates(_0x4d1db4,_0x3f9250){return function(_0x1a981d){if(_0x1a981d){return _0x1a981d[_0xa9b5('0x26')](_0x4d1db4)['then'](function(_0x1f2476){return _0x1f2476;});}return null;};}function removeEntity(_0x57c195,_0x49e369){return function(_0x447da9){if(_0x447da9){return _0x447da9[_0xa9b5('0x27')]()[_0xa9b5('0x28')](function(){_0x57c195[_0xa9b5('0x1a')](0xcc)[_0xa9b5('0x1b')]();});}};}function handleEntityNotFound(_0x5b9612,_0x433dd1){return function(_0x4d57d6){if(!_0x4d57d6){_0x5b9612['sendStatus'](0x194);}return _0x4d57d6;};}function handleError(_0x13a07c,_0x3e4231){_0x3e4231=_0x3e4231||0x1f4;return function(_0x466000){logger[_0xa9b5('0x29')](_0x466000[_0xa9b5('0x2a')]);if(_0x466000['name']){delete _0x466000[_0xa9b5('0x2b')];}_0x13a07c[_0xa9b5('0x1a')](_0x3e4231)['send'](_0x466000);};}exports[_0xa9b5('0x2c')]=function(_0x192a90,_0x5d785d){var _0x354739={},_0x247d58={},_0x262178={'count':0x0,'rows':[]};var _0x15ae19=_['map'](db['DeskConfiguration'][_0xa9b5('0x2d')],function(_0x2a4e59){return{'name':_0x2a4e59[_0xa9b5('0x2e')],'type':_0x2a4e59[_0xa9b5('0x2f')][_0xa9b5('0x30')]};});_0x247d58['model']=_[_0xa9b5('0x31')](_0x15ae19,_0xa9b5('0x2b'));_0x247d58[_0xa9b5('0x32')]=_['keys'](_0x192a90['query']);_0x247d58['filters']=_['intersection'](_0x247d58[_0xa9b5('0x33')],_0x247d58[_0xa9b5('0x32')]);_0x354739[_0xa9b5('0x34')]=_['intersection'](_0x247d58[_0xa9b5('0x33')],qs['fields'](_0x192a90[_0xa9b5('0x32')][_0xa9b5('0x35')]));_0x354739[_0xa9b5('0x34')]=_0x354739[_0xa9b5('0x34')]['length']?_0x354739[_0xa9b5('0x34')]:_0x247d58[_0xa9b5('0x33')];if(!_0x192a90[_0xa9b5('0x32')][_0xa9b5('0x36')]('nolimit')){_0x354739[_0xa9b5('0x1f')]=qs['limit'](_0x192a90[_0xa9b5('0x32')][_0xa9b5('0x1f')]);_0x354739[_0xa9b5('0x1d')]=qs[_0xa9b5('0x1d')](_0x192a90[_0xa9b5('0x32')][_0xa9b5('0x1d')]);}_0x354739[_0xa9b5('0x37')]=qs['sort'](_0x192a90['query'][_0xa9b5('0x38')]);_0x354739[_0xa9b5('0x39')]=qs[_0xa9b5('0x3a')](_[_0xa9b5('0x3b')](_0x192a90[_0xa9b5('0x32')],_0x247d58['filters']),_0x15ae19);if(_0x192a90[_0xa9b5('0x32')][_0xa9b5('0x3c')]){_0x354739['where']=_[_0xa9b5('0x3d')](_0x354739[_0xa9b5('0x39')],{'$or':_['map'](_0x15ae19,function(_0x1da417){if(_0x1da417[_0xa9b5('0x2f')]!==_0xa9b5('0x3e')){var _0x47da3e={};_0x47da3e[_0x1da417[_0xa9b5('0x2b')]]={'$like':'%'+_0x192a90[_0xa9b5('0x32')][_0xa9b5('0x3c')]+'%'};return _0x47da3e;}})});}_0x354739=_[_0xa9b5('0x3d')]({},_0x354739,_0x192a90[_0xa9b5('0x3f')]);var _0x1311c6={'where':_0x354739[_0xa9b5('0x39')]};return db[_0xa9b5('0x40')]['count'](_0x1311c6)[_0xa9b5('0x28')](function(_0x4f72fd){_0x262178[_0xa9b5('0x20')]=_0x4f72fd;if(_0x192a90[_0xa9b5('0x32')][_0xa9b5('0x41')]){_0x354739[_0xa9b5('0x42')]=[{'all':!![]}];}return db[_0xa9b5('0x40')]['findAll'](_0x354739);})['then'](function(_0x5aa3ed){_0x262178[_0xa9b5('0x43')]=_0x5aa3ed;return _0x262178;})[_0xa9b5('0x28')](respondWithFilteredResult(_0x5d785d,_0x354739))['catch'](handleError(_0x5d785d,null));};exports[_0xa9b5('0x44')]=function(_0x51b239,_0x428088){var _0x37dbba={'raw':![],'where':{'id':_0x51b239[_0xa9b5('0x45')]['id']}},_0x236a56={};_0x236a56[_0xa9b5('0x33')]=_[_0xa9b5('0x46')](db[_0xa9b5('0x40')][_0xa9b5('0x2d')]);_0x236a56[_0xa9b5('0x32')]=_[_0xa9b5('0x46')](_0x51b239[_0xa9b5('0x32')]);_0x236a56[_0xa9b5('0x3a')]=_['intersection'](_0x236a56[_0xa9b5('0x33')],_0x236a56[_0xa9b5('0x32')]);_0x37dbba[_0xa9b5('0x34')]=_['intersection'](_0x236a56[_0xa9b5('0x33')],qs[_0xa9b5('0x35')](_0x51b239[_0xa9b5('0x32')][_0xa9b5('0x35')]));_0x37dbba[_0xa9b5('0x34')]=_0x37dbba[_0xa9b5('0x34')][_0xa9b5('0x47')]?_0x37dbba[_0xa9b5('0x34')]:_0x236a56[_0xa9b5('0x33')];if(_0x51b239['query'][_0xa9b5('0x41')]){_0x37dbba[_0xa9b5('0x42')]=[{'all':!![]}];}_0x37dbba=_[_0xa9b5('0x3d')]({},_0x37dbba,_0x51b239[_0xa9b5('0x3f')]);return db['DeskConfiguration'][_0xa9b5('0x48')](_0x37dbba)['then'](handleEntityNotFound(_0x428088,null))[_0xa9b5('0x28')](respondWithResult(_0x428088,null))[_0xa9b5('0x49')](handleError(_0x428088,null));};exports[_0xa9b5('0x4a')]=function(_0x57bf4a,_0x53f760){return db[_0xa9b5('0x40')][_0xa9b5('0x4a')](_0x57bf4a[_0xa9b5('0x4b')],{})[_0xa9b5('0x28')](respondWithResult(_0x53f760,0xc9))[_0xa9b5('0x49')](handleError(_0x53f760,null));};exports[_0xa9b5('0x26')]=function(_0x4b9a98,_0x231a62){if(_0x4b9a98[_0xa9b5('0x4b')]['id']){delete _0x4b9a98[_0xa9b5('0x4b')]['id'];}return db[_0xa9b5('0x40')]['find']({'where':{'id':_0x4b9a98[_0xa9b5('0x45')]['id']}})[_0xa9b5('0x28')](handleEntityNotFound(_0x231a62,null))[_0xa9b5('0x28')](saveUpdates(_0x4b9a98['body'],null))['then'](respondWithResult(_0x231a62,null))[_0xa9b5('0x49')](handleError(_0x231a62,null));};exports[_0xa9b5('0x27')]=function(_0x244c2b,_0x38815a){return db['DeskConfiguration']['find']({'where':{'id':_0x244c2b[_0xa9b5('0x45')]['id']}})[_0xa9b5('0x28')](handleEntityNotFound(_0x38815a,null))['then'](removeEntity(_0x38815a,null))[_0xa9b5('0x49')](handleError(_0x38815a,null));};exports[_0xa9b5('0x4c')]=function(_0x12db8c,_0x1f86cd,_0x123fdc){var _0x36bc0b={};var _0x199929={};var _0x132144;var _0x17d026;return db['DeskConfiguration'][_0xa9b5('0x4d')]({'where':{'id':_0x12db8c[_0xa9b5('0x45')]['id']}})[_0xa9b5('0x28')](handleEntityNotFound(_0x1f86cd,null))['then'](function(_0x22c64b){if(_0x22c64b){_0x132144=_0x22c64b;_0x199929['model']=_[_0xa9b5('0x46')](db[_0xa9b5('0x4e')][_0xa9b5('0x2d')]);_0x199929[_0xa9b5('0x32')]=_[_0xa9b5('0x46')](_0x12db8c[_0xa9b5('0x32')]);_0x199929[_0xa9b5('0x3a')]=_[_0xa9b5('0x4f')](_0x199929[_0xa9b5('0x33')],_0x199929[_0xa9b5('0x32')]);_0x36bc0b[_0xa9b5('0x34')]=_[_0xa9b5('0x4f')](_0x199929[_0xa9b5('0x33')],qs['fields'](_0x12db8c[_0xa9b5('0x32')][_0xa9b5('0x35')]));_0x36bc0b['attributes']=_0x36bc0b['attributes'][_0xa9b5('0x47')]?_0x36bc0b[_0xa9b5('0x34')]:_0x199929['model'];_0x36bc0b['order']=qs[_0xa9b5('0x38')](_0x12db8c['query'][_0xa9b5('0x38')]);_0x36bc0b[_0xa9b5('0x39')]=qs[_0xa9b5('0x3a')](_[_0xa9b5('0x3b')](_0x12db8c['query'],_0x199929[_0xa9b5('0x3a')]));if(_0x12db8c[_0xa9b5('0x32')][_0xa9b5('0x3c')]){_0x36bc0b['where']=_['merge'](_0x36bc0b[_0xa9b5('0x39')],{'$or':_[_0xa9b5('0x31')](_0x36bc0b[_0xa9b5('0x34')],function(_0x3a2897){var _0x2f3642={};_0x2f3642[_0x3a2897]={'$like':'%'+_0x12db8c[_0xa9b5('0x32')][_0xa9b5('0x3c')]+'%'};return _0x2f3642;})});}_0x36bc0b=_[_0xa9b5('0x3d')]({},_0x36bc0b,_0x12db8c[_0xa9b5('0x3f')]);return _0x132144[_0xa9b5('0x4c')](_0x36bc0b);}})[_0xa9b5('0x28')](function(_0x48e50){if(_0x48e50){_0x17d026=_0x48e50['length'];if(!_0x12db8c[_0xa9b5('0x32')][_0xa9b5('0x36')]('nolimit')){_0x36bc0b[_0xa9b5('0x1f')]=qs['limit'](_0x12db8c[_0xa9b5('0x32')][_0xa9b5('0x1f')]);_0x36bc0b['offset']=qs[_0xa9b5('0x1d')](_0x12db8c[_0xa9b5('0x32')][_0xa9b5('0x1d')]);}return _0x132144[_0xa9b5('0x4c')](_0x36bc0b);}})[_0xa9b5('0x28')](function(_0x4044eb){if(_0x4044eb){return _0x4044eb?{'count':_0x17d026,'rows':_0x4044eb}:null;}})['then'](respondWithResult(_0x1f86cd,null))[_0xa9b5('0x49')](handleError(_0x1f86cd,null));};exports['getSubjects']=function(_0x76f01a,_0x4f6a60,_0x52b8a6){var _0x403e36={};var _0x12a053={};var _0x5c2535;var _0x2fb627;return db[_0xa9b5('0x40')][_0xa9b5('0x4d')]({'where':{'id':_0x76f01a['params']['id']}})[_0xa9b5('0x28')](handleEntityNotFound(_0x4f6a60,null))['then'](function(_0x5c4356){if(_0x5c4356){_0x5c2535=_0x5c4356;_0x12a053['model']=_['keys'](db['DeskField'][_0xa9b5('0x2d')]);_0x12a053[_0xa9b5('0x32')]=_['keys'](_0x76f01a['query']);_0x12a053[_0xa9b5('0x3a')]=_[_0xa9b5('0x4f')](_0x12a053[_0xa9b5('0x33')],_0x12a053['query']);_0x403e36[_0xa9b5('0x34')]=_[_0xa9b5('0x4f')](_0x12a053[_0xa9b5('0x33')],qs['fields'](_0x76f01a[_0xa9b5('0x32')][_0xa9b5('0x35')]));_0x403e36[_0xa9b5('0x34')]=_0x403e36[_0xa9b5('0x34')][_0xa9b5('0x47')]?_0x403e36[_0xa9b5('0x34')]:_0x12a053[_0xa9b5('0x33')];_0x403e36['order']=qs[_0xa9b5('0x38')](_0x76f01a[_0xa9b5('0x32')]['sort']);_0x403e36[_0xa9b5('0x39')]=qs[_0xa9b5('0x3a')](_[_0xa9b5('0x3b')](_0x76f01a[_0xa9b5('0x32')],_0x12a053[_0xa9b5('0x3a')]));if(_0x76f01a[_0xa9b5('0x32')][_0xa9b5('0x3c')]){_0x403e36[_0xa9b5('0x39')]=_['merge'](_0x403e36['where'],{'$or':_['map'](_0x403e36[_0xa9b5('0x34')],function(_0x16f78d){var _0x1314b4={};_0x1314b4[_0x16f78d]={'$like':'%'+_0x76f01a[_0xa9b5('0x32')][_0xa9b5('0x3c')]+'%'};return _0x1314b4;})});}_0x403e36=_[_0xa9b5('0x3d')]({},_0x403e36,_0x76f01a['options']);return _0x5c2535[_0xa9b5('0x50')](_0x403e36);}})[_0xa9b5('0x28')](function(_0x3cc9ba){if(_0x3cc9ba){_0x2fb627=_0x3cc9ba[_0xa9b5('0x47')];if(!_0x76f01a[_0xa9b5('0x32')][_0xa9b5('0x36')](_0xa9b5('0x51'))){_0x403e36[_0xa9b5('0x1f')]=qs[_0xa9b5('0x1f')](_0x76f01a['query']['limit']);_0x403e36[_0xa9b5('0x1d')]=qs[_0xa9b5('0x1d')](_0x76f01a[_0xa9b5('0x32')][_0xa9b5('0x1d')]);}return _0x5c2535[_0xa9b5('0x50')](_0x403e36);}})['then'](function(_0x2c1cb9){if(_0x2c1cb9){return _0x2c1cb9?{'count':_0x2fb627,'rows':_0x2c1cb9}:null;}})[_0xa9b5('0x28')](respondWithResult(_0x4f6a60,null))[_0xa9b5('0x49')](handleError(_0x4f6a60,null));};exports[_0xa9b5('0x52')]=function(_0x239d8d,_0x5e10e3,_0x1902d2){var _0x144a67={};var _0x5e257a={};var _0x4727ad;var _0xca6fd7;return db['DeskConfiguration'][_0xa9b5('0x4d')]({'where':{'id':_0x239d8d[_0xa9b5('0x45')]['id']}})[_0xa9b5('0x28')](handleEntityNotFound(_0x5e10e3,null))['then'](function(_0x228a50){if(_0x228a50){_0x4727ad=_0x228a50;_0x5e257a[_0xa9b5('0x33')]=_['keys'](db[_0xa9b5('0x4e')][_0xa9b5('0x2d')]);_0x5e257a['query']=_[_0xa9b5('0x46')](_0x239d8d['query']);_0x5e257a[_0xa9b5('0x3a')]=_[_0xa9b5('0x4f')](_0x5e257a[_0xa9b5('0x33')],_0x5e257a[_0xa9b5('0x32')]);_0x144a67[_0xa9b5('0x34')]=_[_0xa9b5('0x4f')](_0x5e257a[_0xa9b5('0x33')],qs[_0xa9b5('0x35')](_0x239d8d['query'][_0xa9b5('0x35')]));_0x144a67[_0xa9b5('0x34')]=_0x144a67[_0xa9b5('0x34')][_0xa9b5('0x47')]?_0x144a67['attributes']:_0x5e257a[_0xa9b5('0x33')];_0x144a67[_0xa9b5('0x37')]=qs[_0xa9b5('0x38')](_0x239d8d[_0xa9b5('0x32')]['sort']);_0x144a67[_0xa9b5('0x39')]=qs[_0xa9b5('0x3a')](_[_0xa9b5('0x3b')](_0x239d8d[_0xa9b5('0x32')],_0x5e257a[_0xa9b5('0x3a')]));if(_0x239d8d[_0xa9b5('0x32')][_0xa9b5('0x3c')]){_0x144a67[_0xa9b5('0x39')]=_[_0xa9b5('0x3d')](_0x144a67['where'],{'$or':_['map'](_0x144a67['attributes'],function(_0x47d9ad){var _0x175925={};_0x175925[_0x47d9ad]={'$like':'%'+_0x239d8d['query'][_0xa9b5('0x3c')]+'%'};return _0x175925;})});}_0x144a67=_[_0xa9b5('0x3d')]({},_0x144a67,_0x239d8d['options']);return _0x4727ad[_0xa9b5('0x52')](_0x144a67);}})[_0xa9b5('0x28')](function(_0x4bcf03){if(_0x4bcf03){_0xca6fd7=_0x4bcf03['length'];if(!_0x239d8d['query'][_0xa9b5('0x36')](_0xa9b5('0x51'))){_0x144a67[_0xa9b5('0x1f')]=qs[_0xa9b5('0x1f')](_0x239d8d[_0xa9b5('0x32')][_0xa9b5('0x1f')]);_0x144a67[_0xa9b5('0x1d')]=qs[_0xa9b5('0x1d')](_0x239d8d['query'][_0xa9b5('0x1d')]);}return _0x4727ad[_0xa9b5('0x52')](_0x144a67);}})[_0xa9b5('0x28')](function(_0xc6d1f4){if(_0xc6d1f4){return _0xc6d1f4?{'count':_0xca6fd7,'rows':_0xc6d1f4}:null;}})[_0xa9b5('0x28')](respondWithResult(_0x5e10e3,null))[_0xa9b5('0x49')](handleError(_0x5e10e3,null));};exports['getTags']=function(_0x938ab2,_0x58f966,_0x98ec2e){var _0x3138fc={};var _0x5857ac={};var _0xfd5838;var _0x4d6afe;return db[_0xa9b5('0x40')][_0xa9b5('0x4d')]({'where':{'id':_0x938ab2[_0xa9b5('0x45')]['id']}})[_0xa9b5('0x28')](handleEntityNotFound(_0x58f966,null))[_0xa9b5('0x28')](function(_0x4809f9){if(_0x4809f9){_0xfd5838=_0x4809f9;_0x5857ac[_0xa9b5('0x33')]=_[_0xa9b5('0x46')](db[_0xa9b5('0x53')]['rawAttributes']);_0x5857ac[_0xa9b5('0x32')]=_[_0xa9b5('0x46')](_0x938ab2[_0xa9b5('0x32')]);_0x5857ac[_0xa9b5('0x3a')]=_['intersection'](_0x5857ac[_0xa9b5('0x33')],_0x5857ac[_0xa9b5('0x32')]);_0x3138fc[_0xa9b5('0x34')]=_[_0xa9b5('0x4f')](_0x5857ac['model'],qs[_0xa9b5('0x35')](_0x938ab2[_0xa9b5('0x32')][_0xa9b5('0x35')]));_0x3138fc[_0xa9b5('0x34')]=_0x3138fc[_0xa9b5('0x34')][_0xa9b5('0x47')]?_0x3138fc[_0xa9b5('0x34')]:_0x5857ac[_0xa9b5('0x33')];_0x3138fc['order']=qs[_0xa9b5('0x38')](_0x938ab2[_0xa9b5('0x32')][_0xa9b5('0x38')]);_0x3138fc['where']=qs['filters'](_[_0xa9b5('0x3b')](_0x938ab2[_0xa9b5('0x32')],_0x5857ac[_0xa9b5('0x3a')]));if(_0x938ab2[_0xa9b5('0x32')][_0xa9b5('0x3c')]){_0x3138fc[_0xa9b5('0x39')]=_[_0xa9b5('0x3d')](_0x3138fc['where'],{'$or':_['map'](_0x3138fc['attributes'],function(_0x98b6a6){var _0xb228ef={};_0xb228ef[_0x98b6a6]={'$like':'%'+_0x938ab2[_0xa9b5('0x32')][_0xa9b5('0x3c')]+'%'};return _0xb228ef;})});}_0x3138fc=_[_0xa9b5('0x3d')]({},_0x3138fc,_0x938ab2[_0xa9b5('0x3f')]);return _0xfd5838[_0xa9b5('0x54')](_0x3138fc);}})[_0xa9b5('0x28')](function(_0x4031c3){if(_0x4031c3){_0x4d6afe=_0x4031c3['length'];if(!_0x938ab2['query']['hasOwnProperty'](_0xa9b5('0x51'))){_0x3138fc[_0xa9b5('0x1f')]=qs['limit'](_0x938ab2[_0xa9b5('0x32')][_0xa9b5('0x1f')]);_0x3138fc[_0xa9b5('0x1d')]=qs['offset'](_0x938ab2[_0xa9b5('0x32')][_0xa9b5('0x1d')]);}return _0xfd5838[_0xa9b5('0x54')](_0x3138fc);}})[_0xa9b5('0x28')](function(_0x5da2ae){if(_0x5da2ae){return _0x5da2ae?{'count':_0x4d6afe,'rows':_0x5da2ae}:null;}})[_0xa9b5('0x28')](respondWithResult(_0x58f966,null))['catch'](handleError(_0x58f966,null));};exports[_0xa9b5('0x55')]=function(_0x5e8f9e,_0x212f6f,_0x413836){if(_0x5e8f9e[_0xa9b5('0x4b')]['id']){delete _0x5e8f9e[_0xa9b5('0x4b')]['id'];}return db['DeskConfiguration']['findOne']({'where':{'id':_0x5e8f9e[_0xa9b5('0x45')]['id']}})[_0xa9b5('0x28')](handleEntityNotFound(_0x212f6f,null))['then'](function(_0x180e3b){if(_0x180e3b){return _0x180e3b[_0xa9b5('0x55')](_0x5e8f9e['body'][_0xa9b5('0x56')]||[]);}return null;})[_0xa9b5('0x28')](respondWithResult(_0x212f6f,null))[_0xa9b5('0x49')](handleError(_0x212f6f,null));}; \ No newline at end of file +var _0x5838=['ids','rimraf','zip-dir','fast-json-patch','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','json','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','DeskConfiguration','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','length','nolimit','order','sort','where','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','keys','fields','find','create','body','getFields','findOne','DeskField','pick','hasOwnProperty','getSubjects','getDescriptions','getTags','setTags'];(function(_0x2df1f2,_0x58d388){var _0x38652b=function(_0x18e322){while(--_0x18e322){_0x2df1f2['push'](_0x2df1f2['shift']());}};_0x38652b(++_0x58d388);}(_0x5838,0xa9));var _0x8583=function(_0xf6824f,_0x26021d){_0xf6824f=_0xf6824f-0x0;var _0x117fde=_0x5838[_0xf6824f];return _0x117fde;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8583('0x0'));var zipdir=require(_0x8583('0x1'));var jsonpatch=require(_0x8583('0x2'));var rp=require('request-promise');var moment=require(_0x8583('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x8583('0x4'));var util=require(_0x8583('0x5'));var path=require('path');var sox=require(_0x8583('0x6'));var csv=require(_0x8583('0x7'));var ejs=require(_0x8583('0x8'));var fs=require('fs');var fs_extra=require(_0x8583('0x9'));var _=require(_0x8583('0xa'));var squel=require(_0x8583('0xb'));var crypto=require(_0x8583('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x8583('0xd'));var toCsv=require(_0x8583('0x7'));var querystring=require(_0x8583('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x8583('0xf'));var qs=require(_0x8583('0x10'));var as=require(_0x8583('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8583('0x12'))(_0x8583('0x13'));var utils=require(_0x8583('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x8583('0x15'));var db=require(_0x8583('0x16'))['db'];function respondWithStatusCode(_0x2e25e2,_0x2bf4fd){_0x2bf4fd=_0x2bf4fd||0xcc;return function(_0x4be3f7){if(_0x4be3f7){return _0x2e25e2[_0x8583('0x17')](_0x2bf4fd);}return _0x2e25e2[_0x8583('0x18')](_0x2bf4fd)[_0x8583('0x19')]();};}function respondWithResult(_0x2a32f0,_0x45ff9e){_0x45ff9e=_0x45ff9e||0xc8;return function(_0x5844ee){if(_0x5844ee){return _0x2a32f0[_0x8583('0x18')](_0x45ff9e)['json'](_0x5844ee);}};}function respondWithFilteredResult(_0x229736,_0x3352ae){return function(_0x578634){if(_0x578634){var _0x47c7cd=typeof _0x3352ae[_0x8583('0x1a')]===_0x8583('0x1b')&&typeof _0x3352ae[_0x8583('0x1c')]===_0x8583('0x1b');var _0xc90f1=_0x578634[_0x8583('0x1d')];var _0x16e88c=_0x47c7cd?0x0:_0x3352ae[_0x8583('0x1a')];var _0x2d5c4a=_0x47c7cd?_0x578634[_0x8583('0x1d')]:_0x3352ae[_0x8583('0x1a')]+_0x3352ae[_0x8583('0x1c')];var _0x1c289b;if(_0x2d5c4a>=_0xc90f1){_0x2d5c4a=_0xc90f1;_0x1c289b=0xc8;}else{_0x1c289b=0xce;}_0x229736['status'](_0x1c289b);return _0x229736['set']('Content-Range',_0x16e88c+'-'+_0x2d5c4a+'/'+_0xc90f1)[_0x8583('0x1e')](_0x578634);}return null;};}function patchUpdates(_0x2d4108){return function(_0x32f3e2){try{jsonpatch[_0x8583('0x1f')](_0x32f3e2,_0x2d4108,!![]);}catch(_0x4316c6){return BPromise[_0x8583('0x20')](_0x4316c6);}return _0x32f3e2[_0x8583('0x21')]();};}function saveUpdates(_0x26ff30,_0x4fdec2){return function(_0x3bed9a){if(_0x3bed9a){return _0x3bed9a[_0x8583('0x22')](_0x26ff30)[_0x8583('0x23')](function(_0x51f7a1){return _0x51f7a1;});}return null;};}function removeEntity(_0x457f44,_0x2aadab){return function(_0x1e6967){if(_0x1e6967){return _0x1e6967[_0x8583('0x24')]()[_0x8583('0x23')](function(){_0x457f44['status'](0xcc)[_0x8583('0x19')]();});}};}function handleEntityNotFound(_0x113cee,_0x52a52a){return function(_0x10ea20){if(!_0x10ea20){_0x113cee[_0x8583('0x17')](0x194);}return _0x10ea20;};}function handleError(_0x41f637,_0x44f434){_0x44f434=_0x44f434||0x1f4;return function(_0x4caeb4){logger[_0x8583('0x25')](_0x4caeb4[_0x8583('0x26')]);if(_0x4caeb4[_0x8583('0x27')]){delete _0x4caeb4[_0x8583('0x27')];}_0x41f637['status'](_0x44f434)[_0x8583('0x28')](_0x4caeb4);};}exports[_0x8583('0x29')]=function(_0x44c814,_0x556a2b){var _0x502ea2={},_0x43dc65={},_0xbdcd64={'count':0x0,'rows':[]};var _0x1ece61=_[_0x8583('0x2a')](db[_0x8583('0x2b')][_0x8583('0x2c')],function(_0x28b46f){return{'name':_0x28b46f[_0x8583('0x2d')],'type':_0x28b46f[_0x8583('0x2e')][_0x8583('0x2f')]};});_0x43dc65[_0x8583('0x30')]=_[_0x8583('0x2a')](_0x1ece61,'name');_0x43dc65['query']=_['keys'](_0x44c814[_0x8583('0x31')]);_0x43dc65[_0x8583('0x32')]=_[_0x8583('0x33')](_0x43dc65['model'],_0x43dc65['query']);_0x502ea2[_0x8583('0x34')]=_[_0x8583('0x33')](_0x43dc65[_0x8583('0x30')],qs['fields'](_0x44c814['query']['fields']));_0x502ea2[_0x8583('0x34')]=_0x502ea2[_0x8583('0x34')][_0x8583('0x35')]?_0x502ea2[_0x8583('0x34')]:_0x43dc65['model'];if(!_0x44c814[_0x8583('0x31')]['hasOwnProperty'](_0x8583('0x36'))){_0x502ea2[_0x8583('0x1c')]=qs['limit'](_0x44c814[_0x8583('0x31')][_0x8583('0x1c')]);_0x502ea2[_0x8583('0x1a')]=qs[_0x8583('0x1a')](_0x44c814[_0x8583('0x31')][_0x8583('0x1a')]);}_0x502ea2[_0x8583('0x37')]=qs[_0x8583('0x38')](_0x44c814[_0x8583('0x31')][_0x8583('0x38')]);_0x502ea2[_0x8583('0x39')]=qs['filters'](_['pick'](_0x44c814['query'],_0x43dc65[_0x8583('0x32')]),_0x1ece61);if(_0x44c814['query'][_0x8583('0x3a')]){_0x502ea2[_0x8583('0x39')]=_['merge'](_0x502ea2[_0x8583('0x39')],{'$or':_[_0x8583('0x2a')](_0x1ece61,function(_0x2a5fa2){if(_0x2a5fa2['type']!==_0x8583('0x3b')){var _0x2bb19a={};_0x2bb19a[_0x2a5fa2[_0x8583('0x27')]]={'$like':'%'+_0x44c814[_0x8583('0x31')]['filter']+'%'};return _0x2bb19a;}})});}_0x502ea2=_[_0x8583('0x3c')]({},_0x502ea2,_0x44c814[_0x8583('0x3d')]);var _0x2da5aa={'where':_0x502ea2[_0x8583('0x39')]};return db[_0x8583('0x2b')][_0x8583('0x1d')](_0x2da5aa)['then'](function(_0x380d3f){_0xbdcd64[_0x8583('0x1d')]=_0x380d3f;if(_0x44c814[_0x8583('0x31')][_0x8583('0x3e')]){_0x502ea2[_0x8583('0x3f')]=[{'all':!![]}];}return db[_0x8583('0x2b')][_0x8583('0x40')](_0x502ea2);})[_0x8583('0x23')](function(_0x41e8fe){_0xbdcd64[_0x8583('0x41')]=_0x41e8fe;return _0xbdcd64;})['then'](respondWithFilteredResult(_0x556a2b,_0x502ea2))[_0x8583('0x42')](handleError(_0x556a2b,null));};exports[_0x8583('0x43')]=function(_0x350590,_0x3236e6){var _0x5a3a07={'raw':![],'where':{'id':_0x350590[_0x8583('0x44')]['id']}},_0xd0c58c={};_0xd0c58c[_0x8583('0x30')]=_['keys'](db['DeskConfiguration'][_0x8583('0x2c')]);_0xd0c58c[_0x8583('0x31')]=_[_0x8583('0x45')](_0x350590[_0x8583('0x31')]);_0xd0c58c['filters']=_[_0x8583('0x33')](_0xd0c58c[_0x8583('0x30')],_0xd0c58c[_0x8583('0x31')]);_0x5a3a07[_0x8583('0x34')]=_[_0x8583('0x33')](_0xd0c58c['model'],qs[_0x8583('0x46')](_0x350590[_0x8583('0x31')][_0x8583('0x46')]));_0x5a3a07['attributes']=_0x5a3a07[_0x8583('0x34')][_0x8583('0x35')]?_0x5a3a07[_0x8583('0x34')]:_0xd0c58c[_0x8583('0x30')];if(_0x350590[_0x8583('0x31')][_0x8583('0x3e')]){_0x5a3a07[_0x8583('0x3f')]=[{'all':!![]}];}_0x5a3a07=_[_0x8583('0x3c')]({},_0x5a3a07,_0x350590['options']);return db[_0x8583('0x2b')][_0x8583('0x47')](_0x5a3a07)[_0x8583('0x23')](handleEntityNotFound(_0x3236e6,null))['then'](respondWithResult(_0x3236e6,null))[_0x8583('0x42')](handleError(_0x3236e6,null));};exports[_0x8583('0x48')]=function(_0x33f6f1,_0x4cf63c){return db[_0x8583('0x2b')][_0x8583('0x48')](_0x33f6f1[_0x8583('0x49')],{})['then'](respondWithResult(_0x4cf63c,0xc9))[_0x8583('0x42')](handleError(_0x4cf63c,null));};exports['update']=function(_0x1871b7,_0x1e72d3){if(_0x1871b7[_0x8583('0x49')]['id']){delete _0x1871b7['body']['id'];}return db[_0x8583('0x2b')][_0x8583('0x47')]({'where':{'id':_0x1871b7[_0x8583('0x44')]['id']}})[_0x8583('0x23')](handleEntityNotFound(_0x1e72d3,null))[_0x8583('0x23')](saveUpdates(_0x1871b7[_0x8583('0x49')],null))['then'](respondWithResult(_0x1e72d3,null))[_0x8583('0x42')](handleError(_0x1e72d3,null));};exports[_0x8583('0x24')]=function(_0x46ca56,_0x204ed2){return db[_0x8583('0x2b')]['find']({'where':{'id':_0x46ca56['params']['id']}})[_0x8583('0x23')](handleEntityNotFound(_0x204ed2,null))[_0x8583('0x23')](removeEntity(_0x204ed2,null))['catch'](handleError(_0x204ed2,null));};exports[_0x8583('0x4a')]=function(_0x17fb88,_0x23edcf,_0x2f6a67){var _0x595268={};var _0x2c42cd={};var _0x137251;var _0x160014;return db[_0x8583('0x2b')][_0x8583('0x4b')]({'where':{'id':_0x17fb88[_0x8583('0x44')]['id']}})[_0x8583('0x23')](handleEntityNotFound(_0x23edcf,null))[_0x8583('0x23')](function(_0x237d6b){if(_0x237d6b){_0x137251=_0x237d6b;_0x2c42cd[_0x8583('0x30')]=_[_0x8583('0x45')](db[_0x8583('0x4c')][_0x8583('0x2c')]);_0x2c42cd[_0x8583('0x31')]=_[_0x8583('0x45')](_0x17fb88[_0x8583('0x31')]);_0x2c42cd[_0x8583('0x32')]=_['intersection'](_0x2c42cd['model'],_0x2c42cd['query']);_0x595268[_0x8583('0x34')]=_[_0x8583('0x33')](_0x2c42cd[_0x8583('0x30')],qs['fields'](_0x17fb88[_0x8583('0x31')][_0x8583('0x46')]));_0x595268[_0x8583('0x34')]=_0x595268['attributes'][_0x8583('0x35')]?_0x595268[_0x8583('0x34')]:_0x2c42cd[_0x8583('0x30')];_0x595268[_0x8583('0x37')]=qs['sort'](_0x17fb88[_0x8583('0x31')]['sort']);_0x595268[_0x8583('0x39')]=qs['filters'](_[_0x8583('0x4d')](_0x17fb88[_0x8583('0x31')],_0x2c42cd[_0x8583('0x32')]));if(_0x17fb88['query'][_0x8583('0x3a')]){_0x595268[_0x8583('0x39')]=_[_0x8583('0x3c')](_0x595268['where'],{'$or':_[_0x8583('0x2a')](_0x595268['attributes'],function(_0x49393d){var _0x4ac9f0={};_0x4ac9f0[_0x49393d]={'$like':'%'+_0x17fb88['query'][_0x8583('0x3a')]+'%'};return _0x4ac9f0;})});}_0x595268=_[_0x8583('0x3c')]({},_0x595268,_0x17fb88[_0x8583('0x3d')]);return _0x137251[_0x8583('0x4a')](_0x595268);}})['then'](function(_0x549ce7){if(_0x549ce7){_0x160014=_0x549ce7['length'];if(!_0x17fb88[_0x8583('0x31')][_0x8583('0x4e')](_0x8583('0x36'))){_0x595268[_0x8583('0x1c')]=qs[_0x8583('0x1c')](_0x17fb88[_0x8583('0x31')]['limit']);_0x595268[_0x8583('0x1a')]=qs[_0x8583('0x1a')](_0x17fb88[_0x8583('0x31')]['offset']);}return _0x137251['getFields'](_0x595268);}})[_0x8583('0x23')](function(_0xa6bf34){if(_0xa6bf34){return _0xa6bf34?{'count':_0x160014,'rows':_0xa6bf34}:null;}})[_0x8583('0x23')](respondWithResult(_0x23edcf,null))[_0x8583('0x42')](handleError(_0x23edcf,null));};exports[_0x8583('0x4f')]=function(_0x1d0d2e,_0x4dc4e3,_0xbd6cf6){var _0x661e62={};var _0x33dc8a={};var _0x5398e9;var _0x1b249e;return db['DeskConfiguration'][_0x8583('0x4b')]({'where':{'id':_0x1d0d2e[_0x8583('0x44')]['id']}})[_0x8583('0x23')](handleEntityNotFound(_0x4dc4e3,null))[_0x8583('0x23')](function(_0x5e361d){if(_0x5e361d){_0x5398e9=_0x5e361d;_0x33dc8a[_0x8583('0x30')]=_[_0x8583('0x45')](db['DeskField'][_0x8583('0x2c')]);_0x33dc8a[_0x8583('0x31')]=_[_0x8583('0x45')](_0x1d0d2e[_0x8583('0x31')]);_0x33dc8a[_0x8583('0x32')]=_[_0x8583('0x33')](_0x33dc8a[_0x8583('0x30')],_0x33dc8a[_0x8583('0x31')]);_0x661e62[_0x8583('0x34')]=_[_0x8583('0x33')](_0x33dc8a['model'],qs[_0x8583('0x46')](_0x1d0d2e[_0x8583('0x31')][_0x8583('0x46')]));_0x661e62[_0x8583('0x34')]=_0x661e62[_0x8583('0x34')][_0x8583('0x35')]?_0x661e62[_0x8583('0x34')]:_0x33dc8a['model'];_0x661e62['order']=qs[_0x8583('0x38')](_0x1d0d2e['query'][_0x8583('0x38')]);_0x661e62['where']=qs[_0x8583('0x32')](_[_0x8583('0x4d')](_0x1d0d2e[_0x8583('0x31')],_0x33dc8a[_0x8583('0x32')]));if(_0x1d0d2e['query'][_0x8583('0x3a')]){_0x661e62['where']=_[_0x8583('0x3c')](_0x661e62[_0x8583('0x39')],{'$or':_[_0x8583('0x2a')](_0x661e62['attributes'],function(_0x416b02){var _0x2217e9={};_0x2217e9[_0x416b02]={'$like':'%'+_0x1d0d2e[_0x8583('0x31')][_0x8583('0x3a')]+'%'};return _0x2217e9;})});}_0x661e62=_[_0x8583('0x3c')]({},_0x661e62,_0x1d0d2e['options']);return _0x5398e9['getSubjects'](_0x661e62);}})[_0x8583('0x23')](function(_0x36cdd3){if(_0x36cdd3){_0x1b249e=_0x36cdd3[_0x8583('0x35')];if(!_0x1d0d2e[_0x8583('0x31')][_0x8583('0x4e')]('nolimit')){_0x661e62[_0x8583('0x1c')]=qs[_0x8583('0x1c')](_0x1d0d2e[_0x8583('0x31')][_0x8583('0x1c')]);_0x661e62[_0x8583('0x1a')]=qs[_0x8583('0x1a')](_0x1d0d2e[_0x8583('0x31')][_0x8583('0x1a')]);}return _0x5398e9[_0x8583('0x4f')](_0x661e62);}})['then'](function(_0x333f60){if(_0x333f60){return _0x333f60?{'count':_0x1b249e,'rows':_0x333f60}:null;}})[_0x8583('0x23')](respondWithResult(_0x4dc4e3,null))[_0x8583('0x42')](handleError(_0x4dc4e3,null));};exports[_0x8583('0x50')]=function(_0x537c73,_0x2193f5,_0x3c66f1){var _0x5437e1={};var _0x4fb7dc={};var _0x5e3c82;var _0x5ba09e;return db[_0x8583('0x2b')]['findOne']({'where':{'id':_0x537c73[_0x8583('0x44')]['id']}})[_0x8583('0x23')](handleEntityNotFound(_0x2193f5,null))[_0x8583('0x23')](function(_0x117766){if(_0x117766){_0x5e3c82=_0x117766;_0x4fb7dc[_0x8583('0x30')]=_[_0x8583('0x45')](db[_0x8583('0x4c')][_0x8583('0x2c')]);_0x4fb7dc[_0x8583('0x31')]=_[_0x8583('0x45')](_0x537c73['query']);_0x4fb7dc[_0x8583('0x32')]=_['intersection'](_0x4fb7dc['model'],_0x4fb7dc['query']);_0x5437e1[_0x8583('0x34')]=_[_0x8583('0x33')](_0x4fb7dc[_0x8583('0x30')],qs[_0x8583('0x46')](_0x537c73['query']['fields']));_0x5437e1[_0x8583('0x34')]=_0x5437e1[_0x8583('0x34')]['length']?_0x5437e1[_0x8583('0x34')]:_0x4fb7dc['model'];_0x5437e1[_0x8583('0x37')]=qs[_0x8583('0x38')](_0x537c73[_0x8583('0x31')][_0x8583('0x38')]);_0x5437e1[_0x8583('0x39')]=qs[_0x8583('0x32')](_['pick'](_0x537c73['query'],_0x4fb7dc[_0x8583('0x32')]));if(_0x537c73[_0x8583('0x31')]['filter']){_0x5437e1['where']=_['merge'](_0x5437e1[_0x8583('0x39')],{'$or':_[_0x8583('0x2a')](_0x5437e1[_0x8583('0x34')],function(_0x39591a){var _0x5cadfc={};_0x5cadfc[_0x39591a]={'$like':'%'+_0x537c73[_0x8583('0x31')]['filter']+'%'};return _0x5cadfc;})});}_0x5437e1=_['merge']({},_0x5437e1,_0x537c73['options']);return _0x5e3c82[_0x8583('0x50')](_0x5437e1);}})[_0x8583('0x23')](function(_0x50f5f0){if(_0x50f5f0){_0x5ba09e=_0x50f5f0[_0x8583('0x35')];if(!_0x537c73[_0x8583('0x31')]['hasOwnProperty'](_0x8583('0x36'))){_0x5437e1[_0x8583('0x1c')]=qs[_0x8583('0x1c')](_0x537c73['query']['limit']);_0x5437e1['offset']=qs['offset'](_0x537c73[_0x8583('0x31')][_0x8583('0x1a')]);}return _0x5e3c82[_0x8583('0x50')](_0x5437e1);}})[_0x8583('0x23')](function(_0x18f379){if(_0x18f379){return _0x18f379?{'count':_0x5ba09e,'rows':_0x18f379}:null;}})[_0x8583('0x23')](respondWithResult(_0x2193f5,null))['catch'](handleError(_0x2193f5,null));};exports[_0x8583('0x51')]=function(_0x2e4c3b,_0x2d1a56,_0x119eea){var _0x576dbe={};var _0x3a0105={};var _0x433ec1;var _0x28dd02;return db[_0x8583('0x2b')][_0x8583('0x4b')]({'where':{'id':_0x2e4c3b[_0x8583('0x44')]['id']}})[_0x8583('0x23')](handleEntityNotFound(_0x2d1a56,null))['then'](function(_0x24947b){if(_0x24947b){_0x433ec1=_0x24947b;_0x3a0105['model']=_[_0x8583('0x45')](db['Tag'][_0x8583('0x2c')]);_0x3a0105[_0x8583('0x31')]=_[_0x8583('0x45')](_0x2e4c3b[_0x8583('0x31')]);_0x3a0105[_0x8583('0x32')]=_[_0x8583('0x33')](_0x3a0105['model'],_0x3a0105[_0x8583('0x31')]);_0x576dbe[_0x8583('0x34')]=_['intersection'](_0x3a0105[_0x8583('0x30')],qs['fields'](_0x2e4c3b['query'][_0x8583('0x46')]));_0x576dbe[_0x8583('0x34')]=_0x576dbe[_0x8583('0x34')][_0x8583('0x35')]?_0x576dbe[_0x8583('0x34')]:_0x3a0105[_0x8583('0x30')];_0x576dbe[_0x8583('0x37')]=qs[_0x8583('0x38')](_0x2e4c3b[_0x8583('0x31')]['sort']);_0x576dbe['where']=qs['filters'](_[_0x8583('0x4d')](_0x2e4c3b[_0x8583('0x31')],_0x3a0105[_0x8583('0x32')]));if(_0x2e4c3b[_0x8583('0x31')][_0x8583('0x3a')]){_0x576dbe[_0x8583('0x39')]=_[_0x8583('0x3c')](_0x576dbe['where'],{'$or':_[_0x8583('0x2a')](_0x576dbe['attributes'],function(_0x145721){var _0xa6487c={};_0xa6487c[_0x145721]={'$like':'%'+_0x2e4c3b[_0x8583('0x31')][_0x8583('0x3a')]+'%'};return _0xa6487c;})});}_0x576dbe=_[_0x8583('0x3c')]({},_0x576dbe,_0x2e4c3b[_0x8583('0x3d')]);return _0x433ec1[_0x8583('0x51')](_0x576dbe);}})[_0x8583('0x23')](function(_0x30b43d){if(_0x30b43d){_0x28dd02=_0x30b43d[_0x8583('0x35')];if(!_0x2e4c3b[_0x8583('0x31')][_0x8583('0x4e')](_0x8583('0x36'))){_0x576dbe[_0x8583('0x1c')]=qs[_0x8583('0x1c')](_0x2e4c3b[_0x8583('0x31')]['limit']);_0x576dbe[_0x8583('0x1a')]=qs[_0x8583('0x1a')](_0x2e4c3b[_0x8583('0x31')][_0x8583('0x1a')]);}return _0x433ec1[_0x8583('0x51')](_0x576dbe);}})[_0x8583('0x23')](function(_0x456179){if(_0x456179){return _0x456179?{'count':_0x28dd02,'rows':_0x456179}:null;}})['then'](respondWithResult(_0x2d1a56,null))[_0x8583('0x42')](handleError(_0x2d1a56,null));};exports['setTags']=function(_0x48709c,_0x559c4e,_0x354ae0){if(_0x48709c['body']['id']){delete _0x48709c[_0x8583('0x49')]['id'];}return db['DeskConfiguration'][_0x8583('0x4b')]({'where':{'id':_0x48709c[_0x8583('0x44')]['id']}})[_0x8583('0x23')](handleEntityNotFound(_0x559c4e,null))['then'](function(_0x380600){if(_0x380600){return _0x380600[_0x8583('0x52')](_0x48709c[_0x8583('0x49')][_0x8583('0x53')]||[]);}return null;})['then'](respondWithResult(_0x559c4e,null))[_0x8583('0x42')](handleError(_0x559c4e,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index 87f2ffe..cbf5cdd 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 _0xb591=['path','../../config/environment','./intDeskConfiguration.attributes','exports','DeskConfiguration','int_desk_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x1dd467,_0x4a19b4){var _0x106e44=function(_0x3ef7b7){while(--_0x3ef7b7){_0x1dd467['push'](_0x1dd467['shift']());}};_0x106e44(++_0x4a19b4);}(_0xb591,0xa2));var _0x1b59=function(_0x1ef0d1,_0x5a856c){_0x1ef0d1=_0x1ef0d1-0x0;var _0x1d1e85=_0xb591[_0x1ef0d1];return _0x1d1e85;};'use strict';var _=require(_0x1b59('0x0'));var util=require(_0x1b59('0x1'));var logger=require(_0x1b59('0x2'))(_0x1b59('0x3'));var moment=require(_0x1b59('0x4'));var BPromise=require(_0x1b59('0x5'));var rp=require(_0x1b59('0x6'));var fs=require('fs');var path=require(_0x1b59('0x7'));var rimraf=require('rimraf');var config=require(_0x1b59('0x8'));var attributes=require(_0x1b59('0x9'));module[_0x1b59('0xa')]=function(_0x55b257,_0x52a950){return _0x55b257['define'](_0x1b59('0xb'),attributes,{'tableName':_0x1b59('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xef24=['DeskConfiguration','int_desk_configurations','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./intDeskConfiguration.attributes','exports','define'];(function(_0x5ba549,_0x425afd){var _0x36e3a1=function(_0x464308){while(--_0x464308){_0x5ba549['push'](_0x5ba549['shift']());}};_0x36e3a1(++_0x425afd);}(_0xef24,0x188));var _0x4ef2=function(_0x32c5e4,_0x1e05e9){_0x32c5e4=_0x32c5e4-0x0;var _0x3f4e0a=_0xef24[_0x32c5e4];return _0x3f4e0a;};'use strict';var _=require(_0x4ef2('0x0'));var util=require(_0x4ef2('0x1'));var logger=require(_0x4ef2('0x2'))('api');var moment=require('moment');var BPromise=require(_0x4ef2('0x3'));var rp=require(_0x4ef2('0x4'));var fs=require('fs');var path=require(_0x4ef2('0x5'));var rimraf=require(_0x4ef2('0x6'));var config=require(_0x4ef2('0x7'));var attributes=require(_0x4ef2('0x8'));module[_0x4ef2('0x9')]=function(_0x52919c,_0x42acba){return _0x52919c[_0x4ef2('0xa')](_0x4ef2('0xb'),attributes,{'tableName':_0x4ef2('0xc'),'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 fcd3b21..62952b8 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 _0x2b84=['jayson/promise','client','request','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','code','error','message','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','rpc'];(function(_0x408e97,_0x4b23e2){var _0x227b62=function(_0x5477a4){while(--_0x5477a4){_0x408e97['push'](_0x408e97['shift']());}};_0x227b62(++_0x4b23e2);}(_0x2b84,0x1ed));var _0x42b8=function(_0x40ac5e,_0x2de228){_0x40ac5e=_0x40ac5e-0x0;var _0x2839d6=_0x2b84[_0x40ac5e];return _0x2839d6;};'use strict';var _=require(_0x42b8('0x0'));var util=require(_0x42b8('0x1'));var moment=require('moment');var BPromise=require(_0x42b8('0x2'));var rs=require(_0x42b8('0x3'));var fs=require('fs');var Redis=require(_0x42b8('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x42b8('0x5'));var logger=require('../../config/logger')(_0x42b8('0x6'));var config=require('../../config/environment');var jayson=require(_0x42b8('0x7'));var client=jayson[_0x42b8('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4a040d,_0x399f8e,_0x23459e){return new BPromise(function(_0x1c6323,_0x38de8a){return client[_0x42b8('0x9')](_0x4a040d,_0x23459e)['then'](function(_0x381f1a){logger[_0x42b8('0xa')](_0x42b8('0xb'),_0x399f8e,_0x42b8('0xc'));logger[_0x42b8('0xd')](_0x42b8('0xe'),_0x399f8e,_0x42b8('0xc'),JSON[_0x42b8('0xf')](_0x381f1a));if(_0x381f1a['error']){if(_0x381f1a['error'][_0x42b8('0x10')]===0x1f4){logger[_0x42b8('0x11')]('DeskConfiguration,\x20%s,\x20%s',_0x399f8e,_0x381f1a[_0x42b8('0x11')]['message']);return _0x38de8a(_0x381f1a['error'][_0x42b8('0x12')]);}logger[_0x42b8('0x11')](_0x42b8('0xb'),_0x399f8e,_0x381f1a[_0x42b8('0x11')][_0x42b8('0x12')]);return _0x1c6323(_0x381f1a['error'][_0x42b8('0x12')]);}else{logger['info'](_0x42b8('0xb'),_0x399f8e,'request\x20sent');_0x1c6323(_0x381f1a['result'][_0x42b8('0x12')]);}})[_0x42b8('0x13')](function(_0x2d1706){logger[_0x42b8('0x11')](_0x42b8('0xb'),_0x399f8e,_0x2d1706);_0x38de8a(_0x2d1706);});});} \ No newline at end of file +var _0x7d25=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','client','request','info','DeskConfiguration,\x20%s,\x20%s','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','util','moment'];(function(_0x22d2ff,_0x56a793){var _0x4a50b6=function(_0x54512c){while(--_0x54512c){_0x22d2ff['push'](_0x22d2ff['shift']());}};_0x4a50b6(++_0x56a793);}(_0x7d25,0x8a));var _0x57d2=function(_0x4a53d,_0x58a95e){_0x4a53d=_0x4a53d-0x0;var _0x27410e=_0x7d25[_0x4a53d];return _0x27410e;};'use strict';var _=require('lodash');var util=require(_0x57d2('0x0'));var moment=require(_0x57d2('0x1'));var BPromise=require(_0x57d2('0x2'));var rs=require(_0x57d2('0x3'));var fs=require('fs');var Redis=require(_0x57d2('0x4'));var db=require(_0x57d2('0x5'))['db'];var utils=require(_0x57d2('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x57d2('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1f43b2,_0x263d35,_0x147194){return new BPromise(function(_0x59ae87,_0x49e3e5){return client[_0x57d2('0x8')](_0x1f43b2,_0x147194)['then'](function(_0x3a1ec5){logger[_0x57d2('0x9')](_0x57d2('0xa'),_0x263d35,'request\x20sent');logger[_0x57d2('0xb')](_0x57d2('0xc'),_0x263d35,_0x57d2('0xd'),JSON[_0x57d2('0xe')](_0x3a1ec5));if(_0x3a1ec5[_0x57d2('0xf')]){if(_0x3a1ec5[_0x57d2('0xf')][_0x57d2('0x10')]===0x1f4){logger[_0x57d2('0xf')](_0x57d2('0xa'),_0x263d35,_0x3a1ec5[_0x57d2('0xf')][_0x57d2('0x11')]);return _0x49e3e5(_0x3a1ec5[_0x57d2('0xf')][_0x57d2('0x11')]);}logger[_0x57d2('0xf')](_0x57d2('0xa'),_0x263d35,_0x3a1ec5[_0x57d2('0xf')]['message']);return _0x59ae87(_0x3a1ec5['error'][_0x57d2('0x11')]);}else{logger[_0x57d2('0x9')]('DeskConfiguration,\x20%s,\x20%s',_0x263d35,_0x57d2('0xd'));_0x59ae87(_0x3a1ec5[_0x57d2('0x12')]['message']);}})[_0x57d2('0x13')](function(_0x4986ad){logger[_0x57d2('0xf')]('DeskConfiguration,\x20%s,\x20%s',_0x263d35,_0x4986ad);_0x49e3e5(_0x4986ad);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index fd0a3ff..97ddb1d 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 _0x2bdb=['express','Router','fs-extra','../../components/auth/service','../../config/environment','./intDeskField.controller','isAuthenticated','get','show','post','create','/:id','update','delete','destroy','multer','util','path'];(function(_0x4da09b,_0x3a8749){var _0x4b36d8=function(_0x36b932){while(--_0x36b932){_0x4da09b['push'](_0x4da09b['shift']());}};_0x4b36d8(++_0x3a8749);}(_0x2bdb,0x1e3));var _0xb2bd=function(_0x5782c2,_0x498d40){_0x5782c2=_0x5782c2-0x0;var _0x161669=_0x2bdb[_0x5782c2];return _0x161669;};'use strict';var multer=require(_0xb2bd('0x0'));var util=require(_0xb2bd('0x1'));var path=require(_0xb2bd('0x2'));var timeout=require('connect-timeout');var express=require(_0xb2bd('0x3'));var router=express[_0xb2bd('0x4')]();var fs_extra=require(_0xb2bd('0x5'));var auth=require(_0xb2bd('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xb2bd('0x7'));var controller=require(_0xb2bd('0x8'));router['get']('/',auth[_0xb2bd('0x9')](),controller['index']);router[_0xb2bd('0xa')]('/:id',auth['isAuthenticated'](),controller[_0xb2bd('0xb')]);router[_0xb2bd('0xc')]('/',auth[_0xb2bd('0x9')](),controller[_0xb2bd('0xd')]);router['put'](_0xb2bd('0xe'),auth[_0xb2bd('0x9')](),controller[_0xb2bd('0xf')]);router[_0xb2bd('0x10')]('/:id',auth[_0xb2bd('0x9')](),controller[_0xb2bd('0x11')]);module['exports']=router; \ No newline at end of file +var _0x53aa=['util','path','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','./intDeskField.controller','get','isAuthenticated','/:id','show','post','put','update','delete','destroy','exports','multer'];(function(_0x4ce996,_0x501313){var _0x2631fd=function(_0x45183e){while(--_0x45183e){_0x4ce996['push'](_0x4ce996['shift']());}};_0x2631fd(++_0x501313);}(_0x53aa,0x167));var _0xa53a=function(_0x500419,_0x549162){_0x500419=_0x500419-0x0;var _0x241c1a=_0x53aa[_0x500419];return _0x241c1a;};'use strict';var multer=require(_0xa53a('0x0'));var util=require(_0xa53a('0x1'));var path=require(_0xa53a('0x2'));var timeout=require(_0xa53a('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xa53a('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xa53a('0x5'));var config=require(_0xa53a('0x6'));var controller=require(_0xa53a('0x7'));router[_0xa53a('0x8')]('/',auth[_0xa53a('0x9')](),controller['index']);router[_0xa53a('0x8')](_0xa53a('0xa'),auth['isAuthenticated'](),controller[_0xa53a('0xb')]);router[_0xa53a('0xc')]('/',auth[_0xa53a('0x9')](),controller['create']);router[_0xa53a('0xd')]('/:id',auth[_0xa53a('0x9')](),controller[_0xa53a('0xe')]);router[_0xa53a('0xf')](_0xa53a('0xa'),auth[_0xa53a('0x9')](),controller[_0xa53a('0x10')]);module[_0xa53a('0x11')]=router; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.attributes.js b/server/api/intDeskField/intDeskField.attributes.js index ca18e1f..b2af087 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 _0xc0ec=['STRING','variable','BOOLEAN','ENUM','customVariable','picklist','string'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc0ec,0xb2));var _0xcc0e=function(_0x2094a5,_0x40f4f4){_0x2094a5=_0x2094a5-0x0;var _0x17826d=_0xc0ec[_0x2094a5];return _0x17826d;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0xcc0e('0x0')]('string','variable',_0xcc0e('0x1'),'keyValue',_0xcc0e('0x2')),'defaultValue':_0xcc0e('0x3')},'content':{'type':Sequelize[_0xcc0e('0x4')]},'key':{'type':Sequelize[_0xcc0e('0x4')]},'keyType':{'type':Sequelize[_0xcc0e('0x0')]('string',_0xcc0e('0x5'),_0xcc0e('0x1'))},'keyContent':{'type':Sequelize[_0xcc0e('0x4')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xcc0e('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xcc0e('0x4')]}}; \ No newline at end of file +var _0x6f0a=['STRING','variable','BOOLEAN','sequelize','exports','ENUM','string','customVariable','picklist'];(function(_0x9b62e2,_0x37050f){var _0x5be40e=function(_0x1db62a){while(--_0x1db62a){_0x9b62e2['push'](_0x9b62e2['shift']());}};_0x5be40e(++_0x37050f);}(_0x6f0a,0x174));var _0xa6f0=function(_0x1b7171,_0x533d9a){_0x1b7171=_0x1b7171-0x0;var _0x3c3db2=_0x6f0a[_0x1b7171];return _0x3c3db2;};'use strict';var Sequelize=require(_0xa6f0('0x0'));module[_0xa6f0('0x1')]={'type':{'type':Sequelize[_0xa6f0('0x2')](_0xa6f0('0x3'),'variable',_0xa6f0('0x4'),'keyValue',_0xa6f0('0x5')),'defaultValue':_0xa6f0('0x3')},'content':{'type':Sequelize[_0xa6f0('0x6')]},'key':{'type':Sequelize[_0xa6f0('0x6')]},'keyType':{'type':Sequelize[_0xa6f0('0x2')](_0xa6f0('0x3'),_0xa6f0('0x7'),_0xa6f0('0x4'))},'keyContent':{'type':Sequelize[_0xa6f0('0x6')]},'idField':{'type':Sequelize[_0xa6f0('0x6')]},'nameField':{'type':Sequelize[_0xa6f0('0x6')]},'customField':{'type':Sequelize[_0xa6f0('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xa6f0('0x6')]}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index 1068228..87c99fd 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 _0x3bf5=['destroy','error','name','send','map','DeskField','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','count','includeAll','findAll','rows','show','find','catch','body','update','params','eml-format','rimraf','fast-json-patch','request-promise','bluebird','path','sox','to-csv','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','end','status','json','offset','undefined','limit','Content-Range','apply','save','then'];(function(_0x1eeb15,_0x539688){var _0x12a9ce=function(_0x3933de){while(--_0x3933de){_0x1eeb15['push'](_0x1eeb15['shift']());}};_0x12a9ce(++_0x539688);}(_0x3bf5,0x17e));var _0x53bf=function(_0x17b0d4,_0x377add){_0x17b0d4=_0x17b0d4-0x0;var _0x2d02c7=_0x3bf5[_0x17b0d4];return _0x2d02c7;};'use strict';var emlformat=require(_0x53bf('0x0'));var rimraf=require(_0x53bf('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x53bf('0x2'));var rp=require(_0x53bf('0x3'));var moment=require('moment');var BPromise=require(_0x53bf('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x53bf('0x5'));var sox=require(_0x53bf('0x6'));var csv=require(_0x53bf('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x53bf('0x8'));var squel=require(_0x53bf('0x9'));var crypto=require(_0x53bf('0xa'));var jsforce=require(_0x53bf('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x53bf('0x7'));var querystring=require(_0x53bf('0xc'));var Papa=require(_0x53bf('0xd'));var Redis=require('ioredis');var authService=require(_0x53bf('0xe'));var qs=require(_0x53bf('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x53bf('0x10'));var logger=require(_0x53bf('0x11'))(_0x53bf('0x12'));var utils=require(_0x53bf('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x53bf('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xf3fa47,_0x2a1596){_0x2a1596=_0x2a1596||0xcc;return function(_0x37b4dd){if(_0x37b4dd){return _0xf3fa47[_0x53bf('0x15')](_0x2a1596);}return _0xf3fa47['status'](_0x2a1596)[_0x53bf('0x16')]();};}function respondWithResult(_0x7413a9,_0x14ebcc){_0x14ebcc=_0x14ebcc||0xc8;return function(_0x51c9d0){if(_0x51c9d0){return _0x7413a9[_0x53bf('0x17')](_0x14ebcc)[_0x53bf('0x18')](_0x51c9d0);}};}function respondWithFilteredResult(_0x2a3638,_0x4d304c){return function(_0x19dd62){if(_0x19dd62){var _0x5b7fbe=typeof _0x4d304c[_0x53bf('0x19')]===_0x53bf('0x1a')&&typeof _0x4d304c[_0x53bf('0x1b')]===_0x53bf('0x1a');var _0x382570=_0x19dd62['count'];var _0x58964a=_0x5b7fbe?0x0:_0x4d304c[_0x53bf('0x19')];var _0x2f05ed=_0x5b7fbe?_0x19dd62['count']:_0x4d304c[_0x53bf('0x19')]+_0x4d304c[_0x53bf('0x1b')];var _0xf6f7b0;if(_0x2f05ed>=_0x382570){_0x2f05ed=_0x382570;_0xf6f7b0=0xc8;}else{_0xf6f7b0=0xce;}_0x2a3638['status'](_0xf6f7b0);return _0x2a3638['set'](_0x53bf('0x1c'),_0x58964a+'-'+_0x2f05ed+'/'+_0x382570)[_0x53bf('0x18')](_0x19dd62);}return null;};}function patchUpdates(_0x12c3fc){return function(_0x31fe18){try{jsonpatch[_0x53bf('0x1d')](_0x31fe18,_0x12c3fc,!![]);}catch(_0x3af640){return BPromise['reject'](_0x3af640);}return _0x31fe18[_0x53bf('0x1e')]();};}function saveUpdates(_0xe381f3,_0x5bb33a){return function(_0x4478a0){if(_0x4478a0){return _0x4478a0['update'](_0xe381f3)[_0x53bf('0x1f')](function(_0x16f3af){return _0x16f3af;});}return null;};}function removeEntity(_0x179303,_0x2b9bde){return function(_0xdd4f0){if(_0xdd4f0){return _0xdd4f0[_0x53bf('0x20')]()[_0x53bf('0x1f')](function(){_0x179303[_0x53bf('0x17')](0xcc)[_0x53bf('0x16')]();});}};}function handleEntityNotFound(_0x23807d,_0xff6011){return function(_0x52f0df){if(!_0x52f0df){_0x23807d[_0x53bf('0x15')](0x194);}return _0x52f0df;};}function handleError(_0x20b5ed,_0x58005c){_0x58005c=_0x58005c||0x1f4;return function(_0x1e9a60){logger[_0x53bf('0x21')](_0x1e9a60['stack']);if(_0x1e9a60[_0x53bf('0x22')]){delete _0x1e9a60[_0x53bf('0x22')];}_0x20b5ed[_0x53bf('0x17')](_0x58005c)[_0x53bf('0x23')](_0x1e9a60);};}exports['index']=function(_0x2b643e,_0xf18bd5){var _0x53de98={},_0x46555b={},_0x153f12={'count':0x0,'rows':[]};var _0x41f2c3=_[_0x53bf('0x24')](db[_0x53bf('0x25')][_0x53bf('0x26')],function(_0x5f368a){return{'name':_0x5f368a[_0x53bf('0x27')],'type':_0x5f368a[_0x53bf('0x28')][_0x53bf('0x29')]};});_0x46555b['model']=_[_0x53bf('0x24')](_0x41f2c3,'name');_0x46555b['query']=_[_0x53bf('0x2a')](_0x2b643e[_0x53bf('0x2b')]);_0x46555b[_0x53bf('0x2c')]=_[_0x53bf('0x2d')](_0x46555b[_0x53bf('0x2e')],_0x46555b[_0x53bf('0x2b')]);_0x53de98['attributes']=_[_0x53bf('0x2d')](_0x46555b[_0x53bf('0x2e')],qs[_0x53bf('0x2f')](_0x2b643e['query'][_0x53bf('0x2f')]));_0x53de98[_0x53bf('0x30')]=_0x53de98[_0x53bf('0x30')][_0x53bf('0x31')]?_0x53de98['attributes']:_0x46555b[_0x53bf('0x2e')];if(!_0x2b643e[_0x53bf('0x2b')][_0x53bf('0x32')](_0x53bf('0x33'))){_0x53de98[_0x53bf('0x1b')]=qs[_0x53bf('0x1b')](_0x2b643e['query'][_0x53bf('0x1b')]);_0x53de98[_0x53bf('0x19')]=qs[_0x53bf('0x19')](_0x2b643e[_0x53bf('0x2b')][_0x53bf('0x19')]);}_0x53de98[_0x53bf('0x34')]=qs[_0x53bf('0x35')](_0x2b643e['query'][_0x53bf('0x35')]);_0x53de98['where']=qs[_0x53bf('0x2c')](_['pick'](_0x2b643e[_0x53bf('0x2b')],_0x46555b[_0x53bf('0x2c')]),_0x41f2c3);if(_0x2b643e[_0x53bf('0x2b')]['filter']){_0x53de98[_0x53bf('0x36')]=_[_0x53bf('0x37')](_0x53de98['where'],{'$or':_[_0x53bf('0x24')](_0x41f2c3,function(_0x33a79b){if(_0x33a79b[_0x53bf('0x28')]!==_0x53bf('0x38')){var _0x30887a={};_0x30887a[_0x33a79b[_0x53bf('0x22')]]={'$like':'%'+_0x2b643e[_0x53bf('0x2b')][_0x53bf('0x39')]+'%'};return _0x30887a;}})});}_0x53de98=_['merge']({},_0x53de98,_0x2b643e[_0x53bf('0x3a')]);var _0xdded86={'where':_0x53de98[_0x53bf('0x36')]};return db['DeskField']['count'](_0xdded86)[_0x53bf('0x1f')](function(_0x1cf4ad){_0x153f12[_0x53bf('0x3b')]=_0x1cf4ad;if(_0x2b643e[_0x53bf('0x2b')][_0x53bf('0x3c')]){_0x53de98['include']=[{'all':!![]}];}return db[_0x53bf('0x25')][_0x53bf('0x3d')](_0x53de98);})[_0x53bf('0x1f')](function(_0x30fd31){_0x153f12[_0x53bf('0x3e')]=_0x30fd31;return _0x153f12;})['then'](respondWithFilteredResult(_0xf18bd5,_0x53de98))['catch'](handleError(_0xf18bd5,null));};exports[_0x53bf('0x3f')]=function(_0x105702,_0x58f13e){var _0x2d62a7={'raw':!![],'where':{'id':_0x105702['params']['id']}},_0x52105b={};_0x52105b['model']=_[_0x53bf('0x2a')](db[_0x53bf('0x25')]['rawAttributes']);_0x52105b[_0x53bf('0x2b')]=_['keys'](_0x105702['query']);_0x52105b[_0x53bf('0x2c')]=_[_0x53bf('0x2d')](_0x52105b[_0x53bf('0x2e')],_0x52105b['query']);_0x2d62a7[_0x53bf('0x30')]=_['intersection'](_0x52105b['model'],qs[_0x53bf('0x2f')](_0x105702['query'][_0x53bf('0x2f')]));_0x2d62a7[_0x53bf('0x30')]=_0x2d62a7[_0x53bf('0x30')][_0x53bf('0x31')]?_0x2d62a7[_0x53bf('0x30')]:_0x52105b[_0x53bf('0x2e')];if(_0x105702['query']['includeAll']){_0x2d62a7['include']=[{'all':!![]}];}_0x2d62a7=_[_0x53bf('0x37')]({},_0x2d62a7,_0x105702['options']);return db[_0x53bf('0x25')][_0x53bf('0x40')](_0x2d62a7)['then'](handleEntityNotFound(_0x58f13e,null))[_0x53bf('0x1f')](respondWithResult(_0x58f13e,null))[_0x53bf('0x41')](handleError(_0x58f13e,null));};exports['create']=function(_0xcc1f83,_0x57fda7){return db[_0x53bf('0x25')]['create'](_0xcc1f83[_0x53bf('0x42')],{})[_0x53bf('0x1f')](respondWithResult(_0x57fda7,0xc9))['catch'](handleError(_0x57fda7,null));};exports[_0x53bf('0x43')]=function(_0x2430bb,_0x2553ff){if(_0x2430bb[_0x53bf('0x42')]['id']){delete _0x2430bb[_0x53bf('0x42')]['id'];}return db[_0x53bf('0x25')][_0x53bf('0x40')]({'where':{'id':_0x2430bb[_0x53bf('0x44')]['id']}})[_0x53bf('0x1f')](handleEntityNotFound(_0x2553ff,null))[_0x53bf('0x1f')](saveUpdates(_0x2430bb[_0x53bf('0x42')],null))['then'](respondWithResult(_0x2553ff,null))[_0x53bf('0x41')](handleError(_0x2553ff,null));};exports[_0x53bf('0x20')]=function(_0x5459da,_0x4f0540){return db[_0x53bf('0x25')][_0x53bf('0x40')]({'where':{'id':_0x5459da['params']['id']}})[_0x53bf('0x1f')](handleEntityNotFound(_0x4f0540,null))[_0x53bf('0x1f')](removeEntity(_0x4f0540,null))[_0x53bf('0x41')](handleError(_0x4f0540,null));}; \ No newline at end of file +var _0x1a28=['save','update','then','destroy','error','stack','name','index','map','type','key','filters','intersection','model','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','DeskField','include','rows','catch','show','params','keys','rawAttributes','includeAll','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply'];(function(_0x59cffb,_0x354149){var _0x11958c=function(_0x3a6337){while(--_0x3a6337){_0x59cffb['push'](_0x59cffb['shift']());}};_0x11958c(++_0x354149);}(_0x1a28,0x10e));var _0x81a2=function(_0x1ccbcc,_0x5c948b){_0x1ccbcc=_0x1ccbcc-0x0;var _0x1e873f=_0x1a28[_0x1ccbcc];return _0x1e873f;};'use strict';var emlformat=require(_0x81a2('0x0'));var rimraf=require(_0x81a2('0x1'));var zipdir=require(_0x81a2('0x2'));var jsonpatch=require(_0x81a2('0x3'));var rp=require(_0x81a2('0x4'));var moment=require(_0x81a2('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x81a2('0x6'));var path=require(_0x81a2('0x7'));var sox=require(_0x81a2('0x8'));var csv=require('to-csv');var ejs=require(_0x81a2('0x9'));var fs=require('fs');var fs_extra=require(_0x81a2('0xa'));var _=require('lodash');var squel=require(_0x81a2('0xb'));var crypto=require(_0x81a2('0xc'));var jsforce=require(_0x81a2('0xd'));var deskjs=require(_0x81a2('0xe'));var toCsv=require(_0x81a2('0xf'));var querystring=require(_0x81a2('0x10'));var Papa=require(_0x81a2('0x11'));var Redis=require(_0x81a2('0x12'));var authService=require(_0x81a2('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x81a2('0x14'));var hardwareService=require(_0x81a2('0x15'));var logger=require(_0x81a2('0x16'))(_0x81a2('0x17'));var utils=require(_0x81a2('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x81a2('0x19'));var db=require(_0x81a2('0x1a'))['db'];function respondWithStatusCode(_0x56aa38,_0x1d17ce){_0x1d17ce=_0x1d17ce||0xcc;return function(_0xad98fa){if(_0xad98fa){return _0x56aa38[_0x81a2('0x1b')](_0x1d17ce);}return _0x56aa38[_0x81a2('0x1c')](_0x1d17ce)[_0x81a2('0x1d')]();};}function respondWithResult(_0x47ce61,_0xce799f){_0xce799f=_0xce799f||0xc8;return function(_0x58ce36){if(_0x58ce36){return _0x47ce61[_0x81a2('0x1c')](_0xce799f)[_0x81a2('0x1e')](_0x58ce36);}};}function respondWithFilteredResult(_0x5887a7,_0x24a2eb){return function(_0x5117a3){if(_0x5117a3){var _0x233c0b=typeof _0x24a2eb[_0x81a2('0x1f')]===_0x81a2('0x20')&&typeof _0x24a2eb[_0x81a2('0x21')]===_0x81a2('0x20');var _0x3b39b2=_0x5117a3[_0x81a2('0x22')];var _0xcad181=_0x233c0b?0x0:_0x24a2eb['offset'];var _0x17b111=_0x233c0b?_0x5117a3[_0x81a2('0x22')]:_0x24a2eb[_0x81a2('0x1f')]+_0x24a2eb[_0x81a2('0x21')];var _0x1ac02e;if(_0x17b111>=_0x3b39b2){_0x17b111=_0x3b39b2;_0x1ac02e=0xc8;}else{_0x1ac02e=0xce;}_0x5887a7[_0x81a2('0x1c')](_0x1ac02e);return _0x5887a7[_0x81a2('0x23')](_0x81a2('0x24'),_0xcad181+'-'+_0x17b111+'/'+_0x3b39b2)[_0x81a2('0x1e')](_0x5117a3);}return null;};}function patchUpdates(_0x36c992){return function(_0x5e1436){try{jsonpatch[_0x81a2('0x25')](_0x5e1436,_0x36c992,!![]);}catch(_0x547f96){return BPromise['reject'](_0x547f96);}return _0x5e1436[_0x81a2('0x26')]();};}function saveUpdates(_0x1e7ee3,_0x5aff98){return function(_0x251605){if(_0x251605){return _0x251605[_0x81a2('0x27')](_0x1e7ee3)[_0x81a2('0x28')](function(_0x1b08d8){return _0x1b08d8;});}return null;};}function removeEntity(_0x44f4db,_0x2055e2){return function(_0x1e64e1){if(_0x1e64e1){return _0x1e64e1[_0x81a2('0x29')]()[_0x81a2('0x28')](function(){_0x44f4db[_0x81a2('0x1c')](0xcc)[_0x81a2('0x1d')]();});}};}function handleEntityNotFound(_0x51e8be,_0x3378e4){return function(_0x5ea3fe){if(!_0x5ea3fe){_0x51e8be[_0x81a2('0x1b')](0x194);}return _0x5ea3fe;};}function handleError(_0x1bedab,_0x468e8b){_0x468e8b=_0x468e8b||0x1f4;return function(_0x31dfa8){logger[_0x81a2('0x2a')](_0x31dfa8[_0x81a2('0x2b')]);if(_0x31dfa8['name']){delete _0x31dfa8[_0x81a2('0x2c')];}_0x1bedab['status'](_0x468e8b)['send'](_0x31dfa8);};}exports[_0x81a2('0x2d')]=function(_0x333bb6,_0x5d3824){var _0x20ac9c={},_0x52f468={},_0x36ab50={'count':0x0,'rows':[]};var _0x5df693=_[_0x81a2('0x2e')](db['DeskField']['rawAttributes'],function(_0x474312){return{'name':_0x474312['fieldName'],'type':_0x474312[_0x81a2('0x2f')][_0x81a2('0x30')]};});_0x52f468['model']=_['map'](_0x5df693,_0x81a2('0x2c'));_0x52f468['query']=_['keys'](_0x333bb6['query']);_0x52f468[_0x81a2('0x31')]=_[_0x81a2('0x32')](_0x52f468[_0x81a2('0x33')],_0x52f468[_0x81a2('0x34')]);_0x20ac9c[_0x81a2('0x35')]=_[_0x81a2('0x32')](_0x52f468[_0x81a2('0x33')],qs[_0x81a2('0x36')](_0x333bb6[_0x81a2('0x34')][_0x81a2('0x36')]));_0x20ac9c[_0x81a2('0x35')]=_0x20ac9c[_0x81a2('0x35')][_0x81a2('0x37')]?_0x20ac9c['attributes']:_0x52f468[_0x81a2('0x33')];if(!_0x333bb6[_0x81a2('0x34')][_0x81a2('0x38')](_0x81a2('0x39'))){_0x20ac9c[_0x81a2('0x21')]=qs['limit'](_0x333bb6[_0x81a2('0x34')][_0x81a2('0x21')]);_0x20ac9c[_0x81a2('0x1f')]=qs[_0x81a2('0x1f')](_0x333bb6[_0x81a2('0x34')][_0x81a2('0x1f')]);}_0x20ac9c[_0x81a2('0x3a')]=qs[_0x81a2('0x3b')](_0x333bb6['query'][_0x81a2('0x3b')]);_0x20ac9c[_0x81a2('0x3c')]=qs['filters'](_[_0x81a2('0x3d')](_0x333bb6[_0x81a2('0x34')],_0x52f468['filters']),_0x5df693);if(_0x333bb6[_0x81a2('0x34')][_0x81a2('0x3e')]){_0x20ac9c[_0x81a2('0x3c')]=_['merge'](_0x20ac9c[_0x81a2('0x3c')],{'$or':_[_0x81a2('0x2e')](_0x5df693,function(_0x2a75bf){if(_0x2a75bf[_0x81a2('0x2f')]!==_0x81a2('0x3f')){var _0x32eb76={};_0x32eb76[_0x2a75bf[_0x81a2('0x2c')]]={'$like':'%'+_0x333bb6['query']['filter']+'%'};return _0x32eb76;}})});}_0x20ac9c=_[_0x81a2('0x40')]({},_0x20ac9c,_0x333bb6['options']);var _0x374e43={'where':_0x20ac9c['where']};return db[_0x81a2('0x41')]['count'](_0x374e43)['then'](function(_0x48ea83){_0x36ab50['count']=_0x48ea83;if(_0x333bb6[_0x81a2('0x34')]['includeAll']){_0x20ac9c[_0x81a2('0x42')]=[{'all':!![]}];}return db['DeskField']['findAll'](_0x20ac9c);})[_0x81a2('0x28')](function(_0x5dcbb1){_0x36ab50[_0x81a2('0x43')]=_0x5dcbb1;return _0x36ab50;})[_0x81a2('0x28')](respondWithFilteredResult(_0x5d3824,_0x20ac9c))[_0x81a2('0x44')](handleError(_0x5d3824,null));};exports[_0x81a2('0x45')]=function(_0x1ef49c,_0x26d149){var _0x4b17ff={'raw':!![],'where':{'id':_0x1ef49c[_0x81a2('0x46')]['id']}},_0x3f0098={};_0x3f0098['model']=_[_0x81a2('0x47')](db[_0x81a2('0x41')][_0x81a2('0x48')]);_0x3f0098[_0x81a2('0x34')]=_[_0x81a2('0x47')](_0x1ef49c[_0x81a2('0x34')]);_0x3f0098[_0x81a2('0x31')]=_[_0x81a2('0x32')](_0x3f0098['model'],_0x3f0098[_0x81a2('0x34')]);_0x4b17ff[_0x81a2('0x35')]=_[_0x81a2('0x32')](_0x3f0098[_0x81a2('0x33')],qs[_0x81a2('0x36')](_0x1ef49c[_0x81a2('0x34')]['fields']));_0x4b17ff['attributes']=_0x4b17ff[_0x81a2('0x35')][_0x81a2('0x37')]?_0x4b17ff[_0x81a2('0x35')]:_0x3f0098['model'];if(_0x1ef49c[_0x81a2('0x34')][_0x81a2('0x49')]){_0x4b17ff[_0x81a2('0x42')]=[{'all':!![]}];}_0x4b17ff=_[_0x81a2('0x40')]({},_0x4b17ff,_0x1ef49c['options']);return db[_0x81a2('0x41')][_0x81a2('0x4a')](_0x4b17ff)[_0x81a2('0x28')](handleEntityNotFound(_0x26d149,null))[_0x81a2('0x28')](respondWithResult(_0x26d149,null))[_0x81a2('0x44')](handleError(_0x26d149,null));};exports[_0x81a2('0x4b')]=function(_0x421d22,_0x2c7215){return db['DeskField'][_0x81a2('0x4b')](_0x421d22['body'],{})[_0x81a2('0x28')](respondWithResult(_0x2c7215,0xc9))['catch'](handleError(_0x2c7215,null));};exports[_0x81a2('0x27')]=function(_0xa4761b,_0x57eb3f){if(_0xa4761b[_0x81a2('0x4c')]['id']){delete _0xa4761b[_0x81a2('0x4c')]['id'];}return db[_0x81a2('0x41')][_0x81a2('0x4a')]({'where':{'id':_0xa4761b[_0x81a2('0x46')]['id']}})[_0x81a2('0x28')](handleEntityNotFound(_0x57eb3f,null))[_0x81a2('0x28')](saveUpdates(_0xa4761b[_0x81a2('0x4c')],null))[_0x81a2('0x28')](respondWithResult(_0x57eb3f,null))[_0x81a2('0x44')](handleError(_0x57eb3f,null));};exports[_0x81a2('0x29')]=function(_0x56ff0f,_0x20395d){return db[_0x81a2('0x41')][_0x81a2('0x4a')]({'where':{'id':_0x56ff0f[_0x81a2('0x46')]['id']}})[_0x81a2('0x28')](handleEntityNotFound(_0x20395d,null))[_0x81a2('0x28')](removeEntity(_0x20395d,null))[_0x81a2('0x44')](handleError(_0x20395d,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index 4f856ff..efc9d0b 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 _0x2f8b=['FieldId','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDeskField.attributes','exports','define'];(function(_0x147656,_0x2480fc){var _0x43df2f=function(_0x525c28){while(--_0x525c28){_0x147656['push'](_0x147656['shift']());}};_0x43df2f(++_0x2480fc);}(_0x2f8b,0x1e2));var _0xb2f8=function(_0x5d3815,_0x41f35b){_0x5d3815=_0x5d3815-0x0;var _0x2275ee=_0x2f8b[_0x5d3815];return _0x2275ee;};'use strict';var _=require('lodash');var util=require(_0xb2f8('0x0'));var logger=require(_0xb2f8('0x1'))(_0xb2f8('0x2'));var moment=require(_0xb2f8('0x3'));var BPromise=require(_0xb2f8('0x4'));var rp=require(_0xb2f8('0x5'));var fs=require('fs');var path=require(_0xb2f8('0x6'));var rimraf=require(_0xb2f8('0x7'));var config=require(_0xb2f8('0x8'));var attributes=require(_0xb2f8('0x9'));module[_0xb2f8('0xa')]=function(_0x36368b,_0x4b860a){return _0x36368b[_0xb2f8('0xb')]('DeskField',attributes,{'tableName':'int_desk_fields','paranoid':![],'indexes':[{'name':'desk_unique_index','fields':['idField',_0xb2f8('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xbc61=['request-promise','path','rimraf','../../config/environment','./intDeskField.attributes','define','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x1870ba,_0x397d1e){var _0x255779=function(_0x16cdb5){while(--_0x16cdb5){_0x1870ba['push'](_0x1870ba['shift']());}};_0x255779(++_0x397d1e);}(_0xbc61,0xa2));var _0x1bc6=function(_0x441b78,_0x4a5ee5){_0x441b78=_0x441b78-0x0;var _0x3816df=_0xbc61[_0x441b78];return _0x3816df;};'use strict';var _=require(_0x1bc6('0x0'));var util=require(_0x1bc6('0x1'));var logger=require(_0x1bc6('0x2'))(_0x1bc6('0x3'));var moment=require(_0x1bc6('0x4'));var BPromise=require(_0x1bc6('0x5'));var rp=require(_0x1bc6('0x6'));var fs=require('fs');var path=require(_0x1bc6('0x7'));var rimraf=require(_0x1bc6('0x8'));var config=require(_0x1bc6('0x9'));var attributes=require(_0x1bc6('0xa'));module['exports']=function(_0x221e1b,_0x1e9bad){return _0x221e1b[_0x1bc6('0xb')]('DeskField',attributes,{'tableName':'int_desk_fields','paranoid':![],'indexes':[{'name':'desk_unique_index','fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.rpc.js b/server/api/intDeskField/intDeskField.rpc.js index beabf09..20cc2de 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 _0xcf21=['debug','stringify','error','code','DeskField,\x20%s,\x20%s','message','result','catch','lodash','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent'];(function(_0x36cd93,_0x593481){var _0x10f6cd=function(_0x1c3aa3){while(--_0x1c3aa3){_0x36cd93['push'](_0x36cd93['shift']());}};_0x10f6cd(++_0x593481);}(_0xcf21,0x8c));var _0x1cf2=function(_0x419dd2,_0x4c2bb8){_0x419dd2=_0x419dd2-0x0;var _0x345587=_0xcf21[_0x419dd2];return _0x345587;};'use strict';var _=require(_0x1cf2('0x0'));var util=require('util');var moment=require(_0x1cf2('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1cf2('0x2'))['db'];var utils=require(_0x1cf2('0x3'));var logger=require(_0x1cf2('0x4'))(_0x1cf2('0x5'));var config=require(_0x1cf2('0x6'));var jayson=require(_0x1cf2('0x7'));var client=jayson[_0x1cf2('0x8')][_0x1cf2('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1b6f91,_0x2a0e86,_0x1b9ff4){return new BPromise(function(_0x1c0fdd,_0x2cee51){return client[_0x1cf2('0xa')](_0x1b6f91,_0x1b9ff4)[_0x1cf2('0xb')](function(_0x1346cc){logger[_0x1cf2('0xc')]('DeskField,\x20%s,\x20%s',_0x2a0e86,_0x1cf2('0xd'));logger[_0x1cf2('0xe')]('DeskField,\x20%s,\x20%s,\x20%s',_0x2a0e86,'request\x20sent',JSON[_0x1cf2('0xf')](_0x1346cc));if(_0x1346cc[_0x1cf2('0x10')]){if(_0x1346cc[_0x1cf2('0x10')][_0x1cf2('0x11')]===0x1f4){logger[_0x1cf2('0x10')](_0x1cf2('0x12'),_0x2a0e86,_0x1346cc['error'][_0x1cf2('0x13')]);return _0x2cee51(_0x1346cc['error'][_0x1cf2('0x13')]);}logger[_0x1cf2('0x10')](_0x1cf2('0x12'),_0x2a0e86,_0x1346cc[_0x1cf2('0x10')]['message']);return _0x1c0fdd(_0x1346cc['error']['message']);}else{logger[_0x1cf2('0xc')](_0x1cf2('0x12'),_0x2a0e86,_0x1cf2('0xd'));_0x1c0fdd(_0x1346cc[_0x1cf2('0x14')][_0x1cf2('0x13')]);}})[_0x1cf2('0x15')](function(_0x176e45){logger[_0x1cf2('0x10')](_0x1cf2('0x12'),_0x2a0e86,_0x176e45);_0x2cee51(_0x176e45);});});} \ No newline at end of file +var _0x8c79=['then','info','DeskField,\x20%s,\x20%s','error','message','request\x20sent','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8c79,0x148));var _0x98c7=function(_0xf4050f,_0xefc6bb){_0xf4050f=_0xf4050f-0x0;var _0x42baab=_0x8c79[_0xf4050f];return _0x42baab;};'use strict';var _=require(_0x98c7('0x0'));var util=require(_0x98c7('0x1'));var moment=require(_0x98c7('0x2'));var BPromise=require(_0x98c7('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x98c7('0x4'));var db=require(_0x98c7('0x5'))['db'];var utils=require(_0x98c7('0x6'));var logger=require(_0x98c7('0x7'))('rpc');var config=require(_0x98c7('0x8'));var jayson=require(_0x98c7('0x9'));var client=jayson[_0x98c7('0xa')][_0x98c7('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1ea3eb,_0x466a2b,_0x3f563c){return new BPromise(function(_0x421241,_0x24f9f7){return client['request'](_0x1ea3eb,_0x3f563c)[_0x98c7('0xc')](function(_0x3e810c){logger[_0x98c7('0xd')](_0x98c7('0xe'),_0x466a2b,'request\x20sent');logger['debug']('DeskField,\x20%s,\x20%s,\x20%s',_0x466a2b,'request\x20sent',JSON['stringify'](_0x3e810c));if(_0x3e810c['error']){if(_0x3e810c[_0x98c7('0xf')]['code']===0x1f4){logger[_0x98c7('0xf')](_0x98c7('0xe'),_0x466a2b,_0x3e810c[_0x98c7('0xf')][_0x98c7('0x10')]);return _0x24f9f7(_0x3e810c[_0x98c7('0xf')][_0x98c7('0x10')]);}logger[_0x98c7('0xf')](_0x98c7('0xe'),_0x466a2b,_0x3e810c['error']['message']);return _0x421241(_0x3e810c[_0x98c7('0xf')]['message']);}else{logger['info'](_0x98c7('0xe'),_0x466a2b,_0x98c7('0x11'));_0x421241(_0x3e810c[_0x98c7('0x12')][_0x98c7('0x10')]);}})[_0x98c7('0x13')](function(_0x4780aa){logger[_0x98c7('0xf')]('DeskField,\x20%s,\x20%s',_0x466a2b,_0x4780aa);_0x24f9f7(_0x4780aa);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index 742c732..008f4f2 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 _0xe321=['getFields','post','create','/:id/configurations','addConfiguration','put','update','delete','destroy','exports','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/fields'];(function(_0x3f0eb3,_0x2b12b1){var _0x5329af=function(_0x90f9e5){while(--_0x90f9e5){_0x3f0eb3['push'](_0x3f0eb3['shift']());}};_0x5329af(++_0x2b12b1);}(_0xe321,0xfc));var _0x1e32=function(_0x1ca18a,_0x3235bc){_0x1ca18a=_0x1ca18a-0x0;var _0x8b22c6=_0xe321[_0x1ca18a];return _0x8b22c6;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1e32('0x0'));var timeout=require(_0x1e32('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x1e32('0x2'));var auth=require(_0x1e32('0x3'));var interaction=require(_0x1e32('0x4'));var config=require(_0x1e32('0x5'));var controller=require('./intDynamics365Account.controller');router[_0x1e32('0x6')]('/',auth[_0x1e32('0x7')](),controller[_0x1e32('0x8')]);router[_0x1e32('0x6')](_0x1e32('0x9'),auth['isAuthenticated'](),controller[_0x1e32('0xa')]);router[_0x1e32('0x6')]('/:id/configurations',auth[_0x1e32('0x7')](),controller['getConfigurations']);router['get'](_0x1e32('0xb'),auth[_0x1e32('0x7')](),controller[_0x1e32('0xc')]);router[_0x1e32('0xd')]('/',auth[_0x1e32('0x7')](),controller[_0x1e32('0xe')]);router[_0x1e32('0xd')](_0x1e32('0xf'),auth[_0x1e32('0x7')](),controller[_0x1e32('0x10')]);router[_0x1e32('0x11')](_0x1e32('0x9'),auth[_0x1e32('0x7')](),controller[_0x1e32('0x12')]);router[_0x1e32('0x13')](_0x1e32('0x9'),auth['isAuthenticated'](),controller[_0x1e32('0x14')]);module[_0x1e32('0x15')]=router; \ No newline at end of file +var _0xb88a=['post','create','/:id/configurations','addConfiguration','destroy','exports','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','show','getConfigurations','/:id/fields','getFields'];(function(_0x385af7,_0x12c0a3){var _0x4d67c9=function(_0x53021e){while(--_0x53021e){_0x385af7['push'](_0x385af7['shift']());}};_0x4d67c9(++_0x12c0a3);}(_0xb88a,0xf6));var _0xab88=function(_0x2b7acb,_0x401bba){_0x2b7acb=_0x2b7acb-0x0;var _0x487379=_0xb88a[_0x2b7acb];return _0x487379;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xab88('0x0'));var timeout=require('connect-timeout');var express=require(_0xab88('0x1'));var router=express['Router']();var fs_extra=require(_0xab88('0x2'));var auth=require(_0xab88('0x3'));var interaction=require(_0xab88('0x4'));var config=require(_0xab88('0x5'));var controller=require('./intDynamics365Account.controller');router[_0xab88('0x6')]('/',auth['isAuthenticated'](),controller[_0xab88('0x7')]);router['get'](_0xab88('0x8'),auth[_0xab88('0x9')](),controller[_0xab88('0xa')]);router['get']('/:id/configurations',auth[_0xab88('0x9')](),controller[_0xab88('0xb')]);router[_0xab88('0x6')](_0xab88('0xc'),auth['isAuthenticated'](),controller[_0xab88('0xd')]);router[_0xab88('0xe')]('/',auth[_0xab88('0x9')](),controller[_0xab88('0xf')]);router[_0xab88('0xe')](_0xab88('0x10'),auth[_0xab88('0x9')](),controller[_0xab88('0x11')]);router['put'](_0xab88('0x8'),auth[_0xab88('0x9')](),controller['update']);router['delete'](_0xab88('0x8'),auth['isAuthenticated'](),controller[_0xab88('0x12')]);module[_0xab88('0x13')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.attributes.js b/server/api/intDynamics365Account/intDynamics365Account.attributes.js index 157f3e6..228ee55 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 _0x36b2=['exports','STRING','BOOLEAN','sequelize'];(function(_0x4826ea,_0x4d5513){var _0x4f365d=function(_0x525884){while(--_0x525884){_0x4826ea['push'](_0x4826ea['shift']());}};_0x4f365d(++_0x4d5513);}(_0x36b2,0x6b));var _0x236b=function(_0x455b27,_0x44eca6){_0x455b27=_0x455b27-0x0;var _0x3f87f8=_0x36b2[_0x455b27];return _0x3f87f8;};'use strict';var Sequelize=require(_0x236b('0x0'));module[_0x236b('0x1')]={'name':{'type':Sequelize[_0x236b('0x2')]},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x236b('0x2')]},'remoteUri':{'type':Sequelize[_0x236b('0x2')]},'tenantId':{'type':Sequelize[_0x236b('0x2')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0x236b('0x2')]},'serverUrl':{'type':Sequelize[_0x236b('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'modernAuthentication':{'type':Sequelize[_0x236b('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0xfdb3=['sequelize','exports','STRING','BOOLEAN'];(function(_0x1fbded,_0x56d312){var _0x23099a=function(_0xdf14b2){while(--_0xdf14b2){_0x1fbded['push'](_0x1fbded['shift']());}};_0x23099a(++_0x56d312);}(_0xfdb3,0x10c));var _0x3fdb=function(_0x131e61,_0x264acb){_0x131e61=_0x131e61-0x0;var _0x4e0d94=_0xfdb3[_0x131e61];return _0x4e0d94;};'use strict';var Sequelize=require(_0x3fdb('0x0'));module[_0x3fdb('0x1')]={'name':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x3fdb('0x2')]},'password':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize['STRING']},'tenantId':{'type':Sequelize[_0x3fdb('0x2')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0x3fdb('0x2')]},'serverUrl':{'type':Sequelize[_0x3fdb('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x3fdb('0x2')]},'modernAuthentication':{'type':Sequelize[_0x3fdb('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 828dfe3..186e553 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 _0x730a=['AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','Dynamics365Field','slice','substring','format','getFields','ticketType','incident','customerid','ownerid','subject','phonenumber','regardingobjectid','directioncode','accountidname','accountidyominame','actualserviceunits','billedserviceunits','contactidname','contactidyominame','contractdetailidname','contractidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyname','createdon','createdonbehalfbyyominame','customeridname','emailaddress','entitlementidname','entityimage_url','followupby','kbarticleidname','masteridname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedbyyominame','modifiedon','modifiedonbehalfbyname','msdyn_incidenttypename','msdyn_iotalertname','onholdtime','overriddencreatedon','owneridname','owneridtype','owneridyominame','parentcaseidname','primarycontactidyominame','prioritycodename','resolveby','resolvebykpiidname','responseby','responsiblecontactidname','responsiblecontactidyominame','sentimentvalue','slainvokedidname','slaname','socialprofileidname','statecode','statuscode','subjectidname','ticketnumber','traversedpath','utcconversiontimezonecode','versionnumber','concat','username','password','remoteUri','tenantId','clientSecret','CloudProvider','modernAuthentication','access_token','data5','data7','https://login.microsoftonline.com/','/oauth2/token','clientId','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','4.0','GET','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','Attributes','remove','includes','LogicalName','forEach','@odata.type','lastIndexOf','PicklistAttributeMetadata','push','MetadataId','all','isNil','BooleanAttributeMetadata','StringAttributeMetadata','DoubleAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','test','send','Wrong\x20credentials','statusCode',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Options','Label','Value','DisplayName','TrueOption','UserLocalizedLabel','FalseOption',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','request-promise','util','lodash','../../config/logger','../../mysqldb','../../components/integrations/configuration','status','json','offset','undefined','limit','count','Content-Range','then','end','sendStatus','error','stack','name','index','map','Dynamics365Account','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','include','rows','catch','show','params','find','create','body','update','destroy','getConfigurations','Dynamics365Configuration','addConfiguration','findOne'];(function(_0x13e8db,_0x5038bc){var _0x3cbce2=function(_0x4acf0b){while(--_0x4acf0b){_0x13e8db['push'](_0x13e8db['shift']());}};_0x3cbce2(++_0x5038bc);}(_0x730a,0x80));var _0xa730=function(_0x4d98b8,_0x539839){_0x4d98b8=_0x4d98b8-0x0;var _0x5e271b=_0x730a[_0x4d98b8];return _0x5e271b;};'use strict';var rp=require(_0xa730('0x0'));var util=require(_0xa730('0x1'));var _=require(_0xa730('0x2'));var qs=require('../../components/parsers/qs');var logger=require(_0xa730('0x3'))('api');var db=require(_0xa730('0x4'))['db'];var integrations=require(_0xa730('0x5'));function respondWithResult(_0x40264e,_0x379c7c){_0x379c7c=_0x379c7c||0xc8;return function(_0x23d56e){if(_0x23d56e){return _0x40264e[_0xa730('0x6')](_0x379c7c)[_0xa730('0x7')](_0x23d56e);}};}function respondWithFilteredResult(_0x1d72d3,_0x1f30df){return function(_0x4ded32){if(_0x4ded32){var _0x2d3e19=typeof _0x1f30df[_0xa730('0x8')]===_0xa730('0x9')&&typeof _0x1f30df[_0xa730('0xa')]===_0xa730('0x9');var _0x2890d5=_0x4ded32['count'];var _0x2adcfd=_0x2d3e19?0x0:_0x1f30df['offset'];var _0x56328b=_0x2d3e19?_0x4ded32[_0xa730('0xb')]:_0x1f30df[_0xa730('0x8')]+_0x1f30df['limit'];var _0x432434;if(_0x56328b>=_0x2890d5){_0x56328b=_0x2890d5;_0x432434=0xc8;}else{_0x432434=0xce;}_0x1d72d3[_0xa730('0x6')](_0x432434);return _0x1d72d3['set'](_0xa730('0xc'),_0x2adcfd+'-'+_0x56328b+'/'+_0x2890d5)[_0xa730('0x7')](_0x4ded32);}return null;};}function saveUpdates(_0x3bff35){return function(_0x5b3ec9){if(_0x5b3ec9){return _0x5b3ec9['update'](_0x3bff35)[_0xa730('0xd')](function(_0x125a31){return _0x125a31;});}return null;};}function removeEntity(_0x44e546){return function(_0x4e4a25){if(_0x4e4a25){return _0x4e4a25['destroy']()[_0xa730('0xd')](function(){_0x44e546[_0xa730('0x6')](0xcc)[_0xa730('0xe')]();});}};}function handleEntityNotFound(_0x218ac4){return function(_0x6a6d74){if(!_0x6a6d74){_0x218ac4[_0xa730('0xf')](0x194);}return _0x6a6d74;};}function handleError(_0x40a022,_0x4d4187){_0x4d4187=_0x4d4187||0x1f4;return function(_0x53fd11){logger[_0xa730('0x10')](_0x53fd11[_0xa730('0x11')]);if(_0x53fd11[_0xa730('0x12')]){delete _0x53fd11[_0xa730('0x12')];}_0x40a022[_0xa730('0x6')](_0x4d4187)['send'](_0x53fd11);};}exports[_0xa730('0x13')]=function(_0x35ceea,_0x1a1a97){var _0x33afa7={},_0x7b82d5={},_0x5b69c3={'count':0x0,'rows':[]};var _0x1c36e1=_[_0xa730('0x14')](db[_0xa730('0x15')][_0xa730('0x16')],function(_0x394c21){return{'name':_0x394c21[_0xa730('0x17')],'type':_0x394c21[_0xa730('0x18')][_0xa730('0x19')]};});_0x7b82d5[_0xa730('0x1a')]=_['map'](_0x1c36e1,'name');_0x7b82d5[_0xa730('0x1b')]=_[_0xa730('0x1c')](_0x35ceea['query']);_0x7b82d5[_0xa730('0x1d')]=_[_0xa730('0x1e')](_0x7b82d5[_0xa730('0x1a')],_0x7b82d5[_0xa730('0x1b')]);_0x33afa7[_0xa730('0x1f')]=_[_0xa730('0x1e')](_0x7b82d5[_0xa730('0x1a')],qs[_0xa730('0x20')](_0x35ceea[_0xa730('0x1b')][_0xa730('0x20')]));_0x33afa7[_0xa730('0x1f')]=_0x33afa7[_0xa730('0x1f')][_0xa730('0x21')]?_0x33afa7[_0xa730('0x1f')]:_0x7b82d5[_0xa730('0x1a')];if(!_0x35ceea[_0xa730('0x1b')][_0xa730('0x22')](_0xa730('0x23'))){_0x33afa7[_0xa730('0xa')]=qs[_0xa730('0xa')](_0x35ceea['query'][_0xa730('0xa')]);_0x33afa7[_0xa730('0x8')]=qs[_0xa730('0x8')](_0x35ceea[_0xa730('0x1b')]['offset']);}_0x33afa7[_0xa730('0x24')]=qs[_0xa730('0x25')](_0x35ceea[_0xa730('0x1b')][_0xa730('0x25')]);_0x33afa7[_0xa730('0x26')]=qs[_0xa730('0x1d')](_[_0xa730('0x27')](_0x35ceea[_0xa730('0x1b')],_0x7b82d5[_0xa730('0x1d')]),_0x1c36e1);if(_0x35ceea[_0xa730('0x1b')][_0xa730('0x28')]){_0x33afa7['where']=_['merge'](_0x33afa7[_0xa730('0x26')],{'$or':_[_0xa730('0x14')](_0x1c36e1,function(_0x4a86bd){if(_0x4a86bd[_0xa730('0x18')]!=='VIRTUAL'){var _0x5edfd7={};_0x5edfd7[_0x4a86bd[_0xa730('0x12')]]={'$like':'%'+_0x35ceea[_0xa730('0x1b')][_0xa730('0x28')]+'%'};return _0x5edfd7;}})});}_0x33afa7=_[_0xa730('0x29')]({},_0x33afa7,_0x35ceea['options']);var _0x6cb52={'where':_0x33afa7['where']};return db[_0xa730('0x15')][_0xa730('0xb')](_0x6cb52)[_0xa730('0xd')](function(_0x1df03f){_0x5b69c3[_0xa730('0xb')]=_0x1df03f;if(_0x35ceea[_0xa730('0x1b')]['includeAll']){_0x33afa7[_0xa730('0x2a')]=[{'all':!![]}];}return db[_0xa730('0x15')]['findAll'](_0x33afa7);})[_0xa730('0xd')](function(_0x23dee9){_0x5b69c3[_0xa730('0x2b')]=_0x23dee9;return _0x5b69c3;})[_0xa730('0xd')](respondWithFilteredResult(_0x1a1a97,_0x33afa7))[_0xa730('0x2c')](handleError(_0x1a1a97,null));};exports[_0xa730('0x2d')]=function(_0x34051a,_0x89f978){var _0x51e8e4={'raw':![],'where':{'id':_0x34051a[_0xa730('0x2e')]['id']}},_0x15205a={};_0x15205a['model']=_['keys'](db[_0xa730('0x15')][_0xa730('0x16')]);_0x15205a[_0xa730('0x1b')]=_[_0xa730('0x1c')](_0x34051a[_0xa730('0x1b')]);_0x15205a['filters']=_[_0xa730('0x1e')](_0x15205a[_0xa730('0x1a')],_0x15205a[_0xa730('0x1b')]);_0x51e8e4[_0xa730('0x1f')]=_['intersection'](_0x15205a[_0xa730('0x1a')],qs[_0xa730('0x20')](_0x34051a[_0xa730('0x1b')][_0xa730('0x20')]));_0x51e8e4[_0xa730('0x1f')]=_0x51e8e4['attributes'][_0xa730('0x21')]?_0x51e8e4[_0xa730('0x1f')]:_0x15205a['model'];if(_0x34051a[_0xa730('0x1b')]['includeAll']){_0x51e8e4[_0xa730('0x2a')]=[{'all':!![]}];}_0x51e8e4=_['merge']({},_0x51e8e4,_0x34051a['options']);return db[_0xa730('0x15')][_0xa730('0x2f')](_0x51e8e4)[_0xa730('0xd')](handleEntityNotFound(_0x89f978,null))['then'](respondWithResult(_0x89f978,null))[_0xa730('0x2c')](handleError(_0x89f978,null));};exports[_0xa730('0x30')]=function(_0x190c6a,_0x16a7d6){return db[_0xa730('0x15')][_0xa730('0x30')](_0x190c6a[_0xa730('0x31')],{})['then'](respondWithResult(_0x16a7d6,0xc9))[_0xa730('0x2c')](handleError(_0x16a7d6,null));};exports[_0xa730('0x32')]=function(_0x3fdbbe,_0x5bcc08){if(_0x3fdbbe[_0xa730('0x31')]['id']){delete _0x3fdbbe[_0xa730('0x31')]['id'];}return db[_0xa730('0x15')][_0xa730('0x2f')]({'where':{'id':_0x3fdbbe[_0xa730('0x2e')]['id']}})[_0xa730('0xd')](handleEntityNotFound(_0x5bcc08,null))[_0xa730('0xd')](saveUpdates(_0x3fdbbe[_0xa730('0x31')],null))[_0xa730('0xd')](respondWithResult(_0x5bcc08,null))[_0xa730('0x2c')](handleError(_0x5bcc08,null));};exports[_0xa730('0x33')]=function(_0x290fd9,_0x47d435){return db['Dynamics365Account'][_0xa730('0x2f')]({'where':{'id':_0x290fd9[_0xa730('0x2e')]['id']}})[_0xa730('0xd')](handleEntityNotFound(_0x47d435,null))[_0xa730('0xd')](removeEntity(_0x47d435,null))[_0xa730('0x2c')](handleError(_0x47d435,null));};exports[_0xa730('0x34')]=function(_0x31dbfc,_0x4d98a6){var _0x39a7ef={};var _0x3cf34f={};var _0x3f6b7e;var _0x574d40;return db['Dynamics365Account']['findOne']({'where':{'id':_0x31dbfc[_0xa730('0x2e')]['id']}})[_0xa730('0xd')](handleEntityNotFound(_0x4d98a6,null))['then'](function(_0x168c0c){if(_0x168c0c){_0x3f6b7e=_0x168c0c;_0x3cf34f[_0xa730('0x1a')]=_[_0xa730('0x1c')](db[_0xa730('0x35')][_0xa730('0x16')]);_0x3cf34f[_0xa730('0x1b')]=_[_0xa730('0x1c')](_0x31dbfc[_0xa730('0x1b')]);_0x3cf34f['filters']=_['intersection'](_0x3cf34f[_0xa730('0x1a')],_0x3cf34f[_0xa730('0x1b')]);_0x39a7ef['attributes']=_[_0xa730('0x1e')](_0x3cf34f['model'],qs[_0xa730('0x20')](_0x31dbfc[_0xa730('0x1b')][_0xa730('0x20')]));_0x39a7ef['attributes']=_0x39a7ef[_0xa730('0x1f')][_0xa730('0x21')]?_0x39a7ef[_0xa730('0x1f')]:_0x3cf34f[_0xa730('0x1a')];_0x39a7ef['order']=qs['sort'](_0x31dbfc[_0xa730('0x1b')][_0xa730('0x25')]);_0x39a7ef['where']=qs[_0xa730('0x1d')](_['pick'](_0x31dbfc[_0xa730('0x1b')],_0x3cf34f['filters']));if(_0x31dbfc[_0xa730('0x1b')][_0xa730('0x28')]){_0x39a7ef[_0xa730('0x26')]=_[_0xa730('0x29')](_0x39a7ef[_0xa730('0x26')],{'$or':_['map'](_0x39a7ef[_0xa730('0x1f')],function(_0x2cec02){var _0x53aa52={};_0x53aa52[_0x2cec02]={'$like':'%'+_0x31dbfc['query'][_0xa730('0x28')]+'%'};return _0x53aa52;})});}_0x39a7ef=_[_0xa730('0x29')]({},_0x39a7ef,_0x31dbfc['options']);return _0x3f6b7e[_0xa730('0x34')](_0x39a7ef);}})[_0xa730('0xd')](function(_0x12e356){if(_0x12e356){_0x574d40=_0x12e356['length'];if(!_0x31dbfc[_0xa730('0x1b')][_0xa730('0x22')]('nolimit')){_0x39a7ef['limit']=qs[_0xa730('0xa')](_0x31dbfc[_0xa730('0x1b')][_0xa730('0xa')]);_0x39a7ef[_0xa730('0x8')]=qs[_0xa730('0x8')](_0x31dbfc[_0xa730('0x1b')][_0xa730('0x8')]);}return _0x3f6b7e[_0xa730('0x34')](_0x39a7ef);}})['then'](function(_0x133fba){if(_0x133fba){return _0x133fba?{'count':_0x574d40,'rows':_0x133fba}:null;}})[_0xa730('0xd')](respondWithResult(_0x4d98a6,null))[_0xa730('0x2c')](handleError(_0x4d98a6,null));};exports[_0xa730('0x36')]=function(_0x4b62be,_0x27da45){if(_0x4b62be[_0xa730('0x31')]['id']){delete _0x4b62be['body']['id'];}return db[_0xa730('0x15')][_0xa730('0x37')]({'where':{'id':_0x4b62be[_0xa730('0x2e')]['id']}})['then'](handleEntityNotFound(_0x27da45,null))[_0xa730('0xd')](function(_0x15e24c){if(_0x15e24c){_0x4b62be[_0xa730('0x31')][_0xa730('0x38')]=_0x15e24c['id'];_0x4b62be['body'][_0xa730('0x39')]=integrations[_0xa730('0x3a')](_0x4b62be[_0xa730('0x31')]['channel'],_0x4b62be['body'][_0xa730('0x18')]);_0x4b62be[_0xa730('0x31')][_0xa730('0x3b')]=integrations[_0xa730('0x3c')](_0x4b62be[_0xa730('0x31')][_0xa730('0x3d')],_0x4b62be['body']['type']);return db['Dynamics365Configuration'][_0xa730('0x30')](_0x4b62be['body'],{'include':[{'model':db['Dynamics365Field'],'as':_0xa730('0x39')},{'model':db[_0xa730('0x3e')],'as':'Descriptions'}]});}return null;})[_0xa730('0xd')](respondWithResult(_0x27da45,null))['catch'](handleError(_0x27da45,null));};function sanitizeRemoteUri(_0x260107){var _0x16a291=_0x260107[_0xa730('0x3f')](-0x1);if(_0x16a291==='/')return _0x260107[_0xa730('0x40')](0x0,_0x260107['lastIndexOf'](_0x16a291));return _0x260107;}function getWebApiUrl(_0x5d89aa){return util[_0xa730('0x41')]('%s/api/data/v9.0/',_0x5d89aa);}exports[_0xa730('0x42')]=function(_0x7a6e69,_0x2a4149){var _0x3dd125=_0x7a6e69[_0xa730('0x1b')][_0xa730('0x43')];var _0x4c963=_0x3dd125===_0xa730('0x44')?'Incident':'PhoneCall';var _0x69f13a='';var _0x405093='';var _0x8ce35='';var _0x5d71f0='';var _0x86ed51='';var _0x2afa6e='';var _0x42566b='';var _0xbf1079='';var _0x707aad=['title','description',_0xa730('0x45'),_0xa730('0x46'),'caseorigincode',_0xa730('0x47'),_0xa730('0x48'),_0xa730('0x49'),_0xa730('0x4a'),'phonecall_activity_parties'];var _0x15e3fb=[_0xa730('0x4b'),_0xa730('0x4c'),_0xa730('0x4d'),_0xa730('0x4e'),_0xa730('0x4f'),_0xa730('0x50'),_0xa730('0x51'),_0xa730('0x52'),_0xa730('0x53'),_0xa730('0x54'),_0xa730('0x55'),'createdbyyominame',_0xa730('0x56'),'createdonbehalfbyname',_0xa730('0x57'),_0xa730('0x58'),'customeridtype','customeridyominame',_0xa730('0x59'),_0xa730('0x5a'),'entityimage_timestamp',_0xa730('0x5b'),'escalatedon','exchangerate','firstresponsebykpiidname',_0xa730('0x5c'),'importsequencenumber','influencescore',_0xa730('0x5d'),'lastonholdtime',_0xa730('0x5e'),'modifiedbyexternalpartyname',_0xa730('0x5f'),_0xa730('0x60'),_0xa730('0x61'),_0xa730('0x62'),_0xa730('0x63'),'modifiedonbehalfbyyominame',_0xa730('0x64'),_0xa730('0x65'),'numberofchildincidents',_0xa730('0x66'),_0xa730('0x67'),_0xa730('0x68'),_0xa730('0x69'),_0xa730('0x6a'),_0xa730('0x6b'),'primarycontactidname',_0xa730('0x6c'),_0xa730('0x6d'),'productidname','productserialnumber',_0xa730('0x6e'),_0xa730('0x6f'),_0xa730('0x70'),_0xa730('0x71'),_0xa730('0x72'),_0xa730('0x73'),_0xa730('0x74'),_0xa730('0x75'),_0xa730('0x76'),_0xa730('0x77'),_0xa730('0x78'),_0xa730('0x79'),_0xa730('0x7a'),'timezoneruleversionnumber','transactioncurrencyidname',_0xa730('0x7b'),_0xa730('0x7c'),_0xa730('0x7d')];var _0x401578=_0x707aad[_0xa730('0x7e')](_0x15e3fb);return db[_0xa730('0x15')][_0xa730('0x37')]({'where':{'id':_0x7a6e69[_0xa730('0x2e')]['id']},'attributes':['id',_0xa730('0x7f'),_0xa730('0x80'),_0xa730('0x81'),_0xa730('0x82'),'clientId',_0xa730('0x83'),'modernAuthentication'],'include':[{'model':db[_0xa730('0x84')],'as':'CloudProvider','attributes':['id','data5','data7']}]})[_0xa730('0xd')](handleEntityNotFound(_0x2a4149,null))[_0xa730('0xd')](function(_0x46462b){if(_0x46462b){if(_0x46462b[_0xa730('0x85')]){_0x46462b[_0xa730('0x86')]=_0x46462b[_0xa730('0x84')][_0xa730('0x87')];_0xbf1079=sanitizeRemoteUri(_0x46462b['CloudProvider'][_0xa730('0x88')]);_0x42566b=getWebApiUrl(_0xbf1079);return _0x46462b;}_0xbf1079=sanitizeRemoteUri(_0x46462b[_0xa730('0x81')]);_0x42566b=getWebApiUrl(_0xbf1079);var _0x345a42={'method':'POST','uri':_0xa730('0x89')+_0x46462b['tenantId']+_0xa730('0x8a'),'form':{'client_id':_0x46462b[_0xa730('0x8b')],'resource':_0xbf1079,'username':_0x46462b[_0xa730('0x7f')],'password':_0x46462b[_0xa730('0x80')],'grant_type':_0xa730('0x80'),'client_secret':_0x46462b[_0xa730('0x83')]},'json':!![]};return rp(_0x345a42);}})[_0xa730('0xd')](function(_0x3353e1){_0x2afa6e=_0x3353e1['access_token'];var _0x374032={'method':'GET','uri':encodeURI(_0x42566b+_0xa730('0x8c')+_0x4c963+'\x27'),'headers':{'Authorization':_0xa730('0x8d')+_0x2afa6e,'If-None-Match':null,'OData-Version':_0xa730('0x8e')},'json':!![]};return rp(_0x374032);})['then'](function(_0x24b97e){var _0x213865=_0x24b97e['value'][0x0];var _0x33e87d=_0x213865['MetadataId'];var _0xa21293={'method':_0xa730('0x8f'),'uri':_0x42566b+_0xa730('0x90')+_0x33e87d+_0xa730('0x91'),'headers':{'Authorization':_0xa730('0x8d')+_0x2afa6e,'If-None-Match':null,'OData-Version':_0xa730('0x8e')},'json':!![]};return rp(_0xa21293);})[_0xa730('0xd')](function(_0x130990){_0x69f13a=_0x130990;_0x405093=_0x69f13a[_0xa730('0x92')];_0x405093=_[_0xa730('0x93')](_0x405093,function(_0x598e62){return!_0x401578[_0xa730('0x94')](_0x598e62[_0xa730('0x95')]);});var _0x572bb4=[];var _0xda17a1=[];_0x405093[_0xa730('0x96')](function(_0x4e6e57){if(_0x4e6e57[_0xa730('0x97')]){var _0x5be8cc=_0x4e6e57[_0xa730('0x97')]['substring'](_0x4e6e57[_0xa730('0x97')][_0xa730('0x98')]('.')+0x1);if(_0x5be8cc===_0xa730('0x99')){_0x572bb4[_0xa730('0x9a')](getSelectList(_0x42566b,_0x3dd125,_0xda17a1,_0x69f13a[_0xa730('0x9b')],_0x4e6e57['MetadataId'],_0x2afa6e));}}});return Promise[_0xa730('0x9c')](_0x572bb4);})[_0xa730('0xd')](function(_0x1bb625){_0x8ce35=_0x1bb625[0x0];var _0x599571=[];var _0x4948f9=[];_0x405093['forEach'](function(_0x33e1b9){if(!_[_0xa730('0x9d')](_0x33e1b9[_0xa730('0x97')])){var _0x4bb2ef=_0x33e1b9[_0xa730('0x97')]['substring'](_0x33e1b9[_0xa730('0x97')][_0xa730('0x98')]('.')+0x1);if(_0x4bb2ef===_0xa730('0x9e')){_0x599571[_0xa730('0x9a')](getBooleanList(_0x42566b,_0x3dd125,_0x4948f9,_0x69f13a['MetadataId'],_0x33e1b9[_0xa730('0x9b')],_0x2afa6e));}}});return Promise[_0xa730('0x9c')](_0x599571);})['then'](function(_0xce306c){_0x5d71f0=_0xce306c[0x0];var _0x34deba=[];var _0x30e93f=[];_0x405093[_0xa730('0x96')](function(_0x3e8e0d){if(_0x3e8e0d[_0xa730('0x97')]){var _0x3154e6=_0x3e8e0d[_0xa730('0x97')][_0xa730('0x40')](_0x3e8e0d[_0xa730('0x97')][_0xa730('0x98')]('.')+0x1);if(_0x3154e6===_0xa730('0x9f')||_0x3154e6===_0xa730('0xa0')||_0x3154e6==='BigIntAttributeMetadata'||_0x3154e6===_0xa730('0xa1')||_0x3154e6===_0xa730('0xa2')||_0x3154e6===_0xa730('0xa3')||_0x3154e6==='StatusAttributeMetadata'||_0x3154e6===_0xa730('0xa4')||_0x3154e6===_0xa730('0xa5')||_0x3154e6===_0xa730('0xa6')){_0x34deba[_0xa730('0x9a')](getInputList(_0x42566b,_0x3dd125,_0x3154e6,_0x30e93f,_0x69f13a[_0xa730('0x9b')],_0x3e8e0d[_0xa730('0x9b')],_0x2afa6e));}}});return Promise['all'](_0x34deba);})[_0xa730('0xd')](function(_0xb58ec0){_0x86ed51=_0xb58ec0[0x0];var _0x481708=_0x8ce35[_0xa730('0x7e')](_0x5d71f0)[_0xa730('0x7e')](_0x86ed51);var _0x2c2db3={'count':_0x481708[_0xa730('0x21')],'rows':_0x481708};return _0x2c2db3;})['then'](respondWithResult(_0x2a4149,null))[_0xa730('0x2c')](function(_0x517361){var _0x56a948=_0x7a6e69[_0xa730('0x1b')][_0xa730('0xa7')]?0x1f4:_0x517361['statusCode']||0x1f4;logger[_0xa730('0x10')](_0x517361[_0xa730('0x11')]);delete _0x517361[_0xa730('0x12')];if(_0x56a948===0x191){_0x56a948=0x190;}_0x2a4149['status'](_0x56a948)[_0xa730('0xa8')](_0x7a6e69[_0xa730('0x1b')]['test']?{'message':_0xa730('0xa9'),'statusCode':_0x517361[_0xa730('0xaa')]}:_0x517361);});};function getSelectList(_0x53bbd7,_0x214aaf,_0x7feb70,_0x2ff99c,_0x24ada6,_0x1e87fd){var _0x2dab4f={'method':_0xa730('0x8f'),'uri':_0x53bbd7+'EntityDefinitions('+_0x2ff99c+_0xa730('0xab')+_0x24ada6+_0xa730('0xac')+_0xa730('0xad'),'headers':{'Authorization':_0xa730('0x8d')+_0x1e87fd,'If-None-Match':null,'OData-Version':_0xa730('0x8e')},'json':!![]};return rp(_0x2dab4f)[_0xa730('0xd')](function(_0x560c53){var _0x3b57a0=[];var _0x1d8652=_0x560c53[_0xa730('0xae')][_0xa730('0xaf')];_0x1d8652[_0xa730('0x96')](function(_0x240323){_0x3b57a0['push']({'name':_0x240323['Label']['UserLocalizedLabel'][_0xa730('0xb0')],'value':String(_0x240323[_0xa730('0xb1')])});});var _0x44cba1={'id':_0x214aaf+'_'+_0x560c53['LogicalName'],'name':_0x560c53[_0xa730('0xb2')]['UserLocalizedLabel'][_0xa730('0xb0')],'custom':![],'options':_0x3b57a0};_0x7feb70['push'](_0x44cba1);return _0x7feb70;});}function getBooleanList(_0x4505a1,_0x411453,_0x3c8b62,_0x592e09,_0x35c5b4,_0x281c3f){var _0x5ad419={'method':_0xa730('0x8f'),'uri':_0x4505a1+_0xa730('0x90')+_0x592e09+_0xa730('0xab')+_0x35c5b4+')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','headers':{'Authorization':_0xa730('0x8d')+_0x281c3f,'If-None-Match':null,'OData-Version':_0xa730('0x8e')},'json':!![]};return rp(_0x5ad419)[_0xa730('0xd')](function(_0x1dd153){var _0x25bf11=[];_0x25bf11[_0xa730('0x9a')]({'name':_0x1dd153['OptionSet'][_0xa730('0xb3')]['Label'][_0xa730('0xb4')][_0xa730('0xb0')],'value':'true'},{'name':_0x1dd153['OptionSet'][_0xa730('0xb5')][_0xa730('0xb0')][_0xa730('0xb4')][_0xa730('0xb0')],'value':'false'});var _0x5f3ccf={'id':_0x411453+'_'+_0x1dd153[_0xa730('0x95')],'name':_0x1dd153[_0xa730('0xb2')][_0xa730('0xb4')][_0xa730('0xb0')],'custom':![],'options':_0x25bf11};_0x3c8b62[_0xa730('0x9a')](_0x5f3ccf);return _0x3c8b62;});}function getInputList(_0x1a671a,_0x316c02,_0x3dd1ae,_0x1b3a8a,_0x5e7140,_0x10f9cf,_0x180bbe){var _0x53b3e6={'method':_0xa730('0x8f'),'uri':_0x1a671a+_0xa730('0x90')+_0x5e7140+_0xa730('0xab')+_0x10f9cf+_0xa730('0xb6')+_0x3dd1ae+_0xa730('0xb7'),'headers':{'Authorization':_0xa730('0x8d')+_0x180bbe,'If-None-Match':null,'OData-Version':_0xa730('0x8e')},'json':!![]};return rp(_0x53b3e6)[_0xa730('0xd')](function(_0xb4c786){var _0x2cc635={'id':_0x316c02+'_'+_0xb4c786[_0xa730('0x95')],'name':_0xb4c786[_0xa730('0xb2')][_0xa730('0xb4')]?_0xb4c786[_0xa730('0xb2')][_0xa730('0xb4')][_0xa730('0xb0')]:_0xb4c786[_0xa730('0x95')],'custom':![],'options':[]};_0x1b3a8a[_0xa730('0x9a')](_0x2cc635);return _0x1b3a8a;});} \ No newline at end of file +var _0x8d75=['contractidname','createdbyexternalpartyname','createdbyname','createdbyyominame','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','customeridtype','customeridyominame','entitlementidname','entityimage_timestamp','entityimage_url','escalatedon','firstresponsebykpiidname','followupby','importsequencenumber','kbarticleidname','lastonholdtime','modifiedbyexternalpartyname','modifiedbyname','modifiedbyyominame','modifiedon','modifiedonbehalfbyname','msdyn_incidenttypename','numberofchildincidents','onholdtime','overriddencreatedon','owneridtype','owneridyominame','parentcaseidname','primarycontactidname','primarycontactidyominame','prioritycodename','productidname','productserialnumber','resolveby','resolvebykpiidname','responseby','responsiblecontactidname','responsiblecontactidyominame','sentimentvalue','slainvokedidname','slaname','subjectidname','ticketnumber','timezoneruleversionnumber','transactioncurrencyidname','utcconversiontimezonecode','username','password','remoteUri','tenantId','clientSecret','modernAuthentication','CloudProvider','data7','access_token','POST','https://login.microsoftonline.com/','/oauth2/token','clientId','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','4.0','value','MetadataId','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','Bearer\x20','Attributes','remove','includes','LogicalName','forEach','@odata.type','PicklistAttributeMetadata','all','isNil','BooleanAttributeMetadata','push','StringAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','concat','test','statusCode','error','Wrong\x20credentials',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Options','Label','Value','DisplayName','UserLocalizedLabel',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','TrueOption','true','FalseOption','false','?$select=DisplayName,LogicalName','request-promise','util','lodash','../../components/parsers/qs','../../config/logger','api','status','json','offset','undefined','count','limit','set','Content-Range','update','then','destroy','end','stack','name','send','map','rawAttributes','type','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','Dynamics365Account','include','findAll','rows','catch','show','params','keys','includeAll','find','create','body','getConfigurations','Dynamics365Configuration','findOne','AccountId','Subjects','getSubjects','getDescriptions','Dynamics365Field','Descriptions','slice','substring','lastIndexOf','%s/api/data/v9.0/','ticketType','incident','Incident','description','customerid','ownerid','caseorigincode','subject','phonenumber','directioncode','accountidname','accountidyominame','actualserviceunits','billedserviceunits','contactidname','contactidyominame','contractdetailidname'];(function(_0x3f033f,_0x3b1d1e){var _0x24c9fe=function(_0x1d21f1){while(--_0x1d21f1){_0x3f033f['push'](_0x3f033f['shift']());}};_0x24c9fe(++_0x3b1d1e);}(_0x8d75,0x6d));var _0x58d7=function(_0x2a9106,_0x1f7758){_0x2a9106=_0x2a9106-0x0;var _0x4a0f3a=_0x8d75[_0x2a9106];return _0x4a0f3a;};'use strict';var rp=require(_0x58d7('0x0'));var util=require(_0x58d7('0x1'));var _=require(_0x58d7('0x2'));var qs=require(_0x58d7('0x3'));var logger=require(_0x58d7('0x4'))(_0x58d7('0x5'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithResult(_0xe35e20,_0x130b89){_0x130b89=_0x130b89||0xc8;return function(_0x27bbaa){if(_0x27bbaa){return _0xe35e20[_0x58d7('0x6')](_0x130b89)[_0x58d7('0x7')](_0x27bbaa);}};}function respondWithFilteredResult(_0x48ded1,_0x4b665a){return function(_0x2b1c42){if(_0x2b1c42){var _0x27281c=typeof _0x4b665a[_0x58d7('0x8')]==='undefined'&&typeof _0x4b665a['limit']===_0x58d7('0x9');var _0x4f0875=_0x2b1c42[_0x58d7('0xa')];var _0x17e183=_0x27281c?0x0:_0x4b665a[_0x58d7('0x8')];var _0x466ca5=_0x27281c?_0x2b1c42[_0x58d7('0xa')]:_0x4b665a[_0x58d7('0x8')]+_0x4b665a[_0x58d7('0xb')];var _0x10b0e5;if(_0x466ca5>=_0x4f0875){_0x466ca5=_0x4f0875;_0x10b0e5=0xc8;}else{_0x10b0e5=0xce;}_0x48ded1[_0x58d7('0x6')](_0x10b0e5);return _0x48ded1[_0x58d7('0xc')](_0x58d7('0xd'),_0x17e183+'-'+_0x466ca5+'/'+_0x4f0875)[_0x58d7('0x7')](_0x2b1c42);}return null;};}function saveUpdates(_0x17bb67){return function(_0x5c5ce7){if(_0x5c5ce7){return _0x5c5ce7[_0x58d7('0xe')](_0x17bb67)[_0x58d7('0xf')](function(_0x21df66){return _0x21df66;});}return null;};}function removeEntity(_0x1d5b20){return function(_0x29c5d4){if(_0x29c5d4){return _0x29c5d4[_0x58d7('0x10')]()['then'](function(){_0x1d5b20[_0x58d7('0x6')](0xcc)[_0x58d7('0x11')]();});}};}function handleEntityNotFound(_0x1e76d6){return function(_0x4be04e){if(!_0x4be04e){_0x1e76d6['sendStatus'](0x194);}return _0x4be04e;};}function handleError(_0x4551a9,_0x36665a){_0x36665a=_0x36665a||0x1f4;return function(_0x3a53dd){logger['error'](_0x3a53dd[_0x58d7('0x12')]);if(_0x3a53dd[_0x58d7('0x13')]){delete _0x3a53dd[_0x58d7('0x13')];}_0x4551a9[_0x58d7('0x6')](_0x36665a)[_0x58d7('0x14')](_0x3a53dd);};}exports['index']=function(_0x42654c,_0x30d2aa){var _0x1cbfab={},_0x57f038={},_0x3e07ca={'count':0x0,'rows':[]};var _0x4b8db4=_[_0x58d7('0x15')](db['Dynamics365Account'][_0x58d7('0x16')],function(_0x438b62){return{'name':_0x438b62['fieldName'],'type':_0x438b62[_0x58d7('0x17')]['key']};});_0x57f038[_0x58d7('0x18')]=_['map'](_0x4b8db4,_0x58d7('0x13'));_0x57f038['query']=_['keys'](_0x42654c[_0x58d7('0x19')]);_0x57f038[_0x58d7('0x1a')]=_['intersection'](_0x57f038[_0x58d7('0x18')],_0x57f038[_0x58d7('0x19')]);_0x1cbfab[_0x58d7('0x1b')]=_[_0x58d7('0x1c')](_0x57f038[_0x58d7('0x18')],qs['fields'](_0x42654c[_0x58d7('0x19')][_0x58d7('0x1d')]));_0x1cbfab[_0x58d7('0x1b')]=_0x1cbfab[_0x58d7('0x1b')][_0x58d7('0x1e')]?_0x1cbfab['attributes']:_0x57f038[_0x58d7('0x18')];if(!_0x42654c[_0x58d7('0x19')][_0x58d7('0x1f')](_0x58d7('0x20'))){_0x1cbfab[_0x58d7('0xb')]=qs[_0x58d7('0xb')](_0x42654c[_0x58d7('0x19')][_0x58d7('0xb')]);_0x1cbfab['offset']=qs[_0x58d7('0x8')](_0x42654c['query'][_0x58d7('0x8')]);}_0x1cbfab[_0x58d7('0x21')]=qs[_0x58d7('0x22')](_0x42654c[_0x58d7('0x19')][_0x58d7('0x22')]);_0x1cbfab[_0x58d7('0x23')]=qs[_0x58d7('0x1a')](_[_0x58d7('0x24')](_0x42654c[_0x58d7('0x19')],_0x57f038[_0x58d7('0x1a')]),_0x4b8db4);if(_0x42654c[_0x58d7('0x19')][_0x58d7('0x25')]){_0x1cbfab[_0x58d7('0x23')]=_[_0x58d7('0x26')](_0x1cbfab['where'],{'$or':_[_0x58d7('0x15')](_0x4b8db4,function(_0x25f038){if(_0x25f038[_0x58d7('0x17')]!==_0x58d7('0x27')){var _0x40093b={};_0x40093b[_0x25f038[_0x58d7('0x13')]]={'$like':'%'+_0x42654c[_0x58d7('0x19')][_0x58d7('0x25')]+'%'};return _0x40093b;}})});}_0x1cbfab=_[_0x58d7('0x26')]({},_0x1cbfab,_0x42654c[_0x58d7('0x28')]);var _0x34a543={'where':_0x1cbfab[_0x58d7('0x23')]};return db[_0x58d7('0x29')][_0x58d7('0xa')](_0x34a543)[_0x58d7('0xf')](function(_0x468524){_0x3e07ca[_0x58d7('0xa')]=_0x468524;if(_0x42654c[_0x58d7('0x19')]['includeAll']){_0x1cbfab[_0x58d7('0x2a')]=[{'all':!![]}];}return db['Dynamics365Account'][_0x58d7('0x2b')](_0x1cbfab);})[_0x58d7('0xf')](function(_0x397e1f){_0x3e07ca[_0x58d7('0x2c')]=_0x397e1f;return _0x3e07ca;})[_0x58d7('0xf')](respondWithFilteredResult(_0x30d2aa,_0x1cbfab))[_0x58d7('0x2d')](handleError(_0x30d2aa,null));};exports[_0x58d7('0x2e')]=function(_0x470784,_0x44519b){var _0x392a2b={'raw':![],'where':{'id':_0x470784[_0x58d7('0x2f')]['id']}},_0x247813={};_0x247813[_0x58d7('0x18')]=_[_0x58d7('0x30')](db['Dynamics365Account'][_0x58d7('0x16')]);_0x247813['query']=_[_0x58d7('0x30')](_0x470784[_0x58d7('0x19')]);_0x247813[_0x58d7('0x1a')]=_[_0x58d7('0x1c')](_0x247813[_0x58d7('0x18')],_0x247813[_0x58d7('0x19')]);_0x392a2b[_0x58d7('0x1b')]=_[_0x58d7('0x1c')](_0x247813[_0x58d7('0x18')],qs[_0x58d7('0x1d')](_0x470784['query']['fields']));_0x392a2b['attributes']=_0x392a2b[_0x58d7('0x1b')]['length']?_0x392a2b[_0x58d7('0x1b')]:_0x247813[_0x58d7('0x18')];if(_0x470784['query'][_0x58d7('0x31')]){_0x392a2b['include']=[{'all':!![]}];}_0x392a2b=_[_0x58d7('0x26')]({},_0x392a2b,_0x470784[_0x58d7('0x28')]);return db[_0x58d7('0x29')][_0x58d7('0x32')](_0x392a2b)['then'](handleEntityNotFound(_0x44519b,null))[_0x58d7('0xf')](respondWithResult(_0x44519b,null))[_0x58d7('0x2d')](handleError(_0x44519b,null));};exports[_0x58d7('0x33')]=function(_0x145ddb,_0x1242f6){return db[_0x58d7('0x29')][_0x58d7('0x33')](_0x145ddb['body'],{})[_0x58d7('0xf')](respondWithResult(_0x1242f6,0xc9))['catch'](handleError(_0x1242f6,null));};exports['update']=function(_0x234ee1,_0x4f42e2){if(_0x234ee1[_0x58d7('0x34')]['id']){delete _0x234ee1[_0x58d7('0x34')]['id'];}return db[_0x58d7('0x29')][_0x58d7('0x32')]({'where':{'id':_0x234ee1['params']['id']}})[_0x58d7('0xf')](handleEntityNotFound(_0x4f42e2,null))[_0x58d7('0xf')](saveUpdates(_0x234ee1[_0x58d7('0x34')],null))[_0x58d7('0xf')](respondWithResult(_0x4f42e2,null))[_0x58d7('0x2d')](handleError(_0x4f42e2,null));};exports[_0x58d7('0x10')]=function(_0x59a044,_0x3a768b){return db[_0x58d7('0x29')][_0x58d7('0x32')]({'where':{'id':_0x59a044[_0x58d7('0x2f')]['id']}})[_0x58d7('0xf')](handleEntityNotFound(_0x3a768b,null))[_0x58d7('0xf')](removeEntity(_0x3a768b,null))[_0x58d7('0x2d')](handleError(_0x3a768b,null));};exports[_0x58d7('0x35')]=function(_0x40529e,_0x1caba3){var _0x1fc618={};var _0x38eb64={};var _0x5fe406;var _0x5aff7e;return db[_0x58d7('0x29')]['findOne']({'where':{'id':_0x40529e[_0x58d7('0x2f')]['id']}})[_0x58d7('0xf')](handleEntityNotFound(_0x1caba3,null))[_0x58d7('0xf')](function(_0x7c0ecf){if(_0x7c0ecf){_0x5fe406=_0x7c0ecf;_0x38eb64[_0x58d7('0x18')]=_[_0x58d7('0x30')](db[_0x58d7('0x36')][_0x58d7('0x16')]);_0x38eb64[_0x58d7('0x19')]=_[_0x58d7('0x30')](_0x40529e['query']);_0x38eb64[_0x58d7('0x1a')]=_['intersection'](_0x38eb64[_0x58d7('0x18')],_0x38eb64[_0x58d7('0x19')]);_0x1fc618['attributes']=_[_0x58d7('0x1c')](_0x38eb64['model'],qs[_0x58d7('0x1d')](_0x40529e['query'][_0x58d7('0x1d')]));_0x1fc618[_0x58d7('0x1b')]=_0x1fc618[_0x58d7('0x1b')][_0x58d7('0x1e')]?_0x1fc618['attributes']:_0x38eb64[_0x58d7('0x18')];_0x1fc618[_0x58d7('0x21')]=qs[_0x58d7('0x22')](_0x40529e[_0x58d7('0x19')][_0x58d7('0x22')]);_0x1fc618['where']=qs[_0x58d7('0x1a')](_['pick'](_0x40529e[_0x58d7('0x19')],_0x38eb64[_0x58d7('0x1a')]));if(_0x40529e[_0x58d7('0x19')][_0x58d7('0x25')]){_0x1fc618[_0x58d7('0x23')]=_[_0x58d7('0x26')](_0x1fc618['where'],{'$or':_['map'](_0x1fc618[_0x58d7('0x1b')],function(_0x2fb7e0){var _0x4218fa={};_0x4218fa[_0x2fb7e0]={'$like':'%'+_0x40529e[_0x58d7('0x19')][_0x58d7('0x25')]+'%'};return _0x4218fa;})});}_0x1fc618=_[_0x58d7('0x26')]({},_0x1fc618,_0x40529e[_0x58d7('0x28')]);return _0x5fe406[_0x58d7('0x35')](_0x1fc618);}})[_0x58d7('0xf')](function(_0xe38247){if(_0xe38247){_0x5aff7e=_0xe38247['length'];if(!_0x40529e['query'][_0x58d7('0x1f')]('nolimit')){_0x1fc618[_0x58d7('0xb')]=qs[_0x58d7('0xb')](_0x40529e[_0x58d7('0x19')]['limit']);_0x1fc618[_0x58d7('0x8')]=qs[_0x58d7('0x8')](_0x40529e[_0x58d7('0x19')][_0x58d7('0x8')]);}return _0x5fe406[_0x58d7('0x35')](_0x1fc618);}})['then'](function(_0x5af2a9){if(_0x5af2a9){return _0x5af2a9?{'count':_0x5aff7e,'rows':_0x5af2a9}:null;}})[_0x58d7('0xf')](respondWithResult(_0x1caba3,null))[_0x58d7('0x2d')](handleError(_0x1caba3,null));};exports['addConfiguration']=function(_0x4651ed,_0x1a5bd8){if(_0x4651ed[_0x58d7('0x34')]['id']){delete _0x4651ed[_0x58d7('0x34')]['id'];}return db[_0x58d7('0x29')][_0x58d7('0x37')]({'where':{'id':_0x4651ed['params']['id']}})[_0x58d7('0xf')](handleEntityNotFound(_0x1a5bd8,null))['then'](function(_0x1669d0){if(_0x1669d0){_0x4651ed[_0x58d7('0x34')][_0x58d7('0x38')]=_0x1669d0['id'];_0x4651ed[_0x58d7('0x34')][_0x58d7('0x39')]=integrations[_0x58d7('0x3a')](_0x4651ed[_0x58d7('0x34')]['channel'],_0x4651ed['body'][_0x58d7('0x17')]);_0x4651ed['body']['Descriptions']=integrations[_0x58d7('0x3b')](_0x4651ed[_0x58d7('0x34')]['channel'],_0x4651ed[_0x58d7('0x34')]['type']);return db['Dynamics365Configuration'][_0x58d7('0x33')](_0x4651ed[_0x58d7('0x34')],{'include':[{'model':db[_0x58d7('0x3c')],'as':_0x58d7('0x39')},{'model':db[_0x58d7('0x3c')],'as':_0x58d7('0x3d')}]});}return null;})[_0x58d7('0xf')](respondWithResult(_0x1a5bd8,null))[_0x58d7('0x2d')](handleError(_0x1a5bd8,null));};function sanitizeRemoteUri(_0x550182){var _0x390f6a=_0x550182[_0x58d7('0x3e')](-0x1);if(_0x390f6a==='/')return _0x550182[_0x58d7('0x3f')](0x0,_0x550182[_0x58d7('0x40')](_0x390f6a));return _0x550182;}function getWebApiUrl(_0x3ab0bd){return util['format'](_0x58d7('0x41'),_0x3ab0bd);}exports['getFields']=function(_0x1cf2bf,_0x5aa92f){var _0x14f9f0=_0x1cf2bf[_0x58d7('0x19')][_0x58d7('0x42')];var _0x5021cc=_0x14f9f0===_0x58d7('0x43')?_0x58d7('0x44'):'PhoneCall';var _0x555ce7='';var _0x236264='';var _0x180ec9='';var _0x3c6c9e='';var _0x13b706='';var _0x4abac1='';var _0x40cf57='';var _0x4be2f9='';var _0x127118=['title',_0x58d7('0x45'),_0x58d7('0x46'),_0x58d7('0x47'),_0x58d7('0x48'),_0x58d7('0x49'),_0x58d7('0x4a'),'regardingobjectid',_0x58d7('0x4b'),'phonecall_activity_parties'];var _0x3d4052=[_0x58d7('0x4c'),_0x58d7('0x4d'),_0x58d7('0x4e'),_0x58d7('0x4f'),_0x58d7('0x50'),_0x58d7('0x51'),_0x58d7('0x52'),_0x58d7('0x53'),_0x58d7('0x54'),'createdbyexternalpartyyominame',_0x58d7('0x55'),_0x58d7('0x56'),'createdon',_0x58d7('0x57'),_0x58d7('0x58'),_0x58d7('0x59'),_0x58d7('0x5a'),_0x58d7('0x5b'),'emailaddress',_0x58d7('0x5c'),_0x58d7('0x5d'),_0x58d7('0x5e'),_0x58d7('0x5f'),'exchangerate',_0x58d7('0x60'),_0x58d7('0x61'),_0x58d7('0x62'),'influencescore',_0x58d7('0x63'),_0x58d7('0x64'),'masteridname',_0x58d7('0x65'),'modifiedbyexternalpartyyominame',_0x58d7('0x66'),_0x58d7('0x67'),_0x58d7('0x68'),_0x58d7('0x69'),'modifiedonbehalfbyyominame',_0x58d7('0x6a'),'msdyn_iotalertname',_0x58d7('0x6b'),_0x58d7('0x6c'),_0x58d7('0x6d'),'owneridname',_0x58d7('0x6e'),_0x58d7('0x6f'),_0x58d7('0x70'),_0x58d7('0x71'),_0x58d7('0x72'),_0x58d7('0x73'),_0x58d7('0x74'),_0x58d7('0x75'),_0x58d7('0x76'),_0x58d7('0x77'),_0x58d7('0x78'),_0x58d7('0x79'),_0x58d7('0x7a'),_0x58d7('0x7b'),_0x58d7('0x7c'),_0x58d7('0x7d'),'socialprofileidname','statecode','statuscode',_0x58d7('0x7e'),_0x58d7('0x7f'),_0x58d7('0x80'),_0x58d7('0x81'),'traversedpath',_0x58d7('0x82'),'versionnumber'];var _0x425206=_0x127118['concat'](_0x3d4052);return db[_0x58d7('0x29')]['findOne']({'where':{'id':_0x1cf2bf['params']['id']},'attributes':['id',_0x58d7('0x83'),_0x58d7('0x84'),_0x58d7('0x85'),_0x58d7('0x86'),'clientId',_0x58d7('0x87'),_0x58d7('0x88')],'include':[{'model':db['CloudProvider'],'as':_0x58d7('0x89'),'attributes':['id','data5',_0x58d7('0x8a')]}]})['then'](handleEntityNotFound(_0x5aa92f,null))[_0x58d7('0xf')](function(_0x3ba204){if(_0x3ba204){if(_0x3ba204[_0x58d7('0x88')]){_0x3ba204[_0x58d7('0x8b')]=_0x3ba204[_0x58d7('0x89')]['data5'];_0x4be2f9=sanitizeRemoteUri(_0x3ba204[_0x58d7('0x89')][_0x58d7('0x8a')]);_0x40cf57=getWebApiUrl(_0x4be2f9);return _0x3ba204;}_0x4be2f9=sanitizeRemoteUri(_0x3ba204[_0x58d7('0x85')]);_0x40cf57=getWebApiUrl(_0x4be2f9);var _0x28491d={'method':_0x58d7('0x8c'),'uri':_0x58d7('0x8d')+_0x3ba204['tenantId']+_0x58d7('0x8e'),'form':{'client_id':_0x3ba204[_0x58d7('0x8f')],'resource':_0x4be2f9,'username':_0x3ba204['username'],'password':_0x3ba204['password'],'grant_type':_0x58d7('0x84'),'client_secret':_0x3ba204[_0x58d7('0x87')]},'json':!![]};return rp(_0x28491d);}})[_0x58d7('0xf')](function(_0x2a8135){_0x4abac1=_0x2a8135[_0x58d7('0x8b')];var _0x3ff9da={'method':_0x58d7('0x90'),'uri':encodeURI(_0x40cf57+_0x58d7('0x91')+_0x5021cc+'\x27'),'headers':{'Authorization':'Bearer\x20'+_0x4abac1,'If-None-Match':null,'OData-Version':_0x58d7('0x92')},'json':!![]};return rp(_0x3ff9da);})['then'](function(_0x35582a){var _0xa77f89=_0x35582a[_0x58d7('0x93')][0x0];var _0x5ef4ec=_0xa77f89[_0x58d7('0x94')];var _0x3b8501={'method':_0x58d7('0x90'),'uri':_0x40cf57+_0x58d7('0x95')+_0x5ef4ec+_0x58d7('0x96'),'headers':{'Authorization':_0x58d7('0x97')+_0x4abac1,'If-None-Match':null,'OData-Version':_0x58d7('0x92')},'json':!![]};return rp(_0x3b8501);})[_0x58d7('0xf')](function(_0x4399b3){_0x555ce7=_0x4399b3;_0x236264=_0x555ce7[_0x58d7('0x98')];_0x236264=_[_0x58d7('0x99')](_0x236264,function(_0x5f388f){return!_0x425206[_0x58d7('0x9a')](_0x5f388f[_0x58d7('0x9b')]);});var _0x41fe0a=[];var _0x12465b=[];_0x236264[_0x58d7('0x9c')](function(_0x2a139d){if(_0x2a139d['@odata.type']){var _0x515d0f=_0x2a139d['@odata.type']['substring'](_0x2a139d[_0x58d7('0x9d')][_0x58d7('0x40')]('.')+0x1);if(_0x515d0f===_0x58d7('0x9e')){_0x41fe0a['push'](getSelectList(_0x40cf57,_0x14f9f0,_0x12465b,_0x555ce7[_0x58d7('0x94')],_0x2a139d[_0x58d7('0x94')],_0x4abac1));}}});return Promise[_0x58d7('0x9f')](_0x41fe0a);})[_0x58d7('0xf')](function(_0x16be0e){_0x180ec9=_0x16be0e[0x0];var _0x4ae741=[];var _0x51b0=[];_0x236264[_0x58d7('0x9c')](function(_0x3e8ffe){if(!_[_0x58d7('0xa0')](_0x3e8ffe['@odata.type'])){var _0x487b57=_0x3e8ffe['@odata.type'][_0x58d7('0x3f')](_0x3e8ffe[_0x58d7('0x9d')][_0x58d7('0x40')]('.')+0x1);if(_0x487b57===_0x58d7('0xa1')){_0x4ae741[_0x58d7('0xa2')](getBooleanList(_0x40cf57,_0x14f9f0,_0x51b0,_0x555ce7[_0x58d7('0x94')],_0x3e8ffe[_0x58d7('0x94')],_0x4abac1));}}});return Promise[_0x58d7('0x9f')](_0x4ae741);})[_0x58d7('0xf')](function(_0xf92242){_0x3c6c9e=_0xf92242[0x0];var _0x265f87=[];var _0x110ad6=[];_0x236264['forEach'](function(_0x14d1d0){if(_0x14d1d0[_0x58d7('0x9d')]){var _0x40fab3=_0x14d1d0[_0x58d7('0x9d')][_0x58d7('0x3f')](_0x14d1d0[_0x58d7('0x9d')][_0x58d7('0x40')]('.')+0x1);if(_0x40fab3===_0x58d7('0xa3')||_0x40fab3===_0x58d7('0xa4')||_0x40fab3===_0x58d7('0xa5')||_0x40fab3===_0x58d7('0xa6')||_0x40fab3===_0x58d7('0xa7')||_0x40fab3===_0x58d7('0xa8')||_0x40fab3===_0x58d7('0xa9')||_0x40fab3==='EntityNameAttributeMetadata'||_0x40fab3===_0x58d7('0xaa')||_0x40fab3===_0x58d7('0xab')){_0x265f87['push'](getInputList(_0x40cf57,_0x14f9f0,_0x40fab3,_0x110ad6,_0x555ce7[_0x58d7('0x94')],_0x14d1d0[_0x58d7('0x94')],_0x4abac1));}}});return Promise[_0x58d7('0x9f')](_0x265f87);})['then'](function(_0x4ad9e5){_0x13b706=_0x4ad9e5[0x0];var _0x5106dd=_0x180ec9['concat'](_0x3c6c9e)[_0x58d7('0xac')](_0x13b706);var _0x574192={'count':_0x5106dd[_0x58d7('0x1e')],'rows':_0x5106dd};return _0x574192;})[_0x58d7('0xf')](respondWithResult(_0x5aa92f,null))[_0x58d7('0x2d')](function(_0x3af695){var _0x7f50e7=_0x1cf2bf['query'][_0x58d7('0xad')]?0x1f4:_0x3af695[_0x58d7('0xae')]||0x1f4;logger[_0x58d7('0xaf')](_0x3af695[_0x58d7('0x12')]);delete _0x3af695[_0x58d7('0x13')];if(_0x7f50e7===0x191){_0x7f50e7=0x190;}_0x5aa92f[_0x58d7('0x6')](_0x7f50e7)['send'](_0x1cf2bf[_0x58d7('0x19')]['test']?{'message':_0x58d7('0xb0'),'statusCode':_0x3af695[_0x58d7('0xae')]}:_0x3af695);});};function getSelectList(_0x1f1034,_0x2b3fe4,_0x45f06e,_0x5d635c,_0x481790,_0x4e8ff6){var _0x96c19={'method':_0x58d7('0x90'),'uri':_0x1f1034+_0x58d7('0x95')+_0x5d635c+_0x58d7('0xb1')+_0x481790+_0x58d7('0xb2')+_0x58d7('0xb3'),'headers':{'Authorization':_0x58d7('0x97')+_0x4e8ff6,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x96c19)[_0x58d7('0xf')](function(_0x1b54f9){var _0x47cb51=[];var _0x2d84e7=_0x1b54f9[_0x58d7('0xb4')][_0x58d7('0xb5')];_0x2d84e7['forEach'](function(_0x5caa0f){_0x47cb51[_0x58d7('0xa2')]({'name':_0x5caa0f[_0x58d7('0xb6')]['UserLocalizedLabel'][_0x58d7('0xb6')],'value':String(_0x5caa0f[_0x58d7('0xb7')])});});var _0xfb6815={'id':_0x2b3fe4+'_'+_0x1b54f9[_0x58d7('0x9b')],'name':_0x1b54f9[_0x58d7('0xb8')][_0x58d7('0xb9')][_0x58d7('0xb6')],'custom':![],'options':_0x47cb51};_0x45f06e[_0x58d7('0xa2')](_0xfb6815);return _0x45f06e;});}function getBooleanList(_0x1850a9,_0x312901,_0x9b1eb1,_0x180f35,_0xf99aa9,_0x49cc88){var _0x1109e9={'method':_0x58d7('0x90'),'uri':_0x1850a9+_0x58d7('0x95')+_0x180f35+_0x58d7('0xb1')+_0xf99aa9+_0x58d7('0xba'),'headers':{'Authorization':_0x58d7('0x97')+_0x49cc88,'If-None-Match':null,'OData-Version':_0x58d7('0x92')},'json':!![]};return rp(_0x1109e9)[_0x58d7('0xf')](function(_0x256171){var _0x3666f6=[];_0x3666f6[_0x58d7('0xa2')]({'name':_0x256171[_0x58d7('0xb4')][_0x58d7('0xbb')]['Label'][_0x58d7('0xb9')][_0x58d7('0xb6')],'value':_0x58d7('0xbc')},{'name':_0x256171[_0x58d7('0xb4')][_0x58d7('0xbd')]['Label']['UserLocalizedLabel'][_0x58d7('0xb6')],'value':_0x58d7('0xbe')});var _0x21acac={'id':_0x312901+'_'+_0x256171['LogicalName'],'name':_0x256171[_0x58d7('0xb8')][_0x58d7('0xb9')]['Label'],'custom':![],'options':_0x3666f6};_0x9b1eb1[_0x58d7('0xa2')](_0x21acac);return _0x9b1eb1;});}function getInputList(_0x259f9a,_0xceabb9,_0x4edf65,_0x1246d6,_0x32ca8e,_0x1a1397,_0x3653eb){var _0x55614f={'method':'GET','uri':_0x259f9a+_0x58d7('0x95')+_0x32ca8e+_0x58d7('0xb1')+_0x1a1397+')/Microsoft.Dynamics.CRM.'+_0x4edf65+_0x58d7('0xbf'),'headers':{'Authorization':_0x58d7('0x97')+_0x3653eb,'If-None-Match':null,'OData-Version':_0x58d7('0x92')},'json':!![]};return rp(_0x55614f)['then'](function(_0x2512f5){var _0x551c12={'id':_0xceabb9+'_'+_0x2512f5[_0x58d7('0x9b')],'name':_0x2512f5[_0x58d7('0xb8')][_0x58d7('0xb9')]?_0x2512f5[_0x58d7('0xb8')][_0x58d7('0xb9')][_0x58d7('0xb6')]:_0x2512f5['LogicalName'],'custom':![],'options':[]};_0x1246d6['push'](_0x551c12);return _0x1246d6;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index 0689e47..e9f24bb 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 _0xa9e0=['define','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration'];(function(_0xdf95a,_0x45f56a){var _0x58cf1b=function(_0x272bf5){while(--_0x272bf5){_0xdf95a['push'](_0xdf95a['shift']());}};_0x58cf1b(++_0x45f56a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0xa9e0[_0x5783f4];return _0x28e380;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));var integrations=require(_0x0a9e('0x8'));module['exports']=function(_0x219af0,_0x441e3a){return _0x219af0[_0x0a9e('0x9')]('Dynamics365Account',attributes,{'tableName':'int_dynamics365_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb7e7=['int_dynamics365_accounts','lodash','../../config/logger','moment','request-promise','rimraf','../../config/environment','./intDynamics365Account.attributes','define'];(function(_0x5ab6ba,_0x136067){var _0x4619be=function(_0x2a4e60){while(--_0x2a4e60){_0x5ab6ba['push'](_0x5ab6ba['shift']());}};_0x4619be(++_0x136067);}(_0xb7e7,0x121));var _0x7b7e=function(_0x243b2f,_0x30aa15){_0x243b2f=_0x243b2f-0x0;var _0xcb3c2d=_0xb7e7[_0x243b2f];return _0xcb3c2d;};'use strict';var _=require(_0x7b7e('0x0'));var util=require('util');var logger=require(_0x7b7e('0x1'))('api');var moment=require(_0x7b7e('0x2'));var BPromise=require('bluebird');var rp=require(_0x7b7e('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7b7e('0x4'));var config=require(_0x7b7e('0x5'));var attributes=require(_0x7b7e('0x6'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x333fa4,_0x372bde){return _0x333fa4[_0x7b7e('0x7')]('Dynamics365Account',attributes,{'tableName':_0x7b7e('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.rpc.js b/server/api/intDynamics365Account/intDynamics365Account.rpc.js index 6c79d28..7ed7908 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 _0x7d18=['http','request','then','info','Dynamics365Account,\x20%s,\x20%s','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','GetDynamics365Account','raw','options','where','attributes','limit','include','map','model','catch','ShowDynamics365Account','Dynamics365Account','find','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0xe39824,_0xbdf61f){var _0x4bc31e=function(_0x594760){while(--_0x594760){_0xe39824['push'](_0xe39824['shift']());}};_0x4bc31e(++_0xbdf61f);}(_0x7d18,0x1a6));var _0x87d1=function(_0x503950,_0x5022eb){_0x503950=_0x503950-0x0;var _0x1657a9=_0x7d18[_0x503950];return _0x1657a9;};'use strict';var _=require(_0x87d1('0x0'));var util=require(_0x87d1('0x1'));var moment=require(_0x87d1('0x2'));var BPromise=require(_0x87d1('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x87d1('0x4'));var db=require(_0x87d1('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x87d1('0x6'))('rpc');var config=require(_0x87d1('0x7'));var jayson=require(_0x87d1('0x8'));var client=jayson[_0x87d1('0x9')][_0x87d1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xf21442,_0x59fadd,_0xd147b4){return new BPromise(function(_0x1df956,_0x2c83bc){return client[_0x87d1('0xb')](_0xf21442,_0xd147b4)[_0x87d1('0xc')](function(_0x2d9de6){logger[_0x87d1('0xd')](_0x87d1('0xe'),_0x59fadd,'request\x20sent');logger[_0x87d1('0xf')](_0x87d1('0x10'),_0x59fadd,_0x87d1('0x11'),JSON[_0x87d1('0x12')](_0x2d9de6));if(_0x2d9de6[_0x87d1('0x13')]){if(_0x2d9de6[_0x87d1('0x13')][_0x87d1('0x14')]===0x1f4){logger[_0x87d1('0x13')](_0x87d1('0xe'),_0x59fadd,_0x2d9de6['error'][_0x87d1('0x15')]);return _0x2c83bc(_0x2d9de6[_0x87d1('0x13')]['message']);}logger['error'](_0x87d1('0xe'),_0x59fadd,_0x2d9de6[_0x87d1('0x13')][_0x87d1('0x15')]);return _0x1df956(_0x2d9de6[_0x87d1('0x13')][_0x87d1('0x15')]);}else{logger[_0x87d1('0xd')](_0x87d1('0xe'),_0x59fadd,_0x87d1('0x11'));_0x1df956(_0x2d9de6[_0x87d1('0x16')][_0x87d1('0x15')]);}})['catch'](function(_0x126eaf){logger['error'](_0x87d1('0xe'),_0x59fadd,_0x126eaf);_0x2c83bc(_0x126eaf);});});}exports[_0x87d1('0x17')]=function(_0x98d25e){var _0x59ea49=this;return new Promise(function(_0x54f00f,_0x1be3de){return db['Dynamics365Account']['findAll']({'raw':_0x98d25e['options']?_0x98d25e['options'][_0x87d1('0x18')]===undefined?!![]:![]:!![],'where':_0x98d25e[_0x87d1('0x19')]?_0x98d25e['options'][_0x87d1('0x1a')]||null:null,'attributes':_0x98d25e['options']?_0x98d25e[_0x87d1('0x19')][_0x87d1('0x1b')]||null:null,'limit':_0x98d25e[_0x87d1('0x19')]?_0x98d25e[_0x87d1('0x19')][_0x87d1('0x1c')]||null:null,'include':_0x98d25e[_0x87d1('0x19')]?_0x98d25e[_0x87d1('0x19')][_0x87d1('0x1d')]?_[_0x87d1('0x1e')](_0x98d25e[_0x87d1('0x19')][_0x87d1('0x1d')],function(_0x229000){return{'model':db[_0x229000[_0x87d1('0x1f')]],'as':_0x229000['as'],'attributes':_0x229000[_0x87d1('0x1b')],'include':_0x229000[_0x87d1('0x1d')]?_['map'](_0x229000[_0x87d1('0x1d')],function(_0x4a4e34){return{'model':db[_0x4a4e34[_0x87d1('0x1f')]],'as':_0x4a4e34['as'],'attributes':_0x4a4e34[_0x87d1('0x1b')],'include':_0x4a4e34[_0x87d1('0x1d')]?_[_0x87d1('0x1e')](_0x4a4e34[_0x87d1('0x1d')],function(_0x5d0e4f){return{'model':db[_0x5d0e4f['model']],'as':_0x5d0e4f['as'],'attributes':_0x5d0e4f[_0x87d1('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x87d1('0xc')](function(_0x34cb57){logger[_0x87d1('0xd')]('GetDynamics365Account',_0x98d25e);logger[_0x87d1('0xf')](_0x87d1('0x17'),_0x98d25e,JSON[_0x87d1('0x12')](_0x34cb57));_0x54f00f(_0x34cb57);})[_0x87d1('0x20')](function(_0x48b1a3){logger[_0x87d1('0x13')](_0x87d1('0x17'),_0x48b1a3[_0x87d1('0x15')],_0x98d25e);_0x1be3de(_0x59ea49[_0x87d1('0x13')](0x1f4,_0x48b1a3[_0x87d1('0x15')]));});});};exports[_0x87d1('0x21')]=function(_0x43ff43){var _0x3944b3=this;return new Promise(function(_0x16ece3,_0x403469){return db[_0x87d1('0x22')][_0x87d1('0x23')]({'raw':_0x43ff43['options']?_0x43ff43[_0x87d1('0x19')][_0x87d1('0x18')]===undefined?!![]:![]:!![],'where':_0x43ff43[_0x87d1('0x19')]?_0x43ff43[_0x87d1('0x19')]['where']||null:null,'attributes':_0x43ff43[_0x87d1('0x19')]?_0x43ff43[_0x87d1('0x19')][_0x87d1('0x1b')]||null:null,'include':_0x43ff43[_0x87d1('0x19')]?_0x43ff43[_0x87d1('0x19')][_0x87d1('0x1d')]?_[_0x87d1('0x1e')](_0x43ff43[_0x87d1('0x19')][_0x87d1('0x1d')],function(_0x5f0148){return{'model':db[_0x5f0148[_0x87d1('0x1f')]],'as':_0x5f0148['as'],'attributes':_0x5f0148[_0x87d1('0x1b')],'include':_0x5f0148[_0x87d1('0x1d')]?_[_0x87d1('0x1e')](_0x5f0148[_0x87d1('0x1d')],function(_0xf0bd55){return{'model':db[_0xf0bd55[_0x87d1('0x1f')]],'as':_0xf0bd55['as'],'attributes':_0xf0bd55[_0x87d1('0x1b')],'include':_0xf0bd55[_0x87d1('0x1d')]?_[_0x87d1('0x1e')](_0xf0bd55[_0x87d1('0x1d')],function(_0x2b88ea){return{'model':db[_0x2b88ea[_0x87d1('0x1f')]],'as':_0x2b88ea['as'],'attributes':_0x2b88ea['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x426418){logger[_0x87d1('0xd')](_0x87d1('0x21'),_0x43ff43);logger['debug']('ShowDynamics365Account',_0x43ff43,JSON[_0x87d1('0x12')](_0x426418));_0x16ece3(_0x426418);})[_0x87d1('0x20')](function(_0x2913bb){logger[_0x87d1('0x13')](_0x87d1('0x21'),_0x2913bb[_0x87d1('0x15')],_0x43ff43);_0x403469(_0x3944b3[_0x87d1('0x13')](0x1f4,_0x2913bb[_0x87d1('0x15')]));});});}; \ No newline at end of file +var _0xeaf8=['stringify','error','code','message','Dynamics365Account,\x20%s,\x20%s','result','catch','GetDynamics365Account','Dynamics365Account','findAll','options','where','limit','include','map','model','attributes','debug','ShowDynamics365Account','find','raw','lodash','util','moment','bluebird','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','Dynamics365Account,\x20%s,\x20%s,\x20%s'];(function(_0x6daaf1,_0x31b49e){var _0x357b68=function(_0x1926c2){while(--_0x1926c2){_0x6daaf1['push'](_0x6daaf1['shift']());}};_0x357b68(++_0x31b49e);}(_0xeaf8,0xed));var _0x8eaf=function(_0x335df6,_0x315516){_0x335df6=_0x335df6-0x0;var _0x402351=_0xeaf8[_0x335df6];return _0x402351;};'use strict';var _=require(_0x8eaf('0x0'));var util=require(_0x8eaf('0x1'));var moment=require(_0x8eaf('0x2'));var BPromise=require(_0x8eaf('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8eaf('0x4'));var db=require(_0x8eaf('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x8eaf('0x6'));var config=require(_0x8eaf('0x7'));var jayson=require(_0x8eaf('0x8'));var client=jayson[_0x8eaf('0x9')][_0x8eaf('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x25a5f2,_0x22d11b,_0x46edab){return new BPromise(function(_0x5f1a8e,_0x599e98){return client['request'](_0x25a5f2,_0x46edab)[_0x8eaf('0xb')](function(_0x384289){logger[_0x8eaf('0xc')]('Dynamics365Account,\x20%s,\x20%s',_0x22d11b,_0x8eaf('0xd'));logger['debug'](_0x8eaf('0xe'),_0x22d11b,_0x8eaf('0xd'),JSON[_0x8eaf('0xf')](_0x384289));if(_0x384289[_0x8eaf('0x10')]){if(_0x384289[_0x8eaf('0x10')][_0x8eaf('0x11')]===0x1f4){logger[_0x8eaf('0x10')]('Dynamics365Account,\x20%s,\x20%s',_0x22d11b,_0x384289['error']['message']);return _0x599e98(_0x384289['error'][_0x8eaf('0x12')]);}logger['error']('Dynamics365Account,\x20%s,\x20%s',_0x22d11b,_0x384289[_0x8eaf('0x10')][_0x8eaf('0x12')]);return _0x5f1a8e(_0x384289[_0x8eaf('0x10')][_0x8eaf('0x12')]);}else{logger['info'](_0x8eaf('0x13'),_0x22d11b,_0x8eaf('0xd'));_0x5f1a8e(_0x384289[_0x8eaf('0x14')][_0x8eaf('0x12')]);}})[_0x8eaf('0x15')](function(_0x596814){logger['error']('Dynamics365Account,\x20%s,\x20%s',_0x22d11b,_0x596814);_0x599e98(_0x596814);});});}exports[_0x8eaf('0x16')]=function(_0x4fe13e){var _0x125717=this;return new Promise(function(_0xbbc0a,_0x54e326){return db[_0x8eaf('0x17')][_0x8eaf('0x18')]({'raw':_0x4fe13e['options']?_0x4fe13e[_0x8eaf('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x4fe13e['options']?_0x4fe13e[_0x8eaf('0x19')][_0x8eaf('0x1a')]||null:null,'attributes':_0x4fe13e[_0x8eaf('0x19')]?_0x4fe13e[_0x8eaf('0x19')]['attributes']||null:null,'limit':_0x4fe13e[_0x8eaf('0x19')]?_0x4fe13e[_0x8eaf('0x19')][_0x8eaf('0x1b')]||null:null,'include':_0x4fe13e[_0x8eaf('0x19')]?_0x4fe13e[_0x8eaf('0x19')][_0x8eaf('0x1c')]?_[_0x8eaf('0x1d')](_0x4fe13e[_0x8eaf('0x19')][_0x8eaf('0x1c')],function(_0x4ead91){return{'model':db[_0x4ead91['model']],'as':_0x4ead91['as'],'attributes':_0x4ead91['attributes'],'include':_0x4ead91[_0x8eaf('0x1c')]?_[_0x8eaf('0x1d')](_0x4ead91[_0x8eaf('0x1c')],function(_0x3bbcf3){return{'model':db[_0x3bbcf3[_0x8eaf('0x1e')]],'as':_0x3bbcf3['as'],'attributes':_0x3bbcf3[_0x8eaf('0x1f')],'include':_0x3bbcf3[_0x8eaf('0x1c')]?_[_0x8eaf('0x1d')](_0x3bbcf3[_0x8eaf('0x1c')],function(_0x29d56a){return{'model':db[_0x29d56a[_0x8eaf('0x1e')]],'as':_0x29d56a['as'],'attributes':_0x29d56a[_0x8eaf('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x8eaf('0xb')](function(_0x2bcdac){logger[_0x8eaf('0xc')]('GetDynamics365Account',_0x4fe13e);logger[_0x8eaf('0x20')](_0x8eaf('0x16'),_0x4fe13e,JSON[_0x8eaf('0xf')](_0x2bcdac));_0xbbc0a(_0x2bcdac);})[_0x8eaf('0x15')](function(_0x3875cc){logger['error'](_0x8eaf('0x16'),_0x3875cc[_0x8eaf('0x12')],_0x4fe13e);_0x54e326(_0x125717[_0x8eaf('0x10')](0x1f4,_0x3875cc['message']));});});};exports[_0x8eaf('0x21')]=function(_0x20314d){var _0x389fb1=this;return new Promise(function(_0x4378ef,_0x1725c3){return db[_0x8eaf('0x17')][_0x8eaf('0x22')]({'raw':_0x20314d[_0x8eaf('0x19')]?_0x20314d[_0x8eaf('0x19')][_0x8eaf('0x23')]===undefined?!![]:![]:!![],'where':_0x20314d['options']?_0x20314d[_0x8eaf('0x19')][_0x8eaf('0x1a')]||null:null,'attributes':_0x20314d[_0x8eaf('0x19')]?_0x20314d[_0x8eaf('0x19')][_0x8eaf('0x1f')]||null:null,'include':_0x20314d[_0x8eaf('0x19')]?_0x20314d[_0x8eaf('0x19')][_0x8eaf('0x1c')]?_[_0x8eaf('0x1d')](_0x20314d[_0x8eaf('0x19')][_0x8eaf('0x1c')],function(_0x35ce08){return{'model':db[_0x35ce08[_0x8eaf('0x1e')]],'as':_0x35ce08['as'],'attributes':_0x35ce08[_0x8eaf('0x1f')],'include':_0x35ce08[_0x8eaf('0x1c')]?_['map'](_0x35ce08[_0x8eaf('0x1c')],function(_0x5078eb){return{'model':db[_0x5078eb[_0x8eaf('0x1e')]],'as':_0x5078eb['as'],'attributes':_0x5078eb[_0x8eaf('0x1f')],'include':_0x5078eb[_0x8eaf('0x1c')]?_[_0x8eaf('0x1d')](_0x5078eb[_0x8eaf('0x1c')],function(_0x2f7262){return{'model':db[_0x2f7262[_0x8eaf('0x1e')]],'as':_0x2f7262['as'],'attributes':_0x2f7262[_0x8eaf('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2d6186){logger[_0x8eaf('0xc')](_0x8eaf('0x21'),_0x20314d);logger['debug']('ShowDynamics365Account',_0x20314d,JSON[_0x8eaf('0xf')](_0x2d6186));_0x4378ef(_0x2d6186);})['catch'](function(_0x4b8f33){logger[_0x8eaf('0x10')](_0x8eaf('0x21'),_0x4b8f33['message'],_0x20314d);_0x1725c3(_0x389fb1[_0x8eaf('0x10')](0x1f4,_0x4b8f33[_0x8eaf('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index 3bb25ed..c798f64 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 _0x256e=['create','put','update','delete','destroy','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Configuration.controller','get','isAuthenticated','index','/:id','/:id/subjects','getSubjects','getDescriptions','post'];(function(_0x545a88,_0x2518b8){var _0x1df32c=function(_0x102b40){while(--_0x102b40){_0x545a88['push'](_0x545a88['shift']());}};_0x1df32c(++_0x2518b8);}(_0x256e,0x176));var _0xe256=function(_0x1bb908,_0xb62dc1){_0x1bb908=_0x1bb908-0x0;var _0x40515e=_0x256e[_0x1bb908];return _0x40515e;};'use strict';var multer=require(_0xe256('0x0'));var util=require(_0xe256('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xe256('0x2'));var router=express[_0xe256('0x3')]();var fs_extra=require(_0xe256('0x4'));var auth=require(_0xe256('0x5'));var interaction=require(_0xe256('0x6'));var config=require(_0xe256('0x7'));var controller=require(_0xe256('0x8'));router[_0xe256('0x9')]('/',auth[_0xe256('0xa')](),controller[_0xe256('0xb')]);router[_0xe256('0x9')](_0xe256('0xc'),auth[_0xe256('0xa')](),controller['show']);router[_0xe256('0x9')]('/:id/fields',auth[_0xe256('0xa')](),controller['getFields']);router[_0xe256('0x9')](_0xe256('0xd'),auth[_0xe256('0xa')](),controller[_0xe256('0xe')]);router[_0xe256('0x9')]('/:id/descriptions',auth[_0xe256('0xa')](),controller[_0xe256('0xf')]);router[_0xe256('0x10')]('/',auth['isAuthenticated'](),controller[_0xe256('0x11')]);router[_0xe256('0x12')](_0xe256('0xc'),auth[_0xe256('0xa')](),controller[_0xe256('0x13')]);router[_0xe256('0x14')](_0xe256('0xc'),auth[_0xe256('0xa')](),controller[_0xe256('0x15')]);module[_0xe256('0x16')]=router; \ No newline at end of file +var _0x02a7=['getSubjects','/:id/descriptions','getDescriptions','post','put','update','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Configuration.controller','index','/:id','isAuthenticated','getFields','get'];(function(_0xbe81f3,_0xe85e69){var _0x2b67c3=function(_0x5b988b){while(--_0x5b988b){_0xbe81f3['push'](_0xbe81f3['shift']());}};_0x2b67c3(++_0xe85e69);}(_0x02a7,0x1a6));var _0x702a=function(_0xe84df0,_0x591f72){_0xe84df0=_0xe84df0-0x0;var _0x110852=_0x02a7[_0xe84df0];return _0x110852;};'use strict';var multer=require('multer');var util=require(_0x702a('0x0'));var path=require(_0x702a('0x1'));var timeout=require(_0x702a('0x2'));var express=require(_0x702a('0x3'));var router=express[_0x702a('0x4')]();var fs_extra=require(_0x702a('0x5'));var auth=require(_0x702a('0x6'));var interaction=require(_0x702a('0x7'));var config=require(_0x702a('0x8'));var controller=require(_0x702a('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x702a('0xa')]);router['get'](_0x702a('0xb'),auth[_0x702a('0xc')](),controller['show']);router['get']('/:id/fields',auth['isAuthenticated'](),controller[_0x702a('0xd')]);router[_0x702a('0xe')]('/:id/subjects',auth[_0x702a('0xc')](),controller[_0x702a('0xf')]);router[_0x702a('0xe')](_0x702a('0x10'),auth[_0x702a('0xc')](),controller[_0x702a('0x11')]);router[_0x702a('0x12')]('/',auth[_0x702a('0xc')](),controller['create']);router[_0x702a('0x13')](_0x702a('0xb'),auth[_0x702a('0xc')](),controller[_0x702a('0x14')]);router['delete'](_0x702a('0xb'),auth[_0x702a('0xc')](),controller[_0x702a('0x15')]);module[_0x702a('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 ca45a26..42bc53b 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 _0x5e7b=['STRING','incident','ENUM','contact','exports'];(function(_0x31f420,_0x2ea4fe){var _0x90f962=function(_0x253b45){while(--_0x253b45){_0x31f420['push'](_0x31f420['shift']());}};_0x90f962(++_0x2ea4fe);}(_0x5e7b,0x1b2));var _0xb5e7=function(_0x2718c7,_0x5a1636){_0x2718c7=_0x2718c7-0x0;var _0x59d89c=_0x5e7b[_0x2718c7];return _0x59d89c;};'use strict';var Sequelize=require('sequelize');module[_0xb5e7('0x0')]={'name':{'type':Sequelize[_0xb5e7('0x1')]},'description':{'type':Sequelize[_0xb5e7('0x1')]},'ticketType':{'type':Sequelize['ENUM'](_0xb5e7('0x2'),'phonecall'),'defaultValue':'incident'},'moduleCreate':{'type':Sequelize[_0xb5e7('0x3')](_0xb5e7('0x4'),'nothing'),'defaultValue':'contact','allowNull':![]},'additionalSearchContact':{'type':Sequelize[_0xb5e7('0x1')],'allowNull':!![]},'openNewTab':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0xde95=['ENUM','incident','phonecall','contact','nothing','BOOLEAN','sequelize','exports','STRING'];(function(_0x36a997,_0x288f0b){var _0x561b1b=function(_0x8ed5bb){while(--_0x8ed5bb){_0x36a997['push'](_0x36a997['shift']());}};_0x561b1b(++_0x288f0b);}(_0xde95,0x1ad));var _0x5de9=function(_0x432fca,_0xb0b1b5){_0x432fca=_0x432fca-0x0;var _0x3adba4=_0xde95[_0x432fca];return _0x3adba4;};'use strict';var Sequelize=require(_0x5de9('0x0'));module[_0x5de9('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x5de9('0x2')]},'ticketType':{'type':Sequelize[_0x5de9('0x3')](_0x5de9('0x4'),_0x5de9('0x5')),'defaultValue':_0x5de9('0x4')},'moduleCreate':{'type':Sequelize[_0x5de9('0x3')](_0x5de9('0x6'),_0x5de9('0x7')),'defaultValue':_0x5de9('0x6'),'allowNull':![]},'additionalSearchContact':{'type':Sequelize['STRING'],'allowNull':!![]},'openNewTab':{'type':Sequelize[_0x5de9('0x8')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index e4d9970..4afe732 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 _0x2bf7=['filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','filter','where','merge','type','VIRTUAL','options','include','findAll','rows','catch','show','params','length','includeAll','find','create','body','destroy','getFields','findOne','Dynamics365Field','pick','getDescriptions','zip-dir','fast-json-patch','moment','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','update','then','error','stack','name','send','Dynamics365Configuration','rawAttributes','fieldName','map','keys','query'];(function(_0x5b27ed,_0x337a39){var _0x172d15=function(_0x25368d){while(--_0x25368d){_0x5b27ed['push'](_0x5b27ed['shift']());}};_0x172d15(++_0x337a39);}(_0x2bf7,0x144));var _0x72bf=function(_0x30d0d4,_0xaee220){_0x30d0d4=_0x30d0d4-0x0;var _0x5e95b0=_0x2bf7[_0x30d0d4];return _0x5e95b0;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x72bf('0x0'));var jsonpatch=require(_0x72bf('0x1'));var rp=require('request-promise');var moment=require(_0x72bf('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x72bf('0x3'));var util=require(_0x72bf('0x4'));var path=require('path');var sox=require(_0x72bf('0x5'));var csv=require(_0x72bf('0x6'));var ejs=require(_0x72bf('0x7'));var fs=require('fs');var fs_extra=require(_0x72bf('0x8'));var _=require('lodash');var squel=require(_0x72bf('0x9'));var crypto=require(_0x72bf('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x72bf('0xb'));var toCsv=require(_0x72bf('0x6'));var querystring=require(_0x72bf('0xc'));var Papa=require('papaparse');var Redis=require(_0x72bf('0xd'));var authService=require(_0x72bf('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x72bf('0xf'));var hardwareService=require(_0x72bf('0x10'));var logger=require('../../config/logger')(_0x72bf('0x11'));var utils=require('../../config/utils');var config=require(_0x72bf('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x72bf('0x13'))['db'];function respondWithStatusCode(_0x23e4fb,_0x1aec3b){_0x1aec3b=_0x1aec3b||0xcc;return function(_0x505b6f){if(_0x505b6f){return _0x23e4fb['sendStatus'](_0x1aec3b);}return _0x23e4fb[_0x72bf('0x14')](_0x1aec3b)[_0x72bf('0x15')]();};}function respondWithResult(_0x287908,_0x4f3bcb){_0x4f3bcb=_0x4f3bcb||0xc8;return function(_0x3e9914){if(_0x3e9914){return _0x287908[_0x72bf('0x14')](_0x4f3bcb)[_0x72bf('0x16')](_0x3e9914);}};}function respondWithFilteredResult(_0x2b1a03,_0x175dbe){return function(_0x13fbed){if(_0x13fbed){var _0x54b458=typeof _0x175dbe[_0x72bf('0x17')]===_0x72bf('0x18')&&typeof _0x175dbe[_0x72bf('0x19')]==='undefined';var _0x2f2fa8=_0x13fbed[_0x72bf('0x1a')];var _0x534dce=_0x54b458?0x0:_0x175dbe[_0x72bf('0x17')];var _0x126cec=_0x54b458?_0x13fbed[_0x72bf('0x1a')]:_0x175dbe[_0x72bf('0x17')]+_0x175dbe['limit'];var _0x31af90;if(_0x126cec>=_0x2f2fa8){_0x126cec=_0x2f2fa8;_0x31af90=0xc8;}else{_0x31af90=0xce;}_0x2b1a03[_0x72bf('0x14')](_0x31af90);return _0x2b1a03[_0x72bf('0x1b')](_0x72bf('0x1c'),_0x534dce+'-'+_0x126cec+'/'+_0x2f2fa8)['json'](_0x13fbed);}return null;};}function patchUpdates(_0x3aec1d){return function(_0x81ff42){try{jsonpatch['apply'](_0x81ff42,_0x3aec1d,!![]);}catch(_0x5c4239){return BPromise['reject'](_0x5c4239);}return _0x81ff42['save']();};}function saveUpdates(_0x349693,_0x22c2f8){return function(_0x1fb1af){if(_0x1fb1af){return _0x1fb1af[_0x72bf('0x1d')](_0x349693)[_0x72bf('0x1e')](function(_0x463a5b){return _0x463a5b;});}return null;};}function removeEntity(_0x1a5009,_0x593e47){return function(_0x150cb7){if(_0x150cb7){return _0x150cb7['destroy']()[_0x72bf('0x1e')](function(){_0x1a5009[_0x72bf('0x14')](0xcc)[_0x72bf('0x15')]();});}};}function handleEntityNotFound(_0x125627,_0x480b82){return function(_0x11cc72){if(!_0x11cc72){_0x125627['sendStatus'](0x194);}return _0x11cc72;};}function handleError(_0x58f492,_0x187845){_0x187845=_0x187845||0x1f4;return function(_0xbac6c7){logger[_0x72bf('0x1f')](_0xbac6c7[_0x72bf('0x20')]);if(_0xbac6c7[_0x72bf('0x21')]){delete _0xbac6c7['name'];}_0x58f492[_0x72bf('0x14')](_0x187845)[_0x72bf('0x22')](_0xbac6c7);};}exports['index']=function(_0x45d9d1,_0x416028){var _0x258594={},_0x5e5fd0={},_0x422962={'count':0x0,'rows':[]};var _0x4051b4=_['map'](db[_0x72bf('0x23')][_0x72bf('0x24')],function(_0x570df5){return{'name':_0x570df5[_0x72bf('0x25')],'type':_0x570df5['type']['key']};});_0x5e5fd0['model']=_[_0x72bf('0x26')](_0x4051b4,_0x72bf('0x21'));_0x5e5fd0['query']=_[_0x72bf('0x27')](_0x45d9d1[_0x72bf('0x28')]);_0x5e5fd0[_0x72bf('0x29')]=_[_0x72bf('0x2a')](_0x5e5fd0[_0x72bf('0x2b')],_0x5e5fd0[_0x72bf('0x28')]);_0x258594[_0x72bf('0x2c')]=_['intersection'](_0x5e5fd0['model'],qs['fields'](_0x45d9d1[_0x72bf('0x28')][_0x72bf('0x2d')]));_0x258594[_0x72bf('0x2c')]=_0x258594[_0x72bf('0x2c')]['length']?_0x258594[_0x72bf('0x2c')]:_0x5e5fd0[_0x72bf('0x2b')];if(!_0x45d9d1[_0x72bf('0x28')][_0x72bf('0x2e')](_0x72bf('0x2f'))){_0x258594[_0x72bf('0x19')]=qs[_0x72bf('0x19')](_0x45d9d1[_0x72bf('0x28')][_0x72bf('0x19')]);_0x258594[_0x72bf('0x17')]=qs[_0x72bf('0x17')](_0x45d9d1['query'][_0x72bf('0x17')]);}_0x258594[_0x72bf('0x30')]=qs[_0x72bf('0x31')](_0x45d9d1[_0x72bf('0x28')][_0x72bf('0x31')]);_0x258594['where']=qs[_0x72bf('0x29')](_['pick'](_0x45d9d1[_0x72bf('0x28')],_0x5e5fd0[_0x72bf('0x29')]),_0x4051b4);if(_0x45d9d1[_0x72bf('0x28')][_0x72bf('0x32')]){_0x258594[_0x72bf('0x33')]=_[_0x72bf('0x34')](_0x258594[_0x72bf('0x33')],{'$or':_['map'](_0x4051b4,function(_0x14cc7f){if(_0x14cc7f[_0x72bf('0x35')]!==_0x72bf('0x36')){var _0x2c8a14={};_0x2c8a14[_0x14cc7f[_0x72bf('0x21')]]={'$like':'%'+_0x45d9d1[_0x72bf('0x28')]['filter']+'%'};return _0x2c8a14;}})});}_0x258594=_[_0x72bf('0x34')]({},_0x258594,_0x45d9d1[_0x72bf('0x37')]);var _0x2c1f66={'where':_0x258594[_0x72bf('0x33')]};return db[_0x72bf('0x23')]['count'](_0x2c1f66)[_0x72bf('0x1e')](function(_0x31dde0){_0x422962[_0x72bf('0x1a')]=_0x31dde0;if(_0x45d9d1[_0x72bf('0x28')]['includeAll']){_0x258594[_0x72bf('0x38')]=[{'all':!![]}];}return db[_0x72bf('0x23')][_0x72bf('0x39')](_0x258594);})[_0x72bf('0x1e')](function(_0x1fa800){_0x422962[_0x72bf('0x3a')]=_0x1fa800;return _0x422962;})[_0x72bf('0x1e')](respondWithFilteredResult(_0x416028,_0x258594))[_0x72bf('0x3b')](handleError(_0x416028,null));};exports[_0x72bf('0x3c')]=function(_0xbf7994,_0x4393ca){var _0x52a027={'raw':![],'where':{'id':_0xbf7994[_0x72bf('0x3d')]['id']}},_0x180554={};_0x180554[_0x72bf('0x2b')]=_[_0x72bf('0x27')](db[_0x72bf('0x23')][_0x72bf('0x24')]);_0x180554[_0x72bf('0x28')]=_[_0x72bf('0x27')](_0xbf7994[_0x72bf('0x28')]);_0x180554[_0x72bf('0x29')]=_[_0x72bf('0x2a')](_0x180554[_0x72bf('0x2b')],_0x180554['query']);_0x52a027['attributes']=_[_0x72bf('0x2a')](_0x180554['model'],qs[_0x72bf('0x2d')](_0xbf7994[_0x72bf('0x28')][_0x72bf('0x2d')]));_0x52a027[_0x72bf('0x2c')]=_0x52a027[_0x72bf('0x2c')][_0x72bf('0x3e')]?_0x52a027[_0x72bf('0x2c')]:_0x180554[_0x72bf('0x2b')];if(_0xbf7994[_0x72bf('0x28')][_0x72bf('0x3f')]){_0x52a027[_0x72bf('0x38')]=[{'all':!![]}];}_0x52a027=_['merge']({},_0x52a027,_0xbf7994[_0x72bf('0x37')]);return db[_0x72bf('0x23')][_0x72bf('0x40')](_0x52a027)[_0x72bf('0x1e')](handleEntityNotFound(_0x4393ca,null))[_0x72bf('0x1e')](respondWithResult(_0x4393ca,null))['catch'](handleError(_0x4393ca,null));};exports[_0x72bf('0x41')]=function(_0x2562c7,_0x5815f1){return db['Dynamics365Configuration'][_0x72bf('0x41')](_0x2562c7[_0x72bf('0x42')],{})[_0x72bf('0x1e')](respondWithResult(_0x5815f1,0xc9))['catch'](handleError(_0x5815f1,null));};exports['update']=function(_0x1de556,_0x27ba94){if(_0x1de556[_0x72bf('0x42')]['id']){delete _0x1de556['body']['id'];}return db[_0x72bf('0x23')][_0x72bf('0x40')]({'where':{'id':_0x1de556['params']['id']}})[_0x72bf('0x1e')](handleEntityNotFound(_0x27ba94,null))[_0x72bf('0x1e')](saveUpdates(_0x1de556[_0x72bf('0x42')],null))['then'](respondWithResult(_0x27ba94,null))['catch'](handleError(_0x27ba94,null));};exports[_0x72bf('0x43')]=function(_0xb63717,_0x1a1f61){return db[_0x72bf('0x23')]['find']({'where':{'id':_0xb63717[_0x72bf('0x3d')]['id']}})['then'](handleEntityNotFound(_0x1a1f61,null))[_0x72bf('0x1e')](removeEntity(_0x1a1f61,null))[_0x72bf('0x3b')](handleError(_0x1a1f61,null));};exports[_0x72bf('0x44')]=function(_0x578cdf,_0x2cfc6b,_0x156fa8){var _0x2c9ccf={};var _0x178ceb={};var _0x263226;var _0x23394a;return db['Dynamics365Configuration'][_0x72bf('0x45')]({'where':{'id':_0x578cdf[_0x72bf('0x3d')]['id']}})[_0x72bf('0x1e')](handleEntityNotFound(_0x2cfc6b,null))['then'](function(_0x1a3362){if(_0x1a3362){_0x263226=_0x1a3362;_0x178ceb[_0x72bf('0x2b')]=_[_0x72bf('0x27')](db[_0x72bf('0x46')][_0x72bf('0x24')]);_0x178ceb['query']=_[_0x72bf('0x27')](_0x578cdf[_0x72bf('0x28')]);_0x178ceb['filters']=_['intersection'](_0x178ceb[_0x72bf('0x2b')],_0x178ceb[_0x72bf('0x28')]);_0x2c9ccf['attributes']=_[_0x72bf('0x2a')](_0x178ceb[_0x72bf('0x2b')],qs[_0x72bf('0x2d')](_0x578cdf['query'][_0x72bf('0x2d')]));_0x2c9ccf[_0x72bf('0x2c')]=_0x2c9ccf[_0x72bf('0x2c')][_0x72bf('0x3e')]?_0x2c9ccf[_0x72bf('0x2c')]:_0x178ceb[_0x72bf('0x2b')];_0x2c9ccf[_0x72bf('0x30')]=qs['sort'](_0x578cdf['query']['sort']);_0x2c9ccf[_0x72bf('0x33')]=qs[_0x72bf('0x29')](_[_0x72bf('0x47')](_0x578cdf[_0x72bf('0x28')],_0x178ceb[_0x72bf('0x29')]));if(_0x578cdf['query'][_0x72bf('0x32')]){_0x2c9ccf[_0x72bf('0x33')]=_['merge'](_0x2c9ccf['where'],{'$or':_[_0x72bf('0x26')](_0x2c9ccf[_0x72bf('0x2c')],function(_0xdaeb73){var _0x766f4={};_0x766f4[_0xdaeb73]={'$like':'%'+_0x578cdf['query'][_0x72bf('0x32')]+'%'};return _0x766f4;})});}_0x2c9ccf=_[_0x72bf('0x34')]({},_0x2c9ccf,_0x578cdf[_0x72bf('0x37')]);return _0x263226['getFields'](_0x2c9ccf);}})[_0x72bf('0x1e')](function(_0x3df124){if(_0x3df124){_0x23394a=_0x3df124[_0x72bf('0x3e')];if(!_0x578cdf[_0x72bf('0x28')][_0x72bf('0x2e')](_0x72bf('0x2f'))){_0x2c9ccf['limit']=qs[_0x72bf('0x19')](_0x578cdf[_0x72bf('0x28')][_0x72bf('0x19')]);_0x2c9ccf[_0x72bf('0x17')]=qs['offset'](_0x578cdf['query'][_0x72bf('0x17')]);}return _0x263226['getFields'](_0x2c9ccf);}})[_0x72bf('0x1e')](function(_0x24bff3){if(_0x24bff3){return _0x24bff3?{'count':_0x23394a,'rows':_0x24bff3}:null;}})[_0x72bf('0x1e')](respondWithResult(_0x2cfc6b,null))[_0x72bf('0x3b')](handleError(_0x2cfc6b,null));};exports['getSubjects']=function(_0xa7edc9,_0x1314cf,_0x4f1380){var _0x41f693={};var _0xa3c73f={};var _0x24df97;var _0x4e9925;return db[_0x72bf('0x23')][_0x72bf('0x45')]({'where':{'id':_0xa7edc9['params']['id']}})[_0x72bf('0x1e')](handleEntityNotFound(_0x1314cf,null))[_0x72bf('0x1e')](function(_0x5d5fa9){if(_0x5d5fa9){_0x24df97=_0x5d5fa9;_0xa3c73f[_0x72bf('0x2b')]=_[_0x72bf('0x27')](db[_0x72bf('0x46')][_0x72bf('0x24')]);_0xa3c73f[_0x72bf('0x28')]=_[_0x72bf('0x27')](_0xa7edc9['query']);_0xa3c73f[_0x72bf('0x29')]=_[_0x72bf('0x2a')](_0xa3c73f['model'],_0xa3c73f[_0x72bf('0x28')]);_0x41f693[_0x72bf('0x2c')]=_[_0x72bf('0x2a')](_0xa3c73f['model'],qs[_0x72bf('0x2d')](_0xa7edc9[_0x72bf('0x28')][_0x72bf('0x2d')]));_0x41f693[_0x72bf('0x2c')]=_0x41f693[_0x72bf('0x2c')][_0x72bf('0x3e')]?_0x41f693['attributes']:_0xa3c73f[_0x72bf('0x2b')];_0x41f693['order']=qs[_0x72bf('0x31')](_0xa7edc9[_0x72bf('0x28')][_0x72bf('0x31')]);_0x41f693[_0x72bf('0x33')]=qs['filters'](_[_0x72bf('0x47')](_0xa7edc9[_0x72bf('0x28')],_0xa3c73f[_0x72bf('0x29')]));if(_0xa7edc9[_0x72bf('0x28')][_0x72bf('0x32')]){_0x41f693[_0x72bf('0x33')]=_[_0x72bf('0x34')](_0x41f693[_0x72bf('0x33')],{'$or':_['map'](_0x41f693[_0x72bf('0x2c')],function(_0x1f180d){var _0x226139={};_0x226139[_0x1f180d]={'$like':'%'+_0xa7edc9[_0x72bf('0x28')]['filter']+'%'};return _0x226139;})});}_0x41f693=_[_0x72bf('0x34')]({},_0x41f693,_0xa7edc9[_0x72bf('0x37')]);return _0x24df97['getSubjects'](_0x41f693);}})[_0x72bf('0x1e')](function(_0x31777c){if(_0x31777c){_0x4e9925=_0x31777c[_0x72bf('0x3e')];if(!_0xa7edc9[_0x72bf('0x28')][_0x72bf('0x2e')]('nolimit')){_0x41f693[_0x72bf('0x19')]=qs[_0x72bf('0x19')](_0xa7edc9[_0x72bf('0x28')]['limit']);_0x41f693[_0x72bf('0x17')]=qs[_0x72bf('0x17')](_0xa7edc9[_0x72bf('0x28')][_0x72bf('0x17')]);}return _0x24df97['getSubjects'](_0x41f693);}})['then'](function(_0x26dc80){if(_0x26dc80){return _0x26dc80?{'count':_0x4e9925,'rows':_0x26dc80}:null;}})[_0x72bf('0x1e')](respondWithResult(_0x1314cf,null))[_0x72bf('0x3b')](handleError(_0x1314cf,null));};exports[_0x72bf('0x48')]=function(_0x390809,_0x4707fe,_0x1b78e3){var _0x3cb04f={};var _0x5d3168={};var _0x104862;var _0x13f9aa;return db[_0x72bf('0x23')][_0x72bf('0x45')]({'where':{'id':_0x390809[_0x72bf('0x3d')]['id']}})[_0x72bf('0x1e')](handleEntityNotFound(_0x4707fe,null))[_0x72bf('0x1e')](function(_0x5a1916){if(_0x5a1916){_0x104862=_0x5a1916;_0x5d3168[_0x72bf('0x2b')]=_['keys'](db['Dynamics365Field']['rawAttributes']);_0x5d3168[_0x72bf('0x28')]=_[_0x72bf('0x27')](_0x390809['query']);_0x5d3168[_0x72bf('0x29')]=_['intersection'](_0x5d3168[_0x72bf('0x2b')],_0x5d3168[_0x72bf('0x28')]);_0x3cb04f[_0x72bf('0x2c')]=_[_0x72bf('0x2a')](_0x5d3168[_0x72bf('0x2b')],qs[_0x72bf('0x2d')](_0x390809[_0x72bf('0x28')][_0x72bf('0x2d')]));_0x3cb04f[_0x72bf('0x2c')]=_0x3cb04f[_0x72bf('0x2c')]['length']?_0x3cb04f['attributes']:_0x5d3168[_0x72bf('0x2b')];_0x3cb04f[_0x72bf('0x30')]=qs[_0x72bf('0x31')](_0x390809['query'][_0x72bf('0x31')]);_0x3cb04f[_0x72bf('0x33')]=qs['filters'](_[_0x72bf('0x47')](_0x390809[_0x72bf('0x28')],_0x5d3168['filters']));if(_0x390809[_0x72bf('0x28')][_0x72bf('0x32')]){_0x3cb04f[_0x72bf('0x33')]=_['merge'](_0x3cb04f['where'],{'$or':_[_0x72bf('0x26')](_0x3cb04f[_0x72bf('0x2c')],function(_0x5a0935){var _0x132a74={};_0x132a74[_0x5a0935]={'$like':'%'+_0x390809[_0x72bf('0x28')][_0x72bf('0x32')]+'%'};return _0x132a74;})});}_0x3cb04f=_[_0x72bf('0x34')]({},_0x3cb04f,_0x390809[_0x72bf('0x37')]);return _0x104862[_0x72bf('0x48')](_0x3cb04f);}})[_0x72bf('0x1e')](function(_0x31ce68){if(_0x31ce68){_0x13f9aa=_0x31ce68['length'];if(!_0x390809[_0x72bf('0x28')][_0x72bf('0x2e')](_0x72bf('0x2f'))){_0x3cb04f[_0x72bf('0x19')]=qs[_0x72bf('0x19')](_0x390809[_0x72bf('0x28')][_0x72bf('0x19')]);_0x3cb04f['offset']=qs[_0x72bf('0x17')](_0x390809['query'][_0x72bf('0x17')]);}return _0x104862[_0x72bf('0x48')](_0x3cb04f);}})[_0x72bf('0x1e')](function(_0x243ce1){if(_0x243ce1){return _0x243ce1?{'count':_0x13f9aa,'rows':_0x243ce1}:null;}})[_0x72bf('0x1e')](respondWithResult(_0x4707fe,null))[_0x72bf('0x3b')](handleError(_0x4707fe,null));}; \ No newline at end of file +var _0xe4c5=['end','status','json','undefined','offset','count','reject','save','then','sendStatus','stack','name','send','index','Dynamics365Configuration','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','fields','attributes','nolimit','limit','sort','pick','filter','where','VIRTUAL','merge','include','rows','catch','show','params','keys','includeAll','options','find','create','body','update','destroy','getFields','length','order','getSubjects','findOne','Dynamics365Field','hasOwnProperty','getDescriptions','eml-format','fast-json-patch','bluebird','mustache','path','to-csv','ejs','lodash','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb'];(function(_0x39853d,_0x2501bf){var _0x5864ca=function(_0xbc99d5){while(--_0xbc99d5){_0x39853d['push'](_0x39853d['shift']());}};_0x5864ca(++_0x2501bf);}(_0xe4c5,0x11b));var _0x5e4c=function(_0x24c886,_0x67c5c0){_0x24c886=_0x24c886-0x0;var _0x3f1c8b=_0xe4c5[_0x24c886];return _0x3f1c8b;};'use strict';var emlformat=require(_0x5e4c('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x5e4c('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x5e4c('0x2'));var Mustache=require(_0x5e4c('0x3'));var util=require('util');var path=require(_0x5e4c('0x4'));var sox=require('sox');var csv=require(_0x5e4c('0x5'));var ejs=require(_0x5e4c('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5e4c('0x7'));var squel=require('squel');var crypto=require(_0x5e4c('0x8'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x5e4c('0x5'));var querystring=require(_0x5e4c('0x9'));var Papa=require(_0x5e4c('0xa'));var Redis=require(_0x5e4c('0xb'));var authService=require(_0x5e4c('0xc'));var qs=require(_0x5e4c('0xd'));var as=require(_0x5e4c('0xe'));var hardwareService=require(_0x5e4c('0xf'));var logger=require(_0x5e4c('0x10'))(_0x5e4c('0x11'));var utils=require(_0x5e4c('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x5e4c('0x13'));var db=require(_0x5e4c('0x14'))['db'];function respondWithStatusCode(_0x1b109f,_0x25bfdb){_0x25bfdb=_0x25bfdb||0xcc;return function(_0x471af6){if(_0x471af6){return _0x1b109f['sendStatus'](_0x25bfdb);}return _0x1b109f['status'](_0x25bfdb)[_0x5e4c('0x15')]();};}function respondWithResult(_0x3daabe,_0x1a6623){_0x1a6623=_0x1a6623||0xc8;return function(_0x1baf40){if(_0x1baf40){return _0x3daabe[_0x5e4c('0x16')](_0x1a6623)[_0x5e4c('0x17')](_0x1baf40);}};}function respondWithFilteredResult(_0x40d3c4,_0x19003f){return function(_0x4d17d3){if(_0x4d17d3){var _0x221b46=typeof _0x19003f['offset']===_0x5e4c('0x18')&&typeof _0x19003f['limit']===_0x5e4c('0x18');var _0x1c327e=_0x4d17d3['count'];var _0x4bc168=_0x221b46?0x0:_0x19003f[_0x5e4c('0x19')];var _0x4e318c=_0x221b46?_0x4d17d3[_0x5e4c('0x1a')]:_0x19003f['offset']+_0x19003f['limit'];var _0x55e100;if(_0x4e318c>=_0x1c327e){_0x4e318c=_0x1c327e;_0x55e100=0xc8;}else{_0x55e100=0xce;}_0x40d3c4[_0x5e4c('0x16')](_0x55e100);return _0x40d3c4['set']('Content-Range',_0x4bc168+'-'+_0x4e318c+'/'+_0x1c327e)['json'](_0x4d17d3);}return null;};}function patchUpdates(_0x23d838){return function(_0x4ae561){try{jsonpatch['apply'](_0x4ae561,_0x23d838,!![]);}catch(_0x5ab268){return BPromise[_0x5e4c('0x1b')](_0x5ab268);}return _0x4ae561[_0x5e4c('0x1c')]();};}function saveUpdates(_0x5b8a6a,_0x4623b3){return function(_0x5ba482){if(_0x5ba482){return _0x5ba482['update'](_0x5b8a6a)[_0x5e4c('0x1d')](function(_0x4cd436){return _0x4cd436;});}return null;};}function removeEntity(_0x1156ea,_0x28630a){return function(_0x51886c){if(_0x51886c){return _0x51886c['destroy']()[_0x5e4c('0x1d')](function(){_0x1156ea[_0x5e4c('0x16')](0xcc)[_0x5e4c('0x15')]();});}};}function handleEntityNotFound(_0x577bb1,_0x40d795){return function(_0x5e0744){if(!_0x5e0744){_0x577bb1[_0x5e4c('0x1e')](0x194);}return _0x5e0744;};}function handleError(_0x29fee0,_0x482f2e){_0x482f2e=_0x482f2e||0x1f4;return function(_0x48b331){logger['error'](_0x48b331[_0x5e4c('0x1f')]);if(_0x48b331[_0x5e4c('0x20')]){delete _0x48b331[_0x5e4c('0x20')];}_0x29fee0[_0x5e4c('0x16')](_0x482f2e)[_0x5e4c('0x21')](_0x48b331);};}exports[_0x5e4c('0x22')]=function(_0xe10d46,_0x316fae){var _0x525bdd={},_0x1c379a={},_0xa824db={'count':0x0,'rows':[]};var _0x279354=_['map'](db[_0x5e4c('0x23')][_0x5e4c('0x24')],function(_0x8ae35f){return{'name':_0x8ae35f[_0x5e4c('0x25')],'type':_0x8ae35f[_0x5e4c('0x26')][_0x5e4c('0x27')]};});_0x1c379a[_0x5e4c('0x28')]=_[_0x5e4c('0x29')](_0x279354,'name');_0x1c379a['query']=_['keys'](_0xe10d46[_0x5e4c('0x2a')]);_0x1c379a[_0x5e4c('0x2b')]=_[_0x5e4c('0x2c')](_0x1c379a[_0x5e4c('0x28')],_0x1c379a[_0x5e4c('0x2a')]);_0x525bdd['attributes']=_[_0x5e4c('0x2c')](_0x1c379a[_0x5e4c('0x28')],qs[_0x5e4c('0x2d')](_0xe10d46[_0x5e4c('0x2a')][_0x5e4c('0x2d')]));_0x525bdd[_0x5e4c('0x2e')]=_0x525bdd[_0x5e4c('0x2e')]['length']?_0x525bdd[_0x5e4c('0x2e')]:_0x1c379a[_0x5e4c('0x28')];if(!_0xe10d46['query']['hasOwnProperty'](_0x5e4c('0x2f'))){_0x525bdd['limit']=qs['limit'](_0xe10d46[_0x5e4c('0x2a')][_0x5e4c('0x30')]);_0x525bdd['offset']=qs[_0x5e4c('0x19')](_0xe10d46[_0x5e4c('0x2a')][_0x5e4c('0x19')]);}_0x525bdd['order']=qs[_0x5e4c('0x31')](_0xe10d46[_0x5e4c('0x2a')][_0x5e4c('0x31')]);_0x525bdd['where']=qs[_0x5e4c('0x2b')](_[_0x5e4c('0x32')](_0xe10d46[_0x5e4c('0x2a')],_0x1c379a['filters']),_0x279354);if(_0xe10d46['query'][_0x5e4c('0x33')]){_0x525bdd[_0x5e4c('0x34')]=_['merge'](_0x525bdd[_0x5e4c('0x34')],{'$or':_['map'](_0x279354,function(_0x34f6ed){if(_0x34f6ed[_0x5e4c('0x26')]!==_0x5e4c('0x35')){var _0x515652={};_0x515652[_0x34f6ed[_0x5e4c('0x20')]]={'$like':'%'+_0xe10d46['query'][_0x5e4c('0x33')]+'%'};return _0x515652;}})});}_0x525bdd=_[_0x5e4c('0x36')]({},_0x525bdd,_0xe10d46['options']);var _0x1dc897={'where':_0x525bdd['where']};return db['Dynamics365Configuration'][_0x5e4c('0x1a')](_0x1dc897)[_0x5e4c('0x1d')](function(_0x5a3e72){_0xa824db[_0x5e4c('0x1a')]=_0x5a3e72;if(_0xe10d46[_0x5e4c('0x2a')]['includeAll']){_0x525bdd[_0x5e4c('0x37')]=[{'all':!![]}];}return db['Dynamics365Configuration']['findAll'](_0x525bdd);})[_0x5e4c('0x1d')](function(_0x51a033){_0xa824db[_0x5e4c('0x38')]=_0x51a033;return _0xa824db;})[_0x5e4c('0x1d')](respondWithFilteredResult(_0x316fae,_0x525bdd))[_0x5e4c('0x39')](handleError(_0x316fae,null));};exports[_0x5e4c('0x3a')]=function(_0x3dd32a,_0x50a2ae){var _0x56e030={'raw':![],'where':{'id':_0x3dd32a[_0x5e4c('0x3b')]['id']}},_0x3fa116={};_0x3fa116['model']=_[_0x5e4c('0x3c')](db['Dynamics365Configuration'][_0x5e4c('0x24')]);_0x3fa116['query']=_[_0x5e4c('0x3c')](_0x3dd32a['query']);_0x3fa116['filters']=_[_0x5e4c('0x2c')](_0x3fa116['model'],_0x3fa116[_0x5e4c('0x2a')]);_0x56e030[_0x5e4c('0x2e')]=_[_0x5e4c('0x2c')](_0x3fa116['model'],qs['fields'](_0x3dd32a[_0x5e4c('0x2a')][_0x5e4c('0x2d')]));_0x56e030[_0x5e4c('0x2e')]=_0x56e030[_0x5e4c('0x2e')]['length']?_0x56e030[_0x5e4c('0x2e')]:_0x3fa116[_0x5e4c('0x28')];if(_0x3dd32a['query'][_0x5e4c('0x3d')]){_0x56e030[_0x5e4c('0x37')]=[{'all':!![]}];}_0x56e030=_[_0x5e4c('0x36')]({},_0x56e030,_0x3dd32a[_0x5e4c('0x3e')]);return db[_0x5e4c('0x23')][_0x5e4c('0x3f')](_0x56e030)[_0x5e4c('0x1d')](handleEntityNotFound(_0x50a2ae,null))['then'](respondWithResult(_0x50a2ae,null))[_0x5e4c('0x39')](handleError(_0x50a2ae,null));};exports[_0x5e4c('0x40')]=function(_0x3bbc27,_0x2bc4bc){return db[_0x5e4c('0x23')][_0x5e4c('0x40')](_0x3bbc27[_0x5e4c('0x41')],{})[_0x5e4c('0x1d')](respondWithResult(_0x2bc4bc,0xc9))[_0x5e4c('0x39')](handleError(_0x2bc4bc,null));};exports[_0x5e4c('0x42')]=function(_0x4555b4,_0x318022){if(_0x4555b4['body']['id']){delete _0x4555b4[_0x5e4c('0x41')]['id'];}return db['Dynamics365Configuration'][_0x5e4c('0x3f')]({'where':{'id':_0x4555b4[_0x5e4c('0x3b')]['id']}})[_0x5e4c('0x1d')](handleEntityNotFound(_0x318022,null))[_0x5e4c('0x1d')](saveUpdates(_0x4555b4['body'],null))['then'](respondWithResult(_0x318022,null))[_0x5e4c('0x39')](handleError(_0x318022,null));};exports[_0x5e4c('0x43')]=function(_0x500382,_0x5b8705){return db[_0x5e4c('0x23')][_0x5e4c('0x3f')]({'where':{'id':_0x500382[_0x5e4c('0x3b')]['id']}})['then'](handleEntityNotFound(_0x5b8705,null))[_0x5e4c('0x1d')](removeEntity(_0x5b8705,null))[_0x5e4c('0x39')](handleError(_0x5b8705,null));};exports[_0x5e4c('0x44')]=function(_0x15ae8c,_0x2968e5,_0x1a7f49){var _0x34b16f={};var _0x36b87a={};var _0x4e5898;var _0x289f8e;return db[_0x5e4c('0x23')]['findOne']({'where':{'id':_0x15ae8c['params']['id']}})[_0x5e4c('0x1d')](handleEntityNotFound(_0x2968e5,null))[_0x5e4c('0x1d')](function(_0xe5b876){if(_0xe5b876){_0x4e5898=_0xe5b876;_0x36b87a['model']=_[_0x5e4c('0x3c')](db['Dynamics365Field']['rawAttributes']);_0x36b87a[_0x5e4c('0x2a')]=_[_0x5e4c('0x3c')](_0x15ae8c[_0x5e4c('0x2a')]);_0x36b87a[_0x5e4c('0x2b')]=_[_0x5e4c('0x2c')](_0x36b87a['model'],_0x36b87a[_0x5e4c('0x2a')]);_0x34b16f['attributes']=_[_0x5e4c('0x2c')](_0x36b87a[_0x5e4c('0x28')],qs[_0x5e4c('0x2d')](_0x15ae8c[_0x5e4c('0x2a')][_0x5e4c('0x2d')]));_0x34b16f[_0x5e4c('0x2e')]=_0x34b16f[_0x5e4c('0x2e')][_0x5e4c('0x45')]?_0x34b16f[_0x5e4c('0x2e')]:_0x36b87a[_0x5e4c('0x28')];_0x34b16f[_0x5e4c('0x46')]=qs[_0x5e4c('0x31')](_0x15ae8c[_0x5e4c('0x2a')][_0x5e4c('0x31')]);_0x34b16f['where']=qs[_0x5e4c('0x2b')](_[_0x5e4c('0x32')](_0x15ae8c[_0x5e4c('0x2a')],_0x36b87a[_0x5e4c('0x2b')]));if(_0x15ae8c[_0x5e4c('0x2a')]['filter']){_0x34b16f[_0x5e4c('0x34')]=_['merge'](_0x34b16f[_0x5e4c('0x34')],{'$or':_[_0x5e4c('0x29')](_0x34b16f[_0x5e4c('0x2e')],function(_0x2324cc){var _0x22d579={};_0x22d579[_0x2324cc]={'$like':'%'+_0x15ae8c[_0x5e4c('0x2a')]['filter']+'%'};return _0x22d579;})});}_0x34b16f=_[_0x5e4c('0x36')]({},_0x34b16f,_0x15ae8c[_0x5e4c('0x3e')]);return _0x4e5898['getFields'](_0x34b16f);}})[_0x5e4c('0x1d')](function(_0x29baea){if(_0x29baea){_0x289f8e=_0x29baea[_0x5e4c('0x45')];if(!_0x15ae8c[_0x5e4c('0x2a')]['hasOwnProperty']('nolimit')){_0x34b16f['limit']=qs[_0x5e4c('0x30')](_0x15ae8c[_0x5e4c('0x2a')]['limit']);_0x34b16f[_0x5e4c('0x19')]=qs[_0x5e4c('0x19')](_0x15ae8c[_0x5e4c('0x2a')][_0x5e4c('0x19')]);}return _0x4e5898[_0x5e4c('0x44')](_0x34b16f);}})['then'](function(_0x33a8c7){if(_0x33a8c7){return _0x33a8c7?{'count':_0x289f8e,'rows':_0x33a8c7}:null;}})['then'](respondWithResult(_0x2968e5,null))['catch'](handleError(_0x2968e5,null));};exports[_0x5e4c('0x47')]=function(_0x1ab08f,_0x2c1c2e,_0x257857){var _0x38643b={};var _0x3ec05f={};var _0x3f8232;var _0x7075af;return db['Dynamics365Configuration'][_0x5e4c('0x48')]({'where':{'id':_0x1ab08f[_0x5e4c('0x3b')]['id']}})[_0x5e4c('0x1d')](handleEntityNotFound(_0x2c1c2e,null))[_0x5e4c('0x1d')](function(_0x128c53){if(_0x128c53){_0x3f8232=_0x128c53;_0x3ec05f['model']=_[_0x5e4c('0x3c')](db[_0x5e4c('0x49')]['rawAttributes']);_0x3ec05f[_0x5e4c('0x2a')]=_[_0x5e4c('0x3c')](_0x1ab08f[_0x5e4c('0x2a')]);_0x3ec05f[_0x5e4c('0x2b')]=_['intersection'](_0x3ec05f[_0x5e4c('0x28')],_0x3ec05f['query']);_0x38643b[_0x5e4c('0x2e')]=_['intersection'](_0x3ec05f['model'],qs[_0x5e4c('0x2d')](_0x1ab08f[_0x5e4c('0x2a')]['fields']));_0x38643b[_0x5e4c('0x2e')]=_0x38643b[_0x5e4c('0x2e')][_0x5e4c('0x45')]?_0x38643b['attributes']:_0x3ec05f[_0x5e4c('0x28')];_0x38643b[_0x5e4c('0x46')]=qs[_0x5e4c('0x31')](_0x1ab08f[_0x5e4c('0x2a')]['sort']);_0x38643b[_0x5e4c('0x34')]=qs[_0x5e4c('0x2b')](_[_0x5e4c('0x32')](_0x1ab08f['query'],_0x3ec05f['filters']));if(_0x1ab08f['query'][_0x5e4c('0x33')]){_0x38643b[_0x5e4c('0x34')]=_[_0x5e4c('0x36')](_0x38643b[_0x5e4c('0x34')],{'$or':_[_0x5e4c('0x29')](_0x38643b[_0x5e4c('0x2e')],function(_0x29bbfc){var _0x3c214c={};_0x3c214c[_0x29bbfc]={'$like':'%'+_0x1ab08f[_0x5e4c('0x2a')][_0x5e4c('0x33')]+'%'};return _0x3c214c;})});}_0x38643b=_[_0x5e4c('0x36')]({},_0x38643b,_0x1ab08f['options']);return _0x3f8232[_0x5e4c('0x47')](_0x38643b);}})['then'](function(_0x8cee10){if(_0x8cee10){_0x7075af=_0x8cee10[_0x5e4c('0x45')];if(!_0x1ab08f[_0x5e4c('0x2a')][_0x5e4c('0x4a')]('nolimit')){_0x38643b['limit']=qs[_0x5e4c('0x30')](_0x1ab08f[_0x5e4c('0x2a')][_0x5e4c('0x30')]);_0x38643b[_0x5e4c('0x19')]=qs['offset'](_0x1ab08f[_0x5e4c('0x2a')]['offset']);}return _0x3f8232[_0x5e4c('0x47')](_0x38643b);}})[_0x5e4c('0x1d')](function(_0x461109){if(_0x461109){return _0x461109?{'count':_0x7075af,'rows':_0x461109}:null;}})[_0x5e4c('0x1d')](respondWithResult(_0x2c1c2e,null))[_0x5e4c('0x39')](handleError(_0x2c1c2e,null));};exports['getDescriptions']=function(_0x4c1327,_0x55bf68,_0x409c13){var _0x3ff4a2={};var _0xec9791={};var _0x495428;var _0xbe8186;return db[_0x5e4c('0x23')][_0x5e4c('0x48')]({'where':{'id':_0x4c1327[_0x5e4c('0x3b')]['id']}})[_0x5e4c('0x1d')](handleEntityNotFound(_0x55bf68,null))[_0x5e4c('0x1d')](function(_0xe930f7){if(_0xe930f7){_0x495428=_0xe930f7;_0xec9791[_0x5e4c('0x28')]=_[_0x5e4c('0x3c')](db[_0x5e4c('0x49')][_0x5e4c('0x24')]);_0xec9791['query']=_[_0x5e4c('0x3c')](_0x4c1327['query']);_0xec9791['filters']=_[_0x5e4c('0x2c')](_0xec9791[_0x5e4c('0x28')],_0xec9791['query']);_0x3ff4a2[_0x5e4c('0x2e')]=_[_0x5e4c('0x2c')](_0xec9791['model'],qs[_0x5e4c('0x2d')](_0x4c1327[_0x5e4c('0x2a')][_0x5e4c('0x2d')]));_0x3ff4a2[_0x5e4c('0x2e')]=_0x3ff4a2[_0x5e4c('0x2e')][_0x5e4c('0x45')]?_0x3ff4a2['attributes']:_0xec9791['model'];_0x3ff4a2[_0x5e4c('0x46')]=qs[_0x5e4c('0x31')](_0x4c1327[_0x5e4c('0x2a')]['sort']);_0x3ff4a2[_0x5e4c('0x34')]=qs['filters'](_[_0x5e4c('0x32')](_0x4c1327[_0x5e4c('0x2a')],_0xec9791[_0x5e4c('0x2b')]));if(_0x4c1327['query']['filter']){_0x3ff4a2[_0x5e4c('0x34')]=_[_0x5e4c('0x36')](_0x3ff4a2['where'],{'$or':_[_0x5e4c('0x29')](_0x3ff4a2[_0x5e4c('0x2e')],function(_0xf433a0){var _0x422721={};_0x422721[_0xf433a0]={'$like':'%'+_0x4c1327[_0x5e4c('0x2a')][_0x5e4c('0x33')]+'%'};return _0x422721;})});}_0x3ff4a2=_[_0x5e4c('0x36')]({},_0x3ff4a2,_0x4c1327[_0x5e4c('0x3e')]);return _0x495428[_0x5e4c('0x4b')](_0x3ff4a2);}})['then'](function(_0x34f92a){if(_0x34f92a){_0xbe8186=_0x34f92a[_0x5e4c('0x45')];if(!_0x4c1327[_0x5e4c('0x2a')]['hasOwnProperty'](_0x5e4c('0x2f'))){_0x3ff4a2['limit']=qs['limit'](_0x4c1327['query'][_0x5e4c('0x30')]);_0x3ff4a2[_0x5e4c('0x19')]=qs[_0x5e4c('0x19')](_0x4c1327[_0x5e4c('0x2a')][_0x5e4c('0x19')]);}return _0x495428[_0x5e4c('0x4b')](_0x3ff4a2);}})[_0x5e4c('0x1d')](function(_0x3b0ff5){if(_0x3b0ff5){return _0x3b0ff5?{'count':_0xbe8186,'rows':_0x3b0ff5}:null;}})[_0x5e4c('0x1d')](respondWithResult(_0x55bf68,null))['catch'](handleError(_0x55bf68,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index b52326b..e2f5e11 100644 --- a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js +++ b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf3cd=['path','rimraf','../../config/environment','exports','define','Dynamics365Configuration','int_dynamics365_configurations','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x30a937,_0x4cb3fa){var _0x1adb64=function(_0x4e77d5){while(--_0x4e77d5){_0x30a937['push'](_0x30a937['shift']());}};_0x1adb64(++_0x4cb3fa);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x16b667,_0xadec02){_0x16b667=_0x16b667-0x0;var _0x58620e=_0xf3cd[_0x16b667];return _0x58620e;};'use strict';var _=require(_0xdf3c('0x0'));var util=require(_0xdf3c('0x1'));var logger=require(_0xdf3c('0x2'))(_0xdf3c('0x3'));var moment=require(_0xdf3c('0x4'));var BPromise=require(_0xdf3c('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xdf3c('0x6'));var rimraf=require(_0xdf3c('0x7'));var config=require(_0xdf3c('0x8'));var attributes=require('./intDynamics365Configuration.attributes');module[_0xdf3c('0x9')]=function(_0x17d42a,_0x1313d5){return _0x17d42a[_0xdf3c('0xa')](_0xdf3c('0xb'),attributes,{'tableName':_0xdf3c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa9e0=['../../config/environment','./intDynamics365Configuration.attributes','exports','define','Dynamics365Configuration','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x14d6ac,_0x4649ce){var _0x164cfc=function(_0x30684c){while(--_0x30684c){_0x14d6ac['push'](_0x14d6ac['shift']());}};_0x164cfc(++_0x4649ce);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3899d1,_0x4aa04c){_0x3899d1=_0x3899d1-0x0;var _0xeb4a7d=_0xa9e0[_0x3899d1];return _0xeb4a7d;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'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 ae5d26b..df9dde5 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 _0x29ad=['util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Dynamics365Configuration,\x20%s,\x20%s','result','catch','lodash'];(function(_0x3b4823,_0x5c8e7a){var _0x15c670=function(_0x3cd81a){while(--_0x3cd81a){_0x3b4823['push'](_0x3b4823['shift']());}};_0x15c670(++_0x5c8e7a);}(_0x29ad,0x151));var _0xd29a=function(_0x3228a2,_0x5e030a){_0x3228a2=_0x3228a2-0x0;var _0x55195b=_0x29ad[_0x3228a2];return _0x55195b;};'use strict';var _=require(_0xd29a('0x0'));var util=require(_0xd29a('0x1'));var moment=require(_0xd29a('0x2'));var BPromise=require(_0xd29a('0x3'));var rs=require(_0xd29a('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd29a('0x5'))['db'];var utils=require(_0xd29a('0x6'));var logger=require(_0xd29a('0x7'))(_0xd29a('0x8'));var config=require(_0xd29a('0x9'));var jayson=require(_0xd29a('0xa'));var client=jayson[_0xd29a('0xb')][_0xd29a('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xa1bbb0,_0x557955,_0x4c81b2){return new BPromise(function(_0x5dada2,_0x2d2967){return client[_0xd29a('0xd')](_0xa1bbb0,_0x4c81b2)[_0xd29a('0xe')](function(_0x4cd95e){logger[_0xd29a('0xf')]('Dynamics365Configuration,\x20%s,\x20%s',_0x557955,_0xd29a('0x10'));logger[_0xd29a('0x11')](_0xd29a('0x12'),_0x557955,_0xd29a('0x10'),JSON[_0xd29a('0x13')](_0x4cd95e));if(_0x4cd95e[_0xd29a('0x14')]){if(_0x4cd95e[_0xd29a('0x14')][_0xd29a('0x15')]===0x1f4){logger[_0xd29a('0x14')]('Dynamics365Configuration,\x20%s,\x20%s',_0x557955,_0x4cd95e[_0xd29a('0x14')]['message']);return _0x2d2967(_0x4cd95e[_0xd29a('0x14')][_0xd29a('0x16')]);}logger[_0xd29a('0x14')](_0xd29a('0x17'),_0x557955,_0x4cd95e[_0xd29a('0x14')][_0xd29a('0x16')]);return _0x5dada2(_0x4cd95e[_0xd29a('0x14')][_0xd29a('0x16')]);}else{logger[_0xd29a('0xf')](_0xd29a('0x17'),_0x557955,_0xd29a('0x10'));_0x5dada2(_0x4cd95e[_0xd29a('0x18')]['message']);}})[_0xd29a('0x19')](function(_0x2c3c18){logger[_0xd29a('0x14')](_0xd29a('0x17'),_0x557955,_0x2c3c18);_0x2d2967(_0x2c3c18);});});} \ No newline at end of file +var _0xd7e8=['Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent'];(function(_0x41f5a5,_0x3edbfa){var _0xe96838=function(_0x2cbfe5){while(--_0x2cbfe5){_0x41f5a5['push'](_0x41f5a5['shift']());}};_0xe96838(++_0x3edbfa);}(_0xd7e8,0x10e));var _0x8d7e=function(_0x52a4ba,_0x5baa19){_0x52a4ba=_0x52a4ba-0x0;var _0x257aee=_0xd7e8[_0x52a4ba];return _0x257aee;};'use strict';var _=require(_0x8d7e('0x0'));var util=require(_0x8d7e('0x1'));var moment=require(_0x8d7e('0x2'));var BPromise=require(_0x8d7e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8d7e('0x4'));var db=require(_0x8d7e('0x5'))['db'];var utils=require(_0x8d7e('0x6'));var logger=require(_0x8d7e('0x7'))(_0x8d7e('0x8'));var config=require(_0x8d7e('0x9'));var jayson=require(_0x8d7e('0xa'));var client=jayson[_0x8d7e('0xb')][_0x8d7e('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x178723,_0x134d66,_0xfa1cc7){return new BPromise(function(_0x26f03b,_0x5206c5){return client[_0x8d7e('0xd')](_0x178723,_0xfa1cc7)[_0x8d7e('0xe')](function(_0x301bd6){logger[_0x8d7e('0xf')](_0x8d7e('0x10'),_0x134d66,_0x8d7e('0x11'));logger['debug'](_0x8d7e('0x12'),_0x134d66,'request\x20sent',JSON[_0x8d7e('0x13')](_0x301bd6));if(_0x301bd6[_0x8d7e('0x14')]){if(_0x301bd6['error'][_0x8d7e('0x15')]===0x1f4){logger[_0x8d7e('0x14')](_0x8d7e('0x10'),_0x134d66,_0x301bd6[_0x8d7e('0x14')][_0x8d7e('0x16')]);return _0x5206c5(_0x301bd6[_0x8d7e('0x14')][_0x8d7e('0x16')]);}logger[_0x8d7e('0x14')]('Dynamics365Configuration,\x20%s,\x20%s',_0x134d66,_0x301bd6[_0x8d7e('0x14')][_0x8d7e('0x16')]);return _0x26f03b(_0x301bd6[_0x8d7e('0x14')][_0x8d7e('0x16')]);}else{logger[_0x8d7e('0xf')](_0x8d7e('0x10'),_0x134d66,'request\x20sent');_0x26f03b(_0x301bd6['result'][_0x8d7e('0x16')]);}})[_0x8d7e('0x17')](function(_0x4c42bf){logger[_0x8d7e('0x14')]('Dynamics365Configuration,\x20%s,\x20%s',_0x134d66,_0x4c42bf);_0x5206c5(_0x4c42bf);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index afe62b8..83cf37e 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 _0xbcbb=['multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intDynamics365Field.controller','get','isAuthenticated','/:id','show','post','create','put','delete','destroy','exports'];(function(_0x60df74,_0x458e29){var _0x5ee872=function(_0x356888){while(--_0x356888){_0x60df74['push'](_0x60df74['shift']());}};_0x5ee872(++_0x458e29);}(_0xbcbb,0xbe));var _0xbbcb=function(_0x5c049a,_0x2c1263){_0x5c049a=_0x5c049a-0x0;var _0x168e70=_0xbcbb[_0x5c049a];return _0x168e70;};'use strict';var multer=require(_0xbbcb('0x0'));var util=require(_0xbbcb('0x1'));var path=require(_0xbbcb('0x2'));var timeout=require('connect-timeout');var express=require(_0xbbcb('0x3'));var router=express[_0xbbcb('0x4')]();var fs_extra=require(_0xbbcb('0x5'));var auth=require(_0xbbcb('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xbbcb('0x7'));var controller=require(_0xbbcb('0x8'));router[_0xbbcb('0x9')]('/',auth[_0xbbcb('0xa')](),controller['index']);router[_0xbbcb('0x9')](_0xbbcb('0xb'),auth[_0xbbcb('0xa')](),controller[_0xbbcb('0xc')]);router[_0xbbcb('0xd')]('/',auth[_0xbbcb('0xa')](),controller[_0xbbcb('0xe')]);router[_0xbbcb('0xf')]('/:id',auth[_0xbbcb('0xa')](),controller['update']);router[_0xbbcb('0x10')]('/:id',auth[_0xbbcb('0xa')](),controller[_0xbbcb('0x11')]);module[_0xbbcb('0x12')]=router; \ No newline at end of file +var _0x91e7=['get','/:id','isAuthenticated','show','post','create','delete','destroy','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','index'];(function(_0x5ef55a,_0x2a03b1){var _0x20ae40=function(_0x46ce81){while(--_0x46ce81){_0x5ef55a['push'](_0x5ef55a['shift']());}};_0x20ae40(++_0x2a03b1);}(_0x91e7,0xe9));var _0x791e=function(_0x1694f5,_0x49b7c3){_0x1694f5=_0x1694f5-0x0;var _0x5b4321=_0x91e7[_0x1694f5];return _0x5b4321;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x791e('0x0'));var express=require('express');var router=express[_0x791e('0x1')]();var fs_extra=require(_0x791e('0x2'));var auth=require(_0x791e('0x3'));var interaction=require(_0x791e('0x4'));var config=require(_0x791e('0x5'));var controller=require('./intDynamics365Field.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x791e('0x6')]);router[_0x791e('0x7')](_0x791e('0x8'),auth[_0x791e('0x9')](),controller[_0x791e('0xa')]);router[_0x791e('0xb')]('/',auth['isAuthenticated'](),controller[_0x791e('0xc')]);router['put'](_0x791e('0x8'),auth[_0x791e('0x9')](),controller['update']);router[_0x791e('0xd')]('/:id',auth[_0x791e('0x9')](),controller[_0x791e('0xe')]);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 5026ea2..46bd300 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 _0xccc9=['picklist','string','STRING','ENUM','variable','BOOLEAN','exports','customVariable','keyValue'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0xccc9,0x126));var _0x9ccc=function(_0x4e0351,_0x1cded3){_0x4e0351=_0x4e0351-0x0;var _0x5778e6=_0xccc9[_0x4e0351];return _0x5778e6;};'use strict';var Sequelize=require('sequelize');module[_0x9ccc('0x0')]={'type':{'type':Sequelize['ENUM']('string','variable',_0x9ccc('0x1'),_0x9ccc('0x2'),_0x9ccc('0x3')),'defaultValue':_0x9ccc('0x4')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x9ccc('0x5')]},'keyType':{'type':Sequelize[_0x9ccc('0x6')](_0x9ccc('0x4'),_0x9ccc('0x7'),_0x9ccc('0x1'))},'keyContent':{'type':Sequelize[_0x9ccc('0x5')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x9ccc('0x5')]},'customField':{'type':Sequelize[_0x9ccc('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xdf22=['ENUM','string','customVariable','keyValue','STRING','variable','BOOLEAN','exports'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xdf22,0x137));var _0x2df2=function(_0x522235,_0x3eb711){_0x522235=_0x522235-0x0;var _0x2a62ad=_0xdf22[_0x522235];return _0x2a62ad;};'use strict';var Sequelize=require('sequelize');module[_0x2df2('0x0')]={'type':{'type':Sequelize[_0x2df2('0x1')](_0x2df2('0x2'),'variable',_0x2df2('0x3'),_0x2df2('0x4'),'picklist'),'defaultValue':'string'},'content':{'type':Sequelize[_0x2df2('0x5')]},'key':{'type':Sequelize[_0x2df2('0x5')]},'keyType':{'type':Sequelize[_0x2df2('0x1')](_0x2df2('0x2'),_0x2df2('0x6'),_0x2df2('0x3'))},'keyContent':{'type':Sequelize[_0x2df2('0x5')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x2df2('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x2df2('0x5')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.controller.js b/server/api/intDynamics365Field/intDynamics365Field.controller.js index 4fadafd..0f5a6cc 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 _0x78dd=['querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','stack','name','send','Dynamics365Field','rawAttributes','fieldName','type','key','model','map','keys','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','options','includeAll','include','rows','catch','params','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js'];(function(_0x4536a4,_0x55af7b){var _0x4fd1c1=function(_0x4c68cd){while(--_0x4c68cd){_0x4536a4['push'](_0x4536a4['shift']());}};_0x4fd1c1(++_0x55af7b);}(_0x78dd,0xd8));var _0xd78d=function(_0x34ad72,_0x1e43f6){_0x34ad72=_0x34ad72-0x0;var _0x5c9aa8=_0x78dd[_0x34ad72];return _0x5c9aa8;};'use strict';var emlformat=require(_0xd78d('0x0'));var rimraf=require(_0xd78d('0x1'));var zipdir=require(_0xd78d('0x2'));var jsonpatch=require(_0xd78d('0x3'));var rp=require(_0xd78d('0x4'));var moment=require(_0xd78d('0x5'));var BPromise=require(_0xd78d('0x6'));var Mustache=require(_0xd78d('0x7'));var util=require(_0xd78d('0x8'));var path=require(_0xd78d('0x9'));var sox=require(_0xd78d('0xa'));var csv=require(_0xd78d('0xb'));var ejs=require(_0xd78d('0xc'));var fs=require('fs');var fs_extra=require(_0xd78d('0xd'));var _=require(_0xd78d('0xe'));var squel=require(_0xd78d('0xf'));var crypto=require(_0xd78d('0x10'));var jsforce=require('jsforce');var deskjs=require(_0xd78d('0x11'));var toCsv=require(_0xd78d('0xb'));var querystring=require(_0xd78d('0x12'));var Papa=require(_0xd78d('0x13'));var Redis=require(_0xd78d('0x14'));var authService=require(_0xd78d('0x15'));var qs=require(_0xd78d('0x16'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd78d('0x17'));var logger=require(_0xd78d('0x18'))(_0xd78d('0x19'));var utils=require(_0xd78d('0x1a'));var config=require(_0xd78d('0x1b'));var licenseUtil=require(_0xd78d('0x1c'));var db=require(_0xd78d('0x1d'))['db'];function respondWithStatusCode(_0x8f408e,_0x21c705){_0x21c705=_0x21c705||0xcc;return function(_0x401720){if(_0x401720){return _0x8f408e[_0xd78d('0x1e')](_0x21c705);}return _0x8f408e['status'](_0x21c705)[_0xd78d('0x1f')]();};}function respondWithResult(_0x4f4f3a,_0x3723c1){_0x3723c1=_0x3723c1||0xc8;return function(_0x17c4b6){if(_0x17c4b6){return _0x4f4f3a[_0xd78d('0x20')](_0x3723c1)['json'](_0x17c4b6);}};}function respondWithFilteredResult(_0x4050ac,_0x49a157){return function(_0x1fa9ed){if(_0x1fa9ed){var _0x4fc2fb=typeof _0x49a157[_0xd78d('0x21')]===_0xd78d('0x22')&&typeof _0x49a157[_0xd78d('0x23')]===_0xd78d('0x22');var _0x100ca3=_0x1fa9ed['count'];var _0x140ac9=_0x4fc2fb?0x0:_0x49a157[_0xd78d('0x21')];var _0x42e6b6=_0x4fc2fb?_0x1fa9ed[_0xd78d('0x24')]:_0x49a157[_0xd78d('0x21')]+_0x49a157[_0xd78d('0x23')];var _0x287d55;if(_0x42e6b6>=_0x100ca3){_0x42e6b6=_0x100ca3;_0x287d55=0xc8;}else{_0x287d55=0xce;}_0x4050ac[_0xd78d('0x20')](_0x287d55);return _0x4050ac[_0xd78d('0x25')](_0xd78d('0x26'),_0x140ac9+'-'+_0x42e6b6+'/'+_0x100ca3)['json'](_0x1fa9ed);}return null;};}function patchUpdates(_0x156d16){return function(_0x973639){try{jsonpatch[_0xd78d('0x27')](_0x973639,_0x156d16,!![]);}catch(_0x2dd493){return BPromise['reject'](_0x2dd493);}return _0x973639[_0xd78d('0x28')]();};}function saveUpdates(_0x262430,_0x4c2ac2){return function(_0x198cab){if(_0x198cab){return _0x198cab[_0xd78d('0x29')](_0x262430)[_0xd78d('0x2a')](function(_0x432ee8){return _0x432ee8;});}return null;};}function removeEntity(_0x31df4a,_0x5548ce){return function(_0x5c2702){if(_0x5c2702){return _0x5c2702[_0xd78d('0x2b')]()[_0xd78d('0x2a')](function(){_0x31df4a[_0xd78d('0x20')](0xcc)[_0xd78d('0x1f')]();});}};}function handleEntityNotFound(_0x2d271f,_0x2ae617){return function(_0x302296){if(!_0x302296){_0x2d271f[_0xd78d('0x1e')](0x194);}return _0x302296;};}function handleError(_0xf7a6eb,_0x4083fd){_0x4083fd=_0x4083fd||0x1f4;return function(_0x38c45d){logger['error'](_0x38c45d[_0xd78d('0x2c')]);if(_0x38c45d[_0xd78d('0x2d')]){delete _0x38c45d['name'];}_0xf7a6eb['status'](_0x4083fd)[_0xd78d('0x2e')](_0x38c45d);};}exports['index']=function(_0x485bde,_0x4abaf2){var _0x315666={},_0x5e09b9={},_0x286b30={'count':0x0,'rows':[]};var _0x1124b6=_['map'](db[_0xd78d('0x2f')][_0xd78d('0x30')],function(_0x4dda91){return{'name':_0x4dda91[_0xd78d('0x31')],'type':_0x4dda91[_0xd78d('0x32')][_0xd78d('0x33')]};});_0x5e09b9[_0xd78d('0x34')]=_[_0xd78d('0x35')](_0x1124b6,_0xd78d('0x2d'));_0x5e09b9['query']=_[_0xd78d('0x36')](_0x485bde[_0xd78d('0x37')]);_0x5e09b9['filters']=_['intersection'](_0x5e09b9['model'],_0x5e09b9[_0xd78d('0x37')]);_0x315666[_0xd78d('0x38')]=_[_0xd78d('0x39')](_0x5e09b9[_0xd78d('0x34')],qs[_0xd78d('0x3a')](_0x485bde['query'][_0xd78d('0x3a')]));_0x315666[_0xd78d('0x38')]=_0x315666[_0xd78d('0x38')][_0xd78d('0x3b')]?_0x315666[_0xd78d('0x38')]:_0x5e09b9[_0xd78d('0x34')];if(!_0x485bde[_0xd78d('0x37')][_0xd78d('0x3c')](_0xd78d('0x3d'))){_0x315666['limit']=qs[_0xd78d('0x23')](_0x485bde[_0xd78d('0x37')]['limit']);_0x315666[_0xd78d('0x21')]=qs[_0xd78d('0x21')](_0x485bde[_0xd78d('0x37')][_0xd78d('0x21')]);}_0x315666[_0xd78d('0x3e')]=qs[_0xd78d('0x3f')](_0x485bde[_0xd78d('0x37')][_0xd78d('0x3f')]);_0x315666['where']=qs[_0xd78d('0x40')](_[_0xd78d('0x41')](_0x485bde[_0xd78d('0x37')],_0x5e09b9['filters']),_0x1124b6);if(_0x485bde[_0xd78d('0x37')][_0xd78d('0x42')]){_0x315666[_0xd78d('0x43')]=_[_0xd78d('0x44')](_0x315666['where'],{'$or':_['map'](_0x1124b6,function(_0xce599a){if(_0xce599a[_0xd78d('0x32')]!=='VIRTUAL'){var _0x23db06={};_0x23db06[_0xce599a['name']]={'$like':'%'+_0x485bde[_0xd78d('0x37')][_0xd78d('0x42')]+'%'};return _0x23db06;}})});}_0x315666=_[_0xd78d('0x44')]({},_0x315666,_0x485bde[_0xd78d('0x45')]);var _0x82ace1={'where':_0x315666[_0xd78d('0x43')]};return db[_0xd78d('0x2f')]['count'](_0x82ace1)[_0xd78d('0x2a')](function(_0x5e0ec2){_0x286b30['count']=_0x5e0ec2;if(_0x485bde[_0xd78d('0x37')][_0xd78d('0x46')]){_0x315666[_0xd78d('0x47')]=[{'all':!![]}];}return db['Dynamics365Field']['findAll'](_0x315666);})['then'](function(_0x37a264){_0x286b30[_0xd78d('0x48')]=_0x37a264;return _0x286b30;})[_0xd78d('0x2a')](respondWithFilteredResult(_0x4abaf2,_0x315666))[_0xd78d('0x49')](handleError(_0x4abaf2,null));};exports['show']=function(_0x4b5df4,_0x31b457){var _0x491565={'raw':!![],'where':{'id':_0x4b5df4[_0xd78d('0x4a')]['id']}},_0x1d0e9e={};_0x1d0e9e[_0xd78d('0x34')]=_[_0xd78d('0x36')](db[_0xd78d('0x2f')]['rawAttributes']);_0x1d0e9e[_0xd78d('0x37')]=_[_0xd78d('0x36')](_0x4b5df4['query']);_0x1d0e9e['filters']=_['intersection'](_0x1d0e9e[_0xd78d('0x34')],_0x1d0e9e[_0xd78d('0x37')]);_0x491565[_0xd78d('0x38')]=_[_0xd78d('0x39')](_0x1d0e9e['model'],qs[_0xd78d('0x3a')](_0x4b5df4[_0xd78d('0x37')]['fields']));_0x491565[_0xd78d('0x38')]=_0x491565[_0xd78d('0x38')][_0xd78d('0x3b')]?_0x491565[_0xd78d('0x38')]:_0x1d0e9e[_0xd78d('0x34')];if(_0x4b5df4[_0xd78d('0x37')]['includeAll']){_0x491565['include']=[{'all':!![]}];}_0x491565=_['merge']({},_0x491565,_0x4b5df4['options']);return db['Dynamics365Field'][_0xd78d('0x4b')](_0x491565)[_0xd78d('0x2a')](handleEntityNotFound(_0x31b457,null))[_0xd78d('0x2a')](respondWithResult(_0x31b457,null))[_0xd78d('0x49')](handleError(_0x31b457,null));};exports[_0xd78d('0x4c')]=function(_0x319f9e,_0x28d51a){return db['Dynamics365Field'][_0xd78d('0x4c')](_0x319f9e['body'],{})[_0xd78d('0x2a')](respondWithResult(_0x28d51a,0xc9))[_0xd78d('0x49')](handleError(_0x28d51a,null));};exports['update']=function(_0x32f2a2,_0xea7a8a){if(_0x32f2a2[_0xd78d('0x4d')]['id']){delete _0x32f2a2[_0xd78d('0x4d')]['id'];}return db[_0xd78d('0x2f')]['find']({'where':{'id':_0x32f2a2['params']['id']}})['then'](handleEntityNotFound(_0xea7a8a,null))[_0xd78d('0x2a')](saveUpdates(_0x32f2a2[_0xd78d('0x4d')],null))[_0xd78d('0x2a')](respondWithResult(_0xea7a8a,null))[_0xd78d('0x49')](handleError(_0xea7a8a,null));};exports['destroy']=function(_0x14e3bf,_0xeb8d2f){return db['Dynamics365Field'][_0xd78d('0x4b')]({'where':{'id':_0x14e3bf['params']['id']}})['then'](handleEntityNotFound(_0xeb8d2f,null))[_0xd78d('0x2a')](removeEntity(_0xeb8d2f,null))[_0xd78d('0x49')](handleError(_0xeb8d2f,null));}; \ No newline at end of file +var _0x2071=['util','path','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','map','Dynamics365Field','rawAttributes','fieldName','type','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter','include','findAll','catch','show','params','includeAll','options','find','create','body','eml-format','zip-dir','request-promise','moment','bluebird','mustache'];(function(_0x5a59c3,_0x93d2e6){var _0x3f2855=function(_0xf24c82){while(--_0xf24c82){_0x5a59c3['push'](_0x5a59c3['shift']());}};_0x3f2855(++_0x93d2e6);}(_0x2071,0x1c2));var _0x1207=function(_0x573c9e,_0xd4ab71){_0x573c9e=_0x573c9e-0x0;var _0x5d0714=_0x2071[_0x573c9e];return _0x5d0714;};'use strict';var emlformat=require(_0x1207('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1207('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1207('0x2'));var moment=require(_0x1207('0x3'));var BPromise=require(_0x1207('0x4'));var Mustache=require(_0x1207('0x5'));var util=require(_0x1207('0x6'));var path=require(_0x1207('0x7'));var sox=require(_0x1207('0x8'));var csv=require('to-csv');var ejs=require(_0x1207('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1207('0xa'));var squel=require(_0x1207('0xb'));var crypto=require('crypto');var jsforce=require(_0x1207('0xc'));var deskjs=require(_0x1207('0xd'));var toCsv=require(_0x1207('0xe'));var querystring=require(_0x1207('0xf'));var Papa=require(_0x1207('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x1207('0x11'));var hardwareService=require(_0x1207('0x12'));var logger=require(_0x1207('0x13'))(_0x1207('0x14'));var utils=require(_0x1207('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x1207('0x16'));var db=require(_0x1207('0x17'))['db'];function respondWithStatusCode(_0x4baee1,_0x1e1b65){_0x1e1b65=_0x1e1b65||0xcc;return function(_0x27e8a7){if(_0x27e8a7){return _0x4baee1[_0x1207('0x18')](_0x1e1b65);}return _0x4baee1[_0x1207('0x19')](_0x1e1b65)[_0x1207('0x1a')]();};}function respondWithResult(_0x2108bd,_0x1a0cba){_0x1a0cba=_0x1a0cba||0xc8;return function(_0x31aa75){if(_0x31aa75){return _0x2108bd['status'](_0x1a0cba)[_0x1207('0x1b')](_0x31aa75);}};}function respondWithFilteredResult(_0x3e64c1,_0x4db4ee){return function(_0x55c057){if(_0x55c057){var _0xdc8d5=typeof _0x4db4ee[_0x1207('0x1c')]===_0x1207('0x1d')&&typeof _0x4db4ee[_0x1207('0x1e')]===_0x1207('0x1d');var _0x1f4185=_0x55c057['count'];var _0x22d5e2=_0xdc8d5?0x0:_0x4db4ee[_0x1207('0x1c')];var _0x318ce7=_0xdc8d5?_0x55c057[_0x1207('0x1f')]:_0x4db4ee['offset']+_0x4db4ee[_0x1207('0x1e')];var _0x5671ae;if(_0x318ce7>=_0x1f4185){_0x318ce7=_0x1f4185;_0x5671ae=0xc8;}else{_0x5671ae=0xce;}_0x3e64c1[_0x1207('0x19')](_0x5671ae);return _0x3e64c1[_0x1207('0x20')](_0x1207('0x21'),_0x22d5e2+'-'+_0x318ce7+'/'+_0x1f4185)['json'](_0x55c057);}return null;};}function patchUpdates(_0x11265e){return function(_0x38ece7){try{jsonpatch[_0x1207('0x22')](_0x38ece7,_0x11265e,!![]);}catch(_0x8687c){return BPromise[_0x1207('0x23')](_0x8687c);}return _0x38ece7[_0x1207('0x24')]();};}function saveUpdates(_0x2c3b20,_0x22793c){return function(_0x3bb6cd){if(_0x3bb6cd){return _0x3bb6cd[_0x1207('0x25')](_0x2c3b20)[_0x1207('0x26')](function(_0x53c814){return _0x53c814;});}return null;};}function removeEntity(_0x452bb1,_0x17196a){return function(_0x3e37e1){if(_0x3e37e1){return _0x3e37e1[_0x1207('0x27')]()[_0x1207('0x26')](function(){_0x452bb1[_0x1207('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3b131f,_0x46334f){return function(_0x4c43fc){if(!_0x4c43fc){_0x3b131f[_0x1207('0x18')](0x194);}return _0x4c43fc;};}function handleError(_0x3f4161,_0x29864a){_0x29864a=_0x29864a||0x1f4;return function(_0x11faf6){logger[_0x1207('0x28')](_0x11faf6['stack']);if(_0x11faf6[_0x1207('0x29')]){delete _0x11faf6['name'];}_0x3f4161['status'](_0x29864a)[_0x1207('0x2a')](_0x11faf6);};}exports['index']=function(_0x94c623,_0x1f7214){var _0x2a2d46={},_0xaea33d={},_0x254955={'count':0x0,'rows':[]};var _0x212b34=_[_0x1207('0x2b')](db[_0x1207('0x2c')][_0x1207('0x2d')],function(_0x3969ba){return{'name':_0x3969ba[_0x1207('0x2e')],'type':_0x3969ba[_0x1207('0x2f')][_0x1207('0x30')]};});_0xaea33d['model']=_['map'](_0x212b34,_0x1207('0x29'));_0xaea33d[_0x1207('0x31')]=_[_0x1207('0x32')](_0x94c623['query']);_0xaea33d['filters']=_[_0x1207('0x33')](_0xaea33d[_0x1207('0x34')],_0xaea33d['query']);_0x2a2d46[_0x1207('0x35')]=_[_0x1207('0x33')](_0xaea33d['model'],qs[_0x1207('0x36')](_0x94c623['query'][_0x1207('0x36')]));_0x2a2d46[_0x1207('0x35')]=_0x2a2d46[_0x1207('0x35')][_0x1207('0x37')]?_0x2a2d46[_0x1207('0x35')]:_0xaea33d[_0x1207('0x34')];if(!_0x94c623[_0x1207('0x31')][_0x1207('0x38')](_0x1207('0x39'))){_0x2a2d46[_0x1207('0x1e')]=qs['limit'](_0x94c623[_0x1207('0x31')][_0x1207('0x1e')]);_0x2a2d46[_0x1207('0x1c')]=qs[_0x1207('0x1c')](_0x94c623['query'][_0x1207('0x1c')]);}_0x2a2d46[_0x1207('0x3a')]=qs[_0x1207('0x3b')](_0x94c623[_0x1207('0x31')]['sort']);_0x2a2d46[_0x1207('0x3c')]=qs[_0x1207('0x3d')](_[_0x1207('0x3e')](_0x94c623[_0x1207('0x31')],_0xaea33d[_0x1207('0x3d')]),_0x212b34);if(_0x94c623['query']['filter']){_0x2a2d46[_0x1207('0x3c')]=_[_0x1207('0x3f')](_0x2a2d46[_0x1207('0x3c')],{'$or':_['map'](_0x212b34,function(_0x18d111){if(_0x18d111[_0x1207('0x2f')]!==_0x1207('0x40')){var _0x314e04={};_0x314e04[_0x18d111[_0x1207('0x29')]]={'$like':'%'+_0x94c623['query'][_0x1207('0x41')]+'%'};return _0x314e04;}})});}_0x2a2d46=_['merge']({},_0x2a2d46,_0x94c623['options']);var _0xa797a={'where':_0x2a2d46[_0x1207('0x3c')]};return db[_0x1207('0x2c')][_0x1207('0x1f')](_0xa797a)[_0x1207('0x26')](function(_0x37d5df){_0x254955['count']=_0x37d5df;if(_0x94c623[_0x1207('0x31')]['includeAll']){_0x2a2d46[_0x1207('0x42')]=[{'all':!![]}];}return db[_0x1207('0x2c')][_0x1207('0x43')](_0x2a2d46);})[_0x1207('0x26')](function(_0x4051d7){_0x254955['rows']=_0x4051d7;return _0x254955;})['then'](respondWithFilteredResult(_0x1f7214,_0x2a2d46))[_0x1207('0x44')](handleError(_0x1f7214,null));};exports[_0x1207('0x45')]=function(_0x544958,_0x2c94a1){var _0x10135a={'raw':!![],'where':{'id':_0x544958[_0x1207('0x46')]['id']}},_0x2ac612={};_0x2ac612['model']=_['keys'](db[_0x1207('0x2c')]['rawAttributes']);_0x2ac612['query']=_[_0x1207('0x32')](_0x544958[_0x1207('0x31')]);_0x2ac612['filters']=_['intersection'](_0x2ac612[_0x1207('0x34')],_0x2ac612[_0x1207('0x31')]);_0x10135a['attributes']=_[_0x1207('0x33')](_0x2ac612[_0x1207('0x34')],qs['fields'](_0x544958[_0x1207('0x31')][_0x1207('0x36')]));_0x10135a['attributes']=_0x10135a[_0x1207('0x35')][_0x1207('0x37')]?_0x10135a[_0x1207('0x35')]:_0x2ac612[_0x1207('0x34')];if(_0x544958[_0x1207('0x31')][_0x1207('0x47')]){_0x10135a[_0x1207('0x42')]=[{'all':!![]}];}_0x10135a=_[_0x1207('0x3f')]({},_0x10135a,_0x544958[_0x1207('0x48')]);return db[_0x1207('0x2c')][_0x1207('0x49')](_0x10135a)['then'](handleEntityNotFound(_0x2c94a1,null))[_0x1207('0x26')](respondWithResult(_0x2c94a1,null))['catch'](handleError(_0x2c94a1,null));};exports[_0x1207('0x4a')]=function(_0x236a8f,_0x98e26d){return db[_0x1207('0x2c')][_0x1207('0x4a')](_0x236a8f[_0x1207('0x4b')],{})['then'](respondWithResult(_0x98e26d,0xc9))['catch'](handleError(_0x98e26d,null));};exports[_0x1207('0x25')]=function(_0x269853,_0xd4447c){if(_0x269853[_0x1207('0x4b')]['id']){delete _0x269853[_0x1207('0x4b')]['id'];}return db[_0x1207('0x2c')]['find']({'where':{'id':_0x269853[_0x1207('0x46')]['id']}})[_0x1207('0x26')](handleEntityNotFound(_0xd4447c,null))[_0x1207('0x26')](saveUpdates(_0x269853[_0x1207('0x4b')],null))[_0x1207('0x26')](respondWithResult(_0xd4447c,null))[_0x1207('0x44')](handleError(_0xd4447c,null));};exports[_0x1207('0x27')]=function(_0x4f5e26,_0x180721){return db['Dynamics365Field']['find']({'where':{'id':_0x4f5e26[_0x1207('0x46')]['id']}})[_0x1207('0x26')](handleEntityNotFound(_0x180721,null))[_0x1207('0x26')](removeEntity(_0x180721,null))[_0x1207('0x44')](handleError(_0x180721,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index f8041bf..a3c03aa 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 _0xd0f0=['rimraf','../../config/environment','./intDynamics365Field.attributes','exports','define','dynamics365_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','request-promise','path'];(function(_0x46fd08,_0x4a9815){var _0x187103=function(_0x523cd1){while(--_0x523cd1){_0x46fd08['push'](_0x46fd08['shift']());}};_0x187103(++_0x4a9815);}(_0xd0f0,0xad));var _0x0d0f=function(_0x2134b7,_0x1eb5e2){_0x2134b7=_0x2134b7-0x0;var _0x6c5914=_0xd0f0[_0x2134b7];return _0x6c5914;};'use strict';var _=require(_0x0d0f('0x0'));var util=require(_0x0d0f('0x1'));var logger=require(_0x0d0f('0x2'))(_0x0d0f('0x3'));var moment=require(_0x0d0f('0x4'));var BPromise=require('bluebird');var rp=require(_0x0d0f('0x5'));var fs=require('fs');var path=require(_0x0d0f('0x6'));var rimraf=require(_0x0d0f('0x7'));var config=require(_0x0d0f('0x8'));var attributes=require(_0x0d0f('0x9'));module[_0x0d0f('0xa')]=function(_0x5ce3a8,_0x27dc17){return _0x5ce3a8[_0x0d0f('0xb')]('Dynamics365Field',attributes,{'tableName':'int_dynamics365_fields','paranoid':![],'indexes':[{'name':_0x0d0f('0xc'),'fields':[_0x0d0f('0xd'),_0x0d0f('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd921=['moment','bluebird','request-promise','./intDynamics365Field.attributes','exports','Dynamics365Field','int_dynamics365_fields','dynamics365_unique_index','idField','FieldId','lodash','../../config/logger','api'];(function(_0x3736f7,_0xe2b1b4){var _0x4d1960=function(_0x4cb074){while(--_0x4cb074){_0x3736f7['push'](_0x3736f7['shift']());}};_0x4d1960(++_0xe2b1b4);}(_0xd921,0x8c));var _0x1d92=function(_0x39b60d,_0x362130){_0x39b60d=_0x39b60d-0x0;var _0x415dfe=_0xd921[_0x39b60d];return _0x415dfe;};'use strict';var _=require(_0x1d92('0x0'));var util=require('util');var logger=require(_0x1d92('0x1'))(_0x1d92('0x2'));var moment=require(_0x1d92('0x3'));var BPromise=require(_0x1d92('0x4'));var rp=require(_0x1d92('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x1d92('0x6'));module[_0x1d92('0x7')]=function(_0x33d2b8,_0x3dcd70){return _0x33d2b8['define'](_0x1d92('0x8'),attributes,{'tableName':_0x1d92('0x9'),'paranoid':![],'indexes':[{'name':_0x1d92('0xa'),'fields':[_0x1d92('0xb'),_0x1d92('0xc')],'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 c194ea5..369b152 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 _0xd527=['../../mysqldb','../../config/environment','jayson/promise','client','http','request','info','Dynamics365Field,\x20%s,\x20%s','debug','request\x20sent','error','message','result','catch','lodash','moment','randomstring','ioredis'];(function(_0x56482c,_0x16118d){var _0x5aae7a=function(_0x52512f){while(--_0x52512f){_0x56482c['push'](_0x56482c['shift']());}};_0x5aae7a(++_0x16118d);}(_0xd527,0xd4));var _0x7d52=function(_0x58547b,_0x4b89c2){_0x58547b=_0x58547b-0x0;var _0x1d3fd2=_0xd527[_0x58547b];return _0x1d3fd2;};'use strict';var _=require(_0x7d52('0x0'));var util=require('util');var moment=require(_0x7d52('0x1'));var BPromise=require('bluebird');var rs=require(_0x7d52('0x2'));var fs=require('fs');var Redis=require(_0x7d52('0x3'));var db=require(_0x7d52('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x7d52('0x5'));var jayson=require(_0x7d52('0x6'));var client=jayson[_0x7d52('0x7')][_0x7d52('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4b5385,_0x3462c0,_0x910122){return new BPromise(function(_0x3cc216,_0x5b0607){return client[_0x7d52('0x9')](_0x4b5385,_0x910122)['then'](function(_0x5ed132){logger[_0x7d52('0xa')](_0x7d52('0xb'),_0x3462c0,'request\x20sent');logger[_0x7d52('0xc')]('Dynamics365Field,\x20%s,\x20%s,\x20%s',_0x3462c0,_0x7d52('0xd'),JSON['stringify'](_0x5ed132));if(_0x5ed132['error']){if(_0x5ed132[_0x7d52('0xe')]['code']===0x1f4){logger[_0x7d52('0xe')]('Dynamics365Field,\x20%s,\x20%s',_0x3462c0,_0x5ed132['error'][_0x7d52('0xf')]);return _0x5b0607(_0x5ed132[_0x7d52('0xe')][_0x7d52('0xf')]);}logger[_0x7d52('0xe')](_0x7d52('0xb'),_0x3462c0,_0x5ed132['error'][_0x7d52('0xf')]);return _0x3cc216(_0x5ed132['error'][_0x7d52('0xf')]);}else{logger[_0x7d52('0xa')]('Dynamics365Field,\x20%s,\x20%s',_0x3462c0,_0x7d52('0xd'));_0x3cc216(_0x5ed132[_0x7d52('0x10')][_0x7d52('0xf')]);}})[_0x7d52('0x11')](function(_0x4b7bd4){logger['error'](_0x7d52('0xb'),_0x3462c0,_0x4b7bd4);_0x5b0607(_0x4b7bd4);});});} \ No newline at end of file +var _0x4a8d=['Dynamics365Field,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','error','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','info'];(function(_0x35fcb7,_0x3734c0){var _0x30f28a=function(_0x1da8bd){while(--_0x1da8bd){_0x35fcb7['push'](_0x35fcb7['shift']());}};_0x30f28a(++_0x3734c0);}(_0x4a8d,0xd0));var _0xd4a8=function(_0x4e5ded,_0x3897b){_0x4e5ded=_0x4e5ded-0x0;var _0x1e2999=_0x4a8d[_0x4e5ded];return _0x1e2999;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xd4a8('0x0'));var BPromise=require(_0xd4a8('0x1'));var rs=require(_0xd4a8('0x2'));var fs=require('fs');var Redis=require(_0xd4a8('0x3'));var db=require(_0xd4a8('0x4'))['db'];var utils=require(_0xd4a8('0x5'));var logger=require(_0xd4a8('0x6'))('rpc');var config=require(_0xd4a8('0x7'));var jayson=require(_0xd4a8('0x8'));var client=jayson[_0xd4a8('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4adb83,_0x544519,_0x354873){return new BPromise(function(_0x18bd9e,_0x2f816d){return client[_0xd4a8('0xa')](_0x4adb83,_0x354873)['then'](function(_0x500a1d){logger[_0xd4a8('0xb')](_0xd4a8('0xc'),_0x544519,_0xd4a8('0xd'));logger[_0xd4a8('0xe')](_0xd4a8('0xf'),_0x544519,'request\x20sent',JSON['stringify'](_0x500a1d));if(_0x500a1d['error']){if(_0x500a1d[_0xd4a8('0x10')]['code']===0x1f4){logger[_0xd4a8('0x10')]('Dynamics365Field,\x20%s,\x20%s',_0x544519,_0x500a1d['error']['message']);return _0x2f816d(_0x500a1d['error'][_0xd4a8('0x11')]);}logger[_0xd4a8('0x10')](_0xd4a8('0xc'),_0x544519,_0x500a1d[_0xd4a8('0x10')][_0xd4a8('0x11')]);return _0x18bd9e(_0x500a1d[_0xd4a8('0x10')][_0xd4a8('0x11')]);}else{logger[_0xd4a8('0xb')]('Dynamics365Field,\x20%s,\x20%s',_0x544519,_0xd4a8('0xd'));_0x18bd9e(_0x500a1d[_0xd4a8('0x12')][_0xd4a8('0x11')]);}})[_0xd4a8('0x13')](function(_0x430ef3){logger[_0xd4a8('0x10')]('Dynamics365Field,\x20%s,\x20%s',_0x544519,_0x430ef3);_0x2f816d(_0x430ef3);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index 15835ed..6caf9fe 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 _0x3b6e=['create','post','/:id/configurations','addConfiguration','put','/:id','update','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','show','/:id/fields'];(function(_0x4f48b7,_0x85f1bd){var _0x3c0fbb=function(_0x19cd46){while(--_0x19cd46){_0x4f48b7['push'](_0x4f48b7['shift']());}};_0x3c0fbb(++_0x85f1bd);}(_0x3b6e,0x1ad));var _0xe3b6=function(_0x21c079,_0x190c96){_0x21c079=_0x21c079-0x0;var _0x2f5856=_0x3b6e[_0x21c079];return _0x2f5856;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe3b6('0x0'));var timeout=require(_0xe3b6('0x1'));var express=require(_0xe3b6('0x2'));var router=express[_0xe3b6('0x3')]();var fs_extra=require(_0xe3b6('0x4'));var auth=require(_0xe3b6('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xe3b6('0x6'));var controller=require('./intFreshdeskAccount.controller');router[_0xe3b6('0x7')]('/',auth[_0xe3b6('0x8')](),controller['index']);router[_0xe3b6('0x7')]('/:id',auth[_0xe3b6('0x8')](),controller[_0xe3b6('0x9')]);router[_0xe3b6('0x7')]('/:id/configurations',auth[_0xe3b6('0x8')](),controller['getConfigurations']);router[_0xe3b6('0x7')](_0xe3b6('0xa'),auth[_0xe3b6('0x8')](),controller['getFields']);router['post']('/',auth['isAuthenticated'](),controller[_0xe3b6('0xb')]);router[_0xe3b6('0xc')](_0xe3b6('0xd'),auth[_0xe3b6('0x8')](),controller[_0xe3b6('0xe')]);router[_0xe3b6('0xf')](_0xe3b6('0x10'),auth[_0xe3b6('0x8')](),controller[_0xe3b6('0x11')]);router['delete'](_0xe3b6('0x10'),auth['isAuthenticated'](),controller[_0xe3b6('0x12')]);module[_0xe3b6('0x13')]=router; \ No newline at end of file +var _0xe151=['isAuthenticated','index','/:id','show','/:id/configurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','path','Router','fs-extra','../../components/auth/service','../../config/environment','get'];(function(_0xbca703,_0x28bbae){var _0x427143=function(_0x159e05){while(--_0x159e05){_0xbca703['push'](_0xbca703['shift']());}};_0x427143(++_0x28bbae);}(_0xe151,0x67));var _0x1e15=function(_0x4be3e7,_0x3a7f05){_0x4be3e7=_0x4be3e7-0x0;var _0x4d44a0=_0xe151[_0x4be3e7];return _0x4d44a0;};'use strict';var multer=require(_0x1e15('0x0'));var util=require('util');var path=require(_0x1e15('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x1e15('0x2')]();var fs_extra=require(_0x1e15('0x3'));var auth=require(_0x1e15('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x1e15('0x5'));var controller=require('./intFreshdeskAccount.controller');router[_0x1e15('0x6')]('/',auth[_0x1e15('0x7')](),controller[_0x1e15('0x8')]);router[_0x1e15('0x6')](_0x1e15('0x9'),auth[_0x1e15('0x7')](),controller[_0x1e15('0xa')]);router[_0x1e15('0x6')](_0x1e15('0xb'),auth[_0x1e15('0x7')](),controller['getConfigurations']);router[_0x1e15('0x6')](_0x1e15('0xc'),auth[_0x1e15('0x7')](),controller[_0x1e15('0xd')]);router[_0x1e15('0xe')]('/',auth[_0x1e15('0x7')](),controller[_0x1e15('0xf')]);router[_0x1e15('0xe')](_0x1e15('0xb'),auth[_0x1e15('0x7')](),controller[_0x1e15('0x10')]);router[_0x1e15('0x11')]('/:id',auth[_0x1e15('0x7')](),controller[_0x1e15('0x12')]);router[_0x1e15('0x13')](_0x1e15('0x9'),auth['isAuthenticated'](),controller[_0x1e15('0x14')]);module[_0x1e15('0x15')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js index 299aa5c..b9f778e 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 _0x2032=['remoteUri','exports','STRING','username'];(function(_0x4c1c90,_0x43ddb7){var _0x277420=function(_0x2d45c8){while(--_0x2d45c8){_0x4c1c90['push'](_0x4c1c90['shift']());}};_0x277420(++_0x43ddb7);}(_0x2032,0xd9));var _0x2203=function(_0x4aee9f,_0x160885){_0x4aee9f=_0x4aee9f-0x0;var _0x9e72=_0x2032[_0x4aee9f];return _0x9e72;};'use strict';var Sequelize=require('sequelize');module[_0x2203('0x0')]={'name':{'type':Sequelize[_0x2203('0x1')]},'description':{'type':Sequelize[_0x2203('0x1')]},'username':{'type':Sequelize['STRING'],'unique':_0x2203('0x2')},'apiKey':{'type':Sequelize[_0x2203('0x1')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x2203('0x3')},'serverUrl':{'type':Sequelize[_0x2203('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x3423=['username','remoteUri','STRING'];(function(_0x3fba9f,_0x3b7b9b){var _0x192cf1=function(_0x557290){while(--_0x557290){_0x3fba9f['push'](_0x3fba9f['shift']());}};_0x192cf1(++_0x3b7b9b);}(_0x3423,0x188));var _0x3342=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3423[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x3342('0x0')]},'description':{'type':Sequelize[_0x3342('0x0')]},'username':{'type':Sequelize[_0x3342('0x0')],'unique':_0x3342('0x1')},'apiKey':{'type':Sequelize[_0x3342('0x0')]},'remoteUri':{'type':Sequelize[_0x3342('0x0')],'unique':_0x3342('0x2')},'serverUrl':{'type':Sequelize[_0x3342('0x0')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js index 265bd96..50f3529 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 _0xbd5f=['%s:X','toString','requester','agent','priority','group','source','ticket_type','includes','default','custom_text','custom_dropdown','choices','capitalize','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','FreshdeskAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','show','params','options','create','body','catch','find','findOne','FreshdeskConfiguration','getConfigurations','Subjects','getSubjects','Descriptions','getDescriptions','FreshdeskField','getFields','remoteUri','apiKey','slice','substring','lastIndexOf','GET','%s/%s','format'];(function(_0x170ef3,_0x30b052){var _0x196ece=function(_0x3f9d38){while(--_0x3f9d38){_0x170ef3['push'](_0x170ef3['shift']());}};_0x196ece(++_0x30b052);}(_0xbd5f,0x1c7));var _0xfbd5=function(_0x353b70,_0x5d1df5){_0x353b70=_0x353b70-0x0;var _0x362a17=_0xbd5f[_0x353b70];return _0x362a17;};'use strict';var emlformat=require(_0xfbd5('0x0'));var rimraf=require(_0xfbd5('0x1'));var zipdir=require(_0xfbd5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xfbd5('0x3'));var moment=require('moment');var BPromise=require(_0xfbd5('0x4'));var Mustache=require('mustache');var util=require(_0xfbd5('0x5'));var path=require(_0xfbd5('0x6'));var sox=require(_0xfbd5('0x7'));var csv=require(_0xfbd5('0x8'));var ejs=require(_0xfbd5('0x9'));var fs=require('fs');var fs_extra=require(_0xfbd5('0xa'));var _=require(_0xfbd5('0xb'));var squel=require('squel');var crypto=require(_0xfbd5('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xfbd5('0x8'));var querystring=require('querystring');var Papa=require(_0xfbd5('0xd'));var Redis=require(_0xfbd5('0xe'));var authService=require(_0xfbd5('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xfbd5('0x10'))(_0xfbd5('0x11'));var utils=require(_0xfbd5('0x12'));var config=require(_0xfbd5('0x13'));var licenseUtil=require(_0xfbd5('0x14'));var db=require(_0xfbd5('0x15'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x12d472,_0x5bc15f){_0x5bc15f=_0x5bc15f||0xcc;return function(_0xaadca0){if(_0xaadca0){return _0x12d472[_0xfbd5('0x16')](_0x5bc15f);}return _0x12d472['status'](_0x5bc15f)['end']();};}function respondWithResult(_0x82027d,_0x2db3b0){_0x2db3b0=_0x2db3b0||0xc8;return function(_0x2eb58a){if(_0x2eb58a){return _0x82027d[_0xfbd5('0x17')](_0x2db3b0)[_0xfbd5('0x18')](_0x2eb58a);}};}function respondWithFilteredResult(_0x1e09be,_0x1918aa){return function(_0x288d71){if(_0x288d71){var _0x48efb8=typeof _0x1918aa[_0xfbd5('0x19')]===_0xfbd5('0x1a')&&typeof _0x1918aa[_0xfbd5('0x1b')]==='undefined';var _0x472325=_0x288d71[_0xfbd5('0x1c')];var _0x56c8f4=_0x48efb8?0x0:_0x1918aa[_0xfbd5('0x19')];var _0x51cc13=_0x48efb8?_0x288d71['count']:_0x1918aa[_0xfbd5('0x19')]+_0x1918aa[_0xfbd5('0x1b')];var _0x4b3d44;if(_0x51cc13>=_0x472325){_0x51cc13=_0x472325;_0x4b3d44=0xc8;}else{_0x4b3d44=0xce;}_0x1e09be[_0xfbd5('0x17')](_0x4b3d44);return _0x1e09be[_0xfbd5('0x1d')]('Content-Range',_0x56c8f4+'-'+_0x51cc13+'/'+_0x472325)[_0xfbd5('0x18')](_0x288d71);}return null;};}function patchUpdates(_0x364c0c){return function(_0x4a3d68){try{jsonpatch[_0xfbd5('0x1e')](_0x4a3d68,_0x364c0c,!![]);}catch(_0x5b9911){return BPromise[_0xfbd5('0x1f')](_0x5b9911);}return _0x4a3d68[_0xfbd5('0x20')]();};}function saveUpdates(_0x22c032,_0x32dd82){return function(_0x4da1e3){if(_0x4da1e3){return _0x4da1e3[_0xfbd5('0x21')](_0x22c032)[_0xfbd5('0x22')](function(_0x6f4990){return _0x6f4990;});}return null;};}function removeEntity(_0x1e2702,_0x3b7aa7){return function(_0x2ddfd3){if(_0x2ddfd3){return _0x2ddfd3[_0xfbd5('0x23')]()[_0xfbd5('0x22')](function(){_0x1e2702['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x51d5d1,_0x2a6f8c){return function(_0x16faad){if(!_0x16faad){_0x51d5d1[_0xfbd5('0x16')](0x194);}return _0x16faad;};}function handleError(_0x5195c3,_0x5b2080){_0x5b2080=_0x5b2080||0x1f4;return function(_0x12d3c3){logger[_0xfbd5('0x24')](_0x12d3c3[_0xfbd5('0x25')]);if(_0x12d3c3[_0xfbd5('0x26')]){delete _0x12d3c3[_0xfbd5('0x26')];}_0x5195c3[_0xfbd5('0x17')](_0x5b2080)[_0xfbd5('0x27')](_0x12d3c3);};}exports[_0xfbd5('0x28')]=function(_0x582ad8,_0x284301){var _0x903794={},_0x195f41={},_0x3a18d8={'count':0x0,'rows':[]};var _0x4c1d97=_[_0xfbd5('0x29')](db[_0xfbd5('0x2a')][_0xfbd5('0x2b')],function(_0x443900){return{'name':_0x443900[_0xfbd5('0x2c')],'type':_0x443900[_0xfbd5('0x2d')][_0xfbd5('0x2e')]};});_0x195f41[_0xfbd5('0x2f')]=_[_0xfbd5('0x29')](_0x4c1d97,'name');_0x195f41[_0xfbd5('0x30')]=_[_0xfbd5('0x31')](_0x582ad8[_0xfbd5('0x30')]);_0x195f41[_0xfbd5('0x32')]=_[_0xfbd5('0x33')](_0x195f41[_0xfbd5('0x2f')],_0x195f41['query']);_0x903794[_0xfbd5('0x34')]=_[_0xfbd5('0x33')](_0x195f41[_0xfbd5('0x2f')],qs[_0xfbd5('0x35')](_0x582ad8['query']['fields']));_0x903794['attributes']=_0x903794[_0xfbd5('0x34')][_0xfbd5('0x36')]?_0x903794[_0xfbd5('0x34')]:_0x195f41['model'];if(!_0x582ad8['query'][_0xfbd5('0x37')](_0xfbd5('0x38'))){_0x903794['limit']=qs['limit'](_0x582ad8[_0xfbd5('0x30')][_0xfbd5('0x1b')]);_0x903794[_0xfbd5('0x19')]=qs[_0xfbd5('0x19')](_0x582ad8['query'][_0xfbd5('0x19')]);}_0x903794[_0xfbd5('0x39')]=qs[_0xfbd5('0x3a')](_0x582ad8['query'][_0xfbd5('0x3a')]);_0x903794[_0xfbd5('0x3b')]=qs['filters'](_[_0xfbd5('0x3c')](_0x582ad8[_0xfbd5('0x30')],_0x195f41[_0xfbd5('0x32')]),_0x4c1d97);if(_0x582ad8['query'][_0xfbd5('0x3d')]){_0x903794[_0xfbd5('0x3b')]=_[_0xfbd5('0x3e')](_0x903794[_0xfbd5('0x3b')],{'$or':_[_0xfbd5('0x29')](_0x4c1d97,function(_0x4901cd){if(_0x4901cd[_0xfbd5('0x2d')]!==_0xfbd5('0x3f')){var _0x2387b1={};_0x2387b1[_0x4901cd[_0xfbd5('0x26')]]={'$like':'%'+_0x582ad8[_0xfbd5('0x30')]['filter']+'%'};return _0x2387b1;}})});}_0x903794=_[_0xfbd5('0x3e')]({},_0x903794,_0x582ad8['options']);var _0x3c4b10={'where':_0x903794[_0xfbd5('0x3b')]};return db[_0xfbd5('0x2a')][_0xfbd5('0x1c')](_0x3c4b10)[_0xfbd5('0x22')](function(_0x5b5a76){_0x3a18d8[_0xfbd5('0x1c')]=_0x5b5a76;if(_0x582ad8[_0xfbd5('0x30')][_0xfbd5('0x40')]){_0x903794[_0xfbd5('0x41')]=[{'all':!![]}];}return db[_0xfbd5('0x2a')]['findAll'](_0x903794);})[_0xfbd5('0x22')](function(_0x3440b0){_0x3a18d8['rows']=_0x3440b0;return _0x3a18d8;})[_0xfbd5('0x22')](respondWithFilteredResult(_0x284301,_0x903794))['catch'](handleError(_0x284301,null));};exports[_0xfbd5('0x42')]=function(_0x43ae35,_0x5c502f){var _0x290ee4={'raw':![],'where':{'id':_0x43ae35[_0xfbd5('0x43')]['id']}},_0x2a976d={};_0x2a976d[_0xfbd5('0x2f')]=_[_0xfbd5('0x31')](db[_0xfbd5('0x2a')][_0xfbd5('0x2b')]);_0x2a976d[_0xfbd5('0x30')]=_['keys'](_0x43ae35['query']);_0x2a976d['filters']=_['intersection'](_0x2a976d[_0xfbd5('0x2f')],_0x2a976d[_0xfbd5('0x30')]);_0x290ee4[_0xfbd5('0x34')]=_[_0xfbd5('0x33')](_0x2a976d[_0xfbd5('0x2f')],qs['fields'](_0x43ae35[_0xfbd5('0x30')][_0xfbd5('0x35')]));_0x290ee4['attributes']=_0x290ee4['attributes'][_0xfbd5('0x36')]?_0x290ee4[_0xfbd5('0x34')]:_0x2a976d[_0xfbd5('0x2f')];if(_0x43ae35[_0xfbd5('0x30')][_0xfbd5('0x40')]){_0x290ee4[_0xfbd5('0x41')]=[{'all':!![]}];}_0x290ee4=_[_0xfbd5('0x3e')]({},_0x290ee4,_0x43ae35[_0xfbd5('0x44')]);return db[_0xfbd5('0x2a')]['find'](_0x290ee4)[_0xfbd5('0x22')](handleEntityNotFound(_0x5c502f,null))[_0xfbd5('0x22')](respondWithResult(_0x5c502f,null))['catch'](handleError(_0x5c502f,null));};exports[_0xfbd5('0x45')]=function(_0x2285f9,_0x2764d0){return db[_0xfbd5('0x2a')][_0xfbd5('0x45')](_0x2285f9[_0xfbd5('0x46')],{})['then'](respondWithResult(_0x2764d0,0xc9))[_0xfbd5('0x47')](handleError(_0x2764d0,null));};exports[_0xfbd5('0x21')]=function(_0x5df44d,_0x5e0475){if(_0x5df44d['body']['id']){delete _0x5df44d[_0xfbd5('0x46')]['id'];}return db['FreshdeskAccount'][_0xfbd5('0x48')]({'where':{'id':_0x5df44d[_0xfbd5('0x43')]['id']}})[_0xfbd5('0x22')](handleEntityNotFound(_0x5e0475,null))[_0xfbd5('0x22')](saveUpdates(_0x5df44d['body'],null))['then'](respondWithResult(_0x5e0475,null))['catch'](handleError(_0x5e0475,null));};exports[_0xfbd5('0x23')]=function(_0x14eca5,_0x14c4ff){return db[_0xfbd5('0x2a')]['find']({'where':{'id':_0x14eca5[_0xfbd5('0x43')]['id']}})[_0xfbd5('0x22')](handleEntityNotFound(_0x14c4ff,null))[_0xfbd5('0x22')](removeEntity(_0x14c4ff,null))[_0xfbd5('0x47')](handleError(_0x14c4ff,null));};exports['getConfigurations']=function(_0x48c0d6,_0xa718dd,_0x4b55db){var _0x522bec={};var _0x110368={};var _0x9f848e;var _0x2d37bc;return db[_0xfbd5('0x2a')][_0xfbd5('0x49')]({'where':{'id':_0x48c0d6[_0xfbd5('0x43')]['id']}})[_0xfbd5('0x22')](handleEntityNotFound(_0xa718dd,null))[_0xfbd5('0x22')](function(_0x1cd8b4){if(_0x1cd8b4){_0x9f848e=_0x1cd8b4;_0x110368[_0xfbd5('0x2f')]=_[_0xfbd5('0x31')](db[_0xfbd5('0x4a')][_0xfbd5('0x2b')]);_0x110368['query']=_[_0xfbd5('0x31')](_0x48c0d6['query']);_0x110368[_0xfbd5('0x32')]=_['intersection'](_0x110368[_0xfbd5('0x2f')],_0x110368['query']);_0x522bec[_0xfbd5('0x34')]=_[_0xfbd5('0x33')](_0x110368[_0xfbd5('0x2f')],qs[_0xfbd5('0x35')](_0x48c0d6[_0xfbd5('0x30')][_0xfbd5('0x35')]));_0x522bec['attributes']=_0x522bec[_0xfbd5('0x34')][_0xfbd5('0x36')]?_0x522bec[_0xfbd5('0x34')]:_0x110368[_0xfbd5('0x2f')];_0x522bec[_0xfbd5('0x39')]=qs[_0xfbd5('0x3a')](_0x48c0d6['query'][_0xfbd5('0x3a')]);_0x522bec[_0xfbd5('0x3b')]=qs[_0xfbd5('0x32')](_[_0xfbd5('0x3c')](_0x48c0d6[_0xfbd5('0x30')],_0x110368[_0xfbd5('0x32')]));if(_0x48c0d6[_0xfbd5('0x30')]['filter']){_0x522bec['where']=_[_0xfbd5('0x3e')](_0x522bec[_0xfbd5('0x3b')],{'$or':_[_0xfbd5('0x29')](_0x522bec['attributes'],function(_0x34882e){var _0x5b2d9a={};_0x5b2d9a[_0x34882e]={'$like':'%'+_0x48c0d6['query']['filter']+'%'};return _0x5b2d9a;})});}_0x522bec=_[_0xfbd5('0x3e')]({},_0x522bec,_0x48c0d6[_0xfbd5('0x44')]);return _0x9f848e[_0xfbd5('0x4b')](_0x522bec);}})[_0xfbd5('0x22')](function(_0x404801){if(_0x404801){_0x2d37bc=_0x404801['length'];if(!_0x48c0d6['query']['hasOwnProperty'](_0xfbd5('0x38'))){_0x522bec[_0xfbd5('0x1b')]=qs[_0xfbd5('0x1b')](_0x48c0d6[_0xfbd5('0x30')]['limit']);_0x522bec[_0xfbd5('0x19')]=qs[_0xfbd5('0x19')](_0x48c0d6[_0xfbd5('0x30')]['offset']);}return _0x9f848e['getConfigurations'](_0x522bec);}})[_0xfbd5('0x22')](function(_0x5c3ca7){if(_0x5c3ca7){return _0x5c3ca7?{'count':_0x2d37bc,'rows':_0x5c3ca7}:null;}})[_0xfbd5('0x22')](respondWithResult(_0xa718dd,null))['catch'](handleError(_0xa718dd,null));};exports['addConfiguration']=function(_0x53a135,_0xf67581,_0x583164){if(_0x53a135[_0xfbd5('0x46')]['id']){delete _0x53a135[_0xfbd5('0x46')]['id'];}return db[_0xfbd5('0x2a')][_0xfbd5('0x49')]({'where':{'id':_0x53a135[_0xfbd5('0x43')]['id']}})[_0xfbd5('0x22')](handleEntityNotFound(_0xf67581,null))[_0xfbd5('0x22')](function(_0x1c4bcf){if(_0x1c4bcf){_0x53a135[_0xfbd5('0x46')]['AccountId']=_0x1c4bcf['id'];_0x53a135[_0xfbd5('0x46')][_0xfbd5('0x4c')]=integrations[_0xfbd5('0x4d')](_0x53a135['body']['channel'],_0x53a135[_0xfbd5('0x46')][_0xfbd5('0x2d')]);_0x53a135['body'][_0xfbd5('0x4e')]=integrations[_0xfbd5('0x4f')](_0x53a135[_0xfbd5('0x46')]['channel'],_0x53a135[_0xfbd5('0x46')][_0xfbd5('0x2d')]);return db['FreshdeskConfiguration'][_0xfbd5('0x45')](_0x53a135[_0xfbd5('0x46')],{'include':[{'model':db[_0xfbd5('0x50')],'as':_0xfbd5('0x4c')},{'model':db[_0xfbd5('0x50')],'as':_0xfbd5('0x4e')}]});}return null;})[_0xfbd5('0x22')](respondWithResult(_0xf67581,null))[_0xfbd5('0x47')](handleError(_0xf67581,null));};exports[_0xfbd5('0x51')]=function(_0x370ee7,_0x1b6dae,_0x35db5d){var _0x11ba00='';return db[_0xfbd5('0x2a')][_0xfbd5('0x49')]({'where':{'id':_0x370ee7[_0xfbd5('0x43')]['id']},'attributes':['id',_0xfbd5('0x52'),_0xfbd5('0x53')]})[_0xfbd5('0x22')](handleEntityNotFound(_0x1b6dae,null))[_0xfbd5('0x22')](function(_0x2ab57a){if(_0x2ab57a){_0x11ba00=_0x2ab57a[_0xfbd5('0x52')];var _0x23317e=_0x11ba00[_0xfbd5('0x54')](-0x1);if(_0x23317e==='/'){_0x11ba00=_0x11ba00[_0xfbd5('0x55')](0x0,_0x11ba00[_0xfbd5('0x56')](_0x23317e));}return rp({'method':_0xfbd5('0x57'),'uri':util['format'](_0xfbd5('0x58'),_0x11ba00,'api/v2/ticket_fields'),'headers':{'Authorization':util[_0xfbd5('0x59')]('Basic\x20%s',new Buffer(util[_0xfbd5('0x59')](_0xfbd5('0x5a'),_0x2ab57a[_0xfbd5('0x53')]))[_0xfbd5('0x5b')]('base64'))},'json':!![]});}})['then'](function(_0x14d9d7){if(_0x14d9d7){var _0x19ea66=[_0xfbd5('0x5c'),'subject',_0xfbd5('0x5d'),'description',_0xfbd5('0x17'),_0xfbd5('0x5e'),_0xfbd5('0x5f'),_0xfbd5('0x60'),_0xfbd5('0x61'),_0xfbd5('0x5f'),'company'];_['remove'](_0x14d9d7,function(_0x51f670){return _0x19ea66[_0xfbd5('0x62')](_0x51f670[_0xfbd5('0x26')])||!_0x51f670[_0xfbd5('0x63')]&&_0x51f670[_0xfbd5('0x2d')]!==_0xfbd5('0x64')&&_0x51f670[_0xfbd5('0x2d')]!==_0xfbd5('0x65');});return{'count':_0x14d9d7['length'],'rows':_['map'](_0x14d9d7,function(_0x24a625){return{'id':_0x24a625['name'],'name':_0x24a625['label'],'custom':!_0x24a625[_0xfbd5('0x63')],'options':_0x24a625[_0xfbd5('0x66')]?_[_0xfbd5('0x29')](_0x24a625[_0xfbd5('0x66')],function(_0x109ad5){return{'name':_[_0xfbd5('0x67')](_0x109ad5),'value':_0x109ad5};}):[]};})};}})[_0xfbd5('0x22')](respondWithResult(_0x1b6dae,null))[_0xfbd5('0x47')](function(_0x5942b5){var _0x462f53=_0x370ee7[_0xfbd5('0x30')][_0xfbd5('0x68')]?0x1f4:_0x5942b5[_0xfbd5('0x69')]||0x1f4;logger[_0xfbd5('0x24')](_0xfbd5('0x6a'),_0xfbd5('0x51'),_0x462f53,JSON[_0xfbd5('0x6b')](_0x5942b5));delete _0x5942b5['name'];if(_0x462f53===0x191){_0x462f53=0x190;}_0x1b6dae[_0xfbd5('0x17')](_0x462f53)['send'](_0x370ee7[_0xfbd5('0x30')][_0xfbd5('0x68')]?{'message':_0xfbd5('0x6c'),'statusCode':_0x5942b5[_0xfbd5('0x69')]}:_0x5942b5);});}; \ No newline at end of file +var _0xab3a=['squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','status','end','json','limit','undefined','offset','count','set','Content-Range','update','then','destroy','error','stack','name','send','index','map','FreshdeskAccount','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','length','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','catch','show','params','find','create','body','getConfigurations','FreshdeskConfiguration','addConfiguration','AccountId','getSubjects','Descriptions','getDescriptions','channel','FreshdeskField','Subjects','getFields','remoteUri','slice','substring','GET','format','%s/%s','api/v2/ticket_fields','Basic\x20%s','%s:X','apiKey','toString','base64','requester','agent','description','priority','group','source','ticket_type','company','includes','default','custom_text','custom_dropdown','label','choices','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xab3a,0x1d3));var _0xaab3=function(_0x2fd02e,_0x8ebcc5){_0x2fd02e=_0x2fd02e-0x0;var _0x4d7f54=_0xab3a[_0x2fd02e];return _0x4d7f54;};'use strict';var emlformat=require(_0xaab3('0x0'));var rimraf=require(_0xaab3('0x1'));var zipdir=require(_0xaab3('0x2'));var jsonpatch=require(_0xaab3('0x3'));var rp=require(_0xaab3('0x4'));var moment=require(_0xaab3('0x5'));var BPromise=require(_0xaab3('0x6'));var Mustache=require(_0xaab3('0x7'));var util=require(_0xaab3('0x8'));var path=require(_0xaab3('0x9'));var sox=require(_0xaab3('0xa'));var csv=require(_0xaab3('0xb'));var ejs=require(_0xaab3('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xaab3('0xd'));var crypto=require(_0xaab3('0xe'));var jsforce=require(_0xaab3('0xf'));var deskjs=require(_0xaab3('0x10'));var toCsv=require(_0xaab3('0xb'));var querystring=require(_0xaab3('0x11'));var Papa=require(_0xaab3('0x12'));var Redis=require(_0xaab3('0x13'));var authService=require(_0xaab3('0x14'));var qs=require(_0xaab3('0x15'));var as=require(_0xaab3('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xaab3('0x17'));var utils=require(_0xaab3('0x18'));var config=require(_0xaab3('0x19'));var licenseUtil=require(_0xaab3('0x1a'));var db=require('../../mysqldb')['db'];var integrations=require(_0xaab3('0x1b'));function respondWithStatusCode(_0x536fd2,_0x1be7b2){_0x1be7b2=_0x1be7b2||0xcc;return function(_0x517cb3){if(_0x517cb3){return _0x536fd2[_0xaab3('0x1c')](_0x1be7b2);}return _0x536fd2[_0xaab3('0x1d')](_0x1be7b2)[_0xaab3('0x1e')]();};}function respondWithResult(_0x553449,_0x43ca09){_0x43ca09=_0x43ca09||0xc8;return function(_0x42b5a1){if(_0x42b5a1){return _0x553449['status'](_0x43ca09)[_0xaab3('0x1f')](_0x42b5a1);}};}function respondWithFilteredResult(_0xcc28ed,_0x2aea7a){return function(_0x5dbe3e){if(_0x5dbe3e){var _0x4f3f96=typeof _0x2aea7a['offset']==='undefined'&&typeof _0x2aea7a[_0xaab3('0x20')]===_0xaab3('0x21');var _0x21bae7=_0x5dbe3e['count'];var _0x3052a5=_0x4f3f96?0x0:_0x2aea7a[_0xaab3('0x22')];var _0x3a06f2=_0x4f3f96?_0x5dbe3e[_0xaab3('0x23')]:_0x2aea7a[_0xaab3('0x22')]+_0x2aea7a[_0xaab3('0x20')];var _0x4649e0;if(_0x3a06f2>=_0x21bae7){_0x3a06f2=_0x21bae7;_0x4649e0=0xc8;}else{_0x4649e0=0xce;}_0xcc28ed['status'](_0x4649e0);return _0xcc28ed[_0xaab3('0x24')](_0xaab3('0x25'),_0x3052a5+'-'+_0x3a06f2+'/'+_0x21bae7)[_0xaab3('0x1f')](_0x5dbe3e);}return null;};}function patchUpdates(_0x3588a9){return function(_0xbd23c2){try{jsonpatch['apply'](_0xbd23c2,_0x3588a9,!![]);}catch(_0x5ac359){return BPromise['reject'](_0x5ac359);}return _0xbd23c2['save']();};}function saveUpdates(_0x5d7bf6,_0x1fa934){return function(_0x1bef55){if(_0x1bef55){return _0x1bef55[_0xaab3('0x26')](_0x5d7bf6)[_0xaab3('0x27')](function(_0xaebe3e){return _0xaebe3e;});}return null;};}function removeEntity(_0x1816ab,_0x3c552f){return function(_0xa8e660){if(_0xa8e660){return _0xa8e660[_0xaab3('0x28')]()[_0xaab3('0x27')](function(){_0x1816ab[_0xaab3('0x1d')](0xcc)[_0xaab3('0x1e')]();});}};}function handleEntityNotFound(_0x1199c1,_0x4dd8fe){return function(_0x1b2ee6){if(!_0x1b2ee6){_0x1199c1['sendStatus'](0x194);}return _0x1b2ee6;};}function handleError(_0x28eaff,_0x2904f8){_0x2904f8=_0x2904f8||0x1f4;return function(_0x5c9bd7){logger[_0xaab3('0x29')](_0x5c9bd7[_0xaab3('0x2a')]);if(_0x5c9bd7[_0xaab3('0x2b')]){delete _0x5c9bd7['name'];}_0x28eaff['status'](_0x2904f8)[_0xaab3('0x2c')](_0x5c9bd7);};}exports[_0xaab3('0x2d')]=function(_0x2738ea,_0x4a7558){var _0x168eb0={},_0x21e0d9={},_0x15f8e2={'count':0x0,'rows':[]};var _0x33901e=_[_0xaab3('0x2e')](db[_0xaab3('0x2f')][_0xaab3('0x30')],function(_0x42d22c){return{'name':_0x42d22c[_0xaab3('0x31')],'type':_0x42d22c[_0xaab3('0x32')][_0xaab3('0x33')]};});_0x21e0d9[_0xaab3('0x34')]=_[_0xaab3('0x2e')](_0x33901e,_0xaab3('0x2b'));_0x21e0d9['query']=_[_0xaab3('0x35')](_0x2738ea[_0xaab3('0x36')]);_0x21e0d9[_0xaab3('0x37')]=_[_0xaab3('0x38')](_0x21e0d9[_0xaab3('0x34')],_0x21e0d9[_0xaab3('0x36')]);_0x168eb0['attributes']=_[_0xaab3('0x38')](_0x21e0d9['model'],qs['fields'](_0x2738ea[_0xaab3('0x36')][_0xaab3('0x39')]));_0x168eb0['attributes']=_0x168eb0['attributes'][_0xaab3('0x3a')]?_0x168eb0[_0xaab3('0x3b')]:_0x21e0d9[_0xaab3('0x34')];if(!_0x2738ea['query'][_0xaab3('0x3c')](_0xaab3('0x3d'))){_0x168eb0[_0xaab3('0x20')]=qs['limit'](_0x2738ea['query'][_0xaab3('0x20')]);_0x168eb0[_0xaab3('0x22')]=qs[_0xaab3('0x22')](_0x2738ea[_0xaab3('0x36')][_0xaab3('0x22')]);}_0x168eb0[_0xaab3('0x3e')]=qs['sort'](_0x2738ea[_0xaab3('0x36')][_0xaab3('0x3f')]);_0x168eb0[_0xaab3('0x40')]=qs['filters'](_[_0xaab3('0x41')](_0x2738ea[_0xaab3('0x36')],_0x21e0d9[_0xaab3('0x37')]),_0x33901e);if(_0x2738ea[_0xaab3('0x36')][_0xaab3('0x42')]){_0x168eb0[_0xaab3('0x40')]=_['merge'](_0x168eb0['where'],{'$or':_[_0xaab3('0x2e')](_0x33901e,function(_0xaa8326){if(_0xaa8326['type']!=='VIRTUAL'){var _0x132ac7={};_0x132ac7[_0xaa8326[_0xaab3('0x2b')]]={'$like':'%'+_0x2738ea['query'][_0xaab3('0x42')]+'%'};return _0x132ac7;}})});}_0x168eb0=_[_0xaab3('0x43')]({},_0x168eb0,_0x2738ea[_0xaab3('0x44')]);var _0x3006e0={'where':_0x168eb0['where']};return db[_0xaab3('0x2f')][_0xaab3('0x23')](_0x3006e0)['then'](function(_0xc2186d){_0x15f8e2['count']=_0xc2186d;if(_0x2738ea[_0xaab3('0x36')][_0xaab3('0x45')]){_0x168eb0[_0xaab3('0x46')]=[{'all':!![]}];}return db['FreshdeskAccount'][_0xaab3('0x47')](_0x168eb0);})[_0xaab3('0x27')](function(_0x2d1fbb){_0x15f8e2['rows']=_0x2d1fbb;return _0x15f8e2;})[_0xaab3('0x27')](respondWithFilteredResult(_0x4a7558,_0x168eb0))[_0xaab3('0x48')](handleError(_0x4a7558,null));};exports[_0xaab3('0x49')]=function(_0x2786e2,_0x2277a9){var _0x2e57cf={'raw':![],'where':{'id':_0x2786e2[_0xaab3('0x4a')]['id']}},_0x4a1d46={};_0x4a1d46[_0xaab3('0x34')]=_[_0xaab3('0x35')](db[_0xaab3('0x2f')][_0xaab3('0x30')]);_0x4a1d46[_0xaab3('0x36')]=_[_0xaab3('0x35')](_0x2786e2[_0xaab3('0x36')]);_0x4a1d46[_0xaab3('0x37')]=_[_0xaab3('0x38')](_0x4a1d46[_0xaab3('0x34')],_0x4a1d46[_0xaab3('0x36')]);_0x2e57cf['attributes']=_[_0xaab3('0x38')](_0x4a1d46[_0xaab3('0x34')],qs[_0xaab3('0x39')](_0x2786e2[_0xaab3('0x36')]['fields']));_0x2e57cf[_0xaab3('0x3b')]=_0x2e57cf[_0xaab3('0x3b')][_0xaab3('0x3a')]?_0x2e57cf['attributes']:_0x4a1d46['model'];if(_0x2786e2['query'][_0xaab3('0x45')]){_0x2e57cf[_0xaab3('0x46')]=[{'all':!![]}];}_0x2e57cf=_['merge']({},_0x2e57cf,_0x2786e2[_0xaab3('0x44')]);return db[_0xaab3('0x2f')][_0xaab3('0x4b')](_0x2e57cf)[_0xaab3('0x27')](handleEntityNotFound(_0x2277a9,null))[_0xaab3('0x27')](respondWithResult(_0x2277a9,null))[_0xaab3('0x48')](handleError(_0x2277a9,null));};exports[_0xaab3('0x4c')]=function(_0x15ff7d,_0x4ce820){return db[_0xaab3('0x2f')][_0xaab3('0x4c')](_0x15ff7d[_0xaab3('0x4d')],{})[_0xaab3('0x27')](respondWithResult(_0x4ce820,0xc9))[_0xaab3('0x48')](handleError(_0x4ce820,null));};exports['update']=function(_0x2a774e,_0x5b7d33){if(_0x2a774e['body']['id']){delete _0x2a774e['body']['id'];}return db['FreshdeskAccount'][_0xaab3('0x4b')]({'where':{'id':_0x2a774e[_0xaab3('0x4a')]['id']}})['then'](handleEntityNotFound(_0x5b7d33,null))[_0xaab3('0x27')](saveUpdates(_0x2a774e[_0xaab3('0x4d')],null))[_0xaab3('0x27')](respondWithResult(_0x5b7d33,null))[_0xaab3('0x48')](handleError(_0x5b7d33,null));};exports['destroy']=function(_0x27962d,_0x3454cc){return db[_0xaab3('0x2f')][_0xaab3('0x4b')]({'where':{'id':_0x27962d['params']['id']}})[_0xaab3('0x27')](handleEntityNotFound(_0x3454cc,null))[_0xaab3('0x27')](removeEntity(_0x3454cc,null))[_0xaab3('0x48')](handleError(_0x3454cc,null));};exports[_0xaab3('0x4e')]=function(_0x15b533,_0x38536c,_0x29e19a){var _0xbf901f={};var _0x37ebfb={};var _0x19e8f1;var _0x58e304;return db['FreshdeskAccount']['findOne']({'where':{'id':_0x15b533[_0xaab3('0x4a')]['id']}})['then'](handleEntityNotFound(_0x38536c,null))[_0xaab3('0x27')](function(_0x3cf171){if(_0x3cf171){_0x19e8f1=_0x3cf171;_0x37ebfb[_0xaab3('0x34')]=_[_0xaab3('0x35')](db[_0xaab3('0x4f')][_0xaab3('0x30')]);_0x37ebfb[_0xaab3('0x36')]=_[_0xaab3('0x35')](_0x15b533['query']);_0x37ebfb['filters']=_[_0xaab3('0x38')](_0x37ebfb[_0xaab3('0x34')],_0x37ebfb[_0xaab3('0x36')]);_0xbf901f[_0xaab3('0x3b')]=_['intersection'](_0x37ebfb[_0xaab3('0x34')],qs[_0xaab3('0x39')](_0x15b533[_0xaab3('0x36')][_0xaab3('0x39')]));_0xbf901f[_0xaab3('0x3b')]=_0xbf901f[_0xaab3('0x3b')]['length']?_0xbf901f['attributes']:_0x37ebfb['model'];_0xbf901f[_0xaab3('0x3e')]=qs[_0xaab3('0x3f')](_0x15b533[_0xaab3('0x36')][_0xaab3('0x3f')]);_0xbf901f[_0xaab3('0x40')]=qs[_0xaab3('0x37')](_['pick'](_0x15b533[_0xaab3('0x36')],_0x37ebfb[_0xaab3('0x37')]));if(_0x15b533[_0xaab3('0x36')][_0xaab3('0x42')]){_0xbf901f[_0xaab3('0x40')]=_[_0xaab3('0x43')](_0xbf901f[_0xaab3('0x40')],{'$or':_[_0xaab3('0x2e')](_0xbf901f['attributes'],function(_0x5b3e1a){var _0x59a165={};_0x59a165[_0x5b3e1a]={'$like':'%'+_0x15b533[_0xaab3('0x36')][_0xaab3('0x42')]+'%'};return _0x59a165;})});}_0xbf901f=_[_0xaab3('0x43')]({},_0xbf901f,_0x15b533[_0xaab3('0x44')]);return _0x19e8f1[_0xaab3('0x4e')](_0xbf901f);}})[_0xaab3('0x27')](function(_0x5c801d){if(_0x5c801d){_0x58e304=_0x5c801d[_0xaab3('0x3a')];if(!_0x15b533[_0xaab3('0x36')][_0xaab3('0x3c')](_0xaab3('0x3d'))){_0xbf901f[_0xaab3('0x20')]=qs[_0xaab3('0x20')](_0x15b533[_0xaab3('0x36')][_0xaab3('0x20')]);_0xbf901f[_0xaab3('0x22')]=qs[_0xaab3('0x22')](_0x15b533[_0xaab3('0x36')][_0xaab3('0x22')]);}return _0x19e8f1['getConfigurations'](_0xbf901f);}})[_0xaab3('0x27')](function(_0x4230c1){if(_0x4230c1){return _0x4230c1?{'count':_0x58e304,'rows':_0x4230c1}:null;}})[_0xaab3('0x27')](respondWithResult(_0x38536c,null))['catch'](handleError(_0x38536c,null));};exports[_0xaab3('0x50')]=function(_0x13885d,_0x4faf63,_0x449a8a){if(_0x13885d[_0xaab3('0x4d')]['id']){delete _0x13885d['body']['id'];}return db['FreshdeskAccount']['findOne']({'where':{'id':_0x13885d[_0xaab3('0x4a')]['id']}})[_0xaab3('0x27')](handleEntityNotFound(_0x4faf63,null))[_0xaab3('0x27')](function(_0x33a1b9){if(_0x33a1b9){_0x13885d[_0xaab3('0x4d')][_0xaab3('0x51')]=_0x33a1b9['id'];_0x13885d[_0xaab3('0x4d')]['Subjects']=integrations[_0xaab3('0x52')](_0x13885d[_0xaab3('0x4d')]['channel'],_0x13885d[_0xaab3('0x4d')][_0xaab3('0x32')]);_0x13885d[_0xaab3('0x4d')][_0xaab3('0x53')]=integrations[_0xaab3('0x54')](_0x13885d[_0xaab3('0x4d')][_0xaab3('0x55')],_0x13885d[_0xaab3('0x4d')]['type']);return db['FreshdeskConfiguration'][_0xaab3('0x4c')](_0x13885d[_0xaab3('0x4d')],{'include':[{'model':db[_0xaab3('0x56')],'as':_0xaab3('0x57')},{'model':db[_0xaab3('0x56')],'as':_0xaab3('0x53')}]});}return null;})[_0xaab3('0x27')](respondWithResult(_0x4faf63,null))['catch'](handleError(_0x4faf63,null));};exports[_0xaab3('0x58')]=function(_0x13ebc3,_0x21da6d,_0x2fc7fe){var _0xc2061f='';return db['FreshdeskAccount']['findOne']({'where':{'id':_0x13ebc3[_0xaab3('0x4a')]['id']},'attributes':['id','remoteUri','apiKey']})[_0xaab3('0x27')](handleEntityNotFound(_0x21da6d,null))[_0xaab3('0x27')](function(_0x4b4d65){if(_0x4b4d65){_0xc2061f=_0x4b4d65[_0xaab3('0x59')];var _0x4b8c7d=_0xc2061f[_0xaab3('0x5a')](-0x1);if(_0x4b8c7d==='/'){_0xc2061f=_0xc2061f[_0xaab3('0x5b')](0x0,_0xc2061f['lastIndexOf'](_0x4b8c7d));}return rp({'method':_0xaab3('0x5c'),'uri':util[_0xaab3('0x5d')](_0xaab3('0x5e'),_0xc2061f,_0xaab3('0x5f')),'headers':{'Authorization':util[_0xaab3('0x5d')](_0xaab3('0x60'),new Buffer(util[_0xaab3('0x5d')](_0xaab3('0x61'),_0x4b4d65[_0xaab3('0x62')]))[_0xaab3('0x63')](_0xaab3('0x64')))},'json':!![]});}})['then'](function(_0xf8a125){if(_0xf8a125){var _0x492827=[_0xaab3('0x65'),'subject',_0xaab3('0x66'),_0xaab3('0x67'),_0xaab3('0x1d'),_0xaab3('0x68'),_0xaab3('0x69'),_0xaab3('0x6a'),_0xaab3('0x6b'),'group',_0xaab3('0x6c')];_['remove'](_0xf8a125,function(_0x2fcb0d){return _0x492827[_0xaab3('0x6d')](_0x2fcb0d['name'])||!_0x2fcb0d[_0xaab3('0x6e')]&&_0x2fcb0d['type']!==_0xaab3('0x6f')&&_0x2fcb0d['type']!==_0xaab3('0x70');});return{'count':_0xf8a125[_0xaab3('0x3a')],'rows':_[_0xaab3('0x2e')](_0xf8a125,function(_0x179ef0){return{'id':_0x179ef0[_0xaab3('0x2b')],'name':_0x179ef0[_0xaab3('0x71')],'custom':!_0x179ef0[_0xaab3('0x6e')],'options':_0x179ef0['choices']?_[_0xaab3('0x2e')](_0x179ef0[_0xaab3('0x72')],function(_0x1592dc){return{'name':_['capitalize'](_0x1592dc),'value':_0x1592dc};}):[]};})};}})[_0xaab3('0x27')](respondWithResult(_0x21da6d,null))['catch'](function(_0x574adb){var _0x1bcd8b=_0x13ebc3['query'][_0xaab3('0x73')]?0x1f4:_0x574adb[_0xaab3('0x74')]||0x1f4;logger[_0xaab3('0x29')](_0xaab3('0x75'),'getFields',_0x1bcd8b,JSON[_0xaab3('0x76')](_0x574adb));delete _0x574adb[_0xaab3('0x2b')];if(_0x1bcd8b===0x191){_0x1bcd8b=0x190;}_0x21da6d[_0xaab3('0x1d')](_0x1bcd8b)[_0xaab3('0x2c')](_0x13ebc3[_0xaab3('0x36')][_0xaab3('0x73')]?{'message':_0xaab3('0x77'),'statusCode':_0x574adb[_0xaab3('0x74')]}:_0x574adb);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index 7e0b740..572a396 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 _0x6eed=['bluebird','request-promise','path','../../components/integrations/configuration','exports','define','FreshdeskAccount','int_freshdesk_accounts','lodash','../../config/logger','moment'];(function(_0x173d82,_0x1bd048){var _0x1713c1=function(_0x46fa1c){while(--_0x46fa1c){_0x173d82['push'](_0x173d82['shift']());}};_0x1713c1(++_0x1bd048);}(_0x6eed,0x8c));var _0xd6ee=function(_0x450678,_0x2b6600){_0x450678=_0x450678-0x0;var _0xb0d108=_0x6eed[_0x450678];return _0xb0d108;};'use strict';var _=require(_0xd6ee('0x0'));var util=require('util');var logger=require(_0xd6ee('0x1'))('api');var moment=require(_0xd6ee('0x2'));var BPromise=require(_0xd6ee('0x3'));var rp=require(_0xd6ee('0x4'));var fs=require('fs');var path=require(_0xd6ee('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./intFreshdeskAccount.attributes');var integrations=require(_0xd6ee('0x6'));module[_0xd6ee('0x7')]=function(_0x30a7b1,_0x36e534){return _0x30a7b1[_0xd6ee('0x8')](_0xd6ee('0x9'),attributes,{'tableName':_0xd6ee('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbbb2=['moment','bluebird','request-promise','path','rimraf','../../config/environment','../../components/integrations/configuration','exports','define','FreshdeskAccount','lodash','../../config/logger','api'];(function(_0x50f648,_0x3e3cbd){var _0x1b7bec=function(_0x140ddb){while(--_0x140ddb){_0x50f648['push'](_0x50f648['shift']());}};_0x1b7bec(++_0x3e3cbd);}(_0xbbb2,0x99));var _0x2bbb=function(_0xe73080,_0x24c56d){_0xe73080=_0xe73080-0x0;var _0x12cbc4=_0xbbb2[_0xe73080];return _0x12cbc4;};'use strict';var _=require(_0x2bbb('0x0'));var util=require('util');var logger=require(_0x2bbb('0x1'))(_0x2bbb('0x2'));var moment=require(_0x2bbb('0x3'));var BPromise=require(_0x2bbb('0x4'));var rp=require(_0x2bbb('0x5'));var fs=require('fs');var path=require(_0x2bbb('0x6'));var rimraf=require(_0x2bbb('0x7'));var config=require(_0x2bbb('0x8'));var attributes=require('./intFreshdeskAccount.attributes');var integrations=require(_0x2bbb('0x9'));module[_0x2bbb('0xa')]=function(_0x639844,_0x26de95){return _0x639844[_0x2bbb('0xb')](_0x2bbb('0xc'),attributes,{'tableName':'int_freshdesk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.rpc.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.rpc.js index d8cbc83..7960f9d 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 _0x86d8=['error','code','FreshdeskAccount,\x20%s,\x20%s','message','info','catch','GetFreshdeskAccount','FreshdeskAccount','findAll','options','raw','where','attributes','limit','map','model','include','stringify','ShowFreshdeskAccount','lodash','util','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s'];(function(_0x380030,_0x1d39e1){var _0x1b4473=function(_0x51c52e){while(--_0x51c52e){_0x380030['push'](_0x380030['shift']());}};_0x1b4473(++_0x1d39e1);}(_0x86d8,0xb8));var _0x886d=function(_0x50694c,_0x97a97d){_0x50694c=_0x50694c-0x0;var _0x33111e=_0x86d8[_0x50694c];return _0x33111e;};'use strict';var _=require(_0x886d('0x0'));var util=require(_0x886d('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x886d('0x2'));var db=require(_0x886d('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x886d('0x4'))('rpc');var config=require(_0x886d('0x5'));var jayson=require(_0x886d('0x6'));var client=jayson[_0x886d('0x7')][_0x886d('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x42cfa4,_0x488f3c,_0x35753e){return new BPromise(function(_0x44b586,_0x237864){return client[_0x886d('0x9')](_0x42cfa4,_0x35753e)[_0x886d('0xa')](function(_0x1090fe){logger['info']('FreshdeskAccount,\x20%s,\x20%s',_0x488f3c,_0x886d('0xb'));logger[_0x886d('0xc')](_0x886d('0xd'),_0x488f3c,_0x886d('0xb'),JSON['stringify'](_0x1090fe));if(_0x1090fe[_0x886d('0xe')]){if(_0x1090fe[_0x886d('0xe')][_0x886d('0xf')]===0x1f4){logger[_0x886d('0xe')](_0x886d('0x10'),_0x488f3c,_0x1090fe['error'][_0x886d('0x11')]);return _0x237864(_0x1090fe[_0x886d('0xe')][_0x886d('0x11')]);}logger[_0x886d('0xe')](_0x886d('0x10'),_0x488f3c,_0x1090fe['error'][_0x886d('0x11')]);return _0x44b586(_0x1090fe[_0x886d('0xe')]['message']);}else{logger[_0x886d('0x12')]('FreshdeskAccount,\x20%s,\x20%s',_0x488f3c,_0x886d('0xb'));_0x44b586(_0x1090fe['result'][_0x886d('0x11')]);}})[_0x886d('0x13')](function(_0x5e9be0){logger[_0x886d('0xe')](_0x886d('0x10'),_0x488f3c,_0x5e9be0);_0x237864(_0x5e9be0);});});}exports[_0x886d('0x14')]=function(_0x4be275){var _0x2da963=this;return new Promise(function(_0x40fa6d,_0x5c7f44){return db[_0x886d('0x15')][_0x886d('0x16')]({'raw':_0x4be275['options']?_0x4be275[_0x886d('0x17')][_0x886d('0x18')]===undefined?!![]:![]:!![],'where':_0x4be275[_0x886d('0x17')]?_0x4be275[_0x886d('0x17')][_0x886d('0x19')]||null:null,'attributes':_0x4be275[_0x886d('0x17')]?_0x4be275[_0x886d('0x17')][_0x886d('0x1a')]||null:null,'limit':_0x4be275[_0x886d('0x17')]?_0x4be275['options'][_0x886d('0x1b')]||null:null,'include':_0x4be275[_0x886d('0x17')]?_0x4be275[_0x886d('0x17')]['include']?_[_0x886d('0x1c')](_0x4be275[_0x886d('0x17')]['include'],function(_0x31b433){return{'model':db[_0x31b433[_0x886d('0x1d')]],'as':_0x31b433['as'],'attributes':_0x31b433[_0x886d('0x1a')],'include':_0x31b433[_0x886d('0x1e')]?_[_0x886d('0x1c')](_0x31b433['include'],function(_0x4359bb){return{'model':db[_0x4359bb[_0x886d('0x1d')]],'as':_0x4359bb['as'],'attributes':_0x4359bb[_0x886d('0x1a')],'include':_0x4359bb[_0x886d('0x1e')]?_[_0x886d('0x1c')](_0x4359bb[_0x886d('0x1e')],function(_0x4719a8){return{'model':db[_0x4719a8['model']],'as':_0x4719a8['as'],'attributes':_0x4719a8[_0x886d('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x886d('0xa')](function(_0x6eee28){logger[_0x886d('0x12')](_0x886d('0x14'),_0x4be275);logger[_0x886d('0xc')]('GetFreshdeskAccount',_0x4be275,JSON[_0x886d('0x1f')](_0x6eee28));_0x40fa6d(_0x6eee28);})[_0x886d('0x13')](function(_0x8bcb0d){logger[_0x886d('0xe')](_0x886d('0x14'),_0x8bcb0d['message'],_0x4be275);_0x5c7f44(_0x2da963[_0x886d('0xe')](0x1f4,_0x8bcb0d[_0x886d('0x11')]));});});};exports[_0x886d('0x20')]=function(_0x2682d7){var _0x2b5cf3=this;return new Promise(function(_0x2ece66,_0x4161da){return db['FreshdeskAccount']['find']({'raw':_0x2682d7[_0x886d('0x17')]?_0x2682d7['options']['raw']===undefined?!![]:![]:!![],'where':_0x2682d7[_0x886d('0x17')]?_0x2682d7[_0x886d('0x17')][_0x886d('0x19')]||null:null,'attributes':_0x2682d7[_0x886d('0x17')]?_0x2682d7[_0x886d('0x17')][_0x886d('0x1a')]||null:null,'include':_0x2682d7[_0x886d('0x17')]?_0x2682d7[_0x886d('0x17')][_0x886d('0x1e')]?_['map'](_0x2682d7[_0x886d('0x17')]['include'],function(_0x536891){return{'model':db[_0x536891[_0x886d('0x1d')]],'as':_0x536891['as'],'attributes':_0x536891[_0x886d('0x1a')],'include':_0x536891[_0x886d('0x1e')]?_[_0x886d('0x1c')](_0x536891[_0x886d('0x1e')],function(_0x4f61f2){return{'model':db[_0x4f61f2['model']],'as':_0x4f61f2['as'],'attributes':_0x4f61f2[_0x886d('0x1a')],'include':_0x4f61f2[_0x886d('0x1e')]?_[_0x886d('0x1c')](_0x4f61f2[_0x886d('0x1e')],function(_0x2713ee){return{'model':db[_0x2713ee[_0x886d('0x1d')]],'as':_0x2713ee['as'],'attributes':_0x2713ee[_0x886d('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x886d('0xa')](function(_0xa3f173){logger[_0x886d('0x12')](_0x886d('0x20'),_0x2682d7);logger[_0x886d('0xc')](_0x886d('0x20'),_0x2682d7,JSON['stringify'](_0xa3f173));_0x2ece66(_0xa3f173);})[_0x886d('0x13')](function(_0x45d582){logger[_0x886d('0xe')](_0x886d('0x20'),_0x45d582[_0x886d('0x11')],_0x2682d7);_0x4161da(_0x2b5cf3['error'](0x1f4,_0x45d582[_0x886d('0x11')]));});});}; \ No newline at end of file +var _0x3478=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','FreshdeskAccount','options','raw','where','attributes','limit','map','include','model','then','GetFreshdeskAccount','catch','ShowFreshdeskAccount','find','util','moment','bluebird'];(function(_0x1b2f5c,_0x425490){var _0x4b2ea5=function(_0x1a8346){while(--_0x1a8346){_0x1b2f5c['push'](_0x1b2f5c['shift']());}};_0x4b2ea5(++_0x425490);}(_0x3478,0x10d));var _0x8347=function(_0xf8fe2f,_0x494dcd){_0xf8fe2f=_0xf8fe2f-0x0;var _0x478e05=_0x3478[_0xf8fe2f];return _0x478e05;};'use strict';var _=require('lodash');var util=require(_0x8347('0x0'));var moment=require(_0x8347('0x1'));var BPromise=require(_0x8347('0x2'));var rs=require(_0x8347('0x3'));var fs=require('fs');var Redis=require(_0x8347('0x4'));var db=require(_0x8347('0x5'))['db'];var utils=require(_0x8347('0x6'));var logger=require(_0x8347('0x7'))(_0x8347('0x8'));var config=require('../../config/environment');var jayson=require(_0x8347('0x9'));var client=jayson[_0x8347('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x228e44,_0x28edd9,_0x4e8e7b){return new BPromise(function(_0x503141,_0x1ed48c){return client['request'](_0x228e44,_0x4e8e7b)['then'](function(_0x1b7516){logger[_0x8347('0xb')](_0x8347('0xc'),_0x28edd9,_0x8347('0xd'));logger[_0x8347('0xe')](_0x8347('0xf'),_0x28edd9,_0x8347('0xd'),JSON[_0x8347('0x10')](_0x1b7516));if(_0x1b7516[_0x8347('0x11')]){if(_0x1b7516[_0x8347('0x11')][_0x8347('0x12')]===0x1f4){logger['error'](_0x8347('0xc'),_0x28edd9,_0x1b7516['error'][_0x8347('0x13')]);return _0x1ed48c(_0x1b7516[_0x8347('0x11')][_0x8347('0x13')]);}logger[_0x8347('0x11')](_0x8347('0xc'),_0x28edd9,_0x1b7516[_0x8347('0x11')]['message']);return _0x503141(_0x1b7516[_0x8347('0x11')][_0x8347('0x13')]);}else{logger[_0x8347('0xb')](_0x8347('0xc'),_0x28edd9,_0x8347('0xd'));_0x503141(_0x1b7516['result']['message']);}})['catch'](function(_0x35d507){logger[_0x8347('0x11')](_0x8347('0xc'),_0x28edd9,_0x35d507);_0x1ed48c(_0x35d507);});});}exports['GetFreshdeskAccount']=function(_0x351ece){var _0xd23f1d=this;return new Promise(function(_0x8d0d64,_0x2dbcb6){return db[_0x8347('0x14')]['findAll']({'raw':_0x351ece[_0x8347('0x15')]?_0x351ece['options'][_0x8347('0x16')]===undefined?!![]:![]:!![],'where':_0x351ece['options']?_0x351ece[_0x8347('0x15')][_0x8347('0x17')]||null:null,'attributes':_0x351ece[_0x8347('0x15')]?_0x351ece[_0x8347('0x15')][_0x8347('0x18')]||null:null,'limit':_0x351ece[_0x8347('0x15')]?_0x351ece[_0x8347('0x15')][_0x8347('0x19')]||null:null,'include':_0x351ece[_0x8347('0x15')]?_0x351ece[_0x8347('0x15')]['include']?_[_0x8347('0x1a')](_0x351ece[_0x8347('0x15')][_0x8347('0x1b')],function(_0x5081bf){return{'model':db[_0x5081bf[_0x8347('0x1c')]],'as':_0x5081bf['as'],'attributes':_0x5081bf[_0x8347('0x18')],'include':_0x5081bf[_0x8347('0x1b')]?_['map'](_0x5081bf[_0x8347('0x1b')],function(_0x507832){return{'model':db[_0x507832[_0x8347('0x1c')]],'as':_0x507832['as'],'attributes':_0x507832[_0x8347('0x18')],'include':_0x507832[_0x8347('0x1b')]?_['map'](_0x507832[_0x8347('0x1b')],function(_0x3c5167){return{'model':db[_0x3c5167[_0x8347('0x1c')]],'as':_0x3c5167['as'],'attributes':_0x3c5167[_0x8347('0x18')]};}):[]};}):[]};}):[]:[]})[_0x8347('0x1d')](function(_0x288320){logger[_0x8347('0xb')](_0x8347('0x1e'),_0x351ece);logger[_0x8347('0xe')](_0x8347('0x1e'),_0x351ece,JSON[_0x8347('0x10')](_0x288320));_0x8d0d64(_0x288320);})[_0x8347('0x1f')](function(_0x1975e2){logger[_0x8347('0x11')](_0x8347('0x1e'),_0x1975e2[_0x8347('0x13')],_0x351ece);_0x2dbcb6(_0xd23f1d[_0x8347('0x11')](0x1f4,_0x1975e2[_0x8347('0x13')]));});});};exports[_0x8347('0x20')]=function(_0xdb2f39){var _0x33b625=this;return new Promise(function(_0x40f32a,_0x4bfa6e){return db['FreshdeskAccount'][_0x8347('0x21')]({'raw':_0xdb2f39[_0x8347('0x15')]?_0xdb2f39['options'][_0x8347('0x16')]===undefined?!![]:![]:!![],'where':_0xdb2f39[_0x8347('0x15')]?_0xdb2f39['options'][_0x8347('0x17')]||null:null,'attributes':_0xdb2f39[_0x8347('0x15')]?_0xdb2f39[_0x8347('0x15')]['attributes']||null:null,'include':_0xdb2f39['options']?_0xdb2f39[_0x8347('0x15')][_0x8347('0x1b')]?_[_0x8347('0x1a')](_0xdb2f39[_0x8347('0x15')][_0x8347('0x1b')],function(_0x22d42c){return{'model':db[_0x22d42c[_0x8347('0x1c')]],'as':_0x22d42c['as'],'attributes':_0x22d42c['attributes'],'include':_0x22d42c['include']?_['map'](_0x22d42c['include'],function(_0x44652d){return{'model':db[_0x44652d[_0x8347('0x1c')]],'as':_0x44652d['as'],'attributes':_0x44652d[_0x8347('0x18')],'include':_0x44652d['include']?_[_0x8347('0x1a')](_0x44652d[_0x8347('0x1b')],function(_0x113e89){return{'model':db[_0x113e89['model']],'as':_0x113e89['as'],'attributes':_0x113e89[_0x8347('0x18')]};}):[]};}):[]};}):[]:[]})[_0x8347('0x1d')](function(_0x80f2c6){logger['info']('ShowFreshdeskAccount',_0xdb2f39);logger['debug']('ShowFreshdeskAccount',_0xdb2f39,JSON[_0x8347('0x10')](_0x80f2c6));_0x40f32a(_0x80f2c6);})[_0x8347('0x1f')](function(_0x5add46){logger[_0x8347('0x11')](_0x8347('0x20'),_0x5add46['message'],_0xdb2f39);_0x4bfa6e(_0x33b625[_0x8347('0x11')](0x1f4,_0x5add46[_0x8347('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index 4797a7c..34dc5c8 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 _0x437a=['path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskConfiguration.controller','get','isAuthenticated','/:id','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','getTags','post','create','/:id/tags','setTags','delete','exports','multer','util'];(function(_0x52ad84,_0x4e34ce){var _0x3ad2a1=function(_0x5a3056){while(--_0x5a3056){_0x52ad84['push'](_0x52ad84['shift']());}};_0x3ad2a1(++_0x4e34ce);}(_0x437a,0x76));var _0xa437=function(_0x49b5ed,_0x35cb99){_0x49b5ed=_0x49b5ed-0x0;var _0x117247=_0x437a[_0x49b5ed];return _0x117247;};'use strict';var multer=require(_0xa437('0x0'));var util=require(_0xa437('0x1'));var path=require(_0xa437('0x2'));var timeout=require(_0xa437('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xa437('0x4'));var interaction=require(_0xa437('0x5'));var config=require(_0xa437('0x6'));var controller=require(_0xa437('0x7'));router[_0xa437('0x8')]('/',auth[_0xa437('0x9')](),controller['index']);router[_0xa437('0x8')](_0xa437('0xa'),auth[_0xa437('0x9')](),controller[_0xa437('0xb')]);router['get'](_0xa437('0xc'),auth[_0xa437('0x9')](),controller[_0xa437('0xd')]);router[_0xa437('0x8')](_0xa437('0xe'),auth[_0xa437('0x9')](),controller['getSubjects']);router[_0xa437('0x8')](_0xa437('0xf'),auth[_0xa437('0x9')](),controller[_0xa437('0x10')]);router[_0xa437('0x8')]('/:id/tags',auth[_0xa437('0x9')](),controller[_0xa437('0x11')]);router[_0xa437('0x12')]('/',auth[_0xa437('0x9')](),controller[_0xa437('0x13')]);router[_0xa437('0x12')](_0xa437('0x14'),auth[_0xa437('0x9')](),controller[_0xa437('0x15')]);router['put'](_0xa437('0xa'),auth[_0xa437('0x9')](),controller['update']);router[_0xa437('0x16')]('/:id',auth[_0xa437('0x9')](),controller['destroy']);module[_0xa437('0x17')]=router; \ No newline at end of file +var _0xccb7=['/:id','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/tags','getTags','post','create','put','update','delete','destroy','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskConfiguration.controller','get','index'];(function(_0x3c59fc,_0x10dbd2){var _0x2b78d4=function(_0x5f161a){while(--_0x5f161a){_0x3c59fc['push'](_0x3c59fc['shift']());}};_0x2b78d4(++_0x10dbd2);}(_0xccb7,0xf9));var _0x7ccb=function(_0x373e5d,_0x3818f6){_0x373e5d=_0x373e5d-0x0;var _0x3d5694=_0xccb7[_0x373e5d];return _0x3d5694;};'use strict';var multer=require('multer');var util=require(_0x7ccb('0x0'));var path=require(_0x7ccb('0x1'));var timeout=require(_0x7ccb('0x2'));var express=require(_0x7ccb('0x3'));var router=express[_0x7ccb('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x7ccb('0x5'));var interaction=require(_0x7ccb('0x6'));var config=require(_0x7ccb('0x7'));var controller=require(_0x7ccb('0x8'));router[_0x7ccb('0x9')]('/',auth['isAuthenticated'](),controller[_0x7ccb('0xa')]);router['get'](_0x7ccb('0xb'),auth[_0x7ccb('0xc')](),controller[_0x7ccb('0xd')]);router[_0x7ccb('0x9')](_0x7ccb('0xe'),auth[_0x7ccb('0xc')](),controller[_0x7ccb('0xf')]);router[_0x7ccb('0x9')](_0x7ccb('0x10'),auth[_0x7ccb('0xc')](),controller[_0x7ccb('0x11')]);router[_0x7ccb('0x9')]('/:id/descriptions',auth[_0x7ccb('0xc')](),controller['getDescriptions']);router[_0x7ccb('0x9')](_0x7ccb('0x12'),auth[_0x7ccb('0xc')](),controller[_0x7ccb('0x13')]);router[_0x7ccb('0x14')]('/',auth[_0x7ccb('0xc')](),controller[_0x7ccb('0x15')]);router[_0x7ccb('0x14')]('/:id/tags',auth[_0x7ccb('0xc')](),controller['setTags']);router[_0x7ccb('0x16')](_0x7ccb('0xb'),auth[_0x7ccb('0xc')](),controller[_0x7ccb('0x17')]);router[_0x7ccb('0x18')]('/:id',auth[_0x7ccb('0xc')](),controller[_0x7ccb('0x19')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js index 1f66287..7a85d23 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 _0xa599=['sequelize','exports','STRING'];(function(_0x10ad06,_0x2c8756){var _0x515e08=function(_0x3073eb){while(--_0x3073eb){_0x10ad06['push'](_0x10ad06['shift']());}};_0x515e08(++_0x2c8756);}(_0xa599,0x186));var _0x9a59=function(_0x252aae,_0x4c8fa9){_0x252aae=_0x252aae-0x0;var _0x397bbe=_0xa599[_0x252aae];return _0x397bbe;};'use strict';var Sequelize=require(_0x9a59('0x0'));module[_0x9a59('0x1')]={'name':{'type':Sequelize[_0x9a59('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xb740=['sequelize','exports','STRING'];(function(_0x261038,_0x2fab28){var _0x2fd230=function(_0x429660){while(--_0x429660){_0x261038['push'](_0x261038['shift']());}};_0x2fd230(++_0x2fab28);}(_0xb740,0x9c));var _0x0b74=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb740[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x0b74('0x0'));module[_0x0b74('0x1')]={'name':{'type':Sequelize[_0x0b74('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index 4798d7e..374eda8 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 _0x9e36=['status','end','offset','undefined','count','limit','Content-Range','json','apply','save','update','then','destroy','error','stack','name','send','index','map','FreshdeskConfiguration','rawAttributes','fieldName','type','key','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','sort','where','filter','merge','options','includeAll','include','findAll','show','params','find','catch','create','body','getFields','findOne','FreshdeskField','nolimit','getSubjects','pick','order','getDescriptions','Tag','getTags','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus'];(function(_0x5b95ec,_0x16e0d0){var _0x2af647=function(_0x4f7a18){while(--_0x4f7a18){_0x5b95ec['push'](_0x5b95ec['shift']());}};_0x2af647(++_0x16e0d0);}(_0x9e36,0x91));var _0x69e3=function(_0x307d2b,_0x3796e0){_0x307d2b=_0x307d2b-0x0;var _0xe82587=_0x9e36[_0x307d2b];return _0xe82587;};'use strict';var emlformat=require(_0x69e3('0x0'));var rimraf=require(_0x69e3('0x1'));var zipdir=require(_0x69e3('0x2'));var jsonpatch=require(_0x69e3('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x69e3('0x4'));var util=require(_0x69e3('0x5'));var path=require(_0x69e3('0x6'));var sox=require(_0x69e3('0x7'));var csv=require(_0x69e3('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x69e3('0x9'));var _=require(_0x69e3('0xa'));var squel=require(_0x69e3('0xb'));var crypto=require(_0x69e3('0xc'));var jsforce=require(_0x69e3('0xd'));var deskjs=require(_0x69e3('0xe'));var toCsv=require(_0x69e3('0x8'));var querystring=require(_0x69e3('0xf'));var Papa=require(_0x69e3('0x10'));var Redis=require(_0x69e3('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x69e3('0x12'));var as=require(_0x69e3('0x13'));var hardwareService=require(_0x69e3('0x14'));var logger=require(_0x69e3('0x15'))(_0x69e3('0x16'));var utils=require(_0x69e3('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x69e3('0x18'));var db=require(_0x69e3('0x19'))['db'];function respondWithStatusCode(_0x5b23b4,_0x3278e8){_0x3278e8=_0x3278e8||0xcc;return function(_0x13060a){if(_0x13060a){return _0x5b23b4[_0x69e3('0x1a')](_0x3278e8);}return _0x5b23b4[_0x69e3('0x1b')](_0x3278e8)[_0x69e3('0x1c')]();};}function respondWithResult(_0x1c3fca,_0xfd9ce1){_0xfd9ce1=_0xfd9ce1||0xc8;return function(_0x537757){if(_0x537757){return _0x1c3fca['status'](_0xfd9ce1)['json'](_0x537757);}};}function respondWithFilteredResult(_0x531deb,_0x58ed27){return function(_0x555da3){if(_0x555da3){var _0x2954e9=typeof _0x58ed27[_0x69e3('0x1d')]==='undefined'&&typeof _0x58ed27['limit']===_0x69e3('0x1e');var _0x186344=_0x555da3[_0x69e3('0x1f')];var _0x2c69ae=_0x2954e9?0x0:_0x58ed27[_0x69e3('0x1d')];var _0x1576f9=_0x2954e9?_0x555da3[_0x69e3('0x1f')]:_0x58ed27[_0x69e3('0x1d')]+_0x58ed27[_0x69e3('0x20')];var _0x102ee8;if(_0x1576f9>=_0x186344){_0x1576f9=_0x186344;_0x102ee8=0xc8;}else{_0x102ee8=0xce;}_0x531deb['status'](_0x102ee8);return _0x531deb['set'](_0x69e3('0x21'),_0x2c69ae+'-'+_0x1576f9+'/'+_0x186344)[_0x69e3('0x22')](_0x555da3);}return null;};}function patchUpdates(_0x5557b0){return function(_0x5f57d1){try{jsonpatch[_0x69e3('0x23')](_0x5f57d1,_0x5557b0,!![]);}catch(_0x1cfcba){return BPromise['reject'](_0x1cfcba);}return _0x5f57d1[_0x69e3('0x24')]();};}function saveUpdates(_0x21c016,_0x248cb8){return function(_0x1284ad){if(_0x1284ad){return _0x1284ad[_0x69e3('0x25')](_0x21c016)[_0x69e3('0x26')](function(_0x129210){return _0x129210;});}return null;};}function removeEntity(_0x1fc16c,_0x4620a9){return function(_0x3d236c){if(_0x3d236c){return _0x3d236c[_0x69e3('0x27')]()[_0x69e3('0x26')](function(){_0x1fc16c['status'](0xcc)[_0x69e3('0x1c')]();});}};}function handleEntityNotFound(_0x326e33,_0x28679f){return function(_0x14c795){if(!_0x14c795){_0x326e33[_0x69e3('0x1a')](0x194);}return _0x14c795;};}function handleError(_0x2f2d7e,_0x4276d3){_0x4276d3=_0x4276d3||0x1f4;return function(_0x33c283){logger[_0x69e3('0x28')](_0x33c283[_0x69e3('0x29')]);if(_0x33c283[_0x69e3('0x2a')]){delete _0x33c283[_0x69e3('0x2a')];}_0x2f2d7e['status'](_0x4276d3)[_0x69e3('0x2b')](_0x33c283);};}exports[_0x69e3('0x2c')]=function(_0x293c39,_0x202d4b){var _0x279260={},_0x303213={},_0x3bfcd6={'count':0x0,'rows':[]};var _0x8313fc=_[_0x69e3('0x2d')](db[_0x69e3('0x2e')][_0x69e3('0x2f')],function(_0x1f935b){return{'name':_0x1f935b[_0x69e3('0x30')],'type':_0x1f935b[_0x69e3('0x31')][_0x69e3('0x32')]};});_0x303213['model']=_[_0x69e3('0x2d')](_0x8313fc,_0x69e3('0x2a'));_0x303213[_0x69e3('0x33')]=_[_0x69e3('0x34')](_0x293c39['query']);_0x303213[_0x69e3('0x35')]=_['intersection'](_0x303213[_0x69e3('0x36')],_0x303213['query']);_0x279260[_0x69e3('0x37')]=_[_0x69e3('0x38')](_0x303213[_0x69e3('0x36')],qs['fields'](_0x293c39[_0x69e3('0x33')][_0x69e3('0x39')]));_0x279260[_0x69e3('0x37')]=_0x279260['attributes'][_0x69e3('0x3a')]?_0x279260[_0x69e3('0x37')]:_0x303213[_0x69e3('0x36')];if(!_0x293c39['query'][_0x69e3('0x3b')]('nolimit')){_0x279260[_0x69e3('0x20')]=qs['limit'](_0x293c39[_0x69e3('0x33')][_0x69e3('0x20')]);_0x279260[_0x69e3('0x1d')]=qs['offset'](_0x293c39[_0x69e3('0x33')]['offset']);}_0x279260['order']=qs[_0x69e3('0x3c')](_0x293c39[_0x69e3('0x33')][_0x69e3('0x3c')]);_0x279260[_0x69e3('0x3d')]=qs[_0x69e3('0x35')](_['pick'](_0x293c39[_0x69e3('0x33')],_0x303213['filters']),_0x8313fc);if(_0x293c39['query'][_0x69e3('0x3e')]){_0x279260['where']=_[_0x69e3('0x3f')](_0x279260[_0x69e3('0x3d')],{'$or':_[_0x69e3('0x2d')](_0x8313fc,function(_0x1962e0){if(_0x1962e0['type']!=='VIRTUAL'){var _0xa0ab16={};_0xa0ab16[_0x1962e0[_0x69e3('0x2a')]]={'$like':'%'+_0x293c39[_0x69e3('0x33')][_0x69e3('0x3e')]+'%'};return _0xa0ab16;}})});}_0x279260=_['merge']({},_0x279260,_0x293c39[_0x69e3('0x40')]);var _0x4cc1cb={'where':_0x279260[_0x69e3('0x3d')]};return db[_0x69e3('0x2e')][_0x69e3('0x1f')](_0x4cc1cb)['then'](function(_0x380ac9){_0x3bfcd6['count']=_0x380ac9;if(_0x293c39[_0x69e3('0x33')][_0x69e3('0x41')]){_0x279260[_0x69e3('0x42')]=[{'all':!![]}];}return db[_0x69e3('0x2e')][_0x69e3('0x43')](_0x279260);})[_0x69e3('0x26')](function(_0x87e35a){_0x3bfcd6['rows']=_0x87e35a;return _0x3bfcd6;})['then'](respondWithFilteredResult(_0x202d4b,_0x279260))['catch'](handleError(_0x202d4b,null));};exports[_0x69e3('0x44')]=function(_0x975845,_0x1a72b0){var _0x1d1f11={'raw':![],'where':{'id':_0x975845[_0x69e3('0x45')]['id']}},_0xe7bab1={};_0xe7bab1[_0x69e3('0x36')]=_['keys'](db[_0x69e3('0x2e')][_0x69e3('0x2f')]);_0xe7bab1[_0x69e3('0x33')]=_[_0x69e3('0x34')](_0x975845[_0x69e3('0x33')]);_0xe7bab1[_0x69e3('0x35')]=_['intersection'](_0xe7bab1[_0x69e3('0x36')],_0xe7bab1[_0x69e3('0x33')]);_0x1d1f11['attributes']=_[_0x69e3('0x38')](_0xe7bab1['model'],qs['fields'](_0x975845[_0x69e3('0x33')]['fields']));_0x1d1f11['attributes']=_0x1d1f11[_0x69e3('0x37')]['length']?_0x1d1f11[_0x69e3('0x37')]:_0xe7bab1[_0x69e3('0x36')];if(_0x975845['query']['includeAll']){_0x1d1f11['include']=[{'all':!![]}];}_0x1d1f11=_[_0x69e3('0x3f')]({},_0x1d1f11,_0x975845[_0x69e3('0x40')]);return db[_0x69e3('0x2e')][_0x69e3('0x46')](_0x1d1f11)[_0x69e3('0x26')](handleEntityNotFound(_0x1a72b0,null))[_0x69e3('0x26')](respondWithResult(_0x1a72b0,null))[_0x69e3('0x47')](handleError(_0x1a72b0,null));};exports['create']=function(_0x48a6cd,_0x5499aa){return db[_0x69e3('0x2e')][_0x69e3('0x48')](_0x48a6cd[_0x69e3('0x49')],{})[_0x69e3('0x26')](respondWithResult(_0x5499aa,0xc9))[_0x69e3('0x47')](handleError(_0x5499aa,null));};exports[_0x69e3('0x25')]=function(_0x2890d9,_0x39e248){if(_0x2890d9[_0x69e3('0x49')]['id']){delete _0x2890d9['body']['id'];}return db['FreshdeskConfiguration'][_0x69e3('0x46')]({'where':{'id':_0x2890d9[_0x69e3('0x45')]['id']}})[_0x69e3('0x26')](handleEntityNotFound(_0x39e248,null))[_0x69e3('0x26')](saveUpdates(_0x2890d9[_0x69e3('0x49')],null))[_0x69e3('0x26')](respondWithResult(_0x39e248,null))['catch'](handleError(_0x39e248,null));};exports[_0x69e3('0x27')]=function(_0x1e6690,_0x478b40){return db[_0x69e3('0x2e')][_0x69e3('0x46')]({'where':{'id':_0x1e6690[_0x69e3('0x45')]['id']}})[_0x69e3('0x26')](handleEntityNotFound(_0x478b40,null))[_0x69e3('0x26')](removeEntity(_0x478b40,null))[_0x69e3('0x47')](handleError(_0x478b40,null));};exports[_0x69e3('0x4a')]=function(_0x44e753,_0x4d6b13,_0x486e8f){var _0x146cd={};var _0xa5d855={};var _0x40edac;var _0xc7f693;return db['FreshdeskConfiguration'][_0x69e3('0x4b')]({'where':{'id':_0x44e753['params']['id']}})['then'](handleEntityNotFound(_0x4d6b13,null))[_0x69e3('0x26')](function(_0x50e4ed){if(_0x50e4ed){_0x40edac=_0x50e4ed;_0xa5d855[_0x69e3('0x36')]=_[_0x69e3('0x34')](db[_0x69e3('0x4c')][_0x69e3('0x2f')]);_0xa5d855['query']=_[_0x69e3('0x34')](_0x44e753[_0x69e3('0x33')]);_0xa5d855[_0x69e3('0x35')]=_['intersection'](_0xa5d855[_0x69e3('0x36')],_0xa5d855[_0x69e3('0x33')]);_0x146cd['attributes']=_['intersection'](_0xa5d855[_0x69e3('0x36')],qs[_0x69e3('0x39')](_0x44e753[_0x69e3('0x33')][_0x69e3('0x39')]));_0x146cd[_0x69e3('0x37')]=_0x146cd['attributes']['length']?_0x146cd[_0x69e3('0x37')]:_0xa5d855[_0x69e3('0x36')];_0x146cd['order']=qs['sort'](_0x44e753['query'][_0x69e3('0x3c')]);_0x146cd[_0x69e3('0x3d')]=qs[_0x69e3('0x35')](_['pick'](_0x44e753['query'],_0xa5d855[_0x69e3('0x35')]));if(_0x44e753[_0x69e3('0x33')][_0x69e3('0x3e')]){_0x146cd[_0x69e3('0x3d')]=_[_0x69e3('0x3f')](_0x146cd[_0x69e3('0x3d')],{'$or':_[_0x69e3('0x2d')](_0x146cd[_0x69e3('0x37')],function(_0x10c3d0){var _0x51075d={};_0x51075d[_0x10c3d0]={'$like':'%'+_0x44e753['query'][_0x69e3('0x3e')]+'%'};return _0x51075d;})});}_0x146cd=_['merge']({},_0x146cd,_0x44e753['options']);return _0x40edac[_0x69e3('0x4a')](_0x146cd);}})[_0x69e3('0x26')](function(_0x91250e){if(_0x91250e){_0xc7f693=_0x91250e[_0x69e3('0x3a')];if(!_0x44e753[_0x69e3('0x33')]['hasOwnProperty'](_0x69e3('0x4d'))){_0x146cd[_0x69e3('0x20')]=qs['limit'](_0x44e753[_0x69e3('0x33')][_0x69e3('0x20')]);_0x146cd[_0x69e3('0x1d')]=qs[_0x69e3('0x1d')](_0x44e753[_0x69e3('0x33')]['offset']);}return _0x40edac['getFields'](_0x146cd);}})[_0x69e3('0x26')](function(_0x110cca){if(_0x110cca){return _0x110cca?{'count':_0xc7f693,'rows':_0x110cca}:null;}})[_0x69e3('0x26')](respondWithResult(_0x4d6b13,null))[_0x69e3('0x47')](handleError(_0x4d6b13,null));};exports[_0x69e3('0x4e')]=function(_0x218eaf,_0x35c2fa,_0x345c0b){var _0x4bbbfc={};var _0x5dbd1f={};var _0x5aaae7;var _0x281603;return db[_0x69e3('0x2e')][_0x69e3('0x4b')]({'where':{'id':_0x218eaf[_0x69e3('0x45')]['id']}})[_0x69e3('0x26')](handleEntityNotFound(_0x35c2fa,null))[_0x69e3('0x26')](function(_0x48f233){if(_0x48f233){_0x5aaae7=_0x48f233;_0x5dbd1f['model']=_[_0x69e3('0x34')](db[_0x69e3('0x4c')]['rawAttributes']);_0x5dbd1f['query']=_[_0x69e3('0x34')](_0x218eaf[_0x69e3('0x33')]);_0x5dbd1f[_0x69e3('0x35')]=_[_0x69e3('0x38')](_0x5dbd1f['model'],_0x5dbd1f['query']);_0x4bbbfc[_0x69e3('0x37')]=_[_0x69e3('0x38')](_0x5dbd1f[_0x69e3('0x36')],qs[_0x69e3('0x39')](_0x218eaf['query'][_0x69e3('0x39')]));_0x4bbbfc[_0x69e3('0x37')]=_0x4bbbfc[_0x69e3('0x37')]['length']?_0x4bbbfc[_0x69e3('0x37')]:_0x5dbd1f[_0x69e3('0x36')];_0x4bbbfc['order']=qs['sort'](_0x218eaf[_0x69e3('0x33')][_0x69e3('0x3c')]);_0x4bbbfc['where']=qs[_0x69e3('0x35')](_[_0x69e3('0x4f')](_0x218eaf[_0x69e3('0x33')],_0x5dbd1f[_0x69e3('0x35')]));if(_0x218eaf[_0x69e3('0x33')][_0x69e3('0x3e')]){_0x4bbbfc['where']=_['merge'](_0x4bbbfc['where'],{'$or':_[_0x69e3('0x2d')](_0x4bbbfc[_0x69e3('0x37')],function(_0x5f5aa1){var _0x2d93c1={};_0x2d93c1[_0x5f5aa1]={'$like':'%'+_0x218eaf[_0x69e3('0x33')][_0x69e3('0x3e')]+'%'};return _0x2d93c1;})});}_0x4bbbfc=_[_0x69e3('0x3f')]({},_0x4bbbfc,_0x218eaf[_0x69e3('0x40')]);return _0x5aaae7[_0x69e3('0x4e')](_0x4bbbfc);}})[_0x69e3('0x26')](function(_0x2900cd){if(_0x2900cd){_0x281603=_0x2900cd[_0x69e3('0x3a')];if(!_0x218eaf[_0x69e3('0x33')][_0x69e3('0x3b')]('nolimit')){_0x4bbbfc[_0x69e3('0x20')]=qs[_0x69e3('0x20')](_0x218eaf[_0x69e3('0x33')][_0x69e3('0x20')]);_0x4bbbfc[_0x69e3('0x1d')]=qs[_0x69e3('0x1d')](_0x218eaf[_0x69e3('0x33')][_0x69e3('0x1d')]);}return _0x5aaae7[_0x69e3('0x4e')](_0x4bbbfc);}})[_0x69e3('0x26')](function(_0x4a28ab){if(_0x4a28ab){return _0x4a28ab?{'count':_0x281603,'rows':_0x4a28ab}:null;}})[_0x69e3('0x26')](respondWithResult(_0x35c2fa,null))[_0x69e3('0x47')](handleError(_0x35c2fa,null));};exports['getDescriptions']=function(_0xf62682,_0x306071,_0xf3aee7){var _0x1db0ca={};var _0x1b9400={};var _0xad7490;var _0x49f88d;return db[_0x69e3('0x2e')]['findOne']({'where':{'id':_0xf62682[_0x69e3('0x45')]['id']}})[_0x69e3('0x26')](handleEntityNotFound(_0x306071,null))[_0x69e3('0x26')](function(_0x11c72c){if(_0x11c72c){_0xad7490=_0x11c72c;_0x1b9400[_0x69e3('0x36')]=_[_0x69e3('0x34')](db[_0x69e3('0x4c')]['rawAttributes']);_0x1b9400[_0x69e3('0x33')]=_[_0x69e3('0x34')](_0xf62682[_0x69e3('0x33')]);_0x1b9400[_0x69e3('0x35')]=_['intersection'](_0x1b9400[_0x69e3('0x36')],_0x1b9400[_0x69e3('0x33')]);_0x1db0ca[_0x69e3('0x37')]=_[_0x69e3('0x38')](_0x1b9400[_0x69e3('0x36')],qs['fields'](_0xf62682['query'][_0x69e3('0x39')]));_0x1db0ca[_0x69e3('0x37')]=_0x1db0ca[_0x69e3('0x37')][_0x69e3('0x3a')]?_0x1db0ca[_0x69e3('0x37')]:_0x1b9400['model'];_0x1db0ca[_0x69e3('0x50')]=qs[_0x69e3('0x3c')](_0xf62682['query'][_0x69e3('0x3c')]);_0x1db0ca[_0x69e3('0x3d')]=qs['filters'](_[_0x69e3('0x4f')](_0xf62682[_0x69e3('0x33')],_0x1b9400['filters']));if(_0xf62682[_0x69e3('0x33')][_0x69e3('0x3e')]){_0x1db0ca[_0x69e3('0x3d')]=_['merge'](_0x1db0ca[_0x69e3('0x3d')],{'$or':_[_0x69e3('0x2d')](_0x1db0ca[_0x69e3('0x37')],function(_0x321056){var _0xc654d9={};_0xc654d9[_0x321056]={'$like':'%'+_0xf62682[_0x69e3('0x33')]['filter']+'%'};return _0xc654d9;})});}_0x1db0ca=_[_0x69e3('0x3f')]({},_0x1db0ca,_0xf62682[_0x69e3('0x40')]);return _0xad7490[_0x69e3('0x51')](_0x1db0ca);}})[_0x69e3('0x26')](function(_0x59f671){if(_0x59f671){_0x49f88d=_0x59f671[_0x69e3('0x3a')];if(!_0xf62682[_0x69e3('0x33')]['hasOwnProperty']('nolimit')){_0x1db0ca[_0x69e3('0x20')]=qs[_0x69e3('0x20')](_0xf62682['query'][_0x69e3('0x20')]);_0x1db0ca['offset']=qs[_0x69e3('0x1d')](_0xf62682[_0x69e3('0x33')][_0x69e3('0x1d')]);}return _0xad7490[_0x69e3('0x51')](_0x1db0ca);}})['then'](function(_0x4d5bb6){if(_0x4d5bb6){return _0x4d5bb6?{'count':_0x49f88d,'rows':_0x4d5bb6}:null;}})[_0x69e3('0x26')](respondWithResult(_0x306071,null))[_0x69e3('0x47')](handleError(_0x306071,null));};exports['getTags']=function(_0x4c30d2,_0xb8d853,_0x1b33d9){var _0x1aebec={};var _0xe37d62={};var _0x2ed37e;var _0x255cd2;return db[_0x69e3('0x2e')][_0x69e3('0x4b')]({'where':{'id':_0x4c30d2[_0x69e3('0x45')]['id']}})[_0x69e3('0x26')](handleEntityNotFound(_0xb8d853,null))[_0x69e3('0x26')](function(_0x54e494){if(_0x54e494){_0x2ed37e=_0x54e494;_0xe37d62[_0x69e3('0x36')]=_[_0x69e3('0x34')](db[_0x69e3('0x52')][_0x69e3('0x2f')]);_0xe37d62[_0x69e3('0x33')]=_[_0x69e3('0x34')](_0x4c30d2['query']);_0xe37d62[_0x69e3('0x35')]=_['intersection'](_0xe37d62[_0x69e3('0x36')],_0xe37d62['query']);_0x1aebec[_0x69e3('0x37')]=_['intersection'](_0xe37d62[_0x69e3('0x36')],qs[_0x69e3('0x39')](_0x4c30d2[_0x69e3('0x33')]['fields']));_0x1aebec[_0x69e3('0x37')]=_0x1aebec[_0x69e3('0x37')][_0x69e3('0x3a')]?_0x1aebec[_0x69e3('0x37')]:_0xe37d62[_0x69e3('0x36')];_0x1aebec[_0x69e3('0x50')]=qs[_0x69e3('0x3c')](_0x4c30d2[_0x69e3('0x33')][_0x69e3('0x3c')]);_0x1aebec[_0x69e3('0x3d')]=qs[_0x69e3('0x35')](_['pick'](_0x4c30d2[_0x69e3('0x33')],_0xe37d62[_0x69e3('0x35')]));if(_0x4c30d2[_0x69e3('0x33')][_0x69e3('0x3e')]){_0x1aebec['where']=_[_0x69e3('0x3f')](_0x1aebec[_0x69e3('0x3d')],{'$or':_[_0x69e3('0x2d')](_0x1aebec[_0x69e3('0x37')],function(_0x1f54d3){var _0x4e7cbd={};_0x4e7cbd[_0x1f54d3]={'$like':'%'+_0x4c30d2[_0x69e3('0x33')][_0x69e3('0x3e')]+'%'};return _0x4e7cbd;})});}_0x1aebec=_['merge']({},_0x1aebec,_0x4c30d2[_0x69e3('0x40')]);return _0x2ed37e['getTags'](_0x1aebec);}})[_0x69e3('0x26')](function(_0x9e7b7a){if(_0x9e7b7a){_0x255cd2=_0x9e7b7a[_0x69e3('0x3a')];if(!_0x4c30d2[_0x69e3('0x33')]['hasOwnProperty'](_0x69e3('0x4d'))){_0x1aebec[_0x69e3('0x20')]=qs[_0x69e3('0x20')](_0x4c30d2[_0x69e3('0x33')][_0x69e3('0x20')]);_0x1aebec['offset']=qs[_0x69e3('0x1d')](_0x4c30d2['query'][_0x69e3('0x1d')]);}return _0x2ed37e[_0x69e3('0x53')](_0x1aebec);}})[_0x69e3('0x26')](function(_0xcf4581){if(_0xcf4581){return _0xcf4581?{'count':_0x255cd2,'rows':_0xcf4581}:null;}})[_0x69e3('0x26')](respondWithResult(_0xb8d853,null))[_0x69e3('0x47')](handleError(_0xb8d853,null));};exports[_0x69e3('0x54')]=function(_0x13d3fc,_0x3374c7,_0x54001d){if(_0x13d3fc[_0x69e3('0x49')]['id']){delete _0x13d3fc['body']['id'];}return db[_0x69e3('0x2e')][_0x69e3('0x4b')]({'where':{'id':_0x13d3fc[_0x69e3('0x45')]['id']}})[_0x69e3('0x26')](handleEntityNotFound(_0x3374c7,null))['then'](function(_0x10db5f){if(_0x10db5f){return _0x10db5f[_0x69e3('0x54')](_0x13d3fc[_0x69e3('0x49')][_0x69e3('0x55')]||[]);}return null;})[_0x69e3('0x26')](respondWithResult(_0x3374c7,null))['catch'](handleError(_0x3374c7,null));}; \ No newline at end of file +var _0x8fae=['options','includeAll','include','rows','params','catch','create','body','find','intersection','order','getFields','nolimit','getSubjects','findOne','getDescriptions','FreshdeskField','getTags','Tag','setTags','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','fs-extra','lodash','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','set','apply','save','update','then','destroy','sendStatus','error','stack','send','map','FreshdeskConfiguration','rawAttributes','fieldName','key','model','name','query','keys','attributes','fields','length','hasOwnProperty','sort','where','filters','pick','filter','type','VIRTUAL','merge'];(function(_0x40c7f7,_0x42bc78){var _0x479755=function(_0x502b1e){while(--_0x502b1e){_0x40c7f7['push'](_0x40c7f7['shift']());}};_0x479755(++_0x42bc78);}(_0x8fae,0x10d));var _0xe8fa=function(_0x4fd5bc,_0x56f503){_0x4fd5bc=_0x4fd5bc-0x0;var _0x6b69d7=_0x8fae[_0x4fd5bc];return _0x6b69d7;};'use strict';var emlformat=require(_0xe8fa('0x0'));var rimraf=require(_0xe8fa('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe8fa('0x2'));var rp=require(_0xe8fa('0x3'));var moment=require(_0xe8fa('0x4'));var BPromise=require(_0xe8fa('0x5'));var Mustache=require('mustache');var util=require(_0xe8fa('0x6'));var path=require(_0xe8fa('0x7'));var sox=require(_0xe8fa('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe8fa('0x9'));var _=require(_0xe8fa('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xe8fa('0xb'));var deskjs=require(_0xe8fa('0xc'));var toCsv=require(_0xe8fa('0xd'));var querystring=require(_0xe8fa('0xe'));var Papa=require(_0xe8fa('0xf'));var Redis=require(_0xe8fa('0x10'));var authService=require(_0xe8fa('0x11'));var qs=require(_0xe8fa('0x12'));var as=require(_0xe8fa('0x13'));var hardwareService=require(_0xe8fa('0x14'));var logger=require(_0xe8fa('0x15'))(_0xe8fa('0x16'));var utils=require('../../config/utils');var config=require(_0xe8fa('0x17'));var licenseUtil=require(_0xe8fa('0x18'));var db=require(_0xe8fa('0x19'))['db'];function respondWithStatusCode(_0x13d18a,_0x4298d3){_0x4298d3=_0x4298d3||0xcc;return function(_0x5dc11c){if(_0x5dc11c){return _0x13d18a['sendStatus'](_0x4298d3);}return _0x13d18a['status'](_0x4298d3)['end']();};}function respondWithResult(_0x3ef98e,_0x4e4cad){_0x4e4cad=_0x4e4cad||0xc8;return function(_0x5b8a68){if(_0x5b8a68){return _0x3ef98e[_0xe8fa('0x1a')](_0x4e4cad)[_0xe8fa('0x1b')](_0x5b8a68);}};}function respondWithFilteredResult(_0x7765d1,_0x4efe9c){return function(_0xddd7fd){if(_0xddd7fd){var _0x5cedc5=typeof _0x4efe9c[_0xe8fa('0x1c')]===_0xe8fa('0x1d')&&typeof _0x4efe9c[_0xe8fa('0x1e')]===_0xe8fa('0x1d');var _0x367db0=_0xddd7fd[_0xe8fa('0x1f')];var _0x4b74e1=_0x5cedc5?0x0:_0x4efe9c[_0xe8fa('0x1c')];var _0xdb271f=_0x5cedc5?_0xddd7fd[_0xe8fa('0x1f')]:_0x4efe9c[_0xe8fa('0x1c')]+_0x4efe9c[_0xe8fa('0x1e')];var _0x4473d0;if(_0xdb271f>=_0x367db0){_0xdb271f=_0x367db0;_0x4473d0=0xc8;}else{_0x4473d0=0xce;}_0x7765d1[_0xe8fa('0x1a')](_0x4473d0);return _0x7765d1[_0xe8fa('0x20')]('Content-Range',_0x4b74e1+'-'+_0xdb271f+'/'+_0x367db0)[_0xe8fa('0x1b')](_0xddd7fd);}return null;};}function patchUpdates(_0x3c33de){return function(_0x3130f4){try{jsonpatch[_0xe8fa('0x21')](_0x3130f4,_0x3c33de,!![]);}catch(_0x4ae66a){return BPromise['reject'](_0x4ae66a);}return _0x3130f4[_0xe8fa('0x22')]();};}function saveUpdates(_0x19d52e,_0x366b86){return function(_0x13bc6c){if(_0x13bc6c){return _0x13bc6c[_0xe8fa('0x23')](_0x19d52e)[_0xe8fa('0x24')](function(_0x3f864d){return _0x3f864d;});}return null;};}function removeEntity(_0x1af7ac,_0xf65226){return function(_0x2b49e2){if(_0x2b49e2){return _0x2b49e2[_0xe8fa('0x25')]()[_0xe8fa('0x24')](function(){_0x1af7ac[_0xe8fa('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1d170b,_0x4f3b49){return function(_0x7a9652){if(!_0x7a9652){_0x1d170b[_0xe8fa('0x26')](0x194);}return _0x7a9652;};}function handleError(_0x299651,_0x282da0){_0x282da0=_0x282da0||0x1f4;return function(_0x2e3cd0){logger[_0xe8fa('0x27')](_0x2e3cd0[_0xe8fa('0x28')]);if(_0x2e3cd0['name']){delete _0x2e3cd0['name'];}_0x299651['status'](_0x282da0)[_0xe8fa('0x29')](_0x2e3cd0);};}exports['index']=function(_0x1c1a90,_0x202049){var _0x50f84f={},_0xa692b3={},_0xc21834={'count':0x0,'rows':[]};var _0x5479d4=_[_0xe8fa('0x2a')](db[_0xe8fa('0x2b')][_0xe8fa('0x2c')],function(_0x188652){return{'name':_0x188652[_0xe8fa('0x2d')],'type':_0x188652['type'][_0xe8fa('0x2e')]};});_0xa692b3[_0xe8fa('0x2f')]=_[_0xe8fa('0x2a')](_0x5479d4,_0xe8fa('0x30'));_0xa692b3[_0xe8fa('0x31')]=_[_0xe8fa('0x32')](_0x1c1a90['query']);_0xa692b3['filters']=_['intersection'](_0xa692b3[_0xe8fa('0x2f')],_0xa692b3[_0xe8fa('0x31')]);_0x50f84f[_0xe8fa('0x33')]=_['intersection'](_0xa692b3[_0xe8fa('0x2f')],qs[_0xe8fa('0x34')](_0x1c1a90[_0xe8fa('0x31')][_0xe8fa('0x34')]));_0x50f84f[_0xe8fa('0x33')]=_0x50f84f[_0xe8fa('0x33')][_0xe8fa('0x35')]?_0x50f84f['attributes']:_0xa692b3[_0xe8fa('0x2f')];if(!_0x1c1a90['query'][_0xe8fa('0x36')]('nolimit')){_0x50f84f[_0xe8fa('0x1e')]=qs[_0xe8fa('0x1e')](_0x1c1a90['query'][_0xe8fa('0x1e')]);_0x50f84f['offset']=qs[_0xe8fa('0x1c')](_0x1c1a90['query'][_0xe8fa('0x1c')]);}_0x50f84f['order']=qs[_0xe8fa('0x37')](_0x1c1a90[_0xe8fa('0x31')][_0xe8fa('0x37')]);_0x50f84f[_0xe8fa('0x38')]=qs[_0xe8fa('0x39')](_[_0xe8fa('0x3a')](_0x1c1a90[_0xe8fa('0x31')],_0xa692b3[_0xe8fa('0x39')]),_0x5479d4);if(_0x1c1a90[_0xe8fa('0x31')][_0xe8fa('0x3b')]){_0x50f84f[_0xe8fa('0x38')]=_['merge'](_0x50f84f[_0xe8fa('0x38')],{'$or':_[_0xe8fa('0x2a')](_0x5479d4,function(_0x43a891){if(_0x43a891[_0xe8fa('0x3c')]!==_0xe8fa('0x3d')){var _0x546ca5={};_0x546ca5[_0x43a891[_0xe8fa('0x30')]]={'$like':'%'+_0x1c1a90['query'][_0xe8fa('0x3b')]+'%'};return _0x546ca5;}})});}_0x50f84f=_[_0xe8fa('0x3e')]({},_0x50f84f,_0x1c1a90[_0xe8fa('0x3f')]);var _0x38984b={'where':_0x50f84f[_0xe8fa('0x38')]};return db[_0xe8fa('0x2b')][_0xe8fa('0x1f')](_0x38984b)['then'](function(_0x5b9399){_0xc21834['count']=_0x5b9399;if(_0x1c1a90[_0xe8fa('0x31')][_0xe8fa('0x40')]){_0x50f84f[_0xe8fa('0x41')]=[{'all':!![]}];}return db[_0xe8fa('0x2b')]['findAll'](_0x50f84f);})[_0xe8fa('0x24')](function(_0x21ff92){_0xc21834[_0xe8fa('0x42')]=_0x21ff92;return _0xc21834;})[_0xe8fa('0x24')](respondWithFilteredResult(_0x202049,_0x50f84f))['catch'](handleError(_0x202049,null));};exports['show']=function(_0x3acdce,_0xe70bac){var _0x10e322={'raw':![],'where':{'id':_0x3acdce[_0xe8fa('0x43')]['id']}},_0x592d69={};_0x592d69[_0xe8fa('0x2f')]=_['keys'](db[_0xe8fa('0x2b')][_0xe8fa('0x2c')]);_0x592d69[_0xe8fa('0x31')]=_[_0xe8fa('0x32')](_0x3acdce[_0xe8fa('0x31')]);_0x592d69[_0xe8fa('0x39')]=_['intersection'](_0x592d69[_0xe8fa('0x2f')],_0x592d69['query']);_0x10e322['attributes']=_['intersection'](_0x592d69['model'],qs[_0xe8fa('0x34')](_0x3acdce['query'][_0xe8fa('0x34')]));_0x10e322[_0xe8fa('0x33')]=_0x10e322[_0xe8fa('0x33')][_0xe8fa('0x35')]?_0x10e322['attributes']:_0x592d69[_0xe8fa('0x2f')];if(_0x3acdce[_0xe8fa('0x31')][_0xe8fa('0x40')]){_0x10e322[_0xe8fa('0x41')]=[{'all':!![]}];}_0x10e322=_[_0xe8fa('0x3e')]({},_0x10e322,_0x3acdce[_0xe8fa('0x3f')]);return db['FreshdeskConfiguration']['find'](_0x10e322)[_0xe8fa('0x24')](handleEntityNotFound(_0xe70bac,null))['then'](respondWithResult(_0xe70bac,null))[_0xe8fa('0x44')](handleError(_0xe70bac,null));};exports[_0xe8fa('0x45')]=function(_0x57a0f3,_0x3c7d22){return db[_0xe8fa('0x2b')][_0xe8fa('0x45')](_0x57a0f3[_0xe8fa('0x46')],{})[_0xe8fa('0x24')](respondWithResult(_0x3c7d22,0xc9))[_0xe8fa('0x44')](handleError(_0x3c7d22,null));};exports[_0xe8fa('0x23')]=function(_0x52083c,_0x5be19c){if(_0x52083c['body']['id']){delete _0x52083c[_0xe8fa('0x46')]['id'];}return db[_0xe8fa('0x2b')][_0xe8fa('0x47')]({'where':{'id':_0x52083c[_0xe8fa('0x43')]['id']}})['then'](handleEntityNotFound(_0x5be19c,null))[_0xe8fa('0x24')](saveUpdates(_0x52083c['body'],null))[_0xe8fa('0x24')](respondWithResult(_0x5be19c,null))[_0xe8fa('0x44')](handleError(_0x5be19c,null));};exports['destroy']=function(_0x5c320c,_0xfd1336){return db['FreshdeskConfiguration']['find']({'where':{'id':_0x5c320c[_0xe8fa('0x43')]['id']}})[_0xe8fa('0x24')](handleEntityNotFound(_0xfd1336,null))[_0xe8fa('0x24')](removeEntity(_0xfd1336,null))[_0xe8fa('0x44')](handleError(_0xfd1336,null));};exports['getFields']=function(_0x2d9b1d,_0xd194b6,_0x528bea){var _0x2b9f62={};var _0x118fb6={};var _0x1abbc2;var _0x2f98e4;return db[_0xe8fa('0x2b')]['findOne']({'where':{'id':_0x2d9b1d[_0xe8fa('0x43')]['id']}})[_0xe8fa('0x24')](handleEntityNotFound(_0xd194b6,null))[_0xe8fa('0x24')](function(_0x14c77a){if(_0x14c77a){_0x1abbc2=_0x14c77a;_0x118fb6[_0xe8fa('0x2f')]=_['keys'](db['FreshdeskField']['rawAttributes']);_0x118fb6['query']=_[_0xe8fa('0x32')](_0x2d9b1d[_0xe8fa('0x31')]);_0x118fb6[_0xe8fa('0x39')]=_[_0xe8fa('0x48')](_0x118fb6[_0xe8fa('0x2f')],_0x118fb6[_0xe8fa('0x31')]);_0x2b9f62[_0xe8fa('0x33')]=_[_0xe8fa('0x48')](_0x118fb6[_0xe8fa('0x2f')],qs[_0xe8fa('0x34')](_0x2d9b1d[_0xe8fa('0x31')][_0xe8fa('0x34')]));_0x2b9f62[_0xe8fa('0x33')]=_0x2b9f62['attributes']['length']?_0x2b9f62[_0xe8fa('0x33')]:_0x118fb6[_0xe8fa('0x2f')];_0x2b9f62[_0xe8fa('0x49')]=qs[_0xe8fa('0x37')](_0x2d9b1d[_0xe8fa('0x31')][_0xe8fa('0x37')]);_0x2b9f62[_0xe8fa('0x38')]=qs[_0xe8fa('0x39')](_[_0xe8fa('0x3a')](_0x2d9b1d[_0xe8fa('0x31')],_0x118fb6[_0xe8fa('0x39')]));if(_0x2d9b1d[_0xe8fa('0x31')][_0xe8fa('0x3b')]){_0x2b9f62['where']=_[_0xe8fa('0x3e')](_0x2b9f62[_0xe8fa('0x38')],{'$or':_['map'](_0x2b9f62[_0xe8fa('0x33')],function(_0x187148){var _0x156d8b={};_0x156d8b[_0x187148]={'$like':'%'+_0x2d9b1d[_0xe8fa('0x31')][_0xe8fa('0x3b')]+'%'};return _0x156d8b;})});}_0x2b9f62=_['merge']({},_0x2b9f62,_0x2d9b1d['options']);return _0x1abbc2[_0xe8fa('0x4a')](_0x2b9f62);}})['then'](function(_0x20e6c9){if(_0x20e6c9){_0x2f98e4=_0x20e6c9[_0xe8fa('0x35')];if(!_0x2d9b1d[_0xe8fa('0x31')]['hasOwnProperty'](_0xe8fa('0x4b'))){_0x2b9f62[_0xe8fa('0x1e')]=qs[_0xe8fa('0x1e')](_0x2d9b1d[_0xe8fa('0x31')][_0xe8fa('0x1e')]);_0x2b9f62[_0xe8fa('0x1c')]=qs[_0xe8fa('0x1c')](_0x2d9b1d[_0xe8fa('0x31')]['offset']);}return _0x1abbc2['getFields'](_0x2b9f62);}})[_0xe8fa('0x24')](function(_0x3dab64){if(_0x3dab64){return _0x3dab64?{'count':_0x2f98e4,'rows':_0x3dab64}:null;}})['then'](respondWithResult(_0xd194b6,null))[_0xe8fa('0x44')](handleError(_0xd194b6,null));};exports[_0xe8fa('0x4c')]=function(_0x1d7369,_0x1cd9cc,_0x42e8f2){var _0x40409a={};var _0xde20b4={};var _0x3443f8;var _0x1376c6;return db[_0xe8fa('0x2b')][_0xe8fa('0x4d')]({'where':{'id':_0x1d7369[_0xe8fa('0x43')]['id']}})[_0xe8fa('0x24')](handleEntityNotFound(_0x1cd9cc,null))[_0xe8fa('0x24')](function(_0x415f9b){if(_0x415f9b){_0x3443f8=_0x415f9b;_0xde20b4[_0xe8fa('0x2f')]=_[_0xe8fa('0x32')](db['FreshdeskField'][_0xe8fa('0x2c')]);_0xde20b4['query']=_[_0xe8fa('0x32')](_0x1d7369['query']);_0xde20b4[_0xe8fa('0x39')]=_[_0xe8fa('0x48')](_0xde20b4[_0xe8fa('0x2f')],_0xde20b4[_0xe8fa('0x31')]);_0x40409a[_0xe8fa('0x33')]=_[_0xe8fa('0x48')](_0xde20b4['model'],qs[_0xe8fa('0x34')](_0x1d7369[_0xe8fa('0x31')][_0xe8fa('0x34')]));_0x40409a[_0xe8fa('0x33')]=_0x40409a[_0xe8fa('0x33')]['length']?_0x40409a[_0xe8fa('0x33')]:_0xde20b4[_0xe8fa('0x2f')];_0x40409a[_0xe8fa('0x49')]=qs['sort'](_0x1d7369[_0xe8fa('0x31')][_0xe8fa('0x37')]);_0x40409a[_0xe8fa('0x38')]=qs[_0xe8fa('0x39')](_['pick'](_0x1d7369[_0xe8fa('0x31')],_0xde20b4[_0xe8fa('0x39')]));if(_0x1d7369[_0xe8fa('0x31')][_0xe8fa('0x3b')]){_0x40409a[_0xe8fa('0x38')]=_[_0xe8fa('0x3e')](_0x40409a[_0xe8fa('0x38')],{'$or':_[_0xe8fa('0x2a')](_0x40409a['attributes'],function(_0xf8ea77){var _0x338e5e={};_0x338e5e[_0xf8ea77]={'$like':'%'+_0x1d7369[_0xe8fa('0x31')][_0xe8fa('0x3b')]+'%'};return _0x338e5e;})});}_0x40409a=_[_0xe8fa('0x3e')]({},_0x40409a,_0x1d7369[_0xe8fa('0x3f')]);return _0x3443f8[_0xe8fa('0x4c')](_0x40409a);}})[_0xe8fa('0x24')](function(_0x1512c0){if(_0x1512c0){_0x1376c6=_0x1512c0[_0xe8fa('0x35')];if(!_0x1d7369[_0xe8fa('0x31')]['hasOwnProperty'](_0xe8fa('0x4b'))){_0x40409a[_0xe8fa('0x1e')]=qs[_0xe8fa('0x1e')](_0x1d7369[_0xe8fa('0x31')][_0xe8fa('0x1e')]);_0x40409a[_0xe8fa('0x1c')]=qs[_0xe8fa('0x1c')](_0x1d7369['query']['offset']);}return _0x3443f8[_0xe8fa('0x4c')](_0x40409a);}})[_0xe8fa('0x24')](function(_0x3e28ac){if(_0x3e28ac){return _0x3e28ac?{'count':_0x1376c6,'rows':_0x3e28ac}:null;}})[_0xe8fa('0x24')](respondWithResult(_0x1cd9cc,null))[_0xe8fa('0x44')](handleError(_0x1cd9cc,null));};exports[_0xe8fa('0x4e')]=function(_0x3ea2ad,_0x4844fe,_0x12aa94){var _0x26fde1={};var _0x56705f={};var _0x53804d;var _0x29362c;return db[_0xe8fa('0x2b')]['findOne']({'where':{'id':_0x3ea2ad[_0xe8fa('0x43')]['id']}})[_0xe8fa('0x24')](handleEntityNotFound(_0x4844fe,null))[_0xe8fa('0x24')](function(_0x48c02e){if(_0x48c02e){_0x53804d=_0x48c02e;_0x56705f[_0xe8fa('0x2f')]=_[_0xe8fa('0x32')](db[_0xe8fa('0x4f')]['rawAttributes']);_0x56705f[_0xe8fa('0x31')]=_[_0xe8fa('0x32')](_0x3ea2ad[_0xe8fa('0x31')]);_0x56705f[_0xe8fa('0x39')]=_[_0xe8fa('0x48')](_0x56705f[_0xe8fa('0x2f')],_0x56705f['query']);_0x26fde1[_0xe8fa('0x33')]=_[_0xe8fa('0x48')](_0x56705f[_0xe8fa('0x2f')],qs[_0xe8fa('0x34')](_0x3ea2ad[_0xe8fa('0x31')][_0xe8fa('0x34')]));_0x26fde1[_0xe8fa('0x33')]=_0x26fde1[_0xe8fa('0x33')]['length']?_0x26fde1[_0xe8fa('0x33')]:_0x56705f[_0xe8fa('0x2f')];_0x26fde1['order']=qs['sort'](_0x3ea2ad[_0xe8fa('0x31')][_0xe8fa('0x37')]);_0x26fde1['where']=qs['filters'](_[_0xe8fa('0x3a')](_0x3ea2ad[_0xe8fa('0x31')],_0x56705f[_0xe8fa('0x39')]));if(_0x3ea2ad[_0xe8fa('0x31')]['filter']){_0x26fde1[_0xe8fa('0x38')]=_[_0xe8fa('0x3e')](_0x26fde1[_0xe8fa('0x38')],{'$or':_[_0xe8fa('0x2a')](_0x26fde1[_0xe8fa('0x33')],function(_0x110ad0){var _0x2190b2={};_0x2190b2[_0x110ad0]={'$like':'%'+_0x3ea2ad[_0xe8fa('0x31')][_0xe8fa('0x3b')]+'%'};return _0x2190b2;})});}_0x26fde1=_[_0xe8fa('0x3e')]({},_0x26fde1,_0x3ea2ad[_0xe8fa('0x3f')]);return _0x53804d['getDescriptions'](_0x26fde1);}})[_0xe8fa('0x24')](function(_0x4dac52){if(_0x4dac52){_0x29362c=_0x4dac52[_0xe8fa('0x35')];if(!_0x3ea2ad['query'][_0xe8fa('0x36')](_0xe8fa('0x4b'))){_0x26fde1[_0xe8fa('0x1e')]=qs[_0xe8fa('0x1e')](_0x3ea2ad[_0xe8fa('0x31')][_0xe8fa('0x1e')]);_0x26fde1['offset']=qs[_0xe8fa('0x1c')](_0x3ea2ad[_0xe8fa('0x31')][_0xe8fa('0x1c')]);}return _0x53804d[_0xe8fa('0x4e')](_0x26fde1);}})[_0xe8fa('0x24')](function(_0x566607){if(_0x566607){return _0x566607?{'count':_0x29362c,'rows':_0x566607}:null;}})[_0xe8fa('0x24')](respondWithResult(_0x4844fe,null))[_0xe8fa('0x44')](handleError(_0x4844fe,null));};exports[_0xe8fa('0x50')]=function(_0x11265e,_0x555d23,_0x1944ba){var _0xa22d4={};var _0x24072c={};var _0x379da5;var _0x518b35;return db[_0xe8fa('0x2b')][_0xe8fa('0x4d')]({'where':{'id':_0x11265e[_0xe8fa('0x43')]['id']}})['then'](handleEntityNotFound(_0x555d23,null))[_0xe8fa('0x24')](function(_0x37b79f){if(_0x37b79f){_0x379da5=_0x37b79f;_0x24072c[_0xe8fa('0x2f')]=_[_0xe8fa('0x32')](db[_0xe8fa('0x51')][_0xe8fa('0x2c')]);_0x24072c['query']=_[_0xe8fa('0x32')](_0x11265e['query']);_0x24072c[_0xe8fa('0x39')]=_[_0xe8fa('0x48')](_0x24072c[_0xe8fa('0x2f')],_0x24072c[_0xe8fa('0x31')]);_0xa22d4[_0xe8fa('0x33')]=_[_0xe8fa('0x48')](_0x24072c[_0xe8fa('0x2f')],qs[_0xe8fa('0x34')](_0x11265e[_0xe8fa('0x31')][_0xe8fa('0x34')]));_0xa22d4[_0xe8fa('0x33')]=_0xa22d4[_0xe8fa('0x33')][_0xe8fa('0x35')]?_0xa22d4[_0xe8fa('0x33')]:_0x24072c[_0xe8fa('0x2f')];_0xa22d4[_0xe8fa('0x49')]=qs[_0xe8fa('0x37')](_0x11265e['query'][_0xe8fa('0x37')]);_0xa22d4[_0xe8fa('0x38')]=qs[_0xe8fa('0x39')](_[_0xe8fa('0x3a')](_0x11265e['query'],_0x24072c[_0xe8fa('0x39')]));if(_0x11265e[_0xe8fa('0x31')][_0xe8fa('0x3b')]){_0xa22d4['where']=_[_0xe8fa('0x3e')](_0xa22d4[_0xe8fa('0x38')],{'$or':_[_0xe8fa('0x2a')](_0xa22d4['attributes'],function(_0xfc5753){var _0x4c49fd={};_0x4c49fd[_0xfc5753]={'$like':'%'+_0x11265e[_0xe8fa('0x31')][_0xe8fa('0x3b')]+'%'};return _0x4c49fd;})});}_0xa22d4=_[_0xe8fa('0x3e')]({},_0xa22d4,_0x11265e['options']);return _0x379da5[_0xe8fa('0x50')](_0xa22d4);}})[_0xe8fa('0x24')](function(_0x2e4dab){if(_0x2e4dab){_0x518b35=_0x2e4dab[_0xe8fa('0x35')];if(!_0x11265e[_0xe8fa('0x31')][_0xe8fa('0x36')]('nolimit')){_0xa22d4[_0xe8fa('0x1e')]=qs[_0xe8fa('0x1e')](_0x11265e['query'][_0xe8fa('0x1e')]);_0xa22d4[_0xe8fa('0x1c')]=qs['offset'](_0x11265e[_0xe8fa('0x31')][_0xe8fa('0x1c')]);}return _0x379da5[_0xe8fa('0x50')](_0xa22d4);}})[_0xe8fa('0x24')](function(_0x4355b8){if(_0x4355b8){return _0x4355b8?{'count':_0x518b35,'rows':_0x4355b8}:null;}})[_0xe8fa('0x24')](respondWithResult(_0x555d23,null))['catch'](handleError(_0x555d23,null));};exports[_0xe8fa('0x52')]=function(_0x577172,_0x35e3a0,_0x18221a){if(_0x577172[_0xe8fa('0x46')]['id']){delete _0x577172[_0xe8fa('0x46')]['id'];}return db[_0xe8fa('0x2b')][_0xe8fa('0x4d')]({'where':{'id':_0x577172[_0xe8fa('0x43')]['id']}})[_0xe8fa('0x24')](handleEntityNotFound(_0x35e3a0,null))['then'](function(_0x4ca780){if(_0x4ca780){return _0x4ca780[_0xe8fa('0x52')](_0x577172['body']['ids']||[]);}return null;})[_0xe8fa('0x24')](respondWithResult(_0x35e3a0,null))[_0xe8fa('0x44')](handleError(_0x35e3a0,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index 8170c8c..e05e102 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 _0x6a59=['request-promise','path','rimraf','../../config/environment','./intFreshdeskConfiguration.attributes','define','FreshdeskConfiguration','lodash','util','api','moment'];(function(_0x52207b,_0x166990){var _0x1a2824=function(_0x20c589){while(--_0x20c589){_0x52207b['push'](_0x52207b['shift']());}};_0x1a2824(++_0x166990);}(_0x6a59,0xe3));var _0x96a5=function(_0x5c2e3e,_0x26ecd3){_0x5c2e3e=_0x5c2e3e-0x0;var _0x53f64a=_0x6a59[_0x5c2e3e];return _0x53f64a;};'use strict';var _=require(_0x96a5('0x0'));var util=require(_0x96a5('0x1'));var logger=require('../../config/logger')(_0x96a5('0x2'));var moment=require(_0x96a5('0x3'));var BPromise=require('bluebird');var rp=require(_0x96a5('0x4'));var fs=require('fs');var path=require(_0x96a5('0x5'));var rimraf=require(_0x96a5('0x6'));var config=require(_0x96a5('0x7'));var attributes=require(_0x96a5('0x8'));module['exports']=function(_0x19ec7e,_0x2e7965){return _0x19ec7e[_0x96a5('0x9')](_0x96a5('0xa'),attributes,{'tableName':'int_freshdesk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4fbd=['./intFreshdeskConfiguration.attributes','exports','define','FreshdeskConfiguration','int_freshdesk_configurations','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x2085f3,_0x50105b){var _0x384e3c=function(_0x235fa0){while(--_0x235fa0){_0x2085f3['push'](_0x2085f3['shift']());}};_0x384e3c(++_0x50105b);}(_0x4fbd,0x1bd));var _0xd4fb=function(_0x5a1140,_0x3d5d11){_0x5a1140=_0x5a1140-0x0;var _0x14f1c9=_0x4fbd[_0x5a1140];return _0x14f1c9;};'use strict';var _=require('lodash');var util=require(_0xd4fb('0x0'));var logger=require(_0xd4fb('0x1'))(_0xd4fb('0x2'));var moment=require(_0xd4fb('0x3'));var BPromise=require(_0xd4fb('0x4'));var rp=require(_0xd4fb('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xd4fb('0x6'));module[_0xd4fb('0x7')]=function(_0x4c3af1,_0x365a2e){return _0x4c3af1[_0xd4fb('0x8')](_0xd4fb('0x9'),attributes,{'tableName':_0xd4fb('0xa'),'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 f84ab9f..7342723 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 _0xcf26=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util'];(function(_0x3f6bcf,_0x531e79){var _0x1c5350=function(_0x282fc5){while(--_0x282fc5){_0x3f6bcf['push'](_0x3f6bcf['shift']());}};_0x1c5350(++_0x531e79);}(_0xcf26,0x16e));var _0x6cf2=function(_0x216d45,_0x4989fe){_0x216d45=_0x216d45-0x0;var _0xbaac0b=_0xcf26[_0x216d45];return _0xbaac0b;};'use strict';var _=require(_0x6cf2('0x0'));var util=require(_0x6cf2('0x1'));var moment=require(_0x6cf2('0x2'));var BPromise=require(_0x6cf2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6cf2('0x4'));var db=require(_0x6cf2('0x5'))['db'];var utils=require(_0x6cf2('0x6'));var logger=require('../../config/logger')(_0x6cf2('0x7'));var config=require(_0x6cf2('0x8'));var jayson=require(_0x6cf2('0x9'));var client=jayson[_0x6cf2('0xa')][_0x6cf2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3b20c0,_0x244dbc,_0x1bf830){return new BPromise(function(_0x5577a2,_0x1f2449){return client['request'](_0x3b20c0,_0x1bf830)['then'](function(_0x19b22d){logger[_0x6cf2('0xc')](_0x6cf2('0xd'),_0x244dbc,_0x6cf2('0xe'));logger[_0x6cf2('0xf')](_0x6cf2('0x10'),_0x244dbc,'request\x20sent',JSON[_0x6cf2('0x11')](_0x19b22d));if(_0x19b22d[_0x6cf2('0x12')]){if(_0x19b22d[_0x6cf2('0x12')][_0x6cf2('0x13')]===0x1f4){logger[_0x6cf2('0x12')](_0x6cf2('0xd'),_0x244dbc,_0x19b22d[_0x6cf2('0x12')][_0x6cf2('0x14')]);return _0x1f2449(_0x19b22d[_0x6cf2('0x12')][_0x6cf2('0x14')]);}logger[_0x6cf2('0x12')](_0x6cf2('0xd'),_0x244dbc,_0x19b22d[_0x6cf2('0x12')][_0x6cf2('0x14')]);return _0x5577a2(_0x19b22d['error'][_0x6cf2('0x14')]);}else{logger[_0x6cf2('0xc')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x244dbc,_0x6cf2('0xe'));_0x5577a2(_0x19b22d[_0x6cf2('0x15')][_0x6cf2('0x14')]);}})[_0x6cf2('0x16')](function(_0xc21e36){logger[_0x6cf2('0x12')](_0x6cf2('0xd'),_0x244dbc,_0xc21e36);_0x1f2449(_0xc21e36);});});} \ No newline at end of file +var _0xc440=['../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','util','moment','ioredis','../../mysqldb'];(function(_0x333fed,_0x3d2122){var _0x12cac2=function(_0x41d9af){while(--_0x41d9af){_0x333fed['push'](_0x333fed['shift']());}};_0x12cac2(++_0x3d2122);}(_0xc440,0x1c7));var _0x0c44=function(_0x5bc7d7,_0x315f09){_0x5bc7d7=_0x5bc7d7-0x0;var _0x483195=_0xc440[_0x5bc7d7];return _0x483195;};'use strict';var _=require(_0x0c44('0x0'));var util=require(_0x0c44('0x1'));var moment=require(_0x0c44('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0c44('0x3'));var db=require(_0x0c44('0x4'))['db'];var utils=require(_0x0c44('0x5'));var logger=require(_0x0c44('0x6'))(_0x0c44('0x7'));var config=require(_0x0c44('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x0c44('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x10fbbf,_0x39323d,_0xbf0a2b){return new BPromise(function(_0x5f39b2,_0x1b3b62){return client[_0x0c44('0xa')](_0x10fbbf,_0xbf0a2b)[_0x0c44('0xb')](function(_0x4d4839){logger[_0x0c44('0xc')](_0x0c44('0xd'),_0x39323d,_0x0c44('0xe'));logger['debug'](_0x0c44('0xf'),_0x39323d,'request\x20sent',JSON[_0x0c44('0x10')](_0x4d4839));if(_0x4d4839[_0x0c44('0x11')]){if(_0x4d4839[_0x0c44('0x11')][_0x0c44('0x12')]===0x1f4){logger[_0x0c44('0x11')](_0x0c44('0xd'),_0x39323d,_0x4d4839[_0x0c44('0x11')][_0x0c44('0x13')]);return _0x1b3b62(_0x4d4839[_0x0c44('0x11')][_0x0c44('0x13')]);}logger[_0x0c44('0x11')](_0x0c44('0xd'),_0x39323d,_0x4d4839[_0x0c44('0x11')][_0x0c44('0x13')]);return _0x5f39b2(_0x4d4839[_0x0c44('0x11')]['message']);}else{logger[_0x0c44('0xc')](_0x0c44('0xd'),_0x39323d,_0x0c44('0xe'));_0x5f39b2(_0x4d4839['result']['message']);}})['catch'](function(_0x504d96){logger[_0x0c44('0x11')](_0x0c44('0xd'),_0x39323d,_0x504d96);_0x1b3b62(_0x504d96);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index addb868..f153267 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 _0x0f8a=['index','show','post','create','put','/:id','delete','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated'];(function(_0x4baea9,_0x5484b0){var _0x337c11=function(_0x5ee4d8){while(--_0x5ee4d8){_0x4baea9['push'](_0x4baea9['shift']());}};_0x337c11(++_0x5484b0);}(_0x0f8a,0xa9));var _0xa0f8=function(_0x38bf94,_0x173992){_0x38bf94=_0x38bf94-0x0;var _0x4a92e0=_0x0f8a[_0x38bf94];return _0x4a92e0;};'use strict';var multer=require(_0xa0f8('0x0'));var util=require('util');var path=require(_0xa0f8('0x1'));var timeout=require(_0xa0f8('0x2'));var express=require(_0xa0f8('0x3'));var router=express[_0xa0f8('0x4')]();var fs_extra=require(_0xa0f8('0x5'));var auth=require(_0xa0f8('0x6'));var interaction=require(_0xa0f8('0x7'));var config=require(_0xa0f8('0x8'));var controller=require('./intFreshdeskField.controller');router[_0xa0f8('0x9')]('/',auth[_0xa0f8('0xa')](),controller[_0xa0f8('0xb')]);router[_0xa0f8('0x9')]('/:id',auth[_0xa0f8('0xa')](),controller[_0xa0f8('0xc')]);router[_0xa0f8('0xd')]('/',auth['isAuthenticated'](),controller[_0xa0f8('0xe')]);router[_0xa0f8('0xf')](_0xa0f8('0x10'),auth[_0xa0f8('0xa')](),controller['update']);router[_0xa0f8('0x11')](_0xa0f8('0x10'),auth[_0xa0f8('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x7271=['./intFreshdeskField.controller','get','index','/:id','isAuthenticated','show','post','create','put','update','destroy','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x8abd64,_0x539570){var _0xd2511e=function(_0x9fef7d){while(--_0x9fef7d){_0x8abd64['push'](_0x8abd64['shift']());}};_0xd2511e(++_0x539570);}(_0x7271,0xc0));var _0x1727=function(_0xa6f8ea,_0x51cd0e){_0xa6f8ea=_0xa6f8ea-0x0;var _0x4a3097=_0x7271[_0xa6f8ea];return _0x4a3097;};'use strict';var multer=require('multer');var util=require(_0x1727('0x0'));var path=require(_0x1727('0x1'));var timeout=require(_0x1727('0x2'));var express=require('express');var router=express[_0x1727('0x3')]();var fs_extra=require(_0x1727('0x4'));var auth=require(_0x1727('0x5'));var interaction=require(_0x1727('0x6'));var config=require(_0x1727('0x7'));var controller=require(_0x1727('0x8'));router[_0x1727('0x9')]('/',auth['isAuthenticated'](),controller[_0x1727('0xa')]);router[_0x1727('0x9')](_0x1727('0xb'),auth[_0x1727('0xc')](),controller[_0x1727('0xd')]);router[_0x1727('0xe')]('/',auth[_0x1727('0xc')](),controller[_0x1727('0xf')]);router[_0x1727('0x10')]('/:id',auth[_0x1727('0xc')](),controller[_0x1727('0x11')]);router['delete'](_0x1727('0xb'),auth['isAuthenticated'](),controller[_0x1727('0x12')]);module[_0x1727('0x13')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.attributes.js b/server/api/intFreshdeskField/intFreshdeskField.attributes.js index 6d413b7..4d48725 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 _0xbe99=['variable','customVariable','keyValue','STRING','BOOLEAN','sequelize','exports','ENUM','string'];(function(_0x3acee8,_0x5f3924){var _0x5046cc=function(_0x338def){while(--_0x338def){_0x3acee8['push'](_0x3acee8['shift']());}};_0x5046cc(++_0x5f3924);}(_0xbe99,0x83));var _0x9be9=function(_0x220d70,_0xa12514){_0x220d70=_0x220d70-0x0;var _0x5d3c2f=_0xbe99[_0x220d70];return _0x5d3c2f;};'use strict';var Sequelize=require(_0x9be9('0x0'));module[_0x9be9('0x1')]={'type':{'type':Sequelize[_0x9be9('0x2')](_0x9be9('0x3'),_0x9be9('0x4'),_0x9be9('0x5'),_0x9be9('0x6'),'picklist'),'defaultValue':_0x9be9('0x3')},'content':{'type':Sequelize[_0x9be9('0x7')]},'key':{'type':Sequelize[_0x9be9('0x7')]},'keyType':{'type':Sequelize[_0x9be9('0x2')](_0x9be9('0x3'),_0x9be9('0x4'),_0x9be9('0x5'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x9be9('0x7')]},'nameField':{'type':Sequelize[_0x9be9('0x7')]},'customField':{'type':Sequelize[_0x9be9('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xb404=['BOOLEAN','exports','string','variable','customVariable','keyValue','picklist','STRING','ENUM'];(function(_0x3ed71b,_0x4f5514){var _0x15804f=function(_0x474dd8){while(--_0x474dd8){_0x3ed71b['push'](_0x3ed71b['shift']());}};_0x15804f(++_0x4f5514);}(_0xb404,0x1cc));var _0x4b40=function(_0x2b8b8d,_0x51e866){_0x2b8b8d=_0x2b8b8d-0x0;var _0x391af6=_0xb404[_0x2b8b8d];return _0x391af6;};'use strict';var Sequelize=require('sequelize');module[_0x4b40('0x0')]={'type':{'type':Sequelize['ENUM'](_0x4b40('0x1'),_0x4b40('0x2'),_0x4b40('0x3'),_0x4b40('0x4'),_0x4b40('0x5')),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x4b40('0x6')]},'keyType':{'type':Sequelize[_0x4b40('0x7')]('string',_0x4b40('0x2'),'customVariable')},'keyContent':{'type':Sequelize[_0x4b40('0x6')]},'idField':{'type':Sequelize[_0x4b40('0x6')]},'nameField':{'type':Sequelize[_0x4b40('0x6')]},'customField':{'type':Sequelize[_0x4b40('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x4b40('0x6')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index e403b91..9953ce4 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 _0xbc9d=['stack','name','send','index','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','order','sort','where','filter','map','type','merge','options','FreshdeskField','includeAll','include','findAll','rows','show','params','find','catch','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','save','update','destroy','then'];(function(_0x55f4a8,_0x46d283){var _0x560de9=function(_0x942ac8){while(--_0x942ac8){_0x55f4a8['push'](_0x55f4a8['shift']());}};_0x560de9(++_0x46d283);}(_0xbc9d,0xb4));var _0xdbc9=function(_0x51cbc6,_0x56410c){_0x51cbc6=_0x51cbc6-0x0;var _0x2dc19c=_0xbc9d[_0x51cbc6];return _0x2dc19c;};'use strict';var emlformat=require(_0xdbc9('0x0'));var rimraf=require(_0xdbc9('0x1'));var zipdir=require(_0xdbc9('0x2'));var jsonpatch=require(_0xdbc9('0x3'));var rp=require(_0xdbc9('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xdbc9('0x5'));var path=require(_0xdbc9('0x6'));var sox=require(_0xdbc9('0x7'));var csv=require(_0xdbc9('0x8'));var ejs=require(_0xdbc9('0x9'));var fs=require('fs');var fs_extra=require(_0xdbc9('0xa'));var _=require(_0xdbc9('0xb'));var squel=require('squel');var crypto=require(_0xdbc9('0xc'));var jsforce=require(_0xdbc9('0xd'));var deskjs=require(_0xdbc9('0xe'));var toCsv=require('to-csv');var querystring=require(_0xdbc9('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xdbc9('0x10'));var qs=require(_0xdbc9('0x11'));var as=require(_0xdbc9('0x12'));var hardwareService=require(_0xdbc9('0x13'));var logger=require('../../config/logger')(_0xdbc9('0x14'));var utils=require(_0xdbc9('0x15'));var config=require(_0xdbc9('0x16'));var licenseUtil=require(_0xdbc9('0x17'));var db=require(_0xdbc9('0x18'))['db'];function respondWithStatusCode(_0x103d54,_0x48bc83){_0x48bc83=_0x48bc83||0xcc;return function(_0x567e71){if(_0x567e71){return _0x103d54[_0xdbc9('0x19')](_0x48bc83);}return _0x103d54[_0xdbc9('0x1a')](_0x48bc83)[_0xdbc9('0x1b')]();};}function respondWithResult(_0x436e50,_0x53495d){_0x53495d=_0x53495d||0xc8;return function(_0x4a9dcb){if(_0x4a9dcb){return _0x436e50[_0xdbc9('0x1a')](_0x53495d)[_0xdbc9('0x1c')](_0x4a9dcb);}};}function respondWithFilteredResult(_0x3a8a7b,_0x4c7b4f){return function(_0x1b4616){if(_0x1b4616){var _0x1abee8=typeof _0x4c7b4f['offset']===_0xdbc9('0x1d')&&typeof _0x4c7b4f[_0xdbc9('0x1e')]===_0xdbc9('0x1d');var _0x14e655=_0x1b4616[_0xdbc9('0x1f')];var _0x33f1bd=_0x1abee8?0x0:_0x4c7b4f[_0xdbc9('0x20')];var _0xc2ddd2=_0x1abee8?_0x1b4616[_0xdbc9('0x1f')]:_0x4c7b4f[_0xdbc9('0x20')]+_0x4c7b4f['limit'];var _0x1ca5fd;if(_0xc2ddd2>=_0x14e655){_0xc2ddd2=_0x14e655;_0x1ca5fd=0xc8;}else{_0x1ca5fd=0xce;}_0x3a8a7b['status'](_0x1ca5fd);return _0x3a8a7b[_0xdbc9('0x21')](_0xdbc9('0x22'),_0x33f1bd+'-'+_0xc2ddd2+'/'+_0x14e655)['json'](_0x1b4616);}return null;};}function patchUpdates(_0x4408e9){return function(_0x5367dc){try{jsonpatch['apply'](_0x5367dc,_0x4408e9,!![]);}catch(_0x4ab00d){return BPromise['reject'](_0x4ab00d);}return _0x5367dc[_0xdbc9('0x23')]();};}function saveUpdates(_0x2011a2,_0x570ad9){return function(_0x16dcf7){if(_0x16dcf7){return _0x16dcf7[_0xdbc9('0x24')](_0x2011a2)['then'](function(_0x1bc073){return _0x1bc073;});}return null;};}function removeEntity(_0x6b788,_0x1b1c0d){return function(_0x119230){if(_0x119230){return _0x119230[_0xdbc9('0x25')]()[_0xdbc9('0x26')](function(){_0x6b788[_0xdbc9('0x1a')](0xcc)[_0xdbc9('0x1b')]();});}};}function handleEntityNotFound(_0x3c8c1d,_0x4a868b){return function(_0x550bef){if(!_0x550bef){_0x3c8c1d[_0xdbc9('0x19')](0x194);}return _0x550bef;};}function handleError(_0x446ab9,_0x1053ca){_0x1053ca=_0x1053ca||0x1f4;return function(_0x24fdec){logger['error'](_0x24fdec[_0xdbc9('0x27')]);if(_0x24fdec[_0xdbc9('0x28')]){delete _0x24fdec['name'];}_0x446ab9['status'](_0x1053ca)[_0xdbc9('0x29')](_0x24fdec);};}exports[_0xdbc9('0x2a')]=function(_0x473430,_0x59bfd2){var _0x13a432={},_0x539e57={},_0x561f8e={'count':0x0,'rows':[]};var _0x210a40=_['map'](db['FreshdeskField'][_0xdbc9('0x2b')],function(_0x20eb4f){return{'name':_0x20eb4f[_0xdbc9('0x2c')],'type':_0x20eb4f['type'][_0xdbc9('0x2d')]};});_0x539e57[_0xdbc9('0x2e')]=_['map'](_0x210a40,'name');_0x539e57[_0xdbc9('0x2f')]=_[_0xdbc9('0x30')](_0x473430[_0xdbc9('0x2f')]);_0x539e57[_0xdbc9('0x31')]=_[_0xdbc9('0x32')](_0x539e57[_0xdbc9('0x2e')],_0x539e57[_0xdbc9('0x2f')]);_0x13a432['attributes']=_[_0xdbc9('0x32')](_0x539e57[_0xdbc9('0x2e')],qs[_0xdbc9('0x33')](_0x473430[_0xdbc9('0x2f')][_0xdbc9('0x33')]));_0x13a432[_0xdbc9('0x34')]=_0x13a432['attributes'][_0xdbc9('0x35')]?_0x13a432['attributes']:_0x539e57['model'];if(!_0x473430['query']['hasOwnProperty']('nolimit')){_0x13a432[_0xdbc9('0x1e')]=qs[_0xdbc9('0x1e')](_0x473430[_0xdbc9('0x2f')]['limit']);_0x13a432[_0xdbc9('0x20')]=qs[_0xdbc9('0x20')](_0x473430[_0xdbc9('0x2f')][_0xdbc9('0x20')]);}_0x13a432[_0xdbc9('0x36')]=qs[_0xdbc9('0x37')](_0x473430['query'][_0xdbc9('0x37')]);_0x13a432[_0xdbc9('0x38')]=qs[_0xdbc9('0x31')](_['pick'](_0x473430[_0xdbc9('0x2f')],_0x539e57[_0xdbc9('0x31')]),_0x210a40);if(_0x473430[_0xdbc9('0x2f')][_0xdbc9('0x39')]){_0x13a432['where']=_['merge'](_0x13a432[_0xdbc9('0x38')],{'$or':_[_0xdbc9('0x3a')](_0x210a40,function(_0x136392){if(_0x136392[_0xdbc9('0x3b')]!=='VIRTUAL'){var _0x1b651f={};_0x1b651f[_0x136392[_0xdbc9('0x28')]]={'$like':'%'+_0x473430[_0xdbc9('0x2f')]['filter']+'%'};return _0x1b651f;}})});}_0x13a432=_[_0xdbc9('0x3c')]({},_0x13a432,_0x473430[_0xdbc9('0x3d')]);var _0x444219={'where':_0x13a432['where']};return db[_0xdbc9('0x3e')][_0xdbc9('0x1f')](_0x444219)['then'](function(_0x5173c2){_0x561f8e[_0xdbc9('0x1f')]=_0x5173c2;if(_0x473430[_0xdbc9('0x2f')][_0xdbc9('0x3f')]){_0x13a432[_0xdbc9('0x40')]=[{'all':!![]}];}return db['FreshdeskField'][_0xdbc9('0x41')](_0x13a432);})[_0xdbc9('0x26')](function(_0x577725){_0x561f8e[_0xdbc9('0x42')]=_0x577725;return _0x561f8e;})[_0xdbc9('0x26')](respondWithFilteredResult(_0x59bfd2,_0x13a432))['catch'](handleError(_0x59bfd2,null));};exports[_0xdbc9('0x43')]=function(_0x72dee3,_0x2adb23){var _0x3415c3={'raw':!![],'where':{'id':_0x72dee3[_0xdbc9('0x44')]['id']}},_0x3ed4de={};_0x3ed4de[_0xdbc9('0x2e')]=_['keys'](db['FreshdeskField'][_0xdbc9('0x2b')]);_0x3ed4de[_0xdbc9('0x2f')]=_[_0xdbc9('0x30')](_0x72dee3[_0xdbc9('0x2f')]);_0x3ed4de[_0xdbc9('0x31')]=_[_0xdbc9('0x32')](_0x3ed4de[_0xdbc9('0x2e')],_0x3ed4de[_0xdbc9('0x2f')]);_0x3415c3[_0xdbc9('0x34')]=_[_0xdbc9('0x32')](_0x3ed4de[_0xdbc9('0x2e')],qs['fields'](_0x72dee3['query'][_0xdbc9('0x33')]));_0x3415c3[_0xdbc9('0x34')]=_0x3415c3[_0xdbc9('0x34')][_0xdbc9('0x35')]?_0x3415c3[_0xdbc9('0x34')]:_0x3ed4de[_0xdbc9('0x2e')];if(_0x72dee3[_0xdbc9('0x2f')][_0xdbc9('0x3f')]){_0x3415c3['include']=[{'all':!![]}];}_0x3415c3=_['merge']({},_0x3415c3,_0x72dee3[_0xdbc9('0x3d')]);return db[_0xdbc9('0x3e')][_0xdbc9('0x45')](_0x3415c3)[_0xdbc9('0x26')](handleEntityNotFound(_0x2adb23,null))[_0xdbc9('0x26')](respondWithResult(_0x2adb23,null))[_0xdbc9('0x46')](handleError(_0x2adb23,null));};exports[_0xdbc9('0x47')]=function(_0x2ea096,_0x43e3ec){return db['FreshdeskField'][_0xdbc9('0x47')](_0x2ea096[_0xdbc9('0x48')],{})['then'](respondWithResult(_0x43e3ec,0xc9))['catch'](handleError(_0x43e3ec,null));};exports[_0xdbc9('0x24')]=function(_0xc3db3c,_0x133a13){if(_0xc3db3c['body']['id']){delete _0xc3db3c[_0xdbc9('0x48')]['id'];}return db[_0xdbc9('0x3e')][_0xdbc9('0x45')]({'where':{'id':_0xc3db3c[_0xdbc9('0x44')]['id']}})['then'](handleEntityNotFound(_0x133a13,null))[_0xdbc9('0x26')](saveUpdates(_0xc3db3c[_0xdbc9('0x48')],null))[_0xdbc9('0x26')](respondWithResult(_0x133a13,null))[_0xdbc9('0x46')](handleError(_0x133a13,null));};exports['destroy']=function(_0x3e89f5,_0x36c70e){return db[_0xdbc9('0x3e')][_0xdbc9('0x45')]({'where':{'id':_0x3e89f5[_0xdbc9('0x44')]['id']}})[_0xdbc9('0x26')](handleEntityNotFound(_0x36c70e,null))[_0xdbc9('0x26')](removeEntity(_0x36c70e,null))[_0xdbc9('0x46')](handleError(_0x36c70e,null));}; \ No newline at end of file +var _0xb9a7=['merge','VIRTUAL','name','options','includeAll','include','rows','catch','show','params','rawAttributes','intersection','create','body','rimraf','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','limit','count','set','Content-Range','save','update','then','destroy','stack','map','FreshdeskField','fieldName','type','key','model','keys','query','filters','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xb9a7,0x112));var _0x7b9a=function(_0x1928c9,_0x13a6d1){_0x1928c9=_0x1928c9-0x0;var _0x51b5fb=_0xb9a7[_0x1928c9];return _0x51b5fb;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7b9a('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x7b9a('0x1'));var BPromise=require('bluebird');var Mustache=require(_0x7b9a('0x2'));var util=require(_0x7b9a('0x3'));var path=require(_0x7b9a('0x4'));var sox=require(_0x7b9a('0x5'));var csv=require(_0x7b9a('0x6'));var ejs=require(_0x7b9a('0x7'));var fs=require('fs');var fs_extra=require(_0x7b9a('0x8'));var _=require(_0x7b9a('0x9'));var squel=require(_0x7b9a('0xa'));var crypto=require(_0x7b9a('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x7b9a('0xc'));var toCsv=require(_0x7b9a('0x6'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x7b9a('0xd'));var qs=require(_0x7b9a('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7b9a('0xf'));var logger=require('../../config/logger')(_0x7b9a('0x10'));var utils=require('../../config/utils');var config=require(_0x7b9a('0x11'));var licenseUtil=require(_0x7b9a('0x12'));var db=require(_0x7b9a('0x13'))['db'];function respondWithStatusCode(_0x5948ca,_0x32f616){_0x32f616=_0x32f616||0xcc;return function(_0xec5949){if(_0xec5949){return _0x5948ca['sendStatus'](_0x32f616);}return _0x5948ca[_0x7b9a('0x14')](_0x32f616)[_0x7b9a('0x15')]();};}function respondWithResult(_0x4b7ec0,_0xb157e5){_0xb157e5=_0xb157e5||0xc8;return function(_0xde180d){if(_0xde180d){return _0x4b7ec0[_0x7b9a('0x14')](_0xb157e5)[_0x7b9a('0x16')](_0xde180d);}};}function respondWithFilteredResult(_0x344fa7,_0x346daa){return function(_0x22a7e4){if(_0x22a7e4){var _0x35e602=typeof _0x346daa[_0x7b9a('0x17')]==='undefined'&&typeof _0x346daa[_0x7b9a('0x18')]==='undefined';var _0x123921=_0x22a7e4[_0x7b9a('0x19')];var _0x271263=_0x35e602?0x0:_0x346daa[_0x7b9a('0x17')];var _0x44a232=_0x35e602?_0x22a7e4[_0x7b9a('0x19')]:_0x346daa[_0x7b9a('0x17')]+_0x346daa[_0x7b9a('0x18')];var _0x2064a0;if(_0x44a232>=_0x123921){_0x44a232=_0x123921;_0x2064a0=0xc8;}else{_0x2064a0=0xce;}_0x344fa7[_0x7b9a('0x14')](_0x2064a0);return _0x344fa7[_0x7b9a('0x1a')](_0x7b9a('0x1b'),_0x271263+'-'+_0x44a232+'/'+_0x123921)[_0x7b9a('0x16')](_0x22a7e4);}return null;};}function patchUpdates(_0x58aed7){return function(_0x993048){try{jsonpatch['apply'](_0x993048,_0x58aed7,!![]);}catch(_0x1eacbc){return BPromise['reject'](_0x1eacbc);}return _0x993048[_0x7b9a('0x1c')]();};}function saveUpdates(_0x331ae6,_0x23d812){return function(_0x54fda7){if(_0x54fda7){return _0x54fda7[_0x7b9a('0x1d')](_0x331ae6)[_0x7b9a('0x1e')](function(_0x5705b2){return _0x5705b2;});}return null;};}function removeEntity(_0x35aca7,_0x374dca){return function(_0x269c07){if(_0x269c07){return _0x269c07[_0x7b9a('0x1f')]()[_0x7b9a('0x1e')](function(){_0x35aca7['status'](0xcc)[_0x7b9a('0x15')]();});}};}function handleEntityNotFound(_0x23219e,_0x5809f5){return function(_0x39b7ec){if(!_0x39b7ec){_0x23219e['sendStatus'](0x194);}return _0x39b7ec;};}function handleError(_0x31eb67,_0x3091ab){_0x3091ab=_0x3091ab||0x1f4;return function(_0x4c2271){logger['error'](_0x4c2271[_0x7b9a('0x20')]);if(_0x4c2271['name']){delete _0x4c2271['name'];}_0x31eb67[_0x7b9a('0x14')](_0x3091ab)['send'](_0x4c2271);};}exports['index']=function(_0x3847b4,_0x4d5880){var _0x5c89b6={},_0x314b6d={},_0x4fee38={'count':0x0,'rows':[]};var _0x1553ae=_[_0x7b9a('0x21')](db[_0x7b9a('0x22')]['rawAttributes'],function(_0x45ccf5){return{'name':_0x45ccf5[_0x7b9a('0x23')],'type':_0x45ccf5[_0x7b9a('0x24')][_0x7b9a('0x25')]};});_0x314b6d[_0x7b9a('0x26')]=_[_0x7b9a('0x21')](_0x1553ae,'name');_0x314b6d['query']=_[_0x7b9a('0x27')](_0x3847b4[_0x7b9a('0x28')]);_0x314b6d[_0x7b9a('0x29')]=_['intersection'](_0x314b6d[_0x7b9a('0x26')],_0x314b6d[_0x7b9a('0x28')]);_0x5c89b6['attributes']=_['intersection'](_0x314b6d[_0x7b9a('0x26')],qs[_0x7b9a('0x2a')](_0x3847b4['query'][_0x7b9a('0x2a')]));_0x5c89b6[_0x7b9a('0x2b')]=_0x5c89b6[_0x7b9a('0x2b')][_0x7b9a('0x2c')]?_0x5c89b6[_0x7b9a('0x2b')]:_0x314b6d['model'];if(!_0x3847b4[_0x7b9a('0x28')][_0x7b9a('0x2d')](_0x7b9a('0x2e'))){_0x5c89b6[_0x7b9a('0x18')]=qs[_0x7b9a('0x18')](_0x3847b4[_0x7b9a('0x28')]['limit']);_0x5c89b6['offset']=qs[_0x7b9a('0x17')](_0x3847b4[_0x7b9a('0x28')]['offset']);}_0x5c89b6[_0x7b9a('0x2f')]=qs[_0x7b9a('0x30')](_0x3847b4[_0x7b9a('0x28')]['sort']);_0x5c89b6[_0x7b9a('0x31')]=qs[_0x7b9a('0x29')](_['pick'](_0x3847b4['query'],_0x314b6d[_0x7b9a('0x29')]),_0x1553ae);if(_0x3847b4[_0x7b9a('0x28')][_0x7b9a('0x32')]){_0x5c89b6[_0x7b9a('0x31')]=_[_0x7b9a('0x33')](_0x5c89b6[_0x7b9a('0x31')],{'$or':_[_0x7b9a('0x21')](_0x1553ae,function(_0x380f4b){if(_0x380f4b['type']!==_0x7b9a('0x34')){var _0x5ac175={};_0x5ac175[_0x380f4b[_0x7b9a('0x35')]]={'$like':'%'+_0x3847b4[_0x7b9a('0x28')][_0x7b9a('0x32')]+'%'};return _0x5ac175;}})});}_0x5c89b6=_[_0x7b9a('0x33')]({},_0x5c89b6,_0x3847b4[_0x7b9a('0x36')]);var _0x89951b={'where':_0x5c89b6['where']};return db[_0x7b9a('0x22')][_0x7b9a('0x19')](_0x89951b)[_0x7b9a('0x1e')](function(_0x1bc1f0){_0x4fee38['count']=_0x1bc1f0;if(_0x3847b4[_0x7b9a('0x28')][_0x7b9a('0x37')]){_0x5c89b6[_0x7b9a('0x38')]=[{'all':!![]}];}return db[_0x7b9a('0x22')]['findAll'](_0x5c89b6);})[_0x7b9a('0x1e')](function(_0x53d89a){_0x4fee38[_0x7b9a('0x39')]=_0x53d89a;return _0x4fee38;})[_0x7b9a('0x1e')](respondWithFilteredResult(_0x4d5880,_0x5c89b6))[_0x7b9a('0x3a')](handleError(_0x4d5880,null));};exports[_0x7b9a('0x3b')]=function(_0x43fad0,_0x41f541){var _0x56e274={'raw':!![],'where':{'id':_0x43fad0[_0x7b9a('0x3c')]['id']}},_0x33edc6={};_0x33edc6[_0x7b9a('0x26')]=_['keys'](db['FreshdeskField'][_0x7b9a('0x3d')]);_0x33edc6[_0x7b9a('0x28')]=_[_0x7b9a('0x27')](_0x43fad0[_0x7b9a('0x28')]);_0x33edc6[_0x7b9a('0x29')]=_[_0x7b9a('0x3e')](_0x33edc6['model'],_0x33edc6['query']);_0x56e274['attributes']=_[_0x7b9a('0x3e')](_0x33edc6[_0x7b9a('0x26')],qs['fields'](_0x43fad0[_0x7b9a('0x28')][_0x7b9a('0x2a')]));_0x56e274[_0x7b9a('0x2b')]=_0x56e274['attributes'][_0x7b9a('0x2c')]?_0x56e274['attributes']:_0x33edc6[_0x7b9a('0x26')];if(_0x43fad0[_0x7b9a('0x28')][_0x7b9a('0x37')]){_0x56e274[_0x7b9a('0x38')]=[{'all':!![]}];}_0x56e274=_[_0x7b9a('0x33')]({},_0x56e274,_0x43fad0['options']);return db[_0x7b9a('0x22')]['find'](_0x56e274)[_0x7b9a('0x1e')](handleEntityNotFound(_0x41f541,null))['then'](respondWithResult(_0x41f541,null))['catch'](handleError(_0x41f541,null));};exports[_0x7b9a('0x3f')]=function(_0x3727ef,_0x717d08){return db[_0x7b9a('0x22')][_0x7b9a('0x3f')](_0x3727ef[_0x7b9a('0x40')],{})[_0x7b9a('0x1e')](respondWithResult(_0x717d08,0xc9))[_0x7b9a('0x3a')](handleError(_0x717d08,null));};exports[_0x7b9a('0x1d')]=function(_0x5088c7,_0x1d7957){if(_0x5088c7[_0x7b9a('0x40')]['id']){delete _0x5088c7['body']['id'];}return db['FreshdeskField']['find']({'where':{'id':_0x5088c7[_0x7b9a('0x3c')]['id']}})[_0x7b9a('0x1e')](handleEntityNotFound(_0x1d7957,null))[_0x7b9a('0x1e')](saveUpdates(_0x5088c7[_0x7b9a('0x40')],null))['then'](respondWithResult(_0x1d7957,null))[_0x7b9a('0x3a')](handleError(_0x1d7957,null));};exports[_0x7b9a('0x1f')]=function(_0x287dea,_0x33b200){return db[_0x7b9a('0x22')]['find']({'where':{'id':_0x287dea[_0x7b9a('0x3c')]['id']}})['then'](handleEntityNotFound(_0x33b200,null))[_0x7b9a('0x1e')](removeEntity(_0x33b200,null))[_0x7b9a('0x3a')](handleError(_0x33b200,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index 3bc10c7..0f8482f 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 _0x7f2b=['api','moment','bluebird','path','../../config/environment','./intFreshdeskField.attributes','exports','define','FreshdeskField','int_freshdesk_fields','freshdesk_unique_index','idField','FieldId','lodash','util','../../config/logger'];(function(_0x5c6299,_0x11bd28){var _0x23b564=function(_0x329ed6){while(--_0x329ed6){_0x5c6299['push'](_0x5c6299['shift']());}};_0x23b564(++_0x11bd28);}(_0x7f2b,0x11d));var _0xb7f2=function(_0x4c99b6,_0x3a2cc1){_0x4c99b6=_0x4c99b6-0x0;var _0x58eeb1=_0x7f2b[_0x4c99b6];return _0x58eeb1;};'use strict';var _=require(_0xb7f2('0x0'));var util=require(_0xb7f2('0x1'));var logger=require(_0xb7f2('0x2'))(_0xb7f2('0x3'));var moment=require(_0xb7f2('0x4'));var BPromise=require(_0xb7f2('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb7f2('0x6'));var rimraf=require('rimraf');var config=require(_0xb7f2('0x7'));var attributes=require(_0xb7f2('0x8'));module[_0xb7f2('0x9')]=function(_0x550f7c,_0x1e7c59){return _0x550f7c[_0xb7f2('0xa')](_0xb7f2('0xb'),attributes,{'tableName':_0xb7f2('0xc'),'paranoid':![],'indexes':[{'name':_0xb7f2('0xd'),'fields':[_0xb7f2('0xe'),_0xb7f2('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc715=['./intFreshdeskField.attributes','exports','define','FreshdeskField','int_freshdesk_fields','freshdesk_unique_index','idField','FieldId','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x1f2aaf,_0x108c2a){var _0x147986=function(_0x39986e){while(--_0x39986e){_0x1f2aaf['push'](_0x1f2aaf['shift']());}};_0x147986(++_0x108c2a);}(_0xc715,0x18f));var _0x5c71=function(_0x3f816c,_0x51ed7c){_0x3f816c=_0x3f816c-0x0;var _0x55f2dd=_0xc715[_0x3f816c];return _0x55f2dd;};'use strict';var _=require('lodash');var util=require(_0x5c71('0x0'));var logger=require(_0x5c71('0x1'))(_0x5c71('0x2'));var moment=require(_0x5c71('0x3'));var BPromise=require(_0x5c71('0x4'));var rp=require(_0x5c71('0x5'));var fs=require('fs');var path=require(_0x5c71('0x6'));var rimraf=require(_0x5c71('0x7'));var config=require(_0x5c71('0x8'));var attributes=require(_0x5c71('0x9'));module[_0x5c71('0xa')]=function(_0x4fbd70,_0xef132b){return _0x4fbd70[_0x5c71('0xb')](_0x5c71('0xc'),attributes,{'tableName':_0x5c71('0xd'),'paranoid':![],'indexes':[{'name':_0x5c71('0xe'),'fields':[_0x5c71('0xf'),_0x5c71('0x10')],'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 0f4115e..50dc3c1 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 _0x42e3=['util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','info','FreshdeskField,\x20%s,\x20%s','request\x20sent','debug','FreshdeskField,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash'];(function(_0x39ec2a,_0x4302e8){var _0x111682=function(_0xb2979f){while(--_0xb2979f){_0x39ec2a['push'](_0x39ec2a['shift']());}};_0x111682(++_0x4302e8);}(_0x42e3,0x175));var _0x342e=function(_0x5d9bde,_0x1e72c6){_0x5d9bde=_0x5d9bde-0x0;var _0x5b9be5=_0x42e3[_0x5d9bde];return _0x5b9be5;};'use strict';var _=require(_0x342e('0x0'));var util=require(_0x342e('0x1'));var moment=require(_0x342e('0x2'));var BPromise=require(_0x342e('0x3'));var rs=require(_0x342e('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x342e('0x5'))['db'];var utils=require(_0x342e('0x6'));var logger=require('../../config/logger')(_0x342e('0x7'));var config=require(_0x342e('0x8'));var jayson=require(_0x342e('0x9'));var client=jayson[_0x342e('0xa')][_0x342e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x19b750,_0x4803a4,_0x2bf5e9){return new BPromise(function(_0x16e19e,_0x38e432){return client[_0x342e('0xc')](_0x19b750,_0x2bf5e9)['then'](function(_0x4be78d){logger[_0x342e('0xd')](_0x342e('0xe'),_0x4803a4,_0x342e('0xf'));logger[_0x342e('0x10')](_0x342e('0x11'),_0x4803a4,_0x342e('0xf'),JSON['stringify'](_0x4be78d));if(_0x4be78d[_0x342e('0x12')]){if(_0x4be78d[_0x342e('0x12')][_0x342e('0x13')]===0x1f4){logger['error'](_0x342e('0xe'),_0x4803a4,_0x4be78d['error'][_0x342e('0x14')]);return _0x38e432(_0x4be78d[_0x342e('0x12')][_0x342e('0x14')]);}logger[_0x342e('0x12')]('FreshdeskField,\x20%s,\x20%s',_0x4803a4,_0x4be78d[_0x342e('0x12')]['message']);return _0x16e19e(_0x4be78d[_0x342e('0x12')]['message']);}else{logger[_0x342e('0xd')](_0x342e('0xe'),_0x4803a4,'request\x20sent');_0x16e19e(_0x4be78d[_0x342e('0x15')][_0x342e('0x14')]);}})['catch'](function(_0x128349){logger[_0x342e('0x12')]('FreshdeskField,\x20%s,\x20%s',_0x4803a4,_0x128349);_0x38e432(_0x128349);});});} \ No newline at end of file +var _0xa296=['randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','FreshdeskField,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','util','moment','bluebird'];(function(_0x45a85e,_0x292dd7){var _0x4c85b7=function(_0x10059f){while(--_0x10059f){_0x45a85e['push'](_0x45a85e['shift']());}};_0x4c85b7(++_0x292dd7);}(_0xa296,0x1cb));var _0x6a29=function(_0x3c62ab,_0x33f23d){_0x3c62ab=_0x3c62ab-0x0;var _0x536970=_0xa296[_0x3c62ab];return _0x536970;};'use strict';var _=require('lodash');var util=require(_0x6a29('0x0'));var moment=require(_0x6a29('0x1'));var BPromise=require(_0x6a29('0x2'));var rs=require(_0x6a29('0x3'));var fs=require('fs');var Redis=require(_0x6a29('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x6a29('0x5'));var logger=require(_0x6a29('0x6'))(_0x6a29('0x7'));var config=require(_0x6a29('0x8'));var jayson=require(_0x6a29('0x9'));var client=jayson['client'][_0x6a29('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x409dbb,_0x57957e,_0x1bb9fb){return new BPromise(function(_0x277f90,_0x37c3cd){return client['request'](_0x409dbb,_0x1bb9fb)[_0x6a29('0xb')](function(_0x4ed7f5){logger[_0x6a29('0xc')](_0x6a29('0xd'),_0x57957e,_0x6a29('0xe'));logger[_0x6a29('0xf')]('FreshdeskField,\x20%s,\x20%s,\x20%s',_0x57957e,'request\x20sent',JSON['stringify'](_0x4ed7f5));if(_0x4ed7f5[_0x6a29('0x10')]){if(_0x4ed7f5['error'][_0x6a29('0x11')]===0x1f4){logger[_0x6a29('0x10')](_0x6a29('0xd'),_0x57957e,_0x4ed7f5[_0x6a29('0x10')][_0x6a29('0x12')]);return _0x37c3cd(_0x4ed7f5['error'][_0x6a29('0x12')]);}logger[_0x6a29('0x10')]('FreshdeskField,\x20%s,\x20%s',_0x57957e,_0x4ed7f5[_0x6a29('0x10')][_0x6a29('0x12')]);return _0x277f90(_0x4ed7f5[_0x6a29('0x10')][_0x6a29('0x12')]);}else{logger[_0x6a29('0xc')](_0x6a29('0xd'),_0x57957e,_0x6a29('0xe'));_0x277f90(_0x4ed7f5[_0x6a29('0x13')][_0x6a29('0x12')]);}})[_0x6a29('0x14')](function(_0x376ea7){logger[_0x6a29('0x10')]('FreshdeskField,\x20%s,\x20%s',_0x57957e,_0x376ea7);_0x37c3cd(_0x376ea7);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/index.js b/server/api/intFreshsalesAccount/index.js index 1683221..74992e4 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 _0x3c81=['connect-timeout','express','../../config/environment','./intFreshsalesAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','update','delete','multer','util'];(function(_0x137a64,_0x1bcfae){var _0x11c24c=function(_0x1004b9){while(--_0x1004b9){_0x137a64['push'](_0x137a64['shift']());}};_0x11c24c(++_0x1bcfae);}(_0x3c81,0x102));var _0x13c8=function(_0x2fd376,_0x1afebd){_0x2fd376=_0x2fd376-0x0;var _0x1d27a7=_0x3c81[_0x2fd376];return _0x1d27a7;};'use strict';var multer=require(_0x13c8('0x0'));var util=require(_0x13c8('0x1'));var path=require('path');var timeout=require(_0x13c8('0x2'));var express=require(_0x13c8('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x13c8('0x4'));var controller=require(_0x13c8('0x5'));router[_0x13c8('0x6')]('/',auth[_0x13c8('0x7')](),controller[_0x13c8('0x8')]);router[_0x13c8('0x6')](_0x13c8('0x9'),auth['isAuthenticated'](),controller[_0x13c8('0xa')]);router['get'](_0x13c8('0xb'),auth[_0x13c8('0x7')](),controller[_0x13c8('0xc')]);router[_0x13c8('0x6')](_0x13c8('0xd'),auth[_0x13c8('0x7')](),controller[_0x13c8('0xe')]);router[_0x13c8('0xf')]('/',auth[_0x13c8('0x7')](),controller[_0x13c8('0x10')]);router[_0x13c8('0xf')](_0x13c8('0xb'),auth[_0x13c8('0x7')](),controller[_0x13c8('0x11')]);router['put'](_0x13c8('0x9'),auth[_0x13c8('0x7')](),controller[_0x13c8('0x12')]);router[_0x13c8('0x13')]('/:id',auth[_0x13c8('0x7')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xde2c=['getFields','post','/:id/configurations','addConfiguration','put','update','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intFreshsalesAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields'];(function(_0x18d91e,_0xcb6fa1){var _0x4229de=function(_0x27401c){while(--_0x27401c){_0x18d91e['push'](_0x18d91e['shift']());}};_0x4229de(++_0xcb6fa1);}(_0xde2c,0x7f));var _0xcde2=function(_0x1e6db3,_0x5643ac){_0x1e6db3=_0x1e6db3-0x0;var _0x1de886=_0xde2c[_0x1e6db3];return _0x1de886;};'use strict';var multer=require(_0xcde2('0x0'));var util=require(_0xcde2('0x1'));var path=require(_0xcde2('0x2'));var timeout=require(_0xcde2('0x3'));var express=require(_0xcde2('0x4'));var router=express[_0xcde2('0x5')]();var fs_extra=require(_0xcde2('0x6'));var auth=require(_0xcde2('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xcde2('0x8'));var controller=require(_0xcde2('0x9'));router[_0xcde2('0xa')]('/',auth[_0xcde2('0xb')](),controller[_0xcde2('0xc')]);router['get'](_0xcde2('0xd'),auth[_0xcde2('0xb')](),controller[_0xcde2('0xe')]);router['get']('/:id/configurations',auth[_0xcde2('0xb')](),controller[_0xcde2('0xf')]);router['get'](_0xcde2('0x10'),auth[_0xcde2('0xb')](),controller[_0xcde2('0x11')]);router[_0xcde2('0x12')]('/',auth['isAuthenticated'](),controller['create']);router[_0xcde2('0x12')](_0xcde2('0x13'),auth[_0xcde2('0xb')](),controller[_0xcde2('0x14')]);router[_0xcde2('0x15')](_0xcde2('0xd'),auth['isAuthenticated'](),controller[_0xcde2('0x16')]);router['delete'](_0xcde2('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0xcde2('0x17')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js index c5a570d..8c5464f 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 _0xa456=['STRING','username','sequelize','exports'];(function(_0x5e6874,_0x9d1c9e){var _0x290295=function(_0x123a79){while(--_0x123a79){_0x5e6874['push'](_0x5e6874['shift']());}};_0x290295(++_0x9d1c9e);}(_0xa456,0x142));var _0x6a45=function(_0x243b59,_0x3f9495){_0x243b59=_0x243b59-0x0;var _0x3e1676=_0xa456[_0x243b59];return _0x3e1676;};'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 _0x9582=['exports','STRING','username','remoteUri','sequelize'];(function(_0x30efad,_0x245cc4){var _0x3505a4=function(_0x107ce1){while(--_0x107ce1){_0x30efad['push'](_0x30efad['shift']());}};_0x3505a4(++_0x245cc4);}(_0x9582,0x95));var _0x2958=function(_0xf24dd8,_0x468ca3){_0xf24dd8=_0xf24dd8-0x0;var _0x423215=_0x9582[_0xf24dd8];return _0x423215;};'use strict';var Sequelize=require(_0x2958('0x0'));module[_0x2958('0x1')]={'name':{'type':Sequelize[_0x2958('0x2')]},'description':{'type':Sequelize[_0x2958('0x2')]},'username':{'type':Sequelize[_0x2958('0x2')],'unique':_0x2958('0x3')},'apiKey':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x2958('0x2')],'unique':_0x2958('0x4')},'serverUrl':{'type':Sequelize[_0x2958('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 bd75867..3f99f29 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 _0x202e=['getFields,\x20%s,\x20%s,\x20%s','stringify','send','Wrong\x20credentials','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','end','json','undefined','limit','count','offset','status','set','Content-Range','reject','update','then','destroy','sendStatus','error','stack','name','index','map','FreshsalesAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','pick','filter','where','merge','options','include','findAll','params','includeAll','find','catch','create','body','getConfigurations','findOne','FreshsalesConfiguration','addConfiguration','AccountId','Subjects','getSubjects','channel','getDescriptions','FreshsalesField','Descriptions','username','remoteUri','apiKey','slice','substring','lastIndexOf','GET','format','Token\x20token=','email','test','statusCode'];(function(_0x35c964,_0x544301){var _0x460f4b=function(_0x49e241){while(--_0x49e241){_0x35c964['push'](_0x35c964['shift']());}};_0x460f4b(++_0x544301);}(_0x202e,0x68));var _0xe202=function(_0x22d995,_0x4981ab){_0x22d995=_0x22d995-0x0;var _0x1e7df8=_0x202e[_0x22d995];return _0x1e7df8;};'use strict';var emlformat=require(_0xe202('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe202('0x1'));var jsonpatch=require(_0xe202('0x2'));var rp=require(_0xe202('0x3'));var moment=require(_0xe202('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xe202('0x5'));var util=require('util');var path=require('path');var sox=require(_0xe202('0x6'));var csv=require(_0xe202('0x7'));var ejs=require(_0xe202('0x8'));var fs=require('fs');var fs_extra=require(_0xe202('0x9'));var _=require(_0xe202('0xa'));var squel=require(_0xe202('0xb'));var crypto=require('crypto');var jsforce=require(_0xe202('0xc'));var deskjs=require(_0xe202('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xe202('0xe'));var Redis=require(_0xe202('0xf'));var authService=require(_0xe202('0x10'));var qs=require(_0xe202('0x11'));var as=require(_0xe202('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe202('0x13'))(_0xe202('0x14'));var utils=require(_0xe202('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xe202('0x16'));var db=require(_0xe202('0x17'))['db'];var integrations=require(_0xe202('0x18'));function respondWithStatusCode(_0x5248af,_0x1b830c){_0x1b830c=_0x1b830c||0xcc;return function(_0x35e87d){if(_0x35e87d){return _0x5248af['sendStatus'](_0x1b830c);}return _0x5248af['status'](_0x1b830c)[_0xe202('0x19')]();};}function respondWithResult(_0x3e8423,_0x194912){_0x194912=_0x194912||0xc8;return function(_0x5ca73b){if(_0x5ca73b){return _0x3e8423['status'](_0x194912)[_0xe202('0x1a')](_0x5ca73b);}};}function respondWithFilteredResult(_0x4ec6db,_0x3d6a03){return function(_0x54f8c2){if(_0x54f8c2){var _0x1a9843=typeof _0x3d6a03['offset']===_0xe202('0x1b')&&typeof _0x3d6a03[_0xe202('0x1c')]===_0xe202('0x1b');var _0x49fb84=_0x54f8c2[_0xe202('0x1d')];var _0x4c0fc5=_0x1a9843?0x0:_0x3d6a03[_0xe202('0x1e')];var _0x499e29=_0x1a9843?_0x54f8c2[_0xe202('0x1d')]:_0x3d6a03[_0xe202('0x1e')]+_0x3d6a03[_0xe202('0x1c')];var _0x5e5825;if(_0x499e29>=_0x49fb84){_0x499e29=_0x49fb84;_0x5e5825=0xc8;}else{_0x5e5825=0xce;}_0x4ec6db[_0xe202('0x1f')](_0x5e5825);return _0x4ec6db[_0xe202('0x20')](_0xe202('0x21'),_0x4c0fc5+'-'+_0x499e29+'/'+_0x49fb84)[_0xe202('0x1a')](_0x54f8c2);}return null;};}function patchUpdates(_0x587715){return function(_0xbc5d4d){try{jsonpatch['apply'](_0xbc5d4d,_0x587715,!![]);}catch(_0x3cb555){return BPromise[_0xe202('0x22')](_0x3cb555);}return _0xbc5d4d['save']();};}function saveUpdates(_0x24a6f9,_0x4dd51b){return function(_0x53c9ed){if(_0x53c9ed){return _0x53c9ed[_0xe202('0x23')](_0x24a6f9)[_0xe202('0x24')](function(_0x3a1bb9){return _0x3a1bb9;});}return null;};}function removeEntity(_0xb21794,_0x197e36){return function(_0x50fa92){if(_0x50fa92){return _0x50fa92[_0xe202('0x25')]()[_0xe202('0x24')](function(){_0xb21794[_0xe202('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x221428,_0x282e6b){return function(_0x3d28a2){if(!_0x3d28a2){_0x221428[_0xe202('0x26')](0x194);}return _0x3d28a2;};}function handleError(_0x437dd6,_0x49541a){_0x49541a=_0x49541a||0x1f4;return function(_0x459519){logger[_0xe202('0x27')](_0x459519[_0xe202('0x28')]);if(_0x459519[_0xe202('0x29')]){delete _0x459519[_0xe202('0x29')];}_0x437dd6[_0xe202('0x1f')](_0x49541a)['send'](_0x459519);};}exports[_0xe202('0x2a')]=function(_0x1cb04c,_0x43cb6f){var _0x14035b={},_0x10339b={},_0x3d1cbf={'count':0x0,'rows':[]};var _0x19a473=_[_0xe202('0x2b')](db[_0xe202('0x2c')][_0xe202('0x2d')],function(_0x259437){return{'name':_0x259437[_0xe202('0x2e')],'type':_0x259437[_0xe202('0x2f')][_0xe202('0x30')]};});_0x10339b[_0xe202('0x31')]=_['map'](_0x19a473,_0xe202('0x29'));_0x10339b[_0xe202('0x32')]=_[_0xe202('0x33')](_0x1cb04c[_0xe202('0x32')]);_0x10339b[_0xe202('0x34')]=_[_0xe202('0x35')](_0x10339b[_0xe202('0x31')],_0x10339b['query']);_0x14035b['attributes']=_[_0xe202('0x35')](_0x10339b[_0xe202('0x31')],qs[_0xe202('0x36')](_0x1cb04c[_0xe202('0x32')][_0xe202('0x36')]));_0x14035b['attributes']=_0x14035b[_0xe202('0x37')][_0xe202('0x38')]?_0x14035b['attributes']:_0x10339b[_0xe202('0x31')];if(!_0x1cb04c[_0xe202('0x32')]['hasOwnProperty'](_0xe202('0x39'))){_0x14035b['limit']=qs[_0xe202('0x1c')](_0x1cb04c[_0xe202('0x32')][_0xe202('0x1c')]);_0x14035b[_0xe202('0x1e')]=qs[_0xe202('0x1e')](_0x1cb04c[_0xe202('0x32')][_0xe202('0x1e')]);}_0x14035b[_0xe202('0x3a')]=qs[_0xe202('0x3b')](_0x1cb04c[_0xe202('0x32')]['sort']);_0x14035b['where']=qs['filters'](_[_0xe202('0x3c')](_0x1cb04c[_0xe202('0x32')],_0x10339b['filters']),_0x19a473);if(_0x1cb04c[_0xe202('0x32')][_0xe202('0x3d')]){_0x14035b[_0xe202('0x3e')]=_[_0xe202('0x3f')](_0x14035b[_0xe202('0x3e')],{'$or':_['map'](_0x19a473,function(_0x3af043){if(_0x3af043[_0xe202('0x2f')]!=='VIRTUAL'){var _0x4db1e5={};_0x4db1e5[_0x3af043[_0xe202('0x29')]]={'$like':'%'+_0x1cb04c[_0xe202('0x32')][_0xe202('0x3d')]+'%'};return _0x4db1e5;}})});}_0x14035b=_[_0xe202('0x3f')]({},_0x14035b,_0x1cb04c[_0xe202('0x40')]);var _0x9d2bae={'where':_0x14035b[_0xe202('0x3e')]};return db['FreshsalesAccount']['count'](_0x9d2bae)[_0xe202('0x24')](function(_0x410810){_0x3d1cbf[_0xe202('0x1d')]=_0x410810;if(_0x1cb04c[_0xe202('0x32')]['includeAll']){_0x14035b[_0xe202('0x41')]=[{'all':!![]}];}return db[_0xe202('0x2c')][_0xe202('0x42')](_0x14035b);})[_0xe202('0x24')](function(_0x44e526){_0x3d1cbf['rows']=_0x44e526;return _0x3d1cbf;})[_0xe202('0x24')](respondWithFilteredResult(_0x43cb6f,_0x14035b))['catch'](handleError(_0x43cb6f,null));};exports['show']=function(_0x6a9326,_0x480ada){var _0x1990a0={'raw':![],'where':{'id':_0x6a9326[_0xe202('0x43')]['id']}},_0x9863e1={};_0x9863e1[_0xe202('0x31')]=_['keys'](db[_0xe202('0x2c')][_0xe202('0x2d')]);_0x9863e1[_0xe202('0x32')]=_[_0xe202('0x33')](_0x6a9326['query']);_0x9863e1['filters']=_['intersection'](_0x9863e1[_0xe202('0x31')],_0x9863e1['query']);_0x1990a0[_0xe202('0x37')]=_[_0xe202('0x35')](_0x9863e1['model'],qs[_0xe202('0x36')](_0x6a9326[_0xe202('0x32')][_0xe202('0x36')]));_0x1990a0[_0xe202('0x37')]=_0x1990a0[_0xe202('0x37')][_0xe202('0x38')]?_0x1990a0['attributes']:_0x9863e1[_0xe202('0x31')];if(_0x6a9326['query'][_0xe202('0x44')]){_0x1990a0[_0xe202('0x41')]=[{'all':!![]}];}_0x1990a0=_[_0xe202('0x3f')]({},_0x1990a0,_0x6a9326[_0xe202('0x40')]);return db[_0xe202('0x2c')][_0xe202('0x45')](_0x1990a0)[_0xe202('0x24')](handleEntityNotFound(_0x480ada,null))[_0xe202('0x24')](respondWithResult(_0x480ada,null))[_0xe202('0x46')](handleError(_0x480ada,null));};exports[_0xe202('0x47')]=function(_0x4450a8,_0x168907){return db[_0xe202('0x2c')][_0xe202('0x47')](_0x4450a8[_0xe202('0x48')],{})['then'](respondWithResult(_0x168907,0xc9))[_0xe202('0x46')](handleError(_0x168907,null));};exports[_0xe202('0x23')]=function(_0x30c8ae,_0x1e25c9){if(_0x30c8ae[_0xe202('0x48')]['id']){delete _0x30c8ae[_0xe202('0x48')]['id'];}return db[_0xe202('0x2c')]['find']({'where':{'id':_0x30c8ae[_0xe202('0x43')]['id']}})[_0xe202('0x24')](handleEntityNotFound(_0x1e25c9,null))[_0xe202('0x24')](saveUpdates(_0x30c8ae[_0xe202('0x48')],null))[_0xe202('0x24')](respondWithResult(_0x1e25c9,null))[_0xe202('0x46')](handleError(_0x1e25c9,null));};exports[_0xe202('0x25')]=function(_0x5340ac,_0x4c6dfa){return db[_0xe202('0x2c')]['find']({'where':{'id':_0x5340ac[_0xe202('0x43')]['id']}})[_0xe202('0x24')](handleEntityNotFound(_0x4c6dfa,null))['then'](removeEntity(_0x4c6dfa,null))['catch'](handleError(_0x4c6dfa,null));};exports[_0xe202('0x49')]=function(_0x3f6fc5,_0x5c67a9,_0x2f0a22){var _0x5c09ef={};var _0x5d438b={};var _0x30efcb;var _0xbe08e0;return db['FreshsalesAccount'][_0xe202('0x4a')]({'where':{'id':_0x3f6fc5[_0xe202('0x43')]['id']}})[_0xe202('0x24')](handleEntityNotFound(_0x5c67a9,null))[_0xe202('0x24')](function(_0x494457){if(_0x494457){_0x30efcb=_0x494457;_0x5d438b[_0xe202('0x31')]=_[_0xe202('0x33')](db[_0xe202('0x4b')][_0xe202('0x2d')]);_0x5d438b[_0xe202('0x32')]=_[_0xe202('0x33')](_0x3f6fc5['query']);_0x5d438b[_0xe202('0x34')]=_[_0xe202('0x35')](_0x5d438b[_0xe202('0x31')],_0x5d438b['query']);_0x5c09ef[_0xe202('0x37')]=_[_0xe202('0x35')](_0x5d438b[_0xe202('0x31')],qs[_0xe202('0x36')](_0x3f6fc5['query']['fields']));_0x5c09ef[_0xe202('0x37')]=_0x5c09ef[_0xe202('0x37')]['length']?_0x5c09ef['attributes']:_0x5d438b[_0xe202('0x31')];_0x5c09ef[_0xe202('0x3a')]=qs[_0xe202('0x3b')](_0x3f6fc5['query'][_0xe202('0x3b')]);_0x5c09ef['where']=qs['filters'](_[_0xe202('0x3c')](_0x3f6fc5[_0xe202('0x32')],_0x5d438b[_0xe202('0x34')]));if(_0x3f6fc5[_0xe202('0x32')][_0xe202('0x3d')]){_0x5c09ef[_0xe202('0x3e')]=_[_0xe202('0x3f')](_0x5c09ef[_0xe202('0x3e')],{'$or':_['map'](_0x5c09ef['attributes'],function(_0x523f56){var _0x31a94d={};_0x31a94d[_0x523f56]={'$like':'%'+_0x3f6fc5['query']['filter']+'%'};return _0x31a94d;})});}_0x5c09ef=_[_0xe202('0x3f')]({},_0x5c09ef,_0x3f6fc5[_0xe202('0x40')]);return _0x30efcb['getConfigurations'](_0x5c09ef);}})['then'](function(_0xda968b){if(_0xda968b){_0xbe08e0=_0xda968b[_0xe202('0x38')];if(!_0x3f6fc5[_0xe202('0x32')]['hasOwnProperty'](_0xe202('0x39'))){_0x5c09ef[_0xe202('0x1c')]=qs['limit'](_0x3f6fc5[_0xe202('0x32')][_0xe202('0x1c')]);_0x5c09ef[_0xe202('0x1e')]=qs[_0xe202('0x1e')](_0x3f6fc5[_0xe202('0x32')]['offset']);}return _0x30efcb[_0xe202('0x49')](_0x5c09ef);}})['then'](function(_0xabe47f){if(_0xabe47f){return _0xabe47f?{'count':_0xbe08e0,'rows':_0xabe47f}:null;}})[_0xe202('0x24')](respondWithResult(_0x5c67a9,null))[_0xe202('0x46')](handleError(_0x5c67a9,null));};exports[_0xe202('0x4c')]=function(_0x4e4003,_0x211be5,_0x1e5c82){if(_0x4e4003[_0xe202('0x48')]['id']){delete _0x4e4003[_0xe202('0x48')]['id'];}return db['FreshsalesAccount']['findOne']({'where':{'id':_0x4e4003[_0xe202('0x43')]['id']}})[_0xe202('0x24')](handleEntityNotFound(_0x211be5,null))['then'](function(_0x1ad7cb){if(_0x1ad7cb){_0x4e4003['body'][_0xe202('0x4d')]=_0x1ad7cb['id'];_0x4e4003[_0xe202('0x48')][_0xe202('0x4e')]=integrations[_0xe202('0x4f')](_0x4e4003['body'][_0xe202('0x50')],_0x4e4003[_0xe202('0x48')][_0xe202('0x2f')]);_0x4e4003[_0xe202('0x48')]['Descriptions']=integrations[_0xe202('0x51')](_0x4e4003[_0xe202('0x48')][_0xe202('0x50')],_0x4e4003[_0xe202('0x48')][_0xe202('0x2f')]);return db[_0xe202('0x4b')][_0xe202('0x47')](_0x4e4003['body'],{'include':[{'model':db[_0xe202('0x52')],'as':_0xe202('0x4e')},{'model':db['FreshsalesField'],'as':_0xe202('0x53')}]});}return null;})['then'](respondWithResult(_0x211be5,null))[_0xe202('0x46')](handleError(_0x211be5,null));};exports['getFields']=function(_0x5057,_0x1169f2,_0xb45033){var _0x258e6a='';var _0x18cdce='';return db[_0xe202('0x2c')][_0xe202('0x4a')]({'where':{'id':_0x5057[_0xe202('0x43')]['id']},'attributes':['id',_0xe202('0x54'),_0xe202('0x55'),_0xe202('0x56')]})[_0xe202('0x24')](handleEntityNotFound(_0x1169f2,null))[_0xe202('0x24')](function(_0x9eb00c){if(_0x9eb00c){_0x18cdce=_0x9eb00c[_0xe202('0x54')];_0x258e6a=_0x9eb00c[_0xe202('0x55')];var _0x3d65c1=_0x9eb00c[_0xe202('0x55')][_0xe202('0x57')](-0x1);if(_0x3d65c1==='/'){_0x258e6a=_0x258e6a[_0xe202('0x58')](0x0,_0x258e6a[_0xe202('0x59')](_0x3d65c1));}return rp({'method':_0xe202('0x5a'),'uri':util[_0xe202('0x5b')]('%s%s',_0x258e6a,'/api/selector/owners'),'headers':{'Authorization':_0xe202('0x5c')+_0x9eb00c[_0xe202('0x56')]},'json':!![]});}})[_0xe202('0x24')](function(_0x283057){if(_0x283057){var _0x4d4174=_0x283057['users'];var _0x3001dd=![];var _0x497975=null;for(_0x497975=0x0;_0x497975<_0x4d4174['length'];_0x497975++){if(_0x4d4174[_0x497975][_0xe202('0x5d')]===_0x18cdce){_0x3001dd=!![];}}if(_0x3001dd){return!![];}else{throw new Error({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}})[_0xe202('0x24')](respondWithResult(_0x1169f2,null))[_0xe202('0x46')](function(_0x1035f5){var _0x9c9580=_0x5057['query'][_0xe202('0x5e')]?0x1f4:_0x1035f5[_0xe202('0x5f')]||0x1f4;logger[_0xe202('0x27')](_0xe202('0x60'),'getFields',_0x9c9580,JSON[_0xe202('0x61')](_0x1035f5));delete _0x1035f5[_0xe202('0x29')];if(_0x9c9580===0x191){_0x9c9580=0x190;}_0x1169f2[_0xe202('0x1f')](_0x9c9580)[_0xe202('0x62')](_0x5057[_0xe202('0x32')][_0xe202('0x5e')]?{'message':_0xe202('0x63'),'statusCode':_0x1035f5[_0xe202('0x5f')]}:_0x1035f5);});}; \ No newline at end of file +var _0xfbd5=['body','params','getConfigurations','findOne','FreshsalesConfiguration','hasOwnProperty','addConfiguration','Subjects','getSubjects','channel','Descriptions','getDescriptions','FreshsalesField','username','remoteUri','apiKey','slice','substring','lastIndexOf','GET','%s%s','/api/selector/owners','Token\x20token=','users','email','Requested\x20Resource\x20not\x20Found','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','apply','reject','save','update','then','destroy','stack','name','index','map','rawAttributes','fieldName','key','model','keys','query','intersection','fields','attributes','length','nolimit','order','sort','where','filters','filter','merge','type','VIRTUAL','options','FreshsalesAccount','findAll','rows','catch','show','includeAll','include','find','create'];(function(_0x233d82,_0x5ef2c4){var _0x5586cb=function(_0x6642fe){while(--_0x6642fe){_0x233d82['push'](_0x233d82['shift']());}};_0x5586cb(++_0x5ef2c4);}(_0xfbd5,0x8a));var _0x5fbd=function(_0x3302e6,_0x4df139){_0x3302e6=_0x3302e6-0x0;var _0x2aa3fe=_0xfbd5[_0x3302e6];return _0x2aa3fe;};'use strict';var emlformat=require(_0x5fbd('0x0'));var rimraf=require(_0x5fbd('0x1'));var zipdir=require(_0x5fbd('0x2'));var jsonpatch=require(_0x5fbd('0x3'));var rp=require('request-promise');var moment=require(_0x5fbd('0x4'));var BPromise=require(_0x5fbd('0x5'));var Mustache=require(_0x5fbd('0x6'));var util=require(_0x5fbd('0x7'));var path=require('path');var sox=require(_0x5fbd('0x8'));var csv=require(_0x5fbd('0x9'));var ejs=require(_0x5fbd('0xa'));var fs=require('fs');var fs_extra=require(_0x5fbd('0xb'));var _=require(_0x5fbd('0xc'));var squel=require(_0x5fbd('0xd'));var crypto=require(_0x5fbd('0xe'));var jsforce=require(_0x5fbd('0xf'));var deskjs=require(_0x5fbd('0x10'));var toCsv=require(_0x5fbd('0x9'));var querystring=require(_0x5fbd('0x11'));var Papa=require('papaparse');var Redis=require(_0x5fbd('0x12'));var authService=require(_0x5fbd('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x5fbd('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5fbd('0x15'))(_0x5fbd('0x16'));var utils=require(_0x5fbd('0x17'));var config=require(_0x5fbd('0x18'));var licenseUtil=require(_0x5fbd('0x19'));var db=require(_0x5fbd('0x1a'))['db'];var integrations=require(_0x5fbd('0x1b'));function respondWithStatusCode(_0x40b9c7,_0xf75df5){_0xf75df5=_0xf75df5||0xcc;return function(_0x245400){if(_0x245400){return _0x40b9c7[_0x5fbd('0x1c')](_0xf75df5);}return _0x40b9c7[_0x5fbd('0x1d')](_0xf75df5)[_0x5fbd('0x1e')]();};}function respondWithResult(_0x1763df,_0x27613a){_0x27613a=_0x27613a||0xc8;return function(_0x59b7c6){if(_0x59b7c6){return _0x1763df[_0x5fbd('0x1d')](_0x27613a)[_0x5fbd('0x1f')](_0x59b7c6);}};}function respondWithFilteredResult(_0x23c116,_0x55d84b){return function(_0x25348b){if(_0x25348b){var _0x128564=typeof _0x55d84b[_0x5fbd('0x20')]==='undefined'&&typeof _0x55d84b[_0x5fbd('0x21')]===_0x5fbd('0x22');var _0x193da8=_0x25348b[_0x5fbd('0x23')];var _0x1f7ad5=_0x128564?0x0:_0x55d84b[_0x5fbd('0x20')];var _0x104ecf=_0x128564?_0x25348b[_0x5fbd('0x23')]:_0x55d84b[_0x5fbd('0x20')]+_0x55d84b['limit'];var _0x27c6e8;if(_0x104ecf>=_0x193da8){_0x104ecf=_0x193da8;_0x27c6e8=0xc8;}else{_0x27c6e8=0xce;}_0x23c116['status'](_0x27c6e8);return _0x23c116['set'](_0x5fbd('0x24'),_0x1f7ad5+'-'+_0x104ecf+'/'+_0x193da8)['json'](_0x25348b);}return null;};}function patchUpdates(_0x1da134){return function(_0x8c168d){try{jsonpatch[_0x5fbd('0x25')](_0x8c168d,_0x1da134,!![]);}catch(_0xb36f9c){return BPromise[_0x5fbd('0x26')](_0xb36f9c);}return _0x8c168d[_0x5fbd('0x27')]();};}function saveUpdates(_0x174d45,_0x434120){return function(_0x312d16){if(_0x312d16){return _0x312d16[_0x5fbd('0x28')](_0x174d45)[_0x5fbd('0x29')](function(_0x30315b){return _0x30315b;});}return null;};}function removeEntity(_0x510495,_0x175cd8){return function(_0x293eb7){if(_0x293eb7){return _0x293eb7[_0x5fbd('0x2a')]()['then'](function(){_0x510495[_0x5fbd('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x56474c,_0x51ab1f){return function(_0x22fe8a){if(!_0x22fe8a){_0x56474c[_0x5fbd('0x1c')](0x194);}return _0x22fe8a;};}function handleError(_0x430a83,_0x5cffed){_0x5cffed=_0x5cffed||0x1f4;return function(_0x476f76){logger['error'](_0x476f76[_0x5fbd('0x2b')]);if(_0x476f76[_0x5fbd('0x2c')]){delete _0x476f76[_0x5fbd('0x2c')];}_0x430a83[_0x5fbd('0x1d')](_0x5cffed)['send'](_0x476f76);};}exports[_0x5fbd('0x2d')]=function(_0x4ba4d0,_0x23d134){var _0x70c40f={},_0x3cf1a2={},_0x540504={'count':0x0,'rows':[]};var _0x5ce2f5=_[_0x5fbd('0x2e')](db['FreshsalesAccount'][_0x5fbd('0x2f')],function(_0x1c378b){return{'name':_0x1c378b[_0x5fbd('0x30')],'type':_0x1c378b['type'][_0x5fbd('0x31')]};});_0x3cf1a2[_0x5fbd('0x32')]=_['map'](_0x5ce2f5,'name');_0x3cf1a2['query']=_[_0x5fbd('0x33')](_0x4ba4d0[_0x5fbd('0x34')]);_0x3cf1a2['filters']=_[_0x5fbd('0x35')](_0x3cf1a2[_0x5fbd('0x32')],_0x3cf1a2[_0x5fbd('0x34')]);_0x70c40f['attributes']=_[_0x5fbd('0x35')](_0x3cf1a2[_0x5fbd('0x32')],qs[_0x5fbd('0x36')](_0x4ba4d0[_0x5fbd('0x34')]['fields']));_0x70c40f[_0x5fbd('0x37')]=_0x70c40f[_0x5fbd('0x37')][_0x5fbd('0x38')]?_0x70c40f[_0x5fbd('0x37')]:_0x3cf1a2['model'];if(!_0x4ba4d0[_0x5fbd('0x34')]['hasOwnProperty'](_0x5fbd('0x39'))){_0x70c40f[_0x5fbd('0x21')]=qs[_0x5fbd('0x21')](_0x4ba4d0[_0x5fbd('0x34')][_0x5fbd('0x21')]);_0x70c40f[_0x5fbd('0x20')]=qs['offset'](_0x4ba4d0[_0x5fbd('0x34')][_0x5fbd('0x20')]);}_0x70c40f[_0x5fbd('0x3a')]=qs[_0x5fbd('0x3b')](_0x4ba4d0[_0x5fbd('0x34')][_0x5fbd('0x3b')]);_0x70c40f[_0x5fbd('0x3c')]=qs[_0x5fbd('0x3d')](_['pick'](_0x4ba4d0['query'],_0x3cf1a2[_0x5fbd('0x3d')]),_0x5ce2f5);if(_0x4ba4d0[_0x5fbd('0x34')][_0x5fbd('0x3e')]){_0x70c40f[_0x5fbd('0x3c')]=_[_0x5fbd('0x3f')](_0x70c40f[_0x5fbd('0x3c')],{'$or':_[_0x5fbd('0x2e')](_0x5ce2f5,function(_0x28fef5){if(_0x28fef5[_0x5fbd('0x40')]!==_0x5fbd('0x41')){var _0xbcbf43={};_0xbcbf43[_0x28fef5[_0x5fbd('0x2c')]]={'$like':'%'+_0x4ba4d0[_0x5fbd('0x34')][_0x5fbd('0x3e')]+'%'};return _0xbcbf43;}})});}_0x70c40f=_[_0x5fbd('0x3f')]({},_0x70c40f,_0x4ba4d0[_0x5fbd('0x42')]);var _0x2e79e3={'where':_0x70c40f[_0x5fbd('0x3c')]};return db[_0x5fbd('0x43')]['count'](_0x2e79e3)[_0x5fbd('0x29')](function(_0x2c6075){_0x540504['count']=_0x2c6075;if(_0x4ba4d0[_0x5fbd('0x34')]['includeAll']){_0x70c40f['include']=[{'all':!![]}];}return db['FreshsalesAccount'][_0x5fbd('0x44')](_0x70c40f);})[_0x5fbd('0x29')](function(_0x2e23fe){_0x540504[_0x5fbd('0x45')]=_0x2e23fe;return _0x540504;})[_0x5fbd('0x29')](respondWithFilteredResult(_0x23d134,_0x70c40f))[_0x5fbd('0x46')](handleError(_0x23d134,null));};exports[_0x5fbd('0x47')]=function(_0x51a91b,_0x37a4f6){var _0x6b0284={'raw':![],'where':{'id':_0x51a91b['params']['id']}},_0x52f49a={};_0x52f49a['model']=_['keys'](db[_0x5fbd('0x43')][_0x5fbd('0x2f')]);_0x52f49a[_0x5fbd('0x34')]=_[_0x5fbd('0x33')](_0x51a91b['query']);_0x52f49a[_0x5fbd('0x3d')]=_[_0x5fbd('0x35')](_0x52f49a[_0x5fbd('0x32')],_0x52f49a[_0x5fbd('0x34')]);_0x6b0284[_0x5fbd('0x37')]=_[_0x5fbd('0x35')](_0x52f49a[_0x5fbd('0x32')],qs[_0x5fbd('0x36')](_0x51a91b[_0x5fbd('0x34')][_0x5fbd('0x36')]));_0x6b0284[_0x5fbd('0x37')]=_0x6b0284[_0x5fbd('0x37')][_0x5fbd('0x38')]?_0x6b0284['attributes']:_0x52f49a[_0x5fbd('0x32')];if(_0x51a91b['query'][_0x5fbd('0x48')]){_0x6b0284[_0x5fbd('0x49')]=[{'all':!![]}];}_0x6b0284=_[_0x5fbd('0x3f')]({},_0x6b0284,_0x51a91b[_0x5fbd('0x42')]);return db[_0x5fbd('0x43')][_0x5fbd('0x4a')](_0x6b0284)[_0x5fbd('0x29')](handleEntityNotFound(_0x37a4f6,null))[_0x5fbd('0x29')](respondWithResult(_0x37a4f6,null))[_0x5fbd('0x46')](handleError(_0x37a4f6,null));};exports['create']=function(_0x20c88a,_0x300199){return db[_0x5fbd('0x43')][_0x5fbd('0x4b')](_0x20c88a['body'],{})[_0x5fbd('0x29')](respondWithResult(_0x300199,0xc9))['catch'](handleError(_0x300199,null));};exports[_0x5fbd('0x28')]=function(_0x418f01,_0x36fcc6){if(_0x418f01['body']['id']){delete _0x418f01[_0x5fbd('0x4c')]['id'];}return db['FreshsalesAccount'][_0x5fbd('0x4a')]({'where':{'id':_0x418f01[_0x5fbd('0x4d')]['id']}})[_0x5fbd('0x29')](handleEntityNotFound(_0x36fcc6,null))['then'](saveUpdates(_0x418f01[_0x5fbd('0x4c')],null))[_0x5fbd('0x29')](respondWithResult(_0x36fcc6,null))[_0x5fbd('0x46')](handleError(_0x36fcc6,null));};exports['destroy']=function(_0x41c2ac,_0x5eeeb8){return db['FreshsalesAccount'][_0x5fbd('0x4a')]({'where':{'id':_0x41c2ac[_0x5fbd('0x4d')]['id']}})[_0x5fbd('0x29')](handleEntityNotFound(_0x5eeeb8,null))[_0x5fbd('0x29')](removeEntity(_0x5eeeb8,null))[_0x5fbd('0x46')](handleError(_0x5eeeb8,null));};exports[_0x5fbd('0x4e')]=function(_0x32ccb4,_0x2a3386,_0x410607){var _0x38a35d={};var _0x35dc5f={};var _0x49fc30;var _0x2ebd30;return db['FreshsalesAccount'][_0x5fbd('0x4f')]({'where':{'id':_0x32ccb4[_0x5fbd('0x4d')]['id']}})[_0x5fbd('0x29')](handleEntityNotFound(_0x2a3386,null))[_0x5fbd('0x29')](function(_0x3fd4ce){if(_0x3fd4ce){_0x49fc30=_0x3fd4ce;_0x35dc5f[_0x5fbd('0x32')]=_[_0x5fbd('0x33')](db[_0x5fbd('0x50')][_0x5fbd('0x2f')]);_0x35dc5f[_0x5fbd('0x34')]=_['keys'](_0x32ccb4['query']);_0x35dc5f[_0x5fbd('0x3d')]=_[_0x5fbd('0x35')](_0x35dc5f[_0x5fbd('0x32')],_0x35dc5f[_0x5fbd('0x34')]);_0x38a35d['attributes']=_[_0x5fbd('0x35')](_0x35dc5f[_0x5fbd('0x32')],qs['fields'](_0x32ccb4['query'][_0x5fbd('0x36')]));_0x38a35d[_0x5fbd('0x37')]=_0x38a35d['attributes'][_0x5fbd('0x38')]?_0x38a35d[_0x5fbd('0x37')]:_0x35dc5f[_0x5fbd('0x32')];_0x38a35d[_0x5fbd('0x3a')]=qs[_0x5fbd('0x3b')](_0x32ccb4[_0x5fbd('0x34')]['sort']);_0x38a35d[_0x5fbd('0x3c')]=qs[_0x5fbd('0x3d')](_['pick'](_0x32ccb4['query'],_0x35dc5f['filters']));if(_0x32ccb4['query'][_0x5fbd('0x3e')]){_0x38a35d['where']=_['merge'](_0x38a35d['where'],{'$or':_[_0x5fbd('0x2e')](_0x38a35d['attributes'],function(_0x5eef9d){var _0xc079b9={};_0xc079b9[_0x5eef9d]={'$like':'%'+_0x32ccb4[_0x5fbd('0x34')][_0x5fbd('0x3e')]+'%'};return _0xc079b9;})});}_0x38a35d=_['merge']({},_0x38a35d,_0x32ccb4[_0x5fbd('0x42')]);return _0x49fc30[_0x5fbd('0x4e')](_0x38a35d);}})[_0x5fbd('0x29')](function(_0x5416de){if(_0x5416de){_0x2ebd30=_0x5416de[_0x5fbd('0x38')];if(!_0x32ccb4[_0x5fbd('0x34')][_0x5fbd('0x51')](_0x5fbd('0x39'))){_0x38a35d[_0x5fbd('0x21')]=qs['limit'](_0x32ccb4[_0x5fbd('0x34')][_0x5fbd('0x21')]);_0x38a35d[_0x5fbd('0x20')]=qs[_0x5fbd('0x20')](_0x32ccb4[_0x5fbd('0x34')][_0x5fbd('0x20')]);}return _0x49fc30[_0x5fbd('0x4e')](_0x38a35d);}})[_0x5fbd('0x29')](function(_0x56123d){if(_0x56123d){return _0x56123d?{'count':_0x2ebd30,'rows':_0x56123d}:null;}})['then'](respondWithResult(_0x2a3386,null))[_0x5fbd('0x46')](handleError(_0x2a3386,null));};exports[_0x5fbd('0x52')]=function(_0x2c2a7b,_0x3d9971,_0x5bb243){if(_0x2c2a7b[_0x5fbd('0x4c')]['id']){delete _0x2c2a7b['body']['id'];}return db[_0x5fbd('0x43')][_0x5fbd('0x4f')]({'where':{'id':_0x2c2a7b[_0x5fbd('0x4d')]['id']}})[_0x5fbd('0x29')](handleEntityNotFound(_0x3d9971,null))[_0x5fbd('0x29')](function(_0x569942){if(_0x569942){_0x2c2a7b[_0x5fbd('0x4c')]['AccountId']=_0x569942['id'];_0x2c2a7b['body'][_0x5fbd('0x53')]=integrations[_0x5fbd('0x54')](_0x2c2a7b[_0x5fbd('0x4c')][_0x5fbd('0x55')],_0x2c2a7b[_0x5fbd('0x4c')][_0x5fbd('0x40')]);_0x2c2a7b[_0x5fbd('0x4c')][_0x5fbd('0x56')]=integrations[_0x5fbd('0x57')](_0x2c2a7b[_0x5fbd('0x4c')]['channel'],_0x2c2a7b[_0x5fbd('0x4c')][_0x5fbd('0x40')]);return db[_0x5fbd('0x50')]['create'](_0x2c2a7b[_0x5fbd('0x4c')],{'include':[{'model':db[_0x5fbd('0x58')],'as':_0x5fbd('0x53')},{'model':db['FreshsalesField'],'as':_0x5fbd('0x56')}]});}return null;})[_0x5fbd('0x29')](respondWithResult(_0x3d9971,null))[_0x5fbd('0x46')](handleError(_0x3d9971,null));};exports['getFields']=function(_0x3a2782,_0x212e46,_0x4959bb){var _0x50c5e0='';var _0x5ca612='';return db['FreshsalesAccount'][_0x5fbd('0x4f')]({'where':{'id':_0x3a2782['params']['id']},'attributes':['id',_0x5fbd('0x59'),_0x5fbd('0x5a'),_0x5fbd('0x5b')]})[_0x5fbd('0x29')](handleEntityNotFound(_0x212e46,null))[_0x5fbd('0x29')](function(_0x23234){if(_0x23234){_0x5ca612=_0x23234[_0x5fbd('0x59')];_0x50c5e0=_0x23234[_0x5fbd('0x5a')];var _0x39cdcf=_0x23234[_0x5fbd('0x5a')][_0x5fbd('0x5c')](-0x1);if(_0x39cdcf==='/'){_0x50c5e0=_0x50c5e0[_0x5fbd('0x5d')](0x0,_0x50c5e0[_0x5fbd('0x5e')](_0x39cdcf));}return rp({'method':_0x5fbd('0x5f'),'uri':util['format'](_0x5fbd('0x60'),_0x50c5e0,_0x5fbd('0x61')),'headers':{'Authorization':_0x5fbd('0x62')+_0x23234[_0x5fbd('0x5b')]},'json':!![]});}})[_0x5fbd('0x29')](function(_0x5522da){if(_0x5522da){var _0x64b3b4=_0x5522da[_0x5fbd('0x63')];var _0x128bd9=![];var _0x44daff=null;for(_0x44daff=0x0;_0x44daff<_0x64b3b4[_0x5fbd('0x38')];_0x44daff++){if(_0x64b3b4[_0x44daff][_0x5fbd('0x64')]===_0x5ca612){_0x128bd9=!![];}}if(_0x128bd9){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x5fbd('0x65')});}}})[_0x5fbd('0x29')](respondWithResult(_0x212e46,null))[_0x5fbd('0x46')](function(_0x526bfc){var _0x59c765=_0x3a2782[_0x5fbd('0x34')]['test']?0x1f4:_0x526bfc[_0x5fbd('0x66')]||0x1f4;logger['error'](_0x5fbd('0x67'),_0x5fbd('0x68'),_0x59c765,JSON[_0x5fbd('0x69')](_0x526bfc));delete _0x526bfc[_0x5fbd('0x2c')];if(_0x59c765===0x191){_0x59c765=0x190;}_0x212e46['status'](_0x59c765)['send'](_0x3a2782['query']['test']?{'message':_0x5fbd('0x6a'),'statusCode':_0x526bfc['statusCode']}:_0x526bfc);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index ed6fdbf..28d83a0 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 _0x2d72=['exports','define','FreshsalesAccount','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshsalesAccount.attributes','../../components/integrations/configuration'];(function(_0x1a21ff,_0x4a7550){var _0x25afc1=function(_0x4a66ec){while(--_0x4a66ec){_0x1a21ff['push'](_0x1a21ff['shift']());}};_0x25afc1(++_0x4a7550);}(_0x2d72,0xa8));var _0x22d7=function(_0x40f474,_0x5d2426){_0x40f474=_0x40f474-0x0;var _0x566daf=_0x2d72[_0x40f474];return _0x566daf;};'use strict';var _=require(_0x22d7('0x0'));var util=require(_0x22d7('0x1'));var logger=require(_0x22d7('0x2'))(_0x22d7('0x3'));var moment=require(_0x22d7('0x4'));var BPromise=require(_0x22d7('0x5'));var rp=require(_0x22d7('0x6'));var fs=require('fs');var path=require(_0x22d7('0x7'));var rimraf=require(_0x22d7('0x8'));var config=require(_0x22d7('0x9'));var attributes=require(_0x22d7('0xa'));var integrations=require(_0x22d7('0xb'));module[_0x22d7('0xc')]=function(_0x100426,_0x52a3e3){return _0x100426[_0x22d7('0xd')](_0x22d7('0xe'),attributes,{'tableName':'int_freshsales_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8aad=['FreshsalesAccount','int_freshsales_accounts','lodash','util','api','bluebird','request-promise','../../config/environment','exports'];(function(_0x3c8103,_0x2a4125){var _0x16496f=function(_0x5617b0){while(--_0x5617b0){_0x3c8103['push'](_0x3c8103['shift']());}};_0x16496f(++_0x2a4125);}(_0x8aad,0x146));var _0xd8aa=function(_0x24cbbb,_0x409a54){_0x24cbbb=_0x24cbbb-0x0;var _0x1c280b=_0x8aad[_0x24cbbb];return _0x1c280b;};'use strict';var _=require(_0xd8aa('0x0'));var util=require(_0xd8aa('0x1'));var logger=require('../../config/logger')(_0xd8aa('0x2'));var moment=require('moment');var BPromise=require(_0xd8aa('0x3'));var rp=require(_0xd8aa('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xd8aa('0x5'));var attributes=require('./intFreshsalesAccount.attributes');var integrations=require('../../components/integrations/configuration');module[_0xd8aa('0x6')]=function(_0x43ddeb,_0x16ea12){return _0x43ddeb['define'](_0xd8aa('0x7'),attributes,{'tableName':_0xd8aa('0x8'),'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 703741f..6ca6764 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 _0xef0f=['FreshsalesAccount,\x20%s,\x20%s','request\x20sent','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetFreshsalesAccount','FreshsalesAccount','findAll','options','where','include','model','attributes','map','ShowFreshsalesAccount','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x1e9912,_0x50f826){var _0x193d70=function(_0x78541e){while(--_0x78541e){_0x1e9912['push'](_0x1e9912['shift']());}};_0x193d70(++_0x50f826);}(_0xef0f,0x168));var _0xfef0=function(_0x4f8967,_0x28552e){_0x4f8967=_0x4f8967-0x0;var _0x1e1ba7=_0xef0f[_0x4f8967];return _0x1e1ba7;};'use strict';var _=require(_0xfef0('0x0'));var util=require('util');var moment=require(_0xfef0('0x1'));var BPromise=require(_0xfef0('0x2'));var rs=require(_0xfef0('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfef0('0x4'))['db'];var utils=require(_0xfef0('0x5'));var logger=require(_0xfef0('0x6'))('rpc');var config=require(_0xfef0('0x7'));var jayson=require(_0xfef0('0x8'));var client=jayson[_0xfef0('0x9')][_0xfef0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xad43e,_0x11dfd7,_0x5130bd){return new BPromise(function(_0x41ec94,_0x58cf6d){return client[_0xfef0('0xb')](_0xad43e,_0x5130bd)[_0xfef0('0xc')](function(_0x3a81cc){logger[_0xfef0('0xd')](_0xfef0('0xe'),_0x11dfd7,_0xfef0('0xf'));logger[_0xfef0('0x10')](_0xfef0('0x11'),_0x11dfd7,_0xfef0('0xf'),JSON[_0xfef0('0x12')](_0x3a81cc));if(_0x3a81cc[_0xfef0('0x13')]){if(_0x3a81cc[_0xfef0('0x13')][_0xfef0('0x14')]===0x1f4){logger[_0xfef0('0x13')]('FreshsalesAccount,\x20%s,\x20%s',_0x11dfd7,_0x3a81cc[_0xfef0('0x13')][_0xfef0('0x15')]);return _0x58cf6d(_0x3a81cc[_0xfef0('0x13')][_0xfef0('0x15')]);}logger[_0xfef0('0x13')](_0xfef0('0xe'),_0x11dfd7,_0x3a81cc[_0xfef0('0x13')]['message']);return _0x41ec94(_0x3a81cc[_0xfef0('0x13')]['message']);}else{logger['info']('FreshsalesAccount,\x20%s,\x20%s',_0x11dfd7,_0xfef0('0xf'));_0x41ec94(_0x3a81cc[_0xfef0('0x16')][_0xfef0('0x15')]);}})[_0xfef0('0x17')](function(_0x2a96d9){logger[_0xfef0('0x13')](_0xfef0('0xe'),_0x11dfd7,_0x2a96d9);_0x58cf6d(_0x2a96d9);});});}exports[_0xfef0('0x18')]=function(_0x581459){var _0xd60678=this;return new Promise(function(_0x1642cd,_0x1577fa){return db[_0xfef0('0x19')][_0xfef0('0x1a')]({'raw':_0x581459['options']?_0x581459[_0xfef0('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x581459[_0xfef0('0x1b')]?_0x581459[_0xfef0('0x1b')][_0xfef0('0x1c')]||null:null,'attributes':_0x581459['options']?_0x581459[_0xfef0('0x1b')]['attributes']||null:null,'limit':_0x581459[_0xfef0('0x1b')]?_0x581459[_0xfef0('0x1b')]['limit']||null:null,'include':_0x581459['options']?_0x581459['options'][_0xfef0('0x1d')]?_['map'](_0x581459[_0xfef0('0x1b')][_0xfef0('0x1d')],function(_0x1a8d66){return{'model':db[_0x1a8d66[_0xfef0('0x1e')]],'as':_0x1a8d66['as'],'attributes':_0x1a8d66[_0xfef0('0x1f')],'include':_0x1a8d66[_0xfef0('0x1d')]?_['map'](_0x1a8d66['include'],function(_0x316e20){return{'model':db[_0x316e20[_0xfef0('0x1e')]],'as':_0x316e20['as'],'attributes':_0x316e20[_0xfef0('0x1f')],'include':_0x316e20[_0xfef0('0x1d')]?_[_0xfef0('0x20')](_0x316e20[_0xfef0('0x1d')],function(_0x5df04f){return{'model':db[_0x5df04f[_0xfef0('0x1e')]],'as':_0x5df04f['as'],'attributes':_0x5df04f[_0xfef0('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1a6758){logger[_0xfef0('0xd')](_0xfef0('0x18'),_0x581459);logger[_0xfef0('0x10')](_0xfef0('0x18'),_0x581459,JSON[_0xfef0('0x12')](_0x1a6758));_0x1642cd(_0x1a6758);})[_0xfef0('0x17')](function(_0x3e026a){logger[_0xfef0('0x13')](_0xfef0('0x18'),_0x3e026a[_0xfef0('0x15')],_0x581459);_0x1577fa(_0xd60678[_0xfef0('0x13')](0x1f4,_0x3e026a['message']));});});};exports[_0xfef0('0x21')]=function(_0x5806bd){var _0x4eaf74=this;return new Promise(function(_0x7d1692,_0x2ae54a){return db['FreshsalesAccount']['find']({'raw':_0x5806bd['options']?_0x5806bd['options']['raw']===undefined?!![]:![]:!![],'where':_0x5806bd[_0xfef0('0x1b')]?_0x5806bd[_0xfef0('0x1b')][_0xfef0('0x1c')]||null:null,'attributes':_0x5806bd['options']?_0x5806bd['options']['attributes']||null:null,'include':_0x5806bd[_0xfef0('0x1b')]?_0x5806bd['options'][_0xfef0('0x1d')]?_[_0xfef0('0x20')](_0x5806bd[_0xfef0('0x1b')]['include'],function(_0x3cad13){return{'model':db[_0x3cad13['model']],'as':_0x3cad13['as'],'attributes':_0x3cad13[_0xfef0('0x1f')],'include':_0x3cad13[_0xfef0('0x1d')]?_[_0xfef0('0x20')](_0x3cad13[_0xfef0('0x1d')],function(_0x3e1a64){return{'model':db[_0x3e1a64[_0xfef0('0x1e')]],'as':_0x3e1a64['as'],'attributes':_0x3e1a64[_0xfef0('0x1f')],'include':_0x3e1a64[_0xfef0('0x1d')]?_['map'](_0x3e1a64[_0xfef0('0x1d')],function(_0xea09ec){return{'model':db[_0xea09ec[_0xfef0('0x1e')]],'as':_0xea09ec['as'],'attributes':_0xea09ec[_0xfef0('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xfef0('0xc')](function(_0x262341){logger[_0xfef0('0xd')](_0xfef0('0x21'),_0x5806bd);logger[_0xfef0('0x10')](_0xfef0('0x21'),_0x5806bd,JSON[_0xfef0('0x12')](_0x262341));_0x7d1692(_0x262341);})[_0xfef0('0x17')](function(_0x366667){logger['error'](_0xfef0('0x21'),_0x366667['message'],_0x5806bd);_0x2ae54a(_0x4eaf74[_0xfef0('0x13')](0x1f4,_0x366667[_0xfef0('0x15')]));});});}; \ No newline at end of file +var _0x2da6=['info','FreshsalesAccount,\x20%s,\x20%s','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','FreshsalesAccount','options','raw','where','attributes','include','map','model','GetFreshsalesAccount','ShowFreshsalesAccount','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','then'];(function(_0x4ecc5c,_0x2e4b91){var _0x44748e=function(_0x6085f6){while(--_0x6085f6){_0x4ecc5c['push'](_0x4ecc5c['shift']());}};_0x44748e(++_0x2e4b91);}(_0x2da6,0x1dd));var _0x62da=function(_0xa9e6f,_0x3b8b04){_0xa9e6f=_0xa9e6f-0x0;var _0xa7d4e4=_0x2da6[_0xa9e6f];return _0xa7d4e4;};'use strict';var _=require(_0x62da('0x0'));var util=require(_0x62da('0x1'));var moment=require(_0x62da('0x2'));var BPromise=require(_0x62da('0x3'));var rs=require(_0x62da('0x4'));var fs=require('fs');var Redis=require(_0x62da('0x5'));var db=require(_0x62da('0x6'))['db'];var utils=require(_0x62da('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x62da('0x8'));var jayson=require(_0x62da('0x9'));var client=jayson[_0x62da('0xa')][_0x62da('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x100e73,_0x9d9139,_0x310c15){return new BPromise(function(_0x16f919,_0xbfd2b0){return client['request'](_0x100e73,_0x310c15)[_0x62da('0xc')](function(_0x2a3937){logger[_0x62da('0xd')](_0x62da('0xe'),_0x9d9139,'request\x20sent');logger[_0x62da('0xf')](_0x62da('0x10'),_0x9d9139,_0x62da('0x11'),JSON[_0x62da('0x12')](_0x2a3937));if(_0x2a3937[_0x62da('0x13')]){if(_0x2a3937['error'][_0x62da('0x14')]===0x1f4){logger[_0x62da('0x13')](_0x62da('0xe'),_0x9d9139,_0x2a3937[_0x62da('0x13')][_0x62da('0x15')]);return _0xbfd2b0(_0x2a3937['error']['message']);}logger[_0x62da('0x13')](_0x62da('0xe'),_0x9d9139,_0x2a3937[_0x62da('0x13')][_0x62da('0x15')]);return _0x16f919(_0x2a3937[_0x62da('0x13')][_0x62da('0x15')]);}else{logger[_0x62da('0xd')](_0x62da('0xe'),_0x9d9139,_0x62da('0x11'));_0x16f919(_0x2a3937[_0x62da('0x16')][_0x62da('0x15')]);}})[_0x62da('0x17')](function(_0x1f6bc8){logger[_0x62da('0x13')]('FreshsalesAccount,\x20%s,\x20%s',_0x9d9139,_0x1f6bc8);_0xbfd2b0(_0x1f6bc8);});});}exports['GetFreshsalesAccount']=function(_0xa7050b){var _0x4ae4fb=this;return new Promise(function(_0x4d6482,_0x264366){return db[_0x62da('0x18')]['findAll']({'raw':_0xa7050b[_0x62da('0x19')]?_0xa7050b['options'][_0x62da('0x1a')]===undefined?!![]:![]:!![],'where':_0xa7050b[_0x62da('0x19')]?_0xa7050b[_0x62da('0x19')][_0x62da('0x1b')]||null:null,'attributes':_0xa7050b[_0x62da('0x19')]?_0xa7050b[_0x62da('0x19')][_0x62da('0x1c')]||null:null,'limit':_0xa7050b[_0x62da('0x19')]?_0xa7050b[_0x62da('0x19')]['limit']||null:null,'include':_0xa7050b[_0x62da('0x19')]?_0xa7050b[_0x62da('0x19')][_0x62da('0x1d')]?_[_0x62da('0x1e')](_0xa7050b[_0x62da('0x19')][_0x62da('0x1d')],function(_0x24298a){return{'model':db[_0x24298a['model']],'as':_0x24298a['as'],'attributes':_0x24298a['attributes'],'include':_0x24298a['include']?_[_0x62da('0x1e')](_0x24298a[_0x62da('0x1d')],function(_0x14897c){return{'model':db[_0x14897c[_0x62da('0x1f')]],'as':_0x14897c['as'],'attributes':_0x14897c['attributes'],'include':_0x14897c[_0x62da('0x1d')]?_[_0x62da('0x1e')](_0x14897c['include'],function(_0x3ccf96){return{'model':db[_0x3ccf96[_0x62da('0x1f')]],'as':_0x3ccf96['as'],'attributes':_0x3ccf96[_0x62da('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x41de3a){logger[_0x62da('0xd')](_0x62da('0x20'),_0xa7050b);logger['debug']('GetFreshsalesAccount',_0xa7050b,JSON[_0x62da('0x12')](_0x41de3a));_0x4d6482(_0x41de3a);})[_0x62da('0x17')](function(_0x220ffc){logger['error'](_0x62da('0x20'),_0x220ffc[_0x62da('0x15')],_0xa7050b);_0x264366(_0x4ae4fb[_0x62da('0x13')](0x1f4,_0x220ffc[_0x62da('0x15')]));});});};exports[_0x62da('0x21')]=function(_0x1cf765){var _0x592c6c=this;return new Promise(function(_0xbe398f,_0x4f71bc){return db[_0x62da('0x18')][_0x62da('0x22')]({'raw':_0x1cf765[_0x62da('0x19')]?_0x1cf765[_0x62da('0x19')][_0x62da('0x1a')]===undefined?!![]:![]:!![],'where':_0x1cf765[_0x62da('0x19')]?_0x1cf765['options'][_0x62da('0x1b')]||null:null,'attributes':_0x1cf765[_0x62da('0x19')]?_0x1cf765[_0x62da('0x19')]['attributes']||null:null,'include':_0x1cf765[_0x62da('0x19')]?_0x1cf765[_0x62da('0x19')][_0x62da('0x1d')]?_['map'](_0x1cf765[_0x62da('0x19')][_0x62da('0x1d')],function(_0x55eda7){return{'model':db[_0x55eda7[_0x62da('0x1f')]],'as':_0x55eda7['as'],'attributes':_0x55eda7[_0x62da('0x1c')],'include':_0x55eda7['include']?_[_0x62da('0x1e')](_0x55eda7[_0x62da('0x1d')],function(_0x11bf73){return{'model':db[_0x11bf73[_0x62da('0x1f')]],'as':_0x11bf73['as'],'attributes':_0x11bf73[_0x62da('0x1c')],'include':_0x11bf73[_0x62da('0x1d')]?_[_0x62da('0x1e')](_0x11bf73[_0x62da('0x1d')],function(_0x2f1115){return{'model':db[_0x2f1115[_0x62da('0x1f')]],'as':_0x2f1115['as'],'attributes':_0x2f1115[_0x62da('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x62da('0xc')](function(_0x3057f6){logger[_0x62da('0xd')](_0x62da('0x21'),_0x1cf765);logger[_0x62da('0xf')](_0x62da('0x21'),_0x1cf765,JSON['stringify'](_0x3057f6));_0xbe398f(_0x3057f6);})[_0x62da('0x17')](function(_0x5e9295){logger[_0x62da('0x13')](_0x62da('0x21'),_0x5e9295[_0x62da('0x15')],_0x1cf765);_0x4f71bc(_0x592c6c['error'](0x1f4,_0x5e9295[_0x62da('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index 8d32ad5..f993eb7 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 _0x91d6=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intFreshsalesConfiguration.controller','get','index','/:id','isAuthenticated','getSubjects','getDescriptions','/:id/fields','getFields','create','put','update','delete','destroy','exports','util','path','connect-timeout','express'];(function(_0x125a8a,_0x490d31){var _0xe767a5=function(_0x2a505c){while(--_0x2a505c){_0x125a8a['push'](_0x125a8a['shift']());}};_0xe767a5(++_0x490d31);}(_0x91d6,0xf9));var _0x691d=function(_0x4e6ae6,_0x49dba6){_0x4e6ae6=_0x4e6ae6-0x0;var _0x23c108=_0x91d6[_0x4e6ae6];return _0x23c108;};'use strict';var multer=require('multer');var util=require(_0x691d('0x0'));var path=require(_0x691d('0x1'));var timeout=require(_0x691d('0x2'));var express=require(_0x691d('0x3'));var router=express[_0x691d('0x4')]();var fs_extra=require(_0x691d('0x5'));var auth=require(_0x691d('0x6'));var interaction=require(_0x691d('0x7'));var config=require('../../config/environment');var controller=require(_0x691d('0x8'));router[_0x691d('0x9')]('/',auth['isAuthenticated'](),controller[_0x691d('0xa')]);router[_0x691d('0x9')](_0x691d('0xb'),auth['isAuthenticated'](),controller['show']);router['get']('/:id/subjects',auth[_0x691d('0xc')](),controller[_0x691d('0xd')]);router[_0x691d('0x9')]('/:id/descriptions',auth[_0x691d('0xc')](),controller[_0x691d('0xe')]);router[_0x691d('0x9')](_0x691d('0xf'),auth[_0x691d('0xc')](),controller[_0x691d('0x10')]);router['post']('/',auth[_0x691d('0xc')](),controller[_0x691d('0x11')]);router[_0x691d('0x12')]('/:id',auth[_0x691d('0xc')](),controller[_0x691d('0x13')]);router[_0x691d('0x14')](_0x691d('0xb'),auth[_0x691d('0xc')](),controller[_0x691d('0x15')]);module[_0x691d('0x16')]=router; \ No newline at end of file +var _0xe6c9=['isAuthenticated','index','get','/:id','show','/:id/subjects','getSubjects','/:id/fields','post','create','put','delete','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intFreshsalesConfiguration.controller'];(function(_0x1fd675,_0x165dfe){var _0x16b554=function(_0x5761ff){while(--_0x5761ff){_0x1fd675['push'](_0x1fd675['shift']());}};_0x16b554(++_0x165dfe);}(_0xe6c9,0x132));var _0x9e6c=function(_0x8b2437,_0x279ccd){_0x8b2437=_0x8b2437-0x0;var _0x3b6271=_0xe6c9[_0x8b2437];return _0x3b6271;};'use strict';var multer=require(_0x9e6c('0x0'));var util=require(_0x9e6c('0x1'));var path=require(_0x9e6c('0x2'));var timeout=require('connect-timeout');var express=require(_0x9e6c('0x3'));var router=express[_0x9e6c('0x4')]();var fs_extra=require(_0x9e6c('0x5'));var auth=require(_0x9e6c('0x6'));var interaction=require(_0x9e6c('0x7'));var config=require('../../config/environment');var controller=require(_0x9e6c('0x8'));router['get']('/',auth[_0x9e6c('0x9')](),controller[_0x9e6c('0xa')]);router[_0x9e6c('0xb')](_0x9e6c('0xc'),auth[_0x9e6c('0x9')](),controller[_0x9e6c('0xd')]);router[_0x9e6c('0xb')](_0x9e6c('0xe'),auth[_0x9e6c('0x9')](),controller[_0x9e6c('0xf')]);router[_0x9e6c('0xb')]('/:id/descriptions',auth[_0x9e6c('0x9')](),controller['getDescriptions']);router[_0x9e6c('0xb')](_0x9e6c('0x10'),auth['isAuthenticated'](),controller['getFields']);router[_0x9e6c('0x11')]('/',auth[_0x9e6c('0x9')](),controller[_0x9e6c('0x12')]);router[_0x9e6c('0x13')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x9e6c('0x14')](_0x9e6c('0xc'),auth[_0x9e6c('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js index 3cd5f6f..429603b 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 _0x6ca4=['STRING'];(function(_0x2e6e12,_0x238fc4){var _0x4bebf6=function(_0x55643c){while(--_0x55643c){_0x2e6e12['push'](_0x2e6e12['shift']());}};_0x4bebf6(++_0x238fc4);}(_0x6ca4,0x8b));var _0x46ca=function(_0x87e7c5,_0x1a86db){_0x87e7c5=_0x87e7c5-0x0;var _0x3c10df=_0x6ca4[_0x87e7c5];return _0x3c10df;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x46ca('0x0')]},'description':{'type':Sequelize[_0x46ca('0x0')]}}; \ No newline at end of file +var _0x0362=['exports','STRING','sequelize'];(function(_0x3e531a,_0x28a82a){var _0x3c2574=function(_0x4a0c98){while(--_0x4a0c98){_0x3e531a['push'](_0x3e531a['shift']());}};_0x3c2574(++_0x28a82a);}(_0x0362,0xb6));var _0x2036=function(_0x373078,_0x5a8aa2){_0x373078=_0x373078-0x0;var _0x2ef60c=_0x0362[_0x373078];return _0x2ef60c;};'use strict';var Sequelize=require(_0x2036('0x0'));module[_0x2036('0x1')]={'name':{'type':Sequelize[_0x2036('0x2')]},'description':{'type':Sequelize[_0x2036('0x2')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index 3e64f2d..b1fcf0a 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 _0x68cf=['../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','count','set','apply','reject','then','destroy','stack','name','send','index','map','FreshsalesConfiguration','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','filter','merge','type','VIRTUAL','options','rows','catch','show','length','includeAll','include','find','create','update','body','params','getSubjects','findOne','FreshsalesField','getDescriptions','pick','getFields','nolimit','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0xac151d,_0x4ea1d2){var _0x111dba=function(_0x13d7f4){while(--_0x13d7f4){_0xac151d['push'](_0xac151d['shift']());}};_0x111dba(++_0x4ea1d2);}(_0x68cf,0x129));var _0xf68c=function(_0x1cf980,_0x4177f3){_0x1cf980=_0x1cf980-0x0;var _0x59e3c0=_0x68cf[_0x1cf980];return _0x59e3c0;};'use strict';var emlformat=require(_0xf68c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf68c('0x1'));var jsonpatch=require(_0xf68c('0x2'));var rp=require('request-promise');var moment=require(_0xf68c('0x3'));var BPromise=require(_0xf68c('0x4'));var Mustache=require(_0xf68c('0x5'));var util=require(_0xf68c('0x6'));var path=require('path');var sox=require(_0xf68c('0x7'));var csv=require(_0xf68c('0x8'));var ejs=require(_0xf68c('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf68c('0xa'));var squel=require(_0xf68c('0xb'));var crypto=require(_0xf68c('0xc'));var jsforce=require(_0xf68c('0xd'));var deskjs=require(_0xf68c('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xf68c('0xf'));var Redis=require(_0xf68c('0x10'));var authService=require(_0xf68c('0x11'));var qs=require(_0xf68c('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xf68c('0x13'))(_0xf68c('0x14'));var utils=require(_0xf68c('0x15'));var config=require(_0xf68c('0x16'));var licenseUtil=require(_0xf68c('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3b1fc1,_0x1c52bd){_0x1c52bd=_0x1c52bd||0xcc;return function(_0x4b98c2){if(_0x4b98c2){return _0x3b1fc1[_0xf68c('0x18')](_0x1c52bd);}return _0x3b1fc1[_0xf68c('0x19')](_0x1c52bd)[_0xf68c('0x1a')]();};}function respondWithResult(_0x195487,_0x28fc97){_0x28fc97=_0x28fc97||0xc8;return function(_0x583531){if(_0x583531){return _0x195487[_0xf68c('0x19')](_0x28fc97)[_0xf68c('0x1b')](_0x583531);}};}function respondWithFilteredResult(_0x2d6e97,_0x47d8ca){return function(_0x2abe86){if(_0x2abe86){var _0x16e556=typeof _0x47d8ca[_0xf68c('0x1c')]==='undefined'&&typeof _0x47d8ca[_0xf68c('0x1d')]==='undefined';var _0x363e47=_0x2abe86[_0xf68c('0x1e')];var _0x528ba9=_0x16e556?0x0:_0x47d8ca['offset'];var _0x50cffc=_0x16e556?_0x2abe86[_0xf68c('0x1e')]:_0x47d8ca['offset']+_0x47d8ca[_0xf68c('0x1d')];var _0x4e9db5;if(_0x50cffc>=_0x363e47){_0x50cffc=_0x363e47;_0x4e9db5=0xc8;}else{_0x4e9db5=0xce;}_0x2d6e97['status'](_0x4e9db5);return _0x2d6e97[_0xf68c('0x1f')]('Content-Range',_0x528ba9+'-'+_0x50cffc+'/'+_0x363e47)[_0xf68c('0x1b')](_0x2abe86);}return null;};}function patchUpdates(_0x1801cb){return function(_0x161fcc){try{jsonpatch[_0xf68c('0x20')](_0x161fcc,_0x1801cb,!![]);}catch(_0x29c679){return BPromise[_0xf68c('0x21')](_0x29c679);}return _0x161fcc['save']();};}function saveUpdates(_0xc9ad75,_0x1f679d){return function(_0x41cf1d){if(_0x41cf1d){return _0x41cf1d['update'](_0xc9ad75)[_0xf68c('0x22')](function(_0x550bcf){return _0x550bcf;});}return null;};}function removeEntity(_0x2b3cf0,_0x492832){return function(_0x3ee437){if(_0x3ee437){return _0x3ee437[_0xf68c('0x23')]()['then'](function(){_0x2b3cf0[_0xf68c('0x19')](0xcc)[_0xf68c('0x1a')]();});}};}function handleEntityNotFound(_0x59ce09,_0xbc5d4b){return function(_0x3bf3c6){if(!_0x3bf3c6){_0x59ce09['sendStatus'](0x194);}return _0x3bf3c6;};}function handleError(_0x49c131,_0x2efc46){_0x2efc46=_0x2efc46||0x1f4;return function(_0x2b614c){logger['error'](_0x2b614c[_0xf68c('0x24')]);if(_0x2b614c[_0xf68c('0x25')]){delete _0x2b614c[_0xf68c('0x25')];}_0x49c131[_0xf68c('0x19')](_0x2efc46)[_0xf68c('0x26')](_0x2b614c);};}exports[_0xf68c('0x27')]=function(_0x17911e,_0x382ec3){var _0x4682bf={},_0x7c0af={},_0x428587={'count':0x0,'rows':[]};var _0x3af067=_[_0xf68c('0x28')](db[_0xf68c('0x29')][_0xf68c('0x2a')],function(_0x1f679c){return{'name':_0x1f679c[_0xf68c('0x2b')],'type':_0x1f679c['type'][_0xf68c('0x2c')]};});_0x7c0af[_0xf68c('0x2d')]=_[_0xf68c('0x28')](_0x3af067,_0xf68c('0x25'));_0x7c0af['query']=_[_0xf68c('0x2e')](_0x17911e[_0xf68c('0x2f')]);_0x7c0af[_0xf68c('0x30')]=_[_0xf68c('0x31')](_0x7c0af[_0xf68c('0x2d')],_0x7c0af[_0xf68c('0x2f')]);_0x4682bf[_0xf68c('0x32')]=_['intersection'](_0x7c0af[_0xf68c('0x2d')],qs[_0xf68c('0x33')](_0x17911e['query'][_0xf68c('0x33')]));_0x4682bf[_0xf68c('0x32')]=_0x4682bf[_0xf68c('0x32')]['length']?_0x4682bf['attributes']:_0x7c0af[_0xf68c('0x2d')];if(!_0x17911e[_0xf68c('0x2f')][_0xf68c('0x34')]('nolimit')){_0x4682bf[_0xf68c('0x1d')]=qs[_0xf68c('0x1d')](_0x17911e[_0xf68c('0x2f')][_0xf68c('0x1d')]);_0x4682bf['offset']=qs['offset'](_0x17911e[_0xf68c('0x2f')][_0xf68c('0x1c')]);}_0x4682bf[_0xf68c('0x35')]=qs[_0xf68c('0x36')](_0x17911e[_0xf68c('0x2f')][_0xf68c('0x36')]);_0x4682bf[_0xf68c('0x37')]=qs[_0xf68c('0x30')](_['pick'](_0x17911e[_0xf68c('0x2f')],_0x7c0af[_0xf68c('0x30')]),_0x3af067);if(_0x17911e[_0xf68c('0x2f')][_0xf68c('0x38')]){_0x4682bf[_0xf68c('0x37')]=_[_0xf68c('0x39')](_0x4682bf[_0xf68c('0x37')],{'$or':_[_0xf68c('0x28')](_0x3af067,function(_0x38f15c){if(_0x38f15c[_0xf68c('0x3a')]!==_0xf68c('0x3b')){var _0x4265f7={};_0x4265f7[_0x38f15c[_0xf68c('0x25')]]={'$like':'%'+_0x17911e[_0xf68c('0x2f')]['filter']+'%'};return _0x4265f7;}})});}_0x4682bf=_[_0xf68c('0x39')]({},_0x4682bf,_0x17911e[_0xf68c('0x3c')]);var _0x564d00={'where':_0x4682bf[_0xf68c('0x37')]};return db['FreshsalesConfiguration']['count'](_0x564d00)[_0xf68c('0x22')](function(_0x200441){_0x428587[_0xf68c('0x1e')]=_0x200441;if(_0x17911e[_0xf68c('0x2f')]['includeAll']){_0x4682bf['include']=[{'all':!![]}];}return db['FreshsalesConfiguration']['findAll'](_0x4682bf);})['then'](function(_0x579c5b){_0x428587[_0xf68c('0x3d')]=_0x579c5b;return _0x428587;})[_0xf68c('0x22')](respondWithFilteredResult(_0x382ec3,_0x4682bf))[_0xf68c('0x3e')](handleError(_0x382ec3,null));};exports[_0xf68c('0x3f')]=function(_0x5b0270,_0x46d9ae){var _0x42927a={'raw':![],'where':{'id':_0x5b0270['params']['id']}},_0x508e4a={};_0x508e4a[_0xf68c('0x2d')]=_['keys'](db['FreshsalesConfiguration']['rawAttributes']);_0x508e4a['query']=_['keys'](_0x5b0270['query']);_0x508e4a[_0xf68c('0x30')]=_[_0xf68c('0x31')](_0x508e4a['model'],_0x508e4a['query']);_0x42927a[_0xf68c('0x32')]=_[_0xf68c('0x31')](_0x508e4a[_0xf68c('0x2d')],qs[_0xf68c('0x33')](_0x5b0270[_0xf68c('0x2f')][_0xf68c('0x33')]));_0x42927a[_0xf68c('0x32')]=_0x42927a[_0xf68c('0x32')][_0xf68c('0x40')]?_0x42927a[_0xf68c('0x32')]:_0x508e4a[_0xf68c('0x2d')];if(_0x5b0270[_0xf68c('0x2f')][_0xf68c('0x41')]){_0x42927a[_0xf68c('0x42')]=[{'all':!![]}];}_0x42927a=_[_0xf68c('0x39')]({},_0x42927a,_0x5b0270[_0xf68c('0x3c')]);return db[_0xf68c('0x29')][_0xf68c('0x43')](_0x42927a)[_0xf68c('0x22')](handleEntityNotFound(_0x46d9ae,null))[_0xf68c('0x22')](respondWithResult(_0x46d9ae,null))[_0xf68c('0x3e')](handleError(_0x46d9ae,null));};exports[_0xf68c('0x44')]=function(_0x2b25e9,_0x25c453){return db[_0xf68c('0x29')][_0xf68c('0x44')](_0x2b25e9['body'],{})[_0xf68c('0x22')](respondWithResult(_0x25c453,0xc9))[_0xf68c('0x3e')](handleError(_0x25c453,null));};exports[_0xf68c('0x45')]=function(_0xa76ac9,_0x39b247){if(_0xa76ac9[_0xf68c('0x46')]['id']){delete _0xa76ac9[_0xf68c('0x46')]['id'];}return db[_0xf68c('0x29')][_0xf68c('0x43')]({'where':{'id':_0xa76ac9[_0xf68c('0x47')]['id']}})[_0xf68c('0x22')](handleEntityNotFound(_0x39b247,null))['then'](saveUpdates(_0xa76ac9[_0xf68c('0x46')],null))[_0xf68c('0x22')](respondWithResult(_0x39b247,null))[_0xf68c('0x3e')](handleError(_0x39b247,null));};exports[_0xf68c('0x23')]=function(_0x186155,_0x375005){return db[_0xf68c('0x29')][_0xf68c('0x43')]({'where':{'id':_0x186155[_0xf68c('0x47')]['id']}})[_0xf68c('0x22')](handleEntityNotFound(_0x375005,null))[_0xf68c('0x22')](removeEntity(_0x375005,null))[_0xf68c('0x3e')](handleError(_0x375005,null));};exports[_0xf68c('0x48')]=function(_0x57de17,_0x400b00,_0x2a0269){var _0x3b9d65={};var _0x4f5d9e={};var _0x4298a5;var _0x3774a3;return db[_0xf68c('0x29')][_0xf68c('0x49')]({'where':{'id':_0x57de17[_0xf68c('0x47')]['id']}})['then'](handleEntityNotFound(_0x400b00,null))[_0xf68c('0x22')](function(_0xf6dc67){if(_0xf6dc67){_0x4298a5=_0xf6dc67;_0x4f5d9e[_0xf68c('0x2d')]=_[_0xf68c('0x2e')](db[_0xf68c('0x4a')][_0xf68c('0x2a')]);_0x4f5d9e[_0xf68c('0x2f')]=_[_0xf68c('0x2e')](_0x57de17[_0xf68c('0x2f')]);_0x4f5d9e[_0xf68c('0x30')]=_[_0xf68c('0x31')](_0x4f5d9e[_0xf68c('0x2d')],_0x4f5d9e[_0xf68c('0x2f')]);_0x3b9d65[_0xf68c('0x32')]=_[_0xf68c('0x31')](_0x4f5d9e[_0xf68c('0x2d')],qs['fields'](_0x57de17[_0xf68c('0x2f')][_0xf68c('0x33')]));_0x3b9d65['attributes']=_0x3b9d65[_0xf68c('0x32')][_0xf68c('0x40')]?_0x3b9d65['attributes']:_0x4f5d9e[_0xf68c('0x2d')];_0x3b9d65['order']=qs[_0xf68c('0x36')](_0x57de17[_0xf68c('0x2f')]['sort']);_0x3b9d65['where']=qs[_0xf68c('0x30')](_['pick'](_0x57de17[_0xf68c('0x2f')],_0x4f5d9e[_0xf68c('0x30')]));if(_0x57de17[_0xf68c('0x2f')][_0xf68c('0x38')]){_0x3b9d65[_0xf68c('0x37')]=_['merge'](_0x3b9d65[_0xf68c('0x37')],{'$or':_['map'](_0x3b9d65[_0xf68c('0x32')],function(_0x56f32d){var _0x3ba038={};_0x3ba038[_0x56f32d]={'$like':'%'+_0x57de17[_0xf68c('0x2f')][_0xf68c('0x38')]+'%'};return _0x3ba038;})});}_0x3b9d65=_['merge']({},_0x3b9d65,_0x57de17[_0xf68c('0x3c')]);return _0x4298a5['getSubjects'](_0x3b9d65);}})[_0xf68c('0x22')](function(_0x7501c8){if(_0x7501c8){_0x3774a3=_0x7501c8[_0xf68c('0x40')];if(!_0x57de17[_0xf68c('0x2f')]['hasOwnProperty']('nolimit')){_0x3b9d65['limit']=qs[_0xf68c('0x1d')](_0x57de17['query']['limit']);_0x3b9d65[_0xf68c('0x1c')]=qs[_0xf68c('0x1c')](_0x57de17[_0xf68c('0x2f')]['offset']);}return _0x4298a5['getSubjects'](_0x3b9d65);}})['then'](function(_0x24eaa5){if(_0x24eaa5){return _0x24eaa5?{'count':_0x3774a3,'rows':_0x24eaa5}:null;}})[_0xf68c('0x22')](respondWithResult(_0x400b00,null))[_0xf68c('0x3e')](handleError(_0x400b00,null));};exports[_0xf68c('0x4b')]=function(_0x2ef7d1,_0x41acbb,_0xb71fc7){var _0x2c83d0={};var _0x1f7819={};var _0x226c2d;var _0x5a176f;return db[_0xf68c('0x29')][_0xf68c('0x49')]({'where':{'id':_0x2ef7d1[_0xf68c('0x47')]['id']}})[_0xf68c('0x22')](handleEntityNotFound(_0x41acbb,null))[_0xf68c('0x22')](function(_0x2c4ffe){if(_0x2c4ffe){_0x226c2d=_0x2c4ffe;_0x1f7819[_0xf68c('0x2d')]=_['keys'](db['FreshsalesField'][_0xf68c('0x2a')]);_0x1f7819[_0xf68c('0x2f')]=_[_0xf68c('0x2e')](_0x2ef7d1[_0xf68c('0x2f')]);_0x1f7819['filters']=_[_0xf68c('0x31')](_0x1f7819[_0xf68c('0x2d')],_0x1f7819['query']);_0x2c83d0[_0xf68c('0x32')]=_[_0xf68c('0x31')](_0x1f7819['model'],qs[_0xf68c('0x33')](_0x2ef7d1[_0xf68c('0x2f')]['fields']));_0x2c83d0[_0xf68c('0x32')]=_0x2c83d0['attributes'][_0xf68c('0x40')]?_0x2c83d0[_0xf68c('0x32')]:_0x1f7819[_0xf68c('0x2d')];_0x2c83d0['order']=qs['sort'](_0x2ef7d1[_0xf68c('0x2f')][_0xf68c('0x36')]);_0x2c83d0[_0xf68c('0x37')]=qs[_0xf68c('0x30')](_[_0xf68c('0x4c')](_0x2ef7d1[_0xf68c('0x2f')],_0x1f7819[_0xf68c('0x30')]));if(_0x2ef7d1[_0xf68c('0x2f')][_0xf68c('0x38')]){_0x2c83d0[_0xf68c('0x37')]=_[_0xf68c('0x39')](_0x2c83d0[_0xf68c('0x37')],{'$or':_[_0xf68c('0x28')](_0x2c83d0['attributes'],function(_0x31820c){var _0x283630={};_0x283630[_0x31820c]={'$like':'%'+_0x2ef7d1[_0xf68c('0x2f')][_0xf68c('0x38')]+'%'};return _0x283630;})});}_0x2c83d0=_['merge']({},_0x2c83d0,_0x2ef7d1[_0xf68c('0x3c')]);return _0x226c2d[_0xf68c('0x4b')](_0x2c83d0);}})['then'](function(_0x444688){if(_0x444688){_0x5a176f=_0x444688['length'];if(!_0x2ef7d1[_0xf68c('0x2f')]['hasOwnProperty']('nolimit')){_0x2c83d0[_0xf68c('0x1d')]=qs[_0xf68c('0x1d')](_0x2ef7d1['query'][_0xf68c('0x1d')]);_0x2c83d0[_0xf68c('0x1c')]=qs[_0xf68c('0x1c')](_0x2ef7d1['query'][_0xf68c('0x1c')]);}return _0x226c2d[_0xf68c('0x4b')](_0x2c83d0);}})[_0xf68c('0x22')](function(_0x5e0f94){if(_0x5e0f94){return _0x5e0f94?{'count':_0x5a176f,'rows':_0x5e0f94}:null;}})[_0xf68c('0x22')](respondWithResult(_0x41acbb,null))[_0xf68c('0x3e')](handleError(_0x41acbb,null));};exports[_0xf68c('0x4d')]=function(_0x3f352b,_0x1ba78c,_0x298fd1){var _0x13d8dd={};var _0x269d0d={};var _0x56ab0e;var _0x1ff84c;return db[_0xf68c('0x29')][_0xf68c('0x49')]({'where':{'id':_0x3f352b[_0xf68c('0x47')]['id']}})['then'](handleEntityNotFound(_0x1ba78c,null))[_0xf68c('0x22')](function(_0x2d6931){if(_0x2d6931){_0x56ab0e=_0x2d6931;_0x269d0d[_0xf68c('0x2d')]=_[_0xf68c('0x2e')](db['FreshsalesField'][_0xf68c('0x2a')]);_0x269d0d[_0xf68c('0x2f')]=_[_0xf68c('0x2e')](_0x3f352b['query']);_0x269d0d[_0xf68c('0x30')]=_['intersection'](_0x269d0d['model'],_0x269d0d['query']);_0x13d8dd[_0xf68c('0x32')]=_[_0xf68c('0x31')](_0x269d0d[_0xf68c('0x2d')],qs[_0xf68c('0x33')](_0x3f352b[_0xf68c('0x2f')][_0xf68c('0x33')]));_0x13d8dd[_0xf68c('0x32')]=_0x13d8dd['attributes']['length']?_0x13d8dd[_0xf68c('0x32')]:_0x269d0d[_0xf68c('0x2d')];_0x13d8dd['order']=qs['sort'](_0x3f352b[_0xf68c('0x2f')][_0xf68c('0x36')]);_0x13d8dd[_0xf68c('0x37')]=qs[_0xf68c('0x30')](_[_0xf68c('0x4c')](_0x3f352b['query'],_0x269d0d[_0xf68c('0x30')]));if(_0x3f352b[_0xf68c('0x2f')][_0xf68c('0x38')]){_0x13d8dd[_0xf68c('0x37')]=_['merge'](_0x13d8dd[_0xf68c('0x37')],{'$or':_[_0xf68c('0x28')](_0x13d8dd['attributes'],function(_0x21b4dc){var _0x245b50={};_0x245b50[_0x21b4dc]={'$like':'%'+_0x3f352b[_0xf68c('0x2f')]['filter']+'%'};return _0x245b50;})});}_0x13d8dd=_[_0xf68c('0x39')]({},_0x13d8dd,_0x3f352b['options']);return _0x56ab0e['getFields'](_0x13d8dd);}})['then'](function(_0x51b0a8){if(_0x51b0a8){_0x1ff84c=_0x51b0a8['length'];if(!_0x3f352b['query']['hasOwnProperty'](_0xf68c('0x4e'))){_0x13d8dd['limit']=qs[_0xf68c('0x1d')](_0x3f352b[_0xf68c('0x2f')]['limit']);_0x13d8dd[_0xf68c('0x1c')]=qs[_0xf68c('0x1c')](_0x3f352b[_0xf68c('0x2f')][_0xf68c('0x1c')]);}return _0x56ab0e['getFields'](_0x13d8dd);}})['then'](function(_0x395459){if(_0x395459){return _0x395459?{'count':_0x1ff84c,'rows':_0x395459}:null;}})[_0xf68c('0x22')](respondWithResult(_0x1ba78c,null))[_0xf68c('0x3e')](handleError(_0x1ba78c,null));}; \ No newline at end of file +var _0x5e0e=['offset','undefined','count','set','Content-Range','apply','reject','save','then','destroy','stack','name','send','index','map','FreshsalesConfiguration','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','limit','sort','where','pick','filters','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','rawAttributes','find','create','body','params','getSubjects','findOne','FreshsalesField','order','nolimit','getDescriptions','getFields','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','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','end','json'];(function(_0x421446,_0x19af26){var _0x40e2a6=function(_0x254616){while(--_0x254616){_0x421446['push'](_0x421446['shift']());}};_0x40e2a6(++_0x19af26);}(_0x5e0e,0x89));var _0xe5e0=function(_0x21a173,_0x1f6b9a){_0x21a173=_0x21a173-0x0;var _0x244d96=_0x5e0e[_0x21a173];return _0x244d96;};'use strict';var emlformat=require(_0xe5e0('0x0'));var rimraf=require(_0xe5e0('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe5e0('0x2'));var rp=require(_0xe5e0('0x3'));var moment=require(_0xe5e0('0x4'));var BPromise=require(_0xe5e0('0x5'));var Mustache=require(_0xe5e0('0x6'));var util=require('util');var path=require(_0xe5e0('0x7'));var sox=require('sox');var csv=require(_0xe5e0('0x8'));var ejs=require(_0xe5e0('0x9'));var fs=require('fs');var fs_extra=require(_0xe5e0('0xa'));var _=require(_0xe5e0('0xb'));var squel=require(_0xe5e0('0xc'));var crypto=require(_0xe5e0('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xe5e0('0xe'));var toCsv=require(_0xe5e0('0x8'));var querystring=require('querystring');var Papa=require(_0xe5e0('0xf'));var Redis=require(_0xe5e0('0x10'));var authService=require(_0xe5e0('0x11'));var qs=require(_0xe5e0('0x12'));var as=require(_0xe5e0('0x13'));var hardwareService=require(_0xe5e0('0x14'));var logger=require(_0xe5e0('0x15'))(_0xe5e0('0x16'));var utils=require(_0xe5e0('0x17'));var config=require(_0xe5e0('0x18'));var licenseUtil=require(_0xe5e0('0x19'));var db=require(_0xe5e0('0x1a'))['db'];function respondWithStatusCode(_0x25fd2,_0x529189){_0x529189=_0x529189||0xcc;return function(_0x5cabeb){if(_0x5cabeb){return _0x25fd2[_0xe5e0('0x1b')](_0x529189);}return _0x25fd2[_0xe5e0('0x1c')](_0x529189)[_0xe5e0('0x1d')]();};}function respondWithResult(_0x3baab3,_0x5e3a4d){_0x5e3a4d=_0x5e3a4d||0xc8;return function(_0x14043b){if(_0x14043b){return _0x3baab3[_0xe5e0('0x1c')](_0x5e3a4d)[_0xe5e0('0x1e')](_0x14043b);}};}function respondWithFilteredResult(_0x153860,_0x21db75){return function(_0x309b84){if(_0x309b84){var _0x1fe911=typeof _0x21db75[_0xe5e0('0x1f')]===_0xe5e0('0x20')&&typeof _0x21db75['limit']===_0xe5e0('0x20');var _0x57de88=_0x309b84[_0xe5e0('0x21')];var _0x4e7353=_0x1fe911?0x0:_0x21db75[_0xe5e0('0x1f')];var _0x150c3a=_0x1fe911?_0x309b84['count']:_0x21db75[_0xe5e0('0x1f')]+_0x21db75['limit'];var _0xa81bd4;if(_0x150c3a>=_0x57de88){_0x150c3a=_0x57de88;_0xa81bd4=0xc8;}else{_0xa81bd4=0xce;}_0x153860[_0xe5e0('0x1c')](_0xa81bd4);return _0x153860[_0xe5e0('0x22')](_0xe5e0('0x23'),_0x4e7353+'-'+_0x150c3a+'/'+_0x57de88)[_0xe5e0('0x1e')](_0x309b84);}return null;};}function patchUpdates(_0x10d6aa){return function(_0x2b422d){try{jsonpatch[_0xe5e0('0x24')](_0x2b422d,_0x10d6aa,!![]);}catch(_0x10a195){return BPromise[_0xe5e0('0x25')](_0x10a195);}return _0x2b422d[_0xe5e0('0x26')]();};}function saveUpdates(_0x2de764,_0x331ae1){return function(_0x4cd0ca){if(_0x4cd0ca){return _0x4cd0ca['update'](_0x2de764)[_0xe5e0('0x27')](function(_0x228368){return _0x228368;});}return null;};}function removeEntity(_0x1db371,_0x62f2be){return function(_0x3596ca){if(_0x3596ca){return _0x3596ca[_0xe5e0('0x28')]()[_0xe5e0('0x27')](function(){_0x1db371['status'](0xcc)[_0xe5e0('0x1d')]();});}};}function handleEntityNotFound(_0x5df2be,_0x332c4e){return function(_0x6f21de){if(!_0x6f21de){_0x5df2be[_0xe5e0('0x1b')](0x194);}return _0x6f21de;};}function handleError(_0x478078,_0x32d39a){_0x32d39a=_0x32d39a||0x1f4;return function(_0x4867f2){logger['error'](_0x4867f2[_0xe5e0('0x29')]);if(_0x4867f2['name']){delete _0x4867f2[_0xe5e0('0x2a')];}_0x478078[_0xe5e0('0x1c')](_0x32d39a)[_0xe5e0('0x2b')](_0x4867f2);};}exports[_0xe5e0('0x2c')]=function(_0x462b3b,_0x198b94){var _0x5ad4ad={},_0x398df7={},_0x57a362={'count':0x0,'rows':[]};var _0x3b80f0=_[_0xe5e0('0x2d')](db[_0xe5e0('0x2e')]['rawAttributes'],function(_0x1d7cb4){return{'name':_0x1d7cb4[_0xe5e0('0x2f')],'type':_0x1d7cb4[_0xe5e0('0x30')][_0xe5e0('0x31')]};});_0x398df7[_0xe5e0('0x32')]=_['map'](_0x3b80f0,_0xe5e0('0x2a'));_0x398df7[_0xe5e0('0x33')]=_[_0xe5e0('0x34')](_0x462b3b[_0xe5e0('0x33')]);_0x398df7['filters']=_[_0xe5e0('0x35')](_0x398df7[_0xe5e0('0x32')],_0x398df7[_0xe5e0('0x33')]);_0x5ad4ad[_0xe5e0('0x36')]=_[_0xe5e0('0x35')](_0x398df7[_0xe5e0('0x32')],qs[_0xe5e0('0x37')](_0x462b3b[_0xe5e0('0x33')][_0xe5e0('0x37')]));_0x5ad4ad[_0xe5e0('0x36')]=_0x5ad4ad[_0xe5e0('0x36')][_0xe5e0('0x38')]?_0x5ad4ad[_0xe5e0('0x36')]:_0x398df7[_0xe5e0('0x32')];if(!_0x462b3b[_0xe5e0('0x33')][_0xe5e0('0x39')]('nolimit')){_0x5ad4ad['limit']=qs[_0xe5e0('0x3a')](_0x462b3b[_0xe5e0('0x33')][_0xe5e0('0x3a')]);_0x5ad4ad['offset']=qs[_0xe5e0('0x1f')](_0x462b3b[_0xe5e0('0x33')][_0xe5e0('0x1f')]);}_0x5ad4ad['order']=qs[_0xe5e0('0x3b')](_0x462b3b[_0xe5e0('0x33')][_0xe5e0('0x3b')]);_0x5ad4ad[_0xe5e0('0x3c')]=qs['filters'](_[_0xe5e0('0x3d')](_0x462b3b['query'],_0x398df7[_0xe5e0('0x3e')]),_0x3b80f0);if(_0x462b3b['query'][_0xe5e0('0x3f')]){_0x5ad4ad['where']=_[_0xe5e0('0x40')](_0x5ad4ad[_0xe5e0('0x3c')],{'$or':_['map'](_0x3b80f0,function(_0x2c6b9c){if(_0x2c6b9c[_0xe5e0('0x30')]!==_0xe5e0('0x41')){var _0x10ad9b={};_0x10ad9b[_0x2c6b9c[_0xe5e0('0x2a')]]={'$like':'%'+_0x462b3b[_0xe5e0('0x33')][_0xe5e0('0x3f')]+'%'};return _0x10ad9b;}})});}_0x5ad4ad=_[_0xe5e0('0x40')]({},_0x5ad4ad,_0x462b3b[_0xe5e0('0x42')]);var _0x1e7711={'where':_0x5ad4ad[_0xe5e0('0x3c')]};return db['FreshsalesConfiguration'][_0xe5e0('0x21')](_0x1e7711)[_0xe5e0('0x27')](function(_0x2a585f){_0x57a362[_0xe5e0('0x21')]=_0x2a585f;if(_0x462b3b[_0xe5e0('0x33')]['includeAll']){_0x5ad4ad[_0xe5e0('0x43')]=[{'all':!![]}];}return db[_0xe5e0('0x2e')][_0xe5e0('0x44')](_0x5ad4ad);})[_0xe5e0('0x27')](function(_0x4e7ed5){_0x57a362[_0xe5e0('0x45')]=_0x4e7ed5;return _0x57a362;})[_0xe5e0('0x27')](respondWithFilteredResult(_0x198b94,_0x5ad4ad))[_0xe5e0('0x46')](handleError(_0x198b94,null));};exports[_0xe5e0('0x47')]=function(_0x157089,_0x47dcd4){var _0x353749={'raw':![],'where':{'id':_0x157089['params']['id']}},_0x5484fe={};_0x5484fe[_0xe5e0('0x32')]=_[_0xe5e0('0x34')](db[_0xe5e0('0x2e')][_0xe5e0('0x48')]);_0x5484fe[_0xe5e0('0x33')]=_['keys'](_0x157089[_0xe5e0('0x33')]);_0x5484fe[_0xe5e0('0x3e')]=_['intersection'](_0x5484fe['model'],_0x5484fe[_0xe5e0('0x33')]);_0x353749[_0xe5e0('0x36')]=_[_0xe5e0('0x35')](_0x5484fe[_0xe5e0('0x32')],qs[_0xe5e0('0x37')](_0x157089['query'][_0xe5e0('0x37')]));_0x353749[_0xe5e0('0x36')]=_0x353749[_0xe5e0('0x36')]['length']?_0x353749[_0xe5e0('0x36')]:_0x5484fe[_0xe5e0('0x32')];if(_0x157089[_0xe5e0('0x33')]['includeAll']){_0x353749['include']=[{'all':!![]}];}_0x353749=_[_0xe5e0('0x40')]({},_0x353749,_0x157089['options']);return db[_0xe5e0('0x2e')][_0xe5e0('0x49')](_0x353749)[_0xe5e0('0x27')](handleEntityNotFound(_0x47dcd4,null))[_0xe5e0('0x27')](respondWithResult(_0x47dcd4,null))[_0xe5e0('0x46')](handleError(_0x47dcd4,null));};exports[_0xe5e0('0x4a')]=function(_0x38fd91,_0x87972d){return db['FreshsalesConfiguration']['create'](_0x38fd91['body'],{})[_0xe5e0('0x27')](respondWithResult(_0x87972d,0xc9))['catch'](handleError(_0x87972d,null));};exports['update']=function(_0x596d11,_0x577d92){if(_0x596d11['body']['id']){delete _0x596d11[_0xe5e0('0x4b')]['id'];}return db['FreshsalesConfiguration'][_0xe5e0('0x49')]({'where':{'id':_0x596d11['params']['id']}})['then'](handleEntityNotFound(_0x577d92,null))[_0xe5e0('0x27')](saveUpdates(_0x596d11[_0xe5e0('0x4b')],null))['then'](respondWithResult(_0x577d92,null))['catch'](handleError(_0x577d92,null));};exports['destroy']=function(_0x17f89a,_0x1096c7){return db[_0xe5e0('0x2e')][_0xe5e0('0x49')]({'where':{'id':_0x17f89a[_0xe5e0('0x4c')]['id']}})[_0xe5e0('0x27')](handleEntityNotFound(_0x1096c7,null))[_0xe5e0('0x27')](removeEntity(_0x1096c7,null))['catch'](handleError(_0x1096c7,null));};exports[_0xe5e0('0x4d')]=function(_0x1354c1,_0x4ba674,_0xd4c85e){var _0x296862={};var _0x4f07c1={};var _0x2eadd3;var _0x38f1e9;return db[_0xe5e0('0x2e')][_0xe5e0('0x4e')]({'where':{'id':_0x1354c1[_0xe5e0('0x4c')]['id']}})[_0xe5e0('0x27')](handleEntityNotFound(_0x4ba674,null))['then'](function(_0x207b2b){if(_0x207b2b){_0x2eadd3=_0x207b2b;_0x4f07c1[_0xe5e0('0x32')]=_[_0xe5e0('0x34')](db[_0xe5e0('0x4f')][_0xe5e0('0x48')]);_0x4f07c1['query']=_[_0xe5e0('0x34')](_0x1354c1[_0xe5e0('0x33')]);_0x4f07c1['filters']=_[_0xe5e0('0x35')](_0x4f07c1[_0xe5e0('0x32')],_0x4f07c1[_0xe5e0('0x33')]);_0x296862[_0xe5e0('0x36')]=_[_0xe5e0('0x35')](_0x4f07c1[_0xe5e0('0x32')],qs[_0xe5e0('0x37')](_0x1354c1[_0xe5e0('0x33')][_0xe5e0('0x37')]));_0x296862[_0xe5e0('0x36')]=_0x296862['attributes'][_0xe5e0('0x38')]?_0x296862[_0xe5e0('0x36')]:_0x4f07c1['model'];_0x296862[_0xe5e0('0x50')]=qs[_0xe5e0('0x3b')](_0x1354c1[_0xe5e0('0x33')][_0xe5e0('0x3b')]);_0x296862[_0xe5e0('0x3c')]=qs[_0xe5e0('0x3e')](_[_0xe5e0('0x3d')](_0x1354c1[_0xe5e0('0x33')],_0x4f07c1[_0xe5e0('0x3e')]));if(_0x1354c1[_0xe5e0('0x33')][_0xe5e0('0x3f')]){_0x296862[_0xe5e0('0x3c')]=_[_0xe5e0('0x40')](_0x296862[_0xe5e0('0x3c')],{'$or':_[_0xe5e0('0x2d')](_0x296862[_0xe5e0('0x36')],function(_0x429d0f){var _0x47adbc={};_0x47adbc[_0x429d0f]={'$like':'%'+_0x1354c1[_0xe5e0('0x33')][_0xe5e0('0x3f')]+'%'};return _0x47adbc;})});}_0x296862=_[_0xe5e0('0x40')]({},_0x296862,_0x1354c1['options']);return _0x2eadd3[_0xe5e0('0x4d')](_0x296862);}})[_0xe5e0('0x27')](function(_0x260f0c){if(_0x260f0c){_0x38f1e9=_0x260f0c[_0xe5e0('0x38')];if(!_0x1354c1[_0xe5e0('0x33')][_0xe5e0('0x39')](_0xe5e0('0x51'))){_0x296862[_0xe5e0('0x3a')]=qs[_0xe5e0('0x3a')](_0x1354c1[_0xe5e0('0x33')][_0xe5e0('0x3a')]);_0x296862['offset']=qs[_0xe5e0('0x1f')](_0x1354c1[_0xe5e0('0x33')][_0xe5e0('0x1f')]);}return _0x2eadd3[_0xe5e0('0x4d')](_0x296862);}})[_0xe5e0('0x27')](function(_0x5b15fc){if(_0x5b15fc){return _0x5b15fc?{'count':_0x38f1e9,'rows':_0x5b15fc}:null;}})[_0xe5e0('0x27')](respondWithResult(_0x4ba674,null))['catch'](handleError(_0x4ba674,null));};exports[_0xe5e0('0x52')]=function(_0x1b47f1,_0x50fb0c,_0x40bec4){var _0x34998d={};var _0x596990={};var _0x14431a;var _0x312293;return db[_0xe5e0('0x2e')][_0xe5e0('0x4e')]({'where':{'id':_0x1b47f1[_0xe5e0('0x4c')]['id']}})['then'](handleEntityNotFound(_0x50fb0c,null))[_0xe5e0('0x27')](function(_0x4eac9a){if(_0x4eac9a){_0x14431a=_0x4eac9a;_0x596990[_0xe5e0('0x32')]=_['keys'](db[_0xe5e0('0x4f')][_0xe5e0('0x48')]);_0x596990[_0xe5e0('0x33')]=_[_0xe5e0('0x34')](_0x1b47f1[_0xe5e0('0x33')]);_0x596990[_0xe5e0('0x3e')]=_[_0xe5e0('0x35')](_0x596990[_0xe5e0('0x32')],_0x596990['query']);_0x34998d[_0xe5e0('0x36')]=_[_0xe5e0('0x35')](_0x596990[_0xe5e0('0x32')],qs['fields'](_0x1b47f1[_0xe5e0('0x33')][_0xe5e0('0x37')]));_0x34998d[_0xe5e0('0x36')]=_0x34998d['attributes']['length']?_0x34998d[_0xe5e0('0x36')]:_0x596990[_0xe5e0('0x32')];_0x34998d[_0xe5e0('0x50')]=qs[_0xe5e0('0x3b')](_0x1b47f1['query'][_0xe5e0('0x3b')]);_0x34998d['where']=qs['filters'](_['pick'](_0x1b47f1[_0xe5e0('0x33')],_0x596990[_0xe5e0('0x3e')]));if(_0x1b47f1['query'][_0xe5e0('0x3f')]){_0x34998d[_0xe5e0('0x3c')]=_[_0xe5e0('0x40')](_0x34998d[_0xe5e0('0x3c')],{'$or':_[_0xe5e0('0x2d')](_0x34998d[_0xe5e0('0x36')],function(_0x1e3281){var _0x105b24={};_0x105b24[_0x1e3281]={'$like':'%'+_0x1b47f1['query'][_0xe5e0('0x3f')]+'%'};return _0x105b24;})});}_0x34998d=_[_0xe5e0('0x40')]({},_0x34998d,_0x1b47f1[_0xe5e0('0x42')]);return _0x14431a['getDescriptions'](_0x34998d);}})[_0xe5e0('0x27')](function(_0xb30b78){if(_0xb30b78){_0x312293=_0xb30b78['length'];if(!_0x1b47f1['query']['hasOwnProperty'](_0xe5e0('0x51'))){_0x34998d[_0xe5e0('0x3a')]=qs[_0xe5e0('0x3a')](_0x1b47f1[_0xe5e0('0x33')][_0xe5e0('0x3a')]);_0x34998d[_0xe5e0('0x1f')]=qs[_0xe5e0('0x1f')](_0x1b47f1[_0xe5e0('0x33')]['offset']);}return _0x14431a['getDescriptions'](_0x34998d);}})[_0xe5e0('0x27')](function(_0x5a471d){if(_0x5a471d){return _0x5a471d?{'count':_0x312293,'rows':_0x5a471d}:null;}})['then'](respondWithResult(_0x50fb0c,null))['catch'](handleError(_0x50fb0c,null));};exports['getFields']=function(_0x4e99b7,_0x1abad4,_0x5404de){var _0x348cee={};var _0x2cb38f={};var _0x2babf1;var _0x5bbc6b;return db[_0xe5e0('0x2e')][_0xe5e0('0x4e')]({'where':{'id':_0x4e99b7[_0xe5e0('0x4c')]['id']}})['then'](handleEntityNotFound(_0x1abad4,null))[_0xe5e0('0x27')](function(_0x16c2ce){if(_0x16c2ce){_0x2babf1=_0x16c2ce;_0x2cb38f[_0xe5e0('0x32')]=_[_0xe5e0('0x34')](db['FreshsalesField'][_0xe5e0('0x48')]);_0x2cb38f[_0xe5e0('0x33')]=_[_0xe5e0('0x34')](_0x4e99b7['query']);_0x2cb38f[_0xe5e0('0x3e')]=_[_0xe5e0('0x35')](_0x2cb38f[_0xe5e0('0x32')],_0x2cb38f[_0xe5e0('0x33')]);_0x348cee[_0xe5e0('0x36')]=_['intersection'](_0x2cb38f[_0xe5e0('0x32')],qs['fields'](_0x4e99b7[_0xe5e0('0x33')][_0xe5e0('0x37')]));_0x348cee[_0xe5e0('0x36')]=_0x348cee['attributes']['length']?_0x348cee[_0xe5e0('0x36')]:_0x2cb38f['model'];_0x348cee[_0xe5e0('0x50')]=qs['sort'](_0x4e99b7[_0xe5e0('0x33')][_0xe5e0('0x3b')]);_0x348cee[_0xe5e0('0x3c')]=qs[_0xe5e0('0x3e')](_[_0xe5e0('0x3d')](_0x4e99b7['query'],_0x2cb38f[_0xe5e0('0x3e')]));if(_0x4e99b7[_0xe5e0('0x33')]['filter']){_0x348cee[_0xe5e0('0x3c')]=_[_0xe5e0('0x40')](_0x348cee[_0xe5e0('0x3c')],{'$or':_['map'](_0x348cee['attributes'],function(_0x348d94){var _0x2b23da={};_0x2b23da[_0x348d94]={'$like':'%'+_0x4e99b7[_0xe5e0('0x33')][_0xe5e0('0x3f')]+'%'};return _0x2b23da;})});}_0x348cee=_[_0xe5e0('0x40')]({},_0x348cee,_0x4e99b7[_0xe5e0('0x42')]);return _0x2babf1[_0xe5e0('0x53')](_0x348cee);}})[_0xe5e0('0x27')](function(_0x521be7){if(_0x521be7){_0x5bbc6b=_0x521be7[_0xe5e0('0x38')];if(!_0x4e99b7['query'][_0xe5e0('0x39')]('nolimit')){_0x348cee['limit']=qs[_0xe5e0('0x3a')](_0x4e99b7[_0xe5e0('0x33')][_0xe5e0('0x3a')]);_0x348cee[_0xe5e0('0x1f')]=qs['offset'](_0x4e99b7[_0xe5e0('0x33')][_0xe5e0('0x1f')]);}return _0x2babf1['getFields'](_0x348cee);}})[_0xe5e0('0x27')](function(_0x4f8b7f){if(_0x4f8b7f){return _0x4f8b7f?{'count':_0x5bbc6b,'rows':_0x4f8b7f}:null;}})[_0xe5e0('0x27')](respondWithResult(_0x1abad4,null))[_0xe5e0('0x46')](handleError(_0x1abad4,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index a00a7e4..3a7627e 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 _0x49d5=['define','int_freshsales_configurations','lodash','../../config/logger','request-promise','path','rimraf','../../config/environment','./intFreshsalesConfiguration.attributes'];(function(_0x5c3c0b,_0x4ee35e){var _0x52ecd2=function(_0x3cf575){while(--_0x3cf575){_0x5c3c0b['push'](_0x5c3c0b['shift']());}};_0x52ecd2(++_0x4ee35e);}(_0x49d5,0x9b));var _0x549d=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0x49d5[_0x311c35];return _0x5cc50c;};'use strict';var _=require(_0x549d('0x0'));var util=require('util');var logger=require(_0x549d('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x549d('0x2'));var fs=require('fs');var path=require(_0x549d('0x3'));var rimraf=require(_0x549d('0x4'));var config=require(_0x549d('0x5'));var attributes=require(_0x549d('0x6'));module['exports']=function(_0xaa9cff,_0x5c99e1){return _0xaa9cff[_0x549d('0x7')]('FreshsalesConfiguration',attributes,{'tableName':_0x549d('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7f3a=['int_freshsales_configurations','lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./intFreshsalesConfiguration.attributes','exports','define','FreshsalesConfiguration'];(function(_0x3c51cf,_0x3924f6){var _0x23e61a=function(_0x415691){while(--_0x415691){_0x3c51cf['push'](_0x3c51cf['shift']());}};_0x23e61a(++_0x3924f6);}(_0x7f3a,0xf8));var _0xa7f3=function(_0x3c5d42,_0x49ecb7){_0x3c5d42=_0x3c5d42-0x0;var _0x5802e5=_0x7f3a[_0x3c5d42];return _0x5802e5;};'use strict';var _=require(_0xa7f3('0x0'));var util=require('util');var logger=require(_0xa7f3('0x1'))(_0xa7f3('0x2'));var moment=require(_0xa7f3('0x3'));var BPromise=require(_0xa7f3('0x4'));var rp=require(_0xa7f3('0x5'));var fs=require('fs');var path=require(_0xa7f3('0x6'));var rimraf=require('rimraf');var config=require(_0xa7f3('0x7'));var attributes=require(_0xa7f3('0x8'));module[_0xa7f3('0x9')]=function(_0xd21808,_0x40bc5d){return _0xd21808[_0xa7f3('0xa')](_0xa7f3('0xb'),attributes,{'tableName':_0xa7f3('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.rpc.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.rpc.js index d17c5bb..17ee6b6 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 _0xb728=['info','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','FreshsalesConfiguration,\x20%s,\x20%s','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message'];(function(_0x151381,_0x97b314){var _0x2afab6=function(_0x4b3941){while(--_0x4b3941){_0x151381['push'](_0x151381['shift']());}};_0x2afab6(++_0x97b314);}(_0xb728,0x14d));var _0x8b72=function(_0x52b4f2,_0x5b1a64){_0x52b4f2=_0x52b4f2-0x0;var _0x1e07eb=_0xb728[_0x52b4f2];return _0x1e07eb;};'use strict';var _=require(_0x8b72('0x0'));var util=require(_0x8b72('0x1'));var moment=require(_0x8b72('0x2'));var BPromise=require(_0x8b72('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8b72('0x4'));var db=require(_0x8b72('0x5'))['db'];var utils=require(_0x8b72('0x6'));var logger=require('../../config/logger')(_0x8b72('0x7'));var config=require(_0x8b72('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x8b72('0x9')][_0x8b72('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4f402a,_0x34edd1,_0xc67b71){return new BPromise(function(_0x450aee,_0x2e1d98){return client[_0x8b72('0xb')](_0x4f402a,_0xc67b71)['then'](function(_0x228669){logger['info'](_0x8b72('0xc'),_0x34edd1,'request\x20sent');logger['debug'](_0x8b72('0xd'),_0x34edd1,_0x8b72('0xe'),JSON[_0x8b72('0xf')](_0x228669));if(_0x228669[_0x8b72('0x10')]){if(_0x228669['error'][_0x8b72('0x11')]===0x1f4){logger[_0x8b72('0x10')](_0x8b72('0xc'),_0x34edd1,_0x228669['error']['message']);return _0x2e1d98(_0x228669[_0x8b72('0x10')][_0x8b72('0x12')]);}logger['error']('FreshsalesConfiguration,\x20%s,\x20%s',_0x34edd1,_0x228669[_0x8b72('0x10')][_0x8b72('0x12')]);return _0x450aee(_0x228669[_0x8b72('0x10')][_0x8b72('0x12')]);}else{logger[_0x8b72('0x13')](_0x8b72('0xc'),_0x34edd1,'request\x20sent');_0x450aee(_0x228669[_0x8b72('0x14')][_0x8b72('0x12')]);}})[_0x8b72('0x15')](function(_0x581c46){logger[_0x8b72('0x10')](_0x8b72('0xc'),_0x34edd1,_0x581c46);_0x2e1d98(_0x581c46);});});} \ No newline at end of file +var _0x73b1=['bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','client','http','info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment'];(function(_0x1831ac,_0x31bae8){var _0x311ddd=function(_0x30ff52){while(--_0x30ff52){_0x1831ac['push'](_0x1831ac['shift']());}};_0x311ddd(++_0x31bae8);}(_0x73b1,0x9d));var _0x173b=function(_0x3546a6,_0x239442){_0x3546a6=_0x3546a6-0x0;var _0x52594c=_0x73b1[_0x3546a6];return _0x52594c;};'use strict';var _=require(_0x173b('0x0'));var util=require(_0x173b('0x1'));var moment=require(_0x173b('0x2'));var BPromise=require(_0x173b('0x3'));var rs=require(_0x173b('0x4'));var fs=require('fs');var Redis=require(_0x173b('0x5'));var db=require(_0x173b('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x173b('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x173b('0x8')][_0x173b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2b840b,_0x4019e5,_0x477a23){return new BPromise(function(_0x3bfb5d,_0xc4b221){return client['request'](_0x2b840b,_0x477a23)['then'](function(_0x5cbcc2){logger[_0x173b('0xa')](_0x173b('0xb'),_0x4019e5,_0x173b('0xc'));logger[_0x173b('0xd')](_0x173b('0xe'),_0x4019e5,_0x173b('0xc'),JSON[_0x173b('0xf')](_0x5cbcc2));if(_0x5cbcc2[_0x173b('0x10')]){if(_0x5cbcc2['error']['code']===0x1f4){logger['error'](_0x173b('0xb'),_0x4019e5,_0x5cbcc2[_0x173b('0x10')][_0x173b('0x11')]);return _0xc4b221(_0x5cbcc2['error'][_0x173b('0x11')]);}logger['error'](_0x173b('0xb'),_0x4019e5,_0x5cbcc2['error'][_0x173b('0x11')]);return _0x3bfb5d(_0x5cbcc2[_0x173b('0x10')][_0x173b('0x11')]);}else{logger[_0x173b('0xa')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x4019e5,_0x173b('0xc'));_0x3bfb5d(_0x5cbcc2[_0x173b('0x12')][_0x173b('0x11')]);}})[_0x173b('0x13')](function(_0x154948){logger[_0x173b('0x10')](_0x173b('0xb'),_0x4019e5,_0x154948);_0xc4b221(_0x154948);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index 7cef9fa..d2e73e9 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 _0x6364=['isAuthenticated','index','/:id','show','post','create','update','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x6364,0x8f));var _0x4636=function(_0x507e43,_0x40ad84){_0x507e43=_0x507e43-0x0;var _0x5e5df6=_0x6364[_0x507e43];return _0x5e5df6;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x4636('0x0'));var timeout=require(_0x4636('0x1'));var express=require(_0x4636('0x2'));var router=express[_0x4636('0x3')]();var fs_extra=require(_0x4636('0x4'));var auth=require(_0x4636('0x5'));var interaction=require(_0x4636('0x6'));var config=require(_0x4636('0x7'));var controller=require('./intFreshsalesField.controller');router[_0x4636('0x8')]('/',auth[_0x4636('0x9')](),controller[_0x4636('0xa')]);router[_0x4636('0x8')](_0x4636('0xb'),auth['isAuthenticated'](),controller[_0x4636('0xc')]);router[_0x4636('0xd')]('/',auth[_0x4636('0x9')](),controller[_0x4636('0xe')]);router['put'](_0x4636('0xb'),auth[_0x4636('0x9')](),controller[_0x4636('0xf')]);router[_0x4636('0x10')](_0x4636('0xb'),auth['isAuthenticated'](),controller[_0x4636('0x11')]);module[_0x4636('0x12')]=router; \ No newline at end of file +var _0xe14d=['../../components/interaction/service','../../config/environment','./intFreshsalesField.controller','get','isAuthenticated','index','show','post','create','put','/:id','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra'];(function(_0x3d27ba,_0x2671a3){var _0xf01885=function(_0x311f5c){while(--_0x311f5c){_0x3d27ba['push'](_0x3d27ba['shift']());}};_0xf01885(++_0x2671a3);}(_0xe14d,0x1ee));var _0xde14=function(_0x10004e,_0xd701e6){_0x10004e=_0x10004e-0x0;var _0x5af990=_0xe14d[_0x10004e];return _0x5af990;};'use strict';var multer=require(_0xde14('0x0'));var util=require(_0xde14('0x1'));var path=require(_0xde14('0x2'));var timeout=require(_0xde14('0x3'));var express=require('express');var router=express[_0xde14('0x4')]();var fs_extra=require(_0xde14('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xde14('0x6'));var config=require(_0xde14('0x7'));var controller=require(_0xde14('0x8'));router[_0xde14('0x9')]('/',auth[_0xde14('0xa')](),controller[_0xde14('0xb')]);router['get']('/:id',auth[_0xde14('0xa')](),controller[_0xde14('0xc')]);router[_0xde14('0xd')]('/',auth[_0xde14('0xa')](),controller[_0xde14('0xe')]);router[_0xde14('0xf')](_0xde14('0x10'),auth[_0xde14('0xa')](),controller['update']);router[_0xde14('0x11')](_0xde14('0x10'),auth[_0xde14('0xa')](),controller[_0xde14('0x12')]);module[_0xde14('0x13')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.attributes.js b/server/api/intFreshsalesField/intFreshsalesField.attributes.js index 53a8786..e3a5535 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 _0xaf4c=['customVariable','keyValue','picklist','STRING','BOOLEAN','sequelize','exports','ENUM','string','variable'];(function(_0x26c967,_0x2f12e7){var _0x1e1944=function(_0x183bd3){while(--_0x183bd3){_0x26c967['push'](_0x26c967['shift']());}};_0x1e1944(++_0x2f12e7);}(_0xaf4c,0x14f));var _0xcaf4=function(_0x31d61f,_0x1fe64d){_0x31d61f=_0x31d61f-0x0;var _0x19d3ff=_0xaf4c[_0x31d61f];return _0x19d3ff;};'use strict';var Sequelize=require(_0xcaf4('0x0'));module[_0xcaf4('0x1')]={'type':{'type':Sequelize[_0xcaf4('0x2')](_0xcaf4('0x3'),_0xcaf4('0x4'),_0xcaf4('0x5'),_0xcaf4('0x6'),_0xcaf4('0x7')),'defaultValue':_0xcaf4('0x3')},'content':{'type':Sequelize[_0xcaf4('0x8')]},'key':{'type':Sequelize[_0xcaf4('0x8')]},'keyType':{'type':Sequelize[_0xcaf4('0x2')](_0xcaf4('0x3'),_0xcaf4('0x4'),'customVariable')},'keyContent':{'type':Sequelize[_0xcaf4('0x8')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xcaf4('0x8')]},'customField':{'type':Sequelize[_0xcaf4('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xcaf4('0x8')]}}; \ No newline at end of file +var _0x41e1=['sequelize','exports','ENUM','picklist','string','STRING','variable','customVariable'];(function(_0xf64789,_0x55bdfa){var _0x3622f1=function(_0x799d4f){while(--_0x799d4f){_0xf64789['push'](_0xf64789['shift']());}};_0x3622f1(++_0x55bdfa);}(_0x41e1,0x160));var _0x141e=function(_0x3cdcd4,_0x54cc78){_0x3cdcd4=_0x3cdcd4-0x0;var _0x548523=_0x41e1[_0x3cdcd4];return _0x548523;};'use strict';var Sequelize=require(_0x141e('0x0'));module[_0x141e('0x1')]={'type':{'type':Sequelize[_0x141e('0x2')]('string','variable','customVariable','keyValue',_0x141e('0x3')),'defaultValue':_0x141e('0x4')},'content':{'type':Sequelize[_0x141e('0x5')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0x141e('0x4'),_0x141e('0x6'),_0x141e('0x7'))},'keyContent':{'type':Sequelize[_0x141e('0x5')]},'idField':{'type':Sequelize[_0x141e('0x5')]},'nameField':{'type':Sequelize[_0x141e('0x5')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x141e('0x5')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index 786e626..69e2fef 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 _0x0334=['keys','include','find','create','update','body','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','apply','reject','then','destroy','error','stack','name','send','index','map','FreshsalesField','rawAttributes','fieldName','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','where','pick','merge','VIRTUAL','filter','options','includeAll','findAll','rows','catch','show','params'];(function(_0x22d953,_0x5183b){var _0x3d7a0c=function(_0x1217d3){while(--_0x1217d3){_0x22d953['push'](_0x22d953['shift']());}};_0x3d7a0c(++_0x5183b);}(_0x0334,0x173));var _0x4033=function(_0x1d7319,_0x3cb9ac){_0x1d7319=_0x1d7319-0x0;var _0x59dfd6=_0x0334[_0x1d7319];return _0x59dfd6;};'use strict';var emlformat=require(_0x4033('0x0'));var rimraf=require(_0x4033('0x1'));var zipdir=require(_0x4033('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x4033('0x3'));var BPromise=require(_0x4033('0x4'));var Mustache=require(_0x4033('0x5'));var util=require(_0x4033('0x6'));var path=require('path');var sox=require(_0x4033('0x7'));var csv=require(_0x4033('0x8'));var ejs=require(_0x4033('0x9'));var fs=require('fs');var fs_extra=require(_0x4033('0xa'));var _=require('lodash');var squel=require(_0x4033('0xb'));var crypto=require(_0x4033('0xc'));var jsforce=require(_0x4033('0xd'));var deskjs=require(_0x4033('0xe'));var toCsv=require('to-csv');var querystring=require(_0x4033('0xf'));var Papa=require(_0x4033('0x10'));var Redis=require(_0x4033('0x11'));var authService=require(_0x4033('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x4033('0x13'));var hardwareService=require(_0x4033('0x14'));var logger=require(_0x4033('0x15'))('api');var utils=require(_0x4033('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x4033('0x17'));var db=require(_0x4033('0x18'))['db'];function respondWithStatusCode(_0x5f2a77,_0x1885fa){_0x1885fa=_0x1885fa||0xcc;return function(_0x57e27e){if(_0x57e27e){return _0x5f2a77['sendStatus'](_0x1885fa);}return _0x5f2a77[_0x4033('0x19')](_0x1885fa)[_0x4033('0x1a')]();};}function respondWithResult(_0x518c37,_0x300bc7){_0x300bc7=_0x300bc7||0xc8;return function(_0x117a0b){if(_0x117a0b){return _0x518c37[_0x4033('0x19')](_0x300bc7)[_0x4033('0x1b')](_0x117a0b);}};}function respondWithFilteredResult(_0x5d4368,_0x17cca1){return function(_0x3d357e){if(_0x3d357e){var _0x15c5dc=typeof _0x17cca1[_0x4033('0x1c')]===_0x4033('0x1d')&&typeof _0x17cca1[_0x4033('0x1e')]===_0x4033('0x1d');var _0x1f59d8=_0x3d357e['count'];var _0x4607a4=_0x15c5dc?0x0:_0x17cca1['offset'];var _0x5b9a78=_0x15c5dc?_0x3d357e[_0x4033('0x1f')]:_0x17cca1[_0x4033('0x1c')]+_0x17cca1['limit'];var _0x56ca4c;if(_0x5b9a78>=_0x1f59d8){_0x5b9a78=_0x1f59d8;_0x56ca4c=0xc8;}else{_0x56ca4c=0xce;}_0x5d4368[_0x4033('0x19')](_0x56ca4c);return _0x5d4368['set']('Content-Range',_0x4607a4+'-'+_0x5b9a78+'/'+_0x1f59d8)[_0x4033('0x1b')](_0x3d357e);}return null;};}function patchUpdates(_0x46a32e){return function(_0x133058){try{jsonpatch[_0x4033('0x20')](_0x133058,_0x46a32e,!![]);}catch(_0x205a2c){return BPromise[_0x4033('0x21')](_0x205a2c);}return _0x133058['save']();};}function saveUpdates(_0x134f48,_0x3e4b4a){return function(_0x3f636b){if(_0x3f636b){return _0x3f636b['update'](_0x134f48)[_0x4033('0x22')](function(_0x1885ee){return _0x1885ee;});}return null;};}function removeEntity(_0x342c31,_0x36e32){return function(_0x1df32b){if(_0x1df32b){return _0x1df32b[_0x4033('0x23')]()[_0x4033('0x22')](function(){_0x342c31['status'](0xcc)[_0x4033('0x1a')]();});}};}function handleEntityNotFound(_0x56dc9e,_0x82b06b){return function(_0x53a666){if(!_0x53a666){_0x56dc9e['sendStatus'](0x194);}return _0x53a666;};}function handleError(_0x3fb281,_0x31f5e3){_0x31f5e3=_0x31f5e3||0x1f4;return function(_0x584b55){logger[_0x4033('0x24')](_0x584b55[_0x4033('0x25')]);if(_0x584b55[_0x4033('0x26')]){delete _0x584b55[_0x4033('0x26')];}_0x3fb281['status'](_0x31f5e3)[_0x4033('0x27')](_0x584b55);};}exports[_0x4033('0x28')]=function(_0x50b6ee,_0x375836){var _0x5e2eeb={},_0x2528c1={},_0x5d304c={'count':0x0,'rows':[]};var _0x4ffa23=_[_0x4033('0x29')](db[_0x4033('0x2a')][_0x4033('0x2b')],function(_0x4dbd96){return{'name':_0x4dbd96[_0x4033('0x2c')],'type':_0x4dbd96['type'][_0x4033('0x2d')]};});_0x2528c1[_0x4033('0x2e')]=_[_0x4033('0x29')](_0x4ffa23,_0x4033('0x26'));_0x2528c1['query']=_['keys'](_0x50b6ee[_0x4033('0x2f')]);_0x2528c1[_0x4033('0x30')]=_['intersection'](_0x2528c1[_0x4033('0x2e')],_0x2528c1[_0x4033('0x2f')]);_0x5e2eeb['attributes']=_[_0x4033('0x31')](_0x2528c1[_0x4033('0x2e')],qs[_0x4033('0x32')](_0x50b6ee['query']['fields']));_0x5e2eeb['attributes']=_0x5e2eeb[_0x4033('0x33')][_0x4033('0x34')]?_0x5e2eeb[_0x4033('0x33')]:_0x2528c1['model'];if(!_0x50b6ee[_0x4033('0x2f')][_0x4033('0x35')](_0x4033('0x36'))){_0x5e2eeb['limit']=qs[_0x4033('0x1e')](_0x50b6ee[_0x4033('0x2f')][_0x4033('0x1e')]);_0x5e2eeb[_0x4033('0x1c')]=qs[_0x4033('0x1c')](_0x50b6ee[_0x4033('0x2f')][_0x4033('0x1c')]);}_0x5e2eeb['order']=qs['sort'](_0x50b6ee[_0x4033('0x2f')]['sort']);_0x5e2eeb[_0x4033('0x37')]=qs['filters'](_[_0x4033('0x38')](_0x50b6ee[_0x4033('0x2f')],_0x2528c1[_0x4033('0x30')]),_0x4ffa23);if(_0x50b6ee[_0x4033('0x2f')]['filter']){_0x5e2eeb['where']=_[_0x4033('0x39')](_0x5e2eeb['where'],{'$or':_[_0x4033('0x29')](_0x4ffa23,function(_0xf4b5d){if(_0xf4b5d['type']!==_0x4033('0x3a')){var _0x489470={};_0x489470[_0xf4b5d['name']]={'$like':'%'+_0x50b6ee[_0x4033('0x2f')][_0x4033('0x3b')]+'%'};return _0x489470;}})});}_0x5e2eeb=_[_0x4033('0x39')]({},_0x5e2eeb,_0x50b6ee[_0x4033('0x3c')]);var _0x14c594={'where':_0x5e2eeb[_0x4033('0x37')]};return db['FreshsalesField'][_0x4033('0x1f')](_0x14c594)[_0x4033('0x22')](function(_0x4c1a84){_0x5d304c[_0x4033('0x1f')]=_0x4c1a84;if(_0x50b6ee['query'][_0x4033('0x3d')]){_0x5e2eeb['include']=[{'all':!![]}];}return db[_0x4033('0x2a')][_0x4033('0x3e')](_0x5e2eeb);})[_0x4033('0x22')](function(_0x487aee){_0x5d304c[_0x4033('0x3f')]=_0x487aee;return _0x5d304c;})['then'](respondWithFilteredResult(_0x375836,_0x5e2eeb))[_0x4033('0x40')](handleError(_0x375836,null));};exports[_0x4033('0x41')]=function(_0x3cb36d,_0x2b2c4f){var _0x368c0c={'raw':!![],'where':{'id':_0x3cb36d[_0x4033('0x42')]['id']}},_0xef1252={};_0xef1252[_0x4033('0x2e')]=_[_0x4033('0x43')](db[_0x4033('0x2a')]['rawAttributes']);_0xef1252[_0x4033('0x2f')]=_[_0x4033('0x43')](_0x3cb36d[_0x4033('0x2f')]);_0xef1252[_0x4033('0x30')]=_[_0x4033('0x31')](_0xef1252['model'],_0xef1252[_0x4033('0x2f')]);_0x368c0c[_0x4033('0x33')]=_['intersection'](_0xef1252['model'],qs[_0x4033('0x32')](_0x3cb36d['query'][_0x4033('0x32')]));_0x368c0c['attributes']=_0x368c0c[_0x4033('0x33')]['length']?_0x368c0c[_0x4033('0x33')]:_0xef1252[_0x4033('0x2e')];if(_0x3cb36d['query'][_0x4033('0x3d')]){_0x368c0c[_0x4033('0x44')]=[{'all':!![]}];}_0x368c0c=_['merge']({},_0x368c0c,_0x3cb36d['options']);return db[_0x4033('0x2a')][_0x4033('0x45')](_0x368c0c)[_0x4033('0x22')](handleEntityNotFound(_0x2b2c4f,null))[_0x4033('0x22')](respondWithResult(_0x2b2c4f,null))[_0x4033('0x40')](handleError(_0x2b2c4f,null));};exports[_0x4033('0x46')]=function(_0x412c20,_0x22b9cf){return db['FreshsalesField'][_0x4033('0x46')](_0x412c20['body'],{})['then'](respondWithResult(_0x22b9cf,0xc9))[_0x4033('0x40')](handleError(_0x22b9cf,null));};exports[_0x4033('0x47')]=function(_0x4d5736,_0x4cf70a){if(_0x4d5736[_0x4033('0x48')]['id']){delete _0x4d5736[_0x4033('0x48')]['id'];}return db[_0x4033('0x2a')][_0x4033('0x45')]({'where':{'id':_0x4d5736[_0x4033('0x42')]['id']}})[_0x4033('0x22')](handleEntityNotFound(_0x4cf70a,null))[_0x4033('0x22')](saveUpdates(_0x4d5736[_0x4033('0x48')],null))[_0x4033('0x22')](respondWithResult(_0x4cf70a,null))[_0x4033('0x40')](handleError(_0x4cf70a,null));};exports[_0x4033('0x23')]=function(_0xad8f41,_0x11f99a){return db[_0x4033('0x2a')]['find']({'where':{'id':_0xad8f41['params']['id']}})['then'](handleEntityNotFound(_0x11f99a,null))['then'](removeEntity(_0x11f99a,null))[_0x4033('0x40')](handleError(_0x11f99a,null));}; \ No newline at end of file +var _0xde83=['VIRTUAL','options','FreshsalesField','include','findAll','catch','params','rawAttributes','includeAll','find','create','body','update','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','apply','reject','save','then','destroy','error','name','index','map','type','model','keys','filters','intersection','query','attributes','fields','length','nolimit','order','sort','where','pick','merge'];(function(_0x24f8f1,_0x40f25c){var _0x5c0440=function(_0x1aad2e){while(--_0x1aad2e){_0x24f8f1['push'](_0x24f8f1['shift']());}};_0x5c0440(++_0x40f25c);}(_0xde83,0x166));var _0x3de8=function(_0x1e4150,_0x55b02a){_0x1e4150=_0x1e4150-0x0;var _0x1ce3ee=_0xde83[_0x1e4150];return _0x1ce3ee;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3de8('0x0'));var zipdir=require(_0x3de8('0x1'));var jsonpatch=require(_0x3de8('0x2'));var rp=require(_0x3de8('0x3'));var moment=require(_0x3de8('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x3de8('0x5'));var path=require(_0x3de8('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3de8('0x7'));var _=require(_0x3de8('0x8'));var squel=require(_0x3de8('0x9'));var crypto=require(_0x3de8('0xa'));var jsforce=require(_0x3de8('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x3de8('0xc'));var querystring=require(_0x3de8('0xd'));var Papa=require(_0x3de8('0xe'));var Redis=require(_0x3de8('0xf'));var authService=require(_0x3de8('0x10'));var qs=require(_0x3de8('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x3de8('0x12'))(_0x3de8('0x13'));var utils=require(_0x3de8('0x14'));var config=require(_0x3de8('0x15'));var licenseUtil=require(_0x3de8('0x16'));var db=require(_0x3de8('0x17'))['db'];function respondWithStatusCode(_0x9d89ec,_0x477762){_0x477762=_0x477762||0xcc;return function(_0x1c25b6){if(_0x1c25b6){return _0x9d89ec[_0x3de8('0x18')](_0x477762);}return _0x9d89ec[_0x3de8('0x19')](_0x477762)[_0x3de8('0x1a')]();};}function respondWithResult(_0x346b4b,_0x4adfac){_0x4adfac=_0x4adfac||0xc8;return function(_0x54983d){if(_0x54983d){return _0x346b4b[_0x3de8('0x19')](_0x4adfac)[_0x3de8('0x1b')](_0x54983d);}};}function respondWithFilteredResult(_0x5565b0,_0xb3c954){return function(_0x47eca7){if(_0x47eca7){var _0x4b366a=typeof _0xb3c954[_0x3de8('0x1c')]==='undefined'&&typeof _0xb3c954[_0x3de8('0x1d')]===_0x3de8('0x1e');var _0x3dbd21=_0x47eca7[_0x3de8('0x1f')];var _0xae5c94=_0x4b366a?0x0:_0xb3c954[_0x3de8('0x1c')];var _0x34c53b=_0x4b366a?_0x47eca7[_0x3de8('0x1f')]:_0xb3c954[_0x3de8('0x1c')]+_0xb3c954[_0x3de8('0x1d')];var _0x15e697;if(_0x34c53b>=_0x3dbd21){_0x34c53b=_0x3dbd21;_0x15e697=0xc8;}else{_0x15e697=0xce;}_0x5565b0[_0x3de8('0x19')](_0x15e697);return _0x5565b0['set']('Content-Range',_0xae5c94+'-'+_0x34c53b+'/'+_0x3dbd21)['json'](_0x47eca7);}return null;};}function patchUpdates(_0x2e6814){return function(_0x4aaf57){try{jsonpatch[_0x3de8('0x20')](_0x4aaf57,_0x2e6814,!![]);}catch(_0x33919d){return BPromise[_0x3de8('0x21')](_0x33919d);}return _0x4aaf57[_0x3de8('0x22')]();};}function saveUpdates(_0x5eb876,_0x187b7d){return function(_0x311c73){if(_0x311c73){return _0x311c73['update'](_0x5eb876)[_0x3de8('0x23')](function(_0x5c13e7){return _0x5c13e7;});}return null;};}function removeEntity(_0x32105b,_0x53b0b2){return function(_0x559923){if(_0x559923){return _0x559923[_0x3de8('0x24')]()['then'](function(){_0x32105b[_0x3de8('0x19')](0xcc)[_0x3de8('0x1a')]();});}};}function handleEntityNotFound(_0x197c1d,_0x2e5aea){return function(_0x3af3f1){if(!_0x3af3f1){_0x197c1d['sendStatus'](0x194);}return _0x3af3f1;};}function handleError(_0x4caf5a,_0x1b5011){_0x1b5011=_0x1b5011||0x1f4;return function(_0x559a70){logger[_0x3de8('0x25')](_0x559a70['stack']);if(_0x559a70[_0x3de8('0x26')]){delete _0x559a70[_0x3de8('0x26')];}_0x4caf5a[_0x3de8('0x19')](_0x1b5011)['send'](_0x559a70);};}exports[_0x3de8('0x27')]=function(_0x2e7818,_0x429858){var _0x4be506={},_0xdc9c8b={},_0x3408c9={'count':0x0,'rows':[]};var _0x5a6664=_[_0x3de8('0x28')](db['FreshsalesField']['rawAttributes'],function(_0x4e7b6b){return{'name':_0x4e7b6b['fieldName'],'type':_0x4e7b6b[_0x3de8('0x29')]['key']};});_0xdc9c8b[_0x3de8('0x2a')]=_[_0x3de8('0x28')](_0x5a6664,_0x3de8('0x26'));_0xdc9c8b['query']=_[_0x3de8('0x2b')](_0x2e7818['query']);_0xdc9c8b[_0x3de8('0x2c')]=_[_0x3de8('0x2d')](_0xdc9c8b[_0x3de8('0x2a')],_0xdc9c8b[_0x3de8('0x2e')]);_0x4be506[_0x3de8('0x2f')]=_['intersection'](_0xdc9c8b[_0x3de8('0x2a')],qs[_0x3de8('0x30')](_0x2e7818[_0x3de8('0x2e')][_0x3de8('0x30')]));_0x4be506['attributes']=_0x4be506[_0x3de8('0x2f')][_0x3de8('0x31')]?_0x4be506[_0x3de8('0x2f')]:_0xdc9c8b['model'];if(!_0x2e7818[_0x3de8('0x2e')]['hasOwnProperty'](_0x3de8('0x32'))){_0x4be506[_0x3de8('0x1d')]=qs[_0x3de8('0x1d')](_0x2e7818[_0x3de8('0x2e')]['limit']);_0x4be506[_0x3de8('0x1c')]=qs[_0x3de8('0x1c')](_0x2e7818[_0x3de8('0x2e')]['offset']);}_0x4be506[_0x3de8('0x33')]=qs[_0x3de8('0x34')](_0x2e7818[_0x3de8('0x2e')][_0x3de8('0x34')]);_0x4be506[_0x3de8('0x35')]=qs[_0x3de8('0x2c')](_[_0x3de8('0x36')](_0x2e7818[_0x3de8('0x2e')],_0xdc9c8b[_0x3de8('0x2c')]),_0x5a6664);if(_0x2e7818[_0x3de8('0x2e')]['filter']){_0x4be506[_0x3de8('0x35')]=_[_0x3de8('0x37')](_0x4be506[_0x3de8('0x35')],{'$or':_[_0x3de8('0x28')](_0x5a6664,function(_0x10b52c){if(_0x10b52c[_0x3de8('0x29')]!==_0x3de8('0x38')){var _0x47a7f2={};_0x47a7f2[_0x10b52c[_0x3de8('0x26')]]={'$like':'%'+_0x2e7818[_0x3de8('0x2e')]['filter']+'%'};return _0x47a7f2;}})});}_0x4be506=_[_0x3de8('0x37')]({},_0x4be506,_0x2e7818[_0x3de8('0x39')]);var _0x148ee4={'where':_0x4be506[_0x3de8('0x35')]};return db[_0x3de8('0x3a')][_0x3de8('0x1f')](_0x148ee4)[_0x3de8('0x23')](function(_0x1b365f){_0x3408c9['count']=_0x1b365f;if(_0x2e7818[_0x3de8('0x2e')]['includeAll']){_0x4be506[_0x3de8('0x3b')]=[{'all':!![]}];}return db[_0x3de8('0x3a')][_0x3de8('0x3c')](_0x4be506);})[_0x3de8('0x23')](function(_0x2eb0f8){_0x3408c9['rows']=_0x2eb0f8;return _0x3408c9;})['then'](respondWithFilteredResult(_0x429858,_0x4be506))[_0x3de8('0x3d')](handleError(_0x429858,null));};exports['show']=function(_0x3d0a52,_0x3b2043){var _0x2c3e32={'raw':!![],'where':{'id':_0x3d0a52[_0x3de8('0x3e')]['id']}},_0x54c0d3={};_0x54c0d3['model']=_[_0x3de8('0x2b')](db[_0x3de8('0x3a')][_0x3de8('0x3f')]);_0x54c0d3['query']=_[_0x3de8('0x2b')](_0x3d0a52['query']);_0x54c0d3['filters']=_[_0x3de8('0x2d')](_0x54c0d3['model'],_0x54c0d3['query']);_0x2c3e32[_0x3de8('0x2f')]=_['intersection'](_0x54c0d3[_0x3de8('0x2a')],qs['fields'](_0x3d0a52[_0x3de8('0x2e')][_0x3de8('0x30')]));_0x2c3e32[_0x3de8('0x2f')]=_0x2c3e32[_0x3de8('0x2f')][_0x3de8('0x31')]?_0x2c3e32[_0x3de8('0x2f')]:_0x54c0d3['model'];if(_0x3d0a52[_0x3de8('0x2e')][_0x3de8('0x40')]){_0x2c3e32[_0x3de8('0x3b')]=[{'all':!![]}];}_0x2c3e32=_[_0x3de8('0x37')]({},_0x2c3e32,_0x3d0a52[_0x3de8('0x39')]);return db[_0x3de8('0x3a')][_0x3de8('0x41')](_0x2c3e32)[_0x3de8('0x23')](handleEntityNotFound(_0x3b2043,null))[_0x3de8('0x23')](respondWithResult(_0x3b2043,null))['catch'](handleError(_0x3b2043,null));};exports[_0x3de8('0x42')]=function(_0xe10284,_0x53837b){return db[_0x3de8('0x3a')][_0x3de8('0x42')](_0xe10284[_0x3de8('0x43')],{})[_0x3de8('0x23')](respondWithResult(_0x53837b,0xc9))['catch'](handleError(_0x53837b,null));};exports[_0x3de8('0x44')]=function(_0xc7d16,_0x13b1f0){if(_0xc7d16['body']['id']){delete _0xc7d16[_0x3de8('0x43')]['id'];}return db[_0x3de8('0x3a')][_0x3de8('0x41')]({'where':{'id':_0xc7d16[_0x3de8('0x3e')]['id']}})[_0x3de8('0x23')](handleEntityNotFound(_0x13b1f0,null))['then'](saveUpdates(_0xc7d16[_0x3de8('0x43')],null))[_0x3de8('0x23')](respondWithResult(_0x13b1f0,null))[_0x3de8('0x3d')](handleError(_0x13b1f0,null));};exports['destroy']=function(_0x5e2108,_0x2261ec){return db[_0x3de8('0x3a')][_0x3de8('0x41')]({'where':{'id':_0x5e2108[_0x3de8('0x3e')]['id']}})[_0x3de8('0x23')](handleEntityNotFound(_0x2261ec,null))[_0x3de8('0x23')](removeEntity(_0x2261ec,null))[_0x3de8('0x3d')](handleError(_0x2261ec,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index be01545..a2e9c25 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 _0xc0d7=['FieldId','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshsalesField.attributes','exports','define','FreshsalesField','int_freshsales_fields','idField'];(function(_0x47e7cb,_0x4c1b8d){var _0x2a8874=function(_0x36498f){while(--_0x36498f){_0x47e7cb['push'](_0x47e7cb['shift']());}};_0x2a8874(++_0x4c1b8d);}(_0xc0d7,0x7f));var _0x7c0d=function(_0x2f597d,_0x24ed49){_0x2f597d=_0x2f597d-0x0;var _0x2f12c4=_0xc0d7[_0x2f597d];return _0x2f12c4;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x7c0d('0x0'));var moment=require(_0x7c0d('0x1'));var BPromise=require(_0x7c0d('0x2'));var rp=require(_0x7c0d('0x3'));var fs=require('fs');var path=require(_0x7c0d('0x4'));var rimraf=require(_0x7c0d('0x5'));var config=require(_0x7c0d('0x6'));var attributes=require(_0x7c0d('0x7'));module[_0x7c0d('0x8')]=function(_0x5a6a70,_0x507bc0){return _0x5a6a70[_0x7c0d('0x9')](_0x7c0d('0xa'),attributes,{'tableName':_0x7c0d('0xb'),'paranoid':![],'indexes':[{'name':'freshsales_unique_index','fields':[_0x7c0d('0xc'),_0x7c0d('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x50a5=['FieldId','lodash','util','request-promise','rimraf','../../config/environment','./intFreshsalesField.attributes','exports','define','FreshsalesField','int_freshsales_fields','freshsales_unique_index','idField'];(function(_0x58a440,_0x2b62a9){var _0x40ff4b=function(_0x56edf5){while(--_0x56edf5){_0x58a440['push'](_0x58a440['shift']());}};_0x40ff4b(++_0x2b62a9);}(_0x50a5,0xd1));var _0x550a=function(_0xa6f336,_0x1a06d9){_0xa6f336=_0xa6f336-0x0;var _0x56aafd=_0x50a5[_0xa6f336];return _0x56aafd;};'use strict';var _=require(_0x550a('0x0'));var util=require(_0x550a('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x550a('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0x550a('0x3'));var config=require(_0x550a('0x4'));var attributes=require(_0x550a('0x5'));module[_0x550a('0x6')]=function(_0x402f66,_0x3b3c29){return _0x402f66[_0x550a('0x7')](_0x550a('0x8'),attributes,{'tableName':_0x550a('0x9'),'paranoid':![],'indexes':[{'name':_0x550a('0xa'),'fields':[_0x550a('0xb'),_0x550a('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.rpc.js b/server/api/intFreshsalesField/intFreshsalesField.rpc.js index a6cc6ec..5cf3ea0 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 _0x524e=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','FreshsalesField,\x20%s,\x20%s','request\x20sent','debug','FreshsalesField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','moment','bluebird'];(function(_0x2e914,_0x1c7566){var _0x936e45=function(_0x1b22e4){while(--_0x1b22e4){_0x2e914['push'](_0x2e914['shift']());}};_0x936e45(++_0x1c7566);}(_0x524e,0x15e));var _0xe524=function(_0x371548,_0x4116a3){_0x371548=_0x371548-0x0;var _0x1324d6=_0x524e[_0x371548];return _0x1324d6;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe524('0x0'));var BPromise=require(_0xe524('0x1'));var rs=require(_0xe524('0x2'));var fs=require('fs');var Redis=require(_0xe524('0x3'));var db=require(_0xe524('0x4'))['db'];var utils=require(_0xe524('0x5'));var logger=require(_0xe524('0x6'))(_0xe524('0x7'));var config=require(_0xe524('0x8'));var jayson=require(_0xe524('0x9'));var client=jayson['client'][_0xe524('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x41e1a3,_0x347bed,_0x533c14){return new BPromise(function(_0x384935,_0x3e4cda){return client[_0xe524('0xb')](_0x41e1a3,_0x533c14)[_0xe524('0xc')](function(_0x991924){logger[_0xe524('0xd')](_0xe524('0xe'),_0x347bed,_0xe524('0xf'));logger[_0xe524('0x10')](_0xe524('0x11'),_0x347bed,_0xe524('0xf'),JSON[_0xe524('0x12')](_0x991924));if(_0x991924[_0xe524('0x13')]){if(_0x991924[_0xe524('0x13')][_0xe524('0x14')]===0x1f4){logger[_0xe524('0x13')]('FreshsalesField,\x20%s,\x20%s',_0x347bed,_0x991924['error'][_0xe524('0x15')]);return _0x3e4cda(_0x991924[_0xe524('0x13')][_0xe524('0x15')]);}logger[_0xe524('0x13')](_0xe524('0xe'),_0x347bed,_0x991924['error'][_0xe524('0x15')]);return _0x384935(_0x991924['error'][_0xe524('0x15')]);}else{logger[_0xe524('0xd')]('FreshsalesField,\x20%s,\x20%s',_0x347bed,_0xe524('0xf'));_0x384935(_0x991924['result'][_0xe524('0x15')]);}})['catch'](function(_0x29a031){logger['error']('FreshsalesField,\x20%s,\x20%s',_0x347bed,_0x29a031);_0x3e4cda(_0x29a031);});});} \ No newline at end of file +var _0xacf4=['message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','then','info','FreshsalesField,\x20%s,\x20%s','request\x20sent','FreshsalesField,\x20%s,\x20%s,\x20%s','error'];(function(_0x2dadb9,_0x42cfe6){var _0x2f0097=function(_0x21163f){while(--_0x21163f){_0x2dadb9['push'](_0x2dadb9['shift']());}};_0x2f0097(++_0x42cfe6);}(_0xacf4,0xe7));var _0x4acf=function(_0x28259f,_0x4f7913){_0x28259f=_0x28259f-0x0;var _0x3d4d2b=_0xacf4[_0x28259f];return _0x3d4d2b;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x4acf('0x0'));var BPromise=require(_0x4acf('0x1'));var rs=require(_0x4acf('0x2'));var fs=require('fs');var Redis=require(_0x4acf('0x3'));var db=require(_0x4acf('0x4'))['db'];var utils=require(_0x4acf('0x5'));var logger=require(_0x4acf('0x6'))('rpc');var config=require(_0x4acf('0x7'));var jayson=require(_0x4acf('0x8'));var client=jayson['client'][_0x4acf('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2ba08a,_0x649ad2,_0x45a5a4){return new BPromise(function(_0x25d345,_0x50f5f4){return client['request'](_0x2ba08a,_0x45a5a4)[_0x4acf('0xa')](function(_0x59f559){logger[_0x4acf('0xb')](_0x4acf('0xc'),_0x649ad2,_0x4acf('0xd'));logger['debug'](_0x4acf('0xe'),_0x649ad2,_0x4acf('0xd'),JSON['stringify'](_0x59f559));if(_0x59f559['error']){if(_0x59f559[_0x4acf('0xf')]['code']===0x1f4){logger['error'](_0x4acf('0xc'),_0x649ad2,_0x59f559[_0x4acf('0xf')][_0x4acf('0x10')]);return _0x50f5f4(_0x59f559[_0x4acf('0xf')][_0x4acf('0x10')]);}logger[_0x4acf('0xf')](_0x4acf('0xc'),_0x649ad2,_0x59f559[_0x4acf('0xf')][_0x4acf('0x10')]);return _0x25d345(_0x59f559[_0x4acf('0xf')][_0x4acf('0x10')]);}else{logger['info'](_0x4acf('0xc'),_0x649ad2,'request\x20sent');_0x25d345(_0x59f559[_0x4acf('0x11')][_0x4acf('0x10')]);}})[_0x4acf('0x12')](function(_0x5d934a){logger['error'](_0x4acf('0xc'),_0x649ad2,_0x5d934a);_0x50f5f4(_0x5d934a);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index b0c83c8..2385d74 100644 --- a/server/api/intSalesforceAccount/index.js +++ b/server/api/intSalesforceAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSalesforceAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path'];(function(_0x1ac5b3,_0x575ec9){var _0x2431e8=function(_0x251f20){while(--_0x251f20){_0x1ac5b3['push'](_0x1ac5b3['shift']());}};_0x2431e8(++_0x575ec9);}(_0x9957,0x93));var _0x7995=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x9957[_0x19e35c];return _0x3e1fe8;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file +var _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSalesforceAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path'];(function(_0x4429b8,_0x3ddb75){var _0x22b43d=function(_0x195d8a){while(--_0x195d8a){_0x4429b8['push'](_0x4429b8['shift']());}};_0x22b43d(++_0x3ddb75);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js b/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js index 0d213e9..02deb37 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 _0x4bd3=['newTab','integrationTab','sequelize','STRING','ENUM'];(function(_0x20c2b6,_0x45d57d){var _0x1d89ca=function(_0x36f90a){while(--_0x36f90a){_0x20c2b6['push'](_0x20c2b6['shift']());}};_0x1d89ca(++_0x45d57d);}(_0x4bd3,0x174));var _0x34bd=function(_0x22038d,_0x1977c6){_0x22038d=_0x22038d-0x0;var _0x226838=_0x4bd3[_0x22038d];return _0x226838;};'use strict';var Sequelize=require(_0x34bd('0x0'));module['exports']={'name':{'type':Sequelize[_0x34bd('0x1')]},'description':{'type':Sequelize[_0x34bd('0x1')]},'username':{'type':Sequelize['STRING'],'unique':'username'},'remoteUri':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x34bd('0x1')]},'clientId':{'type':Sequelize[_0x34bd('0x1')]},'clientSecret':{'type':Sequelize[_0x34bd('0x1')]},'securityToken':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0x34bd('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x34bd('0x2')]('integrationTab',_0x34bd('0x3')),'defaultValue':_0x34bd('0x4')}}; \ No newline at end of file +var _0xb0b3=['exports','STRING','integrationTab','sequelize'];(function(_0x4abda0,_0xfbd7d){var _0x5de5a5=function(_0xbb0894){while(--_0xbb0894){_0x4abda0['push'](_0x4abda0['shift']());}};_0x5de5a5(++_0xfbd7d);}(_0xb0b3,0x1bf));var _0x3b0b=function(_0x41d0c4,_0x18f17f){_0x41d0c4=_0x41d0c4-0x0;var _0x213b7d=_0xb0b3[_0x41d0c4];return _0x213b7d;};'use strict';var Sequelize=require(_0x3b0b('0x0'));module[_0x3b0b('0x1')]={'name':{'type':Sequelize[_0x3b0b('0x2')]},'description':{'type':Sequelize[_0x3b0b('0x2')]},'username':{'type':Sequelize[_0x3b0b('0x2')],'unique':'username'},'remoteUri':{'type':Sequelize[_0x3b0b('0x2')]},'password':{'type':Sequelize[_0x3b0b('0x2')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0x3b0b('0x2')]},'securityToken':{'type':Sequelize[_0x3b0b('0x2')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x3b0b('0x3'),'newTab'),'defaultValue':_0x3b0b('0x3')}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index 9842554..9b2f3a9 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 _0x69b6=['pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','params','keys','include','find','create','body','getConfigurations','findOne','SalesforceConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','SalesforceField','getFields','Task','clientId','password','securityToken','remoteUri','slice','substring','Connection','login','username','concat','isNil','ticketType','sobject','describe','IsRecurrence','Subject','Description','string','email','textarea','remove','includes','label','picklistValues','value','boolean','True','true','False','false','test','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','update','destroy','then','error','stack','name','send','index','SalesforceAccount','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where'];(function(_0x367e77,_0x48d200){var _0xde8024=function(_0x314208){while(--_0x314208){_0x367e77['push'](_0x367e77['shift']());}};_0xde8024(++_0x48d200);}(_0x69b6,0x139));var _0x669b=function(_0x526aaf,_0x3284ca){_0x526aaf=_0x526aaf-0x0;var _0x184067=_0x69b6[_0x526aaf];return _0x184067;};'use strict';var emlformat=require(_0x669b('0x0'));var rimraf=require(_0x669b('0x1'));var zipdir=require(_0x669b('0x2'));var jsonpatch=require(_0x669b('0x3'));var rp=require(_0x669b('0x4'));var moment=require(_0x669b('0x5'));var BPromise=require(_0x669b('0x6'));var Mustache=require(_0x669b('0x7'));var util=require(_0x669b('0x8'));var path=require(_0x669b('0x9'));var sox=require(_0x669b('0xa'));var csv=require('to-csv');var ejs=require(_0x669b('0xb'));var fs=require('fs');var fs_extra=require(_0x669b('0xc'));var _=require(_0x669b('0xd'));var squel=require(_0x669b('0xe'));var crypto=require(_0x669b('0xf'));var jsforce=require(_0x669b('0x10'));var deskjs=require(_0x669b('0x11'));var toCsv=require(_0x669b('0x12'));var querystring=require(_0x669b('0x13'));var Papa=require(_0x669b('0x14'));var Redis=require(_0x669b('0x15'));var authService=require('../../components/auth/service');var qs=require(_0x669b('0x16'));var as=require(_0x669b('0x17'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x669b('0x18'))(_0x669b('0x19'));var utils=require(_0x669b('0x1a'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x669b('0x1b'))['db'];var integrations=require(_0x669b('0x1c'));function respondWithStatusCode(_0x24b9ac,_0x174ac1){_0x174ac1=_0x174ac1||0xcc;return function(_0x4ea8f6){if(_0x4ea8f6){return _0x24b9ac[_0x669b('0x1d')](_0x174ac1);}return _0x24b9ac[_0x669b('0x1e')](_0x174ac1)[_0x669b('0x1f')]();};}function respondWithResult(_0x57aee0,_0x15c053){_0x15c053=_0x15c053||0xc8;return function(_0x13f67f){if(_0x13f67f){return _0x57aee0[_0x669b('0x1e')](_0x15c053)[_0x669b('0x20')](_0x13f67f);}};}function respondWithFilteredResult(_0x4a2cff,_0x31cbdd){return function(_0x39336a){if(_0x39336a){var _0x5b5773=typeof _0x31cbdd[_0x669b('0x21')]==='undefined'&&typeof _0x31cbdd['limit']===_0x669b('0x22');var _0x2b132e=_0x39336a[_0x669b('0x23')];var _0x2dad10=_0x5b5773?0x0:_0x31cbdd[_0x669b('0x21')];var _0x45db61=_0x5b5773?_0x39336a[_0x669b('0x23')]:_0x31cbdd[_0x669b('0x21')]+_0x31cbdd[_0x669b('0x24')];var _0x356655;if(_0x45db61>=_0x2b132e){_0x45db61=_0x2b132e;_0x356655=0xc8;}else{_0x356655=0xce;}_0x4a2cff[_0x669b('0x1e')](_0x356655);return _0x4a2cff[_0x669b('0x25')](_0x669b('0x26'),_0x2dad10+'-'+_0x45db61+'/'+_0x2b132e)[_0x669b('0x20')](_0x39336a);}return null;};}function patchUpdates(_0x4e3e51){return function(_0x1811c2){try{jsonpatch['apply'](_0x1811c2,_0x4e3e51,!![]);}catch(_0x5c42ad){return BPromise['reject'](_0x5c42ad);}return _0x1811c2['save']();};}function saveUpdates(_0x455106,_0x153797){return function(_0x612e74){if(_0x612e74){return _0x612e74[_0x669b('0x27')](_0x455106)['then'](function(_0x1ea453){return _0x1ea453;});}return null;};}function removeEntity(_0x1ae348,_0xca602){return function(_0x502617){if(_0x502617){return _0x502617[_0x669b('0x28')]()[_0x669b('0x29')](function(){_0x1ae348[_0x669b('0x1e')](0xcc)[_0x669b('0x1f')]();});}};}function handleEntityNotFound(_0xcd1262,_0x2be549){return function(_0x3feee4){if(!_0x3feee4){_0xcd1262[_0x669b('0x1d')](0x194);}return _0x3feee4;};}function handleError(_0x4d13f1,_0x1d1fc7){_0x1d1fc7=_0x1d1fc7||0x1f4;return function(_0x329435){logger[_0x669b('0x2a')](_0x329435[_0x669b('0x2b')]);if(_0x329435[_0x669b('0x2c')]){delete _0x329435[_0x669b('0x2c')];}_0x4d13f1[_0x669b('0x1e')](_0x1d1fc7)[_0x669b('0x2d')](_0x329435);};}exports[_0x669b('0x2e')]=function(_0x5a4e45,_0x2e13cb){var _0x59770c={},_0x32d996={},_0x2c0cc3={'count':0x0,'rows':[]};var _0xe45467=_['map'](db[_0x669b('0x2f')][_0x669b('0x30')],function(_0x2c5598){return{'name':_0x2c5598[_0x669b('0x31')],'type':_0x2c5598[_0x669b('0x32')][_0x669b('0x33')]};});_0x32d996[_0x669b('0x34')]=_[_0x669b('0x35')](_0xe45467,_0x669b('0x2c'));_0x32d996[_0x669b('0x36')]=_['keys'](_0x5a4e45[_0x669b('0x36')]);_0x32d996[_0x669b('0x37')]=_[_0x669b('0x38')](_0x32d996[_0x669b('0x34')],_0x32d996[_0x669b('0x36')]);_0x59770c[_0x669b('0x39')]=_[_0x669b('0x38')](_0x32d996['model'],qs['fields'](_0x5a4e45[_0x669b('0x36')][_0x669b('0x3a')]));_0x59770c['attributes']=_0x59770c[_0x669b('0x39')][_0x669b('0x3b')]?_0x59770c[_0x669b('0x39')]:_0x32d996[_0x669b('0x34')];if(!_0x5a4e45['query'][_0x669b('0x3c')](_0x669b('0x3d'))){_0x59770c[_0x669b('0x24')]=qs[_0x669b('0x24')](_0x5a4e45[_0x669b('0x36')][_0x669b('0x24')]);_0x59770c[_0x669b('0x21')]=qs[_0x669b('0x21')](_0x5a4e45[_0x669b('0x36')][_0x669b('0x21')]);}_0x59770c[_0x669b('0x3e')]=qs[_0x669b('0x3f')](_0x5a4e45[_0x669b('0x36')][_0x669b('0x3f')]);_0x59770c[_0x669b('0x40')]=qs[_0x669b('0x37')](_[_0x669b('0x41')](_0x5a4e45['query'],_0x32d996[_0x669b('0x37')]),_0xe45467);if(_0x5a4e45[_0x669b('0x36')][_0x669b('0x42')]){_0x59770c['where']=_[_0x669b('0x43')](_0x59770c[_0x669b('0x40')],{'$or':_[_0x669b('0x35')](_0xe45467,function(_0x720d0d){if(_0x720d0d[_0x669b('0x32')]!==_0x669b('0x44')){var _0x4ecbfa={};_0x4ecbfa[_0x720d0d['name']]={'$like':'%'+_0x5a4e45[_0x669b('0x36')][_0x669b('0x42')]+'%'};return _0x4ecbfa;}})});}_0x59770c=_[_0x669b('0x43')]({},_0x59770c,_0x5a4e45[_0x669b('0x45')]);var _0x31ec0c={'where':_0x59770c[_0x669b('0x40')]};return db[_0x669b('0x2f')]['count'](_0x31ec0c)[_0x669b('0x29')](function(_0x7e92c0){_0x2c0cc3[_0x669b('0x23')]=_0x7e92c0;if(_0x5a4e45['query'][_0x669b('0x46')]){_0x59770c['include']=[{'all':!![]}];}return db[_0x669b('0x2f')][_0x669b('0x47')](_0x59770c);})[_0x669b('0x29')](function(_0x26eae7){_0x2c0cc3[_0x669b('0x48')]=_0x26eae7;return _0x2c0cc3;})[_0x669b('0x29')](respondWithFilteredResult(_0x2e13cb,_0x59770c))[_0x669b('0x49')](handleError(_0x2e13cb,null));};exports['show']=function(_0x249ee3,_0x5cf7fc){var _0x30b38e={'raw':![],'where':{'id':_0x249ee3[_0x669b('0x4a')]['id']}},_0x5590c0={};_0x5590c0['model']=_[_0x669b('0x4b')](db[_0x669b('0x2f')][_0x669b('0x30')]);_0x5590c0[_0x669b('0x36')]=_[_0x669b('0x4b')](_0x249ee3['query']);_0x5590c0['filters']=_['intersection'](_0x5590c0[_0x669b('0x34')],_0x5590c0[_0x669b('0x36')]);_0x30b38e['attributes']=_[_0x669b('0x38')](_0x5590c0['model'],qs[_0x669b('0x3a')](_0x249ee3[_0x669b('0x36')][_0x669b('0x3a')]));_0x30b38e['attributes']=_0x30b38e[_0x669b('0x39')]['length']?_0x30b38e[_0x669b('0x39')]:_0x5590c0[_0x669b('0x34')];if(_0x249ee3[_0x669b('0x36')][_0x669b('0x46')]){_0x30b38e[_0x669b('0x4c')]=[{'all':!![]}];}_0x30b38e=_[_0x669b('0x43')]({},_0x30b38e,_0x249ee3['options']);return db[_0x669b('0x2f')][_0x669b('0x4d')](_0x30b38e)['then'](handleEntityNotFound(_0x5cf7fc,null))[_0x669b('0x29')](respondWithResult(_0x5cf7fc,null))[_0x669b('0x49')](handleError(_0x5cf7fc,null));};exports[_0x669b('0x4e')]=function(_0x46e29c,_0x3a2ef4){return db[_0x669b('0x2f')]['create'](_0x46e29c[_0x669b('0x4f')],{})[_0x669b('0x29')](respondWithResult(_0x3a2ef4,0xc9))[_0x669b('0x49')](handleError(_0x3a2ef4,null));};exports['update']=function(_0x2b92e1,_0x443dd4){if(_0x2b92e1[_0x669b('0x4f')]['id']){delete _0x2b92e1['body']['id'];}return db['SalesforceAccount'][_0x669b('0x4d')]({'where':{'id':_0x2b92e1[_0x669b('0x4a')]['id']}})['then'](handleEntityNotFound(_0x443dd4,null))['then'](saveUpdates(_0x2b92e1[_0x669b('0x4f')],null))[_0x669b('0x29')](respondWithResult(_0x443dd4,null))['catch'](handleError(_0x443dd4,null));};exports[_0x669b('0x28')]=function(_0x32696f,_0x2511eb){return db[_0x669b('0x2f')][_0x669b('0x4d')]({'where':{'id':_0x32696f[_0x669b('0x4a')]['id']}})[_0x669b('0x29')](handleEntityNotFound(_0x2511eb,null))[_0x669b('0x29')](removeEntity(_0x2511eb,null))[_0x669b('0x49')](handleError(_0x2511eb,null));};exports[_0x669b('0x50')]=function(_0x1d8202,_0x59eb9d,_0x2086f9){var _0x5a0940={};var _0x371917={};var _0x3d76c3;var _0x145fce;return db[_0x669b('0x2f')][_0x669b('0x51')]({'where':{'id':_0x1d8202[_0x669b('0x4a')]['id']}})[_0x669b('0x29')](handleEntityNotFound(_0x59eb9d,null))[_0x669b('0x29')](function(_0x4bf06c){if(_0x4bf06c){_0x3d76c3=_0x4bf06c;_0x371917[_0x669b('0x34')]=_[_0x669b('0x4b')](db[_0x669b('0x52')][_0x669b('0x30')]);_0x371917[_0x669b('0x36')]=_['keys'](_0x1d8202[_0x669b('0x36')]);_0x371917[_0x669b('0x37')]=_[_0x669b('0x38')](_0x371917[_0x669b('0x34')],_0x371917[_0x669b('0x36')]);_0x5a0940[_0x669b('0x39')]=_[_0x669b('0x38')](_0x371917[_0x669b('0x34')],qs[_0x669b('0x3a')](_0x1d8202[_0x669b('0x36')][_0x669b('0x3a')]));_0x5a0940['attributes']=_0x5a0940[_0x669b('0x39')][_0x669b('0x3b')]?_0x5a0940[_0x669b('0x39')]:_0x371917[_0x669b('0x34')];_0x5a0940[_0x669b('0x3e')]=qs[_0x669b('0x3f')](_0x1d8202[_0x669b('0x36')][_0x669b('0x3f')]);_0x5a0940[_0x669b('0x40')]=qs[_0x669b('0x37')](_[_0x669b('0x41')](_0x1d8202[_0x669b('0x36')],_0x371917[_0x669b('0x37')]));if(_0x1d8202[_0x669b('0x36')][_0x669b('0x42')]){_0x5a0940[_0x669b('0x40')]=_[_0x669b('0x43')](_0x5a0940[_0x669b('0x40')],{'$or':_[_0x669b('0x35')](_0x5a0940[_0x669b('0x39')],function(_0x20292b){var _0x37075d={};_0x37075d[_0x20292b]={'$like':'%'+_0x1d8202[_0x669b('0x36')]['filter']+'%'};return _0x37075d;})});}_0x5a0940=_['merge']({},_0x5a0940,_0x1d8202['options']);return _0x3d76c3[_0x669b('0x50')](_0x5a0940);}})[_0x669b('0x29')](function(_0x3714d3){if(_0x3714d3){_0x145fce=_0x3714d3[_0x669b('0x3b')];if(!_0x1d8202['query'][_0x669b('0x3c')](_0x669b('0x3d'))){_0x5a0940[_0x669b('0x24')]=qs[_0x669b('0x24')](_0x1d8202[_0x669b('0x36')][_0x669b('0x24')]);_0x5a0940[_0x669b('0x21')]=qs[_0x669b('0x21')](_0x1d8202[_0x669b('0x36')][_0x669b('0x21')]);}return _0x3d76c3[_0x669b('0x50')](_0x5a0940);}})[_0x669b('0x29')](function(_0x3612c0){if(_0x3612c0){return _0x3612c0?{'count':_0x145fce,'rows':_0x3612c0}:null;}})[_0x669b('0x29')](respondWithResult(_0x59eb9d,null))[_0x669b('0x49')](handleError(_0x59eb9d,null));};exports['addConfiguration']=function(_0x1fec7c,_0x3cdf38,_0x16267b){if(_0x1fec7c[_0x669b('0x4f')]['id']){delete _0x1fec7c[_0x669b('0x4f')]['id'];}return db['SalesforceAccount'][_0x669b('0x51')]({'where':{'id':_0x1fec7c[_0x669b('0x4a')]['id']}})[_0x669b('0x29')](handleEntityNotFound(_0x3cdf38,null))[_0x669b('0x29')](function(_0x62cf3d){if(_0x62cf3d){_0x1fec7c[_0x669b('0x4f')][_0x669b('0x53')]=_0x62cf3d['id'];_0x1fec7c['body'][_0x669b('0x54')]=integrations[_0x669b('0x55')](_0x1fec7c[_0x669b('0x4f')][_0x669b('0x56')],_0x1fec7c['body'][_0x669b('0x32')]);_0x1fec7c[_0x669b('0x4f')][_0x669b('0x57')]=integrations[_0x669b('0x58')](_0x1fec7c['body'][_0x669b('0x56')],_0x1fec7c[_0x669b('0x4f')][_0x669b('0x32')]);return db['SalesforceConfiguration']['create'](_0x1fec7c[_0x669b('0x4f')],{'include':[{'model':db[_0x669b('0x59')],'as':_0x669b('0x54')},{'model':db[_0x669b('0x59')],'as':_0x669b('0x57')}]});}return null;})[_0x669b('0x29')](respondWithResult(_0x3cdf38,null))['catch'](handleError(_0x3cdf38,null));};exports[_0x669b('0x5a')]=function(_0x30febb,_0x55808d,_0x381ddd){var _0x3f3a7a;var _0x19c653='';var _0x48824d=_0x669b('0x5b');return db[_0x669b('0x2f')][_0x669b('0x51')]({'where':{'id':_0x30febb[_0x669b('0x4a')]['id']},'attributes':['id','remoteUri',_0x669b('0x5c'),'clientSecret','username',_0x669b('0x5d'),_0x669b('0x5e')]})[_0x669b('0x29')](handleEntityNotFound(_0x55808d,null))[_0x669b('0x29')](function(_0x4410eb){if(_0x4410eb){_0x19c653=_0x4410eb[_0x669b('0x5f')];var _0x284df0=_0x19c653[_0x669b('0x60')](-0x1);if(_0x284df0==='/'){_0x19c653=_0x19c653[_0x669b('0x61')](0x0,_0x19c653['lastIndexOf'](_0x284df0));}_0x3f3a7a=new jsforce[(_0x669b('0x62'))]({'oauth2':{'loginUrl':_0x19c653,'clientId':_0x4410eb['clientId'],'clientSecret':_0x4410eb['clientSecret']}});return _0x3f3a7a[_0x669b('0x63')](_0x4410eb[_0x669b('0x64')],_0x4410eb[_0x669b('0x5d')][_0x669b('0x65')](_0x4410eb[_0x669b('0x5e')]));}})[_0x669b('0x29')](function(_0x5b7e93){if(_0x5b7e93){if(!_[_0x669b('0x66')](_0x30febb[_0x669b('0x36')]['ticketType'])){_0x48824d=_0x30febb[_0x669b('0x36')][_0x669b('0x67')];}return _0x3f3a7a[_0x669b('0x68')](_0x48824d)[_0x669b('0x69')]();}})['then'](function(_0x3dfd9e){var _0x18ee9b=['OwnerId','ActivityDate','IsReminderSet',_0x669b('0x6a'),_0x669b('0x6b'),_0x669b('0x6c')];var _0x3b0057=[_0x669b('0x6d'),'int','picklist','boolean',_0x669b('0x6e'),_0x669b('0x6f'),'phone'];if(_0x3dfd9e){_[_0x669b('0x70')](_0x3dfd9e[_0x669b('0x3a')],function(_0x53fe5d){return _0x18ee9b[_0x669b('0x71')](_0x53fe5d['name'])||!_0x3b0057['includes'](_0x53fe5d[_0x669b('0x32')]);});return{'count':_0x3dfd9e[_0x669b('0x3a')]['length'],'rows':_[_0x669b('0x35')](_0x3dfd9e[_0x669b('0x3a')],function(_0x328f6b){return{'id':_0x328f6b['name'],'name':_0x328f6b[_0x669b('0x72')],'custom':_0x328f6b['custom'],'options':_0x328f6b[_0x669b('0x73')][_0x669b('0x3b')]>0x0?_[_0x669b('0x35')](_0x328f6b['picklistValues'],function(_0x32462e){return{'name':_0x32462e['label'],'value':_0x32462e[_0x669b('0x74')]};}):_0x328f6b[_0x669b('0x32')]==_0x669b('0x75')?[{'name':_0x669b('0x76'),'value':_0x669b('0x77')},{'name':_0x669b('0x78'),'value':_0x669b('0x79')}]:[]};})};}})[_0x669b('0x29')](respondWithResult(_0x55808d,null))[_0x669b('0x49')](function(_0x5d2a13){var _0x8c9ac=_0x30febb[_0x669b('0x36')][_0x669b('0x7a')]?0x1f4:_0x5d2a13['statusCode']||0x1f4;logger[_0x669b('0x2a')](_0x669b('0x7b'),_0x669b('0x5a'),_0x8c9ac,JSON[_0x669b('0x7c')](_0x5d2a13));delete _0x5d2a13[_0x669b('0x2c')];if(_0x8c9ac===0x191){_0x8c9ac=0x190;}_0x55808d[_0x669b('0x1e')](_0x8c9ac)['send'](_0x30febb[_0x669b('0x36')][_0x669b('0x7a')]?{'message':_0x669b('0x7d'),'statusCode':_0x5d2a13['statusCode']}:_0x5d2a13);});}; \ No newline at end of file +var _0x4950=['model','map','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','merge','SalesforceAccount','includeAll','catch','show','params','fields','options','create','body','find','getConfigurations','addConfiguration','AccountId','getSubjects','channel','Descriptions','getDescriptions','SalesforceConfiguration','SalesforceField','Subjects','getFields','findOne','remoteUri','clientSecret','password','slice','substring','lastIndexOf','Connection','clientId','concat','securityToken','isNil','ticketType','sobject','describe','OwnerId','Subject','string','int','picklist','boolean','remove','includes','label','picklistValues','value','False','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','send','Wrong\x20credentials','eml-format','rimraf','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','json','offset','limit','undefined','count','set','save','update','then','destroy','end','sendStatus','error','stack','name','rawAttributes','fieldName','key'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4950,0x12f));var _0x0495=function(_0x458832,_0x10b8cf){_0x458832=_0x458832-0x0;var _0x56f6c5=_0x4950[_0x458832];return _0x56f6c5;};'use strict';var emlformat=require(_0x0495('0x0'));var rimraf=require(_0x0495('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0495('0x2'));var BPromise=require(_0x0495('0x3'));var Mustache=require('mustache');var util=require(_0x0495('0x4'));var path=require(_0x0495('0x5'));var sox=require(_0x0495('0x6'));var csv=require(_0x0495('0x7'));var ejs=require(_0x0495('0x8'));var fs=require('fs');var fs_extra=require(_0x0495('0x9'));var _=require(_0x0495('0xa'));var squel=require(_0x0495('0xb'));var crypto=require(_0x0495('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x0495('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x0495('0xe'));var authService=require(_0x0495('0xf'));var qs=require(_0x0495('0x10'));var as=require(_0x0495('0x11'));var hardwareService=require(_0x0495('0x12'));var logger=require(_0x0495('0x13'))(_0x0495('0x14'));var utils=require(_0x0495('0x15'));var config=require(_0x0495('0x16'));var licenseUtil=require(_0x0495('0x17'));var db=require(_0x0495('0x18'))['db'];var integrations=require(_0x0495('0x19'));function respondWithStatusCode(_0xe5812,_0x3945ea){_0x3945ea=_0x3945ea||0xcc;return function(_0x4d2539){if(_0x4d2539){return _0xe5812['sendStatus'](_0x3945ea);}return _0xe5812[_0x0495('0x1a')](_0x3945ea)['end']();};}function respondWithResult(_0x11d7d7,_0x592fac){_0x592fac=_0x592fac||0xc8;return function(_0x47ad99){if(_0x47ad99){return _0x11d7d7[_0x0495('0x1a')](_0x592fac)[_0x0495('0x1b')](_0x47ad99);}};}function respondWithFilteredResult(_0x4dd12c,_0x478391){return function(_0x199467){if(_0x199467){var _0xf99cfc=typeof _0x478391[_0x0495('0x1c')]==='undefined'&&typeof _0x478391[_0x0495('0x1d')]===_0x0495('0x1e');var _0x4ea8ef=_0x199467[_0x0495('0x1f')];var _0x2dc2c9=_0xf99cfc?0x0:_0x478391[_0x0495('0x1c')];var _0x3e406c=_0xf99cfc?_0x199467['count']:_0x478391[_0x0495('0x1c')]+_0x478391[_0x0495('0x1d')];var _0x13c64c;if(_0x3e406c>=_0x4ea8ef){_0x3e406c=_0x4ea8ef;_0x13c64c=0xc8;}else{_0x13c64c=0xce;}_0x4dd12c[_0x0495('0x1a')](_0x13c64c);return _0x4dd12c[_0x0495('0x20')]('Content-Range',_0x2dc2c9+'-'+_0x3e406c+'/'+_0x4ea8ef)[_0x0495('0x1b')](_0x199467);}return null;};}function patchUpdates(_0x54f43b){return function(_0x165e29){try{jsonpatch['apply'](_0x165e29,_0x54f43b,!![]);}catch(_0x1442e9){return BPromise['reject'](_0x1442e9);}return _0x165e29[_0x0495('0x21')]();};}function saveUpdates(_0x57366b,_0x5d2738){return function(_0x3aa3cb){if(_0x3aa3cb){return _0x3aa3cb[_0x0495('0x22')](_0x57366b)[_0x0495('0x23')](function(_0x3bfe7f){return _0x3bfe7f;});}return null;};}function removeEntity(_0x33be6f,_0x3d3d47){return function(_0x50073e){if(_0x50073e){return _0x50073e[_0x0495('0x24')]()[_0x0495('0x23')](function(){_0x33be6f[_0x0495('0x1a')](0xcc)[_0x0495('0x25')]();});}};}function handleEntityNotFound(_0x30c045,_0x16f7bd){return function(_0xccfbea){if(!_0xccfbea){_0x30c045[_0x0495('0x26')](0x194);}return _0xccfbea;};}function handleError(_0x3de204,_0x437d59){_0x437d59=_0x437d59||0x1f4;return function(_0x116d24){logger[_0x0495('0x27')](_0x116d24[_0x0495('0x28')]);if(_0x116d24[_0x0495('0x29')]){delete _0x116d24['name'];}_0x3de204[_0x0495('0x1a')](_0x437d59)['send'](_0x116d24);};}exports['index']=function(_0x50ee6d,_0x40f05d){var _0x55fd7b={},_0x214355={},_0xad9933={'count':0x0,'rows':[]};var _0x5b2d0c=_['map'](db['SalesforceAccount'][_0x0495('0x2a')],function(_0x470c49){return{'name':_0x470c49[_0x0495('0x2b')],'type':_0x470c49['type'][_0x0495('0x2c')]};});_0x214355[_0x0495('0x2d')]=_[_0x0495('0x2e')](_0x5b2d0c,_0x0495('0x29'));_0x214355[_0x0495('0x2f')]=_[_0x0495('0x30')](_0x50ee6d['query']);_0x214355[_0x0495('0x31')]=_[_0x0495('0x32')](_0x214355[_0x0495('0x2d')],_0x214355[_0x0495('0x2f')]);_0x55fd7b[_0x0495('0x33')]=_[_0x0495('0x32')](_0x214355[_0x0495('0x2d')],qs['fields'](_0x50ee6d['query']['fields']));_0x55fd7b['attributes']=_0x55fd7b[_0x0495('0x33')][_0x0495('0x34')]?_0x55fd7b[_0x0495('0x33')]:_0x214355[_0x0495('0x2d')];if(!_0x50ee6d[_0x0495('0x2f')][_0x0495('0x35')](_0x0495('0x36'))){_0x55fd7b[_0x0495('0x1d')]=qs[_0x0495('0x1d')](_0x50ee6d[_0x0495('0x2f')][_0x0495('0x1d')]);_0x55fd7b[_0x0495('0x1c')]=qs[_0x0495('0x1c')](_0x50ee6d[_0x0495('0x2f')][_0x0495('0x1c')]);}_0x55fd7b[_0x0495('0x37')]=qs['sort'](_0x50ee6d[_0x0495('0x2f')][_0x0495('0x38')]);_0x55fd7b[_0x0495('0x39')]=qs[_0x0495('0x31')](_[_0x0495('0x3a')](_0x50ee6d[_0x0495('0x2f')],_0x214355[_0x0495('0x31')]),_0x5b2d0c);if(_0x50ee6d['query'][_0x0495('0x3b')]){_0x55fd7b[_0x0495('0x39')]=_['merge'](_0x55fd7b[_0x0495('0x39')],{'$or':_[_0x0495('0x2e')](_0x5b2d0c,function(_0xfdc39d){if(_0xfdc39d[_0x0495('0x3c')]!=='VIRTUAL'){var _0x2eec2b={};_0x2eec2b[_0xfdc39d[_0x0495('0x29')]]={'$like':'%'+_0x50ee6d[_0x0495('0x2f')]['filter']+'%'};return _0x2eec2b;}})});}_0x55fd7b=_[_0x0495('0x3d')]({},_0x55fd7b,_0x50ee6d['options']);var _0x8b40ed={'where':_0x55fd7b[_0x0495('0x39')]};return db[_0x0495('0x3e')]['count'](_0x8b40ed)['then'](function(_0x3517f9){_0xad9933['count']=_0x3517f9;if(_0x50ee6d[_0x0495('0x2f')][_0x0495('0x3f')]){_0x55fd7b['include']=[{'all':!![]}];}return db[_0x0495('0x3e')]['findAll'](_0x55fd7b);})['then'](function(_0x391c4d){_0xad9933['rows']=_0x391c4d;return _0xad9933;})[_0x0495('0x23')](respondWithFilteredResult(_0x40f05d,_0x55fd7b))[_0x0495('0x40')](handleError(_0x40f05d,null));};exports[_0x0495('0x41')]=function(_0x138938,_0x285e9d){var _0x40f607={'raw':![],'where':{'id':_0x138938[_0x0495('0x42')]['id']}},_0x59fc7d={};_0x59fc7d[_0x0495('0x2d')]=_['keys'](db['SalesforceAccount'][_0x0495('0x2a')]);_0x59fc7d['query']=_[_0x0495('0x30')](_0x138938['query']);_0x59fc7d['filters']=_[_0x0495('0x32')](_0x59fc7d[_0x0495('0x2d')],_0x59fc7d[_0x0495('0x2f')]);_0x40f607[_0x0495('0x33')]=_[_0x0495('0x32')](_0x59fc7d[_0x0495('0x2d')],qs[_0x0495('0x43')](_0x138938['query'][_0x0495('0x43')]));_0x40f607[_0x0495('0x33')]=_0x40f607[_0x0495('0x33')]['length']?_0x40f607['attributes']:_0x59fc7d[_0x0495('0x2d')];if(_0x138938['query'][_0x0495('0x3f')]){_0x40f607['include']=[{'all':!![]}];}_0x40f607=_[_0x0495('0x3d')]({},_0x40f607,_0x138938[_0x0495('0x44')]);return db[_0x0495('0x3e')]['find'](_0x40f607)[_0x0495('0x23')](handleEntityNotFound(_0x285e9d,null))[_0x0495('0x23')](respondWithResult(_0x285e9d,null))[_0x0495('0x40')](handleError(_0x285e9d,null));};exports[_0x0495('0x45')]=function(_0x572fcd,_0x274b70){return db[_0x0495('0x3e')][_0x0495('0x45')](_0x572fcd['body'],{})[_0x0495('0x23')](respondWithResult(_0x274b70,0xc9))['catch'](handleError(_0x274b70,null));};exports[_0x0495('0x22')]=function(_0x2b6050,_0x11ed92){if(_0x2b6050[_0x0495('0x46')]['id']){delete _0x2b6050['body']['id'];}return db[_0x0495('0x3e')][_0x0495('0x47')]({'where':{'id':_0x2b6050['params']['id']}})[_0x0495('0x23')](handleEntityNotFound(_0x11ed92,null))['then'](saveUpdates(_0x2b6050[_0x0495('0x46')],null))[_0x0495('0x23')](respondWithResult(_0x11ed92,null))[_0x0495('0x40')](handleError(_0x11ed92,null));};exports[_0x0495('0x24')]=function(_0x56dd5b,_0xe117fd){return db[_0x0495('0x3e')]['find']({'where':{'id':_0x56dd5b[_0x0495('0x42')]['id']}})[_0x0495('0x23')](handleEntityNotFound(_0xe117fd,null))[_0x0495('0x23')](removeEntity(_0xe117fd,null))[_0x0495('0x40')](handleError(_0xe117fd,null));};exports[_0x0495('0x48')]=function(_0x128439,_0x36492f,_0x1bc0be){var _0x41e504={};var _0x134fc9={};var _0x1c1e1e;var _0x5c174b;return db[_0x0495('0x3e')]['findOne']({'where':{'id':_0x128439[_0x0495('0x42')]['id']}})[_0x0495('0x23')](handleEntityNotFound(_0x36492f,null))['then'](function(_0x7fa088){if(_0x7fa088){_0x1c1e1e=_0x7fa088;_0x134fc9[_0x0495('0x2d')]=_[_0x0495('0x30')](db['SalesforceConfiguration'][_0x0495('0x2a')]);_0x134fc9[_0x0495('0x2f')]=_[_0x0495('0x30')](_0x128439[_0x0495('0x2f')]);_0x134fc9[_0x0495('0x31')]=_[_0x0495('0x32')](_0x134fc9[_0x0495('0x2d')],_0x134fc9[_0x0495('0x2f')]);_0x41e504[_0x0495('0x33')]=_['intersection'](_0x134fc9['model'],qs[_0x0495('0x43')](_0x128439[_0x0495('0x2f')][_0x0495('0x43')]));_0x41e504['attributes']=_0x41e504[_0x0495('0x33')][_0x0495('0x34')]?_0x41e504[_0x0495('0x33')]:_0x134fc9[_0x0495('0x2d')];_0x41e504[_0x0495('0x37')]=qs[_0x0495('0x38')](_0x128439[_0x0495('0x2f')][_0x0495('0x38')]);_0x41e504['where']=qs[_0x0495('0x31')](_[_0x0495('0x3a')](_0x128439[_0x0495('0x2f')],_0x134fc9['filters']));if(_0x128439[_0x0495('0x2f')][_0x0495('0x3b')]){_0x41e504['where']=_[_0x0495('0x3d')](_0x41e504[_0x0495('0x39')],{'$or':_[_0x0495('0x2e')](_0x41e504[_0x0495('0x33')],function(_0x111379){var _0x1a6410={};_0x1a6410[_0x111379]={'$like':'%'+_0x128439[_0x0495('0x2f')][_0x0495('0x3b')]+'%'};return _0x1a6410;})});}_0x41e504=_[_0x0495('0x3d')]({},_0x41e504,_0x128439['options']);return _0x1c1e1e[_0x0495('0x48')](_0x41e504);}})['then'](function(_0x45059a){if(_0x45059a){_0x5c174b=_0x45059a[_0x0495('0x34')];if(!_0x128439[_0x0495('0x2f')][_0x0495('0x35')](_0x0495('0x36'))){_0x41e504[_0x0495('0x1d')]=qs[_0x0495('0x1d')](_0x128439[_0x0495('0x2f')]['limit']);_0x41e504['offset']=qs['offset'](_0x128439['query'][_0x0495('0x1c')]);}return _0x1c1e1e['getConfigurations'](_0x41e504);}})['then'](function(_0x474ba4){if(_0x474ba4){return _0x474ba4?{'count':_0x5c174b,'rows':_0x474ba4}:null;}})[_0x0495('0x23')](respondWithResult(_0x36492f,null))['catch'](handleError(_0x36492f,null));};exports[_0x0495('0x49')]=function(_0x490144,_0xf37682,_0x223cf6){if(_0x490144[_0x0495('0x46')]['id']){delete _0x490144['body']['id'];}return db[_0x0495('0x3e')]['findOne']({'where':{'id':_0x490144['params']['id']}})[_0x0495('0x23')](handleEntityNotFound(_0xf37682,null))[_0x0495('0x23')](function(_0x48e8fb){if(_0x48e8fb){_0x490144[_0x0495('0x46')][_0x0495('0x4a')]=_0x48e8fb['id'];_0x490144[_0x0495('0x46')]['Subjects']=integrations[_0x0495('0x4b')](_0x490144[_0x0495('0x46')][_0x0495('0x4c')],_0x490144[_0x0495('0x46')][_0x0495('0x3c')]);_0x490144['body'][_0x0495('0x4d')]=integrations[_0x0495('0x4e')](_0x490144[_0x0495('0x46')]['channel'],_0x490144['body']['type']);return db[_0x0495('0x4f')][_0x0495('0x45')](_0x490144['body'],{'include':[{'model':db[_0x0495('0x50')],'as':_0x0495('0x51')},{'model':db[_0x0495('0x50')],'as':_0x0495('0x4d')}]});}return null;})[_0x0495('0x23')](respondWithResult(_0xf37682,null))['catch'](handleError(_0xf37682,null));};exports[_0x0495('0x52')]=function(_0x146fc7,_0x19e1a0,_0x4503e6){var _0x889b4;var _0x9e6b45='';var _0x12ae44='Task';return db[_0x0495('0x3e')][_0x0495('0x53')]({'where':{'id':_0x146fc7[_0x0495('0x42')]['id']},'attributes':['id',_0x0495('0x54'),'clientId',_0x0495('0x55'),'username',_0x0495('0x56'),'securityToken']})[_0x0495('0x23')](handleEntityNotFound(_0x19e1a0,null))[_0x0495('0x23')](function(_0x164027){if(_0x164027){_0x9e6b45=_0x164027['remoteUri'];var _0x5cd25f=_0x9e6b45[_0x0495('0x57')](-0x1);if(_0x5cd25f==='/'){_0x9e6b45=_0x9e6b45[_0x0495('0x58')](0x0,_0x9e6b45[_0x0495('0x59')](_0x5cd25f));}_0x889b4=new jsforce[(_0x0495('0x5a'))]({'oauth2':{'loginUrl':_0x9e6b45,'clientId':_0x164027[_0x0495('0x5b')],'clientSecret':_0x164027[_0x0495('0x55')]}});return _0x889b4['login'](_0x164027['username'],_0x164027[_0x0495('0x56')][_0x0495('0x5c')](_0x164027[_0x0495('0x5d')]));}})[_0x0495('0x23')](function(_0x3cc9c5){if(_0x3cc9c5){if(!_[_0x0495('0x5e')](_0x146fc7[_0x0495('0x2f')][_0x0495('0x5f')])){_0x12ae44=_0x146fc7[_0x0495('0x2f')]['ticketType'];}return _0x889b4[_0x0495('0x60')](_0x12ae44)[_0x0495('0x61')]();}})[_0x0495('0x23')](function(_0x1efc3c){var _0x2d1e0f=[_0x0495('0x62'),'ActivityDate','IsReminderSet','IsRecurrence',_0x0495('0x63'),'Description'];var _0x4b0025=[_0x0495('0x64'),_0x0495('0x65'),_0x0495('0x66'),_0x0495('0x67'),'email','textarea','phone'];if(_0x1efc3c){_[_0x0495('0x68')](_0x1efc3c[_0x0495('0x43')],function(_0x5c55cb){return _0x2d1e0f[_0x0495('0x69')](_0x5c55cb[_0x0495('0x29')])||!_0x4b0025[_0x0495('0x69')](_0x5c55cb['type']);});return{'count':_0x1efc3c[_0x0495('0x43')][_0x0495('0x34')],'rows':_[_0x0495('0x2e')](_0x1efc3c[_0x0495('0x43')],function(_0x4c9d0e){return{'id':_0x4c9d0e[_0x0495('0x29')],'name':_0x4c9d0e[_0x0495('0x6a')],'custom':_0x4c9d0e['custom'],'options':_0x4c9d0e['picklistValues']['length']>0x0?_[_0x0495('0x2e')](_0x4c9d0e[_0x0495('0x6b')],function(_0x4fa208){return{'name':_0x4fa208[_0x0495('0x6a')],'value':_0x4fa208[_0x0495('0x6c')]};}):_0x4c9d0e[_0x0495('0x3c')]==_0x0495('0x67')?[{'name':'True','value':'true'},{'name':_0x0495('0x6d'),'value':'false'}]:[]};})};}})[_0x0495('0x23')](respondWithResult(_0x19e1a0,null))['catch'](function(_0x224f58){var _0x196256=_0x146fc7[_0x0495('0x2f')][_0x0495('0x6e')]?0x1f4:_0x224f58[_0x0495('0x6f')]||0x1f4;logger[_0x0495('0x27')](_0x0495('0x70'),'getFields',_0x196256,JSON[_0x0495('0x71')](_0x224f58));delete _0x224f58[_0x0495('0x29')];if(_0x196256===0x191){_0x196256=0x190;}_0x19e1a0[_0x0495('0x1a')](_0x196256)[_0x0495('0x72')](_0x146fc7[_0x0495('0x2f')]['test']?{'message':_0x0495('0x73'),'statusCode':_0x224f58[_0x0495('0x6f')]}:_0x224f58);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index 3c0816f..6dc7a3d 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 _0xa923=['lodash','util','../../config/logger','moment','bluebird','rimraf','./intSalesforceAccount.attributes','exports','define','SalesforceAccount'];(function(_0x2d1481,_0x3404ce){var _0x2f8e06=function(_0x320670){while(--_0x320670){_0x2d1481['push'](_0x2d1481['shift']());}};_0x2f8e06(++_0x3404ce);}(_0xa923,0xc8));var _0x3a92=function(_0x5ac05b,_0x45e8ce){_0x5ac05b=_0x5ac05b-0x0;var _0x4e5369=_0xa923[_0x5ac05b];return _0x4e5369;};'use strict';var _=require(_0x3a92('0x0'));var util=require(_0x3a92('0x1'));var logger=require(_0x3a92('0x2'))('api');var moment=require(_0x3a92('0x3'));var BPromise=require(_0x3a92('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x3a92('0x5'));var config=require('../../config/environment');var attributes=require(_0x3a92('0x6'));var integrations=require('../../components/integrations/configuration');module[_0x3a92('0x7')]=function(_0x37407b,_0x3a1751){return _0x37407b[_0x3a92('0x8')](_0x3a92('0x9'),attributes,{'tableName':'int_salesforce_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0a9f=['../../components/integrations/configuration','define','SalesforceAccount','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intSalesforceAccount.attributes'];(function(_0x1aeb39,_0x2e8404){var _0x439790=function(_0x199911){while(--_0x199911){_0x1aeb39['push'](_0x1aeb39['shift']());}};_0x439790(++_0x2e8404);}(_0x0a9f,0x1b5));var _0xf0a9=function(_0x984097,_0x18e5bf){_0x984097=_0x984097-0x0;var _0x557b33=_0x0a9f[_0x984097];return _0x557b33;};'use strict';var _=require(_0xf0a9('0x0'));var util=require(_0xf0a9('0x1'));var logger=require(_0xf0a9('0x2'))(_0xf0a9('0x3'));var moment=require(_0xf0a9('0x4'));var BPromise=require(_0xf0a9('0x5'));var rp=require(_0xf0a9('0x6'));var fs=require('fs');var path=require(_0xf0a9('0x7'));var rimraf=require(_0xf0a9('0x8'));var config=require(_0xf0a9('0x9'));var attributes=require(_0xf0a9('0xa'));var integrations=require(_0xf0a9('0xb'));module['exports']=function(_0x24471f,_0x59adba){return _0x24471f[_0xf0a9('0xc')](_0xf0a9('0xd'),attributes,{'tableName':'int_salesforce_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.rpc.js b/server/api/intSalesforceAccount/intSalesforceAccount.rpc.js index 5aedc51..8efeb6e 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 _0x4b87=['GetSalesforceAccount','SalesforceAccount','findAll','options','raw','where','attributes','limit','include','model','map','find','ShowSalesforceAccount','debug','lodash','util','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','then','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch'];(function(_0x2d5c94,_0x4fb0b3){var _0x1e564f=function(_0x27336c){while(--_0x27336c){_0x2d5c94['push'](_0x2d5c94['shift']());}};_0x1e564f(++_0x4fb0b3);}(_0x4b87,0x1dc));var _0x74b8=function(_0x44fe9e,_0x2b9290){_0x44fe9e=_0x44fe9e-0x0;var _0x27161a=_0x4b87[_0x44fe9e];return _0x27161a;};'use strict';var _=require(_0x74b8('0x0'));var util=require(_0x74b8('0x1'));var moment=require('moment');var BPromise=require(_0x74b8('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x74b8('0x3'));var db=require(_0x74b8('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x74b8('0x5'))(_0x74b8('0x6'));var config=require('../../config/environment');var jayson=require(_0x74b8('0x7'));var client=jayson[_0x74b8('0x8')][_0x74b8('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xd25a67,_0x496f77,_0x515d49){return new BPromise(function(_0x539a30,_0x14a9c2){return client['request'](_0xd25a67,_0x515d49)[_0x74b8('0xa')](function(_0x340c0d){logger[_0x74b8('0xb')](_0x74b8('0xc'),_0x496f77,'request\x20sent');logger['debug']('SalesforceAccount,\x20%s,\x20%s,\x20%s',_0x496f77,_0x74b8('0xd'),JSON[_0x74b8('0xe')](_0x340c0d));if(_0x340c0d[_0x74b8('0xf')]){if(_0x340c0d[_0x74b8('0xf')]['code']===0x1f4){logger[_0x74b8('0xf')](_0x74b8('0xc'),_0x496f77,_0x340c0d[_0x74b8('0xf')][_0x74b8('0x10')]);return _0x14a9c2(_0x340c0d[_0x74b8('0xf')][_0x74b8('0x10')]);}logger[_0x74b8('0xf')]('SalesforceAccount,\x20%s,\x20%s',_0x496f77,_0x340c0d['error'][_0x74b8('0x10')]);return _0x539a30(_0x340c0d[_0x74b8('0xf')][_0x74b8('0x10')]);}else{logger['info'](_0x74b8('0xc'),_0x496f77,_0x74b8('0xd'));_0x539a30(_0x340c0d[_0x74b8('0x11')][_0x74b8('0x10')]);}})[_0x74b8('0x12')](function(_0x4aefca){logger[_0x74b8('0xf')](_0x74b8('0xc'),_0x496f77,_0x4aefca);_0x14a9c2(_0x4aefca);});});}exports[_0x74b8('0x13')]=function(_0x49e7d2){var _0x45ec2b=this;return new Promise(function(_0xa84637,_0x341109){return db[_0x74b8('0x14')][_0x74b8('0x15')]({'raw':_0x49e7d2[_0x74b8('0x16')]?_0x49e7d2[_0x74b8('0x16')][_0x74b8('0x17')]===undefined?!![]:![]:!![],'where':_0x49e7d2[_0x74b8('0x16')]?_0x49e7d2['options'][_0x74b8('0x18')]||null:null,'attributes':_0x49e7d2[_0x74b8('0x16')]?_0x49e7d2[_0x74b8('0x16')][_0x74b8('0x19')]||null:null,'limit':_0x49e7d2['options']?_0x49e7d2[_0x74b8('0x16')][_0x74b8('0x1a')]||null:null,'include':_0x49e7d2[_0x74b8('0x16')]?_0x49e7d2[_0x74b8('0x16')][_0x74b8('0x1b')]?_['map'](_0x49e7d2[_0x74b8('0x16')][_0x74b8('0x1b')],function(_0x42e09c){return{'model':db[_0x42e09c[_0x74b8('0x1c')]],'as':_0x42e09c['as'],'attributes':_0x42e09c[_0x74b8('0x19')],'include':_0x42e09c[_0x74b8('0x1b')]?_[_0x74b8('0x1d')](_0x42e09c[_0x74b8('0x1b')],function(_0x38a9a4){return{'model':db[_0x38a9a4['model']],'as':_0x38a9a4['as'],'attributes':_0x38a9a4['attributes'],'include':_0x38a9a4[_0x74b8('0x1b')]?_[_0x74b8('0x1d')](_0x38a9a4[_0x74b8('0x1b')],function(_0x12b59f){return{'model':db[_0x12b59f[_0x74b8('0x1c')]],'as':_0x12b59f['as'],'attributes':_0x12b59f[_0x74b8('0x19')]};}):[]};}):[]};}):[]:[]})[_0x74b8('0xa')](function(_0x26a27a){logger[_0x74b8('0xb')]('GetSalesforceAccount',_0x49e7d2);logger['debug'](_0x74b8('0x13'),_0x49e7d2,JSON[_0x74b8('0xe')](_0x26a27a));_0xa84637(_0x26a27a);})['catch'](function(_0x4a18b6){logger[_0x74b8('0xf')](_0x74b8('0x13'),_0x4a18b6[_0x74b8('0x10')],_0x49e7d2);_0x341109(_0x45ec2b[_0x74b8('0xf')](0x1f4,_0x4a18b6[_0x74b8('0x10')]));});});};exports['ShowSalesforceAccount']=function(_0x286e4e){var _0x3a257e=this;return new Promise(function(_0x47eee6,_0x35de79){return db['SalesforceAccount'][_0x74b8('0x1e')]({'raw':_0x286e4e[_0x74b8('0x16')]?_0x286e4e['options']['raw']===undefined?!![]:![]:!![],'where':_0x286e4e['options']?_0x286e4e['options'][_0x74b8('0x18')]||null:null,'attributes':_0x286e4e['options']?_0x286e4e[_0x74b8('0x16')]['attributes']||null:null,'include':_0x286e4e[_0x74b8('0x16')]?_0x286e4e['options'][_0x74b8('0x1b')]?_[_0x74b8('0x1d')](_0x286e4e['options'][_0x74b8('0x1b')],function(_0x5bee7c){return{'model':db[_0x5bee7c['model']],'as':_0x5bee7c['as'],'attributes':_0x5bee7c[_0x74b8('0x19')],'include':_0x5bee7c[_0x74b8('0x1b')]?_[_0x74b8('0x1d')](_0x5bee7c[_0x74b8('0x1b')],function(_0x2e3b08){return{'model':db[_0x2e3b08[_0x74b8('0x1c')]],'as':_0x2e3b08['as'],'attributes':_0x2e3b08[_0x74b8('0x19')],'include':_0x2e3b08[_0x74b8('0x1b')]?_[_0x74b8('0x1d')](_0x2e3b08['include'],function(_0x28a28a){return{'model':db[_0x28a28a[_0x74b8('0x1c')]],'as':_0x28a28a['as'],'attributes':_0x28a28a['attributes']};}):[]};}):[]};}):[]:[]})[_0x74b8('0xa')](function(_0x140faa){logger[_0x74b8('0xb')](_0x74b8('0x1f'),_0x286e4e);logger[_0x74b8('0x20')]('ShowSalesforceAccount',_0x286e4e,JSON['stringify'](_0x140faa));_0x47eee6(_0x140faa);})['catch'](function(_0x317d08){logger[_0x74b8('0xf')]('ShowSalesforceAccount',_0x317d08[_0x74b8('0x10')],_0x286e4e);_0x35de79(_0x3a257e[_0x74b8('0xf')](0x1f4,_0x317d08['message']));});});}; \ No newline at end of file +var _0x156d=['request','then','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetSalesforceAccount','SalesforceAccount','findAll','options','raw','limit','include','model','attributes','info','find','map','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','client','http'];(function(_0x332748,_0x11c199){var _0x3e1563=function(_0x209186){while(--_0x209186){_0x332748['push'](_0x332748['shift']());}};_0x3e1563(++_0x11c199);}(_0x156d,0x162));var _0xd156=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x156d[_0xfae23b];return _0x200640;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xd156('0x0'));var BPromise=require(_0xd156('0x1'));var rs=require(_0xd156('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xd156('0x3'));var logger=require(_0xd156('0x4'))(_0xd156('0x5'));var config=require(_0xd156('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xd156('0x7')][_0xd156('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x145bb1,_0x1a60e3,_0x2c1acf){return new BPromise(function(_0x57f77e,_0x273275){return client[_0xd156('0x9')](_0x145bb1,_0x2c1acf)[_0xd156('0xa')](function(_0x13418a){logger['info'](_0xd156('0xb'),_0x1a60e3,_0xd156('0xc'));logger[_0xd156('0xd')](_0xd156('0xe'),_0x1a60e3,_0xd156('0xc'),JSON[_0xd156('0xf')](_0x13418a));if(_0x13418a[_0xd156('0x10')]){if(_0x13418a['error'][_0xd156('0x11')]===0x1f4){logger['error'](_0xd156('0xb'),_0x1a60e3,_0x13418a[_0xd156('0x10')][_0xd156('0x12')]);return _0x273275(_0x13418a[_0xd156('0x10')][_0xd156('0x12')]);}logger[_0xd156('0x10')](_0xd156('0xb'),_0x1a60e3,_0x13418a[_0xd156('0x10')][_0xd156('0x12')]);return _0x57f77e(_0x13418a[_0xd156('0x10')][_0xd156('0x12')]);}else{logger['info']('SalesforceAccount,\x20%s,\x20%s',_0x1a60e3,'request\x20sent');_0x57f77e(_0x13418a[_0xd156('0x13')][_0xd156('0x12')]);}})[_0xd156('0x14')](function(_0x2c2ef3){logger['error'](_0xd156('0xb'),_0x1a60e3,_0x2c2ef3);_0x273275(_0x2c2ef3);});});}exports[_0xd156('0x15')]=function(_0x265b5e){var _0x551352=this;return new Promise(function(_0x39008e,_0x2ae101){return db[_0xd156('0x16')][_0xd156('0x17')]({'raw':_0x265b5e[_0xd156('0x18')]?_0x265b5e[_0xd156('0x18')][_0xd156('0x19')]===undefined?!![]:![]:!![],'where':_0x265b5e[_0xd156('0x18')]?_0x265b5e[_0xd156('0x18')]['where']||null:null,'attributes':_0x265b5e[_0xd156('0x18')]?_0x265b5e['options']['attributes']||null:null,'limit':_0x265b5e[_0xd156('0x18')]?_0x265b5e[_0xd156('0x18')][_0xd156('0x1a')]||null:null,'include':_0x265b5e[_0xd156('0x18')]?_0x265b5e[_0xd156('0x18')][_0xd156('0x1b')]?_['map'](_0x265b5e[_0xd156('0x18')][_0xd156('0x1b')],function(_0x34042d){return{'model':db[_0x34042d['model']],'as':_0x34042d['as'],'attributes':_0x34042d['attributes'],'include':_0x34042d['include']?_['map'](_0x34042d[_0xd156('0x1b')],function(_0x1b4923){return{'model':db[_0x1b4923[_0xd156('0x1c')]],'as':_0x1b4923['as'],'attributes':_0x1b4923[_0xd156('0x1d')],'include':_0x1b4923[_0xd156('0x1b')]?_['map'](_0x1b4923[_0xd156('0x1b')],function(_0x491e21){return{'model':db[_0x491e21[_0xd156('0x1c')]],'as':_0x491e21['as'],'attributes':_0x491e21[_0xd156('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4a8ec2){logger[_0xd156('0x1e')]('GetSalesforceAccount',_0x265b5e);logger['debug'](_0xd156('0x15'),_0x265b5e,JSON[_0xd156('0xf')](_0x4a8ec2));_0x39008e(_0x4a8ec2);})[_0xd156('0x14')](function(_0x3253b0){logger[_0xd156('0x10')]('GetSalesforceAccount',_0x3253b0[_0xd156('0x12')],_0x265b5e);_0x2ae101(_0x551352[_0xd156('0x10')](0x1f4,_0x3253b0[_0xd156('0x12')]));});});};exports['ShowSalesforceAccount']=function(_0x164716){var _0x5c1715=this;return new Promise(function(_0x891eb9,_0x2c7604){return db[_0xd156('0x16')][_0xd156('0x1f')]({'raw':_0x164716[_0xd156('0x18')]?_0x164716[_0xd156('0x18')][_0xd156('0x19')]===undefined?!![]:![]:!![],'where':_0x164716[_0xd156('0x18')]?_0x164716[_0xd156('0x18')]['where']||null:null,'attributes':_0x164716[_0xd156('0x18')]?_0x164716[_0xd156('0x18')][_0xd156('0x1d')]||null:null,'include':_0x164716[_0xd156('0x18')]?_0x164716[_0xd156('0x18')][_0xd156('0x1b')]?_[_0xd156('0x20')](_0x164716['options'][_0xd156('0x1b')],function(_0x5f3046){return{'model':db[_0x5f3046[_0xd156('0x1c')]],'as':_0x5f3046['as'],'attributes':_0x5f3046[_0xd156('0x1d')],'include':_0x5f3046['include']?_[_0xd156('0x20')](_0x5f3046[_0xd156('0x1b')],function(_0x2471e4){return{'model':db[_0x2471e4[_0xd156('0x1c')]],'as':_0x2471e4['as'],'attributes':_0x2471e4[_0xd156('0x1d')],'include':_0x2471e4[_0xd156('0x1b')]?_[_0xd156('0x20')](_0x2471e4[_0xd156('0x1b')],function(_0x16fe53){return{'model':db[_0x16fe53[_0xd156('0x1c')]],'as':_0x16fe53['as'],'attributes':_0x16fe53['attributes']};}):[]};}):[]};}):[]:[]})[_0xd156('0xa')](function(_0x114dce){logger[_0xd156('0x1e')]('ShowSalesforceAccount',_0x164716);logger[_0xd156('0xd')]('ShowSalesforceAccount',_0x164716,JSON[_0xd156('0xf')](_0x114dce));_0x891eb9(_0x114dce);})[_0xd156('0x14')](function(_0x26b443){logger['error']('ShowSalesforceAccount',_0x26b443[_0xd156('0x12')],_0x164716);_0x2c7604(_0x5c1715[_0xd156('0x10')](0x1f4,_0x26b443[_0xd156('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index 894d8bd..59fbf2e 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 _0x2032=['Router','fs-extra','../../components/interaction/service','../../config/environment','./intSalesforceConfiguration.controller','get','isAuthenticated','index','/:id','show','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','create','exports','util','path','connect-timeout'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x2032,0xd9));var _0x2203=function(_0x1610fb,_0x571498){_0x1610fb=_0x1610fb-0x0;var _0x4bf6d5=_0x2032[_0x1610fb];return _0x4bf6d5;};'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/fields',auth['isAuthenticated'](),controller[_0x2203('0xd')]);router['get'](_0x2203('0xe'),auth[_0x2203('0x9')](),controller[_0x2203('0xf')]);router['get'](_0x2203('0x10'),auth['isAuthenticated'](),controller[_0x2203('0x11')]);router['post']('/',auth[_0x2203('0x9')](),controller[_0x2203('0x12')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router['delete'](_0x2203('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0x2203('0x13')]=router; \ No newline at end of file +var _0x7a54=['getSubjects','getDescriptions','post','create','put','update','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceConfiguration.controller','get','index','/:id','isAuthenticated','/:id/subjects'];(function(_0x29947b,_0x547eae){var _0x44cb43=function(_0x111eb9){while(--_0x111eb9){_0x29947b['push'](_0x29947b['shift']());}};_0x44cb43(++_0x547eae);}(_0x7a54,0x106));var _0x47a5=function(_0x3879f2,_0x1be3d5){_0x3879f2=_0x3879f2-0x0;var _0x11469b=_0x7a54[_0x3879f2];return _0x11469b;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x47a5('0x5'));var interaction=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var controller=require(_0x47a5('0x8'));router[_0x47a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['show']);router[_0x47a5('0x9')]('/:id/fields',auth['isAuthenticated'](),controller['getFields']);router[_0x47a5('0x9')](_0x47a5('0xd'),auth['isAuthenticated'](),controller[_0x47a5('0xe')]);router['get']('/:id/descriptions',auth[_0x47a5('0xc')](),controller[_0x47a5('0xf')]);router[_0x47a5('0x10')]('/',auth[_0x47a5('0xc')](),controller[_0x47a5('0x11')]);router[_0x47a5('0x12')](_0x47a5('0xb'),auth['isAuthenticated'](),controller[_0x47a5('0x13')]);router[_0x47a5('0x14')](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x15')]);module[_0x47a5('0x16')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js index bbb1795..2a81cd9 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 _0x60fc=['exports','STRING','Task','Case','lead','account_contact_lead','contact','account','sequelize'];(function(_0xba606b,_0x2d93ba){var _0x1c036a=function(_0x75c4ad){while(--_0x75c4ad){_0xba606b['push'](_0xba606b['shift']());}};_0x1c036a(++_0x2d93ba);}(_0x60fc,0x128));var _0xc60f=function(_0x19ad6b,_0x53abda){_0x19ad6b=_0x19ad6b-0x0;var _0x32ad40=_0x60fc[_0x19ad6b];return _0x32ad40;};'use strict';var Sequelize=require(_0xc60f('0x0'));module[_0xc60f('0x1')]={'name':{'type':Sequelize[_0xc60f('0x2')]},'description':{'type':Sequelize[_0xc60f('0x2')]},'ticketType':{'type':Sequelize['ENUM'](_0xc60f('0x3'),_0xc60f('0x4')),'defaultValue':_0xc60f('0x3')},'moduleSearch':{'type':Sequelize['ENUM']('contact_lead','contact',_0xc60f('0x5'),_0xc60f('0x6'),'account'),'defaultValue':'contact_lead'},'moduleCreate':{'type':Sequelize['ENUM']('nothing',_0xc60f('0x7'),_0xc60f('0x5'),_0xc60f('0x8')),'defaultValue':_0xc60f('0x5')},'leadId':{'type':Sequelize[_0xc60f('0x2')]},'additionalSearchAccount':{'type':Sequelize[_0xc60f('0x2')]},'additionalSearchContact':{'type':Sequelize[_0xc60f('0x2')]},'additionalSearchLead':{'type':Sequelize[_0xc60f('0x2')]}}; \ No newline at end of file +var _0x5305=['ENUM','Task','account_contact_lead','contact_lead','nothing','contact','lead','account','exports','STRING'];(function(_0x43d11d,_0xccff91){var _0x38cd08=function(_0x131ae2){while(--_0x131ae2){_0x43d11d['push'](_0x43d11d['shift']());}};_0x38cd08(++_0xccff91);}(_0x5305,0x9e));var _0x5530=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x5305[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require('sequelize');module[_0x5530('0x0')]={'name':{'type':Sequelize[_0x5530('0x1')]},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize[_0x5530('0x2')]('Task','Case'),'defaultValue':_0x5530('0x3')},'moduleSearch':{'type':Sequelize[_0x5530('0x2')]('contact_lead','contact','lead',_0x5530('0x4'),'account'),'defaultValue':_0x5530('0x5')},'moduleCreate':{'type':Sequelize[_0x5530('0x2')](_0x5530('0x6'),_0x5530('0x7'),_0x5530('0x8'),_0x5530('0x9')),'defaultValue':_0x5530('0x8')},'leadId':{'type':Sequelize['STRING']},'additionalSearchAccount':{'type':Sequelize[_0x5530('0x1')]},'additionalSearchContact':{'type':Sequelize[_0x5530('0x1')]},'additionalSearchLead':{'type':Sequelize[_0x5530('0x1')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index 901a358..0d2d447 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 _0x1c3b=['findOne','rawAttributes','getSubjects','SalesforceField','getDescriptions','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','index','SalesforceConfiguration','fieldName','type','key','model','map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','update','getFields'];(function(_0x1ec618,_0x1b80cd){var _0x4112d0=function(_0x1c2c94){while(--_0x1c2c94){_0x1ec618['push'](_0x1ec618['shift']());}};_0x4112d0(++_0x1b80cd);}(_0x1c3b,0xab));var _0xb1c3=function(_0x3772e7,_0x14926d){_0x3772e7=_0x3772e7-0x0;var _0x5d5eff=_0x1c3b[_0x3772e7];return _0x5d5eff;};'use strict';var emlformat=require(_0xb1c3('0x0'));var rimraf=require(_0xb1c3('0x1'));var zipdir=require(_0xb1c3('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xb1c3('0x3'));var BPromise=require(_0xb1c3('0x4'));var Mustache=require(_0xb1c3('0x5'));var util=require(_0xb1c3('0x6'));var path=require(_0xb1c3('0x7'));var sox=require(_0xb1c3('0x8'));var csv=require('to-csv');var ejs=require(_0xb1c3('0x9'));var fs=require('fs');var fs_extra=require(_0xb1c3('0xa'));var _=require(_0xb1c3('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xb1c3('0xc'));var querystring=require('querystring');var Papa=require(_0xb1c3('0xd'));var Redis=require(_0xb1c3('0xe'));var authService=require(_0xb1c3('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xb1c3('0x10'));var hardwareService=require(_0xb1c3('0x11'));var logger=require(_0xb1c3('0x12'))('api');var utils=require(_0xb1c3('0x13'));var config=require(_0xb1c3('0x14'));var licenseUtil=require(_0xb1c3('0x15'));var db=require(_0xb1c3('0x16'))['db'];function respondWithStatusCode(_0x4dae53,_0xac2af8){_0xac2af8=_0xac2af8||0xcc;return function(_0x30ce26){if(_0x30ce26){return _0x4dae53[_0xb1c3('0x17')](_0xac2af8);}return _0x4dae53['status'](_0xac2af8)[_0xb1c3('0x18')]();};}function respondWithResult(_0x15de90,_0x57b6c9){_0x57b6c9=_0x57b6c9||0xc8;return function(_0x1eb0fa){if(_0x1eb0fa){return _0x15de90[_0xb1c3('0x19')](_0x57b6c9)[_0xb1c3('0x1a')](_0x1eb0fa);}};}function respondWithFilteredResult(_0x378d7a,_0x1bd7e7){return function(_0x4e5f43){if(_0x4e5f43){var _0x3397f0=typeof _0x1bd7e7[_0xb1c3('0x1b')]===_0xb1c3('0x1c')&&typeof _0x1bd7e7[_0xb1c3('0x1d')]===_0xb1c3('0x1c');var _0x599810=_0x4e5f43[_0xb1c3('0x1e')];var _0x2bdeed=_0x3397f0?0x0:_0x1bd7e7[_0xb1c3('0x1b')];var _0x36b25f=_0x3397f0?_0x4e5f43[_0xb1c3('0x1e')]:_0x1bd7e7[_0xb1c3('0x1b')]+_0x1bd7e7[_0xb1c3('0x1d')];var _0x3d0672;if(_0x36b25f>=_0x599810){_0x36b25f=_0x599810;_0x3d0672=0xc8;}else{_0x3d0672=0xce;}_0x378d7a[_0xb1c3('0x19')](_0x3d0672);return _0x378d7a[_0xb1c3('0x1f')](_0xb1c3('0x20'),_0x2bdeed+'-'+_0x36b25f+'/'+_0x599810)[_0xb1c3('0x1a')](_0x4e5f43);}return null;};}function patchUpdates(_0x10c351){return function(_0x5a0950){try{jsonpatch[_0xb1c3('0x21')](_0x5a0950,_0x10c351,!![]);}catch(_0x443040){return BPromise[_0xb1c3('0x22')](_0x443040);}return _0x5a0950[_0xb1c3('0x23')]();};}function saveUpdates(_0x8570d4,_0x236dd6){return function(_0x585d4b){if(_0x585d4b){return _0x585d4b['update'](_0x8570d4)[_0xb1c3('0x24')](function(_0x430a94){return _0x430a94;});}return null;};}function removeEntity(_0x59d11c,_0xdb96){return function(_0x3778fa){if(_0x3778fa){return _0x3778fa[_0xb1c3('0x25')]()[_0xb1c3('0x24')](function(){_0x59d11c['status'](0xcc)[_0xb1c3('0x18')]();});}};}function handleEntityNotFound(_0x1cefff,_0x3614ae){return function(_0x1bfd04){if(!_0x1bfd04){_0x1cefff[_0xb1c3('0x17')](0x194);}return _0x1bfd04;};}function handleError(_0x5c7f13,_0x31aabe){_0x31aabe=_0x31aabe||0x1f4;return function(_0xc6c566){logger[_0xb1c3('0x26')](_0xc6c566[_0xb1c3('0x27')]);if(_0xc6c566[_0xb1c3('0x28')]){delete _0xc6c566[_0xb1c3('0x28')];}_0x5c7f13[_0xb1c3('0x19')](_0x31aabe)[_0xb1c3('0x29')](_0xc6c566);};}exports[_0xb1c3('0x2a')]=function(_0x31ce8a,_0x1c2ed8){var _0x3a91bb={},_0x11eb58={},_0x5c335f={'count':0x0,'rows':[]};var _0x2b82ff=_['map'](db[_0xb1c3('0x2b')]['rawAttributes'],function(_0x295fae){return{'name':_0x295fae[_0xb1c3('0x2c')],'type':_0x295fae[_0xb1c3('0x2d')][_0xb1c3('0x2e')]};});_0x11eb58[_0xb1c3('0x2f')]=_[_0xb1c3('0x30')](_0x2b82ff,'name');_0x11eb58['query']=_[_0xb1c3('0x31')](_0x31ce8a[_0xb1c3('0x32')]);_0x11eb58[_0xb1c3('0x33')]=_[_0xb1c3('0x34')](_0x11eb58[_0xb1c3('0x2f')],_0x11eb58[_0xb1c3('0x32')]);_0x3a91bb[_0xb1c3('0x35')]=_['intersection'](_0x11eb58[_0xb1c3('0x2f')],qs['fields'](_0x31ce8a[_0xb1c3('0x32')][_0xb1c3('0x36')]));_0x3a91bb['attributes']=_0x3a91bb[_0xb1c3('0x35')][_0xb1c3('0x37')]?_0x3a91bb[_0xb1c3('0x35')]:_0x11eb58[_0xb1c3('0x2f')];if(!_0x31ce8a['query'][_0xb1c3('0x38')](_0xb1c3('0x39'))){_0x3a91bb[_0xb1c3('0x1d')]=qs[_0xb1c3('0x1d')](_0x31ce8a[_0xb1c3('0x32')][_0xb1c3('0x1d')]);_0x3a91bb[_0xb1c3('0x1b')]=qs[_0xb1c3('0x1b')](_0x31ce8a[_0xb1c3('0x32')][_0xb1c3('0x1b')]);}_0x3a91bb[_0xb1c3('0x3a')]=qs[_0xb1c3('0x3b')](_0x31ce8a['query'][_0xb1c3('0x3b')]);_0x3a91bb[_0xb1c3('0x3c')]=qs['filters'](_[_0xb1c3('0x3d')](_0x31ce8a[_0xb1c3('0x32')],_0x11eb58[_0xb1c3('0x33')]),_0x2b82ff);if(_0x31ce8a[_0xb1c3('0x32')][_0xb1c3('0x3e')]){_0x3a91bb[_0xb1c3('0x3c')]=_[_0xb1c3('0x3f')](_0x3a91bb[_0xb1c3('0x3c')],{'$or':_['map'](_0x2b82ff,function(_0x2e6bdc){if(_0x2e6bdc[_0xb1c3('0x2d')]!==_0xb1c3('0x40')){var _0x5b7e25={};_0x5b7e25[_0x2e6bdc['name']]={'$like':'%'+_0x31ce8a[_0xb1c3('0x32')][_0xb1c3('0x3e')]+'%'};return _0x5b7e25;}})});}_0x3a91bb=_['merge']({},_0x3a91bb,_0x31ce8a[_0xb1c3('0x41')]);var _0x419db6={'where':_0x3a91bb['where']};return db[_0xb1c3('0x2b')]['count'](_0x419db6)[_0xb1c3('0x24')](function(_0x58c3d9){_0x5c335f[_0xb1c3('0x1e')]=_0x58c3d9;if(_0x31ce8a['query'][_0xb1c3('0x42')]){_0x3a91bb[_0xb1c3('0x43')]=[{'all':!![]}];}return db[_0xb1c3('0x2b')][_0xb1c3('0x44')](_0x3a91bb);})['then'](function(_0x2ce0a5){_0x5c335f[_0xb1c3('0x45')]=_0x2ce0a5;return _0x5c335f;})['then'](respondWithFilteredResult(_0x1c2ed8,_0x3a91bb))[_0xb1c3('0x46')](handleError(_0x1c2ed8,null));};exports[_0xb1c3('0x47')]=function(_0x37eb4b,_0xc6df31){var _0x387c70={'raw':![],'where':{'id':_0x37eb4b[_0xb1c3('0x48')]['id']}},_0x24d0e5={};_0x24d0e5[_0xb1c3('0x2f')]=_[_0xb1c3('0x31')](db[_0xb1c3('0x2b')]['rawAttributes']);_0x24d0e5[_0xb1c3('0x32')]=_[_0xb1c3('0x31')](_0x37eb4b[_0xb1c3('0x32')]);_0x24d0e5[_0xb1c3('0x33')]=_['intersection'](_0x24d0e5['model'],_0x24d0e5['query']);_0x387c70[_0xb1c3('0x35')]=_[_0xb1c3('0x34')](_0x24d0e5['model'],qs[_0xb1c3('0x36')](_0x37eb4b[_0xb1c3('0x32')][_0xb1c3('0x36')]));_0x387c70[_0xb1c3('0x35')]=_0x387c70[_0xb1c3('0x35')][_0xb1c3('0x37')]?_0x387c70[_0xb1c3('0x35')]:_0x24d0e5[_0xb1c3('0x2f')];if(_0x37eb4b[_0xb1c3('0x32')][_0xb1c3('0x42')]){_0x387c70[_0xb1c3('0x43')]=[{'all':!![]}];}_0x387c70=_[_0xb1c3('0x3f')]({},_0x387c70,_0x37eb4b[_0xb1c3('0x41')]);return db[_0xb1c3('0x2b')][_0xb1c3('0x49')](_0x387c70)[_0xb1c3('0x24')](handleEntityNotFound(_0xc6df31,null))[_0xb1c3('0x24')](respondWithResult(_0xc6df31,null))[_0xb1c3('0x46')](handleError(_0xc6df31,null));};exports[_0xb1c3('0x4a')]=function(_0x2d6085,_0x24f927){return db[_0xb1c3('0x2b')][_0xb1c3('0x4a')](_0x2d6085[_0xb1c3('0x4b')],{})['then'](respondWithResult(_0x24f927,0xc9))['catch'](handleError(_0x24f927,null));};exports[_0xb1c3('0x4c')]=function(_0x55a72c,_0x2a0554){if(_0x55a72c[_0xb1c3('0x4b')]['id']){delete _0x55a72c['body']['id'];}return db[_0xb1c3('0x2b')][_0xb1c3('0x49')]({'where':{'id':_0x55a72c['params']['id']}})[_0xb1c3('0x24')](handleEntityNotFound(_0x2a0554,null))[_0xb1c3('0x24')](saveUpdates(_0x55a72c[_0xb1c3('0x4b')],null))[_0xb1c3('0x24')](respondWithResult(_0x2a0554,null))[_0xb1c3('0x46')](handleError(_0x2a0554,null));};exports[_0xb1c3('0x25')]=function(_0x3ace7b,_0x1affe5){return db[_0xb1c3('0x2b')][_0xb1c3('0x49')]({'where':{'id':_0x3ace7b[_0xb1c3('0x48')]['id']}})['then'](handleEntityNotFound(_0x1affe5,null))[_0xb1c3('0x24')](removeEntity(_0x1affe5,null))[_0xb1c3('0x46')](handleError(_0x1affe5,null));};exports[_0xb1c3('0x4d')]=function(_0x84e68a,_0x581b04,_0x3e24e3){var _0x13fd72={};var _0x17084f={};var _0x44b461;var _0x146703;return db[_0xb1c3('0x2b')][_0xb1c3('0x4e')]({'where':{'id':_0x84e68a[_0xb1c3('0x48')]['id']}})['then'](handleEntityNotFound(_0x581b04,null))['then'](function(_0x8158f9){if(_0x8158f9){_0x44b461=_0x8158f9;_0x17084f[_0xb1c3('0x2f')]=_[_0xb1c3('0x31')](db['SalesforceField'][_0xb1c3('0x4f')]);_0x17084f[_0xb1c3('0x32')]=_[_0xb1c3('0x31')](_0x84e68a[_0xb1c3('0x32')]);_0x17084f[_0xb1c3('0x33')]=_[_0xb1c3('0x34')](_0x17084f[_0xb1c3('0x2f')],_0x17084f[_0xb1c3('0x32')]);_0x13fd72[_0xb1c3('0x35')]=_[_0xb1c3('0x34')](_0x17084f[_0xb1c3('0x2f')],qs[_0xb1c3('0x36')](_0x84e68a['query'][_0xb1c3('0x36')]));_0x13fd72[_0xb1c3('0x35')]=_0x13fd72[_0xb1c3('0x35')][_0xb1c3('0x37')]?_0x13fd72[_0xb1c3('0x35')]:_0x17084f[_0xb1c3('0x2f')];_0x13fd72[_0xb1c3('0x3a')]=qs['sort'](_0x84e68a[_0xb1c3('0x32')][_0xb1c3('0x3b')]);_0x13fd72['where']=qs['filters'](_[_0xb1c3('0x3d')](_0x84e68a[_0xb1c3('0x32')],_0x17084f['filters']));if(_0x84e68a[_0xb1c3('0x32')][_0xb1c3('0x3e')]){_0x13fd72['where']=_['merge'](_0x13fd72[_0xb1c3('0x3c')],{'$or':_[_0xb1c3('0x30')](_0x13fd72[_0xb1c3('0x35')],function(_0x561397){var _0x7e37fc={};_0x7e37fc[_0x561397]={'$like':'%'+_0x84e68a[_0xb1c3('0x32')][_0xb1c3('0x3e')]+'%'};return _0x7e37fc;})});}_0x13fd72=_['merge']({},_0x13fd72,_0x84e68a[_0xb1c3('0x41')]);return _0x44b461[_0xb1c3('0x4d')](_0x13fd72);}})[_0xb1c3('0x24')](function(_0x5c4ae4){if(_0x5c4ae4){_0x146703=_0x5c4ae4[_0xb1c3('0x37')];if(!_0x84e68a['query']['hasOwnProperty'](_0xb1c3('0x39'))){_0x13fd72[_0xb1c3('0x1d')]=qs[_0xb1c3('0x1d')](_0x84e68a['query'][_0xb1c3('0x1d')]);_0x13fd72[_0xb1c3('0x1b')]=qs[_0xb1c3('0x1b')](_0x84e68a[_0xb1c3('0x32')][_0xb1c3('0x1b')]);}return _0x44b461[_0xb1c3('0x4d')](_0x13fd72);}})[_0xb1c3('0x24')](function(_0x3f2f7e){if(_0x3f2f7e){return _0x3f2f7e?{'count':_0x146703,'rows':_0x3f2f7e}:null;}})[_0xb1c3('0x24')](respondWithResult(_0x581b04,null))[_0xb1c3('0x46')](handleError(_0x581b04,null));};exports[_0xb1c3('0x50')]=function(_0x2c0404,_0x3c4b38,_0xb989cf){var _0x1facf2={};var _0x36d86c={};var _0x17a3d2;var _0x22fd6f;return db[_0xb1c3('0x2b')][_0xb1c3('0x4e')]({'where':{'id':_0x2c0404['params']['id']}})[_0xb1c3('0x24')](handleEntityNotFound(_0x3c4b38,null))[_0xb1c3('0x24')](function(_0x59296b){if(_0x59296b){_0x17a3d2=_0x59296b;_0x36d86c['model']=_['keys'](db[_0xb1c3('0x51')][_0xb1c3('0x4f')]);_0x36d86c[_0xb1c3('0x32')]=_[_0xb1c3('0x31')](_0x2c0404['query']);_0x36d86c[_0xb1c3('0x33')]=_[_0xb1c3('0x34')](_0x36d86c['model'],_0x36d86c[_0xb1c3('0x32')]);_0x1facf2[_0xb1c3('0x35')]=_[_0xb1c3('0x34')](_0x36d86c[_0xb1c3('0x2f')],qs[_0xb1c3('0x36')](_0x2c0404[_0xb1c3('0x32')][_0xb1c3('0x36')]));_0x1facf2['attributes']=_0x1facf2[_0xb1c3('0x35')]['length']?_0x1facf2[_0xb1c3('0x35')]:_0x36d86c['model'];_0x1facf2['order']=qs[_0xb1c3('0x3b')](_0x2c0404[_0xb1c3('0x32')]['sort']);_0x1facf2[_0xb1c3('0x3c')]=qs[_0xb1c3('0x33')](_[_0xb1c3('0x3d')](_0x2c0404[_0xb1c3('0x32')],_0x36d86c[_0xb1c3('0x33')]));if(_0x2c0404[_0xb1c3('0x32')][_0xb1c3('0x3e')]){_0x1facf2[_0xb1c3('0x3c')]=_[_0xb1c3('0x3f')](_0x1facf2[_0xb1c3('0x3c')],{'$or':_[_0xb1c3('0x30')](_0x1facf2[_0xb1c3('0x35')],function(_0x4a3309){var _0x302015={};_0x302015[_0x4a3309]={'$like':'%'+_0x2c0404[_0xb1c3('0x32')][_0xb1c3('0x3e')]+'%'};return _0x302015;})});}_0x1facf2=_[_0xb1c3('0x3f')]({},_0x1facf2,_0x2c0404[_0xb1c3('0x41')]);return _0x17a3d2[_0xb1c3('0x50')](_0x1facf2);}})['then'](function(_0x212830){if(_0x212830){_0x22fd6f=_0x212830[_0xb1c3('0x37')];if(!_0x2c0404['query'][_0xb1c3('0x38')](_0xb1c3('0x39'))){_0x1facf2['limit']=qs['limit'](_0x2c0404[_0xb1c3('0x32')][_0xb1c3('0x1d')]);_0x1facf2[_0xb1c3('0x1b')]=qs[_0xb1c3('0x1b')](_0x2c0404['query']['offset']);}return _0x17a3d2[_0xb1c3('0x50')](_0x1facf2);}})['then'](function(_0x5e22d0){if(_0x5e22d0){return _0x5e22d0?{'count':_0x22fd6f,'rows':_0x5e22d0}:null;}})[_0xb1c3('0x24')](respondWithResult(_0x3c4b38,null))[_0xb1c3('0x46')](handleError(_0x3c4b38,null));};exports[_0xb1c3('0x52')]=function(_0x207079,_0x283963,_0x1fd65f){var _0x8a75ad={};var _0x2c16d3={};var _0x5be9b9;var _0x557083;return db[_0xb1c3('0x2b')][_0xb1c3('0x4e')]({'where':{'id':_0x207079[_0xb1c3('0x48')]['id']}})[_0xb1c3('0x24')](handleEntityNotFound(_0x283963,null))[_0xb1c3('0x24')](function(_0x3e62fa){if(_0x3e62fa){_0x5be9b9=_0x3e62fa;_0x2c16d3[_0xb1c3('0x2f')]=_['keys'](db['SalesforceField'][_0xb1c3('0x4f')]);_0x2c16d3['query']=_['keys'](_0x207079[_0xb1c3('0x32')]);_0x2c16d3['filters']=_[_0xb1c3('0x34')](_0x2c16d3[_0xb1c3('0x2f')],_0x2c16d3[_0xb1c3('0x32')]);_0x8a75ad[_0xb1c3('0x35')]=_[_0xb1c3('0x34')](_0x2c16d3['model'],qs[_0xb1c3('0x36')](_0x207079['query'][_0xb1c3('0x36')]));_0x8a75ad['attributes']=_0x8a75ad[_0xb1c3('0x35')]['length']?_0x8a75ad[_0xb1c3('0x35')]:_0x2c16d3[_0xb1c3('0x2f')];_0x8a75ad[_0xb1c3('0x3a')]=qs[_0xb1c3('0x3b')](_0x207079[_0xb1c3('0x32')]['sort']);_0x8a75ad[_0xb1c3('0x3c')]=qs[_0xb1c3('0x33')](_['pick'](_0x207079[_0xb1c3('0x32')],_0x2c16d3['filters']));if(_0x207079[_0xb1c3('0x32')][_0xb1c3('0x3e')]){_0x8a75ad[_0xb1c3('0x3c')]=_['merge'](_0x8a75ad['where'],{'$or':_['map'](_0x8a75ad[_0xb1c3('0x35')],function(_0x1327c7){var _0x66f9fc={};_0x66f9fc[_0x1327c7]={'$like':'%'+_0x207079['query'][_0xb1c3('0x3e')]+'%'};return _0x66f9fc;})});}_0x8a75ad=_[_0xb1c3('0x3f')]({},_0x8a75ad,_0x207079['options']);return _0x5be9b9[_0xb1c3('0x52')](_0x8a75ad);}})[_0xb1c3('0x24')](function(_0x28531d){if(_0x28531d){_0x557083=_0x28531d[_0xb1c3('0x37')];if(!_0x207079[_0xb1c3('0x32')][_0xb1c3('0x38')](_0xb1c3('0x39'))){_0x8a75ad['limit']=qs['limit'](_0x207079[_0xb1c3('0x32')][_0xb1c3('0x1d')]);_0x8a75ad[_0xb1c3('0x1b')]=qs[_0xb1c3('0x1b')](_0x207079[_0xb1c3('0x32')]['offset']);}return _0x5be9b9[_0xb1c3('0x52')](_0x8a75ad);}})[_0xb1c3('0x24')](function(_0x329b06){if(_0x329b06){return _0x329b06?{'count':_0x557083,'rows':_0x329b06}:null;}})[_0xb1c3('0x24')](respondWithResult(_0x283963,null))['catch'](handleError(_0x283963,null));}; \ No newline at end of file +var _0x2737=['then','destroy','sendStatus','error','name','index','map','SalesforceConfiguration','rawAttributes','fieldName','key','keys','query','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','filters','pick','filter','where','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','find','create','body','params','getFields','findOne','SalesforceField','getSubjects','order','getDescriptions','rimraf','zip-dir','request-promise','moment','bluebird','path','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','count','limit','set','Content-Range','json','reject','save','update'];(function(_0x5aedfc,_0x1fbae5){var _0x532de4=function(_0x11655b){while(--_0x11655b){_0x5aedfc['push'](_0x5aedfc['shift']());}};_0x532de4(++_0x1fbae5);}(_0x2737,0x11d));var _0x7273=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x2737[_0x501510];return _0x1e6ee5;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7273('0x0'));var zipdir=require(_0x7273('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7273('0x2'));var moment=require(_0x7273('0x3'));var BPromise=require(_0x7273('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x7273('0x5'));var sox=require('sox');var csv=require(_0x7273('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7273('0x7'));var _=require(_0x7273('0x8'));var squel=require('squel');var crypto=require(_0x7273('0x9'));var jsforce=require(_0x7273('0xa'));var deskjs=require(_0x7273('0xb'));var toCsv=require(_0x7273('0x6'));var querystring=require(_0x7273('0xc'));var Papa=require('papaparse');var Redis=require(_0x7273('0xd'));var authService=require(_0x7273('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x7273('0xf'));var hardwareService=require(_0x7273('0x10'));var logger=require(_0x7273('0x11'))(_0x7273('0x12'));var utils=require(_0x7273('0x13'));var config=require(_0x7273('0x14'));var licenseUtil=require(_0x7273('0x15'));var db=require(_0x7273('0x16'))['db'];function respondWithStatusCode(_0x2d9695,_0x4d5ef8){_0x4d5ef8=_0x4d5ef8||0xcc;return function(_0xe302ca){if(_0xe302ca){return _0x2d9695['sendStatus'](_0x4d5ef8);}return _0x2d9695[_0x7273('0x17')](_0x4d5ef8)[_0x7273('0x18')]();};}function respondWithResult(_0x19d73c,_0x381fd1){_0x381fd1=_0x381fd1||0xc8;return function(_0x33400d){if(_0x33400d){return _0x19d73c[_0x7273('0x17')](_0x381fd1)['json'](_0x33400d);}};}function respondWithFilteredResult(_0x1ff7a8,_0x7fdb3){return function(_0x1de177){if(_0x1de177){var _0x568e8e=typeof _0x7fdb3[_0x7273('0x19')]===_0x7273('0x1a')&&typeof _0x7fdb3['limit']==='undefined';var _0x228453=_0x1de177[_0x7273('0x1b')];var _0x59167f=_0x568e8e?0x0:_0x7fdb3['offset'];var _0x29da25=_0x568e8e?_0x1de177['count']:_0x7fdb3[_0x7273('0x19')]+_0x7fdb3[_0x7273('0x1c')];var _0x659c71;if(_0x29da25>=_0x228453){_0x29da25=_0x228453;_0x659c71=0xc8;}else{_0x659c71=0xce;}_0x1ff7a8[_0x7273('0x17')](_0x659c71);return _0x1ff7a8[_0x7273('0x1d')](_0x7273('0x1e'),_0x59167f+'-'+_0x29da25+'/'+_0x228453)[_0x7273('0x1f')](_0x1de177);}return null;};}function patchUpdates(_0x309199){return function(_0x3f1374){try{jsonpatch['apply'](_0x3f1374,_0x309199,!![]);}catch(_0xd27787){return BPromise[_0x7273('0x20')](_0xd27787);}return _0x3f1374[_0x7273('0x21')]();};}function saveUpdates(_0x20c403,_0x51ad71){return function(_0x4a5c73){if(_0x4a5c73){return _0x4a5c73[_0x7273('0x22')](_0x20c403)[_0x7273('0x23')](function(_0x10cdea){return _0x10cdea;});}return null;};}function removeEntity(_0x30170d,_0x5a175b){return function(_0x15054a){if(_0x15054a){return _0x15054a[_0x7273('0x24')]()[_0x7273('0x23')](function(){_0x30170d['status'](0xcc)[_0x7273('0x18')]();});}};}function handleEntityNotFound(_0x4bff6c,_0x4ad832){return function(_0x147652){if(!_0x147652){_0x4bff6c[_0x7273('0x25')](0x194);}return _0x147652;};}function handleError(_0x2a4434,_0x407bbd){_0x407bbd=_0x407bbd||0x1f4;return function(_0x326b3c){logger[_0x7273('0x26')](_0x326b3c['stack']);if(_0x326b3c[_0x7273('0x27')]){delete _0x326b3c[_0x7273('0x27')];}_0x2a4434['status'](_0x407bbd)['send'](_0x326b3c);};}exports[_0x7273('0x28')]=function(_0x39fe75,_0x2f73bb){var _0x3642a3={},_0x49ae98={},_0x1730fd={'count':0x0,'rows':[]};var _0x5e55c1=_[_0x7273('0x29')](db[_0x7273('0x2a')][_0x7273('0x2b')],function(_0x4e3126){return{'name':_0x4e3126[_0x7273('0x2c')],'type':_0x4e3126['type'][_0x7273('0x2d')]};});_0x49ae98['model']=_[_0x7273('0x29')](_0x5e55c1,_0x7273('0x27'));_0x49ae98['query']=_[_0x7273('0x2e')](_0x39fe75[_0x7273('0x2f')]);_0x49ae98['filters']=_[_0x7273('0x30')](_0x49ae98[_0x7273('0x31')],_0x49ae98[_0x7273('0x2f')]);_0x3642a3[_0x7273('0x32')]=_[_0x7273('0x30')](_0x49ae98[_0x7273('0x31')],qs[_0x7273('0x33')](_0x39fe75[_0x7273('0x2f')][_0x7273('0x33')]));_0x3642a3[_0x7273('0x32')]=_0x3642a3[_0x7273('0x32')][_0x7273('0x34')]?_0x3642a3[_0x7273('0x32')]:_0x49ae98[_0x7273('0x31')];if(!_0x39fe75[_0x7273('0x2f')][_0x7273('0x35')](_0x7273('0x36'))){_0x3642a3[_0x7273('0x1c')]=qs[_0x7273('0x1c')](_0x39fe75[_0x7273('0x2f')][_0x7273('0x1c')]);_0x3642a3[_0x7273('0x19')]=qs[_0x7273('0x19')](_0x39fe75[_0x7273('0x2f')][_0x7273('0x19')]);}_0x3642a3['order']=qs[_0x7273('0x37')](_0x39fe75[_0x7273('0x2f')]['sort']);_0x3642a3['where']=qs[_0x7273('0x38')](_[_0x7273('0x39')](_0x39fe75[_0x7273('0x2f')],_0x49ae98[_0x7273('0x38')]),_0x5e55c1);if(_0x39fe75[_0x7273('0x2f')][_0x7273('0x3a')]){_0x3642a3[_0x7273('0x3b')]=_[_0x7273('0x3c')](_0x3642a3[_0x7273('0x3b')],{'$or':_['map'](_0x5e55c1,function(_0x4af636){if(_0x4af636[_0x7273('0x3d')]!==_0x7273('0x3e')){var _0x28f8a6={};_0x28f8a6[_0x4af636['name']]={'$like':'%'+_0x39fe75['query'][_0x7273('0x3a')]+'%'};return _0x28f8a6;}})});}_0x3642a3=_[_0x7273('0x3c')]({},_0x3642a3,_0x39fe75[_0x7273('0x3f')]);var _0x385f0f={'where':_0x3642a3[_0x7273('0x3b')]};return db[_0x7273('0x2a')][_0x7273('0x1b')](_0x385f0f)[_0x7273('0x23')](function(_0x14e83e){_0x1730fd['count']=_0x14e83e;if(_0x39fe75[_0x7273('0x2f')][_0x7273('0x40')]){_0x3642a3[_0x7273('0x41')]=[{'all':!![]}];}return db['SalesforceConfiguration'][_0x7273('0x42')](_0x3642a3);})[_0x7273('0x23')](function(_0x3b3505){_0x1730fd[_0x7273('0x43')]=_0x3b3505;return _0x1730fd;})[_0x7273('0x23')](respondWithFilteredResult(_0x2f73bb,_0x3642a3))[_0x7273('0x44')](handleError(_0x2f73bb,null));};exports[_0x7273('0x45')]=function(_0x5f1195,_0x93a769){var _0x10bb84={'raw':![],'where':{'id':_0x5f1195['params']['id']}},_0x3829c2={};_0x3829c2[_0x7273('0x31')]=_[_0x7273('0x2e')](db[_0x7273('0x2a')][_0x7273('0x2b')]);_0x3829c2[_0x7273('0x2f')]=_['keys'](_0x5f1195['query']);_0x3829c2[_0x7273('0x38')]=_[_0x7273('0x30')](_0x3829c2[_0x7273('0x31')],_0x3829c2[_0x7273('0x2f')]);_0x10bb84[_0x7273('0x32')]=_['intersection'](_0x3829c2[_0x7273('0x31')],qs[_0x7273('0x33')](_0x5f1195['query'][_0x7273('0x33')]));_0x10bb84[_0x7273('0x32')]=_0x10bb84[_0x7273('0x32')]['length']?_0x10bb84[_0x7273('0x32')]:_0x3829c2['model'];if(_0x5f1195[_0x7273('0x2f')][_0x7273('0x40')]){_0x10bb84[_0x7273('0x41')]=[{'all':!![]}];}_0x10bb84=_[_0x7273('0x3c')]({},_0x10bb84,_0x5f1195[_0x7273('0x3f')]);return db[_0x7273('0x2a')][_0x7273('0x46')](_0x10bb84)['then'](handleEntityNotFound(_0x93a769,null))['then'](respondWithResult(_0x93a769,null))['catch'](handleError(_0x93a769,null));};exports['create']=function(_0x281ecb,_0x1f6959){return db[_0x7273('0x2a')][_0x7273('0x47')](_0x281ecb[_0x7273('0x48')],{})[_0x7273('0x23')](respondWithResult(_0x1f6959,0xc9))[_0x7273('0x44')](handleError(_0x1f6959,null));};exports[_0x7273('0x22')]=function(_0x22e3dc,_0x37ae23){if(_0x22e3dc[_0x7273('0x48')]['id']){delete _0x22e3dc[_0x7273('0x48')]['id'];}return db[_0x7273('0x2a')]['find']({'where':{'id':_0x22e3dc[_0x7273('0x49')]['id']}})[_0x7273('0x23')](handleEntityNotFound(_0x37ae23,null))[_0x7273('0x23')](saveUpdates(_0x22e3dc[_0x7273('0x48')],null))[_0x7273('0x23')](respondWithResult(_0x37ae23,null))[_0x7273('0x44')](handleError(_0x37ae23,null));};exports['destroy']=function(_0x31ebbd,_0x53b572){return db['SalesforceConfiguration']['find']({'where':{'id':_0x31ebbd[_0x7273('0x49')]['id']}})[_0x7273('0x23')](handleEntityNotFound(_0x53b572,null))['then'](removeEntity(_0x53b572,null))[_0x7273('0x44')](handleError(_0x53b572,null));};exports[_0x7273('0x4a')]=function(_0x87bba,_0xe8d1c0,_0x58f847){var _0x60ae4={};var _0x42ed54={};var _0x4a3989;var _0x272ae7;return db['SalesforceConfiguration'][_0x7273('0x4b')]({'where':{'id':_0x87bba[_0x7273('0x49')]['id']}})['then'](handleEntityNotFound(_0xe8d1c0,null))[_0x7273('0x23')](function(_0x33fd72){if(_0x33fd72){_0x4a3989=_0x33fd72;_0x42ed54[_0x7273('0x31')]=_[_0x7273('0x2e')](db[_0x7273('0x4c')][_0x7273('0x2b')]);_0x42ed54[_0x7273('0x2f')]=_[_0x7273('0x2e')](_0x87bba['query']);_0x42ed54[_0x7273('0x38')]=_[_0x7273('0x30')](_0x42ed54[_0x7273('0x31')],_0x42ed54[_0x7273('0x2f')]);_0x60ae4[_0x7273('0x32')]=_['intersection'](_0x42ed54['model'],qs[_0x7273('0x33')](_0x87bba['query'][_0x7273('0x33')]));_0x60ae4[_0x7273('0x32')]=_0x60ae4[_0x7273('0x32')][_0x7273('0x34')]?_0x60ae4[_0x7273('0x32')]:_0x42ed54[_0x7273('0x31')];_0x60ae4['order']=qs[_0x7273('0x37')](_0x87bba[_0x7273('0x2f')][_0x7273('0x37')]);_0x60ae4[_0x7273('0x3b')]=qs[_0x7273('0x38')](_[_0x7273('0x39')](_0x87bba['query'],_0x42ed54[_0x7273('0x38')]));if(_0x87bba[_0x7273('0x2f')][_0x7273('0x3a')]){_0x60ae4[_0x7273('0x3b')]=_[_0x7273('0x3c')](_0x60ae4[_0x7273('0x3b')],{'$or':_['map'](_0x60ae4[_0x7273('0x32')],function(_0x1c59ea){var _0x498602={};_0x498602[_0x1c59ea]={'$like':'%'+_0x87bba[_0x7273('0x2f')][_0x7273('0x3a')]+'%'};return _0x498602;})});}_0x60ae4=_[_0x7273('0x3c')]({},_0x60ae4,_0x87bba[_0x7273('0x3f')]);return _0x4a3989[_0x7273('0x4a')](_0x60ae4);}})['then'](function(_0x466663){if(_0x466663){_0x272ae7=_0x466663[_0x7273('0x34')];if(!_0x87bba[_0x7273('0x2f')][_0x7273('0x35')](_0x7273('0x36'))){_0x60ae4[_0x7273('0x1c')]=qs['limit'](_0x87bba['query'][_0x7273('0x1c')]);_0x60ae4['offset']=qs[_0x7273('0x19')](_0x87bba[_0x7273('0x2f')][_0x7273('0x19')]);}return _0x4a3989['getFields'](_0x60ae4);}})['then'](function(_0x3b1d57){if(_0x3b1d57){return _0x3b1d57?{'count':_0x272ae7,'rows':_0x3b1d57}:null;}})[_0x7273('0x23')](respondWithResult(_0xe8d1c0,null))[_0x7273('0x44')](handleError(_0xe8d1c0,null));};exports[_0x7273('0x4d')]=function(_0x3ec670,_0x26fe09,_0x29c8a7){var _0x15babe={};var _0x14e7d1={};var _0x10c183;var _0x225654;return db[_0x7273('0x2a')][_0x7273('0x4b')]({'where':{'id':_0x3ec670[_0x7273('0x49')]['id']}})[_0x7273('0x23')](handleEntityNotFound(_0x26fe09,null))[_0x7273('0x23')](function(_0x99760c){if(_0x99760c){_0x10c183=_0x99760c;_0x14e7d1['model']=_[_0x7273('0x2e')](db[_0x7273('0x4c')][_0x7273('0x2b')]);_0x14e7d1[_0x7273('0x2f')]=_['keys'](_0x3ec670[_0x7273('0x2f')]);_0x14e7d1[_0x7273('0x38')]=_['intersection'](_0x14e7d1[_0x7273('0x31')],_0x14e7d1[_0x7273('0x2f')]);_0x15babe[_0x7273('0x32')]=_[_0x7273('0x30')](_0x14e7d1[_0x7273('0x31')],qs[_0x7273('0x33')](_0x3ec670[_0x7273('0x2f')][_0x7273('0x33')]));_0x15babe[_0x7273('0x32')]=_0x15babe[_0x7273('0x32')][_0x7273('0x34')]?_0x15babe[_0x7273('0x32')]:_0x14e7d1[_0x7273('0x31')];_0x15babe[_0x7273('0x4e')]=qs[_0x7273('0x37')](_0x3ec670[_0x7273('0x2f')]['sort']);_0x15babe[_0x7273('0x3b')]=qs[_0x7273('0x38')](_[_0x7273('0x39')](_0x3ec670[_0x7273('0x2f')],_0x14e7d1['filters']));if(_0x3ec670[_0x7273('0x2f')][_0x7273('0x3a')]){_0x15babe[_0x7273('0x3b')]=_[_0x7273('0x3c')](_0x15babe['where'],{'$or':_[_0x7273('0x29')](_0x15babe[_0x7273('0x32')],function(_0x50a7b4){var _0x37ef9d={};_0x37ef9d[_0x50a7b4]={'$like':'%'+_0x3ec670['query'][_0x7273('0x3a')]+'%'};return _0x37ef9d;})});}_0x15babe=_[_0x7273('0x3c')]({},_0x15babe,_0x3ec670[_0x7273('0x3f')]);return _0x10c183[_0x7273('0x4d')](_0x15babe);}})[_0x7273('0x23')](function(_0x20d3d1){if(_0x20d3d1){_0x225654=_0x20d3d1[_0x7273('0x34')];if(!_0x3ec670['query']['hasOwnProperty'](_0x7273('0x36'))){_0x15babe['limit']=qs[_0x7273('0x1c')](_0x3ec670['query'][_0x7273('0x1c')]);_0x15babe[_0x7273('0x19')]=qs[_0x7273('0x19')](_0x3ec670[_0x7273('0x2f')][_0x7273('0x19')]);}return _0x10c183[_0x7273('0x4d')](_0x15babe);}})[_0x7273('0x23')](function(_0x32487d){if(_0x32487d){return _0x32487d?{'count':_0x225654,'rows':_0x32487d}:null;}})[_0x7273('0x23')](respondWithResult(_0x26fe09,null))['catch'](handleError(_0x26fe09,null));};exports[_0x7273('0x4f')]=function(_0x16d17c,_0x4a6219,_0x1b14d1){var _0x47ce05={};var _0x36b3c8={};var _0x1198bb;var _0x5df196;return db['SalesforceConfiguration']['findOne']({'where':{'id':_0x16d17c[_0x7273('0x49')]['id']}})[_0x7273('0x23')](handleEntityNotFound(_0x4a6219,null))[_0x7273('0x23')](function(_0x51930e){if(_0x51930e){_0x1198bb=_0x51930e;_0x36b3c8[_0x7273('0x31')]=_[_0x7273('0x2e')](db[_0x7273('0x4c')][_0x7273('0x2b')]);_0x36b3c8[_0x7273('0x2f')]=_[_0x7273('0x2e')](_0x16d17c[_0x7273('0x2f')]);_0x36b3c8['filters']=_[_0x7273('0x30')](_0x36b3c8[_0x7273('0x31')],_0x36b3c8[_0x7273('0x2f')]);_0x47ce05[_0x7273('0x32')]=_[_0x7273('0x30')](_0x36b3c8[_0x7273('0x31')],qs[_0x7273('0x33')](_0x16d17c[_0x7273('0x2f')][_0x7273('0x33')]));_0x47ce05[_0x7273('0x32')]=_0x47ce05[_0x7273('0x32')][_0x7273('0x34')]?_0x47ce05[_0x7273('0x32')]:_0x36b3c8[_0x7273('0x31')];_0x47ce05['order']=qs['sort'](_0x16d17c[_0x7273('0x2f')][_0x7273('0x37')]);_0x47ce05[_0x7273('0x3b')]=qs[_0x7273('0x38')](_[_0x7273('0x39')](_0x16d17c[_0x7273('0x2f')],_0x36b3c8['filters']));if(_0x16d17c[_0x7273('0x2f')][_0x7273('0x3a')]){_0x47ce05['where']=_[_0x7273('0x3c')](_0x47ce05[_0x7273('0x3b')],{'$or':_[_0x7273('0x29')](_0x47ce05['attributes'],function(_0x1aa841){var _0x518bc2={};_0x518bc2[_0x1aa841]={'$like':'%'+_0x16d17c[_0x7273('0x2f')][_0x7273('0x3a')]+'%'};return _0x518bc2;})});}_0x47ce05=_[_0x7273('0x3c')]({},_0x47ce05,_0x16d17c[_0x7273('0x3f')]);return _0x1198bb[_0x7273('0x4f')](_0x47ce05);}})[_0x7273('0x23')](function(_0x4d49f6){if(_0x4d49f6){_0x5df196=_0x4d49f6[_0x7273('0x34')];if(!_0x16d17c[_0x7273('0x2f')][_0x7273('0x35')]('nolimit')){_0x47ce05[_0x7273('0x1c')]=qs['limit'](_0x16d17c[_0x7273('0x2f')][_0x7273('0x1c')]);_0x47ce05[_0x7273('0x19')]=qs[_0x7273('0x19')](_0x16d17c[_0x7273('0x2f')][_0x7273('0x19')]);}return _0x1198bb[_0x7273('0x4f')](_0x47ce05);}})['then'](function(_0x4be20b){if(_0x4be20b){return _0x4be20b?{'count':_0x5df196,'rows':_0x4be20b}:null;}})[_0x7273('0x23')](respondWithResult(_0x4a6219,null))[_0x7273('0x44')](handleError(_0x4a6219,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index ca12aa7..c7fe146 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 _0x4f25=['api','moment','request-promise','rimraf','../../config/environment','./intSalesforceConfiguration.attributes','exports','define','SalesforceConfiguration','int_salesforce_configurations','lodash','util','../../config/logger'];(function(_0x152f5e,_0x222866){var _0x20c698=function(_0x3edd83){while(--_0x3edd83){_0x152f5e['push'](_0x152f5e['shift']());}};_0x20c698(++_0x222866);}(_0x4f25,0xf4));var _0x54f2=function(_0x590b63,_0x14debb){_0x590b63=_0x590b63-0x0;var _0x3c9380=_0x4f25[_0x590b63];return _0x3c9380;};'use strict';var _=require(_0x54f2('0x0'));var util=require(_0x54f2('0x1'));var logger=require(_0x54f2('0x2'))(_0x54f2('0x3'));var moment=require(_0x54f2('0x4'));var BPromise=require('bluebird');var rp=require(_0x54f2('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x54f2('0x6'));var config=require(_0x54f2('0x7'));var attributes=require(_0x54f2('0x8'));module[_0x54f2('0x9')]=function(_0x56cdbb,_0x611401){return _0x56cdbb[_0x54f2('0xa')](_0x54f2('0xb'),attributes,{'tableName':_0x54f2('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb43c=['lodash','util','api','moment','bluebird','path','rimraf','../../config/environment','define','SalesforceConfiguration'];(function(_0x2bd491,_0x51cdb1){var _0x2889c2=function(_0x55f343){while(--_0x55f343){_0x2bd491['push'](_0x2bd491['shift']());}};_0x2889c2(++_0x51cdb1);}(_0xb43c,0x104));var _0xcb43=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xb43c[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xcb43('0x0'));var util=require(_0xcb43('0x1'));var logger=require('../../config/logger')(_0xcb43('0x2'));var moment=require(_0xcb43('0x3'));var BPromise=require(_0xcb43('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xcb43('0x5'));var rimraf=require(_0xcb43('0x6'));var config=require(_0xcb43('0x7'));var attributes=require('./intSalesforceConfiguration.attributes');module['exports']=function(_0x2bb846,_0xe2e529){return _0x2bb846[_0xcb43('0x8')](_0xcb43('0x9'),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 f2cc00d..3088232 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 _0xbd44=['util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash'];(function(_0x1ae4bd,_0x45bee0){var _0x10d0af=function(_0x118bea){while(--_0x118bea){_0x1ae4bd['push'](_0x1ae4bd['shift']());}};_0x10d0af(++_0x45bee0);}(_0xbd44,0xc5));var _0x4bd4=function(_0x219659,_0x19a27a){_0x219659=_0x219659-0x0;var _0x1f29b6=_0xbd44[_0x219659];return _0x1f29b6;};'use strict';var _=require(_0x4bd4('0x0'));var util=require(_0x4bd4('0x1'));var moment=require('moment');var BPromise=require(_0x4bd4('0x2'));var rs=require(_0x4bd4('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4bd4('0x4'))['db'];var utils=require(_0x4bd4('0x5'));var logger=require(_0x4bd4('0x6'))('rpc');var config=require(_0x4bd4('0x7'));var jayson=require(_0x4bd4('0x8'));var client=jayson[_0x4bd4('0x9')][_0x4bd4('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x567f2d,_0x3ddafa,_0x191568){return new BPromise(function(_0x4be1f3,_0x33a1b0){return client[_0x4bd4('0xb')](_0x567f2d,_0x191568)[_0x4bd4('0xc')](function(_0x60e7e2){logger[_0x4bd4('0xd')](_0x4bd4('0xe'),_0x3ddafa,_0x4bd4('0xf'));logger[_0x4bd4('0x10')]('SalesforceConfiguration,\x20%s,\x20%s,\x20%s',_0x3ddafa,_0x4bd4('0xf'),JSON[_0x4bd4('0x11')](_0x60e7e2));if(_0x60e7e2['error']){if(_0x60e7e2[_0x4bd4('0x12')][_0x4bd4('0x13')]===0x1f4){logger[_0x4bd4('0x12')](_0x4bd4('0xe'),_0x3ddafa,_0x60e7e2[_0x4bd4('0x12')]['message']);return _0x33a1b0(_0x60e7e2[_0x4bd4('0x12')][_0x4bd4('0x14')]);}logger[_0x4bd4('0x12')](_0x4bd4('0xe'),_0x3ddafa,_0x60e7e2['error']['message']);return _0x4be1f3(_0x60e7e2[_0x4bd4('0x12')][_0x4bd4('0x14')]);}else{logger[_0x4bd4('0xd')]('SalesforceConfiguration,\x20%s,\x20%s',_0x3ddafa,_0x4bd4('0xf'));_0x4be1f3(_0x60e7e2['result'][_0x4bd4('0x14')]);}})[_0x4bd4('0x15')](function(_0x1d5b82){logger[_0x4bd4('0x12')](_0x4bd4('0xe'),_0x3ddafa,_0x1d5b82);_0x33a1b0(_0x1d5b82);});});} \ No newline at end of file +var _0x1e01=['ioredis','../../mysqldb','../../config/environment','client','http','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','bluebird'];(function(_0x455bbf,_0x487eb1){var _0x31cc6a=function(_0x510dd8){while(--_0x510dd8){_0x455bbf['push'](_0x455bbf['shift']());}};_0x31cc6a(++_0x487eb1);}(_0x1e01,0xba));var _0x11e0=function(_0x45ec62,_0x11f807){_0x45ec62=_0x45ec62-0x0;var _0xcb5773=_0x1e01[_0x45ec62];return _0xcb5773;};'use strict';var _=require(_0x11e0('0x0'));var util=require(_0x11e0('0x1'));var moment=require(_0x11e0('0x2'));var BPromise=require(_0x11e0('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x11e0('0x4'));var db=require(_0x11e0('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x11e0('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x11e0('0x7')][_0x11e0('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3b529a,_0x3e30aa,_0x53578c){return new BPromise(function(_0x1f67fb,_0x3b64db){return client['request'](_0x3b529a,_0x53578c)['then'](function(_0x4e7391){logger[_0x11e0('0x9')](_0x11e0('0xa'),_0x3e30aa,_0x11e0('0xb'));logger[_0x11e0('0xc')](_0x11e0('0xd'),_0x3e30aa,'request\x20sent',JSON[_0x11e0('0xe')](_0x4e7391));if(_0x4e7391['error']){if(_0x4e7391[_0x11e0('0xf')][_0x11e0('0x10')]===0x1f4){logger[_0x11e0('0xf')](_0x11e0('0xa'),_0x3e30aa,_0x4e7391['error'][_0x11e0('0x11')]);return _0x3b64db(_0x4e7391[_0x11e0('0xf')][_0x11e0('0x11')]);}logger[_0x11e0('0xf')](_0x11e0('0xa'),_0x3e30aa,_0x4e7391[_0x11e0('0xf')]['message']);return _0x1f67fb(_0x4e7391[_0x11e0('0xf')][_0x11e0('0x11')]);}else{logger['info'](_0x11e0('0xa'),_0x3e30aa,_0x11e0('0xb'));_0x1f67fb(_0x4e7391['result'][_0x11e0('0x11')]);}})[_0x11e0('0x12')](function(_0x26bc11){logger[_0x11e0('0xf')](_0x11e0('0xa'),_0x3e30aa,_0x26bc11);_0x3b64db(_0x26bc11);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index 0e2bd3b..7d18758 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 _0x5a8c=['put','destroy','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','create'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0x5a8c,0x167));var _0xc5a8=function(_0x3b3e54,_0x27f854){_0x3b3e54=_0x3b3e54-0x0;var _0x4f86e1=_0x5a8c[_0x3b3e54];return _0x4f86e1;};'use strict';var multer=require(_0xc5a8('0x0'));var util=require(_0xc5a8('0x1'));var path=require(_0xc5a8('0x2'));var timeout=require('connect-timeout');var express=require(_0xc5a8('0x3'));var router=express[_0xc5a8('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xc5a8('0x5'));var interaction=require(_0xc5a8('0x6'));var config=require(_0xc5a8('0x7'));var controller=require('./intSalesforceField.controller');router[_0xc5a8('0x8')]('/',auth[_0xc5a8('0x9')](),controller[_0xc5a8('0xa')]);router[_0xc5a8('0x8')](_0xc5a8('0xb'),auth[_0xc5a8('0x9')](),controller[_0xc5a8('0xc')]);router[_0xc5a8('0xd')]('/',auth[_0xc5a8('0x9')](),controller[_0xc5a8('0xe')]);router[_0xc5a8('0xf')](_0xc5a8('0xb'),auth['isAuthenticated'](),controller['update']);router['delete'](_0xc5a8('0xb'),auth[_0xc5a8('0x9')](),controller[_0xc5a8('0x10')]);module['exports']=router; \ No newline at end of file +var _0x31ce=['./intSalesforceField.controller','isAuthenticated','index','get','/:id','create','put','update','delete','exports','util','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x37ad7a,_0x3d016b){var _0x2d5fa7=function(_0x10ed2e){while(--_0x10ed2e){_0x37ad7a['push'](_0x37ad7a['shift']());}};_0x2d5fa7(++_0x3d016b);}(_0x31ce,0x1aa));var _0xe31c=function(_0x7a319d,_0x235959){_0x7a319d=_0x7a319d-0x0;var _0x5c6b4e=_0x31ce[_0x7a319d];return _0x5c6b4e;};'use strict';var multer=require('multer');var util=require(_0xe31c('0x0'));var path=require('path');var timeout=require(_0xe31c('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xe31c('0x2'));var auth=require(_0xe31c('0x3'));var interaction=require(_0xe31c('0x4'));var config=require(_0xe31c('0x5'));var controller=require(_0xe31c('0x6'));router['get']('/',auth[_0xe31c('0x7')](),controller[_0xe31c('0x8')]);router[_0xe31c('0x9')](_0xe31c('0xa'),auth[_0xe31c('0x7')](),controller['show']);router['post']('/',auth[_0xe31c('0x7')](),controller[_0xe31c('0xb')]);router[_0xe31c('0xc')](_0xe31c('0xa'),auth['isAuthenticated'](),controller[_0xe31c('0xd')]);router[_0xe31c('0xe')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xe31c('0xf')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.attributes.js b/server/api/intSalesforceField/intSalesforceField.attributes.js index 5d0cbf1..1be7829 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 _0xbbb6=['exports','ENUM','string','variable','keyValue','picklist','STRING','sequelize'];(function(_0x584f68,_0x348cd5){var _0x2e7908=function(_0x3570f1){while(--_0x3570f1){_0x584f68['push'](_0x584f68['shift']());}};_0x2e7908(++_0x348cd5);}(_0xbbb6,0xd7));var _0x6bbb=function(_0x1f8a5e,_0x1ada04){_0x1f8a5e=_0x1f8a5e-0x0;var _0x20854b=_0xbbb6[_0x1f8a5e];return _0x20854b;};'use strict';var Sequelize=require(_0x6bbb('0x0'));module[_0x6bbb('0x1')]={'type':{'type':Sequelize[_0x6bbb('0x2')](_0x6bbb('0x3'),_0x6bbb('0x4'),'customVariable',_0x6bbb('0x5'),_0x6bbb('0x6')),'defaultValue':_0x6bbb('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x6bbb('0x7')]},'keyType':{'type':Sequelize[_0x6bbb('0x2')](_0x6bbb('0x3'),_0x6bbb('0x4'),'customVariable')},'keyContent':{'type':Sequelize[_0x6bbb('0x7')]},'idField':{'type':Sequelize[_0x6bbb('0x7')]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x0dfe=['keyValue','picklist','STRING','variable','sequelize','exports','ENUM','string','customVariable'];(function(_0x5b8da7,_0x31be6b){var _0x2a1518=function(_0x426715){while(--_0x426715){_0x5b8da7['push'](_0x5b8da7['shift']());}};_0x2a1518(++_0x31be6b);}(_0x0dfe,0x124));var _0xe0df=function(_0x2fec41,_0x196204){_0x2fec41=_0x2fec41-0x0;var _0x471c1d=_0x0dfe[_0x2fec41];return _0x471c1d;};'use strict';var Sequelize=require(_0xe0df('0x0'));module[_0xe0df('0x1')]={'type':{'type':Sequelize[_0xe0df('0x2')](_0xe0df('0x3'),'variable',_0xe0df('0x4'),_0xe0df('0x5'),_0xe0df('0x6')),'defaultValue':_0xe0df('0x3')},'content':{'type':Sequelize[_0xe0df('0x7')]},'key':{'type':Sequelize[_0xe0df('0x7')]},'keyType':{'type':Sequelize[_0xe0df('0x2')]('string',_0xe0df('0x8'),_0xe0df('0x4'))},'keyContent':{'type':Sequelize[_0xe0df('0x7')]},'idField':{'type':Sequelize[_0xe0df('0x7')]},'variableName':{'type':Sequelize[_0xe0df('0x7')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index dcfa557..4600c6a 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 _0xe754=['pick','filter','merge','VIRTUAL','options','SalesforceField','includeAll','include','findAll','show','params','find','catch','create','body','update','rimraf','zip-dir','request-promise','moment','util','path','to-csv','fs-extra','lodash','squel','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','undefined','limit','count','offset','Content-Range','json','reject','save','then','destroy','sendStatus','stack','name','send','index','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where'];(function(_0x5857af,_0x445e08){var _0xe18293=function(_0x15181c){while(--_0x15181c){_0x5857af['push'](_0x5857af['shift']());}};_0xe18293(++_0x445e08);}(_0xe754,0x1c0));var _0x4e75=function(_0x25c591,_0x223a4f){_0x25c591=_0x25c591-0x0;var _0x4ea225=_0xe754[_0x25c591];return _0x4ea225;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4e75('0x0'));var zipdir=require(_0x4e75('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4e75('0x2'));var moment=require(_0x4e75('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x4e75('0x4'));var path=require(_0x4e75('0x5'));var sox=require('sox');var csv=require(_0x4e75('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4e75('0x7'));var _=require(_0x4e75('0x8'));var squel=require(_0x4e75('0x9'));var crypto=require('crypto');var jsforce=require(_0x4e75('0xa'));var deskjs=require(_0x4e75('0xb'));var toCsv=require(_0x4e75('0x6'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x4e75('0xc'));var authService=require(_0x4e75('0xd'));var qs=require(_0x4e75('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4e75('0xf'));var logger=require(_0x4e75('0x10'))(_0x4e75('0x11'));var utils=require(_0x4e75('0x12'));var config=require(_0x4e75('0x13'));var licenseUtil=require(_0x4e75('0x14'));var db=require(_0x4e75('0x15'))['db'];function respondWithStatusCode(_0x96cace,_0x2d6da0){_0x2d6da0=_0x2d6da0||0xcc;return function(_0x2e7f9f){if(_0x2e7f9f){return _0x96cace['sendStatus'](_0x2d6da0);}return _0x96cace[_0x4e75('0x16')](_0x2d6da0)[_0x4e75('0x17')]();};}function respondWithResult(_0x5a9c22,_0x47583d){_0x47583d=_0x47583d||0xc8;return function(_0x16e455){if(_0x16e455){return _0x5a9c22[_0x4e75('0x16')](_0x47583d)['json'](_0x16e455);}};}function respondWithFilteredResult(_0x54e553,_0x1e23bd){return function(_0xcff3fc){if(_0xcff3fc){var _0x478f36=typeof _0x1e23bd['offset']===_0x4e75('0x18')&&typeof _0x1e23bd[_0x4e75('0x19')]===_0x4e75('0x18');var _0xbb1ada=_0xcff3fc[_0x4e75('0x1a')];var _0x32d2d9=_0x478f36?0x0:_0x1e23bd[_0x4e75('0x1b')];var _0x23b500=_0x478f36?_0xcff3fc[_0x4e75('0x1a')]:_0x1e23bd[_0x4e75('0x1b')]+_0x1e23bd['limit'];var _0x3b68cc;if(_0x23b500>=_0xbb1ada){_0x23b500=_0xbb1ada;_0x3b68cc=0xc8;}else{_0x3b68cc=0xce;}_0x54e553[_0x4e75('0x16')](_0x3b68cc);return _0x54e553['set'](_0x4e75('0x1c'),_0x32d2d9+'-'+_0x23b500+'/'+_0xbb1ada)[_0x4e75('0x1d')](_0xcff3fc);}return null;};}function patchUpdates(_0x6b6fe6){return function(_0x269a5d){try{jsonpatch['apply'](_0x269a5d,_0x6b6fe6,!![]);}catch(_0x30993c){return BPromise[_0x4e75('0x1e')](_0x30993c);}return _0x269a5d[_0x4e75('0x1f')]();};}function saveUpdates(_0x4d4e28,_0x2f1a3a){return function(_0x184c5b){if(_0x184c5b){return _0x184c5b['update'](_0x4d4e28)[_0x4e75('0x20')](function(_0x41b85c){return _0x41b85c;});}return null;};}function removeEntity(_0x224589,_0x10fd7b){return function(_0x1e05df){if(_0x1e05df){return _0x1e05df[_0x4e75('0x21')]()[_0x4e75('0x20')](function(){_0x224589[_0x4e75('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x16817c,_0x31403e){return function(_0x2348d9){if(!_0x2348d9){_0x16817c[_0x4e75('0x22')](0x194);}return _0x2348d9;};}function handleError(_0x4a00dc,_0x4df074){_0x4df074=_0x4df074||0x1f4;return function(_0x55c66a){logger['error'](_0x55c66a[_0x4e75('0x23')]);if(_0x55c66a[_0x4e75('0x24')]){delete _0x55c66a[_0x4e75('0x24')];}_0x4a00dc[_0x4e75('0x16')](_0x4df074)[_0x4e75('0x25')](_0x55c66a);};}exports[_0x4e75('0x26')]=function(_0x566b63,_0x1a2410){var _0x139891={},_0x25fb5b={},_0x4bea09={'count':0x0,'rows':[]};var _0x927b60=_['map'](db['SalesforceField'][_0x4e75('0x27')],function(_0x5657b0){return{'name':_0x5657b0[_0x4e75('0x28')],'type':_0x5657b0[_0x4e75('0x29')][_0x4e75('0x2a')]};});_0x25fb5b[_0x4e75('0x2b')]=_[_0x4e75('0x2c')](_0x927b60,_0x4e75('0x24'));_0x25fb5b[_0x4e75('0x2d')]=_[_0x4e75('0x2e')](_0x566b63['query']);_0x25fb5b[_0x4e75('0x2f')]=_[_0x4e75('0x30')](_0x25fb5b['model'],_0x25fb5b[_0x4e75('0x2d')]);_0x139891[_0x4e75('0x31')]=_[_0x4e75('0x30')](_0x25fb5b[_0x4e75('0x2b')],qs[_0x4e75('0x32')](_0x566b63[_0x4e75('0x2d')]['fields']));_0x139891[_0x4e75('0x31')]=_0x139891[_0x4e75('0x31')][_0x4e75('0x33')]?_0x139891[_0x4e75('0x31')]:_0x25fb5b[_0x4e75('0x2b')];if(!_0x566b63['query']['hasOwnProperty'](_0x4e75('0x34'))){_0x139891['limit']=qs[_0x4e75('0x19')](_0x566b63['query'][_0x4e75('0x19')]);_0x139891[_0x4e75('0x1b')]=qs[_0x4e75('0x1b')](_0x566b63[_0x4e75('0x2d')][_0x4e75('0x1b')]);}_0x139891[_0x4e75('0x35')]=qs['sort'](_0x566b63['query'][_0x4e75('0x36')]);_0x139891[_0x4e75('0x37')]=qs[_0x4e75('0x2f')](_[_0x4e75('0x38')](_0x566b63[_0x4e75('0x2d')],_0x25fb5b[_0x4e75('0x2f')]),_0x927b60);if(_0x566b63['query'][_0x4e75('0x39')]){_0x139891[_0x4e75('0x37')]=_[_0x4e75('0x3a')](_0x139891[_0x4e75('0x37')],{'$or':_[_0x4e75('0x2c')](_0x927b60,function(_0x203d0e){if(_0x203d0e[_0x4e75('0x29')]!==_0x4e75('0x3b')){var _0x7ef218={};_0x7ef218[_0x203d0e[_0x4e75('0x24')]]={'$like':'%'+_0x566b63[_0x4e75('0x2d')]['filter']+'%'};return _0x7ef218;}})});}_0x139891=_[_0x4e75('0x3a')]({},_0x139891,_0x566b63[_0x4e75('0x3c')]);var _0x9afd3a={'where':_0x139891[_0x4e75('0x37')]};return db[_0x4e75('0x3d')]['count'](_0x9afd3a)['then'](function(_0x4a600c){_0x4bea09['count']=_0x4a600c;if(_0x566b63[_0x4e75('0x2d')][_0x4e75('0x3e')]){_0x139891[_0x4e75('0x3f')]=[{'all':!![]}];}return db['SalesforceField'][_0x4e75('0x40')](_0x139891);})[_0x4e75('0x20')](function(_0x55bdc3){_0x4bea09['rows']=_0x55bdc3;return _0x4bea09;})[_0x4e75('0x20')](respondWithFilteredResult(_0x1a2410,_0x139891))['catch'](handleError(_0x1a2410,null));};exports[_0x4e75('0x41')]=function(_0x4cee8f,_0x3cfd62){var _0x5176d8={'raw':!![],'where':{'id':_0x4cee8f[_0x4e75('0x42')]['id']}},_0x13213b={};_0x13213b[_0x4e75('0x2b')]=_[_0x4e75('0x2e')](db[_0x4e75('0x3d')]['rawAttributes']);_0x13213b[_0x4e75('0x2d')]=_[_0x4e75('0x2e')](_0x4cee8f[_0x4e75('0x2d')]);_0x13213b['filters']=_[_0x4e75('0x30')](_0x13213b['model'],_0x13213b[_0x4e75('0x2d')]);_0x5176d8['attributes']=_['intersection'](_0x13213b[_0x4e75('0x2b')],qs[_0x4e75('0x32')](_0x4cee8f[_0x4e75('0x2d')][_0x4e75('0x32')]));_0x5176d8['attributes']=_0x5176d8[_0x4e75('0x31')][_0x4e75('0x33')]?_0x5176d8[_0x4e75('0x31')]:_0x13213b[_0x4e75('0x2b')];if(_0x4cee8f['query'][_0x4e75('0x3e')]){_0x5176d8['include']=[{'all':!![]}];}_0x5176d8=_[_0x4e75('0x3a')]({},_0x5176d8,_0x4cee8f[_0x4e75('0x3c')]);return db['SalesforceField'][_0x4e75('0x43')](_0x5176d8)[_0x4e75('0x20')](handleEntityNotFound(_0x3cfd62,null))['then'](respondWithResult(_0x3cfd62,null))[_0x4e75('0x44')](handleError(_0x3cfd62,null));};exports[_0x4e75('0x45')]=function(_0x222e11,_0x229067){return db[_0x4e75('0x3d')][_0x4e75('0x45')](_0x222e11[_0x4e75('0x46')],{})[_0x4e75('0x20')](respondWithResult(_0x229067,0xc9))['catch'](handleError(_0x229067,null));};exports[_0x4e75('0x47')]=function(_0x1cef86,_0x4f6d9c){if(_0x1cef86[_0x4e75('0x46')]['id']){delete _0x1cef86['body']['id'];}return db['SalesforceField'][_0x4e75('0x43')]({'where':{'id':_0x1cef86['params']['id']}})[_0x4e75('0x20')](handleEntityNotFound(_0x4f6d9c,null))[_0x4e75('0x20')](saveUpdates(_0x1cef86['body'],null))[_0x4e75('0x20')](respondWithResult(_0x4f6d9c,null))[_0x4e75('0x44')](handleError(_0x4f6d9c,null));};exports['destroy']=function(_0x4b5c50,_0x1f5e71){return db['SalesforceField']['find']({'where':{'id':_0x4b5c50[_0x4e75('0x42')]['id']}})[_0x4e75('0x20')](handleEntityNotFound(_0x1f5e71,null))[_0x4e75('0x20')](removeEntity(_0x1f5e71,null))[_0x4e75('0x44')](handleError(_0x1f5e71,null));}; \ No newline at end of file +var _0x3e2b=['lodash','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','../../mysqldb','sendStatus','status','json','offset','undefined','limit','Content-Range','apply','save','update','then','destroy','end','stack','name','send','index','map','SalesforceField','rawAttributes','type','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','count','includeAll','findAll','rows','catch','show','params','keys','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','fs-extra'];(function(_0xac4f72,_0x3e8646){var _0x1ce861=function(_0x1d3403){while(--_0x1d3403){_0xac4f72['push'](_0xac4f72['shift']());}};_0x1ce861(++_0x3e8646);}(_0x3e2b,0xd3));var _0xb3e2=function(_0x10b0cc,_0x2f3482){_0x10b0cc=_0x10b0cc-0x0;var _0x41638c=_0x3e2b[_0x10b0cc];return _0x41638c;};'use strict';var emlformat=require(_0xb3e2('0x0'));var rimraf=require(_0xb3e2('0x1'));var zipdir=require(_0xb3e2('0x2'));var jsonpatch=require(_0xb3e2('0x3'));var rp=require('request-promise');var moment=require(_0xb3e2('0x4'));var BPromise=require(_0xb3e2('0x5'));var Mustache=require('mustache');var util=require(_0xb3e2('0x6'));var path=require(_0xb3e2('0x7'));var sox=require(_0xb3e2('0x8'));var csv=require(_0xb3e2('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb3e2('0xa'));var _=require(_0xb3e2('0xb'));var squel=require('squel');var crypto=require(_0xb3e2('0xc'));var jsforce=require(_0xb3e2('0xd'));var deskjs=require(_0xb3e2('0xe'));var toCsv=require(_0xb3e2('0x9'));var querystring=require(_0xb3e2('0xf'));var Papa=require(_0xb3e2('0x10'));var Redis=require(_0xb3e2('0x11'));var authService=require(_0xb3e2('0x12'));var qs=require(_0xb3e2('0x13'));var as=require(_0xb3e2('0x14'));var hardwareService=require(_0xb3e2('0x15'));var logger=require(_0xb3e2('0x16'))('api');var utils=require(_0xb3e2('0x17'));var config=require(_0xb3e2('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xb3e2('0x19'))['db'];function respondWithStatusCode(_0x297720,_0x4acac3){_0x4acac3=_0x4acac3||0xcc;return function(_0x5e9be3){if(_0x5e9be3){return _0x297720[_0xb3e2('0x1a')](_0x4acac3);}return _0x297720['status'](_0x4acac3)['end']();};}function respondWithResult(_0x4d4688,_0x582eb8){_0x582eb8=_0x582eb8||0xc8;return function(_0x4ddb25){if(_0x4ddb25){return _0x4d4688[_0xb3e2('0x1b')](_0x582eb8)[_0xb3e2('0x1c')](_0x4ddb25);}};}function respondWithFilteredResult(_0x9eed7c,_0x48f6d5){return function(_0xd629fe){if(_0xd629fe){var _0x361e79=typeof _0x48f6d5[_0xb3e2('0x1d')]===_0xb3e2('0x1e')&&typeof _0x48f6d5[_0xb3e2('0x1f')]===_0xb3e2('0x1e');var _0x56b9d3=_0xd629fe['count'];var _0x40812b=_0x361e79?0x0:_0x48f6d5[_0xb3e2('0x1d')];var _0x249305=_0x361e79?_0xd629fe['count']:_0x48f6d5[_0xb3e2('0x1d')]+_0x48f6d5[_0xb3e2('0x1f')];var _0x44b6c9;if(_0x249305>=_0x56b9d3){_0x249305=_0x56b9d3;_0x44b6c9=0xc8;}else{_0x44b6c9=0xce;}_0x9eed7c[_0xb3e2('0x1b')](_0x44b6c9);return _0x9eed7c['set'](_0xb3e2('0x20'),_0x40812b+'-'+_0x249305+'/'+_0x56b9d3)[_0xb3e2('0x1c')](_0xd629fe);}return null;};}function patchUpdates(_0x23f108){return function(_0x3633bb){try{jsonpatch[_0xb3e2('0x21')](_0x3633bb,_0x23f108,!![]);}catch(_0x1b7473){return BPromise['reject'](_0x1b7473);}return _0x3633bb[_0xb3e2('0x22')]();};}function saveUpdates(_0x9abdd2,_0x26b06c){return function(_0x193519){if(_0x193519){return _0x193519[_0xb3e2('0x23')](_0x9abdd2)[_0xb3e2('0x24')](function(_0x29b24f){return _0x29b24f;});}return null;};}function removeEntity(_0x4080c6,_0x197f19){return function(_0x734cf2){if(_0x734cf2){return _0x734cf2[_0xb3e2('0x25')]()['then'](function(){_0x4080c6[_0xb3e2('0x1b')](0xcc)[_0xb3e2('0x26')]();});}};}function handleEntityNotFound(_0x669cee,_0x2b34d8){return function(_0x2ed433){if(!_0x2ed433){_0x669cee[_0xb3e2('0x1a')](0x194);}return _0x2ed433;};}function handleError(_0x2b8240,_0xb5165c){_0xb5165c=_0xb5165c||0x1f4;return function(_0x2d13f2){logger['error'](_0x2d13f2[_0xb3e2('0x27')]);if(_0x2d13f2[_0xb3e2('0x28')]){delete _0x2d13f2[_0xb3e2('0x28')];}_0x2b8240[_0xb3e2('0x1b')](_0xb5165c)[_0xb3e2('0x29')](_0x2d13f2);};}exports[_0xb3e2('0x2a')]=function(_0xd22786,_0x317790){var _0x26a0ec={},_0x4058a3={},_0x494478={'count':0x0,'rows':[]};var _0xbb0337=_[_0xb3e2('0x2b')](db[_0xb3e2('0x2c')][_0xb3e2('0x2d')],function(_0x2dd96d){return{'name':_0x2dd96d['fieldName'],'type':_0x2dd96d[_0xb3e2('0x2e')]['key']};});_0x4058a3['model']=_[_0xb3e2('0x2b')](_0xbb0337,_0xb3e2('0x28'));_0x4058a3[_0xb3e2('0x2f')]=_['keys'](_0xd22786[_0xb3e2('0x2f')]);_0x4058a3[_0xb3e2('0x30')]=_[_0xb3e2('0x31')](_0x4058a3['model'],_0x4058a3['query']);_0x26a0ec['attributes']=_[_0xb3e2('0x31')](_0x4058a3[_0xb3e2('0x32')],qs[_0xb3e2('0x33')](_0xd22786['query'][_0xb3e2('0x33')]));_0x26a0ec[_0xb3e2('0x34')]=_0x26a0ec[_0xb3e2('0x34')][_0xb3e2('0x35')]?_0x26a0ec['attributes']:_0x4058a3[_0xb3e2('0x32')];if(!_0xd22786[_0xb3e2('0x2f')][_0xb3e2('0x36')](_0xb3e2('0x37'))){_0x26a0ec[_0xb3e2('0x1f')]=qs[_0xb3e2('0x1f')](_0xd22786[_0xb3e2('0x2f')][_0xb3e2('0x1f')]);_0x26a0ec[_0xb3e2('0x1d')]=qs[_0xb3e2('0x1d')](_0xd22786[_0xb3e2('0x2f')][_0xb3e2('0x1d')]);}_0x26a0ec[_0xb3e2('0x38')]=qs[_0xb3e2('0x39')](_0xd22786['query'][_0xb3e2('0x39')]);_0x26a0ec[_0xb3e2('0x3a')]=qs['filters'](_['pick'](_0xd22786[_0xb3e2('0x2f')],_0x4058a3[_0xb3e2('0x30')]),_0xbb0337);if(_0xd22786[_0xb3e2('0x2f')][_0xb3e2('0x3b')]){_0x26a0ec[_0xb3e2('0x3a')]=_[_0xb3e2('0x3c')](_0x26a0ec['where'],{'$or':_[_0xb3e2('0x2b')](_0xbb0337,function(_0x15f54a){if(_0x15f54a[_0xb3e2('0x2e')]!==_0xb3e2('0x3d')){var _0x4184a2={};_0x4184a2[_0x15f54a['name']]={'$like':'%'+_0xd22786[_0xb3e2('0x2f')][_0xb3e2('0x3b')]+'%'};return _0x4184a2;}})});}_0x26a0ec=_[_0xb3e2('0x3c')]({},_0x26a0ec,_0xd22786[_0xb3e2('0x3e')]);var _0x324396={'where':_0x26a0ec['where']};return db[_0xb3e2('0x2c')][_0xb3e2('0x3f')](_0x324396)['then'](function(_0x5af8ed){_0x494478['count']=_0x5af8ed;if(_0xd22786[_0xb3e2('0x2f')][_0xb3e2('0x40')]){_0x26a0ec['include']=[{'all':!![]}];}return db[_0xb3e2('0x2c')][_0xb3e2('0x41')](_0x26a0ec);})[_0xb3e2('0x24')](function(_0x24f1cc){_0x494478[_0xb3e2('0x42')]=_0x24f1cc;return _0x494478;})[_0xb3e2('0x24')](respondWithFilteredResult(_0x317790,_0x26a0ec))[_0xb3e2('0x43')](handleError(_0x317790,null));};exports[_0xb3e2('0x44')]=function(_0x25f9d8,_0x4a74bd){var _0x49a0c2={'raw':!![],'where':{'id':_0x25f9d8[_0xb3e2('0x45')]['id']}},_0x94cbc8={};_0x94cbc8[_0xb3e2('0x32')]=_[_0xb3e2('0x46')](db[_0xb3e2('0x2c')][_0xb3e2('0x2d')]);_0x94cbc8[_0xb3e2('0x2f')]=_[_0xb3e2('0x46')](_0x25f9d8[_0xb3e2('0x2f')]);_0x94cbc8[_0xb3e2('0x30')]=_['intersection'](_0x94cbc8[_0xb3e2('0x32')],_0x94cbc8['query']);_0x49a0c2[_0xb3e2('0x34')]=_['intersection'](_0x94cbc8[_0xb3e2('0x32')],qs[_0xb3e2('0x33')](_0x25f9d8[_0xb3e2('0x2f')][_0xb3e2('0x33')]));_0x49a0c2[_0xb3e2('0x34')]=_0x49a0c2[_0xb3e2('0x34')][_0xb3e2('0x35')]?_0x49a0c2[_0xb3e2('0x34')]:_0x94cbc8[_0xb3e2('0x32')];if(_0x25f9d8['query']['includeAll']){_0x49a0c2['include']=[{'all':!![]}];}_0x49a0c2=_[_0xb3e2('0x3c')]({},_0x49a0c2,_0x25f9d8[_0xb3e2('0x3e')]);return db[_0xb3e2('0x2c')]['find'](_0x49a0c2)[_0xb3e2('0x24')](handleEntityNotFound(_0x4a74bd,null))[_0xb3e2('0x24')](respondWithResult(_0x4a74bd,null))[_0xb3e2('0x43')](handleError(_0x4a74bd,null));};exports['create']=function(_0x759302,_0x446476){return db[_0xb3e2('0x2c')][_0xb3e2('0x47')](_0x759302[_0xb3e2('0x48')],{})['then'](respondWithResult(_0x446476,0xc9))[_0xb3e2('0x43')](handleError(_0x446476,null));};exports[_0xb3e2('0x23')]=function(_0x18d382,_0x3c3f6a){if(_0x18d382['body']['id']){delete _0x18d382[_0xb3e2('0x48')]['id'];}return db[_0xb3e2('0x2c')][_0xb3e2('0x49')]({'where':{'id':_0x18d382[_0xb3e2('0x45')]['id']}})[_0xb3e2('0x24')](handleEntityNotFound(_0x3c3f6a,null))[_0xb3e2('0x24')](saveUpdates(_0x18d382['body'],null))[_0xb3e2('0x24')](respondWithResult(_0x3c3f6a,null))[_0xb3e2('0x43')](handleError(_0x3c3f6a,null));};exports['destroy']=function(_0x3cc43a,_0x90447d){return db['SalesforceField']['find']({'where':{'id':_0x3cc43a[_0xb3e2('0x45')]['id']}})[_0xb3e2('0x24')](handleEntityNotFound(_0x90447d,null))['then'](removeEntity(_0x90447d,null))[_0xb3e2('0x43')](handleError(_0x90447d,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index 0638f18..396fa60 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 _0x3231=['./intSalesforceField.attributes','exports','define','int_salesforce_fields','salesforce_unique_index','idField','FieldId','lodash','util','api','request-promise','path','rimraf','../../config/environment'];(function(_0x1b70e3,_0x3a15b1){var _0x1452ab=function(_0x692883){while(--_0x692883){_0x1b70e3['push'](_0x1b70e3['shift']());}};_0x1452ab(++_0x3a15b1);}(_0x3231,0x103));var _0x1323=function(_0x3d39ea,_0x4ce74c){_0x3d39ea=_0x3d39ea-0x0;var _0x5832ea=_0x3231[_0x3d39ea];return _0x5832ea;};'use strict';var _=require(_0x1323('0x0'));var util=require(_0x1323('0x1'));var logger=require('../../config/logger')(_0x1323('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x1323('0x3'));var fs=require('fs');var path=require(_0x1323('0x4'));var rimraf=require(_0x1323('0x5'));var config=require(_0x1323('0x6'));var attributes=require(_0x1323('0x7'));module[_0x1323('0x8')]=function(_0x5b15d0,_0x3eff29){return _0x5b15d0[_0x1323('0x9')]('SalesforceField',attributes,{'tableName':_0x1323('0xa'),'paranoid':![],'indexes':[{'name':_0x1323('0xb'),'fields':[_0x1323('0xc'),_0x1323('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9406=['request-promise','rimraf','exports','define','int_salesforce_fields','salesforce_unique_index','idField','FieldId','lodash','util','../../config/logger','api','bluebird'];(function(_0x2d17b0,_0x773ed4){var _0x3af5be=function(_0x3b7704){while(--_0x3b7704){_0x2d17b0['push'](_0x2d17b0['shift']());}};_0x3af5be(++_0x773ed4);}(_0x9406,0x1cf));var _0x6940=function(_0x31d91a,_0x53be16){_0x31d91a=_0x31d91a-0x0;var _0x25f005=_0x9406[_0x31d91a];return _0x25f005;};'use strict';var _=require(_0x6940('0x0'));var util=require(_0x6940('0x1'));var logger=require(_0x6940('0x2'))(_0x6940('0x3'));var moment=require('moment');var BPromise=require(_0x6940('0x4'));var rp=require(_0x6940('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6940('0x6'));var config=require('../../config/environment');var attributes=require('./intSalesforceField.attributes');module[_0x6940('0x7')]=function(_0x208e76,_0x2d199c){return _0x208e76[_0x6940('0x8')]('SalesforceField',attributes,{'tableName':_0x6940('0x9'),'paranoid':![],'indexes':[{'name':_0x6940('0xa'),'fields':[_0x6940('0xb'),_0x6940('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 c0c96c8..aeeb0de 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 _0xeb28=['stringify','error','code','message','info','result','lodash','util','moment','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','SalesforceField,\x20%s,\x20%s','request\x20sent','SalesforceField,\x20%s,\x20%s,\x20%s'];(function(_0x5d9cbf,_0x375663){var _0x3834da=function(_0x12cdce){while(--_0x12cdce){_0x5d9cbf['push'](_0x5d9cbf['shift']());}};_0x3834da(++_0x375663);}(_0xeb28,0x10a));var _0x8eb2=function(_0x58ffb0,_0x49b380){_0x58ffb0=_0x58ffb0-0x0;var _0x3f6dae=_0xeb28[_0x58ffb0];return _0x3f6dae;};'use strict';var _=require(_0x8eb2('0x0'));var util=require(_0x8eb2('0x1'));var moment=require(_0x8eb2('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x8eb2('0x3'));var logger=require(_0x8eb2('0x4'))(_0x8eb2('0x5'));var config=require('../../config/environment');var jayson=require(_0x8eb2('0x6'));var client=jayson[_0x8eb2('0x7')][_0x8eb2('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x255d40,_0x3ec62a,_0x423ab8){return new BPromise(function(_0x5a4aaf,_0x206d91){return client[_0x8eb2('0x9')](_0x255d40,_0x423ab8)[_0x8eb2('0xa')](function(_0x187d44){logger['info'](_0x8eb2('0xb'),_0x3ec62a,_0x8eb2('0xc'));logger['debug'](_0x8eb2('0xd'),_0x3ec62a,'request\x20sent',JSON[_0x8eb2('0xe')](_0x187d44));if(_0x187d44[_0x8eb2('0xf')]){if(_0x187d44[_0x8eb2('0xf')][_0x8eb2('0x10')]===0x1f4){logger[_0x8eb2('0xf')](_0x8eb2('0xb'),_0x3ec62a,_0x187d44[_0x8eb2('0xf')][_0x8eb2('0x11')]);return _0x206d91(_0x187d44[_0x8eb2('0xf')][_0x8eb2('0x11')]);}logger[_0x8eb2('0xf')](_0x8eb2('0xb'),_0x3ec62a,_0x187d44[_0x8eb2('0xf')][_0x8eb2('0x11')]);return _0x5a4aaf(_0x187d44['error'][_0x8eb2('0x11')]);}else{logger[_0x8eb2('0x12')](_0x8eb2('0xb'),_0x3ec62a,'request\x20sent');_0x5a4aaf(_0x187d44[_0x8eb2('0x13')]['message']);}})['catch'](function(_0x5821c8){logger[_0x8eb2('0xf')](_0x8eb2('0xb'),_0x3ec62a,_0x5821c8);_0x206d91(_0x5821c8);});});} \ No newline at end of file +var _0x4583=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','SalesforceField,\x20%s,\x20%s','request\x20sent','debug','SalesforceField,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','moment','randomstring','ioredis','../../mysqldb'];(function(_0x38b6a9,_0x4506aa){var _0x4888bb=function(_0x138c24){while(--_0x138c24){_0x38b6a9['push'](_0x38b6a9['shift']());}};_0x4888bb(++_0x4506aa);}(_0x4583,0x79));var _0x3458=function(_0x349bb4,_0x16f67a){_0x349bb4=_0x349bb4-0x0;var _0x14c8d1=_0x4583[_0x349bb4];return _0x14c8d1;};'use strict';var _=require(_0x3458('0x0'));var util=require('util');var moment=require(_0x3458('0x1'));var BPromise=require('bluebird');var rs=require(_0x3458('0x2'));var fs=require('fs');var Redis=require(_0x3458('0x3'));var db=require(_0x3458('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x3458('0x5'));var config=require(_0x3458('0x6'));var jayson=require(_0x3458('0x7'));var client=jayson[_0x3458('0x8')][_0x3458('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x359651,_0x405042,_0x55f67){return new BPromise(function(_0x5059ba,_0x22b833){return client[_0x3458('0xa')](_0x359651,_0x55f67)[_0x3458('0xb')](function(_0x3bb03f){logger[_0x3458('0xc')](_0x3458('0xd'),_0x405042,_0x3458('0xe'));logger[_0x3458('0xf')](_0x3458('0x10'),_0x405042,_0x3458('0xe'),JSON['stringify'](_0x3bb03f));if(_0x3bb03f['error']){if(_0x3bb03f[_0x3458('0x11')][_0x3458('0x12')]===0x1f4){logger['error'](_0x3458('0xd'),_0x405042,_0x3bb03f[_0x3458('0x11')][_0x3458('0x13')]);return _0x22b833(_0x3bb03f[_0x3458('0x11')]['message']);}logger[_0x3458('0x11')](_0x3458('0xd'),_0x405042,_0x3bb03f[_0x3458('0x11')][_0x3458('0x13')]);return _0x5059ba(_0x3bb03f[_0x3458('0x11')]['message']);}else{logger['info'](_0x3458('0xd'),_0x405042,_0x3458('0xe'));_0x5059ba(_0x3bb03f['result'][_0x3458('0x13')]);}})[_0x3458('0x14')](function(_0x419f27){logger[_0x3458('0x11')]('SalesforceField,\x20%s,\x20%s',_0x405042,_0x419f27);_0x22b833(_0x419f27);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index b8f49f4..5cdce93 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 _0xd8b4=['index','/:id','isAuthenticated','getConfigurations','getFields','post','create','/:id/configurations','addConfiguration','put','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../config/environment','./intServicenowAccount.controller','get'];(function(_0x3d568f,_0x56a0c7){var _0x466d25=function(_0xa20a18){while(--_0xa20a18){_0x3d568f['push'](_0x3d568f['shift']());}};_0x466d25(++_0x56a0c7);}(_0xd8b4,0xff));var _0x4d8b=function(_0x4b10a1,_0x5dba53){_0x4b10a1=_0x4b10a1-0x0;var _0x25f2c5=_0xd8b4[_0x4b10a1];return _0x25f2c5;};'use strict';var multer=require(_0x4d8b('0x0'));var util=require(_0x4d8b('0x1'));var path=require(_0x4d8b('0x2'));var timeout=require('connect-timeout');var express=require(_0x4d8b('0x3'));var router=express[_0x4d8b('0x4')]();var fs_extra=require(_0x4d8b('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x4d8b('0x6'));var controller=require(_0x4d8b('0x7'));router[_0x4d8b('0x8')]('/',auth['isAuthenticated'](),controller[_0x4d8b('0x9')]);router[_0x4d8b('0x8')](_0x4d8b('0xa'),auth[_0x4d8b('0xb')](),controller['show']);router[_0x4d8b('0x8')]('/:id/configurations',auth[_0x4d8b('0xb')](),controller[_0x4d8b('0xc')]);router[_0x4d8b('0x8')]('/:id/fields',auth[_0x4d8b('0xb')](),controller[_0x4d8b('0xd')]);router[_0x4d8b('0xe')]('/',auth[_0x4d8b('0xb')](),controller[_0x4d8b('0xf')]);router[_0x4d8b('0xe')](_0x4d8b('0x10'),auth['isAuthenticated'](),controller[_0x4d8b('0x11')]);router[_0x4d8b('0x12')]('/:id',auth[_0x4d8b('0xb')](),controller['update']);router[_0x4d8b('0x13')]('/:id',auth[_0x4d8b('0xb')](),controller[_0x4d8b('0x14')]);module[_0x4d8b('0x15')]=router; \ No newline at end of file +var _0xed7a=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intServicenowAccount.controller','get','index','isAuthenticated','/:id/configurations','getConfigurations','/:id/fields','post','create','put','update','delete','/:id','destroy','exports','multer','util'];(function(_0x43624a,_0x226995){var _0x4c34a0=function(_0x2d6c6e){while(--_0x2d6c6e){_0x43624a['push'](_0x43624a['shift']());}};_0x4c34a0(++_0x226995);}(_0xed7a,0x9f));var _0xaed7=function(_0x17bf4c,_0x43408b){_0x17bf4c=_0x17bf4c-0x0;var _0x3c1a9a=_0xed7a[_0x17bf4c];return _0x3c1a9a;};'use strict';var multer=require(_0xaed7('0x0'));var util=require(_0xaed7('0x1'));var path=require('path');var timeout=require(_0xaed7('0x2'));var express=require(_0xaed7('0x3'));var router=express[_0xaed7('0x4')]();var fs_extra=require(_0xaed7('0x5'));var auth=require(_0xaed7('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xaed7('0x7'));var controller=require(_0xaed7('0x8'));router[_0xaed7('0x9')]('/',auth['isAuthenticated'](),controller[_0xaed7('0xa')]);router[_0xaed7('0x9')]('/:id',auth[_0xaed7('0xb')](),controller['show']);router['get'](_0xaed7('0xc'),auth[_0xaed7('0xb')](),controller[_0xaed7('0xd')]);router[_0xaed7('0x9')](_0xaed7('0xe'),auth[_0xaed7('0xb')](),controller['getFields']);router[_0xaed7('0xf')]('/',auth[_0xaed7('0xb')](),controller[_0xaed7('0x10')]);router['post'](_0xaed7('0xc'),auth['isAuthenticated'](),controller['addConfiguration']);router[_0xaed7('0x11')]('/:id',auth['isAuthenticated'](),controller[_0xaed7('0x12')]);router[_0xaed7('0x13')](_0xaed7('0x14'),auth[_0xaed7('0xb')](),controller[_0xaed7('0x15')]);module[_0xaed7('0x16')]=router; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.attributes.js b/server/api/intServicenowAccount/intServicenowAccount.attributes.js index 4749fe1..ecc2dd3 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 _0x5f1e=['exports','STRING','username','sequelize'];(function(_0x66d8f5,_0x2f6f6f){var _0x28d1b5=function(_0x3b8bec){while(--_0x3b8bec){_0x66d8f5['push'](_0x66d8f5['shift']());}};_0x28d1b5(++_0x2f6f6f);}(_0x5f1e,0xbf));var _0xe5f1=function(_0x1695d2,_0x357e1a){_0x1695d2=_0x1695d2-0x0;var _0x3cec68=_0x5f1e[_0x1695d2];return _0x3cec68;};'use strict';var Sequelize=require(_0xe5f1('0x0'));module[_0xe5f1('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xe5f1('0x2')]},'username':{'type':Sequelize[_0xe5f1('0x2')],'unique':_0xe5f1('0x3')},'password':{'type':Sequelize[_0xe5f1('0x2')]},'email':{'type':Sequelize[_0xe5f1('0x2')]},'remoteUri':{'type':Sequelize[_0xe5f1('0x2')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0xe5f1('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xe69b=['sequelize','exports','STRING','remoteUri'];(function(_0x5c715f,_0x1f34fc){var _0x5c3c46=function(_0x28b7ff){while(--_0x28b7ff){_0x5c715f['push'](_0x5c715f['shift']());}};_0x5c3c46(++_0x1f34fc);}(_0xe69b,0x188));var _0xbe69=function(_0x5e1516,_0x1e47fb){_0x5e1516=_0x5e1516-0x0;var _0x2033f1=_0xe69b[_0x5e1516];return _0x2033f1;};'use strict';var Sequelize=require(_0xbe69('0x0'));module[_0xbe69('0x1')]={'name':{'type':Sequelize[_0xbe69('0x2')]},'description':{'type':Sequelize[_0xbe69('0x2')]},'username':{'type':Sequelize[_0xbe69('0x2')],'unique':'username'},'password':{'type':Sequelize[_0xbe69('0x2')]},'email':{'type':Sequelize[_0xbe69('0x2')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0xbe69('0x3')},'serverUrl':{'type':Sequelize[_0xbe69('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.controller.js b/server/api/intServicenowAccount/intServicenowAccount.controller.js index 17b268b..bd08451 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 _0xc947=['calendar_stc','cmdb_ci','delivery_plan','active','priority','rfc','time_worked','expected_start','opened_at','business_duration','group_list','work_end','reopened_time','resolved_at','caller_id','approval_set','correlation_display','delivery_task','work_start','assignment_group','business_stc','calendar_duration','sys_class_name','close_notes','closed_by','follow_up','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','sys_tags','escalation','upon_approval','location','email','remoteUri','serverUrl','substring','format','%s/api/now/doc/table/schema/','%s/api/now/table/','username','password','GET','incident?sysparm_display_value=all','result','log','incident\x20table\x20objects','assign','forEach','internalType','label','push','all','includes','concat','ServiceNow\x20error:\x20','test','statusCode','error','stack','Wrong\x20credentials','boolean','True','true','False','false','sys_choice?sysparm_query=name=incident^element=','inactive','value','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','../../components/integrations/configuration','status','json','undefined','limit','count','offset','set','apply','save','update','then','destroy','end','sendStatus','name','send','index','map','ServicenowAccount','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','VIRTUAL','filter','options','findAll','rows','catch','show','rawAttributes','keys','include','merge','find','create','body','params','getConfigurations','findOne','ServicenowConfiguration','addConfiguration','Subjects','getSubjects','channel','Descriptions','getDescriptions','ServicenowField','getFields','made_sla','hold_reason','knowledge','subcategory','notify','severity','category','caused_by','watch_list','upon_reject','sys_updated_on','child_incidents','approval_history','resolved_by','sys_updated_by','opened_by','user_input','sys_created_on','state','sys_created_by'];(function(_0x413068,_0x4fd2d8){var _0x2ee70e=function(_0x3458a4){while(--_0x3458a4){_0x413068['push'](_0x413068['shift']());}};_0x2ee70e(++_0x4fd2d8);}(_0xc947,0x1ca));var _0x7c94=function(_0x4a7077,_0x5dbcc0){_0x4a7077=_0x4a7077-0x0;var _0x3ed008=_0xc947[_0x4a7077];return _0x3ed008;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7c94('0x0'));var zipdir=require(_0x7c94('0x1'));var jsonpatch=require(_0x7c94('0x2'));var rp=require(_0x7c94('0x3'));var moment=require(_0x7c94('0x4'));var BPromise=require(_0x7c94('0x5'));var Mustache=require(_0x7c94('0x6'));var util=require(_0x7c94('0x7'));var path=require(_0x7c94('0x8'));var sox=require(_0x7c94('0x9'));var csv=require('to-csv');var ejs=require(_0x7c94('0xa'));var fs=require('fs');var fs_extra=require(_0x7c94('0xb'));var _=require(_0x7c94('0xc'));var squel=require('squel');var crypto=require(_0x7c94('0xd'));var jsforce=require(_0x7c94('0xe'));var deskjs=require(_0x7c94('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7c94('0x10'));var Papa=require(_0x7c94('0x11'));var Redis=require(_0x7c94('0x12'));var authService=require(_0x7c94('0x13'));var qs=require(_0x7c94('0x14'));var as=require(_0x7c94('0x15'));var hardwareService=require(_0x7c94('0x16'));var logger=require(_0x7c94('0x17'))(_0x7c94('0x18'));var utils=require(_0x7c94('0x19'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x7c94('0x1a'))['db'];var integrations=require(_0x7c94('0x1b'));function respondWithStatusCode(_0x410dac,_0x51c53b){_0x51c53b=_0x51c53b||0xcc;return function(_0x2bb3c6){if(_0x2bb3c6){return _0x410dac['sendStatus'](_0x51c53b);}return _0x410dac[_0x7c94('0x1c')](_0x51c53b)['end']();};}function respondWithResult(_0x130988,_0x49f6fd){_0x49f6fd=_0x49f6fd||0xc8;return function(_0x36e450){if(_0x36e450){return _0x130988['status'](_0x49f6fd)[_0x7c94('0x1d')](_0x36e450);}};}function respondWithFilteredResult(_0x5a4fd9,_0x25f117){return function(_0x5a477f){if(_0x5a477f){var _0x239ded=typeof _0x25f117['offset']===_0x7c94('0x1e')&&typeof _0x25f117[_0x7c94('0x1f')]==='undefined';var _0x5cf6a0=_0x5a477f[_0x7c94('0x20')];var _0x528077=_0x239ded?0x0:_0x25f117[_0x7c94('0x21')];var _0x439712=_0x239ded?_0x5a477f[_0x7c94('0x20')]:_0x25f117['offset']+_0x25f117[_0x7c94('0x1f')];var _0x35534a;if(_0x439712>=_0x5cf6a0){_0x439712=_0x5cf6a0;_0x35534a=0xc8;}else{_0x35534a=0xce;}_0x5a4fd9[_0x7c94('0x1c')](_0x35534a);return _0x5a4fd9[_0x7c94('0x22')]('Content-Range',_0x528077+'-'+_0x439712+'/'+_0x5cf6a0)[_0x7c94('0x1d')](_0x5a477f);}return null;};}function patchUpdates(_0x12f433){return function(_0x48f89f){try{jsonpatch[_0x7c94('0x23')](_0x48f89f,_0x12f433,!![]);}catch(_0x1dfaf2){return BPromise['reject'](_0x1dfaf2);}return _0x48f89f[_0x7c94('0x24')]();};}function saveUpdates(_0x3dfd86,_0x34fa25){return function(_0x3c05de){if(_0x3c05de){return _0x3c05de[_0x7c94('0x25')](_0x3dfd86)[_0x7c94('0x26')](function(_0x41ba21){return _0x41ba21;});}return null;};}function removeEntity(_0x8e53b6,_0x10f683){return function(_0x45d42f){if(_0x45d42f){return _0x45d42f[_0x7c94('0x27')]()['then'](function(){_0x8e53b6[_0x7c94('0x1c')](0xcc)[_0x7c94('0x28')]();});}};}function handleEntityNotFound(_0x3e28a1,_0x163ba6){return function(_0x30dc3a){if(!_0x30dc3a){_0x3e28a1[_0x7c94('0x29')](0x194);}return _0x30dc3a;};}function handleError(_0x363f6a,_0xf3eda9){_0xf3eda9=_0xf3eda9||0x1f4;return function(_0x4166bd){logger['error'](_0x4166bd['stack']);if(_0x4166bd[_0x7c94('0x2a')]){delete _0x4166bd['name'];}_0x363f6a[_0x7c94('0x1c')](_0xf3eda9)[_0x7c94('0x2b')](_0x4166bd);};}exports[_0x7c94('0x2c')]=function(_0x335c85,_0x505f46){var _0x18d206={},_0x35d983={},_0x5bed22={'count':0x0,'rows':[]};var _0x43b650=_[_0x7c94('0x2d')](db[_0x7c94('0x2e')]['rawAttributes'],function(_0x77ab5d){return{'name':_0x77ab5d[_0x7c94('0x2f')],'type':_0x77ab5d[_0x7c94('0x30')][_0x7c94('0x31')]};});_0x35d983[_0x7c94('0x32')]=_['map'](_0x43b650,_0x7c94('0x2a'));_0x35d983[_0x7c94('0x33')]=_['keys'](_0x335c85['query']);_0x35d983[_0x7c94('0x34')]=_[_0x7c94('0x35')](_0x35d983[_0x7c94('0x32')],_0x35d983[_0x7c94('0x33')]);_0x18d206[_0x7c94('0x36')]=_['intersection'](_0x35d983[_0x7c94('0x32')],qs['fields'](_0x335c85[_0x7c94('0x33')][_0x7c94('0x37')]));_0x18d206[_0x7c94('0x36')]=_0x18d206[_0x7c94('0x36')][_0x7c94('0x38')]?_0x18d206[_0x7c94('0x36')]:_0x35d983[_0x7c94('0x32')];if(!_0x335c85['query'][_0x7c94('0x39')](_0x7c94('0x3a'))){_0x18d206['limit']=qs[_0x7c94('0x1f')](_0x335c85[_0x7c94('0x33')][_0x7c94('0x1f')]);_0x18d206[_0x7c94('0x21')]=qs[_0x7c94('0x21')](_0x335c85[_0x7c94('0x33')][_0x7c94('0x21')]);}_0x18d206[_0x7c94('0x3b')]=qs[_0x7c94('0x3c')](_0x335c85[_0x7c94('0x33')][_0x7c94('0x3c')]);_0x18d206['where']=qs[_0x7c94('0x34')](_[_0x7c94('0x3d')](_0x335c85[_0x7c94('0x33')],_0x35d983[_0x7c94('0x34')]),_0x43b650);if(_0x335c85[_0x7c94('0x33')]['filter']){_0x18d206[_0x7c94('0x3e')]=_['merge'](_0x18d206['where'],{'$or':_[_0x7c94('0x2d')](_0x43b650,function(_0x4b1a07){if(_0x4b1a07[_0x7c94('0x30')]!==_0x7c94('0x3f')){var _0x45ae43={};_0x45ae43[_0x4b1a07[_0x7c94('0x2a')]]={'$like':'%'+_0x335c85[_0x7c94('0x33')][_0x7c94('0x40')]+'%'};return _0x45ae43;}})});}_0x18d206=_['merge']({},_0x18d206,_0x335c85[_0x7c94('0x41')]);var _0x18b78e={'where':_0x18d206[_0x7c94('0x3e')]};return db[_0x7c94('0x2e')]['count'](_0x18b78e)[_0x7c94('0x26')](function(_0x5ad3c5){_0x5bed22[_0x7c94('0x20')]=_0x5ad3c5;if(_0x335c85[_0x7c94('0x33')]['includeAll']){_0x18d206['include']=[{'all':!![]}];}return db[_0x7c94('0x2e')][_0x7c94('0x42')](_0x18d206);})[_0x7c94('0x26')](function(_0x321633){_0x5bed22[_0x7c94('0x43')]=_0x321633;return _0x5bed22;})[_0x7c94('0x26')](respondWithFilteredResult(_0x505f46,_0x18d206))[_0x7c94('0x44')](handleError(_0x505f46,null));};exports[_0x7c94('0x45')]=function(_0x70e4c5,_0x153c05){var _0x7f4df2={'raw':![],'where':{'id':_0x70e4c5['params']['id']}},_0x59aac6={};_0x59aac6[_0x7c94('0x32')]=_['keys'](db[_0x7c94('0x2e')][_0x7c94('0x46')]);_0x59aac6[_0x7c94('0x33')]=_[_0x7c94('0x47')](_0x70e4c5[_0x7c94('0x33')]);_0x59aac6['filters']=_[_0x7c94('0x35')](_0x59aac6[_0x7c94('0x32')],_0x59aac6[_0x7c94('0x33')]);_0x7f4df2[_0x7c94('0x36')]=_['intersection'](_0x59aac6[_0x7c94('0x32')],qs[_0x7c94('0x37')](_0x70e4c5['query'][_0x7c94('0x37')]));_0x7f4df2[_0x7c94('0x36')]=_0x7f4df2['attributes']['length']?_0x7f4df2[_0x7c94('0x36')]:_0x59aac6['model'];if(_0x70e4c5[_0x7c94('0x33')]['includeAll']){_0x7f4df2[_0x7c94('0x48')]=[{'all':!![]}];}_0x7f4df2=_[_0x7c94('0x49')]({},_0x7f4df2,_0x70e4c5[_0x7c94('0x41')]);return db[_0x7c94('0x2e')][_0x7c94('0x4a')](_0x7f4df2)['then'](handleEntityNotFound(_0x153c05,null))['then'](respondWithResult(_0x153c05,null))[_0x7c94('0x44')](handleError(_0x153c05,null));};exports[_0x7c94('0x4b')]=function(_0x396803,_0x4485f2){return db[_0x7c94('0x2e')]['create'](_0x396803[_0x7c94('0x4c')],{})[_0x7c94('0x26')](respondWithResult(_0x4485f2,0xc9))['catch'](handleError(_0x4485f2,null));};exports[_0x7c94('0x25')]=function(_0x5c09a3,_0x1f93e5){if(_0x5c09a3[_0x7c94('0x4c')]['id']){delete _0x5c09a3['body']['id'];}return db[_0x7c94('0x2e')][_0x7c94('0x4a')]({'where':{'id':_0x5c09a3['params']['id']}})[_0x7c94('0x26')](handleEntityNotFound(_0x1f93e5,null))[_0x7c94('0x26')](saveUpdates(_0x5c09a3[_0x7c94('0x4c')],null))['then'](respondWithResult(_0x1f93e5,null))[_0x7c94('0x44')](handleError(_0x1f93e5,null));};exports['destroy']=function(_0x31ee7b,_0x13ddb6){return db[_0x7c94('0x2e')][_0x7c94('0x4a')]({'where':{'id':_0x31ee7b[_0x7c94('0x4d')]['id']}})[_0x7c94('0x26')](handleEntityNotFound(_0x13ddb6,null))['then'](removeEntity(_0x13ddb6,null))[_0x7c94('0x44')](handleError(_0x13ddb6,null));};exports[_0x7c94('0x4e')]=function(_0x64ea0d,_0x5befaa,_0x2c60a8){var _0x482765={};var _0x2d73ff={};var _0x5b3425;var _0x40367e;return db[_0x7c94('0x2e')][_0x7c94('0x4f')]({'where':{'id':_0x64ea0d['params']['id']}})[_0x7c94('0x26')](handleEntityNotFound(_0x5befaa,null))['then'](function(_0x196f32){if(_0x196f32){_0x5b3425=_0x196f32;_0x2d73ff[_0x7c94('0x32')]=_[_0x7c94('0x47')](db[_0x7c94('0x50')][_0x7c94('0x46')]);_0x2d73ff['query']=_[_0x7c94('0x47')](_0x64ea0d[_0x7c94('0x33')]);_0x2d73ff[_0x7c94('0x34')]=_['intersection'](_0x2d73ff[_0x7c94('0x32')],_0x2d73ff['query']);_0x482765[_0x7c94('0x36')]=_[_0x7c94('0x35')](_0x2d73ff[_0x7c94('0x32')],qs[_0x7c94('0x37')](_0x64ea0d[_0x7c94('0x33')][_0x7c94('0x37')]));_0x482765[_0x7c94('0x36')]=_0x482765[_0x7c94('0x36')][_0x7c94('0x38')]?_0x482765[_0x7c94('0x36')]:_0x2d73ff[_0x7c94('0x32')];_0x482765[_0x7c94('0x3b')]=qs[_0x7c94('0x3c')](_0x64ea0d['query'][_0x7c94('0x3c')]);_0x482765['where']=qs[_0x7c94('0x34')](_[_0x7c94('0x3d')](_0x64ea0d['query'],_0x2d73ff[_0x7c94('0x34')]));if(_0x64ea0d[_0x7c94('0x33')][_0x7c94('0x40')]){_0x482765[_0x7c94('0x3e')]=_['merge'](_0x482765[_0x7c94('0x3e')],{'$or':_[_0x7c94('0x2d')](_0x482765[_0x7c94('0x36')],function(_0x208081){var _0x5743dd={};_0x5743dd[_0x208081]={'$like':'%'+_0x64ea0d['query'][_0x7c94('0x40')]+'%'};return _0x5743dd;})});}_0x482765=_['merge']({},_0x482765,_0x64ea0d[_0x7c94('0x41')]);return _0x5b3425[_0x7c94('0x4e')](_0x482765);}})[_0x7c94('0x26')](function(_0x46fc0f){if(_0x46fc0f){_0x40367e=_0x46fc0f[_0x7c94('0x38')];if(!_0x64ea0d[_0x7c94('0x33')][_0x7c94('0x39')](_0x7c94('0x3a'))){_0x482765[_0x7c94('0x1f')]=qs[_0x7c94('0x1f')](_0x64ea0d['query'][_0x7c94('0x1f')]);_0x482765[_0x7c94('0x21')]=qs[_0x7c94('0x21')](_0x64ea0d[_0x7c94('0x33')]['offset']);}return _0x5b3425[_0x7c94('0x4e')](_0x482765);}})[_0x7c94('0x26')](function(_0x788ef9){if(_0x788ef9){return _0x788ef9?{'count':_0x40367e,'rows':_0x788ef9}:null;}})[_0x7c94('0x26')](respondWithResult(_0x5befaa,null))[_0x7c94('0x44')](handleError(_0x5befaa,null));};exports[_0x7c94('0x51')]=function(_0x538953,_0x1ef20d,_0xe8569a){if(_0x538953['body']['id']){delete _0x538953[_0x7c94('0x4c')]['id'];}return db['ServicenowAccount'][_0x7c94('0x4f')]({'where':{'id':_0x538953['params']['id']}})[_0x7c94('0x26')](handleEntityNotFound(_0x1ef20d,null))['then'](function(_0x45aa2c){if(_0x45aa2c){_0x538953[_0x7c94('0x4c')]['AccountId']=_0x45aa2c['id'];_0x538953[_0x7c94('0x4c')][_0x7c94('0x52')]=integrations[_0x7c94('0x53')](_0x538953[_0x7c94('0x4c')][_0x7c94('0x54')],_0x538953[_0x7c94('0x4c')][_0x7c94('0x30')]);_0x538953[_0x7c94('0x4c')][_0x7c94('0x55')]=integrations[_0x7c94('0x56')](_0x538953[_0x7c94('0x4c')]['channel'],_0x538953[_0x7c94('0x4c')][_0x7c94('0x30')]);return db[_0x7c94('0x50')]['create'](_0x538953[_0x7c94('0x4c')],{'include':[{'model':db[_0x7c94('0x57')],'as':_0x7c94('0x52')},{'model':db[_0x7c94('0x57')],'as':_0x7c94('0x55')}]});}return null;})[_0x7c94('0x26')](respondWithResult(_0x1ef20d,null))[_0x7c94('0x44')](handleError(_0x1ef20d,null));};exports[_0x7c94('0x58')]=function(_0xfcacb1,_0x5ce061,_0x558cf){var _0x483e05=[_0x7c94('0x59'),_0x7c94('0x5a'),_0x7c94('0x5b'),_0x7c94('0x5c'),'close_code',_0x7c94('0x5d'),'incident_state',_0x7c94('0x5e'),_0x7c94('0x5f')];var _0x16ce32=['parent',_0x7c94('0x59'),_0x7c94('0x60'),_0x7c94('0x61'),_0x7c94('0x62'),_0x7c94('0x63'),_0x7c94('0x64'),_0x7c94('0x5a'),_0x7c94('0x65'),'number',_0x7c94('0x66'),_0x7c94('0x67'),_0x7c94('0x68'),_0x7c94('0x69'),_0x7c94('0x6a'),'sys_domain',_0x7c94('0x6b'),_0x7c94('0x6c'),'knowledge','order',_0x7c94('0x6d'),'closed_at',_0x7c94('0x6e'),_0x7c94('0x6f'),'impact',_0x7c94('0x70'),'work_notes_list','business_service',_0x7c94('0x71'),'sys_domain_path',_0x7c94('0x72'),_0x7c94('0x73'),_0x7c94('0x74'),_0x7c94('0x75'),_0x7c94('0x76'),_0x7c94('0x77'),_0x7c94('0x78'),_0x7c94('0x79'),_0x7c94('0x7a'),_0x7c94('0x7b'),_0x7c94('0x7c'),_0x7c94('0x5c'),'work_notes','short_description','close_code',_0x7c94('0x7d'),_0x7c94('0x7e'),_0x7c94('0x7f'),_0x7c94('0x80'),_0x7c94('0x81'),'additional_assignee_list','description',_0x7c94('0x82'),_0x7c94('0x5d'),_0x7c94('0x83'),_0x7c94('0x84'),_0x7c94('0x85'),_0x7c94('0x86'),'parent_incident','sys_id',_0x7c94('0x87'),_0x7c94('0x88'),'incident_state',_0x7c94('0x89'),_0x7c94('0x8a'),_0x7c94('0x8b'),_0x7c94('0x8c'),_0x7c94('0x8d'),_0x7c94('0x8e'),_0x7c94('0x5e'),_0x7c94('0x8f'),_0x7c94('0x90'),_0x7c94('0x91'),_0x7c94('0x92'),_0x7c94('0x93'),_0x7c94('0x94'),'reopen_count',_0x7c94('0x95'),_0x7c94('0x96'),_0x7c94('0x97'),'correlation_id',_0x7c94('0x98'),_0x7c94('0x5f')];var _0x285b9d='';var _0x497ea3='';var _0x67701b=[];var _0x3f85b5='';var _0x422472='';var _0x343b15=[];var _0x473937='';var _0x2212fe='';var _0x46b6d7={};var _0x29c5d3='';return db[_0x7c94('0x2e')][_0x7c94('0x4f')]({'where':{'id':_0xfcacb1[_0x7c94('0x4d')]['id']},'attributes':['id','username','password',_0x7c94('0x99'),_0x7c94('0x9a'),_0x7c94('0x9b')]})[_0x7c94('0x26')](handleEntityNotFound(_0x5ce061,null))[_0x7c94('0x26')](function(_0x4715ee){if(_0x4715ee){_0x29c5d3=_0x4715ee[_0x7c94('0x9a')];var _0x13405c=_0x29c5d3['slice'](-0x1);if(_0x13405c==='/'){_0x29c5d3=_0x29c5d3[_0x7c94('0x9c')](0x0,_0x29c5d3['lastIndexOf'](_0x13405c));}_0x2212fe=util[_0x7c94('0x9d')](_0x7c94('0x9e'),_0x29c5d3);_0x473937=util[_0x7c94('0x9d')](_0x7c94('0x9f'),_0x29c5d3);_0x46b6d7={'user':_0x4715ee[_0x7c94('0xa0')],'pass':_0x4715ee[_0x7c94('0xa1')]};var _0xd43d2e={'method':_0x7c94('0xa2'),'uri':_0x2212fe+_0x7c94('0xa3'),'auth':_0x46b6d7,'json':!![]};return rp(_0xd43d2e);}})[_0x7c94('0x26')](function(_0x12fb77){if(_0x12fb77[_0x7c94('0xa4')][_0x7c94('0x38')]>0x0){_0x285b9d=_0x12fb77['result'];}console[_0x7c94('0xa5')](_0x7c94('0xa6'),_0x285b9d);_0x343b15=[];_0x497ea3=Object[_0x7c94('0xa7')]([],_0x285b9d);_['remove'](_0x497ea3,function(_0x1c6fa0){return!_0x483e05['includes'](_0x1c6fa0['name']);});_0x497ea3[_0x7c94('0xa8')](function(_0x4d1630){var _0xefc3fd=createFieldObject(_0x473937,_0x46b6d7,_0x4d1630[_0x7c94('0xa9')],_0x4d1630[_0x7c94('0x2a')],_0x4d1630[_0x7c94('0xaa')],![]);_0x343b15[_0x7c94('0xab')](_0xefc3fd);});return Promise[_0x7c94('0xac')](_0x343b15);})[_0x7c94('0x26')](function(_0x1ff2fa){_0x67701b=_0x1ff2fa;_0x3f85b5=Object[_0x7c94('0xa7')]([],_0x285b9d);console[_0x7c94('0xa5')]('TCL:\x20_object',_0x285b9d);_['remove'](_0x3f85b5,function(_0x41e1ae){return _0x16ce32[_0x7c94('0xad')](_0x41e1ae[_0x7c94('0x2a')]);});console[_0x7c94('0xa5')]('TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom',_0x3f85b5);_0x343b15=[];_0x3f85b5['forEach'](function(_0x595199){var _0x7c52cc=createFieldObject(_0x473937,_0x46b6d7,_0x595199[_0x7c94('0xa9')],_0x595199[_0x7c94('0x2a')],_0x595199[_0x7c94('0xaa')],!![]);_0x343b15['push'](_0x7c52cc);});return Promise[_0x7c94('0xac')](_0x343b15);})[_0x7c94('0x26')](function(_0x8f57bc){_0x422472=_0x8f57bc;var _0x272f4a=_0x67701b[_0x7c94('0xae')](_0x422472);return{'count':_0x272f4a[_0x7c94('0x38')],'rows':_0x272f4a};})[_0x7c94('0x26')](respondWithResult(_0x5ce061,null))[_0x7c94('0x44')](function(_0x52bd3f){console[_0x7c94('0xa5')](_0x7c94('0xaf')+_0x52bd3f);var _0x30db88=_0xfcacb1[_0x7c94('0x33')][_0x7c94('0xb0')]?0x1f4:_0x52bd3f[_0x7c94('0xb1')]||0x1f4;logger[_0x7c94('0xb2')](_0x52bd3f[_0x7c94('0xb3')]);delete _0x52bd3f[_0x7c94('0x2a')];if(_0x30db88===0x191){_0x30db88=0x190;}_0x5ce061[_0x7c94('0x1c')](_0x30db88)[_0x7c94('0x2b')](_0xfcacb1[_0x7c94('0x33')][_0x7c94('0xb0')]?{'message':_0x7c94('0xb4'),'statusCode':_0x52bd3f[_0x7c94('0xb1')]}:_0x52bd3f);});};function createFieldObject(_0x25dd1c,_0x4a4704,_0x5ed210,_0x56bceb,_0x486940,_0x573b82){return new Promise(function(_0x2b419f,_0x206757){var _0x4d9cbd={'id':_0x56bceb,'name':_0x486940,'custom':_0x573b82};if(_0x5ed210===_0x7c94('0xb5')){_0x4d9cbd[_0x7c94('0x41')]=[{'name':_0x7c94('0xb6'),'value':_0x7c94('0xb7')},{'name':_0x7c94('0xb8'),'value':_0x7c94('0xb9')}];_0x2b419f(_0x4d9cbd);}else{var _0x5adc2a={'method':_0x7c94('0xa2'),'uri':_0x25dd1c+_0x7c94('0xba')+_0x56bceb,'auth':_0x4a4704,'json':!![]};return rp(_0x5adc2a)[_0x7c94('0x26')](function(_0x4e1685){var _0x1cee23=[];if(_0x4e1685[_0x7c94('0xa4')][_0x7c94('0x38')]>0x0){_0x4e1685[_0x7c94('0xa4')][_0x7c94('0xa8')](function(_0x64d795){if(_0x64d795[_0x7c94('0xbb')]===_0x7c94('0xb9')){var _0x1332ec={'name':_0x64d795[_0x7c94('0xaa')],'value':_0x64d795[_0x7c94('0xbc')]};_0x1cee23[_0x7c94('0xab')](_0x1332ec);}});}_0x4d9cbd[_0x7c94('0x41')]=_0x1cee23;if(_0x4d9cbd[_0x7c94('0x41')][_0x7c94('0x38')]>0x0){_0x2b419f(_0x4d9cbd);}else{if(_0x573b82==![]){_0x2b419f();}else{_0x2b419f(_0x4d9cbd);}}});}});} \ No newline at end of file +var _0x90a0=['work_start','assignment_group','description','calendar_duration','sys_class_name','closed_by','follow_up','parent_incident','contact_type','reopened_by','incident_state','problem_id','reassignment_count','assigned_to','comments','approval','comments_and_work_notes','due_date','sys_mod_count','reopen_count','sys_tags','upon_approval','correlation_id','location','username','email','remoteUri','serverUrl','slice','lastIndexOf','format','password','GET','incident?sysparm_display_value=all','result','log','incident\x20table\x20objects','assign','internalType','label','push','includes','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','all','concat','ServiceNow\x20error:\x20','statusCode','test','Wrong\x20credentials','True','true','False','false','forEach','inactive','value','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index','fieldName','type','key','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','order','sort','where','pick','map','merge','options','ServicenowAccount','findAll','rows','catch','show','keys','includeAll','include','find','create','body','params','getConfigurations','findOne','ServicenowConfiguration','rawAttributes','nolimit','addConfiguration','AccountId','channel','getDescriptions','ServicenowField','Subjects','getFields','made_sla','hold_reason','knowledge','subcategory','close_code','notify','severity','category','parent','caused_by','watch_list','upon_reject','sys_updated_on','child_incidents','approval_history','number','resolved_by','opened_by','user_input','sys_domain','state','sys_created_by','cmdb_ci','delivery_plan','impact','work_notes_list','business_service','sys_domain_path','opened_at','business_duration','work_end','reopened_time','resolved_at','approval_set','work_notes','short_description','delivery_task'];(function(_0x1ecae9,_0x3d5fb9){var _0x5518e1=function(_0x1fcef5){while(--_0x1fcef5){_0x1ecae9['push'](_0x1ecae9['shift']());}};_0x5518e1(++_0x3d5fb9);}(_0x90a0,0x1a0));var _0x090a=function(_0xfcbcb8,_0x35bf6b){_0xfcbcb8=_0xfcbcb8-0x0;var _0x1b1f97=_0x90a0[_0xfcbcb8];return _0x1b1f97;};'use strict';var emlformat=require(_0x090a('0x0'));var rimraf=require(_0x090a('0x1'));var zipdir=require(_0x090a('0x2'));var jsonpatch=require(_0x090a('0x3'));var rp=require(_0x090a('0x4'));var moment=require(_0x090a('0x5'));var BPromise=require(_0x090a('0x6'));var Mustache=require(_0x090a('0x7'));var util=require(_0x090a('0x8'));var path=require(_0x090a('0x9'));var sox=require(_0x090a('0xa'));var csv=require(_0x090a('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x090a('0xc'));var _=require(_0x090a('0xd'));var squel=require(_0x090a('0xe'));var crypto=require(_0x090a('0xf'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x090a('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x090a('0x11'));var qs=require(_0x090a('0x12'));var as=require(_0x090a('0x13'));var hardwareService=require(_0x090a('0x14'));var logger=require(_0x090a('0x15'))(_0x090a('0x16'));var utils=require(_0x090a('0x17'));var config=require(_0x090a('0x18'));var licenseUtil=require(_0x090a('0x19'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x5a30bf,_0x4af287){_0x4af287=_0x4af287||0xcc;return function(_0x11e576){if(_0x11e576){return _0x5a30bf[_0x090a('0x1a')](_0x4af287);}return _0x5a30bf[_0x090a('0x1b')](_0x4af287)['end']();};}function respondWithResult(_0x1fce2f,_0x434236){_0x434236=_0x434236||0xc8;return function(_0x295db6){if(_0x295db6){return _0x1fce2f[_0x090a('0x1b')](_0x434236)[_0x090a('0x1c')](_0x295db6);}};}function respondWithFilteredResult(_0x57f39a,_0x4f5578){return function(_0x11ff44){if(_0x11ff44){var _0x5e4f3b=typeof _0x4f5578[_0x090a('0x1d')]==='undefined'&&typeof _0x4f5578[_0x090a('0x1e')]===_0x090a('0x1f');var _0x17c325=_0x11ff44[_0x090a('0x20')];var _0x59f65d=_0x5e4f3b?0x0:_0x4f5578[_0x090a('0x1d')];var _0x9623d4=_0x5e4f3b?_0x11ff44[_0x090a('0x20')]:_0x4f5578[_0x090a('0x1d')]+_0x4f5578['limit'];var _0x5bb75d;if(_0x9623d4>=_0x17c325){_0x9623d4=_0x17c325;_0x5bb75d=0xc8;}else{_0x5bb75d=0xce;}_0x57f39a[_0x090a('0x1b')](_0x5bb75d);return _0x57f39a[_0x090a('0x21')](_0x090a('0x22'),_0x59f65d+'-'+_0x9623d4+'/'+_0x17c325)['json'](_0x11ff44);}return null;};}function patchUpdates(_0x3b1cf3){return function(_0x2d4f39){try{jsonpatch[_0x090a('0x23')](_0x2d4f39,_0x3b1cf3,!![]);}catch(_0x508c22){return BPromise[_0x090a('0x24')](_0x508c22);}return _0x2d4f39['save']();};}function saveUpdates(_0xe4c60c,_0x12a708){return function(_0x557d05){if(_0x557d05){return _0x557d05[_0x090a('0x25')](_0xe4c60c)[_0x090a('0x26')](function(_0x5d5f2c){return _0x5d5f2c;});}return null;};}function removeEntity(_0x421686,_0x17b602){return function(_0x58f4e6){if(_0x58f4e6){return _0x58f4e6[_0x090a('0x27')]()[_0x090a('0x26')](function(){_0x421686[_0x090a('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x63670c,_0x4ad4c0){return function(_0x406ee8){if(!_0x406ee8){_0x63670c[_0x090a('0x1a')](0x194);}return _0x406ee8;};}function handleError(_0xf8bdf2,_0x12c61f){_0x12c61f=_0x12c61f||0x1f4;return function(_0x21740c){logger[_0x090a('0x28')](_0x21740c[_0x090a('0x29')]);if(_0x21740c[_0x090a('0x2a')]){delete _0x21740c['name'];}_0xf8bdf2[_0x090a('0x1b')](_0x12c61f)[_0x090a('0x2b')](_0x21740c);};}exports[_0x090a('0x2c')]=function(_0x5cc8a5,_0x41c015){var _0x337229={},_0x407b16={},_0xb7cfbc={'count':0x0,'rows':[]};var _0x5415be=_['map'](db['ServicenowAccount']['rawAttributes'],function(_0x4fc3f7){return{'name':_0x4fc3f7[_0x090a('0x2d')],'type':_0x4fc3f7[_0x090a('0x2e')][_0x090a('0x2f')]};});_0x407b16['model']=_['map'](_0x5415be,'name');_0x407b16['query']=_['keys'](_0x5cc8a5[_0x090a('0x30')]);_0x407b16[_0x090a('0x31')]=_[_0x090a('0x32')](_0x407b16[_0x090a('0x33')],_0x407b16[_0x090a('0x30')]);_0x337229['attributes']=_[_0x090a('0x32')](_0x407b16[_0x090a('0x33')],qs['fields'](_0x5cc8a5[_0x090a('0x30')][_0x090a('0x34')]));_0x337229[_0x090a('0x35')]=_0x337229[_0x090a('0x35')][_0x090a('0x36')]?_0x337229[_0x090a('0x35')]:_0x407b16[_0x090a('0x33')];if(!_0x5cc8a5[_0x090a('0x30')][_0x090a('0x37')]('nolimit')){_0x337229[_0x090a('0x1e')]=qs['limit'](_0x5cc8a5['query'][_0x090a('0x1e')]);_0x337229[_0x090a('0x1d')]=qs[_0x090a('0x1d')](_0x5cc8a5[_0x090a('0x30')][_0x090a('0x1d')]);}_0x337229[_0x090a('0x38')]=qs[_0x090a('0x39')](_0x5cc8a5[_0x090a('0x30')]['sort']);_0x337229[_0x090a('0x3a')]=qs[_0x090a('0x31')](_[_0x090a('0x3b')](_0x5cc8a5[_0x090a('0x30')],_0x407b16[_0x090a('0x31')]),_0x5415be);if(_0x5cc8a5[_0x090a('0x30')]['filter']){_0x337229[_0x090a('0x3a')]=_['merge'](_0x337229[_0x090a('0x3a')],{'$or':_[_0x090a('0x3c')](_0x5415be,function(_0x13a3c8){if(_0x13a3c8[_0x090a('0x2e')]!=='VIRTUAL'){var _0x4cb91d={};_0x4cb91d[_0x13a3c8['name']]={'$like':'%'+_0x5cc8a5[_0x090a('0x30')]['filter']+'%'};return _0x4cb91d;}})});}_0x337229=_[_0x090a('0x3d')]({},_0x337229,_0x5cc8a5[_0x090a('0x3e')]);var _0x24c373={'where':_0x337229[_0x090a('0x3a')]};return db['ServicenowAccount']['count'](_0x24c373)[_0x090a('0x26')](function(_0x1c92dc){_0xb7cfbc[_0x090a('0x20')]=_0x1c92dc;if(_0x5cc8a5[_0x090a('0x30')]['includeAll']){_0x337229['include']=[{'all':!![]}];}return db[_0x090a('0x3f')][_0x090a('0x40')](_0x337229);})[_0x090a('0x26')](function(_0x38d0c4){_0xb7cfbc[_0x090a('0x41')]=_0x38d0c4;return _0xb7cfbc;})['then'](respondWithFilteredResult(_0x41c015,_0x337229))[_0x090a('0x42')](handleError(_0x41c015,null));};exports[_0x090a('0x43')]=function(_0x53889c,_0x5d542c){var _0x5b88b6={'raw':![],'where':{'id':_0x53889c['params']['id']}},_0x32ad62={};_0x32ad62[_0x090a('0x33')]=_[_0x090a('0x44')](db[_0x090a('0x3f')]['rawAttributes']);_0x32ad62[_0x090a('0x30')]=_[_0x090a('0x44')](_0x53889c['query']);_0x32ad62['filters']=_['intersection'](_0x32ad62[_0x090a('0x33')],_0x32ad62[_0x090a('0x30')]);_0x5b88b6[_0x090a('0x35')]=_[_0x090a('0x32')](_0x32ad62[_0x090a('0x33')],qs['fields'](_0x53889c[_0x090a('0x30')][_0x090a('0x34')]));_0x5b88b6[_0x090a('0x35')]=_0x5b88b6[_0x090a('0x35')][_0x090a('0x36')]?_0x5b88b6['attributes']:_0x32ad62[_0x090a('0x33')];if(_0x53889c['query'][_0x090a('0x45')]){_0x5b88b6[_0x090a('0x46')]=[{'all':!![]}];}_0x5b88b6=_[_0x090a('0x3d')]({},_0x5b88b6,_0x53889c[_0x090a('0x3e')]);return db[_0x090a('0x3f')][_0x090a('0x47')](_0x5b88b6)[_0x090a('0x26')](handleEntityNotFound(_0x5d542c,null))[_0x090a('0x26')](respondWithResult(_0x5d542c,null))[_0x090a('0x42')](handleError(_0x5d542c,null));};exports[_0x090a('0x48')]=function(_0x5c9e87,_0x1cf91a){return db[_0x090a('0x3f')][_0x090a('0x48')](_0x5c9e87['body'],{})[_0x090a('0x26')](respondWithResult(_0x1cf91a,0xc9))['catch'](handleError(_0x1cf91a,null));};exports[_0x090a('0x25')]=function(_0x49e8c6,_0x512cc6){if(_0x49e8c6[_0x090a('0x49')]['id']){delete _0x49e8c6['body']['id'];}return db['ServicenowAccount'][_0x090a('0x47')]({'where':{'id':_0x49e8c6['params']['id']}})['then'](handleEntityNotFound(_0x512cc6,null))[_0x090a('0x26')](saveUpdates(_0x49e8c6['body'],null))[_0x090a('0x26')](respondWithResult(_0x512cc6,null))['catch'](handleError(_0x512cc6,null));};exports[_0x090a('0x27')]=function(_0x1505fd,_0x160c56){return db[_0x090a('0x3f')][_0x090a('0x47')]({'where':{'id':_0x1505fd[_0x090a('0x4a')]['id']}})['then'](handleEntityNotFound(_0x160c56,null))[_0x090a('0x26')](removeEntity(_0x160c56,null))[_0x090a('0x42')](handleError(_0x160c56,null));};exports[_0x090a('0x4b')]=function(_0x13f670,_0x4866b4,_0x2b52b7){var _0x485427={};var _0x48d44e={};var _0x20341b;var _0x320ae2;return db[_0x090a('0x3f')][_0x090a('0x4c')]({'where':{'id':_0x13f670[_0x090a('0x4a')]['id']}})[_0x090a('0x26')](handleEntityNotFound(_0x4866b4,null))[_0x090a('0x26')](function(_0x1725fa){if(_0x1725fa){_0x20341b=_0x1725fa;_0x48d44e[_0x090a('0x33')]=_[_0x090a('0x44')](db[_0x090a('0x4d')][_0x090a('0x4e')]);_0x48d44e[_0x090a('0x30')]=_[_0x090a('0x44')](_0x13f670[_0x090a('0x30')]);_0x48d44e['filters']=_['intersection'](_0x48d44e[_0x090a('0x33')],_0x48d44e[_0x090a('0x30')]);_0x485427[_0x090a('0x35')]=_[_0x090a('0x32')](_0x48d44e[_0x090a('0x33')],qs['fields'](_0x13f670[_0x090a('0x30')][_0x090a('0x34')]));_0x485427['attributes']=_0x485427[_0x090a('0x35')][_0x090a('0x36')]?_0x485427[_0x090a('0x35')]:_0x48d44e[_0x090a('0x33')];_0x485427[_0x090a('0x38')]=qs[_0x090a('0x39')](_0x13f670[_0x090a('0x30')][_0x090a('0x39')]);_0x485427[_0x090a('0x3a')]=qs['filters'](_[_0x090a('0x3b')](_0x13f670[_0x090a('0x30')],_0x48d44e[_0x090a('0x31')]));if(_0x13f670[_0x090a('0x30')]['filter']){_0x485427['where']=_['merge'](_0x485427[_0x090a('0x3a')],{'$or':_['map'](_0x485427[_0x090a('0x35')],function(_0x30524e){var _0x51103d={};_0x51103d[_0x30524e]={'$like':'%'+_0x13f670[_0x090a('0x30')]['filter']+'%'};return _0x51103d;})});}_0x485427=_[_0x090a('0x3d')]({},_0x485427,_0x13f670[_0x090a('0x3e')]);return _0x20341b[_0x090a('0x4b')](_0x485427);}})[_0x090a('0x26')](function(_0x13c36c){if(_0x13c36c){_0x320ae2=_0x13c36c[_0x090a('0x36')];if(!_0x13f670['query'][_0x090a('0x37')](_0x090a('0x4f'))){_0x485427[_0x090a('0x1e')]=qs[_0x090a('0x1e')](_0x13f670[_0x090a('0x30')][_0x090a('0x1e')]);_0x485427[_0x090a('0x1d')]=qs[_0x090a('0x1d')](_0x13f670['query'][_0x090a('0x1d')]);}return _0x20341b[_0x090a('0x4b')](_0x485427);}})[_0x090a('0x26')](function(_0x3ed7df){if(_0x3ed7df){return _0x3ed7df?{'count':_0x320ae2,'rows':_0x3ed7df}:null;}})[_0x090a('0x26')](respondWithResult(_0x4866b4,null))[_0x090a('0x42')](handleError(_0x4866b4,null));};exports[_0x090a('0x50')]=function(_0x38fe12,_0x2a10b1,_0x422c0c){if(_0x38fe12['body']['id']){delete _0x38fe12[_0x090a('0x49')]['id'];}return db['ServicenowAccount']['findOne']({'where':{'id':_0x38fe12[_0x090a('0x4a')]['id']}})[_0x090a('0x26')](handleEntityNotFound(_0x2a10b1,null))[_0x090a('0x26')](function(_0x4471ec){if(_0x4471ec){_0x38fe12[_0x090a('0x49')][_0x090a('0x51')]=_0x4471ec['id'];_0x38fe12[_0x090a('0x49')]['Subjects']=integrations['getSubjects'](_0x38fe12[_0x090a('0x49')][_0x090a('0x52')],_0x38fe12[_0x090a('0x49')]['type']);_0x38fe12[_0x090a('0x49')]['Descriptions']=integrations[_0x090a('0x53')](_0x38fe12['body'][_0x090a('0x52')],_0x38fe12['body']['type']);return db[_0x090a('0x4d')]['create'](_0x38fe12[_0x090a('0x49')],{'include':[{'model':db[_0x090a('0x54')],'as':_0x090a('0x55')},{'model':db[_0x090a('0x54')],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x2a10b1,null))[_0x090a('0x42')](handleError(_0x2a10b1,null));};exports[_0x090a('0x56')]=function(_0x4463a8,_0x5a2b30,_0x3329b1){var _0x5c9107=[_0x090a('0x57'),_0x090a('0x58'),_0x090a('0x59'),_0x090a('0x5a'),_0x090a('0x5b'),_0x090a('0x5c'),'incident_state',_0x090a('0x5d'),_0x090a('0x5e')];var _0x309c9f=[_0x090a('0x5f'),_0x090a('0x57'),_0x090a('0x60'),_0x090a('0x61'),_0x090a('0x62'),_0x090a('0x63'),_0x090a('0x64'),_0x090a('0x58'),_0x090a('0x65'),_0x090a('0x66'),_0x090a('0x67'),'sys_updated_by',_0x090a('0x68'),_0x090a('0x69'),'sys_created_on',_0x090a('0x6a'),_0x090a('0x6b'),_0x090a('0x6c'),'knowledge',_0x090a('0x38'),'calendar_stc','closed_at',_0x090a('0x6d'),_0x090a('0x6e'),_0x090a('0x6f'),'active',_0x090a('0x70'),_0x090a('0x71'),'priority',_0x090a('0x72'),'rfc','time_worked','expected_start',_0x090a('0x73'),_0x090a('0x74'),'group_list',_0x090a('0x75'),_0x090a('0x76'),_0x090a('0x77'),'caller_id',_0x090a('0x78'),_0x090a('0x5a'),_0x090a('0x79'),_0x090a('0x7a'),'close_code','correlation_display',_0x090a('0x7b'),_0x090a('0x7c'),_0x090a('0x7d'),'business_stc','additional_assignee_list',_0x090a('0x7e'),_0x090a('0x7f'),_0x090a('0x5c'),_0x090a('0x80'),'close_notes',_0x090a('0x81'),_0x090a('0x82'),_0x090a('0x83'),'sys_id',_0x090a('0x84'),_0x090a('0x85'),_0x090a('0x86'),'urgency',_0x090a('0x87'),'company',_0x090a('0x88'),'activity_due',_0x090a('0x89'),_0x090a('0x5d'),_0x090a('0x8a'),'sla_due',_0x090a('0x8b'),_0x090a('0x8c'),_0x090a('0x8d'),_0x090a('0x8e'),_0x090a('0x8f'),_0x090a('0x90'),'escalation',_0x090a('0x91'),_0x090a('0x92'),_0x090a('0x93'),'category'];var _0x556241='';var _0x42435f='';var _0x76f459=[];var _0x52f26d='';var _0x555a7f='';var _0x29568d=[];var _0x678bec='';var _0xed6533='';var _0x208394={};var _0x5cf1ab='';return db[_0x090a('0x3f')][_0x090a('0x4c')]({'where':{'id':_0x4463a8[_0x090a('0x4a')]['id']},'attributes':['id',_0x090a('0x94'),'password',_0x090a('0x95'),_0x090a('0x96'),_0x090a('0x97')]})[_0x090a('0x26')](handleEntityNotFound(_0x5a2b30,null))[_0x090a('0x26')](function(_0x5b23d2){if(_0x5b23d2){_0x5cf1ab=_0x5b23d2[_0x090a('0x96')];var _0x4bd7a1=_0x5cf1ab[_0x090a('0x98')](-0x1);if(_0x4bd7a1==='/'){_0x5cf1ab=_0x5cf1ab['substring'](0x0,_0x5cf1ab[_0x090a('0x99')](_0x4bd7a1));}_0xed6533=util['format']('%s/api/now/doc/table/schema/',_0x5cf1ab);_0x678bec=util[_0x090a('0x9a')]('%s/api/now/table/',_0x5cf1ab);_0x208394={'user':_0x5b23d2['username'],'pass':_0x5b23d2[_0x090a('0x9b')]};var _0x340e52={'method':_0x090a('0x9c'),'uri':_0xed6533+_0x090a('0x9d'),'auth':_0x208394,'json':!![]};return rp(_0x340e52);}})[_0x090a('0x26')](function(_0x3ade6b){if(_0x3ade6b[_0x090a('0x9e')][_0x090a('0x36')]>0x0){_0x556241=_0x3ade6b[_0x090a('0x9e')];}console[_0x090a('0x9f')](_0x090a('0xa0'),_0x556241);_0x29568d=[];_0x42435f=Object[_0x090a('0xa1')]([],_0x556241);_['remove'](_0x42435f,function(_0x41def2){return!_0x5c9107['includes'](_0x41def2[_0x090a('0x2a')]);});_0x42435f['forEach'](function(_0x25c0a2){var _0xc000eb=createFieldObject(_0x678bec,_0x208394,_0x25c0a2[_0x090a('0xa2')],_0x25c0a2[_0x090a('0x2a')],_0x25c0a2[_0x090a('0xa3')],![]);_0x29568d[_0x090a('0xa4')](_0xc000eb);});return Promise['all'](_0x29568d);})[_0x090a('0x26')](function(_0x293fe3){_0x76f459=_0x293fe3;_0x52f26d=Object[_0x090a('0xa1')]([],_0x556241);console[_0x090a('0x9f')]('TCL:\x20_object',_0x556241);_['remove'](_0x52f26d,function(_0x489d7b){return _0x309c9f[_0x090a('0xa5')](_0x489d7b[_0x090a('0x2a')]);});console[_0x090a('0x9f')](_0x090a('0xa6'),_0x52f26d);_0x29568d=[];_0x52f26d['forEach'](function(_0x36fc12){var _0x2b2740=createFieldObject(_0x678bec,_0x208394,_0x36fc12[_0x090a('0xa2')],_0x36fc12[_0x090a('0x2a')],_0x36fc12[_0x090a('0xa3')],!![]);_0x29568d[_0x090a('0xa4')](_0x2b2740);});return Promise[_0x090a('0xa7')](_0x29568d);})[_0x090a('0x26')](function(_0x1b76e1){_0x555a7f=_0x1b76e1;var _0x23b34e=_0x76f459[_0x090a('0xa8')](_0x555a7f);return{'count':_0x23b34e['length'],'rows':_0x23b34e};})[_0x090a('0x26')](respondWithResult(_0x5a2b30,null))[_0x090a('0x42')](function(_0x3510f4){console['log'](_0x090a('0xa9')+_0x3510f4);var _0x5a32c1=_0x4463a8[_0x090a('0x30')]['test']?0x1f4:_0x3510f4[_0x090a('0xaa')]||0x1f4;logger['error'](_0x3510f4[_0x090a('0x29')]);delete _0x3510f4[_0x090a('0x2a')];if(_0x5a32c1===0x191){_0x5a32c1=0x190;}_0x5a2b30[_0x090a('0x1b')](_0x5a32c1)[_0x090a('0x2b')](_0x4463a8[_0x090a('0x30')][_0x090a('0xab')]?{'message':_0x090a('0xac'),'statusCode':_0x3510f4['statusCode']}:_0x3510f4);});};function createFieldObject(_0x34a921,_0x598aff,_0x196d7b,_0x2f7abd,_0x51e3a1,_0xf703dd){return new Promise(function(_0x4900b3,_0x4a7a42){var _0x3ee093={'id':_0x2f7abd,'name':_0x51e3a1,'custom':_0xf703dd};if(_0x196d7b==='boolean'){_0x3ee093[_0x090a('0x3e')]=[{'name':_0x090a('0xad'),'value':_0x090a('0xae')},{'name':_0x090a('0xaf'),'value':_0x090a('0xb0')}];_0x4900b3(_0x3ee093);}else{var _0x2d320d={'method':_0x090a('0x9c'),'uri':_0x34a921+'sys_choice?sysparm_query=name=incident^element='+_0x2f7abd,'auth':_0x598aff,'json':!![]};return rp(_0x2d320d)[_0x090a('0x26')](function(_0xc8daaa){var _0x159f27=[];if(_0xc8daaa[_0x090a('0x9e')]['length']>0x0){_0xc8daaa[_0x090a('0x9e')][_0x090a('0xb1')](function(_0x54a3d7){if(_0x54a3d7[_0x090a('0xb2')]===_0x090a('0xb0')){var _0x39a26e={'name':_0x54a3d7[_0x090a('0xa3')],'value':_0x54a3d7[_0x090a('0xb3')]};_0x159f27[_0x090a('0xa4')](_0x39a26e);}});}_0x3ee093[_0x090a('0x3e')]=_0x159f27;if(_0x3ee093[_0x090a('0x3e')][_0x090a('0x36')]>0x0){_0x4900b3(_0x3ee093);}else{if(_0xf703dd==![]){_0x4900b3();}else{_0x4900b3(_0x3ee093);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index 11c3a45..f0fe16f 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 _0xe2fe=['define','int_servicenow_accounts','lodash','api','bluebird','request-promise','path','rimraf','../../config/environment','../../components/integrations/configuration','exports'];(function(_0x5b223c,_0x13dfdd){var _0x4ff523=function(_0x43c9e9){while(--_0x43c9e9){_0x5b223c['push'](_0x5b223c['shift']());}};_0x4ff523(++_0x13dfdd);}(_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 +var _0xa630=['moment','request-promise','rimraf','../../config/environment','./intServicenowAccount.attributes','../../components/integrations/configuration','exports','define','ServicenowAccount','int_servicenow_accounts','lodash','util'];(function(_0xbb193c,_0x3aec46){var _0x40b7f5=function(_0x36b3e9){while(--_0x36b3e9){_0xbb193c['push'](_0xbb193c['shift']());}};_0x40b7f5(++_0x3aec46);}(_0xa630,0xbe));var _0x0a63=function(_0x4fd404,_0x286ba0){_0x4fd404=_0x4fd404-0x0;var _0x3a7983=_0xa630[_0x4fd404];return _0x3a7983;};'use strict';var _=require(_0x0a63('0x0'));var util=require(_0x0a63('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x0a63('0x2'));var BPromise=require('bluebird');var rp=require(_0x0a63('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0a63('0x4'));var config=require(_0x0a63('0x5'));var attributes=require(_0x0a63('0x6'));var integrations=require(_0x0a63('0x7'));module[_0x0a63('0x8')]=function(_0x4b7474,_0x2760b0){return _0x4b7474[_0x0a63('0x9')](_0x0a63('0xa'),attributes,{'tableName':_0x0a63('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.rpc.js b/server/api/intServicenowAccount/intServicenowAccount.rpc.js index 4c86d8b..5e5eec9 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 _0xf8a6=['request','then','info','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','ServicenowAccount,\x20%s,\x20%s','message','GetServicenowAccount','ServicenowAccount','raw','options','attributes','limit','include','map','model','catch','ShowServicenowAccount','find','where','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client'];(function(_0x4b8fd4,_0x3a7e83){var _0x388b2e=function(_0x59af92){while(--_0x59af92){_0x4b8fd4['push'](_0x4b8fd4['shift']());}};_0x388b2e(++_0x3a7e83);}(_0xf8a6,0xbd));var _0x6f8a=function(_0x3911a1,_0x241182){_0x3911a1=_0x3911a1-0x0;var _0x32ecfe=_0xf8a6[_0x3911a1];return _0x32ecfe;};'use strict';var _=require(_0x6f8a('0x0'));var util=require('util');var moment=require(_0x6f8a('0x1'));var BPromise=require('bluebird');var rs=require(_0x6f8a('0x2'));var fs=require('fs');var Redis=require(_0x6f8a('0x3'));var db=require(_0x6f8a('0x4'))['db'];var utils=require(_0x6f8a('0x5'));var logger=require(_0x6f8a('0x6'))(_0x6f8a('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x6f8a('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0xbc15d1,_0x9a9204,_0x135a7c){return new BPromise(function(_0x48eab0,_0x12fcde){return client[_0x6f8a('0x9')](_0xbc15d1,_0x135a7c)[_0x6f8a('0xa')](function(_0x1b7293){logger[_0x6f8a('0xb')]('ServicenowAccount,\x20%s,\x20%s',_0x9a9204,_0x6f8a('0xc'));logger[_0x6f8a('0xd')](_0x6f8a('0xe'),_0x9a9204,_0x6f8a('0xc'),JSON[_0x6f8a('0xf')](_0x1b7293));if(_0x1b7293[_0x6f8a('0x10')]){if(_0x1b7293[_0x6f8a('0x10')][_0x6f8a('0x11')]===0x1f4){logger[_0x6f8a('0x10')](_0x6f8a('0x12'),_0x9a9204,_0x1b7293[_0x6f8a('0x10')][_0x6f8a('0x13')]);return _0x12fcde(_0x1b7293[_0x6f8a('0x10')]['message']);}logger[_0x6f8a('0x10')](_0x6f8a('0x12'),_0x9a9204,_0x1b7293[_0x6f8a('0x10')]['message']);return _0x48eab0(_0x1b7293[_0x6f8a('0x10')][_0x6f8a('0x13')]);}else{logger['info'](_0x6f8a('0x12'),_0x9a9204,_0x6f8a('0xc'));_0x48eab0(_0x1b7293['result'][_0x6f8a('0x13')]);}})['catch'](function(_0x5f316c){logger['error'](_0x6f8a('0x12'),_0x9a9204,_0x5f316c);_0x12fcde(_0x5f316c);});});}exports[_0x6f8a('0x14')]=function(_0xb1d198){var _0x5ddfdd=this;return new Promise(function(_0x14adb1,_0x55cc86){return db[_0x6f8a('0x15')]['findAll']({'raw':_0xb1d198['options']?_0xb1d198['options'][_0x6f8a('0x16')]===undefined?!![]:![]:!![],'where':_0xb1d198[_0x6f8a('0x17')]?_0xb1d198[_0x6f8a('0x17')]['where']||null:null,'attributes':_0xb1d198[_0x6f8a('0x17')]?_0xb1d198[_0x6f8a('0x17')][_0x6f8a('0x18')]||null:null,'limit':_0xb1d198[_0x6f8a('0x17')]?_0xb1d198['options'][_0x6f8a('0x19')]||null:null,'include':_0xb1d198['options']?_0xb1d198[_0x6f8a('0x17')][_0x6f8a('0x1a')]?_[_0x6f8a('0x1b')](_0xb1d198['options'][_0x6f8a('0x1a')],function(_0x3a2873){return{'model':db[_0x3a2873[_0x6f8a('0x1c')]],'as':_0x3a2873['as'],'attributes':_0x3a2873['attributes'],'include':_0x3a2873[_0x6f8a('0x1a')]?_[_0x6f8a('0x1b')](_0x3a2873[_0x6f8a('0x1a')],function(_0x3fbb7e){return{'model':db[_0x3fbb7e[_0x6f8a('0x1c')]],'as':_0x3fbb7e['as'],'attributes':_0x3fbb7e[_0x6f8a('0x18')],'include':_0x3fbb7e[_0x6f8a('0x1a')]?_[_0x6f8a('0x1b')](_0x3fbb7e[_0x6f8a('0x1a')],function(_0x58bff7){return{'model':db[_0x58bff7[_0x6f8a('0x1c')]],'as':_0x58bff7['as'],'attributes':_0x58bff7[_0x6f8a('0x18')]};}):[]};}):[]};}):[]:[]})[_0x6f8a('0xa')](function(_0x11d74a){logger[_0x6f8a('0xb')](_0x6f8a('0x14'),_0xb1d198);logger[_0x6f8a('0xd')](_0x6f8a('0x14'),_0xb1d198,JSON[_0x6f8a('0xf')](_0x11d74a));_0x14adb1(_0x11d74a);})[_0x6f8a('0x1d')](function(_0x267128){logger['error']('GetServicenowAccount',_0x267128['message'],_0xb1d198);_0x55cc86(_0x5ddfdd[_0x6f8a('0x10')](0x1f4,_0x267128[_0x6f8a('0x13')]));});});};exports[_0x6f8a('0x1e')]=function(_0x5486ed){var _0x4fa091=this;return new Promise(function(_0x183e3c,_0x1b62ad){return db[_0x6f8a('0x15')][_0x6f8a('0x1f')]({'raw':_0x5486ed[_0x6f8a('0x17')]?_0x5486ed[_0x6f8a('0x17')][_0x6f8a('0x16')]===undefined?!![]:![]:!![],'where':_0x5486ed['options']?_0x5486ed[_0x6f8a('0x17')][_0x6f8a('0x20')]||null:null,'attributes':_0x5486ed[_0x6f8a('0x17')]?_0x5486ed[_0x6f8a('0x17')]['attributes']||null:null,'include':_0x5486ed[_0x6f8a('0x17')]?_0x5486ed['options'][_0x6f8a('0x1a')]?_[_0x6f8a('0x1b')](_0x5486ed[_0x6f8a('0x17')][_0x6f8a('0x1a')],function(_0xee0f7e){return{'model':db[_0xee0f7e[_0x6f8a('0x1c')]],'as':_0xee0f7e['as'],'attributes':_0xee0f7e['attributes'],'include':_0xee0f7e[_0x6f8a('0x1a')]?_['map'](_0xee0f7e[_0x6f8a('0x1a')],function(_0x1608c2){return{'model':db[_0x1608c2[_0x6f8a('0x1c')]],'as':_0x1608c2['as'],'attributes':_0x1608c2[_0x6f8a('0x18')],'include':_0x1608c2[_0x6f8a('0x1a')]?_[_0x6f8a('0x1b')](_0x1608c2[_0x6f8a('0x1a')],function(_0x4dbbf3){return{'model':db[_0x4dbbf3[_0x6f8a('0x1c')]],'as':_0x4dbbf3['as'],'attributes':_0x4dbbf3[_0x6f8a('0x18')]};}):[]};}):[]};}):[]:[]})[_0x6f8a('0xa')](function(_0x457cd6){logger[_0x6f8a('0xb')]('ShowServicenowAccount',_0x5486ed);logger[_0x6f8a('0xd')](_0x6f8a('0x1e'),_0x5486ed,JSON[_0x6f8a('0xf')](_0x457cd6));_0x183e3c(_0x457cd6);})[_0x6f8a('0x1d')](function(_0x54cb8e){logger[_0x6f8a('0x10')]('ShowServicenowAccount',_0x54cb8e['message'],_0x5486ed);_0x1b62ad(_0x4fa091[_0x6f8a('0x10')](0x1f4,_0x54cb8e[_0x6f8a('0x13')]));});});}; \ No newline at end of file +var _0x9db3=['code','ServicenowAccount,\x20%s,\x20%s','message','result','GetServicenowAccount','findAll','options','raw','attributes','limit','include','map','model','catch','ShowServicenowAccount','ServicenowAccount','find','where','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','jayson/promise','request','then','info','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9db3,0xde));var _0x39db=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0x9db3[_0x46e363];return _0x3fb059;};'use strict';var _=require(_0x39db('0x0'));var util=require(_0x39db('0x1'));var moment=require(_0x39db('0x2'));var BPromise=require(_0x39db('0x3'));var rs=require(_0x39db('0x4'));var fs=require('fs');var Redis=require(_0x39db('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x39db('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x39db('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x17915f,_0x312906,_0x2188d2){return new BPromise(function(_0x219c26,_0x44f94e){return client[_0x39db('0x8')](_0x17915f,_0x2188d2)[_0x39db('0x9')](function(_0x173a29){logger[_0x39db('0xa')]('ServicenowAccount,\x20%s,\x20%s',_0x312906,'request\x20sent');logger[_0x39db('0xb')](_0x39db('0xc'),_0x312906,_0x39db('0xd'),JSON[_0x39db('0xe')](_0x173a29));if(_0x173a29[_0x39db('0xf')]){if(_0x173a29['error'][_0x39db('0x10')]===0x1f4){logger['error'](_0x39db('0x11'),_0x312906,_0x173a29[_0x39db('0xf')][_0x39db('0x12')]);return _0x44f94e(_0x173a29[_0x39db('0xf')][_0x39db('0x12')]);}logger[_0x39db('0xf')](_0x39db('0x11'),_0x312906,_0x173a29[_0x39db('0xf')]['message']);return _0x219c26(_0x173a29['error'][_0x39db('0x12')]);}else{logger['info'](_0x39db('0x11'),_0x312906,_0x39db('0xd'));_0x219c26(_0x173a29[_0x39db('0x13')][_0x39db('0x12')]);}})['catch'](function(_0x526198){logger[_0x39db('0xf')]('ServicenowAccount,\x20%s,\x20%s',_0x312906,_0x526198);_0x44f94e(_0x526198);});});}exports[_0x39db('0x14')]=function(_0x2f28a8){var _0x2653fc=this;return new Promise(function(_0x221794,_0x281e87){return db['ServicenowAccount'][_0x39db('0x15')]({'raw':_0x2f28a8[_0x39db('0x16')]?_0x2f28a8['options'][_0x39db('0x17')]===undefined?!![]:![]:!![],'where':_0x2f28a8[_0x39db('0x16')]?_0x2f28a8['options']['where']||null:null,'attributes':_0x2f28a8[_0x39db('0x16')]?_0x2f28a8['options'][_0x39db('0x18')]||null:null,'limit':_0x2f28a8[_0x39db('0x16')]?_0x2f28a8[_0x39db('0x16')][_0x39db('0x19')]||null:null,'include':_0x2f28a8[_0x39db('0x16')]?_0x2f28a8['options'][_0x39db('0x1a')]?_[_0x39db('0x1b')](_0x2f28a8[_0x39db('0x16')][_0x39db('0x1a')],function(_0x51cde6){return{'model':db[_0x51cde6[_0x39db('0x1c')]],'as':_0x51cde6['as'],'attributes':_0x51cde6[_0x39db('0x18')],'include':_0x51cde6[_0x39db('0x1a')]?_[_0x39db('0x1b')](_0x51cde6['include'],function(_0x556948){return{'model':db[_0x556948[_0x39db('0x1c')]],'as':_0x556948['as'],'attributes':_0x556948[_0x39db('0x18')],'include':_0x556948[_0x39db('0x1a')]?_['map'](_0x556948[_0x39db('0x1a')],function(_0x17ca00){return{'model':db[_0x17ca00[_0x39db('0x1c')]],'as':_0x17ca00['as'],'attributes':_0x17ca00['attributes']};}):[]};}):[]};}):[]:[]})[_0x39db('0x9')](function(_0x43f1ab){logger['info'](_0x39db('0x14'),_0x2f28a8);logger[_0x39db('0xb')](_0x39db('0x14'),_0x2f28a8,JSON[_0x39db('0xe')](_0x43f1ab));_0x221794(_0x43f1ab);})[_0x39db('0x1d')](function(_0x3fc259){logger[_0x39db('0xf')](_0x39db('0x14'),_0x3fc259[_0x39db('0x12')],_0x2f28a8);_0x281e87(_0x2653fc['error'](0x1f4,_0x3fc259['message']));});});};exports[_0x39db('0x1e')]=function(_0x494c08){var _0x1c6fe5=this;return new Promise(function(_0x178423,_0x207a72){return db[_0x39db('0x1f')][_0x39db('0x20')]({'raw':_0x494c08[_0x39db('0x16')]?_0x494c08[_0x39db('0x16')][_0x39db('0x17')]===undefined?!![]:![]:!![],'where':_0x494c08[_0x39db('0x16')]?_0x494c08[_0x39db('0x16')][_0x39db('0x21')]||null:null,'attributes':_0x494c08['options']?_0x494c08[_0x39db('0x16')][_0x39db('0x18')]||null:null,'include':_0x494c08['options']?_0x494c08[_0x39db('0x16')]['include']?_[_0x39db('0x1b')](_0x494c08['options'][_0x39db('0x1a')],function(_0x1273f1){return{'model':db[_0x1273f1[_0x39db('0x1c')]],'as':_0x1273f1['as'],'attributes':_0x1273f1[_0x39db('0x18')],'include':_0x1273f1[_0x39db('0x1a')]?_[_0x39db('0x1b')](_0x1273f1['include'],function(_0x31270c){return{'model':db[_0x31270c[_0x39db('0x1c')]],'as':_0x31270c['as'],'attributes':_0x31270c[_0x39db('0x18')],'include':_0x31270c['include']?_[_0x39db('0x1b')](_0x31270c[_0x39db('0x1a')],function(_0x803902){return{'model':db[_0x803902['model']],'as':_0x803902['as'],'attributes':_0x803902[_0x39db('0x18')]};}):[]};}):[]};}):[]:[]})[_0x39db('0x9')](function(_0x17b15a){logger[_0x39db('0xa')](_0x39db('0x1e'),_0x494c08);logger[_0x39db('0xb')]('ShowServicenowAccount',_0x494c08,JSON[_0x39db('0xe')](_0x17b15a));_0x178423(_0x17b15a);})['catch'](function(_0x59530d){logger[_0x39db('0xf')](_0x39db('0x1e'),_0x59530d['message'],_0x494c08);_0x207a72(_0x1c6fe5[_0x39db('0xf')](0x1f4,_0x59530d['message']));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index f7d0f3e..3023330 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 _0x022a=['../../components/interaction/service','../../config/environment','isAuthenticated','index','get','show','/:id/fields','/:id/descriptions','getDescriptions','put','/:id','update','destroy','exports','util','path','connect-timeout','../../components/auth/service'];(function(_0xdda501,_0x457a7d){var _0x4b548d=function(_0x121071){while(--_0x121071){_0xdda501['push'](_0xdda501['shift']());}};_0x4b548d(++_0x457a7d);}(_0x022a,0x19a));var _0xa022=function(_0x329421,_0xd2822d){_0x329421=_0x329421-0x0;var _0x499643=_0x022a[_0x329421];return _0x499643;};'use strict';var multer=require('multer');var util=require(_0xa022('0x0'));var path=require(_0xa022('0x1'));var timeout=require(_0xa022('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xa022('0x3'));var interaction=require(_0xa022('0x4'));var config=require(_0xa022('0x5'));var controller=require('./intServicenowConfiguration.controller');router['get']('/',auth[_0xa022('0x6')](),controller[_0xa022('0x7')]);router[_0xa022('0x8')]('/:id',auth[_0xa022('0x6')](),controller[_0xa022('0x9')]);router[_0xa022('0x8')](_0xa022('0xa'),auth[_0xa022('0x6')](),controller['getFields']);router[_0xa022('0x8')]('/:id/subjects',auth[_0xa022('0x6')](),controller['getSubjects']);router[_0xa022('0x8')](_0xa022('0xb'),auth[_0xa022('0x6')](),controller[_0xa022('0xc')]);router['post']('/',auth[_0xa022('0x6')](),controller['create']);router[_0xa022('0xd')](_0xa022('0xe'),auth[_0xa022('0x6')](),controller[_0xa022('0xf')]);router['delete']('/:id',auth[_0xa022('0x6')](),controller[_0xa022('0x10')]);module[_0xa022('0x11')]=router; \ No newline at end of file +var _0x60e7=['put','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intServicenowConfiguration.controller','isAuthenticated','index','get','/:id','show','/:id/fields','getSubjects','getDescriptions','post','create'];(function(_0x2a05d7,_0x2a381f){var _0x22feae=function(_0x487042){while(--_0x487042){_0x2a05d7['push'](_0x2a05d7['shift']());}};_0x22feae(++_0x2a381f);}(_0x60e7,0x76));var _0x760e=function(_0x22e953,_0x10a297){_0x22e953=_0x22e953-0x0;var _0x2d4bdc=_0x60e7[_0x22e953];return _0x2d4bdc;};'use strict';var multer=require(_0x760e('0x0'));var util=require(_0x760e('0x1'));var path=require(_0x760e('0x2'));var timeout=require(_0x760e('0x3'));var express=require(_0x760e('0x4'));var router=express[_0x760e('0x5')]();var fs_extra=require(_0x760e('0x6'));var auth=require(_0x760e('0x7'));var interaction=require(_0x760e('0x8'));var config=require('../../config/environment');var controller=require(_0x760e('0x9'));router['get']('/',auth[_0x760e('0xa')](),controller[_0x760e('0xb')]);router[_0x760e('0xc')](_0x760e('0xd'),auth[_0x760e('0xa')](),controller[_0x760e('0xe')]);router[_0x760e('0xc')](_0x760e('0xf'),auth[_0x760e('0xa')](),controller['getFields']);router['get']('/:id/subjects',auth[_0x760e('0xa')](),controller[_0x760e('0x10')]);router[_0x760e('0xc')]('/:id/descriptions',auth[_0x760e('0xa')](),controller[_0x760e('0x11')]);router[_0x760e('0x12')]('/',auth['isAuthenticated'](),controller[_0x760e('0x13')]);router[_0x760e('0x14')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x760e('0x15')](_0x760e('0xd'),auth['isAuthenticated'](),controller[_0x760e('0x16')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js index 1f489c6..208cef9 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 _0x6c35=['exports','STRING','sequelize'];(function(_0x20d2e1,_0x40b026){var _0x3fa1e7=function(_0x1ba87a){while(--_0x1ba87a){_0x20d2e1['push'](_0x20d2e1['shift']());}};_0x3fa1e7(++_0x40b026);}(_0x6c35,0xe9));var _0x56c3=function(_0x4dd46b,_0x2a6d98){_0x4dd46b=_0x4dd46b-0x0;var _0x174841=_0x6c35[_0x4dd46b];return _0x174841;};'use strict';var Sequelize=require(_0x56c3('0x0'));module[_0x56c3('0x1')]={'name':{'type':Sequelize[_0x56c3('0x2')]},'description':{'type':Sequelize[_0x56c3('0x2')]}}; \ No newline at end of file +var _0x6256=['STRING','sequelize','exports'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x6256,0xf1));var _0x6625=function(_0x4792c8,_0x5158a1){_0x4792c8=_0x4792c8-0x0;var _0x35edb1=_0x6256[_0x4792c8];return _0x35edb1;};'use strict';var Sequelize=require(_0x6625('0x0'));module[_0x6625('0x1')]={'name':{'type':Sequelize[_0x6625('0x2')]},'description':{'type':Sequelize[_0x6625('0x2')]}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index 5f75af0..7061b08 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 _0x2ca2=['reject','then','destroy','error','stack','name','send','index','map','fieldName','type','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','sort','pick','where','merge','ServicenowConfiguration','includeAll','findAll','rows','catch','show','rawAttributes','fields','options','find','create','body','update','params','getFields','ServicenowField','order','filter','getSubjects','getDescriptions','findOne','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply'];(function(_0x26d4f0,_0x5f20dc){var _0x1b4727=function(_0x4812f6){while(--_0x4812f6){_0x26d4f0['push'](_0x26d4f0['shift']());}};_0x1b4727(++_0x5f20dc);}(_0x2ca2,0xd4));var _0x22ca=function(_0x4fcf59,_0xc5a493){_0x4fcf59=_0x4fcf59-0x0;var _0xfee2a=_0x2ca2[_0x4fcf59];return _0xfee2a;};'use strict';var emlformat=require(_0x22ca('0x0'));var rimraf=require(_0x22ca('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x22ca('0x2'));var rp=require(_0x22ca('0x3'));var moment=require(_0x22ca('0x4'));var BPromise=require(_0x22ca('0x5'));var Mustache=require(_0x22ca('0x6'));var util=require(_0x22ca('0x7'));var path=require(_0x22ca('0x8'));var sox=require(_0x22ca('0x9'));var csv=require(_0x22ca('0xa'));var ejs=require(_0x22ca('0xb'));var fs=require('fs');var fs_extra=require(_0x22ca('0xc'));var _=require('lodash');var squel=require(_0x22ca('0xd'));var crypto=require(_0x22ca('0xe'));var jsforce=require(_0x22ca('0xf'));var deskjs=require(_0x22ca('0x10'));var toCsv=require(_0x22ca('0xa'));var querystring=require(_0x22ca('0x11'));var Papa=require(_0x22ca('0x12'));var Redis=require(_0x22ca('0x13'));var authService=require(_0x22ca('0x14'));var qs=require(_0x22ca('0x15'));var as=require(_0x22ca('0x16'));var hardwareService=require(_0x22ca('0x17'));var logger=require('../../config/logger')(_0x22ca('0x18'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x22ca('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x24973e,_0x2f63fe){_0x2f63fe=_0x2f63fe||0xcc;return function(_0x2fe289){if(_0x2fe289){return _0x24973e[_0x22ca('0x1a')](_0x2f63fe);}return _0x24973e[_0x22ca('0x1b')](_0x2f63fe)[_0x22ca('0x1c')]();};}function respondWithResult(_0x142ffe,_0x1b8070){_0x1b8070=_0x1b8070||0xc8;return function(_0x57d1b7){if(_0x57d1b7){return _0x142ffe['status'](_0x1b8070)[_0x22ca('0x1d')](_0x57d1b7);}};}function respondWithFilteredResult(_0x239d0c,_0x4ffcde){return function(_0xace9a7){if(_0xace9a7){var _0x1edf41=typeof _0x4ffcde[_0x22ca('0x1e')]==='undefined'&&typeof _0x4ffcde[_0x22ca('0x1f')]===_0x22ca('0x20');var _0x3fe974=_0xace9a7[_0x22ca('0x21')];var _0x1a71ab=_0x1edf41?0x0:_0x4ffcde[_0x22ca('0x1e')];var _0x36f14d=_0x1edf41?_0xace9a7[_0x22ca('0x21')]:_0x4ffcde['offset']+_0x4ffcde['limit'];var _0x1871df;if(_0x36f14d>=_0x3fe974){_0x36f14d=_0x3fe974;_0x1871df=0xc8;}else{_0x1871df=0xce;}_0x239d0c[_0x22ca('0x1b')](_0x1871df);return _0x239d0c[_0x22ca('0x22')](_0x22ca('0x23'),_0x1a71ab+'-'+_0x36f14d+'/'+_0x3fe974)['json'](_0xace9a7);}return null;};}function patchUpdates(_0x4b00f2){return function(_0x255806){try{jsonpatch[_0x22ca('0x24')](_0x255806,_0x4b00f2,!![]);}catch(_0x3b0e13){return BPromise[_0x22ca('0x25')](_0x3b0e13);}return _0x255806['save']();};}function saveUpdates(_0x563edf,_0x450ece){return function(_0xf76c13){if(_0xf76c13){return _0xf76c13['update'](_0x563edf)[_0x22ca('0x26')](function(_0x33ac6e){return _0x33ac6e;});}return null;};}function removeEntity(_0x188a36,_0x42a636){return function(_0x43e593){if(_0x43e593){return _0x43e593[_0x22ca('0x27')]()['then'](function(){_0x188a36[_0x22ca('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1cf040,_0x582e6d){return function(_0x62dc3e){if(!_0x62dc3e){_0x1cf040['sendStatus'](0x194);}return _0x62dc3e;};}function handleError(_0x5f01ec,_0x29bb2b){_0x29bb2b=_0x29bb2b||0x1f4;return function(_0x5d4f03){logger[_0x22ca('0x28')](_0x5d4f03[_0x22ca('0x29')]);if(_0x5d4f03[_0x22ca('0x2a')]){delete _0x5d4f03['name'];}_0x5f01ec[_0x22ca('0x1b')](_0x29bb2b)[_0x22ca('0x2b')](_0x5d4f03);};}exports[_0x22ca('0x2c')]=function(_0x4911de,_0x11a193){var _0x5c84a1={},_0x4ea43b={},_0x1f00d9={'count':0x0,'rows':[]};var _0x327b73=_[_0x22ca('0x2d')](db['ServicenowConfiguration']['rawAttributes'],function(_0x232c85){return{'name':_0x232c85[_0x22ca('0x2e')],'type':_0x232c85[_0x22ca('0x2f')][_0x22ca('0x30')]};});_0x4ea43b[_0x22ca('0x31')]=_[_0x22ca('0x2d')](_0x327b73,'name');_0x4ea43b[_0x22ca('0x32')]=_[_0x22ca('0x33')](_0x4911de[_0x22ca('0x32')]);_0x4ea43b[_0x22ca('0x34')]=_[_0x22ca('0x35')](_0x4ea43b[_0x22ca('0x31')],_0x4ea43b['query']);_0x5c84a1['attributes']=_['intersection'](_0x4ea43b[_0x22ca('0x31')],qs['fields'](_0x4911de['query']['fields']));_0x5c84a1['attributes']=_0x5c84a1[_0x22ca('0x36')][_0x22ca('0x37')]?_0x5c84a1['attributes']:_0x4ea43b[_0x22ca('0x31')];if(!_0x4911de['query'][_0x22ca('0x38')](_0x22ca('0x39'))){_0x5c84a1[_0x22ca('0x1f')]=qs[_0x22ca('0x1f')](_0x4911de['query'][_0x22ca('0x1f')]);_0x5c84a1[_0x22ca('0x1e')]=qs[_0x22ca('0x1e')](_0x4911de[_0x22ca('0x32')]['offset']);}_0x5c84a1['order']=qs[_0x22ca('0x3a')](_0x4911de[_0x22ca('0x32')][_0x22ca('0x3a')]);_0x5c84a1['where']=qs[_0x22ca('0x34')](_[_0x22ca('0x3b')](_0x4911de[_0x22ca('0x32')],_0x4ea43b[_0x22ca('0x34')]),_0x327b73);if(_0x4911de[_0x22ca('0x32')]['filter']){_0x5c84a1[_0x22ca('0x3c')]=_[_0x22ca('0x3d')](_0x5c84a1['where'],{'$or':_['map'](_0x327b73,function(_0x4c8aeb){if(_0x4c8aeb[_0x22ca('0x2f')]!=='VIRTUAL'){var _0x14cab0={};_0x14cab0[_0x4c8aeb[_0x22ca('0x2a')]]={'$like':'%'+_0x4911de[_0x22ca('0x32')]['filter']+'%'};return _0x14cab0;}})});}_0x5c84a1=_[_0x22ca('0x3d')]({},_0x5c84a1,_0x4911de['options']);var _0x3a43da={'where':_0x5c84a1[_0x22ca('0x3c')]};return db[_0x22ca('0x3e')][_0x22ca('0x21')](_0x3a43da)[_0x22ca('0x26')](function(_0x5d3bd5){_0x1f00d9['count']=_0x5d3bd5;if(_0x4911de[_0x22ca('0x32')][_0x22ca('0x3f')]){_0x5c84a1['include']=[{'all':!![]}];}return db[_0x22ca('0x3e')][_0x22ca('0x40')](_0x5c84a1);})[_0x22ca('0x26')](function(_0x5c1b4b){_0x1f00d9[_0x22ca('0x41')]=_0x5c1b4b;return _0x1f00d9;})[_0x22ca('0x26')](respondWithFilteredResult(_0x11a193,_0x5c84a1))[_0x22ca('0x42')](handleError(_0x11a193,null));};exports[_0x22ca('0x43')]=function(_0x4a210f,_0x49a3a1){var _0x4aa966={'raw':![],'where':{'id':_0x4a210f['params']['id']}},_0x3645a3={};_0x3645a3[_0x22ca('0x31')]=_[_0x22ca('0x33')](db[_0x22ca('0x3e')][_0x22ca('0x44')]);_0x3645a3[_0x22ca('0x32')]=_['keys'](_0x4a210f[_0x22ca('0x32')]);_0x3645a3['filters']=_[_0x22ca('0x35')](_0x3645a3[_0x22ca('0x31')],_0x3645a3[_0x22ca('0x32')]);_0x4aa966[_0x22ca('0x36')]=_[_0x22ca('0x35')](_0x3645a3[_0x22ca('0x31')],qs[_0x22ca('0x45')](_0x4a210f[_0x22ca('0x32')][_0x22ca('0x45')]));_0x4aa966[_0x22ca('0x36')]=_0x4aa966[_0x22ca('0x36')][_0x22ca('0x37')]?_0x4aa966[_0x22ca('0x36')]:_0x3645a3[_0x22ca('0x31')];if(_0x4a210f['query']['includeAll']){_0x4aa966['include']=[{'all':!![]}];}_0x4aa966=_[_0x22ca('0x3d')]({},_0x4aa966,_0x4a210f[_0x22ca('0x46')]);return db[_0x22ca('0x3e')][_0x22ca('0x47')](_0x4aa966)[_0x22ca('0x26')](handleEntityNotFound(_0x49a3a1,null))['then'](respondWithResult(_0x49a3a1,null))[_0x22ca('0x42')](handleError(_0x49a3a1,null));};exports[_0x22ca('0x48')]=function(_0x12bcc5,_0x123a1d){return db[_0x22ca('0x3e')][_0x22ca('0x48')](_0x12bcc5[_0x22ca('0x49')],{})[_0x22ca('0x26')](respondWithResult(_0x123a1d,0xc9))[_0x22ca('0x42')](handleError(_0x123a1d,null));};exports[_0x22ca('0x4a')]=function(_0x21d3bd,_0x225094){if(_0x21d3bd[_0x22ca('0x49')]['id']){delete _0x21d3bd[_0x22ca('0x49')]['id'];}return db[_0x22ca('0x3e')][_0x22ca('0x47')]({'where':{'id':_0x21d3bd['params']['id']}})[_0x22ca('0x26')](handleEntityNotFound(_0x225094,null))[_0x22ca('0x26')](saveUpdates(_0x21d3bd['body'],null))[_0x22ca('0x26')](respondWithResult(_0x225094,null))[_0x22ca('0x42')](handleError(_0x225094,null));};exports[_0x22ca('0x27')]=function(_0x26e9cf,_0x2473d1){return db['ServicenowConfiguration'][_0x22ca('0x47')]({'where':{'id':_0x26e9cf[_0x22ca('0x4b')]['id']}})[_0x22ca('0x26')](handleEntityNotFound(_0x2473d1,null))[_0x22ca('0x26')](removeEntity(_0x2473d1,null))[_0x22ca('0x42')](handleError(_0x2473d1,null));};exports[_0x22ca('0x4c')]=function(_0x183e95,_0x307c0d,_0x1af072){var _0x1b0696={};var _0x76b4e3={};var _0x1256cb;var _0x4a5d57;return db[_0x22ca('0x3e')]['findOne']({'where':{'id':_0x183e95[_0x22ca('0x4b')]['id']}})[_0x22ca('0x26')](handleEntityNotFound(_0x307c0d,null))[_0x22ca('0x26')](function(_0x11ffeb){if(_0x11ffeb){_0x1256cb=_0x11ffeb;_0x76b4e3[_0x22ca('0x31')]=_[_0x22ca('0x33')](db[_0x22ca('0x4d')]['rawAttributes']);_0x76b4e3[_0x22ca('0x32')]=_[_0x22ca('0x33')](_0x183e95[_0x22ca('0x32')]);_0x76b4e3['filters']=_[_0x22ca('0x35')](_0x76b4e3[_0x22ca('0x31')],_0x76b4e3[_0x22ca('0x32')]);_0x1b0696[_0x22ca('0x36')]=_[_0x22ca('0x35')](_0x76b4e3[_0x22ca('0x31')],qs['fields'](_0x183e95[_0x22ca('0x32')][_0x22ca('0x45')]));_0x1b0696['attributes']=_0x1b0696[_0x22ca('0x36')][_0x22ca('0x37')]?_0x1b0696[_0x22ca('0x36')]:_0x76b4e3[_0x22ca('0x31')];_0x1b0696[_0x22ca('0x4e')]=qs[_0x22ca('0x3a')](_0x183e95[_0x22ca('0x32')][_0x22ca('0x3a')]);_0x1b0696[_0x22ca('0x3c')]=qs['filters'](_[_0x22ca('0x3b')](_0x183e95[_0x22ca('0x32')],_0x76b4e3[_0x22ca('0x34')]));if(_0x183e95[_0x22ca('0x32')][_0x22ca('0x4f')]){_0x1b0696['where']=_['merge'](_0x1b0696[_0x22ca('0x3c')],{'$or':_[_0x22ca('0x2d')](_0x1b0696['attributes'],function(_0x3d0140){var _0x4a1b53={};_0x4a1b53[_0x3d0140]={'$like':'%'+_0x183e95[_0x22ca('0x32')][_0x22ca('0x4f')]+'%'};return _0x4a1b53;})});}_0x1b0696=_['merge']({},_0x1b0696,_0x183e95[_0x22ca('0x46')]);return _0x1256cb[_0x22ca('0x4c')](_0x1b0696);}})[_0x22ca('0x26')](function(_0x584d74){if(_0x584d74){_0x4a5d57=_0x584d74[_0x22ca('0x37')];if(!_0x183e95['query'][_0x22ca('0x38')]('nolimit')){_0x1b0696[_0x22ca('0x1f')]=qs['limit'](_0x183e95[_0x22ca('0x32')][_0x22ca('0x1f')]);_0x1b0696['offset']=qs[_0x22ca('0x1e')](_0x183e95[_0x22ca('0x32')][_0x22ca('0x1e')]);}return _0x1256cb[_0x22ca('0x4c')](_0x1b0696);}})[_0x22ca('0x26')](function(_0x16830d){if(_0x16830d){return _0x16830d?{'count':_0x4a5d57,'rows':_0x16830d}:null;}})[_0x22ca('0x26')](respondWithResult(_0x307c0d,null))['catch'](handleError(_0x307c0d,null));};exports[_0x22ca('0x50')]=function(_0x4cc7b9,_0x108665,_0x1370a7){var _0x4187ac={};var _0x48d9df={};var _0x450487;var _0x291ae8;return db[_0x22ca('0x3e')]['findOne']({'where':{'id':_0x4cc7b9['params']['id']}})[_0x22ca('0x26')](handleEntityNotFound(_0x108665,null))[_0x22ca('0x26')](function(_0x3009a1){if(_0x3009a1){_0x450487=_0x3009a1;_0x48d9df[_0x22ca('0x31')]=_[_0x22ca('0x33')](db[_0x22ca('0x4d')][_0x22ca('0x44')]);_0x48d9df[_0x22ca('0x32')]=_[_0x22ca('0x33')](_0x4cc7b9[_0x22ca('0x32')]);_0x48d9df[_0x22ca('0x34')]=_[_0x22ca('0x35')](_0x48d9df[_0x22ca('0x31')],_0x48d9df[_0x22ca('0x32')]);_0x4187ac[_0x22ca('0x36')]=_[_0x22ca('0x35')](_0x48d9df[_0x22ca('0x31')],qs['fields'](_0x4cc7b9[_0x22ca('0x32')][_0x22ca('0x45')]));_0x4187ac[_0x22ca('0x36')]=_0x4187ac[_0x22ca('0x36')]['length']?_0x4187ac[_0x22ca('0x36')]:_0x48d9df[_0x22ca('0x31')];_0x4187ac[_0x22ca('0x4e')]=qs[_0x22ca('0x3a')](_0x4cc7b9[_0x22ca('0x32')][_0x22ca('0x3a')]);_0x4187ac[_0x22ca('0x3c')]=qs[_0x22ca('0x34')](_[_0x22ca('0x3b')](_0x4cc7b9[_0x22ca('0x32')],_0x48d9df[_0x22ca('0x34')]));if(_0x4cc7b9[_0x22ca('0x32')][_0x22ca('0x4f')]){_0x4187ac[_0x22ca('0x3c')]=_[_0x22ca('0x3d')](_0x4187ac[_0x22ca('0x3c')],{'$or':_[_0x22ca('0x2d')](_0x4187ac[_0x22ca('0x36')],function(_0x49f9d3){var _0x426b7f={};_0x426b7f[_0x49f9d3]={'$like':'%'+_0x4cc7b9[_0x22ca('0x32')][_0x22ca('0x4f')]+'%'};return _0x426b7f;})});}_0x4187ac=_[_0x22ca('0x3d')]({},_0x4187ac,_0x4cc7b9[_0x22ca('0x46')]);return _0x450487[_0x22ca('0x50')](_0x4187ac);}})['then'](function(_0x18ed41){if(_0x18ed41){_0x291ae8=_0x18ed41['length'];if(!_0x4cc7b9[_0x22ca('0x32')][_0x22ca('0x38')]('nolimit')){_0x4187ac['limit']=qs[_0x22ca('0x1f')](_0x4cc7b9[_0x22ca('0x32')]['limit']);_0x4187ac['offset']=qs[_0x22ca('0x1e')](_0x4cc7b9[_0x22ca('0x32')]['offset']);}return _0x450487[_0x22ca('0x50')](_0x4187ac);}})['then'](function(_0x49379d){if(_0x49379d){return _0x49379d?{'count':_0x291ae8,'rows':_0x49379d}:null;}})[_0x22ca('0x26')](respondWithResult(_0x108665,null))[_0x22ca('0x42')](handleError(_0x108665,null));};exports[_0x22ca('0x51')]=function(_0x394470,_0x29bace,_0x25b4b6){var _0x31a8ae={};var _0x29b2f7={};var _0xa16bc4;var _0x100641;return db[_0x22ca('0x3e')][_0x22ca('0x52')]({'where':{'id':_0x394470['params']['id']}})[_0x22ca('0x26')](handleEntityNotFound(_0x29bace,null))[_0x22ca('0x26')](function(_0x4a7413){if(_0x4a7413){_0xa16bc4=_0x4a7413;_0x29b2f7[_0x22ca('0x31')]=_[_0x22ca('0x33')](db['ServicenowField'][_0x22ca('0x44')]);_0x29b2f7[_0x22ca('0x32')]=_['keys'](_0x394470['query']);_0x29b2f7[_0x22ca('0x34')]=_[_0x22ca('0x35')](_0x29b2f7[_0x22ca('0x31')],_0x29b2f7[_0x22ca('0x32')]);_0x31a8ae['attributes']=_[_0x22ca('0x35')](_0x29b2f7[_0x22ca('0x31')],qs['fields'](_0x394470[_0x22ca('0x32')]['fields']));_0x31a8ae[_0x22ca('0x36')]=_0x31a8ae['attributes']['length']?_0x31a8ae[_0x22ca('0x36')]:_0x29b2f7[_0x22ca('0x31')];_0x31a8ae[_0x22ca('0x4e')]=qs[_0x22ca('0x3a')](_0x394470['query'][_0x22ca('0x3a')]);_0x31a8ae[_0x22ca('0x3c')]=qs['filters'](_[_0x22ca('0x3b')](_0x394470[_0x22ca('0x32')],_0x29b2f7[_0x22ca('0x34')]));if(_0x394470['query'][_0x22ca('0x4f')]){_0x31a8ae[_0x22ca('0x3c')]=_[_0x22ca('0x3d')](_0x31a8ae[_0x22ca('0x3c')],{'$or':_[_0x22ca('0x2d')](_0x31a8ae[_0x22ca('0x36')],function(_0x588f45){var _0x4d7410={};_0x4d7410[_0x588f45]={'$like':'%'+_0x394470[_0x22ca('0x32')]['filter']+'%'};return _0x4d7410;})});}_0x31a8ae=_[_0x22ca('0x3d')]({},_0x31a8ae,_0x394470[_0x22ca('0x46')]);return _0xa16bc4[_0x22ca('0x51')](_0x31a8ae);}})[_0x22ca('0x26')](function(_0x815b27){if(_0x815b27){_0x100641=_0x815b27['length'];if(!_0x394470['query'][_0x22ca('0x38')](_0x22ca('0x39'))){_0x31a8ae['limit']=qs['limit'](_0x394470[_0x22ca('0x32')][_0x22ca('0x1f')]);_0x31a8ae[_0x22ca('0x1e')]=qs[_0x22ca('0x1e')](_0x394470[_0x22ca('0x32')]['offset']);}return _0xa16bc4[_0x22ca('0x51')](_0x31a8ae);}})['then'](function(_0x46625f){if(_0x46625f){return _0x46625f?{'count':_0x100641,'rows':_0x46625f}:null;}})[_0x22ca('0x26')](respondWithResult(_0x29bace,null))['catch'](handleError(_0x29bace,null));}; \ No newline at end of file +var _0x68c8=['getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','error','stack','name','send','index','map','rawAttributes','fieldName','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','type','VIRTUAL','filter','merge','include','ServicenowConfiguration','findAll','rows','show','params','includeAll','options','find','create','body','catch','destroy','findOne','ServicenowField','order','getFields'];(function(_0xab1ddd,_0x4e1df2){var _0x2daaba=function(_0xbd2a02){while(--_0xbd2a02){_0xab1ddd['push'](_0xab1ddd['shift']());}};_0x2daaba(++_0x4e1df2);}(_0x68c8,0x1b0));var _0x868c=function(_0x16fd74,_0x42fabb){_0x16fd74=_0x16fd74-0x0;var _0x1a10f6=_0x68c8[_0x16fd74];return _0x1a10f6;};'use strict';var emlformat=require(_0x868c('0x0'));var rimraf=require(_0x868c('0x1'));var zipdir=require(_0x868c('0x2'));var jsonpatch=require(_0x868c('0x3'));var rp=require(_0x868c('0x4'));var moment=require(_0x868c('0x5'));var BPromise=require(_0x868c('0x6'));var Mustache=require(_0x868c('0x7'));var util=require('util');var path=require(_0x868c('0x8'));var sox=require(_0x868c('0x9'));var csv=require(_0x868c('0xa'));var ejs=require(_0x868c('0xb'));var fs=require('fs');var fs_extra=require(_0x868c('0xc'));var _=require(_0x868c('0xd'));var squel=require('squel');var crypto=require(_0x868c('0xe'));var jsforce=require(_0x868c('0xf'));var deskjs=require(_0x868c('0x10'));var toCsv=require('to-csv');var querystring=require(_0x868c('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x868c('0x12'));var qs=require(_0x868c('0x13'));var as=require(_0x868c('0x14'));var hardwareService=require(_0x868c('0x15'));var logger=require(_0x868c('0x16'))(_0x868c('0x17'));var utils=require(_0x868c('0x18'));var config=require(_0x868c('0x19'));var licenseUtil=require(_0x868c('0x1a'));var db=require(_0x868c('0x1b'))['db'];function respondWithStatusCode(_0x231433,_0x5b2e4a){_0x5b2e4a=_0x5b2e4a||0xcc;return function(_0x14d5e5){if(_0x14d5e5){return _0x231433[_0x868c('0x1c')](_0x5b2e4a);}return _0x231433[_0x868c('0x1d')](_0x5b2e4a)[_0x868c('0x1e')]();};}function respondWithResult(_0x240331,_0x12a358){_0x12a358=_0x12a358||0xc8;return function(_0x14ab48){if(_0x14ab48){return _0x240331['status'](_0x12a358)[_0x868c('0x1f')](_0x14ab48);}};}function respondWithFilteredResult(_0x224fc0,_0x4c2bd4){return function(_0x510ebf){if(_0x510ebf){var _0x5e3293=typeof _0x4c2bd4[_0x868c('0x20')]===_0x868c('0x21')&&typeof _0x4c2bd4[_0x868c('0x22')]===_0x868c('0x21');var _0x4e2a28=_0x510ebf['count'];var _0x3a295a=_0x5e3293?0x0:_0x4c2bd4['offset'];var _0x22bc59=_0x5e3293?_0x510ebf[_0x868c('0x23')]:_0x4c2bd4[_0x868c('0x20')]+_0x4c2bd4[_0x868c('0x22')];var _0x203bbb;if(_0x22bc59>=_0x4e2a28){_0x22bc59=_0x4e2a28;_0x203bbb=0xc8;}else{_0x203bbb=0xce;}_0x224fc0[_0x868c('0x1d')](_0x203bbb);return _0x224fc0[_0x868c('0x24')](_0x868c('0x25'),_0x3a295a+'-'+_0x22bc59+'/'+_0x4e2a28)[_0x868c('0x1f')](_0x510ebf);}return null;};}function patchUpdates(_0x4cac44){return function(_0x124325){try{jsonpatch[_0x868c('0x26')](_0x124325,_0x4cac44,!![]);}catch(_0x197b32){return BPromise['reject'](_0x197b32);}return _0x124325[_0x868c('0x27')]();};}function saveUpdates(_0x1d4788,_0x3190ba){return function(_0x41a058){if(_0x41a058){return _0x41a058[_0x868c('0x28')](_0x1d4788)[_0x868c('0x29')](function(_0x3fea1f){return _0x3fea1f;});}return null;};}function removeEntity(_0x9e6a41,_0x39a529){return function(_0x395a19){if(_0x395a19){return _0x395a19['destroy']()['then'](function(){_0x9e6a41[_0x868c('0x1d')](0xcc)[_0x868c('0x1e')]();});}};}function handleEntityNotFound(_0x18667c,_0x3ccac3){return function(_0x29dec7){if(!_0x29dec7){_0x18667c['sendStatus'](0x194);}return _0x29dec7;};}function handleError(_0x2149ca,_0x3fbb2e){_0x3fbb2e=_0x3fbb2e||0x1f4;return function(_0xf07e04){logger[_0x868c('0x2a')](_0xf07e04[_0x868c('0x2b')]);if(_0xf07e04['name']){delete _0xf07e04[_0x868c('0x2c')];}_0x2149ca['status'](_0x3fbb2e)[_0x868c('0x2d')](_0xf07e04);};}exports[_0x868c('0x2e')]=function(_0x223ba3,_0x3e55b1){var _0x46c457={},_0x5eafd7={},_0x21cb3c={'count':0x0,'rows':[]};var _0x5491e8=_[_0x868c('0x2f')](db['ServicenowConfiguration'][_0x868c('0x30')],function(_0x1bab49){return{'name':_0x1bab49[_0x868c('0x31')],'type':_0x1bab49['type']['key']};});_0x5eafd7['model']=_['map'](_0x5491e8,_0x868c('0x2c'));_0x5eafd7['query']=_[_0x868c('0x32')](_0x223ba3[_0x868c('0x33')]);_0x5eafd7[_0x868c('0x34')]=_[_0x868c('0x35')](_0x5eafd7[_0x868c('0x36')],_0x5eafd7[_0x868c('0x33')]);_0x46c457[_0x868c('0x37')]=_['intersection'](_0x5eafd7[_0x868c('0x36')],qs[_0x868c('0x38')](_0x223ba3['query'][_0x868c('0x38')]));_0x46c457[_0x868c('0x37')]=_0x46c457[_0x868c('0x37')][_0x868c('0x39')]?_0x46c457[_0x868c('0x37')]:_0x5eafd7['model'];if(!_0x223ba3[_0x868c('0x33')][_0x868c('0x3a')](_0x868c('0x3b'))){_0x46c457[_0x868c('0x22')]=qs['limit'](_0x223ba3[_0x868c('0x33')][_0x868c('0x22')]);_0x46c457['offset']=qs['offset'](_0x223ba3['query'][_0x868c('0x20')]);}_0x46c457['order']=qs[_0x868c('0x3c')](_0x223ba3[_0x868c('0x33')]['sort']);_0x46c457[_0x868c('0x3d')]=qs[_0x868c('0x34')](_[_0x868c('0x3e')](_0x223ba3[_0x868c('0x33')],_0x5eafd7[_0x868c('0x34')]),_0x5491e8);if(_0x223ba3[_0x868c('0x33')]['filter']){_0x46c457[_0x868c('0x3d')]=_['merge'](_0x46c457[_0x868c('0x3d')],{'$or':_[_0x868c('0x2f')](_0x5491e8,function(_0x4ae044){if(_0x4ae044[_0x868c('0x3f')]!==_0x868c('0x40')){var _0x473241={};_0x473241[_0x4ae044['name']]={'$like':'%'+_0x223ba3[_0x868c('0x33')][_0x868c('0x41')]+'%'};return _0x473241;}})});}_0x46c457=_[_0x868c('0x42')]({},_0x46c457,_0x223ba3['options']);var _0x59022f={'where':_0x46c457[_0x868c('0x3d')]};return db['ServicenowConfiguration'][_0x868c('0x23')](_0x59022f)[_0x868c('0x29')](function(_0x4466d4){_0x21cb3c[_0x868c('0x23')]=_0x4466d4;if(_0x223ba3[_0x868c('0x33')]['includeAll']){_0x46c457[_0x868c('0x43')]=[{'all':!![]}];}return db[_0x868c('0x44')][_0x868c('0x45')](_0x46c457);})[_0x868c('0x29')](function(_0x3b7df6){_0x21cb3c[_0x868c('0x46')]=_0x3b7df6;return _0x21cb3c;})[_0x868c('0x29')](respondWithFilteredResult(_0x3e55b1,_0x46c457))['catch'](handleError(_0x3e55b1,null));};exports[_0x868c('0x47')]=function(_0x1d8f97,_0x1388c9){var _0x4c35c4={'raw':![],'where':{'id':_0x1d8f97[_0x868c('0x48')]['id']}},_0x281a7f={};_0x281a7f['model']=_[_0x868c('0x32')](db[_0x868c('0x44')][_0x868c('0x30')]);_0x281a7f['query']=_[_0x868c('0x32')](_0x1d8f97[_0x868c('0x33')]);_0x281a7f[_0x868c('0x34')]=_[_0x868c('0x35')](_0x281a7f['model'],_0x281a7f[_0x868c('0x33')]);_0x4c35c4[_0x868c('0x37')]=_[_0x868c('0x35')](_0x281a7f[_0x868c('0x36')],qs['fields'](_0x1d8f97['query'][_0x868c('0x38')]));_0x4c35c4['attributes']=_0x4c35c4[_0x868c('0x37')][_0x868c('0x39')]?_0x4c35c4[_0x868c('0x37')]:_0x281a7f[_0x868c('0x36')];if(_0x1d8f97[_0x868c('0x33')][_0x868c('0x49')]){_0x4c35c4[_0x868c('0x43')]=[{'all':!![]}];}_0x4c35c4=_[_0x868c('0x42')]({},_0x4c35c4,_0x1d8f97[_0x868c('0x4a')]);return db['ServicenowConfiguration'][_0x868c('0x4b')](_0x4c35c4)[_0x868c('0x29')](handleEntityNotFound(_0x1388c9,null))[_0x868c('0x29')](respondWithResult(_0x1388c9,null))['catch'](handleError(_0x1388c9,null));};exports[_0x868c('0x4c')]=function(_0x5029da,_0x597508){return db[_0x868c('0x44')]['create'](_0x5029da[_0x868c('0x4d')],{})[_0x868c('0x29')](respondWithResult(_0x597508,0xc9))[_0x868c('0x4e')](handleError(_0x597508,null));};exports['update']=function(_0x3733a1,_0x46d348){if(_0x3733a1[_0x868c('0x4d')]['id']){delete _0x3733a1['body']['id'];}return db[_0x868c('0x44')]['find']({'where':{'id':_0x3733a1[_0x868c('0x48')]['id']}})[_0x868c('0x29')](handleEntityNotFound(_0x46d348,null))[_0x868c('0x29')](saveUpdates(_0x3733a1['body'],null))[_0x868c('0x29')](respondWithResult(_0x46d348,null))['catch'](handleError(_0x46d348,null));};exports[_0x868c('0x4f')]=function(_0x3254c3,_0x24ad20){return db[_0x868c('0x44')][_0x868c('0x4b')]({'where':{'id':_0x3254c3['params']['id']}})[_0x868c('0x29')](handleEntityNotFound(_0x24ad20,null))[_0x868c('0x29')](removeEntity(_0x24ad20,null))[_0x868c('0x4e')](handleError(_0x24ad20,null));};exports['getFields']=function(_0x443ffd,_0x58185c,_0xd3de36){var _0x2a6fa5={};var _0x46c18b={};var _0x4ce23d;var _0xb8bdbb;return db['ServicenowConfiguration'][_0x868c('0x50')]({'where':{'id':_0x443ffd[_0x868c('0x48')]['id']}})[_0x868c('0x29')](handleEntityNotFound(_0x58185c,null))[_0x868c('0x29')](function(_0x382d62){if(_0x382d62){_0x4ce23d=_0x382d62;_0x46c18b['model']=_[_0x868c('0x32')](db[_0x868c('0x51')][_0x868c('0x30')]);_0x46c18b[_0x868c('0x33')]=_[_0x868c('0x32')](_0x443ffd[_0x868c('0x33')]);_0x46c18b[_0x868c('0x34')]=_[_0x868c('0x35')](_0x46c18b[_0x868c('0x36')],_0x46c18b[_0x868c('0x33')]);_0x2a6fa5[_0x868c('0x37')]=_[_0x868c('0x35')](_0x46c18b[_0x868c('0x36')],qs[_0x868c('0x38')](_0x443ffd['query'][_0x868c('0x38')]));_0x2a6fa5['attributes']=_0x2a6fa5[_0x868c('0x37')]['length']?_0x2a6fa5[_0x868c('0x37')]:_0x46c18b[_0x868c('0x36')];_0x2a6fa5[_0x868c('0x52')]=qs['sort'](_0x443ffd[_0x868c('0x33')]['sort']);_0x2a6fa5[_0x868c('0x3d')]=qs['filters'](_[_0x868c('0x3e')](_0x443ffd[_0x868c('0x33')],_0x46c18b[_0x868c('0x34')]));if(_0x443ffd[_0x868c('0x33')][_0x868c('0x41')]){_0x2a6fa5[_0x868c('0x3d')]=_[_0x868c('0x42')](_0x2a6fa5[_0x868c('0x3d')],{'$or':_[_0x868c('0x2f')](_0x2a6fa5['attributes'],function(_0x854455){var _0x3aa899={};_0x3aa899[_0x854455]={'$like':'%'+_0x443ffd[_0x868c('0x33')][_0x868c('0x41')]+'%'};return _0x3aa899;})});}_0x2a6fa5=_['merge']({},_0x2a6fa5,_0x443ffd[_0x868c('0x4a')]);return _0x4ce23d[_0x868c('0x53')](_0x2a6fa5);}})['then'](function(_0x2b43b6){if(_0x2b43b6){_0xb8bdbb=_0x2b43b6['length'];if(!_0x443ffd[_0x868c('0x33')][_0x868c('0x3a')](_0x868c('0x3b'))){_0x2a6fa5['limit']=qs['limit'](_0x443ffd['query'][_0x868c('0x22')]);_0x2a6fa5[_0x868c('0x20')]=qs['offset'](_0x443ffd[_0x868c('0x33')][_0x868c('0x20')]);}return _0x4ce23d[_0x868c('0x53')](_0x2a6fa5);}})[_0x868c('0x29')](function(_0x1ce8fa){if(_0x1ce8fa){return _0x1ce8fa?{'count':_0xb8bdbb,'rows':_0x1ce8fa}:null;}})[_0x868c('0x29')](respondWithResult(_0x58185c,null))['catch'](handleError(_0x58185c,null));};exports[_0x868c('0x54')]=function(_0x4cc598,_0x63f041,_0x3b7aca){var _0x32c0af={};var _0x4c7054={};var _0x30e7ba;var _0x32dd81;return db[_0x868c('0x44')][_0x868c('0x50')]({'where':{'id':_0x4cc598['params']['id']}})[_0x868c('0x29')](handleEntityNotFound(_0x63f041,null))['then'](function(_0x4328d2){if(_0x4328d2){_0x30e7ba=_0x4328d2;_0x4c7054[_0x868c('0x36')]=_[_0x868c('0x32')](db[_0x868c('0x51')][_0x868c('0x30')]);_0x4c7054[_0x868c('0x33')]=_[_0x868c('0x32')](_0x4cc598[_0x868c('0x33')]);_0x4c7054[_0x868c('0x34')]=_[_0x868c('0x35')](_0x4c7054['model'],_0x4c7054[_0x868c('0x33')]);_0x32c0af[_0x868c('0x37')]=_['intersection'](_0x4c7054[_0x868c('0x36')],qs[_0x868c('0x38')](_0x4cc598['query'][_0x868c('0x38')]));_0x32c0af[_0x868c('0x37')]=_0x32c0af[_0x868c('0x37')]['length']?_0x32c0af['attributes']:_0x4c7054[_0x868c('0x36')];_0x32c0af[_0x868c('0x52')]=qs[_0x868c('0x3c')](_0x4cc598['query'][_0x868c('0x3c')]);_0x32c0af[_0x868c('0x3d')]=qs[_0x868c('0x34')](_[_0x868c('0x3e')](_0x4cc598[_0x868c('0x33')],_0x4c7054['filters']));if(_0x4cc598[_0x868c('0x33')][_0x868c('0x41')]){_0x32c0af[_0x868c('0x3d')]=_[_0x868c('0x42')](_0x32c0af[_0x868c('0x3d')],{'$or':_[_0x868c('0x2f')](_0x32c0af[_0x868c('0x37')],function(_0x10aaec){var _0x1be99c={};_0x1be99c[_0x10aaec]={'$like':'%'+_0x4cc598[_0x868c('0x33')]['filter']+'%'};return _0x1be99c;})});}_0x32c0af=_[_0x868c('0x42')]({},_0x32c0af,_0x4cc598[_0x868c('0x4a')]);return _0x30e7ba[_0x868c('0x54')](_0x32c0af);}})[_0x868c('0x29')](function(_0x57abfa){if(_0x57abfa){_0x32dd81=_0x57abfa[_0x868c('0x39')];if(!_0x4cc598[_0x868c('0x33')][_0x868c('0x3a')](_0x868c('0x3b'))){_0x32c0af[_0x868c('0x22')]=qs[_0x868c('0x22')](_0x4cc598['query'][_0x868c('0x22')]);_0x32c0af['offset']=qs[_0x868c('0x20')](_0x4cc598[_0x868c('0x33')][_0x868c('0x20')]);}return _0x30e7ba[_0x868c('0x54')](_0x32c0af);}})[_0x868c('0x29')](function(_0x57f138){if(_0x57f138){return _0x57f138?{'count':_0x32dd81,'rows':_0x57f138}:null;}})[_0x868c('0x29')](respondWithResult(_0x63f041,null))[_0x868c('0x4e')](handleError(_0x63f041,null));};exports[_0x868c('0x55')]=function(_0x47b6ff,_0x3b6389,_0x634f3a){var _0x2e541a={};var _0x49f61d={};var _0x579cf1;var _0x426a12;return db[_0x868c('0x44')][_0x868c('0x50')]({'where':{'id':_0x47b6ff[_0x868c('0x48')]['id']}})[_0x868c('0x29')](handleEntityNotFound(_0x3b6389,null))[_0x868c('0x29')](function(_0x58a0c3){if(_0x58a0c3){_0x579cf1=_0x58a0c3;_0x49f61d['model']=_[_0x868c('0x32')](db[_0x868c('0x51')][_0x868c('0x30')]);_0x49f61d[_0x868c('0x33')]=_[_0x868c('0x32')](_0x47b6ff[_0x868c('0x33')]);_0x49f61d[_0x868c('0x34')]=_[_0x868c('0x35')](_0x49f61d['model'],_0x49f61d[_0x868c('0x33')]);_0x2e541a[_0x868c('0x37')]=_[_0x868c('0x35')](_0x49f61d[_0x868c('0x36')],qs[_0x868c('0x38')](_0x47b6ff[_0x868c('0x33')]['fields']));_0x2e541a[_0x868c('0x37')]=_0x2e541a[_0x868c('0x37')][_0x868c('0x39')]?_0x2e541a[_0x868c('0x37')]:_0x49f61d[_0x868c('0x36')];_0x2e541a[_0x868c('0x52')]=qs[_0x868c('0x3c')](_0x47b6ff[_0x868c('0x33')][_0x868c('0x3c')]);_0x2e541a['where']=qs['filters'](_['pick'](_0x47b6ff[_0x868c('0x33')],_0x49f61d['filters']));if(_0x47b6ff[_0x868c('0x33')]['filter']){_0x2e541a['where']=_['merge'](_0x2e541a[_0x868c('0x3d')],{'$or':_[_0x868c('0x2f')](_0x2e541a[_0x868c('0x37')],function(_0x498676){var _0x54b7f7={};_0x54b7f7[_0x498676]={'$like':'%'+_0x47b6ff[_0x868c('0x33')][_0x868c('0x41')]+'%'};return _0x54b7f7;})});}_0x2e541a=_[_0x868c('0x42')]({},_0x2e541a,_0x47b6ff[_0x868c('0x4a')]);return _0x579cf1[_0x868c('0x55')](_0x2e541a);}})[_0x868c('0x29')](function(_0xb53ac8){if(_0xb53ac8){_0x426a12=_0xb53ac8['length'];if(!_0x47b6ff[_0x868c('0x33')]['hasOwnProperty']('nolimit')){_0x2e541a['limit']=qs[_0x868c('0x22')](_0x47b6ff[_0x868c('0x33')][_0x868c('0x22')]);_0x2e541a[_0x868c('0x20')]=qs[_0x868c('0x20')](_0x47b6ff[_0x868c('0x33')][_0x868c('0x20')]);}return _0x579cf1['getDescriptions'](_0x2e541a);}})[_0x868c('0x29')](function(_0x564510){if(_0x564510){return _0x564510?{'count':_0x426a12,'rows':_0x564510}:null;}})[_0x868c('0x29')](respondWithResult(_0x3b6389,null))[_0x868c('0x4e')](handleError(_0x3b6389,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index c3c0152..9da3c7c 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 _0x6b72=['../../config/environment','./intServicenowConfiguration.attributes','exports','define','ServicenowConfiguration','int_servicenow_configurations','lodash','../../config/logger','api','bluebird','request-promise'];(function(_0x4037e8,_0x20cb13){var _0x575f49=function(_0x1da562){while(--_0x1da562){_0x4037e8['push'](_0x4037e8['shift']());}};_0x575f49(++_0x20cb13);}(_0x6b72,0x19d));var _0x26b7=function(_0x487da0,_0x4409be){_0x487da0=_0x487da0-0x0;var _0x31c643=_0x6b72[_0x487da0];return _0x31c643;};'use strict';var _=require(_0x26b7('0x0'));var util=require('util');var logger=require(_0x26b7('0x1'))(_0x26b7('0x2'));var moment=require('moment');var BPromise=require(_0x26b7('0x3'));var rp=require(_0x26b7('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x26b7('0x5'));var attributes=require(_0x26b7('0x6'));module[_0x26b7('0x7')]=function(_0x5bf038,_0x26ac11){return _0x5bf038[_0x26b7('0x8')](_0x26b7('0x9'),attributes,{'tableName':_0x26b7('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6215=['lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','define','ServicenowConfiguration','int_servicenow_configurations'];(function(_0x243575,_0xef6324){var _0x5ae7b2=function(_0x5f79){while(--_0x5f79){_0x243575['push'](_0x243575['shift']());}};_0x5ae7b2(++_0xef6324);}(_0x6215,0x198));var _0x5621=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6215[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x5621('0x0'));var util=require(_0x5621('0x1'));var logger=require(_0x5621('0x2'))('api');var moment=require(_0x5621('0x3'));var BPromise=require(_0x5621('0x4'));var rp=require(_0x5621('0x5'));var fs=require('fs');var path=require(_0x5621('0x6'));var rimraf=require(_0x5621('0x7'));var config=require(_0x5621('0x8'));var attributes=require('./intServicenowConfiguration.attributes');module['exports']=function(_0x52f3c6,_0x5ae3af){return _0x52f3c6[_0x5621('0x9')](_0x5621('0xa'),attributes,{'tableName':_0x5621('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js index af638e3..52b0a4d 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 _0x6797=['code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error'];(function(_0x7de12b,_0x2ae0f8){var _0x114781=function(_0x32e5c7){while(--_0x32e5c7){_0x7de12b['push'](_0x7de12b['shift']());}};_0x114781(++_0x2ae0f8);}(_0x6797,0x94));var _0x7679=function(_0x3f0116,_0x1de9d7){_0x3f0116=_0x3f0116-0x0;var _0x1de4f9=_0x6797[_0x3f0116];return _0x1de4f9;};'use strict';var _=require(_0x7679('0x0'));var util=require(_0x7679('0x1'));var moment=require(_0x7679('0x2'));var BPromise=require(_0x7679('0x3'));var rs=require(_0x7679('0x4'));var fs=require('fs');var Redis=require(_0x7679('0x5'));var db=require(_0x7679('0x6'))['db'];var utils=require(_0x7679('0x7'));var logger=require(_0x7679('0x8'))('rpc');var config=require(_0x7679('0x9'));var jayson=require(_0x7679('0xa'));var client=jayson['client'][_0x7679('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5326a8,_0x17cd0b,_0xa34325){return new BPromise(function(_0x423561,_0x52150b){return client[_0x7679('0xc')](_0x5326a8,_0xa34325)[_0x7679('0xd')](function(_0x47151a){logger[_0x7679('0xe')](_0x7679('0xf'),_0x17cd0b,_0x7679('0x10'));logger[_0x7679('0x11')]('ServicenowConfiguration,\x20%s,\x20%s,\x20%s',_0x17cd0b,_0x7679('0x10'),JSON[_0x7679('0x12')](_0x47151a));if(_0x47151a[_0x7679('0x13')]){if(_0x47151a[_0x7679('0x13')][_0x7679('0x14')]===0x1f4){logger[_0x7679('0x13')](_0x7679('0xf'),_0x17cd0b,_0x47151a[_0x7679('0x13')]['message']);return _0x52150b(_0x47151a[_0x7679('0x13')][_0x7679('0x15')]);}logger[_0x7679('0x13')](_0x7679('0xf'),_0x17cd0b,_0x47151a['error'][_0x7679('0x15')]);return _0x423561(_0x47151a[_0x7679('0x13')]['message']);}else{logger[_0x7679('0xe')](_0x7679('0xf'),_0x17cd0b,_0x7679('0x10'));_0x423561(_0x47151a[_0x7679('0x16')][_0x7679('0x15')]);}})[_0x7679('0x17')](function(_0x16eba5){logger[_0x7679('0x13')](_0x7679('0xf'),_0x17cd0b,_0x16eba5);_0x52150b(_0x16eba5);});});} \ No newline at end of file +var _0xb522=['../../config/environment','jayson/promise','client','request','info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x2ee47f,_0x312d0e){var _0x32bda9=function(_0x3e6775){while(--_0x3e6775){_0x2ee47f['push'](_0x2ee47f['shift']());}};_0x32bda9(++_0x312d0e);}(_0xb522,0x15e));var _0x2b52=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb522[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x2b52('0x0'));var util=require(_0x2b52('0x1'));var moment=require(_0x2b52('0x2'));var BPromise=require(_0x2b52('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2b52('0x4'))['db'];var utils=require(_0x2b52('0x5'));var logger=require(_0x2b52('0x6'))('rpc');var config=require(_0x2b52('0x7'));var jayson=require(_0x2b52('0x8'));var client=jayson[_0x2b52('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2d4b56,_0x5a268a,_0xe4927b){return new BPromise(function(_0x32607c,_0x2c9ef2){return client[_0x2b52('0xa')](_0x2d4b56,_0xe4927b)['then'](function(_0x431ba){logger[_0x2b52('0xb')](_0x2b52('0xc'),_0x5a268a,_0x2b52('0xd'));logger[_0x2b52('0xe')](_0x2b52('0xf'),_0x5a268a,_0x2b52('0xd'),JSON[_0x2b52('0x10')](_0x431ba));if(_0x431ba[_0x2b52('0x11')]){if(_0x431ba[_0x2b52('0x11')][_0x2b52('0x12')]===0x1f4){logger[_0x2b52('0x11')](_0x2b52('0xc'),_0x5a268a,_0x431ba[_0x2b52('0x11')][_0x2b52('0x13')]);return _0x2c9ef2(_0x431ba[_0x2b52('0x11')][_0x2b52('0x13')]);}logger[_0x2b52('0x11')](_0x2b52('0xc'),_0x5a268a,_0x431ba['error'][_0x2b52('0x13')]);return _0x32607c(_0x431ba[_0x2b52('0x11')][_0x2b52('0x13')]);}else{logger[_0x2b52('0xb')](_0x2b52('0xc'),_0x5a268a,_0x2b52('0xd'));_0x32607c(_0x431ba['result'][_0x2b52('0x13')]);}})[_0x2b52('0x14')](function(_0x18e2ae){logger[_0x2b52('0x11')](_0x2b52('0xc'),_0x5a268a,_0x18e2ae);_0x2c9ef2(_0x18e2ae);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index 0b370fa..a36e885 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 _0x1866=['./intServicenowField.controller','index','get','/:id','isAuthenticated','create','put','update','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x7bf12b,_0x236b77){var _0x5f0627=function(_0x4b0dd4){while(--_0x4b0dd4){_0x7bf12b['push'](_0x7bf12b['shift']());}};_0x5f0627(++_0x236b77);}(_0x1866,0xd6));var _0x6186=function(_0x543084,_0x4337f5){_0x543084=_0x543084-0x0;var _0x306a57=_0x1866[_0x543084];return _0x306a57;};'use strict';var multer=require(_0x6186('0x0'));var util=require('util');var path=require(_0x6186('0x1'));var timeout=require(_0x6186('0x2'));var express=require(_0x6186('0x3'));var router=express[_0x6186('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x6186('0x5'));var interaction=require(_0x6186('0x6'));var config=require('../../config/environment');var controller=require(_0x6186('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x6186('0x8')]);router[_0x6186('0x9')](_0x6186('0xa'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0x6186('0xb')](),controller[_0x6186('0xc')]);router[_0x6186('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x6186('0xe')]);router['delete'](_0x6186('0xa'),auth[_0x6186('0xb')](),controller[_0x6186('0xf')]);module[_0x6186('0x10')]=router; \ No newline at end of file +var _0x772c=['../../components/interaction/service','../../config/environment','./intServicenowField.controller','get','isAuthenticated','index','/:id','show','post','create','put','delete','destroy','exports','multer','util','path','Router','fs-extra'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x772c,0xdf));var _0xc772=function(_0x1b5660,_0x10c2d9){_0x1b5660=_0x1b5660-0x0;var _0x43218c=_0x772c[_0x1b5660];return _0x43218c;};'use strict';var multer=require(_0xc772('0x0'));var util=require(_0xc772('0x1'));var path=require(_0xc772('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xc772('0x3')]();var fs_extra=require(_0xc772('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xc772('0x5'));var config=require(_0xc772('0x6'));var controller=require(_0xc772('0x7'));router[_0xc772('0x8')]('/',auth[_0xc772('0x9')](),controller[_0xc772('0xa')]);router[_0xc772('0x8')](_0xc772('0xb'),auth[_0xc772('0x9')](),controller[_0xc772('0xc')]);router[_0xc772('0xd')]('/',auth[_0xc772('0x9')](),controller[_0xc772('0xe')]);router[_0xc772('0xf')](_0xc772('0xb'),auth[_0xc772('0x9')](),controller['update']);router[_0xc772('0x10')](_0xc772('0xb'),auth[_0xc772('0x9')](),controller[_0xc772('0x11')]);module[_0xc772('0x12')]=router; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.attributes.js b/server/api/intServicenowField/intServicenowField.attributes.js index 315be45..8b3f8e5 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 _0x947b=['variable','customVariable','keyValue','picklist','string','STRING','BOOLEAN','sequelize','exports','ENUM'];(function(_0x12e3d2,_0x77a0e0){var _0x2e632c=function(_0x52d273){while(--_0x52d273){_0x12e3d2['push'](_0x12e3d2['shift']());}};_0x2e632c(++_0x77a0e0);}(_0x947b,0x15b));var _0xb947=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x947b[_0x3bf83f];return _0x22c4a9;};'use strict';var Sequelize=require(_0xb947('0x0'));module[_0xb947('0x1')]={'type':{'type':Sequelize[_0xb947('0x2')]('string',_0xb947('0x3'),_0xb947('0x4'),_0xb947('0x5'),_0xb947('0x6')),'defaultValue':_0xb947('0x7')},'content':{'type':Sequelize[_0xb947('0x8')]},'key':{'type':Sequelize[_0xb947('0x8')]},'keyType':{'type':Sequelize[_0xb947('0x2')](_0xb947('0x7'),'variable',_0xb947('0x4'))},'keyContent':{'type':Sequelize[_0xb947('0x8')]},'idField':{'type':Sequelize[_0xb947('0x8')]},'nameField':{'type':Sequelize[_0xb947('0x8')]},'customField':{'type':Sequelize[_0xb947('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xb947('0x8')]}}; \ No newline at end of file +var _0x12b3=['string','customVariable','picklist','STRING','ENUM','sequelize'];(function(_0x4fde08,_0x463a36){var _0x12e725=function(_0x2670c5){while(--_0x2670c5){_0x4fde08['push'](_0x4fde08['shift']());}};_0x12e725(++_0x463a36);}(_0x12b3,0x11f));var _0x312b=function(_0x1d754e,_0x48e912){_0x1d754e=_0x1d754e-0x0;var _0x551a3c=_0x12b3[_0x1d754e];return _0x551a3c;};'use strict';var Sequelize=require(_0x312b('0x0'));module['exports']={'type':{'type':Sequelize['ENUM'](_0x312b('0x1'),'variable',_0x312b('0x2'),'keyValue',_0x312b('0x3')),'defaultValue':'string'},'content':{'type':Sequelize[_0x312b('0x4')]},'key':{'type':Sequelize[_0x312b('0x4')]},'keyType':{'type':Sequelize[_0x312b('0x5')](_0x312b('0x1'),'variable',_0x312b('0x2'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x312b('0x4')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index 597db0a..44763b4 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 _0xfa37=['index','ServicenowField','rawAttributes','fieldName','type','key','model','map','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','options','includeAll','include','catch','show','params','find','create','body','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','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','../../config/environment','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','apply','save','update','then','destroy','error','name','send'];(function(_0x17882c,_0x4b964b){var _0x355a59=function(_0x534b5b){while(--_0x534b5b){_0x17882c['push'](_0x17882c['shift']());}};_0x355a59(++_0x4b964b);}(_0xfa37,0x180));var _0x7fa3=function(_0xfa8f85,_0x3e0c34){_0xfa8f85=_0xfa8f85-0x0;var _0x150225=_0xfa37[_0xfa8f85];return _0x150225;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7fa3('0x0'));var zipdir=require(_0x7fa3('0x1'));var jsonpatch=require(_0x7fa3('0x2'));var rp=require(_0x7fa3('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x7fa3('0x4'));var util=require(_0x7fa3('0x5'));var path=require(_0x7fa3('0x6'));var sox=require('sox');var csv=require(_0x7fa3('0x7'));var ejs=require(_0x7fa3('0x8'));var fs=require('fs');var fs_extra=require(_0x7fa3('0x9'));var _=require(_0x7fa3('0xa'));var squel=require(_0x7fa3('0xb'));var crypto=require(_0x7fa3('0xc'));var jsforce=require(_0x7fa3('0xd'));var deskjs=require(_0x7fa3('0xe'));var toCsv=require(_0x7fa3('0x7'));var querystring=require(_0x7fa3('0xf'));var Papa=require(_0x7fa3('0x10'));var Redis=require(_0x7fa3('0x11'));var authService=require(_0x7fa3('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x7fa3('0x13'));var hardwareService=require(_0x7fa3('0x14'));var logger=require(_0x7fa3('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x7fa3('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x7fa3('0x17'))['db'];function respondWithStatusCode(_0x397973,_0x386a17){_0x386a17=_0x386a17||0xcc;return function(_0x219c44){if(_0x219c44){return _0x397973[_0x7fa3('0x18')](_0x386a17);}return _0x397973[_0x7fa3('0x19')](_0x386a17)[_0x7fa3('0x1a')]();};}function respondWithResult(_0x1cf2fb,_0x33a72a){_0x33a72a=_0x33a72a||0xc8;return function(_0x5e7b9f){if(_0x5e7b9f){return _0x1cf2fb[_0x7fa3('0x19')](_0x33a72a)['json'](_0x5e7b9f);}};}function respondWithFilteredResult(_0x29763d,_0x54d6da){return function(_0x443368){if(_0x443368){var _0x388a9b=typeof _0x54d6da[_0x7fa3('0x1b')]==='undefined'&&typeof _0x54d6da[_0x7fa3('0x1c')]===_0x7fa3('0x1d');var _0x4a1aa4=_0x443368[_0x7fa3('0x1e')];var _0x46e7d1=_0x388a9b?0x0:_0x54d6da[_0x7fa3('0x1b')];var _0x52240c=_0x388a9b?_0x443368[_0x7fa3('0x1e')]:_0x54d6da[_0x7fa3('0x1b')]+_0x54d6da[_0x7fa3('0x1c')];var _0x279a72;if(_0x52240c>=_0x4a1aa4){_0x52240c=_0x4a1aa4;_0x279a72=0xc8;}else{_0x279a72=0xce;}_0x29763d['status'](_0x279a72);return _0x29763d[_0x7fa3('0x1f')](_0x7fa3('0x20'),_0x46e7d1+'-'+_0x52240c+'/'+_0x4a1aa4)[_0x7fa3('0x21')](_0x443368);}return null;};}function patchUpdates(_0x4266f1){return function(_0x7d4ad8){try{jsonpatch[_0x7fa3('0x22')](_0x7d4ad8,_0x4266f1,!![]);}catch(_0xfff90a){return BPromise['reject'](_0xfff90a);}return _0x7d4ad8[_0x7fa3('0x23')]();};}function saveUpdates(_0xdaec0f,_0x47443e){return function(_0x3f7866){if(_0x3f7866){return _0x3f7866[_0x7fa3('0x24')](_0xdaec0f)[_0x7fa3('0x25')](function(_0x19346d){return _0x19346d;});}return null;};}function removeEntity(_0x3f33b4,_0x17dafb){return function(_0x2ae299){if(_0x2ae299){return _0x2ae299[_0x7fa3('0x26')]()[_0x7fa3('0x25')](function(){_0x3f33b4[_0x7fa3('0x19')](0xcc)[_0x7fa3('0x1a')]();});}};}function handleEntityNotFound(_0x556979,_0x3b5430){return function(_0x55627d){if(!_0x55627d){_0x556979[_0x7fa3('0x18')](0x194);}return _0x55627d;};}function handleError(_0x192270,_0x31072a){_0x31072a=_0x31072a||0x1f4;return function(_0x4c76f8){logger[_0x7fa3('0x27')](_0x4c76f8['stack']);if(_0x4c76f8[_0x7fa3('0x28')]){delete _0x4c76f8[_0x7fa3('0x28')];}_0x192270[_0x7fa3('0x19')](_0x31072a)[_0x7fa3('0x29')](_0x4c76f8);};}exports[_0x7fa3('0x2a')]=function(_0x2ed744,_0x1598cb){var _0x1ebf6a={},_0x16d659={},_0x2222c6={'count':0x0,'rows':[]};var _0x3b9ecb=_['map'](db[_0x7fa3('0x2b')][_0x7fa3('0x2c')],function(_0x14a61d){return{'name':_0x14a61d[_0x7fa3('0x2d')],'type':_0x14a61d[_0x7fa3('0x2e')][_0x7fa3('0x2f')]};});_0x16d659[_0x7fa3('0x30')]=_[_0x7fa3('0x31')](_0x3b9ecb,_0x7fa3('0x28'));_0x16d659[_0x7fa3('0x32')]=_[_0x7fa3('0x33')](_0x2ed744[_0x7fa3('0x32')]);_0x16d659[_0x7fa3('0x34')]=_['intersection'](_0x16d659[_0x7fa3('0x30')],_0x16d659[_0x7fa3('0x32')]);_0x1ebf6a[_0x7fa3('0x35')]=_['intersection'](_0x16d659[_0x7fa3('0x30')],qs['fields'](_0x2ed744[_0x7fa3('0x32')][_0x7fa3('0x36')]));_0x1ebf6a['attributes']=_0x1ebf6a[_0x7fa3('0x35')][_0x7fa3('0x37')]?_0x1ebf6a[_0x7fa3('0x35')]:_0x16d659[_0x7fa3('0x30')];if(!_0x2ed744[_0x7fa3('0x32')][_0x7fa3('0x38')](_0x7fa3('0x39'))){_0x1ebf6a['limit']=qs[_0x7fa3('0x1c')](_0x2ed744[_0x7fa3('0x32')][_0x7fa3('0x1c')]);_0x1ebf6a[_0x7fa3('0x1b')]=qs['offset'](_0x2ed744[_0x7fa3('0x32')][_0x7fa3('0x1b')]);}_0x1ebf6a['order']=qs[_0x7fa3('0x3a')](_0x2ed744[_0x7fa3('0x32')][_0x7fa3('0x3a')]);_0x1ebf6a[_0x7fa3('0x3b')]=qs[_0x7fa3('0x34')](_['pick'](_0x2ed744[_0x7fa3('0x32')],_0x16d659[_0x7fa3('0x34')]),_0x3b9ecb);if(_0x2ed744[_0x7fa3('0x32')][_0x7fa3('0x3c')]){_0x1ebf6a[_0x7fa3('0x3b')]=_['merge'](_0x1ebf6a[_0x7fa3('0x3b')],{'$or':_[_0x7fa3('0x31')](_0x3b9ecb,function(_0x3549a8){if(_0x3549a8[_0x7fa3('0x2e')]!=='VIRTUAL'){var _0x5e8116={};_0x5e8116[_0x3549a8[_0x7fa3('0x28')]]={'$like':'%'+_0x2ed744[_0x7fa3('0x32')][_0x7fa3('0x3c')]+'%'};return _0x5e8116;}})});}_0x1ebf6a=_[_0x7fa3('0x3d')]({},_0x1ebf6a,_0x2ed744[_0x7fa3('0x3e')]);var _0x32e680={'where':_0x1ebf6a[_0x7fa3('0x3b')]};return db[_0x7fa3('0x2b')][_0x7fa3('0x1e')](_0x32e680)[_0x7fa3('0x25')](function(_0x20fdb1){_0x2222c6['count']=_0x20fdb1;if(_0x2ed744['query'][_0x7fa3('0x3f')]){_0x1ebf6a[_0x7fa3('0x40')]=[{'all':!![]}];}return db[_0x7fa3('0x2b')]['findAll'](_0x1ebf6a);})[_0x7fa3('0x25')](function(_0x4b747a){_0x2222c6['rows']=_0x4b747a;return _0x2222c6;})[_0x7fa3('0x25')](respondWithFilteredResult(_0x1598cb,_0x1ebf6a))[_0x7fa3('0x41')](handleError(_0x1598cb,null));};exports[_0x7fa3('0x42')]=function(_0x21903b,_0x289498){var _0xac7f48={'raw':!![],'where':{'id':_0x21903b[_0x7fa3('0x43')]['id']}},_0x22742d={};_0x22742d[_0x7fa3('0x30')]=_[_0x7fa3('0x33')](db[_0x7fa3('0x2b')][_0x7fa3('0x2c')]);_0x22742d[_0x7fa3('0x32')]=_[_0x7fa3('0x33')](_0x21903b[_0x7fa3('0x32')]);_0x22742d[_0x7fa3('0x34')]=_['intersection'](_0x22742d[_0x7fa3('0x30')],_0x22742d[_0x7fa3('0x32')]);_0xac7f48[_0x7fa3('0x35')]=_['intersection'](_0x22742d[_0x7fa3('0x30')],qs['fields'](_0x21903b[_0x7fa3('0x32')][_0x7fa3('0x36')]));_0xac7f48[_0x7fa3('0x35')]=_0xac7f48[_0x7fa3('0x35')]['length']?_0xac7f48[_0x7fa3('0x35')]:_0x22742d['model'];if(_0x21903b[_0x7fa3('0x32')][_0x7fa3('0x3f')]){_0xac7f48[_0x7fa3('0x40')]=[{'all':!![]}];}_0xac7f48=_[_0x7fa3('0x3d')]({},_0xac7f48,_0x21903b['options']);return db[_0x7fa3('0x2b')][_0x7fa3('0x44')](_0xac7f48)[_0x7fa3('0x25')](handleEntityNotFound(_0x289498,null))[_0x7fa3('0x25')](respondWithResult(_0x289498,null))[_0x7fa3('0x41')](handleError(_0x289498,null));};exports[_0x7fa3('0x45')]=function(_0x366ffa,_0x5e0de3){return db['ServicenowField'][_0x7fa3('0x45')](_0x366ffa[_0x7fa3('0x46')],{})[_0x7fa3('0x25')](respondWithResult(_0x5e0de3,0xc9))['catch'](handleError(_0x5e0de3,null));};exports[_0x7fa3('0x24')]=function(_0x351fc5,_0x4b88c0){if(_0x351fc5['body']['id']){delete _0x351fc5[_0x7fa3('0x46')]['id'];}return db[_0x7fa3('0x2b')][_0x7fa3('0x44')]({'where':{'id':_0x351fc5[_0x7fa3('0x43')]['id']}})[_0x7fa3('0x25')](handleEntityNotFound(_0x4b88c0,null))[_0x7fa3('0x25')](saveUpdates(_0x351fc5[_0x7fa3('0x46')],null))[_0x7fa3('0x25')](respondWithResult(_0x4b88c0,null))[_0x7fa3('0x41')](handleError(_0x4b88c0,null));};exports[_0x7fa3('0x26')]=function(_0x1fefe4,_0x5a5896){return db[_0x7fa3('0x2b')][_0x7fa3('0x44')]({'where':{'id':_0x1fefe4['params']['id']}})[_0x7fa3('0x25')](handleEntityNotFound(_0x5a5896,null))[_0x7fa3('0x25')](removeEntity(_0x5a5896,null))[_0x7fa3('0x41')](handleError(_0x5a5896,null));}; \ No newline at end of file +var _0xab7e=['api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','Content-Range','apply','update','then','error','stack','send','index','map','rawAttributes','fieldName','type','key','model','name','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','merge','VIRTUAL','options','ServicenowField','include','params','find','catch','create','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x18ab2a,_0x4debcd){var _0x16dcee=function(_0x10107a){while(--_0x10107a){_0x18ab2a['push'](_0x18ab2a['shift']());}};_0x16dcee(++_0x4debcd);}(_0xab7e,0x1ea));var _0xeab7=function(_0x41a45d,_0x1e61c3){_0x41a45d=_0x41a45d-0x0;var _0x24b1d6=_0xab7e[_0x41a45d];return _0x24b1d6;};'use strict';var emlformat=require(_0xeab7('0x0'));var rimraf=require(_0xeab7('0x1'));var zipdir=require(_0xeab7('0x2'));var jsonpatch=require(_0xeab7('0x3'));var rp=require(_0xeab7('0x4'));var moment=require('moment');var BPromise=require(_0xeab7('0x5'));var Mustache=require(_0xeab7('0x6'));var util=require(_0xeab7('0x7'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xeab7('0x8'));var fs=require('fs');var fs_extra=require(_0xeab7('0x9'));var _=require(_0xeab7('0xa'));var squel=require(_0xeab7('0xb'));var crypto=require(_0xeab7('0xc'));var jsforce=require(_0xeab7('0xd'));var deskjs=require(_0xeab7('0xe'));var toCsv=require(_0xeab7('0xf'));var querystring=require('querystring');var Papa=require(_0xeab7('0x10'));var Redis=require(_0xeab7('0x11'));var authService=require(_0xeab7('0x12'));var qs=require(_0xeab7('0x13'));var as=require(_0xeab7('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xeab7('0x15'));var utils=require('../../config/utils');var config=require(_0xeab7('0x16'));var licenseUtil=require(_0xeab7('0x17'));var db=require(_0xeab7('0x18'))['db'];function respondWithStatusCode(_0x290e35,_0x2ec619){_0x2ec619=_0x2ec619||0xcc;return function(_0x56d481){if(_0x56d481){return _0x290e35[_0xeab7('0x19')](_0x2ec619);}return _0x290e35[_0xeab7('0x1a')](_0x2ec619)[_0xeab7('0x1b')]();};}function respondWithResult(_0xe30643,_0x291839){_0x291839=_0x291839||0xc8;return function(_0x53c2cd){if(_0x53c2cd){return _0xe30643[_0xeab7('0x1a')](_0x291839)[_0xeab7('0x1c')](_0x53c2cd);}};}function respondWithFilteredResult(_0x59f3fa,_0x578c2b){return function(_0x14b3e1){if(_0x14b3e1){var _0x14402e=typeof _0x578c2b[_0xeab7('0x1d')]===_0xeab7('0x1e')&&typeof _0x578c2b['limit']===_0xeab7('0x1e');var _0x597420=_0x14b3e1[_0xeab7('0x1f')];var _0x2d2e18=_0x14402e?0x0:_0x578c2b['offset'];var _0x182883=_0x14402e?_0x14b3e1[_0xeab7('0x1f')]:_0x578c2b[_0xeab7('0x1d')]+_0x578c2b['limit'];var _0x1fc119;if(_0x182883>=_0x597420){_0x182883=_0x597420;_0x1fc119=0xc8;}else{_0x1fc119=0xce;}_0x59f3fa[_0xeab7('0x1a')](_0x1fc119);return _0x59f3fa['set'](_0xeab7('0x20'),_0x2d2e18+'-'+_0x182883+'/'+_0x597420)[_0xeab7('0x1c')](_0x14b3e1);}return null;};}function patchUpdates(_0x440131){return function(_0x752596){try{jsonpatch[_0xeab7('0x21')](_0x752596,_0x440131,!![]);}catch(_0x2ae826){return BPromise['reject'](_0x2ae826);}return _0x752596['save']();};}function saveUpdates(_0x412d6d,_0x2655bf){return function(_0xbdcc34){if(_0xbdcc34){return _0xbdcc34[_0xeab7('0x22')](_0x412d6d)[_0xeab7('0x23')](function(_0x8ec1c0){return _0x8ec1c0;});}return null;};}function removeEntity(_0x59b9c4,_0x2f44e7){return function(_0x5c4e33){if(_0x5c4e33){return _0x5c4e33['destroy']()[_0xeab7('0x23')](function(){_0x59b9c4[_0xeab7('0x1a')](0xcc)[_0xeab7('0x1b')]();});}};}function handleEntityNotFound(_0x1710b0,_0x4ecf44){return function(_0x19e1ac){if(!_0x19e1ac){_0x1710b0[_0xeab7('0x19')](0x194);}return _0x19e1ac;};}function handleError(_0x500658,_0x416516){_0x416516=_0x416516||0x1f4;return function(_0x450400){logger[_0xeab7('0x24')](_0x450400[_0xeab7('0x25')]);if(_0x450400['name']){delete _0x450400['name'];}_0x500658['status'](_0x416516)[_0xeab7('0x26')](_0x450400);};}exports[_0xeab7('0x27')]=function(_0x20acda,_0x5e09d3){var _0x1fd506={},_0x3862b9={},_0x10ac00={'count':0x0,'rows':[]};var _0xebb245=_[_0xeab7('0x28')](db['ServicenowField'][_0xeab7('0x29')],function(_0x2278b4){return{'name':_0x2278b4[_0xeab7('0x2a')],'type':_0x2278b4[_0xeab7('0x2b')][_0xeab7('0x2c')]};});_0x3862b9[_0xeab7('0x2d')]=_[_0xeab7('0x28')](_0xebb245,_0xeab7('0x2e'));_0x3862b9[_0xeab7('0x2f')]=_[_0xeab7('0x30')](_0x20acda[_0xeab7('0x2f')]);_0x3862b9[_0xeab7('0x31')]=_[_0xeab7('0x32')](_0x3862b9[_0xeab7('0x2d')],_0x3862b9[_0xeab7('0x2f')]);_0x1fd506['attributes']=_['intersection'](_0x3862b9[_0xeab7('0x2d')],qs[_0xeab7('0x33')](_0x20acda['query'][_0xeab7('0x33')]));_0x1fd506[_0xeab7('0x34')]=_0x1fd506[_0xeab7('0x34')][_0xeab7('0x35')]?_0x1fd506[_0xeab7('0x34')]:_0x3862b9['model'];if(!_0x20acda[_0xeab7('0x2f')][_0xeab7('0x36')](_0xeab7('0x37'))){_0x1fd506[_0xeab7('0x38')]=qs[_0xeab7('0x38')](_0x20acda[_0xeab7('0x2f')][_0xeab7('0x38')]);_0x1fd506[_0xeab7('0x1d')]=qs[_0xeab7('0x1d')](_0x20acda[_0xeab7('0x2f')][_0xeab7('0x1d')]);}_0x1fd506[_0xeab7('0x39')]=qs[_0xeab7('0x3a')](_0x20acda[_0xeab7('0x2f')][_0xeab7('0x3a')]);_0x1fd506['where']=qs['filters'](_[_0xeab7('0x3b')](_0x20acda[_0xeab7('0x2f')],_0x3862b9[_0xeab7('0x31')]),_0xebb245);if(_0x20acda[_0xeab7('0x2f')][_0xeab7('0x3c')]){_0x1fd506[_0xeab7('0x3d')]=_[_0xeab7('0x3e')](_0x1fd506[_0xeab7('0x3d')],{'$or':_['map'](_0xebb245,function(_0x57c866){if(_0x57c866[_0xeab7('0x2b')]!==_0xeab7('0x3f')){var _0x59fe58={};_0x59fe58[_0x57c866[_0xeab7('0x2e')]]={'$like':'%'+_0x20acda[_0xeab7('0x2f')][_0xeab7('0x3c')]+'%'};return _0x59fe58;}})});}_0x1fd506=_[_0xeab7('0x3e')]({},_0x1fd506,_0x20acda[_0xeab7('0x40')]);var _0x412584={'where':_0x1fd506[_0xeab7('0x3d')]};return db[_0xeab7('0x41')][_0xeab7('0x1f')](_0x412584)[_0xeab7('0x23')](function(_0x1c685f){_0x10ac00[_0xeab7('0x1f')]=_0x1c685f;if(_0x20acda[_0xeab7('0x2f')]['includeAll']){_0x1fd506[_0xeab7('0x42')]=[{'all':!![]}];}return db[_0xeab7('0x41')]['findAll'](_0x1fd506);})['then'](function(_0x5dc050){_0x10ac00['rows']=_0x5dc050;return _0x10ac00;})[_0xeab7('0x23')](respondWithFilteredResult(_0x5e09d3,_0x1fd506))['catch'](handleError(_0x5e09d3,null));};exports['show']=function(_0x4ab27a,_0x1c11c8){var _0x1fce61={'raw':!![],'where':{'id':_0x4ab27a[_0xeab7('0x43')]['id']}},_0x42b1b3={};_0x42b1b3[_0xeab7('0x2d')]=_[_0xeab7('0x30')](db[_0xeab7('0x41')][_0xeab7('0x29')]);_0x42b1b3['query']=_['keys'](_0x4ab27a['query']);_0x42b1b3[_0xeab7('0x31')]=_[_0xeab7('0x32')](_0x42b1b3['model'],_0x42b1b3[_0xeab7('0x2f')]);_0x1fce61['attributes']=_[_0xeab7('0x32')](_0x42b1b3['model'],qs['fields'](_0x4ab27a[_0xeab7('0x2f')]['fields']));_0x1fce61[_0xeab7('0x34')]=_0x1fce61[_0xeab7('0x34')][_0xeab7('0x35')]?_0x1fce61[_0xeab7('0x34')]:_0x42b1b3[_0xeab7('0x2d')];if(_0x4ab27a['query']['includeAll']){_0x1fce61[_0xeab7('0x42')]=[{'all':!![]}];}_0x1fce61=_[_0xeab7('0x3e')]({},_0x1fce61,_0x4ab27a[_0xeab7('0x40')]);return db[_0xeab7('0x41')][_0xeab7('0x44')](_0x1fce61)[_0xeab7('0x23')](handleEntityNotFound(_0x1c11c8,null))['then'](respondWithResult(_0x1c11c8,null))[_0xeab7('0x45')](handleError(_0x1c11c8,null));};exports[_0xeab7('0x46')]=function(_0x3c8d10,_0x4069c8){return db[_0xeab7('0x41')][_0xeab7('0x46')](_0x3c8d10[_0xeab7('0x47')],{})['then'](respondWithResult(_0x4069c8,0xc9))['catch'](handleError(_0x4069c8,null));};exports['update']=function(_0x252ed4,_0x22e5b5){if(_0x252ed4[_0xeab7('0x47')]['id']){delete _0x252ed4['body']['id'];}return db[_0xeab7('0x41')][_0xeab7('0x44')]({'where':{'id':_0x252ed4[_0xeab7('0x43')]['id']}})[_0xeab7('0x23')](handleEntityNotFound(_0x22e5b5,null))['then'](saveUpdates(_0x252ed4['body'],null))[_0xeab7('0x23')](respondWithResult(_0x22e5b5,null))[_0xeab7('0x45')](handleError(_0x22e5b5,null));};exports[_0xeab7('0x48')]=function(_0x5abf53,_0x484452){return db[_0xeab7('0x41')][_0xeab7('0x44')]({'where':{'id':_0x5abf53['params']['id']}})[_0xeab7('0x23')](handleEntityNotFound(_0x484452,null))[_0xeab7('0x23')](removeEntity(_0x484452,null))[_0xeab7('0x45')](handleError(_0x484452,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index 6ca8dee..59d5e4d 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 _0x638d=['define','ServicenowField','int_servicenow_fields','idField','FieldId','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','./intServicenowField.attributes','exports'];(function(_0x12f76b,_0x100a40){var _0x12b749=function(_0x345d43){while(--_0x345d43){_0x12f76b['push'](_0x12f76b['shift']());}};_0x12b749(++_0x100a40);}(_0x638d,0x19b));var _0xd638=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x638d[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xd638('0x0'));var util=require('util');var logger=require(_0xd638('0x1'))(_0xd638('0x2'));var moment=require('moment');var BPromise=require(_0xd638('0x3'));var rp=require(_0xd638('0x4'));var fs=require('fs');var path=require(_0xd638('0x5'));var rimraf=require(_0xd638('0x6'));var config=require('../../config/environment');var attributes=require(_0xd638('0x7'));module[_0xd638('0x8')]=function(_0x47a9ee,_0x3e8616){return _0x47a9ee[_0xd638('0x9')](_0xd638('0xa'),attributes,{'tableName':_0xd638('0xb'),'paranoid':![],'indexes':[{'name':'servicenow_unique_index','fields':[_0xd638('0xc'),_0xd638('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xeded=['define','int_servicenow_fields','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./intServicenowField.attributes','exports'];(function(_0x1260e8,_0x5b993f){var _0x5ed0d9=function(_0x3c0b78){while(--_0x3c0b78){_0x1260e8['push'](_0x1260e8['shift']());}};_0x5ed0d9(++_0x5b993f);}(_0xeded,0xd6));var _0xdede=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xeded[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xdede('0x0'));var util=require(_0xdede('0x1'));var logger=require(_0xdede('0x2'))(_0xdede('0x3'));var moment=require(_0xdede('0x4'));var BPromise=require(_0xdede('0x5'));var rp=require(_0xdede('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xdede('0x7'));var attributes=require(_0xdede('0x8'));module[_0xdede('0x9')]=function(_0x35e689,_0x5f3c45){return _0x35e689[_0xdede('0xa')]('ServicenowField',attributes,{'tableName':_0xdede('0xb'),'paranoid':![],'indexes':[{'name':'servicenow_unique_index','fields':[_0xdede('0xc'),_0xdede('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 3b86f02..723aecb 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 _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(_0x1c1577,_0x1d4d6d){var _0x566d1f=function(_0x81f351){while(--_0x81f351){_0x1c1577['push'](_0x1c1577['shift']());}};_0x566d1f(++_0x1d4d6d);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var 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 +var _0xb7e7=['ServicenowField,\x20%s,\x20%s','debug','ServicenowField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','http','request','then','info'];(function(_0x143b28,_0x3ecf8a){var _0x87cf5c=function(_0xe4be0){while(--_0xe4be0){_0x143b28['push'](_0x143b28['shift']());}};_0x87cf5c(++_0x3ecf8a);}(_0xb7e7,0x121));var _0x7b7e=function(_0x2ec461,_0x5f588a){_0x2ec461=_0x2ec461-0x0;var _0x28603d=_0xb7e7[_0x2ec461];return _0x28603d;};'use strict';var _=require(_0x7b7e('0x0'));var util=require('util');var moment=require(_0x7b7e('0x1'));var BPromise=require('bluebird');var rs=require(_0x7b7e('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7b7e('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x7b7e('0x4'))(_0x7b7e('0x5'));var config=require(_0x7b7e('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7b7e('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x372bde,_0x7f87e0,_0x55ce81){return new BPromise(function(_0x42b871,_0x223587){return client[_0x7b7e('0x8')](_0x372bde,_0x55ce81)[_0x7b7e('0x9')](function(_0x148964){logger[_0x7b7e('0xa')](_0x7b7e('0xb'),_0x7f87e0,'request\x20sent');logger[_0x7b7e('0xc')](_0x7b7e('0xd'),_0x7f87e0,_0x7b7e('0xe'),JSON[_0x7b7e('0xf')](_0x148964));if(_0x148964[_0x7b7e('0x10')]){if(_0x148964[_0x7b7e('0x10')][_0x7b7e('0x11')]===0x1f4){logger[_0x7b7e('0x10')](_0x7b7e('0xb'),_0x7f87e0,_0x148964['error'][_0x7b7e('0x12')]);return _0x223587(_0x148964[_0x7b7e('0x10')]['message']);}logger[_0x7b7e('0x10')]('ServicenowField,\x20%s,\x20%s',_0x7f87e0,_0x148964['error'][_0x7b7e('0x12')]);return _0x42b871(_0x148964[_0x7b7e('0x10')][_0x7b7e('0x12')]);}else{logger[_0x7b7e('0xa')](_0x7b7e('0xb'),_0x7f87e0,'request\x20sent');_0x42b871(_0x148964['result'][_0x7b7e('0x12')]);}})[_0x7b7e('0x13')](function(_0x27f999){logger[_0x7b7e('0x10')](_0x7b7e('0xb'),_0x7f87e0,_0x27f999);_0x223587(_0x27f999);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index 41734a2..bf80c74 100644 --- a/server/api/intSugarcrmAccount/index.js +++ b/server/api/intSugarcrmAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmAccount.controller','get','index','/:id','getConfigurations','/:id/fields','isAuthenticated','getFields','post','addConfiguration','put','update','destroy','exports','multer','util','path'];(function(_0x1122b0,_0x3259ce){var _0x4dc9c9=function(_0x477a3e){while(--_0x477a3e){_0x1122b0['push'](_0x1122b0['shift']());}};_0x4dc9c9(++_0x3259ce);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0xa9e0[_0x5783f4];return _0x28e380;};'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 _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(_0xa9041,_0x5eb3d2){var _0x101e90=function(_0x10a9db){while(--_0x10a9db){_0xa9041['push'](_0xa9041['shift']());}};_0x101e90(++_0x5eb3d2);}(_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/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 d325cc3..7fc6913 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(_0x4738ea,_0x5acfed){var _0x350b48=function(_0x5d79c8){while(--_0x5d79c8){_0x4738ea['push'](_0x4738ea['shift']());}};_0x350b48(++_0x5acfed);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0xa9e0[_0xbca1b1];return _0x4e1686;};'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(_0x3b2e30,_0x1981f2){var _0x3a083a=function(_0x3658dd){while(--_0x3658dd){_0x3b2e30['push'](_0x3b2e30['shift']());}};_0x3a083a(++_0x1981f2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x298ed3,_0x4ab5e1){_0x298ed3=_0x298ed3-0x0;var _0x5aad28=_0xa9e0[_0x298ed3];return _0x5aad28;};'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 8312049..b0a670f 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 _0x9a62=['index','map','SugarcrmAccount','rawAttributes','fieldName','type','query','keys','filters','intersection','attributes','model','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','includeAll','include','findAll','rows','catch','params','length','find','create','body','getConfigurations','findOne','pick','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','SugarcrmConfiguration','SugarcrmField','getFields','assigned_user_id','created_by','description','duration_minutes','parent_id','parent_type','parent_name','direction','username','remoteUri','slice','substring','lastIndexOf','POST','%s%s','login','JSON','stringify','password','PLAIN','xCALLY\x20Motion\x20Integration','Invalid\x20Login','Password\x20Expired','format','/service/v4_1/rest.php','get_module_fields','Calls','module_fields','remove','includes','label','endsWith','options','value','statusCode','getFields,\x20%s,\x20%s,\x20%s','send','test','Wrong\x20credentials','rimraf','zip-dir','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','sendStatus','status','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','end','error','stack','name'];(function(_0x5cc51f,_0x22c480){var _0x315a2f=function(_0x4f93bd){while(--_0x4f93bd){_0x5cc51f['push'](_0x5cc51f['shift']());}};_0x315a2f(++_0x22c480);}(_0x9a62,0x1bc));var _0x29a6=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x9a62[_0x40a045];return _0x1a687c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x29a6('0x0'));var zipdir=require(_0x29a6('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x29a6('0x2'));var moment=require(_0x29a6('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x29a6('0x4'));var path=require(_0x29a6('0x5'));var sox=require(_0x29a6('0x6'));var csv=require(_0x29a6('0x7'));var ejs=require(_0x29a6('0x8'));var fs=require('fs');var fs_extra=require(_0x29a6('0x9'));var _=require(_0x29a6('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x29a6('0xb'));var deskjs=require(_0x29a6('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x29a6('0xd'));var Redis=require(_0x29a6('0xe'));var authService=require(_0x29a6('0xf'));var qs=require(_0x29a6('0x10'));var as=require(_0x29a6('0x11'));var hardwareService=require(_0x29a6('0x12'));var logger=require(_0x29a6('0x13'))('api');var utils=require(_0x29a6('0x14'));var config=require(_0x29a6('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x1d78fa,_0x7acc03){_0x7acc03=_0x7acc03||0xcc;return function(_0x5e2abb){if(_0x5e2abb){return _0x1d78fa[_0x29a6('0x16')](_0x7acc03);}return _0x1d78fa[_0x29a6('0x17')](_0x7acc03)['end']();};}function respondWithResult(_0x50c663,_0x36d6fd){_0x36d6fd=_0x36d6fd||0xc8;return function(_0x186afa){if(_0x186afa){return _0x50c663['status'](_0x36d6fd)[_0x29a6('0x18')](_0x186afa);}};}function respondWithFilteredResult(_0x22378a,_0x307dd9){return function(_0x4fef5c){if(_0x4fef5c){var _0x862659=typeof _0x307dd9[_0x29a6('0x19')]===_0x29a6('0x1a')&&typeof _0x307dd9[_0x29a6('0x1b')]===_0x29a6('0x1a');var _0x340d75=_0x4fef5c[_0x29a6('0x1c')];var _0x34b66e=_0x862659?0x0:_0x307dd9['offset'];var _0x196882=_0x862659?_0x4fef5c['count']:_0x307dd9[_0x29a6('0x19')]+_0x307dd9[_0x29a6('0x1b')];var _0xdc0ff6;if(_0x196882>=_0x340d75){_0x196882=_0x340d75;_0xdc0ff6=0xc8;}else{_0xdc0ff6=0xce;}_0x22378a['status'](_0xdc0ff6);return _0x22378a[_0x29a6('0x1d')]('Content-Range',_0x34b66e+'-'+_0x196882+'/'+_0x340d75)['json'](_0x4fef5c);}return null;};}function patchUpdates(_0x5a8d55){return function(_0x152b00){try{jsonpatch[_0x29a6('0x1e')](_0x152b00,_0x5a8d55,!![]);}catch(_0x2065be){return BPromise[_0x29a6('0x1f')](_0x2065be);}return _0x152b00[_0x29a6('0x20')]();};}function saveUpdates(_0x552bc7,_0x13341e){return function(_0xae08a5){if(_0xae08a5){return _0xae08a5[_0x29a6('0x21')](_0x552bc7)[_0x29a6('0x22')](function(_0x46fcc7){return _0x46fcc7;});}return null;};}function removeEntity(_0x2dc6c0,_0xedfa4){return function(_0x51761e){if(_0x51761e){return _0x51761e[_0x29a6('0x23')]()[_0x29a6('0x22')](function(){_0x2dc6c0[_0x29a6('0x17')](0xcc)[_0x29a6('0x24')]();});}};}function handleEntityNotFound(_0x1798dd,_0x17b835){return function(_0x364e72){if(!_0x364e72){_0x1798dd['sendStatus'](0x194);}return _0x364e72;};}function handleError(_0x483d22,_0x5a67df){_0x5a67df=_0x5a67df||0x1f4;return function(_0x1bcbf1){logger[_0x29a6('0x25')](_0x1bcbf1[_0x29a6('0x26')]);if(_0x1bcbf1[_0x29a6('0x27')]){delete _0x1bcbf1[_0x29a6('0x27')];}_0x483d22['status'](_0x5a67df)['send'](_0x1bcbf1);};}exports[_0x29a6('0x28')]=function(_0x3607b3,_0x4c5cb8){var _0x454df0={},_0x2b6b35={},_0x4fa41e={'count':0x0,'rows':[]};var _0x5a5cea=_[_0x29a6('0x29')](db[_0x29a6('0x2a')][_0x29a6('0x2b')],function(_0x4250f4){return{'name':_0x4250f4[_0x29a6('0x2c')],'type':_0x4250f4[_0x29a6('0x2d')]['key']};});_0x2b6b35['model']=_[_0x29a6('0x29')](_0x5a5cea,_0x29a6('0x27'));_0x2b6b35[_0x29a6('0x2e')]=_[_0x29a6('0x2f')](_0x3607b3[_0x29a6('0x2e')]);_0x2b6b35[_0x29a6('0x30')]=_[_0x29a6('0x31')](_0x2b6b35['model'],_0x2b6b35[_0x29a6('0x2e')]);_0x454df0[_0x29a6('0x32')]=_[_0x29a6('0x31')](_0x2b6b35[_0x29a6('0x33')],qs[_0x29a6('0x34')](_0x3607b3[_0x29a6('0x2e')][_0x29a6('0x34')]));_0x454df0[_0x29a6('0x32')]=_0x454df0[_0x29a6('0x32')]['length']?_0x454df0[_0x29a6('0x32')]:_0x2b6b35[_0x29a6('0x33')];if(!_0x3607b3[_0x29a6('0x2e')][_0x29a6('0x35')](_0x29a6('0x36'))){_0x454df0[_0x29a6('0x1b')]=qs[_0x29a6('0x1b')](_0x3607b3['query']['limit']);_0x454df0['offset']=qs[_0x29a6('0x19')](_0x3607b3[_0x29a6('0x2e')][_0x29a6('0x19')]);}_0x454df0[_0x29a6('0x37')]=qs[_0x29a6('0x38')](_0x3607b3[_0x29a6('0x2e')]['sort']);_0x454df0[_0x29a6('0x39')]=qs[_0x29a6('0x30')](_['pick'](_0x3607b3[_0x29a6('0x2e')],_0x2b6b35[_0x29a6('0x30')]),_0x5a5cea);if(_0x3607b3['query'][_0x29a6('0x3a')]){_0x454df0[_0x29a6('0x39')]=_[_0x29a6('0x3b')](_0x454df0['where'],{'$or':_[_0x29a6('0x29')](_0x5a5cea,function(_0x3c35b6){if(_0x3c35b6[_0x29a6('0x2d')]!=='VIRTUAL'){var _0x50ab51={};_0x50ab51[_0x3c35b6[_0x29a6('0x27')]]={'$like':'%'+_0x3607b3['query'][_0x29a6('0x3a')]+'%'};return _0x50ab51;}})});}_0x454df0=_[_0x29a6('0x3b')]({},_0x454df0,_0x3607b3['options']);var _0x1a428f={'where':_0x454df0[_0x29a6('0x39')]};return db[_0x29a6('0x2a')][_0x29a6('0x1c')](_0x1a428f)[_0x29a6('0x22')](function(_0xc0e144){_0x4fa41e[_0x29a6('0x1c')]=_0xc0e144;if(_0x3607b3[_0x29a6('0x2e')][_0x29a6('0x3c')]){_0x454df0[_0x29a6('0x3d')]=[{'all':!![]}];}return db[_0x29a6('0x2a')][_0x29a6('0x3e')](_0x454df0);})[_0x29a6('0x22')](function(_0x54b0b1){_0x4fa41e[_0x29a6('0x3f')]=_0x54b0b1;return _0x4fa41e;})[_0x29a6('0x22')](respondWithFilteredResult(_0x4c5cb8,_0x454df0))[_0x29a6('0x40')](handleError(_0x4c5cb8,null));};exports['show']=function(_0x3b71ad,_0x5300ee){var _0x46dc89={'raw':![],'where':{'id':_0x3b71ad[_0x29a6('0x41')]['id']}},_0x2e14af={};_0x2e14af[_0x29a6('0x33')]=_['keys'](db[_0x29a6('0x2a')][_0x29a6('0x2b')]);_0x2e14af[_0x29a6('0x2e')]=_['keys'](_0x3b71ad[_0x29a6('0x2e')]);_0x2e14af[_0x29a6('0x30')]=_['intersection'](_0x2e14af[_0x29a6('0x33')],_0x2e14af[_0x29a6('0x2e')]);_0x46dc89[_0x29a6('0x32')]=_[_0x29a6('0x31')](_0x2e14af[_0x29a6('0x33')],qs[_0x29a6('0x34')](_0x3b71ad[_0x29a6('0x2e')][_0x29a6('0x34')]));_0x46dc89[_0x29a6('0x32')]=_0x46dc89[_0x29a6('0x32')][_0x29a6('0x42')]?_0x46dc89[_0x29a6('0x32')]:_0x2e14af[_0x29a6('0x33')];if(_0x3b71ad[_0x29a6('0x2e')][_0x29a6('0x3c')]){_0x46dc89[_0x29a6('0x3d')]=[{'all':!![]}];}_0x46dc89=_['merge']({},_0x46dc89,_0x3b71ad['options']);return db['SugarcrmAccount'][_0x29a6('0x43')](_0x46dc89)['then'](handleEntityNotFound(_0x5300ee,null))[_0x29a6('0x22')](respondWithResult(_0x5300ee,null))['catch'](handleError(_0x5300ee,null));};exports['create']=function(_0x25995e,_0x57e994){return db[_0x29a6('0x2a')][_0x29a6('0x44')](_0x25995e['body'],{})[_0x29a6('0x22')](respondWithResult(_0x57e994,0xc9))[_0x29a6('0x40')](handleError(_0x57e994,null));};exports[_0x29a6('0x21')]=function(_0x477085,_0x453ba7){if(_0x477085[_0x29a6('0x45')]['id']){delete _0x477085[_0x29a6('0x45')]['id'];}return db[_0x29a6('0x2a')][_0x29a6('0x43')]({'where':{'id':_0x477085[_0x29a6('0x41')]['id']}})['then'](handleEntityNotFound(_0x453ba7,null))[_0x29a6('0x22')](saveUpdates(_0x477085[_0x29a6('0x45')],null))[_0x29a6('0x22')](respondWithResult(_0x453ba7,null))[_0x29a6('0x40')](handleError(_0x453ba7,null));};exports['destroy']=function(_0x3252cd,_0x36ce7e){return db['SugarcrmAccount']['find']({'where':{'id':_0x3252cd['params']['id']}})[_0x29a6('0x22')](handleEntityNotFound(_0x36ce7e,null))[_0x29a6('0x22')](removeEntity(_0x36ce7e,null))[_0x29a6('0x40')](handleError(_0x36ce7e,null));};exports[_0x29a6('0x46')]=function(_0x5cf8cf,_0x3c3262,_0x32327b){var _0x5af0be={};var _0x342585={};var _0x1eacb0;var _0x40f52b;return db[_0x29a6('0x2a')][_0x29a6('0x47')]({'where':{'id':_0x5cf8cf[_0x29a6('0x41')]['id']}})['then'](handleEntityNotFound(_0x3c3262,null))[_0x29a6('0x22')](function(_0x371313){if(_0x371313){_0x1eacb0=_0x371313;_0x342585['model']=_[_0x29a6('0x2f')](db['SugarcrmConfiguration'][_0x29a6('0x2b')]);_0x342585['query']=_[_0x29a6('0x2f')](_0x5cf8cf[_0x29a6('0x2e')]);_0x342585[_0x29a6('0x30')]=_[_0x29a6('0x31')](_0x342585['model'],_0x342585[_0x29a6('0x2e')]);_0x5af0be[_0x29a6('0x32')]=_[_0x29a6('0x31')](_0x342585['model'],qs['fields'](_0x5cf8cf['query']['fields']));_0x5af0be['attributes']=_0x5af0be[_0x29a6('0x32')][_0x29a6('0x42')]?_0x5af0be['attributes']:_0x342585[_0x29a6('0x33')];_0x5af0be['order']=qs[_0x29a6('0x38')](_0x5cf8cf[_0x29a6('0x2e')][_0x29a6('0x38')]);_0x5af0be[_0x29a6('0x39')]=qs[_0x29a6('0x30')](_[_0x29a6('0x48')](_0x5cf8cf[_0x29a6('0x2e')],_0x342585[_0x29a6('0x30')]));if(_0x5cf8cf[_0x29a6('0x2e')]['filter']){_0x5af0be[_0x29a6('0x39')]=_[_0x29a6('0x3b')](_0x5af0be['where'],{'$or':_[_0x29a6('0x29')](_0x5af0be[_0x29a6('0x32')],function(_0x317803){var _0x569944={};_0x569944[_0x317803]={'$like':'%'+_0x5cf8cf['query'][_0x29a6('0x3a')]+'%'};return _0x569944;})});}_0x5af0be=_[_0x29a6('0x3b')]({},_0x5af0be,_0x5cf8cf['options']);return _0x1eacb0[_0x29a6('0x46')](_0x5af0be);}})['then'](function(_0x45f503){if(_0x45f503){_0x40f52b=_0x45f503['length'];if(!_0x5cf8cf[_0x29a6('0x2e')]['hasOwnProperty']('nolimit')){_0x5af0be[_0x29a6('0x1b')]=qs[_0x29a6('0x1b')](_0x5cf8cf['query'][_0x29a6('0x1b')]);_0x5af0be['offset']=qs[_0x29a6('0x19')](_0x5cf8cf['query'][_0x29a6('0x19')]);}return _0x1eacb0['getConfigurations'](_0x5af0be);}})[_0x29a6('0x22')](function(_0x4e4b06){if(_0x4e4b06){return _0x4e4b06?{'count':_0x40f52b,'rows':_0x4e4b06}:null;}})[_0x29a6('0x22')](respondWithResult(_0x3c3262,null))[_0x29a6('0x40')](handleError(_0x3c3262,null));};exports['addConfiguration']=function(_0x290f86,_0x1f8726,_0x41a9e6){if(_0x290f86[_0x29a6('0x45')]['id']){delete _0x290f86[_0x29a6('0x45')]['id'];}return db[_0x29a6('0x2a')][_0x29a6('0x47')]({'where':{'id':_0x290f86[_0x29a6('0x41')]['id']}})[_0x29a6('0x22')](handleEntityNotFound(_0x1f8726,null))[_0x29a6('0x22')](function(_0x9d7bdc){if(_0x9d7bdc){_0x290f86[_0x29a6('0x45')][_0x29a6('0x49')]=_0x9d7bdc['id'];_0x290f86[_0x29a6('0x45')][_0x29a6('0x4a')]=integrations[_0x29a6('0x4b')](_0x290f86[_0x29a6('0x45')][_0x29a6('0x4c')],_0x290f86['body'][_0x29a6('0x2d')]);_0x290f86[_0x29a6('0x45')][_0x29a6('0x4d')]=integrations[_0x29a6('0x4e')](_0x290f86[_0x29a6('0x45')][_0x29a6('0x4c')],_0x290f86[_0x29a6('0x45')][_0x29a6('0x2d')]);return db[_0x29a6('0x4f')][_0x29a6('0x44')](_0x290f86[_0x29a6('0x45')],{'include':[{'model':db[_0x29a6('0x50')],'as':'Subjects'},{'model':db['SugarcrmField'],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x1f8726,null))['catch'](handleError(_0x1f8726,null));};exports[_0x29a6('0x51')]=function(_0x13a545,_0x27ba9a,_0x422344){var _0x27d33f='';var _0x38ad8b=['id',_0x29a6('0x27'),_0x29a6('0x52'),_0x29a6('0x53'),_0x29a6('0x54'),'date_start','duration_hours',_0x29a6('0x55'),_0x29a6('0x56'),_0x29a6('0x57'),_0x29a6('0x58'),_0x29a6('0x59')];return db[_0x29a6('0x2a')][_0x29a6('0x47')]({'where':{'id':_0x13a545[_0x29a6('0x41')]['id']},'attributes':['id',_0x29a6('0x5a'),'password',_0x29a6('0x5b')]})[_0x29a6('0x22')](handleEntityNotFound(_0x27ba9a,null))[_0x29a6('0x22')](function(_0x16b728){if(_0x16b728){_0x27d33f=_0x16b728[_0x29a6('0x5b')];var _0x4468de=_0x27d33f[_0x29a6('0x5c')](-0x1);if(_0x4468de==='/'){_0x27d33f=_0x27d33f[_0x29a6('0x5d')](0x0,_0x27d33f[_0x29a6('0x5e')](_0x4468de));}return rp({'method':_0x29a6('0x5f'),'uri':util['format'](_0x29a6('0x60'),_0x27d33f,'/service/v4_1/rest.php'),'json':!![],'form':{'method':_0x29a6('0x61'),'input_type':_0x29a6('0x62'),'response_type':'JSON','rest_data':JSON[_0x29a6('0x63')]({'user_auth':{'user_name':_0x16b728[_0x29a6('0x5a')],'password':_0x16b728[_0x29a6('0x64')],'encryption':_0x29a6('0x65')},'application':_0x29a6('0x66')})}});}})[_0x29a6('0x22')](function(_0x1302ca){if(_0x1302ca&&_0x1302ca['name']!==_0x29a6('0x67')&&_0x1302ca[_0x29a6('0x27')]!==_0x29a6('0x68')){return rp({'method':_0x29a6('0x5f'),'uri':util[_0x29a6('0x69')](_0x29a6('0x60'),_0x27d33f,_0x29a6('0x6a')),'json':!![],'form':{'method':_0x29a6('0x6b'),'input_type':'JSON','response_type':_0x29a6('0x62'),'rest_data':JSON[_0x29a6('0x63')]({'session':_0x1302ca['id'],'module_name':_0x29a6('0x6c')})}})[_0x29a6('0x22')](function(_0xb15526){if(_0xb15526){var _0x4a46d4=_['values'](_0xb15526[_0x29a6('0x6d')]);_[_0x29a6('0x6e')](_0x4a46d4,function(_0x25514c){return _0x38ad8b[_0x29a6('0x6f')](_0x25514c[_0x29a6('0x27')]);});return{'count':_0x4a46d4['length'],'rows':_['map'](_0x4a46d4,function(_0x424824){return{'id':_0x424824[_0x29a6('0x27')],'name':_0x424824[_0x29a6('0x70')],'custom':_[_0x29a6('0x71')](_0x424824[_0x29a6('0x27')],'_c')?!![]:![],'options':_0x424824[_0x29a6('0x72')]?_[_0x29a6('0x29')](_['values'](_0x424824[_0x29a6('0x72')]),function(_0xac15d8){return{'name':_0xac15d8[_0x29a6('0x73')],'value':_0xac15d8[_0x29a6('0x27')]};}):[]};})};}})['then'](respondWithResult(_0x27ba9a,null))['catch'](function(_0xff1334){var _0x4cdd42=_0x13a545['query']['test']?0x1f4:_0xff1334[_0x29a6('0x74')]||0x1f4;logger['error'](_0x29a6('0x75'),_0x29a6('0x51'),_0x4cdd42,JSON['stringify'](_0xff1334));delete _0xff1334[_0x29a6('0x27')];if(_0x4cdd42===0x191){_0x4cdd42=0x190;}_0x27ba9a[_0x29a6('0x17')](_0x4cdd42)[_0x29a6('0x76')](_0x13a545[_0x29a6('0x2e')][_0x29a6('0x77')]?{'message':_0x29a6('0x78'),'statusCode':_0xff1334[_0x29a6('0x74')]}:_0xff1334);});}else{var _0xdf41f2=0x1f4;_0x27ba9a[_0x29a6('0x17')](_0xdf41f2)['send']({'message':'Wrong\x20credentials','statusCode':0x190});}});}; \ No newline at end of file +var _0xb23a=['limit','count','set','Content-Range','json','apply','save','destroy','error','stack','name','index','map','SugarcrmAccount','rawAttributes','fieldName','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','then','includeAll','include','rows','show','params','find','catch','create','body','update','findOne','getConfigurations','AccountId','Subjects','channel','Descriptions','getDescriptions','SugarcrmConfiguration','SugarcrmField','getFields','created_by','date_start','duration_hours','duration_minutes','parent_type','parent_name','direction','username','password','remoteUri','slice','lastIndexOf','POST','format','%s%s','/service/v4_1/rest.php','login','JSON','stringify','PLAIN','Invalid\x20Login','get_module_fields','Calls','remove','includes','label','endsWith','values','value','getFields,\x20%s,\x20%s,\x20%s','send','test','Wrong\x20credentials','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined'];(function(_0x108a9e,_0x127671){var _0x1fd4b6=function(_0x2cf277){while(--_0x2cf277){_0x108a9e['push'](_0x108a9e['shift']());}};_0x1fd4b6(++_0x127671);}(_0xb23a,0xcf));var _0xab23=function(_0xcc06bb,_0x5a4d98){_0xcc06bb=_0xcc06bb-0x0;var _0x33e773=_0xb23a[_0xcc06bb];return _0x33e773;};'use strict';var emlformat=require(_0xab23('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xab23('0x1'));var rp=require(_0xab23('0x2'));var moment=require(_0xab23('0x3'));var BPromise=require(_0xab23('0x4'));var Mustache=require(_0xab23('0x5'));var util=require(_0xab23('0x6'));var path=require(_0xab23('0x7'));var sox=require(_0xab23('0x8'));var csv=require(_0xab23('0x9'));var ejs=require(_0xab23('0xa'));var fs=require('fs');var fs_extra=require(_0xab23('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xab23('0xc'));var jsforce=require(_0xab23('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xab23('0x9'));var querystring=require(_0xab23('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xab23('0xf'));var qs=require(_0xab23('0x10'));var as=require(_0xab23('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xab23('0x12'))('api');var utils=require('../../config/utils');var config=require(_0xab23('0x13'));var licenseUtil=require(_0xab23('0x14'));var db=require(_0xab23('0x15'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x2c3c9e,_0x2c7a57){_0x2c7a57=_0x2c7a57||0xcc;return function(_0x20db2c){if(_0x20db2c){return _0x2c3c9e[_0xab23('0x16')](_0x2c7a57);}return _0x2c3c9e['status'](_0x2c7a57)[_0xab23('0x17')]();};}function respondWithResult(_0x4b60a6,_0xa30c57){_0xa30c57=_0xa30c57||0xc8;return function(_0xf023bd){if(_0xf023bd){return _0x4b60a6[_0xab23('0x18')](_0xa30c57)['json'](_0xf023bd);}};}function respondWithFilteredResult(_0x51b2b6,_0x3c13b2){return function(_0x37136c){if(_0x37136c){var _0x1e1c36=typeof _0x3c13b2[_0xab23('0x19')]===_0xab23('0x1a')&&typeof _0x3c13b2[_0xab23('0x1b')]==='undefined';var _0x3ba515=_0x37136c[_0xab23('0x1c')];var _0x2f242a=_0x1e1c36?0x0:_0x3c13b2[_0xab23('0x19')];var _0x3a4ebe=_0x1e1c36?_0x37136c[_0xab23('0x1c')]:_0x3c13b2[_0xab23('0x19')]+_0x3c13b2['limit'];var _0x245800;if(_0x3a4ebe>=_0x3ba515){_0x3a4ebe=_0x3ba515;_0x245800=0xc8;}else{_0x245800=0xce;}_0x51b2b6['status'](_0x245800);return _0x51b2b6[_0xab23('0x1d')](_0xab23('0x1e'),_0x2f242a+'-'+_0x3a4ebe+'/'+_0x3ba515)[_0xab23('0x1f')](_0x37136c);}return null;};}function patchUpdates(_0x3f2308){return function(_0x1ba266){try{jsonpatch[_0xab23('0x20')](_0x1ba266,_0x3f2308,!![]);}catch(_0x1d42aa){return BPromise['reject'](_0x1d42aa);}return _0x1ba266[_0xab23('0x21')]();};}function saveUpdates(_0x50382a,_0x353af0){return function(_0x6c1e53){if(_0x6c1e53){return _0x6c1e53['update'](_0x50382a)['then'](function(_0x531083){return _0x531083;});}return null;};}function removeEntity(_0x375bc4,_0x2fb9d9){return function(_0x31a1ad){if(_0x31a1ad){return _0x31a1ad[_0xab23('0x22')]()['then'](function(){_0x375bc4[_0xab23('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3c4c7e,_0x22c865){return function(_0x2cee72){if(!_0x2cee72){_0x3c4c7e['sendStatus'](0x194);}return _0x2cee72;};}function handleError(_0x5a9e6f,_0x18b848){_0x18b848=_0x18b848||0x1f4;return function(_0xf7278d){logger[_0xab23('0x23')](_0xf7278d[_0xab23('0x24')]);if(_0xf7278d[_0xab23('0x25')]){delete _0xf7278d[_0xab23('0x25')];}_0x5a9e6f[_0xab23('0x18')](_0x18b848)['send'](_0xf7278d);};}exports[_0xab23('0x26')]=function(_0x5e5c51,_0x127d6e){var _0x24166b={},_0x10fa7={},_0x3cbc18={'count':0x0,'rows':[]};var _0x446881=_[_0xab23('0x27')](db[_0xab23('0x28')][_0xab23('0x29')],function(_0x2e610b){return{'name':_0x2e610b[_0xab23('0x2a')],'type':_0x2e610b['type'][_0xab23('0x2b')]};});_0x10fa7[_0xab23('0x2c')]=_[_0xab23('0x27')](_0x446881,_0xab23('0x25'));_0x10fa7['query']=_[_0xab23('0x2d')](_0x5e5c51[_0xab23('0x2e')]);_0x10fa7['filters']=_[_0xab23('0x2f')](_0x10fa7[_0xab23('0x2c')],_0x10fa7[_0xab23('0x2e')]);_0x24166b[_0xab23('0x30')]=_[_0xab23('0x2f')](_0x10fa7[_0xab23('0x2c')],qs[_0xab23('0x31')](_0x5e5c51[_0xab23('0x2e')][_0xab23('0x31')]));_0x24166b[_0xab23('0x30')]=_0x24166b[_0xab23('0x30')][_0xab23('0x32')]?_0x24166b[_0xab23('0x30')]:_0x10fa7[_0xab23('0x2c')];if(!_0x5e5c51[_0xab23('0x2e')][_0xab23('0x33')](_0xab23('0x34'))){_0x24166b[_0xab23('0x1b')]=qs['limit'](_0x5e5c51['query'][_0xab23('0x1b')]);_0x24166b[_0xab23('0x19')]=qs['offset'](_0x5e5c51['query']['offset']);}_0x24166b[_0xab23('0x35')]=qs[_0xab23('0x36')](_0x5e5c51[_0xab23('0x2e')][_0xab23('0x36')]);_0x24166b[_0xab23('0x37')]=qs[_0xab23('0x38')](_[_0xab23('0x39')](_0x5e5c51['query'],_0x10fa7[_0xab23('0x38')]),_0x446881);if(_0x5e5c51['query'][_0xab23('0x3a')]){_0x24166b['where']=_[_0xab23('0x3b')](_0x24166b[_0xab23('0x37')],{'$or':_[_0xab23('0x27')](_0x446881,function(_0x39451a){if(_0x39451a[_0xab23('0x3c')]!==_0xab23('0x3d')){var _0x5cdedb={};_0x5cdedb[_0x39451a[_0xab23('0x25')]]={'$like':'%'+_0x5e5c51[_0xab23('0x2e')][_0xab23('0x3a')]+'%'};return _0x5cdedb;}})});}_0x24166b=_[_0xab23('0x3b')]({},_0x24166b,_0x5e5c51[_0xab23('0x3e')]);var _0x1163ef={'where':_0x24166b['where']};return db[_0xab23('0x28')]['count'](_0x1163ef)[_0xab23('0x3f')](function(_0x299620){_0x3cbc18[_0xab23('0x1c')]=_0x299620;if(_0x5e5c51['query'][_0xab23('0x40')]){_0x24166b[_0xab23('0x41')]=[{'all':!![]}];}return db[_0xab23('0x28')]['findAll'](_0x24166b);})[_0xab23('0x3f')](function(_0x144f2){_0x3cbc18[_0xab23('0x42')]=_0x144f2;return _0x3cbc18;})[_0xab23('0x3f')](respondWithFilteredResult(_0x127d6e,_0x24166b))['catch'](handleError(_0x127d6e,null));};exports[_0xab23('0x43')]=function(_0x5ca4e7,_0xea2de9){var _0xb4710a={'raw':![],'where':{'id':_0x5ca4e7[_0xab23('0x44')]['id']}},_0x9300cb={};_0x9300cb[_0xab23('0x2c')]=_['keys'](db[_0xab23('0x28')][_0xab23('0x29')]);_0x9300cb[_0xab23('0x2e')]=_['keys'](_0x5ca4e7[_0xab23('0x2e')]);_0x9300cb[_0xab23('0x38')]=_[_0xab23('0x2f')](_0x9300cb[_0xab23('0x2c')],_0x9300cb[_0xab23('0x2e')]);_0xb4710a['attributes']=_['intersection'](_0x9300cb['model'],qs['fields'](_0x5ca4e7[_0xab23('0x2e')][_0xab23('0x31')]));_0xb4710a[_0xab23('0x30')]=_0xb4710a[_0xab23('0x30')][_0xab23('0x32')]?_0xb4710a[_0xab23('0x30')]:_0x9300cb[_0xab23('0x2c')];if(_0x5ca4e7['query'][_0xab23('0x40')]){_0xb4710a[_0xab23('0x41')]=[{'all':!![]}];}_0xb4710a=_[_0xab23('0x3b')]({},_0xb4710a,_0x5ca4e7[_0xab23('0x3e')]);return db[_0xab23('0x28')][_0xab23('0x45')](_0xb4710a)['then'](handleEntityNotFound(_0xea2de9,null))[_0xab23('0x3f')](respondWithResult(_0xea2de9,null))[_0xab23('0x46')](handleError(_0xea2de9,null));};exports[_0xab23('0x47')]=function(_0x17984d,_0x15451d){return db['SugarcrmAccount']['create'](_0x17984d[_0xab23('0x48')],{})[_0xab23('0x3f')](respondWithResult(_0x15451d,0xc9))[_0xab23('0x46')](handleError(_0x15451d,null));};exports[_0xab23('0x49')]=function(_0x324170,_0x51d8e3){if(_0x324170['body']['id']){delete _0x324170[_0xab23('0x48')]['id'];}return db['SugarcrmAccount'][_0xab23('0x45')]({'where':{'id':_0x324170[_0xab23('0x44')]['id']}})[_0xab23('0x3f')](handleEntityNotFound(_0x51d8e3,null))['then'](saveUpdates(_0x324170['body'],null))['then'](respondWithResult(_0x51d8e3,null))[_0xab23('0x46')](handleError(_0x51d8e3,null));};exports['destroy']=function(_0x1cd2ac,_0x55e483){return db[_0xab23('0x28')][_0xab23('0x45')]({'where':{'id':_0x1cd2ac[_0xab23('0x44')]['id']}})[_0xab23('0x3f')](handleEntityNotFound(_0x55e483,null))[_0xab23('0x3f')](removeEntity(_0x55e483,null))[_0xab23('0x46')](handleError(_0x55e483,null));};exports['getConfigurations']=function(_0x2f5ef7,_0x42ab3b,_0x3908aa){var _0x2e431d={};var _0x566e8f={};var _0x194b0e;var _0x5d275a;return db[_0xab23('0x28')][_0xab23('0x4a')]({'where':{'id':_0x2f5ef7['params']['id']}})['then'](handleEntityNotFound(_0x42ab3b,null))[_0xab23('0x3f')](function(_0x1bad61){if(_0x1bad61){_0x194b0e=_0x1bad61;_0x566e8f['model']=_[_0xab23('0x2d')](db['SugarcrmConfiguration']['rawAttributes']);_0x566e8f[_0xab23('0x2e')]=_['keys'](_0x2f5ef7['query']);_0x566e8f[_0xab23('0x38')]=_[_0xab23('0x2f')](_0x566e8f[_0xab23('0x2c')],_0x566e8f[_0xab23('0x2e')]);_0x2e431d[_0xab23('0x30')]=_[_0xab23('0x2f')](_0x566e8f[_0xab23('0x2c')],qs[_0xab23('0x31')](_0x2f5ef7['query'][_0xab23('0x31')]));_0x2e431d['attributes']=_0x2e431d[_0xab23('0x30')][_0xab23('0x32')]?_0x2e431d[_0xab23('0x30')]:_0x566e8f['model'];_0x2e431d[_0xab23('0x35')]=qs['sort'](_0x2f5ef7['query'][_0xab23('0x36')]);_0x2e431d[_0xab23('0x37')]=qs['filters'](_[_0xab23('0x39')](_0x2f5ef7[_0xab23('0x2e')],_0x566e8f['filters']));if(_0x2f5ef7[_0xab23('0x2e')][_0xab23('0x3a')]){_0x2e431d[_0xab23('0x37')]=_[_0xab23('0x3b')](_0x2e431d['where'],{'$or':_[_0xab23('0x27')](_0x2e431d[_0xab23('0x30')],function(_0xcf280f){var _0x49df22={};_0x49df22[_0xcf280f]={'$like':'%'+_0x2f5ef7[_0xab23('0x2e')][_0xab23('0x3a')]+'%'};return _0x49df22;})});}_0x2e431d=_['merge']({},_0x2e431d,_0x2f5ef7[_0xab23('0x3e')]);return _0x194b0e[_0xab23('0x4b')](_0x2e431d);}})[_0xab23('0x3f')](function(_0x5d81d8){if(_0x5d81d8){_0x5d275a=_0x5d81d8[_0xab23('0x32')];if(!_0x2f5ef7[_0xab23('0x2e')][_0xab23('0x33')]('nolimit')){_0x2e431d['limit']=qs['limit'](_0x2f5ef7[_0xab23('0x2e')][_0xab23('0x1b')]);_0x2e431d[_0xab23('0x19')]=qs['offset'](_0x2f5ef7[_0xab23('0x2e')]['offset']);}return _0x194b0e[_0xab23('0x4b')](_0x2e431d);}})[_0xab23('0x3f')](function(_0x4a8583){if(_0x4a8583){return _0x4a8583?{'count':_0x5d275a,'rows':_0x4a8583}:null;}})[_0xab23('0x3f')](respondWithResult(_0x42ab3b,null))[_0xab23('0x46')](handleError(_0x42ab3b,null));};exports['addConfiguration']=function(_0x56737c,_0x2d97b2,_0x1ef4b9){if(_0x56737c[_0xab23('0x48')]['id']){delete _0x56737c[_0xab23('0x48')]['id'];}return db['SugarcrmAccount'][_0xab23('0x4a')]({'where':{'id':_0x56737c[_0xab23('0x44')]['id']}})['then'](handleEntityNotFound(_0x2d97b2,null))['then'](function(_0x970dd){if(_0x970dd){_0x56737c['body'][_0xab23('0x4c')]=_0x970dd['id'];_0x56737c[_0xab23('0x48')][_0xab23('0x4d')]=integrations['getSubjects'](_0x56737c[_0xab23('0x48')][_0xab23('0x4e')],_0x56737c[_0xab23('0x48')][_0xab23('0x3c')]);_0x56737c['body'][_0xab23('0x4f')]=integrations[_0xab23('0x50')](_0x56737c[_0xab23('0x48')]['channel'],_0x56737c[_0xab23('0x48')][_0xab23('0x3c')]);return db[_0xab23('0x51')]['create'](_0x56737c[_0xab23('0x48')],{'include':[{'model':db['SugarcrmField'],'as':_0xab23('0x4d')},{'model':db[_0xab23('0x52')],'as':_0xab23('0x4f')}]});}return null;})['then'](respondWithResult(_0x2d97b2,null))[_0xab23('0x46')](handleError(_0x2d97b2,null));};exports[_0xab23('0x53')]=function(_0x568eef,_0x55fb0d,_0x465456){var _0x3a14b5='';var _0x2e3a8b=['id',_0xab23('0x25'),'assigned_user_id',_0xab23('0x54'),'description',_0xab23('0x55'),_0xab23('0x56'),_0xab23('0x57'),'parent_id',_0xab23('0x58'),_0xab23('0x59'),_0xab23('0x5a')];return db[_0xab23('0x28')]['findOne']({'where':{'id':_0x568eef[_0xab23('0x44')]['id']},'attributes':['id',_0xab23('0x5b'),_0xab23('0x5c'),_0xab23('0x5d')]})[_0xab23('0x3f')](handleEntityNotFound(_0x55fb0d,null))[_0xab23('0x3f')](function(_0x41550b){if(_0x41550b){_0x3a14b5=_0x41550b[_0xab23('0x5d')];var _0x3adf81=_0x3a14b5[_0xab23('0x5e')](-0x1);if(_0x3adf81==='/'){_0x3a14b5=_0x3a14b5['substring'](0x0,_0x3a14b5[_0xab23('0x5f')](_0x3adf81));}return rp({'method':_0xab23('0x60'),'uri':util[_0xab23('0x61')](_0xab23('0x62'),_0x3a14b5,_0xab23('0x63')),'json':!![],'form':{'method':_0xab23('0x64'),'input_type':_0xab23('0x65'),'response_type':_0xab23('0x65'),'rest_data':JSON[_0xab23('0x66')]({'user_auth':{'user_name':_0x41550b['username'],'password':_0x41550b[_0xab23('0x5c')],'encryption':_0xab23('0x67')},'application':'xCALLY\x20Motion\x20Integration'})}});}})[_0xab23('0x3f')](function(_0x44dec4){if(_0x44dec4&&_0x44dec4[_0xab23('0x25')]!==_0xab23('0x68')&&_0x44dec4[_0xab23('0x25')]!=='Password\x20Expired'){return rp({'method':'POST','uri':util['format']('%s%s',_0x3a14b5,'/service/v4_1/rest.php'),'json':!![],'form':{'method':_0xab23('0x69'),'input_type':_0xab23('0x65'),'response_type':_0xab23('0x65'),'rest_data':JSON['stringify']({'session':_0x44dec4['id'],'module_name':_0xab23('0x6a')})}})[_0xab23('0x3f')](function(_0x10131e){if(_0x10131e){var _0x19c28c=_['values'](_0x10131e['module_fields']);_[_0xab23('0x6b')](_0x19c28c,function(_0x4049a0){return _0x2e3a8b[_0xab23('0x6c')](_0x4049a0[_0xab23('0x25')]);});return{'count':_0x19c28c['length'],'rows':_[_0xab23('0x27')](_0x19c28c,function(_0x2e28c9){return{'id':_0x2e28c9['name'],'name':_0x2e28c9[_0xab23('0x6d')],'custom':_[_0xab23('0x6e')](_0x2e28c9['name'],'_c')?!![]:![],'options':_0x2e28c9[_0xab23('0x3e')]?_['map'](_[_0xab23('0x6f')](_0x2e28c9[_0xab23('0x3e')]),function(_0x37ba01){return{'name':_0x37ba01[_0xab23('0x70')],'value':_0x37ba01[_0xab23('0x25')]};}):[]};})};}})[_0xab23('0x3f')](respondWithResult(_0x55fb0d,null))[_0xab23('0x46')](function(_0x44bd19){var _0x1079b2=_0x568eef[_0xab23('0x2e')]['test']?0x1f4:_0x44bd19['statusCode']||0x1f4;logger['error'](_0xab23('0x71'),_0xab23('0x53'),_0x1079b2,JSON[_0xab23('0x66')](_0x44bd19));delete _0x44bd19[_0xab23('0x25')];if(_0x1079b2===0x191){_0x1079b2=0x190;}_0x55fb0d[_0xab23('0x18')](_0x1079b2)[_0xab23('0x72')](_0x568eef[_0xab23('0x2e')][_0xab23('0x73')]?{'message':_0xab23('0x74'),'statusCode':_0x44bd19['statusCode']}:_0x44bd19);});}else{var _0x24257c=0x1f4;_0x55fb0d[_0xab23('0x18')](_0x24257c)[_0xab23('0x72')]({'message':_0xab23('0x74'),'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 4a57095..e5403fd 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 _0x945e=['rimraf','./intSugarcrmAccount.attributes','../../components/integrations/configuration','exports','define','SugarcrmAccount','int_sugarcrm_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x945e,0xca));var _0xe945=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0x945e[_0x2d7f0e];return _0x110b07;};'use strict';var _=require(_0xe945('0x0'));var util=require(_0xe945('0x1'));var logger=require(_0xe945('0x2'))(_0xe945('0x3'));var moment=require(_0xe945('0x4'));var BPromise=require(_0xe945('0x5'));var rp=require(_0xe945('0x6'));var fs=require('fs');var path=require(_0xe945('0x7'));var rimraf=require(_0xe945('0x8'));var config=require('../../config/environment');var attributes=require(_0xe945('0x9'));var integrations=require(_0xe945('0xa'));module[_0xe945('0xb')]=function(_0x30d2a0,_0x17865e){return _0x30d2a0[_0xe945('0xc')](_0xe945('0xd'),attributes,{'tableName':_0xe945('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc4af=['bluebird','request-promise','rimraf','../../config/environment','./intSugarcrmAccount.attributes','../../components/integrations/configuration','exports','define','SugarcrmAccount','int_sugarcrm_accounts','lodash','../../config/logger','api','moment'];(function(_0x5e7da7,_0x138f0f){var _0x4c5f09=function(_0x578c31){while(--_0x578c31){_0x5e7da7['push'](_0x5e7da7['shift']());}};_0x4c5f09(++_0x138f0f);}(_0xc4af,0x88));var _0xfc4a=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0xc4af[_0x491a7f];return _0x3d8f44;};'use strict';var _=require(_0xfc4a('0x0'));var util=require('util');var logger=require(_0xfc4a('0x1'))(_0xfc4a('0x2'));var moment=require(_0xfc4a('0x3'));var BPromise=require(_0xfc4a('0x4'));var rp=require(_0xfc4a('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xfc4a('0x6'));var config=require(_0xfc4a('0x7'));var attributes=require(_0xfc4a('0x8'));var integrations=require(_0xfc4a('0x9'));module[_0xfc4a('0xa')]=function(_0x4049ce,_0x3e92b5){return _0x4049ce[_0xfc4a('0xb')](_0xfc4a('0xc'),attributes,{'tableName':_0xfc4a('0xd'),'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 2fd46b0..7fff1c9 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 _0x41c9=['GetSugarcrmAccount','SugarcrmAccount','findAll','options','raw','where','attributes','limit','include','map','model','ShowSugarcrmAccount','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','then','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','code','error','message','info','result','catch'];(function(_0x411017,_0x4a8117){var _0x2adeea=function(_0x545222){while(--_0x545222){_0x411017['push'](_0x411017['shift']());}};_0x2adeea(++_0x4a8117);}(_0x41c9,0x1b9));var _0x941c=function(_0xb620ff,_0x159a87){_0xb620ff=_0xb620ff-0x0;var _0x42601e=_0x41c9[_0xb620ff];return _0x42601e;};'use strict';var _=require('lodash');var util=require(_0x941c('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x941c('0x1'));var fs=require('fs');var Redis=require(_0x941c('0x2'));var db=require(_0x941c('0x3'))['db'];var utils=require(_0x941c('0x4'));var logger=require(_0x941c('0x5'))(_0x941c('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x941c('0x7')][_0x941c('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x395ee9,_0x2745e7,_0x129ce3){return new BPromise(function(_0x814060,_0x252ac8){return client['request'](_0x395ee9,_0x129ce3)[_0x941c('0x9')](function(_0x4434ef){logger['info'](_0x941c('0xa'),_0x2745e7,_0x941c('0xb'));logger[_0x941c('0xc')](_0x941c('0xd'),_0x2745e7,_0x941c('0xb'),JSON[_0x941c('0xe')](_0x4434ef));if(_0x4434ef['error']){if(_0x4434ef['error'][_0x941c('0xf')]===0x1f4){logger[_0x941c('0x10')](_0x941c('0xa'),_0x2745e7,_0x4434ef[_0x941c('0x10')][_0x941c('0x11')]);return _0x252ac8(_0x4434ef['error'][_0x941c('0x11')]);}logger[_0x941c('0x10')]('SugarcrmAccount,\x20%s,\x20%s',_0x2745e7,_0x4434ef[_0x941c('0x10')][_0x941c('0x11')]);return _0x814060(_0x4434ef[_0x941c('0x10')][_0x941c('0x11')]);}else{logger[_0x941c('0x12')]('SugarcrmAccount,\x20%s,\x20%s',_0x2745e7,_0x941c('0xb'));_0x814060(_0x4434ef[_0x941c('0x13')]['message']);}})[_0x941c('0x14')](function(_0x150ea8){logger[_0x941c('0x10')](_0x941c('0xa'),_0x2745e7,_0x150ea8);_0x252ac8(_0x150ea8);});});}exports[_0x941c('0x15')]=function(_0x459498){var _0x48b431=this;return new Promise(function(_0x5e739d,_0x2ee1d2){return db[_0x941c('0x16')][_0x941c('0x17')]({'raw':_0x459498[_0x941c('0x18')]?_0x459498[_0x941c('0x18')][_0x941c('0x19')]===undefined?!![]:![]:!![],'where':_0x459498[_0x941c('0x18')]?_0x459498[_0x941c('0x18')][_0x941c('0x1a')]||null:null,'attributes':_0x459498[_0x941c('0x18')]?_0x459498[_0x941c('0x18')][_0x941c('0x1b')]||null:null,'limit':_0x459498['options']?_0x459498[_0x941c('0x18')][_0x941c('0x1c')]||null:null,'include':_0x459498[_0x941c('0x18')]?_0x459498[_0x941c('0x18')][_0x941c('0x1d')]?_[_0x941c('0x1e')](_0x459498[_0x941c('0x18')][_0x941c('0x1d')],function(_0x1d245d){return{'model':db[_0x1d245d['model']],'as':_0x1d245d['as'],'attributes':_0x1d245d[_0x941c('0x1b')],'include':_0x1d245d[_0x941c('0x1d')]?_['map'](_0x1d245d['include'],function(_0x445556){return{'model':db[_0x445556[_0x941c('0x1f')]],'as':_0x445556['as'],'attributes':_0x445556[_0x941c('0x1b')],'include':_0x445556[_0x941c('0x1d')]?_[_0x941c('0x1e')](_0x445556[_0x941c('0x1d')],function(_0x265a4d){return{'model':db[_0x265a4d[_0x941c('0x1f')]],'as':_0x265a4d['as'],'attributes':_0x265a4d[_0x941c('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x941c('0x9')](function(_0x81a24a){logger[_0x941c('0x12')](_0x941c('0x15'),_0x459498);logger['debug'](_0x941c('0x15'),_0x459498,JSON[_0x941c('0xe')](_0x81a24a));_0x5e739d(_0x81a24a);})[_0x941c('0x14')](function(_0x1acb05){logger[_0x941c('0x10')]('GetSugarcrmAccount',_0x1acb05[_0x941c('0x11')],_0x459498);_0x2ee1d2(_0x48b431[_0x941c('0x10')](0x1f4,_0x1acb05[_0x941c('0x11')]));});});};exports[_0x941c('0x20')]=function(_0x23acd6){var _0x29cae6=this;return new Promise(function(_0x5c3df7,_0x2e24dd){return db[_0x941c('0x16')]['find']({'raw':_0x23acd6[_0x941c('0x18')]?_0x23acd6[_0x941c('0x18')][_0x941c('0x19')]===undefined?!![]:![]:!![],'where':_0x23acd6[_0x941c('0x18')]?_0x23acd6[_0x941c('0x18')]['where']||null:null,'attributes':_0x23acd6[_0x941c('0x18')]?_0x23acd6['options']['attributes']||null:null,'include':_0x23acd6[_0x941c('0x18')]?_0x23acd6[_0x941c('0x18')]['include']?_[_0x941c('0x1e')](_0x23acd6[_0x941c('0x18')][_0x941c('0x1d')],function(_0x12604c){return{'model':db[_0x12604c[_0x941c('0x1f')]],'as':_0x12604c['as'],'attributes':_0x12604c['attributes'],'include':_0x12604c[_0x941c('0x1d')]?_[_0x941c('0x1e')](_0x12604c[_0x941c('0x1d')],function(_0x46cc43){return{'model':db[_0x46cc43['model']],'as':_0x46cc43['as'],'attributes':_0x46cc43[_0x941c('0x1b')],'include':_0x46cc43['include']?_['map'](_0x46cc43[_0x941c('0x1d')],function(_0x1e203d){return{'model':db[_0x1e203d[_0x941c('0x1f')]],'as':_0x1e203d['as'],'attributes':_0x1e203d[_0x941c('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x941c('0x9')](function(_0x378616){logger[_0x941c('0x12')](_0x941c('0x20'),_0x23acd6);logger[_0x941c('0xc')]('ShowSugarcrmAccount',_0x23acd6,JSON[_0x941c('0xe')](_0x378616));_0x5c3df7(_0x378616);})[_0x941c('0x14')](function(_0x380c4a){logger[_0x941c('0x10')]('ShowSugarcrmAccount',_0x380c4a[_0x941c('0x11')],_0x23acd6);_0x2e24dd(_0x29cae6[_0x941c('0x10')](0x1f4,_0x380c4a[_0x941c('0x11')]));});});}; \ No newline at end of file +var _0xafd4=['util','moment','randomstring','ioredis','../../config/utils','rpc','../../config/environment','client','info','SugarcrmAccount,\x20%s,\x20%s','SugarcrmAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetSugarcrmAccount','SugarcrmAccount','options','raw','where','attributes','limit','include','map','model','then','debug','stringify','find','ShowSugarcrmAccount','lodash'];(function(_0xa4c85,_0x2b52a7){var _0x172c1f=function(_0x149473){while(--_0x149473){_0xa4c85['push'](_0xa4c85['shift']());}};_0x172c1f(++_0x2b52a7);}(_0xafd4,0x17f));var _0x4afd=function(_0x114a62,_0x16e596){_0x114a62=_0x114a62-0x0;var _0x394695=_0xafd4[_0x114a62];return _0x394695;};'use strict';var _=require(_0x4afd('0x0'));var util=require(_0x4afd('0x1'));var moment=require(_0x4afd('0x2'));var BPromise=require('bluebird');var rs=require(_0x4afd('0x3'));var fs=require('fs');var Redis=require(_0x4afd('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x4afd('0x5'));var logger=require('../../config/logger')(_0x4afd('0x6'));var config=require(_0x4afd('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x4afd('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x266fec,_0x4f115d,_0x309cac){return new BPromise(function(_0x18f66d,_0xb11a82){return client['request'](_0x266fec,_0x309cac)['then'](function(_0x47394e){logger[_0x4afd('0x9')](_0x4afd('0xa'),_0x4f115d,'request\x20sent');logger['debug'](_0x4afd('0xb'),_0x4f115d,'request\x20sent',JSON['stringify'](_0x47394e));if(_0x47394e[_0x4afd('0xc')]){if(_0x47394e['error'][_0x4afd('0xd')]===0x1f4){logger[_0x4afd('0xc')](_0x4afd('0xa'),_0x4f115d,_0x47394e[_0x4afd('0xc')][_0x4afd('0xe')]);return _0xb11a82(_0x47394e[_0x4afd('0xc')][_0x4afd('0xe')]);}logger[_0x4afd('0xc')](_0x4afd('0xa'),_0x4f115d,_0x47394e[_0x4afd('0xc')][_0x4afd('0xe')]);return _0x18f66d(_0x47394e[_0x4afd('0xc')][_0x4afd('0xe')]);}else{logger[_0x4afd('0x9')](_0x4afd('0xa'),_0x4f115d,'request\x20sent');_0x18f66d(_0x47394e[_0x4afd('0xf')][_0x4afd('0xe')]);}})[_0x4afd('0x10')](function(_0x51db8c){logger[_0x4afd('0xc')](_0x4afd('0xa'),_0x4f115d,_0x51db8c);_0xb11a82(_0x51db8c);});});}exports[_0x4afd('0x11')]=function(_0xdfb38e){var _0x1e97ac=this;return new Promise(function(_0x926f41,_0x610c3c){return db[_0x4afd('0x12')]['findAll']({'raw':_0xdfb38e[_0x4afd('0x13')]?_0xdfb38e['options'][_0x4afd('0x14')]===undefined?!![]:![]:!![],'where':_0xdfb38e['options']?_0xdfb38e[_0x4afd('0x13')][_0x4afd('0x15')]||null:null,'attributes':_0xdfb38e[_0x4afd('0x13')]?_0xdfb38e[_0x4afd('0x13')][_0x4afd('0x16')]||null:null,'limit':_0xdfb38e[_0x4afd('0x13')]?_0xdfb38e[_0x4afd('0x13')][_0x4afd('0x17')]||null:null,'include':_0xdfb38e[_0x4afd('0x13')]?_0xdfb38e[_0x4afd('0x13')][_0x4afd('0x18')]?_[_0x4afd('0x19')](_0xdfb38e['options'][_0x4afd('0x18')],function(_0x334514){return{'model':db[_0x334514['model']],'as':_0x334514['as'],'attributes':_0x334514[_0x4afd('0x16')],'include':_0x334514[_0x4afd('0x18')]?_[_0x4afd('0x19')](_0x334514[_0x4afd('0x18')],function(_0x1d24b6){return{'model':db[_0x1d24b6[_0x4afd('0x1a')]],'as':_0x1d24b6['as'],'attributes':_0x1d24b6[_0x4afd('0x16')],'include':_0x1d24b6[_0x4afd('0x18')]?_['map'](_0x1d24b6[_0x4afd('0x18')],function(_0x32403d){return{'model':db[_0x32403d['model']],'as':_0x32403d['as'],'attributes':_0x32403d[_0x4afd('0x16')]};}):[]};}):[]};}):[]:[]})[_0x4afd('0x1b')](function(_0x4316f9){logger[_0x4afd('0x9')](_0x4afd('0x11'),_0xdfb38e);logger[_0x4afd('0x1c')]('GetSugarcrmAccount',_0xdfb38e,JSON[_0x4afd('0x1d')](_0x4316f9));_0x926f41(_0x4316f9);})[_0x4afd('0x10')](function(_0x236943){logger[_0x4afd('0xc')]('GetSugarcrmAccount',_0x236943[_0x4afd('0xe')],_0xdfb38e);_0x610c3c(_0x1e97ac[_0x4afd('0xc')](0x1f4,_0x236943[_0x4afd('0xe')]));});});};exports['ShowSugarcrmAccount']=function(_0xdd56f8){var _0x360e8b=this;return new Promise(function(_0x567742,_0x16c3c3){return db['SugarcrmAccount'][_0x4afd('0x1e')]({'raw':_0xdd56f8[_0x4afd('0x13')]?_0xdd56f8['options'][_0x4afd('0x14')]===undefined?!![]:![]:!![],'where':_0xdd56f8[_0x4afd('0x13')]?_0xdd56f8[_0x4afd('0x13')]['where']||null:null,'attributes':_0xdd56f8[_0x4afd('0x13')]?_0xdd56f8[_0x4afd('0x13')]['attributes']||null:null,'include':_0xdd56f8[_0x4afd('0x13')]?_0xdd56f8[_0x4afd('0x13')]['include']?_[_0x4afd('0x19')](_0xdd56f8[_0x4afd('0x13')][_0x4afd('0x18')],function(_0x2123ad){return{'model':db[_0x2123ad[_0x4afd('0x1a')]],'as':_0x2123ad['as'],'attributes':_0x2123ad[_0x4afd('0x16')],'include':_0x2123ad['include']?_[_0x4afd('0x19')](_0x2123ad[_0x4afd('0x18')],function(_0x59de04){return{'model':db[_0x59de04[_0x4afd('0x1a')]],'as':_0x59de04['as'],'attributes':_0x59de04[_0x4afd('0x16')],'include':_0x59de04['include']?_[_0x4afd('0x19')](_0x59de04['include'],function(_0x50860a){return{'model':db[_0x50860a[_0x4afd('0x1a')]],'as':_0x50860a['as'],'attributes':_0x50860a['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0xfaa2f8){logger[_0x4afd('0x9')](_0x4afd('0x1f'),_0xdd56f8);logger[_0x4afd('0x1c')](_0x4afd('0x1f'),_0xdd56f8,JSON[_0x4afd('0x1d')](_0xfaa2f8));_0x567742(_0xfaa2f8);})['catch'](function(_0x2febb9){logger[_0x4afd('0xc')]('ShowSugarcrmAccount',_0x2febb9['message'],_0xdd56f8);_0x16c3c3(_0x360e8b[_0x4afd('0xc')](0x1f4,_0x2febb9[_0x4afd('0xe')]));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index 3efcfb0..25a0ca4 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 _0x3e38=['put','update','delete','destroy','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmConfiguration.controller','get','/:id','isAuthenticated','getFields','/:id/subjects','getSubjects','getDescriptions','post','create'];(function(_0x5d5016,_0x2f3401){var _0x48e695=function(_0x15582e){while(--_0x15582e){_0x5d5016['push'](_0x5d5016['shift']());}};_0x48e695(++_0x2f3401);}(_0x3e38,0x174));var _0x83e3=function(_0x23741f,_0x223d52){_0x23741f=_0x23741f-0x0;var _0x3ef43e=_0x3e38[_0x23741f];return _0x3ef43e;};'use strict';var multer=require(_0x83e3('0x0'));var util=require(_0x83e3('0x1'));var path=require(_0x83e3('0x2'));var timeout=require('connect-timeout');var express=require(_0x83e3('0x3'));var router=express[_0x83e3('0x4')]();var fs_extra=require(_0x83e3('0x5'));var auth=require(_0x83e3('0x6'));var interaction=require(_0x83e3('0x7'));var config=require(_0x83e3('0x8'));var controller=require(_0x83e3('0x9'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x83e3('0xa')](_0x83e3('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x83e3('0xa')]('/:id/fields',auth[_0x83e3('0xc')](),controller[_0x83e3('0xd')]);router[_0x83e3('0xa')](_0x83e3('0xe'),auth['isAuthenticated'](),controller[_0x83e3('0xf')]);router[_0x83e3('0xa')]('/:id/descriptions',auth[_0x83e3('0xc')](),controller[_0x83e3('0x10')]);router[_0x83e3('0x11')]('/',auth[_0x83e3('0xc')](),controller[_0x83e3('0x12')]);router[_0x83e3('0x13')](_0x83e3('0xb'),auth['isAuthenticated'](),controller[_0x83e3('0x14')]);router[_0x83e3('0x15')](_0x83e3('0xb'),auth[_0x83e3('0xc')](),controller[_0x83e3('0x16')]);module['exports']=router; \ No newline at end of file +var _0x465b=['../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','/:id','show','get','/:id/fields','getFields','/:id/descriptions','getDescriptions','post','create','put','destroy','exports','multer','connect-timeout','express','Router','fs-extra'];(function(_0x36c5b0,_0x5001da){var _0xf19333=function(_0x1e880a){while(--_0x1e880a){_0x36c5b0['push'](_0x36c5b0['shift']());}};_0xf19333(++_0x5001da);}(_0x465b,0x187));var _0xb465=function(_0x29481b,_0x3110d2){_0x29481b=_0x29481b-0x0;var _0x558d3e=_0x465b[_0x29481b];return _0x558d3e;};'use strict';var multer=require(_0xb465('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xb465('0x1'));var express=require(_0xb465('0x2'));var router=express[_0xb465('0x3')]();var fs_extra=require(_0xb465('0x4'));var auth=require(_0xb465('0x5'));var interaction=require(_0xb465('0x6'));var config=require(_0xb465('0x7'));var controller=require('./intSugarcrmConfiguration.controller');router['get']('/',auth[_0xb465('0x8')](),controller[_0xb465('0x9')]);router['get'](_0xb465('0xa'),auth[_0xb465('0x8')](),controller[_0xb465('0xb')]);router[_0xb465('0xc')](_0xb465('0xd'),auth[_0xb465('0x8')](),controller[_0xb465('0xe')]);router[_0xb465('0xc')]('/:id/subjects',auth[_0xb465('0x8')](),controller['getSubjects']);router['get'](_0xb465('0xf'),auth['isAuthenticated'](),controller[_0xb465('0x10')]);router[_0xb465('0x11')]('/',auth[_0xb465('0x8')](),controller[_0xb465('0x12')]);router[_0xb465('0x13')](_0xb465('0xa'),auth[_0xb465('0x8')](),controller['update']);router['delete'](_0xb465('0xa'),auth[_0xb465('0x8')](),controller[_0xb465('0x14')]);module[_0xb465('0x15')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js index 363bcd3..75ce722 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 _0x53a8=['STRING','exports'];(function(_0x38c652,_0x1ea1b7){var _0x218a37=function(_0x5dcb2a){while(--_0x5dcb2a){_0x38c652['push'](_0x38c652['shift']());}};_0x218a37(++_0x1ea1b7);}(_0x53a8,0x8b));var _0x853a=function(_0x214cc0,_0x2dd82d){_0x214cc0=_0x214cc0-0x0;var _0x597499=_0x53a8[_0x214cc0];return _0x597499;};'use strict';var Sequelize=require('sequelize');module[_0x853a('0x0')]={'name':{'type':Sequelize[_0x853a('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xbca8=['exports','STRING','sequelize'];(function(_0x524e5e,_0x4b0590){var _0xe7a0fe=function(_0x39558d){while(--_0x39558d){_0x524e5e['push'](_0x524e5e['shift']());}};_0xe7a0fe(++_0x4b0590);}(_0xbca8,0x191));var _0x8bca=function(_0x1e35f2,_0x5f4559){_0x1e35f2=_0x1e35f2-0x0;var _0x711264=_0xbca8[_0x1e35f2];return _0x711264;};'use strict';var Sequelize=require(_0x8bca('0x0'));module[_0x8bca('0x1')]={'name':{'type':Sequelize[_0x8bca('0x2')]},'description':{'type':Sequelize[_0x8bca('0x2')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index e89abe1..30e749e 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 _0x18ad=['key','model','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','filter','VIRTUAL','merge','includeAll','include','findAll','rows','catch','show','options','find','create','body','update','params','findOne','SugarcrmField','getFields','getSubjects','pick','nolimit','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','offset','limit','undefined','count','set','json','apply','reject','destroy','then','error','stack','name','send','index','SugarcrmConfiguration','rawAttributes','type'];(function(_0x4ce028,_0x526d4b){var _0x583d0c=function(_0x874178){while(--_0x874178){_0x4ce028['push'](_0x4ce028['shift']());}};_0x583d0c(++_0x526d4b);}(_0x18ad,0x74));var _0xd18a=function(_0x4e2148,_0x382a2c){_0x4e2148=_0x4e2148-0x0;var _0x323345=_0x18ad[_0x4e2148];return _0x323345;};'use strict';var emlformat=require(_0xd18a('0x0'));var rimraf=require(_0xd18a('0x1'));var zipdir=require(_0xd18a('0x2'));var jsonpatch=require(_0xd18a('0x3'));var rp=require(_0xd18a('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xd18a('0x5'));var util=require(_0xd18a('0x6'));var path=require('path');var sox=require(_0xd18a('0x7'));var csv=require(_0xd18a('0x8'));var ejs=require(_0xd18a('0x9'));var fs=require('fs');var fs_extra=require(_0xd18a('0xa'));var _=require(_0xd18a('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xd18a('0xc'));var deskjs=require(_0xd18a('0xd'));var toCsv=require(_0xd18a('0x8'));var querystring=require(_0xd18a('0xe'));var Papa=require(_0xd18a('0xf'));var Redis=require(_0xd18a('0x10'));var authService=require(_0xd18a('0x11'));var qs=require(_0xd18a('0x12'));var as=require(_0xd18a('0x13'));var hardwareService=require(_0xd18a('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0xd18a('0x15'));var config=require(_0xd18a('0x16'));var licenseUtil=require(_0xd18a('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1154bb,_0x1e8300){_0x1e8300=_0x1e8300||0xcc;return function(_0x5ecd0c){if(_0x5ecd0c){return _0x1154bb[_0xd18a('0x18')](_0x1e8300);}return _0x1154bb['status'](_0x1e8300)['end']();};}function respondWithResult(_0x32c78a,_0x5e9cbc){_0x5e9cbc=_0x5e9cbc||0xc8;return function(_0x1ca0f0){if(_0x1ca0f0){return _0x32c78a[_0xd18a('0x19')](_0x5e9cbc)['json'](_0x1ca0f0);}};}function respondWithFilteredResult(_0xdbb971,_0xf29d6c){return function(_0x4e0432){if(_0x4e0432){var _0x485841=typeof _0xf29d6c[_0xd18a('0x1a')]==='undefined'&&typeof _0xf29d6c[_0xd18a('0x1b')]===_0xd18a('0x1c');var _0x420732=_0x4e0432[_0xd18a('0x1d')];var _0x4b1ef0=_0x485841?0x0:_0xf29d6c[_0xd18a('0x1a')];var _0x155a78=_0x485841?_0x4e0432[_0xd18a('0x1d')]:_0xf29d6c[_0xd18a('0x1a')]+_0xf29d6c[_0xd18a('0x1b')];var _0x23a0e7;if(_0x155a78>=_0x420732){_0x155a78=_0x420732;_0x23a0e7=0xc8;}else{_0x23a0e7=0xce;}_0xdbb971[_0xd18a('0x19')](_0x23a0e7);return _0xdbb971[_0xd18a('0x1e')]('Content-Range',_0x4b1ef0+'-'+_0x155a78+'/'+_0x420732)[_0xd18a('0x1f')](_0x4e0432);}return null;};}function patchUpdates(_0x524923){return function(_0x4d6313){try{jsonpatch[_0xd18a('0x20')](_0x4d6313,_0x524923,!![]);}catch(_0x15d7ca){return BPromise[_0xd18a('0x21')](_0x15d7ca);}return _0x4d6313['save']();};}function saveUpdates(_0x1d0fcb,_0x3f5e3c){return function(_0x5be998){if(_0x5be998){return _0x5be998['update'](_0x1d0fcb)['then'](function(_0x1751df){return _0x1751df;});}return null;};}function removeEntity(_0x2c979d,_0x218d22){return function(_0x24274a){if(_0x24274a){return _0x24274a[_0xd18a('0x22')]()[_0xd18a('0x23')](function(){_0x2c979d[_0xd18a('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x186cbb,_0x223a4d){return function(_0x587010){if(!_0x587010){_0x186cbb[_0xd18a('0x18')](0x194);}return _0x587010;};}function handleError(_0x5317fb,_0x56d883){_0x56d883=_0x56d883||0x1f4;return function(_0x4c4063){logger[_0xd18a('0x24')](_0x4c4063[_0xd18a('0x25')]);if(_0x4c4063[_0xd18a('0x26')]){delete _0x4c4063[_0xd18a('0x26')];}_0x5317fb[_0xd18a('0x19')](_0x56d883)[_0xd18a('0x27')](_0x4c4063);};}exports[_0xd18a('0x28')]=function(_0xad62ca,_0x19ae9b){var _0xf315e0={},_0x3e9079={},_0x131b97={'count':0x0,'rows':[]};var _0x2ed298=_['map'](db[_0xd18a('0x29')][_0xd18a('0x2a')],function(_0x5316bf){return{'name':_0x5316bf['fieldName'],'type':_0x5316bf[_0xd18a('0x2b')][_0xd18a('0x2c')]};});_0x3e9079[_0xd18a('0x2d')]=_[_0xd18a('0x2e')](_0x2ed298,_0xd18a('0x26'));_0x3e9079[_0xd18a('0x2f')]=_[_0xd18a('0x30')](_0xad62ca[_0xd18a('0x2f')]);_0x3e9079[_0xd18a('0x31')]=_['intersection'](_0x3e9079[_0xd18a('0x2d')],_0x3e9079[_0xd18a('0x2f')]);_0xf315e0[_0xd18a('0x32')]=_[_0xd18a('0x33')](_0x3e9079['model'],qs[_0xd18a('0x34')](_0xad62ca[_0xd18a('0x2f')][_0xd18a('0x34')]));_0xf315e0[_0xd18a('0x32')]=_0xf315e0['attributes'][_0xd18a('0x35')]?_0xf315e0[_0xd18a('0x32')]:_0x3e9079[_0xd18a('0x2d')];if(!_0xad62ca[_0xd18a('0x2f')][_0xd18a('0x36')]('nolimit')){_0xf315e0[_0xd18a('0x1b')]=qs[_0xd18a('0x1b')](_0xad62ca[_0xd18a('0x2f')][_0xd18a('0x1b')]);_0xf315e0['offset']=qs[_0xd18a('0x1a')](_0xad62ca[_0xd18a('0x2f')][_0xd18a('0x1a')]);}_0xf315e0[_0xd18a('0x37')]=qs['sort'](_0xad62ca['query'][_0xd18a('0x38')]);_0xf315e0[_0xd18a('0x39')]=qs[_0xd18a('0x31')](_['pick'](_0xad62ca[_0xd18a('0x2f')],_0x3e9079[_0xd18a('0x31')]),_0x2ed298);if(_0xad62ca[_0xd18a('0x2f')][_0xd18a('0x3a')]){_0xf315e0[_0xd18a('0x39')]=_['merge'](_0xf315e0[_0xd18a('0x39')],{'$or':_['map'](_0x2ed298,function(_0x3ebc1b){if(_0x3ebc1b[_0xd18a('0x2b')]!==_0xd18a('0x3b')){var _0x139e8c={};_0x139e8c[_0x3ebc1b['name']]={'$like':'%'+_0xad62ca['query'][_0xd18a('0x3a')]+'%'};return _0x139e8c;}})});}_0xf315e0=_[_0xd18a('0x3c')]({},_0xf315e0,_0xad62ca['options']);var _0x5e5452={'where':_0xf315e0[_0xd18a('0x39')]};return db[_0xd18a('0x29')][_0xd18a('0x1d')](_0x5e5452)[_0xd18a('0x23')](function(_0x175295){_0x131b97[_0xd18a('0x1d')]=_0x175295;if(_0xad62ca[_0xd18a('0x2f')][_0xd18a('0x3d')]){_0xf315e0[_0xd18a('0x3e')]=[{'all':!![]}];}return db[_0xd18a('0x29')][_0xd18a('0x3f')](_0xf315e0);})[_0xd18a('0x23')](function(_0x2af5a9){_0x131b97[_0xd18a('0x40')]=_0x2af5a9;return _0x131b97;})[_0xd18a('0x23')](respondWithFilteredResult(_0x19ae9b,_0xf315e0))[_0xd18a('0x41')](handleError(_0x19ae9b,null));};exports[_0xd18a('0x42')]=function(_0x935ff1,_0x1cf7ad){var _0x138832={'raw':![],'where':{'id':_0x935ff1['params']['id']}},_0x3bf232={};_0x3bf232[_0xd18a('0x2d')]=_[_0xd18a('0x30')](db['SugarcrmConfiguration'][_0xd18a('0x2a')]);_0x3bf232[_0xd18a('0x2f')]=_['keys'](_0x935ff1[_0xd18a('0x2f')]);_0x3bf232[_0xd18a('0x31')]=_[_0xd18a('0x33')](_0x3bf232[_0xd18a('0x2d')],_0x3bf232[_0xd18a('0x2f')]);_0x138832[_0xd18a('0x32')]=_[_0xd18a('0x33')](_0x3bf232[_0xd18a('0x2d')],qs[_0xd18a('0x34')](_0x935ff1['query'][_0xd18a('0x34')]));_0x138832['attributes']=_0x138832[_0xd18a('0x32')][_0xd18a('0x35')]?_0x138832[_0xd18a('0x32')]:_0x3bf232['model'];if(_0x935ff1[_0xd18a('0x2f')][_0xd18a('0x3d')]){_0x138832['include']=[{'all':!![]}];}_0x138832=_[_0xd18a('0x3c')]({},_0x138832,_0x935ff1[_0xd18a('0x43')]);return db[_0xd18a('0x29')][_0xd18a('0x44')](_0x138832)[_0xd18a('0x23')](handleEntityNotFound(_0x1cf7ad,null))[_0xd18a('0x23')](respondWithResult(_0x1cf7ad,null))['catch'](handleError(_0x1cf7ad,null));};exports[_0xd18a('0x45')]=function(_0x349587,_0x3445d1){return db[_0xd18a('0x29')][_0xd18a('0x45')](_0x349587[_0xd18a('0x46')],{})[_0xd18a('0x23')](respondWithResult(_0x3445d1,0xc9))[_0xd18a('0x41')](handleError(_0x3445d1,null));};exports[_0xd18a('0x47')]=function(_0x24ca40,_0x48c457){if(_0x24ca40[_0xd18a('0x46')]['id']){delete _0x24ca40['body']['id'];}return db['SugarcrmConfiguration'][_0xd18a('0x44')]({'where':{'id':_0x24ca40[_0xd18a('0x48')]['id']}})['then'](handleEntityNotFound(_0x48c457,null))[_0xd18a('0x23')](saveUpdates(_0x24ca40[_0xd18a('0x46')],null))[_0xd18a('0x23')](respondWithResult(_0x48c457,null))[_0xd18a('0x41')](handleError(_0x48c457,null));};exports[_0xd18a('0x22')]=function(_0x1f309e,_0xbbec57){return db['SugarcrmConfiguration']['find']({'where':{'id':_0x1f309e[_0xd18a('0x48')]['id']}})['then'](handleEntityNotFound(_0xbbec57,null))[_0xd18a('0x23')](removeEntity(_0xbbec57,null))['catch'](handleError(_0xbbec57,null));};exports['getFields']=function(_0x523170,_0x30d7ad,_0x31b981){var _0x3096db={};var _0x2acbc6={};var _0x12ddb9;var _0x5e6e15;return db[_0xd18a('0x29')][_0xd18a('0x49')]({'where':{'id':_0x523170['params']['id']}})[_0xd18a('0x23')](handleEntityNotFound(_0x30d7ad,null))[_0xd18a('0x23')](function(_0x12c9f7){if(_0x12c9f7){_0x12ddb9=_0x12c9f7;_0x2acbc6[_0xd18a('0x2d')]=_[_0xd18a('0x30')](db[_0xd18a('0x4a')][_0xd18a('0x2a')]);_0x2acbc6['query']=_[_0xd18a('0x30')](_0x523170[_0xd18a('0x2f')]);_0x2acbc6[_0xd18a('0x31')]=_[_0xd18a('0x33')](_0x2acbc6[_0xd18a('0x2d')],_0x2acbc6[_0xd18a('0x2f')]);_0x3096db[_0xd18a('0x32')]=_[_0xd18a('0x33')](_0x2acbc6[_0xd18a('0x2d')],qs[_0xd18a('0x34')](_0x523170[_0xd18a('0x2f')][_0xd18a('0x34')]));_0x3096db[_0xd18a('0x32')]=_0x3096db[_0xd18a('0x32')][_0xd18a('0x35')]?_0x3096db[_0xd18a('0x32')]:_0x2acbc6[_0xd18a('0x2d')];_0x3096db[_0xd18a('0x37')]=qs[_0xd18a('0x38')](_0x523170[_0xd18a('0x2f')]['sort']);_0x3096db[_0xd18a('0x39')]=qs['filters'](_['pick'](_0x523170[_0xd18a('0x2f')],_0x2acbc6[_0xd18a('0x31')]));if(_0x523170[_0xd18a('0x2f')][_0xd18a('0x3a')]){_0x3096db[_0xd18a('0x39')]=_[_0xd18a('0x3c')](_0x3096db[_0xd18a('0x39')],{'$or':_['map'](_0x3096db[_0xd18a('0x32')],function(_0xb896f7){var _0x5c99b3={};_0x5c99b3[_0xb896f7]={'$like':'%'+_0x523170[_0xd18a('0x2f')][_0xd18a('0x3a')]+'%'};return _0x5c99b3;})});}_0x3096db=_[_0xd18a('0x3c')]({},_0x3096db,_0x523170[_0xd18a('0x43')]);return _0x12ddb9[_0xd18a('0x4b')](_0x3096db);}})[_0xd18a('0x23')](function(_0x3fb351){if(_0x3fb351){_0x5e6e15=_0x3fb351[_0xd18a('0x35')];if(!_0x523170[_0xd18a('0x2f')][_0xd18a('0x36')]('nolimit')){_0x3096db[_0xd18a('0x1b')]=qs[_0xd18a('0x1b')](_0x523170[_0xd18a('0x2f')][_0xd18a('0x1b')]);_0x3096db['offset']=qs[_0xd18a('0x1a')](_0x523170[_0xd18a('0x2f')][_0xd18a('0x1a')]);}return _0x12ddb9[_0xd18a('0x4b')](_0x3096db);}})[_0xd18a('0x23')](function(_0xc0389b){if(_0xc0389b){return _0xc0389b?{'count':_0x5e6e15,'rows':_0xc0389b}:null;}})[_0xd18a('0x23')](respondWithResult(_0x30d7ad,null))[_0xd18a('0x41')](handleError(_0x30d7ad,null));};exports[_0xd18a('0x4c')]=function(_0x2d90a4,_0x3f7e77,_0x424cf3){var _0x39f40a={};var _0x418e33={};var _0x565b76;var _0x400fef;return db[_0xd18a('0x29')][_0xd18a('0x49')]({'where':{'id':_0x2d90a4[_0xd18a('0x48')]['id']}})[_0xd18a('0x23')](handleEntityNotFound(_0x3f7e77,null))[_0xd18a('0x23')](function(_0x12e9db){if(_0x12e9db){_0x565b76=_0x12e9db;_0x418e33[_0xd18a('0x2d')]=_[_0xd18a('0x30')](db['SugarcrmField']['rawAttributes']);_0x418e33[_0xd18a('0x2f')]=_[_0xd18a('0x30')](_0x2d90a4[_0xd18a('0x2f')]);_0x418e33[_0xd18a('0x31')]=_[_0xd18a('0x33')](_0x418e33[_0xd18a('0x2d')],_0x418e33[_0xd18a('0x2f')]);_0x39f40a[_0xd18a('0x32')]=_[_0xd18a('0x33')](_0x418e33[_0xd18a('0x2d')],qs['fields'](_0x2d90a4[_0xd18a('0x2f')]['fields']));_0x39f40a[_0xd18a('0x32')]=_0x39f40a[_0xd18a('0x32')][_0xd18a('0x35')]?_0x39f40a['attributes']:_0x418e33['model'];_0x39f40a['order']=qs[_0xd18a('0x38')](_0x2d90a4[_0xd18a('0x2f')]['sort']);_0x39f40a[_0xd18a('0x39')]=qs['filters'](_[_0xd18a('0x4d')](_0x2d90a4[_0xd18a('0x2f')],_0x418e33[_0xd18a('0x31')]));if(_0x2d90a4[_0xd18a('0x2f')][_0xd18a('0x3a')]){_0x39f40a[_0xd18a('0x39')]=_['merge'](_0x39f40a['where'],{'$or':_[_0xd18a('0x2e')](_0x39f40a['attributes'],function(_0x479bd1){var _0x2d8455={};_0x2d8455[_0x479bd1]={'$like':'%'+_0x2d90a4[_0xd18a('0x2f')][_0xd18a('0x3a')]+'%'};return _0x2d8455;})});}_0x39f40a=_['merge']({},_0x39f40a,_0x2d90a4['options']);return _0x565b76[_0xd18a('0x4c')](_0x39f40a);}})[_0xd18a('0x23')](function(_0x46ade0){if(_0x46ade0){_0x400fef=_0x46ade0['length'];if(!_0x2d90a4[_0xd18a('0x2f')][_0xd18a('0x36')](_0xd18a('0x4e'))){_0x39f40a['limit']=qs[_0xd18a('0x1b')](_0x2d90a4[_0xd18a('0x2f')][_0xd18a('0x1b')]);_0x39f40a['offset']=qs['offset'](_0x2d90a4[_0xd18a('0x2f')][_0xd18a('0x1a')]);}return _0x565b76[_0xd18a('0x4c')](_0x39f40a);}})[_0xd18a('0x23')](function(_0x32d92e){if(_0x32d92e){return _0x32d92e?{'count':_0x400fef,'rows':_0x32d92e}:null;}})[_0xd18a('0x23')](respondWithResult(_0x3f7e77,null))[_0xd18a('0x41')](handleError(_0x3f7e77,null));};exports[_0xd18a('0x4f')]=function(_0x4fe9b6,_0x5a60bf,_0x138f0c){var _0x20fef8={};var _0x52507f={};var _0x4bdd4b;var _0x561560;return db[_0xd18a('0x29')][_0xd18a('0x49')]({'where':{'id':_0x4fe9b6[_0xd18a('0x48')]['id']}})[_0xd18a('0x23')](handleEntityNotFound(_0x5a60bf,null))[_0xd18a('0x23')](function(_0x4dd763){if(_0x4dd763){_0x4bdd4b=_0x4dd763;_0x52507f[_0xd18a('0x2d')]=_['keys'](db[_0xd18a('0x4a')][_0xd18a('0x2a')]);_0x52507f[_0xd18a('0x2f')]=_[_0xd18a('0x30')](_0x4fe9b6[_0xd18a('0x2f')]);_0x52507f[_0xd18a('0x31')]=_[_0xd18a('0x33')](_0x52507f[_0xd18a('0x2d')],_0x52507f['query']);_0x20fef8[_0xd18a('0x32')]=_['intersection'](_0x52507f[_0xd18a('0x2d')],qs[_0xd18a('0x34')](_0x4fe9b6[_0xd18a('0x2f')]['fields']));_0x20fef8['attributes']=_0x20fef8[_0xd18a('0x32')]['length']?_0x20fef8[_0xd18a('0x32')]:_0x52507f['model'];_0x20fef8[_0xd18a('0x37')]=qs['sort'](_0x4fe9b6[_0xd18a('0x2f')][_0xd18a('0x38')]);_0x20fef8[_0xd18a('0x39')]=qs[_0xd18a('0x31')](_[_0xd18a('0x4d')](_0x4fe9b6[_0xd18a('0x2f')],_0x52507f['filters']));if(_0x4fe9b6['query']['filter']){_0x20fef8[_0xd18a('0x39')]=_['merge'](_0x20fef8['where'],{'$or':_[_0xd18a('0x2e')](_0x20fef8[_0xd18a('0x32')],function(_0x37752c){var _0x12f462={};_0x12f462[_0x37752c]={'$like':'%'+_0x4fe9b6[_0xd18a('0x2f')][_0xd18a('0x3a')]+'%'};return _0x12f462;})});}_0x20fef8=_[_0xd18a('0x3c')]({},_0x20fef8,_0x4fe9b6[_0xd18a('0x43')]);return _0x4bdd4b[_0xd18a('0x4f')](_0x20fef8);}})['then'](function(_0x3588b2){if(_0x3588b2){_0x561560=_0x3588b2[_0xd18a('0x35')];if(!_0x4fe9b6[_0xd18a('0x2f')]['hasOwnProperty'](_0xd18a('0x4e'))){_0x20fef8['limit']=qs[_0xd18a('0x1b')](_0x4fe9b6['query']['limit']);_0x20fef8[_0xd18a('0x1a')]=qs['offset'](_0x4fe9b6[_0xd18a('0x2f')][_0xd18a('0x1a')]);}return _0x4bdd4b[_0xd18a('0x4f')](_0x20fef8);}})[_0xd18a('0x23')](function(_0x470a1b){if(_0x470a1b){return _0x470a1b?{'count':_0x561560,'rows':_0x470a1b}:null;}})['then'](respondWithResult(_0x5a60bf,null))[_0xd18a('0x41')](handleError(_0x5a60bf,null));}; \ No newline at end of file +var _0xfaf1=['filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','where','pick','filter','merge','VIRTUAL','options','findAll','rows','catch','params','include','find','create','body','destroy','getFields','findOne','SugarcrmField','rawAttributes','sort','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','sendStatus','error','stack','name','index','map','SugarcrmConfiguration','fieldName','type','key','query','keys'];(function(_0x31a6b1,_0x7c3be1){var _0x8c77f5=function(_0x35b0d7){while(--_0x35b0d7){_0x31a6b1['push'](_0x31a6b1['shift']());}};_0x8c77f5(++_0x7c3be1);}(_0xfaf1,0x118));var _0x1faf=function(_0x2f9fcf,_0x410581){_0x2f9fcf=_0x2f9fcf-0x0;var _0x49b38f=_0xfaf1[_0x2f9fcf];return _0x49b38f;};'use strict';var emlformat=require(_0x1faf('0x0'));var rimraf=require(_0x1faf('0x1'));var zipdir=require(_0x1faf('0x2'));var jsonpatch=require(_0x1faf('0x3'));var rp=require(_0x1faf('0x4'));var moment=require(_0x1faf('0x5'));var BPromise=require(_0x1faf('0x6'));var Mustache=require('mustache');var util=require(_0x1faf('0x7'));var path=require('path');var sox=require(_0x1faf('0x8'));var csv=require(_0x1faf('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1faf('0xa'));var _=require(_0x1faf('0xb'));var squel=require(_0x1faf('0xc'));var crypto=require(_0x1faf('0xd'));var jsforce=require(_0x1faf('0xe'));var deskjs=require(_0x1faf('0xf'));var toCsv=require(_0x1faf('0x9'));var querystring=require(_0x1faf('0x10'));var Papa=require(_0x1faf('0x11'));var Redis=require(_0x1faf('0x12'));var authService=require(_0x1faf('0x13'));var qs=require(_0x1faf('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1faf('0x15'));var logger=require(_0x1faf('0x16'))(_0x1faf('0x17'));var utils=require(_0x1faf('0x18'));var config=require(_0x1faf('0x19'));var licenseUtil=require(_0x1faf('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1e0c1e,_0x4f6060){_0x4f6060=_0x4f6060||0xcc;return function(_0x55bfc3){if(_0x55bfc3){return _0x1e0c1e['sendStatus'](_0x4f6060);}return _0x1e0c1e[_0x1faf('0x1b')](_0x4f6060)[_0x1faf('0x1c')]();};}function respondWithResult(_0x2c2ae9,_0x164268){_0x164268=_0x164268||0xc8;return function(_0x90f818){if(_0x90f818){return _0x2c2ae9['status'](_0x164268)[_0x1faf('0x1d')](_0x90f818);}};}function respondWithFilteredResult(_0x52bdc2,_0x10a991){return function(_0x10b94f){if(_0x10b94f){var _0x191819=typeof _0x10a991[_0x1faf('0x1e')]===_0x1faf('0x1f')&&typeof _0x10a991[_0x1faf('0x20')]===_0x1faf('0x1f');var _0x20c5f2=_0x10b94f[_0x1faf('0x21')];var _0x2abff1=_0x191819?0x0:_0x10a991[_0x1faf('0x1e')];var _0x40d83f=_0x191819?_0x10b94f[_0x1faf('0x21')]:_0x10a991[_0x1faf('0x1e')]+_0x10a991[_0x1faf('0x20')];var _0x1f9220;if(_0x40d83f>=_0x20c5f2){_0x40d83f=_0x20c5f2;_0x1f9220=0xc8;}else{_0x1f9220=0xce;}_0x52bdc2[_0x1faf('0x1b')](_0x1f9220);return _0x52bdc2[_0x1faf('0x22')](_0x1faf('0x23'),_0x2abff1+'-'+_0x40d83f+'/'+_0x20c5f2)[_0x1faf('0x1d')](_0x10b94f);}return null;};}function patchUpdates(_0x560055){return function(_0x4648f1){try{jsonpatch[_0x1faf('0x24')](_0x4648f1,_0x560055,!![]);}catch(_0x91599f){return BPromise[_0x1faf('0x25')](_0x91599f);}return _0x4648f1['save']();};}function saveUpdates(_0x39c6df,_0x6ab052){return function(_0x46d82d){if(_0x46d82d){return _0x46d82d[_0x1faf('0x26')](_0x39c6df)[_0x1faf('0x27')](function(_0x2dcd12){return _0x2dcd12;});}return null;};}function removeEntity(_0x1f874c,_0x5afb95){return function(_0x3ac777){if(_0x3ac777){return _0x3ac777['destroy']()['then'](function(){_0x1f874c[_0x1faf('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1202d2,_0x38b186){return function(_0x28f734){if(!_0x28f734){_0x1202d2[_0x1faf('0x28')](0x194);}return _0x28f734;};}function handleError(_0x1cd13c,_0x155a98){_0x155a98=_0x155a98||0x1f4;return function(_0x2e4fb4){logger[_0x1faf('0x29')](_0x2e4fb4[_0x1faf('0x2a')]);if(_0x2e4fb4[_0x1faf('0x2b')]){delete _0x2e4fb4[_0x1faf('0x2b')];}_0x1cd13c[_0x1faf('0x1b')](_0x155a98)['send'](_0x2e4fb4);};}exports[_0x1faf('0x2c')]=function(_0x153875,_0x4db0dc){var _0x2e03b4={},_0x4b00c7={},_0x952230={'count':0x0,'rows':[]};var _0x13aec8=_[_0x1faf('0x2d')](db[_0x1faf('0x2e')]['rawAttributes'],function(_0x332b52){return{'name':_0x332b52[_0x1faf('0x2f')],'type':_0x332b52[_0x1faf('0x30')][_0x1faf('0x31')]};});_0x4b00c7['model']=_[_0x1faf('0x2d')](_0x13aec8,_0x1faf('0x2b'));_0x4b00c7[_0x1faf('0x32')]=_[_0x1faf('0x33')](_0x153875[_0x1faf('0x32')]);_0x4b00c7[_0x1faf('0x34')]=_[_0x1faf('0x35')](_0x4b00c7[_0x1faf('0x36')],_0x4b00c7[_0x1faf('0x32')]);_0x2e03b4['attributes']=_[_0x1faf('0x35')](_0x4b00c7['model'],qs[_0x1faf('0x37')](_0x153875[_0x1faf('0x32')][_0x1faf('0x37')]));_0x2e03b4[_0x1faf('0x38')]=_0x2e03b4[_0x1faf('0x38')][_0x1faf('0x39')]?_0x2e03b4[_0x1faf('0x38')]:_0x4b00c7[_0x1faf('0x36')];if(!_0x153875[_0x1faf('0x32')][_0x1faf('0x3a')](_0x1faf('0x3b'))){_0x2e03b4['limit']=qs[_0x1faf('0x20')](_0x153875[_0x1faf('0x32')]['limit']);_0x2e03b4[_0x1faf('0x1e')]=qs[_0x1faf('0x1e')](_0x153875['query']['offset']);}_0x2e03b4[_0x1faf('0x3c')]=qs['sort'](_0x153875['query']['sort']);_0x2e03b4[_0x1faf('0x3d')]=qs['filters'](_[_0x1faf('0x3e')](_0x153875[_0x1faf('0x32')],_0x4b00c7[_0x1faf('0x34')]),_0x13aec8);if(_0x153875[_0x1faf('0x32')][_0x1faf('0x3f')]){_0x2e03b4[_0x1faf('0x3d')]=_[_0x1faf('0x40')](_0x2e03b4['where'],{'$or':_[_0x1faf('0x2d')](_0x13aec8,function(_0x1c8530){if(_0x1c8530[_0x1faf('0x30')]!==_0x1faf('0x41')){var _0x278892={};_0x278892[_0x1c8530[_0x1faf('0x2b')]]={'$like':'%'+_0x153875[_0x1faf('0x32')][_0x1faf('0x3f')]+'%'};return _0x278892;}})});}_0x2e03b4=_[_0x1faf('0x40')]({},_0x2e03b4,_0x153875[_0x1faf('0x42')]);var _0x18affe={'where':_0x2e03b4[_0x1faf('0x3d')]};return db[_0x1faf('0x2e')][_0x1faf('0x21')](_0x18affe)[_0x1faf('0x27')](function(_0x3f1664){_0x952230['count']=_0x3f1664;if(_0x153875[_0x1faf('0x32')]['includeAll']){_0x2e03b4['include']=[{'all':!![]}];}return db[_0x1faf('0x2e')][_0x1faf('0x43')](_0x2e03b4);})[_0x1faf('0x27')](function(_0x2f4f72){_0x952230[_0x1faf('0x44')]=_0x2f4f72;return _0x952230;})['then'](respondWithFilteredResult(_0x4db0dc,_0x2e03b4))[_0x1faf('0x45')](handleError(_0x4db0dc,null));};exports['show']=function(_0x1716a0,_0x10cb4e){var _0x1011ad={'raw':![],'where':{'id':_0x1716a0[_0x1faf('0x46')]['id']}},_0x35a27f={};_0x35a27f[_0x1faf('0x36')]=_[_0x1faf('0x33')](db[_0x1faf('0x2e')]['rawAttributes']);_0x35a27f[_0x1faf('0x32')]=_['keys'](_0x1716a0[_0x1faf('0x32')]);_0x35a27f['filters']=_['intersection'](_0x35a27f['model'],_0x35a27f[_0x1faf('0x32')]);_0x1011ad[_0x1faf('0x38')]=_['intersection'](_0x35a27f['model'],qs[_0x1faf('0x37')](_0x1716a0['query'][_0x1faf('0x37')]));_0x1011ad[_0x1faf('0x38')]=_0x1011ad[_0x1faf('0x38')]['length']?_0x1011ad[_0x1faf('0x38')]:_0x35a27f['model'];if(_0x1716a0[_0x1faf('0x32')]['includeAll']){_0x1011ad[_0x1faf('0x47')]=[{'all':!![]}];}_0x1011ad=_[_0x1faf('0x40')]({},_0x1011ad,_0x1716a0[_0x1faf('0x42')]);return db[_0x1faf('0x2e')][_0x1faf('0x48')](_0x1011ad)['then'](handleEntityNotFound(_0x10cb4e,null))['then'](respondWithResult(_0x10cb4e,null))[_0x1faf('0x45')](handleError(_0x10cb4e,null));};exports['create']=function(_0x3e6909,_0x533c90){return db[_0x1faf('0x2e')][_0x1faf('0x49')](_0x3e6909[_0x1faf('0x4a')],{})[_0x1faf('0x27')](respondWithResult(_0x533c90,0xc9))[_0x1faf('0x45')](handleError(_0x533c90,null));};exports[_0x1faf('0x26')]=function(_0x120004,_0x6091b6){if(_0x120004[_0x1faf('0x4a')]['id']){delete _0x120004['body']['id'];}return db[_0x1faf('0x2e')][_0x1faf('0x48')]({'where':{'id':_0x120004[_0x1faf('0x46')]['id']}})['then'](handleEntityNotFound(_0x6091b6,null))[_0x1faf('0x27')](saveUpdates(_0x120004[_0x1faf('0x4a')],null))['then'](respondWithResult(_0x6091b6,null))[_0x1faf('0x45')](handleError(_0x6091b6,null));};exports[_0x1faf('0x4b')]=function(_0x3f145d,_0x2c2eca){return db['SugarcrmConfiguration'][_0x1faf('0x48')]({'where':{'id':_0x3f145d[_0x1faf('0x46')]['id']}})[_0x1faf('0x27')](handleEntityNotFound(_0x2c2eca,null))[_0x1faf('0x27')](removeEntity(_0x2c2eca,null))['catch'](handleError(_0x2c2eca,null));};exports[_0x1faf('0x4c')]=function(_0x44898f,_0x2811e4,_0x90b8){var _0x1e6a9b={};var _0xbfb3b7={};var _0x4e3a7c;var _0x3b007f;return db[_0x1faf('0x2e')][_0x1faf('0x4d')]({'where':{'id':_0x44898f[_0x1faf('0x46')]['id']}})[_0x1faf('0x27')](handleEntityNotFound(_0x2811e4,null))[_0x1faf('0x27')](function(_0x381b08){if(_0x381b08){_0x4e3a7c=_0x381b08;_0xbfb3b7['model']=_[_0x1faf('0x33')](db[_0x1faf('0x4e')][_0x1faf('0x4f')]);_0xbfb3b7[_0x1faf('0x32')]=_[_0x1faf('0x33')](_0x44898f[_0x1faf('0x32')]);_0xbfb3b7[_0x1faf('0x34')]=_[_0x1faf('0x35')](_0xbfb3b7[_0x1faf('0x36')],_0xbfb3b7[_0x1faf('0x32')]);_0x1e6a9b[_0x1faf('0x38')]=_[_0x1faf('0x35')](_0xbfb3b7[_0x1faf('0x36')],qs[_0x1faf('0x37')](_0x44898f[_0x1faf('0x32')][_0x1faf('0x37')]));_0x1e6a9b[_0x1faf('0x38')]=_0x1e6a9b[_0x1faf('0x38')][_0x1faf('0x39')]?_0x1e6a9b[_0x1faf('0x38')]:_0xbfb3b7[_0x1faf('0x36')];_0x1e6a9b[_0x1faf('0x3c')]=qs['sort'](_0x44898f[_0x1faf('0x32')][_0x1faf('0x50')]);_0x1e6a9b[_0x1faf('0x3d')]=qs[_0x1faf('0x34')](_[_0x1faf('0x3e')](_0x44898f[_0x1faf('0x32')],_0xbfb3b7[_0x1faf('0x34')]));if(_0x44898f[_0x1faf('0x32')]['filter']){_0x1e6a9b[_0x1faf('0x3d')]=_[_0x1faf('0x40')](_0x1e6a9b[_0x1faf('0x3d')],{'$or':_[_0x1faf('0x2d')](_0x1e6a9b['attributes'],function(_0x2e56eb){var _0xa4d75e={};_0xa4d75e[_0x2e56eb]={'$like':'%'+_0x44898f['query'][_0x1faf('0x3f')]+'%'};return _0xa4d75e;})});}_0x1e6a9b=_['merge']({},_0x1e6a9b,_0x44898f['options']);return _0x4e3a7c[_0x1faf('0x4c')](_0x1e6a9b);}})[_0x1faf('0x27')](function(_0x55252b){if(_0x55252b){_0x3b007f=_0x55252b[_0x1faf('0x39')];if(!_0x44898f[_0x1faf('0x32')][_0x1faf('0x3a')]('nolimit')){_0x1e6a9b[_0x1faf('0x20')]=qs[_0x1faf('0x20')](_0x44898f['query'][_0x1faf('0x20')]);_0x1e6a9b[_0x1faf('0x1e')]=qs[_0x1faf('0x1e')](_0x44898f['query'][_0x1faf('0x1e')]);}return _0x4e3a7c[_0x1faf('0x4c')](_0x1e6a9b);}})[_0x1faf('0x27')](function(_0x3763b9){if(_0x3763b9){return _0x3763b9?{'count':_0x3b007f,'rows':_0x3763b9}:null;}})['then'](respondWithResult(_0x2811e4,null))[_0x1faf('0x45')](handleError(_0x2811e4,null));};exports['getSubjects']=function(_0x3e7a95,_0x290ee5,_0x3ec0ec){var _0x1274b1={};var _0x585d29={};var _0x148d87;var _0x2df297;return db[_0x1faf('0x2e')][_0x1faf('0x4d')]({'where':{'id':_0x3e7a95[_0x1faf('0x46')]['id']}})[_0x1faf('0x27')](handleEntityNotFound(_0x290ee5,null))[_0x1faf('0x27')](function(_0x2b7bfd){if(_0x2b7bfd){_0x148d87=_0x2b7bfd;_0x585d29['model']=_[_0x1faf('0x33')](db['SugarcrmField'][_0x1faf('0x4f')]);_0x585d29['query']=_[_0x1faf('0x33')](_0x3e7a95[_0x1faf('0x32')]);_0x585d29[_0x1faf('0x34')]=_[_0x1faf('0x35')](_0x585d29[_0x1faf('0x36')],_0x585d29[_0x1faf('0x32')]);_0x1274b1[_0x1faf('0x38')]=_[_0x1faf('0x35')](_0x585d29[_0x1faf('0x36')],qs[_0x1faf('0x37')](_0x3e7a95[_0x1faf('0x32')][_0x1faf('0x37')]));_0x1274b1['attributes']=_0x1274b1['attributes'][_0x1faf('0x39')]?_0x1274b1['attributes']:_0x585d29[_0x1faf('0x36')];_0x1274b1[_0x1faf('0x3c')]=qs[_0x1faf('0x50')](_0x3e7a95[_0x1faf('0x32')][_0x1faf('0x50')]);_0x1274b1[_0x1faf('0x3d')]=qs[_0x1faf('0x34')](_['pick'](_0x3e7a95[_0x1faf('0x32')],_0x585d29[_0x1faf('0x34')]));if(_0x3e7a95[_0x1faf('0x32')][_0x1faf('0x3f')]){_0x1274b1[_0x1faf('0x3d')]=_['merge'](_0x1274b1['where'],{'$or':_['map'](_0x1274b1['attributes'],function(_0x1dc280){var _0x43769c={};_0x43769c[_0x1dc280]={'$like':'%'+_0x3e7a95['query']['filter']+'%'};return _0x43769c;})});}_0x1274b1=_[_0x1faf('0x40')]({},_0x1274b1,_0x3e7a95[_0x1faf('0x42')]);return _0x148d87[_0x1faf('0x51')](_0x1274b1);}})[_0x1faf('0x27')](function(_0x1c84fa){if(_0x1c84fa){_0x2df297=_0x1c84fa['length'];if(!_0x3e7a95['query'][_0x1faf('0x3a')](_0x1faf('0x3b'))){_0x1274b1[_0x1faf('0x20')]=qs[_0x1faf('0x20')](_0x3e7a95['query'][_0x1faf('0x20')]);_0x1274b1[_0x1faf('0x1e')]=qs[_0x1faf('0x1e')](_0x3e7a95[_0x1faf('0x32')][_0x1faf('0x1e')]);}return _0x148d87[_0x1faf('0x51')](_0x1274b1);}})[_0x1faf('0x27')](function(_0x2f9d53){if(_0x2f9d53){return _0x2f9d53?{'count':_0x2df297,'rows':_0x2f9d53}:null;}})['then'](respondWithResult(_0x290ee5,null))[_0x1faf('0x45')](handleError(_0x290ee5,null));};exports[_0x1faf('0x52')]=function(_0x29a618,_0x43392b,_0x300bbe){var _0x439eb5={};var _0x33e10d={};var _0x2d8969;var _0x41fd62;return db[_0x1faf('0x2e')][_0x1faf('0x4d')]({'where':{'id':_0x29a618['params']['id']}})[_0x1faf('0x27')](handleEntityNotFound(_0x43392b,null))['then'](function(_0x22249e){if(_0x22249e){_0x2d8969=_0x22249e;_0x33e10d['model']=_[_0x1faf('0x33')](db['SugarcrmField'][_0x1faf('0x4f')]);_0x33e10d[_0x1faf('0x32')]=_['keys'](_0x29a618[_0x1faf('0x32')]);_0x33e10d['filters']=_['intersection'](_0x33e10d[_0x1faf('0x36')],_0x33e10d[_0x1faf('0x32')]);_0x439eb5[_0x1faf('0x38')]=_['intersection'](_0x33e10d[_0x1faf('0x36')],qs[_0x1faf('0x37')](_0x29a618['query'][_0x1faf('0x37')]));_0x439eb5[_0x1faf('0x38')]=_0x439eb5['attributes'][_0x1faf('0x39')]?_0x439eb5['attributes']:_0x33e10d['model'];_0x439eb5[_0x1faf('0x3c')]=qs[_0x1faf('0x50')](_0x29a618[_0x1faf('0x32')][_0x1faf('0x50')]);_0x439eb5[_0x1faf('0x3d')]=qs['filters'](_[_0x1faf('0x3e')](_0x29a618[_0x1faf('0x32')],_0x33e10d[_0x1faf('0x34')]));if(_0x29a618['query'][_0x1faf('0x3f')]){_0x439eb5[_0x1faf('0x3d')]=_[_0x1faf('0x40')](_0x439eb5['where'],{'$or':_[_0x1faf('0x2d')](_0x439eb5[_0x1faf('0x38')],function(_0x4f2559){var _0x3ebebb={};_0x3ebebb[_0x4f2559]={'$like':'%'+_0x29a618[_0x1faf('0x32')][_0x1faf('0x3f')]+'%'};return _0x3ebebb;})});}_0x439eb5=_['merge']({},_0x439eb5,_0x29a618[_0x1faf('0x42')]);return _0x2d8969[_0x1faf('0x52')](_0x439eb5);}})[_0x1faf('0x27')](function(_0x51496e){if(_0x51496e){_0x41fd62=_0x51496e[_0x1faf('0x39')];if(!_0x29a618[_0x1faf('0x32')][_0x1faf('0x3a')](_0x1faf('0x3b'))){_0x439eb5[_0x1faf('0x20')]=qs[_0x1faf('0x20')](_0x29a618[_0x1faf('0x32')]['limit']);_0x439eb5[_0x1faf('0x1e')]=qs[_0x1faf('0x1e')](_0x29a618[_0x1faf('0x32')]['offset']);}return _0x2d8969[_0x1faf('0x52')](_0x439eb5);}})[_0x1faf('0x27')](function(_0x349f70){if(_0x349f70){return _0x349f70?{'count':_0x41fd62,'rows':_0x349f70}:null;}})[_0x1faf('0x27')](respondWithResult(_0x43392b,null))[_0x1faf('0x45')](handleError(_0x43392b,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index 9c6fe27..4a065a8 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 _0xc367=['int_sugarcrm_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intSugarcrmConfiguration.attributes','exports','define','SugarcrmConfiguration'];(function(_0x3bb8bf,_0x4058a1){var _0x1f8b3e=function(_0x43f74f){while(--_0x43f74f){_0x3bb8bf['push'](_0x3bb8bf['shift']());}};_0x1f8b3e(++_0x4058a1);}(_0xc367,0x14b));var _0x7c36=function(_0x178ca1,_0xba37c8){_0x178ca1=_0x178ca1-0x0;var _0x5f2668=_0xc367[_0x178ca1];return _0x5f2668;};'use strict';var _=require(_0x7c36('0x0'));var util=require(_0x7c36('0x1'));var logger=require(_0x7c36('0x2'))(_0x7c36('0x3'));var moment=require(_0x7c36('0x4'));var BPromise=require(_0x7c36('0x5'));var rp=require(_0x7c36('0x6'));var fs=require('fs');var path=require(_0x7c36('0x7'));var rimraf=require(_0x7c36('0x8'));var config=require(_0x7c36('0x9'));var attributes=require(_0x7c36('0xa'));module[_0x7c36('0xb')]=function(_0x28e1c4,_0x44eb37){return _0x28e1c4[_0x7c36('0xc')](_0x7c36('0xd'),attributes,{'tableName':_0x7c36('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4bdb=['request-promise','path','rimraf','../../config/environment','./intSugarcrmConfiguration.attributes','exports','define','SugarcrmConfiguration','int_sugarcrm_configurations','lodash','util','../../config/logger','api','bluebird'];(function(_0x3eaab9,_0x59b460){var _0x4f224a=function(_0x263987){while(--_0x263987){_0x3eaab9['push'](_0x3eaab9['shift']());}};_0x4f224a(++_0x59b460);}(_0x4bdb,0xcd));var _0xb4bd=function(_0x149d62,_0x149e74){_0x149d62=_0x149d62-0x0;var _0x535fba=_0x4bdb[_0x149d62];return _0x535fba;};'use strict';var _=require(_0xb4bd('0x0'));var util=require(_0xb4bd('0x1'));var logger=require(_0xb4bd('0x2'))(_0xb4bd('0x3'));var moment=require('moment');var BPromise=require(_0xb4bd('0x4'));var rp=require(_0xb4bd('0x5'));var fs=require('fs');var path=require(_0xb4bd('0x6'));var rimraf=require(_0xb4bd('0x7'));var config=require(_0xb4bd('0x8'));var attributes=require(_0xb4bd('0x9'));module[_0xb4bd('0xa')]=function(_0x40a091,_0x4fc433){return _0x40a091[_0xb4bd('0xb')](_0xb4bd('0xc'),attributes,{'tableName':_0xb4bd('0xd'),'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 5881535..af6f029 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 _0x03ea=['http','request\x20sent','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','SugarcrmConfiguration,\x20%s,\x20%s','message','info','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client'];(function(_0x5671c1,_0x41a5e6){var _0xd226f3=function(_0x2bad51){while(--_0x2bad51){_0x5671c1['push'](_0x5671c1['shift']());}};_0xd226f3(++_0x41a5e6);}(_0x03ea,0xbf));var _0xa03e=function(_0xb9c593,_0x391f9b){_0xb9c593=_0xb9c593-0x0;var _0x5b5527=_0x03ea[_0xb9c593];return _0x5b5527;};'use strict';var _=require('lodash');var util=require(_0xa03e('0x0'));var moment=require(_0xa03e('0x1'));var BPromise=require('bluebird');var rs=require(_0xa03e('0x2'));var fs=require('fs');var Redis=require(_0xa03e('0x3'));var db=require(_0xa03e('0x4'))['db'];var utils=require(_0xa03e('0x5'));var logger=require(_0xa03e('0x6'))('rpc');var config=require(_0xa03e('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xa03e('0x8')][_0xa03e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2e8190,_0x280def,_0x3f7b94){return new BPromise(function(_0x1267b3,_0x29acf9){return client['request'](_0x2e8190,_0x3f7b94)['then'](function(_0x3fbd4c){logger['info']('SugarcrmConfiguration,\x20%s,\x20%s',_0x280def,_0xa03e('0xa'));logger['debug'](_0xa03e('0xb'),_0x280def,'request\x20sent',JSON[_0xa03e('0xc')](_0x3fbd4c));if(_0x3fbd4c[_0xa03e('0xd')]){if(_0x3fbd4c[_0xa03e('0xd')][_0xa03e('0xe')]===0x1f4){logger[_0xa03e('0xd')](_0xa03e('0xf'),_0x280def,_0x3fbd4c[_0xa03e('0xd')]['message']);return _0x29acf9(_0x3fbd4c[_0xa03e('0xd')][_0xa03e('0x10')]);}logger[_0xa03e('0xd')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x280def,_0x3fbd4c[_0xa03e('0xd')][_0xa03e('0x10')]);return _0x1267b3(_0x3fbd4c[_0xa03e('0xd')]['message']);}else{logger[_0xa03e('0x11')](_0xa03e('0xf'),_0x280def,_0xa03e('0xa'));_0x1267b3(_0x3fbd4c[_0xa03e('0x12')][_0xa03e('0x10')]);}})[_0xa03e('0x13')](function(_0x2537c6){logger[_0xa03e('0xd')](_0xa03e('0xf'),_0x280def,_0x2537c6);_0x29acf9(_0x2537c6);});});} \ No newline at end of file +var _0x70ca=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','code','message','error','info','catch','lodash','util','moment','bluebird'];(function(_0x443b3b,_0x1e2a2a){var _0x120b80=function(_0x469d68){while(--_0x469d68){_0x443b3b['push'](_0x443b3b['shift']());}};_0x120b80(++_0x1e2a2a);}(_0x70ca,0x1c4));var _0xa70c=function(_0x5cd8ae,_0x5358eb){_0x5cd8ae=_0x5cd8ae-0x0;var _0x5f0a91=_0x70ca[_0x5cd8ae];return _0x5f0a91;};'use strict';var _=require(_0xa70c('0x0'));var util=require(_0xa70c('0x1'));var moment=require(_0xa70c('0x2'));var BPromise=require(_0xa70c('0x3'));var rs=require(_0xa70c('0x4'));var fs=require('fs');var Redis=require(_0xa70c('0x5'));var db=require(_0xa70c('0x6'))['db'];var utils=require(_0xa70c('0x7'));var logger=require(_0xa70c('0x8'))(_0xa70c('0x9'));var config=require(_0xa70c('0xa'));var jayson=require(_0xa70c('0xb'));var client=jayson['client'][_0xa70c('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4e39aa,_0x509df2,_0x52663d){return new BPromise(function(_0x29b1f4,_0x3aaec8){return client[_0xa70c('0xd')](_0x4e39aa,_0x52663d)[_0xa70c('0xe')](function(_0x4ee378){logger['info'](_0xa70c('0xf'),_0x509df2,_0xa70c('0x10'));logger[_0xa70c('0x11')]('SugarcrmConfiguration,\x20%s,\x20%s,\x20%s',_0x509df2,_0xa70c('0x10'),JSON[_0xa70c('0x12')](_0x4ee378));if(_0x4ee378['error']){if(_0x4ee378['error'][_0xa70c('0x13')]===0x1f4){logger['error'](_0xa70c('0xf'),_0x509df2,_0x4ee378['error'][_0xa70c('0x14')]);return _0x3aaec8(_0x4ee378[_0xa70c('0x15')][_0xa70c('0x14')]);}logger['error']('SugarcrmConfiguration,\x20%s,\x20%s',_0x509df2,_0x4ee378[_0xa70c('0x15')][_0xa70c('0x14')]);return _0x29b1f4(_0x4ee378[_0xa70c('0x15')][_0xa70c('0x14')]);}else{logger[_0xa70c('0x16')](_0xa70c('0xf'),_0x509df2,'request\x20sent');_0x29b1f4(_0x4ee378['result'][_0xa70c('0x14')]);}})[_0xa70c('0x17')](function(_0x1312b9){logger[_0xa70c('0x15')](_0xa70c('0xf'),_0x509df2,_0x1312b9);_0x3aaec8(_0x1312b9);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index 8d22a37..44ced13 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 _0xe616=['../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','post','create','put','update','delete','multer','util','path','connect-timeout','express','fs-extra'];(function(_0x1ec8f9,_0x22f5e7){var _0x17cd3d=function(_0x156ad2){while(--_0x156ad2){_0x1ec8f9['push'](_0x1ec8f9['shift']());}};_0x17cd3d(++_0x22f5e7);}(_0xe616,0x192));var _0x6e61=function(_0x20ac62,_0x16e289){_0x20ac62=_0x20ac62-0x0;var _0x28eb5a=_0xe616[_0x20ac62];return _0x28eb5a;};'use strict';var multer=require(_0x6e61('0x0'));var util=require(_0x6e61('0x1'));var path=require(_0x6e61('0x2'));var timeout=require(_0x6e61('0x3'));var express=require(_0x6e61('0x4'));var router=express['Router']();var fs_extra=require(_0x6e61('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x6e61('0x6'));var config=require(_0x6e61('0x7'));var controller=require('./intSugarcrmField.controller');router[_0x6e61('0x8')]('/',auth[_0x6e61('0x9')](),controller[_0x6e61('0xa')]);router[_0x6e61('0x8')](_0x6e61('0xb'),auth[_0x6e61('0x9')](),controller['show']);router[_0x6e61('0xc')]('/',auth[_0x6e61('0x9')](),controller[_0x6e61('0xd')]);router[_0x6e61('0xe')](_0x6e61('0xb'),auth[_0x6e61('0x9')](),controller[_0x6e61('0xf')]);router[_0x6e61('0x10')]('/:id',auth[_0x6e61('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xe2e5=['get','isAuthenticated','index','/:id','show','post','create','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intSugarcrmField.controller'];(function(_0x2a4ddc,_0x4d5fe7){var _0x2c0bef=function(_0x375359){while(--_0x375359){_0x2a4ddc['push'](_0x2a4ddc['shift']());}};_0x2c0bef(++_0x4d5fe7);}(_0xe2e5,0xab));var _0x5e2e=function(_0x19f40c,_0x28e0da){_0x19f40c=_0x19f40c-0x0;var _0x3c86d0=_0xe2e5[_0x19f40c];return _0x3c86d0;};'use strict';var multer=require(_0x5e2e('0x0'));var util=require(_0x5e2e('0x1'));var path=require('path');var timeout=require(_0x5e2e('0x2'));var express=require(_0x5e2e('0x3'));var router=express[_0x5e2e('0x4')]();var fs_extra=require(_0x5e2e('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x5e2e('0x6'));var config=require(_0x5e2e('0x7'));var controller=require(_0x5e2e('0x8'));router[_0x5e2e('0x9')]('/',auth[_0x5e2e('0xa')](),controller[_0x5e2e('0xb')]);router[_0x5e2e('0x9')](_0x5e2e('0xc'),auth[_0x5e2e('0xa')](),controller[_0x5e2e('0xd')]);router[_0x5e2e('0xe')]('/',auth[_0x5e2e('0xa')](),controller[_0x5e2e('0xf')]);router['put'](_0x5e2e('0xc'),auth[_0x5e2e('0xa')](),controller[_0x5e2e('0x10')]);router[_0x5e2e('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x5e2e('0x12')]);module[_0x5e2e('0x13')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.attributes.js b/server/api/intSugarcrmField/intSugarcrmField.attributes.js index a496052..c9bde42 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 _0x815b=['ENUM','variable','sequelize','exports','customVariable','picklist','string','STRING'];(function(_0x22f0a7,_0x2a5e0d){var _0x19adbb=function(_0x4cd069){while(--_0x4cd069){_0x22f0a7['push'](_0x22f0a7['shift']());}};_0x19adbb(++_0x2a5e0d);}(_0x815b,0x12a));var _0xb815=function(_0x5036a7,_0x1c1b57){_0x5036a7=_0x5036a7-0x0;var _0x25d393=_0x815b[_0x5036a7];return _0x25d393;};'use strict';var Sequelize=require(_0xb815('0x0'));module[_0xb815('0x1')]={'type':{'type':Sequelize['ENUM']('string','variable',_0xb815('0x2'),'keyValue',_0xb815('0x3')),'defaultValue':_0xb815('0x4')},'content':{'type':Sequelize[_0xb815('0x5')]},'key':{'type':Sequelize[_0xb815('0x5')]},'keyType':{'type':Sequelize[_0xb815('0x6')]('string',_0xb815('0x7'),_0xb815('0x2'))},'keyContent':{'type':Sequelize[_0xb815('0x5')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xb815('0x5')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xb815('0x5')]}}; \ No newline at end of file +var _0x12e3=['picklist','STRING','variable','BOOLEAN','sequelize','exports','ENUM','string','customVariable','keyValue'];(function(_0x440af8,_0x59a284){var _0x1483f0=function(_0x50c24e){while(--_0x50c24e){_0x440af8['push'](_0x440af8['shift']());}};_0x1483f0(++_0x59a284);}(_0x12e3,0x18a));var _0x312e=function(_0x202eec,_0x47c96f){_0x202eec=_0x202eec-0x0;var _0x3808d1=_0x12e3[_0x202eec];return _0x3808d1;};'use strict';var Sequelize=require(_0x312e('0x0'));module[_0x312e('0x1')]={'type':{'type':Sequelize[_0x312e('0x2')](_0x312e('0x3'),'variable',_0x312e('0x4'),_0x312e('0x5'),_0x312e('0x6')),'defaultValue':_0x312e('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x312e('0x7')]},'keyType':{'type':Sequelize[_0x312e('0x2')](_0x312e('0x3'),_0x312e('0x8'),_0x312e('0x4'))},'keyContent':{'type':Sequelize[_0x312e('0x7')]},'idField':{'type':Sequelize[_0x312e('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x312e('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x312e('0x7')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index 4cfb3e0..4800f02 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 _0x196e=['filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','find','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','status','set','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','SugarcrmField','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick'];(function(_0x76e09b,_0x5d18a3){var _0xd18014=function(_0x47509e){while(--_0x47509e){_0x76e09b['push'](_0x76e09b['shift']());}};_0xd18014(++_0x5d18a3);}(_0x196e,0x1e7));var _0xe196=function(_0x2caaef,_0x3c19ed){_0x2caaef=_0x2caaef-0x0;var _0xd011f8=_0x196e[_0x2caaef];return _0xd011f8;};'use strict';var emlformat=require(_0xe196('0x0'));var rimraf=require(_0xe196('0x1'));var zipdir=require(_0xe196('0x2'));var jsonpatch=require(_0xe196('0x3'));var rp=require(_0xe196('0x4'));var moment=require(_0xe196('0x5'));var BPromise=require(_0xe196('0x6'));var Mustache=require(_0xe196('0x7'));var util=require('util');var path=require(_0xe196('0x8'));var sox=require(_0xe196('0x9'));var csv=require(_0xe196('0xa'));var ejs=require(_0xe196('0xb'));var fs=require('fs');var fs_extra=require(_0xe196('0xc'));var _=require(_0xe196('0xd'));var squel=require('squel');var crypto=require(_0xe196('0xe'));var jsforce=require(_0xe196('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xe196('0x10'));var Papa=require(_0xe196('0x11'));var Redis=require('ioredis');var authService=require(_0xe196('0x12'));var qs=require(_0xe196('0x13'));var as=require(_0xe196('0x14'));var hardwareService=require(_0xe196('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0xe196('0x16'));var config=require(_0xe196('0x17'));var licenseUtil=require(_0xe196('0x18'));var db=require(_0xe196('0x19'))['db'];function respondWithStatusCode(_0x396aa4,_0x444eca){_0x444eca=_0x444eca||0xcc;return function(_0x2659e3){if(_0x2659e3){return _0x396aa4[_0xe196('0x1a')](_0x444eca);}return _0x396aa4['status'](_0x444eca)[_0xe196('0x1b')]();};}function respondWithResult(_0x3f1980,_0xde37dd){_0xde37dd=_0xde37dd||0xc8;return function(_0x42ee8a){if(_0x42ee8a){return _0x3f1980['status'](_0xde37dd)[_0xe196('0x1c')](_0x42ee8a);}};}function respondWithFilteredResult(_0x31c56e,_0x5a838e){return function(_0x1339f0){if(_0x1339f0){var _0xeab6af=typeof _0x5a838e[_0xe196('0x1d')]===_0xe196('0x1e')&&typeof _0x5a838e[_0xe196('0x1f')]==='undefined';var _0x517117=_0x1339f0[_0xe196('0x20')];var _0x25ebcf=_0xeab6af?0x0:_0x5a838e['offset'];var _0x3ecd4f=_0xeab6af?_0x1339f0[_0xe196('0x20')]:_0x5a838e[_0xe196('0x1d')]+_0x5a838e[_0xe196('0x1f')];var _0x9ef653;if(_0x3ecd4f>=_0x517117){_0x3ecd4f=_0x517117;_0x9ef653=0xc8;}else{_0x9ef653=0xce;}_0x31c56e[_0xe196('0x21')](_0x9ef653);return _0x31c56e[_0xe196('0x22')]('Content-Range',_0x25ebcf+'-'+_0x3ecd4f+'/'+_0x517117)['json'](_0x1339f0);}return null;};}function patchUpdates(_0x297301){return function(_0x446358){try{jsonpatch[_0xe196('0x23')](_0x446358,_0x297301,!![]);}catch(_0x579b76){return BPromise[_0xe196('0x24')](_0x579b76);}return _0x446358[_0xe196('0x25')]();};}function saveUpdates(_0x39bd9f,_0xc8ea5b){return function(_0x3eb4e7){if(_0x3eb4e7){return _0x3eb4e7[_0xe196('0x26')](_0x39bd9f)[_0xe196('0x27')](function(_0x5b38ed){return _0x5b38ed;});}return null;};}function removeEntity(_0x4ea2df,_0x5eb1b8){return function(_0x48c0f5){if(_0x48c0f5){return _0x48c0f5[_0xe196('0x28')]()[_0xe196('0x27')](function(){_0x4ea2df[_0xe196('0x21')](0xcc)[_0xe196('0x1b')]();});}};}function handleEntityNotFound(_0x3c2fe4,_0x91d038){return function(_0x2efc4e){if(!_0x2efc4e){_0x3c2fe4[_0xe196('0x1a')](0x194);}return _0x2efc4e;};}function handleError(_0x114811,_0x49a0db){_0x49a0db=_0x49a0db||0x1f4;return function(_0x47251d){logger[_0xe196('0x29')](_0x47251d[_0xe196('0x2a')]);if(_0x47251d[_0xe196('0x2b')]){delete _0x47251d[_0xe196('0x2b')];}_0x114811[_0xe196('0x21')](_0x49a0db)[_0xe196('0x2c')](_0x47251d);};}exports[_0xe196('0x2d')]=function(_0x10de73,_0x1d5da3){var _0x4df900={},_0x11b910={},_0x139187={'count':0x0,'rows':[]};var _0x31110b=_[_0xe196('0x2e')](db[_0xe196('0x2f')][_0xe196('0x30')],function(_0x2bb9e2){return{'name':_0x2bb9e2[_0xe196('0x31')],'type':_0x2bb9e2[_0xe196('0x32')][_0xe196('0x33')]};});_0x11b910[_0xe196('0x34')]=_[_0xe196('0x2e')](_0x31110b,_0xe196('0x2b'));_0x11b910[_0xe196('0x35')]=_[_0xe196('0x36')](_0x10de73[_0xe196('0x35')]);_0x11b910[_0xe196('0x37')]=_[_0xe196('0x38')](_0x11b910[_0xe196('0x34')],_0x11b910[_0xe196('0x35')]);_0x4df900['attributes']=_[_0xe196('0x38')](_0x11b910[_0xe196('0x34')],qs[_0xe196('0x39')](_0x10de73[_0xe196('0x35')][_0xe196('0x39')]));_0x4df900['attributes']=_0x4df900[_0xe196('0x3a')][_0xe196('0x3b')]?_0x4df900[_0xe196('0x3a')]:_0x11b910[_0xe196('0x34')];if(!_0x10de73[_0xe196('0x35')][_0xe196('0x3c')](_0xe196('0x3d'))){_0x4df900[_0xe196('0x1f')]=qs[_0xe196('0x1f')](_0x10de73[_0xe196('0x35')][_0xe196('0x1f')]);_0x4df900[_0xe196('0x1d')]=qs['offset'](_0x10de73[_0xe196('0x35')][_0xe196('0x1d')]);}_0x4df900[_0xe196('0x3e')]=qs['sort'](_0x10de73[_0xe196('0x35')][_0xe196('0x3f')]);_0x4df900[_0xe196('0x40')]=qs['filters'](_[_0xe196('0x41')](_0x10de73[_0xe196('0x35')],_0x11b910[_0xe196('0x37')]),_0x31110b);if(_0x10de73[_0xe196('0x35')][_0xe196('0x42')]){_0x4df900[_0xe196('0x40')]=_[_0xe196('0x43')](_0x4df900[_0xe196('0x40')],{'$or':_[_0xe196('0x2e')](_0x31110b,function(_0x2291ee){if(_0x2291ee['type']!==_0xe196('0x44')){var _0x134574={};_0x134574[_0x2291ee[_0xe196('0x2b')]]={'$like':'%'+_0x10de73[_0xe196('0x35')][_0xe196('0x42')]+'%'};return _0x134574;}})});}_0x4df900=_[_0xe196('0x43')]({},_0x4df900,_0x10de73[_0xe196('0x45')]);var _0x9310a1={'where':_0x4df900['where']};return db['SugarcrmField'][_0xe196('0x20')](_0x9310a1)[_0xe196('0x27')](function(_0x598bd6){_0x139187['count']=_0x598bd6;if(_0x10de73[_0xe196('0x35')][_0xe196('0x46')]){_0x4df900[_0xe196('0x47')]=[{'all':!![]}];}return db[_0xe196('0x2f')][_0xe196('0x48')](_0x4df900);})[_0xe196('0x27')](function(_0x20ebd7){_0x139187[_0xe196('0x49')]=_0x20ebd7;return _0x139187;})[_0xe196('0x27')](respondWithFilteredResult(_0x1d5da3,_0x4df900))[_0xe196('0x4a')](handleError(_0x1d5da3,null));};exports['show']=function(_0x37ca5b,_0x34790f){var _0x24fe83={'raw':!![],'where':{'id':_0x37ca5b['params']['id']}},_0x3b6de={};_0x3b6de[_0xe196('0x34')]=_[_0xe196('0x36')](db[_0xe196('0x2f')][_0xe196('0x30')]);_0x3b6de[_0xe196('0x35')]=_[_0xe196('0x36')](_0x37ca5b[_0xe196('0x35')]);_0x3b6de[_0xe196('0x37')]=_['intersection'](_0x3b6de[_0xe196('0x34')],_0x3b6de[_0xe196('0x35')]);_0x24fe83[_0xe196('0x3a')]=_[_0xe196('0x38')](_0x3b6de['model'],qs[_0xe196('0x39')](_0x37ca5b[_0xe196('0x35')][_0xe196('0x39')]));_0x24fe83[_0xe196('0x3a')]=_0x24fe83[_0xe196('0x3a')][_0xe196('0x3b')]?_0x24fe83[_0xe196('0x3a')]:_0x3b6de[_0xe196('0x34')];if(_0x37ca5b[_0xe196('0x35')]['includeAll']){_0x24fe83[_0xe196('0x47')]=[{'all':!![]}];}_0x24fe83=_[_0xe196('0x43')]({},_0x24fe83,_0x37ca5b[_0xe196('0x45')]);return db['SugarcrmField'][_0xe196('0x4b')](_0x24fe83)[_0xe196('0x27')](handleEntityNotFound(_0x34790f,null))[_0xe196('0x27')](respondWithResult(_0x34790f,null))[_0xe196('0x4a')](handleError(_0x34790f,null));};exports[_0xe196('0x4c')]=function(_0xa57be4,_0x493c01){return db[_0xe196('0x2f')][_0xe196('0x4c')](_0xa57be4[_0xe196('0x4d')],{})[_0xe196('0x27')](respondWithResult(_0x493c01,0xc9))[_0xe196('0x4a')](handleError(_0x493c01,null));};exports['update']=function(_0x3a25d8,_0x5b76fd){if(_0x3a25d8['body']['id']){delete _0x3a25d8[_0xe196('0x4d')]['id'];}return db['SugarcrmField']['find']({'where':{'id':_0x3a25d8[_0xe196('0x4e')]['id']}})['then'](handleEntityNotFound(_0x5b76fd,null))[_0xe196('0x27')](saveUpdates(_0x3a25d8[_0xe196('0x4d')],null))[_0xe196('0x27')](respondWithResult(_0x5b76fd,null))[_0xe196('0x4a')](handleError(_0x5b76fd,null));};exports['destroy']=function(_0x388943,_0x238d09){return db['SugarcrmField']['find']({'where':{'id':_0x388943['params']['id']}})[_0xe196('0x27')](handleEntityNotFound(_0x238d09,null))['then'](removeEntity(_0x238d09,null))[_0xe196('0x4a')](handleError(_0x238d09,null));}; \ No newline at end of file +var _0x743a=['../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','update','then','destroy','error','name','index','map','SugarcrmField','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','eml-format','rimraf','zip-dir','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x3f171c,_0x1cad10){var _0x3c09d7=function(_0x1c0d2e){while(--_0x1c0d2e){_0x3f171c['push'](_0x3f171c['shift']());}};_0x3c09d7(++_0x1cad10);}(_0x743a,0x1ee));var _0xa743=function(_0x2db247,_0x1d5ee1){_0x2db247=_0x2db247-0x0;var _0x1f1b98=_0x743a[_0x2db247];return _0x1f1b98;};'use strict';var emlformat=require(_0xa743('0x0'));var rimraf=require(_0xa743('0x1'));var zipdir=require(_0xa743('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xa743('0x3'));var Mustache=require(_0xa743('0x4'));var util=require(_0xa743('0x5'));var path=require(_0xa743('0x6'));var sox=require(_0xa743('0x7'));var csv=require(_0xa743('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa743('0x9'));var _=require(_0xa743('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xa743('0xb'));var deskjs=require(_0xa743('0xc'));var toCsv=require('to-csv');var querystring=require(_0xa743('0xd'));var Papa=require('papaparse');var Redis=require(_0xa743('0xe'));var authService=require(_0xa743('0xf'));var qs=require(_0xa743('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa743('0x11'));var logger=require('../../config/logger')(_0xa743('0x12'));var utils=require('../../config/utils');var config=require(_0xa743('0x13'));var licenseUtil=require(_0xa743('0x14'));var db=require(_0xa743('0x15'))['db'];function respondWithStatusCode(_0x1fcd49,_0x29d97d){_0x29d97d=_0x29d97d||0xcc;return function(_0x3e0d8b){if(_0x3e0d8b){return _0x1fcd49[_0xa743('0x16')](_0x29d97d);}return _0x1fcd49[_0xa743('0x17')](_0x29d97d)['end']();};}function respondWithResult(_0xed1a4f,_0x5c6bf3){_0x5c6bf3=_0x5c6bf3||0xc8;return function(_0x5e086b){if(_0x5e086b){return _0xed1a4f['status'](_0x5c6bf3)['json'](_0x5e086b);}};}function respondWithFilteredResult(_0x10e97c,_0xc0d56b){return function(_0x411fa8){if(_0x411fa8){var _0x19dc93=typeof _0xc0d56b[_0xa743('0x18')]===_0xa743('0x19')&&typeof _0xc0d56b[_0xa743('0x1a')]==='undefined';var _0x346ee4=_0x411fa8[_0xa743('0x1b')];var _0x5d9298=_0x19dc93?0x0:_0xc0d56b[_0xa743('0x18')];var _0x1b1247=_0x19dc93?_0x411fa8[_0xa743('0x1b')]:_0xc0d56b[_0xa743('0x18')]+_0xc0d56b[_0xa743('0x1a')];var _0x58cbe0;if(_0x1b1247>=_0x346ee4){_0x1b1247=_0x346ee4;_0x58cbe0=0xc8;}else{_0x58cbe0=0xce;}_0x10e97c['status'](_0x58cbe0);return _0x10e97c[_0xa743('0x1c')](_0xa743('0x1d'),_0x5d9298+'-'+_0x1b1247+'/'+_0x346ee4)[_0xa743('0x1e')](_0x411fa8);}return null;};}function patchUpdates(_0x253bb2){return function(_0x261c4a){try{jsonpatch[_0xa743('0x1f')](_0x261c4a,_0x253bb2,!![]);}catch(_0x14682c){return BPromise[_0xa743('0x20')](_0x14682c);}return _0x261c4a['save']();};}function saveUpdates(_0x440b1a,_0x2a4df6){return function(_0xc3f0c){if(_0xc3f0c){return _0xc3f0c[_0xa743('0x21')](_0x440b1a)[_0xa743('0x22')](function(_0x58fd64){return _0x58fd64;});}return null;};}function removeEntity(_0xe1f7d5,_0x144e2d){return function(_0x3f6211){if(_0x3f6211){return _0x3f6211[_0xa743('0x23')]()[_0xa743('0x22')](function(){_0xe1f7d5['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x590943,_0x202e80){return function(_0x50325a){if(!_0x50325a){_0x590943[_0xa743('0x16')](0x194);}return _0x50325a;};}function handleError(_0x1137ed,_0x2b7e7c){_0x2b7e7c=_0x2b7e7c||0x1f4;return function(_0x263f0f){logger[_0xa743('0x24')](_0x263f0f['stack']);if(_0x263f0f[_0xa743('0x25')]){delete _0x263f0f[_0xa743('0x25')];}_0x1137ed['status'](_0x2b7e7c)['send'](_0x263f0f);};}exports[_0xa743('0x26')]=function(_0x2d0684,_0x3424dc){var _0x5bd557={},_0x537c00={},_0x37b33b={'count':0x0,'rows':[]};var _0x21d72b=_[_0xa743('0x27')](db[_0xa743('0x28')][_0xa743('0x29')],function(_0x118a8a){return{'name':_0x118a8a[_0xa743('0x2a')],'type':_0x118a8a[_0xa743('0x2b')][_0xa743('0x2c')]};});_0x537c00[_0xa743('0x2d')]=_['map'](_0x21d72b,_0xa743('0x25'));_0x537c00[_0xa743('0x2e')]=_[_0xa743('0x2f')](_0x2d0684[_0xa743('0x2e')]);_0x537c00['filters']=_[_0xa743('0x30')](_0x537c00[_0xa743('0x2d')],_0x537c00['query']);_0x5bd557[_0xa743('0x31')]=_[_0xa743('0x30')](_0x537c00[_0xa743('0x2d')],qs[_0xa743('0x32')](_0x2d0684['query']['fields']));_0x5bd557[_0xa743('0x31')]=_0x5bd557[_0xa743('0x31')][_0xa743('0x33')]?_0x5bd557[_0xa743('0x31')]:_0x537c00[_0xa743('0x2d')];if(!_0x2d0684[_0xa743('0x2e')][_0xa743('0x34')](_0xa743('0x35'))){_0x5bd557[_0xa743('0x1a')]=qs[_0xa743('0x1a')](_0x2d0684[_0xa743('0x2e')]['limit']);_0x5bd557[_0xa743('0x18')]=qs[_0xa743('0x18')](_0x2d0684[_0xa743('0x2e')][_0xa743('0x18')]);}_0x5bd557[_0xa743('0x36')]=qs[_0xa743('0x37')](_0x2d0684[_0xa743('0x2e')][_0xa743('0x37')]);_0x5bd557[_0xa743('0x38')]=qs[_0xa743('0x39')](_[_0xa743('0x3a')](_0x2d0684[_0xa743('0x2e')],_0x537c00[_0xa743('0x39')]),_0x21d72b);if(_0x2d0684[_0xa743('0x2e')]['filter']){_0x5bd557['where']=_[_0xa743('0x3b')](_0x5bd557['where'],{'$or':_[_0xa743('0x27')](_0x21d72b,function(_0x6d43a0){if(_0x6d43a0[_0xa743('0x2b')]!==_0xa743('0x3c')){var _0x2cc12d={};_0x2cc12d[_0x6d43a0[_0xa743('0x25')]]={'$like':'%'+_0x2d0684['query'][_0xa743('0x3d')]+'%'};return _0x2cc12d;}})});}_0x5bd557=_[_0xa743('0x3b')]({},_0x5bd557,_0x2d0684[_0xa743('0x3e')]);var _0x379dae={'where':_0x5bd557[_0xa743('0x38')]};return db[_0xa743('0x28')][_0xa743('0x1b')](_0x379dae)['then'](function(_0x50ee9a){_0x37b33b[_0xa743('0x1b')]=_0x50ee9a;if(_0x2d0684[_0xa743('0x2e')][_0xa743('0x3f')]){_0x5bd557[_0xa743('0x40')]=[{'all':!![]}];}return db[_0xa743('0x28')][_0xa743('0x41')](_0x5bd557);})[_0xa743('0x22')](function(_0x3abf32){_0x37b33b[_0xa743('0x42')]=_0x3abf32;return _0x37b33b;})[_0xa743('0x22')](respondWithFilteredResult(_0x3424dc,_0x5bd557))[_0xa743('0x43')](handleError(_0x3424dc,null));};exports[_0xa743('0x44')]=function(_0x1cb6da,_0x2ad26a){var _0x254292={'raw':!![],'where':{'id':_0x1cb6da[_0xa743('0x45')]['id']}},_0x5a78d8={};_0x5a78d8[_0xa743('0x2d')]=_[_0xa743('0x2f')](db['SugarcrmField']['rawAttributes']);_0x5a78d8[_0xa743('0x2e')]=_[_0xa743('0x2f')](_0x1cb6da[_0xa743('0x2e')]);_0x5a78d8[_0xa743('0x39')]=_[_0xa743('0x30')](_0x5a78d8['model'],_0x5a78d8[_0xa743('0x2e')]);_0x254292[_0xa743('0x31')]=_[_0xa743('0x30')](_0x5a78d8[_0xa743('0x2d')],qs[_0xa743('0x32')](_0x1cb6da[_0xa743('0x2e')][_0xa743('0x32')]));_0x254292[_0xa743('0x31')]=_0x254292[_0xa743('0x31')]['length']?_0x254292['attributes']:_0x5a78d8['model'];if(_0x1cb6da['query'][_0xa743('0x3f')]){_0x254292['include']=[{'all':!![]}];}_0x254292=_[_0xa743('0x3b')]({},_0x254292,_0x1cb6da['options']);return db['SugarcrmField'][_0xa743('0x46')](_0x254292)[_0xa743('0x22')](handleEntityNotFound(_0x2ad26a,null))[_0xa743('0x22')](respondWithResult(_0x2ad26a,null))['catch'](handleError(_0x2ad26a,null));};exports['create']=function(_0x126ccb,_0x2a98a4){return db[_0xa743('0x28')][_0xa743('0x47')](_0x126ccb[_0xa743('0x48')],{})['then'](respondWithResult(_0x2a98a4,0xc9))[_0xa743('0x43')](handleError(_0x2a98a4,null));};exports[_0xa743('0x21')]=function(_0x133965,_0x5c0380){if(_0x133965[_0xa743('0x48')]['id']){delete _0x133965['body']['id'];}return db[_0xa743('0x28')][_0xa743('0x46')]({'where':{'id':_0x133965[_0xa743('0x45')]['id']}})['then'](handleEntityNotFound(_0x5c0380,null))['then'](saveUpdates(_0x133965[_0xa743('0x48')],null))[_0xa743('0x22')](respondWithResult(_0x5c0380,null))[_0xa743('0x43')](handleError(_0x5c0380,null));};exports['destroy']=function(_0x40f033,_0x4a1862){return db[_0xa743('0x28')][_0xa743('0x46')]({'where':{'id':_0x40f033['params']['id']}})[_0xa743('0x22')](handleEntityNotFound(_0x4a1862,null))[_0xa743('0x22')](removeEntity(_0x4a1862,null))[_0xa743('0x43')](handleError(_0x4a1862,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index 1123430..e16de6f 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 _0x3cef=['bluebird','request-promise','path','rimraf','../../config/environment','./intSugarcrmField.attributes','exports','define','SugarcrmField','idField','lodash','util','../../config/logger','api','moment'];(function(_0x9729d7,_0x1b79a8){var _0x3c4ac6=function(_0x401ba6){while(--_0x401ba6){_0x9729d7['push'](_0x9729d7['shift']());}};_0x3c4ac6(++_0x1b79a8);}(_0x3cef,0x82));var _0xf3ce=function(_0x426da6,_0x291c2f){_0x426da6=_0x426da6-0x0;var _0x142658=_0x3cef[_0x426da6];return _0x142658;};'use strict';var _=require(_0xf3ce('0x0'));var util=require(_0xf3ce('0x1'));var logger=require(_0xf3ce('0x2'))(_0xf3ce('0x3'));var moment=require(_0xf3ce('0x4'));var BPromise=require(_0xf3ce('0x5'));var rp=require(_0xf3ce('0x6'));var fs=require('fs');var path=require(_0xf3ce('0x7'));var rimraf=require(_0xf3ce('0x8'));var config=require(_0xf3ce('0x9'));var attributes=require(_0xf3ce('0xa'));module[_0xf3ce('0xb')]=function(_0x1ff0fc,_0x21dfe3){return _0x1ff0fc[_0xf3ce('0xc')](_0xf3ce('0xd'),attributes,{'tableName':'int_sugarcrm_fields','paranoid':![],'indexes':[{'name':'sugarcrm_unique_index','fields':[_0xf3ce('0xe'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb15b=['../../config/environment','exports','define','int_sugarcrm_fields','sugarcrm_unique_index','idField','FieldId','lodash','util','moment','bluebird','path','rimraf'];(function(_0x4937b2,_0x2599cf){var _0x8da2fb=function(_0x1c875f){while(--_0x1c875f){_0x4937b2['push'](_0x4937b2['shift']());}};_0x8da2fb(++_0x2599cf);}(_0xb15b,0x1a7));var _0xbb15=function(_0x4ba3c5,_0xd48a2e){_0x4ba3c5=_0x4ba3c5-0x0;var _0x104563=_0xb15b[_0x4ba3c5];return _0x104563;};'use strict';var _=require(_0xbb15('0x0'));var util=require(_0xbb15('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xbb15('0x2'));var BPromise=require(_0xbb15('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbb15('0x4'));var rimraf=require(_0xbb15('0x5'));var config=require(_0xbb15('0x6'));var attributes=require('./intSugarcrmField.attributes');module[_0xbb15('0x7')]=function(_0x1e0088,_0x12c255){return _0x1e0088[_0xbb15('0x8')]('SugarcrmField',attributes,{'tableName':_0xbb15('0x9'),'paranoid':![],'indexes':[{'name':_0xbb15('0xa'),'fields':[_0xbb15('0xb'),_0xbb15('0xc')],'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 b430fbf..bc861ea 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 _0x1ef0=['http','then','info','request\x20sent','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','stringify','error','code','SugarcrmField,\x20%s,\x20%s','message','result','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client'];(function(_0x3ddf3e,_0x348eba){var _0x5aa94a=function(_0x360560){while(--_0x360560){_0x3ddf3e['push'](_0x3ddf3e['shift']());}};_0x5aa94a(++_0x348eba);}(_0x1ef0,0x64));var _0x01ef=function(_0x40c9bc,_0x6eb340){_0x40c9bc=_0x40c9bc-0x0;var _0x3acedf=_0x1ef0[_0x40c9bc];return _0x3acedf;};'use strict';var _=require('lodash');var util=require(_0x01ef('0x0'));var moment=require(_0x01ef('0x1'));var BPromise=require(_0x01ef('0x2'));var rs=require(_0x01ef('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x01ef('0x4'))['db'];var utils=require(_0x01ef('0x5'));var logger=require(_0x01ef('0x6'))(_0x01ef('0x7'));var config=require('../../config/environment');var jayson=require(_0x01ef('0x8'));var client=jayson[_0x01ef('0x9')][_0x01ef('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4c79fd,_0x38e5b5,_0x2c93ca){return new BPromise(function(_0x31abfb,_0x173f0d){return client['request'](_0x4c79fd,_0x2c93ca)[_0x01ef('0xb')](function(_0x45e553){logger[_0x01ef('0xc')]('SugarcrmField,\x20%s,\x20%s',_0x38e5b5,_0x01ef('0xd'));logger[_0x01ef('0xe')](_0x01ef('0xf'),_0x38e5b5,_0x01ef('0xd'),JSON[_0x01ef('0x10')](_0x45e553));if(_0x45e553[_0x01ef('0x11')]){if(_0x45e553[_0x01ef('0x11')][_0x01ef('0x12')]===0x1f4){logger[_0x01ef('0x11')](_0x01ef('0x13'),_0x38e5b5,_0x45e553['error']['message']);return _0x173f0d(_0x45e553[_0x01ef('0x11')][_0x01ef('0x14')]);}logger[_0x01ef('0x11')](_0x01ef('0x13'),_0x38e5b5,_0x45e553['error'][_0x01ef('0x14')]);return _0x31abfb(_0x45e553[_0x01ef('0x11')][_0x01ef('0x14')]);}else{logger['info']('SugarcrmField,\x20%s,\x20%s',_0x38e5b5,_0x01ef('0xd'));_0x31abfb(_0x45e553[_0x01ef('0x15')][_0x01ef('0x14')]);}})['catch'](function(_0xda0389){logger['error'](_0x01ef('0x13'),_0x38e5b5,_0xda0389);_0x173f0d(_0xda0389);});});} \ No newline at end of file +var _0xd358=['util','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','SugarcrmField,\x20%s,\x20%s','request\x20sent','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','lodash'];(function(_0x523027,_0x4179ef){var _0xe69a94=function(_0x3b03dc){while(--_0x3b03dc){_0x523027['push'](_0x523027['shift']());}};_0xe69a94(++_0x4179ef);}(_0xd358,0x1e2));var _0x8d35=function(_0x2ed887,_0xf65537){_0x2ed887=_0x2ed887-0x0;var _0x5626b7=_0xd358[_0x2ed887];return _0x5626b7;};'use strict';var _=require(_0x8d35('0x0'));var util=require(_0x8d35('0x1'));var moment=require('moment');var BPromise=require(_0x8d35('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8d35('0x3'));var db=require(_0x8d35('0x4'))['db'];var utils=require(_0x8d35('0x5'));var logger=require('../../config/logger')(_0x8d35('0x6'));var config=require(_0x8d35('0x7'));var jayson=require(_0x8d35('0x8'));var client=jayson[_0x8d35('0x9')][_0x8d35('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x128de7,_0x2e3190,_0xaa0383){return new BPromise(function(_0x5242aa,_0x1ff55d){return client['request'](_0x128de7,_0xaa0383)['then'](function(_0x25e48f){logger['info'](_0x8d35('0xb'),_0x2e3190,_0x8d35('0xc'));logger[_0x8d35('0xd')](_0x8d35('0xe'),_0x2e3190,'request\x20sent',JSON['stringify'](_0x25e48f));if(_0x25e48f[_0x8d35('0xf')]){if(_0x25e48f['error'][_0x8d35('0x10')]===0x1f4){logger[_0x8d35('0xf')](_0x8d35('0xb'),_0x2e3190,_0x25e48f[_0x8d35('0xf')][_0x8d35('0x11')]);return _0x1ff55d(_0x25e48f[_0x8d35('0xf')]['message']);}logger['error'](_0x8d35('0xb'),_0x2e3190,_0x25e48f[_0x8d35('0xf')][_0x8d35('0x11')]);return _0x5242aa(_0x25e48f[_0x8d35('0xf')]['message']);}else{logger[_0x8d35('0x12')](_0x8d35('0xb'),_0x2e3190,'request\x20sent');_0x5242aa(_0x25e48f[_0x8d35('0x13')]['message']);}})[_0x8d35('0x14')](function(_0x414662){logger[_0x8d35('0xf')]('SugarcrmField,\x20%s,\x20%s',_0x2e3190,_0x414662);_0x1ff55d(_0x414662);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index 202c860..cf2a77d 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 _0x3140=['get','isAuthenticated','index','/:id','/:id/configurations','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerAccount.controller'];(function(_0x29c7ed,_0x389f4b){var _0x22b24d=function(_0x512d23){while(--_0x512d23){_0x29c7ed['push'](_0x29c7ed['shift']());}};_0x22b24d(++_0x389f4b);}(_0x3140,0xaf));var _0x0314=function(_0x505241,_0x54a73d){_0x505241=_0x505241-0x0;var _0x1a1fcb=_0x3140[_0x505241];return _0x1a1fcb;};'use strict';var multer=require(_0x0314('0x0'));var util=require(_0x0314('0x1'));var path=require(_0x0314('0x2'));var timeout=require(_0x0314('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x0314('0x4'));var auth=require(_0x0314('0x5'));var interaction=require(_0x0314('0x6'));var config=require(_0x0314('0x7'));var controller=require(_0x0314('0x8'));router[_0x0314('0x9')]('/',auth[_0x0314('0xa')](),controller[_0x0314('0xb')]);router[_0x0314('0x9')](_0x0314('0xc'),auth[_0x0314('0xa')](),controller['show']);router[_0x0314('0x9')](_0x0314('0xd'),auth['isAuthenticated'](),controller['getConfigurations']);router[_0x0314('0x9')]('/:id/fields',auth[_0x0314('0xa')](),controller[_0x0314('0xe')]);router[_0x0314('0xf')]('/',auth[_0x0314('0xa')](),controller[_0x0314('0x10')]);router[_0x0314('0xf')]('/:id/configurations',auth[_0x0314('0xa')](),controller[_0x0314('0x11')]);router[_0x0314('0x12')](_0x0314('0xc'),auth[_0x0314('0xa')](),controller[_0x0314('0x13')]);router[_0x0314('0x14')]('/:id',auth[_0x0314('0xa')](),controller[_0x0314('0x15')]);module[_0x0314('0x16')]=router; \ No newline at end of file +var _0x7b83=['./intVtigerAccount.controller','get','isAuthenticated','index','show','/:id/configurations','getFields','post','create','addConfiguration','/:id','update','delete','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../config/environment'];(function(_0x22d218,_0x391757){var _0x7102c4=function(_0x53d987){while(--_0x53d987){_0x22d218['push'](_0x22d218['shift']());}};_0x7102c4(++_0x391757);}(_0x7b83,0xa1));var _0x37b8=function(_0x5c9f9c,_0x2193ed){_0x5c9f9c=_0x5c9f9c-0x0;var _0x20350a=_0x7b83[_0x5c9f9c];return _0x20350a;};'use strict';var multer=require(_0x37b8('0x0'));var util=require(_0x37b8('0x1'));var path=require(_0x37b8('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x37b8('0x3')]();var fs_extra=require(_0x37b8('0x4'));var auth=require(_0x37b8('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x37b8('0x6'));var controller=require(_0x37b8('0x7'));router[_0x37b8('0x8')]('/',auth[_0x37b8('0x9')](),controller[_0x37b8('0xa')]);router[_0x37b8('0x8')]('/:id',auth[_0x37b8('0x9')](),controller[_0x37b8('0xb')]);router['get'](_0x37b8('0xc'),auth['isAuthenticated'](),controller['getConfigurations']);router['get']('/:id/fields',auth[_0x37b8('0x9')](),controller[_0x37b8('0xd')]);router[_0x37b8('0xe')]('/',auth[_0x37b8('0x9')](),controller[_0x37b8('0xf')]);router['post'](_0x37b8('0xc'),auth['isAuthenticated'](),controller[_0x37b8('0x10')]);router['put'](_0x37b8('0x11'),auth[_0x37b8('0x9')](),controller[_0x37b8('0x12')]);router[_0x37b8('0x13')](_0x37b8('0x11'),auth['isAuthenticated'](),controller['destroy']);module[_0x37b8('0x14')]=router; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.attributes.js b/server/api/intVtigerAccount/intVtigerAccount.attributes.js index 5b55265..d25fcb8 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 _0x3c83=['STRING','HelpDesk','sequelize'];(function(_0xd65530,_0x9a58cd){var _0x317898=function(_0x752ea5){while(--_0x752ea5){_0xd65530['push'](_0xd65530['shift']());}};_0x317898(++_0x9a58cd);}(_0x3c83,0x19a));var _0x33c8=function(_0x210bae,_0x59502b){_0x210bae=_0x210bae-0x0;var _0x5a0766=_0x3c83[_0x210bae];return _0x5a0766;};'use strict';var Sequelize=require(_0x33c8('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x33c8('0x1')]},'username':{'type':Sequelize[_0x33c8('0x1')],'allowNull':![]},'moduleName':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x33c8('0x2')},'remoteUri':{'type':Sequelize['STRING'],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x33c8('0x1')],'allowNull':![]},'accessKey':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0x6da4=['STRING','HelpDesk','sequelize','exports'];(function(_0x5bccd3,_0x4e2b7b){var _0x322dbc=function(_0x2f7b82){while(--_0x2f7b82){_0x5bccd3['push'](_0x5bccd3['shift']());}};_0x322dbc(++_0x4e2b7b);}(_0x6da4,0x116));var _0x46da=function(_0x3a25cf,_0x198b88){_0x3a25cf=_0x3a25cf-0x0;var _0x379207=_0x6da4[_0x3a25cf];return _0x379207;};'use strict';var Sequelize=require(_0x46da('0x0'));module[_0x46da('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x46da('0x2')]},'username':{'type':Sequelize[_0x46da('0x2')],'allowNull':![]},'moduleName':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x46da('0x3')},'remoteUri':{'type':Sequelize[_0x46da('0x2')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x46da('0x2')],'allowNull':![]},'accessKey':{'type':Sequelize[_0x46da('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 e5df411..7482cf2 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 _0x060e=['to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','send','index','VtigerAccount','rawAttributes','fieldName','key','model','map','name','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','keys','create','body','find','findOne','addConfiguration','AccountId','Subjects','getSubjects','channel','type','Descriptions','getDescriptions','VtigerConfiguration','VtigerField','getFields','username','description','moduleName','serverUrl','accessKey','lastIndexOf','format','GET','getchallenge','success','POST','login','result','token','describe','reference','owner','includes','remove','editable','false','label','startsWith','cf_','picklist','picklistValues','value','vTiger\x20error:\x20','test','statusCode','Wrong\x20credentials','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox'];(function(_0x21bc67,_0xf4ed68){var _0x31d142=function(_0x19daa7){while(--_0x19daa7){_0x21bc67['push'](_0x21bc67['shift']());}};_0x31d142(++_0xf4ed68);}(_0x060e,0x1ea));var _0xe060=function(_0x2812c2,_0x2b382d){_0x2812c2=_0x2812c2-0x0;var _0x218ac9=_0x060e[_0x2812c2];return _0x218ac9;};'use strict';var emlformat=require(_0xe060('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe060('0x1'));var jsonpatch=require(_0xe060('0x2'));var rp=require(_0xe060('0x3'));var moment=require(_0xe060('0x4'));var BPromise=require(_0xe060('0x5'));var Mustache=require(_0xe060('0x6'));var util=require(_0xe060('0x7'));var path=require(_0xe060('0x8'));var sox=require(_0xe060('0x9'));var csv=require(_0xe060('0xa'));var ejs=require(_0xe060('0xb'));var fs=require('fs');var fs_extra=require(_0xe060('0xc'));var _=require(_0xe060('0xd'));var squel=require(_0xe060('0xe'));var crypto=require('crypto');var jsforce=require(_0xe060('0xf'));var deskjs=require(_0xe060('0x10'));var toCsv=require(_0xe060('0xa'));var querystring=require('querystring');var Papa=require(_0xe060('0x11'));var Redis=require(_0xe060('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xe060('0x13'));var as=require(_0xe060('0x14'));var hardwareService=require(_0xe060('0x15'));var logger=require(_0xe060('0x16'))(_0xe060('0x17'));var utils=require(_0xe060('0x18'));var config=require(_0xe060('0x19'));var licenseUtil=require(_0xe060('0x1a'));var db=require(_0xe060('0x1b'))['db'];var integrations=require(_0xe060('0x1c'));function respondWithStatusCode(_0x5939cb,_0x45bb63){_0x45bb63=_0x45bb63||0xcc;return function(_0x50046){if(_0x50046){return _0x5939cb[_0xe060('0x1d')](_0x45bb63);}return _0x5939cb[_0xe060('0x1e')](_0x45bb63)[_0xe060('0x1f')]();};}function respondWithResult(_0xab13cf,_0xb8a84e){_0xb8a84e=_0xb8a84e||0xc8;return function(_0x35ec73){if(_0x35ec73){return _0xab13cf[_0xe060('0x1e')](_0xb8a84e)['json'](_0x35ec73);}};}function respondWithFilteredResult(_0x5d5197,_0x200ea8){return function(_0xeb59f4){if(_0xeb59f4){var _0x450894=typeof _0x200ea8[_0xe060('0x20')]==='undefined'&&typeof _0x200ea8[_0xe060('0x21')]===_0xe060('0x22');var _0x2f5d9f=_0xeb59f4[_0xe060('0x23')];var _0x176b6d=_0x450894?0x0:_0x200ea8[_0xe060('0x20')];var _0x4783d9=_0x450894?_0xeb59f4[_0xe060('0x23')]:_0x200ea8['offset']+_0x200ea8[_0xe060('0x21')];var _0x2e288b;if(_0x4783d9>=_0x2f5d9f){_0x4783d9=_0x2f5d9f;_0x2e288b=0xc8;}else{_0x2e288b=0xce;}_0x5d5197['status'](_0x2e288b);return _0x5d5197[_0xe060('0x24')](_0xe060('0x25'),_0x176b6d+'-'+_0x4783d9+'/'+_0x2f5d9f)[_0xe060('0x26')](_0xeb59f4);}return null;};}function patchUpdates(_0x561083){return function(_0x7a698a){try{jsonpatch[_0xe060('0x27')](_0x7a698a,_0x561083,!![]);}catch(_0x46d229){return BPromise[_0xe060('0x28')](_0x46d229);}return _0x7a698a[_0xe060('0x29')]();};}function saveUpdates(_0x8bf4b7,_0x757f67){return function(_0x3f87a8){if(_0x3f87a8){return _0x3f87a8[_0xe060('0x2a')](_0x8bf4b7)[_0xe060('0x2b')](function(_0x26cf0f){return _0x26cf0f;});}return null;};}function removeEntity(_0x10f36b,_0x1a5184){return function(_0x571ed3){if(_0x571ed3){return _0x571ed3[_0xe060('0x2c')]()[_0xe060('0x2b')](function(){_0x10f36b[_0xe060('0x1e')](0xcc)[_0xe060('0x1f')]();});}};}function handleEntityNotFound(_0x413441,_0x31d1bd){return function(_0x52f561){if(!_0x52f561){_0x413441['sendStatus'](0x194);}return _0x52f561;};}function handleError(_0x3a78e2,_0x35dd0d){_0x35dd0d=_0x35dd0d||0x1f4;return function(_0x287c85){logger[_0xe060('0x2d')](_0x287c85[_0xe060('0x2e')]);if(_0x287c85['name']){delete _0x287c85['name'];}_0x3a78e2[_0xe060('0x1e')](_0x35dd0d)[_0xe060('0x2f')](_0x287c85);};}exports[_0xe060('0x30')]=function(_0x330f88,_0x47102f){var _0x406b58={},_0x2157a0={},_0x44c0d1={'count':0x0,'rows':[]};var _0x20400b=_['map'](db[_0xe060('0x31')][_0xe060('0x32')],function(_0x112227){return{'name':_0x112227[_0xe060('0x33')],'type':_0x112227['type'][_0xe060('0x34')]};});_0x2157a0[_0xe060('0x35')]=_[_0xe060('0x36')](_0x20400b,_0xe060('0x37'));_0x2157a0[_0xe060('0x38')]=_['keys'](_0x330f88[_0xe060('0x38')]);_0x2157a0[_0xe060('0x39')]=_[_0xe060('0x3a')](_0x2157a0[_0xe060('0x35')],_0x2157a0[_0xe060('0x38')]);_0x406b58[_0xe060('0x3b')]=_[_0xe060('0x3a')](_0x2157a0[_0xe060('0x35')],qs[_0xe060('0x3c')](_0x330f88['query']['fields']));_0x406b58[_0xe060('0x3b')]=_0x406b58[_0xe060('0x3b')][_0xe060('0x3d')]?_0x406b58['attributes']:_0x2157a0[_0xe060('0x35')];if(!_0x330f88[_0xe060('0x38')][_0xe060('0x3e')](_0xe060('0x3f'))){_0x406b58[_0xe060('0x21')]=qs[_0xe060('0x21')](_0x330f88[_0xe060('0x38')][_0xe060('0x21')]);_0x406b58[_0xe060('0x20')]=qs['offset'](_0x330f88[_0xe060('0x38')][_0xe060('0x20')]);}_0x406b58[_0xe060('0x40')]=qs['sort'](_0x330f88[_0xe060('0x38')][_0xe060('0x41')]);_0x406b58[_0xe060('0x42')]=qs[_0xe060('0x39')](_[_0xe060('0x43')](_0x330f88[_0xe060('0x38')],_0x2157a0[_0xe060('0x39')]),_0x20400b);if(_0x330f88['query'][_0xe060('0x44')]){_0x406b58['where']=_[_0xe060('0x45')](_0x406b58[_0xe060('0x42')],{'$or':_['map'](_0x20400b,function(_0x420fb0){if(_0x420fb0['type']!==_0xe060('0x46')){var _0x5f4c65={};_0x5f4c65[_0x420fb0[_0xe060('0x37')]]={'$like':'%'+_0x330f88['query']['filter']+'%'};return _0x5f4c65;}})});}_0x406b58=_['merge']({},_0x406b58,_0x330f88[_0xe060('0x47')]);var _0x2593f1={'where':_0x406b58['where']};return db[_0xe060('0x31')][_0xe060('0x23')](_0x2593f1)[_0xe060('0x2b')](function(_0x58c4d1){_0x44c0d1[_0xe060('0x23')]=_0x58c4d1;if(_0x330f88[_0xe060('0x38')][_0xe060('0x48')]){_0x406b58[_0xe060('0x49')]=[{'all':!![]}];}return db[_0xe060('0x31')]['findAll'](_0x406b58);})[_0xe060('0x2b')](function(_0x43e04a){_0x44c0d1[_0xe060('0x4a')]=_0x43e04a;return _0x44c0d1;})['then'](respondWithFilteredResult(_0x47102f,_0x406b58))[_0xe060('0x4b')](handleError(_0x47102f,null));};exports[_0xe060('0x4c')]=function(_0x4f2c90,_0x4c8095){var _0x20872f={'raw':![],'where':{'id':_0x4f2c90[_0xe060('0x4d')]['id']}},_0x98a148={};_0x98a148[_0xe060('0x35')]=_['keys'](db['VtigerAccount'][_0xe060('0x32')]);_0x98a148[_0xe060('0x38')]=_[_0xe060('0x4e')](_0x4f2c90[_0xe060('0x38')]);_0x98a148[_0xe060('0x39')]=_[_0xe060('0x3a')](_0x98a148[_0xe060('0x35')],_0x98a148['query']);_0x20872f['attributes']=_['intersection'](_0x98a148[_0xe060('0x35')],qs[_0xe060('0x3c')](_0x4f2c90[_0xe060('0x38')][_0xe060('0x3c')]));_0x20872f['attributes']=_0x20872f[_0xe060('0x3b')][_0xe060('0x3d')]?_0x20872f[_0xe060('0x3b')]:_0x98a148[_0xe060('0x35')];if(_0x4f2c90[_0xe060('0x38')][_0xe060('0x48')]){_0x20872f['include']=[{'all':!![]}];}_0x20872f=_[_0xe060('0x45')]({},_0x20872f,_0x4f2c90[_0xe060('0x47')]);return db[_0xe060('0x31')]['find'](_0x20872f)[_0xe060('0x2b')](handleEntityNotFound(_0x4c8095,null))[_0xe060('0x2b')](respondWithResult(_0x4c8095,null))[_0xe060('0x4b')](handleError(_0x4c8095,null));};exports[_0xe060('0x4f')]=function(_0x22fa24,_0x5b2518){return db[_0xe060('0x31')][_0xe060('0x4f')](_0x22fa24[_0xe060('0x50')],{})[_0xe060('0x2b')](respondWithResult(_0x5b2518,0xc9))[_0xe060('0x4b')](handleError(_0x5b2518,null));};exports['update']=function(_0x5bf2e3,_0x2e60e5){if(_0x5bf2e3[_0xe060('0x50')]['id']){delete _0x5bf2e3[_0xe060('0x50')]['id'];}return db['VtigerAccount']['find']({'where':{'id':_0x5bf2e3[_0xe060('0x4d')]['id']}})[_0xe060('0x2b')](handleEntityNotFound(_0x2e60e5,null))[_0xe060('0x2b')](saveUpdates(_0x5bf2e3[_0xe060('0x50')],null))[_0xe060('0x2b')](respondWithResult(_0x2e60e5,null))[_0xe060('0x4b')](handleError(_0x2e60e5,null));};exports[_0xe060('0x2c')]=function(_0x466f31,_0x3855f5){return db[_0xe060('0x31')][_0xe060('0x51')]({'where':{'id':_0x466f31[_0xe060('0x4d')]['id']}})[_0xe060('0x2b')](handleEntityNotFound(_0x3855f5,null))[_0xe060('0x2b')](removeEntity(_0x3855f5,null))['catch'](handleError(_0x3855f5,null));};exports['getConfigurations']=function(_0x196876,_0x3a0950,_0x5aae16){var _0x54473f={};var _0x2a2e89={};var _0x4e24ee;var _0x12c648;return db[_0xe060('0x31')][_0xe060('0x52')]({'where':{'id':_0x196876['params']['id']}})[_0xe060('0x2b')](handleEntityNotFound(_0x3a0950,null))[_0xe060('0x2b')](function(_0x111c3e){if(_0x111c3e){_0x4e24ee=_0x111c3e;_0x2a2e89[_0xe060('0x35')]=_[_0xe060('0x4e')](db['VtigerConfiguration'][_0xe060('0x32')]);_0x2a2e89[_0xe060('0x38')]=_[_0xe060('0x4e')](_0x196876['query']);_0x2a2e89[_0xe060('0x39')]=_['intersection'](_0x2a2e89[_0xe060('0x35')],_0x2a2e89[_0xe060('0x38')]);_0x54473f[_0xe060('0x3b')]=_['intersection'](_0x2a2e89[_0xe060('0x35')],qs[_0xe060('0x3c')](_0x196876[_0xe060('0x38')][_0xe060('0x3c')]));_0x54473f['attributes']=_0x54473f[_0xe060('0x3b')][_0xe060('0x3d')]?_0x54473f[_0xe060('0x3b')]:_0x2a2e89['model'];_0x54473f[_0xe060('0x40')]=qs[_0xe060('0x41')](_0x196876[_0xe060('0x38')][_0xe060('0x41')]);_0x54473f[_0xe060('0x42')]=qs[_0xe060('0x39')](_[_0xe060('0x43')](_0x196876[_0xe060('0x38')],_0x2a2e89[_0xe060('0x39')]));if(_0x196876[_0xe060('0x38')][_0xe060('0x44')]){_0x54473f[_0xe060('0x42')]=_[_0xe060('0x45')](_0x54473f['where'],{'$or':_[_0xe060('0x36')](_0x54473f[_0xe060('0x3b')],function(_0x1ed542){var _0x26b9f4={};_0x26b9f4[_0x1ed542]={'$like':'%'+_0x196876[_0xe060('0x38')][_0xe060('0x44')]+'%'};return _0x26b9f4;})});}_0x54473f=_['merge']({},_0x54473f,_0x196876['options']);return _0x4e24ee['getConfigurations'](_0x54473f);}})['then'](function(_0x91b8ba){if(_0x91b8ba){_0x12c648=_0x91b8ba[_0xe060('0x3d')];if(!_0x196876[_0xe060('0x38')][_0xe060('0x3e')](_0xe060('0x3f'))){_0x54473f[_0xe060('0x21')]=qs['limit'](_0x196876[_0xe060('0x38')][_0xe060('0x21')]);_0x54473f[_0xe060('0x20')]=qs[_0xe060('0x20')](_0x196876[_0xe060('0x38')][_0xe060('0x20')]);}return _0x4e24ee['getConfigurations'](_0x54473f);}})[_0xe060('0x2b')](function(_0x45e42d){if(_0x45e42d){return _0x45e42d?{'count':_0x12c648,'rows':_0x45e42d}:null;}})[_0xe060('0x2b')](respondWithResult(_0x3a0950,null))[_0xe060('0x4b')](handleError(_0x3a0950,null));};exports[_0xe060('0x53')]=function(_0x2569b0,_0x8493f8,_0x14abf7){if(_0x2569b0[_0xe060('0x50')]['id']){delete _0x2569b0[_0xe060('0x50')]['id'];}return db['VtigerAccount'][_0xe060('0x52')]({'where':{'id':_0x2569b0[_0xe060('0x4d')]['id']}})['then'](handleEntityNotFound(_0x8493f8,null))[_0xe060('0x2b')](function(_0x382374){if(_0x382374){_0x2569b0[_0xe060('0x50')][_0xe060('0x54')]=_0x382374['id'];_0x2569b0[_0xe060('0x50')][_0xe060('0x55')]=integrations[_0xe060('0x56')](_0x2569b0[_0xe060('0x50')][_0xe060('0x57')],_0x2569b0[_0xe060('0x50')][_0xe060('0x58')]);_0x2569b0[_0xe060('0x50')][_0xe060('0x59')]=integrations[_0xe060('0x5a')](_0x2569b0['body'][_0xe060('0x57')],_0x2569b0['body']['type']);return db[_0xe060('0x5b')][_0xe060('0x4f')](_0x2569b0[_0xe060('0x50')],{'include':[{'model':db[_0xe060('0x5c')],'as':'Subjects'},{'model':db[_0xe060('0x5c')],'as':_0xe060('0x59')}]});}return null;})['then'](respondWithResult(_0x8493f8,null))[_0xe060('0x4b')](handleError(_0x8493f8,null));};var md5=require('md5');exports[_0xe060('0x5d')]=function(_0x4efa7d,_0x4bb528,_0x297dbd){var _0x595b06=null;var _0x542843=null;var _0x217c3d=null;var _0x2905b7=null;var _0x2a480a='';return db[_0xe060('0x31')][_0xe060('0x52')]({'where':{'id':_0x4efa7d[_0xe060('0x4d')]['id']},'attributes':['id',_0xe060('0x37'),_0xe060('0x5e'),_0xe060('0x5f'),_0xe060('0x60'),'remoteUri',_0xe060('0x61'),_0xe060('0x62')]})['then'](handleEntityNotFound(_0x4bb528,null))[_0xe060('0x2b')](function(_0x3da2ea){if(_0x3da2ea){_0x595b06=_0x3da2ea[_0xe060('0x5e')];_0x542843=_0x3da2ea[_0xe060('0x62')];_0x217c3d=_0x3da2ea[_0xe060('0x60')];_0x2a480a=_0x3da2ea['remoteUri'];var _0x110b44=_0x2a480a['slice'](-0x1);if(_0x110b44==='/'){_0x2a480a=_0x2a480a['substring'](0x0,_0x2a480a[_0xe060('0x63')](_0x110b44));}_0x2905b7=util[_0xe060('0x64')]('%s/webservice.php',_0x2a480a);var _0x5d0dbd={'method':_0xe060('0x65'),'uri':_0x2905b7,'qs':{'operation':_0xe060('0x66'),'username':_0x3da2ea['username']},'json':!![]};return rp(_0x5d0dbd);}})[_0xe060('0x2b')](function(_0x29adb4){if(_0x29adb4[_0xe060('0x67')]){var _0x45312b={'method':_0xe060('0x68'),'uri':_0x2905b7,'form':{'operation':_0xe060('0x69'),'username':_0x595b06,'accessKey':md5(_0x29adb4[_0xe060('0x6a')][_0xe060('0x6b')]+_0x542843)},'json':!![]};return rp(_0x45312b);}})[_0xe060('0x2b')](function(_0x4ef6f3){if(_0x4ef6f3['success']){var _0x3b3ab0={'method':'GET','uri':_0x2905b7,'qs':{'operation':_0xe060('0x6c'),'username':_0x595b06,'sessionName':_0x4ef6f3[_0xe060('0x6a')]['sessionName'],'elementType':_0x217c3d},'json':!![]};return rp(_0x3b3ab0);}})[_0xe060('0x2b')](function(_0x52efa2){if(_0x52efa2['success']){var _0x3fedbb=['autogenerated',_0xe060('0x6d'),_0xe060('0x6e')];_['remove'](_0x52efa2[_0xe060('0x6a')]['fields'],function(_0x111d97){return _0x3fedbb[_0xe060('0x6f')](_0x111d97[_0xe060('0x58')]['name']);});_[_0xe060('0x70')](_0x52efa2[_0xe060('0x6a')][_0xe060('0x3c')],function(_0x2a9d02){return _0x2a9d02[_0xe060('0x71')]===_0xe060('0x72');});return{'count':_0x52efa2[_0xe060('0x6a')][_0xe060('0x3c')][_0xe060('0x3d')],'rows':_[_0xe060('0x36')](_0x52efa2[_0xe060('0x6a')][_0xe060('0x3c')],function(_0x34db10){return{'id':_0x34db10[_0xe060('0x37')],'name':_0x34db10[_0xe060('0x73')],'custom':_[_0xe060('0x74')](_0x34db10[_0xe060('0x37')],_0xe060('0x75'))?!![]:![],'options':_0x34db10['type'][_0xe060('0x37')]===_0xe060('0x76')&&_0x34db10[_0xe060('0x58')][_0xe060('0x77')][_0xe060('0x3d')]>0x0?_[_0xe060('0x36')](_0x34db10[_0xe060('0x58')][_0xe060('0x77')],function(_0x5415f4){return{'name':_0x5415f4[_0xe060('0x73')],'value':_0x5415f4[_0xe060('0x78')]};}):[]};})};}})[_0xe060('0x2b')](respondWithResult(_0x4bb528,null))[_0xe060('0x4b')](function(_0x23f46b){console['log'](_0xe060('0x79')+_0x23f46b);var _0x1d22fd=_0x4efa7d['query'][_0xe060('0x7a')]?0x1f4:_0x23f46b[_0xe060('0x7b')]||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s',_0xe060('0x5d'),_0x1d22fd,JSON['stringify'](_0x23f46b));delete _0x23f46b[_0xe060('0x37')];if(_0x1d22fd===0x191){_0x1d22fd=0x190;}_0x4bb528[_0xe060('0x1e')](_0x1d22fd)['send'](_0x4efa7d[_0xe060('0x38')][_0xe060('0x7a')]?{'message':_0xe060('0x7c'),'statusCode':_0x23f46b['statusCode']}:_0x23f46b);});}; \ No newline at end of file +var _0x3d53=['catch','create','body','getConfigurations','findOne','VtigerConfiguration','order','filter','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','VtigerField','md5','getFields','username','moduleName','remoteUri','serverUrl','accessKey','slice','substring','lastIndexOf','format','%s/webservice.php','POST','login','token','success','describe','result','sessionName','autogenerated','owner','includes','remove','editable','false','label','startsWith','cf_','picklist','picklistValues','log','vTiger\x20error:\x20','test','error','Wrong\x20credentials','statusCode','eml-format','rimraf','zip-dir','request-promise','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','json','offset','count','set','Content-Range','apply','reject','update','destroy','then','end','sendStatus','stack','name','send','index','VtigerAccount','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','pick','where','map','VIRTUAL','options','includeAll','include','findAll','rows','show','params','merge','find'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x3d53,0xae));var _0x33d5=function(_0x349148,_0x31eabb){_0x349148=_0x349148-0x0;var _0x2f2b0f=_0x3d53[_0x349148];return _0x2f2b0f;};'use strict';var emlformat=require(_0x33d5('0x0'));var rimraf=require(_0x33d5('0x1'));var zipdir=require(_0x33d5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x33d5('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x33d5('0x4'));var util=require(_0x33d5('0x5'));var path=require(_0x33d5('0x6'));var sox=require('sox');var csv=require(_0x33d5('0x7'));var ejs=require(_0x33d5('0x8'));var fs=require('fs');var fs_extra=require(_0x33d5('0x9'));var _=require(_0x33d5('0xa'));var squel=require(_0x33d5('0xb'));var crypto=require(_0x33d5('0xc'));var jsforce=require(_0x33d5('0xd'));var deskjs=require(_0x33d5('0xe'));var toCsv=require(_0x33d5('0x7'));var querystring=require('querystring');var Papa=require(_0x33d5('0xf'));var Redis=require('ioredis');var authService=require(_0x33d5('0x10'));var qs=require(_0x33d5('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x33d5('0x12'));var logger=require(_0x33d5('0x13'))('api');var utils=require(_0x33d5('0x14'));var config=require(_0x33d5('0x15'));var licenseUtil=require(_0x33d5('0x16'));var db=require(_0x33d5('0x17'))['db'];var integrations=require(_0x33d5('0x18'));function respondWithStatusCode(_0x2745cc,_0x277acb){_0x277acb=_0x277acb||0xcc;return function(_0x1fa7ec){if(_0x1fa7ec){return _0x2745cc['sendStatus'](_0x277acb);}return _0x2745cc[_0x33d5('0x19')](_0x277acb)['end']();};}function respondWithResult(_0x1252e9,_0x259b66){_0x259b66=_0x259b66||0xc8;return function(_0x58388e){if(_0x58388e){return _0x1252e9[_0x33d5('0x19')](_0x259b66)[_0x33d5('0x1a')](_0x58388e);}};}function respondWithFilteredResult(_0x382a3f,_0x2c37dc){return function(_0x50f86c){if(_0x50f86c){var _0x422ad4=typeof _0x2c37dc[_0x33d5('0x1b')]==='undefined'&&typeof _0x2c37dc['limit']==='undefined';var _0x27df43=_0x50f86c[_0x33d5('0x1c')];var _0x2f659c=_0x422ad4?0x0:_0x2c37dc[_0x33d5('0x1b')];var _0x3bc7b5=_0x422ad4?_0x50f86c[_0x33d5('0x1c')]:_0x2c37dc[_0x33d5('0x1b')]+_0x2c37dc['limit'];var _0x44d186;if(_0x3bc7b5>=_0x27df43){_0x3bc7b5=_0x27df43;_0x44d186=0xc8;}else{_0x44d186=0xce;}_0x382a3f[_0x33d5('0x19')](_0x44d186);return _0x382a3f[_0x33d5('0x1d')](_0x33d5('0x1e'),_0x2f659c+'-'+_0x3bc7b5+'/'+_0x27df43)[_0x33d5('0x1a')](_0x50f86c);}return null;};}function patchUpdates(_0x27531f){return function(_0x256cbc){try{jsonpatch[_0x33d5('0x1f')](_0x256cbc,_0x27531f,!![]);}catch(_0x54385c){return BPromise[_0x33d5('0x20')](_0x54385c);}return _0x256cbc['save']();};}function saveUpdates(_0x25d49a,_0x2fbfa6){return function(_0x209665){if(_0x209665){return _0x209665[_0x33d5('0x21')](_0x25d49a)['then'](function(_0x19245b){return _0x19245b;});}return null;};}function removeEntity(_0x177ded,_0x53ab4c){return function(_0x24356e){if(_0x24356e){return _0x24356e[_0x33d5('0x22')]()[_0x33d5('0x23')](function(){_0x177ded['status'](0xcc)[_0x33d5('0x24')]();});}};}function handleEntityNotFound(_0x5871f6,_0x434708){return function(_0x37bac9){if(!_0x37bac9){_0x5871f6[_0x33d5('0x25')](0x194);}return _0x37bac9;};}function handleError(_0x3cfffb,_0x41ecdf){_0x41ecdf=_0x41ecdf||0x1f4;return function(_0x3a9c52){logger['error'](_0x3a9c52[_0x33d5('0x26')]);if(_0x3a9c52[_0x33d5('0x27')]){delete _0x3a9c52['name'];}_0x3cfffb[_0x33d5('0x19')](_0x41ecdf)[_0x33d5('0x28')](_0x3a9c52);};}exports[_0x33d5('0x29')]=function(_0xd43a55,_0x5c0c43){var _0x5259d1={},_0x414e41={},_0xc2ef95={'count':0x0,'rows':[]};var _0x55ae0d=_['map'](db[_0x33d5('0x2a')][_0x33d5('0x2b')],function(_0x41c4a8){return{'name':_0x41c4a8[_0x33d5('0x2c')],'type':_0x41c4a8[_0x33d5('0x2d')][_0x33d5('0x2e')]};});_0x414e41[_0x33d5('0x2f')]=_['map'](_0x55ae0d,_0x33d5('0x27'));_0x414e41['query']=_[_0x33d5('0x30')](_0xd43a55['query']);_0x414e41[_0x33d5('0x31')]=_[_0x33d5('0x32')](_0x414e41[_0x33d5('0x2f')],_0x414e41[_0x33d5('0x33')]);_0x5259d1[_0x33d5('0x34')]=_[_0x33d5('0x32')](_0x414e41[_0x33d5('0x2f')],qs[_0x33d5('0x35')](_0xd43a55[_0x33d5('0x33')][_0x33d5('0x35')]));_0x5259d1[_0x33d5('0x34')]=_0x5259d1['attributes'][_0x33d5('0x36')]?_0x5259d1[_0x33d5('0x34')]:_0x414e41['model'];if(!_0xd43a55[_0x33d5('0x33')][_0x33d5('0x37')](_0x33d5('0x38'))){_0x5259d1[_0x33d5('0x39')]=qs[_0x33d5('0x39')](_0xd43a55[_0x33d5('0x33')][_0x33d5('0x39')]);_0x5259d1[_0x33d5('0x1b')]=qs[_0x33d5('0x1b')](_0xd43a55[_0x33d5('0x33')][_0x33d5('0x1b')]);}_0x5259d1['order']=qs['sort'](_0xd43a55['query'][_0x33d5('0x3a')]);_0x5259d1['where']=qs[_0x33d5('0x31')](_[_0x33d5('0x3b')](_0xd43a55[_0x33d5('0x33')],_0x414e41[_0x33d5('0x31')]),_0x55ae0d);if(_0xd43a55['query']['filter']){_0x5259d1['where']=_['merge'](_0x5259d1[_0x33d5('0x3c')],{'$or':_[_0x33d5('0x3d')](_0x55ae0d,function(_0x46698d){if(_0x46698d[_0x33d5('0x2d')]!==_0x33d5('0x3e')){var _0x2647e2={};_0x2647e2[_0x46698d[_0x33d5('0x27')]]={'$like':'%'+_0xd43a55['query']['filter']+'%'};return _0x2647e2;}})});}_0x5259d1=_['merge']({},_0x5259d1,_0xd43a55[_0x33d5('0x3f')]);var _0x263a68={'where':_0x5259d1[_0x33d5('0x3c')]};return db[_0x33d5('0x2a')][_0x33d5('0x1c')](_0x263a68)[_0x33d5('0x23')](function(_0x1030e5){_0xc2ef95[_0x33d5('0x1c')]=_0x1030e5;if(_0xd43a55[_0x33d5('0x33')][_0x33d5('0x40')]){_0x5259d1[_0x33d5('0x41')]=[{'all':!![]}];}return db['VtigerAccount'][_0x33d5('0x42')](_0x5259d1);})[_0x33d5('0x23')](function(_0xbe203e){_0xc2ef95[_0x33d5('0x43')]=_0xbe203e;return _0xc2ef95;})[_0x33d5('0x23')](respondWithFilteredResult(_0x5c0c43,_0x5259d1))['catch'](handleError(_0x5c0c43,null));};exports[_0x33d5('0x44')]=function(_0x40a9a2,_0x5080cc){var _0xcf77af={'raw':![],'where':{'id':_0x40a9a2[_0x33d5('0x45')]['id']}},_0x24e2dc={};_0x24e2dc[_0x33d5('0x2f')]=_[_0x33d5('0x30')](db[_0x33d5('0x2a')][_0x33d5('0x2b')]);_0x24e2dc['query']=_[_0x33d5('0x30')](_0x40a9a2[_0x33d5('0x33')]);_0x24e2dc['filters']=_[_0x33d5('0x32')](_0x24e2dc['model'],_0x24e2dc[_0x33d5('0x33')]);_0xcf77af['attributes']=_[_0x33d5('0x32')](_0x24e2dc[_0x33d5('0x2f')],qs['fields'](_0x40a9a2['query'][_0x33d5('0x35')]));_0xcf77af[_0x33d5('0x34')]=_0xcf77af[_0x33d5('0x34')][_0x33d5('0x36')]?_0xcf77af[_0x33d5('0x34')]:_0x24e2dc['model'];if(_0x40a9a2[_0x33d5('0x33')][_0x33d5('0x40')]){_0xcf77af[_0x33d5('0x41')]=[{'all':!![]}];}_0xcf77af=_[_0x33d5('0x46')]({},_0xcf77af,_0x40a9a2[_0x33d5('0x3f')]);return db[_0x33d5('0x2a')][_0x33d5('0x47')](_0xcf77af)['then'](handleEntityNotFound(_0x5080cc,null))[_0x33d5('0x23')](respondWithResult(_0x5080cc,null))[_0x33d5('0x48')](handleError(_0x5080cc,null));};exports['create']=function(_0x3d6cd2,_0x176060){return db['VtigerAccount'][_0x33d5('0x49')](_0x3d6cd2[_0x33d5('0x4a')],{})[_0x33d5('0x23')](respondWithResult(_0x176060,0xc9))[_0x33d5('0x48')](handleError(_0x176060,null));};exports[_0x33d5('0x21')]=function(_0x3e0a03,_0x2b4154){if(_0x3e0a03[_0x33d5('0x4a')]['id']){delete _0x3e0a03[_0x33d5('0x4a')]['id'];}return db['VtigerAccount'][_0x33d5('0x47')]({'where':{'id':_0x3e0a03[_0x33d5('0x45')]['id']}})['then'](handleEntityNotFound(_0x2b4154,null))[_0x33d5('0x23')](saveUpdates(_0x3e0a03[_0x33d5('0x4a')],null))[_0x33d5('0x23')](respondWithResult(_0x2b4154,null))[_0x33d5('0x48')](handleError(_0x2b4154,null));};exports[_0x33d5('0x22')]=function(_0x333ca1,_0x3d01c0){return db['VtigerAccount']['find']({'where':{'id':_0x333ca1[_0x33d5('0x45')]['id']}})[_0x33d5('0x23')](handleEntityNotFound(_0x3d01c0,null))['then'](removeEntity(_0x3d01c0,null))[_0x33d5('0x48')](handleError(_0x3d01c0,null));};exports[_0x33d5('0x4b')]=function(_0x480517,_0x445a3d,_0x4d6d4b){var _0x20ba5e={};var _0x5dcba9={};var _0x514b61;var _0x15aed3;return db[_0x33d5('0x2a')][_0x33d5('0x4c')]({'where':{'id':_0x480517['params']['id']}})[_0x33d5('0x23')](handleEntityNotFound(_0x445a3d,null))[_0x33d5('0x23')](function(_0x109f6b){if(_0x109f6b){_0x514b61=_0x109f6b;_0x5dcba9[_0x33d5('0x2f')]=_[_0x33d5('0x30')](db[_0x33d5('0x4d')]['rawAttributes']);_0x5dcba9[_0x33d5('0x33')]=_['keys'](_0x480517[_0x33d5('0x33')]);_0x5dcba9[_0x33d5('0x31')]=_[_0x33d5('0x32')](_0x5dcba9['model'],_0x5dcba9[_0x33d5('0x33')]);_0x20ba5e[_0x33d5('0x34')]=_['intersection'](_0x5dcba9['model'],qs['fields'](_0x480517['query'][_0x33d5('0x35')]));_0x20ba5e['attributes']=_0x20ba5e[_0x33d5('0x34')][_0x33d5('0x36')]?_0x20ba5e['attributes']:_0x5dcba9['model'];_0x20ba5e[_0x33d5('0x4e')]=qs[_0x33d5('0x3a')](_0x480517[_0x33d5('0x33')][_0x33d5('0x3a')]);_0x20ba5e[_0x33d5('0x3c')]=qs[_0x33d5('0x31')](_[_0x33d5('0x3b')](_0x480517['query'],_0x5dcba9['filters']));if(_0x480517[_0x33d5('0x33')][_0x33d5('0x4f')]){_0x20ba5e[_0x33d5('0x3c')]=_[_0x33d5('0x46')](_0x20ba5e[_0x33d5('0x3c')],{'$or':_[_0x33d5('0x3d')](_0x20ba5e[_0x33d5('0x34')],function(_0x498552){var _0x21280e={};_0x21280e[_0x498552]={'$like':'%'+_0x480517[_0x33d5('0x33')][_0x33d5('0x4f')]+'%'};return _0x21280e;})});}_0x20ba5e=_[_0x33d5('0x46')]({},_0x20ba5e,_0x480517['options']);return _0x514b61[_0x33d5('0x4b')](_0x20ba5e);}})[_0x33d5('0x23')](function(_0x21165a){if(_0x21165a){_0x15aed3=_0x21165a[_0x33d5('0x36')];if(!_0x480517['query'][_0x33d5('0x37')](_0x33d5('0x38'))){_0x20ba5e[_0x33d5('0x39')]=qs[_0x33d5('0x39')](_0x480517['query'][_0x33d5('0x39')]);_0x20ba5e['offset']=qs[_0x33d5('0x1b')](_0x480517['query'][_0x33d5('0x1b')]);}return _0x514b61[_0x33d5('0x4b')](_0x20ba5e);}})[_0x33d5('0x23')](function(_0x43bd8a){if(_0x43bd8a){return _0x43bd8a?{'count':_0x15aed3,'rows':_0x43bd8a}:null;}})['then'](respondWithResult(_0x445a3d,null))[_0x33d5('0x48')](handleError(_0x445a3d,null));};exports[_0x33d5('0x50')]=function(_0x52c6f3,_0x3631c5,_0x55097d){if(_0x52c6f3['body']['id']){delete _0x52c6f3[_0x33d5('0x4a')]['id'];}return db[_0x33d5('0x2a')][_0x33d5('0x4c')]({'where':{'id':_0x52c6f3['params']['id']}})[_0x33d5('0x23')](handleEntityNotFound(_0x3631c5,null))['then'](function(_0x5e4b04){if(_0x5e4b04){_0x52c6f3[_0x33d5('0x4a')][_0x33d5('0x51')]=_0x5e4b04['id'];_0x52c6f3['body'][_0x33d5('0x52')]=integrations[_0x33d5('0x53')](_0x52c6f3[_0x33d5('0x4a')][_0x33d5('0x54')],_0x52c6f3[_0x33d5('0x4a')][_0x33d5('0x2d')]);_0x52c6f3[_0x33d5('0x4a')][_0x33d5('0x55')]=integrations['getDescriptions'](_0x52c6f3[_0x33d5('0x4a')][_0x33d5('0x54')],_0x52c6f3[_0x33d5('0x4a')][_0x33d5('0x2d')]);return db[_0x33d5('0x4d')][_0x33d5('0x49')](_0x52c6f3[_0x33d5('0x4a')],{'include':[{'model':db[_0x33d5('0x56')],'as':_0x33d5('0x52')},{'model':db['VtigerField'],'as':_0x33d5('0x55')}]});}return null;})[_0x33d5('0x23')](respondWithResult(_0x3631c5,null))[_0x33d5('0x48')](handleError(_0x3631c5,null));};var md5=require(_0x33d5('0x57'));exports[_0x33d5('0x58')]=function(_0x32b8a3,_0x33befc,_0x54c39a){var _0x1a09f2=null;var _0x267ed3=null;var _0x5d4cad=null;var _0x208c0e=null;var _0x47354d='';return db[_0x33d5('0x2a')][_0x33d5('0x4c')]({'where':{'id':_0x32b8a3[_0x33d5('0x45')]['id']},'attributes':['id',_0x33d5('0x27'),_0x33d5('0x59'),'description',_0x33d5('0x5a'),_0x33d5('0x5b'),_0x33d5('0x5c'),_0x33d5('0x5d')]})['then'](handleEntityNotFound(_0x33befc,null))[_0x33d5('0x23')](function(_0x25e8f7){if(_0x25e8f7){_0x1a09f2=_0x25e8f7[_0x33d5('0x59')];_0x267ed3=_0x25e8f7['accessKey'];_0x5d4cad=_0x25e8f7['moduleName'];_0x47354d=_0x25e8f7[_0x33d5('0x5b')];var _0x2512fb=_0x47354d[_0x33d5('0x5e')](-0x1);if(_0x2512fb==='/'){_0x47354d=_0x47354d[_0x33d5('0x5f')](0x0,_0x47354d[_0x33d5('0x60')](_0x2512fb));}_0x208c0e=util[_0x33d5('0x61')](_0x33d5('0x62'),_0x47354d);var _0xc7f7ed={'method':'GET','uri':_0x208c0e,'qs':{'operation':'getchallenge','username':_0x25e8f7[_0x33d5('0x59')]},'json':!![]};return rp(_0xc7f7ed);}})[_0x33d5('0x23')](function(_0x2ee65c){if(_0x2ee65c['success']){var _0x807ee6={'method':_0x33d5('0x63'),'uri':_0x208c0e,'form':{'operation':_0x33d5('0x64'),'username':_0x1a09f2,'accessKey':md5(_0x2ee65c['result'][_0x33d5('0x65')]+_0x267ed3)},'json':!![]};return rp(_0x807ee6);}})[_0x33d5('0x23')](function(_0x3a1601){if(_0x3a1601[_0x33d5('0x66')]){var _0x335bcc={'method':'GET','uri':_0x208c0e,'qs':{'operation':_0x33d5('0x67'),'username':_0x1a09f2,'sessionName':_0x3a1601[_0x33d5('0x68')][_0x33d5('0x69')],'elementType':_0x5d4cad},'json':!![]};return rp(_0x335bcc);}})[_0x33d5('0x23')](function(_0x3b9287){if(_0x3b9287[_0x33d5('0x66')]){var _0x551bc4=[_0x33d5('0x6a'),'reference',_0x33d5('0x6b')];_['remove'](_0x3b9287[_0x33d5('0x68')][_0x33d5('0x35')],function(_0x4ba864){return _0x551bc4[_0x33d5('0x6c')](_0x4ba864[_0x33d5('0x2d')][_0x33d5('0x27')]);});_[_0x33d5('0x6d')](_0x3b9287[_0x33d5('0x68')][_0x33d5('0x35')],function(_0x1ff16b){return _0x1ff16b[_0x33d5('0x6e')]===_0x33d5('0x6f');});return{'count':_0x3b9287[_0x33d5('0x68')][_0x33d5('0x35')][_0x33d5('0x36')],'rows':_[_0x33d5('0x3d')](_0x3b9287[_0x33d5('0x68')][_0x33d5('0x35')],function(_0x5d2483){return{'id':_0x5d2483[_0x33d5('0x27')],'name':_0x5d2483[_0x33d5('0x70')],'custom':_[_0x33d5('0x71')](_0x5d2483[_0x33d5('0x27')],_0x33d5('0x72'))?!![]:![],'options':_0x5d2483[_0x33d5('0x2d')]['name']===_0x33d5('0x73')&&_0x5d2483['type'][_0x33d5('0x74')][_0x33d5('0x36')]>0x0?_[_0x33d5('0x3d')](_0x5d2483[_0x33d5('0x2d')][_0x33d5('0x74')],function(_0x23823f){return{'name':_0x23823f['label'],'value':_0x23823f['value']};}):[]};})};}})[_0x33d5('0x23')](respondWithResult(_0x33befc,null))[_0x33d5('0x48')](function(_0x4c3156){console[_0x33d5('0x75')](_0x33d5('0x76')+_0x4c3156);var _0x9eaee3=_0x32b8a3[_0x33d5('0x33')][_0x33d5('0x77')]?0x1f4:_0x4c3156['statusCode']||0x1f4;logger[_0x33d5('0x78')]('getFields,\x20%s,\x20%s,\x20%s',_0x33d5('0x58'),_0x9eaee3,JSON['stringify'](_0x4c3156));delete _0x4c3156['name'];if(_0x9eaee3===0x191){_0x9eaee3=0x190;}_0x33befc['status'](_0x9eaee3)[_0x33d5('0x28')](_0x32b8a3[_0x33d5('0x33')]['test']?{'message':_0x33d5('0x79'),'statusCode':_0x4c3156[_0x33d5('0x7a')]}:_0x4c3156);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index dcedda4..4d89903 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 _0x5915=['lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./intVtigerAccount.attributes','../../components/integrations/configuration','define','VtigerAccount'];(function(_0x4855d7,_0x533b87){var _0x8b0352=function(_0x56b162){while(--_0x56b162){_0x4855d7['push'](_0x4855d7['shift']());}};_0x8b0352(++_0x533b87);}(_0x5915,0x1ec));var _0x5591=function(_0x4cb50c,_0x6f6c27){_0x4cb50c=_0x4cb50c-0x0;var _0x334ed8=_0x5915[_0x4cb50c];return _0x334ed8;};'use strict';var _=require(_0x5591('0x0'));var util=require(_0x5591('0x1'));var logger=require(_0x5591('0x2'))('api');var moment=require('moment');var BPromise=require(_0x5591('0x3'));var rp=require(_0x5591('0x4'));var fs=require('fs');var path=require(_0x5591('0x5'));var rimraf=require(_0x5591('0x6'));var config=require(_0x5591('0x7'));var attributes=require(_0x5591('0x8'));var integrations=require(_0x5591('0x9'));module['exports']=function(_0x58d26e,_0x5ba182){return _0x58d26e[_0x5591('0xa')](_0x5591('0xb'),attributes,{'tableName':'int_vtiger_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbf07=['../../components/integrations/configuration','define','VtigerAccount','int_vtiger_accounts','lodash','../../config/logger','api','bluebird','path','../../config/environment','./intVtigerAccount.attributes'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbf07,0x17a));var _0x7bf0=function(_0x1314d4,_0xb0b16d){_0x1314d4=_0x1314d4-0x0;var _0x584ba5=_0xbf07[_0x1314d4];return _0x584ba5;};'use strict';var _=require(_0x7bf0('0x0'));var util=require('util');var logger=require(_0x7bf0('0x1'))(_0x7bf0('0x2'));var moment=require('moment');var BPromise=require(_0x7bf0('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7bf0('0x4'));var rimraf=require('rimraf');var config=require(_0x7bf0('0x5'));var attributes=require(_0x7bf0('0x6'));var integrations=require(_0x7bf0('0x7'));module['exports']=function(_0x218ce6,_0x40a20f){return _0x218ce6[_0x7bf0('0x8')](_0x7bf0('0x9'),attributes,{'tableName':_0x7bf0('0xa'),'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 23362c9..502bbb5 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 _0x36ee=['message','info','result','catch','GetVtigerAccount','VtigerAccount','findAll','options','raw','where','attributes','include','map','model','find','ShowVtigerAccount','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','VtigerAccount,\x20%s,\x20%s','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0xa8563a,_0x3f4c62){var _0x322a97=function(_0x4fa06f){while(--_0x4fa06f){_0xa8563a['push'](_0xa8563a['shift']());}};_0x322a97(++_0x3f4c62);}(_0x36ee,0xe8));var _0xe36e=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x36ee[_0x5b644e];return _0x49c6bf;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe36e('0x0'));var BPromise=require('bluebird');var rs=require(_0xe36e('0x1'));var fs=require('fs');var Redis=require(_0xe36e('0x2'));var db=require(_0xe36e('0x3'))['db'];var utils=require(_0xe36e('0x4'));var logger=require(_0xe36e('0x5'))(_0xe36e('0x6'));var config=require(_0xe36e('0x7'));var jayson=require(_0xe36e('0x8'));var client=jayson[_0xe36e('0x9')][_0xe36e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x21be0b,_0x1aa596,_0x51b4bd){return new BPromise(function(_0x74b4b7,_0x4aebdd){return client[_0xe36e('0xb')](_0x21be0b,_0x51b4bd)[_0xe36e('0xc')](function(_0x46f239){logger['info'](_0xe36e('0xd'),_0x1aa596,'request\x20sent');logger[_0xe36e('0xe')](_0xe36e('0xf'),_0x1aa596,_0xe36e('0x10'),JSON[_0xe36e('0x11')](_0x46f239));if(_0x46f239[_0xe36e('0x12')]){if(_0x46f239[_0xe36e('0x12')][_0xe36e('0x13')]===0x1f4){logger[_0xe36e('0x12')]('VtigerAccount,\x20%s,\x20%s',_0x1aa596,_0x46f239[_0xe36e('0x12')][_0xe36e('0x14')]);return _0x4aebdd(_0x46f239[_0xe36e('0x12')][_0xe36e('0x14')]);}logger['error'](_0xe36e('0xd'),_0x1aa596,_0x46f239['error']['message']);return _0x74b4b7(_0x46f239[_0xe36e('0x12')][_0xe36e('0x14')]);}else{logger[_0xe36e('0x15')](_0xe36e('0xd'),_0x1aa596,_0xe36e('0x10'));_0x74b4b7(_0x46f239[_0xe36e('0x16')][_0xe36e('0x14')]);}})[_0xe36e('0x17')](function(_0x387c37){logger[_0xe36e('0x12')]('VtigerAccount,\x20%s,\x20%s',_0x1aa596,_0x387c37);_0x4aebdd(_0x387c37);});});}exports[_0xe36e('0x18')]=function(_0x2184ae){var _0x56c019=this;return new Promise(function(_0x21d9a3,_0x533c06){return db[_0xe36e('0x19')][_0xe36e('0x1a')]({'raw':_0x2184ae['options']?_0x2184ae[_0xe36e('0x1b')][_0xe36e('0x1c')]===undefined?!![]:![]:!![],'where':_0x2184ae[_0xe36e('0x1b')]?_0x2184ae['options'][_0xe36e('0x1d')]||null:null,'attributes':_0x2184ae[_0xe36e('0x1b')]?_0x2184ae[_0xe36e('0x1b')][_0xe36e('0x1e')]||null:null,'limit':_0x2184ae[_0xe36e('0x1b')]?_0x2184ae[_0xe36e('0x1b')]['limit']||null:null,'include':_0x2184ae[_0xe36e('0x1b')]?_0x2184ae[_0xe36e('0x1b')][_0xe36e('0x1f')]?_[_0xe36e('0x20')](_0x2184ae[_0xe36e('0x1b')]['include'],function(_0x598a7a){return{'model':db[_0x598a7a[_0xe36e('0x21')]],'as':_0x598a7a['as'],'attributes':_0x598a7a[_0xe36e('0x1e')],'include':_0x598a7a[_0xe36e('0x1f')]?_[_0xe36e('0x20')](_0x598a7a[_0xe36e('0x1f')],function(_0x1507f9){return{'model':db[_0x1507f9[_0xe36e('0x21')]],'as':_0x1507f9['as'],'attributes':_0x1507f9['attributes'],'include':_0x1507f9[_0xe36e('0x1f')]?_[_0xe36e('0x20')](_0x1507f9[_0xe36e('0x1f')],function(_0x262caa){return{'model':db[_0x262caa['model']],'as':_0x262caa['as'],'attributes':_0x262caa[_0xe36e('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xf7b02e){logger['info'](_0xe36e('0x18'),_0x2184ae);logger['debug'](_0xe36e('0x18'),_0x2184ae,JSON['stringify'](_0xf7b02e));_0x21d9a3(_0xf7b02e);})[_0xe36e('0x17')](function(_0x59548b){logger['error']('GetVtigerAccount',_0x59548b['message'],_0x2184ae);_0x533c06(_0x56c019[_0xe36e('0x12')](0x1f4,_0x59548b[_0xe36e('0x14')]));});});};exports['ShowVtigerAccount']=function(_0x4ac819){var _0x1fa1ec=this;return new Promise(function(_0xb8d44e,_0x259e19){return db[_0xe36e('0x19')][_0xe36e('0x22')]({'raw':_0x4ac819[_0xe36e('0x1b')]?_0x4ac819['options'][_0xe36e('0x1c')]===undefined?!![]:![]:!![],'where':_0x4ac819[_0xe36e('0x1b')]?_0x4ac819['options'][_0xe36e('0x1d')]||null:null,'attributes':_0x4ac819[_0xe36e('0x1b')]?_0x4ac819[_0xe36e('0x1b')][_0xe36e('0x1e')]||null:null,'include':_0x4ac819[_0xe36e('0x1b')]?_0x4ac819[_0xe36e('0x1b')][_0xe36e('0x1f')]?_[_0xe36e('0x20')](_0x4ac819[_0xe36e('0x1b')][_0xe36e('0x1f')],function(_0xf808f5){return{'model':db[_0xf808f5['model']],'as':_0xf808f5['as'],'attributes':_0xf808f5[_0xe36e('0x1e')],'include':_0xf808f5['include']?_['map'](_0xf808f5[_0xe36e('0x1f')],function(_0x4f620d){return{'model':db[_0x4f620d[_0xe36e('0x21')]],'as':_0x4f620d['as'],'attributes':_0x4f620d[_0xe36e('0x1e')],'include':_0x4f620d[_0xe36e('0x1f')]?_[_0xe36e('0x20')](_0x4f620d['include'],function(_0x56135c){return{'model':db[_0x56135c[_0xe36e('0x21')]],'as':_0x56135c['as'],'attributes':_0x56135c[_0xe36e('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xe36e('0xc')](function(_0x243338){logger['info'](_0xe36e('0x23'),_0x4ac819);logger[_0xe36e('0xe')](_0xe36e('0x23'),_0x4ac819,JSON['stringify'](_0x243338));_0xb8d44e(_0x243338);})[_0xe36e('0x17')](function(_0x2ff8f4){logger['error'](_0xe36e('0x23'),_0x2ff8f4[_0xe36e('0x14')],_0x4ac819);_0x259e19(_0x1fa1ec[_0xe36e('0x12')](0x1f4,_0x2ff8f4[_0xe36e('0x14')]));});});}; \ No newline at end of file +var _0xb62e=['bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetVtigerAccount','VtigerAccount','options','raw','where','limit','include','model','map','attributes','then','find','ShowVtigerAccount','lodash','util','moment'];(function(_0x264e7f,_0x4b8f91){var _0x173e6e=function(_0x525cfc){while(--_0x525cfc){_0x264e7f['push'](_0x264e7f['shift']());}};_0x173e6e(++_0x4b8f91);}(_0xb62e,0x1de));var _0xeb62=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb62e[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xeb62('0x0'));var util=require(_0xeb62('0x1'));var moment=require(_0xeb62('0x2'));var BPromise=require(_0xeb62('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xeb62('0x4'));var db=require(_0xeb62('0x5'))['db'];var utils=require(_0xeb62('0x6'));var logger=require(_0xeb62('0x7'))(_0xeb62('0x8'));var config=require(_0xeb62('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xeb62('0xa')][_0xeb62('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x31f5ea,_0x5e0dc4,_0x2065a0){return new BPromise(function(_0xab7049,_0x1e10ae){return client[_0xeb62('0xc')](_0x31f5ea,_0x2065a0)['then'](function(_0x5cdef3){logger[_0xeb62('0xd')](_0xeb62('0xe'),_0x5e0dc4,_0xeb62('0xf'));logger[_0xeb62('0x10')](_0xeb62('0x11'),_0x5e0dc4,_0xeb62('0xf'),JSON[_0xeb62('0x12')](_0x5cdef3));if(_0x5cdef3[_0xeb62('0x13')]){if(_0x5cdef3[_0xeb62('0x13')][_0xeb62('0x14')]===0x1f4){logger['error'](_0xeb62('0xe'),_0x5e0dc4,_0x5cdef3[_0xeb62('0x13')][_0xeb62('0x15')]);return _0x1e10ae(_0x5cdef3[_0xeb62('0x13')]['message']);}logger[_0xeb62('0x13')](_0xeb62('0xe'),_0x5e0dc4,_0x5cdef3[_0xeb62('0x13')]['message']);return _0xab7049(_0x5cdef3[_0xeb62('0x13')][_0xeb62('0x15')]);}else{logger[_0xeb62('0xd')]('VtigerAccount,\x20%s,\x20%s',_0x5e0dc4,_0xeb62('0xf'));_0xab7049(_0x5cdef3[_0xeb62('0x16')][_0xeb62('0x15')]);}})[_0xeb62('0x17')](function(_0x3fb280){logger[_0xeb62('0x13')](_0xeb62('0xe'),_0x5e0dc4,_0x3fb280);_0x1e10ae(_0x3fb280);});});}exports[_0xeb62('0x18')]=function(_0x39b138){var _0x27fd84=this;return new Promise(function(_0x27efc8,_0x11d516){return db[_0xeb62('0x19')]['findAll']({'raw':_0x39b138[_0xeb62('0x1a')]?_0x39b138[_0xeb62('0x1a')][_0xeb62('0x1b')]===undefined?!![]:![]:!![],'where':_0x39b138[_0xeb62('0x1a')]?_0x39b138[_0xeb62('0x1a')][_0xeb62('0x1c')]||null:null,'attributes':_0x39b138[_0xeb62('0x1a')]?_0x39b138['options']['attributes']||null:null,'limit':_0x39b138[_0xeb62('0x1a')]?_0x39b138[_0xeb62('0x1a')][_0xeb62('0x1d')]||null:null,'include':_0x39b138[_0xeb62('0x1a')]?_0x39b138[_0xeb62('0x1a')]['include']?_['map'](_0x39b138[_0xeb62('0x1a')][_0xeb62('0x1e')],function(_0x182781){return{'model':db[_0x182781[_0xeb62('0x1f')]],'as':_0x182781['as'],'attributes':_0x182781['attributes'],'include':_0x182781['include']?_[_0xeb62('0x20')](_0x182781['include'],function(_0x448327){return{'model':db[_0x448327['model']],'as':_0x448327['as'],'attributes':_0x448327[_0xeb62('0x21')],'include':_0x448327['include']?_[_0xeb62('0x20')](_0x448327[_0xeb62('0x1e')],function(_0x46d1bb){return{'model':db[_0x46d1bb['model']],'as':_0x46d1bb['as'],'attributes':_0x46d1bb[_0xeb62('0x21')]};}):[]};}):[]};}):[]:[]})[_0xeb62('0x22')](function(_0x5222f4){logger[_0xeb62('0xd')](_0xeb62('0x18'),_0x39b138);logger[_0xeb62('0x10')]('GetVtigerAccount',_0x39b138,JSON[_0xeb62('0x12')](_0x5222f4));_0x27efc8(_0x5222f4);})[_0xeb62('0x17')](function(_0x57169a){logger[_0xeb62('0x13')](_0xeb62('0x18'),_0x57169a[_0xeb62('0x15')],_0x39b138);_0x11d516(_0x27fd84[_0xeb62('0x13')](0x1f4,_0x57169a[_0xeb62('0x15')]));});});};exports['ShowVtigerAccount']=function(_0x4b58af){var _0x1248bb=this;return new Promise(function(_0x357cf4,_0x1607ef){return db[_0xeb62('0x19')][_0xeb62('0x23')]({'raw':_0x4b58af[_0xeb62('0x1a')]?_0x4b58af[_0xeb62('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x4b58af[_0xeb62('0x1a')]?_0x4b58af['options']['where']||null:null,'attributes':_0x4b58af[_0xeb62('0x1a')]?_0x4b58af[_0xeb62('0x1a')]['attributes']||null:null,'include':_0x4b58af[_0xeb62('0x1a')]?_0x4b58af['options'][_0xeb62('0x1e')]?_[_0xeb62('0x20')](_0x4b58af['options'][_0xeb62('0x1e')],function(_0xe2589){return{'model':db[_0xe2589['model']],'as':_0xe2589['as'],'attributes':_0xe2589[_0xeb62('0x21')],'include':_0xe2589[_0xeb62('0x1e')]?_[_0xeb62('0x20')](_0xe2589[_0xeb62('0x1e')],function(_0x513dd8){return{'model':db[_0x513dd8[_0xeb62('0x1f')]],'as':_0x513dd8['as'],'attributes':_0x513dd8[_0xeb62('0x21')],'include':_0x513dd8['include']?_['map'](_0x513dd8[_0xeb62('0x1e')],function(_0x117d8c){return{'model':db[_0x117d8c['model']],'as':_0x117d8c['as'],'attributes':_0x117d8c[_0xeb62('0x21')]};}):[]};}):[]};}):[]:[]})[_0xeb62('0x22')](function(_0x11eadb){logger[_0xeb62('0xd')](_0xeb62('0x24'),_0x4b58af);logger[_0xeb62('0x10')](_0xeb62('0x24'),_0x4b58af,JSON['stringify'](_0x11eadb));_0x357cf4(_0x11eadb);})['catch'](function(_0x3306e3){logger[_0xeb62('0x13')](_0xeb62('0x24'),_0x3306e3[_0xeb62('0x15')],_0x4b58af);_0x1607ef(_0x1248bb['error'](0x1f4,_0x3306e3[_0xeb62('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index 498cf21..7241109 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 _0xb0ef=['/:id/fields','getSubjects','/:id/descriptions','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerConfiguration.controller','get','index','/:id','isAuthenticated'];(function(_0x641eba,_0x534f52){var _0x48abd3=function(_0x15e01e){while(--_0x15e01e){_0x641eba['push'](_0x641eba['shift']());}};_0x48abd3(++_0x534f52);}(_0xb0ef,0x7c));var _0xfb0e=function(_0x14ac92,_0x2be788){_0x14ac92=_0x14ac92-0x0;var _0x5386f2=_0xb0ef[_0x14ac92];return _0x5386f2;};'use strict';var multer=require(_0xfb0e('0x0'));var util=require(_0xfb0e('0x1'));var path=require(_0xfb0e('0x2'));var timeout=require(_0xfb0e('0x3'));var express=require(_0xfb0e('0x4'));var router=express['Router']();var fs_extra=require(_0xfb0e('0x5'));var auth=require(_0xfb0e('0x6'));var interaction=require(_0xfb0e('0x7'));var config=require(_0xfb0e('0x8'));var controller=require(_0xfb0e('0x9'));router[_0xfb0e('0xa')]('/',auth['isAuthenticated'](),controller[_0xfb0e('0xb')]);router[_0xfb0e('0xa')](_0xfb0e('0xc'),auth[_0xfb0e('0xd')](),controller['show']);router['get'](_0xfb0e('0xe'),auth[_0xfb0e('0xd')](),controller['getFields']);router[_0xfb0e('0xa')]('/:id/subjects',auth['isAuthenticated'](),controller[_0xfb0e('0xf')]);router[_0xfb0e('0xa')](_0xfb0e('0x10'),auth['isAuthenticated'](),controller['getDescriptions']);router['post']('/',auth['isAuthenticated'](),controller[_0xfb0e('0x11')]);router[_0xfb0e('0x12')](_0xfb0e('0xc'),auth[_0xfb0e('0xd')](),controller[_0xfb0e('0x13')]);router[_0xfb0e('0x14')](_0xfb0e('0xc'),auth[_0xfb0e('0xd')](),controller[_0xfb0e('0x15')]);module[_0xfb0e('0x16')]=router; \ No newline at end of file +var _0x614b=['update','delete','destroy','multer','util','path','connect-timeout','express','../../components/interaction/service','../../config/environment','get','index','isAuthenticated','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','/:id'];(function(_0x4ccbaf,_0x405225){var _0x2e49d9=function(_0x13d3af){while(--_0x13d3af){_0x4ccbaf['push'](_0x4ccbaf['shift']());}};_0x2e49d9(++_0x405225);}(_0x614b,0x179));var _0xb614=function(_0x2cb4cc,_0x1042c9){_0x2cb4cc=_0x2cb4cc-0x0;var _0x54bca9=_0x614b[_0x2cb4cc];return _0x54bca9;};'use strict';var multer=require(_0xb614('0x0'));var util=require(_0xb614('0x1'));var path=require(_0xb614('0x2'));var timeout=require(_0xb614('0x3'));var express=require(_0xb614('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xb614('0x5'));var config=require(_0xb614('0x6'));var controller=require('./intVtigerConfiguration.controller');router[_0xb614('0x7')]('/',auth['isAuthenticated'](),controller[_0xb614('0x8')]);router[_0xb614('0x7')]('/:id',auth[_0xb614('0x9')](),controller['show']);router[_0xb614('0x7')](_0xb614('0xa'),auth[_0xb614('0x9')](),controller['getFields']);router[_0xb614('0x7')](_0xb614('0xb'),auth[_0xb614('0x9')](),controller[_0xb614('0xc')]);router['get'](_0xb614('0xd'),auth[_0xb614('0x9')](),controller[_0xb614('0xe')]);router[_0xb614('0xf')]('/',auth[_0xb614('0x9')](),controller[_0xb614('0x10')]);router[_0xb614('0x11')](_0xb614('0x12'),auth[_0xb614('0x9')](),controller[_0xb614('0x13')]);router[_0xb614('0x14')](_0xb614('0x12'),auth[_0xb614('0x9')](),controller[_0xb614('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js index 98c1c5f..93a7fac 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 _0xa932=['exports','STRING'];(function(_0x2ef4e7,_0x16ff25){var _0x1837f9=function(_0x1b5bfe){while(--_0x1b5bfe){_0x2ef4e7['push'](_0x2ef4e7['shift']());}};_0x1837f9(++_0x16ff25);}(_0xa932,0x1c8));var _0x2a93=function(_0x33de83,_0x5cd14a){_0x33de83=_0x33de83-0x0;var _0x2dc227=_0xa932[_0x33de83];return _0x2dc227;};'use strict';var Sequelize=require('sequelize');module[_0x2a93('0x0')]={'name':{'type':Sequelize[_0x2a93('0x1')]},'description':{'type':Sequelize[_0x2a93('0x1')]}}; \ No newline at end of file +var _0x1b41=['STRING','sequelize'];(function(_0x41e3e5,_0x441240){var _0x4b5b5c=function(_0x5b988a){while(--_0x5b988a){_0x41e3e5['push'](_0x41e3e5['shift']());}};_0x4b5b5c(++_0x441240);}(_0x1b41,0x161));var _0x11b4=function(_0x3541e4,_0x4dcf9a){_0x3541e4=_0x3541e4-0x0;var _0x3ca5d9=_0x1b41[_0x3541e4];return _0x3ca5d9;};'use strict';var Sequelize=require(_0x11b4('0x0'));module['exports']={'name':{'type':Sequelize[_0x11b4('0x1')]},'description':{'type':Sequelize[_0x11b4('0x1')]}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index 35f34f0..44ff6dc 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 _0x9b87=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','set','Content-Range','json','apply','reject','update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','keys','intersection','attributes','fields','length','query','hasOwnProperty','nolimit','limit','order','sort','filters','pick','filter','where','merge','type','options','VtigerConfiguration','includeAll','include','catch','params','find','create','body','getFields','findOne','VtigerField','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','querystring','papaparse','ioredis','../../components/parsers/qs'];(function(_0xd8b7,_0x217ce7){var _0x212bd9=function(_0x5588b2){while(--_0x5588b2){_0xd8b7['push'](_0xd8b7['shift']());}};_0x212bd9(++_0x217ce7);}(_0x9b87,0x8e));var _0x79b8=function(_0x7bb309,_0x528140){_0x7bb309=_0x7bb309-0x0;var _0x3613a4=_0x9b87[_0x7bb309];return _0x3613a4;};'use strict';var emlformat=require(_0x79b8('0x0'));var rimraf=require(_0x79b8('0x1'));var zipdir=require(_0x79b8('0x2'));var jsonpatch=require(_0x79b8('0x3'));var rp=require(_0x79b8('0x4'));var moment=require(_0x79b8('0x5'));var BPromise=require(_0x79b8('0x6'));var Mustache=require(_0x79b8('0x7'));var util=require(_0x79b8('0x8'));var path=require(_0x79b8('0x9'));var sox=require(_0x79b8('0xa'));var csv=require(_0x79b8('0xb'));var ejs=require(_0x79b8('0xc'));var fs=require('fs');var fs_extra=require(_0x79b8('0xd'));var _=require(_0x79b8('0xe'));var squel=require(_0x79b8('0xf'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x79b8('0x10'));var Papa=require(_0x79b8('0x11'));var Redis=require(_0x79b8('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x79b8('0x13'));var as=require(_0x79b8('0x14'));var hardwareService=require(_0x79b8('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0x79b8('0x16'));var config=require(_0x79b8('0x17'));var licenseUtil=require(_0x79b8('0x18'));var db=require(_0x79b8('0x19'))['db'];function respondWithStatusCode(_0x21ad20,_0x33227b){_0x33227b=_0x33227b||0xcc;return function(_0x41095c){if(_0x41095c){return _0x21ad20[_0x79b8('0x1a')](_0x33227b);}return _0x21ad20[_0x79b8('0x1b')](_0x33227b)[_0x79b8('0x1c')]();};}function respondWithResult(_0x43ec09,_0x59e229){_0x59e229=_0x59e229||0xc8;return function(_0x150fb7){if(_0x150fb7){return _0x43ec09['status'](_0x59e229)['json'](_0x150fb7);}};}function respondWithFilteredResult(_0x3142e9,_0x21aae0){return function(_0x57a248){if(_0x57a248){var _0x5ddab5=typeof _0x21aae0[_0x79b8('0x1d')]==='undefined'&&typeof _0x21aae0['limit']===_0x79b8('0x1e');var _0x24c02f=_0x57a248[_0x79b8('0x1f')];var _0x2ae2d5=_0x5ddab5?0x0:_0x21aae0[_0x79b8('0x1d')];var _0x23d771=_0x5ddab5?_0x57a248['count']:_0x21aae0[_0x79b8('0x1d')]+_0x21aae0['limit'];var _0x53d386;if(_0x23d771>=_0x24c02f){_0x23d771=_0x24c02f;_0x53d386=0xc8;}else{_0x53d386=0xce;}_0x3142e9[_0x79b8('0x1b')](_0x53d386);return _0x3142e9[_0x79b8('0x20')](_0x79b8('0x21'),_0x2ae2d5+'-'+_0x23d771+'/'+_0x24c02f)[_0x79b8('0x22')](_0x57a248);}return null;};}function patchUpdates(_0x1e24cf){return function(_0x1e7507){try{jsonpatch[_0x79b8('0x23')](_0x1e7507,_0x1e24cf,!![]);}catch(_0x261c48){return BPromise[_0x79b8('0x24')](_0x261c48);}return _0x1e7507['save']();};}function saveUpdates(_0x3e9d83,_0x255207){return function(_0x4dbfcf){if(_0x4dbfcf){return _0x4dbfcf[_0x79b8('0x25')](_0x3e9d83)[_0x79b8('0x26')](function(_0x54c605){return _0x54c605;});}return null;};}function removeEntity(_0x28be4b,_0x4f543f){return function(_0x5e8228){if(_0x5e8228){return _0x5e8228[_0x79b8('0x27')]()[_0x79b8('0x26')](function(){_0x28be4b[_0x79b8('0x1b')](0xcc)[_0x79b8('0x1c')]();});}};}function handleEntityNotFound(_0x9deb6c,_0x4cd38b){return function(_0x35db24){if(!_0x35db24){_0x9deb6c[_0x79b8('0x1a')](0x194);}return _0x35db24;};}function handleError(_0x1e84f3,_0x3ba5ac){_0x3ba5ac=_0x3ba5ac||0x1f4;return function(_0x4bbbf8){logger[_0x79b8('0x28')](_0x4bbbf8[_0x79b8('0x29')]);if(_0x4bbbf8[_0x79b8('0x2a')]){delete _0x4bbbf8['name'];}_0x1e84f3[_0x79b8('0x1b')](_0x3ba5ac)[_0x79b8('0x2b')](_0x4bbbf8);};}exports[_0x79b8('0x2c')]=function(_0x2942e9,_0x3662aa){var _0x23483f={},_0x4f51d1={},_0x434ecd={'count':0x0,'rows':[]};var _0x5a24fd=_[_0x79b8('0x2d')](db['VtigerConfiguration'][_0x79b8('0x2e')],function(_0x1090d2){return{'name':_0x1090d2[_0x79b8('0x2f')],'type':_0x1090d2['type'][_0x79b8('0x30')]};});_0x4f51d1[_0x79b8('0x31')]=_[_0x79b8('0x2d')](_0x5a24fd,_0x79b8('0x2a'));_0x4f51d1['query']=_[_0x79b8('0x32')](_0x2942e9['query']);_0x4f51d1['filters']=_[_0x79b8('0x33')](_0x4f51d1[_0x79b8('0x31')],_0x4f51d1['query']);_0x23483f[_0x79b8('0x34')]=_['intersection'](_0x4f51d1['model'],qs[_0x79b8('0x35')](_0x2942e9['query'][_0x79b8('0x35')]));_0x23483f[_0x79b8('0x34')]=_0x23483f['attributes'][_0x79b8('0x36')]?_0x23483f[_0x79b8('0x34')]:_0x4f51d1[_0x79b8('0x31')];if(!_0x2942e9[_0x79b8('0x37')][_0x79b8('0x38')](_0x79b8('0x39'))){_0x23483f['limit']=qs[_0x79b8('0x3a')](_0x2942e9[_0x79b8('0x37')][_0x79b8('0x3a')]);_0x23483f[_0x79b8('0x1d')]=qs[_0x79b8('0x1d')](_0x2942e9[_0x79b8('0x37')][_0x79b8('0x1d')]);}_0x23483f[_0x79b8('0x3b')]=qs[_0x79b8('0x3c')](_0x2942e9[_0x79b8('0x37')][_0x79b8('0x3c')]);_0x23483f['where']=qs[_0x79b8('0x3d')](_[_0x79b8('0x3e')](_0x2942e9[_0x79b8('0x37')],_0x4f51d1['filters']),_0x5a24fd);if(_0x2942e9[_0x79b8('0x37')][_0x79b8('0x3f')]){_0x23483f[_0x79b8('0x40')]=_[_0x79b8('0x41')](_0x23483f[_0x79b8('0x40')],{'$or':_[_0x79b8('0x2d')](_0x5a24fd,function(_0x4b6248){if(_0x4b6248[_0x79b8('0x42')]!=='VIRTUAL'){var _0x512d04={};_0x512d04[_0x4b6248[_0x79b8('0x2a')]]={'$like':'%'+_0x2942e9['query']['filter']+'%'};return _0x512d04;}})});}_0x23483f=_[_0x79b8('0x41')]({},_0x23483f,_0x2942e9[_0x79b8('0x43')]);var _0x422c56={'where':_0x23483f[_0x79b8('0x40')]};return db[_0x79b8('0x44')][_0x79b8('0x1f')](_0x422c56)[_0x79b8('0x26')](function(_0x2aac60){_0x434ecd[_0x79b8('0x1f')]=_0x2aac60;if(_0x2942e9[_0x79b8('0x37')][_0x79b8('0x45')]){_0x23483f[_0x79b8('0x46')]=[{'all':!![]}];}return db[_0x79b8('0x44')]['findAll'](_0x23483f);})[_0x79b8('0x26')](function(_0x13b041){_0x434ecd['rows']=_0x13b041;return _0x434ecd;})[_0x79b8('0x26')](respondWithFilteredResult(_0x3662aa,_0x23483f))[_0x79b8('0x47')](handleError(_0x3662aa,null));};exports['show']=function(_0x17dd9e,_0x62a011){var _0x2ddad8={'raw':![],'where':{'id':_0x17dd9e[_0x79b8('0x48')]['id']}},_0x28d4e4={};_0x28d4e4[_0x79b8('0x31')]=_[_0x79b8('0x32')](db[_0x79b8('0x44')][_0x79b8('0x2e')]);_0x28d4e4[_0x79b8('0x37')]=_[_0x79b8('0x32')](_0x17dd9e[_0x79b8('0x37')]);_0x28d4e4['filters']=_['intersection'](_0x28d4e4[_0x79b8('0x31')],_0x28d4e4[_0x79b8('0x37')]);_0x2ddad8[_0x79b8('0x34')]=_[_0x79b8('0x33')](_0x28d4e4['model'],qs[_0x79b8('0x35')](_0x17dd9e[_0x79b8('0x37')][_0x79b8('0x35')]));_0x2ddad8[_0x79b8('0x34')]=_0x2ddad8['attributes'][_0x79b8('0x36')]?_0x2ddad8[_0x79b8('0x34')]:_0x28d4e4[_0x79b8('0x31')];if(_0x17dd9e[_0x79b8('0x37')]['includeAll']){_0x2ddad8[_0x79b8('0x46')]=[{'all':!![]}];}_0x2ddad8=_[_0x79b8('0x41')]({},_0x2ddad8,_0x17dd9e[_0x79b8('0x43')]);return db[_0x79b8('0x44')][_0x79b8('0x49')](_0x2ddad8)[_0x79b8('0x26')](handleEntityNotFound(_0x62a011,null))['then'](respondWithResult(_0x62a011,null))[_0x79b8('0x47')](handleError(_0x62a011,null));};exports[_0x79b8('0x4a')]=function(_0x330051,_0xc89e93){return db['VtigerConfiguration']['create'](_0x330051[_0x79b8('0x4b')],{})[_0x79b8('0x26')](respondWithResult(_0xc89e93,0xc9))[_0x79b8('0x47')](handleError(_0xc89e93,null));};exports[_0x79b8('0x25')]=function(_0x32e7ea,_0x19272d){if(_0x32e7ea[_0x79b8('0x4b')]['id']){delete _0x32e7ea[_0x79b8('0x4b')]['id'];}return db[_0x79b8('0x44')]['find']({'where':{'id':_0x32e7ea[_0x79b8('0x48')]['id']}})[_0x79b8('0x26')](handleEntityNotFound(_0x19272d,null))[_0x79b8('0x26')](saveUpdates(_0x32e7ea['body'],null))[_0x79b8('0x26')](respondWithResult(_0x19272d,null))['catch'](handleError(_0x19272d,null));};exports['destroy']=function(_0x24ebb2,_0x252c2c){return db[_0x79b8('0x44')][_0x79b8('0x49')]({'where':{'id':_0x24ebb2['params']['id']}})['then'](handleEntityNotFound(_0x252c2c,null))[_0x79b8('0x26')](removeEntity(_0x252c2c,null))[_0x79b8('0x47')](handleError(_0x252c2c,null));};exports[_0x79b8('0x4c')]=function(_0x43f401,_0x2ff973,_0xcfb9c2){var _0x3f3ffc={};var _0x3d1078={};var _0x26d69e;var _0x1571cf;return db[_0x79b8('0x44')][_0x79b8('0x4d')]({'where':{'id':_0x43f401[_0x79b8('0x48')]['id']}})[_0x79b8('0x26')](handleEntityNotFound(_0x2ff973,null))['then'](function(_0x37e21d){if(_0x37e21d){_0x26d69e=_0x37e21d;_0x3d1078[_0x79b8('0x31')]=_[_0x79b8('0x32')](db[_0x79b8('0x4e')]['rawAttributes']);_0x3d1078['query']=_[_0x79b8('0x32')](_0x43f401[_0x79b8('0x37')]);_0x3d1078[_0x79b8('0x3d')]=_[_0x79b8('0x33')](_0x3d1078['model'],_0x3d1078[_0x79b8('0x37')]);_0x3f3ffc[_0x79b8('0x34')]=_['intersection'](_0x3d1078[_0x79b8('0x31')],qs[_0x79b8('0x35')](_0x43f401[_0x79b8('0x37')]['fields']));_0x3f3ffc[_0x79b8('0x34')]=_0x3f3ffc['attributes'][_0x79b8('0x36')]?_0x3f3ffc[_0x79b8('0x34')]:_0x3d1078[_0x79b8('0x31')];_0x3f3ffc[_0x79b8('0x3b')]=qs[_0x79b8('0x3c')](_0x43f401[_0x79b8('0x37')][_0x79b8('0x3c')]);_0x3f3ffc[_0x79b8('0x40')]=qs[_0x79b8('0x3d')](_[_0x79b8('0x3e')](_0x43f401['query'],_0x3d1078[_0x79b8('0x3d')]));if(_0x43f401['query'][_0x79b8('0x3f')]){_0x3f3ffc['where']=_[_0x79b8('0x41')](_0x3f3ffc[_0x79b8('0x40')],{'$or':_[_0x79b8('0x2d')](_0x3f3ffc[_0x79b8('0x34')],function(_0x2fcd4e){var _0x5885a3={};_0x5885a3[_0x2fcd4e]={'$like':'%'+_0x43f401[_0x79b8('0x37')]['filter']+'%'};return _0x5885a3;})});}_0x3f3ffc=_[_0x79b8('0x41')]({},_0x3f3ffc,_0x43f401[_0x79b8('0x43')]);return _0x26d69e[_0x79b8('0x4c')](_0x3f3ffc);}})[_0x79b8('0x26')](function(_0x27131e){if(_0x27131e){_0x1571cf=_0x27131e[_0x79b8('0x36')];if(!_0x43f401['query'][_0x79b8('0x38')](_0x79b8('0x39'))){_0x3f3ffc['limit']=qs[_0x79b8('0x3a')](_0x43f401['query'][_0x79b8('0x3a')]);_0x3f3ffc[_0x79b8('0x1d')]=qs['offset'](_0x43f401[_0x79b8('0x37')][_0x79b8('0x1d')]);}return _0x26d69e['getFields'](_0x3f3ffc);}})[_0x79b8('0x26')](function(_0x4b197b){if(_0x4b197b){return _0x4b197b?{'count':_0x1571cf,'rows':_0x4b197b}:null;}})[_0x79b8('0x26')](respondWithResult(_0x2ff973,null))['catch'](handleError(_0x2ff973,null));};exports[_0x79b8('0x4f')]=function(_0x1e101d,_0x41f243,_0x26722c){var _0x17a707={};var _0x234855={};var _0x529129;var _0x291ef1;return db[_0x79b8('0x44')]['findOne']({'where':{'id':_0x1e101d['params']['id']}})[_0x79b8('0x26')](handleEntityNotFound(_0x41f243,null))[_0x79b8('0x26')](function(_0x4fb2fd){if(_0x4fb2fd){_0x529129=_0x4fb2fd;_0x234855[_0x79b8('0x31')]=_[_0x79b8('0x32')](db[_0x79b8('0x4e')]['rawAttributes']);_0x234855[_0x79b8('0x37')]=_[_0x79b8('0x32')](_0x1e101d[_0x79b8('0x37')]);_0x234855[_0x79b8('0x3d')]=_[_0x79b8('0x33')](_0x234855[_0x79b8('0x31')],_0x234855['query']);_0x17a707[_0x79b8('0x34')]=_[_0x79b8('0x33')](_0x234855[_0x79b8('0x31')],qs['fields'](_0x1e101d[_0x79b8('0x37')][_0x79b8('0x35')]));_0x17a707[_0x79b8('0x34')]=_0x17a707['attributes'][_0x79b8('0x36')]?_0x17a707[_0x79b8('0x34')]:_0x234855['model'];_0x17a707['order']=qs[_0x79b8('0x3c')](_0x1e101d[_0x79b8('0x37')][_0x79b8('0x3c')]);_0x17a707[_0x79b8('0x40')]=qs[_0x79b8('0x3d')](_[_0x79b8('0x3e')](_0x1e101d[_0x79b8('0x37')],_0x234855[_0x79b8('0x3d')]));if(_0x1e101d['query'][_0x79b8('0x3f')]){_0x17a707['where']=_['merge'](_0x17a707[_0x79b8('0x40')],{'$or':_['map'](_0x17a707[_0x79b8('0x34')],function(_0x43b067){var _0x151cd5={};_0x151cd5[_0x43b067]={'$like':'%'+_0x1e101d['query'][_0x79b8('0x3f')]+'%'};return _0x151cd5;})});}_0x17a707=_[_0x79b8('0x41')]({},_0x17a707,_0x1e101d[_0x79b8('0x43')]);return _0x529129[_0x79b8('0x4f')](_0x17a707);}})[_0x79b8('0x26')](function(_0x225122){if(_0x225122){_0x291ef1=_0x225122[_0x79b8('0x36')];if(!_0x1e101d[_0x79b8('0x37')][_0x79b8('0x38')](_0x79b8('0x39'))){_0x17a707[_0x79b8('0x3a')]=qs[_0x79b8('0x3a')](_0x1e101d['query'][_0x79b8('0x3a')]);_0x17a707[_0x79b8('0x1d')]=qs[_0x79b8('0x1d')](_0x1e101d[_0x79b8('0x37')][_0x79b8('0x1d')]);}return _0x529129[_0x79b8('0x4f')](_0x17a707);}})[_0x79b8('0x26')](function(_0x33ea25){if(_0x33ea25){return _0x33ea25?{'count':_0x291ef1,'rows':_0x33ea25}:null;}})[_0x79b8('0x26')](respondWithResult(_0x41f243,null))[_0x79b8('0x47')](handleError(_0x41f243,null));};exports[_0x79b8('0x50')]=function(_0x4d116d,_0x43420b,_0x4a8cd0){var _0x5b785b={};var _0x211575={};var _0x275c67;var _0xec6d81;return db[_0x79b8('0x44')][_0x79b8('0x4d')]({'where':{'id':_0x4d116d[_0x79b8('0x48')]['id']}})[_0x79b8('0x26')](handleEntityNotFound(_0x43420b,null))[_0x79b8('0x26')](function(_0x574191){if(_0x574191){_0x275c67=_0x574191;_0x211575['model']=_['keys'](db[_0x79b8('0x4e')][_0x79b8('0x2e')]);_0x211575[_0x79b8('0x37')]=_[_0x79b8('0x32')](_0x4d116d[_0x79b8('0x37')]);_0x211575[_0x79b8('0x3d')]=_[_0x79b8('0x33')](_0x211575[_0x79b8('0x31')],_0x211575[_0x79b8('0x37')]);_0x5b785b[_0x79b8('0x34')]=_[_0x79b8('0x33')](_0x211575[_0x79b8('0x31')],qs['fields'](_0x4d116d[_0x79b8('0x37')][_0x79b8('0x35')]));_0x5b785b['attributes']=_0x5b785b[_0x79b8('0x34')][_0x79b8('0x36')]?_0x5b785b[_0x79b8('0x34')]:_0x211575[_0x79b8('0x31')];_0x5b785b[_0x79b8('0x3b')]=qs[_0x79b8('0x3c')](_0x4d116d[_0x79b8('0x37')][_0x79b8('0x3c')]);_0x5b785b['where']=qs['filters'](_[_0x79b8('0x3e')](_0x4d116d[_0x79b8('0x37')],_0x211575[_0x79b8('0x3d')]));if(_0x4d116d[_0x79b8('0x37')][_0x79b8('0x3f')]){_0x5b785b[_0x79b8('0x40')]=_[_0x79b8('0x41')](_0x5b785b[_0x79b8('0x40')],{'$or':_[_0x79b8('0x2d')](_0x5b785b[_0x79b8('0x34')],function(_0x4912ce){var _0x56f946={};_0x56f946[_0x4912ce]={'$like':'%'+_0x4d116d['query']['filter']+'%'};return _0x56f946;})});}_0x5b785b=_[_0x79b8('0x41')]({},_0x5b785b,_0x4d116d[_0x79b8('0x43')]);return _0x275c67['getDescriptions'](_0x5b785b);}})[_0x79b8('0x26')](function(_0xd6c7e7){if(_0xd6c7e7){_0xec6d81=_0xd6c7e7[_0x79b8('0x36')];if(!_0x4d116d[_0x79b8('0x37')][_0x79b8('0x38')](_0x79b8('0x39'))){_0x5b785b[_0x79b8('0x3a')]=qs[_0x79b8('0x3a')](_0x4d116d[_0x79b8('0x37')][_0x79b8('0x3a')]);_0x5b785b[_0x79b8('0x1d')]=qs['offset'](_0x4d116d['query'][_0x79b8('0x1d')]);}return _0x275c67[_0x79b8('0x50')](_0x5b785b);}})[_0x79b8('0x26')](function(_0x42915c){if(_0x42915c){return _0x42915c?{'count':_0xec6d81,'rows':_0x42915c}:null;}})[_0x79b8('0x26')](respondWithResult(_0x43420b,null))[_0x79b8('0x47')](handleError(_0x43420b,null));}; \ No newline at end of file +var _0x731f=['keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','update','destroy','getFields','findOne','VtigerField','filter','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','status','Content-Range','apply','reject','save','then','error','stack','name','index','map','VtigerConfiguration','rawAttributes','fieldName','type','key','model'];(function(_0x4fe870,_0x1c4346){var _0x3a47a1=function(_0x1d560c){while(--_0x1d560c){_0x4fe870['push'](_0x4fe870['shift']());}};_0x3a47a1(++_0x1c4346);}(_0x731f,0xc3));var _0xf731=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x731f[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0xf731('0x0'));var rimraf=require(_0xf731('0x1'));var zipdir=require(_0xf731('0x2'));var jsonpatch=require(_0xf731('0x3'));var rp=require(_0xf731('0x4'));var moment=require(_0xf731('0x5'));var BPromise=require(_0xf731('0x6'));var Mustache=require(_0xf731('0x7'));var util=require('util');var path=require(_0xf731('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(_0xf731('0x9'));var squel=require(_0xf731('0xa'));var crypto=require('crypto');var jsforce=require(_0xf731('0xb'));var deskjs=require(_0xf731('0xc'));var toCsv=require(_0xf731('0xd'));var querystring=require(_0xf731('0xe'));var Papa=require(_0xf731('0xf'));var Redis=require(_0xf731('0x10'));var authService=require(_0xf731('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf731('0x12'));var logger=require(_0xf731('0x13'))(_0xf731('0x14'));var utils=require(_0xf731('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xf731('0x16'));var db=require(_0xf731('0x17'))['db'];function respondWithStatusCode(_0x3e1815,_0x59cc33){_0x59cc33=_0x59cc33||0xcc;return function(_0x2a8272){if(_0x2a8272){return _0x3e1815[_0xf731('0x18')](_0x59cc33);}return _0x3e1815['status'](_0x59cc33)[_0xf731('0x19')]();};}function respondWithResult(_0x326dc8,_0x31aa9f){_0x31aa9f=_0x31aa9f||0xc8;return function(_0x2a9992){if(_0x2a9992){return _0x326dc8['status'](_0x31aa9f)[_0xf731('0x1a')](_0x2a9992);}};}function respondWithFilteredResult(_0x1ee818,_0x4e597f){return function(_0x2742a8){if(_0x2742a8){var _0x2eb274=typeof _0x4e597f[_0xf731('0x1b')]===_0xf731('0x1c')&&typeof _0x4e597f[_0xf731('0x1d')]==='undefined';var _0x5ba9a2=_0x2742a8[_0xf731('0x1e')];var _0x4d62fe=_0x2eb274?0x0:_0x4e597f[_0xf731('0x1b')];var _0x176538=_0x2eb274?_0x2742a8[_0xf731('0x1e')]:_0x4e597f['offset']+_0x4e597f['limit'];var _0x16fd77;if(_0x176538>=_0x5ba9a2){_0x176538=_0x5ba9a2;_0x16fd77=0xc8;}else{_0x16fd77=0xce;}_0x1ee818[_0xf731('0x1f')](_0x16fd77);return _0x1ee818['set'](_0xf731('0x20'),_0x4d62fe+'-'+_0x176538+'/'+_0x5ba9a2)['json'](_0x2742a8);}return null;};}function patchUpdates(_0x39e180){return function(_0x371f18){try{jsonpatch[_0xf731('0x21')](_0x371f18,_0x39e180,!![]);}catch(_0x4a2892){return BPromise[_0xf731('0x22')](_0x4a2892);}return _0x371f18[_0xf731('0x23')]();};}function saveUpdates(_0x44b6dd,_0x15d471){return function(_0x5d4239){if(_0x5d4239){return _0x5d4239['update'](_0x44b6dd)[_0xf731('0x24')](function(_0x473075){return _0x473075;});}return null;};}function removeEntity(_0xcd2927,_0x3abce6){return function(_0x2d852a){if(_0x2d852a){return _0x2d852a['destroy']()['then'](function(){_0xcd2927['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x549f45,_0x4961d6){return function(_0x5c4e2d){if(!_0x5c4e2d){_0x549f45['sendStatus'](0x194);}return _0x5c4e2d;};}function handleError(_0x369053,_0x29fabb){_0x29fabb=_0x29fabb||0x1f4;return function(_0x26a133){logger[_0xf731('0x25')](_0x26a133[_0xf731('0x26')]);if(_0x26a133[_0xf731('0x27')]){delete _0x26a133['name'];}_0x369053[_0xf731('0x1f')](_0x29fabb)['send'](_0x26a133);};}exports[_0xf731('0x28')]=function(_0x298d32,_0x86ab19){var _0x496c2e={},_0xecba96={},_0x8bff57={'count':0x0,'rows':[]};var _0x147ca8=_[_0xf731('0x29')](db[_0xf731('0x2a')][_0xf731('0x2b')],function(_0x2e9774){return{'name':_0x2e9774[_0xf731('0x2c')],'type':_0x2e9774[_0xf731('0x2d')][_0xf731('0x2e')]};});_0xecba96[_0xf731('0x2f')]=_[_0xf731('0x29')](_0x147ca8,_0xf731('0x27'));_0xecba96['query']=_[_0xf731('0x30')](_0x298d32[_0xf731('0x31')]);_0xecba96[_0xf731('0x32')]=_[_0xf731('0x33')](_0xecba96['model'],_0xecba96['query']);_0x496c2e[_0xf731('0x34')]=_[_0xf731('0x33')](_0xecba96[_0xf731('0x2f')],qs['fields'](_0x298d32['query'][_0xf731('0x35')]));_0x496c2e[_0xf731('0x34')]=_0x496c2e[_0xf731('0x34')][_0xf731('0x36')]?_0x496c2e[_0xf731('0x34')]:_0xecba96[_0xf731('0x2f')];if(!_0x298d32[_0xf731('0x31')][_0xf731('0x37')](_0xf731('0x38'))){_0x496c2e[_0xf731('0x1d')]=qs[_0xf731('0x1d')](_0x298d32[_0xf731('0x31')][_0xf731('0x1d')]);_0x496c2e[_0xf731('0x1b')]=qs[_0xf731('0x1b')](_0x298d32[_0xf731('0x31')][_0xf731('0x1b')]);}_0x496c2e[_0xf731('0x39')]=qs[_0xf731('0x3a')](_0x298d32[_0xf731('0x31')][_0xf731('0x3a')]);_0x496c2e[_0xf731('0x3b')]=qs[_0xf731('0x32')](_[_0xf731('0x3c')](_0x298d32[_0xf731('0x31')],_0xecba96[_0xf731('0x32')]),_0x147ca8);if(_0x298d32[_0xf731('0x31')]['filter']){_0x496c2e[_0xf731('0x3b')]=_[_0xf731('0x3d')](_0x496c2e[_0xf731('0x3b')],{'$or':_[_0xf731('0x29')](_0x147ca8,function(_0x1491b2){if(_0x1491b2[_0xf731('0x2d')]!=='VIRTUAL'){var _0x4f0b20={};_0x4f0b20[_0x1491b2[_0xf731('0x27')]]={'$like':'%'+_0x298d32[_0xf731('0x31')]['filter']+'%'};return _0x4f0b20;}})});}_0x496c2e=_[_0xf731('0x3d')]({},_0x496c2e,_0x298d32[_0xf731('0x3e')]);var _0x4cf07c={'where':_0x496c2e[_0xf731('0x3b')]};return db[_0xf731('0x2a')][_0xf731('0x1e')](_0x4cf07c)[_0xf731('0x24')](function(_0x298328){_0x8bff57[_0xf731('0x1e')]=_0x298328;if(_0x298d32[_0xf731('0x31')]['includeAll']){_0x496c2e[_0xf731('0x3f')]=[{'all':!![]}];}return db[_0xf731('0x2a')][_0xf731('0x40')](_0x496c2e);})[_0xf731('0x24')](function(_0x443b74){_0x8bff57[_0xf731('0x41')]=_0x443b74;return _0x8bff57;})['then'](respondWithFilteredResult(_0x86ab19,_0x496c2e))[_0xf731('0x42')](handleError(_0x86ab19,null));};exports[_0xf731('0x43')]=function(_0x582ad6,_0x51c399){var _0x46dd99={'raw':![],'where':{'id':_0x582ad6[_0xf731('0x44')]['id']}},_0x4d81e8={};_0x4d81e8[_0xf731('0x2f')]=_[_0xf731('0x30')](db['VtigerConfiguration'][_0xf731('0x2b')]);_0x4d81e8[_0xf731('0x31')]=_[_0xf731('0x30')](_0x582ad6[_0xf731('0x31')]);_0x4d81e8[_0xf731('0x32')]=_[_0xf731('0x33')](_0x4d81e8[_0xf731('0x2f')],_0x4d81e8['query']);_0x46dd99[_0xf731('0x34')]=_[_0xf731('0x33')](_0x4d81e8[_0xf731('0x2f')],qs[_0xf731('0x35')](_0x582ad6['query']['fields']));_0x46dd99[_0xf731('0x34')]=_0x46dd99[_0xf731('0x34')][_0xf731('0x36')]?_0x46dd99[_0xf731('0x34')]:_0x4d81e8[_0xf731('0x2f')];if(_0x582ad6[_0xf731('0x31')][_0xf731('0x45')]){_0x46dd99[_0xf731('0x3f')]=[{'all':!![]}];}_0x46dd99=_[_0xf731('0x3d')]({},_0x46dd99,_0x582ad6['options']);return db[_0xf731('0x2a')][_0xf731('0x46')](_0x46dd99)[_0xf731('0x24')](handleEntityNotFound(_0x51c399,null))[_0xf731('0x24')](respondWithResult(_0x51c399,null))[_0xf731('0x42')](handleError(_0x51c399,null));};exports[_0xf731('0x47')]=function(_0x23b5bc,_0x3326eb){return db[_0xf731('0x2a')]['create'](_0x23b5bc[_0xf731('0x48')],{})[_0xf731('0x24')](respondWithResult(_0x3326eb,0xc9))[_0xf731('0x42')](handleError(_0x3326eb,null));};exports[_0xf731('0x49')]=function(_0x360127,_0x5c0d97){if(_0x360127[_0xf731('0x48')]['id']){delete _0x360127[_0xf731('0x48')]['id'];}return db[_0xf731('0x2a')]['find']({'where':{'id':_0x360127[_0xf731('0x44')]['id']}})['then'](handleEntityNotFound(_0x5c0d97,null))[_0xf731('0x24')](saveUpdates(_0x360127[_0xf731('0x48')],null))[_0xf731('0x24')](respondWithResult(_0x5c0d97,null))[_0xf731('0x42')](handleError(_0x5c0d97,null));};exports[_0xf731('0x4a')]=function(_0x1a0e19,_0x519d24){return db[_0xf731('0x2a')][_0xf731('0x46')]({'where':{'id':_0x1a0e19[_0xf731('0x44')]['id']}})[_0xf731('0x24')](handleEntityNotFound(_0x519d24,null))[_0xf731('0x24')](removeEntity(_0x519d24,null))[_0xf731('0x42')](handleError(_0x519d24,null));};exports[_0xf731('0x4b')]=function(_0x80bbb3,_0x24d9de,_0x4fb292){var _0x21c10f={};var _0x4c4ba3={};var _0x2b17b6;var _0x1a16b3;return db[_0xf731('0x2a')][_0xf731('0x4c')]({'where':{'id':_0x80bbb3[_0xf731('0x44')]['id']}})[_0xf731('0x24')](handleEntityNotFound(_0x24d9de,null))[_0xf731('0x24')](function(_0x96288e){if(_0x96288e){_0x2b17b6=_0x96288e;_0x4c4ba3['model']=_[_0xf731('0x30')](db[_0xf731('0x4d')][_0xf731('0x2b')]);_0x4c4ba3[_0xf731('0x31')]=_[_0xf731('0x30')](_0x80bbb3[_0xf731('0x31')]);_0x4c4ba3[_0xf731('0x32')]=_[_0xf731('0x33')](_0x4c4ba3[_0xf731('0x2f')],_0x4c4ba3[_0xf731('0x31')]);_0x21c10f['attributes']=_[_0xf731('0x33')](_0x4c4ba3['model'],qs[_0xf731('0x35')](_0x80bbb3[_0xf731('0x31')][_0xf731('0x35')]));_0x21c10f[_0xf731('0x34')]=_0x21c10f['attributes'][_0xf731('0x36')]?_0x21c10f[_0xf731('0x34')]:_0x4c4ba3[_0xf731('0x2f')];_0x21c10f[_0xf731('0x39')]=qs[_0xf731('0x3a')](_0x80bbb3[_0xf731('0x31')][_0xf731('0x3a')]);_0x21c10f[_0xf731('0x3b')]=qs[_0xf731('0x32')](_[_0xf731('0x3c')](_0x80bbb3[_0xf731('0x31')],_0x4c4ba3[_0xf731('0x32')]));if(_0x80bbb3[_0xf731('0x31')][_0xf731('0x4e')]){_0x21c10f[_0xf731('0x3b')]=_[_0xf731('0x3d')](_0x21c10f[_0xf731('0x3b')],{'$or':_['map'](_0x21c10f[_0xf731('0x34')],function(_0x59ed1a){var _0x585eb8={};_0x585eb8[_0x59ed1a]={'$like':'%'+_0x80bbb3[_0xf731('0x31')]['filter']+'%'};return _0x585eb8;})});}_0x21c10f=_[_0xf731('0x3d')]({},_0x21c10f,_0x80bbb3[_0xf731('0x3e')]);return _0x2b17b6[_0xf731('0x4b')](_0x21c10f);}})[_0xf731('0x24')](function(_0x5beffa){if(_0x5beffa){_0x1a16b3=_0x5beffa[_0xf731('0x36')];if(!_0x80bbb3[_0xf731('0x31')][_0xf731('0x37')](_0xf731('0x38'))){_0x21c10f[_0xf731('0x1d')]=qs[_0xf731('0x1d')](_0x80bbb3['query'][_0xf731('0x1d')]);_0x21c10f['offset']=qs[_0xf731('0x1b')](_0x80bbb3[_0xf731('0x31')][_0xf731('0x1b')]);}return _0x2b17b6[_0xf731('0x4b')](_0x21c10f);}})[_0xf731('0x24')](function(_0x4f911b){if(_0x4f911b){return _0x4f911b?{'count':_0x1a16b3,'rows':_0x4f911b}:null;}})['then'](respondWithResult(_0x24d9de,null))[_0xf731('0x42')](handleError(_0x24d9de,null));};exports[_0xf731('0x4f')]=function(_0x2b3422,_0x30f76f,_0x1671d4){var _0x11c9e9={};var _0x337903={};var _0x33e9c6;var _0x5367cc;return db[_0xf731('0x2a')][_0xf731('0x4c')]({'where':{'id':_0x2b3422[_0xf731('0x44')]['id']}})[_0xf731('0x24')](handleEntityNotFound(_0x30f76f,null))[_0xf731('0x24')](function(_0x2d11aa){if(_0x2d11aa){_0x33e9c6=_0x2d11aa;_0x337903[_0xf731('0x2f')]=_[_0xf731('0x30')](db[_0xf731('0x4d')]['rawAttributes']);_0x337903[_0xf731('0x31')]=_[_0xf731('0x30')](_0x2b3422[_0xf731('0x31')]);_0x337903['filters']=_['intersection'](_0x337903[_0xf731('0x2f')],_0x337903['query']);_0x11c9e9[_0xf731('0x34')]=_[_0xf731('0x33')](_0x337903['model'],qs[_0xf731('0x35')](_0x2b3422[_0xf731('0x31')][_0xf731('0x35')]));_0x11c9e9[_0xf731('0x34')]=_0x11c9e9['attributes'][_0xf731('0x36')]?_0x11c9e9[_0xf731('0x34')]:_0x337903[_0xf731('0x2f')];_0x11c9e9[_0xf731('0x39')]=qs[_0xf731('0x3a')](_0x2b3422[_0xf731('0x31')][_0xf731('0x3a')]);_0x11c9e9['where']=qs[_0xf731('0x32')](_['pick'](_0x2b3422[_0xf731('0x31')],_0x337903[_0xf731('0x32')]));if(_0x2b3422[_0xf731('0x31')]['filter']){_0x11c9e9[_0xf731('0x3b')]=_[_0xf731('0x3d')](_0x11c9e9[_0xf731('0x3b')],{'$or':_['map'](_0x11c9e9['attributes'],function(_0x1789ce){var _0x54d4e3={};_0x54d4e3[_0x1789ce]={'$like':'%'+_0x2b3422[_0xf731('0x31')][_0xf731('0x4e')]+'%'};return _0x54d4e3;})});}_0x11c9e9=_[_0xf731('0x3d')]({},_0x11c9e9,_0x2b3422[_0xf731('0x3e')]);return _0x33e9c6[_0xf731('0x4f')](_0x11c9e9);}})[_0xf731('0x24')](function(_0xcda418){if(_0xcda418){_0x5367cc=_0xcda418[_0xf731('0x36')];if(!_0x2b3422[_0xf731('0x31')][_0xf731('0x37')](_0xf731('0x38'))){_0x11c9e9[_0xf731('0x1d')]=qs['limit'](_0x2b3422['query']['limit']);_0x11c9e9[_0xf731('0x1b')]=qs[_0xf731('0x1b')](_0x2b3422[_0xf731('0x31')][_0xf731('0x1b')]);}return _0x33e9c6[_0xf731('0x4f')](_0x11c9e9);}})[_0xf731('0x24')](function(_0x29f674){if(_0x29f674){return _0x29f674?{'count':_0x5367cc,'rows':_0x29f674}:null;}})['then'](respondWithResult(_0x30f76f,null))[_0xf731('0x42')](handleError(_0x30f76f,null));};exports[_0xf731('0x50')]=function(_0x3de8f4,_0x4c2ad6,_0x7bc359){var _0x5e8b8b={};var _0x56dd0c={};var _0xdae656;var _0xfc620b;return db[_0xf731('0x2a')][_0xf731('0x4c')]({'where':{'id':_0x3de8f4[_0xf731('0x44')]['id']}})['then'](handleEntityNotFound(_0x4c2ad6,null))[_0xf731('0x24')](function(_0x15ff1d){if(_0x15ff1d){_0xdae656=_0x15ff1d;_0x56dd0c[_0xf731('0x2f')]=_[_0xf731('0x30')](db['VtigerField'][_0xf731('0x2b')]);_0x56dd0c[_0xf731('0x31')]=_['keys'](_0x3de8f4[_0xf731('0x31')]);_0x56dd0c[_0xf731('0x32')]=_[_0xf731('0x33')](_0x56dd0c[_0xf731('0x2f')],_0x56dd0c['query']);_0x5e8b8b[_0xf731('0x34')]=_['intersection'](_0x56dd0c[_0xf731('0x2f')],qs[_0xf731('0x35')](_0x3de8f4[_0xf731('0x31')]['fields']));_0x5e8b8b[_0xf731('0x34')]=_0x5e8b8b[_0xf731('0x34')][_0xf731('0x36')]?_0x5e8b8b[_0xf731('0x34')]:_0x56dd0c['model'];_0x5e8b8b[_0xf731('0x39')]=qs[_0xf731('0x3a')](_0x3de8f4[_0xf731('0x31')]['sort']);_0x5e8b8b[_0xf731('0x3b')]=qs[_0xf731('0x32')](_[_0xf731('0x3c')](_0x3de8f4['query'],_0x56dd0c[_0xf731('0x32')]));if(_0x3de8f4[_0xf731('0x31')][_0xf731('0x4e')]){_0x5e8b8b[_0xf731('0x3b')]=_[_0xf731('0x3d')](_0x5e8b8b[_0xf731('0x3b')],{'$or':_[_0xf731('0x29')](_0x5e8b8b['attributes'],function(_0x1216b3){var _0x54809e={};_0x54809e[_0x1216b3]={'$like':'%'+_0x3de8f4[_0xf731('0x31')][_0xf731('0x4e')]+'%'};return _0x54809e;})});}_0x5e8b8b=_[_0xf731('0x3d')]({},_0x5e8b8b,_0x3de8f4[_0xf731('0x3e')]);return _0xdae656[_0xf731('0x50')](_0x5e8b8b);}})['then'](function(_0x401aac){if(_0x401aac){_0xfc620b=_0x401aac[_0xf731('0x36')];if(!_0x3de8f4['query'][_0xf731('0x37')](_0xf731('0x38'))){_0x5e8b8b['limit']=qs['limit'](_0x3de8f4[_0xf731('0x31')][_0xf731('0x1d')]);_0x5e8b8b[_0xf731('0x1b')]=qs[_0xf731('0x1b')](_0x3de8f4[_0xf731('0x31')][_0xf731('0x1b')]);}return _0xdae656[_0xf731('0x50')](_0x5e8b8b);}})[_0xf731('0x24')](function(_0x37f71b){if(_0x37f71b){return _0x37f71b?{'count':_0xfc620b,'rows':_0x37f71b}:null;}})['then'](respondWithResult(_0x4c2ad6,null))['catch'](handleError(_0x4c2ad6,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index 10c9dd8..1e794f2 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 _0x4d0e=['request-promise','path','rimraf','../../config/environment','./intVtigerConfiguration.attributes','exports','define','VtigerConfiguration','lodash','../../config/logger','api','moment','bluebird'];(function(_0xfcdda0,_0x32479b){var _0x17ebe3=function(_0x5bfaa3){while(--_0x5bfaa3){_0xfcdda0['push'](_0xfcdda0['shift']());}};_0x17ebe3(++_0x32479b);}(_0x4d0e,0x15a));var _0xe4d0=function(_0x2760da,_0x381ef9){_0x2760da=_0x2760da-0x0;var _0x4c20e0=_0x4d0e[_0x2760da];return _0x4c20e0;};'use strict';var _=require(_0xe4d0('0x0'));var util=require('util');var logger=require(_0xe4d0('0x1'))(_0xe4d0('0x2'));var moment=require(_0xe4d0('0x3'));var BPromise=require(_0xe4d0('0x4'));var rp=require(_0xe4d0('0x5'));var fs=require('fs');var path=require(_0xe4d0('0x6'));var rimraf=require(_0xe4d0('0x7'));var config=require(_0xe4d0('0x8'));var attributes=require(_0xe4d0('0x9'));module[_0xe4d0('0xa')]=function(_0x183ccc,_0x4db717){return _0x183ccc[_0xe4d0('0xb')](_0xe4d0('0xc'),attributes,{'tableName':'int_vtiger_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x65f6=['VtigerConfiguration','int_vtiger_configurations','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intVtigerConfiguration.attributes','define'];(function(_0x56fcdd,_0xd2662f){var _0xf5674=function(_0x36313e){while(--_0x36313e){_0x56fcdd['push'](_0x56fcdd['shift']());}};_0xf5674(++_0xd2662f);}(_0x65f6,0x147));var _0x665f=function(_0x4cd6e2,_0x31cf56){_0x4cd6e2=_0x4cd6e2-0x0;var _0x3a310b=_0x65f6[_0x4cd6e2];return _0x3a310b;};'use strict';var _=require('lodash');var util=require(_0x665f('0x0'));var logger=require(_0x665f('0x1'))(_0x665f('0x2'));var moment=require(_0x665f('0x3'));var BPromise=require(_0x665f('0x4'));var rp=require(_0x665f('0x5'));var fs=require('fs');var path=require(_0x665f('0x6'));var rimraf=require(_0x665f('0x7'));var config=require(_0x665f('0x8'));var attributes=require(_0x665f('0x9'));module['exports']=function(_0x2f9270,_0x2cfda7){return _0x2f9270[_0x665f('0xa')](_0x665f('0xb'),attributes,{'tableName':_0x665f('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 044bb20..6b5e646 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 _0xc607=['http','request','then','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0x173441,_0x26b0d9){var _0x2423a8=function(_0x4d96c2){while(--_0x4d96c2){_0x173441['push'](_0x173441['shift']());}};_0x2423a8(++_0x26b0d9);}(_0xc607,0x1d5));var _0x7c60=function(_0x1b3eea,_0x4d5733){_0x1b3eea=_0x1b3eea-0x0;var _0x2d59b6=_0xc607[_0x1b3eea];return _0x2d59b6;};'use strict';var _=require(_0x7c60('0x0'));var util=require(_0x7c60('0x1'));var moment=require(_0x7c60('0x2'));var BPromise=require(_0x7c60('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7c60('0x4'));var db=require(_0x7c60('0x5'))['db'];var utils=require(_0x7c60('0x6'));var logger=require(_0x7c60('0x7'))('rpc');var config=require(_0x7c60('0x8'));var jayson=require(_0x7c60('0x9'));var client=jayson[_0x7c60('0xa')][_0x7c60('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1a7f26,_0x3f0c88,_0x470902){return new BPromise(function(_0x57f93b,_0x3fc750){return client[_0x7c60('0xc')](_0x1a7f26,_0x470902)[_0x7c60('0xd')](function(_0x15f2ea){logger[_0x7c60('0xe')](_0x7c60('0xf'),_0x3f0c88,_0x7c60('0x10'));logger[_0x7c60('0x11')](_0x7c60('0x12'),_0x3f0c88,_0x7c60('0x10'),JSON[_0x7c60('0x13')](_0x15f2ea));if(_0x15f2ea[_0x7c60('0x14')]){if(_0x15f2ea['error'][_0x7c60('0x15')]===0x1f4){logger[_0x7c60('0x14')](_0x7c60('0xf'),_0x3f0c88,_0x15f2ea['error']['message']);return _0x3fc750(_0x15f2ea[_0x7c60('0x14')][_0x7c60('0x16')]);}logger[_0x7c60('0x14')]('VtigerConfiguration,\x20%s,\x20%s',_0x3f0c88,_0x15f2ea[_0x7c60('0x14')][_0x7c60('0x16')]);return _0x57f93b(_0x15f2ea['error']['message']);}else{logger[_0x7c60('0xe')]('VtigerConfiguration,\x20%s,\x20%s',_0x3f0c88,'request\x20sent');_0x57f93b(_0x15f2ea['result'][_0x7c60('0x16')]);}})[_0x7c60('0x17')](function(_0x1aa69d){logger[_0x7c60('0x14')]('VtigerConfiguration,\x20%s,\x20%s',_0x3f0c88,_0x1aa69d);_0x3fc750(_0x1aa69d);});});} \ No newline at end of file +var _0x9860=['message','result','catch','lodash','util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x4c12ec,_0x2e9103){var _0x3ae42c=function(_0x5a728f){while(--_0x5a728f){_0x4c12ec['push'](_0x4c12ec['shift']());}};_0x3ae42c(++_0x2e9103);}(_0x9860,0xc9));var _0x0986=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9860[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x0986('0x0'));var util=require(_0x0986('0x1'));var moment=require(_0x0986('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0986('0x3'))['db'];var utils=require(_0x0986('0x4'));var logger=require(_0x0986('0x5'))(_0x0986('0x6'));var config=require('../../config/environment');var jayson=require(_0x0986('0x7'));var client=jayson[_0x0986('0x8')][_0x0986('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x392fbf,_0x1ce179,_0x19d9a4){return new BPromise(function(_0xdccdee,_0xb542f4){return client[_0x0986('0xa')](_0x392fbf,_0x19d9a4)[_0x0986('0xb')](function(_0x1b4c32){logger[_0x0986('0xc')](_0x0986('0xd'),_0x1ce179,_0x0986('0xe'));logger[_0x0986('0xf')](_0x0986('0x10'),_0x1ce179,_0x0986('0xe'),JSON[_0x0986('0x11')](_0x1b4c32));if(_0x1b4c32[_0x0986('0x12')]){if(_0x1b4c32[_0x0986('0x12')]['code']===0x1f4){logger[_0x0986('0x12')](_0x0986('0xd'),_0x1ce179,_0x1b4c32['error']['message']);return _0xb542f4(_0x1b4c32[_0x0986('0x12')][_0x0986('0x13')]);}logger[_0x0986('0x12')](_0x0986('0xd'),_0x1ce179,_0x1b4c32[_0x0986('0x12')][_0x0986('0x13')]);return _0xdccdee(_0x1b4c32[_0x0986('0x12')]['message']);}else{logger[_0x0986('0xc')](_0x0986('0xd'),_0x1ce179,_0x0986('0xe'));_0xdccdee(_0x1b4c32[_0x0986('0x14')]['message']);}})[_0x0986('0x15')](function(_0x1e6f20){logger['error'](_0x0986('0xd'),_0x1ce179,_0x1e6f20);_0xb542f4(_0x1e6f20);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index 05f8e9d..3b5af6b 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 _0x86eb=['../../components/auth/service','../../config/environment','get','index','/:id','show','isAuthenticated','create','put','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra'];(function(_0x3ef561,_0x31d930){var _0x510796=function(_0x34782e){while(--_0x34782e){_0x3ef561['push'](_0x3ef561['shift']());}};_0x510796(++_0x31d930);}(_0x86eb,0x12a));var _0xb86e=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x86eb[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0xb86e('0x0'));var util=require(_0xb86e('0x1'));var path=require(_0xb86e('0x2'));var timeout=require('connect-timeout');var express=require(_0xb86e('0x3'));var router=express[_0xb86e('0x4')]();var fs_extra=require(_0xb86e('0x5'));var auth=require(_0xb86e('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xb86e('0x7'));var controller=require('./intVtigerField.controller');router[_0xb86e('0x8')]('/',auth['isAuthenticated'](),controller[_0xb86e('0x9')]);router['get'](_0xb86e('0xa'),auth['isAuthenticated'](),controller[_0xb86e('0xb')]);router['post']('/',auth[_0xb86e('0xc')](),controller[_0xb86e('0xd')]);router[_0xb86e('0xe')](_0xb86e('0xa'),auth[_0xb86e('0xc')](),controller[_0xb86e('0xf')]);router[_0xb86e('0x10')](_0xb86e('0xa'),auth['isAuthenticated'](),controller[_0xb86e('0x11')]);module[_0xb86e('0x12')]=router; \ No newline at end of file +var _0x5008=['put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','./intVtigerField.controller','get','/:id','show','post','isAuthenticated','create'];(function(_0x19f05d,_0x58819d){var _0x5e98b8=function(_0x467442){while(--_0x467442){_0x19f05d['push'](_0x19f05d['shift']());}};_0x5e98b8(++_0x58819d);}(_0x5008,0xaf));var _0x8500=function(_0x126fb9,_0x122c59){_0x126fb9=_0x126fb9-0x0;var _0xc8a3b1=_0x5008[_0x126fb9];return _0xc8a3b1;};'use strict';var multer=require(_0x8500('0x0'));var util=require(_0x8500('0x1'));var path=require(_0x8500('0x2'));var timeout=require(_0x8500('0x3'));var express=require('express');var router=express[_0x8500('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x8500('0x5'));router[_0x8500('0x6')]('/',auth['isAuthenticated'](),controller['index']);router[_0x8500('0x6')](_0x8500('0x7'),auth['isAuthenticated'](),controller[_0x8500('0x8')]);router[_0x8500('0x9')]('/',auth[_0x8500('0xa')](),controller[_0x8500('0xb')]);router[_0x8500('0xc')](_0x8500('0x7'),auth[_0x8500('0xa')](),controller[_0x8500('0xd')]);router[_0x8500('0xe')](_0x8500('0x7'),auth[_0x8500('0xa')](),controller[_0x8500('0xf')]);module[_0x8500('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 d020052..9a70c90 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 _0x2ca5=['ENUM','string','customVariable','keyValue','picklist','STRING','variable','BOOLEAN','exports'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x2ca5,0x131));var _0x52ca=function(_0x903ca9,_0x2fbc2a){_0x903ca9=_0x903ca9-0x0;var _0x370719=_0x2ca5[_0x903ca9];return _0x370719;};'use strict';var Sequelize=require('sequelize');module[_0x52ca('0x0')]={'type':{'type':Sequelize[_0x52ca('0x1')](_0x52ca('0x2'),'variable',_0x52ca('0x3'),_0x52ca('0x4'),_0x52ca('0x5')),'defaultValue':'string'},'content':{'type':Sequelize[_0x52ca('0x6')]},'key':{'type':Sequelize[_0x52ca('0x6')]},'keyType':{'type':Sequelize['ENUM'](_0x52ca('0x2'),_0x52ca('0x7'),_0x52ca('0x3'))},'keyContent':{'type':Sequelize[_0x52ca('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x52ca('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x52ca('0x6')]}}; \ No newline at end of file +var _0x86c8=['customVariable','keyValue','picklist','string','STRING','BOOLEAN','exports','ENUM','variable'];(function(_0x35d775,_0x25431e){var _0x59384d=function(_0x1a0c15){while(--_0x1a0c15){_0x35d775['push'](_0x35d775['shift']());}};_0x59384d(++_0x25431e);}(_0x86c8,0x19b));var _0x886c=function(_0x204fa6,_0x285516){_0x204fa6=_0x204fa6-0x0;var _0x37664b=_0x86c8[_0x204fa6];return _0x37664b;};'use strict';var Sequelize=require('sequelize');module[_0x886c('0x0')]={'type':{'type':Sequelize[_0x886c('0x1')]('string',_0x886c('0x2'),_0x886c('0x3'),_0x886c('0x4'),_0x886c('0x5')),'defaultValue':_0x886c('0x6')},'content':{'type':Sequelize[_0x886c('0x7')]},'key':{'type':Sequelize[_0x886c('0x7')]},'keyType':{'type':Sequelize['ENUM'](_0x886c('0x6'),'variable',_0x886c('0x3'))},'keyContent':{'type':Sequelize[_0x886c('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x886c('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x886c('0x7')]}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index 60aa1e6..26f27ad 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 _0xecc5=['fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','reject','save','update','then','error','stack','name','send','map','VtigerField','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','keys','create','body','find','destroy','eml-format','zip-dir'];(function(_0x4320ce,_0x49f5f5){var _0x537dae=function(_0x5991ef){while(--_0x5991ef){_0x4320ce['push'](_0x4320ce['shift']());}};_0x537dae(++_0x49f5f5);}(_0xecc5,0x96));var _0x5ecc=function(_0x41fab2,_0x368e80){_0x41fab2=_0x41fab2-0x0;var _0xeb8d59=_0xecc5[_0x41fab2];return _0xeb8d59;};'use strict';var emlformat=require(_0x5ecc('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5ecc('0x1'));var jsonpatch=require(_0x5ecc('0x2'));var rp=require(_0x5ecc('0x3'));var moment=require(_0x5ecc('0x4'));var BPromise=require(_0x5ecc('0x5'));var Mustache=require(_0x5ecc('0x6'));var util=require(_0x5ecc('0x7'));var path=require(_0x5ecc('0x8'));var sox=require(_0x5ecc('0x9'));var csv=require(_0x5ecc('0xa'));var ejs=require(_0x5ecc('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5ecc('0xc'));var squel=require(_0x5ecc('0xd'));var crypto=require(_0x5ecc('0xe'));var jsforce=require(_0x5ecc('0xf'));var deskjs=require(_0x5ecc('0x10'));var toCsv=require(_0x5ecc('0xa'));var querystring=require('querystring');var Papa=require(_0x5ecc('0x11'));var Redis=require(_0x5ecc('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x5ecc('0x13'));var hardwareService=require(_0x5ecc('0x14'));var logger=require(_0x5ecc('0x15'))(_0x5ecc('0x16'));var utils=require(_0x5ecc('0x17'));var config=require(_0x5ecc('0x18'));var licenseUtil=require(_0x5ecc('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x132784,_0x478bb3){_0x478bb3=_0x478bb3||0xcc;return function(_0x2c4340){if(_0x2c4340){return _0x132784[_0x5ecc('0x1a')](_0x478bb3);}return _0x132784[_0x5ecc('0x1b')](_0x478bb3)[_0x5ecc('0x1c')]();};}function respondWithResult(_0xf30494,_0xd7acfa){_0xd7acfa=_0xd7acfa||0xc8;return function(_0x4f28cc){if(_0x4f28cc){return _0xf30494[_0x5ecc('0x1b')](_0xd7acfa)['json'](_0x4f28cc);}};}function respondWithFilteredResult(_0x366091,_0x135b80){return function(_0x3dec16){if(_0x3dec16){var _0x1df89e=typeof _0x135b80[_0x5ecc('0x1d')]===_0x5ecc('0x1e')&&typeof _0x135b80[_0x5ecc('0x1f')]==='undefined';var _0x74cfcb=_0x3dec16[_0x5ecc('0x20')];var _0x450273=_0x1df89e?0x0:_0x135b80['offset'];var _0x1d2f36=_0x1df89e?_0x3dec16['count']:_0x135b80['offset']+_0x135b80[_0x5ecc('0x1f')];var _0x18c742;if(_0x1d2f36>=_0x74cfcb){_0x1d2f36=_0x74cfcb;_0x18c742=0xc8;}else{_0x18c742=0xce;}_0x366091[_0x5ecc('0x1b')](_0x18c742);return _0x366091[_0x5ecc('0x21')](_0x5ecc('0x22'),_0x450273+'-'+_0x1d2f36+'/'+_0x74cfcb)[_0x5ecc('0x23')](_0x3dec16);}return null;};}function patchUpdates(_0x23952a){return function(_0x45a0c8){try{jsonpatch['apply'](_0x45a0c8,_0x23952a,!![]);}catch(_0x3f6057){return BPromise[_0x5ecc('0x24')](_0x3f6057);}return _0x45a0c8[_0x5ecc('0x25')]();};}function saveUpdates(_0x19c626,_0x17f35f){return function(_0x17d076){if(_0x17d076){return _0x17d076[_0x5ecc('0x26')](_0x19c626)[_0x5ecc('0x27')](function(_0x3bbeaf){return _0x3bbeaf;});}return null;};}function removeEntity(_0x5b0355,_0x346d70){return function(_0x405bf7){if(_0x405bf7){return _0x405bf7['destroy']()[_0x5ecc('0x27')](function(){_0x5b0355[_0x5ecc('0x1b')](0xcc)[_0x5ecc('0x1c')]();});}};}function handleEntityNotFound(_0x46a76c,_0xa7a7ba){return function(_0x4fb6d9){if(!_0x4fb6d9){_0x46a76c['sendStatus'](0x194);}return _0x4fb6d9;};}function handleError(_0x65cc24,_0x47f172){_0x47f172=_0x47f172||0x1f4;return function(_0x4c4bd2){logger[_0x5ecc('0x28')](_0x4c4bd2[_0x5ecc('0x29')]);if(_0x4c4bd2[_0x5ecc('0x2a')]){delete _0x4c4bd2[_0x5ecc('0x2a')];}_0x65cc24[_0x5ecc('0x1b')](_0x47f172)[_0x5ecc('0x2b')](_0x4c4bd2);};}exports['index']=function(_0x181fbb,_0x3ec051){var _0x5c46d5={},_0x6ff5c0={},_0x217f47={'count':0x0,'rows':[]};var _0x95ad7e=_[_0x5ecc('0x2c')](db[_0x5ecc('0x2d')][_0x5ecc('0x2e')],function(_0x1ed13f){return{'name':_0x1ed13f[_0x5ecc('0x2f')],'type':_0x1ed13f[_0x5ecc('0x30')]['key']};});_0x6ff5c0[_0x5ecc('0x31')]=_[_0x5ecc('0x2c')](_0x95ad7e,_0x5ecc('0x2a'));_0x6ff5c0['query']=_['keys'](_0x181fbb[_0x5ecc('0x32')]);_0x6ff5c0[_0x5ecc('0x33')]=_[_0x5ecc('0x34')](_0x6ff5c0[_0x5ecc('0x31')],_0x6ff5c0[_0x5ecc('0x32')]);_0x5c46d5[_0x5ecc('0x35')]=_[_0x5ecc('0x34')](_0x6ff5c0[_0x5ecc('0x31')],qs[_0x5ecc('0x36')](_0x181fbb[_0x5ecc('0x32')][_0x5ecc('0x36')]));_0x5c46d5['attributes']=_0x5c46d5['attributes'][_0x5ecc('0x37')]?_0x5c46d5[_0x5ecc('0x35')]:_0x6ff5c0[_0x5ecc('0x31')];if(!_0x181fbb[_0x5ecc('0x32')]['hasOwnProperty'](_0x5ecc('0x38'))){_0x5c46d5[_0x5ecc('0x1f')]=qs[_0x5ecc('0x1f')](_0x181fbb[_0x5ecc('0x32')]['limit']);_0x5c46d5[_0x5ecc('0x1d')]=qs['offset'](_0x181fbb[_0x5ecc('0x32')]['offset']);}_0x5c46d5[_0x5ecc('0x39')]=qs[_0x5ecc('0x3a')](_0x181fbb[_0x5ecc('0x32')][_0x5ecc('0x3a')]);_0x5c46d5[_0x5ecc('0x3b')]=qs['filters'](_[_0x5ecc('0x3c')](_0x181fbb[_0x5ecc('0x32')],_0x6ff5c0[_0x5ecc('0x33')]),_0x95ad7e);if(_0x181fbb[_0x5ecc('0x32')][_0x5ecc('0x3d')]){_0x5c46d5[_0x5ecc('0x3b')]=_[_0x5ecc('0x3e')](_0x5c46d5['where'],{'$or':_[_0x5ecc('0x2c')](_0x95ad7e,function(_0x575fb3){if(_0x575fb3[_0x5ecc('0x30')]!==_0x5ecc('0x3f')){var _0x4639eb={};_0x4639eb[_0x575fb3['name']]={'$like':'%'+_0x181fbb[_0x5ecc('0x32')][_0x5ecc('0x3d')]+'%'};return _0x4639eb;}})});}_0x5c46d5=_[_0x5ecc('0x3e')]({},_0x5c46d5,_0x181fbb[_0x5ecc('0x40')]);var _0x494860={'where':_0x5c46d5['where']};return db[_0x5ecc('0x2d')][_0x5ecc('0x20')](_0x494860)[_0x5ecc('0x27')](function(_0x38ead6){_0x217f47[_0x5ecc('0x20')]=_0x38ead6;if(_0x181fbb[_0x5ecc('0x32')][_0x5ecc('0x41')]){_0x5c46d5[_0x5ecc('0x42')]=[{'all':!![]}];}return db[_0x5ecc('0x2d')]['findAll'](_0x5c46d5);})['then'](function(_0x147c44){_0x217f47[_0x5ecc('0x43')]=_0x147c44;return _0x217f47;})['then'](respondWithFilteredResult(_0x3ec051,_0x5c46d5))[_0x5ecc('0x44')](handleError(_0x3ec051,null));};exports[_0x5ecc('0x45')]=function(_0x56b460,_0x3583e1){var _0x70ed74={'raw':!![],'where':{'id':_0x56b460[_0x5ecc('0x46')]['id']}},_0x9ff83c={};_0x9ff83c[_0x5ecc('0x31')]=_[_0x5ecc('0x47')](db['VtigerField'][_0x5ecc('0x2e')]);_0x9ff83c['query']=_[_0x5ecc('0x47')](_0x56b460['query']);_0x9ff83c[_0x5ecc('0x33')]=_[_0x5ecc('0x34')](_0x9ff83c['model'],_0x9ff83c['query']);_0x70ed74[_0x5ecc('0x35')]=_[_0x5ecc('0x34')](_0x9ff83c[_0x5ecc('0x31')],qs[_0x5ecc('0x36')](_0x56b460[_0x5ecc('0x32')]['fields']));_0x70ed74[_0x5ecc('0x35')]=_0x70ed74['attributes'][_0x5ecc('0x37')]?_0x70ed74[_0x5ecc('0x35')]:_0x9ff83c['model'];if(_0x56b460[_0x5ecc('0x32')]['includeAll']){_0x70ed74['include']=[{'all':!![]}];}_0x70ed74=_[_0x5ecc('0x3e')]({},_0x70ed74,_0x56b460[_0x5ecc('0x40')]);return db[_0x5ecc('0x2d')]['find'](_0x70ed74)[_0x5ecc('0x27')](handleEntityNotFound(_0x3583e1,null))[_0x5ecc('0x27')](respondWithResult(_0x3583e1,null))['catch'](handleError(_0x3583e1,null));};exports[_0x5ecc('0x48')]=function(_0x554d2b,_0x13f5bf){return db['VtigerField'][_0x5ecc('0x48')](_0x554d2b['body'],{})[_0x5ecc('0x27')](respondWithResult(_0x13f5bf,0xc9))['catch'](handleError(_0x13f5bf,null));};exports['update']=function(_0x2f98b9,_0x33f4f3){if(_0x2f98b9[_0x5ecc('0x49')]['id']){delete _0x2f98b9[_0x5ecc('0x49')]['id'];}return db[_0x5ecc('0x2d')][_0x5ecc('0x4a')]({'where':{'id':_0x2f98b9['params']['id']}})[_0x5ecc('0x27')](handleEntityNotFound(_0x33f4f3,null))[_0x5ecc('0x27')](saveUpdates(_0x2f98b9[_0x5ecc('0x49')],null))[_0x5ecc('0x27')](respondWithResult(_0x33f4f3,null))[_0x5ecc('0x44')](handleError(_0x33f4f3,null));};exports[_0x5ecc('0x4b')]=function(_0x43b359,_0x22309b){return db[_0x5ecc('0x2d')][_0x5ecc('0x4a')]({'where':{'id':_0x43b359[_0x5ecc('0x46')]['id']}})[_0x5ecc('0x27')](handleEntityNotFound(_0x22309b,null))[_0x5ecc('0x27')](removeEntity(_0x22309b,null))[_0x5ecc('0x44')](handleError(_0x22309b,null));}; \ No newline at end of file +var _0x1c21=['jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','Content-Range','apply','save','update','then','destroy','end','error','stack','name','index','map','VtigerField','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto'];(function(_0x872b02,_0x4f4458){var _0x1a6b24=function(_0x1dfb4e){while(--_0x1dfb4e){_0x872b02['push'](_0x872b02['shift']());}};_0x1a6b24(++_0x4f4458);}(_0x1c21,0xd3));var _0x11c2=function(_0x40bcb3,_0x5bc065){_0x40bcb3=_0x40bcb3-0x0;var _0x2e3e95=_0x1c21[_0x40bcb3];return _0x2e3e95;};'use strict';var emlformat=require(_0x11c2('0x0'));var rimraf=require(_0x11c2('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x11c2('0x2'));var rp=require(_0x11c2('0x3'));var moment=require(_0x11c2('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x11c2('0x5'));var util=require(_0x11c2('0x6'));var path=require(_0x11c2('0x7'));var sox=require(_0x11c2('0x8'));var csv=require(_0x11c2('0x9'));var ejs=require(_0x11c2('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x11c2('0xb'));var squel=require(_0x11c2('0xc'));var crypto=require(_0x11c2('0xd'));var jsforce=require(_0x11c2('0xe'));var deskjs=require(_0x11c2('0xf'));var toCsv=require(_0x11c2('0x9'));var querystring=require(_0x11c2('0x10'));var Papa=require('papaparse');var Redis=require(_0x11c2('0x11'));var authService=require(_0x11c2('0x12'));var qs=require(_0x11c2('0x13'));var as=require(_0x11c2('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x11c2('0x15'));var utils=require(_0x11c2('0x16'));var config=require(_0x11c2('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x11c2('0x18'))['db'];function respondWithStatusCode(_0x2b172a,_0x361cb4){_0x361cb4=_0x361cb4||0xcc;return function(_0x22a07d){if(_0x22a07d){return _0x2b172a[_0x11c2('0x19')](_0x361cb4);}return _0x2b172a[_0x11c2('0x1a')](_0x361cb4)['end']();};}function respondWithResult(_0x368a89,_0x258ff4){_0x258ff4=_0x258ff4||0xc8;return function(_0x34d2d8){if(_0x34d2d8){return _0x368a89[_0x11c2('0x1a')](_0x258ff4)[_0x11c2('0x1b')](_0x34d2d8);}};}function respondWithFilteredResult(_0x172d62,_0x3bcf54){return function(_0x54392f){if(_0x54392f){var _0x4de02b=typeof _0x3bcf54['offset']===_0x11c2('0x1c')&&typeof _0x3bcf54[_0x11c2('0x1d')]===_0x11c2('0x1c');var _0x2e01e3=_0x54392f[_0x11c2('0x1e')];var _0xf28602=_0x4de02b?0x0:_0x3bcf54[_0x11c2('0x1f')];var _0x4ca230=_0x4de02b?_0x54392f[_0x11c2('0x1e')]:_0x3bcf54['offset']+_0x3bcf54[_0x11c2('0x1d')];var _0x71b971;if(_0x4ca230>=_0x2e01e3){_0x4ca230=_0x2e01e3;_0x71b971=0xc8;}else{_0x71b971=0xce;}_0x172d62['status'](_0x71b971);return _0x172d62['set'](_0x11c2('0x20'),_0xf28602+'-'+_0x4ca230+'/'+_0x2e01e3)[_0x11c2('0x1b')](_0x54392f);}return null;};}function patchUpdates(_0x2de6a7){return function(_0x143287){try{jsonpatch[_0x11c2('0x21')](_0x143287,_0x2de6a7,!![]);}catch(_0xd9e8bb){return BPromise['reject'](_0xd9e8bb);}return _0x143287[_0x11c2('0x22')]();};}function saveUpdates(_0x50de1f,_0x28c472){return function(_0x501fb9){if(_0x501fb9){return _0x501fb9[_0x11c2('0x23')](_0x50de1f)[_0x11c2('0x24')](function(_0x527774){return _0x527774;});}return null;};}function removeEntity(_0x9569f7,_0x108311){return function(_0x55f2b3){if(_0x55f2b3){return _0x55f2b3[_0x11c2('0x25')]()[_0x11c2('0x24')](function(){_0x9569f7[_0x11c2('0x1a')](0xcc)[_0x11c2('0x26')]();});}};}function handleEntityNotFound(_0x5583f2,_0x4cb7e2){return function(_0x51ff24){if(!_0x51ff24){_0x5583f2['sendStatus'](0x194);}return _0x51ff24;};}function handleError(_0x3bc92c,_0x483ebc){_0x483ebc=_0x483ebc||0x1f4;return function(_0x48e424){logger[_0x11c2('0x27')](_0x48e424[_0x11c2('0x28')]);if(_0x48e424[_0x11c2('0x29')]){delete _0x48e424[_0x11c2('0x29')];}_0x3bc92c[_0x11c2('0x1a')](_0x483ebc)['send'](_0x48e424);};}exports[_0x11c2('0x2a')]=function(_0x19aaa1,_0x242779){var _0x22fa52={},_0x4c5431={},_0x46bcdb={'count':0x0,'rows':[]};var _0x2cf71a=_[_0x11c2('0x2b')](db[_0x11c2('0x2c')][_0x11c2('0x2d')],function(_0x224afc){return{'name':_0x224afc[_0x11c2('0x2e')],'type':_0x224afc[_0x11c2('0x2f')][_0x11c2('0x30')]};});_0x4c5431[_0x11c2('0x31')]=_['map'](_0x2cf71a,_0x11c2('0x29'));_0x4c5431[_0x11c2('0x32')]=_[_0x11c2('0x33')](_0x19aaa1[_0x11c2('0x32')]);_0x4c5431[_0x11c2('0x34')]=_[_0x11c2('0x35')](_0x4c5431[_0x11c2('0x31')],_0x4c5431[_0x11c2('0x32')]);_0x22fa52[_0x11c2('0x36')]=_['intersection'](_0x4c5431[_0x11c2('0x31')],qs[_0x11c2('0x37')](_0x19aaa1[_0x11c2('0x32')][_0x11c2('0x37')]));_0x22fa52['attributes']=_0x22fa52[_0x11c2('0x36')][_0x11c2('0x38')]?_0x22fa52[_0x11c2('0x36')]:_0x4c5431['model'];if(!_0x19aaa1[_0x11c2('0x32')]['hasOwnProperty']('nolimit')){_0x22fa52[_0x11c2('0x1d')]=qs[_0x11c2('0x1d')](_0x19aaa1[_0x11c2('0x32')]['limit']);_0x22fa52[_0x11c2('0x1f')]=qs['offset'](_0x19aaa1[_0x11c2('0x32')][_0x11c2('0x1f')]);}_0x22fa52[_0x11c2('0x39')]=qs[_0x11c2('0x3a')](_0x19aaa1[_0x11c2('0x32')][_0x11c2('0x3a')]);_0x22fa52[_0x11c2('0x3b')]=qs[_0x11c2('0x34')](_[_0x11c2('0x3c')](_0x19aaa1['query'],_0x4c5431[_0x11c2('0x34')]),_0x2cf71a);if(_0x19aaa1[_0x11c2('0x32')][_0x11c2('0x3d')]){_0x22fa52['where']=_[_0x11c2('0x3e')](_0x22fa52[_0x11c2('0x3b')],{'$or':_[_0x11c2('0x2b')](_0x2cf71a,function(_0x51bde0){if(_0x51bde0[_0x11c2('0x2f')]!==_0x11c2('0x3f')){var _0x2d512d={};_0x2d512d[_0x51bde0[_0x11c2('0x29')]]={'$like':'%'+_0x19aaa1[_0x11c2('0x32')][_0x11c2('0x3d')]+'%'};return _0x2d512d;}})});}_0x22fa52=_[_0x11c2('0x3e')]({},_0x22fa52,_0x19aaa1['options']);var _0x1e2a6d={'where':_0x22fa52[_0x11c2('0x3b')]};return db[_0x11c2('0x2c')]['count'](_0x1e2a6d)[_0x11c2('0x24')](function(_0x429118){_0x46bcdb[_0x11c2('0x1e')]=_0x429118;if(_0x19aaa1[_0x11c2('0x32')][_0x11c2('0x40')]){_0x22fa52[_0x11c2('0x41')]=[{'all':!![]}];}return db[_0x11c2('0x2c')][_0x11c2('0x42')](_0x22fa52);})['then'](function(_0x47bd36){_0x46bcdb[_0x11c2('0x43')]=_0x47bd36;return _0x46bcdb;})[_0x11c2('0x24')](respondWithFilteredResult(_0x242779,_0x22fa52))[_0x11c2('0x44')](handleError(_0x242779,null));};exports[_0x11c2('0x45')]=function(_0x363df7,_0x2c0677){var _0x2b0284={'raw':!![],'where':{'id':_0x363df7[_0x11c2('0x46')]['id']}},_0x4909a1={};_0x4909a1[_0x11c2('0x31')]=_[_0x11c2('0x33')](db[_0x11c2('0x2c')][_0x11c2('0x2d')]);_0x4909a1[_0x11c2('0x32')]=_['keys'](_0x363df7[_0x11c2('0x32')]);_0x4909a1[_0x11c2('0x34')]=_[_0x11c2('0x35')](_0x4909a1[_0x11c2('0x31')],_0x4909a1[_0x11c2('0x32')]);_0x2b0284[_0x11c2('0x36')]=_[_0x11c2('0x35')](_0x4909a1[_0x11c2('0x31')],qs['fields'](_0x363df7[_0x11c2('0x32')][_0x11c2('0x37')]));_0x2b0284[_0x11c2('0x36')]=_0x2b0284[_0x11c2('0x36')][_0x11c2('0x38')]?_0x2b0284[_0x11c2('0x36')]:_0x4909a1[_0x11c2('0x31')];if(_0x363df7[_0x11c2('0x32')]['includeAll']){_0x2b0284[_0x11c2('0x41')]=[{'all':!![]}];}_0x2b0284=_[_0x11c2('0x3e')]({},_0x2b0284,_0x363df7[_0x11c2('0x47')]);return db[_0x11c2('0x2c')][_0x11c2('0x48')](_0x2b0284)[_0x11c2('0x24')](handleEntityNotFound(_0x2c0677,null))[_0x11c2('0x24')](respondWithResult(_0x2c0677,null))[_0x11c2('0x44')](handleError(_0x2c0677,null));};exports[_0x11c2('0x49')]=function(_0x3af1b2,_0x2ec237){return db[_0x11c2('0x2c')][_0x11c2('0x49')](_0x3af1b2[_0x11c2('0x4a')],{})[_0x11c2('0x24')](respondWithResult(_0x2ec237,0xc9))[_0x11c2('0x44')](handleError(_0x2ec237,null));};exports[_0x11c2('0x23')]=function(_0x232a27,_0x26d7e9){if(_0x232a27[_0x11c2('0x4a')]['id']){delete _0x232a27[_0x11c2('0x4a')]['id'];}return db[_0x11c2('0x2c')][_0x11c2('0x48')]({'where':{'id':_0x232a27[_0x11c2('0x46')]['id']}})[_0x11c2('0x24')](handleEntityNotFound(_0x26d7e9,null))['then'](saveUpdates(_0x232a27['body'],null))[_0x11c2('0x24')](respondWithResult(_0x26d7e9,null))[_0x11c2('0x44')](handleError(_0x26d7e9,null));};exports['destroy']=function(_0x51ffd9,_0x350efd){return db[_0x11c2('0x2c')][_0x11c2('0x48')]({'where':{'id':_0x51ffd9['params']['id']}})[_0x11c2('0x24')](handleEntityNotFound(_0x350efd,null))[_0x11c2('0x24')](removeEntity(_0x350efd,null))['catch'](handleError(_0x350efd,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index c23d2bc..f438f20 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 _0x39c3=['./intVtigerField.attributes','exports','define','VtigerField','int_vtiger_fields','vtiger_unique_index','idField','FieldId','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x10c71f,_0xfa6d98){var _0x56b5a4=function(_0x5de344){while(--_0x5de344){_0x10c71f['push'](_0x10c71f['shift']());}};_0x56b5a4(++_0xfa6d98);}(_0x39c3,0x198));var _0x339c=function(_0x1778e1,_0x3e1727){_0x1778e1=_0x1778e1-0x0;var _0x2bc4c6=_0x39c3[_0x1778e1];return _0x2bc4c6;};'use strict';var _=require('lodash');var util=require(_0x339c('0x0'));var logger=require(_0x339c('0x1'))(_0x339c('0x2'));var moment=require(_0x339c('0x3'));var BPromise=require(_0x339c('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x339c('0x5'));var rimraf=require(_0x339c('0x6'));var config=require(_0x339c('0x7'));var attributes=require(_0x339c('0x8'));module[_0x339c('0x9')]=function(_0x332c69,_0x510835){return _0x332c69[_0x339c('0xa')](_0x339c('0xb'),attributes,{'tableName':_0x339c('0xc'),'paranoid':![],'indexes':[{'name':_0x339c('0xd'),'fields':[_0x339c('0xe'),_0x339c('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x58fc=['path','rimraf','../../config/environment','./intVtigerField.attributes','define','VtigerField','int_vtiger_fields','vtiger_unique_index','idField','FieldId','lodash','api','moment','request-promise'];(function(_0x413036,_0x5774f2){var _0x22c01b=function(_0x1d8016){while(--_0x1d8016){_0x413036['push'](_0x413036['shift']());}};_0x22c01b(++_0x5774f2);}(_0x58fc,0x15a));var _0xc58f=function(_0x330cdf,_0x18f3e4){_0x330cdf=_0x330cdf-0x0;var _0xf77c48=_0x58fc[_0x330cdf];return _0xf77c48;};'use strict';var _=require(_0xc58f('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xc58f('0x1'));var moment=require(_0xc58f('0x2'));var BPromise=require('bluebird');var rp=require(_0xc58f('0x3'));var fs=require('fs');var path=require(_0xc58f('0x4'));var rimraf=require(_0xc58f('0x5'));var config=require(_0xc58f('0x6'));var attributes=require(_0xc58f('0x7'));module['exports']=function(_0x1a55fb,_0x241106){return _0x1a55fb[_0xc58f('0x8')](_0xc58f('0x9'),attributes,{'tableName':_0xc58f('0xa'),'paranoid':![],'indexes':[{'name':_0xc58f('0xb'),'fields':[_0xc58f('0xc'),_0xc58f('0xd')],'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 1971426..217402d 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 _0x3ce4=['../../config/environment','jayson/promise','http','then','info','VtigerField,\x20%s,\x20%s','request\x20sent','debug','VtigerField,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x14ca26,_0xf6f7c2){var _0x2061e9=function(_0x4883bc){while(--_0x4883bc){_0x14ca26['push'](_0x14ca26['shift']());}};_0x2061e9(++_0xf6f7c2);}(_0x3ce4,0xcb));var _0x43ce=function(_0x4e7d25,_0x58285f){_0x4e7d25=_0x4e7d25-0x0;var _0x526fe6=_0x3ce4[_0x4e7d25];return _0x526fe6;};'use strict';var _=require(_0x43ce('0x0'));var util=require('util');var moment=require(_0x43ce('0x1'));var BPromise=require('bluebird');var rs=require(_0x43ce('0x2'));var fs=require('fs');var Redis=require(_0x43ce('0x3'));var db=require(_0x43ce('0x4'))['db'];var utils=require(_0x43ce('0x5'));var logger=require(_0x43ce('0x6'))('rpc');var config=require(_0x43ce('0x7'));var jayson=require(_0x43ce('0x8'));var client=jayson['client'][_0x43ce('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x51e29b,_0x1f93c9,_0x2fd0e2){return new BPromise(function(_0x189654,_0x20c136){return client['request'](_0x51e29b,_0x2fd0e2)[_0x43ce('0xa')](function(_0x13dbc6){logger[_0x43ce('0xb')](_0x43ce('0xc'),_0x1f93c9,_0x43ce('0xd'));logger[_0x43ce('0xe')](_0x43ce('0xf'),_0x1f93c9,_0x43ce('0xd'),JSON['stringify'](_0x13dbc6));if(_0x13dbc6[_0x43ce('0x10')]){if(_0x13dbc6['error'][_0x43ce('0x11')]===0x1f4){logger[_0x43ce('0x10')](_0x43ce('0xc'),_0x1f93c9,_0x13dbc6[_0x43ce('0x10')][_0x43ce('0x12')]);return _0x20c136(_0x13dbc6[_0x43ce('0x10')][_0x43ce('0x12')]);}logger['error'](_0x43ce('0xc'),_0x1f93c9,_0x13dbc6['error'][_0x43ce('0x12')]);return _0x189654(_0x13dbc6[_0x43ce('0x10')][_0x43ce('0x12')]);}else{logger['info'](_0x43ce('0xc'),_0x1f93c9,_0x43ce('0xd'));_0x189654(_0x13dbc6[_0x43ce('0x13')][_0x43ce('0x12')]);}})[_0x43ce('0x14')](function(_0x34b84b){logger[_0x43ce('0x10')](_0x43ce('0xc'),_0x1f93c9,_0x34b84b);_0x20c136(_0x34b84b);});});} \ No newline at end of file +var _0x2db9=['code','message','info','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','VtigerField,\x20%s,\x20%s','request\x20sent','debug','stringify','error'];(function(_0x10e9e8,_0x3aa59e){var _0x13251e=function(_0x4c34ec){while(--_0x4c34ec){_0x10e9e8['push'](_0x10e9e8['shift']());}};_0x13251e(++_0x3aa59e);}(_0x2db9,0xad));var _0x92db=function(_0x48d7ee,_0x1574fc){_0x48d7ee=_0x48d7ee-0x0;var _0x20fc81=_0x2db9[_0x48d7ee];return _0x20fc81;};'use strict';var _=require(_0x92db('0x0'));var util=require(_0x92db('0x1'));var moment=require(_0x92db('0x2'));var BPromise=require('bluebird');var rs=require(_0x92db('0x3'));var fs=require('fs');var Redis=require(_0x92db('0x4'));var db=require(_0x92db('0x5'))['db'];var utils=require(_0x92db('0x6'));var logger=require(_0x92db('0x7'))(_0x92db('0x8'));var config=require(_0x92db('0x9'));var jayson=require(_0x92db('0xa'));var client=jayson[_0x92db('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x27b8f3,_0x20851b,_0xec0783){return new BPromise(function(_0x48780c,_0x9c5a4f){return client[_0x92db('0xc')](_0x27b8f3,_0xec0783)[_0x92db('0xd')](function(_0x53fec3){logger['info'](_0x92db('0xe'),_0x20851b,_0x92db('0xf'));logger[_0x92db('0x10')]('VtigerField,\x20%s,\x20%s,\x20%s',_0x20851b,'request\x20sent',JSON[_0x92db('0x11')](_0x53fec3));if(_0x53fec3[_0x92db('0x12')]){if(_0x53fec3[_0x92db('0x12')][_0x92db('0x13')]===0x1f4){logger[_0x92db('0x12')]('VtigerField,\x20%s,\x20%s',_0x20851b,_0x53fec3[_0x92db('0x12')]['message']);return _0x9c5a4f(_0x53fec3[_0x92db('0x12')][_0x92db('0x14')]);}logger['error'](_0x92db('0xe'),_0x20851b,_0x53fec3[_0x92db('0x12')]['message']);return _0x48780c(_0x53fec3[_0x92db('0x12')][_0x92db('0x14')]);}else{logger[_0x92db('0x15')](_0x92db('0xe'),_0x20851b,_0x92db('0xf'));_0x48780c(_0x53fec3[_0x92db('0x16')][_0x92db('0x14')]);}})[_0x92db('0x17')](function(_0x393e23){logger['error'](_0x92db('0xe'),_0x20851b,_0x393e23);_0x9c5a4f(_0x393e23);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index 743ce7f..68b3475 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 _0x39e7=['../../components/interaction/service','../../config/environment','./intZendeskAccount.controller','get','/:id','isAuthenticated','getConfigurations','getFields','create','post','addConfiguration','put','multer','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x2108de,_0x4f503f){var _0x2e0ef9=function(_0x5480c7){while(--_0x5480c7){_0x2108de['push'](_0x2108de['shift']());}};_0x2e0ef9(++_0x4f503f);}(_0x39e7,0x1d4));var _0x739e=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x39e7[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x739e('0x0'));var util=require(_0x739e('0x1'));var path=require(_0x739e('0x2'));var timeout=require(_0x739e('0x3'));var express=require(_0x739e('0x4'));var router=express[_0x739e('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x739e('0x6'));var interaction=require(_0x739e('0x7'));var config=require(_0x739e('0x8'));var controller=require(_0x739e('0x9'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x739e('0xa')](_0x739e('0xb'),auth[_0x739e('0xc')](),controller['show']);router['get']('/:id/configurations',auth[_0x739e('0xc')](),controller[_0x739e('0xd')]);router[_0x739e('0xa')]('/:id/fields',auth[_0x739e('0xc')](),controller[_0x739e('0xe')]);router['post']('/',auth[_0x739e('0xc')](),controller[_0x739e('0xf')]);router[_0x739e('0x10')]('/:id/configurations',auth[_0x739e('0xc')](),controller[_0x739e('0x11')]);router[_0x739e('0x12')](_0x739e('0xb'),auth[_0x739e('0xc')](),controller['update']);router['delete'](_0x739e('0xb'),auth[_0x739e('0xc')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xe6c0=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskAccount.controller','get','isAuthenticated','index','/:id/configurations','post','addConfiguration','put','/:id','delete','destroy','exports','util','path','connect-timeout','Router'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xe6c0,0x88));var _0x0e6c=function(_0x580576,_0x2f107d){_0x580576=_0x580576-0x0;var _0x3f55a0=_0xe6c0[_0x580576];return _0x3f55a0;};'use strict';var multer=require('multer');var util=require(_0x0e6c('0x0'));var path=require(_0x0e6c('0x1'));var timeout=require(_0x0e6c('0x2'));var express=require('express');var router=express[_0x0e6c('0x3')]();var fs_extra=require(_0x0e6c('0x4'));var auth=require(_0x0e6c('0x5'));var interaction=require(_0x0e6c('0x6'));var config=require(_0x0e6c('0x7'));var controller=require(_0x0e6c('0x8'));router[_0x0e6c('0x9')]('/',auth[_0x0e6c('0xa')](),controller[_0x0e6c('0xb')]);router[_0x0e6c('0x9')]('/:id',auth[_0x0e6c('0xa')](),controller['show']);router[_0x0e6c('0x9')](_0x0e6c('0xc'),auth[_0x0e6c('0xa')](),controller['getConfigurations']);router[_0x0e6c('0x9')]('/:id/fields',auth['isAuthenticated'](),controller['getFields']);router[_0x0e6c('0xd')]('/',auth[_0x0e6c('0xa')](),controller['create']);router['post'](_0x0e6c('0xc'),auth[_0x0e6c('0xa')](),controller[_0x0e6c('0xe')]);router[_0x0e6c('0xf')](_0x0e6c('0x10'),auth[_0x0e6c('0xa')](),controller['update']);router[_0x0e6c('0x11')](_0x0e6c('0x10'),auth['isAuthenticated'](),controller[_0x0e6c('0x12')]);module[_0x0e6c('0x13')]=router; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.attributes.js b/server/api/intZendeskAccount/intZendeskAccount.attributes.js index 1f80bb1..0b99d09 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 _0x326f=['integrationTab','newTab','sequelize','STRING','username','remoteUri','ENUM','password','token'];(function(_0x5bfb1b,_0x3e1167){var _0x4e8b51=function(_0x53941b){while(--_0x53941b){_0x5bfb1b['push'](_0x5bfb1b['shift']());}};_0x4e8b51(++_0x3e1167);}(_0x326f,0xd1));var _0xf326=function(_0x11e02a,_0x33ff7d){_0x11e02a=_0x11e02a-0x0;var _0x586512=_0x326f[_0x11e02a];return _0x586512;};'use strict';var Sequelize=require(_0xf326('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xf326('0x1')]},'username':{'type':Sequelize[_0xf326('0x1')],'unique':_0xf326('0x2')},'password':{'type':Sequelize[_0xf326('0x1')]},'token':{'type':Sequelize[_0xf326('0x1')]},'remoteUri':{'type':Sequelize[_0xf326('0x1')],'unique':_0xf326('0x3')},'authType':{'type':Sequelize[_0xf326('0x4')](_0xf326('0x5'),_0xf326('0x6')),'defaultValue':'password'},'serverUrl':{'type':Sequelize[_0xf326('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0xf326('0x4')](_0xf326('0x7'),_0xf326('0x8')),'defaultValue':'integrationTab'}}; \ No newline at end of file +var _0x68fd=['token','integrationTab','newTab','sequelize','STRING','username','remoteUri','ENUM','password'];(function(_0x144add,_0x5352a0){var _0x4e9376=function(_0x5c2b3d){while(--_0x5c2b3d){_0x144add['push'](_0x144add['shift']());}};_0x4e9376(++_0x5352a0);}(_0x68fd,0x1e9));var _0xd68f=function(_0x43a54b,_0x2d2560){_0x43a54b=_0x43a54b-0x0;var _0x6d5dcf=_0x68fd[_0x43a54b];return _0x6d5dcf;};'use strict';var Sequelize=require(_0xd68f('0x0'));module['exports']={'name':{'type':Sequelize[_0xd68f('0x1')]},'description':{'type':Sequelize[_0xd68f('0x1')]},'username':{'type':Sequelize['STRING'],'unique':_0xd68f('0x2')},'password':{'type':Sequelize[_0xd68f('0x1')]},'token':{'type':Sequelize[_0xd68f('0x1')]},'remoteUri':{'type':Sequelize[_0xd68f('0x1')],'unique':_0xd68f('0x3')},'authType':{'type':Sequelize[_0xd68f('0x4')](_0xd68f('0x5'),_0xd68f('0x6')),'defaultValue':_0xd68f('0x5')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xd68f('0x4')](_0xd68f('0x7'),_0xd68f('0x8')),'defaultValue':_0xd68f('0x7')}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index c33e62e..a185879 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 _0x6cb4=['getFields','username','password','token','authType','slice','substring','lastIndexOf','ticket_fields','headers','format','Basic\x20%s','%s:%s','toString','%s/token:%s','Sequelize','ValidationError','Unknown\x20authentication\x20type','description','assignee','includes','position','system_field_options','custom_field_options','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','limit','count','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','map','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','filter','where','merge','VIRTUAL','options','ZendeskAccount','include','findAll','catch','params','keys','find','create','body','getConfigurations','findOne','ZendeskConfiguration','rawAttributes','pick','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','ZendeskField'];(function(_0x2821cc,_0x3e5758){var _0x4e2412=function(_0x966800){while(--_0x966800){_0x2821cc['push'](_0x2821cc['shift']());}};_0x4e2412(++_0x3e5758);}(_0x6cb4,0xff));var _0x46cb=function(_0x46ee4e,_0x56aef6){_0x46ee4e=_0x46ee4e-0x0;var _0x56e736=_0x6cb4[_0x46ee4e];return _0x56e736;};'use strict';var emlformat=require(_0x46cb('0x0'));var rimraf=require(_0x46cb('0x1'));var zipdir=require(_0x46cb('0x2'));var jsonpatch=require(_0x46cb('0x3'));var rp=require(_0x46cb('0x4'));var moment=require(_0x46cb('0x5'));var BPromise=require(_0x46cb('0x6'));var Mustache=require(_0x46cb('0x7'));var util=require(_0x46cb('0x8'));var path=require('path');var sox=require(_0x46cb('0x9'));var csv=require('to-csv');var ejs=require(_0x46cb('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x46cb('0xb'));var squel=require(_0x46cb('0xc'));var crypto=require(_0x46cb('0xd'));var jsforce=require(_0x46cb('0xe'));var deskjs=require(_0x46cb('0xf'));var toCsv=require(_0x46cb('0x10'));var querystring=require('querystring');var Papa=require(_0x46cb('0x11'));var Redis=require(_0x46cb('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x46cb('0x13'));var as=require(_0x46cb('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x46cb('0x15'))(_0x46cb('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x46cb('0x17'))['db'];var integrations=require(_0x46cb('0x18'));function respondWithStatusCode(_0x1058a8,_0xf22158){_0xf22158=_0xf22158||0xcc;return function(_0x553440){if(_0x553440){return _0x1058a8[_0x46cb('0x19')](_0xf22158);}return _0x1058a8[_0x46cb('0x1a')](_0xf22158)[_0x46cb('0x1b')]();};}function respondWithResult(_0x3c0071,_0x1f7150){_0x1f7150=_0x1f7150||0xc8;return function(_0x32201f){if(_0x32201f){return _0x3c0071[_0x46cb('0x1a')](_0x1f7150)[_0x46cb('0x1c')](_0x32201f);}};}function respondWithFilteredResult(_0x37d368,_0x41e398){return function(_0x136215){if(_0x136215){var _0x5cdb4b=typeof _0x41e398[_0x46cb('0x1d')]==='undefined'&&typeof _0x41e398[_0x46cb('0x1e')]==='undefined';var _0x4e3d29=_0x136215['count'];var _0x1b6646=_0x5cdb4b?0x0:_0x41e398[_0x46cb('0x1d')];var _0x4df1f0=_0x5cdb4b?_0x136215[_0x46cb('0x1f')]:_0x41e398[_0x46cb('0x1d')]+_0x41e398[_0x46cb('0x1e')];var _0x264497;if(_0x4df1f0>=_0x4e3d29){_0x4df1f0=_0x4e3d29;_0x264497=0xc8;}else{_0x264497=0xce;}_0x37d368[_0x46cb('0x1a')](_0x264497);return _0x37d368[_0x46cb('0x20')](_0x46cb('0x21'),_0x1b6646+'-'+_0x4df1f0+'/'+_0x4e3d29)[_0x46cb('0x1c')](_0x136215);}return null;};}function patchUpdates(_0x46e541){return function(_0x21e72a){try{jsonpatch[_0x46cb('0x22')](_0x21e72a,_0x46e541,!![]);}catch(_0x188c28){return BPromise[_0x46cb('0x23')](_0x188c28);}return _0x21e72a[_0x46cb('0x24')]();};}function saveUpdates(_0x1fb467,_0x41ecd2){return function(_0xfbf576){if(_0xfbf576){return _0xfbf576[_0x46cb('0x25')](_0x1fb467)[_0x46cb('0x26')](function(_0x309e4b){return _0x309e4b;});}return null;};}function removeEntity(_0xadcad6,_0x40e0e5){return function(_0x5a1338){if(_0x5a1338){return _0x5a1338['destroy']()[_0x46cb('0x26')](function(){_0xadcad6[_0x46cb('0x1a')](0xcc)[_0x46cb('0x1b')]();});}};}function handleEntityNotFound(_0xe078a8,_0x6e6d9){return function(_0x589152){if(!_0x589152){_0xe078a8[_0x46cb('0x19')](0x194);}return _0x589152;};}function handleError(_0x578ffd,_0x495886){_0x495886=_0x495886||0x1f4;return function(_0x544465){logger[_0x46cb('0x27')](_0x544465[_0x46cb('0x28')]);if(_0x544465[_0x46cb('0x29')]){delete _0x544465[_0x46cb('0x29')];}_0x578ffd[_0x46cb('0x1a')](_0x495886)[_0x46cb('0x2a')](_0x544465);};}exports[_0x46cb('0x2b')]=function(_0x8c65b2,_0x2b846a){var _0x12e01e={},_0x4620ef={},_0x4a1517={'count':0x0,'rows':[]};var _0x1ce88f=_[_0x46cb('0x2c')](db['ZendeskAccount']['rawAttributes'],function(_0x15f5cf){return{'name':_0x15f5cf['fieldName'],'type':_0x15f5cf[_0x46cb('0x2d')][_0x46cb('0x2e')]};});_0x4620ef[_0x46cb('0x2f')]=_[_0x46cb('0x2c')](_0x1ce88f,_0x46cb('0x29'));_0x4620ef[_0x46cb('0x30')]=_['keys'](_0x8c65b2[_0x46cb('0x30')]);_0x4620ef['filters']=_[_0x46cb('0x31')](_0x4620ef[_0x46cb('0x2f')],_0x4620ef['query']);_0x12e01e[_0x46cb('0x32')]=_[_0x46cb('0x31')](_0x4620ef[_0x46cb('0x2f')],qs[_0x46cb('0x33')](_0x8c65b2[_0x46cb('0x30')]['fields']));_0x12e01e[_0x46cb('0x32')]=_0x12e01e['attributes'][_0x46cb('0x34')]?_0x12e01e[_0x46cb('0x32')]:_0x4620ef[_0x46cb('0x2f')];if(!_0x8c65b2['query'][_0x46cb('0x35')](_0x46cb('0x36'))){_0x12e01e['limit']=qs[_0x46cb('0x1e')](_0x8c65b2[_0x46cb('0x30')][_0x46cb('0x1e')]);_0x12e01e[_0x46cb('0x1d')]=qs[_0x46cb('0x1d')](_0x8c65b2[_0x46cb('0x30')][_0x46cb('0x1d')]);}_0x12e01e[_0x46cb('0x37')]=qs[_0x46cb('0x38')](_0x8c65b2[_0x46cb('0x30')][_0x46cb('0x38')]);_0x12e01e['where']=qs['filters'](_['pick'](_0x8c65b2[_0x46cb('0x30')],_0x4620ef[_0x46cb('0x39')]),_0x1ce88f);if(_0x8c65b2[_0x46cb('0x30')][_0x46cb('0x3a')]){_0x12e01e[_0x46cb('0x3b')]=_[_0x46cb('0x3c')](_0x12e01e['where'],{'$or':_[_0x46cb('0x2c')](_0x1ce88f,function(_0x4ae944){if(_0x4ae944['type']!==_0x46cb('0x3d')){var _0x59bdb0={};_0x59bdb0[_0x4ae944['name']]={'$like':'%'+_0x8c65b2[_0x46cb('0x30')]['filter']+'%'};return _0x59bdb0;}})});}_0x12e01e=_['merge']({},_0x12e01e,_0x8c65b2[_0x46cb('0x3e')]);var _0x10017d={'where':_0x12e01e[_0x46cb('0x3b')]};return db[_0x46cb('0x3f')][_0x46cb('0x1f')](_0x10017d)[_0x46cb('0x26')](function(_0x21f9a6){_0x4a1517['count']=_0x21f9a6;if(_0x8c65b2[_0x46cb('0x30')]['includeAll']){_0x12e01e[_0x46cb('0x40')]=[{'all':!![]}];}return db['ZendeskAccount'][_0x46cb('0x41')](_0x12e01e);})[_0x46cb('0x26')](function(_0x2445a2){_0x4a1517['rows']=_0x2445a2;return _0x4a1517;})[_0x46cb('0x26')](respondWithFilteredResult(_0x2b846a,_0x12e01e))[_0x46cb('0x42')](handleError(_0x2b846a,null));};exports['show']=function(_0x18be96,_0x3d0b83){var _0x1f67af={'raw':![],'where':{'id':_0x18be96[_0x46cb('0x43')]['id']}},_0x66e602={};_0x66e602['model']=_['keys'](db[_0x46cb('0x3f')]['rawAttributes']);_0x66e602[_0x46cb('0x30')]=_[_0x46cb('0x44')](_0x18be96['query']);_0x66e602[_0x46cb('0x39')]=_[_0x46cb('0x31')](_0x66e602[_0x46cb('0x2f')],_0x66e602['query']);_0x1f67af['attributes']=_['intersection'](_0x66e602['model'],qs[_0x46cb('0x33')](_0x18be96[_0x46cb('0x30')][_0x46cb('0x33')]));_0x1f67af[_0x46cb('0x32')]=_0x1f67af[_0x46cb('0x32')]['length']?_0x1f67af['attributes']:_0x66e602[_0x46cb('0x2f')];if(_0x18be96[_0x46cb('0x30')]['includeAll']){_0x1f67af[_0x46cb('0x40')]=[{'all':!![]}];}_0x1f67af=_[_0x46cb('0x3c')]({},_0x1f67af,_0x18be96[_0x46cb('0x3e')]);return db[_0x46cb('0x3f')][_0x46cb('0x45')](_0x1f67af)[_0x46cb('0x26')](handleEntityNotFound(_0x3d0b83,null))[_0x46cb('0x26')](respondWithResult(_0x3d0b83,null))['catch'](handleError(_0x3d0b83,null));};exports['create']=function(_0x449593,_0x52ed52){return db[_0x46cb('0x3f')][_0x46cb('0x46')](_0x449593[_0x46cb('0x47')],{})['then'](respondWithResult(_0x52ed52,0xc9))[_0x46cb('0x42')](handleError(_0x52ed52,null));};exports['update']=function(_0x5c02c9,_0x16c500){if(_0x5c02c9[_0x46cb('0x47')]['id']){delete _0x5c02c9[_0x46cb('0x47')]['id'];}return db[_0x46cb('0x3f')][_0x46cb('0x45')]({'where':{'id':_0x5c02c9[_0x46cb('0x43')]['id']}})[_0x46cb('0x26')](handleEntityNotFound(_0x16c500,null))['then'](saveUpdates(_0x5c02c9['body'],null))[_0x46cb('0x26')](respondWithResult(_0x16c500,null))[_0x46cb('0x42')](handleError(_0x16c500,null));};exports['destroy']=function(_0x34399d,_0x33ab2e){return db[_0x46cb('0x3f')][_0x46cb('0x45')]({'where':{'id':_0x34399d[_0x46cb('0x43')]['id']}})['then'](handleEntityNotFound(_0x33ab2e,null))[_0x46cb('0x26')](removeEntity(_0x33ab2e,null))[_0x46cb('0x42')](handleError(_0x33ab2e,null));};exports[_0x46cb('0x48')]=function(_0x52d1a7,_0x1f5c71,_0x56ad38){var _0x48b994={};var _0x1e46cc={};var _0x2cfe6f;var _0x2fe0b1;return db[_0x46cb('0x3f')][_0x46cb('0x49')]({'where':{'id':_0x52d1a7['params']['id']}})[_0x46cb('0x26')](handleEntityNotFound(_0x1f5c71,null))[_0x46cb('0x26')](function(_0x5701c0){if(_0x5701c0){_0x2cfe6f=_0x5701c0;_0x1e46cc['model']=_[_0x46cb('0x44')](db[_0x46cb('0x4a')][_0x46cb('0x4b')]);_0x1e46cc['query']=_[_0x46cb('0x44')](_0x52d1a7[_0x46cb('0x30')]);_0x1e46cc[_0x46cb('0x39')]=_[_0x46cb('0x31')](_0x1e46cc[_0x46cb('0x2f')],_0x1e46cc[_0x46cb('0x30')]);_0x48b994[_0x46cb('0x32')]=_[_0x46cb('0x31')](_0x1e46cc[_0x46cb('0x2f')],qs['fields'](_0x52d1a7[_0x46cb('0x30')]['fields']));_0x48b994[_0x46cb('0x32')]=_0x48b994[_0x46cb('0x32')][_0x46cb('0x34')]?_0x48b994[_0x46cb('0x32')]:_0x1e46cc['model'];_0x48b994[_0x46cb('0x37')]=qs[_0x46cb('0x38')](_0x52d1a7[_0x46cb('0x30')][_0x46cb('0x38')]);_0x48b994[_0x46cb('0x3b')]=qs[_0x46cb('0x39')](_[_0x46cb('0x4c')](_0x52d1a7[_0x46cb('0x30')],_0x1e46cc['filters']));if(_0x52d1a7['query']['filter']){_0x48b994['where']=_[_0x46cb('0x3c')](_0x48b994[_0x46cb('0x3b')],{'$or':_['map'](_0x48b994[_0x46cb('0x32')],function(_0xfa28a8){var _0x10c3f9={};_0x10c3f9[_0xfa28a8]={'$like':'%'+_0x52d1a7['query']['filter']+'%'};return _0x10c3f9;})});}_0x48b994=_[_0x46cb('0x3c')]({},_0x48b994,_0x52d1a7['options']);return _0x2cfe6f[_0x46cb('0x48')](_0x48b994);}})[_0x46cb('0x26')](function(_0x1eb392){if(_0x1eb392){_0x2fe0b1=_0x1eb392[_0x46cb('0x34')];if(!_0x52d1a7[_0x46cb('0x30')][_0x46cb('0x35')](_0x46cb('0x36'))){_0x48b994[_0x46cb('0x1e')]=qs[_0x46cb('0x1e')](_0x52d1a7[_0x46cb('0x30')][_0x46cb('0x1e')]);_0x48b994[_0x46cb('0x1d')]=qs[_0x46cb('0x1d')](_0x52d1a7['query'][_0x46cb('0x1d')]);}return _0x2cfe6f['getConfigurations'](_0x48b994);}})[_0x46cb('0x26')](function(_0x478ada){if(_0x478ada){return _0x478ada?{'count':_0x2fe0b1,'rows':_0x478ada}:null;}})[_0x46cb('0x26')](respondWithResult(_0x1f5c71,null))[_0x46cb('0x42')](handleError(_0x1f5c71,null));};exports[_0x46cb('0x4d')]=function(_0x3dc4bd,_0x656601,_0x598a41){if(_0x3dc4bd[_0x46cb('0x47')]['id']){delete _0x3dc4bd[_0x46cb('0x47')]['id'];}return db[_0x46cb('0x3f')][_0x46cb('0x49')]({'where':{'id':_0x3dc4bd['params']['id']}})[_0x46cb('0x26')](handleEntityNotFound(_0x656601,null))[_0x46cb('0x26')](function(_0x6dc790){if(_0x6dc790){_0x3dc4bd[_0x46cb('0x47')][_0x46cb('0x4e')]=_0x6dc790['id'];_0x3dc4bd['body'][_0x46cb('0x4f')]=integrations[_0x46cb('0x50')](_0x3dc4bd[_0x46cb('0x47')][_0x46cb('0x51')],_0x3dc4bd[_0x46cb('0x47')][_0x46cb('0x2d')]);_0x3dc4bd[_0x46cb('0x47')][_0x46cb('0x52')]=integrations['getDescriptions'](_0x3dc4bd['body']['channel'],_0x3dc4bd[_0x46cb('0x47')][_0x46cb('0x2d')]);return db[_0x46cb('0x4a')][_0x46cb('0x46')](_0x3dc4bd[_0x46cb('0x47')],{'include':[{'model':db[_0x46cb('0x53')],'as':_0x46cb('0x4f')},{'model':db[_0x46cb('0x53')],'as':_0x46cb('0x52')}]});}return null;})[_0x46cb('0x26')](respondWithResult(_0x656601,null))[_0x46cb('0x42')](handleError(_0x656601,null));};exports[_0x46cb('0x54')]=function(_0x140c96,_0x2ea5d0,_0x5c9f3c){var _0x2e23e4='';return db['ZendeskAccount'][_0x46cb('0x49')]({'where':{'id':_0x140c96['params']['id']},'attributes':['id',_0x46cb('0x55'),_0x46cb('0x56'),_0x46cb('0x57'),_0x46cb('0x58'),'remoteUri']})[_0x46cb('0x26')](handleEntityNotFound(_0x2ea5d0,null))[_0x46cb('0x26')](function(_0x55895a){if(_0x55895a){_0x2e23e4=_0x55895a['remoteUri'];var _0x473758=_0x2e23e4[_0x46cb('0x59')](-0x1);if(_0x473758==='/'){_0x2e23e4=_0x2e23e4[_0x46cb('0x5a')](0x0,_0x2e23e4[_0x46cb('0x5b')](_0x473758));}var _0x1ba6ae={'method':'GET','uri':util['format']('%s/%s',_0x2e23e4,_0x46cb('0x5c')),'json':!![]};switch(_0x55895a[_0x46cb('0x58')]){case _0x46cb('0x56'):_0x1ba6ae[_0x46cb('0x5d')]={'Authorization':util[_0x46cb('0x5e')](_0x46cb('0x5f'),new Buffer(util[_0x46cb('0x5e')](_0x46cb('0x60'),_0x55895a[_0x46cb('0x55')],_0x55895a[_0x46cb('0x56')]))[_0x46cb('0x61')]('base64'))};break;case _0x46cb('0x57'):_0x1ba6ae[_0x46cb('0x5d')]={'Authorization':util[_0x46cb('0x5e')](_0x46cb('0x5f'),new Buffer(util['format'](_0x46cb('0x62'),_0x55895a[_0x46cb('0x55')],_0x55895a[_0x46cb('0x57')]))[_0x46cb('0x61')]('base64'))};break;default:throw new db[(_0x46cb('0x63'))][(_0x46cb('0x64'))](_0x46cb('0x65'));}return rp(_0x1ba6ae);}})[_0x46cb('0x26')](function(_0x5eaad6){if(_0x5eaad6){var _0x5775dc=['subject',_0x46cb('0x66'),'group',_0x46cb('0x67')];_['remove'](_0x5eaad6[_0x46cb('0x5c')],function(_0x36a82b){return _0x5775dc[_0x46cb('0x68')](_0x36a82b[_0x46cb('0x2d')]);});return{'count':_0x5eaad6['ticket_fields'][_0x46cb('0x34')],'rows':_[_0x46cb('0x2c')](_0x5eaad6[_0x46cb('0x5c')],function(_0x468d1f){return{'id':_0x468d1f['id'],'name':_0x468d1f['position']>0x7?_0x468d1f['title']:_0x468d1f[_0x46cb('0x2d')],'custom':_0x468d1f[_0x46cb('0x69')]>0x7?!![]:![],'options':_0x468d1f[_0x46cb('0x6a')]?_0x468d1f[_0x46cb('0x6a')]:_0x468d1f[_0x46cb('0x6b')]?_0x468d1f[_0x46cb('0x6b')]:[]};})};}})['then'](respondWithResult(_0x2ea5d0,null))['catch'](function(_0x3089d7){var _0x53eb=_0x140c96['query'][_0x46cb('0x6c')]?0x1f4:_0x3089d7[_0x46cb('0x6d')]||0x1f4;logger[_0x46cb('0x27')](_0x46cb('0x6e'),_0x46cb('0x54'),_0x53eb,JSON[_0x46cb('0x6f')](_0x3089d7));delete _0x3089d7[_0x46cb('0x29')];if(_0x53eb===0x191){_0x53eb=0x190;}_0x2ea5d0['status'](_0x53eb)[_0x46cb('0x2a')](_0x140c96[_0x46cb('0x30')][_0x46cb('0x6c')]?{'message':_0x46cb('0x70'),'statusCode':_0x3089d7[_0x46cb('0x6d')]}:_0x3089d7);});}; \ No newline at end of file +var _0x04b8=['lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','status','undefined','limit','count','offset','set','Content-Range','json','apply','reject','save','update','then','destroy','end','stack','name','send','map','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','filter','where','merge','VIRTUAL','options','includeAll','ZendeskAccount','findAll','rows','catch','keys','include','find','create','body','params','getConfigurations','findOne','ZendeskConfiguration','pick','addConfiguration','AccountId','Subjects','getSubjects','channel','getDescriptions','ZendeskField','Descriptions','getFields','username','password','token','remoteUri','slice','lastIndexOf','GET','format','%s/%s','ticket_fields','authType','headers','Basic\x20%s','%s:%s','toString','base64','ValidationError','Unknown\x20authentication\x20type','subject','description','group','assignee','remove','includes','position','custom_field_options','test','error','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','rimraf','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','fs-extra'];(function(_0x18c575,_0x38d6ce){var _0xea22b2=function(_0x30a41d){while(--_0x30a41d){_0x18c575['push'](_0x18c575['shift']());}};_0xea22b2(++_0x38d6ce);}(_0x04b8,0x159));var _0x804b=function(_0x2e7cb8,_0x282d99){_0x2e7cb8=_0x2e7cb8-0x0;var _0x89bfc6=_0x04b8[_0x2e7cb8];return _0x89bfc6;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x804b('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x804b('0x1'));var rp=require(_0x804b('0x2'));var moment=require('moment');var BPromise=require(_0x804b('0x3'));var Mustache=require(_0x804b('0x4'));var util=require('util');var path=require(_0x804b('0x5'));var sox=require(_0x804b('0x6'));var csv=require(_0x804b('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x804b('0x8'));var _=require(_0x804b('0x9'));var squel=require(_0x804b('0xa'));var crypto=require('crypto');var jsforce=require(_0x804b('0xb'));var deskjs=require(_0x804b('0xc'));var toCsv=require('to-csv');var querystring=require(_0x804b('0xd'));var Papa=require(_0x804b('0xe'));var Redis=require(_0x804b('0xf'));var authService=require(_0x804b('0x10'));var qs=require(_0x804b('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x804b('0x12'));var logger=require(_0x804b('0x13'))(_0x804b('0x14'));var utils=require(_0x804b('0x15'));var config=require(_0x804b('0x16'));var licenseUtil=require(_0x804b('0x17'));var db=require('../../mysqldb')['db'];var integrations=require(_0x804b('0x18'));function respondWithStatusCode(_0x5303cc,_0x23ee57){_0x23ee57=_0x23ee57||0xcc;return function(_0x3a2702){if(_0x3a2702){return _0x5303cc[_0x804b('0x19')](_0x23ee57);}return _0x5303cc[_0x804b('0x1a')](_0x23ee57)['end']();};}function respondWithResult(_0x215825,_0x1b01a7){_0x1b01a7=_0x1b01a7||0xc8;return function(_0x274bb8){if(_0x274bb8){return _0x215825[_0x804b('0x1a')](_0x1b01a7)['json'](_0x274bb8);}};}function respondWithFilteredResult(_0x2fd593,_0x8ccbe0){return function(_0x5e1cfe){if(_0x5e1cfe){var _0x3c5986=typeof _0x8ccbe0['offset']===_0x804b('0x1b')&&typeof _0x8ccbe0[_0x804b('0x1c')]===_0x804b('0x1b');var _0x1760f8=_0x5e1cfe[_0x804b('0x1d')];var _0x5a0a82=_0x3c5986?0x0:_0x8ccbe0[_0x804b('0x1e')];var _0x50b4fe=_0x3c5986?_0x5e1cfe[_0x804b('0x1d')]:_0x8ccbe0[_0x804b('0x1e')]+_0x8ccbe0[_0x804b('0x1c')];var _0x469251;if(_0x50b4fe>=_0x1760f8){_0x50b4fe=_0x1760f8;_0x469251=0xc8;}else{_0x469251=0xce;}_0x2fd593['status'](_0x469251);return _0x2fd593[_0x804b('0x1f')](_0x804b('0x20'),_0x5a0a82+'-'+_0x50b4fe+'/'+_0x1760f8)[_0x804b('0x21')](_0x5e1cfe);}return null;};}function patchUpdates(_0x11eaf6){return function(_0x27844b){try{jsonpatch[_0x804b('0x22')](_0x27844b,_0x11eaf6,!![]);}catch(_0x3241a0){return BPromise[_0x804b('0x23')](_0x3241a0);}return _0x27844b[_0x804b('0x24')]();};}function saveUpdates(_0x2b7271,_0x1acc48){return function(_0x5a968b){if(_0x5a968b){return _0x5a968b[_0x804b('0x25')](_0x2b7271)[_0x804b('0x26')](function(_0x5585f8){return _0x5585f8;});}return null;};}function removeEntity(_0x44a921,_0x367024){return function(_0x115b8f){if(_0x115b8f){return _0x115b8f[_0x804b('0x27')]()[_0x804b('0x26')](function(){_0x44a921['status'](0xcc)[_0x804b('0x28')]();});}};}function handleEntityNotFound(_0x7d9c33,_0x4e7266){return function(_0x12b6a6){if(!_0x12b6a6){_0x7d9c33[_0x804b('0x19')](0x194);}return _0x12b6a6;};}function handleError(_0x1117a5,_0x27d5ec){_0x27d5ec=_0x27d5ec||0x1f4;return function(_0x2d88da){logger['error'](_0x2d88da[_0x804b('0x29')]);if(_0x2d88da[_0x804b('0x2a')]){delete _0x2d88da[_0x804b('0x2a')];}_0x1117a5[_0x804b('0x1a')](_0x27d5ec)[_0x804b('0x2b')](_0x2d88da);};}exports['index']=function(_0x3eb531,_0x2931ff){var _0x410871={},_0x5c7026={},_0x3dbd41={'count':0x0,'rows':[]};var _0x407357=_[_0x804b('0x2c')](db['ZendeskAccount'][_0x804b('0x2d')],function(_0x471c04){return{'name':_0x471c04['fieldName'],'type':_0x471c04[_0x804b('0x2e')][_0x804b('0x2f')]};});_0x5c7026[_0x804b('0x30')]=_[_0x804b('0x2c')](_0x407357,_0x804b('0x2a'));_0x5c7026[_0x804b('0x31')]=_['keys'](_0x3eb531[_0x804b('0x31')]);_0x5c7026[_0x804b('0x32')]=_[_0x804b('0x33')](_0x5c7026[_0x804b('0x30')],_0x5c7026[_0x804b('0x31')]);_0x410871[_0x804b('0x34')]=_[_0x804b('0x33')](_0x5c7026[_0x804b('0x30')],qs[_0x804b('0x35')](_0x3eb531[_0x804b('0x31')][_0x804b('0x35')]));_0x410871[_0x804b('0x34')]=_0x410871[_0x804b('0x34')][_0x804b('0x36')]?_0x410871[_0x804b('0x34')]:_0x5c7026[_0x804b('0x30')];if(!_0x3eb531[_0x804b('0x31')][_0x804b('0x37')](_0x804b('0x38'))){_0x410871[_0x804b('0x1c')]=qs[_0x804b('0x1c')](_0x3eb531[_0x804b('0x31')][_0x804b('0x1c')]);_0x410871[_0x804b('0x1e')]=qs[_0x804b('0x1e')](_0x3eb531['query']['offset']);}_0x410871['order']=qs[_0x804b('0x39')](_0x3eb531[_0x804b('0x31')][_0x804b('0x39')]);_0x410871['where']=qs['filters'](_['pick'](_0x3eb531[_0x804b('0x31')],_0x5c7026[_0x804b('0x32')]),_0x407357);if(_0x3eb531[_0x804b('0x31')][_0x804b('0x3a')]){_0x410871[_0x804b('0x3b')]=_[_0x804b('0x3c')](_0x410871[_0x804b('0x3b')],{'$or':_[_0x804b('0x2c')](_0x407357,function(_0x27ba88){if(_0x27ba88[_0x804b('0x2e')]!==_0x804b('0x3d')){var _0x22a3fa={};_0x22a3fa[_0x27ba88[_0x804b('0x2a')]]={'$like':'%'+_0x3eb531['query'][_0x804b('0x3a')]+'%'};return _0x22a3fa;}})});}_0x410871=_[_0x804b('0x3c')]({},_0x410871,_0x3eb531[_0x804b('0x3e')]);var _0x3d6d8a={'where':_0x410871[_0x804b('0x3b')]};return db['ZendeskAccount']['count'](_0x3d6d8a)[_0x804b('0x26')](function(_0x2afafd){_0x3dbd41[_0x804b('0x1d')]=_0x2afafd;if(_0x3eb531['query'][_0x804b('0x3f')]){_0x410871['include']=[{'all':!![]}];}return db[_0x804b('0x40')][_0x804b('0x41')](_0x410871);})[_0x804b('0x26')](function(_0x304710){_0x3dbd41[_0x804b('0x42')]=_0x304710;return _0x3dbd41;})[_0x804b('0x26')](respondWithFilteredResult(_0x2931ff,_0x410871))[_0x804b('0x43')](handleError(_0x2931ff,null));};exports['show']=function(_0x17972a,_0x1c0363){var _0x1dcec8={'raw':![],'where':{'id':_0x17972a['params']['id']}},_0x1d25f6={};_0x1d25f6[_0x804b('0x30')]=_[_0x804b('0x44')](db[_0x804b('0x40')][_0x804b('0x2d')]);_0x1d25f6[_0x804b('0x31')]=_[_0x804b('0x44')](_0x17972a[_0x804b('0x31')]);_0x1d25f6[_0x804b('0x32')]=_['intersection'](_0x1d25f6[_0x804b('0x30')],_0x1d25f6['query']);_0x1dcec8['attributes']=_['intersection'](_0x1d25f6[_0x804b('0x30')],qs['fields'](_0x17972a[_0x804b('0x31')][_0x804b('0x35')]));_0x1dcec8[_0x804b('0x34')]=_0x1dcec8[_0x804b('0x34')]['length']?_0x1dcec8[_0x804b('0x34')]:_0x1d25f6[_0x804b('0x30')];if(_0x17972a[_0x804b('0x31')]['includeAll']){_0x1dcec8[_0x804b('0x45')]=[{'all':!![]}];}_0x1dcec8=_[_0x804b('0x3c')]({},_0x1dcec8,_0x17972a[_0x804b('0x3e')]);return db['ZendeskAccount'][_0x804b('0x46')](_0x1dcec8)[_0x804b('0x26')](handleEntityNotFound(_0x1c0363,null))[_0x804b('0x26')](respondWithResult(_0x1c0363,null))[_0x804b('0x43')](handleError(_0x1c0363,null));};exports[_0x804b('0x47')]=function(_0x3a39f5,_0x392bc0){return db[_0x804b('0x40')][_0x804b('0x47')](_0x3a39f5[_0x804b('0x48')],{})[_0x804b('0x26')](respondWithResult(_0x392bc0,0xc9))[_0x804b('0x43')](handleError(_0x392bc0,null));};exports[_0x804b('0x25')]=function(_0x2c1796,_0x578e92){if(_0x2c1796['body']['id']){delete _0x2c1796[_0x804b('0x48')]['id'];}return db[_0x804b('0x40')][_0x804b('0x46')]({'where':{'id':_0x2c1796[_0x804b('0x49')]['id']}})[_0x804b('0x26')](handleEntityNotFound(_0x578e92,null))['then'](saveUpdates(_0x2c1796[_0x804b('0x48')],null))[_0x804b('0x26')](respondWithResult(_0x578e92,null))[_0x804b('0x43')](handleError(_0x578e92,null));};exports[_0x804b('0x27')]=function(_0x47247c,_0x111e3f){return db['ZendeskAccount']['find']({'where':{'id':_0x47247c[_0x804b('0x49')]['id']}})[_0x804b('0x26')](handleEntityNotFound(_0x111e3f,null))['then'](removeEntity(_0x111e3f,null))['catch'](handleError(_0x111e3f,null));};exports[_0x804b('0x4a')]=function(_0x3d56bb,_0x4a5068,_0x4efe2a){var _0x164c5d={};var _0x38c2c0={};var _0x54cc99;var _0x2756de;return db['ZendeskAccount'][_0x804b('0x4b')]({'where':{'id':_0x3d56bb['params']['id']}})[_0x804b('0x26')](handleEntityNotFound(_0x4a5068,null))[_0x804b('0x26')](function(_0x47c835){if(_0x47c835){_0x54cc99=_0x47c835;_0x38c2c0[_0x804b('0x30')]=_['keys'](db[_0x804b('0x4c')][_0x804b('0x2d')]);_0x38c2c0[_0x804b('0x31')]=_[_0x804b('0x44')](_0x3d56bb[_0x804b('0x31')]);_0x38c2c0[_0x804b('0x32')]=_[_0x804b('0x33')](_0x38c2c0[_0x804b('0x30')],_0x38c2c0[_0x804b('0x31')]);_0x164c5d[_0x804b('0x34')]=_['intersection'](_0x38c2c0['model'],qs[_0x804b('0x35')](_0x3d56bb['query']['fields']));_0x164c5d[_0x804b('0x34')]=_0x164c5d[_0x804b('0x34')][_0x804b('0x36')]?_0x164c5d[_0x804b('0x34')]:_0x38c2c0['model'];_0x164c5d['order']=qs[_0x804b('0x39')](_0x3d56bb[_0x804b('0x31')][_0x804b('0x39')]);_0x164c5d[_0x804b('0x3b')]=qs[_0x804b('0x32')](_[_0x804b('0x4d')](_0x3d56bb[_0x804b('0x31')],_0x38c2c0[_0x804b('0x32')]));if(_0x3d56bb[_0x804b('0x31')][_0x804b('0x3a')]){_0x164c5d[_0x804b('0x3b')]=_[_0x804b('0x3c')](_0x164c5d[_0x804b('0x3b')],{'$or':_[_0x804b('0x2c')](_0x164c5d[_0x804b('0x34')],function(_0x3d98a2){var _0x524291={};_0x524291[_0x3d98a2]={'$like':'%'+_0x3d56bb[_0x804b('0x31')][_0x804b('0x3a')]+'%'};return _0x524291;})});}_0x164c5d=_['merge']({},_0x164c5d,_0x3d56bb[_0x804b('0x3e')]);return _0x54cc99[_0x804b('0x4a')](_0x164c5d);}})[_0x804b('0x26')](function(_0x2576a4){if(_0x2576a4){_0x2756de=_0x2576a4['length'];if(!_0x3d56bb[_0x804b('0x31')][_0x804b('0x37')]('nolimit')){_0x164c5d[_0x804b('0x1c')]=qs[_0x804b('0x1c')](_0x3d56bb[_0x804b('0x31')]['limit']);_0x164c5d[_0x804b('0x1e')]=qs[_0x804b('0x1e')](_0x3d56bb[_0x804b('0x31')][_0x804b('0x1e')]);}return _0x54cc99[_0x804b('0x4a')](_0x164c5d);}})['then'](function(_0xb08c4e){if(_0xb08c4e){return _0xb08c4e?{'count':_0x2756de,'rows':_0xb08c4e}:null;}})[_0x804b('0x26')](respondWithResult(_0x4a5068,null))[_0x804b('0x43')](handleError(_0x4a5068,null));};exports[_0x804b('0x4e')]=function(_0x5dcc63,_0x4f8a81,_0x183796){if(_0x5dcc63['body']['id']){delete _0x5dcc63[_0x804b('0x48')]['id'];}return db[_0x804b('0x40')][_0x804b('0x4b')]({'where':{'id':_0x5dcc63[_0x804b('0x49')]['id']}})[_0x804b('0x26')](handleEntityNotFound(_0x4f8a81,null))['then'](function(_0x27f06c){if(_0x27f06c){_0x5dcc63[_0x804b('0x48')][_0x804b('0x4f')]=_0x27f06c['id'];_0x5dcc63['body'][_0x804b('0x50')]=integrations[_0x804b('0x51')](_0x5dcc63['body'][_0x804b('0x52')],_0x5dcc63['body'][_0x804b('0x2e')]);_0x5dcc63[_0x804b('0x48')]['Descriptions']=integrations[_0x804b('0x53')](_0x5dcc63[_0x804b('0x48')][_0x804b('0x52')],_0x5dcc63['body'][_0x804b('0x2e')]);return db['ZendeskConfiguration'][_0x804b('0x47')](_0x5dcc63[_0x804b('0x48')],{'include':[{'model':db[_0x804b('0x54')],'as':_0x804b('0x50')},{'model':db['ZendeskField'],'as':_0x804b('0x55')}]});}return null;})[_0x804b('0x26')](respondWithResult(_0x4f8a81,null))[_0x804b('0x43')](handleError(_0x4f8a81,null));};exports[_0x804b('0x56')]=function(_0x17e21c,_0x1bb4ec,_0x5b3b79){var _0x39ed3c='';return db[_0x804b('0x40')]['findOne']({'where':{'id':_0x17e21c[_0x804b('0x49')]['id']},'attributes':['id',_0x804b('0x57'),_0x804b('0x58'),_0x804b('0x59'),'authType',_0x804b('0x5a')]})[_0x804b('0x26')](handleEntityNotFound(_0x1bb4ec,null))['then'](function(_0x2541cd){if(_0x2541cd){_0x39ed3c=_0x2541cd[_0x804b('0x5a')];var _0x549504=_0x39ed3c[_0x804b('0x5b')](-0x1);if(_0x549504==='/'){_0x39ed3c=_0x39ed3c['substring'](0x0,_0x39ed3c[_0x804b('0x5c')](_0x549504));}var _0x3e2813={'method':_0x804b('0x5d'),'uri':util[_0x804b('0x5e')](_0x804b('0x5f'),_0x39ed3c,_0x804b('0x60')),'json':!![]};switch(_0x2541cd[_0x804b('0x61')]){case'password':_0x3e2813[_0x804b('0x62')]={'Authorization':util['format'](_0x804b('0x63'),new Buffer(util[_0x804b('0x5e')](_0x804b('0x64'),_0x2541cd[_0x804b('0x57')],_0x2541cd[_0x804b('0x58')]))[_0x804b('0x65')](_0x804b('0x66')))};break;case _0x804b('0x59'):_0x3e2813[_0x804b('0x62')]={'Authorization':util[_0x804b('0x5e')](_0x804b('0x63'),new Buffer(util['format']('%s/token:%s',_0x2541cd[_0x804b('0x57')],_0x2541cd[_0x804b('0x59')]))[_0x804b('0x65')](_0x804b('0x66')))};break;default:throw new db['Sequelize'][(_0x804b('0x67'))](_0x804b('0x68'));}return rp(_0x3e2813);}})[_0x804b('0x26')](function(_0x3dda89){if(_0x3dda89){var _0x260419=[_0x804b('0x69'),_0x804b('0x6a'),_0x804b('0x6b'),_0x804b('0x6c')];_[_0x804b('0x6d')](_0x3dda89['ticket_fields'],function(_0x5a6661){return _0x260419[_0x804b('0x6e')](_0x5a6661[_0x804b('0x2e')]);});return{'count':_0x3dda89['ticket_fields'][_0x804b('0x36')],'rows':_[_0x804b('0x2c')](_0x3dda89['ticket_fields'],function(_0x345bf7){return{'id':_0x345bf7['id'],'name':_0x345bf7['position']>0x7?_0x345bf7['title']:_0x345bf7[_0x804b('0x2e')],'custom':_0x345bf7[_0x804b('0x6f')]>0x7?!![]:![],'options':_0x345bf7['system_field_options']?_0x345bf7['system_field_options']:_0x345bf7[_0x804b('0x70')]?_0x345bf7[_0x804b('0x70')]:[]};})};}})['then'](respondWithResult(_0x1bb4ec,null))[_0x804b('0x43')](function(_0x5e2756){var _0x42dfc3=_0x17e21c[_0x804b('0x31')][_0x804b('0x71')]?0x1f4:_0x5e2756['statusCode']||0x1f4;logger[_0x804b('0x72')](_0x804b('0x73'),_0x804b('0x56'),_0x42dfc3,JSON[_0x804b('0x74')](_0x5e2756));delete _0x5e2756[_0x804b('0x2a')];if(_0x42dfc3===0x191){_0x42dfc3=0x190;}_0x1bb4ec[_0x804b('0x1a')](_0x42dfc3)[_0x804b('0x2b')](_0x17e21c[_0x804b('0x31')][_0x804b('0x71')]?{'message':_0x804b('0x75'),'statusCode':_0x5e2756['statusCode']}:_0x5e2756);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index 49632fe..0a4f282 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 _0x917a=['path','rimraf','../../config/environment','./intZendeskAccount.attributes','../../components/integrations/configuration','ZendeskAccount','int_zendesk_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x588e8a,_0x4502f1){var _0x5976e9=function(_0x49cbf8){while(--_0x49cbf8){_0x588e8a['push'](_0x588e8a['shift']());}};_0x5976e9(++_0x4502f1);}(_0x917a,0x69));var _0xa917=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x917a[_0x4a9fb1];return _0x348672;};'use strict';var _=require(_0xa917('0x0'));var util=require(_0xa917('0x1'));var logger=require(_0xa917('0x2'))(_0xa917('0x3'));var moment=require(_0xa917('0x4'));var BPromise=require(_0xa917('0x5'));var rp=require(_0xa917('0x6'));var fs=require('fs');var path=require(_0xa917('0x7'));var rimraf=require(_0xa917('0x8'));var config=require(_0xa917('0x9'));var attributes=require(_0xa917('0xa'));var integrations=require(_0xa917('0xb'));module['exports']=function(_0x4247fe,_0x55d6ba){return _0x4247fe['define'](_0xa917('0xc'),attributes,{'tableName':_0xa917('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xafd8=['rimraf','./intZendeskAccount.attributes','define','ZendeskAccount','int_zendesk_accounts','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x61516f,_0x2b211d){var _0xd68d1c=function(_0x423116){while(--_0x423116){_0x61516f['push'](_0x61516f['shift']());}};_0xd68d1c(++_0x2b211d);}(_0xafd8,0x1b2));var _0x8afd=function(_0xf64e53,_0x4db24b){_0xf64e53=_0xf64e53-0x0;var _0x1e185e=_0xafd8[_0xf64e53];return _0x1e185e;};'use strict';var _=require(_0x8afd('0x0'));var util=require(_0x8afd('0x1'));var logger=require(_0x8afd('0x2'))(_0x8afd('0x3'));var moment=require('moment');var BPromise=require(_0x8afd('0x4'));var rp=require(_0x8afd('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8afd('0x6'));var config=require('../../config/environment');var attributes=require(_0x8afd('0x7'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x5cdff2,_0x587697){return _0x5cdff2[_0x8afd('0x8')](_0x8afd('0x9'),attributes,{'tableName':_0x8afd('0xa'),'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 8bc9607..3733845 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 _0x664d=['model','then','debug','ShowZendeskAccount','ZendeskAccount','find','lodash','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','ZendeskAccount,\x20%s,\x20%s','ZendeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','GetZendeskAccount','findAll','options','raw','where','attributes','limit','include','map'];(function(_0x2d4421,_0x15a84f){var _0x2d3b01=function(_0xb9e94c){while(--_0xb9e94c){_0x2d4421['push'](_0x2d4421['shift']());}};_0x2d3b01(++_0x15a84f);}(_0x664d,0x1c2));var _0xd664=function(_0x387603,_0x5a2d1){_0x387603=_0x387603-0x0;var _0x55ea9e=_0x664d[_0x387603];return _0x55ea9e;};'use strict';var _=require(_0xd664('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xd664('0x1'));var rs=require(_0xd664('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd664('0x3'))['db'];var utils=require(_0xd664('0x4'));var logger=require(_0xd664('0x5'))(_0xd664('0x6'));var config=require(_0xd664('0x7'));var jayson=require(_0xd664('0x8'));var client=jayson[_0xd664('0x9')][_0xd664('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x49905f,_0x3ea009,_0x278423){return new BPromise(function(_0x1920b6,_0x537649){return client[_0xd664('0xb')](_0x49905f,_0x278423)['then'](function(_0x2d39d8){logger['info'](_0xd664('0xc'),_0x3ea009,'request\x20sent');logger['debug'](_0xd664('0xd'),_0x3ea009,_0xd664('0xe'),JSON[_0xd664('0xf')](_0x2d39d8));if(_0x2d39d8[_0xd664('0x10')]){if(_0x2d39d8['error'][_0xd664('0x11')]===0x1f4){logger[_0xd664('0x10')](_0xd664('0xc'),_0x3ea009,_0x2d39d8[_0xd664('0x10')][_0xd664('0x12')]);return _0x537649(_0x2d39d8['error'][_0xd664('0x12')]);}logger[_0xd664('0x10')]('ZendeskAccount,\x20%s,\x20%s',_0x3ea009,_0x2d39d8[_0xd664('0x10')]['message']);return _0x1920b6(_0x2d39d8[_0xd664('0x10')][_0xd664('0x12')]);}else{logger[_0xd664('0x13')](_0xd664('0xc'),_0x3ea009,_0xd664('0xe'));_0x1920b6(_0x2d39d8[_0xd664('0x14')][_0xd664('0x12')]);}})[_0xd664('0x15')](function(_0x3899e7){logger[_0xd664('0x10')]('ZendeskAccount,\x20%s,\x20%s',_0x3ea009,_0x3899e7);_0x537649(_0x3899e7);});});}exports[_0xd664('0x16')]=function(_0x48f73a){var _0x1213f9=this;return new Promise(function(_0x4acbb8,_0x460f65){return db['ZendeskAccount'][_0xd664('0x17')]({'raw':_0x48f73a['options']?_0x48f73a[_0xd664('0x18')][_0xd664('0x19')]===undefined?!![]:![]:!![],'where':_0x48f73a[_0xd664('0x18')]?_0x48f73a[_0xd664('0x18')][_0xd664('0x1a')]||null:null,'attributes':_0x48f73a[_0xd664('0x18')]?_0x48f73a['options'][_0xd664('0x1b')]||null:null,'limit':_0x48f73a['options']?_0x48f73a['options'][_0xd664('0x1c')]||null:null,'include':_0x48f73a[_0xd664('0x18')]?_0x48f73a[_0xd664('0x18')][_0xd664('0x1d')]?_[_0xd664('0x1e')](_0x48f73a[_0xd664('0x18')][_0xd664('0x1d')],function(_0x195aec){return{'model':db[_0x195aec[_0xd664('0x1f')]],'as':_0x195aec['as'],'attributes':_0x195aec[_0xd664('0x1b')],'include':_0x195aec[_0xd664('0x1d')]?_[_0xd664('0x1e')](_0x195aec[_0xd664('0x1d')],function(_0x3acae4){return{'model':db[_0x3acae4[_0xd664('0x1f')]],'as':_0x3acae4['as'],'attributes':_0x3acae4[_0xd664('0x1b')],'include':_0x3acae4[_0xd664('0x1d')]?_[_0xd664('0x1e')](_0x3acae4[_0xd664('0x1d')],function(_0x381ef2){return{'model':db[_0x381ef2[_0xd664('0x1f')]],'as':_0x381ef2['as'],'attributes':_0x381ef2['attributes']};}):[]};}):[]};}):[]:[]})[_0xd664('0x20')](function(_0x7e4811){logger[_0xd664('0x13')](_0xd664('0x16'),_0x48f73a);logger[_0xd664('0x21')](_0xd664('0x16'),_0x48f73a,JSON[_0xd664('0xf')](_0x7e4811));_0x4acbb8(_0x7e4811);})[_0xd664('0x15')](function(_0x53df4a){logger[_0xd664('0x10')](_0xd664('0x16'),_0x53df4a[_0xd664('0x12')],_0x48f73a);_0x460f65(_0x1213f9[_0xd664('0x10')](0x1f4,_0x53df4a[_0xd664('0x12')]));});});};exports[_0xd664('0x22')]=function(_0x4139e9){var _0x12e9be=this;return new Promise(function(_0x342fd8,_0x65d407){return db[_0xd664('0x23')][_0xd664('0x24')]({'raw':_0x4139e9[_0xd664('0x18')]?_0x4139e9[_0xd664('0x18')][_0xd664('0x19')]===undefined?!![]:![]:!![],'where':_0x4139e9['options']?_0x4139e9[_0xd664('0x18')]['where']||null:null,'attributes':_0x4139e9[_0xd664('0x18')]?_0x4139e9[_0xd664('0x18')]['attributes']||null:null,'include':_0x4139e9[_0xd664('0x18')]?_0x4139e9[_0xd664('0x18')][_0xd664('0x1d')]?_[_0xd664('0x1e')](_0x4139e9[_0xd664('0x18')][_0xd664('0x1d')],function(_0x1ec85b){return{'model':db[_0x1ec85b['model']],'as':_0x1ec85b['as'],'attributes':_0x1ec85b['attributes'],'include':_0x1ec85b[_0xd664('0x1d')]?_[_0xd664('0x1e')](_0x1ec85b['include'],function(_0x3be00e){return{'model':db[_0x3be00e[_0xd664('0x1f')]],'as':_0x3be00e['as'],'attributes':_0x3be00e[_0xd664('0x1b')],'include':_0x3be00e[_0xd664('0x1d')]?_['map'](_0x3be00e[_0xd664('0x1d')],function(_0x327d46){return{'model':db[_0x327d46[_0xd664('0x1f')]],'as':_0x327d46['as'],'attributes':_0x327d46['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x3d1e45){logger['info'](_0xd664('0x22'),_0x4139e9);logger[_0xd664('0x21')](_0xd664('0x22'),_0x4139e9,JSON['stringify'](_0x3d1e45));_0x342fd8(_0x3d1e45);})[_0xd664('0x15')](function(_0x13f5fd){logger[_0xd664('0x10')](_0xd664('0x22'),_0x13f5fd['message'],_0x4139e9);_0x65d407(_0x12e9be[_0xd664('0x10')](0x1f4,_0x13f5fd['message']));});});}; \ No newline at end of file +var _0x8535=['catch','ShowZendeskAccount','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','GetZendeskAccount','ZendeskAccount','options','raw','where','attributes','limit','map','model','include','then'];(function(_0x33bab1,_0xe53802){var _0x54b72e=function(_0xf4d7c8){while(--_0xf4d7c8){_0x33bab1['push'](_0x33bab1['shift']());}};_0x54b72e(++_0xe53802);}(_0x8535,0x97));var _0x5853=function(_0x19db3f,_0x39243c){_0x19db3f=_0x19db3f-0x0;var _0x362a10=_0x8535[_0x19db3f];return _0x362a10;};'use strict';var _=require(_0x5853('0x0'));var util=require(_0x5853('0x1'));var moment=require(_0x5853('0x2'));var BPromise=require(_0x5853('0x3'));var rs=require(_0x5853('0x4'));var fs=require('fs');var Redis=require(_0x5853('0x5'));var db=require(_0x5853('0x6'))['db'];var utils=require(_0x5853('0x7'));var logger=require(_0x5853('0x8'))(_0x5853('0x9'));var config=require(_0x5853('0xa'));var jayson=require(_0x5853('0xb'));var client=jayson[_0x5853('0xc')][_0x5853('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x6fdd6b,_0x201250,_0x230c1c){return new BPromise(function(_0xfbad44,_0xcf3fa3){return client['request'](_0x6fdd6b,_0x230c1c)['then'](function(_0x159b7e){logger['info'](_0x5853('0xe'),_0x201250,_0x5853('0xf'));logger[_0x5853('0x10')]('ZendeskAccount,\x20%s,\x20%s,\x20%s',_0x201250,_0x5853('0xf'),JSON[_0x5853('0x11')](_0x159b7e));if(_0x159b7e[_0x5853('0x12')]){if(_0x159b7e[_0x5853('0x12')][_0x5853('0x13')]===0x1f4){logger['error'](_0x5853('0xe'),_0x201250,_0x159b7e[_0x5853('0x12')]['message']);return _0xcf3fa3(_0x159b7e[_0x5853('0x12')][_0x5853('0x14')]);}logger[_0x5853('0x12')](_0x5853('0xe'),_0x201250,_0x159b7e['error'][_0x5853('0x14')]);return _0xfbad44(_0x159b7e['error']['message']);}else{logger[_0x5853('0x15')](_0x5853('0xe'),_0x201250,_0x5853('0xf'));_0xfbad44(_0x159b7e[_0x5853('0x16')][_0x5853('0x14')]);}})['catch'](function(_0x5cca10){logger[_0x5853('0x12')](_0x5853('0xe'),_0x201250,_0x5cca10);_0xcf3fa3(_0x5cca10);});});}exports[_0x5853('0x17')]=function(_0x3d0229){var _0x1e487b=this;return new Promise(function(_0xffbdce,_0x2b7d96){return db[_0x5853('0x18')]['findAll']({'raw':_0x3d0229[_0x5853('0x19')]?_0x3d0229['options'][_0x5853('0x1a')]===undefined?!![]:![]:!![],'where':_0x3d0229[_0x5853('0x19')]?_0x3d0229[_0x5853('0x19')][_0x5853('0x1b')]||null:null,'attributes':_0x3d0229[_0x5853('0x19')]?_0x3d0229[_0x5853('0x19')][_0x5853('0x1c')]||null:null,'limit':_0x3d0229[_0x5853('0x19')]?_0x3d0229[_0x5853('0x19')][_0x5853('0x1d')]||null:null,'include':_0x3d0229[_0x5853('0x19')]?_0x3d0229[_0x5853('0x19')]['include']?_[_0x5853('0x1e')](_0x3d0229[_0x5853('0x19')]['include'],function(_0x2dd518){return{'model':db[_0x2dd518[_0x5853('0x1f')]],'as':_0x2dd518['as'],'attributes':_0x2dd518['attributes'],'include':_0x2dd518[_0x5853('0x20')]?_['map'](_0x2dd518['include'],function(_0x12894a){return{'model':db[_0x12894a['model']],'as':_0x12894a['as'],'attributes':_0x12894a[_0x5853('0x1c')],'include':_0x12894a[_0x5853('0x20')]?_[_0x5853('0x1e')](_0x12894a['include'],function(_0x55a566){return{'model':db[_0x55a566[_0x5853('0x1f')]],'as':_0x55a566['as'],'attributes':_0x55a566[_0x5853('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x5853('0x21')](function(_0x1cfe23){logger[_0x5853('0x15')](_0x5853('0x17'),_0x3d0229);logger['debug'](_0x5853('0x17'),_0x3d0229,JSON[_0x5853('0x11')](_0x1cfe23));_0xffbdce(_0x1cfe23);})[_0x5853('0x22')](function(_0x445166){logger[_0x5853('0x12')]('GetZendeskAccount',_0x445166[_0x5853('0x14')],_0x3d0229);_0x2b7d96(_0x1e487b[_0x5853('0x12')](0x1f4,_0x445166[_0x5853('0x14')]));});});};exports[_0x5853('0x23')]=function(_0x359a66){var _0x25e965=this;return new Promise(function(_0x24ec10,_0x1ad1e7){return db[_0x5853('0x18')][_0x5853('0x24')]({'raw':_0x359a66['options']?_0x359a66[_0x5853('0x19')][_0x5853('0x1a')]===undefined?!![]:![]:!![],'where':_0x359a66['options']?_0x359a66[_0x5853('0x19')][_0x5853('0x1b')]||null:null,'attributes':_0x359a66['options']?_0x359a66[_0x5853('0x19')][_0x5853('0x1c')]||null:null,'include':_0x359a66[_0x5853('0x19')]?_0x359a66[_0x5853('0x19')][_0x5853('0x20')]?_[_0x5853('0x1e')](_0x359a66[_0x5853('0x19')][_0x5853('0x20')],function(_0x607b84){return{'model':db[_0x607b84['model']],'as':_0x607b84['as'],'attributes':_0x607b84['attributes'],'include':_0x607b84[_0x5853('0x20')]?_['map'](_0x607b84[_0x5853('0x20')],function(_0x1511eb){return{'model':db[_0x1511eb[_0x5853('0x1f')]],'as':_0x1511eb['as'],'attributes':_0x1511eb[_0x5853('0x1c')],'include':_0x1511eb[_0x5853('0x20')]?_[_0x5853('0x1e')](_0x1511eb[_0x5853('0x20')],function(_0x4b7dcd){return{'model':db[_0x4b7dcd[_0x5853('0x1f')]],'as':_0x4b7dcd['as'],'attributes':_0x4b7dcd['attributes']};}):[]};}):[]};}):[]:[]})[_0x5853('0x21')](function(_0x41f82e){logger[_0x5853('0x15')]('ShowZendeskAccount',_0x359a66);logger[_0x5853('0x10')]('ShowZendeskAccount',_0x359a66,JSON[_0x5853('0x11')](_0x41f82e));_0x24ec10(_0x41f82e);})[_0x5853('0x22')](function(_0x48f3f9){logger[_0x5853('0x12')](_0x5853('0x23'),_0x48f3f9[_0x5853('0x14')],_0x359a66);_0x1ad1e7(_0x25e965[_0x5853('0x12')](0x1f4,_0x48f3f9[_0x5853('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index ba8404a..a4a9bc2 100644 --- a/server/api/intZendeskConfiguration/index.js +++ b/server/api/intZendeskConfiguration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbaf0=['isAuthenticated','index','/:id','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','getTags','post','create','/:id/tags','setTags','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','get'];(function(_0x21b7c5,_0x3fb56c){var _0x19a38b=function(_0x29920f){while(--_0x29920f){_0x21b7c5['push'](_0x21b7c5['shift']());}};_0x19a38b(++_0x3fb56c);}(_0xbaf0,0x12a));var _0x0baf=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xbaf0[_0x501510];return _0x1e6ee5;};'use strict';var multer=require('multer');var util=require(_0x0baf('0x0'));var path=require(_0x0baf('0x1'));var timeout=require(_0x0baf('0x2'));var express=require(_0x0baf('0x3'));var router=express[_0x0baf('0x4')]();var fs_extra=require(_0x0baf('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var controller=require(_0x0baf('0x8'));router[_0x0baf('0x9')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0xb')]);router[_0x0baf('0x9')](_0x0baf('0xc'),auth[_0x0baf('0xa')](),controller['show']);router[_0x0baf('0x9')]('/:id/fields',auth[_0x0baf('0xa')](),controller[_0x0baf('0xd')]);router[_0x0baf('0x9')](_0x0baf('0xe'),auth[_0x0baf('0xa')](),controller[_0x0baf('0xf')]);router[_0x0baf('0x9')](_0x0baf('0x10'),auth[_0x0baf('0xa')](),controller[_0x0baf('0x11')]);router[_0x0baf('0x9')]('/:id/tags',auth['isAuthenticated'](),controller[_0x0baf('0x12')]);router[_0x0baf('0x13')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0x14')]);router['post'](_0x0baf('0x15'),auth['isAuthenticated'](),controller[_0x0baf('0x16')]);router[_0x0baf('0x17')](_0x0baf('0xc'),auth[_0x0baf('0xa')](),controller[_0x0baf('0x18')]);router[_0x0baf('0x19')]('/:id',auth['isAuthenticated'](),controller[_0x0baf('0x1a')]);module[_0x0baf('0x1b')]=router; \ No newline at end of file +var _0x757a=['index','isAuthenticated','show','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','post','setTags','put','/:id','update','delete','destroy','exports','util','path','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','get'];(function(_0x59a63b,_0xa1c45b){var _0x571d9e=function(_0x26ca5e){while(--_0x26ca5e){_0x59a63b['push'](_0x59a63b['shift']());}};_0x571d9e(++_0xa1c45b);}(_0x757a,0xde));var _0xa757=function(_0x249d3f,_0x47d868){_0x249d3f=_0x249d3f-0x0;var _0x5c6035=_0x757a[_0x249d3f];return _0x5c6035;};'use strict';var multer=require('multer');var util=require(_0xa757('0x0'));var path=require(_0xa757('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xa757('0x2'));var auth=require(_0xa757('0x3'));var interaction=require(_0xa757('0x4'));var config=require(_0xa757('0x5'));var controller=require(_0xa757('0x6'));router[_0xa757('0x7')]('/',auth['isAuthenticated'](),controller[_0xa757('0x8')]);router[_0xa757('0x7')]('/:id',auth[_0xa757('0x9')](),controller[_0xa757('0xa')]);router[_0xa757('0x7')](_0xa757('0xb'),auth[_0xa757('0x9')](),controller['getFields']);router[_0xa757('0x7')](_0xa757('0xc'),auth[_0xa757('0x9')](),controller[_0xa757('0xd')]);router[_0xa757('0x7')](_0xa757('0xe'),auth[_0xa757('0x9')](),controller['getDescriptions']);router['get']('/:id/tags',auth['isAuthenticated'](),controller['getTags']);router[_0xa757('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0xa757('0xf')]('/:id/tags',auth['isAuthenticated'](),controller[_0xa757('0x10')]);router[_0xa757('0x11')](_0xa757('0x12'),auth[_0xa757('0x9')](),controller[_0xa757('0x13')]);router[_0xa757('0x14')](_0xa757('0x12'),auth[_0xa757('0x9')](),controller[_0xa757('0x15')]);module[_0xa757('0x16')]=router; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js index 896ae4c..df2baf9 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 _0x018f=['sequelize','exports','STRING'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x018f,0x93));var _0xf018=function(_0x254d9f,_0x54ddb5){_0x254d9f=_0x254d9f-0x0;var _0x1eedb9=_0x018f[_0x254d9f];return _0x1eedb9;};'use strict';var Sequelize=require(_0xf018('0x0'));module[_0xf018('0x1')]={'name':{'type':Sequelize[_0xf018('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x8c2a=['sequelize','exports','STRING'];(function(_0x3f7b50,_0x4f96b7){var _0x51f680=function(_0xe3cab2){while(--_0xe3cab2){_0x3f7b50['push'](_0x3f7b50['shift']());}};_0x51f680(++_0x4f96b7);}(_0x8c2a,0xe1));var _0xa8c2=function(_0x133804,_0x46eafb){_0x133804=_0x133804-0x0;var _0x45b070=_0x8c2a[_0x133804];return _0x45b070;};'use strict';var Sequelize=require(_0xa8c2('0x0'));module[_0xa8c2('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xa8c2('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index 0012c22..582278f 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 _0xc306=['keys','filters','attributes','intersection','length','hasOwnProperty','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','fields','find','body','destroy','getFields','findOne','nolimit','getSubjects','ZendeskField','getTags','Tag','setTags','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','offset','limit','count','set','apply','reject','save','update','then','error','stack','name','send','index','ZendeskConfiguration','fieldName','type','key','model','map','query'];(function(_0x1b4587,_0x2add59){var _0x771ed4=function(_0x368d5e){while(--_0x368d5e){_0x1b4587['push'](_0x1b4587['shift']());}};_0x771ed4(++_0x2add59);}(_0xc306,0x74));var _0x6c30=function(_0x4bcf93,_0x455f39){_0x4bcf93=_0x4bcf93-0x0;var _0x23f44d=_0xc306[_0x4bcf93];return _0x23f44d;};'use strict';var emlformat=require(_0x6c30('0x0'));var rimraf=require(_0x6c30('0x1'));var zipdir=require(_0x6c30('0x2'));var jsonpatch=require(_0x6c30('0x3'));var rp=require(_0x6c30('0x4'));var moment=require(_0x6c30('0x5'));var BPromise=require(_0x6c30('0x6'));var Mustache=require(_0x6c30('0x7'));var util=require(_0x6c30('0x8'));var path=require(_0x6c30('0x9'));var sox=require(_0x6c30('0xa'));var csv=require(_0x6c30('0xb'));var ejs=require(_0x6c30('0xc'));var fs=require('fs');var fs_extra=require(_0x6c30('0xd'));var _=require(_0x6c30('0xe'));var squel=require(_0x6c30('0xf'));var crypto=require(_0x6c30('0x10'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x6c30('0xb'));var querystring=require('querystring');var Papa=require(_0x6c30('0x11'));var Redis=require(_0x6c30('0x12'));var authService=require(_0x6c30('0x13'));var qs=require(_0x6c30('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6c30('0x15'));var logger=require('../../config/logger')(_0x6c30('0x16'));var utils=require(_0x6c30('0x17'));var config=require(_0x6c30('0x18'));var licenseUtil=require(_0x6c30('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x321e67,_0x48a35b){_0x48a35b=_0x48a35b||0xcc;return function(_0x741f3c){if(_0x741f3c){return _0x321e67[_0x6c30('0x1a')](_0x48a35b);}return _0x321e67[_0x6c30('0x1b')](_0x48a35b)[_0x6c30('0x1c')]();};}function respondWithResult(_0x44bcc6,_0x557e16){_0x557e16=_0x557e16||0xc8;return function(_0x1ce13b){if(_0x1ce13b){return _0x44bcc6[_0x6c30('0x1b')](_0x557e16)['json'](_0x1ce13b);}};}function respondWithFilteredResult(_0x19d160,_0x3b9b4e){return function(_0x4f773e){if(_0x4f773e){var _0x3d4b24=typeof _0x3b9b4e[_0x6c30('0x1d')]==='undefined'&&typeof _0x3b9b4e[_0x6c30('0x1e')]==='undefined';var _0x2da7fa=_0x4f773e[_0x6c30('0x1f')];var _0x6f20b4=_0x3d4b24?0x0:_0x3b9b4e[_0x6c30('0x1d')];var _0x4da9ae=_0x3d4b24?_0x4f773e[_0x6c30('0x1f')]:_0x3b9b4e['offset']+_0x3b9b4e['limit'];var _0x6c102a;if(_0x4da9ae>=_0x2da7fa){_0x4da9ae=_0x2da7fa;_0x6c102a=0xc8;}else{_0x6c102a=0xce;}_0x19d160[_0x6c30('0x1b')](_0x6c102a);return _0x19d160[_0x6c30('0x20')]('Content-Range',_0x6f20b4+'-'+_0x4da9ae+'/'+_0x2da7fa)['json'](_0x4f773e);}return null;};}function patchUpdates(_0x2c888b){return function(_0x3a94ec){try{jsonpatch[_0x6c30('0x21')](_0x3a94ec,_0x2c888b,!![]);}catch(_0x471ca8){return BPromise[_0x6c30('0x22')](_0x471ca8);}return _0x3a94ec[_0x6c30('0x23')]();};}function saveUpdates(_0x5324e7,_0x1c3ee5){return function(_0x5173e1){if(_0x5173e1){return _0x5173e1[_0x6c30('0x24')](_0x5324e7)['then'](function(_0x497e45){return _0x497e45;});}return null;};}function removeEntity(_0x3cd707,_0x3e5f7d){return function(_0x472bb7){if(_0x472bb7){return _0x472bb7['destroy']()[_0x6c30('0x25')](function(){_0x3cd707[_0x6c30('0x1b')](0xcc)[_0x6c30('0x1c')]();});}};}function handleEntityNotFound(_0x2b5784,_0x105b25){return function(_0x37ec84){if(!_0x37ec84){_0x2b5784[_0x6c30('0x1a')](0x194);}return _0x37ec84;};}function handleError(_0x55ca30,_0x15104b){_0x15104b=_0x15104b||0x1f4;return function(_0x1a62a9){logger[_0x6c30('0x26')](_0x1a62a9[_0x6c30('0x27')]);if(_0x1a62a9[_0x6c30('0x28')]){delete _0x1a62a9[_0x6c30('0x28')];}_0x55ca30['status'](_0x15104b)[_0x6c30('0x29')](_0x1a62a9);};}exports[_0x6c30('0x2a')]=function(_0x18e2a4,_0x2e39aa){var _0x2bf594={},_0x393899={},_0x2392d5={'count':0x0,'rows':[]};var _0x26c9df=_['map'](db[_0x6c30('0x2b')]['rawAttributes'],function(_0x47a29c){return{'name':_0x47a29c[_0x6c30('0x2c')],'type':_0x47a29c[_0x6c30('0x2d')][_0x6c30('0x2e')]};});_0x393899[_0x6c30('0x2f')]=_[_0x6c30('0x30')](_0x26c9df,_0x6c30('0x28'));_0x393899[_0x6c30('0x31')]=_[_0x6c30('0x32')](_0x18e2a4['query']);_0x393899[_0x6c30('0x33')]=_['intersection'](_0x393899[_0x6c30('0x2f')],_0x393899['query']);_0x2bf594[_0x6c30('0x34')]=_[_0x6c30('0x35')](_0x393899[_0x6c30('0x2f')],qs['fields'](_0x18e2a4[_0x6c30('0x31')]['fields']));_0x2bf594[_0x6c30('0x34')]=_0x2bf594[_0x6c30('0x34')][_0x6c30('0x36')]?_0x2bf594[_0x6c30('0x34')]:_0x393899[_0x6c30('0x2f')];if(!_0x18e2a4[_0x6c30('0x31')][_0x6c30('0x37')]('nolimit')){_0x2bf594[_0x6c30('0x1e')]=qs[_0x6c30('0x1e')](_0x18e2a4[_0x6c30('0x31')]['limit']);_0x2bf594[_0x6c30('0x1d')]=qs[_0x6c30('0x1d')](_0x18e2a4[_0x6c30('0x31')][_0x6c30('0x1d')]);}_0x2bf594[_0x6c30('0x38')]=qs[_0x6c30('0x39')](_0x18e2a4['query'][_0x6c30('0x39')]);_0x2bf594[_0x6c30('0x3a')]=qs[_0x6c30('0x33')](_[_0x6c30('0x3b')](_0x18e2a4[_0x6c30('0x31')],_0x393899['filters']),_0x26c9df);if(_0x18e2a4[_0x6c30('0x31')][_0x6c30('0x3c')]){_0x2bf594[_0x6c30('0x3a')]=_['merge'](_0x2bf594[_0x6c30('0x3a')],{'$or':_[_0x6c30('0x30')](_0x26c9df,function(_0x505dd1){if(_0x505dd1[_0x6c30('0x2d')]!=='VIRTUAL'){var _0x2da3bd={};_0x2da3bd[_0x505dd1['name']]={'$like':'%'+_0x18e2a4[_0x6c30('0x31')][_0x6c30('0x3c')]+'%'};return _0x2da3bd;}})});}_0x2bf594=_[_0x6c30('0x3d')]({},_0x2bf594,_0x18e2a4[_0x6c30('0x3e')]);var _0x43577e={'where':_0x2bf594[_0x6c30('0x3a')]};return db[_0x6c30('0x2b')][_0x6c30('0x1f')](_0x43577e)[_0x6c30('0x25')](function(_0x285733){_0x2392d5[_0x6c30('0x1f')]=_0x285733;if(_0x18e2a4[_0x6c30('0x31')][_0x6c30('0x3f')]){_0x2bf594[_0x6c30('0x40')]=[{'all':!![]}];}return db[_0x6c30('0x2b')][_0x6c30('0x41')](_0x2bf594);})[_0x6c30('0x25')](function(_0x5d2050){_0x2392d5[_0x6c30('0x42')]=_0x5d2050;return _0x2392d5;})[_0x6c30('0x25')](respondWithFilteredResult(_0x2e39aa,_0x2bf594))[_0x6c30('0x43')](handleError(_0x2e39aa,null));};exports[_0x6c30('0x44')]=function(_0x55955a,_0x6c7ae0){var _0x143062={'raw':![],'where':{'id':_0x55955a[_0x6c30('0x45')]['id']}},_0x1ea64f={};_0x1ea64f[_0x6c30('0x2f')]=_['keys'](db['ZendeskConfiguration'][_0x6c30('0x46')]);_0x1ea64f[_0x6c30('0x31')]=_[_0x6c30('0x32')](_0x55955a['query']);_0x1ea64f[_0x6c30('0x33')]=_['intersection'](_0x1ea64f[_0x6c30('0x2f')],_0x1ea64f[_0x6c30('0x31')]);_0x143062[_0x6c30('0x34')]=_[_0x6c30('0x35')](_0x1ea64f['model'],qs[_0x6c30('0x47')](_0x55955a[_0x6c30('0x31')][_0x6c30('0x47')]));_0x143062[_0x6c30('0x34')]=_0x143062[_0x6c30('0x34')][_0x6c30('0x36')]?_0x143062[_0x6c30('0x34')]:_0x1ea64f[_0x6c30('0x2f')];if(_0x55955a[_0x6c30('0x31')][_0x6c30('0x3f')]){_0x143062[_0x6c30('0x40')]=[{'all':!![]}];}_0x143062=_[_0x6c30('0x3d')]({},_0x143062,_0x55955a['options']);return db[_0x6c30('0x2b')][_0x6c30('0x48')](_0x143062)[_0x6c30('0x25')](handleEntityNotFound(_0x6c7ae0,null))[_0x6c30('0x25')](respondWithResult(_0x6c7ae0,null))[_0x6c30('0x43')](handleError(_0x6c7ae0,null));};exports['create']=function(_0x3db2ac,_0x2a092a){return db[_0x6c30('0x2b')]['create'](_0x3db2ac[_0x6c30('0x49')],{})['then'](respondWithResult(_0x2a092a,0xc9))[_0x6c30('0x43')](handleError(_0x2a092a,null));};exports[_0x6c30('0x24')]=function(_0x981998,_0x100f1d){if(_0x981998[_0x6c30('0x49')]['id']){delete _0x981998[_0x6c30('0x49')]['id'];}return db[_0x6c30('0x2b')]['find']({'where':{'id':_0x981998[_0x6c30('0x45')]['id']}})['then'](handleEntityNotFound(_0x100f1d,null))['then'](saveUpdates(_0x981998['body'],null))[_0x6c30('0x25')](respondWithResult(_0x100f1d,null))['catch'](handleError(_0x100f1d,null));};exports[_0x6c30('0x4a')]=function(_0x489c5e,_0x132101){return db[_0x6c30('0x2b')][_0x6c30('0x48')]({'where':{'id':_0x489c5e[_0x6c30('0x45')]['id']}})[_0x6c30('0x25')](handleEntityNotFound(_0x132101,null))[_0x6c30('0x25')](removeEntity(_0x132101,null))['catch'](handleError(_0x132101,null));};exports[_0x6c30('0x4b')]=function(_0x46fefa,_0x545ded,_0xe9b0a0){var _0x51de8b={};var _0x5c6e96={};var _0x1c0c6a;var _0x13f7e3;return db[_0x6c30('0x2b')][_0x6c30('0x4c')]({'where':{'id':_0x46fefa[_0x6c30('0x45')]['id']}})[_0x6c30('0x25')](handleEntityNotFound(_0x545ded,null))[_0x6c30('0x25')](function(_0xa9a450){if(_0xa9a450){_0x1c0c6a=_0xa9a450;_0x5c6e96[_0x6c30('0x2f')]=_[_0x6c30('0x32')](db['ZendeskField'][_0x6c30('0x46')]);_0x5c6e96[_0x6c30('0x31')]=_[_0x6c30('0x32')](_0x46fefa[_0x6c30('0x31')]);_0x5c6e96[_0x6c30('0x33')]=_['intersection'](_0x5c6e96[_0x6c30('0x2f')],_0x5c6e96[_0x6c30('0x31')]);_0x51de8b[_0x6c30('0x34')]=_['intersection'](_0x5c6e96[_0x6c30('0x2f')],qs[_0x6c30('0x47')](_0x46fefa[_0x6c30('0x31')][_0x6c30('0x47')]));_0x51de8b[_0x6c30('0x34')]=_0x51de8b[_0x6c30('0x34')][_0x6c30('0x36')]?_0x51de8b[_0x6c30('0x34')]:_0x5c6e96[_0x6c30('0x2f')];_0x51de8b['order']=qs['sort'](_0x46fefa[_0x6c30('0x31')][_0x6c30('0x39')]);_0x51de8b['where']=qs[_0x6c30('0x33')](_[_0x6c30('0x3b')](_0x46fefa[_0x6c30('0x31')],_0x5c6e96['filters']));if(_0x46fefa[_0x6c30('0x31')][_0x6c30('0x3c')]){_0x51de8b['where']=_[_0x6c30('0x3d')](_0x51de8b[_0x6c30('0x3a')],{'$or':_[_0x6c30('0x30')](_0x51de8b['attributes'],function(_0x2421aa){var _0x1bc794={};_0x1bc794[_0x2421aa]={'$like':'%'+_0x46fefa['query'][_0x6c30('0x3c')]+'%'};return _0x1bc794;})});}_0x51de8b=_['merge']({},_0x51de8b,_0x46fefa[_0x6c30('0x3e')]);return _0x1c0c6a['getFields'](_0x51de8b);}})[_0x6c30('0x25')](function(_0xf2b375){if(_0xf2b375){_0x13f7e3=_0xf2b375['length'];if(!_0x46fefa['query'][_0x6c30('0x37')](_0x6c30('0x4d'))){_0x51de8b[_0x6c30('0x1e')]=qs[_0x6c30('0x1e')](_0x46fefa['query']['limit']);_0x51de8b[_0x6c30('0x1d')]=qs[_0x6c30('0x1d')](_0x46fefa[_0x6c30('0x31')][_0x6c30('0x1d')]);}return _0x1c0c6a['getFields'](_0x51de8b);}})[_0x6c30('0x25')](function(_0x1fbc0a){if(_0x1fbc0a){return _0x1fbc0a?{'count':_0x13f7e3,'rows':_0x1fbc0a}:null;}})[_0x6c30('0x25')](respondWithResult(_0x545ded,null))[_0x6c30('0x43')](handleError(_0x545ded,null));};exports[_0x6c30('0x4e')]=function(_0x510107,_0x1a0de3,_0x166a3a){var _0x3ec7e0={};var _0x509bb5={};var _0x386bbf;var _0x5cc0fa;return db['ZendeskConfiguration'][_0x6c30('0x4c')]({'where':{'id':_0x510107[_0x6c30('0x45')]['id']}})[_0x6c30('0x25')](handleEntityNotFound(_0x1a0de3,null))['then'](function(_0x58d52f){if(_0x58d52f){_0x386bbf=_0x58d52f;_0x509bb5[_0x6c30('0x2f')]=_[_0x6c30('0x32')](db[_0x6c30('0x4f')]['rawAttributes']);_0x509bb5[_0x6c30('0x31')]=_['keys'](_0x510107[_0x6c30('0x31')]);_0x509bb5[_0x6c30('0x33')]=_[_0x6c30('0x35')](_0x509bb5[_0x6c30('0x2f')],_0x509bb5[_0x6c30('0x31')]);_0x3ec7e0['attributes']=_[_0x6c30('0x35')](_0x509bb5[_0x6c30('0x2f')],qs[_0x6c30('0x47')](_0x510107[_0x6c30('0x31')][_0x6c30('0x47')]));_0x3ec7e0[_0x6c30('0x34')]=_0x3ec7e0[_0x6c30('0x34')][_0x6c30('0x36')]?_0x3ec7e0[_0x6c30('0x34')]:_0x509bb5['model'];_0x3ec7e0[_0x6c30('0x38')]=qs['sort'](_0x510107[_0x6c30('0x31')][_0x6c30('0x39')]);_0x3ec7e0[_0x6c30('0x3a')]=qs['filters'](_[_0x6c30('0x3b')](_0x510107[_0x6c30('0x31')],_0x509bb5[_0x6c30('0x33')]));if(_0x510107['query'][_0x6c30('0x3c')]){_0x3ec7e0[_0x6c30('0x3a')]=_['merge'](_0x3ec7e0[_0x6c30('0x3a')],{'$or':_[_0x6c30('0x30')](_0x3ec7e0[_0x6c30('0x34')],function(_0x17052d){var _0x8a46f1={};_0x8a46f1[_0x17052d]={'$like':'%'+_0x510107['query'][_0x6c30('0x3c')]+'%'};return _0x8a46f1;})});}_0x3ec7e0=_[_0x6c30('0x3d')]({},_0x3ec7e0,_0x510107[_0x6c30('0x3e')]);return _0x386bbf[_0x6c30('0x4e')](_0x3ec7e0);}})['then'](function(_0x3ac492){if(_0x3ac492){_0x5cc0fa=_0x3ac492[_0x6c30('0x36')];if(!_0x510107[_0x6c30('0x31')][_0x6c30('0x37')](_0x6c30('0x4d'))){_0x3ec7e0[_0x6c30('0x1e')]=qs[_0x6c30('0x1e')](_0x510107[_0x6c30('0x31')][_0x6c30('0x1e')]);_0x3ec7e0['offset']=qs['offset'](_0x510107[_0x6c30('0x31')]['offset']);}return _0x386bbf[_0x6c30('0x4e')](_0x3ec7e0);}})[_0x6c30('0x25')](function(_0x5715eb){if(_0x5715eb){return _0x5715eb?{'count':_0x5cc0fa,'rows':_0x5715eb}:null;}})[_0x6c30('0x25')](respondWithResult(_0x1a0de3,null))[_0x6c30('0x43')](handleError(_0x1a0de3,null));};exports['getDescriptions']=function(_0x24e841,_0x4c8566,_0x4d6c7c){var _0x577789={};var _0x1180be={};var _0x58b2d9;var _0x3d961b;return db['ZendeskConfiguration'][_0x6c30('0x4c')]({'where':{'id':_0x24e841[_0x6c30('0x45')]['id']}})['then'](handleEntityNotFound(_0x4c8566,null))[_0x6c30('0x25')](function(_0x141ed9){if(_0x141ed9){_0x58b2d9=_0x141ed9;_0x1180be['model']=_[_0x6c30('0x32')](db[_0x6c30('0x4f')][_0x6c30('0x46')]);_0x1180be['query']=_['keys'](_0x24e841[_0x6c30('0x31')]);_0x1180be[_0x6c30('0x33')]=_[_0x6c30('0x35')](_0x1180be['model'],_0x1180be[_0x6c30('0x31')]);_0x577789['attributes']=_[_0x6c30('0x35')](_0x1180be['model'],qs[_0x6c30('0x47')](_0x24e841[_0x6c30('0x31')]['fields']));_0x577789['attributes']=_0x577789[_0x6c30('0x34')][_0x6c30('0x36')]?_0x577789[_0x6c30('0x34')]:_0x1180be[_0x6c30('0x2f')];_0x577789[_0x6c30('0x38')]=qs[_0x6c30('0x39')](_0x24e841[_0x6c30('0x31')][_0x6c30('0x39')]);_0x577789[_0x6c30('0x3a')]=qs[_0x6c30('0x33')](_[_0x6c30('0x3b')](_0x24e841[_0x6c30('0x31')],_0x1180be['filters']));if(_0x24e841['query'][_0x6c30('0x3c')]){_0x577789[_0x6c30('0x3a')]=_['merge'](_0x577789[_0x6c30('0x3a')],{'$or':_[_0x6c30('0x30')](_0x577789[_0x6c30('0x34')],function(_0x3a5577){var _0x3928af={};_0x3928af[_0x3a5577]={'$like':'%'+_0x24e841[_0x6c30('0x31')]['filter']+'%'};return _0x3928af;})});}_0x577789=_[_0x6c30('0x3d')]({},_0x577789,_0x24e841[_0x6c30('0x3e')]);return _0x58b2d9['getDescriptions'](_0x577789);}})['then'](function(_0x51d7ce){if(_0x51d7ce){_0x3d961b=_0x51d7ce[_0x6c30('0x36')];if(!_0x24e841[_0x6c30('0x31')][_0x6c30('0x37')](_0x6c30('0x4d'))){_0x577789[_0x6c30('0x1e')]=qs[_0x6c30('0x1e')](_0x24e841[_0x6c30('0x31')][_0x6c30('0x1e')]);_0x577789['offset']=qs['offset'](_0x24e841[_0x6c30('0x31')]['offset']);}return _0x58b2d9['getDescriptions'](_0x577789);}})[_0x6c30('0x25')](function(_0x9faf39){if(_0x9faf39){return _0x9faf39?{'count':_0x3d961b,'rows':_0x9faf39}:null;}})[_0x6c30('0x25')](respondWithResult(_0x4c8566,null))[_0x6c30('0x43')](handleError(_0x4c8566,null));};exports[_0x6c30('0x50')]=function(_0x39fe61,_0x5df7f3,_0x14f002){var _0x3f0d7f={};var _0x3b598c={};var _0x33cfbd;var _0x316d7f;return db[_0x6c30('0x2b')][_0x6c30('0x4c')]({'where':{'id':_0x39fe61[_0x6c30('0x45')]['id']}})[_0x6c30('0x25')](handleEntityNotFound(_0x5df7f3,null))[_0x6c30('0x25')](function(_0x33744a){if(_0x33744a){_0x33cfbd=_0x33744a;_0x3b598c['model']=_[_0x6c30('0x32')](db[_0x6c30('0x51')][_0x6c30('0x46')]);_0x3b598c[_0x6c30('0x31')]=_['keys'](_0x39fe61['query']);_0x3b598c[_0x6c30('0x33')]=_['intersection'](_0x3b598c['model'],_0x3b598c[_0x6c30('0x31')]);_0x3f0d7f[_0x6c30('0x34')]=_[_0x6c30('0x35')](_0x3b598c['model'],qs['fields'](_0x39fe61['query']['fields']));_0x3f0d7f[_0x6c30('0x34')]=_0x3f0d7f[_0x6c30('0x34')]['length']?_0x3f0d7f[_0x6c30('0x34')]:_0x3b598c[_0x6c30('0x2f')];_0x3f0d7f['order']=qs['sort'](_0x39fe61[_0x6c30('0x31')][_0x6c30('0x39')]);_0x3f0d7f[_0x6c30('0x3a')]=qs['filters'](_[_0x6c30('0x3b')](_0x39fe61[_0x6c30('0x31')],_0x3b598c['filters']));if(_0x39fe61[_0x6c30('0x31')][_0x6c30('0x3c')]){_0x3f0d7f[_0x6c30('0x3a')]=_[_0x6c30('0x3d')](_0x3f0d7f[_0x6c30('0x3a')],{'$or':_['map'](_0x3f0d7f[_0x6c30('0x34')],function(_0x380387){var _0x1ec62f={};_0x1ec62f[_0x380387]={'$like':'%'+_0x39fe61[_0x6c30('0x31')][_0x6c30('0x3c')]+'%'};return _0x1ec62f;})});}_0x3f0d7f=_[_0x6c30('0x3d')]({},_0x3f0d7f,_0x39fe61[_0x6c30('0x3e')]);return _0x33cfbd[_0x6c30('0x50')](_0x3f0d7f);}})[_0x6c30('0x25')](function(_0x1b3c31){if(_0x1b3c31){_0x316d7f=_0x1b3c31[_0x6c30('0x36')];if(!_0x39fe61['query'][_0x6c30('0x37')]('nolimit')){_0x3f0d7f[_0x6c30('0x1e')]=qs[_0x6c30('0x1e')](_0x39fe61[_0x6c30('0x31')][_0x6c30('0x1e')]);_0x3f0d7f[_0x6c30('0x1d')]=qs[_0x6c30('0x1d')](_0x39fe61['query'][_0x6c30('0x1d')]);}return _0x33cfbd['getTags'](_0x3f0d7f);}})[_0x6c30('0x25')](function(_0x44934e){if(_0x44934e){return _0x44934e?{'count':_0x316d7f,'rows':_0x44934e}:null;}})[_0x6c30('0x25')](respondWithResult(_0x5df7f3,null))['catch'](handleError(_0x5df7f3,null));};exports['setTags']=function(_0x477e70,_0xc482d7,_0x794775){if(_0x477e70[_0x6c30('0x49')]['id']){delete _0x477e70[_0x6c30('0x49')]['id'];}return db[_0x6c30('0x2b')][_0x6c30('0x4c')]({'where':{'id':_0x477e70['params']['id']}})[_0x6c30('0x25')](handleEntityNotFound(_0xc482d7,null))[_0x6c30('0x25')](function(_0x1405ed){if(_0x1405ed){return _0x1405ed[_0x6c30('0x52')](_0x477e70[_0x6c30('0x49')]['ids']||[]);}return null;})['then'](respondWithResult(_0xc482d7,null))['catch'](handleError(_0xc482d7,null));}; \ No newline at end of file +var _0x9166=['ZendeskConfiguration','include','findAll','rows','catch','find','create','update','params','body','destroy','getFields','findOne','ZendeskField','options','hasOwnProperty','getSubjects','getDescriptions','getTags','Tag','setTags','ids','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','then','error','stack','send','index','map','rawAttributes','fieldName','type','key','model','name','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','filter','where','merge'];(function(_0x254109,_0x47ef01){var _0x54ca42=function(_0x5ee74c){while(--_0x5ee74c){_0x254109['push'](_0x254109['shift']());}};_0x54ca42(++_0x47ef01);}(_0x9166,0x15e));var _0x6916=function(_0x508685,_0x9f94af){_0x508685=_0x508685-0x0;var _0x976a76=_0x9166[_0x508685];return _0x976a76;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6916('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6916('0x1'));var rp=require(_0x6916('0x2'));var moment=require('moment');var BPromise=require(_0x6916('0x3'));var Mustache=require(_0x6916('0x4'));var util=require(_0x6916('0x5'));var path=require('path');var sox=require(_0x6916('0x6'));var csv=require(_0x6916('0x7'));var ejs=require(_0x6916('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6916('0x9'));var squel=require(_0x6916('0xa'));var crypto=require('crypto');var jsforce=require(_0x6916('0xb'));var deskjs=require(_0x6916('0xc'));var toCsv=require(_0x6916('0x7'));var querystring=require(_0x6916('0xd'));var Papa=require(_0x6916('0xe'));var Redis=require(_0x6916('0xf'));var authService=require(_0x6916('0x10'));var qs=require(_0x6916('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6916('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0x6916('0x13'));var config=require(_0x6916('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x6916('0x15'))['db'];function respondWithStatusCode(_0x1fd7d6,_0x3c4907){_0x3c4907=_0x3c4907||0xcc;return function(_0x418281){if(_0x418281){return _0x1fd7d6[_0x6916('0x16')](_0x3c4907);}return _0x1fd7d6[_0x6916('0x17')](_0x3c4907)['end']();};}function respondWithResult(_0x16b794,_0x46c301){_0x46c301=_0x46c301||0xc8;return function(_0x7bda86){if(_0x7bda86){return _0x16b794[_0x6916('0x17')](_0x46c301)[_0x6916('0x18')](_0x7bda86);}};}function respondWithFilteredResult(_0x540f7d,_0x435d4e){return function(_0x1b156a){if(_0x1b156a){var _0x5e1d80=typeof _0x435d4e[_0x6916('0x19')]===_0x6916('0x1a')&&typeof _0x435d4e['limit']===_0x6916('0x1a');var _0x217923=_0x1b156a['count'];var _0xa1c712=_0x5e1d80?0x0:_0x435d4e[_0x6916('0x19')];var _0x3dcdae=_0x5e1d80?_0x1b156a[_0x6916('0x1b')]:_0x435d4e['offset']+_0x435d4e[_0x6916('0x1c')];var _0x4fd0c0;if(_0x3dcdae>=_0x217923){_0x3dcdae=_0x217923;_0x4fd0c0=0xc8;}else{_0x4fd0c0=0xce;}_0x540f7d[_0x6916('0x17')](_0x4fd0c0);return _0x540f7d[_0x6916('0x1d')](_0x6916('0x1e'),_0xa1c712+'-'+_0x3dcdae+'/'+_0x217923)['json'](_0x1b156a);}return null;};}function patchUpdates(_0x49903a){return function(_0x446d1b){try{jsonpatch[_0x6916('0x1f')](_0x446d1b,_0x49903a,!![]);}catch(_0x205481){return BPromise[_0x6916('0x20')](_0x205481);}return _0x446d1b[_0x6916('0x21')]();};}function saveUpdates(_0x4e8ab4,_0x1b7446){return function(_0x31d769){if(_0x31d769){return _0x31d769['update'](_0x4e8ab4)[_0x6916('0x22')](function(_0x3fde47){return _0x3fde47;});}return null;};}function removeEntity(_0x30d889,_0x10634d){return function(_0xa85b7e){if(_0xa85b7e){return _0xa85b7e['destroy']()[_0x6916('0x22')](function(){_0x30d889[_0x6916('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x336f9e,_0x4368ae){return function(_0x4c21f5){if(!_0x4c21f5){_0x336f9e['sendStatus'](0x194);}return _0x4c21f5;};}function handleError(_0x365e51,_0x42b59d){_0x42b59d=_0x42b59d||0x1f4;return function(_0x55bf58){logger[_0x6916('0x23')](_0x55bf58[_0x6916('0x24')]);if(_0x55bf58['name']){delete _0x55bf58['name'];}_0x365e51[_0x6916('0x17')](_0x42b59d)[_0x6916('0x25')](_0x55bf58);};}exports[_0x6916('0x26')]=function(_0x23a7b0,_0x55f063){var _0x487122={},_0x4630ac={},_0x305b9a={'count':0x0,'rows':[]};var _0x1629a0=_[_0x6916('0x27')](db['ZendeskConfiguration'][_0x6916('0x28')],function(_0x763a69){return{'name':_0x763a69[_0x6916('0x29')],'type':_0x763a69[_0x6916('0x2a')][_0x6916('0x2b')]};});_0x4630ac[_0x6916('0x2c')]=_[_0x6916('0x27')](_0x1629a0,_0x6916('0x2d'));_0x4630ac[_0x6916('0x2e')]=_[_0x6916('0x2f')](_0x23a7b0[_0x6916('0x2e')]);_0x4630ac[_0x6916('0x30')]=_[_0x6916('0x31')](_0x4630ac['model'],_0x4630ac[_0x6916('0x2e')]);_0x487122[_0x6916('0x32')]=_['intersection'](_0x4630ac['model'],qs[_0x6916('0x33')](_0x23a7b0[_0x6916('0x2e')]['fields']));_0x487122[_0x6916('0x32')]=_0x487122[_0x6916('0x32')][_0x6916('0x34')]?_0x487122[_0x6916('0x32')]:_0x4630ac[_0x6916('0x2c')];if(!_0x23a7b0[_0x6916('0x2e')]['hasOwnProperty'](_0x6916('0x35'))){_0x487122[_0x6916('0x1c')]=qs[_0x6916('0x1c')](_0x23a7b0[_0x6916('0x2e')][_0x6916('0x1c')]);_0x487122[_0x6916('0x19')]=qs['offset'](_0x23a7b0[_0x6916('0x2e')][_0x6916('0x19')]);}_0x487122[_0x6916('0x36')]=qs[_0x6916('0x37')](_0x23a7b0['query'][_0x6916('0x37')]);_0x487122['where']=qs['filters'](_[_0x6916('0x38')](_0x23a7b0[_0x6916('0x2e')],_0x4630ac['filters']),_0x1629a0);if(_0x23a7b0[_0x6916('0x2e')][_0x6916('0x39')]){_0x487122[_0x6916('0x3a')]=_['merge'](_0x487122['where'],{'$or':_[_0x6916('0x27')](_0x1629a0,function(_0x14df38){if(_0x14df38[_0x6916('0x2a')]!=='VIRTUAL'){var _0x1c47b3={};_0x1c47b3[_0x14df38[_0x6916('0x2d')]]={'$like':'%'+_0x23a7b0[_0x6916('0x2e')][_0x6916('0x39')]+'%'};return _0x1c47b3;}})});}_0x487122=_[_0x6916('0x3b')]({},_0x487122,_0x23a7b0['options']);var _0x332d92={'where':_0x487122['where']};return db[_0x6916('0x3c')][_0x6916('0x1b')](_0x332d92)[_0x6916('0x22')](function(_0x491f77){_0x305b9a[_0x6916('0x1b')]=_0x491f77;if(_0x23a7b0[_0x6916('0x2e')]['includeAll']){_0x487122[_0x6916('0x3d')]=[{'all':!![]}];}return db[_0x6916('0x3c')][_0x6916('0x3e')](_0x487122);})[_0x6916('0x22')](function(_0x4764b9){_0x305b9a[_0x6916('0x3f')]=_0x4764b9;return _0x305b9a;})[_0x6916('0x22')](respondWithFilteredResult(_0x55f063,_0x487122))[_0x6916('0x40')](handleError(_0x55f063,null));};exports['show']=function(_0x325c9e,_0x3c3c15){var _0x1d461a={'raw':![],'where':{'id':_0x325c9e['params']['id']}},_0x350107={};_0x350107[_0x6916('0x2c')]=_['keys'](db[_0x6916('0x3c')]['rawAttributes']);_0x350107[_0x6916('0x2e')]=_[_0x6916('0x2f')](_0x325c9e[_0x6916('0x2e')]);_0x350107[_0x6916('0x30')]=_[_0x6916('0x31')](_0x350107[_0x6916('0x2c')],_0x350107[_0x6916('0x2e')]);_0x1d461a[_0x6916('0x32')]=_['intersection'](_0x350107[_0x6916('0x2c')],qs[_0x6916('0x33')](_0x325c9e[_0x6916('0x2e')][_0x6916('0x33')]));_0x1d461a[_0x6916('0x32')]=_0x1d461a[_0x6916('0x32')]['length']?_0x1d461a[_0x6916('0x32')]:_0x350107['model'];if(_0x325c9e[_0x6916('0x2e')]['includeAll']){_0x1d461a[_0x6916('0x3d')]=[{'all':!![]}];}_0x1d461a=_[_0x6916('0x3b')]({},_0x1d461a,_0x325c9e['options']);return db[_0x6916('0x3c')][_0x6916('0x41')](_0x1d461a)[_0x6916('0x22')](handleEntityNotFound(_0x3c3c15,null))['then'](respondWithResult(_0x3c3c15,null))[_0x6916('0x40')](handleError(_0x3c3c15,null));};exports[_0x6916('0x42')]=function(_0x2a33ec,_0x2bb834){return db[_0x6916('0x3c')]['create'](_0x2a33ec['body'],{})[_0x6916('0x22')](respondWithResult(_0x2bb834,0xc9))[_0x6916('0x40')](handleError(_0x2bb834,null));};exports[_0x6916('0x43')]=function(_0x5afcb1,_0x23fbeb){if(_0x5afcb1['body']['id']){delete _0x5afcb1['body']['id'];}return db[_0x6916('0x3c')][_0x6916('0x41')]({'where':{'id':_0x5afcb1[_0x6916('0x44')]['id']}})[_0x6916('0x22')](handleEntityNotFound(_0x23fbeb,null))[_0x6916('0x22')](saveUpdates(_0x5afcb1[_0x6916('0x45')],null))[_0x6916('0x22')](respondWithResult(_0x23fbeb,null))[_0x6916('0x40')](handleError(_0x23fbeb,null));};exports[_0x6916('0x46')]=function(_0x5b2938,_0x1257db){return db[_0x6916('0x3c')][_0x6916('0x41')]({'where':{'id':_0x5b2938[_0x6916('0x44')]['id']}})[_0x6916('0x22')](handleEntityNotFound(_0x1257db,null))[_0x6916('0x22')](removeEntity(_0x1257db,null))[_0x6916('0x40')](handleError(_0x1257db,null));};exports[_0x6916('0x47')]=function(_0x13f7c8,_0x391fdd,_0x230b3d){var _0x4f49ec={};var _0x33085a={};var _0xf272f5;var _0x5a7e41;return db[_0x6916('0x3c')][_0x6916('0x48')]({'where':{'id':_0x13f7c8[_0x6916('0x44')]['id']}})[_0x6916('0x22')](handleEntityNotFound(_0x391fdd,null))[_0x6916('0x22')](function(_0x8f1cf6){if(_0x8f1cf6){_0xf272f5=_0x8f1cf6;_0x33085a[_0x6916('0x2c')]=_['keys'](db[_0x6916('0x49')]['rawAttributes']);_0x33085a['query']=_[_0x6916('0x2f')](_0x13f7c8[_0x6916('0x2e')]);_0x33085a[_0x6916('0x30')]=_[_0x6916('0x31')](_0x33085a[_0x6916('0x2c')],_0x33085a[_0x6916('0x2e')]);_0x4f49ec[_0x6916('0x32')]=_['intersection'](_0x33085a[_0x6916('0x2c')],qs['fields'](_0x13f7c8[_0x6916('0x2e')][_0x6916('0x33')]));_0x4f49ec[_0x6916('0x32')]=_0x4f49ec['attributes'][_0x6916('0x34')]?_0x4f49ec[_0x6916('0x32')]:_0x33085a[_0x6916('0x2c')];_0x4f49ec['order']=qs['sort'](_0x13f7c8[_0x6916('0x2e')][_0x6916('0x37')]);_0x4f49ec['where']=qs['filters'](_[_0x6916('0x38')](_0x13f7c8[_0x6916('0x2e')],_0x33085a[_0x6916('0x30')]));if(_0x13f7c8[_0x6916('0x2e')]['filter']){_0x4f49ec['where']=_[_0x6916('0x3b')](_0x4f49ec[_0x6916('0x3a')],{'$or':_['map'](_0x4f49ec[_0x6916('0x32')],function(_0x232777){var _0x415fe0={};_0x415fe0[_0x232777]={'$like':'%'+_0x13f7c8[_0x6916('0x2e')][_0x6916('0x39')]+'%'};return _0x415fe0;})});}_0x4f49ec=_[_0x6916('0x3b')]({},_0x4f49ec,_0x13f7c8[_0x6916('0x4a')]);return _0xf272f5['getFields'](_0x4f49ec);}})[_0x6916('0x22')](function(_0x4c6d32){if(_0x4c6d32){_0x5a7e41=_0x4c6d32[_0x6916('0x34')];if(!_0x13f7c8[_0x6916('0x2e')][_0x6916('0x4b')](_0x6916('0x35'))){_0x4f49ec[_0x6916('0x1c')]=qs[_0x6916('0x1c')](_0x13f7c8[_0x6916('0x2e')][_0x6916('0x1c')]);_0x4f49ec[_0x6916('0x19')]=qs['offset'](_0x13f7c8[_0x6916('0x2e')][_0x6916('0x19')]);}return _0xf272f5[_0x6916('0x47')](_0x4f49ec);}})['then'](function(_0x55991c){if(_0x55991c){return _0x55991c?{'count':_0x5a7e41,'rows':_0x55991c}:null;}})[_0x6916('0x22')](respondWithResult(_0x391fdd,null))[_0x6916('0x40')](handleError(_0x391fdd,null));};exports[_0x6916('0x4c')]=function(_0x26e8d2,_0xc58b6d,_0x3e82d0){var _0x2c7ee3={};var _0x5038fe={};var _0x1c651d;var _0x1715f9;return db[_0x6916('0x3c')][_0x6916('0x48')]({'where':{'id':_0x26e8d2['params']['id']}})[_0x6916('0x22')](handleEntityNotFound(_0xc58b6d,null))[_0x6916('0x22')](function(_0x156255){if(_0x156255){_0x1c651d=_0x156255;_0x5038fe[_0x6916('0x2c')]=_[_0x6916('0x2f')](db[_0x6916('0x49')][_0x6916('0x28')]);_0x5038fe['query']=_[_0x6916('0x2f')](_0x26e8d2[_0x6916('0x2e')]);_0x5038fe[_0x6916('0x30')]=_['intersection'](_0x5038fe[_0x6916('0x2c')],_0x5038fe[_0x6916('0x2e')]);_0x2c7ee3[_0x6916('0x32')]=_[_0x6916('0x31')](_0x5038fe[_0x6916('0x2c')],qs[_0x6916('0x33')](_0x26e8d2[_0x6916('0x2e')][_0x6916('0x33')]));_0x2c7ee3[_0x6916('0x32')]=_0x2c7ee3['attributes'][_0x6916('0x34')]?_0x2c7ee3[_0x6916('0x32')]:_0x5038fe[_0x6916('0x2c')];_0x2c7ee3[_0x6916('0x36')]=qs[_0x6916('0x37')](_0x26e8d2['query'][_0x6916('0x37')]);_0x2c7ee3['where']=qs[_0x6916('0x30')](_['pick'](_0x26e8d2[_0x6916('0x2e')],_0x5038fe[_0x6916('0x30')]));if(_0x26e8d2['query'][_0x6916('0x39')]){_0x2c7ee3['where']=_[_0x6916('0x3b')](_0x2c7ee3[_0x6916('0x3a')],{'$or':_['map'](_0x2c7ee3[_0x6916('0x32')],function(_0x5e9f71){var _0x2b3f10={};_0x2b3f10[_0x5e9f71]={'$like':'%'+_0x26e8d2[_0x6916('0x2e')][_0x6916('0x39')]+'%'};return _0x2b3f10;})});}_0x2c7ee3=_['merge']({},_0x2c7ee3,_0x26e8d2['options']);return _0x1c651d['getSubjects'](_0x2c7ee3);}})[_0x6916('0x22')](function(_0x126b8b){if(_0x126b8b){_0x1715f9=_0x126b8b[_0x6916('0x34')];if(!_0x26e8d2[_0x6916('0x2e')]['hasOwnProperty'](_0x6916('0x35'))){_0x2c7ee3[_0x6916('0x1c')]=qs[_0x6916('0x1c')](_0x26e8d2[_0x6916('0x2e')][_0x6916('0x1c')]);_0x2c7ee3[_0x6916('0x19')]=qs[_0x6916('0x19')](_0x26e8d2[_0x6916('0x2e')][_0x6916('0x19')]);}return _0x1c651d['getSubjects'](_0x2c7ee3);}})[_0x6916('0x22')](function(_0x3caba6){if(_0x3caba6){return _0x3caba6?{'count':_0x1715f9,'rows':_0x3caba6}:null;}})['then'](respondWithResult(_0xc58b6d,null))['catch'](handleError(_0xc58b6d,null));};exports[_0x6916('0x4d')]=function(_0x12a8de,_0x2074cd,_0x39a51e){var _0x3a787d={};var _0x45217a={};var _0x52e200;var _0x669d84;return db[_0x6916('0x3c')][_0x6916('0x48')]({'where':{'id':_0x12a8de[_0x6916('0x44')]['id']}})['then'](handleEntityNotFound(_0x2074cd,null))[_0x6916('0x22')](function(_0x570885){if(_0x570885){_0x52e200=_0x570885;_0x45217a[_0x6916('0x2c')]=_[_0x6916('0x2f')](db[_0x6916('0x49')]['rawAttributes']);_0x45217a[_0x6916('0x2e')]=_['keys'](_0x12a8de[_0x6916('0x2e')]);_0x45217a['filters']=_['intersection'](_0x45217a[_0x6916('0x2c')],_0x45217a[_0x6916('0x2e')]);_0x3a787d[_0x6916('0x32')]=_[_0x6916('0x31')](_0x45217a[_0x6916('0x2c')],qs[_0x6916('0x33')](_0x12a8de['query']['fields']));_0x3a787d[_0x6916('0x32')]=_0x3a787d[_0x6916('0x32')][_0x6916('0x34')]?_0x3a787d['attributes']:_0x45217a[_0x6916('0x2c')];_0x3a787d[_0x6916('0x36')]=qs['sort'](_0x12a8de['query'][_0x6916('0x37')]);_0x3a787d[_0x6916('0x3a')]=qs[_0x6916('0x30')](_[_0x6916('0x38')](_0x12a8de['query'],_0x45217a[_0x6916('0x30')]));if(_0x12a8de[_0x6916('0x2e')][_0x6916('0x39')]){_0x3a787d[_0x6916('0x3a')]=_['merge'](_0x3a787d[_0x6916('0x3a')],{'$or':_[_0x6916('0x27')](_0x3a787d['attributes'],function(_0x132987){var _0x180502={};_0x180502[_0x132987]={'$like':'%'+_0x12a8de[_0x6916('0x2e')][_0x6916('0x39')]+'%'};return _0x180502;})});}_0x3a787d=_[_0x6916('0x3b')]({},_0x3a787d,_0x12a8de['options']);return _0x52e200[_0x6916('0x4d')](_0x3a787d);}})[_0x6916('0x22')](function(_0x55916c){if(_0x55916c){_0x669d84=_0x55916c[_0x6916('0x34')];if(!_0x12a8de[_0x6916('0x2e')][_0x6916('0x4b')](_0x6916('0x35'))){_0x3a787d['limit']=qs[_0x6916('0x1c')](_0x12a8de['query'][_0x6916('0x1c')]);_0x3a787d['offset']=qs[_0x6916('0x19')](_0x12a8de['query'][_0x6916('0x19')]);}return _0x52e200['getDescriptions'](_0x3a787d);}})[_0x6916('0x22')](function(_0x103520){if(_0x103520){return _0x103520?{'count':_0x669d84,'rows':_0x103520}:null;}})[_0x6916('0x22')](respondWithResult(_0x2074cd,null))['catch'](handleError(_0x2074cd,null));};exports[_0x6916('0x4e')]=function(_0x23a2ba,_0x3331d1,_0x389f39){var _0x561fb5={};var _0xbdae2d={};var _0x896775;var _0x2bcd67;return db[_0x6916('0x3c')][_0x6916('0x48')]({'where':{'id':_0x23a2ba[_0x6916('0x44')]['id']}})[_0x6916('0x22')](handleEntityNotFound(_0x3331d1,null))[_0x6916('0x22')](function(_0x429b62){if(_0x429b62){_0x896775=_0x429b62;_0xbdae2d[_0x6916('0x2c')]=_[_0x6916('0x2f')](db[_0x6916('0x4f')]['rawAttributes']);_0xbdae2d[_0x6916('0x2e')]=_[_0x6916('0x2f')](_0x23a2ba[_0x6916('0x2e')]);_0xbdae2d[_0x6916('0x30')]=_['intersection'](_0xbdae2d[_0x6916('0x2c')],_0xbdae2d['query']);_0x561fb5[_0x6916('0x32')]=_[_0x6916('0x31')](_0xbdae2d[_0x6916('0x2c')],qs[_0x6916('0x33')](_0x23a2ba[_0x6916('0x2e')][_0x6916('0x33')]));_0x561fb5['attributes']=_0x561fb5['attributes'][_0x6916('0x34')]?_0x561fb5[_0x6916('0x32')]:_0xbdae2d[_0x6916('0x2c')];_0x561fb5['order']=qs[_0x6916('0x37')](_0x23a2ba[_0x6916('0x2e')]['sort']);_0x561fb5[_0x6916('0x3a')]=qs[_0x6916('0x30')](_[_0x6916('0x38')](_0x23a2ba[_0x6916('0x2e')],_0xbdae2d[_0x6916('0x30')]));if(_0x23a2ba['query'][_0x6916('0x39')]){_0x561fb5[_0x6916('0x3a')]=_[_0x6916('0x3b')](_0x561fb5['where'],{'$or':_[_0x6916('0x27')](_0x561fb5['attributes'],function(_0x4fca32){var _0x32806e={};_0x32806e[_0x4fca32]={'$like':'%'+_0x23a2ba[_0x6916('0x2e')][_0x6916('0x39')]+'%'};return _0x32806e;})});}_0x561fb5=_[_0x6916('0x3b')]({},_0x561fb5,_0x23a2ba[_0x6916('0x4a')]);return _0x896775[_0x6916('0x4e')](_0x561fb5);}})[_0x6916('0x22')](function(_0x2f35aa){if(_0x2f35aa){_0x2bcd67=_0x2f35aa[_0x6916('0x34')];if(!_0x23a2ba['query'][_0x6916('0x4b')](_0x6916('0x35'))){_0x561fb5['limit']=qs[_0x6916('0x1c')](_0x23a2ba['query']['limit']);_0x561fb5[_0x6916('0x19')]=qs['offset'](_0x23a2ba[_0x6916('0x2e')][_0x6916('0x19')]);}return _0x896775[_0x6916('0x4e')](_0x561fb5);}})[_0x6916('0x22')](function(_0x30e47f){if(_0x30e47f){return _0x30e47f?{'count':_0x2bcd67,'rows':_0x30e47f}:null;}})[_0x6916('0x22')](respondWithResult(_0x3331d1,null))['catch'](handleError(_0x3331d1,null));};exports[_0x6916('0x50')]=function(_0x11c3ac,_0x3c749a,_0x58e964){if(_0x11c3ac['body']['id']){delete _0x11c3ac[_0x6916('0x45')]['id'];}return db[_0x6916('0x3c')][_0x6916('0x48')]({'where':{'id':_0x11c3ac[_0x6916('0x44')]['id']}})[_0x6916('0x22')](handleEntityNotFound(_0x3c749a,null))[_0x6916('0x22')](function(_0x15c4f3){if(_0x15c4f3){return _0x15c4f3['setTags'](_0x11c3ac[_0x6916('0x45')][_0x6916('0x51')]||[]);}return null;})[_0x6916('0x22')](respondWithResult(_0x3c749a,null))[_0x6916('0x40')](handleError(_0x3c749a,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index a538250..724e537 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 _0xb688=['exports','ZendeskConfiguration','int_zendesk_configurations','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intZendeskConfiguration.attributes'];(function(_0xa96a9c,_0x242a1e){var _0x5bda18=function(_0x2177ac){while(--_0x2177ac){_0xa96a9c['push'](_0xa96a9c['shift']());}};_0x5bda18(++_0x242a1e);}(_0xb688,0xcf));var _0x8b68=function(_0x34c134,_0x3912e3){_0x34c134=_0x34c134-0x0;var _0x90c67e=_0xb688[_0x34c134];return _0x90c67e;};'use strict';var _=require('lodash');var util=require(_0x8b68('0x0'));var logger=require(_0x8b68('0x1'))(_0x8b68('0x2'));var moment=require(_0x8b68('0x3'));var BPromise=require(_0x8b68('0x4'));var rp=require(_0x8b68('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8b68('0x6'));var config=require(_0x8b68('0x7'));var attributes=require(_0x8b68('0x8'));module[_0x8b68('0x9')]=function(_0x583d16,_0x34314e){return _0x583d16['define'](_0x8b68('0xa'),attributes,{'tableName':_0x8b68('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1399=['ZendeskConfiguration','lodash','util','api','bluebird','request-promise','path','rimraf','../../config/environment','./intZendeskConfiguration.attributes','define'];(function(_0x1397d8,_0x275efb){var _0x2f9108=function(_0x577847){while(--_0x577847){_0x1397d8['push'](_0x1397d8['shift']());}};_0x2f9108(++_0x275efb);}(_0x1399,0x16c));var _0x9139=function(_0x5b7786,_0xe47b5c){_0x5b7786=_0x5b7786-0x0;var _0x5882ab=_0x1399[_0x5b7786];return _0x5882ab;};'use strict';var _=require(_0x9139('0x0'));var util=require(_0x9139('0x1'));var logger=require('../../config/logger')(_0x9139('0x2'));var moment=require('moment');var BPromise=require(_0x9139('0x3'));var rp=require(_0x9139('0x4'));var fs=require('fs');var path=require(_0x9139('0x5'));var rimraf=require(_0x9139('0x6'));var config=require(_0x9139('0x7'));var attributes=require(_0x9139('0x8'));module['exports']=function(_0x54af2d,_0x8f086b){return _0x54af2d[_0x9139('0x9')](_0x9139('0xa'),attributes,{'tableName':'int_zendesk_configurations','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 ff9ed39..6d90f5f 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 _0x146e=['request','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/environment','client','http'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x146e,0xa3));var _0xe146=function(_0x57a17b,_0x9214f){_0x57a17b=_0x57a17b-0x0;var _0x4918cf=_0x146e[_0x57a17b];return _0x4918cf;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe146('0x0'));var BPromise=require(_0xe146('0x1'));var rs=require(_0xe146('0x2'));var fs=require('fs');var Redis=require(_0xe146('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xe146('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xe146('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xe146('0x6')][_0xe146('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x296c48,_0x7bfd4c,_0x38d1b3){return new BPromise(function(_0x47c564,_0x5496e8){return client[_0xe146('0x8')](_0x296c48,_0x38d1b3)['then'](function(_0x12a4b3){logger[_0xe146('0x9')](_0xe146('0xa'),_0x7bfd4c,_0xe146('0xb'));logger[_0xe146('0xc')](_0xe146('0xd'),_0x7bfd4c,_0xe146('0xb'),JSON['stringify'](_0x12a4b3));if(_0x12a4b3[_0xe146('0xe')]){if(_0x12a4b3[_0xe146('0xe')][_0xe146('0xf')]===0x1f4){logger[_0xe146('0xe')](_0xe146('0xa'),_0x7bfd4c,_0x12a4b3[_0xe146('0xe')]['message']);return _0x5496e8(_0x12a4b3['error'][_0xe146('0x10')]);}logger['error'](_0xe146('0xa'),_0x7bfd4c,_0x12a4b3[_0xe146('0xe')][_0xe146('0x10')]);return _0x47c564(_0x12a4b3[_0xe146('0xe')][_0xe146('0x10')]);}else{logger[_0xe146('0x9')]('ZendeskConfiguration,\x20%s,\x20%s',_0x7bfd4c,_0xe146('0xb'));_0x47c564(_0x12a4b3[_0xe146('0x11')]['message']);}})[_0xe146('0x12')](function(_0xce97fb){logger[_0xe146('0xe')]('ZendeskConfiguration,\x20%s,\x20%s',_0x7bfd4c,_0xce97fb);_0x5496e8(_0xce97fb);});});} \ No newline at end of file +var _0x171c=['then','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','lodash','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','request'];(function(_0x1e8718,_0x3341f2){var _0x341c46=function(_0x294877){while(--_0x294877){_0x1e8718['push'](_0x1e8718['shift']());}};_0x341c46(++_0x3341f2);}(_0x171c,0x138));var _0xc171=function(_0x151686,_0x380a64){_0x151686=_0x151686-0x0;var _0x341937=_0x171c[_0x151686];return _0x341937;};'use strict';var _=require(_0xc171('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xc171('0x1'));var fs=require('fs');var Redis=require(_0xc171('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xc171('0x3'));var logger=require('../../config/logger')(_0xc171('0x4'));var config=require(_0xc171('0x5'));var jayson=require(_0xc171('0x6'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4198e6,_0x2c2c69,_0x5e2705){return new BPromise(function(_0x1c09e5,_0x50d975){return client[_0xc171('0x7')](_0x4198e6,_0x5e2705)[_0xc171('0x8')](function(_0x1c5192){logger[_0xc171('0x9')](_0xc171('0xa'),_0x2c2c69,_0xc171('0xb'));logger[_0xc171('0xc')](_0xc171('0xd'),_0x2c2c69,'request\x20sent',JSON[_0xc171('0xe')](_0x1c5192));if(_0x1c5192['error']){if(_0x1c5192['error'][_0xc171('0xf')]===0x1f4){logger['error']('ZendeskConfiguration,\x20%s,\x20%s',_0x2c2c69,_0x1c5192[_0xc171('0x10')][_0xc171('0x11')]);return _0x50d975(_0x1c5192[_0xc171('0x10')][_0xc171('0x11')]);}logger[_0xc171('0x10')](_0xc171('0xa'),_0x2c2c69,_0x1c5192[_0xc171('0x10')][_0xc171('0x11')]);return _0x1c09e5(_0x1c5192[_0xc171('0x10')][_0xc171('0x11')]);}else{logger[_0xc171('0x9')](_0xc171('0xa'),_0x2c2c69,_0xc171('0xb'));_0x1c09e5(_0x1c5192[_0xc171('0x12')][_0xc171('0x11')]);}})[_0xc171('0x13')](function(_0x5a459a){logger['error']('ZendeskConfiguration,\x20%s,\x20%s',_0x2c2c69,_0x5a459a);_0x50d975(_0x5a459a);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index 4b2b600..e48145e 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 _0xaa6c=['../../config/environment','./intZendeskField.controller','get','index','/:id','show','isAuthenticated','create','put','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x2080f9,_0x42c071){var _0x21ed08=function(_0x36f9de){while(--_0x36f9de){_0x2080f9['push'](_0x2080f9['shift']());}};_0x21ed08(++_0x42c071);}(_0xaa6c,0x19d));var _0xcaa6=function(_0xc77819,_0x139fdc){_0xc77819=_0xc77819-0x0;var _0x1c9434=_0xaa6c[_0xc77819];return _0x1c9434;};'use strict';var multer=require(_0xcaa6('0x0'));var util=require(_0xcaa6('0x1'));var path=require(_0xcaa6('0x2'));var timeout=require('connect-timeout');var express=require(_0xcaa6('0x3'));var router=express[_0xcaa6('0x4')]();var fs_extra=require(_0xcaa6('0x5'));var auth=require(_0xcaa6('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xcaa6('0x7'));var controller=require(_0xcaa6('0x8'));router[_0xcaa6('0x9')]('/',auth['isAuthenticated'](),controller[_0xcaa6('0xa')]);router[_0xcaa6('0x9')](_0xcaa6('0xb'),auth['isAuthenticated'](),controller[_0xcaa6('0xc')]);router['post']('/',auth[_0xcaa6('0xd')](),controller[_0xcaa6('0xe')]);router[_0xcaa6('0xf')](_0xcaa6('0xb'),auth['isAuthenticated'](),controller[_0xcaa6('0x10')]);router[_0xcaa6('0x11')](_0xcaa6('0xb'),auth[_0xcaa6('0xd')](),controller[_0xcaa6('0x12')]);module[_0xcaa6('0x13')]=router; \ No newline at end of file +var _0x5878=['connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','post','create','update','delete','destroy','exports','multer','util','path'];(function(_0x54bb25,_0x57eb28){var _0x3ec411=function(_0x17f4ae){while(--_0x17f4ae){_0x54bb25['push'](_0x54bb25['shift']());}};_0x3ec411(++_0x57eb28);}(_0x5878,0x189));var _0x8587=function(_0x45f4dd,_0x4bd47c){_0x45f4dd=_0x45f4dd-0x0;var _0x4dd916=_0x5878[_0x45f4dd];return _0x4dd916;};'use strict';var multer=require(_0x8587('0x0'));var util=require(_0x8587('0x1'));var path=require(_0x8587('0x2'));var timeout=require(_0x8587('0x3'));var express=require(_0x8587('0x4'));var router=express[_0x8587('0x5')]();var fs_extra=require(_0x8587('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x8587('0x7'));var config=require(_0x8587('0x8'));var controller=require('./intZendeskField.controller');router[_0x8587('0x9')]('/',auth[_0x8587('0xa')](),controller['index']);router[_0x8587('0x9')](_0x8587('0xb'),auth[_0x8587('0xa')](),controller['show']);router[_0x8587('0xc')]('/',auth[_0x8587('0xa')](),controller[_0x8587('0xd')]);router['put'](_0x8587('0xb'),auth['isAuthenticated'](),controller[_0x8587('0xe')]);router[_0x8587('0xf')](_0x8587('0xb'),auth[_0x8587('0xa')](),controller[_0x8587('0x10')]);module[_0x8587('0x11')]=router; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.attributes.js b/server/api/intZendeskField/intZendeskField.attributes.js index 9dc75a8..cbdb4d2 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 _0x0524=['keyValue','STRING','BOOLEAN','exports','ENUM','string','variable','customVariable'];(function(_0x1c37f4,_0x3a9610){var _0xc0552e=function(_0x2fc63d){while(--_0x2fc63d){_0x1c37f4['push'](_0x1c37f4['shift']());}};_0xc0552e(++_0x3a9610);}(_0x0524,0xeb));var _0x4052=function(_0x1fafa5,_0x1aa281){_0x1fafa5=_0x1fafa5-0x0;var _0xcf08c9=_0x0524[_0x1fafa5];return _0xcf08c9;};'use strict';var Sequelize=require('sequelize');module[_0x4052('0x0')]={'type':{'type':Sequelize[_0x4052('0x1')](_0x4052('0x2'),_0x4052('0x3'),_0x4052('0x4'),_0x4052('0x5'),'picklist'),'defaultValue':_0x4052('0x2')},'content':{'type':Sequelize[_0x4052('0x6')]},'key':{'type':Sequelize[_0x4052('0x6')]},'keyType':{'type':Sequelize[_0x4052('0x1')](_0x4052('0x2'),_0x4052('0x3'),'customVariable')},'keyContent':{'type':Sequelize[_0x4052('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x4052('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x4052('0x6')]}}; \ No newline at end of file +var _0x4b26=['BOOLEAN','ENUM','string','customVariable','keyValue','picklist','STRING','variable'];(function(_0x3b7f76,_0xa1383a){var _0x4c0956=function(_0x55d6b4){while(--_0x55d6b4){_0x3b7f76['push'](_0x3b7f76['shift']());}};_0x4c0956(++_0xa1383a);}(_0x4b26,0xd9));var _0x64b2=function(_0x2d0e92,_0x3f8cec){_0x2d0e92=_0x2d0e92-0x0;var _0x1a0cf2=_0x4b26[_0x2d0e92];return _0x1a0cf2;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0x64b2('0x0')](_0x64b2('0x1'),'variable',_0x64b2('0x2'),_0x64b2('0x3'),_0x64b2('0x4')),'defaultValue':_0x64b2('0x1')},'content':{'type':Sequelize[_0x64b2('0x5')]},'key':{'type':Sequelize[_0x64b2('0x5')]},'keyType':{'type':Sequelize[_0x64b2('0x0')](_0x64b2('0x1'),_0x64b2('0x6'),_0x64b2('0x2'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x64b2('0x5')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x64b2('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x64b2('0x5')]}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index 92bdd95..db07567 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 _0xf951=['../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','offset','count','set','Content-Range','apply','save','update','then','destroy','end','error','stack','name','index','map','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','ZendeskField','includeAll','include','findAll','rows','show','params','catch','create','body','find','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../config/license/hardware','api'];(function(_0x5c3444,_0x4bb587){var _0x1d9516=function(_0x4863b8){while(--_0x4863b8){_0x5c3444['push'](_0x5c3444['shift']());}};_0x1d9516(++_0x4bb587);}(_0xf951,0x1f3));var _0x1f95=function(_0x23bf7f,_0x578f6c){_0x23bf7f=_0x23bf7f-0x0;var _0x64b00e=_0xf951[_0x23bf7f];return _0x64b00e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1f95('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1f95('0x1'));var rp=require(_0x1f95('0x2'));var moment=require('moment');var BPromise=require(_0x1f95('0x3'));var Mustache=require(_0x1f95('0x4'));var util=require(_0x1f95('0x5'));var path=require(_0x1f95('0x6'));var sox=require('sox');var csv=require(_0x1f95('0x7'));var ejs=require(_0x1f95('0x8'));var fs=require('fs');var fs_extra=require(_0x1f95('0x9'));var _=require(_0x1f95('0xa'));var squel=require(_0x1f95('0xb'));var crypto=require(_0x1f95('0xc'));var jsforce=require(_0x1f95('0xd'));var deskjs=require(_0x1f95('0xe'));var toCsv=require(_0x1f95('0x7'));var querystring=require(_0x1f95('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x1f95('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1f95('0x11'));var logger=require('../../config/logger')(_0x1f95('0x12'));var utils=require(_0x1f95('0x13'));var config=require(_0x1f95('0x14'));var licenseUtil=require(_0x1f95('0x15'));var db=require(_0x1f95('0x16'))['db'];function respondWithStatusCode(_0x26911e,_0x7164fc){_0x7164fc=_0x7164fc||0xcc;return function(_0xc664e){if(_0xc664e){return _0x26911e[_0x1f95('0x17')](_0x7164fc);}return _0x26911e[_0x1f95('0x18')](_0x7164fc)['end']();};}function respondWithResult(_0x410076,_0x176c7f){_0x176c7f=_0x176c7f||0xc8;return function(_0x21f802){if(_0x21f802){return _0x410076[_0x1f95('0x18')](_0x176c7f)[_0x1f95('0x19')](_0x21f802);}};}function respondWithFilteredResult(_0x47f57b,_0x3dd511){return function(_0x282757){if(_0x282757){var _0x5799be=typeof _0x3dd511['offset']===_0x1f95('0x1a')&&typeof _0x3dd511[_0x1f95('0x1b')]===_0x1f95('0x1a');var _0x46ca05=_0x282757['count'];var _0x4d1cc2=_0x5799be?0x0:_0x3dd511[_0x1f95('0x1c')];var _0x5b83ee=_0x5799be?_0x282757[_0x1f95('0x1d')]:_0x3dd511[_0x1f95('0x1c')]+_0x3dd511[_0x1f95('0x1b')];var _0x321823;if(_0x5b83ee>=_0x46ca05){_0x5b83ee=_0x46ca05;_0x321823=0xc8;}else{_0x321823=0xce;}_0x47f57b[_0x1f95('0x18')](_0x321823);return _0x47f57b[_0x1f95('0x1e')](_0x1f95('0x1f'),_0x4d1cc2+'-'+_0x5b83ee+'/'+_0x46ca05)[_0x1f95('0x19')](_0x282757);}return null;};}function patchUpdates(_0x3d1471){return function(_0x56d85e){try{jsonpatch[_0x1f95('0x20')](_0x56d85e,_0x3d1471,!![]);}catch(_0x237282){return BPromise['reject'](_0x237282);}return _0x56d85e[_0x1f95('0x21')]();};}function saveUpdates(_0x4f4474,_0x1b2eb8){return function(_0x6be539){if(_0x6be539){return _0x6be539[_0x1f95('0x22')](_0x4f4474)[_0x1f95('0x23')](function(_0x52d7df){return _0x52d7df;});}return null;};}function removeEntity(_0x342d11,_0x53a917){return function(_0x5b9f9f){if(_0x5b9f9f){return _0x5b9f9f[_0x1f95('0x24')]()[_0x1f95('0x23')](function(){_0x342d11['status'](0xcc)[_0x1f95('0x25')]();});}};}function handleEntityNotFound(_0x5a1ca4,_0x1ef0d6){return function(_0x4ddc3f){if(!_0x4ddc3f){_0x5a1ca4[_0x1f95('0x17')](0x194);}return _0x4ddc3f;};}function handleError(_0x2c5461,_0x52ba53){_0x52ba53=_0x52ba53||0x1f4;return function(_0x1936f5){logger[_0x1f95('0x26')](_0x1936f5[_0x1f95('0x27')]);if(_0x1936f5[_0x1f95('0x28')]){delete _0x1936f5[_0x1f95('0x28')];}_0x2c5461[_0x1f95('0x18')](_0x52ba53)['send'](_0x1936f5);};}exports[_0x1f95('0x29')]=function(_0xe8548c,_0x16ccf4){var _0x1eb960={},_0xe59b5b={},_0x3b735b={'count':0x0,'rows':[]};var _0x233a39=_[_0x1f95('0x2a')](db['ZendeskField']['rawAttributes'],function(_0x1de842){return{'name':_0x1de842[_0x1f95('0x2b')],'type':_0x1de842[_0x1f95('0x2c')][_0x1f95('0x2d')]};});_0xe59b5b[_0x1f95('0x2e')]=_[_0x1f95('0x2a')](_0x233a39,'name');_0xe59b5b[_0x1f95('0x2f')]=_[_0x1f95('0x30')](_0xe8548c['query']);_0xe59b5b[_0x1f95('0x31')]=_['intersection'](_0xe59b5b[_0x1f95('0x2e')],_0xe59b5b[_0x1f95('0x2f')]);_0x1eb960[_0x1f95('0x32')]=_[_0x1f95('0x33')](_0xe59b5b['model'],qs[_0x1f95('0x34')](_0xe8548c['query']['fields']));_0x1eb960[_0x1f95('0x32')]=_0x1eb960[_0x1f95('0x32')][_0x1f95('0x35')]?_0x1eb960[_0x1f95('0x32')]:_0xe59b5b['model'];if(!_0xe8548c['query'][_0x1f95('0x36')](_0x1f95('0x37'))){_0x1eb960[_0x1f95('0x1b')]=qs['limit'](_0xe8548c[_0x1f95('0x2f')][_0x1f95('0x1b')]);_0x1eb960['offset']=qs[_0x1f95('0x1c')](_0xe8548c[_0x1f95('0x2f')][_0x1f95('0x1c')]);}_0x1eb960[_0x1f95('0x38')]=qs['sort'](_0xe8548c[_0x1f95('0x2f')][_0x1f95('0x39')]);_0x1eb960[_0x1f95('0x3a')]=qs[_0x1f95('0x31')](_[_0x1f95('0x3b')](_0xe8548c['query'],_0xe59b5b[_0x1f95('0x31')]),_0x233a39);if(_0xe8548c[_0x1f95('0x2f')][_0x1f95('0x3c')]){_0x1eb960['where']=_[_0x1f95('0x3d')](_0x1eb960['where'],{'$or':_[_0x1f95('0x2a')](_0x233a39,function(_0x5857e9){if(_0x5857e9[_0x1f95('0x2c')]!=='VIRTUAL'){var _0x306c8a={};_0x306c8a[_0x5857e9[_0x1f95('0x28')]]={'$like':'%'+_0xe8548c[_0x1f95('0x2f')][_0x1f95('0x3c')]+'%'};return _0x306c8a;}})});}_0x1eb960=_[_0x1f95('0x3d')]({},_0x1eb960,_0xe8548c[_0x1f95('0x3e')]);var _0xc660e4={'where':_0x1eb960['where']};return db[_0x1f95('0x3f')][_0x1f95('0x1d')](_0xc660e4)[_0x1f95('0x23')](function(_0x5cb611){_0x3b735b['count']=_0x5cb611;if(_0xe8548c['query'][_0x1f95('0x40')]){_0x1eb960[_0x1f95('0x41')]=[{'all':!![]}];}return db[_0x1f95('0x3f')][_0x1f95('0x42')](_0x1eb960);})['then'](function(_0x564682){_0x3b735b[_0x1f95('0x43')]=_0x564682;return _0x3b735b;})[_0x1f95('0x23')](respondWithFilteredResult(_0x16ccf4,_0x1eb960))['catch'](handleError(_0x16ccf4,null));};exports[_0x1f95('0x44')]=function(_0x3e15a0,_0x423f77){var _0x2e3790={'raw':!![],'where':{'id':_0x3e15a0[_0x1f95('0x45')]['id']}},_0x3cfa28={};_0x3cfa28[_0x1f95('0x2e')]=_[_0x1f95('0x30')](db[_0x1f95('0x3f')]['rawAttributes']);_0x3cfa28['query']=_['keys'](_0x3e15a0['query']);_0x3cfa28[_0x1f95('0x31')]=_['intersection'](_0x3cfa28['model'],_0x3cfa28['query']);_0x2e3790[_0x1f95('0x32')]=_[_0x1f95('0x33')](_0x3cfa28[_0x1f95('0x2e')],qs[_0x1f95('0x34')](_0x3e15a0['query'][_0x1f95('0x34')]));_0x2e3790[_0x1f95('0x32')]=_0x2e3790[_0x1f95('0x32')]['length']?_0x2e3790[_0x1f95('0x32')]:_0x3cfa28[_0x1f95('0x2e')];if(_0x3e15a0[_0x1f95('0x2f')]['includeAll']){_0x2e3790[_0x1f95('0x41')]=[{'all':!![]}];}_0x2e3790=_[_0x1f95('0x3d')]({},_0x2e3790,_0x3e15a0[_0x1f95('0x3e')]);return db[_0x1f95('0x3f')]['find'](_0x2e3790)[_0x1f95('0x23')](handleEntityNotFound(_0x423f77,null))[_0x1f95('0x23')](respondWithResult(_0x423f77,null))[_0x1f95('0x46')](handleError(_0x423f77,null));};exports['create']=function(_0x30054a,_0x194797){return db['ZendeskField'][_0x1f95('0x47')](_0x30054a[_0x1f95('0x48')],{})[_0x1f95('0x23')](respondWithResult(_0x194797,0xc9))[_0x1f95('0x46')](handleError(_0x194797,null));};exports[_0x1f95('0x22')]=function(_0x4e23ab,_0x221b16){if(_0x4e23ab['body']['id']){delete _0x4e23ab[_0x1f95('0x48')]['id'];}return db['ZendeskField']['find']({'where':{'id':_0x4e23ab[_0x1f95('0x45')]['id']}})[_0x1f95('0x23')](handleEntityNotFound(_0x221b16,null))['then'](saveUpdates(_0x4e23ab[_0x1f95('0x48')],null))[_0x1f95('0x23')](respondWithResult(_0x221b16,null))[_0x1f95('0x46')](handleError(_0x221b16,null));};exports[_0x1f95('0x24')]=function(_0x33f015,_0x221c52){return db[_0x1f95('0x3f')][_0x1f95('0x49')]({'where':{'id':_0x33f015[_0x1f95('0x45')]['id']}})[_0x1f95('0x23')](handleEntityNotFound(_0x221c52,null))[_0x1f95('0x23')](removeEntity(_0x221c52,null))['catch'](handleError(_0x221c52,null));}; \ No newline at end of file +var _0xeec6=['count','set','json','apply','reject','update','then','destroy','error','stack','name','send','map','ZendeskField','fieldName','type','model','query','keys','intersection','attributes','length','hasOwnProperty','nolimit','limit','order','sort','filters','pick','filter','merge','where','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','rawAttributes','fields','find','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined'];(function(_0x3e3064,_0x3dd6f5){var _0x4547e1=function(_0x785d07){while(--_0x785d07){_0x3e3064['push'](_0x3e3064['shift']());}};_0x4547e1(++_0x3dd6f5);}(_0xeec6,0x1aa));var _0x6eec=function(_0x16539a,_0x31409a){_0x16539a=_0x16539a-0x0;var _0x200796=_0xeec6[_0x16539a];return _0x200796;};'use strict';var emlformat=require(_0x6eec('0x0'));var rimraf=require(_0x6eec('0x1'));var zipdir=require(_0x6eec('0x2'));var jsonpatch=require(_0x6eec('0x3'));var rp=require(_0x6eec('0x4'));var moment=require(_0x6eec('0x5'));var BPromise=require(_0x6eec('0x6'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x6eec('0x7'));var csv=require('to-csv');var ejs=require(_0x6eec('0x8'));var fs=require('fs');var fs_extra=require(_0x6eec('0x9'));var _=require(_0x6eec('0xa'));var squel=require(_0x6eec('0xb'));var crypto=require(_0x6eec('0xc'));var jsforce=require(_0x6eec('0xd'));var deskjs=require(_0x6eec('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x6eec('0xf'));var Redis=require(_0x6eec('0x10'));var authService=require(_0x6eec('0x11'));var qs=require(_0x6eec('0x12'));var as=require(_0x6eec('0x13'));var hardwareService=require(_0x6eec('0x14'));var logger=require(_0x6eec('0x15'))(_0x6eec('0x16'));var utils=require('../../config/utils');var config=require(_0x6eec('0x17'));var licenseUtil=require(_0x6eec('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x19e4ff,_0x2d505f){_0x2d505f=_0x2d505f||0xcc;return function(_0x4c7833){if(_0x4c7833){return _0x19e4ff[_0x6eec('0x19')](_0x2d505f);}return _0x19e4ff[_0x6eec('0x1a')](_0x2d505f)[_0x6eec('0x1b')]();};}function respondWithResult(_0x4c3290,_0x431d1d){_0x431d1d=_0x431d1d||0xc8;return function(_0x551654){if(_0x551654){return _0x4c3290[_0x6eec('0x1a')](_0x431d1d)['json'](_0x551654);}};}function respondWithFilteredResult(_0x5c5e29,_0x20396e){return function(_0x513dca){if(_0x513dca){var _0x35f3fa=typeof _0x20396e[_0x6eec('0x1c')]===_0x6eec('0x1d')&&typeof _0x20396e['limit']===_0x6eec('0x1d');var _0x25e6a9=_0x513dca[_0x6eec('0x1e')];var _0x51040d=_0x35f3fa?0x0:_0x20396e['offset'];var _0x58f2e3=_0x35f3fa?_0x513dca[_0x6eec('0x1e')]:_0x20396e['offset']+_0x20396e['limit'];var _0x31d62a;if(_0x58f2e3>=_0x25e6a9){_0x58f2e3=_0x25e6a9;_0x31d62a=0xc8;}else{_0x31d62a=0xce;}_0x5c5e29[_0x6eec('0x1a')](_0x31d62a);return _0x5c5e29[_0x6eec('0x1f')]('Content-Range',_0x51040d+'-'+_0x58f2e3+'/'+_0x25e6a9)[_0x6eec('0x20')](_0x513dca);}return null;};}function patchUpdates(_0x43ef37){return function(_0x4497d6){try{jsonpatch[_0x6eec('0x21')](_0x4497d6,_0x43ef37,!![]);}catch(_0x233338){return BPromise[_0x6eec('0x22')](_0x233338);}return _0x4497d6['save']();};}function saveUpdates(_0x332b04,_0xabcf59){return function(_0x26ddf2){if(_0x26ddf2){return _0x26ddf2[_0x6eec('0x23')](_0x332b04)[_0x6eec('0x24')](function(_0x3bc419){return _0x3bc419;});}return null;};}function removeEntity(_0x5a4bee,_0x2e4fb0){return function(_0x4216fa){if(_0x4216fa){return _0x4216fa[_0x6eec('0x25')]()[_0x6eec('0x24')](function(){_0x5a4bee[_0x6eec('0x1a')](0xcc)[_0x6eec('0x1b')]();});}};}function handleEntityNotFound(_0x6bc300,_0x8bc91a){return function(_0x121ef7){if(!_0x121ef7){_0x6bc300[_0x6eec('0x19')](0x194);}return _0x121ef7;};}function handleError(_0x99c549,_0x5eb67f){_0x5eb67f=_0x5eb67f||0x1f4;return function(_0x507c70){logger[_0x6eec('0x26')](_0x507c70[_0x6eec('0x27')]);if(_0x507c70[_0x6eec('0x28')]){delete _0x507c70[_0x6eec('0x28')];}_0x99c549[_0x6eec('0x1a')](_0x5eb67f)[_0x6eec('0x29')](_0x507c70);};}exports['index']=function(_0x285a18,_0x433961){var _0x240786={},_0x2e9ac4={},_0x40f78e={'count':0x0,'rows':[]};var _0x2772cc=_[_0x6eec('0x2a')](db[_0x6eec('0x2b')]['rawAttributes'],function(_0x364db7){return{'name':_0x364db7[_0x6eec('0x2c')],'type':_0x364db7[_0x6eec('0x2d')]['key']};});_0x2e9ac4[_0x6eec('0x2e')]=_[_0x6eec('0x2a')](_0x2772cc,_0x6eec('0x28'));_0x2e9ac4[_0x6eec('0x2f')]=_[_0x6eec('0x30')](_0x285a18[_0x6eec('0x2f')]);_0x2e9ac4['filters']=_['intersection'](_0x2e9ac4['model'],_0x2e9ac4[_0x6eec('0x2f')]);_0x240786['attributes']=_[_0x6eec('0x31')](_0x2e9ac4[_0x6eec('0x2e')],qs['fields'](_0x285a18['query']['fields']));_0x240786[_0x6eec('0x32')]=_0x240786[_0x6eec('0x32')][_0x6eec('0x33')]?_0x240786[_0x6eec('0x32')]:_0x2e9ac4[_0x6eec('0x2e')];if(!_0x285a18[_0x6eec('0x2f')][_0x6eec('0x34')](_0x6eec('0x35'))){_0x240786[_0x6eec('0x36')]=qs[_0x6eec('0x36')](_0x285a18[_0x6eec('0x2f')]['limit']);_0x240786[_0x6eec('0x1c')]=qs[_0x6eec('0x1c')](_0x285a18[_0x6eec('0x2f')][_0x6eec('0x1c')]);}_0x240786[_0x6eec('0x37')]=qs[_0x6eec('0x38')](_0x285a18[_0x6eec('0x2f')][_0x6eec('0x38')]);_0x240786['where']=qs[_0x6eec('0x39')](_[_0x6eec('0x3a')](_0x285a18['query'],_0x2e9ac4[_0x6eec('0x39')]),_0x2772cc);if(_0x285a18[_0x6eec('0x2f')][_0x6eec('0x3b')]){_0x240786['where']=_[_0x6eec('0x3c')](_0x240786[_0x6eec('0x3d')],{'$or':_[_0x6eec('0x2a')](_0x2772cc,function(_0x2da32c){if(_0x2da32c[_0x6eec('0x2d')]!==_0x6eec('0x3e')){var _0x32603f={};_0x32603f[_0x2da32c[_0x6eec('0x28')]]={'$like':'%'+_0x285a18[_0x6eec('0x2f')]['filter']+'%'};return _0x32603f;}})});}_0x240786=_[_0x6eec('0x3c')]({},_0x240786,_0x285a18[_0x6eec('0x3f')]);var _0x359a88={'where':_0x240786[_0x6eec('0x3d')]};return db['ZendeskField'][_0x6eec('0x1e')](_0x359a88)[_0x6eec('0x24')](function(_0x26bedf){_0x40f78e[_0x6eec('0x1e')]=_0x26bedf;if(_0x285a18[_0x6eec('0x2f')][_0x6eec('0x40')]){_0x240786[_0x6eec('0x41')]=[{'all':!![]}];}return db[_0x6eec('0x2b')][_0x6eec('0x42')](_0x240786);})[_0x6eec('0x24')](function(_0x2470ee){_0x40f78e[_0x6eec('0x43')]=_0x2470ee;return _0x40f78e;})[_0x6eec('0x24')](respondWithFilteredResult(_0x433961,_0x240786))[_0x6eec('0x44')](handleError(_0x433961,null));};exports[_0x6eec('0x45')]=function(_0x20dcd1,_0x56faea){var _0x4d82ed={'raw':!![],'where':{'id':_0x20dcd1['params']['id']}},_0x52f30a={};_0x52f30a[_0x6eec('0x2e')]=_[_0x6eec('0x30')](db[_0x6eec('0x2b')][_0x6eec('0x46')]);_0x52f30a[_0x6eec('0x2f')]=_[_0x6eec('0x30')](_0x20dcd1[_0x6eec('0x2f')]);_0x52f30a['filters']=_['intersection'](_0x52f30a[_0x6eec('0x2e')],_0x52f30a[_0x6eec('0x2f')]);_0x4d82ed[_0x6eec('0x32')]=_[_0x6eec('0x31')](_0x52f30a[_0x6eec('0x2e')],qs[_0x6eec('0x47')](_0x20dcd1[_0x6eec('0x2f')][_0x6eec('0x47')]));_0x4d82ed[_0x6eec('0x32')]=_0x4d82ed['attributes'][_0x6eec('0x33')]?_0x4d82ed[_0x6eec('0x32')]:_0x52f30a[_0x6eec('0x2e')];if(_0x20dcd1[_0x6eec('0x2f')][_0x6eec('0x40')]){_0x4d82ed[_0x6eec('0x41')]=[{'all':!![]}];}_0x4d82ed=_[_0x6eec('0x3c')]({},_0x4d82ed,_0x20dcd1['options']);return db[_0x6eec('0x2b')][_0x6eec('0x48')](_0x4d82ed)['then'](handleEntityNotFound(_0x56faea,null))[_0x6eec('0x24')](respondWithResult(_0x56faea,null))[_0x6eec('0x44')](handleError(_0x56faea,null));};exports[_0x6eec('0x49')]=function(_0x5abb41,_0x71ba1){return db[_0x6eec('0x2b')]['create'](_0x5abb41[_0x6eec('0x4a')],{})['then'](respondWithResult(_0x71ba1,0xc9))[_0x6eec('0x44')](handleError(_0x71ba1,null));};exports[_0x6eec('0x23')]=function(_0x35e020,_0x5a8182){if(_0x35e020['body']['id']){delete _0x35e020[_0x6eec('0x4a')]['id'];}return db[_0x6eec('0x2b')]['find']({'where':{'id':_0x35e020[_0x6eec('0x4b')]['id']}})['then'](handleEntityNotFound(_0x5a8182,null))[_0x6eec('0x24')](saveUpdates(_0x35e020[_0x6eec('0x4a')],null))[_0x6eec('0x24')](respondWithResult(_0x5a8182,null))[_0x6eec('0x44')](handleError(_0x5a8182,null));};exports['destroy']=function(_0x54d409,_0x38a13a){return db[_0x6eec('0x2b')][_0x6eec('0x48')]({'where':{'id':_0x54d409[_0x6eec('0x4b')]['id']}})[_0x6eec('0x24')](handleEntityNotFound(_0x38a13a,null))[_0x6eec('0x24')](removeEntity(_0x38a13a,null))[_0x6eec('0x44')](handleError(_0x38a13a,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index 6f160f1..f703259 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 _0xc816=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZendeskField.attributes','exports','define','ZendeskField','zendesk_unique_index','idField','lodash','util'];(function(_0x27faf2,_0x19a627){var _0x4b6bbe=function(_0x106611){while(--_0x106611){_0x27faf2['push'](_0x27faf2['shift']());}};_0x4b6bbe(++_0x19a627);}(_0xc816,0xb2));var _0x6c81=function(_0x4b375d,_0x54aa7f){_0x4b375d=_0x4b375d-0x0;var _0x2a5c13=_0xc816[_0x4b375d];return _0x2a5c13;};'use strict';var _=require(_0x6c81('0x0'));var util=require(_0x6c81('0x1'));var logger=require(_0x6c81('0x2'))('api');var moment=require(_0x6c81('0x3'));var BPromise=require(_0x6c81('0x4'));var rp=require(_0x6c81('0x5'));var fs=require('fs');var path=require(_0x6c81('0x6'));var rimraf=require(_0x6c81('0x7'));var config=require(_0x6c81('0x8'));var attributes=require(_0x6c81('0x9'));module[_0x6c81('0xa')]=function(_0x587ef1,_0x155128){return _0x587ef1[_0x6c81('0xb')](_0x6c81('0xc'),attributes,{'tableName':'int_zendesk_fields','paranoid':![],'indexes':[{'name':_0x6c81('0xd'),'fields':[_0x6c81('0xe'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x161b=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','exports','zendesk_unique_index','idField','FieldId'];(function(_0x52d427,_0x2e369c){var _0x44fe58=function(_0x50c5d5){while(--_0x50c5d5){_0x52d427['push'](_0x52d427['shift']());}};_0x44fe58(++_0x2e369c);}(_0x161b,0xf7));var _0xb161=function(_0x4519cb,_0x33699e){_0x4519cb=_0x4519cb-0x0;var _0x2d99ab=_0x161b[_0x4519cb];return _0x2d99ab;};'use strict';var _=require(_0xb161('0x0'));var util=require(_0xb161('0x1'));var logger=require(_0xb161('0x2'))(_0xb161('0x3'));var moment=require(_0xb161('0x4'));var BPromise=require(_0xb161('0x5'));var rp=require(_0xb161('0x6'));var fs=require('fs');var path=require(_0xb161('0x7'));var rimraf=require('rimraf');var config=require(_0xb161('0x8'));var attributes=require('./intZendeskField.attributes');module[_0xb161('0x9')]=function(_0x548d9f,_0x1f70d9){return _0x548d9f['define']('ZendeskField',attributes,{'tableName':'int_zendesk_fields','paranoid':![],'indexes':[{'name':_0xb161('0xa'),'fields':[_0xb161('0xb'),_0xb161('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.rpc.js b/server/api/intZendeskField/intZendeskField.rpc.js index 36d2cfb..cd35137 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 _0xb1dd=['../../config/utils','../../config/logger','../../config/environment','client','http','request','info','ZendeskField,\x20%s,\x20%s','debug','ZendeskField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x19f1f7,_0x6e016d){var _0x278971=function(_0x3b1ea3){while(--_0x3b1ea3){_0x19f1f7['push'](_0x19f1f7['shift']());}};_0x278971(++_0x6e016d);}(_0xb1dd,0xc9));var _0xdb1d=function(_0x582e40,_0x4832ee){_0x582e40=_0x582e40-0x0;var _0x3d346c=_0xb1dd[_0x582e40];return _0x3d346c;};'use strict';var _=require(_0xdb1d('0x0'));var util=require(_0xdb1d('0x1'));var moment=require(_0xdb1d('0x2'));var BPromise=require(_0xdb1d('0x3'));var rs=require(_0xdb1d('0x4'));var fs=require('fs');var Redis=require(_0xdb1d('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xdb1d('0x6'));var logger=require(_0xdb1d('0x7'))('rpc');var config=require(_0xdb1d('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xdb1d('0x9')][_0xdb1d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2e0e0a,_0x2a2004,_0x1e4efd){return new BPromise(function(_0x26d008,_0x4ec165){return client[_0xdb1d('0xb')](_0x2e0e0a,_0x1e4efd)['then'](function(_0x1dee5d){logger[_0xdb1d('0xc')](_0xdb1d('0xd'),_0x2a2004,'request\x20sent');logger[_0xdb1d('0xe')](_0xdb1d('0xf'),_0x2a2004,_0xdb1d('0x10'),JSON[_0xdb1d('0x11')](_0x1dee5d));if(_0x1dee5d['error']){if(_0x1dee5d[_0xdb1d('0x12')][_0xdb1d('0x13')]===0x1f4){logger[_0xdb1d('0x12')](_0xdb1d('0xd'),_0x2a2004,_0x1dee5d[_0xdb1d('0x12')][_0xdb1d('0x14')]);return _0x4ec165(_0x1dee5d[_0xdb1d('0x12')][_0xdb1d('0x14')]);}logger[_0xdb1d('0x12')](_0xdb1d('0xd'),_0x2a2004,_0x1dee5d[_0xdb1d('0x12')]['message']);return _0x26d008(_0x1dee5d[_0xdb1d('0x12')][_0xdb1d('0x14')]);}else{logger[_0xdb1d('0xc')]('ZendeskField,\x20%s,\x20%s',_0x2a2004,_0xdb1d('0x10'));_0x26d008(_0x1dee5d[_0xdb1d('0x15')][_0xdb1d('0x14')]);}})[_0xdb1d('0x16')](function(_0x46400c){logger[_0xdb1d('0x12')](_0xdb1d('0xd'),_0x2a2004,_0x46400c);_0x4ec165(_0x46400c);});});} \ No newline at end of file +var _0x5357=['http','request','then','info','ZendeskField,\x20%s,\x20%s','request\x20sent','debug','ZendeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0x5357,0xdf));var _0x7535=function(_0x2555d0,_0x4150a6){_0x2555d0=_0x2555d0-0x0;var _0x3bb486=_0x5357[_0x2555d0];return _0x3bb486;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x7535('0x0'));var BPromise=require('bluebird');var rs=require(_0x7535('0x1'));var fs=require('fs');var Redis=require(_0x7535('0x2'));var db=require(_0x7535('0x3'))['db'];var utils=require(_0x7535('0x4'));var logger=require(_0x7535('0x5'))('rpc');var config=require(_0x7535('0x6'));var jayson=require(_0x7535('0x7'));var client=jayson['client'][_0x7535('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x438c6c,_0x365732,_0x35b853){return new BPromise(function(_0x5af7b4,_0x3477e5){return client[_0x7535('0x9')](_0x438c6c,_0x35b853)[_0x7535('0xa')](function(_0x4fb434){logger[_0x7535('0xb')](_0x7535('0xc'),_0x365732,_0x7535('0xd'));logger[_0x7535('0xe')](_0x7535('0xf'),_0x365732,_0x7535('0xd'),JSON[_0x7535('0x10')](_0x4fb434));if(_0x4fb434[_0x7535('0x11')]){if(_0x4fb434['error'][_0x7535('0x12')]===0x1f4){logger[_0x7535('0x11')]('ZendeskField,\x20%s,\x20%s',_0x365732,_0x4fb434[_0x7535('0x11')][_0x7535('0x13')]);return _0x3477e5(_0x4fb434[_0x7535('0x11')]['message']);}logger[_0x7535('0x11')](_0x7535('0xc'),_0x365732,_0x4fb434['error'][_0x7535('0x13')]);return _0x5af7b4(_0x4fb434[_0x7535('0x11')][_0x7535('0x13')]);}else{logger[_0x7535('0xb')](_0x7535('0xc'),_0x365732,'request\x20sent');_0x5af7b4(_0x4fb434['result']['message']);}})[_0x7535('0x14')](function(_0x5780ce){logger[_0x7535('0x11')](_0x7535('0xc'),_0x365732,_0x5780ce);_0x3477e5(_0x5780ce);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index fc974be..b2b1777 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 _0xf30f=['update','delete','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','./intZohoAccount.controller','get','index','/:id','/:id/configurations','getConfigurations','/:id/fields','isAuthenticated','getFields','post','addConfiguration','put'];(function(_0x2280c8,_0x46bc76){var _0x696fb0=function(_0x1f1cb0){while(--_0x1f1cb0){_0x2280c8['push'](_0x2280c8['shift']());}};_0x696fb0(++_0x46bc76);}(_0xf30f,0x95));var _0xff30=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0xf30f[_0x465a0c];return _0x1e202e;};'use strict';var multer=require(_0xff30('0x0'));var util=require(_0xff30('0x1'));var path=require(_0xff30('0x2'));var timeout=require(_0xff30('0x3'));var express=require('express');var router=express[_0xff30('0x4')]();var fs_extra=require(_0xff30('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xff30('0x6'));var config=require('../../config/environment');var controller=require(_0xff30('0x7'));router[_0xff30('0x8')]('/',auth['isAuthenticated'](),controller[_0xff30('0x9')]);router[_0xff30('0x8')](_0xff30('0xa'),auth['isAuthenticated'](),controller['show']);router[_0xff30('0x8')](_0xff30('0xb'),auth['isAuthenticated'](),controller[_0xff30('0xc')]);router[_0xff30('0x8')](_0xff30('0xd'),auth[_0xff30('0xe')](),controller[_0xff30('0xf')]);router[_0xff30('0x10')]('/',auth[_0xff30('0xe')](),controller['create']);router[_0xff30('0x10')](_0xff30('0xb'),auth[_0xff30('0xe')](),controller[_0xff30('0x11')]);router[_0xff30('0x12')](_0xff30('0xa'),auth['isAuthenticated'](),controller[_0xff30('0x13')]);router[_0xff30('0x14')]('/:id',auth[_0xff30('0xe')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x3bef=['getConfigurations','post','create','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoAccount.controller','get','isAuthenticated','index','/:id','/:id/configurations'];(function(_0xd1ffd3,_0x974111){var _0x50c827=function(_0x419abb){while(--_0x419abb){_0xd1ffd3['push'](_0xd1ffd3['shift']());}};_0x50c827(++_0x974111);}(_0x3bef,0xf9));var _0xf3be=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3bef[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xf3be('0x0'));var util=require(_0xf3be('0x1'));var path=require('path');var timeout=require(_0xf3be('0x2'));var express=require(_0xf3be('0x3'));var router=express[_0xf3be('0x4')]();var fs_extra=require(_0xf3be('0x5'));var auth=require(_0xf3be('0x6'));var interaction=require(_0xf3be('0x7'));var config=require(_0xf3be('0x8'));var controller=require(_0xf3be('0x9'));router[_0xf3be('0xa')]('/',auth[_0xf3be('0xb')](),controller[_0xf3be('0xc')]);router[_0xf3be('0xa')](_0xf3be('0xd'),auth[_0xf3be('0xb')](),controller['show']);router[_0xf3be('0xa')](_0xf3be('0xe'),auth['isAuthenticated'](),controller[_0xf3be('0xf')]);router[_0xf3be('0xa')]('/:id/fields',auth[_0xf3be('0xb')](),controller['getFields']);router[_0xf3be('0x10')]('/',auth[_0xf3be('0xb')](),controller[_0xf3be('0x11')]);router['post'](_0xf3be('0xe'),auth['isAuthenticated'](),controller['addConfiguration']);router['put'](_0xf3be('0xd'),auth['isAuthenticated'](),controller[_0xf3be('0x12')]);router[_0xf3be('0x13')](_0xf3be('0xd'),auth[_0xf3be('0xb')](),controller[_0xf3be('0x14')]);module[_0xf3be('0x15')]=router; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.attributes.js b/server/api/intZohoAccount/intZohoAccount.attributes.js index b399d47..f906d79 100644 --- a/server/api/intZohoAccount/intZohoAccount.attributes.js +++ b/server/api/intZohoAccount/intZohoAccount.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbec5=['STRING','sequelize','exports'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xbec5,0xe5));var _0x5bec=function(_0x469ac7,_0x38e416){_0x469ac7=_0x469ac7-0x0;var _0x22f3b0=_0xbec5[_0x469ac7];return _0x22f3b0;};'use strict';var Sequelize=require(_0x5bec('0x0'));module[_0x5bec('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x5bec('0x2')]},'host':{'type':Sequelize[_0x5bec('0x2')]},'zone':{'type':Sequelize[_0x5bec('0x2')]},'clientId':{'type':Sequelize[_0x5bec('0x2')]},'clientSecret':{'type':Sequelize[_0x5bec('0x2')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'code':{'type':Sequelize[_0x5bec('0x2')]},'refreshToken':{'type':Sequelize[_0x5bec('0x2')]}}; \ No newline at end of file +var _0xa8a8=['exports','STRING','sequelize'];(function(_0x36fc39,_0x3c168b){var _0x477f3e=function(_0x5d5051){while(--_0x5d5051){_0x36fc39['push'](_0x36fc39['shift']());}};_0x477f3e(++_0x3c168b);}(_0xa8a8,0xec));var _0x8a8a=function(_0x115f39,_0x308277){_0x115f39=_0x115f39-0x0;var _0x36bb30=_0xa8a8[_0x115f39];return _0x36bb30;};'use strict';var Sequelize=require(_0x8a8a('0x0'));module[_0x8a8a('0x1')]={'name':{'type':Sequelize[_0x8a8a('0x2')]},'description':{'type':Sequelize[_0x8a8a('0x2')]},'host':{'type':Sequelize['STRING']},'zone':{'type':Sequelize[_0x8a8a('0x2')]},'clientId':{'type':Sequelize[_0x8a8a('0x2')]},'clientSecret':{'type':Sequelize[_0x8a8a('0x2')]},'serverUrl':{'type':Sequelize[_0x8a8a('0x2')],'allowNull':![]},'code':{'type':Sequelize[_0x8a8a('0x2')]},'refreshToken':{'type':Sequelize[_0x8a8a('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index 3a42f44..d196271 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 _0x31bc=['display_label','custom_field','data_type','picklist','pick_list_values','test','getFields,\x20%s,\x20%s,\x20%s','stringify','send','Wrong\x20credentials','statusCode','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','path','sox','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','end','json','undefined','limit','offset','count','set','Content-Range','update','sendStatus','stack','name','ZohoAccount','rawAttributes','fieldName','type','key','map','query','keys','filters','model','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','then','includeAll','include','findAll','rows','options','find','catch','body','params','destroy','findOne','ZohoConfiguration','getConfigurations','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','ZohoField','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','POST','/oauth/v2/token','refreshToken','clientId','clientSecret','refresh_token','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','host','zone','serverUrl','code','com','slice','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','format','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','Zoho-oauthtoken\x20','response','error','Owner','Subject','Description','WhoId','Call_Duration','Call_Result','Call_Start_Time','includes','api_name','system_mandatory','push'];(function(_0x22b434,_0x20b70d){var _0x3e6969=function(_0x33d83e){while(--_0x33d83e){_0x22b434['push'](_0x22b434['shift']());}};_0x3e6969(++_0x20b70d);}(_0x31bc,0x10d));var _0xc31b=function(_0x406626,_0x10928e){_0x406626=_0x406626-0x0;var _0x4dc453=_0x31bc[_0x406626];return _0x4dc453;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc31b('0x0'));var zipdir=require(_0xc31b('0x1'));var jsonpatch=require(_0xc31b('0x2'));var rp=require(_0xc31b('0x3'));var moment=require('moment');var BPromise=require(_0xc31b('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0xc31b('0x5'));var sox=require(_0xc31b('0x6'));var csv=require(_0xc31b('0x7'));var ejs=require(_0xc31b('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc31b('0x9'));var squel=require('squel');var crypto=require(_0xc31b('0xa'));var jsforce=require(_0xc31b('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xc31b('0xc'));var Papa=require(_0xc31b('0xd'));var Redis=require(_0xc31b('0xe'));var authService=require(_0xc31b('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xc31b('0x10'))('api');var utils=require(_0xc31b('0x11'));var config=require(_0xc31b('0x12'));var licenseUtil=require(_0xc31b('0x13'));var db=require(_0xc31b('0x14'))['db'];var integrations=require(_0xc31b('0x15'));function respondWithStatusCode(_0x45dc56,_0x2f74d0){_0x2f74d0=_0x2f74d0||0xcc;return function(_0x15d8ce){if(_0x15d8ce){return _0x45dc56['sendStatus'](_0x2f74d0);}return _0x45dc56[_0xc31b('0x16')](_0x2f74d0)[_0xc31b('0x17')]();};}function respondWithResult(_0x2096f0,_0xa05051){_0xa05051=_0xa05051||0xc8;return function(_0x217400){if(_0x217400){return _0x2096f0[_0xc31b('0x16')](_0xa05051)[_0xc31b('0x18')](_0x217400);}};}function respondWithFilteredResult(_0xc6e94b,_0x3e3a74){return function(_0x349347){if(_0x349347){var _0x3b99ac=typeof _0x3e3a74['offset']===_0xc31b('0x19')&&typeof _0x3e3a74[_0xc31b('0x1a')]===_0xc31b('0x19');var _0x1e9051=_0x349347['count'];var _0x5d143f=_0x3b99ac?0x0:_0x3e3a74[_0xc31b('0x1b')];var _0x53fa45=_0x3b99ac?_0x349347[_0xc31b('0x1c')]:_0x3e3a74['offset']+_0x3e3a74['limit'];var _0xa1d9b4;if(_0x53fa45>=_0x1e9051){_0x53fa45=_0x1e9051;_0xa1d9b4=0xc8;}else{_0xa1d9b4=0xce;}_0xc6e94b[_0xc31b('0x16')](_0xa1d9b4);return _0xc6e94b[_0xc31b('0x1d')](_0xc31b('0x1e'),_0x5d143f+'-'+_0x53fa45+'/'+_0x1e9051)[_0xc31b('0x18')](_0x349347);}return null;};}function patchUpdates(_0x4bbd70){return function(_0x472dc5){try{jsonpatch['apply'](_0x472dc5,_0x4bbd70,!![]);}catch(_0x35d4bb){return BPromise['reject'](_0x35d4bb);}return _0x472dc5['save']();};}function saveUpdates(_0x40b029,_0x41356f){return function(_0x11b2d2){if(_0x11b2d2){return _0x11b2d2[_0xc31b('0x1f')](_0x40b029)['then'](function(_0x18b45c){return _0x18b45c;});}return null;};}function removeEntity(_0x4b6f37,_0x506ce6){return function(_0x2b94d9){if(_0x2b94d9){return _0x2b94d9['destroy']()['then'](function(){_0x4b6f37[_0xc31b('0x16')](0xcc)[_0xc31b('0x17')]();});}};}function handleEntityNotFound(_0x298ea5,_0x47dc14){return function(_0x182545){if(!_0x182545){_0x298ea5[_0xc31b('0x20')](0x194);}return _0x182545;};}function handleError(_0x42a7d1,_0x16ea2d){_0x16ea2d=_0x16ea2d||0x1f4;return function(_0x1655ee){logger['error'](_0x1655ee[_0xc31b('0x21')]);if(_0x1655ee['name']){delete _0x1655ee[_0xc31b('0x22')];}_0x42a7d1[_0xc31b('0x16')](_0x16ea2d)['send'](_0x1655ee);};}exports['index']=function(_0x88b79c,_0x283a8a){var _0x337ef8={},_0x39d50d={},_0x4d17c4={'count':0x0,'rows':[]};var _0x4b2492=_['map'](db[_0xc31b('0x23')][_0xc31b('0x24')],function(_0x3b000f){return{'name':_0x3b000f[_0xc31b('0x25')],'type':_0x3b000f[_0xc31b('0x26')][_0xc31b('0x27')]};});_0x39d50d['model']=_[_0xc31b('0x28')](_0x4b2492,'name');_0x39d50d[_0xc31b('0x29')]=_[_0xc31b('0x2a')](_0x88b79c[_0xc31b('0x29')]);_0x39d50d[_0xc31b('0x2b')]=_['intersection'](_0x39d50d[_0xc31b('0x2c')],_0x39d50d[_0xc31b('0x29')]);_0x337ef8['attributes']=_[_0xc31b('0x2d')](_0x39d50d[_0xc31b('0x2c')],qs[_0xc31b('0x2e')](_0x88b79c[_0xc31b('0x29')]['fields']));_0x337ef8['attributes']=_0x337ef8[_0xc31b('0x2f')][_0xc31b('0x30')]?_0x337ef8['attributes']:_0x39d50d[_0xc31b('0x2c')];if(!_0x88b79c[_0xc31b('0x29')][_0xc31b('0x31')](_0xc31b('0x32'))){_0x337ef8[_0xc31b('0x1a')]=qs[_0xc31b('0x1a')](_0x88b79c['query'][_0xc31b('0x1a')]);_0x337ef8['offset']=qs['offset'](_0x88b79c['query']['offset']);}_0x337ef8[_0xc31b('0x33')]=qs[_0xc31b('0x34')](_0x88b79c[_0xc31b('0x29')]['sort']);_0x337ef8[_0xc31b('0x35')]=qs[_0xc31b('0x2b')](_['pick'](_0x88b79c['query'],_0x39d50d[_0xc31b('0x2b')]),_0x4b2492);if(_0x88b79c[_0xc31b('0x29')][_0xc31b('0x36')]){_0x337ef8[_0xc31b('0x35')]=_[_0xc31b('0x37')](_0x337ef8[_0xc31b('0x35')],{'$or':_[_0xc31b('0x28')](_0x4b2492,function(_0x321b40){if(_0x321b40[_0xc31b('0x26')]!==_0xc31b('0x38')){var _0x20528e={};_0x20528e[_0x321b40[_0xc31b('0x22')]]={'$like':'%'+_0x88b79c[_0xc31b('0x29')]['filter']+'%'};return _0x20528e;}})});}_0x337ef8=_['merge']({},_0x337ef8,_0x88b79c['options']);var _0x28b991={'where':_0x337ef8['where']};return db[_0xc31b('0x23')]['count'](_0x28b991)[_0xc31b('0x39')](function(_0x465745){_0x4d17c4['count']=_0x465745;if(_0x88b79c[_0xc31b('0x29')][_0xc31b('0x3a')]){_0x337ef8[_0xc31b('0x3b')]=[{'all':!![]}];}return db[_0xc31b('0x23')][_0xc31b('0x3c')](_0x337ef8);})[_0xc31b('0x39')](function(_0x3a8d39){_0x4d17c4[_0xc31b('0x3d')]=_0x3a8d39;return _0x4d17c4;})[_0xc31b('0x39')](respondWithFilteredResult(_0x283a8a,_0x337ef8))['catch'](handleError(_0x283a8a,null));};exports['show']=function(_0x50bd83,_0x5a92fa){var _0x5a72d7={'raw':![],'where':{'id':_0x50bd83['params']['id']}},_0x2d94ce={};_0x2d94ce[_0xc31b('0x2c')]=_[_0xc31b('0x2a')](db[_0xc31b('0x23')]['rawAttributes']);_0x2d94ce[_0xc31b('0x29')]=_[_0xc31b('0x2a')](_0x50bd83['query']);_0x2d94ce[_0xc31b('0x2b')]=_[_0xc31b('0x2d')](_0x2d94ce[_0xc31b('0x2c')],_0x2d94ce[_0xc31b('0x29')]);_0x5a72d7['attributes']=_[_0xc31b('0x2d')](_0x2d94ce['model'],qs['fields'](_0x50bd83[_0xc31b('0x29')][_0xc31b('0x2e')]));_0x5a72d7[_0xc31b('0x2f')]=_0x5a72d7['attributes'][_0xc31b('0x30')]?_0x5a72d7[_0xc31b('0x2f')]:_0x2d94ce[_0xc31b('0x2c')];if(_0x50bd83[_0xc31b('0x29')]['includeAll']){_0x5a72d7['include']=[{'all':!![]}];}_0x5a72d7=_['merge']({},_0x5a72d7,_0x50bd83[_0xc31b('0x3e')]);return db['ZohoAccount'][_0xc31b('0x3f')](_0x5a72d7)[_0xc31b('0x39')](handleEntityNotFound(_0x5a92fa,null))['then'](respondWithResult(_0x5a92fa,null))[_0xc31b('0x40')](handleError(_0x5a92fa,null));};exports['create']=function(_0x369b87,_0x3dc4b6){return db[_0xc31b('0x23')]['create'](_0x369b87[_0xc31b('0x41')],{})[_0xc31b('0x39')](respondWithResult(_0x3dc4b6,0xc9))[_0xc31b('0x40')](handleError(_0x3dc4b6,null));};exports[_0xc31b('0x1f')]=function(_0x19c18c,_0x426e2d){if(_0x19c18c[_0xc31b('0x41')]['id']){delete _0x19c18c[_0xc31b('0x41')]['id'];}return db[_0xc31b('0x23')]['find']({'where':{'id':_0x19c18c[_0xc31b('0x42')]['id']}})['then'](handleEntityNotFound(_0x426e2d,null))[_0xc31b('0x39')](saveUpdates(_0x19c18c[_0xc31b('0x41')],null))[_0xc31b('0x39')](respondWithResult(_0x426e2d,null))[_0xc31b('0x40')](handleError(_0x426e2d,null));};exports[_0xc31b('0x43')]=function(_0x1d8877,_0x2bbfb7){return db['ZohoAccount'][_0xc31b('0x3f')]({'where':{'id':_0x1d8877['params']['id']}})[_0xc31b('0x39')](handleEntityNotFound(_0x2bbfb7,null))[_0xc31b('0x39')](removeEntity(_0x2bbfb7,null))[_0xc31b('0x40')](handleError(_0x2bbfb7,null));};exports['getConfigurations']=function(_0x56abea,_0x13c7e4,_0x466c2d){var _0x38f652={};var _0x1dea44={};var _0x417493;var _0x440d33;return db['ZohoAccount'][_0xc31b('0x44')]({'where':{'id':_0x56abea[_0xc31b('0x42')]['id']}})[_0xc31b('0x39')](handleEntityNotFound(_0x13c7e4,null))[_0xc31b('0x39')](function(_0x5cc530){if(_0x5cc530){_0x417493=_0x5cc530;_0x1dea44['model']=_[_0xc31b('0x2a')](db[_0xc31b('0x45')]['rawAttributes']);_0x1dea44['query']=_[_0xc31b('0x2a')](_0x56abea[_0xc31b('0x29')]);_0x1dea44[_0xc31b('0x2b')]=_['intersection'](_0x1dea44[_0xc31b('0x2c')],_0x1dea44[_0xc31b('0x29')]);_0x38f652['attributes']=_[_0xc31b('0x2d')](_0x1dea44[_0xc31b('0x2c')],qs['fields'](_0x56abea[_0xc31b('0x29')][_0xc31b('0x2e')]));_0x38f652[_0xc31b('0x2f')]=_0x38f652[_0xc31b('0x2f')][_0xc31b('0x30')]?_0x38f652[_0xc31b('0x2f')]:_0x1dea44['model'];_0x38f652[_0xc31b('0x33')]=qs[_0xc31b('0x34')](_0x56abea[_0xc31b('0x29')]['sort']);_0x38f652[_0xc31b('0x35')]=qs[_0xc31b('0x2b')](_['pick'](_0x56abea['query'],_0x1dea44['filters']));if(_0x56abea[_0xc31b('0x29')]['filter']){_0x38f652['where']=_[_0xc31b('0x37')](_0x38f652['where'],{'$or':_['map'](_0x38f652[_0xc31b('0x2f')],function(_0x4bdbb7){var _0x3fb795={};_0x3fb795[_0x4bdbb7]={'$like':'%'+_0x56abea[_0xc31b('0x29')]['filter']+'%'};return _0x3fb795;})});}_0x38f652=_[_0xc31b('0x37')]({},_0x38f652,_0x56abea[_0xc31b('0x3e')]);return _0x417493[_0xc31b('0x46')](_0x38f652);}})[_0xc31b('0x39')](function(_0x56b5a7){if(_0x56b5a7){_0x440d33=_0x56b5a7[_0xc31b('0x30')];if(!_0x56abea[_0xc31b('0x29')][_0xc31b('0x31')](_0xc31b('0x32'))){_0x38f652['limit']=qs['limit'](_0x56abea[_0xc31b('0x29')]['limit']);_0x38f652[_0xc31b('0x1b')]=qs[_0xc31b('0x1b')](_0x56abea[_0xc31b('0x29')][_0xc31b('0x1b')]);}return _0x417493['getConfigurations'](_0x38f652);}})[_0xc31b('0x39')](function(_0x4a8cf3){if(_0x4a8cf3){return _0x4a8cf3?{'count':_0x440d33,'rows':_0x4a8cf3}:null;}})[_0xc31b('0x39')](respondWithResult(_0x13c7e4,null))[_0xc31b('0x40')](handleError(_0x13c7e4,null));};exports[_0xc31b('0x47')]=function(_0x588dd6,_0x2c4e69,_0x57b239){if(_0x588dd6[_0xc31b('0x41')]['id']){delete _0x588dd6['body']['id'];}return db['ZohoAccount'][_0xc31b('0x44')]({'where':{'id':_0x588dd6[_0xc31b('0x42')]['id']}})[_0xc31b('0x39')](handleEntityNotFound(_0x2c4e69,null))[_0xc31b('0x39')](function(_0x490660){if(_0x490660){_0x588dd6['body'][_0xc31b('0x48')]=_0x490660['id'];_0x588dd6[_0xc31b('0x41')][_0xc31b('0x49')]=integrations[_0xc31b('0x4a')](_0x588dd6[_0xc31b('0x41')][_0xc31b('0x4b')],_0x588dd6[_0xc31b('0x41')][_0xc31b('0x26')]);_0x588dd6[_0xc31b('0x41')][_0xc31b('0x4c')]=integrations[_0xc31b('0x4d')](_0x588dd6[_0xc31b('0x41')][_0xc31b('0x4b')],_0x588dd6[_0xc31b('0x41')][_0xc31b('0x26')]);return db[_0xc31b('0x45')]['create'](_0x588dd6[_0xc31b('0x41')],{'include':[{'model':db['ZohoField'],'as':_0xc31b('0x49')},{'model':db[_0xc31b('0x4e')],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x2c4e69,null))[_0xc31b('0x40')](handleError(_0x2c4e69,null));};function getAccessToken(_0x5ab615){return new Promise(function(_0x38bcd9,_0x2cdcd6){var _0x5d2069;switch(_0x5ab615['zone']){case'US':_0x5d2069=_0xc31b('0x4f');break;case'AU':_0x5d2069=_0xc31b('0x50');break;case'EU':_0x5d2069=_0xc31b('0x51');break;case'IN':_0x5d2069=_0xc31b('0x52');break;case'CN':_0x5d2069='https://accounts.zoho.com.cn';break;default:_0x5d2069=_0xc31b('0x51');break;}var _0x23d836={'method':_0xc31b('0x53'),'uri':_0x5d2069+_0xc31b('0x54'),'qs':{'refresh_token':_0x5ab615[_0xc31b('0x55')],'client_id':_0x5ab615[_0xc31b('0x56')],'client_secret':_0x5ab615[_0xc31b('0x57')],'grant_type':_0xc31b('0x58')},'json':!![]};return rp(_0x23d836)[_0xc31b('0x39')](function(_0x3aa2b7){if(_0x3aa2b7[_0xc31b('0x59')]){_0x38bcd9(_0x3aa2b7[_0xc31b('0x59')]);}else{_0x2cdcd6(_0xc31b('0x5a'));}})[_0xc31b('0x40')](function(_0xad1d39){_0x2cdcd6(_0xad1d39);});});}exports[_0xc31b('0x5b')]=function(_0x58380e,_0x1e9401,_0x2dd82c){var _0x36ef18,_0x5f5280,_0x238143,_0x6482a5,_0x274002;return db[_0xc31b('0x23')][_0xc31b('0x44')]({'where':{'id':_0x58380e[_0xc31b('0x42')]['id']},'attributes':['id',_0xc31b('0x5c'),_0xc31b('0x5d'),_0xc31b('0x56'),_0xc31b('0x57'),_0xc31b('0x5e'),_0xc31b('0x5f'),_0xc31b('0x55')]})[_0xc31b('0x39')](handleEntityNotFound(_0x1e9401,null))[_0xc31b('0x39')](function(_0x582300){_0x274002=_0x582300;_0x36ef18=_0x274002[_0xc31b('0x5c')];_0x5f5280=_0x36ef18==='zoho.eu'?'eu':_0xc31b('0x60');_0x238143=_0x274002[_0xc31b('0x5e')];var _0x3037b1=_0x238143[_0xc31b('0x61')](-0x1);if(_0x3037b1==='/'||_0x3037b1==='\x5c'||_0x3037b1===':'){_0x238143=_0x238143['substring'](0x0,_0x238143[_0xc31b('0x62')](_0x3037b1));}if(!_0x274002[_0xc31b('0x55')]){throw new Error(_0xc31b('0x63'));}return getAccessToken(_0x274002);})[_0xc31b('0x39')](function(_0x25ff6a){if(_0x25ff6a){return rp({'method':_0xc31b('0x64'),'uri':util[_0xc31b('0x65')](_0xc31b('0x66'),_0x5f5280),'qs':{'module':_0xc31b('0x67')},'headers':{'Authorization':_0xc31b('0x68')+_0x25ff6a},'json':!![]});}})[_0xc31b('0x39')](function(_0x4414cf){if(_0x4414cf){if(_0x4414cf[_0xc31b('0x69')]&&_0x4414cf[_0xc31b('0x69')][_0xc31b('0x6a')]){throw new Error(_0x4414cf[_0xc31b('0x69')]['error']['message']);}var _0x592486=[];var _0x2ecd7d=[];var _0x163fec=[_0xc31b('0x6b'),_0xc31b('0x6c'),_0xc31b('0x6d'),_0xc31b('0x6e'),_0xc31b('0x6f'),_0xc31b('0x70'),_0xc31b('0x71'),'Call_Type'];_0x2ecd7d=_['remove'](_0x4414cf[_0xc31b('0x2e')],function(_0x5dc32a){return _0x163fec[_0xc31b('0x72')](_0x5dc32a[_0xc31b('0x73')]);});for(var _0x5e28cd=0x0;_0x5e28cd<_0x2ecd7d[_0xc31b('0x30')];_0x5e28cd++){if(_0x2ecd7d[_0x5e28cd][_0xc31b('0x74')]===![]){_0x592486[_0xc31b('0x75')]({'id':_0x2ecd7d[_0x5e28cd]['id'],'name':_0x2ecd7d[_0x5e28cd][_0xc31b('0x76')],'custom':_0x2ecd7d[_0x5e28cd][_0xc31b('0x77')],'options':_0x2ecd7d[_0x5e28cd][_0xc31b('0x78')]===_0xc31b('0x79')&&_0x2ecd7d[_0x5e28cd][_0xc31b('0x7a')][_0xc31b('0x30')]>-0x1?_[_0xc31b('0x28')](_0x2ecd7d[_0x5e28cd]['pick_list_values'],function(_0x106ef8){return{'name':_0x106ef8,'value':_0x106ef8};}):[]});}}return{'count':_0x592486[_0xc31b('0x30')],'rows':_0x592486};}else{return{'count':0x0,'rows':[]};}})[_0xc31b('0x39')](respondWithResult(_0x1e9401,null))[_0xc31b('0x40')](function(_0x26fa87){var _0x6e1f3b=_0x58380e[_0xc31b('0x29')][_0xc31b('0x7b')]?0x1f4:_0x26fa87['statusCode']||0x1f4;logger['error'](_0xc31b('0x7c'),_0xc31b('0x5b'),_0x6e1f3b,JSON[_0xc31b('0x7d')](_0x26fa87));delete _0x26fa87[_0xc31b('0x22')];if(_0x6e1f3b===0x191){_0x6e1f3b=0x190;}_0x1e9401['status'](_0x6e1f3b)[_0xc31b('0x7e')](_0x58380e[_0xc31b('0x29')][_0xc31b('0x7b')]?{'message':_0xc31b('0x7f'),'statusCode':_0x26fa87[_0xc31b('0x80')]}:_0x26fa87);});}; \ No newline at end of file +var _0xadfc=['response','message','Owner','Subject','Description','WhoId','Call_Duration','Call_Type','remove','includes','api_name','system_mandatory','push','display_label','data_type','pick_list_values','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','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','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','end','json','undefined','count','limit','set','Content-Range','apply','reject','save','update','destroy','then','sendStatus','error','stack','name','send','ZohoAccount','rawAttributes','fieldName','type','key','model','map','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','offset','order','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','find','body','ZohoConfiguration','sort','getConfigurations','addConfiguration','Subjects','getSubjects','Descriptions','channel','create','ZohoField','zone','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','refreshToken','clientSecret','refresh_token','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','host','clientId','serverUrl','zoho.eu','slice','substring','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','Zoho-oauthtoken\x20'];(function(_0x4a7bac,_0x1a8719){var _0x284a73=function(_0x19afeb){while(--_0x19afeb){_0x4a7bac['push'](_0x4a7bac['shift']());}};_0x284a73(++_0x1a8719);}(_0xadfc,0x9a));var _0xcadf=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0xadfc[_0x3b380d];return _0x54502b;};'use strict';var emlformat=require(_0xcadf('0x0'));var rimraf=require(_0xcadf('0x1'));var zipdir=require(_0xcadf('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xcadf('0x3'));var moment=require(_0xcadf('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xcadf('0x5'));var util=require(_0xcadf('0x6'));var path=require(_0xcadf('0x7'));var sox=require('sox');var csv=require(_0xcadf('0x8'));var ejs=require(_0xcadf('0x9'));var fs=require('fs');var fs_extra=require(_0xcadf('0xa'));var _=require(_0xcadf('0xb'));var squel=require(_0xcadf('0xc'));var crypto=require(_0xcadf('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xcadf('0xe'));var toCsv=require(_0xcadf('0x8'));var querystring=require(_0xcadf('0xf'));var Papa=require(_0xcadf('0x10'));var Redis=require(_0xcadf('0x11'));var authService=require(_0xcadf('0x12'));var qs=require(_0xcadf('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xcadf('0x14'));var logger=require('../../config/logger')(_0xcadf('0x15'));var utils=require(_0xcadf('0x16'));var config=require(_0xcadf('0x17'));var licenseUtil=require(_0xcadf('0x18'));var db=require(_0xcadf('0x19'))['db'];var integrations=require(_0xcadf('0x1a'));function respondWithStatusCode(_0x3b27c5,_0x12c209){_0x12c209=_0x12c209||0xcc;return function(_0x6f1793){if(_0x6f1793){return _0x3b27c5['sendStatus'](_0x12c209);}return _0x3b27c5[_0xcadf('0x1b')](_0x12c209)[_0xcadf('0x1c')]();};}function respondWithResult(_0xb60041,_0x4a9a6d){_0x4a9a6d=_0x4a9a6d||0xc8;return function(_0x111143){if(_0x111143){return _0xb60041[_0xcadf('0x1b')](_0x4a9a6d)[_0xcadf('0x1d')](_0x111143);}};}function respondWithFilteredResult(_0x25853d,_0xd88201){return function(_0x51b68f){if(_0x51b68f){var _0x2dca75=typeof _0xd88201['offset']===_0xcadf('0x1e')&&typeof _0xd88201['limit']==='undefined';var _0x5f40b1=_0x51b68f[_0xcadf('0x1f')];var _0x349067=_0x2dca75?0x0:_0xd88201['offset'];var _0x4dccf7=_0x2dca75?_0x51b68f[_0xcadf('0x1f')]:_0xd88201['offset']+_0xd88201[_0xcadf('0x20')];var _0x3eb846;if(_0x4dccf7>=_0x5f40b1){_0x4dccf7=_0x5f40b1;_0x3eb846=0xc8;}else{_0x3eb846=0xce;}_0x25853d['status'](_0x3eb846);return _0x25853d[_0xcadf('0x21')](_0xcadf('0x22'),_0x349067+'-'+_0x4dccf7+'/'+_0x5f40b1)[_0xcadf('0x1d')](_0x51b68f);}return null;};}function patchUpdates(_0x4f508d){return function(_0x183fab){try{jsonpatch[_0xcadf('0x23')](_0x183fab,_0x4f508d,!![]);}catch(_0x124a7d){return BPromise[_0xcadf('0x24')](_0x124a7d);}return _0x183fab[_0xcadf('0x25')]();};}function saveUpdates(_0x1d8e87,_0x2bd9dc){return function(_0x4d48cb){if(_0x4d48cb){return _0x4d48cb[_0xcadf('0x26')](_0x1d8e87)['then'](function(_0x2913f){return _0x2913f;});}return null;};}function removeEntity(_0x8f84de,_0x35722e){return function(_0x4d894c){if(_0x4d894c){return _0x4d894c[_0xcadf('0x27')]()[_0xcadf('0x28')](function(){_0x8f84de[_0xcadf('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0xe5402a,_0x5e751b){return function(_0x531acf){if(!_0x531acf){_0xe5402a[_0xcadf('0x29')](0x194);}return _0x531acf;};}function handleError(_0x17dfc8,_0x56853e){_0x56853e=_0x56853e||0x1f4;return function(_0x925985){logger[_0xcadf('0x2a')](_0x925985[_0xcadf('0x2b')]);if(_0x925985['name']){delete _0x925985[_0xcadf('0x2c')];}_0x17dfc8['status'](_0x56853e)[_0xcadf('0x2d')](_0x925985);};}exports['index']=function(_0x3e0222,_0x4f4d99){var _0x3a5cf9={},_0x189d90={},_0x1df177={'count':0x0,'rows':[]};var _0x2c01e9=_['map'](db[_0xcadf('0x2e')][_0xcadf('0x2f')],function(_0x2668cb){return{'name':_0x2668cb[_0xcadf('0x30')],'type':_0x2668cb[_0xcadf('0x31')][_0xcadf('0x32')]};});_0x189d90[_0xcadf('0x33')]=_[_0xcadf('0x34')](_0x2c01e9,'name');_0x189d90['query']=_[_0xcadf('0x35')](_0x3e0222[_0xcadf('0x36')]);_0x189d90[_0xcadf('0x37')]=_['intersection'](_0x189d90['model'],_0x189d90['query']);_0x3a5cf9[_0xcadf('0x38')]=_[_0xcadf('0x39')](_0x189d90[_0xcadf('0x33')],qs[_0xcadf('0x3a')](_0x3e0222[_0xcadf('0x36')][_0xcadf('0x3a')]));_0x3a5cf9[_0xcadf('0x38')]=_0x3a5cf9[_0xcadf('0x38')][_0xcadf('0x3b')]?_0x3a5cf9['attributes']:_0x189d90[_0xcadf('0x33')];if(!_0x3e0222[_0xcadf('0x36')][_0xcadf('0x3c')](_0xcadf('0x3d'))){_0x3a5cf9[_0xcadf('0x20')]=qs['limit'](_0x3e0222[_0xcadf('0x36')]['limit']);_0x3a5cf9[_0xcadf('0x3e')]=qs[_0xcadf('0x3e')](_0x3e0222[_0xcadf('0x36')][_0xcadf('0x3e')]);}_0x3a5cf9[_0xcadf('0x3f')]=qs['sort'](_0x3e0222[_0xcadf('0x36')]['sort']);_0x3a5cf9[_0xcadf('0x40')]=qs[_0xcadf('0x37')](_[_0xcadf('0x41')](_0x3e0222[_0xcadf('0x36')],_0x189d90[_0xcadf('0x37')]),_0x2c01e9);if(_0x3e0222[_0xcadf('0x36')][_0xcadf('0x42')]){_0x3a5cf9['where']=_[_0xcadf('0x43')](_0x3a5cf9[_0xcadf('0x40')],{'$or':_[_0xcadf('0x34')](_0x2c01e9,function(_0x10b09b){if(_0x10b09b[_0xcadf('0x31')]!==_0xcadf('0x44')){var _0x505444={};_0x505444[_0x10b09b[_0xcadf('0x2c')]]={'$like':'%'+_0x3e0222[_0xcadf('0x36')][_0xcadf('0x42')]+'%'};return _0x505444;}})});}_0x3a5cf9=_[_0xcadf('0x43')]({},_0x3a5cf9,_0x3e0222[_0xcadf('0x45')]);var _0x292c9a={'where':_0x3a5cf9[_0xcadf('0x40')]};return db[_0xcadf('0x2e')]['count'](_0x292c9a)[_0xcadf('0x28')](function(_0x1123e3){_0x1df177[_0xcadf('0x1f')]=_0x1123e3;if(_0x3e0222[_0xcadf('0x36')][_0xcadf('0x46')]){_0x3a5cf9[_0xcadf('0x47')]=[{'all':!![]}];}return db[_0xcadf('0x2e')][_0xcadf('0x48')](_0x3a5cf9);})[_0xcadf('0x28')](function(_0x39587b){_0x1df177[_0xcadf('0x49')]=_0x39587b;return _0x1df177;})[_0xcadf('0x28')](respondWithFilteredResult(_0x4f4d99,_0x3a5cf9))[_0xcadf('0x4a')](handleError(_0x4f4d99,null));};exports['show']=function(_0x234150,_0x587648){var _0x5d0008={'raw':![],'where':{'id':_0x234150[_0xcadf('0x4b')]['id']}},_0x30f853={};_0x30f853[_0xcadf('0x33')]=_['keys'](db[_0xcadf('0x2e')][_0xcadf('0x2f')]);_0x30f853[_0xcadf('0x36')]=_['keys'](_0x234150[_0xcadf('0x36')]);_0x30f853[_0xcadf('0x37')]=_['intersection'](_0x30f853[_0xcadf('0x33')],_0x30f853[_0xcadf('0x36')]);_0x5d0008[_0xcadf('0x38')]=_[_0xcadf('0x39')](_0x30f853[_0xcadf('0x33')],qs[_0xcadf('0x3a')](_0x234150[_0xcadf('0x36')][_0xcadf('0x3a')]));_0x5d0008[_0xcadf('0x38')]=_0x5d0008['attributes'][_0xcadf('0x3b')]?_0x5d0008[_0xcadf('0x38')]:_0x30f853[_0xcadf('0x33')];if(_0x234150['query'][_0xcadf('0x46')]){_0x5d0008[_0xcadf('0x47')]=[{'all':!![]}];}_0x5d0008=_['merge']({},_0x5d0008,_0x234150[_0xcadf('0x45')]);return db[_0xcadf('0x2e')][_0xcadf('0x4c')](_0x5d0008)[_0xcadf('0x28')](handleEntityNotFound(_0x587648,null))[_0xcadf('0x28')](respondWithResult(_0x587648,null))[_0xcadf('0x4a')](handleError(_0x587648,null));};exports['create']=function(_0x4835b3,_0x1b6c21){return db[_0xcadf('0x2e')]['create'](_0x4835b3[_0xcadf('0x4d')],{})[_0xcadf('0x28')](respondWithResult(_0x1b6c21,0xc9))[_0xcadf('0x4a')](handleError(_0x1b6c21,null));};exports[_0xcadf('0x26')]=function(_0x8fcdb2,_0x160b17){if(_0x8fcdb2[_0xcadf('0x4d')]['id']){delete _0x8fcdb2[_0xcadf('0x4d')]['id'];}return db['ZohoAccount'][_0xcadf('0x4c')]({'where':{'id':_0x8fcdb2[_0xcadf('0x4b')]['id']}})['then'](handleEntityNotFound(_0x160b17,null))[_0xcadf('0x28')](saveUpdates(_0x8fcdb2[_0xcadf('0x4d')],null))[_0xcadf('0x28')](respondWithResult(_0x160b17,null))[_0xcadf('0x4a')](handleError(_0x160b17,null));};exports['destroy']=function(_0x5eaee0,_0x2e9202){return db[_0xcadf('0x2e')][_0xcadf('0x4c')]({'where':{'id':_0x5eaee0[_0xcadf('0x4b')]['id']}})[_0xcadf('0x28')](handleEntityNotFound(_0x2e9202,null))[_0xcadf('0x28')](removeEntity(_0x2e9202,null))[_0xcadf('0x4a')](handleError(_0x2e9202,null));};exports['getConfigurations']=function(_0x18ec4c,_0x41b064,_0x4742d9){var _0x1e1b63={};var _0x403f8e={};var _0x3db1b3;var _0x521e31;return db[_0xcadf('0x2e')]['findOne']({'where':{'id':_0x18ec4c[_0xcadf('0x4b')]['id']}})['then'](handleEntityNotFound(_0x41b064,null))['then'](function(_0x35b4e2){if(_0x35b4e2){_0x3db1b3=_0x35b4e2;_0x403f8e[_0xcadf('0x33')]=_[_0xcadf('0x35')](db[_0xcadf('0x4e')][_0xcadf('0x2f')]);_0x403f8e['query']=_[_0xcadf('0x35')](_0x18ec4c[_0xcadf('0x36')]);_0x403f8e[_0xcadf('0x37')]=_['intersection'](_0x403f8e['model'],_0x403f8e[_0xcadf('0x36')]);_0x1e1b63[_0xcadf('0x38')]=_[_0xcadf('0x39')](_0x403f8e[_0xcadf('0x33')],qs[_0xcadf('0x3a')](_0x18ec4c['query']['fields']));_0x1e1b63[_0xcadf('0x38')]=_0x1e1b63[_0xcadf('0x38')][_0xcadf('0x3b')]?_0x1e1b63['attributes']:_0x403f8e[_0xcadf('0x33')];_0x1e1b63['order']=qs[_0xcadf('0x4f')](_0x18ec4c[_0xcadf('0x36')][_0xcadf('0x4f')]);_0x1e1b63[_0xcadf('0x40')]=qs[_0xcadf('0x37')](_[_0xcadf('0x41')](_0x18ec4c[_0xcadf('0x36')],_0x403f8e[_0xcadf('0x37')]));if(_0x18ec4c['query'][_0xcadf('0x42')]){_0x1e1b63[_0xcadf('0x40')]=_[_0xcadf('0x43')](_0x1e1b63['where'],{'$or':_[_0xcadf('0x34')](_0x1e1b63[_0xcadf('0x38')],function(_0x17bdc0){var _0x4d7536={};_0x4d7536[_0x17bdc0]={'$like':'%'+_0x18ec4c[_0xcadf('0x36')][_0xcadf('0x42')]+'%'};return _0x4d7536;})});}_0x1e1b63=_[_0xcadf('0x43')]({},_0x1e1b63,_0x18ec4c[_0xcadf('0x45')]);return _0x3db1b3[_0xcadf('0x50')](_0x1e1b63);}})[_0xcadf('0x28')](function(_0x3eef6c){if(_0x3eef6c){_0x521e31=_0x3eef6c[_0xcadf('0x3b')];if(!_0x18ec4c[_0xcadf('0x36')]['hasOwnProperty']('nolimit')){_0x1e1b63[_0xcadf('0x20')]=qs[_0xcadf('0x20')](_0x18ec4c[_0xcadf('0x36')][_0xcadf('0x20')]);_0x1e1b63[_0xcadf('0x3e')]=qs['offset'](_0x18ec4c['query']['offset']);}return _0x3db1b3[_0xcadf('0x50')](_0x1e1b63);}})['then'](function(_0x99b6bf){if(_0x99b6bf){return _0x99b6bf?{'count':_0x521e31,'rows':_0x99b6bf}:null;}})[_0xcadf('0x28')](respondWithResult(_0x41b064,null))[_0xcadf('0x4a')](handleError(_0x41b064,null));};exports[_0xcadf('0x51')]=function(_0x4c0e85,_0x48709d,_0x274fa7){if(_0x4c0e85[_0xcadf('0x4d')]['id']){delete _0x4c0e85[_0xcadf('0x4d')]['id'];}return db[_0xcadf('0x2e')]['findOne']({'where':{'id':_0x4c0e85[_0xcadf('0x4b')]['id']}})['then'](handleEntityNotFound(_0x48709d,null))['then'](function(_0x4ac036){if(_0x4ac036){_0x4c0e85[_0xcadf('0x4d')]['AccountId']=_0x4ac036['id'];_0x4c0e85['body'][_0xcadf('0x52')]=integrations[_0xcadf('0x53')](_0x4c0e85[_0xcadf('0x4d')]['channel'],_0x4c0e85[_0xcadf('0x4d')]['type']);_0x4c0e85[_0xcadf('0x4d')][_0xcadf('0x54')]=integrations['getDescriptions'](_0x4c0e85['body'][_0xcadf('0x55')],_0x4c0e85[_0xcadf('0x4d')][_0xcadf('0x31')]);return db[_0xcadf('0x4e')][_0xcadf('0x56')](_0x4c0e85['body'],{'include':[{'model':db['ZohoField'],'as':_0xcadf('0x52')},{'model':db[_0xcadf('0x57')],'as':_0xcadf('0x54')}]});}return null;})['then'](respondWithResult(_0x48709d,null))['catch'](handleError(_0x48709d,null));};function getAccessToken(_0xf024f5){return new Promise(function(_0x5a3b58,_0x1d8194){var _0x141cd4;switch(_0xf024f5[_0xcadf('0x58')]){case'US':_0x141cd4='https://accounts.zoho.com';break;case'AU':_0x141cd4='https://accounts.zoho.com.au';break;case'EU':_0x141cd4=_0xcadf('0x59');break;case'IN':_0x141cd4=_0xcadf('0x5a');break;case'CN':_0x141cd4=_0xcadf('0x5b');break;default:_0x141cd4=_0xcadf('0x59');break;}var _0x2927b2={'method':_0xcadf('0x5c'),'uri':_0x141cd4+_0xcadf('0x5d'),'qs':{'refresh_token':_0xf024f5[_0xcadf('0x5e')],'client_id':_0xf024f5['clientId'],'client_secret':_0xf024f5[_0xcadf('0x5f')],'grant_type':_0xcadf('0x60')},'json':!![]};return rp(_0x2927b2)[_0xcadf('0x28')](function(_0x5c5433){if(_0x5c5433[_0xcadf('0x61')]){_0x5a3b58(_0x5c5433[_0xcadf('0x61')]);}else{_0x1d8194(_0xcadf('0x62'));}})['catch'](function(_0x237b5c){_0x1d8194(_0x237b5c);});});}exports[_0xcadf('0x63')]=function(_0x3dbd16,_0x284535,_0x18f886){var _0x5e94f6,_0x25c046,_0x3d4114,_0x149650,_0x1aa0c5;return db['ZohoAccount']['findOne']({'where':{'id':_0x3dbd16[_0xcadf('0x4b')]['id']},'attributes':['id',_0xcadf('0x64'),_0xcadf('0x58'),_0xcadf('0x65'),_0xcadf('0x5f'),_0xcadf('0x66'),'code',_0xcadf('0x5e')]})[_0xcadf('0x28')](handleEntityNotFound(_0x284535,null))[_0xcadf('0x28')](function(_0x2a10e7){_0x1aa0c5=_0x2a10e7;_0x5e94f6=_0x1aa0c5[_0xcadf('0x64')];_0x25c046=_0x5e94f6===_0xcadf('0x67')?'eu':'com';_0x3d4114=_0x1aa0c5[_0xcadf('0x66')];var _0x2cd4cf=_0x3d4114[_0xcadf('0x68')](-0x1);if(_0x2cd4cf==='/'||_0x2cd4cf==='\x5c'||_0x2cd4cf===':'){_0x3d4114=_0x3d4114[_0xcadf('0x69')](0x0,_0x3d4114[_0xcadf('0x6a')](_0x2cd4cf));}if(!_0x1aa0c5[_0xcadf('0x5e')]){throw new Error(_0xcadf('0x6b'));}return getAccessToken(_0x1aa0c5);})['then'](function(_0x1292c8){if(_0x1292c8){return rp({'method':_0xcadf('0x6c'),'uri':util['format'](_0xcadf('0x6d'),_0x25c046),'qs':{'module':_0xcadf('0x6e')},'headers':{'Authorization':_0xcadf('0x6f')+_0x1292c8},'json':!![]});}})[_0xcadf('0x28')](function(_0x5e7b12){if(_0x5e7b12){if(_0x5e7b12[_0xcadf('0x70')]&&_0x5e7b12['response'][_0xcadf('0x2a')]){throw new Error(_0x5e7b12[_0xcadf('0x70')][_0xcadf('0x2a')][_0xcadf('0x71')]);}var _0x1b4761=[];var _0x5cbe61=[];var _0x30d216=[_0xcadf('0x72'),_0xcadf('0x73'),_0xcadf('0x74'),_0xcadf('0x75'),_0xcadf('0x76'),'Call_Result','Call_Start_Time',_0xcadf('0x77')];_0x5cbe61=_[_0xcadf('0x78')](_0x5e7b12['fields'],function(_0x25ac3f){return _0x30d216[_0xcadf('0x79')](_0x25ac3f[_0xcadf('0x7a')]);});for(var _0x34d8cf=0x0;_0x34d8cf<_0x5cbe61[_0xcadf('0x3b')];_0x34d8cf++){if(_0x5cbe61[_0x34d8cf][_0xcadf('0x7b')]===![]){_0x1b4761[_0xcadf('0x7c')]({'id':_0x5cbe61[_0x34d8cf]['id'],'name':_0x5cbe61[_0x34d8cf][_0xcadf('0x7d')],'custom':_0x5cbe61[_0x34d8cf]['custom_field'],'options':_0x5cbe61[_0x34d8cf][_0xcadf('0x7e')]==='picklist'&&_0x5cbe61[_0x34d8cf]['pick_list_values'][_0xcadf('0x3b')]>-0x1?_[_0xcadf('0x34')](_0x5cbe61[_0x34d8cf][_0xcadf('0x7f')],function(_0x13c38b){return{'name':_0x13c38b,'value':_0x13c38b};}):[]});}}return{'count':_0x1b4761[_0xcadf('0x3b')],'rows':_0x1b4761};}else{return{'count':0x0,'rows':[]};}})[_0xcadf('0x28')](respondWithResult(_0x284535,null))['catch'](function(_0x4b22e8){var _0x338dcc=_0x3dbd16[_0xcadf('0x36')][_0xcadf('0x80')]?0x1f4:_0x4b22e8[_0xcadf('0x81')]||0x1f4;logger[_0xcadf('0x2a')](_0xcadf('0x82'),_0xcadf('0x63'),_0x338dcc,JSON[_0xcadf('0x83')](_0x4b22e8));delete _0x4b22e8[_0xcadf('0x2c')];if(_0x338dcc===0x191){_0x338dcc=0x190;}_0x284535['status'](_0x338dcc)[_0xcadf('0x2d')](_0x3dbd16['query']['test']?{'message':_0xcadf('0x84'),'statusCode':_0x4b22e8[_0xcadf('0x81')]}:_0x4b22e8);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index 1b04260..499aff9 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 _0x4d23=['parse','refresh_token','refreshToken','info','format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','error','inspect','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','host','https://accounts.zoho.in','authorization_code','application/x-www-form-urlencoded','then','catch','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./intZohoAccount.attributes','exports','ZohoAccount','int_zoho_accounts','changed','zone','clientSecret','code','serverUrl','slice','substring','lastIndexOf','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','/oauth/v2/token','clientId'];(function(_0x3722e6,_0x2a63aa){var _0x378a44=function(_0x240d9d){while(--_0x240d9d){_0x3722e6['push'](_0x3722e6['shift']());}};_0x378a44(++_0x2a63aa);}(_0x4d23,0x91));var _0x34d2=function(_0x3afebd,_0x315db2){_0x3afebd=_0x3afebd-0x0;var _0x49858c=_0x4d23[_0x3afebd];return _0x49858c;};'use strict';var _=require('lodash');var util=require(_0x34d2('0x0'));var logger=require(_0x34d2('0x1'))(_0x34d2('0x2'));var moment=require(_0x34d2('0x3'));var BPromise=require(_0x34d2('0x4'));var rp=require(_0x34d2('0x5'));var fs=require('fs');var path=require(_0x34d2('0x6'));var rimraf=require('rimraf');var config=require(_0x34d2('0x7'));var attributes=require(_0x34d2('0x8'));var integrations=require('../../components/integrations/configuration');module[_0x34d2('0x9')]=function(_0x19fc66,_0x1137eb){return _0x19fc66['define'](_0x34d2('0xa'),attributes,{'tableName':_0x34d2('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0xbc3c85,_0x198eed,_0xec4632){if(_0xbc3c85[_0x34d2('0xc')](_0x34d2('0xd'))||_0xbc3c85[_0x34d2('0xc')]('serverUrl')||_0xbc3c85[_0x34d2('0xc')]('clientId')||_0xbc3c85['changed'](_0x34d2('0xe'))||_0xbc3c85[_0x34d2('0xc')](_0x34d2('0xf'))||_0xbc3c85['changed']('host')){var _0x900f66,_0x568614;_0x900f66=_0xbc3c85[_0x34d2('0x10')];var _0x3f6bda=_0x900f66[_0x34d2('0x11')](-0x1);if(_0x3f6bda==='/'||_0x3f6bda==='\x5c'||_0x3f6bda===':'){_0x900f66=_0x900f66[_0x34d2('0x12')](0x0,_0x900f66[_0x34d2('0x13')](_0x3f6bda));}switch(_0xbc3c85['zone']){case'US':_0x568614=_0x34d2('0x14');break;case'AU':_0x568614=_0x34d2('0x15');break;case'IN':_0x568614='https://accounts.zoho.in';break;case'CN':_0x568614=_0x34d2('0x16');break;default:_0x568614=_0x34d2('0x17');break;}var _0x13bacd={'method':_0x34d2('0x18'),'uri':_0x568614+_0x34d2('0x19'),'form':{'grant_type':'authorization_code','client_id':_0xbc3c85[_0x34d2('0x1a')],'client_secret':_0xbc3c85['clientSecret'],'redirect_uri':_0xbc3c85[_0x34d2('0x10')],'code':_0xbc3c85[_0x34d2('0xf')]},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0x13bacd)['then'](function(_0x4788d0){var _0x1563d8=JSON[_0x34d2('0x1b')](_0x4788d0);if(_0x1563d8[_0x34d2('0x1c')]){_0xbc3c85[_0x34d2('0x1d')]=_0x1563d8[_0x34d2('0x1c')];logger[_0x34d2('0x1e')](util[_0x34d2('0x1f')](_0x34d2('0x20'),_0xbc3c85[_0x34d2('0x21')],_0xbc3c85['id']));}else{logger[_0x34d2('0x22')](util[_0x34d2('0x1f')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0xbc3c85[_0x34d2('0x21')],_0xbc3c85['id']),util[_0x34d2('0x23')](_0x1563d8,{'showHidden':![],'depth':null}));}return _0xec4632(null,_0x198eed);})['catch'](function(_0x576840){logger['error'](util[_0x34d2('0x1f')](_0x34d2('0x24'),_0xbc3c85[_0x34d2('0x21')],_0xbc3c85['id']),util[_0x34d2('0x23')](parsedResult,{'showHidden':![],'depth':null}));return _0xec4632(_0x576840);});}else{return _0xec4632(null,_0x198eed);}},'beforeUpdate':function(_0x529131,_0x209b58,_0x4712c1){if(_0x529131[_0x34d2('0xc')](_0x34d2('0xd'))||_0x529131[_0x34d2('0xc')](_0x34d2('0x10'))||_0x529131[_0x34d2('0xc')](_0x34d2('0x1a'))||_0x529131[_0x34d2('0xc')](_0x34d2('0xe'))||_0x529131[_0x34d2('0xc')](_0x34d2('0xf'))||_0x529131['changed'](_0x34d2('0x25'))){var _0x288e1b,_0x52d9d0;_0x288e1b=_0x529131['serverUrl'];var _0x1f0b33=_0x288e1b['slice'](-0x1);if(_0x1f0b33==='/'||_0x1f0b33==='\x5c'||_0x1f0b33===':'){_0x288e1b=_0x288e1b[_0x34d2('0x12')](0x0,_0x288e1b[_0x34d2('0x13')](_0x1f0b33));}switch(_0x529131[_0x34d2('0xd')]){case'US':_0x52d9d0='https://accounts.zoho.com';break;case'AU':_0x52d9d0=_0x34d2('0x15');break;case'IN':_0x52d9d0=_0x34d2('0x26');break;case'CN':_0x52d9d0=_0x34d2('0x16');break;default:_0x52d9d0='https://accounts.zoho.eu';break;}var _0x278d25={'method':_0x34d2('0x18'),'uri':_0x52d9d0+'/oauth/v2/token','form':{'grant_type':_0x34d2('0x27'),'client_id':_0x529131[_0x34d2('0x1a')],'client_secret':_0x529131[_0x34d2('0xe')],'redirect_uri':_0x529131[_0x34d2('0x10')],'code':_0x529131[_0x34d2('0xf')]},'headers':{'Content-Type':_0x34d2('0x28')}};return rp(_0x278d25)[_0x34d2('0x29')](function(_0x59d057){var _0x2880bd=JSON[_0x34d2('0x1b')](_0x59d057);if(_0x2880bd['refresh_token']){_0x529131[_0x34d2('0x1d')]=_0x2880bd['refresh_token'];logger[_0x34d2('0x1e')](util[_0x34d2('0x1f')](_0x34d2('0x20'),_0x529131[_0x34d2('0x21')],_0x529131['id']));}else{logger[_0x34d2('0x22')](util[_0x34d2('0x1f')](_0x34d2('0x24'),_0x529131[_0x34d2('0x21')],_0x529131['id']),util[_0x34d2('0x23')](_0x2880bd,{'showHidden':![],'depth':null}));}return _0x4712c1(null,_0x209b58);})[_0x34d2('0x2a')](function(_0x47db62){logger['error'](util[_0x34d2('0x1f')](_0x34d2('0x24'),_0x529131[_0x34d2('0x21')],_0x529131['id']),util[_0x34d2('0x23')](parsedResult,{'showHidden':![],'depth':null}));return _0x4712c1(_0x47db62);});}else{return _0x4712c1(null,_0x209b58);}}}});}; \ No newline at end of file +var _0x6e9a=['host','slice','substring','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','/oauth/v2/token','then','parse','refresh_token','refreshToken','info','format','error','catch','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','name','inspect','serverUrl','lastIndexOf','application/x-www-form-urlencoded','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','../../components/integrations/configuration','ZohoAccount','int_zoho_accounts','changed','clientId','clientSecret','code'];(function(_0x424501,_0x42096d){var _0xb719af=function(_0x37adcf){while(--_0x37adcf){_0x424501['push'](_0x424501['shift']());}};_0xb719af(++_0x42096d);}(_0x6e9a,0x1dc));var _0xa6e9=function(_0x1f43f4,_0x16d500){_0x1f43f4=_0x1f43f4-0x0;var _0x5435b7=_0x6e9a[_0x1f43f4];return _0x5435b7;};'use strict';var _=require(_0xa6e9('0x0'));var util=require('util');var logger=require(_0xa6e9('0x1'))(_0xa6e9('0x2'));var moment=require(_0xa6e9('0x3'));var BPromise=require(_0xa6e9('0x4'));var rp=require(_0xa6e9('0x5'));var fs=require('fs');var path=require(_0xa6e9('0x6'));var rimraf=require(_0xa6e9('0x7'));var config=require(_0xa6e9('0x8'));var attributes=require('./intZohoAccount.attributes');var integrations=require(_0xa6e9('0x9'));module['exports']=function(_0x4cf853,_0x1cad2e){return _0x4cf853['define'](_0xa6e9('0xa'),attributes,{'tableName':_0xa6e9('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x9ea0ed,_0x11eba3,_0x17c18b){if(_0x9ea0ed[_0xa6e9('0xc')]('zone')||_0x9ea0ed[_0xa6e9('0xc')]('serverUrl')||_0x9ea0ed[_0xa6e9('0xc')](_0xa6e9('0xd'))||_0x9ea0ed['changed'](_0xa6e9('0xe'))||_0x9ea0ed[_0xa6e9('0xc')](_0xa6e9('0xf'))||_0x9ea0ed[_0xa6e9('0xc')](_0xa6e9('0x10'))){var _0x8a4980,_0x27a556;_0x8a4980=_0x9ea0ed['serverUrl'];var _0x4ceb60=_0x8a4980[_0xa6e9('0x11')](-0x1);if(_0x4ceb60==='/'||_0x4ceb60==='\x5c'||_0x4ceb60===':'){_0x8a4980=_0x8a4980[_0xa6e9('0x12')](0x0,_0x8a4980['lastIndexOf'](_0x4ceb60));}switch(_0x9ea0ed[_0xa6e9('0x13')]){case'US':_0x27a556=_0xa6e9('0x14');break;case'AU':_0x27a556=_0xa6e9('0x15');break;case'IN':_0x27a556=_0xa6e9('0x16');break;case'CN':_0x27a556=_0xa6e9('0x17');break;default:_0x27a556=_0xa6e9('0x18');break;}var _0x332b1c={'method':'POST','uri':_0x27a556+_0xa6e9('0x19'),'form':{'grant_type':'authorization_code','client_id':_0x9ea0ed[_0xa6e9('0xd')],'client_secret':_0x9ea0ed[_0xa6e9('0xe')],'redirect_uri':_0x9ea0ed['serverUrl'],'code':_0x9ea0ed[_0xa6e9('0xf')]},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0x332b1c)[_0xa6e9('0x1a')](function(_0x2456f9){var _0x13e9b5=JSON[_0xa6e9('0x1b')](_0x2456f9);if(_0x13e9b5[_0xa6e9('0x1c')]){_0x9ea0ed[_0xa6e9('0x1d')]=_0x13e9b5[_0xa6e9('0x1c')];logger[_0xa6e9('0x1e')](util[_0xa6e9('0x1f')]('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0x9ea0ed['name'],_0x9ea0ed['id']));}else{logger[_0xa6e9('0x20')](util[_0xa6e9('0x1f')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x9ea0ed['name'],_0x9ea0ed['id']),util['inspect'](_0x13e9b5,{'showHidden':![],'depth':null}));}return _0x17c18b(null,_0x11eba3);})[_0xa6e9('0x21')](function(_0x14de34){logger[_0xa6e9('0x20')](util[_0xa6e9('0x1f')](_0xa6e9('0x22'),_0x9ea0ed[_0xa6e9('0x23')],_0x9ea0ed['id']),util[_0xa6e9('0x24')](parsedResult,{'showHidden':![],'depth':null}));return _0x17c18b(_0x14de34);});}else{return _0x17c18b(null,_0x11eba3);}},'beforeUpdate':function(_0x5a423f,_0x4f0136,_0x32cf02){if(_0x5a423f['changed']('zone')||_0x5a423f['changed']('serverUrl')||_0x5a423f['changed'](_0xa6e9('0xd'))||_0x5a423f['changed'](_0xa6e9('0xe'))||_0x5a423f[_0xa6e9('0xc')](_0xa6e9('0xf'))||_0x5a423f[_0xa6e9('0xc')](_0xa6e9('0x10'))){var _0x35fd89,_0x219d5f;_0x35fd89=_0x5a423f[_0xa6e9('0x25')];var _0x17542e=_0x35fd89[_0xa6e9('0x11')](-0x1);if(_0x17542e==='/'||_0x17542e==='\x5c'||_0x17542e===':'){_0x35fd89=_0x35fd89[_0xa6e9('0x12')](0x0,_0x35fd89[_0xa6e9('0x26')](_0x17542e));}switch(_0x5a423f[_0xa6e9('0x13')]){case'US':_0x219d5f=_0xa6e9('0x14');break;case'AU':_0x219d5f='https://accounts.zoho.com.au';break;case'IN':_0x219d5f=_0xa6e9('0x16');break;case'CN':_0x219d5f=_0xa6e9('0x17');break;default:_0x219d5f=_0xa6e9('0x18');break;}var _0x52d79f={'method':'POST','uri':_0x219d5f+'/oauth/v2/token','form':{'grant_type':'authorization_code','client_id':_0x5a423f[_0xa6e9('0xd')],'client_secret':_0x5a423f[_0xa6e9('0xe')],'redirect_uri':_0x5a423f[_0xa6e9('0x25')],'code':_0x5a423f[_0xa6e9('0xf')]},'headers':{'Content-Type':_0xa6e9('0x27')}};return rp(_0x52d79f)[_0xa6e9('0x1a')](function(_0x1f8a64){var _0x2245b7=JSON[_0xa6e9('0x1b')](_0x1f8a64);if(_0x2245b7[_0xa6e9('0x1c')]){_0x5a423f[_0xa6e9('0x1d')]=_0x2245b7['refresh_token'];logger[_0xa6e9('0x1e')](util[_0xa6e9('0x1f')](_0xa6e9('0x28'),_0x5a423f[_0xa6e9('0x23')],_0x5a423f['id']));}else{logger[_0xa6e9('0x20')](util[_0xa6e9('0x1f')](_0xa6e9('0x22'),_0x5a423f[_0xa6e9('0x23')],_0x5a423f['id']),util[_0xa6e9('0x24')](_0x2245b7,{'showHidden':![],'depth':null}));}return _0x32cf02(null,_0x4f0136);})[_0xa6e9('0x21')](function(_0x5e8386){logger[_0xa6e9('0x20')](util[_0xa6e9('0x1f')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x5a423f[_0xa6e9('0x23')],_0x5a423f['id']),util[_0xa6e9('0x24')](parsedResult,{'showHidden':![],'depth':null}));return _0x32cf02(_0x5e8386);});}else{return _0x32cf02(null,_0x4f0136);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index c9d7f11..a9d15f2 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 _0x9c1d=['ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','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','where','attributes','include','map','model','ShowZohoAccount','catch','lodash','util','moment','randomstring'];(function(_0x217e9f,_0x2f0ce3){var _0x504211=function(_0x51842d){while(--_0x51842d){_0x217e9f['push'](_0x217e9f['shift']());}};_0x504211(++_0x2f0ce3);}(_0x9c1d,0x1a9));var _0xd9c1=function(_0x559217,_0x24b686){_0x559217=_0x559217-0x0;var _0x370334=_0x9c1d[_0x559217];return _0x370334;};'use strict';var _=require(_0xd9c1('0x0'));var util=require(_0xd9c1('0x1'));var moment=require(_0xd9c1('0x2'));var BPromise=require('bluebird');var rs=require(_0xd9c1('0x3'));var fs=require('fs');var Redis=require(_0xd9c1('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xd9c1('0x5'));var logger=require(_0xd9c1('0x6'))('rpc');var config=require(_0xd9c1('0x7'));var jayson=require(_0xd9c1('0x8'));var client=jayson[_0xd9c1('0x9')][_0xd9c1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3f729f,_0x3528cc,_0x75aa4b){return new BPromise(function(_0x56e650,_0x3aae47){return client['request'](_0x3f729f,_0x75aa4b)[_0xd9c1('0xb')](function(_0x31c3fb){logger[_0xd9c1('0xc')](_0xd9c1('0xd'),_0x3528cc,_0xd9c1('0xe'));logger[_0xd9c1('0xf')](_0xd9c1('0x10'),_0x3528cc,'request\x20sent',JSON[_0xd9c1('0x11')](_0x31c3fb));if(_0x31c3fb[_0xd9c1('0x12')]){if(_0x31c3fb[_0xd9c1('0x12')]['code']===0x1f4){logger[_0xd9c1('0x12')]('ZohoAccount,\x20%s,\x20%s',_0x3528cc,_0x31c3fb[_0xd9c1('0x12')][_0xd9c1('0x13')]);return _0x3aae47(_0x31c3fb[_0xd9c1('0x12')][_0xd9c1('0x13')]);}logger[_0xd9c1('0x12')](_0xd9c1('0xd'),_0x3528cc,_0x31c3fb[_0xd9c1('0x12')][_0xd9c1('0x13')]);return _0x56e650(_0x31c3fb[_0xd9c1('0x12')][_0xd9c1('0x13')]);}else{logger[_0xd9c1('0xc')](_0xd9c1('0xd'),_0x3528cc,_0xd9c1('0xe'));_0x56e650(_0x31c3fb[_0xd9c1('0x14')][_0xd9c1('0x13')]);}})['catch'](function(_0x4bb069){logger[_0xd9c1('0x12')](_0xd9c1('0xd'),_0x3528cc,_0x4bb069);_0x3aae47(_0x4bb069);});});}exports[_0xd9c1('0x15')]=function(_0x1a1542){var _0x10a586=this;return new Promise(function(_0x454559,_0xfe03f8){return db[_0xd9c1('0x16')][_0xd9c1('0x17')]({'raw':_0x1a1542['options']?_0x1a1542[_0xd9c1('0x18')][_0xd9c1('0x19')]===undefined?!![]:![]:!![],'where':_0x1a1542[_0xd9c1('0x18')]?_0x1a1542[_0xd9c1('0x18')][_0xd9c1('0x1a')]||null:null,'attributes':_0x1a1542[_0xd9c1('0x18')]?_0x1a1542['options'][_0xd9c1('0x1b')]||null:null,'limit':_0x1a1542[_0xd9c1('0x18')]?_0x1a1542[_0xd9c1('0x18')]['limit']||null:null,'include':_0x1a1542['options']?_0x1a1542[_0xd9c1('0x18')][_0xd9c1('0x1c')]?_[_0xd9c1('0x1d')](_0x1a1542[_0xd9c1('0x18')][_0xd9c1('0x1c')],function(_0x5f6a76){return{'model':db[_0x5f6a76[_0xd9c1('0x1e')]],'as':_0x5f6a76['as'],'attributes':_0x5f6a76['attributes'],'include':_0x5f6a76[_0xd9c1('0x1c')]?_[_0xd9c1('0x1d')](_0x5f6a76['include'],function(_0x5dc2ee){return{'model':db[_0x5dc2ee[_0xd9c1('0x1e')]],'as':_0x5dc2ee['as'],'attributes':_0x5dc2ee[_0xd9c1('0x1b')],'include':_0x5dc2ee[_0xd9c1('0x1c')]?_['map'](_0x5dc2ee[_0xd9c1('0x1c')],function(_0x282e01){return{'model':db[_0x282e01['model']],'as':_0x282e01['as'],'attributes':_0x282e01['attributes']};}):[]};}):[]};}):[]:[]})[_0xd9c1('0xb')](function(_0x2d2f1c){logger[_0xd9c1('0xc')](_0xd9c1('0x15'),_0x1a1542);logger[_0xd9c1('0xf')](_0xd9c1('0x15'),_0x1a1542,JSON[_0xd9c1('0x11')](_0x2d2f1c));_0x454559(_0x2d2f1c);})['catch'](function(_0x250527){logger[_0xd9c1('0x12')](_0xd9c1('0x15'),_0x250527[_0xd9c1('0x13')],_0x1a1542);_0xfe03f8(_0x10a586[_0xd9c1('0x12')](0x1f4,_0x250527[_0xd9c1('0x13')]));});});};exports[_0xd9c1('0x1f')]=function(_0x313f05){var _0x5a1a5c=this;return new Promise(function(_0x5117d6,_0x5923d9){return db[_0xd9c1('0x16')]['find']({'raw':_0x313f05[_0xd9c1('0x18')]?_0x313f05[_0xd9c1('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x313f05[_0xd9c1('0x18')]?_0x313f05[_0xd9c1('0x18')][_0xd9c1('0x1a')]||null:null,'attributes':_0x313f05[_0xd9c1('0x18')]?_0x313f05[_0xd9c1('0x18')][_0xd9c1('0x1b')]||null:null,'include':_0x313f05[_0xd9c1('0x18')]?_0x313f05[_0xd9c1('0x18')][_0xd9c1('0x1c')]?_[_0xd9c1('0x1d')](_0x313f05[_0xd9c1('0x18')][_0xd9c1('0x1c')],function(_0x4fd94b){return{'model':db[_0x4fd94b['model']],'as':_0x4fd94b['as'],'attributes':_0x4fd94b[_0xd9c1('0x1b')],'include':_0x4fd94b[_0xd9c1('0x1c')]?_[_0xd9c1('0x1d')](_0x4fd94b['include'],function(_0x6f70be){return{'model':db[_0x6f70be[_0xd9c1('0x1e')]],'as':_0x6f70be['as'],'attributes':_0x6f70be['attributes'],'include':_0x6f70be[_0xd9c1('0x1c')]?_[_0xd9c1('0x1d')](_0x6f70be['include'],function(_0x5805c9){return{'model':db[_0x5805c9[_0xd9c1('0x1e')]],'as':_0x5805c9['as'],'attributes':_0x5805c9[_0xd9c1('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xd9c1('0xb')](function(_0x791234){logger[_0xd9c1('0xc')](_0xd9c1('0x1f'),_0x313f05);logger['debug'](_0xd9c1('0x1f'),_0x313f05,JSON[_0xd9c1('0x11')](_0x791234));_0x5117d6(_0x791234);})[_0xd9c1('0x20')](function(_0x5b062f){logger[_0xd9c1('0x12')](_0xd9c1('0x1f'),_0x5b062f[_0xd9c1('0x13')],_0x313f05);_0x5923d9(_0x5a1a5c[_0xd9c1('0x12')](0x1f4,_0x5b062f[_0xd9c1('0x13')]));});});}; \ No newline at end of file +var _0xbe2c=['result','catch','ZohoAccount','findAll','options','where','attributes','include','map','model','then','GetZohoAccount','debug','ShowZohoAccount','find','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','stringify','error','code','message'];(function(_0x24484e,_0x2c4b25){var _0x6f55c6=function(_0x21139c){while(--_0x21139c){_0x24484e['push'](_0x24484e['shift']());}};_0x6f55c6(++_0x2c4b25);}(_0xbe2c,0x18f));var _0xcbe2=function(_0x47738e,_0x483014){_0x47738e=_0x47738e-0x0;var _0x2eec0d=_0xbe2c[_0x47738e];return _0x2eec0d;};'use strict';var _=require(_0xcbe2('0x0'));var util=require(_0xcbe2('0x1'));var moment=require('moment');var BPromise=require(_0xcbe2('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xcbe2('0x3'));var db=require(_0xcbe2('0x4'))['db'];var utils=require(_0xcbe2('0x5'));var logger=require(_0xcbe2('0x6'))(_0xcbe2('0x7'));var config=require('../../config/environment');var jayson=require(_0xcbe2('0x8'));var client=jayson[_0xcbe2('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2c0389,_0x3eb920,_0x1c28ab){return new BPromise(function(_0x294a61,_0x21233e){return client['request'](_0x2c0389,_0x1c28ab)['then'](function(_0xb7fe3c){logger[_0xcbe2('0xa')](_0xcbe2('0xb'),_0x3eb920,_0xcbe2('0xc'));logger['debug']('ZohoAccount,\x20%s,\x20%s,\x20%s',_0x3eb920,_0xcbe2('0xc'),JSON[_0xcbe2('0xd')](_0xb7fe3c));if(_0xb7fe3c[_0xcbe2('0xe')]){if(_0xb7fe3c[_0xcbe2('0xe')][_0xcbe2('0xf')]===0x1f4){logger[_0xcbe2('0xe')]('ZohoAccount,\x20%s,\x20%s',_0x3eb920,_0xb7fe3c[_0xcbe2('0xe')][_0xcbe2('0x10')]);return _0x21233e(_0xb7fe3c['error'][_0xcbe2('0x10')]);}logger['error'](_0xcbe2('0xb'),_0x3eb920,_0xb7fe3c['error'][_0xcbe2('0x10')]);return _0x294a61(_0xb7fe3c['error']['message']);}else{logger[_0xcbe2('0xa')]('ZohoAccount,\x20%s,\x20%s',_0x3eb920,_0xcbe2('0xc'));_0x294a61(_0xb7fe3c[_0xcbe2('0x11')][_0xcbe2('0x10')]);}})[_0xcbe2('0x12')](function(_0x40dc0f){logger[_0xcbe2('0xe')](_0xcbe2('0xb'),_0x3eb920,_0x40dc0f);_0x21233e(_0x40dc0f);});});}exports['GetZohoAccount']=function(_0xb968ac){var _0x5acacd=this;return new Promise(function(_0x1c09cb,_0xff2918){return db[_0xcbe2('0x13')][_0xcbe2('0x14')]({'raw':_0xb968ac['options']?_0xb968ac[_0xcbe2('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0xb968ac['options']?_0xb968ac[_0xcbe2('0x15')][_0xcbe2('0x16')]||null:null,'attributes':_0xb968ac[_0xcbe2('0x15')]?_0xb968ac['options'][_0xcbe2('0x17')]||null:null,'limit':_0xb968ac[_0xcbe2('0x15')]?_0xb968ac[_0xcbe2('0x15')]['limit']||null:null,'include':_0xb968ac[_0xcbe2('0x15')]?_0xb968ac[_0xcbe2('0x15')][_0xcbe2('0x18')]?_[_0xcbe2('0x19')](_0xb968ac[_0xcbe2('0x15')][_0xcbe2('0x18')],function(_0x2f1e25){return{'model':db[_0x2f1e25[_0xcbe2('0x1a')]],'as':_0x2f1e25['as'],'attributes':_0x2f1e25['attributes'],'include':_0x2f1e25[_0xcbe2('0x18')]?_[_0xcbe2('0x19')](_0x2f1e25['include'],function(_0x40039f){return{'model':db[_0x40039f[_0xcbe2('0x1a')]],'as':_0x40039f['as'],'attributes':_0x40039f[_0xcbe2('0x17')],'include':_0x40039f[_0xcbe2('0x18')]?_[_0xcbe2('0x19')](_0x40039f['include'],function(_0xbc5aab){return{'model':db[_0xbc5aab[_0xcbe2('0x1a')]],'as':_0xbc5aab['as'],'attributes':_0xbc5aab['attributes']};}):[]};}):[]};}):[]:[]})[_0xcbe2('0x1b')](function(_0x5ad2e9){logger[_0xcbe2('0xa')](_0xcbe2('0x1c'),_0xb968ac);logger[_0xcbe2('0x1d')](_0xcbe2('0x1c'),_0xb968ac,JSON['stringify'](_0x5ad2e9));_0x1c09cb(_0x5ad2e9);})[_0xcbe2('0x12')](function(_0x37eb8b){logger['error'](_0xcbe2('0x1c'),_0x37eb8b[_0xcbe2('0x10')],_0xb968ac);_0xff2918(_0x5acacd[_0xcbe2('0xe')](0x1f4,_0x37eb8b[_0xcbe2('0x10')]));});});};exports[_0xcbe2('0x1e')]=function(_0x3cffd1){var _0x3744f3=this;return new Promise(function(_0x8824fc,_0x39ab14){return db[_0xcbe2('0x13')][_0xcbe2('0x1f')]({'raw':_0x3cffd1[_0xcbe2('0x15')]?_0x3cffd1[_0xcbe2('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x3cffd1[_0xcbe2('0x15')]?_0x3cffd1[_0xcbe2('0x15')]['where']||null:null,'attributes':_0x3cffd1['options']?_0x3cffd1[_0xcbe2('0x15')]['attributes']||null:null,'include':_0x3cffd1[_0xcbe2('0x15')]?_0x3cffd1[_0xcbe2('0x15')][_0xcbe2('0x18')]?_[_0xcbe2('0x19')](_0x3cffd1[_0xcbe2('0x15')][_0xcbe2('0x18')],function(_0x183953){return{'model':db[_0x183953['model']],'as':_0x183953['as'],'attributes':_0x183953[_0xcbe2('0x17')],'include':_0x183953['include']?_['map'](_0x183953[_0xcbe2('0x18')],function(_0x4bd628){return{'model':db[_0x4bd628[_0xcbe2('0x1a')]],'as':_0x4bd628['as'],'attributes':_0x4bd628['attributes'],'include':_0x4bd628[_0xcbe2('0x18')]?_[_0xcbe2('0x19')](_0x4bd628['include'],function(_0x97be46){return{'model':db[_0x97be46['model']],'as':_0x97be46['as'],'attributes':_0x97be46[_0xcbe2('0x17')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5e9023){logger[_0xcbe2('0xa')]('ShowZohoAccount',_0x3cffd1);logger['debug'](_0xcbe2('0x1e'),_0x3cffd1,JSON['stringify'](_0x5e9023));_0x8824fc(_0x5e9023);})[_0xcbe2('0x12')](function(_0xc0cc08){logger[_0xcbe2('0xe')]('ShowZohoAccount',_0xc0cc08[_0xcbe2('0x10')],_0x3cffd1);_0x39ab14(_0x3744f3[_0xcbe2('0xe')](0x1f4,_0xc0cc08['message']));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index fb2db91..872fb82 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 _0x4d13=['destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','/:id','get','/:id/fields','getFields','/:id/subjects','getSubjects','getDescriptions','put','update'];(function(_0x1f30f5,_0x20c31b){var _0x9942af=function(_0x2d2adf){while(--_0x2d2adf){_0x1f30f5['push'](_0x1f30f5['shift']());}};_0x9942af(++_0x20c31b);}(_0x4d13,0x112));var _0x34d1=function(_0x30eea3,_0x92645b){_0x30eea3=_0x30eea3-0x0;var _0x30ccf6=_0x4d13[_0x30eea3];return _0x30ccf6;};'use strict';var multer=require(_0x34d1('0x0'));var util=require(_0x34d1('0x1'));var path=require(_0x34d1('0x2'));var timeout=require(_0x34d1('0x3'));var express=require(_0x34d1('0x4'));var router=express[_0x34d1('0x5')]();var fs_extra=require(_0x34d1('0x6'));var auth=require(_0x34d1('0x7'));var interaction=require(_0x34d1('0x8'));var config=require('../../config/environment');var controller=require('./intZohoConfiguration.controller');router['get']('/',auth[_0x34d1('0x9')](),controller[_0x34d1('0xa')]);router['get'](_0x34d1('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x34d1('0xc')](_0x34d1('0xd'),auth[_0x34d1('0x9')](),controller[_0x34d1('0xe')]);router['get'](_0x34d1('0xf'),auth[_0x34d1('0x9')](),controller[_0x34d1('0x10')]);router['get']('/:id/descriptions',auth[_0x34d1('0x9')](),controller[_0x34d1('0x11')]);router['post']('/',auth[_0x34d1('0x9')](),controller['create']);router[_0x34d1('0x12')](_0x34d1('0xb'),auth[_0x34d1('0x9')](),controller[_0x34d1('0x13')]);router['delete'](_0x34d1('0xb'),auth['isAuthenticated'](),controller[_0x34d1('0x14')]);module['exports']=router; \ No newline at end of file +var _0xc577=['/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','put','update','delete','exports','multer','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','show','getFields'];(function(_0x38d3bd,_0x49f837){var _0x19022c=function(_0x30341f){while(--_0x30341f){_0x38d3bd['push'](_0x38d3bd['shift']());}};_0x19022c(++_0x49f837);}(_0xc577,0x8c));var _0x7c57=function(_0x5afa42,_0x30a006){_0x5afa42=_0x5afa42-0x0;var _0x10e567=_0xc577[_0x5afa42];return _0x10e567;};'use strict';var multer=require(_0x7c57('0x0'));var util=require(_0x7c57('0x1'));var path=require(_0x7c57('0x2'));var timeout=require('connect-timeout');var express=require(_0x7c57('0x3'));var router=express[_0x7c57('0x4')]();var fs_extra=require(_0x7c57('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x7c57('0x6'));var config=require(_0x7c57('0x7'));var controller=require('./intZohoConfiguration.controller');router[_0x7c57('0x8')]('/',auth['isAuthenticated'](),controller[_0x7c57('0x9')]);router['get'](_0x7c57('0xa'),auth[_0x7c57('0xb')](),controller[_0x7c57('0xc')]);router[_0x7c57('0x8')]('/:id/fields',auth[_0x7c57('0xb')](),controller[_0x7c57('0xd')]);router[_0x7c57('0x8')](_0x7c57('0xe'),auth[_0x7c57('0xb')](),controller[_0x7c57('0xf')]);router[_0x7c57('0x8')](_0x7c57('0x10'),auth[_0x7c57('0xb')](),controller[_0x7c57('0x11')]);router['post']('/',auth[_0x7c57('0xb')](),controller['create']);router[_0x7c57('0x12')](_0x7c57('0xa'),auth['isAuthenticated'](),controller[_0x7c57('0x13')]);router[_0x7c57('0x14')](_0x7c57('0xa'),auth[_0x7c57('0xb')](),controller['destroy']);module[_0x7c57('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 9d54f9a..bf5fec0 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 _0xd7b1=['contact','nothing','contact_lead','exports','STRING','ENUM','lead'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0xd7b1,0xd5));var _0x1d7b=function(_0x16a9b7,_0x19a43b){_0x16a9b7=_0x16a9b7-0x0;var _0x24b95d=_0xd7b1[_0x16a9b7];return _0x24b95d;};'use strict';var Sequelize=require('sequelize');module[_0x1d7b('0x0')]={'name':{'type':Sequelize[_0x1d7b('0x1')]},'moduleCreate':{'type':Sequelize[_0x1d7b('0x2')](_0x1d7b('0x3'),_0x1d7b('0x4'),_0x1d7b('0x5')),'defaultValue':_0x1d7b('0x3')},'moduleSearch':{'type':Sequelize[_0x1d7b('0x2')](_0x1d7b('0x6'),_0x1d7b('0x4'),_0x1d7b('0x3')),'defaultValue':'contact_lead'},'description':{'type':Sequelize[_0x1d7b('0x1')]}}; \ No newline at end of file +var _0x9581=['nothing','contact_lead','exports','ENUM','lead','contact'];(function(_0x9efdf2,_0xeee8c2){var _0x2fa260=function(_0x58d9c0){while(--_0x58d9c0){_0x9efdf2['push'](_0x9efdf2['shift']());}};_0x2fa260(++_0xeee8c2);}(_0x9581,0x110));var _0x1958=function(_0x368f72,_0x32d0d7){_0x368f72=_0x368f72-0x0;var _0x16b632=_0x9581[_0x368f72];return _0x16b632;};'use strict';var Sequelize=require('sequelize');module[_0x1958('0x0')]={'name':{'type':Sequelize['STRING']},'moduleCreate':{'type':Sequelize[_0x1958('0x1')](_0x1958('0x2'),_0x1958('0x3'),_0x1958('0x4')),'defaultValue':_0x1958('0x2')},'moduleSearch':{'type':Sequelize['ENUM'](_0x1958('0x5'),_0x1958('0x3'),_0x1958('0x2')),'defaultValue':'contact_lead'},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index 153d1b9..48cdcff 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 _0x1c67=['querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','ZohoConfiguration','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','pick','filter','where','VIRTUAL','merge','includeAll','include','findAll','rows','show','params','options','find','catch','create','body','getFields','findOne','ZohoField','length','order','getSubjects','getDescriptions','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js'];(function(_0x8e1c4d,_0x54e064){var _0x4f18b3=function(_0x33d44b){while(--_0x33d44b){_0x8e1c4d['push'](_0x8e1c4d['shift']());}};_0x4f18b3(++_0x54e064);}(_0x1c67,0x1d8));var _0x71c6=function(_0x5b9465,_0x8cfbc7){_0x5b9465=_0x5b9465-0x0;var _0x24d44d=_0x1c67[_0x5b9465];return _0x24d44d;};'use strict';var emlformat=require(_0x71c6('0x0'));var rimraf=require(_0x71c6('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x71c6('0x2'));var rp=require(_0x71c6('0x3'));var moment=require('moment');var BPromise=require(_0x71c6('0x4'));var Mustache=require(_0x71c6('0x5'));var util=require('util');var path=require(_0x71c6('0x6'));var sox=require('sox');var csv=require(_0x71c6('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x71c6('0x8'));var _=require(_0x71c6('0x9'));var squel=require(_0x71c6('0xa'));var crypto=require(_0x71c6('0xb'));var jsforce=require(_0x71c6('0xc'));var deskjs=require(_0x71c6('0xd'));var toCsv=require(_0x71c6('0x7'));var querystring=require(_0x71c6('0xe'));var Papa=require(_0x71c6('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x71c6('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x71c6('0x11'));var logger=require(_0x71c6('0x12'))(_0x71c6('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x71c6('0x14'));var db=require(_0x71c6('0x15'))['db'];function respondWithStatusCode(_0x15df8d,_0x3e4d60){_0x3e4d60=_0x3e4d60||0xcc;return function(_0x33f465){if(_0x33f465){return _0x15df8d[_0x71c6('0x16')](_0x3e4d60);}return _0x15df8d[_0x71c6('0x17')](_0x3e4d60)[_0x71c6('0x18')]();};}function respondWithResult(_0x703570,_0x4982a0){_0x4982a0=_0x4982a0||0xc8;return function(_0x59eb35){if(_0x59eb35){return _0x703570[_0x71c6('0x17')](_0x4982a0)[_0x71c6('0x19')](_0x59eb35);}};}function respondWithFilteredResult(_0x36d2a6,_0x321904){return function(_0x29b46d){if(_0x29b46d){var _0x5f3bfa=typeof _0x321904[_0x71c6('0x1a')]===_0x71c6('0x1b')&&typeof _0x321904[_0x71c6('0x1c')]===_0x71c6('0x1b');var _0x58bc1d=_0x29b46d[_0x71c6('0x1d')];var _0x373394=_0x5f3bfa?0x0:_0x321904[_0x71c6('0x1a')];var _0x1977de=_0x5f3bfa?_0x29b46d[_0x71c6('0x1d')]:_0x321904[_0x71c6('0x1a')]+_0x321904[_0x71c6('0x1c')];var _0x12a429;if(_0x1977de>=_0x58bc1d){_0x1977de=_0x58bc1d;_0x12a429=0xc8;}else{_0x12a429=0xce;}_0x36d2a6['status'](_0x12a429);return _0x36d2a6[_0x71c6('0x1e')](_0x71c6('0x1f'),_0x373394+'-'+_0x1977de+'/'+_0x58bc1d)[_0x71c6('0x19')](_0x29b46d);}return null;};}function patchUpdates(_0x296414){return function(_0x3a769b){try{jsonpatch[_0x71c6('0x20')](_0x3a769b,_0x296414,!![]);}catch(_0x5a49c7){return BPromise[_0x71c6('0x21')](_0x5a49c7);}return _0x3a769b[_0x71c6('0x22')]();};}function saveUpdates(_0xf98996,_0x20824e){return function(_0x50cac8){if(_0x50cac8){return _0x50cac8[_0x71c6('0x23')](_0xf98996)[_0x71c6('0x24')](function(_0x36daf5){return _0x36daf5;});}return null;};}function removeEntity(_0x311b52,_0x2ccbfb){return function(_0x26dc4b){if(_0x26dc4b){return _0x26dc4b[_0x71c6('0x25')]()['then'](function(){_0x311b52['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5b6358,_0x5525af){return function(_0x22b86d){if(!_0x22b86d){_0x5b6358[_0x71c6('0x16')](0x194);}return _0x22b86d;};}function handleError(_0x4ec5be,_0x47b02a){_0x47b02a=_0x47b02a||0x1f4;return function(_0x828e8a){logger[_0x71c6('0x26')](_0x828e8a[_0x71c6('0x27')]);if(_0x828e8a[_0x71c6('0x28')]){delete _0x828e8a['name'];}_0x4ec5be[_0x71c6('0x17')](_0x47b02a)[_0x71c6('0x29')](_0x828e8a);};}exports[_0x71c6('0x2a')]=function(_0x4194e8,_0x2dd16c){var _0x4a6e91={},_0x94134={},_0x11d653={'count':0x0,'rows':[]};var _0x186fbb=_[_0x71c6('0x2b')](db[_0x71c6('0x2c')][_0x71c6('0x2d')],function(_0x1690c2){return{'name':_0x1690c2[_0x71c6('0x2e')],'type':_0x1690c2[_0x71c6('0x2f')]['key']};});_0x94134[_0x71c6('0x30')]=_[_0x71c6('0x2b')](_0x186fbb,_0x71c6('0x28'));_0x94134[_0x71c6('0x31')]=_[_0x71c6('0x32')](_0x4194e8[_0x71c6('0x31')]);_0x94134[_0x71c6('0x33')]=_[_0x71c6('0x34')](_0x94134[_0x71c6('0x30')],_0x94134[_0x71c6('0x31')]);_0x4a6e91[_0x71c6('0x35')]=_[_0x71c6('0x34')](_0x94134[_0x71c6('0x30')],qs[_0x71c6('0x36')](_0x4194e8[_0x71c6('0x31')]['fields']));_0x4a6e91[_0x71c6('0x35')]=_0x4a6e91[_0x71c6('0x35')]['length']?_0x4a6e91[_0x71c6('0x35')]:_0x94134[_0x71c6('0x30')];if(!_0x4194e8[_0x71c6('0x31')][_0x71c6('0x37')](_0x71c6('0x38'))){_0x4a6e91['limit']=qs[_0x71c6('0x1c')](_0x4194e8[_0x71c6('0x31')][_0x71c6('0x1c')]);_0x4a6e91['offset']=qs[_0x71c6('0x1a')](_0x4194e8[_0x71c6('0x31')]['offset']);}_0x4a6e91['order']=qs[_0x71c6('0x39')](_0x4194e8[_0x71c6('0x31')][_0x71c6('0x39')]);_0x4a6e91['where']=qs[_0x71c6('0x33')](_[_0x71c6('0x3a')](_0x4194e8[_0x71c6('0x31')],_0x94134[_0x71c6('0x33')]),_0x186fbb);if(_0x4194e8[_0x71c6('0x31')][_0x71c6('0x3b')]){_0x4a6e91[_0x71c6('0x3c')]=_['merge'](_0x4a6e91[_0x71c6('0x3c')],{'$or':_[_0x71c6('0x2b')](_0x186fbb,function(_0x2f11f9){if(_0x2f11f9['type']!==_0x71c6('0x3d')){var _0x5bd77e={};_0x5bd77e[_0x2f11f9[_0x71c6('0x28')]]={'$like':'%'+_0x4194e8[_0x71c6('0x31')][_0x71c6('0x3b')]+'%'};return _0x5bd77e;}})});}_0x4a6e91=_[_0x71c6('0x3e')]({},_0x4a6e91,_0x4194e8['options']);var _0x3676f7={'where':_0x4a6e91[_0x71c6('0x3c')]};return db[_0x71c6('0x2c')][_0x71c6('0x1d')](_0x3676f7)[_0x71c6('0x24')](function(_0x41288e){_0x11d653[_0x71c6('0x1d')]=_0x41288e;if(_0x4194e8['query'][_0x71c6('0x3f')]){_0x4a6e91[_0x71c6('0x40')]=[{'all':!![]}];}return db[_0x71c6('0x2c')][_0x71c6('0x41')](_0x4a6e91);})['then'](function(_0x298a02){_0x11d653[_0x71c6('0x42')]=_0x298a02;return _0x11d653;})[_0x71c6('0x24')](respondWithFilteredResult(_0x2dd16c,_0x4a6e91))['catch'](handleError(_0x2dd16c,null));};exports[_0x71c6('0x43')]=function(_0x4b0c75,_0x241182){var _0x30d9f8={'raw':![],'where':{'id':_0x4b0c75[_0x71c6('0x44')]['id']}},_0x2e036c={};_0x2e036c[_0x71c6('0x30')]=_[_0x71c6('0x32')](db['ZohoConfiguration'][_0x71c6('0x2d')]);_0x2e036c['query']=_['keys'](_0x4b0c75[_0x71c6('0x31')]);_0x2e036c[_0x71c6('0x33')]=_[_0x71c6('0x34')](_0x2e036c['model'],_0x2e036c[_0x71c6('0x31')]);_0x30d9f8[_0x71c6('0x35')]=_[_0x71c6('0x34')](_0x2e036c[_0x71c6('0x30')],qs[_0x71c6('0x36')](_0x4b0c75[_0x71c6('0x31')]['fields']));_0x30d9f8[_0x71c6('0x35')]=_0x30d9f8['attributes']['length']?_0x30d9f8['attributes']:_0x2e036c['model'];if(_0x4b0c75['query'][_0x71c6('0x3f')]){_0x30d9f8[_0x71c6('0x40')]=[{'all':!![]}];}_0x30d9f8=_[_0x71c6('0x3e')]({},_0x30d9f8,_0x4b0c75[_0x71c6('0x45')]);return db[_0x71c6('0x2c')][_0x71c6('0x46')](_0x30d9f8)[_0x71c6('0x24')](handleEntityNotFound(_0x241182,null))[_0x71c6('0x24')](respondWithResult(_0x241182,null))[_0x71c6('0x47')](handleError(_0x241182,null));};exports[_0x71c6('0x48')]=function(_0x1a3a76,_0x245175){return db[_0x71c6('0x2c')]['create'](_0x1a3a76[_0x71c6('0x49')],{})['then'](respondWithResult(_0x245175,0xc9))['catch'](handleError(_0x245175,null));};exports['update']=function(_0x100e47,_0x1c35c7){if(_0x100e47[_0x71c6('0x49')]['id']){delete _0x100e47[_0x71c6('0x49')]['id'];}return db[_0x71c6('0x2c')][_0x71c6('0x46')]({'where':{'id':_0x100e47[_0x71c6('0x44')]['id']}})[_0x71c6('0x24')](handleEntityNotFound(_0x1c35c7,null))[_0x71c6('0x24')](saveUpdates(_0x100e47['body'],null))[_0x71c6('0x24')](respondWithResult(_0x1c35c7,null))['catch'](handleError(_0x1c35c7,null));};exports[_0x71c6('0x25')]=function(_0x8ed347,_0x5431c4){return db[_0x71c6('0x2c')][_0x71c6('0x46')]({'where':{'id':_0x8ed347[_0x71c6('0x44')]['id']}})['then'](handleEntityNotFound(_0x5431c4,null))[_0x71c6('0x24')](removeEntity(_0x5431c4,null))['catch'](handleError(_0x5431c4,null));};exports[_0x71c6('0x4a')]=function(_0x540f85,_0x44e05c,_0x4db2fd){var _0x124a9e={};var _0x220cd2={};var _0x4c0938;var _0x185858;return db[_0x71c6('0x2c')][_0x71c6('0x4b')]({'where':{'id':_0x540f85[_0x71c6('0x44')]['id']}})[_0x71c6('0x24')](handleEntityNotFound(_0x44e05c,null))[_0x71c6('0x24')](function(_0x3fbfba){if(_0x3fbfba){_0x4c0938=_0x3fbfba;_0x220cd2[_0x71c6('0x30')]=_[_0x71c6('0x32')](db[_0x71c6('0x4c')]['rawAttributes']);_0x220cd2[_0x71c6('0x31')]=_[_0x71c6('0x32')](_0x540f85['query']);_0x220cd2['filters']=_[_0x71c6('0x34')](_0x220cd2[_0x71c6('0x30')],_0x220cd2[_0x71c6('0x31')]);_0x124a9e[_0x71c6('0x35')]=_[_0x71c6('0x34')](_0x220cd2[_0x71c6('0x30')],qs[_0x71c6('0x36')](_0x540f85['query'][_0x71c6('0x36')]));_0x124a9e[_0x71c6('0x35')]=_0x124a9e[_0x71c6('0x35')][_0x71c6('0x4d')]?_0x124a9e['attributes']:_0x220cd2[_0x71c6('0x30')];_0x124a9e[_0x71c6('0x4e')]=qs[_0x71c6('0x39')](_0x540f85[_0x71c6('0x31')]['sort']);_0x124a9e[_0x71c6('0x3c')]=qs['filters'](_[_0x71c6('0x3a')](_0x540f85[_0x71c6('0x31')],_0x220cd2[_0x71c6('0x33')]));if(_0x540f85[_0x71c6('0x31')][_0x71c6('0x3b')]){_0x124a9e[_0x71c6('0x3c')]=_[_0x71c6('0x3e')](_0x124a9e[_0x71c6('0x3c')],{'$or':_[_0x71c6('0x2b')](_0x124a9e[_0x71c6('0x35')],function(_0x1f6ed0){var _0x33f3c9={};_0x33f3c9[_0x1f6ed0]={'$like':'%'+_0x540f85[_0x71c6('0x31')]['filter']+'%'};return _0x33f3c9;})});}_0x124a9e=_['merge']({},_0x124a9e,_0x540f85[_0x71c6('0x45')]);return _0x4c0938['getFields'](_0x124a9e);}})[_0x71c6('0x24')](function(_0x314c2c){if(_0x314c2c){_0x185858=_0x314c2c['length'];if(!_0x540f85[_0x71c6('0x31')][_0x71c6('0x37')](_0x71c6('0x38'))){_0x124a9e['limit']=qs['limit'](_0x540f85[_0x71c6('0x31')][_0x71c6('0x1c')]);_0x124a9e['offset']=qs[_0x71c6('0x1a')](_0x540f85[_0x71c6('0x31')]['offset']);}return _0x4c0938[_0x71c6('0x4a')](_0x124a9e);}})[_0x71c6('0x24')](function(_0x55f402){if(_0x55f402){return _0x55f402?{'count':_0x185858,'rows':_0x55f402}:null;}})[_0x71c6('0x24')](respondWithResult(_0x44e05c,null))[_0x71c6('0x47')](handleError(_0x44e05c,null));};exports[_0x71c6('0x4f')]=function(_0x5ac285,_0x5df839,_0x1f7239){var _0x14b821={};var _0x1230c6={};var _0x317ee4;var _0xe34fea;return db[_0x71c6('0x2c')][_0x71c6('0x4b')]({'where':{'id':_0x5ac285[_0x71c6('0x44')]['id']}})[_0x71c6('0x24')](handleEntityNotFound(_0x5df839,null))[_0x71c6('0x24')](function(_0x4c1bc2){if(_0x4c1bc2){_0x317ee4=_0x4c1bc2;_0x1230c6[_0x71c6('0x30')]=_[_0x71c6('0x32')](db[_0x71c6('0x4c')]['rawAttributes']);_0x1230c6['query']=_[_0x71c6('0x32')](_0x5ac285[_0x71c6('0x31')]);_0x1230c6[_0x71c6('0x33')]=_[_0x71c6('0x34')](_0x1230c6['model'],_0x1230c6[_0x71c6('0x31')]);_0x14b821['attributes']=_[_0x71c6('0x34')](_0x1230c6['model'],qs[_0x71c6('0x36')](_0x5ac285[_0x71c6('0x31')]['fields']));_0x14b821[_0x71c6('0x35')]=_0x14b821['attributes']['length']?_0x14b821[_0x71c6('0x35')]:_0x1230c6[_0x71c6('0x30')];_0x14b821[_0x71c6('0x4e')]=qs[_0x71c6('0x39')](_0x5ac285['query']['sort']);_0x14b821[_0x71c6('0x3c')]=qs['filters'](_[_0x71c6('0x3a')](_0x5ac285[_0x71c6('0x31')],_0x1230c6[_0x71c6('0x33')]));if(_0x5ac285[_0x71c6('0x31')]['filter']){_0x14b821[_0x71c6('0x3c')]=_[_0x71c6('0x3e')](_0x14b821['where'],{'$or':_[_0x71c6('0x2b')](_0x14b821[_0x71c6('0x35')],function(_0x250fc2){var _0x5e5136={};_0x5e5136[_0x250fc2]={'$like':'%'+_0x5ac285[_0x71c6('0x31')][_0x71c6('0x3b')]+'%'};return _0x5e5136;})});}_0x14b821=_[_0x71c6('0x3e')]({},_0x14b821,_0x5ac285[_0x71c6('0x45')]);return _0x317ee4[_0x71c6('0x4f')](_0x14b821);}})[_0x71c6('0x24')](function(_0x54be24){if(_0x54be24){_0xe34fea=_0x54be24[_0x71c6('0x4d')];if(!_0x5ac285[_0x71c6('0x31')][_0x71c6('0x37')](_0x71c6('0x38'))){_0x14b821[_0x71c6('0x1c')]=qs['limit'](_0x5ac285[_0x71c6('0x31')]['limit']);_0x14b821[_0x71c6('0x1a')]=qs['offset'](_0x5ac285[_0x71c6('0x31')][_0x71c6('0x1a')]);}return _0x317ee4[_0x71c6('0x4f')](_0x14b821);}})['then'](function(_0x369e15){if(_0x369e15){return _0x369e15?{'count':_0xe34fea,'rows':_0x369e15}:null;}})['then'](respondWithResult(_0x5df839,null))[_0x71c6('0x47')](handleError(_0x5df839,null));};exports[_0x71c6('0x50')]=function(_0x162b48,_0x4038d8,_0x8b018e){var _0x4d71e3={};var _0x414765={};var _0x256ab2;var _0x59217d;return db[_0x71c6('0x2c')][_0x71c6('0x4b')]({'where':{'id':_0x162b48[_0x71c6('0x44')]['id']}})[_0x71c6('0x24')](handleEntityNotFound(_0x4038d8,null))[_0x71c6('0x24')](function(_0x1d4933){if(_0x1d4933){_0x256ab2=_0x1d4933;_0x414765[_0x71c6('0x30')]=_[_0x71c6('0x32')](db[_0x71c6('0x4c')][_0x71c6('0x2d')]);_0x414765[_0x71c6('0x31')]=_['keys'](_0x162b48['query']);_0x414765[_0x71c6('0x33')]=_[_0x71c6('0x34')](_0x414765[_0x71c6('0x30')],_0x414765[_0x71c6('0x31')]);_0x4d71e3[_0x71c6('0x35')]=_[_0x71c6('0x34')](_0x414765['model'],qs[_0x71c6('0x36')](_0x162b48[_0x71c6('0x31')][_0x71c6('0x36')]));_0x4d71e3[_0x71c6('0x35')]=_0x4d71e3[_0x71c6('0x35')][_0x71c6('0x4d')]?_0x4d71e3[_0x71c6('0x35')]:_0x414765[_0x71c6('0x30')];_0x4d71e3[_0x71c6('0x4e')]=qs['sort'](_0x162b48[_0x71c6('0x31')][_0x71c6('0x39')]);_0x4d71e3[_0x71c6('0x3c')]=qs[_0x71c6('0x33')](_[_0x71c6('0x3a')](_0x162b48[_0x71c6('0x31')],_0x414765['filters']));if(_0x162b48[_0x71c6('0x31')][_0x71c6('0x3b')]){_0x4d71e3[_0x71c6('0x3c')]=_[_0x71c6('0x3e')](_0x4d71e3[_0x71c6('0x3c')],{'$or':_[_0x71c6('0x2b')](_0x4d71e3[_0x71c6('0x35')],function(_0x58cb73){var _0x3e6bde={};_0x3e6bde[_0x58cb73]={'$like':'%'+_0x162b48[_0x71c6('0x31')][_0x71c6('0x3b')]+'%'};return _0x3e6bde;})});}_0x4d71e3=_[_0x71c6('0x3e')]({},_0x4d71e3,_0x162b48['options']);return _0x256ab2[_0x71c6('0x50')](_0x4d71e3);}})[_0x71c6('0x24')](function(_0x35524d){if(_0x35524d){_0x59217d=_0x35524d[_0x71c6('0x4d')];if(!_0x162b48[_0x71c6('0x31')]['hasOwnProperty'](_0x71c6('0x38'))){_0x4d71e3['limit']=qs[_0x71c6('0x1c')](_0x162b48['query'][_0x71c6('0x1c')]);_0x4d71e3[_0x71c6('0x1a')]=qs[_0x71c6('0x1a')](_0x162b48['query'][_0x71c6('0x1a')]);}return _0x256ab2[_0x71c6('0x50')](_0x4d71e3);}})[_0x71c6('0x24')](function(_0x25c1b8){if(_0x25c1b8){return _0x25c1b8?{'count':_0x59217d,'rows':_0x25c1b8}:null;}})[_0x71c6('0x24')](respondWithResult(_0x4038d8,null))[_0x71c6('0x47')](handleError(_0x4038d8,null));}; \ No newline at end of file +var _0x5435=['crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','offset','count','limit','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','index','map','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','ZohoConfiguration','include','findAll','rows','catch','show','params','rawAttributes','includeAll','find','create','body','findOne','pick','getFields','getSubjects','ZohoField','getDescriptions','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel'];(function(_0x3b9cd4,_0x516261){var _0x494a1e=function(_0x37d3c1){while(--_0x37d3c1){_0x3b9cd4['push'](_0x3b9cd4['shift']());}};_0x494a1e(++_0x516261);}(_0x5435,0x17f));var _0x5543=function(_0x416b88,_0x1b8e64){_0x416b88=_0x416b88-0x0;var _0x4e80a9=_0x5435[_0x416b88];return _0x4e80a9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5543('0x0'));var zipdir=require(_0x5543('0x1'));var jsonpatch=require(_0x5543('0x2'));var rp=require('request-promise');var moment=require(_0x5543('0x3'));var BPromise=require(_0x5543('0x4'));var Mustache=require('mustache');var util=require(_0x5543('0x5'));var path=require(_0x5543('0x6'));var sox=require(_0x5543('0x7'));var csv=require(_0x5543('0x8'));var ejs=require(_0x5543('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5543('0xa'));var squel=require(_0x5543('0xb'));var crypto=require(_0x5543('0xc'));var jsforce=require(_0x5543('0xd'));var deskjs=require(_0x5543('0xe'));var toCsv=require(_0x5543('0x8'));var querystring=require(_0x5543('0xf'));var Papa=require(_0x5543('0x10'));var Redis=require(_0x5543('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x5543('0x12'));var as=require(_0x5543('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5543('0x14'))(_0x5543('0x15'));var utils=require(_0x5543('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x5543('0x17'));var db=require(_0x5543('0x18'))['db'];function respondWithStatusCode(_0x4d0de1,_0x7cf8b1){_0x7cf8b1=_0x7cf8b1||0xcc;return function(_0x55d1d1){if(_0x55d1d1){return _0x4d0de1['sendStatus'](_0x7cf8b1);}return _0x4d0de1[_0x5543('0x19')](_0x7cf8b1)['end']();};}function respondWithResult(_0x11232d,_0x344429){_0x344429=_0x344429||0xc8;return function(_0x94cec6){if(_0x94cec6){return _0x11232d[_0x5543('0x19')](_0x344429)['json'](_0x94cec6);}};}function respondWithFilteredResult(_0x406466,_0x27ec7d){return function(_0x3d69ad){if(_0x3d69ad){var _0x2d9312=typeof _0x27ec7d[_0x5543('0x1a')]==='undefined'&&typeof _0x27ec7d['limit']==='undefined';var _0x23e49d=_0x3d69ad[_0x5543('0x1b')];var _0x367d05=_0x2d9312?0x0:_0x27ec7d[_0x5543('0x1a')];var _0x32d98f=_0x2d9312?_0x3d69ad[_0x5543('0x1b')]:_0x27ec7d['offset']+_0x27ec7d[_0x5543('0x1c')];var _0x883709;if(_0x32d98f>=_0x23e49d){_0x32d98f=_0x23e49d;_0x883709=0xc8;}else{_0x883709=0xce;}_0x406466[_0x5543('0x19')](_0x883709);return _0x406466[_0x5543('0x1d')](_0x5543('0x1e'),_0x367d05+'-'+_0x32d98f+'/'+_0x23e49d)['json'](_0x3d69ad);}return null;};}function patchUpdates(_0x3bcb8f){return function(_0x1a06ea){try{jsonpatch[_0x5543('0x1f')](_0x1a06ea,_0x3bcb8f,!![]);}catch(_0x413224){return BPromise['reject'](_0x413224);}return _0x1a06ea[_0x5543('0x20')]();};}function saveUpdates(_0x2ebd0c,_0x35aaaa){return function(_0x1b51b8){if(_0x1b51b8){return _0x1b51b8[_0x5543('0x21')](_0x2ebd0c)[_0x5543('0x22')](function(_0x2671cf){return _0x2671cf;});}return null;};}function removeEntity(_0x5c2cd4,_0x237b5a){return function(_0x29f63d){if(_0x29f63d){return _0x29f63d[_0x5543('0x23')]()[_0x5543('0x22')](function(){_0x5c2cd4[_0x5543('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3f3cb1,_0x52c08e){return function(_0x352e13){if(!_0x352e13){_0x3f3cb1['sendStatus'](0x194);}return _0x352e13;};}function handleError(_0x5f5acc,_0x1e428d){_0x1e428d=_0x1e428d||0x1f4;return function(_0x364a1d){logger[_0x5543('0x24')](_0x364a1d[_0x5543('0x25')]);if(_0x364a1d[_0x5543('0x26')]){delete _0x364a1d[_0x5543('0x26')];}_0x5f5acc[_0x5543('0x19')](_0x1e428d)[_0x5543('0x27')](_0x364a1d);};}exports[_0x5543('0x28')]=function(_0xf0eca8,_0x44f333){var _0x1e6c05={},_0x12ec85={},_0x4106f6={'count':0x0,'rows':[]};var _0x261904=_[_0x5543('0x29')](db['ZohoConfiguration']['rawAttributes'],function(_0x1ba947){return{'name':_0x1ba947[_0x5543('0x2a')],'type':_0x1ba947[_0x5543('0x2b')][_0x5543('0x2c')]};});_0x12ec85[_0x5543('0x2d')]=_[_0x5543('0x29')](_0x261904,'name');_0x12ec85[_0x5543('0x2e')]=_[_0x5543('0x2f')](_0xf0eca8[_0x5543('0x2e')]);_0x12ec85[_0x5543('0x30')]=_[_0x5543('0x31')](_0x12ec85[_0x5543('0x2d')],_0x12ec85['query']);_0x1e6c05[_0x5543('0x32')]=_['intersection'](_0x12ec85[_0x5543('0x2d')],qs['fields'](_0xf0eca8[_0x5543('0x2e')][_0x5543('0x33')]));_0x1e6c05[_0x5543('0x32')]=_0x1e6c05['attributes'][_0x5543('0x34')]?_0x1e6c05[_0x5543('0x32')]:_0x12ec85['model'];if(!_0xf0eca8[_0x5543('0x2e')][_0x5543('0x35')](_0x5543('0x36'))){_0x1e6c05[_0x5543('0x1c')]=qs[_0x5543('0x1c')](_0xf0eca8['query']['limit']);_0x1e6c05[_0x5543('0x1a')]=qs['offset'](_0xf0eca8['query'][_0x5543('0x1a')]);}_0x1e6c05[_0x5543('0x37')]=qs['sort'](_0xf0eca8['query'][_0x5543('0x38')]);_0x1e6c05[_0x5543('0x39')]=qs[_0x5543('0x30')](_['pick'](_0xf0eca8[_0x5543('0x2e')],_0x12ec85['filters']),_0x261904);if(_0xf0eca8[_0x5543('0x2e')][_0x5543('0x3a')]){_0x1e6c05[_0x5543('0x39')]=_[_0x5543('0x3b')](_0x1e6c05[_0x5543('0x39')],{'$or':_['map'](_0x261904,function(_0xca2c71){if(_0xca2c71[_0x5543('0x2b')]!=='VIRTUAL'){var _0x2feb93={};_0x2feb93[_0xca2c71['name']]={'$like':'%'+_0xf0eca8[_0x5543('0x2e')][_0x5543('0x3a')]+'%'};return _0x2feb93;}})});}_0x1e6c05=_[_0x5543('0x3b')]({},_0x1e6c05,_0xf0eca8[_0x5543('0x3c')]);var _0x3b9f2d={'where':_0x1e6c05[_0x5543('0x39')]};return db[_0x5543('0x3d')][_0x5543('0x1b')](_0x3b9f2d)['then'](function(_0x8c3cc3){_0x4106f6[_0x5543('0x1b')]=_0x8c3cc3;if(_0xf0eca8[_0x5543('0x2e')]['includeAll']){_0x1e6c05[_0x5543('0x3e')]=[{'all':!![]}];}return db[_0x5543('0x3d')][_0x5543('0x3f')](_0x1e6c05);})[_0x5543('0x22')](function(_0x38b01a){_0x4106f6[_0x5543('0x40')]=_0x38b01a;return _0x4106f6;})[_0x5543('0x22')](respondWithFilteredResult(_0x44f333,_0x1e6c05))[_0x5543('0x41')](handleError(_0x44f333,null));};exports[_0x5543('0x42')]=function(_0x516da8,_0x13e47a){var _0x5d9f91={'raw':![],'where':{'id':_0x516da8[_0x5543('0x43')]['id']}},_0x5b4454={};_0x5b4454[_0x5543('0x2d')]=_['keys'](db[_0x5543('0x3d')][_0x5543('0x44')]);_0x5b4454[_0x5543('0x2e')]=_[_0x5543('0x2f')](_0x516da8['query']);_0x5b4454['filters']=_['intersection'](_0x5b4454['model'],_0x5b4454[_0x5543('0x2e')]);_0x5d9f91[_0x5543('0x32')]=_[_0x5543('0x31')](_0x5b4454[_0x5543('0x2d')],qs[_0x5543('0x33')](_0x516da8[_0x5543('0x2e')][_0x5543('0x33')]));_0x5d9f91[_0x5543('0x32')]=_0x5d9f91['attributes'][_0x5543('0x34')]?_0x5d9f91[_0x5543('0x32')]:_0x5b4454['model'];if(_0x516da8[_0x5543('0x2e')][_0x5543('0x45')]){_0x5d9f91[_0x5543('0x3e')]=[{'all':!![]}];}_0x5d9f91=_[_0x5543('0x3b')]({},_0x5d9f91,_0x516da8['options']);return db[_0x5543('0x3d')][_0x5543('0x46')](_0x5d9f91)[_0x5543('0x22')](handleEntityNotFound(_0x13e47a,null))['then'](respondWithResult(_0x13e47a,null))['catch'](handleError(_0x13e47a,null));};exports[_0x5543('0x47')]=function(_0x4d8921,_0x3b41df){return db['ZohoConfiguration'][_0x5543('0x47')](_0x4d8921[_0x5543('0x48')],{})[_0x5543('0x22')](respondWithResult(_0x3b41df,0xc9))[_0x5543('0x41')](handleError(_0x3b41df,null));};exports['update']=function(_0x3c7890,_0x152168){if(_0x3c7890['body']['id']){delete _0x3c7890[_0x5543('0x48')]['id'];}return db[_0x5543('0x3d')]['find']({'where':{'id':_0x3c7890['params']['id']}})[_0x5543('0x22')](handleEntityNotFound(_0x152168,null))[_0x5543('0x22')](saveUpdates(_0x3c7890[_0x5543('0x48')],null))[_0x5543('0x22')](respondWithResult(_0x152168,null))[_0x5543('0x41')](handleError(_0x152168,null));};exports['destroy']=function(_0x123e1a,_0x3cce43){return db[_0x5543('0x3d')]['find']({'where':{'id':_0x123e1a[_0x5543('0x43')]['id']}})[_0x5543('0x22')](handleEntityNotFound(_0x3cce43,null))['then'](removeEntity(_0x3cce43,null))[_0x5543('0x41')](handleError(_0x3cce43,null));};exports['getFields']=function(_0x254be5,_0x2fdb60,_0x50682c){var _0x398df0={};var _0x529078={};var _0x3e22c1;var _0x5f32fc;return db[_0x5543('0x3d')][_0x5543('0x49')]({'where':{'id':_0x254be5[_0x5543('0x43')]['id']}})[_0x5543('0x22')](handleEntityNotFound(_0x2fdb60,null))[_0x5543('0x22')](function(_0x3ef69f){if(_0x3ef69f){_0x3e22c1=_0x3ef69f;_0x529078['model']=_[_0x5543('0x2f')](db['ZohoField'][_0x5543('0x44')]);_0x529078[_0x5543('0x2e')]=_[_0x5543('0x2f')](_0x254be5[_0x5543('0x2e')]);_0x529078[_0x5543('0x30')]=_[_0x5543('0x31')](_0x529078['model'],_0x529078[_0x5543('0x2e')]);_0x398df0['attributes']=_[_0x5543('0x31')](_0x529078[_0x5543('0x2d')],qs[_0x5543('0x33')](_0x254be5[_0x5543('0x2e')]['fields']));_0x398df0['attributes']=_0x398df0[_0x5543('0x32')][_0x5543('0x34')]?_0x398df0[_0x5543('0x32')]:_0x529078[_0x5543('0x2d')];_0x398df0[_0x5543('0x37')]=qs[_0x5543('0x38')](_0x254be5[_0x5543('0x2e')][_0x5543('0x38')]);_0x398df0['where']=qs[_0x5543('0x30')](_[_0x5543('0x4a')](_0x254be5['query'],_0x529078[_0x5543('0x30')]));if(_0x254be5[_0x5543('0x2e')][_0x5543('0x3a')]){_0x398df0[_0x5543('0x39')]=_[_0x5543('0x3b')](_0x398df0[_0x5543('0x39')],{'$or':_['map'](_0x398df0[_0x5543('0x32')],function(_0x24c304){var _0x20df33={};_0x20df33[_0x24c304]={'$like':'%'+_0x254be5[_0x5543('0x2e')][_0x5543('0x3a')]+'%'};return _0x20df33;})});}_0x398df0=_[_0x5543('0x3b')]({},_0x398df0,_0x254be5['options']);return _0x3e22c1[_0x5543('0x4b')](_0x398df0);}})[_0x5543('0x22')](function(_0x16a2c3){if(_0x16a2c3){_0x5f32fc=_0x16a2c3[_0x5543('0x34')];if(!_0x254be5[_0x5543('0x2e')][_0x5543('0x35')]('nolimit')){_0x398df0[_0x5543('0x1c')]=qs[_0x5543('0x1c')](_0x254be5[_0x5543('0x2e')][_0x5543('0x1c')]);_0x398df0[_0x5543('0x1a')]=qs[_0x5543('0x1a')](_0x254be5['query']['offset']);}return _0x3e22c1[_0x5543('0x4b')](_0x398df0);}})[_0x5543('0x22')](function(_0x3dd399){if(_0x3dd399){return _0x3dd399?{'count':_0x5f32fc,'rows':_0x3dd399}:null;}})[_0x5543('0x22')](respondWithResult(_0x2fdb60,null))['catch'](handleError(_0x2fdb60,null));};exports[_0x5543('0x4c')]=function(_0x1234b9,_0x2db13f,_0x4962d7){var _0x3803bf={};var _0x3e9a56={};var _0x1b9ae6;var _0x485b99;return db['ZohoConfiguration']['findOne']({'where':{'id':_0x1234b9['params']['id']}})['then'](handleEntityNotFound(_0x2db13f,null))[_0x5543('0x22')](function(_0x7aaabe){if(_0x7aaabe){_0x1b9ae6=_0x7aaabe;_0x3e9a56[_0x5543('0x2d')]=_[_0x5543('0x2f')](db[_0x5543('0x4d')][_0x5543('0x44')]);_0x3e9a56[_0x5543('0x2e')]=_[_0x5543('0x2f')](_0x1234b9['query']);_0x3e9a56[_0x5543('0x30')]=_[_0x5543('0x31')](_0x3e9a56[_0x5543('0x2d')],_0x3e9a56[_0x5543('0x2e')]);_0x3803bf['attributes']=_[_0x5543('0x31')](_0x3e9a56[_0x5543('0x2d')],qs[_0x5543('0x33')](_0x1234b9[_0x5543('0x2e')][_0x5543('0x33')]));_0x3803bf['attributes']=_0x3803bf['attributes']['length']?_0x3803bf['attributes']:_0x3e9a56[_0x5543('0x2d')];_0x3803bf[_0x5543('0x37')]=qs['sort'](_0x1234b9[_0x5543('0x2e')][_0x5543('0x38')]);_0x3803bf[_0x5543('0x39')]=qs['filters'](_['pick'](_0x1234b9[_0x5543('0x2e')],_0x3e9a56[_0x5543('0x30')]));if(_0x1234b9[_0x5543('0x2e')]['filter']){_0x3803bf[_0x5543('0x39')]=_[_0x5543('0x3b')](_0x3803bf[_0x5543('0x39')],{'$or':_[_0x5543('0x29')](_0x3803bf['attributes'],function(_0x1c371a){var _0x1dac59={};_0x1dac59[_0x1c371a]={'$like':'%'+_0x1234b9[_0x5543('0x2e')][_0x5543('0x3a')]+'%'};return _0x1dac59;})});}_0x3803bf=_[_0x5543('0x3b')]({},_0x3803bf,_0x1234b9[_0x5543('0x3c')]);return _0x1b9ae6[_0x5543('0x4c')](_0x3803bf);}})[_0x5543('0x22')](function(_0xb11ce3){if(_0xb11ce3){_0x485b99=_0xb11ce3[_0x5543('0x34')];if(!_0x1234b9[_0x5543('0x2e')][_0x5543('0x35')](_0x5543('0x36'))){_0x3803bf['limit']=qs['limit'](_0x1234b9['query'][_0x5543('0x1c')]);_0x3803bf['offset']=qs['offset'](_0x1234b9['query']['offset']);}return _0x1b9ae6['getSubjects'](_0x3803bf);}})[_0x5543('0x22')](function(_0x392933){if(_0x392933){return _0x392933?{'count':_0x485b99,'rows':_0x392933}:null;}})['then'](respondWithResult(_0x2db13f,null))[_0x5543('0x41')](handleError(_0x2db13f,null));};exports['getDescriptions']=function(_0x4643b6,_0x43aa37,_0x486a67){var _0x512edf={};var _0x2c98b9={};var _0x5198fa;var _0x469f99;return db[_0x5543('0x3d')][_0x5543('0x49')]({'where':{'id':_0x4643b6[_0x5543('0x43')]['id']}})['then'](handleEntityNotFound(_0x43aa37,null))[_0x5543('0x22')](function(_0x28ab0d){if(_0x28ab0d){_0x5198fa=_0x28ab0d;_0x2c98b9[_0x5543('0x2d')]=_[_0x5543('0x2f')](db[_0x5543('0x4d')][_0x5543('0x44')]);_0x2c98b9[_0x5543('0x2e')]=_['keys'](_0x4643b6['query']);_0x2c98b9[_0x5543('0x30')]=_[_0x5543('0x31')](_0x2c98b9[_0x5543('0x2d')],_0x2c98b9[_0x5543('0x2e')]);_0x512edf['attributes']=_['intersection'](_0x2c98b9[_0x5543('0x2d')],qs['fields'](_0x4643b6[_0x5543('0x2e')][_0x5543('0x33')]));_0x512edf['attributes']=_0x512edf[_0x5543('0x32')]['length']?_0x512edf['attributes']:_0x2c98b9[_0x5543('0x2d')];_0x512edf['order']=qs[_0x5543('0x38')](_0x4643b6['query'][_0x5543('0x38')]);_0x512edf[_0x5543('0x39')]=qs['filters'](_[_0x5543('0x4a')](_0x4643b6['query'],_0x2c98b9[_0x5543('0x30')]));if(_0x4643b6['query'][_0x5543('0x3a')]){_0x512edf['where']=_['merge'](_0x512edf[_0x5543('0x39')],{'$or':_[_0x5543('0x29')](_0x512edf[_0x5543('0x32')],function(_0x1cf635){var _0x4b8e20={};_0x4b8e20[_0x1cf635]={'$like':'%'+_0x4643b6['query'][_0x5543('0x3a')]+'%'};return _0x4b8e20;})});}_0x512edf=_[_0x5543('0x3b')]({},_0x512edf,_0x4643b6[_0x5543('0x3c')]);return _0x5198fa[_0x5543('0x4e')](_0x512edf);}})[_0x5543('0x22')](function(_0x4d25dd){if(_0x4d25dd){_0x469f99=_0x4d25dd[_0x5543('0x34')];if(!_0x4643b6['query'][_0x5543('0x35')](_0x5543('0x36'))){_0x512edf[_0x5543('0x1c')]=qs[_0x5543('0x1c')](_0x4643b6['query']['limit']);_0x512edf['offset']=qs['offset'](_0x4643b6[_0x5543('0x2e')][_0x5543('0x1a')]);}return _0x5198fa[_0x5543('0x4e')](_0x512edf);}})[_0x5543('0x22')](function(_0x4923c3){if(_0x4923c3){return _0x4923c3?{'count':_0x469f99,'rows':_0x4923c3}:null;}})[_0x5543('0x22')](respondWithResult(_0x43aa37,null))['catch'](handleError(_0x43aa37,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index b29f12a..e77d983 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 _0x95bb=['define','ZohoConfiguration','lodash','../../config/logger','bluebird','path','rimraf','../../config/environment','./intZohoConfiguration.attributes','exports'];(function(_0x5c18ef,_0xa2e81d){var _0x33789d=function(_0x5761a9){while(--_0x5761a9){_0x5c18ef['push'](_0x5c18ef['shift']());}};_0x33789d(++_0xa2e81d);}(_0x95bb,0x1e2));var _0xb95b=function(_0xed316,_0x26157a){_0xed316=_0xed316-0x0;var _0x4443a0=_0x95bb[_0xed316];return _0x4443a0;};'use strict';var _=require(_0xb95b('0x0'));var util=require('util');var logger=require(_0xb95b('0x1'))('api');var moment=require('moment');var BPromise=require(_0xb95b('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb95b('0x3'));var rimraf=require(_0xb95b('0x4'));var config=require(_0xb95b('0x5'));var attributes=require(_0xb95b('0x6'));module[_0xb95b('0x7')]=function(_0x1b06ac,_0x4c9502){return _0x1b06ac[_0xb95b('0x8')](_0xb95b('0x9'),attributes,{'tableName':'int_zoho_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd11c=['lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./intZohoConfiguration.attributes','exports'];(function(_0x1989cd,_0x49a8b6){var _0x5355bc=function(_0x194a5b){while(--_0x194a5b){_0x1989cd['push'](_0x1989cd['shift']());}};_0x5355bc(++_0x49a8b6);}(_0xd11c,0xbb));var _0xcd11=function(_0x594cb3,_0xe8116a){_0x594cb3=_0x594cb3-0x0;var _0x23f7a1=_0xd11c[_0x594cb3];return _0x23f7a1;};'use strict';var _=require(_0xcd11('0x0'));var util=require(_0xcd11('0x1'));var logger=require(_0xcd11('0x2'))(_0xcd11('0x3'));var moment=require(_0xcd11('0x4'));var BPromise=require(_0xcd11('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xcd11('0x6'));var rimraf=require(_0xcd11('0x7'));var config=require(_0xcd11('0x8'));var attributes=require(_0xcd11('0x9'));module[_0xcd11('0xa')]=function(_0x30adf6,_0x59dfdf){return _0x30adf6['define']('ZohoConfiguration',attributes,{'tableName':'int_zoho_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.rpc.js b/server/api/intZohoConfiguration/intZohoConfiguration.rpc.js index e13b3cf..0c17eb1 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 _0x89b9=['request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','ZohoConfiguration,\x20%s,\x20%s'];(function(_0xe070c5,_0x22f26a){var _0x7bcda2=function(_0x21a991){while(--_0x21a991){_0xe070c5['push'](_0xe070c5['shift']());}};_0x7bcda2(++_0x22f26a);}(_0x89b9,0x127));var _0x989b=function(_0x225795,_0x5f2c5e){_0x225795=_0x225795-0x0;var _0x1da0ea=_0x89b9[_0x225795];return _0x1da0ea;};'use strict';var _=require(_0x989b('0x0'));var util=require(_0x989b('0x1'));var moment=require('moment');var BPromise=require(_0x989b('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x989b('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x989b('0x4'))(_0x989b('0x5'));var config=require(_0x989b('0x6'));var jayson=require(_0x989b('0x7'));var client=jayson[_0x989b('0x8')][_0x989b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x57a554,_0x25740e,_0x1fcfcb){return new BPromise(function(_0x1890e4,_0x180907){return client[_0x989b('0xa')](_0x57a554,_0x1fcfcb)['then'](function(_0x556ea5){logger[_0x989b('0xb')](_0x989b('0xc'),_0x25740e,_0x989b('0xd'));logger[_0x989b('0xe')](_0x989b('0xf'),_0x25740e,'request\x20sent',JSON[_0x989b('0x10')](_0x556ea5));if(_0x556ea5[_0x989b('0x11')]){if(_0x556ea5[_0x989b('0x11')][_0x989b('0x12')]===0x1f4){logger['error'](_0x989b('0xc'),_0x25740e,_0x556ea5[_0x989b('0x11')][_0x989b('0x13')]);return _0x180907(_0x556ea5[_0x989b('0x11')]['message']);}logger[_0x989b('0x11')](_0x989b('0xc'),_0x25740e,_0x556ea5['error'][_0x989b('0x13')]);return _0x1890e4(_0x556ea5[_0x989b('0x11')][_0x989b('0x13')]);}else{logger[_0x989b('0xb')]('ZohoConfiguration,\x20%s,\x20%s',_0x25740e,'request\x20sent');_0x1890e4(_0x556ea5[_0x989b('0x14')][_0x989b('0x13')]);}})[_0x989b('0x15')](function(_0x233349){logger[_0x989b('0x11')](_0x989b('0xc'),_0x25740e,_0x233349);_0x180907(_0x233349);});});} \ No newline at end of file +var _0x5dfd=['http','then','info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x1b349a,_0x22222c){var _0x5d1f7c=function(_0x368d7c){while(--_0x368d7c){_0x1b349a['push'](_0x1b349a['shift']());}};_0x5d1f7c(++_0x22222c);}(_0x5dfd,0x1c1));var _0xd5df=function(_0x363ef8,_0x4ecb1a){_0x363ef8=_0x363ef8-0x0;var _0x148822=_0x5dfd[_0x363ef8];return _0x148822;};'use strict';var _=require(_0xd5df('0x0'));var util=require(_0xd5df('0x1'));var moment=require('moment');var BPromise=require(_0xd5df('0x2'));var rs=require(_0xd5df('0x3'));var fs=require('fs');var Redis=require(_0xd5df('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xd5df('0x5'));var logger=require(_0xd5df('0x6'))(_0xd5df('0x7'));var config=require(_0xd5df('0x8'));var jayson=require(_0xd5df('0x9'));var client=jayson[_0xd5df('0xa')][_0xd5df('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2e3265,_0xb3f96,_0x14b063){return new BPromise(function(_0x4e79a7,_0x269f45){return client['request'](_0x2e3265,_0x14b063)[_0xd5df('0xc')](function(_0x2f32e8){logger[_0xd5df('0xd')](_0xd5df('0xe'),_0xb3f96,_0xd5df('0xf'));logger['debug'](_0xd5df('0x10'),_0xb3f96,_0xd5df('0xf'),JSON[_0xd5df('0x11')](_0x2f32e8));if(_0x2f32e8[_0xd5df('0x12')]){if(_0x2f32e8[_0xd5df('0x12')][_0xd5df('0x13')]===0x1f4){logger[_0xd5df('0x12')]('ZohoConfiguration,\x20%s,\x20%s',_0xb3f96,_0x2f32e8[_0xd5df('0x12')][_0xd5df('0x14')]);return _0x269f45(_0x2f32e8['error']['message']);}logger[_0xd5df('0x12')](_0xd5df('0xe'),_0xb3f96,_0x2f32e8['error'][_0xd5df('0x14')]);return _0x4e79a7(_0x2f32e8[_0xd5df('0x12')][_0xd5df('0x14')]);}else{logger['info'](_0xd5df('0xe'),_0xb3f96,'request\x20sent');_0x4e79a7(_0x2f32e8[_0xd5df('0x15')][_0xd5df('0x14')]);}})[_0xd5df('0x16')](function(_0x403482){logger[_0xd5df('0x12')](_0xd5df('0xe'),_0xb3f96,_0x403482);_0x269f45(_0x403482);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index 942680d..9928e12 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 _0xbfa3=['put','update','delete','destroy','exports','multer','util','path','Router','fs-extra','../../components/auth/service','get','index','/:id','isAuthenticated','show','post','create'];(function(_0x35885a,_0x42fed7){var _0xe86249=function(_0x98edb3){while(--_0x98edb3){_0x35885a['push'](_0x35885a['shift']());}};_0xe86249(++_0x42fed7);}(_0xbfa3,0xdd));var _0x3bfa=function(_0x5c17e6,_0x24949c){_0x5c17e6=_0x5c17e6-0x0;var _0x16a6b1=_0xbfa3[_0x5c17e6];return _0x16a6b1;};'use strict';var multer=require(_0x3bfa('0x0'));var util=require(_0x3bfa('0x1'));var path=require(_0x3bfa('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x3bfa('0x3')]();var fs_extra=require(_0x3bfa('0x4'));var auth=require(_0x3bfa('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./intZohoField.controller');router[_0x3bfa('0x6')]('/',auth['isAuthenticated'](),controller[_0x3bfa('0x7')]);router[_0x3bfa('0x6')](_0x3bfa('0x8'),auth[_0x3bfa('0x9')](),controller[_0x3bfa('0xa')]);router[_0x3bfa('0xb')]('/',auth[_0x3bfa('0x9')](),controller[_0x3bfa('0xc')]);router[_0x3bfa('0xd')](_0x3bfa('0x8'),auth[_0x3bfa('0x9')](),controller[_0x3bfa('0xe')]);router[_0x3bfa('0xf')](_0x3bfa('0x8'),auth['isAuthenticated'](),controller[_0x3bfa('0x10')]);module[_0x3bfa('0x11')]=router; \ No newline at end of file +var _0x6489=['path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./intZohoField.controller','get','isAuthenticated','post','put','update','/:id','destroy','exports','multer','util'];(function(_0x50f5ad,_0x4ddfbf){var _0x18b7b1=function(_0x285c6a){while(--_0x285c6a){_0x50f5ad['push'](_0x50f5ad['shift']());}};_0x18b7b1(++_0x4ddfbf);}(_0x6489,0xa8));var _0x9648=function(_0x35cc59,_0x56421c){_0x35cc59=_0x35cc59-0x0;var _0x570b33=_0x6489[_0x35cc59];return _0x570b33;};'use strict';var multer=require(_0x9648('0x0'));var util=require(_0x9648('0x1'));var path=require(_0x9648('0x2'));var timeout=require(_0x9648('0x3'));var express=require(_0x9648('0x4'));var router=express['Router']();var fs_extra=require(_0x9648('0x5'));var auth=require(_0x9648('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x9648('0x7'));var controller=require(_0x9648('0x8'));router[_0x9648('0x9')]('/',auth[_0x9648('0xa')](),controller['index']);router[_0x9648('0x9')]('/:id',auth[_0x9648('0xa')](),controller['show']);router[_0x9648('0xb')]('/',auth[_0x9648('0xa')](),controller['create']);router[_0x9648('0xc')]('/:id',auth['isAuthenticated'](),controller[_0x9648('0xd')]);router['delete'](_0x9648('0xe'),auth['isAuthenticated'](),controller[_0x9648('0xf')]);module[_0x9648('0x10')]=router; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.attributes.js b/server/api/intZohoField/intZohoField.attributes.js index de36bfa..7719189 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 _0x8652=['picklist','STRING','customVariable','BOOLEAN','sequelize','exports','string','variable','keyValue'];(function(_0x6e2a47,_0x10b0db){var _0x43fd8b=function(_0x17b068){while(--_0x17b068){_0x6e2a47['push'](_0x6e2a47['shift']());}};_0x43fd8b(++_0x10b0db);}(_0x8652,0x190));var _0x2865=function(_0x2a7c2a,_0x37cc9e){_0x2a7c2a=_0x2a7c2a-0x0;var _0x195732=_0x8652[_0x2a7c2a];return _0x195732;};'use strict';var Sequelize=require(_0x2865('0x0'));module[_0x2865('0x1')]={'type':{'type':Sequelize['ENUM'](_0x2865('0x2'),_0x2865('0x3'),'customVariable',_0x2865('0x4'),_0x2865('0x5')),'defaultValue':_0x2865('0x2')},'content':{'type':Sequelize[_0x2865('0x6')]},'key':{'type':Sequelize[_0x2865('0x6')]},'keyType':{'type':Sequelize['ENUM'](_0x2865('0x2'),_0x2865('0x3'),_0x2865('0x7'))},'keyContent':{'type':Sequelize[_0x2865('0x6')]},'idField':{'type':Sequelize[_0x2865('0x6')]},'nameField':{'type':Sequelize[_0x2865('0x6')]},'customField':{'type':Sequelize[_0x2865('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x2865('0x6')]}}; \ No newline at end of file +var _0xc310=['customVariable','picklist','STRING','BOOLEAN','sequelize','exports','ENUM','string','variable'];(function(_0x541f9e,_0x1cd27d){var _0x158bb1=function(_0x4344fd){while(--_0x4344fd){_0x541f9e['push'](_0x541f9e['shift']());}};_0x158bb1(++_0x1cd27d);}(_0xc310,0x1c6));var _0x0c31=function(_0x3aca81,_0x1fe87f){_0x3aca81=_0x3aca81-0x0;var _0x14dfaf=_0xc310[_0x3aca81];return _0x14dfaf;};'use strict';var Sequelize=require(_0x0c31('0x0'));module[_0x0c31('0x1')]={'type':{'type':Sequelize[_0x0c31('0x2')](_0x0c31('0x3'),_0x0c31('0x4'),_0x0c31('0x5'),'keyValue',_0x0c31('0x6')),'defaultValue':'string'},'content':{'type':Sequelize[_0x0c31('0x7')]},'key':{'type':Sequelize[_0x0c31('0x7')]},'keyType':{'type':Sequelize[_0x0c31('0x2')](_0x0c31('0x3'),_0x0c31('0x4'),_0x0c31('0x5'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x0c31('0x7')]},'customField':{'type':Sequelize[_0x0c31('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x0c31('0x7')]}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index a6e15e1..2206bc9 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 _0x1c72=['nolimit','order','sort','filters','pick','where','merge','type','VIRTUAL','name','filter','ZohoField','includeAll','findAll','catch','show','length','include','options','find','create','body','params','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/license/util','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','reject','update','then','error','stack','send','index','map','rawAttributes','fieldName','keys','query','intersection','model','attributes','fields','hasOwnProperty'];(function(_0x15dd25,_0x480651){var _0x23696f=function(_0x47048c){while(--_0x47048c){_0x15dd25['push'](_0x15dd25['shift']());}};_0x23696f(++_0x480651);}(_0x1c72,0x13f));var _0x21c7=function(_0x592d86,_0x481594){_0x592d86=_0x592d86-0x0;var _0x142038=_0x1c72[_0x592d86];return _0x142038;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x21c7('0x0'));var zipdir=require(_0x21c7('0x1'));var jsonpatch=require(_0x21c7('0x2'));var rp=require(_0x21c7('0x3'));var moment=require(_0x21c7('0x4'));var BPromise=require(_0x21c7('0x5'));var Mustache=require(_0x21c7('0x6'));var util=require('util');var path=require(_0x21c7('0x7'));var sox=require(_0x21c7('0x8'));var csv=require(_0x21c7('0x9'));var ejs=require(_0x21c7('0xa'));var fs=require('fs');var fs_extra=require(_0x21c7('0xb'));var _=require(_0x21c7('0xc'));var squel=require('squel');var crypto=require(_0x21c7('0xd'));var jsforce=require(_0x21c7('0xe'));var deskjs=require(_0x21c7('0xf'));var toCsv=require(_0x21c7('0x9'));var querystring=require(_0x21c7('0x10'));var Papa=require(_0x21c7('0x11'));var Redis=require(_0x21c7('0x12'));var authService=require(_0x21c7('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x21c7('0x14'));var logger=require(_0x21c7('0x15'))(_0x21c7('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x21c7('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x19b68f,_0x1ca41c){_0x1ca41c=_0x1ca41c||0xcc;return function(_0x56c744){if(_0x56c744){return _0x19b68f[_0x21c7('0x18')](_0x1ca41c);}return _0x19b68f['status'](_0x1ca41c)[_0x21c7('0x19')]();};}function respondWithResult(_0x479057,_0x544f22){_0x544f22=_0x544f22||0xc8;return function(_0x3e6fdf){if(_0x3e6fdf){return _0x479057[_0x21c7('0x1a')](_0x544f22)[_0x21c7('0x1b')](_0x3e6fdf);}};}function respondWithFilteredResult(_0x4ae6a3,_0x5b5b61){return function(_0x649a5b){if(_0x649a5b){var _0x52b21e=typeof _0x5b5b61[_0x21c7('0x1c')]===_0x21c7('0x1d')&&typeof _0x5b5b61[_0x21c7('0x1e')]===_0x21c7('0x1d');var _0x27ddbd=_0x649a5b[_0x21c7('0x1f')];var _0x1f4294=_0x52b21e?0x0:_0x5b5b61[_0x21c7('0x1c')];var _0x4eac31=_0x52b21e?_0x649a5b[_0x21c7('0x1f')]:_0x5b5b61['offset']+_0x5b5b61[_0x21c7('0x1e')];var _0x4facba;if(_0x4eac31>=_0x27ddbd){_0x4eac31=_0x27ddbd;_0x4facba=0xc8;}else{_0x4facba=0xce;}_0x4ae6a3[_0x21c7('0x1a')](_0x4facba);return _0x4ae6a3[_0x21c7('0x20')](_0x21c7('0x21'),_0x1f4294+'-'+_0x4eac31+'/'+_0x27ddbd)[_0x21c7('0x1b')](_0x649a5b);}return null;};}function patchUpdates(_0xd34e56){return function(_0x539750){try{jsonpatch['apply'](_0x539750,_0xd34e56,!![]);}catch(_0x51cc9d){return BPromise[_0x21c7('0x22')](_0x51cc9d);}return _0x539750['save']();};}function saveUpdates(_0x500291,_0x3ef613){return function(_0x219edd){if(_0x219edd){return _0x219edd[_0x21c7('0x23')](_0x500291)[_0x21c7('0x24')](function(_0x5232d7){return _0x5232d7;});}return null;};}function removeEntity(_0x3063e9,_0x5ac87e){return function(_0x1c9410){if(_0x1c9410){return _0x1c9410['destroy']()[_0x21c7('0x24')](function(){_0x3063e9[_0x21c7('0x1a')](0xcc)[_0x21c7('0x19')]();});}};}function handleEntityNotFound(_0x4ee0d6,_0x19158f){return function(_0xd8f859){if(!_0xd8f859){_0x4ee0d6[_0x21c7('0x18')](0x194);}return _0xd8f859;};}function handleError(_0x449f35,_0x2e0b0d){_0x2e0b0d=_0x2e0b0d||0x1f4;return function(_0x4fd770){logger[_0x21c7('0x25')](_0x4fd770[_0x21c7('0x26')]);if(_0x4fd770['name']){delete _0x4fd770['name'];}_0x449f35[_0x21c7('0x1a')](_0x2e0b0d)[_0x21c7('0x27')](_0x4fd770);};}exports[_0x21c7('0x28')]=function(_0xd98426,_0x2b7e9f){var _0x3f4c1a={},_0x2d3122={},_0x414e9e={'count':0x0,'rows':[]};var _0x730cd2=_[_0x21c7('0x29')](db['ZohoField'][_0x21c7('0x2a')],function(_0x484f14){return{'name':_0x484f14[_0x21c7('0x2b')],'type':_0x484f14['type']['key']};});_0x2d3122['model']=_[_0x21c7('0x29')](_0x730cd2,'name');_0x2d3122['query']=_[_0x21c7('0x2c')](_0xd98426[_0x21c7('0x2d')]);_0x2d3122['filters']=_[_0x21c7('0x2e')](_0x2d3122[_0x21c7('0x2f')],_0x2d3122['query']);_0x3f4c1a[_0x21c7('0x30')]=_[_0x21c7('0x2e')](_0x2d3122[_0x21c7('0x2f')],qs['fields'](_0xd98426[_0x21c7('0x2d')][_0x21c7('0x31')]));_0x3f4c1a[_0x21c7('0x30')]=_0x3f4c1a[_0x21c7('0x30')]['length']?_0x3f4c1a[_0x21c7('0x30')]:_0x2d3122[_0x21c7('0x2f')];if(!_0xd98426[_0x21c7('0x2d')][_0x21c7('0x32')](_0x21c7('0x33'))){_0x3f4c1a[_0x21c7('0x1e')]=qs[_0x21c7('0x1e')](_0xd98426[_0x21c7('0x2d')][_0x21c7('0x1e')]);_0x3f4c1a[_0x21c7('0x1c')]=qs[_0x21c7('0x1c')](_0xd98426[_0x21c7('0x2d')][_0x21c7('0x1c')]);}_0x3f4c1a[_0x21c7('0x34')]=qs['sort'](_0xd98426['query'][_0x21c7('0x35')]);_0x3f4c1a['where']=qs[_0x21c7('0x36')](_[_0x21c7('0x37')](_0xd98426['query'],_0x2d3122[_0x21c7('0x36')]),_0x730cd2);if(_0xd98426[_0x21c7('0x2d')]['filter']){_0x3f4c1a[_0x21c7('0x38')]=_[_0x21c7('0x39')](_0x3f4c1a[_0x21c7('0x38')],{'$or':_[_0x21c7('0x29')](_0x730cd2,function(_0x273b53){if(_0x273b53[_0x21c7('0x3a')]!==_0x21c7('0x3b')){var _0xc5d839={};_0xc5d839[_0x273b53[_0x21c7('0x3c')]]={'$like':'%'+_0xd98426[_0x21c7('0x2d')][_0x21c7('0x3d')]+'%'};return _0xc5d839;}})});}_0x3f4c1a=_[_0x21c7('0x39')]({},_0x3f4c1a,_0xd98426['options']);var _0x48c1cf={'where':_0x3f4c1a[_0x21c7('0x38')]};return db[_0x21c7('0x3e')][_0x21c7('0x1f')](_0x48c1cf)['then'](function(_0x44fb2d){_0x414e9e[_0x21c7('0x1f')]=_0x44fb2d;if(_0xd98426[_0x21c7('0x2d')][_0x21c7('0x3f')]){_0x3f4c1a['include']=[{'all':!![]}];}return db[_0x21c7('0x3e')][_0x21c7('0x40')](_0x3f4c1a);})['then'](function(_0xbb5f26){_0x414e9e['rows']=_0xbb5f26;return _0x414e9e;})[_0x21c7('0x24')](respondWithFilteredResult(_0x2b7e9f,_0x3f4c1a))[_0x21c7('0x41')](handleError(_0x2b7e9f,null));};exports[_0x21c7('0x42')]=function(_0x7d7d15,_0x383f03){var _0x10c468={'raw':!![],'where':{'id':_0x7d7d15['params']['id']}},_0x542423={};_0x542423['model']=_[_0x21c7('0x2c')](db[_0x21c7('0x3e')][_0x21c7('0x2a')]);_0x542423[_0x21c7('0x2d')]=_['keys'](_0x7d7d15['query']);_0x542423[_0x21c7('0x36')]=_[_0x21c7('0x2e')](_0x542423[_0x21c7('0x2f')],_0x542423[_0x21c7('0x2d')]);_0x10c468[_0x21c7('0x30')]=_['intersection'](_0x542423['model'],qs[_0x21c7('0x31')](_0x7d7d15[_0x21c7('0x2d')][_0x21c7('0x31')]));_0x10c468[_0x21c7('0x30')]=_0x10c468[_0x21c7('0x30')][_0x21c7('0x43')]?_0x10c468['attributes']:_0x542423[_0x21c7('0x2f')];if(_0x7d7d15[_0x21c7('0x2d')][_0x21c7('0x3f')]){_0x10c468[_0x21c7('0x44')]=[{'all':!![]}];}_0x10c468=_[_0x21c7('0x39')]({},_0x10c468,_0x7d7d15[_0x21c7('0x45')]);return db[_0x21c7('0x3e')][_0x21c7('0x46')](_0x10c468)[_0x21c7('0x24')](handleEntityNotFound(_0x383f03,null))['then'](respondWithResult(_0x383f03,null))[_0x21c7('0x41')](handleError(_0x383f03,null));};exports['create']=function(_0x4ae190,_0x42fbb6){return db['ZohoField'][_0x21c7('0x47')](_0x4ae190[_0x21c7('0x48')],{})['then'](respondWithResult(_0x42fbb6,0xc9))[_0x21c7('0x41')](handleError(_0x42fbb6,null));};exports['update']=function(_0x59f789,_0x23db7e){if(_0x59f789[_0x21c7('0x48')]['id']){delete _0x59f789[_0x21c7('0x48')]['id'];}return db[_0x21c7('0x3e')]['find']({'where':{'id':_0x59f789[_0x21c7('0x49')]['id']}})['then'](handleEntityNotFound(_0x23db7e,null))['then'](saveUpdates(_0x59f789[_0x21c7('0x48')],null))[_0x21c7('0x24')](respondWithResult(_0x23db7e,null))[_0x21c7('0x41')](handleError(_0x23db7e,null));};exports['destroy']=function(_0x5ba0ee,_0xe41fd2){return db['ZohoField'][_0x21c7('0x46')]({'where':{'id':_0x5ba0ee['params']['id']}})['then'](handleEntityNotFound(_0xe41fd2,null))[_0x21c7('0x24')](removeEntity(_0xe41fd2,null))[_0x21c7('0x41')](handleError(_0xe41fd2,null));}; \ No newline at end of file +var _0xe1e9=['path','sox','ejs','fs-extra','lodash','crypto','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','count','set','Content-Range','reject','save','update','then','destroy','error','stack','name','index','map','ZohoField','rawAttributes','type','query','keys','attributes','intersection','model','fields','length','nolimit','order','sort','where','pick','filter','merge','options','include','findAll','rows','show','params','includeAll','catch','create','body','eml-format','zip-dir','fast-json-patch','bluebird','mustache'];(function(_0x12b266,_0x27b7f8){var _0x343f73=function(_0x2a01df){while(--_0x2a01df){_0x12b266['push'](_0x12b266['shift']());}};_0x343f73(++_0x27b7f8);}(_0xe1e9,0x10b));var _0x9e1e=function(_0x30e9c9,_0x4797a2){_0x30e9c9=_0x30e9c9-0x0;var _0x13b511=_0xe1e9[_0x30e9c9];return _0x13b511;};'use strict';var emlformat=require(_0x9e1e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9e1e('0x1'));var jsonpatch=require(_0x9e1e('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x9e1e('0x3'));var Mustache=require(_0x9e1e('0x4'));var util=require('util');var path=require(_0x9e1e('0x5'));var sox=require(_0x9e1e('0x6'));var csv=require('to-csv');var ejs=require(_0x9e1e('0x7'));var fs=require('fs');var fs_extra=require(_0x9e1e('0x8'));var _=require(_0x9e1e('0x9'));var squel=require('squel');var crypto=require(_0x9e1e('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x9e1e('0xb'));var toCsv=require(_0x9e1e('0xc'));var querystring=require(_0x9e1e('0xd'));var Papa=require(_0x9e1e('0xe'));var Redis=require('ioredis');var authService=require(_0x9e1e('0xf'));var qs=require(_0x9e1e('0x10'));var as=require(_0x9e1e('0x11'));var hardwareService=require(_0x9e1e('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0x9e1e('0x13'));var config=require(_0x9e1e('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x9e1e('0x15'))['db'];function respondWithStatusCode(_0x4ee37a,_0x1626c5){_0x1626c5=_0x1626c5||0xcc;return function(_0x574662){if(_0x574662){return _0x4ee37a[_0x9e1e('0x16')](_0x1626c5);}return _0x4ee37a[_0x9e1e('0x17')](_0x1626c5)[_0x9e1e('0x18')]();};}function respondWithResult(_0x22ea0c,_0x7ea83d){_0x7ea83d=_0x7ea83d||0xc8;return function(_0x206498){if(_0x206498){return _0x22ea0c[_0x9e1e('0x17')](_0x7ea83d)[_0x9e1e('0x19')](_0x206498);}};}function respondWithFilteredResult(_0x15643b,_0x5ecf12){return function(_0x54b809){if(_0x54b809){var _0x4c5ba1=typeof _0x5ecf12[_0x9e1e('0x1a')]==='undefined'&&typeof _0x5ecf12[_0x9e1e('0x1b')]==='undefined';var _0x33a164=_0x54b809[_0x9e1e('0x1c')];var _0x51c3c0=_0x4c5ba1?0x0:_0x5ecf12['offset'];var _0x5c9148=_0x4c5ba1?_0x54b809[_0x9e1e('0x1c')]:_0x5ecf12[_0x9e1e('0x1a')]+_0x5ecf12[_0x9e1e('0x1b')];var _0x51e112;if(_0x5c9148>=_0x33a164){_0x5c9148=_0x33a164;_0x51e112=0xc8;}else{_0x51e112=0xce;}_0x15643b['status'](_0x51e112);return _0x15643b[_0x9e1e('0x1d')](_0x9e1e('0x1e'),_0x51c3c0+'-'+_0x5c9148+'/'+_0x33a164)[_0x9e1e('0x19')](_0x54b809);}return null;};}function patchUpdates(_0x406915){return function(_0x2230fa){try{jsonpatch['apply'](_0x2230fa,_0x406915,!![]);}catch(_0x4fac98){return BPromise[_0x9e1e('0x1f')](_0x4fac98);}return _0x2230fa[_0x9e1e('0x20')]();};}function saveUpdates(_0x41bcf6,_0x12d015){return function(_0x2e2338){if(_0x2e2338){return _0x2e2338[_0x9e1e('0x21')](_0x41bcf6)[_0x9e1e('0x22')](function(_0xd1e41c){return _0xd1e41c;});}return null;};}function removeEntity(_0x1531e5,_0x465076){return function(_0xad40ce){if(_0xad40ce){return _0xad40ce[_0x9e1e('0x23')]()[_0x9e1e('0x22')](function(){_0x1531e5[_0x9e1e('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x53178b,_0xdca92d){return function(_0x4e7852){if(!_0x4e7852){_0x53178b[_0x9e1e('0x16')](0x194);}return _0x4e7852;};}function handleError(_0x38ac32,_0x5ca751){_0x5ca751=_0x5ca751||0x1f4;return function(_0x28370c){logger[_0x9e1e('0x24')](_0x28370c[_0x9e1e('0x25')]);if(_0x28370c[_0x9e1e('0x26')]){delete _0x28370c[_0x9e1e('0x26')];}_0x38ac32[_0x9e1e('0x17')](_0x5ca751)['send'](_0x28370c);};}exports[_0x9e1e('0x27')]=function(_0x528fb1,_0x8f66ef){var _0x43a057={},_0x23f9d0={},_0x240e3b={'count':0x0,'rows':[]};var _0x4a6170=_[_0x9e1e('0x28')](db[_0x9e1e('0x29')][_0x9e1e('0x2a')],function(_0x488009){return{'name':_0x488009['fieldName'],'type':_0x488009[_0x9e1e('0x2b')]['key']};});_0x23f9d0['model']=_[_0x9e1e('0x28')](_0x4a6170,'name');_0x23f9d0[_0x9e1e('0x2c')]=_[_0x9e1e('0x2d')](_0x528fb1['query']);_0x23f9d0['filters']=_['intersection'](_0x23f9d0['model'],_0x23f9d0[_0x9e1e('0x2c')]);_0x43a057[_0x9e1e('0x2e')]=_[_0x9e1e('0x2f')](_0x23f9d0[_0x9e1e('0x30')],qs[_0x9e1e('0x31')](_0x528fb1['query'][_0x9e1e('0x31')]));_0x43a057[_0x9e1e('0x2e')]=_0x43a057[_0x9e1e('0x2e')][_0x9e1e('0x32')]?_0x43a057['attributes']:_0x23f9d0[_0x9e1e('0x30')];if(!_0x528fb1[_0x9e1e('0x2c')]['hasOwnProperty'](_0x9e1e('0x33'))){_0x43a057['limit']=qs[_0x9e1e('0x1b')](_0x528fb1[_0x9e1e('0x2c')][_0x9e1e('0x1b')]);_0x43a057[_0x9e1e('0x1a')]=qs['offset'](_0x528fb1[_0x9e1e('0x2c')]['offset']);}_0x43a057[_0x9e1e('0x34')]=qs[_0x9e1e('0x35')](_0x528fb1[_0x9e1e('0x2c')]['sort']);_0x43a057[_0x9e1e('0x36')]=qs['filters'](_[_0x9e1e('0x37')](_0x528fb1['query'],_0x23f9d0['filters']),_0x4a6170);if(_0x528fb1[_0x9e1e('0x2c')][_0x9e1e('0x38')]){_0x43a057[_0x9e1e('0x36')]=_['merge'](_0x43a057[_0x9e1e('0x36')],{'$or':_[_0x9e1e('0x28')](_0x4a6170,function(_0x23bc73){if(_0x23bc73['type']!=='VIRTUAL'){var _0x847418={};_0x847418[_0x23bc73[_0x9e1e('0x26')]]={'$like':'%'+_0x528fb1['query'][_0x9e1e('0x38')]+'%'};return _0x847418;}})});}_0x43a057=_[_0x9e1e('0x39')]({},_0x43a057,_0x528fb1[_0x9e1e('0x3a')]);var _0x1e6554={'where':_0x43a057['where']};return db[_0x9e1e('0x29')]['count'](_0x1e6554)[_0x9e1e('0x22')](function(_0x7715e1){_0x240e3b[_0x9e1e('0x1c')]=_0x7715e1;if(_0x528fb1['query']['includeAll']){_0x43a057[_0x9e1e('0x3b')]=[{'all':!![]}];}return db[_0x9e1e('0x29')][_0x9e1e('0x3c')](_0x43a057);})[_0x9e1e('0x22')](function(_0x29df26){_0x240e3b[_0x9e1e('0x3d')]=_0x29df26;return _0x240e3b;})[_0x9e1e('0x22')](respondWithFilteredResult(_0x8f66ef,_0x43a057))['catch'](handleError(_0x8f66ef,null));};exports[_0x9e1e('0x3e')]=function(_0x236c4b,_0x9778f1){var _0xe9b826={'raw':!![],'where':{'id':_0x236c4b[_0x9e1e('0x3f')]['id']}},_0x57e2da={};_0x57e2da[_0x9e1e('0x30')]=_[_0x9e1e('0x2d')](db[_0x9e1e('0x29')]['rawAttributes']);_0x57e2da[_0x9e1e('0x2c')]=_['keys'](_0x236c4b[_0x9e1e('0x2c')]);_0x57e2da['filters']=_[_0x9e1e('0x2f')](_0x57e2da[_0x9e1e('0x30')],_0x57e2da[_0x9e1e('0x2c')]);_0xe9b826[_0x9e1e('0x2e')]=_[_0x9e1e('0x2f')](_0x57e2da[_0x9e1e('0x30')],qs['fields'](_0x236c4b['query']['fields']));_0xe9b826[_0x9e1e('0x2e')]=_0xe9b826[_0x9e1e('0x2e')][_0x9e1e('0x32')]?_0xe9b826['attributes']:_0x57e2da[_0x9e1e('0x30')];if(_0x236c4b['query'][_0x9e1e('0x40')]){_0xe9b826[_0x9e1e('0x3b')]=[{'all':!![]}];}_0xe9b826=_['merge']({},_0xe9b826,_0x236c4b[_0x9e1e('0x3a')]);return db[_0x9e1e('0x29')]['find'](_0xe9b826)[_0x9e1e('0x22')](handleEntityNotFound(_0x9778f1,null))[_0x9e1e('0x22')](respondWithResult(_0x9778f1,null))[_0x9e1e('0x41')](handleError(_0x9778f1,null));};exports['create']=function(_0x5d24d7,_0x53e503){return db[_0x9e1e('0x29')][_0x9e1e('0x42')](_0x5d24d7['body'],{})[_0x9e1e('0x22')](respondWithResult(_0x53e503,0xc9))['catch'](handleError(_0x53e503,null));};exports[_0x9e1e('0x21')]=function(_0x26aa0c,_0x5c0c0b){if(_0x26aa0c[_0x9e1e('0x43')]['id']){delete _0x26aa0c[_0x9e1e('0x43')]['id'];}return db['ZohoField']['find']({'where':{'id':_0x26aa0c[_0x9e1e('0x3f')]['id']}})['then'](handleEntityNotFound(_0x5c0c0b,null))[_0x9e1e('0x22')](saveUpdates(_0x26aa0c['body'],null))[_0x9e1e('0x22')](respondWithResult(_0x5c0c0b,null))['catch'](handleError(_0x5c0c0b,null));};exports[_0x9e1e('0x23')]=function(_0x3bc69c,_0x1f0f73){return db[_0x9e1e('0x29')]['find']({'where':{'id':_0x3bc69c[_0x9e1e('0x3f')]['id']}})[_0x9e1e('0x22')](handleEntityNotFound(_0x1f0f73,null))['then'](removeEntity(_0x1f0f73,null))['catch'](handleError(_0x1f0f73,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index 9d6c4bd..242d84f 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 _0x3d04=['request-promise','path','../../config/environment','./intZohoField.attributes','exports','zoho_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x5e822c,_0x5e49c6){var _0x192b6a=function(_0x3ff943){while(--_0x3ff943){_0x5e822c['push'](_0x5e822c['shift']());}};_0x192b6a(++_0x5e49c6);}(_0x3d04,0xbe));var _0x43d0=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x3d04[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0x43d0('0x0'));var util=require(_0x43d0('0x1'));var logger=require(_0x43d0('0x2'))(_0x43d0('0x3'));var moment=require(_0x43d0('0x4'));var BPromise=require(_0x43d0('0x5'));var rp=require(_0x43d0('0x6'));var fs=require('fs');var path=require(_0x43d0('0x7'));var rimraf=require('rimraf');var config=require(_0x43d0('0x8'));var attributes=require(_0x43d0('0x9'));module[_0x43d0('0xa')]=function(_0x617bf,_0x5e284f){return _0x617bf['define']('ZohoField',attributes,{'tableName':'int_zoho_fields','paranoid':![],'indexes':[{'name':_0x43d0('0xb'),'fields':[_0x43d0('0xc'),_0x43d0('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7b84=['moment','bluebird','request-promise','rimraf','../../config/environment','./intZohoField.attributes','exports','ZohoField','int_zoho_fields','zoho_unique_index','idField','FieldId','lodash','util','../../config/logger','api'];(function(_0x205e3c,_0x534a13){var _0x58ec58=function(_0x1a1ece){while(--_0x1a1ece){_0x205e3c['push'](_0x205e3c['shift']());}};_0x58ec58(++_0x534a13);}(_0x7b84,0x17c));var _0x47b8=function(_0x88d00d,_0x337cdd){_0x88d00d=_0x88d00d-0x0;var _0x1641a1=_0x7b84[_0x88d00d];return _0x1641a1;};'use strict';var _=require(_0x47b8('0x0'));var util=require(_0x47b8('0x1'));var logger=require(_0x47b8('0x2'))(_0x47b8('0x3'));var moment=require(_0x47b8('0x4'));var BPromise=require(_0x47b8('0x5'));var rp=require(_0x47b8('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x47b8('0x7'));var config=require(_0x47b8('0x8'));var attributes=require(_0x47b8('0x9'));module[_0x47b8('0xa')]=function(_0x2e6853,_0xafe88a){return _0x2e6853['define'](_0x47b8('0xb'),attributes,{'tableName':_0x47b8('0xc'),'paranoid':![],'indexes':[{'name':_0x47b8('0xd'),'fields':[_0x47b8('0xe'),_0x47b8('0xf')],'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 f0e3db1..9ec99a7 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 _0x4941=['http','request','info','ZohoField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x2d5550,_0x3ecc31){var _0x5b4917=function(_0x2a62a8){while(--_0x2a62a8){_0x2d5550['push'](_0x2d5550['shift']());}};_0x5b4917(++_0x3ecc31);}(_0x4941,0x79));var _0x1494=function(_0x10291b,_0x518773){_0x10291b=_0x10291b-0x0;var _0x1d5fbe=_0x4941[_0x10291b];return _0x1d5fbe;};'use strict';var _=require(_0x1494('0x0'));var util=require(_0x1494('0x1'));var moment=require(_0x1494('0x2'));var BPromise=require(_0x1494('0x3'));var rs=require(_0x1494('0x4'));var fs=require('fs');var Redis=require(_0x1494('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x1494('0x6'))(_0x1494('0x7'));var config=require(_0x1494('0x8'));var jayson=require(_0x1494('0x9'));var client=jayson[_0x1494('0xa')][_0x1494('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x501d35,_0x26712e,_0x44ba91){return new BPromise(function(_0x174974,_0x2af55e){return client[_0x1494('0xc')](_0x501d35,_0x44ba91)['then'](function(_0x5f9409){logger[_0x1494('0xd')](_0x1494('0xe'),_0x26712e,_0x1494('0xf'));logger[_0x1494('0x10')]('ZohoField,\x20%s,\x20%s,\x20%s',_0x26712e,_0x1494('0xf'),JSON[_0x1494('0x11')](_0x5f9409));if(_0x5f9409[_0x1494('0x12')]){if(_0x5f9409[_0x1494('0x12')][_0x1494('0x13')]===0x1f4){logger[_0x1494('0x12')]('ZohoField,\x20%s,\x20%s',_0x26712e,_0x5f9409['error'][_0x1494('0x14')]);return _0x2af55e(_0x5f9409['error'][_0x1494('0x14')]);}logger[_0x1494('0x12')](_0x1494('0xe'),_0x26712e,_0x5f9409[_0x1494('0x12')]['message']);return _0x174974(_0x5f9409[_0x1494('0x12')]['message']);}else{logger['info'](_0x1494('0xe'),_0x26712e,_0x1494('0xf'));_0x174974(_0x5f9409[_0x1494('0x15')][_0x1494('0x14')]);}})['catch'](function(_0x2747f4){logger[_0x1494('0x12')](_0x1494('0xe'),_0x26712e,_0x2747f4);_0x2af55e(_0x2747f4);});});} \ No newline at end of file +var _0x13a6=['ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','ZohoField,\x20%s,\x20%s','request\x20sent','debug','ZohoField,\x20%s,\x20%s,\x20%s','error','message','info','result','catch','lodash','util','bluebird'];(function(_0x58ba62,_0x252d9f){var _0x57628f=function(_0x5ba07b){while(--_0x5ba07b){_0x58ba62['push'](_0x58ba62['shift']());}};_0x57628f(++_0x252d9f);}(_0x13a6,0x90));var _0x613a=function(_0x1800d2,_0x41cdae){_0x1800d2=_0x1800d2-0x0;var _0x3b70ee=_0x13a6[_0x1800d2];return _0x3b70ee;};'use strict';var _=require(_0x613a('0x0'));var util=require(_0x613a('0x1'));var moment=require('moment');var BPromise=require(_0x613a('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x613a('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x613a('0x4'));var logger=require(_0x613a('0x5'))(_0x613a('0x6'));var config=require(_0x613a('0x7'));var jayson=require(_0x613a('0x8'));var client=jayson[_0x613a('0x9')][_0x613a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x13c116,_0x48d1dd,_0x4664f5){return new BPromise(function(_0x50e80c,_0x3df551){return client['request'](_0x13c116,_0x4664f5)[_0x613a('0xb')](function(_0x5356a4){logger['info'](_0x613a('0xc'),_0x48d1dd,_0x613a('0xd'));logger[_0x613a('0xe')](_0x613a('0xf'),_0x48d1dd,_0x613a('0xd'),JSON['stringify'](_0x5356a4));if(_0x5356a4[_0x613a('0x10')]){if(_0x5356a4[_0x613a('0x10')]['code']===0x1f4){logger[_0x613a('0x10')]('ZohoField,\x20%s,\x20%s',_0x48d1dd,_0x5356a4[_0x613a('0x10')]['message']);return _0x3df551(_0x5356a4[_0x613a('0x10')][_0x613a('0x11')]);}logger['error'](_0x613a('0xc'),_0x48d1dd,_0x5356a4[_0x613a('0x10')]['message']);return _0x50e80c(_0x5356a4[_0x613a('0x10')]['message']);}else{logger[_0x613a('0x12')]('ZohoField,\x20%s,\x20%s',_0x48d1dd,_0x613a('0xd'));_0x50e80c(_0x5356a4[_0x613a('0x13')][_0x613a('0x11')]);}})[_0x613a('0x14')](function(_0x384fc4){logger[_0x613a('0x10')]('ZohoField,\x20%s,\x20%s',_0x48d1dd,_0x384fc4);_0x3df551(_0x384fc4);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index ece6767..37a666b 100644 --- a/server/api/integration/index.js +++ b/server/api/integration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x47a604,_0x24755e){var _0x2b2280=function(_0x1996d9){while(--_0x1996d9){_0x47a604['push'](_0x47a604['shift']());}};_0x2b2280(++_0x24755e);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file +var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x1ba865,_0x110d26){var _0x35a964=function(_0x221267){while(--_0x221267){_0x1ba865['push'](_0x1ba865['shift']());}};_0x35a964(++_0x110d26);}(_0x9c44,0x178));var _0x49c4=function(_0xb0f7c3,_0x4eae95){_0xb0f7c3=_0xb0f7c3-0x0;var _0x28ea68=_0x9c44[_0xb0f7c3];return _0x28ea68;};'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 861f5d0..4e41729 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 _0xccb3=['INTEGER','BOOLEAN','state','exports','STRING','unique_name_and_version','app.js'];(function(_0x1b5d3d,_0x44818e){var _0x15c2ce=function(_0x578a44){while(--_0x578a44){_0x1b5d3d['push'](_0x1b5d3d['shift']());}};_0x15c2ce(++_0x44818e);}(_0xccb3,0x15a));var _0x3ccb=function(_0x1d8119,_0xc98f17){_0x1d8119=_0x1d8119-0x0;var _0x3e30f6=_0xccb3[_0x1d8119];return _0x3e30f6;};'use strict';var Sequelize=require('sequelize');module[_0x3ccb('0x0')]={'name':{'type':Sequelize[_0x3ccb('0x1')],'allowNull':![],'unique':'unique_name_and_version'},'version':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x3ccb('0x2')},'main':{'type':Sequelize[_0x3ccb('0x1')],'defaultValue':_0x3ccb('0x3')},'filename':{'type':Sequelize['STRING']},'path':{'type':Sequelize[_0x3ccb('0x1')]},'type':{'type':Sequelize[_0x3ccb('0x1')]},'size':{'type':Sequelize[_0x3ccb('0x4')]},'active':{'type':Sequelize[_0x3ccb('0x5')],'defaultValue':![]},'author':{'type':Sequelize[_0x3ccb('0x1')]},'logo':{'type':Sequelize['STRING']},'state':{'type':Sequelize[_0x3ccb('0x1')],'unique':_0x3ccb('0x6')},'description':{'type':Sequelize[_0x3ccb('0x1')]},'title':{'type':Sequelize[_0x3ccb('0x1')]},'remoteUri':{'type':Sequelize[_0x3ccb('0x1')]},'link':{'type':Sequelize['STRING'],'defaultValue':'#'}}; \ No newline at end of file +var _0xcf45=['sequelize','exports','STRING','unique_name_and_version','BOOLEAN','state'];(function(_0x10bae6,_0x41d85f){var _0x251123=function(_0x548886){while(--_0x548886){_0x10bae6['push'](_0x10bae6['shift']());}};_0x251123(++_0x41d85f);}(_0xcf45,0x168));var _0x5cf4=function(_0x4dd9dc,_0x38722f){_0x4dd9dc=_0x4dd9dc-0x0;var _0x9e067e=_0xcf45[_0x4dd9dc];return _0x9e067e;};'use strict';var Sequelize=require(_0x5cf4('0x0'));module[_0x5cf4('0x1')]={'name':{'type':Sequelize[_0x5cf4('0x2')],'allowNull':![],'unique':'unique_name_and_version'},'version':{'type':Sequelize[_0x5cf4('0x2')],'allowNull':![],'unique':_0x5cf4('0x3')},'main':{'type':Sequelize[_0x5cf4('0x2')],'defaultValue':'app.js'},'filename':{'type':Sequelize[_0x5cf4('0x2')]},'path':{'type':Sequelize[_0x5cf4('0x2')]},'type':{'type':Sequelize[_0x5cf4('0x2')]},'size':{'type':Sequelize['INTEGER']},'active':{'type':Sequelize[_0x5cf4('0x4')],'defaultValue':![]},'author':{'type':Sequelize[_0x5cf4('0x2')]},'logo':{'type':Sequelize[_0x5cf4('0x2')]},'state':{'type':Sequelize[_0x5cf4('0x2')],'unique':_0x5cf4('0x5')},'description':{'type':Sequelize[_0x5cf4('0x2')]},'title':{'type':Sequelize[_0x5cf4('0x2')]},'remoteUri':{'type':Sequelize['STRING']},'link':{'type':Sequelize['STRING'],'defaultValue':'#'}}; \ No newline at end of file diff --git a/server/api/integration/integration.controller.js b/server/api/integration/integration.controller.js index e7bfa7c..acf47c2 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 _0xb016=['eml-format','rimraf','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','end','error','name','send','index','map','Integration','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','params','update','find','body'];(function(_0x5a1477,_0x259b55){var _0x4e838a=function(_0x234610){while(--_0x234610){_0x5a1477['push'](_0x5a1477['shift']());}};_0x4e838a(++_0x259b55);}(_0xb016,0x159));var _0x6b01=function(_0x4d45d6,_0x170171){_0x4d45d6=_0x4d45d6-0x0;var _0x5f0db3=_0xb016[_0x4d45d6];return _0x5f0db3;};'use strict';var emlformat=require(_0x6b01('0x0'));var rimraf=require(_0x6b01('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x6b01('0x2'));var moment=require('moment');var BPromise=require(_0x6b01('0x3'));var Mustache=require(_0x6b01('0x4'));var util=require(_0x6b01('0x5'));var path=require(_0x6b01('0x6'));var sox=require('sox');var csv=require(_0x6b01('0x7'));var ejs=require(_0x6b01('0x8'));var fs=require('fs');var fs_extra=require(_0x6b01('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x6b01('0xa'));var jsforce=require(_0x6b01('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x6b01('0xc'));var Papa=require(_0x6b01('0xd'));var Redis=require(_0x6b01('0xe'));var authService=require(_0x6b01('0xf'));var qs=require(_0x6b01('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x6b01('0x11'))(_0x6b01('0x12'));var utils=require(_0x6b01('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x6b01('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x51f976,_0x26f2a0){_0x26f2a0=_0x26f2a0||0xcc;return function(_0x4fa826){if(_0x4fa826){return _0x51f976[_0x6b01('0x15')](_0x26f2a0);}return _0x51f976[_0x6b01('0x16')](_0x26f2a0)['end']();};}function respondWithResult(_0x2c305e,_0x4ea5fa){_0x4ea5fa=_0x4ea5fa||0xc8;return function(_0x50d778){if(_0x50d778){return _0x2c305e['status'](_0x4ea5fa)[_0x6b01('0x17')](_0x50d778);}};}function respondWithFilteredResult(_0x4cbd38,_0x5b2f60){return function(_0x3a259f){if(_0x3a259f){var _0x327e86=typeof _0x5b2f60[_0x6b01('0x18')]===_0x6b01('0x19')&&typeof _0x5b2f60[_0x6b01('0x1a')]===_0x6b01('0x19');var _0x122769=_0x3a259f[_0x6b01('0x1b')];var _0x9c6571=_0x327e86?0x0:_0x5b2f60[_0x6b01('0x18')];var _0x18f336=_0x327e86?_0x3a259f['count']:_0x5b2f60[_0x6b01('0x18')]+_0x5b2f60[_0x6b01('0x1a')];var _0x3b0bab;if(_0x18f336>=_0x122769){_0x18f336=_0x122769;_0x3b0bab=0xc8;}else{_0x3b0bab=0xce;}_0x4cbd38[_0x6b01('0x16')](_0x3b0bab);return _0x4cbd38[_0x6b01('0x1c')](_0x6b01('0x1d'),_0x9c6571+'-'+_0x18f336+'/'+_0x122769)[_0x6b01('0x17')](_0x3a259f);}return null;};}function patchUpdates(_0x3c0573){return function(_0x54a942){try{jsonpatch[_0x6b01('0x1e')](_0x54a942,_0x3c0573,!![]);}catch(_0xc1f453){return BPromise[_0x6b01('0x1f')](_0xc1f453);}return _0x54a942[_0x6b01('0x20')]();};}function saveUpdates(_0x1fced4,_0x181b09){return function(_0x2cea6e){if(_0x2cea6e){return _0x2cea6e['update'](_0x1fced4)[_0x6b01('0x21')](function(_0xcf9200){return _0xcf9200;});}return null;};}function removeEntity(_0x42c990,_0x51243c){return function(_0x399808){if(_0x399808){return _0x399808[_0x6b01('0x22')]()[_0x6b01('0x21')](function(){_0x42c990[_0x6b01('0x16')](0xcc)[_0x6b01('0x23')]();});}};}function handleEntityNotFound(_0x2456e9,_0x1b46fb){return function(_0x136452){if(!_0x136452){_0x2456e9[_0x6b01('0x15')](0x194);}return _0x136452;};}function handleError(_0x152dda,_0x3c0607){_0x3c0607=_0x3c0607||0x1f4;return function(_0xa846d8){logger[_0x6b01('0x24')](_0xa846d8['stack']);if(_0xa846d8[_0x6b01('0x25')]){delete _0xa846d8[_0x6b01('0x25')];}_0x152dda[_0x6b01('0x16')](_0x3c0607)[_0x6b01('0x26')](_0xa846d8);};}exports[_0x6b01('0x27')]=function(_0x528cbd,_0x54f030){var _0x3fae61={},_0x3df3d4={},_0xc574c={'count':0x0,'rows':[]};var _0x8883d1=_[_0x6b01('0x28')](db[_0x6b01('0x29')]['rawAttributes'],function(_0x39f193){return{'name':_0x39f193['fieldName'],'type':_0x39f193[_0x6b01('0x2a')]['key']};});_0x3df3d4[_0x6b01('0x2b')]=_[_0x6b01('0x28')](_0x8883d1,_0x6b01('0x25'));_0x3df3d4[_0x6b01('0x2c')]=_[_0x6b01('0x2d')](_0x528cbd['query']);_0x3df3d4[_0x6b01('0x2e')]=_[_0x6b01('0x2f')](_0x3df3d4[_0x6b01('0x2b')],_0x3df3d4['query']);_0x3fae61['attributes']=_[_0x6b01('0x2f')](_0x3df3d4['model'],qs[_0x6b01('0x30')](_0x528cbd[_0x6b01('0x2c')][_0x6b01('0x30')]));_0x3fae61['attributes']=_0x3fae61[_0x6b01('0x31')][_0x6b01('0x32')]?_0x3fae61[_0x6b01('0x31')]:_0x3df3d4['model'];if(!_0x528cbd[_0x6b01('0x2c')][_0x6b01('0x33')](_0x6b01('0x34'))){_0x3fae61[_0x6b01('0x1a')]=qs[_0x6b01('0x1a')](_0x528cbd['query'][_0x6b01('0x1a')]);_0x3fae61[_0x6b01('0x18')]=qs[_0x6b01('0x18')](_0x528cbd[_0x6b01('0x2c')][_0x6b01('0x18')]);}_0x3fae61[_0x6b01('0x35')]=qs[_0x6b01('0x36')](_0x528cbd[_0x6b01('0x2c')]['sort']);_0x3fae61[_0x6b01('0x37')]=qs['filters'](_[_0x6b01('0x38')](_0x528cbd[_0x6b01('0x2c')],_0x3df3d4[_0x6b01('0x2e')]),_0x8883d1);if(_0x528cbd[_0x6b01('0x2c')][_0x6b01('0x39')]){_0x3fae61[_0x6b01('0x37')]=_[_0x6b01('0x3a')](_0x3fae61['where'],{'$or':_[_0x6b01('0x28')](_0x8883d1,function(_0x15f274){if(_0x15f274[_0x6b01('0x2a')]!==_0x6b01('0x3b')){var _0x1ca3aa={};_0x1ca3aa[_0x15f274[_0x6b01('0x25')]]={'$like':'%'+_0x528cbd[_0x6b01('0x2c')][_0x6b01('0x39')]+'%'};return _0x1ca3aa;}})});}_0x3fae61=_['merge']({},_0x3fae61,_0x528cbd[_0x6b01('0x3c')]);var _0x55907f={'where':_0x3fae61[_0x6b01('0x37')]};return db[_0x6b01('0x29')]['count'](_0x55907f)[_0x6b01('0x21')](function(_0x2e661b){_0xc574c[_0x6b01('0x1b')]=_0x2e661b;if(_0x528cbd[_0x6b01('0x2c')][_0x6b01('0x3d')]){_0x3fae61[_0x6b01('0x3e')]=[{'all':!![]}];}return db[_0x6b01('0x29')][_0x6b01('0x3f')](_0x3fae61);})[_0x6b01('0x21')](function(_0x17f335){_0xc574c['rows']=_0x17f335;return _0xc574c;})[_0x6b01('0x21')](respondWithFilteredResult(_0x54f030,_0x3fae61))[_0x6b01('0x40')](handleError(_0x54f030,null));};exports['show']=function(_0x52cec0,_0x32b9ec){var _0xd11195={'raw':![],'where':{'id':_0x52cec0[_0x6b01('0x41')]['id']}},_0x558ec1={};_0x558ec1[_0x6b01('0x2b')]=_['keys'](db[_0x6b01('0x29')]['rawAttributes']);_0x558ec1[_0x6b01('0x2c')]=_[_0x6b01('0x2d')](_0x52cec0[_0x6b01('0x2c')]);_0x558ec1['filters']=_[_0x6b01('0x2f')](_0x558ec1[_0x6b01('0x2b')],_0x558ec1['query']);_0xd11195['attributes']=_['intersection'](_0x558ec1[_0x6b01('0x2b')],qs[_0x6b01('0x30')](_0x52cec0[_0x6b01('0x2c')][_0x6b01('0x30')]));_0xd11195[_0x6b01('0x31')]=_0xd11195[_0x6b01('0x31')]['length']?_0xd11195[_0x6b01('0x31')]:_0x558ec1[_0x6b01('0x2b')];if(_0x52cec0[_0x6b01('0x2c')][_0x6b01('0x3d')]){_0xd11195[_0x6b01('0x3e')]=[{'all':!![]}];}_0xd11195=_[_0x6b01('0x3a')]({},_0xd11195,_0x52cec0['options']);return db[_0x6b01('0x29')]['find'](_0xd11195)['then'](handleEntityNotFound(_0x32b9ec,null))[_0x6b01('0x21')](respondWithResult(_0x32b9ec,null))[_0x6b01('0x40')](handleError(_0x32b9ec,null));};exports['create']=function(_0x408bb0,_0x27442e){return db[_0x6b01('0x29')]['create'](_0x408bb0['body'],{})['then'](respondWithResult(_0x27442e,0xc9))[_0x6b01('0x40')](handleError(_0x27442e,null));};exports[_0x6b01('0x42')]=function(_0x518d94,_0x34cef6){if(_0x518d94['body']['id']){delete _0x518d94['body']['id'];}return db['Integration'][_0x6b01('0x43')]({'where':{'id':_0x518d94[_0x6b01('0x41')]['id']}})['then'](handleEntityNotFound(_0x34cef6,null))['then'](saveUpdates(_0x518d94[_0x6b01('0x44')],null))['then'](respondWithResult(_0x34cef6,null))[_0x6b01('0x40')](handleError(_0x34cef6,null));};exports[_0x6b01('0x22')]=function(_0x32d446,_0x172a56){return db[_0x6b01('0x29')]['find']({'where':{'id':_0x32d446[_0x6b01('0x41')]['id']}})[_0x6b01('0x21')](handleEntityNotFound(_0x172a56,null))[_0x6b01('0x21')](removeEntity(_0x172a56,null))['catch'](handleError(_0x172a56,null));}; \ No newline at end of file +var _0x1623=['model','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','pick','filter','where','merge','options','Integration','findAll','rows','catch','show','params','length','find','create','body','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','count','offset','set','apply','save','update','then','destroy','sendStatus','error','name','send','index','map','rawAttributes','fieldName','type','key'];(function(_0x47a7d0,_0x4e182d){var _0xb9bd08=function(_0x588ee2){while(--_0x588ee2){_0x47a7d0['push'](_0x47a7d0['shift']());}};_0xb9bd08(++_0x4e182d);}(_0x1623,0xab));var _0x3162=function(_0x3ba573,_0x18e144){_0x3ba573=_0x3ba573-0x0;var _0x1b35ca=_0x1623[_0x3ba573];return _0x1b35ca;};'use strict';var emlformat=require(_0x3162('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x3162('0x1'));var rp=require(_0x3162('0x2'));var moment=require(_0x3162('0x3'));var BPromise=require(_0x3162('0x4'));var Mustache=require(_0x3162('0x5'));var util=require('util');var path=require('path');var sox=require(_0x3162('0x6'));var csv=require('to-csv');var ejs=require(_0x3162('0x7'));var fs=require('fs');var fs_extra=require(_0x3162('0x8'));var _=require('lodash');var squel=require(_0x3162('0x9'));var crypto=require(_0x3162('0xa'));var jsforce=require(_0x3162('0xb'));var deskjs=require(_0x3162('0xc'));var toCsv=require(_0x3162('0xd'));var querystring=require(_0x3162('0xe'));var Papa=require(_0x3162('0xf'));var Redis=require(_0x3162('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x3162('0x11'));var hardwareService=require(_0x3162('0x12'));var logger=require(_0x3162('0x13'))(_0x3162('0x14'));var utils=require(_0x3162('0x15'));var config=require(_0x3162('0x16'));var licenseUtil=require(_0x3162('0x17'));var db=require(_0x3162('0x18'))['db'];function respondWithStatusCode(_0x157ab8,_0x4c3625){_0x4c3625=_0x4c3625||0xcc;return function(_0x2d11c5){if(_0x2d11c5){return _0x157ab8['sendStatus'](_0x4c3625);}return _0x157ab8[_0x3162('0x19')](_0x4c3625)[_0x3162('0x1a')]();};}function respondWithResult(_0x49d1ad,_0x4a393a){_0x4a393a=_0x4a393a||0xc8;return function(_0x198764){if(_0x198764){return _0x49d1ad[_0x3162('0x19')](_0x4a393a)[_0x3162('0x1b')](_0x198764);}};}function respondWithFilteredResult(_0x4b8a3b,_0x15e348){return function(_0x3d0bea){if(_0x3d0bea){var _0x2705d1=typeof _0x15e348['offset']===_0x3162('0x1c')&&typeof _0x15e348[_0x3162('0x1d')]===_0x3162('0x1c');var _0xc3ee06=_0x3d0bea[_0x3162('0x1e')];var _0x1eed46=_0x2705d1?0x0:_0x15e348[_0x3162('0x1f')];var _0x4b2bf3=_0x2705d1?_0x3d0bea[_0x3162('0x1e')]:_0x15e348[_0x3162('0x1f')]+_0x15e348[_0x3162('0x1d')];var _0x36ca97;if(_0x4b2bf3>=_0xc3ee06){_0x4b2bf3=_0xc3ee06;_0x36ca97=0xc8;}else{_0x36ca97=0xce;}_0x4b8a3b['status'](_0x36ca97);return _0x4b8a3b[_0x3162('0x20')]('Content-Range',_0x1eed46+'-'+_0x4b2bf3+'/'+_0xc3ee06)['json'](_0x3d0bea);}return null;};}function patchUpdates(_0xa5c62b){return function(_0x3e4d23){try{jsonpatch[_0x3162('0x21')](_0x3e4d23,_0xa5c62b,!![]);}catch(_0x523fab){return BPromise['reject'](_0x523fab);}return _0x3e4d23[_0x3162('0x22')]();};}function saveUpdates(_0x396372,_0x32c051){return function(_0x26c90d){if(_0x26c90d){return _0x26c90d[_0x3162('0x23')](_0x396372)[_0x3162('0x24')](function(_0x52ae25){return _0x52ae25;});}return null;};}function removeEntity(_0x1b2713,_0x5a4994){return function(_0xd283d6){if(_0xd283d6){return _0xd283d6[_0x3162('0x25')]()[_0x3162('0x24')](function(){_0x1b2713[_0x3162('0x19')](0xcc)[_0x3162('0x1a')]();});}};}function handleEntityNotFound(_0x3c543e,_0x30552f){return function(_0x5f8f7){if(!_0x5f8f7){_0x3c543e[_0x3162('0x26')](0x194);}return _0x5f8f7;};}function handleError(_0x356c5d,_0x8fa09f){_0x8fa09f=_0x8fa09f||0x1f4;return function(_0x2f62d7){logger[_0x3162('0x27')](_0x2f62d7['stack']);if(_0x2f62d7[_0x3162('0x28')]){delete _0x2f62d7['name'];}_0x356c5d[_0x3162('0x19')](_0x8fa09f)[_0x3162('0x29')](_0x2f62d7);};}exports[_0x3162('0x2a')]=function(_0x57f567,_0x4903e7){var _0xda0389={},_0xaa1f35={},_0x14df16={'count':0x0,'rows':[]};var _0x399148=_[_0x3162('0x2b')](db['Integration'][_0x3162('0x2c')],function(_0x4e3cc2){return{'name':_0x4e3cc2[_0x3162('0x2d')],'type':_0x4e3cc2[_0x3162('0x2e')][_0x3162('0x2f')]};});_0xaa1f35[_0x3162('0x30')]=_[_0x3162('0x2b')](_0x399148,_0x3162('0x28'));_0xaa1f35[_0x3162('0x31')]=_[_0x3162('0x32')](_0x57f567['query']);_0xaa1f35[_0x3162('0x33')]=_[_0x3162('0x34')](_0xaa1f35['model'],_0xaa1f35[_0x3162('0x31')]);_0xda0389[_0x3162('0x35')]=_['intersection'](_0xaa1f35['model'],qs[_0x3162('0x36')](_0x57f567['query'][_0x3162('0x36')]));_0xda0389[_0x3162('0x35')]=_0xda0389[_0x3162('0x35')]['length']?_0xda0389['attributes']:_0xaa1f35[_0x3162('0x30')];if(!_0x57f567[_0x3162('0x31')]['hasOwnProperty'](_0x3162('0x37'))){_0xda0389['limit']=qs[_0x3162('0x1d')](_0x57f567[_0x3162('0x31')][_0x3162('0x1d')]);_0xda0389[_0x3162('0x1f')]=qs[_0x3162('0x1f')](_0x57f567[_0x3162('0x31')][_0x3162('0x1f')]);}_0xda0389[_0x3162('0x38')]=qs[_0x3162('0x39')](_0x57f567[_0x3162('0x31')][_0x3162('0x39')]);_0xda0389['where']=qs[_0x3162('0x33')](_[_0x3162('0x3a')](_0x57f567[_0x3162('0x31')],_0xaa1f35['filters']),_0x399148);if(_0x57f567['query'][_0x3162('0x3b')]){_0xda0389[_0x3162('0x3c')]=_[_0x3162('0x3d')](_0xda0389[_0x3162('0x3c')],{'$or':_['map'](_0x399148,function(_0x4186b6){if(_0x4186b6['type']!=='VIRTUAL'){var _0x5dee49={};_0x5dee49[_0x4186b6[_0x3162('0x28')]]={'$like':'%'+_0x57f567[_0x3162('0x31')][_0x3162('0x3b')]+'%'};return _0x5dee49;}})});}_0xda0389=_['merge']({},_0xda0389,_0x57f567[_0x3162('0x3e')]);var _0x2ce9c6={'where':_0xda0389[_0x3162('0x3c')]};return db[_0x3162('0x3f')][_0x3162('0x1e')](_0x2ce9c6)['then'](function(_0x5447d6){_0x14df16[_0x3162('0x1e')]=_0x5447d6;if(_0x57f567[_0x3162('0x31')]['includeAll']){_0xda0389['include']=[{'all':!![]}];}return db[_0x3162('0x3f')][_0x3162('0x40')](_0xda0389);})[_0x3162('0x24')](function(_0x4883ac){_0x14df16[_0x3162('0x41')]=_0x4883ac;return _0x14df16;})[_0x3162('0x24')](respondWithFilteredResult(_0x4903e7,_0xda0389))[_0x3162('0x42')](handleError(_0x4903e7,null));};exports[_0x3162('0x43')]=function(_0x534708,_0x2617d3){var _0x282e3e={'raw':![],'where':{'id':_0x534708[_0x3162('0x44')]['id']}},_0x522cce={};_0x522cce[_0x3162('0x30')]=_['keys'](db[_0x3162('0x3f')][_0x3162('0x2c')]);_0x522cce['query']=_[_0x3162('0x32')](_0x534708['query']);_0x522cce[_0x3162('0x33')]=_[_0x3162('0x34')](_0x522cce[_0x3162('0x30')],_0x522cce[_0x3162('0x31')]);_0x282e3e[_0x3162('0x35')]=_[_0x3162('0x34')](_0x522cce['model'],qs[_0x3162('0x36')](_0x534708[_0x3162('0x31')][_0x3162('0x36')]));_0x282e3e['attributes']=_0x282e3e[_0x3162('0x35')][_0x3162('0x45')]?_0x282e3e['attributes']:_0x522cce[_0x3162('0x30')];if(_0x534708['query']['includeAll']){_0x282e3e['include']=[{'all':!![]}];}_0x282e3e=_[_0x3162('0x3d')]({},_0x282e3e,_0x534708[_0x3162('0x3e')]);return db[_0x3162('0x3f')][_0x3162('0x46')](_0x282e3e)[_0x3162('0x24')](handleEntityNotFound(_0x2617d3,null))[_0x3162('0x24')](respondWithResult(_0x2617d3,null))[_0x3162('0x42')](handleError(_0x2617d3,null));};exports[_0x3162('0x47')]=function(_0x3d2958,_0x28865c){return db[_0x3162('0x3f')][_0x3162('0x47')](_0x3d2958[_0x3162('0x48')],{})['then'](respondWithResult(_0x28865c,0xc9))[_0x3162('0x42')](handleError(_0x28865c,null));};exports['update']=function(_0x4f1dde,_0x12d791){if(_0x4f1dde[_0x3162('0x48')]['id']){delete _0x4f1dde[_0x3162('0x48')]['id'];}return db[_0x3162('0x3f')]['find']({'where':{'id':_0x4f1dde[_0x3162('0x44')]['id']}})['then'](handleEntityNotFound(_0x12d791,null))[_0x3162('0x24')](saveUpdates(_0x4f1dde[_0x3162('0x48')],null))['then'](respondWithResult(_0x12d791,null))[_0x3162('0x42')](handleError(_0x12d791,null));};exports['destroy']=function(_0x516599,_0x13e7c4){return db[_0x3162('0x3f')][_0x3162('0x46')]({'where':{'id':_0x516599[_0x3162('0x44')]['id']}})[_0x3162('0x24')](handleEntityNotFound(_0x13e7c4,null))[_0x3162('0x24')](removeEntity(_0x13e7c4,null))[_0x3162('0x42')](handleError(_0x13e7c4,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index 75316df..e9786ed 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 _0x612e=['../../config/logger','api','bluebird','request-promise','path','rimraf','./integration.attributes','exports','define','Integration','integrations','util'];(function(_0x10383f,_0x29dee2){var _0x24acf2=function(_0x561f6c){while(--_0x561f6c){_0x10383f['push'](_0x10383f['shift']());}};_0x24acf2(++_0x29dee2);}(_0x612e,0xbf));var _0xe612=function(_0x367aa7,_0x2bb647){_0x367aa7=_0x367aa7-0x0;var _0x2ad802=_0x612e[_0x367aa7];return _0x2ad802;};'use strict';var _=require('lodash');var util=require(_0xe612('0x0'));var logger=require(_0xe612('0x1'))(_0xe612('0x2'));var moment=require('moment');var BPromise=require(_0xe612('0x3'));var rp=require(_0xe612('0x4'));var fs=require('fs');var path=require(_0xe612('0x5'));var rimraf=require(_0xe612('0x6'));var config=require('../../config/environment');var attributes=require(_0xe612('0x7'));module[_0xe612('0x8')]=function(_0x55a28c,_0x3944e2){return _0x55a28c[_0xe612('0x9')](_0xe612('0xa'),attributes,{'tableName':_0xe612('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe509=['../../config/environment','./integration.attributes','exports','define','integrations','util','api','moment','bluebird','request-promise','rimraf'];(function(_0x31ddea,_0x40de6d){var _0x12539b=function(_0x1d353b){while(--_0x1d353b){_0x31ddea['push'](_0x31ddea['shift']());}};_0x12539b(++_0x40de6d);}(_0xe509,0x10d));var _0x9e50=function(_0x53f0db,_0x35c67c){_0x53f0db=_0x53f0db-0x0;var _0xae0a5c=_0xe509[_0x53f0db];return _0xae0a5c;};'use strict';var _=require('lodash');var util=require(_0x9e50('0x0'));var logger=require('../../config/logger')(_0x9e50('0x1'));var moment=require(_0x9e50('0x2'));var BPromise=require(_0x9e50('0x3'));var rp=require(_0x9e50('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9e50('0x5'));var config=require(_0x9e50('0x6'));var attributes=require(_0x9e50('0x7'));module[_0x9e50('0x8')]=function(_0x4f76cd,_0x2f194b){return _0x4f76cd[_0x9e50('0x9')]('Integration',attributes,{'tableName':_0x9e50('0xa'),'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 e93bbb3..26227e9 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 _0x7880=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','Integration,\x20%s,\x20%s','request\x20sent','debug','Integration,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x31cfe1,_0x3a9de3){var _0x340cc5=function(_0x4295b8){while(--_0x4295b8){_0x31cfe1['push'](_0x31cfe1['shift']());}};_0x340cc5(++_0x3a9de3);}(_0x7880,0x1f4));var _0x0788=function(_0x292600,_0x120a55){_0x292600=_0x292600-0x0;var _0x2ef83b=_0x7880[_0x292600];return _0x2ef83b;};'use strict';var _=require('lodash');var util=require(_0x0788('0x0'));var moment=require(_0x0788('0x1'));var BPromise=require(_0x0788('0x2'));var rs=require(_0x0788('0x3'));var fs=require('fs');var Redis=require(_0x0788('0x4'));var db=require(_0x0788('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0788('0x6'))(_0x0788('0x7'));var config=require(_0x0788('0x8'));var jayson=require(_0x0788('0x9'));var client=jayson[_0x0788('0xa')][_0x0788('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3f9cb8,_0x44bbb5,_0x3c29f3){return new BPromise(function(_0x422f8b,_0x55e48a){return client[_0x0788('0xc')](_0x3f9cb8,_0x3c29f3)['then'](function(_0xabaf81){logger['info'](_0x0788('0xd'),_0x44bbb5,_0x0788('0xe'));logger[_0x0788('0xf')](_0x0788('0x10'),_0x44bbb5,_0x0788('0xe'),JSON['stringify'](_0xabaf81));if(_0xabaf81[_0x0788('0x11')]){if(_0xabaf81[_0x0788('0x11')][_0x0788('0x12')]===0x1f4){logger[_0x0788('0x11')](_0x0788('0xd'),_0x44bbb5,_0xabaf81[_0x0788('0x11')][_0x0788('0x13')]);return _0x55e48a(_0xabaf81['error'][_0x0788('0x13')]);}logger[_0x0788('0x11')](_0x0788('0xd'),_0x44bbb5,_0xabaf81[_0x0788('0x11')]['message']);return _0x422f8b(_0xabaf81[_0x0788('0x11')]['message']);}else{logger[_0x0788('0x14')](_0x0788('0xd'),_0x44bbb5,_0x0788('0xe'));_0x422f8b(_0xabaf81[_0x0788('0x15')][_0x0788('0x13')]);}})[_0x0788('0x16')](function(_0x5e1a29){logger['error'](_0x0788('0xd'),_0x44bbb5,_0x5e1a29);_0x55e48a(_0x5e1a29);});});} \ No newline at end of file +var _0x2542=['info','Integration,\x20%s,\x20%s','debug','Integration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then'];(function(_0x3be0d7,_0x4f0a3e){var _0x18188a=function(_0x2868f1){while(--_0x2868f1){_0x3be0d7['push'](_0x3be0d7['shift']());}};_0x18188a(++_0x4f0a3e);}(_0x2542,0x169));var _0x2254=function(_0x51d3b9,_0x302432){_0x51d3b9=_0x51d3b9-0x0;var _0x17d110=_0x2542[_0x51d3b9];return _0x17d110;};'use strict';var _=require(_0x2254('0x0'));var util=require(_0x2254('0x1'));var moment=require(_0x2254('0x2'));var BPromise=require(_0x2254('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2254('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x2254('0x5'));var logger=require(_0x2254('0x6'))(_0x2254('0x7'));var config=require(_0x2254('0x8'));var jayson=require(_0x2254('0x9'));var client=jayson['client'][_0x2254('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xe8ca50,_0x2ee7ee,_0x3c45ec){return new BPromise(function(_0x1637ad,_0x477b47){return client[_0x2254('0xb')](_0xe8ca50,_0x3c45ec)[_0x2254('0xc')](function(_0xb395da){logger[_0x2254('0xd')](_0x2254('0xe'),_0x2ee7ee,'request\x20sent');logger[_0x2254('0xf')](_0x2254('0x10'),_0x2ee7ee,_0x2254('0x11'),JSON[_0x2254('0x12')](_0xb395da));if(_0xb395da['error']){if(_0xb395da['error'][_0x2254('0x13')]===0x1f4){logger[_0x2254('0x14')](_0x2254('0xe'),_0x2ee7ee,_0xb395da[_0x2254('0x14')][_0x2254('0x15')]);return _0x477b47(_0xb395da[_0x2254('0x14')]['message']);}logger[_0x2254('0x14')](_0x2254('0xe'),_0x2ee7ee,_0xb395da['error'][_0x2254('0x15')]);return _0x1637ad(_0xb395da[_0x2254('0x14')][_0x2254('0x15')]);}else{logger[_0x2254('0xd')](_0x2254('0xe'),_0x2ee7ee,_0x2254('0x11'));_0x1637ad(_0xb395da['result'][_0x2254('0x15')]);}})['catch'](function(_0x327d6d){logger[_0x2254('0x14')](_0x2254('0xe'),_0x2ee7ee,_0x327d6d);_0x477b47(_0x327d6d);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index a6f35a9..5228001 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 _0x5fab=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./integrationReport.controller','get','isAuthenticated','/describe','describe','/:id','show','create','put','update','delete','destroy','multer','util','connect-timeout'];(function(_0x8a6ab0,_0x44a78b){var _0x1613ec=function(_0x1f4cbb){while(--_0x1f4cbb){_0x8a6ab0['push'](_0x8a6ab0['shift']());}};_0x1613ec(++_0x44a78b);}(_0x5fab,0x177));var _0xb5fa=function(_0xb4bdb3,_0x48dca0){_0xb4bdb3=_0xb4bdb3-0x0;var _0x4c8c02=_0x5fab[_0xb4bdb3];return _0x4c8c02;};'use strict';var multer=require(_0xb5fa('0x0'));var util=require(_0xb5fa('0x1'));var path=require('path');var timeout=require(_0xb5fa('0x2'));var express=require(_0xb5fa('0x3'));var router=express[_0xb5fa('0x4')]();var fs_extra=require(_0xb5fa('0x5'));var auth=require(_0xb5fa('0x6'));var interaction=require(_0xb5fa('0x7'));var config=require(_0xb5fa('0x8'));var controller=require(_0xb5fa('0x9'));router[_0xb5fa('0xa')]('/',auth[_0xb5fa('0xb')](),controller['index']);router['get'](_0xb5fa('0xc'),auth[_0xb5fa('0xb')](),controller[_0xb5fa('0xd')]);router['get'](_0xb5fa('0xe'),auth[_0xb5fa('0xb')](),controller[_0xb5fa('0xf')]);router['post']('/',auth['isAuthenticated'](),controller[_0xb5fa('0x10')]);router[_0xb5fa('0x11')](_0xb5fa('0xe'),auth[_0xb5fa('0xb')](),controller[_0xb5fa('0x12')]);router[_0xb5fa('0x13')](_0xb5fa('0xe'),auth[_0xb5fa('0xb')](),controller[_0xb5fa('0x14')]);module['exports']=router; \ No newline at end of file +var _0x5f2f=['put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./integrationReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post'];(function(_0x5bd426,_0x4878e5){var _0x23a7eb=function(_0x594b42){while(--_0x594b42){_0x5bd426['push'](_0x5bd426['shift']());}};_0x23a7eb(++_0x4878e5);}(_0x5f2f,0x73));var _0xf5f2=function(_0x45f6ca,_0x2811ad){_0x45f6ca=_0x45f6ca-0x0;var _0x33d664=_0x5f2f[_0x45f6ca];return _0x33d664;};'use strict';var multer=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var path=require(_0xf5f2('0x2'));var timeout=require(_0xf5f2('0x3'));var express=require(_0xf5f2('0x4'));var router=express[_0xf5f2('0x5')]();var fs_extra=require(_0xf5f2('0x6'));var auth=require(_0xf5f2('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xf5f2('0x8'));router[_0xf5f2('0x9')]('/',auth[_0xf5f2('0xa')](),controller[_0xf5f2('0xb')]);router[_0xf5f2('0x9')](_0xf5f2('0xc'),auth['isAuthenticated'](),controller[_0xf5f2('0xd')]);router[_0xf5f2('0x9')](_0xf5f2('0xe'),auth['isAuthenticated'](),controller[_0xf5f2('0xf')]);router[_0xf5f2('0x10')]('/',auth[_0xf5f2('0xa')](),controller['create']);router[_0xf5f2('0x11')]('/:id',auth['isAuthenticated'](),controller[_0xf5f2('0x12')]);router[_0xf5f2('0x13')]('/:id',auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x14')]);module[_0xf5f2('0x15')]=router; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.attributes.js b/server/api/integrationReport/integrationReport.attributes.js index a8769aa..2d95cc9 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 _0xfa09=['INTEGER','DATE','BOOLEAN','TEXT','SENDING','RECEIVED','FAILED','sequelize','exports','STRING'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xfa09,0x7f));var _0x9fa0=function(_0x190b91,_0x7d84e5){_0x190b91=_0x190b91-0x0;var _0x3d2817=_0xfa09[_0x190b91];return _0x3d2817;};'use strict';var Sequelize=require(_0x9fa0('0x0'));module[_0x9fa0('0x1')]={'integration':{'type':Sequelize[_0x9fa0('0x2')]},'eventChannel':{'type':Sequelize[_0x9fa0('0x2')]},'exitStatus':{'type':Sequelize[_0x9fa0('0x2')]},'ticketId':{'type':Sequelize[_0x9fa0('0x2')]},'integrationId':{'type':Sequelize[_0x9fa0('0x3')]},'contacts':{'type':Sequelize[_0x9fa0('0x2')]},'uniqueid':{'type':Sequelize[_0x9fa0('0x2')]},'calleridnum':{'type':Sequelize[_0x9fa0('0x2')]},'calleridname':{'type':Sequelize[_0x9fa0('0x2')]},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x9fa0('0x2')]},'agentcalledAt':{'type':Sequelize[_0x9fa0('0x4')]},'agentconnectAt':{'type':Sequelize[_0x9fa0('0x4')]},'holdtime':{'type':Sequelize[_0x9fa0('0x3')]},'agentcomplete':{'type':Sequelize[_0x9fa0('0x5')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x9fa0('0x4')]},'talktime':{'type':Sequelize[_0x9fa0('0x3')]},'agentacw':{'type':Sequelize[_0x9fa0('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x9fa0('0x3')]},'reason':{'type':Sequelize['STRING']},'agentringnoanswer':{'type':Sequelize[_0x9fa0('0x5')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0x9fa0('0x4')]},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x9fa0('0x4')]},'lastevent':{'type':Sequelize[_0x9fa0('0x2')]},'channel':{'type':Sequelize[_0x9fa0('0x2')]},'channelstate':{'type':Sequelize[_0x9fa0('0x3')]},'channelstatedesc':{'type':Sequelize[_0x9fa0('0x2')]},'connectedlinenum':{'type':Sequelize[_0x9fa0('0x2')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x9fa0('0x2')]},'accountcode':{'type':Sequelize[_0x9fa0('0x2')]},'context':{'type':Sequelize[_0x9fa0('0x2')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x9fa0('0x2')]},'destchannel':{'type':Sequelize[_0x9fa0('0x2')]},'destchannelstate':{'type':Sequelize[_0x9fa0('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0x9fa0('0x2')]},'destcalleridnum':{'type':Sequelize[_0x9fa0('0x2')]},'destcalleridname':{'type':Sequelize[_0x9fa0('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x9fa0('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x9fa0('0x2')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0x9fa0('0x2')]},'destcontext':{'type':Sequelize[_0x9fa0('0x2')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0x9fa0('0x2')]},'destuniqueid':{'type':Sequelize['STRING']},'messageId':{'type':Sequelize[_0x9fa0('0x2')]},'inReplyTo':{'type':Sequelize[_0x9fa0('0x2')]},'subject':{'type':Sequelize[_0x9fa0('0x2')]},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize['STRING']},'attachment':{'type':Sequelize[_0x9fa0('0x6')]},'html':{'type':Sequelize[_0x9fa0('0x6')]},'text':{'type':Sequelize[_0x9fa0('0x6')]},'status':{'type':Sequelize['ENUM']('SENT',_0x9fa0('0x7'),_0x9fa0('0x8'),_0x9fa0('0x9'))},'url':{'type':Sequelize['STRING']},'app':{'type':Sequelize[_0x9fa0('0x2')]},'appdata':{'type':Sequelize[_0x9fa0('0x2')]},'projectId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x87d1=['ENUM','SENT','SENDING','RECEIVED','FAILED','sequelize','exports','STRING','INTEGER','DATE','BOOLEAN','TEXT'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x87d1,0x125));var _0x187d=function(_0x551e84,_0x292d8c){_0x551e84=_0x551e84-0x0;var _0x7ffe22=_0x87d1[_0x551e84];return _0x7ffe22;};'use strict';var Sequelize=require(_0x187d('0x0'));module[_0x187d('0x1')]={'integration':{'type':Sequelize[_0x187d('0x2')]},'eventChannel':{'type':Sequelize['STRING']},'exitStatus':{'type':Sequelize[_0x187d('0x2')]},'ticketId':{'type':Sequelize[_0x187d('0x2')]},'integrationId':{'type':Sequelize[_0x187d('0x3')]},'contacts':{'type':Sequelize[_0x187d('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x187d('0x2')]},'interface':{'type':Sequelize[_0x187d('0x2')]},'membername':{'type':Sequelize[_0x187d('0x2')]},'agentcalledAt':{'type':Sequelize[_0x187d('0x4')]},'agentconnectAt':{'type':Sequelize[_0x187d('0x4')]},'holdtime':{'type':Sequelize[_0x187d('0x3')]},'agentcomplete':{'type':Sequelize[_0x187d('0x5')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x187d('0x4')]},'talktime':{'type':Sequelize[_0x187d('0x3')]},'agentacw':{'type':Sequelize[_0x187d('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x187d('0x3')]},'reason':{'type':Sequelize['STRING']},'agentringnoanswer':{'type':Sequelize[_0x187d('0x5')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0x187d('0x4')]},'agentdump':{'type':Sequelize[_0x187d('0x5')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x187d('0x4')]},'lastevent':{'type':Sequelize[_0x187d('0x2')]},'channel':{'type':Sequelize[_0x187d('0x2')]},'channelstate':{'type':Sequelize[_0x187d('0x3')]},'channelstatedesc':{'type':Sequelize[_0x187d('0x2')]},'connectedlinenum':{'type':Sequelize[_0x187d('0x2')]},'connectedlinename':{'type':Sequelize[_0x187d('0x2')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x187d('0x2')]},'context':{'type':Sequelize[_0x187d('0x2')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x187d('0x2')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0x187d('0x3')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0x187d('0x2')]},'destcalleridname':{'type':Sequelize[_0x187d('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x187d('0x2')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0x187d('0x2')]},'destaccountcode':{'type':Sequelize[_0x187d('0x2')]},'destcontext':{'type':Sequelize[_0x187d('0x2')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0x187d('0x2')]},'destuniqueid':{'type':Sequelize[_0x187d('0x2')]},'messageId':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize[_0x187d('0x2')]},'subject':{'type':Sequelize['STRING']},'from':{'type':Sequelize[_0x187d('0x2')]},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0x187d('0x2')]},'attachment':{'type':Sequelize[_0x187d('0x6')]},'html':{'type':Sequelize[_0x187d('0x6')]},'text':{'type':Sequelize['TEXT']},'status':{'type':Sequelize[_0x187d('0x7')](_0x187d('0x8'),_0x187d('0x9'),_0x187d('0xa'),_0x187d('0xb'))},'url':{'type':Sequelize[_0x187d('0x2')]},'app':{'type':Sequelize[_0x187d('0x2')]},'appdata':{'type':Sequelize['STRING']},'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 f6b985d..4473474 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 _0xed9a=['path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','undefined','count','offset','set','apply','reject','update','then','error','stack','name','map','IntegrationReport','rawAttributes','type','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','params','find','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util'];(function(_0x3602be,_0x4d4e43){var _0x41e34b=function(_0x4df124){while(--_0x4df124){_0x3602be['push'](_0x3602be['shift']());}};_0x41e34b(++_0x4d4e43);}(_0xed9a,0x1bb));var _0xaed9=function(_0x5d4607,_0x6b5e7b){_0x5d4607=_0x5d4607-0x0;var _0x5e4a86=_0xed9a[_0x5d4607];return _0x5e4a86;};'use strict';var emlformat=require(_0xaed9('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xaed9('0x1'));var jsonpatch=require(_0xaed9('0x2'));var rp=require(_0xaed9('0x3'));var moment=require(_0xaed9('0x4'));var BPromise=require(_0xaed9('0x5'));var Mustache=require('mustache');var util=require(_0xaed9('0x6'));var path=require(_0xaed9('0x7'));var sox=require('sox');var csv=require(_0xaed9('0x8'));var ejs=require(_0xaed9('0x9'));var fs=require('fs');var fs_extra=require(_0xaed9('0xa'));var _=require(_0xaed9('0xb'));var squel=require(_0xaed9('0xc'));var crypto=require(_0xaed9('0xd'));var jsforce=require(_0xaed9('0xe'));var deskjs=require(_0xaed9('0xf'));var toCsv=require(_0xaed9('0x8'));var querystring=require(_0xaed9('0x10'));var Papa=require(_0xaed9('0x11'));var Redis=require(_0xaed9('0x12'));var authService=require(_0xaed9('0x13'));var qs=require(_0xaed9('0x14'));var as=require(_0xaed9('0x15'));var hardwareService=require(_0xaed9('0x16'));var logger=require(_0xaed9('0x17'))('api');var utils=require(_0xaed9('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xaed9('0x19'));var db=require(_0xaed9('0x1a'))['db'];function respondWithStatusCode(_0xc744e2,_0x2826d9){_0x2826d9=_0x2826d9||0xcc;return function(_0x50ca05){if(_0x50ca05){return _0xc744e2[_0xaed9('0x1b')](_0x2826d9);}return _0xc744e2[_0xaed9('0x1c')](_0x2826d9)[_0xaed9('0x1d')]();};}function respondWithResult(_0x3ec401,_0x260f25){_0x260f25=_0x260f25||0xc8;return function(_0x5a2761){if(_0x5a2761){return _0x3ec401[_0xaed9('0x1c')](_0x260f25)[_0xaed9('0x1e')](_0x5a2761);}};}function respondWithFilteredResult(_0x555eb1,_0x30f8b4){return function(_0x568573){if(_0x568573){var _0x35122d=typeof _0x30f8b4['offset']==='undefined'&&typeof _0x30f8b4[_0xaed9('0x1f')]===_0xaed9('0x20');var _0x770f42=_0x568573[_0xaed9('0x21')];var _0x55c057=_0x35122d?0x0:_0x30f8b4[_0xaed9('0x22')];var _0x2ade05=_0x35122d?_0x568573['count']:_0x30f8b4['offset']+_0x30f8b4[_0xaed9('0x1f')];var _0x2ad04c;if(_0x2ade05>=_0x770f42){_0x2ade05=_0x770f42;_0x2ad04c=0xc8;}else{_0x2ad04c=0xce;}_0x555eb1[_0xaed9('0x1c')](_0x2ad04c);return _0x555eb1[_0xaed9('0x23')]('Content-Range',_0x55c057+'-'+_0x2ade05+'/'+_0x770f42)[_0xaed9('0x1e')](_0x568573);}return null;};}function patchUpdates(_0x3c3e19){return function(_0x5101c7){try{jsonpatch[_0xaed9('0x24')](_0x5101c7,_0x3c3e19,!![]);}catch(_0x3f10bd){return BPromise[_0xaed9('0x25')](_0x3f10bd);}return _0x5101c7['save']();};}function saveUpdates(_0x33f596,_0x4a54ff){return function(_0x1282a0){if(_0x1282a0){return _0x1282a0[_0xaed9('0x26')](_0x33f596)[_0xaed9('0x27')](function(_0x18a525){return _0x18a525;});}return null;};}function removeEntity(_0x585d7f,_0x253875){return function(_0x2325cc){if(_0x2325cc){return _0x2325cc['destroy']()[_0xaed9('0x27')](function(){_0x585d7f['status'](0xcc)[_0xaed9('0x1d')]();});}};}function handleEntityNotFound(_0x45b148,_0x3cf801){return function(_0x110c52){if(!_0x110c52){_0x45b148[_0xaed9('0x1b')](0x194);}return _0x110c52;};}function handleError(_0x542309,_0x255989){_0x255989=_0x255989||0x1f4;return function(_0x4de671){logger[_0xaed9('0x28')](_0x4de671[_0xaed9('0x29')]);if(_0x4de671[_0xaed9('0x2a')]){delete _0x4de671[_0xaed9('0x2a')];}_0x542309[_0xaed9('0x1c')](_0x255989)['send'](_0x4de671);};}exports['index']=function(_0x41462c,_0xb6e11d){var _0x13362a={},_0x5a947f={},_0x5cb081={'count':0x0,'rows':[]};var _0x50f8fc=_[_0xaed9('0x2b')](db[_0xaed9('0x2c')][_0xaed9('0x2d')],function(_0x4afc3f){return{'name':_0x4afc3f['fieldName'],'type':_0x4afc3f[_0xaed9('0x2e')]['key']};});_0x5a947f['model']=_[_0xaed9('0x2b')](_0x50f8fc,_0xaed9('0x2a'));_0x5a947f[_0xaed9('0x2f')]=_[_0xaed9('0x30')](_0x41462c[_0xaed9('0x2f')]);_0x5a947f[_0xaed9('0x31')]=_[_0xaed9('0x32')](_0x5a947f[_0xaed9('0x33')],_0x5a947f[_0xaed9('0x2f')]);_0x13362a['attributes']=_[_0xaed9('0x32')](_0x5a947f[_0xaed9('0x33')],qs[_0xaed9('0x34')](_0x41462c['query'][_0xaed9('0x34')]));_0x13362a[_0xaed9('0x35')]=_0x13362a['attributes'][_0xaed9('0x36')]?_0x13362a['attributes']:_0x5a947f['model'];if(!_0x41462c[_0xaed9('0x2f')][_0xaed9('0x37')](_0xaed9('0x38'))){_0x13362a[_0xaed9('0x1f')]=qs[_0xaed9('0x1f')](_0x41462c[_0xaed9('0x2f')][_0xaed9('0x1f')]);_0x13362a['offset']=qs[_0xaed9('0x22')](_0x41462c['query'][_0xaed9('0x22')]);}_0x13362a[_0xaed9('0x39')]=qs[_0xaed9('0x3a')](_0x41462c['query']['sort']);_0x13362a[_0xaed9('0x3b')]=qs[_0xaed9('0x31')](_[_0xaed9('0x3c')](_0x41462c[_0xaed9('0x2f')],_0x5a947f[_0xaed9('0x31')]),_0x50f8fc);if(_0x41462c[_0xaed9('0x2f')][_0xaed9('0x3d')]){_0x13362a[_0xaed9('0x3b')]=_['merge'](_0x13362a[_0xaed9('0x3b')],{'$or':_[_0xaed9('0x2b')](_0x50f8fc,function(_0x34ee82){if(_0x34ee82[_0xaed9('0x2e')]!==_0xaed9('0x3e')){var _0x3b65c4={};_0x3b65c4[_0x34ee82[_0xaed9('0x2a')]]={'$like':'%'+_0x41462c[_0xaed9('0x2f')]['filter']+'%'};return _0x3b65c4;}})});}_0x13362a=_[_0xaed9('0x3f')]({},_0x13362a,_0x41462c[_0xaed9('0x40')]);var _0xabb1e7={'where':_0x13362a[_0xaed9('0x3b')]};return db[_0xaed9('0x2c')][_0xaed9('0x21')](_0xabb1e7)[_0xaed9('0x27')](function(_0x73834b){_0x5cb081[_0xaed9('0x21')]=_0x73834b;if(_0x41462c[_0xaed9('0x2f')][_0xaed9('0x41')]){_0x13362a[_0xaed9('0x42')]=[{'all':!![]}];}return db[_0xaed9('0x2c')][_0xaed9('0x43')](_0x13362a);})[_0xaed9('0x27')](function(_0x4280de){_0x5cb081[_0xaed9('0x44')]=_0x4280de;return _0x5cb081;})['then'](respondWithFilteredResult(_0xb6e11d,_0x13362a))[_0xaed9('0x45')](handleError(_0xb6e11d,null));};exports['show']=function(_0x10c847,_0xa7a677){var _0x2ea5e3={'raw':![],'where':{'id':_0x10c847[_0xaed9('0x46')]['id']}},_0x205c6f={};_0x205c6f['model']=_[_0xaed9('0x30')](db[_0xaed9('0x2c')][_0xaed9('0x2d')]);_0x205c6f[_0xaed9('0x2f')]=_['keys'](_0x10c847[_0xaed9('0x2f')]);_0x205c6f[_0xaed9('0x31')]=_[_0xaed9('0x32')](_0x205c6f[_0xaed9('0x33')],_0x205c6f['query']);_0x2ea5e3[_0xaed9('0x35')]=_['intersection'](_0x205c6f[_0xaed9('0x33')],qs['fields'](_0x10c847[_0xaed9('0x2f')][_0xaed9('0x34')]));_0x2ea5e3[_0xaed9('0x35')]=_0x2ea5e3[_0xaed9('0x35')][_0xaed9('0x36')]?_0x2ea5e3[_0xaed9('0x35')]:_0x205c6f[_0xaed9('0x33')];if(_0x10c847[_0xaed9('0x2f')][_0xaed9('0x41')]){_0x2ea5e3['include']=[{'all':!![]}];}_0x2ea5e3=_[_0xaed9('0x3f')]({},_0x2ea5e3,_0x10c847[_0xaed9('0x40')]);return db[_0xaed9('0x2c')][_0xaed9('0x47')](_0x2ea5e3)['then'](handleEntityNotFound(_0xa7a677,null))['then'](respondWithResult(_0xa7a677,null))[_0xaed9('0x45')](handleError(_0xa7a677,null));};exports[_0xaed9('0x48')]=function(_0x4a207b,_0x21ef0c){return db[_0xaed9('0x2c')][_0xaed9('0x48')](_0x4a207b[_0xaed9('0x49')],{})['then'](respondWithResult(_0x21ef0c,0xc9))['catch'](handleError(_0x21ef0c,null));};exports[_0xaed9('0x26')]=function(_0x47f96d,_0x2b01f7){if(_0x47f96d[_0xaed9('0x49')]['id']){delete _0x47f96d['body']['id'];}return db[_0xaed9('0x2c')]['find']({'where':{'id':_0x47f96d[_0xaed9('0x46')]['id']}})[_0xaed9('0x27')](handleEntityNotFound(_0x2b01f7,null))[_0xaed9('0x27')](saveUpdates(_0x47f96d['body'],null))[_0xaed9('0x27')](respondWithResult(_0x2b01f7,null))[_0xaed9('0x45')](handleError(_0x2b01f7,null));};exports['destroy']=function(_0x20f7ac,_0x3739b5){return db[_0xaed9('0x2c')][_0xaed9('0x47')]({'where':{'id':_0x20f7ac[_0xaed9('0x46')]['id']}})[_0xaed9('0x27')](handleEntityNotFound(_0x3739b5,null))[_0xaed9('0x27')](removeEntity(_0x3739b5,null))[_0xaed9('0x45')](handleError(_0x3739b5,null));};exports[_0xaed9('0x4a')]=function(_0x525b2e,_0x4ee749){return db[_0xaed9('0x2c')][_0xaed9('0x4a')]()[_0xaed9('0x27')](respondWithResult(_0x4ee749,null))[_0xaed9('0x45')](handleError(_0x4ee749,null));}; \ No newline at end of file +var _0x9ba8=['../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','send','index','IntegrationReport','rawAttributes','type','key','model','map','name','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','include','catch','show','keys','find','create','body','params','describe','eml-format','rimraf','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','querystring','../../components/auth/service'];(function(_0x3bf04a,_0x56ed90){var _0x241e4b=function(_0x105e52){while(--_0x105e52){_0x3bf04a['push'](_0x3bf04a['shift']());}};_0x241e4b(++_0x56ed90);}(_0x9ba8,0x196));var _0x89ba=function(_0xbe048b,_0x2f8970){_0xbe048b=_0xbe048b-0x0;var _0x1d9099=_0x9ba8[_0xbe048b];return _0x1d9099;};'use strict';var emlformat=require(_0x89ba('0x0'));var rimraf=require(_0x89ba('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x89ba('0x2'));var moment=require(_0x89ba('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x89ba('0x4'));var path=require(_0x89ba('0x5'));var sox=require(_0x89ba('0x6'));var csv=require(_0x89ba('0x7'));var ejs=require(_0x89ba('0x8'));var fs=require('fs');var fs_extra=require(_0x89ba('0x9'));var _=require('lodash');var squel=require(_0x89ba('0xa'));var crypto=require('crypto');var jsforce=require(_0x89ba('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x89ba('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x89ba('0xd'));var qs=require(_0x89ba('0xe'));var as=require(_0x89ba('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x89ba('0x10'));var utils=require(_0x89ba('0x11'));var config=require(_0x89ba('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x89ba('0x13'))['db'];function respondWithStatusCode(_0x535db5,_0x39a6ad){_0x39a6ad=_0x39a6ad||0xcc;return function(_0x2165bb){if(_0x2165bb){return _0x535db5[_0x89ba('0x14')](_0x39a6ad);}return _0x535db5[_0x89ba('0x15')](_0x39a6ad)[_0x89ba('0x16')]();};}function respondWithResult(_0x3e0a70,_0x2e994d){_0x2e994d=_0x2e994d||0xc8;return function(_0x5d8e71){if(_0x5d8e71){return _0x3e0a70[_0x89ba('0x15')](_0x2e994d)[_0x89ba('0x17')](_0x5d8e71);}};}function respondWithFilteredResult(_0xe584da,_0x57b18f){return function(_0x55a458){if(_0x55a458){var _0x83360b=typeof _0x57b18f['offset']==='undefined'&&typeof _0x57b18f['limit']==='undefined';var _0x315e8f=_0x55a458['count'];var _0x4fbcd6=_0x83360b?0x0:_0x57b18f['offset'];var _0x4a2fc3=_0x83360b?_0x55a458[_0x89ba('0x18')]:_0x57b18f[_0x89ba('0x19')]+_0x57b18f[_0x89ba('0x1a')];var _0x5b60b1;if(_0x4a2fc3>=_0x315e8f){_0x4a2fc3=_0x315e8f;_0x5b60b1=0xc8;}else{_0x5b60b1=0xce;}_0xe584da[_0x89ba('0x15')](_0x5b60b1);return _0xe584da[_0x89ba('0x1b')](_0x89ba('0x1c'),_0x4fbcd6+'-'+_0x4a2fc3+'/'+_0x315e8f)[_0x89ba('0x17')](_0x55a458);}return null;};}function patchUpdates(_0x3e80f7){return function(_0x2132ad){try{jsonpatch[_0x89ba('0x1d')](_0x2132ad,_0x3e80f7,!![]);}catch(_0x27945f){return BPromise[_0x89ba('0x1e')](_0x27945f);}return _0x2132ad[_0x89ba('0x1f')]();};}function saveUpdates(_0x471c82,_0x206781){return function(_0x3c511c){if(_0x3c511c){return _0x3c511c[_0x89ba('0x20')](_0x471c82)[_0x89ba('0x21')](function(_0xf9ffff){return _0xf9ffff;});}return null;};}function removeEntity(_0x5d8b24,_0x4103e8){return function(_0x3ff5f4){if(_0x3ff5f4){return _0x3ff5f4[_0x89ba('0x22')]()[_0x89ba('0x21')](function(){_0x5d8b24[_0x89ba('0x15')](0xcc)[_0x89ba('0x16')]();});}};}function handleEntityNotFound(_0xcd326c,_0x315f90){return function(_0x52e26f){if(!_0x52e26f){_0xcd326c[_0x89ba('0x14')](0x194);}return _0x52e26f;};}function handleError(_0x5902c2,_0xbce2eb){_0xbce2eb=_0xbce2eb||0x1f4;return function(_0x3bb5cc){logger[_0x89ba('0x23')](_0x3bb5cc[_0x89ba('0x24')]);if(_0x3bb5cc['name']){delete _0x3bb5cc['name'];}_0x5902c2['status'](_0xbce2eb)[_0x89ba('0x25')](_0x3bb5cc);};}exports[_0x89ba('0x26')]=function(_0x28a672,_0x28bbf7){var _0x3eb47e={},_0x1a0046={},_0x535a09={'count':0x0,'rows':[]};var _0xe72288=_['map'](db[_0x89ba('0x27')][_0x89ba('0x28')],function(_0x2ed293){return{'name':_0x2ed293['fieldName'],'type':_0x2ed293[_0x89ba('0x29')][_0x89ba('0x2a')]};});_0x1a0046[_0x89ba('0x2b')]=_[_0x89ba('0x2c')](_0xe72288,_0x89ba('0x2d'));_0x1a0046[_0x89ba('0x2e')]=_['keys'](_0x28a672[_0x89ba('0x2e')]);_0x1a0046[_0x89ba('0x2f')]=_[_0x89ba('0x30')](_0x1a0046[_0x89ba('0x2b')],_0x1a0046[_0x89ba('0x2e')]);_0x3eb47e[_0x89ba('0x31')]=_[_0x89ba('0x30')](_0x1a0046[_0x89ba('0x2b')],qs['fields'](_0x28a672[_0x89ba('0x2e')][_0x89ba('0x32')]));_0x3eb47e[_0x89ba('0x31')]=_0x3eb47e[_0x89ba('0x31')]['length']?_0x3eb47e[_0x89ba('0x31')]:_0x1a0046[_0x89ba('0x2b')];if(!_0x28a672['query'][_0x89ba('0x33')](_0x89ba('0x34'))){_0x3eb47e[_0x89ba('0x1a')]=qs[_0x89ba('0x1a')](_0x28a672[_0x89ba('0x2e')][_0x89ba('0x1a')]);_0x3eb47e[_0x89ba('0x19')]=qs[_0x89ba('0x19')](_0x28a672[_0x89ba('0x2e')]['offset']);}_0x3eb47e[_0x89ba('0x35')]=qs[_0x89ba('0x36')](_0x28a672[_0x89ba('0x2e')][_0x89ba('0x36')]);_0x3eb47e['where']=qs[_0x89ba('0x2f')](_[_0x89ba('0x37')](_0x28a672[_0x89ba('0x2e')],_0x1a0046['filters']),_0xe72288);if(_0x28a672[_0x89ba('0x2e')][_0x89ba('0x38')]){_0x3eb47e[_0x89ba('0x39')]=_[_0x89ba('0x3a')](_0x3eb47e[_0x89ba('0x39')],{'$or':_[_0x89ba('0x2c')](_0xe72288,function(_0xc109a1){if(_0xc109a1[_0x89ba('0x29')]!==_0x89ba('0x3b')){var _0x5b3b02={};_0x5b3b02[_0xc109a1[_0x89ba('0x2d')]]={'$like':'%'+_0x28a672[_0x89ba('0x2e')]['filter']+'%'};return _0x5b3b02;}})});}_0x3eb47e=_[_0x89ba('0x3a')]({},_0x3eb47e,_0x28a672[_0x89ba('0x3c')]);var _0x2c612c={'where':_0x3eb47e[_0x89ba('0x39')]};return db[_0x89ba('0x27')][_0x89ba('0x18')](_0x2c612c)['then'](function(_0x36b815){_0x535a09[_0x89ba('0x18')]=_0x36b815;if(_0x28a672['query']['includeAll']){_0x3eb47e[_0x89ba('0x3d')]=[{'all':!![]}];}return db[_0x89ba('0x27')]['findAll'](_0x3eb47e);})[_0x89ba('0x21')](function(_0x2dc9bf){_0x535a09['rows']=_0x2dc9bf;return _0x535a09;})[_0x89ba('0x21')](respondWithFilteredResult(_0x28bbf7,_0x3eb47e))[_0x89ba('0x3e')](handleError(_0x28bbf7,null));};exports[_0x89ba('0x3f')]=function(_0x4b9184,_0x2bca95){var _0x5b3dde={'raw':![],'where':{'id':_0x4b9184['params']['id']}},_0x30b114={};_0x30b114[_0x89ba('0x2b')]=_['keys'](db['IntegrationReport'][_0x89ba('0x28')]);_0x30b114[_0x89ba('0x2e')]=_[_0x89ba('0x40')](_0x4b9184[_0x89ba('0x2e')]);_0x30b114[_0x89ba('0x2f')]=_[_0x89ba('0x30')](_0x30b114[_0x89ba('0x2b')],_0x30b114[_0x89ba('0x2e')]);_0x5b3dde['attributes']=_['intersection'](_0x30b114[_0x89ba('0x2b')],qs[_0x89ba('0x32')](_0x4b9184[_0x89ba('0x2e')]['fields']));_0x5b3dde[_0x89ba('0x31')]=_0x5b3dde['attributes']['length']?_0x5b3dde[_0x89ba('0x31')]:_0x30b114[_0x89ba('0x2b')];if(_0x4b9184[_0x89ba('0x2e')]['includeAll']){_0x5b3dde[_0x89ba('0x3d')]=[{'all':!![]}];}_0x5b3dde=_['merge']({},_0x5b3dde,_0x4b9184[_0x89ba('0x3c')]);return db[_0x89ba('0x27')][_0x89ba('0x41')](_0x5b3dde)[_0x89ba('0x21')](handleEntityNotFound(_0x2bca95,null))[_0x89ba('0x21')](respondWithResult(_0x2bca95,null))[_0x89ba('0x3e')](handleError(_0x2bca95,null));};exports['create']=function(_0x28ba61,_0x3f024b){return db[_0x89ba('0x27')][_0x89ba('0x42')](_0x28ba61[_0x89ba('0x43')],{})['then'](respondWithResult(_0x3f024b,0xc9))[_0x89ba('0x3e')](handleError(_0x3f024b,null));};exports[_0x89ba('0x20')]=function(_0x2a109e,_0x4f0e72){if(_0x2a109e[_0x89ba('0x43')]['id']){delete _0x2a109e[_0x89ba('0x43')]['id'];}return db['IntegrationReport'][_0x89ba('0x41')]({'where':{'id':_0x2a109e[_0x89ba('0x44')]['id']}})[_0x89ba('0x21')](handleEntityNotFound(_0x4f0e72,null))['then'](saveUpdates(_0x2a109e['body'],null))[_0x89ba('0x21')](respondWithResult(_0x4f0e72,null))['catch'](handleError(_0x4f0e72,null));};exports[_0x89ba('0x22')]=function(_0xb5433c,_0x3e93e4){return db[_0x89ba('0x27')][_0x89ba('0x41')]({'where':{'id':_0xb5433c['params']['id']}})['then'](handleEntityNotFound(_0x3e93e4,null))[_0x89ba('0x21')](removeEntity(_0x3e93e4,null))[_0x89ba('0x3e')](handleError(_0x3e93e4,null));};exports[_0x89ba('0x45')]=function(_0x51575e,_0x4235af){return db[_0x89ba('0x27')][_0x89ba('0x45')]()[_0x89ba('0x21')](respondWithResult(_0x4235af,null))[_0x89ba('0x3e')](handleError(_0x4235af,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index bce97e3..9c8e218 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 _0xfab2=['api','moment','bluebird','request-promise','rimraf','./integrationReport.attributes','exports','define','IntegrationReport','report_integration','lodash','util'];(function(_0x2d89ce,_0x24d58d){var _0x3fad10=function(_0xad0ec){while(--_0xad0ec){_0x2d89ce['push'](_0x2d89ce['shift']());}};_0x3fad10(++_0x24d58d);}(_0xfab2,0x1d2));var _0x2fab=function(_0x8082a4,_0x5cb597){_0x8082a4=_0x8082a4-0x0;var _0x3c04ad=_0xfab2[_0x8082a4];return _0x3c04ad;};'use strict';var _=require(_0x2fab('0x0'));var util=require(_0x2fab('0x1'));var logger=require('../../config/logger')(_0x2fab('0x2'));var moment=require(_0x2fab('0x3'));var BPromise=require(_0x2fab('0x4'));var rp=require(_0x2fab('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2fab('0x6'));var config=require('../../config/environment');var attributes=require(_0x2fab('0x7'));module[_0x2fab('0x8')]=function(_0x95277a,_0x5383d0){return _0x95277a[_0x2fab('0x9')](_0x2fab('0xa'),attributes,{'tableName':_0x2fab('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2ac7=['../../config/environment','./integrationReport.attributes','exports','IntegrationReport','../../config/logger','api','moment','request-promise','rimraf'];(function(_0x15b3c3,_0x371043){var _0x4ffe85=function(_0xcba735){while(--_0xcba735){_0x15b3c3['push'](_0x15b3c3['shift']());}};_0x4ffe85(++_0x371043);}(_0x2ac7,0x12d));var _0x72ac=function(_0x388ce1,_0x40bd2a){_0x388ce1=_0x388ce1-0x0;var _0xd21ad8=_0x2ac7[_0x388ce1];return _0xd21ad8;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x72ac('0x0'))(_0x72ac('0x1'));var moment=require(_0x72ac('0x2'));var BPromise=require('bluebird');var rp=require(_0x72ac('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x72ac('0x4'));var config=require(_0x72ac('0x5'));var attributes=require(_0x72ac('0x6'));module[_0x72ac('0x7')]=function(_0x21da8a,_0x5cc588){return _0x21da8a['define'](_0x72ac('0x8'),attributes,{'tableName':'report_integration','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.rpc.js b/server/api/integrationReport/integrationReport.rpc.js index e1cc00b..72b679a 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 _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(_0x25bea7,_0x49ab45){var _0x175952=function(_0x56a0b5){while(--_0x56a0b5){_0x25bea7['push'](_0x25bea7['shift']());}};_0x175952(++_0x49ab45);}(_0x4975,0x86));var _0x5497=function(_0x5d1d2f,_0x3e2f59){_0x5d1d2f=_0x5d1d2f-0x0;var _0x30707c=_0x4975[_0x5d1d2f];return _0x30707c;};'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 +var _0xe2fe=['then','info','IntegrationReport,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request'];(function(_0x4eab8a,_0x124c87){var _0x49d966=function(_0x22ca75){while(--_0x22ca75){_0x4eab8a['push'](_0x4eab8a['shift']());}};_0x49d966(++_0x124c87);}(_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 moment=require('moment');var BPromise=require(_0xee2f('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xee2f('0x2'));var db=require(_0xee2f('0x3'))['db'];var utils=require(_0xee2f('0x4'));var logger=require(_0xee2f('0x5'))(_0xee2f('0x6'));var config=require('../../config/environment');var jayson=require(_0xee2f('0x7'));var client=jayson[_0xee2f('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1533a0,_0x2e1c8c,_0x5a7975){return new BPromise(function(_0x3c4095,_0x5ea796){return client[_0xee2f('0x9')](_0x1533a0,_0x5a7975)[_0xee2f('0xa')](function(_0x53f7dd){logger[_0xee2f('0xb')](_0xee2f('0xc'),_0x2e1c8c,'request\x20sent');logger['debug']('IntegrationReport,\x20%s,\x20%s,\x20%s',_0x2e1c8c,'request\x20sent',JSON[_0xee2f('0xd')](_0x53f7dd));if(_0x53f7dd['error']){if(_0x53f7dd['error']['code']===0x1f4){logger[_0xee2f('0xe')](_0xee2f('0xc'),_0x2e1c8c,_0x53f7dd[_0xee2f('0xe')][_0xee2f('0xf')]);return _0x5ea796(_0x53f7dd[_0xee2f('0xe')][_0xee2f('0xf')]);}logger['error'](_0xee2f('0xc'),_0x2e1c8c,_0x53f7dd['error'][_0xee2f('0xf')]);return _0x3c4095(_0x53f7dd[_0xee2f('0xe')]['message']);}else{logger[_0xee2f('0xb')](_0xee2f('0xc'),_0x2e1c8c,_0xee2f('0x10'));_0x3c4095(_0x53f7dd[_0xee2f('0x11')][_0xee2f('0xf')]);}})['catch'](function(_0x3f6372){logger['error'](_0xee2f('0xc'),_0x2e1c8c,_0x3f6372);_0x5ea796(_0x3f6372);});});} \ No newline at end of file diff --git a/server/api/interval/index.js b/server/api/interval/index.js index 5fff1cc..d2b667d 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 _0xba0d=['update','delete','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./interval.controller','get','/:id','isAuthenticated','show','/:id/sub_intervals','post','create','addInterval','/:id/sub_intervals/create_many','addIntervals','put'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xba0d,0x8e));var _0xdba0=function(_0x2b7cc7,_0x1ee01a){_0x2b7cc7=_0x2b7cc7-0x0;var _0xb3b5d0=_0xba0d[_0x2b7cc7];return _0xb3b5d0;};'use strict';var multer=require(_0xdba0('0x0'));var util=require('util');var path=require(_0xdba0('0x1'));var timeout=require(_0xdba0('0x2'));var express=require(_0xdba0('0x3'));var router=express['Router']();var fs_extra=require(_0xdba0('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xdba0('0x5'));var config=require(_0xdba0('0x6'));var controller=require(_0xdba0('0x7'));router[_0xdba0('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0xdba0('0x8')](_0xdba0('0x9'),auth[_0xdba0('0xa')](),controller[_0xdba0('0xb')]);router['get'](_0xdba0('0xc'),auth['isAuthenticated'](),controller['getIntervals']);router[_0xdba0('0xd')]('/',auth['isAuthenticated'](),controller[_0xdba0('0xe')]);router['post'](_0xdba0('0xc'),auth[_0xdba0('0xa')](),controller[_0xdba0('0xf')]);router[_0xdba0('0xd')](_0xdba0('0x10'),auth[_0xdba0('0xa')](),controller[_0xdba0('0x11')]);router[_0xdba0('0x12')]('/:id',auth['isAuthenticated'](),controller[_0xdba0('0x13')]);router[_0xdba0('0x14')](_0xdba0('0x9'),auth[_0xdba0('0xa')](),controller[_0xdba0('0x15')]);module[_0xdba0('0x16')]=router; \ No newline at end of file +var _0xa2c8=['connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./interval.controller','get','isAuthenticated','/:id','show','/:id/sub_intervals','post','create','addInterval','addIntervals','put','update','delete','destroy','multer','util','path'];(function(_0x3e4e85,_0x3472c3){var _0x3102c6=function(_0xcff563){while(--_0xcff563){_0x3e4e85['push'](_0x3e4e85['shift']());}};_0x3102c6(++_0x3472c3);}(_0xa2c8,0x81));var _0x8a2c=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xa2c8[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x8a2c('0x0'));var util=require(_0x8a2c('0x1'));var path=require(_0x8a2c('0x2'));var timeout=require(_0x8a2c('0x3'));var express=require('express');var router=express[_0x8a2c('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x8a2c('0x5'));var interaction=require(_0x8a2c('0x6'));var config=require(_0x8a2c('0x7'));var controller=require(_0x8a2c('0x8'));router[_0x8a2c('0x9')]('/',auth[_0x8a2c('0xa')](),controller['index']);router[_0x8a2c('0x9')](_0x8a2c('0xb'),auth[_0x8a2c('0xa')](),controller[_0x8a2c('0xc')]);router[_0x8a2c('0x9')](_0x8a2c('0xd'),auth[_0x8a2c('0xa')](),controller['getIntervals']);router[_0x8a2c('0xe')]('/',auth[_0x8a2c('0xa')](),controller[_0x8a2c('0xf')]);router[_0x8a2c('0xe')](_0x8a2c('0xd'),auth[_0x8a2c('0xa')](),controller[_0x8a2c('0x10')]);router['post']('/:id/sub_intervals/create_many',auth[_0x8a2c('0xa')](),controller[_0x8a2c('0x11')]);router[_0x8a2c('0x12')](_0x8a2c('0xb'),auth[_0x8a2c('0xa')](),controller[_0x8a2c('0x13')]);router[_0x8a2c('0x14')]('/:id',auth[_0x8a2c('0xa')](),controller[_0x8a2c('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/interval/interval.attributes.js b/server/api/interval/interval.attributes.js index 54ebda4..9335b79 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 _0x9b4b=['STRING','sequelize'];(function(_0x5628e5,_0x24b1b5){var _0x5bdadf=function(_0x1c03c9){while(--_0x1c03c9){_0x5628e5['push'](_0x5628e5['shift']());}};_0x5bdadf(++_0x24b1b5);}(_0x9b4b,0x1a5));var _0xb9b4=function(_0x14c00f,_0x11b192){_0x14c00f=_0x14c00f-0x0;var _0x19fbda=_0x9b4b[_0x14c00f];return _0x19fbda;};'use strict';var Sequelize=require(_0xb9b4('0x0'));module['exports']={'name':{'type':Sequelize[_0xb9b4('0x1')]},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xb9b4('0x1')],'allowNull':!![]}}; \ No newline at end of file +var _0x487b=['exports','STRING','sequelize'];(function(_0x37399f,_0x3d3291){var _0x309ed=function(_0x2ad399){while(--_0x2ad399){_0x37399f['push'](_0x37399f['shift']());}};_0x309ed(++_0x3d3291);}(_0x487b,0xc5));var _0xb487=function(_0x1ab202,_0x533c31){_0x1ab202=_0x1ab202-0x0;var _0x36a5ec=_0x487b[_0x1ab202];return _0x36a5ec;};'use strict';var Sequelize=require(_0xb487('0x0'));module[_0xb487('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xb487('0x2')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/interval/interval.controller.js b/server/api/interval/interval.controller.js index 2920dd5..f61ae5f 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 _0x4c62=['stack','name','index','map','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','Interval','includeAll','include','rows','catch','show','params','keys','find','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addInterval','getIntervals','findOne','addIntervals','sequelize','transaction','IntervalId','bulkCreate','findAll','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../components/extensions/rewrite','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','get','Intervals','UserProfileResource','destroy','error'];(function(_0x292688,_0x4ed5d4){var _0x12f117=function(_0x528959){while(--_0x528959){_0x292688['push'](_0x292688['shift']());}};_0x12f117(++_0x4ed5d4);}(_0x4c62,0x1af));var _0x24c6=function(_0x2b6a11,_0x145bd6){_0x2b6a11=_0x2b6a11-0x0;var _0x586a42=_0x4c62[_0x2b6a11];return _0x586a42;};'use strict';var emlformat=require(_0x24c6('0x0'));var rimraf=require(_0x24c6('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x24c6('0x2'));var rp=require('request-promise');var moment=require(_0x24c6('0x3'));var BPromise=require(_0x24c6('0x4'));var Mustache=require(_0x24c6('0x5'));var util=require(_0x24c6('0x6'));var path=require(_0x24c6('0x7'));var sox=require(_0x24c6('0x8'));var csv=require(_0x24c6('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x24c6('0xa'));var _=require(_0x24c6('0xb'));var squel=require(_0x24c6('0xc'));var crypto=require(_0x24c6('0xd'));var jsforce=require(_0x24c6('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x24c6('0xf'));var Papa=require(_0x24c6('0x10'));var Redis=require(_0x24c6('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x24c6('0x12'));var hardwareService=require(_0x24c6('0x13'));var logger=require('../../config/logger')(_0x24c6('0x14'));var utils=require('../../config/utils');var config=require(_0x24c6('0x15'));var licenseUtil=require(_0x24c6('0x16'));var db=require('../../mysqldb')['db'];var extensions=require(_0x24c6('0x17'));function respondWithStatusCode(_0x317fa9,_0x28bc95){_0x28bc95=_0x28bc95||0xcc;return function(_0x5965a2){if(_0x5965a2){return _0x317fa9[_0x24c6('0x18')](_0x28bc95);}return _0x317fa9[_0x24c6('0x19')](_0x28bc95)[_0x24c6('0x1a')]();};}function respondWithResult(_0x2581c7,_0x51b244){_0x51b244=_0x51b244||0xc8;return function(_0x216edd){if(_0x216edd){return _0x2581c7[_0x24c6('0x19')](_0x51b244)[_0x24c6('0x1b')](_0x216edd);}};}function respondWithFilteredResult(_0x2b044a,_0x14c14d){return function(_0x3d83a3){if(_0x3d83a3){var _0x3220ac=typeof _0x14c14d['offset']===_0x24c6('0x1c')&&typeof _0x14c14d[_0x24c6('0x1d')]===_0x24c6('0x1c');var _0x1d0a6e=_0x3d83a3[_0x24c6('0x1e')];var _0x3a13ca=_0x3220ac?0x0:_0x14c14d[_0x24c6('0x1f')];var _0x7241f2=_0x3220ac?_0x3d83a3[_0x24c6('0x1e')]:_0x14c14d[_0x24c6('0x1f')]+_0x14c14d[_0x24c6('0x1d')];var _0x5d0cc7;if(_0x7241f2>=_0x1d0a6e){_0x7241f2=_0x1d0a6e;_0x5d0cc7=0xc8;}else{_0x5d0cc7=0xce;}_0x2b044a[_0x24c6('0x19')](_0x5d0cc7);return _0x2b044a[_0x24c6('0x20')](_0x24c6('0x21'),_0x3a13ca+'-'+_0x7241f2+'/'+_0x1d0a6e)['json'](_0x3d83a3);}return null;};}function patchUpdates(_0x515f1c){return function(_0x1c1d13){try{jsonpatch[_0x24c6('0x22')](_0x1c1d13,_0x515f1c,!![]);}catch(_0x25e4bb){return BPromise[_0x24c6('0x23')](_0x25e4bb);}return _0x1c1d13[_0x24c6('0x24')]();};}function saveUpdates(_0x24494a,_0xf4de9a){return function(_0x87d75b){if(_0x87d75b){return _0x87d75b[_0x24c6('0x25')](_0x24494a)[_0x24c6('0x26')](function(_0x480a00){return _0x480a00;});}return null;};}function removeEntity(_0x5ca81b,_0x1b3b4b){return function(_0x1430cb){if(_0x1430cb){return _0x1430cb['destroy']()[_0x24c6('0x26')](function(){var _0x5b9d27=_0x1430cb[_0x24c6('0x27')]({'plain':!![]});var _0x5902fc=_0x24c6('0x28');return db[_0x24c6('0x29')][_0x24c6('0x2a')]({'where':{'type':_0x5902fc,'resourceId':_0x5b9d27['id']}})[_0x24c6('0x26')](function(){return _0x1430cb;});})[_0x24c6('0x26')](function(){_0x5ca81b[_0x24c6('0x19')](0xcc)[_0x24c6('0x1a')]();});}};}function handleEntityNotFound(_0x11616f,_0x280179){return function(_0x56ac4a){if(!_0x56ac4a){_0x11616f['sendStatus'](0x194);}return _0x56ac4a;};}function handleError(_0xa13513,_0x1964dd){_0x1964dd=_0x1964dd||0x1f4;return function(_0x38ed21){logger[_0x24c6('0x2b')](_0x38ed21[_0x24c6('0x2c')]);if(_0x38ed21['name']){delete _0x38ed21[_0x24c6('0x2d')];}_0xa13513[_0x24c6('0x19')](_0x1964dd)['send'](_0x38ed21);};}exports[_0x24c6('0x2e')]=function(_0x19604c,_0x2466ac){var _0x2e0b56={},_0x27c714={},_0x1e4e25={'count':0x0,'rows':[]};var _0x3a9f7f=_[_0x24c6('0x2f')](db['Interval'][_0x24c6('0x30')],function(_0x2b8420){return{'name':_0x2b8420[_0x24c6('0x31')],'type':_0x2b8420[_0x24c6('0x32')][_0x24c6('0x33')]};});_0x27c714[_0x24c6('0x34')]=_['map'](_0x3a9f7f,'name');_0x27c714[_0x24c6('0x35')]=_['keys'](_0x19604c[_0x24c6('0x35')]);_0x27c714[_0x24c6('0x36')]=_['intersection'](_0x27c714[_0x24c6('0x34')],_0x27c714[_0x24c6('0x35')]);_0x2e0b56[_0x24c6('0x37')]=_[_0x24c6('0x38')](_0x27c714[_0x24c6('0x34')],qs[_0x24c6('0x39')](_0x19604c[_0x24c6('0x35')][_0x24c6('0x39')]));_0x2e0b56[_0x24c6('0x37')]=_0x2e0b56['attributes'][_0x24c6('0x3a')]?_0x2e0b56[_0x24c6('0x37')]:_0x27c714[_0x24c6('0x34')];if(!_0x19604c['query'][_0x24c6('0x3b')](_0x24c6('0x3c'))){_0x2e0b56[_0x24c6('0x1d')]=qs[_0x24c6('0x1d')](_0x19604c['query'][_0x24c6('0x1d')]);_0x2e0b56['offset']=qs[_0x24c6('0x1f')](_0x19604c[_0x24c6('0x35')]['offset']);}_0x2e0b56[_0x24c6('0x3d')]=qs[_0x24c6('0x3e')](_0x19604c[_0x24c6('0x35')][_0x24c6('0x3e')]);_0x2e0b56[_0x24c6('0x3f')]=qs[_0x24c6('0x36')](_[_0x24c6('0x40')](_0x19604c['query'],_0x27c714[_0x24c6('0x36')]),_0x3a9f7f);if(_0x19604c[_0x24c6('0x35')][_0x24c6('0x41')]){_0x2e0b56['where']=_[_0x24c6('0x42')](_0x2e0b56[_0x24c6('0x3f')],{'$or':_[_0x24c6('0x2f')](_0x3a9f7f,function(_0xb07ea6){if(_0xb07ea6[_0x24c6('0x32')]!==_0x24c6('0x43')){var _0x1c150b={};_0x1c150b[_0xb07ea6['name']]={'$like':'%'+_0x19604c['query'][_0x24c6('0x41')]+'%'};return _0x1c150b;}})});}_0x2e0b56=_[_0x24c6('0x42')]({},_0x2e0b56,_0x19604c[_0x24c6('0x44')]);var _0x3a8dde={'where':_0x2e0b56[_0x24c6('0x3f')]};return db[_0x24c6('0x45')][_0x24c6('0x1e')](_0x3a8dde)[_0x24c6('0x26')](function(_0x482b2b){_0x1e4e25[_0x24c6('0x1e')]=_0x482b2b;if(_0x19604c[_0x24c6('0x35')][_0x24c6('0x46')]){_0x2e0b56[_0x24c6('0x47')]=[{'all':!![]}];}return db[_0x24c6('0x45')]['findAll'](_0x2e0b56);})[_0x24c6('0x26')](function(_0x20f812){_0x1e4e25[_0x24c6('0x48')]=_0x20f812;return _0x1e4e25;})[_0x24c6('0x26')](respondWithFilteredResult(_0x2466ac,_0x2e0b56))[_0x24c6('0x49')](handleError(_0x2466ac,null));};exports[_0x24c6('0x4a')]=function(_0x2fd973,_0x1b6fe1){var _0x2ef35a={'raw':!![],'where':{'id':_0x2fd973[_0x24c6('0x4b')]['id']}},_0x796e96={};_0x796e96['model']=_[_0x24c6('0x4c')](db[_0x24c6('0x45')][_0x24c6('0x30')]);_0x796e96[_0x24c6('0x35')]=_['keys'](_0x2fd973[_0x24c6('0x35')]);_0x796e96[_0x24c6('0x36')]=_['intersection'](_0x796e96[_0x24c6('0x34')],_0x796e96['query']);_0x2ef35a[_0x24c6('0x37')]=_[_0x24c6('0x38')](_0x796e96[_0x24c6('0x34')],qs[_0x24c6('0x39')](_0x2fd973['query']['fields']));_0x2ef35a[_0x24c6('0x37')]=_0x2ef35a[_0x24c6('0x37')][_0x24c6('0x3a')]?_0x2ef35a[_0x24c6('0x37')]:_0x796e96[_0x24c6('0x34')];if(_0x2fd973[_0x24c6('0x35')][_0x24c6('0x46')]){_0x2ef35a[_0x24c6('0x47')]=[{'all':!![]}];}_0x2ef35a=_[_0x24c6('0x42')]({},_0x2ef35a,_0x2fd973[_0x24c6('0x44')]);return db[_0x24c6('0x45')][_0x24c6('0x4d')](_0x2ef35a)['then'](handleEntityNotFound(_0x1b6fe1,null))[_0x24c6('0x26')](respondWithResult(_0x1b6fe1,null))[_0x24c6('0x49')](handleError(_0x1b6fe1,null));};exports['create']=function(_0x1ce32f,_0xaf4679){return db[_0x24c6('0x45')]['create'](_0x1ce32f[_0x24c6('0x4e')],{})['then'](function(_0x4722eb){var _0x5f2149=_0x1ce32f[_0x24c6('0x4f')]['get']({'plain':!![]});if(!_0x5f2149)throw new Error(_0x24c6('0x50'));if(_0x5f2149[_0x24c6('0x51')]===_0x24c6('0x4f')){var _0x1c8433=_0x4722eb[_0x24c6('0x27')]({'plain':!![]});var _0x28dc16=_0x24c6('0x28');return db['UserProfileSection']['find']({'where':{'name':_0x28dc16,'userProfileId':_0x5f2149[_0x24c6('0x52')]},'raw':!![]})[_0x24c6('0x26')](function(_0x254701){if(_0x254701&&_0x254701[_0x24c6('0x53')]===0x0){return db['UserProfileResource'][_0x24c6('0x54')]({'name':_0x1c8433['name'],'resourceId':_0x1c8433['id'],'type':_0x254701['name'],'sectionId':_0x254701['id']},{})['then'](function(){return _0x4722eb;});}else{return _0x4722eb;}})[_0x24c6('0x49')](function(_0x3b97e0){logger[_0x24c6('0x2b')](_0x24c6('0x55'),_0x3b97e0);throw _0x3b97e0;});}return _0x4722eb;})[_0x24c6('0x26')](respondWithResult(_0xaf4679,0xc9))['catch'](handleError(_0xaf4679,null));};exports[_0x24c6('0x25')]=function(_0x38014e,_0x414f4d){if(_0x38014e[_0x24c6('0x4e')]['id']){delete _0x38014e['body']['id'];}return db['Interval'][_0x24c6('0x4d')]({'where':{'id':_0x38014e['params']['id']}})[_0x24c6('0x26')](handleEntityNotFound(_0x414f4d,null))[_0x24c6('0x26')](saveUpdates(_0x38014e[_0x24c6('0x4e')],null))[_0x24c6('0x26')](respondWithResult(_0x414f4d,null))[_0x24c6('0x49')](handleError(_0x414f4d,null));};exports['destroy']=function(_0x150e21,_0x392539){return db[_0x24c6('0x45')][_0x24c6('0x4d')]({'where':{'id':_0x150e21[_0x24c6('0x4b')]['id']}})[_0x24c6('0x26')](handleEntityNotFound(_0x392539,null))['then'](removeEntity(_0x392539,null))['catch'](handleError(_0x392539,null));};exports[_0x24c6('0x56')]=function(_0x3fdfd3,_0x4a07df,_0x54a69d){if(_0x3fdfd3[_0x24c6('0x4e')]['id']){delete _0x3fdfd3[_0x24c6('0x4e')]['id'];}return db['Interval'][_0x24c6('0x4d')]({'where':{'id':_0x3fdfd3[_0x24c6('0x4b')]['id']}})[_0x24c6('0x26')](handleEntityNotFound(_0x4a07df,null))[_0x24c6('0x26')](function(_0x452137){if(_0x452137){_0x3fdfd3[_0x24c6('0x4e')]['IntervalId']=_0x452137['id'];return db[_0x24c6('0x45')][_0x24c6('0x54')](_0x3fdfd3['body']);}})[_0x24c6('0x26')](respondWithResult(_0x4a07df,null))['catch'](handleError(_0x4a07df,null));};exports[_0x24c6('0x57')]=function(_0x23339f,_0x1762af,_0x22860b){var _0x3dc9c3={};var _0x1735b0={};var _0x37dc97;var _0x3204f2;return db[_0x24c6('0x45')][_0x24c6('0x58')]({'where':{'id':_0x23339f['params']['id']}})[_0x24c6('0x26')](handleEntityNotFound(_0x1762af,null))[_0x24c6('0x26')](function(_0x24364f){if(_0x24364f){_0x37dc97=_0x24364f;_0x1735b0[_0x24c6('0x34')]=_[_0x24c6('0x4c')](db['Interval']['rawAttributes']);_0x1735b0['query']=_[_0x24c6('0x4c')](_0x23339f[_0x24c6('0x35')]);_0x1735b0[_0x24c6('0x36')]=_[_0x24c6('0x38')](_0x1735b0[_0x24c6('0x34')],_0x1735b0[_0x24c6('0x35')]);_0x3dc9c3['attributes']=_['intersection'](_0x1735b0[_0x24c6('0x34')],qs[_0x24c6('0x39')](_0x23339f[_0x24c6('0x35')][_0x24c6('0x39')]));_0x3dc9c3['attributes']=_0x3dc9c3[_0x24c6('0x37')][_0x24c6('0x3a')]?_0x3dc9c3[_0x24c6('0x37')]:_0x1735b0[_0x24c6('0x34')];_0x3dc9c3[_0x24c6('0x3d')]=qs[_0x24c6('0x3e')](_0x23339f[_0x24c6('0x35')][_0x24c6('0x3e')]);_0x3dc9c3['where']=qs[_0x24c6('0x36')](_[_0x24c6('0x40')](_0x23339f[_0x24c6('0x35')],_0x1735b0[_0x24c6('0x36')]));if(_0x23339f['query'][_0x24c6('0x41')]){_0x3dc9c3[_0x24c6('0x3f')]=_[_0x24c6('0x42')](_0x3dc9c3[_0x24c6('0x3f')],{'$or':_[_0x24c6('0x2f')](_0x3dc9c3['attributes'],function(_0x223622){var _0x28b920={};_0x28b920[_0x223622]={'$like':'%'+_0x23339f[_0x24c6('0x35')]['filter']+'%'};return _0x28b920;})});}_0x3dc9c3=_['merge']({},_0x3dc9c3,_0x23339f[_0x24c6('0x44')]);return _0x37dc97[_0x24c6('0x57')](_0x3dc9c3);}})['then'](function(_0x5b95d9){if(_0x5b95d9){_0x3204f2=_0x5b95d9[_0x24c6('0x3a')];if(!_0x23339f['query'][_0x24c6('0x3b')](_0x24c6('0x3c'))){_0x3dc9c3[_0x24c6('0x1d')]=qs[_0x24c6('0x1d')](_0x23339f[_0x24c6('0x35')][_0x24c6('0x1d')]);_0x3dc9c3[_0x24c6('0x1f')]=qs[_0x24c6('0x1f')](_0x23339f['query'][_0x24c6('0x1f')]);}return _0x37dc97[_0x24c6('0x57')](_0x3dc9c3);}})[_0x24c6('0x26')](function(_0x2d2bae){if(_0x2d2bae){return _0x2d2bae?{'count':_0x3204f2,'rows':_0x2d2bae}:null;}})[_0x24c6('0x26')](respondWithResult(_0x1762af,null))['catch'](handleError(_0x1762af,null));};exports[_0x24c6('0x59')]=function(_0x4a1897,_0x58c66f,_0x16c2cf){return db[_0x24c6('0x45')][_0x24c6('0x58')]({'where':{'id':_0x4a1897[_0x24c6('0x4b')]['id']}})[_0x24c6('0x26')](handleEntityNotFound(_0x58c66f,null))['then'](function(_0x34974a){if(_0x34974a){return db[_0x24c6('0x5a')][_0x24c6('0x5b')](function(_0x20c664){return db[_0x24c6('0x45')][_0x24c6('0x2a')]({'where':{'IntervalId':_0x4a1897['params']['id']},'transaction':_0x20c664})[_0x24c6('0x26')](function(_0x6dbbd4){var _0x290c76=_[_0x24c6('0x2f')](_0x4a1897[_0x24c6('0x4e')],function(_0x3c29f8){delete _0x3c29f8['id'];_0x3c29f8[_0x24c6('0x5c')]=_0x4a1897['params']['id'];return _0x3c29f8;});return db[_0x24c6('0x45')][_0x24c6('0x5d')](_0x290c76,{'transaction':_0x20c664});});})[_0x24c6('0x26')](function(){return db[_0x24c6('0x45')][_0x24c6('0x5e')]({'where':{'IntervalId':_0x4a1897[_0x24c6('0x4b')]['id']}});});}})[_0x24c6('0x26')](respondWithResult(_0x58c66f,null))[_0x24c6('0x49')](handleError(_0x58c66f,null));}; \ No newline at end of file +var _0x4d9c=['../../components/extensions/rewrite','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','apply','reject','update','then','destroy','get','UserProfileResource','error','stack','name','map','Interval','fieldName','type','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','rawAttributes','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','IntervalId','getIntervals','findOne','nolimit','addIntervals','sequelize','transaction','bulkCreate','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb'];(function(_0xfb825c,_0x54813b){var _0x5253e8=function(_0x4ef169){while(--_0x4ef169){_0xfb825c['push'](_0xfb825c['shift']());}};_0x5253e8(++_0x54813b);}(_0x4d9c,0xfc));var _0xc4d9=function(_0x2d0053,_0x1f3f53){_0x2d0053=_0x2d0053-0x0;var _0x4967cd=_0x4d9c[_0x2d0053];return _0x4967cd;};'use strict';var emlformat=require(_0xc4d9('0x0'));var rimraf=require(_0xc4d9('0x1'));var zipdir=require(_0xc4d9('0x2'));var jsonpatch=require(_0xc4d9('0x3'));var rp=require(_0xc4d9('0x4'));var moment=require(_0xc4d9('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xc4d9('0x6'));var util=require(_0xc4d9('0x7'));var path=require(_0xc4d9('0x8'));var sox=require(_0xc4d9('0x9'));var csv=require(_0xc4d9('0xa'));var ejs=require(_0xc4d9('0xb'));var fs=require('fs');var fs_extra=require(_0xc4d9('0xc'));var _=require(_0xc4d9('0xd'));var squel=require(_0xc4d9('0xe'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xc4d9('0xf'));var toCsv=require('to-csv');var querystring=require(_0xc4d9('0x10'));var Papa=require(_0xc4d9('0x11'));var Redis=require(_0xc4d9('0x12'));var authService=require(_0xc4d9('0x13'));var qs=require(_0xc4d9('0x14'));var as=require(_0xc4d9('0x15'));var hardwareService=require(_0xc4d9('0x16'));var logger=require('../../config/logger')(_0xc4d9('0x17'));var utils=require(_0xc4d9('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xc4d9('0x19'));var db=require(_0xc4d9('0x1a'))['db'];var extensions=require(_0xc4d9('0x1b'));function respondWithStatusCode(_0x241241,_0x3732f0){_0x3732f0=_0x3732f0||0xcc;return function(_0x5dfb18){if(_0x5dfb18){return _0x241241[_0xc4d9('0x1c')](_0x3732f0);}return _0x241241[_0xc4d9('0x1d')](_0x3732f0)[_0xc4d9('0x1e')]();};}function respondWithResult(_0x3af773,_0x586244){_0x586244=_0x586244||0xc8;return function(_0x14d251){if(_0x14d251){return _0x3af773[_0xc4d9('0x1d')](_0x586244)['json'](_0x14d251);}};}function respondWithFilteredResult(_0x84a0b2,_0x317189){return function(_0x54ccfa){if(_0x54ccfa){var _0x42369a=typeof _0x317189[_0xc4d9('0x1f')]===_0xc4d9('0x20')&&typeof _0x317189['limit']===_0xc4d9('0x20');var _0x2a5c50=_0x54ccfa[_0xc4d9('0x21')];var _0x4b6c26=_0x42369a?0x0:_0x317189[_0xc4d9('0x1f')];var _0xcdcf68=_0x42369a?_0x54ccfa['count']:_0x317189['offset']+_0x317189[_0xc4d9('0x22')];var _0x5cb775;if(_0xcdcf68>=_0x2a5c50){_0xcdcf68=_0x2a5c50;_0x5cb775=0xc8;}else{_0x5cb775=0xce;}_0x84a0b2[_0xc4d9('0x1d')](_0x5cb775);return _0x84a0b2[_0xc4d9('0x23')](_0xc4d9('0x24'),_0x4b6c26+'-'+_0xcdcf68+'/'+_0x2a5c50)[_0xc4d9('0x25')](_0x54ccfa);}return null;};}function patchUpdates(_0x2ebc69){return function(_0x218c52){try{jsonpatch[_0xc4d9('0x26')](_0x218c52,_0x2ebc69,!![]);}catch(_0x29e108){return BPromise[_0xc4d9('0x27')](_0x29e108);}return _0x218c52['save']();};}function saveUpdates(_0x3d7544,_0xbe1f89){return function(_0x35e59d){if(_0x35e59d){return _0x35e59d[_0xc4d9('0x28')](_0x3d7544)[_0xc4d9('0x29')](function(_0x358020){return _0x358020;});}return null;};}function removeEntity(_0x45f0b1,_0xf0d733){return function(_0x5ced01){if(_0x5ced01){return _0x5ced01[_0xc4d9('0x2a')]()[_0xc4d9('0x29')](function(){var _0x53f680=_0x5ced01[_0xc4d9('0x2b')]({'plain':!![]});var _0x2b393b='Intervals';return db[_0xc4d9('0x2c')][_0xc4d9('0x2a')]({'where':{'type':_0x2b393b,'resourceId':_0x53f680['id']}})[_0xc4d9('0x29')](function(){return _0x5ced01;});})['then'](function(){_0x45f0b1[_0xc4d9('0x1d')](0xcc)[_0xc4d9('0x1e')]();});}};}function handleEntityNotFound(_0x386ae5,_0x108938){return function(_0x11045c){if(!_0x11045c){_0x386ae5[_0xc4d9('0x1c')](0x194);}return _0x11045c;};}function handleError(_0x5e8336,_0x348e66){_0x348e66=_0x348e66||0x1f4;return function(_0x1eba86){logger[_0xc4d9('0x2d')](_0x1eba86[_0xc4d9('0x2e')]);if(_0x1eba86[_0xc4d9('0x2f')]){delete _0x1eba86[_0xc4d9('0x2f')];}_0x5e8336[_0xc4d9('0x1d')](_0x348e66)['send'](_0x1eba86);};}exports['index']=function(_0x521dc4,_0x291a58){var _0x165e58={},_0x369d94={},_0x385f34={'count':0x0,'rows':[]};var _0x293138=_[_0xc4d9('0x30')](db[_0xc4d9('0x31')]['rawAttributes'],function(_0x38887b){return{'name':_0x38887b[_0xc4d9('0x32')],'type':_0x38887b[_0xc4d9('0x33')][_0xc4d9('0x34')]};});_0x369d94['model']=_[_0xc4d9('0x30')](_0x293138,'name');_0x369d94[_0xc4d9('0x35')]=_[_0xc4d9('0x36')](_0x521dc4[_0xc4d9('0x35')]);_0x369d94['filters']=_[_0xc4d9('0x37')](_0x369d94[_0xc4d9('0x38')],_0x369d94['query']);_0x165e58[_0xc4d9('0x39')]=_[_0xc4d9('0x37')](_0x369d94[_0xc4d9('0x38')],qs['fields'](_0x521dc4['query'][_0xc4d9('0x3a')]));_0x165e58[_0xc4d9('0x39')]=_0x165e58['attributes'][_0xc4d9('0x3b')]?_0x165e58[_0xc4d9('0x39')]:_0x369d94[_0xc4d9('0x38')];if(!_0x521dc4[_0xc4d9('0x35')][_0xc4d9('0x3c')]('nolimit')){_0x165e58[_0xc4d9('0x22')]=qs[_0xc4d9('0x22')](_0x521dc4[_0xc4d9('0x35')][_0xc4d9('0x22')]);_0x165e58[_0xc4d9('0x1f')]=qs['offset'](_0x521dc4[_0xc4d9('0x35')][_0xc4d9('0x1f')]);}_0x165e58[_0xc4d9('0x3d')]=qs[_0xc4d9('0x3e')](_0x521dc4[_0xc4d9('0x35')][_0xc4d9('0x3e')]);_0x165e58[_0xc4d9('0x3f')]=qs['filters'](_[_0xc4d9('0x40')](_0x521dc4['query'],_0x369d94[_0xc4d9('0x41')]),_0x293138);if(_0x521dc4[_0xc4d9('0x35')][_0xc4d9('0x42')]){_0x165e58['where']=_[_0xc4d9('0x43')](_0x165e58[_0xc4d9('0x3f')],{'$or':_[_0xc4d9('0x30')](_0x293138,function(_0x33e64b){if(_0x33e64b[_0xc4d9('0x33')]!==_0xc4d9('0x44')){var _0x1c4be5={};_0x1c4be5[_0x33e64b[_0xc4d9('0x2f')]]={'$like':'%'+_0x521dc4[_0xc4d9('0x35')][_0xc4d9('0x42')]+'%'};return _0x1c4be5;}})});}_0x165e58=_[_0xc4d9('0x43')]({},_0x165e58,_0x521dc4[_0xc4d9('0x45')]);var _0x5f1ab6={'where':_0x165e58[_0xc4d9('0x3f')]};return db[_0xc4d9('0x31')][_0xc4d9('0x21')](_0x5f1ab6)['then'](function(_0x5128e4){_0x385f34['count']=_0x5128e4;if(_0x521dc4[_0xc4d9('0x35')][_0xc4d9('0x46')]){_0x165e58['include']=[{'all':!![]}];}return db['Interval'][_0xc4d9('0x47')](_0x165e58);})['then'](function(_0x54c651){_0x385f34[_0xc4d9('0x48')]=_0x54c651;return _0x385f34;})[_0xc4d9('0x29')](respondWithFilteredResult(_0x291a58,_0x165e58))[_0xc4d9('0x49')](handleError(_0x291a58,null));};exports[_0xc4d9('0x4a')]=function(_0x1ba62c,_0x1f8650){var _0x380560={'raw':!![],'where':{'id':_0x1ba62c[_0xc4d9('0x4b')]['id']}},_0x3e7ff8={};_0x3e7ff8[_0xc4d9('0x38')]=_[_0xc4d9('0x36')](db['Interval'][_0xc4d9('0x4c')]);_0x3e7ff8['query']=_[_0xc4d9('0x36')](_0x1ba62c['query']);_0x3e7ff8['filters']=_[_0xc4d9('0x37')](_0x3e7ff8[_0xc4d9('0x38')],_0x3e7ff8['query']);_0x380560[_0xc4d9('0x39')]=_[_0xc4d9('0x37')](_0x3e7ff8['model'],qs[_0xc4d9('0x3a')](_0x1ba62c[_0xc4d9('0x35')][_0xc4d9('0x3a')]));_0x380560[_0xc4d9('0x39')]=_0x380560[_0xc4d9('0x39')][_0xc4d9('0x3b')]?_0x380560[_0xc4d9('0x39')]:_0x3e7ff8['model'];if(_0x1ba62c[_0xc4d9('0x35')][_0xc4d9('0x46')]){_0x380560[_0xc4d9('0x4d')]=[{'all':!![]}];}_0x380560=_[_0xc4d9('0x43')]({},_0x380560,_0x1ba62c[_0xc4d9('0x45')]);return db['Interval'][_0xc4d9('0x4e')](_0x380560)[_0xc4d9('0x29')](handleEntityNotFound(_0x1f8650,null))['then'](respondWithResult(_0x1f8650,null))['catch'](handleError(_0x1f8650,null));};exports[_0xc4d9('0x4f')]=function(_0x576569,_0x2f969c){return db[_0xc4d9('0x31')][_0xc4d9('0x4f')](_0x576569[_0xc4d9('0x50')],{})['then'](function(_0x3cd186){var _0x536bbf=_0x576569[_0xc4d9('0x51')]['get']({'plain':!![]});if(!_0x536bbf)throw new Error(_0xc4d9('0x52'));if(_0x536bbf['role']===_0xc4d9('0x51')){var _0x5198df=_0x3cd186['get']({'plain':!![]});var _0x1aab27='Intervals';return db[_0xc4d9('0x53')][_0xc4d9('0x4e')]({'where':{'name':_0x1aab27,'userProfileId':_0x536bbf['userProfileId']},'raw':!![]})[_0xc4d9('0x29')](function(_0x128ac0){if(_0x128ac0&&_0x128ac0[_0xc4d9('0x54')]===0x0){return db['UserProfileResource'][_0xc4d9('0x4f')]({'name':_0x5198df[_0xc4d9('0x2f')],'resourceId':_0x5198df['id'],'type':_0x128ac0[_0xc4d9('0x2f')],'sectionId':_0x128ac0['id']},{})[_0xc4d9('0x29')](function(){return _0x3cd186;});}else{return _0x3cd186;}})[_0xc4d9('0x49')](function(_0x1bad89){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1bad89);throw _0x1bad89;});}return _0x3cd186;})[_0xc4d9('0x29')](respondWithResult(_0x2f969c,0xc9))[_0xc4d9('0x49')](handleError(_0x2f969c,null));};exports[_0xc4d9('0x28')]=function(_0x49f994,_0x3ffc61){if(_0x49f994[_0xc4d9('0x50')]['id']){delete _0x49f994['body']['id'];}return db['Interval'][_0xc4d9('0x4e')]({'where':{'id':_0x49f994[_0xc4d9('0x4b')]['id']}})[_0xc4d9('0x29')](handleEntityNotFound(_0x3ffc61,null))[_0xc4d9('0x29')](saveUpdates(_0x49f994[_0xc4d9('0x50')],null))['then'](respondWithResult(_0x3ffc61,null))['catch'](handleError(_0x3ffc61,null));};exports[_0xc4d9('0x2a')]=function(_0x3ee5d7,_0x453539){return db[_0xc4d9('0x31')]['find']({'where':{'id':_0x3ee5d7['params']['id']}})[_0xc4d9('0x29')](handleEntityNotFound(_0x453539,null))[_0xc4d9('0x29')](removeEntity(_0x453539,null))[_0xc4d9('0x49')](handleError(_0x453539,null));};exports['addInterval']=function(_0x2dd655,_0x91c740,_0x2f7a55){if(_0x2dd655['body']['id']){delete _0x2dd655['body']['id'];}return db[_0xc4d9('0x31')]['find']({'where':{'id':_0x2dd655[_0xc4d9('0x4b')]['id']}})[_0xc4d9('0x29')](handleEntityNotFound(_0x91c740,null))[_0xc4d9('0x29')](function(_0x1c385e){if(_0x1c385e){_0x2dd655[_0xc4d9('0x50')][_0xc4d9('0x55')]=_0x1c385e['id'];return db[_0xc4d9('0x31')]['create'](_0x2dd655['body']);}})['then'](respondWithResult(_0x91c740,null))[_0xc4d9('0x49')](handleError(_0x91c740,null));};exports[_0xc4d9('0x56')]=function(_0x5f5a0b,_0x2d77e7,_0x2a2a27){var _0x4f8a28={};var _0x209970={};var _0xd75bd3;var _0xf04477;return db[_0xc4d9('0x31')][_0xc4d9('0x57')]({'where':{'id':_0x5f5a0b[_0xc4d9('0x4b')]['id']}})['then'](handleEntityNotFound(_0x2d77e7,null))['then'](function(_0x3cf758){if(_0x3cf758){_0xd75bd3=_0x3cf758;_0x209970[_0xc4d9('0x38')]=_['keys'](db[_0xc4d9('0x31')][_0xc4d9('0x4c')]);_0x209970[_0xc4d9('0x35')]=_[_0xc4d9('0x36')](_0x5f5a0b[_0xc4d9('0x35')]);_0x209970['filters']=_['intersection'](_0x209970[_0xc4d9('0x38')],_0x209970[_0xc4d9('0x35')]);_0x4f8a28['attributes']=_[_0xc4d9('0x37')](_0x209970[_0xc4d9('0x38')],qs['fields'](_0x5f5a0b[_0xc4d9('0x35')][_0xc4d9('0x3a')]));_0x4f8a28[_0xc4d9('0x39')]=_0x4f8a28[_0xc4d9('0x39')][_0xc4d9('0x3b')]?_0x4f8a28['attributes']:_0x209970['model'];_0x4f8a28['order']=qs[_0xc4d9('0x3e')](_0x5f5a0b[_0xc4d9('0x35')][_0xc4d9('0x3e')]);_0x4f8a28[_0xc4d9('0x3f')]=qs[_0xc4d9('0x41')](_[_0xc4d9('0x40')](_0x5f5a0b[_0xc4d9('0x35')],_0x209970[_0xc4d9('0x41')]));if(_0x5f5a0b[_0xc4d9('0x35')][_0xc4d9('0x42')]){_0x4f8a28[_0xc4d9('0x3f')]=_[_0xc4d9('0x43')](_0x4f8a28[_0xc4d9('0x3f')],{'$or':_['map'](_0x4f8a28[_0xc4d9('0x39')],function(_0x219973){var _0x54f75f={};_0x54f75f[_0x219973]={'$like':'%'+_0x5f5a0b[_0xc4d9('0x35')][_0xc4d9('0x42')]+'%'};return _0x54f75f;})});}_0x4f8a28=_[_0xc4d9('0x43')]({},_0x4f8a28,_0x5f5a0b['options']);return _0xd75bd3[_0xc4d9('0x56')](_0x4f8a28);}})[_0xc4d9('0x29')](function(_0x2a7fa8){if(_0x2a7fa8){_0xf04477=_0x2a7fa8[_0xc4d9('0x3b')];if(!_0x5f5a0b['query'][_0xc4d9('0x3c')](_0xc4d9('0x58'))){_0x4f8a28[_0xc4d9('0x22')]=qs['limit'](_0x5f5a0b['query']['limit']);_0x4f8a28['offset']=qs[_0xc4d9('0x1f')](_0x5f5a0b[_0xc4d9('0x35')][_0xc4d9('0x1f')]);}return _0xd75bd3['getIntervals'](_0x4f8a28);}})['then'](function(_0x9e1749){if(_0x9e1749){return _0x9e1749?{'count':_0xf04477,'rows':_0x9e1749}:null;}})[_0xc4d9('0x29')](respondWithResult(_0x2d77e7,null))['catch'](handleError(_0x2d77e7,null));};exports[_0xc4d9('0x59')]=function(_0x201e18,_0xfcf5d9,_0x514422){return db[_0xc4d9('0x31')][_0xc4d9('0x57')]({'where':{'id':_0x201e18[_0xc4d9('0x4b')]['id']}})[_0xc4d9('0x29')](handleEntityNotFound(_0xfcf5d9,null))[_0xc4d9('0x29')](function(_0x2abe98){if(_0x2abe98){return db[_0xc4d9('0x5a')][_0xc4d9('0x5b')](function(_0x3fb3c5){return db[_0xc4d9('0x31')][_0xc4d9('0x2a')]({'where':{'IntervalId':_0x201e18[_0xc4d9('0x4b')]['id']},'transaction':_0x3fb3c5})[_0xc4d9('0x29')](function(_0x5399f5){var _0x46f8f1=_[_0xc4d9('0x30')](_0x201e18[_0xc4d9('0x50')],function(_0x484ab9){delete _0x484ab9['id'];_0x484ab9['IntervalId']=_0x201e18[_0xc4d9('0x4b')]['id'];return _0x484ab9;});return db[_0xc4d9('0x31')][_0xc4d9('0x5c')](_0x46f8f1,{'transaction':_0x3fb3c5});});})[_0xc4d9('0x29')](function(){return db[_0xc4d9('0x31')][_0xc4d9('0x47')]({'where':{'IntervalId':_0x201e18[_0xc4d9('0x4b')]['id']}});});}})[_0xc4d9('0x29')](respondWithResult(_0xfcf5d9,null))[_0xc4d9('0x49')](handleError(_0xfcf5d9,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index dcd4456..5aef460 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 _0x8e59=['../../utils/iftime','iftime','define','Interval','tools_intervals','rewrite','string','getIntervals','then','ifTime','./interval.attributes','../../components/extensions/rewrite'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x8e59,0x14e));var _0x98e5=function(_0x27f737,_0x8c15bd){_0x27f737=_0x27f737-0x0;var _0x43abbc=_0x8e59[_0x27f737];return _0x43abbc;};'use strict';var attributes=require(_0x98e5('0x0'));var extensions=require(_0x98e5('0x1'));var iftime=require(_0x98e5('0x2'))[_0x98e5('0x3')];module['exports']=function(_0x46d32e){return _0x46d32e[_0x98e5('0x4')](_0x98e5('0x5'),attributes,{'tableName':_0x98e5('0x6'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x28b3aa){extensions[_0x98e5('0x7')](_0x46d32e,_0x28b3aa);},'afterBulkCreate':function(_0x52c513,_0x4e8888,_0xc5f9fe){_0xc5f9fe();extensions[_0x98e5('0x7')](_0x46d32e,_0x52c513[0x0]);},'afterUpdate':function(_0x5db2f2){extensions[_0x98e5('0x7')](_0x46d32e,_0x5db2f2);},'afterDestroy':function(_0x429554){extensions[_0x98e5('0x7')](_0x46d32e,_0x429554);}},'instanceMethods':{'ifTime':function(_0x3210a9=undefined,_0x1dae15=new Date()){if(typeof this['interval']===_0x98e5('0x8')){return iftime(this['interval'],_0x3210a9,_0x1dae15);}else{return this[_0x98e5('0x9')]()[_0x98e5('0xa')](function(_0x5984a1){return Promise['all'](_0x5984a1['map'](function(_0x5f55ff){return _0x5f55ff[_0x98e5('0xb')](_0x3210a9,_0x1dae15);}));})[_0x98e5('0xa')](function(_0x25ed11){return _0x25ed11['reduce'](function(_0x544fcc,_0x122bd9){return _0x544fcc||_0x122bd9;},![]);});}}}});}; \ No newline at end of file +var _0xc713=['exports','define','Interval','rewrite','interval','string','then','all','ifTime','reduce','./interval.attributes','../../utils/iftime'];(function(_0x57e033,_0x55114c){var _0x3e37e9=function(_0x3f59c2){while(--_0x3f59c2){_0x57e033['push'](_0x57e033['shift']());}};_0x3e37e9(++_0x55114c);}(_0xc713,0x6a));var _0x3c71=function(_0x519aab,_0x421210){_0x519aab=_0x519aab-0x0;var _0x4d2c36=_0xc713[_0x519aab];return _0x4d2c36;};'use strict';var attributes=require(_0x3c71('0x0'));var extensions=require('../../components/extensions/rewrite');var iftime=require(_0x3c71('0x1'))['iftime'];module[_0x3c71('0x2')]=function(_0x4704d4){return _0x4704d4[_0x3c71('0x3')](_0x3c71('0x4'),attributes,{'tableName':'tools_intervals','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x1c5a65){extensions[_0x3c71('0x5')](_0x4704d4,_0x1c5a65);},'afterBulkCreate':function(_0x51001a,_0x59f899,_0x44f6f3){_0x44f6f3();extensions[_0x3c71('0x5')](_0x4704d4,_0x51001a[0x0]);},'afterUpdate':function(_0x58c1ff){extensions[_0x3c71('0x5')](_0x4704d4,_0x58c1ff);},'afterDestroy':function(_0x4a668c){extensions[_0x3c71('0x5')](_0x4704d4,_0x4a668c);}},'instanceMethods':{'ifTime':function(_0x46326d=undefined,_0x3bd10f=new Date()){if(typeof this[_0x3c71('0x6')]===_0x3c71('0x7')){return iftime(this[_0x3c71('0x6')],_0x46326d,_0x3bd10f);}else{return this['getIntervals']()[_0x3c71('0x8')](function(_0x18db68){return Promise[_0x3c71('0x9')](_0x18db68['map'](function(_0x36e77c){return _0x36e77c[_0x3c71('0xa')](_0x46326d,_0x3bd10f);}));})[_0x3c71('0x8')](function(_0x27891c){return _0x27891c[_0x3c71('0xb')](function(_0x4d8abe,_0x16334a){return _0x4d8abe||_0x16334a;},![]);});}}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index 2079eee..eca2642 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 _0x5cf5=['../../utils/iftime','iftime','../../config/logger','rpc','GetInterval','Interval','findAll','options','raw','where','attributes','limit','include','map','model','then','debug','stringify','catch','error','message','find','info','ShowInterval','all','ifTime','reduce','format','name','join','findById','IntervalIftime:\x20interval\x20=\x20%s\x20(id\x20=\x20%s)','IntervalIftime','isArray','intervals','string','timezone','length','IntervalIftime:\x20interval\x20strings\x20=\x20%s','IntervalIftime:\x20timezone\x20=\x20%s','Iftime','lodash','util','../../mysqldb'];(function(_0x556f3d,_0xc8deb){var _0x5526d0=function(_0x2c76b5){while(--_0x2c76b5){_0x556f3d['push'](_0x556f3d['shift']());}};_0x5526d0(++_0xc8deb);}(_0x5cf5,0x189));var _0x55cf=function(_0x51f09a,_0x21607f){_0x51f09a=_0x51f09a-0x0;var _0x23aabf=_0x5cf5[_0x51f09a];return _0x23aabf;};'use strict';var _=require(_0x55cf('0x0'));var util=require(_0x55cf('0x1'));var db=require(_0x55cf('0x2'))['db'];var iftime=require(_0x55cf('0x3'))[_0x55cf('0x4')];var logger=require(_0x55cf('0x5'))(_0x55cf('0x6'));exports[_0x55cf('0x7')]=function(_0x5d0956){var _0x4c890b=this;return new Promise(function(_0x5df6cf,_0x2c6c6f){return db[_0x55cf('0x8')][_0x55cf('0x9')]({'raw':_0x5d0956[_0x55cf('0xa')]?_0x5d0956['options'][_0x55cf('0xb')]===undefined?!![]:![]:!![],'where':_0x5d0956[_0x55cf('0xa')]?_0x5d0956[_0x55cf('0xa')][_0x55cf('0xc')]||null:null,'attributes':_0x5d0956[_0x55cf('0xa')]?_0x5d0956['options'][_0x55cf('0xd')]||null:null,'limit':_0x5d0956['options']?_0x5d0956[_0x55cf('0xa')][_0x55cf('0xe')]||null:null,'include':_0x5d0956['options']?_0x5d0956[_0x55cf('0xa')]['include']?_['map'](_0x5d0956[_0x55cf('0xa')][_0x55cf('0xf')],function(_0x4316fa){return{'model':db[_0x4316fa['model']],'as':_0x4316fa['as'],'attributes':_0x4316fa[_0x55cf('0xd')],'include':_0x4316fa['include']?_[_0x55cf('0x10')](_0x4316fa[_0x55cf('0xf')],function(_0x55f42d){return{'model':db[_0x55f42d[_0x55cf('0x11')]],'as':_0x55f42d['as'],'attributes':_0x55f42d[_0x55cf('0xd')],'include':_0x55f42d[_0x55cf('0xf')]?_[_0x55cf('0x10')](_0x55f42d[_0x55cf('0xf')],function(_0x1b7a50){return{'model':db[_0x1b7a50[_0x55cf('0x11')]],'as':_0x1b7a50['as'],'attributes':_0x1b7a50[_0x55cf('0xd')]};}):[]};}):[]};}):[]:[]})[_0x55cf('0x12')](function(_0xa98f59){logger['info'](_0x55cf('0x7'),_0x5d0956);logger[_0x55cf('0x13')](_0x55cf('0x7'),_0x5d0956,JSON[_0x55cf('0x14')](_0xa98f59));_0x5df6cf(_0xa98f59);})[_0x55cf('0x15')](function(_0xf03318){logger[_0x55cf('0x16')]('GetInterval',_0xf03318['message'],_0x5d0956);_0x2c6c6f(_0x4c890b[_0x55cf('0x16')](0x1f4,_0xf03318[_0x55cf('0x17')]));});});};exports['ShowInterval']=function(_0x5b59d8){var _0x49910c=this;return new Promise(function(_0x9f3b6d,_0x42109){return db[_0x55cf('0x8')][_0x55cf('0x18')]({'raw':_0x5b59d8[_0x55cf('0xa')]?_0x5b59d8['options'][_0x55cf('0xb')]===undefined?!![]:![]:!![],'where':_0x5b59d8[_0x55cf('0xa')]?_0x5b59d8[_0x55cf('0xa')][_0x55cf('0xc')]||null:null,'attributes':_0x5b59d8['options']?_0x5b59d8[_0x55cf('0xa')][_0x55cf('0xd')]||null:null,'include':_0x5b59d8['options']?_0x5b59d8[_0x55cf('0xa')][_0x55cf('0xf')]?_[_0x55cf('0x10')](_0x5b59d8[_0x55cf('0xa')][_0x55cf('0xf')],function(_0x6ba921){return{'model':db[_0x6ba921[_0x55cf('0x11')]],'as':_0x6ba921['as'],'attributes':_0x6ba921[_0x55cf('0xd')],'include':_0x6ba921[_0x55cf('0xf')]?_[_0x55cf('0x10')](_0x6ba921[_0x55cf('0xf')],function(_0x4d926e){return{'model':db[_0x4d926e[_0x55cf('0x11')]],'as':_0x4d926e['as'],'attributes':_0x4d926e[_0x55cf('0xd')],'include':_0x4d926e[_0x55cf('0xf')]?_[_0x55cf('0x10')](_0x4d926e[_0x55cf('0xf')],function(_0x1dd833){return{'model':db[_0x1dd833[_0x55cf('0x11')]],'as':_0x1dd833['as'],'attributes':_0x1dd833['attributes']};}):[]};}):[]};}):[]:[]})[_0x55cf('0x12')](function(_0x1381b3){logger[_0x55cf('0x19')](_0x55cf('0x1a'),_0x5b59d8);logger[_0x55cf('0x13')](_0x55cf('0x1a'),_0x5b59d8,JSON[_0x55cf('0x14')](_0x1381b3));_0x9f3b6d(_0x1381b3);})[_0x55cf('0x15')](function(_0x214eb0){logger[_0x55cf('0x16')]('ShowInterval',_0x214eb0[_0x55cf('0x17')],_0x5b59d8);_0x42109(_0x49910c[_0x55cf('0x16')](0x1f4,_0x214eb0[_0x55cf('0x17')]));});});};function checkArrayOfIntervals(_0x3470b3,_0x13de2b){var _0x37dc5f=[];return db[_0x55cf('0x8')][_0x55cf('0x9')]({'where':{'id':_0x3470b3}})[_0x55cf('0x12')](function(_0x5e5f15){_0x37dc5f=_0x5e5f15;return Promise[_0x55cf('0x1b')](_0x37dc5f[_0x55cf('0x10')](function(_0x28f427){return _0x28f427[_0x55cf('0x1c')](_0x13de2b);}));})['then'](function(_0x11fefd){var _0xca51b0=_0x11fefd[_0x55cf('0x1d')](function(_0x2bfabe,_0x3f91e6){return _0x2bfabe||_0x3f91e6;},![]);logger[_0x55cf('0x19')](util[_0x55cf('0x1e')]('IntervalIftime:\x20intervals\x20=\x20%s\x20(ids\x20=\x20%s)',_0x37dc5f['map'](function(_0x4b39c3){return _0x4b39c3[_0x55cf('0x1f')];})[_0x55cf('0x20')](',\x20'),_0x37dc5f[_0x55cf('0x10')](function(_0x4456f7){return _0x4456f7['id'];})[_0x55cf('0x20')](',\x20')));return _0xca51b0;});}function checkSingleInterval(_0x1e6a94,_0x5458bf){return db[_0x55cf('0x8')][_0x55cf('0x21')](_0x1e6a94)[_0x55cf('0x12')](function(_0x10b265){if(_0x10b265){logger[_0x55cf('0x19')](util['format'](_0x55cf('0x22'),_0x10b265[_0x55cf('0x1f')],_0x10b265['id']));return _0x10b265[_0x55cf('0x1c')](_0x5458bf);}});}exports[_0x55cf('0x23')]=function(_0x2452ae){var _0x1cd7ed=_0x2452ae['intervalIds'];var _0x992443=Array[_0x55cf('0x24')](_0x2452ae[_0x55cf('0x25')])?_0x2452ae[_0x55cf('0x25')]:typeof _0x2452ae[_0x55cf('0x25')]===_0x55cf('0x26')?[_0x2452ae[_0x55cf('0x25')]]:[];var _0x29d51c=_0x2452ae[_0x55cf('0x27')]||undefined;var _0xea2734=![];if(_0x992443[_0x55cf('0x28')]){logger[_0x55cf('0x19')](util[_0x55cf('0x1e')](_0x55cf('0x29'),_0x992443['join'](';\x20')));}if(_0x29d51c){logger[_0x55cf('0x19')](util[_0x55cf('0x1e')](_0x55cf('0x2a'),_0x29d51c));}logger[_0x55cf('0x13')](_0x55cf('0x2b'),_0xea2734);logger['silly']('IntervalIftime',_0x2452ae);return Promise['resolve']()[_0x55cf('0x12')](function(){if(Array[_0x55cf('0x24')](_0x1cd7ed)){return checkArrayOfIntervals(_0x1cd7ed,_0x29d51c);}else if(_0x1cd7ed){return checkSingleInterval(_0x1cd7ed,_0x29d51c);}})[_0x55cf('0x12')](function(_0x564555){var _0x24facb=_0x992443['reduce'](function(_0x56426e,_0x51c5dd){return _0x56426e||iftime(_0x51c5dd,_0x29d51c);},![]);_0xea2734=_0x564555||_0x24facb;return _0xea2734;})[_0x55cf('0x15')](function(_0x21ff7b){logger[_0x55cf('0x16')](_0x55cf('0x23'),_0x2452ae,_0x21ff7b);throw this['error'](0x1f4,_0x21ff7b[_0x55cf('0x17')]);});}; \ No newline at end of file +var _0xcc74=['all','reduce','format','name','join','findById','info','IntervalIftime','intervalIds','isArray','intervals','timezone','IntervalIftime:\x20interval\x20strings\x20=\x20%s','IntervalIftime:\x20timezone\x20=\x20%s','Iftime','silly','resolve','lodash','util','../../mysqldb','iftime','../../config/logger','findAll','options','raw','where','limit','include','map','model','attributes','then','GetInterval','stringify','catch','error','message','Interval','find','debug','ShowInterval'];(function(_0x441f97,_0x4d06b2){var _0x198aed=function(_0x3b222e){while(--_0x3b222e){_0x441f97['push'](_0x441f97['shift']());}};_0x198aed(++_0x4d06b2);}(_0xcc74,0xb5));var _0x4cc7=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0xcc74[_0x2b10c6];return _0x3789d2;};'use strict';var _=require(_0x4cc7('0x0'));var util=require(_0x4cc7('0x1'));var db=require(_0x4cc7('0x2'))['db'];var iftime=require('../../utils/iftime')[_0x4cc7('0x3')];var logger=require(_0x4cc7('0x4'))('rpc');exports['GetInterval']=function(_0x285b92){var _0x1e8f2a=this;return new Promise(function(_0x171b0d,_0x54d21c){return db['Interval'][_0x4cc7('0x5')]({'raw':_0x285b92[_0x4cc7('0x6')]?_0x285b92[_0x4cc7('0x6')][_0x4cc7('0x7')]===undefined?!![]:![]:!![],'where':_0x285b92['options']?_0x285b92[_0x4cc7('0x6')][_0x4cc7('0x8')]||null:null,'attributes':_0x285b92[_0x4cc7('0x6')]?_0x285b92[_0x4cc7('0x6')]['attributes']||null:null,'limit':_0x285b92['options']?_0x285b92[_0x4cc7('0x6')][_0x4cc7('0x9')]||null:null,'include':_0x285b92[_0x4cc7('0x6')]?_0x285b92[_0x4cc7('0x6')][_0x4cc7('0xa')]?_[_0x4cc7('0xb')](_0x285b92['options'][_0x4cc7('0xa')],function(_0x28bc7b){return{'model':db[_0x28bc7b[_0x4cc7('0xc')]],'as':_0x28bc7b['as'],'attributes':_0x28bc7b[_0x4cc7('0xd')],'include':_0x28bc7b[_0x4cc7('0xa')]?_['map'](_0x28bc7b[_0x4cc7('0xa')],function(_0x1ca663){return{'model':db[_0x1ca663[_0x4cc7('0xc')]],'as':_0x1ca663['as'],'attributes':_0x1ca663['attributes'],'include':_0x1ca663[_0x4cc7('0xa')]?_['map'](_0x1ca663[_0x4cc7('0xa')],function(_0x4f72ae){return{'model':db[_0x4f72ae[_0x4cc7('0xc')]],'as':_0x4f72ae['as'],'attributes':_0x4f72ae[_0x4cc7('0xd')]};}):[]};}):[]};}):[]:[]})[_0x4cc7('0xe')](function(_0x4b4105){logger['info'](_0x4cc7('0xf'),_0x285b92);logger['debug']('GetInterval',_0x285b92,JSON[_0x4cc7('0x10')](_0x4b4105));_0x171b0d(_0x4b4105);})[_0x4cc7('0x11')](function(_0x1a49e0){logger[_0x4cc7('0x12')](_0x4cc7('0xf'),_0x1a49e0[_0x4cc7('0x13')],_0x285b92);_0x54d21c(_0x1e8f2a[_0x4cc7('0x12')](0x1f4,_0x1a49e0[_0x4cc7('0x13')]));});});};exports['ShowInterval']=function(_0x45bec6){var _0x4e4546=this;return new Promise(function(_0x381627,_0x218187){return db[_0x4cc7('0x14')][_0x4cc7('0x15')]({'raw':_0x45bec6[_0x4cc7('0x6')]?_0x45bec6[_0x4cc7('0x6')][_0x4cc7('0x7')]===undefined?!![]:![]:!![],'where':_0x45bec6[_0x4cc7('0x6')]?_0x45bec6[_0x4cc7('0x6')][_0x4cc7('0x8')]||null:null,'attributes':_0x45bec6[_0x4cc7('0x6')]?_0x45bec6[_0x4cc7('0x6')][_0x4cc7('0xd')]||null:null,'include':_0x45bec6[_0x4cc7('0x6')]?_0x45bec6[_0x4cc7('0x6')][_0x4cc7('0xa')]?_['map'](_0x45bec6['options'][_0x4cc7('0xa')],function(_0x5b8efa){return{'model':db[_0x5b8efa[_0x4cc7('0xc')]],'as':_0x5b8efa['as'],'attributes':_0x5b8efa[_0x4cc7('0xd')],'include':_0x5b8efa[_0x4cc7('0xa')]?_['map'](_0x5b8efa[_0x4cc7('0xa')],function(_0x4f07b1){return{'model':db[_0x4f07b1[_0x4cc7('0xc')]],'as':_0x4f07b1['as'],'attributes':_0x4f07b1[_0x4cc7('0xd')],'include':_0x4f07b1[_0x4cc7('0xa')]?_['map'](_0x4f07b1['include'],function(_0xf3bbed){return{'model':db[_0xf3bbed['model']],'as':_0xf3bbed['as'],'attributes':_0xf3bbed[_0x4cc7('0xd')]};}):[]};}):[]};}):[]:[]})[_0x4cc7('0xe')](function(_0x1a1b57){logger['info']('ShowInterval',_0x45bec6);logger[_0x4cc7('0x16')](_0x4cc7('0x17'),_0x45bec6,JSON['stringify'](_0x1a1b57));_0x381627(_0x1a1b57);})[_0x4cc7('0x11')](function(_0x383adf){logger['error'](_0x4cc7('0x17'),_0x383adf[_0x4cc7('0x13')],_0x45bec6);_0x218187(_0x4e4546['error'](0x1f4,_0x383adf[_0x4cc7('0x13')]));});});};function checkArrayOfIntervals(_0x507cfb,_0x5410fe){var _0xcc6b1=[];return db['Interval'][_0x4cc7('0x5')]({'where':{'id':_0x507cfb}})[_0x4cc7('0xe')](function(_0x49b3b7){_0xcc6b1=_0x49b3b7;return Promise[_0x4cc7('0x18')](_0xcc6b1[_0x4cc7('0xb')](function(_0x952a0a){return _0x952a0a['ifTime'](_0x5410fe);}));})[_0x4cc7('0xe')](function(_0x4dd5f1){var _0x55b7e9=_0x4dd5f1[_0x4cc7('0x19')](function(_0x432a7f,_0x4069bf){return _0x432a7f||_0x4069bf;},![]);logger['info'](util[_0x4cc7('0x1a')]('IntervalIftime:\x20intervals\x20=\x20%s\x20(ids\x20=\x20%s)',_0xcc6b1[_0x4cc7('0xb')](function(_0x41a506){return _0x41a506[_0x4cc7('0x1b')];})[_0x4cc7('0x1c')](',\x20'),_0xcc6b1[_0x4cc7('0xb')](function(_0x38796d){return _0x38796d['id'];})['join'](',\x20')));return _0x55b7e9;});}function checkSingleInterval(_0xeff32c,_0x32ecd3){return db[_0x4cc7('0x14')][_0x4cc7('0x1d')](_0xeff32c)['then'](function(_0x5a0139){if(_0x5a0139){logger[_0x4cc7('0x1e')](util['format']('IntervalIftime:\x20interval\x20=\x20%s\x20(id\x20=\x20%s)',_0x5a0139[_0x4cc7('0x1b')],_0x5a0139['id']));return _0x5a0139['ifTime'](_0x32ecd3);}});}exports[_0x4cc7('0x1f')]=function(_0x53cbb8){var _0xbead5c=_0x53cbb8[_0x4cc7('0x20')];var _0x48cf8b=Array[_0x4cc7('0x21')](_0x53cbb8[_0x4cc7('0x22')])?_0x53cbb8[_0x4cc7('0x22')]:typeof _0x53cbb8[_0x4cc7('0x22')]==='string'?[_0x53cbb8[_0x4cc7('0x22')]]:[];var _0x24fad6=_0x53cbb8[_0x4cc7('0x23')]||undefined;var _0x1c80d4=![];if(_0x48cf8b['length']){logger['info'](util['format'](_0x4cc7('0x24'),_0x48cf8b[_0x4cc7('0x1c')](';\x20')));}if(_0x24fad6){logger[_0x4cc7('0x1e')](util['format'](_0x4cc7('0x25'),_0x24fad6));}logger[_0x4cc7('0x16')](_0x4cc7('0x26'),_0x1c80d4);logger[_0x4cc7('0x27')](_0x4cc7('0x1f'),_0x53cbb8);return Promise[_0x4cc7('0x28')]()[_0x4cc7('0xe')](function(){if(Array['isArray'](_0xbead5c)){return checkArrayOfIntervals(_0xbead5c,_0x24fad6);}else if(_0xbead5c){return checkSingleInterval(_0xbead5c,_0x24fad6);}})['then'](function(_0xa0705a){var _0x47bc0c=_0x48cf8b[_0x4cc7('0x19')](function(_0x774350,_0x2108fd){return _0x774350||iftime(_0x2108fd,_0x24fad6);},![]);_0x1c80d4=_0xa0705a||_0x47bc0c;return _0x1c80d4;})['catch'](function(_0x51e685){logger[_0x4cc7('0x12')](_0x4cc7('0x1f'),_0x53cbb8,_0x51e685);throw this[_0x4cc7('0x12')](0x1f4,_0x51e685[_0x4cc7('0x13')]);});}; \ No newline at end of file diff --git a/server/api/jira/index.js b/server/api/jira/index.js index 690d5e7..51e73cc 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 _0xdb28=['isAuthenticated','send','exports','express','Router','../../components/auth/service','./jira.controller'];(function(_0xe208eb,_0x4bdc87){var _0x5d8d28=function(_0x3b73d){while(--_0x3b73d){_0xe208eb['push'](_0xe208eb['shift']());}};_0x5d8d28(++_0x4bdc87);}(_0xdb28,0x106));var _0x8db2=function(_0x4e77c8,_0x1d85ca){_0x4e77c8=_0x4e77c8-0x0;var _0x26c29c=_0xdb28[_0x4e77c8];return _0x26c29c;};'use strict';var express=require(_0x8db2('0x0'));var router=express[_0x8db2('0x1')]();var auth=require(_0x8db2('0x2'));var controller=require(_0x8db2('0x3'));router['post']('/',auth[_0x8db2('0x4')](),controller[_0x8db2('0x5')]);module[_0x8db2('0x6')]=router; \ No newline at end of file +var _0x0b0e=['exports','express','../../components/auth/service','post','isAuthenticated','send'];(function(_0x2642cb,_0x4b917f){var _0xe6e41=function(_0x281676){while(--_0x281676){_0x2642cb['push'](_0x2642cb['shift']());}};_0xe6e41(++_0x4b917f);}(_0x0b0e,0x187));var _0xe0b0=function(_0x476c7,_0x298ee0){_0x476c7=_0x476c7-0x0;var _0x47ae56=_0x0b0e[_0x476c7];return _0x47ae56;};'use strict';var express=require(_0xe0b0('0x0'));var router=express['Router']();var auth=require(_0xe0b0('0x1'));var controller=require('./jira.controller');router[_0xe0b0('0x2')]('/',auth[_0xe0b0('0x3')](),controller[_0xe0b0('0x4')]);module[_0xe0b0('0x5')]=router; \ No newline at end of file diff --git a/server/api/jira/jira.controller.js b/server/api/jira/jira.controller.js index e921fb6..a941670 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 _0x0543=['newToken','name','reason','customfield_10102','track.xcallymotion.com','/rest/api/2/issue','POST','application/json','base64','request','setEncoding','utf8','data','status','statusCode','json','parse','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','write','end','openIssue','send','body','headers','x-forwarded-for','remoteAddress','socket','bluebird','https','../../config/logger','key','summary','Report','description','stringify','fields','email','oldToken','customfield_11502'];(function(_0x204a28,_0x359c57){var _0x2d8e3d=function(_0xbfd9b6){while(--_0xbfd9b6){_0x204a28['push'](_0x204a28['shift']());}};_0x2d8e3d(++_0x359c57);}(_0x0543,0x90));var _0x3054=function(_0x34f8b0,_0x41c73c){_0x34f8b0=_0x34f8b0-0x0;var _0x48aaab=_0x0543[_0x34f8b0];return _0x48aaab;};'use strict';var BPromise=require(_0x3054('0x0'));var https=require(_0x3054('0x1'));var logger=require(_0x3054('0x2'))('api');var USERNAME='support';var PASSWORD='3eAmWpBVP0';function openIssue(_0x2b95ef,_0x29d86a){var _0x52bf1d={'fields':{'project':{'key':_0x2b95ef[_0x3054('0x3')]||'MOTGUI'},'summary':(_0x2b95ef[_0x3054('0x4')]||_0x3054('0x5'))+'\x20from\x20'+_0x2b95ef['ip'],'description':_0x2b95ef[_0x3054('0x6')]||JSON[_0x3054('0x7')](_0x2b95ef),'issuetype':{'name':_0x2b95ef['issuetype']||'Bug'}}};_0x52bf1d[_0x3054('0x8')]['customfield_11500']=_0x2b95ef[_0x3054('0x9')];_0x52bf1d[_0x3054('0x8')]['customfield_11501']=_0x2b95ef[_0x3054('0xa')];_0x52bf1d[_0x3054('0x8')][_0x3054('0xb')]=_0x2b95ef[_0x3054('0xc')];_0x52bf1d[_0x3054('0x8')]['customfield_11503']=_0x2b95ef[_0x3054('0xd')];_0x52bf1d[_0x3054('0x8')]['customfield_11504']=_0x2b95ef[_0x3054('0xe')];_0x52bf1d[_0x3054('0x8')][_0x3054('0xf')]=_0x2b95ef['ip'];var _0x447f92={'host':_0x3054('0x10'),'port':0x1bb,'path':_0x3054('0x11'),'method':_0x3054('0x12'),'timeout':0x4e20,'headers':{'Content-Type':_0x3054('0x13'),'Authorization':'Basic\x20'+new Buffer(USERNAME+':'+PASSWORD)['toString'](_0x3054('0x14'))}};var _0xe9125e=JSON[_0x3054('0x7')](_0x52bf1d);var _0x353017=https[_0x3054('0x15')](_0x447f92,function(_0x120820){_0x120820[_0x3054('0x16')](_0x3054('0x17'));var _0x406b61='';_0x120820['on'](_0x3054('0x18'),function(_0xdd7e3a){_0x406b61+=_0xdd7e3a;});_0x120820['on']('end',function(){if(_0x29d86a){return _0x29d86a[_0x3054('0x19')](_0x120820[_0x3054('0x1a')])[_0x3054('0x1b')](JSON[_0x3054('0x1c')](_0x406b61));}});});_0x353017['on']('error',function(_0x55304e){if(_0x29d86a){return _0x29d86a[_0x3054('0x19')](0x1f4)[_0x3054('0x1b')]({'errors':[{'message':_0x3054('0x1d'),'type':'api.jira'}]});}});_0x353017[_0x3054('0x1e')](_0xe9125e);_0x353017[_0x3054('0x1f')]();}exports[_0x3054('0x20')]=openIssue;exports[_0x3054('0x21')]=function(_0xd2bd53,_0x26474d){_0xd2bd53[_0x3054('0x22')]['ip']=_0xd2bd53[_0x3054('0x23')][_0x3054('0x24')]||_0xd2bd53['connection'][_0x3054('0x25')]||_0xd2bd53[_0x3054('0x26')][_0x3054('0x25')]||_0xd2bd53['connection'][_0x3054('0x26')][_0x3054('0x25')];return openIssue(_0xd2bd53[_0x3054('0x22')],_0x26474d);}; \ No newline at end of file +var _0xaf93=['oldToken','customfield_11502','newToken','customfield_11503','customfield_11504','reason','customfield_10102','track.xcallymotion.com','/rest/api/2/issue','POST','application/json','Basic\x20','toString','base64','request','setEncoding','utf8','data','end','status','json','parse','error','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','body','headers','connection','remoteAddress','socket','bluebird','../../config/logger','support','3eAmWpBVP0','MOTGUI','Report','\x20from\x20','description','stringify','Bug','fields','customfield_11500','email','customfield_11501'];(function(_0x3f620b,_0x5ac7e8){var _0x1eb195=function(_0x4b147c){while(--_0x4b147c){_0x3f620b['push'](_0x3f620b['shift']());}};_0x1eb195(++_0x5ac7e8);}(_0xaf93,0x1aa));var _0x3af9=function(_0x1ca29f,_0x318ac5){_0x1ca29f=_0x1ca29f-0x0;var _0x576c3b=_0xaf93[_0x1ca29f];return _0x576c3b;};'use strict';var BPromise=require(_0x3af9('0x0'));var https=require('https');var logger=require(_0x3af9('0x1'))('api');var USERNAME=_0x3af9('0x2');var PASSWORD=_0x3af9('0x3');function openIssue(_0x17dfe5,_0x58b1ba){var _0x563888={'fields':{'project':{'key':_0x17dfe5['key']||_0x3af9('0x4')},'summary':(_0x17dfe5['summary']||_0x3af9('0x5'))+_0x3af9('0x6')+_0x17dfe5['ip'],'description':_0x17dfe5[_0x3af9('0x7')]||JSON[_0x3af9('0x8')](_0x17dfe5),'issuetype':{'name':_0x17dfe5['issuetype']||_0x3af9('0x9')}}};_0x563888[_0x3af9('0xa')][_0x3af9('0xb')]=_0x17dfe5[_0x3af9('0xc')];_0x563888[_0x3af9('0xa')][_0x3af9('0xd')]=_0x17dfe5[_0x3af9('0xe')];_0x563888[_0x3af9('0xa')][_0x3af9('0xf')]=_0x17dfe5[_0x3af9('0x10')];_0x563888[_0x3af9('0xa')][_0x3af9('0x11')]=_0x17dfe5['name'];_0x563888[_0x3af9('0xa')][_0x3af9('0x12')]=_0x17dfe5[_0x3af9('0x13')];_0x563888['fields'][_0x3af9('0x14')]=_0x17dfe5['ip'];var _0x2fa263={'host':_0x3af9('0x15'),'port':0x1bb,'path':_0x3af9('0x16'),'method':_0x3af9('0x17'),'timeout':0x4e20,'headers':{'Content-Type':_0x3af9('0x18'),'Authorization':_0x3af9('0x19')+new Buffer(USERNAME+':'+PASSWORD)[_0x3af9('0x1a')](_0x3af9('0x1b'))}};var _0x234632=JSON['stringify'](_0x563888);var _0x1f86d9=https[_0x3af9('0x1c')](_0x2fa263,function(_0x314963){_0x314963[_0x3af9('0x1d')](_0x3af9('0x1e'));var _0x1387f2='';_0x314963['on'](_0x3af9('0x1f'),function(_0x6261ca){_0x1387f2+=_0x6261ca;});_0x314963['on'](_0x3af9('0x20'),function(){if(_0x58b1ba){return _0x58b1ba[_0x3af9('0x21')](_0x314963['statusCode'])[_0x3af9('0x22')](JSON[_0x3af9('0x23')](_0x1387f2));}});});_0x1f86d9['on'](_0x3af9('0x24'),function(_0x46b128){if(_0x58b1ba){return _0x58b1ba[_0x3af9('0x21')](0x1f4)[_0x3af9('0x22')]({'errors':[{'message':_0x3af9('0x25'),'type':_0x3af9('0x26')}]});}});_0x1f86d9['write'](_0x234632);_0x1f86d9[_0x3af9('0x20')]();}exports['openIssue']=openIssue;exports['send']=function(_0x32e0fe,_0x1ab822){_0x32e0fe[_0x3af9('0x27')]['ip']=_0x32e0fe[_0x3af9('0x28')]['x-forwarded-for']||_0x32e0fe[_0x3af9('0x29')][_0x3af9('0x2a')]||_0x32e0fe[_0x3af9('0x2b')][_0x3af9('0x2a')]||_0x32e0fe[_0x3af9('0x29')][_0x3af9('0x2b')][_0x3af9('0x2a')];return openIssue(_0x32e0fe['body'],_0x1ab822);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index 897d535..2ec1753 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 _0xd64b=['../../components/auth/service','../../components/interaction/service','index','get','/describe','isAuthenticated','describe','/:id','post','create','update','delete','exports','multer','path','express','Router','fs-extra'];(function(_0x196c91,_0x45f8ad){var _0x5268d3=function(_0x2b5215){while(--_0x2b5215){_0x196c91['push'](_0x196c91['shift']());}};_0x5268d3(++_0x45f8ad);}(_0xd64b,0xc1));var _0xbd64=function(_0x24b8ec,_0x3c8c5b){_0x24b8ec=_0x24b8ec-0x0;var _0x1d1b63=_0xd64b[_0x24b8ec];return _0x1d1b63;};'use strict';var multer=require(_0xbd64('0x0'));var util=require('util');var path=require(_0xbd64('0x1'));var timeout=require('connect-timeout');var express=require(_0xbd64('0x2'));var router=express[_0xbd64('0x3')]();var fs_extra=require(_0xbd64('0x4'));var auth=require(_0xbd64('0x5'));var interaction=require(_0xbd64('0x6'));var config=require('../../config/environment');var controller=require('./jscriptyAnswerReport.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xbd64('0x7')]);router[_0xbd64('0x8')](_0xbd64('0x9'),auth[_0xbd64('0xa')](),controller[_0xbd64('0xb')]);router[_0xbd64('0x8')](_0xbd64('0xc'),auth['isAuthenticated'](),controller['show']);router[_0xbd64('0xd')]('/',auth[_0xbd64('0xa')](),controller[_0xbd64('0xe')]);router['put'](_0xbd64('0xc'),auth[_0xbd64('0xa')](),controller[_0xbd64('0xf')]);router[_0xbd64('0x10')]('/:id',auth[_0xbd64('0xa')](),controller['destroy']);module[_0xbd64('0x11')]=router; \ No newline at end of file +var _0xee5b=['fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','show','post','put','/:id','update','delete','destroy','exports','multer','path','connect-timeout','Router'];(function(_0x2fb2af,_0x150ee4){var _0x34899e=function(_0x4299e2){while(--_0x4299e2){_0x2fb2af['push'](_0x2fb2af['shift']());}};_0x34899e(++_0x150ee4);}(_0xee5b,0x1f4));var _0xbee5=function(_0x4afcdf,_0x34ef78){_0x4afcdf=_0x4afcdf-0x0;var _0x377dc0=_0xee5b[_0x4afcdf];return _0x377dc0;};'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('./jscriptyAnswerReport.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('0xb')]('/',auth[_0xbee5('0x8')](),controller['create']);router[_0xbee5('0xc')](_0xbee5('0xd'),auth[_0xbee5('0x8')](),controller[_0xbee5('0xe')]);router[_0xbee5('0xf')](_0xbee5('0xd'),auth[_0xbee5('0x8')](),controller[_0xbee5('0x10')]);module[_0xbee5('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 6bce784..e09c553 100644 --- a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js +++ b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['long','STRING','sequelize','exports','TEXT'];(function(_0x1928c9,_0x13a6d1){var _0x51b5fb=function(_0x24cf70){while(--_0x24cf70){_0x1928c9['push'](_0x1928c9['shift']());}};_0x51b5fb(++_0x13a6d1);}(_0x7a54,0x106));var _0x47a5=function(_0x3790cc,_0x25678e){_0x3790cc=_0x3790cc-0x0;var _0x578534=_0x7a54[_0x3790cc];return _0x578534;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'question':{'type':Sequelize[_0x47a5('0x2')]},'answer':{'type':Sequelize['TEXT'](_0x47a5('0x3'))},'membername':{'type':Sequelize[_0x47a5('0x4')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x47a5('0x4')]},'uniqueid':{'type':Sequelize[_0x47a5('0x4')]},'calleridname':{'type':Sequelize[_0x47a5('0x4')]},'calleridnum':{'type':Sequelize[_0x47a5('0x4')]},'questionId':{'type':Sequelize[_0x47a5('0x4')]}}; \ No newline at end of file +var _0x7a54=['long','STRING','sequelize','exports','TEXT'];(function(_0x2235bf,_0x3a06a7){var _0x4c3a64=function(_0x3b3bb6){while(--_0x3b3bb6){_0x2235bf['push'](_0x2235bf['shift']());}};_0x4c3a64(++_0x3a06a7);}(_0x7a54,0x106));var _0x47a5=function(_0x566181,_0x593f8f){_0x566181=_0x566181-0x0;var _0x50525f=_0x7a54[_0x566181];return _0x50525f;};'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 55067c7..f966d86 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 _0xb091=['querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','error','name','send','index','map','JscriptyAnswerReport','fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','params','includeAll','find','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv'];(function(_0x35d770,_0x4b8b78){var _0x2e1b6f=function(_0x33ef12){while(--_0x33ef12){_0x35d770['push'](_0x35d770['shift']());}};_0x2e1b6f(++_0x4b8b78);}(_0xb091,0x16e));var _0x1b09=function(_0x22bc26,_0xad97de){_0x22bc26=_0x22bc26-0x0;var _0x36fffe=_0xb091[_0x22bc26];return _0x36fffe;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1b09('0x0'));var zipdir=require(_0x1b09('0x1'));var jsonpatch=require(_0x1b09('0x2'));var rp=require(_0x1b09('0x3'));var moment=require('moment');var BPromise=require(_0x1b09('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x1b09('0x5'));var sox=require(_0x1b09('0x6'));var csv=require('to-csv');var ejs=require(_0x1b09('0x7'));var fs=require('fs');var fs_extra=require(_0x1b09('0x8'));var _=require(_0x1b09('0x9'));var squel=require('squel');var crypto=require(_0x1b09('0xa'));var jsforce=require(_0x1b09('0xb'));var deskjs=require(_0x1b09('0xc'));var toCsv=require(_0x1b09('0xd'));var querystring=require(_0x1b09('0xe'));var Papa=require(_0x1b09('0xf'));var Redis=require(_0x1b09('0x10'));var authService=require(_0x1b09('0x11'));var qs=require(_0x1b09('0x12'));var as=require(_0x1b09('0x13'));var hardwareService=require(_0x1b09('0x14'));var logger=require('../../config/logger')(_0x1b09('0x15'));var utils=require(_0x1b09('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x1b09('0x17'))['db'];function respondWithStatusCode(_0x4284ad,_0x3ae4a0){_0x3ae4a0=_0x3ae4a0||0xcc;return function(_0x1046f8){if(_0x1046f8){return _0x4284ad[_0x1b09('0x18')](_0x3ae4a0);}return _0x4284ad[_0x1b09('0x19')](_0x3ae4a0)[_0x1b09('0x1a')]();};}function respondWithResult(_0x58392d,_0x37fdb2){_0x37fdb2=_0x37fdb2||0xc8;return function(_0x515ade){if(_0x515ade){return _0x58392d[_0x1b09('0x19')](_0x37fdb2)[_0x1b09('0x1b')](_0x515ade);}};}function respondWithFilteredResult(_0x11ab46,_0x37673e){return function(_0x10b7eb){if(_0x10b7eb){var _0x1dc96b=typeof _0x37673e[_0x1b09('0x1c')]===_0x1b09('0x1d')&&typeof _0x37673e[_0x1b09('0x1e')]===_0x1b09('0x1d');var _0x311158=_0x10b7eb[_0x1b09('0x1f')];var _0x646575=_0x1dc96b?0x0:_0x37673e['offset'];var _0x214c6b=_0x1dc96b?_0x10b7eb[_0x1b09('0x1f')]:_0x37673e['offset']+_0x37673e['limit'];var _0xe93ac4;if(_0x214c6b>=_0x311158){_0x214c6b=_0x311158;_0xe93ac4=0xc8;}else{_0xe93ac4=0xce;}_0x11ab46['status'](_0xe93ac4);return _0x11ab46[_0x1b09('0x20')]('Content-Range',_0x646575+'-'+_0x214c6b+'/'+_0x311158)[_0x1b09('0x1b')](_0x10b7eb);}return null;};}function patchUpdates(_0x4b2eab){return function(_0x2d6dba){try{jsonpatch[_0x1b09('0x21')](_0x2d6dba,_0x4b2eab,!![]);}catch(_0x29dd70){return BPromise[_0x1b09('0x22')](_0x29dd70);}return _0x2d6dba[_0x1b09('0x23')]();};}function saveUpdates(_0x39e569,_0x48b803){return function(_0x5e2806){if(_0x5e2806){return _0x5e2806[_0x1b09('0x24')](_0x39e569)[_0x1b09('0x25')](function(_0x4ce7dc){return _0x4ce7dc;});}return null;};}function removeEntity(_0x3c0496,_0x11d0d5){return function(_0x6e132c){if(_0x6e132c){return _0x6e132c[_0x1b09('0x26')]()['then'](function(){_0x3c0496[_0x1b09('0x19')](0xcc)[_0x1b09('0x1a')]();});}};}function handleEntityNotFound(_0x4936d0,_0x2d3b86){return function(_0x472d30){if(!_0x472d30){_0x4936d0['sendStatus'](0x194);}return _0x472d30;};}function handleError(_0x13c89c,_0x108d80){_0x108d80=_0x108d80||0x1f4;return function(_0xa71272){logger[_0x1b09('0x27')](_0xa71272['stack']);if(_0xa71272[_0x1b09('0x28')]){delete _0xa71272[_0x1b09('0x28')];}_0x13c89c['status'](_0x108d80)[_0x1b09('0x29')](_0xa71272);};}exports[_0x1b09('0x2a')]=function(_0x26befb,_0x1cbbd5){var _0x11098e={},_0x1aa179={},_0x34620f={'count':0x0,'rows':[]};var _0x5a503d=_[_0x1b09('0x2b')](db[_0x1b09('0x2c')]['rawAttributes'],function(_0x34d912){return{'name':_0x34d912[_0x1b09('0x2d')],'type':_0x34d912[_0x1b09('0x2e')][_0x1b09('0x2f')]};});_0x1aa179[_0x1b09('0x30')]=_['map'](_0x5a503d,_0x1b09('0x28'));_0x1aa179['query']=_[_0x1b09('0x31')](_0x26befb['query']);_0x1aa179[_0x1b09('0x32')]=_[_0x1b09('0x33')](_0x1aa179[_0x1b09('0x30')],_0x1aa179[_0x1b09('0x34')]);_0x11098e[_0x1b09('0x35')]=_[_0x1b09('0x33')](_0x1aa179[_0x1b09('0x30')],qs[_0x1b09('0x36')](_0x26befb[_0x1b09('0x34')][_0x1b09('0x36')]));_0x11098e['attributes']=_0x11098e[_0x1b09('0x35')][_0x1b09('0x37')]?_0x11098e[_0x1b09('0x35')]:_0x1aa179['model'];if(!_0x26befb[_0x1b09('0x34')][_0x1b09('0x38')](_0x1b09('0x39'))){_0x11098e[_0x1b09('0x1e')]=qs[_0x1b09('0x1e')](_0x26befb[_0x1b09('0x34')][_0x1b09('0x1e')]);_0x11098e[_0x1b09('0x1c')]=qs['offset'](_0x26befb[_0x1b09('0x34')]['offset']);}_0x11098e[_0x1b09('0x3a')]=qs['sort'](_0x26befb[_0x1b09('0x34')][_0x1b09('0x3b')]);_0x11098e[_0x1b09('0x3c')]=qs[_0x1b09('0x32')](_[_0x1b09('0x3d')](_0x26befb[_0x1b09('0x34')],_0x1aa179[_0x1b09('0x32')]),_0x5a503d);if(_0x26befb[_0x1b09('0x34')][_0x1b09('0x3e')]){_0x11098e[_0x1b09('0x3c')]=_[_0x1b09('0x3f')](_0x11098e[_0x1b09('0x3c')],{'$or':_[_0x1b09('0x2b')](_0x5a503d,function(_0x4bd6fa){if(_0x4bd6fa['type']!==_0x1b09('0x40')){var _0xb2ef05={};_0xb2ef05[_0x4bd6fa[_0x1b09('0x28')]]={'$like':'%'+_0x26befb[_0x1b09('0x34')][_0x1b09('0x3e')]+'%'};return _0xb2ef05;}})});}_0x11098e=_[_0x1b09('0x3f')]({},_0x11098e,_0x26befb[_0x1b09('0x41')]);var _0x33d697={'where':_0x11098e['where']};return db['JscriptyAnswerReport'][_0x1b09('0x1f')](_0x33d697)['then'](function(_0x966873){_0x34620f[_0x1b09('0x1f')]=_0x966873;if(_0x26befb[_0x1b09('0x34')]['includeAll']){_0x11098e[_0x1b09('0x42')]=[{'all':!![]}];}return db[_0x1b09('0x2c')][_0x1b09('0x43')](_0x11098e);})['then'](function(_0x3edcde){_0x34620f[_0x1b09('0x44')]=_0x3edcde;return _0x34620f;})[_0x1b09('0x25')](respondWithFilteredResult(_0x1cbbd5,_0x11098e))[_0x1b09('0x45')](handleError(_0x1cbbd5,null));};exports['show']=function(_0x36f814,_0x2b2341){var _0x4c0559={'raw':!![],'where':{'id':_0x36f814[_0x1b09('0x46')]['id']}},_0x1c7ec6={};_0x1c7ec6['model']=_['keys'](db['JscriptyAnswerReport']['rawAttributes']);_0x1c7ec6[_0x1b09('0x34')]=_[_0x1b09('0x31')](_0x36f814[_0x1b09('0x34')]);_0x1c7ec6['filters']=_[_0x1b09('0x33')](_0x1c7ec6[_0x1b09('0x30')],_0x1c7ec6['query']);_0x4c0559[_0x1b09('0x35')]=_[_0x1b09('0x33')](_0x1c7ec6[_0x1b09('0x30')],qs[_0x1b09('0x36')](_0x36f814[_0x1b09('0x34')][_0x1b09('0x36')]));_0x4c0559[_0x1b09('0x35')]=_0x4c0559[_0x1b09('0x35')][_0x1b09('0x37')]?_0x4c0559[_0x1b09('0x35')]:_0x1c7ec6['model'];if(_0x36f814[_0x1b09('0x34')][_0x1b09('0x47')]){_0x4c0559[_0x1b09('0x42')]=[{'all':!![]}];}_0x4c0559=_['merge']({},_0x4c0559,_0x36f814[_0x1b09('0x41')]);return db['JscriptyAnswerReport'][_0x1b09('0x48')](_0x4c0559)[_0x1b09('0x25')](handleEntityNotFound(_0x2b2341,null))['then'](respondWithResult(_0x2b2341,null))[_0x1b09('0x45')](handleError(_0x2b2341,null));};exports[_0x1b09('0x49')]=function(_0x3732fb,_0x25443a){return db[_0x1b09('0x2c')][_0x1b09('0x49')](_0x3732fb['body'],{})[_0x1b09('0x25')](respondWithResult(_0x25443a,0xc9))['catch'](handleError(_0x25443a,null));};exports[_0x1b09('0x24')]=function(_0x58a158,_0x50a66c){if(_0x58a158[_0x1b09('0x4a')]['id']){delete _0x58a158[_0x1b09('0x4a')]['id'];}return db[_0x1b09('0x2c')][_0x1b09('0x48')]({'where':{'id':_0x58a158[_0x1b09('0x46')]['id']}})[_0x1b09('0x25')](handleEntityNotFound(_0x50a66c,null))[_0x1b09('0x25')](saveUpdates(_0x58a158[_0x1b09('0x4a')],null))['then'](respondWithResult(_0x50a66c,null))[_0x1b09('0x45')](handleError(_0x50a66c,null));};exports[_0x1b09('0x26')]=function(_0x21b4c2,_0x481147){return db['JscriptyAnswerReport'][_0x1b09('0x48')]({'where':{'id':_0x21b4c2['params']['id']}})[_0x1b09('0x25')](handleEntityNotFound(_0x481147,null))[_0x1b09('0x25')](removeEntity(_0x481147,null))['catch'](handleError(_0x481147,null));};exports[_0x1b09('0x4b')]=function(_0x6f4589,_0x5941df){return db[_0x1b09('0x2c')][_0x1b09('0x4b')]()[_0x1b09('0x25')](respondWithResult(_0x5941df,null))[_0x1b09('0x45')](handleError(_0x5941df,null));}; \ No newline at end of file +var _0x379e=['key','model','query','keys','intersection','attributes','fields','length','nolimit','sort','filters','pick','filter','merge','where','VIRTUAL','options','includeAll','include','JscriptyAnswerReport','rows','show','find','create','body','update','catch','params','describe','eml-format','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','count','set','Content-Range','reject','save','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x379e,0x104));var _0xe379=function(_0x506857,_0x1d065e){_0x506857=_0x506857-0x0;var _0x122e94=_0x379e[_0x506857];return _0x122e94;};'use strict';var emlformat=require(_0xe379('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xe379('0x1'));var moment=require(_0xe379('0x2'));var BPromise=require(_0xe379('0x3'));var Mustache=require(_0xe379('0x4'));var util=require(_0xe379('0x5'));var path=require(_0xe379('0x6'));var sox=require(_0xe379('0x7'));var csv=require('to-csv');var ejs=require(_0xe379('0x8'));var fs=require('fs');var fs_extra=require(_0xe379('0x9'));var _=require(_0xe379('0xa'));var squel=require(_0xe379('0xb'));var crypto=require(_0xe379('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xe379('0xd'));var toCsv=require(_0xe379('0xe'));var querystring=require(_0xe379('0xf'));var Papa=require(_0xe379('0x10'));var Redis=require(_0xe379('0x11'));var authService=require(_0xe379('0x12'));var qs=require(_0xe379('0x13'));var as=require(_0xe379('0x14'));var hardwareService=require(_0xe379('0x15'));var logger=require('../../config/logger')(_0xe379('0x16'));var utils=require(_0xe379('0x17'));var config=require(_0xe379('0x18'));var licenseUtil=require(_0xe379('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4c6562,_0x2642a8){_0x2642a8=_0x2642a8||0xcc;return function(_0x45cf1a){if(_0x45cf1a){return _0x4c6562[_0xe379('0x1a')](_0x2642a8);}return _0x4c6562[_0xe379('0x1b')](_0x2642a8)[_0xe379('0x1c')]();};}function respondWithResult(_0x1ee8e0,_0x2a5b60){_0x2a5b60=_0x2a5b60||0xc8;return function(_0x70d82){if(_0x70d82){return _0x1ee8e0['status'](_0x2a5b60)[_0xe379('0x1d')](_0x70d82);}};}function respondWithFilteredResult(_0xab59c7,_0x20eaaf){return function(_0x105d7f){if(_0x105d7f){var _0x3d9351=typeof _0x20eaaf[_0xe379('0x1e')]==='undefined'&&typeof _0x20eaaf[_0xe379('0x1f')]==='undefined';var _0x2c2bd9=_0x105d7f['count'];var _0x150d92=_0x3d9351?0x0:_0x20eaaf[_0xe379('0x1e')];var _0xe4f3d1=_0x3d9351?_0x105d7f[_0xe379('0x20')]:_0x20eaaf['offset']+_0x20eaaf[_0xe379('0x1f')];var _0x260b2e;if(_0xe4f3d1>=_0x2c2bd9){_0xe4f3d1=_0x2c2bd9;_0x260b2e=0xc8;}else{_0x260b2e=0xce;}_0xab59c7[_0xe379('0x1b')](_0x260b2e);return _0xab59c7[_0xe379('0x21')](_0xe379('0x22'),_0x150d92+'-'+_0xe4f3d1+'/'+_0x2c2bd9)['json'](_0x105d7f);}return null;};}function patchUpdates(_0x2c749e){return function(_0x3a8d17){try{jsonpatch['apply'](_0x3a8d17,_0x2c749e,!![]);}catch(_0x39ec4d){return BPromise[_0xe379('0x23')](_0x39ec4d);}return _0x3a8d17[_0xe379('0x24')]();};}function saveUpdates(_0x2e946f,_0x32f43e){return function(_0x10b3c3){if(_0x10b3c3){return _0x10b3c3['update'](_0x2e946f)[_0xe379('0x25')](function(_0x32e16e){return _0x32e16e;});}return null;};}function removeEntity(_0x21e31b,_0x48b543){return function(_0x38236b){if(_0x38236b){return _0x38236b[_0xe379('0x26')]()['then'](function(){_0x21e31b[_0xe379('0x1b')](0xcc)[_0xe379('0x1c')]();});}};}function handleEntityNotFound(_0x4da256,_0x544bf3){return function(_0x22f596){if(!_0x22f596){_0x4da256[_0xe379('0x1a')](0x194);}return _0x22f596;};}function handleError(_0x26ba82,_0x4aa041){_0x4aa041=_0x4aa041||0x1f4;return function(_0x17ba51){logger[_0xe379('0x27')](_0x17ba51[_0xe379('0x28')]);if(_0x17ba51[_0xe379('0x29')]){delete _0x17ba51['name'];}_0x26ba82[_0xe379('0x1b')](_0x4aa041)[_0xe379('0x2a')](_0x17ba51);};}exports[_0xe379('0x2b')]=function(_0x50b0aa,_0x33037d){var _0x120239={},_0x5d9ca1={},_0x24c85d={'count':0x0,'rows':[]};var _0x528a44=_[_0xe379('0x2c')](db['JscriptyAnswerReport'][_0xe379('0x2d')],function(_0x214a0c){return{'name':_0x214a0c[_0xe379('0x2e')],'type':_0x214a0c[_0xe379('0x2f')][_0xe379('0x30')]};});_0x5d9ca1[_0xe379('0x31')]=_[_0xe379('0x2c')](_0x528a44,'name');_0x5d9ca1[_0xe379('0x32')]=_[_0xe379('0x33')](_0x50b0aa[_0xe379('0x32')]);_0x5d9ca1['filters']=_[_0xe379('0x34')](_0x5d9ca1['model'],_0x5d9ca1['query']);_0x120239[_0xe379('0x35')]=_[_0xe379('0x34')](_0x5d9ca1[_0xe379('0x31')],qs[_0xe379('0x36')](_0x50b0aa['query'][_0xe379('0x36')]));_0x120239[_0xe379('0x35')]=_0x120239['attributes'][_0xe379('0x37')]?_0x120239[_0xe379('0x35')]:_0x5d9ca1[_0xe379('0x31')];if(!_0x50b0aa[_0xe379('0x32')]['hasOwnProperty'](_0xe379('0x38'))){_0x120239['limit']=qs[_0xe379('0x1f')](_0x50b0aa[_0xe379('0x32')][_0xe379('0x1f')]);_0x120239[_0xe379('0x1e')]=qs[_0xe379('0x1e')](_0x50b0aa['query'][_0xe379('0x1e')]);}_0x120239['order']=qs[_0xe379('0x39')](_0x50b0aa[_0xe379('0x32')][_0xe379('0x39')]);_0x120239['where']=qs[_0xe379('0x3a')](_[_0xe379('0x3b')](_0x50b0aa[_0xe379('0x32')],_0x5d9ca1[_0xe379('0x3a')]),_0x528a44);if(_0x50b0aa['query'][_0xe379('0x3c')]){_0x120239['where']=_[_0xe379('0x3d')](_0x120239[_0xe379('0x3e')],{'$or':_[_0xe379('0x2c')](_0x528a44,function(_0x12e67e){if(_0x12e67e[_0xe379('0x2f')]!==_0xe379('0x3f')){var _0x56ebb7={};_0x56ebb7[_0x12e67e[_0xe379('0x29')]]={'$like':'%'+_0x50b0aa['query'][_0xe379('0x3c')]+'%'};return _0x56ebb7;}})});}_0x120239=_[_0xe379('0x3d')]({},_0x120239,_0x50b0aa[_0xe379('0x40')]);var _0x2e3eef={'where':_0x120239[_0xe379('0x3e')]};return db['JscriptyAnswerReport'][_0xe379('0x20')](_0x2e3eef)[_0xe379('0x25')](function(_0x59ba54){_0x24c85d['count']=_0x59ba54;if(_0x50b0aa['query'][_0xe379('0x41')]){_0x120239[_0xe379('0x42')]=[{'all':!![]}];}return db[_0xe379('0x43')]['findAll'](_0x120239);})[_0xe379('0x25')](function(_0x3089df){_0x24c85d[_0xe379('0x44')]=_0x3089df;return _0x24c85d;})[_0xe379('0x25')](respondWithFilteredResult(_0x33037d,_0x120239))['catch'](handleError(_0x33037d,null));};exports[_0xe379('0x45')]=function(_0x36ce8e,_0x3c6f5d){var _0x32ecbe={'raw':!![],'where':{'id':_0x36ce8e['params']['id']}},_0x48f0cc={};_0x48f0cc[_0xe379('0x31')]=_[_0xe379('0x33')](db[_0xe379('0x43')][_0xe379('0x2d')]);_0x48f0cc[_0xe379('0x32')]=_[_0xe379('0x33')](_0x36ce8e['query']);_0x48f0cc[_0xe379('0x3a')]=_['intersection'](_0x48f0cc[_0xe379('0x31')],_0x48f0cc[_0xe379('0x32')]);_0x32ecbe[_0xe379('0x35')]=_[_0xe379('0x34')](_0x48f0cc[_0xe379('0x31')],qs[_0xe379('0x36')](_0x36ce8e[_0xe379('0x32')][_0xe379('0x36')]));_0x32ecbe[_0xe379('0x35')]=_0x32ecbe[_0xe379('0x35')][_0xe379('0x37')]?_0x32ecbe[_0xe379('0x35')]:_0x48f0cc[_0xe379('0x31')];if(_0x36ce8e[_0xe379('0x32')][_0xe379('0x41')]){_0x32ecbe[_0xe379('0x42')]=[{'all':!![]}];}_0x32ecbe=_[_0xe379('0x3d')]({},_0x32ecbe,_0x36ce8e[_0xe379('0x40')]);return db[_0xe379('0x43')][_0xe379('0x46')](_0x32ecbe)[_0xe379('0x25')](handleEntityNotFound(_0x3c6f5d,null))[_0xe379('0x25')](respondWithResult(_0x3c6f5d,null))['catch'](handleError(_0x3c6f5d,null));};exports[_0xe379('0x47')]=function(_0x266bfe,_0x42a378){return db[_0xe379('0x43')][_0xe379('0x47')](_0x266bfe[_0xe379('0x48')],{})['then'](respondWithResult(_0x42a378,0xc9))['catch'](handleError(_0x42a378,null));};exports[_0xe379('0x49')]=function(_0x5db39f,_0x55b27b){if(_0x5db39f[_0xe379('0x48')]['id']){delete _0x5db39f[_0xe379('0x48')]['id'];}return db[_0xe379('0x43')][_0xe379('0x46')]({'where':{'id':_0x5db39f['params']['id']}})[_0xe379('0x25')](handleEntityNotFound(_0x55b27b,null))[_0xe379('0x25')](saveUpdates(_0x5db39f['body'],null))[_0xe379('0x25')](respondWithResult(_0x55b27b,null))[_0xe379('0x4a')](handleError(_0x55b27b,null));};exports['destroy']=function(_0x4ac3eb,_0x3af1be){return db[_0xe379('0x43')]['find']({'where':{'id':_0x4ac3eb[_0xe379('0x4b')]['id']}})[_0xe379('0x25')](handleEntityNotFound(_0x3af1be,null))[_0xe379('0x25')](removeEntity(_0x3af1be,null))[_0xe379('0x4a')](handleError(_0x3af1be,null));};exports[_0xe379('0x4c')]=function(_0x4a9c86,_0x337775){return db['JscriptyAnswerReport']['describe']()[_0xe379('0x25')](respondWithResult(_0x337775,null))[_0xe379('0x4a')](handleError(_0x337775,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index 2cc58ca..7b12d1c 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 _0x8e86=['../../config/environment','./jscriptyAnswerReport.attributes','exports','report_jscripty_answers','util','../../config/logger','moment','request-promise'];(function(_0x102e37,_0x14a181){var _0x35a07c=function(_0x16577f){while(--_0x16577f){_0x102e37['push'](_0x102e37['shift']());}};_0x35a07c(++_0x14a181);}(_0x8e86,0xbc));var _0x68e8=function(_0x9c53e9,_0x454d0a){_0x9c53e9=_0x9c53e9-0x0;var _0x931e01=_0x8e86[_0x9c53e9];return _0x931e01;};'use strict';var _=require('lodash');var util=require(_0x68e8('0x0'));var logger=require(_0x68e8('0x1'))('api');var moment=require(_0x68e8('0x2'));var BPromise=require('bluebird');var rp=require(_0x68e8('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x68e8('0x4'));var attributes=require(_0x68e8('0x5'));module[_0x68e8('0x6')]=function(_0x539268,_0x585b0b){return _0x539268['define']('JscriptyAnswerReport',attributes,{'tableName':_0x68e8('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4af2=['JscriptyAnswerReport','report_jscripty_answers','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','exports','define'];(function(_0x2b36b0,_0x331282){var _0x3c0a23=function(_0x4b4b3e){while(--_0x4b4b3e){_0x2b36b0['push'](_0x2b36b0['shift']());}};_0x3c0a23(++_0x331282);}(_0x4af2,0x1ca));var _0x24af=function(_0x3b9c33,_0x2fde78){_0x3b9c33=_0x3b9c33-0x0;var _0x2101b7=_0x4af2[_0x3b9c33];return _0x2101b7;};'use strict';var _=require('lodash');var util=require(_0x24af('0x0'));var logger=require(_0x24af('0x1'))(_0x24af('0x2'));var moment=require(_0x24af('0x3'));var BPromise=require(_0x24af('0x4'));var rp=require(_0x24af('0x5'));var fs=require('fs');var path=require(_0x24af('0x6'));var rimraf=require('rimraf');var config=require(_0x24af('0x7'));var attributes=require('./jscriptyAnswerReport.attributes');module[_0x24af('0x8')]=function(_0x3d056a,_0x4c95f9){return _0x3d056a[_0x24af('0x9')](_0x24af('0xa'),attributes,{'tableName':_0x24af('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js index 38aca3b..a6592ae 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 _0x4d65=['result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','info','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x28cc28,_0x371d60){var _0x5955a7=function(_0x28a891){while(--_0x28a891){_0x28cc28['push'](_0x28cc28['shift']());}};_0x5955a7(++_0x371d60);}(_0x4d65,0x10a));var _0x54d6=function(_0x521929,_0x479be5){_0x521929=_0x521929-0x0;var _0x632436=_0x4d65[_0x521929];return _0x632436;};'use strict';var _=require(_0x54d6('0x0'));var util=require('util');var moment=require(_0x54d6('0x1'));var BPromise=require(_0x54d6('0x2'));var rs=require(_0x54d6('0x3'));var fs=require('fs');var Redis=require(_0x54d6('0x4'));var db=require(_0x54d6('0x5'))['db'];var utils=require(_0x54d6('0x6'));var logger=require('../../config/logger')(_0x54d6('0x7'));var config=require(_0x54d6('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x54d6('0x9')][_0x54d6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x10a95b,_0x53b65d,_0x15dd9d){return new BPromise(function(_0x2587d6,_0x381caa){return client[_0x54d6('0xb')](_0x10a95b,_0x15dd9d)[_0x54d6('0xc')](function(_0x1e4ba1){logger[_0x54d6('0xd')](_0x54d6('0xe'),_0x53b65d,_0x54d6('0xf'));logger[_0x54d6('0x10')](_0x54d6('0x11'),_0x53b65d,_0x54d6('0xf'),JSON[_0x54d6('0x12')](_0x1e4ba1));if(_0x1e4ba1['error']){if(_0x1e4ba1[_0x54d6('0x13')][_0x54d6('0x14')]===0x1f4){logger[_0x54d6('0x13')](_0x54d6('0xe'),_0x53b65d,_0x1e4ba1['error'][_0x54d6('0x15')]);return _0x381caa(_0x1e4ba1[_0x54d6('0x13')][_0x54d6('0x15')]);}logger[_0x54d6('0x13')](_0x54d6('0xe'),_0x53b65d,_0x1e4ba1['error'][_0x54d6('0x15')]);return _0x2587d6(_0x1e4ba1[_0x54d6('0x13')][_0x54d6('0x15')]);}else{logger[_0x54d6('0xd')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x53b65d,_0x54d6('0xf'));_0x2587d6(_0x1e4ba1[_0x54d6('0x16')][_0x54d6('0x15')]);}})[_0x54d6('0x17')](function(_0x282e89){logger[_0x54d6('0x13')](_0x54d6('0xe'),_0x53b65d,_0x282e89);_0x381caa(_0x282e89);});});} \ No newline at end of file +var _0x51fc=['stringify','error','code','message','info','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x21fbb1,_0x120f56){var _0x2f7b69=function(_0x37f84c){while(--_0x37f84c){_0x21fbb1['push'](_0x21fbb1['shift']());}};_0x2f7b69(++_0x120f56);}(_0x51fc,0x133));var _0xc51f=function(_0xcb56d2,_0x18c194){_0xcb56d2=_0xcb56d2-0x0;var _0x57bed4=_0x51fc[_0xcb56d2];return _0x57bed4;};'use strict';var _=require('lodash');var util=require(_0xc51f('0x0'));var moment=require('moment');var BPromise=require(_0xc51f('0x1'));var rs=require(_0xc51f('0x2'));var fs=require('fs');var Redis=require(_0xc51f('0x3'));var db=require(_0xc51f('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xc51f('0x5'))(_0xc51f('0x6'));var config=require(_0xc51f('0x7'));var jayson=require(_0xc51f('0x8'));var client=jayson['client'][_0xc51f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x45747f,_0x566b0a,_0x962ae8){return new BPromise(function(_0x2d687c,_0x67f44b){return client['request'](_0x45747f,_0x962ae8)['then'](function(_0xc05f3){logger['info'](_0xc51f('0xa'),_0x566b0a,_0xc51f('0xb'));logger[_0xc51f('0xc')]('JscriptyAnswerReport,\x20%s,\x20%s,\x20%s',_0x566b0a,_0xc51f('0xb'),JSON[_0xc51f('0xd')](_0xc05f3));if(_0xc05f3[_0xc51f('0xe')]){if(_0xc05f3[_0xc51f('0xe')][_0xc51f('0xf')]===0x1f4){logger['error'](_0xc51f('0xa'),_0x566b0a,_0xc05f3['error'][_0xc51f('0x10')]);return _0x67f44b(_0xc05f3['error'][_0xc51f('0x10')]);}logger[_0xc51f('0xe')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x566b0a,_0xc05f3[_0xc51f('0xe')]['message']);return _0x2d687c(_0xc05f3['error']['message']);}else{logger[_0xc51f('0x11')](_0xc51f('0xa'),_0x566b0a,_0xc51f('0xb'));_0x2d687c(_0xc05f3[_0xc51f('0x12')][_0xc51f('0x10')]);}})[_0xc51f('0x13')](function(_0x5ae18f){logger[_0xc51f('0xe')](_0xc51f('0xa'),_0x566b0a,_0x5ae18f);_0x67f44b(_0x5ae18f);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index eca9c9a..e0dc6ce 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 _0x04c2=['../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyProject.controller','get','isAuthenticated','index','/:id','show','/:id/sessions','getSessions','getAnswers','/:id/summary','30s','post','create','/:id/clone','clone','put','update','delete','destroy','util','connect-timeout','express','fs-extra'];(function(_0x3c4024,_0x1fb7c9){var _0x20f126=function(_0x572d54){while(--_0x572d54){_0x3c4024['push'](_0x3c4024['shift']());}};_0x20f126(++_0x1fb7c9);}(_0x04c2,0xb2));var _0x204c=function(_0xd8ed58,_0x553238){_0xd8ed58=_0xd8ed58-0x0;var _0x36352b=_0x04c2[_0xd8ed58];return _0x36352b;};'use strict';var multer=require('multer');var util=require(_0x204c('0x0'));var path=require('path');var timeout=require(_0x204c('0x1'));var express=require(_0x204c('0x2'));var router=express['Router']();var fs_extra=require(_0x204c('0x3'));var auth=require(_0x204c('0x4'));var interaction=require(_0x204c('0x5'));var config=require(_0x204c('0x6'));var controller=require(_0x204c('0x7'));router[_0x204c('0x8')]('/',auth[_0x204c('0x9')](),controller[_0x204c('0xa')]);router['get'](_0x204c('0xb'),auth[_0x204c('0x9')](),controller[_0x204c('0xc')]);router[_0x204c('0x8')](_0x204c('0xd'),auth[_0x204c('0x9')](),controller[_0x204c('0xe')]);router[_0x204c('0x8')]('/:id/answers',auth[_0x204c('0x9')](),controller[_0x204c('0xf')]);router['get'](_0x204c('0x10'),auth[_0x204c('0x9')](),timeout(_0x204c('0x11')),controller['getSummary']);router[_0x204c('0x12')]('/',auth[_0x204c('0x9')](),controller[_0x204c('0x13')]);router[_0x204c('0x12')](_0x204c('0x14'),auth['isAuthenticated'](),controller[_0x204c('0x15')]);router[_0x204c('0x16')](_0x204c('0xb'),auth[_0x204c('0x9')](),controller[_0x204c('0x17')]);router[_0x204c('0x18')](_0x204c('0xb'),auth['isAuthenticated'](),controller[_0x204c('0x19')]);module['exports']=router; \ No newline at end of file +var _0xbf39=['/:id/answers','getAnswers','/:id/summary','30s','getSummary','create','post','/:id/clone','clone','update','delete','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./jscriptyProject.controller','get','isAuthenticated','index','/:id','getSessions'];(function(_0x279d37,_0x14de3f){var _0x530173=function(_0x37fc79){while(--_0x37fc79){_0x279d37['push'](_0x279d37['shift']());}};_0x530173(++_0x14de3f);}(_0xbf39,0x16a));var _0x9bf3=function(_0x56aec9,_0x353b30){_0x56aec9=_0x56aec9-0x0;var _0x2ef374=_0xbf39[_0x56aec9];return _0x2ef374;};'use strict';var multer=require(_0x9bf3('0x0'));var util=require(_0x9bf3('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x9bf3('0x2'));var router=express[_0x9bf3('0x3')]();var fs_extra=require(_0x9bf3('0x4'));var auth=require(_0x9bf3('0x5'));var interaction=require(_0x9bf3('0x6'));var config=require('../../config/environment');var controller=require(_0x9bf3('0x7'));router[_0x9bf3('0x8')]('/',auth[_0x9bf3('0x9')](),controller[_0x9bf3('0xa')]);router[_0x9bf3('0x8')](_0x9bf3('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x9bf3('0x8')]('/:id/sessions',auth[_0x9bf3('0x9')](),controller[_0x9bf3('0xc')]);router[_0x9bf3('0x8')](_0x9bf3('0xd'),auth[_0x9bf3('0x9')](),controller[_0x9bf3('0xe')]);router[_0x9bf3('0x8')](_0x9bf3('0xf'),auth['isAuthenticated'](),timeout(_0x9bf3('0x10')),controller[_0x9bf3('0x11')]);router['post']('/',auth[_0x9bf3('0x9')](),controller[_0x9bf3('0x12')]);router[_0x9bf3('0x13')](_0x9bf3('0x14'),auth[_0x9bf3('0x9')](),controller[_0x9bf3('0x15')]);router['put'](_0x9bf3('0xb'),auth[_0x9bf3('0x9')](),controller[_0x9bf3('0x16')]);router[_0x9bf3('0x17')](_0x9bf3('0xb'),auth[_0x9bf3('0x9')](),controller['destroy']);module[_0x9bf3('0x18')]=router; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.attributes.js b/server/api/jscriptyProject/jscriptyProject.attributes.js index 360ad71..db9c9ec 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 _0xc4b6=['formData','getDataValue','description','BOOLEAN','sequelize','lodash','util','STRING','name','TEXT','long','stringify','isString','setDataValue'];(function(_0x1b5a05,_0x2c80de){var _0x347931=function(_0xd39454){while(--_0xd39454){_0x1b5a05['push'](_0x1b5a05['shift']());}};_0x347931(++_0x2c80de);}(_0xc4b6,0x90));var _0x6c4b=function(_0x423f85,_0x322a15){_0x423f85=_0x423f85-0x0;var _0x5a4dc=_0xc4b6[_0x423f85];return _0x5a4dc;};'use strict';var Sequelize=require(_0x6c4b('0x0'));var _=require(_0x6c4b('0x1'));var util=require(_0x6c4b('0x2'));module['exports']={'name':{'type':Sequelize[_0x6c4b('0x3')],'unique':_0x6c4b('0x4')},'description':{'type':Sequelize[_0x6c4b('0x3')]},'formData':{'type':Sequelize[_0x6c4b('0x5')](_0x6c4b('0x6')),'set':function(_0x2d4ece){if(_['isObjectLike'](_0x2d4ece)){this['setDataValue']('formData',JSON[_0x6c4b('0x7')](_0x2d4ece));}else if(_[_0x6c4b('0x8')](_0x2d4ece)){this[_0x6c4b('0x9')]('formData',_0x2d4ece);}else{this[_0x6c4b('0x9')](_0x6c4b('0xa'),util['format']('{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}',this[_0x6c4b('0xb')](_0x6c4b('0x4'))||'',this['getDataValue'](_0x6c4b('0xc'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0x6c4b('0xd')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0x6c4b('0xd')],'defaultValue':![]}}; \ No newline at end of file +var _0x9db7=['TEXT','long','isObjectLike','setDataValue','formData','stringify','isString','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','description','BOOLEAN','sequelize','lodash','exports','STRING','name'];(function(_0x587fb5,_0x59cb3b){var _0x551105=function(_0x5bbef4){while(--_0x5bbef4){_0x587fb5['push'](_0x587fb5['shift']());}};_0x551105(++_0x59cb3b);}(_0x9db7,0xcb));var _0x79db=function(_0x270dda,_0x480f22){_0x270dda=_0x270dda-0x0;var _0x41b53b=_0x9db7[_0x270dda];return _0x41b53b;};'use strict';var Sequelize=require(_0x79db('0x0'));var _=require(_0x79db('0x1'));var util=require('util');module[_0x79db('0x2')]={'name':{'type':Sequelize[_0x79db('0x3')],'unique':_0x79db('0x4')},'description':{'type':Sequelize['STRING']},'formData':{'type':Sequelize[_0x79db('0x5')](_0x79db('0x6')),'set':function(_0x1dcbd1){if(_[_0x79db('0x7')](_0x1dcbd1)){this[_0x79db('0x8')](_0x79db('0x9'),JSON[_0x79db('0xa')](_0x1dcbd1));}else if(_[_0x79db('0xb')](_0x1dcbd1)){this[_0x79db('0x8')](_0x79db('0x9'),_0x1dcbd1);}else{this[_0x79db('0x8')]('formData',util[_0x79db('0xc')](_0x79db('0xd'),this['getDataValue']('name')||'',this['getDataValue'](_0x79db('0xe'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0x79db('0xf')],'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 7bdf74a..5d2c8cc 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 _0xbc23=['download','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','json','offset','limit','undefined','count','set','destroy','then','get','Projects','UserProfileResource','end','sendStatus','error','stack','send','map','JscriptyProject','rawAttributes','fieldName','type','model','name','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','rows','show','params','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','createdAt','updatedAt','autoAssociation','update','getSessions','findOne','ProjectId','JscriptySessionReport','findAll','getAnswers','JscriptyAnswerReport','fromCharCode','apply','toString','indexOf','replace','startTime','starttime','parse','JscriptyQuestionReport','questionId','question','format','SessionId','push','isEmpty','now','writeFileSync','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-disposition','Content-type','text/csv'];(function(_0x3f8759,_0x3fe6fb){var _0x2d33ca=function(_0x39b5c9){while(--_0x39b5c9){_0x3f8759['push'](_0x3f8759['shift']());}};_0x2d33ca(++_0x3fe6fb);}(_0xbc23,0x1bd));var _0x3bc2=function(_0x5685dc,_0x2dd160){_0x5685dc=_0x5685dc-0x0;var _0x290698=_0xbc23[_0x5685dc];return _0x290698;};'use strict';var emlformat=require(_0x3bc2('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x3bc2('0x1'));var rp=require(_0x3bc2('0x2'));var moment=require(_0x3bc2('0x3'));var BPromise=require(_0x3bc2('0x4'));var Mustache=require(_0x3bc2('0x5'));var util=require(_0x3bc2('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x3bc2('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x3bc2('0x8'));var crypto=require(_0x3bc2('0x9'));var jsforce=require(_0x3bc2('0xa'));var deskjs=require(_0x3bc2('0xb'));var toCsv=require(_0x3bc2('0x7'));var querystring=require(_0x3bc2('0xc'));var Papa=require(_0x3bc2('0xd'));var Redis=require('ioredis');var authService=require(_0x3bc2('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x3bc2('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3bc2('0x10'))(_0x3bc2('0x11'));var utils=require(_0x3bc2('0x12'));var config=require(_0x3bc2('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x3bc2('0x14'))['db'];function respondWithStatusCode(_0x2280cd,_0xdfdf63){_0xdfdf63=_0xdfdf63||0xcc;return function(_0x2e9ef5){if(_0x2e9ef5){return _0x2280cd['sendStatus'](_0xdfdf63);}return _0x2280cd[_0x3bc2('0x15')](_0xdfdf63)['end']();};}function respondWithResult(_0x8c87ef,_0x15cbb0){_0x15cbb0=_0x15cbb0||0xc8;return function(_0x4d8f05){if(_0x4d8f05){return _0x8c87ef[_0x3bc2('0x15')](_0x15cbb0)[_0x3bc2('0x16')](_0x4d8f05);}};}function respondWithFilteredResult(_0x173493,_0x552e20){return function(_0x243716){if(_0x243716){var _0x4bedb3=typeof _0x552e20[_0x3bc2('0x17')]==='undefined'&&typeof _0x552e20[_0x3bc2('0x18')]===_0x3bc2('0x19');var _0xe3054c=_0x243716[_0x3bc2('0x1a')];var _0x1f4253=_0x4bedb3?0x0:_0x552e20['offset'];var _0x5ecfe4=_0x4bedb3?_0x243716[_0x3bc2('0x1a')]:_0x552e20[_0x3bc2('0x17')]+_0x552e20[_0x3bc2('0x18')];var _0x1d8b47;if(_0x5ecfe4>=_0xe3054c){_0x5ecfe4=_0xe3054c;_0x1d8b47=0xc8;}else{_0x1d8b47=0xce;}_0x173493[_0x3bc2('0x15')](_0x1d8b47);return _0x173493[_0x3bc2('0x1b')]('Content-Range',_0x1f4253+'-'+_0x5ecfe4+'/'+_0xe3054c)[_0x3bc2('0x16')](_0x243716);}return null;};}function patchUpdates(_0x388cd3){return function(_0x4e6bc9){try{jsonpatch['apply'](_0x4e6bc9,_0x388cd3,!![]);}catch(_0x26bb22){return BPromise['reject'](_0x26bb22);}return _0x4e6bc9['save']();};}function saveUpdates(_0x3015e7,_0x580ee2){return function(_0x5d1e39){if(_0x5d1e39){return _0x5d1e39['update'](_0x3015e7)['then'](function(_0x198908){return _0x198908;});}return null;};}function removeEntity(_0x413999,_0x439649){return function(_0x1b00d0){if(_0x1b00d0){return _0x1b00d0[_0x3bc2('0x1c')]()[_0x3bc2('0x1d')](function(){var _0x591e45=_0x1b00d0[_0x3bc2('0x1e')]({'plain':!![]});var _0x25167e=_0x3bc2('0x1f');return db[_0x3bc2('0x20')][_0x3bc2('0x1c')]({'where':{'type':_0x25167e,'resourceId':_0x591e45['id']}})[_0x3bc2('0x1d')](function(){return _0x1b00d0;});})[_0x3bc2('0x1d')](function(){_0x413999[_0x3bc2('0x15')](0xcc)[_0x3bc2('0x21')]();});}};}function handleEntityNotFound(_0x1ddc73,_0xd6b456){return function(_0xd8d5ba){if(!_0xd8d5ba){_0x1ddc73[_0x3bc2('0x22')](0x194);}return _0xd8d5ba;};}function handleError(_0x3d6ba5,_0x594c6f){_0x594c6f=_0x594c6f||0x1f4;return function(_0x396d76){logger[_0x3bc2('0x23')](_0x396d76[_0x3bc2('0x24')]);if(_0x396d76['name']){delete _0x396d76['name'];}_0x3d6ba5[_0x3bc2('0x15')](_0x594c6f)[_0x3bc2('0x25')](_0x396d76);};}exports['index']=function(_0xc12490,_0x10aaa4){var _0x5ebd0d={},_0xaa2ff3={},_0x323d81={'count':0x0,'rows':[]};var _0x283b91=_[_0x3bc2('0x26')](db[_0x3bc2('0x27')][_0x3bc2('0x28')],function(_0x3d7f3c){return{'name':_0x3d7f3c[_0x3bc2('0x29')],'type':_0x3d7f3c[_0x3bc2('0x2a')]['key']};});_0xaa2ff3[_0x3bc2('0x2b')]=_[_0x3bc2('0x26')](_0x283b91,_0x3bc2('0x2c'));_0xaa2ff3[_0x3bc2('0x2d')]=_[_0x3bc2('0x2e')](_0xc12490[_0x3bc2('0x2d')]);_0xaa2ff3[_0x3bc2('0x2f')]=_['intersection'](_0xaa2ff3[_0x3bc2('0x2b')],_0xaa2ff3['query']);_0x5ebd0d[_0x3bc2('0x30')]=_[_0x3bc2('0x31')](_0xaa2ff3['model'],qs[_0x3bc2('0x32')](_0xc12490[_0x3bc2('0x2d')]['fields']));_0x5ebd0d['attributes']=_0x5ebd0d[_0x3bc2('0x30')][_0x3bc2('0x33')]?_0x5ebd0d[_0x3bc2('0x30')]:_0xaa2ff3['model'];if(!_0xc12490[_0x3bc2('0x2d')][_0x3bc2('0x34')](_0x3bc2('0x35'))){_0x5ebd0d['limit']=qs[_0x3bc2('0x18')](_0xc12490[_0x3bc2('0x2d')][_0x3bc2('0x18')]);_0x5ebd0d[_0x3bc2('0x17')]=qs[_0x3bc2('0x17')](_0xc12490[_0x3bc2('0x2d')][_0x3bc2('0x17')]);}_0x5ebd0d[_0x3bc2('0x36')]=qs[_0x3bc2('0x37')](_0xc12490[_0x3bc2('0x2d')][_0x3bc2('0x37')]);_0x5ebd0d[_0x3bc2('0x38')]=qs[_0x3bc2('0x2f')](_[_0x3bc2('0x39')](_0xc12490[_0x3bc2('0x2d')],_0xaa2ff3[_0x3bc2('0x2f')]),_0x283b91);if(_0xc12490['query']['filter']){_0x5ebd0d[_0x3bc2('0x38')]=_[_0x3bc2('0x3a')](_0x5ebd0d[_0x3bc2('0x38')],{'$or':_[_0x3bc2('0x26')](_0x283b91,function(_0x23bc98){if(_0x23bc98[_0x3bc2('0x2a')]!==_0x3bc2('0x3b')){var _0x3c9e9e={};_0x3c9e9e[_0x23bc98[_0x3bc2('0x2c')]]={'$like':'%'+_0xc12490['query'][_0x3bc2('0x3c')]+'%'};return _0x3c9e9e;}})});}_0x5ebd0d=_['merge']({},_0x5ebd0d,_0xc12490[_0x3bc2('0x3d')]);var _0x6e5a6={'where':_0x5ebd0d[_0x3bc2('0x38')]};return db[_0x3bc2('0x27')][_0x3bc2('0x1a')](_0x6e5a6)[_0x3bc2('0x1d')](function(_0xab2142){_0x323d81['count']=_0xab2142;if(_0xc12490[_0x3bc2('0x2d')][_0x3bc2('0x3e')]){_0x5ebd0d[_0x3bc2('0x3f')]=[{'all':!![]}];}return db[_0x3bc2('0x27')]['findAll'](_0x5ebd0d);})[_0x3bc2('0x1d')](function(_0x331501){_0x323d81[_0x3bc2('0x40')]=_0x331501;return _0x323d81;})[_0x3bc2('0x1d')](respondWithFilteredResult(_0x10aaa4,_0x5ebd0d))['catch'](handleError(_0x10aaa4,null));};exports[_0x3bc2('0x41')]=function(_0x11ae06,_0xd1398f){var _0x109e8c={'raw':![],'where':{'id':_0x11ae06[_0x3bc2('0x42')]['id']}},_0x2d3f54={};_0x2d3f54['model']=_[_0x3bc2('0x2e')](db['JscriptyProject'][_0x3bc2('0x28')]);_0x2d3f54[_0x3bc2('0x2d')]=_[_0x3bc2('0x2e')](_0x11ae06[_0x3bc2('0x2d')]);_0x2d3f54[_0x3bc2('0x2f')]=_['intersection'](_0x2d3f54['model'],_0x2d3f54['query']);_0x109e8c[_0x3bc2('0x30')]=_[_0x3bc2('0x31')](_0x2d3f54[_0x3bc2('0x2b')],qs[_0x3bc2('0x32')](_0x11ae06[_0x3bc2('0x2d')]['fields']));_0x109e8c[_0x3bc2('0x30')]=_0x109e8c[_0x3bc2('0x30')][_0x3bc2('0x33')]?_0x109e8c[_0x3bc2('0x30')]:_0x2d3f54[_0x3bc2('0x2b')];if(_0x11ae06[_0x3bc2('0x2d')][_0x3bc2('0x3e')]){_0x109e8c['include']=[{'all':!![]}];}_0x109e8c=_['merge']({},_0x109e8c,_0x11ae06[_0x3bc2('0x3d')]);return db[_0x3bc2('0x27')][_0x3bc2('0x43')](_0x109e8c)['then'](handleEntityNotFound(_0xd1398f,null))[_0x3bc2('0x1d')](respondWithResult(_0xd1398f,null))[_0x3bc2('0x44')](handleError(_0xd1398f,null));};exports[_0x3bc2('0x45')]=function(_0x422ca0,_0x26b68b){return db[_0x3bc2('0x27')][_0x3bc2('0x45')](_0x422ca0[_0x3bc2('0x46')],{})[_0x3bc2('0x1d')](function(_0x530037){var _0x372f5d=_0x422ca0[_0x3bc2('0x47')][_0x3bc2('0x1e')]({'plain':!![]});if(!_0x372f5d)throw new Error(_0x3bc2('0x48'));if(_0x372f5d[_0x3bc2('0x49')]===_0x3bc2('0x47')){var _0x513ac6=_0x530037[_0x3bc2('0x1e')]({'plain':!![]});var _0x39dc3f=_0x3bc2('0x1f');return db[_0x3bc2('0x4a')][_0x3bc2('0x43')]({'where':{'name':_0x39dc3f,'userProfileId':_0x372f5d[_0x3bc2('0x4b')]},'raw':!![]})['then'](function(_0x21d4df){if(_0x21d4df&&_0x21d4df['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x513ac6[_0x3bc2('0x2c')],'resourceId':_0x513ac6['id'],'type':_0x21d4df['name'],'sectionId':_0x21d4df['id']},{})[_0x3bc2('0x1d')](function(){return _0x530037;});}else{return _0x530037;}})['catch'](function(_0x1c99a9){logger[_0x3bc2('0x23')](_0x3bc2('0x4c'),_0x1c99a9);throw _0x1c99a9;});}return _0x530037;})['then'](respondWithResult(_0x26b68b,0xc9))[_0x3bc2('0x44')](handleError(_0x26b68b,null));};exports['clone']=function(_0x3db688,_0x4da621){var _0x562932={'where':{'id':_0x3db688[_0x3bc2('0x42')]['id']}},_0x3da87b={};_0x3da87b[_0x3bc2('0x2b')]=_[_0x3bc2('0x2e')](db[_0x3bc2('0x27')][_0x3bc2('0x28')]);_0x562932[_0x3bc2('0x30')]=_[_0x3bc2('0x31')](_0x3da87b[_0x3bc2('0x2b')],qs['fields'](_0x3db688[_0x3bc2('0x2d')][_0x3bc2('0x32')]));_0x562932[_0x3bc2('0x30')]=_0x562932['attributes'][_0x3bc2('0x33')]?_0x562932[_0x3bc2('0x30')]:_0x3da87b[_0x3bc2('0x2b')];if(_0x3db688[_0x3bc2('0x2d')]['includeAll']){_0x562932[_0x3bc2('0x3f')]=[{'all':!![]}];}_0x562932=_[_0x3bc2('0x3a')]({},_0x562932,_0x3db688[_0x3bc2('0x3d')]);return db[_0x3bc2('0x27')][_0x3bc2('0x43')](_0x562932)[_0x3bc2('0x1d')](handleEntityNotFound(_0x4da621,null))[_0x3bc2('0x1d')](function(_0x2ef720){if(_0x2ef720){var _0x274ddb=_0x2ef720[_0x3bc2('0x1e')]({'plain':!![]});_0x274ddb=qs['omit'](_0x274ddb,['id',_0x3bc2('0x4d'),_0x3bc2('0x4e')]);_0x3db688[_0x3bc2('0x46')]=_['omit'](_0x3db688[_0x3bc2('0x46')],['id',_0x3bc2('0x4d'),_0x3bc2('0x4e')]);return db[_0x3bc2('0x27')][_0x3bc2('0x45')](_[_0x3bc2('0x3a')](_0x274ddb,_0x3db688['body']),{'include':_0x3db688['query'][_0x3bc2('0x3e')]?[{'all':!![]}]:undefined})['then'](function(_0x57996e){var _0x5350af=_0x3db688[_0x3bc2('0x47')][_0x3bc2('0x1e')]({'plain':!![]});if(!_0x5350af)throw new Error(_0x3bc2('0x48'));if(_0x5350af['role']===_0x3bc2('0x47')){var _0x3f71ba=_0x57996e['get']({'plain':!![]});var _0x5b6cf2=_0x3bc2('0x1f');return db['UserProfileSection'][_0x3bc2('0x43')]({'where':{'name':_0x5b6cf2,'userProfileId':_0x5350af[_0x3bc2('0x4b')]},'raw':!![]})[_0x3bc2('0x1d')](function(_0x2c4509){if(_0x2c4509&&_0x2c4509[_0x3bc2('0x4f')]===0x0){return db['UserProfileResource'][_0x3bc2('0x45')]({'name':_0x3f71ba[_0x3bc2('0x2c')],'resourceId':_0x3f71ba['id'],'type':_0x2c4509[_0x3bc2('0x2c')],'sectionId':_0x2c4509['id']},{})[_0x3bc2('0x1d')](function(){return _0x57996e;});}else{return _0x57996e;}})[_0x3bc2('0x44')](function(_0x226a99){logger['error'](_0x3bc2('0x4c'),_0x226a99);throw _0x226a99;});}return _0x57996e;});}})['then'](respondWithResult(_0x4da621,0xc9))[_0x3bc2('0x44')](handleError(_0x4da621,null));};exports[_0x3bc2('0x50')]=function(_0x597b69,_0x2ff71d){if(_0x597b69[_0x3bc2('0x46')]['id']){delete _0x597b69[_0x3bc2('0x46')]['id'];}return db[_0x3bc2('0x27')][_0x3bc2('0x43')]({'where':{'id':_0x597b69[_0x3bc2('0x42')]['id']}})[_0x3bc2('0x1d')](handleEntityNotFound(_0x2ff71d,null))[_0x3bc2('0x1d')](saveUpdates(_0x597b69[_0x3bc2('0x46')],null))[_0x3bc2('0x1d')](respondWithResult(_0x2ff71d,null))[_0x3bc2('0x44')](handleError(_0x2ff71d,null));};exports['destroy']=function(_0x82411f,_0x52f524){return db[_0x3bc2('0x27')][_0x3bc2('0x43')]({'where':{'id':_0x82411f[_0x3bc2('0x42')]['id']}})[_0x3bc2('0x1d')](handleEntityNotFound(_0x52f524,null))[_0x3bc2('0x1d')](removeEntity(_0x52f524,null))[_0x3bc2('0x44')](handleError(_0x52f524,null));};exports[_0x3bc2('0x51')]=function(_0x4e6501,_0x28aab8,_0x515ced){var _0x5e319c={'raw':!![],'where':{}};var _0x5cb5eb={};var _0x528a2e={'count':0x0,'rows':[]};return db[_0x3bc2('0x27')][_0x3bc2('0x52')]({'where':{'id':_0x4e6501['params']['id']}})[_0x3bc2('0x1d')](handleEntityNotFound(_0x28aab8,null))[_0x3bc2('0x1d')](function(_0x57e635){if(_0x57e635){_0x5cb5eb[_0x3bc2('0x2b')]=_[_0x3bc2('0x2e')](db['JscriptySessionReport']['rawAttributes']);_0x5cb5eb[_0x3bc2('0x2d')]=_[_0x3bc2('0x2e')](_0x4e6501[_0x3bc2('0x2d')]);_0x5cb5eb['filters']=_[_0x3bc2('0x31')](_0x5cb5eb[_0x3bc2('0x2b')],_0x5cb5eb[_0x3bc2('0x2d')]);_0x5e319c[_0x3bc2('0x30')]=_[_0x3bc2('0x31')](_0x5cb5eb['model'],qs[_0x3bc2('0x32')](_0x4e6501[_0x3bc2('0x2d')][_0x3bc2('0x32')]));_0x5e319c['attributes']=_0x5e319c[_0x3bc2('0x30')]['length']?_0x5e319c['attributes']:_0x5cb5eb[_0x3bc2('0x2b')];if(!_0x4e6501[_0x3bc2('0x2d')][_0x3bc2('0x34')](_0x3bc2('0x35'))){_0x5e319c[_0x3bc2('0x18')]=qs[_0x3bc2('0x18')](_0x4e6501[_0x3bc2('0x2d')][_0x3bc2('0x18')]);_0x5e319c[_0x3bc2('0x17')]=qs['offset'](_0x4e6501[_0x3bc2('0x2d')][_0x3bc2('0x17')]);}_0x5e319c[_0x3bc2('0x36')]=qs[_0x3bc2('0x37')](_0x4e6501[_0x3bc2('0x2d')][_0x3bc2('0x37')]);_0x5e319c[_0x3bc2('0x38')]=qs[_0x3bc2('0x2f')](_[_0x3bc2('0x39')](_0x4e6501[_0x3bc2('0x2d')],_0x5cb5eb[_0x3bc2('0x2f')]));_0x5e319c[_0x3bc2('0x38')][_0x3bc2('0x53')]=_0x57e635['id'];if(_0x4e6501['query'][_0x3bc2('0x3c')]){_0x5e319c[_0x3bc2('0x38')]=_[_0x3bc2('0x3a')](_0x5e319c[_0x3bc2('0x38')],{'$or':_[_0x3bc2('0x26')](_0x5e319c[_0x3bc2('0x30')],function(_0x182ad8){var _0x3e935c={};_0x3e935c[_0x182ad8]={'$like':'%'+_0x4e6501['query'][_0x3bc2('0x3c')]+'%'};return _0x3e935c;})});}_0x5e319c=_[_0x3bc2('0x3a')]({},_0x5e319c,_0x4e6501[_0x3bc2('0x3d')]);return db[_0x3bc2('0x54')][_0x3bc2('0x1a')]({'where':_0x5e319c[_0x3bc2('0x38')]})[_0x3bc2('0x1d')](function(_0x374a39){_0x528a2e['count']=_0x374a39;if(_0x4e6501[_0x3bc2('0x2d')][_0x3bc2('0x3e')]){_0x5e319c[_0x3bc2('0x3f')]=[{'all':!![]}];}return db[_0x3bc2('0x54')][_0x3bc2('0x55')](_0x5e319c);})[_0x3bc2('0x1d')](function(_0x3e7eb0){_0x528a2e[_0x3bc2('0x40')]=_0x3e7eb0;return _0x528a2e;});}})[_0x3bc2('0x1d')](respondWithFilteredResult(_0x28aab8,_0x5e319c))[_0x3bc2('0x44')](handleError(_0x28aab8,null));};exports[_0x3bc2('0x56')]=function(_0x55dbb3,_0x57c68f,_0x312db8){var _0xd8907e={'raw':!![],'where':{}};var _0x58d54b={};var _0x19c273={'count':0x0,'rows':[]};return db[_0x3bc2('0x27')][_0x3bc2('0x52')]({'where':{'id':_0x55dbb3[_0x3bc2('0x42')]['id']}})[_0x3bc2('0x1d')](handleEntityNotFound(_0x57c68f,null))[_0x3bc2('0x1d')](function(_0x2b6ec7){if(_0x2b6ec7){_0x58d54b[_0x3bc2('0x2b')]=_[_0x3bc2('0x2e')](db[_0x3bc2('0x57')][_0x3bc2('0x28')]);_0x58d54b[_0x3bc2('0x2d')]=_[_0x3bc2('0x2e')](_0x55dbb3[_0x3bc2('0x2d')]);_0x58d54b[_0x3bc2('0x2f')]=_['intersection'](_0x58d54b[_0x3bc2('0x2b')],_0x58d54b[_0x3bc2('0x2d')]);_0xd8907e[_0x3bc2('0x30')]=_['intersection'](_0x58d54b['model'],qs['fields'](_0x55dbb3[_0x3bc2('0x2d')][_0x3bc2('0x32')]));_0xd8907e[_0x3bc2('0x30')]=_0xd8907e[_0x3bc2('0x30')][_0x3bc2('0x33')]?_0xd8907e[_0x3bc2('0x30')]:_0x58d54b[_0x3bc2('0x2b')];if(!_0x55dbb3['query'][_0x3bc2('0x34')]('nolimit')){_0xd8907e[_0x3bc2('0x18')]=qs['limit'](_0x55dbb3['query']['limit']);_0xd8907e[_0x3bc2('0x17')]=qs[_0x3bc2('0x17')](_0x55dbb3['query']['offset']);}_0xd8907e[_0x3bc2('0x36')]=qs[_0x3bc2('0x37')](_0x55dbb3['query'][_0x3bc2('0x37')]);_0xd8907e['where']=qs['filters'](_[_0x3bc2('0x39')](_0x55dbb3[_0x3bc2('0x2d')],_0x58d54b['filters']));_0xd8907e[_0x3bc2('0x38')][_0x3bc2('0x53')]=_0x2b6ec7['id'];if(_0x55dbb3['query'][_0x3bc2('0x3c')]){_0xd8907e[_0x3bc2('0x38')]=_['merge'](_0xd8907e['where'],{'$or':_[_0x3bc2('0x26')](_0xd8907e['attributes'],function(_0x21fdc1){var _0x1d8ed3={};_0x1d8ed3[_0x21fdc1]={'$like':'%'+_0x55dbb3['query'][_0x3bc2('0x3c')]+'%'};return _0x1d8ed3;})});}_0xd8907e=_['merge']({},_0xd8907e,_0x55dbb3[_0x3bc2('0x3d')]);return db[_0x3bc2('0x57')][_0x3bc2('0x1a')]({'where':_0xd8907e[_0x3bc2('0x38')]})[_0x3bc2('0x1d')](function(_0x44d5b4){_0x19c273['count']=_0x44d5b4;if(_0x55dbb3[_0x3bc2('0x2d')]['includeAll']){_0xd8907e['include']=[{'all':!![]}];}return db[_0x3bc2('0x57')][_0x3bc2('0x55')](_0xd8907e);})[_0x3bc2('0x1d')](function(_0x20e156){_0x19c273[_0x3bc2('0x40')]=_0x20e156;return _0x19c273;});}})['then'](respondWithFilteredResult(_0x57c68f,_0xd8907e))['catch'](handleError(_0x57c68f,null));};function char(_0x1c4fb0){return'number'===typeof _0x1c4fb0?String[_0x3bc2('0x58')][_0x3bc2('0x59')](null,arguments):_0x1c4fb0;}function needsEncapsulation(_0x4a44be){return!!_0x4a44be&&(_0x4a44be[_0x3bc2('0x5a')]()[_0x3bc2('0x5b')](char(0xd))>=0x0||_0x4a44be['toString']()[_0x3bc2('0x5b')](char(0xa))>=0x0||_0x4a44be['toString']()[_0x3bc2('0x5b')](char(0x2c))>=0x0||_0x4a44be[_0x3bc2('0x5a')]()['indexOf'](char(0x22))>=0x0);}function encapsulate(_0x28b9fc){var _0xf9d09f=char(0x22),_0x4137c7='\x5c'+char(0x22),_0x411cfa=_0x28b9fc[_0x3bc2('0x5a')]()[_0x3bc2('0x5c')](new RegExp(_0xf9d09f,'g'),_0x4137c7);return _0xf9d09f+_0x411cfa+_0xf9d09f;}exports['getSummary']=function(_0x300dd7,_0x491a93,_0x3e6575){var _0x90a9a0,_0x1ad305;var _0x1d1aed={'where':{'ProjectId':_0x300dd7[_0x3bc2('0x42')]['id']}};if(_0x300dd7[_0x3bc2('0x2d')][_0x3bc2('0x5d')]){_0x1d1aed[_0x3bc2('0x38')][_0x3bc2('0x5e')]=JSON[_0x3bc2('0x5f')](_0x300dd7[_0x3bc2('0x2d')]['startTime']);}return db[_0x3bc2('0x54')][_0x3bc2('0x55')](_0x1d1aed)[_0x3bc2('0x1d')](handleEntityNotFound(_0x491a93,null))[_0x3bc2('0x1d')](function(_0x4eab13){if(_0x4eab13){_0x90a9a0=_0x4eab13;return db[_0x3bc2('0x60')]['findAll']({'where':{'SessionId':{'$in':_[_0x3bc2('0x26')](_0x90a9a0,'id')},'ProjectId':_0x300dd7['params']['id']},'order':'-createdAt'});}})[_0x3bc2('0x1d')](handleEntityNotFound(_0x491a93,null))[_0x3bc2('0x1d')](function(_0x118c9d){if(_0x118c9d){_0x1ad305=_0x118c9d;var _0x2f7538={};for(var _0x40a31a=0x0,_0x449f04=_0x1ad305['length'];_0x40a31a<_0x449f04;_0x40a31a++){if(!_0x2f7538[_0x3bc2('0x34')](_0x1ad305[_0x40a31a]['questionId'])){_0x2f7538[_0x1ad305[_0x40a31a][_0x3bc2('0x61')]]=needsEncapsulation(_0x1ad305[_0x40a31a][_0x3bc2('0x62')])?encapsulate(_0x1ad305[_0x40a31a][_0x3bc2('0x62')]):_0x1ad305[_0x40a31a]['question'];}}var _0x17e37e=[],_0x4b0040={};for(var _0x6357f1=0x0,_0x5d31c2=_0x90a9a0[_0x3bc2('0x33')];_0x6357f1<_0x5d31c2;_0x6357f1++){_0x4b0040={'ProjectId':_0x300dd7[_0x3bc2('0x42')]['id'],'SessionId':_0x90a9a0[_0x6357f1]['id'],'StartTime':moment(_0x90a9a0[_0x6357f1][_0x3bc2('0x5e')])[_0x3bc2('0x63')]('YYYY-MM-DD\x20HH:mm:ss')};for(var _0x4157f2=0x0,_0x4ab670=_0x1ad305[_0x3bc2('0x33')];_0x4157f2<_0x4ab670;_0x4157f2++){if(_0x1ad305[_0x4157f2][_0x3bc2('0x64')]==_0x90a9a0[_0x6357f1]['id']&&_0x2f7538[_0x3bc2('0x34')](_0x1ad305[_0x4157f2]['questionId'])){_0x4b0040[_0x2f7538[_0x1ad305[_0x4157f2][_0x3bc2('0x61')]]]=_0x1ad305[_0x4157f2]['answer'];}}for(var _0x22b469 in _0x2f7538){if(!_0x4b0040[_0x3bc2('0x34')](_0x2f7538[_0x22b469])){_0x4b0040[_0x2f7538[_0x22b469]]=null;}}_0x17e37e[_0x3bc2('0x65')](_0x4b0040);}return _0x17e37e;}})[_0x3bc2('0x1d')](function(_0xd49664){if(!_[_0x3bc2('0x66')](_0xd49664)){var _0x3ba454=toCsv(_0xd49664);var _0x1cc7df=Date[_0x3bc2('0x67')]();fs[_0x3bc2('0x68')](util[_0x3bc2('0x63')](_0x3bc2('0x69'),_0x300dd7[_0x3bc2('0x42')]['id'],_0x1cc7df),_0x3ba454);_0x491a93[_0x3bc2('0x6a')](_0x3bc2('0x6b'),'attachment;\x20filename='+util[_0x3bc2('0x63')]('Jscripty_Project_%d_Summary_%s.csv',_0x300dd7[_0x3bc2('0x42')]['id'],_0x1cc7df));_0x491a93[_0x3bc2('0x6a')](_0x3bc2('0x6c'),_0x3bc2('0x6d'));return _0x491a93[_0x3bc2('0x6e')](util[_0x3bc2('0x63')](_0x3bc2('0x69'),_0x300dd7[_0x3bc2('0x42')]['id'],_0x1cc7df));}else{return _0x491a93[_0x3bc2('0x22')](0xcc);}})[_0x3bc2('0x44')](handleError(_0x491a93,null));}; \ No newline at end of file +var _0x2d58=['ProjectId','number','fromCharCode','toString','indexOf','getSummary','startTime','starttime','JscriptyQuestionReport','-createdAt','questionId','question','format','YYYY-MM-DD\x20HH:mm:ss','SessionId','answer','isEmpty','now','writeFileSync','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','Jscripty_Project_%d_Summary_%s.csv','Content-type','text/csv','download','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','error','name','index','JscriptyProject','rawAttributes','type','key','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','rows','catch','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','Projects','UserProfileSection','userProfileId','clone','omit','createdAt','role','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getSessions','findOne','JscriptySessionReport','findAll','getAnswers','JscriptyAnswerReport'];(function(_0xb8cfbe,_0x2e81b6){var _0x227d51=function(_0x5cb1ff){while(--_0x5cb1ff){_0xb8cfbe['push'](_0xb8cfbe['shift']());}};_0x227d51(++_0x2e81b6);}(_0x2d58,0x186));var _0x82d5=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x2d58[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0x82d5('0x0'));var rimraf=require(_0x82d5('0x1'));var zipdir=require(_0x82d5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x82d5('0x3'));var moment=require('moment');var BPromise=require(_0x82d5('0x4'));var Mustache=require(_0x82d5('0x5'));var util=require(_0x82d5('0x6'));var path=require(_0x82d5('0x7'));var sox=require(_0x82d5('0x8'));var csv=require(_0x82d5('0x9'));var ejs=require(_0x82d5('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x82d5('0xb'));var squel=require(_0x82d5('0xc'));var crypto=require(_0x82d5('0xd'));var jsforce=require(_0x82d5('0xe'));var deskjs=require(_0x82d5('0xf'));var toCsv=require(_0x82d5('0x9'));var querystring=require(_0x82d5('0x10'));var Papa=require(_0x82d5('0x11'));var Redis=require(_0x82d5('0x12'));var authService=require(_0x82d5('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x82d5('0x14'));var hardwareService=require(_0x82d5('0x15'));var logger=require(_0x82d5('0x16'))(_0x82d5('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x82d5('0x18'));var db=require(_0x82d5('0x19'))['db'];function respondWithStatusCode(_0x549d85,_0x14ccdc){_0x14ccdc=_0x14ccdc||0xcc;return function(_0x5c2d84){if(_0x5c2d84){return _0x549d85[_0x82d5('0x1a')](_0x14ccdc);}return _0x549d85[_0x82d5('0x1b')](_0x14ccdc)[_0x82d5('0x1c')]();};}function respondWithResult(_0x265753,_0x201e56){_0x201e56=_0x201e56||0xc8;return function(_0x3f26ff){if(_0x3f26ff){return _0x265753[_0x82d5('0x1b')](_0x201e56)[_0x82d5('0x1d')](_0x3f26ff);}};}function respondWithFilteredResult(_0x4a18f0,_0x128c42){return function(_0x26caa1){if(_0x26caa1){var _0x5b0b6e=typeof _0x128c42[_0x82d5('0x1e')]===_0x82d5('0x1f')&&typeof _0x128c42[_0x82d5('0x20')]===_0x82d5('0x1f');var _0x2e6c2c=_0x26caa1['count'];var _0xe1ce36=_0x5b0b6e?0x0:_0x128c42[_0x82d5('0x1e')];var _0x13c6ed=_0x5b0b6e?_0x26caa1[_0x82d5('0x21')]:_0x128c42[_0x82d5('0x1e')]+_0x128c42[_0x82d5('0x20')];var _0x3505b8;if(_0x13c6ed>=_0x2e6c2c){_0x13c6ed=_0x2e6c2c;_0x3505b8=0xc8;}else{_0x3505b8=0xce;}_0x4a18f0['status'](_0x3505b8);return _0x4a18f0['set'](_0x82d5('0x22'),_0xe1ce36+'-'+_0x13c6ed+'/'+_0x2e6c2c)[_0x82d5('0x1d')](_0x26caa1);}return null;};}function patchUpdates(_0x45d203){return function(_0x4712db){try{jsonpatch[_0x82d5('0x23')](_0x4712db,_0x45d203,!![]);}catch(_0x27a2a4){return BPromise[_0x82d5('0x24')](_0x27a2a4);}return _0x4712db[_0x82d5('0x25')]();};}function saveUpdates(_0x579711,_0x423fe1){return function(_0x2d22ab){if(_0x2d22ab){return _0x2d22ab[_0x82d5('0x26')](_0x579711)[_0x82d5('0x27')](function(_0x54964c){return _0x54964c;});}return null;};}function removeEntity(_0x942fc,_0x59605b){return function(_0x47736d){if(_0x47736d){return _0x47736d[_0x82d5('0x28')]()[_0x82d5('0x27')](function(){var _0x1ec65d=_0x47736d[_0x82d5('0x29')]({'plain':!![]});var _0x41fb26='Projects';return db[_0x82d5('0x2a')]['destroy']({'where':{'type':_0x41fb26,'resourceId':_0x1ec65d['id']}})['then'](function(){return _0x47736d;});})[_0x82d5('0x27')](function(){_0x942fc['status'](0xcc)[_0x82d5('0x1c')]();});}};}function handleEntityNotFound(_0x22c156,_0x18eb16){return function(_0x5854be){if(!_0x5854be){_0x22c156[_0x82d5('0x1a')](0x194);}return _0x5854be;};}function handleError(_0x8f4ba7,_0x10e54d){_0x10e54d=_0x10e54d||0x1f4;return function(_0x4d6054){logger[_0x82d5('0x2b')](_0x4d6054['stack']);if(_0x4d6054[_0x82d5('0x2c')]){delete _0x4d6054[_0x82d5('0x2c')];}_0x8f4ba7[_0x82d5('0x1b')](_0x10e54d)['send'](_0x4d6054);};}exports[_0x82d5('0x2d')]=function(_0x5cf853,_0x199a63){var _0x375c26={},_0x181fd3={},_0x735e28={'count':0x0,'rows':[]};var _0x6ca339=_['map'](db[_0x82d5('0x2e')][_0x82d5('0x2f')],function(_0x34c5ff){return{'name':_0x34c5ff['fieldName'],'type':_0x34c5ff[_0x82d5('0x30')][_0x82d5('0x31')]};});_0x181fd3['model']=_[_0x82d5('0x32')](_0x6ca339,_0x82d5('0x2c'));_0x181fd3[_0x82d5('0x33')]=_[_0x82d5('0x34')](_0x5cf853['query']);_0x181fd3[_0x82d5('0x35')]=_[_0x82d5('0x36')](_0x181fd3[_0x82d5('0x37')],_0x181fd3[_0x82d5('0x33')]);_0x375c26[_0x82d5('0x38')]=_[_0x82d5('0x36')](_0x181fd3[_0x82d5('0x37')],qs[_0x82d5('0x39')](_0x5cf853['query']['fields']));_0x375c26[_0x82d5('0x38')]=_0x375c26[_0x82d5('0x38')][_0x82d5('0x3a')]?_0x375c26[_0x82d5('0x38')]:_0x181fd3[_0x82d5('0x37')];if(!_0x5cf853[_0x82d5('0x33')][_0x82d5('0x3b')](_0x82d5('0x3c'))){_0x375c26[_0x82d5('0x20')]=qs[_0x82d5('0x20')](_0x5cf853[_0x82d5('0x33')][_0x82d5('0x20')]);_0x375c26[_0x82d5('0x1e')]=qs[_0x82d5('0x1e')](_0x5cf853['query'][_0x82d5('0x1e')]);}_0x375c26[_0x82d5('0x3d')]=qs[_0x82d5('0x3e')](_0x5cf853[_0x82d5('0x33')][_0x82d5('0x3e')]);_0x375c26['where']=qs[_0x82d5('0x35')](_[_0x82d5('0x3f')](_0x5cf853[_0x82d5('0x33')],_0x181fd3['filters']),_0x6ca339);if(_0x5cf853[_0x82d5('0x33')][_0x82d5('0x40')]){_0x375c26[_0x82d5('0x41')]=_[_0x82d5('0x42')](_0x375c26[_0x82d5('0x41')],{'$or':_[_0x82d5('0x32')](_0x6ca339,function(_0x4c9d63){if(_0x4c9d63['type']!==_0x82d5('0x43')){var _0x52d84c={};_0x52d84c[_0x4c9d63[_0x82d5('0x2c')]]={'$like':'%'+_0x5cf853[_0x82d5('0x33')]['filter']+'%'};return _0x52d84c;}})});}_0x375c26=_[_0x82d5('0x42')]({},_0x375c26,_0x5cf853[_0x82d5('0x44')]);var _0x547e12={'where':_0x375c26[_0x82d5('0x41')]};return db[_0x82d5('0x2e')][_0x82d5('0x21')](_0x547e12)[_0x82d5('0x27')](function(_0x5e12d8){_0x735e28['count']=_0x5e12d8;if(_0x5cf853['query'][_0x82d5('0x45')]){_0x375c26[_0x82d5('0x46')]=[{'all':!![]}];}return db['JscriptyProject']['findAll'](_0x375c26);})['then'](function(_0x17113a){_0x735e28[_0x82d5('0x47')]=_0x17113a;return _0x735e28;})[_0x82d5('0x27')](respondWithFilteredResult(_0x199a63,_0x375c26))[_0x82d5('0x48')](handleError(_0x199a63,null));};exports['show']=function(_0x5c2dc4,_0x28d151){var _0x5b7eeb={'raw':![],'where':{'id':_0x5c2dc4[_0x82d5('0x49')]['id']}},_0x3628a6={};_0x3628a6[_0x82d5('0x37')]=_['keys'](db[_0x82d5('0x2e')][_0x82d5('0x2f')]);_0x3628a6[_0x82d5('0x33')]=_[_0x82d5('0x34')](_0x5c2dc4[_0x82d5('0x33')]);_0x3628a6[_0x82d5('0x35')]=_[_0x82d5('0x36')](_0x3628a6['model'],_0x3628a6[_0x82d5('0x33')]);_0x5b7eeb['attributes']=_[_0x82d5('0x36')](_0x3628a6[_0x82d5('0x37')],qs['fields'](_0x5c2dc4[_0x82d5('0x33')][_0x82d5('0x39')]));_0x5b7eeb[_0x82d5('0x38')]=_0x5b7eeb[_0x82d5('0x38')][_0x82d5('0x3a')]?_0x5b7eeb[_0x82d5('0x38')]:_0x3628a6[_0x82d5('0x37')];if(_0x5c2dc4['query']['includeAll']){_0x5b7eeb['include']=[{'all':!![]}];}_0x5b7eeb=_[_0x82d5('0x42')]({},_0x5b7eeb,_0x5c2dc4[_0x82d5('0x44')]);return db['JscriptyProject'][_0x82d5('0x4a')](_0x5b7eeb)[_0x82d5('0x27')](handleEntityNotFound(_0x28d151,null))['then'](respondWithResult(_0x28d151,null))['catch'](handleError(_0x28d151,null));};exports[_0x82d5('0x4b')]=function(_0xa890f,_0x4db992){return db[_0x82d5('0x2e')][_0x82d5('0x4b')](_0xa890f[_0x82d5('0x4c')],{})[_0x82d5('0x27')](function(_0x36316b){var _0x53c9a9=_0xa890f[_0x82d5('0x4d')][_0x82d5('0x29')]({'plain':!![]});if(!_0x53c9a9)throw new Error(_0x82d5('0x4e'));if(_0x53c9a9['role']===_0x82d5('0x4d')){var _0x3cea07=_0x36316b['get']({'plain':!![]});var _0x472e65=_0x82d5('0x4f');return db[_0x82d5('0x50')][_0x82d5('0x4a')]({'where':{'name':_0x472e65,'userProfileId':_0x53c9a9[_0x82d5('0x51')]},'raw':!![]})[_0x82d5('0x27')](function(_0x35a50b){if(_0x35a50b&&_0x35a50b['autoAssociation']===0x0){return db[_0x82d5('0x2a')]['create']({'name':_0x3cea07['name'],'resourceId':_0x3cea07['id'],'type':_0x35a50b[_0x82d5('0x2c')],'sectionId':_0x35a50b['id']},{})[_0x82d5('0x27')](function(){return _0x36316b;});}else{return _0x36316b;}})[_0x82d5('0x48')](function(_0x51299f){logger[_0x82d5('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x51299f);throw _0x51299f;});}return _0x36316b;})[_0x82d5('0x27')](respondWithResult(_0x4db992,0xc9))[_0x82d5('0x48')](handleError(_0x4db992,null));};exports[_0x82d5('0x52')]=function(_0x3318bd,_0x598013){var _0x98e76f={'where':{'id':_0x3318bd[_0x82d5('0x49')]['id']}},_0x521855={};_0x521855[_0x82d5('0x37')]=_[_0x82d5('0x34')](db['JscriptyProject'][_0x82d5('0x2f')]);_0x98e76f[_0x82d5('0x38')]=_[_0x82d5('0x36')](_0x521855['model'],qs['fields'](_0x3318bd['query'][_0x82d5('0x39')]));_0x98e76f[_0x82d5('0x38')]=_0x98e76f[_0x82d5('0x38')][_0x82d5('0x3a')]?_0x98e76f[_0x82d5('0x38')]:_0x521855[_0x82d5('0x37')];if(_0x3318bd[_0x82d5('0x33')][_0x82d5('0x45')]){_0x98e76f['include']=[{'all':!![]}];}_0x98e76f=_[_0x82d5('0x42')]({},_0x98e76f,_0x3318bd[_0x82d5('0x44')]);return db[_0x82d5('0x2e')][_0x82d5('0x4a')](_0x98e76f)[_0x82d5('0x27')](handleEntityNotFound(_0x598013,null))[_0x82d5('0x27')](function(_0x15af57){if(_0x15af57){var _0x3ed2c1=_0x15af57[_0x82d5('0x29')]({'plain':!![]});_0x3ed2c1=qs[_0x82d5('0x53')](_0x3ed2c1,['id',_0x82d5('0x54'),'updatedAt']);_0x3318bd[_0x82d5('0x4c')]=_[_0x82d5('0x53')](_0x3318bd[_0x82d5('0x4c')],['id',_0x82d5('0x54'),'updatedAt']);return db[_0x82d5('0x2e')]['create'](_['merge'](_0x3ed2c1,_0x3318bd['body']),{'include':_0x3318bd[_0x82d5('0x33')][_0x82d5('0x45')]?[{'all':!![]}]:undefined})[_0x82d5('0x27')](function(_0x5daddf){var _0x2fb594=_0x3318bd['user'][_0x82d5('0x29')]({'plain':!![]});if(!_0x2fb594)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2fb594[_0x82d5('0x55')]===_0x82d5('0x4d')){var _0x3f65d1=_0x5daddf['get']({'plain':!![]});var _0x507d23=_0x82d5('0x4f');return db[_0x82d5('0x50')]['find']({'where':{'name':_0x507d23,'userProfileId':_0x2fb594['userProfileId']},'raw':!![]})[_0x82d5('0x27')](function(_0x440629){if(_0x440629&&_0x440629[_0x82d5('0x56')]===0x0){return db['UserProfileResource']['create']({'name':_0x3f65d1['name'],'resourceId':_0x3f65d1['id'],'type':_0x440629[_0x82d5('0x2c')],'sectionId':_0x440629['id']},{})[_0x82d5('0x27')](function(){return _0x5daddf;});}else{return _0x5daddf;}})[_0x82d5('0x48')](function(_0x5dccb4){logger[_0x82d5('0x2b')](_0x82d5('0x57'),_0x5dccb4);throw _0x5dccb4;});}return _0x5daddf;});}})['then'](respondWithResult(_0x598013,0xc9))[_0x82d5('0x48')](handleError(_0x598013,null));};exports[_0x82d5('0x26')]=function(_0x25c243,_0x443675){if(_0x25c243[_0x82d5('0x4c')]['id']){delete _0x25c243[_0x82d5('0x4c')]['id'];}return db[_0x82d5('0x2e')]['find']({'where':{'id':_0x25c243[_0x82d5('0x49')]['id']}})[_0x82d5('0x27')](handleEntityNotFound(_0x443675,null))['then'](saveUpdates(_0x25c243[_0x82d5('0x4c')],null))[_0x82d5('0x27')](respondWithResult(_0x443675,null))[_0x82d5('0x48')](handleError(_0x443675,null));};exports['destroy']=function(_0xd88ea0,_0xa61a){return db[_0x82d5('0x2e')]['find']({'where':{'id':_0xd88ea0[_0x82d5('0x49')]['id']}})['then'](handleEntityNotFound(_0xa61a,null))[_0x82d5('0x27')](removeEntity(_0xa61a,null))[_0x82d5('0x48')](handleError(_0xa61a,null));};exports[_0x82d5('0x58')]=function(_0x27fd2b,_0x4f315a,_0x441a73){var _0x59890a={'raw':!![],'where':{}};var _0x1f1bc1={};var _0x28ba24={'count':0x0,'rows':[]};return db[_0x82d5('0x2e')][_0x82d5('0x59')]({'where':{'id':_0x27fd2b[_0x82d5('0x49')]['id']}})[_0x82d5('0x27')](handleEntityNotFound(_0x4f315a,null))[_0x82d5('0x27')](function(_0x205a60){if(_0x205a60){_0x1f1bc1['model']=_['keys'](db['JscriptySessionReport'][_0x82d5('0x2f')]);_0x1f1bc1['query']=_[_0x82d5('0x34')](_0x27fd2b['query']);_0x1f1bc1[_0x82d5('0x35')]=_['intersection'](_0x1f1bc1[_0x82d5('0x37')],_0x1f1bc1[_0x82d5('0x33')]);_0x59890a[_0x82d5('0x38')]=_[_0x82d5('0x36')](_0x1f1bc1[_0x82d5('0x37')],qs[_0x82d5('0x39')](_0x27fd2b['query'][_0x82d5('0x39')]));_0x59890a['attributes']=_0x59890a[_0x82d5('0x38')][_0x82d5('0x3a')]?_0x59890a['attributes']:_0x1f1bc1[_0x82d5('0x37')];if(!_0x27fd2b['query'][_0x82d5('0x3b')](_0x82d5('0x3c'))){_0x59890a['limit']=qs[_0x82d5('0x20')](_0x27fd2b['query'][_0x82d5('0x20')]);_0x59890a[_0x82d5('0x1e')]=qs[_0x82d5('0x1e')](_0x27fd2b[_0x82d5('0x33')]['offset']);}_0x59890a[_0x82d5('0x3d')]=qs[_0x82d5('0x3e')](_0x27fd2b[_0x82d5('0x33')][_0x82d5('0x3e')]);_0x59890a['where']=qs[_0x82d5('0x35')](_['pick'](_0x27fd2b[_0x82d5('0x33')],_0x1f1bc1[_0x82d5('0x35')]));_0x59890a[_0x82d5('0x41')]['ProjectId']=_0x205a60['id'];if(_0x27fd2b['query'][_0x82d5('0x40')]){_0x59890a[_0x82d5('0x41')]=_[_0x82d5('0x42')](_0x59890a[_0x82d5('0x41')],{'$or':_['map'](_0x59890a['attributes'],function(_0x560049){var _0x5e8679={};_0x5e8679[_0x560049]={'$like':'%'+_0x27fd2b[_0x82d5('0x33')]['filter']+'%'};return _0x5e8679;})});}_0x59890a=_[_0x82d5('0x42')]({},_0x59890a,_0x27fd2b[_0x82d5('0x44')]);return db[_0x82d5('0x5a')][_0x82d5('0x21')]({'where':_0x59890a[_0x82d5('0x41')]})[_0x82d5('0x27')](function(_0x1c85e0){_0x28ba24['count']=_0x1c85e0;if(_0x27fd2b[_0x82d5('0x33')][_0x82d5('0x45')]){_0x59890a[_0x82d5('0x46')]=[{'all':!![]}];}return db[_0x82d5('0x5a')][_0x82d5('0x5b')](_0x59890a);})[_0x82d5('0x27')](function(_0x445d9f){_0x28ba24[_0x82d5('0x47')]=_0x445d9f;return _0x28ba24;});}})[_0x82d5('0x27')](respondWithFilteredResult(_0x4f315a,_0x59890a))[_0x82d5('0x48')](handleError(_0x4f315a,null));};exports[_0x82d5('0x5c')]=function(_0x37a0e3,_0x4bb5c0,_0x453b28){var _0x4340dd={'raw':!![],'where':{}};var _0x3f3ff6={};var _0x58e4b={'count':0x0,'rows':[]};return db[_0x82d5('0x2e')]['findOne']({'where':{'id':_0x37a0e3['params']['id']}})[_0x82d5('0x27')](handleEntityNotFound(_0x4bb5c0,null))[_0x82d5('0x27')](function(_0x1c339d){if(_0x1c339d){_0x3f3ff6[_0x82d5('0x37')]=_[_0x82d5('0x34')](db[_0x82d5('0x5d')][_0x82d5('0x2f')]);_0x3f3ff6[_0x82d5('0x33')]=_[_0x82d5('0x34')](_0x37a0e3[_0x82d5('0x33')]);_0x3f3ff6[_0x82d5('0x35')]=_[_0x82d5('0x36')](_0x3f3ff6[_0x82d5('0x37')],_0x3f3ff6[_0x82d5('0x33')]);_0x4340dd['attributes']=_[_0x82d5('0x36')](_0x3f3ff6[_0x82d5('0x37')],qs[_0x82d5('0x39')](_0x37a0e3[_0x82d5('0x33')][_0x82d5('0x39')]));_0x4340dd[_0x82d5('0x38')]=_0x4340dd[_0x82d5('0x38')]['length']?_0x4340dd['attributes']:_0x3f3ff6[_0x82d5('0x37')];if(!_0x37a0e3[_0x82d5('0x33')][_0x82d5('0x3b')](_0x82d5('0x3c'))){_0x4340dd['limit']=qs['limit'](_0x37a0e3[_0x82d5('0x33')][_0x82d5('0x20')]);_0x4340dd['offset']=qs['offset'](_0x37a0e3[_0x82d5('0x33')]['offset']);}_0x4340dd[_0x82d5('0x3d')]=qs['sort'](_0x37a0e3[_0x82d5('0x33')][_0x82d5('0x3e')]);_0x4340dd[_0x82d5('0x41')]=qs[_0x82d5('0x35')](_[_0x82d5('0x3f')](_0x37a0e3[_0x82d5('0x33')],_0x3f3ff6[_0x82d5('0x35')]));_0x4340dd['where'][_0x82d5('0x5e')]=_0x1c339d['id'];if(_0x37a0e3[_0x82d5('0x33')][_0x82d5('0x40')]){_0x4340dd['where']=_['merge'](_0x4340dd[_0x82d5('0x41')],{'$or':_[_0x82d5('0x32')](_0x4340dd[_0x82d5('0x38')],function(_0x3b7e4c){var _0xd4134b={};_0xd4134b[_0x3b7e4c]={'$like':'%'+_0x37a0e3[_0x82d5('0x33')][_0x82d5('0x40')]+'%'};return _0xd4134b;})});}_0x4340dd=_['merge']({},_0x4340dd,_0x37a0e3['options']);return db['JscriptyAnswerReport']['count']({'where':_0x4340dd[_0x82d5('0x41')]})[_0x82d5('0x27')](function(_0x52b490){_0x58e4b[_0x82d5('0x21')]=_0x52b490;if(_0x37a0e3[_0x82d5('0x33')][_0x82d5('0x45')]){_0x4340dd[_0x82d5('0x46')]=[{'all':!![]}];}return db['JscriptyAnswerReport']['findAll'](_0x4340dd);})[_0x82d5('0x27')](function(_0x126cad){_0x58e4b[_0x82d5('0x47')]=_0x126cad;return _0x58e4b;});}})[_0x82d5('0x27')](respondWithFilteredResult(_0x4bb5c0,_0x4340dd))[_0x82d5('0x48')](handleError(_0x4bb5c0,null));};function char(_0x18fe9e){return _0x82d5('0x5f')===typeof _0x18fe9e?String[_0x82d5('0x60')][_0x82d5('0x23')](null,arguments):_0x18fe9e;}function needsEncapsulation(_0x301565){return!!_0x301565&&(_0x301565[_0x82d5('0x61')]()['indexOf'](char(0xd))>=0x0||_0x301565[_0x82d5('0x61')]()[_0x82d5('0x62')](char(0xa))>=0x0||_0x301565[_0x82d5('0x61')]()[_0x82d5('0x62')](char(0x2c))>=0x0||_0x301565[_0x82d5('0x61')]()[_0x82d5('0x62')](char(0x22))>=0x0);}function encapsulate(_0x45526e){var _0x9f8417=char(0x22),_0x4ec5ca='\x5c'+char(0x22),_0x42206b=_0x45526e[_0x82d5('0x61')]()['replace'](new RegExp(_0x9f8417,'g'),_0x4ec5ca);return _0x9f8417+_0x42206b+_0x9f8417;}exports[_0x82d5('0x63')]=function(_0x2be3d6,_0x5d93f7,_0x4f1a3b){var _0x58c713,_0x28ff0f;var _0x101243={'where':{'ProjectId':_0x2be3d6['params']['id']}};if(_0x2be3d6[_0x82d5('0x33')][_0x82d5('0x64')]){_0x101243[_0x82d5('0x41')][_0x82d5('0x65')]=JSON['parse'](_0x2be3d6[_0x82d5('0x33')][_0x82d5('0x64')]);}return db[_0x82d5('0x5a')][_0x82d5('0x5b')](_0x101243)[_0x82d5('0x27')](handleEntityNotFound(_0x5d93f7,null))[_0x82d5('0x27')](function(_0x1f8a58){if(_0x1f8a58){_0x58c713=_0x1f8a58;return db[_0x82d5('0x66')][_0x82d5('0x5b')]({'where':{'SessionId':{'$in':_['map'](_0x58c713,'id')},'ProjectId':_0x2be3d6[_0x82d5('0x49')]['id']},'order':_0x82d5('0x67')});}})[_0x82d5('0x27')](handleEntityNotFound(_0x5d93f7,null))[_0x82d5('0x27')](function(_0x589ece){if(_0x589ece){_0x28ff0f=_0x589ece;var _0x29593b={};for(var _0x2dceca=0x0,_0x4ef58b=_0x28ff0f[_0x82d5('0x3a')];_0x2dceca<_0x4ef58b;_0x2dceca++){if(!_0x29593b[_0x82d5('0x3b')](_0x28ff0f[_0x2dceca][_0x82d5('0x68')])){_0x29593b[_0x28ff0f[_0x2dceca][_0x82d5('0x68')]]=needsEncapsulation(_0x28ff0f[_0x2dceca][_0x82d5('0x69')])?encapsulate(_0x28ff0f[_0x2dceca][_0x82d5('0x69')]):_0x28ff0f[_0x2dceca]['question'];}}var _0x44fc1f=[],_0x25398d={};for(var _0x3c1d21=0x0,_0x251609=_0x58c713['length'];_0x3c1d21<_0x251609;_0x3c1d21++){_0x25398d={'ProjectId':_0x2be3d6[_0x82d5('0x49')]['id'],'SessionId':_0x58c713[_0x3c1d21]['id'],'StartTime':moment(_0x58c713[_0x3c1d21][_0x82d5('0x65')])[_0x82d5('0x6a')](_0x82d5('0x6b'))};for(var _0x396dec=0x0,_0x3dfe57=_0x28ff0f[_0x82d5('0x3a')];_0x396dec<_0x3dfe57;_0x396dec++){if(_0x28ff0f[_0x396dec][_0x82d5('0x6c')]==_0x58c713[_0x3c1d21]['id']&&_0x29593b[_0x82d5('0x3b')](_0x28ff0f[_0x396dec][_0x82d5('0x68')])){_0x25398d[_0x29593b[_0x28ff0f[_0x396dec]['questionId']]]=_0x28ff0f[_0x396dec][_0x82d5('0x6d')];}}for(var _0x5caad4 in _0x29593b){if(!_0x25398d['hasOwnProperty'](_0x29593b[_0x5caad4])){_0x25398d[_0x29593b[_0x5caad4]]=null;}}_0x44fc1f['push'](_0x25398d);}return _0x44fc1f;}})[_0x82d5('0x27')](function(_0x17af8a){if(!_[_0x82d5('0x6e')](_0x17af8a)){var _0x4c8dc7=toCsv(_0x17af8a);var _0x307c62=Date[_0x82d5('0x6f')]();fs[_0x82d5('0x70')](util[_0x82d5('0x6a')](_0x82d5('0x71'),_0x2be3d6[_0x82d5('0x49')]['id'],_0x307c62),_0x4c8dc7);_0x5d93f7[_0x82d5('0x72')](_0x82d5('0x73'),_0x82d5('0x74')+util[_0x82d5('0x6a')](_0x82d5('0x75'),_0x2be3d6[_0x82d5('0x49')]['id'],_0x307c62));_0x5d93f7[_0x82d5('0x72')](_0x82d5('0x76'),_0x82d5('0x77'));return _0x5d93f7[_0x82d5('0x78')](util[_0x82d5('0x6a')](_0x82d5('0x71'),_0x2be3d6[_0x82d5('0x49')]['id'],_0x307c62));}else{return _0x5d93f7['sendStatus'](0xcc);}})[_0x82d5('0x48')](handleError(_0x5d93f7,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index 7f711b9..74c5448 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 _0x0738=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./jscriptyProject.attributes','exports','define','JscriptyProject','jscripty_projects','lodash','../../config/logger'];(function(_0x33a21a,_0x22d1a8){var _0x4c628e=function(_0x59edab){while(--_0x59edab){_0x33a21a['push'](_0x33a21a['shift']());}};_0x4c628e(++_0x22d1a8);}(_0x0738,0x6e));var _0x8073=function(_0x21c601,_0x26f456){_0x21c601=_0x21c601-0x0;var _0xd423f=_0x0738[_0x21c601];return _0xd423f;};'use strict';var _=require(_0x8073('0x0'));var util=require('util');var logger=require(_0x8073('0x1'))(_0x8073('0x2'));var moment=require(_0x8073('0x3'));var BPromise=require(_0x8073('0x4'));var rp=require(_0x8073('0x5'));var fs=require('fs');var path=require(_0x8073('0x6'));var rimraf=require(_0x8073('0x7'));var config=require(_0x8073('0x8'));var attributes=require(_0x8073('0x9'));module[_0x8073('0xa')]=function(_0x2f90b9,_0x588057){return _0x2f90b9[_0x8073('0xb')](_0x8073('0xc'),attributes,{'tableName':_0x8073('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x61a5=['lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','JscriptyProject','jscripty_projects'];(function(_0x4f5919,_0x131535){var _0x29dc08=function(_0x311acf){while(--_0x311acf){_0x4f5919['push'](_0x4f5919['shift']());}};_0x29dc08(++_0x131535);}(_0x61a5,0xf0));var _0x561a=function(_0x337ef8,_0x3971ab){_0x337ef8=_0x337ef8-0x0;var _0x585b75=_0x61a5[_0x337ef8];return _0x585b75;};'use strict';var _=require(_0x561a('0x0'));var util=require('util');var logger=require(_0x561a('0x1'))(_0x561a('0x2'));var moment=require(_0x561a('0x3'));var BPromise=require(_0x561a('0x4'));var rp=require(_0x561a('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x561a('0x6'));var config=require(_0x561a('0x7'));var attributes=require('./jscriptyProject.attributes');module[_0x561a('0x8')]=function(_0x31f762,_0x24c89a){return _0x31f762[_0x561a('0x9')](_0x561a('0xa'),attributes,{'tableName':_0x561a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.rpc.js b/server/api/jscriptyProject/jscriptyProject.rpc.js index 82e3909..6d82cee 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 _0xbdb7=['request\x20sent','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','info','JscriptyProject,\x20%s,\x20%s'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x7e2eb0,_0x17cd58){_0x7e2eb0=_0x7e2eb0-0x0;var _0xd92de4=_0xbdb7[_0x7e2eb0];return _0xd92de4;};'use strict';var _=require(_0x7bdb('0x0'));var util=require(_0x7bdb('0x1'));var moment=require(_0x7bdb('0x2'));var BPromise=require(_0x7bdb('0x3'));var rs=require(_0x7bdb('0x4'));var fs=require('fs');var Redis=require(_0x7bdb('0x5'));var db=require(_0x7bdb('0x6'))['db'];var utils=require(_0x7bdb('0x7'));var logger=require(_0x7bdb('0x8'))('rpc');var config=require(_0x7bdb('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7bdb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1e23a3,_0x493bde,_0x513cba){return new BPromise(function(_0x468041,_0x11a877){return client['request'](_0x1e23a3,_0x513cba)['then'](function(_0xdc2ffc){logger[_0x7bdb('0xb')](_0x7bdb('0xc'),_0x493bde,_0x7bdb('0xd'));logger[_0x7bdb('0xe')](_0x7bdb('0xf'),_0x493bde,_0x7bdb('0xd'),JSON[_0x7bdb('0x10')](_0xdc2ffc));if(_0xdc2ffc['error']){if(_0xdc2ffc['error']['code']===0x1f4){logger[_0x7bdb('0x11')](_0x7bdb('0xc'),_0x493bde,_0xdc2ffc['error'][_0x7bdb('0x12')]);return _0x11a877(_0xdc2ffc['error']['message']);}logger[_0x7bdb('0x11')](_0x7bdb('0xc'),_0x493bde,_0xdc2ffc['error']['message']);return _0x468041(_0xdc2ffc['error'][_0x7bdb('0x12')]);}else{logger[_0x7bdb('0xb')](_0x7bdb('0xc'),_0x493bde,_0x7bdb('0xd'));_0x468041(_0xdc2ffc[_0x7bdb('0x13')][_0x7bdb('0x12')]);}})[_0x7bdb('0x14')](function(_0x1b2d9b){logger['error'](_0x7bdb('0xc'),_0x493bde,_0x1b2d9b);_0x11a877(_0x1b2d9b);});});} \ No newline at end of file +var _0x9bde=['code','message','JscriptyProject,\x20%s,\x20%s','result','catch','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','request\x20sent','error'];(function(_0x5769b5,_0x3295f0){var _0x531f67=function(_0x47917a){while(--_0x47917a){_0x5769b5['push'](_0x5769b5['shift']());}};_0x531f67(++_0x3295f0);}(_0x9bde,0xe1));var _0xe9bd=function(_0x1a192e,_0x1f56b7){_0x1a192e=_0x1a192e-0x0;var _0x1fb017=_0x9bde[_0x1a192e];return _0x1fb017;};'use strict';var _=require('lodash');var util=require(_0xe9bd('0x0'));var moment=require('moment');var BPromise=require(_0xe9bd('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe9bd('0x2'));var db=require(_0xe9bd('0x3'))['db'];var utils=require(_0xe9bd('0x4'));var logger=require(_0xe9bd('0x5'))(_0xe9bd('0x6'));var config=require(_0xe9bd('0x7'));var jayson=require(_0xe9bd('0x8'));var client=jayson['client'][_0xe9bd('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5f18fe,_0x22a438,_0xa66ae2){return new BPromise(function(_0x2d5c75,_0x3ef9e3){return client[_0xe9bd('0xa')](_0x5f18fe,_0xa66ae2)[_0xe9bd('0xb')](function(_0x439abc){logger[_0xe9bd('0xc')]('JscriptyProject,\x20%s,\x20%s',_0x22a438,'request\x20sent');logger[_0xe9bd('0xd')](_0xe9bd('0xe'),_0x22a438,_0xe9bd('0xf'),JSON['stringify'](_0x439abc));if(_0x439abc[_0xe9bd('0x10')]){if(_0x439abc[_0xe9bd('0x10')][_0xe9bd('0x11')]===0x1f4){logger[_0xe9bd('0x10')]('JscriptyProject,\x20%s,\x20%s',_0x22a438,_0x439abc[_0xe9bd('0x10')]['message']);return _0x3ef9e3(_0x439abc[_0xe9bd('0x10')][_0xe9bd('0x12')]);}logger[_0xe9bd('0x10')]('JscriptyProject,\x20%s,\x20%s',_0x22a438,_0x439abc['error'][_0xe9bd('0x12')]);return _0x2d5c75(_0x439abc[_0xe9bd('0x10')][_0xe9bd('0x12')]);}else{logger[_0xe9bd('0xc')](_0xe9bd('0x13'),_0x22a438,_0xe9bd('0xf'));_0x2d5c75(_0x439abc[_0xe9bd('0x14')]['message']);}})[_0xe9bd('0x15')](function(_0x464a1b){logger[_0xe9bd('0x10')]('JscriptyProject,\x20%s,\x20%s',_0x22a438,_0x464a1b);_0x3ef9e3(_0x464a1b);});});} \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index b74531e..fca7f12 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 _0xf467=['delete','destroy','exports','multer','util','path','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','show','create','/:id','update'];(function(_0x53ae6f,_0x50cb80){var _0x472e18=function(_0x87bbe0){while(--_0x87bbe0){_0x53ae6f['push'](_0x53ae6f['shift']());}};_0x472e18(++_0x50cb80);}(_0xf467,0xae));var _0x7f46=function(_0x508748,_0x1e2240){_0x508748=_0x508748-0x0;var _0x45b366=_0xf467[_0x508748];return _0x45b366;};'use strict';var multer=require(_0x7f46('0x0'));var util=require(_0x7f46('0x1'));var path=require(_0x7f46('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x7f46('0x3'));var auth=require(_0x7f46('0x4'));var interaction=require(_0x7f46('0x5'));var config=require(_0x7f46('0x6'));var controller=require('./jscriptyQuestionReport.controller');router[_0x7f46('0x7')]('/',auth[_0x7f46('0x8')](),controller[_0x7f46('0x9')]);router[_0x7f46('0x7')](_0x7f46('0xa'),auth['isAuthenticated'](),controller[_0x7f46('0xb')]);router[_0x7f46('0x7')]('/:id',auth[_0x7f46('0x8')](),controller[_0x7f46('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0x7f46('0xd')]);router['put'](_0x7f46('0xe'),auth[_0x7f46('0x8')](),controller[_0x7f46('0xf')]);router[_0x7f46('0x10')](_0x7f46('0xe'),auth[_0x7f46('0x8')](),controller[_0x7f46('0x11')]);module[_0x7f46('0x12')]=router; \ No newline at end of file +var _0x5700=['destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','./jscriptyQuestionReport.controller','get','isAuthenticated','/describe','describe','/:id','show','post','create','update','delete'];(function(_0x106e92,_0x20a61f){var _0xa8f2be=function(_0x1641d9){while(--_0x1641d9){_0x106e92['push'](_0x106e92['shift']());}};_0xa8f2be(++_0x20a61f);}(_0x5700,0x106));var _0x0570=function(_0x163484,_0x214258){_0x163484=_0x163484-0x0;var _0x22617e=_0x5700[_0x163484];return _0x22617e;};'use strict';var multer=require(_0x0570('0x0'));var util=require(_0x0570('0x1'));var path=require(_0x0570('0x2'));var timeout=require(_0x0570('0x3'));var express=require(_0x0570('0x4'));var router=express[_0x0570('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x0570('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x0570('0x7'));router[_0x0570('0x8')]('/',auth[_0x0570('0x9')](),controller['index']);router['get'](_0x0570('0xa'),auth[_0x0570('0x9')](),controller[_0x0570('0xb')]);router[_0x0570('0x8')](_0x0570('0xc'),auth[_0x0570('0x9')](),controller[_0x0570('0xd')]);router[_0x0570('0xe')]('/',auth[_0x0570('0x9')](),controller[_0x0570('0xf')]);router['put'](_0x0570('0xc'),auth[_0x0570('0x9')](),controller[_0x0570('0x10')]);router[_0x0570('0x11')](_0x0570('0xc'),auth['isAuthenticated'](),controller[_0x0570('0x12')]);module[_0x0570('0x13')]=router; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js index c2638de..3344ed3 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(_0x2d2c16,_0x4e88b6){var _0x53f2fb=function(_0x6b6dac){while(--_0x6b6dac){_0x2d2c16['push'](_0x2d2c16['shift']());}};_0x53f2fb(++_0x4e88b6);}(_0x7a54,0x106));var _0x47a5=function(_0x371690,_0x173be6){_0x371690=_0x371690-0x0;var _0x5be647=_0x7a54[_0x371690];return _0x5be647;};'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(_0x4792c8,_0x5158a1){var _0x35edb1=function(_0x2472d3){while(--_0x2472d3){_0x4792c8['push'](_0x4792c8['shift']());}};_0x35edb1(++_0x5158a1);}(_0x7a54,0x106));var _0x47a5=function(_0x48742d,_0x3fdd2d){_0x48742d=_0x48742d-0x0;var _0xe8ba6d=_0x7a54[_0x48742d];return _0xe8ba6d;};'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 f6e3e5f..ebe47ce 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 _0x4cb1=['bluebird','mustache','util','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','../../mysqldb','status','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','end','sendStatus','stack','name','send','map','JscriptyQuestionReport','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','create','body','find','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch'];(function(_0x580fb7,_0x3d6fc8){var _0xcedb1c=function(_0x214810){while(--_0x214810){_0x580fb7['push'](_0x580fb7['shift']());}};_0xcedb1c(++_0x3d6fc8);}(_0x4cb1,0x1ca));var _0x14cb=function(_0x4b19a2,_0x3279fe){_0x4b19a2=_0x4b19a2-0x0;var _0x44f28e=_0x4cb1[_0x4b19a2];return _0x44f28e;};'use strict';var emlformat=require(_0x14cb('0x0'));var rimraf=require(_0x14cb('0x1'));var zipdir=require(_0x14cb('0x2'));var jsonpatch=require(_0x14cb('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x14cb('0x4'));var Mustache=require(_0x14cb('0x5'));var util=require(_0x14cb('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x14cb('0x7'));var ejs=require(_0x14cb('0x8'));var fs=require('fs');var fs_extra=require(_0x14cb('0x9'));var _=require(_0x14cb('0xa'));var squel=require(_0x14cb('0xb'));var crypto=require(_0x14cb('0xc'));var jsforce=require(_0x14cb('0xd'));var deskjs=require(_0x14cb('0xe'));var toCsv=require('to-csv');var querystring=require(_0x14cb('0xf'));var Papa=require('papaparse');var Redis=require(_0x14cb('0x10'));var authService=require(_0x14cb('0x11'));var qs=require(_0x14cb('0x12'));var as=require(_0x14cb('0x13'));var hardwareService=require(_0x14cb('0x14'));var logger=require(_0x14cb('0x15'))(_0x14cb('0x16'));var utils=require(_0x14cb('0x17'));var config=require(_0x14cb('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x14cb('0x19'))['db'];function respondWithStatusCode(_0x4e7e0e,_0x50c97d){_0x50c97d=_0x50c97d||0xcc;return function(_0x470548){if(_0x470548){return _0x4e7e0e['sendStatus'](_0x50c97d);}return _0x4e7e0e[_0x14cb('0x1a')](_0x50c97d)['end']();};}function respondWithResult(_0x40a6f4,_0x361736){_0x361736=_0x361736||0xc8;return function(_0x307696){if(_0x307696){return _0x40a6f4['status'](_0x361736)[_0x14cb('0x1b')](_0x307696);}};}function respondWithFilteredResult(_0x391579,_0x29d55c){return function(_0x2ba19c){if(_0x2ba19c){var _0x41c041=typeof _0x29d55c[_0x14cb('0x1c')]===_0x14cb('0x1d')&&typeof _0x29d55c['limit']===_0x14cb('0x1d');var _0x3274c6=_0x2ba19c[_0x14cb('0x1e')];var _0x1411fa=_0x41c041?0x0:_0x29d55c[_0x14cb('0x1c')];var _0x40c4d3=_0x41c041?_0x2ba19c[_0x14cb('0x1e')]:_0x29d55c[_0x14cb('0x1c')]+_0x29d55c[_0x14cb('0x1f')];var _0x2b3885;if(_0x40c4d3>=_0x3274c6){_0x40c4d3=_0x3274c6;_0x2b3885=0xc8;}else{_0x2b3885=0xce;}_0x391579['status'](_0x2b3885);return _0x391579[_0x14cb('0x20')](_0x14cb('0x21'),_0x1411fa+'-'+_0x40c4d3+'/'+_0x3274c6)['json'](_0x2ba19c);}return null;};}function patchUpdates(_0xfdcc43){return function(_0x2057fc){try{jsonpatch['apply'](_0x2057fc,_0xfdcc43,!![]);}catch(_0x4d746e){return BPromise[_0x14cb('0x22')](_0x4d746e);}return _0x2057fc[_0x14cb('0x23')]();};}function saveUpdates(_0x9342c4,_0x2105db){return function(_0xcd5df0){if(_0xcd5df0){return _0xcd5df0[_0x14cb('0x24')](_0x9342c4)[_0x14cb('0x25')](function(_0x51cf96){return _0x51cf96;});}return null;};}function removeEntity(_0x378726,_0x4e2ab1){return function(_0x4271eb){if(_0x4271eb){return _0x4271eb['destroy']()[_0x14cb('0x25')](function(){_0x378726[_0x14cb('0x1a')](0xcc)[_0x14cb('0x26')]();});}};}function handleEntityNotFound(_0x4b2538,_0x13855b){return function(_0x49123d){if(!_0x49123d){_0x4b2538[_0x14cb('0x27')](0x194);}return _0x49123d;};}function handleError(_0x3a6405,_0x1d9790){_0x1d9790=_0x1d9790||0x1f4;return function(_0x4eaddb){logger['error'](_0x4eaddb[_0x14cb('0x28')]);if(_0x4eaddb[_0x14cb('0x29')]){delete _0x4eaddb[_0x14cb('0x29')];}_0x3a6405[_0x14cb('0x1a')](_0x1d9790)[_0x14cb('0x2a')](_0x4eaddb);};}exports['index']=function(_0x511f9f,_0x2a898c){var _0x60b045={},_0x17f049={},_0x786f1f={'count':0x0,'rows':[]};var _0x5f5084=_[_0x14cb('0x2b')](db[_0x14cb('0x2c')][_0x14cb('0x2d')],function(_0x11e7ab){return{'name':_0x11e7ab[_0x14cb('0x2e')],'type':_0x11e7ab['type'][_0x14cb('0x2f')]};});_0x17f049[_0x14cb('0x30')]=_['map'](_0x5f5084,_0x14cb('0x29'));_0x17f049[_0x14cb('0x31')]=_[_0x14cb('0x32')](_0x511f9f[_0x14cb('0x31')]);_0x17f049[_0x14cb('0x33')]=_[_0x14cb('0x34')](_0x17f049[_0x14cb('0x30')],_0x17f049[_0x14cb('0x31')]);_0x60b045[_0x14cb('0x35')]=_['intersection'](_0x17f049['model'],qs['fields'](_0x511f9f['query'][_0x14cb('0x36')]));_0x60b045[_0x14cb('0x35')]=_0x60b045[_0x14cb('0x35')][_0x14cb('0x37')]?_0x60b045[_0x14cb('0x35')]:_0x17f049[_0x14cb('0x30')];if(!_0x511f9f[_0x14cb('0x31')]['hasOwnProperty'](_0x14cb('0x38'))){_0x60b045[_0x14cb('0x1f')]=qs[_0x14cb('0x1f')](_0x511f9f[_0x14cb('0x31')][_0x14cb('0x1f')]);_0x60b045['offset']=qs[_0x14cb('0x1c')](_0x511f9f[_0x14cb('0x31')]['offset']);}_0x60b045[_0x14cb('0x39')]=qs[_0x14cb('0x3a')](_0x511f9f[_0x14cb('0x31')][_0x14cb('0x3a')]);_0x60b045[_0x14cb('0x3b')]=qs[_0x14cb('0x33')](_['pick'](_0x511f9f[_0x14cb('0x31')],_0x17f049['filters']),_0x5f5084);if(_0x511f9f['query'][_0x14cb('0x3c')]){_0x60b045[_0x14cb('0x3b')]=_[_0x14cb('0x3d')](_0x60b045['where'],{'$or':_[_0x14cb('0x2b')](_0x5f5084,function(_0x4bc0aa){if(_0x4bc0aa[_0x14cb('0x3e')]!==_0x14cb('0x3f')){var _0x1ed209={};_0x1ed209[_0x4bc0aa['name']]={'$like':'%'+_0x511f9f[_0x14cb('0x31')][_0x14cb('0x3c')]+'%'};return _0x1ed209;}})});}_0x60b045=_[_0x14cb('0x3d')]({},_0x60b045,_0x511f9f[_0x14cb('0x40')]);var _0x409d9b={'where':_0x60b045[_0x14cb('0x3b')]};return db[_0x14cb('0x2c')]['count'](_0x409d9b)[_0x14cb('0x25')](function(_0x565383){_0x786f1f[_0x14cb('0x1e')]=_0x565383;if(_0x511f9f[_0x14cb('0x31')][_0x14cb('0x41')]){_0x60b045[_0x14cb('0x42')]=[{'all':!![]}];}return db['JscriptyQuestionReport'][_0x14cb('0x43')](_0x60b045);})[_0x14cb('0x25')](function(_0x230d8f){_0x786f1f[_0x14cb('0x44')]=_0x230d8f;return _0x786f1f;})[_0x14cb('0x25')](respondWithFilteredResult(_0x2a898c,_0x60b045))[_0x14cb('0x45')](handleError(_0x2a898c,null));};exports[_0x14cb('0x46')]=function(_0x58890b,_0x19ac56){var _0x5ad5f5={'raw':!![],'where':{'id':_0x58890b[_0x14cb('0x47')]['id']}},_0x447281={};_0x447281[_0x14cb('0x30')]=_[_0x14cb('0x32')](db[_0x14cb('0x2c')][_0x14cb('0x2d')]);_0x447281[_0x14cb('0x31')]=_[_0x14cb('0x32')](_0x58890b['query']);_0x447281[_0x14cb('0x33')]=_['intersection'](_0x447281[_0x14cb('0x30')],_0x447281['query']);_0x5ad5f5['attributes']=_[_0x14cb('0x34')](_0x447281[_0x14cb('0x30')],qs[_0x14cb('0x36')](_0x58890b[_0x14cb('0x31')][_0x14cb('0x36')]));_0x5ad5f5['attributes']=_0x5ad5f5[_0x14cb('0x35')][_0x14cb('0x37')]?_0x5ad5f5[_0x14cb('0x35')]:_0x447281['model'];if(_0x58890b[_0x14cb('0x31')][_0x14cb('0x41')]){_0x5ad5f5[_0x14cb('0x42')]=[{'all':!![]}];}_0x5ad5f5=_[_0x14cb('0x3d')]({},_0x5ad5f5,_0x58890b[_0x14cb('0x40')]);return db[_0x14cb('0x2c')]['find'](_0x5ad5f5)[_0x14cb('0x25')](handleEntityNotFound(_0x19ac56,null))[_0x14cb('0x25')](respondWithResult(_0x19ac56,null))[_0x14cb('0x45')](handleError(_0x19ac56,null));};exports[_0x14cb('0x48')]=function(_0x477978,_0x519733){return db[_0x14cb('0x2c')][_0x14cb('0x48')](_0x477978[_0x14cb('0x49')],{})[_0x14cb('0x25')](respondWithResult(_0x519733,0xc9))[_0x14cb('0x45')](handleError(_0x519733,null));};exports[_0x14cb('0x24')]=function(_0x5b1e6f,_0x537b40){if(_0x5b1e6f[_0x14cb('0x49')]['id']){delete _0x5b1e6f[_0x14cb('0x49')]['id'];}return db['JscriptyQuestionReport'][_0x14cb('0x4a')]({'where':{'id':_0x5b1e6f[_0x14cb('0x47')]['id']}})[_0x14cb('0x25')](handleEntityNotFound(_0x537b40,null))[_0x14cb('0x25')](saveUpdates(_0x5b1e6f['body'],null))[_0x14cb('0x25')](respondWithResult(_0x537b40,null))[_0x14cb('0x45')](handleError(_0x537b40,null));};exports[_0x14cb('0x4b')]=function(_0x17439b,_0x4df4cf){return db[_0x14cb('0x2c')]['find']({'where':{'id':_0x17439b['params']['id']}})[_0x14cb('0x25')](handleEntityNotFound(_0x4df4cf,null))[_0x14cb('0x25')](removeEntity(_0x4df4cf,null))['catch'](handleError(_0x4df4cf,null));};exports[_0x14cb('0x4c')]=function(_0x1b85c1,_0x5f2500){return db['JscriptyQuestionReport'][_0x14cb('0x4c')]()[_0x14cb('0x25')](respondWithResult(_0x5f2500,null))[_0x14cb('0x45')](handleError(_0x5f2500,null));}; \ No newline at end of file +var _0xcad5=['fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','name','includeAll','findAll','rows','catch','params','keys','include','options','body','find','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','destroy','then','error','stack','send','index','map','JscriptyQuestionReport','rawAttributes','fieldName','key','model','query','intersection','attributes'];(function(_0x22fe75,_0x50d58a){var _0xbad35=function(_0x54b0c8){while(--_0x54b0c8){_0x22fe75['push'](_0x22fe75['shift']());}};_0xbad35(++_0x50d58a);}(_0xcad5,0x1cf));var _0x5cad=function(_0x204c69,_0x1d8dbe){_0x204c69=_0x204c69-0x0;var _0x5c03dd=_0xcad5[_0x204c69];return _0x5c03dd;};'use strict';var emlformat=require(_0x5cad('0x0'));var rimraf=require(_0x5cad('0x1'));var zipdir=require(_0x5cad('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5cad('0x3'));var moment=require(_0x5cad('0x4'));var BPromise=require(_0x5cad('0x5'));var Mustache=require(_0x5cad('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x5cad('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5cad('0x8'));var squel=require(_0x5cad('0x9'));var crypto=require(_0x5cad('0xa'));var jsforce=require(_0x5cad('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x5cad('0xc'));var Papa=require(_0x5cad('0xd'));var Redis=require(_0x5cad('0xe'));var authService=require(_0x5cad('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x5cad('0x10'));var utils=require(_0x5cad('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0x5cad('0x12'));var db=require(_0x5cad('0x13'))['db'];function respondWithStatusCode(_0x614fa9,_0xba2132){_0xba2132=_0xba2132||0xcc;return function(_0x13e1c5){if(_0x13e1c5){return _0x614fa9[_0x5cad('0x14')](_0xba2132);}return _0x614fa9[_0x5cad('0x15')](_0xba2132)[_0x5cad('0x16')]();};}function respondWithResult(_0x55d99c,_0x437633){_0x437633=_0x437633||0xc8;return function(_0x39e549){if(_0x39e549){return _0x55d99c[_0x5cad('0x15')](_0x437633)[_0x5cad('0x17')](_0x39e549);}};}function respondWithFilteredResult(_0x125ddc,_0x26eec5){return function(_0x46f7bf){if(_0x46f7bf){var _0x343623=typeof _0x26eec5[_0x5cad('0x18')]===_0x5cad('0x19')&&typeof _0x26eec5[_0x5cad('0x1a')]==='undefined';var _0x313166=_0x46f7bf[_0x5cad('0x1b')];var _0x21853e=_0x343623?0x0:_0x26eec5[_0x5cad('0x18')];var _0x18cf06=_0x343623?_0x46f7bf['count']:_0x26eec5[_0x5cad('0x18')]+_0x26eec5['limit'];var _0x104d01;if(_0x18cf06>=_0x313166){_0x18cf06=_0x313166;_0x104d01=0xc8;}else{_0x104d01=0xce;}_0x125ddc[_0x5cad('0x15')](_0x104d01);return _0x125ddc['set'](_0x5cad('0x1c'),_0x21853e+'-'+_0x18cf06+'/'+_0x313166)[_0x5cad('0x17')](_0x46f7bf);}return null;};}function patchUpdates(_0x3f6dc4){return function(_0x108aee){try{jsonpatch[_0x5cad('0x1d')](_0x108aee,_0x3f6dc4,!![]);}catch(_0x308939){return BPromise[_0x5cad('0x1e')](_0x308939);}return _0x108aee[_0x5cad('0x1f')]();};}function saveUpdates(_0x244b71,_0x4f55c7){return function(_0x5523af){if(_0x5523af){return _0x5523af[_0x5cad('0x20')](_0x244b71)['then'](function(_0x32ccdd){return _0x32ccdd;});}return null;};}function removeEntity(_0x25e145,_0x18df3c){return function(_0x3080dd){if(_0x3080dd){return _0x3080dd[_0x5cad('0x21')]()[_0x5cad('0x22')](function(){_0x25e145[_0x5cad('0x15')](0xcc)[_0x5cad('0x16')]();});}};}function handleEntityNotFound(_0x356c73,_0x34e398){return function(_0x125755){if(!_0x125755){_0x356c73[_0x5cad('0x14')](0x194);}return _0x125755;};}function handleError(_0x119e02,_0xaecd71){_0xaecd71=_0xaecd71||0x1f4;return function(_0x4fa905){logger[_0x5cad('0x23')](_0x4fa905[_0x5cad('0x24')]);if(_0x4fa905['name']){delete _0x4fa905['name'];}_0x119e02['status'](_0xaecd71)[_0x5cad('0x25')](_0x4fa905);};}exports[_0x5cad('0x26')]=function(_0x27c27d,_0x1f7597){var _0x40a70d={},_0x35a4cb={},_0x311dbc={'count':0x0,'rows':[]};var _0x5d1da5=_[_0x5cad('0x27')](db[_0x5cad('0x28')][_0x5cad('0x29')],function(_0x2b1aac){return{'name':_0x2b1aac[_0x5cad('0x2a')],'type':_0x2b1aac['type'][_0x5cad('0x2b')]};});_0x35a4cb[_0x5cad('0x2c')]=_[_0x5cad('0x27')](_0x5d1da5,'name');_0x35a4cb[_0x5cad('0x2d')]=_['keys'](_0x27c27d[_0x5cad('0x2d')]);_0x35a4cb['filters']=_[_0x5cad('0x2e')](_0x35a4cb[_0x5cad('0x2c')],_0x35a4cb[_0x5cad('0x2d')]);_0x40a70d[_0x5cad('0x2f')]=_[_0x5cad('0x2e')](_0x35a4cb[_0x5cad('0x2c')],qs[_0x5cad('0x30')](_0x27c27d['query'][_0x5cad('0x30')]));_0x40a70d['attributes']=_0x40a70d[_0x5cad('0x2f')][_0x5cad('0x31')]?_0x40a70d[_0x5cad('0x2f')]:_0x35a4cb[_0x5cad('0x2c')];if(!_0x27c27d[_0x5cad('0x2d')][_0x5cad('0x32')](_0x5cad('0x33'))){_0x40a70d[_0x5cad('0x1a')]=qs[_0x5cad('0x1a')](_0x27c27d[_0x5cad('0x2d')]['limit']);_0x40a70d[_0x5cad('0x18')]=qs['offset'](_0x27c27d[_0x5cad('0x2d')][_0x5cad('0x18')]);}_0x40a70d[_0x5cad('0x34')]=qs[_0x5cad('0x35')](_0x27c27d[_0x5cad('0x2d')][_0x5cad('0x35')]);_0x40a70d[_0x5cad('0x36')]=qs[_0x5cad('0x37')](_[_0x5cad('0x38')](_0x27c27d[_0x5cad('0x2d')],_0x35a4cb[_0x5cad('0x37')]),_0x5d1da5);if(_0x27c27d[_0x5cad('0x2d')][_0x5cad('0x39')]){_0x40a70d['where']=_[_0x5cad('0x3a')](_0x40a70d['where'],{'$or':_['map'](_0x5d1da5,function(_0x5a21e1){if(_0x5a21e1[_0x5cad('0x3b')]!==_0x5cad('0x3c')){var _0x51a81c={};_0x51a81c[_0x5a21e1[_0x5cad('0x3d')]]={'$like':'%'+_0x27c27d[_0x5cad('0x2d')][_0x5cad('0x39')]+'%'};return _0x51a81c;}})});}_0x40a70d=_[_0x5cad('0x3a')]({},_0x40a70d,_0x27c27d['options']);var _0x257062={'where':_0x40a70d[_0x5cad('0x36')]};return db[_0x5cad('0x28')]['count'](_0x257062)[_0x5cad('0x22')](function(_0xb1e3f9){_0x311dbc[_0x5cad('0x1b')]=_0xb1e3f9;if(_0x27c27d['query'][_0x5cad('0x3e')]){_0x40a70d['include']=[{'all':!![]}];}return db[_0x5cad('0x28')][_0x5cad('0x3f')](_0x40a70d);})[_0x5cad('0x22')](function(_0xb8c97){_0x311dbc[_0x5cad('0x40')]=_0xb8c97;return _0x311dbc;})[_0x5cad('0x22')](respondWithFilteredResult(_0x1f7597,_0x40a70d))[_0x5cad('0x41')](handleError(_0x1f7597,null));};exports['show']=function(_0x219ca3,_0x2bac1e){var _0x424cb6={'raw':!![],'where':{'id':_0x219ca3[_0x5cad('0x42')]['id']}},_0x316300={};_0x316300[_0x5cad('0x2c')]=_['keys'](db[_0x5cad('0x28')][_0x5cad('0x29')]);_0x316300[_0x5cad('0x2d')]=_[_0x5cad('0x43')](_0x219ca3[_0x5cad('0x2d')]);_0x316300['filters']=_[_0x5cad('0x2e')](_0x316300[_0x5cad('0x2c')],_0x316300[_0x5cad('0x2d')]);_0x424cb6[_0x5cad('0x2f')]=_[_0x5cad('0x2e')](_0x316300[_0x5cad('0x2c')],qs[_0x5cad('0x30')](_0x219ca3['query'][_0x5cad('0x30')]));_0x424cb6[_0x5cad('0x2f')]=_0x424cb6[_0x5cad('0x2f')][_0x5cad('0x31')]?_0x424cb6[_0x5cad('0x2f')]:_0x316300['model'];if(_0x219ca3[_0x5cad('0x2d')][_0x5cad('0x3e')]){_0x424cb6[_0x5cad('0x44')]=[{'all':!![]}];}_0x424cb6=_['merge']({},_0x424cb6,_0x219ca3[_0x5cad('0x45')]);return db['JscriptyQuestionReport']['find'](_0x424cb6)['then'](handleEntityNotFound(_0x2bac1e,null))['then'](respondWithResult(_0x2bac1e,null))[_0x5cad('0x41')](handleError(_0x2bac1e,null));};exports['create']=function(_0x1efc57,_0x33ea29){return db[_0x5cad('0x28')]['create'](_0x1efc57[_0x5cad('0x46')],{})[_0x5cad('0x22')](respondWithResult(_0x33ea29,0xc9))[_0x5cad('0x41')](handleError(_0x33ea29,null));};exports['update']=function(_0x11d9ff,_0x50094b){if(_0x11d9ff[_0x5cad('0x46')]['id']){delete _0x11d9ff['body']['id'];}return db[_0x5cad('0x28')]['find']({'where':{'id':_0x11d9ff[_0x5cad('0x42')]['id']}})[_0x5cad('0x22')](handleEntityNotFound(_0x50094b,null))[_0x5cad('0x22')](saveUpdates(_0x11d9ff['body'],null))[_0x5cad('0x22')](respondWithResult(_0x50094b,null))['catch'](handleError(_0x50094b,null));};exports[_0x5cad('0x21')]=function(_0xa8ebdc,_0x44716f){return db['JscriptyQuestionReport'][_0x5cad('0x47')]({'where':{'id':_0xa8ebdc[_0x5cad('0x42')]['id']}})[_0x5cad('0x22')](handleEntityNotFound(_0x44716f,null))[_0x5cad('0x22')](removeEntity(_0x44716f,null))[_0x5cad('0x41')](handleError(_0x44716f,null));};exports[_0x5cad('0x48')]=function(_0x216bcf,_0x43b1d3){return db['JscriptyQuestionReport'][_0x5cad('0x48')]()[_0x5cad('0x22')](respondWithResult(_0x43b1d3,null))['catch'](handleError(_0x43b1d3,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index f8d1c03..dcd430b 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 _0x8313=['rimraf','../../config/environment','./jscriptyQuestionReport.attributes','exports','report_jscripty_questions','lodash','../../config/logger','api','bluebird','request-promise','path'];(function(_0x3da558,_0x45dab3){var _0x5d3e24=function(_0x53c26f){while(--_0x53c26f){_0x3da558['push'](_0x3da558['shift']());}};_0x5d3e24(++_0x45dab3);}(_0x8313,0x123));var _0x3831=function(_0x3cb61e,_0x73fe2c){_0x3cb61e=_0x3cb61e-0x0;var _0x3e5210=_0x8313[_0x3cb61e];return _0x3e5210;};'use strict';var _=require(_0x3831('0x0'));var util=require('util');var logger=require(_0x3831('0x1'))(_0x3831('0x2'));var moment=require('moment');var BPromise=require(_0x3831('0x3'));var rp=require(_0x3831('0x4'));var fs=require('fs');var path=require(_0x3831('0x5'));var rimraf=require(_0x3831('0x6'));var config=require(_0x3831('0x7'));var attributes=require(_0x3831('0x8'));module[_0x3831('0x9')]=function(_0x5ee374,_0x207dd9){return _0x5ee374['define']('JscriptyQuestionReport',attributes,{'tableName':_0x3831('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe02f=['./jscriptyQuestionReport.attributes','define','JscriptyQuestionReport','lodash','util','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x4169a4,_0xbba209){var _0x2ea881=function(_0x9556d0){while(--_0x9556d0){_0x4169a4['push'](_0x4169a4['shift']());}};_0x2ea881(++_0xbba209);}(_0xe02f,0x1b0));var _0xfe02=function(_0x5c2829,_0x2e1482){_0x5c2829=_0x5c2829-0x0;var _0x4d6544=_0xe02f[_0x5c2829];return _0x4d6544;};'use strict';var _=require(_0xfe02('0x0'));var util=require(_0xfe02('0x1'));var logger=require('../../config/logger')(_0xfe02('0x2'));var moment=require(_0xfe02('0x3'));var BPromise=require('bluebird');var rp=require(_0xfe02('0x4'));var fs=require('fs');var path=require(_0xfe02('0x5'));var rimraf=require(_0xfe02('0x6'));var config=require(_0xfe02('0x7'));var attributes=require(_0xfe02('0x8'));module['exports']=function(_0x3252ad,_0x3a5311){return _0x3252ad[_0xfe02('0x9')](_0xfe02('0xa'),attributes,{'tableName':'report_jscripty_questions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.rpc.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.rpc.js index 405695a..4559978 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 _0x782b=['rpc','../../config/environment','jayson/promise','client','http','request','then','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','error','code','message','info','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x52533c,_0x5af53e){var _0xaaedca=function(_0x596aa5){while(--_0x596aa5){_0x52533c['push'](_0x52533c['shift']());}};_0xaaedca(++_0x5af53e);}(_0x782b,0x1c0));var _0xb782=function(_0x456b45,_0x273834){_0x456b45=_0x456b45-0x0;var _0xe3627d=_0x782b[_0x456b45];return _0xe3627d;};'use strict';var _=require(_0xb782('0x0'));var util=require(_0xb782('0x1'));var moment=require(_0xb782('0x2'));var BPromise=require(_0xb782('0x3'));var rs=require(_0xb782('0x4'));var fs=require('fs');var Redis=require(_0xb782('0x5'));var db=require(_0xb782('0x6'))['db'];var utils=require(_0xb782('0x7'));var logger=require('../../config/logger')(_0xb782('0x8'));var config=require(_0xb782('0x9'));var jayson=require(_0xb782('0xa'));var client=jayson[_0xb782('0xb')][_0xb782('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x405e11,_0x3de0ad,_0x3f9eaa){return new BPromise(function(_0x2a0229,_0x7be82){return client[_0xb782('0xd')](_0x405e11,_0x3f9eaa)[_0xb782('0xe')](function(_0x174a83){logger['info'](_0xb782('0xf'),_0x3de0ad,_0xb782('0x10'));logger[_0xb782('0x11')](_0xb782('0x12'),_0x3de0ad,_0xb782('0x10'),JSON['stringify'](_0x174a83));if(_0x174a83[_0xb782('0x13')]){if(_0x174a83[_0xb782('0x13')][_0xb782('0x14')]===0x1f4){logger['error'](_0xb782('0xf'),_0x3de0ad,_0x174a83['error'][_0xb782('0x15')]);return _0x7be82(_0x174a83[_0xb782('0x13')][_0xb782('0x15')]);}logger[_0xb782('0x13')](_0xb782('0xf'),_0x3de0ad,_0x174a83[_0xb782('0x13')]['message']);return _0x2a0229(_0x174a83[_0xb782('0x13')][_0xb782('0x15')]);}else{logger[_0xb782('0x16')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x3de0ad,'request\x20sent');_0x2a0229(_0x174a83['result'][_0xb782('0x15')]);}})[_0xb782('0x17')](function(_0x1543ae){logger[_0xb782('0x13')](_0xb782('0xf'),_0x3de0ad,_0x1543ae);_0x7be82(_0x1543ae);});});} \ No newline at end of file +var _0xf993=['../../config/logger','rpc','../../config/environment','jayson/promise','request','info','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0x514e2d,_0x53f950){var _0x50a599=function(_0x4b2738){while(--_0x4b2738){_0x514e2d['push'](_0x514e2d['shift']());}};_0x50a599(++_0x53f950);}(_0xf993,0x1b1));var _0x3f99=function(_0x31edd4,_0x47418b){_0x31edd4=_0x31edd4-0x0;var _0x3c10f1=_0xf993[_0x31edd4];return _0x3c10f1;};'use strict';var _=require(_0x3f99('0x0'));var util=require(_0x3f99('0x1'));var moment=require(_0x3f99('0x2'));var BPromise=require(_0x3f99('0x3'));var rs=require(_0x3f99('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3f99('0x5'))['db'];var utils=require(_0x3f99('0x6'));var logger=require(_0x3f99('0x7'))(_0x3f99('0x8'));var config=require(_0x3f99('0x9'));var jayson=require(_0x3f99('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x379d41,_0xac3caa,_0x3ad6ad){return new BPromise(function(_0x5bc1ea,_0x164771){return client[_0x3f99('0xb')](_0x379d41,_0x3ad6ad)['then'](function(_0x2cbbfc){logger[_0x3f99('0xc')](_0x3f99('0xd'),_0xac3caa,_0x3f99('0xe'));logger[_0x3f99('0xf')](_0x3f99('0x10'),_0xac3caa,_0x3f99('0xe'),JSON[_0x3f99('0x11')](_0x2cbbfc));if(_0x2cbbfc[_0x3f99('0x12')]){if(_0x2cbbfc[_0x3f99('0x12')]['code']===0x1f4){logger[_0x3f99('0x12')](_0x3f99('0xd'),_0xac3caa,_0x2cbbfc[_0x3f99('0x12')][_0x3f99('0x13')]);return _0x164771(_0x2cbbfc[_0x3f99('0x12')][_0x3f99('0x13')]);}logger[_0x3f99('0x12')](_0x3f99('0xd'),_0xac3caa,_0x2cbbfc[_0x3f99('0x12')][_0x3f99('0x13')]);return _0x5bc1ea(_0x2cbbfc['error'][_0x3f99('0x13')]);}else{logger[_0x3f99('0xc')](_0x3f99('0xd'),_0xac3caa,_0x3f99('0xe'));_0x5bc1ea(_0x2cbbfc[_0x3f99('0x14')][_0x3f99('0x13')]);}})[_0x3f99('0x15')](function(_0x3b4eed){logger[_0x3f99('0x12')](_0x3f99('0xd'),_0xac3caa,_0x3b4eed);_0x164771(_0x3b4eed);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index 2e58b07..299158a 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 _0x2019=['/:id/questions','getQuestions','post','create','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe','describe','/:id','show'];(function(_0xc4d7de,_0x261f1f){var _0x3755e9=function(_0x1d4925){while(--_0x1d4925){_0xc4d7de['push'](_0xc4d7de['shift']());}};_0x3755e9(++_0x261f1f);}(_0x2019,0x8a));var _0x9201=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x2019[_0x4a9fb1];return _0x348672;};'use strict';var multer=require(_0x9201('0x0'));var util=require(_0x9201('0x1'));var path=require('path');var timeout=require(_0x9201('0x2'));var express=require(_0x9201('0x3'));var router=express[_0x9201('0x4')]();var fs_extra=require(_0x9201('0x5'));var auth=require(_0x9201('0x6'));var interaction=require(_0x9201('0x7'));var config=require(_0x9201('0x8'));var controller=require('./jscriptySessionReport.controller');router['get']('/',auth[_0x9201('0x9')](),controller[_0x9201('0xa')]);router[_0x9201('0xb')](_0x9201('0xc'),auth['isAuthenticated'](),controller[_0x9201('0xd')]);router[_0x9201('0xb')](_0x9201('0xe'),auth[_0x9201('0x9')](),controller[_0x9201('0xf')]);router['get'](_0x9201('0x10'),auth['isAuthenticated'](),controller[_0x9201('0x11')]);router[_0x9201('0x12')]('/',auth[_0x9201('0x9')](),controller[_0x9201('0x13')]);router['put'](_0x9201('0xe'),auth[_0x9201('0x9')](),controller['update']);router['delete'](_0x9201('0xe'),auth['isAuthenticated'](),controller[_0x9201('0x14')]);module[_0x9201('0x15')]=router; \ No newline at end of file +var _0x1c4a=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','/describe','describe','getQuestions','post','create','put','/:id','destroy','util','path','connect-timeout'];(function(_0xc0a3d3,_0x2c8d00){var _0x3386e8=function(_0x3f9df4){while(--_0x3f9df4){_0xc0a3d3['push'](_0xc0a3d3['shift']());}};_0x3386e8(++_0x2c8d00);}(_0x1c4a,0x19b));var _0xa1c4=function(_0x5f50b5,_0xa8db83){_0x5f50b5=_0x5f50b5-0x0;var _0x54c383=_0x1c4a[_0x5f50b5];return _0x54c383;};'use strict';var multer=require('multer');var util=require(_0xa1c4('0x0'));var path=require(_0xa1c4('0x1'));var timeout=require(_0xa1c4('0x2'));var express=require(_0xa1c4('0x3'));var router=express[_0xa1c4('0x4')]();var fs_extra=require(_0xa1c4('0x5'));var auth=require(_0xa1c4('0x6'));var interaction=require(_0xa1c4('0x7'));var config=require('../../config/environment');var controller=require('./jscriptySessionReport.controller');router[_0xa1c4('0x8')]('/',auth[_0xa1c4('0x9')](),controller['index']);router[_0xa1c4('0x8')](_0xa1c4('0xa'),auth['isAuthenticated'](),controller[_0xa1c4('0xb')]);router[_0xa1c4('0x8')]('/:id',auth[_0xa1c4('0x9')](),controller['show']);router[_0xa1c4('0x8')]('/:id/questions',auth[_0xa1c4('0x9')](),controller[_0xa1c4('0xc')]);router[_0xa1c4('0xd')]('/',auth[_0xa1c4('0x9')](),controller[_0xa1c4('0xe')]);router[_0xa1c4('0xf')](_0xa1c4('0x10'),auth[_0xa1c4('0x9')](),controller['update']);router['delete'](_0xa1c4('0x10'),auth[_0xa1c4('0x9')](),controller[_0xa1c4('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js b/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js index b08e807..a043ea0 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 _0xf5da=['sequelize','exports','DATE','setDataValue','endtime','format','STRING','BOOLEAN','moment'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0xf5da,0x1a6));var _0xaf5d=function(_0x323c7e,_0x3d16ec){_0x323c7e=_0x323c7e-0x0;var _0x2b0f72=_0xf5da[_0x323c7e];return _0x2b0f72;};'use strict';var moment=require(_0xaf5d('0x0'));var Sequelize=require(_0xaf5d('0x1'));module[_0xaf5d('0x2')]={'starttime':{'type':Sequelize[_0xaf5d('0x3')],'set':function(_0x2e8f18){this[_0xaf5d('0x4')]('starttime',_0x2e8f18);this[_0xaf5d('0x4')](_0xaf5d('0x5'),moment()[_0xaf5d('0x6')]('YYYY-MM-DD\x20HH:mm:ss'));}},'endtime':{'type':Sequelize['DATE']},'membername':{'type':Sequelize['STRING']},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0xaf5d('0x7')]},'uniqueid':{'type':Sequelize[_0xaf5d('0x7')]},'calleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xaf5d('0x7')]},'completed':{'type':Sequelize[_0xaf5d('0x8')],'defaultValue':![]}}; \ No newline at end of file +var _0x9b0d=['exports','DATE','starttime','setDataValue','endtime','format','STRING','sequelize'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x9b0d,0xb7));var _0xd9b0=function(_0x144b83,_0x4e6b29){_0x144b83=_0x144b83-0x0;var _0xdfdc5b=_0x9b0d[_0x144b83];return _0xdfdc5b;};'use strict';var moment=require('moment');var Sequelize=require(_0xd9b0('0x0'));module[_0xd9b0('0x1')]={'starttime':{'type':Sequelize[_0xd9b0('0x2')],'set':function(_0x464912){this['setDataValue'](_0xd9b0('0x3'),_0x464912);this[_0xd9b0('0x4')](_0xd9b0('0x5'),moment()[_0xd9b0('0x6')]('YYYY-MM-DD\x20HH:mm:ss'));}},'endtime':{'type':Sequelize[_0xd9b0('0x2')]},'membername':{'type':Sequelize[_0xd9b0('0x7')]},'projectname':{'type':Sequelize[_0xd9b0('0x7')]},'queue':{'type':Sequelize[_0xd9b0('0x7')]},'uniqueid':{'type':Sequelize[_0xd9b0('0x7')]},'calleridname':{'type':Sequelize[_0xd9b0('0x7')]},'calleridnum':{'type':Sequelize[_0xd9b0('0x7')]},'completed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.controller.js b/server/api/jscriptySessionReport/jscriptySessionReport.controller.js index c6febed..7d0004c 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 _0xf141=['papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','limit','undefined','offset','count','Content-Range','apply','reject','update','then','stack','name','index','map','JscriptySessionReport','rawAttributes','fieldName','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','type','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','params','intersection','create','body','find','describe','getQuestions','findOne','JscriptyQuestionReport','SessionId','eml-format','bluebird','mustache','path','sox','to-csv','fs-extra','squel','crypto','desk.js','querystring'];(function(_0x5f10c3,_0x420d0e){var _0x355368=function(_0x3fd315){while(--_0x3fd315){_0x5f10c3['push'](_0x5f10c3['shift']());}};_0x355368(++_0x420d0e);}(_0xf141,0x115));var _0x1f14=function(_0x533fe7,_0x5aac33){_0x533fe7=_0x533fe7-0x0;var _0x4d5d63=_0xf141[_0x533fe7];return _0x4d5d63;};'use strict';var emlformat=require(_0x1f14('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(_0x1f14('0x1'));var Mustache=require(_0x1f14('0x2'));var util=require('util');var path=require(_0x1f14('0x3'));var sox=require(_0x1f14('0x4'));var csv=require(_0x1f14('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1f14('0x6'));var _=require('lodash');var squel=require(_0x1f14('0x7'));var crypto=require(_0x1f14('0x8'));var jsforce=require('jsforce');var deskjs=require(_0x1f14('0x9'));var toCsv=require(_0x1f14('0x5'));var querystring=require(_0x1f14('0xa'));var Papa=require(_0x1f14('0xb'));var Redis=require(_0x1f14('0xc'));var authService=require('../../components/auth/service');var qs=require(_0x1f14('0xd'));var as=require(_0x1f14('0xe'));var hardwareService=require(_0x1f14('0xf'));var logger=require('../../config/logger')('api');var utils=require(_0x1f14('0x10'));var config=require(_0x1f14('0x11'));var licenseUtil=require(_0x1f14('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5f50be,_0x44fa54){_0x44fa54=_0x44fa54||0xcc;return function(_0x1ce4dd){if(_0x1ce4dd){return _0x5f50be[_0x1f14('0x13')](_0x44fa54);}return _0x5f50be[_0x1f14('0x14')](_0x44fa54)[_0x1f14('0x15')]();};}function respondWithResult(_0x4f1f0f,_0x4cd7c5){_0x4cd7c5=_0x4cd7c5||0xc8;return function(_0x441eeb){if(_0x441eeb){return _0x4f1f0f['status'](_0x4cd7c5)[_0x1f14('0x16')](_0x441eeb);}};}function respondWithFilteredResult(_0x222f15,_0x177dc6){return function(_0x476dbd){if(_0x476dbd){var _0x44491e=typeof _0x177dc6['offset']==='undefined'&&typeof _0x177dc6[_0x1f14('0x17')]===_0x1f14('0x18');var _0x5d4956=_0x476dbd['count'];var _0x5607ce=_0x44491e?0x0:_0x177dc6[_0x1f14('0x19')];var _0x2d521c=_0x44491e?_0x476dbd[_0x1f14('0x1a')]:_0x177dc6[_0x1f14('0x19')]+_0x177dc6['limit'];var _0xb854b5;if(_0x2d521c>=_0x5d4956){_0x2d521c=_0x5d4956;_0xb854b5=0xc8;}else{_0xb854b5=0xce;}_0x222f15[_0x1f14('0x14')](_0xb854b5);return _0x222f15['set'](_0x1f14('0x1b'),_0x5607ce+'-'+_0x2d521c+'/'+_0x5d4956)['json'](_0x476dbd);}return null;};}function patchUpdates(_0x193e6c){return function(_0x1cb529){try{jsonpatch[_0x1f14('0x1c')](_0x1cb529,_0x193e6c,!![]);}catch(_0x3834f5){return BPromise[_0x1f14('0x1d')](_0x3834f5);}return _0x1cb529['save']();};}function saveUpdates(_0x41cf81,_0xfde27a){return function(_0x375cbe){if(_0x375cbe){return _0x375cbe[_0x1f14('0x1e')](_0x41cf81)[_0x1f14('0x1f')](function(_0x2b6b8f){return _0x2b6b8f;});}return null;};}function removeEntity(_0x1927f0,_0x357379){return function(_0x5cca9f){if(_0x5cca9f){return _0x5cca9f['destroy']()[_0x1f14('0x1f')](function(){_0x1927f0['status'](0xcc)[_0x1f14('0x15')]();});}};}function handleEntityNotFound(_0x5ebdce,_0x28c0d2){return function(_0x15945c){if(!_0x15945c){_0x5ebdce[_0x1f14('0x13')](0x194);}return _0x15945c;};}function handleError(_0x6a4c34,_0x45cdcc){_0x45cdcc=_0x45cdcc||0x1f4;return function(_0x5388e4){logger['error'](_0x5388e4[_0x1f14('0x20')]);if(_0x5388e4[_0x1f14('0x21')]){delete _0x5388e4[_0x1f14('0x21')];}_0x6a4c34[_0x1f14('0x14')](_0x45cdcc)['send'](_0x5388e4);};}exports[_0x1f14('0x22')]=function(_0x1946f0,_0x5b5422){var _0xf0ffcb={},_0x2350e9={},_0x80f087={'count':0x0,'rows':[]};var _0x5880a5=_[_0x1f14('0x23')](db[_0x1f14('0x24')][_0x1f14('0x25')],function(_0x475fa7){return{'name':_0x475fa7[_0x1f14('0x26')],'type':_0x475fa7['type']['key']};});_0x2350e9[_0x1f14('0x27')]=_['map'](_0x5880a5,'name');_0x2350e9[_0x1f14('0x28')]=_[_0x1f14('0x29')](_0x1946f0[_0x1f14('0x28')]);_0x2350e9[_0x1f14('0x2a')]=_['intersection'](_0x2350e9[_0x1f14('0x27')],_0x2350e9['query']);_0xf0ffcb[_0x1f14('0x2b')]=_['intersection'](_0x2350e9[_0x1f14('0x27')],qs[_0x1f14('0x2c')](_0x1946f0[_0x1f14('0x28')]['fields']));_0xf0ffcb['attributes']=_0xf0ffcb['attributes'][_0x1f14('0x2d')]?_0xf0ffcb[_0x1f14('0x2b')]:_0x2350e9[_0x1f14('0x27')];if(!_0x1946f0[_0x1f14('0x28')][_0x1f14('0x2e')](_0x1f14('0x2f'))){_0xf0ffcb[_0x1f14('0x17')]=qs['limit'](_0x1946f0[_0x1f14('0x28')][_0x1f14('0x17')]);_0xf0ffcb[_0x1f14('0x19')]=qs[_0x1f14('0x19')](_0x1946f0[_0x1f14('0x28')][_0x1f14('0x19')]);}_0xf0ffcb[_0x1f14('0x30')]=qs[_0x1f14('0x31')](_0x1946f0[_0x1f14('0x28')]['sort']);_0xf0ffcb['where']=qs[_0x1f14('0x2a')](_[_0x1f14('0x32')](_0x1946f0[_0x1f14('0x28')],_0x2350e9[_0x1f14('0x2a')]),_0x5880a5);if(_0x1946f0[_0x1f14('0x28')][_0x1f14('0x33')]){_0xf0ffcb[_0x1f14('0x34')]=_['merge'](_0xf0ffcb[_0x1f14('0x34')],{'$or':_['map'](_0x5880a5,function(_0x2c8476){if(_0x2c8476[_0x1f14('0x35')]!==_0x1f14('0x36')){var _0x210052={};_0x210052[_0x2c8476[_0x1f14('0x21')]]={'$like':'%'+_0x1946f0['query']['filter']+'%'};return _0x210052;}})});}_0xf0ffcb=_[_0x1f14('0x37')]({},_0xf0ffcb,_0x1946f0[_0x1f14('0x38')]);var _0x114262={'where':_0xf0ffcb[_0x1f14('0x34')]};return db[_0x1f14('0x24')][_0x1f14('0x1a')](_0x114262)[_0x1f14('0x1f')](function(_0x132353){_0x80f087[_0x1f14('0x1a')]=_0x132353;if(_0x1946f0[_0x1f14('0x28')][_0x1f14('0x39')]){_0xf0ffcb[_0x1f14('0x3a')]=[{'all':!![]}];}return db[_0x1f14('0x24')][_0x1f14('0x3b')](_0xf0ffcb);})[_0x1f14('0x1f')](function(_0x3ce635){_0x80f087[_0x1f14('0x3c')]=_0x3ce635;return _0x80f087;})[_0x1f14('0x1f')](respondWithFilteredResult(_0x5b5422,_0xf0ffcb))[_0x1f14('0x3d')](handleError(_0x5b5422,null));};exports['show']=function(_0x3977f1,_0x4c5f99){var _0x26a914={'raw':!![],'where':{'id':_0x3977f1[_0x1f14('0x3e')]['id']}},_0x57318a={};_0x57318a[_0x1f14('0x27')]=_[_0x1f14('0x29')](db['JscriptySessionReport'][_0x1f14('0x25')]);_0x57318a[_0x1f14('0x28')]=_[_0x1f14('0x29')](_0x3977f1['query']);_0x57318a['filters']=_[_0x1f14('0x3f')](_0x57318a['model'],_0x57318a[_0x1f14('0x28')]);_0x26a914[_0x1f14('0x2b')]=_['intersection'](_0x57318a['model'],qs[_0x1f14('0x2c')](_0x3977f1[_0x1f14('0x28')][_0x1f14('0x2c')]));_0x26a914['attributes']=_0x26a914[_0x1f14('0x2b')][_0x1f14('0x2d')]?_0x26a914[_0x1f14('0x2b')]:_0x57318a[_0x1f14('0x27')];if(_0x3977f1[_0x1f14('0x28')][_0x1f14('0x39')]){_0x26a914[_0x1f14('0x3a')]=[{'all':!![]}];}_0x26a914=_['merge']({},_0x26a914,_0x3977f1[_0x1f14('0x38')]);return db[_0x1f14('0x24')]['find'](_0x26a914)[_0x1f14('0x1f')](handleEntityNotFound(_0x4c5f99,null))[_0x1f14('0x1f')](respondWithResult(_0x4c5f99,null))['catch'](handleError(_0x4c5f99,null));};exports[_0x1f14('0x40')]=function(_0xbfa65f,_0xeda94b){return db[_0x1f14('0x24')][_0x1f14('0x40')](_0xbfa65f['body'],{})[_0x1f14('0x1f')](respondWithResult(_0xeda94b,0xc9))['catch'](handleError(_0xeda94b,null));};exports[_0x1f14('0x1e')]=function(_0x77bc96,_0x4d0f51){if(_0x77bc96['body']['id']){delete _0x77bc96['body']['id'];}return db[_0x1f14('0x24')]['find']({'where':{'id':_0x77bc96[_0x1f14('0x3e')]['id']}})['then'](handleEntityNotFound(_0x4d0f51,null))[_0x1f14('0x1f')](saveUpdates(_0x77bc96[_0x1f14('0x41')],null))[_0x1f14('0x1f')](respondWithResult(_0x4d0f51,null))['catch'](handleError(_0x4d0f51,null));};exports['destroy']=function(_0x455712,_0x134d72){return db[_0x1f14('0x24')][_0x1f14('0x42')]({'where':{'id':_0x455712[_0x1f14('0x3e')]['id']}})['then'](handleEntityNotFound(_0x134d72,null))[_0x1f14('0x1f')](removeEntity(_0x134d72,null))[_0x1f14('0x3d')](handleError(_0x134d72,null));};exports[_0x1f14('0x43')]=function(_0x32fe2d,_0x21a739){return db[_0x1f14('0x24')][_0x1f14('0x43')]()[_0x1f14('0x1f')](respondWithResult(_0x21a739,null))[_0x1f14('0x3d')](handleError(_0x21a739,null));};exports[_0x1f14('0x44')]=function(_0x4e9ee1,_0x3db9ae,_0x5d0863){var _0x4eceec={'raw':!![],'where':{}};var _0x295f07={};var _0x127a4f={'count':0x0,'rows':[]};return db['JscriptySessionReport'][_0x1f14('0x45')]({'where':{'id':_0x4e9ee1['params']['id']}})[_0x1f14('0x1f')](handleEntityNotFound(_0x3db9ae,null))[_0x1f14('0x1f')](function(_0x320003){if(_0x320003){_0x295f07[_0x1f14('0x27')]=_[_0x1f14('0x29')](db[_0x1f14('0x46')]['rawAttributes']);_0x295f07[_0x1f14('0x28')]=_[_0x1f14('0x29')](_0x4e9ee1[_0x1f14('0x28')]);_0x295f07[_0x1f14('0x2a')]=_[_0x1f14('0x3f')](_0x295f07['model'],_0x295f07[_0x1f14('0x28')]);_0x4eceec[_0x1f14('0x2b')]=_[_0x1f14('0x3f')](_0x295f07[_0x1f14('0x27')],qs[_0x1f14('0x2c')](_0x4e9ee1[_0x1f14('0x28')][_0x1f14('0x2c')]));_0x4eceec[_0x1f14('0x2b')]=_0x4eceec[_0x1f14('0x2b')]['length']?_0x4eceec['attributes']:_0x295f07[_0x1f14('0x27')];if(!_0x4e9ee1['query']['hasOwnProperty'](_0x1f14('0x2f'))){_0x4eceec[_0x1f14('0x17')]=qs[_0x1f14('0x17')](_0x4e9ee1[_0x1f14('0x28')]['limit']);_0x4eceec[_0x1f14('0x19')]=qs[_0x1f14('0x19')](_0x4e9ee1[_0x1f14('0x28')]['offset']);}_0x4eceec[_0x1f14('0x30')]=qs['sort'](_0x4e9ee1[_0x1f14('0x28')][_0x1f14('0x31')]);_0x4eceec[_0x1f14('0x34')]=qs[_0x1f14('0x2a')](_[_0x1f14('0x32')](_0x4e9ee1['query'],_0x295f07[_0x1f14('0x2a')]));_0x4eceec['where'][_0x1f14('0x47')]=_0x320003['id'];if(_0x4e9ee1[_0x1f14('0x28')]['filter']){_0x4eceec['where']=_[_0x1f14('0x37')](_0x4eceec['where'],{'$or':_[_0x1f14('0x23')](_0x4eceec[_0x1f14('0x2b')],function(_0xbab7e1){var _0x5ca1cb={};_0x5ca1cb[_0xbab7e1]={'$like':'%'+_0x4e9ee1[_0x1f14('0x28')][_0x1f14('0x33')]+'%'};return _0x5ca1cb;})});}_0x4eceec=_[_0x1f14('0x37')]({},_0x4eceec,_0x4e9ee1[_0x1f14('0x38')]);return db['JscriptyQuestionReport'][_0x1f14('0x1a')]({'where':_0x4eceec[_0x1f14('0x34')]})[_0x1f14('0x1f')](function(_0x5cab7e){_0x127a4f[_0x1f14('0x1a')]=_0x5cab7e;if(_0x4e9ee1[_0x1f14('0x28')][_0x1f14('0x39')]){_0x4eceec[_0x1f14('0x3a')]=[{'all':!![]}];}return db[_0x1f14('0x46')][_0x1f14('0x3b')](_0x4eceec);})[_0x1f14('0x1f')](function(_0x2b083b){_0x127a4f[_0x1f14('0x3c')]=_0x2b083b;return _0x127a4f;});}})[_0x1f14('0x1f')](respondWithFilteredResult(_0x3db9ae,_0x4eceec))['catch'](handleError(_0x3db9ae,null));}; \ No newline at end of file +var _0xf47b=['rows','show','params','rawAttributes','find','catch','create','body','describe','getQuestions','findOne','JscriptyQuestionReport','SessionId','zip-dir','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','apply','reject','update','then','destroy','error','stack','name','send','map','JscriptySessionReport','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','VIRTUAL','merge','options','includeAll','include','findAll'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xf47b,0xa7));var _0xbf47=function(_0x1a36a5,_0x746928){_0x1a36a5=_0x1a36a5-0x0;var _0x746243=_0xf47b[_0x1a36a5];return _0x746243;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xbf47('0x0'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xbf47('0x1'));var Mustache=require(_0xbf47('0x2'));var util=require(_0xbf47('0x3'));var path=require(_0xbf47('0x4'));var sox=require(_0xbf47('0x5'));var csv=require(_0xbf47('0x6'));var ejs=require(_0xbf47('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xbf47('0x8'));var crypto=require(_0xbf47('0x9'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xbf47('0x6'));var querystring=require(_0xbf47('0xa'));var Papa=require(_0xbf47('0xb'));var Redis=require(_0xbf47('0xc'));var authService=require(_0xbf47('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0xbf47('0xe'));var hardwareService=require(_0xbf47('0xf'));var logger=require('../../config/logger')(_0xbf47('0x10'));var utils=require(_0xbf47('0x11'));var config=require(_0xbf47('0x12'));var licenseUtil=require(_0xbf47('0x13'));var db=require(_0xbf47('0x14'))['db'];function respondWithStatusCode(_0x2c3636,_0x3c6521){_0x3c6521=_0x3c6521||0xcc;return function(_0x33f9c1){if(_0x33f9c1){return _0x2c3636[_0xbf47('0x15')](_0x3c6521);}return _0x2c3636[_0xbf47('0x16')](_0x3c6521)[_0xbf47('0x17')]();};}function respondWithResult(_0x1027f7,_0x385e9a){_0x385e9a=_0x385e9a||0xc8;return function(_0x14e1f7){if(_0x14e1f7){return _0x1027f7[_0xbf47('0x16')](_0x385e9a)[_0xbf47('0x18')](_0x14e1f7);}};}function respondWithFilteredResult(_0x33f453,_0x4d4fe3){return function(_0x12cd6c){if(_0x12cd6c){var _0x5c75b5=typeof _0x4d4fe3[_0xbf47('0x19')]===_0xbf47('0x1a')&&typeof _0x4d4fe3[_0xbf47('0x1b')]==='undefined';var _0x1c52e0=_0x12cd6c[_0xbf47('0x1c')];var _0x148d1c=_0x5c75b5?0x0:_0x4d4fe3['offset'];var _0x5e9b9d=_0x5c75b5?_0x12cd6c[_0xbf47('0x1c')]:_0x4d4fe3[_0xbf47('0x19')]+_0x4d4fe3[_0xbf47('0x1b')];var _0x37b1a2;if(_0x5e9b9d>=_0x1c52e0){_0x5e9b9d=_0x1c52e0;_0x37b1a2=0xc8;}else{_0x37b1a2=0xce;}_0x33f453[_0xbf47('0x16')](_0x37b1a2);return _0x33f453['set']('Content-Range',_0x148d1c+'-'+_0x5e9b9d+'/'+_0x1c52e0)['json'](_0x12cd6c);}return null;};}function patchUpdates(_0x1d7ddd){return function(_0x36377b){try{jsonpatch[_0xbf47('0x1d')](_0x36377b,_0x1d7ddd,!![]);}catch(_0x223e18){return BPromise[_0xbf47('0x1e')](_0x223e18);}return _0x36377b['save']();};}function saveUpdates(_0x2a2ba1,_0x42c419){return function(_0x5975a9){if(_0x5975a9){return _0x5975a9[_0xbf47('0x1f')](_0x2a2ba1)[_0xbf47('0x20')](function(_0x1dae8e){return _0x1dae8e;});}return null;};}function removeEntity(_0xe4da8a,_0x32c2ed){return function(_0x2625e3){if(_0x2625e3){return _0x2625e3[_0xbf47('0x21')]()['then'](function(){_0xe4da8a[_0xbf47('0x16')](0xcc)[_0xbf47('0x17')]();});}};}function handleEntityNotFound(_0x2dfaa2,_0x1eb243){return function(_0xcc8034){if(!_0xcc8034){_0x2dfaa2[_0xbf47('0x15')](0x194);}return _0xcc8034;};}function handleError(_0x4a2508,_0x4ab654){_0x4ab654=_0x4ab654||0x1f4;return function(_0x1bf524){logger[_0xbf47('0x22')](_0x1bf524[_0xbf47('0x23')]);if(_0x1bf524[_0xbf47('0x24')]){delete _0x1bf524[_0xbf47('0x24')];}_0x4a2508[_0xbf47('0x16')](_0x4ab654)[_0xbf47('0x25')](_0x1bf524);};}exports['index']=function(_0x1f8374,_0x2007f8){var _0x247511={},_0x23c807={},_0x1738b2={'count':0x0,'rows':[]};var _0x382dd5=_[_0xbf47('0x26')](db[_0xbf47('0x27')]['rawAttributes'],function(_0x2215ed){return{'name':_0x2215ed[_0xbf47('0x28')],'type':_0x2215ed[_0xbf47('0x29')][_0xbf47('0x2a')]};});_0x23c807[_0xbf47('0x2b')]=_[_0xbf47('0x26')](_0x382dd5,_0xbf47('0x24'));_0x23c807[_0xbf47('0x2c')]=_[_0xbf47('0x2d')](_0x1f8374[_0xbf47('0x2c')]);_0x23c807['filters']=_[_0xbf47('0x2e')](_0x23c807['model'],_0x23c807[_0xbf47('0x2c')]);_0x247511[_0xbf47('0x2f')]=_[_0xbf47('0x2e')](_0x23c807[_0xbf47('0x2b')],qs[_0xbf47('0x30')](_0x1f8374[_0xbf47('0x2c')][_0xbf47('0x30')]));_0x247511[_0xbf47('0x2f')]=_0x247511[_0xbf47('0x2f')][_0xbf47('0x31')]?_0x247511['attributes']:_0x23c807['model'];if(!_0x1f8374[_0xbf47('0x2c')][_0xbf47('0x32')](_0xbf47('0x33'))){_0x247511[_0xbf47('0x1b')]=qs[_0xbf47('0x1b')](_0x1f8374[_0xbf47('0x2c')][_0xbf47('0x1b')]);_0x247511[_0xbf47('0x19')]=qs[_0xbf47('0x19')](_0x1f8374[_0xbf47('0x2c')][_0xbf47('0x19')]);}_0x247511[_0xbf47('0x34')]=qs['sort'](_0x1f8374['query'][_0xbf47('0x35')]);_0x247511[_0xbf47('0x36')]=qs['filters'](_[_0xbf47('0x37')](_0x1f8374[_0xbf47('0x2c')],_0x23c807[_0xbf47('0x38')]),_0x382dd5);if(_0x1f8374[_0xbf47('0x2c')][_0xbf47('0x39')]){_0x247511[_0xbf47('0x36')]=_['merge'](_0x247511[_0xbf47('0x36')],{'$or':_[_0xbf47('0x26')](_0x382dd5,function(_0x4269b3){if(_0x4269b3[_0xbf47('0x29')]!==_0xbf47('0x3a')){var _0x3a8f21={};_0x3a8f21[_0x4269b3[_0xbf47('0x24')]]={'$like':'%'+_0x1f8374[_0xbf47('0x2c')][_0xbf47('0x39')]+'%'};return _0x3a8f21;}})});}_0x247511=_[_0xbf47('0x3b')]({},_0x247511,_0x1f8374[_0xbf47('0x3c')]);var _0x1e0327={'where':_0x247511[_0xbf47('0x36')]};return db[_0xbf47('0x27')]['count'](_0x1e0327)[_0xbf47('0x20')](function(_0x3c983d){_0x1738b2['count']=_0x3c983d;if(_0x1f8374[_0xbf47('0x2c')][_0xbf47('0x3d')]){_0x247511[_0xbf47('0x3e')]=[{'all':!![]}];}return db['JscriptySessionReport'][_0xbf47('0x3f')](_0x247511);})['then'](function(_0x187d8c){_0x1738b2[_0xbf47('0x40')]=_0x187d8c;return _0x1738b2;})[_0xbf47('0x20')](respondWithFilteredResult(_0x2007f8,_0x247511))['catch'](handleError(_0x2007f8,null));};exports[_0xbf47('0x41')]=function(_0x22b96e,_0x5de95c){var _0x352378={'raw':!![],'where':{'id':_0x22b96e[_0xbf47('0x42')]['id']}},_0x3650e3={};_0x3650e3[_0xbf47('0x2b')]=_[_0xbf47('0x2d')](db[_0xbf47('0x27')][_0xbf47('0x43')]);_0x3650e3[_0xbf47('0x2c')]=_[_0xbf47('0x2d')](_0x22b96e[_0xbf47('0x2c')]);_0x3650e3[_0xbf47('0x38')]=_[_0xbf47('0x2e')](_0x3650e3[_0xbf47('0x2b')],_0x3650e3[_0xbf47('0x2c')]);_0x352378[_0xbf47('0x2f')]=_[_0xbf47('0x2e')](_0x3650e3[_0xbf47('0x2b')],qs['fields'](_0x22b96e['query'][_0xbf47('0x30')]));_0x352378[_0xbf47('0x2f')]=_0x352378[_0xbf47('0x2f')][_0xbf47('0x31')]?_0x352378[_0xbf47('0x2f')]:_0x3650e3[_0xbf47('0x2b')];if(_0x22b96e['query']['includeAll']){_0x352378[_0xbf47('0x3e')]=[{'all':!![]}];}_0x352378=_['merge']({},_0x352378,_0x22b96e[_0xbf47('0x3c')]);return db[_0xbf47('0x27')][_0xbf47('0x44')](_0x352378)[_0xbf47('0x20')](handleEntityNotFound(_0x5de95c,null))[_0xbf47('0x20')](respondWithResult(_0x5de95c,null))[_0xbf47('0x45')](handleError(_0x5de95c,null));};exports[_0xbf47('0x46')]=function(_0x5743c3,_0x52bd67){return db[_0xbf47('0x27')][_0xbf47('0x46')](_0x5743c3[_0xbf47('0x47')],{})['then'](respondWithResult(_0x52bd67,0xc9))[_0xbf47('0x45')](handleError(_0x52bd67,null));};exports['update']=function(_0x18f368,_0x9817ea){if(_0x18f368[_0xbf47('0x47')]['id']){delete _0x18f368[_0xbf47('0x47')]['id'];}return db[_0xbf47('0x27')]['find']({'where':{'id':_0x18f368[_0xbf47('0x42')]['id']}})['then'](handleEntityNotFound(_0x9817ea,null))[_0xbf47('0x20')](saveUpdates(_0x18f368['body'],null))[_0xbf47('0x20')](respondWithResult(_0x9817ea,null))[_0xbf47('0x45')](handleError(_0x9817ea,null));};exports[_0xbf47('0x21')]=function(_0x1cf839,_0x3fd55d){return db[_0xbf47('0x27')][_0xbf47('0x44')]({'where':{'id':_0x1cf839[_0xbf47('0x42')]['id']}})[_0xbf47('0x20')](handleEntityNotFound(_0x3fd55d,null))[_0xbf47('0x20')](removeEntity(_0x3fd55d,null))[_0xbf47('0x45')](handleError(_0x3fd55d,null));};exports[_0xbf47('0x48')]=function(_0x27fa90,_0x16fa14){return db['JscriptySessionReport'][_0xbf47('0x48')]()[_0xbf47('0x20')](respondWithResult(_0x16fa14,null))['catch'](handleError(_0x16fa14,null));};exports[_0xbf47('0x49')]=function(_0x26b27e,_0x1cdbdc,_0x48dcec){var _0x4cc145={'raw':!![],'where':{}};var _0x31e1fe={};var _0x38c8d7={'count':0x0,'rows':[]};return db['JscriptySessionReport'][_0xbf47('0x4a')]({'where':{'id':_0x26b27e[_0xbf47('0x42')]['id']}})[_0xbf47('0x20')](handleEntityNotFound(_0x1cdbdc,null))[_0xbf47('0x20')](function(_0x218cf9){if(_0x218cf9){_0x31e1fe[_0xbf47('0x2b')]=_[_0xbf47('0x2d')](db[_0xbf47('0x4b')][_0xbf47('0x43')]);_0x31e1fe[_0xbf47('0x2c')]=_['keys'](_0x26b27e['query']);_0x31e1fe[_0xbf47('0x38')]=_[_0xbf47('0x2e')](_0x31e1fe[_0xbf47('0x2b')],_0x31e1fe['query']);_0x4cc145[_0xbf47('0x2f')]=_[_0xbf47('0x2e')](_0x31e1fe[_0xbf47('0x2b')],qs[_0xbf47('0x30')](_0x26b27e[_0xbf47('0x2c')][_0xbf47('0x30')]));_0x4cc145[_0xbf47('0x2f')]=_0x4cc145['attributes']['length']?_0x4cc145[_0xbf47('0x2f')]:_0x31e1fe[_0xbf47('0x2b')];if(!_0x26b27e[_0xbf47('0x2c')][_0xbf47('0x32')](_0xbf47('0x33'))){_0x4cc145[_0xbf47('0x1b')]=qs[_0xbf47('0x1b')](_0x26b27e[_0xbf47('0x2c')][_0xbf47('0x1b')]);_0x4cc145[_0xbf47('0x19')]=qs['offset'](_0x26b27e[_0xbf47('0x2c')][_0xbf47('0x19')]);}_0x4cc145[_0xbf47('0x34')]=qs[_0xbf47('0x35')](_0x26b27e[_0xbf47('0x2c')][_0xbf47('0x35')]);_0x4cc145[_0xbf47('0x36')]=qs['filters'](_[_0xbf47('0x37')](_0x26b27e[_0xbf47('0x2c')],_0x31e1fe[_0xbf47('0x38')]));_0x4cc145[_0xbf47('0x36')][_0xbf47('0x4c')]=_0x218cf9['id'];if(_0x26b27e[_0xbf47('0x2c')]['filter']){_0x4cc145['where']=_[_0xbf47('0x3b')](_0x4cc145['where'],{'$or':_['map'](_0x4cc145['attributes'],function(_0x3899b3){var _0x8577eb={};_0x8577eb[_0x3899b3]={'$like':'%'+_0x26b27e[_0xbf47('0x2c')][_0xbf47('0x39')]+'%'};return _0x8577eb;})});}_0x4cc145=_[_0xbf47('0x3b')]({},_0x4cc145,_0x26b27e['options']);return db[_0xbf47('0x4b')][_0xbf47('0x1c')]({'where':_0x4cc145[_0xbf47('0x36')]})['then'](function(_0x5a1644){_0x38c8d7['count']=_0x5a1644;if(_0x26b27e[_0xbf47('0x2c')][_0xbf47('0x3d')]){_0x4cc145['include']=[{'all':!![]}];}return db[_0xbf47('0x4b')]['findAll'](_0x4cc145);})['then'](function(_0x5137f0){_0x38c8d7[_0xbf47('0x40')]=_0x5137f0;return _0x38c8d7;});}})[_0xbf47('0x20')](respondWithFilteredResult(_0x1cdbdc,_0x4cc145))[_0xbf47('0x45')](handleError(_0x1cdbdc,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index f16dc2e..0e6b75e 100644 --- a/server/api/jscriptySessionReport/jscriptySessionReport.model.js +++ b/server/api/jscriptySessionReport/jscriptySessionReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfcf0=['lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','./jscriptySessionReport.attributes','exports','define','JscriptySessionReport'];(function(_0x26e3cb,_0x3e38c3){var _0x15e990=function(_0xc620fe){while(--_0xc620fe){_0x26e3cb['push'](_0x26e3cb['shift']());}};_0x15e990(++_0x3e38c3);}(_0xfcf0,0x138));var _0x0fcf=function(_0x4b2251,_0x393f10){_0x4b2251=_0x4b2251-0x0;var _0x5d22fb=_0xfcf0[_0x4b2251];return _0x5d22fb;};'use strict';var _=require(_0x0fcf('0x0'));var util=require(_0x0fcf('0x1'));var logger=require('../../config/logger')(_0x0fcf('0x2'));var moment=require(_0x0fcf('0x3'));var BPromise=require(_0x0fcf('0x4'));var rp=require(_0x0fcf('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0fcf('0x6'));var config=require(_0x0fcf('0x7'));var attributes=require(_0x0fcf('0x8'));module[_0x0fcf('0x9')]=function(_0x1bace8,_0x1a7b03){return _0x1bace8[_0x0fcf('0xa')](_0x0fcf('0xb'),attributes,{'tableName':'report_jscripty_sessions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb138=['api','moment','bluebird','request-promise','rimraf','../../config/environment','./jscriptySessionReport.attributes','JscriptySessionReport','report_jscripty_sessions','lodash','util','../../config/logger'];(function(_0x373496,_0x4c8340){var _0x310579=function(_0x143215){while(--_0x143215){_0x373496['push'](_0x373496['shift']());}};_0x310579(++_0x4c8340);}(_0xb138,0x1dd));var _0x8b13=function(_0x452b6,_0x32473d){_0x452b6=_0x452b6-0x0;var _0x37605f=_0xb138[_0x452b6];return _0x37605f;};'use strict';var _=require(_0x8b13('0x0'));var util=require(_0x8b13('0x1'));var logger=require(_0x8b13('0x2'))(_0x8b13('0x3'));var moment=require(_0x8b13('0x4'));var BPromise=require(_0x8b13('0x5'));var rp=require(_0x8b13('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8b13('0x7'));var config=require(_0x8b13('0x8'));var attributes=require(_0x8b13('0x9'));module['exports']=function(_0xd19a0f,_0x13f7bd){return _0xd19a0f['define'](_0x8b13('0xa'),attributes,{'tableName':_0x8b13('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 887641d..0050cea 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 _0x47c5=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment'];(function(_0x97c6ea,_0x4cffce){var _0x2d7f50=function(_0x54010e){while(--_0x54010e){_0x97c6ea['push'](_0x97c6ea['shift']());}};_0x2d7f50(++_0x4cffce);}(_0x47c5,0x165));var _0x547c=function(_0x3ecd7d,_0x52140d){_0x3ecd7d=_0x3ecd7d-0x0;var _0x38ea7a=_0x47c5[_0x3ecd7d];return _0x38ea7a;};'use strict';var _=require(_0x547c('0x0'));var util=require(_0x547c('0x1'));var moment=require(_0x547c('0x2'));var BPromise=require(_0x547c('0x3'));var rs=require(_0x547c('0x4'));var fs=require('fs');var Redis=require(_0x547c('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x547c('0x6'));var logger=require(_0x547c('0x7'))('rpc');var config=require(_0x547c('0x8'));var jayson=require(_0x547c('0x9'));var client=jayson['client'][_0x547c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x439f25,_0x381f2e,_0x10a334){return new BPromise(function(_0x12fb7d,_0x4ef079){return client[_0x547c('0xb')](_0x439f25,_0x10a334)[_0x547c('0xc')](function(_0x10dec9){logger[_0x547c('0xd')](_0x547c('0xe'),_0x381f2e,_0x547c('0xf'));logger[_0x547c('0x10')](_0x547c('0x11'),_0x381f2e,_0x547c('0xf'),JSON[_0x547c('0x12')](_0x10dec9));if(_0x10dec9[_0x547c('0x13')]){if(_0x10dec9['error'][_0x547c('0x14')]===0x1f4){logger[_0x547c('0x13')]('JscriptySessionReport,\x20%s,\x20%s',_0x381f2e,_0x10dec9[_0x547c('0x13')][_0x547c('0x15')]);return _0x4ef079(_0x10dec9[_0x547c('0x13')][_0x547c('0x15')]);}logger[_0x547c('0x13')](_0x547c('0xe'),_0x381f2e,_0x10dec9[_0x547c('0x13')][_0x547c('0x15')]);return _0x12fb7d(_0x10dec9[_0x547c('0x13')][_0x547c('0x15')]);}else{logger[_0x547c('0xd')](_0x547c('0xe'),_0x381f2e,_0x547c('0xf'));_0x12fb7d(_0x10dec9[_0x547c('0x16')][_0x547c('0x15')]);}})[_0x547c('0x17')](function(_0x39498d){logger[_0x547c('0x13')]('JscriptySessionReport,\x20%s,\x20%s',_0x381f2e,_0x39498d);_0x4ef079(_0x39498d);});});} \ No newline at end of file +var _0x2da6=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','then','info','JscriptySessionReport,\x20%s,\x20%s','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment'];(function(_0x4f9b18,_0x2cb5ca){var _0x29f20c=function(_0x268b3d){while(--_0x268b3d){_0x4f9b18['push'](_0x4f9b18['shift']());}};_0x29f20c(++_0x2cb5ca);}(_0x2da6,0x1dd));var _0x62da=function(_0xbce6f6,_0x3a318a){_0xbce6f6=_0xbce6f6-0x0;var _0x24ff2e=_0x2da6[_0xbce6f6];return _0x24ff2e;};'use strict';var _=require(_0x62da('0x0'));var util=require(_0x62da('0x1'));var moment=require(_0x62da('0x2'));var BPromise=require(_0x62da('0x3'));var rs=require(_0x62da('0x4'));var fs=require('fs');var Redis=require(_0x62da('0x5'));var db=require(_0x62da('0x6'))['db'];var utils=require(_0x62da('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x62da('0x8'));var jayson=require(_0x62da('0x9'));var client=jayson[_0x62da('0xa')][_0x62da('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x100e73,_0x9d9139,_0x310c15){return new BPromise(function(_0x16f919,_0xbfd2b0){return client['request'](_0x100e73,_0x310c15)[_0x62da('0xc')](function(_0x2a3937){logger[_0x62da('0xd')](_0x62da('0xe'),_0x9d9139,'request\x20sent');logger[_0x62da('0xf')](_0x62da('0x10'),_0x9d9139,_0x62da('0x11'),JSON[_0x62da('0x12')](_0x2a3937));if(_0x2a3937[_0x62da('0x13')]){if(_0x2a3937['error'][_0x62da('0x14')]===0x1f4){logger[_0x62da('0x13')](_0x62da('0xe'),_0x9d9139,_0x2a3937[_0x62da('0x13')][_0x62da('0x15')]);return _0xbfd2b0(_0x2a3937['error']['message']);}logger[_0x62da('0x13')](_0x62da('0xe'),_0x9d9139,_0x2a3937[_0x62da('0x13')][_0x62da('0x15')]);return _0x16f919(_0x2a3937[_0x62da('0x13')][_0x62da('0x15')]);}else{logger[_0x62da('0xd')](_0x62da('0xe'),_0x9d9139,_0x62da('0x11'));_0x16f919(_0x2a3937[_0x62da('0x16')][_0x62da('0x15')]);}})[_0x62da('0x17')](function(_0x1f6bc8){logger[_0x62da('0x13')]('JscriptySessionReport,\x20%s,\x20%s',_0x9d9139,_0x1f6bc8);_0xbfd2b0(_0x1f6bc8);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index 8c8da7c..0a8592b 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 _0x4b5f=['fs-extra','../../components/auth/service','../../components/interaction/service','./license.controller','get','index','put','/:id','update','/download_log_file','downloadLogFile','exports','multer','util','path','connect-timeout','express'];(function(_0x6eb833,_0x2bb5e5){var _0xdfc38c=function(_0x13c4a4){while(--_0x13c4a4){_0x6eb833['push'](_0x6eb833['shift']());}};_0xdfc38c(++_0x2bb5e5);}(_0x4b5f,0x14f));var _0xf4b5=function(_0x151b2a,_0x2b88b8){_0x151b2a=_0x151b2a-0x0;var _0x5c2c04=_0x4b5f[_0x151b2a];return _0x5c2c04;};'use strict';var multer=require(_0xf4b5('0x0'));var util=require(_0xf4b5('0x1'));var path=require(_0xf4b5('0x2'));var timeout=require(_0xf4b5('0x3'));var express=require(_0xf4b5('0x4'));var router=express['Router']();var fs_extra=require(_0xf4b5('0x5'));var auth=require(_0xf4b5('0x6'));var interaction=require(_0xf4b5('0x7'));var config=require('../../config/environment');var controller=require(_0xf4b5('0x8'));router[_0xf4b5('0x9')]('/',controller[_0xf4b5('0xa')]);router[_0xf4b5('0xb')](_0xf4b5('0xc'),auth['isAuthenticated'](),controller[_0xf4b5('0xd')]);router['get'](_0xf4b5('0xe'),auth['isAuthenticated'](),controller[_0xf4b5('0xf')]);module[_0xf4b5('0x10')]=router; \ No newline at end of file +var _0x2eb5=['/download_log_file','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./license.controller','get','put','/:id','isAuthenticated','update'];(function(_0x9bf8e3,_0x3d1853){var _0x25d637=function(_0xe054d3){while(--_0xe054d3){_0x9bf8e3['push'](_0x9bf8e3['shift']());}};_0x25d637(++_0x3d1853);}(_0x2eb5,0x1f0));var _0x52eb=function(_0x26bd26,_0x1ea668){_0x26bd26=_0x26bd26-0x0;var _0x487b2a=_0x2eb5[_0x26bd26];return _0x487b2a;};'use strict';var multer=require(_0x52eb('0x0'));var util=require(_0x52eb('0x1'));var path=require(_0x52eb('0x2'));var timeout=require(_0x52eb('0x3'));var express=require('express');var router=express[_0x52eb('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x52eb('0x5'));var interaction=require(_0x52eb('0x6'));var config=require(_0x52eb('0x7'));var controller=require(_0x52eb('0x8'));router[_0x52eb('0x9')]('/',controller['index']);router[_0x52eb('0xa')](_0x52eb('0xb'),auth[_0x52eb('0xc')](),controller[_0x52eb('0xd')]);router[_0x52eb('0x9')](_0x52eb('0xe'),auth[_0x52eb('0xc')](),controller['downloadLogFile']);module['exports']=router; \ No newline at end of file diff --git a/server/api/license/license.attributes.js b/server/api/license/license.attributes.js index a9828bf..03ca9e4 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 _0x7e54=['TEXT','STRING','INTEGER','sequelize','exports'];(function(_0x35561d,_0x59a5cf){var _0x2ccc5b=function(_0x6d37d2){while(--_0x6d37d2){_0x35561d['push'](_0x35561d['shift']());}};_0x2ccc5b(++_0x59a5cf);}(_0x7e54,0x67));var _0x47e5=function(_0x4b224d,_0x3b7195){_0x4b224d=_0x4b224d-0x0;var _0x3d7a9a=_0x7e54[_0x4b224d];return _0x3d7a9a;};'use strict';var Sequelize=require(_0x47e5('0x0'));module[_0x47e5('0x1')]={'license':{'type':Sequelize[_0x47e5('0x2')]},'data1':{'type':Sequelize[_0x47e5('0x3')]},'data2':{'type':Sequelize[_0x47e5('0x3')]},'chatLicenseExceeded':{'type':Sequelize[_0x47e5('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x6a4c=['STRING','INTEGER','sequelize','exports','TEXT'];(function(_0x56de3f,_0x3c430f){var _0x14e442=function(_0x336e8d){while(--_0x336e8d){_0x56de3f['push'](_0x56de3f['shift']());}};_0x14e442(++_0x3c430f);}(_0x6a4c,0x93));var _0xc6a4=function(_0x21fce2,_0x59a075){_0x21fce2=_0x21fce2-0x0;var _0x30f704=_0x6a4c[_0x21fce2];return _0x30f704;};'use strict';var Sequelize=require(_0xc6a4('0x0'));module[_0xc6a4('0x1')]={'license':{'type':Sequelize[_0xc6a4('0x2')]},'data1':{'type':Sequelize[_0xc6a4('0x3')]},'data2':{'type':Sequelize[_0xc6a4('0x3')]},'chatLicenseExceeded':{'type':Sequelize[_0xc6a4('0x4')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/license/license.controller.js b/server/api/license/license.controller.js index 207681d..04ed984 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 _0x7335=['../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','reject','update','destroy','then','error','stack','name','send','index','model','keys','rawAttributes','query','filters','intersection','attributes','fields','length','merge','getLicense','catch','body','License','find','params','get','checkLicense','key','downloadLogFile','license-info.log','join','/var','log','setHeader','attachment;\x20filename=','download','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse'];(function(_0xbaa13a,_0x1bebea){var _0x3a3642=function(_0x234fc7){while(--_0x234fc7){_0xbaa13a['push'](_0xbaa13a['shift']());}};_0x3a3642(++_0x1bebea);}(_0x7335,0x1cc));var _0x5733=function(_0x1203f,_0x554bbc){_0x1203f=_0x1203f-0x0;var _0x365f0a=_0x7335[_0x1203f];return _0x365f0a;};'use strict';var emlformat=require(_0x5733('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5733('0x1'));var jsonpatch=require(_0x5733('0x2'));var rp=require(_0x5733('0x3'));var moment=require(_0x5733('0x4'));var BPromise=require(_0x5733('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x5733('0x6'));var sox=require(_0x5733('0x7'));var csv=require(_0x5733('0x8'));var ejs=require(_0x5733('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5733('0xa'));var squel=require(_0x5733('0xb'));var crypto=require('crypto');var jsforce=require(_0x5733('0xc'));var deskjs=require(_0x5733('0xd'));var toCsv=require(_0x5733('0x8'));var querystring=require(_0x5733('0xe'));var Papa=require(_0x5733('0xf'));var Redis=require('ioredis');var authService=require(_0x5733('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x5733('0x11'));var hardwareService=require(_0x5733('0x12'));var logger=require(_0x5733('0x13'))('api');var utils=require(_0x5733('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x5733('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4c4fcc,_0x154ab6){_0x154ab6=_0x154ab6||0xcc;return function(_0x352004){if(_0x352004){return _0x4c4fcc[_0x5733('0x16')](_0x154ab6);}return _0x4c4fcc[_0x5733('0x17')](_0x154ab6)[_0x5733('0x18')]();};}function respondWithResult(_0x286a7e,_0x2b0a1d){_0x2b0a1d=_0x2b0a1d||0xc8;return function(_0x14316d){if(_0x14316d){return _0x286a7e['status'](_0x2b0a1d)[_0x5733('0x19')](_0x14316d);}};}function respondWithFilteredResult(_0x2f9410,_0x44a1fd){return function(_0xce15f2){if(_0xce15f2){var _0x4dbe13=typeof _0x44a1fd['offset']===_0x5733('0x1a')&&typeof _0x44a1fd['limit']==='undefined';var _0x4738fc=_0xce15f2[_0x5733('0x1b')];var _0x1b625d=_0x4dbe13?0x0:_0x44a1fd[_0x5733('0x1c')];var _0xe17ddd=_0x4dbe13?_0xce15f2[_0x5733('0x1b')]:_0x44a1fd['offset']+_0x44a1fd[_0x5733('0x1d')];var _0x2087b0;if(_0xe17ddd>=_0x4738fc){_0xe17ddd=_0x4738fc;_0x2087b0=0xc8;}else{_0x2087b0=0xce;}_0x2f9410[_0x5733('0x17')](_0x2087b0);return _0x2f9410[_0x5733('0x1e')](_0x5733('0x1f'),_0x1b625d+'-'+_0xe17ddd+'/'+_0x4738fc)[_0x5733('0x19')](_0xce15f2);}return null;};}function patchUpdates(_0x14c2a8){return function(_0x3b091b){try{jsonpatch['apply'](_0x3b091b,_0x14c2a8,!![]);}catch(_0x2154e8){return BPromise[_0x5733('0x20')](_0x2154e8);}return _0x3b091b['save']();};}function saveUpdates(_0x5d791d,_0x268b73){return function(_0x55b309){if(_0x55b309){return _0x55b309[_0x5733('0x21')](_0x5d791d)['then'](function(_0x546de2){return _0x546de2;});}return null;};}function removeEntity(_0x466d42,_0x118206){return function(_0x4fe10f){if(_0x4fe10f){return _0x4fe10f[_0x5733('0x22')]()[_0x5733('0x23')](function(){_0x466d42[_0x5733('0x17')](0xcc)[_0x5733('0x18')]();});}};}function handleEntityNotFound(_0x5a44d4,_0x186ce7){return function(_0x4c6256){if(!_0x4c6256){_0x5a44d4['sendStatus'](0x194);}return _0x4c6256;};}function handleError(_0x105bb6,_0x3f8d21){_0x3f8d21=_0x3f8d21||0x1f4;return function(_0x23e054){logger[_0x5733('0x24')](_0x23e054[_0x5733('0x25')]);if(_0x23e054[_0x5733('0x26')]){delete _0x23e054[_0x5733('0x26')];}_0x105bb6[_0x5733('0x17')](_0x3f8d21)[_0x5733('0x27')](_0x23e054);};}var utilLicense=require(_0x5733('0x15'));exports[_0x5733('0x28')]=function(_0x284bde,_0x33c727){var _0x127ae7={'raw':!![],'where':{'id':0x1}},_0x318702={};_0x318702[_0x5733('0x29')]=_[_0x5733('0x2a')](db['License'][_0x5733('0x2b')]);_0x318702[_0x5733('0x2c')]=_[_0x5733('0x2a')](_0x284bde[_0x5733('0x2c')]);_0x318702[_0x5733('0x2d')]=_[_0x5733('0x2e')](_0x318702['model'],_0x318702[_0x5733('0x2c')]);_0x127ae7[_0x5733('0x2f')]=_[_0x5733('0x2e')](_0x318702[_0x5733('0x29')],qs['fields'](_0x284bde[_0x5733('0x2c')][_0x5733('0x30')]));_0x127ae7[_0x5733('0x2f')]=_0x127ae7[_0x5733('0x2f')][_0x5733('0x31')]?_0x127ae7[_0x5733('0x2f')]:_0x318702[_0x5733('0x29')];_0x127ae7=_[_0x5733('0x32')]({},_0x127ae7,_0x284bde['options']);return utilLicense[_0x5733('0x33')](_0x127ae7)[_0x5733('0x23')](respondWithResult(_0x33c727,null))[_0x5733('0x34')](handleError(_0x33c727,null));};exports[_0x5733('0x21')]=function(_0x272180,_0x2df1f8){if(_0x272180[_0x5733('0x35')]['id']){delete _0x272180[_0x5733('0x35')]['id'];}return db[_0x5733('0x36')][_0x5733('0x37')]({'where':{'id':_0x272180[_0x5733('0x38')]['id']}})[_0x5733('0x23')](handleEntityNotFound(_0x2df1f8,null))[_0x5733('0x23')](function(_0x479bdf){var _0x4ae875=_0x479bdf[_0x5733('0x39')]({'plain':!![]});return utilLicense[_0x5733('0x3a')](_0x4ae875,_0x272180['body'][_0x5733('0x3b')]);})[_0x5733('0x23')](function(_0x1086e1){if(!_0x1086e1['demo']){return saveUpdates(_0x272180[_0x5733('0x35')],null);}return _0x1086e1;})[_0x5733('0x23')](respondWithResult(_0x2df1f8,null))[_0x5733('0x34')](handleError(_0x2df1f8,null));};exports[_0x5733('0x3c')]=function(_0x57eaab,_0x5ce311){var _0x4773b6=_0x5733('0x3d');var _0x2d6c6a=path[_0x5733('0x3e')](_0x5733('0x3f'),_0x5733('0x40'),'xcally',_0x4773b6);_0x5ce311[_0x5733('0x41')]('Content-disposition',_0x5733('0x42')+_0x4773b6);_0x5ce311['set']('Content-Type','text/plain');_0x5ce311[_0x5733('0x43')](_0x2d6c6a);}; \ No newline at end of file +var _0x7433=['request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','jsforce','desk.js','papaparse','../../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','update','destroy','error','stack','name','send','index','model','keys','License','rawAttributes','query','filters','intersection','fields','attributes','length','options','getLicense','then','catch','body','params','get','checkLicense','key','demo','license-info.log','join','/var','log','xcally','setHeader','Content-disposition','attachment;\x20filename=','Content-Type','text/plain','download','eml-format','zip-dir','fast-json-patch'];(function(_0x33e393,_0x44ba2e){var _0x182281=function(_0x222c6b){while(--_0x222c6b){_0x33e393['push'](_0x33e393['shift']());}};_0x182281(++_0x44ba2e);}(_0x7433,0x1e7));var _0x3743=function(_0x3d7add,_0x37bdfe){_0x3d7add=_0x3d7add-0x0;var _0x55e63b=_0x7433[_0x3d7add];return _0x55e63b;};'use strict';var emlformat=require(_0x3743('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3743('0x1'));var jsonpatch=require(_0x3743('0x2'));var rp=require(_0x3743('0x3'));var moment=require('moment');var BPromise=require(_0x3743('0x4'));var Mustache=require(_0x3743('0x5'));var util=require(_0x3743('0x6'));var path=require(_0x3743('0x7'));var sox=require(_0x3743('0x8'));var csv=require('to-csv');var ejs=require(_0x3743('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3743('0xa'));var squel=require(_0x3743('0xb'));var crypto=require('crypto');var jsforce=require(_0x3743('0xc'));var deskjs=require(_0x3743('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x3743('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x3743('0xf'));var as=require(_0x3743('0x10'));var hardwareService=require(_0x3743('0x11'));var logger=require(_0x3743('0x12'))('api');var utils=require('../../config/utils');var config=require(_0x3743('0x13'));var licenseUtil=require(_0x3743('0x14'));var db=require(_0x3743('0x15'))['db'];function respondWithStatusCode(_0x3c7ce7,_0x374bb0){_0x374bb0=_0x374bb0||0xcc;return function(_0x33fb88){if(_0x33fb88){return _0x3c7ce7[_0x3743('0x16')](_0x374bb0);}return _0x3c7ce7[_0x3743('0x17')](_0x374bb0)[_0x3743('0x18')]();};}function respondWithResult(_0x54d297,_0x5da0e7){_0x5da0e7=_0x5da0e7||0xc8;return function(_0x1656d3){if(_0x1656d3){return _0x54d297[_0x3743('0x17')](_0x5da0e7)[_0x3743('0x19')](_0x1656d3);}};}function respondWithFilteredResult(_0x114d07,_0x3ea89b){return function(_0x3f0bb3){if(_0x3f0bb3){var _0x1ae62a=typeof _0x3ea89b[_0x3743('0x1a')]===_0x3743('0x1b')&&typeof _0x3ea89b[_0x3743('0x1c')]==='undefined';var _0x5e0d69=_0x3f0bb3[_0x3743('0x1d')];var _0x31227f=_0x1ae62a?0x0:_0x3ea89b[_0x3743('0x1a')];var _0x150615=_0x1ae62a?_0x3f0bb3['count']:_0x3ea89b['offset']+_0x3ea89b[_0x3743('0x1c')];var _0x30c426;if(_0x150615>=_0x5e0d69){_0x150615=_0x5e0d69;_0x30c426=0xc8;}else{_0x30c426=0xce;}_0x114d07[_0x3743('0x17')](_0x30c426);return _0x114d07[_0x3743('0x1e')](_0x3743('0x1f'),_0x31227f+'-'+_0x150615+'/'+_0x5e0d69)['json'](_0x3f0bb3);}return null;};}function patchUpdates(_0x347f87){return function(_0x5f48e7){try{jsonpatch['apply'](_0x5f48e7,_0x347f87,!![]);}catch(_0x44136c){return BPromise['reject'](_0x44136c);}return _0x5f48e7['save']();};}function saveUpdates(_0x20cad9,_0x8e6c59){return function(_0x96a803){if(_0x96a803){return _0x96a803[_0x3743('0x20')](_0x20cad9)['then'](function(_0x2c77ad){return _0x2c77ad;});}return null;};}function removeEntity(_0x3a5fcc,_0x3a56e5){return function(_0x1cf884){if(_0x1cf884){return _0x1cf884[_0x3743('0x21')]()['then'](function(){_0x3a5fcc[_0x3743('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x31410f,_0x12dc09){return function(_0x94d42c){if(!_0x94d42c){_0x31410f[_0x3743('0x16')](0x194);}return _0x94d42c;};}function handleError(_0x34a9ff,_0x4beecd){_0x4beecd=_0x4beecd||0x1f4;return function(_0x40dc72){logger[_0x3743('0x22')](_0x40dc72[_0x3743('0x23')]);if(_0x40dc72[_0x3743('0x24')]){delete _0x40dc72[_0x3743('0x24')];}_0x34a9ff[_0x3743('0x17')](_0x4beecd)[_0x3743('0x25')](_0x40dc72);};}var utilLicense=require(_0x3743('0x14'));exports[_0x3743('0x26')]=function(_0x2d34f1,_0xc4a641){var _0x518525={'raw':!![],'where':{'id':0x1}},_0x13c55b={};_0x13c55b[_0x3743('0x27')]=_[_0x3743('0x28')](db[_0x3743('0x29')][_0x3743('0x2a')]);_0x13c55b[_0x3743('0x2b')]=_['keys'](_0x2d34f1[_0x3743('0x2b')]);_0x13c55b[_0x3743('0x2c')]=_[_0x3743('0x2d')](_0x13c55b[_0x3743('0x27')],_0x13c55b[_0x3743('0x2b')]);_0x518525['attributes']=_['intersection'](_0x13c55b[_0x3743('0x27')],qs[_0x3743('0x2e')](_0x2d34f1[_0x3743('0x2b')]['fields']));_0x518525[_0x3743('0x2f')]=_0x518525[_0x3743('0x2f')][_0x3743('0x30')]?_0x518525[_0x3743('0x2f')]:_0x13c55b[_0x3743('0x27')];_0x518525=_['merge']({},_0x518525,_0x2d34f1[_0x3743('0x31')]);return utilLicense[_0x3743('0x32')](_0x518525)[_0x3743('0x33')](respondWithResult(_0xc4a641,null))[_0x3743('0x34')](handleError(_0xc4a641,null));};exports[_0x3743('0x20')]=function(_0x4436cc,_0x13e4be){if(_0x4436cc[_0x3743('0x35')]['id']){delete _0x4436cc[_0x3743('0x35')]['id'];}return db[_0x3743('0x29')]['find']({'where':{'id':_0x4436cc[_0x3743('0x36')]['id']}})[_0x3743('0x33')](handleEntityNotFound(_0x13e4be,null))[_0x3743('0x33')](function(_0x282ab4){var _0x3d414c=_0x282ab4[_0x3743('0x37')]({'plain':!![]});return utilLicense[_0x3743('0x38')](_0x3d414c,_0x4436cc[_0x3743('0x35')][_0x3743('0x39')]);})[_0x3743('0x33')](function(_0x329757){if(!_0x329757[_0x3743('0x3a')]){return saveUpdates(_0x4436cc[_0x3743('0x35')],null);}return _0x329757;})[_0x3743('0x33')](respondWithResult(_0x13e4be,null))['catch'](handleError(_0x13e4be,null));};exports['downloadLogFile']=function(_0x3aeb58,_0xa4b7b3){var _0x104145=_0x3743('0x3b');var _0x3d8fe2=path[_0x3743('0x3c')](_0x3743('0x3d'),_0x3743('0x3e'),_0x3743('0x3f'),_0x104145);_0xa4b7b3[_0x3743('0x40')](_0x3743('0x41'),_0x3743('0x42')+_0x104145);_0xa4b7b3[_0x3743('0x1e')](_0x3743('0x43'),_0x3743('0x44'));_0xa4b7b3[_0x3743('0x45')](_0x3d8fe2);}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index 5247381..d19ff58 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 _0xb180=['./license.attributes','define','License','license','lodash','util','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0xb180,0x184));var _0x0b18=function(_0x124381,_0x3e93cd){_0x124381=_0x124381-0x0;var _0x1fbff8=_0xb180[_0x124381];return _0x1fbff8;};'use strict';var _=require(_0x0b18('0x0'));var util=require(_0x0b18('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x0b18('0x2'));var BPromise=require(_0x0b18('0x3'));var rp=require(_0x0b18('0x4'));var fs=require('fs');var path=require(_0x0b18('0x5'));var rimraf=require(_0x0b18('0x6'));var config=require(_0x0b18('0x7'));var attributes=require(_0x0b18('0x8'));module['exports']=function(_0x1c8169,_0x12a24a){return _0x1c8169[_0x0b18('0x9')](_0x0b18('0xa'),attributes,{'tableName':_0x0b18('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbd42=['moment','bluebird','request-promise','define','License','license','util','../../config/logger','api'];(function(_0x47a40b,_0x443ecf){var _0x19610c=function(_0x4b8ce1){while(--_0x4b8ce1){_0x47a40b['push'](_0x47a40b['shift']());}};_0x19610c(++_0x443ecf);}(_0xbd42,0x1c8));var _0x2bd4=function(_0x5cd66b,_0x456626){_0x5cd66b=_0x5cd66b-0x0;var _0x212c9e=_0xbd42[_0x5cd66b];return _0x212c9e;};'use strict';var _=require('lodash');var util=require(_0x2bd4('0x0'));var logger=require(_0x2bd4('0x1'))(_0x2bd4('0x2'));var moment=require(_0x2bd4('0x3'));var BPromise=require(_0x2bd4('0x4'));var rp=require(_0x2bd4('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./license.attributes');module['exports']=function(_0x179d24,_0x239f0a){return _0x179d24[_0x2bd4('0x6')](_0x2bd4('0x7'),attributes,{'tableName':_0x2bd4('0x8'),'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 fb6c095..ee6f68d 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 _0xf093=['result','catch','util','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','License,\x20%s,\x20%s','request\x20sent','debug','License,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x4ba861,_0x2518c5){var _0x3dea9f=function(_0x2fcc91){while(--_0x2fcc91){_0x4ba861['push'](_0x4ba861['shift']());}};_0x3dea9f(++_0x2518c5);}(_0xf093,0x13d));var _0x3f09=function(_0x4cb135,_0x2ab5ca){_0x4cb135=_0x4cb135-0x0;var _0x1a8c84=_0xf093[_0x4cb135];return _0x1a8c84;};'use strict';var _=require('lodash');var util=require(_0x3f09('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3f09('0x1'))['db'];var utils=require(_0x3f09('0x2'));var logger=require(_0x3f09('0x3'))(_0x3f09('0x4'));var config=require(_0x3f09('0x5'));var jayson=require(_0x3f09('0x6'));var client=jayson[_0x3f09('0x7')][_0x3f09('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1c8354,_0x5c82d5,_0x3fb755){return new BPromise(function(_0x3dca03,_0x887b5d){return client[_0x3f09('0x9')](_0x1c8354,_0x3fb755)[_0x3f09('0xa')](function(_0x7ebcaa){logger[_0x3f09('0xb')](_0x3f09('0xc'),_0x5c82d5,_0x3f09('0xd'));logger[_0x3f09('0xe')](_0x3f09('0xf'),_0x5c82d5,'request\x20sent',JSON[_0x3f09('0x10')](_0x7ebcaa));if(_0x7ebcaa['error']){if(_0x7ebcaa[_0x3f09('0x11')]['code']===0x1f4){logger[_0x3f09('0x11')](_0x3f09('0xc'),_0x5c82d5,_0x7ebcaa[_0x3f09('0x11')]['message']);return _0x887b5d(_0x7ebcaa[_0x3f09('0x11')][_0x3f09('0x12')]);}logger[_0x3f09('0x11')](_0x3f09('0xc'),_0x5c82d5,_0x7ebcaa['error'][_0x3f09('0x12')]);return _0x3dca03(_0x7ebcaa[_0x3f09('0x11')][_0x3f09('0x12')]);}else{logger['info'](_0x3f09('0xc'),_0x5c82d5,_0x3f09('0xd'));_0x3dca03(_0x7ebcaa[_0x3f09('0x13')][_0x3f09('0x12')]);}})[_0x3f09('0x14')](function(_0x1be622){logger['error'](_0x3f09('0xc'),_0x5c82d5,_0x1be622);_0x887b5d(_0x1be622);});});} \ No newline at end of file +var _0x2655=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','License,\x20%s,\x20%s','request\x20sent','License,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util'];(function(_0x41fced,_0x151348){var _0x399570=function(_0x34168a){while(--_0x34168a){_0x41fced['push'](_0x41fced['shift']());}};_0x399570(++_0x151348);}(_0x2655,0x1c6));var _0x5265=function(_0x213b79,_0x445b0f){_0x213b79=_0x213b79-0x0;var _0x6f1880=_0x2655[_0x213b79];return _0x6f1880;};'use strict';var _=require(_0x5265('0x0'));var util=require(_0x5265('0x1'));var moment=require(_0x5265('0x2'));var BPromise=require(_0x5265('0x3'));var rs=require(_0x5265('0x4'));var fs=require('fs');var Redis=require(_0x5265('0x5'));var db=require(_0x5265('0x6'))['db'];var utils=require(_0x5265('0x7'));var logger=require(_0x5265('0x8'))(_0x5265('0x9'));var config=require(_0x5265('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x5265('0xb')][_0x5265('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3e6f23,_0xe87a5a,_0x4579fb){return new BPromise(function(_0x57f21f,_0x3ad3ae){return client[_0x5265('0xd')](_0x3e6f23,_0x4579fb)['then'](function(_0x5ee66a){logger['info'](_0x5265('0xe'),_0xe87a5a,_0x5265('0xf'));logger['debug'](_0x5265('0x10'),_0xe87a5a,_0x5265('0xf'),JSON[_0x5265('0x11')](_0x5ee66a));if(_0x5ee66a[_0x5265('0x12')]){if(_0x5ee66a[_0x5265('0x12')][_0x5265('0x13')]===0x1f4){logger[_0x5265('0x12')]('License,\x20%s,\x20%s',_0xe87a5a,_0x5ee66a[_0x5265('0x12')][_0x5265('0x14')]);return _0x3ad3ae(_0x5ee66a[_0x5265('0x12')]['message']);}logger[_0x5265('0x12')](_0x5265('0xe'),_0xe87a5a,_0x5ee66a[_0x5265('0x12')][_0x5265('0x14')]);return _0x57f21f(_0x5ee66a[_0x5265('0x12')][_0x5265('0x14')]);}else{logger[_0x5265('0x15')](_0x5265('0xe'),_0xe87a5a,_0x5265('0xf'));_0x57f21f(_0x5ee66a[_0x5265('0x16')][_0x5265('0x14')]);}})[_0x5265('0x17')](function(_0x1b08c7){logger[_0x5265('0x12')](_0x5265('0xe'),_0xe87a5a,_0x1b08c7);_0x3ad3ae(_0x1b08c7);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index 378e988..60beb68 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 _0xea24=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','show','getDispositions','getAnswers','/:id/in_servers','/:id/out_servers','/:id/interactions','/:id/applications','getApplications','/:id/messages','/:id/verify','/:id/users','post','create','addImap','/:id/send','send','addAgents','update','removeDispositions','delete','/:id/canned_answers','removeAnswers','removeSmtp','destroy','removeAgents','exports','util'];(function(_0x259c7f,_0x22e2d9){var _0x8c2ff5=function(_0x16a336){while(--_0x16a336){_0x259c7f['push'](_0x259c7f['shift']());}};_0x8c2ff5(++_0x22e2d9);}(_0xea24,0x147));var _0x4ea2=function(_0xe5256e,_0x144410){_0xe5256e=_0xe5256e-0x0;var _0x17cf68=_0xea24[_0xe5256e];return _0x17cf68;};'use strict';var multer=require('multer');var util=require(_0x4ea2('0x0'));var path=require('path');var timeout=require(_0x4ea2('0x1'));var express=require(_0x4ea2('0x2'));var router=express[_0x4ea2('0x3')]();var fs_extra=require(_0x4ea2('0x4'));var auth=require(_0x4ea2('0x5'));var interaction=require(_0x4ea2('0x6'));var config=require(_0x4ea2('0x7'));var controller=require(_0x4ea2('0x8'));router[_0x4ea2('0x9')]('/',auth[_0x4ea2('0xa')](),controller[_0x4ea2('0xb')]);router[_0x4ea2('0x9')](_0x4ea2('0xc'),auth[_0x4ea2('0xa')](),controller[_0x4ea2('0xd')]);router[_0x4ea2('0x9')](_0x4ea2('0xe'),auth[_0x4ea2('0xa')](),controller[_0x4ea2('0xf')]);router[_0x4ea2('0x9')]('/:id/dispositions',auth[_0x4ea2('0xa')](),controller[_0x4ea2('0x10')]);router[_0x4ea2('0x9')]('/:id/canned_answers',auth[_0x4ea2('0xa')](),controller[_0x4ea2('0x11')]);router[_0x4ea2('0x9')](_0x4ea2('0x12'),auth['isAuthenticated'](),controller['getImap']);router[_0x4ea2('0x9')](_0x4ea2('0x13'),auth[_0x4ea2('0xa')](),controller['getSmtp']);router[_0x4ea2('0x9')](_0x4ea2('0x14'),auth[_0x4ea2('0xa')](),controller['getInteractions']);router['get'](_0x4ea2('0x15'),auth[_0x4ea2('0xa')](),controller[_0x4ea2('0x16')]);router[_0x4ea2('0x9')](_0x4ea2('0x17'),auth[_0x4ea2('0xa')](),controller['getMessages']);router[_0x4ea2('0x9')](_0x4ea2('0x18'),auth[_0x4ea2('0xa')](),controller['verifySmtp']);router[_0x4ea2('0x9')](_0x4ea2('0x19'),auth[_0x4ea2('0xa')](),controller['getAgents']);router[_0x4ea2('0x1a')]('/:id/dispositions',auth[_0x4ea2('0xa')](),controller['addDisposition']);router[_0x4ea2('0x1a')]('/:id/canned_answers',auth[_0x4ea2('0xa')](),controller['addAnswer']);router[_0x4ea2('0x1a')]('/',auth[_0x4ea2('0xa')](),controller[_0x4ea2('0x1b')]);router[_0x4ea2('0x1a')](_0x4ea2('0x12'),auth['isAuthenticated'](),controller[_0x4ea2('0x1c')]);router[_0x4ea2('0x1a')](_0x4ea2('0x13'),auth[_0x4ea2('0xa')](),controller['addSmtp']);router['post']('/:id/interactions',auth[_0x4ea2('0xa')](),controller['addInteraction']);router[_0x4ea2('0x1a')](_0x4ea2('0x15'),auth[_0x4ea2('0xa')](),controller['addApplications']);router['post'](_0x4ea2('0x1d'),auth[_0x4ea2('0xa')](),controller[_0x4ea2('0x1e')]);router[_0x4ea2('0x1a')](_0x4ea2('0x19'),auth[_0x4ea2('0xa')](),controller[_0x4ea2('0x1f')]);router['put'](_0x4ea2('0xe'),auth[_0x4ea2('0xa')](),controller[_0x4ea2('0x20')]);router['delete']('/:id/dispositions',auth['isAuthenticated'](),controller[_0x4ea2('0x21')]);router[_0x4ea2('0x22')](_0x4ea2('0x23'),auth[_0x4ea2('0xa')](),controller[_0x4ea2('0x24')]);router[_0x4ea2('0x22')](_0x4ea2('0x12'),auth[_0x4ea2('0xa')](),controller['removeImap']);router[_0x4ea2('0x22')](_0x4ea2('0x13'),auth['isAuthenticated'](),controller[_0x4ea2('0x25')]);router[_0x4ea2('0x22')](_0x4ea2('0xe'),auth['isAuthenticated'](),controller[_0x4ea2('0x26')]);router[_0x4ea2('0x22')](_0x4ea2('0x19'),auth[_0x4ea2('0xa')](),controller[_0x4ea2('0x27')]);module[_0x4ea2('0x28')]=router; \ No newline at end of file +var _0x0ba6=['describe','/:id','show','getDispositions','/:id/canned_answers','getAnswers','/:id/in_servers','/:id/out_servers','getSmtp','/:id/interactions','getInteractions','getApplications','/:id/messages','getMessages','/:id/verify','verifySmtp','getAgents','post','/:id/dispositions','addDisposition','addAnswer','create','addImap','addInteraction','/:id/applications','addApplications','/:id/send','send','/:id/users','addAgents','put','update','delete','removeDispositions','removeAnswers','removeImap','removeSmtp','removeAgents','multer','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailAccount.controller','get','isAuthenticated','index','/describe'];(function(_0x15185f,_0x2003a5){var _0x3c9c47=function(_0x2862f7){while(--_0x2862f7){_0x15185f['push'](_0x15185f['shift']());}};_0x3c9c47(++_0x2003a5);}(_0x0ba6,0x1df));var _0x60ba=function(_0x409353,_0xe9f04d){_0x409353=_0x409353-0x0;var _0x4f4b59=_0x0ba6[_0x409353];return _0x4f4b59;};'use strict';var multer=require(_0x60ba('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x60ba('0x1')]();var fs_extra=require(_0x60ba('0x2'));var auth=require(_0x60ba('0x3'));var interaction=require(_0x60ba('0x4'));var config=require(_0x60ba('0x5'));var controller=require(_0x60ba('0x6'));router[_0x60ba('0x7')]('/',auth[_0x60ba('0x8')](),controller[_0x60ba('0x9')]);router[_0x60ba('0x7')](_0x60ba('0xa'),auth['isAuthenticated'](),controller[_0x60ba('0xb')]);router[_0x60ba('0x7')](_0x60ba('0xc'),auth['isAuthenticated'](),controller[_0x60ba('0xd')]);router[_0x60ba('0x7')]('/:id/dispositions',auth[_0x60ba('0x8')](),controller[_0x60ba('0xe')]);router[_0x60ba('0x7')](_0x60ba('0xf'),auth[_0x60ba('0x8')](),controller[_0x60ba('0x10')]);router['get'](_0x60ba('0x11'),auth[_0x60ba('0x8')](),controller['getImap']);router['get'](_0x60ba('0x12'),auth[_0x60ba('0x8')](),controller[_0x60ba('0x13')]);router['get'](_0x60ba('0x14'),auth['isAuthenticated'](),controller[_0x60ba('0x15')]);router[_0x60ba('0x7')]('/:id/applications',auth[_0x60ba('0x8')](),controller[_0x60ba('0x16')]);router['get'](_0x60ba('0x17'),auth[_0x60ba('0x8')](),controller[_0x60ba('0x18')]);router[_0x60ba('0x7')](_0x60ba('0x19'),auth['isAuthenticated'](),controller[_0x60ba('0x1a')]);router[_0x60ba('0x7')]('/:id/users',auth[_0x60ba('0x8')](),controller[_0x60ba('0x1b')]);router[_0x60ba('0x1c')](_0x60ba('0x1d'),auth[_0x60ba('0x8')](),controller[_0x60ba('0x1e')]);router[_0x60ba('0x1c')](_0x60ba('0xf'),auth[_0x60ba('0x8')](),controller[_0x60ba('0x1f')]);router['post']('/',auth['isAuthenticated'](),controller[_0x60ba('0x20')]);router[_0x60ba('0x1c')](_0x60ba('0x11'),auth['isAuthenticated'](),controller[_0x60ba('0x21')]);router[_0x60ba('0x1c')](_0x60ba('0x12'),auth[_0x60ba('0x8')](),controller['addSmtp']);router[_0x60ba('0x1c')](_0x60ba('0x14'),auth['isAuthenticated'](),controller[_0x60ba('0x22')]);router[_0x60ba('0x1c')](_0x60ba('0x23'),auth['isAuthenticated'](),controller[_0x60ba('0x24')]);router[_0x60ba('0x1c')](_0x60ba('0x25'),auth['isAuthenticated'](),controller[_0x60ba('0x26')]);router[_0x60ba('0x1c')](_0x60ba('0x27'),auth['isAuthenticated'](),controller[_0x60ba('0x28')]);router[_0x60ba('0x29')]('/:id',auth['isAuthenticated'](),controller[_0x60ba('0x2a')]);router[_0x60ba('0x2b')](_0x60ba('0x1d'),auth[_0x60ba('0x8')](),controller[_0x60ba('0x2c')]);router[_0x60ba('0x2b')](_0x60ba('0xf'),auth[_0x60ba('0x8')](),controller[_0x60ba('0x2d')]);router[_0x60ba('0x2b')](_0x60ba('0x11'),auth[_0x60ba('0x8')](),controller[_0x60ba('0x2e')]);router[_0x60ba('0x2b')]('/:id/out_servers',auth[_0x60ba('0x8')](),controller[_0x60ba('0x2f')]);router[_0x60ba('0x2b')]('/:id',auth[_0x60ba('0x8')](),controller['destroy']);router[_0x60ba('0x2b')](_0x60ba('0x27'),auth[_0x60ba('0x8')](),controller[_0x60ba('0x30')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.attributes.js b/server/api/mailAccount/mailAccount.attributes.js index 582f54b..4c941b7 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 _0x4ab0=['yahoo','getDataValue','provider','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','mandatoryDispositionPauseId','setDataValue','mandatoryDisposition','gmail','hotmail'];(function(_0x2df7a1,_0x4e4751){var _0x5c0460=function(_0x3cd734){while(--_0x3cd734){_0x2df7a1['push'](_0x2df7a1['shift']());}};_0x5c0460(++_0x4e4751);}(_0x4ab0,0x147));var _0x04ab=function(_0x308204,_0x286453){_0x308204=_0x308204-0x0;var _0x34227e=_0x4ab0[_0x308204];return _0x34227e;};'use strict';var Sequelize=require('sequelize');module[_0x04ab('0x0')]={'description':{'type':Sequelize[_0x04ab('0x1')]},'name':{'type':Sequelize[_0x04ab('0x1')],'allowNull':![]},'service':{'type':Sequelize[_0x04ab('0x2')],'defaultValue':![]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x04ab('0x2')],'defaultValue':!![]},'key':{'type':Sequelize[_0x04ab('0x1')],'allowNull':![]},'template':{'type':Sequelize[_0x04ab('0x3')]},'markAsUnread':{'type':Sequelize[_0x04ab('0x2')],'defaultValue':![]},'fontFamily':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x04ab('0x4')},'fontSize':{'type':Sequelize[_0x04ab('0x5')](0x2)[_0x04ab('0x6')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x04ab('0x7');}},'notificationSound':{'type':Sequelize[_0x04ab('0x2')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x04ab('0x2')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x04ab('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x04ab('0x2')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x04ab('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x04ab('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x04ab('0x5')],'allowNull':!![],'defaultValue':null,'comment':_0x04ab('0x8')},'mandatoryDisposition':{'type':Sequelize[_0x04ab('0x2')],'defaultValue':![],'comment':_0x04ab('0x9'),'set':function(_0x48668c){if(!_0x48668c)this['setDataValue'](_0x04ab('0xa'),null);this[_0x04ab('0xb')](_0x04ab('0xc'),_0x48668c);}},'provider':{'type':Sequelize['ENUM'](_0x04ab('0xd'),_0x04ab('0xe'),_0x04ab('0xf'),'outlook365'),'defaultValue':null,'get':function(){if(!this[_0x04ab('0x10')]('provider'))return'custom';return this[_0x04ab('0x10')](_0x04ab('0x11'));},'set':function(_0x424e0a){if(_0x424e0a==='custom')_0x424e0a=null;return this[_0x04ab('0xb')](_0x04ab('0x11'),_0x424e0a);}}}; \ No newline at end of file +var _0x0655=['outlook365','provider','custom','sequelize','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','mandatoryDispositionPauseId','mandatoryDisposition','ENUM','gmail','yahoo'];(function(_0x4188a9,_0x2a7e0a){var _0x40a6a8=function(_0x2a6434){while(--_0x2a6434){_0x4188a9['push'](_0x4188a9['shift']());}};_0x40a6a8(++_0x2a7e0a);}(_0x0655,0xdf));var _0x5065=function(_0x222550,_0x3c0a0c){_0x222550=_0x222550-0x0;var _0x58ac61=_0x0655[_0x222550];return _0x58ac61;};'use strict';var Sequelize=require(_0x5065('0x0'));module[_0x5065('0x1')]={'description':{'type':Sequelize[_0x5065('0x2')]},'name':{'type':Sequelize[_0x5065('0x2')],'allowNull':![]},'service':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize[_0x5065('0x2')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x5065('0x3')],'defaultValue':!![]},'key':{'type':Sequelize[_0x5065('0x2')],'allowNull':![]},'template':{'type':Sequelize[_0x5065('0x4')]},'markAsUnread':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x5065('0x2')],'allowNull':![],'defaultValue':_0x5065('0x5')},'fontSize':{'type':Sequelize[_0x5065('0x6')](0x2)[_0x5065('0x7')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x5065('0x4')],'defaultValue':function(){return _0x5065('0x8');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x5065('0x3')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x5065('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x5065('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x5065('0x3')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x5065('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0x5065('0x9')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x5065('0xa'),'set':function(_0x514894){if(!_0x514894)this[_0x5065('0xb')](_0x5065('0xc'),null);this['setDataValue'](_0x5065('0xd'),_0x514894);}},'provider':{'type':Sequelize[_0x5065('0xe')](_0x5065('0xf'),'hotmail',_0x5065('0x10'),_0x5065('0x11')),'defaultValue':null,'get':function(){if(!this['getDataValue']('provider'))return'custom';return this['getDataValue'](_0x5065('0x12'));},'set':function(_0x1588eb){if(_0x1588eb===_0x5065('0x13'))_0x1588eb=null;return this[_0x5065('0xb')](_0x5065('0x12'),_0x1588eb);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index 0366146..46958bb 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 _0x89d6=['sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','MailApplication','findAndCountAll','priority','stack','finally','getApplications','getMessages','MailMessage','$gte','split','YYYY-MM-DD\x20HH:mm:ss','inlineCss','CmList','List','Contacts','updatedAt','DESC','CloudProvider','Smtp\x20configuration\x20not\x20found','from','%s\x20<%s>','email','attachments','basename','getSmtpOptions','SendMail','sendMail','List\x20not\x20found','messageId','attach','format','Interaction','Messages','verifySmtp','Sequelize','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','spread','emit','removeAgents','isArray','getAgents','moment','path','lodash','juice','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','register','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','message','MailAccount,\x20%s,\x20%s','result','catch','sendStatus','status','end','json','undefined','count','offset','limit','set','update','destroy','get','MailAccounts','UserProfileResource','name','send','gmail','imap.gmail.com','yahoo','imap.mail.yahoo.com','hotmail','outlook.office365.com','Unknown\x20email\x20service\x20provider','smtp.gmail.com','smtp.mail.yahoo.com','smtp-mail.outlook.com','smtp.office365.com','user','username','password','pass','modernAuthentication','CloudProviderId','host','secure','service','authentication','port','Imap','Smtp','index','MailServerOut','MailAccount','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','map','VIRTUAL','include','params','MailServerIn','Pause','mandatoryDispositionPause','options','find','body','provider','Mail\x20Account\x20not\x20found','describe','Disposition','create','getDispositions','rawAttributes','hasOwnProperty','MailAccountId','includeAll','findAll','rows','removeDispositions','ids','addAnswer','getAnswers','findOne','CannedAnswer','ListId','isNil','active','description','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','getImap','addImap','removeImap','setImap','getSmtp','addSmtp','removeSmtp','setSmtp','addInteraction','MailInteraction','omit','getInteractions','CmContact','Contact','User','Owner','Tag','color','tag','addApplications','transaction'];(function(_0x4c67db,_0x2d99d9){var _0x563b5f=function(_0x2c198a){while(--_0x2c198a){_0x4c67db['push'](_0x4c67db['shift']());}};_0x563b5f(++_0x2d99d9);}(_0x89d6,0x1b4));var _0x689d=function(_0x1b1af9,_0x3d783d){_0x1b1af9=_0x1b1af9-0x0;var _0x53f68c=_0x89d6[_0x1b1af9];return _0x53f68c;};'use strict';var moment=require(_0x689d('0x0'));var BPromise=require('bluebird');var util=require('util');var path=require(_0x689d('0x1'));var _=require(_0x689d('0x2'));var juice=require(_0x689d('0x3'));var Redis=require(_0x689d('0x4'));var qs=require(_0x689d('0x5'));var logger=require(_0x689d('0x6'))(_0x689d('0x7'));var config=require(_0x689d('0x8'));var db=require(_0x689d('0x9'))['db'];config['redis']=_[_0x689d('0xa')](config[_0x689d('0xb')],{'host':_0x689d('0xc'),'port':0x18eb});var socket=require(_0x689d('0xd'))(new Redis(config[_0x689d('0xb')]));require('./mailAccount.socket')[_0x689d('0xe')](socket);var jayson=require(_0x689d('0xf'));var client=jayson[_0x689d('0x10')][_0x689d('0x11')]({'port':0x232b});function respondWithRpcPromise(_0x150c8e,_0x127561,_0x38eef4,_0x50b464){return new BPromise(function(_0xeb1f8,_0x55f475){var _0x55eaa1=_0x50b464||client;return _0x55eaa1[_0x689d('0x12')](_0x150c8e,_0x38eef4)[_0x689d('0x13')](function(_0x392755){logger[_0x689d('0x14')]('MailAccount,\x20%s,\x20%s',_0x127561,_0x689d('0x15'));logger[_0x689d('0x16')]('MailAccount,\x20%s,\x20%s,\x20%s',_0x127561,'request\x20sent',JSON[_0x689d('0x17')](_0x392755));if(_0x392755[_0x689d('0x18')]){if(_0x392755['error']['code']===0x1f4){logger[_0x689d('0x18')]('MailAccount,\x20%s,\x20%s',_0x127561,_0x392755[_0x689d('0x18')][_0x689d('0x19')]);return _0x55f475(_0x392755[_0x689d('0x18')][_0x689d('0x19')]);}logger[_0x689d('0x18')](_0x689d('0x1a'),_0x127561,_0x392755[_0x689d('0x18')][_0x689d('0x19')]);return _0xeb1f8(_0x392755[_0x689d('0x18')][_0x689d('0x19')]);}else{logger[_0x689d('0x14')](_0x689d('0x1a'),_0x127561,'request\x20sent');_0xeb1f8(_0x392755[_0x689d('0x1b')]['message']);}})[_0x689d('0x1c')](function(_0xab3f53){logger[_0x689d('0x18')](_0x689d('0x1a'),_0x127561,_0xab3f53);_0x55f475(_0xab3f53);});});}function respondWithStatusCode(_0x3b0ba8,_0xd8bb94){_0xd8bb94=_0xd8bb94||0xcc;return function(_0x9fba1c){if(_0x9fba1c){return _0x3b0ba8[_0x689d('0x1d')](_0xd8bb94);}return _0x3b0ba8[_0x689d('0x1e')](_0xd8bb94)[_0x689d('0x1f')]();};}function respondWithResult(_0x47ab41,_0x5b1a45){_0x5b1a45=_0x5b1a45||0xc8;return function(_0x2c66b5){if(_0x2c66b5){return _0x47ab41[_0x689d('0x1e')](_0x5b1a45)[_0x689d('0x20')](_0x2c66b5);}};}function respondWithFilteredResult(_0x29953c,_0x1edbe1){return function(_0x4a2130){if(_0x4a2130){var _0xee75c1=typeof _0x1edbe1['offset']===_0x689d('0x21')&&typeof _0x1edbe1['limit']==='undefined';var _0x3a99b3=_0x4a2130[_0x689d('0x22')];var _0x3d0b28=_0xee75c1?0x0:_0x1edbe1[_0x689d('0x23')];var _0x1551d7=_0xee75c1?_0x4a2130['count']:_0x1edbe1[_0x689d('0x23')]+_0x1edbe1[_0x689d('0x24')];var _0x459bdd;if(_0x1551d7>=_0x3a99b3){_0x1551d7=_0x3a99b3;_0x459bdd=0xc8;}else{_0x459bdd=0xce;}_0x29953c[_0x689d('0x1e')](_0x459bdd);return _0x29953c[_0x689d('0x25')]('Content-Range',_0x3d0b28+'-'+_0x1551d7+'/'+_0x3a99b3)[_0x689d('0x20')](_0x4a2130);}return null;};}function saveUpdates(_0x5b27d7){return function(_0x4ca7a4){if(_0x4ca7a4){return _0x4ca7a4[_0x689d('0x26')](_0x5b27d7)['then'](function(_0xdd6731){return _0xdd6731;});}return null;};}function removeEntity(_0x2f770c){return function(_0x24709d){if(_0x24709d){return _0x24709d[_0x689d('0x27')]()[_0x689d('0x13')](function(){var _0x471272=_0x24709d[_0x689d('0x28')]({'plain':!![]});var _0x476b61=_0x689d('0x29');return db[_0x689d('0x2a')][_0x689d('0x27')]({'where':{'type':_0x476b61,'resourceId':_0x471272['id']}})['then'](function(){return _0x24709d;});})[_0x689d('0x13')](function(){_0x2f770c[_0x689d('0x1e')](0xcc)[_0x689d('0x1f')]();});}};}function handleEntityNotFound(_0x534238){return function(_0x243bc3){if(!_0x243bc3){_0x534238['sendStatus'](0x194);}return _0x243bc3;};}function handleError(_0x320a1b,_0x2a50d7){_0x2a50d7=_0x2a50d7||0x1f4;return function(_0x3c7b09){logger[_0x689d('0x18')](_0x3c7b09['stack']);if(_0x3c7b09['name']){delete _0x3c7b09[_0x689d('0x2b')];}_0x320a1b[_0x689d('0x1e')](_0x2a50d7)[_0x689d('0x2c')](_0x3c7b09);};}function getImapHost(_0x543f36){switch(_0x543f36){case _0x689d('0x2d'):return _0x689d('0x2e');case _0x689d('0x2f'):return _0x689d('0x30');case _0x689d('0x31'):return'imap-mail.outlook.com';case'outlook365':return _0x689d('0x32');}throw new Error(_0x689d('0x33'),_0x543f36);}function getSmtpHost(_0x2101a5){switch(_0x2101a5){case _0x689d('0x2d'):return _0x689d('0x34');case _0x689d('0x2f'):return _0x689d('0x35');case'hotmail':return _0x689d('0x36');case'outlook365':return _0x689d('0x37');}throw new Error(_0x689d('0x33'),_0x2101a5);}function getAuthenticationOptions(_0x34ad28,_0x5ec0c3){var _0x5bea58={};var _0x45d39b={};if(_0x34ad28){_0x5bea58['user']=_0x45d39b[_0x689d('0x38')]=_0x5ec0c3[_0x689d('0x39')];_0x5bea58[_0x689d('0x3a')]=_0x45d39b[_0x689d('0x3b')]=_0x5ec0c3[_0x689d('0x3a')];if(_0x5ec0c3[_0x689d('0x3c')]){_0x5bea58[_0x689d('0x3c')]=_0x45d39b[_0x689d('0x3c')]=!![];_0x5bea58[_0x689d('0x3d')]=_0x45d39b[_0x689d('0x3d')]=_0x5ec0c3['CloudProviderId'];_0x5bea58[_0x689d('0x3a')]=_0x45d39b[_0x689d('0x3b')]=null;}else{_0x5bea58[_0x689d('0x3d')]=_0x45d39b['CloudProviderId']=null;}_0x5bea58[_0x689d('0x3e')]=getImapHost(_0x34ad28);_0x5bea58['port']=0x3e1;_0x45d39b[_0x689d('0x3e')]=getSmtpHost(_0x34ad28);_0x45d39b['port']=0x24b;_0x45d39b[_0x689d('0x3f')]=![];_0x5bea58[_0x689d('0x40')]=_0x45d39b[_0x689d('0x40')]=null;}else{if(_0x5ec0c3[_0x689d('0x41')]){_0x5bea58[_0x689d('0x38')]=_0x45d39b[_0x689d('0x38')]=_0x5ec0c3[_0x689d('0x39')];_0x5bea58[_0x689d('0x3a')]=_0x45d39b[_0x689d('0x3b')]=_0x5ec0c3['password'];}else{_0x5bea58[_0x689d('0x41')]=_0x45d39b[_0x689d('0x41')]=![];_0x5bea58[_0x689d('0x38')]=_0x45d39b['user']=null;_0x5bea58[_0x689d('0x3a')]=_0x45d39b[_0x689d('0x3b')]=null;}_0x5bea58[_0x689d('0x3e')]=_0x5ec0c3['Imap'][_0x689d('0x3e')];_0x5bea58[_0x689d('0x42')]=_0x5ec0c3[_0x689d('0x43')][_0x689d('0x42')];_0x45d39b[_0x689d('0x3e')]=_0x5ec0c3[_0x689d('0x44')]['host'];_0x45d39b[_0x689d('0x42')]=_0x5ec0c3[_0x689d('0x44')][_0x689d('0x42')];}return{'Imap':_0x5bea58,'Smtp':_0x45d39b};}exports[_0x689d('0x45')]=function(_0x44deb3,_0x26bf6d){var _0x1d98ed={'include':[{'model':db['MailServerIn'],'as':_0x689d('0x43')},{'model':db[_0x689d('0x46')],'as':_0x689d('0x44')},{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0xbb816b={},_0x4de041={'count':0x0,'rows':[]};var _0x42e58b=_['map'](db[_0x689d('0x47')]['rawAttributes'],function(_0x398f2b){return{'name':_0x398f2b[_0x689d('0x48')],'type':_0x398f2b[_0x689d('0x49')][_0x689d('0x4a')]};});_0xbb816b[_0x689d('0x4b')]=_['map'](_0x42e58b,'name');_0xbb816b[_0x689d('0x4c')]=_[_0x689d('0x4d')](_0x44deb3[_0x689d('0x4c')]);_0xbb816b[_0x689d('0x4e')]=_[_0x689d('0x4f')](_0xbb816b[_0x689d('0x4b')],_0xbb816b['query']);_0x1d98ed[_0x689d('0x50')]=_[_0x689d('0x4f')](_0xbb816b[_0x689d('0x4b')],qs[_0x689d('0x51')](_0x44deb3[_0x689d('0x4c')][_0x689d('0x51')]));_0x1d98ed[_0x689d('0x50')]=_0x1d98ed[_0x689d('0x50')][_0x689d('0x52')]?_0x1d98ed['attributes']:_0xbb816b[_0x689d('0x4b')];if(!_0x44deb3[_0x689d('0x4c')]['hasOwnProperty'](_0x689d('0x53'))){_0x1d98ed[_0x689d('0x24')]=qs[_0x689d('0x24')](_0x44deb3[_0x689d('0x4c')][_0x689d('0x24')]);_0x1d98ed['offset']=qs[_0x689d('0x23')](_0x44deb3[_0x689d('0x4c')][_0x689d('0x23')]);}_0x1d98ed[_0x689d('0x54')]=qs[_0x689d('0x55')](_0x44deb3['query'][_0x689d('0x55')]);_0x1d98ed[_0x689d('0x56')]=qs['filters'](_[_0x689d('0x57')](_0x44deb3['query'],_0xbb816b[_0x689d('0x4e')]),_0x42e58b);if(_0x44deb3[_0x689d('0x4c')][_0x689d('0x58')]){_0x1d98ed['where']=_[_0x689d('0x59')](_0x1d98ed[_0x689d('0x56')],{'$or':_[_0x689d('0x5a')](_0x42e58b,function(_0x4240d8){if(_0x4240d8[_0x689d('0x49')]!==_0x689d('0x5b')){var _0x33df2d={};_0x33df2d[_0x4240d8[_0x689d('0x2b')]]={'$like':'%'+_0x44deb3['query'][_0x689d('0x58')]+'%'};return _0x33df2d;}})});}_0x1d98ed=_[_0x689d('0x59')]({},_0x1d98ed,_0x44deb3['options']);var _0x47c106={'where':_0x1d98ed[_0x689d('0x56')]};return db[_0x689d('0x47')][_0x689d('0x22')](_0x47c106)[_0x689d('0x13')](function(_0xdaa25e){_0x4de041[_0x689d('0x22')]=_0xdaa25e;if(_0x44deb3[_0x689d('0x4c')]['includeAll']){_0x1d98ed[_0x689d('0x5c')]=[{'all':!![]}];}return db['MailAccount']['findAll'](_0x1d98ed);})['then'](function(_0x50e1ed){_0x4de041['rows']=_0x50e1ed;return _0x4de041;})[_0x689d('0x13')](respondWithFilteredResult(_0x26bf6d,_0x1d98ed))[_0x689d('0x1c')](handleError(_0x26bf6d,null));};exports['show']=function(_0x5ab620,_0xbc09d1){var _0x1ef671={'raw':![],'where':{'id':_0x5ab620[_0x689d('0x5d')]['id']},'include':[{'model':db[_0x689d('0x5e')],'as':_0x689d('0x43')},{'model':db[_0x689d('0x46')],'as':'Smtp'},{'model':db[_0x689d('0x5f')],'as':_0x689d('0x60')}]},_0xd073d7={};_0xd073d7[_0x689d('0x4b')]=_[_0x689d('0x4d')](db[_0x689d('0x47')]['rawAttributes']);_0xd073d7[_0x689d('0x4c')]=_[_0x689d('0x4d')](_0x5ab620[_0x689d('0x4c')]);_0xd073d7['filters']=_[_0x689d('0x4f')](_0xd073d7[_0x689d('0x4b')],_0xd073d7[_0x689d('0x4c')]);_0x1ef671[_0x689d('0x50')]=_['intersection'](_0xd073d7[_0x689d('0x4b')],qs[_0x689d('0x51')](_0x5ab620[_0x689d('0x4c')]['fields']));_0x1ef671['attributes']=_0x1ef671[_0x689d('0x50')]['length']?_0x1ef671[_0x689d('0x50')]:_0xd073d7[_0x689d('0x4b')];if(_0x5ab620['query']['includeAll']){_0x1ef671['include']=[{'all':!![]}];}_0x1ef671=_[_0x689d('0x59')]({},_0x1ef671,_0x5ab620[_0x689d('0x61')]);return db['MailAccount'][_0x689d('0x62')](_0x1ef671)[_0x689d('0x13')](handleEntityNotFound(_0xbc09d1,null))[_0x689d('0x13')](respondWithResult(_0xbc09d1,null))['catch'](handleError(_0xbc09d1,null));};exports[_0x689d('0x26')]=function(_0x3dd750,_0x41f295){if(_0x3dd750['body']['id']){delete _0x3dd750[_0x689d('0x63')]['id'];}var _0x542dd8=_0x3dd750[_0x689d('0x63')][_0x689d('0x64')]==='custom'?null:_0x3dd750[_0x689d('0x63')][_0x689d('0x64')];var _0x4aad49=_0x3dd750[_0x689d('0x63')][_0x689d('0x43')]||{};var _0x547ec3=_0x3dd750[_0x689d('0x63')][_0x689d('0x44')]||{};if(_0x542dd8){_0x4aad49[_0x689d('0x3e')]=getImapHost(_0x542dd8);_0x4aad49[_0x689d('0x42')]=0x3e1;_0x547ec3[_0x689d('0x3e')]=getSmtpHost(_0x542dd8);_0x547ec3['port']=0x24b;_0x547ec3[_0x689d('0x3f')]=![];}if(_0x547ec3[_0x689d('0x3c')]){_0x547ec3[_0x689d('0x3f')]=![];}else{_0x547ec3['CloudProviderId']=null;}if(!_0x4aad49[_0x689d('0x3c')])_0x4aad49['CloudProviderId']=null;_0x3dd750[_0x689d('0x63')][_0x689d('0x43')]=_0x4aad49;_0x3dd750['body'][_0x689d('0x44')]=_0x547ec3;return db[_0x689d('0x47')]['find']({'where':{'id':_0x3dd750['params']['id']},'include':[{'model':db[_0x689d('0x5e')],'as':'Imap'},{'model':db[_0x689d('0x46')],'as':_0x689d('0x44')},{'model':db[_0x689d('0x5f')],'as':_0x689d('0x60')}]})[_0x689d('0x13')](handleEntityNotFound(_0x41f295,null))[_0x689d('0x13')](function(_0x5dfa48){if(!_0x5dfa48)throw new Error(_0x689d('0x65'));if(_0x5dfa48[_0x689d('0x40')])delete _0x3dd750[_0x689d('0x63')]['Imap'];return _0x5dfa48;})[_0x689d('0x13')](saveUpdates(_0x3dd750[_0x689d('0x63')],null))[_0x689d('0x13')](function(_0x3bb37e){if(!_0x3dd750['body'][_0x689d('0x43')])return _0x3bb37e;return db[_0x689d('0x5e')][_0x689d('0x26')](_0x3dd750[_0x689d('0x63')][_0x689d('0x43')],{'where':{'MailAccountId':_0x3bb37e['id']}})[_0x689d('0x13')](function(){return _0x3bb37e;});})[_0x689d('0x13')](function(_0xd0156){if(!_0x3dd750['body'][_0x689d('0x44')])return _0xd0156;return db[_0x689d('0x46')][_0x689d('0x26')](_0x3dd750['body'][_0x689d('0x44')],{'where':{'MailAccountId':_0xd0156['id']}})[_0x689d('0x13')](function(){return _0xd0156;});})[_0x689d('0x13')](respondWithResult(_0x41f295,null))[_0x689d('0x1c')](handleError(_0x41f295,null));};exports[_0x689d('0x66')]=function(_0x3b9ad8,_0x3f8d58){return db[_0x689d('0x47')]['describe']()[_0x689d('0x13')](respondWithResult(_0x3f8d58,null))[_0x689d('0x1c')](handleError(_0x3f8d58,null));};exports['addDisposition']=function(_0x42afe8,_0x270a9b){if(_0x42afe8[_0x689d('0x63')]['id']){delete _0x42afe8[_0x689d('0x63')]['id'];}return db[_0x689d('0x47')]['find']({'where':{'id':_0x42afe8[_0x689d('0x5d')]['id']}})[_0x689d('0x13')](handleEntityNotFound(_0x270a9b,null))[_0x689d('0x13')](function(_0x403a32){if(_0x403a32){_0x42afe8[_0x689d('0x63')]['MailAccountId']=_0x403a32['id'];return db[_0x689d('0x67')][_0x689d('0x68')](_0x42afe8[_0x689d('0x63')]);}})[_0x689d('0x13')](respondWithResult(_0x270a9b,null))[_0x689d('0x1c')](handleError(_0x270a9b,null));};exports[_0x689d('0x69')]=function(_0x5ba7a7,_0x258969){var _0x4b2240={'raw':![],'where':{}};var _0x18f39d={};var _0x148cf0={'count':0x0,'rows':[]};return db[_0x689d('0x47')]['findOne']({'where':{'id':_0x5ba7a7['params']['id']}})[_0x689d('0x13')](handleEntityNotFound(_0x258969,null))[_0x689d('0x13')](function(_0x5f3bb0){if(_0x5f3bb0){_0x18f39d['model']=_[_0x689d('0x4d')](db[_0x689d('0x67')][_0x689d('0x6a')]);_0x18f39d['query']=_[_0x689d('0x4d')](_0x5ba7a7[_0x689d('0x4c')]);_0x18f39d[_0x689d('0x4e')]=_[_0x689d('0x4f')](_0x18f39d['model'],_0x18f39d['query']);_0x4b2240['attributes']=_[_0x689d('0x4f')](_0x18f39d[_0x689d('0x4b')],qs[_0x689d('0x51')](_0x5ba7a7[_0x689d('0x4c')][_0x689d('0x51')]));_0x4b2240['attributes']=_0x4b2240[_0x689d('0x50')][_0x689d('0x52')]?_0x4b2240[_0x689d('0x50')]:_0x18f39d[_0x689d('0x4b')];if(!_0x5ba7a7[_0x689d('0x4c')][_0x689d('0x6b')](_0x689d('0x53'))){_0x4b2240[_0x689d('0x24')]=qs['limit'](_0x5ba7a7[_0x689d('0x4c')][_0x689d('0x24')]);_0x4b2240[_0x689d('0x23')]=qs[_0x689d('0x23')](_0x5ba7a7[_0x689d('0x4c')][_0x689d('0x23')]);}_0x4b2240[_0x689d('0x54')]=qs[_0x689d('0x55')](_0x5ba7a7['query'][_0x689d('0x55')]);_0x4b2240['where']=qs[_0x689d('0x4e')](_[_0x689d('0x57')](_0x5ba7a7[_0x689d('0x4c')],_0x18f39d[_0x689d('0x4e')]));_0x4b2240[_0x689d('0x56')][_0x689d('0x6c')]=_0x5f3bb0['id'];if(_0x5ba7a7['query']['filter']){_0x4b2240['where']=_[_0x689d('0x59')](_0x4b2240['where'],{'$or':_[_0x689d('0x5a')](_0x4b2240['attributes'],function(_0x5a057a){var _0x130b76={};_0x130b76[_0x5a057a]={'$like':'%'+_0x5ba7a7[_0x689d('0x4c')][_0x689d('0x58')]+'%'};return _0x130b76;})});}_0x4b2240=_[_0x689d('0x59')]({},_0x4b2240,_0x5ba7a7[_0x689d('0x61')]);return db[_0x689d('0x67')][_0x689d('0x22')]({'where':_0x4b2240[_0x689d('0x56')]})[_0x689d('0x13')](function(_0x38a78c){_0x148cf0[_0x689d('0x22')]=_0x38a78c;if(_0x5ba7a7[_0x689d('0x4c')][_0x689d('0x6d')]){_0x4b2240[_0x689d('0x5c')]=[{'all':!![]}];}return db[_0x689d('0x67')][_0x689d('0x6e')](_0x4b2240);})[_0x689d('0x13')](function(_0x2723f8){_0x148cf0[_0x689d('0x6f')]=_0x2723f8;return _0x148cf0;});}})[_0x689d('0x13')](respondWithFilteredResult(_0x258969,_0x4b2240))[_0x689d('0x1c')](handleError(_0x258969,null));};exports[_0x689d('0x70')]=function(_0x50f88c,_0x570fcc){return db[_0x689d('0x47')]['find']({'where':{'id':_0x50f88c['params']['id']}})['then'](handleEntityNotFound(_0x570fcc,null))['then'](function(_0x515aca){if(_0x515aca){return _0x515aca[_0x689d('0x70')](_0x50f88c[_0x689d('0x4c')][_0x689d('0x71')]);}})[_0x689d('0x13')](respondWithStatusCode(_0x570fcc,null))[_0x689d('0x1c')](handleError(_0x570fcc,null));};exports[_0x689d('0x72')]=function(_0x5d7f91,_0x3a7f4a){if(_0x5d7f91[_0x689d('0x63')]['id']){delete _0x5d7f91[_0x689d('0x63')]['id'];}return db[_0x689d('0x47')][_0x689d('0x62')]({'where':{'id':_0x5d7f91['params']['id']}})[_0x689d('0x13')](handleEntityNotFound(_0x3a7f4a,null))[_0x689d('0x13')](function(_0x1d4caf){if(_0x1d4caf){_0x5d7f91[_0x689d('0x63')][_0x689d('0x6c')]=_0x1d4caf['id'];return db['CannedAnswer']['create'](_0x5d7f91[_0x689d('0x63')]);}})[_0x689d('0x13')](respondWithResult(_0x3a7f4a,null))['catch'](handleError(_0x3a7f4a,null));};exports[_0x689d('0x73')]=function(_0x134d1f,_0x19a1e6){var _0x499413={'raw':![],'where':{}};var _0x3a4ac8={};var _0x2051d2={'count':0x0,'rows':[]};return db['MailAccount'][_0x689d('0x74')]({'where':{'id':_0x134d1f[_0x689d('0x5d')]['id']}})[_0x689d('0x13')](handleEntityNotFound(_0x19a1e6,null))[_0x689d('0x13')](function(_0x2cd531){if(_0x2cd531){_0x3a4ac8[_0x689d('0x4b')]=_['keys'](db[_0x689d('0x75')][_0x689d('0x6a')]);_0x3a4ac8[_0x689d('0x4c')]=_[_0x689d('0x4d')](_0x134d1f[_0x689d('0x4c')]);_0x3a4ac8[_0x689d('0x4e')]=_[_0x689d('0x4f')](_0x3a4ac8[_0x689d('0x4b')],_0x3a4ac8[_0x689d('0x4c')]);_0x499413[_0x689d('0x50')]=_[_0x689d('0x4f')](_0x3a4ac8[_0x689d('0x4b')],qs['fields'](_0x134d1f['query'][_0x689d('0x51')]));_0x499413[_0x689d('0x50')]=_0x499413[_0x689d('0x50')][_0x689d('0x52')]?_0x499413[_0x689d('0x50')]:_0x3a4ac8[_0x689d('0x4b')];if(!_0x134d1f[_0x689d('0x4c')][_0x689d('0x6b')](_0x689d('0x53'))){_0x499413[_0x689d('0x24')]=qs['limit'](_0x134d1f[_0x689d('0x4c')][_0x689d('0x24')]);_0x499413['offset']=qs[_0x689d('0x23')](_0x134d1f[_0x689d('0x4c')][_0x689d('0x23')]);}_0x499413[_0x689d('0x54')]=qs[_0x689d('0x55')](_0x134d1f[_0x689d('0x4c')][_0x689d('0x55')]);_0x499413[_0x689d('0x56')]=qs[_0x689d('0x4e')](_[_0x689d('0x57')](_0x134d1f['query'],_0x3a4ac8[_0x689d('0x4e')]));_0x499413[_0x689d('0x56')][_0x689d('0x6c')]=_0x2cd531['id'];if(_0x134d1f[_0x689d('0x4c')][_0x689d('0x58')]){_0x499413[_0x689d('0x56')]=_['merge'](_0x499413[_0x689d('0x56')],{'$or':_[_0x689d('0x5a')](_0x499413['attributes'],function(_0x5961ea){var _0x130972={};_0x130972[_0x5961ea]={'$like':'%'+_0x134d1f[_0x689d('0x4c')]['filter']+'%'};return _0x130972;})});}_0x499413=_['merge']({},_0x499413,_0x134d1f[_0x689d('0x61')]);return db[_0x689d('0x75')][_0x689d('0x22')]({'where':_0x499413[_0x689d('0x56')]})['then'](function(_0x4732a3){_0x2051d2['count']=_0x4732a3;if(_0x134d1f[_0x689d('0x4c')]['includeAll']){_0x499413[_0x689d('0x5c')]=[{'all':!![]}];}return db['CannedAnswer'][_0x689d('0x6e')](_0x499413);})[_0x689d('0x13')](function(_0x24a7bd){_0x2051d2['rows']=_0x24a7bd;return _0x2051d2;});}})[_0x689d('0x13')](respondWithFilteredResult(_0x19a1e6,_0x499413))['catch'](handleError(_0x19a1e6,null));};exports['removeAnswers']=function(_0x2d4b81,_0x1892d8){return db[_0x689d('0x47')][_0x689d('0x62')]({'where':{'id':_0x2d4b81[_0x689d('0x5d')]['id']}})[_0x689d('0x13')](handleEntityNotFound(_0x1892d8,null))[_0x689d('0x13')](function(_0x75daf6){if(_0x75daf6){return _0x75daf6['removeAnswers'](_0x2d4b81[_0x689d('0x4c')][_0x689d('0x71')]);}})[_0x689d('0x13')](respondWithStatusCode(_0x1892d8,null))[_0x689d('0x1c')](handleError(_0x1892d8,null));};exports[_0x689d('0x68')]=function(_0x39bb4a,_0x226054){var _0x427c26={'name':_0x39bb4a['body'][_0x689d('0x2b')],'key':_0x39bb4a[_0x689d('0x63')][_0x689d('0x4a')],'provider':_0x39bb4a[_0x689d('0x63')][_0x689d('0x64')]==='custom'?null:_0x39bb4a[_0x689d('0x63')]['provider'],'email':_0x39bb4a['body']['email'],'ListId':_0x39bb4a[_0x689d('0x63')][_0x689d('0x76')],'active':!_[_0x689d('0x77')](_0x39bb4a[_0x689d('0x63')]['active'])?_0x39bb4a[_0x689d('0x63')][_0x689d('0x78')]:!![],'description':_0x39bb4a[_0x689d('0x63')][_0x689d('0x79')]||null};var _0x7dfcb1=getAuthenticationOptions(_0x427c26[_0x689d('0x64')],_0x39bb4a['body']);_0x427c26[_0x689d('0x43')]=_0x7dfcb1[_0x689d('0x43')];_0x427c26['Smtp']=_0x7dfcb1[_0x689d('0x44')];return db['MailAccount'][_0x689d('0x68')](_0x427c26,{'include':[{'model':db[_0x689d('0x46')],'as':_0x689d('0x44')},{'model':db[_0x689d('0x5e')],'as':'Imap'}]})[_0x689d('0x13')](function(_0x7f93dc){var _0x28e259=_0x39bb4a[_0x689d('0x38')][_0x689d('0x28')]({'plain':!![]});if(!_0x28e259)throw new Error(_0x689d('0x7a'));if(_0x28e259['role']===_0x689d('0x38')){var _0x5c061a=_0x7f93dc[_0x689d('0x28')]({'plain':!![]});return db[_0x689d('0x7b')][_0x689d('0x62')]({'where':{'name':_0x689d('0x29'),'userProfileId':_0x28e259['userProfileId']},'raw':!![]})['then'](function(_0x4f9cc2){if(_0x4f9cc2&&_0x4f9cc2[_0x689d('0x7c')]===0x0){return db[_0x689d('0x2a')]['create']({'name':_0x5c061a[_0x689d('0x2b')],'resourceId':_0x5c061a['id'],'type':_0x4f9cc2[_0x689d('0x2b')],'sectionId':_0x4f9cc2['id']},{})[_0x689d('0x13')](function(){return _0x7f93dc;});}else{return _0x7f93dc;}})['catch'](function(_0x71a5d){logger[_0x689d('0x18')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x71a5d);throw _0x71a5d;});}return _0x7f93dc;})[_0x689d('0x13')](respondWithResult(_0x226054,0xc9))[_0x689d('0x1c')](handleError(_0x226054,null));};exports['getImap']=function(_0x2b4131,_0x275f3a){return db['MailAccount'][_0x689d('0x74')]({'where':{'id':_0x2b4131[_0x689d('0x5d')]['id']}})[_0x689d('0x13')](handleEntityNotFound(_0x275f3a,null))['then'](function(_0x352db6){if(_0x352db6){return _0x352db6[_0x689d('0x7d')]();}return null;})[_0x689d('0x13')](respondWithResult(_0x275f3a,null))[_0x689d('0x1c')](handleError(_0x275f3a,null));};exports[_0x689d('0x7e')]=function(_0xd6bcc0,_0x248468){if(_0xd6bcc0[_0x689d('0x63')]['id']){delete _0xd6bcc0[_0x689d('0x63')]['id'];}return db[_0x689d('0x47')][_0x689d('0x62')]({'where':{'id':_0xd6bcc0[_0x689d('0x5d')]['id']}})[_0x689d('0x13')](handleEntityNotFound(_0x248468,null))[_0x689d('0x13')](function(_0xbc252e){if(_0xbc252e){_0xd6bcc0[_0x689d('0x63')]['MailAccountId']=_0xbc252e['id'];return db[_0x689d('0x5e')]['create'](_0xd6bcc0['body']);}})[_0x689d('0x13')](respondWithResult(_0x248468,null))['catch'](handleError(_0x248468,null));};exports[_0x689d('0x7f')]=function(_0x323411,_0x4593d2){return db[_0x689d('0x47')][_0x689d('0x74')]({'where':{'id':_0x323411[_0x689d('0x5d')]['id']}})[_0x689d('0x13')](handleEntityNotFound(_0x4593d2,null))[_0x689d('0x13')](function(_0x2b6859){if(_0x2b6859){return _0x2b6859[_0x689d('0x80')](null);}return null;})[_0x689d('0x13')](respondWithStatusCode(_0x4593d2,null))[_0x689d('0x1c')](handleError(_0x4593d2,null));};exports[_0x689d('0x81')]=function(_0x50e533,_0x5e12a3){return db['MailAccount'][_0x689d('0x74')]({'where':{'id':_0x50e533[_0x689d('0x5d')]['id']}})[_0x689d('0x13')](handleEntityNotFound(_0x5e12a3,null))[_0x689d('0x13')](function(_0x12b1d5){if(_0x12b1d5){return _0x12b1d5[_0x689d('0x81')]();}return null;})[_0x689d('0x13')](respondWithResult(_0x5e12a3,null))[_0x689d('0x1c')](handleError(_0x5e12a3,null));};exports[_0x689d('0x82')]=function(_0x3a56a1,_0x30ae80){if(_0x3a56a1[_0x689d('0x63')]['id']){delete _0x3a56a1[_0x689d('0x63')]['id'];}return db[_0x689d('0x47')]['find']({'where':{'id':_0x3a56a1[_0x689d('0x5d')]['id']}})[_0x689d('0x13')](handleEntityNotFound(_0x30ae80,null))['then'](function(_0x52d76c){if(_0x52d76c){_0x3a56a1[_0x689d('0x63')][_0x689d('0x6c')]=_0x52d76c['id'];return db[_0x689d('0x46')][_0x689d('0x68')](_0x3a56a1['body']);}})[_0x689d('0x13')](respondWithResult(_0x30ae80,null))[_0x689d('0x1c')](handleError(_0x30ae80,null));};exports[_0x689d('0x83')]=function(_0x471623,_0x39836d){return db[_0x689d('0x47')][_0x689d('0x74')]({'where':{'id':_0x471623[_0x689d('0x5d')]['id']}})[_0x689d('0x13')](handleEntityNotFound(_0x39836d,null))[_0x689d('0x13')](function(_0x2cff10){if(_0x2cff10){return _0x2cff10[_0x689d('0x84')](null);}return null;})[_0x689d('0x13')](respondWithStatusCode(_0x39836d,null))[_0x689d('0x1c')](handleError(_0x39836d,null));};exports[_0x689d('0x85')]=function(_0x1b0d76,_0x3b03b9){return db[_0x689d('0x86')][_0x689d('0x62')]({'where':{'id':_0x1b0d76[_0x689d('0x5d')]['id']}})[_0x689d('0x13')](handleEntityNotFound(_0x3b03b9,null))[_0x689d('0x13')](function(_0x5021bb){if(_0x5021bb){return _0x5021bb[_0x689d('0x85')](_0x1b0d76[_0x689d('0x63')][_0x689d('0x71')],_[_0x689d('0x87')](_0x1b0d76[_0x689d('0x63')],['ids','id'])||{});}})[_0x689d('0x13')](respondWithResult(_0x3b03b9,null))[_0x689d('0x1c')](handleError(_0x3b03b9,null));};exports[_0x689d('0x88')]=function(_0x558b71,_0x5dd35d){var _0x199a0a={'raw':![],'where':{}};var _0x4603c5={};var _0x17821d={'count':0x0,'rows':[]};return db[_0x689d('0x47')][_0x689d('0x74')]({'where':{'id':_0x558b71[_0x689d('0x5d')]['id']}})[_0x689d('0x13')](handleEntityNotFound(_0x5dd35d,null))[_0x689d('0x13')](function(_0x4dd479){if(_0x4dd479){_0x4603c5[_0x689d('0x4b')]=_[_0x689d('0x4d')](db[_0x689d('0x86')][_0x689d('0x6a')]);_0x4603c5[_0x689d('0x4c')]=_[_0x689d('0x4d')](_0x558b71['query']);_0x4603c5[_0x689d('0x4e')]=_[_0x689d('0x4f')](_0x4603c5['model'],_0x4603c5[_0x689d('0x4c')]);_0x199a0a['attributes']=_[_0x689d('0x4f')](_0x4603c5[_0x689d('0x4b')],qs['fields'](_0x558b71[_0x689d('0x4c')]['fields']));_0x199a0a[_0x689d('0x50')]=_0x199a0a[_0x689d('0x50')][_0x689d('0x52')]?_0x199a0a[_0x689d('0x50')]:_0x4603c5[_0x689d('0x4b')];if(!_0x558b71[_0x689d('0x4c')]['hasOwnProperty'](_0x689d('0x53'))){_0x199a0a[_0x689d('0x24')]=qs['limit'](_0x558b71[_0x689d('0x4c')][_0x689d('0x24')]);_0x199a0a[_0x689d('0x23')]=qs[_0x689d('0x23')](_0x558b71['query'][_0x689d('0x23')]);}_0x199a0a[_0x689d('0x54')]=qs['sort'](_0x558b71[_0x689d('0x4c')][_0x689d('0x55')]);_0x199a0a['where']=qs[_0x689d('0x4e')](_['pick'](_0x558b71['query'],_0x4603c5[_0x689d('0x4e')]));_0x199a0a[_0x689d('0x56')][_0x689d('0x6c')]=_0x4dd479['id'];if(_0x558b71[_0x689d('0x4c')][_0x689d('0x58')]){_0x199a0a[_0x689d('0x56')]=_[_0x689d('0x59')](_0x199a0a[_0x689d('0x56')],{'$or':_[_0x689d('0x5a')](_0x199a0a[_0x689d('0x50')],function(_0xc91625){var _0x4c1c82={};_0x4c1c82[_0xc91625]={'$like':'%'+_0x558b71[_0x689d('0x4c')][_0x689d('0x58')]+'%'};return _0x4c1c82;})});}_0x199a0a=_[_0x689d('0x59')]({},_0x199a0a,_0x558b71[_0x689d('0x61')]);return db[_0x689d('0x86')]['count']({'where':_0x199a0a[_0x689d('0x56')]})['then'](function(_0x11d084){_0x17821d[_0x689d('0x22')]=_0x11d084;if(_0x558b71[_0x689d('0x4c')]['includeAll']){_0x199a0a[_0x689d('0x5c')]=[{'model':db[_0x689d('0x89')],'as':_0x689d('0x8a'),'required':![]},{'model':db[_0x689d('0x8b')],'as':_0x689d('0x8c'),'attributes':['name','fullname','internal'],'required':![]},{'model':db[_0x689d('0x8d')],'as':'Tags','attributes':['id',_0x689d('0x2b'),_0x689d('0x8e')],'where':_0x558b71[_0x689d('0x4c')]['tag']?{'id':_0x558b71['query'][_0x689d('0x8f')]}:undefined,'required':_0x558b71['query'][_0x689d('0x8f')]?!![]:![]}];}return db[_0x689d('0x86')][_0x689d('0x6e')](_0x199a0a);})[_0x689d('0x13')](function(_0xfa3e98){_0x17821d[_0x689d('0x6f')]=_0xfa3e98;return _0x17821d;});}})[_0x689d('0x13')](respondWithFilteredResult(_0x5dd35d,_0x199a0a))[_0x689d('0x1c')](handleError(_0x5dd35d,null));};exports[_0x689d('0x90')]=function addApplications(_0x5b86c0,_0x310948){var _0x22d02f=_0x5b86c0['params']['id'];var _0x1b40ff=_0x5b86c0[_0x689d('0x63')];var _0xcd55b9=0xc8;var _0x286886=null;return db['sequelize'][_0x689d('0x91')]({'isolationLevel':db[_0x689d('0x92')][_0x689d('0x93')][_0x689d('0x94')][_0x689d('0x95')]},function(_0x375ebe){return db[_0x689d('0x47')]['findOne']({'where':{'id':_0x22d02f},'transaction':_0x375ebe})[_0x689d('0x13')](function(_0x422c42){if(_0x422c42){return db['MailApplication'][_0x689d('0x27')]({'where':{'MailAccountId':_0x22d02f},'transaction':_0x375ebe})[_0x689d('0x13')](function(){var _0x49289c=_[_0x689d('0x5a')](_0x1b40ff,function(_0x3a822b){_0x3a822b[_0x689d('0x6c')]=_0x22d02f;return _0x3a822b;});return db['MailApplication'][_0x689d('0x96')](_0x49289c,{'transaction':_0x375ebe});});}else{_0xcd55b9=0x194;_0x286886=[];}});})[_0x689d('0x13')](function(){if(_0xcd55b9!==0x194){return db[_0x689d('0x97')][_0x689d('0x98')]({'where':{'MailAccountId':_0x22d02f},'order':_0x689d('0x99')})[_0x689d('0x13')](function(_0x34cefe){_0x286886=_0x34cefe;});}})[_0x689d('0x1c')](function(_0x50f135){_0xcd55b9=0x1f4;logger['error'](_0x50f135[_0x689d('0x9a')]);if(_0x50f135[_0x689d('0x2b')]){delete _0x50f135[_0x689d('0x2b')];}_0x286886=_0x50f135;})[_0x689d('0x9b')](function(){if(_0x286886===null){_0x310948[_0x689d('0x1d')](_0xcd55b9);}else{if(_0xcd55b9===0x1f4){_0x310948['status'](_0xcd55b9)[_0x689d('0x2c')](_0x286886);}else{_0x310948[_0x689d('0x1e')](_0xcd55b9)[_0x689d('0x20')](_0x286886);}}});};exports[_0x689d('0x9c')]=function(_0x81a687,_0x562507){var _0x3fa08e={};var _0x1ad1b3={};var _0x2eba9f;var _0x5270ea;return db[_0x689d('0x47')]['findOne']({'where':{'id':_0x81a687[_0x689d('0x5d')]['id']}})[_0x689d('0x13')](handleEntityNotFound(_0x562507,null))[_0x689d('0x13')](function(_0x1c929a){if(_0x1c929a){_0x2eba9f=_0x1c929a;_0x1ad1b3['model']=_[_0x689d('0x4d')](db[_0x689d('0x97')][_0x689d('0x6a')]);_0x1ad1b3[_0x689d('0x4c')]=_['keys'](_0x81a687[_0x689d('0x4c')]);_0x1ad1b3[_0x689d('0x4e')]=_[_0x689d('0x4f')](_0x1ad1b3[_0x689d('0x4b')],_0x1ad1b3['query']);_0x3fa08e[_0x689d('0x50')]=_[_0x689d('0x4f')](_0x1ad1b3[_0x689d('0x4b')],qs[_0x689d('0x51')](_0x81a687[_0x689d('0x4c')][_0x689d('0x51')]));_0x3fa08e[_0x689d('0x50')]=_0x3fa08e[_0x689d('0x50')][_0x689d('0x52')]?_0x3fa08e[_0x689d('0x50')]:_0x1ad1b3[_0x689d('0x4b')];_0x3fa08e[_0x689d('0x54')]=qs[_0x689d('0x55')](_0x81a687['query'][_0x689d('0x55')]);_0x3fa08e[_0x689d('0x56')]=qs[_0x689d('0x4e')](_[_0x689d('0x57')](_0x81a687[_0x689d('0x4c')],_0x1ad1b3[_0x689d('0x4e')]));if(_0x81a687[_0x689d('0x4c')][_0x689d('0x58')]){_0x3fa08e[_0x689d('0x56')]=_[_0x689d('0x59')](_0x3fa08e[_0x689d('0x56')],{'$or':_[_0x689d('0x5a')](_0x3fa08e['attributes'],function(_0x270c43){var _0x571380={};_0x571380[_0x270c43]={'$like':'%'+_0x81a687['query'][_0x689d('0x58')]+'%'};return _0x571380;})});}_0x3fa08e=_[_0x689d('0x59')]({},_0x3fa08e,_0x81a687['options']);return _0x2eba9f['getApplications'](_0x3fa08e);}})[_0x689d('0x13')](function(_0x441d04){if(_0x441d04){_0x5270ea=_0x441d04[_0x689d('0x52')];if(!_0x81a687[_0x689d('0x4c')][_0x689d('0x6b')](_0x689d('0x53'))){_0x3fa08e['limit']=qs[_0x689d('0x24')](_0x81a687[_0x689d('0x4c')]['limit']);_0x3fa08e[_0x689d('0x23')]=qs[_0x689d('0x23')](_0x81a687['query']['offset']);}return _0x2eba9f[_0x689d('0x9c')](_0x3fa08e);}})[_0x689d('0x13')](function(_0x3535f2){if(_0x3535f2){return _0x3535f2?{'count':_0x5270ea,'rows':_0x3535f2}:null;}})[_0x689d('0x13')](respondWithResult(_0x562507,null))['catch'](handleError(_0x562507,null));};exports[_0x689d('0x9d')]=function(_0x1943f8,_0x793813){var _0x4e9102={'raw':!![],'where':{}};var _0x26c851={};var _0x2a1e75={'count':0x0,'rows':[]};return db['MailAccount'][_0x689d('0x74')]({'where':{'id':_0x1943f8[_0x689d('0x5d')]['id']}})['then'](handleEntityNotFound(_0x793813,null))[_0x689d('0x13')](function(_0x390925){if(_0x390925){_0x26c851['model']=_[_0x689d('0x4d')](db[_0x689d('0x9e')][_0x689d('0x6a')]);_0x26c851[_0x689d('0x4c')]=_['keys'](_0x1943f8[_0x689d('0x4c')]);_0x26c851['filters']=_[_0x689d('0x4f')](_0x26c851['model'],_0x26c851[_0x689d('0x4c')]);_0x4e9102[_0x689d('0x50')]=_[_0x689d('0x4f')](_0x26c851[_0x689d('0x4b')],qs[_0x689d('0x51')](_0x1943f8[_0x689d('0x4c')][_0x689d('0x51')]));_0x4e9102[_0x689d('0x50')]=_0x4e9102[_0x689d('0x50')][_0x689d('0x52')]?_0x4e9102[_0x689d('0x50')]:_0x26c851[_0x689d('0x4b')];if(!_0x1943f8[_0x689d('0x4c')][_0x689d('0x6b')](_0x689d('0x53'))){_0x4e9102[_0x689d('0x24')]=qs['limit'](_0x1943f8[_0x689d('0x4c')][_0x689d('0x24')]);_0x4e9102[_0x689d('0x23')]=qs[_0x689d('0x23')](_0x1943f8['query'][_0x689d('0x23')]);}_0x4e9102[_0x689d('0x54')]=qs[_0x689d('0x55')](_0x1943f8[_0x689d('0x4c')][_0x689d('0x55')]);_0x4e9102[_0x689d('0x56')]=qs[_0x689d('0x4e')](_[_0x689d('0x57')](_0x1943f8[_0x689d('0x4c')],_0x26c851[_0x689d('0x4e')]));_0x4e9102['where'][_0x689d('0x6c')]=_0x390925['id'];if(_0x1943f8['query']['filter']){_0x4e9102['where']=_[_0x689d('0x59')](_0x4e9102[_0x689d('0x56')],{'$or':_[_0x689d('0x5a')](_0x4e9102[_0x689d('0x50')],function(_0x1af483){var _0x33928c={};_0x33928c[_0x1af483]={'$like':'%'+_0x1943f8[_0x689d('0x4c')][_0x689d('0x58')]+'%'};return _0x33928c;})});}if(_0x1943f8[_0x689d('0x4c')][_0x689d('0x9f')]){var _0x1da041=_0x1943f8['query'][_0x689d('0x9f')][_0x689d('0xa0')](',');var _0x327f7e={};_0x327f7e[_0x1da041[0x0]]={'$gte':moment(_0x1da041[0x1])['format'](_0x689d('0xa1'))};_0x4e9102['where']=_[_0x689d('0x59')](_0x4e9102['where'],_0x327f7e);}_0x4e9102=_[_0x689d('0x59')]({},_0x4e9102,_0x1943f8[_0x689d('0x61')]);return db['MailMessage'][_0x689d('0x22')]({'where':_0x4e9102['where']})[_0x689d('0x13')](function(_0x43f9fa){_0x2a1e75[_0x689d('0x22')]=_0x43f9fa;if(_0x1943f8[_0x689d('0x4c')][_0x689d('0x6d')]){_0x4e9102[_0x689d('0x5c')]=[{'all':!![]}];}return db[_0x689d('0x9e')]['findAll'](_0x4e9102);})[_0x689d('0x13')](function(_0x1b8cf8){if(_0x1943f8[_0x689d('0x4c')][_0x689d('0xa2')]==='true'){for(var _0x31af15=0x0;_0x31af15<_0x1b8cf8[_0x689d('0x52')];_0x31af15++){_0x1b8cf8[_0x31af15][_0x689d('0x63')]=juice(_0x1b8cf8[_0x31af15][_0x689d('0x63')]);}}_0x2a1e75[_0x689d('0x6f')]=_0x1b8cf8;return _0x2a1e75;});}})[_0x689d('0x13')](respondWithFilteredResult(_0x793813,_0x4e9102))['catch'](handleError(_0x793813,null));};exports['send']=function(_0x1af481,_0x45497a){var _0x25ce52,_0x3cdc08={},_0x5890d6;if(_0x1af481[_0x689d('0x63')]['to']){_0x5890d6=_0x1af481[_0x689d('0x63')]['to']['split'](',')[0x0];}return db['MailAccount']['find']({'where':{'id':_0x1af481[_0x689d('0x5d')]['id']},'include':[{'model':db[_0x689d('0xa3')],'as':_0x689d('0xa4'),'include':[{'model':db[_0x689d('0x89')],'as':_0x689d('0xa5'),'where':{'email':_0x5890d6},'limit':0x1,'order':[[_0x689d('0xa6'),_0x689d('0xa7')]]}]},{'model':db['MailServerOut'],'as':_0x689d('0x44'),'raw':!![],'include':[{'model':db[_0x689d('0xa8')],'as':_0x689d('0xa8'),'raw':!![]}]}]})[_0x689d('0x13')](handleEntityNotFound(_0x45497a,null))[_0x689d('0x13')](function(_0x4bb4d3){if(!_0x4bb4d3)return;_0x25ce52=_0x4bb4d3;if(!_0x4bb4d3[_0x689d('0x44')])throw new Error(_0x689d('0xa9'));if(_['isNil'](_0x1af481[_0x689d('0x63')]['from'])){_0x1af481[_0x689d('0x63')][_0x689d('0xaa')]=util['format'](_0x689d('0xab'),_0x4bb4d3[_0x689d('0x2b')],_0x4bb4d3[_0x689d('0xac')]||_0x4bb4d3['Smtp'][_0x689d('0x38')]);}if(_0x1af481[_0x689d('0x63')][_0x689d('0xad')]&&_0x1af481[_0x689d('0x63')][_0x689d('0xad')][_0x689d('0x52')]){for(var _0x44bac7=0x0;_0x44bac7<_0x1af481[_0x689d('0x63')]['attachments'][_0x689d('0x52')];_0x44bac7+=0x1){_0x1af481['body'][_0x689d('0xad')][_0x44bac7]={'filename':_0x1af481[_0x689d('0x63')]['attachments'][_0x44bac7]['name'],'path':path['join'](config['root'],'server/files/attachments',_0x1af481['body'][_0x689d('0xad')][_0x44bac7][_0x689d('0xae')])};}}var _0x18a838=_0x4bb4d3[_0x689d('0xaf')]();return respondWithRpcPromise(_0x689d('0xb0'),_0x689d('0xb1'),{'account':_0x18a838,'message':_0x1af481[_0x689d('0x63')]});})[_0x689d('0x13')](function(_0x4c539c){if(!_0x4c539c)return;_0x3cdc08=_0x4c539c;if(!_0x25ce52[_0x689d('0xa4')])throw new Error(_0x689d('0xb2'));if(_0x25ce52[_0x689d('0xa4')]['Contacts'][_0x689d('0x52')])return _0x25ce52[_0x689d('0xa4')][_0x689d('0xa5')][0x0];return db['CmContact']['create'](_[_0x689d('0xa')](_0x1af481['body'],{'firstName':_0x1af481[_0x689d('0x63')]['to'],'email':_0x1af481[_0x689d('0x63')]['to'],'phone':_0x1af481[_0x689d('0x63')]['to'],'ListId':_0x25ce52['ListId']}));})[_0x689d('0x13')](function(_0x2b1932){if(!_0x2b1932)return;var _0x3285fe={'UserId':_0x1af481[_0x689d('0x38')]['id'],'ContactId':_0x2b1932['id'],'MailAccountId':_0x25ce52['id'],'inReplyTo':_0x3cdc08[_0x689d('0xb3')],'to':_0x1af481[_0x689d('0x63')][_0x689d('0xaa')],'cc':_0x1af481[_0x689d('0x63')]['cc'],'subject':_0x1af481[_0x689d('0x63')]['subject'],'attach':_0x1af481['body'][_0x689d('0xb4')],'firstMsgDirection':'out','lastMsgAt':moment()['format'](_0x689d('0xa1')),'lastMsgDirection':'out','Messages':[_[_0x689d('0x59')](_0x1af481[_0x689d('0x63')],{'messageId':_0x3cdc08[_0x689d('0xb3')],'sentAt':moment()[_0x689d('0xb5')]('YYYY-MM-DD\x20HH:mm:ss'),'read':!![],'MailAccountId':_0x25ce52['id'],'UserId':_0x1af481[_0x689d('0x38')]['id'],'ContactId':_0x2b1932['id']})]};if(_0x1af481[_0x689d('0x63')][_0x689d('0xb6')]){_0x3285fe=_[_0x689d('0x59')](_0x3285fe,_0x1af481['body'][_0x689d('0xb6')]);}return db[_0x689d('0x86')][_0x689d('0x68')](_0x3285fe,{'include':[{'model':db['MailMessage'],'as':_0x689d('0xb7')}]});})[_0x689d('0x13')](respondWithResult(_0x45497a,null))['catch'](handleError(_0x45497a,null));};exports[_0x689d('0xb8')]=function(_0x46a960,_0x39c352){return db[_0x689d('0x47')]['find']({'where':{'id':_0x46a960[_0x689d('0x5d')]['id']},'include':[{'model':db[_0x689d('0x46')],'as':'Smtp','raw':!![],'include':[{'model':db['CloudProvider'],'as':'CloudProvider','raw':!![]}]}]})[_0x689d('0x13')](handleEntityNotFound(_0x39c352,null))[_0x689d('0x13')](function(_0x5edc47){if(!_0x5edc47[_0x689d('0x44')])return;var _0x8550af=_0x5edc47[_0x689d('0xaf')]();return respondWithRpcPromise('VerifySmtp',_0x689d('0xb8'),{'account':_0x8550af});})['then'](respondWithResult(_0x39c352,null))[_0x689d('0x1c')](handleError(_0x39c352,null));};exports[_0x689d('0x27')]=function(_0x2dda93,_0x461b4e){return db[_0x689d('0x47')][_0x689d('0x62')]({'where':{'id':_0x2dda93[_0x689d('0x5d')]['id']}})['then'](handleEntityNotFound(_0x461b4e,null))[_0x689d('0x13')](function(_0x5c569a){if(_0x5c569a&&_0x5c569a[_0x689d('0x40')]){throw new db[(_0x689d('0xb9'))][(_0x689d('0xba'))](_0x689d('0xbb'));}return _0x5c569a;})['then'](removeEntity(_0x461b4e,null))[_0x689d('0x1c')](handleError(_0x461b4e,null));};exports[_0x689d('0xbc')]=function(_0x40e8db,_0x4d92f5){return db['MailAccount']['find']({'where':{'id':_0x40e8db[_0x689d('0x5d')]['id']}})['then'](handleEntityNotFound(_0x4d92f5,null))[_0x689d('0x13')](function(_0x32df76){if(_0x32df76){return _0x32df76[_0x689d('0xbc')](_0x40e8db[_0x689d('0x63')][_0x689d('0x71')],_[_0x689d('0x87')](_0x40e8db[_0x689d('0x63')],[_0x689d('0x71'),'id'])||{})[_0x689d('0xbd')](function(_0x3e29d3){for(var _0x8862bd=0x0;_0x8862bd<_0x40e8db['body'][_0x689d('0x71')][_0x689d('0x52')];_0x8862bd+=0x1){socket[_0x689d('0xbe')]('userMailAccount:save',{'UserId':Number(_0x40e8db[_0x689d('0x63')][_0x689d('0x71')][_0x8862bd]),'MailAccountId':Number(_0x40e8db[_0x689d('0x5d')]['id'])});}return _0x3e29d3;});}})[_0x689d('0x13')](respondWithResult(_0x4d92f5,null))[_0x689d('0x1c')](handleError(_0x4d92f5,null));};exports[_0x689d('0xbf')]=function(_0x1dc8d8,_0x53a205){return db[_0x689d('0x47')]['find']({'where':{'id':_0x1dc8d8[_0x689d('0x5d')]['id']}})[_0x689d('0x13')](handleEntityNotFound(_0x53a205,null))[_0x689d('0x13')](function(_0x5a1523){if(_0x5a1523){return _0x5a1523[_0x689d('0xbf')](_0x1dc8d8[_0x689d('0x4c')][_0x689d('0x71')])['then'](function(){if(_[_0x689d('0xc0')](_0x1dc8d8[_0x689d('0x4c')][_0x689d('0x71')])){for(var _0x219cf2=0x0;_0x219cf2<_0x1dc8d8[_0x689d('0x4c')][_0x689d('0x71')]['length'];_0x219cf2+=0x1){socket[_0x689d('0xbe')]('userMailAccount:remove',{'UserId':Number(_0x1dc8d8[_0x689d('0x4c')][_0x689d('0x71')][_0x219cf2]),'MailAccountId':Number(_0x1dc8d8[_0x689d('0x5d')]['id'])});}}else{socket[_0x689d('0xbe')]('userMailAccount:remove',{'UserId':Number(_0x1dc8d8[_0x689d('0x4c')]['ids']),'MailAccountId':Number(_0x1dc8d8[_0x689d('0x5d')]['id'])});}});}})[_0x689d('0x13')](respondWithStatusCode(_0x53a205,null))[_0x689d('0x1c')](handleError(_0x53a205,null));};exports[_0x689d('0xc1')]=function(_0x35dc8f,_0x22aa09){var _0x17fb38={};var _0x18e807={};var _0x5dd723;var _0x299424;return db[_0x689d('0x47')][_0x689d('0x74')]({'where':{'id':_0x35dc8f[_0x689d('0x5d')]['id']}})['then'](handleEntityNotFound(_0x22aa09,null))[_0x689d('0x13')](function(_0x155262){if(_0x155262){_0x5dd723=_0x155262;_0x18e807[_0x689d('0x4b')]=_[_0x689d('0x4d')](db[_0x689d('0x8b')]['rawAttributes']);_0x18e807['query']=_[_0x689d('0x4d')](_0x35dc8f[_0x689d('0x4c')]);_0x18e807[_0x689d('0x4e')]=_[_0x689d('0x4f')](_0x18e807[_0x689d('0x4b')],_0x18e807['query']);_0x17fb38['attributes']=_[_0x689d('0x4f')](_0x18e807[_0x689d('0x4b')],qs[_0x689d('0x51')](_0x35dc8f['query'][_0x689d('0x51')]));_0x17fb38['attributes']=_0x17fb38[_0x689d('0x50')][_0x689d('0x52')]?_0x17fb38[_0x689d('0x50')]:_0x18e807['model'];_0x17fb38[_0x689d('0x54')]=qs[_0x689d('0x55')](_0x35dc8f[_0x689d('0x4c')][_0x689d('0x55')]);_0x17fb38['where']=qs['filters'](_['pick'](_0x35dc8f[_0x689d('0x4c')],_0x18e807['filters']));if(_0x35dc8f['query'][_0x689d('0x58')]){_0x17fb38['where']=_[_0x689d('0x59')](_0x17fb38[_0x689d('0x56')],{'$or':_['map'](_0x17fb38['attributes'],function(_0x44f385){var _0x1369d7={};_0x1369d7[_0x44f385]={'$like':'%'+_0x35dc8f['query'][_0x689d('0x58')]+'%'};return _0x1369d7;})});}_0x17fb38=_[_0x689d('0x59')]({},_0x17fb38,_0x35dc8f[_0x689d('0x61')]);return _0x5dd723['getAgents'](_0x17fb38);}})[_0x689d('0x13')](function(_0x4300ac){if(_0x4300ac){_0x299424=_0x4300ac[_0x689d('0x52')];if(!_0x35dc8f['query'][_0x689d('0x6b')]('nolimit')){_0x17fb38[_0x689d('0x24')]=qs['limit'](_0x35dc8f['query'][_0x689d('0x24')]);_0x17fb38['offset']=qs[_0x689d('0x23')](_0x35dc8f[_0x689d('0x4c')][_0x689d('0x23')]);}return _0x5dd723['getAgents'](_0x17fb38);}})[_0x689d('0x13')](function(_0x37b504){if(_0x37b504){return _0x37b504?{'count':_0x299424,'rows':_0x37b504}:null;}})[_0x689d('0x13')](respondWithResult(_0x22aa09,null))[_0x689d('0x1c')](handleError(_0x22aa09,null));}; \ No newline at end of file +var _0xe9eb=['CloudProviderId','pass','host','port','secure','service','authentication','Imap','Smtp','MailServerIn','Pause','mandatoryDispositionPause','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','MailAccount','includeAll','findAll','rows','show','params','MailServerOut','keys','include','body','provider','custom','find','Mail\x20Account\x20not\x20found','describe','Disposition','getDispositions','findOne','pick','removeDispositions','ids','addAnswer','MailAccountId','CannedAnswer','getAnswers','removeAnswers','create','email','ListId','isNil','active','description','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','removeImap','setImap','getSmtp','addSmtp','removeSmtp','setSmtp','MailInteraction','addInteraction','omit','CmContact','Contact','User','Owner','fullname','internal','Tags','color','tag','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','MailApplication','bulkCreate','findAndCountAll','priority','getApplications','getMessages','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','MailMessage','inlineCss','true','CmList','List','updatedAt','DESC','CloudProvider','Smtp\x20configuration\x20not\x20found','from','%s\x20<%s>','attachments','root','server/files/attachments','basename','getSmtpOptions','SendMail','sendMail','List\x20not\x20found','Contacts','defaults','messageId','subject','out','Interaction','verifySmtp','VerifySmtp','Sequelize','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','spread','emit','userMailAccount:save','isArray','userMailAccount:remove','getAgents','moment','bluebird','path','../../config/logger','api','../../config/environment','redis','localhost','socket.io-emitter','register','jayson/promise','client','http','request','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','sendStatus','status','end','json','limit','count','offset','set','Content-Range','update','destroy','get','MailAccounts','UserProfileResource','stack','name','send','gmail','yahoo','imap.mail.yahoo.com','outlook365','Unknown\x20email\x20service\x20provider','smtp.gmail.com','smtp.mail.yahoo.com','hotmail','smtp.office365.com','user','username','password','modernAuthentication'];(function(_0x3025f2,_0x5a4a78){var _0x58aec9=function(_0x5c8826){while(--_0x5c8826){_0x3025f2['push'](_0x3025f2['shift']());}};_0x58aec9(++_0x5a4a78);}(_0xe9eb,0x8e));var _0xbe9e=function(_0x573f88,_0x1e0023){_0x573f88=_0x573f88-0x0;var _0x12acc0=_0xe9eb[_0x573f88];return _0x12acc0;};'use strict';var moment=require(_0xbe9e('0x0'));var BPromise=require(_0xbe9e('0x1'));var util=require('util');var path=require(_0xbe9e('0x2'));var _=require('lodash');var juice=require('juice');var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var logger=require(_0xbe9e('0x3'))(_0xbe9e('0x4'));var config=require(_0xbe9e('0x5'));var db=require('../../mysqldb')['db'];config[_0xbe9e('0x6')]=_['defaults'](config[_0xbe9e('0x6')],{'host':_0xbe9e('0x7'),'port':0x18eb});var socket=require(_0xbe9e('0x8'))(new Redis(config['redis']));require('./mailAccount.socket')[_0xbe9e('0x9')](socket);var jayson=require(_0xbe9e('0xa'));var client=jayson[_0xbe9e('0xb')][_0xbe9e('0xc')]({'port':0x232b});function respondWithRpcPromise(_0x1c4ff0,_0x49b674,_0x4fb193,_0x3e32e8){return new BPromise(function(_0x678cd7,_0x1dee6d){var _0x27deb6=_0x3e32e8||client;return _0x27deb6[_0xbe9e('0xd')](_0x1c4ff0,_0x4fb193)[_0xbe9e('0xe')](function(_0x281a18){logger[_0xbe9e('0xf')](_0xbe9e('0x10'),_0x49b674,_0xbe9e('0x11'));logger[_0xbe9e('0x12')]('MailAccount,\x20%s,\x20%s,\x20%s',_0x49b674,_0xbe9e('0x11'),JSON[_0xbe9e('0x13')](_0x281a18));if(_0x281a18[_0xbe9e('0x14')]){if(_0x281a18[_0xbe9e('0x14')][_0xbe9e('0x15')]===0x1f4){logger[_0xbe9e('0x14')]('MailAccount,\x20%s,\x20%s',_0x49b674,_0x281a18[_0xbe9e('0x14')][_0xbe9e('0x16')]);return _0x1dee6d(_0x281a18[_0xbe9e('0x14')][_0xbe9e('0x16')]);}logger[_0xbe9e('0x14')](_0xbe9e('0x10'),_0x49b674,_0x281a18['error'][_0xbe9e('0x16')]);return _0x678cd7(_0x281a18[_0xbe9e('0x14')][_0xbe9e('0x16')]);}else{logger[_0xbe9e('0xf')](_0xbe9e('0x10'),_0x49b674,_0xbe9e('0x11'));_0x678cd7(_0x281a18[_0xbe9e('0x17')][_0xbe9e('0x16')]);}})[_0xbe9e('0x18')](function(_0x5e3a0f){logger[_0xbe9e('0x14')](_0xbe9e('0x10'),_0x49b674,_0x5e3a0f);_0x1dee6d(_0x5e3a0f);});});}function respondWithStatusCode(_0x4cf04d,_0x4b958a){_0x4b958a=_0x4b958a||0xcc;return function(_0x1e4a2){if(_0x1e4a2){return _0x4cf04d[_0xbe9e('0x19')](_0x4b958a);}return _0x4cf04d[_0xbe9e('0x1a')](_0x4b958a)[_0xbe9e('0x1b')]();};}function respondWithResult(_0x446268,_0x35c6ab){_0x35c6ab=_0x35c6ab||0xc8;return function(_0x37650a){if(_0x37650a){return _0x446268[_0xbe9e('0x1a')](_0x35c6ab)[_0xbe9e('0x1c')](_0x37650a);}};}function respondWithFilteredResult(_0x2e7445,_0x30c3d6){return function(_0x63e850){if(_0x63e850){var _0xb35892=typeof _0x30c3d6['offset']==='undefined'&&typeof _0x30c3d6[_0xbe9e('0x1d')]==='undefined';var _0x4e3170=_0x63e850[_0xbe9e('0x1e')];var _0x5d01bc=_0xb35892?0x0:_0x30c3d6['offset'];var _0x574dc7=_0xb35892?_0x63e850[_0xbe9e('0x1e')]:_0x30c3d6[_0xbe9e('0x1f')]+_0x30c3d6['limit'];var _0x3856d4;if(_0x574dc7>=_0x4e3170){_0x574dc7=_0x4e3170;_0x3856d4=0xc8;}else{_0x3856d4=0xce;}_0x2e7445[_0xbe9e('0x1a')](_0x3856d4);return _0x2e7445[_0xbe9e('0x20')](_0xbe9e('0x21'),_0x5d01bc+'-'+_0x574dc7+'/'+_0x4e3170)[_0xbe9e('0x1c')](_0x63e850);}return null;};}function saveUpdates(_0xbacf24){return function(_0x8ba130){if(_0x8ba130){return _0x8ba130[_0xbe9e('0x22')](_0xbacf24)['then'](function(_0x559491){return _0x559491;});}return null;};}function removeEntity(_0x3571c6){return function(_0x6059d){if(_0x6059d){return _0x6059d[_0xbe9e('0x23')]()[_0xbe9e('0xe')](function(){var _0xe29659=_0x6059d[_0xbe9e('0x24')]({'plain':!![]});var _0x404386=_0xbe9e('0x25');return db[_0xbe9e('0x26')]['destroy']({'where':{'type':_0x404386,'resourceId':_0xe29659['id']}})[_0xbe9e('0xe')](function(){return _0x6059d;});})[_0xbe9e('0xe')](function(){_0x3571c6[_0xbe9e('0x1a')](0xcc)[_0xbe9e('0x1b')]();});}};}function handleEntityNotFound(_0x19e3e1){return function(_0x119ddd){if(!_0x119ddd){_0x19e3e1['sendStatus'](0x194);}return _0x119ddd;};}function handleError(_0x12a171,_0x336760){_0x336760=_0x336760||0x1f4;return function(_0xd39a4d){logger[_0xbe9e('0x14')](_0xd39a4d[_0xbe9e('0x27')]);if(_0xd39a4d[_0xbe9e('0x28')]){delete _0xd39a4d[_0xbe9e('0x28')];}_0x12a171[_0xbe9e('0x1a')](_0x336760)[_0xbe9e('0x29')](_0xd39a4d);};}function getImapHost(_0x57c62e){switch(_0x57c62e){case _0xbe9e('0x2a'):return'imap.gmail.com';case _0xbe9e('0x2b'):return _0xbe9e('0x2c');case'hotmail':return'imap-mail.outlook.com';case _0xbe9e('0x2d'):return'outlook.office365.com';}throw new Error(_0xbe9e('0x2e'),_0x57c62e);}function getSmtpHost(_0x3b5cf5){switch(_0x3b5cf5){case _0xbe9e('0x2a'):return _0xbe9e('0x2f');case _0xbe9e('0x2b'):return _0xbe9e('0x30');case _0xbe9e('0x31'):return'smtp-mail.outlook.com';case _0xbe9e('0x2d'):return _0xbe9e('0x32');}throw new Error(_0xbe9e('0x2e'),_0x3b5cf5);}function getAuthenticationOptions(_0xe8d1a4,_0x2332db){var _0x372213={};var _0x2f97e1={};if(_0xe8d1a4){_0x372213[_0xbe9e('0x33')]=_0x2f97e1[_0xbe9e('0x33')]=_0x2332db[_0xbe9e('0x34')];_0x372213[_0xbe9e('0x35')]=_0x2f97e1['pass']=_0x2332db[_0xbe9e('0x35')];if(_0x2332db[_0xbe9e('0x36')]){_0x372213[_0xbe9e('0x36')]=_0x2f97e1[_0xbe9e('0x36')]=!![];_0x372213[_0xbe9e('0x37')]=_0x2f97e1[_0xbe9e('0x37')]=_0x2332db[_0xbe9e('0x37')];_0x372213[_0xbe9e('0x35')]=_0x2f97e1[_0xbe9e('0x38')]=null;}else{_0x372213[_0xbe9e('0x37')]=_0x2f97e1[_0xbe9e('0x37')]=null;}_0x372213[_0xbe9e('0x39')]=getImapHost(_0xe8d1a4);_0x372213['port']=0x3e1;_0x2f97e1[_0xbe9e('0x39')]=getSmtpHost(_0xe8d1a4);_0x2f97e1[_0xbe9e('0x3a')]=0x24b;_0x2f97e1[_0xbe9e('0x3b')]=![];_0x372213[_0xbe9e('0x3c')]=_0x2f97e1[_0xbe9e('0x3c')]=null;}else{if(_0x2332db[_0xbe9e('0x3d')]){_0x372213[_0xbe9e('0x33')]=_0x2f97e1[_0xbe9e('0x33')]=_0x2332db['username'];_0x372213['password']=_0x2f97e1[_0xbe9e('0x38')]=_0x2332db[_0xbe9e('0x35')];}else{_0x372213[_0xbe9e('0x3d')]=_0x2f97e1[_0xbe9e('0x3d')]=![];_0x372213[_0xbe9e('0x33')]=_0x2f97e1[_0xbe9e('0x33')]=null;_0x372213['password']=_0x2f97e1[_0xbe9e('0x38')]=null;}_0x372213[_0xbe9e('0x39')]=_0x2332db[_0xbe9e('0x3e')][_0xbe9e('0x39')];_0x372213[_0xbe9e('0x3a')]=_0x2332db[_0xbe9e('0x3e')][_0xbe9e('0x3a')];_0x2f97e1[_0xbe9e('0x39')]=_0x2332db[_0xbe9e('0x3f')]['host'];_0x2f97e1['port']=_0x2332db[_0xbe9e('0x3f')]['port'];}return{'Imap':_0x372213,'Smtp':_0x2f97e1};}exports['index']=function(_0x1d7a6d,_0xeb911f){var _0x432630={'include':[{'model':db[_0xbe9e('0x40')],'as':_0xbe9e('0x3e')},{'model':db['MailServerOut'],'as':'Smtp'},{'model':db[_0xbe9e('0x41')],'as':_0xbe9e('0x42')}]},_0x15303c={},_0x21115e={'count':0x0,'rows':[]};var _0x29556e=_[_0xbe9e('0x43')](db['MailAccount'][_0xbe9e('0x44')],function(_0x582dcf){return{'name':_0x582dcf[_0xbe9e('0x45')],'type':_0x582dcf[_0xbe9e('0x46')][_0xbe9e('0x47')]};});_0x15303c[_0xbe9e('0x48')]=_[_0xbe9e('0x43')](_0x29556e,_0xbe9e('0x28'));_0x15303c[_0xbe9e('0x49')]=_['keys'](_0x1d7a6d[_0xbe9e('0x49')]);_0x15303c[_0xbe9e('0x4a')]=_[_0xbe9e('0x4b')](_0x15303c[_0xbe9e('0x48')],_0x15303c[_0xbe9e('0x49')]);_0x432630[_0xbe9e('0x4c')]=_['intersection'](_0x15303c[_0xbe9e('0x48')],qs[_0xbe9e('0x4d')](_0x1d7a6d[_0xbe9e('0x49')][_0xbe9e('0x4d')]));_0x432630[_0xbe9e('0x4c')]=_0x432630[_0xbe9e('0x4c')][_0xbe9e('0x4e')]?_0x432630[_0xbe9e('0x4c')]:_0x15303c[_0xbe9e('0x48')];if(!_0x1d7a6d[_0xbe9e('0x49')][_0xbe9e('0x4f')](_0xbe9e('0x50'))){_0x432630[_0xbe9e('0x1d')]=qs[_0xbe9e('0x1d')](_0x1d7a6d[_0xbe9e('0x49')]['limit']);_0x432630[_0xbe9e('0x1f')]=qs[_0xbe9e('0x1f')](_0x1d7a6d[_0xbe9e('0x49')][_0xbe9e('0x1f')]);}_0x432630[_0xbe9e('0x51')]=qs['sort'](_0x1d7a6d[_0xbe9e('0x49')][_0xbe9e('0x52')]);_0x432630['where']=qs['filters'](_['pick'](_0x1d7a6d['query'],_0x15303c[_0xbe9e('0x4a')]),_0x29556e);if(_0x1d7a6d['query']['filter']){_0x432630[_0xbe9e('0x53')]=_[_0xbe9e('0x54')](_0x432630[_0xbe9e('0x53')],{'$or':_[_0xbe9e('0x43')](_0x29556e,function(_0x39b326){if(_0x39b326[_0xbe9e('0x46')]!==_0xbe9e('0x55')){var _0x117bc5={};_0x117bc5[_0x39b326['name']]={'$like':'%'+_0x1d7a6d[_0xbe9e('0x49')][_0xbe9e('0x56')]+'%'};return _0x117bc5;}})});}_0x432630=_['merge']({},_0x432630,_0x1d7a6d[_0xbe9e('0x57')]);var _0x4c9d1e={'where':_0x432630[_0xbe9e('0x53')]};return db[_0xbe9e('0x58')][_0xbe9e('0x1e')](_0x4c9d1e)[_0xbe9e('0xe')](function(_0x5b8756){_0x21115e[_0xbe9e('0x1e')]=_0x5b8756;if(_0x1d7a6d[_0xbe9e('0x49')][_0xbe9e('0x59')]){_0x432630['include']=[{'all':!![]}];}return db[_0xbe9e('0x58')][_0xbe9e('0x5a')](_0x432630);})[_0xbe9e('0xe')](function(_0x359fe6){_0x21115e[_0xbe9e('0x5b')]=_0x359fe6;return _0x21115e;})[_0xbe9e('0xe')](respondWithFilteredResult(_0xeb911f,_0x432630))[_0xbe9e('0x18')](handleError(_0xeb911f,null));};exports[_0xbe9e('0x5c')]=function(_0x4dbc0f,_0x440d33){var _0x16657b={'raw':![],'where':{'id':_0x4dbc0f[_0xbe9e('0x5d')]['id']},'include':[{'model':db['MailServerIn'],'as':'Imap'},{'model':db[_0xbe9e('0x5e')],'as':'Smtp'},{'model':db[_0xbe9e('0x41')],'as':_0xbe9e('0x42')}]},_0x21605d={};_0x21605d[_0xbe9e('0x48')]=_[_0xbe9e('0x5f')](db['MailAccount'][_0xbe9e('0x44')]);_0x21605d[_0xbe9e('0x49')]=_['keys'](_0x4dbc0f[_0xbe9e('0x49')]);_0x21605d['filters']=_['intersection'](_0x21605d['model'],_0x21605d['query']);_0x16657b['attributes']=_[_0xbe9e('0x4b')](_0x21605d[_0xbe9e('0x48')],qs[_0xbe9e('0x4d')](_0x4dbc0f[_0xbe9e('0x49')][_0xbe9e('0x4d')]));_0x16657b[_0xbe9e('0x4c')]=_0x16657b[_0xbe9e('0x4c')][_0xbe9e('0x4e')]?_0x16657b['attributes']:_0x21605d[_0xbe9e('0x48')];if(_0x4dbc0f[_0xbe9e('0x49')][_0xbe9e('0x59')]){_0x16657b[_0xbe9e('0x60')]=[{'all':!![]}];}_0x16657b=_[_0xbe9e('0x54')]({},_0x16657b,_0x4dbc0f[_0xbe9e('0x57')]);return db['MailAccount']['find'](_0x16657b)[_0xbe9e('0xe')](handleEntityNotFound(_0x440d33,null))[_0xbe9e('0xe')](respondWithResult(_0x440d33,null))[_0xbe9e('0x18')](handleError(_0x440d33,null));};exports[_0xbe9e('0x22')]=function(_0x16a8be,_0x30fd7b){if(_0x16a8be[_0xbe9e('0x61')]['id']){delete _0x16a8be[_0xbe9e('0x61')]['id'];}var _0x300a4c=_0x16a8be[_0xbe9e('0x61')][_0xbe9e('0x62')]===_0xbe9e('0x63')?null:_0x16a8be['body'][_0xbe9e('0x62')];var _0x4836ac=_0x16a8be[_0xbe9e('0x61')][_0xbe9e('0x3e')]||{};var _0x5ceeef=_0x16a8be[_0xbe9e('0x61')][_0xbe9e('0x3f')]||{};if(_0x300a4c){_0x4836ac[_0xbe9e('0x39')]=getImapHost(_0x300a4c);_0x4836ac[_0xbe9e('0x3a')]=0x3e1;_0x5ceeef[_0xbe9e('0x39')]=getSmtpHost(_0x300a4c);_0x5ceeef['port']=0x24b;_0x5ceeef[_0xbe9e('0x3b')]=![];}if(_0x5ceeef[_0xbe9e('0x36')]){_0x5ceeef['secure']=![];}else{_0x5ceeef[_0xbe9e('0x37')]=null;}if(!_0x4836ac[_0xbe9e('0x36')])_0x4836ac['CloudProviderId']=null;_0x16a8be['body']['Imap']=_0x4836ac;_0x16a8be[_0xbe9e('0x61')][_0xbe9e('0x3f')]=_0x5ceeef;return db[_0xbe9e('0x58')][_0xbe9e('0x64')]({'where':{'id':_0x16a8be[_0xbe9e('0x5d')]['id']},'include':[{'model':db[_0xbe9e('0x40')],'as':_0xbe9e('0x3e')},{'model':db['MailServerOut'],'as':'Smtp'},{'model':db['Pause'],'as':_0xbe9e('0x42')}]})[_0xbe9e('0xe')](handleEntityNotFound(_0x30fd7b,null))[_0xbe9e('0xe')](function(_0x459a7f){if(!_0x459a7f)throw new Error(_0xbe9e('0x65'));if(_0x459a7f[_0xbe9e('0x3c')])delete _0x16a8be['body'][_0xbe9e('0x3e')];return _0x459a7f;})[_0xbe9e('0xe')](saveUpdates(_0x16a8be['body'],null))[_0xbe9e('0xe')](function(_0x604e5f){if(!_0x16a8be[_0xbe9e('0x61')][_0xbe9e('0x3e')])return _0x604e5f;return db[_0xbe9e('0x40')][_0xbe9e('0x22')](_0x16a8be[_0xbe9e('0x61')][_0xbe9e('0x3e')],{'where':{'MailAccountId':_0x604e5f['id']}})['then'](function(){return _0x604e5f;});})[_0xbe9e('0xe')](function(_0x492d3b){if(!_0x16a8be['body'][_0xbe9e('0x3f')])return _0x492d3b;return db[_0xbe9e('0x5e')][_0xbe9e('0x22')](_0x16a8be[_0xbe9e('0x61')][_0xbe9e('0x3f')],{'where':{'MailAccountId':_0x492d3b['id']}})[_0xbe9e('0xe')](function(){return _0x492d3b;});})[_0xbe9e('0xe')](respondWithResult(_0x30fd7b,null))[_0xbe9e('0x18')](handleError(_0x30fd7b,null));};exports[_0xbe9e('0x66')]=function(_0x3c2174,_0x1f32d4){return db['MailAccount'][_0xbe9e('0x66')]()[_0xbe9e('0xe')](respondWithResult(_0x1f32d4,null))[_0xbe9e('0x18')](handleError(_0x1f32d4,null));};exports['addDisposition']=function(_0x1e9f52,_0x3a7eb0){if(_0x1e9f52[_0xbe9e('0x61')]['id']){delete _0x1e9f52[_0xbe9e('0x61')]['id'];}return db[_0xbe9e('0x58')]['find']({'where':{'id':_0x1e9f52[_0xbe9e('0x5d')]['id']}})[_0xbe9e('0xe')](handleEntityNotFound(_0x3a7eb0,null))['then'](function(_0x3eb51f){if(_0x3eb51f){_0x1e9f52[_0xbe9e('0x61')]['MailAccountId']=_0x3eb51f['id'];return db[_0xbe9e('0x67')]['create'](_0x1e9f52['body']);}})[_0xbe9e('0xe')](respondWithResult(_0x3a7eb0,null))['catch'](handleError(_0x3a7eb0,null));};exports[_0xbe9e('0x68')]=function(_0x62692d,_0x30b9b4){var _0x32bf46={'raw':![],'where':{}};var _0x1fed9b={};var _0x5da76e={'count':0x0,'rows':[]};return db[_0xbe9e('0x58')][_0xbe9e('0x69')]({'where':{'id':_0x62692d['params']['id']}})[_0xbe9e('0xe')](handleEntityNotFound(_0x30b9b4,null))['then'](function(_0x1b2cb4){if(_0x1b2cb4){_0x1fed9b[_0xbe9e('0x48')]=_[_0xbe9e('0x5f')](db[_0xbe9e('0x67')][_0xbe9e('0x44')]);_0x1fed9b[_0xbe9e('0x49')]=_[_0xbe9e('0x5f')](_0x62692d[_0xbe9e('0x49')]);_0x1fed9b[_0xbe9e('0x4a')]=_[_0xbe9e('0x4b')](_0x1fed9b[_0xbe9e('0x48')],_0x1fed9b[_0xbe9e('0x49')]);_0x32bf46[_0xbe9e('0x4c')]=_[_0xbe9e('0x4b')](_0x1fed9b[_0xbe9e('0x48')],qs[_0xbe9e('0x4d')](_0x62692d[_0xbe9e('0x49')][_0xbe9e('0x4d')]));_0x32bf46[_0xbe9e('0x4c')]=_0x32bf46[_0xbe9e('0x4c')]['length']?_0x32bf46[_0xbe9e('0x4c')]:_0x1fed9b[_0xbe9e('0x48')];if(!_0x62692d[_0xbe9e('0x49')][_0xbe9e('0x4f')](_0xbe9e('0x50'))){_0x32bf46[_0xbe9e('0x1d')]=qs['limit'](_0x62692d[_0xbe9e('0x49')][_0xbe9e('0x1d')]);_0x32bf46[_0xbe9e('0x1f')]=qs[_0xbe9e('0x1f')](_0x62692d[_0xbe9e('0x49')][_0xbe9e('0x1f')]);}_0x32bf46['order']=qs[_0xbe9e('0x52')](_0x62692d[_0xbe9e('0x49')][_0xbe9e('0x52')]);_0x32bf46['where']=qs[_0xbe9e('0x4a')](_[_0xbe9e('0x6a')](_0x62692d[_0xbe9e('0x49')],_0x1fed9b['filters']));_0x32bf46['where']['MailAccountId']=_0x1b2cb4['id'];if(_0x62692d[_0xbe9e('0x49')][_0xbe9e('0x56')]){_0x32bf46['where']=_[_0xbe9e('0x54')](_0x32bf46[_0xbe9e('0x53')],{'$or':_[_0xbe9e('0x43')](_0x32bf46[_0xbe9e('0x4c')],function(_0x2cdc79){var _0x1e4cce={};_0x1e4cce[_0x2cdc79]={'$like':'%'+_0x62692d[_0xbe9e('0x49')][_0xbe9e('0x56')]+'%'};return _0x1e4cce;})});}_0x32bf46=_['merge']({},_0x32bf46,_0x62692d[_0xbe9e('0x57')]);return db['Disposition']['count']({'where':_0x32bf46[_0xbe9e('0x53')]})['then'](function(_0x40d65a){_0x5da76e[_0xbe9e('0x1e')]=_0x40d65a;if(_0x62692d[_0xbe9e('0x49')][_0xbe9e('0x59')]){_0x32bf46[_0xbe9e('0x60')]=[{'all':!![]}];}return db[_0xbe9e('0x67')][_0xbe9e('0x5a')](_0x32bf46);})['then'](function(_0x1c2935){_0x5da76e[_0xbe9e('0x5b')]=_0x1c2935;return _0x5da76e;});}})[_0xbe9e('0xe')](respondWithFilteredResult(_0x30b9b4,_0x32bf46))[_0xbe9e('0x18')](handleError(_0x30b9b4,null));};exports['removeDispositions']=function(_0x3fbe19,_0x23e24a){return db[_0xbe9e('0x58')][_0xbe9e('0x64')]({'where':{'id':_0x3fbe19[_0xbe9e('0x5d')]['id']}})['then'](handleEntityNotFound(_0x23e24a,null))['then'](function(_0x181698){if(_0x181698){return _0x181698[_0xbe9e('0x6b')](_0x3fbe19[_0xbe9e('0x49')][_0xbe9e('0x6c')]);}})[_0xbe9e('0xe')](respondWithStatusCode(_0x23e24a,null))[_0xbe9e('0x18')](handleError(_0x23e24a,null));};exports[_0xbe9e('0x6d')]=function(_0x5667c8,_0x54a468){if(_0x5667c8[_0xbe9e('0x61')]['id']){delete _0x5667c8[_0xbe9e('0x61')]['id'];}return db['MailAccount'][_0xbe9e('0x64')]({'where':{'id':_0x5667c8[_0xbe9e('0x5d')]['id']}})[_0xbe9e('0xe')](handleEntityNotFound(_0x54a468,null))['then'](function(_0x3a0084){if(_0x3a0084){_0x5667c8['body'][_0xbe9e('0x6e')]=_0x3a0084['id'];return db[_0xbe9e('0x6f')]['create'](_0x5667c8[_0xbe9e('0x61')]);}})[_0xbe9e('0xe')](respondWithResult(_0x54a468,null))['catch'](handleError(_0x54a468,null));};exports[_0xbe9e('0x70')]=function(_0x1a044e,_0x39ffd0){var _0x43ba4b={'raw':![],'where':{}};var _0x315a9d={};var _0x4f9a25={'count':0x0,'rows':[]};return db[_0xbe9e('0x58')]['findOne']({'where':{'id':_0x1a044e[_0xbe9e('0x5d')]['id']}})[_0xbe9e('0xe')](handleEntityNotFound(_0x39ffd0,null))[_0xbe9e('0xe')](function(_0x5adcf9){if(_0x5adcf9){_0x315a9d[_0xbe9e('0x48')]=_[_0xbe9e('0x5f')](db['CannedAnswer']['rawAttributes']);_0x315a9d[_0xbe9e('0x49')]=_['keys'](_0x1a044e[_0xbe9e('0x49')]);_0x315a9d['filters']=_[_0xbe9e('0x4b')](_0x315a9d[_0xbe9e('0x48')],_0x315a9d[_0xbe9e('0x49')]);_0x43ba4b[_0xbe9e('0x4c')]=_[_0xbe9e('0x4b')](_0x315a9d[_0xbe9e('0x48')],qs[_0xbe9e('0x4d')](_0x1a044e['query'][_0xbe9e('0x4d')]));_0x43ba4b[_0xbe9e('0x4c')]=_0x43ba4b[_0xbe9e('0x4c')][_0xbe9e('0x4e')]?_0x43ba4b[_0xbe9e('0x4c')]:_0x315a9d[_0xbe9e('0x48')];if(!_0x1a044e[_0xbe9e('0x49')]['hasOwnProperty']('nolimit')){_0x43ba4b['limit']=qs[_0xbe9e('0x1d')](_0x1a044e[_0xbe9e('0x49')][_0xbe9e('0x1d')]);_0x43ba4b[_0xbe9e('0x1f')]=qs[_0xbe9e('0x1f')](_0x1a044e[_0xbe9e('0x49')][_0xbe9e('0x1f')]);}_0x43ba4b[_0xbe9e('0x51')]=qs['sort'](_0x1a044e[_0xbe9e('0x49')][_0xbe9e('0x52')]);_0x43ba4b[_0xbe9e('0x53')]=qs[_0xbe9e('0x4a')](_['pick'](_0x1a044e[_0xbe9e('0x49')],_0x315a9d[_0xbe9e('0x4a')]));_0x43ba4b[_0xbe9e('0x53')][_0xbe9e('0x6e')]=_0x5adcf9['id'];if(_0x1a044e[_0xbe9e('0x49')][_0xbe9e('0x56')]){_0x43ba4b[_0xbe9e('0x53')]=_[_0xbe9e('0x54')](_0x43ba4b[_0xbe9e('0x53')],{'$or':_[_0xbe9e('0x43')](_0x43ba4b[_0xbe9e('0x4c')],function(_0x1e95d9){var _0x32280e={};_0x32280e[_0x1e95d9]={'$like':'%'+_0x1a044e[_0xbe9e('0x49')][_0xbe9e('0x56')]+'%'};return _0x32280e;})});}_0x43ba4b=_[_0xbe9e('0x54')]({},_0x43ba4b,_0x1a044e[_0xbe9e('0x57')]);return db['CannedAnswer'][_0xbe9e('0x1e')]({'where':_0x43ba4b[_0xbe9e('0x53')]})['then'](function(_0x2c9d54){_0x4f9a25[_0xbe9e('0x1e')]=_0x2c9d54;if(_0x1a044e[_0xbe9e('0x49')][_0xbe9e('0x59')]){_0x43ba4b[_0xbe9e('0x60')]=[{'all':!![]}];}return db[_0xbe9e('0x6f')][_0xbe9e('0x5a')](_0x43ba4b);})[_0xbe9e('0xe')](function(_0x29bba3){_0x4f9a25[_0xbe9e('0x5b')]=_0x29bba3;return _0x4f9a25;});}})['then'](respondWithFilteredResult(_0x39ffd0,_0x43ba4b))[_0xbe9e('0x18')](handleError(_0x39ffd0,null));};exports[_0xbe9e('0x71')]=function(_0x8fd8cb,_0x2c2855){return db[_0xbe9e('0x58')][_0xbe9e('0x64')]({'where':{'id':_0x8fd8cb[_0xbe9e('0x5d')]['id']}})[_0xbe9e('0xe')](handleEntityNotFound(_0x2c2855,null))['then'](function(_0xe3f1b6){if(_0xe3f1b6){return _0xe3f1b6['removeAnswers'](_0x8fd8cb[_0xbe9e('0x49')][_0xbe9e('0x6c')]);}})[_0xbe9e('0xe')](respondWithStatusCode(_0x2c2855,null))[_0xbe9e('0x18')](handleError(_0x2c2855,null));};exports[_0xbe9e('0x72')]=function(_0x5d1748,_0x55e7f2){var _0x40db59={'name':_0x5d1748['body']['name'],'key':_0x5d1748[_0xbe9e('0x61')][_0xbe9e('0x47')],'provider':_0x5d1748[_0xbe9e('0x61')]['provider']===_0xbe9e('0x63')?null:_0x5d1748[_0xbe9e('0x61')]['provider'],'email':_0x5d1748[_0xbe9e('0x61')][_0xbe9e('0x73')],'ListId':_0x5d1748[_0xbe9e('0x61')][_0xbe9e('0x74')],'active':!_[_0xbe9e('0x75')](_0x5d1748[_0xbe9e('0x61')][_0xbe9e('0x76')])?_0x5d1748[_0xbe9e('0x61')][_0xbe9e('0x76')]:!![],'description':_0x5d1748[_0xbe9e('0x61')][_0xbe9e('0x77')]||null};var _0x390ee0=getAuthenticationOptions(_0x40db59['provider'],_0x5d1748[_0xbe9e('0x61')]);_0x40db59[_0xbe9e('0x3e')]=_0x390ee0['Imap'];_0x40db59['Smtp']=_0x390ee0[_0xbe9e('0x3f')];return db['MailAccount'][_0xbe9e('0x72')](_0x40db59,{'include':[{'model':db[_0xbe9e('0x5e')],'as':_0xbe9e('0x3f')},{'model':db[_0xbe9e('0x40')],'as':'Imap'}]})[_0xbe9e('0xe')](function(_0x302b1f){var _0x4d56a4=_0x5d1748[_0xbe9e('0x33')]['get']({'plain':!![]});if(!_0x4d56a4)throw new Error(_0xbe9e('0x78'));if(_0x4d56a4[_0xbe9e('0x79')]===_0xbe9e('0x33')){var _0x28452f=_0x302b1f[_0xbe9e('0x24')]({'plain':!![]});return db[_0xbe9e('0x7a')]['find']({'where':{'name':_0xbe9e('0x25'),'userProfileId':_0x4d56a4[_0xbe9e('0x7b')]},'raw':!![]})['then'](function(_0x509168){if(_0x509168&&_0x509168[_0xbe9e('0x7c')]===0x0){return db[_0xbe9e('0x26')]['create']({'name':_0x28452f[_0xbe9e('0x28')],'resourceId':_0x28452f['id'],'type':_0x509168[_0xbe9e('0x28')],'sectionId':_0x509168['id']},{})[_0xbe9e('0xe')](function(){return _0x302b1f;});}else{return _0x302b1f;}})[_0xbe9e('0x18')](function(_0x30f8dc){logger['error'](_0xbe9e('0x7d'),_0x30f8dc);throw _0x30f8dc;});}return _0x302b1f;})['then'](respondWithResult(_0x55e7f2,0xc9))[_0xbe9e('0x18')](handleError(_0x55e7f2,null));};exports[_0xbe9e('0x7e')]=function(_0x57f6f1,_0x308bb3){return db[_0xbe9e('0x58')]['findOne']({'where':{'id':_0x57f6f1[_0xbe9e('0x5d')]['id']}})[_0xbe9e('0xe')](handleEntityNotFound(_0x308bb3,null))[_0xbe9e('0xe')](function(_0x3d202b){if(_0x3d202b){return _0x3d202b['getImap']();}return null;})[_0xbe9e('0xe')](respondWithResult(_0x308bb3,null))['catch'](handleError(_0x308bb3,null));};exports[_0xbe9e('0x7f')]=function(_0x27bf02,_0x5cf80d){if(_0x27bf02[_0xbe9e('0x61')]['id']){delete _0x27bf02[_0xbe9e('0x61')]['id'];}return db[_0xbe9e('0x58')][_0xbe9e('0x64')]({'where':{'id':_0x27bf02['params']['id']}})[_0xbe9e('0xe')](handleEntityNotFound(_0x5cf80d,null))[_0xbe9e('0xe')](function(_0x572709){if(_0x572709){_0x27bf02[_0xbe9e('0x61')][_0xbe9e('0x6e')]=_0x572709['id'];return db[_0xbe9e('0x40')][_0xbe9e('0x72')](_0x27bf02[_0xbe9e('0x61')]);}})['then'](respondWithResult(_0x5cf80d,null))[_0xbe9e('0x18')](handleError(_0x5cf80d,null));};exports[_0xbe9e('0x80')]=function(_0x156546,_0x1a92d0){return db[_0xbe9e('0x58')][_0xbe9e('0x69')]({'where':{'id':_0x156546[_0xbe9e('0x5d')]['id']}})[_0xbe9e('0xe')](handleEntityNotFound(_0x1a92d0,null))['then'](function(_0x163d14){if(_0x163d14){return _0x163d14[_0xbe9e('0x81')](null);}return null;})[_0xbe9e('0xe')](respondWithStatusCode(_0x1a92d0,null))[_0xbe9e('0x18')](handleError(_0x1a92d0,null));};exports['getSmtp']=function(_0x5fa91a,_0x4b9529){return db[_0xbe9e('0x58')][_0xbe9e('0x69')]({'where':{'id':_0x5fa91a[_0xbe9e('0x5d')]['id']}})[_0xbe9e('0xe')](handleEntityNotFound(_0x4b9529,null))[_0xbe9e('0xe')](function(_0x5681be){if(_0x5681be){return _0x5681be[_0xbe9e('0x82')]();}return null;})['then'](respondWithResult(_0x4b9529,null))[_0xbe9e('0x18')](handleError(_0x4b9529,null));};exports[_0xbe9e('0x83')]=function(_0x46f9f0,_0x397fc9){if(_0x46f9f0['body']['id']){delete _0x46f9f0[_0xbe9e('0x61')]['id'];}return db[_0xbe9e('0x58')][_0xbe9e('0x64')]({'where':{'id':_0x46f9f0['params']['id']}})[_0xbe9e('0xe')](handleEntityNotFound(_0x397fc9,null))['then'](function(_0x1f6a8a){if(_0x1f6a8a){_0x46f9f0['body'][_0xbe9e('0x6e')]=_0x1f6a8a['id'];return db[_0xbe9e('0x5e')]['create'](_0x46f9f0[_0xbe9e('0x61')]);}})['then'](respondWithResult(_0x397fc9,null))[_0xbe9e('0x18')](handleError(_0x397fc9,null));};exports[_0xbe9e('0x84')]=function(_0x514abe,_0x3824b5){return db['MailAccount'][_0xbe9e('0x69')]({'where':{'id':_0x514abe[_0xbe9e('0x5d')]['id']}})[_0xbe9e('0xe')](handleEntityNotFound(_0x3824b5,null))[_0xbe9e('0xe')](function(_0x12f922){if(_0x12f922){return _0x12f922[_0xbe9e('0x85')](null);}return null;})[_0xbe9e('0xe')](respondWithStatusCode(_0x3824b5,null))[_0xbe9e('0x18')](handleError(_0x3824b5,null));};exports['addInteraction']=function(_0xb8dc1,_0x57581f){return db[_0xbe9e('0x86')][_0xbe9e('0x64')]({'where':{'id':_0xb8dc1[_0xbe9e('0x5d')]['id']}})['then'](handleEntityNotFound(_0x57581f,null))[_0xbe9e('0xe')](function(_0x54e568){if(_0x54e568){return _0x54e568[_0xbe9e('0x87')](_0xb8dc1['body']['ids'],_[_0xbe9e('0x88')](_0xb8dc1[_0xbe9e('0x61')],[_0xbe9e('0x6c'),'id'])||{});}})[_0xbe9e('0xe')](respondWithResult(_0x57581f,null))[_0xbe9e('0x18')](handleError(_0x57581f,null));};exports['getInteractions']=function(_0x330307,_0xc31eef){var _0x48c799={'raw':![],'where':{}};var _0x6ccb1={};var _0x55bfa1={'count':0x0,'rows':[]};return db[_0xbe9e('0x58')]['findOne']({'where':{'id':_0x330307[_0xbe9e('0x5d')]['id']}})[_0xbe9e('0xe')](handleEntityNotFound(_0xc31eef,null))[_0xbe9e('0xe')](function(_0x11e29c){if(_0x11e29c){_0x6ccb1[_0xbe9e('0x48')]=_[_0xbe9e('0x5f')](db['MailInteraction']['rawAttributes']);_0x6ccb1['query']=_[_0xbe9e('0x5f')](_0x330307[_0xbe9e('0x49')]);_0x6ccb1[_0xbe9e('0x4a')]=_[_0xbe9e('0x4b')](_0x6ccb1[_0xbe9e('0x48')],_0x6ccb1['query']);_0x48c799[_0xbe9e('0x4c')]=_[_0xbe9e('0x4b')](_0x6ccb1[_0xbe9e('0x48')],qs[_0xbe9e('0x4d')](_0x330307[_0xbe9e('0x49')][_0xbe9e('0x4d')]));_0x48c799[_0xbe9e('0x4c')]=_0x48c799[_0xbe9e('0x4c')][_0xbe9e('0x4e')]?_0x48c799[_0xbe9e('0x4c')]:_0x6ccb1[_0xbe9e('0x48')];if(!_0x330307[_0xbe9e('0x49')]['hasOwnProperty']('nolimit')){_0x48c799['limit']=qs['limit'](_0x330307['query'][_0xbe9e('0x1d')]);_0x48c799[_0xbe9e('0x1f')]=qs[_0xbe9e('0x1f')](_0x330307['query'][_0xbe9e('0x1f')]);}_0x48c799[_0xbe9e('0x51')]=qs[_0xbe9e('0x52')](_0x330307['query'][_0xbe9e('0x52')]);_0x48c799[_0xbe9e('0x53')]=qs[_0xbe9e('0x4a')](_[_0xbe9e('0x6a')](_0x330307['query'],_0x6ccb1[_0xbe9e('0x4a')]));_0x48c799[_0xbe9e('0x53')]['MailAccountId']=_0x11e29c['id'];if(_0x330307[_0xbe9e('0x49')][_0xbe9e('0x56')]){_0x48c799[_0xbe9e('0x53')]=_[_0xbe9e('0x54')](_0x48c799[_0xbe9e('0x53')],{'$or':_[_0xbe9e('0x43')](_0x48c799['attributes'],function(_0x44c55f){var _0x3c840e={};_0x3c840e[_0x44c55f]={'$like':'%'+_0x330307['query']['filter']+'%'};return _0x3c840e;})});}_0x48c799=_[_0xbe9e('0x54')]({},_0x48c799,_0x330307[_0xbe9e('0x57')]);return db[_0xbe9e('0x86')]['count']({'where':_0x48c799[_0xbe9e('0x53')]})[_0xbe9e('0xe')](function(_0x3bcd4c){_0x55bfa1[_0xbe9e('0x1e')]=_0x3bcd4c;if(_0x330307[_0xbe9e('0x49')][_0xbe9e('0x59')]){_0x48c799['include']=[{'model':db[_0xbe9e('0x89')],'as':_0xbe9e('0x8a'),'required':![]},{'model':db[_0xbe9e('0x8b')],'as':_0xbe9e('0x8c'),'attributes':[_0xbe9e('0x28'),_0xbe9e('0x8d'),_0xbe9e('0x8e')],'required':![]},{'model':db['Tag'],'as':_0xbe9e('0x8f'),'attributes':['id','name',_0xbe9e('0x90')],'where':_0x330307[_0xbe9e('0x49')][_0xbe9e('0x91')]?{'id':_0x330307['query'][_0xbe9e('0x91')]}:undefined,'required':_0x330307[_0xbe9e('0x49')][_0xbe9e('0x91')]?!![]:![]}];}return db['MailInteraction'][_0xbe9e('0x5a')](_0x48c799);})['then'](function(_0x46a2de){_0x55bfa1['rows']=_0x46a2de;return _0x55bfa1;});}})[_0xbe9e('0xe')](respondWithFilteredResult(_0xc31eef,_0x48c799))[_0xbe9e('0x18')](handleError(_0xc31eef,null));};exports['addApplications']=function addApplications(_0x3b3cf5,_0x17e2a2){var _0x281c5e=_0x3b3cf5[_0xbe9e('0x5d')]['id'];var _0x49711d=_0x3b3cf5[_0xbe9e('0x61')];var _0x5baca1=0xc8;var _0x52a725=null;return db[_0xbe9e('0x92')]['transaction']({'isolationLevel':db[_0xbe9e('0x92')][_0xbe9e('0x93')][_0xbe9e('0x94')][_0xbe9e('0x95')]},function(_0x1184e0){return db[_0xbe9e('0x58')][_0xbe9e('0x69')]({'where':{'id':_0x281c5e},'transaction':_0x1184e0})[_0xbe9e('0xe')](function(_0xc7e102){if(_0xc7e102){return db[_0xbe9e('0x96')][_0xbe9e('0x23')]({'where':{'MailAccountId':_0x281c5e},'transaction':_0x1184e0})[_0xbe9e('0xe')](function(){var _0x413280=_[_0xbe9e('0x43')](_0x49711d,function(_0x452621){_0x452621[_0xbe9e('0x6e')]=_0x281c5e;return _0x452621;});return db[_0xbe9e('0x96')][_0xbe9e('0x97')](_0x413280,{'transaction':_0x1184e0});});}else{_0x5baca1=0x194;_0x52a725=[];}});})[_0xbe9e('0xe')](function(){if(_0x5baca1!==0x194){return db['MailApplication'][_0xbe9e('0x98')]({'where':{'MailAccountId':_0x281c5e},'order':_0xbe9e('0x99')})[_0xbe9e('0xe')](function(_0x4d1a29){_0x52a725=_0x4d1a29;});}})[_0xbe9e('0x18')](function(_0x421378){_0x5baca1=0x1f4;logger[_0xbe9e('0x14')](_0x421378[_0xbe9e('0x27')]);if(_0x421378[_0xbe9e('0x28')]){delete _0x421378[_0xbe9e('0x28')];}_0x52a725=_0x421378;})['finally'](function(){if(_0x52a725===null){_0x17e2a2[_0xbe9e('0x19')](_0x5baca1);}else{if(_0x5baca1===0x1f4){_0x17e2a2[_0xbe9e('0x1a')](_0x5baca1)[_0xbe9e('0x29')](_0x52a725);}else{_0x17e2a2['status'](_0x5baca1)[_0xbe9e('0x1c')](_0x52a725);}}});};exports['getApplications']=function(_0x563eab,_0x63238f){var _0x39a771={};var _0x29a105={};var _0x4ccb9a;var _0x4871a7;return db[_0xbe9e('0x58')][_0xbe9e('0x69')]({'where':{'id':_0x563eab[_0xbe9e('0x5d')]['id']}})[_0xbe9e('0xe')](handleEntityNotFound(_0x63238f,null))[_0xbe9e('0xe')](function(_0xbd71b3){if(_0xbd71b3){_0x4ccb9a=_0xbd71b3;_0x29a105['model']=_[_0xbe9e('0x5f')](db[_0xbe9e('0x96')][_0xbe9e('0x44')]);_0x29a105[_0xbe9e('0x49')]=_[_0xbe9e('0x5f')](_0x563eab[_0xbe9e('0x49')]);_0x29a105['filters']=_[_0xbe9e('0x4b')](_0x29a105['model'],_0x29a105['query']);_0x39a771['attributes']=_[_0xbe9e('0x4b')](_0x29a105[_0xbe9e('0x48')],qs['fields'](_0x563eab[_0xbe9e('0x49')][_0xbe9e('0x4d')]));_0x39a771[_0xbe9e('0x4c')]=_0x39a771[_0xbe9e('0x4c')][_0xbe9e('0x4e')]?_0x39a771[_0xbe9e('0x4c')]:_0x29a105['model'];_0x39a771['order']=qs[_0xbe9e('0x52')](_0x563eab[_0xbe9e('0x49')][_0xbe9e('0x52')]);_0x39a771['where']=qs['filters'](_[_0xbe9e('0x6a')](_0x563eab['query'],_0x29a105[_0xbe9e('0x4a')]));if(_0x563eab[_0xbe9e('0x49')][_0xbe9e('0x56')]){_0x39a771[_0xbe9e('0x53')]=_['merge'](_0x39a771['where'],{'$or':_[_0xbe9e('0x43')](_0x39a771[_0xbe9e('0x4c')],function(_0x4bcf3e){var _0xebaa5={};_0xebaa5[_0x4bcf3e]={'$like':'%'+_0x563eab['query'][_0xbe9e('0x56')]+'%'};return _0xebaa5;})});}_0x39a771=_[_0xbe9e('0x54')]({},_0x39a771,_0x563eab[_0xbe9e('0x57')]);return _0x4ccb9a[_0xbe9e('0x9a')](_0x39a771);}})[_0xbe9e('0xe')](function(_0x5d67f6){if(_0x5d67f6){_0x4871a7=_0x5d67f6[_0xbe9e('0x4e')];if(!_0x563eab['query'][_0xbe9e('0x4f')](_0xbe9e('0x50'))){_0x39a771[_0xbe9e('0x1d')]=qs[_0xbe9e('0x1d')](_0x563eab[_0xbe9e('0x49')][_0xbe9e('0x1d')]);_0x39a771[_0xbe9e('0x1f')]=qs[_0xbe9e('0x1f')](_0x563eab[_0xbe9e('0x49')][_0xbe9e('0x1f')]);}return _0x4ccb9a['getApplications'](_0x39a771);}})[_0xbe9e('0xe')](function(_0x5efce1){if(_0x5efce1){return _0x5efce1?{'count':_0x4871a7,'rows':_0x5efce1}:null;}})[_0xbe9e('0xe')](respondWithResult(_0x63238f,null))[_0xbe9e('0x18')](handleError(_0x63238f,null));};exports[_0xbe9e('0x9b')]=function(_0x75de48,_0x30fbe1){var _0x50fbb0={'raw':!![],'where':{}};var _0x2469b4={};var _0x4622f8={'count':0x0,'rows':[]};return db['MailAccount'][_0xbe9e('0x69')]({'where':{'id':_0x75de48['params']['id']}})[_0xbe9e('0xe')](handleEntityNotFound(_0x30fbe1,null))['then'](function(_0x4e58ef){if(_0x4e58ef){_0x2469b4[_0xbe9e('0x48')]=_['keys'](db['MailMessage'][_0xbe9e('0x44')]);_0x2469b4[_0xbe9e('0x49')]=_[_0xbe9e('0x5f')](_0x75de48[_0xbe9e('0x49')]);_0x2469b4[_0xbe9e('0x4a')]=_[_0xbe9e('0x4b')](_0x2469b4[_0xbe9e('0x48')],_0x2469b4[_0xbe9e('0x49')]);_0x50fbb0['attributes']=_[_0xbe9e('0x4b')](_0x2469b4[_0xbe9e('0x48')],qs[_0xbe9e('0x4d')](_0x75de48['query'][_0xbe9e('0x4d')]));_0x50fbb0['attributes']=_0x50fbb0['attributes'][_0xbe9e('0x4e')]?_0x50fbb0[_0xbe9e('0x4c')]:_0x2469b4['model'];if(!_0x75de48[_0xbe9e('0x49')][_0xbe9e('0x4f')](_0xbe9e('0x50'))){_0x50fbb0[_0xbe9e('0x1d')]=qs[_0xbe9e('0x1d')](_0x75de48[_0xbe9e('0x49')][_0xbe9e('0x1d')]);_0x50fbb0['offset']=qs[_0xbe9e('0x1f')](_0x75de48[_0xbe9e('0x49')][_0xbe9e('0x1f')]);}_0x50fbb0[_0xbe9e('0x51')]=qs[_0xbe9e('0x52')](_0x75de48[_0xbe9e('0x49')][_0xbe9e('0x52')]);_0x50fbb0[_0xbe9e('0x53')]=qs['filters'](_['pick'](_0x75de48[_0xbe9e('0x49')],_0x2469b4[_0xbe9e('0x4a')]));_0x50fbb0[_0xbe9e('0x53')][_0xbe9e('0x6e')]=_0x4e58ef['id'];if(_0x75de48[_0xbe9e('0x49')][_0xbe9e('0x56')]){_0x50fbb0[_0xbe9e('0x53')]=_['merge'](_0x50fbb0[_0xbe9e('0x53')],{'$or':_[_0xbe9e('0x43')](_0x50fbb0[_0xbe9e('0x4c')],function(_0x57d5bb){var _0x3cc349={};_0x3cc349[_0x57d5bb]={'$like':'%'+_0x75de48[_0xbe9e('0x49')][_0xbe9e('0x56')]+'%'};return _0x3cc349;})});}if(_0x75de48['query'][_0xbe9e('0x9c')]){var _0x1baa6=_0x75de48[_0xbe9e('0x49')][_0xbe9e('0x9c')][_0xbe9e('0x9d')](',');var _0x11b665={};_0x11b665[_0x1baa6[0x0]]={'$gte':moment(_0x1baa6[0x1])[_0xbe9e('0x9e')](_0xbe9e('0x9f'))};_0x50fbb0[_0xbe9e('0x53')]=_[_0xbe9e('0x54')](_0x50fbb0[_0xbe9e('0x53')],_0x11b665);}_0x50fbb0=_[_0xbe9e('0x54')]({},_0x50fbb0,_0x75de48['options']);return db[_0xbe9e('0xa0')][_0xbe9e('0x1e')]({'where':_0x50fbb0[_0xbe9e('0x53')]})['then'](function(_0x1fc9cb){_0x4622f8[_0xbe9e('0x1e')]=_0x1fc9cb;if(_0x75de48['query'][_0xbe9e('0x59')]){_0x50fbb0[_0xbe9e('0x60')]=[{'all':!![]}];}return db[_0xbe9e('0xa0')][_0xbe9e('0x5a')](_0x50fbb0);})[_0xbe9e('0xe')](function(_0xf9fc40){if(_0x75de48[_0xbe9e('0x49')][_0xbe9e('0xa1')]===_0xbe9e('0xa2')){for(var _0x2a9e1e=0x0;_0x2a9e1e<_0xf9fc40[_0xbe9e('0x4e')];_0x2a9e1e++){_0xf9fc40[_0x2a9e1e]['body']=juice(_0xf9fc40[_0x2a9e1e][_0xbe9e('0x61')]);}}_0x4622f8[_0xbe9e('0x5b')]=_0xf9fc40;return _0x4622f8;});}})[_0xbe9e('0xe')](respondWithFilteredResult(_0x30fbe1,_0x50fbb0))[_0xbe9e('0x18')](handleError(_0x30fbe1,null));};exports[_0xbe9e('0x29')]=function(_0x90ffcb,_0x49d903){var _0x53b016,_0x3e19c2={},_0x16fb6d;if(_0x90ffcb[_0xbe9e('0x61')]['to']){_0x16fb6d=_0x90ffcb[_0xbe9e('0x61')]['to'][_0xbe9e('0x9d')](',')[0x0];}return db['MailAccount'][_0xbe9e('0x64')]({'where':{'id':_0x90ffcb[_0xbe9e('0x5d')]['id']},'include':[{'model':db[_0xbe9e('0xa3')],'as':_0xbe9e('0xa4'),'include':[{'model':db[_0xbe9e('0x89')],'as':'Contacts','where':{'email':_0x16fb6d},'limit':0x1,'order':[[_0xbe9e('0xa5'),_0xbe9e('0xa6')]]}]},{'model':db[_0xbe9e('0x5e')],'as':_0xbe9e('0x3f'),'raw':!![],'include':[{'model':db[_0xbe9e('0xa7')],'as':'CloudProvider','raw':!![]}]}]})[_0xbe9e('0xe')](handleEntityNotFound(_0x49d903,null))[_0xbe9e('0xe')](function(_0x3f72c4){if(!_0x3f72c4)return;_0x53b016=_0x3f72c4;if(!_0x3f72c4[_0xbe9e('0x3f')])throw new Error(_0xbe9e('0xa8'));if(_[_0xbe9e('0x75')](_0x90ffcb['body'][_0xbe9e('0xa9')])){_0x90ffcb[_0xbe9e('0x61')]['from']=util[_0xbe9e('0x9e')](_0xbe9e('0xaa'),_0x3f72c4[_0xbe9e('0x28')],_0x3f72c4[_0xbe9e('0x73')]||_0x3f72c4[_0xbe9e('0x3f')][_0xbe9e('0x33')]);}if(_0x90ffcb[_0xbe9e('0x61')][_0xbe9e('0xab')]&&_0x90ffcb['body']['attachments']['length']){for(var _0x526860=0x0;_0x526860<_0x90ffcb[_0xbe9e('0x61')][_0xbe9e('0xab')][_0xbe9e('0x4e')];_0x526860+=0x1){_0x90ffcb['body'][_0xbe9e('0xab')][_0x526860]={'filename':_0x90ffcb[_0xbe9e('0x61')][_0xbe9e('0xab')][_0x526860][_0xbe9e('0x28')],'path':path['join'](config[_0xbe9e('0xac')],_0xbe9e('0xad'),_0x90ffcb['body'][_0xbe9e('0xab')][_0x526860][_0xbe9e('0xae')])};}}var _0x4479cc=_0x3f72c4[_0xbe9e('0xaf')]();return respondWithRpcPromise(_0xbe9e('0xb0'),_0xbe9e('0xb1'),{'account':_0x4479cc,'message':_0x90ffcb[_0xbe9e('0x61')]});})['then'](function(_0x3ee81d){if(!_0x3ee81d)return;_0x3e19c2=_0x3ee81d;if(!_0x53b016[_0xbe9e('0xa4')])throw new Error(_0xbe9e('0xb2'));if(_0x53b016[_0xbe9e('0xa4')][_0xbe9e('0xb3')][_0xbe9e('0x4e')])return _0x53b016['List'][_0xbe9e('0xb3')][0x0];return db[_0xbe9e('0x89')][_0xbe9e('0x72')](_[_0xbe9e('0xb4')](_0x90ffcb[_0xbe9e('0x61')],{'firstName':_0x90ffcb['body']['to'],'email':_0x90ffcb[_0xbe9e('0x61')]['to'],'phone':_0x90ffcb[_0xbe9e('0x61')]['to'],'ListId':_0x53b016[_0xbe9e('0x74')]}));})[_0xbe9e('0xe')](function(_0x599597){if(!_0x599597)return;var _0x1e1dc8={'UserId':_0x90ffcb[_0xbe9e('0x33')]['id'],'ContactId':_0x599597['id'],'MailAccountId':_0x53b016['id'],'inReplyTo':_0x3e19c2[_0xbe9e('0xb5')],'to':_0x90ffcb[_0xbe9e('0x61')][_0xbe9e('0xa9')],'cc':_0x90ffcb[_0xbe9e('0x61')]['cc'],'subject':_0x90ffcb[_0xbe9e('0x61')][_0xbe9e('0xb6')],'attach':_0x90ffcb[_0xbe9e('0x61')]['attach'],'firstMsgDirection':_0xbe9e('0xb7'),'lastMsgAt':moment()[_0xbe9e('0x9e')](_0xbe9e('0x9f')),'lastMsgDirection':'out','Messages':[_[_0xbe9e('0x54')](_0x90ffcb[_0xbe9e('0x61')],{'messageId':_0x3e19c2[_0xbe9e('0xb5')],'sentAt':moment()['format'](_0xbe9e('0x9f')),'read':!![],'MailAccountId':_0x53b016['id'],'UserId':_0x90ffcb[_0xbe9e('0x33')]['id'],'ContactId':_0x599597['id']})]};if(_0x90ffcb[_0xbe9e('0x61')][_0xbe9e('0xb8')]){_0x1e1dc8=_[_0xbe9e('0x54')](_0x1e1dc8,_0x90ffcb[_0xbe9e('0x61')]['Interaction']);}return db[_0xbe9e('0x86')][_0xbe9e('0x72')](_0x1e1dc8,{'include':[{'model':db[_0xbe9e('0xa0')],'as':'Messages'}]});})[_0xbe9e('0xe')](respondWithResult(_0x49d903,null))[_0xbe9e('0x18')](handleError(_0x49d903,null));};exports[_0xbe9e('0xb9')]=function(_0x4faaf6,_0xa9bf04){return db[_0xbe9e('0x58')]['find']({'where':{'id':_0x4faaf6[_0xbe9e('0x5d')]['id']},'include':[{'model':db[_0xbe9e('0x5e')],'as':_0xbe9e('0x3f'),'raw':!![],'include':[{'model':db[_0xbe9e('0xa7')],'as':'CloudProvider','raw':!![]}]}]})[_0xbe9e('0xe')](handleEntityNotFound(_0xa9bf04,null))[_0xbe9e('0xe')](function(_0x107641){if(!_0x107641[_0xbe9e('0x3f')])return;var _0x409bb5=_0x107641[_0xbe9e('0xaf')]();return respondWithRpcPromise(_0xbe9e('0xba'),_0xbe9e('0xb9'),{'account':_0x409bb5});})['then'](respondWithResult(_0xa9bf04,null))[_0xbe9e('0x18')](handleError(_0xa9bf04,null));};exports[_0xbe9e('0x23')]=function(_0x168076,_0x403eb0){return db[_0xbe9e('0x58')][_0xbe9e('0x64')]({'where':{'id':_0x168076[_0xbe9e('0x5d')]['id']}})['then'](handleEntityNotFound(_0x403eb0,null))[_0xbe9e('0xe')](function(_0x4d997a){if(_0x4d997a&&_0x4d997a[_0xbe9e('0x3c')]){throw new db[(_0xbe9e('0xbb'))][(_0xbe9e('0xbc'))](_0xbe9e('0xbd'));}return _0x4d997a;})[_0xbe9e('0xe')](removeEntity(_0x403eb0,null))[_0xbe9e('0x18')](handleError(_0x403eb0,null));};exports['addAgents']=function(_0x159ddf,_0x1b2eba){return db['MailAccount'][_0xbe9e('0x64')]({'where':{'id':_0x159ddf[_0xbe9e('0x5d')]['id']}})[_0xbe9e('0xe')](handleEntityNotFound(_0x1b2eba,null))[_0xbe9e('0xe')](function(_0x54dc4b){if(_0x54dc4b){return _0x54dc4b[_0xbe9e('0xbe')](_0x159ddf[_0xbe9e('0x61')][_0xbe9e('0x6c')],_[_0xbe9e('0x88')](_0x159ddf[_0xbe9e('0x61')],[_0xbe9e('0x6c'),'id'])||{})[_0xbe9e('0xbf')](function(_0xe721fa){for(var _0x3e088c=0x0;_0x3e088c<_0x159ddf[_0xbe9e('0x61')][_0xbe9e('0x6c')]['length'];_0x3e088c+=0x1){socket[_0xbe9e('0xc0')](_0xbe9e('0xc1'),{'UserId':Number(_0x159ddf[_0xbe9e('0x61')][_0xbe9e('0x6c')][_0x3e088c]),'MailAccountId':Number(_0x159ddf[_0xbe9e('0x5d')]['id'])});}return _0xe721fa;});}})['then'](respondWithResult(_0x1b2eba,null))[_0xbe9e('0x18')](handleError(_0x1b2eba,null));};exports['removeAgents']=function(_0x3732f9,_0x43c4e8){return db[_0xbe9e('0x58')]['find']({'where':{'id':_0x3732f9[_0xbe9e('0x5d')]['id']}})['then'](handleEntityNotFound(_0x43c4e8,null))[_0xbe9e('0xe')](function(_0x4d5bc9){if(_0x4d5bc9){return _0x4d5bc9['removeAgents'](_0x3732f9[_0xbe9e('0x49')][_0xbe9e('0x6c')])[_0xbe9e('0xe')](function(){if(_[_0xbe9e('0xc2')](_0x3732f9[_0xbe9e('0x49')][_0xbe9e('0x6c')])){for(var _0x8668a5=0x0;_0x8668a5<_0x3732f9[_0xbe9e('0x49')][_0xbe9e('0x6c')][_0xbe9e('0x4e')];_0x8668a5+=0x1){socket[_0xbe9e('0xc0')]('userMailAccount:remove',{'UserId':Number(_0x3732f9[_0xbe9e('0x49')][_0xbe9e('0x6c')][_0x8668a5]),'MailAccountId':Number(_0x3732f9[_0xbe9e('0x5d')]['id'])});}}else{socket[_0xbe9e('0xc0')](_0xbe9e('0xc3'),{'UserId':Number(_0x3732f9[_0xbe9e('0x49')][_0xbe9e('0x6c')]),'MailAccountId':Number(_0x3732f9[_0xbe9e('0x5d')]['id'])});}});}})[_0xbe9e('0xe')](respondWithStatusCode(_0x43c4e8,null))['catch'](handleError(_0x43c4e8,null));};exports[_0xbe9e('0xc4')]=function(_0x5c165d,_0x5a59c0){var _0x3dfaff={};var _0x182ff3={};var _0x1e85b1;var _0x4f5ffc;return db[_0xbe9e('0x58')]['findOne']({'where':{'id':_0x5c165d[_0xbe9e('0x5d')]['id']}})[_0xbe9e('0xe')](handleEntityNotFound(_0x5a59c0,null))['then'](function(_0x190dce){if(_0x190dce){_0x1e85b1=_0x190dce;_0x182ff3['model']=_['keys'](db[_0xbe9e('0x8b')][_0xbe9e('0x44')]);_0x182ff3[_0xbe9e('0x49')]=_['keys'](_0x5c165d[_0xbe9e('0x49')]);_0x182ff3[_0xbe9e('0x4a')]=_[_0xbe9e('0x4b')](_0x182ff3[_0xbe9e('0x48')],_0x182ff3['query']);_0x3dfaff[_0xbe9e('0x4c')]=_['intersection'](_0x182ff3[_0xbe9e('0x48')],qs[_0xbe9e('0x4d')](_0x5c165d[_0xbe9e('0x49')][_0xbe9e('0x4d')]));_0x3dfaff[_0xbe9e('0x4c')]=_0x3dfaff['attributes'][_0xbe9e('0x4e')]?_0x3dfaff[_0xbe9e('0x4c')]:_0x182ff3[_0xbe9e('0x48')];_0x3dfaff[_0xbe9e('0x51')]=qs[_0xbe9e('0x52')](_0x5c165d[_0xbe9e('0x49')]['sort']);_0x3dfaff['where']=qs[_0xbe9e('0x4a')](_[_0xbe9e('0x6a')](_0x5c165d['query'],_0x182ff3[_0xbe9e('0x4a')]));if(_0x5c165d[_0xbe9e('0x49')][_0xbe9e('0x56')]){_0x3dfaff[_0xbe9e('0x53')]=_[_0xbe9e('0x54')](_0x3dfaff['where'],{'$or':_[_0xbe9e('0x43')](_0x3dfaff['attributes'],function(_0x2efc9f){var _0x111f9a={};_0x111f9a[_0x2efc9f]={'$like':'%'+_0x5c165d['query']['filter']+'%'};return _0x111f9a;})});}_0x3dfaff=_[_0xbe9e('0x54')]({},_0x3dfaff,_0x5c165d['options']);return _0x1e85b1['getAgents'](_0x3dfaff);}})[_0xbe9e('0xe')](function(_0x2822d3){if(_0x2822d3){_0x4f5ffc=_0x2822d3[_0xbe9e('0x4e')];if(!_0x5c165d[_0xbe9e('0x49')][_0xbe9e('0x4f')](_0xbe9e('0x50'))){_0x3dfaff[_0xbe9e('0x1d')]=qs[_0xbe9e('0x1d')](_0x5c165d[_0xbe9e('0x49')][_0xbe9e('0x1d')]);_0x3dfaff[_0xbe9e('0x1f')]=qs[_0xbe9e('0x1f')](_0x5c165d[_0xbe9e('0x49')][_0xbe9e('0x1f')]);}return _0x1e85b1[_0xbe9e('0xc4')](_0x3dfaff);}})[_0xbe9e('0xe')](function(_0x1fbb67){if(_0x1fbb67){return _0x1fbb67?{'count':_0x4f5ffc,'rows':_0x1fbb67}:null;}})[_0xbe9e('0xe')](respondWithResult(_0x5a59c0,null))[_0xbe9e('0x18')](handleError(_0x5a59c0,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index 4d77be2..3a8e07d 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 _0x302e=['exports','events','../../mysqldb','MailAccount','setMaxListeners','update','remove','emit','hasOwnProperty','hook'];(function(_0x1d5458,_0x3acf09){var _0x9bf6f=function(_0x8d948c){while(--_0x8d948c){_0x1d5458['push'](_0x1d5458['shift']());}};_0x9bf6f(++_0x3acf09);}(_0x302e,0x1eb));var _0xe302=function(_0x1b8061,_0x45685a){_0x1b8061=_0x1b8061-0x0;var _0x249437=_0x302e[_0x1b8061];return _0x249437;};'use strict';var EventEmitter=require(_0xe302('0x0'));var MailAccount=require(_0xe302('0x1'))['db'][_0xe302('0x2')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0xe302('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xe302('0x4'),'afterDestroy':_0xe302('0x5')};function emitEvent(_0x3e965){return function(_0x5151d8,_0x321c8a,_0x1647a7){MailAccountEvents['emit'](_0x3e965+':'+_0x5151d8['id'],_0x5151d8);MailAccountEvents[_0xe302('0x6')](_0x3e965,_0x5151d8);_0x1647a7(null);};}for(var e in events){if(events[_0xe302('0x7')](e)){var event=events[e];MailAccount[_0xe302('0x8')](e,emitEvent(event));}}module[_0xe302('0x9')]=MailAccountEvents; \ No newline at end of file +var _0xc4aa=['../../mysqldb','MailAccount','setMaxListeners','save','update','emit','hasOwnProperty','hook','exports','events'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x16b9ed,_0x56517a){_0x16b9ed=_0x16b9ed-0x0;var _0x66b1f8=_0xc4aa[_0x16b9ed];return _0x66b1f8;};'use strict';var EventEmitter=require(_0xac4a('0x0'));var MailAccount=require(_0xac4a('0x1'))['db'][_0xac4a('0x2')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0xac4a('0x3')](0x0);var events={'afterCreate':_0xac4a('0x4'),'afterUpdate':_0xac4a('0x5'),'afterDestroy':'remove'};function emitEvent(_0x5cda73){return function(_0x47d4f6,_0x2f48ed,_0x15b967){MailAccountEvents[_0xac4a('0x6')](_0x5cda73+':'+_0x47d4f6['id'],_0x47d4f6);MailAccountEvents[_0xac4a('0x6')](_0x5cda73,_0x47d4f6);_0x15b967(null);};}for(var e in events){if(events[_0xac4a('0x7')](e)){var event=events[e];MailAccount[_0xac4a('0x8')](e,emitEvent(event));}}module[_0xac4a('0x9')]=MailAccountEvents; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.model.js b/server/api/mailAccount/mailAccount.model.js index a680e9a..19f3b56 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 _0xa121=['modernAuthentication','CloudProvider','Cloud\x20Provider\x20configuration\x20not\x20found','OAuth2','user','data5','auth','pass','./mailAccount.attributes','exports','define','MailAccount','provider','service','host','Smtp','port','secure','authentication'];(function(_0xc8e9ec,_0x2e8176){var _0x457706=function(_0x3684e9){while(--_0x3684e9){_0xc8e9ec['push'](_0xc8e9ec['shift']());}};_0x457706(++_0x2e8176);}(_0xa121,0xb3));var _0x1a12=function(_0x25198d,_0x5e2bce){_0x25198d=_0x25198d-0x0;var _0x273fd2=_0xa121[_0x25198d];return _0x273fd2;};'use strict';var attributes=require(_0x1a12('0x0'));module[_0x1a12('0x1')]=function(_0x3d1af6){return _0x3d1af6[_0x1a12('0x2')](_0x1a12('0x3'),attributes,{'tableName':'mail_accounts','paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x58ffa1=this;var _0x559ebb={'id':_0x58ffa1['id'],'tls':{'rejectUnauthorized':![]}};if(_0x58ffa1[_0x1a12('0x4')]!=='custom'){_0x559ebb[_0x1a12('0x5')]=_0x58ffa1[_0x1a12('0x4')];}else{_0x559ebb[_0x1a12('0x6')]=_0x58ffa1[_0x1a12('0x7')][_0x1a12('0x6')];_0x559ebb['port']=_0x58ffa1[_0x1a12('0x7')][_0x1a12('0x8')];_0x559ebb[_0x1a12('0x9')]=_0x58ffa1[_0x1a12('0x7')][_0x1a12('0x9')];}if(_0x58ffa1[_0x1a12('0x7')][_0x1a12('0xa')]){if(_0x58ffa1[_0x1a12('0x7')][_0x1a12('0xb')]){if(!_0x58ffa1[_0x1a12('0x7')][_0x1a12('0xc')])throw new Error(_0x1a12('0xd'));_0x559ebb['auth']={'type':_0x1a12('0xe'),'user':_0x58ffa1[_0x1a12('0x7')][_0x1a12('0xf')],'accessToken':_0x58ffa1[_0x1a12('0x7')]['CloudProvider'][_0x1a12('0x10')]};}else{_0x559ebb[_0x1a12('0x11')]={'user':_0x58ffa1[_0x1a12('0x7')][_0x1a12('0xf')],'pass':_0x58ffa1['Smtp'][_0x1a12('0x12')]};}}return _0x559ebb;}}});}; \ No newline at end of file +var _0xef6a=['authentication','modernAuthentication','Cloud\x20Provider\x20configuration\x20not\x20found','OAuth2','user','CloudProvider','auth','./mailAccount.attributes','exports','mail_accounts','provider','custom','service','host','Smtp','port','secure'];(function(_0x3f3f06,_0x581e5b){var _0x140feb=function(_0x4cc383){while(--_0x4cc383){_0x3f3f06['push'](_0x3f3f06['shift']());}};_0x140feb(++_0x581e5b);}(_0xef6a,0xf5));var _0xaef6=function(_0x2e4aa2,_0x11956a){_0x2e4aa2=_0x2e4aa2-0x0;var _0x5e6092=_0xef6a[_0x2e4aa2];return _0x5e6092;};'use strict';var attributes=require(_0xaef6('0x0'));module[_0xaef6('0x1')]=function(_0x2453d3){return _0x2453d3['define']('MailAccount',attributes,{'tableName':_0xaef6('0x2'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x1e2f0a=this;var _0x52a935={'id':_0x1e2f0a['id'],'tls':{'rejectUnauthorized':![]}};if(_0x1e2f0a[_0xaef6('0x3')]!==_0xaef6('0x4')){_0x52a935[_0xaef6('0x5')]=_0x1e2f0a[_0xaef6('0x3')];}else{_0x52a935[_0xaef6('0x6')]=_0x1e2f0a[_0xaef6('0x7')][_0xaef6('0x6')];_0x52a935['port']=_0x1e2f0a[_0xaef6('0x7')][_0xaef6('0x8')];_0x52a935[_0xaef6('0x9')]=_0x1e2f0a[_0xaef6('0x7')][_0xaef6('0x9')];}if(_0x1e2f0a[_0xaef6('0x7')][_0xaef6('0xa')]){if(_0x1e2f0a[_0xaef6('0x7')][_0xaef6('0xb')]){if(!_0x1e2f0a[_0xaef6('0x7')]['CloudProvider'])throw new Error(_0xaef6('0xc'));_0x52a935['auth']={'type':_0xaef6('0xd'),'user':_0x1e2f0a['Smtp'][_0xaef6('0xe')],'accessToken':_0x1e2f0a[_0xaef6('0x7')][_0xaef6('0xf')]['data5']};}else{_0x52a935[_0xaef6('0x10')]={'user':_0x1e2f0a[_0xaef6('0x7')]['user'],'pass':_0x1e2f0a[_0xaef6('0x7')]['pass']};}}return _0x52a935;}}});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.rpc.js b/server/api/mailAccount/mailAccount.rpc.js index e4fe778..fe25f91 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 _0x3831=['Start','startRouting','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','client','redis','socket.io-emitter','./mailAccount.socket','register','request','then','info','MailAccount,\x20%s,\x20%s','debug','MailAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','MailAccount','findAll','options','raw','where','attributes','limit','include','model','map','GetMailAccount','stringify','catch','ShowMailAccount','smtp','smtpOptions','NotifyMailAccount','mail','rawAttributes','createdAt','updatedAt','CompanyId','ListId','body','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','find','account','List','CmContact','Contacts','DESC','Applications','Smtp','CloudProvider','get','omit','getSmtpOptions','applications','list','orderBy','priority','autoclose','push','close','length','defaults','create','List\x20not\x20found','messageId','generate','subject','format','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','MailMessage','Messages','Contact\x20not\x20found','spread','update','attach','interaction','created','contact','attachments','originTo','originCc','ChatWebsiteId','originChannel','Email','ChatOfflineMessageId','Attachment','Attachments','UserId','name','unshift','*,*,*,*','MailQueue','queueId','queue','waitForTheAssignedQueue'];(function(_0x3d4f05,_0x3a1e88){var _0x227017=function(_0x56b6f8){while(--_0x56b6f8){_0x3d4f05['push'](_0x3d4f05['shift']());}};_0x227017(++_0x3a1e88);}(_0x3831,0x14c));var _0x1383=function(_0x4c1c6a,_0x4c1ef5){_0x4c1c6a=_0x4c1c6a-0x0;var _0x59a9df=_0x3831[_0x4c1c6a];return _0x59a9df;};'use strict';var _=require(_0x1383('0x0'));var moment=require('moment');var BPromise=require(_0x1383('0x1'));var rs=require(_0x1383('0x2'));var Redis=require(_0x1383('0x3'));var db=require(_0x1383('0x4'))['db'];var logger=require(_0x1383('0x5'))('rpc');var config=require(_0x1383('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x1383('0x7')]['http']({'port':0x232c});config['redis']=_['defaults'](config[_0x1383('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0x1383('0x9'))(new Redis(config[_0x1383('0x8')]));require(_0x1383('0xa'))[_0x1383('0xb')](socket);function respondWithRpcPromise(_0xd6be3b,_0x7cb670,_0x3ca0e6){return new BPromise(function(_0xe0ee2f,_0x47ba84){return client[_0x1383('0xc')](_0xd6be3b,_0x3ca0e6)[_0x1383('0xd')](function(_0x627ec3){logger[_0x1383('0xe')](_0x1383('0xf'),_0x7cb670,'request\x20sent');logger[_0x1383('0x10')](_0x1383('0x11'),_0x7cb670,_0x1383('0x12'),JSON['stringify'](_0x627ec3));if(_0x627ec3['error']){if(_0x627ec3[_0x1383('0x13')][_0x1383('0x14')]===0x1f4){logger[_0x1383('0x13')](_0x1383('0xf'),_0x7cb670,_0x627ec3[_0x1383('0x13')][_0x1383('0x15')]);return _0x47ba84(_0x627ec3[_0x1383('0x13')][_0x1383('0x15')]);}logger['error'](_0x1383('0xf'),_0x7cb670,_0x627ec3[_0x1383('0x13')][_0x1383('0x15')]);return _0xe0ee2f(_0x627ec3[_0x1383('0x13')][_0x1383('0x15')]);}else{logger[_0x1383('0xe')](_0x1383('0xf'),_0x7cb670,'request\x20sent');_0xe0ee2f(_0x627ec3['result'][_0x1383('0x15')]);}})['catch'](function(_0x236b29){logger['error']('MailAccount,\x20%s,\x20%s',_0x7cb670,_0x236b29);_0x47ba84(_0x236b29);});});}exports['GetMailAccount']=function(_0x1c8fe7){var _0x598d09=this;return new Promise(function(_0x2aa3b6,_0x57a840){return db[_0x1383('0x16')][_0x1383('0x17')]({'raw':_0x1c8fe7[_0x1383('0x18')]?_0x1c8fe7[_0x1383('0x18')][_0x1383('0x19')]===undefined?!![]:![]:!![],'where':_0x1c8fe7[_0x1383('0x18')]?_0x1c8fe7[_0x1383('0x18')][_0x1383('0x1a')]||null:null,'attributes':_0x1c8fe7[_0x1383('0x18')]?_0x1c8fe7['options'][_0x1383('0x1b')]||null:null,'limit':_0x1c8fe7[_0x1383('0x18')]?_0x1c8fe7[_0x1383('0x18')][_0x1383('0x1c')]||null:null,'include':_0x1c8fe7[_0x1383('0x18')]?_0x1c8fe7[_0x1383('0x18')][_0x1383('0x1d')]?_['map'](_0x1c8fe7['options'][_0x1383('0x1d')],function(_0x160497){return{'model':db[_0x160497[_0x1383('0x1e')]],'as':_0x160497['as'],'attributes':_0x160497[_0x1383('0x1b')],'include':_0x160497[_0x1383('0x1d')]?_['map'](_0x160497['include'],function(_0x4a8b6e){return{'model':db[_0x4a8b6e[_0x1383('0x1e')]],'as':_0x4a8b6e['as'],'attributes':_0x4a8b6e[_0x1383('0x1b')],'include':_0x4a8b6e[_0x1383('0x1d')]?_[_0x1383('0x1f')](_0x4a8b6e['include'],function(_0x1f7688){return{'model':db[_0x1f7688['model']],'as':_0x1f7688['as'],'attributes':_0x1f7688[_0x1383('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x1383('0xd')](function(_0x42d63f){logger[_0x1383('0xe')](_0x1383('0x20'),_0x1c8fe7);logger[_0x1383('0x10')](_0x1383('0x20'),_0x1c8fe7,JSON[_0x1383('0x21')](_0x42d63f));_0x2aa3b6(_0x42d63f);})[_0x1383('0x22')](function(_0x29ca05){logger[_0x1383('0x13')](_0x1383('0x20'),_0x29ca05[_0x1383('0x15')],_0x1c8fe7);_0x57a840(_0x598d09[_0x1383('0x13')](0x1f4,_0x29ca05['message']));});});};exports[_0x1383('0x23')]=function(_0xadfc34){var _0xb8d058=this;return new Promise(function(_0x343f22,_0x64c8ce){return db[_0x1383('0x16')]['find']({'raw':_0xadfc34[_0x1383('0x18')]?_0xadfc34[_0x1383('0x18')][_0x1383('0x19')]===undefined?!![]:![]:!![],'where':_0xadfc34[_0x1383('0x18')]?_0xadfc34[_0x1383('0x18')][_0x1383('0x1a')]||null:null,'attributes':_0xadfc34['options']?_0xadfc34[_0x1383('0x18')]['attributes']||null:null,'include':_0xadfc34['options']?_0xadfc34[_0x1383('0x18')][_0x1383('0x1d')]?_[_0x1383('0x1f')](_0xadfc34['options']['include'],function(_0x5bca56){return{'model':db[_0x5bca56[_0x1383('0x1e')]],'as':_0x5bca56['as'],'attributes':_0x5bca56[_0x1383('0x1b')],'include':_0x5bca56[_0x1383('0x1d')]?_['map'](_0x5bca56['include'],function(_0x3ab8fe){return{'model':db[_0x3ab8fe[_0x1383('0x1e')]],'as':_0x3ab8fe['as'],'attributes':_0x3ab8fe[_0x1383('0x1b')],'include':_0x3ab8fe[_0x1383('0x1d')]?_['map'](_0x3ab8fe['include'],function(_0x2eea78){return{'model':db[_0x2eea78[_0x1383('0x1e')]],'as':_0x2eea78['as'],'attributes':_0x2eea78[_0x1383('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x1383('0xd')](function(_0x2afb4a){if(_0xadfc34[_0x1383('0x18')][_0x1383('0x24')]===!![])_0x2afb4a['setDataValue'](_0x1383('0x25'),_0x2afb4a['getSmtpOptions']());logger[_0x1383('0xe')](_0x1383('0x23'),_0xadfc34);logger[_0x1383('0x10')]('ShowMailAccount',_0xadfc34,JSON[_0x1383('0x21')](_0x2afb4a));_0x343f22(_0x2afb4a);})['catch'](function(_0x592633){logger[_0x1383('0x13')](_0x1383('0x23'),_0x592633[_0x1383('0x15')],_0xadfc34);_0x64c8ce(_0xb8d058['error'](0x1f4,_0x592633[_0x1383('0x15')]));});});};exports[_0x1383('0x26')]=function(_0x11ada6){var _0x3d6122=this;return new Promise(function(_0x56c269,_0x1ea73e){var _0x4c465e={'body':_0x11ada6['body'],'channel':_0x1383('0x27')};var _0x2f61fb=_['difference'](_['keys'](db['CmContact'][_0x1383('0x28')]),[_0x1383('0x29'),_0x1383('0x2a'),_0x1383('0x2b'),_0x1383('0x2c')]);var _0x3e737a=![];if(_0x11ada6[_0x1383('0x2d')]['id']){delete _0x11ada6[_0x1383('0x2d')]['id'];}if(_[_0x1383('0x2e')](_0x11ada6['body'][_0x1383('0x2f')])){return _0x1ea73e(_0x3d6122[_0x1383('0x13')](0x1f4,_0x1383('0x30')));}if(_['isNil'](_0x11ada6[_0x1383('0x2d')]['body'])||_0x11ada6[_0x1383('0x2d')][_0x1383('0x2d')]===''){return _0x1ea73e(_0x3d6122[_0x1383('0x13')](0x1f4,_0x1383('0x31')));}if(_[_0x1383('0x2e')](_0x11ada6[_0x1383('0x2d')][_0x1383('0x32')])){return _0x1ea73e(_0x3d6122[_0x1383('0x13')](0x1f4,_0x1383('0x33')+_0x2f61fb));}if(!_['includes'](_0x2f61fb,_0x11ada6['body']['mapKey'])){return _0x1ea73e(_0x3d6122[_0x1383('0x13')](0x1f4,_0x1383('0x34')+_0x2f61fb));}var _0x3a8f5f={};_0x3a8f5f[_0x11ada6[_0x1383('0x2d')][_0x1383('0x32')]]=_0x11ada6[_0x1383('0x2d')]['from'];return db[_0x1383('0x16')][_0x1383('0x35')]({'where':{'id':_0x11ada6[_0x1383('0x36')]['id']},'include':[{'model':db['CmList'],'as':_0x1383('0x37'),'include':[{'model':db[_0x1383('0x38')],'as':_0x1383('0x39'),'where':_0x3a8f5f,'limit':0x1,'order':[[_0x1383('0x2a'),_0x1383('0x3a')]]}]},{'model':db['MailApplication'],'as':_0x1383('0x3b')},{'model':db['MailServerOut'],'as':_0x1383('0x3c'),'include':[{'model':db[_0x1383('0x3d')],'as':'CloudProvider'}]}]})[_0x1383('0xd')](function(_0x2e41c3){if(_0x2e41c3&&_0x2e41c3[_0x1383('0x37')]){var _0x1a2836=_0x2e41c3[_0x1383('0x3e')]({'plain':!![]});_0x4c465e[_0x1383('0x36')]=_[_0x1383('0x3f')](_0x1a2836,[_0x1383('0x3b'),_0x1383('0x37')]);_0x4c465e[_0x1383('0x36')]['smtpOptions']=_0x2e41c3[_0x1383('0x40')]();_0x4c465e[_0x1383('0x41')]=_0x1a2836[_0x1383('0x3b')];_0x4c465e[_0x1383('0x42')]=_0x1a2836[_0x1383('0x37')];_0x4c465e[_0x1383('0x41')]=_[_0x1383('0x43')](_0x4c465e[_0x1383('0x41')],[_0x1383('0x44')],['asc']);if(_0x4c465e[_0x1383('0x36')]&&_0x4c465e[_0x1383('0x36')][_0x1383('0x45')]){_0x4c465e['applications'][_0x1383('0x46')]({'id':0x0,'priority':_0x4c465e[_0x1383('0x41')]['length']+0x1,'app':_0x1383('0x47'),'appdata':_0x1383('0x45'),'interval':'*,*,*,*'});}if(_0x4c465e['account'][_0x1383('0x3b')]){delete _0x4c465e[_0x1383('0x36')][_0x1383('0x3b')];}if(_0x4c465e['account'][_0x1383('0x37')]){delete _0x4c465e[_0x1383('0x36')]['List'];}if(_0x1a2836[_0x1383('0x37')]['Contacts'][_0x1383('0x48')]){return _0x1a2836[_0x1383('0x37')][_0x1383('0x39')][0x0];}var _0x2bfcdd=_[_0x1383('0x49')](_0x11ada6[_0x1383('0x2d')],{'firstName':_0x11ada6[_0x1383('0x2d')][_0x1383('0x2f')],'ListId':_0x1a2836[_0x1383('0x2c')]});_0x2bfcdd[_0x11ada6[_0x1383('0x2d')][_0x1383('0x32')]]=_0x11ada6[_0x1383('0x2d')][_0x1383('0x2f')];return db[_0x1383('0x38')][_0x1383('0x4a')](_0x2bfcdd);}else{throw new Error(_0x1383('0x4b'));}})[_0x1383('0xd')](function(_0x3bd569){_0x4c465e['contact']=_0x3bd569;if(_0x3bd569){if(!_0x11ada6[_0x1383('0x2d')][_0x1383('0x15')][_0x1383('0x4c')]){_0x11ada6[_0x1383('0x2d')][_0x1383('0x15')][_0x1383('0x4c')]=rs[_0x1383('0x4d')]()+'\x20'+_0x11ada6[_0x1383('0x2d')][_0x1383('0x15')][_0x1383('0x2f')];}var _0x3ff9bc={'ContactId':_0x3bd569['id'],'MailAccountId':_0x11ada6[_0x1383('0x36')]['id'],'inReplyTo':_0x11ada6[_0x1383('0x2d')][_0x1383('0x15')]['messageId'],'to':_0x11ada6[_0x1383('0x2d')]['message'][_0x1383('0x2f')],'cc':_0x11ada6[_0x1383('0x2d')]['message']['cc'],'subject':_0x11ada6[_0x1383('0x2d')][_0x1383('0x15')][_0x1383('0x4e')],'attach':_0x11ada6[_0x1383('0x2d')]['message']['attach'],'lastMsgAt':moment()[_0x1383('0x4f')](_0x1383('0x50')),'lastMsgDirection':'in'};return db[_0x1383('0x51')][_0x1383('0x35')]({'where':{'closed':![],'MailAccountId':_0x11ada6['account']['id']},'include':[{'model':db[_0x1383('0x52')],'as':_0x1383('0x53'),'attributes':[_0x1383('0x4c')],'where':{'messageId':_0x11ada6['body'][_0x1383('0x15')]['inReplyTo']}}]})[_0x1383('0xd')](function(_0x4ae832){if(_0x4ae832){return[_0x4ae832,![]];}return db[_0x1383('0x51')][_0x1383('0x4a')](_0x3ff9bc)[_0x1383('0xd')](function(_0x1cd59b){return[_0x1cd59b,!![]];});});}else{throw new Error(_0x1383('0x54'));}})[_0x1383('0x55')](function(_0x15a08e,_0x1bce05){if(_0x15a08e){_0x3e737a=_0x1bce05;if(!_0x1bce05){return _0x15a08e[_0x1383('0x56')]({'inReplyTo':_0x11ada6[_0x1383('0x2d')][_0x1383('0x15')][_0x1383('0x4c')],'to':_0x11ada6[_0x1383('0x2d')]['message'][_0x1383('0x2f')],'cc':_0x11ada6[_0x1383('0x2d')][_0x1383('0x15')]['cc'],'subject':_0x11ada6[_0x1383('0x2d')]['message']['subject'],'attach':_0x15a08e[_0x1383('0x57')]?_0x15a08e[_0x1383('0x57')]:_0x11ada6['body']['message'][_0x1383('0x57')],'substatus':null,'substatusAt':moment()[_0x1383('0x4f')](_0x1383('0x50')),'lastMsgAt':moment()[_0x1383('0x4f')](_0x1383('0x50')),'lastMsgDirection':'in'});}else{return _0x15a08e;}}})['then'](function(_0x3fcc3f){_0x4c465e[_0x1383('0x58')]=_0x3fcc3f[_0x1383('0x3e')]({'plain':!![]});_0x4c465e[_0x1383('0x58')][_0x1383('0x59')]=_0x3e737a;return db[_0x1383('0x52')][_0x1383('0x4a')]({'body':_0x11ada6['body'][_0x1383('0x2d')],'MailAccountId':_0x11ada6['account']['id'],'MailInteractionId':_0x3fcc3f['id'],'direction':'in','ContactId':_0x4c465e[_0x1383('0x5a')]['id'],'messageId':_0x11ada6['body'][_0x1383('0x15')]['messageId'],'from':_0x11ada6[_0x1383('0x2d')][_0x1383('0x15')][_0x1383('0x2f')],'to':_0x11ada6['body'][_0x1383('0x15')]['to'],'cc':_0x11ada6['body'][_0x1383('0x15')]['cc'],'subject':_0x11ada6['body'][_0x1383('0x15')]['subject'],'attach':_0x11ada6['body'][_0x1383('0x15')][_0x1383('0x57')],'Attachments':_0x11ada6[_0x1383('0x2d')][_0x1383('0x15')][_0x1383('0x5b')],'originTo':_0x11ada6[_0x1383('0x2d')][_0x1383('0x15')][_0x1383('0x5c')],'originCc':_0x11ada6[_0x1383('0x2d')][_0x1383('0x15')][_0x1383('0x5d')],'bcc':_0x11ada6[_0x1383('0x2d')][_0x1383('0x15')]['bcc'],'ChatWebsiteId':_0x11ada6[_0x1383('0x2d')][_0x1383('0x15')][_0x1383('0x5e')]||null,'originChannel':_0x11ada6[_0x1383('0x2d')][_0x1383('0x15')][_0x1383('0x5f')]||_0x1383('0x60'),'ChatOfflineMessageId':_0x11ada6[_0x1383('0x2d')][_0x1383('0x15')][_0x1383('0x61')]||null},{'include':[{'model':db[_0x1383('0x62')],'as':_0x1383('0x63')}]});})[_0x1383('0xd')](function(_0x4b803d){_0x4c465e[_0x1383('0x15')]=_0x4b803d;if(!_0x4c465e['interaction'][_0x1383('0x64')]){return;}return db['User']['find']({'attributes':['id',_0x1383('0x65')],'where':{'id':_0x4c465e[_0x1383('0x58')]['UserId']}});})['then'](function(_0x817877){if(_0x817877){_0x4c465e[_0x1383('0x41')][_0x1383('0x66')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x817877[_0x1383('0x65')]+','+(_0x4c465e[_0x1383('0x36')]['waitForTheAssignedAgent']||0xa),'interval':_0x1383('0x67')});}if(!_0x4c465e[_0x1383('0x58')]['queueId']){return;}return db[_0x1383('0x68')][_0x1383('0x35')]({'attributes':['id',_0x1383('0x65')],'where':{'id':_0x4c465e[_0x1383('0x58')][_0x1383('0x69')]}});})[_0x1383('0xd')](function(_0x452dc9){if(_0x452dc9){_0x4c465e['applications'][_0x1383('0x66')]({'id':0x0,'priority':0x1,'app':_0x1383('0x6a'),'appdata':_0x452dc9['name']+','+(_0x4c465e['account'][_0x1383('0x6b')]||0x12c),'interval':_0x1383('0x67')});}return respondWithRpcPromise(_0x1383('0x6c'),_0x1383('0x6d'),_0x4c465e);})['then'](function(_0x3f8250){_0x56c269(_0x3f8250);})[_0x1383('0x22')](function(_0x386f1e){_0x1ea73e(_0x3d6122[_0x1383('0x13')](0x1f4,_0x386f1e[_0x1383('0x15')]));});});}; \ No newline at end of file +var _0xe714=['User','unshift','agent','waitForTheAssignedAgent','MailQueue','queueId','queue','waitForTheAssignedQueue','Start','startRouting','lodash','bluebird','randomstring','ioredis','../../mysqldb','rpc','jayson/promise','client','http','redis','defaults','socket.io-emitter','./mailAccount.socket','request','then','info','MailAccount,\x20%s,\x20%s','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','GetMailAccount','MailAccount','findAll','options','raw','where','attributes','include','map','model','catch','smtp','setDataValue','smtpOptions','getSmtpOptions','ShowMailAccount','NotifyMailAccount','mail','difference','keys','createdAt','updatedAt','CompanyId','ListId','body','isNil','from','from\x20is\x20mandatory','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','account','CmList','CmContact','Contacts','DESC','MailApplication','Applications','MailServerOut','CloudProvider','List','get','omit','applications','orderBy','priority','asc','autoclose','length','close','*,*,*,*','create','List\x20not\x20found','messageId','generate','subject','attach','format','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','find','Messages','inReplyTo','spread','update','interaction','attachments','originTo','originCc','originChannel','Email','ChatOfflineMessageId','Attachment','UserId'];(function(_0x369191,_0x5277af){var _0x1cec18=function(_0xb9058a){while(--_0xb9058a){_0x369191['push'](_0x369191['shift']());}};_0x1cec18(++_0x5277af);}(_0xe714,0xe2));var _0x4e71=function(_0x21c334,_0x3c797f){_0x21c334=_0x21c334-0x0;var _0x52cc3c=_0xe714[_0x21c334];return _0x52cc3c;};'use strict';var _=require(_0x4e71('0x0'));var moment=require('moment');var BPromise=require(_0x4e71('0x1'));var rs=require(_0x4e71('0x2'));var Redis=require(_0x4e71('0x3'));var db=require(_0x4e71('0x4'))['db'];var logger=require('../../config/logger')(_0x4e71('0x5'));var config=require('../../config/environment');var jayson=require(_0x4e71('0x6'));var client=jayson[_0x4e71('0x7')][_0x4e71('0x8')]({'port':0x232c});config[_0x4e71('0x9')]=_[_0x4e71('0xa')](config[_0x4e71('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x4e71('0xb'))(new Redis(config[_0x4e71('0x9')]));require(_0x4e71('0xc'))['register'](socket);function respondWithRpcPromise(_0x6faa35,_0x4fd08b,_0x300ff6){return new BPromise(function(_0x372059,_0x73a271){return client[_0x4e71('0xd')](_0x6faa35,_0x300ff6)[_0x4e71('0xe')](function(_0xddba1c){logger[_0x4e71('0xf')](_0x4e71('0x10'),_0x4fd08b,'request\x20sent');logger[_0x4e71('0x11')](_0x4e71('0x12'),_0x4fd08b,'request\x20sent',JSON[_0x4e71('0x13')](_0xddba1c));if(_0xddba1c[_0x4e71('0x14')]){if(_0xddba1c['error'][_0x4e71('0x15')]===0x1f4){logger[_0x4e71('0x14')]('MailAccount,\x20%s,\x20%s',_0x4fd08b,_0xddba1c['error'][_0x4e71('0x16')]);return _0x73a271(_0xddba1c['error']['message']);}logger['error'](_0x4e71('0x10'),_0x4fd08b,_0xddba1c[_0x4e71('0x14')]['message']);return _0x372059(_0xddba1c['error'][_0x4e71('0x16')]);}else{logger[_0x4e71('0xf')](_0x4e71('0x10'),_0x4fd08b,_0x4e71('0x17'));_0x372059(_0xddba1c[_0x4e71('0x18')][_0x4e71('0x16')]);}})['catch'](function(_0x18b745){logger[_0x4e71('0x14')]('MailAccount,\x20%s,\x20%s',_0x4fd08b,_0x18b745);_0x73a271(_0x18b745);});});}exports[_0x4e71('0x19')]=function(_0x20b3ef){var _0x59ac5a=this;return new Promise(function(_0x573bad,_0x5e09b9){return db[_0x4e71('0x1a')][_0x4e71('0x1b')]({'raw':_0x20b3ef[_0x4e71('0x1c')]?_0x20b3ef[_0x4e71('0x1c')][_0x4e71('0x1d')]===undefined?!![]:![]:!![],'where':_0x20b3ef[_0x4e71('0x1c')]?_0x20b3ef[_0x4e71('0x1c')][_0x4e71('0x1e')]||null:null,'attributes':_0x20b3ef[_0x4e71('0x1c')]?_0x20b3ef[_0x4e71('0x1c')][_0x4e71('0x1f')]||null:null,'limit':_0x20b3ef[_0x4e71('0x1c')]?_0x20b3ef['options']['limit']||null:null,'include':_0x20b3ef['options']?_0x20b3ef['options'][_0x4e71('0x20')]?_[_0x4e71('0x21')](_0x20b3ef[_0x4e71('0x1c')]['include'],function(_0x35f181){return{'model':db[_0x35f181[_0x4e71('0x22')]],'as':_0x35f181['as'],'attributes':_0x35f181[_0x4e71('0x1f')],'include':_0x35f181[_0x4e71('0x20')]?_[_0x4e71('0x21')](_0x35f181[_0x4e71('0x20')],function(_0x53b08a){return{'model':db[_0x53b08a['model']],'as':_0x53b08a['as'],'attributes':_0x53b08a[_0x4e71('0x1f')],'include':_0x53b08a[_0x4e71('0x20')]?_[_0x4e71('0x21')](_0x53b08a[_0x4e71('0x20')],function(_0xfe5901){return{'model':db[_0xfe5901[_0x4e71('0x22')]],'as':_0xfe5901['as'],'attributes':_0xfe5901['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x51e9ea){logger[_0x4e71('0xf')](_0x4e71('0x19'),_0x20b3ef);logger['debug'](_0x4e71('0x19'),_0x20b3ef,JSON['stringify'](_0x51e9ea));_0x573bad(_0x51e9ea);})[_0x4e71('0x23')](function(_0x4326cd){logger[_0x4e71('0x14')](_0x4e71('0x19'),_0x4326cd[_0x4e71('0x16')],_0x20b3ef);_0x5e09b9(_0x59ac5a['error'](0x1f4,_0x4326cd[_0x4e71('0x16')]));});});};exports['ShowMailAccount']=function(_0x17ab47){var _0x2e0f5d=this;return new Promise(function(_0x17ed65,_0x446b39){return db[_0x4e71('0x1a')]['find']({'raw':_0x17ab47['options']?_0x17ab47['options'][_0x4e71('0x1d')]===undefined?!![]:![]:!![],'where':_0x17ab47[_0x4e71('0x1c')]?_0x17ab47['options'][_0x4e71('0x1e')]||null:null,'attributes':_0x17ab47[_0x4e71('0x1c')]?_0x17ab47['options']['attributes']||null:null,'include':_0x17ab47[_0x4e71('0x1c')]?_0x17ab47[_0x4e71('0x1c')]['include']?_[_0x4e71('0x21')](_0x17ab47[_0x4e71('0x1c')]['include'],function(_0x24a8eb){return{'model':db[_0x24a8eb[_0x4e71('0x22')]],'as':_0x24a8eb['as'],'attributes':_0x24a8eb[_0x4e71('0x1f')],'include':_0x24a8eb['include']?_[_0x4e71('0x21')](_0x24a8eb[_0x4e71('0x20')],function(_0x9cb8e6){return{'model':db[_0x9cb8e6[_0x4e71('0x22')]],'as':_0x9cb8e6['as'],'attributes':_0x9cb8e6[_0x4e71('0x1f')],'include':_0x9cb8e6['include']?_[_0x4e71('0x21')](_0x9cb8e6[_0x4e71('0x20')],function(_0xf946c3){return{'model':db[_0xf946c3[_0x4e71('0x22')]],'as':_0xf946c3['as'],'attributes':_0xf946c3[_0x4e71('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x50b1b0){if(_0x17ab47[_0x4e71('0x1c')][_0x4e71('0x24')]===!![])_0x50b1b0[_0x4e71('0x25')](_0x4e71('0x26'),_0x50b1b0[_0x4e71('0x27')]());logger['info'](_0x4e71('0x28'),_0x17ab47);logger['debug'](_0x4e71('0x28'),_0x17ab47,JSON['stringify'](_0x50b1b0));_0x17ed65(_0x50b1b0);})[_0x4e71('0x23')](function(_0x25be66){logger['error'](_0x4e71('0x28'),_0x25be66[_0x4e71('0x16')],_0x17ab47);_0x446b39(_0x2e0f5d[_0x4e71('0x14')](0x1f4,_0x25be66[_0x4e71('0x16')]));});});};exports[_0x4e71('0x29')]=function(_0x34bf2a){var _0x43a395=this;return new Promise(function(_0x2bae8a,_0x1d00e5){var _0x5c7c3e={'body':_0x34bf2a['body'],'channel':_0x4e71('0x2a')};var _0x3af98f=_[_0x4e71('0x2b')](_[_0x4e71('0x2c')](db['CmContact']['rawAttributes']),[_0x4e71('0x2d'),_0x4e71('0x2e'),_0x4e71('0x2f'),_0x4e71('0x30')]);var _0x46963b=![];if(_0x34bf2a[_0x4e71('0x31')]['id']){delete _0x34bf2a[_0x4e71('0x31')]['id'];}if(_[_0x4e71('0x32')](_0x34bf2a[_0x4e71('0x31')][_0x4e71('0x33')])){return _0x1d00e5(_0x43a395[_0x4e71('0x14')](0x1f4,_0x4e71('0x34')));}if(_['isNil'](_0x34bf2a[_0x4e71('0x31')][_0x4e71('0x31')])||_0x34bf2a[_0x4e71('0x31')]['body']===''){return _0x1d00e5(_0x43a395['error'](0x1f4,'body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_['isNil'](_0x34bf2a[_0x4e71('0x31')][_0x4e71('0x35')])){return _0x1d00e5(_0x43a395['error'](0x1f4,'mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x3af98f));}if(!_['includes'](_0x3af98f,_0x34bf2a[_0x4e71('0x31')][_0x4e71('0x35')])){return _0x1d00e5(_0x43a395[_0x4e71('0x14')](0x1f4,_0x4e71('0x36')+_0x3af98f));}var _0x3daa67={};_0x3daa67[_0x34bf2a[_0x4e71('0x31')][_0x4e71('0x35')]]=_0x34bf2a[_0x4e71('0x31')][_0x4e71('0x33')];return db[_0x4e71('0x1a')]['find']({'where':{'id':_0x34bf2a[_0x4e71('0x37')]['id']},'include':[{'model':db[_0x4e71('0x38')],'as':'List','include':[{'model':db[_0x4e71('0x39')],'as':_0x4e71('0x3a'),'where':_0x3daa67,'limit':0x1,'order':[['updatedAt',_0x4e71('0x3b')]]}]},{'model':db[_0x4e71('0x3c')],'as':_0x4e71('0x3d')},{'model':db[_0x4e71('0x3e')],'as':'Smtp','include':[{'model':db[_0x4e71('0x3f')],'as':'CloudProvider'}]}]})['then'](function(_0x2af74c){if(_0x2af74c&&_0x2af74c[_0x4e71('0x40')]){var _0x3d57a4=_0x2af74c[_0x4e71('0x41')]({'plain':!![]});_0x5c7c3e[_0x4e71('0x37')]=_[_0x4e71('0x42')](_0x3d57a4,['Applications',_0x4e71('0x40')]);_0x5c7c3e[_0x4e71('0x37')][_0x4e71('0x26')]=_0x2af74c[_0x4e71('0x27')]();_0x5c7c3e[_0x4e71('0x43')]=_0x3d57a4['Applications'];_0x5c7c3e['list']=_0x3d57a4[_0x4e71('0x40')];_0x5c7c3e[_0x4e71('0x43')]=_[_0x4e71('0x44')](_0x5c7c3e[_0x4e71('0x43')],[_0x4e71('0x45')],[_0x4e71('0x46')]);if(_0x5c7c3e[_0x4e71('0x37')]&&_0x5c7c3e[_0x4e71('0x37')][_0x4e71('0x47')]){_0x5c7c3e[_0x4e71('0x43')]['push']({'id':0x0,'priority':_0x5c7c3e[_0x4e71('0x43')][_0x4e71('0x48')]+0x1,'app':_0x4e71('0x49'),'appdata':_0x4e71('0x47'),'interval':_0x4e71('0x4a')});}if(_0x5c7c3e[_0x4e71('0x37')][_0x4e71('0x3d')]){delete _0x5c7c3e[_0x4e71('0x37')][_0x4e71('0x3d')];}if(_0x5c7c3e[_0x4e71('0x37')][_0x4e71('0x40')]){delete _0x5c7c3e[_0x4e71('0x37')][_0x4e71('0x40')];}if(_0x3d57a4['List'][_0x4e71('0x3a')][_0x4e71('0x48')]){return _0x3d57a4[_0x4e71('0x40')][_0x4e71('0x3a')][0x0];}var _0x4739a5=_[_0x4e71('0xa')](_0x34bf2a[_0x4e71('0x31')],{'firstName':_0x34bf2a['body'][_0x4e71('0x33')],'ListId':_0x3d57a4['ListId']});_0x4739a5[_0x34bf2a[_0x4e71('0x31')][_0x4e71('0x35')]]=_0x34bf2a[_0x4e71('0x31')]['from'];return db['CmContact'][_0x4e71('0x4b')](_0x4739a5);}else{throw new Error(_0x4e71('0x4c'));}})[_0x4e71('0xe')](function(_0x2de556){_0x5c7c3e['contact']=_0x2de556;if(_0x2de556){if(!_0x34bf2a[_0x4e71('0x31')]['message'][_0x4e71('0x4d')]){_0x34bf2a[_0x4e71('0x31')][_0x4e71('0x16')]['messageId']=rs[_0x4e71('0x4e')]()+'\x20'+_0x34bf2a[_0x4e71('0x31')][_0x4e71('0x16')][_0x4e71('0x33')];}var _0x3587ba={'ContactId':_0x2de556['id'],'MailAccountId':_0x34bf2a[_0x4e71('0x37')]['id'],'inReplyTo':_0x34bf2a[_0x4e71('0x31')]['message'][_0x4e71('0x4d')],'to':_0x34bf2a[_0x4e71('0x31')][_0x4e71('0x16')][_0x4e71('0x33')],'cc':_0x34bf2a[_0x4e71('0x31')][_0x4e71('0x16')]['cc'],'subject':_0x34bf2a['body'][_0x4e71('0x16')][_0x4e71('0x4f')],'attach':_0x34bf2a[_0x4e71('0x31')]['message'][_0x4e71('0x50')],'lastMsgAt':moment()[_0x4e71('0x51')](_0x4e71('0x52')),'lastMsgDirection':'in'};return db[_0x4e71('0x53')][_0x4e71('0x54')]({'where':{'closed':![],'MailAccountId':_0x34bf2a[_0x4e71('0x37')]['id']},'include':[{'model':db['MailMessage'],'as':_0x4e71('0x55'),'attributes':['messageId'],'where':{'messageId':_0x34bf2a[_0x4e71('0x31')]['message'][_0x4e71('0x56')]}}]})['then'](function(_0x2e0cf4){if(_0x2e0cf4){return[_0x2e0cf4,![]];}return db[_0x4e71('0x53')][_0x4e71('0x4b')](_0x3587ba)[_0x4e71('0xe')](function(_0x15c1f8){return[_0x15c1f8,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0x4e71('0x57')](function(_0x1d6685,_0x274c38){if(_0x1d6685){_0x46963b=_0x274c38;if(!_0x274c38){return _0x1d6685[_0x4e71('0x58')]({'inReplyTo':_0x34bf2a[_0x4e71('0x31')][_0x4e71('0x16')]['messageId'],'to':_0x34bf2a['body']['message'][_0x4e71('0x33')],'cc':_0x34bf2a[_0x4e71('0x31')]['message']['cc'],'subject':_0x34bf2a['body']['message'][_0x4e71('0x4f')],'attach':_0x1d6685[_0x4e71('0x50')]?_0x1d6685['attach']:_0x34bf2a[_0x4e71('0x31')][_0x4e71('0x16')][_0x4e71('0x50')],'substatus':null,'substatusAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgAt':moment()[_0x4e71('0x51')](_0x4e71('0x52')),'lastMsgDirection':'in'});}else{return _0x1d6685;}}})[_0x4e71('0xe')](function(_0x5b53ef){_0x5c7c3e['interaction']=_0x5b53ef[_0x4e71('0x41')]({'plain':!![]});_0x5c7c3e[_0x4e71('0x59')]['created']=_0x46963b;return db['MailMessage'][_0x4e71('0x4b')]({'body':_0x34bf2a[_0x4e71('0x31')]['body'],'MailAccountId':_0x34bf2a['account']['id'],'MailInteractionId':_0x5b53ef['id'],'direction':'in','ContactId':_0x5c7c3e['contact']['id'],'messageId':_0x34bf2a[_0x4e71('0x31')][_0x4e71('0x16')]['messageId'],'from':_0x34bf2a[_0x4e71('0x31')]['message'][_0x4e71('0x33')],'to':_0x34bf2a[_0x4e71('0x31')][_0x4e71('0x16')]['to'],'cc':_0x34bf2a[_0x4e71('0x31')][_0x4e71('0x16')]['cc'],'subject':_0x34bf2a[_0x4e71('0x31')][_0x4e71('0x16')]['subject'],'attach':_0x34bf2a[_0x4e71('0x31')][_0x4e71('0x16')]['attach'],'Attachments':_0x34bf2a[_0x4e71('0x31')][_0x4e71('0x16')][_0x4e71('0x5a')],'originTo':_0x34bf2a[_0x4e71('0x31')][_0x4e71('0x16')][_0x4e71('0x5b')],'originCc':_0x34bf2a[_0x4e71('0x31')][_0x4e71('0x16')][_0x4e71('0x5c')],'bcc':_0x34bf2a[_0x4e71('0x31')][_0x4e71('0x16')]['bcc'],'ChatWebsiteId':_0x34bf2a[_0x4e71('0x31')][_0x4e71('0x16')]['ChatWebsiteId']||null,'originChannel':_0x34bf2a[_0x4e71('0x31')][_0x4e71('0x16')][_0x4e71('0x5d')]||_0x4e71('0x5e'),'ChatOfflineMessageId':_0x34bf2a[_0x4e71('0x31')][_0x4e71('0x16')][_0x4e71('0x5f')]||null},{'include':[{'model':db[_0x4e71('0x60')],'as':'Attachments'}]});})[_0x4e71('0xe')](function(_0x52469b){_0x5c7c3e[_0x4e71('0x16')]=_0x52469b;if(!_0x5c7c3e['interaction'][_0x4e71('0x61')]){return;}return db[_0x4e71('0x62')][_0x4e71('0x54')]({'attributes':['id','name'],'where':{'id':_0x5c7c3e['interaction'][_0x4e71('0x61')]}});})[_0x4e71('0xe')](function(_0x17b8b9){if(_0x17b8b9){_0x5c7c3e[_0x4e71('0x43')][_0x4e71('0x63')]({'id':0x0,'priority':0x0,'app':_0x4e71('0x64'),'appdata':_0x17b8b9['name']+','+(_0x5c7c3e[_0x4e71('0x37')][_0x4e71('0x65')]||0xa),'interval':'*,*,*,*'});}if(!_0x5c7c3e['interaction']['queueId']){return;}return db[_0x4e71('0x66')][_0x4e71('0x54')]({'attributes':['id','name'],'where':{'id':_0x5c7c3e[_0x4e71('0x59')][_0x4e71('0x67')]}});})[_0x4e71('0xe')](function(_0x1dc958){if(_0x1dc958){_0x5c7c3e[_0x4e71('0x43')]['unshift']({'id':0x0,'priority':0x1,'app':_0x4e71('0x68'),'appdata':_0x1dc958['name']+','+(_0x5c7c3e[_0x4e71('0x37')][_0x4e71('0x69')]||0x12c),'interval':_0x4e71('0x4a')});}return respondWithRpcPromise(_0x4e71('0x6a'),_0x4e71('0x6b'),_0x5c7c3e);})['then'](function(_0x4ea63f){_0x2bae8a(_0x4ea63f);})[_0x4e71('0x23')](function(_0x18c96c){_0x1d00e5(_0x43a395[_0x4e71('0x14')](0x1f4,_0x18c96c[_0x4e71('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index 63e3ff2..231b363 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 _0x291e=['removeListener','length','mailAccount:','./mailAccount.events','save','remove','update','emit'];(function(_0x122096,_0x60c295){var _0x3d1966=function(_0x3d569e){while(--_0x3d569e){_0x122096['push'](_0x122096['shift']());}};_0x3d1966(++_0x60c295);}(_0x291e,0xeb));var _0xe291=function(_0x2952e8,_0x39c1f6){_0x2952e8=_0x2952e8-0x0;var _0x1ae924=_0x291e[_0x2952e8];return _0x1ae924;};'use strict';var MailAccountEvents=require(_0xe291('0x0'));var events=[_0xe291('0x1'),_0xe291('0x2'),_0xe291('0x3')];function createListener(_0x28a4aa,_0x13ce09){return function(_0x809365){_0x13ce09[_0xe291('0x4')](_0x28a4aa,_0x809365);};}function removeListener(_0x5c9563,_0x282071){return function(){MailAccountEvents[_0xe291('0x5')](_0x5c9563,_0x282071);};}exports['register']=function(_0x40b7d9){for(var _0x572632=0x0,_0x5864d1=events[_0xe291('0x6')];_0x572632<_0x5864d1;_0x572632++){var _0xeb6daf=events[_0x572632];var _0x50537a=createListener(_0xe291('0x7')+_0xeb6daf,_0x40b7d9);MailAccountEvents['on'](_0xeb6daf,_0x50537a);}}; \ No newline at end of file +var _0x6629=['save','update','emit','length','mailAccount:','./mailAccount.events'];(function(_0x20319a,_0x593659){var _0x27ef9c=function(_0x58abc0){while(--_0x58abc0){_0x20319a['push'](_0x20319a['shift']());}};_0x27ef9c(++_0x593659);}(_0x6629,0x1a9));var _0x9662=function(_0x3cf190,_0x516d3e){_0x3cf190=_0x3cf190-0x0;var _0x45cf59=_0x6629[_0x3cf190];return _0x45cf59;};'use strict';var MailAccountEvents=require(_0x9662('0x0'));var events=[_0x9662('0x1'),'remove',_0x9662('0x2')];function createListener(_0x520671,_0x43b945){return function(_0xe63d4f){_0x43b945[_0x9662('0x3')](_0x520671,_0xe63d4f);};}function removeListener(_0x4e765a,_0x54a4cf){return function(){MailAccountEvents['removeListener'](_0x4e765a,_0x54a4cf);};}exports['register']=function(_0xed6e5c){for(var _0xbc3676=0x0,_0x88b34b=events[_0x9662('0x4')];_0xbc3676<_0x88b34b;_0xbc3676++){var _0x3a6f57=events[_0xbc3676];var _0xbd5747=createListener(_0x9662('0x5')+_0x3a6f57,_0xed6e5c);MailAccountEvents['on'](_0x3a6f57,_0xbd5747);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index e0a5a41..4a8f1f5 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 _0xf548=['show','put','delete','destroy','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailApplication.controller','get','/:id','isAuthenticated'];(function(_0x2aa26d,_0x426cfb){var _0xef6f9e=function(_0x140b09){while(--_0x140b09){_0x2aa26d['push'](_0x2aa26d['shift']());}};_0xef6f9e(++_0x426cfb);}(_0xf548,0x1e1));var _0x8f54=function(_0x365e54,_0x44be74){_0x365e54=_0x365e54-0x0;var _0x13317a=_0xf548[_0x365e54];return _0x13317a;};'use strict';var multer=require(_0x8f54('0x0'));var util=require(_0x8f54('0x1'));var path=require(_0x8f54('0x2'));var timeout=require(_0x8f54('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x8f54('0x4'));var auth=require(_0x8f54('0x5'));var interaction=require(_0x8f54('0x6'));var config=require(_0x8f54('0x7'));var controller=require(_0x8f54('0x8'));router[_0x8f54('0x9')](_0x8f54('0xa'),auth[_0x8f54('0xb')](),controller[_0x8f54('0xc')]);router[_0x8f54('0xd')](_0x8f54('0xa'),auth[_0x8f54('0xb')](),controller['update']);router[_0x8f54('0xe')](_0x8f54('0xa'),auth[_0x8f54('0xb')](),controller[_0x8f54('0xf')]);module[_0x8f54('0x10')]=router; \ No newline at end of file +var _0x684b=['fs-extra','../../config/environment','get','/:id','show','put','isAuthenticated','update','destroy','exports','multer','util','path','connect-timeout'];(function(_0x3cc739,_0xcc6544){var _0x1d6020=function(_0x4a0cb0){while(--_0x4a0cb0){_0x3cc739['push'](_0x3cc739['shift']());}};_0x1d6020(++_0xcc6544);}(_0x684b,0x106));var _0xb684=function(_0x23ca51,_0x4dabc6){_0x23ca51=_0x23ca51-0x0;var _0x2138e8=_0x684b[_0x23ca51];return _0x2138e8;};'use strict';var multer=require(_0xb684('0x0'));var util=require(_0xb684('0x1'));var path=require(_0xb684('0x2'));var timeout=require(_0xb684('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xb684('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xb684('0x5'));var controller=require('./mailApplication.controller');router[_0xb684('0x6')](_0xb684('0x7'),auth['isAuthenticated'](),controller[_0xb684('0x8')]);router[_0xb684('0x9')]('/:id',auth[_0xb684('0xa')](),controller[_0xb684('0xb')]);router['delete']('/:id',auth[_0xb684('0xa')](),controller[_0xb684('0xc')]);module[_0xb684('0xd')]=router; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.attributes.js b/server/api/mailApplication/mailApplication.attributes.js index 8fdd5c3..c375296 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 _0xa6fd=['sequelize','exports','INTEGER','STRING','TEXT'];(function(_0x1faae2,_0x1d0a07){var _0xdcf8f2=function(_0x5bf596){while(--_0x5bf596){_0x1faae2['push'](_0x1faae2['shift']());}};_0xdcf8f2(++_0x1d0a07);}(_0xa6fd,0x145));var _0xda6f=function(_0x36888d,_0x22988e){_0x36888d=_0x36888d-0x0;var _0x14f524=_0xa6fd[_0x36888d];return _0x14f524;};'use strict';var Sequelize=require(_0xda6f('0x0'));module[_0xda6f('0x1')]={'priority':{'type':Sequelize[_0xda6f('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xda6f('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0xda6f('0x4')]()},'description':{'type':Sequelize[_0xda6f('0x3')]},'interval':{'type':Sequelize[_0xda6f('0x3')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x3039=['noop','TEXT','INTEGER','STRING'];(function(_0x2a97f7,_0x465e0c){var _0x13c258=function(_0x1b043d){while(--_0x1b043d){_0x2a97f7['push'](_0x2a97f7['shift']());}};_0x13c258(++_0x465e0c);}(_0x3039,0x8a));var _0x9303=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x3039[_0x57b54c];return _0x59cc19;};'use strict';var Sequelize=require('sequelize');module['exports']={'priority':{'type':Sequelize[_0x9303('0x0')],'allowNull':![]},'app':{'type':Sequelize[_0x9303('0x1')],'allowNull':![],'defaultValue':_0x9303('0x2')},'appdata':{'type':Sequelize[_0x9303('0x3')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x9303('0x1')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index b03fd03..2ae8521 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 _0xcb91=['send','show','params','keys','rawAttributes','query','intersection','attributes','fields','length','model','includeAll','include','merge','options','MailApplication','find','catch','body','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','fs-extra','lodash','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','update','then','destroy','error','stack','name'];(function(_0x5ba320,_0x48008a){var _0x571b66=function(_0x29e2ca){while(--_0x29e2ca){_0x5ba320['push'](_0x5ba320['shift']());}};_0x571b66(++_0x48008a);}(_0xcb91,0x1a9));var _0x1cb9=function(_0xf31767,_0x381746){_0xf31767=_0xf31767-0x0;var _0x24bd0c=_0xcb91[_0xf31767];return _0x24bd0c;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x1cb9('0x0'));var jsonpatch=require(_0x1cb9('0x1'));var rp=require(_0x1cb9('0x2'));var moment=require(_0x1cb9('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x1cb9('0x4'));var util=require(_0x1cb9('0x5'));var path=require('path');var sox=require(_0x1cb9('0x6'));var csv=require(_0x1cb9('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1cb9('0x8'));var _=require(_0x1cb9('0x9'));var squel=require('squel');var crypto=require(_0x1cb9('0xa'));var jsforce=require(_0x1cb9('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x1cb9('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x1cb9('0xc'));var authService=require(_0x1cb9('0xd'));var qs=require(_0x1cb9('0xe'));var as=require(_0x1cb9('0xf'));var hardwareService=require(_0x1cb9('0x10'));var logger=require('../../config/logger')(_0x1cb9('0x11'));var utils=require(_0x1cb9('0x12'));var config=require(_0x1cb9('0x13'));var licenseUtil=require(_0x1cb9('0x14'));var db=require(_0x1cb9('0x15'))['db'];function respondWithStatusCode(_0x5445e1,_0x5e3c19){_0x5e3c19=_0x5e3c19||0xcc;return function(_0x59dec3){if(_0x59dec3){return _0x5445e1[_0x1cb9('0x16')](_0x5e3c19);}return _0x5445e1[_0x1cb9('0x17')](_0x5e3c19)[_0x1cb9('0x18')]();};}function respondWithResult(_0x1c714f,_0x56884d){_0x56884d=_0x56884d||0xc8;return function(_0x397727){if(_0x397727){return _0x1c714f[_0x1cb9('0x17')](_0x56884d)[_0x1cb9('0x19')](_0x397727);}};}function respondWithFilteredResult(_0x8dfa55,_0x3e2d11){return function(_0x5806d8){if(_0x5806d8){var _0x5572cb=typeof _0x3e2d11[_0x1cb9('0x1a')]===_0x1cb9('0x1b')&&typeof _0x3e2d11[_0x1cb9('0x1c')]===_0x1cb9('0x1b');var _0x3e21e0=_0x5806d8[_0x1cb9('0x1d')];var _0x23d3a9=_0x5572cb?0x0:_0x3e2d11['offset'];var _0x479d43=_0x5572cb?_0x5806d8[_0x1cb9('0x1d')]:_0x3e2d11[_0x1cb9('0x1a')]+_0x3e2d11[_0x1cb9('0x1c')];var _0x31481a;if(_0x479d43>=_0x3e21e0){_0x479d43=_0x3e21e0;_0x31481a=0xc8;}else{_0x31481a=0xce;}_0x8dfa55[_0x1cb9('0x17')](_0x31481a);return _0x8dfa55[_0x1cb9('0x1e')](_0x1cb9('0x1f'),_0x23d3a9+'-'+_0x479d43+'/'+_0x3e21e0)['json'](_0x5806d8);}return null;};}function patchUpdates(_0x559bcc){return function(_0x1a5a72){try{jsonpatch['apply'](_0x1a5a72,_0x559bcc,!![]);}catch(_0x4750b1){return BPromise[_0x1cb9('0x20')](_0x4750b1);}return _0x1a5a72['save']();};}function saveUpdates(_0x599275,_0x2e3854){return function(_0x325637){if(_0x325637){return _0x325637[_0x1cb9('0x21')](_0x599275)[_0x1cb9('0x22')](function(_0x45b8d3){return _0x45b8d3;});}return null;};}function removeEntity(_0x27db16,_0x59ebea){return function(_0x55b232){if(_0x55b232){return _0x55b232[_0x1cb9('0x23')]()['then'](function(){_0x27db16[_0x1cb9('0x17')](0xcc)[_0x1cb9('0x18')]();});}};}function handleEntityNotFound(_0x69b4c8,_0x44d3c4){return function(_0x43a100){if(!_0x43a100){_0x69b4c8['sendStatus'](0x194);}return _0x43a100;};}function handleError(_0x195f16,_0x9df250){_0x9df250=_0x9df250||0x1f4;return function(_0x4c8d76){logger[_0x1cb9('0x24')](_0x4c8d76[_0x1cb9('0x25')]);if(_0x4c8d76[_0x1cb9('0x26')]){delete _0x4c8d76[_0x1cb9('0x26')];}_0x195f16[_0x1cb9('0x17')](_0x9df250)[_0x1cb9('0x27')](_0x4c8d76);};}exports[_0x1cb9('0x28')]=function(_0xb644b3,_0x41e5c2){var _0x9de64b={'raw':!![],'where':{'id':_0xb644b3[_0x1cb9('0x29')]['id']}},_0x48888d={};_0x48888d['model']=_[_0x1cb9('0x2a')](db['MailApplication'][_0x1cb9('0x2b')]);_0x48888d[_0x1cb9('0x2c')]=_[_0x1cb9('0x2a')](_0xb644b3[_0x1cb9('0x2c')]);_0x48888d['filters']=_[_0x1cb9('0x2d')](_0x48888d['model'],_0x48888d[_0x1cb9('0x2c')]);_0x9de64b[_0x1cb9('0x2e')]=_[_0x1cb9('0x2d')](_0x48888d['model'],qs[_0x1cb9('0x2f')](_0xb644b3['query'][_0x1cb9('0x2f')]));_0x9de64b['attributes']=_0x9de64b[_0x1cb9('0x2e')][_0x1cb9('0x30')]?_0x9de64b[_0x1cb9('0x2e')]:_0x48888d[_0x1cb9('0x31')];if(_0xb644b3['query'][_0x1cb9('0x32')]){_0x9de64b[_0x1cb9('0x33')]=[{'all':!![]}];}_0x9de64b=_[_0x1cb9('0x34')]({},_0x9de64b,_0xb644b3[_0x1cb9('0x35')]);return db[_0x1cb9('0x36')][_0x1cb9('0x37')](_0x9de64b)[_0x1cb9('0x22')](handleEntityNotFound(_0x41e5c2,null))[_0x1cb9('0x22')](respondWithResult(_0x41e5c2,null))[_0x1cb9('0x38')](handleError(_0x41e5c2,null));};exports[_0x1cb9('0x21')]=function(_0x294eec,_0x26b950){if(_0x294eec[_0x1cb9('0x39')]['id']){delete _0x294eec['body']['id'];}return db['MailApplication'][_0x1cb9('0x37')]({'where':{'id':_0x294eec[_0x1cb9('0x29')]['id']}})[_0x1cb9('0x22')](handleEntityNotFound(_0x26b950,null))[_0x1cb9('0x22')](saveUpdates(_0x294eec[_0x1cb9('0x39')],null))[_0x1cb9('0x22')](respondWithResult(_0x26b950,null))[_0x1cb9('0x38')](handleError(_0x26b950,null));};exports[_0x1cb9('0x23')]=function(_0x4d3e39,_0x2aa59b){return db[_0x1cb9('0x36')][_0x1cb9('0x37')]({'where':{'id':_0x4d3e39['params']['id']}})[_0x1cb9('0x22')](handleEntityNotFound(_0x2aa59b,null))['then'](removeEntity(_0x2aa59b,null))[_0x1cb9('0x38')](handleError(_0x2aa59b,null));}; \ No newline at end of file +var _0x9c44=['Content-Range','apply','reject','save','update','destroy','sendStatus','stack','name','send','show','params','model','keys','MailApplication','rawAttributes','query','attributes','intersection','fields','length','includeAll','include','merge','options','find','then','body','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set'];(function(_0x2815,_0x5f3c49){var _0x42d012=function(_0x2288ad){while(--_0x2288ad){_0x2815['push'](_0x2815['shift']());}};_0x42d012(++_0x5f3c49);}(_0x9c44,0x178));var _0x49c4=function(_0x1d9aa0,_0x272488){_0x1d9aa0=_0x1d9aa0-0x0;var _0x226868=_0x9c44[_0x1d9aa0];return _0x226868;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x49c4('0x0'));var jsonpatch=require(_0x49c4('0x1'));var rp=require(_0x49c4('0x2'));var moment=require(_0x49c4('0x3'));var BPromise=require(_0x49c4('0x4'));var Mustache=require(_0x49c4('0x5'));var util=require('util');var path=require('path');var sox=require(_0x49c4('0x6'));var csv=require('to-csv');var ejs=require(_0x49c4('0x7'));var fs=require('fs');var fs_extra=require(_0x49c4('0x8'));var _=require(_0x49c4('0x9'));var squel=require(_0x49c4('0xa'));var crypto=require(_0x49c4('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x49c4('0xc'));var toCsv=require(_0x49c4('0xd'));var querystring=require(_0x49c4('0xe'));var Papa=require(_0x49c4('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x49c4('0x10'));var as=require(_0x49c4('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x49c4('0x12'))(_0x49c4('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x49c4('0x14'));var db=require(_0x49c4('0x15'))['db'];function respondWithStatusCode(_0x5487cd,_0x7df3a9){_0x7df3a9=_0x7df3a9||0xcc;return function(_0x403bfb){if(_0x403bfb){return _0x5487cd['sendStatus'](_0x7df3a9);}return _0x5487cd[_0x49c4('0x16')](_0x7df3a9)[_0x49c4('0x17')]();};}function respondWithResult(_0x21f15a,_0x2decee){_0x2decee=_0x2decee||0xc8;return function(_0x12777c){if(_0x12777c){return _0x21f15a[_0x49c4('0x16')](_0x2decee)[_0x49c4('0x18')](_0x12777c);}};}function respondWithFilteredResult(_0x3de397,_0x58d177){return function(_0x3acd06){if(_0x3acd06){var _0x141003=typeof _0x58d177[_0x49c4('0x19')]===_0x49c4('0x1a')&&typeof _0x58d177[_0x49c4('0x1b')]==='undefined';var _0x44e607=_0x3acd06[_0x49c4('0x1c')];var _0x4c3253=_0x141003?0x0:_0x58d177['offset'];var _0x3c782d=_0x141003?_0x3acd06[_0x49c4('0x1c')]:_0x58d177[_0x49c4('0x19')]+_0x58d177['limit'];var _0x24856d;if(_0x3c782d>=_0x44e607){_0x3c782d=_0x44e607;_0x24856d=0xc8;}else{_0x24856d=0xce;}_0x3de397['status'](_0x24856d);return _0x3de397[_0x49c4('0x1d')](_0x49c4('0x1e'),_0x4c3253+'-'+_0x3c782d+'/'+_0x44e607)[_0x49c4('0x18')](_0x3acd06);}return null;};}function patchUpdates(_0x291526){return function(_0x382040){try{jsonpatch[_0x49c4('0x1f')](_0x382040,_0x291526,!![]);}catch(_0x280893){return BPromise[_0x49c4('0x20')](_0x280893);}return _0x382040[_0x49c4('0x21')]();};}function saveUpdates(_0x578447,_0x527126){return function(_0x57f502){if(_0x57f502){return _0x57f502[_0x49c4('0x22')](_0x578447)['then'](function(_0x592bb8){return _0x592bb8;});}return null;};}function removeEntity(_0x2263ae,_0x15581b){return function(_0x26c640){if(_0x26c640){return _0x26c640[_0x49c4('0x23')]()['then'](function(){_0x2263ae['status'](0xcc)[_0x49c4('0x17')]();});}};}function handleEntityNotFound(_0x9cb797,_0x565423){return function(_0x207358){if(!_0x207358){_0x9cb797[_0x49c4('0x24')](0x194);}return _0x207358;};}function handleError(_0x210159,_0xa7a826){_0xa7a826=_0xa7a826||0x1f4;return function(_0x531d92){logger['error'](_0x531d92[_0x49c4('0x25')]);if(_0x531d92['name']){delete _0x531d92[_0x49c4('0x26')];}_0x210159[_0x49c4('0x16')](_0xa7a826)[_0x49c4('0x27')](_0x531d92);};}exports[_0x49c4('0x28')]=function(_0x5987ae,_0x889909){var _0x2b2793={'raw':!![],'where':{'id':_0x5987ae[_0x49c4('0x29')]['id']}},_0x46e04d={};_0x46e04d[_0x49c4('0x2a')]=_[_0x49c4('0x2b')](db[_0x49c4('0x2c')][_0x49c4('0x2d')]);_0x46e04d[_0x49c4('0x2e')]=_[_0x49c4('0x2b')](_0x5987ae[_0x49c4('0x2e')]);_0x46e04d['filters']=_['intersection'](_0x46e04d['model'],_0x46e04d[_0x49c4('0x2e')]);_0x2b2793[_0x49c4('0x2f')]=_[_0x49c4('0x30')](_0x46e04d[_0x49c4('0x2a')],qs[_0x49c4('0x31')](_0x5987ae['query'][_0x49c4('0x31')]));_0x2b2793[_0x49c4('0x2f')]=_0x2b2793[_0x49c4('0x2f')][_0x49c4('0x32')]?_0x2b2793['attributes']:_0x46e04d['model'];if(_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x33')]){_0x2b2793[_0x49c4('0x34')]=[{'all':!![]}];}_0x2b2793=_[_0x49c4('0x35')]({},_0x2b2793,_0x5987ae[_0x49c4('0x36')]);return db['MailApplication'][_0x49c4('0x37')](_0x2b2793)[_0x49c4('0x38')](handleEntityNotFound(_0x889909,null))[_0x49c4('0x38')](respondWithResult(_0x889909,null))['catch'](handleError(_0x889909,null));};exports['update']=function(_0x85dce2,_0x1991e9){if(_0x85dce2[_0x49c4('0x39')]['id']){delete _0x85dce2[_0x49c4('0x39')]['id'];}return db[_0x49c4('0x2c')][_0x49c4('0x37')]({'where':{'id':_0x85dce2[_0x49c4('0x29')]['id']}})[_0x49c4('0x38')](handleEntityNotFound(_0x1991e9,null))[_0x49c4('0x38')](saveUpdates(_0x85dce2['body'],null))[_0x49c4('0x38')](respondWithResult(_0x1991e9,null))['catch'](handleError(_0x1991e9,null));};exports[_0x49c4('0x23')]=function(_0x349791,_0x2625a6){return db[_0x49c4('0x2c')]['find']({'where':{'id':_0x349791[_0x49c4('0x29')]['id']}})[_0x49c4('0x38')](handleEntityNotFound(_0x2625a6,null))[_0x49c4('0x38')](removeEntity(_0x2625a6,null))['catch'](handleError(_0x2625a6,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index ead4246..6b22d5b 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 _0xf038=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailApplication.attributes','exports','MailApplication','mail_applications','utf8mb4_unicode_ci','lodash','util','../../config/logger'];(function(_0x411416,_0x35923a){var _0x395e39=function(_0x4bd401){while(--_0x4bd401){_0x411416['push'](_0x411416['shift']());}};_0x395e39(++_0x35923a);}(_0xf038,0xfc));var _0x8f03=function(_0x5beda8,_0x1e8554){_0x5beda8=_0x5beda8-0x0;var _0x2aa042=_0xf038[_0x5beda8];return _0x2aa042;};'use strict';var _=require(_0x8f03('0x0'));var util=require(_0x8f03('0x1'));var logger=require(_0x8f03('0x2'))(_0x8f03('0x3'));var moment=require(_0x8f03('0x4'));var BPromise=require(_0x8f03('0x5'));var rp=require(_0x8f03('0x6'));var fs=require('fs');var path=require(_0x8f03('0x7'));var rimraf=require(_0x8f03('0x8'));var config=require(_0x8f03('0x9'));var attributes=require(_0x8f03('0xa'));module[_0x8f03('0xb')]=function(_0x1bdd71,_0x201cba){return _0x1bdd71['define'](_0x8f03('0xc'),attributes,{'tableName':_0x8f03('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x8f03('0xe')});}; \ No newline at end of file +var _0x2912=['./mailApplication.attributes','define','MailApplication','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x2912,0xc8));var _0x2291=function(_0x1e6330,_0xa3f4c2){_0x1e6330=_0x1e6330-0x0;var _0x13f84f=_0x2912[_0x1e6330];return _0x13f84f;};'use strict';var _=require(_0x2291('0x0'));var util=require('util');var logger=require(_0x2291('0x1'))(_0x2291('0x2'));var moment=require(_0x2291('0x3'));var BPromise=require(_0x2291('0x4'));var rp=require(_0x2291('0x5'));var fs=require('fs');var path=require(_0x2291('0x6'));var rimraf=require('rimraf');var config=require(_0x2291('0x7'));var attributes=require(_0x2291('0x8'));module['exports']=function(_0x2e6711,_0x3b7bd7){return _0x2e6711[_0x2291('0x9')](_0x2291('0xa'),attributes,{'tableName':'mail_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x2291('0xb'),'collate':_0x2291('0xc')});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index 702a39f..08b75ae 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 _0xf884=['then','info','MailApplication,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','UpdateMailApplication','MailApplication','update','body','options','attributes','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x2d4224,_0x394591){var _0x2246fe=function(_0x58793e){while(--_0x58793e){_0x2d4224['push'](_0x2d4224['shift']());}};_0x2246fe(++_0x394591);}(_0xf884,0x15b));var _0x4f88=function(_0x506e7b,_0x51e387){_0x506e7b=_0x506e7b-0x0;var _0x16b51b=_0xf884[_0x506e7b];return _0x16b51b;};'use strict';var _=require(_0x4f88('0x0'));var util=require(_0x4f88('0x1'));var moment=require(_0x4f88('0x2'));var BPromise=require(_0x4f88('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4f88('0x4'))['db'];var utils=require(_0x4f88('0x5'));var logger=require(_0x4f88('0x6'))(_0x4f88('0x7'));var config=require(_0x4f88('0x8'));var jayson=require(_0x4f88('0x9'));var client=jayson[_0x4f88('0xa')][_0x4f88('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5ca0db,_0x16cbc4,_0x225936){return new BPromise(function(_0x4b5980,_0x178998){return client[_0x4f88('0xc')](_0x5ca0db,_0x225936)[_0x4f88('0xd')](function(_0x24a64c){logger[_0x4f88('0xe')](_0x4f88('0xf'),_0x16cbc4,'request\x20sent');logger[_0x4f88('0x10')]('MailApplication,\x20%s,\x20%s,\x20%s',_0x16cbc4,_0x4f88('0x11'),JSON[_0x4f88('0x12')](_0x24a64c));if(_0x24a64c['error']){if(_0x24a64c[_0x4f88('0x13')][_0x4f88('0x14')]===0x1f4){logger['error']('MailApplication,\x20%s,\x20%s',_0x16cbc4,_0x24a64c[_0x4f88('0x13')][_0x4f88('0x15')]);return _0x178998(_0x24a64c['error']['message']);}logger[_0x4f88('0x13')]('MailApplication,\x20%s,\x20%s',_0x16cbc4,_0x24a64c[_0x4f88('0x13')][_0x4f88('0x15')]);return _0x4b5980(_0x24a64c[_0x4f88('0x13')][_0x4f88('0x15')]);}else{logger[_0x4f88('0xe')](_0x4f88('0xf'),_0x16cbc4,_0x4f88('0x11'));_0x4b5980(_0x24a64c[_0x4f88('0x16')][_0x4f88('0x15')]);}})[_0x4f88('0x17')](function(_0x5773f7){logger[_0x4f88('0x13')](_0x4f88('0xf'),_0x16cbc4,_0x5773f7);_0x178998(_0x5773f7);});});}exports[_0x4f88('0x18')]=function(_0x2d58fb){var _0x520e48=this;return new Promise(function(_0x5bdfe1,_0x19acdc){return db[_0x4f88('0x19')][_0x4f88('0x1a')](_0x2d58fb[_0x4f88('0x1b')],{'raw':_0x2d58fb['options']?_0x2d58fb[_0x4f88('0x1c')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2d58fb[_0x4f88('0x1c')]?_0x2d58fb[_0x4f88('0x1c')]['where']||null:null,'attributes':_0x2d58fb[_0x4f88('0x1c')]?_0x2d58fb[_0x4f88('0x1c')][_0x4f88('0x1d')]||null:null,'limit':_0x2d58fb[_0x4f88('0x1c')]?_0x2d58fb[_0x4f88('0x1c')]['limit']||null:null})['then'](function(_0x42c2c1){logger['info'](_0x4f88('0x18'),_0x2d58fb);logger[_0x4f88('0x10')](_0x4f88('0x18'),_0x2d58fb,JSON[_0x4f88('0x12')](_0x42c2c1));_0x5bdfe1(_0x42c2c1);})[_0x4f88('0x17')](function(_0x4321a8){logger[_0x4f88('0x13')](_0x4f88('0x18'),_0x4321a8[_0x4f88('0x15')],_0x2d58fb);_0x19acdc(_0x520e48[_0x4f88('0x13')](0x1f4,_0x4321a8[_0x4f88('0x15')]));});});}; \ No newline at end of file +var _0xfd7c=['attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','MailApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','MailApplication,\x20%s,\x20%s','message','result','catch','UpdateMailApplication','MailApplication','update','body','options','raw','where'];(function(_0x1186c1,_0x5d359f){var _0x484c85=function(_0x202516){while(--_0x202516){_0x1186c1['push'](_0x1186c1['shift']());}};_0x484c85(++_0x5d359f);}(_0xfd7c,0x1b2));var _0xcfd7=function(_0x5d9030,_0x26a000){_0x5d9030=_0x5d9030-0x0;var _0x52ed22=_0xfd7c[_0x5d9030];return _0x52ed22;};'use strict';var _=require(_0xcfd7('0x0'));var util=require(_0xcfd7('0x1'));var moment=require(_0xcfd7('0x2'));var BPromise=require(_0xcfd7('0x3'));var rs=require(_0xcfd7('0x4'));var fs=require('fs');var Redis=require(_0xcfd7('0x5'));var db=require(_0xcfd7('0x6'))['db'];var utils=require(_0xcfd7('0x7'));var logger=require(_0xcfd7('0x8'))(_0xcfd7('0x9'));var config=require(_0xcfd7('0xa'));var jayson=require(_0xcfd7('0xb'));var client=jayson[_0xcfd7('0xc')][_0xcfd7('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x2ed97c,_0x28fffc,_0xf67144){return new BPromise(function(_0x81d76e,_0x5e7d91){return client[_0xcfd7('0xe')](_0x2ed97c,_0xf67144)[_0xcfd7('0xf')](function(_0x245336){logger[_0xcfd7('0x10')]('MailApplication,\x20%s,\x20%s',_0x28fffc,_0xcfd7('0x11'));logger[_0xcfd7('0x12')](_0xcfd7('0x13'),_0x28fffc,_0xcfd7('0x11'),JSON[_0xcfd7('0x14')](_0x245336));if(_0x245336[_0xcfd7('0x15')]){if(_0x245336[_0xcfd7('0x15')][_0xcfd7('0x16')]===0x1f4){logger[_0xcfd7('0x15')](_0xcfd7('0x17'),_0x28fffc,_0x245336[_0xcfd7('0x15')]['message']);return _0x5e7d91(_0x245336[_0xcfd7('0x15')][_0xcfd7('0x18')]);}logger[_0xcfd7('0x15')](_0xcfd7('0x17'),_0x28fffc,_0x245336['error'][_0xcfd7('0x18')]);return _0x81d76e(_0x245336[_0xcfd7('0x15')][_0xcfd7('0x18')]);}else{logger[_0xcfd7('0x10')](_0xcfd7('0x17'),_0x28fffc,_0xcfd7('0x11'));_0x81d76e(_0x245336[_0xcfd7('0x19')][_0xcfd7('0x18')]);}})[_0xcfd7('0x1a')](function(_0x5036f){logger[_0xcfd7('0x15')](_0xcfd7('0x17'),_0x28fffc,_0x5036f);_0x5e7d91(_0x5036f);});});}exports[_0xcfd7('0x1b')]=function(_0x3855ad){var _0x3ea837=this;return new Promise(function(_0x581051,_0x1debfb){return db[_0xcfd7('0x1c')][_0xcfd7('0x1d')](_0x3855ad[_0xcfd7('0x1e')],{'raw':_0x3855ad['options']?_0x3855ad[_0xcfd7('0x1f')][_0xcfd7('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3855ad['options']?_0x3855ad[_0xcfd7('0x1f')][_0xcfd7('0x21')]||null:null,'attributes':_0x3855ad[_0xcfd7('0x1f')]?_0x3855ad[_0xcfd7('0x1f')][_0xcfd7('0x22')]||null:null,'limit':_0x3855ad[_0xcfd7('0x1f')]?_0x3855ad[_0xcfd7('0x1f')][_0xcfd7('0x23')]||null:null})[_0xcfd7('0xf')](function(_0x135e49){logger[_0xcfd7('0x10')](_0xcfd7('0x1b'),_0x3855ad);logger['debug']('UpdateMailApplication',_0x3855ad,JSON[_0xcfd7('0x14')](_0x135e49));_0x581051(_0x135e49);})[_0xcfd7('0x1a')](function(_0x33feed){logger[_0xcfd7('0x15')](_0xcfd7('0x1b'),_0x33feed[_0xcfd7('0x18')],_0x3855ad);_0x1debfb(_0x3ea837[_0xcfd7('0x15')](0x1f4,_0x33feed[_0xcfd7('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index bb873e5..cb38591 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 _0x4582=['index','describe','/:id','show','/:id/messages','getMessages','post','create','addMessage','/:id/tags','mail','mailinteraction:addtags','addTags','put','tracked','mailinteraction:update','update','delete','express','../../components/auth/service','./mailInteraction.controller','get','isAuthenticated'];(function(_0x53b324,_0x11d447){var _0x19fd66=function(_0x7c63a7){while(--_0x7c63a7){_0x53b324['push'](_0x53b324['shift']());}};_0x19fd66(++_0x11d447);}(_0x4582,0x199));var _0x2458=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4582[_0x3dd15e];return _0x231fd0;};'use strict';var express=require(_0x2458('0x0'));var router=express['Router']();var auth=require(_0x2458('0x1'));var interaction=require('../../components/interaction/service');var controller=require(_0x2458('0x2'));router[_0x2458('0x3')]('/',auth[_0x2458('0x4')](),controller[_0x2458('0x5')]);router['get']('/describe',auth[_0x2458('0x4')](),controller[_0x2458('0x6')]);router[_0x2458('0x3')](_0x2458('0x7'),auth[_0x2458('0x4')](),controller[_0x2458('0x8')]);router['get'](_0x2458('0x9'),auth['isAuthenticated'](),controller[_0x2458('0xa')]);router[_0x2458('0x3')]('/:id/download',auth[_0x2458('0x4')](),controller['download']);router[_0x2458('0xb')]('/',auth['isAuthenticated'](),controller[_0x2458('0xc')]);router[_0x2458('0xb')](_0x2458('0x9'),auth[_0x2458('0x4')](),controller[_0x2458('0xd')]);router['post'](_0x2458('0xe'),auth[_0x2458('0x4')](),interaction['tracked'](_0x2458('0xf'),_0x2458('0x10')),controller[_0x2458('0x11')]);router[_0x2458('0x12')](_0x2458('0x7'),auth['isAuthenticated'](),interaction[_0x2458('0x13')](_0x2458('0xf'),_0x2458('0x14')),controller[_0x2458('0x15')]);router[_0x2458('0x16')](_0x2458('0x7'),auth['isAuthenticated'](),interaction[_0x2458('0x13')]('mail','mailinteraction:destroy'),controller['destroy']);router[_0x2458('0x16')](_0x2458('0xe'),auth['isAuthenticated'](),controller['removeTags']);module['exports']=router; \ No newline at end of file +var _0x6821=['mailinteraction:update','update','mailinteraction:destroy','destroy','delete','removeTags','exports','Router','../../components/interaction/service','./mailInteraction.controller','isAuthenticated','index','get','/describe','/:id','show','/:id/messages','post','addMessage','mail','mailinteraction:addtags','put','tracked'];(function(_0x2fffff,_0x415518){var _0x4f2a2c=function(_0x32c77b){while(--_0x32c77b){_0x2fffff['push'](_0x2fffff['shift']());}};_0x4f2a2c(++_0x415518);}(_0x6821,0x1bc));var _0x1682=function(_0x4e55a9,_0x241b22){_0x4e55a9=_0x4e55a9-0x0;var _0x4a9b67=_0x6821[_0x4e55a9];return _0x4a9b67;};'use strict';var express=require('express');var router=express[_0x1682('0x0')]();var auth=require('../../components/auth/service');var interaction=require(_0x1682('0x1'));var controller=require(_0x1682('0x2'));router['get']('/',auth[_0x1682('0x3')](),controller[_0x1682('0x4')]);router[_0x1682('0x5')](_0x1682('0x6'),auth['isAuthenticated'](),controller['describe']);router['get'](_0x1682('0x7'),auth[_0x1682('0x3')](),controller[_0x1682('0x8')]);router[_0x1682('0x5')](_0x1682('0x9'),auth[_0x1682('0x3')](),controller['getMessages']);router[_0x1682('0x5')]('/:id/download',auth[_0x1682('0x3')](),controller['download']);router[_0x1682('0xa')]('/',auth[_0x1682('0x3')](),controller['create']);router['post']('/:id/messages',auth[_0x1682('0x3')](),controller[_0x1682('0xb')]);router[_0x1682('0xa')]('/:id/tags',auth[_0x1682('0x3')](),interaction['tracked'](_0x1682('0xc'),_0x1682('0xd')),controller['addTags']);router[_0x1682('0xe')](_0x1682('0x7'),auth[_0x1682('0x3')](),interaction[_0x1682('0xf')](_0x1682('0xc'),_0x1682('0x10')),controller[_0x1682('0x11')]);router['delete']('/:id',auth['isAuthenticated'](),interaction[_0x1682('0xf')]('mail',_0x1682('0x12')),controller[_0x1682('0x13')]);router[_0x1682('0x14')]('/:id/tags',auth[_0x1682('0x3')](),controller[_0x1682('0x15')]);module[_0x1682('0x16')]=router; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.attributes.js b/server/api/mailInteraction/mailInteraction.attributes.js index bc1368d..ee525a6 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 _0x18bb=['DATE','STRING','TEXT','long','ENUM','out','INTEGER','sequelize','iconv','exports','BOOLEAN'];(function(_0x15293a,_0x4fcce9){var _0x384a40=function(_0x4ed87b){while(--_0x4ed87b){_0x15293a['push'](_0x15293a['shift']());}};_0x384a40(++_0x4fcce9);}(_0x18bb,0x15c));var _0xb18b=function(_0x53b53e,_0x498437){_0x53b53e=_0x53b53e-0x0;var _0xbb6179=_0x18bb[_0x53b53e];return _0xbb6179;};'use strict';var Sequelize=require(_0xb18b('0x0'));var iconv=require(_0xb18b('0x1'));module[_0xb18b('0x2')]={'closed':{'type':Sequelize[_0xb18b('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xb18b('0x4')]},'disposition':{'type':Sequelize[_0xb18b('0x5')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xb18b('0x5')]},'note':{'type':Sequelize[_0xb18b('0x5')]},'inReplyTo':{'type':Sequelize[_0xb18b('0x5')](0x1fe)},'to':{'type':Sequelize[_0xb18b('0x5')]},'cc':{'type':Sequelize[_0xb18b('0x6')](_0xb18b('0x7'))},'subject':{'type':Sequelize['TEXT']()},'attach':{'type':Sequelize[_0xb18b('0x3')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0xb18b('0x4')]},'substatus':{'type':Sequelize[_0xb18b('0x5')](0x3c)},'substatusAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0xb18b('0x8')]('in',_0xb18b('0x9')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xb18b('0x4')]},'lastMsgDirection':{'type':Sequelize[_0xb18b('0x8')]('in',_0xb18b('0x9')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xb18b('0x3')],'defaultValue':![]},'queueId':{'type':Sequelize[_0xb18b('0xa')]}}; \ No newline at end of file +var _0xef8e=['DATE','STRING','TEXT','long','ENUM','out','INTEGER','iconv','exports','BOOLEAN'];(function(_0x11a220,_0x4e470a){var _0x20d8fe=function(_0xbedfd){while(--_0xbedfd){_0x11a220['push'](_0x11a220['shift']());}};_0x20d8fe(++_0x4e470a);}(_0xef8e,0x1dd));var _0xeef8=function(_0x2c7d90,_0x129415){_0x2c7d90=_0x2c7d90-0x0;var _0x35a25c=_0xef8e[_0x2c7d90];return _0x35a25c;};'use strict';var Sequelize=require('sequelize');var iconv=require(_0xeef8('0x0'));module[_0xeef8('0x1')]={'closed':{'type':Sequelize[_0xeef8('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xeef8('0x3')]},'disposition':{'type':Sequelize[_0xeef8('0x4')]},'secondDisposition':{'type':Sequelize[_0xeef8('0x4')]},'thirdDisposition':{'type':Sequelize[_0xeef8('0x4')]},'note':{'type':Sequelize[_0xeef8('0x4')]},'inReplyTo':{'type':Sequelize[_0xeef8('0x4')](0x1fe)},'to':{'type':Sequelize[_0xeef8('0x4')]},'cc':{'type':Sequelize[_0xeef8('0x5')](_0xeef8('0x6'))},'subject':{'type':Sequelize[_0xeef8('0x5')]()},'attach':{'type':Sequelize[_0xeef8('0x2')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0xeef8('0x3')]},'substatus':{'type':Sequelize[_0xeef8('0x4')](0x3c)},'substatusAt':{'type':Sequelize[_0xeef8('0x3')]},'firstMsgDirection':{'type':Sequelize[_0xeef8('0x7')]('in',_0xeef8('0x8')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0xeef8('0x7')]('in',_0xeef8('0x8')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xeef8('0x2')],'defaultValue':![]},'queueId':{'type':Sequelize[_0xeef8('0x9')]}}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index e18828c..f27c0c3 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 _0x3f2c=['mkdirSync','each','missing.recipient@your.company.com','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','existsSync','readFileSync','build','message%d.eml','download','unlinkSync','eml-format','rimraf','zip-dir','moment','bluebird','util','lodash','juice','../../config/logger','api','../../config/environment','../../mysqldb','html-entities','defaults','redis','socket.io-emitter','./mailInteraction.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','update','then','error','name','send','index','type','getOptions','findAll','mail','query','user','catch','params','model','keys','MailInteraction','rawAttributes','filters','fields','attributes','length','include','merge','options','find','create','body','describe','addMessage','MailMessage','ids','findOne','intersection','hasOwnProperty','nolimit','order','sort','where','pick','filter','map','$gte','YYYY-MM-DD\x20HH:mm:ss','includeAll','rows','spread','Tag','color','emit','mailInteractionTags:save','removeTags','unix','toString','join','root','server','files','tmp','attachments','format','push','Attachment','Attachments','from','bcc','subject','createdAt','Messages'];(function(_0x34ef59,_0x1be11b){var _0x285cb5=function(_0x58c45a){while(--_0x58c45a){_0x34ef59['push'](_0x34ef59['shift']());}};_0x285cb5(++_0x1be11b);}(_0x3f2c,0xe9));var _0xc3f2=function(_0x42f740,_0x597b3c){_0x42f740=_0x42f740-0x0;var _0x51cd29=_0x3f2c[_0x42f740];return _0x51cd29;};'use strict';var emlformat=require(_0xc3f2('0x0'));var rimraf=require(_0xc3f2('0x1'));var zipdir=require(_0xc3f2('0x2'));var moment=require(_0xc3f2('0x3'));var BPromise=require(_0xc3f2('0x4'));var util=require(_0xc3f2('0x5'));var path=require('path');var fs=require('fs');var _=require(_0xc3f2('0x6'));var juice=require(_0xc3f2('0x7'));var Redis=require('ioredis');var interaction=require('../../components/interaction/service');var qs=require('../../components/parsers/qs');var logger=require(_0xc3f2('0x8'))(_0xc3f2('0x9'));var config=require(_0xc3f2('0xa'));var db=require(_0xc3f2('0xb'))['db'];var htmlEntities=require(_0xc3f2('0xc'));config['redis']=_[_0xc3f2('0xd')](config[_0xc3f2('0xe')],{'host':'localhost','port':0x18eb});var socket=require(_0xc3f2('0xf'))(new Redis(config['redis']));require(_0xc3f2('0x10'))[_0xc3f2('0x11')](socket);function respondWithStatusCode(_0x288adf,_0x369bb4){_0x369bb4=_0x369bb4||0xcc;return function(_0x19de1b){if(_0x19de1b){return _0x288adf[_0xc3f2('0x12')](_0x369bb4);}return _0x288adf[_0xc3f2('0x13')](_0x369bb4)[_0xc3f2('0x14')]();};}function respondWithResult(_0x2f075e,_0x4df118){_0x4df118=_0x4df118||0xc8;return function(_0x3e8bbf){if(_0x3e8bbf){return _0x2f075e[_0xc3f2('0x13')](_0x4df118)[_0xc3f2('0x15')](_0x3e8bbf);}};}function respondWithFilteredResult(_0x5b64aa,_0x116a07){return function(_0x46fc56){if(_0x46fc56){var _0x1bca08=typeof _0x116a07[_0xc3f2('0x16')]===_0xc3f2('0x17')&&typeof _0x116a07[_0xc3f2('0x18')]==='undefined';var _0x45b1ce=_0x46fc56['count'];var _0x4f64d8=_0x1bca08?0x0:_0x116a07[_0xc3f2('0x16')];var _0x110720=_0x1bca08?_0x46fc56[_0xc3f2('0x19')]:_0x116a07['offset']+_0x116a07[_0xc3f2('0x18')];var _0x174679;if(_0x110720>=_0x45b1ce){_0x110720=_0x45b1ce;_0x174679=0xc8;}else{_0x174679=0xce;}_0x5b64aa[_0xc3f2('0x13')](_0x174679);return _0x5b64aa[_0xc3f2('0x1a')](_0xc3f2('0x1b'),_0x4f64d8+'-'+_0x110720+'/'+_0x45b1ce)[_0xc3f2('0x15')](_0x46fc56);}return null;};}function saveUpdates(_0x163515){return function(_0x4c242c){if(_0x4c242c){return _0x4c242c[_0xc3f2('0x1c')](_0x163515)[_0xc3f2('0x1d')](function(_0x3d8381){return _0x3d8381;});}return null;};}function removeEntity(_0x2df274){return function(_0x2c7aeb){if(_0x2c7aeb){return _0x2c7aeb['destroy']()[_0xc3f2('0x1d')](function(){_0x2df274['status'](0xcc)[_0xc3f2('0x14')]();});}};}function handleEntityNotFound(_0x52efc7){return function(_0x11877e){if(!_0x11877e){_0x52efc7['sendStatus'](0x194);}return _0x11877e;};}function handleError(_0x55f4f0,_0x31f0d8){_0x31f0d8=_0x31f0d8||0x1f4;return function(_0x4d22fa){logger[_0xc3f2('0x1e')](_0x4d22fa['stack']);if(_0x4d22fa[_0xc3f2('0x1f')]){delete _0x4d22fa[_0xc3f2('0x1f')];}_0x55f4f0[_0xc3f2('0x13')](_0x31f0d8)[_0xc3f2('0x20')](_0x4d22fa);};}exports[_0xc3f2('0x21')]=function(_0x1953d9,_0x3aa371){var _0x235043={};var _0x687b97=_['map'](db['MailInteraction']['rawAttributes'],function(_0x639558){return{'name':_0x639558['fieldName'],'type':_0x639558[_0xc3f2('0x22')]['key']};});_0x235043=qs[_0xc3f2('0x23')](_0x687b97,_0x1953d9);return interaction[_0xc3f2('0x24')](_0xc3f2('0x25'),_0x1953d9[_0xc3f2('0x26')],_0x1953d9[_0xc3f2('0x27')],_0x235043,_0x687b97)[_0xc3f2('0x1d')](respondWithFilteredResult(_0x3aa371,_0x235043))[_0xc3f2('0x28')](handleError(_0x3aa371,null));};exports['show']=function(_0x4a2c72,_0x48e3ba){var _0x1ee4c7={'raw':![],'where':{'id':_0x4a2c72[_0xc3f2('0x29')]['id']}},_0x1f5d01={};_0x1f5d01[_0xc3f2('0x2a')]=_[_0xc3f2('0x2b')](db[_0xc3f2('0x2c')][_0xc3f2('0x2d')]);_0x1f5d01[_0xc3f2('0x26')]=_[_0xc3f2('0x2b')](_0x4a2c72['query']);_0x1f5d01[_0xc3f2('0x2e')]=_['intersection'](_0x1f5d01[_0xc3f2('0x2a')],_0x1f5d01['query']);_0x1ee4c7['attributes']=_['intersection'](_0x1f5d01[_0xc3f2('0x2a')],qs[_0xc3f2('0x2f')](_0x4a2c72[_0xc3f2('0x26')][_0xc3f2('0x2f')]));_0x1ee4c7[_0xc3f2('0x30')]=_0x1ee4c7[_0xc3f2('0x30')][_0xc3f2('0x31')]?_0x1ee4c7['attributes']:_0x1f5d01[_0xc3f2('0x2a')];if(_0x4a2c72['query']['includeAll']){_0x1ee4c7[_0xc3f2('0x32')]=[{'all':!![]}];}_0x1ee4c7=_[_0xc3f2('0x33')]({},_0x1ee4c7,_0x4a2c72[_0xc3f2('0x34')]);return db[_0xc3f2('0x2c')][_0xc3f2('0x35')](_0x1ee4c7)[_0xc3f2('0x1d')](handleEntityNotFound(_0x48e3ba,null))[_0xc3f2('0x1d')](respondWithResult(_0x48e3ba,null))['catch'](handleError(_0x48e3ba,null));};exports[_0xc3f2('0x36')]=function(_0x18c57d,_0x2dd1df){return db[_0xc3f2('0x2c')][_0xc3f2('0x36')](_0x18c57d[_0xc3f2('0x37')],{})[_0xc3f2('0x1d')](respondWithResult(_0x2dd1df,0xc9))[_0xc3f2('0x28')](handleError(_0x2dd1df,null));};exports[_0xc3f2('0x1c')]=function(_0x88ed45,_0x539dd7){if(_0x88ed45[_0xc3f2('0x37')]['id']){delete _0x88ed45['body']['id'];}return db['MailInteraction'][_0xc3f2('0x35')]({'where':{'id':_0x88ed45[_0xc3f2('0x29')]['id']}})[_0xc3f2('0x1d')](handleEntityNotFound(_0x539dd7,null))['then'](saveUpdates(_0x88ed45[_0xc3f2('0x37')],null))[_0xc3f2('0x1d')](respondWithResult(_0x539dd7,null))[_0xc3f2('0x28')](handleError(_0x539dd7,null));};exports['destroy']=function(_0x9bca15,_0x523217){return db[_0xc3f2('0x2c')][_0xc3f2('0x35')]({'where':{'id':_0x9bca15[_0xc3f2('0x29')]['id']}})[_0xc3f2('0x1d')](handleEntityNotFound(_0x523217,null))['then'](removeEntity(_0x523217,null))['catch'](handleError(_0x523217,null));};exports[_0xc3f2('0x38')]=function(_0x4014e4,_0x4021ac){return db[_0xc3f2('0x2c')]['describe']()[_0xc3f2('0x1d')](respondWithResult(_0x4021ac,null))[_0xc3f2('0x28')](handleError(_0x4021ac,null));};exports[_0xc3f2('0x39')]=function(_0x95233f,_0x4aabf2){return db[_0xc3f2('0x3a')][_0xc3f2('0x35')]({'where':{'id':_0x95233f[_0xc3f2('0x29')]['id']}})[_0xc3f2('0x1d')](handleEntityNotFound(_0x4aabf2,null))[_0xc3f2('0x1d')](function(_0x495617){if(_0x495617){return _0x495617[_0xc3f2('0x39')](_0x95233f[_0xc3f2('0x37')][_0xc3f2('0x3b')],_['omit'](_0x95233f[_0xc3f2('0x37')],[_0xc3f2('0x3b'),'id'])||{});}})[_0xc3f2('0x1d')](respondWithResult(_0x4aabf2,null))['catch'](handleError(_0x4aabf2,null));};exports['getMessages']=function(_0x404f7b,_0x3fc136){var _0x2452bc={'raw':![],'where':{}};var _0x55bda1={};var _0x5978bc={'count':0x0,'rows':[]};return db[_0xc3f2('0x2c')][_0xc3f2('0x3c')]({'where':{'id':_0x404f7b['params']['id']}})[_0xc3f2('0x1d')](handleEntityNotFound(_0x3fc136,null))[_0xc3f2('0x1d')](function(_0x3f34ff){if(_0x3f34ff){_0x55bda1[_0xc3f2('0x2a')]=_[_0xc3f2('0x2b')](db['MailMessage'][_0xc3f2('0x2d')]);_0x55bda1[_0xc3f2('0x26')]=_[_0xc3f2('0x2b')](_0x404f7b[_0xc3f2('0x26')]);_0x55bda1['filters']=_[_0xc3f2('0x3d')](_0x55bda1[_0xc3f2('0x2a')],_0x55bda1[_0xc3f2('0x26')]);_0x2452bc[_0xc3f2('0x30')]=_[_0xc3f2('0x3d')](_0x55bda1[_0xc3f2('0x2a')],qs[_0xc3f2('0x2f')](_0x404f7b[_0xc3f2('0x26')]['fields']));_0x2452bc[_0xc3f2('0x30')]=_0x2452bc[_0xc3f2('0x30')][_0xc3f2('0x31')]?_0x2452bc['attributes']:_0x55bda1[_0xc3f2('0x2a')];if(!_0x404f7b[_0xc3f2('0x26')][_0xc3f2('0x3e')](_0xc3f2('0x3f'))){_0x2452bc[_0xc3f2('0x18')]=qs['limit'](_0x404f7b[_0xc3f2('0x26')]['limit']);_0x2452bc[_0xc3f2('0x16')]=qs[_0xc3f2('0x16')](_0x404f7b[_0xc3f2('0x26')][_0xc3f2('0x16')]);}_0x2452bc[_0xc3f2('0x40')]=qs['sort'](_0x404f7b['query'][_0xc3f2('0x41')]);_0x2452bc[_0xc3f2('0x42')]=qs[_0xc3f2('0x2e')](_[_0xc3f2('0x43')](_0x404f7b[_0xc3f2('0x26')],_0x55bda1[_0xc3f2('0x2e')]));_0x2452bc[_0xc3f2('0x42')]['MailInteractionId']=_0x3f34ff['id'];if(_0x404f7b['query'][_0xc3f2('0x44')]){_0x2452bc['where']=_['merge'](_0x2452bc[_0xc3f2('0x42')],{'$or':_[_0xc3f2('0x45')](_0x2452bc['attributes'],function(_0x393e5b){var _0x586948={};_0x586948[_0x393e5b]={'$like':'%'+_0x404f7b[_0xc3f2('0x26')][_0xc3f2('0x44')]+'%'};return _0x586948;})});}if(_0x404f7b[_0xc3f2('0x26')][_0xc3f2('0x46')]){var _0x328786=_0x404f7b[_0xc3f2('0x26')]['$gte']['split'](',');var _0x18b81f={};_0x18b81f[_0x328786[0x0]]={'$gte':moment(_0x328786[0x1])['format'](_0xc3f2('0x47'))};_0x2452bc[_0xc3f2('0x42')]=_[_0xc3f2('0x33')](_0x2452bc[_0xc3f2('0x42')],_0x18b81f);}_0x2452bc=_[_0xc3f2('0x33')]({},_0x2452bc,_0x404f7b['options']);return db[_0xc3f2('0x3a')][_0xc3f2('0x19')]({'where':_0x2452bc['where']})[_0xc3f2('0x1d')](function(_0x5a1d15){_0x5978bc['count']=_0x5a1d15;if(_0x404f7b[_0xc3f2('0x26')][_0xc3f2('0x48')]){_0x2452bc[_0xc3f2('0x32')]=[{'all':!![]}];}return db[_0xc3f2('0x3a')][_0xc3f2('0x24')](_0x2452bc);})['then'](function(_0x135433){if(_0x404f7b['query']['inlineCss']==='true'){for(var _0x4078a9=0x0;_0x4078a9<_0x135433[_0xc3f2('0x31')];_0x4078a9++){_0x135433[_0x4078a9]['body']=juice(_0x135433[_0x4078a9][_0xc3f2('0x37')]);}}_0x5978bc[_0xc3f2('0x49')]=_0x135433;return _0x5978bc;});}})[_0xc3f2('0x1d')](respondWithFilteredResult(_0x3fc136,_0x2452bc))['catch'](handleError(_0x3fc136,null));};exports['addTags']=function(_0x179af2,_0x53c5e2){return db[_0xc3f2('0x2c')][_0xc3f2('0x35')]({'where':{'id':_0x179af2[_0xc3f2('0x29')]['id']}})['then'](handleEntityNotFound(_0x53c5e2,null))[_0xc3f2('0x1d')](function(_0x16f0ac){if(_0x16f0ac){return _0x16f0ac['setTags'](_0x179af2[_0xc3f2('0x37')][_0xc3f2('0x3b')],_['omit'](_0x179af2[_0xc3f2('0x37')],['ids','id'])||{})[_0xc3f2('0x4a')](function(){return db[_0xc3f2('0x4b')][_0xc3f2('0x24')]({'attributes':['id',_0xc3f2('0x1f'),_0xc3f2('0x4c')],'where':{'id':_0x179af2[_0xc3f2('0x37')]['ids']}});})['then'](function(_0x54100f){socket[_0xc3f2('0x4d')](_0xc3f2('0x4e'),{'id':Number(_0x179af2[_0xc3f2('0x29')]['id']),'tags':_0x54100f||[]});return{'id':Number(_0x179af2[_0xc3f2('0x29')]['id']),'tags':_0x54100f||[]};});}})[_0xc3f2('0x1d')](respondWithResult(_0x53c5e2,null))['catch'](handleError(_0x53c5e2,null));};exports[_0xc3f2('0x4f')]=function(_0x11c1ef,_0x5ada72){return db['MailInteraction'][_0xc3f2('0x35')]({'where':{'id':_0x11c1ef[_0xc3f2('0x29')]['id']}})[_0xc3f2('0x1d')](handleEntityNotFound(_0x5ada72,null))[_0xc3f2('0x1d')](function(_0x318887){if(_0x318887){return _0x318887[_0xc3f2('0x4f')](_0x11c1ef['query'][_0xc3f2('0x3b')]);}})[_0xc3f2('0x1d')](respondWithStatusCode(_0x5ada72,null))[_0xc3f2('0x28')](handleError(_0x5ada72,null));};exports['download']=function(_0x3bbef7,_0x586dd0){var _0x5ae391=moment()[_0xc3f2('0x50')]()[_0xc3f2('0x51')]();var _0x475a3e=path[_0xc3f2('0x52')](config[_0xc3f2('0x53')],_0xc3f2('0x54'),_0xc3f2('0x55'),_0xc3f2('0x56'));var _0xb67029=path[_0xc3f2('0x52')](config['root'],_0xc3f2('0x54'),'files',_0xc3f2('0x57'));var _0x8b12f9=path[_0xc3f2('0x52')](_0x475a3e,_0x5ae391);var _0x172705=util[_0xc3f2('0x58')]('transcript-%d-%s.zip',_0x3bbef7[_0xc3f2('0x29')]['id'],_0x5ae391);var _0x3420be=path['join'](_0x475a3e,_0x172705);var _0x44f2c8=[];if(_0x3bbef7['query'][_0xc3f2('0x57')]){_0x44f2c8[_0xc3f2('0x59')]({'model':db[_0xc3f2('0x5a')],'as':_0xc3f2('0x5b'),'raw':!![]});}var _0x562653=[{'model':db[_0xc3f2('0x3a')],'as':'Messages','attributes':['id',_0xc3f2('0x37'),_0xc3f2('0x5c'),'to','cc',_0xc3f2('0x5d'),_0xc3f2('0x5e'),_0xc3f2('0x5f')],'where':{'secret':![]},'order':qs['sort']('id'),'include':_0x44f2c8}];return db['MailInteraction'][_0xc3f2('0x35')]({'where':{'id':_0x3bbef7[_0xc3f2('0x29')]['id']},'include':_0x562653})[_0xc3f2('0x1d')](handleEntityNotFound(_0x586dd0,null))[_0xc3f2('0x1d')](function(_0x1d1d92){if(_0x1d1d92&&_0x1d1d92[_0xc3f2('0x60')]){var _0x3e0a3e=_0x1d1d92['get']({'plain':!![]});fs[_0xc3f2('0x61')](_0x8b12f9);return BPromise[_0xc3f2('0x62')](_0x3e0a3e[_0xc3f2('0x60')],function(_0xca98d2,_0x4c6d67){var _0x467929={'from':_0xca98d2[_0xc3f2('0x5c')],'to':_0xca98d2['to']||_0xc3f2('0x63'),'subject':_0xca98d2[_0xc3f2('0x5e')],'html':htmlEntities[_0xc3f2('0x64')](_0xca98d2[_0xc3f2('0x37')]),'headers':{'Date':moment(_0xca98d2[_0xc3f2('0x5f')])[_0xc3f2('0x58')](_0xc3f2('0x65'))},'attachments':[]};if(_0xca98d2['cc']){_0x467929[_0xc3f2('0x66')]['Cc']=_0xca98d2['cc'];}if(_0xca98d2[_0xc3f2('0x5d')]){_0x467929['headers'][_0xc3f2('0x67')]=_0xca98d2[_0xc3f2('0x5d')];}return new BPromise(function(_0x253c40,_0x5aa6d9){if(_0xca98d2[_0xc3f2('0x5b')]){for(var _0x51d29c=0x0;_0x51d29c<_0xca98d2['Attachments']['length'];_0x51d29c++){var _0x34768f=_0xca98d2[_0xc3f2('0x5b')][_0x51d29c];var _0x546f1e=path[_0xc3f2('0x52')](_0xb67029,_0x34768f['basename']);if(fs[_0xc3f2('0x68')](_0x546f1e)){_0x467929[_0xc3f2('0x57')][_0xc3f2('0x59')]({'name':_0x34768f[_0xc3f2('0x1f')],'contentType':_0x34768f[_0xc3f2('0x22')],'data':fs[_0xc3f2('0x69')](_0x546f1e)});}}}emlformat[_0xc3f2('0x6a')](_0x467929,function(_0x502a5a,_0x72e1c4){if(_0x502a5a)return _0x5aa6d9(_0x502a5a);fs['writeFileSync'](path[_0xc3f2('0x52')](_0x8b12f9,util[_0xc3f2('0x58')](_0xc3f2('0x6b'),_0x4c6d67)),_0x72e1c4);return _0x253c40(_0x72e1c4);});});})[_0xc3f2('0x1d')](function(){return new BPromise(function(_0x263e86,_0x58ff10){zipdir(_0x8b12f9,{'saveTo':_0x3420be},function(_0x30f1bb,_0x448254){if(_0x30f1bb)return _0x58ff10(_0x30f1bb);return _0x263e86(_0x448254);});})[_0xc3f2('0x1d')](function(){return new BPromise(function(_0x541d44,_0x4b2a37){rimraf(_0x8b12f9,function(_0x265d31){if(_0x265d31)_0x4b2a37(_0x265d31);return _0x541d44();});});})[_0xc3f2('0x1d')](function(){return _0x586dd0[_0xc3f2('0x6c')](_0x3420be,_0x172705,function(_0xce9e0b){if(!_0xce9e0b)fs[_0xc3f2('0x6d')](_0x3420be);});});});}else{return _0x586dd0[_0xc3f2('0x12')](0xc8);}})['catch'](handleError(_0x586dd0,null));}; \ No newline at end of file +var _0xf196=['transcript-%d-%s.zip','attachments','push','Attachment','Attachments','Messages','from','bcc','subject','get','mkdirSync','each','missing.recipient@your.company.com','decode','createdAt','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','basename','existsSync','readFileSync','build','writeFileSync','message%d.eml','unlinkSync','rimraf','zip-dir','moment','bluebird','util','lodash','juice','ioredis','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailInteraction.socket','register','end','status','json','offset','undefined','limit','count','set','Content-Range','update','then','sendStatus','error','stack','name','send','map','MailInteraction','rawAttributes','fieldName','type','getOptions','mail','query','user','show','params','model','keys','filters','intersection','attributes','fields','length','options','create','body','catch','destroy','find','describe','addMessage','MailMessage','ids','getMessages','hasOwnProperty','nolimit','order','sort','where','pick','MailInteractionId','merge','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','includeAll','include','findAll','inlineCss','true','rows','addTags','spread','Tag','color','mailInteractionTags:save','removeTags','download','unix','toString','root','server','files','tmp','join'];(function(_0x109107,_0x5b5c5e){var _0x3112dd=function(_0x3e45d4){while(--_0x3e45d4){_0x109107['push'](_0x109107['shift']());}};_0x3112dd(++_0x5b5c5e);}(_0xf196,0x17d));var _0x6f19=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xf196[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6f19('0x0'));var zipdir=require(_0x6f19('0x1'));var moment=require(_0x6f19('0x2'));var BPromise=require(_0x6f19('0x3'));var util=require(_0x6f19('0x4'));var path=require('path');var fs=require('fs');var _=require(_0x6f19('0x5'));var juice=require(_0x6f19('0x6'));var Redis=require(_0x6f19('0x7'));var interaction=require('../../components/interaction/service');var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0x6f19('0x8'));var config=require(_0x6f19('0x9'));var db=require(_0x6f19('0xa'))['db'];var htmlEntities=require('html-entities');config[_0x6f19('0xb')]=_[_0x6f19('0xc')](config[_0x6f19('0xb')],{'host':_0x6f19('0xd'),'port':0x18eb});var socket=require(_0x6f19('0xe'))(new Redis(config['redis']));require(_0x6f19('0xf'))[_0x6f19('0x10')](socket);function respondWithStatusCode(_0x1194c5,_0x9f9bde){_0x9f9bde=_0x9f9bde||0xcc;return function(_0x193cdd){if(_0x193cdd){return _0x1194c5['sendStatus'](_0x9f9bde);}return _0x1194c5['status'](_0x9f9bde)[_0x6f19('0x11')]();};}function respondWithResult(_0x2d4a27,_0x14032c){_0x14032c=_0x14032c||0xc8;return function(_0x19628b){if(_0x19628b){return _0x2d4a27[_0x6f19('0x12')](_0x14032c)[_0x6f19('0x13')](_0x19628b);}};}function respondWithFilteredResult(_0x5d75c0,_0x1b3211){return function(_0x19cca6){if(_0x19cca6){var _0x585eba=typeof _0x1b3211[_0x6f19('0x14')]===_0x6f19('0x15')&&typeof _0x1b3211[_0x6f19('0x16')]==='undefined';var _0xf2601=_0x19cca6[_0x6f19('0x17')];var _0x4a3409=_0x585eba?0x0:_0x1b3211[_0x6f19('0x14')];var _0x4e9477=_0x585eba?_0x19cca6[_0x6f19('0x17')]:_0x1b3211[_0x6f19('0x14')]+_0x1b3211[_0x6f19('0x16')];var _0x5bc338;if(_0x4e9477>=_0xf2601){_0x4e9477=_0xf2601;_0x5bc338=0xc8;}else{_0x5bc338=0xce;}_0x5d75c0['status'](_0x5bc338);return _0x5d75c0[_0x6f19('0x18')](_0x6f19('0x19'),_0x4a3409+'-'+_0x4e9477+'/'+_0xf2601)['json'](_0x19cca6);}return null;};}function saveUpdates(_0x15154a){return function(_0x173359){if(_0x173359){return _0x173359[_0x6f19('0x1a')](_0x15154a)[_0x6f19('0x1b')](function(_0x46e69e){return _0x46e69e;});}return null;};}function removeEntity(_0x13c5f1){return function(_0x9d2937){if(_0x9d2937){return _0x9d2937['destroy']()['then'](function(){_0x13c5f1[_0x6f19('0x12')](0xcc)[_0x6f19('0x11')]();});}};}function handleEntityNotFound(_0x43e1d2){return function(_0x2e611d){if(!_0x2e611d){_0x43e1d2[_0x6f19('0x1c')](0x194);}return _0x2e611d;};}function handleError(_0x2f9d6b,_0x10755d){_0x10755d=_0x10755d||0x1f4;return function(_0x4e037b){logger[_0x6f19('0x1d')](_0x4e037b[_0x6f19('0x1e')]);if(_0x4e037b[_0x6f19('0x1f')]){delete _0x4e037b['name'];}_0x2f9d6b['status'](_0x10755d)[_0x6f19('0x20')](_0x4e037b);};}exports['index']=function(_0x2573c5,_0x9443a1){var _0x558904={};var _0x3d7245=_[_0x6f19('0x21')](db[_0x6f19('0x22')][_0x6f19('0x23')],function(_0xe5ad9e){return{'name':_0xe5ad9e[_0x6f19('0x24')],'type':_0xe5ad9e[_0x6f19('0x25')]['key']};});_0x558904=qs[_0x6f19('0x26')](_0x3d7245,_0x2573c5);return interaction['findAll'](_0x6f19('0x27'),_0x2573c5[_0x6f19('0x28')],_0x2573c5[_0x6f19('0x29')],_0x558904,_0x3d7245)['then'](respondWithFilteredResult(_0x9443a1,_0x558904))['catch'](handleError(_0x9443a1,null));};exports[_0x6f19('0x2a')]=function(_0x573a9d,_0x1cf38b){var _0x4f3eb8={'raw':![],'where':{'id':_0x573a9d[_0x6f19('0x2b')]['id']}},_0x15f87c={};_0x15f87c[_0x6f19('0x2c')]=_[_0x6f19('0x2d')](db[_0x6f19('0x22')]['rawAttributes']);_0x15f87c['query']=_['keys'](_0x573a9d[_0x6f19('0x28')]);_0x15f87c[_0x6f19('0x2e')]=_[_0x6f19('0x2f')](_0x15f87c[_0x6f19('0x2c')],_0x15f87c[_0x6f19('0x28')]);_0x4f3eb8[_0x6f19('0x30')]=_[_0x6f19('0x2f')](_0x15f87c['model'],qs['fields'](_0x573a9d[_0x6f19('0x28')][_0x6f19('0x31')]));_0x4f3eb8[_0x6f19('0x30')]=_0x4f3eb8[_0x6f19('0x30')][_0x6f19('0x32')]?_0x4f3eb8[_0x6f19('0x30')]:_0x15f87c['model'];if(_0x573a9d[_0x6f19('0x28')]['includeAll']){_0x4f3eb8['include']=[{'all':!![]}];}_0x4f3eb8=_['merge']({},_0x4f3eb8,_0x573a9d[_0x6f19('0x33')]);return db[_0x6f19('0x22')]['find'](_0x4f3eb8)[_0x6f19('0x1b')](handleEntityNotFound(_0x1cf38b,null))[_0x6f19('0x1b')](respondWithResult(_0x1cf38b,null))['catch'](handleError(_0x1cf38b,null));};exports[_0x6f19('0x34')]=function(_0x2cd622,_0x698560){return db['MailInteraction'][_0x6f19('0x34')](_0x2cd622['body'],{})[_0x6f19('0x1b')](respondWithResult(_0x698560,0xc9))['catch'](handleError(_0x698560,null));};exports['update']=function(_0x56999c,_0x188abf){if(_0x56999c[_0x6f19('0x35')]['id']){delete _0x56999c[_0x6f19('0x35')]['id'];}return db[_0x6f19('0x22')]['find']({'where':{'id':_0x56999c[_0x6f19('0x2b')]['id']}})[_0x6f19('0x1b')](handleEntityNotFound(_0x188abf,null))['then'](saveUpdates(_0x56999c[_0x6f19('0x35')],null))[_0x6f19('0x1b')](respondWithResult(_0x188abf,null))[_0x6f19('0x36')](handleError(_0x188abf,null));};exports[_0x6f19('0x37')]=function(_0x3d798f,_0x584810){return db[_0x6f19('0x22')][_0x6f19('0x38')]({'where':{'id':_0x3d798f[_0x6f19('0x2b')]['id']}})['then'](handleEntityNotFound(_0x584810,null))[_0x6f19('0x1b')](removeEntity(_0x584810,null))[_0x6f19('0x36')](handleError(_0x584810,null));};exports[_0x6f19('0x39')]=function(_0x646746,_0x3fecae){return db['MailInteraction'][_0x6f19('0x39')]()[_0x6f19('0x1b')](respondWithResult(_0x3fecae,null))[_0x6f19('0x36')](handleError(_0x3fecae,null));};exports[_0x6f19('0x3a')]=function(_0x41be38,_0x4ec36c){return db[_0x6f19('0x3b')][_0x6f19('0x38')]({'where':{'id':_0x41be38[_0x6f19('0x2b')]['id']}})[_0x6f19('0x1b')](handleEntityNotFound(_0x4ec36c,null))[_0x6f19('0x1b')](function(_0x1706af){if(_0x1706af){return _0x1706af[_0x6f19('0x3a')](_0x41be38['body']['ids'],_['omit'](_0x41be38[_0x6f19('0x35')],[_0x6f19('0x3c'),'id'])||{});}})[_0x6f19('0x1b')](respondWithResult(_0x4ec36c,null))['catch'](handleError(_0x4ec36c,null));};exports[_0x6f19('0x3d')]=function(_0x2fc2d1,_0x4e480d){var _0x3531d8={'raw':![],'where':{}};var _0x36777a={};var _0xb8cf95={'count':0x0,'rows':[]};return db[_0x6f19('0x22')]['findOne']({'where':{'id':_0x2fc2d1[_0x6f19('0x2b')]['id']}})[_0x6f19('0x1b')](handleEntityNotFound(_0x4e480d,null))[_0x6f19('0x1b')](function(_0x23faa3){if(_0x23faa3){_0x36777a['model']=_[_0x6f19('0x2d')](db['MailMessage'][_0x6f19('0x23')]);_0x36777a[_0x6f19('0x28')]=_['keys'](_0x2fc2d1[_0x6f19('0x28')]);_0x36777a[_0x6f19('0x2e')]=_[_0x6f19('0x2f')](_0x36777a[_0x6f19('0x2c')],_0x36777a['query']);_0x3531d8[_0x6f19('0x30')]=_[_0x6f19('0x2f')](_0x36777a[_0x6f19('0x2c')],qs[_0x6f19('0x31')](_0x2fc2d1[_0x6f19('0x28')]['fields']));_0x3531d8[_0x6f19('0x30')]=_0x3531d8['attributes']['length']?_0x3531d8[_0x6f19('0x30')]:_0x36777a[_0x6f19('0x2c')];if(!_0x2fc2d1[_0x6f19('0x28')][_0x6f19('0x3e')](_0x6f19('0x3f'))){_0x3531d8['limit']=qs[_0x6f19('0x16')](_0x2fc2d1[_0x6f19('0x28')]['limit']);_0x3531d8[_0x6f19('0x14')]=qs['offset'](_0x2fc2d1[_0x6f19('0x28')]['offset']);}_0x3531d8[_0x6f19('0x40')]=qs[_0x6f19('0x41')](_0x2fc2d1['query']['sort']);_0x3531d8[_0x6f19('0x42')]=qs['filters'](_[_0x6f19('0x43')](_0x2fc2d1['query'],_0x36777a[_0x6f19('0x2e')]));_0x3531d8['where'][_0x6f19('0x44')]=_0x23faa3['id'];if(_0x2fc2d1[_0x6f19('0x28')]['filter']){_0x3531d8[_0x6f19('0x42')]=_[_0x6f19('0x45')](_0x3531d8[_0x6f19('0x42')],{'$or':_[_0x6f19('0x21')](_0x3531d8['attributes'],function(_0x26ea2f){var _0x1e2614={};_0x1e2614[_0x26ea2f]={'$like':'%'+_0x2fc2d1[_0x6f19('0x28')][_0x6f19('0x46')]+'%'};return _0x1e2614;})});}if(_0x2fc2d1[_0x6f19('0x28')]['$gte']){var _0x4ac990=_0x2fc2d1[_0x6f19('0x28')][_0x6f19('0x47')][_0x6f19('0x48')](',');var _0x2c8033={};_0x2c8033[_0x4ac990[0x0]]={'$gte':moment(_0x4ac990[0x1])[_0x6f19('0x49')](_0x6f19('0x4a'))};_0x3531d8[_0x6f19('0x42')]=_[_0x6f19('0x45')](_0x3531d8[_0x6f19('0x42')],_0x2c8033);}_0x3531d8=_[_0x6f19('0x45')]({},_0x3531d8,_0x2fc2d1[_0x6f19('0x33')]);return db[_0x6f19('0x3b')][_0x6f19('0x17')]({'where':_0x3531d8[_0x6f19('0x42')]})[_0x6f19('0x1b')](function(_0x43f186){_0xb8cf95[_0x6f19('0x17')]=_0x43f186;if(_0x2fc2d1['query'][_0x6f19('0x4b')]){_0x3531d8[_0x6f19('0x4c')]=[{'all':!![]}];}return db[_0x6f19('0x3b')][_0x6f19('0x4d')](_0x3531d8);})[_0x6f19('0x1b')](function(_0x4b9471){if(_0x2fc2d1[_0x6f19('0x28')][_0x6f19('0x4e')]===_0x6f19('0x4f')){for(var _0xb3213c=0x0;_0xb3213c<_0x4b9471[_0x6f19('0x32')];_0xb3213c++){_0x4b9471[_0xb3213c][_0x6f19('0x35')]=juice(_0x4b9471[_0xb3213c][_0x6f19('0x35')]);}}_0xb8cf95[_0x6f19('0x50')]=_0x4b9471;return _0xb8cf95;});}})[_0x6f19('0x1b')](respondWithFilteredResult(_0x4e480d,_0x3531d8))[_0x6f19('0x36')](handleError(_0x4e480d,null));};exports[_0x6f19('0x51')]=function(_0x52ca02,_0x1ce3aa){return db[_0x6f19('0x22')][_0x6f19('0x38')]({'where':{'id':_0x52ca02[_0x6f19('0x2b')]['id']}})[_0x6f19('0x1b')](handleEntityNotFound(_0x1ce3aa,null))[_0x6f19('0x1b')](function(_0x4d5fbc){if(_0x4d5fbc){return _0x4d5fbc['setTags'](_0x52ca02[_0x6f19('0x35')][_0x6f19('0x3c')],_['omit'](_0x52ca02[_0x6f19('0x35')],[_0x6f19('0x3c'),'id'])||{})[_0x6f19('0x52')](function(){return db[_0x6f19('0x53')][_0x6f19('0x4d')]({'attributes':['id',_0x6f19('0x1f'),_0x6f19('0x54')],'where':{'id':_0x52ca02['body'][_0x6f19('0x3c')]}});})[_0x6f19('0x1b')](function(_0x26556c){socket['emit'](_0x6f19('0x55'),{'id':Number(_0x52ca02['params']['id']),'tags':_0x26556c||[]});return{'id':Number(_0x52ca02['params']['id']),'tags':_0x26556c||[]};});}})[_0x6f19('0x1b')](respondWithResult(_0x1ce3aa,null))[_0x6f19('0x36')](handleError(_0x1ce3aa,null));};exports['removeTags']=function(_0x5ea4c8,_0x1863dc){return db[_0x6f19('0x22')][_0x6f19('0x38')]({'where':{'id':_0x5ea4c8['params']['id']}})[_0x6f19('0x1b')](handleEntityNotFound(_0x1863dc,null))[_0x6f19('0x1b')](function(_0x3291e4){if(_0x3291e4){return _0x3291e4[_0x6f19('0x56')](_0x5ea4c8[_0x6f19('0x28')][_0x6f19('0x3c')]);}})[_0x6f19('0x1b')](respondWithStatusCode(_0x1863dc,null))['catch'](handleError(_0x1863dc,null));};exports[_0x6f19('0x57')]=function(_0x12467d,_0x1bfea3){var _0xd78b0f=moment()[_0x6f19('0x58')]()[_0x6f19('0x59')]();var _0x5b7432=path['join'](config[_0x6f19('0x5a')],_0x6f19('0x5b'),_0x6f19('0x5c'),_0x6f19('0x5d'));var _0x1591fa=path[_0x6f19('0x5e')](config[_0x6f19('0x5a')],_0x6f19('0x5b'),_0x6f19('0x5c'),'attachments');var _0x2e7a3b=path[_0x6f19('0x5e')](_0x5b7432,_0xd78b0f);var _0x5558da=util[_0x6f19('0x49')](_0x6f19('0x5f'),_0x12467d[_0x6f19('0x2b')]['id'],_0xd78b0f);var _0x233381=path['join'](_0x5b7432,_0x5558da);var _0x3c34a2=[];if(_0x12467d[_0x6f19('0x28')][_0x6f19('0x60')]){_0x3c34a2[_0x6f19('0x61')]({'model':db[_0x6f19('0x62')],'as':_0x6f19('0x63'),'raw':!![]});}var _0x5e8974=[{'model':db[_0x6f19('0x3b')],'as':_0x6f19('0x64'),'attributes':['id',_0x6f19('0x35'),_0x6f19('0x65'),'to','cc',_0x6f19('0x66'),_0x6f19('0x67'),'createdAt'],'where':{'secret':![]},'order':qs[_0x6f19('0x41')]('id'),'include':_0x3c34a2}];return db['MailInteraction'][_0x6f19('0x38')]({'where':{'id':_0x12467d[_0x6f19('0x2b')]['id']},'include':_0x5e8974})[_0x6f19('0x1b')](handleEntityNotFound(_0x1bfea3,null))[_0x6f19('0x1b')](function(_0x533ce9){if(_0x533ce9&&_0x533ce9[_0x6f19('0x64')]){var _0x55958a=_0x533ce9[_0x6f19('0x68')]({'plain':!![]});fs[_0x6f19('0x69')](_0x2e7a3b);return BPromise[_0x6f19('0x6a')](_0x55958a[_0x6f19('0x64')],function(_0x345a52,_0x58a4f7){var _0xaf5a23={'from':_0x345a52[_0x6f19('0x65')],'to':_0x345a52['to']||_0x6f19('0x6b'),'subject':_0x345a52[_0x6f19('0x67')],'html':htmlEntities[_0x6f19('0x6c')](_0x345a52[_0x6f19('0x35')]),'headers':{'Date':moment(_0x345a52[_0x6f19('0x6d')])[_0x6f19('0x49')](_0x6f19('0x6e'))},'attachments':[]};if(_0x345a52['cc']){_0xaf5a23['headers']['Cc']=_0x345a52['cc'];}if(_0x345a52[_0x6f19('0x66')]){_0xaf5a23[_0x6f19('0x6f')]['Bcc']=_0x345a52[_0x6f19('0x66')];}return new BPromise(function(_0x5dc48f,_0xc5ab5d){if(_0x345a52[_0x6f19('0x63')]){for(var _0x3afa54=0x0;_0x3afa54<_0x345a52[_0x6f19('0x63')][_0x6f19('0x32')];_0x3afa54++){var _0xe108ca=_0x345a52[_0x6f19('0x63')][_0x3afa54];var _0x5dfcc4=path['join'](_0x1591fa,_0xe108ca[_0x6f19('0x70')]);if(fs[_0x6f19('0x71')](_0x5dfcc4)){_0xaf5a23[_0x6f19('0x60')][_0x6f19('0x61')]({'name':_0xe108ca[_0x6f19('0x1f')],'contentType':_0xe108ca[_0x6f19('0x25')],'data':fs[_0x6f19('0x72')](_0x5dfcc4)});}}}emlformat[_0x6f19('0x73')](_0xaf5a23,function(_0x467a89,_0x256be9){if(_0x467a89)return _0xc5ab5d(_0x467a89);fs[_0x6f19('0x74')](path[_0x6f19('0x5e')](_0x2e7a3b,util['format'](_0x6f19('0x75'),_0x58a4f7)),_0x256be9);return _0x5dc48f(_0x256be9);});});})['then'](function(){return new BPromise(function(_0x50094a,_0xbf3132){zipdir(_0x2e7a3b,{'saveTo':_0x233381},function(_0x3bd49a,_0x3d9c46){if(_0x3bd49a)return _0xbf3132(_0x3bd49a);return _0x50094a(_0x3d9c46);});})[_0x6f19('0x1b')](function(){return new BPromise(function(_0x45473e,_0x349b37){rimraf(_0x2e7a3b,function(_0x4066d5){if(_0x4066d5)_0x349b37(_0x4066d5);return _0x45473e();});});})[_0x6f19('0x1b')](function(){return _0x1bfea3['download'](_0x233381,_0x5558da,function(_0x57ab52){if(!_0x57ab52)fs[_0x6f19('0x76')](_0x233381);});});});}else{return _0x1bfea3['sendStatus'](0xc8);}})[_0x6f19('0x36')](handleError(_0x1bfea3,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index 2b74500..502d284 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 _0x4780=['getUsers','then','setDataValue','map','findAll','length','emit','exports','events','../../mysqldb','MailMessage','save','remove'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x4780,0xbe));var _0x0478=function(_0x20865e,_0x8c725b){_0x20865e=_0x20865e-0x0;var _0x571d3f=_0x4780[_0x20865e];return _0x571d3f;};'use strict';var EventEmitter=require(_0x0478('0x0'));var MailInteraction=require(_0x0478('0x1'))['db']['MailInteraction'];var MailMessage=require(_0x0478('0x1'))['db'][_0x0478('0x2')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x0478('0x3'),'afterUpdate':'update','afterDestroy':_0x0478('0x4')};function emitEvent(_0x2ab6f5){return function(_0x40b8ed,_0x404483,_0x26200c){_0x40b8ed[_0x0478('0x5')]({'attributes':['id'],'raw':!![]})[_0x0478('0x6')](function(_0x50f5db){_0x40b8ed[_0x0478('0x7')]('Users',_0x50f5db[_0x0478('0x8')](function(_0x21f74){return{'id':_0x21f74['id']};}));return MailMessage[_0x0478('0x9')]({'where':{'MailInteractionId':_0x40b8ed['id'],'direction':'in','read':![]},'raw':!![]});})[_0x0478('0x6')](function(_0x4f9a8f){_0x40b8ed['setDataValue']('unreadMessages',_0x4f9a8f[_0x0478('0xa')]);MailInteractionEvents[_0x0478('0xb')](_0x2ab6f5+':'+_0x40b8ed['id'],_0x40b8ed);MailInteractionEvents[_0x0478('0xb')](_0x2ab6f5,_0x40b8ed);_0x26200c(null);})['catch'](_0x26200c(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailInteraction['hook'](e,emitEvent(event));}}module[_0x0478('0xc')]=MailInteractionEvents; \ No newline at end of file +var _0xd2eb=['length','emit','catch','hasOwnProperty','exports','events','MailInteraction','MailMessage','setMaxListeners','save','remove','then','Users','findAll','setDataValue','unreadMessages'];(function(_0x15da19,_0x4b5b10){var _0x3c2991=function(_0x3d68eb){while(--_0x3d68eb){_0x15da19['push'](_0x15da19['shift']());}};_0x3c2991(++_0x4b5b10);}(_0xd2eb,0x1b5));var _0xbd2e=function(_0x23f416,_0x42e777){_0x23f416=_0x23f416-0x0;var _0x14efe5=_0xd2eb[_0x23f416];return _0x14efe5;};'use strict';var EventEmitter=require(_0xbd2e('0x0'));var MailInteraction=require('../../mysqldb')['db'][_0xbd2e('0x1')];var MailMessage=require('../../mysqldb')['db'][_0xbd2e('0x2')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0xbd2e('0x3')](0x0);var events={'afterCreate':_0xbd2e('0x4'),'afterUpdate':'update','afterDestroy':_0xbd2e('0x5')};function emitEvent(_0x284e99){return function(_0x3753dd,_0xb613f1,_0x554e5c){_0x3753dd['getUsers']({'attributes':['id'],'raw':!![]})[_0xbd2e('0x6')](function(_0x5086c2){_0x3753dd['setDataValue'](_0xbd2e('0x7'),_0x5086c2['map'](function(_0x54751e){return{'id':_0x54751e['id']};}));return MailMessage[_0xbd2e('0x8')]({'where':{'MailInteractionId':_0x3753dd['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x3732e7){_0x3753dd[_0xbd2e('0x9')](_0xbd2e('0xa'),_0x3732e7[_0xbd2e('0xb')]);MailInteractionEvents[_0xbd2e('0xc')](_0x284e99+':'+_0x3753dd['id'],_0x3753dd);MailInteractionEvents['emit'](_0x284e99,_0x3753dd);_0x554e5c(null);})[_0xbd2e('0xd')](_0x554e5c(null));};}for(var e in events){if(events[_0xbd2e('0xe')](e)){var event=events[e];MailInteraction['hook'](e,emitEvent(event));}}module[_0xbd2e('0xf')]=MailInteractionEvents; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.model.js b/server/api/mailInteraction/mailInteraction.model.js index a192660..3cdc127 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 _0xd8a0=['FULLTEXT','substatusAt','format','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','changed','substatus','models','get','MailMessage','then','catch','utf8mb4_unicode_ci','util','../../config/logger','bluebird','path','rimraf','./mailInteraction.attributes','exports','define','MailInteraction','mail_interactions','fti_mail_interactions'];(function(_0x2f8fef,_0x558b68){var _0x5c9a8d=function(_0x58d687){while(--_0x58d687){_0x2f8fef['push'](_0x2f8fef['shift']());}};_0x5c9a8d(++_0x558b68);}(_0xd8a0,0x153));var _0x0d8a=function(_0x301052,_0x5c2161){_0x301052=_0x301052-0x0;var _0x212047=_0xd8a0[_0x301052];return _0x212047;};'use strict';var _=require('lodash');var util=require(_0x0d8a('0x0'));var logger=require(_0x0d8a('0x1'))('api');var moment=require('moment');var BPromise=require(_0x0d8a('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0d8a('0x3'));var rimraf=require(_0x0d8a('0x4'));var config=require('../../config/environment');var attributes=require(_0x0d8a('0x5'));module[_0x0d8a('0x6')]=function(_0x2d0026,_0x1c4a7f){return _0x2d0026[_0x0d8a('0x7')](_0x0d8a('0x8'),attributes,{'tableName':_0x0d8a('0x9'),'paranoid':![],'indexes':[{'name':_0x0d8a('0xa'),'fields':['subject','to'],'type':_0x0d8a('0xb')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x4960dc,_0x32ef93,_0x4607b9){if(_0x4960dc['substatus']){_0x4960dc[_0x0d8a('0xc')]=moment()[_0x0d8a('0xd')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x4960dc[_0x0d8a('0xe')]){_0x4960dc[_0x0d8a('0xf')]=moment()[_0x0d8a('0xd')](_0x0d8a('0x10'));}_0x4607b9(null,_0x32ef93);},'beforeUpdate':function(_0x3049ef,_0x3a25af,_0x55e10a){if(_0x3049ef[_0x0d8a('0x11')]('substatus')){_0x3049ef[_0x0d8a('0xc')]=_0x3049ef[_0x0d8a('0x12')]?moment()[_0x0d8a('0xd')](_0x0d8a('0x10')):null;}if(_0x3049ef['changed'](_0x0d8a('0xe'))){_0x3049ef['closedAt']=moment()['format'](_0x0d8a('0x10'));_0x3049ef[_0x0d8a('0x12')]=null;_0x3049ef[_0x0d8a('0xc')]=null;}_0x55e10a(null,_0x3049ef);},'afterUpdate':function(_0x5acc1a,_0x1dbeb7,_0x2b8d94){var _0x185340=_0x2d0026[_0x0d8a('0x13')];var _0x17f1d4=_0x5acc1a[_0x0d8a('0x14')]({'plain':!![]});if(_0x17f1d4[_0x0d8a('0xe')]){return _0x185340[_0x0d8a('0x15')]['update']({'read':!![]},{'where':{'MailInteractionId':_0x17f1d4['id']}})[_0x0d8a('0x16')](function(){_0x2b8d94();})[_0x0d8a('0x17')](function(_0x3d0d76){_0x2b8d94(_0x3d0d76);});}else{_0x2b8d94();}}},'charset':'utf8mb4','collate':_0x0d8a('0x18')});}; \ No newline at end of file +var _0xd8c9=['./mailInteraction.attributes','exports','define','mail_interactions','fti_mail_interactions','subject','FULLTEXT','substatusAt','format','YYYY-MM-DD\x20HH:mm:ss','closed','changed','substatus','closedAt','update','then','catch','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment'];(function(_0x412342,_0x180734){var _0x3e62cb=function(_0x501fc6){while(--_0x501fc6){_0x412342['push'](_0x412342['shift']());}};_0x3e62cb(++_0x180734);}(_0xd8c9,0x1c3));var _0x9d8c=function(_0xf2b275,_0x62f1ff){_0xf2b275=_0xf2b275-0x0;var _0x3a7d9c=_0xd8c9[_0xf2b275];return _0x3a7d9c;};'use strict';var _=require(_0x9d8c('0x0'));var util=require(_0x9d8c('0x1'));var logger=require(_0x9d8c('0x2'))(_0x9d8c('0x3'));var moment=require('moment');var BPromise=require(_0x9d8c('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9d8c('0x5'));var rimraf=require(_0x9d8c('0x6'));var config=require(_0x9d8c('0x7'));var attributes=require(_0x9d8c('0x8'));module[_0x9d8c('0x9')]=function(_0x19a8f9,_0x33c258){return _0x19a8f9[_0x9d8c('0xa')]('MailInteraction',attributes,{'tableName':_0x9d8c('0xb'),'paranoid':![],'indexes':[{'name':_0x9d8c('0xc'),'fields':[_0x9d8c('0xd'),'to'],'type':_0x9d8c('0xe')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x214532,_0x31196c,_0x324692){if(_0x214532['substatus']){_0x214532[_0x9d8c('0xf')]=moment()[_0x9d8c('0x10')](_0x9d8c('0x11'));}if(_0x214532[_0x9d8c('0x12')]){_0x214532['closedAt']=moment()[_0x9d8c('0x10')](_0x9d8c('0x11'));}_0x324692(null,_0x31196c);},'beforeUpdate':function(_0x3d5bbc,_0x37d505,_0x2bd257){if(_0x3d5bbc[_0x9d8c('0x13')](_0x9d8c('0x14'))){_0x3d5bbc[_0x9d8c('0xf')]=_0x3d5bbc[_0x9d8c('0x14')]?moment()[_0x9d8c('0x10')](_0x9d8c('0x11')):null;}if(_0x3d5bbc[_0x9d8c('0x13')](_0x9d8c('0x12'))){_0x3d5bbc[_0x9d8c('0x15')]=moment()[_0x9d8c('0x10')](_0x9d8c('0x11'));_0x3d5bbc[_0x9d8c('0x14')]=null;_0x3d5bbc[_0x9d8c('0xf')]=null;}_0x2bd257(null,_0x3d5bbc);},'afterUpdate':function(_0x2932d7,_0x470bff,_0x159209){var _0x26d50e=_0x19a8f9['models'];var _0x4007f4=_0x2932d7['get']({'plain':!![]});if(_0x4007f4[_0x9d8c('0x12')]){return _0x26d50e['MailMessage'][_0x9d8c('0x16')]({'read':!![]},{'where':{'MailInteractionId':_0x4007f4['id']}})[_0x9d8c('0x17')](function(){_0x159209();})[_0x9d8c('0x18')](function(_0xf88700){_0x159209(_0xf88700);});}else{_0x159209();}}},'charset':_0x9d8c('0x19'),'collate':_0x9d8c('0x1a')});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index 6ba99d0..990f5d5 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 _0x1eae=['catch','MailInteraction','update','body','options','raw','attributes','limit','UpdateMailInteraction','AddTagsToMailInteraction','find','addTags','ids','omit','spread','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','./mailInteraction.socket','register','request','then','info','MailInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message'];(function(_0x2df56c,_0x26b29e){var _0x3ab486=function(_0x44cada){while(--_0x44cada){_0x2df56c['push'](_0x2df56c['shift']());}};_0x3ab486(++_0x26b29e);}(_0x1eae,0x12e));var _0xe1ea=function(_0x1dc89c,_0x257577){_0x1dc89c=_0x1dc89c-0x0;var _0x32ff3e=_0x1eae[_0x1dc89c];return _0x32ff3e;};'use strict';var _=require(_0xe1ea('0x0'));var util=require(_0xe1ea('0x1'));var moment=require(_0xe1ea('0x2'));var BPromise=require(_0xe1ea('0x3'));var rs=require(_0xe1ea('0x4'));var fs=require('fs');var Redis=require(_0xe1ea('0x5'));var db=require(_0xe1ea('0x6'))['db'];var utils=require(_0xe1ea('0x7'));var logger=require('../../config/logger')(_0xe1ea('0x8'));var config=require(_0xe1ea('0x9'));var jayson=require(_0xe1ea('0xa'));var client=jayson['client'][_0xe1ea('0xb')]({'port':0x232a});config[_0xe1ea('0xc')]=_['defaults'](config[_0xe1ea('0xc')],{'host':_0xe1ea('0xd'),'port':0x18eb});var socket=require(_0xe1ea('0xe'))(new Redis(config[_0xe1ea('0xc')]));require(_0xe1ea('0xf'))[_0xe1ea('0x10')](socket);function respondWithRpcPromise(_0x1e01a2,_0x88943e,_0x32a16e){return new BPromise(function(_0x4edf43,_0x5e3eed){return client[_0xe1ea('0x11')](_0x1e01a2,_0x32a16e)[_0xe1ea('0x12')](function(_0x1f0a0e){logger[_0xe1ea('0x13')](_0xe1ea('0x14'),_0x88943e,_0xe1ea('0x15'));logger[_0xe1ea('0x16')]('MailInteraction,\x20%s,\x20%s,\x20%s',_0x88943e,_0xe1ea('0x15'),JSON[_0xe1ea('0x17')](_0x1f0a0e));if(_0x1f0a0e[_0xe1ea('0x18')]){if(_0x1f0a0e[_0xe1ea('0x18')]['code']===0x1f4){logger['error'](_0xe1ea('0x14'),_0x88943e,_0x1f0a0e[_0xe1ea('0x18')][_0xe1ea('0x19')]);return _0x5e3eed(_0x1f0a0e[_0xe1ea('0x18')][_0xe1ea('0x19')]);}logger['error'](_0xe1ea('0x14'),_0x88943e,_0x1f0a0e[_0xe1ea('0x18')]['message']);return _0x4edf43(_0x1f0a0e[_0xe1ea('0x18')][_0xe1ea('0x19')]);}else{logger[_0xe1ea('0x13')](_0xe1ea('0x14'),_0x88943e,_0xe1ea('0x15'));_0x4edf43(_0x1f0a0e['result'][_0xe1ea('0x19')]);}})[_0xe1ea('0x1a')](function(_0x4cff2c){logger['error'](_0xe1ea('0x14'),_0x88943e,_0x4cff2c);_0x5e3eed(_0x4cff2c);});});}exports['UpdateMailInteraction']=function(_0x1936fa){var _0x13ff12=this;return new Promise(function(_0x4b1e86,_0x211274){return db[_0xe1ea('0x1b')][_0xe1ea('0x1c')](_0x1936fa[_0xe1ea('0x1d')],{'raw':_0x1936fa['options']?_0x1936fa[_0xe1ea('0x1e')][_0xe1ea('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1936fa['options']?_0x1936fa[_0xe1ea('0x1e')]['where']||null:null,'attributes':_0x1936fa['options']?_0x1936fa[_0xe1ea('0x1e')][_0xe1ea('0x20')]||null:null,'limit':_0x1936fa[_0xe1ea('0x1e')]?_0x1936fa[_0xe1ea('0x1e')][_0xe1ea('0x21')]||null:null})[_0xe1ea('0x12')](function(_0x555b5f){logger[_0xe1ea('0x13')](_0xe1ea('0x22'),_0x1936fa);logger[_0xe1ea('0x16')]('UpdateMailInteraction',_0x1936fa,JSON[_0xe1ea('0x17')](_0x555b5f));_0x4b1e86(_0x555b5f);})['catch'](function(_0x35a503){logger['error'](_0xe1ea('0x22'),_0x35a503[_0xe1ea('0x19')],_0x1936fa);_0x211274(_0x13ff12[_0xe1ea('0x18')](0x1f4,_0x35a503[_0xe1ea('0x19')]));});});};exports[_0xe1ea('0x23')]=function(_0x58f1df){return new Promise(function(_0x3ee4f8,_0x4a78e9){return db[_0xe1ea('0x1b')][_0xe1ea('0x24')]({'where':_0x58f1df[_0xe1ea('0x1e')]?_0x58f1df[_0xe1ea('0x1e')]['where']||null:null})[_0xe1ea('0x12')](function(_0x340316){if(_0x340316){return _0x340316[_0xe1ea('0x25')](_0x58f1df[_0xe1ea('0x1d')][_0xe1ea('0x26')],_[_0xe1ea('0x27')](_0x58f1df[_0xe1ea('0x1d')],[_0xe1ea('0x26'),'id'])||{});}})[_0xe1ea('0x28')](function(_0x20942b){logger[_0xe1ea('0x13')]('AddTags',_0x58f1df);logger[_0xe1ea('0x16')]('AddTags',_0x58f1df,JSON[_0xe1ea('0x17')](_0x20942b));_0x3ee4f8(_0x20942b);})[_0xe1ea('0x1a')](function(_0x9e0d4e){logger[_0xe1ea('0x18')]('AddTags',_0x9e0d4e[_0xe1ea('0x19')],_0x58f1df);_0x4a78e9(_this[_0xe1ea('0x18')](0x1f4,_0x9e0d4e[_0xe1ea('0x19')]));});});}; \ No newline at end of file +var _0x3a25=['attributes','AddTagsToMailInteraction','find','addTags','omit','ids','AddTags','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','redis','defaults','localhost','socket.io-emitter','./mailInteraction.socket','request','then','info','debug','MailInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','MailInteraction,\x20%s,\x20%s','catch','UpdateMailInteraction','MailInteraction','update','body','options','raw','where'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3a25,0x1f3));var _0x53a2=function(_0x77d5c0,_0x5b6dc6){_0x77d5c0=_0x77d5c0-0x0;var _0x46dd73=_0x3a25[_0x77d5c0];return _0x46dd73;};'use strict';var _=require(_0x53a2('0x0'));var util=require(_0x53a2('0x1'));var moment=require(_0x53a2('0x2'));var BPromise=require(_0x53a2('0x3'));var rs=require(_0x53a2('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x53a2('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x53a2('0x6'))(_0x53a2('0x7'));var config=require(_0x53a2('0x8'));var jayson=require(_0x53a2('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0x53a2('0xa')]=_[_0x53a2('0xb')](config['redis'],{'host':_0x53a2('0xc'),'port':0x18eb});var socket=require(_0x53a2('0xd'))(new Redis(config[_0x53a2('0xa')]));require(_0x53a2('0xe'))['register'](socket);function respondWithRpcPromise(_0x158700,_0x1400bd,_0x24054f){return new BPromise(function(_0x469538,_0x4c297b){return client[_0x53a2('0xf')](_0x158700,_0x24054f)[_0x53a2('0x10')](function(_0xec44ca){logger[_0x53a2('0x11')]('MailInteraction,\x20%s,\x20%s',_0x1400bd,'request\x20sent');logger[_0x53a2('0x12')](_0x53a2('0x13'),_0x1400bd,_0x53a2('0x14'),JSON[_0x53a2('0x15')](_0xec44ca));if(_0xec44ca[_0x53a2('0x16')]){if(_0xec44ca[_0x53a2('0x16')][_0x53a2('0x17')]===0x1f4){logger[_0x53a2('0x16')]('MailInteraction,\x20%s,\x20%s',_0x1400bd,_0xec44ca[_0x53a2('0x16')][_0x53a2('0x18')]);return _0x4c297b(_0xec44ca[_0x53a2('0x16')][_0x53a2('0x18')]);}logger[_0x53a2('0x16')](_0x53a2('0x19'),_0x1400bd,_0xec44ca[_0x53a2('0x16')][_0x53a2('0x18')]);return _0x469538(_0xec44ca[_0x53a2('0x16')][_0x53a2('0x18')]);}else{logger[_0x53a2('0x11')](_0x53a2('0x19'),_0x1400bd,'request\x20sent');_0x469538(_0xec44ca['result'][_0x53a2('0x18')]);}})[_0x53a2('0x1a')](function(_0xb6888d){logger[_0x53a2('0x16')](_0x53a2('0x19'),_0x1400bd,_0xb6888d);_0x4c297b(_0xb6888d);});});}exports[_0x53a2('0x1b')]=function(_0x42e7d4){var _0xdb0e7b=this;return new Promise(function(_0x190eeb,_0x4b7b14){return db[_0x53a2('0x1c')][_0x53a2('0x1d')](_0x42e7d4[_0x53a2('0x1e')],{'raw':_0x42e7d4['options']?_0x42e7d4[_0x53a2('0x1f')][_0x53a2('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x42e7d4[_0x53a2('0x1f')]?_0x42e7d4[_0x53a2('0x1f')][_0x53a2('0x21')]||null:null,'attributes':_0x42e7d4['options']?_0x42e7d4['options'][_0x53a2('0x22')]||null:null,'limit':_0x42e7d4['options']?_0x42e7d4['options']['limit']||null:null})[_0x53a2('0x10')](function(_0x5d3674){logger[_0x53a2('0x11')]('UpdateMailInteraction',_0x42e7d4);logger[_0x53a2('0x12')](_0x53a2('0x1b'),_0x42e7d4,JSON['stringify'](_0x5d3674));_0x190eeb(_0x5d3674);})['catch'](function(_0x6b50eb){logger[_0x53a2('0x16')](_0x53a2('0x1b'),_0x6b50eb[_0x53a2('0x18')],_0x42e7d4);_0x4b7b14(_0xdb0e7b[_0x53a2('0x16')](0x1f4,_0x6b50eb[_0x53a2('0x18')]));});});};exports[_0x53a2('0x23')]=function(_0x1f28dc){return new Promise(function(_0xf258bd,_0x47152c){return db[_0x53a2('0x1c')][_0x53a2('0x24')]({'where':_0x1f28dc[_0x53a2('0x1f')]?_0x1f28dc[_0x53a2('0x1f')][_0x53a2('0x21')]||null:null})[_0x53a2('0x10')](function(_0x51717b){if(_0x51717b){return _0x51717b[_0x53a2('0x25')](_0x1f28dc[_0x53a2('0x1e')]['ids'],_[_0x53a2('0x26')](_0x1f28dc[_0x53a2('0x1e')],[_0x53a2('0x27'),'id'])||{});}})['spread'](function(_0x24db10){logger[_0x53a2('0x11')](_0x53a2('0x28'),_0x1f28dc);logger[_0x53a2('0x12')]('AddTags',_0x1f28dc,JSON[_0x53a2('0x15')](_0x24db10));_0xf258bd(_0x24db10);})[_0x53a2('0x1a')](function(_0x196f38){logger[_0x53a2('0x16')]('AddTags',_0x196f38[_0x53a2('0x18')],_0x1f28dc);_0x47152c(_this[_0x53a2('0x16')](0x1f4,_0x196f38[_0x53a2('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index 36eb38f..6c5e281 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 _0x766f=['save','remove','update','emit','removeListener','register','length','mailInteraction:','./mailInteraction.events'];(function(_0x4f7a17,_0x237ece){var _0x459fae=function(_0x4de820){while(--_0x4de820){_0x4f7a17['push'](_0x4f7a17['shift']());}};_0x459fae(++_0x237ece);}(_0x766f,0xa1));var _0xf766=function(_0x26462c,_0xd20a35){_0x26462c=_0x26462c-0x0;var _0x509a42=_0x766f[_0x26462c];return _0x509a42;};'use strict';var MailInteractionEvents=require(_0xf766('0x0'));var events=[_0xf766('0x1'),_0xf766('0x2'),_0xf766('0x3')];function createListener(_0x38db75,_0x2fe82d){return function(_0x95bacd){_0x2fe82d[_0xf766('0x4')](_0x38db75,_0x95bacd);};}function removeListener(_0x47cbaa,_0x311f7d){return function(){MailInteractionEvents[_0xf766('0x5')](_0x47cbaa,_0x311f7d);};}exports[_0xf766('0x6')]=function(_0x39f1c5){for(var _0x4e81f8=0x0,_0x4ffb48=events[_0xf766('0x7')];_0x4e81f8<_0x4ffb48;_0x4e81f8++){var _0x4582c5=events[_0x4e81f8];var _0x29f9bd=createListener(_0xf766('0x8')+_0x4582c5,_0x39f1c5);MailInteractionEvents['on'](_0x4582c5,_0x29f9bd);}}; \ No newline at end of file +var _0x6f6b=['register','mailInteraction:','./mailInteraction.events','save','update','emit'];(function(_0xc6be3a,_0x540e05){var _0x56a310=function(_0x50a144){while(--_0x50a144){_0xc6be3a['push'](_0xc6be3a['shift']());}};_0x56a310(++_0x540e05);}(_0x6f6b,0x10a));var _0xb6f6=function(_0x1cb931,_0x41493d){_0x1cb931=_0x1cb931-0x0;var _0x1ef86b=_0x6f6b[_0x1cb931];return _0x1ef86b;};'use strict';var MailInteractionEvents=require(_0xb6f6('0x0'));var events=[_0xb6f6('0x1'),'remove',_0xb6f6('0x2')];function createListener(_0x1b55c9,_0x21a795){return function(_0x2ace6c){_0x21a795[_0xb6f6('0x3')](_0x1b55c9,_0x2ace6c);};}function removeListener(_0x3df0ee,_0x38a10a){return function(){MailInteractionEvents['removeListener'](_0x3df0ee,_0x38a10a);};}exports[_0xb6f6('0x4')]=function(_0x3acad1){for(var _0xcf833d=0x0,_0x38bed8=events['length'];_0xcf833d<_0x38bed8;_0xcf833d++){var _0x413039=events[_0xcf833d];var _0x1967ff=createListener(_0xb6f6('0x5')+_0x413039,_0x3acad1);MailInteractionEvents['on'](_0x413039,_0x1967ff);}}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index 1823add..9ba277d 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 _0x1eaa=['index','get','/:id','show','/:id/download','download','mailmessage:create','put','update','/:id/accept','accept','/:id/reject','delete','destroy','exports','multer','connect-timeout','express','fs-extra','../../config/environment','./mailMessage.controller','isAuthenticated'];(function(_0x1a36a5,_0x746928){var _0x746243=function(_0x481966){while(--_0x481966){_0x1a36a5['push'](_0x1a36a5['shift']());}};_0x746243(++_0x746928);}(_0x1eaa,0x1c7));var _0xa1ea=function(_0x4029ae,_0x423d8d){_0x4029ae=_0x4029ae-0x0;var _0x5a6db8=_0x1eaa[_0x4029ae];return _0x5a6db8;};'use strict';var multer=require(_0xa1ea('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xa1ea('0x1'));var express=require(_0xa1ea('0x2'));var router=express['Router']();var fs_extra=require(_0xa1ea('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xa1ea('0x4'));var controller=require(_0xa1ea('0x5'));router['get']('/',auth[_0xa1ea('0x6')](),controller[_0xa1ea('0x7')]);router[_0xa1ea('0x8')]('/describe',auth[_0xa1ea('0x6')](),controller['describe']);router['get'](_0xa1ea('0x9'),auth[_0xa1ea('0x6')](),controller[_0xa1ea('0xa')]);router[_0xa1ea('0x8')](_0xa1ea('0xb'),auth[_0xa1ea('0x6')](),controller[_0xa1ea('0xc')]);router['post']('/',auth[_0xa1ea('0x6')](),interaction['tracked']('mail',_0xa1ea('0xd')),controller['create']);router[_0xa1ea('0xe')](_0xa1ea('0x9'),auth[_0xa1ea('0x6')](),controller[_0xa1ea('0xf')]);router[_0xa1ea('0xe')](_0xa1ea('0x10'),auth[_0xa1ea('0x6')](),controller[_0xa1ea('0x11')]);router['put'](_0xa1ea('0x12'),auth[_0xa1ea('0x6')](),controller['reject']);router[_0xa1ea('0x13')](_0xa1ea('0x9'),auth[_0xa1ea('0x6')](),controller[_0xa1ea('0x14')]);module[_0xa1ea('0x15')]=router; \ No newline at end of file +var _0x70f9=['express','fs-extra','../../components/interaction/service','./mailMessage.controller','get','isAuthenticated','/describe','describe','show','/:id/download','download','post','tracked','mail','create','update','put','/:id/reject','delete','/:id','destroy','exports','path','connect-timeout'];(function(_0x209941,_0x5c9988){var _0x1e8729=function(_0x51a9b8){while(--_0x51a9b8){_0x209941['push'](_0x209941['shift']());}};_0x1e8729(++_0x5c9988);}(_0x70f9,0x14e));var _0x970f=function(_0x21d0c3,_0x16c71c){_0x21d0c3=_0x21d0c3-0x0;var _0x4df18e=_0x70f9[_0x21d0c3];return _0x4df18e;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x970f('0x0'));var timeout=require(_0x970f('0x1'));var express=require(_0x970f('0x2'));var router=express['Router']();var fs_extra=require(_0x970f('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x970f('0x4'));var config=require('../../config/environment');var controller=require(_0x970f('0x5'));router[_0x970f('0x6')]('/',auth[_0x970f('0x7')](),controller['index']);router[_0x970f('0x6')](_0x970f('0x8'),auth[_0x970f('0x7')](),controller[_0x970f('0x9')]);router[_0x970f('0x6')]('/:id',auth[_0x970f('0x7')](),controller[_0x970f('0xa')]);router[_0x970f('0x6')](_0x970f('0xb'),auth[_0x970f('0x7')](),controller[_0x970f('0xc')]);router[_0x970f('0xd')]('/',auth[_0x970f('0x7')](),interaction[_0x970f('0xe')](_0x970f('0xf'),'mailmessage:create'),controller[_0x970f('0x10')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x970f('0x11')]);router[_0x970f('0x12')]('/:id/accept',auth[_0x970f('0x7')](),controller['accept']);router['put'](_0x970f('0x13'),auth[_0x970f('0x7')](),controller['reject']);router[_0x970f('0x14')](_0x970f('0x15'),auth[_0x970f('0x7')](),controller[_0x970f('0x16')]);module[_0x970f('0x17')]=router; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.attributes.js b/server/api/mailMessage/mailMessage.attributes.js index bf93cdf..9d34405 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 _0xfd2e=['INTEGER','Email','Chat','sequelize','lodash','exports','TEXT','long','medium','BOOLEAN','ENUM','out','STRING'];(function(_0x2a8d56,_0x15ecd6){var _0x49b237=function(_0x42df46){while(--_0x42df46){_0x2a8d56['push'](_0x2a8d56['shift']());}};_0x49b237(++_0x15ecd6);}(_0xfd2e,0x1a3));var _0xefd2=function(_0x18cebb,_0x5b75eb){_0x18cebb=_0x18cebb-0x0;var _0x1e060e=_0xfd2e[_0x18cebb];return _0x1e060e;};'use strict';var Sequelize=require(_0xefd2('0x0'));var _=require(_0xefd2('0x1'));module[_0xefd2('0x2')]={'body':{'type':Sequelize[_0xefd2('0x3')](_0xefd2('0x4')),'allowNull':![]},'plainBody':{'type':Sequelize[_0xefd2('0x3')](_0xefd2('0x5'))},'read':{'type':Sequelize[_0xefd2('0x6')],'defaultValue':![]},'direction':{'type':Sequelize[_0xefd2('0x7')]('in','out'),'defaultValue':_0xefd2('0x8'),'allowNull':![]},'messageId':{'type':Sequelize[_0xefd2('0x9')](0x1fe)},'from':{'type':Sequelize[_0xefd2('0x9')]},'to':{'type':Sequelize[_0xefd2('0x3')](_0xefd2('0x4'))},'cc':{'type':Sequelize[_0xefd2('0x3')]('long')},'bcc':{'type':Sequelize[_0xefd2('0x3')](_0xefd2('0x4'))},'subject':{'type':Sequelize[_0xefd2('0x3')]},'sentAt':{'type':Sequelize['DATE']},'attach':{'type':Sequelize[_0xefd2('0xa')],'defaultValue':0x0},'secret':{'type':Sequelize[_0xefd2('0x6')],'defaultValue':![]},'readAt':{'type':Sequelize['DATE']},'originTo':{'type':Sequelize[_0xefd2('0x3')](_0xefd2('0x4'))},'originCc':{'type':Sequelize[_0xefd2('0x3')](_0xefd2('0x4'))},'originChannel':{'type':Sequelize[_0xefd2('0x7')](_0xefd2('0xb'),_0xefd2('0xc')),'defaultValue':_0xefd2('0xb'),'allowNull':![]}}; \ No newline at end of file +var _0x9d5c=['Chat','sequelize','lodash','exports','TEXT','long','medium','ENUM','out','STRING','DATE','INTEGER','BOOLEAN'];(function(_0x3f4ba6,_0x133cd6){var _0x4fa5a3=function(_0x136d8b){while(--_0x136d8b){_0x3f4ba6['push'](_0x3f4ba6['shift']());}};_0x4fa5a3(++_0x133cd6);}(_0x9d5c,0x153));var _0xc9d5=function(_0x2600a6,_0x11f32c){_0x2600a6=_0x2600a6-0x0;var _0x99f4bc=_0x9d5c[_0x2600a6];return _0x99f4bc;};'use strict';var Sequelize=require(_0xc9d5('0x0'));var _=require(_0xc9d5('0x1'));module[_0xc9d5('0x2')]={'body':{'type':Sequelize[_0xc9d5('0x3')](_0xc9d5('0x4')),'allowNull':![]},'plainBody':{'type':Sequelize[_0xc9d5('0x3')](_0xc9d5('0x5'))},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0xc9d5('0x6')]('in','out'),'defaultValue':_0xc9d5('0x7'),'allowNull':![]},'messageId':{'type':Sequelize[_0xc9d5('0x8')](0x1fe)},'from':{'type':Sequelize[_0xc9d5('0x8')]},'to':{'type':Sequelize[_0xc9d5('0x3')](_0xc9d5('0x4'))},'cc':{'type':Sequelize[_0xc9d5('0x3')]('long')},'bcc':{'type':Sequelize[_0xc9d5('0x3')](_0xc9d5('0x4'))},'subject':{'type':Sequelize[_0xc9d5('0x3')]},'sentAt':{'type':Sequelize[_0xc9d5('0x9')]},'attach':{'type':Sequelize[_0xc9d5('0xa')],'defaultValue':0x0},'secret':{'type':Sequelize[_0xc9d5('0xb')],'defaultValue':![]},'readAt':{'type':Sequelize[_0xc9d5('0x9')]},'originTo':{'type':Sequelize[_0xc9d5('0x3')](_0xc9d5('0x4'))},'originCc':{'type':Sequelize[_0xc9d5('0x3')]('long')},'originChannel':{'type':Sequelize[_0xc9d5('0x6')]('Email',_0xc9d5('0xc')),'defaultValue':'Email','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.controller.js b/server/api/mailMessage/mailMessage.controller.js index 0047a31..43f46c2 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 _0x60b5=['[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','User','fullname','email','event','fromString','EventManager','rejectmessage','unix','toString','server','files','tmp','message-%s.eml','from','bcc','subject','createdAt','Attachment','Attachments','headers','Bcc','existsSync','push','readFileSync','writeFileSync','unlinkSync','eml-format','moment','bluebird','path','lodash','ioredis','../../config/logger','../../mysqldb','redis','localhost','socket.io-emitter','html-entities','./mailMessage.socket','register','jayson/promise','http','client','then','info','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','error','code','MailMessage,\x20%s,\x20%s','message','offset','undefined','limit','set','Content-Range','update','destroy','end','sendStatus','stack','index','map','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','where','VIRTUAL','name','filter','options','MailMessage','count','includeAll','include','findAll','rows','catch','show','params','merge','find','body','describe','create','direction','out','secret','split','MailAccount','findOne','MailAccountId','List','updatedAt','MailServerOut','Smtp','CloudProvider','getSmtpOptions','attachments','join','root','basename','Contacts','CmContact','defaults','List\x20not\x20found','SendMail','sendMail','messageId','format','accept','read','YYYY-MM-DD\x20HH:mm:ss','UserId','agent','get','MailInteraction','MailInteractionId','isNil','read1stAt','user','role','interaction','stringify','null','Sequelize','QueryTypes','SELECT','contact','internal','manual','interface','SIP/%s','channel','motionChannel','acceptmessage','reject','mail'];(function(_0x243b59,_0x3f9495){var _0x3e1676=function(_0x354052){while(--_0x354052){_0x243b59['push'](_0x243b59['shift']());}};_0x3e1676(++_0x3f9495);}(_0x60b5,0x157));var _0x560b=function(_0xe69093,_0x17e931){_0xe69093=_0xe69093-0x0;var _0x48bd96=_0x60b5[_0xe69093];return _0x48bd96;};'use strict';var emlformat=require(_0x560b('0x0'));var moment=require(_0x560b('0x1'));var BPromise=require(_0x560b('0x2'));var util=require('util');var path=require(_0x560b('0x3'));var fs=require('fs');var _=require(_0x560b('0x4'));var Redis=require(_0x560b('0x5'));var htmlToText=require('html-to-text');var qs=require('../../components/parsers/qs');var logger=require(_0x560b('0x6'))('api');var interaction_log=require(_0x560b('0x6'))('mail-interactions');var config=require('../../config/environment');var db=require(_0x560b('0x7'))['db'];config[_0x560b('0x8')]=_['defaults'](config[_0x560b('0x8')],{'host':_0x560b('0x9'),'port':0x18eb});var socket=require(_0x560b('0xa'))(new Redis(config[_0x560b('0x8')]));var htmlEntities=require(_0x560b('0xb'));require(_0x560b('0xc'))[_0x560b('0xd')](socket);var jayson=require(_0x560b('0xe'));var client=jayson['client'][_0x560b('0xf')]({'port':0x232c});var client9003=jayson[_0x560b('0x10')]['http']({'port':0x232b});var client9002=jayson[_0x560b('0x10')]['http']({'port':0x232a});function respondWithRpcPromise(_0x38339b,_0x1a9fd9,_0x392396,_0x2c8d1f){return new BPromise(function(_0x216130,_0x129fd6){var _0x145125=_0x2c8d1f||client;return _0x145125['request'](_0x38339b,_0x392396)[_0x560b('0x11')](function(_0x3928c1){logger[_0x560b('0x12')]('MailMessage,\x20%s,\x20%s',_0x1a9fd9,_0x560b('0x13'));logger[_0x560b('0x14')](_0x560b('0x15'),_0x1a9fd9,'request\x20sent',JSON['stringify'](_0x3928c1));if(_0x3928c1['error']){if(_0x3928c1[_0x560b('0x16')][_0x560b('0x17')]===0x1f4){logger[_0x560b('0x16')](_0x560b('0x18'),_0x1a9fd9,_0x3928c1[_0x560b('0x16')][_0x560b('0x19')]);return _0x129fd6(_0x3928c1[_0x560b('0x16')]['message']);}logger[_0x560b('0x16')](_0x560b('0x18'),_0x1a9fd9,_0x3928c1[_0x560b('0x16')][_0x560b('0x19')]);return _0x216130(_0x3928c1[_0x560b('0x16')][_0x560b('0x19')]);}else{logger[_0x560b('0x12')]('MailMessage,\x20%s,\x20%s',_0x1a9fd9,_0x560b('0x13'));_0x216130(_0x3928c1['result'][_0x560b('0x19')]);}})['catch'](function(_0x40d494){logger[_0x560b('0x16')](_0x560b('0x18'),_0x1a9fd9,_0x40d494);_0x129fd6(_0x40d494);});});}function respondWithResult(_0x5351e0,_0x3eb870){_0x3eb870=_0x3eb870||0xc8;return function(_0x5d056d){if(_0x5d056d){return _0x5351e0['status'](_0x3eb870)['json'](_0x5d056d);}};}function respondWithFilteredResult(_0x384272,_0x4fd7be){return function(_0x3d956f){if(_0x3d956f){var _0x3c9826=typeof _0x4fd7be[_0x560b('0x1a')]===_0x560b('0x1b')&&typeof _0x4fd7be[_0x560b('0x1c')]===_0x560b('0x1b');var _0x51b4ca=_0x3d956f['count'];var _0x336235=_0x3c9826?0x0:_0x4fd7be[_0x560b('0x1a')];var _0x41e490=_0x3c9826?_0x3d956f['count']:_0x4fd7be['offset']+_0x4fd7be[_0x560b('0x1c')];var _0x3d4cb2;if(_0x41e490>=_0x51b4ca){_0x41e490=_0x51b4ca;_0x3d4cb2=0xc8;}else{_0x3d4cb2=0xce;}_0x384272['status'](_0x3d4cb2);return _0x384272[_0x560b('0x1d')](_0x560b('0x1e'),_0x336235+'-'+_0x41e490+'/'+_0x51b4ca)['json'](_0x3d956f);}return null;};}function saveUpdates(_0x5b03df){return function(_0x44046f){if(_0x44046f){return _0x44046f[_0x560b('0x1f')](_0x5b03df)['then'](function(_0x37eb65){return _0x37eb65;});}return null;};}function removeEntity(_0x3d1658){return function(_0x3b89c5){if(_0x3b89c5){return _0x3b89c5[_0x560b('0x20')]()['then'](function(){_0x3d1658['status'](0xcc)[_0x560b('0x21')]();});}};}function handleEntityNotFound(_0x4c857f){return function(_0x117df5){if(!_0x117df5){_0x4c857f[_0x560b('0x22')](0x194);}return _0x117df5;};}function handleError(_0xa4f731,_0x27fbb5){_0x27fbb5=_0x27fbb5||0x1f4;return function(_0x1067bd){logger['error'](_0x1067bd[_0x560b('0x23')]);if(_0x1067bd['name']){delete _0x1067bd['name'];}_0xa4f731['status'](_0x27fbb5)['send'](_0x1067bd);};}exports[_0x560b('0x24')]=function(_0x470ba3,_0x21bd92){var _0x2ca6ff={},_0x1681e8={},_0x2f7822={'count':0x0,'rows':[]};var _0x2936d1=_[_0x560b('0x25')](db['MailMessage'][_0x560b('0x26')],function(_0x4c27f3){return{'name':_0x4c27f3['fieldName'],'type':_0x4c27f3[_0x560b('0x27')][_0x560b('0x28')]};});_0x1681e8[_0x560b('0x29')]=_[_0x560b('0x25')](_0x2936d1,'name');_0x1681e8[_0x560b('0x2a')]=_[_0x560b('0x2b')](_0x470ba3['query']);_0x1681e8[_0x560b('0x2c')]=_[_0x560b('0x2d')](_0x1681e8[_0x560b('0x29')],_0x1681e8[_0x560b('0x2a')]);_0x2ca6ff[_0x560b('0x2e')]=_['intersection'](_0x1681e8[_0x560b('0x29')],qs[_0x560b('0x2f')](_0x470ba3[_0x560b('0x2a')][_0x560b('0x2f')]));_0x2ca6ff[_0x560b('0x2e')]=_0x2ca6ff[_0x560b('0x2e')][_0x560b('0x30')]?_0x2ca6ff['attributes']:_0x1681e8['model'];if(!_0x470ba3[_0x560b('0x2a')]['hasOwnProperty'](_0x560b('0x31'))){_0x2ca6ff[_0x560b('0x1c')]=qs[_0x560b('0x1c')](_0x470ba3[_0x560b('0x2a')][_0x560b('0x1c')]);_0x2ca6ff[_0x560b('0x1a')]=qs['offset'](_0x470ba3[_0x560b('0x2a')][_0x560b('0x1a')]);}_0x2ca6ff[_0x560b('0x32')]=qs[_0x560b('0x33')](_0x470ba3['query'][_0x560b('0x33')]);_0x2ca6ff['where']=qs[_0x560b('0x2c')](_[_0x560b('0x34')](_0x470ba3[_0x560b('0x2a')],_0x1681e8['filters']),_0x2936d1);if(_0x470ba3[_0x560b('0x2a')]['filter']){_0x2ca6ff[_0x560b('0x35')]=_['merge'](_0x2ca6ff['where'],{'$or':_[_0x560b('0x25')](_0x2936d1,function(_0x140652){if(_0x140652[_0x560b('0x27')]!==_0x560b('0x36')){var _0x5ab391={};_0x5ab391[_0x140652[_0x560b('0x37')]]={'$like':'%'+_0x470ba3[_0x560b('0x2a')][_0x560b('0x38')]+'%'};return _0x5ab391;}})});}_0x2ca6ff=_['merge']({},_0x2ca6ff,_0x470ba3[_0x560b('0x39')]);var _0x1a9539={'where':_0x2ca6ff['where']};return db[_0x560b('0x3a')][_0x560b('0x3b')](_0x1a9539)[_0x560b('0x11')](function(_0x5a3eeb){_0x2f7822[_0x560b('0x3b')]=_0x5a3eeb;if(_0x470ba3[_0x560b('0x2a')][_0x560b('0x3c')]){_0x2ca6ff[_0x560b('0x3d')]=[{'all':!![]}];}return db['MailMessage'][_0x560b('0x3e')](_0x2ca6ff);})[_0x560b('0x11')](function(_0xee1eda){_0x2f7822[_0x560b('0x3f')]=_0xee1eda;return _0x2f7822;})['then'](respondWithFilteredResult(_0x21bd92,_0x2ca6ff))[_0x560b('0x40')](handleError(_0x21bd92,null));};exports[_0x560b('0x41')]=function(_0x5ecc81,_0x19a292){var _0xcb607={'raw':!![],'where':{'id':_0x5ecc81[_0x560b('0x42')]['id']}},_0x5809f6={};_0x5809f6['model']=_['keys'](db[_0x560b('0x3a')][_0x560b('0x26')]);_0x5809f6['query']=_[_0x560b('0x2b')](_0x5ecc81['query']);_0x5809f6[_0x560b('0x2c')]=_[_0x560b('0x2d')](_0x5809f6[_0x560b('0x29')],_0x5809f6['query']);_0xcb607[_0x560b('0x2e')]=_[_0x560b('0x2d')](_0x5809f6['model'],qs[_0x560b('0x2f')](_0x5ecc81[_0x560b('0x2a')][_0x560b('0x2f')]));_0xcb607[_0x560b('0x2e')]=_0xcb607[_0x560b('0x2e')]['length']?_0xcb607[_0x560b('0x2e')]:_0x5809f6['model'];if(_0x5ecc81['query'][_0x560b('0x3c')]){_0xcb607[_0x560b('0x3d')]=[{'all':!![]}];}_0xcb607=_[_0x560b('0x43')]({},_0xcb607,_0x5ecc81[_0x560b('0x39')]);return db[_0x560b('0x3a')][_0x560b('0x44')](_0xcb607)[_0x560b('0x11')](handleEntityNotFound(_0x19a292,null))[_0x560b('0x11')](respondWithResult(_0x19a292,null))['catch'](handleError(_0x19a292,null));};exports['update']=function(_0x5daa7e,_0x1e7d39){if(_0x5daa7e[_0x560b('0x45')]['id']){delete _0x5daa7e[_0x560b('0x45')]['id'];}return db[_0x560b('0x3a')][_0x560b('0x44')]({'where':{'id':_0x5daa7e[_0x560b('0x42')]['id']}})[_0x560b('0x11')](handleEntityNotFound(_0x1e7d39,null))[_0x560b('0x11')](saveUpdates(_0x5daa7e['body'],null))[_0x560b('0x11')](respondWithResult(_0x1e7d39,null))[_0x560b('0x40')](handleError(_0x1e7d39,null));};exports['destroy']=function(_0x52d77d,_0x32bddb){return db['MailMessage'][_0x560b('0x44')]({'where':{'id':_0x52d77d['params']['id']}})[_0x560b('0x11')](handleEntityNotFound(_0x32bddb,null))['then'](removeEntity(_0x32bddb,null))['catch'](handleError(_0x32bddb,null));};exports[_0x560b('0x46')]=function(_0x21a951,_0x1bb823){return db[_0x560b('0x3a')][_0x560b('0x46')]()[_0x560b('0x11')](respondWithResult(_0x1bb823,null))[_0x560b('0x40')](handleError(_0x1bb823,null));};exports[_0x560b('0x47')]=function(_0x68bf7d,_0x4727f9){return db[_0x560b('0x3a')]['create'](_0x68bf7d[_0x560b('0x45')])[_0x560b('0x11')](function(_0x1e6154){if(_0x1e6154){if(_0x1e6154[_0x560b('0x48')]===_0x560b('0x49')&&!_0x1e6154[_0x560b('0x4a')]){var _0x236a81,_0x5a0048,_0x3b5d3c;if(_0x68bf7d[_0x560b('0x45')]['to']){_0x5a0048=_0x68bf7d[_0x560b('0x45')]['to'][_0x560b('0x4b')](',')[0x0];}return db[_0x560b('0x4c')][_0x560b('0x4d')]({'where':{'id':_0x1e6154[_0x560b('0x4e')]},'include':[{'model':db['CmList'],'as':_0x560b('0x4f'),'include':[{'model':db['CmContact'],'as':'Contacts','where':{'email':_0x5a0048},'limit':0x1,'order':[[_0x560b('0x50'),'DESC']]}]},{'model':db[_0x560b('0x51')],'as':_0x560b('0x52'),'raw':!![],'include':[{'model':db[_0x560b('0x53')],'as':_0x560b('0x53'),'raw':!![]}]}]})[_0x560b('0x11')](function(_0x102bb5){_0x236a81=_0x102bb5;if(!_0x236a81||!_0x236a81[_0x560b('0x52')])return;var _0x4b8bc9=_0x236a81[_0x560b('0x54')]();if(_0x68bf7d[_0x560b('0x45')][_0x560b('0x55')]&&_0x68bf7d[_0x560b('0x45')][_0x560b('0x55')][_0x560b('0x30')]){for(var _0x15173c=0x0;_0x15173c<_0x68bf7d[_0x560b('0x45')][_0x560b('0x55')][_0x560b('0x30')];_0x15173c+=0x1){_0x68bf7d[_0x560b('0x45')][_0x560b('0x55')][_0x15173c]={'filename':_0x68bf7d[_0x560b('0x45')][_0x560b('0x55')][_0x15173c]['name'],'path':path[_0x560b('0x56')](config[_0x560b('0x57')],'server/files/attachments',_0x68bf7d[_0x560b('0x45')][_0x560b('0x55')][_0x15173c][_0x560b('0x58')])};}}_0x3b5d3c={'account':_0x4b8bc9,'message':_0x68bf7d[_0x560b('0x45')]};return;})[_0x560b('0x11')](function(){if(_0x236a81['List']){if(_0x236a81[_0x560b('0x4f')][_0x560b('0x59')][_0x560b('0x30')]){return _0x236a81[_0x560b('0x4f')][_0x560b('0x59')][0x0];}else{return db[_0x560b('0x5a')][_0x560b('0x47')](_[_0x560b('0x5b')](_0x68bf7d[_0x560b('0x45')],{'firstName':_0x68bf7d[_0x560b('0x45')]['to'],'email':_0x68bf7d[_0x560b('0x45')]['to'],'phone':_0x68bf7d[_0x560b('0x45')]['to'],'ListId':_0x236a81['ListId']}));}}else{throw new Error(_0x560b('0x5c'));}})[_0x560b('0x11')](function(){if(_0x3b5d3c){return respondWithRpcPromise(_0x560b('0x5d'),_0x560b('0x5e'),_0x3b5d3c,client9003)[_0x560b('0x11')](function(_0x4ddc77){return _0x1e6154['update']({'read':!![],'messageId':_0x4ddc77[_0x560b('0x5f')],'sentAt':moment()[_0x560b('0x60')]('YYYY-MM-DD\x20HH:mm:ss')});})[_0x560b('0x40')](function(_0x5222d5){logger[_0x560b('0x16')]('%s',JSON['stringify'](_0x5222d5));return _0x1e6154;});}return _0x1e6154;});}return _0x1e6154;}})['then'](respondWithResult(_0x4727f9,0xc9))[_0x560b('0x40')](handleError(_0x4727f9,null));};exports[_0x560b('0x61')]=function(_0x43df6c,_0x5d36f0){var _0x135acc={'agent':{},'channel':'mail'};if(_0x43df6c[_0x560b('0x45')]['id']){delete _0x43df6c[_0x560b('0x45')]['id'];}_0x43df6c['body'][_0x560b('0x62')]=!![];_0x43df6c['body']['readAt']=moment()[_0x560b('0x60')](_0x560b('0x63'));_0x43df6c[_0x560b('0x45')][_0x560b('0x64')]=_0x43df6c[_0x560b('0x45')][_0x560b('0x64')]||_0x43df6c['user']['id'];_0x135acc[_0x560b('0x65')]['id']=_0x43df6c[_0x560b('0x45')]['UserId'];return db[_0x560b('0x3a')][_0x560b('0x44')]({'where':{'id':_0x43df6c[_0x560b('0x42')]['id'],'UserId':null}})[_0x560b('0x11')](handleEntityNotFound(_0x5d36f0,null))['then'](saveUpdates(_0x43df6c['body'],null))[_0x560b('0x11')](function(_0x596eb8){if(_0x596eb8){_0x135acc[_0x560b('0x19')]=_0x596eb8[_0x560b('0x66')]({'plain':!![]});return db[_0x560b('0x67')][_0x560b('0x44')]({'where':{'id':_0x596eb8[_0x560b('0x68')]}});}return null;})['then'](handleEntityNotFound(_0x5d36f0,null))['then'](function(_0x1cc319){if(_0x1cc319){return _0x1cc319[_0x560b('0x1f')]({'UserId':_0x43df6c[_0x560b('0x45')]['UserId'],'read1stAt':_[_0x560b('0x69')](_0x1cc319[_0x560b('0x6a')])?moment()[_0x560b('0x60')](_0x560b('0x63')):undefined});}return null;})['then'](function(_0x35d0ef){if(_0x35d0ef){_0x135acc['interaction']=_0x35d0ef[_0x560b('0x66')]({'plain':!![]});interaction_log[_0x560b('0x12')]('[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x43df6c[_0x560b('0x6b')]['id'],_0x43df6c['user']['name'],_0x43df6c['user'][_0x560b('0x6c')],_0x135acc[_0x560b('0x6d')]['id'],_0x43df6c[_0x560b('0x45')]?JSON[_0x560b('0x6e')](_0x43df6c['body']):_0x560b('0x6f'));return respondWithRpcPromise('AcceptMessage','acceptMessage',_0x135acc);}return null;})[_0x560b('0x11')](function(_0x5f2b58){var _0x3ac6af='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x5f2b58[_0x560b('0x19')]['ContactId'];return db['sequelize'][_0x560b('0x2a')](_0x3ac6af,{'type':db[_0x560b('0x70')][_0x560b('0x71')][_0x560b('0x72')],'raw':!![]})['then'](function(_0x42f5de){return _0x42f5de;});})[_0x560b('0x11')](function(_0x27dd8b){if(_0x27dd8b){_0x135acc[_0x560b('0x19')][_0x560b('0x73')]=_0x27dd8b[0x0];if(!_0x43df6c[_0x560b('0x45')][_0x560b('0x64')])return;return db['User'][_0x560b('0x44')]({'where':{'id':_0x43df6c[_0x560b('0x45')][_0x560b('0x64')],'role':'agent'},'attributes':['id','name','fullname','email',_0x560b('0x74')],'raw':!![]});}return null;})[_0x560b('0x11')](function(_0xc2da9d){if(!_0xc2da9d)return null;_0x135acc[_0x560b('0x19')][_0x560b('0x65')]=_0xc2da9d;return _0x135acc;})[_0x560b('0x11')](function(_0x557de3){if(_0x557de3){if(_0x43df6c[_0x560b('0x45')][_0x560b('0x75')]){_0x135acc[_0x560b('0x19')][_0x560b('0x76')]=util[_0x560b('0x60')](_0x560b('0x77'),_0x43df6c[_0x560b('0x6b')][_0x560b('0x37')]);_0x135acc[_0x560b('0x19')][_0x560b('0x78')]=_0x135acc['channel'];_0x135acc['message'][_0x560b('0x79')]=_0x135acc[_0x560b('0x78')];_0x135acc[_0x560b('0x19')]['event']='accept';_0x135acc[_0x560b('0x19')][_0x560b('0x45')]=htmlToText['fromString'](_0x135acc[_0x560b('0x19')][_0x560b('0x45')]);return respondWithRpcPromise('EventManager','EventManager',{'event':_0x560b('0x7a'),'message':_0x135acc[_0x560b('0x19')]},client9002)[_0x560b('0x11')](function(){return _0x135acc;});}return _0x135acc;}return null;})[_0x560b('0x11')](respondWithResult(_0x5d36f0,null))[_0x560b('0x40')](handleError(_0x5d36f0,null));};exports[_0x560b('0x7b')]=function(_0x1d322d,_0x5cc680){var _0x4326c4={'agent':{},'channel':_0x560b('0x7c')};if(_0x1d322d[_0x560b('0x45')]['id']){delete _0x1d322d[_0x560b('0x45')]['id'];}_0x1d322d[_0x560b('0x45')][_0x560b('0x64')]=_0x1d322d[_0x560b('0x45')][_0x560b('0x64')]||_0x1d322d[_0x560b('0x6b')]['id'];_0x4326c4['agent']['id']=_0x1d322d[_0x560b('0x45')][_0x560b('0x64')];return db['MailMessage']['find']({'where':{'id':_0x1d322d[_0x560b('0x42')]['id'],'UserId':null}})[_0x560b('0x11')](handleEntityNotFound(_0x5cc680,null))[_0x560b('0x11')](function(_0x538b50){if(_0x538b50){_0x4326c4['message']=_0x538b50[_0x560b('0x66')]({'plain':!![]});return db['MailInteraction']['find']({'where':{'id':_0x538b50[_0x560b('0x68')]}});}return null;})[_0x560b('0x11')](handleEntityNotFound(_0x5cc680,null))[_0x560b('0x11')](function(_0x38df0b){if(_0x38df0b){_0x4326c4[_0x560b('0x6d')]=_0x38df0b[_0x560b('0x66')]({'plain':!![]});interaction_log['info'](_0x560b('0x7d'),_0x1d322d[_0x560b('0x6b')]['id'],_0x1d322d[_0x560b('0x6b')]['name'],_0x1d322d[_0x560b('0x6b')][_0x560b('0x6c')],_0x4326c4[_0x560b('0x6d')]['id'],_0x1d322d[_0x560b('0x45')]?JSON[_0x560b('0x6e')](_0x1d322d['body']):_0x560b('0x6f'));return respondWithRpcPromise('RejectMessage',_0x560b('0x7e'),_0x4326c4);}return null;})[_0x560b('0x11')](function(_0x2f659c){var _0x163588=_0x560b('0x7f')+_0x2f659c['message'][_0x560b('0x80')];return db[_0x560b('0x81')][_0x560b('0x2a')](_0x163588,{'type':db[_0x560b('0x70')]['QueryTypes'][_0x560b('0x72')],'raw':!![]})[_0x560b('0x11')](function(_0x16419a){return _0x16419a;});})[_0x560b('0x11')](function(_0x494e33){if(_0x494e33){_0x4326c4[_0x560b('0x19')][_0x560b('0x73')]=_0x494e33[0x0];if(!_0x1d322d['body'][_0x560b('0x64')])return;return db[_0x560b('0x82')][_0x560b('0x44')]({'where':{'id':_0x1d322d[_0x560b('0x45')]['UserId'],'role':_0x560b('0x65')},'attributes':['id',_0x560b('0x37'),_0x560b('0x83'),_0x560b('0x84'),_0x560b('0x74')],'raw':!![]});}return null;})[_0x560b('0x11')](function(_0x3084f0){if(!_0x3084f0)return null;_0x4326c4['message']['agent']=_0x3084f0;return _0x4326c4;})[_0x560b('0x11')](function(_0x17a1e2){if(_0x17a1e2){_0x17a1e2['message'][_0x560b('0x76')]=util[_0x560b('0x60')](_0x560b('0x77'),_0x1d322d[_0x560b('0x6b')]['name']);_0x17a1e2['message'][_0x560b('0x78')]=_0x4326c4[_0x560b('0x78')];_0x17a1e2[_0x560b('0x19')]['motionChannel']=_0x4326c4[_0x560b('0x78')];_0x17a1e2[_0x560b('0x19')][_0x560b('0x85')]=_0x560b('0x7b');_0x17a1e2[_0x560b('0x19')][_0x560b('0x45')]=htmlToText[_0x560b('0x86')](_0x4326c4['message']['body']);respondWithRpcPromise(_0x560b('0x87'),_0x560b('0x87'),{'event':_0x560b('0x88'),'message':_0x17a1e2[_0x560b('0x19')]},client9002);return _0x4326c4;}return null;})[_0x560b('0x11')](respondWithResult(_0x5cc680,null))[_0x560b('0x40')](handleError(_0x5cc680,null));};exports['download']=function(_0x5d58e1,_0x45c626){var _0x7a59ea=moment()[_0x560b('0x89')]()[_0x560b('0x8a')]();var _0x1dd1ab=path[_0x560b('0x56')](config[_0x560b('0x57')],_0x560b('0x8b'),_0x560b('0x8c'),_0x560b('0x8d'));var _0x2d2bba=path[_0x560b('0x56')](config[_0x560b('0x57')],_0x560b('0x8b'),_0x560b('0x8c'),_0x560b('0x55'));var _0x35c2a5=util['format'](_0x560b('0x8e'),_0x7a59ea);return db[_0x560b('0x3a')]['find']({'where':{'id':_0x5d58e1[_0x560b('0x42')]['id']},'attributes':['id',_0x560b('0x45'),_0x560b('0x8f'),'to','cc',_0x560b('0x90'),_0x560b('0x91'),_0x560b('0x92')],'include':_0x5d58e1[_0x560b('0x2a')][_0x560b('0x55')]?[{'model':db[_0x560b('0x93')],'as':_0x560b('0x94')}]:undefined})[_0x560b('0x11')](handleEntityNotFound(_0x45c626,null))[_0x560b('0x11')](function(_0x7cfdce){if(_0x7cfdce){var _0x5daa46=_0x7cfdce;var _0x424641={'from':_0x5daa46[_0x560b('0x8f')],'to':_0x5daa46['to'],'subject':_0x5daa46[_0x560b('0x91')],'html':htmlEntities['decode'](_0x5daa46[_0x560b('0x45')]),'headers':{'Date':moment(_0x5daa46[_0x560b('0x92')])[_0x560b('0x60')]('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x7cfdce['cc']){_0x424641[_0x560b('0x95')]['Cc']=_0x7cfdce['cc'];}if(_0x7cfdce['bcc']){_0x424641['headers'][_0x560b('0x96')]=_0x7cfdce[_0x560b('0x90')];}return new BPromise(function(_0x18021e,_0x2d7895){if(_0x7cfdce[_0x560b('0x94')]){for(var _0x361b44=0x0;_0x361b44<_0x7cfdce[_0x560b('0x94')]['length'];_0x361b44++){var _0x586754=_0x7cfdce['Attachments'][_0x361b44];var _0x5e8db2=path[_0x560b('0x56')](_0x2d2bba,_0x586754[_0x560b('0x58')]);if(fs[_0x560b('0x97')](_0x5e8db2)){_0x424641[_0x560b('0x55')][_0x560b('0x98')]({'name':_0x586754[_0x560b('0x37')],'contentType':_0x586754[_0x560b('0x27')],'data':fs[_0x560b('0x99')](_0x5e8db2)});}}}emlformat['build'](_0x424641,function(_0x18226f,_0x1013b3){if(_0x18226f)return _0x2d7895(_0x18226f);fs[_0x560b('0x9a')](path[_0x560b('0x56')](_0x1dd1ab,_0x35c2a5),_0x1013b3);return _0x18021e(_0x1013b3);});});}})[_0x560b('0x11')](function(_0x4c9fa4){if(_0x4c9fa4){return _0x45c626['download'](path[_0x560b('0x56')](_0x1dd1ab,_0x35c2a5),_0x35c2a5,function(_0x2bce37){if(!_0x2bce37)fs[_0x560b('0x9b')](path[_0x560b('0x56')](_0x1dd1ab,_0x35c2a5));});}})['catch'](handleError(_0x45c626,null));}; \ No newline at end of file +var _0x4f09=['body','find','destroy','describe','create','direction','out','secret','split','MailAccount','findOne','MailAccountId','CmList','List','CmContact','Contacts','MailServerOut','Smtp','CloudProvider','getSmtpOptions','attachments','root','server/files/attachments','basename','List\x20not\x20found','SendMail','sendMail','messageId','format','YYYY-MM-DD\x20HH:mm:ss','read','UserId','user','agent','MailInteraction','MailInteractionId','isNil','read1stAt','interaction','get','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','QueryTypes','contact','User','internal','interface','SIP/%s','channel','motionChannel','accept','fromString','EventManager','acceptmessage','reject','mail','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','email','download','toString','files','join','server','from','bcc','Attachment','decode','createdAt','headers','Attachments','existsSync','push','readFileSync','unlinkSync','moment','bluebird','util','path','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','defaults','localhost','socket.io-emitter','redis','html-entities','./mailMessage.socket','jayson/promise','client','http','request','info','debug','MailMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','MailMessage,\x20%s,\x20%s','message','result','catch','status','offset','undefined','count','limit','Content-Range','json','then','sendStatus','name','send','map','MailMessage','rawAttributes','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','includeAll','include','rows','show','params','keys','update'];(function(_0x484e36,_0x4482d8){var _0xafc85d=function(_0xaba9c8){while(--_0xaba9c8){_0x484e36['push'](_0x484e36['shift']());}};_0xafc85d(++_0x4482d8);}(_0x4f09,0x175));var _0x94f0=function(_0x23e3eb,_0x419ae8){_0x23e3eb=_0x23e3eb-0x0;var _0x1c9ab6=_0x4f09[_0x23e3eb];return _0x1c9ab6;};'use strict';var emlformat=require('eml-format');var moment=require(_0x94f0('0x0'));var BPromise=require(_0x94f0('0x1'));var util=require(_0x94f0('0x2'));var path=require(_0x94f0('0x3'));var fs=require('fs');var _=require(_0x94f0('0x4'));var Redis=require(_0x94f0('0x5'));var htmlToText=require('html-to-text');var qs=require(_0x94f0('0x6'));var logger=require(_0x94f0('0x7'))(_0x94f0('0x8'));var interaction_log=require(_0x94f0('0x7'))('mail-interactions');var config=require(_0x94f0('0x9'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x94f0('0xa')](config['redis'],{'host':_0x94f0('0xb'),'port':0x18eb});var socket=require(_0x94f0('0xc'))(new Redis(config[_0x94f0('0xd')]));var htmlEntities=require(_0x94f0('0xe'));require(_0x94f0('0xf'))['register'](socket);var jayson=require(_0x94f0('0x10'));var client=jayson[_0x94f0('0x11')][_0x94f0('0x12')]({'port':0x232c});var client9003=jayson[_0x94f0('0x11')]['http']({'port':0x232b});var client9002=jayson[_0x94f0('0x11')][_0x94f0('0x12')]({'port':0x232a});function respondWithRpcPromise(_0x210cf0,_0x5137b6,_0x3ac01d,_0x1da15e){return new BPromise(function(_0x2842c5,_0x1b2c2d){var _0x532d88=_0x1da15e||client;return _0x532d88[_0x94f0('0x13')](_0x210cf0,_0x3ac01d)['then'](function(_0x4d0c59){logger[_0x94f0('0x14')]('MailMessage,\x20%s,\x20%s',_0x5137b6,'request\x20sent');logger[_0x94f0('0x15')](_0x94f0('0x16'),_0x5137b6,_0x94f0('0x17'),JSON[_0x94f0('0x18')](_0x4d0c59));if(_0x4d0c59[_0x94f0('0x19')]){if(_0x4d0c59['error'][_0x94f0('0x1a')]===0x1f4){logger[_0x94f0('0x19')](_0x94f0('0x1b'),_0x5137b6,_0x4d0c59[_0x94f0('0x19')][_0x94f0('0x1c')]);return _0x1b2c2d(_0x4d0c59[_0x94f0('0x19')][_0x94f0('0x1c')]);}logger[_0x94f0('0x19')](_0x94f0('0x1b'),_0x5137b6,_0x4d0c59[_0x94f0('0x19')]['message']);return _0x2842c5(_0x4d0c59[_0x94f0('0x19')]['message']);}else{logger[_0x94f0('0x14')]('MailMessage,\x20%s,\x20%s',_0x5137b6,'request\x20sent');_0x2842c5(_0x4d0c59[_0x94f0('0x1d')][_0x94f0('0x1c')]);}})[_0x94f0('0x1e')](function(_0x4357e9){logger[_0x94f0('0x19')](_0x94f0('0x1b'),_0x5137b6,_0x4357e9);_0x1b2c2d(_0x4357e9);});});}function respondWithResult(_0x46931e,_0x17e3d3){_0x17e3d3=_0x17e3d3||0xc8;return function(_0x3e8d44){if(_0x3e8d44){return _0x46931e[_0x94f0('0x1f')](_0x17e3d3)['json'](_0x3e8d44);}};}function respondWithFilteredResult(_0x3d6339,_0x1004a7){return function(_0x6d7875){if(_0x6d7875){var _0x2bcd5b=typeof _0x1004a7[_0x94f0('0x20')]===_0x94f0('0x21')&&typeof _0x1004a7['limit']===_0x94f0('0x21');var _0x330bcd=_0x6d7875[_0x94f0('0x22')];var _0x53fb90=_0x2bcd5b?0x0:_0x1004a7[_0x94f0('0x20')];var _0x4cd201=_0x2bcd5b?_0x6d7875[_0x94f0('0x22')]:_0x1004a7[_0x94f0('0x20')]+_0x1004a7[_0x94f0('0x23')];var _0x576968;if(_0x4cd201>=_0x330bcd){_0x4cd201=_0x330bcd;_0x576968=0xc8;}else{_0x576968=0xce;}_0x3d6339[_0x94f0('0x1f')](_0x576968);return _0x3d6339['set'](_0x94f0('0x24'),_0x53fb90+'-'+_0x4cd201+'/'+_0x330bcd)[_0x94f0('0x25')](_0x6d7875);}return null;};}function saveUpdates(_0x4e38e3){return function(_0x4d0bde){if(_0x4d0bde){return _0x4d0bde['update'](_0x4e38e3)[_0x94f0('0x26')](function(_0x2a7fa4){return _0x2a7fa4;});}return null;};}function removeEntity(_0x468d36){return function(_0xaa1861){if(_0xaa1861){return _0xaa1861['destroy']()[_0x94f0('0x26')](function(){_0x468d36['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4699a6){return function(_0x3146c6){if(!_0x3146c6){_0x4699a6[_0x94f0('0x27')](0x194);}return _0x3146c6;};}function handleError(_0x54e58c,_0x12f4ec){_0x12f4ec=_0x12f4ec||0x1f4;return function(_0x4fbaee){logger[_0x94f0('0x19')](_0x4fbaee['stack']);if(_0x4fbaee[_0x94f0('0x28')]){delete _0x4fbaee[_0x94f0('0x28')];}_0x54e58c['status'](_0x12f4ec)[_0x94f0('0x29')](_0x4fbaee);};}exports['index']=function(_0x280839,_0x48b5ec){var _0x4c5513={},_0x5d8c63={},_0xfd1c19={'count':0x0,'rows':[]};var _0x55b211=_[_0x94f0('0x2a')](db[_0x94f0('0x2b')][_0x94f0('0x2c')],function(_0x122b05){return{'name':_0x122b05['fieldName'],'type':_0x122b05[_0x94f0('0x2d')]['key']};});_0x5d8c63[_0x94f0('0x2e')]=_[_0x94f0('0x2a')](_0x55b211,_0x94f0('0x28'));_0x5d8c63[_0x94f0('0x2f')]=_['keys'](_0x280839[_0x94f0('0x2f')]);_0x5d8c63[_0x94f0('0x30')]=_[_0x94f0('0x31')](_0x5d8c63['model'],_0x5d8c63['query']);_0x4c5513[_0x94f0('0x32')]=_['intersection'](_0x5d8c63['model'],qs[_0x94f0('0x33')](_0x280839[_0x94f0('0x2f')][_0x94f0('0x33')]));_0x4c5513[_0x94f0('0x32')]=_0x4c5513[_0x94f0('0x32')][_0x94f0('0x34')]?_0x4c5513['attributes']:_0x5d8c63[_0x94f0('0x2e')];if(!_0x280839[_0x94f0('0x2f')][_0x94f0('0x35')](_0x94f0('0x36'))){_0x4c5513['limit']=qs[_0x94f0('0x23')](_0x280839[_0x94f0('0x2f')][_0x94f0('0x23')]);_0x4c5513[_0x94f0('0x20')]=qs[_0x94f0('0x20')](_0x280839[_0x94f0('0x2f')]['offset']);}_0x4c5513['order']=qs[_0x94f0('0x37')](_0x280839['query']['sort']);_0x4c5513[_0x94f0('0x38')]=qs[_0x94f0('0x30')](_[_0x94f0('0x39')](_0x280839[_0x94f0('0x2f')],_0x5d8c63[_0x94f0('0x30')]),_0x55b211);if(_0x280839['query'][_0x94f0('0x3a')]){_0x4c5513[_0x94f0('0x38')]=_[_0x94f0('0x3b')](_0x4c5513['where'],{'$or':_[_0x94f0('0x2a')](_0x55b211,function(_0x457554){if(_0x457554[_0x94f0('0x2d')]!=='VIRTUAL'){var _0x549b46={};_0x549b46[_0x457554['name']]={'$like':'%'+_0x280839[_0x94f0('0x2f')]['filter']+'%'};return _0x549b46;}})});}_0x4c5513=_[_0x94f0('0x3b')]({},_0x4c5513,_0x280839[_0x94f0('0x3c')]);var _0x364afa={'where':_0x4c5513[_0x94f0('0x38')]};return db['MailMessage'][_0x94f0('0x22')](_0x364afa)[_0x94f0('0x26')](function(_0x4cc399){_0xfd1c19[_0x94f0('0x22')]=_0x4cc399;if(_0x280839['query'][_0x94f0('0x3d')]){_0x4c5513[_0x94f0('0x3e')]=[{'all':!![]}];}return db[_0x94f0('0x2b')]['findAll'](_0x4c5513);})[_0x94f0('0x26')](function(_0x28e1ab){_0xfd1c19[_0x94f0('0x3f')]=_0x28e1ab;return _0xfd1c19;})['then'](respondWithFilteredResult(_0x48b5ec,_0x4c5513))[_0x94f0('0x1e')](handleError(_0x48b5ec,null));};exports[_0x94f0('0x40')]=function(_0x1011cd,_0xf10c6a){var _0x3f040e={'raw':!![],'where':{'id':_0x1011cd[_0x94f0('0x41')]['id']}},_0x235f88={};_0x235f88[_0x94f0('0x2e')]=_['keys'](db['MailMessage'][_0x94f0('0x2c')]);_0x235f88[_0x94f0('0x2f')]=_[_0x94f0('0x42')](_0x1011cd['query']);_0x235f88[_0x94f0('0x30')]=_['intersection'](_0x235f88['model'],_0x235f88['query']);_0x3f040e[_0x94f0('0x32')]=_[_0x94f0('0x31')](_0x235f88[_0x94f0('0x2e')],qs['fields'](_0x1011cd[_0x94f0('0x2f')][_0x94f0('0x33')]));_0x3f040e[_0x94f0('0x32')]=_0x3f040e[_0x94f0('0x32')]['length']?_0x3f040e[_0x94f0('0x32')]:_0x235f88['model'];if(_0x1011cd[_0x94f0('0x2f')][_0x94f0('0x3d')]){_0x3f040e[_0x94f0('0x3e')]=[{'all':!![]}];}_0x3f040e=_[_0x94f0('0x3b')]({},_0x3f040e,_0x1011cd[_0x94f0('0x3c')]);return db['MailMessage']['find'](_0x3f040e)[_0x94f0('0x26')](handleEntityNotFound(_0xf10c6a,null))[_0x94f0('0x26')](respondWithResult(_0xf10c6a,null))[_0x94f0('0x1e')](handleError(_0xf10c6a,null));};exports[_0x94f0('0x43')]=function(_0x281155,_0x25aa64){if(_0x281155[_0x94f0('0x44')]['id']){delete _0x281155['body']['id'];}return db[_0x94f0('0x2b')][_0x94f0('0x45')]({'where':{'id':_0x281155[_0x94f0('0x41')]['id']}})[_0x94f0('0x26')](handleEntityNotFound(_0x25aa64,null))[_0x94f0('0x26')](saveUpdates(_0x281155[_0x94f0('0x44')],null))['then'](respondWithResult(_0x25aa64,null))[_0x94f0('0x1e')](handleError(_0x25aa64,null));};exports[_0x94f0('0x46')]=function(_0x10a223,_0x5f1f3a){return db[_0x94f0('0x2b')][_0x94f0('0x45')]({'where':{'id':_0x10a223[_0x94f0('0x41')]['id']}})[_0x94f0('0x26')](handleEntityNotFound(_0x5f1f3a,null))[_0x94f0('0x26')](removeEntity(_0x5f1f3a,null))['catch'](handleError(_0x5f1f3a,null));};exports[_0x94f0('0x47')]=function(_0x5c3e9b,_0x29a11e){return db[_0x94f0('0x2b')][_0x94f0('0x47')]()[_0x94f0('0x26')](respondWithResult(_0x29a11e,null))[_0x94f0('0x1e')](handleError(_0x29a11e,null));};exports[_0x94f0('0x48')]=function(_0x545211,_0x527372){return db['MailMessage'][_0x94f0('0x48')](_0x545211['body'])[_0x94f0('0x26')](function(_0x49ddeb){if(_0x49ddeb){if(_0x49ddeb[_0x94f0('0x49')]===_0x94f0('0x4a')&&!_0x49ddeb[_0x94f0('0x4b')]){var _0x32a700,_0x11aea1,_0x2b3b9d;if(_0x545211[_0x94f0('0x44')]['to']){_0x11aea1=_0x545211[_0x94f0('0x44')]['to'][_0x94f0('0x4c')](',')[0x0];}return db[_0x94f0('0x4d')][_0x94f0('0x4e')]({'where':{'id':_0x49ddeb[_0x94f0('0x4f')]},'include':[{'model':db[_0x94f0('0x50')],'as':_0x94f0('0x51'),'include':[{'model':db[_0x94f0('0x52')],'as':_0x94f0('0x53'),'where':{'email':_0x11aea1},'limit':0x1,'order':[['updatedAt','DESC']]}]},{'model':db[_0x94f0('0x54')],'as':_0x94f0('0x55'),'raw':!![],'include':[{'model':db[_0x94f0('0x56')],'as':_0x94f0('0x56'),'raw':!![]}]}]})['then'](function(_0x3f136d){_0x32a700=_0x3f136d;if(!_0x32a700||!_0x32a700[_0x94f0('0x55')])return;var _0x2ce0c9=_0x32a700[_0x94f0('0x57')]();if(_0x545211[_0x94f0('0x44')][_0x94f0('0x58')]&&_0x545211[_0x94f0('0x44')][_0x94f0('0x58')][_0x94f0('0x34')]){for(var _0xd48fe7=0x0;_0xd48fe7<_0x545211[_0x94f0('0x44')][_0x94f0('0x58')]['length'];_0xd48fe7+=0x1){_0x545211[_0x94f0('0x44')][_0x94f0('0x58')][_0xd48fe7]={'filename':_0x545211[_0x94f0('0x44')][_0x94f0('0x58')][_0xd48fe7]['name'],'path':path['join'](config[_0x94f0('0x59')],_0x94f0('0x5a'),_0x545211['body'][_0x94f0('0x58')][_0xd48fe7][_0x94f0('0x5b')])};}}_0x2b3b9d={'account':_0x2ce0c9,'message':_0x545211[_0x94f0('0x44')]};return;})[_0x94f0('0x26')](function(){if(_0x32a700[_0x94f0('0x51')]){if(_0x32a700[_0x94f0('0x51')][_0x94f0('0x53')]['length']){return _0x32a700[_0x94f0('0x51')]['Contacts'][0x0];}else{return db[_0x94f0('0x52')][_0x94f0('0x48')](_[_0x94f0('0xa')](_0x545211['body'],{'firstName':_0x545211[_0x94f0('0x44')]['to'],'email':_0x545211['body']['to'],'phone':_0x545211[_0x94f0('0x44')]['to'],'ListId':_0x32a700['ListId']}));}}else{throw new Error(_0x94f0('0x5c'));}})[_0x94f0('0x26')](function(){if(_0x2b3b9d){return respondWithRpcPromise(_0x94f0('0x5d'),_0x94f0('0x5e'),_0x2b3b9d,client9003)[_0x94f0('0x26')](function(_0x2332f5){return _0x49ddeb[_0x94f0('0x43')]({'read':!![],'messageId':_0x2332f5[_0x94f0('0x5f')],'sentAt':moment()[_0x94f0('0x60')](_0x94f0('0x61'))});})[_0x94f0('0x1e')](function(_0xd0d3b9){logger[_0x94f0('0x19')]('%s',JSON[_0x94f0('0x18')](_0xd0d3b9));return _0x49ddeb;});}return _0x49ddeb;});}return _0x49ddeb;}})[_0x94f0('0x26')](respondWithResult(_0x527372,0xc9))['catch'](handleError(_0x527372,null));};exports['accept']=function(_0x1564b7,_0x43e146){var _0x5f4b81={'agent':{},'channel':'mail'};if(_0x1564b7[_0x94f0('0x44')]['id']){delete _0x1564b7[_0x94f0('0x44')]['id'];}_0x1564b7[_0x94f0('0x44')][_0x94f0('0x62')]=!![];_0x1564b7[_0x94f0('0x44')]['readAt']=moment()[_0x94f0('0x60')](_0x94f0('0x61'));_0x1564b7[_0x94f0('0x44')][_0x94f0('0x63')]=_0x1564b7[_0x94f0('0x44')][_0x94f0('0x63')]||_0x1564b7[_0x94f0('0x64')]['id'];_0x5f4b81[_0x94f0('0x65')]['id']=_0x1564b7[_0x94f0('0x44')][_0x94f0('0x63')];return db[_0x94f0('0x2b')][_0x94f0('0x45')]({'where':{'id':_0x1564b7[_0x94f0('0x41')]['id'],'UserId':null}})[_0x94f0('0x26')](handleEntityNotFound(_0x43e146,null))['then'](saveUpdates(_0x1564b7['body'],null))[_0x94f0('0x26')](function(_0x309af5){if(_0x309af5){_0x5f4b81[_0x94f0('0x1c')]=_0x309af5['get']({'plain':!![]});return db[_0x94f0('0x66')][_0x94f0('0x45')]({'where':{'id':_0x309af5[_0x94f0('0x67')]}});}return null;})[_0x94f0('0x26')](handleEntityNotFound(_0x43e146,null))['then'](function(_0x27094e){if(_0x27094e){return _0x27094e['update']({'UserId':_0x1564b7[_0x94f0('0x44')][_0x94f0('0x63')],'read1stAt':_[_0x94f0('0x68')](_0x27094e[_0x94f0('0x69')])?moment()[_0x94f0('0x60')](_0x94f0('0x61')):undefined});}return null;})['then'](function(_0x694a93){if(_0x694a93){_0x5f4b81[_0x94f0('0x6a')]=_0x694a93[_0x94f0('0x6b')]({'plain':!![]});interaction_log['info'](_0x94f0('0x6c'),_0x1564b7[_0x94f0('0x64')]['id'],_0x1564b7[_0x94f0('0x64')]['name'],_0x1564b7['user'][_0x94f0('0x6d')],_0x5f4b81[_0x94f0('0x6a')]['id'],_0x1564b7[_0x94f0('0x44')]?JSON[_0x94f0('0x18')](_0x1564b7[_0x94f0('0x44')]):'null');return respondWithRpcPromise(_0x94f0('0x6e'),_0x94f0('0x6f'),_0x5f4b81);}return null;})['then'](function(_0x1dc784){var _0x294bcf=_0x94f0('0x70')+_0x1dc784[_0x94f0('0x1c')]['ContactId'];return db[_0x94f0('0x71')][_0x94f0('0x2f')](_0x294bcf,{'type':db['Sequelize'][_0x94f0('0x72')]['SELECT'],'raw':!![]})[_0x94f0('0x26')](function(_0x420ccf){return _0x420ccf;});})[_0x94f0('0x26')](function(_0x5bcb5d){if(_0x5bcb5d){_0x5f4b81[_0x94f0('0x1c')][_0x94f0('0x73')]=_0x5bcb5d[0x0];if(!_0x1564b7[_0x94f0('0x44')][_0x94f0('0x63')])return;return db[_0x94f0('0x74')][_0x94f0('0x45')]({'where':{'id':_0x1564b7[_0x94f0('0x44')][_0x94f0('0x63')],'role':_0x94f0('0x65')},'attributes':['id',_0x94f0('0x28'),'fullname','email',_0x94f0('0x75')],'raw':!![]});}return null;})['then'](function(_0x5aefde){if(!_0x5aefde)return null;_0x5f4b81[_0x94f0('0x1c')][_0x94f0('0x65')]=_0x5aefde;return _0x5f4b81;})[_0x94f0('0x26')](function(_0x4aaaed){if(_0x4aaaed){if(_0x1564b7[_0x94f0('0x44')]['manual']){_0x5f4b81[_0x94f0('0x1c')][_0x94f0('0x76')]=util[_0x94f0('0x60')](_0x94f0('0x77'),_0x1564b7['user'][_0x94f0('0x28')]);_0x5f4b81['message']['channel']=_0x5f4b81[_0x94f0('0x78')];_0x5f4b81[_0x94f0('0x1c')][_0x94f0('0x79')]=_0x5f4b81[_0x94f0('0x78')];_0x5f4b81['message']['event']=_0x94f0('0x7a');_0x5f4b81[_0x94f0('0x1c')][_0x94f0('0x44')]=htmlToText[_0x94f0('0x7b')](_0x5f4b81[_0x94f0('0x1c')][_0x94f0('0x44')]);return respondWithRpcPromise(_0x94f0('0x7c'),_0x94f0('0x7c'),{'event':_0x94f0('0x7d'),'message':_0x5f4b81[_0x94f0('0x1c')]},client9002)['then'](function(){return _0x5f4b81;});}return _0x5f4b81;}return null;})[_0x94f0('0x26')](respondWithResult(_0x43e146,null))[_0x94f0('0x1e')](handleError(_0x43e146,null));};exports[_0x94f0('0x7e')]=function(_0x24c8ae,_0x36dc36){var _0xd927a3={'agent':{},'channel':_0x94f0('0x7f')};if(_0x24c8ae['body']['id']){delete _0x24c8ae[_0x94f0('0x44')]['id'];}_0x24c8ae[_0x94f0('0x44')][_0x94f0('0x63')]=_0x24c8ae[_0x94f0('0x44')][_0x94f0('0x63')]||_0x24c8ae[_0x94f0('0x64')]['id'];_0xd927a3['agent']['id']=_0x24c8ae[_0x94f0('0x44')][_0x94f0('0x63')];return db[_0x94f0('0x2b')]['find']({'where':{'id':_0x24c8ae[_0x94f0('0x41')]['id'],'UserId':null}})[_0x94f0('0x26')](handleEntityNotFound(_0x36dc36,null))[_0x94f0('0x26')](function(_0x128255){if(_0x128255){_0xd927a3['message']=_0x128255['get']({'plain':!![]});return db[_0x94f0('0x66')][_0x94f0('0x45')]({'where':{'id':_0x128255[_0x94f0('0x67')]}});}return null;})[_0x94f0('0x26')](handleEntityNotFound(_0x36dc36,null))[_0x94f0('0x26')](function(_0x2a53aa){if(_0x2a53aa){_0xd927a3[_0x94f0('0x6a')]=_0x2a53aa['get']({'plain':!![]});interaction_log[_0x94f0('0x14')](_0x94f0('0x80'),_0x24c8ae[_0x94f0('0x64')]['id'],_0x24c8ae[_0x94f0('0x64')][_0x94f0('0x28')],_0x24c8ae['user'][_0x94f0('0x6d')],_0xd927a3[_0x94f0('0x6a')]['id'],_0x24c8ae[_0x94f0('0x44')]?JSON['stringify'](_0x24c8ae[_0x94f0('0x44')]):'null');return respondWithRpcPromise('RejectMessage',_0x94f0('0x81'),_0xd927a3);}return null;})[_0x94f0('0x26')](function(_0x2458e0){var _0x11a157='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x2458e0[_0x94f0('0x1c')]['ContactId'];return db[_0x94f0('0x71')][_0x94f0('0x2f')](_0x11a157,{'type':db['Sequelize'][_0x94f0('0x72')]['SELECT'],'raw':!![]})['then'](function(_0x5a934c){return _0x5a934c;});})['then'](function(_0x443280){if(_0x443280){_0xd927a3[_0x94f0('0x1c')]['contact']=_0x443280[0x0];if(!_0x24c8ae['body'][_0x94f0('0x63')])return;return db['User'][_0x94f0('0x45')]({'where':{'id':_0x24c8ae['body'][_0x94f0('0x63')],'role':'agent'},'attributes':['id',_0x94f0('0x28'),'fullname',_0x94f0('0x82'),_0x94f0('0x75')],'raw':!![]});}return null;})['then'](function(_0x455a52){if(!_0x455a52)return null;_0xd927a3[_0x94f0('0x1c')][_0x94f0('0x65')]=_0x455a52;return _0xd927a3;})[_0x94f0('0x26')](function(_0x9bb6ea){if(_0x9bb6ea){_0x9bb6ea['message'][_0x94f0('0x76')]=util['format'](_0x94f0('0x77'),_0x24c8ae[_0x94f0('0x64')][_0x94f0('0x28')]);_0x9bb6ea[_0x94f0('0x1c')][_0x94f0('0x78')]=_0xd927a3[_0x94f0('0x78')];_0x9bb6ea['message'][_0x94f0('0x79')]=_0xd927a3[_0x94f0('0x78')];_0x9bb6ea[_0x94f0('0x1c')]['event']=_0x94f0('0x7e');_0x9bb6ea[_0x94f0('0x1c')][_0x94f0('0x44')]=htmlToText[_0x94f0('0x7b')](_0xd927a3['message'][_0x94f0('0x44')]);respondWithRpcPromise(_0x94f0('0x7c'),_0x94f0('0x7c'),{'event':'rejectmessage','message':_0x9bb6ea[_0x94f0('0x1c')]},client9002);return _0xd927a3;}return null;})[_0x94f0('0x26')](respondWithResult(_0x36dc36,null))['catch'](handleError(_0x36dc36,null));};exports[_0x94f0('0x83')]=function(_0x337b60,_0x3d1f9b){var _0x364c66=moment()['unix']()[_0x94f0('0x84')]();var _0x4808c9=path['join'](config[_0x94f0('0x59')],'server',_0x94f0('0x85'),'tmp');var _0x524d24=path[_0x94f0('0x86')](config['root'],_0x94f0('0x87'),'files',_0x94f0('0x58'));var _0x3f3b0e=util[_0x94f0('0x60')]('message-%s.eml',_0x364c66);return db[_0x94f0('0x2b')][_0x94f0('0x45')]({'where':{'id':_0x337b60['params']['id']},'attributes':['id','body',_0x94f0('0x88'),'to','cc',_0x94f0('0x89'),'subject','createdAt'],'include':_0x337b60[_0x94f0('0x2f')][_0x94f0('0x58')]?[{'model':db[_0x94f0('0x8a')],'as':'Attachments'}]:undefined})[_0x94f0('0x26')](handleEntityNotFound(_0x3d1f9b,null))[_0x94f0('0x26')](function(_0x486754){if(_0x486754){var _0x117810=_0x486754;var _0x29222a={'from':_0x117810[_0x94f0('0x88')],'to':_0x117810['to'],'subject':_0x117810['subject'],'html':htmlEntities[_0x94f0('0x8b')](_0x117810['body']),'headers':{'Date':moment(_0x117810[_0x94f0('0x8c')])[_0x94f0('0x60')]('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x486754['cc']){_0x29222a['headers']['Cc']=_0x486754['cc'];}if(_0x486754[_0x94f0('0x89')]){_0x29222a[_0x94f0('0x8d')]['Bcc']=_0x486754[_0x94f0('0x89')];}return new BPromise(function(_0x13727b,_0x424ba6){if(_0x486754[_0x94f0('0x8e')]){for(var _0x568557=0x0;_0x568557<_0x486754['Attachments']['length'];_0x568557++){var _0x4470a1=_0x486754[_0x94f0('0x8e')][_0x568557];var _0x631b1e=path[_0x94f0('0x86')](_0x524d24,_0x4470a1[_0x94f0('0x5b')]);if(fs[_0x94f0('0x8f')](_0x631b1e)){_0x29222a[_0x94f0('0x58')][_0x94f0('0x90')]({'name':_0x4470a1[_0x94f0('0x28')],'contentType':_0x4470a1[_0x94f0('0x2d')],'data':fs[_0x94f0('0x91')](_0x631b1e)});}}}emlformat['build'](_0x29222a,function(_0x30b46c,_0x5f4964){if(_0x30b46c)return _0x424ba6(_0x30b46c);fs['writeFileSync'](path[_0x94f0('0x86')](_0x4808c9,_0x3f3b0e),_0x5f4964);return _0x13727b(_0x5f4964);});});}})[_0x94f0('0x26')](function(_0x5130fa){if(_0x5130fa){return _0x3d1f9b['download'](path[_0x94f0('0x86')](_0x4808c9,_0x3f3b0e),_0x3f3b0e,function(_0x3a909b){if(!_0x3a909b)fs[_0x94f0('0x92')](path['join'](_0x4808c9,_0x3f3b0e));});}})['catch'](handleError(_0x3d1f9b,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index bb2ca42..8554925 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 _0xe88a=['save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','MailMessage','setMaxListeners'];(function(_0x1f2b50,_0x20b570){var _0x5675c1=function(_0x1745df){while(--_0x1745df){_0x1f2b50['push'](_0x1f2b50['shift']());}};_0x5675c1(++_0x20b570);}(_0xe88a,0x146));var _0xae88=function(_0x5b0cc1,_0x4d668d){_0x5b0cc1=_0x5b0cc1-0x0;var _0x2e379b=_0xe88a[_0x5b0cc1];return _0x2e379b;};'use strict';var EventEmitter=require(_0xae88('0x0'));var MailMessage=require(_0xae88('0x1'))['db'][_0xae88('0x2')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0xae88('0x3')](0x0);var events={'afterCreate':_0xae88('0x4'),'afterUpdate':_0xae88('0x5'),'afterDestroy':_0xae88('0x6')};function emitEvent(_0x58be3f){return function(_0x2ea811,_0x54ebd6,_0x55fabc){MailMessageEvents[_0xae88('0x7')](_0x58be3f+':'+_0x2ea811['id'],_0x2ea811);MailMessageEvents['emit'](_0x58be3f,_0x2ea811);_0x55fabc(null);};}for(var e in events){if(events[_0xae88('0x8')](e)){var event=events[e];MailMessage[_0xae88('0x9')](e,emitEvent(event));}}module[_0xae88('0xa')]=MailMessageEvents; \ No newline at end of file +var _0x2d4a=['save','update','emit','hook','exports','events','MailMessage','setMaxListeners'];(function(_0x1589dd,_0x2b9d22){var _0x1bddd1=function(_0x3687f8){while(--_0x3687f8){_0x1589dd['push'](_0x1589dd['shift']());}};_0x1bddd1(++_0x2b9d22);}(_0x2d4a,0xed));var _0xa2d4=function(_0x3a894f,_0x190892){_0x3a894f=_0x3a894f-0x0;var _0x55c214=_0x2d4a[_0x3a894f];return _0x55c214;};'use strict';var EventEmitter=require(_0xa2d4('0x0'));var MailMessage=require('../../mysqldb')['db'][_0xa2d4('0x1')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0xa2d4('0x2')](0x0);var events={'afterCreate':_0xa2d4('0x3'),'afterUpdate':_0xa2d4('0x4'),'afterDestroy':'remove'};function emitEvent(_0x25c5f2){return function(_0x34de10,_0x5ad817,_0x17cf70){MailMessageEvents[_0xa2d4('0x5')](_0x25c5f2+':'+_0x34de10['id'],_0x34de10);MailMessageEvents['emit'](_0x25c5f2,_0x34de10);_0x17cf70(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailMessage[_0xa2d4('0x6')](e,emitEvent(event));}}module[_0xa2d4('0x7')]=MailMessageEvents; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.model.js b/server/api/mailMessage/mailMessage.model.js index 1218ed8..0bc363b 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 _0x26ad=['path','rimraf','../../config/environment','exports','define','MailMessage','mail_messages','messageId','fti_mail_messages','plainBody','subject','FULLTEXT','body','models','direction','toLowerCase','out','secret','isNil','UserId','MailInteraction','findOne','MailInteractionId','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','html-to-text'];(function(_0x2b10c6,_0x185590){var _0x3789d2=function(_0x272987){while(--_0x272987){_0x2b10c6['push'](_0x2b10c6['shift']());}};_0x3789d2(++_0x185590);}(_0x26ad,0x179));var _0xd26a=function(_0x4b7d87,_0x238711){_0x4b7d87=_0x4b7d87-0x0;var _0x3b9f82=_0x26ad[_0x4b7d87];return _0x3b9f82;};'use strict';var _=require(_0xd26a('0x0'));var util=require(_0xd26a('0x1'));var logger=require(_0xd26a('0x2'))(_0xd26a('0x3'));var moment=require(_0xd26a('0x4'));var BPromise=require(_0xd26a('0x5'));var rp=require(_0xd26a('0x6'));var htmlToText=require(_0xd26a('0x7'));var fs=require('fs');var path=require(_0xd26a('0x8'));var rimraf=require(_0xd26a('0x9'));var config=require(_0xd26a('0xa'));var attributes=require('./mailMessage.attributes');module[_0xd26a('0xb')]=function(_0x35db74,_0x3b6d34){return _0x35db74[_0xd26a('0xc')](_0xd26a('0xd'),attributes,{'tableName':_0xd26a('0xe'),'paranoid':![],'indexes':[{'name':_0xd26a('0xf'),'fields':[_0xd26a('0xf')]},{'name':_0xd26a('0x10'),'fields':[_0xd26a('0x11'),_0xd26a('0x12')],'type':_0xd26a('0x13')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x1a6e28,_0x4eda42,_0x3a3058){if(_0x1a6e28[_0xd26a('0x14')]){_0x1a6e28[_0xd26a('0x11')]=htmlToText['fromString'](_0x1a6e28[_0xd26a('0x14')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x3a3058(null,_0x4eda42);},'afterCreate':function(_0x52b407,_0xf57160,_0x26dd38){var _0x49e364=_0x35db74[_0xd26a('0x15')];var _0x419059=_0x52b407['get']({'plain':!![]});if(_0x419059[_0xd26a('0x16')]['toLowerCase']()==='in'||_0x419059['direction'][_0xd26a('0x17')]()===_0xd26a('0x18')&&!_0x419059[_0xd26a('0x19')]&&!_[_0xd26a('0x1a')](_0x419059[_0xd26a('0x1b')])){_0x49e364[_0xd26a('0x1c')][_0xd26a('0x1d')]({'where':{'id':_0x419059[_0xd26a('0x1e')]}})['then'](function(_0x5c1f13){if(_0x5c1f13){_0x5c1f13['update']({'lastMsgAt':_0x419059['createdAt'],'lastMsgDirection':_0x419059[_0xd26a('0x16')][_0xd26a('0x17')]()});}})[_0xd26a('0x1f')](function(_0x93cda9){console[_0xd26a('0x20')](_0x93cda9);});}_0x26dd38();}},'charset':_0xd26a('0x21'),'collate':_0xd26a('0x22')});}; \ No newline at end of file +var _0x200f=['../../config/environment','./mailMessage.attributes','define','MailMessage','mail_messages','body','fromString','models','get','direction','toLowerCase','out','secret','isNil','UserId','MailInteraction','findOne','MailInteractionId','then','update','createdAt','catch','utf8mb4_unicode_ci','util','../../config/logger','api','bluebird','request-promise','html-to-text','path','rimraf'];(function(_0x2c7b46,_0x1aa654){var _0x4fadaa=function(_0xed97bd){while(--_0xed97bd){_0x2c7b46['push'](_0x2c7b46['shift']());}};_0x4fadaa(++_0x1aa654);}(_0x200f,0x93));var _0xf200=function(_0x122415,_0xb08425){_0x122415=_0x122415-0x0;var _0x3ac79d=_0x200f[_0x122415];return _0x3ac79d;};'use strict';var _=require('lodash');var util=require(_0xf200('0x0'));var logger=require(_0xf200('0x1'))(_0xf200('0x2'));var moment=require('moment');var BPromise=require(_0xf200('0x3'));var rp=require(_0xf200('0x4'));var htmlToText=require(_0xf200('0x5'));var fs=require('fs');var path=require(_0xf200('0x6'));var rimraf=require(_0xf200('0x7'));var config=require(_0xf200('0x8'));var attributes=require(_0xf200('0x9'));module['exports']=function(_0x4c3796,_0xafaf72){return _0x4c3796[_0xf200('0xa')](_0xf200('0xb'),attributes,{'tableName':_0xf200('0xc'),'paranoid':![],'indexes':[{'name':'messageId','fields':['messageId']},{'name':'fti_mail_messages','fields':['plainBody','subject'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x4bd0b3,_0x12c862,_0x544a35){if(_0x4bd0b3[_0xf200('0xd')]){_0x4bd0b3['plainBody']=htmlToText[_0xf200('0xe')](_0x4bd0b3['body'],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x544a35(null,_0x12c862);},'afterCreate':function(_0x295ccd,_0x1df989,_0x398615){var _0x5d4118=_0x4c3796[_0xf200('0xf')];var _0x1461d5=_0x295ccd[_0xf200('0x10')]({'plain':!![]});if(_0x1461d5[_0xf200('0x11')]['toLowerCase']()==='in'||_0x1461d5[_0xf200('0x11')][_0xf200('0x12')]()===_0xf200('0x13')&&!_0x1461d5[_0xf200('0x14')]&&!_[_0xf200('0x15')](_0x1461d5[_0xf200('0x16')])){_0x5d4118[_0xf200('0x17')][_0xf200('0x18')]({'where':{'id':_0x1461d5[_0xf200('0x19')]}})[_0xf200('0x1a')](function(_0x49c730){if(_0x49c730){_0x49c730[_0xf200('0x1b')]({'lastMsgAt':_0x1461d5[_0xf200('0x1c')],'lastMsgDirection':_0x1461d5['direction']['toLowerCase']()});}})[_0xf200('0x1d')](function(_0x35771f){console['error'](_0x35771f);});}_0x398615();}},'charset':'utf8mb4','collate':_0xf200('0x1e')});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index 105bda9..336eceb 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 _0x4e2e=['socket.io-emitter','./mailMessage.socket','request','then','info','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','error','code','MailMessage,\x20%s,\x20%s','message','catch','CreateMailMessage','create','body','options','raw','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost'];(function(_0x3899d1,_0x4aa04c){var _0xeb4a7d=function(_0x3ea5ee){while(--_0x3ea5ee){_0x3899d1['push'](_0x3899d1['shift']());}};_0xeb4a7d(++_0x4aa04c);}(_0x4e2e,0x1f2));var _0xe4e2=function(_0x25fcc7,_0x413ac0){_0x25fcc7=_0x25fcc7-0x0;var _0x415341=_0x4e2e[_0x25fcc7];return _0x415341;};'use strict';var _=require('lodash');var util=require(_0xe4e2('0x0'));var moment=require(_0xe4e2('0x1'));var BPromise=require(_0xe4e2('0x2'));var rs=require(_0xe4e2('0x3'));var fs=require('fs');var Redis=require(_0xe4e2('0x4'));var db=require(_0xe4e2('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xe4e2('0x6'))(_0xe4e2('0x7'));var config=require(_0xe4e2('0x8'));var jayson=require(_0xe4e2('0x9'));var client=jayson['client'][_0xe4e2('0xa')]({'port':0x232a});config[_0xe4e2('0xb')]=_[_0xe4e2('0xc')](config[_0xe4e2('0xb')],{'host':_0xe4e2('0xd'),'port':0x18eb});var socket=require(_0xe4e2('0xe'))(new Redis(config[_0xe4e2('0xb')]));require(_0xe4e2('0xf'))['register'](socket);function respondWithRpcPromise(_0xd81011,_0x14fe0d,_0xa4df88){return new BPromise(function(_0x5b7889,_0x1954f8){return client[_0xe4e2('0x10')](_0xd81011,_0xa4df88)[_0xe4e2('0x11')](function(_0x107816){logger[_0xe4e2('0x12')]('MailMessage,\x20%s,\x20%s',_0x14fe0d,_0xe4e2('0x13'));logger[_0xe4e2('0x14')](_0xe4e2('0x15'),_0x14fe0d,_0xe4e2('0x13'),JSON['stringify'](_0x107816));if(_0x107816[_0xe4e2('0x16')]){if(_0x107816[_0xe4e2('0x16')][_0xe4e2('0x17')]===0x1f4){logger[_0xe4e2('0x16')](_0xe4e2('0x18'),_0x14fe0d,_0x107816['error']['message']);return _0x1954f8(_0x107816[_0xe4e2('0x16')][_0xe4e2('0x19')]);}logger[_0xe4e2('0x16')](_0xe4e2('0x18'),_0x14fe0d,_0x107816[_0xe4e2('0x16')]['message']);return _0x5b7889(_0x107816[_0xe4e2('0x16')][_0xe4e2('0x19')]);}else{logger[_0xe4e2('0x12')]('MailMessage,\x20%s,\x20%s',_0x14fe0d,_0xe4e2('0x13'));_0x5b7889(_0x107816['result'][_0xe4e2('0x19')]);}})[_0xe4e2('0x1a')](function(_0x7a47c3){logger[_0xe4e2('0x16')](_0xe4e2('0x18'),_0x14fe0d,_0x7a47c3);_0x1954f8(_0x7a47c3);});});}exports[_0xe4e2('0x1b')]=function(_0x339d00){var _0x3c4e90=this;return new Promise(function(_0x4769dd,_0x362741){return db['MailMessage'][_0xe4e2('0x1c')](_0x339d00[_0xe4e2('0x1d')],{'raw':_0x339d00[_0xe4e2('0x1e')]?_0x339d00[_0xe4e2('0x1e')][_0xe4e2('0x1f')]===undefined?!![]:![]:!![]})[_0xe4e2('0x11')](function(_0x16f14b){logger['info'](_0xe4e2('0x1b'),_0x339d00);logger[_0xe4e2('0x14')](_0xe4e2('0x1b'),_0x339d00,JSON['stringify'](_0x16f14b));_0x4769dd(_0x16f14b);})[_0xe4e2('0x1a')](function(_0x12ad33){logger['error'](_0xe4e2('0x1b'),_0x12ad33[_0xe4e2('0x19')],_0x339d00);_0x362741(_0x3c4e90[_0xe4e2('0x16')](0x1f4,_0x12ad33[_0xe4e2('0x19')]));});});}; \ No newline at end of file +var _0xa30a=['then','info','MailMessage,\x20%s,\x20%s','debug','MailMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','catch','MailMessage','create','body','options','raw','CreateMailMessage','stringify','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','redis','defaults','socket.io-emitter','./mailMessage.socket','register'];(function(_0x10d0f0,_0x1eba3d){var _0x93e308=function(_0x388548){while(--_0x388548){_0x10d0f0['push'](_0x10d0f0['shift']());}};_0x93e308(++_0x1eba3d);}(_0xa30a,0xd7));var _0xaa30=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa30a[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xaa30('0x0'));var util=require(_0xaa30('0x1'));var moment=require(_0xaa30('0x2'));var BPromise=require('bluebird');var rs=require(_0xaa30('0x3'));var fs=require('fs');var Redis=require(_0xaa30('0x4'));var db=require(_0xaa30('0x5'))['db'];var utils=require(_0xaa30('0x6'));var logger=require(_0xaa30('0x7'))(_0xaa30('0x8'));var config=require(_0xaa30('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xaa30('0xa')]['http']({'port':0x232a});config[_0xaa30('0xb')]=_[_0xaa30('0xc')](config[_0xaa30('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xaa30('0xd'))(new Redis(config[_0xaa30('0xb')]));require(_0xaa30('0xe'))[_0xaa30('0xf')](socket);function respondWithRpcPromise(_0x14a6a6,_0x45419f,_0x56f686){return new BPromise(function(_0x5afbf5,_0x12a8ce){return client['request'](_0x14a6a6,_0x56f686)[_0xaa30('0x10')](function(_0x1a5681){logger[_0xaa30('0x11')](_0xaa30('0x12'),_0x45419f,'request\x20sent');logger[_0xaa30('0x13')](_0xaa30('0x14'),_0x45419f,_0xaa30('0x15'),JSON['stringify'](_0x1a5681));if(_0x1a5681[_0xaa30('0x16')]){if(_0x1a5681[_0xaa30('0x16')][_0xaa30('0x17')]===0x1f4){logger[_0xaa30('0x16')](_0xaa30('0x12'),_0x45419f,_0x1a5681[_0xaa30('0x16')][_0xaa30('0x18')]);return _0x12a8ce(_0x1a5681[_0xaa30('0x16')][_0xaa30('0x18')]);}logger[_0xaa30('0x16')]('MailMessage,\x20%s,\x20%s',_0x45419f,_0x1a5681[_0xaa30('0x16')]['message']);return _0x5afbf5(_0x1a5681['error'][_0xaa30('0x18')]);}else{logger[_0xaa30('0x11')](_0xaa30('0x12'),_0x45419f,'request\x20sent');_0x5afbf5(_0x1a5681['result']['message']);}})[_0xaa30('0x19')](function(_0x4acdfa){logger[_0xaa30('0x16')](_0xaa30('0x12'),_0x45419f,_0x4acdfa);_0x12a8ce(_0x4acdfa);});});}exports['CreateMailMessage']=function(_0x4e29f9){var _0x520abb=this;return new Promise(function(_0x3cbf92,_0x3e4f1d){return db[_0xaa30('0x1a')][_0xaa30('0x1b')](_0x4e29f9[_0xaa30('0x1c')],{'raw':_0x4e29f9['options']?_0x4e29f9[_0xaa30('0x1d')][_0xaa30('0x1e')]===undefined?!![]:![]:!![]})[_0xaa30('0x10')](function(_0x2d9e35){logger[_0xaa30('0x11')]('CreateMailMessage',_0x4e29f9);logger[_0xaa30('0x13')](_0xaa30('0x1f'),_0x4e29f9,JSON[_0xaa30('0x20')](_0x2d9e35));_0x3cbf92(_0x2d9e35);})[_0xaa30('0x19')](function(_0x57d1ca){logger[_0xaa30('0x16')](_0xaa30('0x1f'),_0x57d1ca[_0xaa30('0x18')],_0x4e29f9);_0x3e4f1d(_0x520abb[_0xaa30('0x16')](0x1f4,_0x57d1ca[_0xaa30('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index c87be15..2315279 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 _0x6cba=['length','mailMessage:','register'];(function(_0x42b21d,_0x466185){var _0x444319=function(_0x2cadbf){while(--_0x2cadbf){_0x42b21d['push'](_0x42b21d['shift']());}};_0x444319(++_0x466185);}(_0x6cba,0x17c));var _0xa6cb=function(_0x48f832,_0x1d6e77){_0x48f832=_0x48f832-0x0;var _0x206ae5=_0x6cba[_0x48f832];return _0x206ae5;};'use strict';var MailMessageEvents=require('./mailMessage.events');var events=['save','remove','update'];function createListener(_0x4b988b,_0x55085a){return function(_0x4d1b83){_0x55085a['emit'](_0x4b988b,_0x4d1b83);};}function removeListener(_0x463cec,_0x3774a7){return function(){MailMessageEvents['removeListener'](_0x463cec,_0x3774a7);};}exports[_0xa6cb('0x0')]=function(_0x31ea5d){for(var _0x891bca=0x0,_0x4b955e=events[_0xa6cb('0x1')];_0x891bca<_0x4b955e;_0x891bca++){var _0x508ae0=events[_0x891bca];var _0x5411b6=createListener(_0xa6cb('0x2')+_0x508ae0,_0x31ea5d);MailMessageEvents['on'](_0x508ae0,_0x5411b6);}}; \ No newline at end of file +var _0x82fa=['emit','removeListener','register','length','./mailMessage.events','save','remove','update'];(function(_0x5b848e,_0x5172b9){var _0x381fdb=function(_0x50d5da){while(--_0x50d5da){_0x5b848e['push'](_0x5b848e['shift']());}};_0x381fdb(++_0x5172b9);}(_0x82fa,0x1cc));var _0xa82f=function(_0x103c33,_0x3584a8){_0x103c33=_0x103c33-0x0;var _0x4f1a7e=_0x82fa[_0x103c33];return _0x4f1a7e;};'use strict';var MailMessageEvents=require(_0xa82f('0x0'));var events=[_0xa82f('0x1'),_0xa82f('0x2'),_0xa82f('0x3')];function createListener(_0x48bbeb,_0x58807b){return function(_0x52b8d8){_0x58807b[_0xa82f('0x4')](_0x48bbeb,_0x52b8d8);};}function removeListener(_0x367016,_0x630deb){return function(){MailMessageEvents[_0xa82f('0x5')](_0x367016,_0x630deb);};}exports[_0xa82f('0x6')]=function(_0x20e6e4){for(var _0x6195ef=0x0,_0x3dbb1c=events[_0xa82f('0x7')];_0x6195ef<_0x3dbb1c;_0x6195ef++){var _0x36507a=events[_0x6195ef];var _0x37ee38=createListener('mailMessage:'+_0x36507a,_0x20e6e4);MailMessageEvents['on'](_0x36507a,_0x37ee38);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index d5dd2f8..b846d90 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 _0x1adb=['./mailQueue.controller','isAuthenticated','index','get','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','update','delete','destroy','removeTeams','removeAgents','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment'];(function(_0x234429,_0x17fdb6){var _0x4ee615=function(_0x31df3f){while(--_0x31df3f){_0x234429['push'](_0x234429['shift']());}};_0x4ee615(++_0x17fdb6);}(_0x1adb,0x9d));var _0xb1ad=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x1adb[_0xfae23b];return _0x200640;};'use strict';var multer=require(_0xb1ad('0x0'));var util=require('util');var path=require(_0xb1ad('0x1'));var timeout=require(_0xb1ad('0x2'));var express=require(_0xb1ad('0x3'));var router=express[_0xb1ad('0x4')]();var fs_extra=require(_0xb1ad('0x5'));var auth=require(_0xb1ad('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xb1ad('0x7'));var controller=require(_0xb1ad('0x8'));router['get']('/',auth[_0xb1ad('0x9')](),controller[_0xb1ad('0xa')]);router[_0xb1ad('0xb')](_0xb1ad('0xc'),auth[_0xb1ad('0x9')](),controller[_0xb1ad('0xd')]);router['get'](_0xb1ad('0xe'),auth[_0xb1ad('0x9')](),controller[_0xb1ad('0xf')]);router['get'](_0xb1ad('0x10'),auth[_0xb1ad('0x9')](),controller[_0xb1ad('0x11')]);router[_0xb1ad('0xb')](_0xb1ad('0x12'),auth['isAuthenticated'](),controller[_0xb1ad('0x13')]);router['get'](_0xb1ad('0x14'),auth[_0xb1ad('0x9')](),controller[_0xb1ad('0x15')]);router[_0xb1ad('0x16')]('/',auth[_0xb1ad('0x9')](),controller[_0xb1ad('0x17')]);router[_0xb1ad('0x16')](_0xb1ad('0x12'),auth['isAuthenticated'](),controller[_0xb1ad('0x18')]);router[_0xb1ad('0x16')](_0xb1ad('0x14'),auth[_0xb1ad('0x9')](),controller[_0xb1ad('0x19')]);router[_0xb1ad('0x1a')]('/:id',auth[_0xb1ad('0x9')](),controller[_0xb1ad('0x1b')]);router[_0xb1ad('0x1c')](_0xb1ad('0xe'),auth[_0xb1ad('0x9')](),controller[_0xb1ad('0x1d')]);router[_0xb1ad('0x1c')](_0xb1ad('0x12'),auth[_0xb1ad('0x9')](),controller[_0xb1ad('0x1e')]);router[_0xb1ad('0x1c')]('/:id/users',auth['isAuthenticated'](),controller[_0xb1ad('0x1f')]);module[_0xb1ad('0x20')]=router; \ No newline at end of file +var _0xc362=['connect-timeout','express','Router','fs-extra','../../config/environment','./mailQueue.controller','isAuthenticated','get','/describe','describe','/:id','show','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','delete','removeTeams','removeAgents','exports'];(function(_0x26abf7,_0x5d96e1){var _0x1bcdae=function(_0x12c7c7){while(--_0x12c7c7){_0x26abf7['push'](_0x26abf7['shift']());}};_0x1bcdae(++_0x5d96e1);}(_0xc362,0x138));var _0x2c36=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc362[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x2c36('0x0'));var express=require(_0x2c36('0x1'));var router=express[_0x2c36('0x2')]();var fs_extra=require(_0x2c36('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x2c36('0x4'));var controller=require(_0x2c36('0x5'));router['get']('/',auth[_0x2c36('0x6')](),controller['index']);router[_0x2c36('0x7')](_0x2c36('0x8'),auth[_0x2c36('0x6')](),controller[_0x2c36('0x9')]);router['get'](_0x2c36('0xa'),auth[_0x2c36('0x6')](),controller[_0x2c36('0xb')]);router[_0x2c36('0x7')]('/:id/members',auth['isAuthenticated'](),controller[_0x2c36('0xc')]);router[_0x2c36('0x7')](_0x2c36('0xd'),auth[_0x2c36('0x6')](),controller[_0x2c36('0xe')]);router['get'](_0x2c36('0xf'),auth[_0x2c36('0x6')](),controller[_0x2c36('0x10')]);router[_0x2c36('0x11')]('/',auth[_0x2c36('0x6')](),controller[_0x2c36('0x12')]);router[_0x2c36('0x11')](_0x2c36('0xd'),auth[_0x2c36('0x6')](),controller[_0x2c36('0x13')]);router[_0x2c36('0x11')](_0x2c36('0xf'),auth[_0x2c36('0x6')](),controller[_0x2c36('0x14')]);router[_0x2c36('0x15')]('/:id',auth[_0x2c36('0x6')](),controller['update']);router[_0x2c36('0x16')](_0x2c36('0xa'),auth[_0x2c36('0x6')](),controller['destroy']);router[_0x2c36('0x16')](_0x2c36('0xd'),auth[_0x2c36('0x6')](),controller[_0x2c36('0x17')]);router[_0x2c36('0x16')]('/:id/users',auth['isAuthenticated'](),controller[_0x2c36('0x18')]);module[_0x2c36('0x19')]=router; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.attributes.js b/server/api/mailQueue/mailQueue.attributes.js index 88d9a0f..554d4c6 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 _0x8703=['INTEGER','beepall','roundrobin','exports','STRING','name'];(function(_0x149ead,_0x32f966){var _0x313104=function(_0x23584e){while(--_0x23584e){_0x149ead['push'](_0x149ead['shift']());}};_0x313104(++_0x32f966);}(_0x8703,0xd5));var _0x3870=function(_0x574deb,_0x156e6f){_0x574deb=_0x574deb-0x0;var _0x3c741a=_0x8703[_0x574deb];return _0x3c741a;};'use strict';var Sequelize=require('sequelize');module[_0x3870('0x0')]={'name':{'type':Sequelize[_0x3870('0x1')],'unique':_0x3870('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x3870('0x1')]},'timeout':{'type':Sequelize[_0x3870('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM']('rrmemory',_0x3870('0x4'),_0x3870('0x5'))}}; \ No newline at end of file +var _0xa9a1=['roundrobin','sequelize','STRING','name','ENUM','rrmemory','beepall'];(function(_0x49fc26,_0x2a32e6){var _0x1d3940=function(_0xe9bd8a){while(--_0xe9bd8a){_0x49fc26['push'](_0x49fc26['shift']());}};_0x1d3940(++_0x2a32e6);}(_0xa9a1,0x1eb));var _0x1a9a=function(_0x555d39,_0x2c9e33){_0x555d39=_0x555d39-0x0;var _0x5634f9=_0xa9a1[_0x555d39];return _0x5634f9;};'use strict';var Sequelize=require(_0x1a9a('0x0'));module['exports']={'name':{'type':Sequelize[_0x1a9a('0x1')],'unique':_0x1a9a('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x1a9a('0x1')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x1a9a('0x3')](_0x1a9a('0x4'),_0x1a9a('0x5'),_0x1a9a('0x6'))}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index 0d86855..a2ba1fe 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 _0x1dfa=['getMembers','findOne','UserMailQueue','length','hasOwnProperty','nolimit','order','sort','where','MailQueueId','filter','User','findAndCountAll','UserId','agent','mailPause','updatedAt','createdAt','rows','format','%s/%s','SIP','getTeams','addTeams','ids','Agents','online','interface','flatMap','sequelize','transaction','forEach','userMailQueue:save','Team','select','field','tq.TeamId','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','value','removeTeams','emit','userMailQueue:remove','addAgents','omit','spread','removeAgents','isArray','getAgents','pick','bluebird','lodash','squel','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','socket.io-emitter','./mailQueue.socket','sendStatus','status','end','json','limit','count','offset','set','Content-Range','then','MailQueues','UserProfileResource','destroy','error','name','send','index','map','MailQueue','rawAttributes','key','getOptions','include','findAll','show','params','model','keys','query','filters','intersection','attributes','fields','includeAll','merge','options','find','catch','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','get','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','describe'];(function(_0x2e8f7b,_0x492255){var _0x1741f9=function(_0x1f23ae){while(--_0x1f23ae){_0x2e8f7b['push'](_0x2e8f7b['shift']());}};_0x1741f9(++_0x492255);}(_0x1dfa,0xb8));var _0xa1df=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x1dfa[_0x1facfa];return _0x9ec701;};'use strict';var BPromise=require(_0xa1df('0x0'));var util=require('util');var _=require(_0xa1df('0x1'));var squel=require(_0xa1df('0x2'));var Redis=require('ioredis');var qs=require(_0xa1df('0x3'));var logger=require(_0xa1df('0x4'))(_0xa1df('0x5'));var config=require(_0xa1df('0x6'));var db=require(_0xa1df('0x7'))['db'];config[_0xa1df('0x8')]=_['defaults'](config[_0xa1df('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0xa1df('0x9'))(new Redis(config[_0xa1df('0x8')]));require(_0xa1df('0xa'))['register'](socket);function respondWithStatusCode(_0x3ab27e,_0xefce8b){_0xefce8b=_0xefce8b||0xcc;return function(_0xc2e903){if(_0xc2e903){return _0x3ab27e[_0xa1df('0xb')](_0xefce8b);}return _0x3ab27e[_0xa1df('0xc')](_0xefce8b)[_0xa1df('0xd')]();};}function respondWithResult(_0x292f8a,_0x1751f0){_0x1751f0=_0x1751f0||0xc8;return function(_0x56f38e){if(_0x56f38e){return _0x292f8a['status'](_0x1751f0)[_0xa1df('0xe')](_0x56f38e);}};}function respondWithFilteredResult(_0x5c456f,_0x14c342){return function(_0x2db871){if(_0x2db871){var _0x5d0c07=typeof _0x14c342['offset']==='undefined'&&typeof _0x14c342[_0xa1df('0xf')]==='undefined';var _0x1e93e0=_0x2db871[_0xa1df('0x10')];var _0x1bf858=_0x5d0c07?0x0:_0x14c342[_0xa1df('0x11')];var _0x4be7d6=_0x5d0c07?_0x2db871['count']:_0x14c342['offset']+_0x14c342['limit'];var _0x79f1a5;if(_0x4be7d6>=_0x1e93e0){_0x4be7d6=_0x1e93e0;_0x79f1a5=0xc8;}else{_0x79f1a5=0xce;}_0x5c456f['status'](_0x79f1a5);return _0x5c456f[_0xa1df('0x12')](_0xa1df('0x13'),_0x1bf858+'-'+_0x4be7d6+'/'+_0x1e93e0)['json'](_0x2db871);}return null;};}function saveUpdates(_0xe4bfc1){return function(_0x22e022){if(_0x22e022){return _0x22e022['update'](_0xe4bfc1)[_0xa1df('0x14')](function(_0x378180){return _0x378180;});}return null;};}function removeEntity(_0x571ad7){return function(_0x31b2a0){if(_0x31b2a0){return _0x31b2a0['destroy']()['then'](function(){var _0x1993aa=_0x31b2a0['get']({'plain':!![]});var _0x392b4e=_0xa1df('0x15');return db[_0xa1df('0x16')][_0xa1df('0x17')]({'where':{'type':_0x392b4e,'resourceId':_0x1993aa['id']}})[_0xa1df('0x14')](function(){return _0x31b2a0;});})[_0xa1df('0x14')](function(){_0x571ad7[_0xa1df('0xc')](0xcc)[_0xa1df('0xd')]();});}};}function handleEntityNotFound(_0x21c1d2){return function(_0x11fe58){if(!_0x11fe58){_0x21c1d2[_0xa1df('0xb')](0x194);}return _0x11fe58;};}function handleError(_0x323f4a,_0x1a87e0){_0x1a87e0=_0x1a87e0||0x1f4;return function(_0x34f8c6){logger[_0xa1df('0x18')](_0x34f8c6['stack']);if(_0x34f8c6[_0xa1df('0x19')]){delete _0x34f8c6[_0xa1df('0x19')];}_0x323f4a[_0xa1df('0xc')](_0x1a87e0)[_0xa1df('0x1a')](_0x34f8c6);};}exports[_0xa1df('0x1b')]=function(_0x175112,_0x5932c9){var _0x5d34fa={};var _0x4a68b1={'count':0x0,'rows':[]};var _0x301a45=_[_0xa1df('0x1c')](db[_0xa1df('0x1d')][_0xa1df('0x1e')],function(_0x4913de){return{'name':_0x4913de['fieldName'],'type':_0x4913de['type'][_0xa1df('0x1f')]};});_0x5d34fa=qs[_0xa1df('0x20')](_0x301a45,_0x175112);var _0x450dc7={'where':_0x5d34fa['where']};return db['MailQueue'][_0xa1df('0x10')](_0x450dc7)[_0xa1df('0x14')](function(_0x3973ef){_0x4a68b1[_0xa1df('0x10')]=_0x3973ef;_0x5d34fa['include']=qs[_0xa1df('0x21')](_0x175112['query']);return db[_0xa1df('0x1d')][_0xa1df('0x22')](_0x5d34fa);})['then'](function(_0x4f1367){_0x4a68b1['rows']=_0x4f1367;return _0x4a68b1;})[_0xa1df('0x14')](respondWithFilteredResult(_0x5932c9,_0x5d34fa))['catch'](handleError(_0x5932c9,null));};exports[_0xa1df('0x23')]=function(_0x3c1e76,_0x147d13){var _0x1734d6={'raw':!![],'where':{'id':_0x3c1e76[_0xa1df('0x24')]['id']}},_0x704b76={};_0x704b76[_0xa1df('0x25')]=_[_0xa1df('0x26')](db[_0xa1df('0x1d')][_0xa1df('0x1e')]);_0x704b76[_0xa1df('0x27')]=_[_0xa1df('0x26')](_0x3c1e76[_0xa1df('0x27')]);_0x704b76[_0xa1df('0x28')]=_[_0xa1df('0x29')](_0x704b76['model'],_0x704b76['query']);_0x1734d6[_0xa1df('0x2a')]=_[_0xa1df('0x29')](_0x704b76['model'],qs['fields'](_0x3c1e76['query'][_0xa1df('0x2b')]));_0x1734d6[_0xa1df('0x2a')]=_0x1734d6[_0xa1df('0x2a')]['length']?_0x1734d6[_0xa1df('0x2a')]:_0x704b76[_0xa1df('0x25')];if(_0x3c1e76[_0xa1df('0x27')][_0xa1df('0x2c')]){_0x1734d6[_0xa1df('0x21')]=[{'all':!![]}];}_0x1734d6=_[_0xa1df('0x2d')]({},_0x1734d6,_0x3c1e76[_0xa1df('0x2e')]);return db[_0xa1df('0x1d')][_0xa1df('0x2f')](_0x1734d6)['then'](handleEntityNotFound(_0x147d13,null))[_0xa1df('0x14')](respondWithResult(_0x147d13,null))[_0xa1df('0x30')](handleError(_0x147d13,null));};exports[_0xa1df('0x31')]=function(_0x10b5fc,_0x449355){return db['MailQueue'][_0xa1df('0x31')](_0x10b5fc['body'],{})[_0xa1df('0x14')](function(_0x19bde8){var _0x26c4ef=_0x10b5fc['user']['get']({'plain':!![]});if(!_0x26c4ef)throw new Error(_0xa1df('0x32'));if(_0x26c4ef[_0xa1df('0x33')]===_0xa1df('0x34')){var _0x20350b=_0x19bde8[_0xa1df('0x35')]({'plain':!![]});var _0x3bd134='MailQueues';return db['UserProfileSection']['find']({'where':{'name':_0x3bd134,'userProfileId':_0x26c4ef[_0xa1df('0x36')]},'raw':!![]})[_0xa1df('0x14')](function(_0x3cbf31){if(_0x3cbf31&&_0x3cbf31[_0xa1df('0x37')]===0x0){return db[_0xa1df('0x16')]['create']({'name':_0x20350b[_0xa1df('0x19')],'resourceId':_0x20350b['id'],'type':_0x3cbf31['name'],'sectionId':_0x3cbf31['id']},{})[_0xa1df('0x14')](function(){return _0x19bde8;});}else{return _0x19bde8;}})[_0xa1df('0x30')](function(_0x5af0a7){logger[_0xa1df('0x18')](_0xa1df('0x38'),_0x5af0a7);throw _0x5af0a7;});}return _0x19bde8;})['then'](respondWithResult(_0x449355,0xc9))[_0xa1df('0x30')](handleError(_0x449355,null));};exports[_0xa1df('0x39')]=function(_0x1181e6,_0x182a0b){if(_0x1181e6[_0xa1df('0x3a')]['id']){delete _0x1181e6[_0xa1df('0x3a')]['id'];}return db['MailQueue']['find']({'where':{'id':_0x1181e6['params']['id']}})[_0xa1df('0x14')](handleEntityNotFound(_0x182a0b,null))[_0xa1df('0x14')](saveUpdates(_0x1181e6[_0xa1df('0x3a')],null))['then'](respondWithResult(_0x182a0b,null))[_0xa1df('0x30')](handleError(_0x182a0b,null));};exports['destroy']=function(_0x4529b9,_0x18cd26){return db[_0xa1df('0x1d')][_0xa1df('0x2f')]({'where':{'id':_0x4529b9['params']['id']}})[_0xa1df('0x14')](handleEntityNotFound(_0x18cd26,null))['then'](removeEntity(_0x18cd26,null))[_0xa1df('0x30')](handleError(_0x18cd26,null));};exports[_0xa1df('0x3b')]=function(_0x325c99,_0x50cd6d){return db['MailQueue'][_0xa1df('0x3b')]()[_0xa1df('0x14')](respondWithResult(_0x50cd6d,null))[_0xa1df('0x30')](handleError(_0x50cd6d,null));};exports[_0xa1df('0x3c')]=function(_0x55490d,_0x55ff2e){var _0x5cd484={'raw':!![],'where':{}},_0x2a5a81={},_0x5cfbb2;return db['MailQueue'][_0xa1df('0x3d')]({'where':{'id':_0x55490d[_0xa1df('0x24')]['id']}})[_0xa1df('0x14')](handleEntityNotFound(_0x55ff2e,null))[_0xa1df('0x14')](function(_0x447f1c){if(_0x447f1c){_0x5cfbb2=_0x447f1c[_0xa1df('0x35')]({'plain':!![]});_0x2a5a81[_0xa1df('0x25')]=_[_0xa1df('0x26')](db[_0xa1df('0x3e')][_0xa1df('0x1e')]);_0x2a5a81['query']=_[_0xa1df('0x26')](_0x55490d[_0xa1df('0x27')]);_0x2a5a81[_0xa1df('0x28')]=_[_0xa1df('0x29')](_0x2a5a81[_0xa1df('0x25')],_0x2a5a81[_0xa1df('0x27')]);_0x5cd484[_0xa1df('0x2a')]=_[_0xa1df('0x29')](_0x2a5a81[_0xa1df('0x25')],qs[_0xa1df('0x2b')](_0x55490d[_0xa1df('0x27')][_0xa1df('0x2b')]));_0x5cd484['attributes']=_0x5cd484[_0xa1df('0x2a')][_0xa1df('0x3f')]?_0x5cd484[_0xa1df('0x2a')]:_0x2a5a81[_0xa1df('0x25')];if(!_0x55490d['query'][_0xa1df('0x40')](_0xa1df('0x41'))){_0x5cd484[_0xa1df('0xf')]=qs[_0xa1df('0xf')](_0x55490d['query'][_0xa1df('0xf')]);_0x5cd484[_0xa1df('0x11')]=qs[_0xa1df('0x11')](_0x55490d['query'][_0xa1df('0x11')]);}_0x5cd484[_0xa1df('0x42')]=qs[_0xa1df('0x43')](_0x55490d[_0xa1df('0x27')]['sort']);_0x5cd484['where']=qs[_0xa1df('0x28')](_['pick'](_0x55490d[_0xa1df('0x27')],_0x2a5a81[_0xa1df('0x28')]));_0x5cd484[_0xa1df('0x44')][_0xa1df('0x45')]=_0x447f1c['id'];if(_0x55490d[_0xa1df('0x27')][_0xa1df('0x46')]){_0x5cd484[_0xa1df('0x44')]=_['merge'](_0x5cd484[_0xa1df('0x44')],{'$or':_['map'](_0x5cd484[_0xa1df('0x2a')],function(_0x15e7d4){var _0x193a0b={};_0x193a0b[_0x15e7d4]={'$like':'%'+_0x55490d[_0xa1df('0x27')]['filter']+'%'};return _0x193a0b;})});}_0x5cd484=_['merge']({},_0x5cd484,_0x55490d['options']);return db['UserMailQueue']['findAll'](_0x5cd484);}})[_0xa1df('0x14')](function(_0x3595f7){if(_0x3595f7){return db[_0xa1df('0x47')][_0xa1df('0x48')]({'where':{'id':_[_0xa1df('0x1c')](_0x3595f7,_0xa1df('0x49')),'role':_0xa1df('0x4a')},'attributes':['id',_0xa1df('0x19'),_0xa1df('0x4b'),_0xa1df('0x4c'),_0xa1df('0x4d')]});}})[_0xa1df('0x14')](function(_0x56e3a7){if(_0x56e3a7){return{'count':_0x56e3a7[_0xa1df('0x10')],'rows':_[_0xa1df('0x1c')](_0x56e3a7[_0xa1df('0x4e')],function(_0x1e6aa9){return{'membername':_0x1e6aa9[_0xa1df('0x19')],'UserId':_0x1e6aa9['id'],'queue_name':_0x5cfbb2[_0xa1df('0x19')],'MailQueueId':_0x5cfbb2['id'],'interface':util[_0xa1df('0x4f')](_0xa1df('0x50'),_0xa1df('0x51'),_0x1e6aa9[_0xa1df('0x19')]),'penalty':0x0,'paused':_0x1e6aa9['mailPause'],'createdAt':_0x1e6aa9[_0xa1df('0x4d')],'updatedAt':_0x1e6aa9['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0xa1df('0x14')](respondWithFilteredResult(_0x55ff2e,_0x5cd484))[_0xa1df('0x30')](handleError(_0x55ff2e,null));};exports[_0xa1df('0x52')]=function(_0x1106ac,_0x599303){var _0x2e98a3={};var _0x46611d={};var _0xf48fbe;var _0x330c10;return db['MailQueue'][_0xa1df('0x3d')]({'where':{'id':_0x1106ac[_0xa1df('0x24')]['id']}})[_0xa1df('0x14')](handleEntityNotFound(_0x599303,null))[_0xa1df('0x14')](function(_0x56a6a8){if(_0x56a6a8){_0xf48fbe=_0x56a6a8;_0x46611d[_0xa1df('0x25')]=_[_0xa1df('0x26')](db['Team'][_0xa1df('0x1e')]);_0x46611d['query']=_[_0xa1df('0x26')](_0x1106ac[_0xa1df('0x27')]);_0x46611d[_0xa1df('0x28')]=_[_0xa1df('0x29')](_0x46611d[_0xa1df('0x25')],_0x46611d['query']);_0x2e98a3[_0xa1df('0x2a')]=_[_0xa1df('0x29')](_0x46611d[_0xa1df('0x25')],qs['fields'](_0x1106ac[_0xa1df('0x27')][_0xa1df('0x2b')]));_0x2e98a3[_0xa1df('0x2a')]=_0x2e98a3['attributes'][_0xa1df('0x3f')]?_0x2e98a3[_0xa1df('0x2a')]:_0x46611d[_0xa1df('0x25')];_0x2e98a3[_0xa1df('0x42')]=qs[_0xa1df('0x43')](_0x1106ac['query']['sort']);_0x2e98a3[_0xa1df('0x44')]=qs['filters'](_['pick'](_0x1106ac['query'],_0x46611d['filters']));if(_0x1106ac[_0xa1df('0x27')][_0xa1df('0x46')]){_0x2e98a3[_0xa1df('0x44')]=_[_0xa1df('0x2d')](_0x2e98a3[_0xa1df('0x44')],{'$or':_['map'](_0x2e98a3['attributes'],function(_0x3e5a0c){var _0x19537b={};_0x19537b[_0x3e5a0c]={'$like':'%'+_0x1106ac[_0xa1df('0x27')][_0xa1df('0x46')]+'%'};return _0x19537b;})});}_0x2e98a3=_['merge']({},_0x2e98a3,_0x1106ac[_0xa1df('0x2e')]);return _0xf48fbe[_0xa1df('0x52')](_0x2e98a3);}})[_0xa1df('0x14')](function(_0x342494){if(_0x342494){_0x330c10=_0x342494[_0xa1df('0x3f')];if(!_0x1106ac[_0xa1df('0x27')]['hasOwnProperty']('nolimit')){_0x2e98a3[_0xa1df('0xf')]=qs['limit'](_0x1106ac['query'][_0xa1df('0xf')]);_0x2e98a3[_0xa1df('0x11')]=qs['offset'](_0x1106ac[_0xa1df('0x27')]['offset']);}return _0xf48fbe[_0xa1df('0x52')](_0x2e98a3);}})['then'](function(_0x270888){if(_0x270888){return _0x270888?{'count':_0x330c10,'rows':_0x270888}:null;}})[_0xa1df('0x14')](respondWithResult(_0x599303,null))[_0xa1df('0x30')](handleError(_0x599303,null));};exports[_0xa1df('0x53')]=function(_0x1b1872,_0x1c2b3f){var _0x404a6b=_0x1b1872[_0xa1df('0x3a')][_0xa1df('0x54')];return db['Team']['findAll']({'where':{'id':_0x404a6b},'attributes':['id'],'include':[{'model':db['User'],'as':_0xa1df('0x55'),'attributes':['id',_0xa1df('0x19'),_0xa1df('0x56'),'voicePause',_0xa1df('0x57')],'raw':!![]}]})['then'](function(_0x1f1230){if(_0x1f1230){var _0x10ebac=_[_0xa1df('0x58')](_0x1f1230,function(_0x19599a){var _0x424092=_0x19599a[_0xa1df('0x35')]({'plain':!![]});return _0x424092[_0xa1df('0x55')];});return db[_0xa1df('0x1d')][_0xa1df('0x2f')]({'where':{'id':_0x1b1872[_0xa1df('0x24')]['id']}})[_0xa1df('0x14')](function(_0x3d75c4){return db[_0xa1df('0x59')][_0xa1df('0x5a')](function(_0x525ed4){return _0x3d75c4[_0xa1df('0x53')](_0x404a6b,{'transaction':_0x525ed4})[_0xa1df('0x14')](function(){return BPromise['each'](_0x10ebac,function(_0x362be4){return db[_0xa1df('0x3e')]['findOrCreate']({'where':{'UserId':_0x362be4['id'],'MailQueueId':_0x1b1872[_0xa1df('0x24')]['id']},'transaction':_0x525ed4});});})['then'](function(){_0x10ebac[_0xa1df('0x5b')](function(_0x1eb074){socket['emit'](_0xa1df('0x5c'),{'UserId':_0x1eb074['id'],'MailQueueId':_0x3d75c4['id']});});});});});}})[_0xa1df('0x14')](respondWithStatusCode(_0x1c2b3f,null))[_0xa1df('0x30')](handleError(_0x1c2b3f,null));};exports['removeTeams']=function(_0x561c64,_0x6274c2){return db[_0xa1df('0x5d')]['findAll']({'where':{'id':_0x561c64['query'][_0xa1df('0x54')]},'attributes':['id'],'include':[{'model':db[_0xa1df('0x47')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xa1df('0x14')](handleEntityNotFound(_0x6274c2,null))[_0xa1df('0x14')](function(_0x229c17){var _0xca19d0=_[_0xa1df('0x1c')](_0x229c17,'id');var _0x469dbf=[];var _0x37f76f=[];var _0x25d367=squel[_0xa1df('0x5e')]();_0x25d367[_0xa1df('0x5f')](_0xa1df('0x60'))[_0xa1df('0x61')]('team_has_mail_queues','tq')[_0xa1df('0x62')](_0xa1df('0x63'),'ut',_0xa1df('0x64'))[_0xa1df('0x44')]('MailQueueId\x20=\x20?',_0x561c64[_0xa1df('0x24')]['id']);for(var _0x46c432=0x0;_0x46c432<_0x229c17['length'];_0x46c432+=0x1){let _0x4b3521=_0x229c17[_0x46c432];for(var _0x273d0a=0x0;_0x273d0a<_0x4b3521['Agents'][_0xa1df('0x3f')];_0x273d0a+=0x1){let _0xf82a61=_0x4b3521[_0xa1df('0x55')][_0x273d0a];var _0x23c933=_0x25d367[_0xa1df('0x65')]();_0x23c933['where'](_0xa1df('0x66'),_0xf82a61['id']);_0x37f76f['push'](db[_0xa1df('0x59')][_0xa1df('0x27')](_0x23c933['toString'](),{'type':db[_0xa1df('0x59')][_0xa1df('0x67')][_0xa1df('0x68')]})[_0xa1df('0x14')](function(_0x4c3710){if(_0x4c3710['length']===0x1){return _0xf82a61['id'];}else{var _0xb9ca44=_[_0xa1df('0x69')](_[_0xa1df('0x1c')](_0x4c3710,_0xa1df('0x6a')),function(_0x43e7fe){return _[_0xa1df('0x6b')](_0xca19d0,_0x43e7fe);});if(_0xb9ca44){return _0xf82a61['id'];}}}));}}return BPromise[_0xa1df('0x6c')](_0x37f76f)[_0xa1df('0x14')](function(_0x1faab2){_0x469dbf=_(_0x469dbf)[_0xa1df('0x6d')](_0x1faab2)[_0xa1df('0x6e')]()[_0xa1df('0x6f')]();return db[_0xa1df('0x1d')][_0xa1df('0x2f')]({'where':{'id':_0x561c64[_0xa1df('0x24')]['id']}})[_0xa1df('0x14')](function(_0x22ba61){return db['sequelize'][_0xa1df('0x5a')](function(_0xf383fe){return _0x22ba61[_0xa1df('0x70')](_0x561c64[_0xa1df('0x27')]['ids'],{'transaction':_0xf383fe})[_0xa1df('0x14')](function(){if(!_['isEmpty'](_0x469dbf)){return _0x22ba61['removeAgents'](_0x469dbf,{'transaction':_0xf383fe});}})[_0xa1df('0x14')](function(){_0x469dbf['forEach'](function(_0xf902ef){socket[_0xa1df('0x71')](_0xa1df('0x72'),{'UserId':_0xf902ef,'MailQueueId':_0x22ba61['id']});});});});});});})['then'](respondWithStatusCode(_0x6274c2,null))[_0xa1df('0x30')](handleError(_0x6274c2,null));};exports['addAgents']=function(_0x5d10be,_0x150aa1){return db[_0xa1df('0x1d')][_0xa1df('0x2f')]({'where':{'id':_0x5d10be['params']['id']}})[_0xa1df('0x14')](handleEntityNotFound(_0x150aa1,null))[_0xa1df('0x14')](function(_0x16a850){if(_0x16a850){return _0x16a850[_0xa1df('0x73')](_0x5d10be['body'][_0xa1df('0x54')],_[_0xa1df('0x74')](_0x5d10be[_0xa1df('0x3a')],[_0xa1df('0x54'),'id'])||{})[_0xa1df('0x75')](function(_0x292d03){for(var _0x4ccb35=0x0;_0x4ccb35<_0x5d10be['body'][_0xa1df('0x54')][_0xa1df('0x3f')];_0x4ccb35+=0x1){socket[_0xa1df('0x71')](_0xa1df('0x5c'),{'UserId':Number(_0x5d10be[_0xa1df('0x3a')][_0xa1df('0x54')][_0x4ccb35]),'MailQueueId':Number(_0x5d10be[_0xa1df('0x24')]['id'])});}return _0x292d03;});}})[_0xa1df('0x14')](respondWithResult(_0x150aa1,null))['catch'](handleError(_0x150aa1,null));};exports['removeAgents']=function(_0x240bf1,_0x286457){return db['MailQueue']['find']({'where':{'id':_0x240bf1['params']['id']}})[_0xa1df('0x14')](handleEntityNotFound(_0x286457,null))[_0xa1df('0x14')](function(_0x512159){if(_0x512159){return _0x512159[_0xa1df('0x76')](_0x240bf1['query'][_0xa1df('0x54')])[_0xa1df('0x14')](function(){if(_[_0xa1df('0x77')](_0x240bf1[_0xa1df('0x27')][_0xa1df('0x54')])){for(var _0x428841=0x0;_0x428841<_0x240bf1['query'][_0xa1df('0x54')]['length'];_0x428841+=0x1){socket[_0xa1df('0x71')](_0xa1df('0x72'),{'UserId':Number(_0x240bf1[_0xa1df('0x27')][_0xa1df('0x54')][_0x428841]),'MailQueueId':Number(_0x240bf1[_0xa1df('0x24')]['id'])});}}else{socket[_0xa1df('0x71')](_0xa1df('0x72'),{'UserId':Number(_0x240bf1['query'][_0xa1df('0x54')]),'MailQueueId':Number(_0x240bf1['params']['id'])});}});}})[_0xa1df('0x14')](respondWithStatusCode(_0x286457,null))[_0xa1df('0x30')](handleError(_0x286457,null));};exports[_0xa1df('0x78')]=function(_0x403f65,_0x1b4881){var _0x99a363={};var _0xa546e3={};var _0x19769b;var _0x5d90d4;return db[_0xa1df('0x1d')]['findOne']({'where':{'id':_0x403f65[_0xa1df('0x24')]['id']}})[_0xa1df('0x14')](handleEntityNotFound(_0x1b4881,null))[_0xa1df('0x14')](function(_0x3d1dcb){if(_0x3d1dcb){_0x19769b=_0x3d1dcb;_0xa546e3[_0xa1df('0x25')]=_[_0xa1df('0x26')](db['User']['rawAttributes']);_0xa546e3[_0xa1df('0x27')]=_[_0xa1df('0x26')](_0x403f65[_0xa1df('0x27')]);_0xa546e3[_0xa1df('0x28')]=_[_0xa1df('0x29')](_0xa546e3[_0xa1df('0x25')],_0xa546e3[_0xa1df('0x27')]);_0x99a363['attributes']=_[_0xa1df('0x29')](_0xa546e3['model'],qs['fields'](_0x403f65[_0xa1df('0x27')][_0xa1df('0x2b')]));_0x99a363[_0xa1df('0x2a')]=_0x99a363[_0xa1df('0x2a')]['length']?_0x99a363[_0xa1df('0x2a')]:_0xa546e3['model'];_0x99a363[_0xa1df('0x42')]=qs[_0xa1df('0x43')](_0x403f65['query'][_0xa1df('0x43')]);_0x99a363[_0xa1df('0x44')]=qs[_0xa1df('0x28')](_[_0xa1df('0x79')](_0x403f65['query'],_0xa546e3['filters']));if(_0x403f65['query']['filter']){_0x99a363[_0xa1df('0x44')]=_[_0xa1df('0x2d')](_0x99a363[_0xa1df('0x44')],{'$or':_['map'](_0x99a363[_0xa1df('0x2a')],function(_0x3681c0){var _0x166f29={};_0x166f29[_0x3681c0]={'$like':'%'+_0x403f65[_0xa1df('0x27')]['filter']+'%'};return _0x166f29;})});}_0x99a363=_['merge']({},_0x99a363,_0x403f65[_0xa1df('0x2e')]);return _0x19769b[_0xa1df('0x78')](_0x99a363);}})[_0xa1df('0x14')](function(_0x47d825){if(_0x47d825){_0x5d90d4=_0x47d825[_0xa1df('0x3f')];if(!_0x403f65[_0xa1df('0x27')][_0xa1df('0x40')]('nolimit')){_0x99a363['limit']=qs['limit'](_0x403f65[_0xa1df('0x27')][_0xa1df('0xf')]);_0x99a363[_0xa1df('0x11')]=qs[_0xa1df('0x11')](_0x403f65[_0xa1df('0x27')][_0xa1df('0x11')]);}return _0x19769b['getAgents'](_0x99a363);}})[_0xa1df('0x14')](function(_0x24a1dc){if(_0x24a1dc){return _0x24a1dc?{'count':_0x5d90d4,'rows':_0x24a1dc}:null;}})['then'](respondWithResult(_0x1b4881,null))['catch'](handleError(_0x1b4881,null));}; \ No newline at end of file +var _0x9ad5=['defaults','localhost','socket.io-emitter','./mailQueue.socket','register','sendStatus','end','json','offset','undefined','limit','count','status','Content-Range','update','then','destroy','get','MailQueues','UserProfileResource','error','stack','name','index','map','MailQueue','rawAttributes','fieldName','key','getOptions','where','include','findAll','catch','show','model','keys','query','attributes','intersection','fields','length','includeAll','merge','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','autoAssociation','body','params','describe','getMembers','findOne','UserMailQueue','filters','hasOwnProperty','nolimit','order','sort','pick','filter','User','findAndCountAll','agent','mailPause','updatedAt','createdAt','rows','format','%s/%s','getTeams','Team','options','addTeams','ids','flatMap','Agents','sequelize','transaction','each','findOrCreate','forEach','userMailQueue:save','removeTeams','select','field','tq.TeamId','from','join','MailQueueId\x20=\x20?','clone','push','toString','QueryTypes','SELECT','every','TeamId','includes','union','isEmpty','removeAgents','emit','userMailQueue:remove','addAgents','omit','isArray','getAgents','bluebird','util','lodash','squel','ioredis','../../config/environment','../../mysqldb','redis'];(function(_0x39b64d,_0x34a661){var _0x4520f5=function(_0x4ee903){while(--_0x4ee903){_0x39b64d['push'](_0x39b64d['shift']());}};_0x4520f5(++_0x34a661);}(_0x9ad5,0x1cc));var _0x59ad=function(_0x13f5a6,_0xbecee6){_0x13f5a6=_0x13f5a6-0x0;var _0x155664=_0x9ad5[_0x13f5a6];return _0x155664;};'use strict';var BPromise=require(_0x59ad('0x0'));var util=require(_0x59ad('0x1'));var _=require(_0x59ad('0x2'));var squel=require(_0x59ad('0x3'));var Redis=require(_0x59ad('0x4'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')('api');var config=require(_0x59ad('0x5'));var db=require(_0x59ad('0x6'))['db'];config[_0x59ad('0x7')]=_[_0x59ad('0x8')](config[_0x59ad('0x7')],{'host':_0x59ad('0x9'),'port':0x18eb});var socket=require(_0x59ad('0xa'))(new Redis(config['redis']));require(_0x59ad('0xb'))[_0x59ad('0xc')](socket);function respondWithStatusCode(_0x30ea21,_0x4334f6){_0x4334f6=_0x4334f6||0xcc;return function(_0x5cba1f){if(_0x5cba1f){return _0x30ea21[_0x59ad('0xd')](_0x4334f6);}return _0x30ea21['status'](_0x4334f6)[_0x59ad('0xe')]();};}function respondWithResult(_0x3b5079,_0xe95368){_0xe95368=_0xe95368||0xc8;return function(_0x17b9f6){if(_0x17b9f6){return _0x3b5079['status'](_0xe95368)[_0x59ad('0xf')](_0x17b9f6);}};}function respondWithFilteredResult(_0xea902a,_0x1b7bd0){return function(_0x1bac40){if(_0x1bac40){var _0x12054f=typeof _0x1b7bd0[_0x59ad('0x10')]===_0x59ad('0x11')&&typeof _0x1b7bd0[_0x59ad('0x12')]===_0x59ad('0x11');var _0x2d1193=_0x1bac40[_0x59ad('0x13')];var _0x5e70d8=_0x12054f?0x0:_0x1b7bd0['offset'];var _0x4939d9=_0x12054f?_0x1bac40[_0x59ad('0x13')]:_0x1b7bd0[_0x59ad('0x10')]+_0x1b7bd0[_0x59ad('0x12')];var _0x30f1be;if(_0x4939d9>=_0x2d1193){_0x4939d9=_0x2d1193;_0x30f1be=0xc8;}else{_0x30f1be=0xce;}_0xea902a[_0x59ad('0x14')](_0x30f1be);return _0xea902a['set'](_0x59ad('0x15'),_0x5e70d8+'-'+_0x4939d9+'/'+_0x2d1193)['json'](_0x1bac40);}return null;};}function saveUpdates(_0x2b341d){return function(_0x406cde){if(_0x406cde){return _0x406cde[_0x59ad('0x16')](_0x2b341d)[_0x59ad('0x17')](function(_0x15d767){return _0x15d767;});}return null;};}function removeEntity(_0x397774){return function(_0x1efc2c){if(_0x1efc2c){return _0x1efc2c[_0x59ad('0x18')]()[_0x59ad('0x17')](function(){var _0x273d2f=_0x1efc2c[_0x59ad('0x19')]({'plain':!![]});var _0x2fd0c4=_0x59ad('0x1a');return db[_0x59ad('0x1b')][_0x59ad('0x18')]({'where':{'type':_0x2fd0c4,'resourceId':_0x273d2f['id']}})[_0x59ad('0x17')](function(){return _0x1efc2c;});})[_0x59ad('0x17')](function(){_0x397774['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x234b3e){return function(_0x287f2d){if(!_0x287f2d){_0x234b3e[_0x59ad('0xd')](0x194);}return _0x287f2d;};}function handleError(_0x579b48,_0x245e6a){_0x245e6a=_0x245e6a||0x1f4;return function(_0x1529ad){logger[_0x59ad('0x1c')](_0x1529ad[_0x59ad('0x1d')]);if(_0x1529ad[_0x59ad('0x1e')]){delete _0x1529ad[_0x59ad('0x1e')];}_0x579b48['status'](_0x245e6a)['send'](_0x1529ad);};}exports[_0x59ad('0x1f')]=function(_0x2e4069,_0x3ab812){var _0x39c1ca={};var _0x126cce={'count':0x0,'rows':[]};var _0x1475ef=_[_0x59ad('0x20')](db[_0x59ad('0x21')][_0x59ad('0x22')],function(_0x19eeca){return{'name':_0x19eeca[_0x59ad('0x23')],'type':_0x19eeca['type'][_0x59ad('0x24')]};});_0x39c1ca=qs[_0x59ad('0x25')](_0x1475ef,_0x2e4069);var _0x7258e6={'where':_0x39c1ca[_0x59ad('0x26')]};return db[_0x59ad('0x21')][_0x59ad('0x13')](_0x7258e6)[_0x59ad('0x17')](function(_0xbd7773){_0x126cce['count']=_0xbd7773;_0x39c1ca['include']=qs[_0x59ad('0x27')](_0x2e4069['query']);return db[_0x59ad('0x21')][_0x59ad('0x28')](_0x39c1ca);})[_0x59ad('0x17')](function(_0x4fe36a){_0x126cce['rows']=_0x4fe36a;return _0x126cce;})['then'](respondWithFilteredResult(_0x3ab812,_0x39c1ca))[_0x59ad('0x29')](handleError(_0x3ab812,null));};exports[_0x59ad('0x2a')]=function(_0x2515b7,_0x351097){var _0x58d174={'raw':!![],'where':{'id':_0x2515b7['params']['id']}},_0x2586ac={};_0x2586ac[_0x59ad('0x2b')]=_[_0x59ad('0x2c')](db[_0x59ad('0x21')][_0x59ad('0x22')]);_0x2586ac[_0x59ad('0x2d')]=_[_0x59ad('0x2c')](_0x2515b7[_0x59ad('0x2d')]);_0x2586ac['filters']=_['intersection'](_0x2586ac[_0x59ad('0x2b')],_0x2586ac['query']);_0x58d174[_0x59ad('0x2e')]=_[_0x59ad('0x2f')](_0x2586ac['model'],qs[_0x59ad('0x30')](_0x2515b7[_0x59ad('0x2d')]['fields']));_0x58d174[_0x59ad('0x2e')]=_0x58d174[_0x59ad('0x2e')][_0x59ad('0x31')]?_0x58d174[_0x59ad('0x2e')]:_0x2586ac[_0x59ad('0x2b')];if(_0x2515b7[_0x59ad('0x2d')][_0x59ad('0x32')]){_0x58d174['include']=[{'all':!![]}];}_0x58d174=_[_0x59ad('0x33')]({},_0x58d174,_0x2515b7['options']);return db['MailQueue']['find'](_0x58d174)[_0x59ad('0x17')](handleEntityNotFound(_0x351097,null))[_0x59ad('0x17')](respondWithResult(_0x351097,null))[_0x59ad('0x29')](handleError(_0x351097,null));};exports['create']=function(_0xdedc84,_0x3bc4cd){return db[_0x59ad('0x21')][_0x59ad('0x34')](_0xdedc84['body'],{})[_0x59ad('0x17')](function(_0x4a9e5a){var _0x5a703a=_0xdedc84[_0x59ad('0x35')][_0x59ad('0x19')]({'plain':!![]});if(!_0x5a703a)throw new Error(_0x59ad('0x36'));if(_0x5a703a['role']===_0x59ad('0x35')){var _0x3a3bc7=_0x4a9e5a[_0x59ad('0x19')]({'plain':!![]});var _0x55090b=_0x59ad('0x1a');return db[_0x59ad('0x37')][_0x59ad('0x38')]({'where':{'name':_0x55090b,'userProfileId':_0x5a703a['userProfileId']},'raw':!![]})[_0x59ad('0x17')](function(_0x1911ee){if(_0x1911ee&&_0x1911ee[_0x59ad('0x39')]===0x0){return db[_0x59ad('0x1b')][_0x59ad('0x34')]({'name':_0x3a3bc7[_0x59ad('0x1e')],'resourceId':_0x3a3bc7['id'],'type':_0x1911ee[_0x59ad('0x1e')],'sectionId':_0x1911ee['id']},{})[_0x59ad('0x17')](function(){return _0x4a9e5a;});}else{return _0x4a9e5a;}})['catch'](function(_0x3f4712){logger[_0x59ad('0x1c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3f4712);throw _0x3f4712;});}return _0x4a9e5a;})[_0x59ad('0x17')](respondWithResult(_0x3bc4cd,0xc9))[_0x59ad('0x29')](handleError(_0x3bc4cd,null));};exports[_0x59ad('0x16')]=function(_0x2ce014,_0x999e11){if(_0x2ce014[_0x59ad('0x3a')]['id']){delete _0x2ce014['body']['id'];}return db['MailQueue'][_0x59ad('0x38')]({'where':{'id':_0x2ce014[_0x59ad('0x3b')]['id']}})[_0x59ad('0x17')](handleEntityNotFound(_0x999e11,null))[_0x59ad('0x17')](saveUpdates(_0x2ce014[_0x59ad('0x3a')],null))[_0x59ad('0x17')](respondWithResult(_0x999e11,null))[_0x59ad('0x29')](handleError(_0x999e11,null));};exports[_0x59ad('0x18')]=function(_0x3f16a4,_0x1937b5){return db[_0x59ad('0x21')][_0x59ad('0x38')]({'where':{'id':_0x3f16a4[_0x59ad('0x3b')]['id']}})[_0x59ad('0x17')](handleEntityNotFound(_0x1937b5,null))[_0x59ad('0x17')](removeEntity(_0x1937b5,null))[_0x59ad('0x29')](handleError(_0x1937b5,null));};exports[_0x59ad('0x3c')]=function(_0x40761a,_0x1e318c){return db[_0x59ad('0x21')][_0x59ad('0x3c')]()[_0x59ad('0x17')](respondWithResult(_0x1e318c,null))[_0x59ad('0x29')](handleError(_0x1e318c,null));};exports[_0x59ad('0x3d')]=function(_0x2b0e61,_0x55b04f){var _0x37ef39={'raw':!![],'where':{}},_0x4a273a={},_0x36511e;return db[_0x59ad('0x21')][_0x59ad('0x3e')]({'where':{'id':_0x2b0e61[_0x59ad('0x3b')]['id']}})[_0x59ad('0x17')](handleEntityNotFound(_0x55b04f,null))[_0x59ad('0x17')](function(_0x4d24b5){if(_0x4d24b5){_0x36511e=_0x4d24b5[_0x59ad('0x19')]({'plain':!![]});_0x4a273a[_0x59ad('0x2b')]=_['keys'](db[_0x59ad('0x3f')][_0x59ad('0x22')]);_0x4a273a['query']=_[_0x59ad('0x2c')](_0x2b0e61['query']);_0x4a273a[_0x59ad('0x40')]=_['intersection'](_0x4a273a[_0x59ad('0x2b')],_0x4a273a['query']);_0x37ef39['attributes']=_['intersection'](_0x4a273a['model'],qs[_0x59ad('0x30')](_0x2b0e61[_0x59ad('0x2d')][_0x59ad('0x30')]));_0x37ef39[_0x59ad('0x2e')]=_0x37ef39[_0x59ad('0x2e')][_0x59ad('0x31')]?_0x37ef39['attributes']:_0x4a273a[_0x59ad('0x2b')];if(!_0x2b0e61[_0x59ad('0x2d')][_0x59ad('0x41')](_0x59ad('0x42'))){_0x37ef39[_0x59ad('0x12')]=qs[_0x59ad('0x12')](_0x2b0e61[_0x59ad('0x2d')][_0x59ad('0x12')]);_0x37ef39[_0x59ad('0x10')]=qs[_0x59ad('0x10')](_0x2b0e61[_0x59ad('0x2d')][_0x59ad('0x10')]);}_0x37ef39[_0x59ad('0x43')]=qs['sort'](_0x2b0e61['query'][_0x59ad('0x44')]);_0x37ef39['where']=qs[_0x59ad('0x40')](_[_0x59ad('0x45')](_0x2b0e61[_0x59ad('0x2d')],_0x4a273a['filters']));_0x37ef39[_0x59ad('0x26')]['MailQueueId']=_0x4d24b5['id'];if(_0x2b0e61[_0x59ad('0x2d')]['filter']){_0x37ef39['where']=_[_0x59ad('0x33')](_0x37ef39[_0x59ad('0x26')],{'$or':_[_0x59ad('0x20')](_0x37ef39[_0x59ad('0x2e')],function(_0x440322){var _0x25b7c6={};_0x25b7c6[_0x440322]={'$like':'%'+_0x2b0e61[_0x59ad('0x2d')][_0x59ad('0x46')]+'%'};return _0x25b7c6;})});}_0x37ef39=_['merge']({},_0x37ef39,_0x2b0e61['options']);return db[_0x59ad('0x3f')][_0x59ad('0x28')](_0x37ef39);}})[_0x59ad('0x17')](function(_0x35bdb8){if(_0x35bdb8){return db[_0x59ad('0x47')][_0x59ad('0x48')]({'where':{'id':_[_0x59ad('0x20')](_0x35bdb8,'UserId'),'role':_0x59ad('0x49')},'attributes':['id',_0x59ad('0x1e'),_0x59ad('0x4a'),_0x59ad('0x4b'),_0x59ad('0x4c')]});}})[_0x59ad('0x17')](function(_0x32d7ff){if(_0x32d7ff){return{'count':_0x32d7ff[_0x59ad('0x13')],'rows':_['map'](_0x32d7ff[_0x59ad('0x4d')],function(_0x5f141e){return{'membername':_0x5f141e[_0x59ad('0x1e')],'UserId':_0x5f141e['id'],'queue_name':_0x36511e[_0x59ad('0x1e')],'MailQueueId':_0x36511e['id'],'interface':util[_0x59ad('0x4e')](_0x59ad('0x4f'),'SIP',_0x5f141e[_0x59ad('0x1e')]),'penalty':0x0,'paused':_0x5f141e[_0x59ad('0x4a')],'createdAt':_0x5f141e[_0x59ad('0x4c')],'updatedAt':_0x5f141e[_0x59ad('0x4b')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x59ad('0x17')](respondWithFilteredResult(_0x55b04f,_0x37ef39))[_0x59ad('0x29')](handleError(_0x55b04f,null));};exports[_0x59ad('0x50')]=function(_0x534018,_0x31c016){var _0x46c118={};var _0x56ab55={};var _0x57ad3e;var _0x3922d8;return db['MailQueue'][_0x59ad('0x3e')]({'where':{'id':_0x534018[_0x59ad('0x3b')]['id']}})[_0x59ad('0x17')](handleEntityNotFound(_0x31c016,null))[_0x59ad('0x17')](function(_0x46255f){if(_0x46255f){_0x57ad3e=_0x46255f;_0x56ab55['model']=_[_0x59ad('0x2c')](db[_0x59ad('0x51')][_0x59ad('0x22')]);_0x56ab55[_0x59ad('0x2d')]=_[_0x59ad('0x2c')](_0x534018[_0x59ad('0x2d')]);_0x56ab55[_0x59ad('0x40')]=_['intersection'](_0x56ab55[_0x59ad('0x2b')],_0x56ab55[_0x59ad('0x2d')]);_0x46c118[_0x59ad('0x2e')]=_[_0x59ad('0x2f')](_0x56ab55['model'],qs[_0x59ad('0x30')](_0x534018['query'][_0x59ad('0x30')]));_0x46c118['attributes']=_0x46c118[_0x59ad('0x2e')][_0x59ad('0x31')]?_0x46c118[_0x59ad('0x2e')]:_0x56ab55[_0x59ad('0x2b')];_0x46c118[_0x59ad('0x43')]=qs[_0x59ad('0x44')](_0x534018[_0x59ad('0x2d')][_0x59ad('0x44')]);_0x46c118[_0x59ad('0x26')]=qs[_0x59ad('0x40')](_[_0x59ad('0x45')](_0x534018[_0x59ad('0x2d')],_0x56ab55[_0x59ad('0x40')]));if(_0x534018['query'][_0x59ad('0x46')]){_0x46c118[_0x59ad('0x26')]=_[_0x59ad('0x33')](_0x46c118[_0x59ad('0x26')],{'$or':_['map'](_0x46c118[_0x59ad('0x2e')],function(_0x44933d){var _0x236500={};_0x236500[_0x44933d]={'$like':'%'+_0x534018[_0x59ad('0x2d')]['filter']+'%'};return _0x236500;})});}_0x46c118=_[_0x59ad('0x33')]({},_0x46c118,_0x534018[_0x59ad('0x52')]);return _0x57ad3e[_0x59ad('0x50')](_0x46c118);}})['then'](function(_0x1de4b8){if(_0x1de4b8){_0x3922d8=_0x1de4b8[_0x59ad('0x31')];if(!_0x534018['query'][_0x59ad('0x41')]('nolimit')){_0x46c118[_0x59ad('0x12')]=qs[_0x59ad('0x12')](_0x534018[_0x59ad('0x2d')][_0x59ad('0x12')]);_0x46c118[_0x59ad('0x10')]=qs[_0x59ad('0x10')](_0x534018[_0x59ad('0x2d')]['offset']);}return _0x57ad3e[_0x59ad('0x50')](_0x46c118);}})[_0x59ad('0x17')](function(_0x19d5f8){if(_0x19d5f8){return _0x19d5f8?{'count':_0x3922d8,'rows':_0x19d5f8}:null;}})[_0x59ad('0x17')](respondWithResult(_0x31c016,null))[_0x59ad('0x29')](handleError(_0x31c016,null));};exports[_0x59ad('0x53')]=function(_0x2d91dd,_0xba670a){var _0x5365ea=_0x2d91dd[_0x59ad('0x3a')][_0x59ad('0x54')];return db[_0x59ad('0x51')][_0x59ad('0x28')]({'where':{'id':_0x5365ea},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id',_0x59ad('0x1e'),'online','voicePause','interface'],'raw':!![]}]})[_0x59ad('0x17')](function(_0x299a0a){if(_0x299a0a){var _0x54e0c5=_[_0x59ad('0x55')](_0x299a0a,function(_0x5fe402){var _0x795183=_0x5fe402[_0x59ad('0x19')]({'plain':!![]});return _0x795183[_0x59ad('0x56')];});return db['MailQueue'][_0x59ad('0x38')]({'where':{'id':_0x2d91dd[_0x59ad('0x3b')]['id']}})[_0x59ad('0x17')](function(_0x7474b6){return db[_0x59ad('0x57')][_0x59ad('0x58')](function(_0x4f03a2){return _0x7474b6[_0x59ad('0x53')](_0x5365ea,{'transaction':_0x4f03a2})[_0x59ad('0x17')](function(){return BPromise[_0x59ad('0x59')](_0x54e0c5,function(_0x18ea80){return db[_0x59ad('0x3f')][_0x59ad('0x5a')]({'where':{'UserId':_0x18ea80['id'],'MailQueueId':_0x2d91dd[_0x59ad('0x3b')]['id']},'transaction':_0x4f03a2});});})[_0x59ad('0x17')](function(){_0x54e0c5[_0x59ad('0x5b')](function(_0x4ec590){socket['emit'](_0x59ad('0x5c'),{'UserId':_0x4ec590['id'],'MailQueueId':_0x7474b6['id']});});});});});}})[_0x59ad('0x17')](respondWithStatusCode(_0xba670a,null))[_0x59ad('0x29')](handleError(_0xba670a,null));};exports[_0x59ad('0x5d')]=function(_0x52f672,_0x5b99d7){return db[_0x59ad('0x51')]['findAll']({'where':{'id':_0x52f672[_0x59ad('0x2d')][_0x59ad('0x54')]},'attributes':['id'],'include':[{'model':db[_0x59ad('0x47')],'as':_0x59ad('0x56'),'attributes':['id'],'raw':!![]}]})[_0x59ad('0x17')](handleEntityNotFound(_0x5b99d7,null))[_0x59ad('0x17')](function(_0x5c2953){var _0x4c8998=_['map'](_0x5c2953,'id');var _0x2f4bff=[];var _0x405535=[];var _0x12c547=squel[_0x59ad('0x5e')]();_0x12c547[_0x59ad('0x5f')](_0x59ad('0x60'))[_0x59ad('0x61')]('team_has_mail_queues','tq')[_0x59ad('0x62')]('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')[_0x59ad('0x26')](_0x59ad('0x63'),_0x52f672['params']['id']);for(var _0x9da32c=0x0;_0x9da32c<_0x5c2953['length'];_0x9da32c+=0x1){let _0x318a4c=_0x5c2953[_0x9da32c];for(var _0x3dee4b=0x0;_0x3dee4b<_0x318a4c[_0x59ad('0x56')][_0x59ad('0x31')];_0x3dee4b+=0x1){let _0xc766dc=_0x318a4c[_0x59ad('0x56')][_0x3dee4b];var _0x1a9fdd=_0x12c547[_0x59ad('0x64')]();_0x1a9fdd[_0x59ad('0x26')]('ut.UserId\x20=\x20?',_0xc766dc['id']);_0x405535[_0x59ad('0x65')](db['sequelize']['query'](_0x1a9fdd[_0x59ad('0x66')](),{'type':db['sequelize'][_0x59ad('0x67')][_0x59ad('0x68')]})['then'](function(_0x19370d){if(_0x19370d[_0x59ad('0x31')]===0x1){return _0xc766dc['id'];}else{var _0x523303=_[_0x59ad('0x69')](_['map'](_0x19370d,_0x59ad('0x6a')),function(_0x4ac404){return _[_0x59ad('0x6b')](_0x4c8998,_0x4ac404);});if(_0x523303){return _0xc766dc['id'];}}}));}}return BPromise['all'](_0x405535)[_0x59ad('0x17')](function(_0x36cbfa){_0x2f4bff=_(_0x2f4bff)[_0x59ad('0x6c')](_0x36cbfa)['compact']()['value']();return db['MailQueue'][_0x59ad('0x38')]({'where':{'id':_0x52f672[_0x59ad('0x3b')]['id']}})[_0x59ad('0x17')](function(_0x2b1ba6){return db[_0x59ad('0x57')][_0x59ad('0x58')](function(_0x490867){return _0x2b1ba6[_0x59ad('0x5d')](_0x52f672[_0x59ad('0x2d')][_0x59ad('0x54')],{'transaction':_0x490867})['then'](function(){if(!_[_0x59ad('0x6d')](_0x2f4bff)){return _0x2b1ba6[_0x59ad('0x6e')](_0x2f4bff,{'transaction':_0x490867});}})[_0x59ad('0x17')](function(){_0x2f4bff[_0x59ad('0x5b')](function(_0x43d40d){socket[_0x59ad('0x6f')](_0x59ad('0x70'),{'UserId':_0x43d40d,'MailQueueId':_0x2b1ba6['id']});});});});});});})[_0x59ad('0x17')](respondWithStatusCode(_0x5b99d7,null))['catch'](handleError(_0x5b99d7,null));};exports[_0x59ad('0x71')]=function(_0x517c65,_0x4d5cff){return db['MailQueue'][_0x59ad('0x38')]({'where':{'id':_0x517c65[_0x59ad('0x3b')]['id']}})[_0x59ad('0x17')](handleEntityNotFound(_0x4d5cff,null))[_0x59ad('0x17')](function(_0x3e8a51){if(_0x3e8a51){return _0x3e8a51[_0x59ad('0x71')](_0x517c65[_0x59ad('0x3a')][_0x59ad('0x54')],_[_0x59ad('0x72')](_0x517c65[_0x59ad('0x3a')],[_0x59ad('0x54'),'id'])||{})['spread'](function(_0x2b7f25){for(var _0x3cc6e3=0x0;_0x3cc6e3<_0x517c65[_0x59ad('0x3a')][_0x59ad('0x54')]['length'];_0x3cc6e3+=0x1){socket[_0x59ad('0x6f')](_0x59ad('0x5c'),{'UserId':Number(_0x517c65['body'][_0x59ad('0x54')][_0x3cc6e3]),'MailQueueId':Number(_0x517c65[_0x59ad('0x3b')]['id'])});}return _0x2b7f25;});}})[_0x59ad('0x17')](respondWithResult(_0x4d5cff,null))[_0x59ad('0x29')](handleError(_0x4d5cff,null));};exports[_0x59ad('0x6e')]=function(_0x5a9623,_0xe9f953){return db[_0x59ad('0x21')][_0x59ad('0x38')]({'where':{'id':_0x5a9623[_0x59ad('0x3b')]['id']}})[_0x59ad('0x17')](handleEntityNotFound(_0xe9f953,null))[_0x59ad('0x17')](function(_0x1d2611){if(_0x1d2611){return _0x1d2611[_0x59ad('0x6e')](_0x5a9623['query'][_0x59ad('0x54')])[_0x59ad('0x17')](function(){if(_[_0x59ad('0x73')](_0x5a9623[_0x59ad('0x2d')][_0x59ad('0x54')])){for(var _0x499984=0x0;_0x499984<_0x5a9623[_0x59ad('0x2d')][_0x59ad('0x54')][_0x59ad('0x31')];_0x499984+=0x1){socket[_0x59ad('0x6f')](_0x59ad('0x70'),{'UserId':Number(_0x5a9623[_0x59ad('0x2d')][_0x59ad('0x54')][_0x499984]),'MailQueueId':Number(_0x5a9623[_0x59ad('0x3b')]['id'])});}}else{socket[_0x59ad('0x6f')](_0x59ad('0x70'),{'UserId':Number(_0x5a9623[_0x59ad('0x2d')][_0x59ad('0x54')]),'MailQueueId':Number(_0x5a9623[_0x59ad('0x3b')]['id'])});}});}})['then'](respondWithStatusCode(_0xe9f953,null))[_0x59ad('0x29')](handleError(_0xe9f953,null));};exports[_0x59ad('0x74')]=function(_0x4f3447,_0x54baac){var _0x2eba33={};var _0x33ad33={};var _0x8ece02;var _0x47abf4;return db[_0x59ad('0x21')][_0x59ad('0x3e')]({'where':{'id':_0x4f3447[_0x59ad('0x3b')]['id']}})[_0x59ad('0x17')](handleEntityNotFound(_0x54baac,null))['then'](function(_0x4a2304){if(_0x4a2304){_0x8ece02=_0x4a2304;_0x33ad33['model']=_[_0x59ad('0x2c')](db[_0x59ad('0x47')][_0x59ad('0x22')]);_0x33ad33['query']=_[_0x59ad('0x2c')](_0x4f3447[_0x59ad('0x2d')]);_0x33ad33[_0x59ad('0x40')]=_['intersection'](_0x33ad33[_0x59ad('0x2b')],_0x33ad33[_0x59ad('0x2d')]);_0x2eba33[_0x59ad('0x2e')]=_['intersection'](_0x33ad33[_0x59ad('0x2b')],qs[_0x59ad('0x30')](_0x4f3447[_0x59ad('0x2d')]['fields']));_0x2eba33[_0x59ad('0x2e')]=_0x2eba33[_0x59ad('0x2e')]['length']?_0x2eba33[_0x59ad('0x2e')]:_0x33ad33[_0x59ad('0x2b')];_0x2eba33['order']=qs['sort'](_0x4f3447[_0x59ad('0x2d')]['sort']);_0x2eba33[_0x59ad('0x26')]=qs['filters'](_[_0x59ad('0x45')](_0x4f3447['query'],_0x33ad33[_0x59ad('0x40')]));if(_0x4f3447['query'][_0x59ad('0x46')]){_0x2eba33[_0x59ad('0x26')]=_[_0x59ad('0x33')](_0x2eba33[_0x59ad('0x26')],{'$or':_[_0x59ad('0x20')](_0x2eba33['attributes'],function(_0x653ce7){var _0x40171a={};_0x40171a[_0x653ce7]={'$like':'%'+_0x4f3447[_0x59ad('0x2d')][_0x59ad('0x46')]+'%'};return _0x40171a;})});}_0x2eba33=_[_0x59ad('0x33')]({},_0x2eba33,_0x4f3447[_0x59ad('0x52')]);return _0x8ece02[_0x59ad('0x74')](_0x2eba33);}})[_0x59ad('0x17')](function(_0x2dc760){if(_0x2dc760){_0x47abf4=_0x2dc760[_0x59ad('0x31')];if(!_0x4f3447[_0x59ad('0x2d')][_0x59ad('0x41')](_0x59ad('0x42'))){_0x2eba33['limit']=qs[_0x59ad('0x12')](_0x4f3447['query'][_0x59ad('0x12')]);_0x2eba33[_0x59ad('0x10')]=qs[_0x59ad('0x10')](_0x4f3447[_0x59ad('0x2d')]['offset']);}return _0x8ece02[_0x59ad('0x74')](_0x2eba33);}})[_0x59ad('0x17')](function(_0x54cdd5){if(_0x54cdd5){return _0x54cdd5?{'count':_0x47abf4,'rows':_0x54cdd5}:null;}})[_0x59ad('0x17')](respondWithResult(_0x54baac,null))[_0x59ad('0x29')](handleError(_0x54baac,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index 7867c11..c1f4ffe 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 _0xd9b2=['MailQueue','save','update','emit','hasOwnProperty','hook','../../mysqldb'];(function(_0x5bdb15,_0x8b3fc0){var _0x12270d=function(_0x3e315b){while(--_0x3e315b){_0x5bdb15['push'](_0x5bdb15['shift']());}};_0x12270d(++_0x8b3fc0);}(_0xd9b2,0x179));var _0x2d9b=function(_0x5a31ad,_0x30d5ec){_0x5a31ad=_0x5a31ad-0x0;var _0x460f7b=_0xd9b2[_0x5a31ad];return _0x460f7b;};'use strict';var EventEmitter=require('events');var MailQueue=require(_0x2d9b('0x0'))['db'][_0x2d9b('0x1')];var MailQueueEvents=new EventEmitter();MailQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x2d9b('0x2'),'afterUpdate':_0x2d9b('0x3'),'afterDestroy':'remove'};function emitEvent(_0x2c4ed7){return function(_0x1c8225,_0x391fab,_0x130ce1){MailQueueEvents[_0x2d9b('0x4')](_0x2c4ed7+':'+_0x1c8225['id'],_0x1c8225);MailQueueEvents[_0x2d9b('0x4')](_0x2c4ed7,_0x1c8225);_0x130ce1(null);};}for(var e in events){if(events[_0x2d9b('0x5')](e)){var event=events[e];MailQueue[_0x2d9b('0x6')](e,emitEvent(event));}}module['exports']=MailQueueEvents; \ No newline at end of file +var _0x33e1=['../../mysqldb','MailQueue','update','emit','hasOwnProperty','hook','exports','events'];(function(_0x4d858b,_0x1bc7a4){var _0x567043=function(_0xb34b20){while(--_0xb34b20){_0x4d858b['push'](_0x4d858b['shift']());}};_0x567043(++_0x1bc7a4);}(_0x33e1,0x167));var _0x133e=function(_0x252aa5,_0x3971b5){_0x252aa5=_0x252aa5-0x0;var _0x1f44d6=_0x33e1[_0x252aa5];return _0x1f44d6;};'use strict';var EventEmitter=require(_0x133e('0x0'));var MailQueue=require(_0x133e('0x1'))['db'][_0x133e('0x2')];var MailQueueEvents=new EventEmitter();MailQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x133e('0x3'),'afterDestroy':'remove'};function emitEvent(_0x161201){return function(_0x54e5b0,_0x47a1bf,_0x131f46){MailQueueEvents['emit'](_0x161201+':'+_0x54e5b0['id'],_0x54e5b0);MailQueueEvents[_0x133e('0x4')](_0x161201,_0x54e5b0);_0x131f46(null);};}for(var e in events){if(events[_0x133e('0x5')](e)){var event=events[e];MailQueue[_0x133e('0x6')](e,emitEvent(event));}}module[_0x133e('0x7')]=MailQueueEvents; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.model.js b/server/api/mailQueue/mailQueue.model.js index 6c3a307..4930de4 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 _0x88d3=['../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./mailQueue.attributes','define','MailQueue','mail_queues','lodash','util'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x88d3,0x10f));var _0x388d=function(_0x5e0550,_0x425c1d){_0x5e0550=_0x5e0550-0x0;var _0xa3179f=_0x88d3[_0x5e0550];return _0xa3179f;};'use strict';var _=require(_0x388d('0x0'));var util=require(_0x388d('0x1'));var logger=require(_0x388d('0x2'))(_0x388d('0x3'));var moment=require('moment');var BPromise=require(_0x388d('0x4'));var rp=require(_0x388d('0x5'));var fs=require('fs');var path=require(_0x388d('0x6'));var rimraf=require(_0x388d('0x7'));var config=require(_0x388d('0x8'));var attributes=require(_0x388d('0x9'));module['exports']=function(_0x881ba4,_0x2e953b){return _0x881ba4[_0x388d('0xa')](_0x388d('0xb'),attributes,{'tableName':_0x388d('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8b0e=['./mailQueue.attributes','exports','define','lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x4b2436,_0x452299){var _0x4f5ab2=function(_0x5c6679){while(--_0x5c6679){_0x4b2436['push'](_0x4b2436['shift']());}};_0x4f5ab2(++_0x452299);}(_0x8b0e,0x1dc));var _0xe8b0=function(_0x3399bb,_0x5e7c53){_0x3399bb=_0x3399bb-0x0;var _0x1afd51=_0x8b0e[_0x3399bb];return _0x1afd51;};'use strict';var _=require(_0xe8b0('0x0'));var util=require('util');var logger=require(_0xe8b0('0x1'))(_0xe8b0('0x2'));var moment=require(_0xe8b0('0x3'));var BPromise=require(_0xe8b0('0x4'));var rp=require(_0xe8b0('0x5'));var fs=require('fs');var path=require(_0xe8b0('0x6'));var rimraf=require('rimraf');var config=require(_0xe8b0('0x7'));var attributes=require(_0xe8b0('0x8'));module[_0xe8b0('0x9')]=function(_0x3f0176,_0x42e549){return _0x3f0176[_0xe8b0('0xa')]('MailQueue',attributes,{'tableName':'mail_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.rpc.js b/server/api/mailQueue/mailQueue.rpc.js index 1786c11..b638229 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 _0x67da=['options','raw','where','attributes','limit','map','include','model','info','debug','ShowMailQueue','find','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','defaults','redis','localhost','socket.io-emitter','./mailQueue.socket','register','request','then','MailQueue,\x20%s,\x20%s','request\x20sent','error','message','result','catch','GetMailQueue','MailQueue'];(function(_0x5f0089,_0x227e2c){var _0x193892=function(_0x24051f){while(--_0x24051f){_0x5f0089['push'](_0x5f0089['shift']());}};_0x193892(++_0x227e2c);}(_0x67da,0x192));var _0xa67d=function(_0x8d5c87,_0x6b47cd){_0x8d5c87=_0x8d5c87-0x0;var _0x327361=_0x67da[_0x8d5c87];return _0x327361;};'use strict';var _=require('lodash');var util=require(_0xa67d('0x0'));var moment=require(_0xa67d('0x1'));var BPromise=require(_0xa67d('0x2'));var rs=require(_0xa67d('0x3'));var fs=require('fs');var Redis=require(_0xa67d('0x4'));var db=require(_0xa67d('0x5'))['db'];var utils=require(_0xa67d('0x6'));var logger=require(_0xa67d('0x7'))(_0xa67d('0x8'));var config=require(_0xa67d('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0xa67d('0xa')]({'port':0x232a});config['redis']=_[_0xa67d('0xb')](config[_0xa67d('0xc')],{'host':_0xa67d('0xd'),'port':0x18eb});var socket=require(_0xa67d('0xe'))(new Redis(config[_0xa67d('0xc')]));require(_0xa67d('0xf'))[_0xa67d('0x10')](socket);function respondWithRpcPromise(_0x3e58e0,_0x1e1ef6,_0x3d9b30){return new BPromise(function(_0x52a024,_0x284d90){return client[_0xa67d('0x11')](_0x3e58e0,_0x3d9b30)[_0xa67d('0x12')](function(_0x2796ee){logger['info'](_0xa67d('0x13'),_0x1e1ef6,_0xa67d('0x14'));logger['debug']('MailQueue,\x20%s,\x20%s,\x20%s',_0x1e1ef6,_0xa67d('0x14'),JSON['stringify'](_0x2796ee));if(_0x2796ee[_0xa67d('0x15')]){if(_0x2796ee['error']['code']===0x1f4){logger[_0xa67d('0x15')](_0xa67d('0x13'),_0x1e1ef6,_0x2796ee['error'][_0xa67d('0x16')]);return _0x284d90(_0x2796ee[_0xa67d('0x15')][_0xa67d('0x16')]);}logger[_0xa67d('0x15')]('MailQueue,\x20%s,\x20%s',_0x1e1ef6,_0x2796ee['error']['message']);return _0x52a024(_0x2796ee['error'][_0xa67d('0x16')]);}else{logger['info'](_0xa67d('0x13'),_0x1e1ef6,_0xa67d('0x14'));_0x52a024(_0x2796ee[_0xa67d('0x17')][_0xa67d('0x16')]);}})[_0xa67d('0x18')](function(_0xb1ea04){logger[_0xa67d('0x15')]('MailQueue,\x20%s,\x20%s',_0x1e1ef6,_0xb1ea04);_0x284d90(_0xb1ea04);});});}exports[_0xa67d('0x19')]=function(_0x75055b){var _0x42f3d5=this;return new Promise(function(_0x45c57e,_0x28f38b){return db[_0xa67d('0x1a')]['findAll']({'raw':_0x75055b[_0xa67d('0x1b')]?_0x75055b[_0xa67d('0x1b')][_0xa67d('0x1c')]===undefined?!![]:![]:!![],'where':_0x75055b[_0xa67d('0x1b')]?_0x75055b[_0xa67d('0x1b')][_0xa67d('0x1d')]||null:null,'attributes':_0x75055b['options']?_0x75055b[_0xa67d('0x1b')][_0xa67d('0x1e')]||null:null,'limit':_0x75055b[_0xa67d('0x1b')]?_0x75055b[_0xa67d('0x1b')][_0xa67d('0x1f')]||null:null,'include':_0x75055b[_0xa67d('0x1b')]?_0x75055b[_0xa67d('0x1b')]['include']?_[_0xa67d('0x20')](_0x75055b[_0xa67d('0x1b')][_0xa67d('0x21')],function(_0xe0c7b2){return{'model':db[_0xe0c7b2[_0xa67d('0x22')]],'as':_0xe0c7b2['as'],'attributes':_0xe0c7b2[_0xa67d('0x1e')],'include':_0xe0c7b2['include']?_[_0xa67d('0x20')](_0xe0c7b2[_0xa67d('0x21')],function(_0x4e730e){return{'model':db[_0x4e730e[_0xa67d('0x22')]],'as':_0x4e730e['as'],'attributes':_0x4e730e[_0xa67d('0x1e')],'include':_0x4e730e[_0xa67d('0x21')]?_[_0xa67d('0x20')](_0x4e730e[_0xa67d('0x21')],function(_0x8793cf){return{'model':db[_0x8793cf[_0xa67d('0x22')]],'as':_0x8793cf['as'],'attributes':_0x8793cf[_0xa67d('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xa67d('0x12')](function(_0x152d94){logger[_0xa67d('0x23')](_0xa67d('0x19'),_0x75055b);logger[_0xa67d('0x24')](_0xa67d('0x19'),_0x75055b,JSON['stringify'](_0x152d94));_0x45c57e(_0x152d94);})[_0xa67d('0x18')](function(_0x20c751){logger[_0xa67d('0x15')](_0xa67d('0x19'),_0x20c751[_0xa67d('0x16')],_0x75055b);_0x28f38b(_0x42f3d5['error'](0x1f4,_0x20c751[_0xa67d('0x16')]));});});};exports[_0xa67d('0x25')]=function(_0x3f57ed){var _0x318090=this;return new Promise(function(_0x39faa1,_0x38e0b5){return db[_0xa67d('0x1a')][_0xa67d('0x26')]({'raw':_0x3f57ed[_0xa67d('0x1b')]?_0x3f57ed[_0xa67d('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x3f57ed[_0xa67d('0x1b')]?_0x3f57ed['options'][_0xa67d('0x1d')]||null:null,'attributes':_0x3f57ed[_0xa67d('0x1b')]?_0x3f57ed[_0xa67d('0x1b')]['attributes']||null:null,'include':_0x3f57ed[_0xa67d('0x1b')]?_0x3f57ed[_0xa67d('0x1b')][_0xa67d('0x21')]?_[_0xa67d('0x20')](_0x3f57ed[_0xa67d('0x1b')][_0xa67d('0x21')],function(_0x4ded76){return{'model':db[_0x4ded76[_0xa67d('0x22')]],'as':_0x4ded76['as'],'attributes':_0x4ded76[_0xa67d('0x1e')],'include':_0x4ded76['include']?_['map'](_0x4ded76['include'],function(_0x1bbc6f){return{'model':db[_0x1bbc6f['model']],'as':_0x1bbc6f['as'],'attributes':_0x1bbc6f[_0xa67d('0x1e')],'include':_0x1bbc6f[_0xa67d('0x21')]?_[_0xa67d('0x20')](_0x1bbc6f[_0xa67d('0x21')],function(_0x35a0a0){return{'model':db[_0x35a0a0[_0xa67d('0x22')]],'as':_0x35a0a0['as'],'attributes':_0x35a0a0[_0xa67d('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xa67d('0x12')](function(_0x1d278f){logger[_0xa67d('0x23')](_0xa67d('0x25'),_0x3f57ed);logger[_0xa67d('0x24')](_0xa67d('0x25'),_0x3f57ed,JSON['stringify'](_0x1d278f));_0x39faa1(_0x1d278f);})['catch'](function(_0x4f32fb){logger[_0xa67d('0x15')]('ShowMailQueue',_0x4f32fb[_0xa67d('0x16')],_0x3f57ed);_0x38e0b5(_0x318090[_0xa67d('0x15')](0x1f4,_0x4f32fb[_0xa67d('0x16')]));});});}; \ No newline at end of file +var _0xffbc=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','defaults','redis','./mailQueue.socket','request','then','info','MailQueue,\x20%s,\x20%s','request\x20sent','debug','MailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetMailQueue','findAll','options','where','attributes','limit','map','include','model','catch','MailQueue','find','raw','ShowMailQueue','lodash','util','moment'];(function(_0x6fb392,_0x254831){var _0x317c4b=function(_0x19994c){while(--_0x19994c){_0x6fb392['push'](_0x6fb392['shift']());}};_0x317c4b(++_0x254831);}(_0xffbc,0x14d));var _0xcffb=function(_0x1eda20,_0x1149f4){_0x1eda20=_0x1eda20-0x0;var _0x31b953=_0xffbc[_0x1eda20];return _0x31b953;};'use strict';var _=require(_0xcffb('0x0'));var util=require(_0xcffb('0x1'));var moment=require(_0xcffb('0x2'));var BPromise=require(_0xcffb('0x3'));var rs=require(_0xcffb('0x4'));var fs=require('fs');var Redis=require(_0xcffb('0x5'));var db=require(_0xcffb('0x6'))['db'];var utils=require(_0xcffb('0x7'));var logger=require(_0xcffb('0x8'))(_0xcffb('0x9'));var config=require(_0xcffb('0xa'));var jayson=require(_0xcffb('0xb'));var client=jayson[_0xcffb('0xc')]['http']({'port':0x232a});config['redis']=_[_0xcffb('0xd')](config[_0xcffb('0xe')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xcffb('0xe')]));require(_0xcffb('0xf'))['register'](socket);function respondWithRpcPromise(_0x2a6a25,_0x368824,_0x3958ec){return new BPromise(function(_0x10d06d,_0x284a58){return client[_0xcffb('0x10')](_0x2a6a25,_0x3958ec)[_0xcffb('0x11')](function(_0x2e4b94){logger[_0xcffb('0x12')](_0xcffb('0x13'),_0x368824,_0xcffb('0x14'));logger[_0xcffb('0x15')](_0xcffb('0x16'),_0x368824,_0xcffb('0x14'),JSON[_0xcffb('0x17')](_0x2e4b94));if(_0x2e4b94['error']){if(_0x2e4b94[_0xcffb('0x18')][_0xcffb('0x19')]===0x1f4){logger[_0xcffb('0x18')](_0xcffb('0x13'),_0x368824,_0x2e4b94[_0xcffb('0x18')][_0xcffb('0x1a')]);return _0x284a58(_0x2e4b94['error'][_0xcffb('0x1a')]);}logger[_0xcffb('0x18')](_0xcffb('0x13'),_0x368824,_0x2e4b94['error'][_0xcffb('0x1a')]);return _0x10d06d(_0x2e4b94[_0xcffb('0x18')][_0xcffb('0x1a')]);}else{logger[_0xcffb('0x12')](_0xcffb('0x13'),_0x368824,_0xcffb('0x14'));_0x10d06d(_0x2e4b94[_0xcffb('0x1b')][_0xcffb('0x1a')]);}})['catch'](function(_0x2e2a2c){logger[_0xcffb('0x18')]('MailQueue,\x20%s,\x20%s',_0x368824,_0x2e2a2c);_0x284a58(_0x2e2a2c);});});}exports[_0xcffb('0x1c')]=function(_0x1caa7e){var _0x219bb3=this;return new Promise(function(_0x11dc21,_0x4209b1){return db['MailQueue'][_0xcffb('0x1d')]({'raw':_0x1caa7e[_0xcffb('0x1e')]?_0x1caa7e['options']['raw']===undefined?!![]:![]:!![],'where':_0x1caa7e[_0xcffb('0x1e')]?_0x1caa7e[_0xcffb('0x1e')][_0xcffb('0x1f')]||null:null,'attributes':_0x1caa7e[_0xcffb('0x1e')]?_0x1caa7e[_0xcffb('0x1e')][_0xcffb('0x20')]||null:null,'limit':_0x1caa7e[_0xcffb('0x1e')]?_0x1caa7e[_0xcffb('0x1e')][_0xcffb('0x21')]||null:null,'include':_0x1caa7e[_0xcffb('0x1e')]?_0x1caa7e[_0xcffb('0x1e')]['include']?_[_0xcffb('0x22')](_0x1caa7e[_0xcffb('0x1e')][_0xcffb('0x23')],function(_0x36e3df){return{'model':db[_0x36e3df[_0xcffb('0x24')]],'as':_0x36e3df['as'],'attributes':_0x36e3df[_0xcffb('0x20')],'include':_0x36e3df['include']?_['map'](_0x36e3df[_0xcffb('0x23')],function(_0x2e6b52){return{'model':db[_0x2e6b52[_0xcffb('0x24')]],'as':_0x2e6b52['as'],'attributes':_0x2e6b52[_0xcffb('0x20')],'include':_0x2e6b52[_0xcffb('0x23')]?_[_0xcffb('0x22')](_0x2e6b52[_0xcffb('0x23')],function(_0x4b137d){return{'model':db[_0x4b137d['model']],'as':_0x4b137d['as'],'attributes':_0x4b137d[_0xcffb('0x20')]};}):[]};}):[]};}):[]:[]})[_0xcffb('0x11')](function(_0x2ca24b){logger[_0xcffb('0x12')](_0xcffb('0x1c'),_0x1caa7e);logger[_0xcffb('0x15')](_0xcffb('0x1c'),_0x1caa7e,JSON['stringify'](_0x2ca24b));_0x11dc21(_0x2ca24b);})[_0xcffb('0x25')](function(_0x3245ed){logger[_0xcffb('0x18')](_0xcffb('0x1c'),_0x3245ed[_0xcffb('0x1a')],_0x1caa7e);_0x4209b1(_0x219bb3[_0xcffb('0x18')](0x1f4,_0x3245ed['message']));});});};exports['ShowMailQueue']=function(_0x4c5b38){var _0x509ea4=this;return new Promise(function(_0xa7d0f7,_0x37e67c){return db[_0xcffb('0x26')][_0xcffb('0x27')]({'raw':_0x4c5b38[_0xcffb('0x1e')]?_0x4c5b38[_0xcffb('0x1e')][_0xcffb('0x28')]===undefined?!![]:![]:!![],'where':_0x4c5b38['options']?_0x4c5b38[_0xcffb('0x1e')][_0xcffb('0x1f')]||null:null,'attributes':_0x4c5b38[_0xcffb('0x1e')]?_0x4c5b38[_0xcffb('0x1e')]['attributes']||null:null,'include':_0x4c5b38[_0xcffb('0x1e')]?_0x4c5b38[_0xcffb('0x1e')]['include']?_[_0xcffb('0x22')](_0x4c5b38[_0xcffb('0x1e')][_0xcffb('0x23')],function(_0x1cee22){return{'model':db[_0x1cee22[_0xcffb('0x24')]],'as':_0x1cee22['as'],'attributes':_0x1cee22[_0xcffb('0x20')],'include':_0x1cee22[_0xcffb('0x23')]?_[_0xcffb('0x22')](_0x1cee22[_0xcffb('0x23')],function(_0x1dc480){return{'model':db[_0x1dc480['model']],'as':_0x1dc480['as'],'attributes':_0x1dc480[_0xcffb('0x20')],'include':_0x1dc480['include']?_[_0xcffb('0x22')](_0x1dc480[_0xcffb('0x23')],function(_0x29661d){return{'model':db[_0x29661d[_0xcffb('0x24')]],'as':_0x29661d['as'],'attributes':_0x29661d[_0xcffb('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2784b4){logger[_0xcffb('0x12')](_0xcffb('0x29'),_0x4c5b38);logger[_0xcffb('0x15')](_0xcffb('0x29'),_0x4c5b38,JSON['stringify'](_0x2784b4));_0xa7d0f7(_0x2784b4);})[_0xcffb('0x25')](function(_0x21793f){logger[_0xcffb('0x18')](_0xcffb('0x29'),_0x21793f[_0xcffb('0x1a')],_0x4c5b38);_0x37e67c(_0x509ea4[_0xcffb('0x18')](0x1f4,_0x21793f['message']));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index 38b8a71..0d283ca 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 _0xaa89=['length','mailQueue:','./mailQueue.events','save','remove','update','removeListener'];(function(_0x1819df,_0x18d901){var _0x50cd92=function(_0x4dfbd0){while(--_0x4dfbd0){_0x1819df['push'](_0x1819df['shift']());}};_0x50cd92(++_0x18d901);}(_0xaa89,0x18a));var _0x9aa8=function(_0x4fdc46,_0x2a3759){_0x4fdc46=_0x4fdc46-0x0;var _0x2c178a=_0xaa89[_0x4fdc46];return _0x2c178a;};'use strict';var MailQueueEvents=require(_0x9aa8('0x0'));var events=[_0x9aa8('0x1'),_0x9aa8('0x2'),_0x9aa8('0x3')];function createListener(_0x4b67e1,_0x4035bc){return function(_0x2d3a3d){_0x4035bc['emit'](_0x4b67e1,_0x2d3a3d);};}function removeListener(_0x3d04fb,_0x52b8b9){return function(){MailQueueEvents[_0x9aa8('0x4')](_0x3d04fb,_0x52b8b9);};}exports['register']=function(_0xa3935c){for(var _0x47de3b=0x0,_0x327c04=events[_0x9aa8('0x5')];_0x47de3b<_0x327c04;_0x47de3b++){var _0x40fc33=events[_0x47de3b];var _0x4075ac=createListener(_0x9aa8('0x6')+_0x40fc33,_0xa3935c);MailQueueEvents['on'](_0x40fc33,_0x4075ac);}}; \ No newline at end of file +var _0x5afb=['length','mailQueue:','./mailQueue.events','save','update','emit','removeListener'];(function(_0x11423d,_0x40da27){var _0x1a9a61=function(_0x11ce2d){while(--_0x11ce2d){_0x11423d['push'](_0x11423d['shift']());}};_0x1a9a61(++_0x40da27);}(_0x5afb,0x1c9));var _0xb5af=function(_0x48b5a2,_0x5014c7){_0x48b5a2=_0x48b5a2-0x0;var _0xc7f542=_0x5afb[_0x48b5a2];return _0xc7f542;};'use strict';var MailQueueEvents=require(_0xb5af('0x0'));var events=[_0xb5af('0x1'),'remove',_0xb5af('0x2')];function createListener(_0x4f14d3,_0x5661c1){return function(_0x2c0288){_0x5661c1[_0xb5af('0x3')](_0x4f14d3,_0x2c0288);};}function removeListener(_0x3dc64c,_0x46ac3d){return function(){MailQueueEvents[_0xb5af('0x4')](_0x3dc64c,_0x46ac3d);};}exports['register']=function(_0x5a8622){for(var _0x2a870a=0x0,_0x3f882c=events[_0xb5af('0x5')];_0x2a870a<_0x3f882c;_0x2a870a++){var _0x871eb5=events[_0x2a870a];var _0x2910c4=createListener(_0xb5af('0x6')+_0x871eb5,_0x5a8622);MailQueueEvents['on'](_0x871eb5,_0x2910c4);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index 46e8e2c..8106ac6 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 _0x96b8=['isAuthenticated','show','post','create','put','update','delete','destroy','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','./mailQueueReport.controller','get','index','/describe','/:id'];(function(_0xcf5436,_0x4632c3){var _0xc4f5c8=function(_0x567528){while(--_0x567528){_0xcf5436['push'](_0xcf5436['shift']());}};_0xc4f5c8(++_0x4632c3);}(_0x96b8,0x170));var _0x896b=function(_0x1fae35,_0x385d6a){_0x1fae35=_0x1fae35-0x0;var _0x22f1a7=_0x96b8[_0x1fae35];return _0x22f1a7;};'use strict';var multer=require(_0x896b('0x0'));var util=require(_0x896b('0x1'));var path=require(_0x896b('0x2'));var timeout=require(_0x896b('0x3'));var express=require(_0x896b('0x4'));var router=express['Router']();var fs_extra=require(_0x896b('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x896b('0x6'));var config=require('../../config/environment');var controller=require(_0x896b('0x7'));router[_0x896b('0x8')]('/',auth['isAuthenticated'](),controller[_0x896b('0x9')]);router['get'](_0x896b('0xa'),auth['isAuthenticated'](),controller['describe']);router['get'](_0x896b('0xb'),auth[_0x896b('0xc')](),controller[_0x896b('0xd')]);router[_0x896b('0xe')]('/',auth['isAuthenticated'](),controller[_0x896b('0xf')]);router[_0x896b('0x10')](_0x896b('0xb'),auth[_0x896b('0xc')](),controller[_0x896b('0x11')]);router[_0x896b('0x12')](_0x896b('0xb'),auth[_0x896b('0xc')](),controller[_0x896b('0x13')]);module['exports']=router; \ No newline at end of file +var _0x7ae0=['../../components/interaction/service','../../config/environment','./mailQueueReport.controller','isAuthenticated','get','/describe','describe','post','create','/:id','update','delete','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0xfad1a7,_0x2e3b8d){var _0x571012=function(_0x33255d){while(--_0x33255d){_0xfad1a7['push'](_0xfad1a7['shift']());}};_0x571012(++_0x2e3b8d);}(_0x7ae0,0x111));var _0x07ae=function(_0xd5ce2e,_0x1a9c9b){_0xd5ce2e=_0xd5ce2e-0x0;var _0x33bf51=_0x7ae0[_0xd5ce2e];return _0x33bf51;};'use strict';var multer=require('multer');var util=require(_0x07ae('0x0'));var path=require(_0x07ae('0x1'));var timeout=require(_0x07ae('0x2'));var express=require(_0x07ae('0x3'));var router=express[_0x07ae('0x4')]();var fs_extra=require(_0x07ae('0x5'));var auth=require(_0x07ae('0x6'));var interaction=require(_0x07ae('0x7'));var config=require(_0x07ae('0x8'));var controller=require(_0x07ae('0x9'));router['get']('/',auth[_0x07ae('0xa')](),controller['index']);router[_0x07ae('0xb')](_0x07ae('0xc'),auth[_0x07ae('0xa')](),controller[_0x07ae('0xd')]);router[_0x07ae('0xb')]('/:id',auth[_0x07ae('0xa')](),controller['show']);router[_0x07ae('0xe')]('/',auth[_0x07ae('0xa')](),controller[_0x07ae('0xf')]);router['put'](_0x07ae('0x10'),auth[_0x07ae('0xa')](),controller[_0x07ae('0x11')]);router[_0x07ae('0x12')]('/:id',auth[_0x07ae('0xa')](),controller[_0x07ae('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.attributes.js b/server/api/mailQueueReport/mailQueueReport.attributes.js index 88c0578..734702e 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 _0xd83c=['STRING','DATE'];(function(_0x617fd5,_0x1d0f93){var _0x54545f=function(_0x4f6b50){while(--_0x4f6b50){_0x617fd5['push'](_0x617fd5['shift']());}};_0x54545f(++_0x1d0f93);}(_0xd83c,0x8c));var _0xcd83=function(_0x1e9d62,_0x25bb8e){_0x1e9d62=_0x1e9d62-0x0;var _0x56c490=_0xd83c[_0x1e9d62];return _0x56c490;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0xcd83('0x0')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xcd83('0x1')]},'leaveAt':{'type':Sequelize[_0xcd83('0x1')]},'acceptAt':{'type':Sequelize[_0xcd83('0x1')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x741f=['STRING','DATE','moment','sequelize'];(function(_0x4256c1,_0x3ebd6b){var _0x51db9c=function(_0x25bfa2){while(--_0x25bfa2){_0x4256c1['push'](_0x4256c1['shift']());}};_0x51db9c(++_0x3ebd6b);}(_0x741f,0x76));var _0xf741=function(_0x4dfdb1,_0x5dd194){_0x4dfdb1=_0x4dfdb1-0x0;var _0x1c6fd5=_0x741f[_0x4dfdb1];return _0x1c6fd5;};'use strict';var moment=require(_0xf741('0x0'));var Sequelize=require(_0xf741('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xf741('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xf741('0x2')]},'joinAt':{'type':Sequelize[_0xf741('0x3')]},'leaveAt':{'type':Sequelize[_0xf741('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xf741('0x3')]},'reason':{'type':Sequelize[_0xf741('0x2')]}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index 4be14f5..e00718f 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 _0x583c=['rimraf','zip-dir','fast-json-patch','moment','bluebird','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','apply','reject','save','then','destroy','error','stack','name','index','map','MailQueueReport','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','keys','find','create','body','update','params','describe','eml-format'];(function(_0x510fb4,_0x526e9e){var _0x1c0b2d=function(_0xe8f161){while(--_0xe8f161){_0x510fb4['push'](_0x510fb4['shift']());}};_0x1c0b2d(++_0x526e9e);}(_0x583c,0x12b));var _0xc583=function(_0x1b1a3b,_0x52a88a){_0x1b1a3b=_0x1b1a3b-0x0;var _0x385347=_0x583c[_0x1b1a3b];return _0x385347;};'use strict';var emlformat=require(_0xc583('0x0'));var rimraf=require(_0xc583('0x1'));var zipdir=require(_0xc583('0x2'));var jsonpatch=require(_0xc583('0x3'));var rp=require('request-promise');var moment=require(_0xc583('0x4'));var BPromise=require(_0xc583('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xc583('0x6'));var sox=require(_0xc583('0x7'));var csv=require('to-csv');var ejs=require(_0xc583('0x8'));var fs=require('fs');var fs_extra=require(_0xc583('0x9'));var _=require(_0xc583('0xa'));var squel=require(_0xc583('0xb'));var crypto=require('crypto');var jsforce=require(_0xc583('0xc'));var deskjs=require(_0xc583('0xd'));var toCsv=require('to-csv');var querystring=require(_0xc583('0xe'));var Papa=require(_0xc583('0xf'));var Redis=require(_0xc583('0x10'));var authService=require(_0xc583('0x11'));var qs=require(_0xc583('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc583('0x13'));var logger=require(_0xc583('0x14'))('api');var utils=require(_0xc583('0x15'));var config=require(_0xc583('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xc583('0x17'))['db'];function respondWithStatusCode(_0x87632d,_0x24343b){_0x24343b=_0x24343b||0xcc;return function(_0x267da0){if(_0x267da0){return _0x87632d[_0xc583('0x18')](_0x24343b);}return _0x87632d[_0xc583('0x19')](_0x24343b)[_0xc583('0x1a')]();};}function respondWithResult(_0xf81809,_0x1c6b79){_0x1c6b79=_0x1c6b79||0xc8;return function(_0x5403a3){if(_0x5403a3){return _0xf81809[_0xc583('0x19')](_0x1c6b79)['json'](_0x5403a3);}};}function respondWithFilteredResult(_0x19f46a,_0x299fa1){return function(_0x510090){if(_0x510090){var _0x263552=typeof _0x299fa1[_0xc583('0x1b')]==='undefined'&&typeof _0x299fa1[_0xc583('0x1c')]===_0xc583('0x1d');var _0x5127fa=_0x510090[_0xc583('0x1e')];var _0x8a2d84=_0x263552?0x0:_0x299fa1[_0xc583('0x1b')];var _0x36e0fd=_0x263552?_0x510090['count']:_0x299fa1[_0xc583('0x1b')]+_0x299fa1['limit'];var _0x227ec2;if(_0x36e0fd>=_0x5127fa){_0x36e0fd=_0x5127fa;_0x227ec2=0xc8;}else{_0x227ec2=0xce;}_0x19f46a[_0xc583('0x19')](_0x227ec2);return _0x19f46a[_0xc583('0x1f')](_0xc583('0x20'),_0x8a2d84+'-'+_0x36e0fd+'/'+_0x5127fa)[_0xc583('0x21')](_0x510090);}return null;};}function patchUpdates(_0x12b910){return function(_0x3ce81b){try{jsonpatch[_0xc583('0x22')](_0x3ce81b,_0x12b910,!![]);}catch(_0x37fcd4){return BPromise[_0xc583('0x23')](_0x37fcd4);}return _0x3ce81b[_0xc583('0x24')]();};}function saveUpdates(_0x3b31bc,_0x21466f){return function(_0x478ee1){if(_0x478ee1){return _0x478ee1['update'](_0x3b31bc)[_0xc583('0x25')](function(_0x3e075c){return _0x3e075c;});}return null;};}function removeEntity(_0x8443dc,_0x5ceef1){return function(_0x1521e2){if(_0x1521e2){return _0x1521e2[_0xc583('0x26')]()[_0xc583('0x25')](function(){_0x8443dc[_0xc583('0x19')](0xcc)[_0xc583('0x1a')]();});}};}function handleEntityNotFound(_0x48c95e,_0x4cad36){return function(_0x45871c){if(!_0x45871c){_0x48c95e['sendStatus'](0x194);}return _0x45871c;};}function handleError(_0x45ef74,_0xcbe9b2){_0xcbe9b2=_0xcbe9b2||0x1f4;return function(_0xbabf24){logger[_0xc583('0x27')](_0xbabf24[_0xc583('0x28')]);if(_0xbabf24['name']){delete _0xbabf24[_0xc583('0x29')];}_0x45ef74[_0xc583('0x19')](_0xcbe9b2)['send'](_0xbabf24);};}exports[_0xc583('0x2a')]=function(_0x483357,_0x2c9088){var _0x8d4ecb={},_0x1c80b1={},_0x3ed083={'count':0x0,'rows':[]};var _0x1b2b49=_[_0xc583('0x2b')](db[_0xc583('0x2c')]['rawAttributes'],function(_0x529dbe){return{'name':_0x529dbe[_0xc583('0x2d')],'type':_0x529dbe[_0xc583('0x2e')][_0xc583('0x2f')]};});_0x1c80b1[_0xc583('0x30')]=_[_0xc583('0x2b')](_0x1b2b49,'name');_0x1c80b1[_0xc583('0x31')]=_['keys'](_0x483357['query']);_0x1c80b1[_0xc583('0x32')]=_[_0xc583('0x33')](_0x1c80b1[_0xc583('0x30')],_0x1c80b1[_0xc583('0x31')]);_0x8d4ecb[_0xc583('0x34')]=_['intersection'](_0x1c80b1[_0xc583('0x30')],qs[_0xc583('0x35')](_0x483357[_0xc583('0x31')]['fields']));_0x8d4ecb[_0xc583('0x34')]=_0x8d4ecb['attributes'][_0xc583('0x36')]?_0x8d4ecb[_0xc583('0x34')]:_0x1c80b1[_0xc583('0x30')];if(!_0x483357[_0xc583('0x31')][_0xc583('0x37')]('nolimit')){_0x8d4ecb[_0xc583('0x1c')]=qs['limit'](_0x483357[_0xc583('0x31')]['limit']);_0x8d4ecb[_0xc583('0x1b')]=qs[_0xc583('0x1b')](_0x483357[_0xc583('0x31')][_0xc583('0x1b')]);}_0x8d4ecb[_0xc583('0x38')]=qs[_0xc583('0x39')](_0x483357['query']['sort']);_0x8d4ecb[_0xc583('0x3a')]=qs[_0xc583('0x32')](_['pick'](_0x483357[_0xc583('0x31')],_0x1c80b1[_0xc583('0x32')]),_0x1b2b49);if(_0x483357[_0xc583('0x31')][_0xc583('0x3b')]){_0x8d4ecb[_0xc583('0x3a')]=_[_0xc583('0x3c')](_0x8d4ecb['where'],{'$or':_[_0xc583('0x2b')](_0x1b2b49,function(_0x595351){if(_0x595351[_0xc583('0x2e')]!==_0xc583('0x3d')){var _0x39bed4={};_0x39bed4[_0x595351['name']]={'$like':'%'+_0x483357['query']['filter']+'%'};return _0x39bed4;}})});}_0x8d4ecb=_[_0xc583('0x3c')]({},_0x8d4ecb,_0x483357[_0xc583('0x3e')]);var _0x2b957d={'where':_0x8d4ecb[_0xc583('0x3a')]};return db['MailQueueReport'][_0xc583('0x1e')](_0x2b957d)[_0xc583('0x25')](function(_0x594a0b){_0x3ed083['count']=_0x594a0b;if(_0x483357[_0xc583('0x31')]['includeAll']){_0x8d4ecb[_0xc583('0x3f')]=[{'all':!![]}];}return db[_0xc583('0x2c')][_0xc583('0x40')](_0x8d4ecb);})[_0xc583('0x25')](function(_0x58553e){_0x3ed083[_0xc583('0x41')]=_0x58553e;return _0x3ed083;})[_0xc583('0x25')](respondWithFilteredResult(_0x2c9088,_0x8d4ecb))[_0xc583('0x42')](handleError(_0x2c9088,null));};exports[_0xc583('0x43')]=function(_0x2c1c22,_0x5e6e7e){var _0x3ffeb7={'raw':!![],'where':{'id':_0x2c1c22['params']['id']}},_0x5f5a97={};_0x5f5a97[_0xc583('0x30')]=_[_0xc583('0x44')](db['MailQueueReport']['rawAttributes']);_0x5f5a97[_0xc583('0x31')]=_[_0xc583('0x44')](_0x2c1c22[_0xc583('0x31')]);_0x5f5a97[_0xc583('0x32')]=_['intersection'](_0x5f5a97[_0xc583('0x30')],_0x5f5a97['query']);_0x3ffeb7[_0xc583('0x34')]=_['intersection'](_0x5f5a97[_0xc583('0x30')],qs[_0xc583('0x35')](_0x2c1c22[_0xc583('0x31')][_0xc583('0x35')]));_0x3ffeb7[_0xc583('0x34')]=_0x3ffeb7['attributes'][_0xc583('0x36')]?_0x3ffeb7[_0xc583('0x34')]:_0x5f5a97[_0xc583('0x30')];if(_0x2c1c22['query']['includeAll']){_0x3ffeb7['include']=[{'all':!![]}];}_0x3ffeb7=_[_0xc583('0x3c')]({},_0x3ffeb7,_0x2c1c22['options']);return db[_0xc583('0x2c')][_0xc583('0x45')](_0x3ffeb7)[_0xc583('0x25')](handleEntityNotFound(_0x5e6e7e,null))[_0xc583('0x25')](respondWithResult(_0x5e6e7e,null))[_0xc583('0x42')](handleError(_0x5e6e7e,null));};exports[_0xc583('0x46')]=function(_0x302038,_0x32cfbf){return db[_0xc583('0x2c')][_0xc583('0x46')](_0x302038[_0xc583('0x47')],{})['then'](respondWithResult(_0x32cfbf,0xc9))[_0xc583('0x42')](handleError(_0x32cfbf,null));};exports[_0xc583('0x48')]=function(_0x453df7,_0x230a45){if(_0x453df7['body']['id']){delete _0x453df7[_0xc583('0x47')]['id'];}return db[_0xc583('0x2c')][_0xc583('0x45')]({'where':{'id':_0x453df7[_0xc583('0x49')]['id']}})[_0xc583('0x25')](handleEntityNotFound(_0x230a45,null))[_0xc583('0x25')](saveUpdates(_0x453df7[_0xc583('0x47')],null))[_0xc583('0x25')](respondWithResult(_0x230a45,null))[_0xc583('0x42')](handleError(_0x230a45,null));};exports['destroy']=function(_0x1f4901,_0x1919fa){return db[_0xc583('0x2c')][_0xc583('0x45')]({'where':{'id':_0x1f4901[_0xc583('0x49')]['id']}})[_0xc583('0x25')](handleEntityNotFound(_0x1919fa,null))[_0xc583('0x25')](removeEntity(_0x1919fa,null))[_0xc583('0x42')](handleError(_0x1919fa,null));};exports[_0xc583('0x4a')]=function(_0xa03d53,_0x1a0f91){return db[_0xc583('0x2c')][_0xc583('0x4a')]()['then'](respondWithResult(_0x1a0f91,null))[_0xc583('0x42')](handleError(_0x1a0f91,null));}; \ No newline at end of file +var _0x57ca=['to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','status','json','offset','undefined','count','limit','set','apply','save','update','then','destroy','end','sendStatus','error','stack','name','index','map','MailQueueReport','type','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','options','includeAll','include','findAll','params','find','catch','create','body','describe','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox'];(function(_0x36d1b6,_0x317571){var _0x23226d=function(_0x262592){while(--_0x262592){_0x36d1b6['push'](_0x36d1b6['shift']());}};_0x23226d(++_0x317571);}(_0x57ca,0x108));var _0xa57c=function(_0x3b08bf,_0x4ce99b){_0x3b08bf=_0x3b08bf-0x0;var _0x2a0706=_0x57ca[_0x3b08bf];return _0x2a0706;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa57c('0x0'));var zipdir=require(_0xa57c('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa57c('0x2'));var moment=require(_0xa57c('0x3'));var BPromise=require(_0xa57c('0x4'));var Mustache=require(_0xa57c('0x5'));var util=require(_0xa57c('0x6'));var path=require('path');var sox=require(_0xa57c('0x7'));var csv=require(_0xa57c('0x8'));var ejs=require(_0xa57c('0x9'));var fs=require('fs');var fs_extra=require(_0xa57c('0xa'));var _=require(_0xa57c('0xb'));var squel=require(_0xa57c('0xc'));var crypto=require(_0xa57c('0xd'));var jsforce=require(_0xa57c('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xa57c('0x8'));var querystring=require('querystring');var Papa=require(_0xa57c('0xf'));var Redis=require(_0xa57c('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xa57c('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa57c('0x12'));var logger=require(_0xa57c('0x13'))('api');var utils=require(_0xa57c('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xa57c('0x15'));var db=require(_0xa57c('0x16'))['db'];function respondWithStatusCode(_0x1f2bb5,_0x9e25bf){_0x9e25bf=_0x9e25bf||0xcc;return function(_0x205e72){if(_0x205e72){return _0x1f2bb5['sendStatus'](_0x9e25bf);}return _0x1f2bb5[_0xa57c('0x17')](_0x9e25bf)['end']();};}function respondWithResult(_0x30d23d,_0x3d5995){_0x3d5995=_0x3d5995||0xc8;return function(_0x30940d){if(_0x30940d){return _0x30d23d[_0xa57c('0x17')](_0x3d5995)[_0xa57c('0x18')](_0x30940d);}};}function respondWithFilteredResult(_0x37a323,_0x3f900a){return function(_0x4b4bdb){if(_0x4b4bdb){var _0x26607a=typeof _0x3f900a[_0xa57c('0x19')]===_0xa57c('0x1a')&&typeof _0x3f900a['limit']===_0xa57c('0x1a');var _0x5f33f1=_0x4b4bdb[_0xa57c('0x1b')];var _0x3d781d=_0x26607a?0x0:_0x3f900a[_0xa57c('0x19')];var _0xe3d505=_0x26607a?_0x4b4bdb[_0xa57c('0x1b')]:_0x3f900a[_0xa57c('0x19')]+_0x3f900a[_0xa57c('0x1c')];var _0x595c7a;if(_0xe3d505>=_0x5f33f1){_0xe3d505=_0x5f33f1;_0x595c7a=0xc8;}else{_0x595c7a=0xce;}_0x37a323['status'](_0x595c7a);return _0x37a323[_0xa57c('0x1d')]('Content-Range',_0x3d781d+'-'+_0xe3d505+'/'+_0x5f33f1)['json'](_0x4b4bdb);}return null;};}function patchUpdates(_0x418415){return function(_0xa5b314){try{jsonpatch[_0xa57c('0x1e')](_0xa5b314,_0x418415,!![]);}catch(_0x23bec0){return BPromise['reject'](_0x23bec0);}return _0xa5b314[_0xa57c('0x1f')]();};}function saveUpdates(_0x25715f,_0x34d1bc){return function(_0x2213b2){if(_0x2213b2){return _0x2213b2[_0xa57c('0x20')](_0x25715f)[_0xa57c('0x21')](function(_0x1e0192){return _0x1e0192;});}return null;};}function removeEntity(_0x42038e,_0x2e99ed){return function(_0xdf65dd){if(_0xdf65dd){return _0xdf65dd[_0xa57c('0x22')]()[_0xa57c('0x21')](function(){_0x42038e[_0xa57c('0x17')](0xcc)[_0xa57c('0x23')]();});}};}function handleEntityNotFound(_0x431bec,_0x511a26){return function(_0x2db443){if(!_0x2db443){_0x431bec[_0xa57c('0x24')](0x194);}return _0x2db443;};}function handleError(_0x27884d,_0x5228b9){_0x5228b9=_0x5228b9||0x1f4;return function(_0x315ad7){logger[_0xa57c('0x25')](_0x315ad7[_0xa57c('0x26')]);if(_0x315ad7[_0xa57c('0x27')]){delete _0x315ad7[_0xa57c('0x27')];}_0x27884d[_0xa57c('0x17')](_0x5228b9)['send'](_0x315ad7);};}exports[_0xa57c('0x28')]=function(_0x4c1478,_0x54a18b){var _0x257661={},_0x7d10ec={},_0x5a3e03={'count':0x0,'rows':[]};var _0x12898b=_[_0xa57c('0x29')](db[_0xa57c('0x2a')]['rawAttributes'],function(_0xd779f1){return{'name':_0xd779f1['fieldName'],'type':_0xd779f1[_0xa57c('0x2b')]['key']};});_0x7d10ec[_0xa57c('0x2c')]=_['map'](_0x12898b,_0xa57c('0x27'));_0x7d10ec['query']=_[_0xa57c('0x2d')](_0x4c1478[_0xa57c('0x2e')]);_0x7d10ec[_0xa57c('0x2f')]=_[_0xa57c('0x30')](_0x7d10ec[_0xa57c('0x2c')],_0x7d10ec[_0xa57c('0x2e')]);_0x257661[_0xa57c('0x31')]=_['intersection'](_0x7d10ec[_0xa57c('0x2c')],qs['fields'](_0x4c1478[_0xa57c('0x2e')][_0xa57c('0x32')]));_0x257661[_0xa57c('0x31')]=_0x257661['attributes'][_0xa57c('0x33')]?_0x257661['attributes']:_0x7d10ec[_0xa57c('0x2c')];if(!_0x4c1478['query'][_0xa57c('0x34')]('nolimit')){_0x257661[_0xa57c('0x1c')]=qs[_0xa57c('0x1c')](_0x4c1478['query'][_0xa57c('0x1c')]);_0x257661['offset']=qs[_0xa57c('0x19')](_0x4c1478['query'][_0xa57c('0x19')]);}_0x257661[_0xa57c('0x35')]=qs[_0xa57c('0x36')](_0x4c1478[_0xa57c('0x2e')][_0xa57c('0x36')]);_0x257661[_0xa57c('0x37')]=qs['filters'](_['pick'](_0x4c1478[_0xa57c('0x2e')],_0x7d10ec[_0xa57c('0x2f')]),_0x12898b);if(_0x4c1478[_0xa57c('0x2e')]['filter']){_0x257661[_0xa57c('0x37')]=_['merge'](_0x257661[_0xa57c('0x37')],{'$or':_[_0xa57c('0x29')](_0x12898b,function(_0x5c8256){if(_0x5c8256['type']!=='VIRTUAL'){var _0x3be888={};_0x3be888[_0x5c8256[_0xa57c('0x27')]]={'$like':'%'+_0x4c1478[_0xa57c('0x2e')][_0xa57c('0x38')]+'%'};return _0x3be888;}})});}_0x257661=_[_0xa57c('0x39')]({},_0x257661,_0x4c1478[_0xa57c('0x3a')]);var _0x5a444a={'where':_0x257661[_0xa57c('0x37')]};return db[_0xa57c('0x2a')]['count'](_0x5a444a)['then'](function(_0x5e10b){_0x5a3e03[_0xa57c('0x1b')]=_0x5e10b;if(_0x4c1478['query'][_0xa57c('0x3b')]){_0x257661[_0xa57c('0x3c')]=[{'all':!![]}];}return db[_0xa57c('0x2a')][_0xa57c('0x3d')](_0x257661);})[_0xa57c('0x21')](function(_0x43c1d7){_0x5a3e03['rows']=_0x43c1d7;return _0x5a3e03;})[_0xa57c('0x21')](respondWithFilteredResult(_0x54a18b,_0x257661))['catch'](handleError(_0x54a18b,null));};exports['show']=function(_0x5b3300,_0x520383){var _0x588199={'raw':!![],'where':{'id':_0x5b3300[_0xa57c('0x3e')]['id']}},_0x39b20f={};_0x39b20f[_0xa57c('0x2c')]=_['keys'](db['MailQueueReport']['rawAttributes']);_0x39b20f[_0xa57c('0x2e')]=_[_0xa57c('0x2d')](_0x5b3300[_0xa57c('0x2e')]);_0x39b20f[_0xa57c('0x2f')]=_[_0xa57c('0x30')](_0x39b20f[_0xa57c('0x2c')],_0x39b20f['query']);_0x588199[_0xa57c('0x31')]=_[_0xa57c('0x30')](_0x39b20f[_0xa57c('0x2c')],qs[_0xa57c('0x32')](_0x5b3300[_0xa57c('0x2e')][_0xa57c('0x32')]));_0x588199['attributes']=_0x588199[_0xa57c('0x31')][_0xa57c('0x33')]?_0x588199[_0xa57c('0x31')]:_0x39b20f[_0xa57c('0x2c')];if(_0x5b3300[_0xa57c('0x2e')]['includeAll']){_0x588199[_0xa57c('0x3c')]=[{'all':!![]}];}_0x588199=_[_0xa57c('0x39')]({},_0x588199,_0x5b3300[_0xa57c('0x3a')]);return db[_0xa57c('0x2a')][_0xa57c('0x3f')](_0x588199)[_0xa57c('0x21')](handleEntityNotFound(_0x520383,null))['then'](respondWithResult(_0x520383,null))[_0xa57c('0x40')](handleError(_0x520383,null));};exports[_0xa57c('0x41')]=function(_0x247906,_0x44ea0a){return db[_0xa57c('0x2a')][_0xa57c('0x41')](_0x247906['body'],{})['then'](respondWithResult(_0x44ea0a,0xc9))['catch'](handleError(_0x44ea0a,null));};exports['update']=function(_0x232675,_0x49492f){if(_0x232675[_0xa57c('0x42')]['id']){delete _0x232675[_0xa57c('0x42')]['id'];}return db['MailQueueReport'][_0xa57c('0x3f')]({'where':{'id':_0x232675[_0xa57c('0x3e')]['id']}})[_0xa57c('0x21')](handleEntityNotFound(_0x49492f,null))[_0xa57c('0x21')](saveUpdates(_0x232675[_0xa57c('0x42')],null))['then'](respondWithResult(_0x49492f,null))[_0xa57c('0x40')](handleError(_0x49492f,null));};exports[_0xa57c('0x22')]=function(_0x4584e8,_0xd57bac){return db[_0xa57c('0x2a')]['find']({'where':{'id':_0x4584e8[_0xa57c('0x3e')]['id']}})['then'](handleEntityNotFound(_0xd57bac,null))['then'](removeEntity(_0xd57bac,null))[_0xa57c('0x40')](handleError(_0xd57bac,null));};exports[_0xa57c('0x43')]=function(_0x5ded49,_0x5bf336){return db['MailQueueReport'][_0xa57c('0x43')]()[_0xa57c('0x21')](respondWithResult(_0x5bf336,null))[_0xa57c('0x40')](handleError(_0x5bf336,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index 49ad0d2..0bdc5db 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 _0x072e=['api','moment','request-promise','path','rimraf','./mailQueueReport.attributes','define','MailQueueReport','report_mail_queue','uniqueid','lodash','util','../../config/logger'];(function(_0x58ac34,_0x5b5bfb){var _0x3921ab=function(_0x172dd5){while(--_0x172dd5){_0x58ac34['push'](_0x58ac34['shift']());}};_0x3921ab(++_0x5b5bfb);}(_0x072e,0x1aa));var _0xe072=function(_0x225fbc,_0x44c645){_0x225fbc=_0x225fbc-0x0;var _0x35d151=_0x072e[_0x225fbc];return _0x35d151;};'use strict';var _=require(_0xe072('0x0'));var util=require(_0xe072('0x1'));var logger=require(_0xe072('0x2'))(_0xe072('0x3'));var moment=require(_0xe072('0x4'));var BPromise=require('bluebird');var rp=require(_0xe072('0x5'));var fs=require('fs');var path=require(_0xe072('0x6'));var rimraf=require(_0xe072('0x7'));var config=require('../../config/environment');var attributes=require(_0xe072('0x8'));module['exports']=function(_0x4446ae,_0x2d03a5){return _0x4446ae[_0xe072('0x9')](_0xe072('0xa'),attributes,{'tableName':_0xe072('0xb'),'paranoid':![],'indexes':[{'name':_0xe072('0xc'),'fields':[_0xe072('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5d23=['rimraf','../../config/environment','./mailQueueReport.attributes','define','MailQueueReport','report_mail_queue','uniqueid','lodash','../../config/logger','api','moment','bluebird','path'];(function(_0xbd08b4,_0x4790ed){var _0x314f1e=function(_0x161589){while(--_0x161589){_0xbd08b4['push'](_0xbd08b4['shift']());}};_0x314f1e(++_0x4790ed);}(_0x5d23,0x6f));var _0x35d2=function(_0x319224,_0x42100e){_0x319224=_0x319224-0x0;var _0xc1bb74=_0x5d23[_0x319224];return _0xc1bb74;};'use strict';var _=require(_0x35d2('0x0'));var util=require('util');var logger=require(_0x35d2('0x1'))(_0x35d2('0x2'));var moment=require(_0x35d2('0x3'));var BPromise=require(_0x35d2('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x35d2('0x5'));var rimraf=require(_0x35d2('0x6'));var config=require(_0x35d2('0x7'));var attributes=require(_0x35d2('0x8'));module['exports']=function(_0x37b700,_0x4edb41){return _0x37b700[_0x35d2('0x9')](_0x35d2('0xa'),attributes,{'tableName':_0x35d2('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x35d2('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.rpc.js b/server/api/mailQueueReport/mailQueueReport.rpc.js index 3655474..25c52ee 100644 --- a/server/api/mailQueueReport/mailQueueReport.rpc.js +++ b/server/api/mailQueueReport/mailQueueReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc4aa=['create','body','options','raw','update','where','attributes','limit','UpdateMailQueueReport','stringify','lodash','util','moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','then','MailQueueReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','catch','CreateMailQueueReport','MailQueueReport'];(function(_0x4fc29f,_0x338677){var _0x2b55e8=function(_0x5846a8){while(--_0x5846a8){_0x4fc29f['push'](_0x4fc29f['shift']());}};_0x2b55e8(++_0x338677);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0xc4aa[_0x53ccf2];return _0x5a2964;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var moment=require(_0xac4a('0x2'));var BPromise=require(_0xac4a('0x3'));var rs=require(_0xac4a('0x4'));var fs=require('fs');var Redis=require(_0xac4a('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xac4a('0x6'));var config=require(_0xac4a('0x7'));var jayson=require(_0xac4a('0x8'));var client=jayson[_0xac4a('0x9')][_0xac4a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x15cd34,_0x3ef77c,_0x10525b){return new BPromise(function(_0x5c6179,_0x5b8339){return client[_0xac4a('0xb')](_0x15cd34,_0x10525b)[_0xac4a('0xc')](function(_0x26ec84){logger['info'](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));logger[_0xac4a('0xf')]('MailQueueReport,\x20%s,\x20%s,\x20%s',_0x3ef77c,_0xac4a('0xe'),JSON['stringify'](_0x26ec84));if(_0x26ec84[_0xac4a('0x10')]){if(_0x26ec84['error'][_0xac4a('0x11')]===0x1f4){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84['error'][_0xac4a('0x12')]);return _0x5b8339(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);return _0x5c6179(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}else{logger[_0xac4a('0x13')](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));_0x5c6179(_0x26ec84['result'][_0xac4a('0x12')]);}})[_0xac4a('0x14')](function(_0x23eb66){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x23eb66);_0x5b8339(_0x23eb66);});});}exports[_0xac4a('0x15')]=function(_0x28e304){var _0x44ec59=this;return new Promise(function(_0x546c5d,_0x5ac21e){return db[_0xac4a('0x16')][_0xac4a('0x17')](_0x28e304[_0xac4a('0x18')],{'raw':_0x28e304['options']?_0x28e304[_0xac4a('0x19')][_0xac4a('0x1a')]===undefined?!![]:![]:!![]})[_0xac4a('0xc')](function(_0x3a3cdb){logger[_0xac4a('0x13')](_0xac4a('0x15'),_0x28e304);logger[_0xac4a('0xf')](_0xac4a('0x15'),_0x28e304,JSON['stringify'](_0x3a3cdb));_0x546c5d(_0x3a3cdb);})[_0xac4a('0x14')](function(_0x3204ad){logger['error'](_0xac4a('0x15'),_0x3204ad[_0xac4a('0x12')],_0x28e304);_0x5ac21e(_0x44ec59[_0xac4a('0x10')](0x1f4,_0x3204ad[_0xac4a('0x12')]));});});};exports['UpdateMailQueueReport']=function(_0x1b7998){var _0x2503d8=this;return new Promise(function(_0x15435c,_0x412494){return db[_0xac4a('0x16')][_0xac4a('0x1b')](_0x1b7998[_0xac4a('0x18')],{'raw':_0x1b7998[_0xac4a('0x19')]?_0x1b7998[_0xac4a('0x19')][_0xac4a('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1b7998[_0xac4a('0x19')]?_0x1b7998[_0xac4a('0x19')][_0xac4a('0x1c')]||null:null,'attributes':_0x1b7998[_0xac4a('0x19')]?_0x1b7998[_0xac4a('0x19')][_0xac4a('0x1d')]||null:null,'limit':_0x1b7998['options']?_0x1b7998[_0xac4a('0x19')][_0xac4a('0x1e')]||null:null})[_0xac4a('0xc')](function(_0x2772fe){logger[_0xac4a('0x13')]('UpdateMailQueueReport',_0x1b7998);logger['debug'](_0xac4a('0x1f'),_0x1b7998,JSON[_0xac4a('0x20')](_0x2772fe));_0x15435c(_0x2772fe);})[_0xac4a('0x14')](function(_0x546b65){logger['error'](_0xac4a('0x1f'),_0x546b65[_0xac4a('0x12')],_0x1b7998);_0x412494(_0x2503d8[_0xac4a('0x10')](0x1f4,_0x546b65[_0xac4a('0x12')]));});});}; \ No newline at end of file +var _0xc4aa=['create','body','options','raw','update','where','attributes','limit','UpdateMailQueueReport','stringify','lodash','util','moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','then','MailQueueReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','catch','CreateMailQueueReport','MailQueueReport'];(function(_0x5623b1,_0x96aadd){var _0x4f2416=function(_0x26db56){while(--_0x26db56){_0x5623b1['push'](_0x5623b1['shift']());}};_0x4f2416(++_0x96aadd);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x4792c8,_0x5158a1){_0x4792c8=_0x4792c8-0x0;var _0x35edb1=_0xc4aa[_0x4792c8];return _0x35edb1;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var moment=require(_0xac4a('0x2'));var BPromise=require(_0xac4a('0x3'));var rs=require(_0xac4a('0x4'));var fs=require('fs');var Redis=require(_0xac4a('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xac4a('0x6'));var config=require(_0xac4a('0x7'));var jayson=require(_0xac4a('0x8'));var client=jayson[_0xac4a('0x9')][_0xac4a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x15cd34,_0x3ef77c,_0x10525b){return new BPromise(function(_0x5c6179,_0x5b8339){return client[_0xac4a('0xb')](_0x15cd34,_0x10525b)[_0xac4a('0xc')](function(_0x26ec84){logger['info'](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));logger[_0xac4a('0xf')]('MailQueueReport,\x20%s,\x20%s,\x20%s',_0x3ef77c,_0xac4a('0xe'),JSON['stringify'](_0x26ec84));if(_0x26ec84[_0xac4a('0x10')]){if(_0x26ec84['error'][_0xac4a('0x11')]===0x1f4){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84['error'][_0xac4a('0x12')]);return _0x5b8339(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);return _0x5c6179(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}else{logger[_0xac4a('0x13')](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));_0x5c6179(_0x26ec84['result'][_0xac4a('0x12')]);}})[_0xac4a('0x14')](function(_0x23eb66){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x23eb66);_0x5b8339(_0x23eb66);});});}exports[_0xac4a('0x15')]=function(_0x28e304){var _0x44ec59=this;return new Promise(function(_0x546c5d,_0x5ac21e){return db[_0xac4a('0x16')][_0xac4a('0x17')](_0x28e304[_0xac4a('0x18')],{'raw':_0x28e304['options']?_0x28e304[_0xac4a('0x19')][_0xac4a('0x1a')]===undefined?!![]:![]:!![]})[_0xac4a('0xc')](function(_0x3a3cdb){logger[_0xac4a('0x13')](_0xac4a('0x15'),_0x28e304);logger[_0xac4a('0xf')](_0xac4a('0x15'),_0x28e304,JSON['stringify'](_0x3a3cdb));_0x546c5d(_0x3a3cdb);})[_0xac4a('0x14')](function(_0x3204ad){logger['error'](_0xac4a('0x15'),_0x3204ad[_0xac4a('0x12')],_0x28e304);_0x5ac21e(_0x44ec59[_0xac4a('0x10')](0x1f4,_0x3204ad[_0xac4a('0x12')]));});});};exports['UpdateMailQueueReport']=function(_0x1b7998){var _0x2503d8=this;return new Promise(function(_0x15435c,_0x412494){return db[_0xac4a('0x16')][_0xac4a('0x1b')](_0x1b7998[_0xac4a('0x18')],{'raw':_0x1b7998[_0xac4a('0x19')]?_0x1b7998[_0xac4a('0x19')][_0xac4a('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1b7998[_0xac4a('0x19')]?_0x1b7998[_0xac4a('0x19')][_0xac4a('0x1c')]||null:null,'attributes':_0x1b7998[_0xac4a('0x19')]?_0x1b7998[_0xac4a('0x19')][_0xac4a('0x1d')]||null:null,'limit':_0x1b7998['options']?_0x1b7998[_0xac4a('0x19')][_0xac4a('0x1e')]||null:null})[_0xac4a('0xc')](function(_0x2772fe){logger[_0xac4a('0x13')]('UpdateMailQueueReport',_0x1b7998);logger['debug'](_0xac4a('0x1f'),_0x1b7998,JSON[_0xac4a('0x20')](_0x2772fe));_0x15435c(_0x2772fe);})[_0xac4a('0x14')](function(_0x546b65){logger['error'](_0xac4a('0x1f'),_0x546b65[_0xac4a('0x12')],_0x1b7998);_0x412494(_0x2503d8[_0xac4a('0x10')](0x1f4,_0x546b65[_0xac4a('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerIn/index.js b/server/api/mailServerIn/index.js index 300377b..4fd9190 100644 --- a/server/api/mailServerIn/index.js +++ b/server/api/mailServerIn/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x4164f2,_0x38669f){var _0x2575c7=function(_0x24dca1){while(--_0x24dca1){_0x4164f2['push'](_0x4164f2['shift']());}};_0x2575c7(++_0x38669f);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file +var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x416f4e,_0x46a4b1){var _0x230028=function(_0x5a17ea){while(--_0x5a17ea){_0x416f4e['push'](_0x416f4e['shift']());}};_0x230028(++_0x46a4b1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0xa9e0[_0x4fc9e6];return _0x551d28;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.attributes.js b/server/api/mailServerIn/mailServerIn.attributes.js index 4a69d36..e0b4ca2 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 _0xfc33=['sequelize','exports','STRING','BOOLEAN','INTEGER','INBOX'];(function(_0x523841,_0x42f4ca){var _0x52c669=function(_0x22b29d){while(--_0x22b29d){_0x523841['push'](_0x523841['shift']());}};_0x52c669(++_0x42f4ca);}(_0xfc33,0xf0));var _0x3fc3=function(_0xaa1b3e,_0x47d976){_0xaa1b3e=_0xaa1b3e-0x0;var _0x454d7d=_0xfc33[_0xaa1b3e];return _0x454d7d;};'use strict';var Sequelize=require(_0x3fc3('0x0'));module[_0x3fc3('0x1')]={'description':{'type':Sequelize[_0x3fc3('0x2')]},'host':{'type':Sequelize[_0x3fc3('0x2')]},'authentication':{'type':Sequelize[_0x3fc3('0x3')],'defaultValue':!![]},'user':{'type':Sequelize[_0x3fc3('0x2')]},'password':{'type':Sequelize[_0x3fc3('0x2')]},'port':{'type':Sequelize[_0x3fc3('0x4')]},'tls':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x3fc3('0x2')],'defaultValue':_0x3fc3('0x5')},'connTimeout':{'type':Sequelize[_0x3fc3('0x4')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0x3fc3('0x4')],'defaultValue':0x5},'service':{'type':Sequelize[_0x3fc3('0x2')]},'modernAuthentication':{'type':Sequelize[_0x3fc3('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x73b3=['INBOX','sequelize','exports','STRING','BOOLEAN','INTEGER'];(function(_0x29a740,_0x5c211){var _0x4edd09=function(_0x5b7be6){while(--_0x5b7be6){_0x29a740['push'](_0x29a740['shift']());}};_0x4edd09(++_0x5c211);}(_0x73b3,0x1ab));var _0x373b=function(_0x1a8f86,_0x5ed9c4){_0x1a8f86=_0x1a8f86-0x0;var _0x20d876=_0x73b3[_0x1a8f86];return _0x20d876;};'use strict';var Sequelize=require(_0x373b('0x0'));module[_0x373b('0x1')]={'description':{'type':Sequelize[_0x373b('0x2')]},'host':{'type':Sequelize[_0x373b('0x2')]},'authentication':{'type':Sequelize[_0x373b('0x3')],'defaultValue':!![]},'user':{'type':Sequelize[_0x373b('0x2')]},'password':{'type':Sequelize[_0x373b('0x2')]},'port':{'type':Sequelize[_0x373b('0x4')]},'tls':{'type':Sequelize[_0x373b('0x3')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x373b('0x2')],'defaultValue':_0x373b('0x5')},'connTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0x373b('0x4')],'defaultValue':0x5},'service':{'type':Sequelize['STRING']},'modernAuthentication':{'type':Sequelize[_0x373b('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.model.js b/server/api/mailServerIn/mailServerIn.model.js index a0600c0..9e79daf 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 _0xe8b0=['define','MailServerIn','mail_servers_in','lodash','moment','request-promise','path','rimraf','../../config/environment','./mailServerIn.attributes','exports'];(function(_0x1fd2e8,_0x49432f){var _0x32524e=function(_0x15a743){while(--_0x15a743){_0x1fd2e8['push'](_0x1fd2e8['shift']());}};_0x32524e(++_0x49432f);}(_0xe8b0,0x121));var _0x0e8b=function(_0x47ce4a,_0x3c5aa3){_0x47ce4a=_0x47ce4a-0x0;var _0x18f1dc=_0xe8b0[_0x47ce4a];return _0x18f1dc;};'use strict';var _=require(_0x0e8b('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x0e8b('0x1'));var BPromise=require('bluebird');var rp=require(_0x0e8b('0x2'));var fs=require('fs');var path=require(_0x0e8b('0x3'));var rimraf=require(_0x0e8b('0x4'));var config=require(_0x0e8b('0x5'));var attributes=require(_0x0e8b('0x6'));module[_0x0e8b('0x7')]=function(_0x35aa57,_0xc461f4){return _0x35aa57[_0x0e8b('0x8')](_0x0e8b('0x9'),attributes,{'tableName':_0x0e8b('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x84bd=['lodash','util','../../config/logger','api','moment','bluebird','./mailServerIn.attributes','exports','define','MailServerIn','mail_servers_in'];(function(_0x5a94ae,_0x247306){var _0x1537e0=function(_0x1aaebb){while(--_0x1aaebb){_0x5a94ae['push'](_0x5a94ae['shift']());}};_0x1537e0(++_0x247306);}(_0x84bd,0x1c3));var _0xd84b=function(_0x401609,_0x5eb61d){_0x401609=_0x401609-0x0;var _0x35fd57=_0x84bd[_0x401609];return _0x35fd57;};'use strict';var _=require(_0xd84b('0x0'));var util=require(_0xd84b('0x1'));var logger=require(_0xd84b('0x2'))(_0xd84b('0x3'));var moment=require(_0xd84b('0x4'));var BPromise=require(_0xd84b('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xd84b('0x6'));module[_0xd84b('0x7')]=function(_0x1748a3,_0x125aba){return _0x1748a3[_0xd84b('0x8')](_0xd84b('0x9'),attributes,{'tableName':_0xd84b('0xa'),'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 cb6dc06..98a3ba6 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 _0x5974=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','MailServerIn,\x20%s,\x20%s,\x20%s','stringify','error','MailServerIn,\x20%s,\x20%s','result','catch','GetMailServerIn','MailServerIn','findAll','options','raw','where','limit','include','map','model','attributes','message','lodash','util','bluebird','ioredis'];(function(_0x2fcf18,_0x10009a){var _0x4c68cc=function(_0x444002){while(--_0x444002){_0x2fcf18['push'](_0x2fcf18['shift']());}};_0x4c68cc(++_0x10009a);}(_0x5974,0x1d8));var _0x4597=function(_0x520ce8,_0x445e56){_0x520ce8=_0x520ce8-0x0;var _0x64369e=_0x5974[_0x520ce8];return _0x64369e;};'use strict';var _=require(_0x4597('0x0'));var util=require(_0x4597('0x1'));var moment=require('moment');var BPromise=require(_0x4597('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4597('0x3'));var db=require(_0x4597('0x4'))['db'];var utils=require(_0x4597('0x5'));var logger=require(_0x4597('0x6'))(_0x4597('0x7'));var config=require(_0x4597('0x8'));var jayson=require(_0x4597('0x9'));var client=jayson[_0x4597('0xa')][_0x4597('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x50fd44,_0x3f9bb2,_0x356491){return new BPromise(function(_0x31479f,_0x4ee387){return client['request'](_0x50fd44,_0x356491)[_0x4597('0xc')](function(_0x85065b){logger[_0x4597('0xd')]('MailServerIn,\x20%s,\x20%s',_0x3f9bb2,_0x4597('0xe'));logger[_0x4597('0xf')](_0x4597('0x10'),_0x3f9bb2,_0x4597('0xe'),JSON[_0x4597('0x11')](_0x85065b));if(_0x85065b[_0x4597('0x12')]){if(_0x85065b[_0x4597('0x12')]['code']===0x1f4){logger[_0x4597('0x12')](_0x4597('0x13'),_0x3f9bb2,_0x85065b['error']['message']);return _0x4ee387(_0x85065b[_0x4597('0x12')]['message']);}logger[_0x4597('0x12')]('MailServerIn,\x20%s,\x20%s',_0x3f9bb2,_0x85065b[_0x4597('0x12')]['message']);return _0x31479f(_0x85065b['error']['message']);}else{logger[_0x4597('0xd')](_0x4597('0x13'),_0x3f9bb2,_0x4597('0xe'));_0x31479f(_0x85065b[_0x4597('0x14')]['message']);}})[_0x4597('0x15')](function(_0x512e9c){logger['error'](_0x4597('0x13'),_0x3f9bb2,_0x512e9c);_0x4ee387(_0x512e9c);});});}exports[_0x4597('0x16')]=function(_0x589c81){var _0xceb374=this;return new Promise(function(_0x2e8288,_0x523546){return db[_0x4597('0x17')][_0x4597('0x18')]({'raw':_0x589c81[_0x4597('0x19')]?_0x589c81[_0x4597('0x19')][_0x4597('0x1a')]===undefined?!![]:![]:!![],'where':_0x589c81[_0x4597('0x19')]?_0x589c81['options'][_0x4597('0x1b')]||null:null,'attributes':_0x589c81[_0x4597('0x19')]?_0x589c81[_0x4597('0x19')]['attributes']||null:null,'limit':_0x589c81[_0x4597('0x19')]?_0x589c81['options'][_0x4597('0x1c')]||null:null,'include':_0x589c81[_0x4597('0x19')]?_0x589c81[_0x4597('0x19')][_0x4597('0x1d')]?_[_0x4597('0x1e')](_0x589c81[_0x4597('0x19')][_0x4597('0x1d')],function(_0x4a4454){return{'model':db[_0x4a4454[_0x4597('0x1f')]],'as':_0x4a4454['as'],'attributes':_0x4a4454[_0x4597('0x20')],'include':_0x4a4454[_0x4597('0x1d')]?_['map'](_0x4a4454[_0x4597('0x1d')],function(_0xa9fe87){return{'model':db[_0xa9fe87[_0x4597('0x1f')]],'as':_0xa9fe87['as'],'attributes':_0xa9fe87[_0x4597('0x20')],'include':_0xa9fe87['include']?_['map'](_0xa9fe87[_0x4597('0x1d')],function(_0x230f28){return{'model':db[_0x230f28['model']],'as':_0x230f28['as'],'attributes':_0x230f28[_0x4597('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1ff809){logger[_0x4597('0xd')](_0x4597('0x16'),_0x589c81);logger[_0x4597('0xf')](_0x4597('0x16'),_0x589c81,JSON[_0x4597('0x11')](_0x1ff809));_0x2e8288(_0x1ff809);})['catch'](function(_0x11c1a3){logger[_0x4597('0x12')](_0x4597('0x16'),_0x11c1a3['message'],_0x589c81);_0x523546(_0xceb374['error'](0x1f4,_0x11c1a3[_0x4597('0x21')]));});});}; \ No newline at end of file +var _0x9b69=['options','raw','attributes','limit','include','map','model','debug','GetMailServerIn','stringify','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','info','MailServerIn,\x20%s,\x20%s','request\x20sent','MailServerIn,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','MailServerIn','findAll'];(function(_0x14612f,_0x1c3389){var _0x3c41ad=function(_0x41043c){while(--_0x41043c){_0x14612f['push'](_0x14612f['shift']());}};_0x3c41ad(++_0x1c3389);}(_0x9b69,0x196));var _0x99b6=function(_0x49a627,_0x57e91d){_0x49a627=_0x49a627-0x0;var _0x4171b0=_0x9b69[_0x49a627];return _0x4171b0;};'use strict';var _=require(_0x99b6('0x0'));var util=require('util');var moment=require(_0x99b6('0x1'));var BPromise=require(_0x99b6('0x2'));var rs=require(_0x99b6('0x3'));var fs=require('fs');var Redis=require(_0x99b6('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x99b6('0x5'));var logger=require('../../config/logger')(_0x99b6('0x6'));var config=require(_0x99b6('0x7'));var jayson=require(_0x99b6('0x8'));var client=jayson[_0x99b6('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x55a5ad,_0x5d0ca6,_0x49d176){return new BPromise(function(_0x38c76a,_0x2d14a8){return client[_0x99b6('0xa')](_0x55a5ad,_0x49d176)[_0x99b6('0xb')](function(_0xaf4c11){logger[_0x99b6('0xc')](_0x99b6('0xd'),_0x5d0ca6,_0x99b6('0xe'));logger['debug'](_0x99b6('0xf'),_0x5d0ca6,'request\x20sent',JSON['stringify'](_0xaf4c11));if(_0xaf4c11[_0x99b6('0x10')]){if(_0xaf4c11[_0x99b6('0x10')][_0x99b6('0x11')]===0x1f4){logger[_0x99b6('0x10')]('MailServerIn,\x20%s,\x20%s',_0x5d0ca6,_0xaf4c11[_0x99b6('0x10')][_0x99b6('0x12')]);return _0x2d14a8(_0xaf4c11['error']['message']);}logger['error'](_0x99b6('0xd'),_0x5d0ca6,_0xaf4c11[_0x99b6('0x10')][_0x99b6('0x12')]);return _0x38c76a(_0xaf4c11['error']['message']);}else{logger[_0x99b6('0xc')]('MailServerIn,\x20%s,\x20%s',_0x5d0ca6,_0x99b6('0xe'));_0x38c76a(_0xaf4c11[_0x99b6('0x13')][_0x99b6('0x12')]);}})[_0x99b6('0x14')](function(_0x389ded){logger[_0x99b6('0x10')](_0x99b6('0xd'),_0x5d0ca6,_0x389ded);_0x2d14a8(_0x389ded);});});}exports['GetMailServerIn']=function(_0x1f7f33){var _0x29f844=this;return new Promise(function(_0xf23455,_0x3711ee){return db[_0x99b6('0x15')][_0x99b6('0x16')]({'raw':_0x1f7f33[_0x99b6('0x17')]?_0x1f7f33[_0x99b6('0x17')][_0x99b6('0x18')]===undefined?!![]:![]:!![],'where':_0x1f7f33[_0x99b6('0x17')]?_0x1f7f33[_0x99b6('0x17')]['where']||null:null,'attributes':_0x1f7f33[_0x99b6('0x17')]?_0x1f7f33[_0x99b6('0x17')][_0x99b6('0x19')]||null:null,'limit':_0x1f7f33['options']?_0x1f7f33[_0x99b6('0x17')][_0x99b6('0x1a')]||null:null,'include':_0x1f7f33[_0x99b6('0x17')]?_0x1f7f33['options'][_0x99b6('0x1b')]?_[_0x99b6('0x1c')](_0x1f7f33[_0x99b6('0x17')][_0x99b6('0x1b')],function(_0x382ab8){return{'model':db[_0x382ab8[_0x99b6('0x1d')]],'as':_0x382ab8['as'],'attributes':_0x382ab8[_0x99b6('0x19')],'include':_0x382ab8[_0x99b6('0x1b')]?_[_0x99b6('0x1c')](_0x382ab8[_0x99b6('0x1b')],function(_0x269c21){return{'model':db[_0x269c21[_0x99b6('0x1d')]],'as':_0x269c21['as'],'attributes':_0x269c21[_0x99b6('0x19')],'include':_0x269c21[_0x99b6('0x1b')]?_[_0x99b6('0x1c')](_0x269c21[_0x99b6('0x1b')],function(_0x5416c7){return{'model':db[_0x5416c7[_0x99b6('0x1d')]],'as':_0x5416c7['as'],'attributes':_0x5416c7[_0x99b6('0x19')]};}):[]};}):[]};}):[]:[]})[_0x99b6('0xb')](function(_0x2cc099){logger['info']('GetMailServerIn',_0x1f7f33);logger[_0x99b6('0x1e')](_0x99b6('0x1f'),_0x1f7f33,JSON[_0x99b6('0x20')](_0x2cc099));_0xf23455(_0x2cc099);})['catch'](function(_0x330f8b){logger[_0x99b6('0x10')]('GetMailServerIn',_0x330f8b['message'],_0x1f7f33);_0x3711ee(_0x29f844[_0x99b6('0x10')](0x1f4,_0x330f8b['message']));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index 53176c9..fea8eb2 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(_0xc6be3a,_0x540e05){var _0x56a310=function(_0x50a144){while(--_0x50a144){_0xc6be3a['push'](_0xc6be3a['shift']());}};_0x56a310(++_0x540e05);}(_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('0xe')]('/',auth['isAuthenticated'](),controller[_0x7995('0xf')]);router[_0x7995('0x10')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router[_0x7995('0x12')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0x13')]);module[_0x7995('0x14')]=router; \ No newline at end of file +var _0x7a54=['index','/:id','isAuthenticated','post','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailServerOut.controller','get'];(function(_0x16d10f,_0x2ba2d5){var _0x50c823=function(_0x44e43f){while(--_0x44e43f){_0x16d10f['push'](_0x16d10f['shift']());}};_0x50c823(++_0x2ba2d5);}(_0x7a54,0x106));var _0x47a5=function(_0x33a572,_0x8b71a2){_0x33a572=_0x33a572-0x0;var _0x1800ff=_0x7a54[_0x33a572];return _0x1800ff;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x47a5('0x5'));var interaction=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var controller=require(_0x47a5('0x8'));router[_0x47a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['show']);router[_0x47a5('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['update']);router[_0x47a5('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x47a5('0xf')]);module[_0x47a5('0x10')]=router; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.attributes.js b/server/api/mailServerOut/mailServerOut.attributes.js index cdc1e52..655a7ea 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 _0xb10b=['INTEGER','BOOLEAN','sequelize','STRING'];(function(_0x1e03a6,_0xf0349){var _0x295b64=function(_0x1ad0a5){while(--_0x1ad0a5){_0x1e03a6['push'](_0x1e03a6['shift']());}};_0x295b64(++_0xf0349);}(_0xb10b,0x12a));var _0xbb10=function(_0x5079f0,_0x2e0ae4){_0x5079f0=_0x5079f0-0x0;var _0x182bce=_0xb10b[_0x5079f0];return _0x182bce;};'use strict';var Sequelize=require(_0xbb10('0x0'));module['exports']={'description':{'type':Sequelize[_0xbb10('0x1')]},'host':{'type':Sequelize[_0xbb10('0x1')]},'user':{'type':Sequelize[_0xbb10('0x1')]},'pass':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0xbb10('0x2')]},'secure':{'type':Sequelize[_0xbb10('0x3')],'defaultValue':![]},'service':{'type':Sequelize[_0xbb10('0x1')]},'authentication':{'type':Sequelize[_0xbb10('0x3')],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize[_0xbb10('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x9348=['exports','STRING','INTEGER','BOOLEAN','sequelize'];(function(_0x38b8c6,_0x541f91){var _0x3104d6=function(_0x4215ee){while(--_0x4215ee){_0x38b8c6['push'](_0x38b8c6['shift']());}};_0x3104d6(++_0x541f91);}(_0x9348,0x10d));var _0x8934=function(_0x1c649f,_0x296c57){_0x1c649f=_0x1c649f-0x0;var _0x251d8a=_0x9348[_0x1c649f];return _0x251d8a;};'use strict';var Sequelize=require(_0x8934('0x0'));module[_0x8934('0x1')]={'description':{'type':Sequelize[_0x8934('0x2')]},'host':{'type':Sequelize[_0x8934('0x2')]},'user':{'type':Sequelize[_0x8934('0x2')]},'pass':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0x8934('0x3')]},'secure':{'type':Sequelize[_0x8934('0x4')],'defaultValue':![]},'service':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize[_0x8934('0x4')],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize[_0x8934('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 8e894ea..44e0fd8 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 _0x1c1c=['filters','intersection','model','attributes','length','nolimit','limit','order','sort','where','pick','filter','merge','includeAll','include','findAll','catch','show','MailServerOut','fields','options','find','create','body','params','destroy','eml-format','rimraf','zip-dir','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','set','Content-Range','apply','reject','save','update','then','error','stack','name','index','map','rawAttributes','fieldName','type','key','keys','query'];(function(_0x21dea6,_0x42306c){var _0xe2f95=function(_0x48def5){while(--_0x48def5){_0x21dea6['push'](_0x21dea6['shift']());}};_0xe2f95(++_0x42306c);}(_0x1c1c,0x14e));var _0xc1c1=function(_0x580576,_0x2f107d){_0x580576=_0x580576-0x0;var _0x3f55a0=_0x1c1c[_0x580576];return _0x3f55a0;};'use strict';var emlformat=require(_0xc1c1('0x0'));var rimraf=require(_0xc1c1('0x1'));var zipdir=require(_0xc1c1('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc1c1('0x3'));var moment=require(_0xc1c1('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xc1c1('0x5'));var path=require(_0xc1c1('0x6'));var sox=require(_0xc1c1('0x7'));var csv=require(_0xc1c1('0x8'));var ejs=require(_0xc1c1('0x9'));var fs=require('fs');var fs_extra=require(_0xc1c1('0xa'));var _=require(_0xc1c1('0xb'));var squel=require(_0xc1c1('0xc'));var crypto=require(_0xc1c1('0xd'));var jsforce=require(_0xc1c1('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xc1c1('0xf'));var Redis=require(_0xc1c1('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xc1c1('0x11'));var as=require(_0xc1c1('0x12'));var hardwareService=require(_0xc1c1('0x13'));var logger=require(_0xc1c1('0x14'))(_0xc1c1('0x15'));var utils=require(_0xc1c1('0x16'));var config=require(_0xc1c1('0x17'));var licenseUtil=require(_0xc1c1('0x18'));var db=require(_0xc1c1('0x19'))['db'];function respondWithStatusCode(_0x2fb1f0,_0x23f072){_0x23f072=_0x23f072||0xcc;return function(_0x7fab1f){if(_0x7fab1f){return _0x2fb1f0[_0xc1c1('0x1a')](_0x23f072);}return _0x2fb1f0['status'](_0x23f072)[_0xc1c1('0x1b')]();};}function respondWithResult(_0x23a213,_0xbc0c6){_0xbc0c6=_0xbc0c6||0xc8;return function(_0x2b6635){if(_0x2b6635){return _0x23a213[_0xc1c1('0x1c')](_0xbc0c6)[_0xc1c1('0x1d')](_0x2b6635);}};}function respondWithFilteredResult(_0x43935e,_0x54933b){return function(_0x4494f2){if(_0x4494f2){var _0x1e18cc=typeof _0x54933b[_0xc1c1('0x1e')]==='undefined'&&typeof _0x54933b['limit']===_0xc1c1('0x1f');var _0x134165=_0x4494f2[_0xc1c1('0x20')];var _0x262371=_0x1e18cc?0x0:_0x54933b[_0xc1c1('0x1e')];var _0xa09a27=_0x1e18cc?_0x4494f2[_0xc1c1('0x20')]:_0x54933b['offset']+_0x54933b['limit'];var _0x17eaba;if(_0xa09a27>=_0x134165){_0xa09a27=_0x134165;_0x17eaba=0xc8;}else{_0x17eaba=0xce;}_0x43935e[_0xc1c1('0x1c')](_0x17eaba);return _0x43935e[_0xc1c1('0x21')](_0xc1c1('0x22'),_0x262371+'-'+_0xa09a27+'/'+_0x134165)['json'](_0x4494f2);}return null;};}function patchUpdates(_0x4b2128){return function(_0x3cfa22){try{jsonpatch[_0xc1c1('0x23')](_0x3cfa22,_0x4b2128,!![]);}catch(_0x5b1a9e){return BPromise[_0xc1c1('0x24')](_0x5b1a9e);}return _0x3cfa22[_0xc1c1('0x25')]();};}function saveUpdates(_0x4a676d,_0x36ff7c){return function(_0x6f9975){if(_0x6f9975){return _0x6f9975[_0xc1c1('0x26')](_0x4a676d)[_0xc1c1('0x27')](function(_0x39922f){return _0x39922f;});}return null;};}function removeEntity(_0x461499,_0xda887e){return function(_0x3e6af4){if(_0x3e6af4){return _0x3e6af4['destroy']()['then'](function(){_0x461499[_0xc1c1('0x1c')](0xcc)[_0xc1c1('0x1b')]();});}};}function handleEntityNotFound(_0xdc0b9a,_0x325c46){return function(_0x54f43c){if(!_0x54f43c){_0xdc0b9a[_0xc1c1('0x1a')](0x194);}return _0x54f43c;};}function handleError(_0x1addb6,_0x2cf551){_0x2cf551=_0x2cf551||0x1f4;return function(_0x3dd6ca){logger[_0xc1c1('0x28')](_0x3dd6ca[_0xc1c1('0x29')]);if(_0x3dd6ca[_0xc1c1('0x2a')]){delete _0x3dd6ca[_0xc1c1('0x2a')];}_0x1addb6[_0xc1c1('0x1c')](_0x2cf551)['send'](_0x3dd6ca);};}exports[_0xc1c1('0x2b')]=function(_0x325c39,_0x594a71){var _0xc06042={},_0xa861b7={},_0x17fd70={'count':0x0,'rows':[]};var _0x2a3eb6=_[_0xc1c1('0x2c')](db['MailServerOut'][_0xc1c1('0x2d')],function(_0x4b03b9){return{'name':_0x4b03b9[_0xc1c1('0x2e')],'type':_0x4b03b9[_0xc1c1('0x2f')][_0xc1c1('0x30')]};});_0xa861b7['model']=_[_0xc1c1('0x2c')](_0x2a3eb6,_0xc1c1('0x2a'));_0xa861b7['query']=_[_0xc1c1('0x31')](_0x325c39[_0xc1c1('0x32')]);_0xa861b7[_0xc1c1('0x33')]=_[_0xc1c1('0x34')](_0xa861b7[_0xc1c1('0x35')],_0xa861b7[_0xc1c1('0x32')]);_0xc06042[_0xc1c1('0x36')]=_['intersection'](_0xa861b7[_0xc1c1('0x35')],qs['fields'](_0x325c39[_0xc1c1('0x32')]['fields']));_0xc06042[_0xc1c1('0x36')]=_0xc06042[_0xc1c1('0x36')][_0xc1c1('0x37')]?_0xc06042[_0xc1c1('0x36')]:_0xa861b7['model'];if(!_0x325c39[_0xc1c1('0x32')]['hasOwnProperty'](_0xc1c1('0x38'))){_0xc06042['limit']=qs[_0xc1c1('0x39')](_0x325c39[_0xc1c1('0x32')][_0xc1c1('0x39')]);_0xc06042[_0xc1c1('0x1e')]=qs[_0xc1c1('0x1e')](_0x325c39[_0xc1c1('0x32')][_0xc1c1('0x1e')]);}_0xc06042[_0xc1c1('0x3a')]=qs[_0xc1c1('0x3b')](_0x325c39['query'][_0xc1c1('0x3b')]);_0xc06042[_0xc1c1('0x3c')]=qs[_0xc1c1('0x33')](_[_0xc1c1('0x3d')](_0x325c39[_0xc1c1('0x32')],_0xa861b7[_0xc1c1('0x33')]),_0x2a3eb6);if(_0x325c39[_0xc1c1('0x32')][_0xc1c1('0x3e')]){_0xc06042['where']=_[_0xc1c1('0x3f')](_0xc06042[_0xc1c1('0x3c')],{'$or':_[_0xc1c1('0x2c')](_0x2a3eb6,function(_0x291f7d){if(_0x291f7d[_0xc1c1('0x2f')]!=='VIRTUAL'){var _0x308eec={};_0x308eec[_0x291f7d['name']]={'$like':'%'+_0x325c39[_0xc1c1('0x32')][_0xc1c1('0x3e')]+'%'};return _0x308eec;}})});}_0xc06042=_[_0xc1c1('0x3f')]({},_0xc06042,_0x325c39['options']);var _0x280c73={'where':_0xc06042[_0xc1c1('0x3c')]};return db['MailServerOut'][_0xc1c1('0x20')](_0x280c73)[_0xc1c1('0x27')](function(_0x45b0ca){_0x17fd70['count']=_0x45b0ca;if(_0x325c39[_0xc1c1('0x32')][_0xc1c1('0x40')]){_0xc06042[_0xc1c1('0x41')]=[{'all':!![]}];}return db['MailServerOut'][_0xc1c1('0x42')](_0xc06042);})[_0xc1c1('0x27')](function(_0x4af215){_0x17fd70['rows']=_0x4af215;return _0x17fd70;})[_0xc1c1('0x27')](respondWithFilteredResult(_0x594a71,_0xc06042))[_0xc1c1('0x43')](handleError(_0x594a71,null));};exports[_0xc1c1('0x44')]=function(_0x16216d,_0x17e753){var _0x4cf174={'raw':!![],'where':{'id':_0x16216d['params']['id']}},_0x68dbb4={};_0x68dbb4[_0xc1c1('0x35')]=_[_0xc1c1('0x31')](db[_0xc1c1('0x45')]['rawAttributes']);_0x68dbb4['query']=_[_0xc1c1('0x31')](_0x16216d[_0xc1c1('0x32')]);_0x68dbb4[_0xc1c1('0x33')]=_[_0xc1c1('0x34')](_0x68dbb4['model'],_0x68dbb4['query']);_0x4cf174[_0xc1c1('0x36')]=_[_0xc1c1('0x34')](_0x68dbb4[_0xc1c1('0x35')],qs[_0xc1c1('0x46')](_0x16216d[_0xc1c1('0x32')][_0xc1c1('0x46')]));_0x4cf174['attributes']=_0x4cf174[_0xc1c1('0x36')][_0xc1c1('0x37')]?_0x4cf174[_0xc1c1('0x36')]:_0x68dbb4[_0xc1c1('0x35')];if(_0x16216d[_0xc1c1('0x32')]['includeAll']){_0x4cf174[_0xc1c1('0x41')]=[{'all':!![]}];}_0x4cf174=_[_0xc1c1('0x3f')]({},_0x4cf174,_0x16216d[_0xc1c1('0x47')]);return db[_0xc1c1('0x45')][_0xc1c1('0x48')](_0x4cf174)[_0xc1c1('0x27')](handleEntityNotFound(_0x17e753,null))[_0xc1c1('0x27')](respondWithResult(_0x17e753,null))[_0xc1c1('0x43')](handleError(_0x17e753,null));};exports[_0xc1c1('0x49')]=function(_0x5e2681,_0x452dbe){return db[_0xc1c1('0x45')][_0xc1c1('0x49')](_0x5e2681[_0xc1c1('0x4a')],{})[_0xc1c1('0x27')](respondWithResult(_0x452dbe,0xc9))[_0xc1c1('0x43')](handleError(_0x452dbe,null));};exports[_0xc1c1('0x26')]=function(_0x20b95f,_0x412e09){if(_0x20b95f['body']['id']){delete _0x20b95f[_0xc1c1('0x4a')]['id'];}return db[_0xc1c1('0x45')]['find']({'where':{'id':_0x20b95f[_0xc1c1('0x4b')]['id']}})['then'](handleEntityNotFound(_0x412e09,null))[_0xc1c1('0x27')](saveUpdates(_0x20b95f[_0xc1c1('0x4a')],null))[_0xc1c1('0x27')](respondWithResult(_0x412e09,null))[_0xc1c1('0x43')](handleError(_0x412e09,null));};exports[_0xc1c1('0x4c')]=function(_0x312dab,_0x17ab0e){return db[_0xc1c1('0x45')][_0xc1c1('0x48')]({'where':{'id':_0x312dab[_0xc1c1('0x4b')]['id']}})['then'](handleEntityNotFound(_0x17ab0e,null))[_0xc1c1('0x27')](removeEntity(_0x17ab0e,null))[_0xc1c1('0x43')](handleError(_0x17ab0e,null));}; \ No newline at end of file +var _0x3f1d=['intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','options','include','findAll','rows','catch','params','includeAll','create','body','find','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','end','name','send','index','MailServerOut','rawAttributes','fieldName','type','key','map','query','keys','filters'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x3f1d,0x1d2));var _0xd3f1=function(_0x47eaf6,_0x22d6f7){_0x47eaf6=_0x47eaf6-0x0;var _0x495430=_0x3f1d[_0x47eaf6];return _0x495430;};'use strict';var emlformat=require(_0xd3f1('0x0'));var rimraf=require(_0xd3f1('0x1'));var zipdir=require(_0xd3f1('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd3f1('0x3'));var moment=require('moment');var BPromise=require(_0xd3f1('0x4'));var Mustache=require(_0xd3f1('0x5'));var util=require('util');var path=require(_0xd3f1('0x6'));var sox=require(_0xd3f1('0x7'));var csv=require(_0xd3f1('0x8'));var ejs=require(_0xd3f1('0x9'));var fs=require('fs');var fs_extra=require(_0xd3f1('0xa'));var _=require(_0xd3f1('0xb'));var squel=require('squel');var crypto=require(_0xd3f1('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xd3f1('0xd'));var toCsv=require(_0xd3f1('0x8'));var querystring=require(_0xd3f1('0xe'));var Papa=require(_0xd3f1('0xf'));var Redis=require(_0xd3f1('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xd3f1('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd3f1('0x12'));var logger=require(_0xd3f1('0x13'))(_0xd3f1('0x14'));var utils=require(_0xd3f1('0x15'));var config=require(_0xd3f1('0x16'));var licenseUtil=require(_0xd3f1('0x17'));var db=require(_0xd3f1('0x18'))['db'];function respondWithStatusCode(_0x5b8877,_0x25bd7c){_0x25bd7c=_0x25bd7c||0xcc;return function(_0x45868e){if(_0x45868e){return _0x5b8877[_0xd3f1('0x19')](_0x25bd7c);}return _0x5b8877[_0xd3f1('0x1a')](_0x25bd7c)['end']();};}function respondWithResult(_0x55504c,_0x510a91){_0x510a91=_0x510a91||0xc8;return function(_0x4ed4d4){if(_0x4ed4d4){return _0x55504c[_0xd3f1('0x1a')](_0x510a91)['json'](_0x4ed4d4);}};}function respondWithFilteredResult(_0x4b72b0,_0x5c7590){return function(_0x4df4d2){if(_0x4df4d2){var _0x59aa79=typeof _0x5c7590[_0xd3f1('0x1b')]===_0xd3f1('0x1c')&&typeof _0x5c7590[_0xd3f1('0x1d')]===_0xd3f1('0x1c');var _0x842237=_0x4df4d2['count'];var _0x2f53bf=_0x59aa79?0x0:_0x5c7590[_0xd3f1('0x1b')];var _0x19d2fa=_0x59aa79?_0x4df4d2[_0xd3f1('0x1e')]:_0x5c7590[_0xd3f1('0x1b')]+_0x5c7590['limit'];var _0x19db03;if(_0x19d2fa>=_0x842237){_0x19d2fa=_0x842237;_0x19db03=0xc8;}else{_0x19db03=0xce;}_0x4b72b0[_0xd3f1('0x1a')](_0x19db03);return _0x4b72b0[_0xd3f1('0x1f')](_0xd3f1('0x20'),_0x2f53bf+'-'+_0x19d2fa+'/'+_0x842237)[_0xd3f1('0x21')](_0x4df4d2);}return null;};}function patchUpdates(_0x2b0e0f){return function(_0x5b60d0){try{jsonpatch[_0xd3f1('0x22')](_0x5b60d0,_0x2b0e0f,!![]);}catch(_0x2ed218){return BPromise[_0xd3f1('0x23')](_0x2ed218);}return _0x5b60d0[_0xd3f1('0x24')]();};}function saveUpdates(_0x7aaf3f,_0x5783ed){return function(_0x50e95c){if(_0x50e95c){return _0x50e95c[_0xd3f1('0x25')](_0x7aaf3f)['then'](function(_0x40ea72){return _0x40ea72;});}return null;};}function removeEntity(_0x16d8ee,_0x35a319){return function(_0x5214b2){if(_0x5214b2){return _0x5214b2['destroy']()[_0xd3f1('0x26')](function(){_0x16d8ee[_0xd3f1('0x1a')](0xcc)[_0xd3f1('0x27')]();});}};}function handleEntityNotFound(_0x2890ee,_0x4e5ad9){return function(_0x442055){if(!_0x442055){_0x2890ee['sendStatus'](0x194);}return _0x442055;};}function handleError(_0x3b301f,_0x22bba4){_0x22bba4=_0x22bba4||0x1f4;return function(_0x214845){logger['error'](_0x214845['stack']);if(_0x214845['name']){delete _0x214845[_0xd3f1('0x28')];}_0x3b301f['status'](_0x22bba4)[_0xd3f1('0x29')](_0x214845);};}exports[_0xd3f1('0x2a')]=function(_0x30d87e,_0x1c3090){var _0x3d1fc5={},_0x355384={},_0x4c4be4={'count':0x0,'rows':[]};var _0x4f2318=_['map'](db[_0xd3f1('0x2b')][_0xd3f1('0x2c')],function(_0x15c2c4){return{'name':_0x15c2c4[_0xd3f1('0x2d')],'type':_0x15c2c4[_0xd3f1('0x2e')][_0xd3f1('0x2f')]};});_0x355384['model']=_[_0xd3f1('0x30')](_0x4f2318,_0xd3f1('0x28'));_0x355384[_0xd3f1('0x31')]=_[_0xd3f1('0x32')](_0x30d87e[_0xd3f1('0x31')]);_0x355384[_0xd3f1('0x33')]=_[_0xd3f1('0x34')](_0x355384[_0xd3f1('0x35')],_0x355384[_0xd3f1('0x31')]);_0x3d1fc5[_0xd3f1('0x36')]=_[_0xd3f1('0x34')](_0x355384[_0xd3f1('0x35')],qs['fields'](_0x30d87e[_0xd3f1('0x31')][_0xd3f1('0x37')]));_0x3d1fc5['attributes']=_0x3d1fc5[_0xd3f1('0x36')][_0xd3f1('0x38')]?_0x3d1fc5[_0xd3f1('0x36')]:_0x355384[_0xd3f1('0x35')];if(!_0x30d87e[_0xd3f1('0x31')][_0xd3f1('0x39')](_0xd3f1('0x3a'))){_0x3d1fc5[_0xd3f1('0x1d')]=qs['limit'](_0x30d87e[_0xd3f1('0x31')][_0xd3f1('0x1d')]);_0x3d1fc5[_0xd3f1('0x1b')]=qs[_0xd3f1('0x1b')](_0x30d87e[_0xd3f1('0x31')]['offset']);}_0x3d1fc5[_0xd3f1('0x3b')]=qs[_0xd3f1('0x3c')](_0x30d87e[_0xd3f1('0x31')][_0xd3f1('0x3c')]);_0x3d1fc5[_0xd3f1('0x3d')]=qs[_0xd3f1('0x33')](_[_0xd3f1('0x3e')](_0x30d87e[_0xd3f1('0x31')],_0x355384[_0xd3f1('0x33')]),_0x4f2318);if(_0x30d87e[_0xd3f1('0x31')]['filter']){_0x3d1fc5[_0xd3f1('0x3d')]=_['merge'](_0x3d1fc5[_0xd3f1('0x3d')],{'$or':_[_0xd3f1('0x30')](_0x4f2318,function(_0x2fb7d9){if(_0x2fb7d9[_0xd3f1('0x2e')]!=='VIRTUAL'){var _0x351d4={};_0x351d4[_0x2fb7d9['name']]={'$like':'%'+_0x30d87e[_0xd3f1('0x31')]['filter']+'%'};return _0x351d4;}})});}_0x3d1fc5=_[_0xd3f1('0x3f')]({},_0x3d1fc5,_0x30d87e[_0xd3f1('0x40')]);var _0x1cba33={'where':_0x3d1fc5['where']};return db[_0xd3f1('0x2b')][_0xd3f1('0x1e')](_0x1cba33)[_0xd3f1('0x26')](function(_0x5715a9){_0x4c4be4['count']=_0x5715a9;if(_0x30d87e[_0xd3f1('0x31')]['includeAll']){_0x3d1fc5[_0xd3f1('0x41')]=[{'all':!![]}];}return db[_0xd3f1('0x2b')][_0xd3f1('0x42')](_0x3d1fc5);})['then'](function(_0x28832f){_0x4c4be4[_0xd3f1('0x43')]=_0x28832f;return _0x4c4be4;})[_0xd3f1('0x26')](respondWithFilteredResult(_0x1c3090,_0x3d1fc5))[_0xd3f1('0x44')](handleError(_0x1c3090,null));};exports['show']=function(_0x856a36,_0xbf3e2b){var _0x2c356a={'raw':!![],'where':{'id':_0x856a36[_0xd3f1('0x45')]['id']}},_0x5b8378={};_0x5b8378[_0xd3f1('0x35')]=_[_0xd3f1('0x32')](db[_0xd3f1('0x2b')][_0xd3f1('0x2c')]);_0x5b8378[_0xd3f1('0x31')]=_['keys'](_0x856a36[_0xd3f1('0x31')]);_0x5b8378[_0xd3f1('0x33')]=_[_0xd3f1('0x34')](_0x5b8378[_0xd3f1('0x35')],_0x5b8378[_0xd3f1('0x31')]);_0x2c356a[_0xd3f1('0x36')]=_[_0xd3f1('0x34')](_0x5b8378[_0xd3f1('0x35')],qs[_0xd3f1('0x37')](_0x856a36[_0xd3f1('0x31')][_0xd3f1('0x37')]));_0x2c356a[_0xd3f1('0x36')]=_0x2c356a['attributes'][_0xd3f1('0x38')]?_0x2c356a[_0xd3f1('0x36')]:_0x5b8378[_0xd3f1('0x35')];if(_0x856a36[_0xd3f1('0x31')][_0xd3f1('0x46')]){_0x2c356a[_0xd3f1('0x41')]=[{'all':!![]}];}_0x2c356a=_[_0xd3f1('0x3f')]({},_0x2c356a,_0x856a36[_0xd3f1('0x40')]);return db['MailServerOut']['find'](_0x2c356a)[_0xd3f1('0x26')](handleEntityNotFound(_0xbf3e2b,null))['then'](respondWithResult(_0xbf3e2b,null))[_0xd3f1('0x44')](handleError(_0xbf3e2b,null));};exports['create']=function(_0x1de850,_0x461d62){return db['MailServerOut'][_0xd3f1('0x47')](_0x1de850[_0xd3f1('0x48')],{})[_0xd3f1('0x26')](respondWithResult(_0x461d62,0xc9))[_0xd3f1('0x44')](handleError(_0x461d62,null));};exports[_0xd3f1('0x25')]=function(_0x3bd1e0,_0x1077d3){if(_0x3bd1e0['body']['id']){delete _0x3bd1e0['body']['id'];}return db['MailServerOut'][_0xd3f1('0x49')]({'where':{'id':_0x3bd1e0[_0xd3f1('0x45')]['id']}})[_0xd3f1('0x26')](handleEntityNotFound(_0x1077d3,null))[_0xd3f1('0x26')](saveUpdates(_0x3bd1e0[_0xd3f1('0x48')],null))[_0xd3f1('0x26')](respondWithResult(_0x1077d3,null))['catch'](handleError(_0x1077d3,null));};exports['destroy']=function(_0x35a635,_0x1c4442){return db[_0xd3f1('0x2b')][_0xd3f1('0x49')]({'where':{'id':_0x35a635[_0xd3f1('0x45')]['id']}})['then'](handleEntityNotFound(_0x1c4442,null))['then'](removeEntity(_0x1c4442,null))[_0xd3f1('0x44')](handleError(_0x1c4442,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index 58dffb2..578b301 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 _0x5084=['path','rimraf','../../config/environment','./mailServerOut.attributes','MailServerOut','mail_servers_out','api','moment','request-promise'];(function(_0x552900,_0x3a1d5f){var _0x26fe96=function(_0x5e26a9){while(--_0x5e26a9){_0x552900['push'](_0x552900['shift']());}};_0x26fe96(++_0x3a1d5f);}(_0x5084,0x8d));var _0x4508=function(_0x1994f9,_0x1f4261){_0x1994f9=_0x1994f9-0x0;var _0x241348=_0x5084[_0x1994f9];return _0x241348;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x4508('0x0'));var moment=require(_0x4508('0x1'));var BPromise=require('bluebird');var rp=require(_0x4508('0x2'));var fs=require('fs');var path=require(_0x4508('0x3'));var rimraf=require(_0x4508('0x4'));var config=require(_0x4508('0x5'));var attributes=require(_0x4508('0x6'));module['exports']=function(_0xb11e78,_0x1eb503){return _0xb11e78['define'](_0x4508('0x7'),attributes,{'tableName':_0x4508('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa2c9=['request-promise','rimraf','../../config/environment','exports','define','MailServerOut','mail_servers_out','util','../../config/logger','api','moment','bluebird'];(function(_0x2ba7d3,_0x3befb6){var _0x51fc4f=function(_0x12700b){while(--_0x12700b){_0x2ba7d3['push'](_0x2ba7d3['shift']());}};_0x51fc4f(++_0x3befb6);}(_0xa2c9,0x157));var _0x9a2c=function(_0xd87061,_0x3f6b0f){_0xd87061=_0xd87061-0x0;var _0x1e42ff=_0xa2c9[_0xd87061];return _0x1e42ff;};'use strict';var _=require('lodash');var util=require(_0x9a2c('0x0'));var logger=require(_0x9a2c('0x1'))(_0x9a2c('0x2'));var moment=require(_0x9a2c('0x3'));var BPromise=require(_0x9a2c('0x4'));var rp=require(_0x9a2c('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9a2c('0x6'));var config=require(_0x9a2c('0x7'));var attributes=require('./mailServerOut.attributes');module[_0x9a2c('0x8')]=function(_0x46b8e2,_0x2afeb4){return _0x46b8e2[_0x9a2c('0x9')](_0x9a2c('0xa'),attributes,{'tableName':_0x9a2c('0xb'),'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 2e9ae94..29f54b5 100644 --- a/server/api/mailServerOut/mailServerOut.rpc.js +++ b/server/api/mailServerOut/mailServerOut.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xadb5=['error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','MailServerOut,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x23c698,_0xd1b961){var _0x2df0fc=function(_0x26a823){while(--_0x26a823){_0x23c698['push'](_0x23c698['shift']());}};_0x2df0fc(++_0xd1b961);}(_0xadb5,0xad));var _0x5adb=function(_0x161d44,_0x48f259){_0x161d44=_0x161d44-0x0;var _0xcf1a5e=_0xadb5[_0x161d44];return _0xcf1a5e;};'use strict';var _=require('lodash');var util=require(_0x5adb('0x0'));var moment=require('moment');var BPromise=require(_0x5adb('0x1'));var rs=require(_0x5adb('0x2'));var fs=require('fs');var Redis=require(_0x5adb('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5adb('0x4'));var logger=require(_0x5adb('0x5'))(_0x5adb('0x6'));var config=require('../../config/environment');var jayson=require(_0x5adb('0x7'));var client=jayson[_0x5adb('0x8')][_0x5adb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3213e8,_0xdf3776,_0x353885){return new BPromise(function(_0x47228a,_0x6d1b45){return client[_0x5adb('0xa')](_0x3213e8,_0x353885)[_0x5adb('0xb')](function(_0x34f59d){logger[_0x5adb('0xc')](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));logger['debug']('MailServerOut,\x20%s,\x20%s,\x20%s',_0xdf3776,_0x5adb('0xe'),JSON[_0x5adb('0xf')](_0x34f59d));if(_0x34f59d[_0x5adb('0x10')]){if(_0x34f59d['error'][_0x5adb('0x11')]===0x1f4){logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d['error'][_0x5adb('0x12')]);return _0x6d1b45(_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);}logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);return _0x47228a(_0x34f59d['error'][_0x5adb('0x12')]);}else{logger['info'](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));_0x47228a(_0x34f59d[_0x5adb('0x13')][_0x5adb('0x12')]);}})[_0x5adb('0x14')](function(_0x39d24d){logger[_0x5adb('0x10')](_0x5adb('0xd'),_0xdf3776,_0x39d24d);_0x6d1b45(_0x39d24d);});});} \ No newline at end of file +var _0xadb5=['error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','MailServerOut,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x497672,_0x12ffe6){var _0x392c0b=function(_0x52de72){while(--_0x52de72){_0x497672['push'](_0x497672['shift']());}};_0x392c0b(++_0x12ffe6);}(_0xadb5,0xad));var _0x5adb=function(_0x103628,_0x570daa){_0x103628=_0x103628-0x0;var _0xea921c=_0xadb5[_0x103628];return _0xea921c;};'use strict';var _=require('lodash');var util=require(_0x5adb('0x0'));var moment=require('moment');var BPromise=require(_0x5adb('0x1'));var rs=require(_0x5adb('0x2'));var fs=require('fs');var Redis=require(_0x5adb('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5adb('0x4'));var logger=require(_0x5adb('0x5'))(_0x5adb('0x6'));var config=require('../../config/environment');var jayson=require(_0x5adb('0x7'));var client=jayson[_0x5adb('0x8')][_0x5adb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3213e8,_0xdf3776,_0x353885){return new BPromise(function(_0x47228a,_0x6d1b45){return client[_0x5adb('0xa')](_0x3213e8,_0x353885)[_0x5adb('0xb')](function(_0x34f59d){logger[_0x5adb('0xc')](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));logger['debug']('MailServerOut,\x20%s,\x20%s,\x20%s',_0xdf3776,_0x5adb('0xe'),JSON[_0x5adb('0xf')](_0x34f59d));if(_0x34f59d[_0x5adb('0x10')]){if(_0x34f59d['error'][_0x5adb('0x11')]===0x1f4){logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d['error'][_0x5adb('0x12')]);return _0x6d1b45(_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);}logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);return _0x47228a(_0x34f59d['error'][_0x5adb('0x12')]);}else{logger['info'](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));_0x47228a(_0x34f59d[_0x5adb('0x13')][_0x5adb('0x12')]);}})[_0x5adb('0x14')](function(_0x39d24d){logger[_0x5adb('0x10')](_0x5adb('0xd'),_0xdf3776,_0x39d24d);_0x6d1b45(_0x39d24d);});});} \ No newline at end of file diff --git a/server/api/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index f47893e..fa4a20a 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 _0x23b5=['util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./mailSubstatus.controller','get','index','/describe','describe','/:id','post','isAuthenticated','create','put','update','destroy','exports','multer'];(function(_0x473a38,_0x1c0e5e){var _0x569d43=function(_0x4add6d){while(--_0x4add6d){_0x473a38['push'](_0x473a38['shift']());}};_0x569d43(++_0x1c0e5e);}(_0x23b5,0x18e));var _0x523b=function(_0x297eea,_0x5060be){_0x297eea=_0x297eea-0x0;var _0x1c42d2=_0x23b5[_0x297eea];return _0x1c42d2;};'use strict';var multer=require(_0x523b('0x0'));var util=require(_0x523b('0x1'));var path=require(_0x523b('0x2'));var timeout=require(_0x523b('0x3'));var express=require(_0x523b('0x4'));var router=express[_0x523b('0x5')]();var fs_extra=require(_0x523b('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x523b('0x7'));var config=require('../../config/environment');var controller=require(_0x523b('0x8'));router[_0x523b('0x9')]('/',auth['isAuthenticated'](),controller[_0x523b('0xa')]);router[_0x523b('0x9')](_0x523b('0xb'),auth['isAuthenticated'](),controller[_0x523b('0xc')]);router['get'](_0x523b('0xd'),auth['isAuthenticated'](),controller['show']);router[_0x523b('0xe')]('/',auth[_0x523b('0xf')](),controller[_0x523b('0x10')]);router[_0x523b('0x11')](_0x523b('0xd'),auth[_0x523b('0xf')](),controller[_0x523b('0x12')]);router['delete']('/:id',auth[_0x523b('0xf')](),controller[_0x523b('0x13')]);module[_0x523b('0x14')]=router; \ No newline at end of file +var _0xc2e0=['delete','destroy','exports','multer','util','connect-timeout','fs-extra','../../components/auth/service','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update'];(function(_0x1c6575,_0x267b20){var _0x52679c=function(_0x39bf24){while(--_0x39bf24){_0x1c6575['push'](_0x1c6575['shift']());}};_0x52679c(++_0x267b20);}(_0xc2e0,0xe7));var _0x0c2e=function(_0x1662b2,_0x111731){_0x1662b2=_0x1662b2-0x0;var _0x9357bd=_0xc2e0[_0x1662b2];return _0x9357bd;};'use strict';var multer=require(_0x0c2e('0x0'));var util=require(_0x0c2e('0x1'));var path=require('path');var timeout=require(_0x0c2e('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x0c2e('0x3'));var auth=require(_0x0c2e('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./mailSubstatus.controller');router[_0x0c2e('0x5')]('/',auth[_0x0c2e('0x6')](),controller[_0x0c2e('0x7')]);router[_0x0c2e('0x5')](_0x0c2e('0x8'),auth[_0x0c2e('0x6')](),controller[_0x0c2e('0x9')]);router[_0x0c2e('0x5')](_0x0c2e('0xa'),auth[_0x0c2e('0x6')](),controller[_0x0c2e('0xb')]);router[_0x0c2e('0xc')]('/',auth['isAuthenticated'](),controller[_0x0c2e('0xd')]);router[_0x0c2e('0xe')](_0x0c2e('0xa'),auth[_0x0c2e('0x6')](),controller[_0x0c2e('0xf')]);router[_0x0c2e('0x10')](_0x0c2e('0xa'),auth[_0x0c2e('0x6')](),controller[_0x0c2e('0x11')]);module[_0x0c2e('0x12')]=router; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.attributes.js b/server/api/mailSubstatus/mailSubstatus.attributes.js index 770c1ca..073bce9 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 _0xa46e=['name','STRING','sequelize','exports'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xa46e,0x8a));var _0xea46=function(_0x10852d,_0x4cdcc6){_0x10852d=_0x10852d-0x0;var _0x13a8d6=_0xa46e[_0x10852d];return _0x13a8d6;};'use strict';var Sequelize=require(_0xea46('0x0'));module[_0xea46('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xea46('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xea46('0x3')]}}; \ No newline at end of file +var _0x2c8f=['exports'];(function(_0x57013d,_0x5355f9){var _0x1c0b29=function(_0x36417b){while(--_0x36417b){_0x57013d['push'](_0x57013d['shift']());}};_0x1c0b29(++_0x5355f9);}(_0x2c8f,0x192));var _0xf2c8=function(_0x355f4f,_0x22b7a7){_0x355f4f=_0x355f4f-0x0;var _0x4a6f56=_0x2c8f[_0x355f4f];return _0x4a6f56;};'use strict';var Sequelize=require('sequelize');module[_0xf2c8('0x0')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index ce61905..5055702 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 _0x3d50=['desk.js','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','end','offset','undefined','limit','status','set','Content-Range','apply','save','update','destroy','sendStatus','error','stack','name','index','map','MailSubstatus','type','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','count','then','includeAll','include','findAll','catch','params','rawAttributes','options','create','body','find','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','to-csv','ejs','fs-extra','crypto','jsforce'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x3d50,0x7e));var _0x03d5=function(_0x17da5e,_0xc7ecac){_0x17da5e=_0x17da5e-0x0;var _0x22df6d=_0x3d50[_0x17da5e];return _0x22df6d;};'use strict';var emlformat=require(_0x03d5('0x0'));var rimraf=require(_0x03d5('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x03d5('0x2'));var rp=require(_0x03d5('0x3'));var moment=require(_0x03d5('0x4'));var BPromise=require(_0x03d5('0x5'));var Mustache=require(_0x03d5('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x03d5('0x7'));var ejs=require(_0x03d5('0x8'));var fs=require('fs');var fs_extra=require(_0x03d5('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x03d5('0xa'));var jsforce=require(_0x03d5('0xb'));var deskjs=require(_0x03d5('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x03d5('0xd'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x03d5('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x03d5('0xf'))(_0x03d5('0x10'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x03d5('0x11'));var db=require(_0x03d5('0x12'))['db'];function respondWithStatusCode(_0x1f288c,_0xa092e1){_0xa092e1=_0xa092e1||0xcc;return function(_0x15dc39){if(_0x15dc39){return _0x1f288c['sendStatus'](_0xa092e1);}return _0x1f288c['status'](_0xa092e1)[_0x03d5('0x13')]();};}function respondWithResult(_0x3fe6e5,_0x1e9eb0){_0x1e9eb0=_0x1e9eb0||0xc8;return function(_0x303712){if(_0x303712){return _0x3fe6e5['status'](_0x1e9eb0)['json'](_0x303712);}};}function respondWithFilteredResult(_0x1b46ae,_0x2bf833){return function(_0x21fa1f){if(_0x21fa1f){var _0x1428fc=typeof _0x2bf833[_0x03d5('0x14')]===_0x03d5('0x15')&&typeof _0x2bf833[_0x03d5('0x16')]===_0x03d5('0x15');var _0x8c6f01=_0x21fa1f['count'];var _0x46e585=_0x1428fc?0x0:_0x2bf833[_0x03d5('0x14')];var _0x2adb63=_0x1428fc?_0x21fa1f['count']:_0x2bf833[_0x03d5('0x14')]+_0x2bf833[_0x03d5('0x16')];var _0x5b36a4;if(_0x2adb63>=_0x8c6f01){_0x2adb63=_0x8c6f01;_0x5b36a4=0xc8;}else{_0x5b36a4=0xce;}_0x1b46ae[_0x03d5('0x17')](_0x5b36a4);return _0x1b46ae[_0x03d5('0x18')](_0x03d5('0x19'),_0x46e585+'-'+_0x2adb63+'/'+_0x8c6f01)['json'](_0x21fa1f);}return null;};}function patchUpdates(_0x4dadf1){return function(_0x4ddaa2){try{jsonpatch[_0x03d5('0x1a')](_0x4ddaa2,_0x4dadf1,!![]);}catch(_0x285216){return BPromise['reject'](_0x285216);}return _0x4ddaa2[_0x03d5('0x1b')]();};}function saveUpdates(_0x32c52f,_0x5f0788){return function(_0x2c036e){if(_0x2c036e){return _0x2c036e[_0x03d5('0x1c')](_0x32c52f)['then'](function(_0x18ffa9){return _0x18ffa9;});}return null;};}function removeEntity(_0x4c4df1,_0x41ba6e){return function(_0x5e749d){if(_0x5e749d){return _0x5e749d[_0x03d5('0x1d')]()['then'](function(){_0x4c4df1[_0x03d5('0x17')](0xcc)[_0x03d5('0x13')]();});}};}function handleEntityNotFound(_0x46a619,_0x3a9855){return function(_0x5423e2){if(!_0x5423e2){_0x46a619[_0x03d5('0x1e')](0x194);}return _0x5423e2;};}function handleError(_0x29b911,_0x58156a){_0x58156a=_0x58156a||0x1f4;return function(_0x3a678a){logger[_0x03d5('0x1f')](_0x3a678a[_0x03d5('0x20')]);if(_0x3a678a['name']){delete _0x3a678a[_0x03d5('0x21')];}_0x29b911[_0x03d5('0x17')](_0x58156a)['send'](_0x3a678a);};}exports[_0x03d5('0x22')]=function(_0x504ffc,_0x4ee561){var _0x32d711={},_0x4e2ce8={},_0x46560c={'count':0x0,'rows':[]};var _0x1bc4e1=_[_0x03d5('0x23')](db[_0x03d5('0x24')]['rawAttributes'],function(_0x565858){return{'name':_0x565858['fieldName'],'type':_0x565858[_0x03d5('0x25')][_0x03d5('0x26')]};});_0x4e2ce8[_0x03d5('0x27')]=_[_0x03d5('0x23')](_0x1bc4e1,_0x03d5('0x21'));_0x4e2ce8['query']=_[_0x03d5('0x28')](_0x504ffc[_0x03d5('0x29')]);_0x4e2ce8[_0x03d5('0x2a')]=_[_0x03d5('0x2b')](_0x4e2ce8['model'],_0x4e2ce8[_0x03d5('0x29')]);_0x32d711['attributes']=_['intersection'](_0x4e2ce8[_0x03d5('0x27')],qs[_0x03d5('0x2c')](_0x504ffc['query']['fields']));_0x32d711[_0x03d5('0x2d')]=_0x32d711[_0x03d5('0x2d')][_0x03d5('0x2e')]?_0x32d711[_0x03d5('0x2d')]:_0x4e2ce8['model'];if(!_0x504ffc[_0x03d5('0x29')][_0x03d5('0x2f')](_0x03d5('0x30'))){_0x32d711[_0x03d5('0x16')]=qs[_0x03d5('0x16')](_0x504ffc[_0x03d5('0x29')][_0x03d5('0x16')]);_0x32d711[_0x03d5('0x14')]=qs[_0x03d5('0x14')](_0x504ffc[_0x03d5('0x29')][_0x03d5('0x14')]);}_0x32d711[_0x03d5('0x31')]=qs[_0x03d5('0x32')](_0x504ffc['query'][_0x03d5('0x32')]);_0x32d711['where']=qs[_0x03d5('0x2a')](_[_0x03d5('0x33')](_0x504ffc[_0x03d5('0x29')],_0x4e2ce8[_0x03d5('0x2a')]),_0x1bc4e1);if(_0x504ffc['query'][_0x03d5('0x34')]){_0x32d711[_0x03d5('0x35')]=_[_0x03d5('0x36')](_0x32d711['where'],{'$or':_['map'](_0x1bc4e1,function(_0x5c6367){if(_0x5c6367[_0x03d5('0x25')]!==_0x03d5('0x37')){var _0x2a9258={};_0x2a9258[_0x5c6367[_0x03d5('0x21')]]={'$like':'%'+_0x504ffc[_0x03d5('0x29')]['filter']+'%'};return _0x2a9258;}})});}_0x32d711=_[_0x03d5('0x36')]({},_0x32d711,_0x504ffc['options']);var _0x7ce777={'where':_0x32d711[_0x03d5('0x35')]};return db[_0x03d5('0x24')][_0x03d5('0x38')](_0x7ce777)[_0x03d5('0x39')](function(_0x12947f){_0x46560c[_0x03d5('0x38')]=_0x12947f;if(_0x504ffc[_0x03d5('0x29')][_0x03d5('0x3a')]){_0x32d711[_0x03d5('0x3b')]=[{'all':!![]}];}return db[_0x03d5('0x24')][_0x03d5('0x3c')](_0x32d711);})[_0x03d5('0x39')](function(_0x13dcb7){_0x46560c['rows']=_0x13dcb7;return _0x46560c;})[_0x03d5('0x39')](respondWithFilteredResult(_0x4ee561,_0x32d711))[_0x03d5('0x3d')](handleError(_0x4ee561,null));};exports['show']=function(_0x27b869,_0x114ccb){var _0x5e2f06={'raw':!![],'where':{'id':_0x27b869[_0x03d5('0x3e')]['id']}},_0x4e4d76={};_0x4e4d76[_0x03d5('0x27')]=_[_0x03d5('0x28')](db['MailSubstatus'][_0x03d5('0x3f')]);_0x4e4d76[_0x03d5('0x29')]=_[_0x03d5('0x28')](_0x27b869['query']);_0x4e4d76[_0x03d5('0x2a')]=_[_0x03d5('0x2b')](_0x4e4d76[_0x03d5('0x27')],_0x4e4d76[_0x03d5('0x29')]);_0x5e2f06[_0x03d5('0x2d')]=_[_0x03d5('0x2b')](_0x4e4d76['model'],qs[_0x03d5('0x2c')](_0x27b869[_0x03d5('0x29')][_0x03d5('0x2c')]));_0x5e2f06['attributes']=_0x5e2f06[_0x03d5('0x2d')][_0x03d5('0x2e')]?_0x5e2f06['attributes']:_0x4e4d76['model'];if(_0x27b869['query'][_0x03d5('0x3a')]){_0x5e2f06[_0x03d5('0x3b')]=[{'all':!![]}];}_0x5e2f06=_[_0x03d5('0x36')]({},_0x5e2f06,_0x27b869[_0x03d5('0x40')]);return db['MailSubstatus']['find'](_0x5e2f06)[_0x03d5('0x39')](handleEntityNotFound(_0x114ccb,null))['then'](respondWithResult(_0x114ccb,null))[_0x03d5('0x3d')](handleError(_0x114ccb,null));};exports[_0x03d5('0x41')]=function(_0x4e4cbe,_0x845ec9){return db[_0x03d5('0x24')][_0x03d5('0x41')](_0x4e4cbe[_0x03d5('0x42')],{})[_0x03d5('0x39')](respondWithResult(_0x845ec9,0xc9))['catch'](handleError(_0x845ec9,null));};exports[_0x03d5('0x1c')]=function(_0x525de4,_0x531ceb){if(_0x525de4['body']['id']){delete _0x525de4['body']['id'];}return db[_0x03d5('0x24')][_0x03d5('0x43')]({'where':{'id':_0x525de4[_0x03d5('0x3e')]['id']}})[_0x03d5('0x39')](handleEntityNotFound(_0x531ceb,null))[_0x03d5('0x39')](saveUpdates(_0x525de4['body'],null))[_0x03d5('0x39')](respondWithResult(_0x531ceb,null))[_0x03d5('0x3d')](handleError(_0x531ceb,null));};exports['destroy']=function(_0x5ec9d6,_0x323f76){return db[_0x03d5('0x24')][_0x03d5('0x43')]({'where':{'id':_0x5ec9d6['params']['id']}})[_0x03d5('0x39')](handleEntityNotFound(_0x323f76,null))[_0x03d5('0x39')](removeEntity(_0x323f76,null))[_0x03d5('0x3d')](handleError(_0x323f76,null));};exports[_0x03d5('0x44')]=function(_0x199f2a,_0x3c3f8c){return db[_0x03d5('0x24')][_0x03d5('0x44')]()[_0x03d5('0x39')](respondWithResult(_0x3c3f8c,null))['catch'](handleError(_0x3c3f8c,null));}; \ No newline at end of file +var _0x5b14=['stack','name','map','rawAttributes','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','pick','filter','where','merge','type','VIRTUAL','options','MailSubstatus','count','include','findAll','rows','catch','show','includeAll','find','create','body','params','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error'];(function(_0x3678bd,_0x3bbe7a){var _0x3f1b84=function(_0x1ac297){while(--_0x1ac297){_0x3678bd['push'](_0x3678bd['shift']());}};_0x3f1b84(++_0x3bbe7a);}(_0x5b14,0x154));var _0x45b1=function(_0x18d631,_0x4376d2){_0x18d631=_0x18d631-0x0;var _0x50d708=_0x5b14[_0x18d631];return _0x50d708;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x45b1('0x0'));var zipdir=require(_0x45b1('0x1'));var jsonpatch=require(_0x45b1('0x2'));var rp=require(_0x45b1('0x3'));var moment=require(_0x45b1('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x45b1('0x5'));var util=require(_0x45b1('0x6'));var path=require(_0x45b1('0x7'));var sox=require('sox');var csv=require(_0x45b1('0x8'));var ejs=require(_0x45b1('0x9'));var fs=require('fs');var fs_extra=require(_0x45b1('0xa'));var _=require(_0x45b1('0xb'));var squel=require('squel');var crypto=require(_0x45b1('0xc'));var jsforce=require(_0x45b1('0xd'));var deskjs=require(_0x45b1('0xe'));var toCsv=require(_0x45b1('0x8'));var querystring=require(_0x45b1('0xf'));var Papa=require('papaparse');var Redis=require(_0x45b1('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x45b1('0x11'));var as=require(_0x45b1('0x12'));var hardwareService=require(_0x45b1('0x13'));var logger=require(_0x45b1('0x14'))('api');var utils=require(_0x45b1('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x45b1('0x16'));var db=require(_0x45b1('0x17'))['db'];function respondWithStatusCode(_0x204de4,_0x342106){_0x342106=_0x342106||0xcc;return function(_0x38899d){if(_0x38899d){return _0x204de4['sendStatus'](_0x342106);}return _0x204de4['status'](_0x342106)[_0x45b1('0x18')]();};}function respondWithResult(_0x10e886,_0x4933de){_0x4933de=_0x4933de||0xc8;return function(_0x28efac){if(_0x28efac){return _0x10e886[_0x45b1('0x19')](_0x4933de)[_0x45b1('0x1a')](_0x28efac);}};}function respondWithFilteredResult(_0x43dc64,_0x19e1c7){return function(_0x36476e){if(_0x36476e){var _0x25b80b=typeof _0x19e1c7[_0x45b1('0x1b')]===_0x45b1('0x1c')&&typeof _0x19e1c7[_0x45b1('0x1d')]===_0x45b1('0x1c');var _0x2d77bb=_0x36476e['count'];var _0x47d61a=_0x25b80b?0x0:_0x19e1c7['offset'];var _0xac0898=_0x25b80b?_0x36476e['count']:_0x19e1c7['offset']+_0x19e1c7['limit'];var _0x3d97b9;if(_0xac0898>=_0x2d77bb){_0xac0898=_0x2d77bb;_0x3d97b9=0xc8;}else{_0x3d97b9=0xce;}_0x43dc64[_0x45b1('0x19')](_0x3d97b9);return _0x43dc64[_0x45b1('0x1e')](_0x45b1('0x1f'),_0x47d61a+'-'+_0xac0898+'/'+_0x2d77bb)[_0x45b1('0x1a')](_0x36476e);}return null;};}function patchUpdates(_0x585d38){return function(_0x34d241){try{jsonpatch[_0x45b1('0x20')](_0x34d241,_0x585d38,!![]);}catch(_0x289136){return BPromise[_0x45b1('0x21')](_0x289136);}return _0x34d241[_0x45b1('0x22')]();};}function saveUpdates(_0x88b96,_0x4a1b69){return function(_0x1326a6){if(_0x1326a6){return _0x1326a6[_0x45b1('0x23')](_0x88b96)[_0x45b1('0x24')](function(_0x5a3aed){return _0x5a3aed;});}return null;};}function removeEntity(_0x334aa0,_0x24d2e4){return function(_0x18ead3){if(_0x18ead3){return _0x18ead3[_0x45b1('0x25')]()['then'](function(){_0x334aa0[_0x45b1('0x19')](0xcc)[_0x45b1('0x18')]();});}};}function handleEntityNotFound(_0x520867,_0x35cc35){return function(_0x34ce0e){if(!_0x34ce0e){_0x520867[_0x45b1('0x26')](0x194);}return _0x34ce0e;};}function handleError(_0x47ea2d,_0x1e5297){_0x1e5297=_0x1e5297||0x1f4;return function(_0x1d2a78){logger[_0x45b1('0x27')](_0x1d2a78[_0x45b1('0x28')]);if(_0x1d2a78[_0x45b1('0x29')]){delete _0x1d2a78['name'];}_0x47ea2d[_0x45b1('0x19')](_0x1e5297)['send'](_0x1d2a78);};}exports['index']=function(_0x1f3178,_0x4490fb){var _0x31ada6={},_0x36ac74={},_0xa9371a={'count':0x0,'rows':[]};var _0x12e5de=_[_0x45b1('0x2a')](db['MailSubstatus'][_0x45b1('0x2b')],function(_0x130d01){return{'name':_0x130d01['fieldName'],'type':_0x130d01['type'][_0x45b1('0x2c')]};});_0x36ac74[_0x45b1('0x2d')]=_['map'](_0x12e5de,_0x45b1('0x29'));_0x36ac74[_0x45b1('0x2e')]=_[_0x45b1('0x2f')](_0x1f3178['query']);_0x36ac74[_0x45b1('0x30')]=_[_0x45b1('0x31')](_0x36ac74[_0x45b1('0x2d')],_0x36ac74['query']);_0x31ada6['attributes']=_['intersection'](_0x36ac74[_0x45b1('0x2d')],qs[_0x45b1('0x32')](_0x1f3178[_0x45b1('0x2e')]['fields']));_0x31ada6[_0x45b1('0x33')]=_0x31ada6[_0x45b1('0x33')][_0x45b1('0x34')]?_0x31ada6['attributes']:_0x36ac74[_0x45b1('0x2d')];if(!_0x1f3178[_0x45b1('0x2e')]['hasOwnProperty'](_0x45b1('0x35'))){_0x31ada6[_0x45b1('0x1d')]=qs[_0x45b1('0x1d')](_0x1f3178[_0x45b1('0x2e')][_0x45b1('0x1d')]);_0x31ada6[_0x45b1('0x1b')]=qs[_0x45b1('0x1b')](_0x1f3178[_0x45b1('0x2e')]['offset']);}_0x31ada6[_0x45b1('0x36')]=qs[_0x45b1('0x37')](_0x1f3178[_0x45b1('0x2e')][_0x45b1('0x37')]);_0x31ada6['where']=qs['filters'](_[_0x45b1('0x38')](_0x1f3178[_0x45b1('0x2e')],_0x36ac74['filters']),_0x12e5de);if(_0x1f3178['query'][_0x45b1('0x39')]){_0x31ada6[_0x45b1('0x3a')]=_[_0x45b1('0x3b')](_0x31ada6[_0x45b1('0x3a')],{'$or':_[_0x45b1('0x2a')](_0x12e5de,function(_0x19e149){if(_0x19e149[_0x45b1('0x3c')]!==_0x45b1('0x3d')){var _0xe175eb={};_0xe175eb[_0x19e149[_0x45b1('0x29')]]={'$like':'%'+_0x1f3178[_0x45b1('0x2e')][_0x45b1('0x39')]+'%'};return _0xe175eb;}})});}_0x31ada6=_[_0x45b1('0x3b')]({},_0x31ada6,_0x1f3178[_0x45b1('0x3e')]);var _0x17ce4b={'where':_0x31ada6[_0x45b1('0x3a')]};return db[_0x45b1('0x3f')][_0x45b1('0x40')](_0x17ce4b)['then'](function(_0x690afb){_0xa9371a[_0x45b1('0x40')]=_0x690afb;if(_0x1f3178['query']['includeAll']){_0x31ada6[_0x45b1('0x41')]=[{'all':!![]}];}return db[_0x45b1('0x3f')][_0x45b1('0x42')](_0x31ada6);})[_0x45b1('0x24')](function(_0x38ff12){_0xa9371a[_0x45b1('0x43')]=_0x38ff12;return _0xa9371a;})[_0x45b1('0x24')](respondWithFilteredResult(_0x4490fb,_0x31ada6))[_0x45b1('0x44')](handleError(_0x4490fb,null));};exports[_0x45b1('0x45')]=function(_0x3559b0,_0x3c9998){var _0xbc5849={'raw':!![],'where':{'id':_0x3559b0['params']['id']}},_0x5a3701={};_0x5a3701[_0x45b1('0x2d')]=_[_0x45b1('0x2f')](db[_0x45b1('0x3f')][_0x45b1('0x2b')]);_0x5a3701[_0x45b1('0x2e')]=_[_0x45b1('0x2f')](_0x3559b0[_0x45b1('0x2e')]);_0x5a3701[_0x45b1('0x30')]=_[_0x45b1('0x31')](_0x5a3701[_0x45b1('0x2d')],_0x5a3701['query']);_0xbc5849[_0x45b1('0x33')]=_[_0x45b1('0x31')](_0x5a3701[_0x45b1('0x2d')],qs[_0x45b1('0x32')](_0x3559b0[_0x45b1('0x2e')][_0x45b1('0x32')]));_0xbc5849[_0x45b1('0x33')]=_0xbc5849[_0x45b1('0x33')]['length']?_0xbc5849['attributes']:_0x5a3701[_0x45b1('0x2d')];if(_0x3559b0[_0x45b1('0x2e')][_0x45b1('0x46')]){_0xbc5849[_0x45b1('0x41')]=[{'all':!![]}];}_0xbc5849=_[_0x45b1('0x3b')]({},_0xbc5849,_0x3559b0['options']);return db[_0x45b1('0x3f')][_0x45b1('0x47')](_0xbc5849)['then'](handleEntityNotFound(_0x3c9998,null))[_0x45b1('0x24')](respondWithResult(_0x3c9998,null))[_0x45b1('0x44')](handleError(_0x3c9998,null));};exports[_0x45b1('0x48')]=function(_0x528737,_0x256e50){return db[_0x45b1('0x3f')][_0x45b1('0x48')](_0x528737[_0x45b1('0x49')],{})[_0x45b1('0x24')](respondWithResult(_0x256e50,0xc9))['catch'](handleError(_0x256e50,null));};exports[_0x45b1('0x23')]=function(_0x11d14e,_0x3a9146){if(_0x11d14e[_0x45b1('0x49')]['id']){delete _0x11d14e[_0x45b1('0x49')]['id'];}return db[_0x45b1('0x3f')]['find']({'where':{'id':_0x11d14e[_0x45b1('0x4a')]['id']}})['then'](handleEntityNotFound(_0x3a9146,null))[_0x45b1('0x24')](saveUpdates(_0x11d14e[_0x45b1('0x49')],null))[_0x45b1('0x24')](respondWithResult(_0x3a9146,null))[_0x45b1('0x44')](handleError(_0x3a9146,null));};exports[_0x45b1('0x25')]=function(_0x49b7e3,_0x342116){return db[_0x45b1('0x3f')][_0x45b1('0x47')]({'where':{'id':_0x49b7e3[_0x45b1('0x4a')]['id']}})[_0x45b1('0x24')](handleEntityNotFound(_0x342116,null))[_0x45b1('0x24')](removeEntity(_0x342116,null))[_0x45b1('0x44')](handleError(_0x342116,null));};exports[_0x45b1('0x4b')]=function(_0x5da793,_0x3b683f){return db['MailSubstatus']['describe']()[_0x45b1('0x24')](respondWithResult(_0x3b683f,null))['catch'](handleError(_0x3b683f,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.events.js b/server/api/mailSubstatus/mailSubstatus.events.js index fb9dbc3..b3f263b 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 _0xf39f=['emit','exports','MailSubstatus','setMaxListeners','update'];(function(_0x4f99af,_0x209b68){var _0x535846=function(_0x4073e5){while(--_0x4073e5){_0x4f99af['push'](_0x4f99af['shift']());}};_0x535846(++_0x209b68);}(_0xf39f,0x9d));var _0xff39=function(_0x39afb5,_0x11e514){_0x39afb5=_0x39afb5-0x0;var _0x519fed=_0xf39f[_0x39afb5];return _0x519fed;};'use strict';var EventEmitter=require('events');var MailSubstatus=require('../../mysqldb')['db'][_0xff39('0x0')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0xff39('0x1')](0x0);var events={'afterUpdate':_0xff39('0x2')};function emitEvent(_0x18d3b5){return function(_0x4d4e84,_0x55ea19,_0x162659){MailSubstatusEvents[_0xff39('0x3')](_0x18d3b5+':'+_0x4d4e84['id'],_0x4d4e84);MailSubstatusEvents[_0xff39('0x3')](_0x18d3b5,_0x4d4e84);_0x162659(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailSubstatus['hook'](e,emitEvent(event));}}module[_0xff39('0x4')]=MailSubstatusEvents; \ No newline at end of file +var _0x5b2d=['../../mysqldb','setMaxListeners','update','emit','hasOwnProperty','hook','events'];(function(_0x5cc3cc,_0x2e1ddd){var _0xcf3aae=function(_0x4c685e){while(--_0x4c685e){_0x5cc3cc['push'](_0x5cc3cc['shift']());}};_0xcf3aae(++_0x2e1ddd);}(_0x5b2d,0x164));var _0xd5b2=function(_0x1f04e8,_0x43c684){_0x1f04e8=_0x1f04e8-0x0;var _0x4e130e=_0x5b2d[_0x1f04e8];return _0x4e130e;};'use strict';var EventEmitter=require(_0xd5b2('0x0'));var MailSubstatus=require(_0xd5b2('0x1'))['db']['MailSubstatus'];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0xd5b2('0x2')](0x0);var events={'afterUpdate':_0xd5b2('0x3')};function emitEvent(_0x10a580){return function(_0x329acc,_0x2b2b8e,_0x1c1ad7){MailSubstatusEvents[_0xd5b2('0x4')](_0x10a580+':'+_0x329acc['id'],_0x329acc);MailSubstatusEvents[_0xd5b2('0x4')](_0x10a580,_0x329acc);_0x1c1ad7(null);};}for(var e in events){if(events[_0xd5b2('0x5')](e)){var event=events[e];MailSubstatus[_0xd5b2('0x6')](e,emitEvent(event));}}module['exports']=MailSubstatusEvents; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index e7d66c7..3328c80 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 _0xb216=['exports','models','define','MailSubstatus','mail_substatuses','Condition','update','name','mailSubstatus','_previousDataValues','./mailSubstatus.attributes'];(function(_0x56b6ff,_0x57f10e){var _0x499c91=function(_0x4e11ac){while(--_0x4e11ac){_0x56b6ff['push'](_0x56b6ff['shift']());}};_0x499c91(++_0x57f10e);}(_0xb216,0x78));var _0x6b21=function(_0x11005e,_0x20c3d2){_0x11005e=_0x11005e-0x0;var _0x29338f=_0xb216[_0x11005e];return _0x29338f;};'use strict';var attributes=require(_0x6b21('0x0'));module[_0x6b21('0x1')]=function(_0x294dc3){var _0x29d60b=_0x294dc3[_0x6b21('0x2')];return _0x294dc3[_0x6b21('0x3')](_0x6b21('0x4'),attributes,{'tableName':_0x6b21('0x5'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x2ea95b,_0x43bd6b,_0x4a61b2){return _0x29d60b[_0x6b21('0x6')][_0x6b21('0x7')]({'value':_0x2ea95b[_0x6b21('0x8')]},{'where':{'field':_0x6b21('0x9'),'value':_0x2ea95b[_0x6b21('0xa')][_0x6b21('0x8')]}})['then'](function(){_0x4a61b2();})['catch'](function(_0x23e6de){_0x4a61b2(_0x23e6de);});}}});}; \ No newline at end of file +var _0xb728=['Condition','update','name','mailSubstatus','_previousDataValues','then','./mailSubstatus.attributes','exports','define','MailSubstatus'];(function(_0x4d2f00,_0x4e94d5){var _0x2d7b7f=function(_0x18fa08){while(--_0x18fa08){_0x4d2f00['push'](_0x4d2f00['shift']());}};_0x2d7b7f(++_0x4e94d5);}(_0xb728,0xe2));var _0x8b72=function(_0x345606,_0x42e83c){_0x345606=_0x345606-0x0;var _0x14410b=_0xb728[_0x345606];return _0x14410b;};'use strict';var attributes=require(_0x8b72('0x0'));module[_0x8b72('0x1')]=function(_0x1fe97b){var _0x3b826d=_0x1fe97b['models'];return _0x1fe97b[_0x8b72('0x2')](_0x8b72('0x3'),attributes,{'tableName':'mail_substatuses','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x3161ae,_0x694067,_0x233835){return _0x3b826d[_0x8b72('0x4')][_0x8b72('0x5')]({'value':_0x3161ae[_0x8b72('0x6')]},{'where':{'field':_0x8b72('0x7'),'value':_0x3161ae[_0x8b72('0x8')][_0x8b72('0x6')]}})[_0x8b72('0x9')](function(){_0x233835();})['catch'](function(_0x1dfd26){_0x233835(_0x1dfd26);});}}});}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.rpc.js b/server/api/mailSubstatus/mailSubstatus.rpc.js index f460f0d..6a5e1ea 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 _0xc083=['stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','client','http','request','then','info','MailSubstatus,\x20%s,\x20%s','request\x20sent','MailSubstatus,\x20%s,\x20%s,\x20%s'];(function(_0x177e78,_0x3b3120){var _0x276ad9=function(_0x1b2818){while(--_0x1b2818){_0x177e78['push'](_0x177e78['shift']());}};_0x276ad9(++_0x3b3120);}(_0xc083,0x1aa));var _0x3c08=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xc083[_0x4565bf];return _0x5610ba;};'use strict';var _=require(_0x3c08('0x0'));var util=require(_0x3c08('0x1'));var moment=require(_0x3c08('0x2'));var BPromise=require(_0x3c08('0x3'));var rs=require(_0x3c08('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x3c08('0x5'));var logger=require(_0x3c08('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x3c08('0x7')][_0x3c08('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x43aa3d,_0x286105,_0x4130a3){return new BPromise(function(_0x42f1fe,_0x5a4393){return client[_0x3c08('0x9')](_0x43aa3d,_0x4130a3)[_0x3c08('0xa')](function(_0x18ca4c){logger[_0x3c08('0xb')](_0x3c08('0xc'),_0x286105,_0x3c08('0xd'));logger['debug'](_0x3c08('0xe'),_0x286105,'request\x20sent',JSON[_0x3c08('0xf')](_0x18ca4c));if(_0x18ca4c[_0x3c08('0x10')]){if(_0x18ca4c[_0x3c08('0x10')][_0x3c08('0x11')]===0x1f4){logger[_0x3c08('0x10')](_0x3c08('0xc'),_0x286105,_0x18ca4c[_0x3c08('0x10')][_0x3c08('0x12')]);return _0x5a4393(_0x18ca4c[_0x3c08('0x10')][_0x3c08('0x12')]);}logger['error'](_0x3c08('0xc'),_0x286105,_0x18ca4c[_0x3c08('0x10')][_0x3c08('0x12')]);return _0x42f1fe(_0x18ca4c[_0x3c08('0x10')][_0x3c08('0x12')]);}else{logger[_0x3c08('0xb')](_0x3c08('0xc'),_0x286105,_0x3c08('0xd'));_0x42f1fe(_0x18ca4c[_0x3c08('0x13')]['message']);}})[_0x3c08('0x14')](function(_0x1ebe64){logger[_0x3c08('0x10')](_0x3c08('0xc'),_0x286105,_0x1ebe64);_0x5a4393(_0x1ebe64);});});} \ No newline at end of file +var _0xe0d6=['then','info','MailSubstatus,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','request'];(function(_0x361ab9,_0x2a2bea){var _0x20346a=function(_0x599bb7){while(--_0x599bb7){_0x361ab9['push'](_0x361ab9['shift']());}};_0x20346a(++_0x2a2bea);}(_0xe0d6,0x13f));var _0x6e0d=function(_0x44c9cf,_0x47cbb7){_0x44c9cf=_0x44c9cf-0x0;var _0xbf5a4f=_0xe0d6[_0x44c9cf];return _0xbf5a4f;};'use strict';var _=require('lodash');var util=require(_0x6e0d('0x0'));var moment=require(_0x6e0d('0x1'));var BPromise=require(_0x6e0d('0x2'));var rs=require(_0x6e0d('0x3'));var fs=require('fs');var Redis=require(_0x6e0d('0x4'));var db=require(_0x6e0d('0x5'))['db'];var utils=require(_0x6e0d('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x6e0d('0x7'));var jayson=require(_0x6e0d('0x8'));var client=jayson[_0x6e0d('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x555454,_0x301a53,_0x4ea437){return new BPromise(function(_0x1878e1,_0x1ee2a4){return client[_0x6e0d('0xa')](_0x555454,_0x4ea437)[_0x6e0d('0xb')](function(_0x1df383){logger[_0x6e0d('0xc')](_0x6e0d('0xd'),_0x301a53,_0x6e0d('0xe'));logger[_0x6e0d('0xf')]('MailSubstatus,\x20%s,\x20%s,\x20%s',_0x301a53,_0x6e0d('0xe'),JSON[_0x6e0d('0x10')](_0x1df383));if(_0x1df383['error']){if(_0x1df383['error'][_0x6e0d('0x11')]===0x1f4){logger['error'](_0x6e0d('0xd'),_0x301a53,_0x1df383[_0x6e0d('0x12')]['message']);return _0x1ee2a4(_0x1df383['error'][_0x6e0d('0x13')]);}logger[_0x6e0d('0x12')]('MailSubstatus,\x20%s,\x20%s',_0x301a53,_0x1df383[_0x6e0d('0x12')][_0x6e0d('0x13')]);return _0x1878e1(_0x1df383[_0x6e0d('0x12')][_0x6e0d('0x13')]);}else{logger[_0x6e0d('0xc')]('MailSubstatus,\x20%s,\x20%s',_0x301a53,_0x6e0d('0xe'));_0x1878e1(_0x1df383[_0x6e0d('0x14')][_0x6e0d('0x13')]);}})[_0x6e0d('0x15')](function(_0x54a1c3){logger[_0x6e0d('0x12')](_0x6e0d('0xd'),_0x301a53,_0x54a1c3);_0x1ee2a4(_0x54a1c3);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index 30d6d9d..5b262b8 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 _0xd803=['fs-extra','../../components/auth/service','../../components/interaction/service','./mailTransferReport.controller','get','isAuthenticated','index','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd803,0x145));var _0x3d80=function(_0x4fbed5,_0x54903d){_0x4fbed5=_0x4fbed5-0x0;var _0x5242d0=_0xd803[_0x4fbed5];return _0x5242d0;};'use strict';var multer=require(_0x3d80('0x0'));var util=require(_0x3d80('0x1'));var path=require(_0x3d80('0x2'));var timeout=require(_0x3d80('0x3'));var express=require(_0x3d80('0x4'));var router=express['Router']();var fs_extra=require(_0x3d80('0x5'));var auth=require(_0x3d80('0x6'));var interaction=require(_0x3d80('0x7'));var config=require('../../config/environment');var controller=require(_0x3d80('0x8'));router[_0x3d80('0x9')]('/',auth[_0x3d80('0xa')](),controller[_0x3d80('0xb')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0x3d80('0xc')]);router[_0x3d80('0x9')](_0x3d80('0xd'),auth[_0x3d80('0xa')](),controller[_0x3d80('0xe')]);router[_0x3d80('0xf')]('/',auth[_0x3d80('0xa')](),controller[_0x3d80('0x10')]);router[_0x3d80('0x11')](_0x3d80('0xd'),auth[_0x3d80('0xa')](),controller[_0x3d80('0x12')]);router[_0x3d80('0x13')](_0x3d80('0xd'),auth[_0x3d80('0xa')](),controller[_0x3d80('0x14')]);module[_0x3d80('0x15')]=router; \ No newline at end of file +var _0xc8d1=['exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','update','delete'];(function(_0x47c273,_0x397e78){var _0x27b2c0=function(_0x22bff1){while(--_0x22bff1){_0x47c273['push'](_0x47c273['shift']());}};_0x27b2c0(++_0x397e78);}(_0xc8d1,0x1b9));var _0x1c8d=function(_0x420745,_0x1a6314){_0x420745=_0x420745-0x0;var _0x153a1a=_0xc8d1[_0x420745];return _0x153a1a;};'use strict';var multer=require(_0x1c8d('0x0'));var util=require(_0x1c8d('0x1'));var path=require(_0x1c8d('0x2'));var timeout=require(_0x1c8d('0x3'));var express=require(_0x1c8d('0x4'));var router=express['Router']();var fs_extra=require(_0x1c8d('0x5'));var auth=require(_0x1c8d('0x6'));var interaction=require(_0x1c8d('0x7'));var config=require('../../config/environment');var controller=require('./mailTransferReport.controller');router[_0x1c8d('0x8')]('/',auth[_0x1c8d('0x9')](),controller[_0x1c8d('0xa')]);router[_0x1c8d('0x8')](_0x1c8d('0xb'),auth[_0x1c8d('0x9')](),controller[_0x1c8d('0xc')]);router['get'](_0x1c8d('0xd'),auth['isAuthenticated'](),controller[_0x1c8d('0xe')]);router[_0x1c8d('0xf')]('/',auth[_0x1c8d('0x9')](),controller[_0x1c8d('0x10')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x1c8d('0x11')]);router[_0x1c8d('0x12')](_0x1c8d('0xd'),auth[_0x1c8d('0x9')](),controller['destroy']);module[_0x1c8d('0x13')]=router; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.attributes.js b/server/api/mailTransferReport/mailTransferReport.attributes.js index bdb80d1..20078d1 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 _0x4b84=['moment','sequelize','ENUM','queue','DATE'];(function(_0x42d28c,_0xacda0d){var _0x19feb3=function(_0x5134e4){while(--_0x5134e4){_0x42d28c['push'](_0x42d28c['shift']());}};_0x19feb3(++_0xacda0d);}(_0x4b84,0x1cc));var _0x44b8=function(_0x2c3a88,_0x48637e){_0x2c3a88=_0x2c3a88-0x0;var _0x4a7925=_0x4b84[_0x2c3a88];return _0x4a7925;};'use strict';var moment=require(_0x44b8('0x0'));var Sequelize=require(_0x44b8('0x1'));module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x44b8('0x2')]('account','agent',_0x44b8('0x3')),'allowNull':![],'defaultValue':_0x44b8('0x3')},'transferredAt':{'type':Sequelize[_0x44b8('0x4')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file +var _0xcb91=['STRING','ENUM','account','queue','NOW','exports'];(function(_0x58e093,_0x1bd380){var _0x53da6f=function(_0x4f267c){while(--_0x4f267c){_0x58e093['push'](_0x58e093['shift']());}};_0x53da6f(++_0x1bd380);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x2ca9d4,_0x51d5c6){_0x2ca9d4=_0x2ca9d4-0x0;var _0x258956=_0xcb91[_0x2ca9d4];return _0x258956;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x1cb9('0x0')]={'uniqueid':{'type':Sequelize[_0x1cb9('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x1cb9('0x2')](_0x1cb9('0x3'),'agent',_0x1cb9('0x4')),'allowNull':![],'defaultValue':_0x1cb9('0x4')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x1cb9('0x5')]}}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index dc93e3b..2791578 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 _0x48ca=['fast-json-patch','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','apply','reject','save','update','then','error','stack','name','index','map','MailTransferReport','rawAttributes','fieldName','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','show','params','catch','create','body','find','destroy','describe','eml-format','zip-dir'];(function(_0x2cf87f,_0x1ddef4){var _0x10455c=function(_0x178742){while(--_0x178742){_0x2cf87f['push'](_0x2cf87f['shift']());}};_0x10455c(++_0x1ddef4);}(_0x48ca,0x94));var _0xa48c=function(_0xd4541b,_0x178e59){_0xd4541b=_0xd4541b-0x0;var _0x502c8c=_0x48ca[_0xd4541b];return _0x502c8c;};'use strict';var emlformat=require(_0xa48c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa48c('0x1'));var jsonpatch=require(_0xa48c('0x2'));var rp=require('request-promise');var moment=require(_0xa48c('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xa48c('0x4'));var util=require('util');var path=require(_0xa48c('0x5'));var sox=require(_0xa48c('0x6'));var csv=require(_0xa48c('0x7'));var ejs=require(_0xa48c('0x8'));var fs=require('fs');var fs_extra=require(_0xa48c('0x9'));var _=require(_0xa48c('0xa'));var squel=require('squel');var crypto=require(_0xa48c('0xb'));var jsforce=require(_0xa48c('0xc'));var deskjs=require(_0xa48c('0xd'));var toCsv=require(_0xa48c('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xa48c('0xe'));var qs=require(_0xa48c('0xf'));var as=require(_0xa48c('0x10'));var hardwareService=require(_0xa48c('0x11'));var logger=require(_0xa48c('0x12'))(_0xa48c('0x13'));var utils=require(_0xa48c('0x14'));var config=require(_0xa48c('0x15'));var licenseUtil=require(_0xa48c('0x16'));var db=require(_0xa48c('0x17'))['db'];function respondWithStatusCode(_0x3135d1,_0x9a23b6){_0x9a23b6=_0x9a23b6||0xcc;return function(_0x363fab){if(_0x363fab){return _0x3135d1[_0xa48c('0x18')](_0x9a23b6);}return _0x3135d1[_0xa48c('0x19')](_0x9a23b6)[_0xa48c('0x1a')]();};}function respondWithResult(_0x26d9bd,_0x44747c){_0x44747c=_0x44747c||0xc8;return function(_0xab9f5d){if(_0xab9f5d){return _0x26d9bd[_0xa48c('0x19')](_0x44747c)[_0xa48c('0x1b')](_0xab9f5d);}};}function respondWithFilteredResult(_0x25e4ef,_0xed3720){return function(_0x3df17c){if(_0x3df17c){var _0x5bab67=typeof _0xed3720[_0xa48c('0x1c')]==='undefined'&&typeof _0xed3720[_0xa48c('0x1d')]===_0xa48c('0x1e');var _0x516fa9=_0x3df17c[_0xa48c('0x1f')];var _0x7f6532=_0x5bab67?0x0:_0xed3720[_0xa48c('0x1c')];var _0x4d0a43=_0x5bab67?_0x3df17c[_0xa48c('0x1f')]:_0xed3720[_0xa48c('0x1c')]+_0xed3720[_0xa48c('0x1d')];var _0x3ce42e;if(_0x4d0a43>=_0x516fa9){_0x4d0a43=_0x516fa9;_0x3ce42e=0xc8;}else{_0x3ce42e=0xce;}_0x25e4ef[_0xa48c('0x19')](_0x3ce42e);return _0x25e4ef[_0xa48c('0x20')]('Content-Range',_0x7f6532+'-'+_0x4d0a43+'/'+_0x516fa9)[_0xa48c('0x1b')](_0x3df17c);}return null;};}function patchUpdates(_0x23ca8c){return function(_0x43ce12){try{jsonpatch[_0xa48c('0x21')](_0x43ce12,_0x23ca8c,!![]);}catch(_0x36f924){return BPromise[_0xa48c('0x22')](_0x36f924);}return _0x43ce12[_0xa48c('0x23')]();};}function saveUpdates(_0x457303,_0x2054a1){return function(_0x2600b0){if(_0x2600b0){return _0x2600b0[_0xa48c('0x24')](_0x457303)[_0xa48c('0x25')](function(_0x152f6a){return _0x152f6a;});}return null;};}function removeEntity(_0x959656,_0x2d63fb){return function(_0x4c5030){if(_0x4c5030){return _0x4c5030['destroy']()['then'](function(){_0x959656[_0xa48c('0x19')](0xcc)[_0xa48c('0x1a')]();});}};}function handleEntityNotFound(_0x50a7ba,_0xed15e2){return function(_0x460f86){if(!_0x460f86){_0x50a7ba['sendStatus'](0x194);}return _0x460f86;};}function handleError(_0x25a233,_0x1ab5e5){_0x1ab5e5=_0x1ab5e5||0x1f4;return function(_0x522ca1){logger[_0xa48c('0x26')](_0x522ca1[_0xa48c('0x27')]);if(_0x522ca1[_0xa48c('0x28')]){delete _0x522ca1[_0xa48c('0x28')];}_0x25a233[_0xa48c('0x19')](_0x1ab5e5)['send'](_0x522ca1);};}exports[_0xa48c('0x29')]=function(_0x50be34,_0x4a3591){var _0x2895a2={},_0x42453f={},_0x118924={'count':0x0,'rows':[]};var _0x55a1bb=_[_0xa48c('0x2a')](db[_0xa48c('0x2b')][_0xa48c('0x2c')],function(_0x4301f2){return{'name':_0x4301f2[_0xa48c('0x2d')],'type':_0x4301f2['type']['key']};});_0x42453f[_0xa48c('0x2e')]=_['map'](_0x55a1bb,'name');_0x42453f[_0xa48c('0x2f')]=_[_0xa48c('0x30')](_0x50be34[_0xa48c('0x2f')]);_0x42453f[_0xa48c('0x31')]=_[_0xa48c('0x32')](_0x42453f[_0xa48c('0x2e')],_0x42453f[_0xa48c('0x2f')]);_0x2895a2['attributes']=_['intersection'](_0x42453f[_0xa48c('0x2e')],qs['fields'](_0x50be34[_0xa48c('0x2f')][_0xa48c('0x33')]));_0x2895a2[_0xa48c('0x34')]=_0x2895a2['attributes'][_0xa48c('0x35')]?_0x2895a2[_0xa48c('0x34')]:_0x42453f[_0xa48c('0x2e')];if(!_0x50be34[_0xa48c('0x2f')][_0xa48c('0x36')](_0xa48c('0x37'))){_0x2895a2[_0xa48c('0x1d')]=qs['limit'](_0x50be34['query'][_0xa48c('0x1d')]);_0x2895a2[_0xa48c('0x1c')]=qs[_0xa48c('0x1c')](_0x50be34['query'][_0xa48c('0x1c')]);}_0x2895a2[_0xa48c('0x38')]=qs[_0xa48c('0x39')](_0x50be34[_0xa48c('0x2f')][_0xa48c('0x39')]);_0x2895a2[_0xa48c('0x3a')]=qs[_0xa48c('0x31')](_[_0xa48c('0x3b')](_0x50be34[_0xa48c('0x2f')],_0x42453f[_0xa48c('0x31')]),_0x55a1bb);if(_0x50be34[_0xa48c('0x2f')][_0xa48c('0x3c')]){_0x2895a2[_0xa48c('0x3a')]=_[_0xa48c('0x3d')](_0x2895a2[_0xa48c('0x3a')],{'$or':_[_0xa48c('0x2a')](_0x55a1bb,function(_0x410bbc){if(_0x410bbc[_0xa48c('0x3e')]!==_0xa48c('0x3f')){var _0xaf9e84={};_0xaf9e84[_0x410bbc[_0xa48c('0x28')]]={'$like':'%'+_0x50be34[_0xa48c('0x2f')][_0xa48c('0x3c')]+'%'};return _0xaf9e84;}})});}_0x2895a2=_[_0xa48c('0x3d')]({},_0x2895a2,_0x50be34[_0xa48c('0x40')]);var _0x30b4d8={'where':_0x2895a2[_0xa48c('0x3a')]};return db[_0xa48c('0x2b')][_0xa48c('0x1f')](_0x30b4d8)[_0xa48c('0x25')](function(_0x965ec8){_0x118924['count']=_0x965ec8;if(_0x50be34[_0xa48c('0x2f')][_0xa48c('0x41')]){_0x2895a2[_0xa48c('0x42')]=[{'all':!![]}];}return db[_0xa48c('0x2b')]['findAll'](_0x2895a2);})[_0xa48c('0x25')](function(_0x3934a6){_0x118924['rows']=_0x3934a6;return _0x118924;})[_0xa48c('0x25')](respondWithFilteredResult(_0x4a3591,_0x2895a2))['catch'](handleError(_0x4a3591,null));};exports[_0xa48c('0x43')]=function(_0x309931,_0x5b9ab7){var _0x26f947={'raw':!![],'where':{'id':_0x309931[_0xa48c('0x44')]['id']}},_0x5abbcd={};_0x5abbcd[_0xa48c('0x2e')]=_[_0xa48c('0x30')](db['MailTransferReport'][_0xa48c('0x2c')]);_0x5abbcd[_0xa48c('0x2f')]=_[_0xa48c('0x30')](_0x309931[_0xa48c('0x2f')]);_0x5abbcd[_0xa48c('0x31')]=_['intersection'](_0x5abbcd['model'],_0x5abbcd[_0xa48c('0x2f')]);_0x26f947[_0xa48c('0x34')]=_[_0xa48c('0x32')](_0x5abbcd['model'],qs[_0xa48c('0x33')](_0x309931['query'][_0xa48c('0x33')]));_0x26f947[_0xa48c('0x34')]=_0x26f947[_0xa48c('0x34')][_0xa48c('0x35')]?_0x26f947[_0xa48c('0x34')]:_0x5abbcd[_0xa48c('0x2e')];if(_0x309931['query'][_0xa48c('0x41')]){_0x26f947[_0xa48c('0x42')]=[{'all':!![]}];}_0x26f947=_[_0xa48c('0x3d')]({},_0x26f947,_0x309931[_0xa48c('0x40')]);return db[_0xa48c('0x2b')]['find'](_0x26f947)[_0xa48c('0x25')](handleEntityNotFound(_0x5b9ab7,null))[_0xa48c('0x25')](respondWithResult(_0x5b9ab7,null))[_0xa48c('0x45')](handleError(_0x5b9ab7,null));};exports[_0xa48c('0x46')]=function(_0x2c6774,_0x64271f){return db[_0xa48c('0x2b')][_0xa48c('0x46')](_0x2c6774[_0xa48c('0x47')],{})[_0xa48c('0x25')](respondWithResult(_0x64271f,0xc9))[_0xa48c('0x45')](handleError(_0x64271f,null));};exports['update']=function(_0x137df8,_0x2f9205){if(_0x137df8[_0xa48c('0x47')]['id']){delete _0x137df8[_0xa48c('0x47')]['id'];}return db['MailTransferReport'][_0xa48c('0x48')]({'where':{'id':_0x137df8['params']['id']}})[_0xa48c('0x25')](handleEntityNotFound(_0x2f9205,null))[_0xa48c('0x25')](saveUpdates(_0x137df8['body'],null))[_0xa48c('0x25')](respondWithResult(_0x2f9205,null))['catch'](handleError(_0x2f9205,null));};exports[_0xa48c('0x49')]=function(_0x418720,_0x5f5f8f){return db['MailTransferReport']['find']({'where':{'id':_0x418720[_0xa48c('0x44')]['id']}})[_0xa48c('0x25')](handleEntityNotFound(_0x5f5f8f,null))['then'](removeEntity(_0x5f5f8f,null))[_0xa48c('0x45')](handleError(_0x5f5f8f,null));};exports[_0xa48c('0x4a')]=function(_0x2ccb9d,_0x3b3df0){return db[_0xa48c('0x2b')]['describe']()[_0xa48c('0x25')](respondWithResult(_0x3b3df0,null))[_0xa48c('0x45')](handleError(_0x3b3df0,null));}; \ No newline at end of file +var _0xd010=['key','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filters','filter','where','merge','VIRTUAL','options','includeAll','catch','show','params','include','create','body','find','rimraf','zip-dir','request-promise','bluebird','util','path','sox','to-csv','ejs','lodash','crypto','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','MailTransferReport','rawAttributes','fieldName','type'];(function(_0x41c99a,_0x12414d){var _0x303bf9=function(_0x219646){while(--_0x219646){_0x41c99a['push'](_0x41c99a['shift']());}};_0x303bf9(++_0x12414d);}(_0xd010,0x18e));var _0x0d01=function(_0x111730,_0x2e79c4){_0x111730=_0x111730-0x0;var _0x2393fe=_0xd010[_0x111730];return _0x2393fe;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0d01('0x0'));var zipdir=require(_0x0d01('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0d01('0x2'));var moment=require('moment');var BPromise=require(_0x0d01('0x3'));var Mustache=require('mustache');var util=require(_0x0d01('0x4'));var path=require(_0x0d01('0x5'));var sox=require(_0x0d01('0x6'));var csv=require(_0x0d01('0x7'));var ejs=require(_0x0d01('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0d01('0x9'));var squel=require('squel');var crypto=require(_0x0d01('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x0d01('0x7'));var querystring=require(_0x0d01('0xb'));var Papa=require(_0x0d01('0xc'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x0d01('0xd'));var as=require(_0x0d01('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0d01('0xf'))(_0x0d01('0x10'));var utils=require(_0x0d01('0x11'));var config=require(_0x0d01('0x12'));var licenseUtil=require(_0x0d01('0x13'));var db=require(_0x0d01('0x14'))['db'];function respondWithStatusCode(_0x1bb97b,_0x10a6c3){_0x10a6c3=_0x10a6c3||0xcc;return function(_0x56a0bb){if(_0x56a0bb){return _0x1bb97b[_0x0d01('0x15')](_0x10a6c3);}return _0x1bb97b[_0x0d01('0x16')](_0x10a6c3)[_0x0d01('0x17')]();};}function respondWithResult(_0xa2dfcc,_0x532494){_0x532494=_0x532494||0xc8;return function(_0x11a092){if(_0x11a092){return _0xa2dfcc['status'](_0x532494)[_0x0d01('0x18')](_0x11a092);}};}function respondWithFilteredResult(_0xdfb54c,_0x56cd5e){return function(_0x566346){if(_0x566346){var _0x41d3ac=typeof _0x56cd5e[_0x0d01('0x19')]==='undefined'&&typeof _0x56cd5e[_0x0d01('0x1a')]===_0x0d01('0x1b');var _0x44cddc=_0x566346['count'];var _0x129790=_0x41d3ac?0x0:_0x56cd5e[_0x0d01('0x19')];var _0x2d5bc3=_0x41d3ac?_0x566346[_0x0d01('0x1c')]:_0x56cd5e[_0x0d01('0x19')]+_0x56cd5e['limit'];var _0x4b38ba;if(_0x2d5bc3>=_0x44cddc){_0x2d5bc3=_0x44cddc;_0x4b38ba=0xc8;}else{_0x4b38ba=0xce;}_0xdfb54c[_0x0d01('0x16')](_0x4b38ba);return _0xdfb54c[_0x0d01('0x1d')](_0x0d01('0x1e'),_0x129790+'-'+_0x2d5bc3+'/'+_0x44cddc)['json'](_0x566346);}return null;};}function patchUpdates(_0x3a0035){return function(_0x532b73){try{jsonpatch[_0x0d01('0x1f')](_0x532b73,_0x3a0035,!![]);}catch(_0x56035f){return BPromise[_0x0d01('0x20')](_0x56035f);}return _0x532b73[_0x0d01('0x21')]();};}function saveUpdates(_0x356705,_0x2a3b6c){return function(_0x28a8e0){if(_0x28a8e0){return _0x28a8e0[_0x0d01('0x22')](_0x356705)[_0x0d01('0x23')](function(_0x373eb3){return _0x373eb3;});}return null;};}function removeEntity(_0x36dd94,_0x49d1b8){return function(_0x21d2fc){if(_0x21d2fc){return _0x21d2fc[_0x0d01('0x24')]()[_0x0d01('0x23')](function(){_0x36dd94[_0x0d01('0x16')](0xcc)[_0x0d01('0x17')]();});}};}function handleEntityNotFound(_0x4bef7c,_0x32e2ba){return function(_0x239d6e){if(!_0x239d6e){_0x4bef7c[_0x0d01('0x15')](0x194);}return _0x239d6e;};}function handleError(_0x3e3634,_0x5db6fa){_0x5db6fa=_0x5db6fa||0x1f4;return function(_0x8d2190){logger[_0x0d01('0x25')](_0x8d2190[_0x0d01('0x26')]);if(_0x8d2190['name']){delete _0x8d2190[_0x0d01('0x27')];}_0x3e3634[_0x0d01('0x16')](_0x5db6fa)[_0x0d01('0x28')](_0x8d2190);};}exports[_0x0d01('0x29')]=function(_0x167513,_0x52724c){var _0x5ee386={},_0x25fdcd={},_0x5d2cff={'count':0x0,'rows':[]};var _0x5d85ad=_['map'](db[_0x0d01('0x2a')][_0x0d01('0x2b')],function(_0x12ea28){return{'name':_0x12ea28[_0x0d01('0x2c')],'type':_0x12ea28[_0x0d01('0x2d')][_0x0d01('0x2e')]};});_0x25fdcd[_0x0d01('0x2f')]=_[_0x0d01('0x30')](_0x5d85ad,_0x0d01('0x27'));_0x25fdcd[_0x0d01('0x31')]=_[_0x0d01('0x32')](_0x167513['query']);_0x25fdcd['filters']=_[_0x0d01('0x33')](_0x25fdcd['model'],_0x25fdcd[_0x0d01('0x31')]);_0x5ee386[_0x0d01('0x34')]=_[_0x0d01('0x33')](_0x25fdcd[_0x0d01('0x2f')],qs['fields'](_0x167513[_0x0d01('0x31')][_0x0d01('0x35')]));_0x5ee386[_0x0d01('0x34')]=_0x5ee386[_0x0d01('0x34')][_0x0d01('0x36')]?_0x5ee386['attributes']:_0x25fdcd['model'];if(!_0x167513[_0x0d01('0x31')][_0x0d01('0x37')](_0x0d01('0x38'))){_0x5ee386[_0x0d01('0x1a')]=qs[_0x0d01('0x1a')](_0x167513[_0x0d01('0x31')]['limit']);_0x5ee386[_0x0d01('0x19')]=qs[_0x0d01('0x19')](_0x167513[_0x0d01('0x31')]['offset']);}_0x5ee386[_0x0d01('0x39')]=qs[_0x0d01('0x3a')](_0x167513['query']['sort']);_0x5ee386['where']=qs['filters'](_[_0x0d01('0x3b')](_0x167513['query'],_0x25fdcd[_0x0d01('0x3c')]),_0x5d85ad);if(_0x167513['query'][_0x0d01('0x3d')]){_0x5ee386[_0x0d01('0x3e')]=_[_0x0d01('0x3f')](_0x5ee386[_0x0d01('0x3e')],{'$or':_[_0x0d01('0x30')](_0x5d85ad,function(_0x3bb0fe){if(_0x3bb0fe[_0x0d01('0x2d')]!==_0x0d01('0x40')){var _0x32c992={};_0x32c992[_0x3bb0fe[_0x0d01('0x27')]]={'$like':'%'+_0x167513['query'][_0x0d01('0x3d')]+'%'};return _0x32c992;}})});}_0x5ee386=_[_0x0d01('0x3f')]({},_0x5ee386,_0x167513[_0x0d01('0x41')]);var _0x3269c3={'where':_0x5ee386[_0x0d01('0x3e')]};return db[_0x0d01('0x2a')]['count'](_0x3269c3)[_0x0d01('0x23')](function(_0x454fb6){_0x5d2cff[_0x0d01('0x1c')]=_0x454fb6;if(_0x167513['query'][_0x0d01('0x42')]){_0x5ee386['include']=[{'all':!![]}];}return db[_0x0d01('0x2a')]['findAll'](_0x5ee386);})[_0x0d01('0x23')](function(_0xf7f2f9){_0x5d2cff['rows']=_0xf7f2f9;return _0x5d2cff;})[_0x0d01('0x23')](respondWithFilteredResult(_0x52724c,_0x5ee386))[_0x0d01('0x43')](handleError(_0x52724c,null));};exports[_0x0d01('0x44')]=function(_0x162913,_0x2e5eda){var _0x4b5bdb={'raw':!![],'where':{'id':_0x162913[_0x0d01('0x45')]['id']}},_0x1d7442={};_0x1d7442[_0x0d01('0x2f')]=_[_0x0d01('0x32')](db[_0x0d01('0x2a')]['rawAttributes']);_0x1d7442[_0x0d01('0x31')]=_[_0x0d01('0x32')](_0x162913[_0x0d01('0x31')]);_0x1d7442['filters']=_[_0x0d01('0x33')](_0x1d7442['model'],_0x1d7442[_0x0d01('0x31')]);_0x4b5bdb[_0x0d01('0x34')]=_[_0x0d01('0x33')](_0x1d7442['model'],qs[_0x0d01('0x35')](_0x162913[_0x0d01('0x31')][_0x0d01('0x35')]));_0x4b5bdb[_0x0d01('0x34')]=_0x4b5bdb['attributes'][_0x0d01('0x36')]?_0x4b5bdb['attributes']:_0x1d7442['model'];if(_0x162913[_0x0d01('0x31')][_0x0d01('0x42')]){_0x4b5bdb[_0x0d01('0x46')]=[{'all':!![]}];}_0x4b5bdb=_['merge']({},_0x4b5bdb,_0x162913[_0x0d01('0x41')]);return db['MailTransferReport']['find'](_0x4b5bdb)['then'](handleEntityNotFound(_0x2e5eda,null))[_0x0d01('0x23')](respondWithResult(_0x2e5eda,null))[_0x0d01('0x43')](handleError(_0x2e5eda,null));};exports[_0x0d01('0x47')]=function(_0x3a0ad4,_0x1cdc8e){return db['MailTransferReport'][_0x0d01('0x47')](_0x3a0ad4[_0x0d01('0x48')],{})[_0x0d01('0x23')](respondWithResult(_0x1cdc8e,0xc9))[_0x0d01('0x43')](handleError(_0x1cdc8e,null));};exports['update']=function(_0x940743,_0x1c4b47){if(_0x940743['body']['id']){delete _0x940743['body']['id'];}return db['MailTransferReport']['find']({'where':{'id':_0x940743['params']['id']}})['then'](handleEntityNotFound(_0x1c4b47,null))[_0x0d01('0x23')](saveUpdates(_0x940743[_0x0d01('0x48')],null))['then'](respondWithResult(_0x1c4b47,null))[_0x0d01('0x43')](handleError(_0x1c4b47,null));};exports[_0x0d01('0x24')]=function(_0x456849,_0x4b1f2b){return db[_0x0d01('0x2a')][_0x0d01('0x49')]({'where':{'id':_0x456849['params']['id']}})['then'](handleEntityNotFound(_0x4b1f2b,null))[_0x0d01('0x23')](removeEntity(_0x4b1f2b,null))[_0x0d01('0x43')](handleError(_0x4b1f2b,null));};exports['describe']=function(_0x4f5119,_0x2919af){return db[_0x0d01('0x2a')]['describe']()['then'](respondWithResult(_0x2919af,null))[_0x0d01('0x43')](handleError(_0x2919af,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index f449c55..046cff5 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 _0x40c2=['./mailTransferReport.attributes','exports','MailTransferReport','report_mail_transfer','uniqueid','util','../../config/logger','api','moment','path','rimraf','../../config/environment'];(function(_0x180d23,_0x5575f5){var _0xce5fa8=function(_0x343755){while(--_0x343755){_0x180d23['push'](_0x180d23['shift']());}};_0xce5fa8(++_0x5575f5);}(_0x40c2,0x10d));var _0x240c=function(_0xa5caf7,_0x3ec2fe){_0xa5caf7=_0xa5caf7-0x0;var _0x14eca9=_0x40c2[_0xa5caf7];return _0x14eca9;};'use strict';var _=require('lodash');var util=require(_0x240c('0x0'));var logger=require(_0x240c('0x1'))(_0x240c('0x2'));var moment=require(_0x240c('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x240c('0x4'));var rimraf=require(_0x240c('0x5'));var config=require(_0x240c('0x6'));var attributes=require(_0x240c('0x7'));module[_0x240c('0x8')]=function(_0xf776b7,_0x2d597f){return _0xf776b7['define'](_0x240c('0x9'),attributes,{'tableName':_0x240c('0xa'),'paranoid':![],'indexes':[{'name':_0x240c('0xb'),'fields':[_0x240c('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5fdc=['rimraf','../../config/environment','./mailTransferReport.attributes','exports','define','MailTransferReport','report_mail_transfer','uniqueid','lodash','api','moment','bluebird','path'];(function(_0x292c26,_0x453998){var _0x4be988=function(_0x48b997){while(--_0x48b997){_0x292c26['push'](_0x292c26['shift']());}};_0x4be988(++_0x453998);}(_0x5fdc,0xcb));var _0xc5fd=function(_0x4619d6,_0x40f9a2){_0x4619d6=_0x4619d6-0x0;var _0xc5ed44=_0x5fdc[_0x4619d6];return _0xc5ed44;};'use strict';var _=require(_0xc5fd('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xc5fd('0x1'));var moment=require(_0xc5fd('0x2'));var BPromise=require(_0xc5fd('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc5fd('0x4'));var rimraf=require(_0xc5fd('0x5'));var config=require(_0xc5fd('0x6'));var attributes=require(_0xc5fd('0x7'));module[_0xc5fd('0x8')]=function(_0x2a2f9c,_0x34d4d5){return _0x2a2f9c[_0xc5fd('0x9')](_0xc5fd('0xa'),attributes,{'tableName':_0xc5fd('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xc5fd('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.rpc.js b/server/api/mailTransferReport/mailTransferReport.rpc.js index 06bf9ea..9e50a7e 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 _0x1c34=['randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','http','request','then','info','MailTransferReport,\x20%s,\x20%s','request\x20sent','MailTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird'];(function(_0x10c69e,_0x5cad96){var _0x26da29=function(_0x4d3b33){while(--_0x4d3b33){_0x10c69e['push'](_0x10c69e['shift']());}};_0x26da29(++_0x5cad96);}(_0x1c34,0x161));var _0x41c3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1c34[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x41c3('0x0'));var util=require(_0x41c3('0x1'));var moment=require(_0x41c3('0x2'));var BPromise=require(_0x41c3('0x3'));var rs=require(_0x41c3('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x41c3('0x5'))['db'];var utils=require(_0x41c3('0x6'));var logger=require('../../config/logger')(_0x41c3('0x7'));var config=require('../../config/environment');var jayson=require(_0x41c3('0x8'));var client=jayson['client'][_0x41c3('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x17f187,_0x43e13e,_0x4cf1e8){return new BPromise(function(_0xd552ca,_0x59e2e0){return client[_0x41c3('0xa')](_0x17f187,_0x4cf1e8)[_0x41c3('0xb')](function(_0x1617ad){logger[_0x41c3('0xc')](_0x41c3('0xd'),_0x43e13e,_0x41c3('0xe'));logger['debug'](_0x41c3('0xf'),_0x43e13e,_0x41c3('0xe'),JSON[_0x41c3('0x10')](_0x1617ad));if(_0x1617ad['error']){if(_0x1617ad[_0x41c3('0x11')][_0x41c3('0x12')]===0x1f4){logger['error'](_0x41c3('0xd'),_0x43e13e,_0x1617ad[_0x41c3('0x11')]['message']);return _0x59e2e0(_0x1617ad[_0x41c3('0x11')][_0x41c3('0x13')]);}logger['error'](_0x41c3('0xd'),_0x43e13e,_0x1617ad['error']['message']);return _0xd552ca(_0x1617ad[_0x41c3('0x11')][_0x41c3('0x13')]);}else{logger[_0x41c3('0xc')](_0x41c3('0xd'),_0x43e13e,'request\x20sent');_0xd552ca(_0x1617ad[_0x41c3('0x14')]['message']);}})['catch'](function(_0x204bf8){logger[_0x41c3('0x11')](_0x41c3('0xd'),_0x43e13e,_0x204bf8);_0x59e2e0(_0x204bf8);});});} \ No newline at end of file +var _0xb35d=['MailTransferReport,\x20%s,\x20%s','message','result','catch','lodash','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','info','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xb35d,0xfb));var _0xdb35=function(_0x58e32c,_0x309781){_0x58e32c=_0x58e32c-0x0;var _0x481e60=_0xb35d[_0x58e32c];return _0x481e60;};'use strict';var _=require(_0xdb35('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xdb35('0x1'));var rs=require(_0xdb35('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdb35('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xdb35('0x4'))(_0xdb35('0x5'));var config=require(_0xdb35('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xdb35('0x7')][_0xdb35('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3079b4,_0x10c279,_0x39a0b3){return new BPromise(function(_0x23a8dc,_0x3c20af){return client['request'](_0x3079b4,_0x39a0b3)['then'](function(_0x126e4a){logger[_0xdb35('0x9')]('MailTransferReport,\x20%s,\x20%s',_0x10c279,'request\x20sent');logger[_0xdb35('0xa')](_0xdb35('0xb'),_0x10c279,_0xdb35('0xc'),JSON[_0xdb35('0xd')](_0x126e4a));if(_0x126e4a[_0xdb35('0xe')]){if(_0x126e4a[_0xdb35('0xe')]['code']===0x1f4){logger[_0xdb35('0xe')](_0xdb35('0xf'),_0x10c279,_0x126e4a[_0xdb35('0xe')][_0xdb35('0x10')]);return _0x3c20af(_0x126e4a[_0xdb35('0xe')][_0xdb35('0x10')]);}logger[_0xdb35('0xe')](_0xdb35('0xf'),_0x10c279,_0x126e4a['error'][_0xdb35('0x10')]);return _0x23a8dc(_0x126e4a[_0xdb35('0xe')][_0xdb35('0x10')]);}else{logger[_0xdb35('0x9')](_0xdb35('0xf'),_0x10c279,_0xdb35('0xc'));_0x23a8dc(_0x126e4a[_0xdb35('0x11')][_0xdb35('0x10')]);}})[_0xdb35('0x12')](function(_0x519a39){logger['error'](_0xdb35('0xf'),_0x10c279,_0x519a39);_0x3c20af(_0x519a39);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index 31e6c6b..a777925 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 _0x39be=['/describe','/:id','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','./memberReport.controller','get','isAuthenticated','index'];(function(_0x2a403a,_0x4ec334){var _0x3a0f0d=function(_0x5b586f){while(--_0x5b586f){_0x2a403a['push'](_0x2a403a['shift']());}};_0x3a0f0d(++_0x4ec334);}(_0x39be,0x95));var _0xe39b=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x39be[_0x167cc1];return _0x10bc4b;};'use strict';var multer=require(_0xe39b('0x0'));var util=require(_0xe39b('0x1'));var path=require(_0xe39b('0x2'));var timeout=require(_0xe39b('0x3'));var express=require('express');var router=express[_0xe39b('0x4')]();var fs_extra=require(_0xe39b('0x5'));var auth=require(_0xe39b('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xe39b('0x7'));router[_0xe39b('0x8')]('/',auth[_0xe39b('0x9')](),controller[_0xe39b('0xa')]);router[_0xe39b('0x8')](_0xe39b('0xb'),auth[_0xe39b('0x9')](),controller['describe']);router[_0xe39b('0x8')](_0xe39b('0xc'),auth['isAuthenticated'](),controller['show']);router[_0xe39b('0xd')]('/',auth[_0xe39b('0x9')](),controller[_0xe39b('0xe')]);router[_0xe39b('0xf')]('/:id',auth['isAuthenticated'](),controller[_0xe39b('0x10')]);router[_0xe39b('0x11')]('/:id',auth[_0xe39b('0x9')](),controller[_0xe39b('0x12')]);module[_0xe39b('0x13')]=router; \ No newline at end of file +var _0x7bd1=['create','update','destroy','exports','multer','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','/:id','post'];(function(_0x5a9b50,_0x402800){var _0x3a02b6=function(_0x38d5f6){while(--_0x38d5f6){_0x5a9b50['push'](_0x5a9b50['shift']());}};_0x3a02b6(++_0x402800);}(_0x7bd1,0xd0));var _0x17bd=function(_0x2f8f75,_0x23ee4d){_0x2f8f75=_0x2f8f75-0x0;var _0x5c06d0=_0x7bd1[_0x2f8f75];return _0x5c06d0;};'use strict';var multer=require(_0x17bd('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x17bd('0x1'));var router=express[_0x17bd('0x2')]();var fs_extra=require(_0x17bd('0x3'));var auth=require(_0x17bd('0x4'));var interaction=require(_0x17bd('0x5'));var config=require(_0x17bd('0x6'));var controller=require('./memberReport.controller');router[_0x17bd('0x7')]('/',auth[_0x17bd('0x8')](),controller[_0x17bd('0x9')]);router[_0x17bd('0x7')]('/describe',auth[_0x17bd('0x8')](),controller[_0x17bd('0xa')]);router[_0x17bd('0x7')](_0x17bd('0xb'),auth[_0x17bd('0x8')](),controller['show']);router[_0x17bd('0xc')]('/',auth[_0x17bd('0x8')](),controller[_0x17bd('0xd')]);router['put']('/:id',auth[_0x17bd('0x8')](),controller[_0x17bd('0xe')]);router['delete']('/:id',auth[_0x17bd('0x8')](),controller[_0x17bd('0xf')]);module[_0x17bd('0x10')]=router; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.attributes.js b/server/api/memberReport/memberReport.attributes.js index 9d6af6a..04a1012 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 _0xf0d8=['talk:[destination]','talk:[dial\x20string]','talk:[queue]','sequelize','moment','exports','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE','getDataValue','enterAt','setDataValue','exitAt','duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]'];(function(_0x3ca198,_0x2be2b9){var _0x29ce0d=function(_0x58334a){while(--_0x58334a){_0x3ca198['push'](_0x3ca198['shift']());}};_0x29ce0d(++_0x2be2b9);}(_0xf0d8,0x111));var _0x8f0d=function(_0xc981a4,_0x18ba78){_0xc981a4=_0xc981a4-0x0;var _0x2fe137=_0xf0d8[_0xc981a4];return _0x2fe137;};'use strict';var Sequelize=require(_0x8f0d('0x0'));var moment=require(_0x8f0d('0x1'));module[_0x8f0d('0x2')]={'channel':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x8f0d('0x3')]},'interface':{'type':Sequelize[_0x8f0d('0x3')]},'type':{'type':Sequelize[_0x8f0d('0x3')],'defaultValue':_0x8f0d('0x4'),'comment':_0x8f0d('0x5')},'duration':{'type':Sequelize[_0x8f0d('0x6')]},'enterAt':{'type':Sequelize[_0x8f0d('0x7')]},'exitAt':{'type':Sequelize[_0x8f0d('0x7')],'set':function(_0x4a3784){var _0x25af71=moment(_0x4a3784);var _0x44003f=moment(this[_0x8f0d('0x8')](_0x8f0d('0x9')));var _0x3d727e=_0x25af71['diff'](_0x44003f,'seconds');this[_0x8f0d('0xa')](_0x8f0d('0xb'),_0x4a3784);this[_0x8f0d('0xa')](_0x8f0d('0xc'),_0x3d727e>=0x0?_0x3d727e:null);}},'data1':{'type':Sequelize[_0x8f0d('0x3')],'comment':_0x8f0d('0xd')},'data2':{'type':Sequelize[_0x8f0d('0x3')],'comment':_0x8f0d('0xe')},'data3':{'type':Sequelize[_0x8f0d('0x3')],'comment':_0x8f0d('0xf')},'data4':{'type':Sequelize[_0x8f0d('0x3')],'comment':_0x8f0d('0x10')},'data5':{'type':Sequelize[_0x8f0d('0x3')],'comment':_0x8f0d('0x11')},'role':{'type':Sequelize[_0x8f0d('0x3')]},'internal':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize[_0x8f0d('0x3')]}}; \ No newline at end of file +var _0xf167=['diff','setDataValue','duration','talk:[start]','talk:[destination]','talk:[dial\x20string]','talk:[queue]','sequelize','moment','exports','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE'];(function(_0x5c2f52,_0x46e3f5){var _0x1d704e=function(_0x2a0723){while(--_0x2a0723){_0x5c2f52['push'](_0x5c2f52['shift']());}};_0x1d704e(++_0x46e3f5);}(_0xf167,0x124));var _0x7f16=function(_0x1f1f3b,_0x227aa9){_0x1f1f3b=_0x1f1f3b-0x0;var _0x2e63aa=_0xf167[_0x1f1f3b];return _0x2e63aa;};'use strict';var Sequelize=require(_0x7f16('0x0'));var moment=require(_0x7f16('0x1'));module[_0x7f16('0x2')]={'channel':{'type':Sequelize[_0x7f16('0x3')]},'membername':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0x7f16('0x3')]},'type':{'type':Sequelize[_0x7f16('0x3')],'defaultValue':_0x7f16('0x4'),'comment':_0x7f16('0x5')},'duration':{'type':Sequelize[_0x7f16('0x6')]},'enterAt':{'type':Sequelize[_0x7f16('0x7')]},'exitAt':{'type':Sequelize[_0x7f16('0x7')],'set':function(_0x3b0b81){var _0x2c3352=moment(_0x3b0b81);var _0x177af2=moment(this['getDataValue']('enterAt'));var _0x29b4f8=_0x2c3352[_0x7f16('0x8')](_0x177af2,'seconds');this[_0x7f16('0x9')]('exitAt',_0x3b0b81);this[_0x7f16('0x9')](_0x7f16('0xa'),_0x29b4f8>=0x0?_0x29b4f8:null);}},'data1':{'type':Sequelize[_0x7f16('0x3')],'comment':'talk:[inbound,\x20outbound],\x20pause:[reason]'},'data2':{'type':Sequelize['STRING'],'comment':_0x7f16('0xb')},'data3':{'type':Sequelize[_0x7f16('0x3')],'comment':_0x7f16('0xc')},'data4':{'type':Sequelize[_0x7f16('0x3')],'comment':_0x7f16('0xd')},'data5':{'type':Sequelize[_0x7f16('0x3')],'comment':_0x7f16('0xe')},'role':{'type':Sequelize[_0x7f16('0x3')]},'internal':{'type':Sequelize[_0x7f16('0x6')]},'uniqueid':{'type':Sequelize[_0x7f16('0x3')]}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index 1552633..7e930aa 100644 --- a/server/api/memberReport/memberReport.controller.js +++ b/server/api/memberReport/memberReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','name','send','index','fieldName','type','key','model','map','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','MemberReport','findAll','rows','show','rawAttributes','includeAll','include','find','create','catch','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache'];(function(_0x37b599,_0x8e26cc){var _0x123314=function(_0x48a619){while(--_0x48a619){_0x37b599['push'](_0x37b599['shift']());}};_0x123314(++_0x8e26cc);}(_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['MemberReport']['rawAttributes'],function(_0x3573be){return{'name':_0x3573be[_0x7995('0x2c')],'type':_0x3573be[_0x7995('0x2d')][_0x7995('0x2e')]};});_0x456a28[_0x7995('0x2f')]=_[_0x7995('0x30')](_0x4253e5,'name');_0x456a28['query']=_[_0x7995('0x31')](_0x4b6f99['query']);_0x456a28[_0x7995('0x32')]=_[_0x7995('0x33')](_0x456a28[_0x7995('0x2f')],_0x456a28[_0x7995('0x34')]);_0x514445[_0x7995('0x35')]=_['intersection'](_0x456a28[_0x7995('0x2f')],qs[_0x7995('0x36')](_0x4b6f99['query']['fields']));_0x514445['attributes']=_0x514445[_0x7995('0x35')][_0x7995('0x37')]?_0x514445['attributes']:_0x456a28[_0x7995('0x2f')];if(!_0x4b6f99['query'][_0x7995('0x38')](_0x7995('0x39'))){_0x514445[_0x7995('0x21')]=qs['limit'](_0x4b6f99['query'][_0x7995('0x21')]);_0x514445['offset']=qs['offset'](_0x4b6f99[_0x7995('0x34')][_0x7995('0x20')]);}_0x514445['order']=qs[_0x7995('0x3a')](_0x4b6f99[_0x7995('0x34')][_0x7995('0x3a')]);_0x514445[_0x7995('0x3b')]=qs[_0x7995('0x32')](_['pick'](_0x4b6f99[_0x7995('0x34')],_0x456a28[_0x7995('0x32')]),_0x4253e5);if(_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]){_0x514445['where']=_[_0x7995('0x3d')](_0x514445[_0x7995('0x3b')],{'$or':_[_0x7995('0x30')](_0x4253e5,function(_0xe5ea43){if(_0xe5ea43[_0x7995('0x2d')]!==_0x7995('0x3e')){var _0x5688a1={};_0x5688a1[_0xe5ea43[_0x7995('0x29')]]={'$like':'%'+_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]+'%'};return _0x5688a1;}})});}_0x514445=_[_0x7995('0x3d')]({},_0x514445,_0x4b6f99[_0x7995('0x3f')]);var _0x298fc2={'where':_0x514445[_0x7995('0x3b')]};return db[_0x7995('0x40')][_0x7995('0x1f')](_0x298fc2)[_0x7995('0x26')](function(_0x6fe77b){_0x3250e0[_0x7995('0x1f')]=_0x6fe77b;if(_0x4b6f99[_0x7995('0x34')]['includeAll']){_0x514445['include']=[{'all':!![]}];}return db[_0x7995('0x40')][_0x7995('0x41')](_0x514445);})['then'](function(_0x4b0855){_0x3250e0[_0x7995('0x42')]=_0x4b0855;return _0x3250e0;})['then'](respondWithFilteredResult(_0x9b2a15,_0x514445))['catch'](handleError(_0x9b2a15,null));};exports[_0x7995('0x43')]=function(_0x36e28b,_0x35c8ff){var _0x576b96={'raw':!![],'where':{'id':_0x36e28b['params']['id']}},_0x46ac4f={};_0x46ac4f[_0x7995('0x2f')]=_['keys'](db['MemberReport'][_0x7995('0x44')]);_0x46ac4f[_0x7995('0x34')]=_[_0x7995('0x31')](_0x36e28b[_0x7995('0x34')]);_0x46ac4f['filters']=_[_0x7995('0x33')](_0x46ac4f[_0x7995('0x2f')],_0x46ac4f[_0x7995('0x34')]);_0x576b96[_0x7995('0x35')]=_['intersection'](_0x46ac4f['model'],qs[_0x7995('0x36')](_0x36e28b['query'][_0x7995('0x36')]));_0x576b96['attributes']=_0x576b96[_0x7995('0x35')]['length']?_0x576b96[_0x7995('0x35')]:_0x46ac4f[_0x7995('0x2f')];if(_0x36e28b['query'][_0x7995('0x45')]){_0x576b96[_0x7995('0x46')]=[{'all':!![]}];}_0x576b96=_[_0x7995('0x3d')]({},_0x576b96,_0x36e28b[_0x7995('0x3f')]);return db['MemberReport'][_0x7995('0x47')](_0x576b96)[_0x7995('0x26')](handleEntityNotFound(_0x35c8ff,null))[_0x7995('0x26')](respondWithResult(_0x35c8ff,null))['catch'](handleError(_0x35c8ff,null));};exports[_0x7995('0x48')]=function(_0x44f516,_0x511567){return db[_0x7995('0x40')][_0x7995('0x48')](_0x44f516['body'],{})[_0x7995('0x26')](respondWithResult(_0x511567,0xc9))[_0x7995('0x49')](handleError(_0x511567,null));};exports['update']=function(_0x3d1dbb,_0x5843ba){if(_0x3d1dbb[_0x7995('0x4a')]['id']){delete _0x3d1dbb[_0x7995('0x4a')]['id'];}return db[_0x7995('0x40')][_0x7995('0x47')]({'where':{'id':_0x3d1dbb[_0x7995('0x4b')]['id']}})[_0x7995('0x26')](handleEntityNotFound(_0x5843ba,null))[_0x7995('0x26')](saveUpdates(_0x3d1dbb['body'],null))[_0x7995('0x26')](respondWithResult(_0x5843ba,null))[_0x7995('0x49')](handleError(_0x5843ba,null));};exports[_0x7995('0x27')]=function(_0x4ffc8a,_0x19da63){return db[_0x7995('0x40')][_0x7995('0x47')]({'where':{'id':_0x4ffc8a['params']['id']}})['then'](handleEntityNotFound(_0x19da63,null))['then'](removeEntity(_0x19da63,null))[_0x7995('0x49')](handleError(_0x19da63,null));};exports[_0x7995('0x4c')]=function(_0x4cf5db,_0x1cd85){return db[_0x7995('0x40')][_0x7995('0x4c')]()[_0x7995('0x26')](respondWithResult(_0x1cd85,null))[_0x7995('0x49')](handleError(_0x1cd85,null));}; \ No newline at end of file +var _0x3e74=['show','params','options','find','catch','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','end','json','undefined','limit','offset','count','status','set','Content-Range','apply','save','update','then','destroy','sendStatus','name','send','index','map','MemberReport','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows'];(function(_0x5242ce,_0x304f13){var _0x17d2a4=function(_0x5d4fe5){while(--_0x5d4fe5){_0x5242ce['push'](_0x5242ce['shift']());}};_0x17d2a4(++_0x304f13);}(_0x3e74,0x175));var _0x43e7=function(_0x191b51,_0x41f420){_0x191b51=_0x191b51-0x0;var _0x3a3b24=_0x3e74[_0x191b51];return _0x3a3b24;};'use strict';var emlformat=require(_0x43e7('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x43e7('0x1'));var jsonpatch=require(_0x43e7('0x2'));var rp=require(_0x43e7('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x43e7('0x4'));var util=require('util');var path=require(_0x43e7('0x5'));var sox=require(_0x43e7('0x6'));var csv=require(_0x43e7('0x7'));var ejs=require(_0x43e7('0x8'));var fs=require('fs');var fs_extra=require(_0x43e7('0x9'));var _=require('lodash');var squel=require(_0x43e7('0xa'));var crypto=require(_0x43e7('0xb'));var jsforce=require(_0x43e7('0xc'));var deskjs=require(_0x43e7('0xd'));var toCsv=require(_0x43e7('0x7'));var querystring=require('querystring');var Papa=require(_0x43e7('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x43e7('0xf'));var as=require(_0x43e7('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x43e7('0x11'))('api');var utils=require(_0x43e7('0x12'));var config=require(_0x43e7('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x43e7('0x14'))['db'];function respondWithStatusCode(_0xc960ea,_0x2718d3){_0x2718d3=_0x2718d3||0xcc;return function(_0x3bb83f){if(_0x3bb83f){return _0xc960ea['sendStatus'](_0x2718d3);}return _0xc960ea['status'](_0x2718d3)[_0x43e7('0x15')]();};}function respondWithResult(_0x21fdd3,_0x44b0bd){_0x44b0bd=_0x44b0bd||0xc8;return function(_0x51b974){if(_0x51b974){return _0x21fdd3['status'](_0x44b0bd)[_0x43e7('0x16')](_0x51b974);}};}function respondWithFilteredResult(_0x14c146,_0x203378){return function(_0x328445){if(_0x328445){var _0x4de324=typeof _0x203378['offset']===_0x43e7('0x17')&&typeof _0x203378[_0x43e7('0x18')]===_0x43e7('0x17');var _0x5d346f=_0x328445['count'];var _0x446986=_0x4de324?0x0:_0x203378[_0x43e7('0x19')];var _0x9037d3=_0x4de324?_0x328445[_0x43e7('0x1a')]:_0x203378[_0x43e7('0x19')]+_0x203378[_0x43e7('0x18')];var _0x619236;if(_0x9037d3>=_0x5d346f){_0x9037d3=_0x5d346f;_0x619236=0xc8;}else{_0x619236=0xce;}_0x14c146[_0x43e7('0x1b')](_0x619236);return _0x14c146[_0x43e7('0x1c')](_0x43e7('0x1d'),_0x446986+'-'+_0x9037d3+'/'+_0x5d346f)[_0x43e7('0x16')](_0x328445);}return null;};}function patchUpdates(_0x177ee1){return function(_0x4b5d64){try{jsonpatch[_0x43e7('0x1e')](_0x4b5d64,_0x177ee1,!![]);}catch(_0x3c6625){return BPromise['reject'](_0x3c6625);}return _0x4b5d64[_0x43e7('0x1f')]();};}function saveUpdates(_0x3e281e,_0x3945bb){return function(_0x28aacc){if(_0x28aacc){return _0x28aacc[_0x43e7('0x20')](_0x3e281e)[_0x43e7('0x21')](function(_0x54a9e7){return _0x54a9e7;});}return null;};}function removeEntity(_0x454359,_0x4eea52){return function(_0x4c9df3){if(_0x4c9df3){return _0x4c9df3[_0x43e7('0x22')]()[_0x43e7('0x21')](function(){_0x454359['status'](0xcc)[_0x43e7('0x15')]();});}};}function handleEntityNotFound(_0x4ca5cf,_0x326dab){return function(_0x5c5e67){if(!_0x5c5e67){_0x4ca5cf[_0x43e7('0x23')](0x194);}return _0x5c5e67;};}function handleError(_0x1b5f50,_0x20888b){_0x20888b=_0x20888b||0x1f4;return function(_0x405f85){logger['error'](_0x405f85['stack']);if(_0x405f85[_0x43e7('0x24')]){delete _0x405f85['name'];}_0x1b5f50[_0x43e7('0x1b')](_0x20888b)[_0x43e7('0x25')](_0x405f85);};}exports[_0x43e7('0x26')]=function(_0xb1fc63,_0x5087d7){var _0x33a1a5={},_0x4690a6={},_0x45b675={'count':0x0,'rows':[]};var _0x50f9f5=_[_0x43e7('0x27')](db[_0x43e7('0x28')][_0x43e7('0x29')],function(_0x31b2a6){return{'name':_0x31b2a6[_0x43e7('0x2a')],'type':_0x31b2a6[_0x43e7('0x2b')][_0x43e7('0x2c')]};});_0x4690a6[_0x43e7('0x2d')]=_[_0x43e7('0x27')](_0x50f9f5,_0x43e7('0x24'));_0x4690a6['query']=_[_0x43e7('0x2e')](_0xb1fc63[_0x43e7('0x2f')]);_0x4690a6[_0x43e7('0x30')]=_[_0x43e7('0x31')](_0x4690a6[_0x43e7('0x2d')],_0x4690a6['query']);_0x33a1a5[_0x43e7('0x32')]=_[_0x43e7('0x31')](_0x4690a6[_0x43e7('0x2d')],qs[_0x43e7('0x33')](_0xb1fc63['query']['fields']));_0x33a1a5['attributes']=_0x33a1a5[_0x43e7('0x32')][_0x43e7('0x34')]?_0x33a1a5[_0x43e7('0x32')]:_0x4690a6[_0x43e7('0x2d')];if(!_0xb1fc63[_0x43e7('0x2f')][_0x43e7('0x35')]('nolimit')){_0x33a1a5['limit']=qs['limit'](_0xb1fc63['query']['limit']);_0x33a1a5['offset']=qs['offset'](_0xb1fc63[_0x43e7('0x2f')]['offset']);}_0x33a1a5[_0x43e7('0x36')]=qs[_0x43e7('0x37')](_0xb1fc63[_0x43e7('0x2f')][_0x43e7('0x37')]);_0x33a1a5[_0x43e7('0x38')]=qs[_0x43e7('0x30')](_[_0x43e7('0x39')](_0xb1fc63['query'],_0x4690a6['filters']),_0x50f9f5);if(_0xb1fc63['query'][_0x43e7('0x3a')]){_0x33a1a5[_0x43e7('0x38')]=_[_0x43e7('0x3b')](_0x33a1a5[_0x43e7('0x38')],{'$or':_[_0x43e7('0x27')](_0x50f9f5,function(_0x1ed538){if(_0x1ed538[_0x43e7('0x2b')]!==_0x43e7('0x3c')){var _0x55c798={};_0x55c798[_0x1ed538[_0x43e7('0x24')]]={'$like':'%'+_0xb1fc63[_0x43e7('0x2f')]['filter']+'%'};return _0x55c798;}})});}_0x33a1a5=_[_0x43e7('0x3b')]({},_0x33a1a5,_0xb1fc63['options']);var _0x44d8e4={'where':_0x33a1a5[_0x43e7('0x38')]};return db[_0x43e7('0x28')][_0x43e7('0x1a')](_0x44d8e4)[_0x43e7('0x21')](function(_0x234d8f){_0x45b675['count']=_0x234d8f;if(_0xb1fc63['query'][_0x43e7('0x3d')]){_0x33a1a5[_0x43e7('0x3e')]=[{'all':!![]}];}return db[_0x43e7('0x28')][_0x43e7('0x3f')](_0x33a1a5);})[_0x43e7('0x21')](function(_0x4a4a85){_0x45b675[_0x43e7('0x40')]=_0x4a4a85;return _0x45b675;})[_0x43e7('0x21')](respondWithFilteredResult(_0x5087d7,_0x33a1a5))['catch'](handleError(_0x5087d7,null));};exports[_0x43e7('0x41')]=function(_0x51a69c,_0x2ad8ef){var _0x504101={'raw':!![],'where':{'id':_0x51a69c[_0x43e7('0x42')]['id']}},_0x3d81ae={};_0x3d81ae[_0x43e7('0x2d')]=_[_0x43e7('0x2e')](db['MemberReport']['rawAttributes']);_0x3d81ae[_0x43e7('0x2f')]=_[_0x43e7('0x2e')](_0x51a69c[_0x43e7('0x2f')]);_0x3d81ae[_0x43e7('0x30')]=_['intersection'](_0x3d81ae['model'],_0x3d81ae['query']);_0x504101[_0x43e7('0x32')]=_['intersection'](_0x3d81ae[_0x43e7('0x2d')],qs['fields'](_0x51a69c['query'][_0x43e7('0x33')]));_0x504101['attributes']=_0x504101[_0x43e7('0x32')][_0x43e7('0x34')]?_0x504101[_0x43e7('0x32')]:_0x3d81ae[_0x43e7('0x2d')];if(_0x51a69c['query'][_0x43e7('0x3d')]){_0x504101[_0x43e7('0x3e')]=[{'all':!![]}];}_0x504101=_[_0x43e7('0x3b')]({},_0x504101,_0x51a69c[_0x43e7('0x43')]);return db[_0x43e7('0x28')][_0x43e7('0x44')](_0x504101)['then'](handleEntityNotFound(_0x2ad8ef,null))['then'](respondWithResult(_0x2ad8ef,null))[_0x43e7('0x45')](handleError(_0x2ad8ef,null));};exports[_0x43e7('0x46')]=function(_0x212841,_0x4c00a8){return db['MemberReport']['create'](_0x212841[_0x43e7('0x47')],{})[_0x43e7('0x21')](respondWithResult(_0x4c00a8,0xc9))['catch'](handleError(_0x4c00a8,null));};exports[_0x43e7('0x20')]=function(_0x47686e,_0x3c96fe){if(_0x47686e['body']['id']){delete _0x47686e['body']['id'];}return db['MemberReport']['find']({'where':{'id':_0x47686e[_0x43e7('0x42')]['id']}})[_0x43e7('0x21')](handleEntityNotFound(_0x3c96fe,null))['then'](saveUpdates(_0x47686e[_0x43e7('0x47')],null))[_0x43e7('0x21')](respondWithResult(_0x3c96fe,null))[_0x43e7('0x45')](handleError(_0x3c96fe,null));};exports[_0x43e7('0x22')]=function(_0x4a0ce5,_0x2718d5){return db['MemberReport']['find']({'where':{'id':_0x4a0ce5[_0x43e7('0x42')]['id']}})[_0x43e7('0x21')](handleEntityNotFound(_0x2718d5,null))[_0x43e7('0x21')](removeEntity(_0x2718d5,null))[_0x43e7('0x45')](handleError(_0x2718d5,null));};exports[_0x43e7('0x48')]=function(_0x2351cf,_0x1cd87c){return db[_0x43e7('0x28')][_0x43e7('0x48')]()[_0x43e7('0x21')](respondWithResult(_0x1cd87c,null))['catch'](handleError(_0x1cd87c,null));}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.model.js b/server/api/memberReport/memberReport.model.js index c7f72a6..1c2a15f 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 _0x7212=['report_member','membername_interface','membername','lodash','moment','rimraf','exports','MemberReport'];(function(_0x13588c,_0x289580){var _0x53a0d0=function(_0x627cce){while(--_0x627cce){_0x13588c['push'](_0x13588c['shift']());}};_0x53a0d0(++_0x289580);}(_0x7212,0x1e3));var _0x2721=function(_0x581456,_0x6023e5){_0x581456=_0x581456-0x0;var _0x331eb6=_0x7212[_0x581456];return _0x331eb6;};'use strict';var _=require(_0x2721('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x2721('0x1'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x2721('0x2'));var config=require('../../config/environment');var attributes=require('./memberReport.attributes');module[_0x2721('0x3')]=function(_0x3e584a,_0x3673ce){return _0x3e584a['define'](_0x2721('0x4'),attributes,{'tableName':_0x2721('0x5'),'paranoid':![],'indexes':[{'name':_0x2721('0x6'),'fields':[_0x2721('0x7'),'interface']}],'timestamps':!![]});}; \ No newline at end of file +var _0xa5c9=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./memberReport.attributes','define','MemberReport','report_member','membername_interface','membername','interface','lodash','util','../../config/logger'];(function(_0x336837,_0x8af3e4){var _0xe4493b=function(_0x10c9f8){while(--_0x10c9f8){_0x336837['push'](_0x336837['shift']());}};_0xe4493b(++_0x8af3e4);}(_0xa5c9,0xda));var _0x9a5c=function(_0x6cf19c,_0x2f3f02){_0x6cf19c=_0x6cf19c-0x0;var _0xce14f3=_0xa5c9[_0x6cf19c];return _0xce14f3;};'use strict';var _=require(_0x9a5c('0x0'));var util=require(_0x9a5c('0x1'));var logger=require(_0x9a5c('0x2'))(_0x9a5c('0x3'));var moment=require(_0x9a5c('0x4'));var BPromise=require(_0x9a5c('0x5'));var rp=require(_0x9a5c('0x6'));var fs=require('fs');var path=require(_0x9a5c('0x7'));var rimraf=require(_0x9a5c('0x8'));var config=require(_0x9a5c('0x9'));var attributes=require(_0x9a5c('0xa'));module['exports']=function(_0x4bce37,_0x57b9e1){return _0x4bce37[_0x9a5c('0xb')](_0x9a5c('0xc'),attributes,{'tableName':_0x9a5c('0xd'),'paranoid':![],'indexes':[{'name':_0x9a5c('0xe'),'fields':[_0x9a5c('0xf'),_0x9a5c('0x10')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.rpc.js b/server/api/memberReport/memberReport.rpc.js index 494adb5..88a7464 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 _0xd2f5=['raw','attributes','map','include','model','stringify','CreateMemberReport','create','body','UpdateMemberReport','where','limit','lodash','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','MemberReport,\x20%s,\x20%s','debug','MemberReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','GetMemberReport','MemberReport','findAll','options'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd2f5,0x144));var _0x5d2f=function(_0x252478,_0x50c9ae){_0x252478=_0x252478-0x0;var _0x3bb47f=_0xd2f5[_0x252478];return _0x3bb47f;};'use strict';var _=require(_0x5d2f('0x0'));var util=require('util');var moment=require(_0x5d2f('0x1'));var BPromise=require('bluebird');var rs=require(_0x5d2f('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5d2f('0x3'))['db'];var utils=require(_0x5d2f('0x4'));var logger=require(_0x5d2f('0x5'))(_0x5d2f('0x6'));var config=require(_0x5d2f('0x7'));var jayson=require(_0x5d2f('0x8'));var client=jayson[_0x5d2f('0x9')][_0x5d2f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4b2540,_0x443779,_0x908c6){return new BPromise(function(_0x1c8c59,_0x1670ea){return client[_0x5d2f('0xb')](_0x4b2540,_0x908c6)[_0x5d2f('0xc')](function(_0x58e637){logger[_0x5d2f('0xd')](_0x5d2f('0xe'),_0x443779,'request\x20sent');logger[_0x5d2f('0xf')](_0x5d2f('0x10'),_0x443779,_0x5d2f('0x11'),JSON['stringify'](_0x58e637));if(_0x58e637[_0x5d2f('0x12')]){if(_0x58e637[_0x5d2f('0x12')][_0x5d2f('0x13')]===0x1f4){logger['error']('MemberReport,\x20%s,\x20%s',_0x443779,_0x58e637[_0x5d2f('0x12')]['message']);return _0x1670ea(_0x58e637[_0x5d2f('0x12')][_0x5d2f('0x14')]);}logger['error'](_0x5d2f('0xe'),_0x443779,_0x58e637['error'][_0x5d2f('0x14')]);return _0x1c8c59(_0x58e637[_0x5d2f('0x12')][_0x5d2f('0x14')]);}else{logger['info'](_0x5d2f('0xe'),_0x443779,_0x5d2f('0x11'));_0x1c8c59(_0x58e637[_0x5d2f('0x15')][_0x5d2f('0x14')]);}})[_0x5d2f('0x16')](function(_0x5796f6){logger[_0x5d2f('0x12')](_0x5d2f('0xe'),_0x443779,_0x5796f6);_0x1670ea(_0x5796f6);});});}exports[_0x5d2f('0x17')]=function(_0x454782){var _0x5a79f1=this;return new Promise(function(_0x27e16d,_0x38a958){return db[_0x5d2f('0x18')][_0x5d2f('0x19')]({'raw':_0x454782[_0x5d2f('0x1a')]?_0x454782[_0x5d2f('0x1a')][_0x5d2f('0x1b')]===undefined?!![]:![]:!![],'where':_0x454782['options']?_0x454782['options']['where']||null:null,'attributes':_0x454782[_0x5d2f('0x1a')]?_0x454782[_0x5d2f('0x1a')][_0x5d2f('0x1c')]||null:null,'limit':_0x454782[_0x5d2f('0x1a')]?_0x454782[_0x5d2f('0x1a')]['limit']||null:null,'include':_0x454782['options']?_0x454782[_0x5d2f('0x1a')]['include']?_[_0x5d2f('0x1d')](_0x454782[_0x5d2f('0x1a')][_0x5d2f('0x1e')],function(_0x6d8859){return{'model':db[_0x6d8859[_0x5d2f('0x1f')]],'as':_0x6d8859['as'],'attributes':_0x6d8859[_0x5d2f('0x1c')],'include':_0x6d8859[_0x5d2f('0x1e')]?_[_0x5d2f('0x1d')](_0x6d8859['include'],function(_0x3e5ef5){return{'model':db[_0x3e5ef5[_0x5d2f('0x1f')]],'as':_0x3e5ef5['as'],'attributes':_0x3e5ef5[_0x5d2f('0x1c')],'include':_0x3e5ef5[_0x5d2f('0x1e')]?_[_0x5d2f('0x1d')](_0x3e5ef5[_0x5d2f('0x1e')],function(_0x2ff7cc){return{'model':db[_0x2ff7cc[_0x5d2f('0x1f')]],'as':_0x2ff7cc['as'],'attributes':_0x2ff7cc['attributes']};}):[]};}):[]};}):[]:[]})[_0x5d2f('0xc')](function(_0xa95a71){logger[_0x5d2f('0xd')](_0x5d2f('0x17'),_0x454782);logger[_0x5d2f('0xf')]('GetMemberReport',_0x454782,JSON[_0x5d2f('0x20')](_0xa95a71));_0x27e16d(_0xa95a71);})[_0x5d2f('0x16')](function(_0x102977){logger[_0x5d2f('0x12')]('GetMemberReport',_0x102977[_0x5d2f('0x14')],_0x454782);_0x38a958(_0x5a79f1[_0x5d2f('0x12')](0x1f4,_0x102977['message']));});});};exports[_0x5d2f('0x21')]=function(_0x2f881d){var _0x26e988=this;return new Promise(function(_0x4ff711,_0x3391b1){return db[_0x5d2f('0x18')][_0x5d2f('0x22')](_0x2f881d[_0x5d2f('0x23')],{'raw':_0x2f881d[_0x5d2f('0x1a')]?_0x2f881d[_0x5d2f('0x1a')]['raw']===undefined?!![]:![]:!![]})[_0x5d2f('0xc')](function(_0x9bb510){logger[_0x5d2f('0xd')]('CreateMemberReport',_0x2f881d);logger['debug'](_0x5d2f('0x21'),_0x2f881d,JSON[_0x5d2f('0x20')](_0x9bb510));_0x4ff711(_0x9bb510);})[_0x5d2f('0x16')](function(_0x24ea6a){logger[_0x5d2f('0x12')](_0x5d2f('0x21'),_0x24ea6a[_0x5d2f('0x14')],_0x2f881d);_0x3391b1(_0x26e988[_0x5d2f('0x12')](0x1f4,_0x24ea6a[_0x5d2f('0x14')]));});});};exports[_0x5d2f('0x24')]=function(_0xfdd81){var _0x68ee1=this;return new Promise(function(_0x34534b,_0x24e512){return db[_0x5d2f('0x18')]['update'](_0xfdd81[_0x5d2f('0x23')],{'raw':_0xfdd81[_0x5d2f('0x1a')]?_0xfdd81[_0x5d2f('0x1a')][_0x5d2f('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xfdd81[_0x5d2f('0x1a')]?_0xfdd81[_0x5d2f('0x1a')][_0x5d2f('0x25')]||null:null,'attributes':_0xfdd81[_0x5d2f('0x1a')]?_0xfdd81[_0x5d2f('0x1a')]['attributes']||null:null,'limit':_0xfdd81[_0x5d2f('0x1a')]?_0xfdd81[_0x5d2f('0x1a')][_0x5d2f('0x26')]||null:null})[_0x5d2f('0xc')](function(_0x14c319){logger[_0x5d2f('0xd')](_0x5d2f('0x24'),_0xfdd81);logger[_0x5d2f('0xf')]('UpdateMemberReport',_0xfdd81,JSON[_0x5d2f('0x20')](_0x14c319));_0x34534b(_0x14c319);})['catch'](function(_0x2c5ba8){logger[_0x5d2f('0x12')](_0x5d2f('0x24'),_0x2c5ba8[_0x5d2f('0x14')],_0xfdd81);_0x24e512(_0x68ee1[_0x5d2f('0x12')](0x1f4,_0x2c5ba8[_0x5d2f('0x14')]));});});}; \ No newline at end of file +var _0x85d0=['GetMemberReport','MemberReport','options','raw','attributes','include','map','model','catch','create','CreateMemberReport','UpdateMemberReport','update','body','where','limit','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','MemberReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result'];(function(_0x1cf6ef,_0x3a4330){var _0x291a34=function(_0x173cf1){while(--_0x173cf1){_0x1cf6ef['push'](_0x1cf6ef['shift']());}};_0x291a34(++_0x3a4330);}(_0x85d0,0x164));var _0x085d=function(_0x1b04d7,_0x390739){_0x1b04d7=_0x1b04d7-0x0;var _0x517396=_0x85d0[_0x1b04d7];return _0x517396;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x085d('0x0'));var fs=require('fs');var Redis=require(_0x085d('0x1'));var db=require(_0x085d('0x2'))['db'];var utils=require(_0x085d('0x3'));var logger=require(_0x085d('0x4'))(_0x085d('0x5'));var config=require('../../config/environment');var jayson=require(_0x085d('0x6'));var client=jayson['client'][_0x085d('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x9acc97,_0x2a6902,_0x4a12b7){return new BPromise(function(_0xf65d01,_0xa94124){return client[_0x085d('0x8')](_0x9acc97,_0x4a12b7)[_0x085d('0x9')](function(_0x349271){logger[_0x085d('0xa')](_0x085d('0xb'),_0x2a6902,_0x085d('0xc'));logger[_0x085d('0xd')]('MemberReport,\x20%s,\x20%s,\x20%s',_0x2a6902,_0x085d('0xc'),JSON[_0x085d('0xe')](_0x349271));if(_0x349271[_0x085d('0xf')]){if(_0x349271[_0x085d('0xf')]['code']===0x1f4){logger[_0x085d('0xf')](_0x085d('0xb'),_0x2a6902,_0x349271['error'][_0x085d('0x10')]);return _0xa94124(_0x349271[_0x085d('0xf')][_0x085d('0x10')]);}logger[_0x085d('0xf')]('MemberReport,\x20%s,\x20%s',_0x2a6902,_0x349271[_0x085d('0xf')][_0x085d('0x10')]);return _0xf65d01(_0x349271['error']['message']);}else{logger[_0x085d('0xa')](_0x085d('0xb'),_0x2a6902,_0x085d('0xc'));_0xf65d01(_0x349271[_0x085d('0x11')][_0x085d('0x10')]);}})['catch'](function(_0x2b29be){logger[_0x085d('0xf')](_0x085d('0xb'),_0x2a6902,_0x2b29be);_0xa94124(_0x2b29be);});});}exports[_0x085d('0x12')]=function(_0x3e566f){var _0x1c9de6=this;return new Promise(function(_0x5c046e,_0x6f7604){return db[_0x085d('0x13')]['findAll']({'raw':_0x3e566f[_0x085d('0x14')]?_0x3e566f[_0x085d('0x14')][_0x085d('0x15')]===undefined?!![]:![]:!![],'where':_0x3e566f[_0x085d('0x14')]?_0x3e566f[_0x085d('0x14')]['where']||null:null,'attributes':_0x3e566f[_0x085d('0x14')]?_0x3e566f[_0x085d('0x14')][_0x085d('0x16')]||null:null,'limit':_0x3e566f[_0x085d('0x14')]?_0x3e566f['options']['limit']||null:null,'include':_0x3e566f['options']?_0x3e566f[_0x085d('0x14')][_0x085d('0x17')]?_[_0x085d('0x18')](_0x3e566f[_0x085d('0x14')][_0x085d('0x17')],function(_0x17dafb){return{'model':db[_0x17dafb['model']],'as':_0x17dafb['as'],'attributes':_0x17dafb[_0x085d('0x16')],'include':_0x17dafb[_0x085d('0x17')]?_[_0x085d('0x18')](_0x17dafb['include'],function(_0x38cddc){return{'model':db[_0x38cddc[_0x085d('0x19')]],'as':_0x38cddc['as'],'attributes':_0x38cddc[_0x085d('0x16')],'include':_0x38cddc[_0x085d('0x17')]?_[_0x085d('0x18')](_0x38cddc['include'],function(_0x5e5228){return{'model':db[_0x5e5228['model']],'as':_0x5e5228['as'],'attributes':_0x5e5228[_0x085d('0x16')]};}):[]};}):[]};}):[]:[]})[_0x085d('0x9')](function(_0x402440){logger['info'](_0x085d('0x12'),_0x3e566f);logger[_0x085d('0xd')](_0x085d('0x12'),_0x3e566f,JSON['stringify'](_0x402440));_0x5c046e(_0x402440);})[_0x085d('0x1a')](function(_0x2eae2c){logger[_0x085d('0xf')](_0x085d('0x12'),_0x2eae2c['message'],_0x3e566f);_0x6f7604(_0x1c9de6[_0x085d('0xf')](0x1f4,_0x2eae2c[_0x085d('0x10')]));});});};exports['CreateMemberReport']=function(_0x33305c){var _0x326a12=this;return new Promise(function(_0x4b0066,_0x2b8858){return db[_0x085d('0x13')][_0x085d('0x1b')](_0x33305c['body'],{'raw':_0x33305c[_0x085d('0x14')]?_0x33305c[_0x085d('0x14')][_0x085d('0x15')]===undefined?!![]:![]:!![]})['then'](function(_0x1bb369){logger['info'](_0x085d('0x1c'),_0x33305c);logger[_0x085d('0xd')](_0x085d('0x1c'),_0x33305c,JSON[_0x085d('0xe')](_0x1bb369));_0x4b0066(_0x1bb369);})['catch'](function(_0x1f6f72){logger[_0x085d('0xf')](_0x085d('0x1c'),_0x1f6f72[_0x085d('0x10')],_0x33305c);_0x2b8858(_0x326a12['error'](0x1f4,_0x1f6f72['message']));});});};exports[_0x085d('0x1d')]=function(_0x2e27ce){var _0xa4d581=this;return new Promise(function(_0x19386,_0x22a83f){return db[_0x085d('0x13')][_0x085d('0x1e')](_0x2e27ce[_0x085d('0x1f')],{'raw':_0x2e27ce[_0x085d('0x14')]?_0x2e27ce['options'][_0x085d('0x15')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2e27ce[_0x085d('0x14')]?_0x2e27ce['options'][_0x085d('0x20')]||null:null,'attributes':_0x2e27ce['options']?_0x2e27ce[_0x085d('0x14')][_0x085d('0x16')]||null:null,'limit':_0x2e27ce['options']?_0x2e27ce[_0x085d('0x14')][_0x085d('0x21')]||null:null})[_0x085d('0x9')](function(_0x13c7e3){logger[_0x085d('0xa')]('UpdateMemberReport',_0x2e27ce);logger[_0x085d('0xd')]('UpdateMemberReport',_0x2e27ce,JSON['stringify'](_0x13c7e3));_0x19386(_0x13c7e3);})[_0x085d('0x1a')](function(_0x32bf4f){logger[_0x085d('0xf')](_0x085d('0x1d'),_0x32bf4f[_0x085d('0x10')],_0x2e27ce);_0x22a83f(_0xa4d581['error'](0x1f4,_0x32bf4f[_0x085d('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index b7fc99c..152e301 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 _0x5e61=['../../components/interaction/service','./migration.controller','get','index','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service'];(function(_0x24117c,_0x2f30ec){var _0x4f2f1b=function(_0x321700){while(--_0x321700){_0x24117c['push'](_0x24117c['shift']());}};_0x4f2f1b(++_0x2f30ec);}(_0x5e61,0x126));var _0x15e6=function(_0x3df314,_0x1e108a){_0x3df314=_0x3df314-0x0;var _0x13a167=_0x5e61[_0x3df314];return _0x13a167;};'use strict';var multer=require(_0x15e6('0x0'));var util=require('util');var path=require(_0x15e6('0x1'));var timeout=require(_0x15e6('0x2'));var express=require('express');var router=express[_0x15e6('0x3')]();var fs_extra=require(_0x15e6('0x4'));var auth=require(_0x15e6('0x5'));var interaction=require(_0x15e6('0x6'));var config=require('../../config/environment');var controller=require(_0x15e6('0x7'));router[_0x15e6('0x8')]('/',controller[_0x15e6('0x9')]);module['exports']=router; \ No newline at end of file +var _0x2265=['exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./migration.controller','get'];(function(_0x543ac1,_0x209912){var _0x36ccc3=function(_0x4a71a4){while(--_0x4a71a4){_0x543ac1['push'](_0x543ac1['shift']());}};_0x36ccc3(++_0x209912);}(_0x2265,0x114));var _0x5226=function(_0x16d10f,_0x2ba2d5){_0x16d10f=_0x16d10f-0x0;var _0x50c823=_0x2265[_0x16d10f];return _0x50c823;};'use strict';var multer=require(_0x5226('0x0'));var util=require(_0x5226('0x1'));var path=require(_0x5226('0x2'));var timeout=require(_0x5226('0x3'));var express=require(_0x5226('0x4'));var router=express[_0x5226('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x5226('0x6'));var interaction=require(_0x5226('0x7'));var config=require('../../config/environment');var controller=require(_0x5226('0x8'));router[_0x5226('0x9')]('/',controller['index']);module[_0x5226('0xa')]=router; \ No newline at end of file diff --git a/server/api/migration/migration.attributes.js b/server/api/migration/migration.attributes.js index b1f82ee..d56df5b 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 _0x4720=['exports','STRING'];(function(_0x2c0dc0,_0x19900d){var _0x4c0990=function(_0x530791){while(--_0x530791){_0x2c0dc0['push'](_0x2c0dc0['shift']());}};_0x4c0990(++_0x19900d);}(_0x4720,0x6e));var _0x0472=function(_0x3ba566,_0x5e009d){_0x3ba566=_0x3ba566-0x0;var _0x480317=_0x4720[_0x3ba566];return _0x480317;};'use strict';var Sequelize=require('sequelize');module[_0x0472('0x0')]={'version':{'type':Sequelize[_0x0472('0x1')],'unique':'version'}}; \ No newline at end of file +var _0xc886=['STRING','version','sequelize','exports'];(function(_0x51baf5,_0x56276d){var _0x1a9173=function(_0x479f64){while(--_0x479f64){_0x51baf5['push'](_0x51baf5['shift']());}};_0x1a9173(++_0x56276d);}(_0xc886,0x11a));var _0x6c88=function(_0x301808,_0x3d53e1){_0x301808=_0x301808-0x0;var _0x2db2e6=_0xc886[_0x301808];return _0x2db2e6;};'use strict';var Sequelize=require(_0x6c88('0x0'));module[_0x6c88('0x1')]={'version':{'type':Sequelize[_0x6c88('0x2')],'unique':_0x6c88('0x3')}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index 5e35b45..ccabe60 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 _0x24f8=['name','send','index','map','Migration','fieldName','type','key','model','query','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','rimraf','zip-dir','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','count','limit','set','apply','save','then','destroy','sendStatus','error'];(function(_0x5341d2,_0x2da6d6){var _0x3a4d6a=function(_0x254688){while(--_0x254688){_0x5341d2['push'](_0x5341d2['shift']());}};_0x3a4d6a(++_0x2da6d6);}(_0x24f8,0x1bb));var _0x824f=function(_0x12b683,_0x124186){_0x12b683=_0x12b683-0x0;var _0xfb150b=_0x24f8[_0x12b683];return _0xfb150b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x824f('0x0'));var zipdir=require(_0x824f('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x824f('0x2'));var moment=require(_0x824f('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x824f('0x4'));var util=require(_0x824f('0x5'));var path=require('path');var sox=require(_0x824f('0x6'));var csv=require(_0x824f('0x7'));var ejs=require(_0x824f('0x8'));var fs=require('fs');var fs_extra=require(_0x824f('0x9'));var _=require(_0x824f('0xa'));var squel=require(_0x824f('0xb'));var crypto=require(_0x824f('0xc'));var jsforce=require(_0x824f('0xd'));var deskjs=require(_0x824f('0xe'));var toCsv=require('to-csv');var querystring=require(_0x824f('0xf'));var Papa=require(_0x824f('0x10'));var Redis=require(_0x824f('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x824f('0x12'));var as=require(_0x824f('0x13'));var hardwareService=require(_0x824f('0x14'));var logger=require(_0x824f('0x15'))(_0x824f('0x16'));var utils=require(_0x824f('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x824f('0x18'));var db=require(_0x824f('0x19'))['db'];function respondWithStatusCode(_0x26cd15,_0x1e9d60){_0x1e9d60=_0x1e9d60||0xcc;return function(_0x27c25a){if(_0x27c25a){return _0x26cd15['sendStatus'](_0x1e9d60);}return _0x26cd15['status'](_0x1e9d60)[_0x824f('0x1a')]();};}function respondWithResult(_0x24be29,_0x3a9fe1){_0x3a9fe1=_0x3a9fe1||0xc8;return function(_0x370be7){if(_0x370be7){return _0x24be29[_0x824f('0x1b')](_0x3a9fe1)[_0x824f('0x1c')](_0x370be7);}};}function respondWithFilteredResult(_0x4243e2,_0x453054){return function(_0x408cdf){if(_0x408cdf){var _0x17db35=typeof _0x453054[_0x824f('0x1d')]==='undefined'&&typeof _0x453054['limit']===_0x824f('0x1e');var _0x30849b=_0x408cdf[_0x824f('0x1f')];var _0x441692=_0x17db35?0x0:_0x453054[_0x824f('0x1d')];var _0x99996=_0x17db35?_0x408cdf[_0x824f('0x1f')]:_0x453054[_0x824f('0x1d')]+_0x453054[_0x824f('0x20')];var _0x317e54;if(_0x99996>=_0x30849b){_0x99996=_0x30849b;_0x317e54=0xc8;}else{_0x317e54=0xce;}_0x4243e2[_0x824f('0x1b')](_0x317e54);return _0x4243e2[_0x824f('0x21')]('Content-Range',_0x441692+'-'+_0x99996+'/'+_0x30849b)[_0x824f('0x1c')](_0x408cdf);}return null;};}function patchUpdates(_0x2a724a){return function(_0x571e66){try{jsonpatch[_0x824f('0x22')](_0x571e66,_0x2a724a,!![]);}catch(_0x24b792){return BPromise['reject'](_0x24b792);}return _0x571e66[_0x824f('0x23')]();};}function saveUpdates(_0x18ec24,_0x26c55d){return function(_0x1ece63){if(_0x1ece63){return _0x1ece63['update'](_0x18ec24)[_0x824f('0x24')](function(_0x157670){return _0x157670;});}return null;};}function removeEntity(_0x240a5e,_0x18ce1e){return function(_0x2e2f6f){if(_0x2e2f6f){return _0x2e2f6f[_0x824f('0x25')]()['then'](function(){_0x240a5e[_0x824f('0x1b')](0xcc)[_0x824f('0x1a')]();});}};}function handleEntityNotFound(_0x5aec80,_0x3b2691){return function(_0x218d16){if(!_0x218d16){_0x5aec80[_0x824f('0x26')](0x194);}return _0x218d16;};}function handleError(_0x1c6fca,_0x5b783c){_0x5b783c=_0x5b783c||0x1f4;return function(_0x583d66){logger[_0x824f('0x27')](_0x583d66['stack']);if(_0x583d66[_0x824f('0x28')]){delete _0x583d66['name'];}_0x1c6fca[_0x824f('0x1b')](_0x5b783c)[_0x824f('0x29')](_0x583d66);};}exports[_0x824f('0x2a')]=function(_0x5c433e,_0x305c9a){var _0x4e41bd={},_0x14eb70={},_0x314940={'count':0x0,'rows':[]};var _0x49f2bf=_[_0x824f('0x2b')](db[_0x824f('0x2c')]['rawAttributes'],function(_0x276967){return{'name':_0x276967[_0x824f('0x2d')],'type':_0x276967[_0x824f('0x2e')][_0x824f('0x2f')]};});_0x14eb70[_0x824f('0x30')]=_['map'](_0x49f2bf,_0x824f('0x28'));_0x14eb70['query']=_['keys'](_0x5c433e[_0x824f('0x31')]);_0x14eb70['filters']=_[_0x824f('0x32')](_0x14eb70[_0x824f('0x30')],_0x14eb70[_0x824f('0x31')]);_0x4e41bd['attributes']=_[_0x824f('0x32')](_0x14eb70[_0x824f('0x30')],qs[_0x824f('0x33')](_0x5c433e['query']['fields']));_0x4e41bd[_0x824f('0x34')]=_0x4e41bd[_0x824f('0x34')]['length']?_0x4e41bd[_0x824f('0x34')]:_0x14eb70[_0x824f('0x30')];if(!_0x5c433e[_0x824f('0x31')][_0x824f('0x35')](_0x824f('0x36'))){_0x4e41bd[_0x824f('0x20')]=qs[_0x824f('0x20')](_0x5c433e[_0x824f('0x31')][_0x824f('0x20')]);_0x4e41bd['offset']=qs[_0x824f('0x1d')](_0x5c433e['query'][_0x824f('0x1d')]);}_0x4e41bd[_0x824f('0x37')]=qs[_0x824f('0x38')](_0x5c433e[_0x824f('0x31')][_0x824f('0x38')]);_0x4e41bd[_0x824f('0x39')]=qs[_0x824f('0x3a')](_[_0x824f('0x3b')](_0x5c433e['query'],_0x14eb70[_0x824f('0x3a')]),_0x49f2bf);if(_0x5c433e[_0x824f('0x31')][_0x824f('0x3c')]){_0x4e41bd['where']=_[_0x824f('0x3d')](_0x4e41bd[_0x824f('0x39')],{'$or':_['map'](_0x49f2bf,function(_0x310666){if(_0x310666['type']!==_0x824f('0x3e')){var _0x2a600e={};_0x2a600e[_0x310666[_0x824f('0x28')]]={'$like':'%'+_0x5c433e[_0x824f('0x31')][_0x824f('0x3c')]+'%'};return _0x2a600e;}})});}_0x4e41bd=_[_0x824f('0x3d')]({},_0x4e41bd,_0x5c433e[_0x824f('0x3f')]);var _0x284ef1={'where':_0x4e41bd['where']};return db[_0x824f('0x2c')][_0x824f('0x1f')](_0x284ef1)['then'](function(_0x50abe3){_0x314940[_0x824f('0x1f')]=_0x50abe3;if(_0x5c433e[_0x824f('0x31')][_0x824f('0x40')]){_0x4e41bd[_0x824f('0x41')]=[{'all':!![]}];}return db['Migration'][_0x824f('0x42')](_0x4e41bd);})['then'](function(_0x28e2b6){_0x314940[_0x824f('0x43')]=_0x28e2b6;return _0x314940;})[_0x824f('0x24')](respondWithFilteredResult(_0x305c9a,_0x4e41bd))[_0x824f('0x44')](handleError(_0x305c9a,null));}; \ No newline at end of file +var _0xc2f9=['fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','destroy','name','send','map','Migration','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filter','where','VIRTUAL','merge','options','then','includeAll','include','findAll','rows','catch','eml-format'];(function(_0x5c3435,_0x302791){var _0x13a0be=function(_0x5a9032){while(--_0x5a9032){_0x5c3435['push'](_0x5c3435['shift']());}};_0x13a0be(++_0x302791);}(_0xc2f9,0x167));var _0x9c2f=function(_0x5ec4d2,_0xf51fd8){_0x5ec4d2=_0x5ec4d2-0x0;var _0xeb7593=_0xc2f9[_0x5ec4d2];return _0xeb7593;};'use strict';var emlformat=require(_0x9c2f('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x9c2f('0x1'));var rp=require(_0x9c2f('0x2'));var moment=require(_0x9c2f('0x3'));var BPromise=require(_0x9c2f('0x4'));var Mustache=require(_0x9c2f('0x5'));var util=require('util');var path=require(_0x9c2f('0x6'));var sox=require(_0x9c2f('0x7'));var csv=require(_0x9c2f('0x8'));var ejs=require(_0x9c2f('0x9'));var fs=require('fs');var fs_extra=require(_0x9c2f('0xa'));var _=require(_0x9c2f('0xb'));var squel=require(_0x9c2f('0xc'));var crypto=require(_0x9c2f('0xd'));var jsforce=require(_0x9c2f('0xe'));var deskjs=require(_0x9c2f('0xf'));var toCsv=require(_0x9c2f('0x8'));var querystring=require(_0x9c2f('0x10'));var Papa=require('papaparse');var Redis=require(_0x9c2f('0x11'));var authService=require(_0x9c2f('0x12'));var qs=require(_0x9c2f('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9c2f('0x14'));var logger=require(_0x9c2f('0x15'))(_0x9c2f('0x16'));var utils=require(_0x9c2f('0x17'));var config=require(_0x9c2f('0x18'));var licenseUtil=require(_0x9c2f('0x19'));var db=require(_0x9c2f('0x1a'))['db'];function respondWithStatusCode(_0xc99058,_0x4cd71d){_0x4cd71d=_0x4cd71d||0xcc;return function(_0x31e697){if(_0x31e697){return _0xc99058[_0x9c2f('0x1b')](_0x4cd71d);}return _0xc99058[_0x9c2f('0x1c')](_0x4cd71d)[_0x9c2f('0x1d')]();};}function respondWithResult(_0x5257ac,_0x201fe8){_0x201fe8=_0x201fe8||0xc8;return function(_0x16de68){if(_0x16de68){return _0x5257ac[_0x9c2f('0x1c')](_0x201fe8)[_0x9c2f('0x1e')](_0x16de68);}};}function respondWithFilteredResult(_0x33c2e5,_0x940be5){return function(_0x14a1f8){if(_0x14a1f8){var _0x22139c=typeof _0x940be5['offset']===_0x9c2f('0x1f')&&typeof _0x940be5[_0x9c2f('0x20')]===_0x9c2f('0x1f');var _0x46f89a=_0x14a1f8[_0x9c2f('0x21')];var _0x17aa5e=_0x22139c?0x0:_0x940be5[_0x9c2f('0x22')];var _0x268245=_0x22139c?_0x14a1f8[_0x9c2f('0x21')]:_0x940be5[_0x9c2f('0x22')]+_0x940be5[_0x9c2f('0x20')];var _0x243c5f;if(_0x268245>=_0x46f89a){_0x268245=_0x46f89a;_0x243c5f=0xc8;}else{_0x243c5f=0xce;}_0x33c2e5['status'](_0x243c5f);return _0x33c2e5[_0x9c2f('0x23')](_0x9c2f('0x24'),_0x17aa5e+'-'+_0x268245+'/'+_0x46f89a)[_0x9c2f('0x1e')](_0x14a1f8);}return null;};}function patchUpdates(_0x504446){return function(_0x237d78){try{jsonpatch[_0x9c2f('0x25')](_0x237d78,_0x504446,!![]);}catch(_0xfaefe2){return BPromise[_0x9c2f('0x26')](_0xfaefe2);}return _0x237d78[_0x9c2f('0x27')]();};}function saveUpdates(_0x5465e2,_0x32f778){return function(_0x4df193){if(_0x4df193){return _0x4df193[_0x9c2f('0x28')](_0x5465e2)['then'](function(_0x529570){return _0x529570;});}return null;};}function removeEntity(_0x242aff,_0x3613d4){return function(_0x2149c4){if(_0x2149c4){return _0x2149c4[_0x9c2f('0x29')]()['then'](function(){_0x242aff[_0x9c2f('0x1c')](0xcc)[_0x9c2f('0x1d')]();});}};}function handleEntityNotFound(_0x2daf6b,_0x55496c){return function(_0x5900d8){if(!_0x5900d8){_0x2daf6b['sendStatus'](0x194);}return _0x5900d8;};}function handleError(_0x57720e,_0x49b1e0){_0x49b1e0=_0x49b1e0||0x1f4;return function(_0x38e962){logger['error'](_0x38e962['stack']);if(_0x38e962[_0x9c2f('0x2a')]){delete _0x38e962[_0x9c2f('0x2a')];}_0x57720e[_0x9c2f('0x1c')](_0x49b1e0)[_0x9c2f('0x2b')](_0x38e962);};}exports['index']=function(_0x4b962e,_0xbc5b9c){var _0x2232c5={},_0x369f1f={},_0x630ea1={'count':0x0,'rows':[]};var _0x543686=_[_0x9c2f('0x2c')](db[_0x9c2f('0x2d')][_0x9c2f('0x2e')],function(_0xf7ceea){return{'name':_0xf7ceea[_0x9c2f('0x2f')],'type':_0xf7ceea[_0x9c2f('0x30')][_0x9c2f('0x31')]};});_0x369f1f[_0x9c2f('0x32')]=_[_0x9c2f('0x2c')](_0x543686,_0x9c2f('0x2a'));_0x369f1f[_0x9c2f('0x33')]=_['keys'](_0x4b962e[_0x9c2f('0x33')]);_0x369f1f[_0x9c2f('0x34')]=_[_0x9c2f('0x35')](_0x369f1f[_0x9c2f('0x32')],_0x369f1f[_0x9c2f('0x33')]);_0x2232c5['attributes']=_[_0x9c2f('0x35')](_0x369f1f['model'],qs[_0x9c2f('0x36')](_0x4b962e[_0x9c2f('0x33')]['fields']));_0x2232c5[_0x9c2f('0x37')]=_0x2232c5[_0x9c2f('0x37')][_0x9c2f('0x38')]?_0x2232c5[_0x9c2f('0x37')]:_0x369f1f[_0x9c2f('0x32')];if(!_0x4b962e[_0x9c2f('0x33')][_0x9c2f('0x39')](_0x9c2f('0x3a'))){_0x2232c5[_0x9c2f('0x20')]=qs[_0x9c2f('0x20')](_0x4b962e[_0x9c2f('0x33')][_0x9c2f('0x20')]);_0x2232c5[_0x9c2f('0x22')]=qs['offset'](_0x4b962e['query'][_0x9c2f('0x22')]);}_0x2232c5[_0x9c2f('0x3b')]=qs[_0x9c2f('0x3c')](_0x4b962e[_0x9c2f('0x33')][_0x9c2f('0x3c')]);_0x2232c5['where']=qs[_0x9c2f('0x34')](_['pick'](_0x4b962e[_0x9c2f('0x33')],_0x369f1f[_0x9c2f('0x34')]),_0x543686);if(_0x4b962e[_0x9c2f('0x33')][_0x9c2f('0x3d')]){_0x2232c5[_0x9c2f('0x3e')]=_['merge'](_0x2232c5[_0x9c2f('0x3e')],{'$or':_[_0x9c2f('0x2c')](_0x543686,function(_0x107eb1){if(_0x107eb1[_0x9c2f('0x30')]!==_0x9c2f('0x3f')){var _0x46ac47={};_0x46ac47[_0x107eb1[_0x9c2f('0x2a')]]={'$like':'%'+_0x4b962e[_0x9c2f('0x33')]['filter']+'%'};return _0x46ac47;}})});}_0x2232c5=_[_0x9c2f('0x40')]({},_0x2232c5,_0x4b962e[_0x9c2f('0x41')]);var _0x526b18={'where':_0x2232c5[_0x9c2f('0x3e')]};return db[_0x9c2f('0x2d')][_0x9c2f('0x21')](_0x526b18)[_0x9c2f('0x42')](function(_0x253ba4){_0x630ea1['count']=_0x253ba4;if(_0x4b962e[_0x9c2f('0x33')][_0x9c2f('0x43')]){_0x2232c5[_0x9c2f('0x44')]=[{'all':!![]}];}return db[_0x9c2f('0x2d')][_0x9c2f('0x45')](_0x2232c5);})['then'](function(_0x23cf60){_0x630ea1[_0x9c2f('0x46')]=_0x23cf60;return _0x630ea1;})[_0x9c2f('0x42')](respondWithFilteredResult(_0xbc5b9c,_0x2232c5))[_0x9c2f('0x47')](handleError(_0xbc5b9c,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index 82d9b77..6afb8d4 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 _0x6c4d=['exports','define','Migration','migrations','util','../../config/logger','moment','request-promise','path','../../config/environment','./migration.attributes'];(function(_0x24ae68,_0x2ecc4c){var _0x37ab49=function(_0x318f00){while(--_0x318f00){_0x24ae68['push'](_0x24ae68['shift']());}};_0x37ab49(++_0x2ecc4c);}(_0x6c4d,0x1d2));var _0xd6c4=function(_0x3054be,_0x1bdc8b){_0x3054be=_0x3054be-0x0;var _0x3df150=_0x6c4d[_0x3054be];return _0x3df150;};'use strict';var _=require('lodash');var util=require(_0xd6c4('0x0'));var logger=require(_0xd6c4('0x1'))('api');var moment=require(_0xd6c4('0x2'));var BPromise=require('bluebird');var rp=require(_0xd6c4('0x3'));var fs=require('fs');var path=require(_0xd6c4('0x4'));var rimraf=require('rimraf');var config=require(_0xd6c4('0x5'));var attributes=require(_0xd6c4('0x6'));module[_0xd6c4('0x7')]=function(_0x1dcfb7,_0x3becf5){return _0x1dcfb7[_0xd6c4('0x8')](_0xd6c4('0x9'),attributes,{'tableName':_0xd6c4('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbe79=['Migration','migrations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./migration.attributes','define'];(function(_0x4fd467,_0x52315a){var _0x213143=function(_0x4e4423){while(--_0x4e4423){_0x4fd467['push'](_0x4fd467['shift']());}};_0x213143(++_0x52315a);}(_0xbe79,0x64));var _0x9be7=function(_0x13e998,_0x1e4e68){_0x13e998=_0x13e998-0x0;var _0x142948=_0xbe79[_0x13e998];return _0x142948;};'use strict';var _=require(_0x9be7('0x0'));var util=require(_0x9be7('0x1'));var logger=require(_0x9be7('0x2'))(_0x9be7('0x3'));var moment=require(_0x9be7('0x4'));var BPromise=require(_0x9be7('0x5'));var rp=require(_0x9be7('0x6'));var fs=require('fs');var path=require(_0x9be7('0x7'));var rimraf=require(_0x9be7('0x8'));var config=require(_0x9be7('0x9'));var attributes=require(_0x9be7('0xa'));module['exports']=function(_0xaef0df,_0xbf323f){return _0xaef0df[_0x9be7('0xb')](_0x9be7('0xc'),attributes,{'tableName':_0x9be7('0xd'),'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 0272f6a..7092e21 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 _0x4a3c=['info','Migration,\x20%s,\x20%s','request\x20sent','debug','error','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then'];(function(_0xf11b27,_0x12692e){var _0x53a633=function(_0x5bbb4d){while(--_0x5bbb4d){_0xf11b27['push'](_0xf11b27['shift']());}};_0x53a633(++_0x12692e);}(_0x4a3c,0x13c));var _0xc4a3=function(_0x511457,_0x2713a9){_0x511457=_0x511457-0x0;var _0x112c44=_0x4a3c[_0x511457];return _0x112c44;};'use strict';var _=require(_0xc4a3('0x0'));var util=require('util');var moment=require(_0xc4a3('0x1'));var BPromise=require(_0xc4a3('0x2'));var rs=require(_0xc4a3('0x3'));var fs=require('fs');var Redis=require(_0xc4a3('0x4'));var db=require(_0xc4a3('0x5'))['db'];var utils=require(_0xc4a3('0x6'));var logger=require(_0xc4a3('0x7'))('rpc');var config=require(_0xc4a3('0x8'));var jayson=require(_0xc4a3('0x9'));var client=jayson[_0xc4a3('0xa')][_0xc4a3('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4b1c84,_0x49fa26,_0x596b01){return new BPromise(function(_0xc11c29,_0x58bdcd){return client[_0xc4a3('0xc')](_0x4b1c84,_0x596b01)[_0xc4a3('0xd')](function(_0x1e7f27){logger[_0xc4a3('0xe')](_0xc4a3('0xf'),_0x49fa26,_0xc4a3('0x10'));logger[_0xc4a3('0x11')]('Migration,\x20%s,\x20%s,\x20%s',_0x49fa26,'request\x20sent',JSON['stringify'](_0x1e7f27));if(_0x1e7f27['error']){if(_0x1e7f27['error']['code']===0x1f4){logger['error'](_0xc4a3('0xf'),_0x49fa26,_0x1e7f27[_0xc4a3('0x12')][_0xc4a3('0x13')]);return _0x58bdcd(_0x1e7f27[_0xc4a3('0x12')]['message']);}logger[_0xc4a3('0x12')](_0xc4a3('0xf'),_0x49fa26,_0x1e7f27['error'][_0xc4a3('0x13')]);return _0xc11c29(_0x1e7f27[_0xc4a3('0x12')][_0xc4a3('0x13')]);}else{logger[_0xc4a3('0xe')](_0xc4a3('0xf'),_0x49fa26,_0xc4a3('0x10'));_0xc11c29(_0x1e7f27[_0xc4a3('0x14')][_0xc4a3('0x13')]);}})[_0xc4a3('0x15')](function(_0x584b6d){logger[_0xc4a3('0x12')](_0xc4a3('0xf'),_0x49fa26,_0x584b6d);_0x58bdcd(_0x584b6d);});});} \ No newline at end of file +var _0xaf80=['result','lodash','util','moment','bluebird','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','Migration,\x20%s,\x20%s','Migration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message'];(function(_0x47b747,_0x1059a3){var _0x13be0=function(_0x39b008){while(--_0x39b008){_0x47b747['push'](_0x47b747['shift']());}};_0x13be0(++_0x1059a3);}(_0xaf80,0x1ef));var _0x0af8=function(_0x555fa9,_0x194ef2){_0x555fa9=_0x555fa9-0x0;var _0x37d16e=_0xaf80[_0x555fa9];return _0x37d16e;};'use strict';var _=require(_0x0af8('0x0'));var util=require(_0x0af8('0x1'));var moment=require(_0x0af8('0x2'));var BPromise=require(_0x0af8('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x0af8('0x4'));var logger=require(_0x0af8('0x5'))(_0x0af8('0x6'));var config=require(_0x0af8('0x7'));var jayson=require(_0x0af8('0x8'));var client=jayson[_0x0af8('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4bce2c,_0x28f555,_0x538c1c){return new BPromise(function(_0x207a9b,_0x430bd4){return client[_0x0af8('0xa')](_0x4bce2c,_0x538c1c)['then'](function(_0xc0d5eb){logger[_0x0af8('0xb')](_0x0af8('0xc'),_0x28f555,'request\x20sent');logger['debug'](_0x0af8('0xd'),_0x28f555,_0x0af8('0xe'),JSON[_0x0af8('0xf')](_0xc0d5eb));if(_0xc0d5eb[_0x0af8('0x10')]){if(_0xc0d5eb[_0x0af8('0x10')]['code']===0x1f4){logger[_0x0af8('0x10')](_0x0af8('0xc'),_0x28f555,_0xc0d5eb[_0x0af8('0x10')][_0x0af8('0x11')]);return _0x430bd4(_0xc0d5eb[_0x0af8('0x10')][_0x0af8('0x11')]);}logger[_0x0af8('0x10')]('Migration,\x20%s,\x20%s',_0x28f555,_0xc0d5eb['error'][_0x0af8('0x11')]);return _0x207a9b(_0xc0d5eb[_0x0af8('0x10')][_0x0af8('0x11')]);}else{logger[_0x0af8('0xb')](_0x0af8('0xc'),_0x28f555,_0x0af8('0xe'));_0x207a9b(_0xc0d5eb[_0x0af8('0x12')][_0x0af8('0x11')]);}})['catch'](function(_0x5f4275){logger['error'](_0x0af8('0xc'),_0x28f555,_0x5f4275);_0x430bd4(_0x5f4275);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index 85463dd..9be3432 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 _0x0913=['../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','put','update','delete','destroy','exports','multer','util','fs-extra','../../components/auth/service'];(function(_0x1f1f6e,_0x5a3545){var _0xe9d294=function(_0x1f41a7){while(--_0x1f41a7){_0x1f1f6e['push'](_0x1f1f6e['shift']());}};_0xe9d294(++_0x5a3545);}(_0x0913,0x1a5));var _0x3091=function(_0x185235,_0x5cef89){_0x185235=_0x185235-0x0;var _0x196f9d=_0x0913[_0x185235];return _0x196f9d;};'use strict';var multer=require(_0x3091('0x0'));var util=require(_0x3091('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x3091('0x2'));var auth=require(_0x3091('0x3'));var interaction=require(_0x3091('0x4'));var config=require(_0x3091('0x5'));var controller=require('./network.controller');router[_0x3091('0x6')]('/',auth[_0x3091('0x7')](),controller[_0x3091('0x8')]);router[_0x3091('0x6')](_0x3091('0x9'),auth['isAuthenticated'](),controller[_0x3091('0xa')]);router[_0x3091('0xb')]('/',auth['isAuthenticated'](),controller['create']);router[_0x3091('0xc')]('/:id',auth[_0x3091('0x7')](),controller[_0x3091('0xd')]);router[_0x3091('0xe')](_0x3091('0x9'),auth[_0x3091('0x7')](),controller[_0x3091('0xf')]);module[_0x3091('0x10')]=router; \ No newline at end of file +var _0x431b=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./network.controller','isAuthenticated','get','show','create','put','/:id','update','delete','destroy','exports','multer','util','path'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x431b,0x18d));var _0xb431=function(_0x303986,_0x5c751c){_0x303986=_0x303986-0x0;var _0x4c4431=_0x431b[_0x303986];return _0x4c4431;};'use strict';var multer=require(_0xb431('0x0'));var util=require(_0xb431('0x1'));var path=require(_0xb431('0x2'));var timeout=require('connect-timeout');var express=require(_0xb431('0x3'));var router=express[_0xb431('0x4')]();var fs_extra=require(_0xb431('0x5'));var auth=require(_0xb431('0x6'));var interaction=require(_0xb431('0x7'));var config=require(_0xb431('0x8'));var controller=require(_0xb431('0x9'));router['get']('/',auth[_0xb431('0xa')](),controller['index']);router[_0xb431('0xb')]('/:id',auth['isAuthenticated'](),controller[_0xb431('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0xb431('0xd')]);router[_0xb431('0xe')](_0xb431('0xf'),auth[_0xb431('0xa')](),controller[_0xb431('0x10')]);router[_0xb431('0x11')](_0xb431('0xf'),auth['isAuthenticated'](),controller[_0xb431('0x12')]);module[_0xb431('0x13')]=router; \ No newline at end of file diff --git a/server/api/network/network.attributes.js b/server/api/network/network.attributes.js index 8577a93..85b29e9 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 _0x7c82=['externip','stun','turn','STRING','sequelize','exports','ENUM'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7c82,0x193));var _0x27c8=function(_0x22cf70,_0x52ded0){_0x22cf70=_0x22cf70-0x0;var _0x5dc166=_0x7c82[_0x22cf70];return _0x5dc166;};'use strict';var Sequelize=require(_0x27c8('0x0'));module[_0x27c8('0x1')]={'type':{'type':Sequelize[_0x27c8('0x2')]('localnet',_0x27c8('0x3'),_0x27c8('0x4'),_0x27c8('0x5'))},'value':{'type':Sequelize[_0x27c8('0x6')]},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x27c8('0x6')]}}; \ No newline at end of file +var _0x2a60=['sequelize','exports','ENUM','localnet','externip','stun','turn','STRING'];(function(_0xb25d59,_0x263d6e){var _0x4fabcc=function(_0x1862b8){while(--_0x1862b8){_0xb25d59['push'](_0xb25d59['shift']());}};_0x4fabcc(++_0x263d6e);}(_0x2a60,0x1c8));var _0x02a6=function(_0x4a5a9b,_0x452ac8){_0x4a5a9b=_0x4a5a9b-0x0;var _0x3419f0=_0x2a60[_0x4a5a9b];return _0x3419f0;};'use strict';var Sequelize=require(_0x02a6('0x0'));module[_0x02a6('0x1')]={'type':{'type':Sequelize[_0x02a6('0x2')](_0x02a6('0x3'),_0x02a6('0x4'),_0x02a6('0x5'),_0x02a6('0x6'))},'value':{'type':Sequelize[_0x02a6('0x7')]},'username':{'type':Sequelize[_0x02a6('0x7')]},'password':{'type':Sequelize[_0x02a6('0x7')]}}; \ No newline at end of file diff --git a/server/api/network/network.controller.js b/server/api/network/network.controller.js index 36e656c..d4b0fcc 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 _0x75cf=['pick','filter','where','merge','type','include','rows','show','params','includeAll','options','find','create','findAll','body','toUpperCase','STUN','readFileSync','root','server/files/templates/stun_multiple.ejs','render','writeFileSync','res_stun_monitor.so','TURN','server/files/templates/turn_multiple.ejs','utf8','/etc/asterisk/turn_xcally.conf','join','server/files/templates/network.ejs','format','/etc/asterisk/sip_xcally_%s.conf','Reload','chan_sip.so','/etc/asterisk/stun_xcally.conf','toLowerCase','util','path','ejs','lodash','../../components/parsers/qs','../../config/logger','api','../../mysqldb','jayson/promise','http','request','then','request\x20sent','Network,\x20%s,\x20%s,\x20%s','stringify','error','code','Network,\x20%s,\x20%s','message','info','result','catch','status','json','undefined','count','offset','limit','update','destroy','end','sendStatus','name','index','Network','rawAttributes','fieldName','key','model','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort'];(function(_0x27ddff,_0x3adbce){var _0x537313=function(_0x574c50){while(--_0x574c50){_0x27ddff['push'](_0x27ddff['shift']());}};_0x537313(++_0x3adbce);}(_0x75cf,0x1cc));var _0xf75c=function(_0x878790,_0x20cf02){_0x878790=_0x878790-0x0;var _0xa07f7b=_0x75cf[_0x878790];return _0xa07f7b;};'use strict';var util=require(_0xf75c('0x0'));var path=require(_0xf75c('0x1'));var ejs=require(_0xf75c('0x2'));var fs=require('fs');var _=require(_0xf75c('0x3'));var qs=require(_0xf75c('0x4'));var logger=require(_0xf75c('0x5'))(_0xf75c('0x6'));var config=require('../../config/environment');var db=require(_0xf75c('0x7'))['db'];var jayson=require(_0xf75c('0x8'));var client=jayson['client'][_0xf75c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x20c400,_0x56e4fe,_0x5783bb,_0x3dae99){return new Promise(function(_0x353908,_0x535b66){var _0x53e85f=_0x3dae99||client;return _0x53e85f[_0xf75c('0xa')](_0x20c400,_0x5783bb)[_0xf75c('0xb')](function(_0x441f0e){logger['info']('Network,\x20%s,\x20%s',_0x56e4fe,_0xf75c('0xc'));logger['debug'](_0xf75c('0xd'),_0x56e4fe,_0xf75c('0xc'),JSON[_0xf75c('0xe')](_0x441f0e));if(_0x441f0e[_0xf75c('0xf')]){if(_0x441f0e[_0xf75c('0xf')][_0xf75c('0x10')]===0x1f4){logger[_0xf75c('0xf')](_0xf75c('0x11'),_0x56e4fe,_0x441f0e[_0xf75c('0xf')][_0xf75c('0x12')]);return _0x535b66(_0x441f0e[_0xf75c('0xf')][_0xf75c('0x12')]);}logger[_0xf75c('0xf')](_0xf75c('0x11'),_0x56e4fe,_0x441f0e['error'][_0xf75c('0x12')]);return _0x353908(_0x441f0e[_0xf75c('0xf')][_0xf75c('0x12')]);}else{logger[_0xf75c('0x13')]('Network,\x20%s,\x20%s',_0x56e4fe,'request\x20sent');_0x353908(_0x441f0e[_0xf75c('0x14')][_0xf75c('0x12')]);}})[_0xf75c('0x15')](function(_0x38b611){logger['error'](_0xf75c('0x11'),_0x56e4fe,_0x38b611);_0x535b66(_0x38b611);});});}function respondWithResult(_0x12f7b0,_0x38254){_0x38254=_0x38254||0xc8;return function(_0x16b014){if(_0x16b014){return _0x12f7b0[_0xf75c('0x16')](_0x38254)[_0xf75c('0x17')](_0x16b014);}};}function respondWithFilteredResult(_0x370ea4,_0x19350b){return function(_0x239267){if(_0x239267){var _0x8c2d76=typeof _0x19350b['offset']===_0xf75c('0x18')&&typeof _0x19350b['limit']===_0xf75c('0x18');var _0x5d2f5c=_0x239267[_0xf75c('0x19')];var _0x8dc775=_0x8c2d76?0x0:_0x19350b['offset'];var _0x4259d7=_0x8c2d76?_0x239267[_0xf75c('0x19')]:_0x19350b[_0xf75c('0x1a')]+_0x19350b[_0xf75c('0x1b')];var _0x579664;if(_0x4259d7>=_0x5d2f5c){_0x4259d7=_0x5d2f5c;_0x579664=0xc8;}else{_0x579664=0xce;}_0x370ea4['status'](_0x579664);return _0x370ea4['set']('Content-Range',_0x8dc775+'-'+_0x4259d7+'/'+_0x5d2f5c)[_0xf75c('0x17')](_0x239267);}return null;};}function saveUpdates(_0x56f24b){return function(_0x108a23){if(_0x108a23){return _0x108a23[_0xf75c('0x1c')](_0x56f24b)[_0xf75c('0xb')](function(_0xb04bb3){return _0xb04bb3;});}return null;};}function removeEntity(_0x418d49){return function(_0x39f24c){if(_0x39f24c){return _0x39f24c[_0xf75c('0x1d')]()['then'](function(){_0x418d49[_0xf75c('0x16')](0xcc)[_0xf75c('0x1e')]();});}};}function handleEntityNotFound(_0x49cb0f){return function(_0x1d1e39){if(!_0x1d1e39){_0x49cb0f[_0xf75c('0x1f')](0x194);}return _0x1d1e39;};}function handleError(_0xb76336,_0x2afb04){_0x2afb04=_0x2afb04||0x1f4;return function(_0x21417c){logger[_0xf75c('0xf')](_0x21417c['stack']);if(_0x21417c[_0xf75c('0x20')]){delete _0x21417c['name'];}_0xb76336['status'](_0x2afb04)['send'](_0x21417c);};}exports[_0xf75c('0x21')]=function(_0x87db08,_0xa06f1f){var _0x30582e={},_0x224d45={},_0x1c2077={'count':0x0,'rows':[]};var _0x2ce23c=_['map'](db[_0xf75c('0x22')][_0xf75c('0x23')],function(_0x18a7cc){return{'name':_0x18a7cc[_0xf75c('0x24')],'type':_0x18a7cc['type'][_0xf75c('0x25')]};});_0x224d45[_0xf75c('0x26')]=_[_0xf75c('0x27')](_0x2ce23c,'name');_0x224d45[_0xf75c('0x28')]=_[_0xf75c('0x29')](_0x87db08[_0xf75c('0x28')]);_0x224d45[_0xf75c('0x2a')]=_['intersection'](_0x224d45['model'],_0x224d45[_0xf75c('0x28')]);_0x30582e[_0xf75c('0x2b')]=_[_0xf75c('0x2c')](_0x224d45[_0xf75c('0x26')],qs[_0xf75c('0x2d')](_0x87db08[_0xf75c('0x28')][_0xf75c('0x2d')]));_0x30582e['attributes']=_0x30582e['attributes'][_0xf75c('0x2e')]?_0x30582e[_0xf75c('0x2b')]:_0x224d45[_0xf75c('0x26')];if(!_0x87db08[_0xf75c('0x28')][_0xf75c('0x2f')](_0xf75c('0x30'))){_0x30582e[_0xf75c('0x1b')]=qs['limit'](_0x87db08[_0xf75c('0x28')][_0xf75c('0x1b')]);_0x30582e[_0xf75c('0x1a')]=qs['offset'](_0x87db08['query'][_0xf75c('0x1a')]);}_0x30582e['order']=qs[_0xf75c('0x31')](_0x87db08[_0xf75c('0x28')][_0xf75c('0x31')]);_0x30582e['where']=qs['filters'](_[_0xf75c('0x32')](_0x87db08[_0xf75c('0x28')],_0x224d45[_0xf75c('0x2a')]),_0x2ce23c);if(_0x87db08[_0xf75c('0x28')][_0xf75c('0x33')]){_0x30582e[_0xf75c('0x34')]=_[_0xf75c('0x35')](_0x30582e[_0xf75c('0x34')],{'$or':_[_0xf75c('0x27')](_0x2ce23c,function(_0x5949de){if(_0x5949de[_0xf75c('0x36')]!=='VIRTUAL'){var _0x42ecbc={};_0x42ecbc[_0x5949de[_0xf75c('0x20')]]={'$like':'%'+_0x87db08[_0xf75c('0x28')][_0xf75c('0x33')]+'%'};return _0x42ecbc;}})});}_0x30582e=_[_0xf75c('0x35')]({},_0x30582e,_0x87db08['options']);var _0x51359b={'where':_0x30582e['where']};return db['Network'][_0xf75c('0x19')](_0x51359b)[_0xf75c('0xb')](function(_0x1c379e){_0x1c2077['count']=_0x1c379e;if(_0x87db08[_0xf75c('0x28')]['includeAll']){_0x30582e[_0xf75c('0x37')]=[{'all':!![]}];}return db[_0xf75c('0x22')]['findAll'](_0x30582e);})[_0xf75c('0xb')](function(_0x57d500){_0x1c2077[_0xf75c('0x38')]=_0x57d500;return _0x1c2077;})['then'](respondWithFilteredResult(_0xa06f1f,_0x30582e))[_0xf75c('0x15')](handleError(_0xa06f1f,null));};exports[_0xf75c('0x39')]=function(_0x491c14,_0x4625c2){var _0x47ddb5={'raw':!![],'where':{'id':_0x491c14[_0xf75c('0x3a')]['id']}},_0x1d9744={};_0x1d9744[_0xf75c('0x26')]=_['keys'](db[_0xf75c('0x22')][_0xf75c('0x23')]);_0x1d9744[_0xf75c('0x28')]=_[_0xf75c('0x29')](_0x491c14[_0xf75c('0x28')]);_0x1d9744[_0xf75c('0x2a')]=_[_0xf75c('0x2c')](_0x1d9744['model'],_0x1d9744['query']);_0x47ddb5['attributes']=_[_0xf75c('0x2c')](_0x1d9744[_0xf75c('0x26')],qs[_0xf75c('0x2d')](_0x491c14[_0xf75c('0x28')]['fields']));_0x47ddb5[_0xf75c('0x2b')]=_0x47ddb5[_0xf75c('0x2b')][_0xf75c('0x2e')]?_0x47ddb5[_0xf75c('0x2b')]:_0x1d9744[_0xf75c('0x26')];if(_0x491c14[_0xf75c('0x28')][_0xf75c('0x3b')]){_0x47ddb5[_0xf75c('0x37')]=[{'all':!![]}];}_0x47ddb5=_['merge']({},_0x47ddb5,_0x491c14[_0xf75c('0x3c')]);return db[_0xf75c('0x22')][_0xf75c('0x3d')](_0x47ddb5)['then'](handleEntityNotFound(_0x4625c2,null))['then'](respondWithResult(_0x4625c2,null))[_0xf75c('0x15')](handleError(_0x4625c2,null));};exports[_0xf75c('0x3e')]=function(_0x4b24c6,_0x53b2c8){var _0x7fdd11;return db[_0xf75c('0x22')]['create'](_0x4b24c6['body'],{'raw':!![]})[_0xf75c('0xb')](function(_0x2142ad){_0x7fdd11=_0x2142ad;return db[_0xf75c('0x22')][_0xf75c('0x3f')]({'where':{'type':_0x4b24c6[_0xf75c('0x40')][_0xf75c('0x36')]},'raw':!![]});})[_0xf75c('0xb')](function(_0x3753cc){if(_0x7fdd11['type'][_0xf75c('0x41')]()==_0xf75c('0x42')){var _0x1e66c2=fs[_0xf75c('0x43')](path['join'](config[_0xf75c('0x44')],_0xf75c('0x45')),'utf8');var _0x7ebeac=ejs[_0xf75c('0x46')](_0x1e66c2,{'networks':_0x3753cc||[]});fs[_0xf75c('0x47')]('/etc/asterisk/stun_xcally.conf',_0x7ebeac);return respondWithRpcPromise('Reload','create',{'module':_0xf75c('0x48')});}else if(_0x7fdd11[_0xf75c('0x36')][_0xf75c('0x41')]()==_0xf75c('0x49')){var _0x12245a=fs[_0xf75c('0x43')](path['join'](config[_0xf75c('0x44')],_0xf75c('0x4a')),_0xf75c('0x4b'));var _0x48c724=ejs[_0xf75c('0x46')](_0x12245a,{'networks':_0x3753cc||[]});fs[_0xf75c('0x47')](_0xf75c('0x4c'),_0x48c724);return respondWithRpcPromise('Reload','create',{'module':_0xf75c('0x48')});}else{var _0x550736=fs['readFileSync'](path[_0xf75c('0x4d')](config[_0xf75c('0x44')],_0xf75c('0x4e')),'utf8');var _0x12fa2a=ejs[_0xf75c('0x46')](_0x550736,{'networks':_0x3753cc||[]});fs[_0xf75c('0x47')](util[_0xf75c('0x4f')](_0xf75c('0x50'),_0x4b24c6[_0xf75c('0x40')][_0xf75c('0x36')]['toLowerCase']()),_0x12fa2a);return respondWithRpcPromise(_0xf75c('0x51'),_0xf75c('0x3e'),{'module':_0xf75c('0x52')});}})[_0xf75c('0xb')](function(){return _0x7fdd11;})[_0xf75c('0xb')](respondWithResult(_0x53b2c8,0xc9))[_0xf75c('0x15')](handleError(_0x53b2c8,null));};exports[_0xf75c('0x1c')]=function(_0x380050,_0x4e3b13){var _0x882148;return db[_0xf75c('0x22')][_0xf75c('0x3d')]({'where':{'id':_0x380050[_0xf75c('0x3a')]['id']}})[_0xf75c('0xb')](handleEntityNotFound(_0x4e3b13,null))[_0xf75c('0xb')](saveUpdates(_0x380050['body'],null))[_0xf75c('0xb')](function(_0x370188){if(_0x370188){_0x882148=_0x370188;return db[_0xf75c('0x22')][_0xf75c('0x3f')]({'where':{'type':_0x882148[_0xf75c('0x36')]},'raw':!![]});}return null;})[_0xf75c('0xb')](function(_0x55219f){if(_0x882148['type']['toUpperCase']()==_0xf75c('0x42')){var _0x4fec25=fs['readFileSync'](path[_0xf75c('0x4d')](config['root'],_0xf75c('0x45')),_0xf75c('0x4b'));var _0x4d43ea=ejs[_0xf75c('0x46')](_0x4fec25,{'networks':_0x55219f||[]});fs[_0xf75c('0x47')]('/etc/asterisk/stun_xcally.conf',_0x4d43ea);return respondWithRpcPromise(_0xf75c('0x51'),_0xf75c('0x1c'),{'module':_0xf75c('0x48')});}else if(_0x882148['type'][_0xf75c('0x41')]()==_0xf75c('0x49')){var _0x20977c=fs[_0xf75c('0x43')](path[_0xf75c('0x4d')](config[_0xf75c('0x44')],_0xf75c('0x4a')),'utf8');var _0x15bfbc=ejs[_0xf75c('0x46')](_0x20977c,{'networks':_0x55219f||[]});fs['writeFileSync'](_0xf75c('0x4c'),_0x15bfbc);return respondWithRpcPromise(_0xf75c('0x51'),_0xf75c('0x1c'),{'module':_0xf75c('0x48')});}else{var _0xf23604=fs[_0xf75c('0x43')](path[_0xf75c('0x4d')](config['root'],_0xf75c('0x4e')),_0xf75c('0x4b'));var _0x420dfa=ejs[_0xf75c('0x46')](_0xf23604,{'networks':_0x55219f||[]});fs['writeFileSync'](util[_0xf75c('0x4f')](_0xf75c('0x50'),_0x380050[_0xf75c('0x40')][_0xf75c('0x36')]['toLowerCase']()),_0x420dfa);return respondWithRpcPromise(_0xf75c('0x51'),_0xf75c('0x1c'),{'module':_0xf75c('0x52')});}})[_0xf75c('0xb')](function(_0x38e2cb){if(_0x38e2cb){return _0x882148;}return null;})[_0xf75c('0xb')](respondWithResult(_0x4e3b13,null))[_0xf75c('0x15')](handleError(_0x4e3b13,null));};exports[_0xf75c('0x1d')]=function(_0x559b2e,_0x2b6879){var _0x2d6786;return db[_0xf75c('0x22')]['find']({'where':{'id':_0x559b2e['params']['id']}})['then'](function(_0x4f3e1b){_0x2d6786=_0x4f3e1b;return _0x4f3e1b;})[_0xf75c('0xb')](handleEntityNotFound(_0x2b6879,null))['then'](removeEntity(_0x2b6879,null))[_0xf75c('0xb')](function(){if(_0x2d6786){return db['Network'][_0xf75c('0x3f')]({'where':{'type':_0x2d6786[_0xf75c('0x36')]},'raw':!![]});}})[_0xf75c('0xb')](function(_0x1e4982){if(_0x2d6786[_0xf75c('0x36')][_0xf75c('0x41')]()==_0xf75c('0x42')){var _0x258d64=fs[_0xf75c('0x43')](path[_0xf75c('0x4d')](config[_0xf75c('0x44')],_0xf75c('0x45')),'utf8');var _0x37359d=ejs[_0xf75c('0x46')](_0x258d64,{'networks':_0x1e4982||[]});fs[_0xf75c('0x47')](_0xf75c('0x53'),_0x37359d);return respondWithRpcPromise(_0xf75c('0x51'),_0xf75c('0x1d'),{'module':_0xf75c('0x48')});}else if(_0x2d6786[_0xf75c('0x36')]['toUpperCase']()=='TURN'){var _0x1b016e=fs[_0xf75c('0x43')](path[_0xf75c('0x4d')](config['root'],_0xf75c('0x4a')),_0xf75c('0x4b'));var _0x38db11=ejs['render'](_0x1b016e,{'networks':_0x1e4982||[]});fs[_0xf75c('0x47')]('/etc/asterisk/turn_xcally.conf',_0x38db11);return respondWithRpcPromise('Reload',_0xf75c('0x1d'),{'module':_0xf75c('0x48')});}else{var _0x40c97e=fs[_0xf75c('0x43')](path[_0xf75c('0x4d')](config[_0xf75c('0x44')],_0xf75c('0x4e')),_0xf75c('0x4b'));var _0x1e14ca=ejs[_0xf75c('0x46')](_0x40c97e,{'networks':_0x1e4982||[]});fs[_0xf75c('0x47')](util[_0xf75c('0x4f')](_0xf75c('0x50'),_0x2d6786['type'][_0xf75c('0x54')]()),_0x1e14ca);return respondWithRpcPromise(_0xf75c('0x51'),_0xf75c('0x1d'),{'module':'chan_sip.so'});}})[_0xf75c('0x15')](handleError(_0x2b6879,null));}; \ No newline at end of file +var _0x39e8=['request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','status','json','offset','undefined','limit','count','set','update','destroy','stack','name','send','index','Network','rawAttributes','fieldName','type','model','map','keys','query','filters','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','intersection','length','find','create','body','toUpperCase','STUN','readFileSync','join','root','utf8','render','writeFileSync','/etc/asterisk/stun_xcally.conf','res_stun_monitor.so','server/files/templates/turn_multiple.ejs','/etc/asterisk/turn_xcally.conf','Reload','server/files/templates/network.ejs','format','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','params','findAll','server/files/templates/stun_multiple.ejs','TURN','chan_sip.so','util','path','ejs','../../components/parsers/qs','../../config/logger','api','../../mysqldb','client','request','then','info','Network,\x20%s,\x20%s'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x39e8,0x1ec));var _0x839e=function(_0xdee8a1,_0x3c4ab1){_0xdee8a1=_0xdee8a1-0x0;var _0x47f6fb=_0x39e8[_0xdee8a1];return _0x47f6fb;};'use strict';var util=require(_0x839e('0x0'));var path=require(_0x839e('0x1'));var ejs=require(_0x839e('0x2'));var fs=require('fs');var _=require('lodash');var qs=require(_0x839e('0x3'));var logger=require(_0x839e('0x4'))(_0x839e('0x5'));var config=require('../../config/environment');var db=require(_0x839e('0x6'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x839e('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x49f160,_0x154f1c,_0x48f6cc,_0xa03428){return new Promise(function(_0x4ee3ee,_0x406e3a){var _0x44e362=_0xa03428||client;return _0x44e362[_0x839e('0x8')](_0x49f160,_0x48f6cc)[_0x839e('0x9')](function(_0x2d59e5){logger[_0x839e('0xa')](_0x839e('0xb'),_0x154f1c,_0x839e('0xc'));logger[_0x839e('0xd')](_0x839e('0xe'),_0x154f1c,_0x839e('0xc'),JSON[_0x839e('0xf')](_0x2d59e5));if(_0x2d59e5[_0x839e('0x10')]){if(_0x2d59e5[_0x839e('0x10')][_0x839e('0x11')]===0x1f4){logger[_0x839e('0x10')](_0x839e('0xb'),_0x154f1c,_0x2d59e5[_0x839e('0x10')][_0x839e('0x12')]);return _0x406e3a(_0x2d59e5[_0x839e('0x10')][_0x839e('0x12')]);}logger[_0x839e('0x10')]('Network,\x20%s,\x20%s',_0x154f1c,_0x2d59e5['error']['message']);return _0x4ee3ee(_0x2d59e5[_0x839e('0x10')][_0x839e('0x12')]);}else{logger[_0x839e('0xa')](_0x839e('0xb'),_0x154f1c,_0x839e('0xc'));_0x4ee3ee(_0x2d59e5['result'][_0x839e('0x12')]);}})[_0x839e('0x13')](function(_0x50b743){logger['error'](_0x839e('0xb'),_0x154f1c,_0x50b743);_0x406e3a(_0x50b743);});});}function respondWithResult(_0x3dc3bb,_0x37458d){_0x37458d=_0x37458d||0xc8;return function(_0x4ceb61){if(_0x4ceb61){return _0x3dc3bb[_0x839e('0x14')](_0x37458d)[_0x839e('0x15')](_0x4ceb61);}};}function respondWithFilteredResult(_0xab1536,_0x4841f6){return function(_0xc09210){if(_0xc09210){var _0x48594e=typeof _0x4841f6[_0x839e('0x16')]===_0x839e('0x17')&&typeof _0x4841f6[_0x839e('0x18')]==='undefined';var _0x3adb36=_0xc09210[_0x839e('0x19')];var _0x59250e=_0x48594e?0x0:_0x4841f6[_0x839e('0x16')];var _0x2690ec=_0x48594e?_0xc09210[_0x839e('0x19')]:_0x4841f6[_0x839e('0x16')]+_0x4841f6[_0x839e('0x18')];var _0x515096;if(_0x2690ec>=_0x3adb36){_0x2690ec=_0x3adb36;_0x515096=0xc8;}else{_0x515096=0xce;}_0xab1536['status'](_0x515096);return _0xab1536[_0x839e('0x1a')]('Content-Range',_0x59250e+'-'+_0x2690ec+'/'+_0x3adb36)[_0x839e('0x15')](_0xc09210);}return null;};}function saveUpdates(_0x1d961d){return function(_0x4eac69){if(_0x4eac69){return _0x4eac69[_0x839e('0x1b')](_0x1d961d)['then'](function(_0x3cd6b4){return _0x3cd6b4;});}return null;};}function removeEntity(_0x93d344){return function(_0x178390){if(_0x178390){return _0x178390[_0x839e('0x1c')]()['then'](function(){_0x93d344[_0x839e('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x43db88){return function(_0x1d0609){if(!_0x1d0609){_0x43db88['sendStatus'](0x194);}return _0x1d0609;};}function handleError(_0x1645b8,_0x13fe46){_0x13fe46=_0x13fe46||0x1f4;return function(_0xdadf92){logger[_0x839e('0x10')](_0xdadf92[_0x839e('0x1d')]);if(_0xdadf92[_0x839e('0x1e')]){delete _0xdadf92[_0x839e('0x1e')];}_0x1645b8[_0x839e('0x14')](_0x13fe46)[_0x839e('0x1f')](_0xdadf92);};}exports[_0x839e('0x20')]=function(_0x4ca768,_0x420187){var _0x149a2a={},_0x4a0001={},_0x595662={'count':0x0,'rows':[]};var _0x1e3c72=_['map'](db[_0x839e('0x21')][_0x839e('0x22')],function(_0x9d085d){return{'name':_0x9d085d[_0x839e('0x23')],'type':_0x9d085d[_0x839e('0x24')]['key']};});_0x4a0001[_0x839e('0x25')]=_[_0x839e('0x26')](_0x1e3c72,'name');_0x4a0001['query']=_[_0x839e('0x27')](_0x4ca768[_0x839e('0x28')]);_0x4a0001[_0x839e('0x29')]=_['intersection'](_0x4a0001[_0x839e('0x25')],_0x4a0001[_0x839e('0x28')]);_0x149a2a['attributes']=_['intersection'](_0x4a0001['model'],qs['fields'](_0x4ca768[_0x839e('0x28')][_0x839e('0x2a')]));_0x149a2a[_0x839e('0x2b')]=_0x149a2a['attributes']['length']?_0x149a2a[_0x839e('0x2b')]:_0x4a0001[_0x839e('0x25')];if(!_0x4ca768['query'][_0x839e('0x2c')](_0x839e('0x2d'))){_0x149a2a[_0x839e('0x18')]=qs[_0x839e('0x18')](_0x4ca768[_0x839e('0x28')]['limit']);_0x149a2a['offset']=qs[_0x839e('0x16')](_0x4ca768[_0x839e('0x28')][_0x839e('0x16')]);}_0x149a2a[_0x839e('0x2e')]=qs[_0x839e('0x2f')](_0x4ca768[_0x839e('0x28')][_0x839e('0x2f')]);_0x149a2a[_0x839e('0x30')]=qs['filters'](_[_0x839e('0x31')](_0x4ca768['query'],_0x4a0001[_0x839e('0x29')]),_0x1e3c72);if(_0x4ca768[_0x839e('0x28')][_0x839e('0x32')]){_0x149a2a[_0x839e('0x30')]=_[_0x839e('0x33')](_0x149a2a[_0x839e('0x30')],{'$or':_['map'](_0x1e3c72,function(_0xefc80c){if(_0xefc80c['type']!==_0x839e('0x34')){var _0xc4f997={};_0xc4f997[_0xefc80c[_0x839e('0x1e')]]={'$like':'%'+_0x4ca768[_0x839e('0x28')][_0x839e('0x32')]+'%'};return _0xc4f997;}})});}_0x149a2a=_['merge']({},_0x149a2a,_0x4ca768[_0x839e('0x35')]);var _0x516af1={'where':_0x149a2a[_0x839e('0x30')]};return db[_0x839e('0x21')][_0x839e('0x19')](_0x516af1)['then'](function(_0x42f947){_0x595662[_0x839e('0x19')]=_0x42f947;if(_0x4ca768[_0x839e('0x28')][_0x839e('0x36')]){_0x149a2a[_0x839e('0x37')]=[{'all':!![]}];}return db['Network']['findAll'](_0x149a2a);})[_0x839e('0x9')](function(_0x2393a4){_0x595662[_0x839e('0x38')]=_0x2393a4;return _0x595662;})[_0x839e('0x9')](respondWithFilteredResult(_0x420187,_0x149a2a))['catch'](handleError(_0x420187,null));};exports['show']=function(_0x4e0fbe,_0x5ca5ce){var _0x4f1b99={'raw':!![],'where':{'id':_0x4e0fbe['params']['id']}},_0x52ac64={};_0x52ac64[_0x839e('0x25')]=_[_0x839e('0x27')](db['Network'][_0x839e('0x22')]);_0x52ac64[_0x839e('0x28')]=_['keys'](_0x4e0fbe['query']);_0x52ac64[_0x839e('0x29')]=_[_0x839e('0x39')](_0x52ac64[_0x839e('0x25')],_0x52ac64[_0x839e('0x28')]);_0x4f1b99['attributes']=_['intersection'](_0x52ac64[_0x839e('0x25')],qs[_0x839e('0x2a')](_0x4e0fbe['query']['fields']));_0x4f1b99['attributes']=_0x4f1b99[_0x839e('0x2b')][_0x839e('0x3a')]?_0x4f1b99[_0x839e('0x2b')]:_0x52ac64[_0x839e('0x25')];if(_0x4e0fbe[_0x839e('0x28')][_0x839e('0x36')]){_0x4f1b99[_0x839e('0x37')]=[{'all':!![]}];}_0x4f1b99=_['merge']({},_0x4f1b99,_0x4e0fbe['options']);return db[_0x839e('0x21')][_0x839e('0x3b')](_0x4f1b99)[_0x839e('0x9')](handleEntityNotFound(_0x5ca5ce,null))[_0x839e('0x9')](respondWithResult(_0x5ca5ce,null))[_0x839e('0x13')](handleError(_0x5ca5ce,null));};exports[_0x839e('0x3c')]=function(_0x1ec462,_0x2ceb6c){var _0x51816d;return db[_0x839e('0x21')]['create'](_0x1ec462[_0x839e('0x3d')],{'raw':!![]})[_0x839e('0x9')](function(_0x15cfd2){_0x51816d=_0x15cfd2;return db[_0x839e('0x21')]['findAll']({'where':{'type':_0x1ec462[_0x839e('0x3d')][_0x839e('0x24')]},'raw':!![]});})['then'](function(_0x44d26c){if(_0x51816d[_0x839e('0x24')][_0x839e('0x3e')]()==_0x839e('0x3f')){var _0x4e7b08=fs[_0x839e('0x40')](path[_0x839e('0x41')](config[_0x839e('0x42')],'server/files/templates/stun_multiple.ejs'),_0x839e('0x43'));var _0x52e3fd=ejs[_0x839e('0x44')](_0x4e7b08,{'networks':_0x44d26c||[]});fs[_0x839e('0x45')](_0x839e('0x46'),_0x52e3fd);return respondWithRpcPromise('Reload',_0x839e('0x3c'),{'module':_0x839e('0x47')});}else if(_0x51816d[_0x839e('0x24')][_0x839e('0x3e')]()=='TURN'){var _0x177717=fs[_0x839e('0x40')](path['join'](config['root'],_0x839e('0x48')),_0x839e('0x43'));var _0x309baa=ejs['render'](_0x177717,{'networks':_0x44d26c||[]});fs[_0x839e('0x45')](_0x839e('0x49'),_0x309baa);return respondWithRpcPromise(_0x839e('0x4a'),'create',{'module':_0x839e('0x47')});}else{var _0x1ec86d=fs[_0x839e('0x40')](path[_0x839e('0x41')](config[_0x839e('0x42')],_0x839e('0x4b')),_0x839e('0x43'));var _0x5c2c46=ejs[_0x839e('0x44')](_0x1ec86d,{'networks':_0x44d26c||[]});fs[_0x839e('0x45')](util[_0x839e('0x4c')](_0x839e('0x4d'),_0x1ec462['body']['type'][_0x839e('0x4e')]()),_0x5c2c46);return respondWithRpcPromise(_0x839e('0x4a'),_0x839e('0x3c'),{'module':'chan_sip.so'});}})['then'](function(){return _0x51816d;})[_0x839e('0x9')](respondWithResult(_0x2ceb6c,0xc9))[_0x839e('0x13')](handleError(_0x2ceb6c,null));};exports[_0x839e('0x1b')]=function(_0x3c0d49,_0x28db92){var _0x225765;return db[_0x839e('0x21')][_0x839e('0x3b')]({'where':{'id':_0x3c0d49[_0x839e('0x4f')]['id']}})[_0x839e('0x9')](handleEntityNotFound(_0x28db92,null))['then'](saveUpdates(_0x3c0d49[_0x839e('0x3d')],null))[_0x839e('0x9')](function(_0x394a56){if(_0x394a56){_0x225765=_0x394a56;return db[_0x839e('0x21')][_0x839e('0x50')]({'where':{'type':_0x225765[_0x839e('0x24')]},'raw':!![]});}return null;})[_0x839e('0x9')](function(_0x5326ca){if(_0x225765[_0x839e('0x24')][_0x839e('0x3e')]()==_0x839e('0x3f')){var _0x2ad06a=fs['readFileSync'](path['join'](config[_0x839e('0x42')],_0x839e('0x51')),'utf8');var _0x28e549=ejs['render'](_0x2ad06a,{'networks':_0x5326ca||[]});fs[_0x839e('0x45')]('/etc/asterisk/stun_xcally.conf',_0x28e549);return respondWithRpcPromise(_0x839e('0x4a'),_0x839e('0x1b'),{'module':'res_stun_monitor.so'});}else if(_0x225765[_0x839e('0x24')]['toUpperCase']()==_0x839e('0x52')){var _0x27a191=fs[_0x839e('0x40')](path[_0x839e('0x41')](config['root'],_0x839e('0x48')),_0x839e('0x43'));var _0x50fb4e=ejs[_0x839e('0x44')](_0x27a191,{'networks':_0x5326ca||[]});fs[_0x839e('0x45')](_0x839e('0x49'),_0x50fb4e);return respondWithRpcPromise('Reload',_0x839e('0x1b'),{'module':_0x839e('0x47')});}else{var _0x36d90e=fs[_0x839e('0x40')](path[_0x839e('0x41')](config['root'],_0x839e('0x4b')),_0x839e('0x43'));var _0x1e3a48=ejs[_0x839e('0x44')](_0x36d90e,{'networks':_0x5326ca||[]});fs[_0x839e('0x45')](util['format'](_0x839e('0x4d'),_0x3c0d49['body'][_0x839e('0x24')][_0x839e('0x4e')]()),_0x1e3a48);return respondWithRpcPromise('Reload',_0x839e('0x1b'),{'module':_0x839e('0x53')});}})[_0x839e('0x9')](function(_0x1c8f80){if(_0x1c8f80){return _0x225765;}return null;})[_0x839e('0x9')](respondWithResult(_0x28db92,null))[_0x839e('0x13')](handleError(_0x28db92,null));};exports[_0x839e('0x1c')]=function(_0x49123d,_0x48a845){var _0x16c344;return db['Network'][_0x839e('0x3b')]({'where':{'id':_0x49123d[_0x839e('0x4f')]['id']}})[_0x839e('0x9')](function(_0x3e23d1){_0x16c344=_0x3e23d1;return _0x3e23d1;})[_0x839e('0x9')](handleEntityNotFound(_0x48a845,null))[_0x839e('0x9')](removeEntity(_0x48a845,null))['then'](function(){if(_0x16c344){return db[_0x839e('0x21')][_0x839e('0x50')]({'where':{'type':_0x16c344['type']},'raw':!![]});}})[_0x839e('0x9')](function(_0x5c5ebe){if(_0x16c344['type'][_0x839e('0x3e')]()==_0x839e('0x3f')){var _0x35b267=fs['readFileSync'](path[_0x839e('0x41')](config[_0x839e('0x42')],'server/files/templates/stun_multiple.ejs'),_0x839e('0x43'));var _0x3b02bb=ejs[_0x839e('0x44')](_0x35b267,{'networks':_0x5c5ebe||[]});fs[_0x839e('0x45')](_0x839e('0x46'),_0x3b02bb);return respondWithRpcPromise(_0x839e('0x4a'),_0x839e('0x1c'),{'module':_0x839e('0x47')});}else if(_0x16c344[_0x839e('0x24')][_0x839e('0x3e')]()==_0x839e('0x52')){var _0x2915e1=fs[_0x839e('0x40')](path[_0x839e('0x41')](config[_0x839e('0x42')],_0x839e('0x48')),_0x839e('0x43'));var _0x6f9a7c=ejs[_0x839e('0x44')](_0x2915e1,{'networks':_0x5c5ebe||[]});fs['writeFileSync'](_0x839e('0x49'),_0x6f9a7c);return respondWithRpcPromise('Reload',_0x839e('0x1c'),{'module':_0x839e('0x47')});}else{var _0xab43ab=fs['readFileSync'](path['join'](config[_0x839e('0x42')],_0x839e('0x4b')),_0x839e('0x43'));var _0x21696f=ejs[_0x839e('0x44')](_0xab43ab,{'networks':_0x5c5ebe||[]});fs[_0x839e('0x45')](util[_0x839e('0x4c')](_0x839e('0x4d'),_0x16c344[_0x839e('0x24')]['toLowerCase']()),_0x21696f);return respondWithRpcPromise(_0x839e('0x4a'),'destroy',{'module':'chan_sip.so'});}})[_0x839e('0x13')](handleError(_0x48a845,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index df6ee20..a2adaf6 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 _0xb43b=['rimraf','../../config/environment','./network.attributes','Network','network','lodash','util','api','moment','bluebird','path'];(function(_0x2b8aec,_0x1953a8){var _0x4b2e10=function(_0x1efb6b){while(--_0x1efb6b){_0x2b8aec['push'](_0x2b8aec['shift']());}};_0x4b2e10(++_0x1953a8);}(_0xb43b,0x1b2));var _0xbb43=function(_0x329553,_0x156ce7){_0x329553=_0x329553-0x0;var _0x24e79e=_0xb43b[_0x329553];return _0x24e79e;};'use strict';var _=require(_0xbb43('0x0'));var util=require(_0xbb43('0x1'));var logger=require('../../config/logger')(_0xbb43('0x2'));var moment=require(_0xbb43('0x3'));var BPromise=require(_0xbb43('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbb43('0x5'));var rimraf=require(_0xbb43('0x6'));var config=require(_0xbb43('0x7'));var attributes=require(_0xbb43('0x8'));module['exports']=function(_0x491fb9,_0x378df5){return _0x491fb9['define'](_0xbb43('0x9'),attributes,{'tableName':_0xbb43('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x37f8=['Network','network','util','../../config/logger','api','moment','request-promise','define'];(function(_0x58a359,_0x4c21c5){var _0xfe8153=function(_0x2b6dd7){while(--_0x2b6dd7){_0x58a359['push'](_0x58a359['shift']());}};_0xfe8153(++_0x4c21c5);}(_0x37f8,0xd2));var _0x837f=function(_0x48cd43,_0x18ea0a){_0x48cd43=_0x48cd43-0x0;var _0x3b7362=_0x37f8[_0x48cd43];return _0x3b7362;};'use strict';var _=require('lodash');var util=require(_0x837f('0x0'));var logger=require(_0x837f('0x1'))(_0x837f('0x2'));var moment=require(_0x837f('0x3'));var BPromise=require('bluebird');var rp=require(_0x837f('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./network.attributes');module['exports']=function(_0x19c939,_0x42986f){return _0x19c939[_0x837f('0x5')](_0x837f('0x6'),attributes,{'tableName':_0x837f('0x7'),'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 9cced17..65b3345 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(_0x3d3b9d,_0x351d0f){var _0x207f62=function(_0x11e5b1){while(--_0x11e5b1){_0x3d3b9d['push'](_0x3d3b9d['shift']());}};_0x207f62(++_0x351d0f);}(_0x9957,0x93));var _0x7995=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x9957[_0xbca1b1];return _0x4e1686;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var 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 _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(_0x3debfc,_0x5b140f){var _0x596dc2=function(_0x221993){while(--_0x221993){_0x3debfc['push'](_0x3debfc['shift']());}};_0x596dc2(++_0x5b140f);}(_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 diff --git a/server/api/openchannelAccount/index.js b/server/api/openchannelAccount/index.js index dfdd59a..0ee32e9 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 _0xcefe=['create','addDisposition','addAnswer','/:id/notify','notify','/:id/applications','addApplications','addAgents','/:id/send','send','/:id','update','destroy','delete','removeAgents','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelAccount.controller','get','isAuthenticated','index','/describe','show','/:id/dispositions','getDispositions','/:id/canned_answers','getApplications','getInteractions','/:id/users','getAgents','post'];(function(_0x5da789,_0x12e256){var _0x35495d=function(_0x1869f3){while(--_0x1869f3){_0x5da789['push'](_0x5da789['shift']());}};_0x35495d(++_0x12e256);}(_0xcefe,0xce));var _0xecef=function(_0x2ccfc4,_0x521080){_0x2ccfc4=_0x2ccfc4-0x0;var _0x3e573a=_0xcefe[_0x2ccfc4];return _0x3e573a;};'use strict';var multer=require(_0xecef('0x0'));var util=require(_0xecef('0x1'));var path=require(_0xecef('0x2'));var timeout=require('connect-timeout');var express=require(_0xecef('0x3'));var router=express['Router']();var fs_extra=require(_0xecef('0x4'));var auth=require(_0xecef('0x5'));var interaction=require(_0xecef('0x6'));var config=require(_0xecef('0x7'));var controller=require(_0xecef('0x8'));router[_0xecef('0x9')]('/',auth[_0xecef('0xa')](),controller[_0xecef('0xb')]);router[_0xecef('0x9')](_0xecef('0xc'),auth[_0xecef('0xa')](),controller['describe']);router[_0xecef('0x9')]('/:id',auth[_0xecef('0xa')](),controller[_0xecef('0xd')]);router[_0xecef('0x9')](_0xecef('0xe'),auth[_0xecef('0xa')](),controller[_0xecef('0xf')]);router[_0xecef('0x9')](_0xecef('0x10'),auth[_0xecef('0xa')](),controller['getAnswers']);router[_0xecef('0x9')]('/:id/applications',auth['isAuthenticated'](),controller[_0xecef('0x11')]);router[_0xecef('0x9')]('/:id/interactions',auth[_0xecef('0xa')](),controller[_0xecef('0x12')]);router[_0xecef('0x9')](_0xecef('0x13'),auth['isAuthenticated'](),controller[_0xecef('0x14')]);router[_0xecef('0x15')]('/',auth['isAuthenticated'](),controller[_0xecef('0x16')]);router['post'](_0xecef('0xe'),auth[_0xecef('0xa')](),controller[_0xecef('0x17')]);router[_0xecef('0x15')](_0xecef('0x10'),auth['isAuthenticated'](),controller[_0xecef('0x18')]);router['post'](_0xecef('0x19'),controller[_0xecef('0x1a')]);router[_0xecef('0x15')](_0xecef('0x1b'),auth[_0xecef('0xa')](),controller[_0xecef('0x1c')]);router[_0xecef('0x15')]('/:id/users',auth[_0xecef('0xa')](),controller[_0xecef('0x1d')]);router[_0xecef('0x15')](_0xecef('0x1e'),auth[_0xecef('0xa')](),controller[_0xecef('0x1f')]);router['put'](_0xecef('0x20'),auth[_0xecef('0xa')](),controller[_0xecef('0x21')]);router['delete'](_0xecef('0x20'),auth[_0xecef('0xa')](),controller[_0xecef('0x22')]);router[_0xecef('0x23')]('/:id/dispositions',auth['isAuthenticated'](),controller['removeDispositions']);router[_0xecef('0x23')](_0xecef('0x10'),auth[_0xecef('0xa')](),controller['removeAnswers']);router[_0xecef('0x23')]('/:id/users',auth[_0xecef('0xa')](),controller[_0xecef('0x24')]);module[_0xecef('0x25')]=router; \ No newline at end of file +var _0x2220=['removeAnswers','removeAgents','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','get','/describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getInteractions','/:id/users','getAgents','create','post','addDisposition','addAnswer','notify','addApplications','addAgents','/:id/send','send','update','delete','destroy'];(function(_0x3c24a1,_0x12903f){var _0x29e948=function(_0x2170ce){while(--_0x2170ce){_0x3c24a1['push'](_0x3c24a1['shift']());}};_0x29e948(++_0x12903f);}(_0x2220,0xdb));var _0x0222=function(_0x5f3f88,_0x562baf){_0x5f3f88=_0x5f3f88-0x0;var _0xd08119=_0x2220[_0x5f3f88];return _0xd08119;};'use strict';var multer=require(_0x0222('0x0'));var util=require('util');var path=require(_0x0222('0x1'));var timeout=require('connect-timeout');var express=require(_0x0222('0x2'));var router=express[_0x0222('0x3')]();var fs_extra=require(_0x0222('0x4'));var auth=require(_0x0222('0x5'));var interaction=require(_0x0222('0x6'));var config=require('../../config/environment');var controller=require('./openchannelAccount.controller');router['get']('/',auth[_0x0222('0x7')](),controller[_0x0222('0x8')]);router[_0x0222('0x9')](_0x0222('0xa'),auth[_0x0222('0x7')](),controller['describe']);router['get'](_0x0222('0xb'),auth[_0x0222('0x7')](),controller[_0x0222('0xc')]);router[_0x0222('0x9')](_0x0222('0xd'),auth[_0x0222('0x7')](),controller[_0x0222('0xe')]);router[_0x0222('0x9')](_0x0222('0xf'),auth[_0x0222('0x7')](),controller[_0x0222('0x10')]);router[_0x0222('0x9')](_0x0222('0x11'),auth[_0x0222('0x7')](),controller['getApplications']);router['get']('/:id/interactions',auth['isAuthenticated'](),controller[_0x0222('0x12')]);router['get'](_0x0222('0x13'),auth[_0x0222('0x7')](),controller[_0x0222('0x14')]);router['post']('/',auth[_0x0222('0x7')](),controller[_0x0222('0x15')]);router[_0x0222('0x16')](_0x0222('0xd'),auth[_0x0222('0x7')](),controller[_0x0222('0x17')]);router[_0x0222('0x16')](_0x0222('0xf'),auth[_0x0222('0x7')](),controller[_0x0222('0x18')]);router['post']('/:id/notify',controller[_0x0222('0x19')]);router[_0x0222('0x16')]('/:id/applications',auth[_0x0222('0x7')](),controller[_0x0222('0x1a')]);router[_0x0222('0x16')](_0x0222('0x13'),auth[_0x0222('0x7')](),controller[_0x0222('0x1b')]);router[_0x0222('0x16')](_0x0222('0x1c'),auth[_0x0222('0x7')](),controller[_0x0222('0x1d')]);router['put'](_0x0222('0xb'),auth[_0x0222('0x7')](),controller[_0x0222('0x1e')]);router[_0x0222('0x1f')]('/:id',auth[_0x0222('0x7')](),controller[_0x0222('0x20')]);router[_0x0222('0x1f')](_0x0222('0xd'),auth['isAuthenticated'](),controller['removeDispositions']);router['delete'](_0x0222('0xf'),auth[_0x0222('0x7')](),controller[_0x0222('0x21')]);router['delete'](_0x0222('0x13'),auth['isAuthenticated'](),controller[_0x0222('0x22')]);module[_0x0222('0x23')]=router; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.attributes.js b/server/api/openchannelAccount/openchannelAccount.attributes.js index 8df34ae..0694bd7 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 _0x3964=['sequelize','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','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition'];(function(_0x1318e7,_0x21edcc){var _0x664d8f=function(_0x1bb3fa){while(--_0x1bb3fa){_0x1318e7['push'](_0x1318e7['shift']());}};_0x664d8f(++_0x21edcc);}(_0x3964,0x186));var _0x4396=function(_0x159fa3,_0x1af810){_0x159fa3=_0x159fa3-0x0;var _0x296a62=_0x3964[_0x159fa3];return _0x296a62;};'use strict';var Sequelize=require(_0x4396('0x0'));var rs=require('randomstring');module[_0x4396('0x1')]={'name':{'type':Sequelize[_0x4396('0x2')],'unique':_0x4396('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x4396('0x2')]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x4396('0x4')]();}},'replyUri':{'type':Sequelize['STRING'],'validate':{'isUrl':!![]}},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x4396('0x5');}},'notificationSound':{'type':Sequelize[_0x4396('0x6')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x4396('0x6')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x4396('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0x4396('0x2')]},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x4396('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x4396('0x6')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x4396('0x7')],'allowNull':!![],'defaultValue':null,'comment':_0x4396('0x8')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x4396('0x9'),'set':function(_0x550d9c){if(!_0x550d9c)this[_0x4396('0xa')](_0x4396('0xb'),null);this[_0x4396('0xa')](_0x4396('0xc'),_0x550d9c);}}}; \ No newline at end of file +var _0x2267=['mandatoryDispositionPauseId','setDataValue','sequelize','randomstring','exports','name','STRING','TEXT','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue'];(function(_0x58a9a9,_0x3fc0d1){var _0x5c66b5=function(_0x4a0bd7){while(--_0x4a0bd7){_0x58a9a9['push'](_0x58a9a9['shift']());}};_0x5c66b5(++_0x3fc0d1);}(_0x2267,0x13a));var _0x7226=function(_0x229a5f,_0xb91285){_0x229a5f=_0x229a5f-0x0;var _0x3d4b3f=_0x2267[_0x229a5f];return _0x3d4b3f;};'use strict';var Sequelize=require(_0x7226('0x0'));var rs=require(_0x7226('0x1'));module[_0x7226('0x2')]={'name':{'type':Sequelize['STRING'],'unique':_0x7226('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x7226('0x4')]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs['generate']();}},'replyUri':{'type':Sequelize[_0x7226('0x4')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x7226('0x4')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x7226('0x5')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x7226('0x6')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0x7226('0x4')]},'queueTransfer':{'type':Sequelize[_0x7226('0x6')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x7226('0x7')],'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[_0x7226('0x7')],'allowNull':!![],'defaultValue':null,'comment':_0x7226('0x8')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x7226('0x9'),'set':function(_0x1545a6){if(!_0x1545a6)this['setDataValue'](_0x7226('0xa'),null);this[_0x7226('0xb')]('mandatoryDisposition',_0x1545a6);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index c8cbf1f..203f191 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 _0x289e=['Start','EventManager','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','OpenchannelApplication','bulkCreate','findAndCountAll','priority','finally','getApplications','getInteractions','Contact','User','Owner','fullname','internal','Tag','Tags','color','tag','addAgents','omit','emit','userOpenchannelAccount:save','removeAgents','userOpenchannelAccount:remove','getAgents','send','CmList','out','dataValues','Messages','push','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelAccount.socket','jayson/promise','http','request','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','update','then','OpenchannelAccounts','UserProfileResource','destroy','name','Pause','mandatoryDispositionPause','map','OpenchannelAccount','fieldName','type','key','keys','query','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','includeAll','findAll','rows','show','params','rawAttributes','include','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','describe','OpenchannelAccountId','Disposition','getDispositions','findOne','removeDispositions','addAnswer','CannedAnswer','getAnswers','removeAnswers','ids','notify','openchannel','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','createdAt','updatedAt','difference','CompanyId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','List','Contacts','DESC','Applications','account','applications','list','orderBy','asc','contact','firstName','lastName','threadId','OpenchannelInteraction','externalUrl','ContactId','spread','messageId','interaction','created','autoclose','unmanaged','*,*,*,*','OpenchannelMessage','AttachmentId','UserId','unshift','agent','queueId','OpenchannelQueue','queue','waitForTheAssignedQueue'];(function(_0x585876,_0x1e5db0){var _0x3f453a=function(_0x259e1e){while(--_0x259e1e){_0x585876['push'](_0x585876['shift']());}};_0x3f453a(++_0x1e5db0);}(_0x289e,0xea));var _0xe289=function(_0x1a160d,_0x57fd51){_0x1a160d=_0x1a160d-0x0;var _0x3be03b=_0x289e[_0x1a160d];return _0x3be03b;};'use strict';var emlformat=require(_0xe289('0x0'));var rimraf=require(_0xe289('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe289('0x2'));var rp=require(_0xe289('0x3'));var moment=require('moment');var BPromise=require(_0xe289('0x4'));var Mustache=require(_0xe289('0x5'));var util=require('util');var path=require(_0xe289('0x6'));var sox=require(_0xe289('0x7'));var csv=require(_0xe289('0x8'));var ejs=require(_0xe289('0x9'));var fs=require('fs');var fs_extra=require(_0xe289('0xa'));var _=require(_0xe289('0xb'));var squel=require(_0xe289('0xc'));var crypto=require(_0xe289('0xd'));var jsforce=require(_0xe289('0xe'));var deskjs=require(_0xe289('0xf'));var toCsv=require('to-csv');var querystring=require(_0xe289('0x10'));var Papa=require(_0xe289('0x11'));var Redis=require(_0xe289('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xe289('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe289('0x14'));var logger=require(_0xe289('0x15'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xe289('0x16'));var db=require(_0xe289('0x17'))['db'];config[_0xe289('0x18')]=_[_0xe289('0x19')](config['redis'],{'host':_0xe289('0x1a'),'port':0x18eb});var socket=require(_0xe289('0x1b'))(new Redis(config[_0xe289('0x18')]));require(_0xe289('0x1c'))['register'](socket);var jayson=require(_0xe289('0x1d'));var client=jayson['client'][_0xe289('0x1e')]({'port':0x232c});var client9002=jayson['client'][_0xe289('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x4b61b8,_0x253fd6,_0x2efcfa,_0x1b9091){return new BPromise(function(_0x3ceb3e,_0x26311b){var _0x41f5c8=_0x1b9091||client;return _0x41f5c8[_0xe289('0x1f')](_0x4b61b8,_0x2efcfa)['then'](function(_0x1a9624){logger[_0xe289('0x20')](_0xe289('0x21'),_0x253fd6,_0xe289('0x22'));logger[_0xe289('0x23')](_0xe289('0x24'),_0x253fd6,_0xe289('0x22'),JSON[_0xe289('0x25')](_0x1a9624));if(_0x1a9624[_0xe289('0x26')]){if(_0x1a9624[_0xe289('0x26')][_0xe289('0x27')]===0x1f4){logger['error'](_0xe289('0x21'),_0x253fd6,_0x1a9624['error']['message']);return _0x26311b(_0x1a9624[_0xe289('0x26')][_0xe289('0x28')]);}logger[_0xe289('0x26')](_0xe289('0x21'),_0x253fd6,_0x1a9624[_0xe289('0x26')][_0xe289('0x28')]);return _0x3ceb3e(_0x1a9624[_0xe289('0x26')][_0xe289('0x28')]);}else{logger[_0xe289('0x20')](_0xe289('0x21'),_0x253fd6,'request\x20sent');_0x3ceb3e(_0x1a9624[_0xe289('0x29')][_0xe289('0x28')]);}})[_0xe289('0x2a')](function(_0x3cc28f){logger[_0xe289('0x26')](_0xe289('0x21'),_0x253fd6,_0x3cc28f);_0x26311b(_0x3cc28f);});});}function respondWithStatusCode(_0x23a0be,_0x47c755){_0x47c755=_0x47c755||0xcc;return function(_0x5e4ea1){if(_0x5e4ea1){return _0x23a0be[_0xe289('0x2b')](_0x47c755);}return _0x23a0be[_0xe289('0x2c')](_0x47c755)[_0xe289('0x2d')]();};}function respondWithResult(_0x52867c,_0x46c273){_0x46c273=_0x46c273||0xc8;return function(_0x348a6c){if(_0x348a6c){return _0x52867c[_0xe289('0x2c')](_0x46c273)[_0xe289('0x2e')](_0x348a6c);}};}function respondWithFilteredResult(_0x2d0e14,_0x3f22c7){return function(_0x56f298){if(_0x56f298){var _0xc4c7c6=typeof _0x3f22c7[_0xe289('0x2f')]===_0xe289('0x30')&&typeof _0x3f22c7[_0xe289('0x31')]===_0xe289('0x30');var _0x463152=_0x56f298['count'];var _0x58e89e=_0xc4c7c6?0x0:_0x3f22c7[_0xe289('0x2f')];var _0x2decae=_0xc4c7c6?_0x56f298[_0xe289('0x32')]:_0x3f22c7[_0xe289('0x2f')]+_0x3f22c7[_0xe289('0x31')];var _0x4d704;if(_0x2decae>=_0x463152){_0x2decae=_0x463152;_0x4d704=0xc8;}else{_0x4d704=0xce;}_0x2d0e14[_0xe289('0x2c')](_0x4d704);return _0x2d0e14['set'](_0xe289('0x33'),_0x58e89e+'-'+_0x2decae+'/'+_0x463152)[_0xe289('0x2e')](_0x56f298);}return null;};}function patchUpdates(_0x5e683b){return function(_0xf3a935){try{jsonpatch[_0xe289('0x34')](_0xf3a935,_0x5e683b,!![]);}catch(_0x63e4ff){return BPromise['reject'](_0x63e4ff);}return _0xf3a935['save']();};}function saveUpdates(_0x215024,_0x27be52){return function(_0x10656a){if(_0x10656a){return _0x10656a[_0xe289('0x35')](_0x215024)['then'](function(_0x3ce8f4){return _0x3ce8f4;});}return null;};}function removeEntity(_0x1fccbb,_0x3b217e){return function(_0x14e6f4){if(_0x14e6f4){return _0x14e6f4['destroy']()[_0xe289('0x36')](function(){var _0x439850=_0x14e6f4['get']({'plain':!![]});var _0x4e5796=_0xe289('0x37');return db[_0xe289('0x38')][_0xe289('0x39')]({'where':{'type':_0x4e5796,'resourceId':_0x439850['id']}})['then'](function(){return _0x14e6f4;});})[_0xe289('0x36')](function(){_0x1fccbb['status'](0xcc)[_0xe289('0x2d')]();});}};}function handleEntityNotFound(_0x1769c1,_0x54ac8b){return function(_0xd00fe3){if(!_0xd00fe3){_0x1769c1['sendStatus'](0x194);}return _0xd00fe3;};}function handleError(_0x38efc1,_0x471efe){_0x471efe=_0x471efe||0x1f4;return function(_0x1b9d93){logger['error'](_0x1b9d93['stack']);if(_0x1b9d93[_0xe289('0x3a')]){delete _0x1b9d93[_0xe289('0x3a')];}_0x38efc1['status'](_0x471efe)['send'](_0x1b9d93);};}exports['index']=function(_0x22a6dc,_0x557409){var _0x34b648={'include':[{'model':db[_0xe289('0x3b')],'as':_0xe289('0x3c')}]},_0x1a04a2={},_0x1ef453={'count':0x0,'rows':[]};var _0x1f58cf=_[_0xe289('0x3d')](db[_0xe289('0x3e')]['rawAttributes'],function(_0x22459d){return{'name':_0x22459d[_0xe289('0x3f')],'type':_0x22459d[_0xe289('0x40')][_0xe289('0x41')]};});_0x1a04a2['model']=_[_0xe289('0x3d')](_0x1f58cf,'name');_0x1a04a2['query']=_[_0xe289('0x42')](_0x22a6dc[_0xe289('0x43')]);_0x1a04a2['filters']=_[_0xe289('0x44')](_0x1a04a2['model'],_0x1a04a2[_0xe289('0x43')]);_0x34b648[_0xe289('0x45')]=_[_0xe289('0x44')](_0x1a04a2[_0xe289('0x46')],qs[_0xe289('0x47')](_0x22a6dc['query']['fields']));_0x34b648[_0xe289('0x45')]=_0x34b648[_0xe289('0x45')][_0xe289('0x48')]?_0x34b648['attributes']:_0x1a04a2[_0xe289('0x46')];if(!_0x22a6dc[_0xe289('0x43')][_0xe289('0x49')](_0xe289('0x4a'))){_0x34b648[_0xe289('0x31')]=qs[_0xe289('0x31')](_0x22a6dc['query'][_0xe289('0x31')]);_0x34b648[_0xe289('0x2f')]=qs[_0xe289('0x2f')](_0x22a6dc[_0xe289('0x43')]['offset']);}_0x34b648[_0xe289('0x4b')]=qs[_0xe289('0x4c')](_0x22a6dc[_0xe289('0x43')][_0xe289('0x4c')]);_0x34b648[_0xe289('0x4d')]=qs[_0xe289('0x4e')](_[_0xe289('0x4f')](_0x22a6dc[_0xe289('0x43')],_0x1a04a2[_0xe289('0x4e')]),_0x1f58cf);if(_0x22a6dc[_0xe289('0x43')]['filter']){_0x34b648[_0xe289('0x4d')]=_[_0xe289('0x50')](_0x34b648[_0xe289('0x4d')],{'$or':_[_0xe289('0x3d')](_0x1f58cf,function(_0x26d7ea){if(_0x26d7ea[_0xe289('0x40')]!==_0xe289('0x51')){var _0x23dea0={};_0x23dea0[_0x26d7ea[_0xe289('0x3a')]]={'$like':'%'+_0x22a6dc[_0xe289('0x43')][_0xe289('0x52')]+'%'};return _0x23dea0;}})});}_0x34b648=_[_0xe289('0x50')]({},_0x34b648,_0x22a6dc[_0xe289('0x53')]);var _0x30e138={'where':_0x34b648[_0xe289('0x4d')]};return db[_0xe289('0x3e')][_0xe289('0x32')](_0x30e138)[_0xe289('0x36')](function(_0x1f46da){_0x1ef453[_0xe289('0x32')]=_0x1f46da;if(_0x22a6dc[_0xe289('0x43')][_0xe289('0x54')]){_0x34b648['include']=[{'all':!![]}];}return db[_0xe289('0x3e')][_0xe289('0x55')](_0x34b648);})[_0xe289('0x36')](function(_0x50df65){_0x1ef453[_0xe289('0x56')]=_0x50df65;return _0x1ef453;})['then'](respondWithFilteredResult(_0x557409,_0x34b648))['catch'](handleError(_0x557409,null));};exports[_0xe289('0x57')]=function(_0x529c28,_0x1a16b0){var _0x8ec96c={'raw':![],'where':{'id':_0x529c28[_0xe289('0x58')]['id']},'include':[{'model':db[_0xe289('0x3b')],'as':_0xe289('0x3c')}]},_0x3e6400={};_0x3e6400[_0xe289('0x46')]=_[_0xe289('0x42')](db[_0xe289('0x3e')][_0xe289('0x59')]);_0x3e6400['query']=_['keys'](_0x529c28[_0xe289('0x43')]);_0x3e6400[_0xe289('0x4e')]=_[_0xe289('0x44')](_0x3e6400[_0xe289('0x46')],_0x3e6400[_0xe289('0x43')]);_0x8ec96c[_0xe289('0x45')]=_['intersection'](_0x3e6400[_0xe289('0x46')],qs['fields'](_0x529c28['query']['fields']));_0x8ec96c[_0xe289('0x45')]=_0x8ec96c['attributes']['length']?_0x8ec96c['attributes']:_0x3e6400[_0xe289('0x46')];if(_0x529c28[_0xe289('0x43')]['includeAll']){_0x8ec96c[_0xe289('0x5a')]=[{'all':!![]}];}_0x8ec96c=_[_0xe289('0x50')]({},_0x8ec96c,_0x529c28[_0xe289('0x53')]);return db[_0xe289('0x3e')][_0xe289('0x5b')](_0x8ec96c)[_0xe289('0x36')](handleEntityNotFound(_0x1a16b0,null))['then'](respondWithResult(_0x1a16b0,null))[_0xe289('0x2a')](handleError(_0x1a16b0,null));};exports[_0xe289('0x5c')]=function(_0x32c193,_0x3e19be){return db[_0xe289('0x3e')][_0xe289('0x5c')](_0x32c193[_0xe289('0x5d')],{})['then'](function(_0x463a03){var _0x40e59e=_0x32c193[_0xe289('0x5e')][_0xe289('0x5f')]({'plain':!![]});if(!_0x40e59e)throw new Error(_0xe289('0x60'));if(_0x40e59e[_0xe289('0x61')]===_0xe289('0x5e')){var _0x1e26c9=_0x463a03[_0xe289('0x5f')]({'plain':!![]});var _0x5d53d2=_0xe289('0x37');return db[_0xe289('0x62')]['find']({'where':{'name':_0x5d53d2,'userProfileId':_0x40e59e[_0xe289('0x63')]},'raw':!![]})['then'](function(_0x410d4a){if(_0x410d4a&&_0x410d4a[_0xe289('0x64')]===0x0){return db['UserProfileResource'][_0xe289('0x5c')]({'name':_0x1e26c9[_0xe289('0x3a')],'resourceId':_0x1e26c9['id'],'type':_0x410d4a[_0xe289('0x3a')],'sectionId':_0x410d4a['id']},{})[_0xe289('0x36')](function(){return _0x463a03;});}else{return _0x463a03;}})['catch'](function(_0x3466c0){logger[_0xe289('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3466c0);throw _0x3466c0;});}return _0x463a03;})[_0xe289('0x36')](respondWithResult(_0x3e19be,0xc9))['catch'](handleError(_0x3e19be,null));};exports['update']=function(_0x4d36bb,_0x526c6f){if(_0x4d36bb[_0xe289('0x5d')]['id']){delete _0x4d36bb['body']['id'];}return db['OpenchannelAccount'][_0xe289('0x5b')]({'where':{'id':_0x4d36bb[_0xe289('0x58')]['id']},'include':[{'model':db[_0xe289('0x3b')],'as':'mandatoryDispositionPause'}]})[_0xe289('0x36')](handleEntityNotFound(_0x526c6f,null))[_0xe289('0x36')](saveUpdates(_0x4d36bb[_0xe289('0x5d')],null))[_0xe289('0x36')](respondWithResult(_0x526c6f,null))[_0xe289('0x2a')](handleError(_0x526c6f,null));};exports[_0xe289('0x39')]=function(_0x537dfd,_0x40e9c7){return db[_0xe289('0x3e')][_0xe289('0x5b')]({'where':{'id':_0x537dfd[_0xe289('0x58')]['id']}})[_0xe289('0x36')](handleEntityNotFound(_0x40e9c7,null))[_0xe289('0x36')](removeEntity(_0x40e9c7,null))['catch'](handleError(_0x40e9c7,null));};exports[_0xe289('0x65')]=function(_0xdd829d,_0x1be36e){return db['OpenchannelAccount']['describe']()[_0xe289('0x36')](respondWithResult(_0x1be36e,null))[_0xe289('0x2a')](handleError(_0x1be36e,null));};exports['addDisposition']=function(_0x57a8b9,_0x2bbe98,_0x2d6dba){if(_0x57a8b9[_0xe289('0x5d')]['id']){delete _0x57a8b9[_0xe289('0x5d')]['id'];}return db[_0xe289('0x3e')][_0xe289('0x5b')]({'where':{'id':_0x57a8b9[_0xe289('0x58')]['id']}})['then'](handleEntityNotFound(_0x2bbe98,null))['then'](function(_0x598d4a){if(_0x598d4a){_0x57a8b9['body'][_0xe289('0x66')]=_0x598d4a['id'];return db[_0xe289('0x67')][_0xe289('0x5c')](_0x57a8b9[_0xe289('0x5d')]);}})[_0xe289('0x36')](respondWithResult(_0x2bbe98,null))[_0xe289('0x2a')](handleError(_0x2bbe98,null));};exports[_0xe289('0x68')]=function(_0xf85573,_0x5bad2c,_0x1189d3){var _0x59be2d={'raw':![],'where':{}};var _0x4d594b={};var _0x4492cb={'count':0x0,'rows':[]};return db[_0xe289('0x3e')][_0xe289('0x69')]({'where':{'id':_0xf85573['params']['id']}})[_0xe289('0x36')](handleEntityNotFound(_0x5bad2c,null))[_0xe289('0x36')](function(_0x27cc32){if(_0x27cc32){_0x4d594b[_0xe289('0x46')]=_['keys'](db[_0xe289('0x67')][_0xe289('0x59')]);_0x4d594b[_0xe289('0x43')]=_[_0xe289('0x42')](_0xf85573['query']);_0x4d594b[_0xe289('0x4e')]=_[_0xe289('0x44')](_0x4d594b[_0xe289('0x46')],_0x4d594b[_0xe289('0x43')]);_0x59be2d[_0xe289('0x45')]=_[_0xe289('0x44')](_0x4d594b['model'],qs[_0xe289('0x47')](_0xf85573[_0xe289('0x43')][_0xe289('0x47')]));_0x59be2d[_0xe289('0x45')]=_0x59be2d[_0xe289('0x45')][_0xe289('0x48')]?_0x59be2d['attributes']:_0x4d594b[_0xe289('0x46')];if(!_0xf85573[_0xe289('0x43')][_0xe289('0x49')](_0xe289('0x4a'))){_0x59be2d[_0xe289('0x31')]=qs[_0xe289('0x31')](_0xf85573['query'][_0xe289('0x31')]);_0x59be2d[_0xe289('0x2f')]=qs[_0xe289('0x2f')](_0xf85573[_0xe289('0x43')][_0xe289('0x2f')]);}_0x59be2d[_0xe289('0x4b')]=qs[_0xe289('0x4c')](_0xf85573[_0xe289('0x43')][_0xe289('0x4c')]);_0x59be2d[_0xe289('0x4d')]=qs[_0xe289('0x4e')](_[_0xe289('0x4f')](_0xf85573[_0xe289('0x43')],_0x4d594b[_0xe289('0x4e')]));_0x59be2d['where'][_0xe289('0x66')]=_0x27cc32['id'];if(_0xf85573[_0xe289('0x43')][_0xe289('0x52')]){_0x59be2d[_0xe289('0x4d')]=_[_0xe289('0x50')](_0x59be2d['where'],{'$or':_[_0xe289('0x3d')](_0x59be2d[_0xe289('0x45')],function(_0x2a7f5f){var _0x598f42={};_0x598f42[_0x2a7f5f]={'$like':'%'+_0xf85573['query'][_0xe289('0x52')]+'%'};return _0x598f42;})});}_0x59be2d=_[_0xe289('0x50')]({},_0x59be2d,_0xf85573[_0xe289('0x53')]);return db[_0xe289('0x67')][_0xe289('0x32')]({'where':_0x59be2d[_0xe289('0x4d')]})[_0xe289('0x36')](function(_0x19298b){_0x4492cb[_0xe289('0x32')]=_0x19298b;if(_0xf85573[_0xe289('0x43')]['includeAll']){_0x59be2d['include']=[{'all':!![]}];}return db[_0xe289('0x67')][_0xe289('0x55')](_0x59be2d);})[_0xe289('0x36')](function(_0x1e3de7){_0x4492cb[_0xe289('0x56')]=_0x1e3de7;return _0x4492cb;});}})[_0xe289('0x36')](respondWithFilteredResult(_0x5bad2c,_0x59be2d))[_0xe289('0x2a')](handleError(_0x5bad2c,null));};exports[_0xe289('0x6a')]=function(_0x417c2e,_0x51251a,_0x2c6013){return db['OpenchannelAccount'][_0xe289('0x5b')]({'where':{'id':_0x417c2e[_0xe289('0x58')]['id']}})[_0xe289('0x36')](handleEntityNotFound(_0x51251a,null))['then'](function(_0x1190c9){if(_0x1190c9){return _0x1190c9[_0xe289('0x6a')](_0x417c2e['query']['ids']);}})['then'](respondWithStatusCode(_0x51251a,null))[_0xe289('0x2a')](handleError(_0x51251a,null));};exports[_0xe289('0x6b')]=function(_0x23d5b4,_0x434628,_0x453a70){if(_0x23d5b4[_0xe289('0x5d')]['id']){delete _0x23d5b4[_0xe289('0x5d')]['id'];}return db['OpenchannelAccount'][_0xe289('0x5b')]({'where':{'id':_0x23d5b4[_0xe289('0x58')]['id']}})['then'](handleEntityNotFound(_0x434628,null))[_0xe289('0x36')](function(_0x45d1da){if(_0x45d1da){_0x23d5b4[_0xe289('0x5d')]['OpenchannelAccountId']=_0x45d1da['id'];return db[_0xe289('0x6c')]['create'](_0x23d5b4[_0xe289('0x5d')]);}})[_0xe289('0x36')](respondWithResult(_0x434628,null))['catch'](handleError(_0x434628,null));};exports[_0xe289('0x6d')]=function(_0x143f6c,_0xa7d956,_0x424235){var _0x23b8cd={'raw':![],'where':{}};var _0x5bf492={};var _0x17efa3={'count':0x0,'rows':[]};return db['OpenchannelAccount']['findOne']({'where':{'id':_0x143f6c['params']['id']}})[_0xe289('0x36')](handleEntityNotFound(_0xa7d956,null))['then'](function(_0x5e8c95){if(_0x5e8c95){_0x5bf492[_0xe289('0x46')]=_['keys'](db['CannedAnswer'][_0xe289('0x59')]);_0x5bf492[_0xe289('0x43')]=_[_0xe289('0x42')](_0x143f6c[_0xe289('0x43')]);_0x5bf492['filters']=_[_0xe289('0x44')](_0x5bf492['model'],_0x5bf492[_0xe289('0x43')]);_0x23b8cd[_0xe289('0x45')]=_['intersection'](_0x5bf492[_0xe289('0x46')],qs[_0xe289('0x47')](_0x143f6c[_0xe289('0x43')][_0xe289('0x47')]));_0x23b8cd[_0xe289('0x45')]=_0x23b8cd[_0xe289('0x45')][_0xe289('0x48')]?_0x23b8cd['attributes']:_0x5bf492['model'];if(!_0x143f6c[_0xe289('0x43')]['hasOwnProperty'](_0xe289('0x4a'))){_0x23b8cd[_0xe289('0x31')]=qs[_0xe289('0x31')](_0x143f6c[_0xe289('0x43')][_0xe289('0x31')]);_0x23b8cd[_0xe289('0x2f')]=qs[_0xe289('0x2f')](_0x143f6c[_0xe289('0x43')][_0xe289('0x2f')]);}_0x23b8cd[_0xe289('0x4b')]=qs['sort'](_0x143f6c['query']['sort']);_0x23b8cd[_0xe289('0x4d')]=qs['filters'](_['pick'](_0x143f6c[_0xe289('0x43')],_0x5bf492[_0xe289('0x4e')]));_0x23b8cd[_0xe289('0x4d')]['OpenchannelAccountId']=_0x5e8c95['id'];if(_0x143f6c[_0xe289('0x43')][_0xe289('0x52')]){_0x23b8cd[_0xe289('0x4d')]=_[_0xe289('0x50')](_0x23b8cd[_0xe289('0x4d')],{'$or':_[_0xe289('0x3d')](_0x23b8cd[_0xe289('0x45')],function(_0x3296ad){var _0x43d8ad={};_0x43d8ad[_0x3296ad]={'$like':'%'+_0x143f6c[_0xe289('0x43')][_0xe289('0x52')]+'%'};return _0x43d8ad;})});}_0x23b8cd=_[_0xe289('0x50')]({},_0x23b8cd,_0x143f6c['options']);return db[_0xe289('0x6c')][_0xe289('0x32')]({'where':_0x23b8cd[_0xe289('0x4d')]})[_0xe289('0x36')](function(_0x3442aa){_0x17efa3[_0xe289('0x32')]=_0x3442aa;if(_0x143f6c[_0xe289('0x43')][_0xe289('0x54')]){_0x23b8cd['include']=[{'all':!![]}];}return db[_0xe289('0x6c')][_0xe289('0x55')](_0x23b8cd);})['then'](function(_0x350bf5){_0x17efa3['rows']=_0x350bf5;return _0x17efa3;});}})[_0xe289('0x36')](respondWithFilteredResult(_0xa7d956,_0x23b8cd))['catch'](handleError(_0xa7d956,null));};exports[_0xe289('0x6e')]=function(_0x2356df,_0x1d653e,_0x1d202b){return db[_0xe289('0x3e')][_0xe289('0x5b')]({'where':{'id':_0x2356df['params']['id']}})['then'](handleEntityNotFound(_0x1d653e,null))['then'](function(_0x355d6f){if(_0x355d6f){return _0x355d6f['removeAnswers'](_0x2356df[_0xe289('0x43')][_0xe289('0x6f')]);}})[_0xe289('0x36')](respondWithStatusCode(_0x1d653e,null))[_0xe289('0x2a')](handleError(_0x1d653e,null));};exports[_0xe289('0x70')]=function(_0x3ed91b,_0x2e5bb8,_0x501848){var _0x5de9f2={'body':_0x3ed91b['body'],'channel':_0xe289('0x71')};var _0x171584=[];var _0x597b11=[];var _0x5832af={};var _0x3a9ece=![];return db[_0xe289('0x72')][_0xe289('0x65')]()[_0xe289('0x36')](function(_0xa870f1){if(!_0xa870f1){throw new db[(_0xe289('0x73'))][(_0xe289('0x74'))](_0xe289('0x75'));}_0x171584=_['difference'](_[_0xe289('0x42')](_0xa870f1),[_0xe289('0x76'),_0xe289('0x77')]);_0x597b11=_[_0xe289('0x78')](_[_0xe289('0x42')](_0xa870f1),[_0xe289('0x76'),'updatedAt',_0xe289('0x79'),'ListId']);if(_0x3ed91b['body']['id']){delete _0x3ed91b['body']['id'];}if(_[_0xe289('0x7a')](_0x3ed91b[_0xe289('0x5d')][_0xe289('0x7b')])){throw new db['Sequelize'][(_0xe289('0x74'))](_0xe289('0x7c'));}if(_[_0xe289('0x7a')](_0x3ed91b[_0xe289('0x5d')]['body'])||_0x3ed91b['body'][_0xe289('0x5d')]===''){throw new db[(_0xe289('0x73'))][(_0xe289('0x74'))](_0xe289('0x7d'));}if(_[_0xe289('0x7a')](_0x3ed91b[_0xe289('0x5d')][_0xe289('0x7e')])){throw new db[(_0xe289('0x73'))][(_0xe289('0x74'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x597b11);}if(!_[_0xe289('0x7f')](_0x597b11,_0x3ed91b[_0xe289('0x5d')][_0xe289('0x7e')])){throw new db[(_0xe289('0x73'))]['ValidationError']('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x597b11);}_0x5832af[_0x3ed91b[_0xe289('0x5d')][_0xe289('0x7e')]]=_0x3ed91b[_0xe289('0x5d')][_0xe289('0x7b')];})[_0xe289('0x36')](function(){return db[_0xe289('0x3e')][_0xe289('0x5b')]({'where':{'id':_0x3ed91b[_0xe289('0x58')]['id']},'include':[{'model':db['CmList'],'as':_0xe289('0x80'),'include':[{'model':db[_0xe289('0x72')],'as':_0xe289('0x81'),'where':_0x5832af,'limit':0x1,'order':[['updatedAt',_0xe289('0x82')]]}]},{'model':db['OpenchannelApplication'],'as':_0xe289('0x83')}]});})[_0xe289('0x36')](handleEntityNotFound(_0x2e5bb8,null))[_0xe289('0x36')](function(_0x2a975a){if(_0x2a975a&&_0x2a975a['List']){_0x5de9f2[_0xe289('0x84')]=_0x2a975a;_0x5de9f2[_0xe289('0x85')]=_0x2a975a[_0xe289('0x83')];_0x5de9f2[_0xe289('0x86')]=_0x2a975a[_0xe289('0x80')];_0x5de9f2[_0xe289('0x85')]=_[_0xe289('0x87')](_0x5de9f2[_0xe289('0x85')],['priority'],[_0xe289('0x88')]);if(_0x5de9f2[_0xe289('0x84')][_0xe289('0x83')]){delete _0x5de9f2[_0xe289('0x84')]['Applications'];}if(_0x5de9f2[_0xe289('0x84')][_0xe289('0x80')]&&_0x5de9f2[_0xe289('0x84')][_0xe289('0x80')]['Contacts'][_0xe289('0x48')]){return _0x5de9f2[_0xe289('0x84')]['List'][_0xe289('0x81')][0x0];}var _0x76386b=_['defaults'](_0x3ed91b[_0xe289('0x5d')],{'firstName':_0x3ed91b[_0xe289('0x5d')]['from'],'ListId':_0x2a975a['ListId']});_0x76386b[_0x3ed91b[_0xe289('0x5d')][_0xe289('0x7e')]]=_0x3ed91b[_0xe289('0x5d')][_0xe289('0x7b')];return db[_0xe289('0x72')][_0xe289('0x5c')](_0x76386b,{'fields':_0x171584,'raw':!![]});}})[_0xe289('0x36')](handleEntityNotFound(_0x2e5bb8,null))['then'](function(_0x749460){_0x5de9f2[_0xe289('0x89')]=_0x749460;if(_0x749460){var _0x1ee99b={'ContactId':_0x749460['id'],'OpenchannelAccountId':_0x3ed91b['params']['id'],'from':(_0x749460[_0xe289('0x8a')]||'')+'\x20'+(_0x749460[_0xe289('0x8b')]||'')};var _0x1226c5={'OpenchannelAccountId':_0x3ed91b[_0xe289('0x58')]['id'],'closed':![]};if(_0x3ed91b['body']['threadId']){_0x1226c5[_0xe289('0x8c')]=_0x3ed91b['body'][_0xe289('0x8c')];return db[_0xe289('0x8d')][_0xe289('0x5b')]({'where':_0x1226c5})['then'](function(_0x16ff0a){if(_0x16ff0a){return[_0x16ff0a,![]];}_0x1ee99b[_0xe289('0x8c')]=_0x3ed91b[_0xe289('0x5d')][_0xe289('0x8c')];_0x1ee99b[_0xe289('0x8e')]=_0x3ed91b[_0xe289('0x5d')][_0xe289('0x8e')];return db[_0xe289('0x8d')]['create'](_0x1ee99b)['then'](function(_0x74f97b){return[_0x74f97b,!![]];});});}else{_0x1226c5[_0xe289('0x8c')]=null;}_0x1226c5[_0xe289('0x8f')]=_0x749460['id'];return db[_0xe289('0x8d')]['find']({'where':_0x1226c5})[_0xe289('0x36')](function(_0xa27e26){if(_0xa27e26){return[_0xa27e26,![]];}return db[_0xe289('0x8d')]['create'](_0x1ee99b)['then'](function(_0x379524){return[_0x379524,!![]];});});}})[_0xe289('0x90')](function(_0x545ab1,_0x18985a){if(_0x545ab1){_0x3a9ece=_0x18985a;if(!_0x18985a){var _0x4f8e4f={'from':(_0x5de9f2[_0xe289('0x89')][_0xe289('0x8a')]||'')+'\x20'+(_0x5de9f2['contact']['lastName']||'')};if(_0x3ed91b[_0xe289('0x5d')][_0xe289('0x8c')]&&_0x3ed91b[_0xe289('0x5d')][_0xe289('0x91')]&&_0x3ed91b[_0xe289('0x5d')][_0xe289('0x8c')]!=_0x3ed91b['body']['messageId']){_0x4f8e4f[_0xe289('0x8c')]=_0x3ed91b[_0xe289('0x5d')][_0xe289('0x91')];}return _0x545ab1[_0xe289('0x35')](_0x4f8e4f);}else{return _0x545ab1;}}})[_0xe289('0x36')](function(_0x201061){_0x5de9f2[_0xe289('0x92')]=_0x201061[_0xe289('0x5f')]({'plain':!![]});_0x5de9f2[_0xe289('0x92')][_0xe289('0x93')]=_0x3a9ece;if(_0x5de9f2['interaction']['created']){if(_0x5de9f2[_0xe289('0x84')][_0xe289('0x94')]){_0x5de9f2[_0xe289('0x85')]['push']({'id':0x0,'priority':_0x5de9f2[_0xe289('0x85')][_0xe289('0x48')]+0x1,'app':'close','appdata':_0xe289('0x95'),'interval':_0xe289('0x96')});}}return db[_0xe289('0x97')][_0xe289('0x5c')]({'body':_0x3ed91b['body'][_0xe289('0x5d')],'OpenchannelAccountId':_0x3ed91b[_0xe289('0x58')]['id'],'OpenchannelInteractionId':_0x201061['id'],'direction':'in','ContactId':_0x5de9f2['contact']['id'],'AttachmentId':_0x3ed91b[_0xe289('0x5d')][_0xe289('0x98')]});})[_0xe289('0x36')](function(_0x55d609){_0x5de9f2['message']=_0x55d609;if(!_0x5de9f2['interaction'][_0xe289('0x99')])return;return db['User'][_0xe289('0x5b')]({'attributes':['id',_0xe289('0x3a')],'where':{'id':_0x5de9f2[_0xe289('0x92')][_0xe289('0x99')]}});})['then'](function(_0x16b603){if(_0x16b603){_0x5de9f2[_0xe289('0x85')][_0xe289('0x9a')]({'id':0x0,'priority':0x0,'app':_0xe289('0x9b'),'appdata':_0x16b603[_0xe289('0x3a')]+','+(_0x5de9f2[_0xe289('0x84')]['waitForTheAssignedAgent']||0xa),'interval':_0xe289('0x96')});}if(!_0x5de9f2[_0xe289('0x92')][_0xe289('0x9c')])return;return db[_0xe289('0x9d')][_0xe289('0x5b')]({'attributes':['id',_0xe289('0x3a')],'where':{'id':_0x5de9f2[_0xe289('0x92')]['queueId']}});})[_0xe289('0x36')](function(_0x4d8f8a){if(_0x4d8f8a){_0x5de9f2[_0xe289('0x85')][_0xe289('0x9a')]({'id':0x0,'priority':0x1,'app':_0xe289('0x9e'),'appdata':_0x4d8f8a['name']+','+(_0x5de9f2['account'][_0xe289('0x9f')]||0x12c),'interval':_0xe289('0x96')});}return respondWithRpcPromise(_0xe289('0xa0'),'startRouting',_0x5de9f2);})[_0xe289('0x36')](function(_0x44b7dc){respondWithRpcPromise(_0xe289('0xa1'),_0xe289('0xa1'),{'event':_0xe289('0x70'),'message':_0x44b7dc},client9002);return _0x44b7dc;})[_0xe289('0x36')](respondWithResult(_0x2e5bb8,null))[_0xe289('0x2a')](handleError(_0x2e5bb8,null));};exports[_0xe289('0xa2')]=function(_0x18521d,_0x4af4eb){var _0x507c29=_0x18521d[_0xe289('0x58')]['id'];var _0x13b85b=_0x18521d['body'];var _0x42e478=0xc8;var _0x358a8=null;return db[_0xe289('0xa3')][_0xe289('0xa4')]({'isolationLevel':db[_0xe289('0xa3')][_0xe289('0xa5')][_0xe289('0xa6')][_0xe289('0xa7')]},function(_0x49c8b2){return db[_0xe289('0x3e')][_0xe289('0x69')]({'where':{'id':_0x507c29},'transaction':_0x49c8b2})[_0xe289('0x36')](function(_0x4b37e8){if(_0x4b37e8){return db[_0xe289('0xa8')][_0xe289('0x39')]({'where':{'OpenchannelAccountId':_0x507c29},'transaction':_0x49c8b2})[_0xe289('0x36')](function(){var _0x59aafa=_['map'](_0x13b85b,function(_0x320c7c){_0x320c7c['OpenchannelAccountId']=_0x507c29;return _0x320c7c;});return db[_0xe289('0xa8')][_0xe289('0xa9')](_0x59aafa,{'transaction':_0x49c8b2});});}else{_0x42e478=0x194;_0x358a8=[];}});})[_0xe289('0x36')](function(){if(_0x42e478!==0x194){return db[_0xe289('0xa8')][_0xe289('0xaa')]({'where':{'OpenchannelAccountId':_0x507c29},'order':_0xe289('0xab')})[_0xe289('0x36')](function(_0x174af9){_0x358a8=_0x174af9;});}})[_0xe289('0x2a')](function(_0xfd3816){_0x42e478=0x1f4;logger[_0xe289('0x26')](_0xfd3816['stack']);if(_0xfd3816[_0xe289('0x3a')]){delete _0xfd3816['name'];}_0x358a8=_0xfd3816;})[_0xe289('0xac')](function(){if(_0x358a8===null){_0x4af4eb[_0xe289('0x2b')](_0x42e478);}else{if(_0x42e478===0x1f4){_0x4af4eb[_0xe289('0x2c')](_0x42e478)['send'](_0x358a8);}else{_0x4af4eb[_0xe289('0x2c')](_0x42e478)[_0xe289('0x2e')](_0x358a8);}}});};exports[_0xe289('0xad')]=function(_0x1896e8,_0x221b55,_0x632c67){var _0x417418={};var _0x323a6d={};var _0x4ee1e2;var _0x439961;return db[_0xe289('0x3e')][_0xe289('0x69')]({'where':{'id':_0x1896e8[_0xe289('0x58')]['id']}})[_0xe289('0x36')](handleEntityNotFound(_0x221b55,null))[_0xe289('0x36')](function(_0x7ee891){if(_0x7ee891){_0x4ee1e2=_0x7ee891;_0x323a6d['model']=_[_0xe289('0x42')](db[_0xe289('0xa8')][_0xe289('0x59')]);_0x323a6d[_0xe289('0x43')]=_[_0xe289('0x42')](_0x1896e8[_0xe289('0x43')]);_0x323a6d['filters']=_['intersection'](_0x323a6d[_0xe289('0x46')],_0x323a6d[_0xe289('0x43')]);_0x417418[_0xe289('0x45')]=_[_0xe289('0x44')](_0x323a6d[_0xe289('0x46')],qs[_0xe289('0x47')](_0x1896e8['query'][_0xe289('0x47')]));_0x417418[_0xe289('0x45')]=_0x417418[_0xe289('0x45')][_0xe289('0x48')]?_0x417418[_0xe289('0x45')]:_0x323a6d[_0xe289('0x46')];_0x417418[_0xe289('0x4b')]=qs[_0xe289('0x4c')](_0x1896e8[_0xe289('0x43')][_0xe289('0x4c')]);_0x417418[_0xe289('0x4d')]=qs['filters'](_['pick'](_0x1896e8[_0xe289('0x43')],_0x323a6d['filters']));if(_0x1896e8[_0xe289('0x43')][_0xe289('0x52')]){_0x417418[_0xe289('0x4d')]=_[_0xe289('0x50')](_0x417418[_0xe289('0x4d')],{'$or':_[_0xe289('0x3d')](_0x417418[_0xe289('0x45')],function(_0x44f021){var _0xb21745={};_0xb21745[_0x44f021]={'$like':'%'+_0x1896e8[_0xe289('0x43')][_0xe289('0x52')]+'%'};return _0xb21745;})});}_0x417418=_[_0xe289('0x50')]({},_0x417418,_0x1896e8[_0xe289('0x53')]);return _0x4ee1e2[_0xe289('0xad')](_0x417418);}})['then'](function(_0x1f8187){if(_0x1f8187){_0x439961=_0x1f8187[_0xe289('0x48')];if(!_0x1896e8['query'][_0xe289('0x49')](_0xe289('0x4a'))){_0x417418[_0xe289('0x31')]=qs[_0xe289('0x31')](_0x1896e8['query'][_0xe289('0x31')]);_0x417418['offset']=qs[_0xe289('0x2f')](_0x1896e8[_0xe289('0x43')][_0xe289('0x2f')]);}return _0x4ee1e2['getApplications'](_0x417418);}})[_0xe289('0x36')](function(_0x482b6d){if(_0x482b6d){return _0x482b6d?{'count':_0x439961,'rows':_0x482b6d}:null;}})['then'](respondWithResult(_0x221b55,null))[_0xe289('0x2a')](handleError(_0x221b55,null));};exports[_0xe289('0xae')]=function(_0x4b9b6d,_0x4e4cfa,_0x44351a){var _0x161a39={'raw':![],'where':{}};var _0x50de19={};var _0x3fe909={'count':0x0,'rows':[]};return db[_0xe289('0x3e')][_0xe289('0x69')]({'where':{'id':_0x4b9b6d[_0xe289('0x58')]['id']}})[_0xe289('0x36')](handleEntityNotFound(_0x4e4cfa,null))[_0xe289('0x36')](function(_0x1ba550){if(_0x1ba550){_0x50de19[_0xe289('0x46')]=_[_0xe289('0x42')](db[_0xe289('0x8d')][_0xe289('0x59')]);_0x50de19[_0xe289('0x43')]=_['keys'](_0x4b9b6d[_0xe289('0x43')]);_0x50de19['filters']=_['intersection'](_0x50de19['model'],_0x50de19[_0xe289('0x43')]);_0x161a39[_0xe289('0x45')]=_[_0xe289('0x44')](_0x50de19[_0xe289('0x46')],qs[_0xe289('0x47')](_0x4b9b6d[_0xe289('0x43')][_0xe289('0x47')]));_0x161a39[_0xe289('0x45')]=_0x161a39[_0xe289('0x45')]['length']?_0x161a39['attributes']:_0x50de19[_0xe289('0x46')];if(!_0x4b9b6d['query']['hasOwnProperty'](_0xe289('0x4a'))){_0x161a39[_0xe289('0x31')]=qs[_0xe289('0x31')](_0x4b9b6d[_0xe289('0x43')][_0xe289('0x31')]);_0x161a39['offset']=qs[_0xe289('0x2f')](_0x4b9b6d[_0xe289('0x43')][_0xe289('0x2f')]);}_0x161a39[_0xe289('0x4b')]=qs['sort'](_0x4b9b6d[_0xe289('0x43')][_0xe289('0x4c')]);_0x161a39['where']=qs[_0xe289('0x4e')](_[_0xe289('0x4f')](_0x4b9b6d[_0xe289('0x43')],_0x50de19['filters']));_0x161a39[_0xe289('0x4d')][_0xe289('0x66')]=_0x1ba550['id'];if(_0x4b9b6d[_0xe289('0x43')][_0xe289('0x52')]){_0x161a39[_0xe289('0x4d')]=_[_0xe289('0x50')](_0x161a39[_0xe289('0x4d')],{'$or':_['map'](_0x161a39[_0xe289('0x45')],function(_0x372603){var _0x53a50b={};_0x53a50b[_0x372603]={'$like':'%'+_0x4b9b6d[_0xe289('0x43')][_0xe289('0x52')]+'%'};return _0x53a50b;})});}_0x161a39=_[_0xe289('0x50')]({},_0x161a39,_0x4b9b6d[_0xe289('0x53')]);return db[_0xe289('0x8d')][_0xe289('0x32')]({'where':_0x161a39[_0xe289('0x4d')]})['then'](function(_0x1be70d){_0x3fe909[_0xe289('0x32')]=_0x1be70d;if(_0x4b9b6d[_0xe289('0x43')]['includeAll']){_0x161a39[_0xe289('0x5a')]=[{'model':db[_0xe289('0x72')],'as':_0xe289('0xaf'),'required':![]},{'model':db[_0xe289('0xb0')],'as':_0xe289('0xb1'),'attributes':[_0xe289('0x3a'),_0xe289('0xb2'),_0xe289('0xb3')],'required':![]},{'model':db[_0xe289('0xb4')],'as':_0xe289('0xb5'),'attributes':['id',_0xe289('0x3a'),_0xe289('0xb6')],'where':_0x4b9b6d[_0xe289('0x43')][_0xe289('0xb7')]?{'id':_0x4b9b6d[_0xe289('0x43')][_0xe289('0xb7')]}:undefined,'required':_0x4b9b6d[_0xe289('0x43')][_0xe289('0xb7')]?!![]:![]}];}return db['OpenchannelInteraction'][_0xe289('0x55')](_0x161a39);})[_0xe289('0x36')](function(_0x21d16e){_0x3fe909['rows']=_0x21d16e;return _0x3fe909;});}})[_0xe289('0x36')](respondWithFilteredResult(_0x4e4cfa,_0x161a39))[_0xe289('0x2a')](handleError(_0x4e4cfa,null));};exports[_0xe289('0xb8')]=function(_0x6173e2,_0x2c0b92,_0x18fe49){return db[_0xe289('0x3e')][_0xe289('0x5b')]({'where':{'id':_0x6173e2[_0xe289('0x58')]['id']}})[_0xe289('0x36')](handleEntityNotFound(_0x2c0b92,null))[_0xe289('0x36')](function(_0x44e86d){if(_0x44e86d){return _0x44e86d[_0xe289('0xb8')](_0x6173e2[_0xe289('0x5d')][_0xe289('0x6f')],_[_0xe289('0xb9')](_0x6173e2[_0xe289('0x5d')],[_0xe289('0x6f'),'id'])||{})[_0xe289('0x90')](function(_0x7026c9){for(var _0x573f68=0x0;_0x573f68<_0x6173e2[_0xe289('0x5d')]['ids'][_0xe289('0x48')];_0x573f68+=0x1){socket[_0xe289('0xba')](_0xe289('0xbb'),{'UserId':Number(_0x6173e2[_0xe289('0x5d')][_0xe289('0x6f')][_0x573f68]),'OpenchannelAccountId':Number(_0x6173e2[_0xe289('0x58')]['id'])});}return _0x7026c9;});}})['then'](respondWithResult(_0x2c0b92,null))['catch'](handleError(_0x2c0b92,null));};exports['removeAgents']=function(_0x103fa3,_0x151c17,_0x1a6e3f){return db[_0xe289('0x3e')][_0xe289('0x5b')]({'where':{'id':_0x103fa3[_0xe289('0x58')]['id']}})[_0xe289('0x36')](handleEntityNotFound(_0x151c17,null))['then'](function(_0x2fd023){if(_0x2fd023){return _0x2fd023[_0xe289('0xbc')](_0x103fa3[_0xe289('0x43')][_0xe289('0x6f')])[_0xe289('0x36')](function(){if(_['isArray'](_0x103fa3[_0xe289('0x43')][_0xe289('0x6f')])){for(var _0x20ac8d=0x0;_0x20ac8d<_0x103fa3[_0xe289('0x43')][_0xe289('0x6f')][_0xe289('0x48')];_0x20ac8d+=0x1){socket[_0xe289('0xba')](_0xe289('0xbd'),{'UserId':Number(_0x103fa3[_0xe289('0x43')][_0xe289('0x6f')][_0x20ac8d]),'OpenchannelAccountId':Number(_0x103fa3[_0xe289('0x58')]['id'])});}}else{socket[_0xe289('0xba')]('userOpenchannelAccount:remove',{'UserId':Number(_0x103fa3[_0xe289('0x43')][_0xe289('0x6f')]),'OpenchannelAccountId':Number(_0x103fa3[_0xe289('0x58')]['id'])});}});}})[_0xe289('0x36')](respondWithStatusCode(_0x151c17,null))[_0xe289('0x2a')](handleError(_0x151c17,null));};exports[_0xe289('0xbe')]=function(_0x491aa1,_0x1f9f49,_0xa543b0){var _0x55debb={};var _0x3a7016={};var _0x413672;var _0x52c48e;return db[_0xe289('0x3e')][_0xe289('0x69')]({'where':{'id':_0x491aa1['params']['id']}})[_0xe289('0x36')](handleEntityNotFound(_0x1f9f49,null))['then'](function(_0x14ef7c){if(_0x14ef7c){_0x413672=_0x14ef7c;_0x3a7016[_0xe289('0x46')]=_[_0xe289('0x42')](db[_0xe289('0xb0')][_0xe289('0x59')]);_0x3a7016['query']=_[_0xe289('0x42')](_0x491aa1[_0xe289('0x43')]);_0x3a7016[_0xe289('0x4e')]=_[_0xe289('0x44')](_0x3a7016[_0xe289('0x46')],_0x3a7016[_0xe289('0x43')]);_0x55debb['attributes']=_['intersection'](_0x3a7016['model'],qs[_0xe289('0x47')](_0x491aa1['query'][_0xe289('0x47')]));_0x55debb[_0xe289('0x45')]=_0x55debb[_0xe289('0x45')][_0xe289('0x48')]?_0x55debb[_0xe289('0x45')]:_0x3a7016[_0xe289('0x46')];_0x55debb[_0xe289('0x4b')]=qs['sort'](_0x491aa1[_0xe289('0x43')]['sort']);_0x55debb[_0xe289('0x4d')]=qs[_0xe289('0x4e')](_['pick'](_0x491aa1[_0xe289('0x43')],_0x3a7016[_0xe289('0x4e')]));if(_0x491aa1[_0xe289('0x43')][_0xe289('0x52')]){_0x55debb[_0xe289('0x4d')]=_[_0xe289('0x50')](_0x55debb[_0xe289('0x4d')],{'$or':_[_0xe289('0x3d')](_0x55debb[_0xe289('0x45')],function(_0x23e649){var _0xc3aa49={};_0xc3aa49[_0x23e649]={'$like':'%'+_0x491aa1[_0xe289('0x43')]['filter']+'%'};return _0xc3aa49;})});}_0x55debb=_[_0xe289('0x50')]({},_0x55debb,_0x491aa1[_0xe289('0x53')]);return _0x413672['getAgents'](_0x55debb);}})[_0xe289('0x36')](function(_0x227a33){if(_0x227a33){_0x52c48e=_0x227a33[_0xe289('0x48')];if(!_0x491aa1[_0xe289('0x43')][_0xe289('0x49')]('nolimit')){_0x55debb[_0xe289('0x31')]=qs[_0xe289('0x31')](_0x491aa1[_0xe289('0x43')][_0xe289('0x31')]);_0x55debb['offset']=qs['offset'](_0x491aa1['query'][_0xe289('0x2f')]);}return _0x413672[_0xe289('0xbe')](_0x55debb);}})[_0xe289('0x36')](function(_0x261619){if(_0x261619){return _0x261619?{'count':_0x52c48e,'rows':_0x261619}:null;}})['then'](respondWithResult(_0x1f9f49,null))['catch'](handleError(_0x1f9f49,null));};exports[_0xe289('0xbf')]=function(_0x1c47e8,_0x341153,_0x54b04f){var _0x51acc2,_0xe05e30,_0x3bf1de;if(_[_0xe289('0x7a')](_0x1c47e8[_0xe289('0x5d')]['body'])||_0x1c47e8['body'][_0xe289('0x5d')]===''){throw new db[(_0xe289('0x73'))][(_0xe289('0x74'))](_0xe289('0x7d'));}if(_[_0xe289('0x7a')](_0x1c47e8['body']['to'])){}_0x51acc2=_0x1c47e8[_0xe289('0x5d')]['to'];return db[_0xe289('0x3e')][_0xe289('0x69')]({'where':{'id':_0x1c47e8[_0xe289('0x58')]['id']}})[_0xe289('0x36')](handleEntityNotFound(_0x341153,null))['then'](function(_0x4bbd5d){if(_0x4bbd5d){return db[_0xe289('0x3e')][_0xe289('0x5b')]({'where':{'id':_0x4bbd5d['id']},'include':[{'model':db[_0xe289('0xc0')],'as':_0xe289('0x80'),'include':[{'model':db[_0xe289('0x72')],'as':'Contacts','where':{[_0x4bbd5d[_0xe289('0x7e')]]:_0x51acc2},'limit':0x1,'order':[['updatedAt','DESC']]}]}]})[_0xe289('0x36')](handleEntityNotFound(_0x341153,null))[_0xe289('0x36')](function(_0x2d881b){if(_0x2d881b&&_0x2d881b[_0xe289('0x80')]){_0xe05e30=_0x2d881b['get']({'plain':!![]});if(_0xe05e30[_0xe289('0x80')]&&_0xe05e30[_0xe289('0x80')][_0xe289('0x81')][_0xe289('0x48')]){return _0xe05e30[_0xe289('0x80')][_0xe289('0x81')][0x0];}return db[_0xe289('0x72')][_0xe289('0x5c')](_[_0xe289('0x19')](_0x1c47e8[_0xe289('0x5d')],{'firstName':_0x51acc2,[_0x2d881b[_0xe289('0x7e')]]:_0x51acc2,'phone':_0x51acc2,'ListId':_0xe05e30['ListId']}));}})['then'](handleEntityNotFound(_0x341153,null))[_0xe289('0x36')](function(_0x5b418c){if(_0x5b418c){_0x3bf1de=_0x5b418c;return db[_0xe289('0x8d')]['find']({'where':{'ContactId':_0x3bf1de['id'],'closed':![],'OpenchannelAccountId':_0xe05e30['id']}})['then'](function(_0x4eb24c){if(_0x4eb24c){return[_0x4eb24c,![]];}return db['OpenchannelInteraction'][_0xe289('0x5c')]({'UserId':_0x1c47e8[_0xe289('0x5e')]['id'],'ContactId':_0x3bf1de['id'],'OpenchannelAccountId':_0xe05e30['id'],'lastMsgDirection':_0xe289('0xc1'),'firstMsgDirection':_0xe289('0xc1'),'Messages':[_[_0xe289('0x50')](_0x1c47e8['body'],{'read':![],'body':_0x1c47e8[_0xe289('0x5d')][_0xe289('0x5d')],'OpenchannelAccountId':_0xe05e30['id'],'UserId':_0x1c47e8[_0xe289('0x5e')]['id'],'ContactId':_0x3bf1de['id']})]},{'include':[{'model':db['OpenchannelMessage'],'as':'Messages'}]})[_0xe289('0x36')](function(_0x10fa4f){return[_0x10fa4f,!![]];});});}})['spread'](function(_0x1bf932,_0x16e1a7){if(_0x16e1a7){return _0x1bf932;}return db[_0xe289('0x97')][_0xe289('0x5c')](_[_0xe289('0x50')](_0x1c47e8[_0xe289('0x5d')],{'read':![],'body':_0x1c47e8[_0xe289('0x5d')][_0xe289('0x5d')],'OpenchannelAccountId':_0xe05e30['id'],'OpenchannelInteractionId':_0x1bf932['id'],'UserId':_0x1c47e8[_0xe289('0x5e')]['id'],'ContactId':_0x3bf1de['id']}))[_0xe289('0x36')](function(_0x4047c9){_0x1bf932[_0xe289('0xc2')]['Messages']=[];_0x1bf932[_0xe289('0xc2')][_0xe289('0xc3')][_0xe289('0xc4')](_0x4047c9['dataValues']);return _0x1bf932;});});}})['then'](respondWithResult(_0x341153,null))[_0xe289('0x2a')](handleError(_0x341153,null));}; \ No newline at end of file +var _0x047e=['getDispositions','findOne','filter','rows','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','findAll','removeAnswers','notify','openchannel','Sequelize','ValidationError','no\x20available\x20attributes','createdAt','updatedAt','difference','ListId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','CmContact','Contacts','DESC','OpenchannelApplication','Applications','account','applications','orderBy','priority','asc','List','contact','lastName','threadId','OpenchannelInteraction','externalUrl','ContactId','spread','messageId','interaction','created','push','close','unmanaged','AttachmentId','UserId','unshift','*,*,*,*','queueId','OpenchannelQueue','queue','waitForTheAssignedQueue','startRouting','EventManager','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','findAndCountAll','finally','send','getApplications','getInteractions','Contact','Owner','fullname','internal','Tag','tag','addAgents','emit','userOpenchannelAccount:save','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','User','out','OpenchannelMessage','Messages','dataValues','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','./openchannelAccount.socket','register','jayson/promise','http','client','then','info','request\x20sent','debug','stringify','error','code','OpenchannelAccount,\x20%s,\x20%s','message','result','catch','status','end','json','offset','undefined','limit','count','set','reject','save','get','OpenchannelAccounts','UserProfileResource','destroy','sendStatus','stack','name','index','mandatoryDispositionPause','OpenchannelAccount','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','includeAll','include','show','params','Pause','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','describe','addDisposition','OpenchannelAccountId','Disposition'];(function(_0x5404e5,_0x6c7366){var _0x2f6f67=function(_0x4a22b3){while(--_0x4a22b3){_0x5404e5['push'](_0x5404e5['shift']());}};_0x2f6f67(++_0x6c7366);}(_0x047e,0x121));var _0xe047=function(_0x5b6fd2,_0x5830cb){_0x5b6fd2=_0x5b6fd2-0x0;var _0x450877=_0x047e[_0x5b6fd2];return _0x450877;};'use strict';var emlformat=require(_0xe047('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe047('0x1'));var jsonpatch=require(_0xe047('0x2'));var rp=require(_0xe047('0x3'));var moment=require(_0xe047('0x4'));var BPromise=require(_0xe047('0x5'));var Mustache=require('mustache');var util=require(_0xe047('0x6'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xe047('0x7'));var fs=require('fs');var fs_extra=require(_0xe047('0x8'));var _=require('lodash');var squel=require(_0xe047('0x9'));var crypto=require(_0xe047('0xa'));var jsforce=require(_0xe047('0xb'));var deskjs=require(_0xe047('0xc'));var toCsv=require(_0xe047('0xd'));var querystring=require(_0xe047('0xe'));var Papa=require(_0xe047('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xe047('0x10'));var hardwareService=require(_0xe047('0x11'));var logger=require(_0xe047('0x12'))(_0xe047('0x13'));var utils=require(_0xe047('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xe047('0x15'));var db=require(_0xe047('0x16'))['db'];config[_0xe047('0x17')]=_[_0xe047('0x18')](config['redis'],{'host':_0xe047('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe047('0x17')]));require(_0xe047('0x1a'))[_0xe047('0x1b')](socket);var jayson=require(_0xe047('0x1c'));var client=jayson['client'][_0xe047('0x1d')]({'port':0x232c});var client9002=jayson[_0xe047('0x1e')][_0xe047('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x198dfe,_0x519a87,_0x629b7,_0x20d24f){return new BPromise(function(_0x310440,_0x5e3e76){var _0x47da67=_0x20d24f||client;return _0x47da67['request'](_0x198dfe,_0x629b7)[_0xe047('0x1f')](function(_0x5c8448){logger[_0xe047('0x20')]('OpenchannelAccount,\x20%s,\x20%s',_0x519a87,_0xe047('0x21'));logger[_0xe047('0x22')]('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x519a87,_0xe047('0x21'),JSON[_0xe047('0x23')](_0x5c8448));if(_0x5c8448[_0xe047('0x24')]){if(_0x5c8448[_0xe047('0x24')][_0xe047('0x25')]===0x1f4){logger[_0xe047('0x24')](_0xe047('0x26'),_0x519a87,_0x5c8448[_0xe047('0x24')][_0xe047('0x27')]);return _0x5e3e76(_0x5c8448[_0xe047('0x24')]['message']);}logger['error'](_0xe047('0x26'),_0x519a87,_0x5c8448[_0xe047('0x24')][_0xe047('0x27')]);return _0x310440(_0x5c8448['error']['message']);}else{logger[_0xe047('0x20')](_0xe047('0x26'),_0x519a87,_0xe047('0x21'));_0x310440(_0x5c8448[_0xe047('0x28')][_0xe047('0x27')]);}})[_0xe047('0x29')](function(_0x3c0919){logger['error']('OpenchannelAccount,\x20%s,\x20%s',_0x519a87,_0x3c0919);_0x5e3e76(_0x3c0919);});});}function respondWithStatusCode(_0x20007f,_0x3f4aa4){_0x3f4aa4=_0x3f4aa4||0xcc;return function(_0x490ca0){if(_0x490ca0){return _0x20007f['sendStatus'](_0x3f4aa4);}return _0x20007f[_0xe047('0x2a')](_0x3f4aa4)[_0xe047('0x2b')]();};}function respondWithResult(_0x109934,_0x4a2896){_0x4a2896=_0x4a2896||0xc8;return function(_0x23cdba){if(_0x23cdba){return _0x109934[_0xe047('0x2a')](_0x4a2896)[_0xe047('0x2c')](_0x23cdba);}};}function respondWithFilteredResult(_0x5c2c36,_0x4d057d){return function(_0x5e71d5){if(_0x5e71d5){var _0x3a21d5=typeof _0x4d057d[_0xe047('0x2d')]===_0xe047('0x2e')&&typeof _0x4d057d[_0xe047('0x2f')]===_0xe047('0x2e');var _0x3ce6c7=_0x5e71d5[_0xe047('0x30')];var _0x346cc5=_0x3a21d5?0x0:_0x4d057d[_0xe047('0x2d')];var _0x779c=_0x3a21d5?_0x5e71d5['count']:_0x4d057d[_0xe047('0x2d')]+_0x4d057d[_0xe047('0x2f')];var _0x5e96ff;if(_0x779c>=_0x3ce6c7){_0x779c=_0x3ce6c7;_0x5e96ff=0xc8;}else{_0x5e96ff=0xce;}_0x5c2c36[_0xe047('0x2a')](_0x5e96ff);return _0x5c2c36[_0xe047('0x31')]('Content-Range',_0x346cc5+'-'+_0x779c+'/'+_0x3ce6c7)[_0xe047('0x2c')](_0x5e71d5);}return null;};}function patchUpdates(_0x5bbd5b){return function(_0x445e1f){try{jsonpatch['apply'](_0x445e1f,_0x5bbd5b,!![]);}catch(_0x4b7298){return BPromise[_0xe047('0x32')](_0x4b7298);}return _0x445e1f[_0xe047('0x33')]();};}function saveUpdates(_0xe0359d,_0xee8e87){return function(_0x49406f){if(_0x49406f){return _0x49406f['update'](_0xe0359d)[_0xe047('0x1f')](function(_0x4e0f85){return _0x4e0f85;});}return null;};}function removeEntity(_0x50bf7c,_0x5af6ca){return function(_0x34eaa2){if(_0x34eaa2){return _0x34eaa2['destroy']()[_0xe047('0x1f')](function(){var _0x4da094=_0x34eaa2[_0xe047('0x34')]({'plain':!![]});var _0x30979b=_0xe047('0x35');return db[_0xe047('0x36')][_0xe047('0x37')]({'where':{'type':_0x30979b,'resourceId':_0x4da094['id']}})[_0xe047('0x1f')](function(){return _0x34eaa2;});})[_0xe047('0x1f')](function(){_0x50bf7c[_0xe047('0x2a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5a70fa,_0x2c526a){return function(_0x403aa8){if(!_0x403aa8){_0x5a70fa[_0xe047('0x38')](0x194);}return _0x403aa8;};}function handleError(_0x52d35f,_0x3d6fdd){_0x3d6fdd=_0x3d6fdd||0x1f4;return function(_0x464653){logger[_0xe047('0x24')](_0x464653[_0xe047('0x39')]);if(_0x464653[_0xe047('0x3a')]){delete _0x464653['name'];}_0x52d35f[_0xe047('0x2a')](_0x3d6fdd)['send'](_0x464653);};}exports[_0xe047('0x3b')]=function(_0x562dae,_0x51ea84){var _0xb09c54={'include':[{'model':db['Pause'],'as':_0xe047('0x3c')}]},_0x5d608e={},_0x4ba517={'count':0x0,'rows':[]};var _0x38e7ff=_['map'](db[_0xe047('0x3d')][_0xe047('0x3e')],function(_0xf5bb08){return{'name':_0xf5bb08[_0xe047('0x3f')],'type':_0xf5bb08[_0xe047('0x40')][_0xe047('0x41')]};});_0x5d608e[_0xe047('0x42')]=_[_0xe047('0x43')](_0x38e7ff,_0xe047('0x3a'));_0x5d608e[_0xe047('0x44')]=_[_0xe047('0x45')](_0x562dae[_0xe047('0x44')]);_0x5d608e[_0xe047('0x46')]=_[_0xe047('0x47')](_0x5d608e[_0xe047('0x42')],_0x5d608e[_0xe047('0x44')]);_0xb09c54[_0xe047('0x48')]=_[_0xe047('0x47')](_0x5d608e['model'],qs[_0xe047('0x49')](_0x562dae[_0xe047('0x44')][_0xe047('0x49')]));_0xb09c54[_0xe047('0x48')]=_0xb09c54['attributes'][_0xe047('0x4a')]?_0xb09c54['attributes']:_0x5d608e[_0xe047('0x42')];if(!_0x562dae[_0xe047('0x44')][_0xe047('0x4b')](_0xe047('0x4c'))){_0xb09c54[_0xe047('0x2f')]=qs[_0xe047('0x2f')](_0x562dae[_0xe047('0x44')][_0xe047('0x2f')]);_0xb09c54[_0xe047('0x2d')]=qs[_0xe047('0x2d')](_0x562dae[_0xe047('0x44')]['offset']);}_0xb09c54[_0xe047('0x4d')]=qs[_0xe047('0x4e')](_0x562dae['query']['sort']);_0xb09c54[_0xe047('0x4f')]=qs['filters'](_[_0xe047('0x50')](_0x562dae[_0xe047('0x44')],_0x5d608e[_0xe047('0x46')]),_0x38e7ff);if(_0x562dae[_0xe047('0x44')]['filter']){_0xb09c54['where']=_[_0xe047('0x51')](_0xb09c54['where'],{'$or':_[_0xe047('0x43')](_0x38e7ff,function(_0x436efe){if(_0x436efe[_0xe047('0x40')]!==_0xe047('0x52')){var _0x53ad73={};_0x53ad73[_0x436efe[_0xe047('0x3a')]]={'$like':'%'+_0x562dae[_0xe047('0x44')]['filter']+'%'};return _0x53ad73;}})});}_0xb09c54=_[_0xe047('0x51')]({},_0xb09c54,_0x562dae['options']);var _0xe898ed={'where':_0xb09c54[_0xe047('0x4f')]};return db[_0xe047('0x3d')]['count'](_0xe898ed)['then'](function(_0x18ee90){_0x4ba517[_0xe047('0x30')]=_0x18ee90;if(_0x562dae['query'][_0xe047('0x53')]){_0xb09c54[_0xe047('0x54')]=[{'all':!![]}];}return db[_0xe047('0x3d')]['findAll'](_0xb09c54);})[_0xe047('0x1f')](function(_0x11b18a){_0x4ba517['rows']=_0x11b18a;return _0x4ba517;})['then'](respondWithFilteredResult(_0x51ea84,_0xb09c54))['catch'](handleError(_0x51ea84,null));};exports[_0xe047('0x55')]=function(_0x23bb4c,_0x3f47f2){var _0x27a090={'raw':![],'where':{'id':_0x23bb4c[_0xe047('0x56')]['id']},'include':[{'model':db[_0xe047('0x57')],'as':_0xe047('0x3c')}]},_0x2d3afe={};_0x2d3afe[_0xe047('0x42')]=_[_0xe047('0x45')](db['OpenchannelAccount'][_0xe047('0x3e')]);_0x2d3afe[_0xe047('0x44')]=_[_0xe047('0x45')](_0x23bb4c['query']);_0x2d3afe['filters']=_['intersection'](_0x2d3afe[_0xe047('0x42')],_0x2d3afe[_0xe047('0x44')]);_0x27a090['attributes']=_[_0xe047('0x47')](_0x2d3afe['model'],qs[_0xe047('0x49')](_0x23bb4c[_0xe047('0x44')]['fields']));_0x27a090[_0xe047('0x48')]=_0x27a090[_0xe047('0x48')][_0xe047('0x4a')]?_0x27a090[_0xe047('0x48')]:_0x2d3afe[_0xe047('0x42')];if(_0x23bb4c[_0xe047('0x44')][_0xe047('0x53')]){_0x27a090[_0xe047('0x54')]=[{'all':!![]}];}_0x27a090=_['merge']({},_0x27a090,_0x23bb4c[_0xe047('0x58')]);return db['OpenchannelAccount'][_0xe047('0x59')](_0x27a090)[_0xe047('0x1f')](handleEntityNotFound(_0x3f47f2,null))[_0xe047('0x1f')](respondWithResult(_0x3f47f2,null))['catch'](handleError(_0x3f47f2,null));};exports[_0xe047('0x5a')]=function(_0x5c6e63,_0x19f0e9){return db['OpenchannelAccount']['create'](_0x5c6e63['body'],{})[_0xe047('0x1f')](function(_0x1187c7){var _0x3a33d6=_0x5c6e63[_0xe047('0x5b')][_0xe047('0x34')]({'plain':!![]});if(!_0x3a33d6)throw new Error(_0xe047('0x5c'));if(_0x3a33d6['role']===_0xe047('0x5b')){var _0x383ab5=_0x1187c7[_0xe047('0x34')]({'plain':!![]});var _0x270b8e=_0xe047('0x35');return db[_0xe047('0x5d')][_0xe047('0x59')]({'where':{'name':_0x270b8e,'userProfileId':_0x3a33d6[_0xe047('0x5e')]},'raw':!![]})[_0xe047('0x1f')](function(_0x2b1243){if(_0x2b1243&&_0x2b1243[_0xe047('0x5f')]===0x0){return db[_0xe047('0x36')][_0xe047('0x5a')]({'name':_0x383ab5[_0xe047('0x3a')],'resourceId':_0x383ab5['id'],'type':_0x2b1243[_0xe047('0x3a')],'sectionId':_0x2b1243['id']},{})[_0xe047('0x1f')](function(){return _0x1187c7;});}else{return _0x1187c7;}})[_0xe047('0x29')](function(_0x12b8d8){logger[_0xe047('0x24')](_0xe047('0x60'),_0x12b8d8);throw _0x12b8d8;});}return _0x1187c7;})[_0xe047('0x1f')](respondWithResult(_0x19f0e9,0xc9))[_0xe047('0x29')](handleError(_0x19f0e9,null));};exports[_0xe047('0x61')]=function(_0x4aad61,_0x188d3f){if(_0x4aad61['body']['id']){delete _0x4aad61[_0xe047('0x62')]['id'];}return db[_0xe047('0x3d')][_0xe047('0x59')]({'where':{'id':_0x4aad61[_0xe047('0x56')]['id']},'include':[{'model':db[_0xe047('0x57')],'as':'mandatoryDispositionPause'}]})[_0xe047('0x1f')](handleEntityNotFound(_0x188d3f,null))[_0xe047('0x1f')](saveUpdates(_0x4aad61['body'],null))[_0xe047('0x1f')](respondWithResult(_0x188d3f,null))[_0xe047('0x29')](handleError(_0x188d3f,null));};exports[_0xe047('0x37')]=function(_0x53cb03,_0x353b45){return db[_0xe047('0x3d')][_0xe047('0x59')]({'where':{'id':_0x53cb03[_0xe047('0x56')]['id']}})[_0xe047('0x1f')](handleEntityNotFound(_0x353b45,null))['then'](removeEntity(_0x353b45,null))[_0xe047('0x29')](handleError(_0x353b45,null));};exports[_0xe047('0x63')]=function(_0x50b54d,_0x49ff01){return db[_0xe047('0x3d')][_0xe047('0x63')]()[_0xe047('0x1f')](respondWithResult(_0x49ff01,null))['catch'](handleError(_0x49ff01,null));};exports[_0xe047('0x64')]=function(_0x301d6d,_0x49d525,_0x29c30f){if(_0x301d6d[_0xe047('0x62')]['id']){delete _0x301d6d['body']['id'];}return db[_0xe047('0x3d')][_0xe047('0x59')]({'where':{'id':_0x301d6d[_0xe047('0x56')]['id']}})[_0xe047('0x1f')](handleEntityNotFound(_0x49d525,null))[_0xe047('0x1f')](function(_0xaa9ce1){if(_0xaa9ce1){_0x301d6d[_0xe047('0x62')][_0xe047('0x65')]=_0xaa9ce1['id'];return db[_0xe047('0x66')][_0xe047('0x5a')](_0x301d6d['body']);}})[_0xe047('0x1f')](respondWithResult(_0x49d525,null))[_0xe047('0x29')](handleError(_0x49d525,null));};exports[_0xe047('0x67')]=function(_0x550e41,_0x4352f0,_0x4917e){var _0x35bbf8={'raw':![],'where':{}};var _0x166c9c={};var _0x3f011a={'count':0x0,'rows':[]};return db[_0xe047('0x3d')][_0xe047('0x68')]({'where':{'id':_0x550e41[_0xe047('0x56')]['id']}})[_0xe047('0x1f')](handleEntityNotFound(_0x4352f0,null))[_0xe047('0x1f')](function(_0x2558ae){if(_0x2558ae){_0x166c9c[_0xe047('0x42')]=_[_0xe047('0x45')](db['Disposition'][_0xe047('0x3e')]);_0x166c9c['query']=_['keys'](_0x550e41['query']);_0x166c9c['filters']=_[_0xe047('0x47')](_0x166c9c[_0xe047('0x42')],_0x166c9c[_0xe047('0x44')]);_0x35bbf8[_0xe047('0x48')]=_[_0xe047('0x47')](_0x166c9c[_0xe047('0x42')],qs['fields'](_0x550e41['query'][_0xe047('0x49')]));_0x35bbf8[_0xe047('0x48')]=_0x35bbf8['attributes'][_0xe047('0x4a')]?_0x35bbf8[_0xe047('0x48')]:_0x166c9c['model'];if(!_0x550e41[_0xe047('0x44')][_0xe047('0x4b')]('nolimit')){_0x35bbf8['limit']=qs[_0xe047('0x2f')](_0x550e41[_0xe047('0x44')][_0xe047('0x2f')]);_0x35bbf8[_0xe047('0x2d')]=qs[_0xe047('0x2d')](_0x550e41[_0xe047('0x44')][_0xe047('0x2d')]);}_0x35bbf8['order']=qs[_0xe047('0x4e')](_0x550e41[_0xe047('0x44')]['sort']);_0x35bbf8[_0xe047('0x4f')]=qs[_0xe047('0x46')](_[_0xe047('0x50')](_0x550e41[_0xe047('0x44')],_0x166c9c[_0xe047('0x46')]));_0x35bbf8[_0xe047('0x4f')][_0xe047('0x65')]=_0x2558ae['id'];if(_0x550e41[_0xe047('0x44')][_0xe047('0x69')]){_0x35bbf8['where']=_['merge'](_0x35bbf8[_0xe047('0x4f')],{'$or':_[_0xe047('0x43')](_0x35bbf8[_0xe047('0x48')],function(_0x12cc8f){var _0x4a5a7f={};_0x4a5a7f[_0x12cc8f]={'$like':'%'+_0x550e41[_0xe047('0x44')][_0xe047('0x69')]+'%'};return _0x4a5a7f;})});}_0x35bbf8=_[_0xe047('0x51')]({},_0x35bbf8,_0x550e41[_0xe047('0x58')]);return db[_0xe047('0x66')][_0xe047('0x30')]({'where':_0x35bbf8['where']})[_0xe047('0x1f')](function(_0x6dcc6b){_0x3f011a[_0xe047('0x30')]=_0x6dcc6b;if(_0x550e41[_0xe047('0x44')][_0xe047('0x53')]){_0x35bbf8[_0xe047('0x54')]=[{'all':!![]}];}return db[_0xe047('0x66')]['findAll'](_0x35bbf8);})['then'](function(_0x41c688){_0x3f011a[_0xe047('0x6a')]=_0x41c688;return _0x3f011a;});}})[_0xe047('0x1f')](respondWithFilteredResult(_0x4352f0,_0x35bbf8))[_0xe047('0x29')](handleError(_0x4352f0,null));};exports[_0xe047('0x6b')]=function(_0x3e9914,_0x31d99d,_0x5d90ad){return db['OpenchannelAccount'][_0xe047('0x59')]({'where':{'id':_0x3e9914[_0xe047('0x56')]['id']}})['then'](handleEntityNotFound(_0x31d99d,null))[_0xe047('0x1f')](function(_0x1ddf5b){if(_0x1ddf5b){return _0x1ddf5b[_0xe047('0x6b')](_0x3e9914[_0xe047('0x44')][_0xe047('0x6c')]);}})[_0xe047('0x1f')](respondWithStatusCode(_0x31d99d,null))['catch'](handleError(_0x31d99d,null));};exports[_0xe047('0x6d')]=function(_0x5bed6a,_0x4a4502,_0x376a3c){if(_0x5bed6a[_0xe047('0x62')]['id']){delete _0x5bed6a[_0xe047('0x62')]['id'];}return db[_0xe047('0x3d')]['find']({'where':{'id':_0x5bed6a[_0xe047('0x56')]['id']}})[_0xe047('0x1f')](handleEntityNotFound(_0x4a4502,null))[_0xe047('0x1f')](function(_0x5ab777){if(_0x5ab777){_0x5bed6a[_0xe047('0x62')][_0xe047('0x65')]=_0x5ab777['id'];return db[_0xe047('0x6e')][_0xe047('0x5a')](_0x5bed6a['body']);}})[_0xe047('0x1f')](respondWithResult(_0x4a4502,null))[_0xe047('0x29')](handleError(_0x4a4502,null));};exports[_0xe047('0x6f')]=function(_0x38dcb1,_0x30ff19,_0x300f90){var _0x270b1f={'raw':![],'where':{}};var _0x50db9a={};var _0x46a2ec={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0xe047('0x68')]({'where':{'id':_0x38dcb1['params']['id']}})[_0xe047('0x1f')](handleEntityNotFound(_0x30ff19,null))[_0xe047('0x1f')](function(_0x1f3c53){if(_0x1f3c53){_0x50db9a['model']=_['keys'](db[_0xe047('0x6e')]['rawAttributes']);_0x50db9a[_0xe047('0x44')]=_['keys'](_0x38dcb1[_0xe047('0x44')]);_0x50db9a[_0xe047('0x46')]=_[_0xe047('0x47')](_0x50db9a[_0xe047('0x42')],_0x50db9a['query']);_0x270b1f[_0xe047('0x48')]=_[_0xe047('0x47')](_0x50db9a[_0xe047('0x42')],qs['fields'](_0x38dcb1[_0xe047('0x44')][_0xe047('0x49')]));_0x270b1f[_0xe047('0x48')]=_0x270b1f[_0xe047('0x48')][_0xe047('0x4a')]?_0x270b1f[_0xe047('0x48')]:_0x50db9a[_0xe047('0x42')];if(!_0x38dcb1[_0xe047('0x44')]['hasOwnProperty'](_0xe047('0x4c'))){_0x270b1f[_0xe047('0x2f')]=qs[_0xe047('0x2f')](_0x38dcb1[_0xe047('0x44')][_0xe047('0x2f')]);_0x270b1f[_0xe047('0x2d')]=qs[_0xe047('0x2d')](_0x38dcb1[_0xe047('0x44')][_0xe047('0x2d')]);}_0x270b1f['order']=qs[_0xe047('0x4e')](_0x38dcb1[_0xe047('0x44')][_0xe047('0x4e')]);_0x270b1f[_0xe047('0x4f')]=qs[_0xe047('0x46')](_[_0xe047('0x50')](_0x38dcb1[_0xe047('0x44')],_0x50db9a[_0xe047('0x46')]));_0x270b1f[_0xe047('0x4f')][_0xe047('0x65')]=_0x1f3c53['id'];if(_0x38dcb1[_0xe047('0x44')][_0xe047('0x69')]){_0x270b1f[_0xe047('0x4f')]=_['merge'](_0x270b1f[_0xe047('0x4f')],{'$or':_[_0xe047('0x43')](_0x270b1f[_0xe047('0x48')],function(_0x2bfe51){var _0x252e81={};_0x252e81[_0x2bfe51]={'$like':'%'+_0x38dcb1[_0xe047('0x44')][_0xe047('0x69')]+'%'};return _0x252e81;})});}_0x270b1f=_['merge']({},_0x270b1f,_0x38dcb1[_0xe047('0x58')]);return db[_0xe047('0x6e')]['count']({'where':_0x270b1f[_0xe047('0x4f')]})['then'](function(_0x2772cd){_0x46a2ec[_0xe047('0x30')]=_0x2772cd;if(_0x38dcb1[_0xe047('0x44')][_0xe047('0x53')]){_0x270b1f[_0xe047('0x54')]=[{'all':!![]}];}return db[_0xe047('0x6e')][_0xe047('0x70')](_0x270b1f);})[_0xe047('0x1f')](function(_0x2692e1){_0x46a2ec[_0xe047('0x6a')]=_0x2692e1;return _0x46a2ec;});}})[_0xe047('0x1f')](respondWithFilteredResult(_0x30ff19,_0x270b1f))[_0xe047('0x29')](handleError(_0x30ff19,null));};exports[_0xe047('0x71')]=function(_0x72f0f4,_0x22d2db,_0x3a1bef){return db['OpenchannelAccount'][_0xe047('0x59')]({'where':{'id':_0x72f0f4[_0xe047('0x56')]['id']}})[_0xe047('0x1f')](handleEntityNotFound(_0x22d2db,null))[_0xe047('0x1f')](function(_0x186f09){if(_0x186f09){return _0x186f09[_0xe047('0x71')](_0x72f0f4[_0xe047('0x44')][_0xe047('0x6c')]);}})['then'](respondWithStatusCode(_0x22d2db,null))['catch'](handleError(_0x22d2db,null));};exports[_0xe047('0x72')]=function(_0x5f2758,_0x3345b7,_0x2b5f91){var _0x5cf4b2={'body':_0x5f2758[_0xe047('0x62')],'channel':_0xe047('0x73')};var _0x2caea8=[];var _0x30b5cb=[];var _0x5bad19={};var _0x2bcfed=![];return db['CmContact'][_0xe047('0x63')]()['then'](function(_0x5cee28){if(!_0x5cee28){throw new db[(_0xe047('0x74'))][(_0xe047('0x75'))](_0xe047('0x76'));}_0x2caea8=_['difference'](_['keys'](_0x5cee28),[_0xe047('0x77'),_0xe047('0x78')]);_0x30b5cb=_[_0xe047('0x79')](_[_0xe047('0x45')](_0x5cee28),[_0xe047('0x77'),'updatedAt','CompanyId',_0xe047('0x7a')]);if(_0x5f2758[_0xe047('0x62')]['id']){delete _0x5f2758[_0xe047('0x62')]['id'];}if(_[_0xe047('0x7b')](_0x5f2758['body'][_0xe047('0x7c')])){throw new db[(_0xe047('0x74'))][(_0xe047('0x75'))](_0xe047('0x7d'));}if(_[_0xe047('0x7b')](_0x5f2758[_0xe047('0x62')][_0xe047('0x62')])||_0x5f2758['body'][_0xe047('0x62')]===''){throw new db[(_0xe047('0x74'))][(_0xe047('0x75'))](_0xe047('0x7e'));}if(_['isNil'](_0x5f2758[_0xe047('0x62')][_0xe047('0x7f')])){throw new db[(_0xe047('0x74'))][(_0xe047('0x75'))](_0xe047('0x80')+_0x30b5cb);}if(!_[_0xe047('0x81')](_0x30b5cb,_0x5f2758['body'][_0xe047('0x7f')])){throw new db[(_0xe047('0x74'))][(_0xe047('0x75'))](_0xe047('0x82')+_0x30b5cb);}_0x5bad19[_0x5f2758[_0xe047('0x62')][_0xe047('0x7f')]]=_0x5f2758[_0xe047('0x62')][_0xe047('0x7c')];})[_0xe047('0x1f')](function(){return db[_0xe047('0x3d')][_0xe047('0x59')]({'where':{'id':_0x5f2758['params']['id']},'include':[{'model':db[_0xe047('0x83')],'as':'List','include':[{'model':db[_0xe047('0x84')],'as':_0xe047('0x85'),'where':_0x5bad19,'limit':0x1,'order':[['updatedAt',_0xe047('0x86')]]}]},{'model':db[_0xe047('0x87')],'as':_0xe047('0x88')}]});})[_0xe047('0x1f')](handleEntityNotFound(_0x3345b7,null))[_0xe047('0x1f')](function(_0x30e240){if(_0x30e240&&_0x30e240['List']){_0x5cf4b2[_0xe047('0x89')]=_0x30e240;_0x5cf4b2[_0xe047('0x8a')]=_0x30e240[_0xe047('0x88')];_0x5cf4b2['list']=_0x30e240['List'];_0x5cf4b2[_0xe047('0x8a')]=_[_0xe047('0x8b')](_0x5cf4b2[_0xe047('0x8a')],[_0xe047('0x8c')],[_0xe047('0x8d')]);if(_0x5cf4b2[_0xe047('0x89')][_0xe047('0x88')]){delete _0x5cf4b2['account']['Applications'];}if(_0x5cf4b2[_0xe047('0x89')][_0xe047('0x8e')]&&_0x5cf4b2[_0xe047('0x89')][_0xe047('0x8e')][_0xe047('0x85')]['length']){return _0x5cf4b2[_0xe047('0x89')][_0xe047('0x8e')]['Contacts'][0x0];}var _0x25cdc1=_[_0xe047('0x18')](_0x5f2758[_0xe047('0x62')],{'firstName':_0x5f2758[_0xe047('0x62')][_0xe047('0x7c')],'ListId':_0x30e240[_0xe047('0x7a')]});_0x25cdc1[_0x5f2758[_0xe047('0x62')][_0xe047('0x7f')]]=_0x5f2758[_0xe047('0x62')]['from'];return db['CmContact']['create'](_0x25cdc1,{'fields':_0x2caea8,'raw':!![]});}})[_0xe047('0x1f')](handleEntityNotFound(_0x3345b7,null))['then'](function(_0x74da26){_0x5cf4b2[_0xe047('0x8f')]=_0x74da26;if(_0x74da26){var _0x5e8512={'ContactId':_0x74da26['id'],'OpenchannelAccountId':_0x5f2758[_0xe047('0x56')]['id'],'from':(_0x74da26['firstName']||'')+'\x20'+(_0x74da26[_0xe047('0x90')]||'')};var _0x4c423b={'OpenchannelAccountId':_0x5f2758['params']['id'],'closed':![]};if(_0x5f2758[_0xe047('0x62')]['threadId']){_0x4c423b[_0xe047('0x91')]=_0x5f2758[_0xe047('0x62')][_0xe047('0x91')];return db[_0xe047('0x92')][_0xe047('0x59')]({'where':_0x4c423b})[_0xe047('0x1f')](function(_0x27fcad){if(_0x27fcad){return[_0x27fcad,![]];}_0x5e8512['threadId']=_0x5f2758[_0xe047('0x62')][_0xe047('0x91')];_0x5e8512[_0xe047('0x93')]=_0x5f2758[_0xe047('0x62')][_0xe047('0x93')];return db[_0xe047('0x92')][_0xe047('0x5a')](_0x5e8512)['then'](function(_0x38988d){return[_0x38988d,!![]];});});}else{_0x4c423b['threadId']=null;}_0x4c423b[_0xe047('0x94')]=_0x74da26['id'];return db[_0xe047('0x92')][_0xe047('0x59')]({'where':_0x4c423b})[_0xe047('0x1f')](function(_0x451789){if(_0x451789){return[_0x451789,![]];}return db[_0xe047('0x92')]['create'](_0x5e8512)['then'](function(_0xa9752){return[_0xa9752,!![]];});});}})[_0xe047('0x95')](function(_0x54094f,_0x107d26){if(_0x54094f){_0x2bcfed=_0x107d26;if(!_0x107d26){var _0x1c4412={'from':(_0x5cf4b2[_0xe047('0x8f')]['firstName']||'')+'\x20'+(_0x5cf4b2['contact'][_0xe047('0x90')]||'')};if(_0x5f2758[_0xe047('0x62')][_0xe047('0x91')]&&_0x5f2758['body'][_0xe047('0x96')]&&_0x5f2758[_0xe047('0x62')][_0xe047('0x91')]!=_0x5f2758[_0xe047('0x62')]['messageId']){_0x1c4412['threadId']=_0x5f2758[_0xe047('0x62')]['messageId'];}return _0x54094f['update'](_0x1c4412);}else{return _0x54094f;}}})[_0xe047('0x1f')](function(_0x4618f9){_0x5cf4b2[_0xe047('0x97')]=_0x4618f9[_0xe047('0x34')]({'plain':!![]});_0x5cf4b2['interaction'][_0xe047('0x98')]=_0x2bcfed;if(_0x5cf4b2['interaction'][_0xe047('0x98')]){if(_0x5cf4b2[_0xe047('0x89')]['autoclose']){_0x5cf4b2[_0xe047('0x8a')][_0xe047('0x99')]({'id':0x0,'priority':_0x5cf4b2[_0xe047('0x8a')][_0xe047('0x4a')]+0x1,'app':_0xe047('0x9a'),'appdata':_0xe047('0x9b'),'interval':'*,*,*,*'});}}return db['OpenchannelMessage'][_0xe047('0x5a')]({'body':_0x5f2758[_0xe047('0x62')][_0xe047('0x62')],'OpenchannelAccountId':_0x5f2758[_0xe047('0x56')]['id'],'OpenchannelInteractionId':_0x4618f9['id'],'direction':'in','ContactId':_0x5cf4b2[_0xe047('0x8f')]['id'],'AttachmentId':_0x5f2758[_0xe047('0x62')][_0xe047('0x9c')]});})[_0xe047('0x1f')](function(_0x4b72d1){_0x5cf4b2['message']=_0x4b72d1;if(!_0x5cf4b2[_0xe047('0x97')][_0xe047('0x9d')])return;return db['User'][_0xe047('0x59')]({'attributes':['id',_0xe047('0x3a')],'where':{'id':_0x5cf4b2['interaction'][_0xe047('0x9d')]}});})[_0xe047('0x1f')](function(_0x461582){if(_0x461582){_0x5cf4b2['applications'][_0xe047('0x9e')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x461582[_0xe047('0x3a')]+','+(_0x5cf4b2[_0xe047('0x89')]['waitForTheAssignedAgent']||0xa),'interval':_0xe047('0x9f')});}if(!_0x5cf4b2[_0xe047('0x97')][_0xe047('0xa0')])return;return db[_0xe047('0xa1')][_0xe047('0x59')]({'attributes':['id','name'],'where':{'id':_0x5cf4b2['interaction']['queueId']}});})['then'](function(_0x2b424e){if(_0x2b424e){_0x5cf4b2[_0xe047('0x8a')][_0xe047('0x9e')]({'id':0x0,'priority':0x1,'app':_0xe047('0xa2'),'appdata':_0x2b424e['name']+','+(_0x5cf4b2[_0xe047('0x89')][_0xe047('0xa3')]||0x12c),'interval':_0xe047('0x9f')});}return respondWithRpcPromise('Start',_0xe047('0xa4'),_0x5cf4b2);})['then'](function(_0x320057){respondWithRpcPromise(_0xe047('0xa5'),_0xe047('0xa5'),{'event':_0xe047('0x72'),'message':_0x320057},client9002);return _0x320057;})[_0xe047('0x1f')](respondWithResult(_0x3345b7,null))[_0xe047('0x29')](handleError(_0x3345b7,null));};exports[_0xe047('0xa6')]=function(_0x586f9d,_0x4818dd){var _0x21999a=_0x586f9d[_0xe047('0x56')]['id'];var _0x443697=_0x586f9d['body'];var _0x5a938e=0xc8;var _0x4952f0=null;return db[_0xe047('0xa7')][_0xe047('0xa8')]({'isolationLevel':db[_0xe047('0xa7')][_0xe047('0xa9')][_0xe047('0xaa')][_0xe047('0xab')]},function(_0x570c31){return db[_0xe047('0x3d')][_0xe047('0x68')]({'where':{'id':_0x21999a},'transaction':_0x570c31})[_0xe047('0x1f')](function(_0x36a5ae){if(_0x36a5ae){return db[_0xe047('0x87')]['destroy']({'where':{'OpenchannelAccountId':_0x21999a},'transaction':_0x570c31})[_0xe047('0x1f')](function(){var _0x31d794=_[_0xe047('0x43')](_0x443697,function(_0x58a986){_0x58a986[_0xe047('0x65')]=_0x21999a;return _0x58a986;});return db[_0xe047('0x87')][_0xe047('0xac')](_0x31d794,{'transaction':_0x570c31});});}else{_0x5a938e=0x194;_0x4952f0=[];}});})[_0xe047('0x1f')](function(){if(_0x5a938e!==0x194){return db[_0xe047('0x87')][_0xe047('0xad')]({'where':{'OpenchannelAccountId':_0x21999a},'order':_0xe047('0x8c')})['then'](function(_0x11fcdb){_0x4952f0=_0x11fcdb;});}})[_0xe047('0x29')](function(_0x59a182){_0x5a938e=0x1f4;logger[_0xe047('0x24')](_0x59a182[_0xe047('0x39')]);if(_0x59a182[_0xe047('0x3a')]){delete _0x59a182[_0xe047('0x3a')];}_0x4952f0=_0x59a182;})[_0xe047('0xae')](function(){if(_0x4952f0===null){_0x4818dd[_0xe047('0x38')](_0x5a938e);}else{if(_0x5a938e===0x1f4){_0x4818dd['status'](_0x5a938e)[_0xe047('0xaf')](_0x4952f0);}else{_0x4818dd['status'](_0x5a938e)['json'](_0x4952f0);}}});};exports[_0xe047('0xb0')]=function(_0x280e99,_0x308499,_0x59e471){var _0x50a152={};var _0x395ef9={};var _0x5260e1;var _0x3f6f4d;return db[_0xe047('0x3d')][_0xe047('0x68')]({'where':{'id':_0x280e99[_0xe047('0x56')]['id']}})[_0xe047('0x1f')](handleEntityNotFound(_0x308499,null))['then'](function(_0x1d7920){if(_0x1d7920){_0x5260e1=_0x1d7920;_0x395ef9[_0xe047('0x42')]=_[_0xe047('0x45')](db[_0xe047('0x87')]['rawAttributes']);_0x395ef9[_0xe047('0x44')]=_[_0xe047('0x45')](_0x280e99[_0xe047('0x44')]);_0x395ef9[_0xe047('0x46')]=_[_0xe047('0x47')](_0x395ef9[_0xe047('0x42')],_0x395ef9[_0xe047('0x44')]);_0x50a152['attributes']=_[_0xe047('0x47')](_0x395ef9['model'],qs[_0xe047('0x49')](_0x280e99[_0xe047('0x44')][_0xe047('0x49')]));_0x50a152['attributes']=_0x50a152[_0xe047('0x48')][_0xe047('0x4a')]?_0x50a152[_0xe047('0x48')]:_0x395ef9[_0xe047('0x42')];_0x50a152['order']=qs[_0xe047('0x4e')](_0x280e99[_0xe047('0x44')][_0xe047('0x4e')]);_0x50a152[_0xe047('0x4f')]=qs[_0xe047('0x46')](_['pick'](_0x280e99['query'],_0x395ef9['filters']));if(_0x280e99[_0xe047('0x44')][_0xe047('0x69')]){_0x50a152[_0xe047('0x4f')]=_[_0xe047('0x51')](_0x50a152[_0xe047('0x4f')],{'$or':_[_0xe047('0x43')](_0x50a152[_0xe047('0x48')],function(_0x2f8257){var _0x124fd2={};_0x124fd2[_0x2f8257]={'$like':'%'+_0x280e99[_0xe047('0x44')]['filter']+'%'};return _0x124fd2;})});}_0x50a152=_[_0xe047('0x51')]({},_0x50a152,_0x280e99[_0xe047('0x58')]);return _0x5260e1[_0xe047('0xb0')](_0x50a152);}})[_0xe047('0x1f')](function(_0x503749){if(_0x503749){_0x3f6f4d=_0x503749['length'];if(!_0x280e99[_0xe047('0x44')][_0xe047('0x4b')](_0xe047('0x4c'))){_0x50a152[_0xe047('0x2f')]=qs[_0xe047('0x2f')](_0x280e99[_0xe047('0x44')][_0xe047('0x2f')]);_0x50a152[_0xe047('0x2d')]=qs[_0xe047('0x2d')](_0x280e99[_0xe047('0x44')]['offset']);}return _0x5260e1[_0xe047('0xb0')](_0x50a152);}})[_0xe047('0x1f')](function(_0x3565ab){if(_0x3565ab){return _0x3565ab?{'count':_0x3f6f4d,'rows':_0x3565ab}:null;}})[_0xe047('0x1f')](respondWithResult(_0x308499,null))['catch'](handleError(_0x308499,null));};exports[_0xe047('0xb1')]=function(_0x49edac,_0x5bb22a,_0x8b09ba){var _0x5caf42={'raw':![],'where':{}};var _0x52cfc6={};var _0x274011={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0xe047('0x68')]({'where':{'id':_0x49edac['params']['id']}})[_0xe047('0x1f')](handleEntityNotFound(_0x5bb22a,null))[_0xe047('0x1f')](function(_0x649a85){if(_0x649a85){_0x52cfc6[_0xe047('0x42')]=_[_0xe047('0x45')](db['OpenchannelInteraction'][_0xe047('0x3e')]);_0x52cfc6['query']=_['keys'](_0x49edac[_0xe047('0x44')]);_0x52cfc6[_0xe047('0x46')]=_[_0xe047('0x47')](_0x52cfc6[_0xe047('0x42')],_0x52cfc6['query']);_0x5caf42['attributes']=_[_0xe047('0x47')](_0x52cfc6['model'],qs[_0xe047('0x49')](_0x49edac['query'][_0xe047('0x49')]));_0x5caf42['attributes']=_0x5caf42[_0xe047('0x48')][_0xe047('0x4a')]?_0x5caf42[_0xe047('0x48')]:_0x52cfc6[_0xe047('0x42')];if(!_0x49edac[_0xe047('0x44')][_0xe047('0x4b')](_0xe047('0x4c'))){_0x5caf42['limit']=qs[_0xe047('0x2f')](_0x49edac['query'][_0xe047('0x2f')]);_0x5caf42[_0xe047('0x2d')]=qs['offset'](_0x49edac[_0xe047('0x44')][_0xe047('0x2d')]);}_0x5caf42[_0xe047('0x4d')]=qs[_0xe047('0x4e')](_0x49edac[_0xe047('0x44')]['sort']);_0x5caf42['where']=qs[_0xe047('0x46')](_[_0xe047('0x50')](_0x49edac[_0xe047('0x44')],_0x52cfc6['filters']));_0x5caf42['where'][_0xe047('0x65')]=_0x649a85['id'];if(_0x49edac[_0xe047('0x44')]['filter']){_0x5caf42['where']=_['merge'](_0x5caf42[_0xe047('0x4f')],{'$or':_[_0xe047('0x43')](_0x5caf42[_0xe047('0x48')],function(_0x4a6dac){var _0x3bc44a={};_0x3bc44a[_0x4a6dac]={'$like':'%'+_0x49edac[_0xe047('0x44')][_0xe047('0x69')]+'%'};return _0x3bc44a;})});}_0x5caf42=_['merge']({},_0x5caf42,_0x49edac[_0xe047('0x58')]);return db['OpenchannelInteraction']['count']({'where':_0x5caf42[_0xe047('0x4f')]})[_0xe047('0x1f')](function(_0x23a602){_0x274011[_0xe047('0x30')]=_0x23a602;if(_0x49edac['query'][_0xe047('0x53')]){_0x5caf42[_0xe047('0x54')]=[{'model':db[_0xe047('0x84')],'as':_0xe047('0xb2'),'required':![]},{'model':db['User'],'as':_0xe047('0xb3'),'attributes':[_0xe047('0x3a'),_0xe047('0xb4'),_0xe047('0xb5')],'required':![]},{'model':db[_0xe047('0xb6')],'as':'Tags','attributes':['id','name','color'],'where':_0x49edac['query'][_0xe047('0xb7')]?{'id':_0x49edac[_0xe047('0x44')]['tag']}:undefined,'required':_0x49edac['query'][_0xe047('0xb7')]?!![]:![]}];}return db[_0xe047('0x92')][_0xe047('0x70')](_0x5caf42);})[_0xe047('0x1f')](function(_0x254dc9){_0x274011['rows']=_0x254dc9;return _0x274011;});}})[_0xe047('0x1f')](respondWithFilteredResult(_0x5bb22a,_0x5caf42))[_0xe047('0x29')](handleError(_0x5bb22a,null));};exports[_0xe047('0xb8')]=function(_0x4fca2f,_0x29129b,_0x5d4493){return db[_0xe047('0x3d')][_0xe047('0x59')]({'where':{'id':_0x4fca2f[_0xe047('0x56')]['id']}})['then'](handleEntityNotFound(_0x29129b,null))[_0xe047('0x1f')](function(_0x2008e3){if(_0x2008e3){return _0x2008e3[_0xe047('0xb8')](_0x4fca2f[_0xe047('0x62')][_0xe047('0x6c')],_['omit'](_0x4fca2f[_0xe047('0x62')],[_0xe047('0x6c'),'id'])||{})[_0xe047('0x95')](function(_0x181556){for(var _0x4a183a=0x0;_0x4a183a<_0x4fca2f['body'][_0xe047('0x6c')][_0xe047('0x4a')];_0x4a183a+=0x1){socket[_0xe047('0xb9')](_0xe047('0xba'),{'UserId':Number(_0x4fca2f[_0xe047('0x62')][_0xe047('0x6c')][_0x4a183a]),'OpenchannelAccountId':Number(_0x4fca2f[_0xe047('0x56')]['id'])});}return _0x181556;});}})['then'](respondWithResult(_0x29129b,null))[_0xe047('0x29')](handleError(_0x29129b,null));};exports[_0xe047('0xbb')]=function(_0x210632,_0x47117e,_0x3a401e){return db[_0xe047('0x3d')][_0xe047('0x59')]({'where':{'id':_0x210632[_0xe047('0x56')]['id']}})[_0xe047('0x1f')](handleEntityNotFound(_0x47117e,null))['then'](function(_0x10ee42){if(_0x10ee42){return _0x10ee42['removeAgents'](_0x210632[_0xe047('0x44')]['ids'])['then'](function(){if(_[_0xe047('0xbc')](_0x210632[_0xe047('0x44')][_0xe047('0x6c')])){for(var _0x4fbf84=0x0;_0x4fbf84<_0x210632[_0xe047('0x44')]['ids'][_0xe047('0x4a')];_0x4fbf84+=0x1){socket[_0xe047('0xb9')]('userOpenchannelAccount:remove',{'UserId':Number(_0x210632[_0xe047('0x44')][_0xe047('0x6c')][_0x4fbf84]),'OpenchannelAccountId':Number(_0x210632['params']['id'])});}}else{socket[_0xe047('0xb9')](_0xe047('0xbd'),{'UserId':Number(_0x210632[_0xe047('0x44')][_0xe047('0x6c')]),'OpenchannelAccountId':Number(_0x210632['params']['id'])});}});}})[_0xe047('0x1f')](respondWithStatusCode(_0x47117e,null))[_0xe047('0x29')](handleError(_0x47117e,null));};exports[_0xe047('0xbe')]=function(_0x4e3259,_0x26ff67,_0x4e29f8){var _0x473777={};var _0x1634a0={};var _0x21ce77;var _0x59317f;return db[_0xe047('0x3d')]['findOne']({'where':{'id':_0x4e3259[_0xe047('0x56')]['id']}})[_0xe047('0x1f')](handleEntityNotFound(_0x26ff67,null))[_0xe047('0x1f')](function(_0x4f5355){if(_0x4f5355){_0x21ce77=_0x4f5355;_0x1634a0[_0xe047('0x42')]=_[_0xe047('0x45')](db[_0xe047('0xbf')][_0xe047('0x3e')]);_0x1634a0[_0xe047('0x44')]=_[_0xe047('0x45')](_0x4e3259[_0xe047('0x44')]);_0x1634a0[_0xe047('0x46')]=_['intersection'](_0x1634a0['model'],_0x1634a0[_0xe047('0x44')]);_0x473777[_0xe047('0x48')]=_['intersection'](_0x1634a0[_0xe047('0x42')],qs['fields'](_0x4e3259[_0xe047('0x44')]['fields']));_0x473777[_0xe047('0x48')]=_0x473777[_0xe047('0x48')][_0xe047('0x4a')]?_0x473777['attributes']:_0x1634a0['model'];_0x473777[_0xe047('0x4d')]=qs[_0xe047('0x4e')](_0x4e3259[_0xe047('0x44')][_0xe047('0x4e')]);_0x473777[_0xe047('0x4f')]=qs[_0xe047('0x46')](_[_0xe047('0x50')](_0x4e3259[_0xe047('0x44')],_0x1634a0['filters']));if(_0x4e3259[_0xe047('0x44')]['filter']){_0x473777[_0xe047('0x4f')]=_[_0xe047('0x51')](_0x473777[_0xe047('0x4f')],{'$or':_['map'](_0x473777['attributes'],function(_0x4cb7af){var _0x577024={};_0x577024[_0x4cb7af]={'$like':'%'+_0x4e3259[_0xe047('0x44')][_0xe047('0x69')]+'%'};return _0x577024;})});}_0x473777=_[_0xe047('0x51')]({},_0x473777,_0x4e3259['options']);return _0x21ce77[_0xe047('0xbe')](_0x473777);}})[_0xe047('0x1f')](function(_0x3b7571){if(_0x3b7571){_0x59317f=_0x3b7571['length'];if(!_0x4e3259[_0xe047('0x44')]['hasOwnProperty'](_0xe047('0x4c'))){_0x473777[_0xe047('0x2f')]=qs[_0xe047('0x2f')](_0x4e3259['query']['limit']);_0x473777[_0xe047('0x2d')]=qs[_0xe047('0x2d')](_0x4e3259['query'][_0xe047('0x2d')]);}return _0x21ce77[_0xe047('0xbe')](_0x473777);}})['then'](function(_0x145a71){if(_0x145a71){return _0x145a71?{'count':_0x59317f,'rows':_0x145a71}:null;}})['then'](respondWithResult(_0x26ff67,null))[_0xe047('0x29')](handleError(_0x26ff67,null));};exports['send']=function(_0x2c647e,_0x4b6e45,_0x4b1064){var _0x3a009a,_0x213d0e,_0x11a772;if(_[_0xe047('0x7b')](_0x2c647e['body'][_0xe047('0x62')])||_0x2c647e[_0xe047('0x62')][_0xe047('0x62')]===''){throw new db['Sequelize'][(_0xe047('0x75'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xe047('0x7b')](_0x2c647e[_0xe047('0x62')]['to'])){}_0x3a009a=_0x2c647e['body']['to'];return db[_0xe047('0x3d')][_0xe047('0x68')]({'where':{'id':_0x2c647e[_0xe047('0x56')]['id']}})['then'](handleEntityNotFound(_0x4b6e45,null))[_0xe047('0x1f')](function(_0x2e9e7a){if(_0x2e9e7a){return db[_0xe047('0x3d')][_0xe047('0x59')]({'where':{'id':_0x2e9e7a['id']},'include':[{'model':db[_0xe047('0x83')],'as':_0xe047('0x8e'),'include':[{'model':db['CmContact'],'as':_0xe047('0x85'),'where':{[_0x2e9e7a[_0xe047('0x7f')]]:_0x3a009a},'limit':0x1,'order':[[_0xe047('0x78'),_0xe047('0x86')]]}]}]})[_0xe047('0x1f')](handleEntityNotFound(_0x4b6e45,null))[_0xe047('0x1f')](function(_0x2e113f){if(_0x2e113f&&_0x2e113f[_0xe047('0x8e')]){_0x213d0e=_0x2e113f[_0xe047('0x34')]({'plain':!![]});if(_0x213d0e[_0xe047('0x8e')]&&_0x213d0e[_0xe047('0x8e')]['Contacts'][_0xe047('0x4a')]){return _0x213d0e['List'][_0xe047('0x85')][0x0];}return db[_0xe047('0x84')][_0xe047('0x5a')](_['defaults'](_0x2c647e[_0xe047('0x62')],{'firstName':_0x3a009a,[_0x2e113f[_0xe047('0x7f')]]:_0x3a009a,'phone':_0x3a009a,'ListId':_0x213d0e[_0xe047('0x7a')]}));}})['then'](handleEntityNotFound(_0x4b6e45,null))['then'](function(_0x35e59d){if(_0x35e59d){_0x11a772=_0x35e59d;return db[_0xe047('0x92')][_0xe047('0x59')]({'where':{'ContactId':_0x11a772['id'],'closed':![],'OpenchannelAccountId':_0x213d0e['id']}})['then'](function(_0x48a511){if(_0x48a511){return[_0x48a511,![]];}return db[_0xe047('0x92')][_0xe047('0x5a')]({'UserId':_0x2c647e[_0xe047('0x5b')]['id'],'ContactId':_0x11a772['id'],'OpenchannelAccountId':_0x213d0e['id'],'lastMsgDirection':_0xe047('0xc0'),'firstMsgDirection':_0xe047('0xc0'),'Messages':[_['merge'](_0x2c647e['body'],{'read':![],'body':_0x2c647e[_0xe047('0x62')][_0xe047('0x62')],'OpenchannelAccountId':_0x213d0e['id'],'UserId':_0x2c647e['user']['id'],'ContactId':_0x11a772['id']})]},{'include':[{'model':db[_0xe047('0xc1')],'as':_0xe047('0xc2')}]})[_0xe047('0x1f')](function(_0x33dc89){return[_0x33dc89,!![]];});});}})[_0xe047('0x95')](function(_0xa952ef,_0x55621f){if(_0x55621f){return _0xa952ef;}return db['OpenchannelMessage'][_0xe047('0x5a')](_[_0xe047('0x51')](_0x2c647e['body'],{'read':![],'body':_0x2c647e[_0xe047('0x62')]['body'],'OpenchannelAccountId':_0x213d0e['id'],'OpenchannelInteractionId':_0xa952ef['id'],'UserId':_0x2c647e[_0xe047('0x5b')]['id'],'ContactId':_0x11a772['id']}))['then'](function(_0x1b0a3d){_0xa952ef[_0xe047('0xc3')][_0xe047('0xc2')]=[];_0xa952ef['dataValues'][_0xe047('0xc2')][_0xe047('0x99')](_0x1b0a3d[_0xe047('0xc3')]);return _0xa952ef;});});}})[_0xe047('0x1f')](respondWithResult(_0x4b6e45,null))[_0xe047('0x29')](handleError(_0x4b6e45,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index b2d298f..ff1f545 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 _0x54ef=['remove','hasOwnProperty','hook','exports','events','../../mysqldb','OpenchannelAccount','save','update'];(function(_0x542ff6,_0xa0f401){var _0x40df45=function(_0x7ba286){while(--_0x7ba286){_0x542ff6['push'](_0x542ff6['shift']());}};_0x40df45(++_0xa0f401);}(_0x54ef,0x112));var _0xf54e=function(_0xdfac76,_0x4e2a7a){_0xdfac76=_0xdfac76-0x0;var _0x41d185=_0x54ef[_0xdfac76];return _0x41d185;};'use strict';var EventEmitter=require(_0xf54e('0x0'));var OpenchannelAccount=require(_0xf54e('0x1'))['db'][_0xf54e('0x2')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xf54e('0x3'),'afterUpdate':_0xf54e('0x4'),'afterDestroy':_0xf54e('0x5')};function emitEvent(_0x42b9b2){return function(_0x8b6bb6,_0x431e36,_0x12d43f){OpenchannelAccountEvents['emit'](_0x42b9b2+':'+_0x8b6bb6['id'],_0x8b6bb6);OpenchannelAccountEvents['emit'](_0x42b9b2,_0x8b6bb6);_0x12d43f(null);};}for(var e in events){if(events[_0xf54e('0x6')](e)){var event=events[e];OpenchannelAccount[_0xf54e('0x7')](e,emitEvent(event));}}module[_0xf54e('0x8')]=OpenchannelAccountEvents; \ No newline at end of file +var _0x750a=['../../mysqldb','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x4a26e7,_0x232272){var _0x13c81b=function(_0x15c69f){while(--_0x15c69f){_0x4a26e7['push'](_0x4a26e7['shift']());}};_0x13c81b(++_0x232272);}(_0x750a,0x140));var _0xa750=function(_0x48d388,_0x134805){_0x48d388=_0x48d388-0x0;var _0x5beafd=_0x750a[_0x48d388];return _0x5beafd;};'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 2147fd1..422a204 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(_0x308998,_0x5e324b){var _0x3d90e6=function(_0x3f988f){while(--_0x3f988f){_0x308998['push'](_0x308998['shift']());}};_0x3d90e6(++_0x5e324b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4dbaad,_0x730318){_0x4dbaad=_0x4dbaad-0x0;var _0x226c72=_0xa9e0[_0x4dbaad];return _0x226c72;};'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(_0x21e822,_0x5482f1){var _0x543380=function(_0x90ac60){while(--_0x90ac60){_0x21e822['push'](_0x21e822['shift']());}};_0x543380(++_0x5482f1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x134c2e,_0x3573c4){_0x134c2e=_0x134c2e-0x0;var _0x2825db=_0xa9e0[_0x134c2e];return _0x2825db;};'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 278d335..1bce82c 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 _0x6f2f=['socket.io-emitter','./openchannelAccount.socket','register','request','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','ioredis','../../config/logger','rpc','../../config/environment','http','redis','defaults','localhost'];(function(_0x1a2a50,_0x1cdd3c){var _0x49df88=function(_0x44b07e){while(--_0x44b07e){_0x1a2a50['push'](_0x1a2a50['shift']());}};_0x49df88(++_0x1cdd3c);}(_0x6f2f,0xbe));var _0xf6f2=function(_0x288f5e,_0x205edd){_0x288f5e=_0x288f5e-0x0;var _0x476cc9=_0x6f2f[_0x288f5e];return _0x476cc9;};'use strict';var _=require(_0xf6f2('0x0'));var util=require(_0xf6f2('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf6f2('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xf6f2('0x3'))(_0xf6f2('0x4'));var config=require(_0xf6f2('0x5'));var jayson=require('jayson/promise');var client=jayson['client'][_0xf6f2('0x6')]({'port':0x232a});config[_0xf6f2('0x7')]=_[_0xf6f2('0x8')](config[_0xf6f2('0x7')],{'host':_0xf6f2('0x9'),'port':0x18eb});var socket=require(_0xf6f2('0xa'))(new Redis(config[_0xf6f2('0x7')]));require(_0xf6f2('0xb'))[_0xf6f2('0xc')](socket);function respondWithRpcPromise(_0x17ffd2,_0x55a260,_0x109271){return new BPromise(function(_0x266c6e,_0x2a4325){return client[_0xf6f2('0xd')](_0x17ffd2,_0x109271)['then'](function(_0x4ca76a){logger['info'](_0xf6f2('0xe'),_0x55a260,_0xf6f2('0xf'));logger[_0xf6f2('0x10')](_0xf6f2('0x11'),_0x55a260,_0xf6f2('0xf'),JSON[_0xf6f2('0x12')](_0x4ca76a));if(_0x4ca76a['error']){if(_0x4ca76a[_0xf6f2('0x13')][_0xf6f2('0x14')]===0x1f4){logger[_0xf6f2('0x13')](_0xf6f2('0xe'),_0x55a260,_0x4ca76a[_0xf6f2('0x13')]['message']);return _0x2a4325(_0x4ca76a[_0xf6f2('0x13')][_0xf6f2('0x15')]);}logger[_0xf6f2('0x13')](_0xf6f2('0xe'),_0x55a260,_0x4ca76a[_0xf6f2('0x13')][_0xf6f2('0x15')]);return _0x266c6e(_0x4ca76a[_0xf6f2('0x13')][_0xf6f2('0x15')]);}else{logger[_0xf6f2('0x16')](_0xf6f2('0xe'),_0x55a260,_0xf6f2('0xf'));_0x266c6e(_0x4ca76a[_0xf6f2('0x17')][_0xf6f2('0x15')]);}})[_0xf6f2('0x18')](function(_0xb05611){logger['error']('OpenchannelAccount,\x20%s,\x20%s',_0x55a260,_0xb05611);_0x2a4325(_0xb05611);});});} \ No newline at end of file +var _0x065e=['socket.io-emitter','./openchannelAccount.socket','register','request','then','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','OpenchannelAccount,\x20%s,\x20%s','result','catch','lodash','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','client','http','redis'];(function(_0x126f47,_0x2199e9){var _0x49508a=function(_0x20ba36){while(--_0x20ba36){_0x126f47['push'](_0x126f47['shift']());}};_0x49508a(++_0x2199e9);}(_0x065e,0x1a7));var _0xe065=function(_0x3a62d3,_0x4fd275){_0x3a62d3=_0x3a62d3-0x0;var _0x138eae=_0x065e[_0x3a62d3];return _0x138eae;};'use strict';var _=require(_0xe065('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xe065('0x1'));var fs=require('fs');var Redis=require(_0xe065('0x2'));var db=require(_0xe065('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xe065('0x4'));var config=require(_0xe065('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xe065('0x6')][_0xe065('0x7')]({'port':0x232a});config[_0xe065('0x8')]=_['defaults'](config[_0xe065('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0xe065('0x9'))(new Redis(config[_0xe065('0x8')]));require(_0xe065('0xa'))[_0xe065('0xb')](socket);function respondWithRpcPromise(_0x85001e,_0x531ebd,_0x43827c){return new BPromise(function(_0x6c9117,_0x3f59d3){return client[_0xe065('0xc')](_0x85001e,_0x43827c)[_0xe065('0xd')](function(_0x2a6a6e){logger['info']('OpenchannelAccount,\x20%s,\x20%s',_0x531ebd,_0xe065('0xe'));logger[_0xe065('0xf')](_0xe065('0x10'),_0x531ebd,'request\x20sent',JSON[_0xe065('0x11')](_0x2a6a6e));if(_0x2a6a6e[_0xe065('0x12')]){if(_0x2a6a6e[_0xe065('0x12')][_0xe065('0x13')]===0x1f4){logger[_0xe065('0x12')]('OpenchannelAccount,\x20%s,\x20%s',_0x531ebd,_0x2a6a6e[_0xe065('0x12')][_0xe065('0x14')]);return _0x3f59d3(_0x2a6a6e[_0xe065('0x12')][_0xe065('0x14')]);}logger[_0xe065('0x12')](_0xe065('0x15'),_0x531ebd,_0x2a6a6e[_0xe065('0x12')]['message']);return _0x6c9117(_0x2a6a6e[_0xe065('0x12')][_0xe065('0x14')]);}else{logger['info'](_0xe065('0x15'),_0x531ebd,_0xe065('0xe'));_0x6c9117(_0x2a6a6e[_0xe065('0x16')][_0xe065('0x14')]);}})[_0xe065('0x17')](function(_0x302adf){logger[_0xe065('0x12')]('OpenchannelAccount,\x20%s,\x20%s',_0x531ebd,_0x302adf);_0x3f59d3(_0x302adf);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index 18d4324..7e8ea6c 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 _0x902b=['register','./openchannelAccount.events','remove','update','emit'];(function(_0x57c1c7,_0x5f0cde){var _0x5b2f7d=function(_0x46fe04){while(--_0x46fe04){_0x57c1c7['push'](_0x57c1c7['shift']());}};_0x5b2f7d(++_0x5f0cde);}(_0x902b,0x6a));var _0xb902=function(_0x500419,_0x549162){_0x500419=_0x500419-0x0;var _0x241c1a=_0x902b[_0x500419];return _0x241c1a;};'use strict';var OpenchannelAccountEvents=require(_0xb902('0x0'));var events=['save',_0xb902('0x1'),_0xb902('0x2')];function createListener(_0x26d7c7,_0x20a412){return function(_0xa2acb9){_0x20a412[_0xb902('0x3')](_0x26d7c7,_0xa2acb9);};}function removeListener(_0x492bd4,_0x1af7b5){return function(){OpenchannelAccountEvents['removeListener'](_0x492bd4,_0x1af7b5);};}exports[_0xb902('0x4')]=function(_0x5d38bb){for(var _0x157e14=0x0,_0x5e7240=events['length'];_0x157e14<_0x5e7240;_0x157e14++){var _0x5b0b74=events[_0x157e14];var _0x55331d=createListener('openchannelAccount:'+_0x5b0b74,_0x5d38bb);OpenchannelAccountEvents['on'](_0x5b0b74,_0x55331d);}}; \ No newline at end of file +var _0x5e14=['emit','removeListener','register','length','openchannelAccount:','./openchannelAccount.events','save','remove','update'];(function(_0x40c402,_0x42ee7d){var _0x4e7680=function(_0x52b150){while(--_0x52b150){_0x40c402['push'](_0x40c402['shift']());}};_0x4e7680(++_0x42ee7d);}(_0x5e14,0x164));var _0x45e1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5e14[_0x3dd15e];return _0x231fd0;};'use strict';var OpenchannelAccountEvents=require(_0x45e1('0x0'));var events=[_0x45e1('0x1'),_0x45e1('0x2'),_0x45e1('0x3')];function createListener(_0x12c02b,_0x1af150){return function(_0xfb5d5e){_0x1af150[_0x45e1('0x4')](_0x12c02b,_0xfb5d5e);};}function removeListener(_0x1f8823,_0x33ce6c){return function(){OpenchannelAccountEvents[_0x45e1('0x5')](_0x1f8823,_0x33ce6c);};}exports[_0x45e1('0x6')]=function(_0xc25c34){for(var _0x41b13c=0x0,_0x26ee2e=events[_0x45e1('0x7')];_0x41b13c<_0x26ee2e;_0x41b13c++){var _0x111f7c=events[_0x41b13c];var _0x4062de=createListener(_0x45e1('0x8')+_0x111f7c,_0xc25c34);OpenchannelAccountEvents['on'](_0x111f7c,_0x4062de);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index 39eda93..ec46755 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 _0x3c70=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelApplication.controller','get','isAuthenticated','index','post','create','put','/:id','destroy','exports','multer','util','connect-timeout'];(function(_0x57fa7e,_0xd0b5ce){var _0x320671=function(_0x3392cc){while(--_0x3392cc){_0x57fa7e['push'](_0x57fa7e['shift']());}};_0x320671(++_0xd0b5ce);}(_0x3c70,0xb1));var _0x03c7=function(_0x55f8b4,_0x43f30d){_0x55f8b4=_0x55f8b4-0x0;var _0x2475f9=_0x3c70[_0x55f8b4];return _0x2475f9;};'use strict';var multer=require(_0x03c7('0x0'));var util=require(_0x03c7('0x1'));var path=require('path');var timeout=require(_0x03c7('0x2'));var express=require('express');var router=express[_0x03c7('0x3')]();var fs_extra=require(_0x03c7('0x4'));var auth=require(_0x03c7('0x5'));var interaction=require(_0x03c7('0x6'));var config=require(_0x03c7('0x7'));var controller=require(_0x03c7('0x8'));router[_0x03c7('0x9')]('/',auth[_0x03c7('0xa')](),controller[_0x03c7('0xb')]);router['get']('/:id',auth[_0x03c7('0xa')](),controller['show']);router[_0x03c7('0xc')]('/',auth[_0x03c7('0xa')](),controller[_0x03c7('0xd')]);router[_0x03c7('0xe')]('/:id',auth['isAuthenticated'](),controller['update']);router['delete'](_0x03c7('0xf'),auth[_0x03c7('0xa')](),controller[_0x03c7('0x10')]);module[_0x03c7('0x11')]=router; \ No newline at end of file +var _0x4461=['get','index','/:id','isAuthenticated','post','create','put','update','delete','destroy','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0xd623aa,_0x59c1a8){var _0x5cb726=function(_0x3b79d6){while(--_0x3b79d6){_0xd623aa['push'](_0xd623aa['shift']());}};_0x5cb726(++_0x59c1a8);}(_0x4461,0x13c));var _0x1446=function(_0x78f943,_0x58e155){_0x78f943=_0x78f943-0x0;var _0x51255a=_0x4461[_0x78f943];return _0x51255a;};'use strict';var multer=require(_0x1446('0x0'));var util=require(_0x1446('0x1'));var path=require(_0x1446('0x2'));var timeout=require('connect-timeout');var express=require(_0x1446('0x3'));var router=express[_0x1446('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x1446('0x5'));var interaction=require(_0x1446('0x6'));var config=require('../../config/environment');var controller=require('./openchannelApplication.controller');router[_0x1446('0x7')]('/',auth['isAuthenticated'](),controller[_0x1446('0x8')]);router[_0x1446('0x7')](_0x1446('0x9'),auth[_0x1446('0xa')](),controller['show']);router[_0x1446('0xb')]('/',auth['isAuthenticated'](),controller[_0x1446('0xc')]);router[_0x1446('0xd')](_0x1446('0x9'),auth[_0x1446('0xa')](),controller[_0x1446('0xe')]);router[_0x1446('0xf')]('/:id',auth[_0x1446('0xa')](),controller[_0x1446('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.attributes.js b/server/api/openchannelApplication/openchannelApplication.attributes.js index 63b0d54..a08c398 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 _0x1fe0=['STRING','*,*,*,*','sequelize'];(function(_0x72da07,_0x45bf5d){var _0x2415fc=function(_0x4a39b2){while(--_0x4a39b2){_0x72da07['push'](_0x72da07['shift']());}};_0x2415fc(++_0x45bf5d);}(_0x1fe0,0xfe));var _0x01fe=function(_0x220f3f,_0x11c540){_0x220f3f=_0x220f3f-0x0;var _0x1f170e=_0x1fe0[_0x220f3f];return _0x1f170e;};'use strict';var Sequelize=require(_0x01fe('0x0'));module['exports']={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x01fe('0x1')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x01fe('0x1')]},'interval':{'type':Sequelize[_0x01fe('0x1')],'defaultValue':_0x01fe('0x2')}}; \ No newline at end of file +var _0xac8b=['TEXT','*,*,*,*','exports','INTEGER','STRING','noop'];(function(_0x1706eb,_0xe07024){var _0x267834=function(_0x22abd9){while(--_0x22abd9){_0x1706eb['push'](_0x1706eb['shift']());}};_0x267834(++_0xe07024);}(_0xac8b,0x9e));var _0xbac8=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xac8b[_0x502c7d];return _0x30b7ed;};'use strict';var Sequelize=require('sequelize');module[_0xbac8('0x0')]={'priority':{'type':Sequelize[_0xbac8('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xbac8('0x2')],'allowNull':![],'defaultValue':_0xbac8('0x3')},'appdata':{'type':Sequelize[_0xbac8('0x4')]()},'description':{'type':Sequelize[_0xbac8('0x2')]},'interval':{'type':Sequelize[_0xbac8('0x2')],'defaultValue':_0xbac8('0x5')}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index 0d3c9cc..cccae30 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 _0x15ad=['VIRTUAL','options','includeAll','findAll','rows','catch','show','params','rawAttributes','include','find','create','body','update','eml-format','rimraf','zip-dir','request-promise','mustache','util','path','to-csv','ejs','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','../../mysqldb','sendStatus','status','end','json','undefined','limit','offset','count','set','Content-Range','reject','save','then','error','stack','send','map','OpenchannelApplication','fieldName','type','key','model','name','query','attributes','intersection','fields','length','nolimit','order','sort','where','filters','pick','filter','merge'];(function(_0x255f64,_0x3e2d77){var _0x23934e=function(_0x29d24c){while(--_0x29d24c){_0x255f64['push'](_0x255f64['shift']());}};_0x23934e(++_0x3e2d77);}(_0x15ad,0xa2));var _0xd15a=function(_0x2bad7e,_0x147afd){_0x2bad7e=_0x2bad7e-0x0;var _0x4ba8c0=_0x15ad[_0x2bad7e];return _0x4ba8c0;};'use strict';var emlformat=require(_0xd15a('0x0'));var rimraf=require(_0xd15a('0x1'));var zipdir=require(_0xd15a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd15a('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xd15a('0x4'));var util=require(_0xd15a('0x5'));var path=require(_0xd15a('0x6'));var sox=require('sox');var csv=require(_0xd15a('0x7'));var ejs=require(_0xd15a('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xd15a('0x9'));var crypto=require(_0xd15a('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xd15a('0xb'));var toCsv=require(_0xd15a('0x7'));var querystring=require(_0xd15a('0xc'));var Papa=require(_0xd15a('0xd'));var Redis=require(_0xd15a('0xe'));var authService=require(_0xd15a('0xf'));var qs=require(_0xd15a('0x10'));var as=require(_0xd15a('0x11'));var hardwareService=require(_0xd15a('0x12'));var logger=require(_0xd15a('0x13'))(_0xd15a('0x14'));var utils=require(_0xd15a('0x15'));var config=require(_0xd15a('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xd15a('0x17'))['db'];function respondWithStatusCode(_0x1c5dd2,_0x2f0855){_0x2f0855=_0x2f0855||0xcc;return function(_0x3811ed){if(_0x3811ed){return _0x1c5dd2[_0xd15a('0x18')](_0x2f0855);}return _0x1c5dd2[_0xd15a('0x19')](_0x2f0855)[_0xd15a('0x1a')]();};}function respondWithResult(_0xf269a6,_0x4b3fef){_0x4b3fef=_0x4b3fef||0xc8;return function(_0x4d91b2){if(_0x4d91b2){return _0xf269a6['status'](_0x4b3fef)[_0xd15a('0x1b')](_0x4d91b2);}};}function respondWithFilteredResult(_0x47c1dd,_0x29e529){return function(_0x7f4e33){if(_0x7f4e33){var _0x41f4aa=typeof _0x29e529['offset']===_0xd15a('0x1c')&&typeof _0x29e529[_0xd15a('0x1d')]==='undefined';var _0x56aea5=_0x7f4e33['count'];var _0x33a473=_0x41f4aa?0x0:_0x29e529[_0xd15a('0x1e')];var _0x4233ba=_0x41f4aa?_0x7f4e33[_0xd15a('0x1f')]:_0x29e529['offset']+_0x29e529['limit'];var _0x517856;if(_0x4233ba>=_0x56aea5){_0x4233ba=_0x56aea5;_0x517856=0xc8;}else{_0x517856=0xce;}_0x47c1dd[_0xd15a('0x19')](_0x517856);return _0x47c1dd[_0xd15a('0x20')](_0xd15a('0x21'),_0x33a473+'-'+_0x4233ba+'/'+_0x56aea5)[_0xd15a('0x1b')](_0x7f4e33);}return null;};}function patchUpdates(_0x2db901){return function(_0xa18d76){try{jsonpatch['apply'](_0xa18d76,_0x2db901,!![]);}catch(_0x4f9f59){return BPromise[_0xd15a('0x22')](_0x4f9f59);}return _0xa18d76[_0xd15a('0x23')]();};}function saveUpdates(_0x2f4827,_0x5c1388){return function(_0x1accc2){if(_0x1accc2){return _0x1accc2['update'](_0x2f4827)[_0xd15a('0x24')](function(_0x10371b){return _0x10371b;});}return null;};}function removeEntity(_0x19ab86,_0x45cac6){return function(_0x5637cf){if(_0x5637cf){return _0x5637cf['destroy']()[_0xd15a('0x24')](function(){_0x19ab86[_0xd15a('0x19')](0xcc)[_0xd15a('0x1a')]();});}};}function handleEntityNotFound(_0x177595,_0x5e215d){return function(_0x3ed4a6){if(!_0x3ed4a6){_0x177595[_0xd15a('0x18')](0x194);}return _0x3ed4a6;};}function handleError(_0xf933bb,_0x3bf1c7){_0x3bf1c7=_0x3bf1c7||0x1f4;return function(_0x2512e3){logger[_0xd15a('0x25')](_0x2512e3[_0xd15a('0x26')]);if(_0x2512e3['name']){delete _0x2512e3['name'];}_0xf933bb[_0xd15a('0x19')](_0x3bf1c7)[_0xd15a('0x27')](_0x2512e3);};}exports['index']=function(_0x1bbdc1,_0x5730ed){var _0x5cd1ff={},_0xf51a7a={},_0x48b201={'count':0x0,'rows':[]};var _0x2c5db7=_[_0xd15a('0x28')](db[_0xd15a('0x29')]['rawAttributes'],function(_0xe4f25c){return{'name':_0xe4f25c[_0xd15a('0x2a')],'type':_0xe4f25c[_0xd15a('0x2b')][_0xd15a('0x2c')]};});_0xf51a7a[_0xd15a('0x2d')]=_[_0xd15a('0x28')](_0x2c5db7,_0xd15a('0x2e'));_0xf51a7a['query']=_['keys'](_0x1bbdc1[_0xd15a('0x2f')]);_0xf51a7a['filters']=_['intersection'](_0xf51a7a[_0xd15a('0x2d')],_0xf51a7a[_0xd15a('0x2f')]);_0x5cd1ff[_0xd15a('0x30')]=_[_0xd15a('0x31')](_0xf51a7a[_0xd15a('0x2d')],qs[_0xd15a('0x32')](_0x1bbdc1['query'][_0xd15a('0x32')]));_0x5cd1ff[_0xd15a('0x30')]=_0x5cd1ff[_0xd15a('0x30')][_0xd15a('0x33')]?_0x5cd1ff[_0xd15a('0x30')]:_0xf51a7a['model'];if(!_0x1bbdc1[_0xd15a('0x2f')]['hasOwnProperty'](_0xd15a('0x34'))){_0x5cd1ff[_0xd15a('0x1d')]=qs[_0xd15a('0x1d')](_0x1bbdc1['query'][_0xd15a('0x1d')]);_0x5cd1ff['offset']=qs['offset'](_0x1bbdc1[_0xd15a('0x2f')]['offset']);}_0x5cd1ff[_0xd15a('0x35')]=qs[_0xd15a('0x36')](_0x1bbdc1[_0xd15a('0x2f')][_0xd15a('0x36')]);_0x5cd1ff[_0xd15a('0x37')]=qs[_0xd15a('0x38')](_[_0xd15a('0x39')](_0x1bbdc1[_0xd15a('0x2f')],_0xf51a7a[_0xd15a('0x38')]),_0x2c5db7);if(_0x1bbdc1[_0xd15a('0x2f')][_0xd15a('0x3a')]){_0x5cd1ff[_0xd15a('0x37')]=_[_0xd15a('0x3b')](_0x5cd1ff[_0xd15a('0x37')],{'$or':_[_0xd15a('0x28')](_0x2c5db7,function(_0x5ed9c2){if(_0x5ed9c2[_0xd15a('0x2b')]!==_0xd15a('0x3c')){var _0x167037={};_0x167037[_0x5ed9c2[_0xd15a('0x2e')]]={'$like':'%'+_0x1bbdc1[_0xd15a('0x2f')]['filter']+'%'};return _0x167037;}})});}_0x5cd1ff=_[_0xd15a('0x3b')]({},_0x5cd1ff,_0x1bbdc1[_0xd15a('0x3d')]);var _0x4c37fa={'where':_0x5cd1ff[_0xd15a('0x37')]};return db[_0xd15a('0x29')][_0xd15a('0x1f')](_0x4c37fa)[_0xd15a('0x24')](function(_0x2e9221){_0x48b201[_0xd15a('0x1f')]=_0x2e9221;if(_0x1bbdc1['query'][_0xd15a('0x3e')]){_0x5cd1ff['include']=[{'all':!![]}];}return db[_0xd15a('0x29')][_0xd15a('0x3f')](_0x5cd1ff);})[_0xd15a('0x24')](function(_0x1c677c){_0x48b201[_0xd15a('0x40')]=_0x1c677c;return _0x48b201;})[_0xd15a('0x24')](respondWithFilteredResult(_0x5730ed,_0x5cd1ff))[_0xd15a('0x41')](handleError(_0x5730ed,null));};exports[_0xd15a('0x42')]=function(_0x52492c,_0x597a97){var _0x18303f={'raw':!![],'where':{'id':_0x52492c[_0xd15a('0x43')]['id']}},_0xe1499b={};_0xe1499b[_0xd15a('0x2d')]=_['keys'](db[_0xd15a('0x29')][_0xd15a('0x44')]);_0xe1499b[_0xd15a('0x2f')]=_['keys'](_0x52492c['query']);_0xe1499b[_0xd15a('0x38')]=_[_0xd15a('0x31')](_0xe1499b['model'],_0xe1499b[_0xd15a('0x2f')]);_0x18303f['attributes']=_[_0xd15a('0x31')](_0xe1499b[_0xd15a('0x2d')],qs[_0xd15a('0x32')](_0x52492c['query'][_0xd15a('0x32')]));_0x18303f[_0xd15a('0x30')]=_0x18303f['attributes'][_0xd15a('0x33')]?_0x18303f[_0xd15a('0x30')]:_0xe1499b[_0xd15a('0x2d')];if(_0x52492c[_0xd15a('0x2f')][_0xd15a('0x3e')]){_0x18303f[_0xd15a('0x45')]=[{'all':!![]}];}_0x18303f=_[_0xd15a('0x3b')]({},_0x18303f,_0x52492c[_0xd15a('0x3d')]);return db['OpenchannelApplication'][_0xd15a('0x46')](_0x18303f)[_0xd15a('0x24')](handleEntityNotFound(_0x597a97,null))['then'](respondWithResult(_0x597a97,null))[_0xd15a('0x41')](handleError(_0x597a97,null));};exports['create']=function(_0x23d4f3,_0x3d5612){return db['OpenchannelApplication'][_0xd15a('0x47')](_0x23d4f3[_0xd15a('0x48')],{})[_0xd15a('0x24')](respondWithResult(_0x3d5612,0xc9))[_0xd15a('0x41')](handleError(_0x3d5612,null));};exports[_0xd15a('0x49')]=function(_0x34c6d2,_0x18ded8){if(_0x34c6d2[_0xd15a('0x48')]['id']){delete _0x34c6d2['body']['id'];}return db[_0xd15a('0x29')]['find']({'where':{'id':_0x34c6d2[_0xd15a('0x43')]['id']}})[_0xd15a('0x24')](handleEntityNotFound(_0x18ded8,null))[_0xd15a('0x24')](saveUpdates(_0x34c6d2[_0xd15a('0x48')],null))[_0xd15a('0x24')](respondWithResult(_0x18ded8,null))['catch'](handleError(_0x18ded8,null));};exports['destroy']=function(_0x5555ca,_0x8fb6e0){return db[_0xd15a('0x29')][_0xd15a('0x46')]({'where':{'id':_0x5555ca['params']['id']}})[_0xd15a('0x24')](handleEntityNotFound(_0x8fb6e0,null))['then'](removeEntity(_0x8fb6e0,null))[_0xd15a('0x41')](handleError(_0x8fb6e0,null));}; \ No newline at end of file +var _0x3f84=['show','includeAll','options','create','body','find','params','destroy','eml-format','fast-json-patch','request-promise','moment','bluebird','util','sox','lodash','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','sendStatus','error','stack','name','send','index','map','OpenchannelApplication','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','VIRTUAL','filter','merge','include','rows','catch'];(function(_0x311909,_0x414bf7){var _0x8d3163=function(_0x226f55){while(--_0x226f55){_0x311909['push'](_0x311909['shift']());}};_0x8d3163(++_0x414bf7);}(_0x3f84,0x1eb));var _0x43f8=function(_0x45fc6a,_0x166adb){_0x45fc6a=_0x45fc6a-0x0;var _0x14bcfd=_0x3f84[_0x45fc6a];return _0x14bcfd;};'use strict';var emlformat=require(_0x43f8('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x43f8('0x1'));var rp=require(_0x43f8('0x2'));var moment=require(_0x43f8('0x3'));var BPromise=require(_0x43f8('0x4'));var Mustache=require('mustache');var util=require(_0x43f8('0x5'));var path=require('path');var sox=require(_0x43f8('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x43f8('0x7'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x43f8('0x8'));var deskjs=require(_0x43f8('0x9'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x43f8('0xa'));var Redis=require(_0x43f8('0xb'));var authService=require(_0x43f8('0xc'));var qs=require('../../components/parsers/qs');var as=require(_0x43f8('0xd'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x43f8('0xe'));var utils=require(_0x43f8('0xf'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x43f8('0x10'))['db'];function respondWithStatusCode(_0x3c0453,_0x543cbb){_0x543cbb=_0x543cbb||0xcc;return function(_0x4453eb){if(_0x4453eb){return _0x3c0453['sendStatus'](_0x543cbb);}return _0x3c0453[_0x43f8('0x11')](_0x543cbb)[_0x43f8('0x12')]();};}function respondWithResult(_0x5e2339,_0x5c8fc4){_0x5c8fc4=_0x5c8fc4||0xc8;return function(_0x399f20){if(_0x399f20){return _0x5e2339[_0x43f8('0x11')](_0x5c8fc4)[_0x43f8('0x13')](_0x399f20);}};}function respondWithFilteredResult(_0x49acca,_0x45d912){return function(_0x2a4464){if(_0x2a4464){var _0x5f371f=typeof _0x45d912[_0x43f8('0x14')]===_0x43f8('0x15')&&typeof _0x45d912[_0x43f8('0x16')]===_0x43f8('0x15');var _0x3322f4=_0x2a4464[_0x43f8('0x17')];var _0x53701e=_0x5f371f?0x0:_0x45d912['offset'];var _0x4bd4d2=_0x5f371f?_0x2a4464[_0x43f8('0x17')]:_0x45d912[_0x43f8('0x14')]+_0x45d912['limit'];var _0x53f500;if(_0x4bd4d2>=_0x3322f4){_0x4bd4d2=_0x3322f4;_0x53f500=0xc8;}else{_0x53f500=0xce;}_0x49acca[_0x43f8('0x11')](_0x53f500);return _0x49acca[_0x43f8('0x18')](_0x43f8('0x19'),_0x53701e+'-'+_0x4bd4d2+'/'+_0x3322f4)[_0x43f8('0x13')](_0x2a4464);}return null;};}function patchUpdates(_0x5234fc){return function(_0x301a9f){try{jsonpatch[_0x43f8('0x1a')](_0x301a9f,_0x5234fc,!![]);}catch(_0x58504c){return BPromise[_0x43f8('0x1b')](_0x58504c);}return _0x301a9f[_0x43f8('0x1c')]();};}function saveUpdates(_0x55cafb,_0x376b5a){return function(_0x560cbc){if(_0x560cbc){return _0x560cbc[_0x43f8('0x1d')](_0x55cafb)['then'](function(_0x3e5056){return _0x3e5056;});}return null;};}function removeEntity(_0x26c01b,_0x597e2f){return function(_0x2e5a34){if(_0x2e5a34){return _0x2e5a34['destroy']()[_0x43f8('0x1e')](function(){_0x26c01b[_0x43f8('0x11')](0xcc)[_0x43f8('0x12')]();});}};}function handleEntityNotFound(_0x3da717,_0x40d3f4){return function(_0x53ad77){if(!_0x53ad77){_0x3da717[_0x43f8('0x1f')](0x194);}return _0x53ad77;};}function handleError(_0x49c90e,_0x453a3a){_0x453a3a=_0x453a3a||0x1f4;return function(_0x202c7d){logger[_0x43f8('0x20')](_0x202c7d[_0x43f8('0x21')]);if(_0x202c7d[_0x43f8('0x22')]){delete _0x202c7d[_0x43f8('0x22')];}_0x49c90e[_0x43f8('0x11')](_0x453a3a)[_0x43f8('0x23')](_0x202c7d);};}exports[_0x43f8('0x24')]=function(_0x145c1a,_0x528568){var _0x37535a={},_0x3b80f4={},_0x7fc979={'count':0x0,'rows':[]};var _0x15c2ee=_[_0x43f8('0x25')](db[_0x43f8('0x26')]['rawAttributes'],function(_0x482bff){return{'name':_0x482bff[_0x43f8('0x27')],'type':_0x482bff[_0x43f8('0x28')][_0x43f8('0x29')]};});_0x3b80f4['model']=_[_0x43f8('0x25')](_0x15c2ee,'name');_0x3b80f4[_0x43f8('0x2a')]=_[_0x43f8('0x2b')](_0x145c1a[_0x43f8('0x2a')]);_0x3b80f4[_0x43f8('0x2c')]=_[_0x43f8('0x2d')](_0x3b80f4[_0x43f8('0x2e')],_0x3b80f4[_0x43f8('0x2a')]);_0x37535a[_0x43f8('0x2f')]=_[_0x43f8('0x2d')](_0x3b80f4[_0x43f8('0x2e')],qs[_0x43f8('0x30')](_0x145c1a[_0x43f8('0x2a')][_0x43f8('0x30')]));_0x37535a[_0x43f8('0x2f')]=_0x37535a['attributes'][_0x43f8('0x31')]?_0x37535a['attributes']:_0x3b80f4[_0x43f8('0x2e')];if(!_0x145c1a[_0x43f8('0x2a')][_0x43f8('0x32')](_0x43f8('0x33'))){_0x37535a[_0x43f8('0x16')]=qs[_0x43f8('0x16')](_0x145c1a[_0x43f8('0x2a')][_0x43f8('0x16')]);_0x37535a[_0x43f8('0x14')]=qs[_0x43f8('0x14')](_0x145c1a[_0x43f8('0x2a')]['offset']);}_0x37535a[_0x43f8('0x34')]=qs[_0x43f8('0x35')](_0x145c1a[_0x43f8('0x2a')][_0x43f8('0x35')]);_0x37535a[_0x43f8('0x36')]=qs[_0x43f8('0x2c')](_['pick'](_0x145c1a['query'],_0x3b80f4[_0x43f8('0x2c')]),_0x15c2ee);if(_0x145c1a[_0x43f8('0x2a')]['filter']){_0x37535a[_0x43f8('0x36')]=_['merge'](_0x37535a[_0x43f8('0x36')],{'$or':_[_0x43f8('0x25')](_0x15c2ee,function(_0x1b22c7){if(_0x1b22c7[_0x43f8('0x28')]!==_0x43f8('0x37')){var _0x29c8d3={};_0x29c8d3[_0x1b22c7[_0x43f8('0x22')]]={'$like':'%'+_0x145c1a[_0x43f8('0x2a')][_0x43f8('0x38')]+'%'};return _0x29c8d3;}})});}_0x37535a=_[_0x43f8('0x39')]({},_0x37535a,_0x145c1a['options']);var _0x595c4c={'where':_0x37535a['where']};return db[_0x43f8('0x26')]['count'](_0x595c4c)[_0x43f8('0x1e')](function(_0x10627c){_0x7fc979[_0x43f8('0x17')]=_0x10627c;if(_0x145c1a[_0x43f8('0x2a')]['includeAll']){_0x37535a[_0x43f8('0x3a')]=[{'all':!![]}];}return db[_0x43f8('0x26')]['findAll'](_0x37535a);})['then'](function(_0x3639e0){_0x7fc979[_0x43f8('0x3b')]=_0x3639e0;return _0x7fc979;})[_0x43f8('0x1e')](respondWithFilteredResult(_0x528568,_0x37535a))[_0x43f8('0x3c')](handleError(_0x528568,null));};exports[_0x43f8('0x3d')]=function(_0x483cb8,_0x2fa327){var _0x3fa2f3={'raw':!![],'where':{'id':_0x483cb8['params']['id']}},_0x5e795d={};_0x5e795d['model']=_['keys'](db[_0x43f8('0x26')]['rawAttributes']);_0x5e795d[_0x43f8('0x2a')]=_[_0x43f8('0x2b')](_0x483cb8['query']);_0x5e795d[_0x43f8('0x2c')]=_[_0x43f8('0x2d')](_0x5e795d[_0x43f8('0x2e')],_0x5e795d[_0x43f8('0x2a')]);_0x3fa2f3[_0x43f8('0x2f')]=_[_0x43f8('0x2d')](_0x5e795d[_0x43f8('0x2e')],qs[_0x43f8('0x30')](_0x483cb8['query'][_0x43f8('0x30')]));_0x3fa2f3['attributes']=_0x3fa2f3[_0x43f8('0x2f')]['length']?_0x3fa2f3['attributes']:_0x5e795d[_0x43f8('0x2e')];if(_0x483cb8[_0x43f8('0x2a')][_0x43f8('0x3e')]){_0x3fa2f3[_0x43f8('0x3a')]=[{'all':!![]}];}_0x3fa2f3=_[_0x43f8('0x39')]({},_0x3fa2f3,_0x483cb8[_0x43f8('0x3f')]);return db[_0x43f8('0x26')]['find'](_0x3fa2f3)[_0x43f8('0x1e')](handleEntityNotFound(_0x2fa327,null))['then'](respondWithResult(_0x2fa327,null))[_0x43f8('0x3c')](handleError(_0x2fa327,null));};exports[_0x43f8('0x40')]=function(_0x32eaf1,_0x1d6114){return db[_0x43f8('0x26')][_0x43f8('0x40')](_0x32eaf1['body'],{})[_0x43f8('0x1e')](respondWithResult(_0x1d6114,0xc9))[_0x43f8('0x3c')](handleError(_0x1d6114,null));};exports[_0x43f8('0x1d')]=function(_0xa1d298,_0x1e765c){if(_0xa1d298[_0x43f8('0x41')]['id']){delete _0xa1d298[_0x43f8('0x41')]['id'];}return db[_0x43f8('0x26')][_0x43f8('0x42')]({'where':{'id':_0xa1d298[_0x43f8('0x43')]['id']}})['then'](handleEntityNotFound(_0x1e765c,null))[_0x43f8('0x1e')](saveUpdates(_0xa1d298[_0x43f8('0x41')],null))['then'](respondWithResult(_0x1e765c,null))[_0x43f8('0x3c')](handleError(_0x1e765c,null));};exports[_0x43f8('0x44')]=function(_0x1dcd48,_0x220cb7){return db[_0x43f8('0x26')][_0x43f8('0x42')]({'where':{'id':_0x1dcd48[_0x43f8('0x43')]['id']}})[_0x43f8('0x1e')](handleEntityNotFound(_0x220cb7,null))['then'](removeEntity(_0x220cb7,null))[_0x43f8('0x3c')](handleError(_0x220cb7,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index 7ac3a05..964649b 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 _0xf845=['exports','OpenchannelApplication','openchannel_applications','utf8mb4','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./openchannelApplication.attributes'];(function(_0x4e1e2b,_0x1d9b58){var _0x535ab1=function(_0x2f73ea){while(--_0x2f73ea){_0x4e1e2b['push'](_0x4e1e2b['shift']());}};_0x535ab1(++_0x1d9b58);}(_0xf845,0x178));var _0x5f84=function(_0x36e93b,_0x3b9e91){_0x36e93b=_0x36e93b-0x0;var _0xb24066=_0xf845[_0x36e93b];return _0xb24066;};'use strict';var _=require('lodash');var util=require(_0x5f84('0x0'));var logger=require(_0x5f84('0x1'))(_0x5f84('0x2'));var moment=require('moment');var BPromise=require(_0x5f84('0x3'));var rp=require(_0x5f84('0x4'));var fs=require('fs');var path=require(_0x5f84('0x5'));var rimraf=require('rimraf');var config=require(_0x5f84('0x6'));var attributes=require(_0x5f84('0x7'));module[_0x5f84('0x8')]=function(_0x46b7ca,_0x352fe5){return _0x46b7ca['define'](_0x5f84('0x9'),attributes,{'tableName':_0x5f84('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x5f84('0xb'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x7e0b=['utf8mb4_unicode_ci','lodash','util','api','bluebird','request-promise','../../config/environment','exports','define','OpenchannelApplication','utf8mb4'];(function(_0x131c4c,_0x15e9a7){var _0x53d693=function(_0x45e431){while(--_0x45e431){_0x131c4c['push'](_0x131c4c['shift']());}};_0x53d693(++_0x15e9a7);}(_0x7e0b,0xb1));var _0xb7e0=function(_0x3c5b22,_0xf1adff){_0x3c5b22=_0x3c5b22-0x0;var _0x347e5b=_0x7e0b[_0x3c5b22];return _0x347e5b;};'use strict';var _=require(_0xb7e0('0x0'));var util=require(_0xb7e0('0x1'));var logger=require('../../config/logger')(_0xb7e0('0x2'));var moment=require('moment');var BPromise=require(_0xb7e0('0x3'));var rp=require(_0xb7e0('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xb7e0('0x5'));var attributes=require('./openchannelApplication.attributes');module[_0xb7e0('0x6')]=function(_0x42d05a,_0xb49e96){return _0x42d05a[_0xb7e0('0x7')](_0xb7e0('0x8'),attributes,{'tableName':'openchannel_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xb7e0('0x9'),'collate':_0xb7e0('0xa')});}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index b83177e..7a0baba 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 _0xc479=['body','options','raw','where','attributes','limit','info','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','stringify','error','code','message','OpenchannelApplication,\x20%s,\x20%s','catch','UpdateOpenchannelApplication','OpenchannelApplication','update'];(function(_0x464d29,_0x43bceb){var _0x5dd094=function(_0x16ab4b){while(--_0x16ab4b){_0x464d29['push'](_0x464d29['shift']());}};_0x5dd094(++_0x43bceb);}(_0xc479,0xc7));var _0x9c47=function(_0x261355,_0x5dabff){_0x261355=_0x261355-0x0;var _0x4f8c06=_0xc479[_0x261355];return _0x4f8c06;};'use strict';var _=require(_0x9c47('0x0'));var util=require(_0x9c47('0x1'));var moment=require(_0x9c47('0x2'));var BPromise=require(_0x9c47('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9c47('0x4'));var db=require(_0x9c47('0x5'))['db'];var utils=require(_0x9c47('0x6'));var logger=require(_0x9c47('0x7'))('rpc');var config=require(_0x9c47('0x8'));var jayson=require(_0x9c47('0x9'));var client=jayson[_0x9c47('0xa')][_0x9c47('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4afc60,_0x43a9e9,_0x3edddb){return new BPromise(function(_0xef238e,_0x38ee9c){return client[_0x9c47('0xc')](_0x4afc60,_0x3edddb)[_0x9c47('0xd')](function(_0x77407b){logger['info']('OpenchannelApplication,\x20%s,\x20%s',_0x43a9e9,_0x9c47('0xe'));logger[_0x9c47('0xf')]('OpenchannelApplication,\x20%s,\x20%s,\x20%s',_0x43a9e9,_0x9c47('0xe'),JSON[_0x9c47('0x10')](_0x77407b));if(_0x77407b[_0x9c47('0x11')]){if(_0x77407b['error'][_0x9c47('0x12')]===0x1f4){logger[_0x9c47('0x11')]('OpenchannelApplication,\x20%s,\x20%s',_0x43a9e9,_0x77407b[_0x9c47('0x11')]['message']);return _0x38ee9c(_0x77407b[_0x9c47('0x11')][_0x9c47('0x13')]);}logger[_0x9c47('0x11')](_0x9c47('0x14'),_0x43a9e9,_0x77407b[_0x9c47('0x11')][_0x9c47('0x13')]);return _0xef238e(_0x77407b['error']['message']);}else{logger['info'](_0x9c47('0x14'),_0x43a9e9,'request\x20sent');_0xef238e(_0x77407b['result'][_0x9c47('0x13')]);}})[_0x9c47('0x15')](function(_0x3a4db7){logger[_0x9c47('0x11')](_0x9c47('0x14'),_0x43a9e9,_0x3a4db7);_0x38ee9c(_0x3a4db7);});});}exports[_0x9c47('0x16')]=function(_0x104a1d){var _0x452c43=this;return new Promise(function(_0x1f015b,_0x4cd459){return db[_0x9c47('0x17')][_0x9c47('0x18')](_0x104a1d[_0x9c47('0x19')],{'raw':_0x104a1d[_0x9c47('0x1a')]?_0x104a1d[_0x9c47('0x1a')][_0x9c47('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x104a1d[_0x9c47('0x1a')]?_0x104a1d[_0x9c47('0x1a')][_0x9c47('0x1c')]||null:null,'attributes':_0x104a1d[_0x9c47('0x1a')]?_0x104a1d[_0x9c47('0x1a')][_0x9c47('0x1d')]||null:null,'limit':_0x104a1d['options']?_0x104a1d['options'][_0x9c47('0x1e')]||null:null})[_0x9c47('0xd')](function(_0x179441){logger[_0x9c47('0x1f')](_0x9c47('0x16'),_0x104a1d);logger['debug']('UpdateOpenchannelApplication',_0x104a1d,JSON[_0x9c47('0x10')](_0x179441));_0x1f015b(_0x179441);})['catch'](function(_0x126724){logger[_0x9c47('0x11')](_0x9c47('0x16'),_0x126724[_0x9c47('0x13')],_0x104a1d);_0x4cd459(_0x452c43['error'](0x1f4,_0x126724[_0x9c47('0x13')]));});});}; \ No newline at end of file +var _0x6bc9=['moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','info','OpenchannelApplication,\x20%s,\x20%s','request\x20sent','debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s','error','message','result','catch','UpdateOpenchannelApplication','OpenchannelApplication','update','options','raw','where','limit','stringify','lodash','util'];(function(_0x3bb5be,_0x423a9f){var _0x5ead50=function(_0x3bcb90){while(--_0x3bcb90){_0x3bb5be['push'](_0x3bb5be['shift']());}};_0x5ead50(++_0x423a9f);}(_0x6bc9,0x148));var _0x96bc=function(_0x51e5bd,_0x3c2cf1){_0x51e5bd=_0x51e5bd-0x0;var _0x250aed=_0x6bc9[_0x51e5bd];return _0x250aed;};'use strict';var _=require(_0x96bc('0x0'));var util=require(_0x96bc('0x1'));var moment=require(_0x96bc('0x2'));var BPromise=require('bluebird');var rs=require(_0x96bc('0x3'));var fs=require('fs');var Redis=require(_0x96bc('0x4'));var db=require(_0x96bc('0x5'))['db'];var utils=require(_0x96bc('0x6'));var logger=require(_0x96bc('0x7'))(_0x96bc('0x8'));var config=require('../../config/environment');var jayson=require(_0x96bc('0x9'));var client=jayson[_0x96bc('0xa')][_0x96bc('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xe1aa25,_0x3fd48d,_0x12e760){return new BPromise(function(_0x27cc7b,_0x1ccbee){return client[_0x96bc('0xc')](_0xe1aa25,_0x12e760)['then'](function(_0x5f5839){logger[_0x96bc('0xd')](_0x96bc('0xe'),_0x3fd48d,_0x96bc('0xf'));logger[_0x96bc('0x10')](_0x96bc('0x11'),_0x3fd48d,_0x96bc('0xf'),JSON['stringify'](_0x5f5839));if(_0x5f5839[_0x96bc('0x12')]){if(_0x5f5839['error']['code']===0x1f4){logger['error']('OpenchannelApplication,\x20%s,\x20%s',_0x3fd48d,_0x5f5839[_0x96bc('0x12')][_0x96bc('0x13')]);return _0x1ccbee(_0x5f5839[_0x96bc('0x12')][_0x96bc('0x13')]);}logger[_0x96bc('0x12')](_0x96bc('0xe'),_0x3fd48d,_0x5f5839['error']['message']);return _0x27cc7b(_0x5f5839[_0x96bc('0x12')][_0x96bc('0x13')]);}else{logger[_0x96bc('0xd')](_0x96bc('0xe'),_0x3fd48d,_0x96bc('0xf'));_0x27cc7b(_0x5f5839[_0x96bc('0x14')]['message']);}})[_0x96bc('0x15')](function(_0x935a49){logger[_0x96bc('0x12')](_0x96bc('0xe'),_0x3fd48d,_0x935a49);_0x1ccbee(_0x935a49);});});}exports[_0x96bc('0x16')]=function(_0x1084d5){var _0x3486e4=this;return new Promise(function(_0x599faf,_0xda4cb){return db[_0x96bc('0x17')][_0x96bc('0x18')](_0x1084d5['body'],{'raw':_0x1084d5[_0x96bc('0x19')]?_0x1084d5[_0x96bc('0x19')][_0x96bc('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1084d5[_0x96bc('0x19')]?_0x1084d5['options'][_0x96bc('0x1b')]||null:null,'attributes':_0x1084d5[_0x96bc('0x19')]?_0x1084d5[_0x96bc('0x19')]['attributes']||null:null,'limit':_0x1084d5['options']?_0x1084d5[_0x96bc('0x19')][_0x96bc('0x1c')]||null:null})['then'](function(_0x5c6801){logger[_0x96bc('0xd')](_0x96bc('0x16'),_0x1084d5);logger[_0x96bc('0x10')](_0x96bc('0x16'),_0x1084d5,JSON[_0x96bc('0x1d')](_0x5c6801));_0x599faf(_0x5c6801);})[_0x96bc('0x15')](function(_0x35bbe3){logger['error']('UpdateOpenchannelApplication',_0x35bbe3[_0x96bc('0x13')],_0x1084d5);_0xda4cb(_0x3486e4[_0x96bc('0x12')](0x1f4,_0x35bbe3['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/index.js b/server/api/openchannelInteraction/index.js index 97fff69..e73ff26 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 _0xde54=['addMessage','/:id/tags','tracked','openchannel','addTags','openchannelinteraction:update','update','destroy','delete','removeTags','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./openchannelInteraction.controller','isAuthenticated','index','get','/describe','/:id','show','/:id/messages','getMessages','download','post','create'];(function(_0x572b5d,_0x517b9e){var _0x31a9f8=function(_0x45ee7c){while(--_0x45ee7c){_0x572b5d['push'](_0x572b5d['shift']());}};_0x31a9f8(++_0x517b9e);}(_0xde54,0xe4));var _0x4de5=function(_0x18e9e3,_0x33ec06){_0x18e9e3=_0x18e9e3-0x0;var _0xcee7dc=_0xde54[_0x18e9e3];return _0xcee7dc;};'use strict';var multer=require(_0x4de5('0x0'));var util=require(_0x4de5('0x1'));var path=require(_0x4de5('0x2'));var timeout=require(_0x4de5('0x3'));var express=require(_0x4de5('0x4'));var router=express[_0x4de5('0x5')]();var fs_extra=require(_0x4de5('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x4de5('0x7'));var config=require('../../config/environment');var controller=require(_0x4de5('0x8'));router['get']('/',auth[_0x4de5('0x9')](),controller[_0x4de5('0xa')]);router[_0x4de5('0xb')](_0x4de5('0xc'),auth[_0x4de5('0x9')](),controller['describe']);router[_0x4de5('0xb')](_0x4de5('0xd'),auth[_0x4de5('0x9')](),controller[_0x4de5('0xe')]);router[_0x4de5('0xb')](_0x4de5('0xf'),auth[_0x4de5('0x9')](),controller[_0x4de5('0x10')]);router[_0x4de5('0xb')]('/:id/download',auth[_0x4de5('0x9')](),controller[_0x4de5('0x11')]);router[_0x4de5('0x12')]('/',auth['isAuthenticated'](),controller[_0x4de5('0x13')]);router[_0x4de5('0x12')](_0x4de5('0xf'),auth[_0x4de5('0x9')](),controller[_0x4de5('0x14')]);router[_0x4de5('0x12')](_0x4de5('0x15'),auth[_0x4de5('0x9')](),interaction[_0x4de5('0x16')](_0x4de5('0x17'),'openchannelinteraction:addtags'),controller[_0x4de5('0x18')]);router['put'](_0x4de5('0xd'),auth[_0x4de5('0x9')](),interaction[_0x4de5('0x16')](_0x4de5('0x17'),_0x4de5('0x19')),controller[_0x4de5('0x1a')]);router['delete'](_0x4de5('0xd'),auth[_0x4de5('0x9')](),interaction['tracked'](_0x4de5('0x17'),'openchannelinteraction:destroy'),controller[_0x4de5('0x1b')]);router[_0x4de5('0x1c')](_0x4de5('0x15'),auth[_0x4de5('0x9')](),controller[_0x4de5('0x1d')]);module[_0x4de5('0x1e')]=router; \ No newline at end of file +var _0xa17b=['../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/messages','getMessages','/:id/download','download','post','create','/:id/tags','tracked','openchannel','openchannelinteraction:addtags','addTags','put','openchannelinteraction:update','update','delete','openchannelinteraction:destroy','destroy','removeTags','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x16d8d9,_0x2be9a4){var _0x274705=function(_0x33ba82){while(--_0x33ba82){_0x16d8d9['push'](_0x16d8d9['shift']());}};_0x274705(++_0x2be9a4);}(_0xa17b,0x7d));var _0xba17=function(_0x81e6e2,_0x3565ca){_0x81e6e2=_0x81e6e2-0x0;var _0x56bb71=_0xa17b[_0x81e6e2];return _0x56bb71;};'use strict';var multer=require(_0xba17('0x0'));var util=require('util');var path=require(_0xba17('0x1'));var timeout=require(_0xba17('0x2'));var express=require(_0xba17('0x3'));var router=express[_0xba17('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xba17('0x5'));var interaction=require(_0xba17('0x6'));var config=require(_0xba17('0x7'));var controller=require('./openchannelInteraction.controller');router[_0xba17('0x8')]('/',auth[_0xba17('0x9')](),controller[_0xba17('0xa')]);router[_0xba17('0x8')](_0xba17('0xb'),auth[_0xba17('0x9')](),controller[_0xba17('0xc')]);router[_0xba17('0x8')](_0xba17('0xd'),auth[_0xba17('0x9')](),controller[_0xba17('0xe')]);router[_0xba17('0x8')](_0xba17('0xf'),auth['isAuthenticated'](),controller[_0xba17('0x10')]);router[_0xba17('0x8')](_0xba17('0x11'),auth['isAuthenticated'](),controller[_0xba17('0x12')]);router[_0xba17('0x13')]('/',auth[_0xba17('0x9')](),controller[_0xba17('0x14')]);router[_0xba17('0x13')](_0xba17('0xf'),auth[_0xba17('0x9')](),controller['addMessage']);router['post'](_0xba17('0x15'),auth[_0xba17('0x9')](),interaction[_0xba17('0x16')](_0xba17('0x17'),_0xba17('0x18')),controller[_0xba17('0x19')]);router[_0xba17('0x1a')]('/:id',auth[_0xba17('0x9')](),interaction[_0xba17('0x16')]('openchannel',_0xba17('0x1b')),controller[_0xba17('0x1c')]);router[_0xba17('0x1d')](_0xba17('0xd'),auth[_0xba17('0x9')](),interaction[_0xba17('0x16')](_0xba17('0x17'),_0xba17('0x1e')),controller[_0xba17('0x1f')]);router['delete'](_0xba17('0x15'),auth[_0xba17('0x9')](),controller[_0xba17('0x20')]);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 4568433..02016a9 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 _0xbac2=['BOOLEAN','DATE','STRING','ENUM','out','INTEGER','sequelize','exports'];(function(_0x2f2adf,_0x1ff667){var _0xc14a2=function(_0xe22e14){while(--_0xe22e14){_0x2f2adf['push'](_0x2f2adf['shift']());}};_0xc14a2(++_0x1ff667);}(_0xbac2,0xc6));var _0x2bac=function(_0x18b5e8,_0x51e875){_0x18b5e8=_0x18b5e8-0x0;var _0x25baed=_0xbac2[_0x18b5e8];return _0x25baed;};'use strict';var Sequelize=require(_0x2bac('0x0'));module[_0x2bac('0x1')]={'closed':{'type':Sequelize[_0x2bac('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x2bac('0x3')]},'disposition':{'type':Sequelize[_0x2bac('0x4')]},'secondDisposition':{'type':Sequelize[_0x2bac('0x4')]},'thirdDisposition':{'type':Sequelize[_0x2bac('0x4')]},'note':{'type':Sequelize[_0x2bac('0x4')]},'read1stAt':{'type':Sequelize['DATE']},'threadId':{'type':Sequelize[_0x2bac('0x4')]},'externalUrl':{'type':Sequelize[_0x2bac('0x4')]},'lastMsgAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0x2bac('0x5')]('in',_0x2bac('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize[_0x2bac('0x5')]('in',_0x2bac('0x6')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0x2bac('0x4')]},'autoreplyExecuted':{'type':Sequelize[_0x2bac('0x2')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x2bac('0x7')]}}; \ No newline at end of file +var _0xa42e=['STRING','ENUM','out','INTEGER','sequelize','BOOLEAN','DATE'];(function(_0x4d91b4,_0x3d9e10){var _0x3e4be9=function(_0x43d10f){while(--_0x43d10f){_0x4d91b4['push'](_0x4d91b4['shift']());}};_0x3e4be9(++_0x3d9e10);}(_0xa42e,0xba));var _0xea42=function(_0x5df6f0,_0x197a9f){_0x5df6f0=_0x5df6f0-0x0;var _0x252619=_0xa42e[_0x5df6f0];return _0x252619;};'use strict';var Sequelize=require(_0xea42('0x0'));module['exports']={'closed':{'type':Sequelize[_0xea42('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xea42('0x2')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xea42('0x3')]},'read1stAt':{'type':Sequelize['DATE']},'threadId':{'type':Sequelize[_0xea42('0x3')]},'externalUrl':{'type':Sequelize[_0xea42('0x3')]},'lastMsgAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0xea42('0x4')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xea42('0x5')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize['STRING']},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueId':{'type':Sequelize[_0xea42('0x6')]}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index 3b1009b..5f4d96e 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 _0x237d=['where','filter','merge','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','rows','ids','omit','color','emit','removeTags','download','unix','root','server','files','tmp','join','attachments','transcript-%d-%s.zip','push','User','fullname','CmContact','Contact','Attachment','Messages','direction','secret','Account','Owner','get','Openchannel','N.A.','createdAt','toString','closed','closedAt','threadId','Public','Private','existsSync','createReadStream','createWriteStream','out','System','firstName','lastName','basename','read','renderFile','.pdf','createPdfFromHTML','error','Unable\x20to\x20delete\x20zip\x20file','unlinkSync','rimraf','moment','path','ejs','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../config/environment','redis','defaults','socket.io-emitter','./openchannelInteraction.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','update','then','stack','name','OpenchannelInteraction','rawAttributes','fieldName','type','key','getOptions','findAll','openchannel','query','user','from','params','model','keys','filters','intersection','attributes','fields','length','includeAll','find','catch','create','body','destroy','describe','OpenchannelMessage','addMessage','getMessages','findOne','nolimit','order','sort'];(function(_0x147d0f,_0x5c7064){var _0x3642ad=function(_0x3435d1){while(--_0x3435d1){_0x147d0f['push'](_0x147d0f['shift']());}};_0x3642ad(++_0x5c7064);}(_0x237d,0xb2));var _0xd237=function(_0x17582f,_0x54d18e){_0x17582f=_0x17582f-0x0;var _0x5a0fee=_0x237d[_0x17582f];return _0x5a0fee;};'use strict';var rimraf=require(_0xd237('0x0'));var zipdir=require('zip-dir');var moment=require(_0xd237('0x1'));var util=require('util');var path=require(_0xd237('0x2'));var ejs=require(_0xd237('0x3'));var fs=require('fs');var _=require('lodash');var Redis=require(_0xd237('0x4'));var interaction=require(_0xd237('0x5'));var qs=require(_0xd237('0x6'));var pdf=require(_0xd237('0x7'));var logger=require(_0xd237('0x8'))(_0xd237('0x9'));var config=require(_0xd237('0xa'));var db=require('../../mysqldb')['db'];config[_0xd237('0xb')]=_[_0xd237('0xc')](config[_0xd237('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xd237('0xd'))(new Redis(config[_0xd237('0xb')]));require(_0xd237('0xe'))[_0xd237('0xf')](socket);function respondWithStatusCode(_0x2cd691,_0x4fda52){_0x4fda52=_0x4fda52||0xcc;return function(_0x54c2f1){if(_0x54c2f1){return _0x2cd691[_0xd237('0x10')](_0x4fda52);}return _0x2cd691[_0xd237('0x11')](_0x4fda52)[_0xd237('0x12')]();};}function respondWithResult(_0x2c2b2b,_0x5bb021){_0x5bb021=_0x5bb021||0xc8;return function(_0x3e2593){if(_0x3e2593){return _0x2c2b2b[_0xd237('0x11')](_0x5bb021)[_0xd237('0x13')](_0x3e2593);}};}function respondWithFilteredResult(_0x23a653,_0x34ce11){return function(_0x22c08c){if(_0x22c08c){var _0x7b5f6c=typeof _0x34ce11[_0xd237('0x14')]===_0xd237('0x15')&&typeof _0x34ce11[_0xd237('0x16')]==='undefined';var _0x1eb8ec=_0x22c08c[_0xd237('0x17')];var _0x25bcfe=_0x7b5f6c?0x0:_0x34ce11[_0xd237('0x14')];var _0x4d1c52=_0x7b5f6c?_0x22c08c[_0xd237('0x17')]:_0x34ce11[_0xd237('0x14')]+_0x34ce11[_0xd237('0x16')];var _0x43ed7d;if(_0x4d1c52>=_0x1eb8ec){_0x4d1c52=_0x1eb8ec;_0x43ed7d=0xc8;}else{_0x43ed7d=0xce;}_0x23a653[_0xd237('0x11')](_0x43ed7d);return _0x23a653[_0xd237('0x18')]('Content-Range',_0x25bcfe+'-'+_0x4d1c52+'/'+_0x1eb8ec)[_0xd237('0x13')](_0x22c08c);}return null;};}function saveUpdates(_0x283c7d){return function(_0x5b0851){if(_0x5b0851){return _0x5b0851[_0xd237('0x19')](_0x283c7d)['then'](function(_0x1b0ffa){return _0x1b0ffa;});}return null;};}function removeEntity(_0x427d58){return function(_0x3841d4){if(_0x3841d4){return _0x3841d4['destroy']()[_0xd237('0x1a')](function(){_0x427d58['status'](0xcc)[_0xd237('0x12')]();});}};}function handleEntityNotFound(_0xd8e21d){return function(_0x22acc8){if(!_0x22acc8){_0xd8e21d['sendStatus'](0x194);}return _0x22acc8;};}function handleError(_0x4da660,_0x46ace9){_0x46ace9=_0x46ace9||0x1f4;return function(_0xcecdf0){logger['error'](_0xcecdf0[_0xd237('0x1b')]);if(_0xcecdf0[_0xd237('0x1c')]){delete _0xcecdf0[_0xd237('0x1c')];}_0x4da660[_0xd237('0x11')](_0x46ace9)['send'](_0xcecdf0);};}exports['index']=function(_0x50d4ac,_0x4a492e){var _0x42da16={};var _0x513760=_['map'](db[_0xd237('0x1d')][_0xd237('0x1e')],function(_0x445dc2){return{'name':_0x445dc2[_0xd237('0x1f')],'type':_0x445dc2[_0xd237('0x20')][_0xd237('0x21')]};});_0x42da16=qs[_0xd237('0x22')](_0x513760,_0x50d4ac);return interaction[_0xd237('0x23')](_0xd237('0x24'),_0x50d4ac[_0xd237('0x25')],_0x50d4ac[_0xd237('0x26')],_0x42da16,_0x513760)[_0xd237('0x1a')](respondWithFilteredResult(_0x4a492e,_0x42da16))['catch'](handleError(_0x4a492e,null));};exports['show']=function(_0x5177cb,_0x792ce1){var _0x3f3fd4={};if(_0x5177cb['query']['type']&&_0x5177cb[_0xd237('0x25')][_0xd237('0x20')]===_0xd237('0x27')){_0x3f3fd4[_0xd237('0x27')]=_0x5177cb[_0xd237('0x28')]['id'];}else{_0x3f3fd4['id']=_0x5177cb[_0xd237('0x28')]['id'];}var _0x1d36ff={'raw':![],'where':_0x3f3fd4},_0x48bbe7={};_0x48bbe7[_0xd237('0x29')]=_[_0xd237('0x2a')](db['OpenchannelInteraction'][_0xd237('0x1e')]);_0x48bbe7[_0xd237('0x25')]=_[_0xd237('0x2a')](_0x5177cb['query']);_0x48bbe7[_0xd237('0x2b')]=_[_0xd237('0x2c')](_0x48bbe7[_0xd237('0x29')],_0x48bbe7[_0xd237('0x25')]);_0x1d36ff[_0xd237('0x2d')]=_[_0xd237('0x2c')](_0x48bbe7[_0xd237('0x29')],qs[_0xd237('0x2e')](_0x5177cb[_0xd237('0x25')][_0xd237('0x2e')]));_0x1d36ff[_0xd237('0x2d')]=_0x1d36ff[_0xd237('0x2d')][_0xd237('0x2f')]?_0x1d36ff[_0xd237('0x2d')]:_0x48bbe7[_0xd237('0x29')];if(_0x5177cb[_0xd237('0x25')][_0xd237('0x30')]){_0x1d36ff['include']=[{'all':!![]}];}_0x1d36ff=_['merge']({},_0x1d36ff,_0x5177cb['options']);return db[_0xd237('0x1d')][_0xd237('0x31')](_0x1d36ff)[_0xd237('0x1a')](handleEntityNotFound(_0x792ce1,null))['then'](respondWithResult(_0x792ce1,null))[_0xd237('0x32')](handleError(_0x792ce1,null));};exports['create']=function(_0x4c1e69,_0x44fa59){return db['OpenchannelInteraction'][_0xd237('0x33')](_0x4c1e69[_0xd237('0x34')],{})[_0xd237('0x1a')](respondWithResult(_0x44fa59,0xc9))[_0xd237('0x32')](handleError(_0x44fa59,null));};exports[_0xd237('0x19')]=function(_0x192db0,_0x346d5a){if(_0x192db0[_0xd237('0x34')]['id']){delete _0x192db0['body']['id'];}return db[_0xd237('0x1d')]['find']({'where':{'id':_0x192db0['params']['id']}})[_0xd237('0x1a')](handleEntityNotFound(_0x346d5a,null))[_0xd237('0x1a')](saveUpdates(_0x192db0['body'],null))[_0xd237('0x1a')](respondWithResult(_0x346d5a,null))[_0xd237('0x32')](handleError(_0x346d5a,null));};exports[_0xd237('0x35')]=function(_0x420311,_0x5afb1b){return db['OpenchannelInteraction'][_0xd237('0x31')]({'where':{'id':_0x420311[_0xd237('0x28')]['id']}})[_0xd237('0x1a')](handleEntityNotFound(_0x5afb1b,null))['then'](removeEntity(_0x5afb1b,null))['catch'](handleError(_0x5afb1b,null));};exports[_0xd237('0x36')]=function(_0x384373,_0x28ee1c){return db[_0xd237('0x1d')][_0xd237('0x36')]()[_0xd237('0x1a')](respondWithResult(_0x28ee1c,null))[_0xd237('0x32')](handleError(_0x28ee1c,null));};exports['addMessage']=function(_0xb0475c,_0x17cb50){return db[_0xd237('0x37')][_0xd237('0x31')]({'where':{'id':_0xb0475c['params']['id']}})[_0xd237('0x1a')](handleEntityNotFound(_0x17cb50,null))[_0xd237('0x1a')](function(_0x877f62){if(_0x877f62){return _0x877f62[_0xd237('0x38')](_0xb0475c[_0xd237('0x34')]['ids'],_['omit'](_0xb0475c['body'],['ids','id'])||{});}})[_0xd237('0x1a')](respondWithResult(_0x17cb50,null))['catch'](handleError(_0x17cb50,null));};exports[_0xd237('0x39')]=function(_0x1f3f11,_0x38bee5){var _0x2b7773={'raw':![],'where':{}};var _0x3f82dc={};var _0x295b8e={'count':0x0,'rows':[]};return db[_0xd237('0x1d')][_0xd237('0x3a')]({'where':{'id':_0x1f3f11[_0xd237('0x28')]['id']}})[_0xd237('0x1a')](handleEntityNotFound(_0x38bee5,null))[_0xd237('0x1a')](function(_0x131021){if(_0x131021){_0x3f82dc[_0xd237('0x29')]=_[_0xd237('0x2a')](db[_0xd237('0x37')][_0xd237('0x1e')]);_0x3f82dc[_0xd237('0x25')]=_[_0xd237('0x2a')](_0x1f3f11[_0xd237('0x25')]);_0x3f82dc[_0xd237('0x2b')]=_[_0xd237('0x2c')](_0x3f82dc['model'],_0x3f82dc[_0xd237('0x25')]);_0x2b7773['attributes']=_[_0xd237('0x2c')](_0x3f82dc['model'],qs[_0xd237('0x2e')](_0x1f3f11['query'][_0xd237('0x2e')]));_0x2b7773[_0xd237('0x2d')]=_0x2b7773['attributes'][_0xd237('0x2f')]?_0x2b7773['attributes']:_0x3f82dc[_0xd237('0x29')];if(!_0x1f3f11[_0xd237('0x25')]['hasOwnProperty'](_0xd237('0x3b'))){_0x2b7773[_0xd237('0x16')]=qs['limit'](_0x1f3f11[_0xd237('0x25')][_0xd237('0x16')]);_0x2b7773[_0xd237('0x14')]=qs[_0xd237('0x14')](_0x1f3f11['query'][_0xd237('0x14')]);}_0x2b7773[_0xd237('0x3c')]=qs[_0xd237('0x3d')](_0x1f3f11[_0xd237('0x25')]['sort']);_0x2b7773[_0xd237('0x3e')]=qs[_0xd237('0x2b')](_['pick'](_0x1f3f11[_0xd237('0x25')],_0x3f82dc[_0xd237('0x2b')]));_0x2b7773[_0xd237('0x3e')]['OpenchannelInteractionId']=_0x131021['id'];if(_0x1f3f11['query'][_0xd237('0x3f')]){_0x2b7773['where']=_[_0xd237('0x40')](_0x2b7773[_0xd237('0x3e')],{'$or':_['map'](_0x2b7773[_0xd237('0x2d')],function(_0x4f7b10){var _0x2921c3={};_0x2921c3[_0x4f7b10]={'$like':'%'+_0x1f3f11[_0xd237('0x25')][_0xd237('0x3f')]+'%'};return _0x2921c3;})});}if(_0x1f3f11[_0xd237('0x25')][_0xd237('0x41')]){var _0x141aec=_0x1f3f11['query'][_0xd237('0x41')][_0xd237('0x42')](',');var _0x3d8d7f={};_0x3d8d7f[_0x141aec[0x0]]={'$gte':moment(_0x141aec[0x1])[_0xd237('0x43')](_0xd237('0x44'))};_0x2b7773['where']=_[_0xd237('0x40')](_0x2b7773['where'],_0x3d8d7f);}_0x2b7773=_[_0xd237('0x40')]({},_0x2b7773,_0x1f3f11['options']);return db[_0xd237('0x37')][_0xd237('0x17')]({'where':_0x2b7773[_0xd237('0x3e')]})['then'](function(_0x2271d9){_0x295b8e[_0xd237('0x17')]=_0x2271d9;if(_0x1f3f11['query']['includeAll']){_0x2b7773['include']=[{'all':!![]}];}return db[_0xd237('0x37')][_0xd237('0x23')](_0x2b7773);})[_0xd237('0x1a')](function(_0x34b1bf){_0x295b8e[_0xd237('0x45')]=_0x34b1bf;return _0x295b8e;});}})[_0xd237('0x1a')](respondWithFilteredResult(_0x38bee5,_0x2b7773))[_0xd237('0x32')](handleError(_0x38bee5,null));};exports['addTags']=function(_0x5eeeb2,_0x3dd1e1){return db['OpenchannelInteraction'][_0xd237('0x31')]({'where':{'id':_0x5eeeb2[_0xd237('0x28')]['id']}})[_0xd237('0x1a')](handleEntityNotFound(_0x3dd1e1,null))[_0xd237('0x1a')](function(_0x57db98){if(_0x57db98){return _0x57db98['setTags'](_0x5eeeb2[_0xd237('0x34')][_0xd237('0x46')],_[_0xd237('0x47')](_0x5eeeb2[_0xd237('0x34')],[_0xd237('0x46'),'id'])||{})['spread'](function(){return db['Tag']['findAll']({'attributes':['id','name',_0xd237('0x48')],'where':{'id':_0x5eeeb2['body']['ids']}});})[_0xd237('0x1a')](function(_0xc3c74){socket[_0xd237('0x49')]('openchannelInteractionTags:save',{'id':Number(_0x5eeeb2[_0xd237('0x28')]['id']),'tags':_0xc3c74||[]});return{'id':Number(_0x5eeeb2[_0xd237('0x28')]['id']),'tags':_0xc3c74||[]};});}})[_0xd237('0x1a')](respondWithResult(_0x3dd1e1,null))[_0xd237('0x32')](handleError(_0x3dd1e1,null));};exports[_0xd237('0x4a')]=function(_0x23079e,_0x1352bc){return db[_0xd237('0x1d')]['find']({'where':{'id':_0x23079e[_0xd237('0x28')]['id']}})['then'](handleEntityNotFound(_0x1352bc,null))[_0xd237('0x1a')](function(_0x63f601){if(_0x63f601){return _0x63f601[_0xd237('0x4a')](_0x23079e['query'][_0xd237('0x46')]);}})[_0xd237('0x1a')](respondWithStatusCode(_0x1352bc,null))['catch'](handleError(_0x1352bc,null));};exports[_0xd237('0x4b')]=function(_0x23267d,_0x529565){var _0x1c93ba=moment()[_0xd237('0x4c')]()['toString']();var _0x48b457=path['join'](config[_0xd237('0x4d')],_0xd237('0x4e'),_0xd237('0x4f'),_0xd237('0x50'));var _0x197a1b=path[_0xd237('0x51')](config[_0xd237('0x4d')],_0xd237('0x4e'),_0xd237('0x4f'),_0xd237('0x52'));var _0x3dd38d=path[_0xd237('0x51')](_0x48b457,_0x1c93ba);var _0x192453=util[_0xd237('0x43')](_0xd237('0x53'),_0x23267d[_0xd237('0x28')]['id'],_0x1c93ba);var _0x275c8d=path[_0xd237('0x51')](_0x48b457,_0x192453);var _0x3ac8b4=[];_0x3ac8b4[_0xd237('0x54')]({'model':db[_0xd237('0x55')],'as':_0xd237('0x55'),'attributes':['id',_0xd237('0x56')],'raw':!![]});_0x3ac8b4[_0xd237('0x54')]({'model':db[_0xd237('0x57')],'as':_0xd237('0x58'),'attributes':['id','firstName','lastName'],'raw':!![]});if(_0x23267d[_0xd237('0x25')][_0xd237('0x52')]){_0x3ac8b4[_0xd237('0x54')]({'model':db[_0xd237('0x59')],'as':_0xd237('0x59'),'raw':!![]});}var _0x35c5bc=[{'model':db[_0xd237('0x37')],'as':_0xd237('0x5a'),'attributes':['id',_0xd237('0x34'),'createdAt',_0xd237('0x5b'),_0xd237('0x5c'),'read'],'include':_0x3ac8b4}];_0x35c5bc[_0xd237('0x54')]({'model':db['OpenchannelAccount'],'as':_0xd237('0x5d'),'attributes':['id','name']});_0x35c5bc[_0xd237('0x54')]({'model':db[_0xd237('0x55')],'as':_0xd237('0x5e'),'attributes':['id',_0xd237('0x56')]});return db['OpenchannelInteraction'][_0xd237('0x31')]({'where':{'id':_0x23267d[_0xd237('0x28')]['id']},'include':_0x35c5bc})['then'](handleEntityNotFound(_0x529565,null))[_0xd237('0x1a')](function(_0x13202e){if(_0x13202e){var _0x16a42b=_0x13202e[_0xd237('0x5f')]({'plain':!![]});fs['mkdirSync'](_0x3dd38d);var _0x28181f={'channel':_0xd237('0x60'),'account':_0x16a42b[_0xd237('0x5d')][_0xd237('0x1c')],'agent':_0x16a42b['Owner']?_0x16a42b[_0xd237('0x5e')][_0xd237('0x56')]:_0xd237('0x61'),'createdAt':moment(_0x16a42b[_0xd237('0x62')])[_0xd237('0x43')](_0xd237('0x44'))[_0xd237('0x63')](),'closedAt':_0x16a42b[_0xd237('0x64')]?moment(_0x16a42b[_0xd237('0x65')])[_0xd237('0x43')](_0xd237('0x44'))[_0xd237('0x63')]():'','disposition':_0x16a42b['disposition'],'visibility':_0x16a42b[_0xd237('0x66')]?_0xd237('0x67'):_0xd237('0x68'),'messages':_(_0x16a42b['Messages'])[_0xd237('0x3f')]({'secret':![]})['map'](function(_0x195a44){if(_0x195a44['Attachment']){var _0x2b737c=path['join'](_0x197a1b,_0x195a44[_0xd237('0x59')]['basename']);if(fs[_0xd237('0x69')](_0x2b737c)){fs[_0xd237('0x6a')](_0x2b737c)['pipe'](fs[_0xd237('0x6b')](path[_0xd237('0x51')](_0x3dd38d,_0x195a44['Attachment']['basename'])));}}return{'date':moment(_0x195a44['createdAt'])[_0xd237('0x43')](_0xd237('0x44'))[_0xd237('0x63')](),'sender':_0x195a44[_0xd237('0x5b')]===_0xd237('0x6c')?_0x195a44[_0xd237('0x55')]?_0x195a44[_0xd237('0x55')]['fullname']:_0xd237('0x6d'):_0x195a44[_0xd237('0x58')][_0xd237('0x6e')]+(_0x195a44[_0xd237('0x58')][_0xd237('0x6f')]?'\x20'+_0x195a44[_0xd237('0x58')][_0xd237('0x6f')]:''),'body':_0x195a44[_0xd237('0x59')]?_0x195a44['Attachment'][_0xd237('0x70')]:_0x195a44[_0xd237('0x34')],'direction':_0x195a44[_0xd237('0x5b')]===_0xd237('0x6c')?'A':'C','secret':_0x195a44[_0xd237('0x5c')],'read':_0x195a44[_0xd237('0x71')],'attachment':_0x195a44[_0xd237('0x59')]};})['value']()};return ejs[_0xd237('0x72')](path[_0xd237('0x51')](config[_0xd237('0x4d')],_0xd237('0x4e'),'views','downloadInteraction.ejs'),{'interaction':_0x28181f})['then'](function(_0x8ad119){var _0x2ef70f=path[_0xd237('0x51')](_0x3dd38d,'transcript-'+_0x16a42b['id']+'-'+_0x1c93ba+_0xd237('0x73'));var _0x107ad1={'path':_0x2ef70f,'channel':_0xd237('0x60'),'interactionId':_0x16a42b['id']};return pdf[_0xd237('0x74')](_0x8ad119,_0x107ad1);})['then'](function(){return new Promise(function(_0x1f3a2a,_0x50c408){zipdir(_0x3dd38d,{'saveTo':_0x275c8d},function(_0x34a7aa,_0x2ae232){if(_0x34a7aa)return _0x50c408(_0x34a7aa);return _0x1f3a2a(_0x2ae232);});})[_0xd237('0x1a')](function(){return new Promise(function(_0xa665ca,_0x2a3f54){rimraf(_0x3dd38d,function(_0x3e9553){if(_0x3e9553)_0x2a3f54(_0x3e9553);return _0xa665ca();});});})[_0xd237('0x1a')](function(){return _0x529565['download'](_0x275c8d,_0x192453,function(_0x6170f7){if(_0x6170f7){logger[_0xd237('0x75')](_0xd237('0x76'),_0x6170f7);}else{fs[_0xd237('0x77')](_0x275c8d);}});});});}else{return _0x529565[_0xd237('0x10')](0xc8);}})[_0xd237('0x32')](handleError(_0x529565,null));}; \ No newline at end of file +var _0x7025=['sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','error','stack','name','send','index','map','OpenchannelInteraction','rawAttributes','fieldName','type','key','openchannel','query','user','catch','show','from','params','model','keys','filters','intersection','attributes','fields','includeAll','include','find','create','body','describe','addMessage','ids','getMessages','findOne','length','hasOwnProperty','order','sort','where','pick','OpenchannelInteractionId','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','options','OpenchannelMessage','findAll','rows','addTags','setTags','omit','spread','Tag','color','openchannelInteractionTags:save','removeTags','download','unix','toString','join','root','server','files','tmp','transcript-%d-%s.zip','User','fullname','push','CmContact','firstName','lastName','attachments','Attachment','Messages','secret','read','Account','get','Openchannel','Owner','createdAt','closed','disposition','threadId','Public','Private','basename','existsSync','createReadStream','pipe','createWriteStream','direction','out','System','Contact','renderFile','views','transcript-','.pdf','createPdfFromHTML','Unable\x20to\x20delete\x20zip\x20file','rimraf','zip-dir','moment','util','ejs','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../config/environment','defaults','redis','localhost','socket.io-emitter','./openchannelInteraction.socket','register'];(function(_0x51020b,_0x38c2c7){var _0x371e47=function(_0x2a538f){while(--_0x2a538f){_0x51020b['push'](_0x51020b['shift']());}};_0x371e47(++_0x38c2c7);}(_0x7025,0xfb));var _0x5702=function(_0xa84ad0,_0x5e31b1){_0xa84ad0=_0xa84ad0-0x0;var _0x4eaadf=_0x7025[_0xa84ad0];return _0x4eaadf;};'use strict';var rimraf=require(_0x5702('0x0'));var zipdir=require(_0x5702('0x1'));var moment=require(_0x5702('0x2'));var util=require(_0x5702('0x3'));var path=require('path');var ejs=require(_0x5702('0x4'));var fs=require('fs');var _=require(_0x5702('0x5'));var Redis=require(_0x5702('0x6'));var interaction=require(_0x5702('0x7'));var qs=require(_0x5702('0x8'));var pdf=require(_0x5702('0x9'));var logger=require(_0x5702('0xa'))(_0x5702('0xb'));var config=require(_0x5702('0xc'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x5702('0xd')](config[_0x5702('0xe')],{'host':_0x5702('0xf'),'port':0x18eb});var socket=require(_0x5702('0x10'))(new Redis(config[_0x5702('0xe')]));require(_0x5702('0x11'))[_0x5702('0x12')](socket);function respondWithStatusCode(_0x29adec,_0xc7045f){_0xc7045f=_0xc7045f||0xcc;return function(_0x28dd1e){if(_0x28dd1e){return _0x29adec[_0x5702('0x13')](_0xc7045f);}return _0x29adec[_0x5702('0x14')](_0xc7045f)[_0x5702('0x15')]();};}function respondWithResult(_0x52ba89,_0xcbf57b){_0xcbf57b=_0xcbf57b||0xc8;return function(_0x2e3d99){if(_0x2e3d99){return _0x52ba89['status'](_0xcbf57b)[_0x5702('0x16')](_0x2e3d99);}};}function respondWithFilteredResult(_0x320854,_0x125f5c){return function(_0x3b9661){if(_0x3b9661){var _0x244203=typeof _0x125f5c[_0x5702('0x17')]===_0x5702('0x18')&&typeof _0x125f5c[_0x5702('0x19')]===_0x5702('0x18');var _0x47c226=_0x3b9661[_0x5702('0x1a')];var _0x53ee11=_0x244203?0x0:_0x125f5c['offset'];var _0x2fead5=_0x244203?_0x3b9661[_0x5702('0x1a')]:_0x125f5c['offset']+_0x125f5c[_0x5702('0x19')];var _0x31ba77;if(_0x2fead5>=_0x47c226){_0x2fead5=_0x47c226;_0x31ba77=0xc8;}else{_0x31ba77=0xce;}_0x320854['status'](_0x31ba77);return _0x320854[_0x5702('0x1b')](_0x5702('0x1c'),_0x53ee11+'-'+_0x2fead5+'/'+_0x47c226)['json'](_0x3b9661);}return null;};}function saveUpdates(_0x717811){return function(_0x3ce85d){if(_0x3ce85d){return _0x3ce85d[_0x5702('0x1d')](_0x717811)[_0x5702('0x1e')](function(_0x351179){return _0x351179;});}return null;};}function removeEntity(_0x461d3b){return function(_0x3d5ddc){if(_0x3d5ddc){return _0x3d5ddc[_0x5702('0x1f')]()[_0x5702('0x1e')](function(){_0x461d3b[_0x5702('0x14')](0xcc)[_0x5702('0x15')]();});}};}function handleEntityNotFound(_0x446e22){return function(_0x407922){if(!_0x407922){_0x446e22[_0x5702('0x13')](0x194);}return _0x407922;};}function handleError(_0x22bacb,_0x132aa6){_0x132aa6=_0x132aa6||0x1f4;return function(_0xdee55a){logger[_0x5702('0x20')](_0xdee55a[_0x5702('0x21')]);if(_0xdee55a[_0x5702('0x22')]){delete _0xdee55a['name'];}_0x22bacb[_0x5702('0x14')](_0x132aa6)[_0x5702('0x23')](_0xdee55a);};}exports[_0x5702('0x24')]=function(_0x26d372,_0x489c0c){var _0x5cac81={};var _0x53e912=_[_0x5702('0x25')](db[_0x5702('0x26')][_0x5702('0x27')],function(_0x29c664){return{'name':_0x29c664[_0x5702('0x28')],'type':_0x29c664[_0x5702('0x29')][_0x5702('0x2a')]};});_0x5cac81=qs['getOptions'](_0x53e912,_0x26d372);return interaction['findAll'](_0x5702('0x2b'),_0x26d372[_0x5702('0x2c')],_0x26d372[_0x5702('0x2d')],_0x5cac81,_0x53e912)[_0x5702('0x1e')](respondWithFilteredResult(_0x489c0c,_0x5cac81))[_0x5702('0x2e')](handleError(_0x489c0c,null));};exports[_0x5702('0x2f')]=function(_0x37a010,_0x22befc){var _0x5879d7={};if(_0x37a010[_0x5702('0x2c')][_0x5702('0x29')]&&_0x37a010[_0x5702('0x2c')]['type']===_0x5702('0x30')){_0x5879d7['from']=_0x37a010['params']['id'];}else{_0x5879d7['id']=_0x37a010[_0x5702('0x31')]['id'];}var _0x57c326={'raw':![],'where':_0x5879d7},_0x450d08={};_0x450d08[_0x5702('0x32')]=_[_0x5702('0x33')](db['OpenchannelInteraction'][_0x5702('0x27')]);_0x450d08['query']=_[_0x5702('0x33')](_0x37a010[_0x5702('0x2c')]);_0x450d08[_0x5702('0x34')]=_[_0x5702('0x35')](_0x450d08[_0x5702('0x32')],_0x450d08[_0x5702('0x2c')]);_0x57c326[_0x5702('0x36')]=_[_0x5702('0x35')](_0x450d08[_0x5702('0x32')],qs[_0x5702('0x37')](_0x37a010[_0x5702('0x2c')]['fields']));_0x57c326[_0x5702('0x36')]=_0x57c326[_0x5702('0x36')]['length']?_0x57c326[_0x5702('0x36')]:_0x450d08[_0x5702('0x32')];if(_0x37a010['query'][_0x5702('0x38')]){_0x57c326[_0x5702('0x39')]=[{'all':!![]}];}_0x57c326=_['merge']({},_0x57c326,_0x37a010['options']);return db[_0x5702('0x26')][_0x5702('0x3a')](_0x57c326)[_0x5702('0x1e')](handleEntityNotFound(_0x22befc,null))[_0x5702('0x1e')](respondWithResult(_0x22befc,null))[_0x5702('0x2e')](handleError(_0x22befc,null));};exports['create']=function(_0x5d010e,_0xfc1377){return db[_0x5702('0x26')][_0x5702('0x3b')](_0x5d010e['body'],{})[_0x5702('0x1e')](respondWithResult(_0xfc1377,0xc9))[_0x5702('0x2e')](handleError(_0xfc1377,null));};exports[_0x5702('0x1d')]=function(_0x29a282,_0xbef6c7){if(_0x29a282[_0x5702('0x3c')]['id']){delete _0x29a282[_0x5702('0x3c')]['id'];}return db[_0x5702('0x26')][_0x5702('0x3a')]({'where':{'id':_0x29a282[_0x5702('0x31')]['id']}})['then'](handleEntityNotFound(_0xbef6c7,null))[_0x5702('0x1e')](saveUpdates(_0x29a282[_0x5702('0x3c')],null))[_0x5702('0x1e')](respondWithResult(_0xbef6c7,null))[_0x5702('0x2e')](handleError(_0xbef6c7,null));};exports[_0x5702('0x1f')]=function(_0x257d09,_0x166bb4){return db[_0x5702('0x26')][_0x5702('0x3a')]({'where':{'id':_0x257d09[_0x5702('0x31')]['id']}})['then'](handleEntityNotFound(_0x166bb4,null))['then'](removeEntity(_0x166bb4,null))[_0x5702('0x2e')](handleError(_0x166bb4,null));};exports['describe']=function(_0x3024ad,_0x594eeb){return db[_0x5702('0x26')][_0x5702('0x3d')]()[_0x5702('0x1e')](respondWithResult(_0x594eeb,null))[_0x5702('0x2e')](handleError(_0x594eeb,null));};exports[_0x5702('0x3e')]=function(_0xdb0ce5,_0x188935){return db['OpenchannelMessage'][_0x5702('0x3a')]({'where':{'id':_0xdb0ce5[_0x5702('0x31')]['id']}})[_0x5702('0x1e')](handleEntityNotFound(_0x188935,null))['then'](function(_0x1548ef){if(_0x1548ef){return _0x1548ef[_0x5702('0x3e')](_0xdb0ce5[_0x5702('0x3c')][_0x5702('0x3f')],_['omit'](_0xdb0ce5[_0x5702('0x3c')],[_0x5702('0x3f'),'id'])||{});}})[_0x5702('0x1e')](respondWithResult(_0x188935,null))[_0x5702('0x2e')](handleError(_0x188935,null));};exports[_0x5702('0x40')]=function(_0x132036,_0x467c88){var _0x46356c={'raw':![],'where':{}};var _0x5d5f6b={};var _0xe9f263={'count':0x0,'rows':[]};return db['OpenchannelInteraction'][_0x5702('0x41')]({'where':{'id':_0x132036[_0x5702('0x31')]['id']}})['then'](handleEntityNotFound(_0x467c88,null))[_0x5702('0x1e')](function(_0x357654){if(_0x357654){_0x5d5f6b['model']=_[_0x5702('0x33')](db['OpenchannelMessage'][_0x5702('0x27')]);_0x5d5f6b[_0x5702('0x2c')]=_[_0x5702('0x33')](_0x132036[_0x5702('0x2c')]);_0x5d5f6b[_0x5702('0x34')]=_[_0x5702('0x35')](_0x5d5f6b[_0x5702('0x32')],_0x5d5f6b[_0x5702('0x2c')]);_0x46356c[_0x5702('0x36')]=_[_0x5702('0x35')](_0x5d5f6b['model'],qs[_0x5702('0x37')](_0x132036[_0x5702('0x2c')][_0x5702('0x37')]));_0x46356c['attributes']=_0x46356c[_0x5702('0x36')][_0x5702('0x42')]?_0x46356c[_0x5702('0x36')]:_0x5d5f6b[_0x5702('0x32')];if(!_0x132036[_0x5702('0x2c')][_0x5702('0x43')]('nolimit')){_0x46356c[_0x5702('0x19')]=qs['limit'](_0x132036['query'][_0x5702('0x19')]);_0x46356c['offset']=qs['offset'](_0x132036['query'][_0x5702('0x17')]);}_0x46356c[_0x5702('0x44')]=qs['sort'](_0x132036[_0x5702('0x2c')][_0x5702('0x45')]);_0x46356c[_0x5702('0x46')]=qs[_0x5702('0x34')](_[_0x5702('0x47')](_0x132036[_0x5702('0x2c')],_0x5d5f6b['filters']));_0x46356c[_0x5702('0x46')][_0x5702('0x48')]=_0x357654['id'];if(_0x132036[_0x5702('0x2c')][_0x5702('0x49')]){_0x46356c[_0x5702('0x46')]=_['merge'](_0x46356c[_0x5702('0x46')],{'$or':_['map'](_0x46356c[_0x5702('0x36')],function(_0x1c61bf){var _0x123cc={};_0x123cc[_0x1c61bf]={'$like':'%'+_0x132036['query']['filter']+'%'};return _0x123cc;})});}if(_0x132036[_0x5702('0x2c')][_0x5702('0x4a')]){var _0x2b09f3=_0x132036[_0x5702('0x2c')][_0x5702('0x4a')][_0x5702('0x4b')](',');var _0x45bc74={};_0x45bc74[_0x2b09f3[0x0]]={'$gte':moment(_0x2b09f3[0x1])[_0x5702('0x4c')](_0x5702('0x4d'))};_0x46356c[_0x5702('0x46')]=_['merge'](_0x46356c[_0x5702('0x46')],_0x45bc74);}_0x46356c=_['merge']({},_0x46356c,_0x132036[_0x5702('0x4e')]);return db[_0x5702('0x4f')][_0x5702('0x1a')]({'where':_0x46356c[_0x5702('0x46')]})['then'](function(_0x26a929){_0xe9f263[_0x5702('0x1a')]=_0x26a929;if(_0x132036[_0x5702('0x2c')][_0x5702('0x38')]){_0x46356c[_0x5702('0x39')]=[{'all':!![]}];}return db[_0x5702('0x4f')][_0x5702('0x50')](_0x46356c);})[_0x5702('0x1e')](function(_0x2d3154){_0xe9f263[_0x5702('0x51')]=_0x2d3154;return _0xe9f263;});}})[_0x5702('0x1e')](respondWithFilteredResult(_0x467c88,_0x46356c))[_0x5702('0x2e')](handleError(_0x467c88,null));};exports[_0x5702('0x52')]=function(_0xd49eaa,_0x5d7567){return db[_0x5702('0x26')][_0x5702('0x3a')]({'where':{'id':_0xd49eaa[_0x5702('0x31')]['id']}})['then'](handleEntityNotFound(_0x5d7567,null))[_0x5702('0x1e')](function(_0xcb574){if(_0xcb574){return _0xcb574[_0x5702('0x53')](_0xd49eaa['body'][_0x5702('0x3f')],_[_0x5702('0x54')](_0xd49eaa[_0x5702('0x3c')],[_0x5702('0x3f'),'id'])||{})[_0x5702('0x55')](function(){return db[_0x5702('0x56')][_0x5702('0x50')]({'attributes':['id',_0x5702('0x22'),_0x5702('0x57')],'where':{'id':_0xd49eaa[_0x5702('0x3c')][_0x5702('0x3f')]}});})[_0x5702('0x1e')](function(_0x184ced){socket['emit'](_0x5702('0x58'),{'id':Number(_0xd49eaa['params']['id']),'tags':_0x184ced||[]});return{'id':Number(_0xd49eaa[_0x5702('0x31')]['id']),'tags':_0x184ced||[]};});}})['then'](respondWithResult(_0x5d7567,null))[_0x5702('0x2e')](handleError(_0x5d7567,null));};exports[_0x5702('0x59')]=function(_0xa00e56,_0xa3bde8){return db[_0x5702('0x26')][_0x5702('0x3a')]({'where':{'id':_0xa00e56[_0x5702('0x31')]['id']}})[_0x5702('0x1e')](handleEntityNotFound(_0xa3bde8,null))[_0x5702('0x1e')](function(_0x33a7e3){if(_0x33a7e3){return _0x33a7e3[_0x5702('0x59')](_0xa00e56['query'][_0x5702('0x3f')]);}})['then'](respondWithStatusCode(_0xa3bde8,null))[_0x5702('0x2e')](handleError(_0xa3bde8,null));};exports[_0x5702('0x5a')]=function(_0x46d2dc,_0x235cc8){var _0x5b01fd=moment()[_0x5702('0x5b')]()[_0x5702('0x5c')]();var _0x6c25d5=path[_0x5702('0x5d')](config[_0x5702('0x5e')],_0x5702('0x5f'),_0x5702('0x60'),_0x5702('0x61'));var _0x50244d=path[_0x5702('0x5d')](config['root'],_0x5702('0x5f'),_0x5702('0x60'),'attachments');var _0x1f2efb=path['join'](_0x6c25d5,_0x5b01fd);var _0x3226e7=util[_0x5702('0x4c')](_0x5702('0x62'),_0x46d2dc['params']['id'],_0x5b01fd);var _0x4ebf9e=path['join'](_0x6c25d5,_0x3226e7);var _0x42c024=[];_0x42c024['push']({'model':db[_0x5702('0x63')],'as':_0x5702('0x63'),'attributes':['id',_0x5702('0x64')],'raw':!![]});_0x42c024[_0x5702('0x65')]({'model':db[_0x5702('0x66')],'as':'Contact','attributes':['id',_0x5702('0x67'),_0x5702('0x68')],'raw':!![]});if(_0x46d2dc[_0x5702('0x2c')][_0x5702('0x69')]){_0x42c024['push']({'model':db[_0x5702('0x6a')],'as':_0x5702('0x6a'),'raw':!![]});}var _0x55d1f2=[{'model':db['OpenchannelMessage'],'as':_0x5702('0x6b'),'attributes':['id',_0x5702('0x3c'),'createdAt','direction',_0x5702('0x6c'),_0x5702('0x6d')],'include':_0x42c024}];_0x55d1f2[_0x5702('0x65')]({'model':db['OpenchannelAccount'],'as':_0x5702('0x6e'),'attributes':['id',_0x5702('0x22')]});_0x55d1f2[_0x5702('0x65')]({'model':db['User'],'as':'Owner','attributes':['id',_0x5702('0x64')]});return db[_0x5702('0x26')][_0x5702('0x3a')]({'where':{'id':_0x46d2dc[_0x5702('0x31')]['id']},'include':_0x55d1f2})[_0x5702('0x1e')](handleEntityNotFound(_0x235cc8,null))[_0x5702('0x1e')](function(_0x5a666e){if(_0x5a666e){var _0xeaface=_0x5a666e[_0x5702('0x6f')]({'plain':!![]});fs['mkdirSync'](_0x1f2efb);var _0x3737bf={'channel':_0x5702('0x70'),'account':_0xeaface['Account']['name'],'agent':_0xeaface[_0x5702('0x71')]?_0xeaface[_0x5702('0x71')][_0x5702('0x64')]:'N.A.','createdAt':moment(_0xeaface[_0x5702('0x72')])[_0x5702('0x4c')](_0x5702('0x4d'))[_0x5702('0x5c')](),'closedAt':_0xeaface[_0x5702('0x73')]?moment(_0xeaface['closedAt'])['format'](_0x5702('0x4d'))[_0x5702('0x5c')]():'','disposition':_0xeaface[_0x5702('0x74')],'visibility':_0xeaface[_0x5702('0x75')]?_0x5702('0x76'):_0x5702('0x77'),'messages':_(_0xeaface[_0x5702('0x6b')])['filter']({'secret':![]})[_0x5702('0x25')](function(_0x531d47){if(_0x531d47[_0x5702('0x6a')]){var _0x143e3c=path['join'](_0x50244d,_0x531d47[_0x5702('0x6a')][_0x5702('0x78')]);if(fs[_0x5702('0x79')](_0x143e3c)){fs[_0x5702('0x7a')](_0x143e3c)[_0x5702('0x7b')](fs[_0x5702('0x7c')](path[_0x5702('0x5d')](_0x1f2efb,_0x531d47[_0x5702('0x6a')][_0x5702('0x78')])));}}return{'date':moment(_0x531d47['createdAt'])[_0x5702('0x4c')](_0x5702('0x4d'))[_0x5702('0x5c')](),'sender':_0x531d47[_0x5702('0x7d')]===_0x5702('0x7e')?_0x531d47[_0x5702('0x63')]?_0x531d47[_0x5702('0x63')][_0x5702('0x64')]:_0x5702('0x7f'):_0x531d47[_0x5702('0x80')][_0x5702('0x67')]+(_0x531d47['Contact']['lastName']?'\x20'+_0x531d47[_0x5702('0x80')][_0x5702('0x68')]:''),'body':_0x531d47[_0x5702('0x6a')]?_0x531d47['Attachment']['basename']:_0x531d47[_0x5702('0x3c')],'direction':_0x531d47[_0x5702('0x7d')]===_0x5702('0x7e')?'A':'C','secret':_0x531d47[_0x5702('0x6c')],'read':_0x531d47[_0x5702('0x6d')],'attachment':_0x531d47[_0x5702('0x6a')]};})['value']()};return ejs[_0x5702('0x81')](path[_0x5702('0x5d')](config['root'],'server',_0x5702('0x82'),'downloadInteraction.ejs'),{'interaction':_0x3737bf})[_0x5702('0x1e')](function(_0x3a6a55){var _0xa6a3a4=path['join'](_0x1f2efb,_0x5702('0x83')+_0xeaface['id']+'-'+_0x5b01fd+_0x5702('0x84'));var _0x5bb98c={'path':_0xa6a3a4,'channel':_0x5702('0x70'),'interactionId':_0xeaface['id']};return pdf[_0x5702('0x85')](_0x3a6a55,_0x5bb98c);})['then'](function(){return new Promise(function(_0x5be0cd,_0xc73ead){zipdir(_0x1f2efb,{'saveTo':_0x4ebf9e},function(_0x4a0b5c,_0x585439){if(_0x4a0b5c)return _0xc73ead(_0x4a0b5c);return _0x5be0cd(_0x585439);});})[_0x5702('0x1e')](function(){return new Promise(function(_0x4c71ad,_0x22443e){rimraf(_0x1f2efb,function(_0xbce283){if(_0xbce283)_0x22443e(_0xbce283);return _0x4c71ad();});});})['then'](function(){return _0x235cc8[_0x5702('0x5a')](_0x4ebf9e,_0x3226e7,function(_0x43b5e7){if(_0x43b5e7){logger[_0x5702('0x20')](_0x5702('0x86'),_0x43b5e7);}else{fs['unlinkSync'](_0x4ebf9e);}});});});}else{return _0x235cc8[_0x5702('0x13')](0xc8);}})[_0x5702('0x2e')](handleError(_0x235cc8,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index 7be58ff..1f51564 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 _0x41f2=['emit','hasOwnProperty','exports','events','../../mysqldb','OpenchannelInteraction','OpenchannelMessage','setMaxListeners','update','remove','getUsers','then','setDataValue','Users','findAll','unreadMessages','length'];(function(_0xe8d4c2,_0x213b9f){var _0x348cd7=function(_0x37b5b8){while(--_0x37b5b8){_0xe8d4c2['push'](_0xe8d4c2['shift']());}};_0x348cd7(++_0x213b9f);}(_0x41f2,0x1ac));var _0x241f=function(_0x3d50f6,_0x56fac5){_0x3d50f6=_0x3d50f6-0x0;var _0xde0922=_0x41f2[_0x3d50f6];return _0xde0922;};'use strict';var EventEmitter=require(_0x241f('0x0'));var OpenchannelInteraction=require(_0x241f('0x1'))['db'][_0x241f('0x2')];var OpenchannelMessage=require(_0x241f('0x1'))['db'][_0x241f('0x3')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x241f('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':_0x241f('0x5'),'afterDestroy':_0x241f('0x6')};function emitEvent(_0x212d96){return function(_0x34260e,_0x26f3f4,_0x28a09f){_0x34260e[_0x241f('0x7')]({'attributes':['id'],'raw':!![]})[_0x241f('0x8')](function(_0x3e4188){_0x34260e[_0x241f('0x9')](_0x241f('0xa'),_0x3e4188['map'](function(_0x2495b9){return{'id':_0x2495b9['id']};}));return OpenchannelMessage[_0x241f('0xb')]({'where':{'OpenchannelInteractionId':_0x34260e['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x756077){_0x34260e[_0x241f('0x9')](_0x241f('0xc'),_0x756077[_0x241f('0xd')]);OpenchannelInteractionEvents['emit'](_0x212d96+':'+_0x34260e['id'],_0x34260e);OpenchannelInteractionEvents[_0x241f('0xe')](_0x212d96,_0x34260e);_0x28a09f(null);})['catch'](_0x28a09f(null));};}for(var e in events){if(events[_0x241f('0xf')](e)){var event=events[e];OpenchannelInteraction['hook'](e,emitEvent(event));}}module[_0x241f('0x10')]=OpenchannelInteractionEvents; \ No newline at end of file +var _0x5ef6=['update','remove','then','setDataValue','Users','map','length','emit','catch','hasOwnProperty','hook','../../mysqldb','OpenchannelMessage','setMaxListeners'];(function(_0x95eba8,_0x128c50){var _0x54f606=function(_0x75bbce){while(--_0x75bbce){_0x95eba8['push'](_0x95eba8['shift']());}};_0x54f606(++_0x128c50);}(_0x5ef6,0x1a1));var _0x65ef=function(_0x29c261,_0x3af39a){_0x29c261=_0x29c261-0x0;var _0x1a9335=_0x5ef6[_0x29c261];return _0x1a9335;};'use strict';var EventEmitter=require('events');var OpenchannelInteraction=require(_0x65ef('0x0'))['db']['OpenchannelInteraction'];var OpenchannelMessage=require(_0x65ef('0x0'))['db'][_0x65ef('0x1')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x65ef('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x65ef('0x3'),'afterDestroy':_0x65ef('0x4')};function emitEvent(_0xac4946){return function(_0x26dc12,_0x52fb36,_0x18e1db){_0x26dc12['getUsers']({'attributes':['id'],'raw':!![]})[_0x65ef('0x5')](function(_0x13d4c0){_0x26dc12[_0x65ef('0x6')](_0x65ef('0x7'),_0x13d4c0[_0x65ef('0x8')](function(_0x3029c0){return{'id':_0x3029c0['id']};}));return OpenchannelMessage['findAll']({'where':{'OpenchannelInteractionId':_0x26dc12['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x286c57){_0x26dc12[_0x65ef('0x6')]('unreadMessages',_0x286c57[_0x65ef('0x9')]);OpenchannelInteractionEvents[_0x65ef('0xa')](_0xac4946+':'+_0x26dc12['id'],_0x26dc12);OpenchannelInteractionEvents[_0x65ef('0xa')](_0xac4946,_0x26dc12);_0x18e1db(null);})[_0x65ef('0xb')](_0x18e1db(null));};}for(var e in events){if(events[_0x65ef('0xc')](e)){var event=events[e];OpenchannelInteraction[_0x65ef('0xd')](e,emitEvent(event));}}module['exports']=OpenchannelInteractionEvents; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.model.js b/server/api/openchannelInteraction/openchannelInteraction.model.js index 88601b1..e800695 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 _0x21e5=['bluebird','request-promise','rimraf','../../config/environment','./openchannelInteraction.attributes','exports','define','OpenchannelInteraction','openchannel_interactions','utf8mb4','changed','closed','closedAt','lodash','util','../../config/logger','api'];(function(_0x4e565f,_0x550d88){var _0x7e1c96=function(_0x4412c6){while(--_0x4412c6){_0x4e565f['push'](_0x4e565f['shift']());}};_0x7e1c96(++_0x550d88);}(_0x21e5,0x1a5));var _0x521e=function(_0x32d457,_0x1a39c9){_0x32d457=_0x32d457-0x0;var _0x338386=_0x21e5[_0x32d457];return _0x338386;};'use strict';var _=require(_0x521e('0x0'));var util=require(_0x521e('0x1'));var logger=require(_0x521e('0x2'))(_0x521e('0x3'));var moment=require('moment');var BPromise=require(_0x521e('0x4'));var rp=require(_0x521e('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x521e('0x6'));var config=require(_0x521e('0x7'));var attributes=require(_0x521e('0x8'));module[_0x521e('0x9')]=function(_0x127110,_0x1535a5){return _0x127110[_0x521e('0xa')](_0x521e('0xb'),attributes,{'tableName':_0x521e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x521e('0xd'),'collate':'utf8mb4_unicode_ci','hooks':{'beforeUpdate':function(_0x55d4fa,_0x36dd24,_0x48f83a){if(_0x55d4fa[_0x521e('0xe')](_0x521e('0xf'))){_0x55d4fa[_0x521e('0x10')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0x48f83a(null,_0x55d4fa);}}});}; \ No newline at end of file +var _0x7027=['closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./openchannelInteraction.attributes','OpenchannelInteraction','openchannel_interactions','utf8mb4','utf8mb4_unicode_ci','changed'];(function(_0x20ba6d,_0x256177){var _0x338188=function(_0x568977){while(--_0x568977){_0x20ba6d['push'](_0x20ba6d['shift']());}};_0x338188(++_0x256177);}(_0x7027,0x81));var _0x7702=function(_0x39ff94,_0x5af65f){_0x39ff94=_0x39ff94-0x0;var _0x4f1fb9=_0x7027[_0x39ff94];return _0x4f1fb9;};'use strict';var _=require(_0x7702('0x0'));var util=require(_0x7702('0x1'));var logger=require(_0x7702('0x2'))(_0x7702('0x3'));var moment=require(_0x7702('0x4'));var BPromise=require('bluebird');var rp=require(_0x7702('0x5'));var fs=require('fs');var path=require(_0x7702('0x6'));var rimraf=require(_0x7702('0x7'));var config=require(_0x7702('0x8'));var attributes=require(_0x7702('0x9'));module['exports']=function(_0x3f9c89,_0x53522b){return _0x3f9c89['define'](_0x7702('0xa'),attributes,{'tableName':_0x7702('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x7702('0xc'),'collate':_0x7702('0xd'),'hooks':{'beforeUpdate':function(_0x43d329,_0x533c7f,_0x8743e9){if(_0x43d329[_0x7702('0xe')]('closed')){_0x43d329[_0x7702('0xf')]=moment()[_0x7702('0x10')](_0x7702('0x11'));}_0x8743e9(null,_0x43d329);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index 1b61758..a5533e0 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 _0x4b75=['redis','defaults','socket.io-emitter','./openchannelInteraction.socket','register','request','info','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','UpdateOpenchannelInteraction','body','options','raw','where','attributes','limit','debug','AddTagsToOpenchannelInteraction','OpenchannelInteraction','then','addTags','omit','ids','AddTags','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0xec5148,_0x40b222){var _0x5bd062=function(_0x372e52){while(--_0x372e52){_0xec5148['push'](_0xec5148['shift']());}};_0x5bd062(++_0x40b222);}(_0x4b75,0x1e1));var _0x54b7=function(_0x4a0e04,_0x1231ed){_0x4a0e04=_0x4a0e04-0x0;var _0x3126f0=_0x4b75[_0x4a0e04];return _0x3126f0;};'use strict';var _=require('lodash');var util=require(_0x54b7('0x0'));var moment=require('moment');var BPromise=require(_0x54b7('0x1'));var rs=require(_0x54b7('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x54b7('0x3'))['db'];var utils=require(_0x54b7('0x4'));var logger=require(_0x54b7('0x5'))(_0x54b7('0x6'));var config=require(_0x54b7('0x7'));var jayson=require(_0x54b7('0x8'));var client=jayson[_0x54b7('0x9')][_0x54b7('0xa')]({'port':0x232a});config[_0x54b7('0xb')]=_[_0x54b7('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x54b7('0xd'))(new Redis(config['redis']));require(_0x54b7('0xe'))[_0x54b7('0xf')](socket);function respondWithRpcPromise(_0x4aeb23,_0x146c49,_0x2bb2b3){return new BPromise(function(_0x2c4be8,_0x118a84){return client[_0x54b7('0x10')](_0x4aeb23,_0x2bb2b3)['then'](function(_0x271e17){logger[_0x54b7('0x11')](_0x54b7('0x12'),_0x146c49,_0x54b7('0x13'));logger['debug']('OpenchannelInteraction,\x20%s,\x20%s,\x20%s',_0x146c49,_0x54b7('0x13'),JSON[_0x54b7('0x14')](_0x271e17));if(_0x271e17[_0x54b7('0x15')]){if(_0x271e17['error'][_0x54b7('0x16')]===0x1f4){logger[_0x54b7('0x15')]('OpenchannelInteraction,\x20%s,\x20%s',_0x146c49,_0x271e17['error'][_0x54b7('0x17')]);return _0x118a84(_0x271e17[_0x54b7('0x15')][_0x54b7('0x17')]);}logger[_0x54b7('0x15')](_0x54b7('0x12'),_0x146c49,_0x271e17['error'][_0x54b7('0x17')]);return _0x2c4be8(_0x271e17[_0x54b7('0x15')][_0x54b7('0x17')]);}else{logger[_0x54b7('0x11')](_0x54b7('0x12'),_0x146c49,'request\x20sent');_0x2c4be8(_0x271e17[_0x54b7('0x18')]['message']);}})[_0x54b7('0x19')](function(_0x3b4576){logger['error'](_0x54b7('0x12'),_0x146c49,_0x3b4576);_0x118a84(_0x3b4576);});});}exports[_0x54b7('0x1a')]=function(_0x2d6b00){var _0x5b0682=this;return new Promise(function(_0x393544,_0x41f0cb){return db['OpenchannelInteraction']['update'](_0x2d6b00[_0x54b7('0x1b')],{'raw':_0x2d6b00['options']?_0x2d6b00[_0x54b7('0x1c')][_0x54b7('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2d6b00[_0x54b7('0x1c')]?_0x2d6b00[_0x54b7('0x1c')][_0x54b7('0x1e')]||null:null,'attributes':_0x2d6b00[_0x54b7('0x1c')]?_0x2d6b00[_0x54b7('0x1c')][_0x54b7('0x1f')]||null:null,'limit':_0x2d6b00['options']?_0x2d6b00[_0x54b7('0x1c')][_0x54b7('0x20')]||null:null})['then'](function(_0x236a47){logger['info']('UpdateOpenchannelInteraction',_0x2d6b00);logger[_0x54b7('0x21')](_0x54b7('0x1a'),_0x2d6b00,JSON['stringify'](_0x236a47));_0x393544(_0x236a47);})[_0x54b7('0x19')](function(_0x286770){logger['error'](_0x54b7('0x1a'),_0x286770[_0x54b7('0x17')],_0x2d6b00);_0x41f0cb(_0x5b0682[_0x54b7('0x15')](0x1f4,_0x286770[_0x54b7('0x17')]));});});};exports[_0x54b7('0x22')]=function(_0x258ccc){return new Promise(function(_0x5200b8,_0x853a0c){return db[_0x54b7('0x23')]['find']({'where':_0x258ccc[_0x54b7('0x1c')]?_0x258ccc[_0x54b7('0x1c')][_0x54b7('0x1e')]||null:null})[_0x54b7('0x24')](function(_0x88ad46){if(_0x88ad46){return _0x88ad46[_0x54b7('0x25')](_0x258ccc['body']['ids'],_[_0x54b7('0x26')](_0x258ccc[_0x54b7('0x1b')],[_0x54b7('0x27'),'id'])||{});}})['spread'](function(_0x23c7b4){logger[_0x54b7('0x11')]('AddTags',_0x258ccc);logger[_0x54b7('0x21')](_0x54b7('0x28'),_0x258ccc,JSON[_0x54b7('0x14')](_0x23c7b4));_0x5200b8(_0x23c7b4);})[_0x54b7('0x19')](function(_0xe83a9e){logger[_0x54b7('0x15')](_0x54b7('0x28'),_0xe83a9e[_0x54b7('0x17')],_0x258ccc);_0x853a0c(_this[_0x54b7('0x15')](0x1f4,_0xe83a9e[_0x54b7('0x17')]));});});}; \ No newline at end of file +var _0xdd3d=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateOpenchannelInteraction','OpenchannelInteraction','update','body','options','raw','where','attributes','limit','debug','AddTagsToOpenchannelInteraction','addTags','ids','omit','AddTags','lodash','moment'];(function(_0x2d946d,_0x4c2c73){var _0x4872fa=function(_0x51d62a){while(--_0x51d62a){_0x2d946d['push'](_0x2d946d['shift']());}};_0x4872fa(++_0x4c2c73);}(_0xdd3d,0x1cc));var _0xddd3=function(_0x209dde,_0x2cd93c){_0x209dde=_0x209dde-0x0;var _0x146dad=_0xdd3d[_0x209dde];return _0x146dad;};'use strict';var _=require(_0xddd3('0x0'));var util=require('util');var moment=require(_0xddd3('0x1'));var BPromise=require(_0xddd3('0x2'));var rs=require(_0xddd3('0x3'));var fs=require('fs');var Redis=require(_0xddd3('0x4'));var db=require(_0xddd3('0x5'))['db'];var utils=require(_0xddd3('0x6'));var logger=require(_0xddd3('0x7'))(_0xddd3('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xddd3('0x9')]({'port':0x232a});config[_0xddd3('0xa')]=_[_0xddd3('0xb')](config[_0xddd3('0xa')],{'host':_0xddd3('0xc'),'port':0x18eb});var socket=require(_0xddd3('0xd'))(new Redis(config[_0xddd3('0xa')]));require('./openchannelInteraction.socket')[_0xddd3('0xe')](socket);function respondWithRpcPromise(_0x294dad,_0xbceb06,_0x2c3d21){return new BPromise(function(_0x1d3a2e,_0x20ff6c){return client[_0xddd3('0xf')](_0x294dad,_0x2c3d21)[_0xddd3('0x10')](function(_0x5b68f4){logger[_0xddd3('0x11')](_0xddd3('0x12'),_0xbceb06,_0xddd3('0x13'));logger['debug'](_0xddd3('0x14'),_0xbceb06,_0xddd3('0x13'),JSON[_0xddd3('0x15')](_0x5b68f4));if(_0x5b68f4[_0xddd3('0x16')]){if(_0x5b68f4[_0xddd3('0x16')][_0xddd3('0x17')]===0x1f4){logger[_0xddd3('0x16')](_0xddd3('0x12'),_0xbceb06,_0x5b68f4[_0xddd3('0x16')][_0xddd3('0x18')]);return _0x20ff6c(_0x5b68f4['error'][_0xddd3('0x18')]);}logger['error'](_0xddd3('0x12'),_0xbceb06,_0x5b68f4[_0xddd3('0x16')][_0xddd3('0x18')]);return _0x1d3a2e(_0x5b68f4['error'][_0xddd3('0x18')]);}else{logger['info']('OpenchannelInteraction,\x20%s,\x20%s',_0xbceb06,_0xddd3('0x13'));_0x1d3a2e(_0x5b68f4[_0xddd3('0x19')][_0xddd3('0x18')]);}})[_0xddd3('0x1a')](function(_0x1cecc4){logger[_0xddd3('0x16')](_0xddd3('0x12'),_0xbceb06,_0x1cecc4);_0x20ff6c(_0x1cecc4);});});}exports[_0xddd3('0x1b')]=function(_0x32e681){var _0x4c5c84=this;return new Promise(function(_0x365929,_0x491aae){return db[_0xddd3('0x1c')][_0xddd3('0x1d')](_0x32e681[_0xddd3('0x1e')],{'raw':_0x32e681['options']?_0x32e681[_0xddd3('0x1f')][_0xddd3('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x32e681[_0xddd3('0x1f')]?_0x32e681['options'][_0xddd3('0x21')]||null:null,'attributes':_0x32e681[_0xddd3('0x1f')]?_0x32e681[_0xddd3('0x1f')][_0xddd3('0x22')]||null:null,'limit':_0x32e681[_0xddd3('0x1f')]?_0x32e681['options'][_0xddd3('0x23')]||null:null})[_0xddd3('0x10')](function(_0x14dfbb){logger['info'](_0xddd3('0x1b'),_0x32e681);logger[_0xddd3('0x24')](_0xddd3('0x1b'),_0x32e681,JSON[_0xddd3('0x15')](_0x14dfbb));_0x365929(_0x14dfbb);})[_0xddd3('0x1a')](function(_0x2e2cdd){logger[_0xddd3('0x16')]('UpdateOpenchannelInteraction',_0x2e2cdd[_0xddd3('0x18')],_0x32e681);_0x491aae(_0x4c5c84['error'](0x1f4,_0x2e2cdd['message']));});});};exports[_0xddd3('0x25')]=function(_0x5cb19c){return new Promise(function(_0xde01e0,_0x5bb4a9){return db[_0xddd3('0x1c')]['find']({'where':_0x5cb19c[_0xddd3('0x1f')]?_0x5cb19c[_0xddd3('0x1f')]['where']||null:null})[_0xddd3('0x10')](function(_0x20d93c){if(_0x20d93c){return _0x20d93c[_0xddd3('0x26')](_0x5cb19c[_0xddd3('0x1e')][_0xddd3('0x27')],_[_0xddd3('0x28')](_0x5cb19c[_0xddd3('0x1e')],['ids','id'])||{});}})['spread'](function(_0x5336f8){logger[_0xddd3('0x11')]('AddTags',_0x5cb19c);logger[_0xddd3('0x24')]('AddTags',_0x5cb19c,JSON[_0xddd3('0x15')](_0x5336f8));_0xde01e0(_0x5336f8);})['catch'](function(_0x421ce7){logger[_0xddd3('0x16')](_0xddd3('0x29'),_0x421ce7[_0xddd3('0x18')],_0x5cb19c);_0x5bb4a9(_this[_0xddd3('0x16')](0x1f4,_0x421ce7['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index ab14404..889a44e 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 _0xbe59=['./openchannelInteraction.events','save','update','register','openchannelInteraction:'];(function(_0x3d26b7,_0xd960b){var _0xbe0757=function(_0x30b5e1){while(--_0x30b5e1){_0x3d26b7['push'](_0x3d26b7['shift']());}};_0xbe0757(++_0xd960b);}(_0xbe59,0xaa));var _0x9be5=function(_0x13034b,_0xf7406f){_0x13034b=_0x13034b-0x0;var _0x2deaae=_0xbe59[_0x13034b];return _0x2deaae;};'use strict';var OpenchannelInteractionEvents=require(_0x9be5('0x0'));var events=[_0x9be5('0x1'),'remove',_0x9be5('0x2')];function createListener(_0x496969,_0x1f28ba){return function(_0x458f97){_0x1f28ba['emit'](_0x496969,_0x458f97);};}function removeListener(_0xde2884,_0x1a5bd4){return function(){OpenchannelInteractionEvents['removeListener'](_0xde2884,_0x1a5bd4);};}exports[_0x9be5('0x3')]=function(_0x4013bb){for(var _0x3eae1b=0x0,_0xfdd474=events['length'];_0x3eae1b<_0xfdd474;_0x3eae1b++){var _0x376f92=events[_0x3eae1b];var _0x132d06=createListener(_0x9be5('0x4')+_0x376f92,_0x4013bb);OpenchannelInteractionEvents['on'](_0x376f92,_0x132d06);}}; \ No newline at end of file +var _0xb2dc=['emit','removeListener','length','openchannelInteraction:','./openchannelInteraction.events','remove'];(function(_0x564b0f,_0xbc0201){var _0x5220a4=function(_0x2dec72){while(--_0x2dec72){_0x564b0f['push'](_0x564b0f['shift']());}};_0x5220a4(++_0xbc0201);}(_0xb2dc,0xfa));var _0xcb2d=function(_0x16bf26,_0x224b74){_0x16bf26=_0x16bf26-0x0;var _0x377e93=_0xb2dc[_0x16bf26];return _0x377e93;};'use strict';var OpenchannelInteractionEvents=require(_0xcb2d('0x0'));var events=['save',_0xcb2d('0x1'),'update'];function createListener(_0x3ebee9,_0x36b800){return function(_0x2050a0){_0x36b800[_0xcb2d('0x2')](_0x3ebee9,_0x2050a0);};}function removeListener(_0x4a2059,_0x142ef4){return function(){OpenchannelInteractionEvents[_0xcb2d('0x3')](_0x4a2059,_0x142ef4);};}exports['register']=function(_0x4c13e1){for(var _0x372c39=0x0,_0x5c3a90=events[_0xcb2d('0x4')];_0x372c39<_0x5c3a90;_0x372c39++){var _0x4e3df1=events[_0x372c39];var _0x3d4236=createListener(_0xcb2d('0x5')+_0x4e3df1,_0x4c13e1);OpenchannelInteractionEvents['on'](_0x4e3df1,_0x3d4236);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index 7e66f81..afb8ddc 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 _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','post','tracked','openchannel','openchannelmessage:create','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','multer','util'];(function(_0xbefd3c,_0xbc56f0){var _0x253ad5=function(_0x284b82){while(--_0x284b82){_0xbefd3c['push'](_0xbefd3c['shift']());}};_0x253ad5(++_0xbc56f0);}(_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('./openchannelMessage.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),interaction[_0x0d8b('0xe')](_0x0d8b('0xf'),_0x0d8b('0x10')),controller['create']);router[_0x0d8b('0x11')]('/:id',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x12')]);router[_0x0d8b('0x11')](_0x0d8b('0x13'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x14')]);router[_0x0d8b('0x11')](_0x0d8b('0x15'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x16')]);router[_0x0d8b('0x17')](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x18')]);module['exports']=router; \ No newline at end of file +var _0x70e0=['put','update','/:id/accept','accept','destroy','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelMessage.controller','isAuthenticated','describe','get','/:id','show','post','openchannel','openchannelmessage:create','create'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x70e0,0x17b));var _0x070e=function(_0x236028,_0x430735){_0x236028=_0x236028-0x0;var _0x14338d=_0x70e0[_0x236028];return _0x14338d;};'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');var controller=require(_0x070e('0x7'));router['get']('/',auth[_0x070e('0x8')](),controller['index']);router['get']('/describe',auth[_0x070e('0x8')](),controller[_0x070e('0x9')]);router[_0x070e('0xa')](_0x070e('0xb'),auth[_0x070e('0x8')](),controller[_0x070e('0xc')]);router[_0x070e('0xd')]('/',auth['isAuthenticated'](),interaction['tracked'](_0x070e('0xe'),_0x070e('0xf')),controller[_0x070e('0x10')]);router[_0x070e('0x11')](_0x070e('0xb'),auth[_0x070e('0x8')](),controller[_0x070e('0x12')]);router[_0x070e('0x11')](_0x070e('0x13'),auth[_0x070e('0x8')](),controller[_0x070e('0x14')]);router['put']('/:id/reject',auth[_0x070e('0x8')](),controller['reject']);router['delete']('/:id',auth[_0x070e('0x8')](),controller[_0x070e('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.attributes.js b/server/api/openchannelMessage/openchannelMessage.attributes.js index 702c28e..2b254f5 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 _0xee4f=['BOOLEAN','out','DATE','sequelize','medium'];(function(_0x3609af,_0x3d20ea){var _0x438412=function(_0x3bc2a4){while(--_0x3bc2a4){_0x3609af['push'](_0x3609af['shift']());}};_0x438412(++_0x3d20ea);}(_0xee4f,0xad));var _0xfee4=function(_0x310342,_0x189cdd){_0x310342=_0x310342-0x0;var _0x3cc7ba=_0xee4f[_0x310342];return _0x3cc7ba;};'use strict';var Sequelize=require(_0xfee4('0x0'));module['exports']={'body':{'type':Sequelize['TEXT'](_0xfee4('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0xfee4('0x2')],'defaultValue':![]},'secret':{'type':Sequelize[_0xfee4('0x2')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0xfee4('0x3')),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize[_0xfee4('0x4')]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x9861=['out','STRING','TEXT','sequelize','medium','BOOLEAN','ENUM'];(function(_0x533b33,_0x1690bf){var _0x50d6f6=function(_0x29bedb){while(--_0x29bedb){_0x533b33['push'](_0x533b33['shift']());}};_0x50d6f6(++_0x1690bf);}(_0x9861,0x176));var _0x1986=function(_0xb07ec8,_0x4ec78b){_0xb07ec8=_0xb07ec8-0x0;var _0x56cf8c=_0x9861[_0xb07ec8];return _0x56cf8c;};'use strict';var Sequelize=require(_0x1986('0x0'));module['exports']={'body':{'type':Sequelize['TEXT'](_0x1986('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0x1986('0x2')],'defaultValue':![]},'secret':{'type':Sequelize[_0x1986('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0x1986('0x3')]('in',_0x1986('0x4')),'defaultValue':_0x1986('0x4'),'allowNull':![]},'readAt':{'type':Sequelize['DATE']},'providerName':{'type':Sequelize[_0x1986('0x5')]},'providerResponse':{'type':Sequelize[_0x1986('0x6')]}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index c1af9f8..0e565a3 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 _0x6ca2=['stack','name','send','index','OpenchannelMessage','rawAttributes','fieldName','type','map','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','sort','pick','where','merge','VIRTUAL','filter','includeAll','include','findAll','rows','show','params','length','find','create','body','describe','openchannel-interactions','accept','openchannel','readAt','format','UserId','user','get','OpenchannelInteraction','OpenchannelInteractionId','isNil','read1stAt','interaction','role','null','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','QueryTypes','SELECT','User','agent','fullname','email','internal','interface','channel','EventManager','reject','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','sequelize','contact','SIP/%s','motionChannel','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','client','http','request','then','info','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelMessage,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','apply','update','destroy'];(function(_0x10dbba,_0x3147ea){var _0x19bcda=function(_0x5e01e7){while(--_0x5e01e7){_0x10dbba['push'](_0x10dbba['shift']());}};_0x19bcda(++_0x3147ea);}(_0x6ca2,0xc8));var _0x26ca=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x6ca2[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x26ca('0x0'));var zipdir=require(_0x26ca('0x1'));var jsonpatch=require(_0x26ca('0x2'));var rp=require(_0x26ca('0x3'));var moment=require(_0x26ca('0x4'));var BPromise=require(_0x26ca('0x5'));var Mustache=require(_0x26ca('0x6'));var util=require(_0x26ca('0x7'));var path=require(_0x26ca('0x8'));var sox=require(_0x26ca('0x9'));var csv=require('to-csv');var ejs=require(_0x26ca('0xa'));var fs=require('fs');var fs_extra=require(_0x26ca('0xb'));var _=require('lodash');var squel=require(_0x26ca('0xc'));var crypto=require(_0x26ca('0xd'));var jsforce=require(_0x26ca('0xe'));var deskjs=require(_0x26ca('0xf'));var toCsv=require(_0x26ca('0x10'));var querystring=require(_0x26ca('0x11'));var Papa=require(_0x26ca('0x12'));var Redis=require(_0x26ca('0x13'));var authService=require(_0x26ca('0x14'));var qs=require(_0x26ca('0x15'));var as=require(_0x26ca('0x16'));var hardwareService=require(_0x26ca('0x17'));var logger=require(_0x26ca('0x18'))('api');var utils=require(_0x26ca('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x26ca('0x1a'));var db=require(_0x26ca('0x1b'))['db'];config[_0x26ca('0x1c')]=_[_0x26ca('0x1d')](config[_0x26ca('0x1c')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./openchannelMessage.socket')['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0x26ca('0x1e')][_0x26ca('0x1f')]({'port':0x232c});var client9002=jayson[_0x26ca('0x1e')][_0x26ca('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x2be192,_0x32aaef,_0x5b49ea,_0x339d48){return new BPromise(function(_0x478208,_0x684dba){var _0x2972e9=_0x339d48||client;return _0x2972e9[_0x26ca('0x20')](_0x2be192,_0x5b49ea)[_0x26ca('0x21')](function(_0x3963e4){logger[_0x26ca('0x22')]('OpenchannelMessage,\x20%s,\x20%s',_0x32aaef,_0x26ca('0x23'));logger[_0x26ca('0x24')](_0x26ca('0x25'),_0x32aaef,_0x26ca('0x23'),JSON[_0x26ca('0x26')](_0x3963e4));if(_0x3963e4[_0x26ca('0x27')]){if(_0x3963e4[_0x26ca('0x27')][_0x26ca('0x28')]===0x1f4){logger[_0x26ca('0x27')](_0x26ca('0x29'),_0x32aaef,_0x3963e4['error'][_0x26ca('0x2a')]);return _0x684dba(_0x3963e4[_0x26ca('0x27')][_0x26ca('0x2a')]);}logger['error']('OpenchannelMessage,\x20%s,\x20%s',_0x32aaef,_0x3963e4[_0x26ca('0x27')][_0x26ca('0x2a')]);return _0x478208(_0x3963e4['error'][_0x26ca('0x2a')]);}else{logger[_0x26ca('0x22')](_0x26ca('0x29'),_0x32aaef,'request\x20sent');_0x478208(_0x3963e4[_0x26ca('0x2b')][_0x26ca('0x2a')]);}})[_0x26ca('0x2c')](function(_0x1b6971){logger['error'](_0x26ca('0x29'),_0x32aaef,_0x1b6971);_0x684dba(_0x1b6971);});});}function respondWithStatusCode(_0x45e34e,_0x40d0d9){_0x40d0d9=_0x40d0d9||0xcc;return function(_0x5d1e59){if(_0x5d1e59){return _0x45e34e[_0x26ca('0x2d')](_0x40d0d9);}return _0x45e34e[_0x26ca('0x2e')](_0x40d0d9)[_0x26ca('0x2f')]();};}function respondWithResult(_0x4c33bb,_0x14db9d){_0x14db9d=_0x14db9d||0xc8;return function(_0x3df62b){if(_0x3df62b){return _0x4c33bb['status'](_0x14db9d)[_0x26ca('0x30')](_0x3df62b);}};}function respondWithFilteredResult(_0x1ee4ca,_0x40601e){return function(_0x4302ca){if(_0x4302ca){var _0xa51f8d=typeof _0x40601e[_0x26ca('0x31')]===_0x26ca('0x32')&&typeof _0x40601e[_0x26ca('0x33')]===_0x26ca('0x32');var _0x20adea=_0x4302ca[_0x26ca('0x34')];var _0x1d4acb=_0xa51f8d?0x0:_0x40601e[_0x26ca('0x31')];var _0x32b703=_0xa51f8d?_0x4302ca[_0x26ca('0x34')]:_0x40601e[_0x26ca('0x31')]+_0x40601e[_0x26ca('0x33')];var _0x47e76b;if(_0x32b703>=_0x20adea){_0x32b703=_0x20adea;_0x47e76b=0xc8;}else{_0x47e76b=0xce;}_0x1ee4ca[_0x26ca('0x2e')](_0x47e76b);return _0x1ee4ca['set']('Content-Range',_0x1d4acb+'-'+_0x32b703+'/'+_0x20adea)[_0x26ca('0x30')](_0x4302ca);}return null;};}function patchUpdates(_0x1b1feb){return function(_0x4ad04e){try{jsonpatch[_0x26ca('0x35')](_0x4ad04e,_0x1b1feb,!![]);}catch(_0xdc785b){return BPromise['reject'](_0xdc785b);}return _0x4ad04e['save']();};}function saveUpdates(_0x2d3bb1,_0x687f21){return function(_0x245dd7){if(_0x245dd7){return _0x245dd7[_0x26ca('0x36')](_0x2d3bb1)['then'](function(_0x235b3e){return _0x235b3e;});}return null;};}function removeEntity(_0x41994e,_0x3e9197){return function(_0x1821ea){if(_0x1821ea){return _0x1821ea[_0x26ca('0x37')]()[_0x26ca('0x21')](function(){_0x41994e[_0x26ca('0x2e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x49bb65,_0x138f31){return function(_0x1d1ec5){if(!_0x1d1ec5){_0x49bb65[_0x26ca('0x2d')](0x194);}return _0x1d1ec5;};}function handleError(_0x41da1b,_0x28c400){_0x28c400=_0x28c400||0x1f4;return function(_0x1d67f3){logger[_0x26ca('0x27')](_0x1d67f3[_0x26ca('0x38')]);if(_0x1d67f3[_0x26ca('0x39')]){delete _0x1d67f3[_0x26ca('0x39')];}_0x41da1b[_0x26ca('0x2e')](_0x28c400)[_0x26ca('0x3a')](_0x1d67f3);};}exports[_0x26ca('0x3b')]=function(_0x6d0eea,_0x53aacc){var _0x57423d={},_0x8239ec={},_0x48437f={'count':0x0,'rows':[]};var _0x212ba2=_['map'](db[_0x26ca('0x3c')][_0x26ca('0x3d')],function(_0x4bebc2){return{'name':_0x4bebc2[_0x26ca('0x3e')],'type':_0x4bebc2[_0x26ca('0x3f')]['key']};});_0x8239ec['model']=_[_0x26ca('0x40')](_0x212ba2,_0x26ca('0x39'));_0x8239ec[_0x26ca('0x41')]=_[_0x26ca('0x42')](_0x6d0eea['query']);_0x8239ec[_0x26ca('0x43')]=_[_0x26ca('0x44')](_0x8239ec[_0x26ca('0x45')],_0x8239ec[_0x26ca('0x41')]);_0x57423d[_0x26ca('0x46')]=_[_0x26ca('0x44')](_0x8239ec[_0x26ca('0x45')],qs[_0x26ca('0x47')](_0x6d0eea[_0x26ca('0x41')][_0x26ca('0x47')]));_0x57423d[_0x26ca('0x46')]=_0x57423d[_0x26ca('0x46')]['length']?_0x57423d['attributes']:_0x8239ec[_0x26ca('0x45')];if(!_0x6d0eea[_0x26ca('0x41')][_0x26ca('0x48')](_0x26ca('0x49'))){_0x57423d[_0x26ca('0x33')]=qs[_0x26ca('0x33')](_0x6d0eea['query'][_0x26ca('0x33')]);_0x57423d[_0x26ca('0x31')]=qs[_0x26ca('0x31')](_0x6d0eea[_0x26ca('0x41')][_0x26ca('0x31')]);}_0x57423d['order']=qs[_0x26ca('0x4a')](_0x6d0eea[_0x26ca('0x41')][_0x26ca('0x4a')]);_0x57423d['where']=qs[_0x26ca('0x43')](_[_0x26ca('0x4b')](_0x6d0eea[_0x26ca('0x41')],_0x8239ec[_0x26ca('0x43')]),_0x212ba2);if(_0x6d0eea[_0x26ca('0x41')]['filter']){_0x57423d[_0x26ca('0x4c')]=_[_0x26ca('0x4d')](_0x57423d['where'],{'$or':_[_0x26ca('0x40')](_0x212ba2,function(_0x2e916f){if(_0x2e916f[_0x26ca('0x3f')]!==_0x26ca('0x4e')){var _0x47168f={};_0x47168f[_0x2e916f[_0x26ca('0x39')]]={'$like':'%'+_0x6d0eea[_0x26ca('0x41')][_0x26ca('0x4f')]+'%'};return _0x47168f;}})});}_0x57423d=_[_0x26ca('0x4d')]({},_0x57423d,_0x6d0eea['options']);var _0x3004a0={'where':_0x57423d[_0x26ca('0x4c')]};return db[_0x26ca('0x3c')][_0x26ca('0x34')](_0x3004a0)['then'](function(_0x327d1a){_0x48437f['count']=_0x327d1a;if(_0x6d0eea[_0x26ca('0x41')][_0x26ca('0x50')]){_0x57423d[_0x26ca('0x51')]=[{'all':!![]}];}return db[_0x26ca('0x3c')][_0x26ca('0x52')](_0x57423d);})[_0x26ca('0x21')](function(_0x84524c){_0x48437f[_0x26ca('0x53')]=_0x84524c;return _0x48437f;})['then'](respondWithFilteredResult(_0x53aacc,_0x57423d))['catch'](handleError(_0x53aacc,null));};exports[_0x26ca('0x54')]=function(_0x22ecf1,_0x1243a5){var _0x13abeb={'raw':!![],'where':{'id':_0x22ecf1[_0x26ca('0x55')]['id']}},_0x117db9={};_0x117db9['model']=_[_0x26ca('0x42')](db[_0x26ca('0x3c')]['rawAttributes']);_0x117db9['query']=_['keys'](_0x22ecf1['query']);_0x117db9[_0x26ca('0x43')]=_['intersection'](_0x117db9[_0x26ca('0x45')],_0x117db9[_0x26ca('0x41')]);_0x13abeb[_0x26ca('0x46')]=_['intersection'](_0x117db9['model'],qs['fields'](_0x22ecf1[_0x26ca('0x41')][_0x26ca('0x47')]));_0x13abeb['attributes']=_0x13abeb[_0x26ca('0x46')][_0x26ca('0x56')]?_0x13abeb['attributes']:_0x117db9[_0x26ca('0x45')];if(_0x22ecf1[_0x26ca('0x41')][_0x26ca('0x50')]){_0x13abeb[_0x26ca('0x51')]=[{'all':!![]}];}_0x13abeb=_['merge']({},_0x13abeb,_0x22ecf1['options']);return db[_0x26ca('0x3c')][_0x26ca('0x57')](_0x13abeb)['then'](handleEntityNotFound(_0x1243a5,null))[_0x26ca('0x21')](respondWithResult(_0x1243a5,null))[_0x26ca('0x2c')](handleError(_0x1243a5,null));};exports['create']=function(_0x58b02d,_0x5931e7){return db[_0x26ca('0x3c')][_0x26ca('0x58')](_0x58b02d[_0x26ca('0x59')],{})[_0x26ca('0x21')](respondWithResult(_0x5931e7,0xc9))[_0x26ca('0x2c')](handleError(_0x5931e7,null));};exports[_0x26ca('0x36')]=function(_0x5d4bce,_0x2b820f){if(_0x5d4bce['body']['id']){delete _0x5d4bce[_0x26ca('0x59')]['id'];}return db[_0x26ca('0x3c')]['find']({'where':{'id':_0x5d4bce[_0x26ca('0x55')]['id']}})['then'](handleEntityNotFound(_0x2b820f,null))['then'](saveUpdates(_0x5d4bce[_0x26ca('0x59')],null))[_0x26ca('0x21')](respondWithResult(_0x2b820f,null))[_0x26ca('0x2c')](handleError(_0x2b820f,null));};exports[_0x26ca('0x37')]=function(_0x10057c,_0x4fd6ef){return db[_0x26ca('0x3c')][_0x26ca('0x57')]({'where':{'id':_0x10057c['params']['id']}})[_0x26ca('0x21')](handleEntityNotFound(_0x4fd6ef,null))[_0x26ca('0x21')](removeEntity(_0x4fd6ef,null))[_0x26ca('0x2c')](handleError(_0x4fd6ef,null));};exports[_0x26ca('0x5a')]=function(_0x2fe2af,_0xd93b07){return db[_0x26ca('0x3c')]['describe']()[_0x26ca('0x21')](respondWithResult(_0xd93b07,null))[_0x26ca('0x2c')](handleError(_0xd93b07,null));};var interaction_log=require(_0x26ca('0x18'))(_0x26ca('0x5b'));exports[_0x26ca('0x5c')]=function(_0x220006,_0x329d2b,_0x17e412){var _0x550302={'agent':{},'channel':_0x26ca('0x5d')};if(_0x220006[_0x26ca('0x59')]['id']){delete _0x220006[_0x26ca('0x59')]['id'];}_0x220006['body']['read']=!![];_0x220006[_0x26ca('0x59')][_0x26ca('0x5e')]=moment()[_0x26ca('0x5f')]('YYYY-MM-DD\x20HH:mm:ss');_0x220006[_0x26ca('0x59')]['UserId']=_0x220006[_0x26ca('0x59')][_0x26ca('0x60')]||_0x220006[_0x26ca('0x61')]['id'];_0x550302['agent']['id']=_0x220006[_0x26ca('0x59')][_0x26ca('0x60')];return db[_0x26ca('0x3c')]['find']({'where':{'id':_0x220006[_0x26ca('0x55')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x329d2b,null))['then'](saveUpdates(_0x220006[_0x26ca('0x59')],null))[_0x26ca('0x21')](function(_0x3cd7a7){if(_0x3cd7a7){_0x550302[_0x26ca('0x2a')]=_0x3cd7a7[_0x26ca('0x62')]({'plain':!![]});return db[_0x26ca('0x63')][_0x26ca('0x57')]({'where':{'id':_0x3cd7a7[_0x26ca('0x64')]}});}return null;})[_0x26ca('0x21')](handleEntityNotFound(_0x329d2b,null))[_0x26ca('0x21')](function(_0x17600c){if(_0x17600c){return _0x17600c[_0x26ca('0x36')]({'UserId':_0x220006[_0x26ca('0x59')][_0x26ca('0x60')],'read1stAt':_[_0x26ca('0x65')](_0x17600c[_0x26ca('0x66')])?moment()[_0x26ca('0x5f')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x26ca('0x21')](function(_0x213b10){if(_0x213b10){_0x550302[_0x26ca('0x67')]=_0x213b10['get']({'plain':!![]});interaction_log[_0x26ca('0x22')]('[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x220006[_0x26ca('0x61')]['id'],_0x220006['user'][_0x26ca('0x39')],_0x220006[_0x26ca('0x61')][_0x26ca('0x68')],_0x550302[_0x26ca('0x67')]['id'],_0x220006[_0x26ca('0x59')]?JSON[_0x26ca('0x26')](_0x220006[_0x26ca('0x59')]):_0x26ca('0x69'));return respondWithRpcPromise(_0x26ca('0x6a'),'acceptMessage',_0x550302);}return null;})[_0x26ca('0x21')](function(_0xb27c0d){var _0x41de04=_0x26ca('0x6b')+_0xb27c0d[_0x26ca('0x2a')][_0x26ca('0x6c')];return db['sequelize'][_0x26ca('0x41')](_0x41de04,{'type':db[_0x26ca('0x6d')][_0x26ca('0x6e')][_0x26ca('0x6f')],'raw':!![]})[_0x26ca('0x21')](function(_0x42c219){return _0x42c219;});})['then'](function(_0x2bca53){if(_0x2bca53){_0x550302[_0x26ca('0x2a')]['contact']=_0x2bca53[0x0];if(!_0x220006[_0x26ca('0x59')][_0x26ca('0x60')])return;return db[_0x26ca('0x70')][_0x26ca('0x57')]({'where':{'id':_0x220006[_0x26ca('0x59')][_0x26ca('0x60')],'role':_0x26ca('0x71')},'attributes':['id',_0x26ca('0x39'),_0x26ca('0x72'),_0x26ca('0x73'),_0x26ca('0x74')],'raw':!![]});}return null;})['then'](function(_0xa6a1a1){if(!_0xa6a1a1)return null;_0x550302['message'][_0x26ca('0x71')]=_0xa6a1a1;return _0x550302;})[_0x26ca('0x21')](function(_0x191aa5){if(_0x191aa5){if(_0x220006['body']['manual']){_0x550302[_0x26ca('0x2a')][_0x26ca('0x75')]=util[_0x26ca('0x5f')]('SIP/%s',_0x220006[_0x26ca('0x61')][_0x26ca('0x39')]);_0x550302['message'][_0x26ca('0x76')]=_0x550302[_0x26ca('0x76')];_0x550302[_0x26ca('0x2a')]['motionChannel']=_0x550302[_0x26ca('0x76')];_0x550302[_0x26ca('0x2a')]['event']=_0x26ca('0x5c');return respondWithRpcPromise(_0x26ca('0x77'),_0x26ca('0x77'),{'event':'acceptmessage','message':_0x550302[_0x26ca('0x2a')]},client9002)[_0x26ca('0x21')](function(){return _0x550302;});}return _0x550302;}return null;})[_0x26ca('0x21')](respondWithResult(_0x329d2b,null))[_0x26ca('0x2c')](handleError(_0x329d2b,null));};var interaction_log=require('../../config/logger')(_0x26ca('0x5b'));exports[_0x26ca('0x78')]=function(_0x4d66af,_0x423456,_0x196543){var _0x27b230={'agent':{},'channel':_0x26ca('0x5d')};if(_0x4d66af[_0x26ca('0x59')]['id']){delete _0x4d66af[_0x26ca('0x59')]['id'];}_0x4d66af[_0x26ca('0x59')][_0x26ca('0x60')]=_0x4d66af[_0x26ca('0x59')][_0x26ca('0x60')]||_0x4d66af['user']['id'];_0x27b230[_0x26ca('0x71')]['id']=_0x4d66af[_0x26ca('0x59')][_0x26ca('0x60')];return db[_0x26ca('0x3c')]['find']({'where':{'id':_0x4d66af['params']['id'],'UserId':null}})[_0x26ca('0x21')](handleEntityNotFound(_0x423456,null))[_0x26ca('0x21')](function(_0x56bde9){if(_0x56bde9){_0x27b230[_0x26ca('0x2a')]=_0x56bde9[_0x26ca('0x62')]({'plain':!![]});return db['OpenchannelInteraction'][_0x26ca('0x57')]({'where':{'id':_0x56bde9[_0x26ca('0x64')]}});}return null;})[_0x26ca('0x21')](handleEntityNotFound(_0x423456,null))[_0x26ca('0x21')](function(_0x364844){if(_0x364844){_0x27b230['interaction']=_0x364844[_0x26ca('0x62')]({'plain':!![]});interaction_log['info'](_0x26ca('0x79'),_0x4d66af[_0x26ca('0x61')]['id'],_0x4d66af[_0x26ca('0x61')][_0x26ca('0x39')],_0x4d66af[_0x26ca('0x61')][_0x26ca('0x68')],_0x27b230[_0x26ca('0x67')]['id'],_0x4d66af[_0x26ca('0x59')]?JSON[_0x26ca('0x26')](_0x4d66af[_0x26ca('0x59')]):_0x26ca('0x69'));return respondWithRpcPromise(_0x26ca('0x7a'),_0x26ca('0x7b'),_0x27b230);}return null;})[_0x26ca('0x21')](function(_0x3b59f4){var _0x4e5b1f='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x3b59f4[_0x26ca('0x2a')]['ContactId'];return db[_0x26ca('0x7c')]['query'](_0x4e5b1f,{'type':db[_0x26ca('0x6d')][_0x26ca('0x6e')][_0x26ca('0x6f')],'raw':!![]})[_0x26ca('0x21')](function(_0x285648){return _0x285648;});})[_0x26ca('0x21')](function(_0x12af1a){if(_0x12af1a){_0x27b230[_0x26ca('0x2a')][_0x26ca('0x7d')]=_0x12af1a[0x0];if(!_0x4d66af[_0x26ca('0x59')][_0x26ca('0x60')])return;return db[_0x26ca('0x70')][_0x26ca('0x57')]({'where':{'id':_0x4d66af['body'][_0x26ca('0x60')],'role':'agent'},'attributes':['id',_0x26ca('0x39'),_0x26ca('0x72'),_0x26ca('0x73'),_0x26ca('0x74')],'raw':!![]});}return null;})[_0x26ca('0x21')](function(_0x5ead2f){if(!_0x5ead2f)return null;_0x27b230[_0x26ca('0x2a')][_0x26ca('0x71')]=_0x5ead2f;return _0x27b230;})[_0x26ca('0x21')](function(_0x2d4f0e){if(_0x2d4f0e){_0x2d4f0e[_0x26ca('0x2a')][_0x26ca('0x75')]=util[_0x26ca('0x5f')](_0x26ca('0x7e'),_0x4d66af[_0x26ca('0x61')][_0x26ca('0x39')]);_0x2d4f0e['message'][_0x26ca('0x76')]=_0x27b230[_0x26ca('0x76')];_0x2d4f0e[_0x26ca('0x2a')][_0x26ca('0x7f')]=_0x27b230[_0x26ca('0x76')];_0x2d4f0e[_0x26ca('0x2a')]['event']=_0x26ca('0x78');respondWithRpcPromise(_0x26ca('0x77'),_0x26ca('0x77'),{'event':'rejectmessage','message':_0x2d4f0e['message']},client9002);return _0x27b230;}return null;})[_0x26ca('0x21')](respondWithResult(_0x423456,null))['catch'](handleError(_0x423456,null));}; \ No newline at end of file +var _0xc690=['includeAll','include','findAll','rows','catch','show','params','keys','OpenchannelMessage','length','find','create','body','describe','openchannel-interactions','accept','openchannel','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','get','isNil','read1stAt','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','interaction','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','QueryTypes','SELECT','contact','User','fullname','email','internal','channel','motionChannel','event','EventManager','acceptmessage','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','sequelize','Sequelize','agent','SIP/%s','rejectmessage','rimraf','request-promise','moment','util','sox','to-csv','ejs','fs-extra','crypto','jsforce','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','defaults','socket.io-emitter','redis','./openchannelMessage.socket','register','jayson/promise','client','http','request','then','request\x20sent','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelMessage,\x20%s,\x20%s','message','info','result','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','destroy','name','send','index','map','rawAttributes','fieldName','type','query','filters','model','attributes','intersection','fields','order','sort','where','pick','merge','VIRTUAL','filter','options'];(function(_0x45313f,_0x46caf4){var _0x402910=function(_0x4883d8){while(--_0x4883d8){_0x45313f['push'](_0x45313f['shift']());}};_0x402910(++_0x46caf4);}(_0xc690,0x1b8));var _0x0c69=function(_0xbf2ad2,_0x360d77){_0xbf2ad2=_0xbf2ad2-0x0;var _0x56a440=_0xc690[_0xbf2ad2];return _0x56a440;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0c69('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0c69('0x1'));var moment=require(_0x0c69('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x0c69('0x3'));var path=require('path');var sox=require(_0x0c69('0x4'));var csv=require(_0x0c69('0x5'));var ejs=require(_0x0c69('0x6'));var fs=require('fs');var fs_extra=require(_0x0c69('0x7'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x0c69('0x8'));var jsforce=require(_0x0c69('0x9'));var deskjs=require(_0x0c69('0xa'));var toCsv=require(_0x0c69('0x5'));var querystring=require(_0x0c69('0xb'));var Papa=require('papaparse');var Redis=require(_0x0c69('0xc'));var authService=require(_0x0c69('0xd'));var qs=require(_0x0c69('0xe'));var as=require(_0x0c69('0xf'));var hardwareService=require(_0x0c69('0x10'));var logger=require(_0x0c69('0x11'))('api');var utils=require(_0x0c69('0x12'));var config=require(_0x0c69('0x13'));var licenseUtil=require(_0x0c69('0x14'));var db=require(_0x0c69('0x15'))['db'];config['redis']=_[_0x0c69('0x16')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x0c69('0x17'))(new Redis(config[_0x0c69('0x18')]));require(_0x0c69('0x19'))[_0x0c69('0x1a')](socket);var jayson=require(_0x0c69('0x1b'));var client=jayson[_0x0c69('0x1c')][_0x0c69('0x1d')]({'port':0x232c});var client9002=jayson[_0x0c69('0x1c')][_0x0c69('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x1ad0b3,_0x16da0e,_0x476a77,_0x4ab1bc){return new BPromise(function(_0x367dba,_0x150349){var _0x256896=_0x4ab1bc||client;return _0x256896[_0x0c69('0x1e')](_0x1ad0b3,_0x476a77)[_0x0c69('0x1f')](function(_0x56a972){logger['info']('OpenchannelMessage,\x20%s,\x20%s',_0x16da0e,_0x0c69('0x20'));logger['debug'](_0x0c69('0x21'),_0x16da0e,_0x0c69('0x20'),JSON[_0x0c69('0x22')](_0x56a972));if(_0x56a972[_0x0c69('0x23')]){if(_0x56a972[_0x0c69('0x23')][_0x0c69('0x24')]===0x1f4){logger['error'](_0x0c69('0x25'),_0x16da0e,_0x56a972['error'][_0x0c69('0x26')]);return _0x150349(_0x56a972[_0x0c69('0x23')]['message']);}logger[_0x0c69('0x23')](_0x0c69('0x25'),_0x16da0e,_0x56a972[_0x0c69('0x23')][_0x0c69('0x26')]);return _0x367dba(_0x56a972['error'][_0x0c69('0x26')]);}else{logger[_0x0c69('0x27')](_0x0c69('0x25'),_0x16da0e,_0x0c69('0x20'));_0x367dba(_0x56a972[_0x0c69('0x28')][_0x0c69('0x26')]);}})['catch'](function(_0x3ce1da){logger[_0x0c69('0x23')](_0x0c69('0x25'),_0x16da0e,_0x3ce1da);_0x150349(_0x3ce1da);});});}function respondWithStatusCode(_0x1d0291,_0x50550a){_0x50550a=_0x50550a||0xcc;return function(_0x38f734){if(_0x38f734){return _0x1d0291[_0x0c69('0x29')](_0x50550a);}return _0x1d0291[_0x0c69('0x2a')](_0x50550a)[_0x0c69('0x2b')]();};}function respondWithResult(_0x2cf105,_0x53113a){_0x53113a=_0x53113a||0xc8;return function(_0x3a13fa){if(_0x3a13fa){return _0x2cf105['status'](_0x53113a)[_0x0c69('0x2c')](_0x3a13fa);}};}function respondWithFilteredResult(_0xd21feb,_0x3b817){return function(_0x3c7737){if(_0x3c7737){var _0x41e189=typeof _0x3b817[_0x0c69('0x2d')]===_0x0c69('0x2e')&&typeof _0x3b817[_0x0c69('0x2f')]===_0x0c69('0x2e');var _0x3746bc=_0x3c7737[_0x0c69('0x30')];var _0x1cbeb4=_0x41e189?0x0:_0x3b817['offset'];var _0x10a756=_0x41e189?_0x3c7737[_0x0c69('0x30')]:_0x3b817[_0x0c69('0x2d')]+_0x3b817[_0x0c69('0x2f')];var _0x23e587;if(_0x10a756>=_0x3746bc){_0x10a756=_0x3746bc;_0x23e587=0xc8;}else{_0x23e587=0xce;}_0xd21feb[_0x0c69('0x2a')](_0x23e587);return _0xd21feb[_0x0c69('0x31')]('Content-Range',_0x1cbeb4+'-'+_0x10a756+'/'+_0x3746bc)['json'](_0x3c7737);}return null;};}function patchUpdates(_0x2db44c){return function(_0x6dc200){try{jsonpatch[_0x0c69('0x32')](_0x6dc200,_0x2db44c,!![]);}catch(_0x58c471){return BPromise[_0x0c69('0x33')](_0x58c471);}return _0x6dc200[_0x0c69('0x34')]();};}function saveUpdates(_0x3af862,_0x28edd6){return function(_0x2ed545){if(_0x2ed545){return _0x2ed545[_0x0c69('0x35')](_0x3af862)[_0x0c69('0x1f')](function(_0xcd7ecf){return _0xcd7ecf;});}return null;};}function removeEntity(_0x18b4a9,_0x12e920){return function(_0x3b7a42){if(_0x3b7a42){return _0x3b7a42[_0x0c69('0x36')]()['then'](function(){_0x18b4a9[_0x0c69('0x2a')](0xcc)[_0x0c69('0x2b')]();});}};}function handleEntityNotFound(_0x28c8b4,_0x76365f){return function(_0x29f1ae){if(!_0x29f1ae){_0x28c8b4[_0x0c69('0x29')](0x194);}return _0x29f1ae;};}function handleError(_0x106fa6,_0x4894e9){_0x4894e9=_0x4894e9||0x1f4;return function(_0x45da52){logger[_0x0c69('0x23')](_0x45da52['stack']);if(_0x45da52['name']){delete _0x45da52[_0x0c69('0x37')];}_0x106fa6[_0x0c69('0x2a')](_0x4894e9)[_0x0c69('0x38')](_0x45da52);};}exports[_0x0c69('0x39')]=function(_0x39d328,_0x12f0fa){var _0x412848={},_0x1b63dc={},_0xe79a2={'count':0x0,'rows':[]};var _0x1a701b=_[_0x0c69('0x3a')](db['OpenchannelMessage'][_0x0c69('0x3b')],function(_0x2c83f4){return{'name':_0x2c83f4[_0x0c69('0x3c')],'type':_0x2c83f4[_0x0c69('0x3d')]['key']};});_0x1b63dc['model']=_[_0x0c69('0x3a')](_0x1a701b,'name');_0x1b63dc[_0x0c69('0x3e')]=_['keys'](_0x39d328[_0x0c69('0x3e')]);_0x1b63dc[_0x0c69('0x3f')]=_['intersection'](_0x1b63dc[_0x0c69('0x40')],_0x1b63dc[_0x0c69('0x3e')]);_0x412848[_0x0c69('0x41')]=_[_0x0c69('0x42')](_0x1b63dc[_0x0c69('0x40')],qs[_0x0c69('0x43')](_0x39d328[_0x0c69('0x3e')][_0x0c69('0x43')]));_0x412848[_0x0c69('0x41')]=_0x412848[_0x0c69('0x41')]['length']?_0x412848[_0x0c69('0x41')]:_0x1b63dc[_0x0c69('0x40')];if(!_0x39d328[_0x0c69('0x3e')]['hasOwnProperty']('nolimit')){_0x412848[_0x0c69('0x2f')]=qs[_0x0c69('0x2f')](_0x39d328['query']['limit']);_0x412848[_0x0c69('0x2d')]=qs[_0x0c69('0x2d')](_0x39d328[_0x0c69('0x3e')][_0x0c69('0x2d')]);}_0x412848[_0x0c69('0x44')]=qs[_0x0c69('0x45')](_0x39d328[_0x0c69('0x3e')]['sort']);_0x412848[_0x0c69('0x46')]=qs[_0x0c69('0x3f')](_[_0x0c69('0x47')](_0x39d328[_0x0c69('0x3e')],_0x1b63dc[_0x0c69('0x3f')]),_0x1a701b);if(_0x39d328[_0x0c69('0x3e')]['filter']){_0x412848[_0x0c69('0x46')]=_[_0x0c69('0x48')](_0x412848[_0x0c69('0x46')],{'$or':_[_0x0c69('0x3a')](_0x1a701b,function(_0x1f97d4){if(_0x1f97d4[_0x0c69('0x3d')]!==_0x0c69('0x49')){var _0x27741b={};_0x27741b[_0x1f97d4[_0x0c69('0x37')]]={'$like':'%'+_0x39d328[_0x0c69('0x3e')][_0x0c69('0x4a')]+'%'};return _0x27741b;}})});}_0x412848=_[_0x0c69('0x48')]({},_0x412848,_0x39d328[_0x0c69('0x4b')]);var _0x2659a5={'where':_0x412848[_0x0c69('0x46')]};return db['OpenchannelMessage'][_0x0c69('0x30')](_0x2659a5)[_0x0c69('0x1f')](function(_0x1bce85){_0xe79a2[_0x0c69('0x30')]=_0x1bce85;if(_0x39d328['query'][_0x0c69('0x4c')]){_0x412848[_0x0c69('0x4d')]=[{'all':!![]}];}return db['OpenchannelMessage'][_0x0c69('0x4e')](_0x412848);})[_0x0c69('0x1f')](function(_0x24281e){_0xe79a2[_0x0c69('0x4f')]=_0x24281e;return _0xe79a2;})[_0x0c69('0x1f')](respondWithFilteredResult(_0x12f0fa,_0x412848))[_0x0c69('0x50')](handleError(_0x12f0fa,null));};exports[_0x0c69('0x51')]=function(_0x534352,_0x264bc1){var _0x44f014={'raw':!![],'where':{'id':_0x534352[_0x0c69('0x52')]['id']}},_0x4c5cd8={};_0x4c5cd8[_0x0c69('0x40')]=_[_0x0c69('0x53')](db[_0x0c69('0x54')]['rawAttributes']);_0x4c5cd8['query']=_[_0x0c69('0x53')](_0x534352[_0x0c69('0x3e')]);_0x4c5cd8[_0x0c69('0x3f')]=_[_0x0c69('0x42')](_0x4c5cd8[_0x0c69('0x40')],_0x4c5cd8['query']);_0x44f014[_0x0c69('0x41')]=_['intersection'](_0x4c5cd8['model'],qs[_0x0c69('0x43')](_0x534352[_0x0c69('0x3e')][_0x0c69('0x43')]));_0x44f014[_0x0c69('0x41')]=_0x44f014[_0x0c69('0x41')][_0x0c69('0x55')]?_0x44f014[_0x0c69('0x41')]:_0x4c5cd8[_0x0c69('0x40')];if(_0x534352['query'][_0x0c69('0x4c')]){_0x44f014[_0x0c69('0x4d')]=[{'all':!![]}];}_0x44f014=_[_0x0c69('0x48')]({},_0x44f014,_0x534352[_0x0c69('0x4b')]);return db[_0x0c69('0x54')][_0x0c69('0x56')](_0x44f014)[_0x0c69('0x1f')](handleEntityNotFound(_0x264bc1,null))['then'](respondWithResult(_0x264bc1,null))[_0x0c69('0x50')](handleError(_0x264bc1,null));};exports[_0x0c69('0x57')]=function(_0x559cc3,_0x152629){return db[_0x0c69('0x54')][_0x0c69('0x57')](_0x559cc3[_0x0c69('0x58')],{})[_0x0c69('0x1f')](respondWithResult(_0x152629,0xc9))[_0x0c69('0x50')](handleError(_0x152629,null));};exports[_0x0c69('0x35')]=function(_0x2b52f8,_0x1dc818){if(_0x2b52f8[_0x0c69('0x58')]['id']){delete _0x2b52f8[_0x0c69('0x58')]['id'];}return db[_0x0c69('0x54')]['find']({'where':{'id':_0x2b52f8[_0x0c69('0x52')]['id']}})[_0x0c69('0x1f')](handleEntityNotFound(_0x1dc818,null))['then'](saveUpdates(_0x2b52f8[_0x0c69('0x58')],null))[_0x0c69('0x1f')](respondWithResult(_0x1dc818,null))[_0x0c69('0x50')](handleError(_0x1dc818,null));};exports[_0x0c69('0x36')]=function(_0xda4dee,_0x50810e){return db[_0x0c69('0x54')][_0x0c69('0x56')]({'where':{'id':_0xda4dee[_0x0c69('0x52')]['id']}})[_0x0c69('0x1f')](handleEntityNotFound(_0x50810e,null))[_0x0c69('0x1f')](removeEntity(_0x50810e,null))['catch'](handleError(_0x50810e,null));};exports[_0x0c69('0x59')]=function(_0x38d32f,_0x8c2416){return db[_0x0c69('0x54')][_0x0c69('0x59')]()[_0x0c69('0x1f')](respondWithResult(_0x8c2416,null))[_0x0c69('0x50')](handleError(_0x8c2416,null));};var interaction_log=require(_0x0c69('0x11'))(_0x0c69('0x5a'));exports[_0x0c69('0x5b')]=function(_0x1244e2,_0x1603f9,_0xe35deb){var _0x1f2515={'agent':{},'channel':_0x0c69('0x5c')};if(_0x1244e2[_0x0c69('0x58')]['id']){delete _0x1244e2[_0x0c69('0x58')]['id'];}_0x1244e2[_0x0c69('0x58')][_0x0c69('0x5d')]=!![];_0x1244e2[_0x0c69('0x58')][_0x0c69('0x5e')]=moment()[_0x0c69('0x5f')](_0x0c69('0x60'));_0x1244e2[_0x0c69('0x58')][_0x0c69('0x61')]=_0x1244e2[_0x0c69('0x58')][_0x0c69('0x61')]||_0x1244e2[_0x0c69('0x62')]['id'];_0x1f2515['agent']['id']=_0x1244e2[_0x0c69('0x58')]['UserId'];return db[_0x0c69('0x54')]['find']({'where':{'id':_0x1244e2[_0x0c69('0x52')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x1603f9,null))['then'](saveUpdates(_0x1244e2[_0x0c69('0x58')],null))[_0x0c69('0x1f')](function(_0x19b4df){if(_0x19b4df){_0x1f2515[_0x0c69('0x26')]=_0x19b4df[_0x0c69('0x63')]({'plain':!![]});return db['OpenchannelInteraction'][_0x0c69('0x56')]({'where':{'id':_0x19b4df['OpenchannelInteractionId']}});}return null;})[_0x0c69('0x1f')](handleEntityNotFound(_0x1603f9,null))[_0x0c69('0x1f')](function(_0x27ab94){if(_0x27ab94){return _0x27ab94[_0x0c69('0x35')]({'UserId':_0x1244e2['body'][_0x0c69('0x61')],'read1stAt':_[_0x0c69('0x64')](_0x27ab94[_0x0c69('0x65')])?moment()['format'](_0x0c69('0x60')):undefined});}return null;})[_0x0c69('0x1f')](function(_0x1f454d){if(_0x1f454d){_0x1f2515['interaction']=_0x1f454d['get']({'plain':!![]});interaction_log[_0x0c69('0x27')](_0x0c69('0x66'),_0x1244e2[_0x0c69('0x62')]['id'],_0x1244e2[_0x0c69('0x62')][_0x0c69('0x37')],_0x1244e2['user'][_0x0c69('0x67')],_0x1f2515[_0x0c69('0x68')]['id'],_0x1244e2[_0x0c69('0x58')]?JSON[_0x0c69('0x22')](_0x1244e2[_0x0c69('0x58')]):_0x0c69('0x69'));return respondWithRpcPromise(_0x0c69('0x6a'),_0x0c69('0x6b'),_0x1f2515);}return null;})[_0x0c69('0x1f')](function(_0x5089ea){var _0x5a95b0=_0x0c69('0x6c')+_0x5089ea[_0x0c69('0x26')]['ContactId'];return db['sequelize']['query'](_0x5a95b0,{'type':db['Sequelize'][_0x0c69('0x6d')][_0x0c69('0x6e')],'raw':!![]})[_0x0c69('0x1f')](function(_0x2a2f9b){return _0x2a2f9b;});})[_0x0c69('0x1f')](function(_0x5543d8){if(_0x5543d8){_0x1f2515[_0x0c69('0x26')][_0x0c69('0x6f')]=_0x5543d8[0x0];if(!_0x1244e2[_0x0c69('0x58')][_0x0c69('0x61')])return;return db[_0x0c69('0x70')][_0x0c69('0x56')]({'where':{'id':_0x1244e2['body']['UserId'],'role':'agent'},'attributes':['id','name',_0x0c69('0x71'),_0x0c69('0x72'),_0x0c69('0x73')],'raw':!![]});}return null;})['then'](function(_0x2ca74c){if(!_0x2ca74c)return null;_0x1f2515[_0x0c69('0x26')]['agent']=_0x2ca74c;return _0x1f2515;})['then'](function(_0x523185){if(_0x523185){if(_0x1244e2[_0x0c69('0x58')]['manual']){_0x1f2515[_0x0c69('0x26')]['interface']=util[_0x0c69('0x5f')]('SIP/%s',_0x1244e2[_0x0c69('0x62')]['name']);_0x1f2515[_0x0c69('0x26')][_0x0c69('0x74')]=_0x1f2515['channel'];_0x1f2515[_0x0c69('0x26')][_0x0c69('0x75')]=_0x1f2515[_0x0c69('0x74')];_0x1f2515[_0x0c69('0x26')][_0x0c69('0x76')]=_0x0c69('0x5b');return respondWithRpcPromise(_0x0c69('0x77'),'EventManager',{'event':_0x0c69('0x78'),'message':_0x1f2515[_0x0c69('0x26')]},client9002)[_0x0c69('0x1f')](function(){return _0x1f2515;});}return _0x1f2515;}return null;})[_0x0c69('0x1f')](respondWithResult(_0x1603f9,null))['catch'](handleError(_0x1603f9,null));};var interaction_log=require(_0x0c69('0x11'))('openchannel-interactions');exports[_0x0c69('0x33')]=function(_0x5ddb9c,_0x512e21,_0x1a9acb){var _0x17497c={'agent':{},'channel':_0x0c69('0x5c')};if(_0x5ddb9c[_0x0c69('0x58')]['id']){delete _0x5ddb9c[_0x0c69('0x58')]['id'];}_0x5ddb9c[_0x0c69('0x58')][_0x0c69('0x61')]=_0x5ddb9c[_0x0c69('0x58')][_0x0c69('0x61')]||_0x5ddb9c[_0x0c69('0x62')]['id'];_0x17497c['agent']['id']=_0x5ddb9c[_0x0c69('0x58')][_0x0c69('0x61')];return db[_0x0c69('0x54')]['find']({'where':{'id':_0x5ddb9c[_0x0c69('0x52')]['id'],'UserId':null}})[_0x0c69('0x1f')](handleEntityNotFound(_0x512e21,null))[_0x0c69('0x1f')](function(_0x54c456){if(_0x54c456){_0x17497c[_0x0c69('0x26')]=_0x54c456[_0x0c69('0x63')]({'plain':!![]});return db['OpenchannelInteraction'][_0x0c69('0x56')]({'where':{'id':_0x54c456['OpenchannelInteractionId']}});}return null;})[_0x0c69('0x1f')](handleEntityNotFound(_0x512e21,null))[_0x0c69('0x1f')](function(_0xe52a4f){if(_0xe52a4f){_0x17497c[_0x0c69('0x68')]=_0xe52a4f[_0x0c69('0x63')]({'plain':!![]});interaction_log[_0x0c69('0x27')](_0x0c69('0x79'),_0x5ddb9c[_0x0c69('0x62')]['id'],_0x5ddb9c[_0x0c69('0x62')]['name'],_0x5ddb9c[_0x0c69('0x62')][_0x0c69('0x67')],_0x17497c[_0x0c69('0x68')]['id'],_0x5ddb9c[_0x0c69('0x58')]?JSON[_0x0c69('0x22')](_0x5ddb9c[_0x0c69('0x58')]):'null');return respondWithRpcPromise(_0x0c69('0x7a'),_0x0c69('0x7b'),_0x17497c);}return null;})[_0x0c69('0x1f')](function(_0xb5dce5){var _0x223175='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0xb5dce5[_0x0c69('0x26')]['ContactId'];return db[_0x0c69('0x7c')][_0x0c69('0x3e')](_0x223175,{'type':db[_0x0c69('0x7d')][_0x0c69('0x6d')]['SELECT'],'raw':!![]})[_0x0c69('0x1f')](function(_0xbea6bd){return _0xbea6bd;});})['then'](function(_0x19b843){if(_0x19b843){_0x17497c['message'][_0x0c69('0x6f')]=_0x19b843[0x0];if(!_0x5ddb9c[_0x0c69('0x58')][_0x0c69('0x61')])return;return db[_0x0c69('0x70')]['find']({'where':{'id':_0x5ddb9c[_0x0c69('0x58')][_0x0c69('0x61')],'role':_0x0c69('0x7e')},'attributes':['id','name',_0x0c69('0x71'),_0x0c69('0x72'),_0x0c69('0x73')],'raw':!![]});}return null;})[_0x0c69('0x1f')](function(_0x214e69){if(!_0x214e69)return null;_0x17497c['message'][_0x0c69('0x7e')]=_0x214e69;return _0x17497c;})[_0x0c69('0x1f')](function(_0x117aec){if(_0x117aec){_0x117aec[_0x0c69('0x26')]['interface']=util[_0x0c69('0x5f')](_0x0c69('0x7f'),_0x5ddb9c[_0x0c69('0x62')][_0x0c69('0x37')]);_0x117aec[_0x0c69('0x26')][_0x0c69('0x74')]=_0x17497c['channel'];_0x117aec['message'][_0x0c69('0x75')]=_0x17497c[_0x0c69('0x74')];_0x117aec['message'][_0x0c69('0x76')]='reject';respondWithRpcPromise('EventManager','EventManager',{'event':_0x0c69('0x80'),'message':_0x117aec[_0x0c69('0x26')]},client9002);return _0x17497c;}return null;})[_0x0c69('0x1f')](respondWithResult(_0x512e21,null))[_0x0c69('0x50')](handleError(_0x512e21,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index 0bc4812..c4b5d0c 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 _0xb195=['emit','hasOwnProperty','exports','events','OpenchannelMessage','setMaxListeners','update','remove'];(function(_0xd8403a,_0x567163){var _0x3a52ac=function(_0x3dfb0d){while(--_0x3dfb0d){_0xd8403a['push'](_0xd8403a['shift']());}};_0x3a52ac(++_0x567163);}(_0xb195,0x12b));var _0x5b19=function(_0x1573ea,_0x434f02){_0x1573ea=_0x1573ea-0x0;var _0x51c0e2=_0xb195[_0x1573ea];return _0x51c0e2;};'use strict';var EventEmitter=require(_0x5b19('0x0'));var OpenchannelMessage=require('../../mysqldb')['db'][_0x5b19('0x1')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x5b19('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x5b19('0x3'),'afterDestroy':_0x5b19('0x4')};function emitEvent(_0xcf0ac2){return function(_0x2fb602,_0x24c018,_0x2e7164){OpenchannelMessageEvents[_0x5b19('0x5')](_0xcf0ac2+':'+_0x2fb602['id'],_0x2fb602);OpenchannelMessageEvents['emit'](_0xcf0ac2,_0x2fb602);_0x2e7164(null);};}for(var e in events){if(events[_0x5b19('0x6')](e)){var event=events[e];OpenchannelMessage['hook'](e,emitEvent(event));}}module[_0x5b19('0x7')]=OpenchannelMessageEvents; \ No newline at end of file +var _0xb57f=['exports','../../mysqldb','OpenchannelMessage','setMaxListeners','save','emit'];(function(_0x17aa68,_0x340a68){var _0x58f216=function(_0xe0981f){while(--_0xe0981f){_0x17aa68['push'](_0x17aa68['shift']());}};_0x58f216(++_0x340a68);}(_0xb57f,0xa3));var _0xfb57=function(_0x31616b,_0x362e3b){_0x31616b=_0x31616b-0x0;var _0x570931=_0xb57f[_0x31616b];return _0x570931;};'use strict';var EventEmitter=require('events');var OpenchannelMessage=require(_0xfb57('0x0'))['db'][_0xfb57('0x1')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0xfb57('0x2')](0x0);var events={'afterCreate':_0xfb57('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x54d676){return function(_0x3c3f47,_0x57b239,_0x123475){OpenchannelMessageEvents['emit'](_0x54d676+':'+_0x3c3f47['id'],_0x3c3f47);OpenchannelMessageEvents[_0xfb57('0x4')](_0x54d676,_0x3c3f47);_0x123475(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelMessage['hook'](e,emitEvent(event));}}module[_0xfb57('0x5')]=OpenchannelMessageEvents; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.model.js b/server/api/openchannelMessage/openchannelMessage.model.js index 91dcdef..15217e8 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 _0x690c=['define','OpenchannelMessage','models','get','direction','toLowerCase','out','secret','OpenchannelInteraction','findOne','OpenchannelInteractionId','createdAt','error','describe','then','find','OpenchannelAccountId','Interactions','CmContact','Contact','keys','replyUri','info','afterCreate','format','Forwarding\x20message\x20%d\x20to\x20%s','length','POST','method','GET','body','threadId','update','Interaction','inspect','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','request-promise','rimraf','../../config/environment','./openchannelMessage.attributes','exports'];(function(_0x47aaff,_0x98b0c6){var _0x4673f6=function(_0xaa984f){while(--_0xaa984f){_0x47aaff['push'](_0x47aaff['shift']());}};_0x4673f6(++_0x98b0c6);}(_0x690c,0x167));var _0xc690=function(_0xa2743e,_0x18fddc){_0xa2743e=_0xa2743e-0x0;var _0x1b8ba6=_0x690c[_0xa2743e];return _0x1b8ba6;};'use strict';var _=require(_0xc690('0x0'));var util=require(_0xc690('0x1'));var logger=require(_0xc690('0x2'))(_0xc690('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xc690('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc690('0x5'));var config=require(_0xc690('0x6'));var attributes=require(_0xc690('0x7'));module[_0xc690('0x8')]=function(_0x183409,_0x49e73f){return _0x183409[_0xc690('0x9')](_0xc690('0xa'),attributes,{'tableName':'openchannel_messages','paranoid':![],'indexes':[{'name':'fti_openchannel_messages','fields':['body'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x16da22,_0x39a0a3,_0x28afb4){var _0x461eb1=_0x183409[_0xc690('0xb')];var _0x3b2c2b=_0x16da22[_0xc690('0xc')]({'plain':!![]});if(_0x3b2c2b[_0xc690('0xd')][_0xc690('0xe')]()==='in'||_0x3b2c2b[_0xc690('0xd')]['toLowerCase']()===_0xc690('0xf')&&!_0x3b2c2b[_0xc690('0x10')]&&!_['isNil'](_0x3b2c2b['UserId'])){_0x461eb1[_0xc690('0x11')][_0xc690('0x12')]({'where':{'id':_0x3b2c2b[_0xc690('0x13')]}})['then'](function(_0x73986f){if(_0x73986f){_0x73986f['update']({'lastMsgAt':_0x3b2c2b[_0xc690('0x14')],'lastMsgDirection':_0x3b2c2b['direction'][_0xc690('0xe')]()});}})['catch'](function(_0x23af9f){console[_0xc690('0x15')](_0x23af9f);});}if(_0x3b2c2b[_0xc690('0xd')]==='out'&&!_0x3b2c2b[_0xc690('0x10')]){var _0x1ed083;_0x461eb1['CmContact'][_0xc690('0x16')]()[_0xc690('0x17')](function(_0x554ce5){return _0x461eb1['OpenchannelAccount'][_0xc690('0x18')]({'where':{'id':_0x3b2c2b[_0xc690('0x19')]},'include':[{'model':_0x461eb1[_0xc690('0x11')],'as':_0xc690('0x1a'),'where':{'id':_0x3b2c2b[_0xc690('0x13')]},'limit':0x1,'include':[{'model':_0x461eb1[_0xc690('0x1b')],'as':_0xc690('0x1c'),'attributes':_[_0xc690('0x1d')](_0x554ce5)}]}]});})[_0xc690('0x17')](function(_0x40e216){_0x1ed083=_0x40e216['get']({'plain':!![]});if(_0x1ed083&&_0x1ed083[_0xc690('0x1e')]){logger[_0xc690('0x1f')]('OpenchannelMessage,\x20%s,\x20%s',_0xc690('0x20'),util[_0xc690('0x21')](_0xc690('0x22'),_0x3b2c2b['id'],_0x1ed083[_0xc690('0x1e')]));if(_0x1ed083[_0xc690('0x1a')]&&_0x1ed083['Interactions'][_0xc690('0x23')]){_0x3b2c2b['Interaction']=_['omit'](_0x1ed083['Interactions'][0x0],_0xc690('0x1c'));_0x3b2c2b[_0xc690('0x1c')]=_0x1ed083[_0xc690('0x1a')][0x0][_0xc690('0x1c')];}var _0x39a0a3={'method':_0xc690('0x24'),'uri':encodeURI(_0x1ed083[_0xc690('0x1e')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x39a0a3[_0xc690('0x25')]){case _0xc690('0x26'):_0x39a0a3['qs']=_0x3b2c2b;break;case _0xc690('0x24'):_0x39a0a3[_0xc690('0x27')]=_0x3b2c2b;break;}return rp(_0x39a0a3)[_0xc690('0x17')](function(_0xe9637b){logger[_0xc690('0x1f')]('OpenchannelMessage,\x20%s,\x20%s',_0xc690('0x20'),util['format']('Message\x20%d\x20forwarded\x20to\x20%s',_0x3b2c2b['id'],_0x1ed083[_0xc690('0x1e')]));if(_0xe9637b['body'][_0xc690('0x28')]&&_0xe9637b[_0xc690('0x27')][_0xc690('0x28')]!=_0x3b2c2b['Interaction'][_0xc690('0x28')]){return _0x461eb1[_0xc690('0x11')][_0xc690('0x29')]({'threadId':_0xe9637b['body'][_0xc690('0x28')]},{'where':{'id':_0x3b2c2b[_0xc690('0x2a')]['id']}});}else{return;}})[_0xc690('0x17')](function(){return _0x16da22[_0xc690('0x29')]({'read':!![]});})['catch'](function(_0x387b82){logger[_0xc690('0x15')]('OpenchannelMessage,\x20%s,\x20%s',_0xc690('0x20'),util[_0xc690('0x2b')](_0x387b82,{'showHidden':![],'depth':null}));_0x28afb4();});}else{_0x28afb4();}})['finally'](function(){_0x28afb4();});}else{_0x28afb4();}}},'charset':_0xc690('0x2c'),'collate':_0xc690('0x2d')});}; \ No newline at end of file +var _0xe7e4=['utf8mb4_unicode_ci','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelMessage.attributes','exports','define','fti_openchannel_messages','FULLTEXT','models','get','direction','toLowerCase','isNil','UserId','OpenchannelInteraction','findOne','OpenchannelInteractionId','update','createdAt','error','out','describe','OpenchannelAccount','find','OpenchannelAccountId','Interactions','CmContact','Contact','then','replyUri','OpenchannelMessage,\x20%s,\x20%s','afterCreate','format','length','Interaction','omit','POST','method','body','info','Message\x20%d\x20forwarded\x20to\x20%s','threadId','catch'];(function(_0x5bdd96,_0x178a4f){var _0x31625b=function(_0x4e8535){while(--_0x4e8535){_0x5bdd96['push'](_0x5bdd96['shift']());}};_0x31625b(++_0x178a4f);}(_0xe7e4,0xc1));var _0x4e7e=function(_0x556a98,_0xc65176){_0x556a98=_0x556a98-0x0;var _0x1d0d5f=_0xe7e4[_0x556a98];return _0x1d0d5f;};'use strict';var _=require(_0x4e7e('0x0'));var util=require(_0x4e7e('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x4e7e('0x2'));var rp=require(_0x4e7e('0x3'));var fs=require('fs');var path=require(_0x4e7e('0x4'));var rimraf=require(_0x4e7e('0x5'));var config=require(_0x4e7e('0x6'));var attributes=require(_0x4e7e('0x7'));module[_0x4e7e('0x8')]=function(_0x37a160,_0x4b153c){return _0x37a160[_0x4e7e('0x9')]('OpenchannelMessage',attributes,{'tableName':'openchannel_messages','paranoid':![],'indexes':[{'name':_0x4e7e('0xa'),'fields':['body'],'type':_0x4e7e('0xb')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x2e1e15,_0x553532,_0x298ce7){var _0x516559=_0x37a160[_0x4e7e('0xc')];var _0x2b2c61=_0x2e1e15[_0x4e7e('0xd')]({'plain':!![]});if(_0x2b2c61[_0x4e7e('0xe')][_0x4e7e('0xf')]()==='in'||_0x2b2c61[_0x4e7e('0xe')][_0x4e7e('0xf')]()==='out'&&!_0x2b2c61['secret']&&!_[_0x4e7e('0x10')](_0x2b2c61[_0x4e7e('0x11')])){_0x516559[_0x4e7e('0x12')][_0x4e7e('0x13')]({'where':{'id':_0x2b2c61[_0x4e7e('0x14')]}})['then'](function(_0x2afcd8){if(_0x2afcd8){_0x2afcd8[_0x4e7e('0x15')]({'lastMsgAt':_0x2b2c61[_0x4e7e('0x16')],'lastMsgDirection':_0x2b2c61[_0x4e7e('0xe')][_0x4e7e('0xf')]()});}})['catch'](function(_0x359998){console[_0x4e7e('0x17')](_0x359998);});}if(_0x2b2c61[_0x4e7e('0xe')]===_0x4e7e('0x18')&&!_0x2b2c61['secret']){var _0x5d5b20;_0x516559['CmContact'][_0x4e7e('0x19')]()['then'](function(_0x24677b){return _0x516559[_0x4e7e('0x1a')][_0x4e7e('0x1b')]({'where':{'id':_0x2b2c61[_0x4e7e('0x1c')]},'include':[{'model':_0x516559[_0x4e7e('0x12')],'as':_0x4e7e('0x1d'),'where':{'id':_0x2b2c61[_0x4e7e('0x14')]},'limit':0x1,'include':[{'model':_0x516559[_0x4e7e('0x1e')],'as':_0x4e7e('0x1f'),'attributes':_['keys'](_0x24677b)}]}]});})[_0x4e7e('0x20')](function(_0x4a364b){_0x5d5b20=_0x4a364b['get']({'plain':!![]});if(_0x5d5b20&&_0x5d5b20[_0x4e7e('0x21')]){logger['info'](_0x4e7e('0x22'),_0x4e7e('0x23'),util[_0x4e7e('0x24')]('Forwarding\x20message\x20%d\x20to\x20%s',_0x2b2c61['id'],_0x5d5b20[_0x4e7e('0x21')]));if(_0x5d5b20[_0x4e7e('0x1d')]&&_0x5d5b20[_0x4e7e('0x1d')][_0x4e7e('0x25')]){_0x2b2c61[_0x4e7e('0x26')]=_[_0x4e7e('0x27')](_0x5d5b20[_0x4e7e('0x1d')][0x0],_0x4e7e('0x1f'));_0x2b2c61[_0x4e7e('0x1f')]=_0x5d5b20['Interactions'][0x0][_0x4e7e('0x1f')];}var _0x553532={'method':_0x4e7e('0x28'),'uri':encodeURI(_0x5d5b20[_0x4e7e('0x21')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x553532[_0x4e7e('0x29')]){case'GET':_0x553532['qs']=_0x2b2c61;break;case _0x4e7e('0x28'):_0x553532[_0x4e7e('0x2a')]=_0x2b2c61;break;}return rp(_0x553532)[_0x4e7e('0x20')](function(_0x4f6dee){logger[_0x4e7e('0x2b')]('OpenchannelMessage,\x20%s,\x20%s',_0x4e7e('0x23'),util[_0x4e7e('0x24')](_0x4e7e('0x2c'),_0x2b2c61['id'],_0x5d5b20[_0x4e7e('0x21')]));if(_0x4f6dee[_0x4e7e('0x2a')][_0x4e7e('0x2d')]&&_0x4f6dee[_0x4e7e('0x2a')]['threadId']!=_0x2b2c61['Interaction'][_0x4e7e('0x2d')]){return _0x516559[_0x4e7e('0x12')][_0x4e7e('0x15')]({'threadId':_0x4f6dee[_0x4e7e('0x2a')]['threadId']},{'where':{'id':_0x2b2c61[_0x4e7e('0x26')]['id']}});}else{return;}})[_0x4e7e('0x20')](function(){return _0x2e1e15[_0x4e7e('0x15')]({'read':!![]});})[_0x4e7e('0x2e')](function(_0x26ba8a){logger[_0x4e7e('0x17')](_0x4e7e('0x22'),_0x4e7e('0x23'),util['inspect'](_0x26ba8a,{'showHidden':![],'depth':null}));_0x298ce7();});}else{_0x298ce7();}})['finally'](function(){_0x298ce7();});}else{_0x298ce7();}}},'charset':'utf8mb4','collate':_0x4e7e('0x2f')});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index ee92064..b723483 100644 --- a/server/api/openchannelMessage/openchannelMessage.rpc.js +++ b/server/api/openchannelMessage/openchannelMessage.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['../../config/environment','jayson/promise','http','defaults','redis','socket.io-emitter','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateOpenchannelMessage','OpenchannelMessage','body','options','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x184176,_0x55afa9){var _0x3d257e=function(_0x574f77){while(--_0x574f77){_0x184176['push'](_0x184176['shift']());}};_0x3d257e(++_0x55afa9);}(_0x7a54,0x106));var _0x47a5=function(_0x2276d9,_0x56cd0f){_0x2276d9=_0x2276d9-0x0;var _0x5cc6bc=_0x7a54[_0x2276d9];return _0x5cc6bc;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});config['redis']=_[_0x47a5('0xb')](config[_0x47a5('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x47a5('0xd'))(new Redis(config['redis']));require('./openchannelMessage.socket')['register'](socket);function respondWithRpcPromise(_0x2a0e98,_0x2baee7,_0x5e31dd){return new BPromise(function(_0x2eb0dd,_0x49e844){return client['request'](_0x2a0e98,_0x5e31dd)[_0x47a5('0xe')](function(_0x69e4d4){logger[_0x47a5('0xf')](_0x47a5('0x10'),_0x2baee7,_0x47a5('0x11'));logger[_0x47a5('0x12')](_0x47a5('0x13'),_0x2baee7,'request\x20sent',JSON[_0x47a5('0x14')](_0x69e4d4));if(_0x69e4d4[_0x47a5('0x15')]){if(_0x69e4d4[_0x47a5('0x15')][_0x47a5('0x16')]===0x1f4){logger[_0x47a5('0x15')](_0x47a5('0x10'),_0x2baee7,_0x69e4d4[_0x47a5('0x15')][_0x47a5('0x17')]);return _0x49e844(_0x69e4d4['error'][_0x47a5('0x17')]);}logger[_0x47a5('0x15')](_0x47a5('0x10'),_0x2baee7,_0x69e4d4[_0x47a5('0x15')][_0x47a5('0x17')]);return _0x2eb0dd(_0x69e4d4['error']['message']);}else{logger[_0x47a5('0xf')]('OpenchannelMessage,\x20%s,\x20%s',_0x2baee7,'request\x20sent');_0x2eb0dd(_0x69e4d4[_0x47a5('0x18')][_0x47a5('0x17')]);}})[_0x47a5('0x19')](function(_0x1ef371){logger[_0x47a5('0x15')](_0x47a5('0x10'),_0x2baee7,_0x1ef371);_0x49e844(_0x1ef371);});});}exports[_0x47a5('0x1a')]=function(_0xe3c618){var _0x3aed38=this;return new Promise(function(_0x4a9fcb,_0x1570bc){return db[_0x47a5('0x1b')]['create'](_0xe3c618[_0x47a5('0x1c')],{'raw':_0xe3c618[_0x47a5('0x1d')]?_0xe3c618[_0x47a5('0x1d')]['raw']===undefined?!![]:![]:!![]})[_0x47a5('0xe')](function(_0x2f142b){logger[_0x47a5('0xf')](_0x47a5('0x1a'),_0xe3c618);logger['debug'](_0x47a5('0x1a'),_0xe3c618,JSON[_0x47a5('0x14')](_0x2f142b));_0x4a9fcb(_0x2f142b);})['catch'](function(_0x28747d){logger[_0x47a5('0x15')](_0x47a5('0x1a'),_0x28747d[_0x47a5('0x17')],_0xe3c618);_0x1570bc(_0x3aed38[_0x47a5('0x15')](0x1f4,_0x28747d['message']));});});}; \ No newline at end of file +var _0x2ef3=['lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','redis','defaults','localhost','socket.io-emitter','./openchannelMessage.socket','register','request','then','OpenchannelMessage,\x20%s,\x20%s','debug','request\x20sent','stringify','code','error','message','result','catch','CreateOpenchannelMessage','create','options','info'];(function(_0x324af0,_0x188f98){var _0x3ee024=function(_0x26a877){while(--_0x26a877){_0x324af0['push'](_0x324af0['shift']());}};_0x3ee024(++_0x188f98);}(_0x2ef3,0xba));var _0x32ef=function(_0x2fa7a8,_0x44a7a1){_0x2fa7a8=_0x2fa7a8-0x0;var _0x4a5625=_0x2ef3[_0x2fa7a8];return _0x4a5625;};'use strict';var _=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var moment=require(_0x32ef('0x2'));var BPromise=require(_0x32ef('0x3'));var rs=require(_0x32ef('0x4'));var fs=require('fs');var Redis=require(_0x32ef('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x32ef('0x6'));var logger=require(_0x32ef('0x7'))('rpc');var config=require(_0x32ef('0x8'));var jayson=require(_0x32ef('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0x32ef('0xa')]=_[_0x32ef('0xb')](config[_0x32ef('0xa')],{'host':_0x32ef('0xc'),'port':0x18eb});var socket=require(_0x32ef('0xd'))(new Redis(config[_0x32ef('0xa')]));require(_0x32ef('0xe'))[_0x32ef('0xf')](socket);function respondWithRpcPromise(_0x28275c,_0x77df79,_0x56eb42){return new BPromise(function(_0x5780e9,_0x401d0b){return client[_0x32ef('0x10')](_0x28275c,_0x56eb42)[_0x32ef('0x11')](function(_0x1499c2){logger['info'](_0x32ef('0x12'),_0x77df79,'request\x20sent');logger[_0x32ef('0x13')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x77df79,_0x32ef('0x14'),JSON[_0x32ef('0x15')](_0x1499c2));if(_0x1499c2['error']){if(_0x1499c2['error'][_0x32ef('0x16')]===0x1f4){logger['error'](_0x32ef('0x12'),_0x77df79,_0x1499c2[_0x32ef('0x17')][_0x32ef('0x18')]);return _0x401d0b(_0x1499c2[_0x32ef('0x17')]['message']);}logger['error']('OpenchannelMessage,\x20%s,\x20%s',_0x77df79,_0x1499c2[_0x32ef('0x17')][_0x32ef('0x18')]);return _0x5780e9(_0x1499c2[_0x32ef('0x17')]['message']);}else{logger['info'](_0x32ef('0x12'),_0x77df79,_0x32ef('0x14'));_0x5780e9(_0x1499c2[_0x32ef('0x19')]['message']);}})[_0x32ef('0x1a')](function(_0x33e230){logger['error'](_0x32ef('0x12'),_0x77df79,_0x33e230);_0x401d0b(_0x33e230);});});}exports[_0x32ef('0x1b')]=function(_0x26aff3){var _0x251084=this;return new Promise(function(_0x445cda,_0x3aec05){return db['OpenchannelMessage'][_0x32ef('0x1c')](_0x26aff3['body'],{'raw':_0x26aff3[_0x32ef('0x1d')]?_0x26aff3[_0x32ef('0x1d')]['raw']===undefined?!![]:![]:!![]})[_0x32ef('0x11')](function(_0x97780){logger[_0x32ef('0x1e')]('CreateOpenchannelMessage',_0x26aff3);logger['debug'](_0x32ef('0x1b'),_0x26aff3,JSON[_0x32ef('0x15')](_0x97780));_0x445cda(_0x97780);})[_0x32ef('0x1a')](function(_0x478bef){logger['error'](_0x32ef('0x1b'),_0x478bef['message'],_0x26aff3);_0x3aec05(_0x251084['error'](0x1f4,_0x478bef[_0x32ef('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.socket.js b/server/api/openchannelMessage/openchannelMessage.socket.js index 5f1e279..3e7d3f8 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 _0x50d8=['update','removeListener','register','length','openchannelMessage:','./openchannelMessage.events','remove'];(function(_0x149d7f,_0x543c48){var _0x49920a=function(_0x33360e){while(--_0x33360e){_0x149d7f['push'](_0x149d7f['shift']());}};_0x49920a(++_0x543c48);}(_0x50d8,0x12b));var _0x850d=function(_0x777e9b,_0x5c9657){_0x777e9b=_0x777e9b-0x0;var _0x557da7=_0x50d8[_0x777e9b];return _0x557da7;};'use strict';var OpenchannelMessageEvents=require(_0x850d('0x0'));var events=['save',_0x850d('0x1'),_0x850d('0x2')];function createListener(_0x4b90e2,_0x1bc032){return function(_0x53ea5e){_0x1bc032['emit'](_0x4b90e2,_0x53ea5e);};}function removeListener(_0x3c91c1,_0x10858c){return function(){OpenchannelMessageEvents[_0x850d('0x3')](_0x3c91c1,_0x10858c);};}exports[_0x850d('0x4')]=function(_0x54470c){for(var _0x5e7c62=0x0,_0x9dd636=events[_0x850d('0x5')];_0x5e7c62<_0x9dd636;_0x5e7c62++){var _0x1cce5c=events[_0x5e7c62];var _0x1f443a=createListener(_0x850d('0x6')+_0x1cce5c,_0x54470c);OpenchannelMessageEvents['on'](_0x1cce5c,_0x1f443a);}}; \ No newline at end of file +var _0x8375=['openchannelMessage:','save','remove','update','register'];(function(_0x19c741,_0x347762){var _0x1f4595=function(_0x25b59f){while(--_0x25b59f){_0x19c741['push'](_0x19c741['shift']());}};_0x1f4595(++_0x347762);}(_0x8375,0x132));var _0x5837=function(_0x25690f,_0xa41edb){_0x25690f=_0x25690f-0x0;var _0x356dd6=_0x8375[_0x25690f];return _0x356dd6;};'use strict';var OpenchannelMessageEvents=require('./openchannelMessage.events');var events=[_0x5837('0x0'),_0x5837('0x1'),_0x5837('0x2')];function createListener(_0x1fb900,_0x3bd795){return function(_0x144751){_0x3bd795['emit'](_0x1fb900,_0x144751);};}function removeListener(_0x2ddfc1,_0x110a7d){return function(){OpenchannelMessageEvents['removeListener'](_0x2ddfc1,_0x110a7d);};}exports[_0x5837('0x3')]=function(_0x438491){for(var _0x21c9bd=0x0,_0x1e0d00=events['length'];_0x21c9bd<_0x1e0d00;_0x21c9bd++){var _0x23454c=events[_0x21c9bd];var _0x1f4f78=createListener(_0x5837('0x4')+_0x23454c,_0x438491);OpenchannelMessageEvents['on'](_0x23454c,_0x1f4f78);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index 8d308c6..655bc47 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 _0xc12d=['../../config/environment','get','isAuthenticated','index','/describe','describe','getMembers','getTeams','getAgents','post','/:id/teams','addAgents','/:id','delete','destroy','removeTeams','/:id/users','removeAgents','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xc12d,0xc1));var _0xdc12=function(_0x283ed6,_0xbb5d01){_0x283ed6=_0x283ed6-0x0;var _0x227db6=_0xc12d[_0x283ed6];return _0x227db6;};'use strict';var multer=require(_0xdc12('0x0'));var util=require(_0xdc12('0x1'));var path=require(_0xdc12('0x2'));var timeout=require(_0xdc12('0x3'));var express=require('express');var router=express[_0xdc12('0x4')]();var fs_extra=require(_0xdc12('0x5'));var auth=require(_0xdc12('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xdc12('0x7'));var controller=require('./openchannelQueue.controller');router[_0xdc12('0x8')]('/',auth[_0xdc12('0x9')](),controller[_0xdc12('0xa')]);router[_0xdc12('0x8')](_0xdc12('0xb'),auth['isAuthenticated'](),controller[_0xdc12('0xc')]);router['get']('/:id',auth[_0xdc12('0x9')](),controller['show']);router[_0xdc12('0x8')]('/:id/members',auth[_0xdc12('0x9')](),controller[_0xdc12('0xd')]);router['get']('/:id/teams',auth[_0xdc12('0x9')](),controller[_0xdc12('0xe')]);router['get']('/:id/users',auth[_0xdc12('0x9')](),controller[_0xdc12('0xf')]);router['post']('/',auth[_0xdc12('0x9')](),controller['create']);router[_0xdc12('0x10')](_0xdc12('0x11'),auth['isAuthenticated'](),controller['addTeams']);router['post']('/:id/users',auth[_0xdc12('0x9')](),controller[_0xdc12('0x12')]);router['put'](_0xdc12('0x13'),auth[_0xdc12('0x9')](),controller['update']);router[_0xdc12('0x14')](_0xdc12('0x13'),auth[_0xdc12('0x9')](),controller[_0xdc12('0x15')]);router[_0xdc12('0x14')]('/:id/teams',auth['isAuthenticated'](),controller[_0xdc12('0x16')]);router[_0xdc12('0x14')](_0xdc12('0x17'),auth['isAuthenticated'](),controller[_0xdc12('0x18')]);module['exports']=router; \ No newline at end of file +var _0xc06d=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueue.controller','get','index','/describe','isAuthenticated','show','/:id/members','getMembers','/:id/teams','getTeams','getAgents','post','create','addTeams','/:id/users','/:id','update','delete','destroy','removeTeams','removeAgents'];(function(_0x18c06f,_0x3dc7b3){var _0x191c53=function(_0x3a5a32){while(--_0x3a5a32){_0x18c06f['push'](_0x18c06f['shift']());}};_0x191c53(++_0x3dc7b3);}(_0xc06d,0xba));var _0xdc06=function(_0x4fa4e0,_0x6791e7){_0x4fa4e0=_0x4fa4e0-0x0;var _0x4ab6ee=_0xc06d[_0x4fa4e0];return _0x4ab6ee;};'use strict';var multer=require(_0xdc06('0x0'));var util=require(_0xdc06('0x1'));var path=require(_0xdc06('0x2'));var timeout=require(_0xdc06('0x3'));var express=require(_0xdc06('0x4'));var router=express[_0xdc06('0x5')]();var fs_extra=require(_0xdc06('0x6'));var auth=require(_0xdc06('0x7'));var interaction=require(_0xdc06('0x8'));var config=require(_0xdc06('0x9'));var controller=require(_0xdc06('0xa'));router[_0xdc06('0xb')]('/',auth['isAuthenticated'](),controller[_0xdc06('0xc')]);router[_0xdc06('0xb')](_0xdc06('0xd'),auth[_0xdc06('0xe')](),controller['describe']);router[_0xdc06('0xb')]('/:id',auth['isAuthenticated'](),controller[_0xdc06('0xf')]);router[_0xdc06('0xb')](_0xdc06('0x10'),auth[_0xdc06('0xe')](),controller[_0xdc06('0x11')]);router[_0xdc06('0xb')](_0xdc06('0x12'),auth[_0xdc06('0xe')](),controller[_0xdc06('0x13')]);router[_0xdc06('0xb')]('/:id/users',auth[_0xdc06('0xe')](),controller[_0xdc06('0x14')]);router[_0xdc06('0x15')]('/',auth['isAuthenticated'](),controller[_0xdc06('0x16')]);router['post'](_0xdc06('0x12'),auth[_0xdc06('0xe')](),controller[_0xdc06('0x17')]);router['post'](_0xdc06('0x18'),auth['isAuthenticated'](),controller['addAgents']);router['put'](_0xdc06('0x19'),auth[_0xdc06('0xe')](),controller[_0xdc06('0x1a')]);router[_0xdc06('0x1b')](_0xdc06('0x19'),auth[_0xdc06('0xe')](),controller[_0xdc06('0x1c')]);router['delete']('/:id/teams',auth[_0xdc06('0xe')](),controller[_0xdc06('0x1d')]);router[_0xdc06('0x1b')](_0xdc06('0x18'),auth['isAuthenticated'](),controller[_0xdc06('0x1e')]);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 6a5758d..1dc88a7 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 _0xf045=['INTEGER','ENUM','beepall','roundrobin','sequelize','STRING','name'];(function(_0x292fc8,_0x432137){var _0x478e76=function(_0x4c7a0a){while(--_0x4c7a0a){_0x292fc8['push'](_0x292fc8['shift']());}};_0x478e76(++_0x432137);}(_0xf045,0x13f));var _0x5f04=function(_0x474f3c,_0x366ca7){_0x474f3c=_0x474f3c-0x0;var _0x24c780=_0xf045[_0x474f3c];return _0x24c780;};'use strict';var Sequelize=require(_0x5f04('0x0'));module['exports']={'name':{'type':Sequelize[_0x5f04('0x1')],'unique':_0x5f04('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x5f04('0x1')]},'timeout':{'type':Sequelize[_0x5f04('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x5f04('0x4')]('rrmemory',_0x5f04('0x5'),_0x5f04('0x6'))}}; \ No newline at end of file +var _0x8719=['rrmemory','beepall','roundrobin','sequelize','exports','STRING','INTEGER'];(function(_0x4612f5,_0x3e9ae5){var _0x5eaaf8=function(_0x1f5c4f){while(--_0x1f5c4f){_0x4612f5['push'](_0x4612f5['shift']());}};_0x5eaaf8(++_0x3e9ae5);}(_0x8719,0x1ed));var _0x9871=function(_0x138751,_0x27e5a5){_0x138751=_0x138751-0x0;var _0xc96617=_0x8719[_0x138751];return _0xc96617;};'use strict';var Sequelize=require(_0x9871('0x0'));module[_0x9871('0x1')]={'name':{'type':Sequelize[_0x9871('0x2')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x9871('0x2')]},'timeout':{'type':Sequelize[_0x9871('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x9871('0x4'),_0x9871('0x5'),_0x9871('0x6'))}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index 8ac5f50..3dca9eb 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 _0x249e=['pick','map','filter','User','findAndCountAll','UserId','agent','openchannelPause','updatedAt','createdAt','rows','%s/%s','getTeams','Team','hasOwnProperty','addTeams','ids','Agents','voicePause','interface','flatMap','sequelize','transaction','emit','removeTeams','select','tq.TeamId','team_has_openchannel_queues','join','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','SELECT','every','includes','all','union','isEmpty','removeAgents','forEach','userOpenchannelQueue:remove','addAgents','omit','spread','userOpenchannelQueue:save','isArray','getAgents','findOne','bluebird','util','lodash','squel','ioredis','../../components/parsers/qs','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./openchannelQueue.socket','register','status','offset','undefined','limit','count','set','Content-Range','json','update','then','destroy','error','name','send','index','OpenchannelQueue','rawAttributes','type','key','getOptions','where','include','query','findAll','catch','show','model','keys','filters','intersection','attributes','fields','length','includeAll','merge','options','find','create','user','get','OpenchannelQueues','autoAssociation','body','params','describe','getMembers','UserOpenchannelQueue','nolimit','order','sort'];(function(_0x8c553b,_0x3ccb72){var _0x5a3bf8=function(_0x19068e){while(--_0x19068e){_0x8c553b['push'](_0x8c553b['shift']());}};_0x5a3bf8(++_0x3ccb72);}(_0x249e,0x119));var _0xe249=function(_0x30e6c8,_0x4fb6b8){_0x30e6c8=_0x30e6c8-0x0;var _0x2da47d=_0x249e[_0x30e6c8];return _0x2da47d;};'use strict';var BPromise=require(_0xe249('0x0'));var util=require(_0xe249('0x1'));var _=require(_0xe249('0x2'));var squel=require(_0xe249('0x3'));var Redis=require(_0xe249('0x4'));var qs=require(_0xe249('0x5'));var logger=require('../../config/logger')(_0xe249('0x6'));var config=require(_0xe249('0x7'));var db=require(_0xe249('0x8'))['db'];config[_0xe249('0x9')]=_['defaults'](config[_0xe249('0x9')],{'host':_0xe249('0xa'),'port':0x18eb});var socket=require(_0xe249('0xb'))(new Redis(config[_0xe249('0x9')]));require(_0xe249('0xc'))[_0xe249('0xd')](socket);function respondWithStatusCode(_0xa1bb4b,_0xeaa3ae){_0xeaa3ae=_0xeaa3ae||0xcc;return function(_0x372868){if(_0x372868){return _0xa1bb4b['sendStatus'](_0xeaa3ae);}return _0xa1bb4b[_0xe249('0xe')](_0xeaa3ae)['end']();};}function respondWithResult(_0x14eab0,_0x21a140){_0x21a140=_0x21a140||0xc8;return function(_0x223269){if(_0x223269){return _0x14eab0['status'](_0x21a140)['json'](_0x223269);}};}function respondWithFilteredResult(_0x12c208,_0x25d49b){return function(_0x28ef97){if(_0x28ef97){var _0x425ac1=typeof _0x25d49b[_0xe249('0xf')]===_0xe249('0x10')&&typeof _0x25d49b[_0xe249('0x11')]===_0xe249('0x10');var _0x1e8bdd=_0x28ef97[_0xe249('0x12')];var _0x501873=_0x425ac1?0x0:_0x25d49b[_0xe249('0xf')];var _0x5eeddf=_0x425ac1?_0x28ef97['count']:_0x25d49b[_0xe249('0xf')]+_0x25d49b[_0xe249('0x11')];var _0xddde73;if(_0x5eeddf>=_0x1e8bdd){_0x5eeddf=_0x1e8bdd;_0xddde73=0xc8;}else{_0xddde73=0xce;}_0x12c208[_0xe249('0xe')](_0xddde73);return _0x12c208[_0xe249('0x13')](_0xe249('0x14'),_0x501873+'-'+_0x5eeddf+'/'+_0x1e8bdd)[_0xe249('0x15')](_0x28ef97);}return null;};}function saveUpdates(_0x12db23){return function(_0x35026b){if(_0x35026b){return _0x35026b[_0xe249('0x16')](_0x12db23)[_0xe249('0x17')](function(_0x5df417){return _0x5df417;});}return null;};}function removeEntity(_0x36bd16){return function(_0x5e5a1e){if(_0x5e5a1e){return _0x5e5a1e['destroy']()[_0xe249('0x17')](function(){var _0x2ec519=_0x5e5a1e['get']({'plain':!![]});var _0x44918c='OpenchannelQueues';return db['UserProfileResource'][_0xe249('0x18')]({'where':{'type':_0x44918c,'resourceId':_0x2ec519['id']}})['then'](function(){return _0x5e5a1e;});})[_0xe249('0x17')](function(){_0x36bd16[_0xe249('0xe')](0xcc)['end']();});}};}function handleEntityNotFound(_0x443a68){return function(_0x577e6d){if(!_0x577e6d){_0x443a68['sendStatus'](0x194);}return _0x577e6d;};}function handleError(_0xfb66a4,_0x270f49){_0x270f49=_0x270f49||0x1f4;return function(_0x557a01){logger[_0xe249('0x19')](_0x557a01['stack']);if(_0x557a01[_0xe249('0x1a')]){delete _0x557a01[_0xe249('0x1a')];}_0xfb66a4[_0xe249('0xe')](_0x270f49)[_0xe249('0x1b')](_0x557a01);};}exports[_0xe249('0x1c')]=function(_0x15ed30,_0x5e16cd){var _0x3d98a8={};var _0xdb953a={'count':0x0,'rows':[]};var _0x2d9591=_['map'](db[_0xe249('0x1d')][_0xe249('0x1e')],function(_0x26a781){return{'name':_0x26a781['fieldName'],'type':_0x26a781[_0xe249('0x1f')][_0xe249('0x20')]};});_0x3d98a8=qs[_0xe249('0x21')](_0x2d9591,_0x15ed30);var _0x58111c={'where':_0x3d98a8[_0xe249('0x22')]};return db[_0xe249('0x1d')]['count'](_0x58111c)[_0xe249('0x17')](function(_0x41ef0c){_0xdb953a[_0xe249('0x12')]=_0x41ef0c;_0x3d98a8['include']=qs[_0xe249('0x23')](_0x15ed30[_0xe249('0x24')]);return db['OpenchannelQueue'][_0xe249('0x25')](_0x3d98a8);})[_0xe249('0x17')](function(_0x4d8170){_0xdb953a['rows']=_0x4d8170;return _0xdb953a;})['then'](respondWithFilteredResult(_0x5e16cd,_0x3d98a8))[_0xe249('0x26')](handleError(_0x5e16cd,null));};exports[_0xe249('0x27')]=function(_0xfd1e33,_0x4f1c43){var _0xd116ef={'raw':!![],'where':{'id':_0xfd1e33['params']['id']}},_0x5216cb={};_0x5216cb[_0xe249('0x28')]=_[_0xe249('0x29')](db[_0xe249('0x1d')][_0xe249('0x1e')]);_0x5216cb[_0xe249('0x24')]=_['keys'](_0xfd1e33[_0xe249('0x24')]);_0x5216cb[_0xe249('0x2a')]=_[_0xe249('0x2b')](_0x5216cb[_0xe249('0x28')],_0x5216cb['query']);_0xd116ef[_0xe249('0x2c')]=_[_0xe249('0x2b')](_0x5216cb[_0xe249('0x28')],qs['fields'](_0xfd1e33[_0xe249('0x24')][_0xe249('0x2d')]));_0xd116ef[_0xe249('0x2c')]=_0xd116ef[_0xe249('0x2c')][_0xe249('0x2e')]?_0xd116ef[_0xe249('0x2c')]:_0x5216cb[_0xe249('0x28')];if(_0xfd1e33['query'][_0xe249('0x2f')]){_0xd116ef[_0xe249('0x23')]=[{'all':!![]}];}_0xd116ef=_[_0xe249('0x30')]({},_0xd116ef,_0xfd1e33[_0xe249('0x31')]);return db[_0xe249('0x1d')][_0xe249('0x32')](_0xd116ef)[_0xe249('0x17')](handleEntityNotFound(_0x4f1c43,null))[_0xe249('0x17')](respondWithResult(_0x4f1c43,null))['catch'](handleError(_0x4f1c43,null));};exports[_0xe249('0x33')]=function(_0x15454b,_0x494f49){return db[_0xe249('0x1d')][_0xe249('0x33')](_0x15454b['body'],{})['then'](function(_0x406f16){var _0x2fe125=_0x15454b[_0xe249('0x34')][_0xe249('0x35')]({'plain':!![]});if(!_0x2fe125)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2fe125['role']===_0xe249('0x34')){var _0x5ac837=_0x406f16[_0xe249('0x35')]({'plain':!![]});var _0x57db31=_0xe249('0x36');return db['UserProfileSection']['find']({'where':{'name':_0x57db31,'userProfileId':_0x2fe125['userProfileId']},'raw':!![]})[_0xe249('0x17')](function(_0x37e92b){if(_0x37e92b&&_0x37e92b[_0xe249('0x37')]===0x0){return db['UserProfileResource'][_0xe249('0x33')]({'name':_0x5ac837[_0xe249('0x1a')],'resourceId':_0x5ac837['id'],'type':_0x37e92b[_0xe249('0x1a')],'sectionId':_0x37e92b['id']},{})[_0xe249('0x17')](function(){return _0x406f16;});}else{return _0x406f16;}})['catch'](function(_0x8cc092){logger[_0xe249('0x19')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x8cc092);throw _0x8cc092;});}return _0x406f16;})[_0xe249('0x17')](respondWithResult(_0x494f49,0xc9))[_0xe249('0x26')](handleError(_0x494f49,null));};exports[_0xe249('0x16')]=function(_0x5e1927,_0x449825){if(_0x5e1927[_0xe249('0x38')]['id']){delete _0x5e1927[_0xe249('0x38')]['id'];}return db[_0xe249('0x1d')][_0xe249('0x32')]({'where':{'id':_0x5e1927[_0xe249('0x39')]['id']}})[_0xe249('0x17')](handleEntityNotFound(_0x449825,null))[_0xe249('0x17')](saveUpdates(_0x5e1927[_0xe249('0x38')],null))['then'](respondWithResult(_0x449825,null))[_0xe249('0x26')](handleError(_0x449825,null));};exports[_0xe249('0x18')]=function(_0x52d890,_0x1e296e){return db['OpenchannelQueue'][_0xe249('0x32')]({'where':{'id':_0x52d890[_0xe249('0x39')]['id']}})['then'](handleEntityNotFound(_0x1e296e,null))[_0xe249('0x17')](removeEntity(_0x1e296e,null))['catch'](handleError(_0x1e296e,null));};exports[_0xe249('0x3a')]=function(_0x5829be,_0x3881b0){return db['OpenchannelQueue'][_0xe249('0x3a')]()[_0xe249('0x17')](respondWithResult(_0x3881b0,null))[_0xe249('0x26')](handleError(_0x3881b0,null));};exports[_0xe249('0x3b')]=function(_0x190695,_0x4891e1){var _0x4feb44={'raw':!![],'where':{}},_0x447f8f={},_0x1ad206;return db[_0xe249('0x1d')]['findOne']({'where':{'id':_0x190695['params']['id']}})[_0xe249('0x17')](handleEntityNotFound(_0x4891e1,null))['then'](function(_0x234aab){if(_0x234aab){_0x1ad206=_0x234aab[_0xe249('0x35')]({'plain':!![]});_0x447f8f[_0xe249('0x28')]=_[_0xe249('0x29')](db[_0xe249('0x3c')][_0xe249('0x1e')]);_0x447f8f[_0xe249('0x24')]=_[_0xe249('0x29')](_0x190695['query']);_0x447f8f['filters']=_[_0xe249('0x2b')](_0x447f8f[_0xe249('0x28')],_0x447f8f[_0xe249('0x24')]);_0x4feb44[_0xe249('0x2c')]=_[_0xe249('0x2b')](_0x447f8f[_0xe249('0x28')],qs[_0xe249('0x2d')](_0x190695[_0xe249('0x24')]['fields']));_0x4feb44[_0xe249('0x2c')]=_0x4feb44[_0xe249('0x2c')][_0xe249('0x2e')]?_0x4feb44['attributes']:_0x447f8f[_0xe249('0x28')];if(!_0x190695[_0xe249('0x24')]['hasOwnProperty'](_0xe249('0x3d'))){_0x4feb44[_0xe249('0x11')]=qs['limit'](_0x190695['query'][_0xe249('0x11')]);_0x4feb44[_0xe249('0xf')]=qs['offset'](_0x190695[_0xe249('0x24')][_0xe249('0xf')]);}_0x4feb44[_0xe249('0x3e')]=qs[_0xe249('0x3f')](_0x190695[_0xe249('0x24')]['sort']);_0x4feb44[_0xe249('0x22')]=qs['filters'](_[_0xe249('0x40')](_0x190695['query'],_0x447f8f['filters']));_0x4feb44[_0xe249('0x22')]['OpenchannelQueueId']=_0x234aab['id'];if(_0x190695[_0xe249('0x24')]['filter']){_0x4feb44['where']=_['merge'](_0x4feb44[_0xe249('0x22')],{'$or':_[_0xe249('0x41')](_0x4feb44[_0xe249('0x2c')],function(_0x1436fb){var _0x5d7747={};_0x5d7747[_0x1436fb]={'$like':'%'+_0x190695[_0xe249('0x24')][_0xe249('0x42')]+'%'};return _0x5d7747;})});}_0x4feb44=_[_0xe249('0x30')]({},_0x4feb44,_0x190695[_0xe249('0x31')]);return db[_0xe249('0x3c')][_0xe249('0x25')](_0x4feb44);}})['then'](function(_0x54e409){if(_0x54e409){return db[_0xe249('0x43')][_0xe249('0x44')]({'where':{'id':_['map'](_0x54e409,_0xe249('0x45')),'role':_0xe249('0x46')},'attributes':['id',_0xe249('0x1a'),_0xe249('0x47'),_0xe249('0x48'),_0xe249('0x49')]});}})[_0xe249('0x17')](function(_0x346c8c){if(_0x346c8c){return{'count':_0x346c8c[_0xe249('0x12')],'rows':_['map'](_0x346c8c[_0xe249('0x4a')],function(_0x488d05){return{'membername':_0x488d05[_0xe249('0x1a')],'UserId':_0x488d05['id'],'queue_name':_0x1ad206[_0xe249('0x1a')],'OpenchannelQueueId':_0x1ad206['id'],'interface':util['format'](_0xe249('0x4b'),'SIP',_0x488d05['name']),'penalty':0x0,'paused':_0x488d05[_0xe249('0x47')],'createdAt':_0x488d05[_0xe249('0x49')],'updatedAt':_0x488d05[_0xe249('0x48')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x4891e1,_0x4feb44))['catch'](handleError(_0x4891e1,null));};exports[_0xe249('0x4c')]=function(_0x2507ea,_0x452bce){var _0xf8ab2e={};var _0xadcd1e={};var _0x50a020;var _0x11ac64;return db[_0xe249('0x1d')]['findOne']({'where':{'id':_0x2507ea[_0xe249('0x39')]['id']}})[_0xe249('0x17')](handleEntityNotFound(_0x452bce,null))[_0xe249('0x17')](function(_0x2eca6d){if(_0x2eca6d){_0x50a020=_0x2eca6d;_0xadcd1e[_0xe249('0x28')]=_[_0xe249('0x29')](db[_0xe249('0x4d')][_0xe249('0x1e')]);_0xadcd1e['query']=_[_0xe249('0x29')](_0x2507ea[_0xe249('0x24')]);_0xadcd1e['filters']=_[_0xe249('0x2b')](_0xadcd1e[_0xe249('0x28')],_0xadcd1e['query']);_0xf8ab2e[_0xe249('0x2c')]=_[_0xe249('0x2b')](_0xadcd1e['model'],qs[_0xe249('0x2d')](_0x2507ea['query'][_0xe249('0x2d')]));_0xf8ab2e['attributes']=_0xf8ab2e['attributes'][_0xe249('0x2e')]?_0xf8ab2e[_0xe249('0x2c')]:_0xadcd1e[_0xe249('0x28')];_0xf8ab2e[_0xe249('0x3e')]=qs[_0xe249('0x3f')](_0x2507ea[_0xe249('0x24')][_0xe249('0x3f')]);_0xf8ab2e[_0xe249('0x22')]=qs['filters'](_[_0xe249('0x40')](_0x2507ea[_0xe249('0x24')],_0xadcd1e[_0xe249('0x2a')]));if(_0x2507ea[_0xe249('0x24')][_0xe249('0x42')]){_0xf8ab2e[_0xe249('0x22')]=_[_0xe249('0x30')](_0xf8ab2e[_0xe249('0x22')],{'$or':_[_0xe249('0x41')](_0xf8ab2e[_0xe249('0x2c')],function(_0x5d94){var _0x5088ab={};_0x5088ab[_0x5d94]={'$like':'%'+_0x2507ea[_0xe249('0x24')]['filter']+'%'};return _0x5088ab;})});}_0xf8ab2e=_[_0xe249('0x30')]({},_0xf8ab2e,_0x2507ea['options']);return _0x50a020[_0xe249('0x4c')](_0xf8ab2e);}})['then'](function(_0x4ff6d6){if(_0x4ff6d6){_0x11ac64=_0x4ff6d6[_0xe249('0x2e')];if(!_0x2507ea[_0xe249('0x24')][_0xe249('0x4e')](_0xe249('0x3d'))){_0xf8ab2e[_0xe249('0x11')]=qs[_0xe249('0x11')](_0x2507ea[_0xe249('0x24')][_0xe249('0x11')]);_0xf8ab2e['offset']=qs[_0xe249('0xf')](_0x2507ea[_0xe249('0x24')][_0xe249('0xf')]);}return _0x50a020[_0xe249('0x4c')](_0xf8ab2e);}})['then'](function(_0xf19d57){if(_0xf19d57){return _0xf19d57?{'count':_0x11ac64,'rows':_0xf19d57}:null;}})[_0xe249('0x17')](respondWithResult(_0x452bce,null))[_0xe249('0x26')](handleError(_0x452bce,null));};exports[_0xe249('0x4f')]=function(_0x221997,_0x20d79b){var _0x14b605=_0x221997[_0xe249('0x38')][_0xe249('0x50')];return db[_0xe249('0x4d')]['findAll']({'where':{'id':_0x14b605},'attributes':['id'],'include':[{'model':db[_0xe249('0x43')],'as':_0xe249('0x51'),'attributes':['id',_0xe249('0x1a'),'online',_0xe249('0x52'),_0xe249('0x53')],'raw':!![]}]})['then'](function(_0x4aa407){if(_0x4aa407){var _0x3e4f9c=_[_0xe249('0x54')](_0x4aa407,function(_0x34dfd8){var _0x33c880=_0x34dfd8[_0xe249('0x35')]({'plain':!![]});return _0x33c880[_0xe249('0x51')];});return db[_0xe249('0x1d')][_0xe249('0x32')]({'where':{'id':_0x221997[_0xe249('0x39')]['id']}})['then'](function(_0x111d1b){return db[_0xe249('0x55')][_0xe249('0x56')](function(_0x34022b){return _0x111d1b['addTeams'](_0x14b605,{'transaction':_0x34022b})[_0xe249('0x17')](function(){return BPromise['each'](_0x3e4f9c,function(_0x1dd249){return db['UserOpenchannelQueue']['findOrCreate']({'where':{'UserId':_0x1dd249['id'],'OpenchannelQueueId':_0x221997[_0xe249('0x39')]['id']},'transaction':_0x34022b});});})['then'](function(){_0x3e4f9c['forEach'](function(_0x100719){socket[_0xe249('0x57')]('userOpenchannelQueue:save',{'UserId':_0x100719['id'],'OpenchannelQueueId':_0x111d1b['id']});});});});});}})[_0xe249('0x17')](respondWithStatusCode(_0x20d79b,null))['catch'](handleError(_0x20d79b,null));};exports[_0xe249('0x58')]=function(_0x596166,_0x66945){return db[_0xe249('0x4d')][_0xe249('0x25')]({'where':{'id':_0x596166[_0xe249('0x24')]['ids']},'attributes':['id'],'include':[{'model':db[_0xe249('0x43')],'as':_0xe249('0x51'),'attributes':['id'],'raw':!![]}]})[_0xe249('0x17')](handleEntityNotFound(_0x66945,null))['then'](function(_0x2b94af){var _0x4af6fd=_[_0xe249('0x41')](_0x2b94af,'id');var _0x298d40=[];var _0xaa74c4=[];var _0x2d2e0a=squel[_0xe249('0x59')]();_0x2d2e0a['field'](_0xe249('0x5a'))['from'](_0xe249('0x5b'),'tq')[_0xe249('0x5c')]('user_has_teams','ut',_0xe249('0x5d'))[_0xe249('0x22')](_0xe249('0x5e'),_0x596166[_0xe249('0x39')]['id']);for(var _0x5713d8=0x0;_0x5713d8<_0x2b94af['length'];_0x5713d8+=0x1){let _0x503db7=_0x2b94af[_0x5713d8];for(var _0x5c84d5=0x0;_0x5c84d5<_0x503db7[_0xe249('0x51')][_0xe249('0x2e')];_0x5c84d5+=0x1){let _0x4186fe=_0x503db7[_0xe249('0x51')][_0x5c84d5];var _0x42eddb=_0x2d2e0a[_0xe249('0x5f')]();_0x42eddb[_0xe249('0x22')](_0xe249('0x60'),_0x4186fe['id']);_0xaa74c4[_0xe249('0x61')](db['sequelize'][_0xe249('0x24')](_0x42eddb[_0xe249('0x62')](),{'type':db['sequelize']['QueryTypes'][_0xe249('0x63')]})['then'](function(_0x9349e5){if(_0x9349e5[_0xe249('0x2e')]===0x1){return _0x4186fe['id'];}else{var _0x4905f8=_[_0xe249('0x64')](_[_0xe249('0x41')](_0x9349e5,'TeamId'),function(_0x2261bf){return _[_0xe249('0x65')](_0x4af6fd,_0x2261bf);});if(_0x4905f8){return _0x4186fe['id'];}}}));}}return BPromise[_0xe249('0x66')](_0xaa74c4)['then'](function(_0x58f2c7){_0x298d40=_(_0x298d40)[_0xe249('0x67')](_0x58f2c7)['compact']()['value']();return db['OpenchannelQueue']['find']({'where':{'id':_0x596166[_0xe249('0x39')]['id']}})[_0xe249('0x17')](function(_0x4c4aff){return db[_0xe249('0x55')]['transaction'](function(_0x281c6b){return _0x4c4aff[_0xe249('0x58')](_0x596166['query'][_0xe249('0x50')],{'transaction':_0x281c6b})[_0xe249('0x17')](function(){if(!_[_0xe249('0x68')](_0x298d40)){return _0x4c4aff[_0xe249('0x69')](_0x298d40,{'transaction':_0x281c6b});}})[_0xe249('0x17')](function(){_0x298d40[_0xe249('0x6a')](function(_0x57281b){socket['emit'](_0xe249('0x6b'),{'UserId':_0x57281b,'OpenchannelQueueId':_0x4c4aff['id']});});});});});});})['then'](respondWithStatusCode(_0x66945,null))[_0xe249('0x26')](handleError(_0x66945,null));};exports[_0xe249('0x6c')]=function(_0x28c14d,_0x1fc6b9){return db['OpenchannelQueue']['find']({'where':{'id':_0x28c14d[_0xe249('0x39')]['id']}})[_0xe249('0x17')](handleEntityNotFound(_0x1fc6b9,null))[_0xe249('0x17')](function(_0x3e7521){if(_0x3e7521){return _0x3e7521['addAgents'](_0x28c14d[_0xe249('0x38')][_0xe249('0x50')],_[_0xe249('0x6d')](_0x28c14d[_0xe249('0x38')],[_0xe249('0x50'),'id'])||{})[_0xe249('0x6e')](function(_0x5bfb7e){for(var _0x26497f=0x0;_0x26497f<_0x28c14d['body'][_0xe249('0x50')][_0xe249('0x2e')];_0x26497f+=0x1){socket[_0xe249('0x57')](_0xe249('0x6f'),{'UserId':Number(_0x28c14d['body'][_0xe249('0x50')][_0x26497f]),'OpenchannelQueueId':Number(_0x28c14d['params']['id'])});}return _0x5bfb7e;});}})[_0xe249('0x17')](respondWithResult(_0x1fc6b9,null))[_0xe249('0x26')](handleError(_0x1fc6b9,null));};exports['removeAgents']=function(_0x593503,_0x5630e4){return db[_0xe249('0x1d')][_0xe249('0x32')]({'where':{'id':_0x593503[_0xe249('0x39')]['id']}})['then'](handleEntityNotFound(_0x5630e4,null))['then'](function(_0x22f36e){if(_0x22f36e){return _0x22f36e['removeAgents'](_0x593503['query'][_0xe249('0x50')])[_0xe249('0x17')](function(){if(_[_0xe249('0x70')](_0x593503[_0xe249('0x24')][_0xe249('0x50')])){for(var _0x4b13b1=0x0;_0x4b13b1<_0x593503['query'][_0xe249('0x50')][_0xe249('0x2e')];_0x4b13b1+=0x1){socket[_0xe249('0x57')]('userOpenchannelQueue:remove',{'UserId':Number(_0x593503[_0xe249('0x24')][_0xe249('0x50')][_0x4b13b1]),'OpenchannelQueueId':Number(_0x593503[_0xe249('0x39')]['id'])});}}else{socket[_0xe249('0x57')](_0xe249('0x6b'),{'UserId':Number(_0x593503[_0xe249('0x24')]['ids']),'OpenchannelQueueId':Number(_0x593503['params']['id'])});}});}})['then'](respondWithStatusCode(_0x5630e4,null))[_0xe249('0x26')](handleError(_0x5630e4,null));};exports[_0xe249('0x71')]=function(_0x90e6f9,_0x2bcfce){var _0x54c438={};var _0x2d1230={};var _0x47d71b;var _0x3a97b6;return db['OpenchannelQueue'][_0xe249('0x72')]({'where':{'id':_0x90e6f9[_0xe249('0x39')]['id']}})[_0xe249('0x17')](handleEntityNotFound(_0x2bcfce,null))['then'](function(_0x222429){if(_0x222429){_0x47d71b=_0x222429;_0x2d1230[_0xe249('0x28')]=_[_0xe249('0x29')](db[_0xe249('0x43')]['rawAttributes']);_0x2d1230['query']=_[_0xe249('0x29')](_0x90e6f9[_0xe249('0x24')]);_0x2d1230[_0xe249('0x2a')]=_[_0xe249('0x2b')](_0x2d1230[_0xe249('0x28')],_0x2d1230['query']);_0x54c438['attributes']=_['intersection'](_0x2d1230[_0xe249('0x28')],qs['fields'](_0x90e6f9['query'][_0xe249('0x2d')]));_0x54c438[_0xe249('0x2c')]=_0x54c438[_0xe249('0x2c')]['length']?_0x54c438[_0xe249('0x2c')]:_0x2d1230[_0xe249('0x28')];_0x54c438[_0xe249('0x3e')]=qs[_0xe249('0x3f')](_0x90e6f9['query'][_0xe249('0x3f')]);_0x54c438['where']=qs[_0xe249('0x2a')](_['pick'](_0x90e6f9[_0xe249('0x24')],_0x2d1230[_0xe249('0x2a')]));if(_0x90e6f9[_0xe249('0x24')][_0xe249('0x42')]){_0x54c438['where']=_[_0xe249('0x30')](_0x54c438[_0xe249('0x22')],{'$or':_[_0xe249('0x41')](_0x54c438['attributes'],function(_0xb06e58){var _0x22807f={};_0x22807f[_0xb06e58]={'$like':'%'+_0x90e6f9[_0xe249('0x24')]['filter']+'%'};return _0x22807f;})});}_0x54c438=_[_0xe249('0x30')]({},_0x54c438,_0x90e6f9[_0xe249('0x31')]);return _0x47d71b[_0xe249('0x71')](_0x54c438);}})[_0xe249('0x17')](function(_0x4e4a13){if(_0x4e4a13){_0x3a97b6=_0x4e4a13['length'];if(!_0x90e6f9[_0xe249('0x24')]['hasOwnProperty'](_0xe249('0x3d'))){_0x54c438[_0xe249('0x11')]=qs[_0xe249('0x11')](_0x90e6f9['query'][_0xe249('0x11')]);_0x54c438[_0xe249('0xf')]=qs['offset'](_0x90e6f9[_0xe249('0x24')][_0xe249('0xf')]);}return _0x47d71b[_0xe249('0x71')](_0x54c438);}})[_0xe249('0x17')](function(_0x1118b9){if(_0x1118b9){return _0x1118b9?{'count':_0x3a97b6,'rows':_0x1118b9}:null;}})[_0xe249('0x17')](respondWithResult(_0x2bcfce,null))['catch'](handleError(_0x2bcfce,null));}; \ No newline at end of file +var _0x69ed=['query','findAll','rows','show','params','model','keys','filters','attributes','fields','length','includeAll','merge','options','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getMembers','intersection','hasOwnProperty','nolimit','sort','where','pick','OpenchannelQueueId','filter','UserOpenchannelQueue','User','UserId','agent','openchannelPause','updatedAt','format','%s/%s','SIP','getTeams','findOne','order','addTeams','ids','Agents','online','voicePause','interface','flatMap','sequelize','transaction','each','findOrCreate','forEach','emit','userOpenchannelQueue:save','removeTeams','Team','select','field','tq.TeamId','from','team_has_openchannel_queues','join','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','push','toString','SELECT','every','includes','union','compact','isEmpty','removeAgents','addAgents','omit','userOpenchannelQueue:remove','getAgents','bluebird','util','lodash','squel','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelQueue.socket','register','sendStatus','end','status','json','offset','undefined','limit','count','set','update','then','destroy','get','OpenchannelQueues','name','send','index','map','rawAttributes','fieldName','type','getOptions','OpenchannelQueue','include'];(function(_0x2879ea,_0xd06535){var _0x270d9c=function(_0x5a1b63){while(--_0x5a1b63){_0x2879ea['push'](_0x2879ea['shift']());}};_0x270d9c(++_0xd06535);}(_0x69ed,0x1c8));var _0xd69e=function(_0x1a8ee7,_0x4114e2){_0x1a8ee7=_0x1a8ee7-0x0;var _0x4535c0=_0x69ed[_0x1a8ee7];return _0x4535c0;};'use strict';var BPromise=require(_0xd69e('0x0'));var util=require(_0xd69e('0x1'));var _=require(_0xd69e('0x2'));var squel=require(_0xd69e('0x3'));var Redis=require(_0xd69e('0x4'));var qs=require(_0xd69e('0x5'));var logger=require(_0xd69e('0x6'))(_0xd69e('0x7'));var config=require(_0xd69e('0x8'));var db=require(_0xd69e('0x9'))['db'];config[_0xd69e('0xa')]=_[_0xd69e('0xb')](config[_0xd69e('0xa')],{'host':_0xd69e('0xc'),'port':0x18eb});var socket=require(_0xd69e('0xd'))(new Redis(config[_0xd69e('0xa')]));require(_0xd69e('0xe'))[_0xd69e('0xf')](socket);function respondWithStatusCode(_0x580cd6,_0x5ccd3e){_0x5ccd3e=_0x5ccd3e||0xcc;return function(_0x1ca6db){if(_0x1ca6db){return _0x580cd6[_0xd69e('0x10')](_0x5ccd3e);}return _0x580cd6['status'](_0x5ccd3e)[_0xd69e('0x11')]();};}function respondWithResult(_0x297df5,_0x2dc278){_0x2dc278=_0x2dc278||0xc8;return function(_0x4e71cf){if(_0x4e71cf){return _0x297df5[_0xd69e('0x12')](_0x2dc278)[_0xd69e('0x13')](_0x4e71cf);}};}function respondWithFilteredResult(_0x53fea9,_0x3c033c){return function(_0x449b6e){if(_0x449b6e){var _0x4f0925=typeof _0x3c033c[_0xd69e('0x14')]===_0xd69e('0x15')&&typeof _0x3c033c[_0xd69e('0x16')]===_0xd69e('0x15');var _0x11e1d0=_0x449b6e[_0xd69e('0x17')];var _0x268e9a=_0x4f0925?0x0:_0x3c033c[_0xd69e('0x14')];var _0x4d5e4a=_0x4f0925?_0x449b6e[_0xd69e('0x17')]:_0x3c033c[_0xd69e('0x14')]+_0x3c033c[_0xd69e('0x16')];var _0x1f209c;if(_0x4d5e4a>=_0x11e1d0){_0x4d5e4a=_0x11e1d0;_0x1f209c=0xc8;}else{_0x1f209c=0xce;}_0x53fea9[_0xd69e('0x12')](_0x1f209c);return _0x53fea9[_0xd69e('0x18')]('Content-Range',_0x268e9a+'-'+_0x4d5e4a+'/'+_0x11e1d0)[_0xd69e('0x13')](_0x449b6e);}return null;};}function saveUpdates(_0x1b4fa4){return function(_0x245635){if(_0x245635){return _0x245635[_0xd69e('0x19')](_0x1b4fa4)[_0xd69e('0x1a')](function(_0x8b1bca){return _0x8b1bca;});}return null;};}function removeEntity(_0x1f9a76){return function(_0x5809a8){if(_0x5809a8){return _0x5809a8[_0xd69e('0x1b')]()[_0xd69e('0x1a')](function(){var _0xd3d214=_0x5809a8[_0xd69e('0x1c')]({'plain':!![]});var _0x157626=_0xd69e('0x1d');return db['UserProfileResource'][_0xd69e('0x1b')]({'where':{'type':_0x157626,'resourceId':_0xd3d214['id']}})[_0xd69e('0x1a')](function(){return _0x5809a8;});})[_0xd69e('0x1a')](function(){_0x1f9a76[_0xd69e('0x12')](0xcc)[_0xd69e('0x11')]();});}};}function handleEntityNotFound(_0x48a934){return function(_0x9f274f){if(!_0x9f274f){_0x48a934['sendStatus'](0x194);}return _0x9f274f;};}function handleError(_0x5393a6,_0x1f92c5){_0x1f92c5=_0x1f92c5||0x1f4;return function(_0x583238){logger['error'](_0x583238['stack']);if(_0x583238[_0xd69e('0x1e')]){delete _0x583238[_0xd69e('0x1e')];}_0x5393a6[_0xd69e('0x12')](_0x1f92c5)[_0xd69e('0x1f')](_0x583238);};}exports[_0xd69e('0x20')]=function(_0x36f61e,_0x16de08){var _0x1292c5={};var _0xb45e19={'count':0x0,'rows':[]};var _0x3dc2ac=_[_0xd69e('0x21')](db['OpenchannelQueue'][_0xd69e('0x22')],function(_0x2c7f6c){return{'name':_0x2c7f6c[_0xd69e('0x23')],'type':_0x2c7f6c[_0xd69e('0x24')]['key']};});_0x1292c5=qs[_0xd69e('0x25')](_0x3dc2ac,_0x36f61e);var _0x118625={'where':_0x1292c5['where']};return db[_0xd69e('0x26')][_0xd69e('0x17')](_0x118625)[_0xd69e('0x1a')](function(_0xf17ce0){_0xb45e19[_0xd69e('0x17')]=_0xf17ce0;_0x1292c5[_0xd69e('0x27')]=qs[_0xd69e('0x27')](_0x36f61e[_0xd69e('0x28')]);return db[_0xd69e('0x26')][_0xd69e('0x29')](_0x1292c5);})[_0xd69e('0x1a')](function(_0x44ac64){_0xb45e19[_0xd69e('0x2a')]=_0x44ac64;return _0xb45e19;})[_0xd69e('0x1a')](respondWithFilteredResult(_0x16de08,_0x1292c5))['catch'](handleError(_0x16de08,null));};exports[_0xd69e('0x2b')]=function(_0x1ad516,_0x3636dd){var _0x57e0fe={'raw':!![],'where':{'id':_0x1ad516[_0xd69e('0x2c')]['id']}},_0x28ea70={};_0x28ea70[_0xd69e('0x2d')]=_['keys'](db['OpenchannelQueue'][_0xd69e('0x22')]);_0x28ea70[_0xd69e('0x28')]=_[_0xd69e('0x2e')](_0x1ad516[_0xd69e('0x28')]);_0x28ea70[_0xd69e('0x2f')]=_['intersection'](_0x28ea70[_0xd69e('0x2d')],_0x28ea70[_0xd69e('0x28')]);_0x57e0fe[_0xd69e('0x30')]=_['intersection'](_0x28ea70[_0xd69e('0x2d')],qs['fields'](_0x1ad516['query'][_0xd69e('0x31')]));_0x57e0fe[_0xd69e('0x30')]=_0x57e0fe[_0xd69e('0x30')][_0xd69e('0x32')]?_0x57e0fe['attributes']:_0x28ea70[_0xd69e('0x2d')];if(_0x1ad516[_0xd69e('0x28')][_0xd69e('0x33')]){_0x57e0fe[_0xd69e('0x27')]=[{'all':!![]}];}_0x57e0fe=_[_0xd69e('0x34')]({},_0x57e0fe,_0x1ad516[_0xd69e('0x35')]);return db[_0xd69e('0x26')][_0xd69e('0x36')](_0x57e0fe)['then'](handleEntityNotFound(_0x3636dd,null))[_0xd69e('0x1a')](respondWithResult(_0x3636dd,null))[_0xd69e('0x37')](handleError(_0x3636dd,null));};exports['create']=function(_0x5ffc07,_0x1c2d6e){return db[_0xd69e('0x26')][_0xd69e('0x38')](_0x5ffc07[_0xd69e('0x39')],{})[_0xd69e('0x1a')](function(_0x30909d){var _0x5a1de1=_0x5ffc07[_0xd69e('0x3a')][_0xd69e('0x1c')]({'plain':!![]});if(!_0x5a1de1)throw new Error(_0xd69e('0x3b'));if(_0x5a1de1[_0xd69e('0x3c')]===_0xd69e('0x3a')){var _0x68978a=_0x30909d[_0xd69e('0x1c')]({'plain':!![]});var _0x2db4c4=_0xd69e('0x1d');return db[_0xd69e('0x3d')]['find']({'where':{'name':_0x2db4c4,'userProfileId':_0x5a1de1[_0xd69e('0x3e')]},'raw':!![]})[_0xd69e('0x1a')](function(_0xab5674){if(_0xab5674&&_0xab5674[_0xd69e('0x3f')]===0x0){return db['UserProfileResource'][_0xd69e('0x38')]({'name':_0x68978a['name'],'resourceId':_0x68978a['id'],'type':_0xab5674[_0xd69e('0x1e')],'sectionId':_0xab5674['id']},{})[_0xd69e('0x1a')](function(){return _0x30909d;});}else{return _0x30909d;}})[_0xd69e('0x37')](function(_0x2abd9c){logger['error'](_0xd69e('0x40'),_0x2abd9c);throw _0x2abd9c;});}return _0x30909d;})['then'](respondWithResult(_0x1c2d6e,0xc9))[_0xd69e('0x37')](handleError(_0x1c2d6e,null));};exports['update']=function(_0x4d2a44,_0x4b4ff2){if(_0x4d2a44[_0xd69e('0x39')]['id']){delete _0x4d2a44[_0xd69e('0x39')]['id'];}return db[_0xd69e('0x26')][_0xd69e('0x36')]({'where':{'id':_0x4d2a44[_0xd69e('0x2c')]['id']}})['then'](handleEntityNotFound(_0x4b4ff2,null))['then'](saveUpdates(_0x4d2a44['body'],null))[_0xd69e('0x1a')](respondWithResult(_0x4b4ff2,null))[_0xd69e('0x37')](handleError(_0x4b4ff2,null));};exports['destroy']=function(_0x3912cb,_0x56fd8b){return db[_0xd69e('0x26')][_0xd69e('0x36')]({'where':{'id':_0x3912cb['params']['id']}})[_0xd69e('0x1a')](handleEntityNotFound(_0x56fd8b,null))[_0xd69e('0x1a')](removeEntity(_0x56fd8b,null))[_0xd69e('0x37')](handleError(_0x56fd8b,null));};exports['describe']=function(_0x758746,_0xd8af2b){return db[_0xd69e('0x26')]['describe']()['then'](respondWithResult(_0xd8af2b,null))[_0xd69e('0x37')](handleError(_0xd8af2b,null));};exports[_0xd69e('0x41')]=function(_0x22a3f7,_0x3cad4b){var _0x594533={'raw':!![],'where':{}},_0x2a24bc={},_0x3cd2e6;return db[_0xd69e('0x26')]['findOne']({'where':{'id':_0x22a3f7[_0xd69e('0x2c')]['id']}})[_0xd69e('0x1a')](handleEntityNotFound(_0x3cad4b,null))[_0xd69e('0x1a')](function(_0x4e6d0f){if(_0x4e6d0f){_0x3cd2e6=_0x4e6d0f[_0xd69e('0x1c')]({'plain':!![]});_0x2a24bc['model']=_[_0xd69e('0x2e')](db['UserOpenchannelQueue'][_0xd69e('0x22')]);_0x2a24bc[_0xd69e('0x28')]=_[_0xd69e('0x2e')](_0x22a3f7[_0xd69e('0x28')]);_0x2a24bc['filters']=_['intersection'](_0x2a24bc[_0xd69e('0x2d')],_0x2a24bc[_0xd69e('0x28')]);_0x594533[_0xd69e('0x30')]=_[_0xd69e('0x42')](_0x2a24bc[_0xd69e('0x2d')],qs[_0xd69e('0x31')](_0x22a3f7[_0xd69e('0x28')][_0xd69e('0x31')]));_0x594533[_0xd69e('0x30')]=_0x594533[_0xd69e('0x30')]['length']?_0x594533[_0xd69e('0x30')]:_0x2a24bc['model'];if(!_0x22a3f7[_0xd69e('0x28')][_0xd69e('0x43')](_0xd69e('0x44'))){_0x594533[_0xd69e('0x16')]=qs['limit'](_0x22a3f7['query'][_0xd69e('0x16')]);_0x594533[_0xd69e('0x14')]=qs[_0xd69e('0x14')](_0x22a3f7[_0xd69e('0x28')][_0xd69e('0x14')]);}_0x594533['order']=qs[_0xd69e('0x45')](_0x22a3f7[_0xd69e('0x28')][_0xd69e('0x45')]);_0x594533[_0xd69e('0x46')]=qs[_0xd69e('0x2f')](_[_0xd69e('0x47')](_0x22a3f7[_0xd69e('0x28')],_0x2a24bc[_0xd69e('0x2f')]));_0x594533[_0xd69e('0x46')][_0xd69e('0x48')]=_0x4e6d0f['id'];if(_0x22a3f7[_0xd69e('0x28')]['filter']){_0x594533[_0xd69e('0x46')]=_[_0xd69e('0x34')](_0x594533['where'],{'$or':_[_0xd69e('0x21')](_0x594533[_0xd69e('0x30')],function(_0x44d7bd){var _0x45ee26={};_0x45ee26[_0x44d7bd]={'$like':'%'+_0x22a3f7['query'][_0xd69e('0x49')]+'%'};return _0x45ee26;})});}_0x594533=_[_0xd69e('0x34')]({},_0x594533,_0x22a3f7['options']);return db[_0xd69e('0x4a')][_0xd69e('0x29')](_0x594533);}})['then'](function(_0x6ef73c){if(_0x6ef73c){return db[_0xd69e('0x4b')]['findAndCountAll']({'where':{'id':_[_0xd69e('0x21')](_0x6ef73c,_0xd69e('0x4c')),'role':_0xd69e('0x4d')},'attributes':['id',_0xd69e('0x1e'),_0xd69e('0x4e'),_0xd69e('0x4f'),'createdAt']});}})[_0xd69e('0x1a')](function(_0x44d7b2){if(_0x44d7b2){return{'count':_0x44d7b2[_0xd69e('0x17')],'rows':_[_0xd69e('0x21')](_0x44d7b2[_0xd69e('0x2a')],function(_0x580e69){return{'membername':_0x580e69[_0xd69e('0x1e')],'UserId':_0x580e69['id'],'queue_name':_0x3cd2e6[_0xd69e('0x1e')],'OpenchannelQueueId':_0x3cd2e6['id'],'interface':util[_0xd69e('0x50')](_0xd69e('0x51'),_0xd69e('0x52'),_0x580e69[_0xd69e('0x1e')]),'penalty':0x0,'paused':_0x580e69[_0xd69e('0x4e')],'createdAt':_0x580e69['createdAt'],'updatedAt':_0x580e69[_0xd69e('0x4f')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x3cad4b,_0x594533))['catch'](handleError(_0x3cad4b,null));};exports[_0xd69e('0x53')]=function(_0x2b3f22,_0x314015){var _0x119c64={};var _0x222d43={};var _0x5bae3e;var _0x18d088;return db['OpenchannelQueue'][_0xd69e('0x54')]({'where':{'id':_0x2b3f22[_0xd69e('0x2c')]['id']}})['then'](handleEntityNotFound(_0x314015,null))[_0xd69e('0x1a')](function(_0x4fe1dd){if(_0x4fe1dd){_0x5bae3e=_0x4fe1dd;_0x222d43[_0xd69e('0x2d')]=_['keys'](db['Team'][_0xd69e('0x22')]);_0x222d43[_0xd69e('0x28')]=_[_0xd69e('0x2e')](_0x2b3f22['query']);_0x222d43[_0xd69e('0x2f')]=_[_0xd69e('0x42')](_0x222d43[_0xd69e('0x2d')],_0x222d43['query']);_0x119c64['attributes']=_[_0xd69e('0x42')](_0x222d43[_0xd69e('0x2d')],qs[_0xd69e('0x31')](_0x2b3f22[_0xd69e('0x28')][_0xd69e('0x31')]));_0x119c64['attributes']=_0x119c64[_0xd69e('0x30')][_0xd69e('0x32')]?_0x119c64[_0xd69e('0x30')]:_0x222d43[_0xd69e('0x2d')];_0x119c64[_0xd69e('0x55')]=qs[_0xd69e('0x45')](_0x2b3f22[_0xd69e('0x28')][_0xd69e('0x45')]);_0x119c64[_0xd69e('0x46')]=qs[_0xd69e('0x2f')](_['pick'](_0x2b3f22[_0xd69e('0x28')],_0x222d43[_0xd69e('0x2f')]));if(_0x2b3f22[_0xd69e('0x28')][_0xd69e('0x49')]){_0x119c64[_0xd69e('0x46')]=_[_0xd69e('0x34')](_0x119c64['where'],{'$or':_[_0xd69e('0x21')](_0x119c64[_0xd69e('0x30')],function(_0x3ee509){var _0x338791={};_0x338791[_0x3ee509]={'$like':'%'+_0x2b3f22['query'][_0xd69e('0x49')]+'%'};return _0x338791;})});}_0x119c64=_[_0xd69e('0x34')]({},_0x119c64,_0x2b3f22[_0xd69e('0x35')]);return _0x5bae3e[_0xd69e('0x53')](_0x119c64);}})['then'](function(_0x47ad9e){if(_0x47ad9e){_0x18d088=_0x47ad9e[_0xd69e('0x32')];if(!_0x2b3f22[_0xd69e('0x28')][_0xd69e('0x43')](_0xd69e('0x44'))){_0x119c64[_0xd69e('0x16')]=qs['limit'](_0x2b3f22['query'][_0xd69e('0x16')]);_0x119c64['offset']=qs[_0xd69e('0x14')](_0x2b3f22['query'][_0xd69e('0x14')]);}return _0x5bae3e[_0xd69e('0x53')](_0x119c64);}})['then'](function(_0x50ed0a){if(_0x50ed0a){return _0x50ed0a?{'count':_0x18d088,'rows':_0x50ed0a}:null;}})[_0xd69e('0x1a')](respondWithResult(_0x314015,null))[_0xd69e('0x37')](handleError(_0x314015,null));};exports[_0xd69e('0x56')]=function(_0x14e141,_0x14ee4d){var _0x3786dd=_0x14e141[_0xd69e('0x39')][_0xd69e('0x57')];return db['Team'][_0xd69e('0x29')]({'where':{'id':_0x3786dd},'attributes':['id'],'include':[{'model':db[_0xd69e('0x4b')],'as':_0xd69e('0x58'),'attributes':['id',_0xd69e('0x1e'),_0xd69e('0x59'),_0xd69e('0x5a'),_0xd69e('0x5b')],'raw':!![]}]})[_0xd69e('0x1a')](function(_0x53f0d7){if(_0x53f0d7){var _0x54c511=_[_0xd69e('0x5c')](_0x53f0d7,function(_0x4e7aff){var _0x40f4cf=_0x4e7aff[_0xd69e('0x1c')]({'plain':!![]});return _0x40f4cf['Agents'];});return db[_0xd69e('0x26')][_0xd69e('0x36')]({'where':{'id':_0x14e141[_0xd69e('0x2c')]['id']}})['then'](function(_0x1f95e8){return db[_0xd69e('0x5d')][_0xd69e('0x5e')](function(_0x5b8827){return _0x1f95e8[_0xd69e('0x56')](_0x3786dd,{'transaction':_0x5b8827})['then'](function(){return BPromise[_0xd69e('0x5f')](_0x54c511,function(_0x589d73){return db[_0xd69e('0x4a')][_0xd69e('0x60')]({'where':{'UserId':_0x589d73['id'],'OpenchannelQueueId':_0x14e141[_0xd69e('0x2c')]['id']},'transaction':_0x5b8827});});})['then'](function(){_0x54c511[_0xd69e('0x61')](function(_0x2b3e1e){socket[_0xd69e('0x62')](_0xd69e('0x63'),{'UserId':_0x2b3e1e['id'],'OpenchannelQueueId':_0x1f95e8['id']});});});});});}})[_0xd69e('0x1a')](respondWithStatusCode(_0x14ee4d,null))[_0xd69e('0x37')](handleError(_0x14ee4d,null));};exports[_0xd69e('0x64')]=function(_0x2eea21,_0x12776d){return db[_0xd69e('0x65')][_0xd69e('0x29')]({'where':{'id':_0x2eea21[_0xd69e('0x28')][_0xd69e('0x57')]},'attributes':['id'],'include':[{'model':db[_0xd69e('0x4b')],'as':_0xd69e('0x58'),'attributes':['id'],'raw':!![]}]})[_0xd69e('0x1a')](handleEntityNotFound(_0x12776d,null))[_0xd69e('0x1a')](function(_0x2f14a0){var _0x5cac57=_['map'](_0x2f14a0,'id');var _0x35d93d=[];var _0x38b8a0=[];var _0xc465a9=squel[_0xd69e('0x66')]();_0xc465a9[_0xd69e('0x67')](_0xd69e('0x68'))[_0xd69e('0x69')](_0xd69e('0x6a'),'tq')[_0xd69e('0x6b')]('user_has_teams','ut',_0xd69e('0x6c'))['where']('OpenchannelQueueId\x20=\x20?',_0x2eea21[_0xd69e('0x2c')]['id']);for(var _0x26f95e=0x0;_0x26f95e<_0x2f14a0[_0xd69e('0x32')];_0x26f95e+=0x1){let _0x44feb5=_0x2f14a0[_0x26f95e];for(var _0x37bbf8=0x0;_0x37bbf8<_0x44feb5[_0xd69e('0x58')]['length'];_0x37bbf8+=0x1){let _0x43eac7=_0x44feb5[_0xd69e('0x58')][_0x37bbf8];var _0x99d69f=_0xc465a9[_0xd69e('0x6d')]();_0x99d69f['where'](_0xd69e('0x6e'),_0x43eac7['id']);_0x38b8a0[_0xd69e('0x6f')](db[_0xd69e('0x5d')][_0xd69e('0x28')](_0x99d69f[_0xd69e('0x70')](),{'type':db[_0xd69e('0x5d')]['QueryTypes'][_0xd69e('0x71')]})[_0xd69e('0x1a')](function(_0x3079df){if(_0x3079df[_0xd69e('0x32')]===0x1){return _0x43eac7['id'];}else{var _0x10bf09=_[_0xd69e('0x72')](_[_0xd69e('0x21')](_0x3079df,'TeamId'),function(_0x4fa954){return _[_0xd69e('0x73')](_0x5cac57,_0x4fa954);});if(_0x10bf09){return _0x43eac7['id'];}}}));}}return BPromise['all'](_0x38b8a0)[_0xd69e('0x1a')](function(_0x243957){_0x35d93d=_(_0x35d93d)[_0xd69e('0x74')](_0x243957)[_0xd69e('0x75')]()['value']();return db[_0xd69e('0x26')]['find']({'where':{'id':_0x2eea21[_0xd69e('0x2c')]['id']}})[_0xd69e('0x1a')](function(_0x38a775){return db[_0xd69e('0x5d')][_0xd69e('0x5e')](function(_0x5bd844){return _0x38a775['removeTeams'](_0x2eea21[_0xd69e('0x28')][_0xd69e('0x57')],{'transaction':_0x5bd844})[_0xd69e('0x1a')](function(){if(!_[_0xd69e('0x76')](_0x35d93d)){return _0x38a775[_0xd69e('0x77')](_0x35d93d,{'transaction':_0x5bd844});}})[_0xd69e('0x1a')](function(){_0x35d93d[_0xd69e('0x61')](function(_0x2ba4c4){socket['emit']('userOpenchannelQueue:remove',{'UserId':_0x2ba4c4,'OpenchannelQueueId':_0x38a775['id']});});});});});});})[_0xd69e('0x1a')](respondWithStatusCode(_0x12776d,null))[_0xd69e('0x37')](handleError(_0x12776d,null));};exports[_0xd69e('0x78')]=function(_0x220cca,_0x2ee6fe){return db[_0xd69e('0x26')][_0xd69e('0x36')]({'where':{'id':_0x220cca[_0xd69e('0x2c')]['id']}})['then'](handleEntityNotFound(_0x2ee6fe,null))[_0xd69e('0x1a')](function(_0x17d86b){if(_0x17d86b){return _0x17d86b['addAgents'](_0x220cca[_0xd69e('0x39')][_0xd69e('0x57')],_[_0xd69e('0x79')](_0x220cca[_0xd69e('0x39')],[_0xd69e('0x57'),'id'])||{})['spread'](function(_0x2e8cf8){for(var _0x548e7f=0x0;_0x548e7f<_0x220cca[_0xd69e('0x39')][_0xd69e('0x57')][_0xd69e('0x32')];_0x548e7f+=0x1){socket['emit'](_0xd69e('0x63'),{'UserId':Number(_0x220cca[_0xd69e('0x39')][_0xd69e('0x57')][_0x548e7f]),'OpenchannelQueueId':Number(_0x220cca[_0xd69e('0x2c')]['id'])});}return _0x2e8cf8;});}})[_0xd69e('0x1a')](respondWithResult(_0x2ee6fe,null))[_0xd69e('0x37')](handleError(_0x2ee6fe,null));};exports[_0xd69e('0x77')]=function(_0x286de5,_0x51461c){return db[_0xd69e('0x26')]['find']({'where':{'id':_0x286de5[_0xd69e('0x2c')]['id']}})['then'](handleEntityNotFound(_0x51461c,null))[_0xd69e('0x1a')](function(_0x3bec51){if(_0x3bec51){return _0x3bec51[_0xd69e('0x77')](_0x286de5['query'][_0xd69e('0x57')])[_0xd69e('0x1a')](function(){if(_['isArray'](_0x286de5['query']['ids'])){for(var _0x810c16=0x0;_0x810c16<_0x286de5[_0xd69e('0x28')][_0xd69e('0x57')][_0xd69e('0x32')];_0x810c16+=0x1){socket[_0xd69e('0x62')](_0xd69e('0x7a'),{'UserId':Number(_0x286de5['query'][_0xd69e('0x57')][_0x810c16]),'OpenchannelQueueId':Number(_0x286de5[_0xd69e('0x2c')]['id'])});}}else{socket['emit']('userOpenchannelQueue:remove',{'UserId':Number(_0x286de5[_0xd69e('0x28')][_0xd69e('0x57')]),'OpenchannelQueueId':Number(_0x286de5[_0xd69e('0x2c')]['id'])});}});}})[_0xd69e('0x1a')](respondWithStatusCode(_0x51461c,null))[_0xd69e('0x37')](handleError(_0x51461c,null));};exports['getAgents']=function(_0x4b01a8,_0x33060f){var _0x473f0c={};var _0x4bb875={};var _0x1bfe27;var _0x3da6bc;return db[_0xd69e('0x26')][_0xd69e('0x54')]({'where':{'id':_0x4b01a8[_0xd69e('0x2c')]['id']}})[_0xd69e('0x1a')](handleEntityNotFound(_0x33060f,null))[_0xd69e('0x1a')](function(_0x3ab014){if(_0x3ab014){_0x1bfe27=_0x3ab014;_0x4bb875[_0xd69e('0x2d')]=_['keys'](db['User'][_0xd69e('0x22')]);_0x4bb875[_0xd69e('0x28')]=_['keys'](_0x4b01a8[_0xd69e('0x28')]);_0x4bb875[_0xd69e('0x2f')]=_[_0xd69e('0x42')](_0x4bb875[_0xd69e('0x2d')],_0x4bb875[_0xd69e('0x28')]);_0x473f0c[_0xd69e('0x30')]=_[_0xd69e('0x42')](_0x4bb875[_0xd69e('0x2d')],qs[_0xd69e('0x31')](_0x4b01a8[_0xd69e('0x28')][_0xd69e('0x31')]));_0x473f0c[_0xd69e('0x30')]=_0x473f0c[_0xd69e('0x30')][_0xd69e('0x32')]?_0x473f0c[_0xd69e('0x30')]:_0x4bb875[_0xd69e('0x2d')];_0x473f0c['order']=qs[_0xd69e('0x45')](_0x4b01a8[_0xd69e('0x28')][_0xd69e('0x45')]);_0x473f0c['where']=qs['filters'](_['pick'](_0x4b01a8[_0xd69e('0x28')],_0x4bb875[_0xd69e('0x2f')]));if(_0x4b01a8[_0xd69e('0x28')][_0xd69e('0x49')]){_0x473f0c[_0xd69e('0x46')]=_[_0xd69e('0x34')](_0x473f0c[_0xd69e('0x46')],{'$or':_[_0xd69e('0x21')](_0x473f0c[_0xd69e('0x30')],function(_0x5a095d){var _0x196d53={};_0x196d53[_0x5a095d]={'$like':'%'+_0x4b01a8[_0xd69e('0x28')][_0xd69e('0x49')]+'%'};return _0x196d53;})});}_0x473f0c=_[_0xd69e('0x34')]({},_0x473f0c,_0x4b01a8[_0xd69e('0x35')]);return _0x1bfe27[_0xd69e('0x7b')](_0x473f0c);}})[_0xd69e('0x1a')](function(_0x2d331f){if(_0x2d331f){_0x3da6bc=_0x2d331f[_0xd69e('0x32')];if(!_0x4b01a8[_0xd69e('0x28')][_0xd69e('0x43')](_0xd69e('0x44'))){_0x473f0c[_0xd69e('0x16')]=qs[_0xd69e('0x16')](_0x4b01a8[_0xd69e('0x28')]['limit']);_0x473f0c['offset']=qs[_0xd69e('0x14')](_0x4b01a8[_0xd69e('0x28')]['offset']);}return _0x1bfe27[_0xd69e('0x7b')](_0x473f0c);}})[_0xd69e('0x1a')](function(_0x39d8ab){if(_0x39d8ab){return _0x39d8ab?{'count':_0x3da6bc,'rows':_0x39d8ab}:null;}})['then'](respondWithResult(_0x33060f,null))[_0xd69e('0x37')](handleError(_0x33060f,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index 4c2dde8..4040254 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 _0xcdcc=['OpenchannelQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0xe6c335,_0x276ffe){var _0x86836b=function(_0x508fd2){while(--_0x508fd2){_0xe6c335['push'](_0xe6c335['shift']());}};_0x86836b(++_0x276ffe);}(_0xcdcc,0xa3));var _0xccdc=function(_0x2cc649,_0x3b9b41){_0x2cc649=_0x2cc649-0x0;var _0x6bac75=_0xcdcc[_0x2cc649];return _0x6bac75;};'use strict';var EventEmitter=require(_0xccdc('0x0'));var OpenchannelQueue=require(_0xccdc('0x1'))['db'][_0xccdc('0x2')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0xccdc('0x3')](0x0);var events={'afterCreate':_0xccdc('0x4'),'afterUpdate':_0xccdc('0x5'),'afterDestroy':_0xccdc('0x6')};function emitEvent(_0xae08c8){return function(_0x1bed40,_0x3444af,_0x120a6b){OpenchannelQueueEvents[_0xccdc('0x7')](_0xae08c8+':'+_0x1bed40['id'],_0x1bed40);OpenchannelQueueEvents[_0xccdc('0x7')](_0xae08c8,_0x1bed40);_0x120a6b(null);};}for(var e in events){if(events[_0xccdc('0x8')](e)){var event=events[e];OpenchannelQueue[_0xccdc('0x9')](e,emitEvent(event));}}module[_0xccdc('0xa')]=OpenchannelQueueEvents; \ No newline at end of file +var _0x3e26=['hook','events','../../mysqldb','OpenchannelQueue','setMaxListeners','update','remove','emit'];(function(_0x59e0fc,_0x2ad48c){var _0x477e19=function(_0x3fabc9){while(--_0x3fabc9){_0x59e0fc['push'](_0x59e0fc['shift']());}};_0x477e19(++_0x2ad48c);}(_0x3e26,0xe1));var _0x63e2=function(_0x346687,_0x1e1bd8){_0x346687=_0x346687-0x0;var _0x31d223=_0x3e26[_0x346687];return _0x31d223;};'use strict';var EventEmitter=require(_0x63e2('0x0'));var OpenchannelQueue=require(_0x63e2('0x1'))['db'][_0x63e2('0x2')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x63e2('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x63e2('0x4'),'afterDestroy':_0x63e2('0x5')};function emitEvent(_0x1fdca0){return function(_0x1ef797,_0x4df2ff,_0x3a42c1){OpenchannelQueueEvents[_0x63e2('0x6')](_0x1fdca0+':'+_0x1ef797['id'],_0x1ef797);OpenchannelQueueEvents['emit'](_0x1fdca0,_0x1ef797);_0x3a42c1(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelQueue[_0x63e2('0x7')](e,emitEvent(event));}}module['exports']=OpenchannelQueueEvents; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.model.js b/server/api/openchannelQueue/openchannelQueue.model.js index 168291f..210644b 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 _0xaff6=['./openchannelQueue.attributes','exports','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x3672a8,_0x547725){var _0x470ed6=function(_0x5c30b9){while(--_0x5c30b9){_0x3672a8['push'](_0x3672a8['shift']());}};_0x470ed6(++_0x547725);}(_0xaff6,0xf2));var _0x6aff=function(_0x487289,_0xced20b){_0x487289=_0x487289-0x0;var _0x2d6d1a=_0xaff6[_0x487289];return _0x2d6d1a;};'use strict';var _=require(_0x6aff('0x0'));var util=require(_0x6aff('0x1'));var logger=require(_0x6aff('0x2'))('api');var moment=require('moment');var BPromise=require(_0x6aff('0x3'));var rp=require(_0x6aff('0x4'));var fs=require('fs');var path=require(_0x6aff('0x5'));var rimraf=require(_0x6aff('0x6'));var config=require(_0x6aff('0x7'));var attributes=require(_0x6aff('0x8'));module[_0x6aff('0x9')]=function(_0x4ed676,_0x42b347){return _0x4ed676['define']('OpenchannelQueue',attributes,{'tableName':'openchannel_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdd28=['util','../../config/logger','api','moment','bluebird','request-promise','path','exports','define','OpenchannelQueue','openchannel_queues','lodash'];(function(_0x10035e,_0x1315b5){var _0x3f64b4=function(_0x189276){while(--_0x189276){_0x10035e['push'](_0x10035e['shift']());}};_0x3f64b4(++_0x1315b5);}(_0xdd28,0xfb));var _0x8dd2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xdd28[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x8dd2('0x0'));var util=require(_0x8dd2('0x1'));var logger=require(_0x8dd2('0x2'))(_0x8dd2('0x3'));var moment=require(_0x8dd2('0x4'));var BPromise=require(_0x8dd2('0x5'));var rp=require(_0x8dd2('0x6'));var fs=require('fs');var path=require(_0x8dd2('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./openchannelQueue.attributes');module[_0x8dd2('0x8')]=function(_0x5ac649,_0x27abef){return _0x5ac649[_0x8dd2('0x9')](_0x8dd2('0xa'),attributes,{'tableName':_0x8dd2('0xb'),'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 67e4e93..8ad6254 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 _0x0ee1=['rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./openchannelQueue.socket','register','request','then','request\x20sent','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','OpenchannelQueue,\x20%s,\x20%s','info','catch','GetOpenchannelQueue','OpenchannelQueue','findAll','options','raw','where','attributes','limit','model','map','include','ShowOpenchannelQueue','find','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x1b2779,_0x181d22){var _0x162929=function(_0x2d0083){while(--_0x2d0083){_0x1b2779['push'](_0x1b2779['shift']());}};_0x162929(++_0x181d22);}(_0x0ee1,0x7c));var _0x10ee=function(_0x19fc3e,_0x1a060e){_0x19fc3e=_0x19fc3e-0x0;var _0x56a220=_0x0ee1[_0x19fc3e];return _0x56a220;};'use strict';var _=require(_0x10ee('0x0'));var util=require(_0x10ee('0x1'));var moment=require(_0x10ee('0x2'));var BPromise=require('bluebird');var rs=require(_0x10ee('0x3'));var fs=require('fs');var Redis=require(_0x10ee('0x4'));var db=require(_0x10ee('0x5'))['db'];var utils=require(_0x10ee('0x6'));var logger=require(_0x10ee('0x7'))(_0x10ee('0x8'));var config=require(_0x10ee('0x9'));var jayson=require(_0x10ee('0xa'));var client=jayson[_0x10ee('0xb')][_0x10ee('0xc')]({'port':0x232a});config[_0x10ee('0xd')]=_[_0x10ee('0xe')](config[_0x10ee('0xd')],{'host':_0x10ee('0xf'),'port':0x18eb});var socket=require(_0x10ee('0x10'))(new Redis(config['redis']));require(_0x10ee('0x11'))[_0x10ee('0x12')](socket);function respondWithRpcPromise(_0x5056b3,_0x4c7c9d,_0x5bf6cb){return new BPromise(function(_0x3a1828,_0x2d3381){return client[_0x10ee('0x13')](_0x5056b3,_0x5bf6cb)[_0x10ee('0x14')](function(_0x43d081){logger['info']('OpenchannelQueue,\x20%s,\x20%s',_0x4c7c9d,_0x10ee('0x15'));logger[_0x10ee('0x16')](_0x10ee('0x17'),_0x4c7c9d,_0x10ee('0x15'),JSON[_0x10ee('0x18')](_0x43d081));if(_0x43d081[_0x10ee('0x19')]){if(_0x43d081[_0x10ee('0x19')][_0x10ee('0x1a')]===0x1f4){logger[_0x10ee('0x19')]('OpenchannelQueue,\x20%s,\x20%s',_0x4c7c9d,_0x43d081[_0x10ee('0x19')][_0x10ee('0x1b')]);return _0x2d3381(_0x43d081[_0x10ee('0x19')][_0x10ee('0x1b')]);}logger[_0x10ee('0x19')](_0x10ee('0x1c'),_0x4c7c9d,_0x43d081[_0x10ee('0x19')][_0x10ee('0x1b')]);return _0x3a1828(_0x43d081[_0x10ee('0x19')]['message']);}else{logger[_0x10ee('0x1d')](_0x10ee('0x1c'),_0x4c7c9d,_0x10ee('0x15'));_0x3a1828(_0x43d081['result'][_0x10ee('0x1b')]);}})[_0x10ee('0x1e')](function(_0x1c4d57){logger[_0x10ee('0x19')]('OpenchannelQueue,\x20%s,\x20%s',_0x4c7c9d,_0x1c4d57);_0x2d3381(_0x1c4d57);});});}exports[_0x10ee('0x1f')]=function(_0x1ea4a5){var _0x541152=this;return new Promise(function(_0x466609,_0xc568da){return db[_0x10ee('0x20')][_0x10ee('0x21')]({'raw':_0x1ea4a5['options']?_0x1ea4a5[_0x10ee('0x22')][_0x10ee('0x23')]===undefined?!![]:![]:!![],'where':_0x1ea4a5['options']?_0x1ea4a5[_0x10ee('0x22')][_0x10ee('0x24')]||null:null,'attributes':_0x1ea4a5[_0x10ee('0x22')]?_0x1ea4a5[_0x10ee('0x22')][_0x10ee('0x25')]||null:null,'limit':_0x1ea4a5[_0x10ee('0x22')]?_0x1ea4a5['options'][_0x10ee('0x26')]||null:null,'include':_0x1ea4a5[_0x10ee('0x22')]?_0x1ea4a5[_0x10ee('0x22')]['include']?_['map'](_0x1ea4a5[_0x10ee('0x22')]['include'],function(_0x3d9010){return{'model':db[_0x3d9010[_0x10ee('0x27')]],'as':_0x3d9010['as'],'attributes':_0x3d9010['attributes'],'include':_0x3d9010['include']?_[_0x10ee('0x28')](_0x3d9010[_0x10ee('0x29')],function(_0x41fe6f){return{'model':db[_0x41fe6f[_0x10ee('0x27')]],'as':_0x41fe6f['as'],'attributes':_0x41fe6f[_0x10ee('0x25')],'include':_0x41fe6f[_0x10ee('0x29')]?_['map'](_0x41fe6f[_0x10ee('0x29')],function(_0x1c9bd9){return{'model':db[_0x1c9bd9[_0x10ee('0x27')]],'as':_0x1c9bd9['as'],'attributes':_0x1c9bd9[_0x10ee('0x25')]};}):[]};}):[]};}):[]:[]})[_0x10ee('0x14')](function(_0x142431){logger[_0x10ee('0x1d')](_0x10ee('0x1f'),_0x1ea4a5);logger[_0x10ee('0x16')](_0x10ee('0x1f'),_0x1ea4a5,JSON[_0x10ee('0x18')](_0x142431));_0x466609(_0x142431);})[_0x10ee('0x1e')](function(_0x4b6154){logger[_0x10ee('0x19')](_0x10ee('0x1f'),_0x4b6154[_0x10ee('0x1b')],_0x1ea4a5);_0xc568da(_0x541152[_0x10ee('0x19')](0x1f4,_0x4b6154['message']));});});};exports[_0x10ee('0x2a')]=function(_0x493df8){var _0x1c83f7=this;return new Promise(function(_0xfb7dde,_0x250fd2){return db[_0x10ee('0x20')][_0x10ee('0x2b')]({'raw':_0x493df8['options']?_0x493df8[_0x10ee('0x22')][_0x10ee('0x23')]===undefined?!![]:![]:!![],'where':_0x493df8[_0x10ee('0x22')]?_0x493df8[_0x10ee('0x22')][_0x10ee('0x24')]||null:null,'attributes':_0x493df8[_0x10ee('0x22')]?_0x493df8[_0x10ee('0x22')][_0x10ee('0x25')]||null:null,'include':_0x493df8[_0x10ee('0x22')]?_0x493df8[_0x10ee('0x22')][_0x10ee('0x29')]?_['map'](_0x493df8[_0x10ee('0x22')]['include'],function(_0x5c0476){return{'model':db[_0x5c0476['model']],'as':_0x5c0476['as'],'attributes':_0x5c0476[_0x10ee('0x25')],'include':_0x5c0476[_0x10ee('0x29')]?_[_0x10ee('0x28')](_0x5c0476['include'],function(_0x1bafcb){return{'model':db[_0x1bafcb[_0x10ee('0x27')]],'as':_0x1bafcb['as'],'attributes':_0x1bafcb[_0x10ee('0x25')],'include':_0x1bafcb[_0x10ee('0x29')]?_[_0x10ee('0x28')](_0x1bafcb['include'],function(_0x22ef99){return{'model':db[_0x22ef99[_0x10ee('0x27')]],'as':_0x22ef99['as'],'attributes':_0x22ef99['attributes']};}):[]};}):[]};}):[]:[]})[_0x10ee('0x14')](function(_0x2c47c9){logger[_0x10ee('0x1d')](_0x10ee('0x2a'),_0x493df8);logger[_0x10ee('0x16')]('ShowOpenchannelQueue',_0x493df8,JSON[_0x10ee('0x18')](_0x2c47c9));_0xfb7dde(_0x2c47c9);})[_0x10ee('0x1e')](function(_0x2b1bc2){logger[_0x10ee('0x19')]('ShowOpenchannelQueue',_0x2b1bc2[_0x10ee('0x1b')],_0x493df8);_0x250fd2(_0x1c83f7[_0x10ee('0x19')](0x1f4,_0x2b1bc2[_0x10ee('0x1b')]));});});}; \ No newline at end of file +var _0x28d8=['error','code','message','result','catch','OpenchannelQueue','options','raw','where','attributes','limit','map','model','include','GetOpenchannelQueue','stringify','ShowOpenchannelQueue','find','util','moment','randomstring','../../mysqldb','../../config/utils','jayson/promise','client','http','defaults','redis','socket.io-emitter','./openchannelQueue.socket','register','request','then','info','OpenchannelQueue,\x20%s,\x20%s','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x315843,_0x301556){var _0x4fd3bc=function(_0x498e22){while(--_0x498e22){_0x315843['push'](_0x315843['shift']());}};_0x4fd3bc(++_0x301556);}(_0x28d8,0x168));var _0x828d=function(_0x482ed9,_0x589513){_0x482ed9=_0x482ed9-0x0;var _0x4a55f1=_0x28d8[_0x482ed9];return _0x4a55f1;};'use strict';var _=require('lodash');var util=require(_0x828d('0x0'));var moment=require(_0x828d('0x1'));var BPromise=require('bluebird');var rs=require(_0x828d('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x828d('0x3'))['db'];var utils=require(_0x828d('0x4'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x828d('0x5'));var client=jayson[_0x828d('0x6')][_0x828d('0x7')]({'port':0x232a});config['redis']=_[_0x828d('0x8')](config[_0x828d('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x828d('0xa'))(new Redis(config['redis']));require(_0x828d('0xb'))[_0x828d('0xc')](socket);function respondWithRpcPromise(_0x23f433,_0x30a6ed,_0x9182f8){return new BPromise(function(_0x427aab,_0x2dc4f6){return client[_0x828d('0xd')](_0x23f433,_0x9182f8)[_0x828d('0xe')](function(_0x1a7624){logger[_0x828d('0xf')](_0x828d('0x10'),_0x30a6ed,'request\x20sent');logger[_0x828d('0x11')](_0x828d('0x12'),_0x30a6ed,_0x828d('0x13'),JSON['stringify'](_0x1a7624));if(_0x1a7624[_0x828d('0x14')]){if(_0x1a7624[_0x828d('0x14')][_0x828d('0x15')]===0x1f4){logger[_0x828d('0x14')]('OpenchannelQueue,\x20%s,\x20%s',_0x30a6ed,_0x1a7624[_0x828d('0x14')][_0x828d('0x16')]);return _0x2dc4f6(_0x1a7624['error'][_0x828d('0x16')]);}logger['error']('OpenchannelQueue,\x20%s,\x20%s',_0x30a6ed,_0x1a7624[_0x828d('0x14')][_0x828d('0x16')]);return _0x427aab(_0x1a7624[_0x828d('0x14')][_0x828d('0x16')]);}else{logger[_0x828d('0xf')](_0x828d('0x10'),_0x30a6ed,'request\x20sent');_0x427aab(_0x1a7624[_0x828d('0x17')][_0x828d('0x16')]);}})[_0x828d('0x18')](function(_0x1ab551){logger[_0x828d('0x14')](_0x828d('0x10'),_0x30a6ed,_0x1ab551);_0x2dc4f6(_0x1ab551);});});}exports['GetOpenchannelQueue']=function(_0x5f361d){var _0x52bb40=this;return new Promise(function(_0x15f97a,_0x22eebf){return db[_0x828d('0x19')]['findAll']({'raw':_0x5f361d['options']?_0x5f361d[_0x828d('0x1a')][_0x828d('0x1b')]===undefined?!![]:![]:!![],'where':_0x5f361d[_0x828d('0x1a')]?_0x5f361d[_0x828d('0x1a')][_0x828d('0x1c')]||null:null,'attributes':_0x5f361d[_0x828d('0x1a')]?_0x5f361d['options'][_0x828d('0x1d')]||null:null,'limit':_0x5f361d['options']?_0x5f361d[_0x828d('0x1a')][_0x828d('0x1e')]||null:null,'include':_0x5f361d[_0x828d('0x1a')]?_0x5f361d[_0x828d('0x1a')]['include']?_[_0x828d('0x1f')](_0x5f361d['options']['include'],function(_0x59147a){return{'model':db[_0x59147a[_0x828d('0x20')]],'as':_0x59147a['as'],'attributes':_0x59147a[_0x828d('0x1d')],'include':_0x59147a['include']?_[_0x828d('0x1f')](_0x59147a[_0x828d('0x21')],function(_0x5ebb68){return{'model':db[_0x5ebb68[_0x828d('0x20')]],'as':_0x5ebb68['as'],'attributes':_0x5ebb68[_0x828d('0x1d')],'include':_0x5ebb68[_0x828d('0x21')]?_[_0x828d('0x1f')](_0x5ebb68[_0x828d('0x21')],function(_0x23b6a6){return{'model':db[_0x23b6a6['model']],'as':_0x23b6a6['as'],'attributes':_0x23b6a6[_0x828d('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x828d('0xe')](function(_0x142b20){logger[_0x828d('0xf')](_0x828d('0x22'),_0x5f361d);logger[_0x828d('0x11')](_0x828d('0x22'),_0x5f361d,JSON[_0x828d('0x23')](_0x142b20));_0x15f97a(_0x142b20);})[_0x828d('0x18')](function(_0x37bac0){logger[_0x828d('0x14')](_0x828d('0x22'),_0x37bac0[_0x828d('0x16')],_0x5f361d);_0x22eebf(_0x52bb40[_0x828d('0x14')](0x1f4,_0x37bac0['message']));});});};exports[_0x828d('0x24')]=function(_0x49c860){var _0xee4495=this;return new Promise(function(_0x1f57ee,_0x22d0a1){return db['OpenchannelQueue'][_0x828d('0x25')]({'raw':_0x49c860[_0x828d('0x1a')]?_0x49c860['options']['raw']===undefined?!![]:![]:!![],'where':_0x49c860[_0x828d('0x1a')]?_0x49c860[_0x828d('0x1a')][_0x828d('0x1c')]||null:null,'attributes':_0x49c860[_0x828d('0x1a')]?_0x49c860[_0x828d('0x1a')]['attributes']||null:null,'include':_0x49c860[_0x828d('0x1a')]?_0x49c860[_0x828d('0x1a')][_0x828d('0x21')]?_[_0x828d('0x1f')](_0x49c860[_0x828d('0x1a')]['include'],function(_0x2e5b25){return{'model':db[_0x2e5b25['model']],'as':_0x2e5b25['as'],'attributes':_0x2e5b25[_0x828d('0x1d')],'include':_0x2e5b25[_0x828d('0x21')]?_['map'](_0x2e5b25[_0x828d('0x21')],function(_0x5d1f29){return{'model':db[_0x5d1f29[_0x828d('0x20')]],'as':_0x5d1f29['as'],'attributes':_0x5d1f29[_0x828d('0x1d')],'include':_0x5d1f29[_0x828d('0x21')]?_[_0x828d('0x1f')](_0x5d1f29[_0x828d('0x21')],function(_0x562dab){return{'model':db[_0x562dab[_0x828d('0x20')]],'as':_0x562dab['as'],'attributes':_0x562dab['attributes']};}):[]};}):[]};}):[]:[]})[_0x828d('0xe')](function(_0x36bca8){logger['info'](_0x828d('0x24'),_0x49c860);logger['debug'](_0x828d('0x24'),_0x49c860,JSON[_0x828d('0x23')](_0x36bca8));_0x1f57ee(_0x36bca8);})['catch'](function(_0x4751c4){logger[_0x828d('0x14')](_0x828d('0x24'),_0x4751c4[_0x828d('0x16')],_0x49c860);_0x22d0a1(_0xee4495[_0x828d('0x14')](0x1f4,_0x4751c4[_0x828d('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index b345ced..d07a371 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 _0x49a3=['register','length','openchannelQueue:','./openchannelQueue.events','save','remove','update','emit','removeListener'];(function(_0x1c3f75,_0x4d4b16){var _0xbc1b96=function(_0x56c839){while(--_0x56c839){_0x1c3f75['push'](_0x1c3f75['shift']());}};_0xbc1b96(++_0x4d4b16);}(_0x49a3,0x16b));var _0x349a=function(_0x4d0631,_0x16de84){_0x4d0631=_0x4d0631-0x0;var _0x34c864=_0x49a3[_0x4d0631];return _0x34c864;};'use strict';var OpenchannelQueueEvents=require(_0x349a('0x0'));var events=[_0x349a('0x1'),_0x349a('0x2'),_0x349a('0x3')];function createListener(_0x21beb4,_0x1a4ba4){return function(_0xf102e8){_0x1a4ba4[_0x349a('0x4')](_0x21beb4,_0xf102e8);};}function removeListener(_0x314616,_0x2136d6){return function(){OpenchannelQueueEvents[_0x349a('0x5')](_0x314616,_0x2136d6);};}exports[_0x349a('0x6')]=function(_0x3f2fdf){for(var _0x29d2d1=0x0,_0x187b9f=events[_0x349a('0x7')];_0x29d2d1<_0x187b9f;_0x29d2d1++){var _0x142b5d=events[_0x29d2d1];var _0x1f401b=createListener(_0x349a('0x8')+_0x142b5d,_0x3f2fdf);OpenchannelQueueEvents['on'](_0x142b5d,_0x1f401b);}}; \ No newline at end of file +var _0xe1c6=['remove','update','emit','register','openchannelQueue:','./openchannelQueue.events','save'];(function(_0x5f0c2e,_0x33309f){var _0x1c2dda=function(_0x205be4){while(--_0x205be4){_0x5f0c2e['push'](_0x5f0c2e['shift']());}};_0x1c2dda(++_0x33309f);}(_0xe1c6,0x18d));var _0x6e1c=function(_0x3d8163,_0x5470c4){_0x3d8163=_0x3d8163-0x0;var _0x49db86=_0xe1c6[_0x3d8163];return _0x49db86;};'use strict';var OpenchannelQueueEvents=require(_0x6e1c('0x0'));var events=[_0x6e1c('0x1'),_0x6e1c('0x2'),_0x6e1c('0x3')];function createListener(_0x41dde8,_0x37f67c){return function(_0x53ba58){_0x37f67c[_0x6e1c('0x4')](_0x41dde8,_0x53ba58);};}function removeListener(_0x500a2a,_0xf3008b){return function(){OpenchannelQueueEvents['removeListener'](_0x500a2a,_0xf3008b);};}exports[_0x6e1c('0x5')]=function(_0x1d4f6c){for(var _0xfe7d3e=0x0,_0x4602aa=events['length'];_0xfe7d3e<_0x4602aa;_0xfe7d3e++){var _0x4e9c87=events[_0xfe7d3e];var _0x283e42=createListener(_0x6e1c('0x6')+_0x4e9c87,_0x1d4f6c);OpenchannelQueueEvents['on'](_0x4e9c87,_0x283e42);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index 06658b6..e3e936b 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 _0x34a3=['get','isAuthenticated','index','/describe','describe','post','create','put','/:id','update','delete','exports','multer','util','path','express','Router','fs-extra','./openchannelQueueReport.controller'];(function(_0x291fff,_0xdc5e25){var _0x30e35c=function(_0x51565c){while(--_0x51565c){_0x291fff['push'](_0x291fff['shift']());}};_0x30e35c(++_0xdc5e25);}(_0x34a3,0x1ae));var _0x334a=function(_0x5e58b2,_0x1b7ed4){_0x5e58b2=_0x5e58b2-0x0;var _0x4facd0=_0x34a3[_0x5e58b2];return _0x4facd0;};'use strict';var multer=require(_0x334a('0x0'));var util=require(_0x334a('0x1'));var path=require(_0x334a('0x2'));var timeout=require('connect-timeout');var express=require(_0x334a('0x3'));var router=express[_0x334a('0x4')]();var fs_extra=require(_0x334a('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x334a('0x6'));router[_0x334a('0x7')]('/',auth[_0x334a('0x8')](),controller[_0x334a('0x9')]);router[_0x334a('0x7')](_0x334a('0xa'),auth[_0x334a('0x8')](),controller[_0x334a('0xb')]);router[_0x334a('0x7')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x334a('0xc')]('/',auth[_0x334a('0x8')](),controller[_0x334a('0xd')]);router[_0x334a('0xe')](_0x334a('0xf'),auth[_0x334a('0x8')](),controller[_0x334a('0x10')]);router[_0x334a('0x11')](_0x334a('0xf'),auth[_0x334a('0x8')](),controller['destroy']);module[_0x334a('0x12')]=router; \ No newline at end of file +var _0xee16=['multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueueReport.controller','get','isAuthenticated','/describe','describe','/:id','post','create','put','delete','destroy','exports'];(function(_0x130a28,_0x315418){var _0x2dc93b=function(_0x29295c){while(--_0x29295c){_0x130a28['push'](_0x130a28['shift']());}};_0x2dc93b(++_0x315418);}(_0xee16,0x1e0));var _0x6ee1=function(_0x22868f,_0x450f48){_0x22868f=_0x22868f-0x0;var _0x97bc75=_0xee16[_0x22868f];return _0x97bc75;};'use strict';var multer=require(_0x6ee1('0x0'));var util=require(_0x6ee1('0x1'));var path=require(_0x6ee1('0x2'));var timeout=require('connect-timeout');var express=require(_0x6ee1('0x3'));var router=express[_0x6ee1('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x6ee1('0x5'));var interaction=require(_0x6ee1('0x6'));var config=require(_0x6ee1('0x7'));var controller=require(_0x6ee1('0x8'));router[_0x6ee1('0x9')]('/',auth[_0x6ee1('0xa')](),controller['index']);router[_0x6ee1('0x9')](_0x6ee1('0xb'),auth[_0x6ee1('0xa')](),controller[_0x6ee1('0xc')]);router[_0x6ee1('0x9')](_0x6ee1('0xd'),auth['isAuthenticated'](),controller['show']);router[_0x6ee1('0xe')]('/',auth[_0x6ee1('0xa')](),controller[_0x6ee1('0xf')]);router[_0x6ee1('0x10')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x6ee1('0x11')]('/:id',auth[_0x6ee1('0xa')](),controller[_0x6ee1('0x12')]);module[_0x6ee1('0x13')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js b/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js index d4713b9..6a04092 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 _0xe3e3=['exports','STRING','DATE'];(function(_0x315db5,_0x5ae123){var _0x294278=function(_0x4008a3){while(--_0x4008a3){_0x315db5['push'](_0x315db5['shift']());}};_0x294278(++_0x5ae123);}(_0xe3e3,0x9c));var _0x3e3e=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0xe3e3[_0x618414];return _0x21c19a;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x3e3e('0x0')]={'uniqueid':{'type':Sequelize[_0x3e3e('0x1')],'allowNull':![]},'from':{'type':Sequelize[_0x3e3e('0x1')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x3e3e('0x2')]},'acceptAt':{'type':Sequelize[_0x3e3e('0x2')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x49fe=['STRING','moment','sequelize','exports','DATE'];(function(_0x3137f0,_0x509d52){var _0x4c12c4=function(_0x4b9be3){while(--_0x4b9be3){_0x3137f0['push'](_0x3137f0['shift']());}};_0x4c12c4(++_0x509d52);}(_0x49fe,0x100));var _0xe49f=function(_0x3607ed,_0x4d75fc){_0x3607ed=_0x3607ed-0x0;var _0x339085=_0x49fe[_0x3607ed];return _0x339085;};'use strict';var moment=require(_0xe49f('0x0'));var Sequelize=require(_0xe49f('0x1'));module[_0xe49f('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xe49f('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0xe49f('0x3')]},'exitAt':{'type':Sequelize[_0xe49f('0x3')]},'reason':{'type':Sequelize[_0xe49f('0x4')]}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index 795671b..bce58bb 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 _0x54fa=['send','map','OpenchannelQueueReport','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','keys','find','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','error','stack','name'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0x54fa,0x1a2));var _0xa54f=function(_0x2e7087,_0x112eec){_0x2e7087=_0x2e7087-0x0;var _0xb5b3a6=_0x54fa[_0x2e7087];return _0xb5b3a6;};'use strict';var emlformat=require(_0xa54f('0x0'));var rimraf=require(_0xa54f('0x1'));var zipdir=require(_0xa54f('0x2'));var jsonpatch=require(_0xa54f('0x3'));var rp=require('request-promise');var moment=require(_0xa54f('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xa54f('0x5'));var util=require(_0xa54f('0x6'));var path=require(_0xa54f('0x7'));var sox=require('sox');var csv=require(_0xa54f('0x8'));var ejs=require(_0xa54f('0x9'));var fs=require('fs');var fs_extra=require(_0xa54f('0xa'));var _=require('lodash');var squel=require(_0xa54f('0xb'));var crypto=require(_0xa54f('0xc'));var jsforce=require(_0xa54f('0xd'));var deskjs=require(_0xa54f('0xe'));var toCsv=require(_0xa54f('0x8'));var querystring=require(_0xa54f('0xf'));var Papa=require(_0xa54f('0x10'));var Redis=require(_0xa54f('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xa54f('0x12'));var as=require(_0xa54f('0x13'));var hardwareService=require(_0xa54f('0x14'));var logger=require('../../config/logger')(_0xa54f('0x15'));var utils=require(_0xa54f('0x16'));var config=require(_0xa54f('0x17'));var licenseUtil=require(_0xa54f('0x18'));var db=require(_0xa54f('0x19'))['db'];function respondWithStatusCode(_0x4aab72,_0x45efc9){_0x45efc9=_0x45efc9||0xcc;return function(_0x342202){if(_0x342202){return _0x4aab72[_0xa54f('0x1a')](_0x45efc9);}return _0x4aab72['status'](_0x45efc9)[_0xa54f('0x1b')]();};}function respondWithResult(_0xa009f5,_0xe45998){_0xe45998=_0xe45998||0xc8;return function(_0x45ef67){if(_0x45ef67){return _0xa009f5[_0xa54f('0x1c')](_0xe45998)[_0xa54f('0x1d')](_0x45ef67);}};}function respondWithFilteredResult(_0xede73a,_0x3f8ce5){return function(_0x22b6f8){if(_0x22b6f8){var _0x44bee3=typeof _0x3f8ce5[_0xa54f('0x1e')]===_0xa54f('0x1f')&&typeof _0x3f8ce5[_0xa54f('0x20')]==='undefined';var _0x14be4e=_0x22b6f8[_0xa54f('0x21')];var _0x20bc78=_0x44bee3?0x0:_0x3f8ce5[_0xa54f('0x1e')];var _0x2dad05=_0x44bee3?_0x22b6f8[_0xa54f('0x21')]:_0x3f8ce5['offset']+_0x3f8ce5[_0xa54f('0x20')];var _0x5b2d75;if(_0x2dad05>=_0x14be4e){_0x2dad05=_0x14be4e;_0x5b2d75=0xc8;}else{_0x5b2d75=0xce;}_0xede73a[_0xa54f('0x1c')](_0x5b2d75);return _0xede73a['set'](_0xa54f('0x22'),_0x20bc78+'-'+_0x2dad05+'/'+_0x14be4e)['json'](_0x22b6f8);}return null;};}function patchUpdates(_0x20a74c){return function(_0xdacc2d){try{jsonpatch[_0xa54f('0x23')](_0xdacc2d,_0x20a74c,!![]);}catch(_0xc709aa){return BPromise[_0xa54f('0x24')](_0xc709aa);}return _0xdacc2d[_0xa54f('0x25')]();};}function saveUpdates(_0x578b3f,_0x48729a){return function(_0xb5017){if(_0xb5017){return _0xb5017[_0xa54f('0x26')](_0x578b3f)[_0xa54f('0x27')](function(_0x321f66){return _0x321f66;});}return null;};}function removeEntity(_0x5e4f7d,_0x4b18a5){return function(_0x3a9b01){if(_0x3a9b01){return _0x3a9b01[_0xa54f('0x28')]()[_0xa54f('0x27')](function(){_0x5e4f7d[_0xa54f('0x1c')](0xcc)[_0xa54f('0x1b')]();});}};}function handleEntityNotFound(_0x2562f1,_0x3f2b2d){return function(_0x1fb2d6){if(!_0x1fb2d6){_0x2562f1['sendStatus'](0x194);}return _0x1fb2d6;};}function handleError(_0x3f497c,_0xce9b5c){_0xce9b5c=_0xce9b5c||0x1f4;return function(_0x437ff8){logger[_0xa54f('0x29')](_0x437ff8[_0xa54f('0x2a')]);if(_0x437ff8[_0xa54f('0x2b')]){delete _0x437ff8[_0xa54f('0x2b')];}_0x3f497c[_0xa54f('0x1c')](_0xce9b5c)[_0xa54f('0x2c')](_0x437ff8);};}exports['index']=function(_0xdf5fdc,_0x2d74d8){var _0x41bf9a={},_0x3aea58={},_0xae552a={'count':0x0,'rows':[]};var _0x3374df=_[_0xa54f('0x2d')](db[_0xa54f('0x2e')]['rawAttributes'],function(_0x3bb638){return{'name':_0x3bb638[_0xa54f('0x2f')],'type':_0x3bb638['type'][_0xa54f('0x30')]};});_0x3aea58[_0xa54f('0x31')]=_[_0xa54f('0x2d')](_0x3374df,_0xa54f('0x2b'));_0x3aea58[_0xa54f('0x32')]=_['keys'](_0xdf5fdc[_0xa54f('0x32')]);_0x3aea58[_0xa54f('0x33')]=_[_0xa54f('0x34')](_0x3aea58[_0xa54f('0x31')],_0x3aea58[_0xa54f('0x32')]);_0x41bf9a[_0xa54f('0x35')]=_[_0xa54f('0x34')](_0x3aea58['model'],qs[_0xa54f('0x36')](_0xdf5fdc[_0xa54f('0x32')]['fields']));_0x41bf9a[_0xa54f('0x35')]=_0x41bf9a['attributes'][_0xa54f('0x37')]?_0x41bf9a[_0xa54f('0x35')]:_0x3aea58[_0xa54f('0x31')];if(!_0xdf5fdc['query'][_0xa54f('0x38')]('nolimit')){_0x41bf9a[_0xa54f('0x20')]=qs['limit'](_0xdf5fdc[_0xa54f('0x32')][_0xa54f('0x20')]);_0x41bf9a[_0xa54f('0x1e')]=qs[_0xa54f('0x1e')](_0xdf5fdc['query'][_0xa54f('0x1e')]);}_0x41bf9a[_0xa54f('0x39')]=qs[_0xa54f('0x3a')](_0xdf5fdc[_0xa54f('0x32')]['sort']);_0x41bf9a[_0xa54f('0x3b')]=qs[_0xa54f('0x33')](_[_0xa54f('0x3c')](_0xdf5fdc[_0xa54f('0x32')],_0x3aea58['filters']),_0x3374df);if(_0xdf5fdc[_0xa54f('0x32')][_0xa54f('0x3d')]){_0x41bf9a['where']=_[_0xa54f('0x3e')](_0x41bf9a[_0xa54f('0x3b')],{'$or':_[_0xa54f('0x2d')](_0x3374df,function(_0x986fa8){if(_0x986fa8['type']!==_0xa54f('0x3f')){var _0x2a5246={};_0x2a5246[_0x986fa8['name']]={'$like':'%'+_0xdf5fdc[_0xa54f('0x32')][_0xa54f('0x3d')]+'%'};return _0x2a5246;}})});}_0x41bf9a=_[_0xa54f('0x3e')]({},_0x41bf9a,_0xdf5fdc[_0xa54f('0x40')]);var _0x1569aa={'where':_0x41bf9a[_0xa54f('0x3b')]};return db[_0xa54f('0x2e')][_0xa54f('0x21')](_0x1569aa)['then'](function(_0x299050){_0xae552a['count']=_0x299050;if(_0xdf5fdc[_0xa54f('0x32')][_0xa54f('0x41')]){_0x41bf9a[_0xa54f('0x42')]=[{'all':!![]}];}return db['OpenchannelQueueReport'][_0xa54f('0x43')](_0x41bf9a);})[_0xa54f('0x27')](function(_0x2e0b2e){_0xae552a[_0xa54f('0x44')]=_0x2e0b2e;return _0xae552a;})[_0xa54f('0x27')](respondWithFilteredResult(_0x2d74d8,_0x41bf9a))[_0xa54f('0x45')](handleError(_0x2d74d8,null));};exports[_0xa54f('0x46')]=function(_0x529450,_0xc5fcbc){var _0x3cc5d5={'raw':!![],'where':{'id':_0x529450['params']['id']}},_0x56b0d0={};_0x56b0d0[_0xa54f('0x31')]=_[_0xa54f('0x47')](db[_0xa54f('0x2e')]['rawAttributes']);_0x56b0d0[_0xa54f('0x32')]=_[_0xa54f('0x47')](_0x529450['query']);_0x56b0d0['filters']=_[_0xa54f('0x34')](_0x56b0d0[_0xa54f('0x31')],_0x56b0d0[_0xa54f('0x32')]);_0x3cc5d5['attributes']=_['intersection'](_0x56b0d0[_0xa54f('0x31')],qs['fields'](_0x529450['query']['fields']));_0x3cc5d5[_0xa54f('0x35')]=_0x3cc5d5[_0xa54f('0x35')][_0xa54f('0x37')]?_0x3cc5d5[_0xa54f('0x35')]:_0x56b0d0[_0xa54f('0x31')];if(_0x529450[_0xa54f('0x32')][_0xa54f('0x41')]){_0x3cc5d5[_0xa54f('0x42')]=[{'all':!![]}];}_0x3cc5d5=_[_0xa54f('0x3e')]({},_0x3cc5d5,_0x529450[_0xa54f('0x40')]);return db['OpenchannelQueueReport'][_0xa54f('0x48')](_0x3cc5d5)[_0xa54f('0x27')](handleEntityNotFound(_0xc5fcbc,null))[_0xa54f('0x27')](respondWithResult(_0xc5fcbc,null))['catch'](handleError(_0xc5fcbc,null));};exports[_0xa54f('0x49')]=function(_0x3604e6,_0x46a4f6){return db[_0xa54f('0x2e')][_0xa54f('0x49')](_0x3604e6[_0xa54f('0x4a')],{})[_0xa54f('0x27')](respondWithResult(_0x46a4f6,0xc9))[_0xa54f('0x45')](handleError(_0x46a4f6,null));};exports[_0xa54f('0x26')]=function(_0x5aed94,_0x33d191){if(_0x5aed94[_0xa54f('0x4a')]['id']){delete _0x5aed94[_0xa54f('0x4a')]['id'];}return db[_0xa54f('0x2e')][_0xa54f('0x48')]({'where':{'id':_0x5aed94['params']['id']}})[_0xa54f('0x27')](handleEntityNotFound(_0x33d191,null))['then'](saveUpdates(_0x5aed94[_0xa54f('0x4a')],null))[_0xa54f('0x27')](respondWithResult(_0x33d191,null))['catch'](handleError(_0x33d191,null));};exports[_0xa54f('0x28')]=function(_0x5f5293,_0x11be6b){return db[_0xa54f('0x2e')]['find']({'where':{'id':_0x5f5293[_0xa54f('0x4b')]['id']}})['then'](handleEntityNotFound(_0x11be6b,null))['then'](removeEntity(_0x11be6b,null))[_0xa54f('0x45')](handleError(_0x11be6b,null));};exports['describe']=function(_0x3a1ab4,_0x5dee6b){return db['OpenchannelQueueReport'][_0xa54f('0x4c')]()[_0xa54f('0x27')](respondWithResult(_0x5dee6b,null))['catch'](handleError(_0x5dee6b,null));}; \ No newline at end of file +var _0xc6f8=['attributes','fields','length','nolimit','sort','where','pick','filter','merge','map','options','includeAll','include','rows','params','keys','filters','find','create','catch','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','limit','count','offset','Content-Range','apply','reject','update','destroy','then','sendStatus','error','stack','name','send','index','OpenchannelQueueReport','rawAttributes','fieldName','key','model','query','intersection'];(function(_0x1b95e1,_0x43f2d4){var _0x572e1f=function(_0x363009){while(--_0x363009){_0x1b95e1['push'](_0x1b95e1['shift']());}};_0x572e1f(++_0x43f2d4);}(_0xc6f8,0xf4));var _0x8c6f=function(_0x53fb8c,_0x1ed0df){_0x53fb8c=_0x53fb8c-0x0;var _0x3d899f=_0xc6f8[_0x53fb8c];return _0x3d899f;};'use strict';var emlformat=require(_0x8c6f('0x0'));var rimraf=require(_0x8c6f('0x1'));var zipdir=require(_0x8c6f('0x2'));var jsonpatch=require(_0x8c6f('0x3'));var rp=require('request-promise');var moment=require(_0x8c6f('0x4'));var BPromise=require(_0x8c6f('0x5'));var Mustache=require(_0x8c6f('0x6'));var util=require(_0x8c6f('0x7'));var path=require(_0x8c6f('0x8'));var sox=require(_0x8c6f('0x9'));var csv=require(_0x8c6f('0xa'));var ejs=require(_0x8c6f('0xb'));var fs=require('fs');var fs_extra=require(_0x8c6f('0xc'));var _=require(_0x8c6f('0xd'));var squel=require(_0x8c6f('0xe'));var crypto=require('crypto');var jsforce=require(_0x8c6f('0xf'));var deskjs=require(_0x8c6f('0x10'));var toCsv=require(_0x8c6f('0xa'));var querystring=require(_0x8c6f('0x11'));var Papa=require(_0x8c6f('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x8c6f('0x13'));var as=require(_0x8c6f('0x14'));var hardwareService=require(_0x8c6f('0x15'));var logger=require(_0x8c6f('0x16'))(_0x8c6f('0x17'));var utils=require('../../config/utils');var config=require(_0x8c6f('0x18'));var licenseUtil=require(_0x8c6f('0x19'));var db=require(_0x8c6f('0x1a'))['db'];function respondWithStatusCode(_0x2c5f4a,_0x25773a){_0x25773a=_0x25773a||0xcc;return function(_0x2c9199){if(_0x2c9199){return _0x2c5f4a['sendStatus'](_0x25773a);}return _0x2c5f4a[_0x8c6f('0x1b')](_0x25773a)[_0x8c6f('0x1c')]();};}function respondWithResult(_0x67c414,_0x441f23){_0x441f23=_0x441f23||0xc8;return function(_0x1c39b4){if(_0x1c39b4){return _0x67c414[_0x8c6f('0x1b')](_0x441f23)[_0x8c6f('0x1d')](_0x1c39b4);}};}function respondWithFilteredResult(_0x349466,_0x2aa6ba){return function(_0x1e7016){if(_0x1e7016){var _0x873c85=typeof _0x2aa6ba['offset']==='undefined'&&typeof _0x2aa6ba[_0x8c6f('0x1e')]==='undefined';var _0x2c342c=_0x1e7016[_0x8c6f('0x1f')];var _0x23baff=_0x873c85?0x0:_0x2aa6ba[_0x8c6f('0x20')];var _0x1b0c8e=_0x873c85?_0x1e7016[_0x8c6f('0x1f')]:_0x2aa6ba['offset']+_0x2aa6ba[_0x8c6f('0x1e')];var _0xde77f4;if(_0x1b0c8e>=_0x2c342c){_0x1b0c8e=_0x2c342c;_0xde77f4=0xc8;}else{_0xde77f4=0xce;}_0x349466[_0x8c6f('0x1b')](_0xde77f4);return _0x349466['set'](_0x8c6f('0x21'),_0x23baff+'-'+_0x1b0c8e+'/'+_0x2c342c)[_0x8c6f('0x1d')](_0x1e7016);}return null;};}function patchUpdates(_0x45a2){return function(_0x369fce){try{jsonpatch[_0x8c6f('0x22')](_0x369fce,_0x45a2,!![]);}catch(_0x21941c){return BPromise[_0x8c6f('0x23')](_0x21941c);}return _0x369fce['save']();};}function saveUpdates(_0x2a4a28,_0x21108a){return function(_0x14b1cd){if(_0x14b1cd){return _0x14b1cd[_0x8c6f('0x24')](_0x2a4a28)['then'](function(_0x447731){return _0x447731;});}return null;};}function removeEntity(_0x53f942,_0x21a912){return function(_0x2bf630){if(_0x2bf630){return _0x2bf630[_0x8c6f('0x25')]()[_0x8c6f('0x26')](function(){_0x53f942[_0x8c6f('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2a4245,_0x1ae94e){return function(_0x4001c7){if(!_0x4001c7){_0x2a4245[_0x8c6f('0x27')](0x194);}return _0x4001c7;};}function handleError(_0x49eed2,_0x4ce32e){_0x4ce32e=_0x4ce32e||0x1f4;return function(_0x2a4df6){logger[_0x8c6f('0x28')](_0x2a4df6[_0x8c6f('0x29')]);if(_0x2a4df6[_0x8c6f('0x2a')]){delete _0x2a4df6[_0x8c6f('0x2a')];}_0x49eed2[_0x8c6f('0x1b')](_0x4ce32e)[_0x8c6f('0x2b')](_0x2a4df6);};}exports[_0x8c6f('0x2c')]=function(_0x1907a0,_0x12501e){var _0x2d3103={},_0x5b4ccd={},_0x3122e2={'count':0x0,'rows':[]};var _0x3a9992=_['map'](db[_0x8c6f('0x2d')][_0x8c6f('0x2e')],function(_0x2b5748){return{'name':_0x2b5748[_0x8c6f('0x2f')],'type':_0x2b5748['type'][_0x8c6f('0x30')]};});_0x5b4ccd[_0x8c6f('0x31')]=_['map'](_0x3a9992,'name');_0x5b4ccd[_0x8c6f('0x32')]=_['keys'](_0x1907a0[_0x8c6f('0x32')]);_0x5b4ccd['filters']=_[_0x8c6f('0x33')](_0x5b4ccd[_0x8c6f('0x31')],_0x5b4ccd[_0x8c6f('0x32')]);_0x2d3103[_0x8c6f('0x34')]=_[_0x8c6f('0x33')](_0x5b4ccd[_0x8c6f('0x31')],qs[_0x8c6f('0x35')](_0x1907a0[_0x8c6f('0x32')][_0x8c6f('0x35')]));_0x2d3103['attributes']=_0x2d3103[_0x8c6f('0x34')][_0x8c6f('0x36')]?_0x2d3103[_0x8c6f('0x34')]:_0x5b4ccd[_0x8c6f('0x31')];if(!_0x1907a0[_0x8c6f('0x32')]['hasOwnProperty'](_0x8c6f('0x37'))){_0x2d3103['limit']=qs[_0x8c6f('0x1e')](_0x1907a0[_0x8c6f('0x32')][_0x8c6f('0x1e')]);_0x2d3103[_0x8c6f('0x20')]=qs[_0x8c6f('0x20')](_0x1907a0[_0x8c6f('0x32')][_0x8c6f('0x20')]);}_0x2d3103['order']=qs[_0x8c6f('0x38')](_0x1907a0[_0x8c6f('0x32')]['sort']);_0x2d3103[_0x8c6f('0x39')]=qs['filters'](_[_0x8c6f('0x3a')](_0x1907a0[_0x8c6f('0x32')],_0x5b4ccd['filters']),_0x3a9992);if(_0x1907a0['query'][_0x8c6f('0x3b')]){_0x2d3103[_0x8c6f('0x39')]=_[_0x8c6f('0x3c')](_0x2d3103[_0x8c6f('0x39')],{'$or':_[_0x8c6f('0x3d')](_0x3a9992,function(_0x3c269b){if(_0x3c269b['type']!=='VIRTUAL'){var _0xbbd99d={};_0xbbd99d[_0x3c269b[_0x8c6f('0x2a')]]={'$like':'%'+_0x1907a0['query']['filter']+'%'};return _0xbbd99d;}})});}_0x2d3103=_[_0x8c6f('0x3c')]({},_0x2d3103,_0x1907a0[_0x8c6f('0x3e')]);var _0x12289e={'where':_0x2d3103[_0x8c6f('0x39')]};return db[_0x8c6f('0x2d')][_0x8c6f('0x1f')](_0x12289e)[_0x8c6f('0x26')](function(_0x59f113){_0x3122e2[_0x8c6f('0x1f')]=_0x59f113;if(_0x1907a0[_0x8c6f('0x32')][_0x8c6f('0x3f')]){_0x2d3103[_0x8c6f('0x40')]=[{'all':!![]}];}return db[_0x8c6f('0x2d')]['findAll'](_0x2d3103);})[_0x8c6f('0x26')](function(_0x31d360){_0x3122e2[_0x8c6f('0x41')]=_0x31d360;return _0x3122e2;})['then'](respondWithFilteredResult(_0x12501e,_0x2d3103))['catch'](handleError(_0x12501e,null));};exports['show']=function(_0x322cad,_0x450a2d){var _0x3d69ac={'raw':!![],'where':{'id':_0x322cad[_0x8c6f('0x42')]['id']}},_0x525117={};_0x525117[_0x8c6f('0x31')]=_[_0x8c6f('0x43')](db[_0x8c6f('0x2d')][_0x8c6f('0x2e')]);_0x525117[_0x8c6f('0x32')]=_[_0x8c6f('0x43')](_0x322cad[_0x8c6f('0x32')]);_0x525117[_0x8c6f('0x44')]=_[_0x8c6f('0x33')](_0x525117['model'],_0x525117[_0x8c6f('0x32')]);_0x3d69ac['attributes']=_[_0x8c6f('0x33')](_0x525117[_0x8c6f('0x31')],qs[_0x8c6f('0x35')](_0x322cad[_0x8c6f('0x32')]['fields']));_0x3d69ac[_0x8c6f('0x34')]=_0x3d69ac['attributes'][_0x8c6f('0x36')]?_0x3d69ac[_0x8c6f('0x34')]:_0x525117[_0x8c6f('0x31')];if(_0x322cad[_0x8c6f('0x32')][_0x8c6f('0x3f')]){_0x3d69ac['include']=[{'all':!![]}];}_0x3d69ac=_[_0x8c6f('0x3c')]({},_0x3d69ac,_0x322cad[_0x8c6f('0x3e')]);return db[_0x8c6f('0x2d')][_0x8c6f('0x45')](_0x3d69ac)['then'](handleEntityNotFound(_0x450a2d,null))['then'](respondWithResult(_0x450a2d,null))['catch'](handleError(_0x450a2d,null));};exports['create']=function(_0x2af357,_0x240519){return db[_0x8c6f('0x2d')][_0x8c6f('0x46')](_0x2af357['body'],{})[_0x8c6f('0x26')](respondWithResult(_0x240519,0xc9))[_0x8c6f('0x47')](handleError(_0x240519,null));};exports[_0x8c6f('0x24')]=function(_0x248661,_0x464a55){if(_0x248661[_0x8c6f('0x48')]['id']){delete _0x248661[_0x8c6f('0x48')]['id'];}return db[_0x8c6f('0x2d')]['find']({'where':{'id':_0x248661[_0x8c6f('0x42')]['id']}})[_0x8c6f('0x26')](handleEntityNotFound(_0x464a55,null))['then'](saveUpdates(_0x248661[_0x8c6f('0x48')],null))[_0x8c6f('0x26')](respondWithResult(_0x464a55,null))[_0x8c6f('0x47')](handleError(_0x464a55,null));};exports[_0x8c6f('0x25')]=function(_0x248815,_0x375f7a){return db[_0x8c6f('0x2d')][_0x8c6f('0x45')]({'where':{'id':_0x248815[_0x8c6f('0x42')]['id']}})[_0x8c6f('0x26')](handleEntityNotFound(_0x375f7a,null))['then'](removeEntity(_0x375f7a,null))['catch'](handleError(_0x375f7a,null));};exports[_0x8c6f('0x49')]=function(_0xf412c5,_0x4b9a4c){return db[_0x8c6f('0x2d')]['describe']()[_0x8c6f('0x26')](respondWithResult(_0x4b9a4c,null))[_0x8c6f('0x47')](handleError(_0x4b9a4c,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index 69b4f5b..15b2318 100644 --- a/server/api/openchannelQueueReport/openchannelQueueReport.model.js +++ b/server/api/openchannelQueueReport/openchannelQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5fc3=['util','api','moment','bluebird','request-promise','path','../../config/environment','./openchannelQueueReport.attributes','exports','define','report_openchannel_queue','uniqueid','lodash'];(function(_0x15cbce,_0xda8402){var _0x257f29=function(_0x388132){while(--_0x388132){_0x15cbce['push'](_0x15cbce['shift']());}};_0x257f29(++_0xda8402);}(_0x5fc3,0xa8));var _0x35fc=function(_0xf48cce,_0x3531e4){_0xf48cce=_0xf48cce-0x0;var _0x2a5c38=_0x5fc3[_0xf48cce];return _0x2a5c38;};'use strict';var _=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var logger=require('../../config/logger')(_0x35fc('0x2'));var moment=require(_0x35fc('0x3'));var BPromise=require(_0x35fc('0x4'));var rp=require(_0x35fc('0x5'));var fs=require('fs');var path=require(_0x35fc('0x6'));var rimraf=require('rimraf');var config=require(_0x35fc('0x7'));var attributes=require(_0x35fc('0x8'));module[_0x35fc('0x9')]=function(_0x5b85ad,_0x5754be){return _0x5b85ad[_0x35fc('0xa')]('OpenchannelQueueReport',attributes,{'tableName':_0x35fc('0xb'),'paranoid':![],'indexes':[{'name':_0x35fc('0xc'),'fields':[_0x35fc('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc4aa=['bluebird','../../config/environment','./openchannelQueueReport.attributes','exports','define','OpenchannelQueueReport','report_openchannel_queue','lodash','util','../../config/logger','api','moment'];(function(_0x224570,_0x25b2f0){var _0x51c15e=function(_0x60b5f5){while(--_0x60b5f5){_0x224570['push'](_0x224570['shift']());}};_0x51c15e(++_0x25b2f0);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x3511d3,_0x4107ae){_0x3511d3=_0x3511d3-0x0;var _0x5d6321=_0xc4aa[_0x3511d3];return _0x5d6321;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var logger=require(_0xac4a('0x2'))(_0xac4a('0x3'));var moment=require(_0xac4a('0x4'));var BPromise=require(_0xac4a('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xac4a('0x6'));var attributes=require(_0xac4a('0x7'));module[_0xac4a('0x8')]=function(_0x215f39,_0x96be2b){return _0x215f39[_0xac4a('0x9')](_0xac4a('0xa'),attributes,{'tableName':_0xac4a('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js b/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js index 2c211d9..c843604 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 _0x7916=['../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','then','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','CreateOpenchannelQueueReport','OpenchannelQueueReport','create','body','options','raw','where','attributes','UpdateOpenchannelQueueReport','lodash','moment','bluebird','ioredis'];(function(_0xadc03d,_0x4164f6){var _0x30b870=function(_0x27430e){while(--_0x27430e){_0xadc03d['push'](_0xadc03d['shift']());}};_0x30b870(++_0x4164f6);}(_0x7916,0x128));var _0x6791=function(_0x2f92d1,_0x4e6aa2){_0x2f92d1=_0x2f92d1-0x0;var _0x2b0c0d=_0x7916[_0x2f92d1];return _0x2b0c0d;};'use strict';var _=require(_0x6791('0x0'));var util=require('util');var moment=require(_0x6791('0x1'));var BPromise=require(_0x6791('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6791('0x3'));var db=require(_0x6791('0x4'))['db'];var utils=require(_0x6791('0x5'));var logger=require(_0x6791('0x6'))('rpc');var config=require(_0x6791('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x6791('0x8')][_0x6791('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5ad8c0,_0x8b85ff,_0x5d2118){return new BPromise(function(_0x2b240c,_0x50c563){return client['request'](_0x5ad8c0,_0x5d2118)[_0x6791('0xa')](function(_0x198a64){logger['info'](_0x6791('0xb'),_0x8b85ff,_0x6791('0xc'));logger[_0x6791('0xd')]('OpenchannelQueueReport,\x20%s,\x20%s,\x20%s',_0x8b85ff,_0x6791('0xc'),JSON[_0x6791('0xe')](_0x198a64));if(_0x198a64[_0x6791('0xf')]){if(_0x198a64[_0x6791('0xf')][_0x6791('0x10')]===0x1f4){logger[_0x6791('0xf')](_0x6791('0xb'),_0x8b85ff,_0x198a64[_0x6791('0xf')][_0x6791('0x11')]);return _0x50c563(_0x198a64[_0x6791('0xf')][_0x6791('0x11')]);}logger['error']('OpenchannelQueueReport,\x20%s,\x20%s',_0x8b85ff,_0x198a64[_0x6791('0xf')]['message']);return _0x2b240c(_0x198a64[_0x6791('0xf')]['message']);}else{logger[_0x6791('0x12')](_0x6791('0xb'),_0x8b85ff,'request\x20sent');_0x2b240c(_0x198a64[_0x6791('0x13')]['message']);}})[_0x6791('0x14')](function(_0x150d1f){logger['error'](_0x6791('0xb'),_0x8b85ff,_0x150d1f);_0x50c563(_0x150d1f);});});}exports[_0x6791('0x15')]=function(_0x5bec14){var _0x1872f5=this;return new Promise(function(_0x4d8a79,_0xe55dba){return db[_0x6791('0x16')][_0x6791('0x17')](_0x5bec14[_0x6791('0x18')],{'raw':_0x5bec14[_0x6791('0x19')]?_0x5bec14[_0x6791('0x19')][_0x6791('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x4a2922){logger[_0x6791('0x12')]('CreateOpenchannelQueueReport',_0x5bec14);logger[_0x6791('0xd')](_0x6791('0x15'),_0x5bec14,JSON['stringify'](_0x4a2922));_0x4d8a79(_0x4a2922);})[_0x6791('0x14')](function(_0x309610){logger[_0x6791('0xf')](_0x6791('0x15'),_0x309610['message'],_0x5bec14);_0xe55dba(_0x1872f5[_0x6791('0xf')](0x1f4,_0x309610[_0x6791('0x11')]));});});};exports['UpdateOpenchannelQueueReport']=function(_0x53bb44){var _0x4b23bc=this;return new Promise(function(_0x372dae,_0x502043){return db[_0x6791('0x16')]['update'](_0x53bb44['body'],{'raw':_0x53bb44['options']?_0x53bb44[_0x6791('0x19')][_0x6791('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x53bb44[_0x6791('0x19')]?_0x53bb44['options'][_0x6791('0x1b')]||null:null,'attributes':_0x53bb44[_0x6791('0x19')]?_0x53bb44['options'][_0x6791('0x1c')]||null:null,'limit':_0x53bb44['options']?_0x53bb44[_0x6791('0x19')]['limit']||null:null})['then'](function(_0x270a1d){logger['info'](_0x6791('0x1d'),_0x53bb44);logger[_0x6791('0xd')]('UpdateOpenchannelQueueReport',_0x53bb44,JSON[_0x6791('0xe')](_0x270a1d));_0x372dae(_0x270a1d);})[_0x6791('0x14')](function(_0x234c5e){logger[_0x6791('0xf')]('UpdateOpenchannelQueueReport',_0x234c5e['message'],_0x53bb44);_0x502043(_0x4b23bc[_0x6791('0xf')](0x1f4,_0x234c5e['message']));});});}; \ No newline at end of file +var _0x01d3=['attributes','limit','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','OpenchannelQueueReport,\x20%s,\x20%s','message','catch','CreateOpenchannelQueueReport','create','body','options','UpdateOpenchannelQueueReport','OpenchannelQueueReport','update','where'];(function(_0x16ae15,_0x7dec88){var _0x18fd6f=function(_0x24a0bc){while(--_0x24a0bc){_0x16ae15['push'](_0x16ae15['shift']());}};_0x18fd6f(++_0x7dec88);}(_0x01d3,0xa2));var _0x301d=function(_0xd6667d,_0x406fd3){_0xd6667d=_0xd6667d-0x0;var _0x247e8f=_0x01d3[_0xd6667d];return _0x247e8f;};'use strict';var _=require(_0x301d('0x0'));var util=require(_0x301d('0x1'));var moment=require(_0x301d('0x2'));var BPromise=require(_0x301d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x301d('0x4'));var db=require(_0x301d('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x301d('0x6'))(_0x301d('0x7'));var config=require(_0x301d('0x8'));var jayson=require(_0x301d('0x9'));var client=jayson['client'][_0x301d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2d8fc2,_0xe2b2d8,_0x3bbbde){return new BPromise(function(_0x35e760,_0x3ba019){return client[_0x301d('0xb')](_0x2d8fc2,_0x3bbbde)[_0x301d('0xc')](function(_0x35ae14){logger[_0x301d('0xd')]('OpenchannelQueueReport,\x20%s,\x20%s',_0xe2b2d8,_0x301d('0xe'));logger[_0x301d('0xf')](_0x301d('0x10'),_0xe2b2d8,'request\x20sent',JSON[_0x301d('0x11')](_0x35ae14));if(_0x35ae14[_0x301d('0x12')]){if(_0x35ae14['error']['code']===0x1f4){logger['error'](_0x301d('0x13'),_0xe2b2d8,_0x35ae14[_0x301d('0x12')][_0x301d('0x14')]);return _0x3ba019(_0x35ae14[_0x301d('0x12')][_0x301d('0x14')]);}logger[_0x301d('0x12')](_0x301d('0x13'),_0xe2b2d8,_0x35ae14['error']['message']);return _0x35e760(_0x35ae14[_0x301d('0x12')][_0x301d('0x14')]);}else{logger[_0x301d('0xd')]('OpenchannelQueueReport,\x20%s,\x20%s',_0xe2b2d8,'request\x20sent');_0x35e760(_0x35ae14['result']['message']);}})[_0x301d('0x15')](function(_0x3deffb){logger[_0x301d('0x12')](_0x301d('0x13'),_0xe2b2d8,_0x3deffb);_0x3ba019(_0x3deffb);});});}exports[_0x301d('0x16')]=function(_0x39e505){var _0x4c36a6=this;return new Promise(function(_0x40a9ed,_0x4ed038){return db['OpenchannelQueueReport'][_0x301d('0x17')](_0x39e505[_0x301d('0x18')],{'raw':_0x39e505['options']?_0x39e505[_0x301d('0x19')]['raw']===undefined?!![]:![]:!![]})[_0x301d('0xc')](function(_0x3f300c){logger[_0x301d('0xd')]('CreateOpenchannelQueueReport',_0x39e505);logger[_0x301d('0xf')]('CreateOpenchannelQueueReport',_0x39e505,JSON[_0x301d('0x11')](_0x3f300c));_0x40a9ed(_0x3f300c);})[_0x301d('0x15')](function(_0x24b6fc){logger['error'](_0x301d('0x16'),_0x24b6fc[_0x301d('0x14')],_0x39e505);_0x4ed038(_0x4c36a6[_0x301d('0x12')](0x1f4,_0x24b6fc[_0x301d('0x14')]));});});};exports[_0x301d('0x1a')]=function(_0x1d8d00){var _0x36f26a=this;return new Promise(function(_0x52e758,_0x2f3b71){return db[_0x301d('0x1b')][_0x301d('0x1c')](_0x1d8d00['body'],{'raw':_0x1d8d00[_0x301d('0x19')]?_0x1d8d00[_0x301d('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1d8d00[_0x301d('0x19')]?_0x1d8d00['options'][_0x301d('0x1d')]||null:null,'attributes':_0x1d8d00[_0x301d('0x19')]?_0x1d8d00['options'][_0x301d('0x1e')]||null:null,'limit':_0x1d8d00['options']?_0x1d8d00['options'][_0x301d('0x1f')]||null:null})[_0x301d('0xc')](function(_0x2a6652){logger['info'](_0x301d('0x1a'),_0x1d8d00);logger['debug']('UpdateOpenchannelQueueReport',_0x1d8d00,JSON['stringify'](_0x2a6652));_0x52e758(_0x2a6652);})[_0x301d('0x15')](function(_0x54e9a1){logger[_0x301d('0x12')](_0x301d('0x1a'),_0x54e9a1[_0x301d('0x14')],_0x1d8d00);_0x2f3b71(_0x36f26a[_0x301d('0x12')](0x1f4,_0x54e9a1[_0x301d('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index b5c6d83..e5d893d 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 _0x429e=['destroy','exports','multer','util','path','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','./openchannelTransferReport.controller','index','get','/describe','isAuthenticated','describe','/:id','show','post','create','update'];(function(_0x36210e,_0x9a09b7){var _0xc07bc7=function(_0x1377f6){while(--_0x1377f6){_0x36210e['push'](_0x36210e['shift']());}};_0xc07bc7(++_0x9a09b7);}(_0x429e,0x17e));var _0xe429=function(_0x43d605,_0x51a25d){_0x43d605=_0x43d605-0x0;var _0xce65e0=_0x429e[_0x43d605];return _0xce65e0;};'use strict';var multer=require(_0xe429('0x0'));var util=require(_0xe429('0x1'));var path=require(_0xe429('0x2'));var timeout=require(_0xe429('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xe429('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xe429('0x5'));var config=require(_0xe429('0x6'));var controller=require(_0xe429('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0xe429('0x8')]);router[_0xe429('0x9')](_0xe429('0xa'),auth[_0xe429('0xb')](),controller[_0xe429('0xc')]);router[_0xe429('0x9')](_0xe429('0xd'),auth[_0xe429('0xb')](),controller[_0xe429('0xe')]);router[_0xe429('0xf')]('/',auth[_0xe429('0xb')](),controller[_0xe429('0x10')]);router['put'](_0xe429('0xd'),auth[_0xe429('0xb')](),controller[_0xe429('0x11')]);router['delete'](_0xe429('0xd'),auth[_0xe429('0xb')](),controller[_0xe429('0x12')]);module[_0xe429('0x13')]=router; \ No newline at end of file +var _0x7369=['show','create','put','delete','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelTransferReport.controller','get','/describe','describe','/:id','isAuthenticated'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x7369,0x112));var _0x9736=function(_0x4dbaad,_0x730318){_0x4dbaad=_0x4dbaad-0x0;var _0x226c72=_0x7369[_0x4dbaad];return _0x226c72;};'use strict';var multer=require('multer');var util=require(_0x9736('0x0'));var path=require(_0x9736('0x1'));var timeout=require(_0x9736('0x2'));var express=require('express');var router=express[_0x9736('0x3')]();var fs_extra=require(_0x9736('0x4'));var auth=require(_0x9736('0x5'));var interaction=require(_0x9736('0x6'));var config=require(_0x9736('0x7'));var controller=require(_0x9736('0x8'));router[_0x9736('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x9736('0x9')](_0x9736('0xa'),auth['isAuthenticated'](),controller[_0x9736('0xb')]);router[_0x9736('0x9')](_0x9736('0xc'),auth[_0x9736('0xd')](),controller[_0x9736('0xe')]);router['post']('/',auth[_0x9736('0xd')](),controller[_0x9736('0xf')]);router[_0x9736('0x10')]('/:id',auth[_0x9736('0xd')](),controller['update']);router[_0x9736('0x11')](_0x9736('0xc'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js b/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js index 9c3e922..21c3f10 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 _0x9c44=['ENUM','account','agent','queue','NOW','exports','STRING'];(function(_0x54f7c0,_0x27af83){var _0x245d03=function(_0x1ad6c4){while(--_0x1ad6c4){_0x54f7c0['push'](_0x54f7c0['shift']());}};_0x245d03(++_0x27af83);}(_0x9c44,0x178));var _0x49c4=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x9c44[_0x2641f9];return _0x585741;};'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 _0x70e0=['NOW','moment','sequelize','exports','account','agent','queue'];(function(_0x27d94f,_0x1739db){var _0x1e722b=function(_0x3046ca){while(--_0x3046ca){_0x27d94f['push'](_0x27d94f['shift']());}};_0x1e722b(++_0x1739db);}(_0x70e0,0x17b));var _0x070e=function(_0x747f88,_0x1b4d62){_0x747f88=_0x747f88-0x0;var _0x5d8539=_0x70e0[_0x747f88];return _0x5d8539;};'use strict';var moment=require(_0x070e('0x0'));var Sequelize=require(_0x070e('0x1'));module[_0x070e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x070e('0x3'),_0x070e('0x4'),_0x070e('0x5')),'allowNull':![],'defaultValue':_0x070e('0x5')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x070e('0x6')]}}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index c63a3a6..c34be0b 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 _0x1989=['querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','sendStatus','status','end','limit','undefined','count','offset','set','Content-Range','json','save','then','destroy','error','stack','name','send','index','map','OpenchannelTransferReport','fieldName','type','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','sort','where','pick','filters','filter','VIRTUAL','merge','options','include','rows','show','params','rawAttributes','find','create','body','catch','update','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js'];(function(_0x493364,_0x1b5060){var _0x5bbd22=function(_0x28a25c){while(--_0x28a25c){_0x493364['push'](_0x493364['shift']());}};_0x5bbd22(++_0x1b5060);}(_0x1989,0x119));var _0x9198=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1989[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x9198('0x0'));var rimraf=require(_0x9198('0x1'));var zipdir=require(_0x9198('0x2'));var jsonpatch=require(_0x9198('0x3'));var rp=require(_0x9198('0x4'));var moment=require(_0x9198('0x5'));var BPromise=require(_0x9198('0x6'));var Mustache=require('mustache');var util=require(_0x9198('0x7'));var path=require('path');var sox=require(_0x9198('0x8'));var csv=require(_0x9198('0x9'));var ejs=require(_0x9198('0xa'));var fs=require('fs');var fs_extra=require(_0x9198('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x9198('0xc'));var jsforce=require(_0x9198('0xd'));var deskjs=require(_0x9198('0xe'));var toCsv=require(_0x9198('0x9'));var querystring=require(_0x9198('0xf'));var Papa=require(_0x9198('0x10'));var Redis=require(_0x9198('0x11'));var authService=require(_0x9198('0x12'));var qs=require(_0x9198('0x13'));var as=require(_0x9198('0x14'));var hardwareService=require(_0x9198('0x15'));var logger=require(_0x9198('0x16'))(_0x9198('0x17'));var utils=require('../../config/utils');var config=require(_0x9198('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x38e2f4,_0x3d1b34){_0x3d1b34=_0x3d1b34||0xcc;return function(_0x2f131f){if(_0x2f131f){return _0x38e2f4[_0x9198('0x19')](_0x3d1b34);}return _0x38e2f4[_0x9198('0x1a')](_0x3d1b34)[_0x9198('0x1b')]();};}function respondWithResult(_0x4e43b9,_0xd22e2a){_0xd22e2a=_0xd22e2a||0xc8;return function(_0x18da1f){if(_0x18da1f){return _0x4e43b9[_0x9198('0x1a')](_0xd22e2a)['json'](_0x18da1f);}};}function respondWithFilteredResult(_0x3454c9,_0x5dbd76){return function(_0x297152){if(_0x297152){var _0x1a3f52=typeof _0x5dbd76['offset']==='undefined'&&typeof _0x5dbd76[_0x9198('0x1c')]===_0x9198('0x1d');var _0x190942=_0x297152[_0x9198('0x1e')];var _0x1461b1=_0x1a3f52?0x0:_0x5dbd76[_0x9198('0x1f')];var _0x46baf8=_0x1a3f52?_0x297152[_0x9198('0x1e')]:_0x5dbd76[_0x9198('0x1f')]+_0x5dbd76[_0x9198('0x1c')];var _0x1bacc1;if(_0x46baf8>=_0x190942){_0x46baf8=_0x190942;_0x1bacc1=0xc8;}else{_0x1bacc1=0xce;}_0x3454c9[_0x9198('0x1a')](_0x1bacc1);return _0x3454c9[_0x9198('0x20')](_0x9198('0x21'),_0x1461b1+'-'+_0x46baf8+'/'+_0x190942)[_0x9198('0x22')](_0x297152);}return null;};}function patchUpdates(_0x4ef7b1){return function(_0x24efd1){try{jsonpatch['apply'](_0x24efd1,_0x4ef7b1,!![]);}catch(_0x51c19a){return BPromise['reject'](_0x51c19a);}return _0x24efd1[_0x9198('0x23')]();};}function saveUpdates(_0x319e55,_0x25f7c2){return function(_0x16d699){if(_0x16d699){return _0x16d699['update'](_0x319e55)[_0x9198('0x24')](function(_0xb66360){return _0xb66360;});}return null;};}function removeEntity(_0xb8e2a5,_0x215e9f){return function(_0x4b90bf){if(_0x4b90bf){return _0x4b90bf[_0x9198('0x25')]()[_0x9198('0x24')](function(){_0xb8e2a5['status'](0xcc)[_0x9198('0x1b')]();});}};}function handleEntityNotFound(_0x380f46,_0x3cb289){return function(_0x24b5f4){if(!_0x24b5f4){_0x380f46[_0x9198('0x19')](0x194);}return _0x24b5f4;};}function handleError(_0x592973,_0x4a3109){_0x4a3109=_0x4a3109||0x1f4;return function(_0x59629c){logger[_0x9198('0x26')](_0x59629c[_0x9198('0x27')]);if(_0x59629c[_0x9198('0x28')]){delete _0x59629c[_0x9198('0x28')];}_0x592973[_0x9198('0x1a')](_0x4a3109)[_0x9198('0x29')](_0x59629c);};}exports[_0x9198('0x2a')]=function(_0x412252,_0x4c601e){var _0x3b8656={},_0x59aeab={},_0x5d8b4f={'count':0x0,'rows':[]};var _0x123b22=_[_0x9198('0x2b')](db[_0x9198('0x2c')]['rawAttributes'],function(_0x504405){return{'name':_0x504405[_0x9198('0x2d')],'type':_0x504405[_0x9198('0x2e')][_0x9198('0x2f')]};});_0x59aeab[_0x9198('0x30')]=_['map'](_0x123b22,_0x9198('0x28'));_0x59aeab[_0x9198('0x31')]=_[_0x9198('0x32')](_0x412252[_0x9198('0x31')]);_0x59aeab['filters']=_['intersection'](_0x59aeab[_0x9198('0x30')],_0x59aeab[_0x9198('0x31')]);_0x3b8656[_0x9198('0x33')]=_[_0x9198('0x34')](_0x59aeab['model'],qs['fields'](_0x412252[_0x9198('0x31')][_0x9198('0x35')]));_0x3b8656['attributes']=_0x3b8656[_0x9198('0x33')][_0x9198('0x36')]?_0x3b8656[_0x9198('0x33')]:_0x59aeab['model'];if(!_0x412252[_0x9198('0x31')][_0x9198('0x37')]('nolimit')){_0x3b8656[_0x9198('0x1c')]=qs[_0x9198('0x1c')](_0x412252[_0x9198('0x31')]['limit']);_0x3b8656[_0x9198('0x1f')]=qs[_0x9198('0x1f')](_0x412252['query'][_0x9198('0x1f')]);}_0x3b8656['order']=qs[_0x9198('0x38')](_0x412252[_0x9198('0x31')]['sort']);_0x3b8656[_0x9198('0x39')]=qs['filters'](_[_0x9198('0x3a')](_0x412252[_0x9198('0x31')],_0x59aeab[_0x9198('0x3b')]),_0x123b22);if(_0x412252[_0x9198('0x31')][_0x9198('0x3c')]){_0x3b8656[_0x9198('0x39')]=_['merge'](_0x3b8656[_0x9198('0x39')],{'$or':_[_0x9198('0x2b')](_0x123b22,function(_0x5e7048){if(_0x5e7048[_0x9198('0x2e')]!==_0x9198('0x3d')){var _0x5df39b={};_0x5df39b[_0x5e7048[_0x9198('0x28')]]={'$like':'%'+_0x412252[_0x9198('0x31')]['filter']+'%'};return _0x5df39b;}})});}_0x3b8656=_[_0x9198('0x3e')]({},_0x3b8656,_0x412252[_0x9198('0x3f')]);var _0x33a02d={'where':_0x3b8656[_0x9198('0x39')]};return db[_0x9198('0x2c')]['count'](_0x33a02d)[_0x9198('0x24')](function(_0x360bca){_0x5d8b4f[_0x9198('0x1e')]=_0x360bca;if(_0x412252['query']['includeAll']){_0x3b8656[_0x9198('0x40')]=[{'all':!![]}];}return db['OpenchannelTransferReport']['findAll'](_0x3b8656);})['then'](function(_0x3b8aa8){_0x5d8b4f[_0x9198('0x41')]=_0x3b8aa8;return _0x5d8b4f;})['then'](respondWithFilteredResult(_0x4c601e,_0x3b8656))['catch'](handleError(_0x4c601e,null));};exports[_0x9198('0x42')]=function(_0x13f81e,_0x45a6df){var _0x2887cf={'raw':!![],'where':{'id':_0x13f81e[_0x9198('0x43')]['id']}},_0x1d324d={};_0x1d324d['model']=_[_0x9198('0x32')](db[_0x9198('0x2c')][_0x9198('0x44')]);_0x1d324d['query']=_[_0x9198('0x32')](_0x13f81e[_0x9198('0x31')]);_0x1d324d[_0x9198('0x3b')]=_[_0x9198('0x34')](_0x1d324d[_0x9198('0x30')],_0x1d324d[_0x9198('0x31')]);_0x2887cf['attributes']=_[_0x9198('0x34')](_0x1d324d['model'],qs[_0x9198('0x35')](_0x13f81e[_0x9198('0x31')][_0x9198('0x35')]));_0x2887cf[_0x9198('0x33')]=_0x2887cf[_0x9198('0x33')][_0x9198('0x36')]?_0x2887cf[_0x9198('0x33')]:_0x1d324d[_0x9198('0x30')];if(_0x13f81e[_0x9198('0x31')]['includeAll']){_0x2887cf[_0x9198('0x40')]=[{'all':!![]}];}_0x2887cf=_[_0x9198('0x3e')]({},_0x2887cf,_0x13f81e[_0x9198('0x3f')]);return db[_0x9198('0x2c')][_0x9198('0x45')](_0x2887cf)[_0x9198('0x24')](handleEntityNotFound(_0x45a6df,null))[_0x9198('0x24')](respondWithResult(_0x45a6df,null))['catch'](handleError(_0x45a6df,null));};exports[_0x9198('0x46')]=function(_0x4b4e3b,_0xd1562){return db[_0x9198('0x2c')][_0x9198('0x46')](_0x4b4e3b[_0x9198('0x47')],{})['then'](respondWithResult(_0xd1562,0xc9))[_0x9198('0x48')](handleError(_0xd1562,null));};exports[_0x9198('0x49')]=function(_0x4652ed,_0x4bba35){if(_0x4652ed[_0x9198('0x47')]['id']){delete _0x4652ed[_0x9198('0x47')]['id'];}return db[_0x9198('0x2c')]['find']({'where':{'id':_0x4652ed[_0x9198('0x43')]['id']}})[_0x9198('0x24')](handleEntityNotFound(_0x4bba35,null))[_0x9198('0x24')](saveUpdates(_0x4652ed[_0x9198('0x47')],null))[_0x9198('0x24')](respondWithResult(_0x4bba35,null))[_0x9198('0x48')](handleError(_0x4bba35,null));};exports[_0x9198('0x25')]=function(_0x116f5b,_0x5bcd27){return db[_0x9198('0x2c')][_0x9198('0x45')]({'where':{'id':_0x116f5b[_0x9198('0x43')]['id']}})['then'](handleEntityNotFound(_0x5bcd27,null))[_0x9198('0x24')](removeEntity(_0x5bcd27,null))[_0x9198('0x48')](handleError(_0x5bcd27,null));};exports['describe']=function(_0x111072,_0x3b8bb7){return db[_0x9198('0x2c')]['describe']()[_0x9198('0x24')](respondWithResult(_0x3b8bb7,null))[_0x9198('0x48')](handleError(_0x3b8bb7,null));}; \ No newline at end of file +var _0x3bf8=['includeAll','merge','find','create','body','destroy','describe','eml-format','zip-dir','fast-json-patch','moment','mustache','path','sox','to-csv','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','reject','save','update','then','stack','name','send','map','OpenchannelTransferReport','rawAttributes','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','options','include','findAll','catch','show','params'];(function(_0x544e03,_0x5dd541){var _0x17a562=function(_0x3638d3){while(--_0x3638d3){_0x544e03['push'](_0x544e03['shift']());}};_0x17a562(++_0x5dd541);}(_0x3bf8,0x127));var _0x83bf=function(_0x51c3a7,_0x4db319){_0x51c3a7=_0x51c3a7-0x0;var _0x290f32=_0x3bf8[_0x51c3a7];return _0x290f32;};'use strict';var emlformat=require(_0x83bf('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x83bf('0x1'));var jsonpatch=require(_0x83bf('0x2'));var rp=require('request-promise');var moment=require(_0x83bf('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x83bf('0x4'));var util=require('util');var path=require(_0x83bf('0x5'));var sox=require(_0x83bf('0x6'));var csv=require(_0x83bf('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x83bf('0x8'));var squel=require(_0x83bf('0x9'));var crypto=require(_0x83bf('0xa'));var jsforce=require(_0x83bf('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x83bf('0x7'));var querystring=require(_0x83bf('0xc'));var Papa=require(_0x83bf('0xd'));var Redis=require(_0x83bf('0xe'));var authService=require(_0x83bf('0xf'));var qs=require(_0x83bf('0x10'));var as=require(_0x83bf('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x83bf('0x12'))('api');var utils=require(_0x83bf('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x83bf('0x14'));var db=require(_0x83bf('0x15'))['db'];function respondWithStatusCode(_0xfef3cd,_0x438966){_0x438966=_0x438966||0xcc;return function(_0x4f7b8b){if(_0x4f7b8b){return _0xfef3cd[_0x83bf('0x16')](_0x438966);}return _0xfef3cd[_0x83bf('0x17')](_0x438966)[_0x83bf('0x18')]();};}function respondWithResult(_0x18b7ff,_0x5f4b4d){_0x5f4b4d=_0x5f4b4d||0xc8;return function(_0x5c6520){if(_0x5c6520){return _0x18b7ff[_0x83bf('0x17')](_0x5f4b4d)[_0x83bf('0x19')](_0x5c6520);}};}function respondWithFilteredResult(_0x358239,_0x5e700c){return function(_0x1825ea){if(_0x1825ea){var _0x1d14fe=typeof _0x5e700c[_0x83bf('0x1a')]===_0x83bf('0x1b')&&typeof _0x5e700c[_0x83bf('0x1c')]===_0x83bf('0x1b');var _0x593833=_0x1825ea[_0x83bf('0x1d')];var _0x1da7c2=_0x1d14fe?0x0:_0x5e700c['offset'];var _0x107a5d=_0x1d14fe?_0x1825ea[_0x83bf('0x1d')]:_0x5e700c[_0x83bf('0x1a')]+_0x5e700c['limit'];var _0x529a78;if(_0x107a5d>=_0x593833){_0x107a5d=_0x593833;_0x529a78=0xc8;}else{_0x529a78=0xce;}_0x358239[_0x83bf('0x17')](_0x529a78);return _0x358239[_0x83bf('0x1e')]('Content-Range',_0x1da7c2+'-'+_0x107a5d+'/'+_0x593833)[_0x83bf('0x19')](_0x1825ea);}return null;};}function patchUpdates(_0x104e4d){return function(_0x19b970){try{jsonpatch['apply'](_0x19b970,_0x104e4d,!![]);}catch(_0x25e27b){return BPromise[_0x83bf('0x1f')](_0x25e27b);}return _0x19b970[_0x83bf('0x20')]();};}function saveUpdates(_0x2f03ca,_0x449935){return function(_0x23f9cb){if(_0x23f9cb){return _0x23f9cb[_0x83bf('0x21')](_0x2f03ca)[_0x83bf('0x22')](function(_0x6ca67c){return _0x6ca67c;});}return null;};}function removeEntity(_0x36799d,_0x37c995){return function(_0x3b4c83){if(_0x3b4c83){return _0x3b4c83['destroy']()[_0x83bf('0x22')](function(){_0x36799d[_0x83bf('0x17')](0xcc)[_0x83bf('0x18')]();});}};}function handleEntityNotFound(_0x421116,_0x4c0acc){return function(_0xa40b8c){if(!_0xa40b8c){_0x421116[_0x83bf('0x16')](0x194);}return _0xa40b8c;};}function handleError(_0x481613,_0x41374c){_0x41374c=_0x41374c||0x1f4;return function(_0x3dce9a){logger['error'](_0x3dce9a[_0x83bf('0x23')]);if(_0x3dce9a[_0x83bf('0x24')]){delete _0x3dce9a['name'];}_0x481613[_0x83bf('0x17')](_0x41374c)[_0x83bf('0x25')](_0x3dce9a);};}exports['index']=function(_0x5878ac,_0x52ef65){var _0x30b046={},_0x12263f={},_0x30871f={'count':0x0,'rows':[]};var _0x5d0ec7=_[_0x83bf('0x26')](db[_0x83bf('0x27')][_0x83bf('0x28')],function(_0x2adb86){return{'name':_0x2adb86['fieldName'],'type':_0x2adb86[_0x83bf('0x29')][_0x83bf('0x2a')]};});_0x12263f[_0x83bf('0x2b')]=_[_0x83bf('0x26')](_0x5d0ec7,_0x83bf('0x24'));_0x12263f[_0x83bf('0x2c')]=_[_0x83bf('0x2d')](_0x5878ac[_0x83bf('0x2c')]);_0x12263f[_0x83bf('0x2e')]=_['intersection'](_0x12263f['model'],_0x12263f[_0x83bf('0x2c')]);_0x30b046[_0x83bf('0x2f')]=_[_0x83bf('0x30')](_0x12263f['model'],qs[_0x83bf('0x31')](_0x5878ac[_0x83bf('0x2c')]['fields']));_0x30b046[_0x83bf('0x2f')]=_0x30b046['attributes'][_0x83bf('0x32')]?_0x30b046['attributes']:_0x12263f[_0x83bf('0x2b')];if(!_0x5878ac[_0x83bf('0x2c')][_0x83bf('0x33')](_0x83bf('0x34'))){_0x30b046['limit']=qs['limit'](_0x5878ac[_0x83bf('0x2c')]['limit']);_0x30b046['offset']=qs[_0x83bf('0x1a')](_0x5878ac[_0x83bf('0x2c')][_0x83bf('0x1a')]);}_0x30b046[_0x83bf('0x35')]=qs[_0x83bf('0x36')](_0x5878ac[_0x83bf('0x2c')]['sort']);_0x30b046[_0x83bf('0x37')]=qs[_0x83bf('0x2e')](_[_0x83bf('0x38')](_0x5878ac[_0x83bf('0x2c')],_0x12263f['filters']),_0x5d0ec7);if(_0x5878ac['query'][_0x83bf('0x39')]){_0x30b046[_0x83bf('0x37')]=_['merge'](_0x30b046[_0x83bf('0x37')],{'$or':_['map'](_0x5d0ec7,function(_0x1efd48){if(_0x1efd48[_0x83bf('0x29')]!==_0x83bf('0x3a')){var _0x563f87={};_0x563f87[_0x1efd48[_0x83bf('0x24')]]={'$like':'%'+_0x5878ac['query'][_0x83bf('0x39')]+'%'};return _0x563f87;}})});}_0x30b046=_['merge']({},_0x30b046,_0x5878ac[_0x83bf('0x3b')]);var _0x5d22b3={'where':_0x30b046[_0x83bf('0x37')]};return db[_0x83bf('0x27')][_0x83bf('0x1d')](_0x5d22b3)[_0x83bf('0x22')](function(_0x131f9e){_0x30871f[_0x83bf('0x1d')]=_0x131f9e;if(_0x5878ac[_0x83bf('0x2c')]['includeAll']){_0x30b046[_0x83bf('0x3c')]=[{'all':!![]}];}return db['OpenchannelTransferReport'][_0x83bf('0x3d')](_0x30b046);})[_0x83bf('0x22')](function(_0x41ae47){_0x30871f['rows']=_0x41ae47;return _0x30871f;})['then'](respondWithFilteredResult(_0x52ef65,_0x30b046))[_0x83bf('0x3e')](handleError(_0x52ef65,null));};exports[_0x83bf('0x3f')]=function(_0x5a2b70,_0xdf60aa){var _0x1bb5cb={'raw':!![],'where':{'id':_0x5a2b70[_0x83bf('0x40')]['id']}},_0x131126={};_0x131126[_0x83bf('0x2b')]=_['keys'](db[_0x83bf('0x27')][_0x83bf('0x28')]);_0x131126[_0x83bf('0x2c')]=_[_0x83bf('0x2d')](_0x5a2b70[_0x83bf('0x2c')]);_0x131126[_0x83bf('0x2e')]=_[_0x83bf('0x30')](_0x131126[_0x83bf('0x2b')],_0x131126[_0x83bf('0x2c')]);_0x1bb5cb[_0x83bf('0x2f')]=_['intersection'](_0x131126[_0x83bf('0x2b')],qs[_0x83bf('0x31')](_0x5a2b70['query'][_0x83bf('0x31')]));_0x1bb5cb[_0x83bf('0x2f')]=_0x1bb5cb['attributes'][_0x83bf('0x32')]?_0x1bb5cb['attributes']:_0x131126[_0x83bf('0x2b')];if(_0x5a2b70['query'][_0x83bf('0x41')]){_0x1bb5cb['include']=[{'all':!![]}];}_0x1bb5cb=_[_0x83bf('0x42')]({},_0x1bb5cb,_0x5a2b70[_0x83bf('0x3b')]);return db['OpenchannelTransferReport'][_0x83bf('0x43')](_0x1bb5cb)['then'](handleEntityNotFound(_0xdf60aa,null))['then'](respondWithResult(_0xdf60aa,null))[_0x83bf('0x3e')](handleError(_0xdf60aa,null));};exports[_0x83bf('0x44')]=function(_0x322e80,_0x3e735c){return db['OpenchannelTransferReport'][_0x83bf('0x44')](_0x322e80[_0x83bf('0x45')],{})[_0x83bf('0x22')](respondWithResult(_0x3e735c,0xc9))[_0x83bf('0x3e')](handleError(_0x3e735c,null));};exports[_0x83bf('0x21')]=function(_0x41f40e,_0x18bb14){if(_0x41f40e['body']['id']){delete _0x41f40e[_0x83bf('0x45')]['id'];}return db[_0x83bf('0x27')][_0x83bf('0x43')]({'where':{'id':_0x41f40e['params']['id']}})['then'](handleEntityNotFound(_0x18bb14,null))[_0x83bf('0x22')](saveUpdates(_0x41f40e['body'],null))[_0x83bf('0x22')](respondWithResult(_0x18bb14,null))[_0x83bf('0x3e')](handleError(_0x18bb14,null));};exports[_0x83bf('0x46')]=function(_0x574a8f,_0xf901b6){return db[_0x83bf('0x27')][_0x83bf('0x43')]({'where':{'id':_0x574a8f[_0x83bf('0x40')]['id']}})['then'](handleEntityNotFound(_0xf901b6,null))[_0x83bf('0x22')](removeEntity(_0xf901b6,null))[_0x83bf('0x3e')](handleError(_0xf901b6,null));};exports[_0x83bf('0x47')]=function(_0x559bbd,_0x28e15a){return db[_0x83bf('0x27')]['describe']()[_0x83bf('0x22')](respondWithResult(_0x28e15a,null))[_0x83bf('0x3e')](handleError(_0x28e15a,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index bd0be36..b3cac13 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 _0x29cc=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelTransferReport.attributes','exports','define','report_openchannel_transfer','uniqueid','lodash','util','../../config/logger'];(function(_0x411017,_0x4a8117){var _0x2adeea=function(_0x545222){while(--_0x545222){_0x411017['push'](_0x411017['shift']());}};_0x2adeea(++_0x4a8117);}(_0x29cc,0x1ec));var _0xc29c=function(_0x45ad2e,_0x574050){_0x45ad2e=_0x45ad2e-0x0;var _0x5dd087=_0x29cc[_0x45ad2e];return _0x5dd087;};'use strict';var _=require(_0xc29c('0x0'));var util=require(_0xc29c('0x1'));var logger=require(_0xc29c('0x2'))(_0xc29c('0x3'));var moment=require(_0xc29c('0x4'));var BPromise=require(_0xc29c('0x5'));var rp=require(_0xc29c('0x6'));var fs=require('fs');var path=require(_0xc29c('0x7'));var rimraf=require(_0xc29c('0x8'));var config=require(_0xc29c('0x9'));var attributes=require(_0xc29c('0xa'));module[_0xc29c('0xb')]=function(_0x2e2c0a,_0x37a32c){return _0x2e2c0a[_0xc29c('0xc')]('OpenchannelTransferReport',attributes,{'tableName':_0xc29c('0xd'),'paranoid':![],'indexes':[{'name':_0xc29c('0xe'),'fields':[_0xc29c('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x820c=['exports','define','OpenchannelTransferReport','report_openchannel_transfer','uniqueid','util','../../config/logger','api','moment','request-promise','path','../../config/environment','./openchannelTransferReport.attributes'];(function(_0x6b3aa,_0x25d15c){var _0x1123f2=function(_0x576038){while(--_0x576038){_0x6b3aa['push'](_0x6b3aa['shift']());}};_0x1123f2(++_0x25d15c);}(_0x820c,0x18b));var _0xc820=function(_0x55728b,_0x11641a){_0x55728b=_0x55728b-0x0;var _0x430ef1=_0x820c[_0x55728b];return _0x430ef1;};'use strict';var _=require('lodash');var util=require(_0xc820('0x0'));var logger=require(_0xc820('0x1'))(_0xc820('0x2'));var moment=require(_0xc820('0x3'));var BPromise=require('bluebird');var rp=require(_0xc820('0x4'));var fs=require('fs');var path=require(_0xc820('0x5'));var rimraf=require('rimraf');var config=require(_0xc820('0x6'));var attributes=require(_0xc820('0x7'));module[_0xc820('0x8')]=function(_0x193539,_0x3765a8){return _0x193539[_0xc820('0x9')](_0xc820('0xa'),attributes,{'tableName':_0xc820('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xc820('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js index a937c3c..2aa8003 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 _0x78d3=['../../config/environment','jayson/promise','client','http','request','then','info','OpenchannelTransferReport,\x20%s,\x20%s','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0xe97b8,_0x3437b6){var _0x191ebe=function(_0x555926){while(--_0x555926){_0xe97b8['push'](_0xe97b8['shift']());}};_0x191ebe(++_0x3437b6);}(_0x78d3,0x73));var _0x378d=function(_0x48d68b,_0x231241){_0x48d68b=_0x48d68b-0x0;var _0x199ae0=_0x78d3[_0x48d68b];return _0x199ae0;};'use strict';var _=require(_0x378d('0x0'));var util=require(_0x378d('0x1'));var moment=require(_0x378d('0x2'));var BPromise=require(_0x378d('0x3'));var rs=require(_0x378d('0x4'));var fs=require('fs');var Redis=require(_0x378d('0x5'));var db=require(_0x378d('0x6'))['db'];var utils=require(_0x378d('0x7'));var logger=require(_0x378d('0x8'))(_0x378d('0x9'));var config=require(_0x378d('0xa'));var jayson=require(_0x378d('0xb'));var client=jayson[_0x378d('0xc')][_0x378d('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x47a99f,_0x4fef30,_0x1c880e){return new BPromise(function(_0x4b3ef5,_0x14112d){return client[_0x378d('0xe')](_0x47a99f,_0x1c880e)[_0x378d('0xf')](function(_0x4698d9){logger[_0x378d('0x10')](_0x378d('0x11'),_0x4fef30,'request\x20sent');logger[_0x378d('0x12')](_0x378d('0x13'),_0x4fef30,_0x378d('0x14'),JSON['stringify'](_0x4698d9));if(_0x4698d9[_0x378d('0x15')]){if(_0x4698d9['error']['code']===0x1f4){logger[_0x378d('0x15')](_0x378d('0x11'),_0x4fef30,_0x4698d9['error'][_0x378d('0x16')]);return _0x14112d(_0x4698d9[_0x378d('0x15')][_0x378d('0x16')]);}logger['error'](_0x378d('0x11'),_0x4fef30,_0x4698d9['error'][_0x378d('0x16')]);return _0x4b3ef5(_0x4698d9[_0x378d('0x15')][_0x378d('0x16')]);}else{logger[_0x378d('0x10')](_0x378d('0x11'),_0x4fef30,'request\x20sent');_0x4b3ef5(_0x4698d9[_0x378d('0x17')]['message']);}})[_0x378d('0x18')](function(_0x1602f9){logger[_0x378d('0x15')](_0x378d('0x11'),_0x4fef30,_0x1602f9);_0x14112d(_0x1602f9);});});} \ No newline at end of file +var _0x2975=['http','request','then','info','request\x20sent','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','OpenchannelTransferReport,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/environment','jayson/promise','client'];(function(_0xf3e375,_0x5dc1c9){var _0x27027b=function(_0x41785a){while(--_0x41785a){_0xf3e375['push'](_0xf3e375['shift']());}};_0x27027b(++_0x5dc1c9);}(_0x2975,0x1c5));var _0x5297=function(_0x4c892e,_0x33bf4c){_0x4c892e=_0x4c892e-0x0;var _0x55c680=_0x2975[_0x4c892e];return _0x55c680;};'use strict';var _=require('lodash');var util=require(_0x5297('0x0'));var moment=require(_0x5297('0x1'));var BPromise=require(_0x5297('0x2'));var rs=require(_0x5297('0x3'));var fs=require('fs');var Redis=require(_0x5297('0x4'));var db=require(_0x5297('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x5297('0x6'));var jayson=require(_0x5297('0x7'));var client=jayson[_0x5297('0x8')][_0x5297('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4d1d2c,_0x1f6762,_0x1b72a7){return new BPromise(function(_0x4f12b0,_0x2c015c){return client[_0x5297('0xa')](_0x4d1d2c,_0x1b72a7)[_0x5297('0xb')](function(_0x2f3b24){logger[_0x5297('0xc')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x1f6762,_0x5297('0xd'));logger[_0x5297('0xe')](_0x5297('0xf'),_0x1f6762,'request\x20sent',JSON[_0x5297('0x10')](_0x2f3b24));if(_0x2f3b24[_0x5297('0x11')]){if(_0x2f3b24[_0x5297('0x11')]['code']===0x1f4){logger[_0x5297('0x11')](_0x5297('0x12'),_0x1f6762,_0x2f3b24['error']['message']);return _0x2c015c(_0x2f3b24[_0x5297('0x11')][_0x5297('0x13')]);}logger['error'](_0x5297('0x12'),_0x1f6762,_0x2f3b24['error'][_0x5297('0x13')]);return _0x4f12b0(_0x2f3b24[_0x5297('0x11')]['message']);}else{logger[_0x5297('0xc')](_0x5297('0x12'),_0x1f6762,_0x5297('0xd'));_0x4f12b0(_0x2f3b24[_0x5297('0x14')][_0x5297('0x13')]);}})[_0x5297('0x15')](function(_0x1fb138){logger[_0x5297('0x11')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x1f6762,_0x1fb138);_0x2c015c(_0x1fb138);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index 3d6d561..640b226 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 _0xd763=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./pause.controller','get','isAuthenticated','index','/:id','put','update','delete','destroy','exports','connect-timeout','express'];(function(_0x3b7cde,_0x13428a){var _0x361ee4=function(_0x246c6c){while(--_0x246c6c){_0x3b7cde['push'](_0x3b7cde['shift']());}};_0x361ee4(++_0x13428a);}(_0xd763,0x17e));var _0x3d76=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0xd763[_0x46698a];return _0x356db0;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x3d76('0x0'));var express=require(_0x3d76('0x1'));var router=express[_0x3d76('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x3d76('0x3'));var interaction=require(_0x3d76('0x4'));var config=require(_0x3d76('0x5'));var controller=require(_0x3d76('0x6'));router[_0x3d76('0x7')]('/',auth[_0x3d76('0x8')](),controller[_0x3d76('0x9')]);router[_0x3d76('0x7')](_0x3d76('0xa'),auth[_0x3d76('0x8')](),controller['show']);router['post']('/',auth[_0x3d76('0x8')](),controller['create']);router[_0x3d76('0xb')]('/:id',auth[_0x3d76('0x8')](),controller[_0x3d76('0xc')]);router[_0x3d76('0xd')](_0x3d76('0xa'),auth[_0x3d76('0x8')](),controller[_0x3d76('0xe')]);module[_0x3d76('0xf')]=router; \ No newline at end of file +var _0x9b93=['../../components/auth/service','./pause.controller','get','isAuthenticated','index','/:id','show','post','create','put','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9b93,0xf7));var _0x39b9=function(_0x1118eb,_0x476f0a){_0x1118eb=_0x1118eb-0x0;var _0x2dbcd0=_0x9b93[_0x1118eb];return _0x2dbcd0;};'use strict';var multer=require(_0x39b9('0x0'));var util=require(_0x39b9('0x1'));var path=require(_0x39b9('0x2'));var timeout=require(_0x39b9('0x3'));var express=require(_0x39b9('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x39b9('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x39b9('0x6'));router[_0x39b9('0x7')]('/',auth[_0x39b9('0x8')](),controller[_0x39b9('0x9')]);router[_0x39b9('0x7')](_0x39b9('0xa'),auth[_0x39b9('0x8')](),controller[_0x39b9('0xb')]);router[_0x39b9('0xc')]('/',auth['isAuthenticated'](),controller[_0x39b9('0xd')]);router[_0x39b9('0xe')](_0x39b9('0xa'),auth[_0x39b9('0x8')](),controller['update']);router[_0x39b9('0xf')]('/:id',auth[_0x39b9('0x8')](),controller[_0x39b9('0x10')]);module[_0x39b9('0x11')]=router; \ No newline at end of file diff --git a/server/api/pause/pause.attributes.js b/server/api/pause/pause.attributes.js index 686733b..f2da93e 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 _0x14f7=['STRING','name','sequelize','exports'];(function(_0x198afa,_0x18d8d8){var _0x173f1d=function(_0x12e58a){while(--_0x12e58a){_0x198afa['push'](_0x198afa['shift']());}};_0x173f1d(++_0x18d8d8);}(_0x14f7,0x1b2));var _0x714f=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x14f7[_0x432682];return _0x463d05;};'use strict';var Sequelize=require(_0x714f('0x0'));module[_0x714f('0x1')]={'name':{'type':Sequelize[_0x714f('0x2')],'unique':_0x714f('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x714f('0x2')]}}; \ No newline at end of file +var _0xdc52=['exports','STRING','sequelize'];(function(_0x4982f6,_0x45ba31){var _0x3d8a48=function(_0xef2826){while(--_0xef2826){_0x4982f6['push'](_0x4982f6['shift']());}};_0x3d8a48(++_0x45ba31);}(_0xdc52,0xe9));var _0x2dc5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xdc52[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x2dc5('0x0'));module[_0x2dc5('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0x2dc5('0x2')]}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index 79c611a..cf7eb67 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 _0xd95d=['create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','Pauses','UserProfileSection','autoAssociation','body','params','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','squel','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','get','destroy','error','stack','name','send','map','Pause','fieldName','type','key','model','query','keys','filters','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','show','rawAttributes','intersection','include','find','catch'];(function(_0x4ed838,_0x1446cd){var _0x2a5ecb=function(_0x23b6ed){while(--_0x23b6ed){_0x4ed838['push'](_0x4ed838['shift']());}};_0x2a5ecb(++_0x1446cd);}(_0xd95d,0x198));var _0xdd95=function(_0x496a3e,_0x55f6a5){_0x496a3e=_0x496a3e-0x0;var _0x181149=_0xd95d[_0x496a3e];return _0x181149;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xdd95('0x0'));var zipdir=require(_0xdd95('0x1'));var jsonpatch=require(_0xdd95('0x2'));var rp=require(_0xdd95('0x3'));var moment=require(_0xdd95('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xdd95('0x5'));var util=require('util');var path=require(_0xdd95('0x6'));var sox=require(_0xdd95('0x7'));var csv=require(_0xdd95('0x8'));var ejs=require(_0xdd95('0x9'));var fs=require('fs');var fs_extra=require(_0xdd95('0xa'));var _=require('lodash');var squel=require(_0xdd95('0xb'));var crypto=require('crypto');var jsforce=require(_0xdd95('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xdd95('0x8'));var querystring=require('querystring');var Papa=require(_0xdd95('0xd'));var Redis=require(_0xdd95('0xe'));var authService=require(_0xdd95('0xf'));var qs=require(_0xdd95('0x10'));var as=require(_0xdd95('0x11'));var hardwareService=require(_0xdd95('0x12'));var logger=require('../../config/logger')(_0xdd95('0x13'));var utils=require(_0xdd95('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xdd95('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x579cd9,_0x26c1e2){_0x26c1e2=_0x26c1e2||0xcc;return function(_0x5c83f8){if(_0x5c83f8){return _0x579cd9[_0xdd95('0x16')](_0x26c1e2);}return _0x579cd9[_0xdd95('0x17')](_0x26c1e2)[_0xdd95('0x18')]();};}function respondWithResult(_0x34f547,_0x18c280){_0x18c280=_0x18c280||0xc8;return function(_0x2072a1){if(_0x2072a1){return _0x34f547['status'](_0x18c280)['json'](_0x2072a1);}};}function respondWithFilteredResult(_0x22e78d,_0x188b93){return function(_0x564b21){if(_0x564b21){var _0x4d5906=typeof _0x188b93[_0xdd95('0x19')]===_0xdd95('0x1a')&&typeof _0x188b93[_0xdd95('0x1b')]===_0xdd95('0x1a');var _0x136071=_0x564b21[_0xdd95('0x1c')];var _0x57ecde=_0x4d5906?0x0:_0x188b93[_0xdd95('0x19')];var _0x45fbdf=_0x4d5906?_0x564b21[_0xdd95('0x1c')]:_0x188b93[_0xdd95('0x19')]+_0x188b93['limit'];var _0x7a3a02;if(_0x45fbdf>=_0x136071){_0x45fbdf=_0x136071;_0x7a3a02=0xc8;}else{_0x7a3a02=0xce;}_0x22e78d[_0xdd95('0x17')](_0x7a3a02);return _0x22e78d[_0xdd95('0x1d')](_0xdd95('0x1e'),_0x57ecde+'-'+_0x45fbdf+'/'+_0x136071)[_0xdd95('0x1f')](_0x564b21);}return null;};}function patchUpdates(_0x339730){return function(_0x29a130){try{jsonpatch[_0xdd95('0x20')](_0x29a130,_0x339730,!![]);}catch(_0xecd9db){return BPromise[_0xdd95('0x21')](_0xecd9db);}return _0x29a130[_0xdd95('0x22')]();};}function saveUpdates(_0x567269,_0x508213){return function(_0x1faa15){if(_0x1faa15){return _0x1faa15[_0xdd95('0x23')](_0x567269)[_0xdd95('0x24')](function(_0x67efcb){return _0x67efcb;});}return null;};}function removeEntity(_0x4d0a19,_0x5c9411){return function(_0xf1dba6){if(_0xf1dba6){return _0xf1dba6['destroy']()[_0xdd95('0x24')](function(){var _0x79efbd=_0xf1dba6[_0xdd95('0x25')]({'plain':!![]});var _0x22b5b7='Pauses';return db['UserProfileResource'][_0xdd95('0x26')]({'where':{'type':_0x22b5b7,'resourceId':_0x79efbd['id']}})[_0xdd95('0x24')](function(){return _0xf1dba6;});})[_0xdd95('0x24')](function(){_0x4d0a19['status'](0xcc)[_0xdd95('0x18')]();});}};}function handleEntityNotFound(_0x380f4c,_0x518f78){return function(_0x2fdc74){if(!_0x2fdc74){_0x380f4c[_0xdd95('0x16')](0x194);}return _0x2fdc74;};}function handleError(_0x58075c,_0x340498){_0x340498=_0x340498||0x1f4;return function(_0x4e5546){logger[_0xdd95('0x27')](_0x4e5546[_0xdd95('0x28')]);if(_0x4e5546['name']){delete _0x4e5546[_0xdd95('0x29')];}_0x58075c[_0xdd95('0x17')](_0x340498)[_0xdd95('0x2a')](_0x4e5546);};}exports['index']=function(_0x4fb2a0,_0xe04600){var _0x133642={},_0x5f13c9={},_0x5abd0a={'count':0x0,'rows':[]};var _0x4f01fe=_[_0xdd95('0x2b')](db[_0xdd95('0x2c')]['rawAttributes'],function(_0x1a088b){return{'name':_0x1a088b[_0xdd95('0x2d')],'type':_0x1a088b[_0xdd95('0x2e')][_0xdd95('0x2f')]};});_0x5f13c9[_0xdd95('0x30')]=_[_0xdd95('0x2b')](_0x4f01fe,_0xdd95('0x29'));_0x5f13c9[_0xdd95('0x31')]=_[_0xdd95('0x32')](_0x4fb2a0[_0xdd95('0x31')]);_0x5f13c9[_0xdd95('0x33')]=_['intersection'](_0x5f13c9['model'],_0x5f13c9[_0xdd95('0x31')]);_0x133642['attributes']=_['intersection'](_0x5f13c9[_0xdd95('0x30')],qs[_0xdd95('0x34')](_0x4fb2a0[_0xdd95('0x31')][_0xdd95('0x34')]));_0x133642[_0xdd95('0x35')]=_0x133642['attributes'][_0xdd95('0x36')]?_0x133642[_0xdd95('0x35')]:_0x5f13c9[_0xdd95('0x30')];if(!_0x4fb2a0['query'][_0xdd95('0x37')](_0xdd95('0x38'))){_0x133642[_0xdd95('0x1b')]=qs[_0xdd95('0x1b')](_0x4fb2a0[_0xdd95('0x31')][_0xdd95('0x1b')]);_0x133642[_0xdd95('0x19')]=qs[_0xdd95('0x19')](_0x4fb2a0[_0xdd95('0x31')]['offset']);}_0x133642['order']=qs[_0xdd95('0x39')](_0x4fb2a0[_0xdd95('0x31')][_0xdd95('0x39')]);_0x133642[_0xdd95('0x3a')]=qs[_0xdd95('0x33')](_[_0xdd95('0x3b')](_0x4fb2a0[_0xdd95('0x31')],_0x5f13c9[_0xdd95('0x33')]),_0x4f01fe);if(_0x4fb2a0[_0xdd95('0x31')][_0xdd95('0x3c')]){_0x133642['where']=_[_0xdd95('0x3d')](_0x133642[_0xdd95('0x3a')],{'$or':_[_0xdd95('0x2b')](_0x4f01fe,function(_0x2216c0){if(_0x2216c0['type']!==_0xdd95('0x3e')){var _0x3edcb2={};_0x3edcb2[_0x2216c0[_0xdd95('0x29')]]={'$like':'%'+_0x4fb2a0['query'][_0xdd95('0x3c')]+'%'};return _0x3edcb2;}})});}_0x133642=_[_0xdd95('0x3d')]({},_0x133642,_0x4fb2a0[_0xdd95('0x3f')]);var _0x5bd38e={'where':_0x133642[_0xdd95('0x3a')]};return db[_0xdd95('0x2c')][_0xdd95('0x1c')](_0x5bd38e)[_0xdd95('0x24')](function(_0x23101e){_0x5abd0a['count']=_0x23101e;if(_0x4fb2a0[_0xdd95('0x31')][_0xdd95('0x40')]){_0x133642['include']=[{'all':!![]}];}return db['Pause'][_0xdd95('0x41')](_0x133642);})[_0xdd95('0x24')](function(_0x30a715){_0x5abd0a['rows']=_0x30a715;return _0x5abd0a;})[_0xdd95('0x24')](respondWithFilteredResult(_0xe04600,_0x133642))['catch'](handleError(_0xe04600,null));};exports[_0xdd95('0x42')]=function(_0x153d6c,_0x3df966){var _0x432a8e={'raw':!![],'where':{'id':_0x153d6c['params']['id']}},_0x1b18bf={};_0x1b18bf[_0xdd95('0x30')]=_[_0xdd95('0x32')](db[_0xdd95('0x2c')][_0xdd95('0x43')]);_0x1b18bf[_0xdd95('0x31')]=_[_0xdd95('0x32')](_0x153d6c[_0xdd95('0x31')]);_0x1b18bf[_0xdd95('0x33')]=_[_0xdd95('0x44')](_0x1b18bf[_0xdd95('0x30')],_0x1b18bf[_0xdd95('0x31')]);_0x432a8e[_0xdd95('0x35')]=_['intersection'](_0x1b18bf[_0xdd95('0x30')],qs[_0xdd95('0x34')](_0x153d6c[_0xdd95('0x31')][_0xdd95('0x34')]));_0x432a8e[_0xdd95('0x35')]=_0x432a8e['attributes']['length']?_0x432a8e[_0xdd95('0x35')]:_0x1b18bf[_0xdd95('0x30')];if(_0x153d6c[_0xdd95('0x31')]['includeAll']){_0x432a8e[_0xdd95('0x45')]=[{'all':!![]}];}_0x432a8e=_[_0xdd95('0x3d')]({},_0x432a8e,_0x153d6c[_0xdd95('0x3f')]);return db['Pause'][_0xdd95('0x46')](_0x432a8e)[_0xdd95('0x24')](handleEntityNotFound(_0x3df966,null))[_0xdd95('0x24')](respondWithResult(_0x3df966,null))[_0xdd95('0x47')](handleError(_0x3df966,null));};exports[_0xdd95('0x48')]=function(_0x325e2a,_0x57c76c){return db['Pause'][_0xdd95('0x48')](_0x325e2a['body'],{})['then'](function(_0xe44f0c){var _0x382b38=_0x325e2a[_0xdd95('0x49')][_0xdd95('0x25')]({'plain':!![]});if(!_0x382b38)throw new Error(_0xdd95('0x4a'));if(_0x382b38['role']===_0xdd95('0x49')){var _0xf9b53=_0xe44f0c[_0xdd95('0x25')]({'plain':!![]});var _0x3cb6c6=_0xdd95('0x4b');return db[_0xdd95('0x4c')]['find']({'where':{'name':_0x3cb6c6,'userProfileId':_0x382b38['userProfileId']},'raw':!![]})['then'](function(_0x49716a){if(_0x49716a&&_0x49716a[_0xdd95('0x4d')]===0x0){return db['UserProfileResource'][_0xdd95('0x48')]({'name':_0xf9b53[_0xdd95('0x29')],'resourceId':_0xf9b53['id'],'type':_0x49716a[_0xdd95('0x29')],'sectionId':_0x49716a['id']},{})[_0xdd95('0x24')](function(){return _0xe44f0c;});}else{return _0xe44f0c;}})[_0xdd95('0x47')](function(_0x329b46){logger[_0xdd95('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x329b46);throw _0x329b46;});}return _0xe44f0c;})['then'](respondWithResult(_0x57c76c,0xc9))['catch'](handleError(_0x57c76c,null));};exports['update']=function(_0x1c089d,_0x1ca90){if(_0x1c089d[_0xdd95('0x4e')]['id']){delete _0x1c089d['body']['id'];}return db['Pause'][_0xdd95('0x46')]({'where':{'id':_0x1c089d[_0xdd95('0x4f')]['id']}})[_0xdd95('0x24')](handleEntityNotFound(_0x1ca90,null))[_0xdd95('0x24')](saveUpdates(_0x1c089d[_0xdd95('0x4e')],null))[_0xdd95('0x24')](respondWithResult(_0x1ca90,null))['catch'](handleError(_0x1ca90,null));};exports['destroy']=function(_0x4380db,_0x2b358e){return db[_0xdd95('0x2c')]['find']({'where':{'id':_0x4380db[_0xdd95('0x4f')]['id']}})[_0xdd95('0x24')](handleEntityNotFound(_0x2b358e,null))['then'](removeEntity(_0x2b358e,null))[_0xdd95('0x47')](handleError(_0x2b358e,null));}; \ No newline at end of file +var _0xa67e=['index','map','Pause','type','key','model','query','keys','intersection','attributes','fields','limit','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','rawAttributes','length','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','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/environment','../../config/license/util','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','Pauses','UserProfileResource','sendStatus','error','stack','name','send'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa67e,0xcf));var _0xea67=function(_0x45f3a4,_0x46968d){_0x45f3a4=_0x45f3a4-0x0;var _0x49943a=_0xa67e[_0x45f3a4];return _0x49943a;};'use strict';var emlformat=require(_0xea67('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xea67('0x1'));var jsonpatch=require(_0xea67('0x2'));var rp=require(_0xea67('0x3'));var moment=require(_0xea67('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xea67('0x5'));var util=require('util');var path=require('path');var sox=require(_0xea67('0x6'));var csv=require(_0xea67('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xea67('0x8'));var _=require(_0xea67('0x9'));var squel=require(_0xea67('0xa'));var crypto=require(_0xea67('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xea67('0xc'));var toCsv=require(_0xea67('0x7'));var querystring=require(_0xea67('0xd'));var Papa=require(_0xea67('0xe'));var Redis=require(_0xea67('0xf'));var authService=require(_0xea67('0x10'));var qs=require(_0xea67('0x11'));var as=require(_0xea67('0x12'));var hardwareService=require(_0xea67('0x13'));var logger=require(_0xea67('0x14'))(_0xea67('0x15'));var utils=require('../../config/utils');var config=require(_0xea67('0x16'));var licenseUtil=require(_0xea67('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x15aa32,_0x346a68){_0x346a68=_0x346a68||0xcc;return function(_0x1c0d13){if(_0x1c0d13){return _0x15aa32['sendStatus'](_0x346a68);}return _0x15aa32[_0xea67('0x18')](_0x346a68)[_0xea67('0x19')]();};}function respondWithResult(_0x1be315,_0x3f304d){_0x3f304d=_0x3f304d||0xc8;return function(_0x1a8a41){if(_0x1a8a41){return _0x1be315[_0xea67('0x18')](_0x3f304d)[_0xea67('0x1a')](_0x1a8a41);}};}function respondWithFilteredResult(_0x411001,_0xf016f3){return function(_0x389b43){if(_0x389b43){var _0x893bf7=typeof _0xf016f3[_0xea67('0x1b')]===_0xea67('0x1c')&&typeof _0xf016f3['limit']===_0xea67('0x1c');var _0x26e2f4=_0x389b43[_0xea67('0x1d')];var _0x235478=_0x893bf7?0x0:_0xf016f3['offset'];var _0x433f2e=_0x893bf7?_0x389b43[_0xea67('0x1d')]:_0xf016f3[_0xea67('0x1b')]+_0xf016f3['limit'];var _0x4bfbe7;if(_0x433f2e>=_0x26e2f4){_0x433f2e=_0x26e2f4;_0x4bfbe7=0xc8;}else{_0x4bfbe7=0xce;}_0x411001['status'](_0x4bfbe7);return _0x411001[_0xea67('0x1e')](_0xea67('0x1f'),_0x235478+'-'+_0x433f2e+'/'+_0x26e2f4)[_0xea67('0x1a')](_0x389b43);}return null;};}function patchUpdates(_0x2ed6bd){return function(_0x5559b3){try{jsonpatch[_0xea67('0x20')](_0x5559b3,_0x2ed6bd,!![]);}catch(_0x4f35a0){return BPromise[_0xea67('0x21')](_0x4f35a0);}return _0x5559b3[_0xea67('0x22')]();};}function saveUpdates(_0xe57108,_0x468b35){return function(_0xd6eab4){if(_0xd6eab4){return _0xd6eab4[_0xea67('0x23')](_0xe57108)[_0xea67('0x24')](function(_0x17fd84){return _0x17fd84;});}return null;};}function removeEntity(_0x1a6cc5,_0x3c7cd4){return function(_0x3c9c4b){if(_0x3c9c4b){return _0x3c9c4b[_0xea67('0x25')]()[_0xea67('0x24')](function(){var _0x2c9ee5=_0x3c9c4b['get']({'plain':!![]});var _0x34a598=_0xea67('0x26');return db[_0xea67('0x27')][_0xea67('0x25')]({'where':{'type':_0x34a598,'resourceId':_0x2c9ee5['id']}})[_0xea67('0x24')](function(){return _0x3c9c4b;});})[_0xea67('0x24')](function(){_0x1a6cc5['status'](0xcc)[_0xea67('0x19')]();});}};}function handleEntityNotFound(_0x3eb1c0,_0x21a014){return function(_0x9d92b){if(!_0x9d92b){_0x3eb1c0[_0xea67('0x28')](0x194);}return _0x9d92b;};}function handleError(_0x4cd17e,_0x4ded9b){_0x4ded9b=_0x4ded9b||0x1f4;return function(_0x597cfb){logger[_0xea67('0x29')](_0x597cfb[_0xea67('0x2a')]);if(_0x597cfb[_0xea67('0x2b')]){delete _0x597cfb['name'];}_0x4cd17e['status'](_0x4ded9b)[_0xea67('0x2c')](_0x597cfb);};}exports[_0xea67('0x2d')]=function(_0xc64b68,_0x5dc157){var _0x5ba159={},_0x240e38={},_0x452c90={'count':0x0,'rows':[]};var _0x46e08d=_[_0xea67('0x2e')](db[_0xea67('0x2f')]['rawAttributes'],function(_0x687a24){return{'name':_0x687a24['fieldName'],'type':_0x687a24[_0xea67('0x30')][_0xea67('0x31')]};});_0x240e38[_0xea67('0x32')]=_[_0xea67('0x2e')](_0x46e08d,_0xea67('0x2b'));_0x240e38[_0xea67('0x33')]=_[_0xea67('0x34')](_0xc64b68[_0xea67('0x33')]);_0x240e38['filters']=_[_0xea67('0x35')](_0x240e38[_0xea67('0x32')],_0x240e38['query']);_0x5ba159[_0xea67('0x36')]=_[_0xea67('0x35')](_0x240e38[_0xea67('0x32')],qs[_0xea67('0x37')](_0xc64b68[_0xea67('0x33')][_0xea67('0x37')]));_0x5ba159[_0xea67('0x36')]=_0x5ba159['attributes']['length']?_0x5ba159['attributes']:_0x240e38[_0xea67('0x32')];if(!_0xc64b68[_0xea67('0x33')]['hasOwnProperty']('nolimit')){_0x5ba159[_0xea67('0x38')]=qs[_0xea67('0x38')](_0xc64b68[_0xea67('0x33')]['limit']);_0x5ba159[_0xea67('0x1b')]=qs[_0xea67('0x1b')](_0xc64b68[_0xea67('0x33')][_0xea67('0x1b')]);}_0x5ba159['order']=qs[_0xea67('0x39')](_0xc64b68[_0xea67('0x33')][_0xea67('0x39')]);_0x5ba159[_0xea67('0x3a')]=qs[_0xea67('0x3b')](_[_0xea67('0x3c')](_0xc64b68['query'],_0x240e38[_0xea67('0x3b')]),_0x46e08d);if(_0xc64b68['query'][_0xea67('0x3d')]){_0x5ba159['where']=_[_0xea67('0x3e')](_0x5ba159[_0xea67('0x3a')],{'$or':_[_0xea67('0x2e')](_0x46e08d,function(_0x5f3ea0){if(_0x5f3ea0[_0xea67('0x30')]!==_0xea67('0x3f')){var _0x19394c={};_0x19394c[_0x5f3ea0[_0xea67('0x2b')]]={'$like':'%'+_0xc64b68[_0xea67('0x33')][_0xea67('0x3d')]+'%'};return _0x19394c;}})});}_0x5ba159=_[_0xea67('0x3e')]({},_0x5ba159,_0xc64b68[_0xea67('0x40')]);var _0x5a28b4={'where':_0x5ba159[_0xea67('0x3a')]};return db[_0xea67('0x2f')][_0xea67('0x1d')](_0x5a28b4)[_0xea67('0x24')](function(_0x2b3571){_0x452c90['count']=_0x2b3571;if(_0xc64b68[_0xea67('0x33')][_0xea67('0x41')]){_0x5ba159[_0xea67('0x42')]=[{'all':!![]}];}return db[_0xea67('0x2f')]['findAll'](_0x5ba159);})[_0xea67('0x24')](function(_0x71f909){_0x452c90[_0xea67('0x43')]=_0x71f909;return _0x452c90;})[_0xea67('0x24')](respondWithFilteredResult(_0x5dc157,_0x5ba159))[_0xea67('0x44')](handleError(_0x5dc157,null));};exports[_0xea67('0x45')]=function(_0x4dcbd5,_0x5ba4d8){var _0x31b604={'raw':!![],'where':{'id':_0x4dcbd5[_0xea67('0x46')]['id']}},_0x502cda={};_0x502cda[_0xea67('0x32')]=_[_0xea67('0x34')](db[_0xea67('0x2f')][_0xea67('0x47')]);_0x502cda[_0xea67('0x33')]=_[_0xea67('0x34')](_0x4dcbd5[_0xea67('0x33')]);_0x502cda[_0xea67('0x3b')]=_[_0xea67('0x35')](_0x502cda[_0xea67('0x32')],_0x502cda[_0xea67('0x33')]);_0x31b604[_0xea67('0x36')]=_['intersection'](_0x502cda[_0xea67('0x32')],qs['fields'](_0x4dcbd5[_0xea67('0x33')]['fields']));_0x31b604['attributes']=_0x31b604['attributes'][_0xea67('0x48')]?_0x31b604[_0xea67('0x36')]:_0x502cda['model'];if(_0x4dcbd5[_0xea67('0x33')][_0xea67('0x41')]){_0x31b604['include']=[{'all':!![]}];}_0x31b604=_['merge']({},_0x31b604,_0x4dcbd5[_0xea67('0x40')]);return db[_0xea67('0x2f')]['find'](_0x31b604)[_0xea67('0x24')](handleEntityNotFound(_0x5ba4d8,null))[_0xea67('0x24')](respondWithResult(_0x5ba4d8,null))[_0xea67('0x44')](handleError(_0x5ba4d8,null));};exports[_0xea67('0x49')]=function(_0x104ed3,_0x5c67d1){return db[_0xea67('0x2f')][_0xea67('0x49')](_0x104ed3['body'],{})[_0xea67('0x24')](function(_0x1310c9){var _0x3cecd6=_0x104ed3[_0xea67('0x4a')]['get']({'plain':!![]});if(!_0x3cecd6)throw new Error(_0xea67('0x4b'));if(_0x3cecd6[_0xea67('0x4c')]===_0xea67('0x4a')){var _0x570413=_0x1310c9[_0xea67('0x4d')]({'plain':!![]});var _0x409edf='Pauses';return db[_0xea67('0x4e')][_0xea67('0x4f')]({'where':{'name':_0x409edf,'userProfileId':_0x3cecd6[_0xea67('0x50')]},'raw':!![]})[_0xea67('0x24')](function(_0x30d0f8){if(_0x30d0f8&&_0x30d0f8[_0xea67('0x51')]===0x0){return db[_0xea67('0x27')]['create']({'name':_0x570413[_0xea67('0x2b')],'resourceId':_0x570413['id'],'type':_0x30d0f8['name'],'sectionId':_0x30d0f8['id']},{})['then'](function(){return _0x1310c9;});}else{return _0x1310c9;}})['catch'](function(_0x50d371){logger['error'](_0xea67('0x52'),_0x50d371);throw _0x50d371;});}return _0x1310c9;})[_0xea67('0x24')](respondWithResult(_0x5c67d1,0xc9))[_0xea67('0x44')](handleError(_0x5c67d1,null));};exports['update']=function(_0x3aea2c,_0x4cd15b){if(_0x3aea2c[_0xea67('0x53')]['id']){delete _0x3aea2c[_0xea67('0x53')]['id'];}return db[_0xea67('0x2f')][_0xea67('0x4f')]({'where':{'id':_0x3aea2c['params']['id']}})[_0xea67('0x24')](handleEntityNotFound(_0x4cd15b,null))[_0xea67('0x24')](saveUpdates(_0x3aea2c[_0xea67('0x53')],null))[_0xea67('0x24')](respondWithResult(_0x4cd15b,null))['catch'](handleError(_0x4cd15b,null));};exports[_0xea67('0x25')]=function(_0x412155,_0x3306b3){return db[_0xea67('0x2f')][_0xea67('0x4f')]({'where':{'id':_0x412155['params']['id']}})['then'](handleEntityNotFound(_0x3306b3,null))[_0xea67('0x24')](removeEntity(_0x3306b3,null))[_0xea67('0x44')](handleError(_0x3306b3,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index 36f86df..6d06658 100644 --- a/server/api/pause/pause.model.js +++ b/server/api/pause/pause.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7fbe=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./pause.attributes','exports','define','Pause'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0xd6fcb5,_0x526523){_0xd6fcb5=_0xd6fcb5-0x0;var _0x278ac7=_0x7fbe[_0xd6fcb5];return _0x278ac7;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe7fb('0x0'))(_0xe7fb('0x1'));var moment=require(_0xe7fb('0x2'));var BPromise=require(_0xe7fb('0x3'));var rp=require(_0xe7fb('0x4'));var fs=require('fs');var path=require(_0xe7fb('0x5'));var rimraf=require(_0xe7fb('0x6'));var config=require(_0xe7fb('0x7'));var attributes=require(_0xe7fb('0x8'));module[_0xe7fb('0x9')]=function(_0x290172,_0x12d1b0){return _0x290172[_0xe7fb('0xa')](_0xe7fb('0xb'),attributes,{'tableName':'tools_pauses','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc4aa=['bluebird','../../config/environment','./pause.attributes','exports','define','Pause','tools_pauses','lodash','util','../../config/logger','api','moment'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x36c5b0,_0x5001da){_0x36c5b0=_0x36c5b0-0x0;var _0xf19333=_0xc4aa[_0x36c5b0];return _0xf19333;};'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':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/pause/pause.rpc.js b/server/api/pause/pause.rpc.js index 35e0455..3df2f4e 100644 --- a/server/api/pause/pause.rpc.js +++ b/server/api/pause/pause.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Pause,\x20%s,\x20%s','Pause,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','ShowPause','Pause','find','options','raw','where','attributes','map','include','model','debug'];(function(_0x5626f4,_0x3fabf3){var _0x55dd99=function(_0x4bb422){while(--_0x4bb422){_0x5626f4['push'](_0x5626f4['shift']());}};_0x55dd99(++_0x3fabf3);}(_0xb10b,0x12a));var _0xbb10=function(_0x4dd4a1,_0x5ca922){_0x4dd4a1=_0x4dd4a1-0x0;var _0x168d0f=_0xb10b[_0x4dd4a1];return _0x168d0f;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')]({'raw':_0x378da8['options']?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![],'where':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1a')]||null:null,'attributes':_0x378da8[_0xbb10('0x18')]?_0x378da8['options'][_0xbb10('0x1b')]||null:null,'include':_0x378da8[_0xbb10('0x18')]?_0x378da8['options']['include']?_[_0xbb10('0x1c')](_0x378da8[_0xbb10('0x18')][_0xbb10('0x1d')],function(_0x317da4){return{'model':db[_0x317da4[_0xbb10('0x1e')]],'as':_0x317da4['as'],'attributes':_0x317da4[_0xbb10('0x1b')],'include':_0x317da4[_0xbb10('0x1d')]?_[_0xbb10('0x1c')](_0x317da4[_0xbb10('0x1d')],function(_0x395404){return{'model':db[_0x395404[_0xbb10('0x1e')]],'as':_0x395404['as'],'attributes':_0x395404[_0xbb10('0x1b')],'include':_0x395404['include']?_['map'](_0x395404['include'],function(_0xc93a04){return{'model':db[_0xc93a04[_0xbb10('0x1e')]],'as':_0xc93a04['as'],'attributes':_0xc93a04[_0xbb10('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2fdde9){logger[_0xbb10('0xd')](_0xbb10('0x15'),_0x378da8);logger[_0xbb10('0x1f')](_0xbb10('0x15'),_0x378da8,JSON[_0xbb10('0x11')](_0x2fdde9));_0x575cca(_0x2fdde9);})[_0xbb10('0x20')](function(_0x4aabb9){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x4aabb9[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x4aabb9[_0xbb10('0x13')]));});});}; \ No newline at end of file +var _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(_0x483b9c,_0x2adf61){var _0x5a6d50=function(_0x48aee0){while(--_0x48aee0){_0x483b9c['push'](_0x483b9c['shift']());}};_0x5a6d50(++_0x2adf61);}(_0x7a54,0x106));var _0x47a5=function(_0x4884e4,_0x883ea3){_0x4884e4=_0x4884e4-0x0;var _0x1aafdf=_0x7a54[_0x4884e4];return _0x1aafdf;};'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 53fd0d5..ece7390 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 _0xedd9=['/webhook','/:id','show','/:id/download','download','diskStorage','root','server/files/plugins','originalname','replace','%s-%s%s','basename','extname','now','single','file','upload','webhookPost','put','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./plugin.controller','get','isAuthenticated','index'];(function(_0x2e8ee9,_0xcec846){var _0x2bd44b=function(_0x403bcf){while(--_0x403bcf){_0x2e8ee9['push'](_0x2e8ee9['shift']());}};_0x2bd44b(++_0xcec846);}(_0xedd9,0xfc));var _0x9edd=function(_0x11abd3,_0x19cb1f){_0x11abd3=_0x11abd3-0x0;var _0x4c677f=_0xedd9[_0x11abd3];return _0x4c677f;};'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'),controller['webhookGet']);router[_0x9edd('0x9')](_0x9edd('0xd'),auth[_0x9edd('0xa')](),controller[_0x9edd('0xe')]);router['get'](_0x9edd('0xf'),auth['isAuthenticated'](),controller[_0x9edd('0x10')]);var upload=multer({'storage':multer[_0x9edd('0x11')]({'destination':function(_0x523026,_0xbf9da6,_0x13dc4f){_0x13dc4f(null,path['join'](config[_0x9edd('0x12')],_0x9edd('0x13')));},'filename':function(_0x25e64c,_0xfd544a,_0x287ddd){_0xfd544a[_0x9edd('0x14')]=_0xfd544a[_0x9edd('0x14')][_0x9edd('0x15')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x287ddd(null,util['format'](_0x9edd('0x16'),path[_0x9edd('0x17')](_0xfd544a[_0x9edd('0x14')],path[_0x9edd('0x18')](_0xfd544a[_0x9edd('0x14')])),Date[_0x9edd('0x19')](),path[_0x9edd('0x18')](_0xfd544a[_0x9edd('0x14')])));}})});router['post']('/',upload[_0x9edd('0x1a')](_0x9edd('0x1b')),controller[_0x9edd('0x1c')]);router['post'](_0x9edd('0xc'),controller[_0x9edd('0x1d')]);router[_0x9edd('0x1e')]('/:id',auth[_0x9edd('0xa')](),controller['update']);router[_0x9edd('0x1f')](_0x9edd('0xd'),auth['isAuthenticated'](),controller['delete']);module[_0x9edd('0x20')]=router; \ No newline at end of file +var _0x55e0=['webhookPost','update','delete','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./plugin.controller','get','webhookGet','/:id','isAuthenticated','show','/:id/download','download','diskStorage','join','server/files/plugins','originalname','replace','%s-%s%s','basename','extname','post','file','upload','/webhook'];(function(_0x24de14,_0x880194){var _0x2afa28=function(_0x1fcc45){while(--_0x1fcc45){_0x24de14['push'](_0x24de14['shift']());}};_0x2afa28(++_0x880194);}(_0x55e0,0xdc));var _0x055e=function(_0x192b63,_0x1004c7){_0x192b63=_0x192b63-0x0;var _0x48a225=_0x55e0[_0x192b63];return _0x48a225;};'use strict';var multer=require(_0x055e('0x0'));var util=require(_0x055e('0x1'));var path=require(_0x055e('0x2'));var timeout=require(_0x055e('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x055e('0x4'));var auth=require(_0x055e('0x5'));var interaction=require(_0x055e('0x6'));var config=require(_0x055e('0x7'));var controller=require(_0x055e('0x8'));router[_0x055e('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x055e('0x9')]('/webhook',controller[_0x055e('0xa')]);router[_0x055e('0x9')](_0x055e('0xb'),auth[_0x055e('0xc')](),controller[_0x055e('0xd')]);router['get'](_0x055e('0xe'),auth[_0x055e('0xc')](),controller[_0x055e('0xf')]);var upload=multer({'storage':multer[_0x055e('0x10')]({'destination':function(_0x238068,_0x5237d9,_0x56c78a){_0x56c78a(null,path[_0x055e('0x11')](config['root'],_0x055e('0x12')));},'filename':function(_0x466da3,_0x72d424,_0x101bc3){_0x72d424[_0x055e('0x13')]=_0x72d424[_0x055e('0x13')][_0x055e('0x14')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x101bc3(null,util['format'](_0x055e('0x15'),path[_0x055e('0x16')](_0x72d424[_0x055e('0x13')],path[_0x055e('0x17')](_0x72d424[_0x055e('0x13')])),Date['now'](),path[_0x055e('0x17')](_0x72d424[_0x055e('0x13')])));}})});router[_0x055e('0x18')]('/',upload['single'](_0x055e('0x19')),controller[_0x055e('0x1a')]);router[_0x055e('0x18')](_0x055e('0x1b'),controller[_0x055e('0x1c')]);router['put'](_0x055e('0xb'),auth[_0x055e('0xc')](),controller[_0x055e('0x1d')]);router[_0x055e('0x1e')]('/:id',auth[_0x055e('0xc')](),controller[_0x055e('0x1e')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index 980a7d4..6a0df99 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 _0x77c5=['always','never','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize','exports','STRING','ENUM','html','script','TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0x77c5,0x148));var _0x577c=function(_0x3b2dbd,_0x49dadd){_0x3b2dbd=_0x3b2dbd-0x0;var _0x2a680f=_0x77c5[_0x3b2dbd];return _0x2a680f;};'use strict';var Sequelize=require(_0x577c('0x0'));module[_0x577c('0x1')]={'name':{'type':Sequelize[_0x577c('0x2')]},'type':{'type':Sequelize[_0x577c('0x3')](_0x577c('0x4'),_0x577c('0x5'))},'description':{'type':Sequelize[_0x577c('0x6')]},'version':{'type':Sequelize[_0x577c('0x6')]},'path':{'type':Sequelize['STRING'],'comment':_0x577c('0x7')},'active':{'type':Sequelize[_0x577c('0x8')],'defaultValue':0x0,'comment':_0x577c('0x9')},'sidebar':{'type':Sequelize[_0x577c('0x3')]('adminOnly','agentOnly',_0x577c('0xa'),_0x577c('0xb')),'defaultValue':_0x577c('0xa'),'comment':_0x577c('0xc')},'icon':{'type':Sequelize[_0x577c('0x2')]},'adminUrl':{'type':Sequelize[_0x577c('0x2')]},'agentUrl':{'type':Sequelize[_0x577c('0x2')]},'scriptName':{'type':Sequelize[_0x577c('0x2')]},'scriptPath':{'type':Sequelize[_0x577c('0x2')]}}; \ No newline at end of file +var _0x273e=['Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','adminOnly','agentOnly','always','never','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize','exports','STRING','ENUM','html','TEXT'];(function(_0x1573ea,_0x434f02){var _0x51c0e2=function(_0x5c9b28){while(--_0x5c9b28){_0x1573ea['push'](_0x1573ea['shift']());}};_0x51c0e2(++_0x434f02);}(_0x273e,0x66));var _0xe273=function(_0x416e6a,_0x102b77){_0x416e6a=_0x416e6a-0x0;var _0x523f0c=_0x273e[_0x416e6a];return _0x523f0c;};'use strict';var Sequelize=require(_0xe273('0x0'));module[_0xe273('0x1')]={'name':{'type':Sequelize[_0xe273('0x2')]},'type':{'type':Sequelize[_0xe273('0x3')](_0xe273('0x4'),'script')},'description':{'type':Sequelize['TEXT']},'version':{'type':Sequelize[_0xe273('0x5')]},'path':{'type':Sequelize['STRING'],'comment':'The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.'},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0xe273('0x6')},'sidebar':{'type':Sequelize[_0xe273('0x3')](_0xe273('0x7'),_0xe273('0x8'),_0xe273('0x9'),_0xe273('0xa')),'defaultValue':_0xe273('0x9'),'comment':_0xe273('0xb')},'icon':{'type':Sequelize[_0xe273('0x2')]},'adminUrl':{'type':Sequelize[_0xe273('0x2')]},'agentUrl':{'type':Sequelize[_0xe273('0x2')]},'scriptName':{'type':Sequelize['STRING']},'scriptPath':{'type':Sequelize[_0xe273('0x2')]}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index e07311d..f728f0a 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 _0xd345=['Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','Download\x20completed','info','Temporary\x20file\x20removed','upload','file','filename','Plugin\x20upload\x20filepath:\x20%s','chmodSync','readdirSync','Invalid\x20plugin\x20structure','lstatSync','isFile','isDirectory','some','manifest.json','Plugin\x20manifest\x20missing','parse','version','Invalid\x20manifest:\x20version\x20not\x20specified','Invalid\x20manifest:\x20parameters\x20missing','parameters','Invalid\x20manifest:\x20views\x20missing','views','admin','agent','script','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','always','icon','icon-apps','html','test','Warning:\x20admin\x20view\x20not\x20specified','Warning:\x20agent\x20view\x20not\x20specified','scriptName','plugins','body','userProfileId','role','user','Plugins','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','update','delete','webhookGet','\x27PATH\x27\x20parameter\x20not\x20specified','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','json','encoding','method','format','headers','content-length','content-type','endsWith','statusCode','resolve','http://localhost:','%s%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','extract-zip','archiver','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','./plugin.socket','status','end','offset','undefined','limit','count','set','Content-Range','reject','save','destroy','then','UserProfileResource','sendStatus','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','Plugin','include','findAll','show','params','includeAll','find','catch','download','root','server/files/plugins','%s.zip','basename','createWriteStream','code','error','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','pipe','glob','**/*','join','dirname','node_modules/**/*','attachments/**/*','finalize','close','Plugin\x20not\x20found'];(function(_0x221332,_0x5c0307){var _0x281621=function(_0xd004fa){while(--_0xd004fa){_0x221332['push'](_0x221332['shift']());}};_0x281621(++_0x5c0307);}(_0xd345,0xf0));var _0x5d34=function(_0x2a1fe6,_0x3d74e7){_0x2a1fe6=_0x2a1fe6-0x0;var _0x26179f=_0xd345[_0x2a1fe6];return _0x26179f;};'use strict';var emlformat=require(_0x5d34('0x0'));var rimraf=require(_0x5d34('0x1'));var zipdir=require(_0x5d34('0x2'));var jsonpatch=require(_0x5d34('0x3'));var rp=require(_0x5d34('0x4'));var moment=require('moment');var BPromise=require(_0x5d34('0x5'));var Mustache=require(_0x5d34('0x6'));var util=require('util');var path=require(_0x5d34('0x7'));var sox=require('sox');var csv=require(_0x5d34('0x8'));var ejs=require(_0x5d34('0x9'));var fs=require('fs');var fs_extra=require(_0x5d34('0xa'));var _=require(_0x5d34('0xb'));var squel=require(_0x5d34('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x5d34('0xd'));var toCsv=require('to-csv');var querystring=require(_0x5d34('0xe'));var Papa=require(_0x5d34('0xf'));var extract=require(_0x5d34('0x10'));var rimraf=require(_0x5d34('0x1'));var archiver=require(_0x5d34('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x5d34('0x12'));var as=require(_0x5d34('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5d34('0x14'))('api');var utils=require(_0x5d34('0x15'));var config=require(_0x5d34('0x16'));var licenseUtil=require(_0x5d34('0x17'));var db=require(_0x5d34('0x18'))['db'];config['redis']=_[_0x5d34('0x19')](config[_0x5d34('0x1a')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x5d34('0x1b'))['register'](socket);function respondWithStatusCode(_0x423921,_0xb20b29){_0xb20b29=_0xb20b29||0xcc;return function(_0x4b70da){if(_0x4b70da){return _0x423921['sendStatus'](_0xb20b29);}return _0x423921[_0x5d34('0x1c')](_0xb20b29)[_0x5d34('0x1d')]();};}function respondWithResult(_0x335434,_0x159643){_0x159643=_0x159643||0xc8;return function(_0x438a57){if(_0x438a57){return _0x335434[_0x5d34('0x1c')](_0x159643)['json'](_0x438a57);}};}function respondWithFilteredResult(_0x297893,_0x5c9b0c){return function(_0x3dea5b){if(_0x3dea5b){var _0x241679=typeof _0x5c9b0c[_0x5d34('0x1e')]===_0x5d34('0x1f')&&typeof _0x5c9b0c[_0x5d34('0x20')]==='undefined';var _0x237409=_0x3dea5b[_0x5d34('0x21')];var _0x25c148=_0x241679?0x0:_0x5c9b0c[_0x5d34('0x1e')];var _0x5ec09f=_0x241679?_0x3dea5b[_0x5d34('0x21')]:_0x5c9b0c[_0x5d34('0x1e')]+_0x5c9b0c[_0x5d34('0x20')];var _0x3fe8db;if(_0x5ec09f>=_0x237409){_0x5ec09f=_0x237409;_0x3fe8db=0xc8;}else{_0x3fe8db=0xce;}_0x297893[_0x5d34('0x1c')](_0x3fe8db);return _0x297893[_0x5d34('0x22')](_0x5d34('0x23'),_0x25c148+'-'+_0x5ec09f+'/'+_0x237409)['json'](_0x3dea5b);}return null;};}function patchUpdates(_0x22c534){return function(_0x1b9dda){try{jsonpatch['apply'](_0x1b9dda,_0x22c534,!![]);}catch(_0x3082c0){return BPromise[_0x5d34('0x24')](_0x3082c0);}return _0x1b9dda[_0x5d34('0x25')]();};}function saveUpdates(_0x247be3,_0x561429){return function(_0x277133){if(_0x277133){return _0x277133['update'](_0x247be3)['then'](function(_0xce5afd){return _0xce5afd;});}return null;};}function removeEntity(_0x11194f,_0x3824fe){return function(_0x217634){if(_0x217634){return _0x217634[_0x5d34('0x26')]()[_0x5d34('0x27')](function(){var _0x48ca24=_0x217634['get']({'plain':!![]});var _0xef5cec='Plugins';return db[_0x5d34('0x28')]['destroy']({'where':{'type':_0xef5cec,'resourceId':_0x48ca24['id']}})['then'](function(){return _0x217634;});})['then'](function(){_0x11194f['status'](0xcc)[_0x5d34('0x1d')]();});}};}function handleEntityNotFound(_0x3f4ec1,_0x263718){return function(_0x300340){if(!_0x300340){_0x3f4ec1[_0x5d34('0x29')](0x194);}return _0x300340;};}function handleError(_0x583886,_0x519691){_0x519691=_0x519691||0x1f4;return function(_0x105373){logger['error'](_0x105373[_0x5d34('0x2a')]);if(_0x105373[_0x5d34('0x2b')]){delete _0x105373[_0x5d34('0x2b')];}_0x583886[_0x5d34('0x1c')](_0x519691)[_0x5d34('0x2c')](_0x105373);};}exports[_0x5d34('0x2d')]=function(_0xeaf0dd,_0x1798d6){var _0x191322={},_0x122f76={},_0x26c888={'count':0x0,'rows':[]};var _0x359f1e=_[_0x5d34('0x2e')](db['Plugin'][_0x5d34('0x2f')],function(_0x337a4c){return{'name':_0x337a4c[_0x5d34('0x30')],'type':_0x337a4c[_0x5d34('0x31')][_0x5d34('0x32')]};});_0x122f76[_0x5d34('0x33')]=_[_0x5d34('0x2e')](_0x359f1e,'name');_0x122f76[_0x5d34('0x34')]=_[_0x5d34('0x35')](_0xeaf0dd[_0x5d34('0x34')]);_0x122f76[_0x5d34('0x36')]=_[_0x5d34('0x37')](_0x122f76[_0x5d34('0x33')],_0x122f76[_0x5d34('0x34')]);_0x191322[_0x5d34('0x38')]=_[_0x5d34('0x37')](_0x122f76['model'],qs[_0x5d34('0x39')](_0xeaf0dd[_0x5d34('0x34')][_0x5d34('0x39')]));_0x191322[_0x5d34('0x38')]=_0x191322[_0x5d34('0x38')][_0x5d34('0x3a')]?_0x191322['attributes']:_0x122f76['model'];if(!_0xeaf0dd[_0x5d34('0x34')][_0x5d34('0x3b')]('nolimit')){_0x191322['limit']=qs[_0x5d34('0x20')](_0xeaf0dd['query'][_0x5d34('0x20')]);_0x191322[_0x5d34('0x1e')]=qs[_0x5d34('0x1e')](_0xeaf0dd[_0x5d34('0x34')][_0x5d34('0x1e')]);}_0x191322['order']=qs[_0x5d34('0x3c')](_0xeaf0dd[_0x5d34('0x34')]['sort']);_0x191322[_0x5d34('0x3d')]=qs['filters'](_[_0x5d34('0x3e')](_0xeaf0dd[_0x5d34('0x34')],_0x122f76['filters']),_0x359f1e);if(_0xeaf0dd[_0x5d34('0x34')][_0x5d34('0x3f')]){_0x191322[_0x5d34('0x3d')]=_[_0x5d34('0x40')](_0x191322[_0x5d34('0x3d')],{'$or':_[_0x5d34('0x2e')](_0x359f1e,function(_0x3d48d4){if(_0x3d48d4[_0x5d34('0x31')]!==_0x5d34('0x41')){var _0x2d6584={};_0x2d6584[_0x3d48d4[_0x5d34('0x2b')]]={'$like':'%'+_0xeaf0dd['query'][_0x5d34('0x3f')]+'%'};return _0x2d6584;}})});}_0x191322=_[_0x5d34('0x40')]({},_0x191322,_0xeaf0dd[_0x5d34('0x42')]);var _0x2d535e={'where':_0x191322[_0x5d34('0x3d')]};return db[_0x5d34('0x43')][_0x5d34('0x21')](_0x2d535e)[_0x5d34('0x27')](function(_0x61fcbf){_0x26c888[_0x5d34('0x21')]=_0x61fcbf;if(_0xeaf0dd[_0x5d34('0x34')]['includeAll']){_0x191322[_0x5d34('0x44')]=[{'all':!![]}];}return db[_0x5d34('0x43')][_0x5d34('0x45')](_0x191322);})[_0x5d34('0x27')](function(_0x587ac7){_0x26c888['rows']=_0x587ac7;return _0x26c888;})['then'](respondWithFilteredResult(_0x1798d6,_0x191322))['catch'](handleError(_0x1798d6,null));};exports[_0x5d34('0x46')]=function(_0x778553,_0x134e3c){var _0x15db17={'raw':!![],'where':{'id':_0x778553[_0x5d34('0x47')]['id']}},_0x3b6e9b={};_0x3b6e9b[_0x5d34('0x33')]=_[_0x5d34('0x35')](db['Plugin']['rawAttributes']);_0x3b6e9b['query']=_['keys'](_0x778553[_0x5d34('0x34')]);_0x3b6e9b[_0x5d34('0x36')]=_[_0x5d34('0x37')](_0x3b6e9b[_0x5d34('0x33')],_0x3b6e9b[_0x5d34('0x34')]);_0x15db17[_0x5d34('0x38')]=_[_0x5d34('0x37')](_0x3b6e9b[_0x5d34('0x33')],qs[_0x5d34('0x39')](_0x778553[_0x5d34('0x34')][_0x5d34('0x39')]));_0x15db17[_0x5d34('0x38')]=_0x15db17['attributes'][_0x5d34('0x3a')]?_0x15db17['attributes']:_0x3b6e9b[_0x5d34('0x33')];if(_0x778553['query'][_0x5d34('0x48')]){_0x15db17[_0x5d34('0x44')]=[{'all':!![]}];}_0x15db17=_[_0x5d34('0x40')]({},_0x15db17,_0x778553[_0x5d34('0x42')]);return db[_0x5d34('0x43')][_0x5d34('0x49')](_0x15db17)[_0x5d34('0x27')](handleEntityNotFound(_0x134e3c,null))['then'](respondWithResult(_0x134e3c,null))[_0x5d34('0x4a')](handleError(_0x134e3c,null));};exports[_0x5d34('0x4b')]=function(_0x26c57c,_0x9c3370,_0x83e5f8){return db[_0x5d34('0x43')][_0x5d34('0x49')]({'where':{'id':_0x26c57c[_0x5d34('0x47')]['id']},'attributes':[_0x5d34('0x2b'),_0x5d34('0x7')],'raw':!![]})[_0x5d34('0x27')](handleEntityNotFound(_0x9c3370,null))[_0x5d34('0x27')](function(_0x3eeb0a){if(_0x3eeb0a){var _0x524e7e=path['join'](config[_0x5d34('0x4c')],_0x5d34('0x4d'),util['format'](_0x5d34('0x4e'),path[_0x5d34('0x4f')](_0x3eeb0a[_0x5d34('0x7')])));var _0x2ed689=fs[_0x5d34('0x50')](_0x524e7e);var _0x5df37f=archiver('zip',{'zlib':{'level':0x9}});_0x5df37f['on']('warning',function(_0x20f3ab){if(_0x20f3ab[_0x5d34('0x51')]==='ENOENT'){logger[_0x5d34('0x52')](_0x20f3ab);}else{throw new db[(_0x5d34('0x53'))][(_0x5d34('0x54'))](_0x5d34('0x55'));}});_0x5df37f['on']('error',function(_0x1a4c52){throw new db[(_0x5d34('0x53'))][(_0x5d34('0x54'))](_0x5d34('0x55'));});_0x5df37f[_0x5d34('0x56')](_0x2ed689);_0x5df37f[_0x5d34('0x57')](_0x5d34('0x58'),{'cwd':path[_0x5d34('0x59')](config[_0x5d34('0x4c')],_0x5d34('0x4d'),path[_0x5d34('0x5a')](_0x3eeb0a['path'])),'ignore':[path['join'](path[_0x5d34('0x4f')](_0x3eeb0a['path']),_0x5d34('0x5b')),path['join'](path[_0x5d34('0x4f')](_0x3eeb0a[_0x5d34('0x7')]),_0x5d34('0x5c'))],'nodir':!![]})[_0x5d34('0x5d')]();_0x2ed689['on'](_0x5d34('0x5e'),function(){if(!fs['existsSync'](_0x524e7e)){throw new db['Sequelize'][(_0x5d34('0x54'))](_0x5d34('0x5f'));}return _0x9c3370[_0x5d34('0x4b')](_0x524e7e,util['format'](_0x5d34('0x4e'),path[_0x5d34('0x4f')](_0x3eeb0a['path'])),function(_0x5d7b30){if(_0x5d7b30){throw new db['Sequelize'][(_0x5d34('0x54'))](_0x5d34('0x60'));}fs[_0x5d34('0x61')](_0x524e7e);logger['info'](_0x5d34('0x62'));logger[_0x5d34('0x63')](_0x5d34('0x64'));});});}return null;})[_0x5d34('0x4a')](handleError(_0x9c3370,null));};exports[_0x5d34('0x65')]=function(_0x1debc6,_0x233302,_0x26fbe9){var _0x3279c3=path[_0x5d34('0x4f')](_0x1debc6[_0x5d34('0x66')][_0x5d34('0x67')],path['extname'](_0x1debc6[_0x5d34('0x66')][_0x5d34('0x67')]));var _0x396463=path[_0x5d34('0x59')](config[_0x5d34('0x4c')],_0x5d34('0x4d'),_0x1debc6[_0x5d34('0x66')][_0x5d34('0x67')]);var _0x1274cd=path[_0x5d34('0x59')](config['root'],_0x5d34('0x4d'),_0x3279c3);logger[_0x5d34('0x63')](_0x5d34('0x68'),_0x396463);logger[_0x5d34('0x63')]('Plugin\x20upload\x20destination:\x20%s',_0x1274cd);try{fs[_0x5d34('0x69')](_0x396463,parseInt('0777',0x8));extract(_0x396463,{'dir':_0x1274cd},function(_0x30e647){if(_0x30e647){logger[_0x5d34('0x52')](_0x30e647);handleError(_0x30e647,!![]);};var _0x27d322=fs[_0x5d34('0x6a')](_0x1274cd);if(_0x27d322['length']>0x1){removeReferences(_0x396463,_0x1274cd);logger['error']('Invalid\x20plugin\x20structure');return _0x26fbe9(new Error(_0x5d34('0x6b')));}var _0x5b57b4=fs[_0x5d34('0x6c')](path['join'](_0x1274cd,_0x27d322[0x0]));if(_0x5b57b4[_0x5d34('0x6d')]()){removeReferences(_0x396463,_0x1274cd);logger[_0x5d34('0x52')](_0x5d34('0x6b'));return _0x26fbe9(new Error(_0x5d34('0x6b')));}if(_0x5b57b4[_0x5d34('0x6e')]()){var _0x1eab3d=fs['readdirSync'](path['join'](_0x1274cd,_0x27d322[0x0]));if(_0x1eab3d[_0x5d34('0x3a')]===0x0){removeReferences(_0x396463,_0x1274cd);logger['error'](_0x5d34('0x6b'));return _0x26fbe9(new Error(_0x5d34('0x6b')));}var _0x2cdaa0=_0x1eab3d[_0x5d34('0x6f')](function(_0x3bc28c){return _0x3bc28c===_0x5d34('0x70');});if(!_0x2cdaa0){return _0x26fbe9(new Error(_0x5d34('0x71')));}var _0x43ff58=fs['readFileSync'](path[_0x5d34('0x59')](_0x1274cd,_0x27d322[0x0],_0x5d34('0x70')));var _0x201241=JSON[_0x5d34('0x72')](_0x43ff58);if(_0x5d34('0x1f')==typeof _0x201241[_0x5d34('0x2b')]){return _0x26fbe9(new Error('Invalid\x20manifest:\x20name\x20missing'));}if(_0x5d34('0x1f')==typeof _0x201241[_0x5d34('0x31')]){return _0x26fbe9(new Error('Invalid\x20manifest:\x20type\x20missing'));}if(_0x5d34('0x1f')==typeof _0x201241[_0x5d34('0x73')]){return _0x26fbe9(new Error(_0x5d34('0x74')));}if('undefined'==typeof _0x201241['parameters']){return _0x26fbe9(new Error(_0x5d34('0x75')));}if(_0x201241[_0x5d34('0x31')]==='html'){if('undefined'==typeof _0x201241[_0x5d34('0x76')]['views']){return _0x26fbe9(new Error(_0x5d34('0x77')));}if(_0x5d34('0x1f')==typeof _0x201241[_0x5d34('0x76')][_0x5d34('0x78')][_0x5d34('0x79')]&&_0x5d34('0x1f')==typeof _0x201241[_0x5d34('0x76')][_0x5d34('0x78')][_0x5d34('0x7a')]){return _0x26fbe9(new Error('Invalid\x20manifest:\x20no\x20view\x20specified'));}}else if(_0x201241[_0x5d34('0x31')]===_0x5d34('0x7b')){if(_0x5d34('0x1f')==typeof _0x201241['parameters']['scriptName']){return _0x26fbe9(new Error(_0x5d34('0x7c')));}if(_0x5d34('0x1f')==typeof _0x201241['parameters'][_0x5d34('0x7d')]){return _0x26fbe9(new Error(_0x5d34('0x7e')));}}else{return _0x26fbe9(new Error(_0x5d34('0x7f')));}var _0xdd6d60=_0x201241['name'];var _0x45ba0b=_0x201241[_0x5d34('0x80')];var _0x139dd8=_0x201241[_0x5d34('0x31')];var _0x321e3b=_0x201241[_0x5d34('0x81')]?_0x201241['sidebar']:_0x5d34('0x82');var _0x3122ad=_0x201241[_0x5d34('0x83')]?_0x201241[_0x5d34('0x83')]:_0x5d34('0x84');var _0x35e03='';var _0x11fd91='';var _0x5e8412='';var _0x1d071b='';var _0x329270=_0x201241['version'];if(_0x139dd8===_0x5d34('0x85')){if(_0x5d34('0x1f')!=typeof _0x201241[_0x5d34('0x76')][_0x5d34('0x78')]['admin']){var _0xcd332a=_0x201241[_0x5d34('0x76')]['views'][_0x5d34('0x79')];if(!/^(f|ht)tps?:\/\//i[_0x5d34('0x86')](_0xcd332a)){_0x35e03=path[_0x5d34('0x59')]('plugins',_0x3279c3,_0x27d322[0x0],_0xcd332a);}else{_0x35e03=_0xcd332a;}}else{logger[_0x5d34('0x63')](_0x5d34('0x87'));}if(_0x5d34('0x1f')!=typeof _0x201241[_0x5d34('0x76')][_0x5d34('0x78')][_0x5d34('0x7a')]){var _0xbd1a60=_0x201241[_0x5d34('0x76')][_0x5d34('0x78')][_0x5d34('0x7a')];if(!/^(f|ht)tps?:\/\//i[_0x5d34('0x86')](_0xbd1a60)){_0x11fd91=path[_0x5d34('0x59')]('plugins',_0x3279c3,_0x27d322[0x0],_0xbd1a60);}else{_0x11fd91=_0xbd1a60;}}else{logger[_0x5d34('0x63')](_0x5d34('0x88'));}}else if(_0x139dd8===_0x5d34('0x7b')){_0x5e8412=_0x201241[_0x5d34('0x76')][_0x5d34('0x89')];_0x1d071b=_0x201241[_0x5d34('0x76')][_0x5d34('0x7d')];if(_0x5d34('0x1f')!=typeof _0x201241[_0x5d34('0x76')][_0x5d34('0x78')]){if(_0x5d34('0x1f')!=typeof _0x201241[_0x5d34('0x76')]['views'][_0x5d34('0x79')]){var _0xcd332a=_0x201241[_0x5d34('0x76')][_0x5d34('0x78')][_0x5d34('0x79')];if(!/^(f|ht)tps?:\/\//i[_0x5d34('0x86')](_0xcd332a)){_0x35e03=path['join'](_0x5d34('0x8a'),_0x3279c3,_0x27d322[0x0],_0xcd332a);}else{_0x35e03=_0xcd332a;}}if(_0x5d34('0x1f')!=typeof _0x201241[_0x5d34('0x76')][_0x5d34('0x78')][_0x5d34('0x7a')]){var _0xbd1a60=_0x201241[_0x5d34('0x76')][_0x5d34('0x78')][_0x5d34('0x7a')];if(!/^(f|ht)tps?:\/\//i['test'](_0xbd1a60)){_0x11fd91=path['join'](_0x5d34('0x8a'),_0x3279c3,_0x27d322[0x0],_0xbd1a60);}else{_0x11fd91=_0xbd1a60;}}}}var _0x669e54={'name':_0xdd6d60,'description':_0x45ba0b,'path':path[_0x5d34('0x59')](_0x3279c3,_0x27d322[0x0]),'type':_0x139dd8,'sidebar':_0x321e3b,'icon':_0x3122ad,'adminUrl':_0x35e03,'agentUrl':_0x11fd91,'scriptName':_0x5e8412,'scriptPath':_0x1d071b,'version':_0x329270};removeReferences(_0x396463,null);return db[_0x5d34('0x43')]['create'](_0x669e54)[_0x5d34('0x27')](function(_0x2849d8){var _0x4160c6={'role':_0x1debc6[_0x5d34('0x8b')]['role'],'userProfileId':_0x1debc6[_0x5d34('0x8b')][_0x5d34('0x8c')]};if(!_0x4160c6)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4160c6[_0x5d34('0x8d')]===_0x5d34('0x8e')){var _0x3b43f4=_0x2849d8['get']({'plain':!![]});return db['UserProfileSection'][_0x5d34('0x49')]({'where':{'name':_0x5d34('0x8f'),'userProfileId':_0x4160c6[_0x5d34('0x8c')]},'raw':!![]})[_0x5d34('0x27')](function(_0x260b4b){if(_0x260b4b&&_0x260b4b[_0x5d34('0x90')]===0x0){return db[_0x5d34('0x28')][_0x5d34('0x91')]({'name':_0x3b43f4['name'],'resourceId':_0x3b43f4['id'],'type':_0x260b4b[_0x5d34('0x2b')],'sectionId':_0x260b4b['id']},{})['then'](function(){return _0x2849d8;});}else{return _0x2849d8;}})['catch'](function(_0x59950d){logger[_0x5d34('0x52')](_0x5d34('0x92'),_0x59950d);throw _0x59950d;});}return _0x2849d8;})[_0x5d34('0x27')](respondWithResult(_0x233302,null))[_0x5d34('0x4a')](handleError(_0x233302,null));}});}catch(_0x365f13){_0x233302[_0x5d34('0x1c')](0x1f4)[_0x5d34('0x2c')](_0x365f13);}};function removeReferences(_0x548591,_0x5700d6){try{if(_0x548591){fs[_0x5d34('0x61')](_0x548591);logger[_0x5d34('0x63')](_0x5d34('0x93'));}if(_0x5700d6){rimraf(_0x5700d6,function(){});logger[_0x5d34('0x63')](_0x5d34('0x94'));}}catch(_0x5a9c30){logger[_0x5d34('0x52')](_0x5a9c30);}}exports[_0x5d34('0x95')]=function(_0x41e6c8,_0x1d9df9,_0x1d72bd){return db[_0x5d34('0x43')]['find']({'where':{'id':_0x41e6c8[_0x5d34('0x47')]['id']}})['then'](handleEntityNotFound(_0x1d9df9,null))[_0x5d34('0x27')](saveUpdates(_0x41e6c8[_0x5d34('0x8b')],null))[_0x5d34('0x27')](respondWithResult(_0x1d9df9,null))['catch'](handleError(_0x1d9df9,null));};exports[_0x5d34('0x96')]=function(_0x212303,_0x7ad32b,_0x3ae242){return db[_0x5d34('0x43')][_0x5d34('0x49')]({'where':{'id':_0x212303[_0x5d34('0x47')]['id']}})[_0x5d34('0x27')](function(_0x23cb50){if(_0x23cb50){return _0x23cb50[_0x5d34('0x26')]();}})[_0x5d34('0x27')](function(_0x5215d7){rimraf(path['join'](config[_0x5d34('0x4c')],_0x5d34('0x4d'),path[_0x5d34('0x5a')](_0x5215d7[_0x5d34('0x7')])),function(){});return _0x5215d7;})['then'](handleEntityNotFound(_0x7ad32b,null))[_0x5d34('0x27')](respondWithStatusCode(_0x7ad32b,null))[_0x5d34('0x4a')](handleError(_0x7ad32b,null));};exports[_0x5d34('0x97')]=function(_0x1187f4,_0x299e80,_0x4d21e8){return BPromise['resolve']()[_0x5d34('0x27')](function(){if(!_0x1187f4[_0x5d34('0x34')]['path']){throw new Error(_0x5d34('0x98'));}if(!_0x1187f4[_0x5d34('0x34')][_0x5d34('0x99')]){throw new Error(_0x5d34('0x9a'));}var _0x1e8cb8=_0x1187f4[_0x5d34('0x34')]['hostname']?_0x1187f4['query'][_0x5d34('0x9b')]+':'+_0x1187f4[_0x5d34('0x34')][_0x5d34('0x99')]:'http://localhost:'+_0x1187f4[_0x5d34('0x34')][_0x5d34('0x99')];var _0x5cc3db=_0x1187f4['query'][_0x5d34('0x9c')]?_0x1187f4[_0x5d34('0x34')][_0x5d34('0x9c')]:!![];var _0x715720=_0x1187f4[_0x5d34('0x34')][_0x5d34('0x9d')]?_0x1187f4[_0x5d34('0x34')][_0x5d34('0x9d')]:null;var _0x5d2349={'method':_0x1187f4[_0x5d34('0x9e')],'uri':util[_0x5d34('0x9f')]('%s%s',_0x1e8cb8,_0x1187f4['query']['path']),'json':_0x5cc3db,'resolveWithFullResponse':!![],'encoding':_0x715720,'qs':_0x1187f4[_0x5d34('0x34')]};if(_0x1187f4[_0x5d34('0xa0')]){_0x5d2349[_0x5d34('0xa0')]=_0x1187f4[_0x5d34('0xa0')];if(_0x5d2349[_0x5d34('0xa0')][_0x5d34('0xa1')]){delete _0x5d2349[_0x5d34('0xa0')][_0x5d34('0xa1')];}}if(_0x5d2349['headers']['content-type']){delete _0x5d2349[_0x5d34('0xa0')][_0x5d34('0xa2')];}return rp(_0x5d2349);})['then'](function(_0x730039){if(_0x730039){_0x299e80[_0x5d34('0x22')](_0x730039[_0x5d34('0xa0')]);logger['info'](_0x730039[_0x5d34('0x8b')]);if(_[_0x5d34('0xa3')](_0x1187f4['query'][_0x5d34('0x7')],_0x5d34('0x4b'))&&_0x730039[_0x5d34('0xa4')]==0x1f4){return _0x299e80[_0x5d34('0x29')](_0x730039[_0x5d34('0xa4')]);}else{return _0x299e80[_0x5d34('0x1c')](_0x730039[_0x5d34('0xa4')])['send'](_0x730039['body']);}}else{return _0x299e80[_0x5d34('0x29')](0xc8);}})[_0x5d34('0x4a')](handleError(_0x299e80,null));};exports['webhookPost']=function(_0x15d28b,_0x387a24,_0x3d6afd){return BPromise[_0x5d34('0xa5')]()[_0x5d34('0x27')](function(){if(!_0x15d28b[_0x5d34('0x34')][_0x5d34('0x7')]){throw new Error(_0x5d34('0x98'));}if(!_0x15d28b[_0x5d34('0x34')]['port']){throw new Error(_0x5d34('0x9a'));}var _0x3bf3a2=_0x15d28b[_0x5d34('0x34')][_0x5d34('0x9b')]?_0x15d28b[_0x5d34('0x34')][_0x5d34('0x9b')]+':'+_0x15d28b[_0x5d34('0x34')][_0x5d34('0x99')]:_0x5d34('0xa6')+_0x15d28b['query'][_0x5d34('0x99')];var _0x51cf39=_0x15d28b[_0x5d34('0x34')][_0x5d34('0x9c')]?_0x15d28b[_0x5d34('0x34')][_0x5d34('0x9c')]:!![];var _0x49e9d3=_0x15d28b[_0x5d34('0x34')][_0x5d34('0x9d')]?_0x15d28b[_0x5d34('0x34')][_0x5d34('0x9d')]:null;var _0xd5fcac={'method':_0x15d28b[_0x5d34('0x9e')],'uri':util[_0x5d34('0x9f')](_0x5d34('0xa7'),_0x3bf3a2,_0x15d28b[_0x5d34('0x34')][_0x5d34('0x7')]),'json':_0x51cf39,'resolveWithFullResponse':!![],'encoding':_0x49e9d3,'body':_0x15d28b[_0x5d34('0x8b')]};if(_0x15d28b['headers']){_0xd5fcac['headers']=_0x15d28b[_0x5d34('0xa0')];if(_0xd5fcac['headers']['content-length']){delete _0xd5fcac['headers'][_0x5d34('0xa1')];}}if(_0xd5fcac[_0x5d34('0xa0')]['content-type']){delete _0xd5fcac[_0x5d34('0xa0')][_0x5d34('0xa2')];}return rp(_0xd5fcac);})[_0x5d34('0x27')](function(_0x313e75){if(_0x313e75){_0x387a24['set'](_0x313e75[_0x5d34('0xa0')]);logger['info'](_0x313e75[_0x5d34('0x8b')]);return _0x387a24['status'](_0x313e75[_0x5d34('0xa4')])['send'](_0x313e75[_0x5d34('0x8b')]);}else{return _0x387a24[_0x5d34('0x29')](0xc8);}})[_0x5d34('0x4a')](handleError(_0x387a24,null));}; \ No newline at end of file +var _0x8c9c=['sendStatus','end','status','offset','undefined','limit','count','set','json','apply','reject','save','update','then','destroy','get','UserProfileResource','error','stack','name','send','map','Plugin','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','sort','filter','where','merge','options','includeAll','include','findAll','rows','catch','find','join','root','server/files/plugins','format','%s.zip','basename','createWriteStream','warning','ENOENT','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','glob','**/*','dirname','node_modules/**/*','attachments/**/*','finalize','close','existsSync','Plugin\x20not\x20found','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','info','Download\x20completed','Temporary\x20file\x20removed','file','extname','filename','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','chmodSync','0777','readdirSync','Invalid\x20plugin\x20structure','lstatSync','isFile','isDirectory','manifest.json','Plugin\x20manifest\x20missing','readFileSync','parse','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','Invalid\x20manifest:\x20parameters\x20missing','parameters','views','Invalid\x20manifest:\x20views\x20missing','admin','agent','script','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','always','icon','test','plugins','Warning:\x20admin\x20view\x20not\x20specified','Warning:\x20agent\x20view\x20not\x20specified','create','role','body','userProfileId','user','Plugins','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Extracted\x20folder\x20removed','params','delete','webhookGet','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','http://localhost:','encoding','method','%s%s','headers','content-length','content-type','endsWith','download','statusCode','webhookPost','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','extract-zip','rimraf','archiver','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter'];(function(_0x37a9d7,_0x2b6fde){var _0x1343d3=function(_0x3bde45){while(--_0x3bde45){_0x37a9d7['push'](_0x37a9d7['shift']());}};_0x1343d3(++_0x2b6fde);}(_0x8c9c,0x136));var _0xc8c9=function(_0x8a0dfe,_0x25015a){_0x8a0dfe=_0x8a0dfe-0x0;var _0x134296=_0x8c9c[_0x8a0dfe];return _0x134296;};'use strict';var emlformat=require(_0xc8c9('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc8c9('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc8c9('0x2'));var moment=require(_0xc8c9('0x3'));var BPromise=require(_0xc8c9('0x4'));var Mustache=require(_0xc8c9('0x5'));var util=require(_0xc8c9('0x6'));var path=require(_0xc8c9('0x7'));var sox=require('sox');var csv=require(_0xc8c9('0x8'));var ejs=require(_0xc8c9('0x9'));var fs=require('fs');var fs_extra=require(_0xc8c9('0xa'));var _=require('lodash');var squel=require(_0xc8c9('0xb'));var crypto=require(_0xc8c9('0xc'));var jsforce=require(_0xc8c9('0xd'));var deskjs=require(_0xc8c9('0xe'));var toCsv=require('to-csv');var querystring=require(_0xc8c9('0xf'));var Papa=require(_0xc8c9('0x10'));var extract=require(_0xc8c9('0x11'));var rimraf=require(_0xc8c9('0x12'));var archiver=require(_0xc8c9('0x13'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xc8c9('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xc8c9('0x15'))(_0xc8c9('0x16'));var utils=require(_0xc8c9('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xc8c9('0x18'));var db=require(_0xc8c9('0x19'))['db'];config[_0xc8c9('0x1a')]=_[_0xc8c9('0x1b')](config['redis'],{'host':_0xc8c9('0x1c'),'port':0x18eb});var socket=require(_0xc8c9('0x1d'))(new Redis(config[_0xc8c9('0x1a')]));require('./plugin.socket')['register'](socket);function respondWithStatusCode(_0x48d419,_0x1b178d){_0x1b178d=_0x1b178d||0xcc;return function(_0x1b031e){if(_0x1b031e){return _0x48d419[_0xc8c9('0x1e')](_0x1b178d);}return _0x48d419['status'](_0x1b178d)[_0xc8c9('0x1f')]();};}function respondWithResult(_0x167704,_0x55a4a7){_0x55a4a7=_0x55a4a7||0xc8;return function(_0x4f9600){if(_0x4f9600){return _0x167704[_0xc8c9('0x20')](_0x55a4a7)['json'](_0x4f9600);}};}function respondWithFilteredResult(_0x490b95,_0x2b1ed5){return function(_0x1469d9){if(_0x1469d9){var _0x29f42a=typeof _0x2b1ed5[_0xc8c9('0x21')]===_0xc8c9('0x22')&&typeof _0x2b1ed5[_0xc8c9('0x23')]===_0xc8c9('0x22');var _0x105a58=_0x1469d9[_0xc8c9('0x24')];var _0x1c95bf=_0x29f42a?0x0:_0x2b1ed5[_0xc8c9('0x21')];var _0x4ef6ab=_0x29f42a?_0x1469d9[_0xc8c9('0x24')]:_0x2b1ed5[_0xc8c9('0x21')]+_0x2b1ed5[_0xc8c9('0x23')];var _0x3d1b7c;if(_0x4ef6ab>=_0x105a58){_0x4ef6ab=_0x105a58;_0x3d1b7c=0xc8;}else{_0x3d1b7c=0xce;}_0x490b95[_0xc8c9('0x20')](_0x3d1b7c);return _0x490b95[_0xc8c9('0x25')]('Content-Range',_0x1c95bf+'-'+_0x4ef6ab+'/'+_0x105a58)[_0xc8c9('0x26')](_0x1469d9);}return null;};}function patchUpdates(_0x4605fb){return function(_0x584459){try{jsonpatch[_0xc8c9('0x27')](_0x584459,_0x4605fb,!![]);}catch(_0x1ba51b){return BPromise[_0xc8c9('0x28')](_0x1ba51b);}return _0x584459[_0xc8c9('0x29')]();};}function saveUpdates(_0x1d0407,_0x25ce27){return function(_0x1e9867){if(_0x1e9867){return _0x1e9867[_0xc8c9('0x2a')](_0x1d0407)[_0xc8c9('0x2b')](function(_0x5d9461){return _0x5d9461;});}return null;};}function removeEntity(_0x46720a,_0x1d40ea){return function(_0x4887cf){if(_0x4887cf){return _0x4887cf[_0xc8c9('0x2c')]()['then'](function(){var _0x933134=_0x4887cf[_0xc8c9('0x2d')]({'plain':!![]});var _0x37cf12='Plugins';return db[_0xc8c9('0x2e')][_0xc8c9('0x2c')]({'where':{'type':_0x37cf12,'resourceId':_0x933134['id']}})[_0xc8c9('0x2b')](function(){return _0x4887cf;});})[_0xc8c9('0x2b')](function(){_0x46720a[_0xc8c9('0x20')](0xcc)[_0xc8c9('0x1f')]();});}};}function handleEntityNotFound(_0x5b0fd3,_0xa08b71){return function(_0x26c660){if(!_0x26c660){_0x5b0fd3[_0xc8c9('0x1e')](0x194);}return _0x26c660;};}function handleError(_0x26478a,_0x272b57){_0x272b57=_0x272b57||0x1f4;return function(_0xa2c4f1){logger[_0xc8c9('0x2f')](_0xa2c4f1[_0xc8c9('0x30')]);if(_0xa2c4f1[_0xc8c9('0x31')]){delete _0xa2c4f1[_0xc8c9('0x31')];}_0x26478a['status'](_0x272b57)[_0xc8c9('0x32')](_0xa2c4f1);};}exports['index']=function(_0x4bb793,_0x49bac6){var _0x2cae39={},_0x5cd531={},_0x4bce9a={'count':0x0,'rows':[]};var _0x467048=_[_0xc8c9('0x33')](db[_0xc8c9('0x34')][_0xc8c9('0x35')],function(_0x4ce26b){return{'name':_0x4ce26b['fieldName'],'type':_0x4ce26b[_0xc8c9('0x36')][_0xc8c9('0x37')]};});_0x5cd531[_0xc8c9('0x38')]=_[_0xc8c9('0x33')](_0x467048,_0xc8c9('0x31'));_0x5cd531[_0xc8c9('0x39')]=_[_0xc8c9('0x3a')](_0x4bb793[_0xc8c9('0x39')]);_0x5cd531[_0xc8c9('0x3b')]=_['intersection'](_0x5cd531[_0xc8c9('0x38')],_0x5cd531[_0xc8c9('0x39')]);_0x2cae39['attributes']=_[_0xc8c9('0x3c')](_0x5cd531[_0xc8c9('0x38')],qs[_0xc8c9('0x3d')](_0x4bb793[_0xc8c9('0x39')][_0xc8c9('0x3d')]));_0x2cae39[_0xc8c9('0x3e')]=_0x2cae39[_0xc8c9('0x3e')][_0xc8c9('0x3f')]?_0x2cae39['attributes']:_0x5cd531[_0xc8c9('0x38')];if(!_0x4bb793['query']['hasOwnProperty'](_0xc8c9('0x40'))){_0x2cae39[_0xc8c9('0x23')]=qs[_0xc8c9('0x23')](_0x4bb793['query'][_0xc8c9('0x23')]);_0x2cae39[_0xc8c9('0x21')]=qs[_0xc8c9('0x21')](_0x4bb793[_0xc8c9('0x39')][_0xc8c9('0x21')]);}_0x2cae39['order']=qs['sort'](_0x4bb793[_0xc8c9('0x39')][_0xc8c9('0x41')]);_0x2cae39['where']=qs['filters'](_['pick'](_0x4bb793['query'],_0x5cd531[_0xc8c9('0x3b')]),_0x467048);if(_0x4bb793[_0xc8c9('0x39')][_0xc8c9('0x42')]){_0x2cae39[_0xc8c9('0x43')]=_[_0xc8c9('0x44')](_0x2cae39[_0xc8c9('0x43')],{'$or':_[_0xc8c9('0x33')](_0x467048,function(_0x3e4ef9){if(_0x3e4ef9[_0xc8c9('0x36')]!=='VIRTUAL'){var _0x2c0145={};_0x2c0145[_0x3e4ef9[_0xc8c9('0x31')]]={'$like':'%'+_0x4bb793[_0xc8c9('0x39')][_0xc8c9('0x42')]+'%'};return _0x2c0145;}})});}_0x2cae39=_['merge']({},_0x2cae39,_0x4bb793[_0xc8c9('0x45')]);var _0x5d8edc={'where':_0x2cae39[_0xc8c9('0x43')]};return db[_0xc8c9('0x34')][_0xc8c9('0x24')](_0x5d8edc)[_0xc8c9('0x2b')](function(_0xaee9ec){_0x4bce9a['count']=_0xaee9ec;if(_0x4bb793[_0xc8c9('0x39')][_0xc8c9('0x46')]){_0x2cae39[_0xc8c9('0x47')]=[{'all':!![]}];}return db[_0xc8c9('0x34')][_0xc8c9('0x48')](_0x2cae39);})[_0xc8c9('0x2b')](function(_0xb91bfa){_0x4bce9a[_0xc8c9('0x49')]=_0xb91bfa;return _0x4bce9a;})['then'](respondWithFilteredResult(_0x49bac6,_0x2cae39))[_0xc8c9('0x4a')](handleError(_0x49bac6,null));};exports['show']=function(_0x3845c9,_0x110b75){var _0x23c612={'raw':!![],'where':{'id':_0x3845c9['params']['id']}},_0x5e09ea={};_0x5e09ea[_0xc8c9('0x38')]=_[_0xc8c9('0x3a')](db['Plugin']['rawAttributes']);_0x5e09ea[_0xc8c9('0x39')]=_['keys'](_0x3845c9['query']);_0x5e09ea[_0xc8c9('0x3b')]=_[_0xc8c9('0x3c')](_0x5e09ea[_0xc8c9('0x38')],_0x5e09ea[_0xc8c9('0x39')]);_0x23c612[_0xc8c9('0x3e')]=_['intersection'](_0x5e09ea['model'],qs[_0xc8c9('0x3d')](_0x3845c9[_0xc8c9('0x39')][_0xc8c9('0x3d')]));_0x23c612[_0xc8c9('0x3e')]=_0x23c612[_0xc8c9('0x3e')][_0xc8c9('0x3f')]?_0x23c612[_0xc8c9('0x3e')]:_0x5e09ea[_0xc8c9('0x38')];if(_0x3845c9[_0xc8c9('0x39')][_0xc8c9('0x46')]){_0x23c612[_0xc8c9('0x47')]=[{'all':!![]}];}_0x23c612=_[_0xc8c9('0x44')]({},_0x23c612,_0x3845c9[_0xc8c9('0x45')]);return db[_0xc8c9('0x34')][_0xc8c9('0x4b')](_0x23c612)['then'](handleEntityNotFound(_0x110b75,null))['then'](respondWithResult(_0x110b75,null))['catch'](handleError(_0x110b75,null));};exports['download']=function(_0x3eba49,_0x33ec18,_0x5e9c97){return db[_0xc8c9('0x34')]['find']({'where':{'id':_0x3eba49['params']['id']},'attributes':[_0xc8c9('0x31'),_0xc8c9('0x7')],'raw':!![]})['then'](handleEntityNotFound(_0x33ec18,null))['then'](function(_0x50083c){if(_0x50083c){var _0x3c4612=path[_0xc8c9('0x4c')](config[_0xc8c9('0x4d')],_0xc8c9('0x4e'),util[_0xc8c9('0x4f')](_0xc8c9('0x50'),path[_0xc8c9('0x51')](_0x50083c[_0xc8c9('0x7')])));var _0x4489c8=fs[_0xc8c9('0x52')](_0x3c4612);var _0x77293b=archiver('zip',{'zlib':{'level':0x9}});_0x77293b['on'](_0xc8c9('0x53'),function(_0x5100d6){if(_0x5100d6['code']===_0xc8c9('0x54')){logger[_0xc8c9('0x2f')](_0x5100d6);}else{throw new db[(_0xc8c9('0x55'))][(_0xc8c9('0x56'))](_0xc8c9('0x57'));}});_0x77293b['on'](_0xc8c9('0x2f'),function(_0x1f1ac3){throw new db[(_0xc8c9('0x55'))]['Error'](_0xc8c9('0x57'));});_0x77293b['pipe'](_0x4489c8);_0x77293b[_0xc8c9('0x58')](_0xc8c9('0x59'),{'cwd':path['join'](config[_0xc8c9('0x4d')],'server/files/plugins',path[_0xc8c9('0x5a')](_0x50083c[_0xc8c9('0x7')])),'ignore':[path[_0xc8c9('0x4c')](path[_0xc8c9('0x51')](_0x50083c[_0xc8c9('0x7')]),_0xc8c9('0x5b')),path[_0xc8c9('0x4c')](path['basename'](_0x50083c[_0xc8c9('0x7')]),_0xc8c9('0x5c'))],'nodir':!![]})[_0xc8c9('0x5d')]();_0x4489c8['on'](_0xc8c9('0x5e'),function(){if(!fs[_0xc8c9('0x5f')](_0x3c4612)){throw new db[(_0xc8c9('0x55'))][(_0xc8c9('0x56'))](_0xc8c9('0x60'));}return _0x33ec18['download'](_0x3c4612,util[_0xc8c9('0x4f')](_0xc8c9('0x50'),path['basename'](_0x50083c['path'])),function(_0x11bfd7){if(_0x11bfd7){throw new db['Sequelize'][(_0xc8c9('0x56'))](_0xc8c9('0x61'));}fs[_0xc8c9('0x62')](_0x3c4612);logger[_0xc8c9('0x63')](_0xc8c9('0x64'));logger[_0xc8c9('0x63')](_0xc8c9('0x65'));});});}return null;})[_0xc8c9('0x4a')](handleError(_0x33ec18,null));};exports['upload']=function(_0x25378d,_0x274c5f,_0x34e77c){var _0x13adc0=path[_0xc8c9('0x51')](_0x25378d[_0xc8c9('0x66')]['filename'],path[_0xc8c9('0x67')](_0x25378d[_0xc8c9('0x66')][_0xc8c9('0x68')]));var _0x5e1871=path['join'](config['root'],_0xc8c9('0x4e'),_0x25378d['file'][_0xc8c9('0x68')]);var _0x5591d5=path['join'](config[_0xc8c9('0x4d')],'server/files/plugins',_0x13adc0);logger[_0xc8c9('0x63')](_0xc8c9('0x69'),_0x5e1871);logger['info'](_0xc8c9('0x6a'),_0x5591d5);try{fs[_0xc8c9('0x6b')](_0x5e1871,parseInt(_0xc8c9('0x6c'),0x8));extract(_0x5e1871,{'dir':_0x5591d5},function(_0x1efe2b){if(_0x1efe2b){logger['error'](_0x1efe2b);handleError(_0x1efe2b,!![]);};var _0xa8765f=fs[_0xc8c9('0x6d')](_0x5591d5);if(_0xa8765f[_0xc8c9('0x3f')]>0x1){removeReferences(_0x5e1871,_0x5591d5);logger['error']('Invalid\x20plugin\x20structure');return _0x34e77c(new Error(_0xc8c9('0x6e')));}var _0x512d67=fs[_0xc8c9('0x6f')](path[_0xc8c9('0x4c')](_0x5591d5,_0xa8765f[0x0]));if(_0x512d67[_0xc8c9('0x70')]()){removeReferences(_0x5e1871,_0x5591d5);logger[_0xc8c9('0x2f')](_0xc8c9('0x6e'));return _0x34e77c(new Error(_0xc8c9('0x6e')));}if(_0x512d67[_0xc8c9('0x71')]()){var _0x252a6e=fs[_0xc8c9('0x6d')](path[_0xc8c9('0x4c')](_0x5591d5,_0xa8765f[0x0]));if(_0x252a6e[_0xc8c9('0x3f')]===0x0){removeReferences(_0x5e1871,_0x5591d5);logger['error'](_0xc8c9('0x6e'));return _0x34e77c(new Error('Invalid\x20plugin\x20structure'));}var _0x31c796=_0x252a6e['some'](function(_0xec34b6){return _0xec34b6===_0xc8c9('0x72');});if(!_0x31c796){return _0x34e77c(new Error(_0xc8c9('0x73')));}var _0x302039=fs[_0xc8c9('0x74')](path[_0xc8c9('0x4c')](_0x5591d5,_0xa8765f[0x0],_0xc8c9('0x72')));var _0x4685d1=JSON[_0xc8c9('0x75')](_0x302039);if(_0xc8c9('0x22')==typeof _0x4685d1[_0xc8c9('0x31')]){return _0x34e77c(new Error(_0xc8c9('0x76')));}if(_0xc8c9('0x22')==typeof _0x4685d1['type']){return _0x34e77c(new Error(_0xc8c9('0x77')));}if(_0xc8c9('0x22')==typeof _0x4685d1[_0xc8c9('0x78')]){return _0x34e77c(new Error(_0xc8c9('0x79')));}if(_0xc8c9('0x22')==typeof _0x4685d1['parameters']){return _0x34e77c(new Error(_0xc8c9('0x7a')));}if(_0x4685d1[_0xc8c9('0x36')]==='html'){if(_0xc8c9('0x22')==typeof _0x4685d1[_0xc8c9('0x7b')][_0xc8c9('0x7c')]){return _0x34e77c(new Error(_0xc8c9('0x7d')));}if(_0xc8c9('0x22')==typeof _0x4685d1['parameters'][_0xc8c9('0x7c')][_0xc8c9('0x7e')]&&'undefined'==typeof _0x4685d1[_0xc8c9('0x7b')]['views'][_0xc8c9('0x7f')]){return _0x34e77c(new Error('Invalid\x20manifest:\x20no\x20view\x20specified'));}}else if(_0x4685d1[_0xc8c9('0x36')]===_0xc8c9('0x80')){if(_0xc8c9('0x22')==typeof _0x4685d1['parameters'][_0xc8c9('0x81')]){return _0x34e77c(new Error(_0xc8c9('0x82')));}if(_0xc8c9('0x22')==typeof _0x4685d1[_0xc8c9('0x7b')][_0xc8c9('0x83')]){return _0x34e77c(new Error(_0xc8c9('0x84')));}}else{return _0x34e77c(new Error(_0xc8c9('0x85')));}var _0x3e9b9d=_0x4685d1[_0xc8c9('0x31')];var _0x594efc=_0x4685d1[_0xc8c9('0x86')];var _0x4e888b=_0x4685d1[_0xc8c9('0x36')];var _0x534386=_0x4685d1[_0xc8c9('0x87')]?_0x4685d1['sidebar']:_0xc8c9('0x88');var _0x46f237=_0x4685d1[_0xc8c9('0x89')]?_0x4685d1[_0xc8c9('0x89')]:'icon-apps';var _0x572833='';var _0x4f3b29='';var _0x4b2b93='';var _0x4c0501='';var _0x1831d6=_0x4685d1[_0xc8c9('0x78')];if(_0x4e888b==='html'){if(_0xc8c9('0x22')!=typeof _0x4685d1[_0xc8c9('0x7b')]['views'][_0xc8c9('0x7e')]){var _0x258e34=_0x4685d1[_0xc8c9('0x7b')][_0xc8c9('0x7c')][_0xc8c9('0x7e')];if(!/^(f|ht)tps?:\/\//i[_0xc8c9('0x8a')](_0x258e34)){_0x572833=path['join'](_0xc8c9('0x8b'),_0x13adc0,_0xa8765f[0x0],_0x258e34);}else{_0x572833=_0x258e34;}}else{logger['info'](_0xc8c9('0x8c'));}if('undefined'!=typeof _0x4685d1[_0xc8c9('0x7b')][_0xc8c9('0x7c')][_0xc8c9('0x7f')]){var _0x269ae3=_0x4685d1['parameters'][_0xc8c9('0x7c')][_0xc8c9('0x7f')];if(!/^(f|ht)tps?:\/\//i[_0xc8c9('0x8a')](_0x269ae3)){_0x4f3b29=path[_0xc8c9('0x4c')](_0xc8c9('0x8b'),_0x13adc0,_0xa8765f[0x0],_0x269ae3);}else{_0x4f3b29=_0x269ae3;}}else{logger[_0xc8c9('0x63')](_0xc8c9('0x8d'));}}else if(_0x4e888b===_0xc8c9('0x80')){_0x4b2b93=_0x4685d1[_0xc8c9('0x7b')][_0xc8c9('0x81')];_0x4c0501=_0x4685d1['parameters'][_0xc8c9('0x83')];if('undefined'!=typeof _0x4685d1['parameters']['views']){if(_0xc8c9('0x22')!=typeof _0x4685d1[_0xc8c9('0x7b')][_0xc8c9('0x7c')]['admin']){var _0x258e34=_0x4685d1[_0xc8c9('0x7b')][_0xc8c9('0x7c')][_0xc8c9('0x7e')];if(!/^(f|ht)tps?:\/\//i[_0xc8c9('0x8a')](_0x258e34)){_0x572833=path[_0xc8c9('0x4c')](_0xc8c9('0x8b'),_0x13adc0,_0xa8765f[0x0],_0x258e34);}else{_0x572833=_0x258e34;}}if('undefined'!=typeof _0x4685d1[_0xc8c9('0x7b')][_0xc8c9('0x7c')]['agent']){var _0x269ae3=_0x4685d1[_0xc8c9('0x7b')][_0xc8c9('0x7c')]['agent'];if(!/^(f|ht)tps?:\/\//i[_0xc8c9('0x8a')](_0x269ae3)){_0x4f3b29=path[_0xc8c9('0x4c')](_0xc8c9('0x8b'),_0x13adc0,_0xa8765f[0x0],_0x269ae3);}else{_0x4f3b29=_0x269ae3;}}}}var _0x309ccc={'name':_0x3e9b9d,'description':_0x594efc,'path':path[_0xc8c9('0x4c')](_0x13adc0,_0xa8765f[0x0]),'type':_0x4e888b,'sidebar':_0x534386,'icon':_0x46f237,'adminUrl':_0x572833,'agentUrl':_0x4f3b29,'scriptName':_0x4b2b93,'scriptPath':_0x4c0501,'version':_0x1831d6};removeReferences(_0x5e1871,null);return db[_0xc8c9('0x34')][_0xc8c9('0x8e')](_0x309ccc)[_0xc8c9('0x2b')](function(_0x12daed){var _0x3489b2={'role':_0x25378d['body'][_0xc8c9('0x8f')],'userProfileId':_0x25378d[_0xc8c9('0x90')][_0xc8c9('0x91')]};if(!_0x3489b2)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3489b2[_0xc8c9('0x8f')]===_0xc8c9('0x92')){var _0xf24161=_0x12daed[_0xc8c9('0x2d')]({'plain':!![]});return db['UserProfileSection'][_0xc8c9('0x4b')]({'where':{'name':_0xc8c9('0x93'),'userProfileId':_0x3489b2['userProfileId']},'raw':!![]})[_0xc8c9('0x2b')](function(_0x28a31d){if(_0x28a31d&&_0x28a31d[_0xc8c9('0x94')]===0x0){return db[_0xc8c9('0x2e')][_0xc8c9('0x8e')]({'name':_0xf24161[_0xc8c9('0x31')],'resourceId':_0xf24161['id'],'type':_0x28a31d['name'],'sectionId':_0x28a31d['id']},{})['then'](function(){return _0x12daed;});}else{return _0x12daed;}})['catch'](function(_0x466c8d){logger[_0xc8c9('0x2f')](_0xc8c9('0x95'),_0x466c8d);throw _0x466c8d;});}return _0x12daed;})[_0xc8c9('0x2b')](respondWithResult(_0x274c5f,null))[_0xc8c9('0x4a')](handleError(_0x274c5f,null));}});}catch(_0x5d2934){_0x274c5f[_0xc8c9('0x20')](0x1f4)[_0xc8c9('0x32')](_0x5d2934);}};function removeReferences(_0x815b4b,_0x1ea471){try{if(_0x815b4b){fs[_0xc8c9('0x62')](_0x815b4b);logger[_0xc8c9('0x63')]('Zip\x20archive\x20removed');}if(_0x1ea471){rimraf(_0x1ea471,function(){});logger[_0xc8c9('0x63')](_0xc8c9('0x96'));}}catch(_0x590aeb){logger[_0xc8c9('0x2f')](_0x590aeb);}}exports[_0xc8c9('0x2a')]=function(_0x592af1,_0x531cfe,_0x4c2139){return db[_0xc8c9('0x34')][_0xc8c9('0x4b')]({'where':{'id':_0x592af1[_0xc8c9('0x97')]['id']}})[_0xc8c9('0x2b')](handleEntityNotFound(_0x531cfe,null))[_0xc8c9('0x2b')](saveUpdates(_0x592af1[_0xc8c9('0x90')],null))[_0xc8c9('0x2b')](respondWithResult(_0x531cfe,null))[_0xc8c9('0x4a')](handleError(_0x531cfe,null));};exports[_0xc8c9('0x98')]=function(_0x2a3442,_0x1cc3db,_0x135f23){return db['Plugin'][_0xc8c9('0x4b')]({'where':{'id':_0x2a3442['params']['id']}})[_0xc8c9('0x2b')](function(_0x4b56af){if(_0x4b56af){return _0x4b56af['destroy']();}})['then'](function(_0x11e075){rimraf(path[_0xc8c9('0x4c')](config[_0xc8c9('0x4d')],'server/files/plugins',path[_0xc8c9('0x5a')](_0x11e075[_0xc8c9('0x7')])),function(){});return _0x11e075;})[_0xc8c9('0x2b')](handleEntityNotFound(_0x1cc3db,null))[_0xc8c9('0x2b')](respondWithStatusCode(_0x1cc3db,null))['catch'](handleError(_0x1cc3db,null));};exports[_0xc8c9('0x99')]=function(_0x257a3d,_0x3de673,_0x1b2943){return BPromise[_0xc8c9('0x9a')]()['then'](function(){if(!_0x257a3d[_0xc8c9('0x39')]['path']){throw new Error(_0xc8c9('0x9b'));}if(!_0x257a3d[_0xc8c9('0x39')][_0xc8c9('0x9c')]){throw new Error(_0xc8c9('0x9d'));}var _0x3256fc=_0x257a3d['query'][_0xc8c9('0x9e')]?_0x257a3d[_0xc8c9('0x39')][_0xc8c9('0x9e')]+':'+_0x257a3d[_0xc8c9('0x39')][_0xc8c9('0x9c')]:_0xc8c9('0x9f')+_0x257a3d['query']['port'];var _0x44e9a7=_0x257a3d[_0xc8c9('0x39')][_0xc8c9('0x26')]?_0x257a3d[_0xc8c9('0x39')]['json']:!![];var _0xc44200=_0x257a3d['query'][_0xc8c9('0xa0')]?_0x257a3d[_0xc8c9('0x39')]['encoding']:null;var _0x53e323={'method':_0x257a3d[_0xc8c9('0xa1')],'uri':util[_0xc8c9('0x4f')](_0xc8c9('0xa2'),_0x3256fc,_0x257a3d[_0xc8c9('0x39')][_0xc8c9('0x7')]),'json':_0x44e9a7,'resolveWithFullResponse':!![],'encoding':_0xc44200,'qs':_0x257a3d['query']};if(_0x257a3d[_0xc8c9('0xa3')]){_0x53e323['headers']=_0x257a3d[_0xc8c9('0xa3')];if(_0x53e323[_0xc8c9('0xa3')][_0xc8c9('0xa4')]){delete _0x53e323[_0xc8c9('0xa3')][_0xc8c9('0xa4')];}}if(_0x53e323[_0xc8c9('0xa3')][_0xc8c9('0xa5')]){delete _0x53e323[_0xc8c9('0xa3')][_0xc8c9('0xa5')];}return rp(_0x53e323);})[_0xc8c9('0x2b')](function(_0x26cd61){if(_0x26cd61){_0x3de673[_0xc8c9('0x25')](_0x26cd61[_0xc8c9('0xa3')]);logger['info'](_0x26cd61[_0xc8c9('0x90')]);if(_[_0xc8c9('0xa6')](_0x257a3d[_0xc8c9('0x39')][_0xc8c9('0x7')],_0xc8c9('0xa7'))&&_0x26cd61[_0xc8c9('0xa8')]==0x1f4){return _0x3de673[_0xc8c9('0x1e')](_0x26cd61[_0xc8c9('0xa8')]);}else{return _0x3de673[_0xc8c9('0x20')](_0x26cd61['statusCode'])[_0xc8c9('0x32')](_0x26cd61[_0xc8c9('0x90')]);}}else{return _0x3de673['sendStatus'](0xc8);}})[_0xc8c9('0x4a')](handleError(_0x3de673,null));};exports[_0xc8c9('0xa9')]=function(_0x5ec498,_0x5e150c,_0x348bbb){return BPromise[_0xc8c9('0x9a')]()[_0xc8c9('0x2b')](function(){if(!_0x5ec498['query']['path']){throw new Error(_0xc8c9('0x9b'));}if(!_0x5ec498[_0xc8c9('0x39')]['port']){throw new Error(_0xc8c9('0x9d'));}var _0x1708ca=_0x5ec498[_0xc8c9('0x39')]['hostname']?_0x5ec498[_0xc8c9('0x39')][_0xc8c9('0x9e')]+':'+_0x5ec498[_0xc8c9('0x39')][_0xc8c9('0x9c')]:_0xc8c9('0x9f')+_0x5ec498[_0xc8c9('0x39')]['port'];var _0x16ab0b=_0x5ec498[_0xc8c9('0x39')][_0xc8c9('0x26')]?_0x5ec498[_0xc8c9('0x39')][_0xc8c9('0x26')]:!![];var _0x43cf63=_0x5ec498[_0xc8c9('0x39')][_0xc8c9('0xa0')]?_0x5ec498[_0xc8c9('0x39')]['encoding']:null;var _0x502ec1={'method':_0x5ec498['method'],'uri':util[_0xc8c9('0x4f')](_0xc8c9('0xa2'),_0x1708ca,_0x5ec498['query'][_0xc8c9('0x7')]),'json':_0x16ab0b,'resolveWithFullResponse':!![],'encoding':_0x43cf63,'body':_0x5ec498[_0xc8c9('0x90')]};if(_0x5ec498[_0xc8c9('0xa3')]){_0x502ec1[_0xc8c9('0xa3')]=_0x5ec498[_0xc8c9('0xa3')];if(_0x502ec1['headers']['content-length']){delete _0x502ec1[_0xc8c9('0xa3')][_0xc8c9('0xa4')];}}if(_0x502ec1[_0xc8c9('0xa3')]['content-type']){delete _0x502ec1[_0xc8c9('0xa3')][_0xc8c9('0xa5')];}return rp(_0x502ec1);})[_0xc8c9('0x2b')](function(_0x2fe052){if(_0x2fe052){_0x5e150c['set'](_0x2fe052[_0xc8c9('0xa3')]);logger[_0xc8c9('0x63')](_0x2fe052[_0xc8c9('0x90')]);return _0x5e150c[_0xc8c9('0x20')](_0x2fe052['statusCode'])['send'](_0x2fe052[_0xc8c9('0x90')]);}else{return _0x5e150c[_0xc8c9('0x1e')](0xc8);}})[_0xc8c9('0x4a')](handleError(_0x5e150c,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index 33df069..9505682 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 _0x3eea=['emit','exports','events','Plugin','setMaxListeners','save','update','remove'];(function(_0x3b5b02,_0x34cd1f){var _0x3fd6c9=function(_0x281f67){while(--_0x281f67){_0x3b5b02['push'](_0x3b5b02['shift']());}};_0x3fd6c9(++_0x34cd1f);}(_0x3eea,0x1ca));var _0xa3ee=function(_0x3d81ba,_0x5c2b7c){_0x3d81ba=_0x3d81ba-0x0;var _0x476ae4=_0x3eea[_0x3d81ba];return _0x476ae4;};'use strict';var EventEmitter=require(_0xa3ee('0x0'));var Plugin=require('../../mysqldb')['db'][_0xa3ee('0x1')];var PluginEvents=new EventEmitter();PluginEvents[_0xa3ee('0x2')](0x0);var events={'afterCreate':_0xa3ee('0x3'),'afterUpdate':_0xa3ee('0x4'),'afterDestroy':_0xa3ee('0x5')};function emitEvent(_0x269141){return function(_0x104913,_0x35ed7d,_0x23c42d){PluginEvents[_0xa3ee('0x6')](_0x269141+':'+_0x104913['id'],_0x104913);PluginEvents[_0xa3ee('0x6')](_0x269141,_0x104913);_0x23c42d(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Plugin['hook'](e,emitEvent(event));}}module[_0xa3ee('0x7')]=PluginEvents; \ No newline at end of file +var _0xf569=['exports','../../mysqldb','Plugin','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x52b501,_0x2a4a0e){var _0x15050f=function(_0x3e9590){while(--_0x3e9590){_0x52b501['push'](_0x52b501['shift']());}};_0x15050f(++_0x2a4a0e);}(_0xf569,0xd0));var _0x9f56=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0xf569[_0x8c43de];return _0xa6591b;};'use strict';var EventEmitter=require('events');var Plugin=require(_0x9f56('0x0'))['db'][_0x9f56('0x1')];var PluginEvents=new EventEmitter();PluginEvents[_0x9f56('0x2')](0x0);var events={'afterCreate':_0x9f56('0x3'),'afterUpdate':_0x9f56('0x4'),'afterDestroy':_0x9f56('0x5')};function emitEvent(_0x4506a1){return function(_0x6d506b,_0x5bc3e8,_0x314ee2){PluginEvents['emit'](_0x4506a1+':'+_0x6d506b['id'],_0x6d506b);PluginEvents[_0x9f56('0x6')](_0x4506a1,_0x6d506b);_0x314ee2(null);};}for(var e in events){if(events[_0x9f56('0x7')](e)){var event=events[e];Plugin['hook'](e,emitEvent(event));}}module[_0x9f56('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 1cddbba..e97c249 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 _0x4927=['./plugin.attributes','exports','define','Plugin','plugins','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x2ea218,_0x48c42b){var _0x15b538=function(_0xddc22f){while(--_0xddc22f){_0x2ea218['push'](_0x2ea218['shift']());}};_0x15b538(++_0x48c42b);}(_0x4927,0x122));var _0x7492=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4927[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x7492('0x0'));var util=require(_0x7492('0x1'));var logger=require(_0x7492('0x2'))(_0x7492('0x3'));var moment=require(_0x7492('0x4'));var BPromise=require(_0x7492('0x5'));var rp=require(_0x7492('0x6'));var fs=require('fs');var path=require(_0x7492('0x7'));var rimraf=require(_0x7492('0x8'));var config=require(_0x7492('0x9'));var attributes=require(_0x7492('0xa'));module[_0x7492('0xb')]=function(_0x110eca,_0x276317){return _0x110eca[_0x7492('0xc')](_0x7492('0xd'),attributes,{'tableName':_0x7492('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8406=['bluebird','request-promise','path','../../config/environment','./plugin.attributes','define','Plugin','plugins','lodash','util','../../config/logger','api','moment'];(function(_0x295a92,_0x7d70dc){var _0x3f5dac=function(_0x47b9e8){while(--_0x47b9e8){_0x295a92['push'](_0x295a92['shift']());}};_0x3f5dac(++_0x7d70dc);}(_0x8406,0x10c));var _0x6840=function(_0x427810,_0x1fd7b2){_0x427810=_0x427810-0x0;var _0x2341c8=_0x8406[_0x427810];return _0x2341c8;};'use strict';var _=require(_0x6840('0x0'));var util=require(_0x6840('0x1'));var logger=require(_0x6840('0x2'))(_0x6840('0x3'));var moment=require(_0x6840('0x4'));var BPromise=require(_0x6840('0x5'));var rp=require(_0x6840('0x6'));var fs=require('fs');var path=require(_0x6840('0x7'));var rimraf=require('rimraf');var config=require(_0x6840('0x8'));var attributes=require(_0x6840('0x9'));module['exports']=function(_0x4a33be,_0xf0cbcb){return _0x4a33be[_0x6840('0xa')](_0x6840('0xb'),attributes,{'tableName':_0x6840('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.rpc.js b/server/api/plugin/plugin.rpc.js index a4aa58e..1ce5254 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 _0x28f2=['CreatePlugin','Plugin','create','body','options','raw','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','localhost','socket.io-emitter','./plugin.socket','request','then','Plugin,\x20%s,\x20%s','request\x20sent','debug','Plugin,\x20%s,\x20%s,\x20%s','stringify','error','message','info'];(function(_0x4598ef,_0x1dd7c9){var _0x346a13=function(_0x369c1a){while(--_0x369c1a){_0x4598ef['push'](_0x4598ef['shift']());}};_0x346a13(++_0x1dd7c9);}(_0x28f2,0x193));var _0x228f=function(_0x44c209,_0x8c55f0){_0x44c209=_0x44c209-0x0;var _0x1ffd92=_0x28f2[_0x44c209];return _0x1ffd92;};'use strict';var _=require(_0x228f('0x0'));var util=require(_0x228f('0x1'));var moment=require(_0x228f('0x2'));var BPromise=require(_0x228f('0x3'));var rs=require(_0x228f('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x228f('0x5'))['db'];var utils=require(_0x228f('0x6'));var logger=require(_0x228f('0x7'))(_0x228f('0x8'));var config=require(_0x228f('0x9'));var jayson=require(_0x228f('0xa'));var client=jayson[_0x228f('0xb')]['http']({'port':0x232a});config[_0x228f('0xc')]=_['defaults'](config[_0x228f('0xc')],{'host':_0x228f('0xd'),'port':0x18eb});var socket=require(_0x228f('0xe'))(new Redis(config['redis']));require(_0x228f('0xf'))['register'](socket);function respondWithRpcPromise(_0x212c90,_0x2dfd07,_0x4e26fe){return new BPromise(function(_0x3884c6,_0x40aca5){return client[_0x228f('0x10')](_0x212c90,_0x4e26fe)[_0x228f('0x11')](function(_0x3aa9bf){logger['info'](_0x228f('0x12'),_0x2dfd07,_0x228f('0x13'));logger[_0x228f('0x14')](_0x228f('0x15'),_0x2dfd07,_0x228f('0x13'),JSON[_0x228f('0x16')](_0x3aa9bf));if(_0x3aa9bf[_0x228f('0x17')]){if(_0x3aa9bf[_0x228f('0x17')]['code']===0x1f4){logger[_0x228f('0x17')](_0x228f('0x12'),_0x2dfd07,_0x3aa9bf[_0x228f('0x17')][_0x228f('0x18')]);return _0x40aca5(_0x3aa9bf[_0x228f('0x17')][_0x228f('0x18')]);}logger[_0x228f('0x17')]('Plugin,\x20%s,\x20%s',_0x2dfd07,_0x3aa9bf[_0x228f('0x17')]['message']);return _0x3884c6(_0x3aa9bf[_0x228f('0x17')][_0x228f('0x18')]);}else{logger[_0x228f('0x19')]('Plugin,\x20%s,\x20%s',_0x2dfd07,_0x228f('0x13'));_0x3884c6(_0x3aa9bf['result'][_0x228f('0x18')]);}})['catch'](function(_0x30cbc2){logger['error']('Plugin,\x20%s,\x20%s',_0x2dfd07,_0x30cbc2);_0x40aca5(_0x30cbc2);});});}exports[_0x228f('0x1a')]=function(_0x52da36){var _0x302d54=this;return new Promise(function(_0x139373,_0x1294a8){return db[_0x228f('0x1b')][_0x228f('0x1c')](_0x52da36[_0x228f('0x1d')],{'raw':_0x52da36[_0x228f('0x1e')]?_0x52da36[_0x228f('0x1e')][_0x228f('0x1f')]===undefined?!![]:![]:!![]})['then'](function(_0x1e96d4){logger[_0x228f('0x19')](_0x228f('0x1a'),_0x52da36);logger[_0x228f('0x14')](_0x228f('0x1a'),_0x52da36,JSON[_0x228f('0x16')](_0x1e96d4));_0x139373(_0x1e96d4);})[_0x228f('0x20')](function(_0x20c111){logger[_0x228f('0x17')]('CreatePlugin',_0x20c111[_0x228f('0x18')],_0x52da36);_0x1294a8(_0x302d54[_0x228f('0x17')](0x1f4,_0x20c111[_0x228f('0x18')]));});});}; \ No newline at end of file +var _0xcb52=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','Plugin,\x20%s,\x20%s','request\x20sent','debug','Plugin,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','create','raw','info','CreatePlugin','catch','lodash','util','ioredis','../../mysqldb'];(function(_0x1d0988,_0x5eb899){var _0x323608=function(_0x2cad60){while(--_0x2cad60){_0x1d0988['push'](_0x1d0988['shift']());}};_0x323608(++_0x5eb899);}(_0xcb52,0x15c));var _0x2cb5=function(_0x3efcf1,_0xfa83c3){_0x3efcf1=_0x3efcf1-0x0;var _0x4ef023=_0xcb52[_0x3efcf1];return _0x4ef023;};'use strict';var _=require(_0x2cb5('0x0'));var util=require(_0x2cb5('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2cb5('0x2'));var db=require(_0x2cb5('0x3'))['db'];var utils=require(_0x2cb5('0x4'));var logger=require(_0x2cb5('0x5'))(_0x2cb5('0x6'));var config=require(_0x2cb5('0x7'));var jayson=require(_0x2cb5('0x8'));var client=jayson[_0x2cb5('0x9')][_0x2cb5('0xa')]({'port':0x232a});config[_0x2cb5('0xb')]=_[_0x2cb5('0xc')](config['redis'],{'host':_0x2cb5('0xd'),'port':0x18eb});var socket=require(_0x2cb5('0xe'))(new Redis(config[_0x2cb5('0xb')]));require('./plugin.socket')[_0x2cb5('0xf')](socket);function respondWithRpcPromise(_0x27a571,_0x9dcc97,_0x1029eb){return new BPromise(function(_0x1054e6,_0x1a48b8){return client[_0x2cb5('0x10')](_0x27a571,_0x1029eb)[_0x2cb5('0x11')](function(_0x5febfc){logger['info'](_0x2cb5('0x12'),_0x9dcc97,_0x2cb5('0x13'));logger[_0x2cb5('0x14')](_0x2cb5('0x15'),_0x9dcc97,_0x2cb5('0x13'),JSON[_0x2cb5('0x16')](_0x5febfc));if(_0x5febfc[_0x2cb5('0x17')]){if(_0x5febfc[_0x2cb5('0x17')][_0x2cb5('0x18')]===0x1f4){logger[_0x2cb5('0x17')](_0x2cb5('0x12'),_0x9dcc97,_0x5febfc[_0x2cb5('0x17')][_0x2cb5('0x19')]);return _0x1a48b8(_0x5febfc[_0x2cb5('0x17')][_0x2cb5('0x19')]);}logger['error'](_0x2cb5('0x12'),_0x9dcc97,_0x5febfc['error']['message']);return _0x1054e6(_0x5febfc[_0x2cb5('0x17')]['message']);}else{logger['info'](_0x2cb5('0x12'),_0x9dcc97,_0x2cb5('0x13'));_0x1054e6(_0x5febfc[_0x2cb5('0x1a')][_0x2cb5('0x19')]);}})['catch'](function(_0x30c128){logger['error']('Plugin,\x20%s,\x20%s',_0x9dcc97,_0x30c128);_0x1a48b8(_0x30c128);});});}exports['CreatePlugin']=function(_0x37559c){var _0x976359=this;return new Promise(function(_0x58f357,_0x31eefc){return db['Plugin'][_0x2cb5('0x1b')](_0x37559c['body'],{'raw':_0x37559c['options']?_0x37559c['options'][_0x2cb5('0x1c')]===undefined?!![]:![]:!![]})[_0x2cb5('0x11')](function(_0x4b0b29){logger[_0x2cb5('0x1d')](_0x2cb5('0x1e'),_0x37559c);logger[_0x2cb5('0x14')]('CreatePlugin',_0x37559c,JSON['stringify'](_0x4b0b29));_0x58f357(_0x4b0b29);})[_0x2cb5('0x1f')](function(_0x5a968a){logger[_0x2cb5('0x17')](_0x2cb5('0x1e'),_0x5a968a[_0x2cb5('0x19')],_0x37559c);_0x31eefc(_0x976359[_0x2cb5('0x17')](0x1f4,_0x5a968a['message']));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index 0811c12..bd27ba0 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 _0xd15e=['update','register','length','./plugin.events','save','remove'];(function(_0x4a84d0,_0x461592){var _0x11d0e9=function(_0x50f299){while(--_0x50f299){_0x4a84d0['push'](_0x4a84d0['shift']());}};_0x11d0e9(++_0x461592);}(_0xd15e,0x9f));var _0xed15=function(_0x3aac46,_0x3ce132){_0x3aac46=_0x3aac46-0x0;var _0x4eb896=_0xd15e[_0x3aac46];return _0x4eb896;};'use strict';var PluginEvents=require(_0xed15('0x0'));var events=[_0xed15('0x1'),_0xed15('0x2'),_0xed15('0x3')];function createListener(_0x56288d,_0x19c232){return function(_0x38fa41){_0x19c232['emit'](_0x56288d,_0x38fa41);};}function removeListener(_0x2ef4fe,_0x5d6f02){return function(){PluginEvents['removeListener'](_0x2ef4fe,_0x5d6f02);};}exports[_0xed15('0x4')]=function(_0x3921c3){for(var _0x19e27b=0x0,_0x2e138d=events[_0xed15('0x5')];_0x19e27b<_0x2e138d;_0x19e27b++){var _0x225a35=events[_0x19e27b];var _0x4a9d55=createListener('plugin:'+_0x225a35,_0x3921c3);PluginEvents['on'](_0x225a35,_0x4a9d55);}}; \ No newline at end of file +var _0x47b1=['remove','update','emit','removeListener','register','length','plugin:','./plugin.events','save'];(function(_0x32abb6,_0x1650a8){var _0x401c73=function(_0x43733e){while(--_0x43733e){_0x32abb6['push'](_0x32abb6['shift']());}};_0x401c73(++_0x1650a8);}(_0x47b1,0x130));var _0x147b=function(_0x3cf5b1,_0xb6502b){_0x3cf5b1=_0x3cf5b1-0x0;var _0x45585a=_0x47b1[_0x3cf5b1];return _0x45585a;};'use strict';var PluginEvents=require(_0x147b('0x0'));var events=[_0x147b('0x1'),_0x147b('0x2'),_0x147b('0x3')];function createListener(_0x3275ac,_0x1e82dd){return function(_0x56c813){_0x1e82dd[_0x147b('0x4')](_0x3275ac,_0x56c813);};}function removeListener(_0x412044,_0x233652){return function(){PluginEvents[_0x147b('0x5')](_0x412044,_0x233652);};}exports[_0x147b('0x6')]=function(_0x5128b9){for(var _0x2c1c15=0x0,_0x497f2b=events[_0x147b('0x7')];_0x2c1c15<_0x497f2b;_0x2c1c15++){var _0xdae9fd=events[_0x2c1c15];var _0x1761c3=createListener(_0x147b('0x8')+_0xdae9fd,_0x5128b9);PluginEvents['on'](_0xdae9fd,_0x1761c3);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index 1fad750..4aea471 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(_0x4c0c77,_0x8df6ec){var _0x2de5ed=function(_0x5a02b7){while(--_0x5a02b7){_0x4c0c77['push'](_0x4c0c77['shift']());}};_0x2de5ed(++_0x8df6ec);}(_0xa9e0,0x123));var _0x0a9e=function(_0x40ac5e,_0x2de228){_0x40ac5e=_0x40ac5e-0x0;var _0x2839d6=_0xa9e0[_0x40ac5e];return _0x2839d6;};'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(_0x182f68,_0x18d7a4){var _0x3b16bd=function(_0x346f9c){while(--_0x346f9c){_0x182f68['push'](_0x182f68['shift']());}};_0x3b16bd(++_0x18d7a4);}(_0xa9e0,0x123));var _0x0a9e=function(_0x433a86,_0x175b5c){_0x433a86=_0x433a86-0x0;var _0x23000c=_0xa9e0[_0x433a86];return _0x23000c;};'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 ef396b1..863e616 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 _0x7072=['update','restart','stop','hasOwnProperty','Unknown\x20status','destroy','delete','Unknown\x20id','../../config/pm2','../../config/logger','api','path','child_process','sendStatus','status','json','name','send','npm\x20install','info','error','list','then','reject','express','length','catch','show','params','body','script','join','../../files/plugins','cwd','chdir','dirname','start','dump'];(function(_0x4517bc,_0xe8a21e){var _0x5a90ba=function(_0x1ab4a9){while(--_0x1ab4a9){_0x4517bc['push'](_0x4517bc['shift']());}};_0x5a90ba(++_0xe8a21e);}(_0x7072,0x138));var _0x2707=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0x7072[_0x1d1779];return _0x2377e9;};'use strict';var _=require('lodash');var pm2=require(_0x2707('0x0'));var logger=require(_0x2707('0x1'))(_0x2707('0x2'));var path=require(_0x2707('0x3'));var exec=require(_0x2707('0x4'))['exec'];var BPromise=require('bluebird');function handleEntityNotFound(_0xfdfa7a,_0x5f3c1c){return function(_0xd36287){if(!_0xd36287){_0xfdfa7a[_0x2707('0x5')](0x194);;}return _0xd36287;};}function respondWithResult(_0x1e86f2,_0x194132){_0x194132=_0x194132||0xc8;return function(_0x2fd8ff){if(_0x2fd8ff){return _0x1e86f2[_0x2707('0x6')](_0x194132)[_0x2707('0x7')](_0x2fd8ff);}return null;};}function handleError(_0x745cfd,_0x4062b6){_0x4062b6=_0x4062b6||0x1f4;return function(_0x2820ef){logger['error'](_0x2820ef['stack']);if(_0x2820ef[_0x2707('0x8')]){delete _0x2820ef[_0x2707('0x8')];}_0x745cfd[_0x2707('0x6')](_0x4062b6)[_0x2707('0x9')](_0x2820ef);};}function execChildProcess(){return new BPromise(function(_0x30090e,_0x2e1a46){exec(_0x2707('0xa'),function(_0x19881c,_0x115535,_0x478717){logger[_0x2707('0xb')](_0x115535);logger[_0x2707('0xb')](_0x478717);if(_0x19881c){logger[_0x2707('0xc')](_0x19881c);return _0x2e1a46(_0x19881c);}return _0x30090e(_0x115535);});});}exports['index']=function(_0x44c1d7,_0x590152){return pm2[_0x2707('0xd')]()[_0x2707('0xe')](function(_0xfe975c){if(_0xfe975c){var _0x3a67f2=_[_0x2707('0xf')](_0xfe975c,function(_0x4e52a3){return _0x4e52a3[_0x2707('0x8')]===_0x2707('0x10')||_0x4e52a3[_0x2707('0x8')]==='motion2';});return{'rows':_0x3a67f2,'count':_0x3a67f2[_0x2707('0x11')]};}return null;})[_0x2707('0xe')](respondWithResult(_0x590152,null))[_0x2707('0x12')](handleError(_0x590152,null));};exports[_0x2707('0x13')]=function(_0x7ed037,_0x27a3ea){return pm2['describe'](_0x7ed037[_0x2707('0x14')]['id'])[_0x2707('0xe')](respondWithResult(_0x27a3ea,null))[_0x2707('0xe')](handleEntityNotFound(_0x27a3ea,null))['catch'](handleError(_0x27a3ea,null));};exports['create']=function(_0x58a4ee,_0x1da4a6){if(_0x58a4ee[_0x2707('0x15')][_0x2707('0x8')]&&_0x58a4ee[_0x2707('0x15')][_0x2707('0x16')]){var _0x3c2935=path[_0x2707('0x17')](__dirname,_0x2707('0x18'),_0x58a4ee[_0x2707('0x15')][_0x2707('0x16')]);var _0x37c475=process[_0x2707('0x19')]();process[_0x2707('0x1a')](path[_0x2707('0x1b')](_0x3c2935));return execChildProcess()['then'](function(_0x1acf22){process[_0x2707('0x1a')](_0x37c475);return pm2[_0x2707('0x1c')]({'name':_0x58a4ee[_0x2707('0x15')][_0x2707('0x8')],'script':_0x3c2935});})[_0x2707('0xe')](function(_0x4831ed){pm2[_0x2707('0x1d')]();return _0x4831ed[0x0];})[_0x2707('0xe')](respondWithResult(_0x1da4a6,0xc9))[_0x2707('0x12')](handleError(_0x1da4a6,null));}else{return _0x1da4a6[_0x2707('0x6')](0x1f4)[_0x2707('0x9')]({'message':'Missing\x20name\x20and/or\x20path'});}};exports[_0x2707('0x1e')]=function(_0x4ca05d,_0x29dad2){if(_0x4ca05d[_0x2707('0x15')]['id']){delete _0x4ca05d[_0x2707('0x15')]['id'];}var _0x57da26={'online':_0x2707('0x1f'),'stopped':_0x2707('0x20')};if(_0x57da26[_0x2707('0x21')](_0x4ca05d['body'][_0x2707('0x6')])){return pm2[_0x57da26[_0x4ca05d[_0x2707('0x15')]['status']]](_0x4ca05d[_0x2707('0x14')]['id'])['then'](respondWithResult(_0x29dad2,0xc8))['catch'](handleError(_0x29dad2,null));}else{return _0x29dad2[_0x2707('0x6')](0x1f4)['send']({'message':_0x2707('0x22')});}};exports[_0x2707('0x23')]=function(_0x417a97,_0x36b2e9){if(_0x417a97['body']['id']){delete _0x417a97[_0x2707('0x15')]['id'];}if(_0x417a97[_0x2707('0x14')]['id']){return pm2[_0x2707('0x24')](_0x417a97[_0x2707('0x14')]['id'])[_0x2707('0xe')](function(_0x341e14){pm2[_0x2707('0x1d')]();return _0x341e14[0x0];})[_0x2707('0xe')](respondWithResult(_0x36b2e9,null))[_0x2707('0x12')](handleError(_0x36b2e9,null));}else{return _0x36b2e9['status'](0x1f4)[_0x2707('0x9')]({'message':_0x2707('0x25')});}}; \ No newline at end of file +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(_0x1fa361,_0x43de67){var _0x59b0cc=function(_0x17b2ac){while(--_0x17b2ac){_0x1fa361['push'](_0x1fa361['shift']());}};_0x59b0cc(++_0x43de67);}(_0x2f68,0x9a));var _0x82f6=function(_0x47896f,_0x52db00){_0x47896f=_0x47896f-0x0;var _0x2dca2b=_0x2f68[_0x47896f];return _0x2dca2b;};'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 diff --git a/server/api/realtime/index.js b/server/api/realtime/index.js index 966fae1..2294995 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 _0xf087=['exports','../../components/auth/service','get','isAuthenticated','getAgents','/queues','getQueues'];(function(_0x4214c2,_0x275024){var _0x6769b=function(_0x5ecbb1){while(--_0x5ecbb1){_0x4214c2['push'](_0x4214c2['shift']());}};_0x6769b(++_0x275024);}(_0xf087,0x1f2));var _0x7f08=function(_0xe08342,_0xca4ab5){_0xe08342=_0xe08342-0x0;var _0x6faba1=_0xf087[_0xe08342];return _0x6faba1;};'use strict';var express=require('express');var router=express['Router']();var auth=require(_0x7f08('0x0'));var controller=require('./realtime.controller');router[_0x7f08('0x1')]('/agents',auth[_0x7f08('0x2')](),controller[_0x7f08('0x3')]);router[_0x7f08('0x1')](_0x7f08('0x4'),auth[_0x7f08('0x2')](),controller[_0x7f08('0x5')]);module[_0x7f08('0x6')]=router; \ No newline at end of file +var _0x5ccd=['exports','express','Router','../../components/auth/service','./realtime.controller','/agents','isAuthenticated','getAgents','/queues','getQueues'];(function(_0xcbe787,_0x401e4c){var _0x4c78fa=function(_0x392922){while(--_0x392922){_0xcbe787['push'](_0xcbe787['shift']());}};_0x4c78fa(++_0x401e4c);}(_0x5ccd,0x79));var _0xd5cc=function(_0x12309b,_0x59dd8c){_0x12309b=_0x12309b-0x0;var _0x482e4d=_0x5ccd[_0x12309b];return _0x482e4d;};'use strict';var express=require(_0xd5cc('0x0'));var router=express[_0xd5cc('0x1')]();var auth=require(_0xd5cc('0x2'));var controller=require(_0xd5cc('0x3'));router['get'](_0xd5cc('0x4'),auth[_0xd5cc('0x5')](),controller[_0xd5cc('0x6')]);router['get'](_0xd5cc('0x7'),auth['isAuthenticated'](),controller[_0xd5cc('0x8')]);module[_0xd5cc('0x9')]=router; \ No newline at end of file diff --git a/server/api/realtime/realtime.controller.js b/server/api/realtime/realtime.controller.js index 3c76b96..06459c1 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 _0x500c=['Content-Range','json','getAgents','getChannels','query','globalStatusFilter','pauseTypeFilter','pause','*pause','then','channel','isValidChannel','format','Channel\x20parameter\x20%s\x20is\x20invalid','sort','globalStatus','validateSortParameter','fields','join','order','getAgentIdsByQueues','rows','getSortedAgentsIdsByStatus','length','map','rawAttributes','fieldName','type','role','agent','getOptions','raw','push','sequelize','literal','FIELD(id,','forEach','Pause','where','merge','user','Agents','online','extraQueryConditions','UserProfile','getResources','User','findAndCountAll','find','filterAgentAttributes','getAgentStatus','includes','voice','talking','voiceStatus','Status','sortAgentsByStatus','getRealtimeAgentsQueryFields','pick','getQueues','resolve','toLowerCase','Queue','key','name','outbound','dialActive','dialMethod','QueueCampaigns','Queues','filter','assign','getRealtimeQueues','initializeQueues','catch','util','../../components/realtime/queues','../../components/parsers/qs','../../mysqldb','../../errors/api','APIBadRequestError','handleError','offset','limit','undefined','count','status','set'];(function(_0x1f530d,_0x18a19e){var _0x22103f=function(_0x2664c5){while(--_0x2664c5){_0x1f530d['push'](_0x1f530d['shift']());}};_0x22103f(++_0x18a19e);}(_0x500c,0x1ab));var _0xc500=function(_0x385dfc,_0x91f31){_0x385dfc=_0x385dfc-0x0;var _0x22ca89=_0x500c[_0x385dfc];return _0x22ca89;};'use strict';var _=require('lodash');var util=require(_0xc500('0x0'));var rta=require('../../components/realtime/agents');var rtq=require(_0xc500('0x1'));var qs=require(_0xc500('0x2'));var utils=require('../../config/utils');var db=require(_0xc500('0x3'))['db'];var APIBadRequestError=require(_0xc500('0x4'))[_0xc500('0x5')];var APIHandleError=require(_0xc500('0x4'))[_0xc500('0x6')];function respondWithFilteredResult(_0x23c77e,_0x4dc516){return function(_0x37c4e8){if(_0x37c4e8){var _0x100a64=typeof _0x4dc516[_0xc500('0x7')]==='undefined'&&typeof _0x4dc516[_0xc500('0x8')]===_0xc500('0x9');var _0x3e1c18=_0x37c4e8[_0xc500('0xa')];var _0x45501f=_0x100a64?0x0:_0x4dc516[_0xc500('0x7')];var _0x2956f3=_0x100a64?_0x37c4e8[_0xc500('0xa')]:_0x4dc516['offset']+_0x4dc516['limit'];var _0x2c69d7;if(_0x2956f3>=_0x3e1c18){_0x2956f3=_0x3e1c18;_0x2c69d7=0xc8;}else{_0x2c69d7=0xce;}_0x23c77e[_0xc500('0xb')](_0x2c69d7);return _0x23c77e[_0xc500('0xc')](_0xc500('0xd'),_0x45501f+'-'+_0x2956f3+'/'+_0x3e1c18)[_0xc500('0xe')](_0x37c4e8);}return null;};}exports[_0xc500('0xf')]=function(_0x14bc5c,_0x43c2c5){var _0x506c10={'count':0x0,'rows':[]};var _0x472c33={};var _0x3f37a6;var _0x2c5459=utils[_0xc500('0x10')]();var _0x1c2b6d;var _0x1e43a5;var _0x4207ab=_0x14bc5c[_0xc500('0x11')]['globalQueueFilter'];var _0x13f640=_0x14bc5c[_0xc500('0x11')][_0xc500('0x12')];var _0x4f95d3=_0x14bc5c[_0xc500('0x11')][_0xc500('0x13')];var _0x3c4b89=_0x13f640===_0xc500('0x14')||_0x13f640===_0xc500('0x15')?!![]:![];var _0x7e4092=[];var _0x33747e;var _0x281a1b;Promise['resolve']()[_0xc500('0x16')](function(){if(_0x14bc5c[_0xc500('0x11')][_0xc500('0x17')]){if(!utils[_0xc500('0x18')](_0x14bc5c['query'][_0xc500('0x17')])){throw new APIBadRequestError(util[_0xc500('0x19')](_0xc500('0x1a'),_0x14bc5c[_0xc500('0x11')][_0xc500('0x17')]));}_0x3f37a6=_0x14bc5c[_0xc500('0x11')][_0xc500('0x17')]['toLowerCase']();}if(!_0x14bc5c[_0xc500('0x11')][_0xc500('0x1b')]||!_0x14bc5c[_0xc500('0x11')]['sort']['includes'](_0xc500('0x1c'))){_0x14bc5c[_0xc500('0x11')][_0xc500('0x1b')]=rta[_0xc500('0x1d')](_0x14bc5c[_0xc500('0x11')][_0xc500('0x1b')]);return;}var _0x4aadb5=rta['getUpdatedSortOptions'](_0x14bc5c[_0xc500('0x11')][_0xc500('0x1b')]);_0x14bc5c[_0xc500('0x11')][_0xc500('0x1b')]=_0x4aadb5[_0xc500('0x1e')][_0xc500('0x1f')](',');_0x33747e=_0x4aadb5[_0xc500('0x20')];})[_0xc500('0x16')](function(){if(!_0x4207ab){return[];}return rta[_0xc500('0x21')](_0x4207ab,_0x3f37a6);})[_0xc500('0x16')](function(_0x40d98c){_0x7e4092=_0x40d98c;return rta['getRealtimeAgents']();})[_0xc500('0x16')](function(_0x4740eb){_0x1e43a5=_0x4740eb[_0xc500('0x22')];if((!_0x13f640||_0x3c4b89)&&!_0x33747e){return _0x7e4092;}if(_0x33747e&&!_0x13f640){return rta[_0xc500('0x23')](_0x1e43a5,_0x7e4092,_0x33747e);}else{return rta['getAgentIdsByStatus'](_0x1e43a5,_0x7e4092,_0x13f640);}})['then'](function(_0x11e453){_0x7e4092=_0x11e453;var _0x1e2e77=![];if(_0x7e4092[_0xc500('0x24')]===0x0){if(_0x4207ab||_0x13f640){_0x1e2e77=!![];}if(_0x3c4b89){_0x1e2e77=![];}}if(_0x1e2e77){return _0x506c10;}var _0x3d1509=_[_0xc500('0x25')](db['User'][_0xc500('0x26')],function(_0x4e4002){return{'name':_0x4e4002[_0xc500('0x27')],'type':_0x4e4002[_0xc500('0x28')]['key']};});_0x14bc5c['query'][_0xc500('0x29')]=_0xc500('0x2a');_0x472c33=qs[_0xc500('0x2b')](_0x3d1509,_0x14bc5c);_0x472c33[_0xc500('0x2c')]=!![];var _0x807f61=[];if(_0x7e4092['length']>0x0){_0x807f61[_0xc500('0x2d')]({'id':{'$in':_0x7e4092}});if(_0x33747e&&!_0x13f640){_0x281a1b=[db[_0xc500('0x2e')][_0xc500('0x2f')](_0xc500('0x30')+_0x7e4092+')')];_0x472c33[_0xc500('0x20')]=_0x281a1b;}}if(_0x3c4b89){_0x2c5459[_0xc500('0x31')](function(_0x58eef8){var _0x2d4b4e=!![];if(_0x13f640===_0xc500('0x15')&&_0x3f37a6!==_0x58eef8){_0x2d4b4e=![];}_0x807f61[_0xc500('0x2d')]({[_0x58eef8+_0xc500('0x32')]:_0x2d4b4e});});if(_0x4f95d3){_0x807f61[_0xc500('0x2d')]({'pauseType':_0x4f95d3});}}else if(_0x13f640){_0x2c5459['forEach'](function(_0xcb8e8a){_0x807f61[_0xc500('0x2d')]({[_0xcb8e8a+_0xc500('0x32')]:![]});});}_0x472c33[_0xc500('0x33')]=_[_0xc500('0x34')](_0x472c33[_0xc500('0x33')],{'$and':_0x807f61});if(_0x14bc5c[_0xc500('0x35')][_0xc500('0x29')]===_0xc500('0x35')){var _0x1de9ff={'params':{'id':_0x14bc5c[_0xc500('0x35')]['userProfileId']},'query':{'section':_0xc500('0x36'),'role':_0xc500('0x2a'),'raw':!![],'ids':_0x7e4092,'customSorting':_0x281a1b}};if(_0x14bc5c[_0xc500('0x11')][_0xc500('0x37')]){_0x1de9ff[_0xc500('0x11')][_0xc500('0x37')]=!![];}if(_0x3c4b89){_0x1de9ff[_0xc500('0x11')][_0xc500('0x38')]=_0x807f61;}_0x1de9ff[_0xc500('0x11')]=Object['assign'](_0x1de9ff[_0xc500('0x11')],_0x14bc5c[_0xc500('0x11')]);return db[_0xc500('0x39')][_0xc500('0x3a')](_0x1de9ff);}return db[_0xc500('0x3b')][_0xc500('0x3c')](_0x472c33);})[_0xc500('0x16')](function(_0x108288){_0x506c10[_0xc500('0xa')]=_0x108288[_0xc500('0xa')];_0x1c2b6d=_0x108288['rows'];return _0x1c2b6d[_0xc500('0x25')](function(_0x110ffe){var _0x48d94f=_[_0xc500('0x3d')](_0x1e43a5,['id',_0x110ffe['id']]);if(_0x48d94f){var _0x444d86=rta[_0xc500('0x3e')](_0x48d94f);_[_0xc500('0x34')](_0x110ffe,_0x444d86);}_0x110ffe[_0xc500('0x1c')]=rta[_0xc500('0x3f')](_0x110ffe);if(_0x110ffe['globalStatus'][_0xc500('0x40')]('pause')){_0x2c5459[_0xc500('0x31')](function(_0x59a2c8){if(_0x110ffe[_0x59a2c8+_0xc500('0x32')]){if(_0x59a2c8===_0xc500('0x41')){if(_0x110ffe['voiceStatus']!==_0xc500('0x42')){_0x110ffe[_0xc500('0x43')]=_0xc500('0x14');}}else{_0x110ffe[_0x59a2c8+_0xc500('0x44')]=_0xc500('0x14');}}});}return _0x110ffe;});})[_0xc500('0x16')](function(_0x173ff7){if(!_0x33747e||_0x281a1b){return _0x173ff7;}return rta[_0xc500('0x45')](_0x173ff7,_0x33747e);})[_0xc500('0x16')](function(_0x3f1e3e){var _0x1a63af=rta[_0xc500('0x46')]();_0x506c10['rows']=_0x3f1e3e[_0xc500('0x25')](function(_0x356bd9){return _[_0xc500('0x47')](_0x356bd9,_0x1a63af);});return _0x506c10;})[_0xc500('0x16')](respondWithFilteredResult(_0x43c2c5,_0x472c33))['catch'](APIHandleError(_0x43c2c5));};exports[_0xc500('0x48')]=function(_0x3aefe3,_0x3e773e){var _0x5ac941={'count':0x0,'rows':[]};var _0x51a265={};var _0x31481a;var _0x5825d4;var _0x4cd13a;Promise[_0xc500('0x49')]()[_0xc500('0x16')](function(){if(_0x3aefe3[_0xc500('0x11')][_0xc500('0x17')]){if(!utils[_0xc500('0x18')](_0x3aefe3[_0xc500('0x11')][_0xc500('0x17')])){throw new APIBadRequestError(util[_0xc500('0x19')]('Channel\x20parameter\x20%s\x20is\x20invalid',_0x3aefe3['query'][_0xc500('0x17')]));}_0x31481a=_0x3aefe3['query'][_0xc500('0x17')][_0xc500('0x4a')]();}var _0x1d6d00=_['startCase'](_0x31481a)+_0xc500('0x4b');var _0x1b6106=_['map'](db[_0x1d6d00][_0xc500('0x26')],function(_0x1d0bdf){return{'name':_0x1d0bdf[_0xc500('0x27')],'type':_0x1d0bdf['type'][_0xc500('0x4c')]};});if(!_0x3aefe3[_0xc500('0x11')][_0xc500('0x1e')]){var _0x283954=['id',_0xc500('0x4d')];if(_0x31481a===_0xc500('0x41')){_0x283954[_0xc500('0x2d')]('type');if(_0x3aefe3['query'][_0xc500('0x28')]===_0xc500('0x4e')){_0x283954[_0xc500('0x2d')]([_0xc500('0x4f'),_0xc500('0x50')]);}}_0x3aefe3[_0xc500('0x11')][_0xc500('0x1e')]=_0x283954[_0xc500('0x1f')](',');}_0x51a265=qs[_0xc500('0x2b')](_0x1b6106,_0x3aefe3);if(_0x3aefe3[_0xc500('0x35')][_0xc500('0x29')]===_0xc500('0x35')){var _0x35309a={'params':{'id':_0x3aefe3[_0xc500('0x35')]['userProfileId']},'query':{'section':_0x31481a==='voice'&&_0x3aefe3[_0xc500('0x11')][_0xc500('0x28')]===_0xc500('0x4e')?_0xc500('0x51'):_['startCase'](_0x31481a)+_0xc500('0x52'),'type':_0x3aefe3[_0xc500('0x11')][_0xc500('0x28')],'nolimit':!![],'sort':_0xc500('0x4d'),'filter':_0x3aefe3[_0xc500('0x11')][_0xc500('0x53')]}};_0x35309a[_0xc500('0x11')]=Object[_0xc500('0x54')](_0x35309a[_0xc500('0x11')],_0x3aefe3[_0xc500('0x11')]);delete _0x35309a['query']['id'];return db['UserProfile']['getResources'](_0x35309a);}return db[_0x1d6d00]['findAndCountAll'](_0x51a265);})[_0xc500('0x16')](function(_0x391c71){_0x5ac941[_0xc500('0xa')]=_0x391c71[_0xc500('0xa')];_0x5825d4=_0x391c71[_0xc500('0x22')];return rtq[_0xc500('0x55')](_0x3aefe3,_0x31481a);})[_0xc500('0x16')](function(_0x3ede87){_0x4cd13a=_0x3ede87['rows'];return rtq[_0xc500('0x56')](_0x5825d4,_0x4cd13a,_0x31481a,_0x3aefe3[_0xc500('0x11')][_0xc500('0x28')]);})[_0xc500('0x16')](function(_0x1e85eb){_0x5ac941['rows']=_0x1e85eb;return _0x5ac941;})['then'](respondWithFilteredResult(_0x3e773e,_0x51a265))[_0xc500('0x57')](APIHandleError(_0x3e773e));}; \ No newline at end of file +var _0x7ca0=['voiceStatus','talking','Status','sortAgentsByStatus','rows','pick','catch','getQueues','key','QueueCampaigns','Queues','name','filter','getRealtimeQueues','initializeQueues','lodash','../../components/realtime/agents','../../components/realtime/queues','../../components/parsers/qs','../../config/utils','../../mysqldb','../../errors/api','APIBadRequestError','handleError','offset','count','limit','status','set','Content-Range','json','getAgents','getChannels','query','globalQueueFilter','globalStatusFilter','pauseTypeFilter','pause','resolve','then','isValidChannel','channel','format','Channel\x20parameter\x20%s\x20is\x20invalid','toLowerCase','sort','includes','globalStatus','validateSortParameter','getUpdatedSortOptions','fields','join','order','getAgentIdsByQueues','getRealtimeAgents','getSortedAgentsIdsByStatus','getAgentIdsByStatus','length','map','User','fieldName','type','role','agent','getOptions','raw','push','literal','FIELD(id,','forEach','*pause','Pause','where','merge','user','userProfileId','Agents','online','extraQueryConditions','UserProfile','getResources','findAndCountAll','find','filterAgentAttributes','getAgentStatus','voice'];(function(_0x1362b1,_0x2f0a44){var _0x4c64c4=function(_0x1fe655){while(--_0x1fe655){_0x1362b1['push'](_0x1362b1['shift']());}};_0x4c64c4(++_0x2f0a44);}(_0x7ca0,0xbb));var _0x07ca=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7ca0[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x07ca('0x0'));var util=require('util');var rta=require(_0x07ca('0x1'));var rtq=require(_0x07ca('0x2'));var qs=require(_0x07ca('0x3'));var utils=require(_0x07ca('0x4'));var db=require(_0x07ca('0x5'))['db'];var APIBadRequestError=require(_0x07ca('0x6'))[_0x07ca('0x7')];var APIHandleError=require(_0x07ca('0x6'))[_0x07ca('0x8')];function respondWithFilteredResult(_0x3eb065,_0x1f91e2){return function(_0x4e8566){if(_0x4e8566){var _0x17ca29=typeof _0x1f91e2[_0x07ca('0x9')]==='undefined'&&typeof _0x1f91e2['limit']==='undefined';var _0x3c7f7e=_0x4e8566[_0x07ca('0xa')];var _0x31a7f5=_0x17ca29?0x0:_0x1f91e2[_0x07ca('0x9')];var _0x5dc6cb=_0x17ca29?_0x4e8566[_0x07ca('0xa')]:_0x1f91e2[_0x07ca('0x9')]+_0x1f91e2[_0x07ca('0xb')];var _0x319fec;if(_0x5dc6cb>=_0x3c7f7e){_0x5dc6cb=_0x3c7f7e;_0x319fec=0xc8;}else{_0x319fec=0xce;}_0x3eb065[_0x07ca('0xc')](_0x319fec);return _0x3eb065[_0x07ca('0xd')](_0x07ca('0xe'),_0x31a7f5+'-'+_0x5dc6cb+'/'+_0x3c7f7e)[_0x07ca('0xf')](_0x4e8566);}return null;};}exports[_0x07ca('0x10')]=function(_0x4b3917,_0x33ea7b){var _0x1e73fd={'count':0x0,'rows':[]};var _0x5bc08a={};var _0x1b56a4;var _0x52049d=utils[_0x07ca('0x11')]();var _0x48447f;var _0x5d6b40;var _0x5033a0=_0x4b3917[_0x07ca('0x12')][_0x07ca('0x13')];var _0x48a00e=_0x4b3917[_0x07ca('0x12')][_0x07ca('0x14')];var _0x1e2faf=_0x4b3917['query'][_0x07ca('0x15')];var _0x4cb0e2=_0x48a00e===_0x07ca('0x16')||_0x48a00e==='*pause'?!![]:![];var _0x32627e=[];var _0x21bdc2;var _0x2ad3eb;Promise[_0x07ca('0x17')]()[_0x07ca('0x18')](function(){if(_0x4b3917[_0x07ca('0x12')]['channel']){if(!utils[_0x07ca('0x19')](_0x4b3917[_0x07ca('0x12')][_0x07ca('0x1a')])){throw new APIBadRequestError(util[_0x07ca('0x1b')](_0x07ca('0x1c'),_0x4b3917['query'][_0x07ca('0x1a')]));}_0x1b56a4=_0x4b3917[_0x07ca('0x12')]['channel'][_0x07ca('0x1d')]();}if(!_0x4b3917[_0x07ca('0x12')][_0x07ca('0x1e')]||!_0x4b3917[_0x07ca('0x12')][_0x07ca('0x1e')][_0x07ca('0x1f')](_0x07ca('0x20'))){_0x4b3917[_0x07ca('0x12')][_0x07ca('0x1e')]=rta[_0x07ca('0x21')](_0x4b3917[_0x07ca('0x12')]['sort']);return;}var _0x419225=rta[_0x07ca('0x22')](_0x4b3917['query'][_0x07ca('0x1e')]);_0x4b3917['query'][_0x07ca('0x1e')]=_0x419225[_0x07ca('0x23')][_0x07ca('0x24')](',');_0x21bdc2=_0x419225[_0x07ca('0x25')];})[_0x07ca('0x18')](function(){if(!_0x5033a0){return[];}return rta[_0x07ca('0x26')](_0x5033a0,_0x1b56a4);})[_0x07ca('0x18')](function(_0x2af06e){_0x32627e=_0x2af06e;return rta[_0x07ca('0x27')]();})[_0x07ca('0x18')](function(_0xaa496){_0x5d6b40=_0xaa496['rows'];if((!_0x48a00e||_0x4cb0e2)&&!_0x21bdc2){return _0x32627e;}if(_0x21bdc2&&!_0x48a00e){return rta[_0x07ca('0x28')](_0x5d6b40,_0x32627e,_0x21bdc2);}else{return rta[_0x07ca('0x29')](_0x5d6b40,_0x32627e,_0x48a00e);}})['then'](function(_0xff4f25){_0x32627e=_0xff4f25;var _0x24072c=![];if(_0x32627e[_0x07ca('0x2a')]===0x0){if(_0x5033a0||_0x48a00e){_0x24072c=!![];}if(_0x4cb0e2){_0x24072c=![];}}if(_0x24072c){return _0x1e73fd;}var _0x26632b=_[_0x07ca('0x2b')](db[_0x07ca('0x2c')]['rawAttributes'],function(_0x42d68a){return{'name':_0x42d68a[_0x07ca('0x2d')],'type':_0x42d68a[_0x07ca('0x2e')]['key']};});_0x4b3917['query'][_0x07ca('0x2f')]=_0x07ca('0x30');_0x5bc08a=qs[_0x07ca('0x31')](_0x26632b,_0x4b3917);_0x5bc08a[_0x07ca('0x32')]=!![];var _0x5f25e8=[];if(_0x32627e[_0x07ca('0x2a')]>0x0){_0x5f25e8[_0x07ca('0x33')]({'id':{'$in':_0x32627e}});if(_0x21bdc2&&!_0x48a00e){_0x2ad3eb=[db['sequelize'][_0x07ca('0x34')](_0x07ca('0x35')+_0x32627e+')')];_0x5bc08a[_0x07ca('0x25')]=_0x2ad3eb;}}if(_0x4cb0e2){_0x52049d[_0x07ca('0x36')](function(_0x2dad36){var _0x2c7fc0=!![];if(_0x48a00e===_0x07ca('0x37')&&_0x1b56a4!==_0x2dad36){_0x2c7fc0=![];}_0x5f25e8[_0x07ca('0x33')]({[_0x2dad36+_0x07ca('0x38')]:_0x2c7fc0});});if(_0x1e2faf){_0x5f25e8['push']({'pauseType':_0x1e2faf});}}else if(_0x48a00e){_0x52049d[_0x07ca('0x36')](function(_0x4a9811){_0x5f25e8['push']({[_0x4a9811+'Pause']:![]});});}_0x5bc08a[_0x07ca('0x39')]=_[_0x07ca('0x3a')](_0x5bc08a[_0x07ca('0x39')],{'$and':_0x5f25e8});if(_0x4b3917[_0x07ca('0x3b')][_0x07ca('0x2f')]===_0x07ca('0x3b')){var _0x3064fa={'params':{'id':_0x4b3917[_0x07ca('0x3b')][_0x07ca('0x3c')]},'query':{'section':_0x07ca('0x3d'),'role':_0x07ca('0x30'),'raw':!![],'ids':_0x32627e,'customSorting':_0x2ad3eb}};if(_0x4b3917['query'][_0x07ca('0x3e')]){_0x3064fa[_0x07ca('0x12')][_0x07ca('0x3e')]=!![];}if(_0x4cb0e2){_0x3064fa['query'][_0x07ca('0x3f')]=_0x5f25e8;}_0x3064fa['query']=Object['assign'](_0x3064fa['query'],_0x4b3917[_0x07ca('0x12')]);return db[_0x07ca('0x40')][_0x07ca('0x41')](_0x3064fa);}return db['User'][_0x07ca('0x42')](_0x5bc08a);})[_0x07ca('0x18')](function(_0x320825){_0x1e73fd[_0x07ca('0xa')]=_0x320825[_0x07ca('0xa')];_0x48447f=_0x320825['rows'];return _0x48447f[_0x07ca('0x2b')](function(_0x1fe59a){var _0x471ab8=_[_0x07ca('0x43')](_0x5d6b40,['id',_0x1fe59a['id']]);if(_0x471ab8){var _0x562506=rta[_0x07ca('0x44')](_0x471ab8);_[_0x07ca('0x3a')](_0x1fe59a,_0x562506);}_0x1fe59a[_0x07ca('0x20')]=rta[_0x07ca('0x45')](_0x1fe59a);if(_0x1fe59a[_0x07ca('0x20')]['includes'](_0x07ca('0x16'))){_0x52049d[_0x07ca('0x36')](function(_0x459d18){if(_0x1fe59a[_0x459d18+_0x07ca('0x38')]){if(_0x459d18===_0x07ca('0x46')){if(_0x1fe59a[_0x07ca('0x47')]!==_0x07ca('0x48')){_0x1fe59a['voiceStatus']=_0x07ca('0x16');}}else{_0x1fe59a[_0x459d18+_0x07ca('0x49')]='pause';}}});}return _0x1fe59a;});})[_0x07ca('0x18')](function(_0x58ebc1){if(!_0x21bdc2||_0x2ad3eb){return _0x58ebc1;}return rta[_0x07ca('0x4a')](_0x58ebc1,_0x21bdc2);})[_0x07ca('0x18')](function(_0x474edb){var _0x17576d=rta['getRealtimeAgentsQueryFields']();_0x1e73fd[_0x07ca('0x4b')]=_0x474edb[_0x07ca('0x2b')](function(_0x4bfbbd){return _[_0x07ca('0x4c')](_0x4bfbbd,_0x17576d);});return _0x1e73fd;})['then'](respondWithFilteredResult(_0x33ea7b,_0x5bc08a))[_0x07ca('0x4d')](APIHandleError(_0x33ea7b));};exports[_0x07ca('0x4e')]=function(_0x281d87,_0x3f9490){var _0x2cc4ac={'count':0x0,'rows':[]};var _0x271a94={};var _0x1d1f5d;var _0x351949;var _0x463c96;Promise[_0x07ca('0x17')]()[_0x07ca('0x18')](function(){if(_0x281d87['query'][_0x07ca('0x1a')]){if(!utils[_0x07ca('0x19')](_0x281d87[_0x07ca('0x12')]['channel'])){throw new APIBadRequestError(util[_0x07ca('0x1b')](_0x07ca('0x1c'),_0x281d87[_0x07ca('0x12')][_0x07ca('0x1a')]));}_0x1d1f5d=_0x281d87[_0x07ca('0x12')][_0x07ca('0x1a')][_0x07ca('0x1d')]();}var _0x568eec=_['startCase'](_0x1d1f5d)+'Queue';var _0x175ac6=_['map'](db[_0x568eec]['rawAttributes'],function(_0xf438c6){return{'name':_0xf438c6[_0x07ca('0x2d')],'type':_0xf438c6[_0x07ca('0x2e')][_0x07ca('0x4f')]};});if(!_0x281d87[_0x07ca('0x12')][_0x07ca('0x23')]){var _0x555aa6=['id','name'];if(_0x1d1f5d===_0x07ca('0x46')){_0x555aa6[_0x07ca('0x33')](_0x07ca('0x2e'));if(_0x281d87['query'][_0x07ca('0x2e')]==='outbound'){_0x555aa6[_0x07ca('0x33')](['dialActive','dialMethod']);}}_0x281d87[_0x07ca('0x12')][_0x07ca('0x23')]=_0x555aa6['join'](',');}_0x271a94=qs['getOptions'](_0x175ac6,_0x281d87);if(_0x281d87[_0x07ca('0x3b')][_0x07ca('0x2f')]==='user'){var _0x57a53e={'params':{'id':_0x281d87['user'][_0x07ca('0x3c')]},'query':{'section':_0x1d1f5d===_0x07ca('0x46')&&_0x281d87[_0x07ca('0x12')]['type']==='outbound'?_0x07ca('0x50'):_['startCase'](_0x1d1f5d)+_0x07ca('0x51'),'type':_0x281d87['query']['type'],'nolimit':!![],'sort':_0x07ca('0x52'),'filter':_0x281d87[_0x07ca('0x12')][_0x07ca('0x53')]}};_0x57a53e['query']=Object['assign'](_0x57a53e[_0x07ca('0x12')],_0x281d87[_0x07ca('0x12')]);delete _0x57a53e[_0x07ca('0x12')]['id'];return db[_0x07ca('0x40')]['getResources'](_0x57a53e);}return db[_0x568eec]['findAndCountAll'](_0x271a94);})[_0x07ca('0x18')](function(_0xadc30c){_0x2cc4ac[_0x07ca('0xa')]=_0xadc30c['count'];_0x351949=_0xadc30c[_0x07ca('0x4b')];return rtq[_0x07ca('0x54')](_0x281d87,_0x1d1f5d);})['then'](function(_0x2736ad){_0x463c96=_0x2736ad[_0x07ca('0x4b')];return rtq[_0x07ca('0x55')](_0x351949,_0x463c96,_0x1d1f5d,_0x281d87[_0x07ca('0x12')][_0x07ca('0x2e')]);})['then'](function(_0x176ceb){_0x2cc4ac[_0x07ca('0x4b')]=_0x176ceb;return _0x2cc4ac;})[_0x07ca('0x18')](respondWithFilteredResult(_0x3f9490,_0x271a94))[_0x07ca('0x4d')](APIHandleError(_0x3f9490));}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index cbae31a..16e9420 100644 --- a/server/api/reportAgentPreview/index.js +++ b/server/api/reportAgentPreview/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x35ca5b,_0x6cdf03){var _0x39d6d9=function(_0x5c0e9e){while(--_0x5c0e9e){_0x35ca5b['push'](_0x35ca5b['shift']());}};_0x39d6d9(++_0x6cdf03);}(_0xedd9,0xfc));var _0x9edd=function(_0x5d1cd8,_0x569af8){_0x5d1cd8=_0x5d1cd8-0x0;var _0xd15a30=_0xedd9[_0x5d1cd8];return _0xd15a30;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');module[_0x9edd('0x8')]=router; \ No newline at end of file +var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x233ef0,_0x5bb5ed){var _0x58c405=function(_0x1f43f7){while(--_0x1f43f7){_0x233ef0['push'](_0x233ef0['shift']());}};_0x58c405(++_0x5bb5ed);}(_0xe706,0xa3));var _0x6e70=function(_0x192ec2,_0xc3a237){_0x192ec2=_0x192ec2-0x0;var _0x4abd11=_0xe706[_0x192ec2];return _0x4abd11;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.attributes.js b/server/api/reportAgentPreview/reportAgentPreview.attributes.js index 5166270..9308c37 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 _0xc029=['exports','INTEGER','STRING','DATE','sequelize'];(function(_0x104b96,_0x1968f3){var _0x55cdbd=function(_0x45a723){while(--_0x45a723){_0x104b96['push'](_0x104b96['shift']());}};_0x55cdbd(++_0x1968f3);}(_0xc029,0x1df));var _0x9c02=function(_0x343dab,_0x134185){_0x343dab=_0x343dab-0x0;var _0xa7e52d=_0xc029[_0x343dab];return _0xa7e52d;};'use strict';var Sequelize=require(_0x9c02('0x0'));module[_0x9c02('0x1')]={'state':{'type':Sequelize[_0x9c02('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x9c02('0x3')]},'scheduledat':{'type':Sequelize[_0x9c02('0x4')]},'uniqueid':{'type':Sequelize[_0x9c02('0x3')]},'starttime':{'type':Sequelize[_0x9c02('0x4')]},'responsetime':{'type':Sequelize[_0x9c02('0x4')]},'ringtime':{'type':Sequelize[_0x9c02('0x2')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x9c02('0x3')]},'campaigntype':{'type':Sequelize[_0x9c02('0x3')]},'membername':{'type':Sequelize[_0x9c02('0x3')]}}; \ No newline at end of file +var _0x1298=['DATE','INTEGER','exports','STRING'];(function(_0x5c8fc3,_0x1cb71a){var _0x262ac7=function(_0x1e0dc7){while(--_0x1e0dc7){_0x5c8fc3['push'](_0x5c8fc3['shift']());}};_0x262ac7(++_0x1cb71a);}(_0x1298,0x19e));var _0x8129=function(_0x5a278b,_0x31cf6a){_0x5a278b=_0x5a278b-0x0;var _0x280554=_0x1298[_0x5a278b];return _0x280554;};'use strict';var Sequelize=require('sequelize');module[_0x8129('0x0')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0x8129('0x1')]},'scheduledat':{'type':Sequelize[_0x8129('0x2')]},'uniqueid':{'type':Sequelize[_0x8129('0x1')]},'starttime':{'type':Sequelize[_0x8129('0x2')]},'responsetime':{'type':Sequelize[_0x8129('0x2')]},'ringtime':{'type':Sequelize[_0x8129('0x3')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x8129('0x1')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x8129('0x1')]}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index 98e0505..0b46fb4 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 _0x25fb=['request-promise','path','../../config/environment','./reportAgentPreview.attributes','exports','define','report_agent_preview','lodash','util','../../config/logger','api','moment'];(function(_0x4c361c,_0x56d458){var _0x3415b1=function(_0x8dce1a){while(--_0x8dce1a){_0x4c361c['push'](_0x4c361c['shift']());}};_0x3415b1(++_0x56d458);}(_0x25fb,0x1ab));var _0xb25f=function(_0x2b5b8e,_0x33d71f){_0x2b5b8e=_0x2b5b8e-0x0;var _0xfb2055=_0x25fb[_0x2b5b8e];return _0xfb2055;};'use strict';var _=require(_0xb25f('0x0'));var util=require(_0xb25f('0x1'));var logger=require(_0xb25f('0x2'))(_0xb25f('0x3'));var moment=require(_0xb25f('0x4'));var BPromise=require('bluebird');var rp=require(_0xb25f('0x5'));var fs=require('fs');var path=require(_0xb25f('0x6'));var rimraf=require('rimraf');var config=require(_0xb25f('0x7'));var attributes=require(_0xb25f('0x8'));module[_0xb25f('0x9')]=function(_0x3a7efc,_0x566995){return _0x3a7efc[_0xb25f('0xa')]('ReportAgentPreview',attributes,{'tableName':_0xb25f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x101f=['define','report_agent_preview','lodash','util','api','moment','path','./reportAgentPreview.attributes','exports'];(function(_0x5c351c,_0x2046d8){var _0x26f3b3=function(_0x47ac18){while(--_0x47ac18){_0x5c351c['push'](_0x5c351c['shift']());}};_0x26f3b3(++_0x2046d8);}(_0x101f,0x92));var _0xf101=function(_0xc47d86,_0x5de3dd){_0xc47d86=_0xc47d86-0x0;var _0x951916=_0x101f[_0xc47d86];return _0x951916;};'use strict';var _=require(_0xf101('0x0'));var util=require(_0xf101('0x1'));var logger=require('../../config/logger')(_0xf101('0x2'));var moment=require(_0xf101('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xf101('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xf101('0x5'));module[_0xf101('0x6')]=function(_0x5501eb,_0x36205c){return _0x5501eb[_0xf101('0x7')]('ReportAgentPreview',attributes,{'tableName':_0xf101('0x8'),'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 dc09783..6a6ce4d 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 _0x3eeb=['request\x20sent','debug','stringify','error','code','message','result','CreateReportAgentPreview','ReportAgentPreview','create','body','options','raw','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','ReportAgentPreview,\x20%s,\x20%s'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x3eeb,0x1f3));var _0xb3ee=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x3eeb[_0x1ac595];return _0x455fff;};'use strict';var _=require('lodash');var util=require(_0xb3ee('0x0'));var moment=require(_0xb3ee('0x1'));var BPromise=require(_0xb3ee('0x2'));var rs=require(_0xb3ee('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb3ee('0x4'))['db'];var utils=require(_0xb3ee('0x5'));var logger=require(_0xb3ee('0x6'))('rpc');var config=require(_0xb3ee('0x7'));var jayson=require(_0xb3ee('0x8'));var client=jayson[_0xb3ee('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x58a2ff,_0x28a847,_0x62c920){return new BPromise(function(_0x2f8cb3,_0x37e0ad){return client[_0xb3ee('0xa')](_0x58a2ff,_0x62c920)[_0xb3ee('0xb')](function(_0x45dd32){logger[_0xb3ee('0xc')](_0xb3ee('0xd'),_0x28a847,_0xb3ee('0xe'));logger[_0xb3ee('0xf')]('ReportAgentPreview,\x20%s,\x20%s,\x20%s',_0x28a847,_0xb3ee('0xe'),JSON[_0xb3ee('0x10')](_0x45dd32));if(_0x45dd32[_0xb3ee('0x11')]){if(_0x45dd32[_0xb3ee('0x11')][_0xb3ee('0x12')]===0x1f4){logger[_0xb3ee('0x11')](_0xb3ee('0xd'),_0x28a847,_0x45dd32[_0xb3ee('0x11')][_0xb3ee('0x13')]);return _0x37e0ad(_0x45dd32[_0xb3ee('0x11')][_0xb3ee('0x13')]);}logger[_0xb3ee('0x11')]('ReportAgentPreview,\x20%s,\x20%s',_0x28a847,_0x45dd32[_0xb3ee('0x11')]['message']);return _0x2f8cb3(_0x45dd32[_0xb3ee('0x11')][_0xb3ee('0x13')]);}else{logger['info']('ReportAgentPreview,\x20%s,\x20%s',_0x28a847,_0xb3ee('0xe'));_0x2f8cb3(_0x45dd32[_0xb3ee('0x14')][_0xb3ee('0x13')]);}})['catch'](function(_0x58bf3e){logger[_0xb3ee('0x11')](_0xb3ee('0xd'),_0x28a847,_0x58bf3e);_0x37e0ad(_0x58bf3e);});});}exports[_0xb3ee('0x15')]=function(_0x17b869){var _0x22228a=this;return new Promise(function(_0x3a4d28,_0x1bbb76){return db[_0xb3ee('0x16')][_0xb3ee('0x17')](_0x17b869[_0xb3ee('0x18')],{'raw':_0x17b869[_0xb3ee('0x19')]?_0x17b869[_0xb3ee('0x19')][_0xb3ee('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x369d61){logger[_0xb3ee('0xc')]('CreateReportAgentPreview',_0x17b869);logger['debug']('CreateReportAgentPreview',_0x17b869,JSON[_0xb3ee('0x10')](_0x369d61));_0x3a4d28(_0x369d61);})['catch'](function(_0x4c484){logger[_0xb3ee('0x11')](_0xb3ee('0x15'),_0x4c484['message'],_0x17b869);_0x1bbb76(_0x22228a[_0xb3ee('0x11')](0x1f4,_0x4c484[_0xb3ee('0x13')]));});});}; \ No newline at end of file +var _0xb810=['options','raw','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','then','info','ReportAgentPreview,\x20%s,\x20%s','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','CreateReportAgentPreview','ReportAgentPreview','create','body'];(function(_0xe97e4c,_0x486a93){var _0x2a2f09=function(_0x4a7575){while(--_0x4a7575){_0xe97e4c['push'](_0xe97e4c['shift']());}};_0x2a2f09(++_0x486a93);}(_0xb810,0x8a));var _0x0b81=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xb810[_0x122ef9];return _0x42fba0;};'use strict';var _=require('lodash');var util=require(_0x0b81('0x0'));var moment=require(_0x0b81('0x1'));var BPromise=require(_0x0b81('0x2'));var rs=require(_0x0b81('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0b81('0x4'))['db'];var utils=require(_0x0b81('0x5'));var logger=require(_0x0b81('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x0b81('0x7'));var client=jayson[_0x0b81('0x8')][_0x0b81('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2f64d7,_0x368955,_0x41ca94){return new BPromise(function(_0x14cf43,_0xd52c13){return client['request'](_0x2f64d7,_0x41ca94)[_0x0b81('0xa')](function(_0x1fed9b){logger[_0x0b81('0xb')](_0x0b81('0xc'),_0x368955,'request\x20sent');logger[_0x0b81('0xd')](_0x0b81('0xe'),_0x368955,_0x0b81('0xf'),JSON[_0x0b81('0x10')](_0x1fed9b));if(_0x1fed9b[_0x0b81('0x11')]){if(_0x1fed9b[_0x0b81('0x11')]['code']===0x1f4){logger[_0x0b81('0x11')](_0x0b81('0xc'),_0x368955,_0x1fed9b[_0x0b81('0x11')][_0x0b81('0x12')]);return _0xd52c13(_0x1fed9b[_0x0b81('0x11')][_0x0b81('0x12')]);}logger[_0x0b81('0x11')](_0x0b81('0xc'),_0x368955,_0x1fed9b[_0x0b81('0x11')][_0x0b81('0x12')]);return _0x14cf43(_0x1fed9b[_0x0b81('0x11')][_0x0b81('0x12')]);}else{logger[_0x0b81('0xb')](_0x0b81('0xc'),_0x368955,_0x0b81('0xf'));_0x14cf43(_0x1fed9b[_0x0b81('0x13')][_0x0b81('0x12')]);}})['catch'](function(_0x1d7a47){logger[_0x0b81('0x11')](_0x0b81('0xc'),_0x368955,_0x1d7a47);_0xd52c13(_0x1d7a47);});});}exports[_0x0b81('0x14')]=function(_0x1809db){var _0x1cfe2a=this;return new Promise(function(_0x279a69,_0x214b83){return db[_0x0b81('0x15')][_0x0b81('0x16')](_0x1809db[_0x0b81('0x17')],{'raw':_0x1809db['options']?_0x1809db[_0x0b81('0x18')][_0x0b81('0x19')]===undefined?!![]:![]:!![]})[_0x0b81('0xa')](function(_0x1e4b93){logger['info'](_0x0b81('0x14'),_0x1809db);logger[_0x0b81('0xd')](_0x0b81('0x14'),_0x1809db,JSON[_0x0b81('0x10')](_0x1e4b93));_0x279a69(_0x1e4b93);})[_0x0b81('0x1a')](function(_0x546b39){logger[_0x0b81('0x11')]('CreateReportAgentPreview',_0x546b39[_0x0b81('0x12')],_0x1809db);_0x214b83(_0x1cfe2a[_0x0b81('0x11')](0x1f4,_0x546b39['message']));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index 5e3adf0..b6fa61b 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 _0x89e0=['/trunks','/campaigns','campaigns','/fax/accounts','faxAccounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','/sms/queues/waitinginteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','post','/mail/queues/:id/notify','queueNotify','mail','/mail/queues/:id','/chat/queues/:id/notify','chat','/chat/queues/:id','showChatQueues','/fax/queues/:id/notify','fax','/fax/queues/:id','/openchannel/queues/:id/notify','openchannel','/openchannel/queues/:id','showOpenchannelQueues','/sms/queues/:id/notify','sms','/whatsapp/queues/:id/notify','/sms/queues/:id','showSmsQueues','showWhatsappQueues','agentNotify','exports','multer','util','path','express','Router','../../components/auth/service','./rpc.controller','get','/voice/channels','voiceChannels','/voice/channels/:uniqueid/mixmonitor','isAuthenticated','voiceChannelStopMixMonitor','voiceQueues','/chat/queues','/mail/queues','/mail/accounts','/openchannel/queues','openchannelQueues','smsQueues','whatsappQueues','/fax/queues','faxQueues','/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels','/voice/queues/channels/:uniqueid','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','showVoiceQueues','put','/voice/queues/:id','/outbound','outbound','/outbound/channels','outboundChannels','/agents','agents','agentCapacity','/telephones','telephones'];(function(_0x12df10,_0x4ed4bc){var _0xc08e49=function(_0x52920f){while(--_0x52920f){_0x12df10['push'](_0x12df10['shift']());}};_0xc08e49(++_0x4ed4bc);}(_0x89e0,0x1cd));var _0x089e=function(_0x46c6e1,_0x3e103d){_0x46c6e1=_0x46c6e1-0x0;var _0x23f5dd=_0x89e0[_0x46c6e1];return _0x23f5dd;};'use strict';var multer=require(_0x089e('0x0'));var util=require(_0x089e('0x1'));var path=require(_0x089e('0x2'));var express=require(_0x089e('0x3'));var router=express[_0x089e('0x4')]();var auth=require(_0x089e('0x5'));var controller=require(_0x089e('0x6'));router[_0x089e('0x7')](_0x089e('0x8'),auth['isAuthenticated'](),controller[_0x089e('0x9')]);router[_0x089e('0x7')](_0x089e('0xa'),auth[_0x089e('0xb')](),controller['voiceChannelMixMonitor']);router['get']('/voice/channels/:uniqueid/stopmixmonitor',auth[_0x089e('0xb')](),controller[_0x089e('0xc')]);router[_0x089e('0x7')]('/voice/queues',auth[_0x089e('0xb')](),controller[_0x089e('0xd')]);router[_0x089e('0x7')](_0x089e('0xe'),auth[_0x089e('0xb')](),controller['chatQueues']);router[_0x089e('0x7')](_0x089e('0xf'),auth[_0x089e('0xb')](),controller['mailQueues']);router[_0x089e('0x7')](_0x089e('0x10'),auth['isAuthenticated'](),controller['mailAccounts']);router[_0x089e('0x7')](_0x089e('0x11'),auth[_0x089e('0xb')](),controller[_0x089e('0x12')]);router[_0x089e('0x7')]('/sms/queues',auth[_0x089e('0xb')](),controller[_0x089e('0x13')]);router['get']('/whatsapp/queues',auth[_0x089e('0xb')](),controller[_0x089e('0x14')]);router[_0x089e('0x7')](_0x089e('0x15'),auth[_0x089e('0xb')](),controller[_0x089e('0x16')]);router[_0x089e('0x7')](_0x089e('0x17'),auth['isAuthenticated'](),controller[_0x089e('0x18')]);router['get'](_0x089e('0x19'),auth[_0x089e('0xb')](),controller['voiceQueuesChannels']);router['get'](_0x089e('0x1a'),auth[_0x089e('0xb')](),controller[_0x089e('0x1b')]);router[_0x089e('0x7')](_0x089e('0x1c'),auth[_0x089e('0xb')](),controller['voiceQueuesChannelHangup']);router[_0x089e('0x7')](_0x089e('0x1d'),auth[_0x089e('0xb')](),controller[_0x089e('0x1e')]);router['get']('/voice/queues/:id',auth[_0x089e('0xb')](),controller[_0x089e('0x1f')]);router[_0x089e('0x20')](_0x089e('0x21'),auth[_0x089e('0xb')](),controller['updateVoiceQueue']);router[_0x089e('0x7')](_0x089e('0x22'),auth[_0x089e('0xb')](),controller[_0x089e('0x23')]);router[_0x089e('0x7')](_0x089e('0x24'),auth[_0x089e('0xb')](),controller[_0x089e('0x25')]);router[_0x089e('0x7')](_0x089e('0x26'),auth[_0x089e('0xb')](),controller[_0x089e('0x27')]);router['put']('/agents/:id/capacity',auth['isAuthenticated'](),controller[_0x089e('0x28')]);router[_0x089e('0x7')](_0x089e('0x29'),auth[_0x089e('0xb')](),controller[_0x089e('0x2a')]);router[_0x089e('0x7')](_0x089e('0x2b'),auth[_0x089e('0xb')](),controller['trunks']);router['get'](_0x089e('0x2c'),auth[_0x089e('0xb')](),controller[_0x089e('0x2d')]);router[_0x089e('0x7')](_0x089e('0x2e'),auth[_0x089e('0xb')](),controller[_0x089e('0x2f')]);router[_0x089e('0x7')](_0x089e('0x30'),auth[_0x089e('0xb')](),controller[_0x089e('0x31')]);router['get'](_0x089e('0x32'),auth[_0x089e('0xb')](),controller[_0x089e('0x33')]);router[_0x089e('0x7')](_0x089e('0x34'),auth[_0x089e('0xb')](),controller[_0x089e('0x35')]);router[_0x089e('0x7')](_0x089e('0x36'),auth[_0x089e('0xb')](),controller['openchannelQueuesIdWaitingInteractions']);router[_0x089e('0x7')](_0x089e('0x37'),auth[_0x089e('0xb')](),controller['smsQueuesWaitingInteractions']);router[_0x089e('0x7')](_0x089e('0x38'),auth[_0x089e('0xb')](),controller[_0x089e('0x39')]);router[_0x089e('0x7')](_0x089e('0x3a'),auth['isAuthenticated'](),controller[_0x089e('0x3b')]);router[_0x089e('0x3c')](_0x089e('0x3d'),auth[_0x089e('0xb')](),controller[_0x089e('0x3e')](_0x089e('0x3f')));router[_0x089e('0x7')](_0x089e('0x40'),auth[_0x089e('0xb')](),controller['showMailQueues']);router[_0x089e('0x3c')](_0x089e('0x41'),auth[_0x089e('0xb')](),controller['queueNotify'](_0x089e('0x42')));router['get'](_0x089e('0x43'),auth['isAuthenticated'](),controller[_0x089e('0x44')]);router[_0x089e('0x3c')](_0x089e('0x45'),auth['isAuthenticated'](),controller[_0x089e('0x3e')](_0x089e('0x46')));router[_0x089e('0x7')](_0x089e('0x47'),auth['isAuthenticated'](),controller['showFaxQueues']);router['post'](_0x089e('0x48'),auth[_0x089e('0xb')](),controller[_0x089e('0x3e')](_0x089e('0x49')));router[_0x089e('0x7')](_0x089e('0x4a'),auth[_0x089e('0xb')](),controller[_0x089e('0x4b')]);router[_0x089e('0x3c')](_0x089e('0x4c'),auth['isAuthenticated'](),controller[_0x089e('0x3e')](_0x089e('0x4d')));router[_0x089e('0x3c')](_0x089e('0x4e'),auth['isAuthenticated'](),controller[_0x089e('0x3e')]('whatsapp'));router['get'](_0x089e('0x4f'),auth[_0x089e('0xb')](),controller[_0x089e('0x50')]);router[_0x089e('0x7')]('/whatsapp/queues/:id',auth[_0x089e('0xb')](),controller[_0x089e('0x51')]);router['post']('/agents/:id/notify',auth['isAuthenticated'](),controller[_0x089e('0x52')]);module[_0x089e('0x53')]=router; \ No newline at end of file +var _0x937f=['showWhatsappQueues','agentNotify','exports','multer','path','express','Router','../../components/auth/service','./rpc.controller','get','isAuthenticated','/voice/channels/:uniqueid/mixmonitor','/voice/channels/:uniqueid/stopmixmonitor','/voice/queues','voiceQueues','/chat/queues','chatQueues','mailQueues','mailAccounts','/openchannel/queues','openchannelQueues','/sms/queues','smsQueues','/whatsapp/queues','/fax/queues','faxQueues','/voice/queues/preview/:id','/voice/queues/channels','voiceQueuesChannels','voiceQueuesChannel','voiceQueuesChannelHangup','voiceQueuesChannelRedirect','/voice/queues/:id','showVoiceQueues','/outbound','outbound','/outbound/channels','outboundChannels','/agents/:id/capacity','/telephones','/trunks','trunks','/campaigns','campaigns','/fax/accounts','faxAccounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','/mail/queues/:id/notify','mail','/mail/queues/:id','post','/chat/queues/:id/notify','queueNotify','chat','/fax/queues/:id/notify','/fax/queues/:id','showFaxQueues','/openchannel/queues/:id/notify','/openchannel/queues/:id','/sms/queues/:id/notify','whatsapp','showSmsQueues','/whatsapp/queues/:id'];(function(_0x308d9f,_0x36733d){var _0x2bfbe8=function(_0x43cb64){while(--_0x43cb64){_0x308d9f['push'](_0x308d9f['shift']());}};_0x2bfbe8(++_0x36733d);}(_0x937f,0x175));var _0xf937=function(_0x41232a,_0x20440d){_0x41232a=_0x41232a-0x0;var _0x1ab731=_0x937f[_0x41232a];return _0x1ab731;};'use strict';var multer=require(_0xf937('0x0'));var util=require('util');var path=require(_0xf937('0x1'));var express=require(_0xf937('0x2'));var router=express[_0xf937('0x3')]();var auth=require(_0xf937('0x4'));var controller=require(_0xf937('0x5'));router[_0xf937('0x6')]('/voice/channels',auth[_0xf937('0x7')](),controller['voiceChannels']);router[_0xf937('0x6')](_0xf937('0x8'),auth[_0xf937('0x7')](),controller['voiceChannelMixMonitor']);router['get'](_0xf937('0x9'),auth[_0xf937('0x7')](),controller['voiceChannelStopMixMonitor']);router['get'](_0xf937('0xa'),auth[_0xf937('0x7')](),controller[_0xf937('0xb')]);router['get'](_0xf937('0xc'),auth['isAuthenticated'](),controller[_0xf937('0xd')]);router[_0xf937('0x6')]('/mail/queues',auth[_0xf937('0x7')](),controller[_0xf937('0xe')]);router[_0xf937('0x6')]('/mail/accounts',auth[_0xf937('0x7')](),controller[_0xf937('0xf')]);router[_0xf937('0x6')](_0xf937('0x10'),auth[_0xf937('0x7')](),controller[_0xf937('0x11')]);router[_0xf937('0x6')](_0xf937('0x12'),auth[_0xf937('0x7')](),controller[_0xf937('0x13')]);router[_0xf937('0x6')](_0xf937('0x14'),auth[_0xf937('0x7')](),controller['whatsappQueues']);router[_0xf937('0x6')](_0xf937('0x15'),auth[_0xf937('0x7')](),controller[_0xf937('0x16')]);router[_0xf937('0x6')](_0xf937('0x17'),auth[_0xf937('0x7')](),controller['voiceQueuesPreview']);router[_0xf937('0x6')](_0xf937('0x18'),auth[_0xf937('0x7')](),controller[_0xf937('0x19')]);router[_0xf937('0x6')]('/voice/queues/channels/:uniqueid',auth[_0xf937('0x7')](),controller[_0xf937('0x1a')]);router[_0xf937('0x6')]('/voice/queues/channels/:uniqueid/hangup',auth['isAuthenticated'](),controller[_0xf937('0x1b')]);router[_0xf937('0x6')]('/voice/queues/channels/:uniqueid/redirect/:exten',auth[_0xf937('0x7')](),controller[_0xf937('0x1c')]);router[_0xf937('0x6')](_0xf937('0x1d'),auth[_0xf937('0x7')](),controller[_0xf937('0x1e')]);router['put'](_0xf937('0x1d'),auth[_0xf937('0x7')](),controller['updateVoiceQueue']);router[_0xf937('0x6')](_0xf937('0x1f'),auth[_0xf937('0x7')](),controller[_0xf937('0x20')]);router[_0xf937('0x6')](_0xf937('0x21'),auth[_0xf937('0x7')](),controller[_0xf937('0x22')]);router[_0xf937('0x6')]('/agents',auth[_0xf937('0x7')](),controller['agents']);router['put'](_0xf937('0x23'),auth[_0xf937('0x7')](),controller['agentCapacity']);router[_0xf937('0x6')](_0xf937('0x24'),auth[_0xf937('0x7')](),controller['telephones']);router['get'](_0xf937('0x25'),auth[_0xf937('0x7')](),controller[_0xf937('0x26')]);router[_0xf937('0x6')](_0xf937('0x27'),auth[_0xf937('0x7')](),controller[_0xf937('0x28')]);router[_0xf937('0x6')](_0xf937('0x29'),auth[_0xf937('0x7')](),controller[_0xf937('0x2a')]);router['get'](_0xf937('0x2b'),auth[_0xf937('0x7')](),controller[_0xf937('0x2c')]);router[_0xf937('0x6')](_0xf937('0x2d'),auth[_0xf937('0x7')](),controller[_0xf937('0x2e')]);router['get'](_0xf937('0x2f'),auth['isAuthenticated'](),controller[_0xf937('0x30')]);router['get']('/openchannel/queues/:id/waitinginteractions',auth['isAuthenticated'](),controller[_0xf937('0x31')]);router[_0xf937('0x6')]('/sms/queues/waitinginteractions',auth[_0xf937('0x7')](),controller[_0xf937('0x32')]);router[_0xf937('0x6')](_0xf937('0x33'),auth[_0xf937('0x7')](),controller[_0xf937('0x34')]);router[_0xf937('0x6')](_0xf937('0x35'),auth[_0xf937('0x7')](),controller[_0xf937('0x36')]);router['post'](_0xf937('0x37'),auth[_0xf937('0x7')](),controller['queueNotify'](_0xf937('0x38')));router[_0xf937('0x6')](_0xf937('0x39'),auth[_0xf937('0x7')](),controller['showMailQueues']);router[_0xf937('0x3a')](_0xf937('0x3b'),auth[_0xf937('0x7')](),controller[_0xf937('0x3c')](_0xf937('0x3d')));router[_0xf937('0x6')]('/chat/queues/:id',auth[_0xf937('0x7')](),controller['showChatQueues']);router[_0xf937('0x3a')](_0xf937('0x3e'),auth[_0xf937('0x7')](),controller['queueNotify']('fax'));router[_0xf937('0x6')](_0xf937('0x3f'),auth[_0xf937('0x7')](),controller[_0xf937('0x40')]);router[_0xf937('0x3a')](_0xf937('0x41'),auth['isAuthenticated'](),controller[_0xf937('0x3c')]('openchannel'));router[_0xf937('0x6')](_0xf937('0x42'),auth[_0xf937('0x7')](),controller['showOpenchannelQueues']);router[_0xf937('0x3a')](_0xf937('0x43'),auth[_0xf937('0x7')](),controller[_0xf937('0x3c')]('sms'));router[_0xf937('0x3a')]('/whatsapp/queues/:id/notify',auth[_0xf937('0x7')](),controller[_0xf937('0x3c')](_0xf937('0x44')));router[_0xf937('0x6')]('/sms/queues/:id',auth[_0xf937('0x7')](),controller[_0xf937('0x45')]);router[_0xf937('0x6')](_0xf937('0x46'),auth[_0xf937('0x7')](),controller[_0xf937('0x47')]);router['post']('/agents/:id/notify',auth[_0xf937('0x7')](),controller[_0xf937('0x48')]);module[_0xf937('0x49')]=router; \ No newline at end of file diff --git a/server/api/rpc/rpc.controller.js b/server/api/rpc/rpc.controller.js index 8918f8a..5681af4 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 _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(_0x2d9f26,_0x10e8dd){var _0x5c7562=function(_0xc15ae9){while(--_0xc15ae9){_0x2d9f26['push'](_0x2d9f26['shift']());}};_0x5c7562(++_0x10e8dd);}(_0xb10b,0x12a));var _0xbb10=function(_0x50450d,_0x314c15){_0x50450d=_0x50450d-0x0;var _0x1c391b=_0xb10b[_0x50450d];return _0x1c391b;};'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 +var _0xbaf0=['MailQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','OpenchannelQueuesWaitingInteractions','type','filter','map','queue_id','value','indexOf','smsQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','capitalize','chat','Queue','findOne','\x20Queue\x20not\x20found','Message','messageId','Interaction','Account','\x20Message\x20not\x20found','update','queue','From','QueueId','TransferReport','create','Start','queueTransferTimeout','*,*,*,*','agentNotify','channel','Channel\x20field\x20is\x20mandatory','Website','Agent\x20not\x20found','InteractionId','agentTransferTimeout','moment','lodash','util','../../mysqldb','../../config/logger','api','client','http','request','then','error','code','message','result','status','sendStatus','stack','name','isNil','rows','voiceChannels','VoiceChannels','catch','voiceChannelMixMonitor','VoiceChannelMixMonitor','merge','query','params','VoiceChannelStopMixMonitor','voiceQueues','VoiceQueues','showVoiceQueues','updateVoiceQueue','UpdateVoiceQueue','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','voiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','Outbound','outboundChannels','OutboundChannels','agents','Agents','agentCapacity','body','interaction','user','hasOwnProperty','MemberReport','findAll','INTERACTION','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','findOrCreate','interface','SIP/%s','agent','internal','AgentCapacity','capacity','telephones','Telephones','trunks','Campaigns','chatQueues','ChatQueues','showChatQueues','MailQueues','showMailQueues','mailAccounts','openchannelQueues','OpenchannelQueues','smsQueues','showSmsQueues','WhatsappQueues','showWhatsappQueues','faxQueues','showFaxQueues','FaxQueues','faxAccounts','FaxAccounts','mailQueuesWaitingInteractions'];(function(_0x1c978f,_0x5d0883){var _0x177929=function(_0x399143){while(--_0x399143){_0x1c978f['push'](_0x1c978f['shift']());}};_0x177929(++_0x5d0883);}(_0xbaf0,0x12a));var _0x0baf=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xbaf0[_0x2b4411];return _0x8e41ef;};'use strict';var BPromise=require('bluebird');var moment=require(_0x0baf('0x0'));var _=require(_0x0baf('0x1'));var util=require(_0x0baf('0x2'));var db=require(_0x0baf('0x3'))['db'];var logger=require(_0x0baf('0x4'))(_0x0baf('0x5'));var jayson=require('jayson/promise');var amiClient=jayson[_0x0baf('0x6')][_0x0baf('0x7')]({'port':0x232a});var mailClient=jayson[_0x0baf('0x6')][_0x0baf('0x7')]({'port':0x232b});var routingClient=jayson[_0x0baf('0x6')][_0x0baf('0x7')]({'port':0x232c});function respondWithRpcPromise(_0x1a10b1,_0x2dcaac,_0x1d0a0d){return new BPromise(function(_0x5f5030,_0x11b947){var _0x5f20aa=_0x1d0a0d?_0x1d0a0d:amiClient;return _0x5f20aa[_0x0baf('0x8')](_0x1a10b1,_0x2dcaac)[_0x0baf('0x9')](function(_0x465528){if(_0x465528[_0x0baf('0xa')]){if(_0x465528[_0x0baf('0xa')][_0x0baf('0xb')]===0x1f4){return _0x11b947(_0x465528[_0x0baf('0xa')][_0x0baf('0xc')]);}return _0x5f5030(_0x465528[_0x0baf('0xa')][_0x0baf('0xc')]);}else{_0x5f5030(_0x465528[_0x0baf('0xd')]);}})['catch'](function(_0x5a53e2){_0x11b947(_0x5a53e2);});});}function respondWithResult(_0x465dd7,_0xe4378c){_0xe4378c=_0xe4378c||0xc8;return function(_0x5db689){if(_0x5db689){return _0x465dd7[_0x0baf('0xe')](_0xe4378c)['json'](_0x5db689);}return _0x465dd7[_0x0baf('0xf')](0x194);};}function handleError(_0x49e44b,_0x1c76a8){_0x1c76a8=_0x1c76a8||0x1f4;return function(_0x1f50c3){logger[_0x0baf('0xa')](_0x1f50c3[_0x0baf('0x10')]);if(_0x1f50c3[_0x0baf('0x11')]){delete _0x1f50c3[_0x0baf('0x11')];}_0x49e44b['status'](_0x1c76a8)['send'](_0x1f50c3);};}function findById(_0x2312c7){return function(_0x38395b){if(!_[_0x0baf('0x12')](_0x2312c7)&&!_[_0x0baf('0x12')](_0x38395b)&&!_[_0x0baf('0x12')](_0x38395b[_0x0baf('0x13')])){return _['find'](_0x38395b[_0x0baf('0x13')],function(_0xfbecec){return _0xfbecec['id']==_0x2312c7;});}return null;};}exports[_0x0baf('0x14')]=function(_0x3e9cb4,_0x47070d){return respondWithRpcPromise(_0x0baf('0x15'),_0x3e9cb4['query'])['then'](respondWithResult(_0x47070d,null))[_0x0baf('0x16')](handleError(_0x47070d,null));};exports[_0x0baf('0x17')]=function(_0x32e839,_0x1848e8){return respondWithRpcPromise(_0x0baf('0x18'),_[_0x0baf('0x19')](_0x32e839[_0x0baf('0x1a')],_0x32e839[_0x0baf('0x1b')]))[_0x0baf('0x9')](respondWithResult(_0x1848e8,null))[_0x0baf('0x16')](handleError(_0x1848e8,null));};exports['voiceChannelStopMixMonitor']=function(_0x334bd6,_0x482522){return respondWithRpcPromise(_0x0baf('0x1c'),_['merge'](_0x334bd6['query'],_0x334bd6[_0x0baf('0x1b')]))['then'](respondWithResult(_0x482522,null))['catch'](handleError(_0x482522,null));};exports[_0x0baf('0x1d')]=function(_0x27b59c,_0x34e264){return respondWithRpcPromise(_0x0baf('0x1e'),_0x27b59c[_0x0baf('0x1a')])['then'](respondWithResult(_0x34e264,null))[_0x0baf('0x16')](handleError(_0x34e264,null));};exports[_0x0baf('0x1f')]=function(_0x1ca35a,_0x366e71){return respondWithRpcPromise(_0x0baf('0x1e'),_0x1ca35a[_0x0baf('0x1a')])[_0x0baf('0x9')](findById(_0x1ca35a['params']['id']))[_0x0baf('0x9')](respondWithResult(_0x366e71,null))[_0x0baf('0x16')](handleError(_0x366e71,null));};exports[_0x0baf('0x20')]=function(_0x265915,_0x55c715){return respondWithRpcPromise(_0x0baf('0x21'),_[_0x0baf('0x19')](_0x265915['body'],_0x265915[_0x0baf('0x1b')]))[_0x0baf('0x9')](respondWithResult(_0x55c715,null))[_0x0baf('0x16')](handleError(_0x55c715,null));};exports[_0x0baf('0x22')]=function(_0xd14f0f,_0x366924){return respondWithRpcPromise(_0x0baf('0x23'),_['merge'](_0xd14f0f[_0x0baf('0x1a')],_0xd14f0f[_0x0baf('0x1b')]))[_0x0baf('0x9')](respondWithResult(_0x366924,null))[_0x0baf('0x16')](handleError(_0x366924,null));};exports[_0x0baf('0x24')]=function(_0x275ea1,_0x2fc983){return respondWithRpcPromise(_0x0baf('0x25'),_0x275ea1[_0x0baf('0x1a')])[_0x0baf('0x9')](respondWithResult(_0x2fc983,null))[_0x0baf('0x16')](handleError(_0x2fc983,null));};exports[_0x0baf('0x26')]=function(_0x45294a,_0x3a3353){return respondWithRpcPromise('VoiceQueuesChannel',_[_0x0baf('0x19')](_0x45294a['query'],_0x45294a[_0x0baf('0x1b')]))[_0x0baf('0x9')](respondWithResult(_0x3a3353,null))[_0x0baf('0x16')](handleError(_0x3a3353,null));};exports[_0x0baf('0x27')]=function(_0x5300a5,_0x1a2b03){return respondWithRpcPromise(_0x0baf('0x28'),_['merge'](_0x5300a5[_0x0baf('0x1a')],_0x5300a5[_0x0baf('0x1b')]))[_0x0baf('0x9')](respondWithResult(_0x1a2b03,null))[_0x0baf('0x16')](handleError(_0x1a2b03,null));};exports[_0x0baf('0x29')]=function(_0x1b0991,_0xe03d82){return respondWithRpcPromise(_0x0baf('0x2a'),_['merge'](_0x1b0991[_0x0baf('0x1a')],_0x1b0991[_0x0baf('0x1b')]))['then'](respondWithResult(_0xe03d82,null))[_0x0baf('0x16')](handleError(_0xe03d82,null));};exports['outbound']=function(_0x5c545f,_0x11bc49){return respondWithRpcPromise(_0x0baf('0x2b'),_0x5c545f['query'])['then'](respondWithResult(_0x11bc49,null))[_0x0baf('0x16')](handleError(_0x11bc49,null));};exports[_0x0baf('0x2c')]=function(_0x3412bc,_0xb2d9ab){return respondWithRpcPromise(_0x0baf('0x2d'),_0x3412bc[_0x0baf('0x1a')])[_0x0baf('0x9')](respondWithResult(_0xb2d9ab,null))[_0x0baf('0x16')](handleError(_0xb2d9ab,null));};exports[_0x0baf('0x2e')]=function(_0x36c6d2,_0x200864){var _0x148540;return respondWithRpcPromise(_0x0baf('0x2f'),_0x36c6d2[_0x0baf('0x1a')])['then'](function(_0x3573ce){_0x148540=_0x3573ce;return respondWithRpcPromise(_0x0baf('0x2f'),_0x36c6d2['query'],routingClient);})[_0x0baf('0x9')](function(_0x324369){return _[_0x0baf('0x19')]({},_0x324369,_0x148540);})[_0x0baf('0x9')](respondWithResult(_0x200864,null))[_0x0baf('0x16')](handleError(_0x200864,null));};exports[_0x0baf('0x30')]=function(_0x57b581,_0x23ad34){if(_0x57b581[_0x0baf('0x31')]&&_0x57b581['body'][_0x0baf('0x32')]&&_0x57b581[_0x0baf('0x33')]&&_0x57b581[_0x0baf('0x33')][_0x0baf('0x11')]){for(var _0x504031 in _0x57b581[_0x0baf('0x31')][_0x0baf('0x32')]){if(_0x57b581[_0x0baf('0x31')][_0x0baf('0x32')][_0x0baf('0x34')](_0x504031)){db[_0x0baf('0x35')][_0x0baf('0x36')]({'where':{'channel':_0x504031,'membername':_0x57b581[_0x0baf('0x33')][_0x0baf('0x11')],'type':_0x0baf('0x37'),'exitAt':null,'uniqueid':_0x57b581['body'][_0x0baf('0x32')][_0x504031]&&_0x57b581[_0x0baf('0x31')][_0x0baf('0x32')][_0x504031][_0x0baf('0x38')]?{'$notIn':_0x57b581[_0x0baf('0x31')]['interaction'][_0x504031]}:{'$ne':null}}})[_0x0baf('0x9')](function(_0x310240){var _0x27c3ee=moment()[_0x0baf('0x39')](_0x0baf('0x3a'));for(var _0x54ed41=0x0,_0x2a0924=_0x310240[_0x0baf('0x38')];_0x54ed41<_0x2a0924;_0x54ed41+=0x1){_0x310240[_0x54ed41][_0x0baf('0x3b')]({'exitAt':_0x27c3ee});}});for(var _0x1522b0=0x0;_0x1522b0<_0x57b581[_0x0baf('0x31')][_0x0baf('0x32')][_0x504031][_0x0baf('0x38')];_0x1522b0+=0x1){db['MemberReport'][_0x0baf('0x3c')]({'where':{'channel':_0x504031,'membername':_0x57b581[_0x0baf('0x33')][_0x0baf('0x11')],'type':'INTERACTION','uniqueid':_0x57b581[_0x0baf('0x31')][_0x0baf('0x32')][_0x504031][_0x1522b0],'exitAt':null},'defaults':{'channel':_0x504031,'membername':_0x57b581[_0x0baf('0x33')][_0x0baf('0x11')],'interface':_[_0x0baf('0x12')](_0x57b581[_0x0baf('0x33')][_0x0baf('0x3d')])?util['format'](_0x0baf('0x3e'),_0x57b581[_0x0baf('0x33')][_0x0baf('0x11')]):_0x57b581[_0x0baf('0x33')][_0x0baf('0x3d')],'type':_0x0baf('0x37'),'enterAt':moment()[_0x0baf('0x39')](_0x0baf('0x3a')),'role':_0x0baf('0x3f'),'internal':_0x57b581[_0x0baf('0x33')][_0x0baf('0x40')],'uniqueid':_0x57b581['body']['interaction'][_0x504031][_0x1522b0]}});}}}}return respondWithRpcPromise(_0x0baf('0x41'),{'id':_0x57b581[_0x0baf('0x1b')]['id'],'capacity':_0x57b581[_0x0baf('0x31')][_0x0baf('0x42')]},routingClient)[_0x0baf('0x9')](respondWithResult(_0x23ad34,null))[_0x0baf('0x16')](handleError(_0x23ad34,null));};exports[_0x0baf('0x43')]=function(_0x4b492c,_0x3fe534){return respondWithRpcPromise(_0x0baf('0x44'),_0x4b492c[_0x0baf('0x1a')])[_0x0baf('0x9')](respondWithResult(_0x3fe534,null))[_0x0baf('0x16')](handleError(_0x3fe534,null));};exports[_0x0baf('0x45')]=function(_0x5e1849,_0x3eebe5){return respondWithRpcPromise('Trunks',_0x5e1849[_0x0baf('0x1a')])['then'](respondWithResult(_0x3eebe5,null))[_0x0baf('0x16')](handleError(_0x3eebe5,null));};exports['campaigns']=function(_0x35b1a5,_0x4c035b){return respondWithRpcPromise(_0x0baf('0x46'),_0x35b1a5[_0x0baf('0x1a')])[_0x0baf('0x9')](respondWithResult(_0x4c035b,null))[_0x0baf('0x16')](handleError(_0x4c035b,null));};exports[_0x0baf('0x47')]=function(_0x576475,_0x21f179){return respondWithRpcPromise(_0x0baf('0x48'),_0x576475[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](respondWithResult(_0x21f179,null))[_0x0baf('0x16')](handleError(_0x21f179,null));};exports[_0x0baf('0x49')]=function(_0x480834,_0x402f4d){return respondWithRpcPromise(_0x0baf('0x48'),_0x480834[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](findById(_0x480834[_0x0baf('0x1b')]['id']))[_0x0baf('0x9')](respondWithResult(_0x402f4d,null))[_0x0baf('0x16')](handleError(_0x402f4d,null));};exports['mailQueues']=function(_0x48e855,_0x23f6ea){return respondWithRpcPromise(_0x0baf('0x4a'),_0x48e855[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](respondWithResult(_0x23f6ea,null))[_0x0baf('0x16')](handleError(_0x23f6ea,null));};exports[_0x0baf('0x4b')]=function(_0xaa4293,_0x14a667){return respondWithRpcPromise(_0x0baf('0x4a'),_0xaa4293['query'],routingClient)[_0x0baf('0x9')](findById(_0xaa4293[_0x0baf('0x1b')]['id']))[_0x0baf('0x9')](respondWithResult(_0x14a667,null))[_0x0baf('0x16')](handleError(_0x14a667,null));};exports[_0x0baf('0x4c')]=function(_0xebfc0c,_0x26f5c9){return respondWithRpcPromise('MailAccounts',_0xebfc0c[_0x0baf('0x1a')],mailClient)[_0x0baf('0x9')](respondWithResult(_0x26f5c9,null))[_0x0baf('0x16')](handleError(_0x26f5c9,null));};exports[_0x0baf('0x4d')]=function(_0x1c7d88,_0x1a6d22){return respondWithRpcPromise(_0x0baf('0x4e'),_0x1c7d88[_0x0baf('0x1a')],routingClient)['then'](respondWithResult(_0x1a6d22,null))[_0x0baf('0x16')](handleError(_0x1a6d22,null));};exports['showOpenchannelQueues']=function(_0x3c00e7,_0x5f2fbe){return respondWithRpcPromise('OpenchannelQueues',_0x3c00e7[_0x0baf('0x1a')],routingClient)['then'](findById(_0x3c00e7[_0x0baf('0x1b')]['id']))[_0x0baf('0x9')](respondWithResult(_0x5f2fbe,null))['catch'](handleError(_0x5f2fbe,null));};exports[_0x0baf('0x4f')]=function(_0xfb6708,_0x156572){return respondWithRpcPromise('SmsQueues',_0xfb6708['query'],routingClient)[_0x0baf('0x9')](respondWithResult(_0x156572,null))[_0x0baf('0x16')](handleError(_0x156572,null));};exports[_0x0baf('0x50')]=function(_0x7f49e,_0x784e1a){return respondWithRpcPromise('SmsQueues',_0x7f49e[_0x0baf('0x1a')],routingClient)['then'](findById(_0x7f49e['params']['id']))['then'](respondWithResult(_0x784e1a,null))[_0x0baf('0x16')](handleError(_0x784e1a,null));};exports['whatsappQueues']=function(_0x4946d4,_0x11a81e){return respondWithRpcPromise(_0x0baf('0x51'),_0x4946d4[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](respondWithResult(_0x11a81e,null))[_0x0baf('0x16')](handleError(_0x11a81e,null));};exports[_0x0baf('0x52')]=function(_0x4c05d6,_0xec3b32){return respondWithRpcPromise(_0x0baf('0x51'),_0x4c05d6[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](findById(_0x4c05d6[_0x0baf('0x1b')]['id']))[_0x0baf('0x9')](respondWithResult(_0xec3b32,null))['catch'](handleError(_0xec3b32,null));};exports[_0x0baf('0x53')]=function(_0x468363,_0x29fd46){return respondWithRpcPromise('FaxQueues',_0x468363[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](respondWithResult(_0x29fd46,null))[_0x0baf('0x16')](handleError(_0x29fd46,null));};exports[_0x0baf('0x54')]=function(_0x125906,_0x27a959){return respondWithRpcPromise(_0x0baf('0x55'),_0x125906['query'],routingClient)['then'](findById(_0x125906['params']['id']))[_0x0baf('0x9')](respondWithResult(_0x27a959,null))[_0x0baf('0x16')](handleError(_0x27a959,null));};exports[_0x0baf('0x56')]=function(_0x12b9b5,_0x3e65d4){return respondWithRpcPromise(_0x0baf('0x57'),_0x12b9b5['query'])['then'](respondWithResult(_0x3e65d4,null))[_0x0baf('0x16')](handleError(_0x3e65d4,null));};exports['chatQueuesWaitingInteractions']=function(_0x22cd07,_0x3e9b79){return respondWithRpcPromise('ChatQueuesWaitingInteractions',_0x22cd07[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](respondWithResult(_0x3e9b79,null))[_0x0baf('0x16')](handleError(_0x3e9b79,null));};exports[_0x0baf('0x58')]=function(_0x115ff5,_0x33a5af){return respondWithRpcPromise(_0x0baf('0x59'),_0x115ff5[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](respondWithResult(_0x33a5af,null))['catch'](handleError(_0x33a5af,null));};exports['openchannelQueuesWaitingInteractions']=function(_0x58a079,_0x493784){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x58a079[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](respondWithResult(_0x493784,null))[_0x0baf('0x16')](handleError(_0x493784,null));};exports[_0x0baf('0x5a')]=function(_0x5093f5,_0x1be7f2){return respondWithRpcPromise(_0x0baf('0x5b'),_0x5093f5['query'],routingClient)['then'](function(_0x43aecd){if(_0x5093f5[_0x0baf('0x1a')][_0x0baf('0x5c')]!==undefined){var _0x442e5f=_(_0x43aecd[_0x0baf('0x13')])[_0x0baf('0x5d')]([_0x5093f5[_0x0baf('0x1a')][_0x0baf('0x5c')],_0x5093f5['params']['id']])[_0x0baf('0x5e')](_0x0baf('0x5f'))['uniq']()[_0x0baf('0x60')]();return _0x43aecd[_0x0baf('0x13')]['filter'](function(_0x97d385){return _0x442e5f[_0x0baf('0x61')](_0x97d385[_0x0baf('0x5f')])>-0x1;});}else{return _0x43aecd[_0x0baf('0x13')][_0x0baf('0x5d')](function(_0x4fc5af){return _0x4fc5af['queue_id']===parseInt(_0x5093f5[_0x0baf('0x1b')]['id']);});}})[_0x0baf('0x9')](respondWithResult(_0x1be7f2,null))['catch'](handleError(_0x1be7f2,null));};exports[_0x0baf('0x62')]=function(_0x59dad5,_0x21ad25){return respondWithRpcPromise('SmsQueuesWaitingInteractions',_0x59dad5[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](respondWithResult(_0x21ad25,null))[_0x0baf('0x16')](handleError(_0x21ad25,null));};exports['whatsappQueuesWaitingInteractions']=function(_0x3c2bc1,_0x5008c5){return respondWithRpcPromise(_0x0baf('0x63'),_0x3c2bc1[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](respondWithResult(_0x5008c5,null))[_0x0baf('0x16')](handleError(_0x5008c5,null));};exports[_0x0baf('0x64')]=function(_0x52e845,_0x866e6e){return respondWithRpcPromise(_0x0baf('0x65'),_0x52e845['query'],routingClient)[_0x0baf('0x9')](respondWithResult(_0x866e6e,null))[_0x0baf('0x16')](handleError(_0x866e6e,null));};exports[_0x0baf('0x66')]=function(_0x379c54){return function(_0x1cbbcc,_0x250df2){var _0xa4fd1b,_0x1cda78;var _0x44ef57=_[_0x0baf('0x67')](_0x379c54);var _0x3b7abf=_0x379c54===_0x0baf('0x68')?'Website':'Account';return db[_0x44ef57+_0x0baf('0x69')][_0x0baf('0x6a')]({'raw':!![],'where':{'id':_0x1cbbcc[_0x0baf('0x1b')]['id']}})['then'](function(_0x507783){if(_[_0x0baf('0x12')](_0x507783)){throw new Error(_0x44ef57+_0x0baf('0x6b'));}_0xa4fd1b=_0x507783;return db[_0x44ef57+_0x0baf('0x6c')][_0x0baf('0x6a')]({'where':{'id':_0x1cbbcc[_0x0baf('0x31')][_0x0baf('0x6d')]},'include':[{'model':db[_0x44ef57+_0x0baf('0x6e')],'as':_0x0baf('0x6e')},{'model':db[_0x44ef57+_0x3b7abf],'as':_0x0baf('0x6f')}]});})['then'](function(_0x1590a5){if(_[_0x0baf('0x12')](_0x1590a5)){throw new Error(_0x44ef57+_0x0baf('0x70'));}_0x1cda78=_0x1590a5;return _0x1590a5[_0x0baf('0x71')]({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x5d26e6={'uniqueid':_0x379c54+'.'+_0x1cda78['id']+'.'+_0x1cda78['Interaction']['id'],'FromUserId':_0x1cbbcc[_0x0baf('0x33')]['id'],'type':_0x0baf('0x72')};_0x5d26e6[_0x44ef57+'MessageId']=_0x1cda78['id'];_0x5d26e6[_0x44ef57+'InteractionId']=_0x1cda78[_0x0baf('0x6e')]['id'];_0x5d26e6[_0x0baf('0x73')+_0x44ef57+_0x3b7abf+'Id']=_0x1cda78['Account']['id'];_0x5d26e6['To'+_0x44ef57+_0x0baf('0x74')]=_0xa4fd1b['id'];return db[_0x44ef57+_0x0baf('0x75')][_0x0baf('0x76')](_0x5d26e6);})[_0x0baf('0x9')](function(){return respondWithRpcPromise(_0x0baf('0x77'),{'channel':_0x379c54,'interaction':_0x1cda78[_0x0baf('0x6e')],'message':_0x1cda78,'account':_0x1cda78[_0x0baf('0x6f')],'applications':[{'id':0x0,'priority':0x1,'app':_0x0baf('0x72'),'appdata':_0xa4fd1b[_0x0baf('0x11')]+','+(_0x1cda78[_0x0baf('0x6f')][_0x0baf('0x78')]||0x12c),'interval':_0x0baf('0x79')}],'transfer':!![]},routingClient);})['then'](respondWithResult(_0x250df2,null))[_0x0baf('0x16')](handleError(_0x250df2,null));};};exports[_0x0baf('0x7a')]=function(_0x1e1adb,_0x3bd15b){var _0x3c37b4,_0x195303;if(_['isNil'](_0x1e1adb[_0x0baf('0x31')][_0x0baf('0x7b')])){throw new Error(_0x0baf('0x7c'));}var _0x457ae8=_0x1e1adb[_0x0baf('0x31')]['channel'];var _0x3761b5=_[_0x0baf('0x67')](_0x457ae8);var _0x2eae1b=_0x457ae8===_0x0baf('0x68')?_0x0baf('0x7d'):'Account';return db['User'][_0x0baf('0x6a')]({'raw':!![],'where':{'id':_0x1e1adb['params']['id'],'role':_0x0baf('0x3f')}})['then'](function(_0x32d8b6){if(_[_0x0baf('0x12')](_0x32d8b6)){throw new Error(_0x0baf('0x7e'));}_0x3c37b4=_0x32d8b6;return db[_0x3761b5+_0x0baf('0x6c')]['findOne']({'where':{'id':_0x1e1adb[_0x0baf('0x31')][_0x0baf('0x6d')]},'include':[{'model':db[_0x3761b5+_0x0baf('0x6e')],'as':'Interaction'},{'model':db[_0x3761b5+_0x2eae1b],'as':'Account'}]});})['then'](function(_0x4d4884){if(_[_0x0baf('0x12')](_0x4d4884)){throw new Error(_0x3761b5+_0x0baf('0x70'));}_0x195303=_0x4d4884;return _0x4d4884[_0x0baf('0x71')]({'read':0x0,'readAt':null,'UserId':null});})[_0x0baf('0x9')](function(){var _0x597830={'uniqueid':_0x457ae8+'.'+_0x195303['id']+'.'+_0x195303[_0x0baf('0x6e')]['id'],'FromUserId':_0x1e1adb[_0x0baf('0x33')]['id'],'type':_0x0baf('0x3f'),'ToUserId':_0x3c37b4['id']};_0x597830[_0x3761b5+'MessageId']=_0x195303['id'];_0x597830[_0x3761b5+_0x0baf('0x7f')]=_0x195303[_0x0baf('0x6e')]['id'];_0x597830['From'+_0x3761b5+_0x2eae1b+'Id']=_0x195303[_0x0baf('0x6f')]['id'];return db[_0x3761b5+'TransferReport'][_0x0baf('0x76')](_0x597830);})[_0x0baf('0x9')](function(){return respondWithRpcPromise(_0x0baf('0x77'),{'channel':_0x457ae8,'interaction':_0x195303[_0x0baf('0x6e')],'message':_0x195303,'account':_0x195303['Account'],'applications':[{'id':0x0,'priority':0x1,'app':'agent','appdata':_0x3c37b4[_0x0baf('0x11')]+','+(_0x195303['Account'][_0x0baf('0x80')]||0x12c),'interval':_0x0baf('0x79')}],'transfer':!![]},routingClient);})[_0x0baf('0x9')](respondWithResult(_0x3bd15b,null))[_0x0baf('0x16')](handleError(_0x3bd15b,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index 7882cf4..d3691be 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 _0x4f82=['index','/:id','/:id/run','run','post','create','put','update','delete','destroy','exports','multer','connect-timeout','express','fs-extra','../../config/environment','./schedule.controller','get','isAuthenticated'];(function(_0xcfd4ae,_0x94892f){var _0x196069=function(_0x47b15f){while(--_0x47b15f){_0xcfd4ae['push'](_0xcfd4ae['shift']());}};_0x196069(++_0x94892f);}(_0x4f82,0x13b));var _0x24f8=function(_0x1f36bb,_0x8af718){_0x1f36bb=_0x1f36bb-0x0;var _0xaf97fa=_0x4f82[_0x1f36bb];return _0xaf97fa;};'use strict';var multer=require(_0x24f8('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x24f8('0x1'));var express=require(_0x24f8('0x2'));var router=express['Router']();var fs_extra=require(_0x24f8('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x24f8('0x4'));var controller=require(_0x24f8('0x5'));router[_0x24f8('0x6')]('/',auth[_0x24f8('0x7')](),controller[_0x24f8('0x8')]);router[_0x24f8('0x6')](_0x24f8('0x9'),auth[_0x24f8('0x7')](),controller['show']);router['get'](_0x24f8('0xa'),auth[_0x24f8('0x7')](),controller[_0x24f8('0xb')]);router[_0x24f8('0xc')]('/',auth[_0x24f8('0x7')](),controller[_0x24f8('0xd')]);router[_0x24f8('0xe')](_0x24f8('0x9'),auth[_0x24f8('0x7')](),controller[_0x24f8('0xf')]);router[_0x24f8('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x24f8('0x11')]);module[_0x24f8('0x12')]=router; \ No newline at end of file +var _0x5282=['destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./schedule.controller','get','isAuthenticated','index','show','/:id/run','run','post','create','/:id','update'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5282,0xc8));var _0x2528=function(_0x4536a4,_0x55af7b){_0x4536a4=_0x4536a4-0x0;var _0x4fd1c1=_0x5282[_0x4536a4];return _0x4fd1c1;};'use strict';var multer=require(_0x2528('0x0'));var util=require(_0x2528('0x1'));var path=require(_0x2528('0x2'));var timeout=require(_0x2528('0x3'));var express=require(_0x2528('0x4'));var router=express[_0x2528('0x5')]();var fs_extra=require(_0x2528('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x2528('0x7'));var config=require(_0x2528('0x8'));var controller=require(_0x2528('0x9'));router[_0x2528('0xa')]('/',auth[_0x2528('0xb')](),controller[_0x2528('0xc')]);router[_0x2528('0xa')]('/:id',auth[_0x2528('0xb')](),controller[_0x2528('0xd')]);router[_0x2528('0xa')](_0x2528('0xe'),auth['isAuthenticated'](),controller[_0x2528('0xf')]);router[_0x2528('0x10')]('/',auth[_0x2528('0xb')](),controller[_0x2528('0x11')]);router['put'](_0x2528('0x12'),auth[_0x2528('0xb')](),controller[_0x2528('0x13')]);router['delete'](_0x2528('0x12'),auth['isAuthenticated'](),controller[_0x2528('0x14')]);module[_0x2528('0x15')]=router; \ No newline at end of file diff --git a/server/api/schedule/schedule.attributes.js b/server/api/schedule/schedule.attributes.js index a27edcf..cff3edb 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 _0xeefd=['DATE','INTEGER','ENUM','years','quarters','months','hours','minutes','csv','pdf','xlsx','custom','default','TEXT','sequelize','exports','STRING','BOOLEAN','0\x200\x20*\x20*\x20*'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0xeefd,0x1d6));var _0xdeef=function(_0x510a58,_0x43ca67){_0x510a58=_0x510a58-0x0;var _0x24e65e=_0xeefd[_0x510a58];return _0x24e65e;};'use strict';var Sequelize=require(_0xdeef('0x0'));module[_0xdeef('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0xdeef('0x2')]},'active':{'type':Sequelize[_0xdeef('0x3')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0xdeef('0x2')],'allowNull':![],'defaultValue':_0xdeef('0x4')},'startAt':{'type':Sequelize[_0xdeef('0x5')],'allowNull':![]},'endAt':{'type':Sequelize[_0xdeef('0x5')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0xdeef('0x6')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0xdeef('0x7')](_0xdeef('0x8'),_0xdeef('0x9'),_0xdeef('0xa'),'weeks','days',_0xdeef('0xb'),_0xdeef('0xc')),'allowNull':![],'defaultValue':'days'},'output':{'type':Sequelize['ENUM'](_0xdeef('0xd'),_0xdeef('0xe'),_0xdeef('0xf')),'allowNull':![],'defaultValue':_0xdeef('0xd')},'type':{'type':Sequelize[_0xdeef('0x7')](_0xdeef('0x10'),_0xdeef('0x11')),'allowNull':![],'defaultValue':_0xdeef('0x10')},'sendMail':{'type':Sequelize[_0xdeef('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0xdeef('0x2')]},'cc':{'type':Sequelize[_0xdeef('0x12')]},'bcc':{'type':Sequelize['TEXT']},'sendIfEmpty':{'type':Sequelize[_0xdeef('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0x1247=['months','weeks','hours','days','csv','pdf','xlsx','default','custom','TEXT','sequelize','exports','STRING','BOOLEAN','0\x200\x20*\x20*\x20*','DATE','INTEGER','ENUM','years','quarters'];(function(_0x4c184d,_0x4278ab){var _0x23d997=function(_0x22d068){while(--_0x22d068){_0x4c184d['push'](_0x4c184d['shift']());}};_0x23d997(++_0x4278ab);}(_0x1247,0xbe));var _0x7124=function(_0x189305,_0x46c43f){_0x189305=_0x189305-0x0;var _0xea3406=_0x1247[_0x189305];return _0xea3406;};'use strict';var Sequelize=require(_0x7124('0x0'));module[_0x7124('0x1')]={'name':{'type':Sequelize[_0x7124('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0x7124('0x3')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x7124('0x2')],'allowNull':![],'defaultValue':_0x7124('0x4')},'startAt':{'type':Sequelize[_0x7124('0x5')],'allowNull':![]},'endAt':{'type':Sequelize['DATE'],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0x7124('0x6')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x7124('0x7')](_0x7124('0x8'),_0x7124('0x9'),_0x7124('0xa'),_0x7124('0xb'),'days',_0x7124('0xc'),'minutes'),'allowNull':![],'defaultValue':_0x7124('0xd')},'output':{'type':Sequelize['ENUM'](_0x7124('0xe'),_0x7124('0xf'),_0x7124('0x10')),'allowNull':![],'defaultValue':'csv'},'type':{'type':Sequelize['ENUM']('custom',_0x7124('0x11')),'allowNull':![],'defaultValue':_0x7124('0x12')},'sendMail':{'type':Sequelize[_0x7124('0x3')],'defaultValue':![]},'email':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0x7124('0x13')]},'bcc':{'type':Sequelize[_0x7124('0x13')]},'sendIfEmpty':{'type':Sequelize[_0x7124('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 b9e6d52..a9572fa 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 _0x52ba=['mustache','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','apply','reject','save','update','then','get','Scheduler','UserProfileResource','destroy','error','stack','name','index','rawAttributes','fieldName','type','map','query','keys','filters','intersection','model','fields','attributes','length','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','Schedule','includeAll','include','findAll','rows','catch','show','params','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','../../config/schedule','run','eml-format','rimraf','zip-dir','fast-json-patch','bluebird'];(function(_0x129890,_0x20af0b){var _0x10f8e8=function(_0x17cd7){while(--_0x17cd7){_0x129890['push'](_0x129890['shift']());}};_0x10f8e8(++_0x20af0b);}(_0x52ba,0x14f));var _0xa52b=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x52ba[_0x57b54c];return _0x59cc19;};'use strict';var emlformat=require(_0xa52b('0x0'));var rimraf=require(_0xa52b('0x1'));var zipdir=require(_0xa52b('0x2'));var jsonpatch=require(_0xa52b('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xa52b('0x4'));var Mustache=require(_0xa52b('0x5'));var util=require('util');var path=require('path');var sox=require(_0xa52b('0x6'));var csv=require(_0xa52b('0x7'));var ejs=require(_0xa52b('0x8'));var fs=require('fs');var fs_extra=require(_0xa52b('0x9'));var _=require(_0xa52b('0xa'));var squel=require('squel');var crypto=require(_0xa52b('0xb'));var jsforce=require(_0xa52b('0xc'));var deskjs=require(_0xa52b('0xd'));var toCsv=require(_0xa52b('0x7'));var querystring=require(_0xa52b('0xe'));var Papa=require(_0xa52b('0xf'));var Redis=require(_0xa52b('0x10'));var authService=require(_0xa52b('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xa52b('0x12'));var hardwareService=require(_0xa52b('0x13'));var logger=require(_0xa52b('0x14'))('api');var utils=require(_0xa52b('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xa52b('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x211a05,_0x1addc9){_0x1addc9=_0x1addc9||0xcc;return function(_0x18026d){if(_0x18026d){return _0x211a05[_0xa52b('0x17')](_0x1addc9);}return _0x211a05[_0xa52b('0x18')](_0x1addc9)[_0xa52b('0x19')]();};}function respondWithResult(_0x5de6ab,_0x4d4f7e){_0x4d4f7e=_0x4d4f7e||0xc8;return function(_0x1c0c07){if(_0x1c0c07){return _0x5de6ab[_0xa52b('0x18')](_0x4d4f7e)[_0xa52b('0x1a')](_0x1c0c07);}};}function respondWithFilteredResult(_0x5d268c,_0x1aaaa2){return function(_0x51fc40){if(_0x51fc40){var _0xe8fad4=typeof _0x1aaaa2[_0xa52b('0x1b')]===_0xa52b('0x1c')&&typeof _0x1aaaa2[_0xa52b('0x1d')]===_0xa52b('0x1c');var _0x4119d5=_0x51fc40[_0xa52b('0x1e')];var _0x300e60=_0xe8fad4?0x0:_0x1aaaa2[_0xa52b('0x1b')];var _0x31ca3f=_0xe8fad4?_0x51fc40[_0xa52b('0x1e')]:_0x1aaaa2['offset']+_0x1aaaa2['limit'];var _0x1dcaf7;if(_0x31ca3f>=_0x4119d5){_0x31ca3f=_0x4119d5;_0x1dcaf7=0xc8;}else{_0x1dcaf7=0xce;}_0x5d268c[_0xa52b('0x18')](_0x1dcaf7);return _0x5d268c['set']('Content-Range',_0x300e60+'-'+_0x31ca3f+'/'+_0x4119d5)['json'](_0x51fc40);}return null;};}function patchUpdates(_0x205ca5){return function(_0x44b612){try{jsonpatch[_0xa52b('0x1f')](_0x44b612,_0x205ca5,!![]);}catch(_0x12d154){return BPromise[_0xa52b('0x20')](_0x12d154);}return _0x44b612[_0xa52b('0x21')]();};}function saveUpdates(_0x57fe3f,_0x306bc9){return function(_0x249a42){if(_0x249a42){return _0x249a42[_0xa52b('0x22')](_0x57fe3f)[_0xa52b('0x23')](function(_0x594c9b){return _0x594c9b;});}return null;};}function removeEntity(_0x2c3e1a,_0x506e04){return function(_0x35c04d){if(_0x35c04d){return _0x35c04d['destroy']()['then'](function(){var _0x5ada91=_0x35c04d[_0xa52b('0x24')]({'plain':!![]});var _0x2d094b=_0xa52b('0x25');return db[_0xa52b('0x26')][_0xa52b('0x27')]({'where':{'type':_0x2d094b,'resourceId':_0x5ada91['id']}})[_0xa52b('0x23')](function(){return _0x35c04d;});})[_0xa52b('0x23')](function(){_0x2c3e1a[_0xa52b('0x18')](0xcc)[_0xa52b('0x19')]();});}};}function handleEntityNotFound(_0x10fa1b,_0x150128){return function(_0x3c5c78){if(!_0x3c5c78){_0x10fa1b[_0xa52b('0x17')](0x194);}return _0x3c5c78;};}function handleError(_0x25a90c,_0x2f95a2){_0x2f95a2=_0x2f95a2||0x1f4;return function(_0x5336ae){logger[_0xa52b('0x28')](_0x5336ae[_0xa52b('0x29')]);if(_0x5336ae[_0xa52b('0x2a')]){delete _0x5336ae['name'];}_0x25a90c[_0xa52b('0x18')](_0x2f95a2)['send'](_0x5336ae);};}exports[_0xa52b('0x2b')]=function(_0x4b8ff5,_0x4f910a){var _0x3135f8={},_0x42dd55={},_0xd6e184={'count':0x0,'rows':[]};var _0x5373ed=_['map'](db['Schedule'][_0xa52b('0x2c')],function(_0x18f29d){return{'name':_0x18f29d[_0xa52b('0x2d')],'type':_0x18f29d[_0xa52b('0x2e')]['key']};});_0x42dd55['model']=_[_0xa52b('0x2f')](_0x5373ed,_0xa52b('0x2a'));_0x42dd55[_0xa52b('0x30')]=_[_0xa52b('0x31')](_0x4b8ff5[_0xa52b('0x30')]);_0x42dd55[_0xa52b('0x32')]=_[_0xa52b('0x33')](_0x42dd55['model'],_0x42dd55[_0xa52b('0x30')]);_0x3135f8['attributes']=_['intersection'](_0x42dd55[_0xa52b('0x34')],qs[_0xa52b('0x35')](_0x4b8ff5[_0xa52b('0x30')][_0xa52b('0x35')]));_0x3135f8['attributes']=_0x3135f8[_0xa52b('0x36')][_0xa52b('0x37')]?_0x3135f8[_0xa52b('0x36')]:_0x42dd55[_0xa52b('0x34')];if(!_0x4b8ff5[_0xa52b('0x30')]['hasOwnProperty'](_0xa52b('0x38'))){_0x3135f8[_0xa52b('0x1d')]=qs[_0xa52b('0x1d')](_0x4b8ff5[_0xa52b('0x30')][_0xa52b('0x1d')]);_0x3135f8[_0xa52b('0x1b')]=qs[_0xa52b('0x1b')](_0x4b8ff5[_0xa52b('0x30')][_0xa52b('0x1b')]);}_0x3135f8[_0xa52b('0x39')]=qs[_0xa52b('0x3a')](_0x4b8ff5[_0xa52b('0x30')]['sort']);_0x3135f8[_0xa52b('0x3b')]=qs[_0xa52b('0x32')](_[_0xa52b('0x3c')](_0x4b8ff5[_0xa52b('0x30')],_0x42dd55[_0xa52b('0x32')]),_0x5373ed);if(_0x4b8ff5[_0xa52b('0x30')]['filter']){_0x3135f8[_0xa52b('0x3b')]=_[_0xa52b('0x3d')](_0x3135f8['where'],{'$or':_[_0xa52b('0x2f')](_0x5373ed,function(_0x30cab7){if(_0x30cab7[_0xa52b('0x2e')]!==_0xa52b('0x3e')){var _0x46fa75={};_0x46fa75[_0x30cab7['name']]={'$like':'%'+_0x4b8ff5[_0xa52b('0x30')][_0xa52b('0x3f')]+'%'};return _0x46fa75;}})});}_0x3135f8=_['merge']({},_0x3135f8,_0x4b8ff5[_0xa52b('0x40')]);var _0x5c3089={'where':_0x3135f8[_0xa52b('0x3b')]};return db[_0xa52b('0x41')][_0xa52b('0x1e')](_0x5c3089)['then'](function(_0xc005a2){_0xd6e184['count']=_0xc005a2;if(_0x4b8ff5['query'][_0xa52b('0x42')]){_0x3135f8[_0xa52b('0x43')]=[{'all':!![]}];}return db[_0xa52b('0x41')][_0xa52b('0x44')](_0x3135f8);})[_0xa52b('0x23')](function(_0x6c47b8){_0xd6e184[_0xa52b('0x45')]=_0x6c47b8;return _0xd6e184;})[_0xa52b('0x23')](respondWithFilteredResult(_0x4f910a,_0x3135f8))[_0xa52b('0x46')](handleError(_0x4f910a,null));};exports[_0xa52b('0x47')]=function(_0x30c4ce,_0x1f91b1){var _0x46f18f={'raw':![],'where':{'id':_0x30c4ce[_0xa52b('0x48')]['id']}},_0x385f1e={};_0x385f1e[_0xa52b('0x34')]=_[_0xa52b('0x31')](db['Schedule'][_0xa52b('0x2c')]);_0x385f1e[_0xa52b('0x30')]=_[_0xa52b('0x31')](_0x30c4ce['query']);_0x385f1e['filters']=_[_0xa52b('0x33')](_0x385f1e[_0xa52b('0x34')],_0x385f1e[_0xa52b('0x30')]);_0x46f18f[_0xa52b('0x36')]=_['intersection'](_0x385f1e[_0xa52b('0x34')],qs[_0xa52b('0x35')](_0x30c4ce['query']['fields']));_0x46f18f[_0xa52b('0x36')]=_0x46f18f[_0xa52b('0x36')][_0xa52b('0x37')]?_0x46f18f[_0xa52b('0x36')]:_0x385f1e[_0xa52b('0x34')];if(_0x30c4ce['query'][_0xa52b('0x42')]){_0x46f18f[_0xa52b('0x43')]=[{'all':!![]}];}_0x46f18f=_[_0xa52b('0x3d')]({},_0x46f18f,_0x30c4ce[_0xa52b('0x40')]);return db[_0xa52b('0x41')][_0xa52b('0x49')](_0x46f18f)[_0xa52b('0x23')](handleEntityNotFound(_0x1f91b1,null))['then'](respondWithResult(_0x1f91b1,null))[_0xa52b('0x46')](handleError(_0x1f91b1,null));};exports[_0xa52b('0x4a')]=function(_0x1ddbeb,_0x36e64d){return db['Schedule'][_0xa52b('0x4a')](_0x1ddbeb['body'],{})[_0xa52b('0x23')](function(_0x2fb74f){var _0x524170=_0x1ddbeb['user'][_0xa52b('0x24')]({'plain':!![]});if(!_0x524170)throw new Error(_0xa52b('0x4b'));if(_0x524170[_0xa52b('0x4c')]===_0xa52b('0x4d')){var _0x4e16b1=_0x2fb74f[_0xa52b('0x24')]({'plain':!![]});var _0x23dab8=_0xa52b('0x25');return db[_0xa52b('0x4e')][_0xa52b('0x49')]({'where':{'name':_0x23dab8,'userProfileId':_0x524170[_0xa52b('0x4f')]},'raw':!![]})[_0xa52b('0x23')](function(_0x42e07d){if(_0x42e07d&&_0x42e07d[_0xa52b('0x50')]===0x0){return db[_0xa52b('0x26')][_0xa52b('0x4a')]({'name':_0x4e16b1['name'],'resourceId':_0x4e16b1['id'],'type':_0x42e07d['name'],'sectionId':_0x42e07d['id']},{})[_0xa52b('0x23')](function(){return _0x2fb74f;});}else{return _0x2fb74f;}})['catch'](function(_0x3e75ff){logger[_0xa52b('0x28')](_0xa52b('0x51'),_0x3e75ff);throw _0x3e75ff;});}return _0x2fb74f;})[_0xa52b('0x23')](respondWithResult(_0x36e64d,0xc9))[_0xa52b('0x46')](handleError(_0x36e64d,null));};exports[_0xa52b('0x22')]=function(_0x38f961,_0x490647){if(_0x38f961['body']['id']){delete _0x38f961[_0xa52b('0x52')]['id'];}return db[_0xa52b('0x41')]['find']({'where':{'id':_0x38f961[_0xa52b('0x48')]['id']}})['then'](handleEntityNotFound(_0x490647,null))[_0xa52b('0x23')](saveUpdates(_0x38f961['body'],null))[_0xa52b('0x23')](respondWithResult(_0x490647,null))['catch'](handleError(_0x490647,null));};exports['destroy']=function(_0x2f92b8,_0x17ce7b){return db[_0xa52b('0x41')]['find']({'where':{'id':_0x2f92b8['params']['id']}})[_0xa52b('0x23')](handleEntityNotFound(_0x17ce7b,null))['then'](removeEntity(_0x17ce7b,null))['catch'](handleError(_0x17ce7b,null));};exports['run']=function(_0x8637ff,_0x37e1d9,_0x4d6dab){var _0x5eb2fa=require(_0xa52b('0x53'));return db[_0xa52b('0x41')][_0xa52b('0x49')]({'where':{'id':_0x8637ff[_0xa52b('0x48')]['id']},'raw':!![]})[_0xa52b('0x23')](handleEntityNotFound(_0x37e1d9,null))['then'](function(){_0x5eb2fa[_0xa52b('0x54')](_0x8637ff[_0xa52b('0x48')]['id']);})['then'](respondWithStatusCode(_0x37e1d9,null))[_0xa52b('0x46')](handleError(_0x37e1d9,null));}; \ No newline at end of file +var _0x58d1=['length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','VIRTUAL','options','count','includeAll','include','findAll','catch','show','params','keys','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','run','../../config/schedule','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','reject','save','update','then','get','UserProfileResource','destroy','error','stack','name','send','index','Schedule','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields'];(function(_0x393500,_0x1037af){var _0x120d3b=function(_0x17234e){while(--_0x17234e){_0x393500['push'](_0x393500['shift']());}};_0x120d3b(++_0x1037af);}(_0x58d1,0x1dc));var _0x158d=function(_0x3799cd,_0x131494){_0x3799cd=_0x3799cd-0x0;var _0x3410d3=_0x58d1[_0x3799cd];return _0x3410d3;};'use strict';var emlformat=require(_0x158d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x158d('0x1'));var jsonpatch=require(_0x158d('0x2'));var rp=require(_0x158d('0x3'));var moment=require(_0x158d('0x4'));var BPromise=require(_0x158d('0x5'));var Mustache=require(_0x158d('0x6'));var util=require('util');var path=require(_0x158d('0x7'));var sox=require(_0x158d('0x8'));var csv=require(_0x158d('0x9'));var ejs=require(_0x158d('0xa'));var fs=require('fs');var fs_extra=require(_0x158d('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x158d('0xc'));var jsforce=require(_0x158d('0xd'));var deskjs=require(_0x158d('0xe'));var toCsv=require(_0x158d('0x9'));var querystring=require(_0x158d('0xf'));var Papa=require(_0x158d('0x10'));var Redis=require(_0x158d('0x11'));var authService=require(_0x158d('0x12'));var qs=require(_0x158d('0x13'));var as=require(_0x158d('0x14'));var hardwareService=require(_0x158d('0x15'));var logger=require(_0x158d('0x16'))('api');var utils=require(_0x158d('0x17'));var config=require(_0x158d('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x158d('0x19'))['db'];function respondWithStatusCode(_0x42ed79,_0x25b311){_0x25b311=_0x25b311||0xcc;return function(_0xa4ed2f){if(_0xa4ed2f){return _0x42ed79[_0x158d('0x1a')](_0x25b311);}return _0x42ed79[_0x158d('0x1b')](_0x25b311)[_0x158d('0x1c')]();};}function respondWithResult(_0x2021ec,_0x506c65){_0x506c65=_0x506c65||0xc8;return function(_0x2c1e54){if(_0x2c1e54){return _0x2021ec['status'](_0x506c65)[_0x158d('0x1d')](_0x2c1e54);}};}function respondWithFilteredResult(_0x2a7a2a,_0x157384){return function(_0x5d5157){if(_0x5d5157){var _0x3dc804=typeof _0x157384[_0x158d('0x1e')]===_0x158d('0x1f')&&typeof _0x157384['limit']===_0x158d('0x1f');var _0x5550a7=_0x5d5157['count'];var _0x3e7628=_0x3dc804?0x0:_0x157384[_0x158d('0x1e')];var _0x617591=_0x3dc804?_0x5d5157['count']:_0x157384[_0x158d('0x1e')]+_0x157384[_0x158d('0x20')];var _0x3cf271;if(_0x617591>=_0x5550a7){_0x617591=_0x5550a7;_0x3cf271=0xc8;}else{_0x3cf271=0xce;}_0x2a7a2a[_0x158d('0x1b')](_0x3cf271);return _0x2a7a2a[_0x158d('0x21')](_0x158d('0x22'),_0x3e7628+'-'+_0x617591+'/'+_0x5550a7)[_0x158d('0x1d')](_0x5d5157);}return null;};}function patchUpdates(_0x10e54d){return function(_0xa9aea5){try{jsonpatch['apply'](_0xa9aea5,_0x10e54d,!![]);}catch(_0x3a50b5){return BPromise[_0x158d('0x23')](_0x3a50b5);}return _0xa9aea5[_0x158d('0x24')]();};}function saveUpdates(_0x1b78bf,_0x328d20){return function(_0x4cbe02){if(_0x4cbe02){return _0x4cbe02[_0x158d('0x25')](_0x1b78bf)['then'](function(_0x12e9e8){return _0x12e9e8;});}return null;};}function removeEntity(_0x757800,_0x3623c9){return function(_0x2ce398){if(_0x2ce398){return _0x2ce398['destroy']()[_0x158d('0x26')](function(){var _0x240f47=_0x2ce398[_0x158d('0x27')]({'plain':!![]});var _0x48082a='Scheduler';return db[_0x158d('0x28')][_0x158d('0x29')]({'where':{'type':_0x48082a,'resourceId':_0x240f47['id']}})[_0x158d('0x26')](function(){return _0x2ce398;});})[_0x158d('0x26')](function(){_0x757800[_0x158d('0x1b')](0xcc)[_0x158d('0x1c')]();});}};}function handleEntityNotFound(_0x122cc0,_0x503561){return function(_0x2e255c){if(!_0x2e255c){_0x122cc0['sendStatus'](0x194);}return _0x2e255c;};}function handleError(_0x223698,_0x514f04){_0x514f04=_0x514f04||0x1f4;return function(_0x892bda){logger[_0x158d('0x2a')](_0x892bda[_0x158d('0x2b')]);if(_0x892bda[_0x158d('0x2c')]){delete _0x892bda[_0x158d('0x2c')];}_0x223698[_0x158d('0x1b')](_0x514f04)[_0x158d('0x2d')](_0x892bda);};}exports[_0x158d('0x2e')]=function(_0x4ed741,_0x4754e8){var _0x318ede={},_0x78a935={},_0x1118dd={'count':0x0,'rows':[]};var _0x419192=_['map'](db[_0x158d('0x2f')][_0x158d('0x30')],function(_0x1aba99){return{'name':_0x1aba99[_0x158d('0x31')],'type':_0x1aba99[_0x158d('0x32')][_0x158d('0x33')]};});_0x78a935['model']=_['map'](_0x419192,'name');_0x78a935[_0x158d('0x34')]=_['keys'](_0x4ed741[_0x158d('0x34')]);_0x78a935[_0x158d('0x35')]=_[_0x158d('0x36')](_0x78a935[_0x158d('0x37')],_0x78a935[_0x158d('0x34')]);_0x318ede[_0x158d('0x38')]=_[_0x158d('0x36')](_0x78a935[_0x158d('0x37')],qs['fields'](_0x4ed741['query'][_0x158d('0x39')]));_0x318ede[_0x158d('0x38')]=_0x318ede[_0x158d('0x38')][_0x158d('0x3a')]?_0x318ede[_0x158d('0x38')]:_0x78a935['model'];if(!_0x4ed741[_0x158d('0x34')][_0x158d('0x3b')](_0x158d('0x3c'))){_0x318ede[_0x158d('0x20')]=qs['limit'](_0x4ed741[_0x158d('0x34')][_0x158d('0x20')]);_0x318ede['offset']=qs[_0x158d('0x1e')](_0x4ed741[_0x158d('0x34')]['offset']);}_0x318ede[_0x158d('0x3d')]=qs[_0x158d('0x3e')](_0x4ed741[_0x158d('0x34')][_0x158d('0x3e')]);_0x318ede[_0x158d('0x3f')]=qs[_0x158d('0x35')](_[_0x158d('0x40')](_0x4ed741[_0x158d('0x34')],_0x78a935[_0x158d('0x35')]),_0x419192);if(_0x4ed741[_0x158d('0x34')][_0x158d('0x41')]){_0x318ede['where']=_[_0x158d('0x42')](_0x318ede['where'],{'$or':_[_0x158d('0x43')](_0x419192,function(_0x4ef2fe){if(_0x4ef2fe[_0x158d('0x32')]!==_0x158d('0x44')){var _0x130d0c={};_0x130d0c[_0x4ef2fe[_0x158d('0x2c')]]={'$like':'%'+_0x4ed741[_0x158d('0x34')][_0x158d('0x41')]+'%'};return _0x130d0c;}})});}_0x318ede=_['merge']({},_0x318ede,_0x4ed741[_0x158d('0x45')]);var _0x14e4d6={'where':_0x318ede[_0x158d('0x3f')]};return db[_0x158d('0x2f')]['count'](_0x14e4d6)[_0x158d('0x26')](function(_0x15d7c8){_0x1118dd[_0x158d('0x46')]=_0x15d7c8;if(_0x4ed741['query'][_0x158d('0x47')]){_0x318ede[_0x158d('0x48')]=[{'all':!![]}];}return db[_0x158d('0x2f')][_0x158d('0x49')](_0x318ede);})[_0x158d('0x26')](function(_0x1ac035){_0x1118dd['rows']=_0x1ac035;return _0x1118dd;})[_0x158d('0x26')](respondWithFilteredResult(_0x4754e8,_0x318ede))[_0x158d('0x4a')](handleError(_0x4754e8,null));};exports[_0x158d('0x4b')]=function(_0xf86b1e,_0x58a999){var _0x168b87={'raw':![],'where':{'id':_0xf86b1e[_0x158d('0x4c')]['id']}},_0x5a813c={};_0x5a813c[_0x158d('0x37')]=_[_0x158d('0x4d')](db[_0x158d('0x2f')][_0x158d('0x30')]);_0x5a813c[_0x158d('0x34')]=_[_0x158d('0x4d')](_0xf86b1e[_0x158d('0x34')]);_0x5a813c[_0x158d('0x35')]=_[_0x158d('0x36')](_0x5a813c[_0x158d('0x37')],_0x5a813c[_0x158d('0x34')]);_0x168b87[_0x158d('0x38')]=_[_0x158d('0x36')](_0x5a813c[_0x158d('0x37')],qs[_0x158d('0x39')](_0xf86b1e[_0x158d('0x34')][_0x158d('0x39')]));_0x168b87['attributes']=_0x168b87['attributes'][_0x158d('0x3a')]?_0x168b87['attributes']:_0x5a813c[_0x158d('0x37')];if(_0xf86b1e[_0x158d('0x34')][_0x158d('0x47')]){_0x168b87[_0x158d('0x48')]=[{'all':!![]}];}_0x168b87=_[_0x158d('0x42')]({},_0x168b87,_0xf86b1e[_0x158d('0x45')]);return db['Schedule'][_0x158d('0x4e')](_0x168b87)[_0x158d('0x26')](handleEntityNotFound(_0x58a999,null))[_0x158d('0x26')](respondWithResult(_0x58a999,null))[_0x158d('0x4a')](handleError(_0x58a999,null));};exports[_0x158d('0x4f')]=function(_0x2bf6b0,_0x18d831){return db['Schedule'][_0x158d('0x4f')](_0x2bf6b0[_0x158d('0x50')],{})[_0x158d('0x26')](function(_0x531599){var _0x5c6bca=_0x2bf6b0[_0x158d('0x51')]['get']({'plain':!![]});if(!_0x5c6bca)throw new Error(_0x158d('0x52'));if(_0x5c6bca[_0x158d('0x53')]==='user'){var _0x48a780=_0x531599[_0x158d('0x27')]({'plain':!![]});var _0x52476d='Scheduler';return db['UserProfileSection']['find']({'where':{'name':_0x52476d,'userProfileId':_0x5c6bca[_0x158d('0x54')]},'raw':!![]})['then'](function(_0x58fb27){if(_0x58fb27&&_0x58fb27[_0x158d('0x55')]===0x0){return db[_0x158d('0x28')][_0x158d('0x4f')]({'name':_0x48a780[_0x158d('0x2c')],'resourceId':_0x48a780['id'],'type':_0x58fb27['name'],'sectionId':_0x58fb27['id']},{})['then'](function(){return _0x531599;});}else{return _0x531599;}})[_0x158d('0x4a')](function(_0x389d67){logger[_0x158d('0x2a')](_0x158d('0x56'),_0x389d67);throw _0x389d67;});}return _0x531599;})[_0x158d('0x26')](respondWithResult(_0x18d831,0xc9))[_0x158d('0x4a')](handleError(_0x18d831,null));};exports['update']=function(_0x57db7c,_0x12b0da){if(_0x57db7c['body']['id']){delete _0x57db7c[_0x158d('0x50')]['id'];}return db[_0x158d('0x2f')][_0x158d('0x4e')]({'where':{'id':_0x57db7c[_0x158d('0x4c')]['id']}})[_0x158d('0x26')](handleEntityNotFound(_0x12b0da,null))['then'](saveUpdates(_0x57db7c[_0x158d('0x50')],null))[_0x158d('0x26')](respondWithResult(_0x12b0da,null))[_0x158d('0x4a')](handleError(_0x12b0da,null));};exports[_0x158d('0x29')]=function(_0x5c935d,_0x304f94){return db[_0x158d('0x2f')][_0x158d('0x4e')]({'where':{'id':_0x5c935d[_0x158d('0x4c')]['id']}})[_0x158d('0x26')](handleEntityNotFound(_0x304f94,null))[_0x158d('0x26')](removeEntity(_0x304f94,null))[_0x158d('0x4a')](handleError(_0x304f94,null));};exports[_0x158d('0x57')]=function(_0x2a059a,_0x26b492,_0xa99daa){var _0x363a4f=require(_0x158d('0x58'));return db['Schedule'][_0x158d('0x4e')]({'where':{'id':_0x2a059a[_0x158d('0x4c')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x26b492,null))[_0x158d('0x26')](function(){_0x363a4f['run'](_0x2a059a[_0x158d('0x4c')]['id']);})[_0x158d('0x26')](respondWithStatusCode(_0x26b492,null))[_0x158d('0x4a')](handleError(_0x26b492,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index c5db859..5826d25 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 _0xc3eb=['define','Schedule','tools_schedules','lodash','util','api','moment','request-promise','../../config/environment'];(function(_0x251264,_0x128c77){var _0x95cc54=function(_0x4eb7ad){while(--_0x4eb7ad){_0x251264['push'](_0x251264['shift']());}};_0x95cc54(++_0x128c77);}(_0xc3eb,0x198));var _0xbc3e=function(_0x10df1e,_0xf56f85){_0x10df1e=_0x10df1e-0x0;var _0x3e24fb=_0xc3eb[_0x10df1e];return _0x3e24fb;};'use strict';var _=require(_0xbc3e('0x0'));var util=require(_0xbc3e('0x1'));var logger=require('../../config/logger')(_0xbc3e('0x2'));var moment=require(_0xbc3e('0x3'));var BPromise=require('bluebird');var rp=require(_0xbc3e('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xbc3e('0x5'));var attributes=require('./schedule.attributes');module['exports']=function(_0x1bdd68,_0xc8fd21){return _0x1bdd68[_0xbc3e('0x6')](_0xbc3e('0x7'),attributes,{'tableName':_0xbc3e('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8169=['rimraf','./schedule.attributes','exports','Schedule','lodash','util','../../config/logger','bluebird','path'];(function(_0x417990,_0x3c6fd7){var _0x415a4a=function(_0x1e0838){while(--_0x1e0838){_0x417990['push'](_0x417990['shift']());}};_0x415a4a(++_0x3c6fd7);}(_0x8169,0x187));var _0x9816=function(_0x5988d1,_0x345c23){_0x5988d1=_0x5988d1-0x0;var _0x32a7ea=_0x8169[_0x5988d1];return _0x32a7ea;};'use strict';var _=require(_0x9816('0x0'));var util=require(_0x9816('0x1'));var logger=require(_0x9816('0x2'))('api');var moment=require('moment');var BPromise=require(_0x9816('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9816('0x4'));var rimraf=require(_0x9816('0x5'));var config=require('../../config/environment');var attributes=require(_0x9816('0x6'));module[_0x9816('0x7')]=function(_0x24d74c,_0x1f2710){return _0x24d74c['define'](_0x9816('0x8'),attributes,{'tableName':'tools_schedules','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/schedule/schedule.rpc.js b/server/api/schedule/schedule.rpc.js index 671daa8..ea81def 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 _0xbfef=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','request','then','info','request\x20sent','Schedule,\x20%s,\x20%s,\x20%s','stringify','code','Schedule,\x20%s,\x20%s','error','message','result','catch','lodash','util','moment'];(function(_0xab3ad3,_0x3b65b7){var _0x3528f4=function(_0x2b190f){while(--_0x2b190f){_0xab3ad3['push'](_0xab3ad3['shift']());}};_0x3528f4(++_0x3b65b7);}(_0xbfef,0x1cb));var _0xfbfe=function(_0x1bbcb3,_0x33d9f4){_0x1bbcb3=_0x1bbcb3-0x0;var _0x4681f9=_0xbfef[_0x1bbcb3];return _0x4681f9;};'use strict';var _=require(_0xfbfe('0x0'));var util=require(_0xfbfe('0x1'));var moment=require(_0xfbfe('0x2'));var BPromise=require('bluebird');var rs=require(_0xfbfe('0x3'));var fs=require('fs');var Redis=require(_0xfbfe('0x4'));var db=require(_0xfbfe('0x5'))['db'];var utils=require(_0xfbfe('0x6'));var logger=require(_0xfbfe('0x7'))(_0xfbfe('0x8'));var config=require(_0xfbfe('0x9'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x17b890,_0x470849,_0x677fed){return new BPromise(function(_0x5f1758,_0x218e6a){return client[_0xfbfe('0xa')](_0x17b890,_0x677fed)[_0xfbfe('0xb')](function(_0x1335a1){logger[_0xfbfe('0xc')]('Schedule,\x20%s,\x20%s',_0x470849,_0xfbfe('0xd'));logger['debug'](_0xfbfe('0xe'),_0x470849,_0xfbfe('0xd'),JSON[_0xfbfe('0xf')](_0x1335a1));if(_0x1335a1['error']){if(_0x1335a1['error'][_0xfbfe('0x10')]===0x1f4){logger['error'](_0xfbfe('0x11'),_0x470849,_0x1335a1[_0xfbfe('0x12')][_0xfbfe('0x13')]);return _0x218e6a(_0x1335a1[_0xfbfe('0x12')]['message']);}logger[_0xfbfe('0x12')]('Schedule,\x20%s,\x20%s',_0x470849,_0x1335a1[_0xfbfe('0x12')][_0xfbfe('0x13')]);return _0x5f1758(_0x1335a1[_0xfbfe('0x12')][_0xfbfe('0x13')]);}else{logger[_0xfbfe('0xc')](_0xfbfe('0x11'),_0x470849,'request\x20sent');_0x5f1758(_0x1335a1[_0xfbfe('0x14')][_0xfbfe('0x13')]);}})[_0xfbfe('0x15')](function(_0x37a1be){logger[_0xfbfe('0x12')]('Schedule,\x20%s,\x20%s',_0x470849,_0x37a1be);_0x218e6a(_0x37a1be);});});} \ No newline at end of file +var _0xf8f2=['rpc','client','then','info','Schedule,\x20%s,\x20%s','request\x20sent','debug','Schedule,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','util','moment','bluebird','../../mysqldb'];(function(_0x51020b,_0x38c2c7){var _0x371e47=function(_0x2a538f){while(--_0x2a538f){_0x51020b['push'](_0x51020b['shift']());}};_0x371e47(++_0x38c2c7);}(_0xf8f2,0x171));var _0x2f8f=function(_0x4b4501,_0x105927){_0x4b4501=_0x4b4501-0x0;var _0x421562=_0xf8f2[_0x4b4501];return _0x421562;};'use strict';var _=require(_0x2f8f('0x0'));var util=require(_0x2f8f('0x1'));var moment=require(_0x2f8f('0x2'));var BPromise=require(_0x2f8f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2f8f('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x2f8f('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x2f8f('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2125f5,_0x17878a,_0x3b78b2){return new BPromise(function(_0x4d3be3,_0x49ffb8){return client['request'](_0x2125f5,_0x3b78b2)[_0x2f8f('0x7')](function(_0xeaccf){logger[_0x2f8f('0x8')](_0x2f8f('0x9'),_0x17878a,_0x2f8f('0xa'));logger[_0x2f8f('0xb')](_0x2f8f('0xc'),_0x17878a,_0x2f8f('0xa'),JSON['stringify'](_0xeaccf));if(_0xeaccf['error']){if(_0xeaccf[_0x2f8f('0xd')]['code']===0x1f4){logger[_0x2f8f('0xd')](_0x2f8f('0x9'),_0x17878a,_0xeaccf[_0x2f8f('0xd')][_0x2f8f('0xe')]);return _0x49ffb8(_0xeaccf[_0x2f8f('0xd')][_0x2f8f('0xe')]);}logger[_0x2f8f('0xd')](_0x2f8f('0x9'),_0x17878a,_0xeaccf['error'][_0x2f8f('0xe')]);return _0x4d3be3(_0xeaccf['error'][_0x2f8f('0xe')]);}else{logger[_0x2f8f('0x8')]('Schedule,\x20%s,\x20%s',_0x17878a,_0x2f8f('0xa'));_0x4d3be3(_0xeaccf[_0x2f8f('0xf')][_0x2f8f('0xe')]);}})[_0x2f8f('0x10')](function(_0x16014d){logger[_0x2f8f('0xd')]('Schedule,\x20%s,\x20%s',_0x17878a,_0x16014d);_0x49ffb8(_0x16014d);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index 60239eb..19fe706 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 _0x5711=['show','/:id/download','download','create','put','update','delete','destroy','multer','util','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','/:id'];(function(_0x2e8b1e,_0x13c934){var _0x3a707a=function(_0x33dbf){while(--_0x33dbf){_0x2e8b1e['push'](_0x2e8b1e['shift']());}};_0x3a707a(++_0x13c934);}(_0x5711,0x94));var _0x1571=function(_0x593564,_0x43583f){_0x593564=_0x593564-0x0;var _0x211a89=_0x5711[_0x593564];return _0x211a89;};'use strict';var multer=require(_0x1571('0x0'));var util=require(_0x1571('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x1571('0x2'));var router=express['Router']();var fs_extra=require(_0x1571('0x3'));var auth=require(_0x1571('0x4'));var interaction=require(_0x1571('0x5'));var config=require(_0x1571('0x6'));var controller=require('./screenRecording.controller');router[_0x1571('0x7')]('/',auth['isAuthenticated'](),controller[_0x1571('0x8')]);router[_0x1571('0x7')](_0x1571('0x9'),auth[_0x1571('0xa')](),controller['describe']);router['get'](_0x1571('0xb'),auth[_0x1571('0xa')](),controller[_0x1571('0xc')]);router['get'](_0x1571('0xd'),auth[_0x1571('0xa')](),controller[_0x1571('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0x1571('0xf')]);router[_0x1571('0x10')](_0x1571('0xb'),auth[_0x1571('0xa')](),controller[_0x1571('0x11')]);router[_0x1571('0x12')](_0x1571('0xb'),auth[_0x1571('0xa')](),controller[_0x1571('0x13')]);module['exports']=router; \ No newline at end of file +var _0xf53b=['show','download','post','create','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./screenRecording.controller','get','/describe','isAuthenticated','describe','/:id'];(function(_0xbdf55e,_0x5e4edb){var _0x5aa5af=function(_0x42420c){while(--_0x42420c){_0xbdf55e['push'](_0xbdf55e['shift']());}};_0x5aa5af(++_0x5e4edb);}(_0xf53b,0xf8));var _0xbf53=function(_0x2e7105,_0x391c65){_0x2e7105=_0x2e7105-0x0;var _0x306db8=_0xf53b[_0x2e7105];return _0x306db8;};'use strict';var multer=require(_0xbf53('0x0'));var util=require(_0xbf53('0x1'));var path=require(_0xbf53('0x2'));var timeout=require(_0xbf53('0x3'));var express=require(_0xbf53('0x4'));var router=express[_0xbf53('0x5')]();var fs_extra=require(_0xbf53('0x6'));var auth=require(_0xbf53('0x7'));var interaction=require(_0xbf53('0x8'));var config=require(_0xbf53('0x9'));var controller=require(_0xbf53('0xa'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xbf53('0xb')](_0xbf53('0xc'),auth[_0xbf53('0xd')](),controller[_0xbf53('0xe')]);router[_0xbf53('0xb')](_0xbf53('0xf'),auth[_0xbf53('0xd')](),controller[_0xbf53('0x10')]);router['get']('/:id/download',auth['isAuthenticated'](),controller[_0xbf53('0x11')]);router[_0xbf53('0x12')]('/',auth[_0xbf53('0xd')](),controller[_0xbf53('0x13')]);router[_0xbf53('0x14')]('/:id',auth[_0xbf53('0xd')](),controller[_0xbf53('0x15')]);router['delete'](_0xbf53('0xf'),auth['isAuthenticated'](),controller[_0xbf53('0x16')]);module[_0xbf53('0x17')]=router; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.attributes.js b/server/api/screenRecording/screenRecording.attributes.js index 1c64e76..6e0900c 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 _0x2581=['value','extname','STRING','replace','setDataValue','INTEGER','subtract','closedAt','DATE','startedAt','format','toString','MM-DD-YYYY\x20HH:mm','sequelize','moment','path','../../config/environment','exports','getDataValue'];(function(_0x156b4c,_0x32fab7){var _0x91e4e5=function(_0x1817b5){while(--_0x1817b5){_0x156b4c['push'](_0x156b4c['shift']());}};_0x91e4e5(++_0x32fab7);}(_0x2581,0xcb));var _0x1258=function(_0x516b4e,_0x75e8f3){_0x516b4e=_0x516b4e-0x0;var _0x58d624=_0x2581[_0x516b4e];return _0x58d624;};'use strict';var Sequelize=require(_0x1258('0x0'));var moment=require(_0x1258('0x1'));var path=require(_0x1258('0x2'));var config=require(_0x1258('0x3'));module[_0x1258('0x4')]={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x1258('0x5')](_0x1258('0x6'))?path[_0x1258('0x7')](this[_0x1258('0x5')](_0x1258('0x6'))):undefined;}},'interactionid':{'type':Sequelize[_0x1258('0x8')]},'channel':{'type':Sequelize[_0x1258('0x8')]},'value':{'type':Sequelize[_0x1258('0x8')],'set':function(_0x582ed7){var _0x3e1044=_0x582ed7[_0x1258('0x9')](/\\/g,'/');this[_0x1258('0xa')](_0x1258('0x6'),_0x3e1044);}},'rating':{'type':Sequelize[_0x1258('0xb')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0x1258('0xb')],'set':function(_0x429efc){this['setDataValue']('startedAt',moment()[_0x1258('0xc')](_0x429efc,'ms'));this[_0x1258('0xa')](_0x1258('0xd'),moment());this[_0x1258('0xa')]('duration',_0x429efc);}},'startedAt':{'type':Sequelize[_0x1258('0xe')],'get':function(){return moment(this[_0x1258('0x5')](_0x1258('0xf')))[_0x1258('0x10')]('MM-DD-YYYY\x20HH:mm')[_0x1258('0x11')]();}},'closedAt':{'type':Sequelize[_0x1258('0xe')],'get':function(){return moment(this[_0x1258('0x5')](_0x1258('0xd')))[_0x1258('0x10')](_0x1258('0x12'))[_0x1258('0x11')]();}},'createdAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x1258('0x5')]('createdAt'))[_0x1258('0x10')](_0x1258('0x12'))[_0x1258('0x11')]();}},'updatedAt':{'type':Sequelize[_0x1258('0xe')],'get':function(){return moment(this[_0x1258('0x5')]('updatedAt'))[_0x1258('0x10')](_0x1258('0x12'))[_0x1258('0x11')]();}}}; \ No newline at end of file +var _0xa848=['duration','DATE','format','MM-DD-YYYY\x20HH:mm','toString','updatedAt','sequelize','moment','path','exports','VIRTUAL','getDataValue','value','extname','STRING','replace','setDataValue','INTEGER','startedAt','subtract','closedAt'];(function(_0xf08827,_0x36d525){var _0x339b17=function(_0x341390){while(--_0x341390){_0xf08827['push'](_0xf08827['shift']());}};_0x339b17(++_0x36d525);}(_0xa848,0x99));var _0x8a84=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0xa848[_0x3b380d];return _0x54502b;};'use strict';var Sequelize=require(_0x8a84('0x0'));var moment=require(_0x8a84('0x1'));var path=require(_0x8a84('0x2'));var config=require('../../config/environment');module[_0x8a84('0x3')]={'format':{'type':Sequelize[_0x8a84('0x4')],'get':function(){return this[_0x8a84('0x5')](_0x8a84('0x6'))?path[_0x8a84('0x7')](this[_0x8a84('0x5')](_0x8a84('0x6'))):undefined;}},'interactionid':{'type':Sequelize[_0x8a84('0x8')]},'channel':{'type':Sequelize[_0x8a84('0x8')]},'value':{'type':Sequelize[_0x8a84('0x8')],'set':function(_0x1d463b){var _0x1b958b=_0x1d463b[_0x8a84('0x9')](/\\/g,'/');this[_0x8a84('0xa')]('value',_0x1b958b);}},'rating':{'type':Sequelize[_0x8a84('0xb')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0x8a84('0xb')],'set':function(_0x2294c8){this['setDataValue'](_0x8a84('0xc'),moment()[_0x8a84('0xd')](_0x2294c8,'ms'));this[_0x8a84('0xa')](_0x8a84('0xe'),moment());this[_0x8a84('0xa')](_0x8a84('0xf'),_0x2294c8);}},'startedAt':{'type':Sequelize[_0x8a84('0x10')],'get':function(){return moment(this[_0x8a84('0x5')](_0x8a84('0xc')))[_0x8a84('0x11')](_0x8a84('0x12'))[_0x8a84('0x13')]();}},'closedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x8a84('0x5')](_0x8a84('0xe')))[_0x8a84('0x11')]('MM-DD-YYYY\x20HH:mm')[_0x8a84('0x13')]();}},'createdAt':{'type':Sequelize[_0x8a84('0x10')],'get':function(){return moment(this[_0x8a84('0x5')]('createdAt'))[_0x8a84('0x11')](_0x8a84('0x12'))['toString']();}},'updatedAt':{'type':Sequelize[_0x8a84('0x10')],'get':function(){return moment(this[_0x8a84('0x5')](_0x8a84('0x14')))[_0x8a84('0x11')]('MM-DD-YYYY\x20HH:mm')[_0x8a84('0x13')]();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index 11ad958..a5648ff 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 _0x6aa7=['fieldName','type','model','differenceBy','format','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','find','catch','create','body','duration','createdAt','closedAt','params','describe','../../components/encryptor','uniqueid','value','join','root','server/files/screen_recordings','%s.cypher','secrets','recording','existsSync','Sequelize','ValidationError','ScreenRecording\x20not\x20found','filename','unlink','download','message','Not\x20found','isNil','cancellazione\x20fisica\x20documento\x20%s','info','File:\x20\x22','unlinkSync','.cypher','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','undefined','count','offset','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','send','map','ScreenRecording','rawAttributes'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0x6aa7,0x178));var _0x76aa=function(_0x95ad75,_0x494e6f){_0x95ad75=_0x95ad75-0x0;var _0xe3a140=_0x6aa7[_0x95ad75];return _0xe3a140;};'use strict';var emlformat=require(_0x76aa('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x76aa('0x1'));var jsonpatch=require(_0x76aa('0x2'));var rp=require(_0x76aa('0x3'));var moment=require(_0x76aa('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x76aa('0x5'));var util=require(_0x76aa('0x6'));var path=require(_0x76aa('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x76aa('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x76aa('0x9'));var squel=require(_0x76aa('0xa'));var crypto=require(_0x76aa('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x76aa('0xc'));var toCsv=require(_0x76aa('0xd'));var querystring=require(_0x76aa('0xe'));var Papa=require('papaparse');var Redis=require(_0x76aa('0xf'));var authService=require(_0x76aa('0x10'));var qs=require(_0x76aa('0x11'));var as=require(_0x76aa('0x12'));var hardwareService=require(_0x76aa('0x13'));var logger=require(_0x76aa('0x14'))(_0x76aa('0x15'));var utils=require(_0x76aa('0x16'));var config=require(_0x76aa('0x17'));var licenseUtil=require(_0x76aa('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x112c39,_0x5df49c){_0x5df49c=_0x5df49c||0xcc;return function(_0x226536){if(_0x226536){return _0x112c39[_0x76aa('0x19')](_0x5df49c);}return _0x112c39[_0x76aa('0x1a')](_0x5df49c)[_0x76aa('0x1b')]();};}function respondWithResult(_0x10432c,_0x4e309f){_0x4e309f=_0x4e309f||0xc8;return function(_0x5f5b59){if(_0x5f5b59){return _0x10432c[_0x76aa('0x1a')](_0x4e309f)['json'](_0x5f5b59);}};}function respondWithFilteredResult(_0x180d92,_0x319bf1){return function(_0x5cf594){if(_0x5cf594){var _0x2111c7=typeof _0x319bf1['offset']===_0x76aa('0x1c')&&typeof _0x319bf1['limit']===_0x76aa('0x1c');var _0x413cf6=_0x5cf594[_0x76aa('0x1d')];var _0x21c16d=_0x2111c7?0x0:_0x319bf1[_0x76aa('0x1e')];var _0x3ead3f=_0x2111c7?_0x5cf594['count']:_0x319bf1['offset']+_0x319bf1[_0x76aa('0x1f')];var _0x454dd3;if(_0x3ead3f>=_0x413cf6){_0x3ead3f=_0x413cf6;_0x454dd3=0xc8;}else{_0x454dd3=0xce;}_0x180d92[_0x76aa('0x1a')](_0x454dd3);return _0x180d92[_0x76aa('0x20')](_0x76aa('0x21'),_0x21c16d+'-'+_0x3ead3f+'/'+_0x413cf6)[_0x76aa('0x22')](_0x5cf594);}return null;};}function patchUpdates(_0x19af92){return function(_0x2eaf48){try{jsonpatch[_0x76aa('0x23')](_0x2eaf48,_0x19af92,!![]);}catch(_0x5990c1){return BPromise[_0x76aa('0x24')](_0x5990c1);}return _0x2eaf48[_0x76aa('0x25')]();};}function saveUpdates(_0x338a6b,_0x5b3f55){return function(_0x41463a){if(_0x41463a){return _0x41463a[_0x76aa('0x26')](_0x338a6b)[_0x76aa('0x27')](function(_0x2bd2c6){return _0x2bd2c6;});}return null;};}function removeEntity(_0x29c50c,_0xc1044c){return function(_0x3cd039){if(_0x3cd039){return _0x3cd039[_0x76aa('0x28')]()[_0x76aa('0x27')](function(){_0x29c50c[_0x76aa('0x1a')](0xcc)[_0x76aa('0x1b')]();});}};}function handleEntityNotFound(_0x26b75e,_0x3599a9){return function(_0x4ef9b0){if(!_0x4ef9b0){_0x26b75e[_0x76aa('0x19')](0x194);}return _0x4ef9b0;};}function handleError(_0x1d6d15,_0x25c614){_0x25c614=_0x25c614||0x1f4;return function(_0x2e7ab4){logger[_0x76aa('0x29')](_0x2e7ab4[_0x76aa('0x2a')]);if(_0x2e7ab4[_0x76aa('0x2b')]){delete _0x2e7ab4[_0x76aa('0x2b')];}_0x1d6d15[_0x76aa('0x1a')](_0x25c614)[_0x76aa('0x2c')](_0x2e7ab4);};}exports['index']=function(_0x3fcb7f,_0x5a8030){var _0x994550={},_0x365ff8={},_0x2dec94={'count':0x0,'rows':[]};var _0x1e90b9=_[_0x76aa('0x2d')](db[_0x76aa('0x2e')][_0x76aa('0x2f')],function(_0x3827ec){return{'name':_0x3827ec[_0x76aa('0x30')],'type':_0x3827ec[_0x76aa('0x31')]['key']};});_0x365ff8[_0x76aa('0x32')]=_[_0x76aa('0x33')](_[_0x76aa('0x2d')](_0x1e90b9,_0x76aa('0x2b')),[_0x76aa('0x34')]);_0x365ff8[_0x76aa('0x35')]=_[_0x76aa('0x36')](_0x3fcb7f['query']);_0x365ff8[_0x76aa('0x37')]=_[_0x76aa('0x38')](_0x365ff8['model'],_0x365ff8[_0x76aa('0x35')]);_0x994550['attributes']=_[_0x76aa('0x38')](_0x365ff8['model'],qs[_0x76aa('0x39')](_0x3fcb7f['query']['fields']));_0x994550[_0x76aa('0x3a')]=_0x994550[_0x76aa('0x3a')][_0x76aa('0x3b')]?_0x994550[_0x76aa('0x3a')]:_0x365ff8['model'];if(!_0x3fcb7f['query'][_0x76aa('0x3c')](_0x76aa('0x3d'))){_0x994550[_0x76aa('0x1f')]=qs[_0x76aa('0x1f')](_0x3fcb7f[_0x76aa('0x35')]['limit']);_0x994550[_0x76aa('0x1e')]=qs['offset'](_0x3fcb7f['query'][_0x76aa('0x1e')]);}_0x994550[_0x76aa('0x3e')]=qs[_0x76aa('0x3f')](_0x3fcb7f[_0x76aa('0x35')]['sort']);_0x994550[_0x76aa('0x40')]=qs[_0x76aa('0x37')](_[_0x76aa('0x41')](_0x3fcb7f['query'],_0x365ff8[_0x76aa('0x37')]),_0x1e90b9);if(_0x3fcb7f[_0x76aa('0x35')][_0x76aa('0x42')]){_0x994550[_0x76aa('0x40')]=_[_0x76aa('0x43')](_0x994550[_0x76aa('0x40')],{'$or':_[_0x76aa('0x2d')](_0x1e90b9,function(_0x307d67){if(_0x307d67[_0x76aa('0x31')]!=='VIRTUAL'){var _0x1525cb={};_0x1525cb[_0x307d67[_0x76aa('0x2b')]]={'$like':'%'+_0x3fcb7f[_0x76aa('0x35')][_0x76aa('0x42')]+'%'};return _0x1525cb;}})});}_0x994550=_[_0x76aa('0x43')]({},_0x994550,_0x3fcb7f[_0x76aa('0x44')]);var _0x572fdb={'where':_0x994550['where']};return db[_0x76aa('0x2e')][_0x76aa('0x1d')](_0x572fdb)[_0x76aa('0x27')](function(_0x365612){_0x2dec94['count']=_0x365612;if(_0x3fcb7f[_0x76aa('0x35')][_0x76aa('0x45')]){_0x994550[_0x76aa('0x46')]=[{'all':!![]}];}return db[_0x76aa('0x2e')][_0x76aa('0x47')](_0x994550);})['then'](function(_0x13dafe){_0x2dec94['rows']=_0x13dafe;return _0x2dec94;})[_0x76aa('0x27')](respondWithFilteredResult(_0x5a8030,_0x994550))['catch'](handleError(_0x5a8030,null));};exports['show']=function(_0x4f7f3a,_0x144f0a){var _0x541594={'raw':![],'where':{'id':_0x4f7f3a['params']['id']}},_0x5cf314={};_0x5cf314[_0x76aa('0x32')]=_[_0x76aa('0x36')](db[_0x76aa('0x2e')][_0x76aa('0x2f')]);_0x5cf314[_0x76aa('0x35')]=_['keys'](_0x4f7f3a[_0x76aa('0x35')]);_0x5cf314[_0x76aa('0x37')]=_[_0x76aa('0x38')](_0x5cf314[_0x76aa('0x32')],_0x5cf314[_0x76aa('0x35')]);_0x541594['attributes']=_[_0x76aa('0x38')](_0x5cf314[_0x76aa('0x32')],qs['fields'](_0x4f7f3a[_0x76aa('0x35')]['fields']));_0x541594[_0x76aa('0x3a')]=_0x541594[_0x76aa('0x3a')][_0x76aa('0x3b')]?_0x541594[_0x76aa('0x3a')]:_0x5cf314[_0x76aa('0x32')];if(_0x4f7f3a[_0x76aa('0x35')][_0x76aa('0x45')]){_0x541594[_0x76aa('0x46')]=[{'all':!![]}];}_0x541594=_[_0x76aa('0x43')]({},_0x541594,_0x4f7f3a[_0x76aa('0x44')]);return db['ScreenRecording'][_0x76aa('0x48')](_0x541594)['then'](handleEntityNotFound(_0x144f0a,null))[_0x76aa('0x27')](respondWithResult(_0x144f0a,null))[_0x76aa('0x49')](handleError(_0x144f0a,null));};exports[_0x76aa('0x4a')]=function(_0x156d4e,_0x5ca721){return db['ScreenRecording'][_0x76aa('0x4a')](_0x156d4e['body'],{})[_0x76aa('0x27')](respondWithResult(_0x5ca721,0xc9))[_0x76aa('0x49')](handleError(_0x5ca721,null));};exports[_0x76aa('0x26')]=function(_0x2e5633,_0x30c577){if(_0x2e5633[_0x76aa('0x4b')]['id']){delete _0x2e5633['body']['id'];}delete _0x2e5633['body'][_0x76aa('0x4c')];delete _0x2e5633[_0x76aa('0x4b')][_0x76aa('0x4d')];delete _0x2e5633[_0x76aa('0x4b')][_0x76aa('0x4e')];delete _0x2e5633[_0x76aa('0x4b')]['value'];return db[_0x76aa('0x2e')][_0x76aa('0x48')]({'where':{'id':_0x2e5633[_0x76aa('0x4f')]['id']}})['then'](handleEntityNotFound(_0x30c577,null))[_0x76aa('0x27')](saveUpdates(_0x2e5633['body'],null))[_0x76aa('0x27')](respondWithResult(_0x30c577,null))['catch'](handleError(_0x30c577,null));};exports[_0x76aa('0x50')]=function(_0x4449c1,_0x3c63e5){return db[_0x76aa('0x2e')][_0x76aa('0x50')]()[_0x76aa('0x27')](respondWithResult(_0x3c63e5,null))[_0x76aa('0x49')](handleError(_0x3c63e5,null));};exports['download']=function(_0x186654,_0x5eeaa5,_0x3ee32){var _0x311bd5=require(_0x76aa('0x51'));var _0x53be10=![];var _0x3fa7ec={};if(_0x186654[_0x76aa('0x35')][_0x76aa('0x31')]&&_0x186654['query'][_0x76aa('0x31')]===_0x76aa('0x52')){_0x3fa7ec[_0x76aa('0x52')]=_0x186654[_0x76aa('0x4f')]['id'];}else{_0x3fa7ec['id']=_0x186654['params']['id'];}return db[_0x76aa('0x2e')][_0x76aa('0x48')]({'where':_0x3fa7ec,'attributes':['id',_0x76aa('0x53')],'raw':!![]})[_0x76aa('0x27')](handleEntityNotFound(_0x5eeaa5,null))[_0x76aa('0x27')](function(_0xf7732){if(_0xf7732){var _0x4e6c09=path[_0x76aa('0x54')](config[_0x76aa('0x55')],_0x76aa('0x56'),_0xf7732[_0x76aa('0x53')]);var _0x3967f3=util[_0x76aa('0x34')](_0x76aa('0x57'),_0x4e6c09);if(fs['existsSync'](_0x3967f3)){_0x53be10=!![];return _0x311bd5['decryptFile'](_0x3967f3,_0x4e6c09,config[_0x76aa('0x58')][_0x76aa('0x59')])['then'](function(){return _0xf7732;});}return _0xf7732;}})[_0x76aa('0x27')](function(_0x1e6f3c){if(_0x1e6f3c){var _0x4f832d=path[_0x76aa('0x54')](config[_0x76aa('0x55')],_0x76aa('0x56'),_0x1e6f3c[_0x76aa('0x53')]);if(!fs[_0x76aa('0x5a')](_0x4f832d)){throw new db[(_0x76aa('0x5b'))][(_0x76aa('0x5c'))](_0x76aa('0x5d'));}if(_0x1e6f3c[_0x76aa('0x5e')]){return _0x5eeaa5['download'](_0x4f832d,_0x1e6f3c[_0x76aa('0x5e')]+path['extname'](_0x4f832d),function(){if(_0x53be10){fs[_0x76aa('0x5f')](_0x4f832d);}});}else{return _0x5eeaa5[_0x76aa('0x60')](_0x4f832d,function(_0x2fef92){if(_0x53be10){fs[_0x76aa('0x5f')](_0x4f832d);}});}}})[_0x76aa('0x49')](function(_0x260ad2){if(_0x260ad2[_0x76aa('0x61')]===_0x76aa('0x5d')){_0x5eeaa5[_0x76aa('0x1a')](0x194)['send'](_0x76aa('0x62'));}else{return handleError(_0x5eeaa5,null);}});};exports[_0x76aa('0x28')]=function(_0x5c542b,_0xe5957d){return db[_0x76aa('0x2e')][_0x76aa('0x48')]({'where':{'id':_0x5c542b[_0x76aa('0x4f')]['id']}})[_0x76aa('0x27')](function(_0x5546b6){if(_[_0x76aa('0x63')](_0x5546b6)){throw new ReferenceError('Entity\x20not\x20found');}return _0x5546b6;})[_0x76aa('0x27')](function(_0x35881c){var _0x3e97f8=path[_0x76aa('0x54')](config[_0x76aa('0x55')],_0x76aa('0x56'),_0x35881c[_0x76aa('0x53')]);logger['info'](_0x76aa('0x64'),_0x3e97f8);if(!_[_0x76aa('0x63')](_0x35881c['value'])&&fs['existsSync'](_0x3e97f8)){logger[_0x76aa('0x65')](_0x76aa('0x66')+_0x3e97f8+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x76aa('0x67')](_0x3e97f8);}_0x3e97f8=_0x3e97f8+_0x76aa('0x68');if(!_[_0x76aa('0x63')](_0x35881c['value'])&&fs[_0x76aa('0x5a')](_0x3e97f8)){logger['info'](_0x76aa('0x66')+_0x3e97f8+_0x76aa('0x69'));fs[_0x76aa('0x67')](_0x3e97f8);}return _0x35881c;})[_0x76aa('0x27')](function(_0x55ca84){if(!_0x55ca84)throw new InternalError();return _0x55ca84['destroy']();})[_0x76aa('0x27')](function(){_0xe5957d['status'](0xcc)[_0x76aa('0x1b')]();})[_0x76aa('0x49')](handleError(_0xe5957d,null));}; \ No newline at end of file +var _0x008c=['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','sendStatus','send','index','ScreenRecording','rawAttributes','key','model','differenceBy','map','name','format','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','where','type','VIRTUAL','filter','merge','options','include','findAll','catch','show','params','includeAll','find','create','body','duration','createdAt','closedAt','describe','../../components/encryptor','uniqueid','value','join','root','server/files/screen_recordings','decryptFile','secrets','recording','existsSync','ValidationError','filename','download','extname','unlink','message','ScreenRecording\x20not\x20found','Not\x20found','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','unlinkSync','.cypher','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js'];(function(_0x422905,_0x3bce3a){var _0x33dc6c=function(_0x4852c9){while(--_0x4852c9){_0x422905['push'](_0x422905['shift']());}};_0x33dc6c(++_0x3bce3a);}(_0x008c,0x188));var _0xc008=function(_0x21b359,_0x4dc80e){_0x21b359=_0x21b359-0x0;var _0x57b8e7=_0x008c[_0x21b359];return _0x57b8e7;};'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(){_0x459fd9[_0xc008('0x19')](0xcc)[_0xc008('0x18')]();});}};}function handleEntityNotFound(_0x5410f5,_0x48582b){return function(_0x5de1e9){if(!_0x5de1e9){_0x5410f5[_0xc008('0x23')](0x194);}return _0x5de1e9;};}function handleError(_0x15dade,_0x92c582){_0x92c582=_0x92c582||0x1f4;return function(_0x2e31c2){logger['error'](_0x2e31c2['stack']);if(_0x2e31c2['name']){delete _0x2e31c2['name'];}_0x15dade['status'](_0x92c582)[_0xc008('0x24')](_0x2e31c2);};}exports[_0xc008('0x25')]=function(_0x25eae4,_0x529961){var _0x24c14c={},_0x32390d={},_0x209591={'count':0x0,'rows':[]};var _0x2a7d4f=_['map'](db[_0xc008('0x26')][_0xc008('0x27')],function(_0x53ed35){return{'name':_0x53ed35['fieldName'],'type':_0x53ed35['type'][_0xc008('0x28')]};});_0x32390d[_0xc008('0x29')]=_[_0xc008('0x2a')](_[_0xc008('0x2b')](_0x2a7d4f,_0xc008('0x2c')),[_0xc008('0x2d')]);_0x32390d[_0xc008('0x2e')]=_[_0xc008('0x2f')](_0x25eae4[_0xc008('0x2e')]);_0x32390d[_0xc008('0x30')]=_[_0xc008('0x31')](_0x32390d[_0xc008('0x29')],_0x32390d['query']);_0x24c14c[_0xc008('0x32')]=_[_0xc008('0x31')](_0x32390d['model'],qs[_0xc008('0x33')](_0x25eae4[_0xc008('0x2e')][_0xc008('0x33')]));_0x24c14c[_0xc008('0x32')]=_0x24c14c[_0xc008('0x32')][_0xc008('0x34')]?_0x24c14c[_0xc008('0x32')]:_0x32390d[_0xc008('0x29')];if(!_0x25eae4[_0xc008('0x2e')]['hasOwnProperty'](_0xc008('0x35'))){_0x24c14c[_0xc008('0x1d')]=qs[_0xc008('0x1d')](_0x25eae4[_0xc008('0x2e')][_0xc008('0x1d')]);_0x24c14c[_0xc008('0x1b')]=qs[_0xc008('0x1b')](_0x25eae4['query'][_0xc008('0x1b')]);}_0x24c14c[_0xc008('0x36')]=qs['sort'](_0x25eae4[_0xc008('0x2e')][_0xc008('0x37')]);_0x24c14c['where']=qs[_0xc008('0x30')](_[_0xc008('0x38')](_0x25eae4[_0xc008('0x2e')],_0x32390d['filters']),_0x2a7d4f);if(_0x25eae4['query']['filter']){_0x24c14c[_0xc008('0x39')]=_['merge'](_0x24c14c[_0xc008('0x39')],{'$or':_[_0xc008('0x2b')](_0x2a7d4f,function(_0x6a4ccb){if(_0x6a4ccb[_0xc008('0x3a')]!==_0xc008('0x3b')){var _0xa381d1={};_0xa381d1[_0x6a4ccb[_0xc008('0x2c')]]={'$like':'%'+_0x25eae4[_0xc008('0x2e')][_0xc008('0x3c')]+'%'};return _0xa381d1;}})});}_0x24c14c=_[_0xc008('0x3d')]({},_0x24c14c,_0x25eae4[_0xc008('0x3e')]);var _0xdfca2e={'where':_0x24c14c[_0xc008('0x39')]};return db[_0xc008('0x26')]['count'](_0xdfca2e)[_0xc008('0x21')](function(_0x23c4db){_0x209591[_0xc008('0x1e')]=_0x23c4db;if(_0x25eae4[_0xc008('0x2e')]['includeAll']){_0x24c14c[_0xc008('0x3f')]=[{'all':!![]}];}return db[_0xc008('0x26')][_0xc008('0x40')](_0x24c14c);})[_0xc008('0x21')](function(_0x2d142d){_0x209591['rows']=_0x2d142d;return _0x209591;})[_0xc008('0x21')](respondWithFilteredResult(_0x529961,_0x24c14c))[_0xc008('0x41')](handleError(_0x529961,null));};exports[_0xc008('0x42')]=function(_0x3e9a99,_0x7279e8){var _0x4f93a4={'raw':![],'where':{'id':_0x3e9a99[_0xc008('0x43')]['id']}},_0xf4cc4b={};_0xf4cc4b[_0xc008('0x29')]=_[_0xc008('0x2f')](db['ScreenRecording'][_0xc008('0x27')]);_0xf4cc4b[_0xc008('0x2e')]=_[_0xc008('0x2f')](_0x3e9a99['query']);_0xf4cc4b[_0xc008('0x30')]=_['intersection'](_0xf4cc4b[_0xc008('0x29')],_0xf4cc4b['query']);_0x4f93a4[_0xc008('0x32')]=_[_0xc008('0x31')](_0xf4cc4b['model'],qs[_0xc008('0x33')](_0x3e9a99[_0xc008('0x2e')][_0xc008('0x33')]));_0x4f93a4['attributes']=_0x4f93a4[_0xc008('0x32')][_0xc008('0x34')]?_0x4f93a4[_0xc008('0x32')]:_0xf4cc4b[_0xc008('0x29')];if(_0x3e9a99[_0xc008('0x2e')][_0xc008('0x44')]){_0x4f93a4['include']=[{'all':!![]}];}_0x4f93a4=_['merge']({},_0x4f93a4,_0x3e9a99['options']);return db[_0xc008('0x26')][_0xc008('0x45')](_0x4f93a4)[_0xc008('0x21')](handleEntityNotFound(_0x7279e8,null))[_0xc008('0x21')](respondWithResult(_0x7279e8,null))[_0xc008('0x41')](handleError(_0x7279e8,null));};exports[_0xc008('0x46')]=function(_0x2cf641,_0x33be4f){return db['ScreenRecording']['create'](_0x2cf641['body'],{})[_0xc008('0x21')](respondWithResult(_0x33be4f,0xc9))[_0xc008('0x41')](handleError(_0x33be4f,null));};exports[_0xc008('0x20')]=function(_0x511383,_0x28bc33){if(_0x511383[_0xc008('0x47')]['id']){delete _0x511383[_0xc008('0x47')]['id'];}delete _0x511383[_0xc008('0x47')][_0xc008('0x48')];delete _0x511383[_0xc008('0x47')][_0xc008('0x49')];delete _0x511383[_0xc008('0x47')][_0xc008('0x4a')];delete _0x511383[_0xc008('0x47')]['value'];return db['ScreenRecording'][_0xc008('0x45')]({'where':{'id':_0x511383['params']['id']}})[_0xc008('0x21')](handleEntityNotFound(_0x28bc33,null))[_0xc008('0x21')](saveUpdates(_0x511383[_0xc008('0x47')],null))['then'](respondWithResult(_0x28bc33,null))[_0xc008('0x41')](handleError(_0x28bc33,null));};exports[_0xc008('0x4b')]=function(_0xee64,_0x8b9775){return db[_0xc008('0x26')]['describe']()[_0xc008('0x21')](respondWithResult(_0x8b9775,null))[_0xc008('0x41')](handleError(_0x8b9775,null));};exports['download']=function(_0x24f775,_0xfd6d1d,_0x5b5fbf){var _0x51d3dc=require(_0xc008('0x4c'));var _0xd47b74=![];var _0x20947b={};if(_0x24f775[_0xc008('0x2e')][_0xc008('0x3a')]&&_0x24f775['query']['type']===_0xc008('0x4d')){_0x20947b['uniqueid']=_0x24f775[_0xc008('0x43')]['id'];}else{_0x20947b['id']=_0x24f775[_0xc008('0x43')]['id'];}return db[_0xc008('0x26')][_0xc008('0x45')]({'where':_0x20947b,'attributes':['id',_0xc008('0x4e')],'raw':!![]})[_0xc008('0x21')](handleEntityNotFound(_0xfd6d1d,null))['then'](function(_0x2ea742){if(_0x2ea742){var _0xbd7422=path[_0xc008('0x4f')](config[_0xc008('0x50')],_0xc008('0x51'),_0x2ea742['value']);var _0x41fae3=util['format']('%s.cypher',_0xbd7422);if(fs['existsSync'](_0x41fae3)){_0xd47b74=!![];return _0x51d3dc[_0xc008('0x52')](_0x41fae3,_0xbd7422,config[_0xc008('0x53')][_0xc008('0x54')])['then'](function(){return _0x2ea742;});}return _0x2ea742;}})[_0xc008('0x21')](function(_0x2d8361){if(_0x2d8361){var _0x3dda82=path['join'](config[_0xc008('0x50')],_0xc008('0x51'),_0x2d8361[_0xc008('0x4e')]);if(!fs[_0xc008('0x55')](_0x3dda82)){throw new db['Sequelize'][(_0xc008('0x56'))]('ScreenRecording\x20not\x20found');}if(_0x2d8361[_0xc008('0x57')]){return _0xfd6d1d[_0xc008('0x58')](_0x3dda82,_0x2d8361[_0xc008('0x57')]+path[_0xc008('0x59')](_0x3dda82),function(){if(_0xd47b74){fs[_0xc008('0x5a')](_0x3dda82);}});}else{return _0xfd6d1d[_0xc008('0x58')](_0x3dda82,function(_0x4818c7){if(_0xd47b74){fs[_0xc008('0x5a')](_0x3dda82);}});}}})['catch'](function(_0x5bf4a9){if(_0x5bf4a9[_0xc008('0x5b')]===_0xc008('0x5c')){_0xfd6d1d['status'](0x194)[_0xc008('0x24')](_0xc008('0x5d'));}else{return handleError(_0xfd6d1d,null);}});};exports[_0xc008('0x22')]=function(_0x4517c0,_0x21ee6d){return db[_0xc008('0x26')][_0xc008('0x45')]({'where':{'id':_0x4517c0['params']['id']}})[_0xc008('0x21')](function(_0x462e1e){if(_[_0xc008('0x5e')](_0x462e1e)){throw new ReferenceError(_0xc008('0x5f'));}return _0x462e1e;})[_0xc008('0x21')](function(_0x167425){var _0x249898=path[_0xc008('0x4f')](config[_0xc008('0x50')],_0xc008('0x51'),_0x167425[_0xc008('0x4e')]);logger[_0xc008('0x60')](_0xc008('0x61'),_0x249898);if(!_[_0xc008('0x5e')](_0x167425['value'])&&fs[_0xc008('0x55')](_0x249898)){logger[_0xc008('0x60')](_0xc008('0x62')+_0x249898+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0xc008('0x63')](_0x249898);}_0x249898=_0x249898+_0xc008('0x64');if(!_['isNil'](_0x167425['value'])&&fs[_0xc008('0x55')](_0x249898)){logger[_0xc008('0x60')](_0xc008('0x62')+_0x249898+_0xc008('0x65'));fs[_0xc008('0x63')](_0x249898);}return _0x167425;})[_0xc008('0x21')](function(_0x238852){if(!_0x238852)throw new InternalError();return _0x238852[_0xc008('0x22')]();})[_0xc008('0x21')](function(){_0x21ee6d[_0xc008('0x19')](0xcc)[_0xc008('0x18')]();})['catch'](handleError(_0x21ee6d,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index 7b3bc2a..153a871 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 _0x2aee=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./screenRecording.attributes','exports','define','ScreenRecording','screen_recordings','interactionid','lodash'];(function(_0x4724fb,_0x15dc89){var _0x8e378=function(_0x369dd6){while(--_0x369dd6){_0x4724fb['push'](_0x4724fb['shift']());}};_0x8e378(++_0x15dc89);}(_0x2aee,0x1cf));var _0xe2ae=function(_0x9bca53,_0x59b4f8){_0x9bca53=_0x9bca53-0x0;var _0x3894bc=_0x2aee[_0x9bca53];return _0x3894bc;};'use strict';var _=require(_0xe2ae('0x0'));var util=require(_0xe2ae('0x1'));var logger=require(_0xe2ae('0x2'))(_0xe2ae('0x3'));var moment=require(_0xe2ae('0x4'));var BPromise=require(_0xe2ae('0x5'));var rp=require(_0xe2ae('0x6'));var fs=require('fs');var path=require(_0xe2ae('0x7'));var rimraf=require(_0xe2ae('0x8'));var config=require(_0xe2ae('0x9'));var attributes=require(_0xe2ae('0xa'));module[_0xe2ae('0xb')]=function(_0x296392,_0x3b8d07){return _0x296392[_0xe2ae('0xc')](_0xe2ae('0xd'),attributes,{'tableName':_0xe2ae('0xe'),'paranoid':![],'indexes':[{'name':_0xe2ae('0xf'),'fields':[_0xe2ae('0xf')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa5ad=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./screenRecording.attributes','exports','define','ScreenRecording','screen_recordings','interactionid','lodash','util'];(function(_0x590b61,_0x4c4335){var _0x1a14dc=function(_0x2ff4f6){while(--_0x2ff4f6){_0x590b61['push'](_0x590b61['shift']());}};_0x1a14dc(++_0x4c4335);}(_0xa5ad,0xce));var _0xda5a=function(_0x518342,_0x464bad){_0x518342=_0x518342-0x0;var _0x5a384f=_0xa5ad[_0x518342];return _0x5a384f;};'use strict';var _=require(_0xda5a('0x0'));var util=require(_0xda5a('0x1'));var logger=require(_0xda5a('0x2'))(_0xda5a('0x3'));var moment=require(_0xda5a('0x4'));var BPromise=require(_0xda5a('0x5'));var rp=require(_0xda5a('0x6'));var fs=require('fs');var path=require(_0xda5a('0x7'));var rimraf=require(_0xda5a('0x8'));var config=require(_0xda5a('0x9'));var attributes=require(_0xda5a('0xa'));module[_0xda5a('0xb')]=function(_0x351c9f,_0x5d3bce){return _0x351c9f[_0xda5a('0xc')](_0xda5a('0xd'),attributes,{'tableName':_0xda5a('0xe'),'paranoid':![],'indexes':[{'name':_0xda5a('0xf'),'fields':[_0xda5a('0xf')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.rpc.js b/server/api/screenRecording/screenRecording.rpc.js index 02651c8..1968b42 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 _0xd8ae=['util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','ScreenRecording,\x20%s,\x20%s','request\x20sent','error','message','catch','lodash'];(function(_0x14723d,_0x4e09de){var _0x53227d=function(_0x28aea4){while(--_0x28aea4){_0x14723d['push'](_0x14723d['shift']());}};_0x53227d(++_0x4e09de);}(_0xd8ae,0xaa));var _0xed8a=function(_0x583652,_0x460744){_0x583652=_0x583652-0x0;var _0x4b56fd=_0xd8ae[_0x583652];return _0x4b56fd;};'use strict';var _=require(_0xed8a('0x0'));var util=require(_0xed8a('0x1'));var moment=require('moment');var BPromise=require(_0xed8a('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xed8a('0x3'));var db=require(_0xed8a('0x4'))['db'];var utils=require(_0xed8a('0x5'));var logger=require(_0xed8a('0x6'))('rpc');var config=require(_0xed8a('0x7'));var jayson=require(_0xed8a('0x8'));var client=jayson[_0xed8a('0x9')][_0xed8a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x116b97,_0x9cd37b,_0x4b3764){return new BPromise(function(_0x4ac30c,_0x5bd0c7){return client[_0xed8a('0xb')](_0x116b97,_0x4b3764)[_0xed8a('0xc')](function(_0x1a79ff){logger[_0xed8a('0xd')](_0xed8a('0xe'),_0x9cd37b,'request\x20sent');logger['debug']('ScreenRecording,\x20%s,\x20%s,\x20%s',_0x9cd37b,_0xed8a('0xf'),JSON['stringify'](_0x1a79ff));if(_0x1a79ff[_0xed8a('0x10')]){if(_0x1a79ff['error']['code']===0x1f4){logger[_0xed8a('0x10')](_0xed8a('0xe'),_0x9cd37b,_0x1a79ff['error']['message']);return _0x5bd0c7(_0x1a79ff[_0xed8a('0x10')][_0xed8a('0x11')]);}logger[_0xed8a('0x10')](_0xed8a('0xe'),_0x9cd37b,_0x1a79ff[_0xed8a('0x10')][_0xed8a('0x11')]);return _0x4ac30c(_0x1a79ff[_0xed8a('0x10')][_0xed8a('0x11')]);}else{logger[_0xed8a('0xd')]('ScreenRecording,\x20%s,\x20%s',_0x9cd37b,_0xed8a('0xf'));_0x4ac30c(_0x1a79ff['result'][_0xed8a('0x11')]);}})[_0xed8a('0x12')](function(_0x17b874){logger['error']('ScreenRecording,\x20%s,\x20%s',_0x9cd37b,_0x17b874);_0x5bd0c7(_0x17b874);});});} \ No newline at end of file +var _0x4ccd=['http','request','then','ScreenRecording,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client'];(function(_0x5793e1,_0x5f2966){var _0x43ea8f=function(_0x5aa1b2){while(--_0x5aa1b2){_0x5793e1['push'](_0x5793e1['shift']());}};_0x43ea8f(++_0x5f2966);}(_0x4ccd,0x1c4));var _0xd4cc=function(_0x5817e6,_0x44a2d0){_0x5817e6=_0x5817e6-0x0;var _0x51916a=_0x4ccd[_0x5817e6];return _0x51916a;};'use strict';var _=require(_0xd4cc('0x0'));var util=require(_0xd4cc('0x1'));var moment=require(_0xd4cc('0x2'));var BPromise=require('bluebird');var rs=require(_0xd4cc('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd4cc('0x4'))['db'];var utils=require(_0xd4cc('0x5'));var logger=require(_0xd4cc('0x6'))(_0xd4cc('0x7'));var config=require(_0xd4cc('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xd4cc('0x9')][_0xd4cc('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x279efc,_0x2fc1cb,_0x333505){return new BPromise(function(_0x1f9984,_0x57580a){return client[_0xd4cc('0xb')](_0x279efc,_0x333505)[_0xd4cc('0xc')](function(_0x260a1c){logger['info'](_0xd4cc('0xd'),_0x2fc1cb,_0xd4cc('0xe'));logger['debug']('ScreenRecording,\x20%s,\x20%s,\x20%s',_0x2fc1cb,'request\x20sent',JSON[_0xd4cc('0xf')](_0x260a1c));if(_0x260a1c[_0xd4cc('0x10')]){if(_0x260a1c['error'][_0xd4cc('0x11')]===0x1f4){logger['error'](_0xd4cc('0xd'),_0x2fc1cb,_0x260a1c[_0xd4cc('0x10')][_0xd4cc('0x12')]);return _0x57580a(_0x260a1c['error'][_0xd4cc('0x12')]);}logger[_0xd4cc('0x10')](_0xd4cc('0xd'),_0x2fc1cb,_0x260a1c['error'][_0xd4cc('0x12')]);return _0x1f9984(_0x260a1c[_0xd4cc('0x10')][_0xd4cc('0x12')]);}else{logger[_0xd4cc('0x13')](_0xd4cc('0xd'),_0x2fc1cb,_0xd4cc('0xe'));_0x1f9984(_0x260a1c[_0xd4cc('0x14')][_0xd4cc('0x12')]);}})[_0xd4cc('0x15')](function(_0x26f838){logger[_0xd4cc('0x10')](_0xd4cc('0xd'),_0x2fc1cb,_0x26f838);_0x57580a(_0x26f838);});});} \ No newline at end of file diff --git a/server/api/setting/index.js b/server/api/setting/index.js index 4ccd5f7..aad181a 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 _0x48f8=['/:id/logo_login','getLogoLogin','/:id/gdpr','gdpr','/:id/preferred','getPreferred','/:id/favicon','getFavicon','diskStorage','root','server/files/images/logos/','format','%s%s','logo','extname','/:id/logo','addLogo','join','logologin','originalname','post','addLogoLogin','preferred','single','file','addPreferred','favicon','addFavicon','put','update','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id'];(function(_0x5b8290,_0x30c005){var _0xc4418d=function(_0x310e88){while(--_0x310e88){_0x5b8290['push'](_0x5b8290['shift']());}};_0xc4418d(++_0x30c005);}(_0x48f8,0xf1));var _0x848f=function(_0x465bd3,_0x17a11e){_0x465bd3=_0x465bd3-0x0;var _0x366ccc=_0x48f8[_0x465bd3];return _0x366ccc;};'use strict';var multer=require(_0x848f('0x0'));var util=require('util');var path=require(_0x848f('0x1'));var timeout=require(_0x848f('0x2'));var express=require(_0x848f('0x3'));var router=express[_0x848f('0x4')]();var fs_extra=require(_0x848f('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x848f('0x6'));var config=require(_0x848f('0x7'));var controller=require('./setting.controller');router[_0x848f('0x8')]('/',auth[_0x848f('0x9')](),controller['index']);router[_0x848f('0x8')]('/now',controller['getDate']);router[_0x848f('0x8')](_0x848f('0xa'),controller['show']);router[_0x848f('0x8')]('/:id/logo',controller['getLogo']);router[_0x848f('0x8')](_0x848f('0xb'),controller[_0x848f('0xc')]);router['get'](_0x848f('0xd'),controller[_0x848f('0xe')]);router['get'](_0x848f('0xf'),controller[_0x848f('0x10')]);router[_0x848f('0x8')](_0x848f('0x11'),controller[_0x848f('0x12')]);var upload=multer({'storage':multer[_0x848f('0x13')]({'destination':function(_0x31ed71,_0x47637a,_0x2b47ee){_0x2b47ee(null,path['join'](config[_0x848f('0x14')],_0x848f('0x15')));},'filename':function(_0x4cc201,_0x695677,_0x1314f0){_0x1314f0(null,util[_0x848f('0x16')](_0x848f('0x17'),_0x848f('0x18'),path[_0x848f('0x19')](_0x695677['originalname'])));}})});router['post'](_0x848f('0x1a'),upload['single']('file'),controller[_0x848f('0x1b')]);var upload=multer({'storage':multer[_0x848f('0x13')]({'destination':function(_0x25ab10,_0x36608b,_0x49f36c){_0x49f36c(null,path[_0x848f('0x1c')](config[_0x848f('0x14')],'server/files/images/logos/'));},'filename':function(_0x19e1ab,_0x4276f0,_0x27ba4e){_0x27ba4e(null,util[_0x848f('0x16')](_0x848f('0x17'),_0x848f('0x1d'),path['extname'](_0x4276f0[_0x848f('0x1e')])));}})});router[_0x848f('0x1f')](_0x848f('0xb'),upload['single']('file'),controller[_0x848f('0x20')]);var upload=multer({'storage':multer[_0x848f('0x13')]({'destination':function(_0x592fa0,_0x4bba03,_0xe4950){_0xe4950(null,path[_0x848f('0x1c')](config[_0x848f('0x14')],_0x848f('0x15')));},'filename':function(_0x3fae22,_0x457bfc,_0x59876b){_0x59876b(null,util[_0x848f('0x16')](_0x848f('0x17'),_0x848f('0x21'),path[_0x848f('0x19')](_0x457bfc['originalname'])));}})});router[_0x848f('0x1f')](_0x848f('0xf'),upload[_0x848f('0x22')](_0x848f('0x23')),controller[_0x848f('0x24')]);var upload=multer({'storage':multer[_0x848f('0x13')]({'destination':function(_0x507490,_0x371ba7,_0x3fa1ad){_0x3fa1ad(null,path[_0x848f('0x1c')](config[_0x848f('0x14')],_0x848f('0x15')));},'filename':function(_0x226dd7,_0x57926c,_0xed45c){_0xed45c(null,util[_0x848f('0x16')](_0x848f('0x17'),_0x848f('0x25'),path[_0x848f('0x19')](_0x57926c[_0x848f('0x1e')])));}})});router['post'](_0x848f('0x11'),upload['single']('file'),controller[_0x848f('0x26')]);router[_0x848f('0x27')](_0x848f('0xa'),auth[_0x848f('0x9')](),controller[_0x848f('0x28')]);module[_0x848f('0x29')]=router; \ No newline at end of file +var _0xc324=['update','multer','util','connect-timeout','express','../../components/auth/service','../../config/environment','./setting.controller','isAuthenticated','index','get','/now','getDate','/:id','getLogoLogin','/:id/gdpr','/:id/favicon','getFavicon','diskStorage','root','server/files/images/logos/','format','%s%s','logo','extname','originalname','single','file','join','post','/:id/logo_login','addLogoLogin','preferred','/:id/preferred','addPreferred','favicon','addFavicon','put'];(function(_0x38ba02,_0x2f9f4e){var _0xefb4f5=function(_0x27fb0f){while(--_0x27fb0f){_0x38ba02['push'](_0x38ba02['shift']());}};_0xefb4f5(++_0x2f9f4e);}(_0xc324,0x1c9));var _0x4c32=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc324[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x4c32('0x0'));var util=require(_0x4c32('0x1'));var path=require('path');var timeout=require(_0x4c32('0x2'));var express=require(_0x4c32('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x4c32('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x4c32('0x5'));var controller=require(_0x4c32('0x6'));router['get']('/',auth[_0x4c32('0x7')](),controller[_0x4c32('0x8')]);router[_0x4c32('0x9')](_0x4c32('0xa'),controller[_0x4c32('0xb')]);router[_0x4c32('0x9')](_0x4c32('0xc'),controller['show']);router[_0x4c32('0x9')]('/:id/logo',controller['getLogo']);router[_0x4c32('0x9')]('/:id/logo_login',controller[_0x4c32('0xd')]);router[_0x4c32('0x9')](_0x4c32('0xe'),controller['gdpr']);router['get']('/:id/preferred',controller['getPreferred']);router['get'](_0x4c32('0xf'),controller[_0x4c32('0x10')]);var upload=multer({'storage':multer[_0x4c32('0x11')]({'destination':function(_0x5ab3d7,_0x114965,_0x470575){_0x470575(null,path['join'](config[_0x4c32('0x12')],_0x4c32('0x13')));},'filename':function(_0x24fbae,_0x47eb67,_0x1f0ea4){_0x1f0ea4(null,util[_0x4c32('0x14')](_0x4c32('0x15'),_0x4c32('0x16'),path[_0x4c32('0x17')](_0x47eb67[_0x4c32('0x18')])));}})});router['post']('/:id/logo',upload[_0x4c32('0x19')](_0x4c32('0x1a')),controller['addLogo']);var upload=multer({'storage':multer[_0x4c32('0x11')]({'destination':function(_0x48a69c,_0x21f7a6,_0x3ceb17){_0x3ceb17(null,path[_0x4c32('0x1b')](config['root'],_0x4c32('0x13')));},'filename':function(_0x592586,_0xb52953,_0x319408){_0x319408(null,util[_0x4c32('0x14')](_0x4c32('0x15'),'logologin',path[_0x4c32('0x17')](_0xb52953['originalname'])));}})});router[_0x4c32('0x1c')](_0x4c32('0x1d'),upload[_0x4c32('0x19')](_0x4c32('0x1a')),controller[_0x4c32('0x1e')]);var upload=multer({'storage':multer[_0x4c32('0x11')]({'destination':function(_0x35106e,_0x75b351,_0x5802ae){_0x5802ae(null,path[_0x4c32('0x1b')](config[_0x4c32('0x12')],'server/files/images/logos/'));},'filename':function(_0x1777ea,_0x27e9a0,_0x410a3d){_0x410a3d(null,util[_0x4c32('0x14')]('%s%s',_0x4c32('0x1f'),path[_0x4c32('0x17')](_0x27e9a0[_0x4c32('0x18')])));}})});router[_0x4c32('0x1c')](_0x4c32('0x20'),upload['single'](_0x4c32('0x1a')),controller[_0x4c32('0x21')]);var upload=multer({'storage':multer[_0x4c32('0x11')]({'destination':function(_0x6c6eb1,_0x30e712,_0x2d0b66){_0x2d0b66(null,path[_0x4c32('0x1b')](config[_0x4c32('0x12')],_0x4c32('0x13')));},'filename':function(_0x3a0318,_0x592d5e,_0x20680c){_0x20680c(null,util[_0x4c32('0x14')]('%s%s',_0x4c32('0x22'),path[_0x4c32('0x17')](_0x592d5e['originalname'])));}})});router[_0x4c32('0x1c')](_0x4c32('0xf'),upload[_0x4c32('0x19')](_0x4c32('0x1a')),controller[_0x4c32('0x23')]);router[_0x4c32('0x24')](_0x4c32('0xc'),auth[_0x4c32('0x7')](),controller[_0x4c32('0x25')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/setting/setting.attributes.js b/server/api/setting/setting.attributes.js index e2e3992..7456c03 100644 --- a/server/api/setting/setting.attributes.js +++ b/server/api/setting/setting.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['BOOLEAN','alternate','UNSIGNED','sequelize','exports','INTEGER','min_mailbox','STRING','/var/opt/motion2/server/files/sounds/converted'];(function(_0x280b68,_0x40e9fc){var _0x51c17b=function(_0x35ff30){while(--_0x35ff30){_0x280b68['push'](_0x280b68['shift']());}};_0x51c17b(++_0x40e9fc);}(_0xa9e0,0x123));var _0x0a9e=function(_0x138f59,_0x1b53fb){_0x138f59=_0x138f59-0x0;var _0x3d114d=_0xa9e0[_0x138f59];return _0x3d114d;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'min_internal':{'type':Sequelize[_0x0a9e('0x2')](0xb),'unique':'min_internal','defaultValue':0x3e8},'min_mailbox':{'type':Sequelize['INTEGER'](0xb),'unique':_0x0a9e('0x3'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':_0x0a9e('0x5')},'logo':{'type':Sequelize[_0x0a9e('0x4')]},'defaultLogo':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x0a9e('0x4')]},'defaultLoginLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x0a9e('0x4')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'firstSetup':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'stunaddr':{'type':Sequelize['STRING']},'turnaddr':{'type':Sequelize[_0x0a9e('0x4')]},'turnusername':{'type':Sequelize['STRING']},'turnpassword':{'type':Sequelize['STRING']},'pageTitle':{'type':Sequelize[_0x0a9e('0x4')]},'defaultPageTitle':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x0a9e('0x2')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':'https://www.xcally.com/bar/phonebar/autoupdater.xml'},'enableEmailPreview':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'split':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':_0x0a9e('0x7')},'chatTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'preferred':{'type':Sequelize['STRING']},'defaultPreferred':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x0a9e('0x4')]},'allowedLoginAttempts':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x0a9e('0x4')]},'defaultFavicon':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize['INTEGER']},'transcribeRegion':{'type':Sequelize[_0x0a9e('0x4')]},'sentiment':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x0a9e('0x2')]},'sentimentRegion':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x0a9e('0x4')]},'bucket':{'type':Sequelize[_0x0a9e('0x4')]},'googleSsoEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0x0a9e('0x2')](0x2)['UNSIGNED'],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x5,'validate':{'min':0x1}},'disabledCookie':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'limitTabs':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x14}}; \ No newline at end of file +var _0xa9e0=['BOOLEAN','alternate','UNSIGNED','sequelize','exports','INTEGER','min_mailbox','STRING','/var/opt/motion2/server/files/sounds/converted'];(function(_0x33385a,_0x340697){var _0x22459b=function(_0xa41ae7){while(--_0xa41ae7){_0x33385a['push'](_0x33385a['shift']());}};_0x22459b(++_0x340697);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3c4737,_0x2329ec){_0x3c4737=_0x3c4737-0x0;var _0x2bb926=_0xa9e0[_0x3c4737];return _0x2bb926;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'min_internal':{'type':Sequelize[_0x0a9e('0x2')](0xb),'unique':'min_internal','defaultValue':0x3e8},'min_mailbox':{'type':Sequelize['INTEGER'](0xb),'unique':_0x0a9e('0x3'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':_0x0a9e('0x5')},'logo':{'type':Sequelize[_0x0a9e('0x4')]},'defaultLogo':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x0a9e('0x4')]},'defaultLoginLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x0a9e('0x4')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'firstSetup':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'stunaddr':{'type':Sequelize['STRING']},'turnaddr':{'type':Sequelize[_0x0a9e('0x4')]},'turnusername':{'type':Sequelize['STRING']},'turnpassword':{'type':Sequelize['STRING']},'pageTitle':{'type':Sequelize[_0x0a9e('0x4')]},'defaultPageTitle':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x0a9e('0x2')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':'https://www.xcally.com/bar/phonebar/autoupdater.xml'},'enableEmailPreview':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'split':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':_0x0a9e('0x7')},'chatTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'preferred':{'type':Sequelize['STRING']},'defaultPreferred':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x0a9e('0x4')]},'allowedLoginAttempts':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x0a9e('0x4')]},'defaultFavicon':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize['INTEGER']},'transcribeRegion':{'type':Sequelize[_0x0a9e('0x4')]},'sentiment':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x0a9e('0x2')]},'sentimentRegion':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x0a9e('0x4')]},'bucket':{'type':Sequelize[_0x0a9e('0x4')]},'googleSsoEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0x0a9e('0x2')](0x2)['UNSIGNED'],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x5,'validate':{'min':0x1}},'disabledCookie':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'limitTabs':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x14}}; \ No newline at end of file diff --git a/server/api/setting/setting.controller.js b/server/api/setting/setting.controller.js index 84d84ae..bdec26b 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 _0x575b=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','jayson/promise','client','http','request','info','Setting,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','end','status','json','undefined','count','offset','limit','set','reject','update','then','destroy','stack','name','index','map','Setting','rawAttributes','fieldName','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','include','findAll','rows','params','intersection','find','body','addLogo','file','filename','logo','addLogoLogin','loginLogo','getLogo','server/files/images/logos','preferred','favicon','defaultLoginLogo','defaultPreferred','existsSync','root','toLower','default','upperFirst','custom','join','default_logo.svg','ValidationError','\x20not\x20found','download','getLicense','default_loginLogo.svg','Sequelize','gdpr','securePassword','addPreferred','getPreferred','defaultLogo','defaultFavicon','default_preferred.png','addFavicon','getFavicon','default_favicon.ico','getDate','utcOffset','now','format','send','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis'];(function(_0x1dcd54,_0x5e468a){var _0x49e594=function(_0xc3546a){while(--_0xc3546a){_0x1dcd54['push'](_0x1dcd54['shift']());}};_0x49e594(++_0x5e468a);}(_0x575b,0x1e0));var _0xb575=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x575b[_0x17d9e3];return _0x14192d;};'use strict';var emlformat=require(_0xb575('0x0'));var rimraf=require(_0xb575('0x1'));var zipdir=require(_0xb575('0x2'));var jsonpatch=require(_0xb575('0x3'));var rp=require(_0xb575('0x4'));var moment=require('moment');var BPromise=require(_0xb575('0x5'));var Mustache=require(_0xb575('0x6'));var util=require('util');var path=require(_0xb575('0x7'));var sox=require(_0xb575('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xb575('0x9'));var crypto=require(_0xb575('0xa'));var jsforce=require(_0xb575('0xb'));var deskjs=require(_0xb575('0xc'));var toCsv=require('to-csv');var querystring=require(_0xb575('0xd'));var Papa=require(_0xb575('0xe'));var Redis=require(_0xb575('0xf'));var authService=require(_0xb575('0x10'));var qs=require(_0xb575('0x11'));var as=require(_0xb575('0x12'));var hardwareService=require(_0xb575('0x13'));var logger=require(_0xb575('0x14'))(_0xb575('0x15'));var utils=require('../../config/utils');var config=require(_0xb575('0x16'));var licenseUtil=require(_0xb575('0x17'));var db=require('../../mysqldb')['db'];var jayson=require(_0xb575('0x18'));var client=jayson[_0xb575('0x19')][_0xb575('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x2bace2,_0x200b3b,_0x36dfc5,_0x2bff4d){return new BPromise(function(_0x55cc73,_0x4a4911){var _0x3006fb=_0x2bff4d||client;return _0x3006fb[_0xb575('0x1b')](_0x2bace2,_0x36dfc5)['then'](function(_0xe32150){logger[_0xb575('0x1c')](_0xb575('0x1d'),_0x200b3b,_0xb575('0x1e'));logger['debug']('Setting,\x20%s,\x20%s,\x20%s',_0x200b3b,'request\x20sent',JSON[_0xb575('0x1f')](_0xe32150));if(_0xe32150[_0xb575('0x20')]){if(_0xe32150[_0xb575('0x20')][_0xb575('0x21')]===0x1f4){logger[_0xb575('0x20')](_0xb575('0x1d'),_0x200b3b,_0xe32150['error'][_0xb575('0x22')]);return _0x4a4911(_0xe32150['error']['message']);}logger[_0xb575('0x20')]('Setting,\x20%s,\x20%s',_0x200b3b,_0xe32150[_0xb575('0x20')][_0xb575('0x22')]);return _0x55cc73(_0xe32150['error'][_0xb575('0x22')]);}else{logger[_0xb575('0x1c')](_0xb575('0x1d'),_0x200b3b,_0xb575('0x1e'));_0x55cc73(_0xe32150[_0xb575('0x23')][_0xb575('0x22')]);}})[_0xb575('0x24')](function(_0xc54a3){logger[_0xb575('0x20')]('Setting,\x20%s,\x20%s',_0x200b3b,_0xc54a3);_0x4a4911(_0xc54a3);});});}function respondWithStatusCode(_0x4ee867,_0x250e70){_0x250e70=_0x250e70||0xcc;return function(_0x57b4cb){if(_0x57b4cb){return _0x4ee867[_0xb575('0x25')](_0x250e70);}return _0x4ee867['status'](_0x250e70)[_0xb575('0x26')]();};}function respondWithResult(_0x1a2eda,_0x2296c8){_0x2296c8=_0x2296c8||0xc8;return function(_0x121065){if(_0x121065){return _0x1a2eda[_0xb575('0x27')](_0x2296c8)[_0xb575('0x28')](_0x121065);}};}function respondWithFilteredResult(_0x37b573,_0x5d9a82){return function(_0x39e725){if(_0x39e725){var _0xad37de=typeof _0x5d9a82['offset']===_0xb575('0x29')&&typeof _0x5d9a82['limit']===_0xb575('0x29');var _0x17d18b=_0x39e725[_0xb575('0x2a')];var _0x583a2d=_0xad37de?0x0:_0x5d9a82[_0xb575('0x2b')];var _0x527d71=_0xad37de?_0x39e725['count']:_0x5d9a82['offset']+_0x5d9a82[_0xb575('0x2c')];var _0x4928be;if(_0x527d71>=_0x17d18b){_0x527d71=_0x17d18b;_0x4928be=0xc8;}else{_0x4928be=0xce;}_0x37b573['status'](_0x4928be);return _0x37b573[_0xb575('0x2d')]('Content-Range',_0x583a2d+'-'+_0x527d71+'/'+_0x17d18b)['json'](_0x39e725);}return null;};}function patchUpdates(_0x5e53c8){return function(_0x7a22a1){try{jsonpatch['apply'](_0x7a22a1,_0x5e53c8,!![]);}catch(_0x405448){return BPromise[_0xb575('0x2e')](_0x405448);}return _0x7a22a1['save']();};}function saveUpdates(_0x49100f,_0x3edd3a){return function(_0x26638f){if(_0x26638f){return _0x26638f[_0xb575('0x2f')](_0x49100f)[_0xb575('0x30')](function(_0x431018){return _0x431018;});}return null;};}function removeEntity(_0x2726a8,_0x342bed){return function(_0x30563f){if(_0x30563f){return _0x30563f[_0xb575('0x31')]()[_0xb575('0x30')](function(){_0x2726a8[_0xb575('0x27')](0xcc)[_0xb575('0x26')]();});}};}function handleEntityNotFound(_0x23cdf8,_0x1646c2){return function(_0x181a00){if(!_0x181a00){_0x23cdf8[_0xb575('0x25')](0x194);}return _0x181a00;};}function handleError(_0x547d50,_0x2aafee){_0x2aafee=_0x2aafee||0x1f4;return function(_0x33f503){logger[_0xb575('0x20')](_0x33f503[_0xb575('0x32')]);if(_0x33f503[_0xb575('0x33')]){delete _0x33f503[_0xb575('0x33')];}_0x547d50[_0xb575('0x27')](_0x2aafee)['send'](_0x33f503);};}exports[_0xb575('0x34')]=function(_0x5b092,_0x4c3a95){var _0x504148={},_0x1cf385={},_0x5740f1={'count':0x0,'rows':[]};var _0x5597ed=_[_0xb575('0x35')](db[_0xb575('0x36')][_0xb575('0x37')],function(_0x9ff40e){return{'name':_0x9ff40e[_0xb575('0x38')],'type':_0x9ff40e['type'][_0xb575('0x39')]};});_0x1cf385[_0xb575('0x3a')]=_[_0xb575('0x35')](_0x5597ed,_0xb575('0x33'));_0x1cf385[_0xb575('0x3b')]=_[_0xb575('0x3c')](_0x5b092[_0xb575('0x3b')]);_0x1cf385[_0xb575('0x3d')]=_['intersection'](_0x1cf385[_0xb575('0x3a')],_0x1cf385[_0xb575('0x3b')]);_0x504148[_0xb575('0x3e')]=_['intersection'](_0x1cf385['model'],qs[_0xb575('0x3f')](_0x5b092[_0xb575('0x3b')][_0xb575('0x3f')]));_0x504148[_0xb575('0x3e')]=_0x504148['attributes'][_0xb575('0x40')]?_0x504148[_0xb575('0x3e')]:_0x1cf385[_0xb575('0x3a')];if(!_0x5b092[_0xb575('0x3b')][_0xb575('0x41')](_0xb575('0x42'))){_0x504148[_0xb575('0x2c')]=qs[_0xb575('0x2c')](_0x5b092[_0xb575('0x3b')][_0xb575('0x2c')]);_0x504148['offset']=qs['offset'](_0x5b092[_0xb575('0x3b')][_0xb575('0x2b')]);}_0x504148[_0xb575('0x43')]=qs[_0xb575('0x44')](_0x5b092[_0xb575('0x3b')][_0xb575('0x44')]);_0x504148[_0xb575('0x45')]=qs[_0xb575('0x3d')](_[_0xb575('0x46')](_0x5b092[_0xb575('0x3b')],_0x1cf385['filters']),_0x5597ed);if(_0x5b092[_0xb575('0x3b')][_0xb575('0x47')]){_0x504148[_0xb575('0x45')]=_[_0xb575('0x48')](_0x504148[_0xb575('0x45')],{'$or':_[_0xb575('0x35')](_0x5597ed,function(_0x29d41e){if(_0x29d41e[_0xb575('0x49')]!==_0xb575('0x4a')){var _0x4dc2b8={};_0x4dc2b8[_0x29d41e[_0xb575('0x33')]]={'$like':'%'+_0x5b092[_0xb575('0x3b')]['filter']+'%'};return _0x4dc2b8;}})});}_0x504148=_['merge']({},_0x504148,_0x5b092[_0xb575('0x4b')]);var _0x57335c={'where':_0x504148[_0xb575('0x45')]};return db[_0xb575('0x36')][_0xb575('0x2a')](_0x57335c)[_0xb575('0x30')](function(_0x1eb6c9){_0x5740f1[_0xb575('0x2a')]=_0x1eb6c9;if(_0x5b092[_0xb575('0x3b')]['includeAll']){_0x504148[_0xb575('0x4c')]=[{'all':!![]}];}return db[_0xb575('0x36')][_0xb575('0x4d')](_0x504148);})[_0xb575('0x30')](function(_0x422906){_0x5740f1[_0xb575('0x4e')]=_0x422906;return _0x5740f1;})['then'](respondWithFilteredResult(_0x4c3a95,_0x504148))['catch'](handleError(_0x4c3a95,null));};exports['show']=function(_0x415ea0,_0x411886){var _0x2d32f4={'raw':![],'where':{'id':_0x415ea0[_0xb575('0x4f')]['id']}},_0x4e424e={};_0x4e424e['model']=_[_0xb575('0x3c')](db[_0xb575('0x36')]['rawAttributes']);_0x4e424e['query']=_[_0xb575('0x3c')](_0x415ea0[_0xb575('0x3b')]);_0x4e424e[_0xb575('0x3d')]=_[_0xb575('0x50')](_0x4e424e[_0xb575('0x3a')],_0x4e424e['query']);_0x2d32f4[_0xb575('0x3e')]=_[_0xb575('0x50')](_0x4e424e['model'],qs['fields'](_0x415ea0[_0xb575('0x3b')][_0xb575('0x3f')]));_0x2d32f4[_0xb575('0x3e')]=_0x2d32f4[_0xb575('0x3e')]['length']?_0x2d32f4[_0xb575('0x3e')]:_0x4e424e[_0xb575('0x3a')];if(_0x415ea0['query']['includeAll']){_0x2d32f4[_0xb575('0x4c')]=[{'all':!![]}];}_0x2d32f4=_[_0xb575('0x48')]({},_0x2d32f4,_0x415ea0[_0xb575('0x4b')]);return db[_0xb575('0x36')][_0xb575('0x51')](_0x2d32f4)[_0xb575('0x30')](handleEntityNotFound(_0x411886,null))[_0xb575('0x30')](respondWithResult(_0x411886,null))[_0xb575('0x24')](handleError(_0x411886,null));};exports[_0xb575('0x2f')]=function(_0x23cc0f,_0x13a6fb){if(_0x23cc0f[_0xb575('0x52')]['id']){delete _0x23cc0f[_0xb575('0x52')]['id'];}return db[_0xb575('0x36')]['find']({'where':{'id':_0x23cc0f[_0xb575('0x4f')]['id']}})[_0xb575('0x30')](handleEntityNotFound(_0x13a6fb,null))[_0xb575('0x30')](saveUpdates(_0x23cc0f[_0xb575('0x52')],null))[_0xb575('0x30')](respondWithResult(_0x13a6fb,null))[_0xb575('0x24')](handleError(_0x13a6fb,null));};exports[_0xb575('0x53')]=function(_0x3c7823,_0x151d01,_0x12df54){if(_0x3c7823[_0xb575('0x54')]&&_0x3c7823['file'][_0xb575('0x55')]){_0x3c7823['body'][_0xb575('0x56')]=_0x3c7823[_0xb575('0x54')][_0xb575('0x55')];}return db[_0xb575('0x36')][_0xb575('0x51')]({'where':{'id':_0x3c7823[_0xb575('0x4f')]['id']}})['then'](handleEntityNotFound(_0x151d01,null))['then'](saveUpdates(_0x3c7823[_0xb575('0x52')],null))[_0xb575('0x30')](respondWithResult(_0x151d01,null))[_0xb575('0x24')](handleError(_0x151d01,null));};exports[_0xb575('0x57')]=function(_0x159534,_0x565690,_0x1a1801){if(_0x159534[_0xb575('0x54')]&&_0x159534['file']['filename']){_0x159534[_0xb575('0x52')][_0xb575('0x58')]=_0x159534[_0xb575('0x54')][_0xb575('0x55')];}return db['Setting'][_0xb575('0x51')]({'where':{'id':_0x159534[_0xb575('0x4f')]['id']}})[_0xb575('0x30')](handleEntityNotFound(_0x565690,null))['then'](saveUpdates(_0x159534[_0xb575('0x52')],null))[_0xb575('0x30')](respondWithResult(_0x565690,null))[_0xb575('0x24')](handleError(_0x565690,null));};var utilLicense=require(_0xb575('0x17'));exports[_0xb575('0x59')]=function(_0x3d6491,_0x10990c,_0x35f702){var _0xee178=_0xb575('0x5a');var _0x3337a0={'custom':![]};return utilLicense['getLicense']()[_0xb575('0x30')](function(_0x1c8037){if(_0x1c8037){_0x3337a0=_0x1c8037;}return db[_0xb575('0x36')][_0xb575('0x51')]({'where':{'id':_0x3d6491[_0xb575('0x4f')]['id']},'attributes':[_0xb575('0x56'),_0xb575('0x58'),_0xb575('0x5b'),_0xb575('0x5c'),'defaultLogo',_0xb575('0x5d'),_0xb575('0x5e'),'defaultFavicon'],'raw':!![]});})[_0xb575('0x30')](handleEntityNotFound(_0x10990c,null))[_0xb575('0x30')](function(_0x10e371){if(_0x10e371){var _0x342e50=_0x10e371[_0xb575('0x56')]&&fs[_0xb575('0x5f')](path['join'](config['root'],_0xee178,_['toLower'](_0x10e371[_0xb575('0x56')])))?path['join'](config[_0xb575('0x60')],_0xee178,_[_0xb575('0x61')](_0x10e371[_0xb575('0x56')])):path['join'](config[_0xb575('0x60')],_0xee178,_['toLower']('default_logo.svg'));var _0x590422=_0xb575('0x62')+_[_0xb575('0x63')](_0xb575('0x56'));if(_0x10e371[_0x590422]||!_0x3337a0[_0xb575('0x64')]){_0x342e50=path[_0xb575('0x65')](config['root'],_0xee178,_['toLower'](_0xb575('0x66')));}if(!fs[_0xb575('0x5f')](_0x342e50)){throw new db['Sequelize'][(_0xb575('0x67'))](_[_0xb575('0x63')]('logo')+_0xb575('0x68'));}return _0x10990c[_0xb575('0x69')](_0x342e50);}})[_0xb575('0x24')](handleError(_0x10990c,null));};var utilLicense=require(_0xb575('0x17'));exports['getLogoLogin']=function(_0x3ad989,_0x17a7a5,_0x578b8a){var _0x42bf1b='server/files/images/logos';var _0x8274b9={'custom':![]};return utilLicense[_0xb575('0x6a')]()[_0xb575('0x30')](function(_0x48b1f0){if(_0x48b1f0){_0x8274b9=_0x48b1f0;}return db['Setting'][_0xb575('0x51')]({'where':{'id':_0x3ad989['params']['id']},'attributes':[_0xb575('0x56'),_0xb575('0x58'),_0xb575('0x5b'),_0xb575('0x5c'),'defaultLogo',_0xb575('0x5d'),_0xb575('0x5e'),'defaultFavicon'],'raw':!![]});})[_0xb575('0x30')](handleEntityNotFound(_0x17a7a5,null))[_0xb575('0x30')](function(_0xb8f891){if(_0xb8f891){var _0x18eac6=_0xb8f891['loginLogo']&&fs['existsSync'](path[_0xb575('0x65')](config[_0xb575('0x60')],_0x42bf1b,_[_0xb575('0x61')](_0xb8f891['loginLogo'])))?path[_0xb575('0x65')](config[_0xb575('0x60')],_0x42bf1b,_[_0xb575('0x61')](_0xb8f891[_0xb575('0x58')])):path[_0xb575('0x65')](config[_0xb575('0x60')],_0x42bf1b,_[_0xb575('0x61')]('default_loginLogo.svg'));var _0x3d4f08=_0xb575('0x62')+_[_0xb575('0x63')](_0xb575('0x58'));if(_0xb8f891[_0x3d4f08]||!_0x8274b9[_0xb575('0x64')]){_0x18eac6=path[_0xb575('0x65')](config[_0xb575('0x60')],_0x42bf1b,_[_0xb575('0x61')](_0xb575('0x6b')));}if(!fs['existsSync'](_0x18eac6)){throw new db[(_0xb575('0x6c'))][(_0xb575('0x67'))](_[_0xb575('0x63')](_0xb575('0x58'))+'\x20not\x20found');}return _0x17a7a5[_0xb575('0x69')](_0x18eac6);}})['catch'](handleError(_0x17a7a5,null));};exports[_0xb575('0x6d')]=function(_0x59f601,_0x23e486){return db[_0xb575('0x36')][_0xb575('0x51')]({'where':{'id':_0x59f601[_0xb575('0x4f')]['id']},'attributes':[_0xb575('0x6e')]})[_0xb575('0x30')](respondWithResult(_0x23e486,null))['catch'](handleError(_0x23e486,null));};exports[_0xb575('0x6f')]=function(_0x5c039f,_0x1a0800,_0x40778b){if(_0x5c039f[_0xb575('0x54')]&&_0x5c039f[_0xb575('0x54')][_0xb575('0x55')]){_0x5c039f[_0xb575('0x52')][_0xb575('0x5b')]=_0x5c039f[_0xb575('0x54')][_0xb575('0x55')];}return db['Setting'][_0xb575('0x51')]({'where':{'id':_0x5c039f['params']['id']}})[_0xb575('0x30')](handleEntityNotFound(_0x1a0800,null))[_0xb575('0x30')](saveUpdates(_0x5c039f[_0xb575('0x52')],null))[_0xb575('0x30')](respondWithResult(_0x1a0800,null))[_0xb575('0x24')](handleError(_0x1a0800,null));};var utilLicense=require(_0xb575('0x17'));exports[_0xb575('0x70')]=function(_0x1ac5d6,_0x561b36,_0x42afff){var _0x58d6b5='server/files/images/logos';var _0x2800ab={'custom':![]};return utilLicense[_0xb575('0x6a')]()['then'](function(_0x4c4748){if(_0x4c4748){_0x2800ab=_0x4c4748;}return db[_0xb575('0x36')][_0xb575('0x51')]({'where':{'id':_0x1ac5d6[_0xb575('0x4f')]['id']},'attributes':[_0xb575('0x56'),_0xb575('0x58'),_0xb575('0x5b'),_0xb575('0x5c'),_0xb575('0x71'),'defaultLoginLogo',_0xb575('0x5e'),_0xb575('0x72')],'raw':!![]});})[_0xb575('0x30')](handleEntityNotFound(_0x561b36,null))[_0xb575('0x30')](function(_0xf60bbf){if(_0xf60bbf){var _0x3f9732=_0xf60bbf[_0xb575('0x5b')]&&fs['existsSync'](path[_0xb575('0x65')](config[_0xb575('0x60')],_0x58d6b5,_[_0xb575('0x61')](_0xf60bbf[_0xb575('0x5b')])))?path['join'](config[_0xb575('0x60')],_0x58d6b5,_[_0xb575('0x61')](_0xf60bbf[_0xb575('0x5b')])):path['join'](config['root'],_0x58d6b5,_['toLower']('default_preferred.png'));var _0x81b332='default'+_['upperFirst'](_0xb575('0x5b'));if(_0xf60bbf[_0x81b332]||!_0x2800ab[_0xb575('0x64')]||!_0x2800ab[_0xb575('0x5b')]){_0x3f9732=path['join'](config['root'],_0x58d6b5,_[_0xb575('0x61')](_0xb575('0x73')));}if(!fs[_0xb575('0x5f')](_0x3f9732)){throw new db[(_0xb575('0x6c'))]['ValidationError'](_[_0xb575('0x63')]('preferred')+_0xb575('0x68'));}return _0x561b36['download'](_0x3f9732);}})[_0xb575('0x24')](handleError(_0x561b36,null));};exports[_0xb575('0x74')]=function(_0x134b82,_0x45d80d,_0x2af15f){if(_0x134b82['file']&&_0x134b82[_0xb575('0x54')][_0xb575('0x55')]){_0x134b82['body'][_0xb575('0x5c')]=_0x134b82[_0xb575('0x54')][_0xb575('0x55')];}return db[_0xb575('0x36')]['find']({'where':{'id':_0x134b82[_0xb575('0x4f')]['id']}})[_0xb575('0x30')](handleEntityNotFound(_0x45d80d,null))[_0xb575('0x30')](saveUpdates(_0x134b82[_0xb575('0x52')],null))[_0xb575('0x30')](respondWithResult(_0x45d80d,null))[_0xb575('0x24')](handleError(_0x45d80d,null));};var utilLicense=require(_0xb575('0x17'));exports[_0xb575('0x75')]=function(_0x3e7a59,_0x20ecee,_0x199b2d){var _0x498cbe=_0xb575('0x5a');var _0x383133={'custom':![]};return utilLicense[_0xb575('0x6a')]()[_0xb575('0x30')](function(_0x4eb9a0){if(_0x4eb9a0){_0x383133=_0x4eb9a0;}return db[_0xb575('0x36')]['find']({'where':{'id':_0x3e7a59['params']['id']},'attributes':[_0xb575('0x56'),_0xb575('0x58'),'preferred',_0xb575('0x5c'),_0xb575('0x71'),'defaultLoginLogo','defaultPreferred','defaultFavicon'],'raw':!![]});})[_0xb575('0x30')](handleEntityNotFound(_0x20ecee,null))['then'](function(_0x464914){if(_0x464914){var _0x5d2130=_0x464914[_0xb575('0x5c')]&&fs['existsSync'](path[_0xb575('0x65')](config[_0xb575('0x60')],_0x498cbe,_[_0xb575('0x61')](_0x464914['favicon'])))?path[_0xb575('0x65')](config[_0xb575('0x60')],_0x498cbe,_[_0xb575('0x61')](_0x464914[_0xb575('0x5c')])):path[_0xb575('0x65')](config[_0xb575('0x60')],_0x498cbe,_[_0xb575('0x61')]('default_favicon.ico'));var _0x319045=_0xb575('0x62')+_[_0xb575('0x63')](_0xb575('0x5c'));if(_0x464914[_0x319045]||!_0x383133[_0xb575('0x64')]){_0x5d2130=path[_0xb575('0x65')](config[_0xb575('0x60')],_0x498cbe,_['toLower'](_0xb575('0x76')));}if(!fs[_0xb575('0x5f')](_0x5d2130)){throw new db[(_0xb575('0x6c'))][(_0xb575('0x67'))](_[_0xb575('0x63')](_0xb575('0x5c'))+_0xb575('0x68'));}return _0x20ecee[_0xb575('0x69')](_0x5d2130);}})[_0xb575('0x24')](handleError(_0x20ecee,null));};exports[_0xb575('0x77')]=function(_0x2aee37,_0x30306d){var _0x5650a9={'offset':moment()[_0xb575('0x78')]()};_0x5650a9[_0xb575('0x79')]=moment()[_0xb575('0x78')](_0x5650a9[_0xb575('0x2b')])[_0xb575('0x7a')]('YYYY-MM-DD\x20HH:mm:ss:SSS');return _0x30306d[_0xb575('0x27')](0xc8)[_0xb575('0x7b')](_0x5650a9);}; \ No newline at end of file +var _0x362a=['defaultPreferred','default_loginLogo.svg','default','custom','gdpr','securePassword','addPreferred','getPreferred','defaultFavicon','default_preferred.png','ValidationError','addFavicon','default_favicon.ico','utcOffset','now','YYYY-MM-DD\x20HH:mm:ss:SSS','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','then','info','Setting,\x20%s,\x20%s','Setting,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','destroy','stack','name','map','Setting','rawAttributes','fieldName','type','key','model','query','filters','attributes','fields','length','nolimit','sort','where','pick','filter','merge','VIRTUAL','include','rows','show','params','keys','intersection','find','update','body','addLogo','file','filename','logo','loginLogo','getLogo','server/files/images/logos','preferred','favicon','defaultLogo','defaultLoginLogo','existsSync','join','root','toLower','default_logo.svg','upperFirst','Sequelize','\x20not\x20found','download','getLicense'];(function(_0x5e3a45,_0x45f0c5){var _0x13419f=function(_0x5ac996){while(--_0x5ac996){_0x5e3a45['push'](_0x5e3a45['shift']());}};_0x13419f(++_0x45f0c5);}(_0x362a,0x102));var _0xa362=function(_0x5c1a4c,_0x3778b2){_0x5c1a4c=_0x5c1a4c-0x0;var _0x5c66b7=_0x362a[_0x5c1a4c];return _0x5c66b7;};'use strict';var emlformat=require(_0xa362('0x0'));var rimraf=require(_0xa362('0x1'));var zipdir=require(_0xa362('0x2'));var jsonpatch=require(_0xa362('0x3'));var rp=require(_0xa362('0x4'));var moment=require(_0xa362('0x5'));var BPromise=require(_0xa362('0x6'));var Mustache=require(_0xa362('0x7'));var util=require(_0xa362('0x8'));var path=require(_0xa362('0x9'));var sox=require(_0xa362('0xa'));var csv=require(_0xa362('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa362('0xc'));var _=require(_0xa362('0xd'));var squel=require(_0xa362('0xe'));var crypto=require(_0xa362('0xf'));var jsforce=require(_0xa362('0x10'));var deskjs=require('desk.js');var toCsv=require(_0xa362('0xb'));var querystring=require(_0xa362('0x11'));var Papa=require(_0xa362('0x12'));var Redis=require(_0xa362('0x13'));var authService=require(_0xa362('0x14'));var qs=require(_0xa362('0x15'));var as=require(_0xa362('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa362('0x17'))(_0xa362('0x18'));var utils=require(_0xa362('0x19'));var config=require(_0xa362('0x1a'));var licenseUtil=require(_0xa362('0x1b'));var db=require(_0xa362('0x1c'))['db'];var jayson=require(_0xa362('0x1d'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xef2703,_0x154d05,_0x3fe753,_0x158b6f){return new BPromise(function(_0x5700fc,_0x4c5c50){var _0x218465=_0x158b6f||client;return _0x218465['request'](_0xef2703,_0x3fe753)[_0xa362('0x1e')](function(_0xf13eca){logger[_0xa362('0x1f')](_0xa362('0x20'),_0x154d05,'request\x20sent');logger['debug'](_0xa362('0x21'),_0x154d05,_0xa362('0x22'),JSON[_0xa362('0x23')](_0xf13eca));if(_0xf13eca[_0xa362('0x24')]){if(_0xf13eca['error'][_0xa362('0x25')]===0x1f4){logger[_0xa362('0x24')](_0xa362('0x20'),_0x154d05,_0xf13eca[_0xa362('0x24')][_0xa362('0x26')]);return _0x4c5c50(_0xf13eca['error']['message']);}logger['error'](_0xa362('0x20'),_0x154d05,_0xf13eca[_0xa362('0x24')][_0xa362('0x26')]);return _0x5700fc(_0xf13eca[_0xa362('0x24')][_0xa362('0x26')]);}else{logger[_0xa362('0x1f')](_0xa362('0x20'),_0x154d05,_0xa362('0x22'));_0x5700fc(_0xf13eca[_0xa362('0x27')][_0xa362('0x26')]);}})[_0xa362('0x28')](function(_0x559398){logger[_0xa362('0x24')]('Setting,\x20%s,\x20%s',_0x154d05,_0x559398);_0x4c5c50(_0x559398);});});}function respondWithStatusCode(_0x2384b6,_0x3f5449){_0x3f5449=_0x3f5449||0xcc;return function(_0x545157){if(_0x545157){return _0x2384b6[_0xa362('0x29')](_0x3f5449);}return _0x2384b6['status'](_0x3f5449)['end']();};}function respondWithResult(_0x3cb136,_0x53c9a7){_0x53c9a7=_0x53c9a7||0xc8;return function(_0x3f5bc2){if(_0x3f5bc2){return _0x3cb136[_0xa362('0x2a')](_0x53c9a7)[_0xa362('0x2b')](_0x3f5bc2);}};}function respondWithFilteredResult(_0x54a496,_0x275a52){return function(_0x32ceb1){if(_0x32ceb1){var _0x293aff=typeof _0x275a52[_0xa362('0x2c')]===_0xa362('0x2d')&&typeof _0x275a52[_0xa362('0x2e')]===_0xa362('0x2d');var _0x26de98=_0x32ceb1[_0xa362('0x2f')];var _0x3018df=_0x293aff?0x0:_0x275a52['offset'];var _0x136e20=_0x293aff?_0x32ceb1[_0xa362('0x2f')]:_0x275a52['offset']+_0x275a52[_0xa362('0x2e')];var _0xa97673;if(_0x136e20>=_0x26de98){_0x136e20=_0x26de98;_0xa97673=0xc8;}else{_0xa97673=0xce;}_0x54a496[_0xa362('0x2a')](_0xa97673);return _0x54a496[_0xa362('0x30')](_0xa362('0x31'),_0x3018df+'-'+_0x136e20+'/'+_0x26de98)[_0xa362('0x2b')](_0x32ceb1);}return null;};}function patchUpdates(_0xb085fc){return function(_0x49422e){try{jsonpatch[_0xa362('0x32')](_0x49422e,_0xb085fc,!![]);}catch(_0x5ddc48){return BPromise[_0xa362('0x33')](_0x5ddc48);}return _0x49422e[_0xa362('0x34')]();};}function saveUpdates(_0x45a5fc,_0x28c0e2){return function(_0x14f1ac){if(_0x14f1ac){return _0x14f1ac['update'](_0x45a5fc)[_0xa362('0x1e')](function(_0x6d1927){return _0x6d1927;});}return null;};}function removeEntity(_0x342bb3,_0x5839aa){return function(_0x3b4058){if(_0x3b4058){return _0x3b4058[_0xa362('0x35')]()[_0xa362('0x1e')](function(){_0x342bb3[_0xa362('0x2a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x29ac42,_0x2e127e){return function(_0x363516){if(!_0x363516){_0x29ac42['sendStatus'](0x194);}return _0x363516;};}function handleError(_0x2cbbb8,_0x120e25){_0x120e25=_0x120e25||0x1f4;return function(_0x16e89d){logger[_0xa362('0x24')](_0x16e89d[_0xa362('0x36')]);if(_0x16e89d[_0xa362('0x37')]){delete _0x16e89d[_0xa362('0x37')];}_0x2cbbb8[_0xa362('0x2a')](_0x120e25)['send'](_0x16e89d);};}exports['index']=function(_0x13217d,_0x43d6ea){var _0x268e4e={},_0x4c7910={},_0x5ce606={'count':0x0,'rows':[]};var _0x347b0a=_[_0xa362('0x38')](db[_0xa362('0x39')][_0xa362('0x3a')],function(_0x10a27a){return{'name':_0x10a27a[_0xa362('0x3b')],'type':_0x10a27a[_0xa362('0x3c')][_0xa362('0x3d')]};});_0x4c7910[_0xa362('0x3e')]=_[_0xa362('0x38')](_0x347b0a,'name');_0x4c7910[_0xa362('0x3f')]=_['keys'](_0x13217d[_0xa362('0x3f')]);_0x4c7910[_0xa362('0x40')]=_['intersection'](_0x4c7910[_0xa362('0x3e')],_0x4c7910[_0xa362('0x3f')]);_0x268e4e[_0xa362('0x41')]=_['intersection'](_0x4c7910['model'],qs[_0xa362('0x42')](_0x13217d[_0xa362('0x3f')]['fields']));_0x268e4e[_0xa362('0x41')]=_0x268e4e['attributes'][_0xa362('0x43')]?_0x268e4e[_0xa362('0x41')]:_0x4c7910[_0xa362('0x3e')];if(!_0x13217d[_0xa362('0x3f')]['hasOwnProperty'](_0xa362('0x44'))){_0x268e4e[_0xa362('0x2e')]=qs['limit'](_0x13217d[_0xa362('0x3f')][_0xa362('0x2e')]);_0x268e4e[_0xa362('0x2c')]=qs[_0xa362('0x2c')](_0x13217d[_0xa362('0x3f')][_0xa362('0x2c')]);}_0x268e4e['order']=qs[_0xa362('0x45')](_0x13217d[_0xa362('0x3f')]['sort']);_0x268e4e[_0xa362('0x46')]=qs[_0xa362('0x40')](_[_0xa362('0x47')](_0x13217d[_0xa362('0x3f')],_0x4c7910[_0xa362('0x40')]),_0x347b0a);if(_0x13217d[_0xa362('0x3f')][_0xa362('0x48')]){_0x268e4e[_0xa362('0x46')]=_[_0xa362('0x49')](_0x268e4e[_0xa362('0x46')],{'$or':_[_0xa362('0x38')](_0x347b0a,function(_0x2a22c2){if(_0x2a22c2[_0xa362('0x3c')]!==_0xa362('0x4a')){var _0x1470f1={};_0x1470f1[_0x2a22c2[_0xa362('0x37')]]={'$like':'%'+_0x13217d[_0xa362('0x3f')][_0xa362('0x48')]+'%'};return _0x1470f1;}})});}_0x268e4e=_[_0xa362('0x49')]({},_0x268e4e,_0x13217d['options']);var _0x59488b={'where':_0x268e4e[_0xa362('0x46')]};return db[_0xa362('0x39')][_0xa362('0x2f')](_0x59488b)['then'](function(_0x2ac9da){_0x5ce606[_0xa362('0x2f')]=_0x2ac9da;if(_0x13217d[_0xa362('0x3f')]['includeAll']){_0x268e4e[_0xa362('0x4b')]=[{'all':!![]}];}return db[_0xa362('0x39')]['findAll'](_0x268e4e);})[_0xa362('0x1e')](function(_0x58e4dd){_0x5ce606[_0xa362('0x4c')]=_0x58e4dd;return _0x5ce606;})['then'](respondWithFilteredResult(_0x43d6ea,_0x268e4e))['catch'](handleError(_0x43d6ea,null));};exports[_0xa362('0x4d')]=function(_0x50eb0a,_0x2bcd29){var _0x118472={'raw':![],'where':{'id':_0x50eb0a[_0xa362('0x4e')]['id']}},_0xcbd59d={};_0xcbd59d[_0xa362('0x3e')]=_[_0xa362('0x4f')](db[_0xa362('0x39')][_0xa362('0x3a')]);_0xcbd59d['query']=_[_0xa362('0x4f')](_0x50eb0a[_0xa362('0x3f')]);_0xcbd59d['filters']=_[_0xa362('0x50')](_0xcbd59d['model'],_0xcbd59d[_0xa362('0x3f')]);_0x118472['attributes']=_[_0xa362('0x50')](_0xcbd59d['model'],qs[_0xa362('0x42')](_0x50eb0a[_0xa362('0x3f')][_0xa362('0x42')]));_0x118472['attributes']=_0x118472[_0xa362('0x41')]['length']?_0x118472[_0xa362('0x41')]:_0xcbd59d[_0xa362('0x3e')];if(_0x50eb0a['query']['includeAll']){_0x118472[_0xa362('0x4b')]=[{'all':!![]}];}_0x118472=_['merge']({},_0x118472,_0x50eb0a['options']);return db[_0xa362('0x39')][_0xa362('0x51')](_0x118472)['then'](handleEntityNotFound(_0x2bcd29,null))[_0xa362('0x1e')](respondWithResult(_0x2bcd29,null))['catch'](handleError(_0x2bcd29,null));};exports[_0xa362('0x52')]=function(_0x1ab4ea,_0x5e84c7){if(_0x1ab4ea[_0xa362('0x53')]['id']){delete _0x1ab4ea['body']['id'];}return db[_0xa362('0x39')][_0xa362('0x51')]({'where':{'id':_0x1ab4ea['params']['id']}})[_0xa362('0x1e')](handleEntityNotFound(_0x5e84c7,null))[_0xa362('0x1e')](saveUpdates(_0x1ab4ea[_0xa362('0x53')],null))['then'](respondWithResult(_0x5e84c7,null))[_0xa362('0x28')](handleError(_0x5e84c7,null));};exports[_0xa362('0x54')]=function(_0x186fd3,_0xff68f9,_0x3749e4){if(_0x186fd3[_0xa362('0x55')]&&_0x186fd3[_0xa362('0x55')][_0xa362('0x56')]){_0x186fd3[_0xa362('0x53')][_0xa362('0x57')]=_0x186fd3[_0xa362('0x55')]['filename'];}return db[_0xa362('0x39')][_0xa362('0x51')]({'where':{'id':_0x186fd3[_0xa362('0x4e')]['id']}})['then'](handleEntityNotFound(_0xff68f9,null))[_0xa362('0x1e')](saveUpdates(_0x186fd3['body'],null))[_0xa362('0x1e')](respondWithResult(_0xff68f9,null))[_0xa362('0x28')](handleError(_0xff68f9,null));};exports['addLogoLogin']=function(_0x220033,_0xe1b952,_0x12a581){if(_0x220033['file']&&_0x220033[_0xa362('0x55')]['filename']){_0x220033[_0xa362('0x53')][_0xa362('0x58')]=_0x220033[_0xa362('0x55')]['filename'];}return db['Setting'][_0xa362('0x51')]({'where':{'id':_0x220033['params']['id']}})[_0xa362('0x1e')](handleEntityNotFound(_0xe1b952,null))[_0xa362('0x1e')](saveUpdates(_0x220033[_0xa362('0x53')],null))['then'](respondWithResult(_0xe1b952,null))['catch'](handleError(_0xe1b952,null));};var utilLicense=require(_0xa362('0x1b'));exports[_0xa362('0x59')]=function(_0x1d9b14,_0xa899d,_0xfbf1b9){var _0x302d0c=_0xa362('0x5a');var _0x2acdb6={'custom':![]};return utilLicense['getLicense']()[_0xa362('0x1e')](function(_0x35b7f7){if(_0x35b7f7){_0x2acdb6=_0x35b7f7;}return db['Setting'][_0xa362('0x51')]({'where':{'id':_0x1d9b14[_0xa362('0x4e')]['id']},'attributes':[_0xa362('0x57'),_0xa362('0x58'),_0xa362('0x5b'),_0xa362('0x5c'),_0xa362('0x5d'),_0xa362('0x5e'),'defaultPreferred','defaultFavicon'],'raw':!![]});})['then'](handleEntityNotFound(_0xa899d,null))[_0xa362('0x1e')](function(_0x1fceb3){if(_0x1fceb3){var _0x4bbf3a=_0x1fceb3[_0xa362('0x57')]&&fs[_0xa362('0x5f')](path[_0xa362('0x60')](config[_0xa362('0x61')],_0x302d0c,_[_0xa362('0x62')](_0x1fceb3[_0xa362('0x57')])))?path['join'](config['root'],_0x302d0c,_[_0xa362('0x62')](_0x1fceb3[_0xa362('0x57')])):path[_0xa362('0x60')](config[_0xa362('0x61')],_0x302d0c,_[_0xa362('0x62')](_0xa362('0x63')));var _0x727503='default'+_[_0xa362('0x64')](_0xa362('0x57'));if(_0x1fceb3[_0x727503]||!_0x2acdb6['custom']){_0x4bbf3a=path[_0xa362('0x60')](config[_0xa362('0x61')],_0x302d0c,_['toLower'](_0xa362('0x63')));}if(!fs[_0xa362('0x5f')](_0x4bbf3a)){throw new db[(_0xa362('0x65'))]['ValidationError'](_[_0xa362('0x64')](_0xa362('0x57'))+_0xa362('0x66'));}return _0xa899d[_0xa362('0x67')](_0x4bbf3a);}})['catch'](handleError(_0xa899d,null));};var utilLicense=require(_0xa362('0x1b'));exports['getLogoLogin']=function(_0x12221c,_0x2bfd6a,_0x144a11){var _0x27d40e=_0xa362('0x5a');var _0x5c8709={'custom':![]};return utilLicense[_0xa362('0x68')]()[_0xa362('0x1e')](function(_0x2e1449){if(_0x2e1449){_0x5c8709=_0x2e1449;}return db[_0xa362('0x39')][_0xa362('0x51')]({'where':{'id':_0x12221c['params']['id']},'attributes':['logo',_0xa362('0x58'),_0xa362('0x5b'),_0xa362('0x5c'),_0xa362('0x5d'),_0xa362('0x5e'),_0xa362('0x69'),'defaultFavicon'],'raw':!![]});})[_0xa362('0x1e')](handleEntityNotFound(_0x2bfd6a,null))['then'](function(_0x15b44e){if(_0x15b44e){var _0x1ece48=_0x15b44e['loginLogo']&&fs['existsSync'](path[_0xa362('0x60')](config[_0xa362('0x61')],_0x27d40e,_['toLower'](_0x15b44e[_0xa362('0x58')])))?path[_0xa362('0x60')](config['root'],_0x27d40e,_[_0xa362('0x62')](_0x15b44e[_0xa362('0x58')])):path['join'](config[_0xa362('0x61')],_0x27d40e,_['toLower'](_0xa362('0x6a')));var _0x4215a7=_0xa362('0x6b')+_[_0xa362('0x64')](_0xa362('0x58'));if(_0x15b44e[_0x4215a7]||!_0x5c8709[_0xa362('0x6c')]){_0x1ece48=path['join'](config[_0xa362('0x61')],_0x27d40e,_['toLower'](_0xa362('0x6a')));}if(!fs[_0xa362('0x5f')](_0x1ece48)){throw new db['Sequelize']['ValidationError'](_[_0xa362('0x64')](_0xa362('0x58'))+_0xa362('0x66'));}return _0x2bfd6a[_0xa362('0x67')](_0x1ece48);}})[_0xa362('0x28')](handleError(_0x2bfd6a,null));};exports[_0xa362('0x6d')]=function(_0x197607,_0x3cb1f1){return db['Setting'][_0xa362('0x51')]({'where':{'id':_0x197607[_0xa362('0x4e')]['id']},'attributes':[_0xa362('0x6e')]})[_0xa362('0x1e')](respondWithResult(_0x3cb1f1,null))['catch'](handleError(_0x3cb1f1,null));};exports[_0xa362('0x6f')]=function(_0x3874c9,_0x408c31,_0x590077){if(_0x3874c9[_0xa362('0x55')]&&_0x3874c9[_0xa362('0x55')]['filename']){_0x3874c9[_0xa362('0x53')][_0xa362('0x5b')]=_0x3874c9['file'][_0xa362('0x56')];}return db[_0xa362('0x39')][_0xa362('0x51')]({'where':{'id':_0x3874c9['params']['id']}})[_0xa362('0x1e')](handleEntityNotFound(_0x408c31,null))[_0xa362('0x1e')](saveUpdates(_0x3874c9[_0xa362('0x53')],null))[_0xa362('0x1e')](respondWithResult(_0x408c31,null))['catch'](handleError(_0x408c31,null));};var utilLicense=require(_0xa362('0x1b'));exports[_0xa362('0x70')]=function(_0x3f1077,_0x139c54,_0x159dfb){var _0x424f39=_0xa362('0x5a');var _0x576ecb={'custom':![]};return utilLicense[_0xa362('0x68')]()['then'](function(_0x3b27ed){if(_0x3b27ed){_0x576ecb=_0x3b27ed;}return db[_0xa362('0x39')]['find']({'where':{'id':_0x3f1077[_0xa362('0x4e')]['id']},'attributes':[_0xa362('0x57'),_0xa362('0x58'),'preferred',_0xa362('0x5c'),_0xa362('0x5d'),_0xa362('0x5e'),_0xa362('0x69'),_0xa362('0x71')],'raw':!![]});})[_0xa362('0x1e')](handleEntityNotFound(_0x139c54,null))[_0xa362('0x1e')](function(_0x27867f){if(_0x27867f){var _0xa4a7ee=_0x27867f['preferred']&&fs[_0xa362('0x5f')](path[_0xa362('0x60')](config[_0xa362('0x61')],_0x424f39,_[_0xa362('0x62')](_0x27867f[_0xa362('0x5b')])))?path['join'](config[_0xa362('0x61')],_0x424f39,_[_0xa362('0x62')](_0x27867f[_0xa362('0x5b')])):path[_0xa362('0x60')](config[_0xa362('0x61')],_0x424f39,_['toLower'](_0xa362('0x72')));var _0x404a78=_0xa362('0x6b')+_[_0xa362('0x64')]('preferred');if(_0x27867f[_0x404a78]||!_0x576ecb[_0xa362('0x6c')]||!_0x576ecb[_0xa362('0x5b')]){_0xa4a7ee=path['join'](config[_0xa362('0x61')],_0x424f39,_[_0xa362('0x62')]('default_preferred.png'));}if(!fs['existsSync'](_0xa4a7ee)){throw new db[(_0xa362('0x65'))][(_0xa362('0x73'))](_[_0xa362('0x64')](_0xa362('0x5b'))+_0xa362('0x66'));}return _0x139c54['download'](_0xa4a7ee);}})['catch'](handleError(_0x139c54,null));};exports[_0xa362('0x74')]=function(_0x838a6c,_0x437382,_0x53ed06){if(_0x838a6c['file']&&_0x838a6c[_0xa362('0x55')][_0xa362('0x56')]){_0x838a6c[_0xa362('0x53')][_0xa362('0x5c')]=_0x838a6c[_0xa362('0x55')]['filename'];}return db['Setting']['find']({'where':{'id':_0x838a6c[_0xa362('0x4e')]['id']}})[_0xa362('0x1e')](handleEntityNotFound(_0x437382,null))[_0xa362('0x1e')](saveUpdates(_0x838a6c[_0xa362('0x53')],null))['then'](respondWithResult(_0x437382,null))[_0xa362('0x28')](handleError(_0x437382,null));};var utilLicense=require('../../config/license/util');exports['getFavicon']=function(_0x2b0ab1,_0x539a06,_0x11aa6c){var _0x389e92='server/files/images/logos';var _0x5a06ea={'custom':![]};return utilLicense[_0xa362('0x68')]()[_0xa362('0x1e')](function(_0x13b970){if(_0x13b970){_0x5a06ea=_0x13b970;}return db['Setting'][_0xa362('0x51')]({'where':{'id':_0x2b0ab1[_0xa362('0x4e')]['id']},'attributes':[_0xa362('0x57'),'loginLogo',_0xa362('0x5b'),_0xa362('0x5c'),_0xa362('0x5d'),'defaultLoginLogo',_0xa362('0x69'),_0xa362('0x71')],'raw':!![]});})[_0xa362('0x1e')](handleEntityNotFound(_0x539a06,null))[_0xa362('0x1e')](function(_0x2741ad){if(_0x2741ad){var _0x22f77e=_0x2741ad['favicon']&&fs[_0xa362('0x5f')](path[_0xa362('0x60')](config[_0xa362('0x61')],_0x389e92,_['toLower'](_0x2741ad[_0xa362('0x5c')])))?path['join'](config[_0xa362('0x61')],_0x389e92,_[_0xa362('0x62')](_0x2741ad[_0xa362('0x5c')])):path['join'](config[_0xa362('0x61')],_0x389e92,_[_0xa362('0x62')](_0xa362('0x75')));var _0x2ddcd6=_0xa362('0x6b')+_['upperFirst']('favicon');if(_0x2741ad[_0x2ddcd6]||!_0x5a06ea[_0xa362('0x6c')]){_0x22f77e=path[_0xa362('0x60')](config['root'],_0x389e92,_[_0xa362('0x62')](_0xa362('0x75')));}if(!fs[_0xa362('0x5f')](_0x22f77e)){throw new db[(_0xa362('0x65'))][(_0xa362('0x73'))](_[_0xa362('0x64')](_0xa362('0x5c'))+'\x20not\x20found');}return _0x539a06[_0xa362('0x67')](_0x22f77e);}})[_0xa362('0x28')](handleError(_0x539a06,null));};exports['getDate']=function(_0x1a2a81,_0x195026){var _0x1f612a={'offset':moment()[_0xa362('0x76')]()};_0x1f612a[_0xa362('0x77')]=moment()['utcOffset'](_0x1f612a[_0xa362('0x2c')])['format'](_0xa362('0x78'));return _0x195026['status'](0xc8)['send'](_0x1f612a);}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index 6937050..61dc15f 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 _0x3e74=['exports','Setting','settings','lodash','../../config/logger','api','moment','path','../../config/environment','./setting.attributes'];(function(_0x3b9b2e,_0x1d3afe){var _0x3e1a74=function(_0x1d5439){while(--_0x1d5439){_0x3b9b2e['push'](_0x3b9b2e['shift']());}};_0x3e1a74(++_0x1d3afe);}(_0x3e74,0x175));var _0x43e7=function(_0x462c9e,_0x462249){_0x462c9e=_0x462c9e-0x0;var _0x286a68=_0x3e74[_0x462c9e];return _0x286a68;};'use strict';var _=require(_0x43e7('0x0'));var util=require('util');var logger=require(_0x43e7('0x1'))(_0x43e7('0x2'));var moment=require(_0x43e7('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x43e7('0x4'));var rimraf=require('rimraf');var config=require(_0x43e7('0x5'));var attributes=require(_0x43e7('0x6'));module[_0x43e7('0x7')]=function(_0x1c503b,_0xc98b9c){return _0x1c503b['define'](_0x43e7('0x8'),attributes,{'tableName':_0x43e7('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x34e8=['settings','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./setting.attributes','exports','Setting'];(function(_0x5e465c,_0x384ccb){var _0x533db1=function(_0x51c79e){while(--_0x51c79e){_0x5e465c['push'](_0x5e465c['shift']());}};_0x533db1(++_0x384ccb);}(_0x34e8,0x12c));var _0x834e=function(_0x1d0ebd,_0x42a828){_0x1d0ebd=_0x1d0ebd-0x0;var _0x55dd40=_0x34e8[_0x1d0ebd];return _0x55dd40;};'use strict';var _=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var logger=require(_0x834e('0x2'))(_0x834e('0x3'));var moment=require('moment');var BPromise=require(_0x834e('0x4'));var rp=require(_0x834e('0x5'));var fs=require('fs');var path=require(_0x834e('0x6'));var rimraf=require(_0x834e('0x7'));var config=require(_0x834e('0x8'));var attributes=require(_0x834e('0x9'));module[_0x834e('0xa')]=function(_0x4a2018,_0x858aa1){return _0x4a2018['define'](_0x834e('0xb'),attributes,{'tableName':_0x834e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/setting/setting.rpc.js b/server/api/setting/setting.rpc.js index dd70bb5..8002d54 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 _0x7e86=['then','info','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','find','options','raw','where','include','model','map','attributes','ShowSetting','stringify','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request'];(function(_0x2f4c1d,_0x5821c1){var _0x64b451=function(_0x5af5aa){while(--_0x5af5aa){_0x2f4c1d['push'](_0x2f4c1d['shift']());}};_0x64b451(++_0x5821c1);}(_0x7e86,0x1a1));var _0x67e8=function(_0x56664b,_0x1a29b8){_0x56664b=_0x56664b-0x0;var _0x2c1ca5=_0x7e86[_0x56664b];return _0x2c1ca5;};'use strict';var _=require(_0x67e8('0x0'));var util=require(_0x67e8('0x1'));var moment=require('moment');var BPromise=require(_0x67e8('0x2'));var rs=require(_0x67e8('0x3'));var fs=require('fs');var Redis=require(_0x67e8('0x4'));var db=require(_0x67e8('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x67e8('0x6'))(_0x67e8('0x7'));var config=require('../../config/environment');var jayson=require(_0x67e8('0x8'));var client=jayson[_0x67e8('0x9')][_0x67e8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3087af,_0x27aa9b,_0x4e72f0){return new BPromise(function(_0x1a0d34,_0xff144){return client[_0x67e8('0xb')](_0x3087af,_0x4e72f0)[_0x67e8('0xc')](function(_0x21b5d3){logger[_0x67e8('0xd')](_0x67e8('0xe'),_0x27aa9b,_0x67e8('0xf'));logger[_0x67e8('0x10')](_0x67e8('0x11'),_0x27aa9b,_0x67e8('0xf'),JSON['stringify'](_0x21b5d3));if(_0x21b5d3['error']){if(_0x21b5d3[_0x67e8('0x12')][_0x67e8('0x13')]===0x1f4){logger[_0x67e8('0x12')](_0x67e8('0xe'),_0x27aa9b,_0x21b5d3[_0x67e8('0x12')]['message']);return _0xff144(_0x21b5d3[_0x67e8('0x12')][_0x67e8('0x14')]);}logger[_0x67e8('0x12')](_0x67e8('0xe'),_0x27aa9b,_0x21b5d3[_0x67e8('0x12')]['message']);return _0x1a0d34(_0x21b5d3[_0x67e8('0x12')]['message']);}else{logger['info']('Setting,\x20%s,\x20%s',_0x27aa9b,_0x67e8('0xf'));_0x1a0d34(_0x21b5d3[_0x67e8('0x15')][_0x67e8('0x14')]);}})[_0x67e8('0x16')](function(_0x1910dc){logger[_0x67e8('0x12')](_0x67e8('0xe'),_0x27aa9b,_0x1910dc);_0xff144(_0x1910dc);});});}exports['ShowSetting']=function(_0x34094f){var _0x4af67e=this;return new Promise(function(_0xb074aa,_0x14e010){return db['Setting'][_0x67e8('0x17')]({'raw':_0x34094f[_0x67e8('0x18')]?_0x34094f[_0x67e8('0x18')][_0x67e8('0x19')]===undefined?!![]:![]:!![],'where':_0x34094f[_0x67e8('0x18')]?_0x34094f['options'][_0x67e8('0x1a')]||null:null,'attributes':_0x34094f['options']?_0x34094f[_0x67e8('0x18')]['attributes']||null:null,'include':_0x34094f[_0x67e8('0x18')]?_0x34094f[_0x67e8('0x18')]['include']?_['map'](_0x34094f[_0x67e8('0x18')][_0x67e8('0x1b')],function(_0x1865f9){return{'model':db[_0x1865f9[_0x67e8('0x1c')]],'as':_0x1865f9['as'],'attributes':_0x1865f9['attributes'],'include':_0x1865f9[_0x67e8('0x1b')]?_[_0x67e8('0x1d')](_0x1865f9['include'],function(_0xd36bd5){return{'model':db[_0xd36bd5[_0x67e8('0x1c')]],'as':_0xd36bd5['as'],'attributes':_0xd36bd5[_0x67e8('0x1e')],'include':_0xd36bd5[_0x67e8('0x1b')]?_[_0x67e8('0x1d')](_0xd36bd5[_0x67e8('0x1b')],function(_0x24c333){return{'model':db[_0x24c333['model']],'as':_0x24c333['as'],'attributes':_0x24c333[_0x67e8('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1b8e2a){logger[_0x67e8('0xd')]('ShowSetting',_0x34094f);logger[_0x67e8('0x10')](_0x67e8('0x1f'),_0x34094f,JSON[_0x67e8('0x20')](_0x1b8e2a));_0xb074aa(_0x1b8e2a);})['catch'](function(_0x84d9ae){logger['error']('ShowSetting',_0x84d9ae[_0x67e8('0x14')],_0x34094f);_0x14e010(_0x4af67e[_0x67e8('0x12')](0x1f4,_0x84d9ae[_0x67e8('0x14')]));});});}; \ No newline at end of file +var _0x011e=['find','options','raw','where','include','map','attributes','model','debug','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','Setting,\x20%s,\x20%s','request\x20sent','Setting,\x20%s,\x20%s,\x20%s','error','code','message','result','ShowSetting','Setting'];(function(_0x1cdbcf,_0x39f808){var _0x2c531b=function(_0x269642){while(--_0x269642){_0x1cdbcf['push'](_0x1cdbcf['shift']());}};_0x2c531b(++_0x39f808);}(_0x011e,0x70));var _0xe011=function(_0x3de8a4,_0x289a5c){_0x3de8a4=_0x3de8a4-0x0;var _0x4635cf=_0x011e[_0x3de8a4];return _0x4635cf;};'use strict';var _=require(_0xe011('0x0'));var util=require(_0xe011('0x1'));var moment=require(_0xe011('0x2'));var BPromise=require(_0xe011('0x3'));var rs=require(_0xe011('0x4'));var fs=require('fs');var Redis=require(_0xe011('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xe011('0x6'));var logger=require(_0xe011('0x7'))(_0xe011('0x8'));var config=require(_0xe011('0x9'));var jayson=require(_0xe011('0xa'));var client=jayson[_0xe011('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5e898f,_0x5484bd,_0x4430e1){return new BPromise(function(_0x54296d,_0x2fc3a0){return client[_0xe011('0xc')](_0x5e898f,_0x4430e1)[_0xe011('0xd')](function(_0x234df9){logger[_0xe011('0xe')](_0xe011('0xf'),_0x5484bd,_0xe011('0x10'));logger['debug'](_0xe011('0x11'),_0x5484bd,'request\x20sent',JSON['stringify'](_0x234df9));if(_0x234df9[_0xe011('0x12')]){if(_0x234df9[_0xe011('0x12')][_0xe011('0x13')]===0x1f4){logger[_0xe011('0x12')](_0xe011('0xf'),_0x5484bd,_0x234df9['error'][_0xe011('0x14')]);return _0x2fc3a0(_0x234df9[_0xe011('0x12')]['message']);}logger['error'](_0xe011('0xf'),_0x5484bd,_0x234df9[_0xe011('0x12')][_0xe011('0x14')]);return _0x54296d(_0x234df9[_0xe011('0x12')][_0xe011('0x14')]);}else{logger[_0xe011('0xe')](_0xe011('0xf'),_0x5484bd,_0xe011('0x10'));_0x54296d(_0x234df9[_0xe011('0x15')][_0xe011('0x14')]);}})['catch'](function(_0x1dc2db){logger['error']('Setting,\x20%s,\x20%s',_0x5484bd,_0x1dc2db);_0x2fc3a0(_0x1dc2db);});});}exports[_0xe011('0x16')]=function(_0x307d6e){var _0x471772=this;return new Promise(function(_0x175cae,_0x462ba7){return db[_0xe011('0x17')][_0xe011('0x18')]({'raw':_0x307d6e[_0xe011('0x19')]?_0x307d6e['options'][_0xe011('0x1a')]===undefined?!![]:![]:!![],'where':_0x307d6e[_0xe011('0x19')]?_0x307d6e[_0xe011('0x19')][_0xe011('0x1b')]||null:null,'attributes':_0x307d6e[_0xe011('0x19')]?_0x307d6e[_0xe011('0x19')]['attributes']||null:null,'include':_0x307d6e['options']?_0x307d6e[_0xe011('0x19')][_0xe011('0x1c')]?_[_0xe011('0x1d')](_0x307d6e[_0xe011('0x19')][_0xe011('0x1c')],function(_0xcfbad1){return{'model':db[_0xcfbad1['model']],'as':_0xcfbad1['as'],'attributes':_0xcfbad1[_0xe011('0x1e')],'include':_0xcfbad1[_0xe011('0x1c')]?_[_0xe011('0x1d')](_0xcfbad1[_0xe011('0x1c')],function(_0xfd2d71){return{'model':db[_0xfd2d71[_0xe011('0x1f')]],'as':_0xfd2d71['as'],'attributes':_0xfd2d71['attributes'],'include':_0xfd2d71[_0xe011('0x1c')]?_[_0xe011('0x1d')](_0xfd2d71[_0xe011('0x1c')],function(_0x5e2901){return{'model':db[_0x5e2901['model']],'as':_0x5e2901['as'],'attributes':_0x5e2901[_0xe011('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xe011('0xd')](function(_0x3a9e28){logger[_0xe011('0xe')](_0xe011('0x16'),_0x307d6e);logger[_0xe011('0x20')]('ShowSetting',_0x307d6e,JSON[_0xe011('0x21')](_0x3a9e28));_0x175cae(_0x3a9e28);})['catch'](function(_0x4b20f0){logger[_0xe011('0x12')](_0xe011('0x16'),_0x4b20f0[_0xe011('0x14')],_0x307d6e);_0x462ba7(_0x471772[_0xe011('0x12')](0x1f4,_0x4b20f0[_0xe011('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index 26c40cf..cc9bc43 100644 --- a/server/api/smsAccount/index.js +++ b/server/api/smsAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['getInteractions','statusGet','/:id/users','getAgents','post','create','addDisposition','/:id/canned_answers','addAnswer','addApplications','/:id/status','status','addAgents','/:id','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsAccount.controller','get','isAuthenticated','index','/describe','describe','show','/:id/dispositions','getDispositions','getAnswers','/:id/applications','getApplications','/:id/interactions'];(function(_0x4a8ce2,_0x4cd94e){var _0x38c265=function(_0x1fb277){while(--_0x1fb277){_0x4a8ce2['push'](_0x4a8ce2['shift']());}};_0x38c265(++_0x4cd94e);}(_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',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x9')]('/:id/canned_answers',auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router['get'](_0x7995('0x12'),auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x9')](_0x7995('0x14'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router['get']('/:id/status',controller[_0x7995('0x16')]);router[_0x7995('0x9')](_0x7995('0x17'),auth[_0x7995('0xa')](),controller[_0x7995('0x18')]);router[_0x7995('0x19')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0x1a')]);router['post'](_0x7995('0xf'),auth['isAuthenticated'](),controller[_0x7995('0x1b')]);router[_0x7995('0x19')](_0x7995('0x1c'),auth[_0x7995('0xa')](),controller[_0x7995('0x1d')]);router[_0x7995('0x19')]('/:id/notify',controller['notify']);router[_0x7995('0x19')]('/:id/applications',auth['isAuthenticated'](),controller[_0x7995('0x1e')]);router[_0x7995('0x19')]('/:id/send',auth[_0x7995('0xa')](),controller['send']);router['post'](_0x7995('0x1f'),controller[_0x7995('0x20')]);router[_0x7995('0x19')](_0x7995('0x17'),auth[_0x7995('0xa')](),controller[_0x7995('0x21')]);router['put'](_0x7995('0x22'),auth[_0x7995('0xa')](),controller[_0x7995('0x23')]);router[_0x7995('0x24')](_0x7995('0x22'),auth[_0x7995('0xa')](),controller[_0x7995('0x25')]);router[_0x7995('0x24')]('/:id/dispositions',auth[_0x7995('0xa')](),controller[_0x7995('0x26')]);router[_0x7995('0x24')](_0x7995('0x1c'),auth[_0x7995('0xa')](),controller[_0x7995('0x27')]);router['delete'](_0x7995('0x17'),auth['isAuthenticated'](),controller[_0x7995('0x28')]);module[_0x7995('0x29')]=router; \ No newline at end of file +var _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(_0x89311d,_0x991439){var _0x53ee33=function(_0x10f6d0){while(--_0x10f6d0){_0x89311d['push'](_0x89311d['shift']());}};_0x53ee33(++_0x991439);}(_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('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 654af09..0a388c2 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 _0xe2cf=['name','generate','ENUM','skebby','connectel','plivo','clickatell','bandwidth','csc','BOOLEAN','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','setDataValue','mandatoryDisposition','sequelize','exports','STRING'];(function(_0x4179b3,_0x2eaff2){var _0x5b5c7e=function(_0x568341){while(--_0x568341){_0x4179b3['push'](_0x4179b3['shift']());}};_0x5b5c7e(++_0x2eaff2);}(_0xe2cf,0x7b));var _0xfe2c=function(_0x26d034,_0x2c22db){_0x26d034=_0x26d034-0x0;var _0x3015aa=_0xe2cf[_0x26d034];return _0x3015aa;};'use strict';var Sequelize=require(_0xfe2c('0x0'));var rs=require('randomstring');module[_0xfe2c('0x1')]={'name':{'type':Sequelize[_0xfe2c('0x2')],'unique':_0xfe2c('0x3'),'allowNull':![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'remote':{'type':Sequelize[_0xfe2c('0x2')],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0xfe2c('0x4')]();}},'phone':{'type':Sequelize[_0xfe2c('0x2')]},'type':{'type':Sequelize[_0xfe2c('0x5')]('twilio',_0xfe2c('0x6'),_0xfe2c('0x7'),'clicksend',_0xfe2c('0x8'),_0xfe2c('0x9'),_0xfe2c('0xa'),_0xfe2c('0xb'),'infobip','intelepeer')},'accountSid':{'type':Sequelize[_0xfe2c('0x2')]},'authId':{'type':Sequelize[_0xfe2c('0x2')]},'authToken':{'type':Sequelize[_0xfe2c('0x2')]},'smsMethod':{'type':Sequelize[_0xfe2c('0x5')]('SI','TI','GP')},'username':{'type':Sequelize[_0xfe2c('0x2')]},'password':{'type':Sequelize[_0xfe2c('0x2')]},'apiKey':{'type':Sequelize[_0xfe2c('0x2')]},'applicationId':{'type':Sequelize[_0xfe2c('0x2')]},'accountId':{'type':Sequelize[_0xfe2c('0x2')]},'senderString':{'type':Sequelize['STRING']},'deliveryReport':{'type':Sequelize[_0xfe2c('0xc')],'defaultValue':![]},'description':{'type':Sequelize[_0xfe2c('0x2')]},'notificationTemplate':{'type':Sequelize[_0xfe2c('0xd')],'defaultValue':function(){return _0xfe2c('0xe');}},'notificationSound':{'type':Sequelize[_0xfe2c('0xc')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xfe2c('0xc')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xfe2c('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xfe2c('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xfe2c('0xc')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0xfe2c('0x2')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0xfe2c('0xf')],'comment':_0xfe2c('0x10')},'mandatoryDisposition':{'type':Sequelize[_0xfe2c('0xc')],'defaultValue':![],'comment':_0xfe2c('0x11'),'set':function(_0x254064){if(!_0x254064)this['setDataValue'](_0xfe2c('0x12'),null);this[_0xfe2c('0x13')](_0xfe2c('0x14'),_0x254064);}}}; \ No newline at end of file +var _0x39c0=['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','setDataValue','mandatoryDisposition','randomstring','STRING','name','generate','ENUM','twilio','connectel','clicksend','plivo','clickatell','csc','infobip','intelepeer'];(function(_0x5b2672,_0x5d5820){var _0x44cbaa=function(_0x9f9574){while(--_0x9f9574){_0x5b2672['push'](_0x5b2672['shift']());}};_0x44cbaa(++_0x5d5820);}(_0x39c0,0x1ab));var _0x039c=function(_0x434ad8,_0x2579ff){_0x434ad8=_0x434ad8-0x0;var _0x5ad69b=_0x39c0[_0x434ad8];return _0x5ad69b;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x039c('0x0'));module['exports']={'name':{'type':Sequelize[_0x039c('0x1')],'unique':_0x039c('0x2'),'allowNull':![]},'key':{'type':Sequelize[_0x039c('0x1')],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize[_0x039c('0x1')],'defaultValue':function(){return rs[_0x039c('0x3')]();}},'phone':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x039c('0x4')](_0x039c('0x5'),'skebby',_0x039c('0x6'),_0x039c('0x7'),_0x039c('0x8'),_0x039c('0x9'),'bandwidth',_0x039c('0xa'),_0x039c('0xb'),_0x039c('0xc'))},'accountSid':{'type':Sequelize[_0x039c('0x1')]},'authId':{'type':Sequelize[_0x039c('0x1')]},'authToken':{'type':Sequelize['STRING']},'smsMethod':{'type':Sequelize[_0x039c('0x4')]('SI','TI','GP')},'username':{'type':Sequelize[_0x039c('0x1')]},'password':{'type':Sequelize[_0x039c('0x1')]},'apiKey':{'type':Sequelize[_0x039c('0x1')]},'applicationId':{'type':Sequelize[_0x039c('0x1')]},'accountId':{'type':Sequelize['STRING']},'senderString':{'type':Sequelize[_0x039c('0x1')]},'deliveryReport':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize[_0x039c('0x1')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x039c('0xd');}},'notificationSound':{'type':Sequelize[_0x039c('0xe')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x039c('0xe')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x039c('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x039c('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x039c('0xe')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x039c('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x039c('0xe')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x039c('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize['STRING']},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0x039c('0x10')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x4a8ca0){if(!_0x4a8ca0)this['setDataValue'](_0x039c('0x11'),null);this[_0x039c('0x12')](_0x039c('0x13'),_0x4a8ca0);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index 4d09c84..b004117 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 _0x5664=['isArray','userSmsAccount:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','./smsAccount.socket','register','jayson/promise','client','http','request','then','info','SmsAccount,\x20%s,\x20%s','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','catch','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','get','SmsAccounts','sendStatus','stack','name','send','Pause','mandatoryDispositionPause','map','SmsAccount','rawAttributes','fieldName','type','key','model','query','intersection','fields','attributes','length','order','sort','where','filters','pick','filter','merge','options','includeAll','findAll','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','SmsAccountId','Disposition','getDispositions','findOne','hasOwnProperty','include','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','notify','sms','SmsApplication','Applications','account','applications','orderBy','priority','asc','CmContact','Sequelize','ValidationError','difference','createdAt','updatedAt','CompanyId','ListId','mobile','twilio','Body','messageId','skebby','from','connectel','clicksend','message_id','Text','MessageUUID','infobip','results','text','csc','segmentedMessage','clickatell','fromNumber','bandwidth','refid','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','DESC','list','omit','Contacts','contact','SmsInteraction','spread','interaction','created','autoclose','close','unmanaged','ContactId','AttachmentId','UserId','User','*,*,*,*','SmsQueue','queueId','unshift','queue','Start','receiveMessage','entity\x20found','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','Content-Type','text/xml','transaction','sequelize','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','finally','getApplications','nolimit','getInteractions','Contact','Owner','fullname','internal','Tag','Tags','color','tag','rows','to\x20is\x20mandatory','CmList','List','out','SmsMessage','dataValues','Messages','received\x20delivery\x20report\x20from','inspect','skebby_dispatch_id','statusInt','requestid','status_code','groupName','DELIVERED','intelepeer','redif','error_code','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','message-delivered','DELIVRD','ACCEPTD','debug','message-id','state','addAgents','emit','removeAgents'];(function(_0x2dadb9,_0x42cfe6){var _0x2f0097=function(_0x21163f){while(--_0x21163f){_0x2dadb9['push'](_0x2dadb9['shift']());}};_0x2f0097(++_0x42cfe6);}(_0x5664,0xf2));var _0x4566=function(_0x256b72,_0x340985){_0x256b72=_0x256b72-0x0;var _0x2183e3=_0x5664[_0x256b72];return _0x2183e3;};'use strict';var emlformat=require(_0x4566('0x0'));var rimraf=require(_0x4566('0x1'));var zipdir=require(_0x4566('0x2'));var jsonpatch=require(_0x4566('0x3'));var rp=require(_0x4566('0x4'));var moment=require(_0x4566('0x5'));var BPromise=require(_0x4566('0x6'));var Mustache=require('mustache');var util=require(_0x4566('0x7'));var path=require(_0x4566('0x8'));var sox=require(_0x4566('0x9'));var csv=require(_0x4566('0xa'));var ejs=require(_0x4566('0xb'));var fs=require('fs');var fs_extra=require(_0x4566('0xc'));var _=require(_0x4566('0xd'));var squel=require('squel');var crypto=require(_0x4566('0xe'));var jsforce=require(_0x4566('0xf'));var deskjs=require(_0x4566('0x10'));var toCsv=require(_0x4566('0xa'));var querystring=require(_0x4566('0x11'));var Papa=require(_0x4566('0x12'));var Redis=require(_0x4566('0x13'));var authService=require(_0x4566('0x14'));var qs=require(_0x4566('0x15'));var as=require(_0x4566('0x16'));var hardwareService=require(_0x4566('0x17'));var logger=require(_0x4566('0x18'))(_0x4566('0x19'));var utils=require(_0x4566('0x1a'));var config=require('../../config/environment');var licenseUtil=require(_0x4566('0x1b'));var db=require(_0x4566('0x1c'))['db'];config[_0x4566('0x1d')]=_[_0x4566('0x1e')](config['redis'],{'host':_0x4566('0x1f'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4566('0x1d')]));require(_0x4566('0x20'))[_0x4566('0x21')](socket);var jayson=require(_0x4566('0x22'));var client=jayson[_0x4566('0x23')][_0x4566('0x24')]({'port':0x232c});function respondWithRpcPromise(_0x1aa53d,_0x3a9dc9,_0xbe72a3,_0x3ff076){return new BPromise(function(_0x16530f,_0x28019f){var _0x5e7c93=_0x3ff076||client;return _0x5e7c93[_0x4566('0x25')](_0x1aa53d,_0xbe72a3)[_0x4566('0x26')](function(_0x593a2a){logger[_0x4566('0x27')](_0x4566('0x28'),_0x3a9dc9,'request\x20sent');logger['debug'](_0x4566('0x29'),_0x3a9dc9,'request\x20sent',JSON[_0x4566('0x2a')](_0x593a2a));if(_0x593a2a[_0x4566('0x2b')]){if(_0x593a2a[_0x4566('0x2b')][_0x4566('0x2c')]===0x1f4){logger['error']('SmsAccount,\x20%s,\x20%s',_0x3a9dc9,_0x593a2a[_0x4566('0x2b')][_0x4566('0x2d')]);return _0x28019f(_0x593a2a[_0x4566('0x2b')][_0x4566('0x2d')]);}logger['error'](_0x4566('0x28'),_0x3a9dc9,_0x593a2a[_0x4566('0x2b')][_0x4566('0x2d')]);return _0x16530f(_0x593a2a['error'][_0x4566('0x2d')]);}else{logger[_0x4566('0x27')](_0x4566('0x28'),_0x3a9dc9,_0x4566('0x2e'));_0x16530f(_0x593a2a['result'][_0x4566('0x2d')]);}})[_0x4566('0x2f')](function(_0x180274){logger['error'](_0x4566('0x28'),_0x3a9dc9,_0x180274);_0x28019f(_0x180274);});});}function respondWithStatusCode(_0x29ad08,_0x6dd3cb){_0x6dd3cb=_0x6dd3cb||0xcc;return function(_0xa8a03f){if(_0xa8a03f){return _0x29ad08['sendStatus'](_0x6dd3cb);}return _0x29ad08[_0x4566('0x30')](_0x6dd3cb)[_0x4566('0x31')]();};}function respondWithResult(_0x4ecd63,_0x1ee9ff){_0x1ee9ff=_0x1ee9ff||0xc8;return function(_0x1e19f2){if(_0x1e19f2){return _0x4ecd63['status'](_0x1ee9ff)[_0x4566('0x32')](_0x1e19f2);}};}function respondWithFilteredResult(_0x59a973,_0x48aeab){return function(_0x5abbe3){if(_0x5abbe3){var _0x3c99a8=typeof _0x48aeab['offset']===_0x4566('0x33')&&typeof _0x48aeab['limit']===_0x4566('0x33');var _0x5ab060=_0x5abbe3[_0x4566('0x34')];var _0x18bee8=_0x3c99a8?0x0:_0x48aeab['offset'];var _0x544196=_0x3c99a8?_0x5abbe3[_0x4566('0x34')]:_0x48aeab[_0x4566('0x35')]+_0x48aeab[_0x4566('0x36')];var _0x22e5ab;if(_0x544196>=_0x5ab060){_0x544196=_0x5ab060;_0x22e5ab=0xc8;}else{_0x22e5ab=0xce;}_0x59a973['status'](_0x22e5ab);return _0x59a973[_0x4566('0x37')](_0x4566('0x38'),_0x18bee8+'-'+_0x544196+'/'+_0x5ab060)[_0x4566('0x32')](_0x5abbe3);}return null;};}function patchUpdates(_0x8c9801){return function(_0x7c4e4b){try{jsonpatch[_0x4566('0x39')](_0x7c4e4b,_0x8c9801,!![]);}catch(_0x5c59b2){return BPromise[_0x4566('0x3a')](_0x5c59b2);}return _0x7c4e4b[_0x4566('0x3b')]();};}function saveUpdates(_0x3baf4f,_0x196087){return function(_0x50afc1){if(_0x50afc1){return _0x50afc1[_0x4566('0x3c')](_0x3baf4f)['then'](function(_0x5efe85){return _0x5efe85;});}return null;};}function removeEntity(_0x9feed6,_0x4f1ecd){return function(_0x382ebe){if(_0x382ebe){return _0x382ebe[_0x4566('0x3d')]()['then'](function(){var _0x255c96=_0x382ebe[_0x4566('0x3e')]({'plain':!![]});var _0x2fcb74=_0x4566('0x3f');return db['UserProfileResource'][_0x4566('0x3d')]({'where':{'type':_0x2fcb74,'resourceId':_0x255c96['id']}})[_0x4566('0x26')](function(){return _0x382ebe;});})[_0x4566('0x26')](function(){_0x9feed6['status'](0xcc)[_0x4566('0x31')]();});}};}function handleEntityNotFound(_0x576973,_0x330147){return function(_0x470ec1){if(!_0x470ec1){_0x576973[_0x4566('0x40')](0x194);}return _0x470ec1;};}function handleError(_0x4b716b,_0x1f4b7c){_0x1f4b7c=_0x1f4b7c||0x1f4;return function(_0x4ab088){logger[_0x4566('0x2b')](_0x4ab088[_0x4566('0x41')]);if(_0x4ab088['name']){delete _0x4ab088[_0x4566('0x42')];}_0x4b716b[_0x4566('0x30')](_0x1f4b7c)[_0x4566('0x43')](_0x4ab088);};}exports['index']=function(_0x26fae1,_0x46f458){var _0x432c84={'include':[{'model':db[_0x4566('0x44')],'as':_0x4566('0x45')}]},_0x4d13cb={},_0x1fd740={'count':0x0,'rows':[]};var _0x124f74=_[_0x4566('0x46')](db[_0x4566('0x47')][_0x4566('0x48')],function(_0x2a83ee){return{'name':_0x2a83ee[_0x4566('0x49')],'type':_0x2a83ee[_0x4566('0x4a')][_0x4566('0x4b')]};});_0x4d13cb[_0x4566('0x4c')]=_[_0x4566('0x46')](_0x124f74,_0x4566('0x42'));_0x4d13cb[_0x4566('0x4d')]=_['keys'](_0x26fae1[_0x4566('0x4d')]);_0x4d13cb['filters']=_['intersection'](_0x4d13cb[_0x4566('0x4c')],_0x4d13cb[_0x4566('0x4d')]);_0x432c84['attributes']=_[_0x4566('0x4e')](_0x4d13cb[_0x4566('0x4c')],qs[_0x4566('0x4f')](_0x26fae1[_0x4566('0x4d')]['fields']));_0x432c84[_0x4566('0x50')]=_0x432c84[_0x4566('0x50')][_0x4566('0x51')]?_0x432c84['attributes']:_0x4d13cb[_0x4566('0x4c')];if(!_0x26fae1[_0x4566('0x4d')]['hasOwnProperty']('nolimit')){_0x432c84[_0x4566('0x36')]=qs[_0x4566('0x36')](_0x26fae1['query'][_0x4566('0x36')]);_0x432c84[_0x4566('0x35')]=qs[_0x4566('0x35')](_0x26fae1[_0x4566('0x4d')][_0x4566('0x35')]);}_0x432c84[_0x4566('0x52')]=qs[_0x4566('0x53')](_0x26fae1[_0x4566('0x4d')]['sort']);_0x432c84[_0x4566('0x54')]=qs[_0x4566('0x55')](_[_0x4566('0x56')](_0x26fae1['query'],_0x4d13cb[_0x4566('0x55')]),_0x124f74);if(_0x26fae1['query'][_0x4566('0x57')]){_0x432c84[_0x4566('0x54')]=_[_0x4566('0x58')](_0x432c84[_0x4566('0x54')],{'$or':_[_0x4566('0x46')](_0x124f74,function(_0x539de6){if(_0x539de6['type']!=='VIRTUAL'){var _0x37edd5={};_0x37edd5[_0x539de6['name']]={'$like':'%'+_0x26fae1['query'][_0x4566('0x57')]+'%'};return _0x37edd5;}})});}_0x432c84=_['merge']({},_0x432c84,_0x26fae1[_0x4566('0x59')]);var _0x5e1b31={'where':_0x432c84[_0x4566('0x54')]};return db[_0x4566('0x47')][_0x4566('0x34')](_0x5e1b31)['then'](function(_0x15fada){_0x1fd740[_0x4566('0x34')]=_0x15fada;if(_0x26fae1[_0x4566('0x4d')][_0x4566('0x5a')]){_0x432c84['include']=[{'all':!![]}];}return db[_0x4566('0x47')][_0x4566('0x5b')](_0x432c84);})['then'](function(_0x4ab976){_0x1fd740['rows']=_0x4ab976;return _0x1fd740;})['then'](respondWithFilteredResult(_0x46f458,_0x432c84))[_0x4566('0x2f')](handleError(_0x46f458,null));};exports[_0x4566('0x5c')]=function(_0x3ee695,_0x36d44c){var _0x2c636a={'raw':![],'where':{'id':_0x3ee695[_0x4566('0x5d')]['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x46902a={};_0x46902a[_0x4566('0x4c')]=_[_0x4566('0x5e')](db['SmsAccount']['rawAttributes']);_0x46902a['query']=_[_0x4566('0x5e')](_0x3ee695[_0x4566('0x4d')]);_0x46902a['filters']=_[_0x4566('0x4e')](_0x46902a[_0x4566('0x4c')],_0x46902a[_0x4566('0x4d')]);_0x2c636a['attributes']=_[_0x4566('0x4e')](_0x46902a[_0x4566('0x4c')],qs[_0x4566('0x4f')](_0x3ee695[_0x4566('0x4d')][_0x4566('0x4f')]));_0x2c636a[_0x4566('0x50')]=_0x2c636a['attributes'][_0x4566('0x51')]?_0x2c636a[_0x4566('0x50')]:_0x46902a['model'];if(_0x3ee695[_0x4566('0x4d')][_0x4566('0x5a')]){_0x2c636a['include']=[{'all':!![]}];}_0x2c636a=_[_0x4566('0x58')]({},_0x2c636a,_0x3ee695[_0x4566('0x59')]);return db[_0x4566('0x47')][_0x4566('0x5f')](_0x2c636a)['then'](handleEntityNotFound(_0x36d44c,null))[_0x4566('0x26')](respondWithResult(_0x36d44c,null))['catch'](handleError(_0x36d44c,null));};exports[_0x4566('0x60')]=function(_0x3256a8,_0x20f4be){return db[_0x4566('0x47')][_0x4566('0x60')](_0x3256a8[_0x4566('0x61')],{})[_0x4566('0x26')](function(_0x313d5c){var _0x4c40eb=_0x3256a8[_0x4566('0x62')][_0x4566('0x3e')]({'plain':!![]});if(!_0x4c40eb)throw new Error(_0x4566('0x63'));if(_0x4c40eb[_0x4566('0x64')]==='user'){var _0x2e4130=_0x313d5c[_0x4566('0x3e')]({'plain':!![]});var _0x794782=_0x4566('0x3f');return db[_0x4566('0x65')][_0x4566('0x5f')]({'where':{'name':_0x794782,'userProfileId':_0x4c40eb[_0x4566('0x66')]},'raw':!![]})[_0x4566('0x26')](function(_0x58a696){if(_0x58a696&&_0x58a696[_0x4566('0x67')]===0x0){return db['UserProfileResource'][_0x4566('0x60')]({'name':_0x2e4130[_0x4566('0x42')],'resourceId':_0x2e4130['id'],'type':_0x58a696[_0x4566('0x42')],'sectionId':_0x58a696['id']},{})[_0x4566('0x26')](function(){return _0x313d5c;});}else{return _0x313d5c;}})[_0x4566('0x2f')](function(_0x4eca3a){logger[_0x4566('0x2b')](_0x4566('0x68'),_0x4eca3a);throw _0x4eca3a;});}return _0x313d5c;})[_0x4566('0x26')](respondWithResult(_0x20f4be,0xc9))[_0x4566('0x2f')](handleError(_0x20f4be,null));};exports[_0x4566('0x3c')]=function(_0x135075,_0x48b53a){if(_0x135075[_0x4566('0x61')]['id']){delete _0x135075[_0x4566('0x61')]['id'];}return db[_0x4566('0x47')][_0x4566('0x5f')]({'where':{'id':_0x135075[_0x4566('0x5d')]['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]})[_0x4566('0x26')](handleEntityNotFound(_0x48b53a,null))[_0x4566('0x26')](saveUpdates(_0x135075[_0x4566('0x61')],null))['then'](respondWithResult(_0x48b53a,null))[_0x4566('0x2f')](handleError(_0x48b53a,null));};exports[_0x4566('0x3d')]=function(_0x2bc3ba,_0x3a118b){return db[_0x4566('0x47')][_0x4566('0x5f')]({'where':{'id':_0x2bc3ba['params']['id']}})['then'](handleEntityNotFound(_0x3a118b,null))[_0x4566('0x26')](removeEntity(_0x3a118b,null))[_0x4566('0x2f')](handleError(_0x3a118b,null));};exports[_0x4566('0x69')]=function(_0x585dcc,_0x6707c0){return db[_0x4566('0x47')]['describe']()['then'](respondWithResult(_0x6707c0,null))['catch'](handleError(_0x6707c0,null));};exports[_0x4566('0x6a')]=function(_0x48cdc6,_0x52ca3f,_0x327e3f){if(_0x48cdc6[_0x4566('0x61')]['id']){delete _0x48cdc6[_0x4566('0x61')]['id'];}return db[_0x4566('0x47')]['find']({'where':{'id':_0x48cdc6[_0x4566('0x5d')]['id']}})['then'](handleEntityNotFound(_0x52ca3f,null))[_0x4566('0x26')](function(_0x146635){if(_0x146635){_0x48cdc6[_0x4566('0x61')][_0x4566('0x6b')]=_0x146635['id'];return db[_0x4566('0x6c')]['create'](_0x48cdc6[_0x4566('0x61')]);}})[_0x4566('0x26')](respondWithResult(_0x52ca3f,null))[_0x4566('0x2f')](handleError(_0x52ca3f,null));};exports[_0x4566('0x6d')]=function(_0x5a3d46,_0x2aa623,_0x16032c){var _0x74528e={'raw':![],'where':{}};var _0xe69c33={};var _0x50268e={'count':0x0,'rows':[]};return db['SmsAccount'][_0x4566('0x6e')]({'where':{'id':_0x5a3d46[_0x4566('0x5d')]['id']}})[_0x4566('0x26')](handleEntityNotFound(_0x2aa623,null))[_0x4566('0x26')](function(_0x30f719){if(_0x30f719){_0xe69c33[_0x4566('0x4c')]=_[_0x4566('0x5e')](db['Disposition']['rawAttributes']);_0xe69c33[_0x4566('0x4d')]=_['keys'](_0x5a3d46[_0x4566('0x4d')]);_0xe69c33[_0x4566('0x55')]=_['intersection'](_0xe69c33[_0x4566('0x4c')],_0xe69c33['query']);_0x74528e['attributes']=_[_0x4566('0x4e')](_0xe69c33[_0x4566('0x4c')],qs[_0x4566('0x4f')](_0x5a3d46[_0x4566('0x4d')][_0x4566('0x4f')]));_0x74528e['attributes']=_0x74528e[_0x4566('0x50')]['length']?_0x74528e[_0x4566('0x50')]:_0xe69c33['model'];if(!_0x5a3d46[_0x4566('0x4d')][_0x4566('0x6f')]('nolimit')){_0x74528e[_0x4566('0x36')]=qs['limit'](_0x5a3d46[_0x4566('0x4d')][_0x4566('0x36')]);_0x74528e[_0x4566('0x35')]=qs['offset'](_0x5a3d46[_0x4566('0x4d')][_0x4566('0x35')]);}_0x74528e[_0x4566('0x52')]=qs[_0x4566('0x53')](_0x5a3d46['query'][_0x4566('0x53')]);_0x74528e[_0x4566('0x54')]=qs[_0x4566('0x55')](_[_0x4566('0x56')](_0x5a3d46[_0x4566('0x4d')],_0xe69c33['filters']));_0x74528e[_0x4566('0x54')][_0x4566('0x6b')]=_0x30f719['id'];if(_0x5a3d46['query'][_0x4566('0x57')]){_0x74528e[_0x4566('0x54')]=_[_0x4566('0x58')](_0x74528e['where'],{'$or':_[_0x4566('0x46')](_0x74528e['attributes'],function(_0x2cc598){var _0x6de8a8={};_0x6de8a8[_0x2cc598]={'$like':'%'+_0x5a3d46[_0x4566('0x4d')]['filter']+'%'};return _0x6de8a8;})});}_0x74528e=_['merge']({},_0x74528e,_0x5a3d46[_0x4566('0x59')]);return db['Disposition']['count']({'where':_0x74528e['where']})[_0x4566('0x26')](function(_0x398546){_0x50268e[_0x4566('0x34')]=_0x398546;if(_0x5a3d46[_0x4566('0x4d')][_0x4566('0x5a')]){_0x74528e[_0x4566('0x70')]=[{'all':!![]}];}return db['Disposition']['findAll'](_0x74528e);})[_0x4566('0x26')](function(_0x5877c3){_0x50268e['rows']=_0x5877c3;return _0x50268e;});}})[_0x4566('0x26')](respondWithFilteredResult(_0x2aa623,_0x74528e))[_0x4566('0x2f')](handleError(_0x2aa623,null));};exports[_0x4566('0x71')]=function(_0x3c338c,_0x2d55dc,_0x568e95){return db['SmsAccount'][_0x4566('0x5f')]({'where':{'id':_0x3c338c['params']['id']}})['then'](handleEntityNotFound(_0x2d55dc,null))[_0x4566('0x26')](function(_0xa9092e){if(_0xa9092e){return _0xa9092e[_0x4566('0x71')](_0x3c338c['query'][_0x4566('0x72')]);}})[_0x4566('0x26')](respondWithStatusCode(_0x2d55dc,null))[_0x4566('0x2f')](handleError(_0x2d55dc,null));};exports[_0x4566('0x73')]=function(_0x5dd3da,_0x1bf768,_0x4959d6){if(_0x5dd3da['body']['id']){delete _0x5dd3da[_0x4566('0x61')]['id'];}return db['SmsAccount']['find']({'where':{'id':_0x5dd3da[_0x4566('0x5d')]['id']}})[_0x4566('0x26')](handleEntityNotFound(_0x1bf768,null))[_0x4566('0x26')](function(_0x350ee1){if(_0x350ee1){_0x5dd3da[_0x4566('0x61')]['SmsAccountId']=_0x350ee1['id'];return db[_0x4566('0x74')]['create'](_0x5dd3da[_0x4566('0x61')]);}})[_0x4566('0x26')](respondWithResult(_0x1bf768,null))[_0x4566('0x2f')](handleError(_0x1bf768,null));};exports[_0x4566('0x75')]=function(_0x15a382,_0xd0783c,_0x5d50fb){var _0x39e349={'raw':![],'where':{}};var _0xab00e9={};var _0x4dd750={'count':0x0,'rows':[]};return db[_0x4566('0x47')][_0x4566('0x6e')]({'where':{'id':_0x15a382[_0x4566('0x5d')]['id']}})['then'](handleEntityNotFound(_0xd0783c,null))[_0x4566('0x26')](function(_0x18d973){if(_0x18d973){_0xab00e9['model']=_[_0x4566('0x5e')](db['CannedAnswer'][_0x4566('0x48')]);_0xab00e9[_0x4566('0x4d')]=_['keys'](_0x15a382[_0x4566('0x4d')]);_0xab00e9[_0x4566('0x55')]=_[_0x4566('0x4e')](_0xab00e9[_0x4566('0x4c')],_0xab00e9[_0x4566('0x4d')]);_0x39e349['attributes']=_['intersection'](_0xab00e9[_0x4566('0x4c')],qs[_0x4566('0x4f')](_0x15a382[_0x4566('0x4d')][_0x4566('0x4f')]));_0x39e349[_0x4566('0x50')]=_0x39e349['attributes'][_0x4566('0x51')]?_0x39e349[_0x4566('0x50')]:_0xab00e9[_0x4566('0x4c')];if(!_0x15a382[_0x4566('0x4d')][_0x4566('0x6f')]('nolimit')){_0x39e349[_0x4566('0x36')]=qs[_0x4566('0x36')](_0x15a382[_0x4566('0x4d')][_0x4566('0x36')]);_0x39e349[_0x4566('0x35')]=qs[_0x4566('0x35')](_0x15a382['query'][_0x4566('0x35')]);}_0x39e349[_0x4566('0x52')]=qs['sort'](_0x15a382['query']['sort']);_0x39e349['where']=qs[_0x4566('0x55')](_[_0x4566('0x56')](_0x15a382[_0x4566('0x4d')],_0xab00e9[_0x4566('0x55')]));_0x39e349['where'][_0x4566('0x6b')]=_0x18d973['id'];if(_0x15a382[_0x4566('0x4d')][_0x4566('0x57')]){_0x39e349[_0x4566('0x54')]=_['merge'](_0x39e349['where'],{'$or':_['map'](_0x39e349[_0x4566('0x50')],function(_0x4d6271){var _0x26e059={};_0x26e059[_0x4d6271]={'$like':'%'+_0x15a382['query'][_0x4566('0x57')]+'%'};return _0x26e059;})});}_0x39e349=_['merge']({},_0x39e349,_0x15a382[_0x4566('0x59')]);return db[_0x4566('0x74')][_0x4566('0x34')]({'where':_0x39e349['where']})[_0x4566('0x26')](function(_0x1e1749){_0x4dd750[_0x4566('0x34')]=_0x1e1749;if(_0x15a382[_0x4566('0x4d')]['includeAll']){_0x39e349[_0x4566('0x70')]=[{'all':!![]}];}return db[_0x4566('0x74')]['findAll'](_0x39e349);})[_0x4566('0x26')](function(_0x105c04){_0x4dd750['rows']=_0x105c04;return _0x4dd750;});}})[_0x4566('0x26')](respondWithFilteredResult(_0xd0783c,_0x39e349))[_0x4566('0x2f')](handleError(_0xd0783c,null));};exports[_0x4566('0x76')]=function(_0x22267a,_0x377cf5,_0x59c724){return db['SmsAccount'][_0x4566('0x5f')]({'where':{'id':_0x22267a['params']['id']}})[_0x4566('0x26')](handleEntityNotFound(_0x377cf5,null))[_0x4566('0x26')](function(_0x2ed17f){if(_0x2ed17f){return _0x2ed17f[_0x4566('0x76')](_0x22267a[_0x4566('0x4d')][_0x4566('0x72')]);}})['then'](respondWithStatusCode(_0x377cf5,null))['catch'](handleError(_0x377cf5,null));};exports[_0x4566('0x77')]=function(_0x16eb8e,_0x5e558e,_0x310433){var _0x9ae8e1={'channel':_0x4566('0x78')};var _0x454690=[];var _0x376511=[];var _0xdae6c={};return db[_0x4566('0x47')][_0x4566('0x5f')]({'where':{'id':_0x16eb8e[_0x4566('0x5d')]['id']},'include':[{'model':db[_0x4566('0x79')],'as':_0x4566('0x7a')}]})[_0x4566('0x26')](handleEntityNotFound(_0x5e558e,null))[_0x4566('0x26')](function(_0x48bedf){_0x9ae8e1[_0x4566('0x7b')]=_0x48bedf;_0x9ae8e1[_0x4566('0x7c')]=_[_0x4566('0x7d')](_0x48bedf['Applications'],[_0x4566('0x7e')],[_0x4566('0x7f')]);if(_0x9ae8e1[_0x4566('0x7b')][_0x4566('0x7a')]){delete _0x9ae8e1[_0x4566('0x7b')]['Applications'];}return db[_0x4566('0x80')][_0x4566('0x69')]();})[_0x4566('0x26')](function(_0x2626b6){if(!_0x2626b6){throw new db[(_0x4566('0x81'))][(_0x4566('0x82'))]('no\x20available\x20attributes');}_0x454690=_[_0x4566('0x83')](_['keys'](_0x2626b6),[_0x4566('0x84'),_0x4566('0x85')]);_0x376511=_[_0x4566('0x83')](_[_0x4566('0x5e')](_0x2626b6),[_0x4566('0x84'),'updatedAt',_0x4566('0x86'),_0x4566('0x87')]);_0x9ae8e1['body']={'mapKey':_0x4566('0x88')};if(_0x9ae8e1[_0x4566('0x7b')][_0x4566('0x4a')]){switch(_0x9ae8e1['account']['type']){case _0x4566('0x89'):_0x9ae8e1[_0x4566('0x61')]['from']=_0x16eb8e[_0x4566('0x61')]['From'];_0x9ae8e1[_0x4566('0x61')]['body']=_0x16eb8e[_0x4566('0x61')][_0x4566('0x8a')];_0x9ae8e1['body'][_0x4566('0x8b')]=_0x16eb8e[_0x4566('0x61')]['MessageSid'];break;case _0x4566('0x8c'):_0x9ae8e1[_0x4566('0x61')][_0x4566('0x8d')]='+'+_0x16eb8e[_0x4566('0x61')]['sender'];_0x9ae8e1[_0x4566('0x61')]['body']=_0x16eb8e['body']['text'];break;case _0x4566('0x8e'):_0x9ae8e1[_0x4566('0x61')][_0x4566('0x8d')]=_0x16eb8e[_0x4566('0x61')][_0x4566('0x8d')];_0x9ae8e1[_0x4566('0x61')][_0x4566('0x61')]=_0x16eb8e[_0x4566('0x61')][_0x4566('0x2d')];break;case _0x4566('0x8f'):_0x9ae8e1['body']['from']=_0x16eb8e[_0x4566('0x61')][_0x4566('0x8d')];_0x9ae8e1['body'][_0x4566('0x61')]=_0x16eb8e[_0x4566('0x61')]['body'];_0x9ae8e1[_0x4566('0x61')][_0x4566('0x8b')]=_0x16eb8e[_0x4566('0x61')][_0x4566('0x90')];break;case'plivo':_0x9ae8e1[_0x4566('0x61')][_0x4566('0x8d')]=_0x16eb8e['body']['From'];_0x9ae8e1[_0x4566('0x61')][_0x4566('0x61')]=_0x16eb8e[_0x4566('0x61')][_0x4566('0x91')];_0x9ae8e1[_0x4566('0x61')][_0x4566('0x8b')]=_0x16eb8e[_0x4566('0x61')][_0x4566('0x92')];break;case _0x4566('0x93'):_0x9ae8e1[_0x4566('0x61')][_0x4566('0x8d')]='+'+_0x16eb8e['body']['results'][0x0][_0x4566('0x8d')];_0x9ae8e1[_0x4566('0x61')][_0x4566('0x61')]=_0x16eb8e[_0x4566('0x61')][_0x4566('0x94')][0x0][_0x4566('0x95')];_0x9ae8e1['body'][_0x4566('0x8b')]=_0x16eb8e['body'][_0x4566('0x94')][0x0]['messageId'];break;case _0x4566('0x96'):_0x9ae8e1['body']['from']=_0x16eb8e[_0x4566('0x61')]['originatingAddress'];_0x9ae8e1['body'][_0x4566('0x61')]=_0x16eb8e['body'][_0x4566('0x97')]['message'];break;case _0x4566('0x98'):_0x9ae8e1[_0x4566('0x61')]['from']=_0x16eb8e[_0x4566('0x61')][_0x4566('0x99')];_0x9ae8e1[_0x4566('0x61')][_0x4566('0x61')]=_0x16eb8e['body']['text'];_0x9ae8e1[_0x4566('0x61')][_0x4566('0x8b')]=_0x16eb8e['body']['replyMessageId'];break;case _0x4566('0x9a'):_0x9ae8e1[_0x4566('0x61')]['messageId']=_0x16eb8e['body'][0x0][_0x4566('0x2d')]['id'];_0x9ae8e1[_0x4566('0x61')]['from']=_0x16eb8e[_0x4566('0x61')][0x0]['message'][_0x4566('0x8d')];_0x9ae8e1['body']['body']=_0x16eb8e['body'][0x0][_0x4566('0x2d')]['text'];break;case'intelepeer':_0x9ae8e1[_0x4566('0x61')][_0x4566('0x8d')]=_0x16eb8e['body'][_0x4566('0x8d')];_0x9ae8e1['body'][_0x4566('0x61')]=_0x16eb8e[_0x4566('0x61')][_0x4566('0x2d')];_0x9ae8e1['body'][_0x4566('0x8b')]=_0x16eb8e['body'][_0x4566('0x9b')];break;}}if(_0x9ae8e1[_0x4566('0x61')]['id']){delete _0x9ae8e1[_0x4566('0x61')]['id'];}if(_[_0x4566('0x9c')](_0x9ae8e1[_0x4566('0x61')][_0x4566('0x8d')])){throw new db[(_0x4566('0x81'))][(_0x4566('0x82'))](_0x4566('0x9d'));}if(_[_0x4566('0x9c')](_0x9ae8e1[_0x4566('0x61')][_0x4566('0x61')])||_0x9ae8e1[_0x4566('0x61')][_0x4566('0x61')]===''){throw new db[(_0x4566('0x81'))]['ValidationError'](_0x4566('0x9e'));}if(_[_0x4566('0x9c')](_0x9ae8e1['body'][_0x4566('0x9f')])){throw new db[(_0x4566('0x81'))]['ValidationError']('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x376511);}if(!_[_0x4566('0xa0')](_0x376511,_0x9ae8e1[_0x4566('0x61')][_0x4566('0x9f')])){throw new db[(_0x4566('0x81'))][(_0x4566('0x82'))](_0x4566('0xa1')+_0x376511);}_0xdae6c[_0x9ae8e1[_0x4566('0x61')][_0x4566('0x9f')]]=_0x9ae8e1[_0x4566('0x61')][_0x4566('0x8d')];return db['CmList'][_0x4566('0x5f')]({'where':{'id':_0x9ae8e1[_0x4566('0x7b')][_0x4566('0x87')]},'include':[{'model':db[_0x4566('0x80')],'as':'Contacts','where':_0xdae6c,'limit':0x1,'order':[[_0x4566('0x85'),_0x4566('0xa2')]]}]});})['then'](handleEntityNotFound(_0x5e558e,null))['then'](function(_0x38a55f){if(_0x38a55f){_0x9ae8e1[_0x4566('0xa3')]=_[_0x4566('0xa4')](_0x38a55f,['Contacts']);if(_0x38a55f[_0x4566('0xa5')][_0x4566('0x51')]){return _0x38a55f[_0x4566('0xa5')][0x0];}var _0x46af32=_[_0x4566('0x1e')](_0x9ae8e1[_0x4566('0x61')],{'firstName':_0x9ae8e1[_0x4566('0x61')]['from'],'ListId':_0x38a55f['id']});_0x46af32[_0x9ae8e1[_0x4566('0x61')][_0x4566('0x9f')]]=_0x9ae8e1['body'][_0x4566('0x8d')];return db[_0x4566('0x80')][_0x4566('0x60')](_0x46af32,{'fields':_0x454690,'raw':!![]});}})[_0x4566('0x26')](handleEntityNotFound(_0x5e558e,null))[_0x4566('0x26')](function(_0x152cff){if(_0x152cff){_0x9ae8e1[_0x4566('0xa6')]=_0x152cff;var _0x390096={'ContactId':_0x152cff['id'],'phone':_0x9ae8e1[_0x4566('0x61')]['from'],'SmsAccountId':_0x16eb8e['params']['id']};var _0x3a6843={'ContactId':_0x152cff['id'],'SmsAccountId':_0x16eb8e[_0x4566('0x5d')]['id'],'closed':![]};return db[_0x4566('0xa7')]['find']({'where':_0x3a6843})[_0x4566('0x26')](function(_0xe39340){if(_0xe39340){return[_0xe39340,![]];}return db['SmsInteraction'][_0x4566('0x60')](_0x390096)['then'](function(_0x5b88c3){return[_0x5b88c3,!![]];});});}})[_0x4566('0xa8')](function(_0x49b70f,_0x4de2b2){_0x9ae8e1[_0x4566('0xa9')]=_0x49b70f[_0x4566('0x3e')]({'plain':!![]});_0x9ae8e1[_0x4566('0xa9')][_0x4566('0xaa')]=![];if(_0x4de2b2){if(_0x9ae8e1['account'][_0x4566('0xab')]){_0x9ae8e1[_0x4566('0x7c')]['push']({'id':0x0,'priority':_0x9ae8e1['applications'][_0x4566('0x51')]+0x1,'app':_0x4566('0xac'),'appdata':_0x4566('0xad'),'interval':'*,*,*,*'});}_0x9ae8e1[_0x4566('0xa9')][_0x4566('0xaa')]=!![];}return db['SmsMessage'][_0x4566('0x60')]({'phone':_0x9ae8e1['body'][_0x4566('0x8d')],'messageId':_0x9ae8e1[_0x4566('0x61')][_0x4566('0x8b')],'body':_0x9ae8e1[_0x4566('0x61')][_0x4566('0x61')],'SmsAccountId':_0x16eb8e[_0x4566('0x5d')]['id'],'SmsInteractionId':_0x49b70f['id'],'direction':'in','ContactId':_0x49b70f[_0x4566('0xae')],'AttachmentId':_0x9ae8e1[_0x4566('0x61')][_0x4566('0xaf')]});})[_0x4566('0x26')](function(_0x104a67){_0x9ae8e1['message']=_0x104a67;if(!_0x9ae8e1[_0x4566('0xa9')][_0x4566('0xb0')])return;return db[_0x4566('0xb1')][_0x4566('0x5f')]({'attributes':['id',_0x4566('0x42')],'where':{'id':_0x9ae8e1[_0x4566('0xa9')][_0x4566('0xb0')]}});})[_0x4566('0x26')](function(_0x136451){if(_0x136451){_0x9ae8e1[_0x4566('0x7c')]['unshift']({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x136451['name']+','+(_0x9ae8e1[_0x4566('0x7b')]['waitForTheAssignedAgent']||0xa),'interval':_0x4566('0xb2')});}if(!_0x9ae8e1[_0x4566('0xa9')]['queueId'])return;return db[_0x4566('0xb3')][_0x4566('0x5f')]({'attributes':['id','name'],'where':{'id':_0x9ae8e1[_0x4566('0xa9')][_0x4566('0xb4')]}});})[_0x4566('0x26')](function(_0x4bcff7){if(_0x4bcff7){_0x9ae8e1[_0x4566('0x7c')][_0x4566('0xb5')]({'id':0x0,'priority':0x1,'app':_0x4566('0xb6'),'appdata':_0x4bcff7['name']+','+(_0x9ae8e1['account']['waitForTheAssignedQueue']||0x12c),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x4566('0xb7'),'startRouting',_0x9ae8e1);})['then'](function(_0x27bedd){if(_0x27bedd){var _0x52e601=0xc8;var _0x1905d4=_0x4566('0xb8');logger[_0x4566('0x27')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x1905d4,_0x52e601,_0x4566('0xb9'));logger['debug'](_0x4566('0xba'),_0x1905d4,_0x52e601,_0x4566('0xb9'),JSON[_0x4566('0x2a')](_0x27bedd));if(_0x9ae8e1[_0x4566('0x7b')][_0x4566('0x4a')]===_0x4566('0x89')){return _0x5e558e['status'](_0x52e601)[_0x4566('0x37')](_0x4566('0xbb'),_0x4566('0xbc'))[_0x4566('0x43')]('\x0a');}else{return _0x5e558e[_0x4566('0x30')](_0x52e601)[_0x4566('0x32')](_0x27bedd);}}})[_0x4566('0x2f')](handleError(_0x5e558e,null));};exports['addApplications']=function(_0x192e8a,_0x233f47){var _0x20b0f2=_0x192e8a[_0x4566('0x5d')]['id'];var _0x1f50be=_0x192e8a[_0x4566('0x61')];var _0x4b9dca=0xc8;var _0x21f96c=null;return db['sequelize'][_0x4566('0xbd')]({'isolationLevel':db[_0x4566('0xbe')]['Transaction'][_0x4566('0xbf')][_0x4566('0xc0')]},function(_0x2d36ea){return db[_0x4566('0x47')][_0x4566('0x6e')]({'where':{'id':_0x20b0f2},'transaction':_0x2d36ea})['then'](function(_0x3a3e1d){if(_0x3a3e1d){return db['SmsApplication'][_0x4566('0x3d')]({'where':{'SmsAccountId':_0x20b0f2},'transaction':_0x2d36ea})['then'](function(){var _0x59fb85=_[_0x4566('0x46')](_0x1f50be,function(_0x15c95c){_0x15c95c[_0x4566('0x6b')]=_0x20b0f2;return _0x15c95c;});return db[_0x4566('0x79')][_0x4566('0xc1')](_0x59fb85,{'transaction':_0x2d36ea});});}else{_0x4b9dca=0x194;_0x21f96c=[];}});})[_0x4566('0x26')](function(){if(_0x4b9dca!==0x194){return db['SmsApplication']['findAndCountAll']({'where':{'SmsAccountId':_0x20b0f2},'order':_0x4566('0x7e')})[_0x4566('0x26')](function(_0xd25cff){_0x21f96c=_0xd25cff;});}})[_0x4566('0x2f')](function(_0x5aaae9){_0x4b9dca=0x1f4;logger[_0x4566('0x2b')](_0x5aaae9[_0x4566('0x41')]);if(_0x5aaae9[_0x4566('0x42')]){delete _0x5aaae9[_0x4566('0x42')];}_0x21f96c=_0x5aaae9;})[_0x4566('0xc2')](function(){if(_0x21f96c===null){_0x233f47[_0x4566('0x40')](_0x4b9dca);}else{if(_0x4b9dca===0x1f4){_0x233f47[_0x4566('0x30')](_0x4b9dca)['send'](_0x21f96c);}else{_0x233f47[_0x4566('0x30')](_0x4b9dca)[_0x4566('0x32')](_0x21f96c);}}});};exports[_0x4566('0xc3')]=function(_0x280882,_0x5bedbd,_0x2364f7){var _0x1d0f75={};var _0x4b36f4={};var _0x510f36;var _0x310fce;return db[_0x4566('0x47')][_0x4566('0x6e')]({'where':{'id':_0x280882[_0x4566('0x5d')]['id']}})[_0x4566('0x26')](handleEntityNotFound(_0x5bedbd,null))[_0x4566('0x26')](function(_0x17de7e){if(_0x17de7e){_0x510f36=_0x17de7e;_0x4b36f4[_0x4566('0x4c')]=_['keys'](db['SmsApplication'][_0x4566('0x48')]);_0x4b36f4[_0x4566('0x4d')]=_['keys'](_0x280882[_0x4566('0x4d')]);_0x4b36f4[_0x4566('0x55')]=_[_0x4566('0x4e')](_0x4b36f4[_0x4566('0x4c')],_0x4b36f4[_0x4566('0x4d')]);_0x1d0f75[_0x4566('0x50')]=_[_0x4566('0x4e')](_0x4b36f4['model'],qs[_0x4566('0x4f')](_0x280882[_0x4566('0x4d')][_0x4566('0x4f')]));_0x1d0f75[_0x4566('0x50')]=_0x1d0f75[_0x4566('0x50')][_0x4566('0x51')]?_0x1d0f75['attributes']:_0x4b36f4['model'];_0x1d0f75[_0x4566('0x52')]=qs['sort'](_0x280882[_0x4566('0x4d')][_0x4566('0x53')]);_0x1d0f75[_0x4566('0x54')]=qs[_0x4566('0x55')](_[_0x4566('0x56')](_0x280882[_0x4566('0x4d')],_0x4b36f4[_0x4566('0x55')]));if(_0x280882['query'][_0x4566('0x57')]){_0x1d0f75[_0x4566('0x54')]=_[_0x4566('0x58')](_0x1d0f75[_0x4566('0x54')],{'$or':_[_0x4566('0x46')](_0x1d0f75[_0x4566('0x50')],function(_0xc74ba4){var _0x2e39bf={};_0x2e39bf[_0xc74ba4]={'$like':'%'+_0x280882[_0x4566('0x4d')][_0x4566('0x57')]+'%'};return _0x2e39bf;})});}_0x1d0f75=_[_0x4566('0x58')]({},_0x1d0f75,_0x280882[_0x4566('0x59')]);return _0x510f36[_0x4566('0xc3')](_0x1d0f75);}})[_0x4566('0x26')](function(_0x5cb790){if(_0x5cb790){_0x310fce=_0x5cb790[_0x4566('0x51')];if(!_0x280882[_0x4566('0x4d')][_0x4566('0x6f')](_0x4566('0xc4'))){_0x1d0f75[_0x4566('0x36')]=qs['limit'](_0x280882[_0x4566('0x4d')]['limit']);_0x1d0f75['offset']=qs[_0x4566('0x35')](_0x280882[_0x4566('0x4d')][_0x4566('0x35')]);}return _0x510f36[_0x4566('0xc3')](_0x1d0f75);}})[_0x4566('0x26')](function(_0x35d8b6){if(_0x35d8b6){return _0x35d8b6?{'count':_0x310fce,'rows':_0x35d8b6}:null;}})['then'](respondWithResult(_0x5bedbd,null))[_0x4566('0x2f')](handleError(_0x5bedbd,null));};exports[_0x4566('0xc5')]=function(_0x5624e4,_0x5bf9b9,_0x5ee369){var _0x2c2f0b={'raw':![],'where':{}};var _0x5030d8={};var _0x1f2bf1={'count':0x0,'rows':[]};return db[_0x4566('0x47')][_0x4566('0x6e')]({'where':{'id':_0x5624e4[_0x4566('0x5d')]['id']}})[_0x4566('0x26')](handleEntityNotFound(_0x5bf9b9,null))[_0x4566('0x26')](function(_0x5c1ca7){if(_0x5c1ca7){_0x5030d8[_0x4566('0x4c')]=_[_0x4566('0x5e')](db[_0x4566('0xa7')][_0x4566('0x48')]);_0x5030d8[_0x4566('0x4d')]=_[_0x4566('0x5e')](_0x5624e4[_0x4566('0x4d')]);_0x5030d8[_0x4566('0x55')]=_[_0x4566('0x4e')](_0x5030d8[_0x4566('0x4c')],_0x5030d8['query']);_0x2c2f0b[_0x4566('0x50')]=_[_0x4566('0x4e')](_0x5030d8[_0x4566('0x4c')],qs[_0x4566('0x4f')](_0x5624e4[_0x4566('0x4d')][_0x4566('0x4f')]));_0x2c2f0b['attributes']=_0x2c2f0b[_0x4566('0x50')][_0x4566('0x51')]?_0x2c2f0b[_0x4566('0x50')]:_0x5030d8[_0x4566('0x4c')];if(!_0x5624e4[_0x4566('0x4d')][_0x4566('0x6f')](_0x4566('0xc4'))){_0x2c2f0b[_0x4566('0x36')]=qs[_0x4566('0x36')](_0x5624e4[_0x4566('0x4d')][_0x4566('0x36')]);_0x2c2f0b['offset']=qs[_0x4566('0x35')](_0x5624e4[_0x4566('0x4d')][_0x4566('0x35')]);}_0x2c2f0b[_0x4566('0x52')]=qs[_0x4566('0x53')](_0x5624e4[_0x4566('0x4d')][_0x4566('0x53')]);_0x2c2f0b['where']=qs['filters'](_[_0x4566('0x56')](_0x5624e4[_0x4566('0x4d')],_0x5030d8[_0x4566('0x55')]));_0x2c2f0b[_0x4566('0x54')][_0x4566('0x6b')]=_0x5c1ca7['id'];if(_0x5624e4[_0x4566('0x4d')][_0x4566('0x57')]){_0x2c2f0b['where']=_[_0x4566('0x58')](_0x2c2f0b[_0x4566('0x54')],{'$or':_[_0x4566('0x46')](_0x2c2f0b['attributes'],function(_0x353b93){var _0x2e3ada={};_0x2e3ada[_0x353b93]={'$like':'%'+_0x5624e4['query']['filter']+'%'};return _0x2e3ada;})});}_0x2c2f0b=_[_0x4566('0x58')]({},_0x2c2f0b,_0x5624e4[_0x4566('0x59')]);return db[_0x4566('0xa7')]['count']({'where':_0x2c2f0b['where']})[_0x4566('0x26')](function(_0x2ada38){_0x1f2bf1[_0x4566('0x34')]=_0x2ada38;if(_0x5624e4[_0x4566('0x4d')][_0x4566('0x5a')]){_0x2c2f0b[_0x4566('0x70')]=[{'model':db['CmContact'],'as':_0x4566('0xc6'),'required':![]},{'model':db[_0x4566('0xb1')],'as':_0x4566('0xc7'),'attributes':[_0x4566('0x42'),_0x4566('0xc8'),_0x4566('0xc9')],'required':![]},{'model':db[_0x4566('0xca')],'as':_0x4566('0xcb'),'attributes':['id',_0x4566('0x42'),_0x4566('0xcc')],'where':_0x5624e4[_0x4566('0x4d')]['tag']?{'id':_0x5624e4[_0x4566('0x4d')][_0x4566('0xcd')]}:undefined,'required':_0x5624e4[_0x4566('0x4d')][_0x4566('0xcd')]?!![]:![]}];}return db[_0x4566('0xa7')][_0x4566('0x5b')](_0x2c2f0b);})[_0x4566('0x26')](function(_0x45f983){_0x1f2bf1[_0x4566('0xce')]=_0x45f983;return _0x1f2bf1;});}})['then'](respondWithFilteredResult(_0x5bf9b9,_0x2c2f0b))[_0x4566('0x2f')](handleError(_0x5bf9b9,null));};exports[_0x4566('0x43')]=function(_0x535112,_0x1f8018,_0xffdcc){var _0x24f876,_0x2cb483,_0x439c76;if(_[_0x4566('0x9c')](_0x535112['body'][_0x4566('0x61')])||_0x535112[_0x4566('0x61')]['body']===''){throw new db[(_0x4566('0x81'))][(_0x4566('0x82'))](_0x4566('0x9e'));}if(_[_0x4566('0x9c')](_0x535112['body']['to'])){throw new db['Sequelize'][(_0x4566('0x82'))](_0x4566('0xcf'));}_0x24f876=_0x535112['body']['to'];return db[_0x4566('0x47')]['find']({'where':{'id':_0x535112[_0x4566('0x5d')]['id']},'include':[{'model':db[_0x4566('0xd0')],'as':'List','include':[{'model':db[_0x4566('0x80')],'as':'Contacts','where':{'mobile':_0x24f876},'limit':0x1,'order':[[_0x4566('0x85'),_0x4566('0xa2')]]}]}]})[_0x4566('0x26')](handleEntityNotFound(_0x1f8018,null))['then'](function(_0x14a70b){if(_0x14a70b&&_0x14a70b[_0x4566('0xd1')]){_0x2cb483=_0x14a70b[_0x4566('0x3e')]({'plain':!![]});if(_0x2cb483['List']&&_0x2cb483['List'][_0x4566('0xa5')]['length']){return _0x2cb483[_0x4566('0xd1')]['Contacts'][0x0];}return db['CmContact'][_0x4566('0x60')](_[_0x4566('0x1e')](_0x535112[_0x4566('0x61')],{'firstName':_0x24f876,'mobile':_0x24f876,'phone':_0x24f876,'ListId':_0x2cb483[_0x4566('0x87')]}));}})[_0x4566('0x26')](handleEntityNotFound(_0x1f8018,null))[_0x4566('0x26')](function(_0x5840f8){if(_0x5840f8){_0x439c76=_0x5840f8;return db[_0x4566('0xa7')][_0x4566('0x5f')]({'where':{'ContactId':_0x439c76['id'],'closed':![],'SmsAccountId':_0x2cb483['id']}})[_0x4566('0x26')](function(_0x2e7259){if(_0x2e7259){return[_0x2e7259,![]];}return db['SmsInteraction']['create']({'UserId':_0x535112['user']['id'],'ContactId':_0x439c76['id'],'SmsAccountId':_0x2cb483['id'],'phone':_0x24f876,'firstMsgDirection':_0x4566('0xd2'),'Messages':[_[_0x4566('0x58')](_0x535112[_0x4566('0x61')],{'read':![],'body':_0x535112[_0x4566('0x61')][_0x4566('0x61')],'phone':_0x24f876,'SmsAccountId':_0x2cb483['id'],'UserId':_0x535112[_0x4566('0x62')]['id'],'ContactId':_0x439c76['id']})]},{'include':[{'model':db['SmsMessage'],'as':'Messages'}]})[_0x4566('0x26')](function(_0x36e2d0){return[_0x36e2d0,!![]];});});}})[_0x4566('0xa8')](function(_0x3ca256,_0x1de59a){if(_0x1de59a){return _0x3ca256;}return db[_0x4566('0xd3')]['create'](_[_0x4566('0x58')](_0x535112[_0x4566('0x61')],{'read':![],'body':_0x535112[_0x4566('0x61')][_0x4566('0x61')],'phone':_0x24f876,'SmsAccountId':_0x2cb483['id'],'SmsInteractionId':_0x3ca256['id'],'UserId':_0x535112[_0x4566('0x62')]['id'],'ContactId':_0x439c76['id']}))[_0x4566('0x26')](function(_0x37bd9c){_0x3ca256[_0x4566('0xd4')][_0x4566('0xd5')]=[];_0x3ca256['dataValues'][_0x4566('0xd5')]['push'](_0x37bd9c[_0x4566('0xd4')]);return _0x3ca256;});})[_0x4566('0x26')](respondWithResult(_0x1f8018,null))[_0x4566('0x2f')](handleError(_0x1f8018,null));};exports[_0x4566('0x30')]=function(_0x3614fe,_0x5acf63,_0xf4ca85){if(_0x3614fe['body']['id']){delete _0x3614fe[_0x4566('0x61')]['id'];}var _0x4e0d9c,_0x14f36f,_0x265328;return db[_0x4566('0x47')]['find']({'where':{'id':_0x3614fe[_0x4566('0x5d')]['id']}})['then'](handleEntityNotFound(_0x5acf63,null))['then'](function(_0x4185c5){if(_0x4185c5){_0x265328=_0x4185c5;logger['debug'](_0x4566('0x29'),_0x4566('0x30'),_0x4566('0xd6'),_0x4185c5[_0x4566('0x4a')],util[_0x4566('0xd7')](_0x3614fe[_0x4566('0x61')],{'showHidden':![],'depth':null}));switch(_0x4185c5[_0x4566('0x4a')]){case _0x4566('0x8c'):if(_0x3614fe['body'][_0x4566('0xd8')]&&_0x3614fe[_0x4566('0x61')]['status']){_0x14f36f=_0x3614fe[_0x4566('0x61')]['status'];return db['SmsMessage']['find']({'where':{'messageId':_0x3614fe[_0x4566('0x61')][_0x4566('0xd8')]}});}break;case _0x4566('0x8e'):if(_0x3614fe[_0x4566('0x61')]['requestid']&&_0x3614fe[_0x4566('0x61')][_0x4566('0xd9')]){_0x14f36f=_0x3614fe[_0x4566('0x61')][_0x4566('0xd9')];return db[_0x4566('0xd3')][_0x4566('0x5f')]({'where':{'messageId':_0x3614fe[_0x4566('0x61')][_0x4566('0xda')]}});}break;case _0x4566('0x8f'):if(_0x3614fe[_0x4566('0x61')][_0x4566('0x90')]&&_0x3614fe[_0x4566('0x61')][_0x4566('0xdb')]){_0x14f36f=_0x3614fe[_0x4566('0x61')][_0x4566('0xdb')];return db[_0x4566('0xd3')][_0x4566('0x5f')]({'where':{'messageId':_0x3614fe[_0x4566('0x61')]['message_id']}});}break;case'infobip':var _0x21ed97=_0x3614fe[_0x4566('0x61')][_0x4566('0x94')][0x0];if(_0x21ed97[_0x4566('0x8b')]&&_0x21ed97['status'][_0x4566('0xdc')]===_0x4566('0xdd')){_0x14f36f=_0x21ed97[_0x4566('0x30')][_0x4566('0xdc')];return db[_0x4566('0xd3')][_0x4566('0x5f')]({'where':{'messageId':_0x21ed97[_0x4566('0x8b')]}});}break;case _0x4566('0x98'):if(_0x3614fe[_0x4566('0x61')][_0x4566('0x8b')]&&_0x3614fe['body'][_0x4566('0x30')]){_0x14f36f=_0x3614fe['body'][_0x4566('0x30')];return db[_0x4566('0xd3')]['find']({'where':{'messageId':_0x3614fe[_0x4566('0x61')]['messageId']}});}break;case _0x4566('0x9a'):if(_0x3614fe[_0x4566('0x61')][0x0][_0x4566('0x2d')]['id']){_0x14f36f=_0x3614fe[_0x4566('0x61')][0x0][_0x4566('0x4a')];return db[_0x4566('0xd3')][_0x4566('0x5f')]({'where':{'messageId':_0x3614fe[_0x4566('0x61')][0x0][_0x4566('0x2d')]['id']}});}break;case _0x4566('0xde'):if(_0x3614fe[_0x4566('0x61')][_0x4566('0xdf')]&&_0x3614fe[_0x4566('0x61')][_0x4566('0x30')]){_0x14f36f=_0x3614fe['body'][_0x4566('0x30')];return db[_0x4566('0xd3')][_0x4566('0x5f')]({'where':{'messageId':_0x3614fe['body'][_0x4566('0xdf')]}});}break;}}})[_0x4566('0x26')](handleEntityNotFound(_0x5acf63,null))[_0x4566('0x26')](function(_0x8817cf){if(_0x8817cf){_0x4e0d9c=_0x8817cf;switch(_0x265328[_0x4566('0x4a')]){case _0x4566('0x8c'):if(_0x14f36f===_0x4566('0xdd')){return _0x4e0d9c[_0x4566('0x3c')]({'read':!![]});}else{logger['error'](_0x4566('0x29'),_0x4566('0x30'),_0x4566('0x8c'),util['inspect'](_0x3614fe[_0x4566('0x61')],{'showHidden':![],'depth':null}));}break;case _0x4566('0x8e'):if(_0x14f36f==='1'){return _0x4e0d9c['update']({'read':!![]});}else{logger[_0x4566('0x2b')](_0x4566('0x29'),_0x4566('0x30'),'skebby',util[_0x4566('0xd7')](_0x3614fe[_0x4566('0x61')],{'showHidden':![],'depth':null}));}break;case _0x4566('0x8f'):if(!_0x3614fe['body'][_0x4566('0xe0')]&&_0x14f36f>=0xc8&&_0x14f36f<=0xce){return _0x4e0d9c[_0x4566('0x3c')]({'read':!![]});}else{logger['error'](_0x4566('0x29'),_0x4566('0x30'),_0x4566('0x8f'),util[_0x4566('0xd7')](_0x3614fe[_0x4566('0x61')],{'showHidden':![],'depth':null}));}break;case'infobip':var _0x1cea1f=_0x3614fe[_0x4566('0x61')][_0x4566('0x94')][0x0];if(_0x1cea1f[_0x4566('0x30')][_0x4566('0xdc')]==='DELIVERED'){return _0x4e0d9c[_0x4566('0x3c')]({'read':!![]});}else{logger[_0x4566('0x2b')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x4566('0x30'),_0x4566('0x93'),util['inspect'](_0x3614fe[_0x4566('0x61')],{'showHidden':![],'depth':null}));}break;case _0x4566('0x98'):if(_0x14f36f==_0x4566('0xe1')||_0x14f36f==_0x4566('0xe2')){return _0x4e0d9c[_0x4566('0x3c')]({'read':!![]});}else{logger[_0x4566('0x2b')](_0x4566('0x29'),'status',_0x4566('0x98'),util['inspect'](_0x3614fe[_0x4566('0x61')],{'showHidden':![],'depth':null}));}break;case _0x4566('0x9a'):if(_0x14f36f==_0x4566('0xe3')){return _0x4e0d9c['update']({'read':!![]});}else{logger[_0x4566('0x2b')](_0x4566('0x29'),_0x4566('0x30'),'bandwidth',util[_0x4566('0xd7')](_0x3614fe[_0x4566('0x61')],{'showHidden':![],'depth':null}));}break;case _0x4566('0xde'):if(_0x14f36f===_0x4566('0xe4')||_0x14f36f===_0x4566('0xe5')){return _0x4e0d9c['update']({'read':!![]});}else{logger[_0x4566('0x2b')](_0x4566('0x29'),_0x4566('0x30'),_0x4566('0xde'),util[_0x4566('0xd7')](_0x3614fe[_0x4566('0x61')],{'showHidden':![],'depth':null}));}break;}return _0x4e0d9c;}})[_0x4566('0x26')](respondWithResult(_0x5acf63,null))[_0x4566('0x2f')](handleError(_0x5acf63,null));};exports['statusGet']=function(_0x342a13,_0x205371,_0x217cd3){var _0x4575ad,_0x6a40c2,_0xc5d993;return db[_0x4566('0x47')]['find']({'where':{'id':_0x342a13[_0x4566('0x5d')]['id']}})['then'](handleEntityNotFound(_0x205371,null))[_0x4566('0x26')](function(_0x12d1c5){if(_0x12d1c5){_0xc5d993=_0x12d1c5;logger[_0x4566('0xe6')](_0x4566('0x29'),_0x4566('0x30'),_0x4566('0xd6'),_0x12d1c5[_0x4566('0x4a')],util[_0x4566('0xd7')](_0x342a13[_0x4566('0x4d')],{'showHidden':![],'depth':null}));switch(_0x12d1c5[_0x4566('0x4a')]){case _0x4566('0x96'):if(_0x342a13[_0x4566('0x4d')][_0x4566('0xe7')]&&_0x342a13[_0x4566('0x4d')][_0x4566('0xe8')]){_0x6a40c2=_0x342a13[_0x4566('0x4d')][_0x4566('0xe8')];return db[_0x4566('0xd3')][_0x4566('0x5f')]({'where':{'messageId':_0x342a13['query'][_0x4566('0xe7')]}});}break;}}})[_0x4566('0x26')](handleEntityNotFound(_0x205371,null))[_0x4566('0x26')](function(_0x54c496){if(_0x54c496){_0x4575ad=_0x54c496;switch(_0xc5d993[_0x4566('0x4a')]){case'csc':if(_0x6a40c2==='2'||_0x6a40c2==='6'){return _0x4575ad[_0x4566('0x3c')]({'read':!![]});}else{logger['error'](_0x4566('0x29'),'status','csc',util[_0x4566('0xd7')](_0x342a13[_0x4566('0x4d')],{'showHidden':![],'depth':null}));};break;}return _0x4575ad;}})[_0x4566('0x26')](respondWithResult(_0x205371,null))[_0x4566('0x2f')](handleError(_0x205371,null));};exports[_0x4566('0xe9')]=function(_0x29efb2,_0x3203b4,_0x2d49ae){return db['SmsAccount'][_0x4566('0x5f')]({'where':{'id':_0x29efb2[_0x4566('0x5d')]['id']}})['then'](handleEntityNotFound(_0x3203b4,null))[_0x4566('0x26')](function(_0x249a2c){if(_0x249a2c){return _0x249a2c['addAgents'](_0x29efb2[_0x4566('0x61')][_0x4566('0x72')],_[_0x4566('0xa4')](_0x29efb2[_0x4566('0x61')],['ids','id'])||{})['spread'](function(_0x417fb9){for(var _0x413cec=0x0;_0x413cec<_0x29efb2[_0x4566('0x61')][_0x4566('0x72')][_0x4566('0x51')];_0x413cec+=0x1){socket[_0x4566('0xea')]('userSmsAccount:save',{'UserId':Number(_0x29efb2[_0x4566('0x61')][_0x4566('0x72')][_0x413cec]),'SmsAccountId':Number(_0x29efb2[_0x4566('0x5d')]['id'])});}return _0x417fb9;});}})['then'](respondWithResult(_0x3203b4,null))[_0x4566('0x2f')](handleError(_0x3203b4,null));};exports['removeAgents']=function(_0x323b6e,_0x26260f,_0x51a258){return db[_0x4566('0x47')]['find']({'where':{'id':_0x323b6e[_0x4566('0x5d')]['id']}})[_0x4566('0x26')](handleEntityNotFound(_0x26260f,null))[_0x4566('0x26')](function(_0x17d375){if(_0x17d375){return _0x17d375[_0x4566('0xeb')](_0x323b6e[_0x4566('0x4d')][_0x4566('0x72')])[_0x4566('0x26')](function(){if(_[_0x4566('0xec')](_0x323b6e['query'][_0x4566('0x72')])){for(var _0x5ba176=0x0;_0x5ba176<_0x323b6e[_0x4566('0x4d')][_0x4566('0x72')][_0x4566('0x51')];_0x5ba176+=0x1){socket[_0x4566('0xea')]('userSmsAccount:remove',{'UserId':Number(_0x323b6e[_0x4566('0x4d')][_0x4566('0x72')][_0x5ba176]),'SmsAccountId':Number(_0x323b6e[_0x4566('0x5d')]['id'])});}}else{socket[_0x4566('0xea')](_0x4566('0xed'),{'UserId':Number(_0x323b6e[_0x4566('0x4d')]['ids']),'SmsAccountId':Number(_0x323b6e[_0x4566('0x5d')]['id'])});}});}})['then'](respondWithStatusCode(_0x26260f,null))[_0x4566('0x2f')](handleError(_0x26260f,null));};exports['getAgents']=function(_0xbe2599,_0x2b306c,_0x6d4faf){var _0x4131f2={};var _0x54ab06={};var _0x452d8b;var _0x2bdd08;return db[_0x4566('0x47')][_0x4566('0x6e')]({'where':{'id':_0xbe2599[_0x4566('0x5d')]['id']}})['then'](handleEntityNotFound(_0x2b306c,null))[_0x4566('0x26')](function(_0x414552){if(_0x414552){_0x452d8b=_0x414552;_0x54ab06[_0x4566('0x4c')]=_[_0x4566('0x5e')](db[_0x4566('0xb1')]['rawAttributes']);_0x54ab06['query']=_['keys'](_0xbe2599[_0x4566('0x4d')]);_0x54ab06['filters']=_[_0x4566('0x4e')](_0x54ab06[_0x4566('0x4c')],_0x54ab06[_0x4566('0x4d')]);_0x4131f2[_0x4566('0x50')]=_[_0x4566('0x4e')](_0x54ab06['model'],qs['fields'](_0xbe2599[_0x4566('0x4d')][_0x4566('0x4f')]));_0x4131f2[_0x4566('0x50')]=_0x4131f2[_0x4566('0x50')]['length']?_0x4131f2['attributes']:_0x54ab06[_0x4566('0x4c')];_0x4131f2[_0x4566('0x52')]=qs['sort'](_0xbe2599[_0x4566('0x4d')][_0x4566('0x53')]);_0x4131f2[_0x4566('0x54')]=qs['filters'](_['pick'](_0xbe2599[_0x4566('0x4d')],_0x54ab06[_0x4566('0x55')]));if(_0xbe2599['query'][_0x4566('0x57')]){_0x4131f2['where']=_['merge'](_0x4131f2[_0x4566('0x54')],{'$or':_[_0x4566('0x46')](_0x4131f2[_0x4566('0x50')],function(_0x35c5ee){var _0x4561a4={};_0x4561a4[_0x35c5ee]={'$like':'%'+_0xbe2599[_0x4566('0x4d')][_0x4566('0x57')]+'%'};return _0x4561a4;})});}_0x4131f2=_['merge']({},_0x4131f2,_0xbe2599[_0x4566('0x59')]);return _0x452d8b[_0x4566('0xee')](_0x4131f2);}})['then'](function(_0x4ebacc){if(_0x4ebacc){_0x2bdd08=_0x4ebacc[_0x4566('0x51')];if(!_0xbe2599[_0x4566('0x4d')][_0x4566('0x6f')](_0x4566('0xc4'))){_0x4131f2[_0x4566('0x36')]=qs[_0x4566('0x36')](_0xbe2599[_0x4566('0x4d')][_0x4566('0x36')]);_0x4131f2['offset']=qs[_0x4566('0x35')](_0xbe2599[_0x4566('0x4d')]['offset']);}return _0x452d8b['getAgents'](_0x4131f2);}})[_0x4566('0x26')](function(_0x40019a){if(_0x40019a){return _0x40019a?{'count':_0x2bdd08,'rows':_0x40019a}:null;}})[_0x4566('0x26')](respondWithResult(_0x2b306c,null))[_0x4566('0x2f')](handleError(_0x2b306c,null));}; \ No newline at end of file +var _0x0b81=['find','autoAssociation','describe','addDisposition','SmsAccountId','Disposition','pick','ids','getAnswers','findOne','CannedAnswer','removeAnswers','notify','sms','SmsApplication','account','applications','Applications','asc','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','twilio','from','From','MessageSid','skebby','sender','text','connectel','clicksend','messageId','message_id','plivo','results','csc','segmentedMessage','fromNumber','replyMessageId','intelepeer','refid','from\x20is\x20mandatory','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','DESC','list','omit','contact','SmsInteraction','spread','interaction','autoclose','close','unmanaged','*,*,*,*','ContactId','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','queueId','SmsQueue','queue','waitForTheAssignedQueue','Start','entity\x20found','Content-Type','text/xml','\x0a','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','findAndCountAll','priority','getApplications','Contact','Owner','fullname','internal','color','tag','body\x20is\x20mandatory\x20and\x20not\x20empty','isNil','to\x20is\x20mandatory','List','SmsMessage','Messages','dataValues','push','received\x20delivery\x20report\x20from','inspect','skebby_dispatch_id','requestid','statusInt','status_code','groupName','DELIVERED','clickatell','redif','error_code','infobip','message-delivered','bandwidth','DELIVRD','ACCEPTD','statusGet','message-id','state','addAgents','emit','userSmsAccount:save','removeAgents','isArray','userSmsAccount:remove','getAgents','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./smsAccount.socket','register','jayson/promise','client','http','then','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','sendStatus','status','offset','undefined','count','limit','set','Content-Range','json','apply','reject','save','update','destroy','get','SmsAccounts','UserProfileResource','end','stack','name','send','index','Pause','mandatoryDispositionPause','map','SmsAccount','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','options','includeAll','findAll','rows','params','include','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection'];(function(_0x9cd4c3,_0x1c9b2c){var _0x4c9025=function(_0x25b3c6){while(--_0x25b3c6){_0x9cd4c3['push'](_0x9cd4c3['shift']());}};_0x4c9025(++_0x1c9b2c);}(_0x0b81,0x166));var _0x10b8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0b81[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x10b8('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x10b8('0x1'));var jsonpatch=require(_0x10b8('0x2'));var rp=require(_0x10b8('0x3'));var moment=require(_0x10b8('0x4'));var BPromise=require(_0x10b8('0x5'));var Mustache=require(_0x10b8('0x6'));var util=require('util');var path=require(_0x10b8('0x7'));var sox=require(_0x10b8('0x8'));var csv=require(_0x10b8('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x10b8('0xa'));var _=require(_0x10b8('0xb'));var squel=require(_0x10b8('0xc'));var crypto=require(_0x10b8('0xd'));var jsforce=require(_0x10b8('0xe'));var deskjs=require(_0x10b8('0xf'));var toCsv=require(_0x10b8('0x9'));var querystring=require(_0x10b8('0x10'));var Papa=require('papaparse');var Redis=require(_0x10b8('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x10b8('0x12'));var hardwareService=require(_0x10b8('0x13'));var logger=require('../../config/logger')(_0x10b8('0x14'));var utils=require('../../config/utils');var config=require(_0x10b8('0x15'));var licenseUtil=require(_0x10b8('0x16'));var db=require('../../mysqldb')['db'];config[_0x10b8('0x17')]=_[_0x10b8('0x18')](config[_0x10b8('0x17')],{'host':_0x10b8('0x19'),'port':0x18eb});var socket=require(_0x10b8('0x1a'))(new Redis(config[_0x10b8('0x17')]));require(_0x10b8('0x1b'))[_0x10b8('0x1c')](socket);var jayson=require(_0x10b8('0x1d'));var client=jayson[_0x10b8('0x1e')][_0x10b8('0x1f')]({'port':0x232c});function respondWithRpcPromise(_0x7af8c2,_0x3edbd8,_0x17524a,_0xe27e8b){return new BPromise(function(_0x24d083,_0x20db2c){var _0x17bea4=_0xe27e8b||client;return _0x17bea4['request'](_0x7af8c2,_0x17524a)[_0x10b8('0x20')](function(_0x76323b){logger['info'](_0x10b8('0x21'),_0x3edbd8,_0x10b8('0x22'));logger[_0x10b8('0x23')](_0x10b8('0x24'),_0x3edbd8,_0x10b8('0x22'),JSON[_0x10b8('0x25')](_0x76323b));if(_0x76323b['error']){if(_0x76323b[_0x10b8('0x26')]['code']===0x1f4){logger[_0x10b8('0x26')](_0x10b8('0x21'),_0x3edbd8,_0x76323b[_0x10b8('0x26')][_0x10b8('0x27')]);return _0x20db2c(_0x76323b[_0x10b8('0x26')][_0x10b8('0x27')]);}logger[_0x10b8('0x26')](_0x10b8('0x21'),_0x3edbd8,_0x76323b[_0x10b8('0x26')][_0x10b8('0x27')]);return _0x24d083(_0x76323b[_0x10b8('0x26')][_0x10b8('0x27')]);}else{logger[_0x10b8('0x28')]('SmsAccount,\x20%s,\x20%s',_0x3edbd8,_0x10b8('0x22'));_0x24d083(_0x76323b[_0x10b8('0x29')][_0x10b8('0x27')]);}})[_0x10b8('0x2a')](function(_0x242d2f){logger[_0x10b8('0x26')](_0x10b8('0x21'),_0x3edbd8,_0x242d2f);_0x20db2c(_0x242d2f);});});}function respondWithStatusCode(_0x14fcaf,_0x371ab7){_0x371ab7=_0x371ab7||0xcc;return function(_0x5b56aa){if(_0x5b56aa){return _0x14fcaf[_0x10b8('0x2b')](_0x371ab7);}return _0x14fcaf[_0x10b8('0x2c')](_0x371ab7)['end']();};}function respondWithResult(_0x54f293,_0x321faa){_0x321faa=_0x321faa||0xc8;return function(_0x1bbdc6){if(_0x1bbdc6){return _0x54f293[_0x10b8('0x2c')](_0x321faa)['json'](_0x1bbdc6);}};}function respondWithFilteredResult(_0x30d14,_0x5dca40){return function(_0x69edec){if(_0x69edec){var _0x46b442=typeof _0x5dca40[_0x10b8('0x2d')]===_0x10b8('0x2e')&&typeof _0x5dca40['limit']==='undefined';var _0x56bff2=_0x69edec['count'];var _0x53826a=_0x46b442?0x0:_0x5dca40['offset'];var _0xb777b5=_0x46b442?_0x69edec[_0x10b8('0x2f')]:_0x5dca40[_0x10b8('0x2d')]+_0x5dca40[_0x10b8('0x30')];var _0x30d7fc;if(_0xb777b5>=_0x56bff2){_0xb777b5=_0x56bff2;_0x30d7fc=0xc8;}else{_0x30d7fc=0xce;}_0x30d14[_0x10b8('0x2c')](_0x30d7fc);return _0x30d14[_0x10b8('0x31')](_0x10b8('0x32'),_0x53826a+'-'+_0xb777b5+'/'+_0x56bff2)[_0x10b8('0x33')](_0x69edec);}return null;};}function patchUpdates(_0x501c7f){return function(_0x25bb83){try{jsonpatch[_0x10b8('0x34')](_0x25bb83,_0x501c7f,!![]);}catch(_0x6ae12c){return BPromise[_0x10b8('0x35')](_0x6ae12c);}return _0x25bb83[_0x10b8('0x36')]();};}function saveUpdates(_0x4a670b,_0x43df24){return function(_0x4efa03){if(_0x4efa03){return _0x4efa03[_0x10b8('0x37')](_0x4a670b)[_0x10b8('0x20')](function(_0x1ba926){return _0x1ba926;});}return null;};}function removeEntity(_0x23b86e,_0x58a3d4){return function(_0x4f80de){if(_0x4f80de){return _0x4f80de[_0x10b8('0x38')]()[_0x10b8('0x20')](function(){var _0x513fd3=_0x4f80de[_0x10b8('0x39')]({'plain':!![]});var _0x3786df=_0x10b8('0x3a');return db[_0x10b8('0x3b')][_0x10b8('0x38')]({'where':{'type':_0x3786df,'resourceId':_0x513fd3['id']}})['then'](function(){return _0x4f80de;});})[_0x10b8('0x20')](function(){_0x23b86e['status'](0xcc)[_0x10b8('0x3c')]();});}};}function handleEntityNotFound(_0x3e21f1,_0x26d2f0){return function(_0x539bc0){if(!_0x539bc0){_0x3e21f1[_0x10b8('0x2b')](0x194);}return _0x539bc0;};}function handleError(_0x5a0023,_0x145320){_0x145320=_0x145320||0x1f4;return function(_0x265b15){logger[_0x10b8('0x26')](_0x265b15[_0x10b8('0x3d')]);if(_0x265b15[_0x10b8('0x3e')]){delete _0x265b15[_0x10b8('0x3e')];}_0x5a0023['status'](_0x145320)[_0x10b8('0x3f')](_0x265b15);};}exports[_0x10b8('0x40')]=function(_0x1d34e6,_0x3f0349){var _0x3c86f5={'include':[{'model':db[_0x10b8('0x41')],'as':_0x10b8('0x42')}]},_0x3f5ea6={},_0x4845fc={'count':0x0,'rows':[]};var _0x2c40ec=_[_0x10b8('0x43')](db[_0x10b8('0x44')][_0x10b8('0x45')],function(_0x3c586f){return{'name':_0x3c586f[_0x10b8('0x46')],'type':_0x3c586f[_0x10b8('0x47')][_0x10b8('0x48')]};});_0x3f5ea6[_0x10b8('0x49')]=_[_0x10b8('0x43')](_0x2c40ec,'name');_0x3f5ea6['query']=_[_0x10b8('0x4a')](_0x1d34e6[_0x10b8('0x4b')]);_0x3f5ea6[_0x10b8('0x4c')]=_[_0x10b8('0x4d')](_0x3f5ea6[_0x10b8('0x49')],_0x3f5ea6[_0x10b8('0x4b')]);_0x3c86f5[_0x10b8('0x4e')]=_[_0x10b8('0x4d')](_0x3f5ea6[_0x10b8('0x49')],qs[_0x10b8('0x4f')](_0x1d34e6[_0x10b8('0x4b')][_0x10b8('0x4f')]));_0x3c86f5[_0x10b8('0x4e')]=_0x3c86f5[_0x10b8('0x4e')][_0x10b8('0x50')]?_0x3c86f5['attributes']:_0x3f5ea6[_0x10b8('0x49')];if(!_0x1d34e6[_0x10b8('0x4b')][_0x10b8('0x51')](_0x10b8('0x52'))){_0x3c86f5[_0x10b8('0x30')]=qs[_0x10b8('0x30')](_0x1d34e6[_0x10b8('0x4b')][_0x10b8('0x30')]);_0x3c86f5[_0x10b8('0x2d')]=qs[_0x10b8('0x2d')](_0x1d34e6['query']['offset']);}_0x3c86f5[_0x10b8('0x53')]=qs[_0x10b8('0x54')](_0x1d34e6[_0x10b8('0x4b')][_0x10b8('0x54')]);_0x3c86f5['where']=qs['filters'](_['pick'](_0x1d34e6[_0x10b8('0x4b')],_0x3f5ea6['filters']),_0x2c40ec);if(_0x1d34e6[_0x10b8('0x4b')][_0x10b8('0x55')]){_0x3c86f5['where']=_['merge'](_0x3c86f5[_0x10b8('0x56')],{'$or':_[_0x10b8('0x43')](_0x2c40ec,function(_0x325903){if(_0x325903[_0x10b8('0x47')]!=='VIRTUAL'){var _0x1e0405={};_0x1e0405[_0x325903[_0x10b8('0x3e')]]={'$like':'%'+_0x1d34e6[_0x10b8('0x4b')][_0x10b8('0x55')]+'%'};return _0x1e0405;}})});}_0x3c86f5=_[_0x10b8('0x57')]({},_0x3c86f5,_0x1d34e6[_0x10b8('0x58')]);var _0x289076={'where':_0x3c86f5[_0x10b8('0x56')]};return db[_0x10b8('0x44')]['count'](_0x289076)[_0x10b8('0x20')](function(_0x3d3eac){_0x4845fc[_0x10b8('0x2f')]=_0x3d3eac;if(_0x1d34e6['query'][_0x10b8('0x59')]){_0x3c86f5['include']=[{'all':!![]}];}return db['SmsAccount'][_0x10b8('0x5a')](_0x3c86f5);})[_0x10b8('0x20')](function(_0x24921b){_0x4845fc[_0x10b8('0x5b')]=_0x24921b;return _0x4845fc;})['then'](respondWithFilteredResult(_0x3f0349,_0x3c86f5))[_0x10b8('0x2a')](handleError(_0x3f0349,null));};exports['show']=function(_0x1ca17e,_0x27e1bd){var _0x5f277a={'raw':![],'where':{'id':_0x1ca17e[_0x10b8('0x5c')]['id']},'include':[{'model':db['Pause'],'as':_0x10b8('0x42')}]},_0x5ad26e={};_0x5ad26e[_0x10b8('0x49')]=_[_0x10b8('0x4a')](db[_0x10b8('0x44')]['rawAttributes']);_0x5ad26e['query']=_['keys'](_0x1ca17e[_0x10b8('0x4b')]);_0x5ad26e[_0x10b8('0x4c')]=_[_0x10b8('0x4d')](_0x5ad26e[_0x10b8('0x49')],_0x5ad26e[_0x10b8('0x4b')]);_0x5f277a[_0x10b8('0x4e')]=_['intersection'](_0x5ad26e[_0x10b8('0x49')],qs[_0x10b8('0x4f')](_0x1ca17e['query'][_0x10b8('0x4f')]));_0x5f277a[_0x10b8('0x4e')]=_0x5f277a[_0x10b8('0x4e')]['length']?_0x5f277a[_0x10b8('0x4e')]:_0x5ad26e[_0x10b8('0x49')];if(_0x1ca17e['query']['includeAll']){_0x5f277a[_0x10b8('0x5d')]=[{'all':!![]}];}_0x5f277a=_[_0x10b8('0x57')]({},_0x5f277a,_0x1ca17e['options']);return db[_0x10b8('0x44')]['find'](_0x5f277a)['then'](handleEntityNotFound(_0x27e1bd,null))[_0x10b8('0x20')](respondWithResult(_0x27e1bd,null))['catch'](handleError(_0x27e1bd,null));};exports[_0x10b8('0x5e')]=function(_0x58ff42,_0x3fe235){return db[_0x10b8('0x44')][_0x10b8('0x5e')](_0x58ff42[_0x10b8('0x5f')],{})['then'](function(_0x4059fc){var _0x12ca77=_0x58ff42[_0x10b8('0x60')][_0x10b8('0x39')]({'plain':!![]});if(!_0x12ca77)throw new Error(_0x10b8('0x61'));if(_0x12ca77[_0x10b8('0x62')]===_0x10b8('0x60')){var _0x261ae9=_0x4059fc[_0x10b8('0x39')]({'plain':!![]});var _0x286e2f=_0x10b8('0x3a');return db[_0x10b8('0x63')][_0x10b8('0x64')]({'where':{'name':_0x286e2f,'userProfileId':_0x12ca77['userProfileId']},'raw':!![]})['then'](function(_0x15c460){if(_0x15c460&&_0x15c460[_0x10b8('0x65')]===0x0){return db[_0x10b8('0x3b')]['create']({'name':_0x261ae9['name'],'resourceId':_0x261ae9['id'],'type':_0x15c460[_0x10b8('0x3e')],'sectionId':_0x15c460['id']},{})[_0x10b8('0x20')](function(){return _0x4059fc;});}else{return _0x4059fc;}})[_0x10b8('0x2a')](function(_0x286446){logger[_0x10b8('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x286446);throw _0x286446;});}return _0x4059fc;})[_0x10b8('0x20')](respondWithResult(_0x3fe235,0xc9))[_0x10b8('0x2a')](handleError(_0x3fe235,null));};exports['update']=function(_0x2d335a,_0x19f62b){if(_0x2d335a[_0x10b8('0x5f')]['id']){delete _0x2d335a[_0x10b8('0x5f')]['id'];}return db['SmsAccount'][_0x10b8('0x64')]({'where':{'id':_0x2d335a[_0x10b8('0x5c')]['id']},'include':[{'model':db['Pause'],'as':_0x10b8('0x42')}]})[_0x10b8('0x20')](handleEntityNotFound(_0x19f62b,null))[_0x10b8('0x20')](saveUpdates(_0x2d335a[_0x10b8('0x5f')],null))[_0x10b8('0x20')](respondWithResult(_0x19f62b,null))[_0x10b8('0x2a')](handleError(_0x19f62b,null));};exports['destroy']=function(_0x142f75,_0x2efc50){return db[_0x10b8('0x44')]['find']({'where':{'id':_0x142f75[_0x10b8('0x5c')]['id']}})[_0x10b8('0x20')](handleEntityNotFound(_0x2efc50,null))['then'](removeEntity(_0x2efc50,null))[_0x10b8('0x2a')](handleError(_0x2efc50,null));};exports['describe']=function(_0x352b8a,_0x411d7e){return db['SmsAccount'][_0x10b8('0x66')]()[_0x10b8('0x20')](respondWithResult(_0x411d7e,null))['catch'](handleError(_0x411d7e,null));};exports[_0x10b8('0x67')]=function(_0x2f9dbc,_0xbe5458,_0x1ad62b){if(_0x2f9dbc['body']['id']){delete _0x2f9dbc[_0x10b8('0x5f')]['id'];}return db[_0x10b8('0x44')][_0x10b8('0x64')]({'where':{'id':_0x2f9dbc[_0x10b8('0x5c')]['id']}})[_0x10b8('0x20')](handleEntityNotFound(_0xbe5458,null))['then'](function(_0x41e4bc){if(_0x41e4bc){_0x2f9dbc[_0x10b8('0x5f')][_0x10b8('0x68')]=_0x41e4bc['id'];return db[_0x10b8('0x69')][_0x10b8('0x5e')](_0x2f9dbc[_0x10b8('0x5f')]);}})[_0x10b8('0x20')](respondWithResult(_0xbe5458,null))[_0x10b8('0x2a')](handleError(_0xbe5458,null));};exports['getDispositions']=function(_0xb7b2dd,_0x481d04,_0x882c91){var _0x145291={'raw':![],'where':{}};var _0xf0eaa0={};var _0x340fd9={'count':0x0,'rows':[]};return db['SmsAccount']['findOne']({'where':{'id':_0xb7b2dd[_0x10b8('0x5c')]['id']}})[_0x10b8('0x20')](handleEntityNotFound(_0x481d04,null))[_0x10b8('0x20')](function(_0x62a4f){if(_0x62a4f){_0xf0eaa0[_0x10b8('0x49')]=_[_0x10b8('0x4a')](db[_0x10b8('0x69')][_0x10b8('0x45')]);_0xf0eaa0[_0x10b8('0x4b')]=_[_0x10b8('0x4a')](_0xb7b2dd[_0x10b8('0x4b')]);_0xf0eaa0['filters']=_['intersection'](_0xf0eaa0['model'],_0xf0eaa0[_0x10b8('0x4b')]);_0x145291[_0x10b8('0x4e')]=_[_0x10b8('0x4d')](_0xf0eaa0[_0x10b8('0x49')],qs[_0x10b8('0x4f')](_0xb7b2dd['query']['fields']));_0x145291[_0x10b8('0x4e')]=_0x145291['attributes'][_0x10b8('0x50')]?_0x145291[_0x10b8('0x4e')]:_0xf0eaa0[_0x10b8('0x49')];if(!_0xb7b2dd[_0x10b8('0x4b')][_0x10b8('0x51')](_0x10b8('0x52'))){_0x145291[_0x10b8('0x30')]=qs[_0x10b8('0x30')](_0xb7b2dd['query'][_0x10b8('0x30')]);_0x145291['offset']=qs[_0x10b8('0x2d')](_0xb7b2dd['query']['offset']);}_0x145291[_0x10b8('0x53')]=qs[_0x10b8('0x54')](_0xb7b2dd[_0x10b8('0x4b')][_0x10b8('0x54')]);_0x145291[_0x10b8('0x56')]=qs[_0x10b8('0x4c')](_[_0x10b8('0x6a')](_0xb7b2dd[_0x10b8('0x4b')],_0xf0eaa0[_0x10b8('0x4c')]));_0x145291['where'][_0x10b8('0x68')]=_0x62a4f['id'];if(_0xb7b2dd['query']['filter']){_0x145291['where']=_[_0x10b8('0x57')](_0x145291[_0x10b8('0x56')],{'$or':_['map'](_0x145291[_0x10b8('0x4e')],function(_0x1d54f4){var _0x14aea1={};_0x14aea1[_0x1d54f4]={'$like':'%'+_0xb7b2dd[_0x10b8('0x4b')][_0x10b8('0x55')]+'%'};return _0x14aea1;})});}_0x145291=_[_0x10b8('0x57')]({},_0x145291,_0xb7b2dd[_0x10b8('0x58')]);return db[_0x10b8('0x69')][_0x10b8('0x2f')]({'where':_0x145291['where']})[_0x10b8('0x20')](function(_0x99ec56){_0x340fd9[_0x10b8('0x2f')]=_0x99ec56;if(_0xb7b2dd[_0x10b8('0x4b')]['includeAll']){_0x145291[_0x10b8('0x5d')]=[{'all':!![]}];}return db[_0x10b8('0x69')][_0x10b8('0x5a')](_0x145291);})[_0x10b8('0x20')](function(_0x2b1769){_0x340fd9[_0x10b8('0x5b')]=_0x2b1769;return _0x340fd9;});}})[_0x10b8('0x20')](respondWithFilteredResult(_0x481d04,_0x145291))[_0x10b8('0x2a')](handleError(_0x481d04,null));};exports['removeDispositions']=function(_0x34c201,_0x382578,_0xe9c06a){return db[_0x10b8('0x44')][_0x10b8('0x64')]({'where':{'id':_0x34c201[_0x10b8('0x5c')]['id']}})['then'](handleEntityNotFound(_0x382578,null))[_0x10b8('0x20')](function(_0x4af548){if(_0x4af548){return _0x4af548['removeDispositions'](_0x34c201[_0x10b8('0x4b')][_0x10b8('0x6b')]);}})['then'](respondWithStatusCode(_0x382578,null))[_0x10b8('0x2a')](handleError(_0x382578,null));};exports['addAnswer']=function(_0x42d25b,_0x2104eb,_0x3cc3af){if(_0x42d25b['body']['id']){delete _0x42d25b[_0x10b8('0x5f')]['id'];}return db[_0x10b8('0x44')][_0x10b8('0x64')]({'where':{'id':_0x42d25b['params']['id']}})[_0x10b8('0x20')](handleEntityNotFound(_0x2104eb,null))[_0x10b8('0x20')](function(_0x54a7e4){if(_0x54a7e4){_0x42d25b[_0x10b8('0x5f')][_0x10b8('0x68')]=_0x54a7e4['id'];return db['CannedAnswer'][_0x10b8('0x5e')](_0x42d25b[_0x10b8('0x5f')]);}})['then'](respondWithResult(_0x2104eb,null))[_0x10b8('0x2a')](handleError(_0x2104eb,null));};exports[_0x10b8('0x6c')]=function(_0x5e46a1,_0x5ecbd8,_0x3145f3){var _0x12c020={'raw':![],'where':{}};var _0x1a0725={};var _0x1e8239={'count':0x0,'rows':[]};return db[_0x10b8('0x44')][_0x10b8('0x6d')]({'where':{'id':_0x5e46a1['params']['id']}})[_0x10b8('0x20')](handleEntityNotFound(_0x5ecbd8,null))[_0x10b8('0x20')](function(_0x56a719){if(_0x56a719){_0x1a0725['model']=_[_0x10b8('0x4a')](db[_0x10b8('0x6e')][_0x10b8('0x45')]);_0x1a0725['query']=_['keys'](_0x5e46a1[_0x10b8('0x4b')]);_0x1a0725[_0x10b8('0x4c')]=_['intersection'](_0x1a0725[_0x10b8('0x49')],_0x1a0725['query']);_0x12c020[_0x10b8('0x4e')]=_[_0x10b8('0x4d')](_0x1a0725[_0x10b8('0x49')],qs['fields'](_0x5e46a1['query'][_0x10b8('0x4f')]));_0x12c020[_0x10b8('0x4e')]=_0x12c020['attributes'][_0x10b8('0x50')]?_0x12c020['attributes']:_0x1a0725[_0x10b8('0x49')];if(!_0x5e46a1[_0x10b8('0x4b')][_0x10b8('0x51')]('nolimit')){_0x12c020[_0x10b8('0x30')]=qs['limit'](_0x5e46a1[_0x10b8('0x4b')][_0x10b8('0x30')]);_0x12c020[_0x10b8('0x2d')]=qs[_0x10b8('0x2d')](_0x5e46a1['query']['offset']);}_0x12c020[_0x10b8('0x53')]=qs[_0x10b8('0x54')](_0x5e46a1['query']['sort']);_0x12c020[_0x10b8('0x56')]=qs[_0x10b8('0x4c')](_[_0x10b8('0x6a')](_0x5e46a1['query'],_0x1a0725[_0x10b8('0x4c')]));_0x12c020[_0x10b8('0x56')][_0x10b8('0x68')]=_0x56a719['id'];if(_0x5e46a1[_0x10b8('0x4b')][_0x10b8('0x55')]){_0x12c020[_0x10b8('0x56')]=_[_0x10b8('0x57')](_0x12c020[_0x10b8('0x56')],{'$or':_['map'](_0x12c020[_0x10b8('0x4e')],function(_0x3b7d0a){var _0x1336e0={};_0x1336e0[_0x3b7d0a]={'$like':'%'+_0x5e46a1['query'][_0x10b8('0x55')]+'%'};return _0x1336e0;})});}_0x12c020=_[_0x10b8('0x57')]({},_0x12c020,_0x5e46a1[_0x10b8('0x58')]);return db[_0x10b8('0x6e')][_0x10b8('0x2f')]({'where':_0x12c020[_0x10b8('0x56')]})[_0x10b8('0x20')](function(_0x540ac8){_0x1e8239[_0x10b8('0x2f')]=_0x540ac8;if(_0x5e46a1['query']['includeAll']){_0x12c020[_0x10b8('0x5d')]=[{'all':!![]}];}return db[_0x10b8('0x6e')]['findAll'](_0x12c020);})[_0x10b8('0x20')](function(_0x25462a){_0x1e8239[_0x10b8('0x5b')]=_0x25462a;return _0x1e8239;});}})[_0x10b8('0x20')](respondWithFilteredResult(_0x5ecbd8,_0x12c020))['catch'](handleError(_0x5ecbd8,null));};exports[_0x10b8('0x6f')]=function(_0x2f8be0,_0x30f6bd,_0x164cff){return db[_0x10b8('0x44')]['find']({'where':{'id':_0x2f8be0[_0x10b8('0x5c')]['id']}})['then'](handleEntityNotFound(_0x30f6bd,null))[_0x10b8('0x20')](function(_0x47d5ad){if(_0x47d5ad){return _0x47d5ad['removeAnswers'](_0x2f8be0[_0x10b8('0x4b')][_0x10b8('0x6b')]);}})[_0x10b8('0x20')](respondWithStatusCode(_0x30f6bd,null))[_0x10b8('0x2a')](handleError(_0x30f6bd,null));};exports[_0x10b8('0x70')]=function(_0x2be967,_0x21437e,_0x56c800){var _0x586221={'channel':_0x10b8('0x71')};var _0x299e38=[];var _0x50400a=[];var _0x2a95bd={};return db[_0x10b8('0x44')]['find']({'where':{'id':_0x2be967[_0x10b8('0x5c')]['id']},'include':[{'model':db[_0x10b8('0x72')],'as':'Applications'}]})[_0x10b8('0x20')](handleEntityNotFound(_0x21437e,null))['then'](function(_0xcdc309){_0x586221[_0x10b8('0x73')]=_0xcdc309;_0x586221[_0x10b8('0x74')]=_['orderBy'](_0xcdc309[_0x10b8('0x75')],['priority'],[_0x10b8('0x76')]);if(_0x586221[_0x10b8('0x73')][_0x10b8('0x75')]){delete _0x586221[_0x10b8('0x73')][_0x10b8('0x75')];}return db[_0x10b8('0x77')][_0x10b8('0x66')]();})[_0x10b8('0x20')](function(_0x1f1996){if(!_0x1f1996){throw new db[(_0x10b8('0x78'))][(_0x10b8('0x79'))](_0x10b8('0x7a'));}_0x299e38=_[_0x10b8('0x7b')](_[_0x10b8('0x4a')](_0x1f1996),[_0x10b8('0x7c'),_0x10b8('0x7d')]);_0x50400a=_['difference'](_[_0x10b8('0x4a')](_0x1f1996),['createdAt',_0x10b8('0x7d'),_0x10b8('0x7e'),_0x10b8('0x7f')]);_0x586221[_0x10b8('0x5f')]={'mapKey':'mobile'};if(_0x586221[_0x10b8('0x73')]['type']){switch(_0x586221[_0x10b8('0x73')][_0x10b8('0x47')]){case _0x10b8('0x80'):_0x586221[_0x10b8('0x5f')][_0x10b8('0x81')]=_0x2be967[_0x10b8('0x5f')][_0x10b8('0x82')];_0x586221[_0x10b8('0x5f')][_0x10b8('0x5f')]=_0x2be967[_0x10b8('0x5f')]['Body'];_0x586221[_0x10b8('0x5f')]['messageId']=_0x2be967[_0x10b8('0x5f')][_0x10b8('0x83')];break;case _0x10b8('0x84'):_0x586221[_0x10b8('0x5f')]['from']='+'+_0x2be967[_0x10b8('0x5f')][_0x10b8('0x85')];_0x586221['body'][_0x10b8('0x5f')]=_0x2be967[_0x10b8('0x5f')][_0x10b8('0x86')];break;case _0x10b8('0x87'):_0x586221['body'][_0x10b8('0x81')]=_0x2be967['body'][_0x10b8('0x81')];_0x586221['body'][_0x10b8('0x5f')]=_0x2be967[_0x10b8('0x5f')][_0x10b8('0x27')];break;case _0x10b8('0x88'):_0x586221[_0x10b8('0x5f')][_0x10b8('0x81')]=_0x2be967[_0x10b8('0x5f')][_0x10b8('0x81')];_0x586221['body']['body']=_0x2be967['body'][_0x10b8('0x5f')];_0x586221[_0x10b8('0x5f')][_0x10b8('0x89')]=_0x2be967['body'][_0x10b8('0x8a')];break;case _0x10b8('0x8b'):_0x586221['body'][_0x10b8('0x81')]=_0x2be967[_0x10b8('0x5f')][_0x10b8('0x82')];_0x586221[_0x10b8('0x5f')][_0x10b8('0x5f')]=_0x2be967[_0x10b8('0x5f')]['Text'];_0x586221[_0x10b8('0x5f')][_0x10b8('0x89')]=_0x2be967[_0x10b8('0x5f')]['MessageUUID'];break;case'infobip':_0x586221['body'][_0x10b8('0x81')]='+'+_0x2be967[_0x10b8('0x5f')]['results'][0x0][_0x10b8('0x81')];_0x586221[_0x10b8('0x5f')][_0x10b8('0x5f')]=_0x2be967[_0x10b8('0x5f')]['results'][0x0]['text'];_0x586221[_0x10b8('0x5f')]['messageId']=_0x2be967[_0x10b8('0x5f')][_0x10b8('0x8c')][0x0][_0x10b8('0x89')];break;case _0x10b8('0x8d'):_0x586221[_0x10b8('0x5f')][_0x10b8('0x81')]=_0x2be967['body']['originatingAddress'];_0x586221['body'][_0x10b8('0x5f')]=_0x2be967[_0x10b8('0x5f')][_0x10b8('0x8e')][_0x10b8('0x27')];break;case'clickatell':_0x586221[_0x10b8('0x5f')][_0x10b8('0x81')]=_0x2be967[_0x10b8('0x5f')][_0x10b8('0x8f')];_0x586221[_0x10b8('0x5f')][_0x10b8('0x5f')]=_0x2be967[_0x10b8('0x5f')]['text'];_0x586221['body'][_0x10b8('0x89')]=_0x2be967[_0x10b8('0x5f')][_0x10b8('0x90')];break;case'bandwidth':_0x586221[_0x10b8('0x5f')][_0x10b8('0x89')]=_0x2be967[_0x10b8('0x5f')][0x0]['message']['id'];_0x586221['body']['from']=_0x2be967[_0x10b8('0x5f')][0x0]['message']['from'];_0x586221[_0x10b8('0x5f')][_0x10b8('0x5f')]=_0x2be967[_0x10b8('0x5f')][0x0][_0x10b8('0x27')]['text'];break;case _0x10b8('0x91'):_0x586221[_0x10b8('0x5f')][_0x10b8('0x81')]=_0x2be967[_0x10b8('0x5f')][_0x10b8('0x81')];_0x586221[_0x10b8('0x5f')][_0x10b8('0x5f')]=_0x2be967[_0x10b8('0x5f')]['message'];_0x586221[_0x10b8('0x5f')]['messageId']=_0x2be967[_0x10b8('0x5f')][_0x10b8('0x92')];break;}}if(_0x586221[_0x10b8('0x5f')]['id']){delete _0x586221['body']['id'];}if(_['isNil'](_0x586221[_0x10b8('0x5f')][_0x10b8('0x81')])){throw new db[(_0x10b8('0x78'))][(_0x10b8('0x79'))](_0x10b8('0x93'));}if(_['isNil'](_0x586221[_0x10b8('0x5f')]['body'])||_0x586221[_0x10b8('0x5f')][_0x10b8('0x5f')]===''){throw new db[(_0x10b8('0x78'))][(_0x10b8('0x79'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x586221[_0x10b8('0x5f')][_0x10b8('0x94')])){throw new db[(_0x10b8('0x78'))]['ValidationError'](_0x10b8('0x95')+_0x50400a);}if(!_['includes'](_0x50400a,_0x586221[_0x10b8('0x5f')][_0x10b8('0x94')])){throw new db[(_0x10b8('0x78'))]['ValidationError'](_0x10b8('0x96')+_0x50400a);}_0x2a95bd[_0x586221['body'][_0x10b8('0x94')]]=_0x586221[_0x10b8('0x5f')][_0x10b8('0x81')];return db[_0x10b8('0x97')][_0x10b8('0x64')]({'where':{'id':_0x586221[_0x10b8('0x73')]['ListId']},'include':[{'model':db[_0x10b8('0x77')],'as':_0x10b8('0x98'),'where':_0x2a95bd,'limit':0x1,'order':[[_0x10b8('0x7d'),_0x10b8('0x99')]]}]});})[_0x10b8('0x20')](handleEntityNotFound(_0x21437e,null))[_0x10b8('0x20')](function(_0x8af95d){if(_0x8af95d){_0x586221[_0x10b8('0x9a')]=_[_0x10b8('0x9b')](_0x8af95d,[_0x10b8('0x98')]);if(_0x8af95d[_0x10b8('0x98')][_0x10b8('0x50')]){return _0x8af95d['Contacts'][0x0];}var _0x4dfa35=_[_0x10b8('0x18')](_0x586221[_0x10b8('0x5f')],{'firstName':_0x586221[_0x10b8('0x5f')][_0x10b8('0x81')],'ListId':_0x8af95d['id']});_0x4dfa35[_0x586221[_0x10b8('0x5f')][_0x10b8('0x94')]]=_0x586221[_0x10b8('0x5f')][_0x10b8('0x81')];return db[_0x10b8('0x77')][_0x10b8('0x5e')](_0x4dfa35,{'fields':_0x299e38,'raw':!![]});}})[_0x10b8('0x20')](handleEntityNotFound(_0x21437e,null))[_0x10b8('0x20')](function(_0x565c57){if(_0x565c57){_0x586221[_0x10b8('0x9c')]=_0x565c57;var _0x398215={'ContactId':_0x565c57['id'],'phone':_0x586221[_0x10b8('0x5f')]['from'],'SmsAccountId':_0x2be967['params']['id']};var _0x98b3f4={'ContactId':_0x565c57['id'],'SmsAccountId':_0x2be967['params']['id'],'closed':![]};return db[_0x10b8('0x9d')][_0x10b8('0x64')]({'where':_0x98b3f4})[_0x10b8('0x20')](function(_0x115feb){if(_0x115feb){return[_0x115feb,![]];}return db['SmsInteraction']['create'](_0x398215)[_0x10b8('0x20')](function(_0x2822f0){return[_0x2822f0,!![]];});});}})[_0x10b8('0x9e')](function(_0x41fe2b,_0x23080f){_0x586221['interaction']=_0x41fe2b['get']({'plain':!![]});_0x586221[_0x10b8('0x9f')]['created']=![];if(_0x23080f){if(_0x586221[_0x10b8('0x73')][_0x10b8('0xa0')]){_0x586221[_0x10b8('0x74')]['push']({'id':0x0,'priority':_0x586221['applications']['length']+0x1,'app':_0x10b8('0xa1'),'appdata':_0x10b8('0xa2'),'interval':_0x10b8('0xa3')});}_0x586221['interaction']['created']=!![];}return db['SmsMessage']['create']({'phone':_0x586221[_0x10b8('0x5f')]['from'],'messageId':_0x586221[_0x10b8('0x5f')][_0x10b8('0x89')],'body':_0x586221[_0x10b8('0x5f')][_0x10b8('0x5f')],'SmsAccountId':_0x2be967[_0x10b8('0x5c')]['id'],'SmsInteractionId':_0x41fe2b['id'],'direction':'in','ContactId':_0x41fe2b[_0x10b8('0xa4')],'AttachmentId':_0x586221[_0x10b8('0x5f')][_0x10b8('0xa5')]});})[_0x10b8('0x20')](function(_0x65827d){_0x586221[_0x10b8('0x27')]=_0x65827d;if(!_0x586221[_0x10b8('0x9f')][_0x10b8('0xa6')])return;return db[_0x10b8('0xa7')][_0x10b8('0x64')]({'attributes':['id','name'],'where':{'id':_0x586221[_0x10b8('0x9f')]['UserId']}});})[_0x10b8('0x20')](function(_0x471978){if(_0x471978){_0x586221[_0x10b8('0x74')][_0x10b8('0xa8')]({'id':0x0,'priority':0x0,'app':_0x10b8('0xa9'),'appdata':_0x471978[_0x10b8('0x3e')]+','+(_0x586221['account'][_0x10b8('0xaa')]||0xa),'interval':'*,*,*,*'});}if(!_0x586221[_0x10b8('0x9f')][_0x10b8('0xab')])return;return db[_0x10b8('0xac')][_0x10b8('0x64')]({'attributes':['id',_0x10b8('0x3e')],'where':{'id':_0x586221['interaction'][_0x10b8('0xab')]}});})[_0x10b8('0x20')](function(_0x541087){if(_0x541087){_0x586221[_0x10b8('0x74')][_0x10b8('0xa8')]({'id':0x0,'priority':0x1,'app':_0x10b8('0xad'),'appdata':_0x541087[_0x10b8('0x3e')]+','+(_0x586221[_0x10b8('0x73')][_0x10b8('0xae')]||0x12c),'interval':_0x10b8('0xa3')});}return respondWithRpcPromise(_0x10b8('0xaf'),'startRouting',_0x586221);})[_0x10b8('0x20')](function(_0x1266c5){if(_0x1266c5){var _0x3804e1=0xc8;var _0x9338b6='receiveMessage';logger['info'](_0x10b8('0x24'),_0x9338b6,_0x3804e1,_0x10b8('0xb0'));logger[_0x10b8('0x23')]('SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0x9338b6,_0x3804e1,_0x10b8('0xb0'),JSON['stringify'](_0x1266c5));if(_0x586221['account'][_0x10b8('0x47')]===_0x10b8('0x80')){return _0x21437e[_0x10b8('0x2c')](_0x3804e1)['set'](_0x10b8('0xb1'),_0x10b8('0xb2'))[_0x10b8('0x3f')](_0x10b8('0xb3'));}else{return _0x21437e[_0x10b8('0x2c')](_0x3804e1)[_0x10b8('0x33')](_0x1266c5);}}})[_0x10b8('0x2a')](handleError(_0x21437e,null));};exports[_0x10b8('0xb4')]=function(_0x1dd7d3,_0x305fb9){var _0xc5f75=_0x1dd7d3[_0x10b8('0x5c')]['id'];var _0x565c55=_0x1dd7d3[_0x10b8('0x5f')];var _0x1709d0=0xc8;var _0x194bcb=null;return db[_0x10b8('0xb5')][_0x10b8('0xb6')]({'isolationLevel':db[_0x10b8('0xb5')][_0x10b8('0xb7')][_0x10b8('0xb8')][_0x10b8('0xb9')]},function(_0x30a5d9){return db[_0x10b8('0x44')]['findOne']({'where':{'id':_0xc5f75},'transaction':_0x30a5d9})[_0x10b8('0x20')](function(_0x2a629c){if(_0x2a629c){return db[_0x10b8('0x72')]['destroy']({'where':{'SmsAccountId':_0xc5f75},'transaction':_0x30a5d9})['then'](function(){var _0x88f156=_[_0x10b8('0x43')](_0x565c55,function(_0x464a81){_0x464a81[_0x10b8('0x68')]=_0xc5f75;return _0x464a81;});return db[_0x10b8('0x72')]['bulkCreate'](_0x88f156,{'transaction':_0x30a5d9});});}else{_0x1709d0=0x194;_0x194bcb=[];}});})['then'](function(){if(_0x1709d0!==0x194){return db[_0x10b8('0x72')][_0x10b8('0xba')]({'where':{'SmsAccountId':_0xc5f75},'order':_0x10b8('0xbb')})[_0x10b8('0x20')](function(_0x3004eb){_0x194bcb=_0x3004eb;});}})[_0x10b8('0x2a')](function(_0x55b936){_0x1709d0=0x1f4;logger[_0x10b8('0x26')](_0x55b936[_0x10b8('0x3d')]);if(_0x55b936[_0x10b8('0x3e')]){delete _0x55b936['name'];}_0x194bcb=_0x55b936;})['finally'](function(){if(_0x194bcb===null){_0x305fb9[_0x10b8('0x2b')](_0x1709d0);}else{if(_0x1709d0===0x1f4){_0x305fb9[_0x10b8('0x2c')](_0x1709d0)['send'](_0x194bcb);}else{_0x305fb9[_0x10b8('0x2c')](_0x1709d0)['json'](_0x194bcb);}}});};exports['getApplications']=function(_0x20ec3e,_0x19e6d9,_0x3986c3){var _0x3e4381={};var _0x27e99e={};var _0x4e3229;var _0x3d0a95;return db[_0x10b8('0x44')][_0x10b8('0x6d')]({'where':{'id':_0x20ec3e[_0x10b8('0x5c')]['id']}})[_0x10b8('0x20')](handleEntityNotFound(_0x19e6d9,null))['then'](function(_0x3047ae){if(_0x3047ae){_0x4e3229=_0x3047ae;_0x27e99e[_0x10b8('0x49')]=_[_0x10b8('0x4a')](db['SmsApplication']['rawAttributes']);_0x27e99e['query']=_[_0x10b8('0x4a')](_0x20ec3e['query']);_0x27e99e[_0x10b8('0x4c')]=_[_0x10b8('0x4d')](_0x27e99e[_0x10b8('0x49')],_0x27e99e[_0x10b8('0x4b')]);_0x3e4381[_0x10b8('0x4e')]=_[_0x10b8('0x4d')](_0x27e99e[_0x10b8('0x49')],qs[_0x10b8('0x4f')](_0x20ec3e[_0x10b8('0x4b')][_0x10b8('0x4f')]));_0x3e4381['attributes']=_0x3e4381[_0x10b8('0x4e')][_0x10b8('0x50')]?_0x3e4381[_0x10b8('0x4e')]:_0x27e99e[_0x10b8('0x49')];_0x3e4381['order']=qs['sort'](_0x20ec3e[_0x10b8('0x4b')][_0x10b8('0x54')]);_0x3e4381[_0x10b8('0x56')]=qs['filters'](_[_0x10b8('0x6a')](_0x20ec3e[_0x10b8('0x4b')],_0x27e99e['filters']));if(_0x20ec3e[_0x10b8('0x4b')][_0x10b8('0x55')]){_0x3e4381['where']=_['merge'](_0x3e4381[_0x10b8('0x56')],{'$or':_[_0x10b8('0x43')](_0x3e4381[_0x10b8('0x4e')],function(_0x4e2b1b){var _0x15f3d9={};_0x15f3d9[_0x4e2b1b]={'$like':'%'+_0x20ec3e[_0x10b8('0x4b')][_0x10b8('0x55')]+'%'};return _0x15f3d9;})});}_0x3e4381=_['merge']({},_0x3e4381,_0x20ec3e[_0x10b8('0x58')]);return _0x4e3229['getApplications'](_0x3e4381);}})[_0x10b8('0x20')](function(_0x32a6b0){if(_0x32a6b0){_0x3d0a95=_0x32a6b0[_0x10b8('0x50')];if(!_0x20ec3e[_0x10b8('0x4b')][_0x10b8('0x51')]('nolimit')){_0x3e4381['limit']=qs[_0x10b8('0x30')](_0x20ec3e[_0x10b8('0x4b')][_0x10b8('0x30')]);_0x3e4381[_0x10b8('0x2d')]=qs['offset'](_0x20ec3e[_0x10b8('0x4b')]['offset']);}return _0x4e3229[_0x10b8('0xbc')](_0x3e4381);}})[_0x10b8('0x20')](function(_0x491010){if(_0x491010){return _0x491010?{'count':_0x3d0a95,'rows':_0x491010}:null;}})['then'](respondWithResult(_0x19e6d9,null))['catch'](handleError(_0x19e6d9,null));};exports['getInteractions']=function(_0x166851,_0x31bab3,_0x3d4883){var _0x2ec485={'raw':![],'where':{}};var _0x4132f7={};var _0x433bb3={'count':0x0,'rows':[]};return db[_0x10b8('0x44')]['findOne']({'where':{'id':_0x166851[_0x10b8('0x5c')]['id']}})[_0x10b8('0x20')](handleEntityNotFound(_0x31bab3,null))['then'](function(_0x1f88a8){if(_0x1f88a8){_0x4132f7[_0x10b8('0x49')]=_[_0x10b8('0x4a')](db['SmsInteraction'][_0x10b8('0x45')]);_0x4132f7[_0x10b8('0x4b')]=_[_0x10b8('0x4a')](_0x166851['query']);_0x4132f7[_0x10b8('0x4c')]=_[_0x10b8('0x4d')](_0x4132f7[_0x10b8('0x49')],_0x4132f7[_0x10b8('0x4b')]);_0x2ec485['attributes']=_[_0x10b8('0x4d')](_0x4132f7[_0x10b8('0x49')],qs[_0x10b8('0x4f')](_0x166851['query'][_0x10b8('0x4f')]));_0x2ec485[_0x10b8('0x4e')]=_0x2ec485[_0x10b8('0x4e')][_0x10b8('0x50')]?_0x2ec485[_0x10b8('0x4e')]:_0x4132f7[_0x10b8('0x49')];if(!_0x166851[_0x10b8('0x4b')]['hasOwnProperty']('nolimit')){_0x2ec485[_0x10b8('0x30')]=qs[_0x10b8('0x30')](_0x166851[_0x10b8('0x4b')]['limit']);_0x2ec485[_0x10b8('0x2d')]=qs[_0x10b8('0x2d')](_0x166851[_0x10b8('0x4b')]['offset']);}_0x2ec485[_0x10b8('0x53')]=qs[_0x10b8('0x54')](_0x166851[_0x10b8('0x4b')][_0x10b8('0x54')]);_0x2ec485[_0x10b8('0x56')]=qs['filters'](_[_0x10b8('0x6a')](_0x166851['query'],_0x4132f7[_0x10b8('0x4c')]));_0x2ec485['where'][_0x10b8('0x68')]=_0x1f88a8['id'];if(_0x166851['query'][_0x10b8('0x55')]){_0x2ec485[_0x10b8('0x56')]=_[_0x10b8('0x57')](_0x2ec485['where'],{'$or':_[_0x10b8('0x43')](_0x2ec485['attributes'],function(_0x11c545){var _0x3a6c2a={};_0x3a6c2a[_0x11c545]={'$like':'%'+_0x166851['query'][_0x10b8('0x55')]+'%'};return _0x3a6c2a;})});}_0x2ec485=_[_0x10b8('0x57')]({},_0x2ec485,_0x166851[_0x10b8('0x58')]);return db[_0x10b8('0x9d')]['count']({'where':_0x2ec485[_0x10b8('0x56')]})[_0x10b8('0x20')](function(_0x143778){_0x433bb3[_0x10b8('0x2f')]=_0x143778;if(_0x166851[_0x10b8('0x4b')]['includeAll']){_0x2ec485[_0x10b8('0x5d')]=[{'model':db['CmContact'],'as':_0x10b8('0xbd'),'required':![]},{'model':db[_0x10b8('0xa7')],'as':_0x10b8('0xbe'),'attributes':[_0x10b8('0x3e'),_0x10b8('0xbf'),_0x10b8('0xc0')],'required':![]},{'model':db['Tag'],'as':'Tags','attributes':['id',_0x10b8('0x3e'),_0x10b8('0xc1')],'where':_0x166851[_0x10b8('0x4b')][_0x10b8('0xc2')]?{'id':_0x166851[_0x10b8('0x4b')]['tag']}:undefined,'required':_0x166851[_0x10b8('0x4b')][_0x10b8('0xc2')]?!![]:![]}];}return db['SmsInteraction'][_0x10b8('0x5a')](_0x2ec485);})[_0x10b8('0x20')](function(_0x4a22c2){_0x433bb3[_0x10b8('0x5b')]=_0x4a22c2;return _0x433bb3;});}})['then'](respondWithFilteredResult(_0x31bab3,_0x2ec485))['catch'](handleError(_0x31bab3,null));};exports[_0x10b8('0x3f')]=function(_0x2ae0a8,_0x975443,_0x21ca5a){var _0x558a2e,_0x1e12dc,_0x5524ab;if(_['isNil'](_0x2ae0a8[_0x10b8('0x5f')]['body'])||_0x2ae0a8[_0x10b8('0x5f')][_0x10b8('0x5f')]===''){throw new db[(_0x10b8('0x78'))][(_0x10b8('0x79'))](_0x10b8('0xc3'));}if(_[_0x10b8('0xc4')](_0x2ae0a8[_0x10b8('0x5f')]['to'])){throw new db[(_0x10b8('0x78'))][(_0x10b8('0x79'))](_0x10b8('0xc5'));}_0x558a2e=_0x2ae0a8[_0x10b8('0x5f')]['to'];return db['SmsAccount'][_0x10b8('0x64')]({'where':{'id':_0x2ae0a8['params']['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0x10b8('0x77')],'as':_0x10b8('0x98'),'where':{'mobile':_0x558a2e},'limit':0x1,'order':[['updatedAt',_0x10b8('0x99')]]}]}]})[_0x10b8('0x20')](handleEntityNotFound(_0x975443,null))['then'](function(_0x42033d){if(_0x42033d&&_0x42033d[_0x10b8('0xc6')]){_0x1e12dc=_0x42033d[_0x10b8('0x39')]({'plain':!![]});if(_0x1e12dc[_0x10b8('0xc6')]&&_0x1e12dc[_0x10b8('0xc6')][_0x10b8('0x98')][_0x10b8('0x50')]){return _0x1e12dc[_0x10b8('0xc6')][_0x10b8('0x98')][0x0];}return db['CmContact'][_0x10b8('0x5e')](_[_0x10b8('0x18')](_0x2ae0a8[_0x10b8('0x5f')],{'firstName':_0x558a2e,'mobile':_0x558a2e,'phone':_0x558a2e,'ListId':_0x1e12dc[_0x10b8('0x7f')]}));}})[_0x10b8('0x20')](handleEntityNotFound(_0x975443,null))[_0x10b8('0x20')](function(_0x1853cb){if(_0x1853cb){_0x5524ab=_0x1853cb;return db[_0x10b8('0x9d')][_0x10b8('0x64')]({'where':{'ContactId':_0x5524ab['id'],'closed':![],'SmsAccountId':_0x1e12dc['id']}})[_0x10b8('0x20')](function(_0x1c7ee5){if(_0x1c7ee5){return[_0x1c7ee5,![]];}return db[_0x10b8('0x9d')]['create']({'UserId':_0x2ae0a8[_0x10b8('0x60')]['id'],'ContactId':_0x5524ab['id'],'SmsAccountId':_0x1e12dc['id'],'phone':_0x558a2e,'firstMsgDirection':'out','Messages':[_[_0x10b8('0x57')](_0x2ae0a8['body'],{'read':![],'body':_0x2ae0a8[_0x10b8('0x5f')]['body'],'phone':_0x558a2e,'SmsAccountId':_0x1e12dc['id'],'UserId':_0x2ae0a8['user']['id'],'ContactId':_0x5524ab['id']})]},{'include':[{'model':db[_0x10b8('0xc7')],'as':_0x10b8('0xc8')}]})['then'](function(_0x51a753){return[_0x51a753,!![]];});});}})[_0x10b8('0x9e')](function(_0x284271,_0x701296){if(_0x701296){return _0x284271;}return db[_0x10b8('0xc7')]['create'](_[_0x10b8('0x57')](_0x2ae0a8['body'],{'read':![],'body':_0x2ae0a8[_0x10b8('0x5f')]['body'],'phone':_0x558a2e,'SmsAccountId':_0x1e12dc['id'],'SmsInteractionId':_0x284271['id'],'UserId':_0x2ae0a8[_0x10b8('0x60')]['id'],'ContactId':_0x5524ab['id']}))['then'](function(_0x53260e){_0x284271[_0x10b8('0xc9')][_0x10b8('0xc8')]=[];_0x284271['dataValues']['Messages'][_0x10b8('0xca')](_0x53260e[_0x10b8('0xc9')]);return _0x284271;});})[_0x10b8('0x20')](respondWithResult(_0x975443,null))['catch'](handleError(_0x975443,null));};exports[_0x10b8('0x2c')]=function(_0x12faf4,_0x4c349a,_0x370d17){if(_0x12faf4['body']['id']){delete _0x12faf4[_0x10b8('0x5f')]['id'];}var _0x50127e,_0x5b051d,_0x1d4deb;return db[_0x10b8('0x44')][_0x10b8('0x64')]({'where':{'id':_0x12faf4[_0x10b8('0x5c')]['id']}})[_0x10b8('0x20')](handleEntityNotFound(_0x4c349a,null))[_0x10b8('0x20')](function(_0x17c8ea){if(_0x17c8ea){_0x1d4deb=_0x17c8ea;logger[_0x10b8('0x23')](_0x10b8('0x24'),'status',_0x10b8('0xcb'),_0x17c8ea[_0x10b8('0x47')],util[_0x10b8('0xcc')](_0x12faf4[_0x10b8('0x5f')],{'showHidden':![],'depth':null}));switch(_0x17c8ea[_0x10b8('0x47')]){case'skebby':if(_0x12faf4['body'][_0x10b8('0xcd')]&&_0x12faf4[_0x10b8('0x5f')][_0x10b8('0x2c')]){_0x5b051d=_0x12faf4[_0x10b8('0x5f')][_0x10b8('0x2c')];return db[_0x10b8('0xc7')][_0x10b8('0x64')]({'where':{'messageId':_0x12faf4['body'][_0x10b8('0xcd')]}});}break;case _0x10b8('0x87'):if(_0x12faf4[_0x10b8('0x5f')][_0x10b8('0xce')]&&_0x12faf4[_0x10b8('0x5f')][_0x10b8('0xcf')]){_0x5b051d=_0x12faf4[_0x10b8('0x5f')][_0x10b8('0xcf')];return db[_0x10b8('0xc7')][_0x10b8('0x64')]({'where':{'messageId':_0x12faf4[_0x10b8('0x5f')]['requestid']}});}break;case'clicksend':if(_0x12faf4[_0x10b8('0x5f')][_0x10b8('0x8a')]&&_0x12faf4[_0x10b8('0x5f')][_0x10b8('0xd0')]){_0x5b051d=_0x12faf4[_0x10b8('0x5f')][_0x10b8('0xd0')];return db[_0x10b8('0xc7')][_0x10b8('0x64')]({'where':{'messageId':_0x12faf4[_0x10b8('0x5f')]['message_id']}});}break;case'infobip':var _0x16914e=_0x12faf4['body']['results'][0x0];if(_0x16914e[_0x10b8('0x89')]&&_0x16914e[_0x10b8('0x2c')][_0x10b8('0xd1')]===_0x10b8('0xd2')){_0x5b051d=_0x16914e[_0x10b8('0x2c')]['groupName'];return db[_0x10b8('0xc7')][_0x10b8('0x64')]({'where':{'messageId':_0x16914e['messageId']}});}break;case _0x10b8('0xd3'):if(_0x12faf4[_0x10b8('0x5f')][_0x10b8('0x89')]&&_0x12faf4['body'][_0x10b8('0x2c')]){_0x5b051d=_0x12faf4['body'][_0x10b8('0x2c')];return db['SmsMessage'][_0x10b8('0x64')]({'where':{'messageId':_0x12faf4[_0x10b8('0x5f')][_0x10b8('0x89')]}});}break;case'bandwidth':if(_0x12faf4['body'][0x0]['message']['id']){_0x5b051d=_0x12faf4[_0x10b8('0x5f')][0x0][_0x10b8('0x47')];return db[_0x10b8('0xc7')]['find']({'where':{'messageId':_0x12faf4[_0x10b8('0x5f')][0x0][_0x10b8('0x27')]['id']}});}break;case _0x10b8('0x91'):if(_0x12faf4[_0x10b8('0x5f')]['redif']&&_0x12faf4['body'][_0x10b8('0x2c')]){_0x5b051d=_0x12faf4[_0x10b8('0x5f')][_0x10b8('0x2c')];return db[_0x10b8('0xc7')]['find']({'where':{'messageId':_0x12faf4[_0x10b8('0x5f')][_0x10b8('0xd4')]}});}break;}}})[_0x10b8('0x20')](handleEntityNotFound(_0x4c349a,null))[_0x10b8('0x20')](function(_0x40a5a5){if(_0x40a5a5){_0x50127e=_0x40a5a5;switch(_0x1d4deb[_0x10b8('0x47')]){case'skebby':if(_0x5b051d===_0x10b8('0xd2')){return _0x50127e[_0x10b8('0x37')]({'read':!![]});}else{logger[_0x10b8('0x26')](_0x10b8('0x24'),_0x10b8('0x2c'),'skebby',util[_0x10b8('0xcc')](_0x12faf4['body'],{'showHidden':![],'depth':null}));}break;case'connectel':if(_0x5b051d==='1'){return _0x50127e[_0x10b8('0x37')]({'read':!![]});}else{logger[_0x10b8('0x26')](_0x10b8('0x24'),_0x10b8('0x2c'),_0x10b8('0x84'),util[_0x10b8('0xcc')](_0x12faf4[_0x10b8('0x5f')],{'showHidden':![],'depth':null}));}break;case _0x10b8('0x88'):if(!_0x12faf4[_0x10b8('0x5f')][_0x10b8('0xd5')]&&_0x5b051d>=0xc8&&_0x5b051d<=0xce){return _0x50127e[_0x10b8('0x37')]({'read':!![]});}else{logger[_0x10b8('0x26')](_0x10b8('0x24'),_0x10b8('0x2c'),_0x10b8('0x88'),util[_0x10b8('0xcc')](_0x12faf4[_0x10b8('0x5f')],{'showHidden':![],'depth':null}));}break;case _0x10b8('0xd6'):var _0x1505f6=_0x12faf4[_0x10b8('0x5f')][_0x10b8('0x8c')][0x0];if(_0x1505f6[_0x10b8('0x2c')]['groupName']===_0x10b8('0xd2')){return _0x50127e[_0x10b8('0x37')]({'read':!![]});}else{logger[_0x10b8('0x26')]('SmsAccount,\x20%s,\x20%s,\x20%s','status','infobip',util['inspect'](_0x12faf4['body'],{'showHidden':![],'depth':null}));}break;case _0x10b8('0xd3'):if(_0x5b051d=='DELIVERED_TO_GATEWAY'||_0x5b051d=='RECEIVED_BY_RECIPIENT'){return _0x50127e[_0x10b8('0x37')]({'read':!![]});}else{logger[_0x10b8('0x26')](_0x10b8('0x24'),_0x10b8('0x2c'),_0x10b8('0xd3'),util[_0x10b8('0xcc')](_0x12faf4[_0x10b8('0x5f')],{'showHidden':![],'depth':null}));}break;case'bandwidth':if(_0x5b051d==_0x10b8('0xd7')){return _0x50127e[_0x10b8('0x37')]({'read':!![]});}else{logger[_0x10b8('0x26')](_0x10b8('0x24'),'status',_0x10b8('0xd8'),util['inspect'](_0x12faf4[_0x10b8('0x5f')],{'showHidden':![],'depth':null}));}break;case _0x10b8('0x91'):if(_0x5b051d===_0x10b8('0xd9')||_0x5b051d===_0x10b8('0xda')){return _0x50127e[_0x10b8('0x37')]({'read':!![]});}else{logger[_0x10b8('0x26')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x10b8('0x2c'),_0x10b8('0x91'),util['inspect'](_0x12faf4[_0x10b8('0x5f')],{'showHidden':![],'depth':null}));}break;}return _0x50127e;}})['then'](respondWithResult(_0x4c349a,null))[_0x10b8('0x2a')](handleError(_0x4c349a,null));};exports[_0x10b8('0xdb')]=function(_0xa96549,_0x4556b3,_0x23afc2){var _0x22802a,_0x4bde36,_0x204240;return db['SmsAccount'][_0x10b8('0x64')]({'where':{'id':_0xa96549[_0x10b8('0x5c')]['id']}})['then'](handleEntityNotFound(_0x4556b3,null))[_0x10b8('0x20')](function(_0x48454b){if(_0x48454b){_0x204240=_0x48454b;logger['debug'](_0x10b8('0x24'),'status',_0x10b8('0xcb'),_0x48454b[_0x10b8('0x47')],util[_0x10b8('0xcc')](_0xa96549['query'],{'showHidden':![],'depth':null}));switch(_0x48454b[_0x10b8('0x47')]){case'csc':if(_0xa96549['query'][_0x10b8('0xdc')]&&_0xa96549[_0x10b8('0x4b')][_0x10b8('0xdd')]){_0x4bde36=_0xa96549['query'][_0x10b8('0xdd')];return db[_0x10b8('0xc7')]['find']({'where':{'messageId':_0xa96549[_0x10b8('0x4b')]['message-id']}});}break;}}})[_0x10b8('0x20')](handleEntityNotFound(_0x4556b3,null))['then'](function(_0x530c20){if(_0x530c20){_0x22802a=_0x530c20;switch(_0x204240[_0x10b8('0x47')]){case _0x10b8('0x8d'):if(_0x4bde36==='2'||_0x4bde36==='6'){return _0x22802a[_0x10b8('0x37')]({'read':!![]});}else{logger[_0x10b8('0x26')](_0x10b8('0x24'),_0x10b8('0x2c'),_0x10b8('0x8d'),util[_0x10b8('0xcc')](_0xa96549[_0x10b8('0x4b')],{'showHidden':![],'depth':null}));};break;}return _0x22802a;}})[_0x10b8('0x20')](respondWithResult(_0x4556b3,null))[_0x10b8('0x2a')](handleError(_0x4556b3,null));};exports['addAgents']=function(_0x5a2bac,_0xc504fd,_0x1d064a){return db[_0x10b8('0x44')][_0x10b8('0x64')]({'where':{'id':_0x5a2bac['params']['id']}})[_0x10b8('0x20')](handleEntityNotFound(_0xc504fd,null))[_0x10b8('0x20')](function(_0x597377){if(_0x597377){return _0x597377[_0x10b8('0xde')](_0x5a2bac['body'][_0x10b8('0x6b')],_[_0x10b8('0x9b')](_0x5a2bac['body'],[_0x10b8('0x6b'),'id'])||{})['spread'](function(_0x441e4b){for(var _0x1857c2=0x0;_0x1857c2<_0x5a2bac[_0x10b8('0x5f')][_0x10b8('0x6b')][_0x10b8('0x50')];_0x1857c2+=0x1){socket[_0x10b8('0xdf')](_0x10b8('0xe0'),{'UserId':Number(_0x5a2bac[_0x10b8('0x5f')][_0x10b8('0x6b')][_0x1857c2]),'SmsAccountId':Number(_0x5a2bac[_0x10b8('0x5c')]['id'])});}return _0x441e4b;});}})[_0x10b8('0x20')](respondWithResult(_0xc504fd,null))[_0x10b8('0x2a')](handleError(_0xc504fd,null));};exports[_0x10b8('0xe1')]=function(_0x1c8747,_0x44d0e8,_0x5c4c7f){return db[_0x10b8('0x44')][_0x10b8('0x64')]({'where':{'id':_0x1c8747[_0x10b8('0x5c')]['id']}})[_0x10b8('0x20')](handleEntityNotFound(_0x44d0e8,null))[_0x10b8('0x20')](function(_0x3ad8b5){if(_0x3ad8b5){return _0x3ad8b5[_0x10b8('0xe1')](_0x1c8747['query'][_0x10b8('0x6b')])[_0x10b8('0x20')](function(){if(_[_0x10b8('0xe2')](_0x1c8747[_0x10b8('0x4b')][_0x10b8('0x6b')])){for(var _0x2e461a=0x0;_0x2e461a<_0x1c8747[_0x10b8('0x4b')]['ids'][_0x10b8('0x50')];_0x2e461a+=0x1){socket[_0x10b8('0xdf')](_0x10b8('0xe3'),{'UserId':Number(_0x1c8747[_0x10b8('0x4b')]['ids'][_0x2e461a]),'SmsAccountId':Number(_0x1c8747[_0x10b8('0x5c')]['id'])});}}else{socket[_0x10b8('0xdf')]('userSmsAccount:remove',{'UserId':Number(_0x1c8747[_0x10b8('0x4b')][_0x10b8('0x6b')]),'SmsAccountId':Number(_0x1c8747[_0x10b8('0x5c')]['id'])});}});}})[_0x10b8('0x20')](respondWithStatusCode(_0x44d0e8,null))[_0x10b8('0x2a')](handleError(_0x44d0e8,null));};exports[_0x10b8('0xe4')]=function(_0x5ed413,_0x1ec4e7,_0x40cb32){var _0xd6ddff={};var _0x58a417={};var _0x5b1e2c;var _0x6b16a2;return db[_0x10b8('0x44')][_0x10b8('0x6d')]({'where':{'id':_0x5ed413[_0x10b8('0x5c')]['id']}})['then'](handleEntityNotFound(_0x1ec4e7,null))[_0x10b8('0x20')](function(_0x50572b){if(_0x50572b){_0x5b1e2c=_0x50572b;_0x58a417['model']=_[_0x10b8('0x4a')](db['User']['rawAttributes']);_0x58a417[_0x10b8('0x4b')]=_[_0x10b8('0x4a')](_0x5ed413['query']);_0x58a417['filters']=_['intersection'](_0x58a417[_0x10b8('0x49')],_0x58a417[_0x10b8('0x4b')]);_0xd6ddff['attributes']=_[_0x10b8('0x4d')](_0x58a417['model'],qs[_0x10b8('0x4f')](_0x5ed413[_0x10b8('0x4b')]['fields']));_0xd6ddff[_0x10b8('0x4e')]=_0xd6ddff[_0x10b8('0x4e')][_0x10b8('0x50')]?_0xd6ddff[_0x10b8('0x4e')]:_0x58a417['model'];_0xd6ddff['order']=qs['sort'](_0x5ed413[_0x10b8('0x4b')][_0x10b8('0x54')]);_0xd6ddff[_0x10b8('0x56')]=qs[_0x10b8('0x4c')](_[_0x10b8('0x6a')](_0x5ed413[_0x10b8('0x4b')],_0x58a417[_0x10b8('0x4c')]));if(_0x5ed413['query'][_0x10b8('0x55')]){_0xd6ddff[_0x10b8('0x56')]=_[_0x10b8('0x57')](_0xd6ddff[_0x10b8('0x56')],{'$or':_[_0x10b8('0x43')](_0xd6ddff['attributes'],function(_0xc341a3){var _0x308b03={};_0x308b03[_0xc341a3]={'$like':'%'+_0x5ed413[_0x10b8('0x4b')][_0x10b8('0x55')]+'%'};return _0x308b03;})});}_0xd6ddff=_[_0x10b8('0x57')]({},_0xd6ddff,_0x5ed413[_0x10b8('0x58')]);return _0x5b1e2c[_0x10b8('0xe4')](_0xd6ddff);}})[_0x10b8('0x20')](function(_0x3f5f47){if(_0x3f5f47){_0x6b16a2=_0x3f5f47[_0x10b8('0x50')];if(!_0x5ed413['query'][_0x10b8('0x51')](_0x10b8('0x52'))){_0xd6ddff[_0x10b8('0x30')]=qs[_0x10b8('0x30')](_0x5ed413[_0x10b8('0x4b')][_0x10b8('0x30')]);_0xd6ddff[_0x10b8('0x2d')]=qs['offset'](_0x5ed413['query']['offset']);}return _0x5b1e2c['getAgents'](_0xd6ddff);}})[_0x10b8('0x20')](function(_0x5f064b){if(_0x5f064b){return _0x5f064b?{'count':_0x6b16a2,'rows':_0x5f064b}:null;}})['then'](respondWithResult(_0x1ec4e7,null))[_0x10b8('0x2a')](handleError(_0x1ec4e7,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index 84ed890..32eeb66 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 _0xb8f1=['setMaxListeners','save','update','remove','emit','exports','events','../../mysqldb','SmsAccount'];(function(_0x2f3848,_0x48564d){var _0x102668=function(_0x5e32ab){while(--_0x5e32ab){_0x2f3848['push'](_0x2f3848['shift']());}};_0x102668(++_0x48564d);}(_0xb8f1,0x1d1));var _0x1b8f=function(_0x37612b,_0x7338a8){_0x37612b=_0x37612b-0x0;var _0x1ee7e7=_0xb8f1[_0x37612b];return _0x1ee7e7;};'use strict';var EventEmitter=require(_0x1b8f('0x0'));var SmsAccount=require(_0x1b8f('0x1'))['db'][_0x1b8f('0x2')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x1b8f('0x3')](0x0);var events={'afterCreate':_0x1b8f('0x4'),'afterUpdate':_0x1b8f('0x5'),'afterDestroy':_0x1b8f('0x6')};function emitEvent(_0x41fe0c){return function(_0x7ac401,_0x376ad4,_0x10da03){SmsAccountEvents['emit'](_0x41fe0c+':'+_0x7ac401['id'],_0x7ac401);SmsAccountEvents[_0x1b8f('0x7')](_0x41fe0c,_0x7ac401);_0x10da03(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsAccount['hook'](e,emitEvent(event));}}module[_0x1b8f('0x8')]=SmsAccountEvents; \ No newline at end of file +var _0x1a18=['../../mysqldb','setMaxListeners','update','remove','emit','hook','exports'];(function(_0x103576,_0x44cf91){var _0x18cccb=function(_0x541145){while(--_0x541145){_0x103576['push'](_0x103576['shift']());}};_0x18cccb(++_0x44cf91);}(_0x1a18,0x1f1));var _0x81a1=function(_0x335271,_0x5025f2){_0x335271=_0x335271-0x0;var _0xa9fff8=_0x1a18[_0x335271];return _0xa9fff8;};'use strict';var EventEmitter=require('events');var SmsAccount=require(_0x81a1('0x0'))['db']['SmsAccount'];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x81a1('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0x81a1('0x2'),'afterDestroy':_0x81a1('0x3')};function emitEvent(_0x2b2187){return function(_0x4b4f24,_0x2af1d2,_0x3824e5){SmsAccountEvents[_0x81a1('0x4')](_0x2b2187+':'+_0x4b4f24['id'],_0x4b4f24);SmsAccountEvents['emit'](_0x2b2187,_0x4b4f24);_0x3824e5(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsAccount[_0x81a1('0x5')](e,emitEvent(event));}}module[_0x81a1('0x6')]=SmsAccountEvents; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.model.js b/server/api/smsAccount/smsAccount.model.js index 2b5d2bb..ed8fe18 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 _0x8952=['moment','bluebird','request-promise','path','../../config/environment','exports','define','SmsAccount','sms_accounts','lodash','util','../../config/logger','api'];(function(_0x6d7cf0,_0x337915){var _0x2d5ca3=function(_0x2cee25){while(--_0x2cee25){_0x6d7cf0['push'](_0x6d7cf0['shift']());}};_0x2d5ca3(++_0x337915);}(_0x8952,0x71));var _0x2895=function(_0x2e2614,_0x13e5e7){_0x2e2614=_0x2e2614-0x0;var _0x2e57ec=_0x8952[_0x2e2614];return _0x2e57ec;};'use strict';var _=require(_0x2895('0x0'));var util=require(_0x2895('0x1'));var logger=require(_0x2895('0x2'))(_0x2895('0x3'));var moment=require(_0x2895('0x4'));var BPromise=require(_0x2895('0x5'));var rp=require(_0x2895('0x6'));var fs=require('fs');var path=require(_0x2895('0x7'));var rimraf=require('rimraf');var config=require(_0x2895('0x8'));var attributes=require('./smsAccount.attributes');module[_0x2895('0x9')]=function(_0x4ac085,_0x34bbc7){return _0x4ac085[_0x2895('0xa')](_0x2895('0xb'),attributes,{'tableName':_0x2895('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf300=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','define','SmsAccount','util'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xf300,0xe5));var _0x0f30=function(_0x1fa381,_0x758c2a){_0x1fa381=_0x1fa381-0x0;var _0x47eefe=_0xf300[_0x1fa381];return _0x47eefe;};'use strict';var _=require('lodash');var util=require(_0x0f30('0x0'));var logger=require(_0x0f30('0x1'))(_0x0f30('0x2'));var moment=require(_0x0f30('0x3'));var BPromise=require(_0x0f30('0x4'));var rp=require(_0x0f30('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0f30('0x6'));var config=require(_0x0f30('0x7'));var attributes=require('./smsAccount.attributes');module['exports']=function(_0x5bfeef,_0x42b0a2){return _0x5bfeef[_0x0f30('0x8')](_0x0f30('0x9'),attributes,{'tableName':'sms_accounts','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 b5f4bb8..2430a22 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 _0xbe90=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./smsAccount.socket','register','request','SmsAccount,\x20%s,\x20%s','debug','SmsAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','ShowSmsAccount','find','options','raw','where','attributes','include','map','model','then'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0xbe90,0x156));var _0x0be9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbe90[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x0be9('0x0'));var util=require(_0x0be9('0x1'));var moment=require(_0x0be9('0x2'));var BPromise=require(_0x0be9('0x3'));var rs=require(_0x0be9('0x4'));var fs=require('fs');var Redis=require(_0x0be9('0x5'));var db=require(_0x0be9('0x6'))['db'];var utils=require(_0x0be9('0x7'));var logger=require('../../config/logger')(_0x0be9('0x8'));var config=require(_0x0be9('0x9'));var jayson=require(_0x0be9('0xa'));var client=jayson[_0x0be9('0xb')][_0x0be9('0xc')]({'port':0x232a});config[_0x0be9('0xd')]=_[_0x0be9('0xe')](config[_0x0be9('0xd')],{'host':_0x0be9('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0be9('0xd')]));require(_0x0be9('0x10'))[_0x0be9('0x11')](socket);function respondWithRpcPromise(_0x2dca85,_0x36aee9,_0x1c6182){return new BPromise(function(_0x54cbc8,_0x44aea1){return client[_0x0be9('0x12')](_0x2dca85,_0x1c6182)['then'](function(_0x27b89b){logger['info'](_0x0be9('0x13'),_0x36aee9,'request\x20sent');logger[_0x0be9('0x14')](_0x0be9('0x15'),_0x36aee9,_0x0be9('0x16'),JSON[_0x0be9('0x17')](_0x27b89b));if(_0x27b89b[_0x0be9('0x18')]){if(_0x27b89b[_0x0be9('0x18')]['code']===0x1f4){logger[_0x0be9('0x18')]('SmsAccount,\x20%s,\x20%s',_0x36aee9,_0x27b89b[_0x0be9('0x18')][_0x0be9('0x19')]);return _0x44aea1(_0x27b89b[_0x0be9('0x18')][_0x0be9('0x19')]);}logger[_0x0be9('0x18')]('SmsAccount,\x20%s,\x20%s',_0x36aee9,_0x27b89b[_0x0be9('0x18')]['message']);return _0x54cbc8(_0x27b89b['error'][_0x0be9('0x19')]);}else{logger[_0x0be9('0x1a')](_0x0be9('0x13'),_0x36aee9,'request\x20sent');_0x54cbc8(_0x27b89b[_0x0be9('0x1b')][_0x0be9('0x19')]);}})['catch'](function(_0x47c2f1){logger[_0x0be9('0x18')](_0x0be9('0x13'),_0x36aee9,_0x47c2f1);_0x44aea1(_0x47c2f1);});});}exports[_0x0be9('0x1c')]=function(_0x2125f1){var _0x5f1796=this;return new Promise(function(_0x553d52,_0x46c74a){return db['SmsAccount'][_0x0be9('0x1d')]({'raw':_0x2125f1['options']?_0x2125f1[_0x0be9('0x1e')][_0x0be9('0x1f')]===undefined?!![]:![]:!![],'where':_0x2125f1['options']?_0x2125f1[_0x0be9('0x1e')][_0x0be9('0x20')]||null:null,'attributes':_0x2125f1[_0x0be9('0x1e')]?_0x2125f1[_0x0be9('0x1e')][_0x0be9('0x21')]||null:null,'include':_0x2125f1[_0x0be9('0x1e')]?_0x2125f1[_0x0be9('0x1e')][_0x0be9('0x22')]?_[_0x0be9('0x23')](_0x2125f1['options'][_0x0be9('0x22')],function(_0x3b0b86){return{'model':db[_0x3b0b86['model']],'as':_0x3b0b86['as'],'attributes':_0x3b0b86[_0x0be9('0x21')],'include':_0x3b0b86[_0x0be9('0x22')]?_[_0x0be9('0x23')](_0x3b0b86[_0x0be9('0x22')],function(_0x354e23){return{'model':db[_0x354e23[_0x0be9('0x24')]],'as':_0x354e23['as'],'attributes':_0x354e23[_0x0be9('0x21')],'include':_0x354e23[_0x0be9('0x22')]?_['map'](_0x354e23[_0x0be9('0x22')],function(_0x17b1e6){return{'model':db[_0x17b1e6['model']],'as':_0x17b1e6['as'],'attributes':_0x17b1e6[_0x0be9('0x21')]};}):[]};}):[]};}):[]:[]})[_0x0be9('0x25')](function(_0x198ad7){logger['info'](_0x0be9('0x1c'),_0x2125f1);logger['debug']('ShowSmsAccount',_0x2125f1,JSON[_0x0be9('0x17')](_0x198ad7));_0x553d52(_0x198ad7);})['catch'](function(_0x1f8970){logger[_0x0be9('0x18')](_0x0be9('0x1c'),_0x1f8970[_0x0be9('0x19')],_0x2125f1);_0x46c74a(_0x5f1796[_0x0be9('0x18')](0x1f4,_0x1f8970['message']));});});}; \ No newline at end of file +var _0xfdaf=['randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsAccount,\x20%s,\x20%s','message','info','result','catch','SmsAccount','find','options','raw','include','map','model','attributes','then','ShowSmsAccount','lodash','util','moment','bluebird'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfdaf,0x19e));var _0xffda=function(_0x28a0fa,_0x24395f){_0x28a0fa=_0x28a0fa-0x0;var _0x11e95f=_0xfdaf[_0x28a0fa];return _0x11e95f;};'use strict';var _=require(_0xffda('0x0'));var util=require(_0xffda('0x1'));var moment=require(_0xffda('0x2'));var BPromise=require(_0xffda('0x3'));var rs=require(_0xffda('0x4'));var fs=require('fs');var Redis=require(_0xffda('0x5'));var db=require(_0xffda('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xffda('0x7'))('rpc');var config=require(_0xffda('0x8'));var jayson=require(_0xffda('0x9'));var client=jayson[_0xffda('0xa')][_0xffda('0xb')]({'port':0x232a});config[_0xffda('0xc')]=_[_0xffda('0xd')](config[_0xffda('0xc')],{'host':_0xffda('0xe'),'port':0x18eb});var socket=require(_0xffda('0xf'))(new Redis(config[_0xffda('0xc')]));require('./smsAccount.socket')[_0xffda('0x10')](socket);function respondWithRpcPromise(_0x6fba41,_0x32320c,_0x2c87fa){return new BPromise(function(_0x509b2f,_0x561fb){return client['request'](_0x6fba41,_0x2c87fa)['then'](function(_0x4946d7){logger['info']('SmsAccount,\x20%s,\x20%s',_0x32320c,_0xffda('0x11'));logger[_0xffda('0x12')](_0xffda('0x13'),_0x32320c,_0xffda('0x11'),JSON[_0xffda('0x14')](_0x4946d7));if(_0x4946d7[_0xffda('0x15')]){if(_0x4946d7[_0xffda('0x15')][_0xffda('0x16')]===0x1f4){logger[_0xffda('0x15')](_0xffda('0x17'),_0x32320c,_0x4946d7[_0xffda('0x15')][_0xffda('0x18')]);return _0x561fb(_0x4946d7['error'][_0xffda('0x18')]);}logger['error'](_0xffda('0x17'),_0x32320c,_0x4946d7[_0xffda('0x15')]['message']);return _0x509b2f(_0x4946d7['error']['message']);}else{logger[_0xffda('0x19')](_0xffda('0x17'),_0x32320c,_0xffda('0x11'));_0x509b2f(_0x4946d7[_0xffda('0x1a')][_0xffda('0x18')]);}})[_0xffda('0x1b')](function(_0x209147){logger[_0xffda('0x15')](_0xffda('0x17'),_0x32320c,_0x209147);_0x561fb(_0x209147);});});}exports['ShowSmsAccount']=function(_0x30f39b){var _0x344fc6=this;return new Promise(function(_0x396222,_0x503e1a){return db[_0xffda('0x1c')][_0xffda('0x1d')]({'raw':_0x30f39b[_0xffda('0x1e')]?_0x30f39b[_0xffda('0x1e')][_0xffda('0x1f')]===undefined?!![]:![]:!![],'where':_0x30f39b[_0xffda('0x1e')]?_0x30f39b[_0xffda('0x1e')]['where']||null:null,'attributes':_0x30f39b[_0xffda('0x1e')]?_0x30f39b[_0xffda('0x1e')]['attributes']||null:null,'include':_0x30f39b[_0xffda('0x1e')]?_0x30f39b['options'][_0xffda('0x20')]?_[_0xffda('0x21')](_0x30f39b[_0xffda('0x1e')][_0xffda('0x20')],function(_0x231360){return{'model':db[_0x231360[_0xffda('0x22')]],'as':_0x231360['as'],'attributes':_0x231360[_0xffda('0x23')],'include':_0x231360[_0xffda('0x20')]?_[_0xffda('0x21')](_0x231360['include'],function(_0x1ffcb4){return{'model':db[_0x1ffcb4['model']],'as':_0x1ffcb4['as'],'attributes':_0x1ffcb4[_0xffda('0x23')],'include':_0x1ffcb4[_0xffda('0x20')]?_['map'](_0x1ffcb4[_0xffda('0x20')],function(_0x51955b){return{'model':db[_0x51955b['model']],'as':_0x51955b['as'],'attributes':_0x51955b[_0xffda('0x23')]};}):[]};}):[]};}):[]:[]})[_0xffda('0x24')](function(_0x56adbe){logger[_0xffda('0x19')](_0xffda('0x25'),_0x30f39b);logger[_0xffda('0x12')]('ShowSmsAccount',_0x30f39b,JSON[_0xffda('0x14')](_0x56adbe));_0x396222(_0x56adbe);})[_0xffda('0x1b')](function(_0x13159f){logger[_0xffda('0x15')](_0xffda('0x25'),_0x13159f[_0xffda('0x18')],_0x30f39b);_0x503e1a(_0x344fc6['error'](0x1f4,_0x13159f['message']));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index 27619a4..9c4c5b9 100644 --- a/server/api/smsAccount/smsAccount.socket.js +++ b/server/api/smsAccount/smsAccount.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['register','length','smsAccount:','./smsAccount.events','save','remove','emit','removeListener'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf0bcac,_0x531755){_0xf0bcac=_0xf0bcac-0x0;var _0x4e4c65=_0xa9e0[_0xf0bcac];return _0x4e4c65;};'use strict';var SmsAccountEvents=require(_0x0a9e('0x0'));var events=[_0x0a9e('0x1'),_0x0a9e('0x2'),'update'];function createListener(_0x550fbc,_0x18d5c9){return function(_0x4ce2f1){_0x18d5c9[_0x0a9e('0x3')](_0x550fbc,_0x4ce2f1);};}function removeListener(_0x432180,_0x2ab90b){return function(){SmsAccountEvents[_0x0a9e('0x4')](_0x432180,_0x2ab90b);};}exports[_0x0a9e('0x5')]=function(_0x57b080){for(var _0x219af0=0x0,_0x441e3a=events[_0x0a9e('0x6')];_0x219af0<_0x441e3a;_0x219af0++){var _0x5f41ea=events[_0x219af0];var _0x503809=createListener(_0x0a9e('0x7')+_0x5f41ea,_0x57b080);SmsAccountEvents['on'](_0x5f41ea,_0x503809);}}; \ No newline at end of file +var _0xa9e0=['register','length','smsAccount:','./smsAccount.events','save','remove','emit','removeListener'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xa9e0,0x123));var _0x0a9e=function(_0x481bf7,_0x437f69){_0x481bf7=_0x481bf7-0x0;var _0x461787=_0xa9e0[_0x481bf7];return _0x461787;};'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 41afe0d..60f2a04 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 _0x9957=['multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsApplication.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports'];(function(_0x110c3d,_0x12ee06){var _0x226d67=function(_0x1fb6e1){while(--_0x1fb6e1){_0x110c3d['push'](_0x110c3d['shift']());}};_0x226d67(++_0x12ee06);}(_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('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 _0xedd9=['post','create','update','delete','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsApplication.controller','get','isAuthenticated','index','/:id','show'];(function(_0x286c12,_0x20b2ce){var _0x43f526=function(_0x1e01bd){while(--_0x1e01bd){_0x286c12['push'](_0x286c12['shift']());}};_0x43f526(++_0x20b2ce);}(_0xedd9,0xfc));var _0x9edd=function(_0x268ac1,_0x3c9369){_0x268ac1=_0x268ac1-0x0;var _0x53c80c=_0xedd9[_0x268ac1];return _0x53c80c;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');var controller=require(_0x9edd('0x8'));router[_0x9edd('0x9')]('/',auth[_0x9edd('0xa')](),controller[_0x9edd('0xb')]);router['get'](_0x9edd('0xc'),auth['isAuthenticated'](),controller[_0x9edd('0xd')]);router[_0x9edd('0xe')]('/',auth[_0x9edd('0xa')](),controller[_0x9edd('0xf')]);router['put'](_0x9edd('0xc'),auth['isAuthenticated'](),controller[_0x9edd('0x10')]);router[_0x9edd('0x11')]('/:id',auth[_0x9edd('0xa')](),controller[_0x9edd('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.attributes.js b/server/api/smsApplication/smsApplication.attributes.js index dc69638..699f581 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 _0xfa75=['*,*,*,*','sequelize','exports','STRING','TEXT'];(function(_0x241e61,_0x51e5ea){var _0x409de4=function(_0x1ccc72){while(--_0x1ccc72){_0x241e61['push'](_0x241e61['shift']());}};_0x409de4(++_0x51e5ea);}(_0xfa75,0x1b9));var _0x5fa7=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xfa75[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x5fa7('0x0'));module[_0x5fa7('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x5fa7('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x5fa7('0x3')]()},'description':{'type':Sequelize[_0x5fa7('0x2')]},'interval':{'type':Sequelize[_0x5fa7('0x2')],'defaultValue':_0x5fa7('0x4')}}; \ No newline at end of file +var _0x4d19=['TEXT','*,*,*,*','sequelize','exports','INTEGER','STRING'];(function(_0x5103a4,_0x4b7f5c){var _0x4f99e0=function(_0x1fb571){while(--_0x1fb571){_0x5103a4['push'](_0x5103a4['shift']());}};_0x4f99e0(++_0x4b7f5c);}(_0x4d19,0x98));var _0x94d1=function(_0x1486a4,_0xc1fd28){_0x1486a4=_0x1486a4-0x0;var _0x4c17fc=_0x4d19[_0x1486a4];return _0x4c17fc;};'use strict';var Sequelize=require(_0x94d1('0x0'));module[_0x94d1('0x1')]={'priority':{'type':Sequelize[_0x94d1('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x94d1('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x94d1('0x4')]()},'description':{'type':Sequelize[_0x94d1('0x3')]},'interval':{'type':Sequelize[_0x94d1('0x3')],'defaultValue':_0x94d1('0x5')}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index c93432f..7d28609 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 _0xbf87=['ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','limit','undefined','count','set','Content-Range','json','apply','reject','update','then','destroy','error','map','SmsApplication','rawAttributes','fieldName','keys','filters','model','query','attributes','intersection','length','nolimit','sort','pick','merge','where','type','VIRTUAL','name','filter','options','includeAll','include','findAll','rows','catch','fields','find','create','body','params','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','path','to-csv'];(function(_0x5c8cd2,_0x3a1bc0){var _0x2706fa=function(_0x338f9b){while(--_0x338f9b){_0x5c8cd2['push'](_0x5c8cd2['shift']());}};_0x2706fa(++_0x3a1bc0);}(_0xbf87,0x156));var _0x7bf8=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xbf87[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require(_0x7bf8('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7bf8('0x1'));var jsonpatch=require(_0x7bf8('0x2'));var rp=require('request-promise');var moment=require(_0x7bf8('0x3'));var BPromise=require(_0x7bf8('0x4'));var Mustache=require(_0x7bf8('0x5'));var util=require('util');var path=require(_0x7bf8('0x6'));var sox=require('sox');var csv=require(_0x7bf8('0x7'));var ejs=require(_0x7bf8('0x8'));var fs=require('fs');var fs_extra=require(_0x7bf8('0x9'));var _=require(_0x7bf8('0xa'));var squel=require(_0x7bf8('0xb'));var crypto=require('crypto');var jsforce=require(_0x7bf8('0xc'));var deskjs=require(_0x7bf8('0xd'));var toCsv=require(_0x7bf8('0x7'));var querystring=require(_0x7bf8('0xe'));var Papa=require(_0x7bf8('0xf'));var Redis=require('ioredis');var authService=require(_0x7bf8('0x10'));var qs=require(_0x7bf8('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7bf8('0x12'));var logger=require('../../config/logger')(_0x7bf8('0x13'));var utils=require('../../config/utils');var config=require(_0x7bf8('0x14'));var licenseUtil=require(_0x7bf8('0x15'));var db=require(_0x7bf8('0x16'))['db'];function respondWithStatusCode(_0x5c9051,_0x287d0e){_0x287d0e=_0x287d0e||0xcc;return function(_0x65ebb){if(_0x65ebb){return _0x5c9051[_0x7bf8('0x17')](_0x287d0e);}return _0x5c9051['status'](_0x287d0e)[_0x7bf8('0x18')]();};}function respondWithResult(_0x403914,_0x1044d2){_0x1044d2=_0x1044d2||0xc8;return function(_0x1f87ba){if(_0x1f87ba){return _0x403914[_0x7bf8('0x19')](_0x1044d2)['json'](_0x1f87ba);}};}function respondWithFilteredResult(_0x2144d1,_0x239ae8){return function(_0x1c96a4){if(_0x1c96a4){var _0x4be371=typeof _0x239ae8[_0x7bf8('0x1a')]==='undefined'&&typeof _0x239ae8[_0x7bf8('0x1b')]===_0x7bf8('0x1c');var _0x2b42d0=_0x1c96a4[_0x7bf8('0x1d')];var _0x4ca0bd=_0x4be371?0x0:_0x239ae8['offset'];var _0x516c9f=_0x4be371?_0x1c96a4[_0x7bf8('0x1d')]:_0x239ae8[_0x7bf8('0x1a')]+_0x239ae8['limit'];var _0x5416dd;if(_0x516c9f>=_0x2b42d0){_0x516c9f=_0x2b42d0;_0x5416dd=0xc8;}else{_0x5416dd=0xce;}_0x2144d1[_0x7bf8('0x19')](_0x5416dd);return _0x2144d1[_0x7bf8('0x1e')](_0x7bf8('0x1f'),_0x4ca0bd+'-'+_0x516c9f+'/'+_0x2b42d0)[_0x7bf8('0x20')](_0x1c96a4);}return null;};}function patchUpdates(_0xb2eac2){return function(_0x43371e){try{jsonpatch[_0x7bf8('0x21')](_0x43371e,_0xb2eac2,!![]);}catch(_0x2a6184){return BPromise[_0x7bf8('0x22')](_0x2a6184);}return _0x43371e['save']();};}function saveUpdates(_0xe7b185,_0x3a22ce){return function(_0x3dcc53){if(_0x3dcc53){return _0x3dcc53[_0x7bf8('0x23')](_0xe7b185)[_0x7bf8('0x24')](function(_0x12ee38){return _0x12ee38;});}return null;};}function removeEntity(_0x343af1,_0x38a515){return function(_0x42cccc){if(_0x42cccc){return _0x42cccc[_0x7bf8('0x25')]()[_0x7bf8('0x24')](function(){_0x343af1['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x52052a,_0x21bc6e){return function(_0x1ca8a1){if(!_0x1ca8a1){_0x52052a[_0x7bf8('0x17')](0x194);}return _0x1ca8a1;};}function handleError(_0x1d84e9,_0x40d388){_0x40d388=_0x40d388||0x1f4;return function(_0x1faaa9){logger[_0x7bf8('0x26')](_0x1faaa9['stack']);if(_0x1faaa9['name']){delete _0x1faaa9['name'];}_0x1d84e9['status'](_0x40d388)['send'](_0x1faaa9);};}exports['index']=function(_0x1e73dc,_0x1e3525){var _0x84bae6={},_0x2e408b={},_0x14eaef={'count':0x0,'rows':[]};var _0x1d273d=_[_0x7bf8('0x27')](db[_0x7bf8('0x28')][_0x7bf8('0x29')],function(_0xf6fc9e){return{'name':_0xf6fc9e[_0x7bf8('0x2a')],'type':_0xf6fc9e['type']['key']};});_0x2e408b['model']=_[_0x7bf8('0x27')](_0x1d273d,'name');_0x2e408b['query']=_[_0x7bf8('0x2b')](_0x1e73dc['query']);_0x2e408b[_0x7bf8('0x2c')]=_['intersection'](_0x2e408b[_0x7bf8('0x2d')],_0x2e408b[_0x7bf8('0x2e')]);_0x84bae6[_0x7bf8('0x2f')]=_[_0x7bf8('0x30')](_0x2e408b['model'],qs['fields'](_0x1e73dc[_0x7bf8('0x2e')]['fields']));_0x84bae6[_0x7bf8('0x2f')]=_0x84bae6[_0x7bf8('0x2f')][_0x7bf8('0x31')]?_0x84bae6[_0x7bf8('0x2f')]:_0x2e408b[_0x7bf8('0x2d')];if(!_0x1e73dc[_0x7bf8('0x2e')]['hasOwnProperty'](_0x7bf8('0x32'))){_0x84bae6[_0x7bf8('0x1b')]=qs[_0x7bf8('0x1b')](_0x1e73dc[_0x7bf8('0x2e')][_0x7bf8('0x1b')]);_0x84bae6['offset']=qs[_0x7bf8('0x1a')](_0x1e73dc['query'][_0x7bf8('0x1a')]);}_0x84bae6['order']=qs[_0x7bf8('0x33')](_0x1e73dc[_0x7bf8('0x2e')][_0x7bf8('0x33')]);_0x84bae6['where']=qs[_0x7bf8('0x2c')](_[_0x7bf8('0x34')](_0x1e73dc[_0x7bf8('0x2e')],_0x2e408b[_0x7bf8('0x2c')]),_0x1d273d);if(_0x1e73dc[_0x7bf8('0x2e')]['filter']){_0x84bae6['where']=_[_0x7bf8('0x35')](_0x84bae6[_0x7bf8('0x36')],{'$or':_[_0x7bf8('0x27')](_0x1d273d,function(_0x101bc0){if(_0x101bc0[_0x7bf8('0x37')]!==_0x7bf8('0x38')){var _0x13d5f1={};_0x13d5f1[_0x101bc0[_0x7bf8('0x39')]]={'$like':'%'+_0x1e73dc[_0x7bf8('0x2e')][_0x7bf8('0x3a')]+'%'};return _0x13d5f1;}})});}_0x84bae6=_[_0x7bf8('0x35')]({},_0x84bae6,_0x1e73dc[_0x7bf8('0x3b')]);var _0x3cfbcc={'where':_0x84bae6[_0x7bf8('0x36')]};return db[_0x7bf8('0x28')][_0x7bf8('0x1d')](_0x3cfbcc)[_0x7bf8('0x24')](function(_0x1cd796){_0x14eaef[_0x7bf8('0x1d')]=_0x1cd796;if(_0x1e73dc[_0x7bf8('0x2e')][_0x7bf8('0x3c')]){_0x84bae6[_0x7bf8('0x3d')]=[{'all':!![]}];}return db['SmsApplication'][_0x7bf8('0x3e')](_0x84bae6);})[_0x7bf8('0x24')](function(_0x3997a3){_0x14eaef[_0x7bf8('0x3f')]=_0x3997a3;return _0x14eaef;})[_0x7bf8('0x24')](respondWithFilteredResult(_0x1e3525,_0x84bae6))[_0x7bf8('0x40')](handleError(_0x1e3525,null));};exports['show']=function(_0x4a594f,_0x5d33ca){var _0xb217c={'raw':!![],'where':{'id':_0x4a594f['params']['id']}},_0x496e65={};_0x496e65[_0x7bf8('0x2d')]=_[_0x7bf8('0x2b')](db[_0x7bf8('0x28')][_0x7bf8('0x29')]);_0x496e65['query']=_['keys'](_0x4a594f[_0x7bf8('0x2e')]);_0x496e65[_0x7bf8('0x2c')]=_[_0x7bf8('0x30')](_0x496e65[_0x7bf8('0x2d')],_0x496e65['query']);_0xb217c[_0x7bf8('0x2f')]=_[_0x7bf8('0x30')](_0x496e65[_0x7bf8('0x2d')],qs[_0x7bf8('0x41')](_0x4a594f[_0x7bf8('0x2e')][_0x7bf8('0x41')]));_0xb217c[_0x7bf8('0x2f')]=_0xb217c[_0x7bf8('0x2f')]['length']?_0xb217c[_0x7bf8('0x2f')]:_0x496e65['model'];if(_0x4a594f[_0x7bf8('0x2e')][_0x7bf8('0x3c')]){_0xb217c[_0x7bf8('0x3d')]=[{'all':!![]}];}_0xb217c=_[_0x7bf8('0x35')]({},_0xb217c,_0x4a594f['options']);return db[_0x7bf8('0x28')][_0x7bf8('0x42')](_0xb217c)[_0x7bf8('0x24')](handleEntityNotFound(_0x5d33ca,null))[_0x7bf8('0x24')](respondWithResult(_0x5d33ca,null))[_0x7bf8('0x40')](handleError(_0x5d33ca,null));};exports[_0x7bf8('0x43')]=function(_0x1fcb58,_0x344282){return db[_0x7bf8('0x28')][_0x7bf8('0x43')](_0x1fcb58['body'],{})['then'](respondWithResult(_0x344282,0xc9))['catch'](handleError(_0x344282,null));};exports[_0x7bf8('0x23')]=function(_0x297420,_0x290272){if(_0x297420[_0x7bf8('0x44')]['id']){delete _0x297420[_0x7bf8('0x44')]['id'];}return db[_0x7bf8('0x28')][_0x7bf8('0x42')]({'where':{'id':_0x297420[_0x7bf8('0x45')]['id']}})[_0x7bf8('0x24')](handleEntityNotFound(_0x290272,null))[_0x7bf8('0x24')](saveUpdates(_0x297420[_0x7bf8('0x44')],null))[_0x7bf8('0x24')](respondWithResult(_0x290272,null))[_0x7bf8('0x40')](handleError(_0x290272,null));};exports[_0x7bf8('0x25')]=function(_0x3fa1fd,_0x1e2555){return db[_0x7bf8('0x28')]['find']({'where':{'id':_0x3fa1fd[_0x7bf8('0x45')]['id']}})['then'](handleEntityNotFound(_0x1e2555,null))[_0x7bf8('0x24')](removeEntity(_0x1e2555,null))[_0x7bf8('0x40')](handleError(_0x1e2555,null));}; \ No newline at end of file +var _0xba90=['options','find','create','body','destroy','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','reject','save','update','then','end','error','stack','name','index','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','length','hasOwnProperty','nolimit','order','sort','merge','where','VIRTUAL','filter','includeAll','SmsApplication','findAll','rows','catch','show','params','include'];(function(_0x548627,_0x4ec392){var _0x844a84=function(_0x2ffdd2){while(--_0x2ffdd2){_0x548627['push'](_0x548627['shift']());}};_0x844a84(++_0x4ec392);}(_0xba90,0x1bb));var _0x0ba9=function(_0x53dec5,_0x5553a2){_0x53dec5=_0x53dec5-0x0;var _0x3d456a=_0xba90[_0x53dec5];return _0x3d456a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0ba9('0x0'));var zipdir=require(_0x0ba9('0x1'));var jsonpatch=require(_0x0ba9('0x2'));var rp=require('request-promise');var moment=require(_0x0ba9('0x3'));var BPromise=require(_0x0ba9('0x4'));var Mustache=require(_0x0ba9('0x5'));var util=require(_0x0ba9('0x6'));var path=require(_0x0ba9('0x7'));var sox=require(_0x0ba9('0x8'));var csv=require(_0x0ba9('0x9'));var ejs=require(_0x0ba9('0xa'));var fs=require('fs');var fs_extra=require(_0x0ba9('0xb'));var _=require(_0x0ba9('0xc'));var squel=require(_0x0ba9('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x0ba9('0x9'));var querystring=require(_0x0ba9('0xe'));var Papa=require(_0x0ba9('0xf'));var Redis=require(_0x0ba9('0x10'));var authService=require(_0x0ba9('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x0ba9('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0ba9('0x13'))(_0x0ba9('0x14'));var utils=require(_0x0ba9('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x0ba9('0x16'))['db'];function respondWithStatusCode(_0x3e0d47,_0x4aa6f2){_0x4aa6f2=_0x4aa6f2||0xcc;return function(_0x11be1e){if(_0x11be1e){return _0x3e0d47[_0x0ba9('0x17')](_0x4aa6f2);}return _0x3e0d47[_0x0ba9('0x18')](_0x4aa6f2)['end']();};}function respondWithResult(_0x3eecbd,_0x542be1){_0x542be1=_0x542be1||0xc8;return function(_0x433c33){if(_0x433c33){return _0x3eecbd['status'](_0x542be1)[_0x0ba9('0x19')](_0x433c33);}};}function respondWithFilteredResult(_0x1638e1,_0xd525e){return function(_0x12da39){if(_0x12da39){var _0x1b0f32=typeof _0xd525e[_0x0ba9('0x1a')]===_0x0ba9('0x1b')&&typeof _0xd525e[_0x0ba9('0x1c')]==='undefined';var _0x8f5ff7=_0x12da39[_0x0ba9('0x1d')];var _0x503c3c=_0x1b0f32?0x0:_0xd525e[_0x0ba9('0x1a')];var _0x3d9c38=_0x1b0f32?_0x12da39[_0x0ba9('0x1d')]:_0xd525e[_0x0ba9('0x1a')]+_0xd525e['limit'];var _0x10e324;if(_0x3d9c38>=_0x8f5ff7){_0x3d9c38=_0x8f5ff7;_0x10e324=0xc8;}else{_0x10e324=0xce;}_0x1638e1[_0x0ba9('0x18')](_0x10e324);return _0x1638e1['set'](_0x0ba9('0x1e'),_0x503c3c+'-'+_0x3d9c38+'/'+_0x8f5ff7)[_0x0ba9('0x19')](_0x12da39);}return null;};}function patchUpdates(_0x5cba5d){return function(_0x1b1468){try{jsonpatch['apply'](_0x1b1468,_0x5cba5d,!![]);}catch(_0x100130){return BPromise[_0x0ba9('0x1f')](_0x100130);}return _0x1b1468[_0x0ba9('0x20')]();};}function saveUpdates(_0x4ae238,_0x30bb09){return function(_0x464150){if(_0x464150){return _0x464150[_0x0ba9('0x21')](_0x4ae238)[_0x0ba9('0x22')](function(_0x31bd83){return _0x31bd83;});}return null;};}function removeEntity(_0x3ff663,_0x148723){return function(_0x5bb26a){if(_0x5bb26a){return _0x5bb26a['destroy']()[_0x0ba9('0x22')](function(){_0x3ff663['status'](0xcc)[_0x0ba9('0x23')]();});}};}function handleEntityNotFound(_0x422848,_0xcd810a){return function(_0x344e19){if(!_0x344e19){_0x422848[_0x0ba9('0x17')](0x194);}return _0x344e19;};}function handleError(_0x5e3d09,_0x14305e){_0x14305e=_0x14305e||0x1f4;return function(_0x5ccd60){logger[_0x0ba9('0x24')](_0x5ccd60[_0x0ba9('0x25')]);if(_0x5ccd60[_0x0ba9('0x26')]){delete _0x5ccd60[_0x0ba9('0x26')];}_0x5e3d09[_0x0ba9('0x18')](_0x14305e)['send'](_0x5ccd60);};}exports[_0x0ba9('0x27')]=function(_0x1ab125,_0xd43445){var _0x47a096={},_0x5b2bf0={},_0x60818c={'count':0x0,'rows':[]};var _0x1cf3c7=_[_0x0ba9('0x28')](db['SmsApplication'][_0x0ba9('0x29')],function(_0x63df61){return{'name':_0x63df61[_0x0ba9('0x2a')],'type':_0x63df61[_0x0ba9('0x2b')][_0x0ba9('0x2c')]};});_0x5b2bf0['model']=_[_0x0ba9('0x28')](_0x1cf3c7,_0x0ba9('0x26'));_0x5b2bf0[_0x0ba9('0x2d')]=_[_0x0ba9('0x2e')](_0x1ab125['query']);_0x5b2bf0[_0x0ba9('0x2f')]=_[_0x0ba9('0x30')](_0x5b2bf0['model'],_0x5b2bf0[_0x0ba9('0x2d')]);_0x47a096['attributes']=_[_0x0ba9('0x30')](_0x5b2bf0[_0x0ba9('0x31')],qs['fields'](_0x1ab125['query']['fields']));_0x47a096['attributes']=_0x47a096[_0x0ba9('0x32')][_0x0ba9('0x33')]?_0x47a096[_0x0ba9('0x32')]:_0x5b2bf0[_0x0ba9('0x31')];if(!_0x1ab125[_0x0ba9('0x2d')][_0x0ba9('0x34')](_0x0ba9('0x35'))){_0x47a096[_0x0ba9('0x1c')]=qs[_0x0ba9('0x1c')](_0x1ab125[_0x0ba9('0x2d')][_0x0ba9('0x1c')]);_0x47a096[_0x0ba9('0x1a')]=qs[_0x0ba9('0x1a')](_0x1ab125['query'][_0x0ba9('0x1a')]);}_0x47a096[_0x0ba9('0x36')]=qs[_0x0ba9('0x37')](_0x1ab125[_0x0ba9('0x2d')][_0x0ba9('0x37')]);_0x47a096['where']=qs[_0x0ba9('0x2f')](_['pick'](_0x1ab125[_0x0ba9('0x2d')],_0x5b2bf0[_0x0ba9('0x2f')]),_0x1cf3c7);if(_0x1ab125['query']['filter']){_0x47a096['where']=_[_0x0ba9('0x38')](_0x47a096[_0x0ba9('0x39')],{'$or':_[_0x0ba9('0x28')](_0x1cf3c7,function(_0x2747f7){if(_0x2747f7[_0x0ba9('0x2b')]!==_0x0ba9('0x3a')){var _0x2c858f={};_0x2c858f[_0x2747f7[_0x0ba9('0x26')]]={'$like':'%'+_0x1ab125[_0x0ba9('0x2d')][_0x0ba9('0x3b')]+'%'};return _0x2c858f;}})});}_0x47a096=_[_0x0ba9('0x38')]({},_0x47a096,_0x1ab125['options']);var _0x3b931c={'where':_0x47a096[_0x0ba9('0x39')]};return db['SmsApplication'][_0x0ba9('0x1d')](_0x3b931c)[_0x0ba9('0x22')](function(_0x2e0b2f){_0x60818c['count']=_0x2e0b2f;if(_0x1ab125[_0x0ba9('0x2d')][_0x0ba9('0x3c')]){_0x47a096['include']=[{'all':!![]}];}return db[_0x0ba9('0x3d')][_0x0ba9('0x3e')](_0x47a096);})['then'](function(_0x2678ed){_0x60818c[_0x0ba9('0x3f')]=_0x2678ed;return _0x60818c;})[_0x0ba9('0x22')](respondWithFilteredResult(_0xd43445,_0x47a096))[_0x0ba9('0x40')](handleError(_0xd43445,null));};exports[_0x0ba9('0x41')]=function(_0x2129b0,_0x149b61){var _0x318ac9={'raw':!![],'where':{'id':_0x2129b0[_0x0ba9('0x42')]['id']}},_0x4e0682={};_0x4e0682[_0x0ba9('0x31')]=_[_0x0ba9('0x2e')](db[_0x0ba9('0x3d')][_0x0ba9('0x29')]);_0x4e0682[_0x0ba9('0x2d')]=_[_0x0ba9('0x2e')](_0x2129b0[_0x0ba9('0x2d')]);_0x4e0682[_0x0ba9('0x2f')]=_['intersection'](_0x4e0682['model'],_0x4e0682[_0x0ba9('0x2d')]);_0x318ac9[_0x0ba9('0x32')]=_[_0x0ba9('0x30')](_0x4e0682['model'],qs['fields'](_0x2129b0['query']['fields']));_0x318ac9['attributes']=_0x318ac9[_0x0ba9('0x32')][_0x0ba9('0x33')]?_0x318ac9['attributes']:_0x4e0682[_0x0ba9('0x31')];if(_0x2129b0[_0x0ba9('0x2d')][_0x0ba9('0x3c')]){_0x318ac9[_0x0ba9('0x43')]=[{'all':!![]}];}_0x318ac9=_[_0x0ba9('0x38')]({},_0x318ac9,_0x2129b0[_0x0ba9('0x44')]);return db['SmsApplication'][_0x0ba9('0x45')](_0x318ac9)['then'](handleEntityNotFound(_0x149b61,null))[_0x0ba9('0x22')](respondWithResult(_0x149b61,null))['catch'](handleError(_0x149b61,null));};exports[_0x0ba9('0x46')]=function(_0x2d2feb,_0x3b5512){return db[_0x0ba9('0x3d')]['create'](_0x2d2feb[_0x0ba9('0x47')],{})[_0x0ba9('0x22')](respondWithResult(_0x3b5512,0xc9))[_0x0ba9('0x40')](handleError(_0x3b5512,null));};exports[_0x0ba9('0x21')]=function(_0x163378,_0x1d7724){if(_0x163378[_0x0ba9('0x47')]['id']){delete _0x163378[_0x0ba9('0x47')]['id'];}return db[_0x0ba9('0x3d')]['find']({'where':{'id':_0x163378[_0x0ba9('0x42')]['id']}})[_0x0ba9('0x22')](handleEntityNotFound(_0x1d7724,null))['then'](saveUpdates(_0x163378[_0x0ba9('0x47')],null))[_0x0ba9('0x22')](respondWithResult(_0x1d7724,null))['catch'](handleError(_0x1d7724,null));};exports[_0x0ba9('0x48')]=function(_0x302902,_0x17686b){return db[_0x0ba9('0x3d')][_0x0ba9('0x45')]({'where':{'id':_0x302902[_0x0ba9('0x42')]['id']}})['then'](handleEntityNotFound(_0x17686b,null))[_0x0ba9('0x22')](removeEntity(_0x17686b,null))['catch'](handleError(_0x17686b,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index 028f7d1..a116cae 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 _0x0076=['rimraf','../../config/environment','./smsApplication.attributes','exports','define','sms_applications','utf8mb4','lodash','util','../../config/logger','api','moment','path'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x0076,0x1b4));var _0x6007=function(_0x9c2427,_0x17c865){_0x9c2427=_0x9c2427-0x0;var _0x51984f=_0x0076[_0x9c2427];return _0x51984f;};'use strict';var _=require(_0x6007('0x0'));var util=require(_0x6007('0x1'));var logger=require(_0x6007('0x2'))(_0x6007('0x3'));var moment=require(_0x6007('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x6007('0x5'));var rimraf=require(_0x6007('0x6'));var config=require(_0x6007('0x7'));var attributes=require(_0x6007('0x8'));module[_0x6007('0x9')]=function(_0x442210,_0x4c64c0){return _0x442210[_0x6007('0xa')]('SmsApplication',attributes,{'tableName':_0x6007('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x6007('0xc'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xe54d=['../../config/environment','./smsApplication.attributes','exports','define','SmsApplication','sms_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','bluebird','request-promise','rimraf'];(function(_0x78029b,_0x19ce64){var _0x2c1b66=function(_0x3d1543){while(--_0x3d1543){_0x78029b['push'](_0x78029b['shift']());}};_0x2c1b66(++_0x19ce64);}(_0xe54d,0xbe));var _0xde54=function(_0x39fcf9,_0x26f83f){_0x39fcf9=_0x39fcf9-0x0;var _0x35fcce=_0xe54d[_0x39fcf9];return _0x35fcce;};'use strict';var _=require(_0xde54('0x0'));var util=require(_0xde54('0x1'));var logger=require('../../config/logger')(_0xde54('0x2'));var moment=require('moment');var BPromise=require(_0xde54('0x3'));var rp=require(_0xde54('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xde54('0x5'));var config=require(_0xde54('0x6'));var attributes=require(_0xde54('0x7'));module[_0xde54('0x8')]=function(_0x1bad1d,_0xc080cd){return _0x1bad1d[_0xde54('0x9')](_0xde54('0xa'),attributes,{'tableName':_0xde54('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xde54('0xc'),'collate':_0xde54('0xd')});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index f68d737..8a7ee0f 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 _0x6209=['stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','then','info','SmsApplication,\x20%s,\x20%s','request\x20sent','debug','SmsApplication,\x20%s,\x20%s,\x20%s'];(function(_0x2a5a6c,_0xbc8914){var _0x365094=function(_0x198905){while(--_0x198905){_0x2a5a6c['push'](_0x2a5a6c['shift']());}};_0x365094(++_0xbc8914);}(_0x6209,0x1e8));var _0x9620=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x6209[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0x9620('0x0'));var util=require(_0x9620('0x1'));var moment=require(_0x9620('0x2'));var BPromise=require(_0x9620('0x3'));var rs=require(_0x9620('0x4'));var fs=require('fs');var Redis=require(_0x9620('0x5'));var db=require(_0x9620('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x9620('0x7'))(_0x9620('0x8'));var config=require(_0x9620('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x9620('0xa')][_0x9620('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2bdb4e,_0x339bdc,_0x488d59){return new BPromise(function(_0x4e9082,_0x11af3d){return client['request'](_0x2bdb4e,_0x488d59)[_0x9620('0xc')](function(_0x345acb){logger[_0x9620('0xd')](_0x9620('0xe'),_0x339bdc,_0x9620('0xf'));logger[_0x9620('0x10')](_0x9620('0x11'),_0x339bdc,'request\x20sent',JSON[_0x9620('0x12')](_0x345acb));if(_0x345acb['error']){if(_0x345acb[_0x9620('0x13')][_0x9620('0x14')]===0x1f4){logger[_0x9620('0x13')](_0x9620('0xe'),_0x339bdc,_0x345acb[_0x9620('0x13')][_0x9620('0x15')]);return _0x11af3d(_0x345acb[_0x9620('0x13')][_0x9620('0x15')]);}logger[_0x9620('0x13')](_0x9620('0xe'),_0x339bdc,_0x345acb['error']['message']);return _0x4e9082(_0x345acb[_0x9620('0x13')][_0x9620('0x15')]);}else{logger['info'](_0x9620('0xe'),_0x339bdc,_0x9620('0xf'));_0x4e9082(_0x345acb[_0x9620('0x16')][_0x9620('0x15')]);}})['catch'](function(_0x2cb40e){logger[_0x9620('0x13')]('SmsApplication,\x20%s,\x20%s',_0x339bdc,_0x2cb40e);_0x11af3d(_0x2cb40e);});});} \ No newline at end of file +var _0xa3fe=['../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request\x20sent','debug','SmsApplication,\x20%s,\x20%s,\x20%s','error','code','SmsApplication,\x20%s,\x20%s','message','info','result','catch','lodash','moment','bluebird','ioredis'];(function(_0x18998b,_0x3a0248){var _0x50186d=function(_0x55faf9){while(--_0x55faf9){_0x18998b['push'](_0x18998b['shift']());}};_0x50186d(++_0x3a0248);}(_0xa3fe,0xd8));var _0xea3f=function(_0x3d3685,_0x1439db){_0x3d3685=_0x3d3685-0x0;var _0x1f8b0a=_0xa3fe[_0x3d3685];return _0x1f8b0a;};'use strict';var _=require(_0xea3f('0x0'));var util=require('util');var moment=require(_0xea3f('0x1'));var BPromise=require(_0xea3f('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xea3f('0x3'));var db=require(_0xea3f('0x4'))['db'];var utils=require(_0xea3f('0x5'));var logger=require('../../config/logger')(_0xea3f('0x6'));var config=require('../../config/environment');var jayson=require(_0xea3f('0x7'));var client=jayson[_0xea3f('0x8')][_0xea3f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x49e494,_0x56abd6,_0x187ce0){return new BPromise(function(_0x35ba50,_0x3c4807){return client['request'](_0x49e494,_0x187ce0)['then'](function(_0x464ad4){logger['info']('SmsApplication,\x20%s,\x20%s',_0x56abd6,_0xea3f('0xa'));logger[_0xea3f('0xb')](_0xea3f('0xc'),_0x56abd6,'request\x20sent',JSON['stringify'](_0x464ad4));if(_0x464ad4['error']){if(_0x464ad4[_0xea3f('0xd')][_0xea3f('0xe')]===0x1f4){logger[_0xea3f('0xd')](_0xea3f('0xf'),_0x56abd6,_0x464ad4['error']['message']);return _0x3c4807(_0x464ad4['error'][_0xea3f('0x10')]);}logger[_0xea3f('0xd')]('SmsApplication,\x20%s,\x20%s',_0x56abd6,_0x464ad4[_0xea3f('0xd')][_0xea3f('0x10')]);return _0x35ba50(_0x464ad4['error'][_0xea3f('0x10')]);}else{logger[_0xea3f('0x11')](_0xea3f('0xf'),_0x56abd6,_0xea3f('0xa'));_0x35ba50(_0x464ad4[_0xea3f('0x12')][_0xea3f('0x10')]);}})[_0xea3f('0x13')](function(_0x2585f1){logger[_0xea3f('0xd')](_0xea3f('0xf'),_0x56abd6,_0x2585f1);_0x3c4807(_0x2585f1);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index 9481356..3b5f7da 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 _0x3c81=['express','../../config/environment','./smsInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','addTags','tracked','sms','update','delete','smsinteraction:destroy','destroy','/:id/tags','exports','multer','util','connect-timeout'];(function(_0x41dee0,_0x374287){var _0x4091bb=function(_0x19bfd1){while(--_0x19bfd1){_0x41dee0['push'](_0x41dee0['shift']());}};_0x4091bb(++_0x374287);}(_0x3c81,0x102));var _0x13c8=function(_0xbaae2c,_0xd76f28){_0xbaae2c=_0xbaae2c-0x0;var _0x4e7852=_0x3c81[_0xbaae2c];return _0x4e7852;};'use strict';var multer=require(_0x13c8('0x0'));var util=require(_0x13c8('0x1'));var path=require('path');var timeout=require(_0x13c8('0x2'));var express=require(_0x13c8('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x13c8('0x4'));var controller=require(_0x13c8('0x5'));router[_0x13c8('0x6')]('/',auth[_0x13c8('0x7')](),controller[_0x13c8('0x8')]);router[_0x13c8('0x6')](_0x13c8('0x9'),auth['isAuthenticated'](),controller[_0x13c8('0xa')]);router['get'](_0x13c8('0xb'),auth[_0x13c8('0x7')](),controller[_0x13c8('0xc')]);router[_0x13c8('0x6')](_0x13c8('0xd'),auth[_0x13c8('0x7')](),controller[_0x13c8('0xe')]);router[_0x13c8('0x6')](_0x13c8('0xf'),auth[_0x13c8('0x7')](),controller[_0x13c8('0x10')]);router[_0x13c8('0x11')]('/',auth[_0x13c8('0x7')](),controller[_0x13c8('0x12')]);router['post'](_0x13c8('0xd'),auth[_0x13c8('0x7')](),controller[_0x13c8('0x13')]);router[_0x13c8('0x11')]('/:id/tags',auth[_0x13c8('0x7')](),interaction['tracked']('sms','smsinteraction:addtags'),controller[_0x13c8('0x14')]);router['put'](_0x13c8('0xb'),auth[_0x13c8('0x7')](),interaction[_0x13c8('0x15')](_0x13c8('0x16'),'smsinteraction:update'),controller[_0x13c8('0x17')]);router[_0x13c8('0x18')](_0x13c8('0xb'),auth[_0x13c8('0x7')](),interaction[_0x13c8('0x15')](_0x13c8('0x16'),_0x13c8('0x19')),controller[_0x13c8('0x1a')]);router[_0x13c8('0x18')](_0x13c8('0x1b'),auth[_0x13c8('0x7')](),controller['removeTags']);module[_0x13c8('0x1c')]=router; \ No newline at end of file +var _0xe5b5=['destroy','removeTags','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/download','download','post','/:id/messages','addMessage','/:id/tags','sms','smsinteraction:addtags','put','tracked','smsinteraction:update','delete','smsinteraction:destroy'];(function(_0x20d2c8,_0x560bd7){var _0x4137de=function(_0x56b70f){while(--_0x56b70f){_0x20d2c8['push'](_0x20d2c8['shift']());}};_0x4137de(++_0x560bd7);}(_0xe5b5,0x12b));var _0x5e5b=function(_0x39096d,_0x51f8a0){_0x39096d=_0x39096d-0x0;var _0x13da4f=_0xe5b5[_0x39096d];return _0x13da4f;};'use strict';var multer=require(_0x5e5b('0x0'));var util=require(_0x5e5b('0x1'));var path=require(_0x5e5b('0x2'));var timeout=require(_0x5e5b('0x3'));var express=require(_0x5e5b('0x4'));var router=express[_0x5e5b('0x5')]();var fs_extra=require(_0x5e5b('0x6'));var auth=require(_0x5e5b('0x7'));var interaction=require(_0x5e5b('0x8'));var config=require(_0x5e5b('0x9'));var controller=require(_0x5e5b('0xa'));router[_0x5e5b('0xb')]('/',auth[_0x5e5b('0xc')](),controller[_0x5e5b('0xd')]);router[_0x5e5b('0xb')](_0x5e5b('0xe'),auth[_0x5e5b('0xc')](),controller[_0x5e5b('0xf')]);router[_0x5e5b('0xb')](_0x5e5b('0x10'),auth[_0x5e5b('0xc')](),controller[_0x5e5b('0x11')]);router[_0x5e5b('0xb')]('/:id/messages',auth[_0x5e5b('0xc')](),controller['getMessages']);router[_0x5e5b('0xb')](_0x5e5b('0x12'),auth[_0x5e5b('0xc')](),controller[_0x5e5b('0x13')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x5e5b('0x14')](_0x5e5b('0x15'),auth[_0x5e5b('0xc')](),controller[_0x5e5b('0x16')]);router[_0x5e5b('0x14')](_0x5e5b('0x17'),auth[_0x5e5b('0xc')](),interaction['tracked'](_0x5e5b('0x18'),_0x5e5b('0x19')),controller['addTags']);router[_0x5e5b('0x1a')]('/:id',auth['isAuthenticated'](),interaction[_0x5e5b('0x1b')](_0x5e5b('0x18'),_0x5e5b('0x1c')),controller['update']);router[_0x5e5b('0x1d')]('/:id',auth[_0x5e5b('0xc')](),interaction[_0x5e5b('0x1b')]('sms',_0x5e5b('0x1e')),controller[_0x5e5b('0x1f')]);router[_0x5e5b('0x1d')]('/:id/tags',auth[_0x5e5b('0xc')](),controller[_0x5e5b('0x20')]);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 3f9b1fd..f44258e 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 _0xc893=['STRING','DATE','ENUM','out','BOOLEAN','moment','exports'];(function(_0x5447fd,_0x52a6b5){var _0x15b28a=function(_0x370d4f){while(--_0x370d4f){_0x5447fd['push'](_0x5447fd['shift']());}};_0x15b28a(++_0x52a6b5);}(_0xc893,0x194));var _0x3c89=function(_0x5d17f1,_0x13cde1){_0x5d17f1=_0x5d17f1-0x0;var _0x4d08f7=_0xc893[_0x5d17f1];return _0x4d08f7;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x3c89('0x0'));module[_0x3c89('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x3c89('0x2')]},'secondDisposition':{'type':Sequelize[_0x3c89('0x2')]},'thirdDisposition':{'type':Sequelize[_0x3c89('0x2')]},'note':{'type':Sequelize[_0x3c89('0x2')]},'phone':{'type':Sequelize[_0x3c89('0x2')]},'read1stAt':{'type':Sequelize[_0x3c89('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x3c89('0x4')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x3c89('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x3c89('0x4')]('in',_0x3c89('0x5')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x3c89('0x6')],'defaultValue':![]},'queueId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0xc373=['exports','BOOLEAN','STRING','DATE','ENUM','out','INTEGER','moment'];(function(_0x386a7c,_0x1aaa07){var _0x19ed87=function(_0x4fdc94){while(--_0x4fdc94){_0x386a7c['push'](_0x386a7c['shift']());}};_0x19ed87(++_0x1aaa07);}(_0xc373,0x1c7));var _0x3c37=function(_0x2e819c,_0x3f99a5){_0x2e819c=_0x2e819c-0x0;var _0x24e271=_0xc373[_0x2e819c];return _0x24e271;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x3c37('0x0'));module[_0x3c37('0x1')]={'closed':{'type':Sequelize[_0x3c37('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x3c37('0x3')]},'thirdDisposition':{'type':Sequelize[_0x3c37('0x3')]},'note':{'type':Sequelize[_0x3c37('0x3')]},'phone':{'type':Sequelize[_0x3c37('0x3')]},'read1stAt':{'type':Sequelize[_0x3c37('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x3c37('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x3c37('0x5')]('in',_0x3c37('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x3c37('0x2')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x3c37('0x7')]}}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.controller.js b/server/api/smsInteraction/smsInteraction.controller.js index a92566a..926a4ed 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 _0x06de=['create','body','describe','addMessage','SmsMessage','ids','hasOwnProperty','nolimit','order','sort','where','pick','SmsInteractionId','filter','merge','$gte','split','YYYY-MM-DD\x20HH:mm:ss','count','rows','setTags','spread','color','emit','smsInteractionTags:save','removeTags','download','root','server','files','tmp','join','transcript-%d-%s.zip','push','User','fullname','CmContact','firstName','Messages','createdAt','direction','secret','read','SmsAccount','Account','Owner','get','mkdirSync','Sms','format','closed','closedAt','disposition','out','System','Contact','lastName','views','downloadInteraction.ejs','transcript-','.pdf','unlinkSync','rimraf','zip-dir','moment','bluebird','path','ejs','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsInteraction.socket','register','sendStatus','status','end','json','offset','undefined','limit','update','then','destroy','error','name','send','index','map','SmsInteraction','fieldName','type','key','findAll','sms','query','catch','show','params','model','keys','rawAttributes','filters','intersection','attributes','fields','length','includeAll','include','options','find'];(function(_0x471ee9,_0x1a97ff){var _0x44a386=function(_0x2f0be4){while(--_0x2f0be4){_0x471ee9['push'](_0x471ee9['shift']());}};_0x44a386(++_0x1a97ff);}(_0x06de,0x1a3));var _0xe06d=function(_0x4ca3b4,_0x2450bc){_0x4ca3b4=_0x4ca3b4-0x0;var _0x51ea64=_0x06de[_0x4ca3b4];return _0x51ea64;};'use strict';var rimraf=require(_0xe06d('0x0'));var zipdir=require(_0xe06d('0x1'));var moment=require(_0xe06d('0x2'));var BPromise=require(_0xe06d('0x3'));var util=require('util');var path=require(_0xe06d('0x4'));var ejs=require(_0xe06d('0x5'));var fs=require('fs');var _=require(_0xe06d('0x6'));var Redis=require(_0xe06d('0x7'));var interaction=require(_0xe06d('0x8'));var qs=require(_0xe06d('0x9'));var pdf=require(_0xe06d('0xa'));var logger=require(_0xe06d('0xb'))('api');var config=require(_0xe06d('0xc'));var db=require(_0xe06d('0xd'))['db'];config[_0xe06d('0xe')]=_[_0xe06d('0xf')](config[_0xe06d('0xe')],{'host':_0xe06d('0x10'),'port':0x18eb});var socket=require(_0xe06d('0x11'))(new Redis(config[_0xe06d('0xe')]));require(_0xe06d('0x12'))[_0xe06d('0x13')](socket);function respondWithStatusCode(_0x42463d,_0x524aef){_0x524aef=_0x524aef||0xcc;return function(_0x512448){if(_0x512448){return _0x42463d[_0xe06d('0x14')](_0x524aef);}return _0x42463d[_0xe06d('0x15')](_0x524aef)[_0xe06d('0x16')]();};}function respondWithResult(_0x26b19a,_0x27d7ee){_0x27d7ee=_0x27d7ee||0xc8;return function(_0x198618){if(_0x198618){return _0x26b19a[_0xe06d('0x15')](_0x27d7ee)[_0xe06d('0x17')](_0x198618);}};}function respondWithFilteredResult(_0x3b0f7d,_0x5b8975){return function(_0x33ee52){if(_0x33ee52){var _0x261ce3=typeof _0x5b8975[_0xe06d('0x18')]===_0xe06d('0x19')&&typeof _0x5b8975['limit']===_0xe06d('0x19');var _0x5c8624=_0x33ee52['count'];var _0x30ed8b=_0x261ce3?0x0:_0x5b8975[_0xe06d('0x18')];var _0x5c4404=_0x261ce3?_0x33ee52['count']:_0x5b8975['offset']+_0x5b8975[_0xe06d('0x1a')];var _0x91814b;if(_0x5c4404>=_0x5c8624){_0x5c4404=_0x5c8624;_0x91814b=0xc8;}else{_0x91814b=0xce;}_0x3b0f7d[_0xe06d('0x15')](_0x91814b);return _0x3b0f7d['set']('Content-Range',_0x30ed8b+'-'+_0x5c4404+'/'+_0x5c8624)[_0xe06d('0x17')](_0x33ee52);}return null;};}function saveUpdates(_0x269f63){return function(_0x8a8c1a){if(_0x8a8c1a){return _0x8a8c1a[_0xe06d('0x1b')](_0x269f63)[_0xe06d('0x1c')](function(_0x40a3a7){return _0x40a3a7;});}return null;};}function removeEntity(_0xca0991){return function(_0x28cceb){if(_0x28cceb){return _0x28cceb[_0xe06d('0x1d')]()[_0xe06d('0x1c')](function(){_0xca0991['status'](0xcc)[_0xe06d('0x16')]();});}};}function handleEntityNotFound(_0x57466f){return function(_0x1237c6){if(!_0x1237c6){_0x57466f[_0xe06d('0x14')](0x194);}return _0x1237c6;};}function handleError(_0x2e8524,_0xec3428){_0xec3428=_0xec3428||0x1f4;return function(_0x5709ca){logger[_0xe06d('0x1e')](_0x5709ca['stack']);if(_0x5709ca['name']){delete _0x5709ca[_0xe06d('0x1f')];}_0x2e8524['status'](_0xec3428)[_0xe06d('0x20')](_0x5709ca);};}exports[_0xe06d('0x21')]=function(_0x4ecaba,_0x3dc806){var _0x110a80={};var _0x275226=_[_0xe06d('0x22')](db[_0xe06d('0x23')]['rawAttributes'],function(_0x2b894e){return{'name':_0x2b894e[_0xe06d('0x24')],'type':_0x2b894e[_0xe06d('0x25')][_0xe06d('0x26')]};});_0x110a80=qs['getOptions'](_0x275226,_0x4ecaba);return interaction[_0xe06d('0x27')](_0xe06d('0x28'),_0x4ecaba[_0xe06d('0x29')],_0x4ecaba['user'],_0x110a80,_0x275226)[_0xe06d('0x1c')](respondWithFilteredResult(_0x3dc806,_0x110a80))[_0xe06d('0x2a')](handleError(_0x3dc806,null));};exports[_0xe06d('0x2b')]=function(_0x920392,_0xcd83d5){var _0x3b7463={'raw':![],'where':{'id':_0x920392[_0xe06d('0x2c')]['id']}},_0x9287fc={};_0x9287fc[_0xe06d('0x2d')]=_[_0xe06d('0x2e')](db[_0xe06d('0x23')][_0xe06d('0x2f')]);_0x9287fc[_0xe06d('0x29')]=_[_0xe06d('0x2e')](_0x920392['query']);_0x9287fc[_0xe06d('0x30')]=_[_0xe06d('0x31')](_0x9287fc[_0xe06d('0x2d')],_0x9287fc[_0xe06d('0x29')]);_0x3b7463[_0xe06d('0x32')]=_[_0xe06d('0x31')](_0x9287fc['model'],qs[_0xe06d('0x33')](_0x920392[_0xe06d('0x29')][_0xe06d('0x33')]));_0x3b7463[_0xe06d('0x32')]=_0x3b7463[_0xe06d('0x32')][_0xe06d('0x34')]?_0x3b7463[_0xe06d('0x32')]:_0x9287fc[_0xe06d('0x2d')];if(_0x920392[_0xe06d('0x29')][_0xe06d('0x35')]){_0x3b7463[_0xe06d('0x36')]=[{'all':!![]}];}_0x3b7463=_['merge']({},_0x3b7463,_0x920392[_0xe06d('0x37')]);return db[_0xe06d('0x23')][_0xe06d('0x38')](_0x3b7463)[_0xe06d('0x1c')](handleEntityNotFound(_0xcd83d5,null))[_0xe06d('0x1c')](respondWithResult(_0xcd83d5,null))['catch'](handleError(_0xcd83d5,null));};exports[_0xe06d('0x39')]=function(_0x4cf240,_0x1199a7){return db[_0xe06d('0x23')][_0xe06d('0x39')](_0x4cf240[_0xe06d('0x3a')],{})[_0xe06d('0x1c')](respondWithResult(_0x1199a7,0xc9))['catch'](handleError(_0x1199a7,null));};exports[_0xe06d('0x1b')]=function(_0x276703,_0x3d84cd){if(_0x276703[_0xe06d('0x3a')]['id']){delete _0x276703[_0xe06d('0x3a')]['id'];}return db['SmsInteraction'][_0xe06d('0x38')]({'where':{'id':_0x276703['params']['id']}})['then'](handleEntityNotFound(_0x3d84cd,null))[_0xe06d('0x1c')](saveUpdates(_0x276703[_0xe06d('0x3a')],null))[_0xe06d('0x1c')](respondWithResult(_0x3d84cd,null))[_0xe06d('0x2a')](handleError(_0x3d84cd,null));};exports[_0xe06d('0x1d')]=function(_0x303b2c,_0x5c2962){return db[_0xe06d('0x23')][_0xe06d('0x38')]({'where':{'id':_0x303b2c['params']['id']}})[_0xe06d('0x1c')](handleEntityNotFound(_0x5c2962,null))['then'](removeEntity(_0x5c2962,null))[_0xe06d('0x2a')](handleError(_0x5c2962,null));};exports[_0xe06d('0x3b')]=function(_0xea4ae3,_0x3141e1){return db[_0xe06d('0x23')][_0xe06d('0x3b')]()[_0xe06d('0x1c')](respondWithResult(_0x3141e1,null))['catch'](handleError(_0x3141e1,null));};exports[_0xe06d('0x3c')]=function(_0x570abf,_0x4fb28b){return db[_0xe06d('0x3d')][_0xe06d('0x38')]({'where':{'id':_0x570abf['params']['id']}})[_0xe06d('0x1c')](handleEntityNotFound(_0x4fb28b,null))[_0xe06d('0x1c')](function(_0x5d6350){if(_0x5d6350){return _0x5d6350[_0xe06d('0x3c')](_0x570abf[_0xe06d('0x3a')][_0xe06d('0x3e')],_['omit'](_0x570abf['body'],[_0xe06d('0x3e'),'id'])||{});}})[_0xe06d('0x1c')](respondWithResult(_0x4fb28b,null))[_0xe06d('0x2a')](handleError(_0x4fb28b,null));};exports['getMessages']=function(_0x2ad292,_0x5b4600){var _0x292190={'raw':![],'where':{}};var _0x1890ca={};var _0x35d0ed={'count':0x0,'rows':[]};return db['SmsInteraction']['findOne']({'where':{'id':_0x2ad292['params']['id']}})[_0xe06d('0x1c')](handleEntityNotFound(_0x5b4600,null))[_0xe06d('0x1c')](function(_0x16186a){if(_0x16186a){_0x1890ca[_0xe06d('0x2d')]=_[_0xe06d('0x2e')](db[_0xe06d('0x3d')]['rawAttributes']);_0x1890ca['query']=_['keys'](_0x2ad292[_0xe06d('0x29')]);_0x1890ca[_0xe06d('0x30')]=_[_0xe06d('0x31')](_0x1890ca[_0xe06d('0x2d')],_0x1890ca[_0xe06d('0x29')]);_0x292190['attributes']=_[_0xe06d('0x31')](_0x1890ca[_0xe06d('0x2d')],qs['fields'](_0x2ad292[_0xe06d('0x29')][_0xe06d('0x33')]));_0x292190[_0xe06d('0x32')]=_0x292190[_0xe06d('0x32')]['length']?_0x292190[_0xe06d('0x32')]:_0x1890ca[_0xe06d('0x2d')];if(!_0x2ad292[_0xe06d('0x29')][_0xe06d('0x3f')](_0xe06d('0x40'))){_0x292190[_0xe06d('0x1a')]=qs['limit'](_0x2ad292[_0xe06d('0x29')][_0xe06d('0x1a')]);_0x292190['offset']=qs[_0xe06d('0x18')](_0x2ad292[_0xe06d('0x29')]['offset']);}_0x292190[_0xe06d('0x41')]=qs[_0xe06d('0x42')](_0x2ad292[_0xe06d('0x29')]['sort']);_0x292190[_0xe06d('0x43')]=qs[_0xe06d('0x30')](_[_0xe06d('0x44')](_0x2ad292['query'],_0x1890ca['filters']));_0x292190[_0xe06d('0x43')][_0xe06d('0x45')]=_0x16186a['id'];if(_0x2ad292[_0xe06d('0x29')][_0xe06d('0x46')]){_0x292190['where']=_[_0xe06d('0x47')](_0x292190['where'],{'$or':_[_0xe06d('0x22')](_0x292190[_0xe06d('0x32')],function(_0x274341){var _0x2488e4={};_0x2488e4[_0x274341]={'$like':'%'+_0x2ad292['query'][_0xe06d('0x46')]+'%'};return _0x2488e4;})});}if(_0x2ad292[_0xe06d('0x29')][_0xe06d('0x48')]){var _0x529736=_0x2ad292[_0xe06d('0x29')][_0xe06d('0x48')][_0xe06d('0x49')](',');var _0x53b7b6={};_0x53b7b6[_0x529736[0x0]]={'$gte':moment(_0x529736[0x1])['format'](_0xe06d('0x4a'))};_0x292190[_0xe06d('0x43')]=_[_0xe06d('0x47')](_0x292190[_0xe06d('0x43')],_0x53b7b6);}_0x292190=_[_0xe06d('0x47')]({},_0x292190,_0x2ad292[_0xe06d('0x37')]);return db['SmsMessage'][_0xe06d('0x4b')]({'where':_0x292190[_0xe06d('0x43')]})['then'](function(_0x1a217b){_0x35d0ed[_0xe06d('0x4b')]=_0x1a217b;if(_0x2ad292[_0xe06d('0x29')]['includeAll']){_0x292190['include']=[{'all':!![]}];}return db['SmsMessage'][_0xe06d('0x27')](_0x292190);})['then'](function(_0x2a41ee){_0x35d0ed[_0xe06d('0x4c')]=_0x2a41ee;return _0x35d0ed;});}})[_0xe06d('0x1c')](respondWithFilteredResult(_0x5b4600,_0x292190))[_0xe06d('0x2a')](handleError(_0x5b4600,null));};exports['addTags']=function(_0x4bf871,_0x2bccae){return db['SmsInteraction'][_0xe06d('0x38')]({'where':{'id':_0x4bf871['params']['id']}})[_0xe06d('0x1c')](handleEntityNotFound(_0x2bccae,null))[_0xe06d('0x1c')](function(_0x21c7b5){if(_0x21c7b5){return _0x21c7b5[_0xe06d('0x4d')](_0x4bf871['body'][_0xe06d('0x3e')],_['omit'](_0x4bf871[_0xe06d('0x3a')],[_0xe06d('0x3e'),'id'])||{})[_0xe06d('0x4e')](function(){return db['Tag']['findAll']({'attributes':['id',_0xe06d('0x1f'),_0xe06d('0x4f')],'where':{'id':_0x4bf871['body'][_0xe06d('0x3e')]}});})['then'](function(_0x4d9ec6){socket[_0xe06d('0x50')](_0xe06d('0x51'),{'id':Number(_0x4bf871[_0xe06d('0x2c')]['id']),'tags':_0x4d9ec6||[]});return{'id':Number(_0x4bf871[_0xe06d('0x2c')]['id']),'tags':_0x4d9ec6||[]};});}})[_0xe06d('0x1c')](respondWithResult(_0x2bccae,null))[_0xe06d('0x2a')](handleError(_0x2bccae,null));};exports['removeTags']=function(_0x52a383,_0x5e7dad){return db[_0xe06d('0x23')][_0xe06d('0x38')]({'where':{'id':_0x52a383['params']['id']}})[_0xe06d('0x1c')](handleEntityNotFound(_0x5e7dad,null))[_0xe06d('0x1c')](function(_0x4511a4){if(_0x4511a4){return _0x4511a4[_0xe06d('0x52')](_0x52a383['query'][_0xe06d('0x3e')]);}})['then'](respondWithStatusCode(_0x5e7dad,null))[_0xe06d('0x2a')](handleError(_0x5e7dad,null));};exports[_0xe06d('0x53')]=function(_0x70b865,_0x44170e){var _0x4c4188=moment()['unix']()['toString']();var _0x3df215=path['join'](config[_0xe06d('0x54')],_0xe06d('0x55'),_0xe06d('0x56'),_0xe06d('0x57'));var _0x45726e=path[_0xe06d('0x58')](_0x3df215,_0x4c4188);var _0x2b9ca8=util['format'](_0xe06d('0x59'),_0x70b865[_0xe06d('0x2c')]['id'],_0x4c4188);var _0x4e2be3=path[_0xe06d('0x58')](_0x3df215,_0x2b9ca8);var _0x5be31c=[];_0x5be31c[_0xe06d('0x5a')]({'model':db[_0xe06d('0x5b')],'as':_0xe06d('0x5b'),'attributes':['id',_0xe06d('0x5c')],'raw':!![]});_0x5be31c[_0xe06d('0x5a')]({'model':db[_0xe06d('0x5d')],'as':'Contact','attributes':['id',_0xe06d('0x5e'),'lastName'],'raw':!![]});var _0x5952ce=[{'model':db[_0xe06d('0x3d')],'as':_0xe06d('0x5f'),'attributes':['id',_0xe06d('0x3a'),_0xe06d('0x60'),_0xe06d('0x61'),_0xe06d('0x62'),_0xe06d('0x63')],'include':_0x5be31c}];_0x5952ce[_0xe06d('0x5a')]({'model':db[_0xe06d('0x64')],'as':_0xe06d('0x65'),'attributes':['id','name']});_0x5952ce[_0xe06d('0x5a')]({'model':db['User'],'as':_0xe06d('0x66'),'attributes':['id','fullname']});return db[_0xe06d('0x23')][_0xe06d('0x38')]({'where':{'id':_0x70b865['params']['id']},'include':_0x5952ce})[_0xe06d('0x1c')](handleEntityNotFound(_0x44170e,null))[_0xe06d('0x1c')](function(_0x22fb93){if(_0x22fb93){var _0x496b3e=_0x22fb93[_0xe06d('0x67')]({'plain':!![]});fs[_0xe06d('0x68')](_0x45726e);var _0x20c1e4={'channel':_0xe06d('0x69'),'account':_0x496b3e[_0xe06d('0x65')][_0xe06d('0x1f')],'agent':_0x496b3e['Owner']?_0x496b3e[_0xe06d('0x66')][_0xe06d('0x5c')]:'N.A.','createdAt':moment(_0x496b3e['createdAt'])[_0xe06d('0x6a')](_0xe06d('0x4a'))['toString'](),'closedAt':_0x496b3e[_0xe06d('0x6b')]?moment(_0x496b3e[_0xe06d('0x6c')])[_0xe06d('0x6a')](_0xe06d('0x4a'))['toString']():'','disposition':_0x496b3e[_0xe06d('0x6d')],'messages':_(_0x496b3e[_0xe06d('0x5f')])['filter']({'secret':![]})[_0xe06d('0x22')](function(_0xb88374){return{'date':moment(_0xb88374[_0xe06d('0x60')])[_0xe06d('0x6a')](_0xe06d('0x4a'))['toString'](),'sender':_0xb88374[_0xe06d('0x61')]===_0xe06d('0x6e')?_0xb88374['User']?_0xb88374[_0xe06d('0x5b')]['fullname']:_0xe06d('0x6f'):_0xb88374['Contact'][_0xe06d('0x5e')]+(_0xb88374[_0xe06d('0x70')][_0xe06d('0x71')]?'\x20'+_0xb88374[_0xe06d('0x70')]['lastName']:''),'body':_0xb88374[_0xe06d('0x3a')],'direction':_0xb88374[_0xe06d('0x61')]===_0xe06d('0x6e')?'A':'C','secret':_0xb88374['secret'],'read':_0xb88374['read']};})['value']()};return ejs['renderFile'](path[_0xe06d('0x58')](config[_0xe06d('0x54')],'server',_0xe06d('0x72'),_0xe06d('0x73')),{'interaction':_0x20c1e4})[_0xe06d('0x1c')](function(_0x555aed){var _0x1c1cba=path[_0xe06d('0x58')](_0x45726e,_0xe06d('0x74')+_0x496b3e['id']+'-'+_0x4c4188+_0xe06d('0x75'));var _0xe28941={'path':_0x1c1cba,'channel':'Sms','interactionId':_0x496b3e['id']};return pdf['createPdfFromHTML'](_0x555aed,_0xe28941);})[_0xe06d('0x1c')](function(){return new BPromise(function(_0x2dbe96,_0x423c80){zipdir(_0x45726e,{'saveTo':_0x4e2be3},function(_0x52a013,_0x26db01){if(_0x52a013)return _0x423c80(_0x52a013);return _0x2dbe96(_0x26db01);});})[_0xe06d('0x1c')](function(){return new BPromise(function(_0x4a4020,_0x3c9fd0){rimraf(_0x45726e,function(_0x2421d8){if(_0x2421d8)_0x3c9fd0(_0x2421d8);return _0x4a4020();});});})[_0xe06d('0x1c')](function(){return _0x44170e['download'](_0x4e2be3,_0x2b9ca8,function(_0x5a22fd){if(_0x5a22fd){console['log']('err',_0x5a22fd);}else{fs[_0xe06d('0x76')](_0x4e2be3);}});});});}else{return _0x44170e[_0xe06d('0x14')](0xc8);}})[_0xe06d('0x2a')](handleError(_0x44170e,null));}; \ No newline at end of file +var _0xa65a=['Contact','lastName','Messages','createdAt','direction','secret','read','SmsAccount','Account','Owner','mkdirSync','N.A.','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','toString','out','System','value','server','downloadInteraction.ejs','.pdf','createPdfFromHTML','log','err','unlinkSync','rimraf','util','path','ioredis','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../config/environment','defaults','localhost','socket.io-emitter','redis','./smsInteraction.socket','register','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','update','then','end','error','stack','name','index','map','rawAttributes','type','getOptions','sms','query','user','catch','show','params','model','keys','SmsInteraction','filters','attributes','intersection','fields','include','merge','options','find','create','body','describe','addMessage','SmsMessage','ids','getMessages','findOne','length','hasOwnProperty','nolimit','order','sort','where','filter','$gte','split','includeAll','findAll','addTags','omit','spread','Tag','color','emit','smsInteractionTags:save','removeTags','download','join','root','files','tmp','format','transcript-%d-%s.zip','push','User','fullname','CmContact'];(function(_0x38fe37,_0x55dff6){var _0x22dbe9=function(_0x36d9bb){while(--_0x36d9bb){_0x38fe37['push'](_0x38fe37['shift']());}};_0x22dbe9(++_0x55dff6);}(_0xa65a,0x176));var _0xaa65=function(_0xfc1114,_0x5c3aae){_0xfc1114=_0xfc1114-0x0;var _0x34183b=_0xa65a[_0xfc1114];return _0x34183b;};'use strict';var rimraf=require(_0xaa65('0x0'));var zipdir=require('zip-dir');var moment=require('moment');var BPromise=require('bluebird');var util=require(_0xaa65('0x1'));var path=require(_0xaa65('0x2'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var Redis=require(_0xaa65('0x3'));var interaction=require('../../components/interaction/service');var qs=require(_0xaa65('0x4'));var pdf=require(_0xaa65('0x5'));var logger=require(_0xaa65('0x6'))(_0xaa65('0x7'));var config=require(_0xaa65('0x8'));var db=require('../../mysqldb')['db'];config['redis']=_[_0xaa65('0x9')](config['redis'],{'host':_0xaa65('0xa'),'port':0x18eb});var socket=require(_0xaa65('0xb'))(new Redis(config[_0xaa65('0xc')]));require(_0xaa65('0xd'))[_0xaa65('0xe')](socket);function respondWithStatusCode(_0x187742,_0x45d264){_0x45d264=_0x45d264||0xcc;return function(_0x560ab7){if(_0x560ab7){return _0x187742[_0xaa65('0xf')](_0x45d264);}return _0x187742[_0xaa65('0x10')](_0x45d264)['end']();};}function respondWithResult(_0x54234d,_0x22bd35){_0x22bd35=_0x22bd35||0xc8;return function(_0x4fa736){if(_0x4fa736){return _0x54234d[_0xaa65('0x10')](_0x22bd35)[_0xaa65('0x11')](_0x4fa736);}};}function respondWithFilteredResult(_0xb82770,_0x58086b){return function(_0x4be9b5){if(_0x4be9b5){var _0xe49e54=typeof _0x58086b[_0xaa65('0x12')]===_0xaa65('0x13')&&typeof _0x58086b[_0xaa65('0x14')]==='undefined';var _0x3ca5e9=_0x4be9b5[_0xaa65('0x15')];var _0x478ff3=_0xe49e54?0x0:_0x58086b[_0xaa65('0x12')];var _0x908c58=_0xe49e54?_0x4be9b5[_0xaa65('0x15')]:_0x58086b[_0xaa65('0x12')]+_0x58086b[_0xaa65('0x14')];var _0x58d4d6;if(_0x908c58>=_0x3ca5e9){_0x908c58=_0x3ca5e9;_0x58d4d6=0xc8;}else{_0x58d4d6=0xce;}_0xb82770[_0xaa65('0x10')](_0x58d4d6);return _0xb82770[_0xaa65('0x16')](_0xaa65('0x17'),_0x478ff3+'-'+_0x908c58+'/'+_0x3ca5e9)[_0xaa65('0x11')](_0x4be9b5);}return null;};}function saveUpdates(_0x2bce70){return function(_0x2029eb){if(_0x2029eb){return _0x2029eb[_0xaa65('0x18')](_0x2bce70)[_0xaa65('0x19')](function(_0x2a0651){return _0x2a0651;});}return null;};}function removeEntity(_0x851f42){return function(_0x17ba66){if(_0x17ba66){return _0x17ba66['destroy']()[_0xaa65('0x19')](function(){_0x851f42['status'](0xcc)[_0xaa65('0x1a')]();});}};}function handleEntityNotFound(_0x196c79){return function(_0x16b66b){if(!_0x16b66b){_0x196c79['sendStatus'](0x194);}return _0x16b66b;};}function handleError(_0x76f213,_0x584695){_0x584695=_0x584695||0x1f4;return function(_0x5d4eb2){logger[_0xaa65('0x1b')](_0x5d4eb2[_0xaa65('0x1c')]);if(_0x5d4eb2['name']){delete _0x5d4eb2[_0xaa65('0x1d')];}_0x76f213['status'](_0x584695)['send'](_0x5d4eb2);};}exports[_0xaa65('0x1e')]=function(_0x12b205,_0x40d799){var _0x19cace={};var _0xbcf2ab=_[_0xaa65('0x1f')](db['SmsInteraction'][_0xaa65('0x20')],function(_0x3e9232){return{'name':_0x3e9232['fieldName'],'type':_0x3e9232[_0xaa65('0x21')]['key']};});_0x19cace=qs[_0xaa65('0x22')](_0xbcf2ab,_0x12b205);return interaction['findAll'](_0xaa65('0x23'),_0x12b205[_0xaa65('0x24')],_0x12b205[_0xaa65('0x25')],_0x19cace,_0xbcf2ab)['then'](respondWithFilteredResult(_0x40d799,_0x19cace))[_0xaa65('0x26')](handleError(_0x40d799,null));};exports[_0xaa65('0x27')]=function(_0x5257e4,_0x399231){var _0x35b359={'raw':![],'where':{'id':_0x5257e4[_0xaa65('0x28')]['id']}},_0x2bf870={};_0x2bf870[_0xaa65('0x29')]=_[_0xaa65('0x2a')](db[_0xaa65('0x2b')]['rawAttributes']);_0x2bf870['query']=_[_0xaa65('0x2a')](_0x5257e4[_0xaa65('0x24')]);_0x2bf870[_0xaa65('0x2c')]=_['intersection'](_0x2bf870[_0xaa65('0x29')],_0x2bf870[_0xaa65('0x24')]);_0x35b359[_0xaa65('0x2d')]=_[_0xaa65('0x2e')](_0x2bf870[_0xaa65('0x29')],qs[_0xaa65('0x2f')](_0x5257e4['query'][_0xaa65('0x2f')]));_0x35b359[_0xaa65('0x2d')]=_0x35b359[_0xaa65('0x2d')]['length']?_0x35b359['attributes']:_0x2bf870[_0xaa65('0x29')];if(_0x5257e4[_0xaa65('0x24')]['includeAll']){_0x35b359[_0xaa65('0x30')]=[{'all':!![]}];}_0x35b359=_[_0xaa65('0x31')]({},_0x35b359,_0x5257e4[_0xaa65('0x32')]);return db[_0xaa65('0x2b')][_0xaa65('0x33')](_0x35b359)[_0xaa65('0x19')](handleEntityNotFound(_0x399231,null))[_0xaa65('0x19')](respondWithResult(_0x399231,null))[_0xaa65('0x26')](handleError(_0x399231,null));};exports[_0xaa65('0x34')]=function(_0x56dd8a,_0x4e97ce){return db[_0xaa65('0x2b')]['create'](_0x56dd8a[_0xaa65('0x35')],{})[_0xaa65('0x19')](respondWithResult(_0x4e97ce,0xc9))[_0xaa65('0x26')](handleError(_0x4e97ce,null));};exports[_0xaa65('0x18')]=function(_0x3b6967,_0x4eb563){if(_0x3b6967[_0xaa65('0x35')]['id']){delete _0x3b6967[_0xaa65('0x35')]['id'];}return db[_0xaa65('0x2b')][_0xaa65('0x33')]({'where':{'id':_0x3b6967[_0xaa65('0x28')]['id']}})['then'](handleEntityNotFound(_0x4eb563,null))[_0xaa65('0x19')](saveUpdates(_0x3b6967[_0xaa65('0x35')],null))[_0xaa65('0x19')](respondWithResult(_0x4eb563,null))[_0xaa65('0x26')](handleError(_0x4eb563,null));};exports['destroy']=function(_0x240d52,_0x24e571){return db['SmsInteraction'][_0xaa65('0x33')]({'where':{'id':_0x240d52[_0xaa65('0x28')]['id']}})['then'](handleEntityNotFound(_0x24e571,null))[_0xaa65('0x19')](removeEntity(_0x24e571,null))['catch'](handleError(_0x24e571,null));};exports[_0xaa65('0x36')]=function(_0x507a7b,_0x3d9075){return db[_0xaa65('0x2b')]['describe']()[_0xaa65('0x19')](respondWithResult(_0x3d9075,null))[_0xaa65('0x26')](handleError(_0x3d9075,null));};exports[_0xaa65('0x37')]=function(_0x27e2c9,_0x428c1e){return db[_0xaa65('0x38')]['find']({'where':{'id':_0x27e2c9[_0xaa65('0x28')]['id']}})[_0xaa65('0x19')](handleEntityNotFound(_0x428c1e,null))[_0xaa65('0x19')](function(_0x50407e){if(_0x50407e){return _0x50407e[_0xaa65('0x37')](_0x27e2c9['body'][_0xaa65('0x39')],_['omit'](_0x27e2c9[_0xaa65('0x35')],[_0xaa65('0x39'),'id'])||{});}})[_0xaa65('0x19')](respondWithResult(_0x428c1e,null))[_0xaa65('0x26')](handleError(_0x428c1e,null));};exports[_0xaa65('0x3a')]=function(_0x51ca6f,_0x32f6a4){var _0x24f40e={'raw':![],'where':{}};var _0x13eb75={};var _0x57028a={'count':0x0,'rows':[]};return db[_0xaa65('0x2b')][_0xaa65('0x3b')]({'where':{'id':_0x51ca6f[_0xaa65('0x28')]['id']}})[_0xaa65('0x19')](handleEntityNotFound(_0x32f6a4,null))['then'](function(_0x3e0731){if(_0x3e0731){_0x13eb75[_0xaa65('0x29')]=_[_0xaa65('0x2a')](db['SmsMessage']['rawAttributes']);_0x13eb75['query']=_[_0xaa65('0x2a')](_0x51ca6f['query']);_0x13eb75[_0xaa65('0x2c')]=_['intersection'](_0x13eb75[_0xaa65('0x29')],_0x13eb75[_0xaa65('0x24')]);_0x24f40e['attributes']=_['intersection'](_0x13eb75[_0xaa65('0x29')],qs['fields'](_0x51ca6f[_0xaa65('0x24')][_0xaa65('0x2f')]));_0x24f40e[_0xaa65('0x2d')]=_0x24f40e['attributes'][_0xaa65('0x3c')]?_0x24f40e['attributes']:_0x13eb75[_0xaa65('0x29')];if(!_0x51ca6f['query'][_0xaa65('0x3d')](_0xaa65('0x3e'))){_0x24f40e[_0xaa65('0x14')]=qs[_0xaa65('0x14')](_0x51ca6f['query'][_0xaa65('0x14')]);_0x24f40e[_0xaa65('0x12')]=qs['offset'](_0x51ca6f['query'][_0xaa65('0x12')]);}_0x24f40e[_0xaa65('0x3f')]=qs[_0xaa65('0x40')](_0x51ca6f[_0xaa65('0x24')][_0xaa65('0x40')]);_0x24f40e[_0xaa65('0x41')]=qs[_0xaa65('0x2c')](_['pick'](_0x51ca6f[_0xaa65('0x24')],_0x13eb75[_0xaa65('0x2c')]));_0x24f40e[_0xaa65('0x41')]['SmsInteractionId']=_0x3e0731['id'];if(_0x51ca6f['query'][_0xaa65('0x42')]){_0x24f40e[_0xaa65('0x41')]=_[_0xaa65('0x31')](_0x24f40e[_0xaa65('0x41')],{'$or':_[_0xaa65('0x1f')](_0x24f40e[_0xaa65('0x2d')],function(_0x388294){var _0x16e61e={};_0x16e61e[_0x388294]={'$like':'%'+_0x51ca6f[_0xaa65('0x24')][_0xaa65('0x42')]+'%'};return _0x16e61e;})});}if(_0x51ca6f['query'][_0xaa65('0x43')]){var _0x2fb896=_0x51ca6f[_0xaa65('0x24')][_0xaa65('0x43')][_0xaa65('0x44')](',');var _0x3fa93f={};_0x3fa93f[_0x2fb896[0x0]]={'$gte':moment(_0x2fb896[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x24f40e[_0xaa65('0x41')]=_[_0xaa65('0x31')](_0x24f40e[_0xaa65('0x41')],_0x3fa93f);}_0x24f40e=_[_0xaa65('0x31')]({},_0x24f40e,_0x51ca6f[_0xaa65('0x32')]);return db[_0xaa65('0x38')]['count']({'where':_0x24f40e[_0xaa65('0x41')]})[_0xaa65('0x19')](function(_0x352f72){_0x57028a[_0xaa65('0x15')]=_0x352f72;if(_0x51ca6f['query'][_0xaa65('0x45')]){_0x24f40e[_0xaa65('0x30')]=[{'all':!![]}];}return db[_0xaa65('0x38')][_0xaa65('0x46')](_0x24f40e);})['then'](function(_0x57b25e){_0x57028a['rows']=_0x57b25e;return _0x57028a;});}})[_0xaa65('0x19')](respondWithFilteredResult(_0x32f6a4,_0x24f40e))[_0xaa65('0x26')](handleError(_0x32f6a4,null));};exports[_0xaa65('0x47')]=function(_0x289dd1,_0x2a7b1b){return db[_0xaa65('0x2b')][_0xaa65('0x33')]({'where':{'id':_0x289dd1[_0xaa65('0x28')]['id']}})['then'](handleEntityNotFound(_0x2a7b1b,null))[_0xaa65('0x19')](function(_0x2db3f1){if(_0x2db3f1){return _0x2db3f1['setTags'](_0x289dd1[_0xaa65('0x35')][_0xaa65('0x39')],_[_0xaa65('0x48')](_0x289dd1[_0xaa65('0x35')],[_0xaa65('0x39'),'id'])||{})[_0xaa65('0x49')](function(){return db[_0xaa65('0x4a')][_0xaa65('0x46')]({'attributes':['id',_0xaa65('0x1d'),_0xaa65('0x4b')],'where':{'id':_0x289dd1['body'][_0xaa65('0x39')]}});})[_0xaa65('0x19')](function(_0x2b7def){socket[_0xaa65('0x4c')](_0xaa65('0x4d'),{'id':Number(_0x289dd1[_0xaa65('0x28')]['id']),'tags':_0x2b7def||[]});return{'id':Number(_0x289dd1[_0xaa65('0x28')]['id']),'tags':_0x2b7def||[]};});}})[_0xaa65('0x19')](respondWithResult(_0x2a7b1b,null))['catch'](handleError(_0x2a7b1b,null));};exports[_0xaa65('0x4e')]=function(_0x484c5f,_0x1a0574){return db['SmsInteraction'][_0xaa65('0x33')]({'where':{'id':_0x484c5f[_0xaa65('0x28')]['id']}})[_0xaa65('0x19')](handleEntityNotFound(_0x1a0574,null))['then'](function(_0x1953a2){if(_0x1953a2){return _0x1953a2['removeTags'](_0x484c5f[_0xaa65('0x24')]['ids']);}})['then'](respondWithStatusCode(_0x1a0574,null))[_0xaa65('0x26')](handleError(_0x1a0574,null));};exports[_0xaa65('0x4f')]=function(_0x3ad417,_0x380845){var _0x2e526d=moment()['unix']()['toString']();var _0xf80879=path[_0xaa65('0x50')](config[_0xaa65('0x51')],'server',_0xaa65('0x52'),_0xaa65('0x53'));var _0x40e92c=path[_0xaa65('0x50')](_0xf80879,_0x2e526d);var _0x26ec46=util[_0xaa65('0x54')](_0xaa65('0x55'),_0x3ad417['params']['id'],_0x2e526d);var _0x49b446=path[_0xaa65('0x50')](_0xf80879,_0x26ec46);var _0x1b20d3=[];_0x1b20d3[_0xaa65('0x56')]({'model':db['User'],'as':_0xaa65('0x57'),'attributes':['id',_0xaa65('0x58')],'raw':!![]});_0x1b20d3[_0xaa65('0x56')]({'model':db[_0xaa65('0x59')],'as':_0xaa65('0x5a'),'attributes':['id','firstName',_0xaa65('0x5b')],'raw':!![]});var _0x3f5009=[{'model':db['SmsMessage'],'as':_0xaa65('0x5c'),'attributes':['id',_0xaa65('0x35'),_0xaa65('0x5d'),_0xaa65('0x5e'),_0xaa65('0x5f'),_0xaa65('0x60')],'include':_0x1b20d3}];_0x3f5009[_0xaa65('0x56')]({'model':db[_0xaa65('0x61')],'as':_0xaa65('0x62'),'attributes':['id',_0xaa65('0x1d')]});_0x3f5009['push']({'model':db[_0xaa65('0x57')],'as':_0xaa65('0x63'),'attributes':['id',_0xaa65('0x58')]});return db['SmsInteraction'][_0xaa65('0x33')]({'where':{'id':_0x3ad417['params']['id']},'include':_0x3f5009})[_0xaa65('0x19')](handleEntityNotFound(_0x380845,null))[_0xaa65('0x19')](function(_0x33e69e){if(_0x33e69e){var _0x975a95=_0x33e69e['get']({'plain':!![]});fs[_0xaa65('0x64')](_0x40e92c);var _0x409176={'channel':'Sms','account':_0x975a95[_0xaa65('0x62')][_0xaa65('0x1d')],'agent':_0x975a95['Owner']?_0x975a95['Owner'][_0xaa65('0x58')]:_0xaa65('0x65'),'createdAt':moment(_0x975a95[_0xaa65('0x5d')])['format']('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'closedAt':_0x975a95[_0xaa65('0x66')]?moment(_0x975a95[_0xaa65('0x67')])[_0xaa65('0x54')](_0xaa65('0x68'))[_0xaa65('0x69')]():'','disposition':_0x975a95['disposition'],'messages':_(_0x975a95[_0xaa65('0x5c')])[_0xaa65('0x42')]({'secret':![]})[_0xaa65('0x1f')](function(_0x1ade1f){return{'date':moment(_0x1ade1f[_0xaa65('0x5d')])[_0xaa65('0x54')](_0xaa65('0x68'))[_0xaa65('0x69')](),'sender':_0x1ade1f['direction']===_0xaa65('0x6a')?_0x1ade1f[_0xaa65('0x57')]?_0x1ade1f['User'][_0xaa65('0x58')]:_0xaa65('0x6b'):_0x1ade1f['Contact']['firstName']+(_0x1ade1f[_0xaa65('0x5a')]['lastName']?'\x20'+_0x1ade1f[_0xaa65('0x5a')][_0xaa65('0x5b')]:''),'body':_0x1ade1f[_0xaa65('0x35')],'direction':_0x1ade1f[_0xaa65('0x5e')]===_0xaa65('0x6a')?'A':'C','secret':_0x1ade1f[_0xaa65('0x5f')],'read':_0x1ade1f[_0xaa65('0x60')]};})[_0xaa65('0x6c')]()};return ejs['renderFile'](path[_0xaa65('0x50')](config[_0xaa65('0x51')],_0xaa65('0x6d'),'views',_0xaa65('0x6e')),{'interaction':_0x409176})['then'](function(_0x40f3fb){var _0x6f3dc7=path['join'](_0x40e92c,'transcript-'+_0x975a95['id']+'-'+_0x2e526d+_0xaa65('0x6f'));var _0x5a39c9={'path':_0x6f3dc7,'channel':'Sms','interactionId':_0x975a95['id']};return pdf[_0xaa65('0x70')](_0x40f3fb,_0x5a39c9);})['then'](function(){return new BPromise(function(_0x345ef5,_0x5d359c){zipdir(_0x40e92c,{'saveTo':_0x49b446},function(_0x1127e5,_0xf819d7){if(_0x1127e5)return _0x5d359c(_0x1127e5);return _0x345ef5(_0xf819d7);});})[_0xaa65('0x19')](function(){return new BPromise(function(_0x1c3918,_0x2035a4){rimraf(_0x40e92c,function(_0x3c971e){if(_0x3c971e)_0x2035a4(_0x3c971e);return _0x1c3918();});});})[_0xaa65('0x19')](function(){return _0x380845[_0xaa65('0x4f')](_0x49b446,_0x26ec46,function(_0x592dcb){if(_0x592dcb){console[_0xaa65('0x71')](_0xaa65('0x72'),_0x592dcb);}else{fs[_0xaa65('0x73')](_0x49b446);}});});});}else{return _0x380845[_0xaa65('0xf')](0xc8);}})[_0xaa65('0x26')](handleError(_0x380845,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index bf008cf..df75faa 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 _0x4325=['Users','map','findAll','then','setDataValue','length','emit','catch','exports','events','../../mysqldb','SmsMessage','setMaxListeners','remove','getUsers'];(function(_0x267070,_0x494ad4){var _0x468380=function(_0x26a6a0){while(--_0x26a6a0){_0x267070['push'](_0x267070['shift']());}};_0x468380(++_0x494ad4);}(_0x4325,0x1da));var _0x5432=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x4325[_0x3ab51d];return _0x29a04e;};'use strict';var EventEmitter=require(_0x5432('0x0'));var SmsInteraction=require(_0x5432('0x1'))['db']['SmsInteraction'];var SmsMessage=require(_0x5432('0x1'))['db'][_0x5432('0x2')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x5432('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x5432('0x4')};function emitEvent(_0x36ce53){return function(_0xad26e9,_0x4acbe4,_0x209e2e){_0xad26e9[_0x5432('0x5')]({'attributes':['id'],'raw':!![]})['then'](function(_0x106ec9){_0xad26e9['setDataValue'](_0x5432('0x6'),_0x106ec9[_0x5432('0x7')](function(_0x40e756){return{'id':_0x40e756['id']};}));return SmsMessage[_0x5432('0x8')]({'where':{'SmsInteractionId':_0xad26e9['id'],'direction':'in','read':![]},'raw':!![]});})[_0x5432('0x9')](function(_0x4a9a51){_0xad26e9[_0x5432('0xa')]('unreadMessages',_0x4a9a51[_0x5432('0xb')]);SmsInteractionEvents[_0x5432('0xc')](_0x36ce53+':'+_0xad26e9['id'],_0xad26e9);SmsInteractionEvents[_0x5432('0xc')](_0x36ce53,_0xad26e9);_0x209e2e(null);})[_0x5432('0xd')](_0x209e2e(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsInteraction['hook'](e,emitEvent(event));}}module[_0x5432('0xe')]=SmsInteractionEvents; \ No newline at end of file +var _0x1399=['setDataValue','unreadMessages','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','save','update','remove','getUsers','then','Users','findAll'];(function(_0x583af6,_0x48e7bd){var _0x2f5bc8=function(_0x9702b3){while(--_0x9702b3){_0x583af6['push'](_0x583af6['shift']());}};_0x2f5bc8(++_0x48e7bd);}(_0x1399,0x16c));var _0x9139=function(_0x415429,_0x1e15b8){_0x415429=_0x415429-0x0;var _0x5f3cc5=_0x1399[_0x415429];return _0x5f3cc5;};'use strict';var EventEmitter=require(_0x9139('0x0'));var SmsInteraction=require(_0x9139('0x1'))['db']['SmsInteraction'];var SmsMessage=require(_0x9139('0x1'))['db']['SmsMessage'];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x9139('0x2')](0x0);var events={'afterCreate':_0x9139('0x3'),'afterUpdate':_0x9139('0x4'),'afterDestroy':_0x9139('0x5')};function emitEvent(_0x251798){return function(_0x2acb38,_0x5ac80b,_0x54af2d){_0x2acb38[_0x9139('0x6')]({'attributes':['id'],'raw':!![]})[_0x9139('0x7')](function(_0x4d5d1e){_0x2acb38['setDataValue'](_0x9139('0x8'),_0x4d5d1e['map'](function(_0x504ced){return{'id':_0x504ced['id']};}));return SmsMessage[_0x9139('0x9')]({'where':{'SmsInteractionId':_0x2acb38['id'],'direction':'in','read':![]},'raw':!![]});})[_0x9139('0x7')](function(_0x4830cd){_0x2acb38[_0x9139('0xa')](_0x9139('0xb'),_0x4830cd['length']);SmsInteractionEvents['emit'](_0x251798+':'+_0x2acb38['id'],_0x2acb38);SmsInteractionEvents[_0x9139('0xc')](_0x251798,_0x2acb38);_0x54af2d(null);})[_0x9139('0xd')](_0x54af2d(null));};}for(var e in events){if(events[_0x9139('0xe')](e)){var event=events[e];SmsInteraction[_0x9139('0xf')](e,emitEvent(event));}}module[_0x9139('0x10')]=SmsInteractionEvents; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.model.js b/server/api/smsInteraction/smsInteraction.model.js index 9afb022..2679733 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 _0xd05d=['changed','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','lodash','../../config/logger','bluebird','request-promise','path','rimraf','./smsInteraction.attributes','exports','define','sms_interactions'];(function(_0x2d321f,_0x196439){var _0x16744f=function(_0x539eb7){while(--_0x539eb7){_0x2d321f['push'](_0x2d321f['shift']());}};_0x16744f(++_0x196439);}(_0xd05d,0x162));var _0xdd05=function(_0x43b9f8,_0x2fa525){_0x43b9f8=_0x43b9f8-0x0;var _0x1de094=_0xd05d[_0x43b9f8];return _0x1de094;};'use strict';var _=require(_0xdd05('0x0'));var util=require('util');var logger=require(_0xdd05('0x1'))('api');var moment=require('moment');var BPromise=require(_0xdd05('0x2'));var rp=require(_0xdd05('0x3'));var fs=require('fs');var path=require(_0xdd05('0x4'));var rimraf=require(_0xdd05('0x5'));var config=require('../../config/environment');var attributes=require(_0xdd05('0x6'));module[_0xdd05('0x7')]=function(_0x8e6064,_0x5037e5){return _0x8e6064[_0xdd05('0x8')]('SmsInteraction',attributes,{'tableName':_0xdd05('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1d9db8,_0x4e3494,_0x488cbd){if(_0x1d9db8[_0xdd05('0xa')](_0xdd05('0xb'))){_0x1d9db8[_0xdd05('0xc')]=moment()['format'](_0xdd05('0xd'));}_0x488cbd(null,_0x1d9db8);}}});}; \ No newline at end of file +var _0x5328=['format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','moment','bluebird','path','rimraf','./smsInteraction.attributes','exports','SmsInteraction','sms_interactions','changed','closed','closedAt'];(function(_0x5ead51,_0x20050d){var _0x511fb3=function(_0x4a93f9){while(--_0x4a93f9){_0x5ead51['push'](_0x5ead51['shift']());}};_0x511fb3(++_0x20050d);}(_0x5328,0x15b));var _0x8532=function(_0x82d1f8,_0x5d37a9){_0x82d1f8=_0x82d1f8-0x0;var _0x3290f8=_0x5328[_0x82d1f8];return _0x3290f8;};'use strict';var _=require(_0x8532('0x0'));var util=require(_0x8532('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x8532('0x2'));var BPromise=require(_0x8532('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8532('0x4'));var rimraf=require(_0x8532('0x5'));var config=require('../../config/environment');var attributes=require(_0x8532('0x6'));module[_0x8532('0x7')]=function(_0x8cbb9f,_0x33b8cf){return _0x8cbb9f['define'](_0x8532('0x8'),attributes,{'tableName':_0x8532('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1d372f,_0x4e48bc,_0x5b389b){if(_0x1d372f[_0x8532('0xa')](_0x8532('0xb'))){_0x1d372f[_0x8532('0xc')]=moment()[_0x8532('0xd')](_0x8532('0xe'));}_0x5b389b(null,_0x1d372f);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index 11a26af..a7df457 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 _0x6e0d=['then','stringify','AddTagsToSmsInteraction','find','addTags','ids','omit','spread','AddTags','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./smsInteraction.socket','register','info','SmsInteraction,\x20%s,\x20%s','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','catch','UpdateSmsInteraction','SmsInteraction','update','body','options','raw','where','attributes','limit'];(function(_0x2549ec,_0x20c37e){var _0x30fb2d=function(_0x581287){while(--_0x581287){_0x2549ec['push'](_0x2549ec['shift']());}};_0x30fb2d(++_0x20c37e);}(_0x6e0d,0xbd));var _0xd6e0=function(_0x5dcbc,_0x5cb291){_0x5dcbc=_0x5dcbc-0x0;var _0x4339ef=_0x6e0d[_0x5dcbc];return _0x4339ef;};'use strict';var _=require('lodash');var util=require(_0xd6e0('0x0'));var moment=require(_0xd6e0('0x1'));var BPromise=require(_0xd6e0('0x2'));var rs=require(_0xd6e0('0x3'));var fs=require('fs');var Redis=require(_0xd6e0('0x4'));var db=require(_0xd6e0('0x5'))['db'];var utils=require(_0xd6e0('0x6'));var logger=require(_0xd6e0('0x7'))('rpc');var config=require(_0xd6e0('0x8'));var jayson=require(_0xd6e0('0x9'));var client=jayson[_0xd6e0('0xa')][_0xd6e0('0xb')]({'port':0x232a});config['redis']=_[_0xd6e0('0xc')](config[_0xd6e0('0xd')],{'host':_0xd6e0('0xe'),'port':0x18eb});var socket=require(_0xd6e0('0xf'))(new Redis(config[_0xd6e0('0xd')]));require(_0xd6e0('0x10'))[_0xd6e0('0x11')](socket);function respondWithRpcPromise(_0xeeabef,_0x509744,_0x27c03e){return new BPromise(function(_0x365fa8,_0x8ab3f8){return client['request'](_0xeeabef,_0x27c03e)['then'](function(_0x457ed5){logger[_0xd6e0('0x12')](_0xd6e0('0x13'),_0x509744,'request\x20sent');logger[_0xd6e0('0x14')](_0xd6e0('0x15'),_0x509744,_0xd6e0('0x16'),JSON['stringify'](_0x457ed5));if(_0x457ed5[_0xd6e0('0x17')]){if(_0x457ed5[_0xd6e0('0x17')][_0xd6e0('0x18')]===0x1f4){logger[_0xd6e0('0x17')](_0xd6e0('0x13'),_0x509744,_0x457ed5[_0xd6e0('0x17')][_0xd6e0('0x19')]);return _0x8ab3f8(_0x457ed5['error'][_0xd6e0('0x19')]);}logger['error'](_0xd6e0('0x13'),_0x509744,_0x457ed5['error'][_0xd6e0('0x19')]);return _0x365fa8(_0x457ed5[_0xd6e0('0x17')][_0xd6e0('0x19')]);}else{logger[_0xd6e0('0x12')](_0xd6e0('0x13'),_0x509744,'request\x20sent');_0x365fa8(_0x457ed5['result']['message']);}})[_0xd6e0('0x1a')](function(_0x519537){logger[_0xd6e0('0x17')]('SmsInteraction,\x20%s,\x20%s',_0x509744,_0x519537);_0x8ab3f8(_0x519537);});});}exports[_0xd6e0('0x1b')]=function(_0x5d5b9a){var _0x507622=this;return new Promise(function(_0x5f36e1,_0x13f349){return db[_0xd6e0('0x1c')][_0xd6e0('0x1d')](_0x5d5b9a[_0xd6e0('0x1e')],{'raw':_0x5d5b9a[_0xd6e0('0x1f')]?_0x5d5b9a[_0xd6e0('0x1f')][_0xd6e0('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5d5b9a[_0xd6e0('0x1f')]?_0x5d5b9a['options'][_0xd6e0('0x21')]||null:null,'attributes':_0x5d5b9a[_0xd6e0('0x1f')]?_0x5d5b9a['options'][_0xd6e0('0x22')]||null:null,'limit':_0x5d5b9a[_0xd6e0('0x1f')]?_0x5d5b9a[_0xd6e0('0x1f')][_0xd6e0('0x23')]||null:null})[_0xd6e0('0x24')](function(_0x38fa1d){logger['info'](_0xd6e0('0x1b'),_0x5d5b9a);logger['debug'](_0xd6e0('0x1b'),_0x5d5b9a,JSON[_0xd6e0('0x25')](_0x38fa1d));_0x5f36e1(_0x38fa1d);})[_0xd6e0('0x1a')](function(_0x4139d2){logger[_0xd6e0('0x17')](_0xd6e0('0x1b'),_0x4139d2[_0xd6e0('0x19')],_0x5d5b9a);_0x13f349(_0x507622[_0xd6e0('0x17')](0x1f4,_0x4139d2[_0xd6e0('0x19')]));});});};exports[_0xd6e0('0x26')]=function(_0x30c159){return new Promise(function(_0x443810,_0x47961e){return db[_0xd6e0('0x1c')][_0xd6e0('0x27')]({'where':_0x30c159['options']?_0x30c159['options']['where']||null:null})[_0xd6e0('0x24')](function(_0x454f6d){if(_0x454f6d){return _0x454f6d[_0xd6e0('0x28')](_0x30c159[_0xd6e0('0x1e')][_0xd6e0('0x29')],_[_0xd6e0('0x2a')](_0x30c159[_0xd6e0('0x1e')],[_0xd6e0('0x29'),'id'])||{});}})[_0xd6e0('0x2b')](function(_0x31d551){logger[_0xd6e0('0x12')]('AddTags',_0x30c159);logger['debug'](_0xd6e0('0x2c'),_0x30c159,JSON['stringify'](_0x31d551));_0x443810(_0x31d551);})[_0xd6e0('0x1a')](function(_0x1a1374){logger[_0xd6e0('0x17')](_0xd6e0('0x2c'),_0x1a1374[_0xd6e0('0x19')],_0x30c159);_0x47961e(_this[_0xd6e0('0x17')](0x1f4,_0x1a1374[_0xd6e0('0x19')]));});});}; \ No newline at end of file +var _0x43f9=['./smsInteraction.socket','register','SmsInteraction,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','UpdateSmsInteraction','SmsInteraction','update','body','options','raw','attributes','then','info','AddTagsToSmsInteraction','find','where','addTags','ids','omit','spread','AddTags','debug','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','redis'];(function(_0x3f8be8,_0x4268b2){var _0x16b4c0=function(_0x4e8ead){while(--_0x4e8ead){_0x3f8be8['push'](_0x3f8be8['shift']());}};_0x16b4c0(++_0x4268b2);}(_0x43f9,0x94));var _0x943f=function(_0xa896ef,_0x6a6ee){_0xa896ef=_0xa896ef-0x0;var _0xb956bd=_0x43f9[_0xa896ef];return _0xb956bd;};'use strict';var _=require(_0x943f('0x0'));var util=require(_0x943f('0x1'));var moment=require(_0x943f('0x2'));var BPromise=require(_0x943f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x943f('0x4'));var db=require(_0x943f('0x5'))['db'];var utils=require(_0x943f('0x6'));var logger=require(_0x943f('0x7'))(_0x943f('0x8'));var config=require(_0x943f('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x943f('0xa')]({'port':0x232a});config[_0x943f('0xb')]=_['defaults'](config[_0x943f('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x943f('0xb')]));require(_0x943f('0xc'))[_0x943f('0xd')](socket);function respondWithRpcPromise(_0x5c4820,_0xe47cf0,_0x589af2){return new BPromise(function(_0x25d271,_0x30e4c7){return client['request'](_0x5c4820,_0x589af2)['then'](function(_0x5d4257){logger['info'](_0x943f('0xe'),_0xe47cf0,_0x943f('0xf'));logger['debug']('SmsInteraction,\x20%s,\x20%s,\x20%s',_0xe47cf0,_0x943f('0xf'),JSON[_0x943f('0x10')](_0x5d4257));if(_0x5d4257[_0x943f('0x11')]){if(_0x5d4257[_0x943f('0x11')][_0x943f('0x12')]===0x1f4){logger[_0x943f('0x11')](_0x943f('0xe'),_0xe47cf0,_0x5d4257['error'][_0x943f('0x13')]);return _0x30e4c7(_0x5d4257['error']['message']);}logger['error'](_0x943f('0xe'),_0xe47cf0,_0x5d4257[_0x943f('0x11')][_0x943f('0x13')]);return _0x25d271(_0x5d4257[_0x943f('0x11')][_0x943f('0x13')]);}else{logger['info'](_0x943f('0xe'),_0xe47cf0,_0x943f('0xf'));_0x25d271(_0x5d4257[_0x943f('0x14')][_0x943f('0x13')]);}})[_0x943f('0x15')](function(_0xa10c29){logger['error'](_0x943f('0xe'),_0xe47cf0,_0xa10c29);_0x30e4c7(_0xa10c29);});});}exports[_0x943f('0x16')]=function(_0x45e82e){var _0x59b6cc=this;return new Promise(function(_0x3e2c59,_0x213eb6){return db[_0x943f('0x17')][_0x943f('0x18')](_0x45e82e[_0x943f('0x19')],{'raw':_0x45e82e[_0x943f('0x1a')]?_0x45e82e[_0x943f('0x1a')][_0x943f('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x45e82e[_0x943f('0x1a')]?_0x45e82e[_0x943f('0x1a')]['where']||null:null,'attributes':_0x45e82e[_0x943f('0x1a')]?_0x45e82e[_0x943f('0x1a')][_0x943f('0x1c')]||null:null,'limit':_0x45e82e[_0x943f('0x1a')]?_0x45e82e[_0x943f('0x1a')]['limit']||null:null})[_0x943f('0x1d')](function(_0x1f409c){logger[_0x943f('0x1e')](_0x943f('0x16'),_0x45e82e);logger['debug'](_0x943f('0x16'),_0x45e82e,JSON['stringify'](_0x1f409c));_0x3e2c59(_0x1f409c);})[_0x943f('0x15')](function(_0x10af6e){logger['error'](_0x943f('0x16'),_0x10af6e[_0x943f('0x13')],_0x45e82e);_0x213eb6(_0x59b6cc[_0x943f('0x11')](0x1f4,_0x10af6e[_0x943f('0x13')]));});});};exports[_0x943f('0x1f')]=function(_0x6d3904){return new Promise(function(_0x1aa46c,_0x128f8c){return db[_0x943f('0x17')][_0x943f('0x20')]({'where':_0x6d3904[_0x943f('0x1a')]?_0x6d3904[_0x943f('0x1a')][_0x943f('0x21')]||null:null})[_0x943f('0x1d')](function(_0x122f4c){if(_0x122f4c){return _0x122f4c[_0x943f('0x22')](_0x6d3904[_0x943f('0x19')][_0x943f('0x23')],_[_0x943f('0x24')](_0x6d3904['body'],[_0x943f('0x23'),'id'])||{});}})[_0x943f('0x25')](function(_0x42f0fa){logger[_0x943f('0x1e')](_0x943f('0x26'),_0x6d3904);logger[_0x943f('0x27')]('AddTags',_0x6d3904,JSON[_0x943f('0x10')](_0x42f0fa));_0x1aa46c(_0x42f0fa);})['catch'](function(_0x56b301){logger[_0x943f('0x11')](_0x943f('0x26'),_0x56b301['message'],_0x6d3904);_0x128f8c(_this[_0x943f('0x11')](0x1f4,_0x56b301[_0x943f('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index 026d6b3..689f874 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 _0xc926=['smsInteraction:','save','remove','update','emit','removeListener','length'];(function(_0xb30b6b,_0x204198){var _0x3ac554=function(_0x57b8f1){while(--_0x57b8f1){_0xb30b6b['push'](_0xb30b6b['shift']());}};_0x3ac554(++_0x204198);}(_0xc926,0x1ac));var _0x6c92=function(_0x55bcbb,_0x4fdca6){_0x55bcbb=_0x55bcbb-0x0;var _0x4c98d2=_0xc926[_0x55bcbb];return _0x4c98d2;};'use strict';var SmsInteractionEvents=require('./smsInteraction.events');var events=[_0x6c92('0x0'),_0x6c92('0x1'),_0x6c92('0x2')];function createListener(_0x106792,_0x280694){return function(_0x4d5c39){_0x280694[_0x6c92('0x3')](_0x106792,_0x4d5c39);};}function removeListener(_0x11ee9f,_0x4b9031){return function(){SmsInteractionEvents[_0x6c92('0x4')](_0x11ee9f,_0x4b9031);};}exports['register']=function(_0xf17737){for(var _0x3aac18=0x0,_0x21bf8b=events[_0x6c92('0x5')];_0x3aac18<_0x21bf8b;_0x3aac18++){var _0x470741=events[_0x3aac18];var _0x351fca=createListener(_0x6c92('0x6')+_0x470741,_0xf17737);SmsInteractionEvents['on'](_0x470741,_0x351fca);}}; \ No newline at end of file +var _0xf906=['remove','emit','register','save'];(function(_0xb3b452,_0x582e8e){var _0x238983=function(_0x3bc866){while(--_0x3bc866){_0xb3b452['push'](_0xb3b452['shift']());}};_0x238983(++_0x582e8e);}(_0xf906,0x167));var _0x6f90=function(_0x26bfa3,_0x14eddb){_0x26bfa3=_0x26bfa3-0x0;var _0x37daaf=_0xf906[_0x26bfa3];return _0x37daaf;};'use strict';var SmsInteractionEvents=require('./smsInteraction.events');var events=[_0x6f90('0x0'),_0x6f90('0x1'),'update'];function createListener(_0x3d22b2,_0x5e0ed7){return function(_0x2f157c){_0x5e0ed7[_0x6f90('0x2')](_0x3d22b2,_0x2f157c);};}function removeListener(_0x3946a2,_0x723985){return function(){SmsInteractionEvents['removeListener'](_0x3946a2,_0x723985);};}exports[_0x6f90('0x3')]=function(_0x25af83){for(var _0x215db1=0x0,_0x5f14ad=events['length'];_0x215db1<_0x5f14ad;_0x215db1++){var _0x2e92da=events[_0x215db1];var _0x4baab2=createListener('smsInteraction:'+_0x2e92da,_0x25af83);SmsInteractionEvents['on'](_0x2e92da,_0x4baab2);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index bb0929c..20c3065 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 _0x6f1e=['multer','util','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsMessage.controller','get','isAuthenticated','index','show','post','tracked','sms','smsmessage:create','create','/:id/status','status','put','update','/:id/accept','/:id/reject','delete','/:id','destroy'];(function(_0x291df7,_0x4d98bf){var _0x5c10cd=function(_0x450757){while(--_0x450757){_0x291df7['push'](_0x291df7['shift']());}};_0x5c10cd(++_0x4d98bf);}(_0x6f1e,0x78));var _0xe6f1=function(_0x31115a,_0x456073){_0x31115a=_0x31115a-0x0;var _0x2fc9f4=_0x6f1e[_0x31115a];return _0x2fc9f4;};'use strict';var multer=require(_0xe6f1('0x0'));var util=require(_0xe6f1('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xe6f1('0x2'));var interaction=require(_0xe6f1('0x3'));var config=require(_0xe6f1('0x4'));var controller=require(_0xe6f1('0x5'));router[_0xe6f1('0x6')]('/',auth[_0xe6f1('0x7')](),controller[_0xe6f1('0x8')]);router[_0xe6f1('0x6')]('/describe',auth[_0xe6f1('0x7')](),controller['describe']);router['get']('/:id',auth[_0xe6f1('0x7')](),controller[_0xe6f1('0x9')]);router[_0xe6f1('0xa')]('/',auth[_0xe6f1('0x7')](),interaction[_0xe6f1('0xb')](_0xe6f1('0xc'),_0xe6f1('0xd')),controller[_0xe6f1('0xe')]);router[_0xe6f1('0xa')](_0xe6f1('0xf'),controller[_0xe6f1('0x10')]);router[_0xe6f1('0x11')]('/:id',auth[_0xe6f1('0x7')](),controller[_0xe6f1('0x12')]);router[_0xe6f1('0x11')](_0xe6f1('0x13'),auth['isAuthenticated'](),controller['accept']);router[_0xe6f1('0x11')](_0xe6f1('0x14'),auth[_0xe6f1('0x7')](),controller['reject']);router[_0xe6f1('0x15')](_0xe6f1('0x16'),auth[_0xe6f1('0x7')](),controller[_0xe6f1('0x17')]);module['exports']=router; \ No newline at end of file +var _0x8f9b=['/:id/reject','reject','delete','destroy','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','./smsMessage.controller','get','isAuthenticated','/describe','describe','/:id','show','post','tracked','sms','create','/:id/status','update','put','/:id/accept'];(function(_0xa1e3e3,_0x29fe0e){var _0xc980e9=function(_0x1f5adc){while(--_0x1f5adc){_0xa1e3e3['push'](_0xa1e3e3['shift']());}};_0xc980e9(++_0x29fe0e);}(_0x8f9b,0x162));var _0xb8f9=function(_0x4af9e5,_0x14f208){_0x4af9e5=_0x4af9e5-0x0;var _0x2cac90=_0x8f9b[_0x4af9e5];return _0x2cac90;};'use strict';var multer=require(_0xb8f9('0x0'));var util=require('util');var path=require(_0xb8f9('0x1'));var timeout=require('connect-timeout');var express=require(_0xb8f9('0x2'));var router=express[_0xb8f9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xb8f9('0x4'));var interaction=require(_0xb8f9('0x5'));var config=require('../../config/environment');var controller=require(_0xb8f9('0x6'));router[_0xb8f9('0x7')]('/',auth[_0xb8f9('0x8')](),controller['index']);router[_0xb8f9('0x7')](_0xb8f9('0x9'),auth['isAuthenticated'](),controller[_0xb8f9('0xa')]);router[_0xb8f9('0x7')](_0xb8f9('0xb'),auth['isAuthenticated'](),controller[_0xb8f9('0xc')]);router[_0xb8f9('0xd')]('/',auth['isAuthenticated'](),interaction[_0xb8f9('0xe')](_0xb8f9('0xf'),'smsmessage:create'),controller[_0xb8f9('0x10')]);router[_0xb8f9('0xd')](_0xb8f9('0x11'),controller['status']);router['put'](_0xb8f9('0xb'),auth[_0xb8f9('0x8')](),controller[_0xb8f9('0x12')]);router[_0xb8f9('0x13')](_0xb8f9('0x14'),auth[_0xb8f9('0x8')](),controller['accept']);router['put'](_0xb8f9('0x15'),auth[_0xb8f9('0x8')](),controller[_0xb8f9('0x16')]);router[_0xb8f9('0x17')](_0xb8f9('0xb'),auth[_0xb8f9('0x8')](),controller[_0xb8f9('0x18')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.attributes.js b/server/api/smsMessage/smsMessage.attributes.js index eae3f27..d477b08 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 _0xa14b=['sequelize','exports','TEXT','ENUM','out','STRING','DATE','BOOLEAN'];(function(_0x8a969d,_0x339d9f){var _0x1d8dc7=function(_0x283ec0){while(--_0x283ec0){_0x8a969d['push'](_0x8a969d['shift']());}};_0x1d8dc7(++_0x339d9f);}(_0xa14b,0x68));var _0xba14=function(_0x2258bb,_0x337f26){_0x2258bb=_0x2258bb-0x0;var _0x22c2c1=_0xa14b[_0x2258bb];return _0x22c2c1;};'use strict';var Sequelize=require(_0xba14('0x0'));module[_0xba14('0x1')]={'body':{'type':Sequelize[_0xba14('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0xba14('0x3')]('in','out'),'defaultValue':_0xba14('0x4'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize[_0xba14('0x5')]},'readAt':{'type':Sequelize[_0xba14('0x6')]},'secret':{'type':Sequelize[_0xba14('0x7')],'defaultValue':![]},'providerName':{'type':Sequelize[_0xba14('0x5')]},'providerResponse':{'type':Sequelize[_0xba14('0x2')]}}; \ No newline at end of file +var _0x2159=['ENUM','out','STRING','DATE','BOOLEAN','sequelize','exports','TEXT','medium'];(function(_0x1135b1,_0x644ab2){var _0x387f6b=function(_0x515757){while(--_0x515757){_0x1135b1['push'](_0x1135b1['shift']());}};_0x387f6b(++_0x644ab2);}(_0x2159,0x17f));var _0x9215=function(_0x3e734a,_0x5479d4){_0x3e734a=_0x3e734a-0x0;var _0xe6fc77=_0x2159[_0x3e734a];return _0xe6fc77;};'use strict';var Sequelize=require(_0x9215('0x0'));module[_0x9215('0x1')]={'body':{'type':Sequelize[_0x9215('0x2')](_0x9215('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x9215('0x4')]('in','out'),'defaultValue':_0x9215('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0x9215('0x6')](0xbe)},'phone':{'type':Sequelize[_0x9215('0x6')]},'readAt':{'type':Sequelize[_0x9215('0x7')]},'secret':{'type':Sequelize[_0x9215('0x8')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x9215('0x6')]},'providerResponse':{'type':Sequelize[_0x9215('0x2')]}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index 7f0365e..6a52b2d 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 _0x1cdb=['./smsMessage.socket','register','jayson/promise','client','http','request','then','info','SmsMessage,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','destroy','stack','name','index','SmsMessage','fieldName','type','key','map','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','include','findAll','show','rawAttributes','keys','includeAll','create','body','update','find','params','describe','sms-interactions','sms','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','get','SmsInteraction','SmsInteractionId','isNil','format','interaction','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','QueryTypes','SELECT','User','agent','fullname','email','internal','interface','SIP/%s','channel','motionChannel','accept','EventManager','acceptmessage','../../config/logger','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','sequelize','contact','event','SmsAccount','SmsAccountId','SmsMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','twilio','MessageSid','SmsAccount,\x20%s,\x20%s,\x20%s','inspect','plivo','MessageUUID','messageId','indexOf','sent','delivered','Status','plivio','infobip','results','groupName','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost'];(function(_0x3e4419,_0x454b62){var _0x218914=function(_0x5d7eff){while(--_0x5d7eff){_0x3e4419['push'](_0x3e4419['shift']());}};_0x218914(++_0x454b62);}(_0x1cdb,0x117));var _0xb1cd=function(_0x31a597,_0x567f20){_0x31a597=_0x31a597-0x0;var _0x3a8f0e=_0x1cdb[_0x31a597];return _0x3a8f0e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb1cd('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xb1cd('0x1'));var moment=require(_0xb1cd('0x2'));var BPromise=require(_0xb1cd('0x3'));var Mustache=require(_0xb1cd('0x4'));var util=require(_0xb1cd('0x5'));var path=require(_0xb1cd('0x6'));var sox=require(_0xb1cd('0x7'));var csv=require(_0xb1cd('0x8'));var ejs=require(_0xb1cd('0x9'));var fs=require('fs');var fs_extra=require(_0xb1cd('0xa'));var _=require(_0xb1cd('0xb'));var squel=require(_0xb1cd('0xc'));var crypto=require(_0xb1cd('0xd'));var jsforce=require(_0xb1cd('0xe'));var deskjs=require(_0xb1cd('0xf'));var toCsv=require(_0xb1cd('0x8'));var querystring=require(_0xb1cd('0x10'));var Papa=require(_0xb1cd('0x11'));var Redis=require('ioredis');var authService=require(_0xb1cd('0x12'));var qs=require(_0xb1cd('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb1cd('0x14'));var logger=require('../../config/logger')(_0xb1cd('0x15'));var utils=require(_0xb1cd('0x16'));var config=require(_0xb1cd('0x17'));var licenseUtil=require(_0xb1cd('0x18'));var db=require(_0xb1cd('0x19'))['db'];config[_0xb1cd('0x1a')]=_[_0xb1cd('0x1b')](config[_0xb1cd('0x1a')],{'host':_0xb1cd('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb1cd('0x1a')]));require(_0xb1cd('0x1d'))[_0xb1cd('0x1e')](socket);var jayson=require(_0xb1cd('0x1f'));var client=jayson[_0xb1cd('0x20')][_0xb1cd('0x21')]({'port':0x232c});var client9002=jayson[_0xb1cd('0x20')][_0xb1cd('0x21')]({'port':0x232a});function respondWithRpcPromise(_0x5055cf,_0x4cbcc4,_0x4e267c,_0xef1d6){return new BPromise(function(_0x2f4584,_0x2cc86e){var _0xbd8d6c=_0xef1d6||client;return _0xbd8d6c[_0xb1cd('0x22')](_0x5055cf,_0x4e267c)[_0xb1cd('0x23')](function(_0xb9dc57){logger[_0xb1cd('0x24')](_0xb1cd('0x25'),_0x4cbcc4,'request\x20sent');logger[_0xb1cd('0x26')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x4cbcc4,_0xb1cd('0x27'),JSON[_0xb1cd('0x28')](_0xb9dc57));if(_0xb9dc57['error']){if(_0xb9dc57[_0xb1cd('0x29')][_0xb1cd('0x2a')]===0x1f4){logger[_0xb1cd('0x29')]('SmsMessage,\x20%s,\x20%s',_0x4cbcc4,_0xb9dc57[_0xb1cd('0x29')][_0xb1cd('0x2b')]);return _0x2cc86e(_0xb9dc57[_0xb1cd('0x29')]['message']);}logger[_0xb1cd('0x29')](_0xb1cd('0x25'),_0x4cbcc4,_0xb9dc57[_0xb1cd('0x29')][_0xb1cd('0x2b')]);return _0x2f4584(_0xb9dc57[_0xb1cd('0x29')][_0xb1cd('0x2b')]);}else{logger[_0xb1cd('0x24')]('SmsMessage,\x20%s,\x20%s',_0x4cbcc4,_0xb1cd('0x27'));_0x2f4584(_0xb9dc57[_0xb1cd('0x2c')][_0xb1cd('0x2b')]);}})[_0xb1cd('0x2d')](function(_0x4d6288){logger[_0xb1cd('0x29')](_0xb1cd('0x25'),_0x4cbcc4,_0x4d6288);_0x2cc86e(_0x4d6288);});});}function respondWithStatusCode(_0x6d0ec1,_0x49b470){_0x49b470=_0x49b470||0xcc;return function(_0x5c9b3f){if(_0x5c9b3f){return _0x6d0ec1['sendStatus'](_0x49b470);}return _0x6d0ec1[_0xb1cd('0x2e')](_0x49b470)[_0xb1cd('0x2f')]();};}function respondWithResult(_0x4ad880,_0x51d8a8){_0x51d8a8=_0x51d8a8||0xc8;return function(_0xed5006){if(_0xed5006){return _0x4ad880['status'](_0x51d8a8)[_0xb1cd('0x30')](_0xed5006);}};}function respondWithFilteredResult(_0x1eaf78,_0x21606a){return function(_0x3d6524){if(_0x3d6524){var _0xe5e19e=typeof _0x21606a[_0xb1cd('0x31')]===_0xb1cd('0x32')&&typeof _0x21606a[_0xb1cd('0x33')]===_0xb1cd('0x32');var _0x3f44ec=_0x3d6524[_0xb1cd('0x34')];var _0x530cb4=_0xe5e19e?0x0:_0x21606a[_0xb1cd('0x31')];var _0x493173=_0xe5e19e?_0x3d6524[_0xb1cd('0x34')]:_0x21606a[_0xb1cd('0x31')]+_0x21606a[_0xb1cd('0x33')];var _0xcd9f1c;if(_0x493173>=_0x3f44ec){_0x493173=_0x3f44ec;_0xcd9f1c=0xc8;}else{_0xcd9f1c=0xce;}_0x1eaf78[_0xb1cd('0x2e')](_0xcd9f1c);return _0x1eaf78[_0xb1cd('0x35')](_0xb1cd('0x36'),_0x530cb4+'-'+_0x493173+'/'+_0x3f44ec)[_0xb1cd('0x30')](_0x3d6524);}return null;};}function patchUpdates(_0x3e76a5){return function(_0x5a096d){try{jsonpatch['apply'](_0x5a096d,_0x3e76a5,!![]);}catch(_0x43f44c){return BPromise[_0xb1cd('0x37')](_0x43f44c);}return _0x5a096d[_0xb1cd('0x38')]();};}function saveUpdates(_0x3977d4,_0x558352){return function(_0x2b62e0){if(_0x2b62e0){return _0x2b62e0['update'](_0x3977d4)['then'](function(_0x2916e5){return _0x2916e5;});}return null;};}function removeEntity(_0x12b562,_0x4367be){return function(_0x4fb32a){if(_0x4fb32a){return _0x4fb32a[_0xb1cd('0x39')]()[_0xb1cd('0x23')](function(){_0x12b562[_0xb1cd('0x2e')](0xcc)[_0xb1cd('0x2f')]();});}};}function handleEntityNotFound(_0x496761,_0x41c240){return function(_0x167303){if(!_0x167303){_0x496761['sendStatus'](0x194);}return _0x167303;};}function handleError(_0x46ce6a,_0x1455c5){_0x1455c5=_0x1455c5||0x1f4;return function(_0x157360){logger['error'](_0x157360[_0xb1cd('0x3a')]);if(_0x157360[_0xb1cd('0x3b')]){delete _0x157360['name'];}_0x46ce6a['status'](_0x1455c5)['send'](_0x157360);};}exports[_0xb1cd('0x3c')]=function(_0x3c6835,_0x503d55){var _0x4e6a7a={},_0x43780f={},_0x17f8f2={'count':0x0,'rows':[]};var _0x62c8f=_['map'](db[_0xb1cd('0x3d')]['rawAttributes'],function(_0x496a46){return{'name':_0x496a46[_0xb1cd('0x3e')],'type':_0x496a46[_0xb1cd('0x3f')][_0xb1cd('0x40')]};});_0x43780f['model']=_[_0xb1cd('0x41')](_0x62c8f,_0xb1cd('0x3b'));_0x43780f[_0xb1cd('0x42')]=_['keys'](_0x3c6835[_0xb1cd('0x42')]);_0x43780f[_0xb1cd('0x43')]=_[_0xb1cd('0x44')](_0x43780f[_0xb1cd('0x45')],_0x43780f[_0xb1cd('0x42')]);_0x4e6a7a[_0xb1cd('0x46')]=_[_0xb1cd('0x44')](_0x43780f['model'],qs['fields'](_0x3c6835[_0xb1cd('0x42')][_0xb1cd('0x47')]));_0x4e6a7a[_0xb1cd('0x46')]=_0x4e6a7a[_0xb1cd('0x46')][_0xb1cd('0x48')]?_0x4e6a7a[_0xb1cd('0x46')]:_0x43780f[_0xb1cd('0x45')];if(!_0x3c6835[_0xb1cd('0x42')][_0xb1cd('0x49')](_0xb1cd('0x4a'))){_0x4e6a7a[_0xb1cd('0x33')]=qs[_0xb1cd('0x33')](_0x3c6835[_0xb1cd('0x42')][_0xb1cd('0x33')]);_0x4e6a7a['offset']=qs[_0xb1cd('0x31')](_0x3c6835[_0xb1cd('0x42')]['offset']);}_0x4e6a7a[_0xb1cd('0x4b')]=qs[_0xb1cd('0x4c')](_0x3c6835[_0xb1cd('0x42')][_0xb1cd('0x4c')]);_0x4e6a7a[_0xb1cd('0x4d')]=qs['filters'](_[_0xb1cd('0x4e')](_0x3c6835[_0xb1cd('0x42')],_0x43780f[_0xb1cd('0x43')]),_0x62c8f);if(_0x3c6835['query'][_0xb1cd('0x4f')]){_0x4e6a7a[_0xb1cd('0x4d')]=_[_0xb1cd('0x50')](_0x4e6a7a[_0xb1cd('0x4d')],{'$or':_[_0xb1cd('0x41')](_0x62c8f,function(_0x2cdc89){if(_0x2cdc89[_0xb1cd('0x3f')]!=='VIRTUAL'){var _0x31f49a={};_0x31f49a[_0x2cdc89['name']]={'$like':'%'+_0x3c6835['query'][_0xb1cd('0x4f')]+'%'};return _0x31f49a;}})});}_0x4e6a7a=_['merge']({},_0x4e6a7a,_0x3c6835[_0xb1cd('0x51')]);var _0x5900eb={'where':_0x4e6a7a['where']};return db[_0xb1cd('0x3d')][_0xb1cd('0x34')](_0x5900eb)['then'](function(_0x3ef0b4){_0x17f8f2['count']=_0x3ef0b4;if(_0x3c6835[_0xb1cd('0x42')]['includeAll']){_0x4e6a7a[_0xb1cd('0x52')]=[{'all':!![]}];}return db[_0xb1cd('0x3d')][_0xb1cd('0x53')](_0x4e6a7a);})[_0xb1cd('0x23')](function(_0x2c099c){_0x17f8f2['rows']=_0x2c099c;return _0x17f8f2;})[_0xb1cd('0x23')](respondWithFilteredResult(_0x503d55,_0x4e6a7a))[_0xb1cd('0x2d')](handleError(_0x503d55,null));};exports[_0xb1cd('0x54')]=function(_0x4a8810,_0x1e4a63){var _0x5a5431={'raw':!![],'where':{'id':_0x4a8810['params']['id']}},_0x1bbc16={};_0x1bbc16[_0xb1cd('0x45')]=_['keys'](db[_0xb1cd('0x3d')][_0xb1cd('0x55')]);_0x1bbc16[_0xb1cd('0x42')]=_[_0xb1cd('0x56')](_0x4a8810[_0xb1cd('0x42')]);_0x1bbc16['filters']=_[_0xb1cd('0x44')](_0x1bbc16[_0xb1cd('0x45')],_0x1bbc16[_0xb1cd('0x42')]);_0x5a5431[_0xb1cd('0x46')]=_[_0xb1cd('0x44')](_0x1bbc16['model'],qs[_0xb1cd('0x47')](_0x4a8810[_0xb1cd('0x42')][_0xb1cd('0x47')]));_0x5a5431['attributes']=_0x5a5431[_0xb1cd('0x46')][_0xb1cd('0x48')]?_0x5a5431[_0xb1cd('0x46')]:_0x1bbc16[_0xb1cd('0x45')];if(_0x4a8810['query'][_0xb1cd('0x57')]){_0x5a5431['include']=[{'all':!![]}];}_0x5a5431=_[_0xb1cd('0x50')]({},_0x5a5431,_0x4a8810[_0xb1cd('0x51')]);return db[_0xb1cd('0x3d')]['find'](_0x5a5431)[_0xb1cd('0x23')](handleEntityNotFound(_0x1e4a63,null))['then'](respondWithResult(_0x1e4a63,null))['catch'](handleError(_0x1e4a63,null));};exports[_0xb1cd('0x58')]=function(_0x408aee,_0x99aa09){return db[_0xb1cd('0x3d')][_0xb1cd('0x58')](_0x408aee[_0xb1cd('0x59')],{})[_0xb1cd('0x23')](respondWithResult(_0x99aa09,0xc9))[_0xb1cd('0x2d')](handleError(_0x99aa09,null));};exports[_0xb1cd('0x5a')]=function(_0x13e3a4,_0x22b7b2){if(_0x13e3a4[_0xb1cd('0x59')]['id']){delete _0x13e3a4[_0xb1cd('0x59')]['id'];}return db[_0xb1cd('0x3d')][_0xb1cd('0x5b')]({'where':{'id':_0x13e3a4[_0xb1cd('0x5c')]['id']}})[_0xb1cd('0x23')](handleEntityNotFound(_0x22b7b2,null))[_0xb1cd('0x23')](saveUpdates(_0x13e3a4[_0xb1cd('0x59')],null))[_0xb1cd('0x23')](respondWithResult(_0x22b7b2,null))[_0xb1cd('0x2d')](handleError(_0x22b7b2,null));};exports[_0xb1cd('0x39')]=function(_0x514d82,_0x295624){return db['SmsMessage']['find']({'where':{'id':_0x514d82['params']['id']}})[_0xb1cd('0x23')](handleEntityNotFound(_0x295624,null))[_0xb1cd('0x23')](removeEntity(_0x295624,null))[_0xb1cd('0x2d')](handleError(_0x295624,null));};exports[_0xb1cd('0x5d')]=function(_0x4dd819,_0x3ffe81){return db[_0xb1cd('0x3d')]['describe']()['then'](respondWithResult(_0x3ffe81,null))[_0xb1cd('0x2d')](handleError(_0x3ffe81,null));};var interaction_log=require('../../config/logger')(_0xb1cd('0x5e'));exports['accept']=function(_0x48d6d7,_0xb3ff57,_0x4bf575){var _0x25583d={'agent':{},'channel':_0xb1cd('0x5f')};if(_0x48d6d7[_0xb1cd('0x59')]['id']){delete _0x48d6d7['body']['id'];}_0x48d6d7[_0xb1cd('0x59')][_0xb1cd('0x60')]=!![];_0x48d6d7['body'][_0xb1cd('0x61')]=moment()['format'](_0xb1cd('0x62'));_0x48d6d7[_0xb1cd('0x59')]['UserId']=_0x48d6d7['body'][_0xb1cd('0x63')]||_0x48d6d7['user']['id'];_0x25583d['agent']['id']=_0x48d6d7['body'][_0xb1cd('0x63')];return db[_0xb1cd('0x3d')]['find']({'where':{'id':_0x48d6d7[_0xb1cd('0x5c')]['id'],'UserId':null}})[_0xb1cd('0x23')](handleEntityNotFound(_0xb3ff57,null))['then'](saveUpdates(_0x48d6d7[_0xb1cd('0x59')],null))[_0xb1cd('0x23')](function(_0x20422a){if(_0x20422a){_0x25583d[_0xb1cd('0x2b')]=_0x20422a[_0xb1cd('0x64')]({'plain':!![]});return db[_0xb1cd('0x65')]['find']({'where':{'id':_0x20422a[_0xb1cd('0x66')]}});}return null;})[_0xb1cd('0x23')](handleEntityNotFound(_0xb3ff57,null))[_0xb1cd('0x23')](function(_0x584441){if(_0x584441){return _0x584441[_0xb1cd('0x5a')]({'UserId':_0x48d6d7[_0xb1cd('0x59')][_0xb1cd('0x63')],'read1stAt':_[_0xb1cd('0x67')](_0x584441['read1stAt'])?moment()[_0xb1cd('0x68')](_0xb1cd('0x62')):undefined});}return null;})[_0xb1cd('0x23')](function(_0x46967e){if(_0x46967e){_0x25583d[_0xb1cd('0x69')]=_0x46967e['get']({'plain':!![]});interaction_log[_0xb1cd('0x24')](_0xb1cd('0x6a'),_0x48d6d7[_0xb1cd('0x6b')]['id'],_0x48d6d7[_0xb1cd('0x6b')][_0xb1cd('0x3b')],_0x48d6d7['user']['role'],_0x25583d[_0xb1cd('0x69')]['id'],_0x48d6d7[_0xb1cd('0x59')]?JSON[_0xb1cd('0x28')](_0x48d6d7[_0xb1cd('0x59')]):_0xb1cd('0x6c'));return respondWithRpcPromise(_0xb1cd('0x6d'),_0xb1cd('0x6e'),_0x25583d);}return null;})['then'](function(_0x343b1e){var _0x10b96f=_0xb1cd('0x6f')+_0x343b1e[_0xb1cd('0x2b')][_0xb1cd('0x70')];return db['sequelize'][_0xb1cd('0x42')](_0x10b96f,{'type':db[_0xb1cd('0x71')][_0xb1cd('0x72')][_0xb1cd('0x73')],'raw':!![]})[_0xb1cd('0x23')](function(_0x4ef5a2){return _0x4ef5a2;});})[_0xb1cd('0x23')](function(_0x420f4e){if(_0x420f4e){_0x25583d['message']['contact']=_0x420f4e[0x0];if(!_0x48d6d7[_0xb1cd('0x59')][_0xb1cd('0x63')])return;return db[_0xb1cd('0x74')][_0xb1cd('0x5b')]({'where':{'id':_0x48d6d7['body'][_0xb1cd('0x63')],'role':_0xb1cd('0x75')},'attributes':['id','name',_0xb1cd('0x76'),_0xb1cd('0x77'),_0xb1cd('0x78')],'raw':!![]});}return null;})['then'](function(_0x1d928d){if(!_0x1d928d)return null;_0x25583d[_0xb1cd('0x2b')][_0xb1cd('0x75')]=_0x1d928d;return _0x25583d;})[_0xb1cd('0x23')](function(_0x1819b9){if(_0x1819b9){if(_0x48d6d7['body']['manual']){_0x25583d[_0xb1cd('0x2b')][_0xb1cd('0x79')]=util[_0xb1cd('0x68')](_0xb1cd('0x7a'),_0x48d6d7[_0xb1cd('0x6b')][_0xb1cd('0x3b')]);_0x25583d[_0xb1cd('0x2b')][_0xb1cd('0x7b')]=_0x25583d[_0xb1cd('0x7b')];_0x25583d[_0xb1cd('0x2b')][_0xb1cd('0x7c')]=_0x25583d['channel'];_0x25583d[_0xb1cd('0x2b')]['event']=_0xb1cd('0x7d');return respondWithRpcPromise(_0xb1cd('0x7e'),'EventManager',{'event':_0xb1cd('0x7f'),'message':_0x25583d[_0xb1cd('0x2b')]},client9002)[_0xb1cd('0x23')](function(){return _0x25583d;});}return _0x25583d;}return null;})[_0xb1cd('0x23')](respondWithResult(_0xb3ff57,null))[_0xb1cd('0x2d')](handleError(_0xb3ff57,null));};var interaction_log=require(_0xb1cd('0x80'))('sms-interactions');exports[_0xb1cd('0x37')]=function(_0x297339,_0x28cd76,_0x59a146){var _0x1dca70={'agent':{},'channel':_0xb1cd('0x5f')};if(_0x297339[_0xb1cd('0x59')]['id']){delete _0x297339[_0xb1cd('0x59')]['id'];}_0x297339[_0xb1cd('0x59')][_0xb1cd('0x63')]=_0x297339[_0xb1cd('0x59')][_0xb1cd('0x63')]||_0x297339['user']['id'];_0x1dca70[_0xb1cd('0x75')]['id']=_0x297339[_0xb1cd('0x59')][_0xb1cd('0x63')];return db[_0xb1cd('0x3d')][_0xb1cd('0x5b')]({'where':{'id':_0x297339[_0xb1cd('0x5c')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x28cd76,null))[_0xb1cd('0x23')](function(_0x1f52a3){if(_0x1f52a3){_0x1dca70[_0xb1cd('0x2b')]=_0x1f52a3[_0xb1cd('0x64')]({'plain':!![]});return db[_0xb1cd('0x65')][_0xb1cd('0x5b')]({'where':{'id':_0x1f52a3['SmsInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x28cd76,null))[_0xb1cd('0x23')](function(_0x4cf497){if(_0x4cf497){_0x1dca70[_0xb1cd('0x69')]=_0x4cf497[_0xb1cd('0x64')]({'plain':!![]});interaction_log[_0xb1cd('0x24')](_0xb1cd('0x81'),_0x297339['user']['id'],_0x297339['user'][_0xb1cd('0x3b')],_0x297339[_0xb1cd('0x6b')]['role'],_0x1dca70['interaction']['id'],_0x297339[_0xb1cd('0x59')]?JSON[_0xb1cd('0x28')](_0x297339['body']):_0xb1cd('0x6c'));return respondWithRpcPromise(_0xb1cd('0x82'),_0xb1cd('0x83'),_0x1dca70);}return null;})[_0xb1cd('0x23')](function(_0x3361cb){var _0xedd95c='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x3361cb['message']['ContactId'];return db[_0xb1cd('0x84')][_0xb1cd('0x42')](_0xedd95c,{'type':db[_0xb1cd('0x71')][_0xb1cd('0x72')][_0xb1cd('0x73')],'raw':!![]})[_0xb1cd('0x23')](function(_0x39eb4d){return _0x39eb4d;});})['then'](function(_0x274ece){if(_0x274ece){_0x1dca70[_0xb1cd('0x2b')][_0xb1cd('0x85')]=_0x274ece[0x0];if(!_0x297339[_0xb1cd('0x59')][_0xb1cd('0x63')])return;return db[_0xb1cd('0x74')]['find']({'where':{'id':_0x297339[_0xb1cd('0x59')][_0xb1cd('0x63')],'role':_0xb1cd('0x75')},'attributes':['id',_0xb1cd('0x3b'),_0xb1cd('0x76'),_0xb1cd('0x77'),'internal'],'raw':!![]});}return null;})[_0xb1cd('0x23')](function(_0x553972){if(!_0x553972)return null;_0x1dca70[_0xb1cd('0x2b')]['agent']=_0x553972;return _0x1dca70;})['then'](function(_0xccf129){if(_0xccf129){_0xccf129[_0xb1cd('0x2b')][_0xb1cd('0x79')]=util[_0xb1cd('0x68')](_0xb1cd('0x7a'),_0x297339[_0xb1cd('0x6b')][_0xb1cd('0x3b')]);_0xccf129['message'][_0xb1cd('0x7b')]=_0x1dca70[_0xb1cd('0x7b')];_0xccf129[_0xb1cd('0x2b')][_0xb1cd('0x7c')]=_0x1dca70[_0xb1cd('0x7b')];_0xccf129[_0xb1cd('0x2b')][_0xb1cd('0x86')]='reject';respondWithRpcPromise('EventManager','EventManager',{'event':'rejectmessage','message':_0xccf129['message']},client9002);return _0x1dca70;}return null;})[_0xb1cd('0x23')](respondWithResult(_0x28cd76,null))[_0xb1cd('0x2d')](handleError(_0x28cd76,null));};exports[_0xb1cd('0x2e')]=function(_0x5ec01b,_0x4c5cf6,_0x13d3fe){if(_0x5ec01b[_0xb1cd('0x59')]['id']){delete _0x5ec01b[_0xb1cd('0x59')]['id'];}var _0x4e0a80;return db[_0xb1cd('0x3d')][_0xb1cd('0x5b')]({'where':{'id':_0x5ec01b[_0xb1cd('0x5c')]['id']}})[_0xb1cd('0x23')](handleEntityNotFound(_0x4c5cf6,null))[_0xb1cd('0x23')](function(_0x4e0e21){if(_0x4e0e21){_0x4e0a80=_0x4e0e21;return db[_0xb1cd('0x87')]['find']({'where':{'id':_0x4e0e21[_0xb1cd('0x88')]}});}})[_0xb1cd('0x23')](handleEntityNotFound(_0x4c5cf6,null))['then'](function(_0x2d6199){if(_0x2d6199){logger[_0xb1cd('0x26')](_0xb1cd('0x89'),'status',_0xb1cd('0x8a'),_0x2d6199[_0xb1cd('0x3f')],util['inspect'](_0x5ec01b['body'],{'showHidden':![],'depth':null}));switch(_0x2d6199['type']){case _0xb1cd('0x8b'):if(_0x5ec01b['body']['MessageSid']&&_0x5ec01b[_0xb1cd('0x59')][_0xb1cd('0x8c')]===_0x4e0a80['messageId']){return _0x4e0a80[_0xb1cd('0x5a')]({'read':!![]});}else{logger[_0xb1cd('0x29')](_0xb1cd('0x8d'),'status',_0xb1cd('0x8b'),util[_0xb1cd('0x8e')](_0x5ec01b[_0xb1cd('0x59')],{'showHidden':![],'depth':null}));}break;case _0xb1cd('0x8f'):if(_0x5ec01b[_0xb1cd('0x59')]['MessageUUID']&&_0x5ec01b[_0xb1cd('0x59')][_0xb1cd('0x90')]===_0x4e0a80[_0xb1cd('0x91')]&&_[_0xb1cd('0x92')]([_0xb1cd('0x93'),_0xb1cd('0x94')],_0x5ec01b[_0xb1cd('0x59')][_0xb1cd('0x95')])>=0x0){return _0x4e0a80['update']({'read':!![]});}else{logger[_0xb1cd('0x29')](_0xb1cd('0x8d'),'status',_0xb1cd('0x96'),util[_0xb1cd('0x8e')](_0x5ec01b[_0xb1cd('0x59')],{'showHidden':![],'depth':null}));}break;case _0xb1cd('0x97'):var _0x447d02=_0x5ec01b[_0xb1cd('0x59')][_0xb1cd('0x98')][0x0];if(_0x447d02['status'][_0xb1cd('0x99')]==='DELIVERED'){return _0x4e0a80[_0xb1cd('0x5a')]({'read':!![]});}else{logger[_0xb1cd('0x29')](_0xb1cd('0x8d'),_0xb1cd('0x2e'),'infobip',util[_0xb1cd('0x8e')](_0x5ec01b['body'],{'showHidden':![],'depth':null}));}break;}return _0x4e0a80;}})[_0xb1cd('0x23')](respondWithResult(_0x4c5cf6,null))[_0xb1cd('0x2d')](handleError(_0x4c5cf6,null));}; \ No newline at end of file +var _0x7cdc=['request','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','status','end','json','undefined','limit','offset','count','set','Content-Range','reject','update','destroy','stack','name','send','index','map','SmsMessage','rawAttributes','fieldName','type','query','filters','intersection','model','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','keys','create','body','find','describe','sms-interactions','accept','readAt','format','UserId','user','agent','SmsInteraction','SmsInteractionId','isNil','interaction','get','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','sequelize','Sequelize','QueryTypes','SELECT','contact','User','fullname','email','internal','manual','SIP/%s','channel','motionChannel','event','EventManager','sms','RejectMessage','rejectMessage','ContactId','interface','rejectmessage','SmsAccount','SmsAccountId','debug','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','plivo','MessageUUID','messageId','indexOf','sent','SmsAccount,\x20%s,\x20%s,\x20%s','plivio','infobip','results','groupName','rimraf','zip-dir','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','redis','defaults','localhost','./smsMessage.socket','jayson/promise','http'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0x7cdc,0x190));var _0xc7cd=function(_0x8a101d,_0x43bafb){_0x8a101d=_0x8a101d-0x0;var _0x597503=_0x7cdc[_0x8a101d];return _0x597503;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc7cd('0x0'));var zipdir=require(_0xc7cd('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc7cd('0x2'));var moment=require(_0xc7cd('0x3'));var BPromise=require(_0xc7cd('0x4'));var Mustache=require('mustache');var util=require(_0xc7cd('0x5'));var path=require(_0xc7cd('0x6'));var sox=require('sox');var csv=require(_0xc7cd('0x7'));var ejs=require(_0xc7cd('0x8'));var fs=require('fs');var fs_extra=require(_0xc7cd('0x9'));var _=require(_0xc7cd('0xa'));var squel=require(_0xc7cd('0xb'));var crypto=require(_0xc7cd('0xc'));var jsforce=require(_0xc7cd('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xc7cd('0x7'));var querystring=require('querystring');var Papa=require(_0xc7cd('0xe'));var Redis=require(_0xc7cd('0xf'));var authService=require(_0xc7cd('0x10'));var qs=require(_0xc7cd('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc7cd('0x12'));var logger=require(_0xc7cd('0x13'))(_0xc7cd('0x14'));var utils=require(_0xc7cd('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xc7cd('0x16'));var db=require('../../mysqldb')['db'];config[_0xc7cd('0x17')]=_[_0xc7cd('0x18')](config[_0xc7cd('0x17')],{'host':_0xc7cd('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc7cd('0x17')]));require(_0xc7cd('0x1a'))['register'](socket);var jayson=require(_0xc7cd('0x1b'));var client=jayson['client'][_0xc7cd('0x1c')]({'port':0x232c});var client9002=jayson['client'][_0xc7cd('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x2bbe07,_0x2f04cb,_0x317b0b,_0x494658){return new BPromise(function(_0x211e6d,_0x34ddb8){var _0x3c7d5c=_0x494658||client;return _0x3c7d5c[_0xc7cd('0x1d')](_0x2bbe07,_0x317b0b)[_0xc7cd('0x1e')](function(_0x2eca03){logger[_0xc7cd('0x1f')](_0xc7cd('0x20'),_0x2f04cb,_0xc7cd('0x21'));logger['debug'](_0xc7cd('0x22'),_0x2f04cb,'request\x20sent',JSON[_0xc7cd('0x23')](_0x2eca03));if(_0x2eca03[_0xc7cd('0x24')]){if(_0x2eca03[_0xc7cd('0x24')][_0xc7cd('0x25')]===0x1f4){logger[_0xc7cd('0x24')]('SmsMessage,\x20%s,\x20%s',_0x2f04cb,_0x2eca03[_0xc7cd('0x24')][_0xc7cd('0x26')]);return _0x34ddb8(_0x2eca03[_0xc7cd('0x24')][_0xc7cd('0x26')]);}logger['error'](_0xc7cd('0x20'),_0x2f04cb,_0x2eca03[_0xc7cd('0x24')][_0xc7cd('0x26')]);return _0x211e6d(_0x2eca03[_0xc7cd('0x24')]['message']);}else{logger['info']('SmsMessage,\x20%s,\x20%s',_0x2f04cb,_0xc7cd('0x21'));_0x211e6d(_0x2eca03['result'][_0xc7cd('0x26')]);}})[_0xc7cd('0x27')](function(_0x2932fe){logger[_0xc7cd('0x24')](_0xc7cd('0x20'),_0x2f04cb,_0x2932fe);_0x34ddb8(_0x2932fe);});});}function respondWithStatusCode(_0x3242a4,_0x5d16e3){_0x5d16e3=_0x5d16e3||0xcc;return function(_0x2d2c1c){if(_0x2d2c1c){return _0x3242a4[_0xc7cd('0x28')](_0x5d16e3);}return _0x3242a4[_0xc7cd('0x29')](_0x5d16e3)[_0xc7cd('0x2a')]();};}function respondWithResult(_0x51d040,_0x325792){_0x325792=_0x325792||0xc8;return function(_0x3994ae){if(_0x3994ae){return _0x51d040[_0xc7cd('0x29')](_0x325792)[_0xc7cd('0x2b')](_0x3994ae);}};}function respondWithFilteredResult(_0x4ed88b,_0x19aa4a){return function(_0x22be13){if(_0x22be13){var _0x5ab9a2=typeof _0x19aa4a['offset']===_0xc7cd('0x2c')&&typeof _0x19aa4a[_0xc7cd('0x2d')]===_0xc7cd('0x2c');var _0x34530d=_0x22be13['count'];var _0x1d5d4c=_0x5ab9a2?0x0:_0x19aa4a[_0xc7cd('0x2e')];var _0x5ed4d5=_0x5ab9a2?_0x22be13[_0xc7cd('0x2f')]:_0x19aa4a['offset']+_0x19aa4a[_0xc7cd('0x2d')];var _0xbd2964;if(_0x5ed4d5>=_0x34530d){_0x5ed4d5=_0x34530d;_0xbd2964=0xc8;}else{_0xbd2964=0xce;}_0x4ed88b[_0xc7cd('0x29')](_0xbd2964);return _0x4ed88b[_0xc7cd('0x30')](_0xc7cd('0x31'),_0x1d5d4c+'-'+_0x5ed4d5+'/'+_0x34530d)[_0xc7cd('0x2b')](_0x22be13);}return null;};}function patchUpdates(_0x1b7edd){return function(_0x11be09){try{jsonpatch['apply'](_0x11be09,_0x1b7edd,!![]);}catch(_0x4ee497){return BPromise[_0xc7cd('0x32')](_0x4ee497);}return _0x11be09['save']();};}function saveUpdates(_0x5dfa8a,_0x68f3b3){return function(_0x2e4790){if(_0x2e4790){return _0x2e4790[_0xc7cd('0x33')](_0x5dfa8a)[_0xc7cd('0x1e')](function(_0x4e1582){return _0x4e1582;});}return null;};}function removeEntity(_0x3dfcb7,_0xe319f6){return function(_0x2d9518){if(_0x2d9518){return _0x2d9518[_0xc7cd('0x34')]()[_0xc7cd('0x1e')](function(){_0x3dfcb7['status'](0xcc)[_0xc7cd('0x2a')]();});}};}function handleEntityNotFound(_0x2d2fc7,_0x5c6060){return function(_0xf0eb98){if(!_0xf0eb98){_0x2d2fc7[_0xc7cd('0x28')](0x194);}return _0xf0eb98;};}function handleError(_0x1ed44e,_0xcbc4aa){_0xcbc4aa=_0xcbc4aa||0x1f4;return function(_0x47d9b3){logger[_0xc7cd('0x24')](_0x47d9b3[_0xc7cd('0x35')]);if(_0x47d9b3[_0xc7cd('0x36')]){delete _0x47d9b3[_0xc7cd('0x36')];}_0x1ed44e[_0xc7cd('0x29')](_0xcbc4aa)[_0xc7cd('0x37')](_0x47d9b3);};}exports[_0xc7cd('0x38')]=function(_0x1a2f34,_0x426977){var _0x3ea57b={},_0x55ca78={},_0xc553aa={'count':0x0,'rows':[]};var _0x5d59e9=_[_0xc7cd('0x39')](db[_0xc7cd('0x3a')][_0xc7cd('0x3b')],function(_0x3b6ed4){return{'name':_0x3b6ed4[_0xc7cd('0x3c')],'type':_0x3b6ed4[_0xc7cd('0x3d')]['key']};});_0x55ca78['model']=_[_0xc7cd('0x39')](_0x5d59e9,_0xc7cd('0x36'));_0x55ca78[_0xc7cd('0x3e')]=_['keys'](_0x1a2f34[_0xc7cd('0x3e')]);_0x55ca78[_0xc7cd('0x3f')]=_[_0xc7cd('0x40')](_0x55ca78[_0xc7cd('0x41')],_0x55ca78[_0xc7cd('0x3e')]);_0x3ea57b['attributes']=_['intersection'](_0x55ca78[_0xc7cd('0x41')],qs[_0xc7cd('0x42')](_0x1a2f34[_0xc7cd('0x3e')]['fields']));_0x3ea57b[_0xc7cd('0x43')]=_0x3ea57b[_0xc7cd('0x43')][_0xc7cd('0x44')]?_0x3ea57b[_0xc7cd('0x43')]:_0x55ca78[_0xc7cd('0x41')];if(!_0x1a2f34[_0xc7cd('0x3e')]['hasOwnProperty'](_0xc7cd('0x45'))){_0x3ea57b[_0xc7cd('0x2d')]=qs[_0xc7cd('0x2d')](_0x1a2f34['query']['limit']);_0x3ea57b[_0xc7cd('0x2e')]=qs[_0xc7cd('0x2e')](_0x1a2f34[_0xc7cd('0x3e')][_0xc7cd('0x2e')]);}_0x3ea57b[_0xc7cd('0x46')]=qs['sort'](_0x1a2f34['query'][_0xc7cd('0x47')]);_0x3ea57b[_0xc7cd('0x48')]=qs[_0xc7cd('0x3f')](_[_0xc7cd('0x49')](_0x1a2f34[_0xc7cd('0x3e')],_0x55ca78[_0xc7cd('0x3f')]),_0x5d59e9);if(_0x1a2f34['query'][_0xc7cd('0x4a')]){_0x3ea57b[_0xc7cd('0x48')]=_[_0xc7cd('0x4b')](_0x3ea57b[_0xc7cd('0x48')],{'$or':_[_0xc7cd('0x39')](_0x5d59e9,function(_0x1f2bc2){if(_0x1f2bc2[_0xc7cd('0x3d')]!==_0xc7cd('0x4c')){var _0x10dbfb={};_0x10dbfb[_0x1f2bc2[_0xc7cd('0x36')]]={'$like':'%'+_0x1a2f34[_0xc7cd('0x3e')][_0xc7cd('0x4a')]+'%'};return _0x10dbfb;}})});}_0x3ea57b=_[_0xc7cd('0x4b')]({},_0x3ea57b,_0x1a2f34[_0xc7cd('0x4d')]);var _0x4db42c={'where':_0x3ea57b[_0xc7cd('0x48')]};return db[_0xc7cd('0x3a')]['count'](_0x4db42c)[_0xc7cd('0x1e')](function(_0xce7089){_0xc553aa[_0xc7cd('0x2f')]=_0xce7089;if(_0x1a2f34[_0xc7cd('0x3e')][_0xc7cd('0x4e')]){_0x3ea57b[_0xc7cd('0x4f')]=[{'all':!![]}];}return db[_0xc7cd('0x3a')][_0xc7cd('0x50')](_0x3ea57b);})[_0xc7cd('0x1e')](function(_0x11a0a3){_0xc553aa[_0xc7cd('0x51')]=_0x11a0a3;return _0xc553aa;})[_0xc7cd('0x1e')](respondWithFilteredResult(_0x426977,_0x3ea57b))[_0xc7cd('0x27')](handleError(_0x426977,null));};exports[_0xc7cd('0x52')]=function(_0x553c68,_0x598aa0){var _0x5f25bc={'raw':!![],'where':{'id':_0x553c68[_0xc7cd('0x53')]['id']}},_0x5df6d0={};_0x5df6d0[_0xc7cd('0x41')]=_[_0xc7cd('0x54')](db[_0xc7cd('0x3a')][_0xc7cd('0x3b')]);_0x5df6d0[_0xc7cd('0x3e')]=_[_0xc7cd('0x54')](_0x553c68[_0xc7cd('0x3e')]);_0x5df6d0[_0xc7cd('0x3f')]=_[_0xc7cd('0x40')](_0x5df6d0[_0xc7cd('0x41')],_0x5df6d0[_0xc7cd('0x3e')]);_0x5f25bc[_0xc7cd('0x43')]=_[_0xc7cd('0x40')](_0x5df6d0[_0xc7cd('0x41')],qs['fields'](_0x553c68[_0xc7cd('0x3e')][_0xc7cd('0x42')]));_0x5f25bc[_0xc7cd('0x43')]=_0x5f25bc['attributes']['length']?_0x5f25bc[_0xc7cd('0x43')]:_0x5df6d0['model'];if(_0x553c68['query']['includeAll']){_0x5f25bc[_0xc7cd('0x4f')]=[{'all':!![]}];}_0x5f25bc=_[_0xc7cd('0x4b')]({},_0x5f25bc,_0x553c68[_0xc7cd('0x4d')]);return db[_0xc7cd('0x3a')]['find'](_0x5f25bc)[_0xc7cd('0x1e')](handleEntityNotFound(_0x598aa0,null))[_0xc7cd('0x1e')](respondWithResult(_0x598aa0,null))[_0xc7cd('0x27')](handleError(_0x598aa0,null));};exports[_0xc7cd('0x55')]=function(_0x1ed9be,_0x1df3a4){return db[_0xc7cd('0x3a')][_0xc7cd('0x55')](_0x1ed9be[_0xc7cd('0x56')],{})['then'](respondWithResult(_0x1df3a4,0xc9))[_0xc7cd('0x27')](handleError(_0x1df3a4,null));};exports[_0xc7cd('0x33')]=function(_0x33d1c0,_0x508f43){if(_0x33d1c0['body']['id']){delete _0x33d1c0[_0xc7cd('0x56')]['id'];}return db[_0xc7cd('0x3a')][_0xc7cd('0x57')]({'where':{'id':_0x33d1c0[_0xc7cd('0x53')]['id']}})[_0xc7cd('0x1e')](handleEntityNotFound(_0x508f43,null))[_0xc7cd('0x1e')](saveUpdates(_0x33d1c0[_0xc7cd('0x56')],null))['then'](respondWithResult(_0x508f43,null))[_0xc7cd('0x27')](handleError(_0x508f43,null));};exports['destroy']=function(_0x2389b8,_0x199e5a){return db[_0xc7cd('0x3a')]['find']({'where':{'id':_0x2389b8[_0xc7cd('0x53')]['id']}})[_0xc7cd('0x1e')](handleEntityNotFound(_0x199e5a,null))[_0xc7cd('0x1e')](removeEntity(_0x199e5a,null))[_0xc7cd('0x27')](handleError(_0x199e5a,null));};exports['describe']=function(_0xbd358f,_0xc4eaef){return db[_0xc7cd('0x3a')][_0xc7cd('0x58')]()['then'](respondWithResult(_0xc4eaef,null))[_0xc7cd('0x27')](handleError(_0xc4eaef,null));};var interaction_log=require(_0xc7cd('0x13'))(_0xc7cd('0x59'));exports[_0xc7cd('0x5a')]=function(_0x266423,_0x4fe62a,_0x4f229e){var _0x2c5cc3={'agent':{},'channel':'sms'};if(_0x266423['body']['id']){delete _0x266423['body']['id'];}_0x266423[_0xc7cd('0x56')]['read']=!![];_0x266423[_0xc7cd('0x56')][_0xc7cd('0x5b')]=moment()[_0xc7cd('0x5c')]('YYYY-MM-DD\x20HH:mm:ss');_0x266423[_0xc7cd('0x56')][_0xc7cd('0x5d')]=_0x266423[_0xc7cd('0x56')][_0xc7cd('0x5d')]||_0x266423[_0xc7cd('0x5e')]['id'];_0x2c5cc3[_0xc7cd('0x5f')]['id']=_0x266423['body']['UserId'];return db[_0xc7cd('0x3a')]['find']({'where':{'id':_0x266423['params']['id'],'UserId':null}})[_0xc7cd('0x1e')](handleEntityNotFound(_0x4fe62a,null))[_0xc7cd('0x1e')](saveUpdates(_0x266423[_0xc7cd('0x56')],null))[_0xc7cd('0x1e')](function(_0xeb8e3c){if(_0xeb8e3c){_0x2c5cc3[_0xc7cd('0x26')]=_0xeb8e3c['get']({'plain':!![]});return db[_0xc7cd('0x60')][_0xc7cd('0x57')]({'where':{'id':_0xeb8e3c[_0xc7cd('0x61')]}});}return null;})[_0xc7cd('0x1e')](handleEntityNotFound(_0x4fe62a,null))[_0xc7cd('0x1e')](function(_0x5bb5fb){if(_0x5bb5fb){return _0x5bb5fb[_0xc7cd('0x33')]({'UserId':_0x266423[_0xc7cd('0x56')]['UserId'],'read1stAt':_[_0xc7cd('0x62')](_0x5bb5fb['read1stAt'])?moment()[_0xc7cd('0x5c')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0xc7cd('0x1e')](function(_0x565092){if(_0x565092){_0x2c5cc3[_0xc7cd('0x63')]=_0x565092[_0xc7cd('0x64')]({'plain':!![]});interaction_log['info'](_0xc7cd('0x65'),_0x266423['user']['id'],_0x266423[_0xc7cd('0x5e')][_0xc7cd('0x36')],_0x266423[_0xc7cd('0x5e')][_0xc7cd('0x66')],_0x2c5cc3[_0xc7cd('0x63')]['id'],_0x266423['body']?JSON[_0xc7cd('0x23')](_0x266423[_0xc7cd('0x56')]):_0xc7cd('0x67'));return respondWithRpcPromise(_0xc7cd('0x68'),'acceptMessage',_0x2c5cc3);}return null;})[_0xc7cd('0x1e')](function(_0x5ac889){var _0x318359='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x5ac889[_0xc7cd('0x26')]['ContactId'];return db[_0xc7cd('0x69')][_0xc7cd('0x3e')](_0x318359,{'type':db[_0xc7cd('0x6a')][_0xc7cd('0x6b')][_0xc7cd('0x6c')],'raw':!![]})[_0xc7cd('0x1e')](function(_0x7401c3){return _0x7401c3;});})[_0xc7cd('0x1e')](function(_0x34d708){if(_0x34d708){_0x2c5cc3[_0xc7cd('0x26')][_0xc7cd('0x6d')]=_0x34d708[0x0];if(!_0x266423[_0xc7cd('0x56')]['UserId'])return;return db[_0xc7cd('0x6e')][_0xc7cd('0x57')]({'where':{'id':_0x266423['body'][_0xc7cd('0x5d')],'role':_0xc7cd('0x5f')},'attributes':['id',_0xc7cd('0x36'),_0xc7cd('0x6f'),_0xc7cd('0x70'),_0xc7cd('0x71')],'raw':!![]});}return null;})[_0xc7cd('0x1e')](function(_0x295b21){if(!_0x295b21)return null;_0x2c5cc3[_0xc7cd('0x26')][_0xc7cd('0x5f')]=_0x295b21;return _0x2c5cc3;})[_0xc7cd('0x1e')](function(_0x41d08f){if(_0x41d08f){if(_0x266423[_0xc7cd('0x56')][_0xc7cd('0x72')]){_0x2c5cc3[_0xc7cd('0x26')]['interface']=util[_0xc7cd('0x5c')](_0xc7cd('0x73'),_0x266423[_0xc7cd('0x5e')][_0xc7cd('0x36')]);_0x2c5cc3[_0xc7cd('0x26')][_0xc7cd('0x74')]=_0x2c5cc3[_0xc7cd('0x74')];_0x2c5cc3[_0xc7cd('0x26')][_0xc7cd('0x75')]=_0x2c5cc3['channel'];_0x2c5cc3[_0xc7cd('0x26')][_0xc7cd('0x76')]=_0xc7cd('0x5a');return respondWithRpcPromise(_0xc7cd('0x77'),_0xc7cd('0x77'),{'event':'acceptmessage','message':_0x2c5cc3['message']},client9002)['then'](function(){return _0x2c5cc3;});}return _0x2c5cc3;}return null;})['then'](respondWithResult(_0x4fe62a,null))[_0xc7cd('0x27')](handleError(_0x4fe62a,null));};var interaction_log=require('../../config/logger')(_0xc7cd('0x59'));exports[_0xc7cd('0x32')]=function(_0x1a7fa8,_0x5f40e6,_0x1546d9){var _0x13f0c9={'agent':{},'channel':_0xc7cd('0x78')};if(_0x1a7fa8[_0xc7cd('0x56')]['id']){delete _0x1a7fa8[_0xc7cd('0x56')]['id'];}_0x1a7fa8['body'][_0xc7cd('0x5d')]=_0x1a7fa8[_0xc7cd('0x56')][_0xc7cd('0x5d')]||_0x1a7fa8[_0xc7cd('0x5e')]['id'];_0x13f0c9[_0xc7cd('0x5f')]['id']=_0x1a7fa8['body'][_0xc7cd('0x5d')];return db[_0xc7cd('0x3a')][_0xc7cd('0x57')]({'where':{'id':_0x1a7fa8[_0xc7cd('0x53')]['id'],'UserId':null}})[_0xc7cd('0x1e')](handleEntityNotFound(_0x5f40e6,null))['then'](function(_0x2c459e){if(_0x2c459e){_0x13f0c9['message']=_0x2c459e[_0xc7cd('0x64')]({'plain':!![]});return db['SmsInteraction'][_0xc7cd('0x57')]({'where':{'id':_0x2c459e['SmsInteractionId']}});}return null;})[_0xc7cd('0x1e')](handleEntityNotFound(_0x5f40e6,null))[_0xc7cd('0x1e')](function(_0x3553f0){if(_0x3553f0){_0x13f0c9[_0xc7cd('0x63')]=_0x3553f0[_0xc7cd('0x64')]({'plain':!![]});interaction_log[_0xc7cd('0x1f')]('[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x1a7fa8[_0xc7cd('0x5e')]['id'],_0x1a7fa8[_0xc7cd('0x5e')][_0xc7cd('0x36')],_0x1a7fa8[_0xc7cd('0x5e')][_0xc7cd('0x66')],_0x13f0c9[_0xc7cd('0x63')]['id'],_0x1a7fa8[_0xc7cd('0x56')]?JSON['stringify'](_0x1a7fa8[_0xc7cd('0x56')]):'null');return respondWithRpcPromise(_0xc7cd('0x79'),_0xc7cd('0x7a'),_0x13f0c9);}return null;})['then'](function(_0x1dd560){var _0x5c23a3='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x1dd560['message'][_0xc7cd('0x7b')];return db[_0xc7cd('0x69')][_0xc7cd('0x3e')](_0x5c23a3,{'type':db[_0xc7cd('0x6a')][_0xc7cd('0x6b')]['SELECT'],'raw':!![]})[_0xc7cd('0x1e')](function(_0x283af){return _0x283af;});})['then'](function(_0x464ee5){if(_0x464ee5){_0x13f0c9['message'][_0xc7cd('0x6d')]=_0x464ee5[0x0];if(!_0x1a7fa8[_0xc7cd('0x56')][_0xc7cd('0x5d')])return;return db[_0xc7cd('0x6e')][_0xc7cd('0x57')]({'where':{'id':_0x1a7fa8[_0xc7cd('0x56')][_0xc7cd('0x5d')],'role':_0xc7cd('0x5f')},'attributes':['id',_0xc7cd('0x36'),_0xc7cd('0x6f'),'email','internal'],'raw':!![]});}return null;})[_0xc7cd('0x1e')](function(_0xc06513){if(!_0xc06513)return null;_0x13f0c9[_0xc7cd('0x26')][_0xc7cd('0x5f')]=_0xc06513;return _0x13f0c9;})[_0xc7cd('0x1e')](function(_0x4eeeff){if(_0x4eeeff){_0x4eeeff[_0xc7cd('0x26')][_0xc7cd('0x7c')]=util[_0xc7cd('0x5c')](_0xc7cd('0x73'),_0x1a7fa8[_0xc7cd('0x5e')]['name']);_0x4eeeff['message'][_0xc7cd('0x74')]=_0x13f0c9[_0xc7cd('0x74')];_0x4eeeff['message'][_0xc7cd('0x75')]=_0x13f0c9[_0xc7cd('0x74')];_0x4eeeff[_0xc7cd('0x26')][_0xc7cd('0x76')]=_0xc7cd('0x32');respondWithRpcPromise('EventManager',_0xc7cd('0x77'),{'event':_0xc7cd('0x7d'),'message':_0x4eeeff['message']},client9002);return _0x13f0c9;}return null;})[_0xc7cd('0x1e')](respondWithResult(_0x5f40e6,null))[_0xc7cd('0x27')](handleError(_0x5f40e6,null));};exports[_0xc7cd('0x29')]=function(_0x3fc99b,_0x2b7901,_0x495642){if(_0x3fc99b['body']['id']){delete _0x3fc99b[_0xc7cd('0x56')]['id'];}var _0x2abcc5;return db['SmsMessage'][_0xc7cd('0x57')]({'where':{'id':_0x3fc99b['params']['id']}})[_0xc7cd('0x1e')](handleEntityNotFound(_0x2b7901,null))[_0xc7cd('0x1e')](function(_0x27c2ad){if(_0x27c2ad){_0x2abcc5=_0x27c2ad;return db[_0xc7cd('0x7e')][_0xc7cd('0x57')]({'where':{'id':_0x27c2ad[_0xc7cd('0x7f')]}});}})[_0xc7cd('0x1e')](handleEntityNotFound(_0x2b7901,null))[_0xc7cd('0x1e')](function(_0x2c916c){if(_0x2c916c){logger[_0xc7cd('0x80')](_0xc7cd('0x22'),_0xc7cd('0x29'),_0xc7cd('0x81'),_0x2c916c[_0xc7cd('0x3d')],util[_0xc7cd('0x82')](_0x3fc99b[_0xc7cd('0x56')],{'showHidden':![],'depth':null}));switch(_0x2c916c[_0xc7cd('0x3d')]){case _0xc7cd('0x83'):if(_0x3fc99b[_0xc7cd('0x56')][_0xc7cd('0x84')]&&_0x3fc99b['body']['MessageSid']===_0x2abcc5['messageId']){return _0x2abcc5[_0xc7cd('0x33')]({'read':!![]});}else{logger[_0xc7cd('0x24')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xc7cd('0x29'),_0xc7cd('0x83'),util[_0xc7cd('0x82')](_0x3fc99b[_0xc7cd('0x56')],{'showHidden':![],'depth':null}));}break;case _0xc7cd('0x85'):if(_0x3fc99b['body'][_0xc7cd('0x86')]&&_0x3fc99b[_0xc7cd('0x56')]['MessageUUID']===_0x2abcc5[_0xc7cd('0x87')]&&_[_0xc7cd('0x88')]([_0xc7cd('0x89'),'delivered'],_0x3fc99b[_0xc7cd('0x56')]['Status'])>=0x0){return _0x2abcc5['update']({'read':!![]});}else{logger['error'](_0xc7cd('0x8a'),_0xc7cd('0x29'),_0xc7cd('0x8b'),util[_0xc7cd('0x82')](_0x3fc99b[_0xc7cd('0x56')],{'showHidden':![],'depth':null}));}break;case _0xc7cd('0x8c'):var _0xb88536=_0x3fc99b[_0xc7cd('0x56')][_0xc7cd('0x8d')][0x0];if(_0xb88536[_0xc7cd('0x29')][_0xc7cd('0x8e')]==='DELIVERED'){return _0x2abcc5[_0xc7cd('0x33')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0xc7cd('0x29'),'infobip',util[_0xc7cd('0x82')](_0x3fc99b[_0xc7cd('0x56')],{'showHidden':![],'depth':null}));}break;}return _0x2abcc5;}})[_0xc7cd('0x1e')](respondWithResult(_0x2b7901,null))[_0xc7cd('0x27')](handleError(_0x2b7901,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index ae7ddb7..813aeaf 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 _0x3d16=['events','SmsMessage','setMaxListeners','save','update','remove','emit','exports'];(function(_0x26c43f,_0x3c6f5f){var _0x18de8b=function(_0x547f33){while(--_0x547f33){_0x26c43f['push'](_0x26c43f['shift']());}};_0x18de8b(++_0x3c6f5f);}(_0x3d16,0x158));var _0x63d1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3d16[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0x63d1('0x0'));var SmsMessage=require('../../mysqldb')['db'][_0x63d1('0x1')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x63d1('0x2')](0x0);var events={'afterCreate':_0x63d1('0x3'),'afterUpdate':_0x63d1('0x4'),'afterDestroy':_0x63d1('0x5')};function emitEvent(_0x200704){return function(_0xb3cda1,_0xefd1e,_0x3407f8){SmsMessageEvents[_0x63d1('0x6')](_0x200704+':'+_0xb3cda1['id'],_0xb3cda1);SmsMessageEvents[_0x63d1('0x6')](_0x200704,_0xb3cda1);_0x3407f8(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsMessage['hook'](e,emitEvent(event));}}module[_0x63d1('0x7')]=SmsMessageEvents; \ No newline at end of file +var _0x6f5b=['exports','events','../../mysqldb','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x13c0df,_0x785782){var _0x3eb8dd=function(_0x16eca5){while(--_0x16eca5){_0x13c0df['push'](_0x13c0df['shift']());}};_0x3eb8dd(++_0x785782);}(_0x6f5b,0x1d5));var _0xb6f5=function(_0x544f22,_0x4d4ad8){_0x544f22=_0x544f22-0x0;var _0x47090b=_0x6f5b[_0x544f22];return _0x47090b;};'use strict';var EventEmitter=require(_0xb6f5('0x0'));var SmsMessage=require(_0xb6f5('0x1'))['db']['SmsMessage'];var SmsMessageEvents=new EventEmitter();SmsMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xb6f5('0x2'),'afterUpdate':_0xb6f5('0x3'),'afterDestroy':_0xb6f5('0x4')};function emitEvent(_0x7dbce){return function(_0x57ae3e,_0x1c6118,_0x3abc9d){SmsMessageEvents[_0xb6f5('0x5')](_0x7dbce+':'+_0x57ae3e['id'],_0x57ae3e);SmsMessageEvents[_0xb6f5('0x5')](_0x7dbce,_0x57ae3e);_0x3abc9d(null);};}for(var e in events){if(events[_0xb6f5('0x6')](e)){var event=events[e];SmsMessage[_0xb6f5('0x7')](e,emitEvent(event));}}module[_0xb6f5('0x8')]=SmsMessageEvents; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.model.js b/server/api/smsMessage/smsMessage.model.js index 944bcb7..ed5a70e 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 _0xe200=['out','secret','isNil','UserId','SmsInteractionId','SmsInteraction','findOne','then','createdAt','direction','SmsAccount','find','SmsAccountId','type','twilio','accountSid','authToken','phone','messages','body','remote','/api/sms/messages/','/status?token=','token','sid','update','catch','error','afterCreate','inspect','SmsMessage,\x20%s,\x20%s,\x20%s','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','https://api.skebby.it/API/v1.0/REST/','username','password','smsMethod','login?username=','split','sms','total_sent','internal_order_id','deliveryReport','skebby','Missing\x20parameters:\x20username,\x20password','connectel','senderString','POST','https://smsapi.connectel.se/api/v2/send/','requestid','Missing\x20parameters:\x20authToken','clicksend','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','toString','base64','http_code','data','queued_count','head','message_id','read','clickSend','plivo','authId','format','%s:%s','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/sms/2/text/advanced','application/json','IBSSO\x20','csc','crypto','apiKey','login','text','timestamp','keys','sort','length','md5','digest','hex','GET','/external/get/send.php?','id_sms','Missing\x20parameters:\x20apiKey','clickatell','https://platform.clickatell.com/messages','uuid','UTF-8','apiMessageId','bandwidth','https://messaging.bandwidth.com/api/v2/users/','accountId','/messages','applicationId','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','code','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','finally','utf8mb4','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./smsMessage.attributes','define','SmsMessage','sms_messages','messageId','fti_sms_messages','FULLTEXT','models','get','toLowerCase'];(function(_0x31035e,_0x5ae9d3){var _0x4b6640=function(_0x57bf1e){while(--_0x57bf1e){_0x31035e['push'](_0x31035e['shift']());}};_0x4b6640(++_0x5ae9d3);}(_0xe200,0x164));var _0x0e20=function(_0x4883fe,_0x295690){_0x4883fe=_0x4883fe-0x0;var _0x2a97e8=_0xe200[_0x4883fe];return _0x2a97e8;};'use strict';var _=require(_0x0e20('0x0'));var util=require(_0x0e20('0x1'));var logger=require(_0x0e20('0x2'))(_0x0e20('0x3'));var moment=require(_0x0e20('0x4'));var BPromise=require(_0x0e20('0x5'));var rp=require(_0x0e20('0x6'));var fs=require('fs');var path=require(_0x0e20('0x7'));var rimraf=require(_0x0e20('0x8'));var config=require('../../config/environment');var attributes=require(_0x0e20('0x9'));module['exports']=function(_0x2b4f35,_0x5c60c8){return _0x2b4f35[_0x0e20('0xa')](_0x0e20('0xb'),attributes,{'tableName':_0x0e20('0xc'),'paranoid':![],'indexes':[{'name':_0x0e20('0xd'),'fields':[_0x0e20('0xd')]},{'name':_0x0e20('0xe'),'fields':['body'],'type':_0x0e20('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x2ac3e3,_0x315b3e,_0x29886f){var _0x59dc29=_0x2b4f35[_0x0e20('0x10')];var _0x240e8d=_0x2ac3e3[_0x0e20('0x11')]({'plain':!![]});if(_0x240e8d['direction'][_0x0e20('0x12')]()==='in'||_0x240e8d['direction'][_0x0e20('0x12')]()===_0x0e20('0x13')&&!_0x240e8d[_0x0e20('0x14')]&&!_[_0x0e20('0x15')](_0x240e8d[_0x0e20('0x16')])&&!_[_0x0e20('0x15')](_0x240e8d[_0x0e20('0x17')])){_0x59dc29[_0x0e20('0x18')][_0x0e20('0x19')]({'where':{'id':_0x240e8d[_0x0e20('0x17')]}})[_0x0e20('0x1a')](function(_0x548948){if(_0x548948){_0x548948['update']({'lastMsgAt':_0x240e8d[_0x0e20('0x1b')],'lastMsgDirection':_0x240e8d[_0x0e20('0x1c')][_0x0e20('0x12')]()});}})['catch'](function(_0x2c1c84){console['error'](_0x2c1c84);});}if(_0x240e8d[_0x0e20('0x1c')]===_0x0e20('0x13')&&!_0x240e8d['secret']){var _0x24aefc;_0x59dc29[_0x0e20('0x1d')][_0x0e20('0x1e')]({'where':{'id':_0x240e8d[_0x0e20('0x1f')]},'raw':!![]})[_0x0e20('0x1a')](function(_0x55e02b){_0x24aefc=_0x55e02b;if(_0x24aefc&&_0x24aefc[_0x0e20('0x20')]){switch(_0x24aefc[_0x0e20('0x20')]){case'twilio':var _0x4937a8=require(_0x0e20('0x21'));if(_0x24aefc[_0x0e20('0x22')]&&_0x24aefc[_0x0e20('0x23')]&&_0x24aefc[_0x0e20('0x24')]){var _0x16671e=new _0x4937a8(_0x24aefc['accountSid'],_0x24aefc[_0x0e20('0x23')]);_0x16671e[_0x0e20('0x25')]['create']({'body':_0x240e8d[_0x0e20('0x26')],'to':_0x240e8d[_0x0e20('0x24')],'from':_0x24aefc[_0x0e20('0x24')],'statusCallback':_0x24aefc[_0x0e20('0x27')]+_0x0e20('0x28')+_0x240e8d['id']+_0x0e20('0x29')+_0x24aefc[_0x0e20('0x2a')]})[_0x0e20('0x1a')](function(_0x2fe969){if(_0x2fe969[_0x0e20('0x2b')]){return _0x2ac3e3[_0x0e20('0x2c')]({'messageId':_0x2fe969['sid']});}})[_0x0e20('0x2d')](function(_0x125f6f){logger[_0x0e20('0x2e')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x0e20('0x2f'),_0x0e20('0x21'),util[_0x0e20('0x30')](_0x125f6f,{'showHidden':![],'depth':null}));});}else{logger[_0x0e20('0x2e')](_0x0e20('0x31'),_0x0e20('0x2f'),_0x0e20('0x21'),_0x0e20('0x32'));}break;case'skebby':var _0x3e53e1=_0x0e20('0x33');if(_0x24aefc[_0x0e20('0x34')]&&_0x24aefc[_0x0e20('0x35')]){var _0x7654f0={'recipient':[_0x240e8d[_0x0e20('0x24')]],'message':_0x240e8d[_0x0e20('0x26')],'message_type':_0x24aefc['smsMethod']};if(_0x24aefc[_0x0e20('0x36')]&&_0x24aefc['smsMethod']!=='SI'){_0x7654f0['sender']=_0x24aefc['phone'];}var _0x20f96a={'url':_0x3e53e1+_0x0e20('0x37')+_0x24aefc[_0x0e20('0x34')]+'&password='+_0x24aefc[_0x0e20('0x35')],'method':'GET'};rp(_0x20f96a)[_0x0e20('0x1a')](function(_0xbe0e41){var _0x4b39c2=_0xbe0e41[_0x0e20('0x38')](';');var _0x2e3877={'user_key':_0x4b39c2[0x0],'session_key':_0x4b39c2[0x1]};_0x20f96a={'url':_0x3e53e1+_0x0e20('0x39'),'method':'POST','headers':{'user_key':_0x2e3877['user_key'],'Session_key':_0x2e3877['session_key']},'json':!![],'body':_0x7654f0};return rp(_0x20f96a);})[_0x0e20('0x1a')](function(_0x90b9bb){if(_0x90b9bb[_0x0e20('0x3a')]>=0x1){var _0x479112={'messageId':_0x90b9bb[_0x0e20('0x3b')]};if(_0x24aefc[_0x0e20('0x36')]!=='GP'||!_0x24aefc[_0x0e20('0x3c')]){_0x479112['read']=!![];}return _0x2ac3e3[_0x0e20('0x2c')](_0x479112);}else{return logger[_0x0e20('0x2e')](_0x0e20('0x31'),'afterCreate',_0x0e20('0x3d'),util[_0x0e20('0x30')](_0x90b9bb,{'showHidden':![],'depth':null}));}})['catch'](function(_0x187015){return logger[_0x0e20('0x2e')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x0e20('0x2f'),_0x0e20('0x3d'),util['inspect'](_0x187015,{'showHidden':![],'depth':null}));});}else{logger[_0x0e20('0x2e')](_0x0e20('0x31'),_0x0e20('0x2f'),_0x0e20('0x3d'),_0x0e20('0x3e'));}break;case _0x0e20('0x3f'):if(_0x24aefc[_0x0e20('0x23')]){var _0x23101f={'recipient':_0x240e8d[_0x0e20('0x24')],'message':_0x240e8d[_0x0e20('0x26')],'sender':_0x24aefc[_0x0e20('0x40')]||_0x24aefc['phone'],'authorization':_0x24aefc[_0x0e20('0x23')]};var _0x315b3e={'method':_0x0e20('0x41'),'uri':_0x0e20('0x42'),'body':_0x23101f,'json':!![]};rp(_0x315b3e)[_0x0e20('0x1a')](function(_0x48522e){var _0x2ea3d4={'messageId':_0x48522e[_0x0e20('0x43')]};if(!_0x24aefc[_0x0e20('0x3c')]){_0x2ea3d4['read']=!![];}return _0x2ac3e3[_0x0e20('0x2c')](_0x2ea3d4);})[_0x0e20('0x2d')](function(_0x5b01be){logger[_0x0e20('0x2e')](_0x0e20('0x31'),_0x0e20('0x2f'),'connectel',util[_0x0e20('0x30')](_0x5b01be,{'showHidden':![],'depth':null}));});}else{logger[_0x0e20('0x2e')](_0x0e20('0x31'),_0x0e20('0x2f'),_0x0e20('0x3f'),_0x0e20('0x44'));}break;case _0x0e20('0x45'):if(_0x24aefc[_0x0e20('0x34')]&&_0x24aefc[_0x0e20('0x35')]){var _0x23101f={'messages':[{'source':'xCALLY\x20Motion','to':_0x240e8d[_0x0e20('0x24')],'body':_0x240e8d[_0x0e20('0x26')],'from':_0x24aefc[_0x0e20('0x40')]||_0x24aefc[_0x0e20('0x24')]}]};var _0x477cf3=util['format']('%s:%s',_0x24aefc[_0x0e20('0x34')],_0x24aefc[_0x0e20('0x35')]);var _0x315b3e={'method':_0x0e20('0x41'),'uri':_0x0e20('0x46'),'body':_0x23101f,'headers':{'Authorization':util['format'](_0x0e20('0x47'),new Buffer(_0x477cf3)[_0x0e20('0x48')](_0x0e20('0x49')))},'json':!![]};rp(_0x315b3e)[_0x0e20('0x1a')](function(_0x2e66df){if(_0x2e66df[_0x0e20('0x4a')]>=0xc8&&_0x2e66df['http_code']<=0xce){if(_0x2e66df[_0x0e20('0x4b')]&&_0x2e66df['data'][_0x0e20('0x4c')]>0x0){var _0x3a232d=_[_0x0e20('0x4d')](_0x2e66df[_0x0e20('0x4b')][_0x0e20('0x25')]);var _0x3c6d03={'messageId':_0x3a232d[_0x0e20('0x4e')]};if(!_0x24aefc[_0x0e20('0x3c')]){_0x3c6d03[_0x0e20('0x4f')]=!![];}return _0x2ac3e3[_0x0e20('0x2c')](_0x3c6d03);}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x0e20('0x2f'),_0x0e20('0x50'),util[_0x0e20('0x30')](_0x2e66df,{'showHidden':![],'depth':null}));}}else{logger[_0x0e20('0x2e')](_0x0e20('0x31'),_0x0e20('0x2f'),'clickSend',util[_0x0e20('0x30')](_0x2e66df,{'showHidden':![],'depth':null}));}})['catch'](function(_0x423465){logger[_0x0e20('0x2e')](_0x0e20('0x31'),_0x0e20('0x2f'),_0x0e20('0x50'),util['inspect'](_0x423465,{'showHidden':![],'depth':null}));});}else{logger[_0x0e20('0x2e')](_0x0e20('0x31'),'afterCreate',_0x0e20('0x50'),_0x0e20('0x3e'));}break;case _0x0e20('0x51'):if(_0x24aefc[_0x0e20('0x52')]&&_0x24aefc['authToken']){var _0x23101f={'dst':_0x240e8d[_0x0e20('0x24')],'text':_0x240e8d['body'],'src':_0x24aefc[_0x0e20('0x40')]||_0x24aefc['phone'],'url':_0x24aefc[_0x0e20('0x27')]+_0x0e20('0x28')+_0x240e8d['id']+'/status?token='+_0x24aefc['token']};var _0x477cf3=util[_0x0e20('0x53')](_0x0e20('0x54'),_0x24aefc[_0x0e20('0x52')],_0x24aefc['authToken']);var _0x315b3e={'method':_0x0e20('0x41'),'uri':util[_0x0e20('0x53')]('https://api.plivo.com/v1/Account/%s/Message/',_0x24aefc[_0x0e20('0x52')]),'body':_0x23101f,'headers':{'Authorization':util['format'](_0x0e20('0x47'),new Buffer(_0x477cf3)['toString'](_0x0e20('0x49')))},'json':!![]};rp(_0x315b3e)[_0x0e20('0x1a')](function(_0x6b317c){var _0x5b2d3c={'messageId':_0x6b317c['message_uuid'][0x0]};return _0x2ac3e3[_0x0e20('0x2c')](_0x5b2d3c);})[_0x0e20('0x2d')](function(_0x436e28){logger[_0x0e20('0x2e')](_0x0e20('0x31'),_0x0e20('0x2f'),_0x0e20('0x51'),util[_0x0e20('0x30')](_0x436e28,{'showHidden':![],'depth':null}));});}else{logger[_0x0e20('0x2e')](_0x0e20('0x31'),'afterCreate',_0x0e20('0x51'),_0x0e20('0x55'));}break;case _0x0e20('0x56'):if(_0x24aefc['username']&&_0x24aefc['password']){if(_0x24aefc[_0x0e20('0x57')]){var _0x1ff6c7={'method':_0x0e20('0x41'),'uri':_0x24aefc[_0x0e20('0x57')]+'/auth/1/session','body':{'username':_0x24aefc[_0x0e20('0x34')],'password':_0x24aefc[_0x0e20('0x35')]},'json':!![]};return rp(_0x1ff6c7)['then'](function(_0x21dad4){var _0xf8e56a={'method':_0x0e20('0x41'),'uri':_0x24aefc['baseUrl']+_0x0e20('0x58'),'body':{'messages':[{'from':_0x24aefc['phone'],'destinations':[{'to':_0x240e8d[_0x0e20('0x24')]}],'text':_0x240e8d[_0x0e20('0x26')],'notifyUrl':_0x24aefc[_0x0e20('0x27')]+'/api/sms/messages/'+_0x240e8d['id']+'/status?token='+_0x24aefc[_0x0e20('0x2a')],'notifyContentType':_0x0e20('0x59'),'callbackData':_0x24aefc[_0x0e20('0x24')]+';'+_0x240e8d['body']}]},'headers':{'Authorization':_0x0e20('0x5a')+_0x21dad4[_0x0e20('0x2a')]},'json':!![]};return rp(_0xf8e56a)['then'](function(_0x475f11){if(_0x475f11['messages']){var _0x298c67={'messageId':_0x475f11['messages'][0x0][_0x0e20('0xd')]};if(!_0x24aefc['deliveryReport']){_0x298c67[_0x0e20('0x4f')]=!![];}return _0x2ac3e3[_0x0e20('0x2c')](_0x298c67);}else{return logger[_0x0e20('0x2e')](_0x0e20('0x31'),_0x0e20('0x2f'),_0x0e20('0x56'),util[_0x0e20('0x30')](_0x475f11,{'showHidden':![],'depth':null}));}});})[_0x0e20('0x2d')](function(_0x396458){return logger[_0x0e20('0x2e')](_0x0e20('0x31'),_0x0e20('0x2f'),'infobip',util[_0x0e20('0x30')](_0x396458,{'showHidden':![],'depth':null}));});}else{logger[_0x0e20('0x2e')](_0x0e20('0x31'),'afterCreate',_0x0e20('0x56'),'Missing\x20parameters:\x20base_url');}}else{logger[_0x0e20('0x2e')](_0x0e20('0x31'),_0x0e20('0x2f'),_0x0e20('0x56'),_0x0e20('0x3e'));}break;case _0x0e20('0x5b'):var _0x30b2c0=require(_0x0e20('0x5c'));if(_0x24aefc[_0x0e20('0x5d')]){var _0x5d6703={};_0x5d6703[_0x0e20('0x5e')]=_0x24aefc[_0x0e20('0x34')];_0x5d6703[_0x0e20('0x24')]=_0x240e8d[_0x0e20('0x24')];_0x5d6703['sender']=_0x24aefc[_0x0e20('0x24')];_0x5d6703[_0x0e20('0x5f')]=_0x240e8d[_0x0e20('0x26')];_0x5d6703[_0x0e20('0x60')]=+new Date();var _0x4725f3='';var _0x4c96f3='';var _0x1c7562=Object[_0x0e20('0x61')](_0x5d6703);_0x1c7562[_0x0e20('0x62')]();for(var _0x403913=0x0;_0x403913<_0x1c7562[_0x0e20('0x63')];_0x403913++){if(_0x4725f3!=''){_0x4725f3+='&';}_0x4725f3+=_0x1c7562[_0x403913]+'='+encodeURIComponent(_0x5d6703[_0x1c7562[_0x403913]]);_0x4c96f3+=_0x5d6703[_0x1c7562[_0x403913]];}_0x4c96f3+=_0x24aefc[_0x0e20('0x5d')];_0x4c96f3=_0x30b2c0['createHash'](_0x0e20('0x64'))['update'](_0x4c96f3)[_0x0e20('0x65')](_0x0e20('0x66'));if(_0x4725f3!==''){_0x4725f3+='&';}_0x4725f3+='signature='+_0x4c96f3;var _0x20f96a={'method':_0x0e20('0x67'),'uri':_0x24aefc[_0x0e20('0x57')]+_0x0e20('0x68')+_0x4725f3,'json':!![]};return rp(_0x20f96a)['then'](function(_0x45648c){var _0x1d347c=Object[_0x0e20('0x61')](_0x45648c);if(_0x45648c[_0x1d347c[0x0]][_0x0e20('0x2e')]&&parseInt(_0x45648c[_0x1d347c[0x0]]['error'])===0x0){var _0xb69aee={'messageId':_0x45648c[_0x1d347c[0x0]][_0x0e20('0x69')]};if(!_0x24aefc[_0x0e20('0x3c')]){_0xb69aee[_0x0e20('0x4f')]=!![];}return _0x2ac3e3['update'](_0xb69aee);}else{return logger[_0x0e20('0x2e')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x0e20('0x5b'),util[_0x0e20('0x30')](_0x45648c[_0x0e20('0x2e')],{'showHidden':![],'depth':null}));}})['catch'](function(_0x28bb21){return logger[_0x0e20('0x2e')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x0e20('0x2f'),_0x0e20('0x5b'),util['inspect'](_0x28bb21,{'showHidden':![],'depth':null}));});}else{logger[_0x0e20('0x2e')](_0x0e20('0x31'),_0x0e20('0x2f'),'csc',_0x0e20('0x6a'));}break;case _0x0e20('0x6b'):if(_0x24aefc[_0x0e20('0x5d')]){var _0x4a7cf2={'method':'POST','uri':_0x0e20('0x6c'),'headers':{'Authorization':_0x24aefc[_0x0e20('0x5d')]},'body':{'content':_0x240e8d[_0x0e20('0x26')],'to':[_0x240e8d[_0x0e20('0x24')]],'from':_0x24aefc[_0x0e20('0x24')],'binary':![],'clientMessageId':_0x0e20('0x6d'),'charset':_0x0e20('0x6e')},'json':!![]};rp(_0x4a7cf2)[_0x0e20('0x1a')](function(_0x2a1be5){if(!_0x2a1be5[_0x0e20('0x2e')]){var _0x49eed8={'messageId':_0x2a1be5[_0x0e20('0x25')][0x0][_0x0e20('0x6f')]};if(!_0x24aefc[_0x0e20('0x3c')]){_0x49eed8[_0x0e20('0x4f')]=!![];}return _0x2ac3e3['update'](_0x49eed8);}else{return logger[_0x0e20('0x2e')](_0x0e20('0x31'),_0x0e20('0x2f'),_0x0e20('0x6b'),util[_0x0e20('0x30')](_0x2a1be5[_0x0e20('0x2e')],{'showHidden':![],'depth':null}));}})[_0x0e20('0x2d')](function(_0x22755c){return logger[_0x0e20('0x2e')](_0x0e20('0x31'),_0x0e20('0x2f'),_0x0e20('0x6b'),util[_0x0e20('0x30')](_0x22755c,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x0e20('0x31'),_0x0e20('0x2f'),_0x0e20('0x6b'),_0x0e20('0x6a'));}break;case _0x0e20('0x70'):if(_0x24aefc['username']&&_0x24aefc[_0x0e20('0x35')]){var _0x477cf3=util[_0x0e20('0x53')](_0x0e20('0x54'),_0x24aefc[_0x0e20('0x34')],_0x24aefc['password']);var _0x315b3e={'method':_0x0e20('0x41'),'uri':_0x0e20('0x71')+_0x24aefc[_0x0e20('0x72')]+_0x0e20('0x73'),'body':{'to':[_0x240e8d[_0x0e20('0x24')]],'text':_0x240e8d['body'],'from':_0x24aefc[_0x0e20('0x24')],'applicationId':_0x24aefc[_0x0e20('0x74')]},'headers':{'Authorization':util['format'](_0x0e20('0x47'),new Buffer(_0x477cf3)['toString']('base64'))},'json':!![]};rp(_0x315b3e)['then'](function(_0x20a894){if(_0x20a894['id']){var _0x509a5f={'messageId':_0x20a894['id']};return _0x2ac3e3[_0x0e20('0x2c')](_0x509a5f);}else{logger[_0x0e20('0x2e')](_0x0e20('0x31'),_0x0e20('0x2f'),'bandwidth',util[_0x0e20('0x30')](_0x20a894,{'showHidden':![],'depth':null}));}})[_0x0e20('0x2d')](function(_0x486655){logger[_0x0e20('0x2e')](_0x0e20('0x31'),_0x0e20('0x2f'),'bandwidth',util[_0x0e20('0x30')](_0x486655,{'showHidden':![],'depth':null}));});}else{logger[_0x0e20('0x2e')](_0x0e20('0x31'),_0x0e20('0x2f'),'bandwidth','Missing\x20parameters:\x20username,\x20password');}break;case _0x0e20('0x75'):if(_0x24aefc[_0x0e20('0x5d')]){var _0x13bb88={};var _0x20f96a={'method':_0x0e20('0x41'),'uri':_0x0e20('0x76'),'headers':{'Authorization':_0x0e20('0x77')+_0x24aefc[_0x0e20('0x5d')],'Content-Type':'application/json'},'body':{'from':_0x24aefc[_0x0e20('0x24')],'to':_0x240e8d['phone'],'text':_0x240e8d[_0x0e20('0x26')]},'json':!![]};return rp(_0x20f96a)[_0x0e20('0x1a')](function(_0x463e90){if(_0x463e90[_0x0e20('0x78')]==0xca){_0x13bb88[_0x0e20('0x79')]=_0x463e90;var _0xe76097={'method':'POST','uri':_0x0e20('0x7a'),'headers':{'Authorization':'Bearer\x20'+_0x24aefc['apiKey'],'Content-Type':'application/json'},'body':{'refid':_0x13bb88['message']['refid']},'json':!![]};return rp(_0xe76097)['then'](function(_0x432cf0){_0x13bb88['status']=_0x432cf0;var _0x569b08={'messageId':_0x13bb88['message']['refid'],'read':!![]};return _0x2ac3e3[_0x0e20('0x2c')](_0x569b08);});}else{return logger[_0x0e20('0x2e')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x0e20('0x2f'),_0x0e20('0x75'),util['inspect'](_0x463e90,{'showHidden':![],'depth':null}));}})['catch'](function(_0x216fb9){return logger['error'](_0x0e20('0x31'),_0x0e20('0x2f'),'intelepeer',util['inspect'](_0x216fb9,{'showHidden':![],'depth':null}));});}else{return logger[_0x0e20('0x2e')](_0x0e20('0x31'),'afterCreate',_0x0e20('0x75'),'Token\x20not\x20received');}break;}}})[_0x0e20('0x7b')](function(){_0x29886f();});}else{_0x29886f();}}},'charset':_0x0e20('0x7c'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x4b71=['deliveryReport','read','skebby','inspect','Missing\x20parameters:\x20username,\x20password','connectel','senderString','https://smsapi.connectel.se/api/v2/send/','requestid','Missing\x20parameters:\x20authToken','clicksend','xCALLY\x20Motion','format','%s:%s','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','toString','base64','http_code','data','queued_count','head','message_id','clickSend','plivo','authId','token','https://api.plivo.com/v1/Account/%s/Message/','message_uuid','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/sms/2/text/advanced','application/json','IBSSO\x20','messages','Missing\x20parameters:\x20base_url','csc','crypto','login','text','timestamp','keys','sort','length','createHash','md5','digest','hex','signature=','clickatell','https://platform.clickatell.com/messages','UTF-8','bandwidth','accountId','/messages','intelepeer','apiKey','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','code','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','refid','status','Token\x20not\x20received','finally','utf8mb4','lodash','../../config/logger','request-promise','path','rimraf','../../config/environment','./smsMessage.attributes','exports','SmsMessage','sms_messages','messageId','fti_sms_messages','body','FULLTEXT','models','direction','toLowerCase','out','secret','isNil','UserId','SmsInteraction','update','createdAt','catch','error','SmsAccount','then','type','twilio','accountSid','authToken','phone','create','remote','/api/sms/messages/','/status?token=','sid','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','username','password','smsMethod','sender','login?username=','&password=','GET','POST','user_key','session_key','total_sent'];(function(_0x119280,_0x439c3e){var _0x481797=function(_0x4265cb){while(--_0x4265cb){_0x119280['push'](_0x119280['shift']());}};_0x481797(++_0x439c3e);}(_0x4b71,0x1ac));var _0x14b7=function(_0x2b3062,_0x1f4d35){_0x2b3062=_0x2b3062-0x0;var _0x528b16=_0x4b71[_0x2b3062];return _0x528b16;};'use strict';var _=require(_0x14b7('0x0'));var util=require('util');var logger=require(_0x14b7('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x14b7('0x2'));var fs=require('fs');var path=require(_0x14b7('0x3'));var rimraf=require(_0x14b7('0x4'));var config=require(_0x14b7('0x5'));var attributes=require(_0x14b7('0x6'));module[_0x14b7('0x7')]=function(_0x45a6ea,_0x8255cc){return _0x45a6ea['define'](_0x14b7('0x8'),attributes,{'tableName':_0x14b7('0x9'),'paranoid':![],'indexes':[{'name':_0x14b7('0xa'),'fields':[_0x14b7('0xa')]},{'name':_0x14b7('0xb'),'fields':[_0x14b7('0xc')],'type':_0x14b7('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x4d13a2,_0x19459d,_0x32c32f){var _0x2c7994=_0x45a6ea[_0x14b7('0xe')];var _0x315841=_0x4d13a2['get']({'plain':!![]});if(_0x315841[_0x14b7('0xf')][_0x14b7('0x10')]()==='in'||_0x315841[_0x14b7('0xf')][_0x14b7('0x10')]()===_0x14b7('0x11')&&!_0x315841[_0x14b7('0x12')]&&!_[_0x14b7('0x13')](_0x315841[_0x14b7('0x14')])&&!_['isNil'](_0x315841['SmsInteractionId'])){_0x2c7994[_0x14b7('0x15')]['findOne']({'where':{'id':_0x315841['SmsInteractionId']}})['then'](function(_0xb633ce){if(_0xb633ce){_0xb633ce[_0x14b7('0x16')]({'lastMsgAt':_0x315841[_0x14b7('0x17')],'lastMsgDirection':_0x315841[_0x14b7('0xf')][_0x14b7('0x10')]()});}})[_0x14b7('0x18')](function(_0x1ed0df){console[_0x14b7('0x19')](_0x1ed0df);});}if(_0x315841[_0x14b7('0xf')]===_0x14b7('0x11')&&!_0x315841['secret']){var _0x2fb697;_0x2c7994[_0x14b7('0x1a')]['find']({'where':{'id':_0x315841['SmsAccountId']},'raw':!![]})[_0x14b7('0x1b')](function(_0x70e586){_0x2fb697=_0x70e586;if(_0x2fb697&&_0x2fb697[_0x14b7('0x1c')]){switch(_0x2fb697['type']){case'twilio':var _0x172c56=require(_0x14b7('0x1d'));if(_0x2fb697[_0x14b7('0x1e')]&&_0x2fb697[_0x14b7('0x1f')]&&_0x2fb697[_0x14b7('0x20')]){var _0x4b3c9f=new _0x172c56(_0x2fb697[_0x14b7('0x1e')],_0x2fb697['authToken']);_0x4b3c9f['messages'][_0x14b7('0x21')]({'body':_0x315841[_0x14b7('0xc')],'to':_0x315841['phone'],'from':_0x2fb697['phone'],'statusCallback':_0x2fb697[_0x14b7('0x22')]+_0x14b7('0x23')+_0x315841['id']+_0x14b7('0x24')+_0x2fb697['token']})['then'](function(_0x3c79e3){if(_0x3c79e3[_0x14b7('0x25')]){return _0x4d13a2[_0x14b7('0x16')]({'messageId':_0x3c79e3[_0x14b7('0x25')]});}})['catch'](function(_0x8df0c4){logger[_0x14b7('0x19')](_0x14b7('0x26'),'afterCreate','twilio',util['inspect'](_0x8df0c4,{'showHidden':![],'depth':null}));});}else{logger[_0x14b7('0x19')](_0x14b7('0x26'),_0x14b7('0x27'),'twilio',_0x14b7('0x28'));}break;case'skebby':var _0x17ad1f='https://api.skebby.it/API/v1.0/REST/';if(_0x2fb697[_0x14b7('0x29')]&&_0x2fb697[_0x14b7('0x2a')]){var _0x54e31f={'recipient':[_0x315841[_0x14b7('0x20')]],'message':_0x315841[_0x14b7('0xc')],'message_type':_0x2fb697['smsMethod']};if(_0x2fb697[_0x14b7('0x2b')]&&_0x2fb697[_0x14b7('0x2b')]!=='SI'){_0x54e31f[_0x14b7('0x2c')]=_0x2fb697[_0x14b7('0x20')];}var _0x170e2f={'url':_0x17ad1f+_0x14b7('0x2d')+_0x2fb697[_0x14b7('0x29')]+_0x14b7('0x2e')+_0x2fb697[_0x14b7('0x2a')],'method':_0x14b7('0x2f')};rp(_0x170e2f)[_0x14b7('0x1b')](function(_0x1a44fd){var _0x1e7893=_0x1a44fd['split'](';');var _0x444070={'user_key':_0x1e7893[0x0],'session_key':_0x1e7893[0x1]};_0x170e2f={'url':_0x17ad1f+'sms','method':_0x14b7('0x30'),'headers':{'user_key':_0x444070[_0x14b7('0x31')],'Session_key':_0x444070[_0x14b7('0x32')]},'json':!![],'body':_0x54e31f};return rp(_0x170e2f);})['then'](function(_0x947912){if(_0x947912[_0x14b7('0x33')]>=0x1){var _0x4c43fb={'messageId':_0x947912['internal_order_id']};if(_0x2fb697[_0x14b7('0x2b')]!=='GP'||!_0x2fb697[_0x14b7('0x34')]){_0x4c43fb[_0x14b7('0x35')]=!![];}return _0x4d13a2[_0x14b7('0x16')](_0x4c43fb);}else{return logger[_0x14b7('0x19')](_0x14b7('0x26'),_0x14b7('0x27'),_0x14b7('0x36'),util['inspect'](_0x947912,{'showHidden':![],'depth':null}));}})[_0x14b7('0x18')](function(_0x53afa5){return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x14b7('0x27'),_0x14b7('0x36'),util[_0x14b7('0x37')](_0x53afa5,{'showHidden':![],'depth':null}));});}else{logger[_0x14b7('0x19')](_0x14b7('0x26'),'afterCreate',_0x14b7('0x36'),_0x14b7('0x38'));}break;case _0x14b7('0x39'):if(_0x2fb697[_0x14b7('0x1f')]){var _0x452a8f={'recipient':_0x315841[_0x14b7('0x20')],'message':_0x315841[_0x14b7('0xc')],'sender':_0x2fb697[_0x14b7('0x3a')]||_0x2fb697[_0x14b7('0x20')],'authorization':_0x2fb697[_0x14b7('0x1f')]};var _0x19459d={'method':_0x14b7('0x30'),'uri':_0x14b7('0x3b'),'body':_0x452a8f,'json':!![]};rp(_0x19459d)[_0x14b7('0x1b')](function(_0x3e1d0e){var _0x569a08={'messageId':_0x3e1d0e[_0x14b7('0x3c')]};if(!_0x2fb697[_0x14b7('0x34')]){_0x569a08[_0x14b7('0x35')]=!![];}return _0x4d13a2['update'](_0x569a08);})[_0x14b7('0x18')](function(_0x55d525){logger[_0x14b7('0x19')](_0x14b7('0x26'),_0x14b7('0x27'),_0x14b7('0x39'),util[_0x14b7('0x37')](_0x55d525,{'showHidden':![],'depth':null}));});}else{logger[_0x14b7('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x14b7('0x27'),_0x14b7('0x39'),_0x14b7('0x3d'));}break;case _0x14b7('0x3e'):if(_0x2fb697[_0x14b7('0x29')]&&_0x2fb697['password']){var _0x452a8f={'messages':[{'source':_0x14b7('0x3f'),'to':_0x315841[_0x14b7('0x20')],'body':_0x315841[_0x14b7('0xc')],'from':_0x2fb697['senderString']||_0x2fb697[_0x14b7('0x20')]}]};var _0x13f048=util[_0x14b7('0x40')](_0x14b7('0x41'),_0x2fb697[_0x14b7('0x29')],_0x2fb697[_0x14b7('0x2a')]);var _0x19459d={'method':'POST','uri':_0x14b7('0x42'),'body':_0x452a8f,'headers':{'Authorization':util[_0x14b7('0x40')](_0x14b7('0x43'),new Buffer(_0x13f048)[_0x14b7('0x44')](_0x14b7('0x45')))},'json':!![]};rp(_0x19459d)[_0x14b7('0x1b')](function(_0x24c928){if(_0x24c928[_0x14b7('0x46')]>=0xc8&&_0x24c928[_0x14b7('0x46')]<=0xce){if(_0x24c928[_0x14b7('0x47')]&&_0x24c928[_0x14b7('0x47')][_0x14b7('0x48')]>0x0){var _0x5f92c5=_[_0x14b7('0x49')](_0x24c928[_0x14b7('0x47')]['messages']);var _0x4a4b9e={'messageId':_0x5f92c5[_0x14b7('0x4a')]};if(!_0x2fb697['deliveryReport']){_0x4a4b9e['read']=!![];}return _0x4d13a2['update'](_0x4a4b9e);}else{logger['error'](_0x14b7('0x26'),_0x14b7('0x27'),_0x14b7('0x4b'),util[_0x14b7('0x37')](_0x24c928,{'showHidden':![],'depth':null}));}}else{logger[_0x14b7('0x19')](_0x14b7('0x26'),_0x14b7('0x27'),_0x14b7('0x4b'),util[_0x14b7('0x37')](_0x24c928,{'showHidden':![],'depth':null}));}})['catch'](function(_0x4e28eb){logger[_0x14b7('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','clickSend',util[_0x14b7('0x37')](_0x4e28eb,{'showHidden':![],'depth':null}));});}else{logger[_0x14b7('0x19')](_0x14b7('0x26'),'afterCreate',_0x14b7('0x4b'),_0x14b7('0x38'));}break;case _0x14b7('0x4c'):if(_0x2fb697[_0x14b7('0x4d')]&&_0x2fb697[_0x14b7('0x1f')]){var _0x452a8f={'dst':_0x315841['phone'],'text':_0x315841[_0x14b7('0xc')],'src':_0x2fb697[_0x14b7('0x3a')]||_0x2fb697[_0x14b7('0x20')],'url':_0x2fb697[_0x14b7('0x22')]+_0x14b7('0x23')+_0x315841['id']+_0x14b7('0x24')+_0x2fb697[_0x14b7('0x4e')]};var _0x13f048=util[_0x14b7('0x40')](_0x14b7('0x41'),_0x2fb697[_0x14b7('0x4d')],_0x2fb697[_0x14b7('0x1f')]);var _0x19459d={'method':_0x14b7('0x30'),'uri':util[_0x14b7('0x40')](_0x14b7('0x4f'),_0x2fb697[_0x14b7('0x4d')]),'body':_0x452a8f,'headers':{'Authorization':util[_0x14b7('0x40')]('Basic\x20%s',new Buffer(_0x13f048)[_0x14b7('0x44')]('base64'))},'json':!![]};rp(_0x19459d)[_0x14b7('0x1b')](function(_0x34d9b9){var _0x5c7fab={'messageId':_0x34d9b9[_0x14b7('0x50')][0x0]};return _0x4d13a2[_0x14b7('0x16')](_0x5c7fab);})[_0x14b7('0x18')](function(_0x421e5d){logger[_0x14b7('0x19')](_0x14b7('0x26'),_0x14b7('0x27'),_0x14b7('0x4c'),util[_0x14b7('0x37')](_0x421e5d,{'showHidden':![],'depth':null}));});}else{logger[_0x14b7('0x19')](_0x14b7('0x26'),_0x14b7('0x27'),_0x14b7('0x4c'),_0x14b7('0x51'));}break;case _0x14b7('0x52'):if(_0x2fb697['username']&&_0x2fb697[_0x14b7('0x2a')]){if(_0x2fb697[_0x14b7('0x53')]){var _0x4cead1={'method':_0x14b7('0x30'),'uri':_0x2fb697[_0x14b7('0x53')]+'/auth/1/session','body':{'username':_0x2fb697[_0x14b7('0x29')],'password':_0x2fb697[_0x14b7('0x2a')]},'json':!![]};return rp(_0x4cead1)[_0x14b7('0x1b')](function(_0xbba1dd){var _0x4c8779={'method':_0x14b7('0x30'),'uri':_0x2fb697[_0x14b7('0x53')]+_0x14b7('0x54'),'body':{'messages':[{'from':_0x2fb697[_0x14b7('0x20')],'destinations':[{'to':_0x315841['phone']}],'text':_0x315841[_0x14b7('0xc')],'notifyUrl':_0x2fb697[_0x14b7('0x22')]+_0x14b7('0x23')+_0x315841['id']+'/status?token='+_0x2fb697[_0x14b7('0x4e')],'notifyContentType':_0x14b7('0x55'),'callbackData':_0x2fb697[_0x14b7('0x20')]+';'+_0x315841[_0x14b7('0xc')]}]},'headers':{'Authorization':_0x14b7('0x56')+_0xbba1dd[_0x14b7('0x4e')]},'json':!![]};return rp(_0x4c8779)[_0x14b7('0x1b')](function(_0x2feb8b){if(_0x2feb8b[_0x14b7('0x57')]){var _0x55089b={'messageId':_0x2feb8b[_0x14b7('0x57')][0x0]['messageId']};if(!_0x2fb697[_0x14b7('0x34')]){_0x55089b['read']=!![];}return _0x4d13a2[_0x14b7('0x16')](_0x55089b);}else{return logger[_0x14b7('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','infobip',util[_0x14b7('0x37')](_0x2feb8b,{'showHidden':![],'depth':null}));}});})['catch'](function(_0x7b0f5d){return logger[_0x14b7('0x19')](_0x14b7('0x26'),_0x14b7('0x27'),_0x14b7('0x52'),util['inspect'](_0x7b0f5d,{'showHidden':![],'depth':null}));});}else{logger[_0x14b7('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x14b7('0x27'),'infobip',_0x14b7('0x58'));}}else{logger[_0x14b7('0x19')](_0x14b7('0x26'),_0x14b7('0x27'),_0x14b7('0x52'),_0x14b7('0x38'));}break;case _0x14b7('0x59'):var _0x58e63c=require(_0x14b7('0x5a'));if(_0x2fb697['apiKey']){var _0x58569c={};_0x58569c[_0x14b7('0x5b')]=_0x2fb697[_0x14b7('0x29')];_0x58569c[_0x14b7('0x20')]=_0x315841[_0x14b7('0x20')];_0x58569c[_0x14b7('0x2c')]=_0x2fb697['phone'];_0x58569c[_0x14b7('0x5c')]=_0x315841[_0x14b7('0xc')];_0x58569c[_0x14b7('0x5d')]=+new Date();var _0x4b5676='';var _0x3108a6='';var _0x38b672=Object[_0x14b7('0x5e')](_0x58569c);_0x38b672[_0x14b7('0x5f')]();for(var _0x4f0796=0x0;_0x4f0796<_0x38b672[_0x14b7('0x60')];_0x4f0796++){if(_0x4b5676!=''){_0x4b5676+='&';}_0x4b5676+=_0x38b672[_0x4f0796]+'='+encodeURIComponent(_0x58569c[_0x38b672[_0x4f0796]]);_0x3108a6+=_0x58569c[_0x38b672[_0x4f0796]];}_0x3108a6+=_0x2fb697['apiKey'];_0x3108a6=_0x58e63c[_0x14b7('0x61')](_0x14b7('0x62'))['update'](_0x3108a6)[_0x14b7('0x63')](_0x14b7('0x64'));if(_0x4b5676!==''){_0x4b5676+='&';}_0x4b5676+=_0x14b7('0x65')+_0x3108a6;var _0x170e2f={'method':_0x14b7('0x2f'),'uri':_0x2fb697[_0x14b7('0x53')]+'/external/get/send.php?'+_0x4b5676,'json':!![]};return rp(_0x170e2f)['then'](function(_0x4db376){var _0x39143f=Object[_0x14b7('0x5e')](_0x4db376);if(_0x4db376[_0x39143f[0x0]][_0x14b7('0x19')]&&parseInt(_0x4db376[_0x39143f[0x0]][_0x14b7('0x19')])===0x0){var _0x2e72fa={'messageId':_0x4db376[_0x39143f[0x0]]['id_sms']};if(!_0x2fb697['deliveryReport']){_0x2e72fa[_0x14b7('0x35')]=!![];}return _0x4d13a2[_0x14b7('0x16')](_0x2e72fa);}else{return logger[_0x14b7('0x19')](_0x14b7('0x26'),'afterCreate',_0x14b7('0x59'),util['inspect'](_0x4db376[_0x14b7('0x19')],{'showHidden':![],'depth':null}));}})[_0x14b7('0x18')](function(_0x432294){return logger[_0x14b7('0x19')](_0x14b7('0x26'),_0x14b7('0x27'),_0x14b7('0x59'),util['inspect'](_0x432294,{'showHidden':![],'depth':null}));});}else{logger[_0x14b7('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x14b7('0x59'),'Missing\x20parameters:\x20apiKey');}break;case _0x14b7('0x66'):if(_0x2fb697['apiKey']){var _0x2a30aa={'method':_0x14b7('0x30'),'uri':_0x14b7('0x67'),'headers':{'Authorization':_0x2fb697['apiKey']},'body':{'content':_0x315841[_0x14b7('0xc')],'to':[_0x315841[_0x14b7('0x20')]],'from':_0x2fb697[_0x14b7('0x20')],'binary':![],'clientMessageId':'uuid','charset':_0x14b7('0x68')},'json':!![]};rp(_0x2a30aa)[_0x14b7('0x1b')](function(_0x17645a){if(!_0x17645a[_0x14b7('0x19')]){var _0x10a8f9={'messageId':_0x17645a['messages'][0x0]['apiMessageId']};if(!_0x2fb697[_0x14b7('0x34')]){_0x10a8f9['read']=!![];}return _0x4d13a2[_0x14b7('0x16')](_0x10a8f9);}else{return logger[_0x14b7('0x19')](_0x14b7('0x26'),_0x14b7('0x27'),'clickatell',util['inspect'](_0x17645a[_0x14b7('0x19')],{'showHidden':![],'depth':null}));}})[_0x14b7('0x18')](function(_0x3d4068){return logger[_0x14b7('0x19')](_0x14b7('0x26'),_0x14b7('0x27'),_0x14b7('0x66'),util[_0x14b7('0x37')](_0x3d4068,{'showHidden':![],'depth':null}));});}else{logger[_0x14b7('0x19')](_0x14b7('0x26'),_0x14b7('0x27'),_0x14b7('0x66'),'Missing\x20parameters:\x20apiKey');}break;case _0x14b7('0x69'):if(_0x2fb697[_0x14b7('0x29')]&&_0x2fb697[_0x14b7('0x2a')]){var _0x13f048=util[_0x14b7('0x40')](_0x14b7('0x41'),_0x2fb697[_0x14b7('0x29')],_0x2fb697[_0x14b7('0x2a')]);var _0x19459d={'method':_0x14b7('0x30'),'uri':'https://messaging.bandwidth.com/api/v2/users/'+_0x2fb697[_0x14b7('0x6a')]+_0x14b7('0x6b'),'body':{'to':[_0x315841['phone']],'text':_0x315841[_0x14b7('0xc')],'from':_0x2fb697['phone'],'applicationId':_0x2fb697['applicationId']},'headers':{'Authorization':util[_0x14b7('0x40')](_0x14b7('0x43'),new Buffer(_0x13f048)['toString']('base64'))},'json':!![]};rp(_0x19459d)[_0x14b7('0x1b')](function(_0x47bb3a){if(_0x47bb3a['id']){var _0x27abbf={'messageId':_0x47bb3a['id']};return _0x4d13a2['update'](_0x27abbf);}else{logger['error'](_0x14b7('0x26'),'afterCreate',_0x14b7('0x69'),util[_0x14b7('0x37')](_0x47bb3a,{'showHidden':![],'depth':null}));}})[_0x14b7('0x18')](function(_0x2756ae){logger[_0x14b7('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x14b7('0x27'),'bandwidth',util[_0x14b7('0x37')](_0x2756ae,{'showHidden':![],'depth':null}));});}else{logger[_0x14b7('0x19')](_0x14b7('0x26'),_0x14b7('0x27'),'bandwidth','Missing\x20parameters:\x20username,\x20password');}break;case _0x14b7('0x6c'):if(_0x2fb697[_0x14b7('0x6d')]){var _0x23ef6f={};var _0x170e2f={'method':_0x14b7('0x30'),'uri':_0x14b7('0x6e'),'headers':{'Authorization':_0x14b7('0x6f')+_0x2fb697[_0x14b7('0x6d')],'Content-Type':_0x14b7('0x55')},'body':{'from':_0x2fb697['phone'],'to':_0x315841[_0x14b7('0x20')],'text':_0x315841[_0x14b7('0xc')]},'json':!![]};return rp(_0x170e2f)[_0x14b7('0x1b')](function(_0xa4de67){if(_0xa4de67[_0x14b7('0x70')]==0xca){_0x23ef6f[_0x14b7('0x71')]=_0xa4de67;var _0x216725={'method':_0x14b7('0x30'),'uri':_0x14b7('0x72'),'headers':{'Authorization':_0x14b7('0x6f')+_0x2fb697['apiKey'],'Content-Type':_0x14b7('0x55')},'body':{'refid':_0x23ef6f[_0x14b7('0x71')][_0x14b7('0x73')]},'json':!![]};return rp(_0x216725)[_0x14b7('0x1b')](function(_0x464c9b){_0x23ef6f[_0x14b7('0x74')]=_0x464c9b;var _0xcd0f2a={'messageId':_0x23ef6f['message'][_0x14b7('0x73')],'read':!![]};return _0x4d13a2[_0x14b7('0x16')](_0xcd0f2a);});}else{return logger[_0x14b7('0x19')](_0x14b7('0x26'),'afterCreate',_0x14b7('0x6c'),util[_0x14b7('0x37')](_0xa4de67,{'showHidden':![],'depth':null}));}})['catch'](function(_0x5518f5){return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x14b7('0x6c'),util[_0x14b7('0x37')](_0x5518f5,{'showHidden':![],'depth':null}));});}else{return logger[_0x14b7('0x19')](_0x14b7('0x26'),_0x14b7('0x27'),_0x14b7('0x6c'),_0x14b7('0x75'));}break;}}})[_0x14b7('0x76')](function(){_0x32c32f();});}else{_0x32c32f();}}},'charset':_0x14b7('0x77'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index fe86909..ee59772 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 _0x86b4=['rpc','../../config/environment','jayson/promise','client','redis','defaults','socket.io-emitter','./smsMessage.socket','register','request','info','request\x20sent','SmsMessage,\x20%s,\x20%s,\x20%s','error','SmsMessage,\x20%s,\x20%s','message','CreateSmsMessage','create','then','debug','stringify','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x487e48,_0x232219){var _0x934dbb=function(_0x12a6bb){while(--_0x12a6bb){_0x487e48['push'](_0x487e48['shift']());}};_0x934dbb(++_0x232219);}(_0x86b4,0x138));var _0x486b=function(_0xd5299b,_0x8c30ab){_0xd5299b=_0xd5299b-0x0;var _0x168ab5=_0x86b4[_0xd5299b];return _0x168ab5;};'use strict';var _=require('lodash');var util=require(_0x486b('0x0'));var moment=require(_0x486b('0x1'));var BPromise=require(_0x486b('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x486b('0x3'));var db=require(_0x486b('0x4'))['db'];var utils=require(_0x486b('0x5'));var logger=require(_0x486b('0x6'))(_0x486b('0x7'));var config=require(_0x486b('0x8'));var jayson=require(_0x486b('0x9'));var client=jayson[_0x486b('0xa')]['http']({'port':0x232a});config[_0x486b('0xb')]=_[_0x486b('0xc')](config[_0x486b('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x486b('0xd'))(new Redis(config[_0x486b('0xb')]));require(_0x486b('0xe'))[_0x486b('0xf')](socket);function respondWithRpcPromise(_0x51861a,_0x3d9d76,_0x356a50){return new BPromise(function(_0x1bebca,_0x36284b){return client[_0x486b('0x10')](_0x51861a,_0x356a50)['then'](function(_0x50d401){logger[_0x486b('0x11')]('SmsMessage,\x20%s,\x20%s',_0x3d9d76,_0x486b('0x12'));logger['debug'](_0x486b('0x13'),_0x3d9d76,_0x486b('0x12'),JSON['stringify'](_0x50d401));if(_0x50d401[_0x486b('0x14')]){if(_0x50d401[_0x486b('0x14')]['code']===0x1f4){logger[_0x486b('0x14')](_0x486b('0x15'),_0x3d9d76,_0x50d401[_0x486b('0x14')][_0x486b('0x16')]);return _0x36284b(_0x50d401[_0x486b('0x14')][_0x486b('0x16')]);}logger[_0x486b('0x14')](_0x486b('0x15'),_0x3d9d76,_0x50d401[_0x486b('0x14')][_0x486b('0x16')]);return _0x1bebca(_0x50d401[_0x486b('0x14')]['message']);}else{logger[_0x486b('0x11')](_0x486b('0x15'),_0x3d9d76,_0x486b('0x12'));_0x1bebca(_0x50d401['result'][_0x486b('0x16')]);}})['catch'](function(_0x11a1bb){logger['error'](_0x486b('0x15'),_0x3d9d76,_0x11a1bb);_0x36284b(_0x11a1bb);});});}exports[_0x486b('0x17')]=function(_0x965591){var _0x3a5816=this;return new Promise(function(_0x5d583f,_0x1e612f){return db['SmsMessage'][_0x486b('0x18')](_0x965591['body'],{'raw':_0x965591['options']?_0x965591['options']['raw']===undefined?!![]:![]:!![]})[_0x486b('0x19')](function(_0x3851f7){logger[_0x486b('0x11')](_0x486b('0x17'),_0x965591);logger[_0x486b('0x1a')]('CreateSmsMessage',_0x965591,JSON[_0x486b('0x1b')](_0x3851f7));_0x5d583f(_0x3851f7);})[_0x486b('0x1c')](function(_0x484574){logger[_0x486b('0x14')]('CreateSmsMessage',_0x484574[_0x486b('0x16')],_0x965591);_0x1e612f(_0x3a5816[_0x486b('0x14')](0x1f4,_0x484574[_0x486b('0x16')]));});});}; \ No newline at end of file +var _0x29ef=['SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','error','code','message','catch','CreateSmsMessage','SmsMessage','create','body','options','stringify','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','http','localhost','socket.io-emitter','redis','register','request','then'];(function(_0x315aea,_0x318a80){var _0x4a4bdb=function(_0x7c049c){while(--_0x7c049c){_0x315aea['push'](_0x315aea['shift']());}};_0x4a4bdb(++_0x318a80);}(_0x29ef,0x14d));var _0xf29e=function(_0x310504,_0x26ad95){_0x310504=_0x310504-0x0;var _0x5b36d0=_0x29ef[_0x310504];return _0x5b36d0;};'use strict';var _=require(_0xf29e('0x0'));var util=require(_0xf29e('0x1'));var moment=require('moment');var BPromise=require(_0xf29e('0x2'));var rs=require(_0xf29e('0x3'));var fs=require('fs');var Redis=require(_0xf29e('0x4'));var db=require(_0xf29e('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xf29e('0x6'))('rpc');var config=require(_0xf29e('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xf29e('0x8')]({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':_0xf29e('0x9'),'port':0x18eb});var socket=require(_0xf29e('0xa'))(new Redis(config[_0xf29e('0xb')]));require('./smsMessage.socket')[_0xf29e('0xc')](socket);function respondWithRpcPromise(_0x17c069,_0x225a03,_0xc98e67){return new BPromise(function(_0x502cbd,_0x295d1c){return client[_0xf29e('0xd')](_0x17c069,_0xc98e67)[_0xf29e('0xe')](function(_0xe86ca7){logger['info'](_0xf29e('0xf'),_0x225a03,_0xf29e('0x10'));logger[_0xf29e('0x11')](_0xf29e('0x12'),_0x225a03,_0xf29e('0x10'),JSON['stringify'](_0xe86ca7));if(_0xe86ca7[_0xf29e('0x13')]){if(_0xe86ca7[_0xf29e('0x13')][_0xf29e('0x14')]===0x1f4){logger[_0xf29e('0x13')](_0xf29e('0xf'),_0x225a03,_0xe86ca7[_0xf29e('0x13')]['message']);return _0x295d1c(_0xe86ca7[_0xf29e('0x13')][_0xf29e('0x15')]);}logger[_0xf29e('0x13')](_0xf29e('0xf'),_0x225a03,_0xe86ca7['error'][_0xf29e('0x15')]);return _0x502cbd(_0xe86ca7[_0xf29e('0x13')][_0xf29e('0x15')]);}else{logger['info']('SmsMessage,\x20%s,\x20%s',_0x225a03,_0xf29e('0x10'));_0x502cbd(_0xe86ca7['result']['message']);}})[_0xf29e('0x16')](function(_0x29ebbc){logger['error']('SmsMessage,\x20%s,\x20%s',_0x225a03,_0x29ebbc);_0x295d1c(_0x29ebbc);});});}exports[_0xf29e('0x17')]=function(_0x8515e4){var _0x1df09f=this;return new Promise(function(_0xac7ea8,_0x3b8ce9){return db[_0xf29e('0x18')][_0xf29e('0x19')](_0x8515e4[_0xf29e('0x1a')],{'raw':_0x8515e4[_0xf29e('0x1b')]?_0x8515e4[_0xf29e('0x1b')]['raw']===undefined?!![]:![]:!![]})[_0xf29e('0xe')](function(_0x1296cd){logger['info'](_0xf29e('0x17'),_0x8515e4);logger[_0xf29e('0x11')](_0xf29e('0x17'),_0x8515e4,JSON[_0xf29e('0x1c')](_0x1296cd));_0xac7ea8(_0x1296cd);})[_0xf29e('0x16')](function(_0x118faa){logger['error'](_0xf29e('0x17'),_0x118faa[_0xf29e('0x15')],_0x8515e4);_0x3b8ce9(_0x1df09f[_0xf29e('0x13')](0x1f4,_0x118faa['message']));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index 44c1748..65dd0a1 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 _0xe26a=['length','smsMessage:','save','remove','update','removeListener'];(function(_0x2873a5,_0x588b19){var _0x162506=function(_0x2d71d4){while(--_0x2d71d4){_0x2873a5['push'](_0x2873a5['shift']());}};_0x162506(++_0x588b19);}(_0xe26a,0x1a6));var _0xae26=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe26a[_0x3dd15e];return _0x231fd0;};'use strict';var SmsMessageEvents=require('./smsMessage.events');var events=[_0xae26('0x0'),_0xae26('0x1'),_0xae26('0x2')];function createListener(_0x177b71,_0x191611){return function(_0x2b5a16){_0x191611['emit'](_0x177b71,_0x2b5a16);};}function removeListener(_0x3aa101,_0x7a306c){return function(){SmsMessageEvents[_0xae26('0x3')](_0x3aa101,_0x7a306c);};}exports['register']=function(_0x394b63){for(var _0x3a2e9e=0x0,_0x2156e2=events[_0xae26('0x4')];_0x3a2e9e<_0x2156e2;_0x3a2e9e++){var _0x5f5865=events[_0x3a2e9e];var _0x16499d=createListener(_0xae26('0x5')+_0x5f5865,_0x394b63);SmsMessageEvents['on'](_0x5f5865,_0x16499d);}}; \ No newline at end of file +var _0x835b=['emit','removeListener','register','length','./smsMessage.events','remove','update'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0x835b,0xdd));var _0xb835=function(_0x2e17ee,_0x2ca16d){_0x2e17ee=_0x2e17ee-0x0;var _0x3155ba=_0x835b[_0x2e17ee];return _0x3155ba;};'use strict';var SmsMessageEvents=require(_0xb835('0x0'));var events=['save',_0xb835('0x1'),_0xb835('0x2')];function createListener(_0x2b44cc,_0x3f0959){return function(_0x5c8949){_0x3f0959[_0xb835('0x3')](_0x2b44cc,_0x5c8949);};}function removeListener(_0x4a3518,_0x356115){return function(){SmsMessageEvents[_0xb835('0x4')](_0x4a3518,_0x356115);};}exports[_0xb835('0x5')]=function(_0x3bc867){for(var _0x186354=0x0,_0x2a893a=events[_0xb835('0x6')];_0x186354<_0x2a893a;_0x186354++){var _0x304184=events[_0x186354];var _0x4f4d4f=createListener('smsMessage:'+_0x304184,_0x3bc867);SmsMessageEvents['on'](_0x304184,_0x4f4d4f);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index 2984155..d2aa3bf 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 _0x3df7=['/:id','delete','removeTeams','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','create','post','addTeams','addAgents','put','update'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3df7,0xdc));var _0x73df=function(_0x15f849,_0x4bbc2e){_0x15f849=_0x15f849-0x0;var _0xeeb648=_0x3df7[_0x15f849];return _0xeeb648;};'use strict';var multer=require(_0x73df('0x0'));var util=require('util');var path=require(_0x73df('0x1'));var timeout=require(_0x73df('0x2'));var express=require(_0x73df('0x3'));var router=express[_0x73df('0x4')]();var fs_extra=require(_0x73df('0x5'));var auth=require(_0x73df('0x6'));var interaction=require(_0x73df('0x7'));var config=require(_0x73df('0x8'));var controller=require('./smsQueue.controller');router[_0x73df('0x9')]('/',auth[_0x73df('0xa')](),controller['index']);router['get'](_0x73df('0xb'),auth[_0x73df('0xa')](),controller['describe']);router[_0x73df('0x9')]('/:id',auth[_0x73df('0xa')](),controller['show']);router[_0x73df('0x9')](_0x73df('0xc'),auth[_0x73df('0xa')](),controller['getMembers']);router[_0x73df('0x9')](_0x73df('0xd'),auth[_0x73df('0xa')](),controller[_0x73df('0xe')]);router[_0x73df('0x9')](_0x73df('0xf'),auth['isAuthenticated'](),controller[_0x73df('0x10')]);router['post']('/',auth[_0x73df('0xa')](),controller[_0x73df('0x11')]);router[_0x73df('0x12')](_0x73df('0xd'),auth[_0x73df('0xa')](),controller[_0x73df('0x13')]);router[_0x73df('0x12')](_0x73df('0xf'),auth[_0x73df('0xa')](),controller[_0x73df('0x14')]);router[_0x73df('0x15')]('/:id',auth['isAuthenticated'](),controller[_0x73df('0x16')]);router['delete'](_0x73df('0x17'),auth[_0x73df('0xa')](),controller['destroy']);router[_0x73df('0x18')](_0x73df('0xd'),auth[_0x73df('0xa')](),controller[_0x73df('0x19')]);router['delete']('/:id/users',auth['isAuthenticated'](),controller['removeAgents']);module[_0x73df('0x1a')]=router; \ No newline at end of file +var _0x0ea8=['express','Router','fs-extra','../../components/auth/service','../../config/environment','./smsQueue.controller','get','isAuthenticated','index','/describe','describe','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','addTeams','addAgents','put','/:id','delete','destroy','removeTeams','removeAgents','multer','util','path','connect-timeout'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x0ea8,0x97));var _0x80ea=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x0ea8[_0x6c993a];return _0x27f547;};'use strict';var multer=require(_0x80ea('0x0'));var util=require(_0x80ea('0x1'));var path=require(_0x80ea('0x2'));var timeout=require(_0x80ea('0x3'));var express=require(_0x80ea('0x4'));var router=express[_0x80ea('0x5')]();var fs_extra=require(_0x80ea('0x6'));var auth=require(_0x80ea('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x80ea('0x8'));var controller=require(_0x80ea('0x9'));router[_0x80ea('0xa')]('/',auth[_0x80ea('0xb')](),controller[_0x80ea('0xc')]);router[_0x80ea('0xa')](_0x80ea('0xd'),auth[_0x80ea('0xb')](),controller[_0x80ea('0xe')]);router[_0x80ea('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x80ea('0xf')]);router['get'](_0x80ea('0x10'),auth[_0x80ea('0xb')](),controller[_0x80ea('0x11')]);router[_0x80ea('0xa')](_0x80ea('0x12'),auth[_0x80ea('0xb')](),controller[_0x80ea('0x13')]);router['get'](_0x80ea('0x14'),auth['isAuthenticated'](),controller[_0x80ea('0x15')]);router[_0x80ea('0x16')]('/',auth[_0x80ea('0xb')](),controller['create']);router[_0x80ea('0x16')]('/:id/teams',auth[_0x80ea('0xb')](),controller[_0x80ea('0x17')]);router['post'](_0x80ea('0x14'),auth[_0x80ea('0xb')](),controller[_0x80ea('0x18')]);router[_0x80ea('0x19')](_0x80ea('0x1a'),auth[_0x80ea('0xb')](),controller['update']);router[_0x80ea('0x1b')](_0x80ea('0x1a'),auth['isAuthenticated'](),controller[_0x80ea('0x1c')]);router[_0x80ea('0x1b')](_0x80ea('0x12'),auth[_0x80ea('0xb')](),controller[_0x80ea('0x1d')]);router[_0x80ea('0x1b')]('/:id/users',auth[_0x80ea('0xb')](),controller[_0x80ea('0x1e')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.attributes.js b/server/api/smsQueue/smsQueue.attributes.js index df1cfee..7aed3e6 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 _0x2dea=['name','INTEGER','rrmemory','beepall','sequelize','STRING'];(function(_0xee07b5,_0x5baff5){var _0x139ade=function(_0x59c49d){while(--_0x59c49d){_0xee07b5['push'](_0xee07b5['shift']());}};_0x139ade(++_0x5baff5);}(_0x2dea,0x124));var _0xa2de=function(_0x27975e,_0x4856c2){_0x27975e=_0x27975e-0x0;var _0x383887=_0x2dea[_0x27975e];return _0x383887;};'use strict';var Sequelize=require(_0xa2de('0x0'));module['exports']={'name':{'type':Sequelize[_0xa2de('0x1')],'unique':_0xa2de('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xa2de('0x1')]},'timeout':{'type':Sequelize[_0xa2de('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0xa2de('0x4'),_0xa2de('0x5'),'roundrobin')}}; \ No newline at end of file +var _0xcf31=['STRING','name','INTEGER','ENUM','rrmemory','beepall','sequelize','exports'];(function(_0x38daa6,_0x37ca95){var _0x372625=function(_0x2b8b7c){while(--_0x2b8b7c){_0x38daa6['push'](_0x38daa6['shift']());}};_0x372625(++_0x37ca95);}(_0xcf31,0x96));var _0x1cf3=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xcf31[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0x1cf3('0x0'));module[_0x1cf3('0x1')]={'name':{'type':Sequelize[_0x1cf3('0x2')],'unique':_0x1cf3('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x1cf3('0x2')]},'timeout':{'type':Sequelize[_0x1cf3('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x1cf3('0x5')](_0x1cf3('0x6'),_0x1cf3('0x7'),'roundrobin')}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index 28fb0b4..520ac51 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 _0x2032=['offset','limit','set','Content-Range','json','update','then','get','SmsQueues','UserProfileResource','destroy','error','name','send','index','map','SmsQueue','rawAttributes','fieldName','type','getOptions','where','include','query','rows','show','keys','filters','intersection','attributes','model','fields','options','find','catch','body','user','UserProfileSection','autoAssociation','params','describe','findOne','UserSmsQueue','hasOwnProperty','order','sort','SmsQueueId','filter','merge','findAll','User','agent','smsPause','updatedAt','createdAt','%s/%s','SIP','getTeams','Team','pick','nolimit','addTeams','Agents','online','voicePause','interface','sequelize','each','findOrCreate','forEach','userSmsQueue:save','removeTeams','ids','select','field','tq.TeamId','from','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','SmsQueueId\x20=\x20?','length','clone','toString','QueryTypes','SELECT','every','TeamId','includes','all','value','transaction','isEmpty','emit','userSmsQueue:remove','addAgents','omit','spread','removeAgents','isArray','getAgents','util','lodash','squel','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsQueue.socket','register','sendStatus','end','status','count'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x2032,0xd9));var _0x2203=function(_0x1d76f7,_0x624c33){_0x1d76f7=_0x1d76f7-0x0;var _0x379e1b=_0x2032[_0x1d76f7];return _0x379e1b;};'use strict';var BPromise=require('bluebird');var util=require(_0x2203('0x0'));var _=require(_0x2203('0x1'));var squel=require(_0x2203('0x2'));var Redis=require('ioredis');var qs=require(_0x2203('0x3'));var logger=require(_0x2203('0x4'))('api');var config=require(_0x2203('0x5'));var db=require(_0x2203('0x6'))['db'];config[_0x2203('0x7')]=_[_0x2203('0x8')](config[_0x2203('0x7')],{'host':_0x2203('0x9'),'port':0x18eb});var socket=require(_0x2203('0xa'))(new Redis(config[_0x2203('0x7')]));require(_0x2203('0xb'))[_0x2203('0xc')](socket);function respondWithStatusCode(_0x2999ed,_0x5ecf9e){_0x5ecf9e=_0x5ecf9e||0xcc;return function(_0x526ae0){if(_0x526ae0){return _0x2999ed[_0x2203('0xd')](_0x5ecf9e);}return _0x2999ed['status'](_0x5ecf9e)[_0x2203('0xe')]();};}function respondWithResult(_0x2972f3,_0x6339c4){_0x6339c4=_0x6339c4||0xc8;return function(_0x5b19df){if(_0x5b19df){return _0x2972f3[_0x2203('0xf')](_0x6339c4)['json'](_0x5b19df);}};}function respondWithFilteredResult(_0x3f690a,_0x4b73be){return function(_0x297459){if(_0x297459){var _0x1abb51=typeof _0x4b73be['offset']==='undefined'&&typeof _0x4b73be['limit']==='undefined';var _0x4bad7c=_0x297459[_0x2203('0x10')];var _0x538b30=_0x1abb51?0x0:_0x4b73be['offset'];var _0x21a3af=_0x1abb51?_0x297459[_0x2203('0x10')]:_0x4b73be[_0x2203('0x11')]+_0x4b73be[_0x2203('0x12')];var _0x226209;if(_0x21a3af>=_0x4bad7c){_0x21a3af=_0x4bad7c;_0x226209=0xc8;}else{_0x226209=0xce;}_0x3f690a[_0x2203('0xf')](_0x226209);return _0x3f690a[_0x2203('0x13')](_0x2203('0x14'),_0x538b30+'-'+_0x21a3af+'/'+_0x4bad7c)[_0x2203('0x15')](_0x297459);}return null;};}function saveUpdates(_0x3053f3){return function(_0x5129fb){if(_0x5129fb){return _0x5129fb[_0x2203('0x16')](_0x3053f3)[_0x2203('0x17')](function(_0x4893ff){return _0x4893ff;});}return null;};}function removeEntity(_0x3f9ef6){return function(_0x8906e1){if(_0x8906e1){return _0x8906e1['destroy']()[_0x2203('0x17')](function(){var _0x5ee83c=_0x8906e1[_0x2203('0x18')]({'plain':!![]});var _0x310b8c=_0x2203('0x19');return db[_0x2203('0x1a')][_0x2203('0x1b')]({'where':{'type':_0x310b8c,'resourceId':_0x5ee83c['id']}})[_0x2203('0x17')](function(){return _0x8906e1;});})['then'](function(){_0x3f9ef6[_0x2203('0xf')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5ac866){return function(_0x15f543){if(!_0x15f543){_0x5ac866['sendStatus'](0x194);}return _0x15f543;};}function handleError(_0x3b8ef9,_0x5bfe61){_0x5bfe61=_0x5bfe61||0x1f4;return function(_0x5d4c4e){logger[_0x2203('0x1c')](_0x5d4c4e['stack']);if(_0x5d4c4e['name']){delete _0x5d4c4e[_0x2203('0x1d')];}_0x3b8ef9[_0x2203('0xf')](_0x5bfe61)[_0x2203('0x1e')](_0x5d4c4e);};}exports[_0x2203('0x1f')]=function(_0x1244f4,_0x3114ef){var _0x49c12={};var _0x250349={'count':0x0,'rows':[]};var _0x576378=_[_0x2203('0x20')](db[_0x2203('0x21')][_0x2203('0x22')],function(_0x5f11bf){return{'name':_0x5f11bf[_0x2203('0x23')],'type':_0x5f11bf[_0x2203('0x24')]['key']};});_0x49c12=qs[_0x2203('0x25')](_0x576378,_0x1244f4);var _0xd91f5d={'where':_0x49c12[_0x2203('0x26')]};return db[_0x2203('0x21')][_0x2203('0x10')](_0xd91f5d)[_0x2203('0x17')](function(_0x9c53f){_0x250349['count']=_0x9c53f;_0x49c12[_0x2203('0x27')]=qs[_0x2203('0x27')](_0x1244f4[_0x2203('0x28')]);return db[_0x2203('0x21')]['findAll'](_0x49c12);})[_0x2203('0x17')](function(_0x21ff0d){_0x250349[_0x2203('0x29')]=_0x21ff0d;return _0x250349;})[_0x2203('0x17')](respondWithFilteredResult(_0x3114ef,_0x49c12))['catch'](handleError(_0x3114ef,null));};exports[_0x2203('0x2a')]=function(_0x50aa17,_0x5e6560){var _0x5c0157={'raw':!![],'where':{'id':_0x50aa17['params']['id']}},_0x1d5f74={};_0x1d5f74['model']=_[_0x2203('0x2b')](db[_0x2203('0x21')][_0x2203('0x22')]);_0x1d5f74[_0x2203('0x28')]=_[_0x2203('0x2b')](_0x50aa17['query']);_0x1d5f74[_0x2203('0x2c')]=_[_0x2203('0x2d')](_0x1d5f74['model'],_0x1d5f74[_0x2203('0x28')]);_0x5c0157[_0x2203('0x2e')]=_[_0x2203('0x2d')](_0x1d5f74[_0x2203('0x2f')],qs[_0x2203('0x30')](_0x50aa17[_0x2203('0x28')][_0x2203('0x30')]));_0x5c0157[_0x2203('0x2e')]=_0x5c0157[_0x2203('0x2e')]['length']?_0x5c0157[_0x2203('0x2e')]:_0x1d5f74[_0x2203('0x2f')];if(_0x50aa17['query']['includeAll']){_0x5c0157[_0x2203('0x27')]=[{'all':!![]}];}_0x5c0157=_['merge']({},_0x5c0157,_0x50aa17[_0x2203('0x31')]);return db[_0x2203('0x21')][_0x2203('0x32')](_0x5c0157)['then'](handleEntityNotFound(_0x5e6560,null))['then'](respondWithResult(_0x5e6560,null))[_0x2203('0x33')](handleError(_0x5e6560,null));};exports['create']=function(_0x2d0365,_0x5cfe5e){return db[_0x2203('0x21')]['create'](_0x2d0365[_0x2203('0x34')],{})[_0x2203('0x17')](function(_0x4311d1){var _0x40a793=_0x2d0365[_0x2203('0x35')]['get']({'plain':!![]});if(!_0x40a793)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x40a793['role']===_0x2203('0x35')){var _0x25a2dc=_0x4311d1[_0x2203('0x18')]({'plain':!![]});var _0x3b0c7a=_0x2203('0x19');return db[_0x2203('0x36')][_0x2203('0x32')]({'where':{'name':_0x3b0c7a,'userProfileId':_0x40a793['userProfileId']},'raw':!![]})[_0x2203('0x17')](function(_0x1b12c3){if(_0x1b12c3&&_0x1b12c3[_0x2203('0x37')]===0x0){return db[_0x2203('0x1a')]['create']({'name':_0x25a2dc['name'],'resourceId':_0x25a2dc['id'],'type':_0x1b12c3[_0x2203('0x1d')],'sectionId':_0x1b12c3['id']},{})['then'](function(){return _0x4311d1;});}else{return _0x4311d1;}})[_0x2203('0x33')](function(_0x446209){logger[_0x2203('0x1c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x446209);throw _0x446209;});}return _0x4311d1;})['then'](respondWithResult(_0x5cfe5e,0xc9))[_0x2203('0x33')](handleError(_0x5cfe5e,null));};exports[_0x2203('0x16')]=function(_0x368444,_0x1e09f3){if(_0x368444[_0x2203('0x34')]['id']){delete _0x368444[_0x2203('0x34')]['id'];}return db['SmsQueue'][_0x2203('0x32')]({'where':{'id':_0x368444[_0x2203('0x38')]['id']}})[_0x2203('0x17')](handleEntityNotFound(_0x1e09f3,null))[_0x2203('0x17')](saveUpdates(_0x368444[_0x2203('0x34')],null))[_0x2203('0x17')](respondWithResult(_0x1e09f3,null))[_0x2203('0x33')](handleError(_0x1e09f3,null));};exports[_0x2203('0x1b')]=function(_0x36b8e4,_0x1e34a0){return db['SmsQueue'][_0x2203('0x32')]({'where':{'id':_0x36b8e4[_0x2203('0x38')]['id']}})[_0x2203('0x17')](handleEntityNotFound(_0x1e34a0,null))[_0x2203('0x17')](removeEntity(_0x1e34a0,null))['catch'](handleError(_0x1e34a0,null));};exports['describe']=function(_0x1c6661,_0x48129c){return db[_0x2203('0x21')][_0x2203('0x39')]()[_0x2203('0x17')](respondWithResult(_0x48129c,null))[_0x2203('0x33')](handleError(_0x48129c,null));};exports['getMembers']=function(_0x289146,_0x102803){var _0x5cd8c6={'raw':!![],'where':{}},_0x29bd91={},_0x381b3e;return db[_0x2203('0x21')][_0x2203('0x3a')]({'where':{'id':_0x289146['params']['id']}})['then'](handleEntityNotFound(_0x102803,null))[_0x2203('0x17')](function(_0x5707c8){if(_0x5707c8){_0x381b3e=_0x5707c8['get']({'plain':!![]});_0x29bd91[_0x2203('0x2f')]=_[_0x2203('0x2b')](db[_0x2203('0x3b')]['rawAttributes']);_0x29bd91['query']=_[_0x2203('0x2b')](_0x289146[_0x2203('0x28')]);_0x29bd91[_0x2203('0x2c')]=_[_0x2203('0x2d')](_0x29bd91[_0x2203('0x2f')],_0x29bd91[_0x2203('0x28')]);_0x5cd8c6['attributes']=_[_0x2203('0x2d')](_0x29bd91['model'],qs[_0x2203('0x30')](_0x289146[_0x2203('0x28')][_0x2203('0x30')]));_0x5cd8c6[_0x2203('0x2e')]=_0x5cd8c6['attributes']['length']?_0x5cd8c6[_0x2203('0x2e')]:_0x29bd91[_0x2203('0x2f')];if(!_0x289146[_0x2203('0x28')][_0x2203('0x3c')]('nolimit')){_0x5cd8c6['limit']=qs['limit'](_0x289146[_0x2203('0x28')][_0x2203('0x12')]);_0x5cd8c6['offset']=qs[_0x2203('0x11')](_0x289146[_0x2203('0x28')]['offset']);}_0x5cd8c6[_0x2203('0x3d')]=qs[_0x2203('0x3e')](_0x289146[_0x2203('0x28')][_0x2203('0x3e')]);_0x5cd8c6['where']=qs[_0x2203('0x2c')](_['pick'](_0x289146[_0x2203('0x28')],_0x29bd91[_0x2203('0x2c')]));_0x5cd8c6['where'][_0x2203('0x3f')]=_0x5707c8['id'];if(_0x289146[_0x2203('0x28')][_0x2203('0x40')]){_0x5cd8c6[_0x2203('0x26')]=_[_0x2203('0x41')](_0x5cd8c6[_0x2203('0x26')],{'$or':_['map'](_0x5cd8c6['attributes'],function(_0x2f2537){var _0x524356={};_0x524356[_0x2f2537]={'$like':'%'+_0x289146['query'][_0x2203('0x40')]+'%'};return _0x524356;})});}_0x5cd8c6=_[_0x2203('0x41')]({},_0x5cd8c6,_0x289146[_0x2203('0x31')]);return db['UserSmsQueue'][_0x2203('0x42')](_0x5cd8c6);}})['then'](function(_0x5ddf9e){if(_0x5ddf9e){return db[_0x2203('0x43')]['findAndCountAll']({'where':{'id':_['map'](_0x5ddf9e,'UserId'),'role':_0x2203('0x44')},'attributes':['id',_0x2203('0x1d'),_0x2203('0x45'),_0x2203('0x46'),_0x2203('0x47')]});}})[_0x2203('0x17')](function(_0x2baea2){if(_0x2baea2){return{'count':_0x2baea2[_0x2203('0x10')],'rows':_[_0x2203('0x20')](_0x2baea2[_0x2203('0x29')],function(_0x384a59){return{'membername':_0x384a59[_0x2203('0x1d')],'UserId':_0x384a59['id'],'queue_name':_0x381b3e['name'],'SmsQueueId':_0x381b3e['id'],'interface':util['format'](_0x2203('0x48'),_0x2203('0x49'),_0x384a59[_0x2203('0x1d')]),'penalty':0x0,'paused':_0x384a59[_0x2203('0x45')],'createdAt':_0x384a59[_0x2203('0x47')],'updatedAt':_0x384a59[_0x2203('0x46')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x102803,_0x5cd8c6))['catch'](handleError(_0x102803,null));};exports[_0x2203('0x4a')]=function(_0x34358e,_0x21ee59){var _0x1e6d21={};var _0xcab922={};var _0x7b0b9c;var _0x133d22;return db[_0x2203('0x21')][_0x2203('0x3a')]({'where':{'id':_0x34358e[_0x2203('0x38')]['id']}})[_0x2203('0x17')](handleEntityNotFound(_0x21ee59,null))['then'](function(_0x1ea97a){if(_0x1ea97a){_0x7b0b9c=_0x1ea97a;_0xcab922[_0x2203('0x2f')]=_[_0x2203('0x2b')](db[_0x2203('0x4b')][_0x2203('0x22')]);_0xcab922[_0x2203('0x28')]=_[_0x2203('0x2b')](_0x34358e[_0x2203('0x28')]);_0xcab922[_0x2203('0x2c')]=_[_0x2203('0x2d')](_0xcab922[_0x2203('0x2f')],_0xcab922[_0x2203('0x28')]);_0x1e6d21[_0x2203('0x2e')]=_[_0x2203('0x2d')](_0xcab922[_0x2203('0x2f')],qs[_0x2203('0x30')](_0x34358e[_0x2203('0x28')][_0x2203('0x30')]));_0x1e6d21[_0x2203('0x2e')]=_0x1e6d21[_0x2203('0x2e')]['length']?_0x1e6d21[_0x2203('0x2e')]:_0xcab922[_0x2203('0x2f')];_0x1e6d21[_0x2203('0x3d')]=qs['sort'](_0x34358e[_0x2203('0x28')][_0x2203('0x3e')]);_0x1e6d21[_0x2203('0x26')]=qs[_0x2203('0x2c')](_[_0x2203('0x4c')](_0x34358e['query'],_0xcab922[_0x2203('0x2c')]));if(_0x34358e[_0x2203('0x28')][_0x2203('0x40')]){_0x1e6d21['where']=_['merge'](_0x1e6d21['where'],{'$or':_['map'](_0x1e6d21['attributes'],function(_0x418d48){var _0xbc9f88={};_0xbc9f88[_0x418d48]={'$like':'%'+_0x34358e[_0x2203('0x28')][_0x2203('0x40')]+'%'};return _0xbc9f88;})});}_0x1e6d21=_[_0x2203('0x41')]({},_0x1e6d21,_0x34358e[_0x2203('0x31')]);return _0x7b0b9c[_0x2203('0x4a')](_0x1e6d21);}})[_0x2203('0x17')](function(_0x56dcbe){if(_0x56dcbe){_0x133d22=_0x56dcbe['length'];if(!_0x34358e[_0x2203('0x28')][_0x2203('0x3c')](_0x2203('0x4d'))){_0x1e6d21[_0x2203('0x12')]=qs[_0x2203('0x12')](_0x34358e[_0x2203('0x28')][_0x2203('0x12')]);_0x1e6d21[_0x2203('0x11')]=qs[_0x2203('0x11')](_0x34358e[_0x2203('0x28')][_0x2203('0x11')]);}return _0x7b0b9c[_0x2203('0x4a')](_0x1e6d21);}})[_0x2203('0x17')](function(_0xae45a5){if(_0xae45a5){return _0xae45a5?{'count':_0x133d22,'rows':_0xae45a5}:null;}})[_0x2203('0x17')](respondWithResult(_0x21ee59,null))[_0x2203('0x33')](handleError(_0x21ee59,null));};exports[_0x2203('0x4e')]=function(_0x173ac1,_0xa15021){var _0x4b2e4f=_0x173ac1[_0x2203('0x34')]['ids'];return db[_0x2203('0x4b')]['findAll']({'where':{'id':_0x4b2e4f},'attributes':['id'],'include':[{'model':db[_0x2203('0x43')],'as':_0x2203('0x4f'),'attributes':['id',_0x2203('0x1d'),_0x2203('0x50'),_0x2203('0x51'),_0x2203('0x52')],'raw':!![]}]})[_0x2203('0x17')](function(_0x2eab08){if(_0x2eab08){var _0x4e9a01=_['flatMap'](_0x2eab08,function(_0x38903b){var _0x34593a=_0x38903b[_0x2203('0x18')]({'plain':!![]});return _0x34593a['Agents'];});return db['SmsQueue']['find']({'where':{'id':_0x173ac1[_0x2203('0x38')]['id']}})[_0x2203('0x17')](function(_0x20385b){return db[_0x2203('0x53')]['transaction'](function(_0x2f7850){return _0x20385b['addTeams'](_0x4b2e4f,{'transaction':_0x2f7850})[_0x2203('0x17')](function(){return BPromise[_0x2203('0x54')](_0x4e9a01,function(_0xe3bee5){return db[_0x2203('0x3b')][_0x2203('0x55')]({'where':{'UserId':_0xe3bee5['id'],'SmsQueueId':_0x173ac1['params']['id']},'transaction':_0x2f7850});});})[_0x2203('0x17')](function(){_0x4e9a01[_0x2203('0x56')](function(_0x18663f){socket['emit'](_0x2203('0x57'),{'UserId':_0x18663f['id'],'SmsQueueId':_0x20385b['id']});});});});});}})[_0x2203('0x17')](respondWithStatusCode(_0xa15021,null))[_0x2203('0x33')](handleError(_0xa15021,null));};exports[_0x2203('0x58')]=function(_0x1c65f9,_0x4356fe){return db[_0x2203('0x4b')][_0x2203('0x42')]({'where':{'id':_0x1c65f9[_0x2203('0x28')][_0x2203('0x59')]},'attributes':['id'],'include':[{'model':db[_0x2203('0x43')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x2203('0x17')](handleEntityNotFound(_0x4356fe,null))[_0x2203('0x17')](function(_0x21b755){var _0x2da37c=_[_0x2203('0x20')](_0x21b755,'id');var _0x52c35e=[];var _0x23f7b1=[];var _0x2a5a4b=squel[_0x2203('0x5a')]();_0x2a5a4b[_0x2203('0x5b')](_0x2203('0x5c'))[_0x2203('0x5d')]('team_has_sms_queues','tq')['join'](_0x2203('0x5e'),'ut',_0x2203('0x5f'))[_0x2203('0x26')](_0x2203('0x60'),_0x1c65f9[_0x2203('0x38')]['id']);for(var _0x4fd029=0x0;_0x4fd029<_0x21b755[_0x2203('0x61')];_0x4fd029+=0x1){let _0x3cb792=_0x21b755[_0x4fd029];for(var _0x4e539b=0x0;_0x4e539b<_0x3cb792['Agents']['length'];_0x4e539b+=0x1){let _0x4fc51a=_0x3cb792['Agents'][_0x4e539b];var _0x2952fc=_0x2a5a4b[_0x2203('0x62')]();_0x2952fc[_0x2203('0x26')]('ut.UserId\x20=\x20?',_0x4fc51a['id']);_0x23f7b1['push'](db['sequelize'][_0x2203('0x28')](_0x2952fc[_0x2203('0x63')](),{'type':db[_0x2203('0x53')][_0x2203('0x64')][_0x2203('0x65')]})[_0x2203('0x17')](function(_0x3d1797){if(_0x3d1797['length']===0x1){return _0x4fc51a['id'];}else{var _0x3bf2c9=_[_0x2203('0x66')](_[_0x2203('0x20')](_0x3d1797,_0x2203('0x67')),function(_0x35ff6b){return _[_0x2203('0x68')](_0x2da37c,_0x35ff6b);});if(_0x3bf2c9){return _0x4fc51a['id'];}}}));}}return BPromise[_0x2203('0x69')](_0x23f7b1)['then'](function(_0x188722){_0x52c35e=_(_0x52c35e)['union'](_0x188722)['compact']()[_0x2203('0x6a')]();return db['SmsQueue'][_0x2203('0x32')]({'where':{'id':_0x1c65f9[_0x2203('0x38')]['id']}})['then'](function(_0x29d545){return db[_0x2203('0x53')][_0x2203('0x6b')](function(_0x461f90){return _0x29d545[_0x2203('0x58')](_0x1c65f9[_0x2203('0x28')]['ids'],{'transaction':_0x461f90})[_0x2203('0x17')](function(){if(!_[_0x2203('0x6c')](_0x52c35e)){return _0x29d545['removeAgents'](_0x52c35e,{'transaction':_0x461f90});}})['then'](function(){_0x52c35e[_0x2203('0x56')](function(_0x3fe71b){socket[_0x2203('0x6d')](_0x2203('0x6e'),{'UserId':_0x3fe71b,'SmsQueueId':_0x29d545['id']});});});});});});})[_0x2203('0x17')](respondWithStatusCode(_0x4356fe,null))[_0x2203('0x33')](handleError(_0x4356fe,null));};exports[_0x2203('0x6f')]=function(_0x3c41bf,_0x4749df){return db[_0x2203('0x21')][_0x2203('0x32')]({'where':{'id':_0x3c41bf[_0x2203('0x38')]['id']}})[_0x2203('0x17')](handleEntityNotFound(_0x4749df,null))[_0x2203('0x17')](function(_0x7589a7){if(_0x7589a7){return _0x7589a7[_0x2203('0x6f')](_0x3c41bf['body']['ids'],_[_0x2203('0x70')](_0x3c41bf[_0x2203('0x34')],['ids','id'])||{})[_0x2203('0x71')](function(_0x447a95){for(var _0x5b5e95=0x0;_0x5b5e95<_0x3c41bf[_0x2203('0x34')][_0x2203('0x59')]['length'];_0x5b5e95+=0x1){socket[_0x2203('0x6d')](_0x2203('0x57'),{'UserId':Number(_0x3c41bf['body'][_0x2203('0x59')][_0x5b5e95]),'SmsQueueId':Number(_0x3c41bf[_0x2203('0x38')]['id'])});}return _0x447a95;});}})[_0x2203('0x17')](respondWithResult(_0x4749df,null))[_0x2203('0x33')](handleError(_0x4749df,null));};exports['removeAgents']=function(_0x511c66,_0x2df837){return db[_0x2203('0x21')][_0x2203('0x32')]({'where':{'id':_0x511c66['params']['id']}})['then'](handleEntityNotFound(_0x2df837,null))[_0x2203('0x17')](function(_0x199bec){if(_0x199bec){return _0x199bec[_0x2203('0x72')](_0x511c66['query']['ids'])[_0x2203('0x17')](function(){if(_[_0x2203('0x73')](_0x511c66['query'][_0x2203('0x59')])){for(var _0x2de64d=0x0;_0x2de64d<_0x511c66['query'][_0x2203('0x59')]['length'];_0x2de64d+=0x1){socket[_0x2203('0x6d')]('userSmsQueue:remove',{'UserId':Number(_0x511c66['query']['ids'][_0x2de64d]),'SmsQueueId':Number(_0x511c66[_0x2203('0x38')]['id'])});}}else{socket[_0x2203('0x6d')]('userSmsQueue:remove',{'UserId':Number(_0x511c66[_0x2203('0x28')][_0x2203('0x59')]),'SmsQueueId':Number(_0x511c66[_0x2203('0x38')]['id'])});}});}})['then'](respondWithStatusCode(_0x2df837,null))[_0x2203('0x33')](handleError(_0x2df837,null));};exports['getAgents']=function(_0x3f31e0,_0x3edb38){var _0x486563={};var _0x4358c1={};var _0x4096f4;var _0x5bd4e4;return db[_0x2203('0x21')][_0x2203('0x3a')]({'where':{'id':_0x3f31e0[_0x2203('0x38')]['id']}})[_0x2203('0x17')](handleEntityNotFound(_0x3edb38,null))[_0x2203('0x17')](function(_0x5d73a7){if(_0x5d73a7){_0x4096f4=_0x5d73a7;_0x4358c1[_0x2203('0x2f')]=_[_0x2203('0x2b')](db[_0x2203('0x43')][_0x2203('0x22')]);_0x4358c1[_0x2203('0x28')]=_[_0x2203('0x2b')](_0x3f31e0['query']);_0x4358c1[_0x2203('0x2c')]=_[_0x2203('0x2d')](_0x4358c1['model'],_0x4358c1[_0x2203('0x28')]);_0x486563['attributes']=_[_0x2203('0x2d')](_0x4358c1[_0x2203('0x2f')],qs[_0x2203('0x30')](_0x3f31e0['query'][_0x2203('0x30')]));_0x486563[_0x2203('0x2e')]=_0x486563[_0x2203('0x2e')][_0x2203('0x61')]?_0x486563[_0x2203('0x2e')]:_0x4358c1[_0x2203('0x2f')];_0x486563[_0x2203('0x3d')]=qs['sort'](_0x3f31e0['query'][_0x2203('0x3e')]);_0x486563[_0x2203('0x26')]=qs[_0x2203('0x2c')](_[_0x2203('0x4c')](_0x3f31e0[_0x2203('0x28')],_0x4358c1[_0x2203('0x2c')]));if(_0x3f31e0[_0x2203('0x28')]['filter']){_0x486563[_0x2203('0x26')]=_[_0x2203('0x41')](_0x486563['where'],{'$or':_[_0x2203('0x20')](_0x486563['attributes'],function(_0xc3dac5){var _0xbd1866={};_0xbd1866[_0xc3dac5]={'$like':'%'+_0x3f31e0['query'][_0x2203('0x40')]+'%'};return _0xbd1866;})});}_0x486563=_[_0x2203('0x41')]({},_0x486563,_0x3f31e0[_0x2203('0x31')]);return _0x4096f4[_0x2203('0x74')](_0x486563);}})[_0x2203('0x17')](function(_0x36ab7f){if(_0x36ab7f){_0x5bd4e4=_0x36ab7f[_0x2203('0x61')];if(!_0x3f31e0[_0x2203('0x28')][_0x2203('0x3c')](_0x2203('0x4d'))){_0x486563[_0x2203('0x12')]=qs[_0x2203('0x12')](_0x3f31e0['query'][_0x2203('0x12')]);_0x486563['offset']=qs[_0x2203('0x11')](_0x3f31e0[_0x2203('0x28')][_0x2203('0x11')]);}return _0x4096f4[_0x2203('0x74')](_0x486563);}})[_0x2203('0x17')](function(_0x2159a5){if(_0x2159a5){return _0x2159a5?{'count':_0x5bd4e4,'rows':_0x2159a5}:null;}})[_0x2203('0x17')](respondWithResult(_0x3edb38,null))[_0x2203('0x33')](handleError(_0x3edb38,null));}; \ No newline at end of file +var _0x5f2f=['redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','get','SmsQueues','UserProfileResource','error','stack','name','map','SmsQueue','rawAttributes','type','key','getOptions','where','include','findAll','rows','show','params','model','keys','query','filters','intersection','attributes','fields','includeAll','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserSmsQueue','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','findAndCountAll','UserId','agent','smsPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','Team','addTeams','ids','User','Agents','online','voicePause','interface','flatMap','findOrCreate','forEach','emit','userSmsQueue:save','removeTeams','field','SmsQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','value','sequelize','transaction','isEmpty','removeAgents','addAgents','omit','spread','isArray','userSmsQueue:remove','getAgents','bluebird','util','lodash','squel','ioredis','../../components/parsers/qs','../../config/logger','api'];(function(_0x54820c,_0xd5a2f6){var _0x5c60c1=function(_0x495680){while(--_0x495680){_0x54820c['push'](_0x54820c['shift']());}};_0x5c60c1(++_0xd5a2f6);}(_0x5f2f,0x73));var _0xf5f2=function(_0x1599c9,_0x172bdb){_0x1599c9=_0x1599c9-0x0;var _0x46b583=_0x5f2f[_0x1599c9];return _0x46b583;};'use strict';var BPromise=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var _=require(_0xf5f2('0x2'));var squel=require(_0xf5f2('0x3'));var Redis=require(_0xf5f2('0x4'));var qs=require(_0xf5f2('0x5'));var logger=require(_0xf5f2('0x6'))(_0xf5f2('0x7'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0xf5f2('0x8')]=_[_0xf5f2('0x9')](config[_0xf5f2('0x8')],{'host':_0xf5f2('0xa'),'port':0x18eb});var socket=require(_0xf5f2('0xb'))(new Redis(config[_0xf5f2('0x8')]));require('./smsQueue.socket')[_0xf5f2('0xc')](socket);function respondWithStatusCode(_0x46cd9c,_0x2ec345){_0x2ec345=_0x2ec345||0xcc;return function(_0x56a69f){if(_0x56a69f){return _0x46cd9c[_0xf5f2('0xd')](_0x2ec345);}return _0x46cd9c[_0xf5f2('0xe')](_0x2ec345)[_0xf5f2('0xf')]();};}function respondWithResult(_0x4e0e6b,_0x977a59){_0x977a59=_0x977a59||0xc8;return function(_0x4ebbbe){if(_0x4ebbbe){return _0x4e0e6b['status'](_0x977a59)[_0xf5f2('0x10')](_0x4ebbbe);}};}function respondWithFilteredResult(_0x151aba,_0x4b78cd){return function(_0x336f6b){if(_0x336f6b){var _0x14b51f=typeof _0x4b78cd[_0xf5f2('0x11')]===_0xf5f2('0x12')&&typeof _0x4b78cd[_0xf5f2('0x13')]===_0xf5f2('0x12');var _0x5c01b8=_0x336f6b[_0xf5f2('0x14')];var _0xea612c=_0x14b51f?0x0:_0x4b78cd[_0xf5f2('0x11')];var _0x1c1a5c=_0x14b51f?_0x336f6b[_0xf5f2('0x14')]:_0x4b78cd['offset']+_0x4b78cd[_0xf5f2('0x13')];var _0x286197;if(_0x1c1a5c>=_0x5c01b8){_0x1c1a5c=_0x5c01b8;_0x286197=0xc8;}else{_0x286197=0xce;}_0x151aba[_0xf5f2('0xe')](_0x286197);return _0x151aba[_0xf5f2('0x15')](_0xf5f2('0x16'),_0xea612c+'-'+_0x1c1a5c+'/'+_0x5c01b8)[_0xf5f2('0x10')](_0x336f6b);}return null;};}function saveUpdates(_0xdb61b3){return function(_0x395a5a){if(_0x395a5a){return _0x395a5a[_0xf5f2('0x17')](_0xdb61b3)[_0xf5f2('0x18')](function(_0x20fccd){return _0x20fccd;});}return null;};}function removeEntity(_0x28e097){return function(_0x4ff59b){if(_0x4ff59b){return _0x4ff59b[_0xf5f2('0x19')]()[_0xf5f2('0x18')](function(){var _0x626999=_0x4ff59b[_0xf5f2('0x1a')]({'plain':!![]});var _0x56acc5=_0xf5f2('0x1b');return db[_0xf5f2('0x1c')]['destroy']({'where':{'type':_0x56acc5,'resourceId':_0x626999['id']}})['then'](function(){return _0x4ff59b;});})[_0xf5f2('0x18')](function(){_0x28e097[_0xf5f2('0xe')](0xcc)['end']();});}};}function handleEntityNotFound(_0x45b74f){return function(_0x170042){if(!_0x170042){_0x45b74f[_0xf5f2('0xd')](0x194);}return _0x170042;};}function handleError(_0x39c024,_0x36f1cb){_0x36f1cb=_0x36f1cb||0x1f4;return function(_0x4c691a){logger[_0xf5f2('0x1d')](_0x4c691a[_0xf5f2('0x1e')]);if(_0x4c691a[_0xf5f2('0x1f')]){delete _0x4c691a[_0xf5f2('0x1f')];}_0x39c024[_0xf5f2('0xe')](_0x36f1cb)['send'](_0x4c691a);};}exports['index']=function(_0x5f1124,_0x3f79d5){var _0x13da6f={};var _0x1a5bb3={'count':0x0,'rows':[]};var _0xf6c58d=_[_0xf5f2('0x20')](db[_0xf5f2('0x21')][_0xf5f2('0x22')],function(_0x294414){return{'name':_0x294414['fieldName'],'type':_0x294414[_0xf5f2('0x23')][_0xf5f2('0x24')]};});_0x13da6f=qs[_0xf5f2('0x25')](_0xf6c58d,_0x5f1124);var _0x31bfcb={'where':_0x13da6f[_0xf5f2('0x26')]};return db[_0xf5f2('0x21')]['count'](_0x31bfcb)['then'](function(_0x22c826){_0x1a5bb3[_0xf5f2('0x14')]=_0x22c826;_0x13da6f[_0xf5f2('0x27')]=qs['include'](_0x5f1124['query']);return db[_0xf5f2('0x21')][_0xf5f2('0x28')](_0x13da6f);})[_0xf5f2('0x18')](function(_0x153924){_0x1a5bb3[_0xf5f2('0x29')]=_0x153924;return _0x1a5bb3;})['then'](respondWithFilteredResult(_0x3f79d5,_0x13da6f))['catch'](handleError(_0x3f79d5,null));};exports[_0xf5f2('0x2a')]=function(_0x4e19cb,_0xb744b9){var _0x58a4df={'raw':!![],'where':{'id':_0x4e19cb[_0xf5f2('0x2b')]['id']}},_0x45b643={};_0x45b643[_0xf5f2('0x2c')]=_[_0xf5f2('0x2d')](db[_0xf5f2('0x21')][_0xf5f2('0x22')]);_0x45b643[_0xf5f2('0x2e')]=_[_0xf5f2('0x2d')](_0x4e19cb['query']);_0x45b643[_0xf5f2('0x2f')]=_[_0xf5f2('0x30')](_0x45b643[_0xf5f2('0x2c')],_0x45b643[_0xf5f2('0x2e')]);_0x58a4df[_0xf5f2('0x31')]=_[_0xf5f2('0x30')](_0x45b643[_0xf5f2('0x2c')],qs['fields'](_0x4e19cb[_0xf5f2('0x2e')][_0xf5f2('0x32')]));_0x58a4df['attributes']=_0x58a4df[_0xf5f2('0x31')]['length']?_0x58a4df[_0xf5f2('0x31')]:_0x45b643[_0xf5f2('0x2c')];if(_0x4e19cb[_0xf5f2('0x2e')][_0xf5f2('0x33')]){_0x58a4df['include']=[{'all':!![]}];}_0x58a4df=_['merge']({},_0x58a4df,_0x4e19cb[_0xf5f2('0x34')]);return db[_0xf5f2('0x21')][_0xf5f2('0x35')](_0x58a4df)['then'](handleEntityNotFound(_0xb744b9,null))[_0xf5f2('0x18')](respondWithResult(_0xb744b9,null))['catch'](handleError(_0xb744b9,null));};exports[_0xf5f2('0x36')]=function(_0x566c47,_0x46f464){return db[_0xf5f2('0x21')]['create'](_0x566c47[_0xf5f2('0x37')],{})[_0xf5f2('0x18')](function(_0x5a4441){var _0x35f738=_0x566c47['user']['get']({'plain':!![]});if(!_0x35f738)throw new Error(_0xf5f2('0x38'));if(_0x35f738[_0xf5f2('0x39')]===_0xf5f2('0x3a')){var _0x2d4400=_0x5a4441[_0xf5f2('0x1a')]({'plain':!![]});var _0xe62b57=_0xf5f2('0x1b');return db['UserProfileSection'][_0xf5f2('0x35')]({'where':{'name':_0xe62b57,'userProfileId':_0x35f738[_0xf5f2('0x3b')]},'raw':!![]})['then'](function(_0xc6a1ae){if(_0xc6a1ae&&_0xc6a1ae[_0xf5f2('0x3c')]===0x0){return db[_0xf5f2('0x1c')][_0xf5f2('0x36')]({'name':_0x2d4400[_0xf5f2('0x1f')],'resourceId':_0x2d4400['id'],'type':_0xc6a1ae[_0xf5f2('0x1f')],'sectionId':_0xc6a1ae['id']},{})[_0xf5f2('0x18')](function(){return _0x5a4441;});}else{return _0x5a4441;}})[_0xf5f2('0x3d')](function(_0x574f24){logger[_0xf5f2('0x1d')](_0xf5f2('0x3e'),_0x574f24);throw _0x574f24;});}return _0x5a4441;})[_0xf5f2('0x18')](respondWithResult(_0x46f464,0xc9))['catch'](handleError(_0x46f464,null));};exports['update']=function(_0x59eb00,_0x76d21b){if(_0x59eb00[_0xf5f2('0x37')]['id']){delete _0x59eb00['body']['id'];}return db[_0xf5f2('0x21')][_0xf5f2('0x35')]({'where':{'id':_0x59eb00[_0xf5f2('0x2b')]['id']}})[_0xf5f2('0x18')](handleEntityNotFound(_0x76d21b,null))[_0xf5f2('0x18')](saveUpdates(_0x59eb00[_0xf5f2('0x37')],null))[_0xf5f2('0x18')](respondWithResult(_0x76d21b,null))[_0xf5f2('0x3d')](handleError(_0x76d21b,null));};exports[_0xf5f2('0x19')]=function(_0x106062,_0x444317){return db[_0xf5f2('0x21')][_0xf5f2('0x35')]({'where':{'id':_0x106062[_0xf5f2('0x2b')]['id']}})['then'](handleEntityNotFound(_0x444317,null))[_0xf5f2('0x18')](removeEntity(_0x444317,null))['catch'](handleError(_0x444317,null));};exports[_0xf5f2('0x3f')]=function(_0xc04f44,_0x218def){return db[_0xf5f2('0x21')][_0xf5f2('0x3f')]()[_0xf5f2('0x18')](respondWithResult(_0x218def,null))['catch'](handleError(_0x218def,null));};exports[_0xf5f2('0x40')]=function(_0x2e7193,_0x1c1497){var _0x29b108={'raw':!![],'where':{}},_0x12124d={},_0x10753a;return db[_0xf5f2('0x21')][_0xf5f2('0x41')]({'where':{'id':_0x2e7193['params']['id']}})[_0xf5f2('0x18')](handleEntityNotFound(_0x1c1497,null))[_0xf5f2('0x18')](function(_0x45db9a){if(_0x45db9a){_0x10753a=_0x45db9a['get']({'plain':!![]});_0x12124d[_0xf5f2('0x2c')]=_[_0xf5f2('0x2d')](db[_0xf5f2('0x42')]['rawAttributes']);_0x12124d['query']=_[_0xf5f2('0x2d')](_0x2e7193[_0xf5f2('0x2e')]);_0x12124d['filters']=_[_0xf5f2('0x30')](_0x12124d['model'],_0x12124d[_0xf5f2('0x2e')]);_0x29b108['attributes']=_[_0xf5f2('0x30')](_0x12124d['model'],qs[_0xf5f2('0x32')](_0x2e7193[_0xf5f2('0x2e')][_0xf5f2('0x32')]));_0x29b108[_0xf5f2('0x31')]=_0x29b108['attributes'][_0xf5f2('0x43')]?_0x29b108[_0xf5f2('0x31')]:_0x12124d['model'];if(!_0x2e7193['query'][_0xf5f2('0x44')](_0xf5f2('0x45'))){_0x29b108['limit']=qs[_0xf5f2('0x13')](_0x2e7193[_0xf5f2('0x2e')][_0xf5f2('0x13')]);_0x29b108[_0xf5f2('0x11')]=qs['offset'](_0x2e7193['query'][_0xf5f2('0x11')]);}_0x29b108[_0xf5f2('0x46')]=qs['sort'](_0x2e7193[_0xf5f2('0x2e')][_0xf5f2('0x47')]);_0x29b108[_0xf5f2('0x26')]=qs[_0xf5f2('0x2f')](_[_0xf5f2('0x48')](_0x2e7193[_0xf5f2('0x2e')],_0x12124d[_0xf5f2('0x2f')]));_0x29b108['where']['SmsQueueId']=_0x45db9a['id'];if(_0x2e7193[_0xf5f2('0x2e')][_0xf5f2('0x49')]){_0x29b108[_0xf5f2('0x26')]=_[_0xf5f2('0x4a')](_0x29b108[_0xf5f2('0x26')],{'$or':_['map'](_0x29b108[_0xf5f2('0x31')],function(_0x20ba91){var _0x18b124={};_0x18b124[_0x20ba91]={'$like':'%'+_0x2e7193['query'][_0xf5f2('0x49')]+'%'};return _0x18b124;})});}_0x29b108=_['merge']({},_0x29b108,_0x2e7193[_0xf5f2('0x34')]);return db[_0xf5f2('0x42')][_0xf5f2('0x28')](_0x29b108);}})[_0xf5f2('0x18')](function(_0x4afa4d){if(_0x4afa4d){return db['User'][_0xf5f2('0x4b')]({'where':{'id':_['map'](_0x4afa4d,_0xf5f2('0x4c')),'role':_0xf5f2('0x4d')},'attributes':['id','name',_0xf5f2('0x4e'),_0xf5f2('0x4f'),_0xf5f2('0x50')]});}})['then'](function(_0x397b99){if(_0x397b99){return{'count':_0x397b99[_0xf5f2('0x14')],'rows':_[_0xf5f2('0x20')](_0x397b99[_0xf5f2('0x29')],function(_0x51fa7e){return{'membername':_0x51fa7e[_0xf5f2('0x1f')],'UserId':_0x51fa7e['id'],'queue_name':_0x10753a['name'],'SmsQueueId':_0x10753a['id'],'interface':util[_0xf5f2('0x51')](_0xf5f2('0x52'),_0xf5f2('0x53'),_0x51fa7e[_0xf5f2('0x1f')]),'penalty':0x0,'paused':_0x51fa7e[_0xf5f2('0x4e')],'createdAt':_0x51fa7e['createdAt'],'updatedAt':_0x51fa7e[_0xf5f2('0x4f')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xf5f2('0x18')](respondWithFilteredResult(_0x1c1497,_0x29b108))[_0xf5f2('0x3d')](handleError(_0x1c1497,null));};exports[_0xf5f2('0x54')]=function(_0x2c5733,_0x5359b5){var _0x31e16b={};var _0x5ee6bc={};var _0x4c96ee;var _0xd4f6ef;return db['SmsQueue'][_0xf5f2('0x41')]({'where':{'id':_0x2c5733[_0xf5f2('0x2b')]['id']}})[_0xf5f2('0x18')](handleEntityNotFound(_0x5359b5,null))[_0xf5f2('0x18')](function(_0x5767fc){if(_0x5767fc){_0x4c96ee=_0x5767fc;_0x5ee6bc[_0xf5f2('0x2c')]=_[_0xf5f2('0x2d')](db[_0xf5f2('0x55')][_0xf5f2('0x22')]);_0x5ee6bc[_0xf5f2('0x2e')]=_[_0xf5f2('0x2d')](_0x2c5733[_0xf5f2('0x2e')]);_0x5ee6bc['filters']=_[_0xf5f2('0x30')](_0x5ee6bc[_0xf5f2('0x2c')],_0x5ee6bc[_0xf5f2('0x2e')]);_0x31e16b[_0xf5f2('0x31')]=_['intersection'](_0x5ee6bc[_0xf5f2('0x2c')],qs['fields'](_0x2c5733[_0xf5f2('0x2e')][_0xf5f2('0x32')]));_0x31e16b['attributes']=_0x31e16b[_0xf5f2('0x31')][_0xf5f2('0x43')]?_0x31e16b[_0xf5f2('0x31')]:_0x5ee6bc[_0xf5f2('0x2c')];_0x31e16b[_0xf5f2('0x46')]=qs['sort'](_0x2c5733[_0xf5f2('0x2e')][_0xf5f2('0x47')]);_0x31e16b[_0xf5f2('0x26')]=qs[_0xf5f2('0x2f')](_[_0xf5f2('0x48')](_0x2c5733[_0xf5f2('0x2e')],_0x5ee6bc['filters']));if(_0x2c5733[_0xf5f2('0x2e')][_0xf5f2('0x49')]){_0x31e16b['where']=_[_0xf5f2('0x4a')](_0x31e16b[_0xf5f2('0x26')],{'$or':_[_0xf5f2('0x20')](_0x31e16b['attributes'],function(_0x551cc9){var _0x4f3df6={};_0x4f3df6[_0x551cc9]={'$like':'%'+_0x2c5733[_0xf5f2('0x2e')][_0xf5f2('0x49')]+'%'};return _0x4f3df6;})});}_0x31e16b=_[_0xf5f2('0x4a')]({},_0x31e16b,_0x2c5733[_0xf5f2('0x34')]);return _0x4c96ee[_0xf5f2('0x54')](_0x31e16b);}})['then'](function(_0x278b76){if(_0x278b76){_0xd4f6ef=_0x278b76[_0xf5f2('0x43')];if(!_0x2c5733[_0xf5f2('0x2e')][_0xf5f2('0x44')](_0xf5f2('0x45'))){_0x31e16b[_0xf5f2('0x13')]=qs[_0xf5f2('0x13')](_0x2c5733[_0xf5f2('0x2e')][_0xf5f2('0x13')]);_0x31e16b[_0xf5f2('0x11')]=qs[_0xf5f2('0x11')](_0x2c5733['query']['offset']);}return _0x4c96ee['getTeams'](_0x31e16b);}})[_0xf5f2('0x18')](function(_0xafba8e){if(_0xafba8e){return _0xafba8e?{'count':_0xd4f6ef,'rows':_0xafba8e}:null;}})[_0xf5f2('0x18')](respondWithResult(_0x5359b5,null))[_0xf5f2('0x3d')](handleError(_0x5359b5,null));};exports[_0xf5f2('0x56')]=function(_0x5c6959,_0x9d943f){var _0x43c732=_0x5c6959[_0xf5f2('0x37')][_0xf5f2('0x57')];return db[_0xf5f2('0x55')]['findAll']({'where':{'id':_0x43c732},'attributes':['id'],'include':[{'model':db[_0xf5f2('0x58')],'as':_0xf5f2('0x59'),'attributes':['id','name',_0xf5f2('0x5a'),_0xf5f2('0x5b'),_0xf5f2('0x5c')],'raw':!![]}]})[_0xf5f2('0x18')](function(_0x588434){if(_0x588434){var _0x40b36e=_[_0xf5f2('0x5d')](_0x588434,function(_0x19602d){var _0x2adeb4=_0x19602d[_0xf5f2('0x1a')]({'plain':!![]});return _0x2adeb4['Agents'];});return db['SmsQueue'][_0xf5f2('0x35')]({'where':{'id':_0x5c6959[_0xf5f2('0x2b')]['id']}})[_0xf5f2('0x18')](function(_0xe3ea1e){return db['sequelize']['transaction'](function(_0x16048e){return _0xe3ea1e['addTeams'](_0x43c732,{'transaction':_0x16048e})['then'](function(){return BPromise['each'](_0x40b36e,function(_0x57cb18){return db[_0xf5f2('0x42')][_0xf5f2('0x5e')]({'where':{'UserId':_0x57cb18['id'],'SmsQueueId':_0x5c6959[_0xf5f2('0x2b')]['id']},'transaction':_0x16048e});});})[_0xf5f2('0x18')](function(){_0x40b36e[_0xf5f2('0x5f')](function(_0x9f941e){socket[_0xf5f2('0x60')](_0xf5f2('0x61'),{'UserId':_0x9f941e['id'],'SmsQueueId':_0xe3ea1e['id']});});});});});}})[_0xf5f2('0x18')](respondWithStatusCode(_0x9d943f,null))[_0xf5f2('0x3d')](handleError(_0x9d943f,null));};exports[_0xf5f2('0x62')]=function(_0x2afeac,_0x1ba503){return db[_0xf5f2('0x55')][_0xf5f2('0x28')]({'where':{'id':_0x2afeac[_0xf5f2('0x2e')][_0xf5f2('0x57')]},'attributes':['id'],'include':[{'model':db[_0xf5f2('0x58')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xf5f2('0x18')](handleEntityNotFound(_0x1ba503,null))[_0xf5f2('0x18')](function(_0x21043b){var _0x2811ad=_[_0xf5f2('0x20')](_0x21043b,'id');var _0x308220=[];var _0x16491c=[];var _0xcf48eb=squel['select']();_0xcf48eb[_0xf5f2('0x63')]('tq.TeamId')['from']('team_has_sms_queues','tq')['join']('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')[_0xf5f2('0x26')](_0xf5f2('0x64'),_0x2afeac[_0xf5f2('0x2b')]['id']);for(var _0x375bc9=0x0;_0x375bc9<_0x21043b[_0xf5f2('0x43')];_0x375bc9+=0x1){let _0x3cf857=_0x21043b[_0x375bc9];for(var _0x5dc63f=0x0;_0x5dc63f<_0x3cf857['Agents'][_0xf5f2('0x43')];_0x5dc63f+=0x1){let _0x578a22=_0x3cf857[_0xf5f2('0x59')][_0x5dc63f];var _0x186fdd=_0xcf48eb['clone']();_0x186fdd['where'](_0xf5f2('0x65'),_0x578a22['id']);_0x16491c[_0xf5f2('0x66')](db['sequelize'][_0xf5f2('0x2e')](_0x186fdd[_0xf5f2('0x67')](),{'type':db['sequelize'][_0xf5f2('0x68')][_0xf5f2('0x69')]})[_0xf5f2('0x18')](function(_0x4c1678){if(_0x4c1678[_0xf5f2('0x43')]===0x1){return _0x578a22['id'];}else{var _0xc28adc=_[_0xf5f2('0x6a')](_[_0xf5f2('0x20')](_0x4c1678,_0xf5f2('0x6b')),function(_0x3e0288){return _[_0xf5f2('0x6c')](_0x2811ad,_0x3e0288);});if(_0xc28adc){return _0x578a22['id'];}}}));}}return BPromise[_0xf5f2('0x6d')](_0x16491c)[_0xf5f2('0x18')](function(_0x3a6f60){_0x308220=_(_0x308220)[_0xf5f2('0x6e')](_0x3a6f60)[_0xf5f2('0x6f')]()[_0xf5f2('0x70')]();return db[_0xf5f2('0x21')][_0xf5f2('0x35')]({'where':{'id':_0x2afeac[_0xf5f2('0x2b')]['id']}})[_0xf5f2('0x18')](function(_0x29a9d4){return db[_0xf5f2('0x71')][_0xf5f2('0x72')](function(_0x800f42){return _0x29a9d4['removeTeams'](_0x2afeac[_0xf5f2('0x2e')][_0xf5f2('0x57')],{'transaction':_0x800f42})['then'](function(){if(!_[_0xf5f2('0x73')](_0x308220)){return _0x29a9d4[_0xf5f2('0x74')](_0x308220,{'transaction':_0x800f42});}})['then'](function(){_0x308220[_0xf5f2('0x5f')](function(_0x2f54eb){socket[_0xf5f2('0x60')]('userSmsQueue:remove',{'UserId':_0x2f54eb,'SmsQueueId':_0x29a9d4['id']});});});});});});})['then'](respondWithStatusCode(_0x1ba503,null))[_0xf5f2('0x3d')](handleError(_0x1ba503,null));};exports[_0xf5f2('0x75')]=function(_0x213ade,_0x5ba275){return db['SmsQueue'][_0xf5f2('0x35')]({'where':{'id':_0x213ade[_0xf5f2('0x2b')]['id']}})[_0xf5f2('0x18')](handleEntityNotFound(_0x5ba275,null))['then'](function(_0x4cde64){if(_0x4cde64){return _0x4cde64['addAgents'](_0x213ade['body']['ids'],_[_0xf5f2('0x76')](_0x213ade['body'],[_0xf5f2('0x57'),'id'])||{})[_0xf5f2('0x77')](function(_0xec3c35){for(var _0x43a167=0x0;_0x43a167<_0x213ade[_0xf5f2('0x37')][_0xf5f2('0x57')][_0xf5f2('0x43')];_0x43a167+=0x1){socket[_0xf5f2('0x60')](_0xf5f2('0x61'),{'UserId':Number(_0x213ade[_0xf5f2('0x37')][_0xf5f2('0x57')][_0x43a167]),'SmsQueueId':Number(_0x213ade[_0xf5f2('0x2b')]['id'])});}return _0xec3c35;});}})[_0xf5f2('0x18')](respondWithResult(_0x5ba275,null))['catch'](handleError(_0x5ba275,null));};exports[_0xf5f2('0x74')]=function(_0x2a4fed,_0x5783e2){return db[_0xf5f2('0x21')][_0xf5f2('0x35')]({'where':{'id':_0x2a4fed['params']['id']}})[_0xf5f2('0x18')](handleEntityNotFound(_0x5783e2,null))[_0xf5f2('0x18')](function(_0x281f61){if(_0x281f61){return _0x281f61['removeAgents'](_0x2a4fed[_0xf5f2('0x2e')][_0xf5f2('0x57')])['then'](function(){if(_[_0xf5f2('0x78')](_0x2a4fed[_0xf5f2('0x2e')][_0xf5f2('0x57')])){for(var _0x517aa8=0x0;_0x517aa8<_0x2a4fed[_0xf5f2('0x2e')]['ids'][_0xf5f2('0x43')];_0x517aa8+=0x1){socket['emit'](_0xf5f2('0x79'),{'UserId':Number(_0x2a4fed[_0xf5f2('0x2e')][_0xf5f2('0x57')][_0x517aa8]),'SmsQueueId':Number(_0x2a4fed[_0xf5f2('0x2b')]['id'])});}}else{socket['emit'](_0xf5f2('0x79'),{'UserId':Number(_0x2a4fed['query']['ids']),'SmsQueueId':Number(_0x2a4fed['params']['id'])});}});}})[_0xf5f2('0x18')](respondWithStatusCode(_0x5783e2,null))[_0xf5f2('0x3d')](handleError(_0x5783e2,null));};exports['getAgents']=function(_0x3c8a1b,_0x15025d){var _0x35790b={};var _0x3962b2={};var _0x28873e;var _0x1fc5ae;return db['SmsQueue'][_0xf5f2('0x41')]({'where':{'id':_0x3c8a1b[_0xf5f2('0x2b')]['id']}})['then'](handleEntityNotFound(_0x15025d,null))[_0xf5f2('0x18')](function(_0x19cbff){if(_0x19cbff){_0x28873e=_0x19cbff;_0x3962b2['model']=_[_0xf5f2('0x2d')](db[_0xf5f2('0x58')][_0xf5f2('0x22')]);_0x3962b2[_0xf5f2('0x2e')]=_[_0xf5f2('0x2d')](_0x3c8a1b[_0xf5f2('0x2e')]);_0x3962b2['filters']=_[_0xf5f2('0x30')](_0x3962b2[_0xf5f2('0x2c')],_0x3962b2[_0xf5f2('0x2e')]);_0x35790b[_0xf5f2('0x31')]=_[_0xf5f2('0x30')](_0x3962b2[_0xf5f2('0x2c')],qs[_0xf5f2('0x32')](_0x3c8a1b[_0xf5f2('0x2e')][_0xf5f2('0x32')]));_0x35790b['attributes']=_0x35790b[_0xf5f2('0x31')][_0xf5f2('0x43')]?_0x35790b[_0xf5f2('0x31')]:_0x3962b2[_0xf5f2('0x2c')];_0x35790b[_0xf5f2('0x46')]=qs[_0xf5f2('0x47')](_0x3c8a1b[_0xf5f2('0x2e')][_0xf5f2('0x47')]);_0x35790b[_0xf5f2('0x26')]=qs[_0xf5f2('0x2f')](_['pick'](_0x3c8a1b['query'],_0x3962b2[_0xf5f2('0x2f')]));if(_0x3c8a1b[_0xf5f2('0x2e')][_0xf5f2('0x49')]){_0x35790b[_0xf5f2('0x26')]=_['merge'](_0x35790b[_0xf5f2('0x26')],{'$or':_[_0xf5f2('0x20')](_0x35790b[_0xf5f2('0x31')],function(_0x3d7f53){var _0x456a1e={};_0x456a1e[_0x3d7f53]={'$like':'%'+_0x3c8a1b['query'][_0xf5f2('0x49')]+'%'};return _0x456a1e;})});}_0x35790b=_[_0xf5f2('0x4a')]({},_0x35790b,_0x3c8a1b['options']);return _0x28873e[_0xf5f2('0x7a')](_0x35790b);}})[_0xf5f2('0x18')](function(_0x2563fa){if(_0x2563fa){_0x1fc5ae=_0x2563fa[_0xf5f2('0x43')];if(!_0x3c8a1b['query'][_0xf5f2('0x44')](_0xf5f2('0x45'))){_0x35790b[_0xf5f2('0x13')]=qs['limit'](_0x3c8a1b['query'][_0xf5f2('0x13')]);_0x35790b[_0xf5f2('0x11')]=qs[_0xf5f2('0x11')](_0x3c8a1b[_0xf5f2('0x2e')][_0xf5f2('0x11')]);}return _0x28873e[_0xf5f2('0x7a')](_0x35790b);}})['then'](function(_0x39dee8){if(_0x39dee8){return _0x39dee8?{'count':_0x1fc5ae,'rows':_0x39dee8}:null;}})['then'](respondWithResult(_0x15025d,null))[_0xf5f2('0x3d')](handleError(_0x15025d,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index 70f36ab..52842f5 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 _0x4415=['emit','hasOwnProperty','hook','../../mysqldb','save','update'];(function(_0x21b9b8,_0x3a1809){var _0x5e13b3=function(_0xbb6757){while(--_0xbb6757){_0x21b9b8['push'](_0x21b9b8['shift']());}};_0x5e13b3(++_0x3a1809);}(_0x4415,0x69));var _0x5441=function(_0x4017b0,_0x4347db){_0x4017b0=_0x4017b0-0x0;var _0x5ed4f7=_0x4415[_0x4017b0];return _0x5ed4f7;};'use strict';var EventEmitter=require('events');var SmsQueue=require(_0x5441('0x0'))['db']['SmsQueue'];var SmsQueueEvents=new EventEmitter();SmsQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x5441('0x1'),'afterUpdate':_0x5441('0x2'),'afterDestroy':'remove'};function emitEvent(_0x1d7c1c){return function(_0x2dd9ba,_0x12ead9,_0x4dab75){SmsQueueEvents[_0x5441('0x3')](_0x1d7c1c+':'+_0x2dd9ba['id'],_0x2dd9ba);SmsQueueEvents[_0x5441('0x3')](_0x1d7c1c,_0x2dd9ba);_0x4dab75(null);};}for(var e in events){if(events[_0x5441('0x4')](e)){var event=events[e];SmsQueue[_0x5441('0x5')](e,emitEvent(event));}}module['exports']=SmsQueueEvents; \ No newline at end of file +var _0x8b42=['events','../../mysqldb','setMaxListeners','save','emit','hasOwnProperty','exports'];(function(_0x1090f8,_0xd83a11){var _0x180524=function(_0x109ab8){while(--_0x109ab8){_0x1090f8['push'](_0x1090f8['shift']());}};_0x180524(++_0xd83a11);}(_0x8b42,0x11f));var _0x28b4=function(_0x50e704,_0x1cac35){_0x50e704=_0x50e704-0x0;var _0x21a84a=_0x8b42[_0x50e704];return _0x21a84a;};'use strict';var EventEmitter=require(_0x28b4('0x0'));var SmsQueue=require(_0x28b4('0x1'))['db']['SmsQueue'];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0x28b4('0x2')](0x0);var events={'afterCreate':_0x28b4('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x3e2e9a){return function(_0x425dab,_0x265026,_0x471ab4){SmsQueueEvents[_0x28b4('0x4')](_0x3e2e9a+':'+_0x425dab['id'],_0x425dab);SmsQueueEvents[_0x28b4('0x4')](_0x3e2e9a,_0x425dab);_0x471ab4(null);};}for(var e in events){if(events[_0x28b4('0x5')](e)){var event=events[e];SmsQueue['hook'](e,emitEvent(event));}}module[_0x28b4('0x6')]=SmsQueueEvents; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.model.js b/server/api/smsQueue/smsQueue.model.js index 05fe8c4..2ed68de 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 _0x12e8=['sms_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','./smsQueue.attributes','exports','SmsQueue'];(function(_0x46aff0,_0x122890){var _0x9d78cf=function(_0x3f14cb){while(--_0x3f14cb){_0x46aff0['push'](_0x46aff0['shift']());}};_0x9d78cf(++_0x122890);}(_0x12e8,0x1b1));var _0x812e=function(_0x1c097f,_0xc57bae){_0x1c097f=_0x1c097f-0x0;var _0x2844de=_0x12e8[_0x1c097f];return _0x2844de;};'use strict';var _=require(_0x812e('0x0'));var util=require(_0x812e('0x1'));var logger=require(_0x812e('0x2'))(_0x812e('0x3'));var moment=require(_0x812e('0x4'));var BPromise=require(_0x812e('0x5'));var rp=require(_0x812e('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x812e('0x7'));var config=require('../../config/environment');var attributes=require(_0x812e('0x8'));module[_0x812e('0x9')]=function(_0x4393da,_0x484ccb){return _0x4393da['define'](_0x812e('0xa'),attributes,{'tableName':_0x812e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xac00=['path','rimraf','../../config/environment','./smsQueue.attributes','exports','define','sms_queues','lodash','moment','bluebird','request-promise'];(function(_0x14294a,_0x30486d){var _0x527f17=function(_0x4f2234){while(--_0x4f2234){_0x14294a['push'](_0x14294a['shift']());}};_0x527f17(++_0x30486d);}(_0xac00,0xd8));var _0x0ac0=function(_0x56ab74,_0x1effda){_0x56ab74=_0x56ab74-0x0;var _0x17d8d0=_0xac00[_0x56ab74];return _0x17d8d0;};'use strict';var _=require(_0x0ac0('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x0ac0('0x1'));var BPromise=require(_0x0ac0('0x2'));var rp=require(_0x0ac0('0x3'));var fs=require('fs');var path=require(_0x0ac0('0x4'));var rimraf=require(_0x0ac0('0x5'));var config=require(_0x0ac0('0x6'));var attributes=require(_0x0ac0('0x7'));module[_0x0ac0('0x8')]=function(_0xba8195,_0x481451){return _0xba8195[_0x0ac0('0x9')]('SmsQueue',attributes,{'tableName':_0x0ac0('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.rpc.js b/server/api/smsQueue/smsQueue.rpc.js index 1ec41a5..a0c749c 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 _0xcf5e=['limit','map','model','include','ShowSmsQueue','find','then','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','defaults','redis','localhost','./smsQueue.socket','request','info','request\x20sent','debug','stringify','error','SmsQueue,\x20%s,\x20%s','message','catch','GetSmsQueue','SmsQueue','findAll','options','raw','where','attributes'];(function(_0x1fc122,_0x5e2c17){var _0xa2cb13=function(_0x263b13){while(--_0x263b13){_0x1fc122['push'](_0x1fc122['shift']());}};_0xa2cb13(++_0x5e2c17);}(_0xcf5e,0x13f));var _0xecf5=function(_0x4fae5e,_0x11215c){_0x4fae5e=_0x4fae5e-0x0;var _0x1b0302=_0xcf5e[_0x4fae5e];return _0x1b0302;};'use strict';var _=require('lodash');var util=require(_0xecf5('0x0'));var moment=require(_0xecf5('0x1'));var BPromise=require(_0xecf5('0x2'));var rs=require(_0xecf5('0x3'));var fs=require('fs');var Redis=require(_0xecf5('0x4'));var db=require(_0xecf5('0x5'))['db'];var utils=require(_0xecf5('0x6'));var logger=require(_0xecf5('0x7'))(_0xecf5('0x8'));var config=require(_0xecf5('0x9'));var jayson=require(_0xecf5('0xa'));var client=jayson['client'][_0xecf5('0xb')]({'port':0x232a});config['redis']=_[_0xecf5('0xc')](config[_0xecf5('0xd')],{'host':_0xecf5('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xecf5('0xd')]));require(_0xecf5('0xf'))['register'](socket);function respondWithRpcPromise(_0x5aa094,_0x464dab,_0xa6a5b9){return new BPromise(function(_0x1560a8,_0x483044){return client[_0xecf5('0x10')](_0x5aa094,_0xa6a5b9)['then'](function(_0x13a853){logger[_0xecf5('0x11')]('SmsQueue,\x20%s,\x20%s',_0x464dab,_0xecf5('0x12'));logger[_0xecf5('0x13')]('SmsQueue,\x20%s,\x20%s,\x20%s',_0x464dab,_0xecf5('0x12'),JSON[_0xecf5('0x14')](_0x13a853));if(_0x13a853[_0xecf5('0x15')]){if(_0x13a853[_0xecf5('0x15')]['code']===0x1f4){logger['error'](_0xecf5('0x16'),_0x464dab,_0x13a853[_0xecf5('0x15')]['message']);return _0x483044(_0x13a853[_0xecf5('0x15')][_0xecf5('0x17')]);}logger['error']('SmsQueue,\x20%s,\x20%s',_0x464dab,_0x13a853[_0xecf5('0x15')]['message']);return _0x1560a8(_0x13a853[_0xecf5('0x15')][_0xecf5('0x17')]);}else{logger[_0xecf5('0x11')](_0xecf5('0x16'),_0x464dab,_0xecf5('0x12'));_0x1560a8(_0x13a853['result'][_0xecf5('0x17')]);}})[_0xecf5('0x18')](function(_0x6de3fd){logger['error'](_0xecf5('0x16'),_0x464dab,_0x6de3fd);_0x483044(_0x6de3fd);});});}exports[_0xecf5('0x19')]=function(_0xea4e56){var _0x1897bf=this;return new Promise(function(_0x21fd51,_0x32d315){return db[_0xecf5('0x1a')][_0xecf5('0x1b')]({'raw':_0xea4e56[_0xecf5('0x1c')]?_0xea4e56[_0xecf5('0x1c')][_0xecf5('0x1d')]===undefined?!![]:![]:!![],'where':_0xea4e56[_0xecf5('0x1c')]?_0xea4e56[_0xecf5('0x1c')][_0xecf5('0x1e')]||null:null,'attributes':_0xea4e56[_0xecf5('0x1c')]?_0xea4e56[_0xecf5('0x1c')][_0xecf5('0x1f')]||null:null,'limit':_0xea4e56['options']?_0xea4e56[_0xecf5('0x1c')][_0xecf5('0x20')]||null:null,'include':_0xea4e56[_0xecf5('0x1c')]?_0xea4e56[_0xecf5('0x1c')]['include']?_[_0xecf5('0x21')](_0xea4e56[_0xecf5('0x1c')]['include'],function(_0x3300b0){return{'model':db[_0x3300b0[_0xecf5('0x22')]],'as':_0x3300b0['as'],'attributes':_0x3300b0[_0xecf5('0x1f')],'include':_0x3300b0[_0xecf5('0x23')]?_[_0xecf5('0x21')](_0x3300b0[_0xecf5('0x23')],function(_0x198c8a){return{'model':db[_0x198c8a[_0xecf5('0x22')]],'as':_0x198c8a['as'],'attributes':_0x198c8a[_0xecf5('0x1f')],'include':_0x198c8a[_0xecf5('0x23')]?_[_0xecf5('0x21')](_0x198c8a['include'],function(_0x2776cc){return{'model':db[_0x2776cc[_0xecf5('0x22')]],'as':_0x2776cc['as'],'attributes':_0x2776cc[_0xecf5('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5a3e74){logger[_0xecf5('0x11')](_0xecf5('0x19'),_0xea4e56);logger[_0xecf5('0x13')](_0xecf5('0x19'),_0xea4e56,JSON[_0xecf5('0x14')](_0x5a3e74));_0x21fd51(_0x5a3e74);})['catch'](function(_0x4d0639){logger['error'](_0xecf5('0x19'),_0x4d0639[_0xecf5('0x17')],_0xea4e56);_0x32d315(_0x1897bf[_0xecf5('0x15')](0x1f4,_0x4d0639['message']));});});};exports[_0xecf5('0x24')]=function(_0x4ffc1c){var _0x31e631=this;return new Promise(function(_0x4f17e0,_0x5077c3){return db['SmsQueue'][_0xecf5('0x25')]({'raw':_0x4ffc1c[_0xecf5('0x1c')]?_0x4ffc1c['options'][_0xecf5('0x1d')]===undefined?!![]:![]:!![],'where':_0x4ffc1c[_0xecf5('0x1c')]?_0x4ffc1c[_0xecf5('0x1c')]['where']||null:null,'attributes':_0x4ffc1c[_0xecf5('0x1c')]?_0x4ffc1c['options'][_0xecf5('0x1f')]||null:null,'include':_0x4ffc1c[_0xecf5('0x1c')]?_0x4ffc1c[_0xecf5('0x1c')]['include']?_[_0xecf5('0x21')](_0x4ffc1c[_0xecf5('0x1c')]['include'],function(_0x56a6bc){return{'model':db[_0x56a6bc[_0xecf5('0x22')]],'as':_0x56a6bc['as'],'attributes':_0x56a6bc[_0xecf5('0x1f')],'include':_0x56a6bc[_0xecf5('0x23')]?_[_0xecf5('0x21')](_0x56a6bc[_0xecf5('0x23')],function(_0x550378){return{'model':db[_0x550378['model']],'as':_0x550378['as'],'attributes':_0x550378[_0xecf5('0x1f')],'include':_0x550378[_0xecf5('0x23')]?_[_0xecf5('0x21')](_0x550378[_0xecf5('0x23')],function(_0x760f63){return{'model':db[_0x760f63[_0xecf5('0x22')]],'as':_0x760f63['as'],'attributes':_0x760f63[_0xecf5('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xecf5('0x26')](function(_0x159d6a){logger[_0xecf5('0x11')]('ShowSmsQueue',_0x4ffc1c);logger['debug']('ShowSmsQueue',_0x4ffc1c,JSON[_0xecf5('0x14')](_0x159d6a));_0x4f17e0(_0x159d6a);})[_0xecf5('0x18')](function(_0xc41030){logger[_0xecf5('0x15')](_0xecf5('0x24'),_0xc41030[_0xecf5('0x17')],_0x4ffc1c);_0x5077c3(_0x31e631[_0xecf5('0x15')](0x1f4,_0xc41030[_0xecf5('0x17')]));});});}; \ No newline at end of file +var _0x5e37=['stringify','error','code','message','result','catch','findAll','options','raw','where','limit','include','model','attributes','map','GetSmsQueue','SmsQueue','find','ShowSmsQueue','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./smsQueue.socket','register','request','then','info','SmsQueue,\x20%s,\x20%s','request\x20sent','debug','SmsQueue,\x20%s,\x20%s,\x20%s'];(function(_0x1383dd,_0x51e52d){var _0x3902bf=function(_0x19542f){while(--_0x19542f){_0x1383dd['push'](_0x1383dd['shift']());}};_0x3902bf(++_0x51e52d);}(_0x5e37,0x139));var _0x75e3=function(_0x525d78,_0x14175d){_0x525d78=_0x525d78-0x0;var _0x4c203d=_0x5e37[_0x525d78];return _0x4c203d;};'use strict';var _=require(_0x75e3('0x0'));var util=require(_0x75e3('0x1'));var moment=require(_0x75e3('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x75e3('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x75e3('0x4'));var logger=require(_0x75e3('0x5'))(_0x75e3('0x6'));var config=require(_0x75e3('0x7'));var jayson=require(_0x75e3('0x8'));var client=jayson['client'][_0x75e3('0x9')]({'port':0x232a});config[_0x75e3('0xa')]=_[_0x75e3('0xb')](config[_0x75e3('0xa')],{'host':_0x75e3('0xc'),'port':0x18eb});var socket=require(_0x75e3('0xd'))(new Redis(config['redis']));require(_0x75e3('0xe'))[_0x75e3('0xf')](socket);function respondWithRpcPromise(_0x5adb61,_0x20c672,_0x3a0269){return new BPromise(function(_0x41e613,_0x2b6bba){return client[_0x75e3('0x10')](_0x5adb61,_0x3a0269)[_0x75e3('0x11')](function(_0xf65f2b){logger[_0x75e3('0x12')](_0x75e3('0x13'),_0x20c672,_0x75e3('0x14'));logger[_0x75e3('0x15')](_0x75e3('0x16'),_0x20c672,_0x75e3('0x14'),JSON[_0x75e3('0x17')](_0xf65f2b));if(_0xf65f2b['error']){if(_0xf65f2b[_0x75e3('0x18')][_0x75e3('0x19')]===0x1f4){logger[_0x75e3('0x18')](_0x75e3('0x13'),_0x20c672,_0xf65f2b[_0x75e3('0x18')][_0x75e3('0x1a')]);return _0x2b6bba(_0xf65f2b[_0x75e3('0x18')]['message']);}logger['error'](_0x75e3('0x13'),_0x20c672,_0xf65f2b['error'][_0x75e3('0x1a')]);return _0x41e613(_0xf65f2b[_0x75e3('0x18')][_0x75e3('0x1a')]);}else{logger[_0x75e3('0x12')](_0x75e3('0x13'),_0x20c672,_0x75e3('0x14'));_0x41e613(_0xf65f2b[_0x75e3('0x1b')][_0x75e3('0x1a')]);}})[_0x75e3('0x1c')](function(_0xc0b9e6){logger[_0x75e3('0x18')]('SmsQueue,\x20%s,\x20%s',_0x20c672,_0xc0b9e6);_0x2b6bba(_0xc0b9e6);});});}exports['GetSmsQueue']=function(_0x1b96f5){var _0x3118ea=this;return new Promise(function(_0x3c7762,_0x4d381d){return db['SmsQueue'][_0x75e3('0x1d')]({'raw':_0x1b96f5[_0x75e3('0x1e')]?_0x1b96f5[_0x75e3('0x1e')][_0x75e3('0x1f')]===undefined?!![]:![]:!![],'where':_0x1b96f5['options']?_0x1b96f5['options'][_0x75e3('0x20')]||null:null,'attributes':_0x1b96f5[_0x75e3('0x1e')]?_0x1b96f5['options']['attributes']||null:null,'limit':_0x1b96f5[_0x75e3('0x1e')]?_0x1b96f5[_0x75e3('0x1e')][_0x75e3('0x21')]||null:null,'include':_0x1b96f5[_0x75e3('0x1e')]?_0x1b96f5[_0x75e3('0x1e')][_0x75e3('0x22')]?_['map'](_0x1b96f5['options'][_0x75e3('0x22')],function(_0x1cce29){return{'model':db[_0x1cce29[_0x75e3('0x23')]],'as':_0x1cce29['as'],'attributes':_0x1cce29[_0x75e3('0x24')],'include':_0x1cce29['include']?_[_0x75e3('0x25')](_0x1cce29[_0x75e3('0x22')],function(_0x1d3816){return{'model':db[_0x1d3816['model']],'as':_0x1d3816['as'],'attributes':_0x1d3816[_0x75e3('0x24')],'include':_0x1d3816[_0x75e3('0x22')]?_['map'](_0x1d3816[_0x75e3('0x22')],function(_0x2ac4c3){return{'model':db[_0x2ac4c3['model']],'as':_0x2ac4c3['as'],'attributes':_0x2ac4c3[_0x75e3('0x24')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3b1f85){logger[_0x75e3('0x12')]('GetSmsQueue',_0x1b96f5);logger[_0x75e3('0x15')](_0x75e3('0x26'),_0x1b96f5,JSON[_0x75e3('0x17')](_0x3b1f85));_0x3c7762(_0x3b1f85);})['catch'](function(_0x2ef426){logger[_0x75e3('0x18')](_0x75e3('0x26'),_0x2ef426[_0x75e3('0x1a')],_0x1b96f5);_0x4d381d(_0x3118ea[_0x75e3('0x18')](0x1f4,_0x2ef426['message']));});});};exports['ShowSmsQueue']=function(_0x2b7c10){var _0x29d766=this;return new Promise(function(_0x176bef,_0x567c67){return db[_0x75e3('0x27')][_0x75e3('0x28')]({'raw':_0x2b7c10['options']?_0x2b7c10['options'][_0x75e3('0x1f')]===undefined?!![]:![]:!![],'where':_0x2b7c10[_0x75e3('0x1e')]?_0x2b7c10[_0x75e3('0x1e')][_0x75e3('0x20')]||null:null,'attributes':_0x2b7c10[_0x75e3('0x1e')]?_0x2b7c10['options']['attributes']||null:null,'include':_0x2b7c10[_0x75e3('0x1e')]?_0x2b7c10[_0x75e3('0x1e')][_0x75e3('0x22')]?_[_0x75e3('0x25')](_0x2b7c10[_0x75e3('0x1e')][_0x75e3('0x22')],function(_0xc85ece){return{'model':db[_0xc85ece['model']],'as':_0xc85ece['as'],'attributes':_0xc85ece[_0x75e3('0x24')],'include':_0xc85ece[_0x75e3('0x22')]?_[_0x75e3('0x25')](_0xc85ece[_0x75e3('0x22')],function(_0x42cc8c){return{'model':db[_0x42cc8c['model']],'as':_0x42cc8c['as'],'attributes':_0x42cc8c[_0x75e3('0x24')],'include':_0x42cc8c['include']?_[_0x75e3('0x25')](_0x42cc8c['include'],function(_0x8b19f7){return{'model':db[_0x8b19f7['model']],'as':_0x8b19f7['as'],'attributes':_0x8b19f7['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x224980){logger[_0x75e3('0x12')](_0x75e3('0x29'),_0x2b7c10);logger['debug'](_0x75e3('0x29'),_0x2b7c10,JSON[_0x75e3('0x17')](_0x224980));_0x176bef(_0x224980);})[_0x75e3('0x1c')](function(_0x2f3017){logger['error'](_0x75e3('0x29'),_0x2f3017[_0x75e3('0x1a')],_0x2b7c10);_0x567c67(_0x29d766[_0x75e3('0x18')](0x1f4,_0x2f3017[_0x75e3('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index f58e95c..a7a723d 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 _0x8cea=['save','remove','update','emit','removeListener','register','length','smsQueue:','./smsQueue.events'];(function(_0x6d9edf,_0x33270f){var _0x380379=function(_0x122e5c){while(--_0x122e5c){_0x6d9edf['push'](_0x6d9edf['shift']());}};_0x380379(++_0x33270f);}(_0x8cea,0x104));var _0xa8ce=function(_0x2e6dbf,_0x57dd06){_0x2e6dbf=_0x2e6dbf-0x0;var _0x2680e5=_0x8cea[_0x2e6dbf];return _0x2680e5;};'use strict';var SmsQueueEvents=require(_0xa8ce('0x0'));var events=[_0xa8ce('0x1'),_0xa8ce('0x2'),_0xa8ce('0x3')];function createListener(_0x472580,_0x52ffce){return function(_0x1c88bf){_0x52ffce[_0xa8ce('0x4')](_0x472580,_0x1c88bf);};}function removeListener(_0x495f54,_0x56c6ff){return function(){SmsQueueEvents[_0xa8ce('0x5')](_0x495f54,_0x56c6ff);};}exports[_0xa8ce('0x6')]=function(_0x58dbf8){for(var _0x5b17c7=0x0,_0xd375e7=events[_0xa8ce('0x7')];_0x5b17c7<_0xd375e7;_0x5b17c7++){var _0x3ab5f9=events[_0x5b17c7];var _0x43e6a0=createListener(_0xa8ce('0x8')+_0x3ab5f9,_0x58dbf8);SmsQueueEvents['on'](_0x3ab5f9,_0x43e6a0);}}; \ No newline at end of file +var _0x6ac0=['emit','removeListener','register','length','smsQueue:','save','remove'];(function(_0x159722,_0x2ffac5){var _0x72d030=function(_0x4c88c6){while(--_0x4c88c6){_0x159722['push'](_0x159722['shift']());}};_0x72d030(++_0x2ffac5);}(_0x6ac0,0xbb));var _0x06ac=function(_0x367a2d,_0x17d047){_0x367a2d=_0x367a2d-0x0;var _0x59c356=_0x6ac0[_0x367a2d];return _0x59c356;};'use strict';var SmsQueueEvents=require('./smsQueue.events');var events=[_0x06ac('0x0'),_0x06ac('0x1'),'update'];function createListener(_0x8ee130,_0x3f3c6f){return function(_0x15f3fc){_0x3f3c6f[_0x06ac('0x2')](_0x8ee130,_0x15f3fc);};}function removeListener(_0x5c8e99,_0x574802){return function(){SmsQueueEvents[_0x06ac('0x3')](_0x5c8e99,_0x574802);};}exports[_0x06ac('0x4')]=function(_0x15b9bc){for(var _0x4c55e6=0x0,_0xb62f6a=events[_0x06ac('0x5')];_0x4c55e6<_0xb62f6a;_0x4c55e6++){var _0x32a618=events[_0x4c55e6];var _0x3cd4ee=createListener(_0x06ac('0x6')+_0x32a618,_0x15b9bc);SmsQueueEvents['on'](_0x32a618,_0x3cd4ee);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index fd39205..25eb23c 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 _0x8d0a=['exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueueReport.controller','isAuthenticated','index','get','/describe','/:id','create','update','delete','destroy'];(function(_0x5c9025,_0x32b52f){var _0x53ec3b=function(_0x558612){while(--_0x558612){_0x5c9025['push'](_0x5c9025['shift']());}};_0x53ec3b(++_0x32b52f);}(_0x8d0a,0x65));var _0xa8d0=function(_0x25e91e,_0x525f91){_0x25e91e=_0x25e91e-0x0;var _0x4c3018=_0x8d0a[_0x25e91e];return _0x4c3018;};'use strict';var multer=require(_0xa8d0('0x0'));var util=require('util');var path=require(_0xa8d0('0x1'));var timeout=require(_0xa8d0('0x2'));var express=require(_0xa8d0('0x3'));var router=express[_0xa8d0('0x4')]();var fs_extra=require(_0xa8d0('0x5'));var auth=require(_0xa8d0('0x6'));var interaction=require(_0xa8d0('0x7'));var config=require(_0xa8d0('0x8'));var controller=require(_0xa8d0('0x9'));router['get']('/',auth[_0xa8d0('0xa')](),controller[_0xa8d0('0xb')]);router[_0xa8d0('0xc')](_0xa8d0('0xd'),auth[_0xa8d0('0xa')](),controller['describe']);router['get'](_0xa8d0('0xe'),auth[_0xa8d0('0xa')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0xa8d0('0xf')]);router['put'](_0xa8d0('0xe'),auth[_0xa8d0('0xa')](),controller[_0xa8d0('0x10')]);router[_0xa8d0('0x11')](_0xa8d0('0xe'),auth[_0xa8d0('0xa')](),controller[_0xa8d0('0x12')]);module[_0xa8d0('0x13')]=router; \ No newline at end of file +var _0xac4f=['delete','destroy','multer','path','express','../../components/auth/service','../../components/interaction/service','./smsQueueReport.controller','get','isAuthenticated','/describe','describe','/:id','show','post','create','put','update'];(function(_0x20589d,_0x55d5bf){var _0x422de9=function(_0x44cbbb){while(--_0x44cbbb){_0x20589d['push'](_0x20589d['shift']());}};_0x422de9(++_0x55d5bf);}(_0xac4f,0x122));var _0xfac4=function(_0x13f5a2,_0x435893){_0x13f5a2=_0x13f5a2-0x0;var _0x1c2719=_0xac4f[_0x13f5a2];return _0x1c2719;};'use strict';var multer=require(_0xfac4('0x0'));var util=require('util');var path=require(_0xfac4('0x1'));var timeout=require('connect-timeout');var express=require(_0xfac4('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xfac4('0x3'));var interaction=require(_0xfac4('0x4'));var config=require('../../config/environment');var controller=require(_0xfac4('0x5'));router[_0xfac4('0x6')]('/',auth[_0xfac4('0x7')](),controller['index']);router[_0xfac4('0x6')](_0xfac4('0x8'),auth[_0xfac4('0x7')](),controller[_0xfac4('0x9')]);router[_0xfac4('0x6')](_0xfac4('0xa'),auth['isAuthenticated'](),controller[_0xfac4('0xb')]);router[_0xfac4('0xc')]('/',auth[_0xfac4('0x7')](),controller[_0xfac4('0xd')]);router[_0xfac4('0xe')](_0xfac4('0xa'),auth[_0xfac4('0x7')](),controller[_0xfac4('0xf')]);router[_0xfac4('0x10')](_0xfac4('0xa'),auth[_0xfac4('0x7')](),controller[_0xfac4('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.attributes.js b/server/api/smsQueueReport/smsQueueReport.attributes.js index a026b7f..b93a6d3 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 _0xf77f=['moment','exports','STRING','DATE'];(function(_0x3a317e,_0xded344){var _0x80baf2=function(_0x4f9a1d){while(--_0x4f9a1d){_0x3a317e['push'](_0x3a317e['shift']());}};_0x80baf2(++_0xded344);}(_0xf77f,0x134));var _0xff77=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0xf77f[_0x376b45];return _0x2341b3;};'use strict';var moment=require(_0xff77('0x0'));var Sequelize=require('sequelize');module[_0xff77('0x1')]={'uniqueid':{'type':Sequelize[_0xff77('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xff77('0x2')]},'joinAt':{'type':Sequelize[_0xff77('0x3')]},'leaveAt':{'type':Sequelize[_0xff77('0x3')]},'acceptAt':{'type':Sequelize[_0xff77('0x3')]},'exitAt':{'type':Sequelize[_0xff77('0x3')]},'reason':{'type':Sequelize[_0xff77('0x2')]}}; \ No newline at end of file +var _0xdc0d=['sequelize','STRING','DATE','moment'];(function(_0x107c1e,_0xb15ce){var _0x20a663=function(_0x41484b){while(--_0x41484b){_0x107c1e['push'](_0x107c1e['shift']());}};_0x20a663(++_0xb15ce);}(_0xdc0d,0x1db));var _0xddc0=function(_0x3a7e32,_0x4c6ad5){_0x3a7e32=_0x3a7e32-0x0;var _0x52347a=_0xdc0d[_0x3a7e32];return _0x52347a;};'use strict';var moment=require(_0xddc0('0x0'));var Sequelize=require(_0xddc0('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xddc0('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xddc0('0x3')]},'leaveAt':{'type':Sequelize[_0xddc0('0x3')]},'acceptAt':{'type':Sequelize[_0xddc0('0x3')]},'exitAt':{'type':Sequelize[_0xddc0('0x3')]},'reason':{'type':Sequelize[_0xddc0('0x2')]}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index 9584da9..b957ea1 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 _0xa864=['Content-Range','apply','reject','then','error','stack','name','send','index','map','SmsQueueReport','rawAttributes','fieldName','type','key','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','findAll','rows','catch','show','params','keys','find','create','body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set'];(function(_0x5dcfbc,_0x39c822){var _0xadc7e=function(_0x354a18){while(--_0x354a18){_0x5dcfbc['push'](_0x5dcfbc['shift']());}};_0xadc7e(++_0x39c822);}(_0xa864,0x1a7));var _0x4a86=function(_0x49ad79,_0x48ee93){_0x49ad79=_0x49ad79-0x0;var _0xa4e38a=_0xa864[_0x49ad79];return _0xa4e38a;};'use strict';var emlformat=require(_0x4a86('0x0'));var rimraf=require(_0x4a86('0x1'));var zipdir=require(_0x4a86('0x2'));var jsonpatch=require(_0x4a86('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x4a86('0x4'));var Mustache=require(_0x4a86('0x5'));var util=require(_0x4a86('0x6'));var path=require(_0x4a86('0x7'));var sox=require('sox');var csv=require(_0x4a86('0x8'));var ejs=require(_0x4a86('0x9'));var fs=require('fs');var fs_extra=require(_0x4a86('0xa'));var _=require(_0x4a86('0xb'));var squel=require(_0x4a86('0xc'));var crypto=require(_0x4a86('0xd'));var jsforce=require(_0x4a86('0xe'));var deskjs=require(_0x4a86('0xf'));var toCsv=require(_0x4a86('0x8'));var querystring=require(_0x4a86('0x10'));var Papa=require('papaparse');var Redis=require(_0x4a86('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x4a86('0x12'));var as=require(_0x4a86('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4a86('0x14'))('api');var utils=require(_0x4a86('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x4a86('0x16'));var db=require(_0x4a86('0x17'))['db'];function respondWithStatusCode(_0x47f190,_0x57f5db){_0x57f5db=_0x57f5db||0xcc;return function(_0xe73276){if(_0xe73276){return _0x47f190[_0x4a86('0x18')](_0x57f5db);}return _0x47f190[_0x4a86('0x19')](_0x57f5db)[_0x4a86('0x1a')]();};}function respondWithResult(_0xd16f22,_0x5da97a){_0x5da97a=_0x5da97a||0xc8;return function(_0x275034){if(_0x275034){return _0xd16f22['status'](_0x5da97a)[_0x4a86('0x1b')](_0x275034);}};}function respondWithFilteredResult(_0x2315dd,_0x414abd){return function(_0x2f5840){if(_0x2f5840){var _0x484978=typeof _0x414abd[_0x4a86('0x1c')]===_0x4a86('0x1d')&&typeof _0x414abd['limit']===_0x4a86('0x1d');var _0x1d9de8=_0x2f5840[_0x4a86('0x1e')];var _0x209c73=_0x484978?0x0:_0x414abd[_0x4a86('0x1c')];var _0x80cf00=_0x484978?_0x2f5840[_0x4a86('0x1e')]:_0x414abd[_0x4a86('0x1c')]+_0x414abd[_0x4a86('0x1f')];var _0x35171e;if(_0x80cf00>=_0x1d9de8){_0x80cf00=_0x1d9de8;_0x35171e=0xc8;}else{_0x35171e=0xce;}_0x2315dd['status'](_0x35171e);return _0x2315dd[_0x4a86('0x20')](_0x4a86('0x21'),_0x209c73+'-'+_0x80cf00+'/'+_0x1d9de8)[_0x4a86('0x1b')](_0x2f5840);}return null;};}function patchUpdates(_0x4ab2a0){return function(_0xec2cc1){try{jsonpatch[_0x4a86('0x22')](_0xec2cc1,_0x4ab2a0,!![]);}catch(_0xed3e2f){return BPromise[_0x4a86('0x23')](_0xed3e2f);}return _0xec2cc1['save']();};}function saveUpdates(_0x5c9c70,_0x2e2c66){return function(_0x4d9182){if(_0x4d9182){return _0x4d9182['update'](_0x5c9c70)[_0x4a86('0x24')](function(_0x711331){return _0x711331;});}return null;};}function removeEntity(_0x2be463,_0x3638ca){return function(_0xc508ef){if(_0xc508ef){return _0xc508ef['destroy']()['then'](function(){_0x2be463['status'](0xcc)[_0x4a86('0x1a')]();});}};}function handleEntityNotFound(_0x523218,_0xe2d81d){return function(_0x1e7680){if(!_0x1e7680){_0x523218['sendStatus'](0x194);}return _0x1e7680;};}function handleError(_0x54fbff,_0x181a96){_0x181a96=_0x181a96||0x1f4;return function(_0x4968a9){logger[_0x4a86('0x25')](_0x4968a9[_0x4a86('0x26')]);if(_0x4968a9[_0x4a86('0x27')]){delete _0x4968a9[_0x4a86('0x27')];}_0x54fbff[_0x4a86('0x19')](_0x181a96)[_0x4a86('0x28')](_0x4968a9);};}exports[_0x4a86('0x29')]=function(_0x328059,_0x50bdb5){var _0x32fb82={},_0x23e465={},_0x466a6e={'count':0x0,'rows':[]};var _0x11fdb6=_[_0x4a86('0x2a')](db[_0x4a86('0x2b')][_0x4a86('0x2c')],function(_0x7c2fa0){return{'name':_0x7c2fa0[_0x4a86('0x2d')],'type':_0x7c2fa0[_0x4a86('0x2e')][_0x4a86('0x2f')]};});_0x23e465['model']=_[_0x4a86('0x2a')](_0x11fdb6,'name');_0x23e465['query']=_['keys'](_0x328059[_0x4a86('0x30')]);_0x23e465[_0x4a86('0x31')]=_[_0x4a86('0x32')](_0x23e465[_0x4a86('0x33')],_0x23e465['query']);_0x32fb82['attributes']=_[_0x4a86('0x32')](_0x23e465[_0x4a86('0x33')],qs[_0x4a86('0x34')](_0x328059[_0x4a86('0x30')][_0x4a86('0x34')]));_0x32fb82[_0x4a86('0x35')]=_0x32fb82['attributes'][_0x4a86('0x36')]?_0x32fb82[_0x4a86('0x35')]:_0x23e465[_0x4a86('0x33')];if(!_0x328059['query'][_0x4a86('0x37')](_0x4a86('0x38'))){_0x32fb82[_0x4a86('0x1f')]=qs[_0x4a86('0x1f')](_0x328059['query'][_0x4a86('0x1f')]);_0x32fb82[_0x4a86('0x1c')]=qs[_0x4a86('0x1c')](_0x328059[_0x4a86('0x30')]['offset']);}_0x32fb82[_0x4a86('0x39')]=qs['sort'](_0x328059[_0x4a86('0x30')][_0x4a86('0x3a')]);_0x32fb82[_0x4a86('0x3b')]=qs[_0x4a86('0x31')](_[_0x4a86('0x3c')](_0x328059['query'],_0x23e465[_0x4a86('0x31')]),_0x11fdb6);if(_0x328059[_0x4a86('0x30')][_0x4a86('0x3d')]){_0x32fb82[_0x4a86('0x3b')]=_[_0x4a86('0x3e')](_0x32fb82[_0x4a86('0x3b')],{'$or':_['map'](_0x11fdb6,function(_0x19acd8){if(_0x19acd8['type']!=='VIRTUAL'){var _0x4e617d={};_0x4e617d[_0x19acd8[_0x4a86('0x27')]]={'$like':'%'+_0x328059[_0x4a86('0x30')][_0x4a86('0x3d')]+'%'};return _0x4e617d;}})});}_0x32fb82=_[_0x4a86('0x3e')]({},_0x32fb82,_0x328059[_0x4a86('0x3f')]);var _0x4a1ccb={'where':_0x32fb82[_0x4a86('0x3b')]};return db[_0x4a86('0x2b')][_0x4a86('0x1e')](_0x4a1ccb)[_0x4a86('0x24')](function(_0x5ec51a){_0x466a6e[_0x4a86('0x1e')]=_0x5ec51a;if(_0x328059[_0x4a86('0x30')][_0x4a86('0x40')]){_0x32fb82['include']=[{'all':!![]}];}return db[_0x4a86('0x2b')][_0x4a86('0x41')](_0x32fb82);})[_0x4a86('0x24')](function(_0x5a555e){_0x466a6e[_0x4a86('0x42')]=_0x5a555e;return _0x466a6e;})['then'](respondWithFilteredResult(_0x50bdb5,_0x32fb82))[_0x4a86('0x43')](handleError(_0x50bdb5,null));};exports[_0x4a86('0x44')]=function(_0x585078,_0x51e608){var _0x525324={'raw':!![],'where':{'id':_0x585078[_0x4a86('0x45')]['id']}},_0x120c89={};_0x120c89[_0x4a86('0x33')]=_[_0x4a86('0x46')](db[_0x4a86('0x2b')][_0x4a86('0x2c')]);_0x120c89['query']=_['keys'](_0x585078[_0x4a86('0x30')]);_0x120c89[_0x4a86('0x31')]=_[_0x4a86('0x32')](_0x120c89[_0x4a86('0x33')],_0x120c89[_0x4a86('0x30')]);_0x525324[_0x4a86('0x35')]=_[_0x4a86('0x32')](_0x120c89[_0x4a86('0x33')],qs[_0x4a86('0x34')](_0x585078['query'][_0x4a86('0x34')]));_0x525324[_0x4a86('0x35')]=_0x525324[_0x4a86('0x35')][_0x4a86('0x36')]?_0x525324[_0x4a86('0x35')]:_0x120c89[_0x4a86('0x33')];if(_0x585078[_0x4a86('0x30')][_0x4a86('0x40')]){_0x525324['include']=[{'all':!![]}];}_0x525324=_[_0x4a86('0x3e')]({},_0x525324,_0x585078[_0x4a86('0x3f')]);return db['SmsQueueReport'][_0x4a86('0x47')](_0x525324)[_0x4a86('0x24')](handleEntityNotFound(_0x51e608,null))[_0x4a86('0x24')](respondWithResult(_0x51e608,null))[_0x4a86('0x43')](handleError(_0x51e608,null));};exports[_0x4a86('0x48')]=function(_0x75799b,_0x425fd3){return db[_0x4a86('0x2b')]['create'](_0x75799b[_0x4a86('0x49')],{})[_0x4a86('0x24')](respondWithResult(_0x425fd3,0xc9))[_0x4a86('0x43')](handleError(_0x425fd3,null));};exports['update']=function(_0x3b2e89,_0x1f6a7c){if(_0x3b2e89[_0x4a86('0x49')]['id']){delete _0x3b2e89[_0x4a86('0x49')]['id'];}return db[_0x4a86('0x2b')]['find']({'where':{'id':_0x3b2e89[_0x4a86('0x45')]['id']}})[_0x4a86('0x24')](handleEntityNotFound(_0x1f6a7c,null))[_0x4a86('0x24')](saveUpdates(_0x3b2e89[_0x4a86('0x49')],null))[_0x4a86('0x24')](respondWithResult(_0x1f6a7c,null))[_0x4a86('0x43')](handleError(_0x1f6a7c,null));};exports[_0x4a86('0x4a')]=function(_0x2f1d2a,_0xa8895a){return db['SmsQueueReport']['find']({'where':{'id':_0x2f1d2a[_0x4a86('0x45')]['id']}})[_0x4a86('0x24')](handleEntityNotFound(_0xa8895a,null))[_0x4a86('0x24')](removeEntity(_0xa8895a,null))[_0x4a86('0x43')](handleError(_0xa8895a,null));};exports[_0x4a86('0x4b')]=function(_0x49d543,_0x1f95c2){return db[_0x4a86('0x2b')][_0x4a86('0x4b')]()['then'](respondWithResult(_0x1f95c2,null))[_0x4a86('0x43')](handleError(_0x1f95c2,null));}; \ No newline at end of file +var _0xf836=['pick','filter','VIRTUAL','merge','options','then','include','findAll','rows','catch','params','keys','fields','includeAll','create','body','find','describe','eml-format','rimraf','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','reject','save','destroy','error','stack','name','send','index','map','SmsQueueReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','length','attributes','nolimit','order','sort','where'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf836,0xf0));var _0x6f83=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xf836[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0x6f83('0x0'));var rimraf=require(_0x6f83('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x6f83('0x2'));var BPromise=require(_0x6f83('0x3'));var Mustache=require(_0x6f83('0x4'));var util=require(_0x6f83('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x6f83('0x6'));var ejs=require(_0x6f83('0x7'));var fs=require('fs');var fs_extra=require(_0x6f83('0x8'));var _=require(_0x6f83('0x9'));var squel=require(_0x6f83('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x6f83('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x6f83('0xc'));var Redis=require(_0x6f83('0xd'));var authService=require(_0x6f83('0xe'));var qs=require(_0x6f83('0xf'));var as=require(_0x6f83('0x10'));var hardwareService=require(_0x6f83('0x11'));var logger=require(_0x6f83('0x12'))(_0x6f83('0x13'));var utils=require(_0x6f83('0x14'));var config=require(_0x6f83('0x15'));var licenseUtil=require(_0x6f83('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x47362a,_0x2a77db){_0x2a77db=_0x2a77db||0xcc;return function(_0x4452e2){if(_0x4452e2){return _0x47362a[_0x6f83('0x17')](_0x2a77db);}return _0x47362a[_0x6f83('0x18')](_0x2a77db)[_0x6f83('0x19')]();};}function respondWithResult(_0x2103af,_0xc63775){_0xc63775=_0xc63775||0xc8;return function(_0x7a598f){if(_0x7a598f){return _0x2103af['status'](_0xc63775)[_0x6f83('0x1a')](_0x7a598f);}};}function respondWithFilteredResult(_0x5e35aa,_0xfc511a){return function(_0x1b0644){if(_0x1b0644){var _0x1e2191=typeof _0xfc511a[_0x6f83('0x1b')]==='undefined'&&typeof _0xfc511a[_0x6f83('0x1c')]===_0x6f83('0x1d');var _0x149a13=_0x1b0644[_0x6f83('0x1e')];var _0x446342=_0x1e2191?0x0:_0xfc511a[_0x6f83('0x1b')];var _0x12fb0c=_0x1e2191?_0x1b0644[_0x6f83('0x1e')]:_0xfc511a['offset']+_0xfc511a[_0x6f83('0x1c')];var _0x1978cd;if(_0x12fb0c>=_0x149a13){_0x12fb0c=_0x149a13;_0x1978cd=0xc8;}else{_0x1978cd=0xce;}_0x5e35aa[_0x6f83('0x18')](_0x1978cd);return _0x5e35aa['set'](_0x6f83('0x1f'),_0x446342+'-'+_0x12fb0c+'/'+_0x149a13)[_0x6f83('0x1a')](_0x1b0644);}return null;};}function patchUpdates(_0x578674){return function(_0x5c0b71){try{jsonpatch['apply'](_0x5c0b71,_0x578674,!![]);}catch(_0x2df47d){return BPromise[_0x6f83('0x20')](_0x2df47d);}return _0x5c0b71[_0x6f83('0x21')]();};}function saveUpdates(_0xfedf41,_0x68941e){return function(_0x386971){if(_0x386971){return _0x386971['update'](_0xfedf41)['then'](function(_0x498a42){return _0x498a42;});}return null;};}function removeEntity(_0x23f137,_0x3dd40d){return function(_0x40ef31){if(_0x40ef31){return _0x40ef31[_0x6f83('0x22')]()['then'](function(){_0x23f137[_0x6f83('0x18')](0xcc)[_0x6f83('0x19')]();});}};}function handleEntityNotFound(_0x5c2a0d,_0x3399d3){return function(_0x331a60){if(!_0x331a60){_0x5c2a0d['sendStatus'](0x194);}return _0x331a60;};}function handleError(_0x1a4977,_0x4660de){_0x4660de=_0x4660de||0x1f4;return function(_0x41ef1a){logger[_0x6f83('0x23')](_0x41ef1a[_0x6f83('0x24')]);if(_0x41ef1a[_0x6f83('0x25')]){delete _0x41ef1a[_0x6f83('0x25')];}_0x1a4977[_0x6f83('0x18')](_0x4660de)[_0x6f83('0x26')](_0x41ef1a);};}exports[_0x6f83('0x27')]=function(_0x2ef02d,_0x4a7c9a){var _0xc2fb74={},_0x200ade={},_0x2ba11e={'count':0x0,'rows':[]};var _0x506506=_[_0x6f83('0x28')](db[_0x6f83('0x29')][_0x6f83('0x2a')],function(_0x357529){return{'name':_0x357529[_0x6f83('0x2b')],'type':_0x357529[_0x6f83('0x2c')][_0x6f83('0x2d')]};});_0x200ade[_0x6f83('0x2e')]=_[_0x6f83('0x28')](_0x506506,_0x6f83('0x25'));_0x200ade[_0x6f83('0x2f')]=_['keys'](_0x2ef02d[_0x6f83('0x2f')]);_0x200ade[_0x6f83('0x30')]=_[_0x6f83('0x31')](_0x200ade['model'],_0x200ade['query']);_0xc2fb74['attributes']=_[_0x6f83('0x31')](_0x200ade[_0x6f83('0x2e')],qs['fields'](_0x2ef02d[_0x6f83('0x2f')]['fields']));_0xc2fb74['attributes']=_0xc2fb74['attributes'][_0x6f83('0x32')]?_0xc2fb74[_0x6f83('0x33')]:_0x200ade[_0x6f83('0x2e')];if(!_0x2ef02d[_0x6f83('0x2f')]['hasOwnProperty'](_0x6f83('0x34'))){_0xc2fb74[_0x6f83('0x1c')]=qs[_0x6f83('0x1c')](_0x2ef02d[_0x6f83('0x2f')][_0x6f83('0x1c')]);_0xc2fb74[_0x6f83('0x1b')]=qs[_0x6f83('0x1b')](_0x2ef02d['query'][_0x6f83('0x1b')]);}_0xc2fb74[_0x6f83('0x35')]=qs[_0x6f83('0x36')](_0x2ef02d[_0x6f83('0x2f')]['sort']);_0xc2fb74[_0x6f83('0x37')]=qs[_0x6f83('0x30')](_[_0x6f83('0x38')](_0x2ef02d[_0x6f83('0x2f')],_0x200ade[_0x6f83('0x30')]),_0x506506);if(_0x2ef02d['query'][_0x6f83('0x39')]){_0xc2fb74[_0x6f83('0x37')]=_['merge'](_0xc2fb74[_0x6f83('0x37')],{'$or':_['map'](_0x506506,function(_0x37a80c){if(_0x37a80c['type']!==_0x6f83('0x3a')){var _0x48015c={};_0x48015c[_0x37a80c[_0x6f83('0x25')]]={'$like':'%'+_0x2ef02d[_0x6f83('0x2f')]['filter']+'%'};return _0x48015c;}})});}_0xc2fb74=_[_0x6f83('0x3b')]({},_0xc2fb74,_0x2ef02d[_0x6f83('0x3c')]);var _0x206271={'where':_0xc2fb74[_0x6f83('0x37')]};return db[_0x6f83('0x29')]['count'](_0x206271)[_0x6f83('0x3d')](function(_0x5e57e0){_0x2ba11e['count']=_0x5e57e0;if(_0x2ef02d[_0x6f83('0x2f')]['includeAll']){_0xc2fb74[_0x6f83('0x3e')]=[{'all':!![]}];}return db[_0x6f83('0x29')][_0x6f83('0x3f')](_0xc2fb74);})[_0x6f83('0x3d')](function(_0x192509){_0x2ba11e[_0x6f83('0x40')]=_0x192509;return _0x2ba11e;})[_0x6f83('0x3d')](respondWithFilteredResult(_0x4a7c9a,_0xc2fb74))[_0x6f83('0x41')](handleError(_0x4a7c9a,null));};exports['show']=function(_0x5a96c1,_0x19748c){var _0x5e0cc5={'raw':!![],'where':{'id':_0x5a96c1[_0x6f83('0x42')]['id']}},_0x2461ae={};_0x2461ae['model']=_['keys'](db[_0x6f83('0x29')][_0x6f83('0x2a')]);_0x2461ae[_0x6f83('0x2f')]=_[_0x6f83('0x43')](_0x5a96c1[_0x6f83('0x2f')]);_0x2461ae[_0x6f83('0x30')]=_[_0x6f83('0x31')](_0x2461ae[_0x6f83('0x2e')],_0x2461ae['query']);_0x5e0cc5[_0x6f83('0x33')]=_[_0x6f83('0x31')](_0x2461ae[_0x6f83('0x2e')],qs[_0x6f83('0x44')](_0x5a96c1['query'][_0x6f83('0x44')]));_0x5e0cc5[_0x6f83('0x33')]=_0x5e0cc5[_0x6f83('0x33')][_0x6f83('0x32')]?_0x5e0cc5[_0x6f83('0x33')]:_0x2461ae[_0x6f83('0x2e')];if(_0x5a96c1[_0x6f83('0x2f')][_0x6f83('0x45')]){_0x5e0cc5[_0x6f83('0x3e')]=[{'all':!![]}];}_0x5e0cc5=_[_0x6f83('0x3b')]({},_0x5e0cc5,_0x5a96c1['options']);return db[_0x6f83('0x29')]['find'](_0x5e0cc5)[_0x6f83('0x3d')](handleEntityNotFound(_0x19748c,null))['then'](respondWithResult(_0x19748c,null))['catch'](handleError(_0x19748c,null));};exports[_0x6f83('0x46')]=function(_0x105843,_0x4cf2c5){return db[_0x6f83('0x29')][_0x6f83('0x46')](_0x105843[_0x6f83('0x47')],{})[_0x6f83('0x3d')](respondWithResult(_0x4cf2c5,0xc9))[_0x6f83('0x41')](handleError(_0x4cf2c5,null));};exports['update']=function(_0x3e778b,_0x351390){if(_0x3e778b[_0x6f83('0x47')]['id']){delete _0x3e778b[_0x6f83('0x47')]['id'];}return db[_0x6f83('0x29')][_0x6f83('0x48')]({'where':{'id':_0x3e778b[_0x6f83('0x42')]['id']}})[_0x6f83('0x3d')](handleEntityNotFound(_0x351390,null))['then'](saveUpdates(_0x3e778b[_0x6f83('0x47')],null))[_0x6f83('0x3d')](respondWithResult(_0x351390,null))['catch'](handleError(_0x351390,null));};exports[_0x6f83('0x22')]=function(_0x4f560f,_0x397ffe){return db[_0x6f83('0x29')][_0x6f83('0x48')]({'where':{'id':_0x4f560f['params']['id']}})[_0x6f83('0x3d')](handleEntityNotFound(_0x397ffe,null))['then'](removeEntity(_0x397ffe,null))[_0x6f83('0x41')](handleError(_0x397ffe,null));};exports['describe']=function(_0x5a7d15,_0x506444){return db[_0x6f83('0x29')][_0x6f83('0x49')]()[_0x6f83('0x3d')](respondWithResult(_0x506444,null))['catch'](handleError(_0x506444,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index c4e7024..94a18ac 100644 --- a/server/api/smsQueueReport/smsQueueReport.model.js +++ b/server/api/smsQueueReport/smsQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['define','report_sms_queue','uniqueid','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0xeda735,_0x51d771){var _0x4157cc=function(_0x139056){while(--_0x139056){_0xeda735['push'](_0xeda735['shift']());}};_0x4157cc(++_0x51d771);}(_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 logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x0d8b('0x2'));var rp=require(_0x0d8b('0x3'));var fs=require('fs');var path=require(_0x0d8b('0x4'));var rimraf=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var attributes=require('./smsQueueReport.attributes');module['exports']=function(_0x3f8b6f,_0x227c63){return _0x3f8b6f[_0x0d8b('0x7')]('SmsQueueReport',attributes,{'tableName':_0x0d8b('0x8'),'paranoid':![],'indexes':[{'name':_0x0d8b('0x9'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xa9e0=['define','SmsQueueReport','uniqueid','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./smsQueueReport.attributes','exports'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0xa9e0[_0x5783f4];return _0x28e380;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'report_sms_queue','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x0a9e('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.rpc.js b/server/api/smsQueueReport/smsQueueReport.rpc.js index 55bc405..2023c02 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 _0xe720=['request','then','info','SmsQueueReport,\x20%s,\x20%s','request\x20sent','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CreateSmsQueueReport','SmsQueueReport','create','body','options','raw','update','where','attributes','limit','UpdateSmsQueueReport','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','client'];(function(_0x3caa59,_0x41d4c6){var _0x324b64=function(_0x4e757f){while(--_0x4e757f){_0x3caa59['push'](_0x3caa59['shift']());}};_0x324b64(++_0x41d4c6);}(_0xe720,0xf7));var _0x0e72=function(_0x2ba23b,_0x4d6341){_0x2ba23b=_0x2ba23b-0x0;var _0x3e521b=_0xe720[_0x2ba23b];return _0x3e521b;};'use strict';var _=require(_0x0e72('0x0'));var util=require(_0x0e72('0x1'));var moment=require(_0x0e72('0x2'));var BPromise=require(_0x0e72('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0e72('0x4'))['db'];var utils=require(_0x0e72('0x5'));var logger=require('../../config/logger')(_0x0e72('0x6'));var config=require(_0x0e72('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x0e72('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x40037d,_0x1478f6,_0x397056){return new BPromise(function(_0x3c62d8,_0x7abd3c){return client[_0x0e72('0x9')](_0x40037d,_0x397056)[_0x0e72('0xa')](function(_0x1b8228){logger[_0x0e72('0xb')](_0x0e72('0xc'),_0x1478f6,_0x0e72('0xd'));logger[_0x0e72('0xe')](_0x0e72('0xf'),_0x1478f6,_0x0e72('0xd'),JSON[_0x0e72('0x10')](_0x1b8228));if(_0x1b8228[_0x0e72('0x11')]){if(_0x1b8228[_0x0e72('0x11')]['code']===0x1f4){logger[_0x0e72('0x11')](_0x0e72('0xc'),_0x1478f6,_0x1b8228[_0x0e72('0x11')][_0x0e72('0x12')]);return _0x7abd3c(_0x1b8228[_0x0e72('0x11')][_0x0e72('0x12')]);}logger['error'](_0x0e72('0xc'),_0x1478f6,_0x1b8228[_0x0e72('0x11')][_0x0e72('0x12')]);return _0x3c62d8(_0x1b8228[_0x0e72('0x11')]['message']);}else{logger[_0x0e72('0xb')]('SmsQueueReport,\x20%s,\x20%s',_0x1478f6,_0x0e72('0xd'));_0x3c62d8(_0x1b8228[_0x0e72('0x13')][_0x0e72('0x12')]);}})[_0x0e72('0x14')](function(_0x23e31f){logger['error']('SmsQueueReport,\x20%s,\x20%s',_0x1478f6,_0x23e31f);_0x7abd3c(_0x23e31f);});});}exports[_0x0e72('0x15')]=function(_0x3fe946){var _0x334c59=this;return new Promise(function(_0x5c3ae2,_0x16d30b){return db[_0x0e72('0x16')][_0x0e72('0x17')](_0x3fe946[_0x0e72('0x18')],{'raw':_0x3fe946[_0x0e72('0x19')]?_0x3fe946[_0x0e72('0x19')][_0x0e72('0x1a')]===undefined?!![]:![]:!![]})[_0x0e72('0xa')](function(_0x5ec6dc){logger['info'](_0x0e72('0x15'),_0x3fe946);logger[_0x0e72('0xe')]('CreateSmsQueueReport',_0x3fe946,JSON[_0x0e72('0x10')](_0x5ec6dc));_0x5c3ae2(_0x5ec6dc);})['catch'](function(_0x1812bf){logger[_0x0e72('0x11')]('CreateSmsQueueReport',_0x1812bf[_0x0e72('0x12')],_0x3fe946);_0x16d30b(_0x334c59[_0x0e72('0x11')](0x1f4,_0x1812bf[_0x0e72('0x12')]));});});};exports['UpdateSmsQueueReport']=function(_0x9f206c){var _0x37409f=this;return new Promise(function(_0x14d14f,_0x423864){return db['SmsQueueReport'][_0x0e72('0x1b')](_0x9f206c[_0x0e72('0x18')],{'raw':_0x9f206c[_0x0e72('0x19')]?_0x9f206c[_0x0e72('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x9f206c[_0x0e72('0x19')]?_0x9f206c['options'][_0x0e72('0x1c')]||null:null,'attributes':_0x9f206c['options']?_0x9f206c[_0x0e72('0x19')][_0x0e72('0x1d')]||null:null,'limit':_0x9f206c['options']?_0x9f206c[_0x0e72('0x19')][_0x0e72('0x1e')]||null:null})[_0x0e72('0xa')](function(_0x5c4bfe){logger[_0x0e72('0xb')]('UpdateSmsQueueReport',_0x9f206c);logger[_0x0e72('0xe')](_0x0e72('0x1f'),_0x9f206c,JSON[_0x0e72('0x10')](_0x5c4bfe));_0x14d14f(_0x5c4bfe);})[_0x0e72('0x14')](function(_0x4384c8){logger[_0x0e72('0x11')](_0x0e72('0x1f'),_0x4384c8['message'],_0x9f206c);_0x423864(_0x37409f[_0x0e72('0x11')](0x1f4,_0x4384c8[_0x0e72('0x12')]));});});}; \ No newline at end of file +var _0xba26=['UpdateSmsQueueReport','lodash','util','moment','bluebird','randomstring','../../config/logger','../../config/environment','jayson/promise','client','http','info','SmsQueueReport,\x20%s,\x20%s','request\x20sent','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','create','body','options','then','CreateSmsQueueReport','SmsQueueReport','raw','attributes','limit'];(function(_0x521d5c,_0x2a1b45){var _0x5cc0e5=function(_0x2e240e){while(--_0x2e240e){_0x521d5c['push'](_0x521d5c['shift']());}};_0x5cc0e5(++_0x2a1b45);}(_0xba26,0x1f1));var _0x6ba2=function(_0x42ab07,_0x4788a1){_0x42ab07=_0x42ab07-0x0;var _0x44836a=_0xba26[_0x42ab07];return _0x44836a;};'use strict';var _=require(_0x6ba2('0x0'));var util=require(_0x6ba2('0x1'));var moment=require(_0x6ba2('0x2'));var BPromise=require(_0x6ba2('0x3'));var rs=require(_0x6ba2('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x6ba2('0x5'))('rpc');var config=require(_0x6ba2('0x6'));var jayson=require(_0x6ba2('0x7'));var client=jayson[_0x6ba2('0x8')][_0x6ba2('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x56d090,_0x5aec70,_0x46806d){return new BPromise(function(_0x4bc518,_0x428a8c){return client['request'](_0x56d090,_0x46806d)['then'](function(_0x10c282){logger[_0x6ba2('0xa')](_0x6ba2('0xb'),_0x5aec70,_0x6ba2('0xc'));logger[_0x6ba2('0xd')](_0x6ba2('0xe'),_0x5aec70,'request\x20sent',JSON[_0x6ba2('0xf')](_0x10c282));if(_0x10c282['error']){if(_0x10c282[_0x6ba2('0x10')][_0x6ba2('0x11')]===0x1f4){logger[_0x6ba2('0x10')](_0x6ba2('0xb'),_0x5aec70,_0x10c282[_0x6ba2('0x10')][_0x6ba2('0x12')]);return _0x428a8c(_0x10c282[_0x6ba2('0x10')]['message']);}logger['error'](_0x6ba2('0xb'),_0x5aec70,_0x10c282[_0x6ba2('0x10')]['message']);return _0x4bc518(_0x10c282[_0x6ba2('0x10')]['message']);}else{logger['info'](_0x6ba2('0xb'),_0x5aec70,_0x6ba2('0xc'));_0x4bc518(_0x10c282[_0x6ba2('0x13')][_0x6ba2('0x12')]);}})[_0x6ba2('0x14')](function(_0x3d0574){logger['error']('SmsQueueReport,\x20%s,\x20%s',_0x5aec70,_0x3d0574);_0x428a8c(_0x3d0574);});});}exports['CreateSmsQueueReport']=function(_0x227bdc){var _0x54bb03=this;return new Promise(function(_0x56d5f0,_0xe30abb){return db['SmsQueueReport'][_0x6ba2('0x15')](_0x227bdc[_0x6ba2('0x16')],{'raw':_0x227bdc[_0x6ba2('0x17')]?_0x227bdc['options']['raw']===undefined?!![]:![]:!![]})[_0x6ba2('0x18')](function(_0x3d1821){logger[_0x6ba2('0xa')]('CreateSmsQueueReport',_0x227bdc);logger['debug'](_0x6ba2('0x19'),_0x227bdc,JSON[_0x6ba2('0xf')](_0x3d1821));_0x56d5f0(_0x3d1821);})[_0x6ba2('0x14')](function(_0x1bb5f9){logger['error'](_0x6ba2('0x19'),_0x1bb5f9[_0x6ba2('0x12')],_0x227bdc);_0xe30abb(_0x54bb03[_0x6ba2('0x10')](0x1f4,_0x1bb5f9['message']));});});};exports['UpdateSmsQueueReport']=function(_0x42844a){var _0x8bc5c1=this;return new Promise(function(_0x36a28f,_0x35c2bb){return db[_0x6ba2('0x1a')]['update'](_0x42844a[_0x6ba2('0x16')],{'raw':_0x42844a[_0x6ba2('0x17')]?_0x42844a[_0x6ba2('0x17')][_0x6ba2('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x42844a['options']?_0x42844a[_0x6ba2('0x17')]['where']||null:null,'attributes':_0x42844a[_0x6ba2('0x17')]?_0x42844a[_0x6ba2('0x17')][_0x6ba2('0x1c')]||null:null,'limit':_0x42844a[_0x6ba2('0x17')]?_0x42844a['options'][_0x6ba2('0x1d')]||null:null})[_0x6ba2('0x18')](function(_0x42964c){logger[_0x6ba2('0xa')](_0x6ba2('0x1e'),_0x42844a);logger[_0x6ba2('0xd')](_0x6ba2('0x1e'),_0x42844a,JSON[_0x6ba2('0xf')](_0x42964c));_0x36a28f(_0x42964c);})['catch'](function(_0x3a7d6b){logger[_0x6ba2('0x10')]('UpdateSmsQueueReport',_0x3a7d6b[_0x6ba2('0x12')],_0x42844a);_0x35c2bb(_0x8bc5c1[_0x6ba2('0x10')](0x1f4,_0x3a7d6b['message']));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index 2f0ce24..b340660 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 _0xbd50=['path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','get','/describe','/:id','show','create','delete','exports','multer','util'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xbd50,0x196));var _0x0bd5=function(_0x72a04b,_0x6e6ccc){_0x72a04b=_0x72a04b-0x0;var _0xc193c2=_0xbd50[_0x72a04b];return _0xc193c2;};'use strict';var multer=require(_0x0bd5('0x0'));var util=require(_0x0bd5('0x1'));var path=require(_0x0bd5('0x2'));var timeout=require('connect-timeout');var express=require(_0x0bd5('0x3'));var router=express[_0x0bd5('0x4')]();var fs_extra=require(_0x0bd5('0x5'));var auth=require(_0x0bd5('0x6'));var interaction=require(_0x0bd5('0x7'));var config=require('../../config/environment');var controller=require('./smsTransferReport.controller');router['get']('/',auth[_0x0bd5('0x8')](),controller[_0x0bd5('0x9')]);router[_0x0bd5('0xa')](_0x0bd5('0xb'),auth[_0x0bd5('0x8')](),controller['describe']);router['get'](_0x0bd5('0xc'),auth[_0x0bd5('0x8')](),controller[_0x0bd5('0xd')]);router['post']('/',auth[_0x0bd5('0x8')](),controller[_0x0bd5('0xe')]);router['put'](_0x0bd5('0xc'),auth[_0x0bd5('0x8')](),controller['update']);router[_0x0bd5('0xf')](_0x0bd5('0xc'),auth[_0x0bd5('0x8')](),controller['destroy']);module[_0x0bd5('0x10')]=router; \ No newline at end of file +var _0xe0ae=['exports','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./smsTransferReport.controller','index','get','/describe','isAuthenticated','show','post','put','/:id','update'];(function(_0x454df7,_0x449532){var _0x12e277=function(_0x560355){while(--_0x560355){_0x454df7['push'](_0x454df7['shift']());}};_0x12e277(++_0x449532);}(_0xe0ae,0xa1));var _0xee0a=function(_0x4fb1b8,_0x32d98d){_0x4fb1b8=_0x4fb1b8-0x0;var _0x146c71=_0xe0ae[_0x4fb1b8];return _0x146c71;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xee0a('0x0'));var timeout=require(_0xee0a('0x1'));var express=require('express');var router=express[_0xee0a('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xee0a('0x3'));var interaction=require(_0xee0a('0x4'));var config=require('../../config/environment');var controller=require(_0xee0a('0x5'));router['get']('/',auth['isAuthenticated'](),controller[_0xee0a('0x6')]);router[_0xee0a('0x7')](_0xee0a('0x8'),auth[_0xee0a('0x9')](),controller['describe']);router[_0xee0a('0x7')]('/:id',auth['isAuthenticated'](),controller[_0xee0a('0xa')]);router[_0xee0a('0xb')]('/',auth[_0xee0a('0x9')](),controller['create']);router[_0xee0a('0xc')](_0xee0a('0xd'),auth['isAuthenticated'](),controller[_0xee0a('0xe')]);router['delete'](_0xee0a('0xd'),auth[_0xee0a('0x9')](),controller['destroy']);module[_0xee0a('0xf')]=router; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.attributes.js b/server/api/smsTransferReport/smsTransferReport.attributes.js index 44a8432..ebf0976 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 _0x9bde=['NOW','sequelize','STRING','account','agent','queue','DATE'];(function(_0x53abe5,_0x33a9e5){var _0xc1c37e=function(_0xd53c6e){while(--_0xd53c6e){_0x53abe5['push'](_0x53abe5['shift']());}};_0xc1c37e(++_0x33a9e5);}(_0x9bde,0xe1));var _0xe9bd=function(_0x4eaae1,_0x4c214e){_0x4eaae1=_0x4eaae1-0x0;var _0x9fbaa2=_0x9bde[_0x4eaae1];return _0x9fbaa2;};'use strict';var moment=require('moment');var Sequelize=require(_0xe9bd('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xe9bd('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xe9bd('0x2'),_0xe9bd('0x3'),_0xe9bd('0x4')),'allowNull':![],'defaultValue':_0xe9bd('0x4')},'transferredAt':{'type':Sequelize[_0xe9bd('0x5')],'allowNull':![],'defaultValue':Sequelize[_0xe9bd('0x6')]}}; \ No newline at end of file +var _0x34e8=['queue','DATE','NOW','moment','sequelize','exports','STRING','account','agent'];(function(_0x31e94f,_0x42ecd6){var _0x1b8494=function(_0x5da15c){while(--_0x5da15c){_0x31e94f['push'](_0x31e94f['shift']());}};_0x1b8494(++_0x42ecd6);}(_0x34e8,0x12c));var _0x834e=function(_0x45e031,_0x4ff4b1){_0x45e031=_0x45e031-0x0;var _0x4c5064=_0x34e8[_0x45e031];return _0x4c5064;};'use strict';var moment=require(_0x834e('0x0'));var Sequelize=require(_0x834e('0x1'));module[_0x834e('0x2')]={'uniqueid':{'type':Sequelize[_0x834e('0x3')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x834e('0x4'),_0x834e('0x5'),_0x834e('0x6')),'allowNull':![],'defaultValue':_0x834e('0x6')},'transferredAt':{'type':Sequelize[_0x834e('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x834e('0x8')]}}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index 6b7b446..3f2ac87 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 _0xfdc0=['json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','then','end','error','stack','name','send','index','rawAttributes','fieldName','key','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','type','VIRTUAL','merge','options','SmsTransferReport','include','findAll','catch','show','params','length','includeAll','find','create','body','update','destroy','describe','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','crypto','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','../../mysqldb','sendStatus','status'];(function(_0x2ba573,_0x25c00b){var _0x588b98=function(_0x585994){while(--_0x585994){_0x2ba573['push'](_0x2ba573['shift']());}};_0x588b98(++_0x25c00b);}(_0xfdc0,0x1af));var _0x0fdc=function(_0x2d9c6a,_0x59393d){_0x2d9c6a=_0x2d9c6a-0x0;var _0xf3c918=_0xfdc0[_0x2d9c6a];return _0xf3c918;};'use strict';var emlformat=require(_0x0fdc('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0fdc('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0fdc('0x2'));var moment=require(_0x0fdc('0x3'));var BPromise=require(_0x0fdc('0x4'));var Mustache=require(_0x0fdc('0x5'));var util=require(_0x0fdc('0x6'));var path=require(_0x0fdc('0x7'));var sox=require(_0x0fdc('0x8'));var csv=require('to-csv');var ejs=require(_0x0fdc('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0fdc('0xa'));var squel=require('squel');var crypto=require(_0x0fdc('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x0fdc('0xc'));var toCsv=require(_0x0fdc('0xd'));var querystring=require('querystring');var Papa=require(_0x0fdc('0xe'));var Redis=require(_0x0fdc('0xf'));var authService=require(_0x0fdc('0x10'));var qs=require(_0x0fdc('0x11'));var as=require(_0x0fdc('0x12'));var hardwareService=require(_0x0fdc('0x13'));var logger=require('../../config/logger')(_0x0fdc('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0fdc('0x15'));var db=require(_0x0fdc('0x16'))['db'];function respondWithStatusCode(_0x20b0e1,_0x5e2189){_0x5e2189=_0x5e2189||0xcc;return function(_0x443081){if(_0x443081){return _0x20b0e1[_0x0fdc('0x17')](_0x5e2189);}return _0x20b0e1['status'](_0x5e2189)['end']();};}function respondWithResult(_0x243253,_0xb24ff6){_0xb24ff6=_0xb24ff6||0xc8;return function(_0x25b039){if(_0x25b039){return _0x243253[_0x0fdc('0x18')](_0xb24ff6)[_0x0fdc('0x19')](_0x25b039);}};}function respondWithFilteredResult(_0x1afa8e,_0x11d051){return function(_0x178a76){if(_0x178a76){var _0x4d0db0=typeof _0x11d051[_0x0fdc('0x1a')]==='undefined'&&typeof _0x11d051[_0x0fdc('0x1b')]===_0x0fdc('0x1c');var _0x408f5d=_0x178a76[_0x0fdc('0x1d')];var _0x3285e7=_0x4d0db0?0x0:_0x11d051[_0x0fdc('0x1a')];var _0x9e9308=_0x4d0db0?_0x178a76[_0x0fdc('0x1d')]:_0x11d051[_0x0fdc('0x1a')]+_0x11d051[_0x0fdc('0x1b')];var _0x1faca9;if(_0x9e9308>=_0x408f5d){_0x9e9308=_0x408f5d;_0x1faca9=0xc8;}else{_0x1faca9=0xce;}_0x1afa8e[_0x0fdc('0x18')](_0x1faca9);return _0x1afa8e[_0x0fdc('0x1e')](_0x0fdc('0x1f'),_0x3285e7+'-'+_0x9e9308+'/'+_0x408f5d)['json'](_0x178a76);}return null;};}function patchUpdates(_0x32a317){return function(_0x26674b){try{jsonpatch[_0x0fdc('0x20')](_0x26674b,_0x32a317,!![]);}catch(_0x321004){return BPromise[_0x0fdc('0x21')](_0x321004);}return _0x26674b[_0x0fdc('0x22')]();};}function saveUpdates(_0x5b037c,_0x2d205e){return function(_0x10f616){if(_0x10f616){return _0x10f616['update'](_0x5b037c)['then'](function(_0x4313d3){return _0x4313d3;});}return null;};}function removeEntity(_0x52e4f7,_0x5706d9){return function(_0x1723a9){if(_0x1723a9){return _0x1723a9['destroy']()[_0x0fdc('0x23')](function(){_0x52e4f7[_0x0fdc('0x18')](0xcc)[_0x0fdc('0x24')]();});}};}function handleEntityNotFound(_0x1ef474,_0x13db7b){return function(_0x4d9421){if(!_0x4d9421){_0x1ef474[_0x0fdc('0x17')](0x194);}return _0x4d9421;};}function handleError(_0x424792,_0x622306){_0x622306=_0x622306||0x1f4;return function(_0x549b6c){logger[_0x0fdc('0x25')](_0x549b6c[_0x0fdc('0x26')]);if(_0x549b6c['name']){delete _0x549b6c[_0x0fdc('0x27')];}_0x424792[_0x0fdc('0x18')](_0x622306)[_0x0fdc('0x28')](_0x549b6c);};}exports[_0x0fdc('0x29')]=function(_0x133afd,_0x430815){var _0x5938e4={},_0x404b93={},_0x497c1b={'count':0x0,'rows':[]};var _0xb7c816=_['map'](db['SmsTransferReport'][_0x0fdc('0x2a')],function(_0x53aeee){return{'name':_0x53aeee[_0x0fdc('0x2b')],'type':_0x53aeee['type'][_0x0fdc('0x2c')]};});_0x404b93[_0x0fdc('0x2d')]=_[_0x0fdc('0x2e')](_0xb7c816,_0x0fdc('0x27'));_0x404b93[_0x0fdc('0x2f')]=_['keys'](_0x133afd[_0x0fdc('0x2f')]);_0x404b93[_0x0fdc('0x30')]=_[_0x0fdc('0x31')](_0x404b93['model'],_0x404b93['query']);_0x5938e4[_0x0fdc('0x32')]=_[_0x0fdc('0x31')](_0x404b93[_0x0fdc('0x2d')],qs[_0x0fdc('0x33')](_0x133afd[_0x0fdc('0x2f')]['fields']));_0x5938e4[_0x0fdc('0x32')]=_0x5938e4['attributes']['length']?_0x5938e4[_0x0fdc('0x32')]:_0x404b93[_0x0fdc('0x2d')];if(!_0x133afd[_0x0fdc('0x2f')][_0x0fdc('0x34')](_0x0fdc('0x35'))){_0x5938e4['limit']=qs[_0x0fdc('0x1b')](_0x133afd[_0x0fdc('0x2f')][_0x0fdc('0x1b')]);_0x5938e4['offset']=qs['offset'](_0x133afd[_0x0fdc('0x2f')][_0x0fdc('0x1a')]);}_0x5938e4[_0x0fdc('0x36')]=qs[_0x0fdc('0x37')](_0x133afd['query'][_0x0fdc('0x37')]);_0x5938e4[_0x0fdc('0x38')]=qs['filters'](_['pick'](_0x133afd[_0x0fdc('0x2f')],_0x404b93[_0x0fdc('0x30')]),_0xb7c816);if(_0x133afd[_0x0fdc('0x2f')][_0x0fdc('0x39')]){_0x5938e4[_0x0fdc('0x38')]=_['merge'](_0x5938e4[_0x0fdc('0x38')],{'$or':_['map'](_0xb7c816,function(_0x2bd5d4){if(_0x2bd5d4[_0x0fdc('0x3a')]!==_0x0fdc('0x3b')){var _0x4c1f5e={};_0x4c1f5e[_0x2bd5d4[_0x0fdc('0x27')]]={'$like':'%'+_0x133afd[_0x0fdc('0x2f')][_0x0fdc('0x39')]+'%'};return _0x4c1f5e;}})});}_0x5938e4=_[_0x0fdc('0x3c')]({},_0x5938e4,_0x133afd[_0x0fdc('0x3d')]);var _0x35adae={'where':_0x5938e4['where']};return db[_0x0fdc('0x3e')][_0x0fdc('0x1d')](_0x35adae)['then'](function(_0x5c9dd7){_0x497c1b[_0x0fdc('0x1d')]=_0x5c9dd7;if(_0x133afd['query']['includeAll']){_0x5938e4[_0x0fdc('0x3f')]=[{'all':!![]}];}return db[_0x0fdc('0x3e')][_0x0fdc('0x40')](_0x5938e4);})[_0x0fdc('0x23')](function(_0x282378){_0x497c1b['rows']=_0x282378;return _0x497c1b;})[_0x0fdc('0x23')](respondWithFilteredResult(_0x430815,_0x5938e4))[_0x0fdc('0x41')](handleError(_0x430815,null));};exports[_0x0fdc('0x42')]=function(_0x23256a,_0x4a8b57){var _0x25eff0={'raw':!![],'where':{'id':_0x23256a[_0x0fdc('0x43')]['id']}},_0x2028db={};_0x2028db[_0x0fdc('0x2d')]=_['keys'](db['SmsTransferReport'][_0x0fdc('0x2a')]);_0x2028db[_0x0fdc('0x2f')]=_['keys'](_0x23256a[_0x0fdc('0x2f')]);_0x2028db[_0x0fdc('0x30')]=_[_0x0fdc('0x31')](_0x2028db['model'],_0x2028db[_0x0fdc('0x2f')]);_0x25eff0[_0x0fdc('0x32')]=_[_0x0fdc('0x31')](_0x2028db['model'],qs[_0x0fdc('0x33')](_0x23256a[_0x0fdc('0x2f')]['fields']));_0x25eff0[_0x0fdc('0x32')]=_0x25eff0[_0x0fdc('0x32')][_0x0fdc('0x44')]?_0x25eff0[_0x0fdc('0x32')]:_0x2028db[_0x0fdc('0x2d')];if(_0x23256a[_0x0fdc('0x2f')][_0x0fdc('0x45')]){_0x25eff0[_0x0fdc('0x3f')]=[{'all':!![]}];}_0x25eff0=_[_0x0fdc('0x3c')]({},_0x25eff0,_0x23256a[_0x0fdc('0x3d')]);return db[_0x0fdc('0x3e')][_0x0fdc('0x46')](_0x25eff0)[_0x0fdc('0x23')](handleEntityNotFound(_0x4a8b57,null))[_0x0fdc('0x23')](respondWithResult(_0x4a8b57,null))[_0x0fdc('0x41')](handleError(_0x4a8b57,null));};exports[_0x0fdc('0x47')]=function(_0x25777b,_0x5a9293){return db['SmsTransferReport']['create'](_0x25777b[_0x0fdc('0x48')],{})[_0x0fdc('0x23')](respondWithResult(_0x5a9293,0xc9))['catch'](handleError(_0x5a9293,null));};exports[_0x0fdc('0x49')]=function(_0x1b73d4,_0x2c3660){if(_0x1b73d4[_0x0fdc('0x48')]['id']){delete _0x1b73d4[_0x0fdc('0x48')]['id'];}return db[_0x0fdc('0x3e')]['find']({'where':{'id':_0x1b73d4[_0x0fdc('0x43')]['id']}})[_0x0fdc('0x23')](handleEntityNotFound(_0x2c3660,null))['then'](saveUpdates(_0x1b73d4[_0x0fdc('0x48')],null))[_0x0fdc('0x23')](respondWithResult(_0x2c3660,null))[_0x0fdc('0x41')](handleError(_0x2c3660,null));};exports[_0x0fdc('0x4a')]=function(_0x1cfc9a,_0x8e3c8d){return db['SmsTransferReport']['find']({'where':{'id':_0x1cfc9a[_0x0fdc('0x43')]['id']}})[_0x0fdc('0x23')](handleEntityNotFound(_0x8e3c8d,null))[_0x0fdc('0x23')](removeEntity(_0x8e3c8d,null))[_0x0fdc('0x41')](handleError(_0x8e3c8d,null));};exports[_0x0fdc('0x4b')]=function(_0x64ef4a,_0x29ebad){return db['SmsTransferReport'][_0x0fdc('0x4b')]()[_0x0fdc('0x23')](respondWithResult(_0x29ebad,null))['catch'](handleError(_0x29ebad,null));}; \ No newline at end of file +var _0xdcd0=['sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','apply','reject','save','then','destroy','error','name','send','index','map','SmsTransferReport','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','includeAll','include','rows','catch','show','params','merge','options','find','create','body','describe','eml-format','rimraf','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb'];(function(_0xa270f3,_0x293fd){var _0x48767f=function(_0x2db048){while(--_0x2db048){_0xa270f3['push'](_0xa270f3['shift']());}};_0x48767f(++_0x293fd);}(_0xdcd0,0x163));var _0x0dcd=function(_0x570da3,_0x2f3016){_0x570da3=_0x570da3-0x0;var _0x196ecb=_0xdcd0[_0x570da3];return _0x196ecb;};'use strict';var emlformat=require(_0x0dcd('0x0'));var rimraf=require(_0x0dcd('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0dcd('0x2'));var BPromise=require(_0x0dcd('0x3'));var Mustache=require(_0x0dcd('0x4'));var util=require(_0x0dcd('0x5'));var path=require(_0x0dcd('0x6'));var sox=require(_0x0dcd('0x7'));var csv=require(_0x0dcd('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0dcd('0x9'));var squel=require(_0x0dcd('0xa'));var crypto=require(_0x0dcd('0xb'));var jsforce=require(_0x0dcd('0xc'));var deskjs=require(_0x0dcd('0xd'));var toCsv=require(_0x0dcd('0x8'));var querystring=require(_0x0dcd('0xe'));var Papa=require(_0x0dcd('0xf'));var Redis=require(_0x0dcd('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x0dcd('0x11'));var as=require(_0x0dcd('0x12'));var hardwareService=require(_0x0dcd('0x13'));var logger=require(_0x0dcd('0x14'))(_0x0dcd('0x15'));var utils=require(_0x0dcd('0x16'));var config=require(_0x0dcd('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x0dcd('0x18'))['db'];function respondWithStatusCode(_0x4aaf44,_0x3b9104){_0x3b9104=_0x3b9104||0xcc;return function(_0x25c637){if(_0x25c637){return _0x4aaf44[_0x0dcd('0x19')](_0x3b9104);}return _0x4aaf44[_0x0dcd('0x1a')](_0x3b9104)[_0x0dcd('0x1b')]();};}function respondWithResult(_0x53813f,_0x222a01){_0x222a01=_0x222a01||0xc8;return function(_0x148547){if(_0x148547){return _0x53813f['status'](_0x222a01)[_0x0dcd('0x1c')](_0x148547);}};}function respondWithFilteredResult(_0xfc51ef,_0x7acc97){return function(_0x4d2e20){if(_0x4d2e20){var _0x5206ea=typeof _0x7acc97[_0x0dcd('0x1d')]===_0x0dcd('0x1e')&&typeof _0x7acc97['limit']===_0x0dcd('0x1e');var _0x2fad1b=_0x4d2e20[_0x0dcd('0x1f')];var _0x5ecc10=_0x5206ea?0x0:_0x7acc97[_0x0dcd('0x1d')];var _0x28eea2=_0x5206ea?_0x4d2e20[_0x0dcd('0x1f')]:_0x7acc97[_0x0dcd('0x1d')]+_0x7acc97[_0x0dcd('0x20')];var _0x2ef19b;if(_0x28eea2>=_0x2fad1b){_0x28eea2=_0x2fad1b;_0x2ef19b=0xc8;}else{_0x2ef19b=0xce;}_0xfc51ef[_0x0dcd('0x1a')](_0x2ef19b);return _0xfc51ef['set'](_0x0dcd('0x21'),_0x5ecc10+'-'+_0x28eea2+'/'+_0x2fad1b)['json'](_0x4d2e20);}return null;};}function patchUpdates(_0x14dc65){return function(_0xaff053){try{jsonpatch[_0x0dcd('0x22')](_0xaff053,_0x14dc65,!![]);}catch(_0x590a4e){return BPromise[_0x0dcd('0x23')](_0x590a4e);}return _0xaff053[_0x0dcd('0x24')]();};}function saveUpdates(_0x446135,_0x249aa8){return function(_0x298f91){if(_0x298f91){return _0x298f91['update'](_0x446135)[_0x0dcd('0x25')](function(_0x342f40){return _0x342f40;});}return null;};}function removeEntity(_0x5e1567,_0x9b4787){return function(_0x38ac13){if(_0x38ac13){return _0x38ac13[_0x0dcd('0x26')]()[_0x0dcd('0x25')](function(){_0x5e1567[_0x0dcd('0x1a')](0xcc)[_0x0dcd('0x1b')]();});}};}function handleEntityNotFound(_0x539373,_0x24de75){return function(_0x448cb4){if(!_0x448cb4){_0x539373['sendStatus'](0x194);}return _0x448cb4;};}function handleError(_0x278cfc,_0x25d61f){_0x25d61f=_0x25d61f||0x1f4;return function(_0x5839ea){logger[_0x0dcd('0x27')](_0x5839ea['stack']);if(_0x5839ea['name']){delete _0x5839ea[_0x0dcd('0x28')];}_0x278cfc[_0x0dcd('0x1a')](_0x25d61f)[_0x0dcd('0x29')](_0x5839ea);};}exports[_0x0dcd('0x2a')]=function(_0x23ecb6,_0x298312){var _0x41be93={},_0x6260e0={},_0x567f9b={'count':0x0,'rows':[]};var _0x772564=_[_0x0dcd('0x2b')](db[_0x0dcd('0x2c')][_0x0dcd('0x2d')],function(_0x4e45d1){return{'name':_0x4e45d1[_0x0dcd('0x2e')],'type':_0x4e45d1[_0x0dcd('0x2f')][_0x0dcd('0x30')]};});_0x6260e0[_0x0dcd('0x31')]=_['map'](_0x772564,'name');_0x6260e0[_0x0dcd('0x32')]=_[_0x0dcd('0x33')](_0x23ecb6[_0x0dcd('0x32')]);_0x6260e0[_0x0dcd('0x34')]=_['intersection'](_0x6260e0[_0x0dcd('0x31')],_0x6260e0[_0x0dcd('0x32')]);_0x41be93[_0x0dcd('0x35')]=_[_0x0dcd('0x36')](_0x6260e0[_0x0dcd('0x31')],qs[_0x0dcd('0x37')](_0x23ecb6['query'][_0x0dcd('0x37')]));_0x41be93[_0x0dcd('0x35')]=_0x41be93[_0x0dcd('0x35')][_0x0dcd('0x38')]?_0x41be93['attributes']:_0x6260e0[_0x0dcd('0x31')];if(!_0x23ecb6[_0x0dcd('0x32')][_0x0dcd('0x39')](_0x0dcd('0x3a'))){_0x41be93[_0x0dcd('0x20')]=qs[_0x0dcd('0x20')](_0x23ecb6[_0x0dcd('0x32')][_0x0dcd('0x20')]);_0x41be93[_0x0dcd('0x1d')]=qs[_0x0dcd('0x1d')](_0x23ecb6[_0x0dcd('0x32')][_0x0dcd('0x1d')]);}_0x41be93[_0x0dcd('0x3b')]=qs[_0x0dcd('0x3c')](_0x23ecb6['query'][_0x0dcd('0x3c')]);_0x41be93[_0x0dcd('0x3d')]=qs['filters'](_['pick'](_0x23ecb6[_0x0dcd('0x32')],_0x6260e0['filters']),_0x772564);if(_0x23ecb6[_0x0dcd('0x32')][_0x0dcd('0x3e')]){_0x41be93[_0x0dcd('0x3d')]=_['merge'](_0x41be93['where'],{'$or':_[_0x0dcd('0x2b')](_0x772564,function(_0x4c911d){if(_0x4c911d[_0x0dcd('0x2f')]!==_0x0dcd('0x3f')){var _0x5c01a6={};_0x5c01a6[_0x4c911d[_0x0dcd('0x28')]]={'$like':'%'+_0x23ecb6['query'][_0x0dcd('0x3e')]+'%'};return _0x5c01a6;}})});}_0x41be93=_['merge']({},_0x41be93,_0x23ecb6['options']);var _0x27341f={'where':_0x41be93[_0x0dcd('0x3d')]};return db['SmsTransferReport'][_0x0dcd('0x1f')](_0x27341f)['then'](function(_0x809f03){_0x567f9b[_0x0dcd('0x1f')]=_0x809f03;if(_0x23ecb6[_0x0dcd('0x32')][_0x0dcd('0x40')]){_0x41be93[_0x0dcd('0x41')]=[{'all':!![]}];}return db[_0x0dcd('0x2c')]['findAll'](_0x41be93);})['then'](function(_0x1041d0){_0x567f9b[_0x0dcd('0x42')]=_0x1041d0;return _0x567f9b;})[_0x0dcd('0x25')](respondWithFilteredResult(_0x298312,_0x41be93))[_0x0dcd('0x43')](handleError(_0x298312,null));};exports[_0x0dcd('0x44')]=function(_0x68f9d6,_0x41db50){var _0x52cce7={'raw':!![],'where':{'id':_0x68f9d6[_0x0dcd('0x45')]['id']}},_0x3b9071={};_0x3b9071[_0x0dcd('0x31')]=_[_0x0dcd('0x33')](db[_0x0dcd('0x2c')][_0x0dcd('0x2d')]);_0x3b9071['query']=_[_0x0dcd('0x33')](_0x68f9d6['query']);_0x3b9071[_0x0dcd('0x34')]=_['intersection'](_0x3b9071[_0x0dcd('0x31')],_0x3b9071[_0x0dcd('0x32')]);_0x52cce7[_0x0dcd('0x35')]=_[_0x0dcd('0x36')](_0x3b9071[_0x0dcd('0x31')],qs['fields'](_0x68f9d6[_0x0dcd('0x32')][_0x0dcd('0x37')]));_0x52cce7[_0x0dcd('0x35')]=_0x52cce7[_0x0dcd('0x35')][_0x0dcd('0x38')]?_0x52cce7[_0x0dcd('0x35')]:_0x3b9071['model'];if(_0x68f9d6[_0x0dcd('0x32')][_0x0dcd('0x40')]){_0x52cce7[_0x0dcd('0x41')]=[{'all':!![]}];}_0x52cce7=_[_0x0dcd('0x46')]({},_0x52cce7,_0x68f9d6[_0x0dcd('0x47')]);return db['SmsTransferReport'][_0x0dcd('0x48')](_0x52cce7)[_0x0dcd('0x25')](handleEntityNotFound(_0x41db50,null))[_0x0dcd('0x25')](respondWithResult(_0x41db50,null))[_0x0dcd('0x43')](handleError(_0x41db50,null));};exports[_0x0dcd('0x49')]=function(_0x30d46f,_0x3107a2){return db['SmsTransferReport'][_0x0dcd('0x49')](_0x30d46f[_0x0dcd('0x4a')],{})[_0x0dcd('0x25')](respondWithResult(_0x3107a2,0xc9))[_0x0dcd('0x43')](handleError(_0x3107a2,null));};exports['update']=function(_0x50114c,_0x35816e){if(_0x50114c[_0x0dcd('0x4a')]['id']){delete _0x50114c[_0x0dcd('0x4a')]['id'];}return db[_0x0dcd('0x2c')][_0x0dcd('0x48')]({'where':{'id':_0x50114c[_0x0dcd('0x45')]['id']}})[_0x0dcd('0x25')](handleEntityNotFound(_0x35816e,null))[_0x0dcd('0x25')](saveUpdates(_0x50114c[_0x0dcd('0x4a')],null))[_0x0dcd('0x25')](respondWithResult(_0x35816e,null))['catch'](handleError(_0x35816e,null));};exports[_0x0dcd('0x26')]=function(_0x340b7a,_0x1f56f4){return db[_0x0dcd('0x2c')][_0x0dcd('0x48')]({'where':{'id':_0x340b7a[_0x0dcd('0x45')]['id']}})['then'](handleEntityNotFound(_0x1f56f4,null))['then'](removeEntity(_0x1f56f4,null))[_0x0dcd('0x43')](handleError(_0x1f56f4,null));};exports['describe']=function(_0x336a25,_0x234ca5){return db['SmsTransferReport'][_0x0dcd('0x4b')]()[_0x0dcd('0x25')](respondWithResult(_0x234ca5,null))[_0x0dcd('0x43')](handleError(_0x234ca5,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index fc936b2..3d43b79 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 _0xd69c=['api','moment','path','rimraf','./smsTransferReport.attributes','exports','define','SmsTransferReport','report_sms_transfer','uniqueid','lodash','util','../../config/logger'];(function(_0x579ad3,_0x5d763c){var _0x289a74=function(_0x16a359){while(--_0x16a359){_0x579ad3['push'](_0x579ad3['shift']());}};_0x289a74(++_0x5d763c);}(_0xd69c,0x15c));var _0xcd69=function(_0x3f2c72,_0x339845){_0x3f2c72=_0x3f2c72-0x0;var _0x4564ab=_0xd69c[_0x3f2c72];return _0x4564ab;};'use strict';var _=require(_0xcd69('0x0'));var util=require(_0xcd69('0x1'));var logger=require(_0xcd69('0x2'))(_0xcd69('0x3'));var moment=require(_0xcd69('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xcd69('0x5'));var rimraf=require(_0xcd69('0x6'));var config=require('../../config/environment');var attributes=require(_0xcd69('0x7'));module[_0xcd69('0x8')]=function(_0x48257f,_0x5d99a5){return _0x48257f[_0xcd69('0x9')](_0xcd69('0xa'),attributes,{'tableName':_0xcd69('0xb'),'paranoid':![],'indexes':[{'name':_0xcd69('0xc'),'fields':[_0xcd69('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3ffb=['define','SmsTransferReport','report_sms_transfer','uniqueid','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./smsTransferReport.attributes','exports'];(function(_0x1455e5,_0x732446){var _0x53b75f=function(_0x324236){while(--_0x324236){_0x1455e5['push'](_0x1455e5['shift']());}};_0x53b75f(++_0x732446);}(_0x3ffb,0x13f));var _0xb3ff=function(_0x2a219a,_0x5ed797){_0x2a219a=_0x2a219a-0x0;var _0x471b5b=_0x3ffb[_0x2a219a];return _0x471b5b;};'use strict';var _=require(_0xb3ff('0x0'));var util=require(_0xb3ff('0x1'));var logger=require(_0xb3ff('0x2'))(_0xb3ff('0x3'));var moment=require(_0xb3ff('0x4'));var BPromise=require('bluebird');var rp=require(_0xb3ff('0x5'));var fs=require('fs');var path=require(_0xb3ff('0x6'));var rimraf=require(_0xb3ff('0x7'));var config=require(_0xb3ff('0x8'));var attributes=require(_0xb3ff('0x9'));module[_0xb3ff('0xa')]=function(_0x45d514,_0x59bcb3){return _0x45d514[_0xb3ff('0xb')](_0xb3ff('0xc'),attributes,{'tableName':_0xb3ff('0xd'),'paranoid':![],'indexes':[{'name':_0xb3ff('0xe'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.rpc.js b/server/api/smsTransferReport/smsTransferReport.rpc.js index 0283c6c..bbdaa9a 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 _0x34e7=['SmsTransferReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','SmsTransferReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x5a85c3,_0x1c5402){var _0x43fa29=function(_0x1b10fc){while(--_0x1b10fc){_0x5a85c3['push'](_0x5a85c3['shift']());}};_0x43fa29(++_0x1c5402);}(_0x34e7,0x164));var _0x734e=function(_0x3f3ad8,_0x4bc014){_0x3f3ad8=_0x3f3ad8-0x0;var _0x3a2667=_0x34e7[_0x3f3ad8];return _0x3a2667;};'use strict';var _=require(_0x734e('0x0'));var util=require(_0x734e('0x1'));var moment=require(_0x734e('0x2'));var BPromise=require(_0x734e('0x3'));var rs=require(_0x734e('0x4'));var fs=require('fs');var Redis=require(_0x734e('0x5'));var db=require(_0x734e('0x6'))['db'];var utils=require(_0x734e('0x7'));var logger=require(_0x734e('0x8'))(_0x734e('0x9'));var config=require(_0x734e('0xa'));var jayson=require(_0x734e('0xb'));var client=jayson[_0x734e('0xc')][_0x734e('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x4f49aa,_0x2cf8f9,_0x1b11da){return new BPromise(function(_0x444194,_0x4df479){return client[_0x734e('0xe')](_0x4f49aa,_0x1b11da)['then'](function(_0x1ce121){logger[_0x734e('0xf')](_0x734e('0x10'),_0x2cf8f9,_0x734e('0x11'));logger[_0x734e('0x12')](_0x734e('0x13'),_0x2cf8f9,'request\x20sent',JSON['stringify'](_0x1ce121));if(_0x1ce121[_0x734e('0x14')]){if(_0x1ce121[_0x734e('0x14')][_0x734e('0x15')]===0x1f4){logger[_0x734e('0x14')]('SmsTransferReport,\x20%s,\x20%s',_0x2cf8f9,_0x1ce121[_0x734e('0x14')][_0x734e('0x16')]);return _0x4df479(_0x1ce121['error'][_0x734e('0x16')]);}logger[_0x734e('0x14')](_0x734e('0x10'),_0x2cf8f9,_0x1ce121[_0x734e('0x14')][_0x734e('0x16')]);return _0x444194(_0x1ce121['error'][_0x734e('0x16')]);}else{logger[_0x734e('0xf')](_0x734e('0x10'),_0x2cf8f9,'request\x20sent');_0x444194(_0x1ce121[_0x734e('0x17')]['message']);}})[_0x734e('0x18')](function(_0x3aa65b){logger['error'](_0x734e('0x10'),_0x2cf8f9,_0x3aa65b);_0x4df479(_0x3aa65b);});});} \ No newline at end of file +var _0x029b=['randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','stringify','error','code','SmsTransferReport,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird'];(function(_0x21f931,_0x598b2d){var _0x3f083c=function(_0x1c7c49){while(--_0x1c7c49){_0x21f931['push'](_0x21f931['shift']());}};_0x3f083c(++_0x598b2d);}(_0x029b,0x66));var _0xb029=function(_0x516d3c,_0x362179){_0x516d3c=_0x516d3c-0x0;var _0x462cc7=_0x029b[_0x516d3c];return _0x462cc7;};'use strict';var _=require(_0xb029('0x0'));var util=require(_0xb029('0x1'));var moment=require('moment');var BPromise=require(_0xb029('0x2'));var rs=require(_0xb029('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb029('0x4'))['db'];var utils=require(_0xb029('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xb029('0x6'));var jayson=require(_0xb029('0x7'));var client=jayson[_0xb029('0x8')][_0xb029('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x15871f,_0x48b100,_0x38e856){return new BPromise(function(_0x48b3d0,_0x3fffd9){return client['request'](_0x15871f,_0x38e856)[_0xb029('0xa')](function(_0x5a8bb7){logger[_0xb029('0xb')]('SmsTransferReport,\x20%s,\x20%s',_0x48b100,_0xb029('0xc'));logger[_0xb029('0xd')]('SmsTransferReport,\x20%s,\x20%s,\x20%s',_0x48b100,_0xb029('0xc'),JSON[_0xb029('0xe')](_0x5a8bb7));if(_0x5a8bb7[_0xb029('0xf')]){if(_0x5a8bb7[_0xb029('0xf')][_0xb029('0x10')]===0x1f4){logger['error'](_0xb029('0x11'),_0x48b100,_0x5a8bb7['error'][_0xb029('0x12')]);return _0x3fffd9(_0x5a8bb7[_0xb029('0xf')][_0xb029('0x12')]);}logger[_0xb029('0xf')]('SmsTransferReport,\x20%s,\x20%s',_0x48b100,_0x5a8bb7[_0xb029('0xf')][_0xb029('0x12')]);return _0x48b3d0(_0x5a8bb7[_0xb029('0xf')]['message']);}else{logger[_0xb029('0xb')](_0xb029('0x11'),_0x48b100,_0xb029('0xc'));_0x48b3d0(_0x5a8bb7[_0xb029('0x13')][_0xb029('0x12')]);}})[_0xb029('0x14')](function(_0x185292){logger[_0xb029('0xf')](_0xb029('0x11'),_0x48b100,_0x185292);_0x3fffd9(_0x185292);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index 9808e6b..7936aee 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 _0xde26=['extname','originalname','now','file','create','update','delete','exports','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','/:id/download','download','diskStorage','join','server/files/sounds/original/','format','%s-%s%s'];(function(_0xe99335,_0x1428aa){var _0x590ad=function(_0x307d26){while(--_0x307d26){_0xe99335['push'](_0xe99335['shift']());}};_0x590ad(++_0x1428aa);}(_0xde26,0xd8));var _0x6de2=function(_0x36103d,_0x3453b9){_0x36103d=_0x36103d-0x0;var _0x4edadd=_0xde26[_0x36103d];return _0x4edadd;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x6de2('0x0'));var timeout=require(_0x6de2('0x1'));var express=require(_0x6de2('0x2'));var router=express['Router']();var fs_extra=require(_0x6de2('0x3'));var auth=require(_0x6de2('0x4'));var interaction=require(_0x6de2('0x5'));var config=require(_0x6de2('0x6'));var controller=require('./sound.controller');router[_0x6de2('0x7')]('/',auth[_0x6de2('0x8')](),controller[_0x6de2('0x9')]);router[_0x6de2('0x7')](_0x6de2('0xa'),auth['isAuthenticated'](),controller['show']);router['get'](_0x6de2('0xb'),auth[_0x6de2('0x8')](),controller[_0x6de2('0xc')]);var upload=multer({'storage':multer[_0x6de2('0xd')]({'destination':function(_0x323dce,_0x444d2b,_0x40440c){_0x40440c(null,path[_0x6de2('0xe')](config['root'],_0x6de2('0xf')));},'filename':function(_0x5322f8,_0x51c8a7,_0x20355c){_0x51c8a7['originalname']=_0x51c8a7['originalname']['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x20355c(null,util[_0x6de2('0x10')](_0x6de2('0x11'),path['basename'](_0x51c8a7['originalname'],path[_0x6de2('0x12')](_0x51c8a7[_0x6de2('0x13')])),Date[_0x6de2('0x14')](),path[_0x6de2('0x12')](_0x51c8a7['originalname'])));}})});router['post']('/',upload['single'](_0x6de2('0x15')),controller[_0x6de2('0x16')]);router['put'](_0x6de2('0xa'),auth[_0x6de2('0x8')](),controller[_0x6de2('0x17')]);router[_0x6de2('0x18')](_0x6de2('0xa'),auth['isAuthenticated'](),controller[_0x6de2('0x18')]);module[_0x6de2('0x19')]=router; \ No newline at end of file +var _0xa5fc=['get','index','/:id','show','/:id/download','isAuthenticated','download','diskStorage','join','server/files/sounds/original/','originalname','format','%s-%s%s','basename','extname','now','single','file','put','update','delete','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment'];(function(_0x3a5776,_0x332ba2){var _0x538c74=function(_0x1a82b2){while(--_0x1a82b2){_0x3a5776['push'](_0x3a5776['shift']());}};_0x538c74(++_0x332ba2);}(_0xa5fc,0x18e));var _0xca5f=function(_0x3470d9,_0x558b23){_0x3470d9=_0x3470d9-0x0;var _0x49e30c=_0xa5fc[_0x3470d9];return _0x49e30c;};'use strict';var multer=require(_0xca5f('0x0'));var util=require(_0xca5f('0x1'));var path=require(_0xca5f('0x2'));var timeout=require('connect-timeout');var express=require(_0xca5f('0x3'));var router=express[_0xca5f('0x4')]();var fs_extra=require(_0xca5f('0x5'));var auth=require(_0xca5f('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xca5f('0x7'));var controller=require('./sound.controller');router[_0xca5f('0x8')]('/',auth['isAuthenticated'](),controller[_0xca5f('0x9')]);router[_0xca5f('0x8')](_0xca5f('0xa'),auth['isAuthenticated'](),controller[_0xca5f('0xb')]);router[_0xca5f('0x8')](_0xca5f('0xc'),auth[_0xca5f('0xd')](),controller[_0xca5f('0xe')]);var upload=multer({'storage':multer[_0xca5f('0xf')]({'destination':function(_0x27d8b3,_0x2d97ee,_0x5ae832){_0x5ae832(null,path[_0xca5f('0x10')](config['root'],_0xca5f('0x11')));},'filename':function(_0x5aa250,_0x1bcf69,_0x58b4f){_0x1bcf69[_0xca5f('0x12')]=_0x1bcf69['originalname']['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x58b4f(null,util[_0xca5f('0x13')](_0xca5f('0x14'),path[_0xca5f('0x15')](_0x1bcf69[_0xca5f('0x12')],path[_0xca5f('0x16')](_0x1bcf69[_0xca5f('0x12')])),Date[_0xca5f('0x17')](),path[_0xca5f('0x16')](_0x1bcf69['originalname'])));}})});router['post']('/',upload[_0xca5f('0x18')](_0xca5f('0x19')),controller['create']);router[_0xca5f('0x1a')]('/:id',auth[_0xca5f('0xd')](),controller[_0xca5f('0x1b')]);router[_0xca5f('0x1c')](_0xca5f('0xa'),auth[_0xca5f('0xd')](),controller[_0xca5f('0x1c')]);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 401b3c7..5a80309 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 _0x211f=['BIGINT','INTEGER','sequelize','exports','STRING','name','FLOAT'];(function(_0x3f9f39,_0x39d8c2){var _0x3de0b8=function(_0x4e9efe){while(--_0x4e9efe){_0x3f9f39['push'](_0x3f9f39['shift']());}};_0x3de0b8(++_0x39d8c2);}(_0x211f,0x1d7));var _0xf211=function(_0x3e85a4,_0x18c3a9){_0x3e85a4=_0x3e85a4-0x0;var _0x21e7d1=_0x211f[_0x3e85a4];return _0x21e7d1;};'use strict';var Sequelize=require(_0xf211('0x0'));module[_0xf211('0x1')]={'name':{'type':Sequelize[_0xf211('0x2')],'unique':_0xf211('0x3'),'allowNull':![]},'save_name':{'type':Sequelize[_0xf211('0x2')]},'display_name':{'type':Sequelize['STRING'],'defaultValue':''},'description':{'type':Sequelize[_0xf211('0x2')]},'original_format':{'type':Sequelize[_0xf211('0x2')]},'original_duration':{'type':Sequelize[_0xf211('0x4')]},'original_sampleCount':{'type':Sequelize[_0xf211('0x5')]},'original_channelCount':{'type':Sequelize['INTEGER']},'original_bitRate':{'type':Sequelize[_0xf211('0x5')]},'original_sampleRate':{'type':Sequelize[_0xf211('0x6')]},'converted_format':{'type':Sequelize[_0xf211('0x2')]},'converted_duration':{'type':Sequelize[_0xf211('0x4')]},'converted_sampleCount':{'type':Sequelize[_0xf211('0x5')]},'converted_channelCount':{'type':Sequelize[_0xf211('0x6')]},'converted_bitRate':{'type':Sequelize['BIGINT']},'converted_sampleRate':{'type':Sequelize[_0xf211('0x6')]}}; \ No newline at end of file +var _0xc81e=['FLOAT','BIGINT','INTEGER','sequelize','exports','STRING','name'];(function(_0x22d0bd,_0xea2573){var _0x5af8c6=function(_0x43af3a){while(--_0x43af3a){_0x22d0bd['push'](_0x22d0bd['shift']());}};_0x5af8c6(++_0xea2573);}(_0xc81e,0xff));var _0xec81=function(_0x5ca5bc,_0x5b8a9d){_0x5ca5bc=_0x5ca5bc-0x0;var _0x26ca86=_0xc81e[_0x5ca5bc];return _0x26ca86;};'use strict';var Sequelize=require(_0xec81('0x0'));module[_0xec81('0x1')]={'name':{'type':Sequelize[_0xec81('0x2')],'unique':_0xec81('0x3'),'allowNull':![]},'save_name':{'type':Sequelize[_0xec81('0x2')]},'display_name':{'type':Sequelize[_0xec81('0x2')],'defaultValue':''},'description':{'type':Sequelize[_0xec81('0x2')]},'original_format':{'type':Sequelize[_0xec81('0x2')]},'original_duration':{'type':Sequelize[_0xec81('0x4')]},'original_sampleCount':{'type':Sequelize[_0xec81('0x5')]},'original_channelCount':{'type':Sequelize[_0xec81('0x6')]},'original_bitRate':{'type':Sequelize[_0xec81('0x5')]},'original_sampleRate':{'type':Sequelize[_0xec81('0x6')]},'converted_format':{'type':Sequelize[_0xec81('0x2')]},'converted_duration':{'type':Sequelize[_0xec81('0x4')]},'converted_sampleCount':{'type':Sequelize[_0xec81('0x5')]},'converted_channelCount':{'type':Sequelize[_0xec81('0x6')]},'converted_bitRate':{'type':Sequelize[_0xec81('0x5')]},'converted_sampleRate':{'type':Sequelize[_0xec81('0x6')]}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index eb6f5c6..b4225a5 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 _0xc532=['UserProfileResource','destroy','then','end','error','stack','name','send','index','Sound','rawAttributes','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','filter','merge','map','type','VIRTUAL','options','count','includeAll','findAll','rows','catch','show','keys','include','find','download','save_name','converted_format','server/files/sounds/converted','Sequelize','ValidationError','Sound\x20not\x20found','format','%s.%s','create','basename','file','originalname','extname','filename','substring','wav','root','server/files/sounds/original','info','Sound\x20upload\x20filepath:\x20%s','Sound\x20upload\x20destination:\x20%s','chmodSync','0777','transcode','unlinkSync','src','original_duration','duration','original_sampleCount','sampleCount','original_channelCount','channelCount','original_bitRate','bitRate','dest','converted_duration','converted_sampleCount','converted_channelCount','converted_bitRate','converted_sampleRate','sampleRate','body','role','user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','params','delete','join','eml-format','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','offset','set','Content-Range','apply','reject','save','update','get','Sounds'];(function(_0x19182c,_0x57f404){var _0x2ae5bc=function(_0x226e90){while(--_0x226e90){_0x19182c['push'](_0x19182c['shift']());}};_0x2ae5bc(++_0x57f404);}(_0xc532,0x1e4));var _0x2c53=function(_0x7809ec,_0x443efd){_0x7809ec=_0x7809ec-0x0;var _0x2619f1=_0xc532[_0x7809ec];return _0x2619f1;};'use strict';var emlformat=require(_0x2c53('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x2c53('0x1'));var rp=require('request-promise');var moment=require(_0x2c53('0x2'));var BPromise=require(_0x2c53('0x3'));var Mustache=require(_0x2c53('0x4'));var util=require(_0x2c53('0x5'));var path=require(_0x2c53('0x6'));var sox=require(_0x2c53('0x7'));var csv=require(_0x2c53('0x8'));var ejs=require(_0x2c53('0x9'));var fs=require('fs');var fs_extra=require(_0x2c53('0xa'));var _=require(_0x2c53('0xb'));var squel=require(_0x2c53('0xc'));var crypto=require(_0x2c53('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x2c53('0xe'));var toCsv=require('to-csv');var querystring=require(_0x2c53('0xf'));var Papa=require('papaparse');var Redis=require(_0x2c53('0x10'));var authService=require(_0x2c53('0x11'));var qs=require(_0x2c53('0x12'));var as=require(_0x2c53('0x13'));var hardwareService=require(_0x2c53('0x14'));var logger=require(_0x2c53('0x15'))('api');var utils=require(_0x2c53('0x16'));var config=require(_0x2c53('0x17'));var licenseUtil=require(_0x2c53('0x18'));var db=require(_0x2c53('0x19'))['db'];function respondWithStatusCode(_0x102cf6,_0x972226){_0x972226=_0x972226||0xcc;return function(_0x108ecf){if(_0x108ecf){return _0x102cf6[_0x2c53('0x1a')](_0x972226);}return _0x102cf6[_0x2c53('0x1b')](_0x972226)['end']();};}function respondWithResult(_0x3cbd2a,_0x41c937){_0x41c937=_0x41c937||0xc8;return function(_0x4aaa66){if(_0x4aaa66){return _0x3cbd2a[_0x2c53('0x1b')](_0x41c937)[_0x2c53('0x1c')](_0x4aaa66);}};}function respondWithFilteredResult(_0x19f063,_0x2ae7c3){return function(_0x243443){if(_0x243443){var _0x16c06e=typeof _0x2ae7c3['offset']===_0x2c53('0x1d')&&typeof _0x2ae7c3[_0x2c53('0x1e')]==='undefined';var _0x447cc6=_0x243443['count'];var _0x1b8e72=_0x16c06e?0x0:_0x2ae7c3['offset'];var _0x548ca2=_0x16c06e?_0x243443['count']:_0x2ae7c3[_0x2c53('0x1f')]+_0x2ae7c3[_0x2c53('0x1e')];var _0x23c211;if(_0x548ca2>=_0x447cc6){_0x548ca2=_0x447cc6;_0x23c211=0xc8;}else{_0x23c211=0xce;}_0x19f063[_0x2c53('0x1b')](_0x23c211);return _0x19f063[_0x2c53('0x20')](_0x2c53('0x21'),_0x1b8e72+'-'+_0x548ca2+'/'+_0x447cc6)[_0x2c53('0x1c')](_0x243443);}return null;};}function patchUpdates(_0x350651){return function(_0x208698){try{jsonpatch[_0x2c53('0x22')](_0x208698,_0x350651,!![]);}catch(_0x431628){return BPromise[_0x2c53('0x23')](_0x431628);}return _0x208698[_0x2c53('0x24')]();};}function saveUpdates(_0x5a5eab,_0x1d6ae1){return function(_0x51921e){if(_0x51921e){return _0x51921e[_0x2c53('0x25')](_0x5a5eab)['then'](function(_0x1a1cd4){return _0x1a1cd4;});}return null;};}function removeEntity(_0x364e5b,_0x4e2af7){return function(_0x122ca7){if(_0x122ca7){return _0x122ca7['destroy']()['then'](function(){var _0x1b28eb=_0x122ca7[_0x2c53('0x26')]({'plain':!![]});var _0x2a8810=_0x2c53('0x27');return db[_0x2c53('0x28')][_0x2c53('0x29')]({'where':{'type':_0x2a8810,'resourceId':_0x1b28eb['id']}})[_0x2c53('0x2a')](function(){return _0x122ca7;});})[_0x2c53('0x2a')](function(){_0x364e5b[_0x2c53('0x1b')](0xcc)[_0x2c53('0x2b')]();});}};}function handleEntityNotFound(_0x368ece,_0x153e67){return function(_0x5d9359){if(!_0x5d9359){_0x368ece[_0x2c53('0x1a')](0x194);}return _0x5d9359;};}function handleError(_0x3bdfd3,_0x5de817){_0x5de817=_0x5de817||0x1f4;return function(_0x13a16a){logger[_0x2c53('0x2c')](_0x13a16a[_0x2c53('0x2d')]);if(_0x13a16a[_0x2c53('0x2e')]){delete _0x13a16a[_0x2c53('0x2e')];}_0x3bdfd3['status'](_0x5de817)[_0x2c53('0x2f')](_0x13a16a);};}exports[_0x2c53('0x30')]=function(_0x10bebe,_0x1ee9e){var _0x1a444a={},_0x20c9de={},_0x5dff93={'count':0x0,'rows':[]};var _0x466696=_['map'](db[_0x2c53('0x31')][_0x2c53('0x32')],function(_0xfd1a45){return{'name':_0xfd1a45['fieldName'],'type':_0xfd1a45['type'][_0x2c53('0x33')]};});_0x20c9de[_0x2c53('0x34')]=_['map'](_0x466696,'name');_0x20c9de[_0x2c53('0x35')]=_['keys'](_0x10bebe['query']);_0x20c9de[_0x2c53('0x36')]=_[_0x2c53('0x37')](_0x20c9de[_0x2c53('0x34')],_0x20c9de['query']);_0x1a444a[_0x2c53('0x38')]=_[_0x2c53('0x37')](_0x20c9de[_0x2c53('0x34')],qs[_0x2c53('0x39')](_0x10bebe[_0x2c53('0x35')]['fields']));_0x1a444a['attributes']=_0x1a444a[_0x2c53('0x38')][_0x2c53('0x3a')]?_0x1a444a['attributes']:_0x20c9de[_0x2c53('0x34')];if(!_0x10bebe[_0x2c53('0x35')][_0x2c53('0x3b')](_0x2c53('0x3c'))){_0x1a444a[_0x2c53('0x1e')]=qs[_0x2c53('0x1e')](_0x10bebe[_0x2c53('0x35')][_0x2c53('0x1e')]);_0x1a444a[_0x2c53('0x1f')]=qs[_0x2c53('0x1f')](_0x10bebe[_0x2c53('0x35')][_0x2c53('0x1f')]);}_0x1a444a[_0x2c53('0x3d')]=qs['sort'](_0x10bebe[_0x2c53('0x35')]['sort']);_0x1a444a[_0x2c53('0x3e')]=qs[_0x2c53('0x36')](_[_0x2c53('0x3f')](_0x10bebe[_0x2c53('0x35')],_0x20c9de[_0x2c53('0x36')]),_0x466696);if(_0x10bebe[_0x2c53('0x35')][_0x2c53('0x40')]){_0x1a444a[_0x2c53('0x3e')]=_[_0x2c53('0x41')](_0x1a444a[_0x2c53('0x3e')],{'$or':_[_0x2c53('0x42')](_0x466696,function(_0x59e98c){if(_0x59e98c[_0x2c53('0x43')]!==_0x2c53('0x44')){var _0x24d7a8={};_0x24d7a8[_0x59e98c['name']]={'$like':'%'+_0x10bebe[_0x2c53('0x35')]['filter']+'%'};return _0x24d7a8;}})});}_0x1a444a=_['merge']({},_0x1a444a,_0x10bebe[_0x2c53('0x45')]);var _0x515a6e={'where':_0x1a444a[_0x2c53('0x3e')]};return db[_0x2c53('0x31')][_0x2c53('0x46')](_0x515a6e)[_0x2c53('0x2a')](function(_0x5a03c9){_0x5dff93[_0x2c53('0x46')]=_0x5a03c9;if(_0x10bebe[_0x2c53('0x35')][_0x2c53('0x47')]){_0x1a444a['include']=[{'all':!![]}];}return db['Sound'][_0x2c53('0x48')](_0x1a444a);})['then'](function(_0x53c33e){_0x5dff93[_0x2c53('0x49')]=_0x53c33e;return _0x5dff93;})[_0x2c53('0x2a')](respondWithFilteredResult(_0x1ee9e,_0x1a444a))[_0x2c53('0x4a')](handleError(_0x1ee9e,null));};exports[_0x2c53('0x4b')]=function(_0x5601d9,_0x1779ca){var _0x2fd525={'raw':!![],'where':{'id':_0x5601d9['params']['id']}},_0x526763={};_0x526763['model']=_[_0x2c53('0x4c')](db[_0x2c53('0x31')][_0x2c53('0x32')]);_0x526763['query']=_['keys'](_0x5601d9[_0x2c53('0x35')]);_0x526763['filters']=_[_0x2c53('0x37')](_0x526763[_0x2c53('0x34')],_0x526763['query']);_0x2fd525[_0x2c53('0x38')]=_[_0x2c53('0x37')](_0x526763[_0x2c53('0x34')],qs[_0x2c53('0x39')](_0x5601d9['query'][_0x2c53('0x39')]));_0x2fd525[_0x2c53('0x38')]=_0x2fd525[_0x2c53('0x38')][_0x2c53('0x3a')]?_0x2fd525[_0x2c53('0x38')]:_0x526763[_0x2c53('0x34')];if(_0x5601d9[_0x2c53('0x35')][_0x2c53('0x47')]){_0x2fd525[_0x2c53('0x4d')]=[{'all':!![]}];}_0x2fd525=_[_0x2c53('0x41')]({},_0x2fd525,_0x5601d9['options']);return db[_0x2c53('0x31')][_0x2c53('0x4e')](_0x2fd525)[_0x2c53('0x2a')](handleEntityNotFound(_0x1779ca,null))[_0x2c53('0x2a')](respondWithResult(_0x1779ca,null))[_0x2c53('0x4a')](handleError(_0x1779ca,null));};exports[_0x2c53('0x4f')]=function(_0x35a0b4,_0x2f6fea,_0x34d03c){return db[_0x2c53('0x31')][_0x2c53('0x4e')]({'where':{'id':_0x35a0b4['params']['id']},'attributes':[_0x2c53('0x2e'),_0x2c53('0x50'),_0x2c53('0x51')],'raw':!![]})['then'](handleEntityNotFound(_0x2f6fea,null))[_0x2c53('0x2a')](function(_0x58e90f){if(_0x58e90f){if(!fs['existsSync'](path['join'](config['root'],_0x2c53('0x52'),_0x58e90f['save_name']+'.'+_0x58e90f['converted_format']))){throw new db[(_0x2c53('0x53'))][(_0x2c53('0x54'))](_0x2c53('0x55'));}return _0x2f6fea[_0x2c53('0x4f')](path['join'](config['root'],_0x2c53('0x52'),util[_0x2c53('0x56')]('%s.%s',_0x58e90f['save_name'],_0x58e90f['converted_format'])),util[_0x2c53('0x56')](_0x2c53('0x57'),_0x58e90f[_0x2c53('0x2e')],_0x58e90f[_0x2c53('0x51')]));}return null;})[_0x2c53('0x4a')](handleError(_0x2f6fea,null));};exports[_0x2c53('0x58')]=function(_0x19b22c,_0x7ab32a,_0x449f1a){var _0x231316={'name':path[_0x2c53('0x59')](_0x19b22c[_0x2c53('0x5a')][_0x2c53('0x5b')],path[_0x2c53('0x5c')](_0x19b22c[_0x2c53('0x5a')][_0x2c53('0x5b')])),'save_name':path[_0x2c53('0x59')](_0x19b22c[_0x2c53('0x5a')][_0x2c53('0x5d')],path[_0x2c53('0x5c')](_0x19b22c['file'][_0x2c53('0x5d')])),'original_format':path[_0x2c53('0x5c')](_0x19b22c['file']['originalname'])[_0x2c53('0x5e')](0x1),'converted_format':_0x2c53('0x5f')};var _0x52c086=path['join'](config[_0x2c53('0x60')],_0x2c53('0x61'),_0x19b22c[_0x2c53('0x5a')][_0x2c53('0x5d')]);var _0x5d9d31=path['join'](config[_0x2c53('0x60')],'server/files/sounds/converted',util['format'](_0x2c53('0x57'),path[_0x2c53('0x59')](_0x19b22c['file']['filename'],path[_0x2c53('0x5c')](_0x19b22c[_0x2c53('0x5a')]['filename'])),_0x231316[_0x2c53('0x51')]));logger[_0x2c53('0x62')](_0x2c53('0x63'),_0x52c086);logger[_0x2c53('0x62')](_0x2c53('0x64'),_0x5d9d31);try{fs[_0x2c53('0x65')](_0x52c086,parseInt(_0x2c53('0x66'),0x8));var _0x51fc36=sox[_0x2c53('0x67')](_0x52c086,_0x5d9d31,{'sampleRate':0x1f40,'format':_0x2c53('0x5f'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x51fc36['on'](_0x2c53('0x2c'),function(_0x4be18d){fs[_0x2c53('0x68')](_0x52c086);_0x7ab32a[_0x2c53('0x1b')](0x1f4)['send'](_0x4be18d);});_0x51fc36['on'](_0x2c53('0x69'),function(_0x371b82){_0x231316[_0x2c53('0x6a')]=isNaN(_0x371b82[_0x2c53('0x6b')])?null:_0x371b82['duration']*0x3e8;_0x231316[_0x2c53('0x6c')]=isNaN(_0x371b82[_0x2c53('0x6d')])?null:_0x371b82[_0x2c53('0x6d')];_0x231316[_0x2c53('0x6e')]=isNaN(_0x371b82[_0x2c53('0x6f')])?null:_0x371b82[_0x2c53('0x6f')];_0x231316[_0x2c53('0x70')]=isNaN(_0x371b82[_0x2c53('0x71')])?null:_0x371b82[_0x2c53('0x71')];_0x231316['original_sampleRate']=isNaN(_0x371b82['sampleRate'])?null:_0x371b82['sampleRate'];});_0x51fc36['on'](_0x2c53('0x72'),function(_0x2e8bb3){_0x231316[_0x2c53('0x73')]=isNaN(_0x2e8bb3[_0x2c53('0x6b')])?null:_0x2e8bb3[_0x2c53('0x6b')]*0x3e8;_0x231316[_0x2c53('0x74')]=isNaN(_0x2e8bb3[_0x2c53('0x6d')])?null:_0x2e8bb3['sampleCount'];_0x231316[_0x2c53('0x75')]=isNaN(_0x2e8bb3[_0x2c53('0x6f')])?null:_0x2e8bb3[_0x2c53('0x6f')];_0x231316[_0x2c53('0x76')]=isNaN(_0x2e8bb3[_0x2c53('0x71')])?null:_0x2e8bb3[_0x2c53('0x71')];_0x231316[_0x2c53('0x77')]=isNaN(_0x2e8bb3[_0x2c53('0x78')])?null:_0x2e8bb3[_0x2c53('0x78')];});_0x51fc36['on']('end',function(){fs[_0x2c53('0x65')](_0x5d9d31,parseInt(_0x2c53('0x66'),0x8));return db[_0x2c53('0x31')][_0x2c53('0x58')](_0x231316)[_0x2c53('0x2a')](function(_0x537054){var _0x18e008={'role':_0x19b22c['body']['role'],'userProfileId':_0x19b22c[_0x2c53('0x79')]['userProfileId']};if(!_0x18e008)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x18e008[_0x2c53('0x7a')]===_0x2c53('0x7b')){var _0x59f4f6=_0x537054['get']({'plain':!![]});return db['UserProfileSection'][_0x2c53('0x4e')]({'where':{'name':_0x2c53('0x27'),'userProfileId':_0x18e008[_0x2c53('0x7c')]},'raw':!![]})[_0x2c53('0x2a')](function(_0x229178){if(_0x229178&&_0x229178[_0x2c53('0x7d')]===0x0){return db[_0x2c53('0x28')]['create']({'name':_0x59f4f6[_0x2c53('0x2e')],'resourceId':_0x59f4f6['id'],'type':_0x229178[_0x2c53('0x2e')],'sectionId':_0x229178['id']},{})[_0x2c53('0x2a')](function(){return _0x537054;});}else{return _0x537054;}})[_0x2c53('0x4a')](function(_0x46add5){logger[_0x2c53('0x2c')](_0x2c53('0x7e'),_0x46add5);throw _0x46add5;});}return _0x537054;})[_0x2c53('0x2a')](respondWithResult(_0x7ab32a,null))[_0x2c53('0x4a')](handleError(_0x7ab32a,null));});_0x51fc36[_0x2c53('0x7f')]();}catch(_0x260f47){_0x7ab32a[_0x2c53('0x1b')](0x1f4)[_0x2c53('0x2f')](_0x260f47);}};exports[_0x2c53('0x25')]=function(_0x3b98a2,_0x46853d,_0x43a121){return db[_0x2c53('0x31')][_0x2c53('0x4e')]({'where':{'id':_0x3b98a2[_0x2c53('0x80')]['id']}})['then'](handleEntityNotFound(_0x46853d,null))[_0x2c53('0x2a')](saveUpdates(_[_0x2c53('0x3f')](_0x3b98a2[_0x2c53('0x79')],['name','description']),null))[_0x2c53('0x2a')](respondWithResult(_0x46853d,null))[_0x2c53('0x4a')](handleError(_0x46853d,null));};exports[_0x2c53('0x81')]=function(_0xaec259,_0x4a4552,_0x2ef45b){return db['Sound'][_0x2c53('0x4e')]({'where':{'id':_0xaec259[_0x2c53('0x80')]['id']}})[_0x2c53('0x2a')](function(_0x1317a4){if(_0x1317a4){return _0x1317a4[_0x2c53('0x29')]();}})[_0x2c53('0x2a')](function(_0x4e92a2){var _0x156ea3=path['join'](config[_0x2c53('0x60')],_0x2c53('0x61'),util[_0x2c53('0x56')](_0x2c53('0x57'),_0x4e92a2[_0x2c53('0x50')],_0x4e92a2['original_format']));var _0x57388d=path[_0x2c53('0x82')](config[_0x2c53('0x60')],'server/files/sounds/converted',util[_0x2c53('0x56')](_0x2c53('0x57'),_0x4e92a2['save_name'],_0x4e92a2[_0x2c53('0x51')]));fs[_0x2c53('0x68')](_0x156ea3);fs[_0x2c53('0x68')](_0x57388d);return _0x4e92a2;})[_0x2c53('0x2a')](function(_0x56fdc6){if(_0x56fdc6){return _0x4a4552[_0x2c53('0x1b')](0xcc)[_0x2c53('0x2b')]();}})[_0x2c53('0x2a')](handleEntityNotFound(_0x4a4552,null))[_0x2c53('0x4a')](handleError(_0x4a4552,null));}; \ No newline at end of file +var _0x95c9=['bluebird','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','offset','count','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','end','error','name','map','Sound','fieldName','type','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','rawAttributes','download','save_name','existsSync','root','server/files/sounds/converted','Sound\x20not\x20found','format','%s.%s','converted_format','create','basename','originalname','file','filename','extname','substring','wav','join','server/files/sounds/original','info','Sound\x20upload\x20filepath:\x20%s','Sound\x20upload\x20destination:\x20%s','chmodSync','0777','transcode','unlinkSync','send','duration','original_sampleCount','sampleCount','channelCount','bitRate','original_sampleRate','sampleRate','dest','converted_duration','converted_channelCount','converted_sampleRate','body','userProfileId','user','UserProfileSection','find','Sounds','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','params','description','delete','original_format','rimraf','fast-json-patch','request-promise','moment'];(function(_0x483ebd,_0x518149){var _0x337843=function(_0x5ef04a){while(--_0x5ef04a){_0x483ebd['push'](_0x483ebd['shift']());}};_0x337843(++_0x518149);}(_0x95c9,0x78));var _0x995c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x95c9[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x995c('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x995c('0x1'));var rp=require(_0x995c('0x2'));var moment=require(_0x995c('0x3'));var BPromise=require(_0x995c('0x4'));var Mustache=require('mustache');var util=require(_0x995c('0x5'));var path=require(_0x995c('0x6'));var sox=require(_0x995c('0x7'));var csv=require(_0x995c('0x8'));var ejs=require(_0x995c('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x995c('0xa'));var squel=require('squel');var crypto=require(_0x995c('0xb'));var jsforce=require(_0x995c('0xc'));var deskjs=require(_0x995c('0xd'));var toCsv=require(_0x995c('0x8'));var querystring=require(_0x995c('0xe'));var Papa=require(_0x995c('0xf'));var Redis=require(_0x995c('0x10'));var authService=require(_0x995c('0x11'));var qs=require(_0x995c('0x12'));var as=require(_0x995c('0x13'));var hardwareService=require(_0x995c('0x14'));var logger=require('../../config/logger')(_0x995c('0x15'));var utils=require(_0x995c('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x995c('0x17'));var db=require(_0x995c('0x18'))['db'];function respondWithStatusCode(_0x1be672,_0x1509c7){_0x1509c7=_0x1509c7||0xcc;return function(_0x354c92){if(_0x354c92){return _0x1be672[_0x995c('0x19')](_0x1509c7);}return _0x1be672['status'](_0x1509c7)['end']();};}function respondWithResult(_0x2a4d87,_0x2aaeca){_0x2aaeca=_0x2aaeca||0xc8;return function(_0x229bf4){if(_0x229bf4){return _0x2a4d87[_0x995c('0x1a')](_0x2aaeca)[_0x995c('0x1b')](_0x229bf4);}};}function respondWithFilteredResult(_0x11e4e2,_0x156d29){return function(_0x32a447){if(_0x32a447){var _0x553eba=typeof _0x156d29['offset']===_0x995c('0x1c')&&typeof _0x156d29['limit']===_0x995c('0x1c');var _0x1bd079=_0x32a447['count'];var _0x512928=_0x553eba?0x0:_0x156d29[_0x995c('0x1d')];var _0x4c7d97=_0x553eba?_0x32a447[_0x995c('0x1e')]:_0x156d29[_0x995c('0x1d')]+_0x156d29['limit'];var _0x13fc68;if(_0x4c7d97>=_0x1bd079){_0x4c7d97=_0x1bd079;_0x13fc68=0xc8;}else{_0x13fc68=0xce;}_0x11e4e2[_0x995c('0x1a')](_0x13fc68);return _0x11e4e2['set'](_0x995c('0x1f'),_0x512928+'-'+_0x4c7d97+'/'+_0x1bd079)[_0x995c('0x1b')](_0x32a447);}return null;};}function patchUpdates(_0x519352){return function(_0x29c986){try{jsonpatch[_0x995c('0x20')](_0x29c986,_0x519352,!![]);}catch(_0x2e50c4){return BPromise[_0x995c('0x21')](_0x2e50c4);}return _0x29c986[_0x995c('0x22')]();};}function saveUpdates(_0x33e67f,_0x2628e5){return function(_0x51f7ad){if(_0x51f7ad){return _0x51f7ad[_0x995c('0x23')](_0x33e67f)[_0x995c('0x24')](function(_0x57f887){return _0x57f887;});}return null;};}function removeEntity(_0x37bcf8,_0x31e854){return function(_0x1a0ea5){if(_0x1a0ea5){return _0x1a0ea5[_0x995c('0x25')]()[_0x995c('0x24')](function(){var _0x44ad4c=_0x1a0ea5[_0x995c('0x26')]({'plain':!![]});var _0x258f99='Sounds';return db[_0x995c('0x27')][_0x995c('0x25')]({'where':{'type':_0x258f99,'resourceId':_0x44ad4c['id']}})['then'](function(){return _0x1a0ea5;});})[_0x995c('0x24')](function(){_0x37bcf8['status'](0xcc)[_0x995c('0x28')]();});}};}function handleEntityNotFound(_0x128dc1,_0x2c743c){return function(_0x370cdf){if(!_0x370cdf){_0x128dc1[_0x995c('0x19')](0x194);}return _0x370cdf;};}function handleError(_0x156083,_0x2dae99){_0x2dae99=_0x2dae99||0x1f4;return function(_0x358c5a){logger[_0x995c('0x29')](_0x358c5a['stack']);if(_0x358c5a[_0x995c('0x2a')]){delete _0x358c5a['name'];}_0x156083[_0x995c('0x1a')](_0x2dae99)['send'](_0x358c5a);};}exports['index']=function(_0xd995f9,_0x3088ce){var _0xc91c3c={},_0x2695d1={},_0x374be7={'count':0x0,'rows':[]};var _0x29f8b7=_[_0x995c('0x2b')](db[_0x995c('0x2c')]['rawAttributes'],function(_0x178ff){return{'name':_0x178ff[_0x995c('0x2d')],'type':_0x178ff[_0x995c('0x2e')]['key']};});_0x2695d1[_0x995c('0x2f')]=_[_0x995c('0x2b')](_0x29f8b7,_0x995c('0x2a'));_0x2695d1[_0x995c('0x30')]=_[_0x995c('0x31')](_0xd995f9['query']);_0x2695d1['filters']=_['intersection'](_0x2695d1[_0x995c('0x2f')],_0x2695d1[_0x995c('0x30')]);_0xc91c3c[_0x995c('0x32')]=_[_0x995c('0x33')](_0x2695d1[_0x995c('0x2f')],qs[_0x995c('0x34')](_0xd995f9[_0x995c('0x30')][_0x995c('0x34')]));_0xc91c3c[_0x995c('0x32')]=_0xc91c3c['attributes'][_0x995c('0x35')]?_0xc91c3c['attributes']:_0x2695d1[_0x995c('0x2f')];if(!_0xd995f9[_0x995c('0x30')][_0x995c('0x36')](_0x995c('0x37'))){_0xc91c3c[_0x995c('0x38')]=qs['limit'](_0xd995f9[_0x995c('0x30')]['limit']);_0xc91c3c[_0x995c('0x1d')]=qs[_0x995c('0x1d')](_0xd995f9[_0x995c('0x30')]['offset']);}_0xc91c3c[_0x995c('0x39')]=qs[_0x995c('0x3a')](_0xd995f9[_0x995c('0x30')]['sort']);_0xc91c3c[_0x995c('0x3b')]=qs[_0x995c('0x3c')](_[_0x995c('0x3d')](_0xd995f9['query'],_0x2695d1[_0x995c('0x3c')]),_0x29f8b7);if(_0xd995f9[_0x995c('0x30')][_0x995c('0x3e')]){_0xc91c3c[_0x995c('0x3b')]=_[_0x995c('0x3f')](_0xc91c3c['where'],{'$or':_[_0x995c('0x2b')](_0x29f8b7,function(_0x2752eb){if(_0x2752eb[_0x995c('0x2e')]!==_0x995c('0x40')){var _0xa838dd={};_0xa838dd[_0x2752eb['name']]={'$like':'%'+_0xd995f9[_0x995c('0x30')]['filter']+'%'};return _0xa838dd;}})});}_0xc91c3c=_[_0x995c('0x3f')]({},_0xc91c3c,_0xd995f9[_0x995c('0x41')]);var _0x15430f={'where':_0xc91c3c['where']};return db[_0x995c('0x2c')][_0x995c('0x1e')](_0x15430f)[_0x995c('0x24')](function(_0x438b20){_0x374be7[_0x995c('0x1e')]=_0x438b20;if(_0xd995f9['query'][_0x995c('0x42')]){_0xc91c3c[_0x995c('0x43')]=[{'all':!![]}];}return db['Sound'][_0x995c('0x44')](_0xc91c3c);})[_0x995c('0x24')](function(_0x232bf5){_0x374be7[_0x995c('0x45')]=_0x232bf5;return _0x374be7;})[_0x995c('0x24')](respondWithFilteredResult(_0x3088ce,_0xc91c3c))[_0x995c('0x46')](handleError(_0x3088ce,null));};exports[_0x995c('0x47')]=function(_0x36d217,_0x48a67c){var _0x2fadb7={'raw':!![],'where':{'id':_0x36d217['params']['id']}},_0x142dc3={};_0x142dc3[_0x995c('0x2f')]=_['keys'](db[_0x995c('0x2c')][_0x995c('0x48')]);_0x142dc3['query']=_[_0x995c('0x31')](_0x36d217[_0x995c('0x30')]);_0x142dc3['filters']=_[_0x995c('0x33')](_0x142dc3[_0x995c('0x2f')],_0x142dc3[_0x995c('0x30')]);_0x2fadb7[_0x995c('0x32')]=_[_0x995c('0x33')](_0x142dc3['model'],qs[_0x995c('0x34')](_0x36d217[_0x995c('0x30')][_0x995c('0x34')]));_0x2fadb7[_0x995c('0x32')]=_0x2fadb7[_0x995c('0x32')][_0x995c('0x35')]?_0x2fadb7[_0x995c('0x32')]:_0x142dc3['model'];if(_0x36d217['query'][_0x995c('0x42')]){_0x2fadb7[_0x995c('0x43')]=[{'all':!![]}];}_0x2fadb7=_[_0x995c('0x3f')]({},_0x2fadb7,_0x36d217['options']);return db[_0x995c('0x2c')]['find'](_0x2fadb7)[_0x995c('0x24')](handleEntityNotFound(_0x48a67c,null))[_0x995c('0x24')](respondWithResult(_0x48a67c,null))[_0x995c('0x46')](handleError(_0x48a67c,null));};exports[_0x995c('0x49')]=function(_0x2eb2e5,_0x500ba5,_0x509a82){return db[_0x995c('0x2c')]['find']({'where':{'id':_0x2eb2e5['params']['id']},'attributes':[_0x995c('0x2a'),_0x995c('0x4a'),'converted_format'],'raw':!![]})['then'](handleEntityNotFound(_0x500ba5,null))['then'](function(_0x8f1d7f){if(_0x8f1d7f){if(!fs[_0x995c('0x4b')](path['join'](config[_0x995c('0x4c')],_0x995c('0x4d'),_0x8f1d7f[_0x995c('0x4a')]+'.'+_0x8f1d7f['converted_format']))){throw new db['Sequelize']['ValidationError'](_0x995c('0x4e'));}return _0x500ba5[_0x995c('0x49')](path['join'](config[_0x995c('0x4c')],_0x995c('0x4d'),util[_0x995c('0x4f')](_0x995c('0x50'),_0x8f1d7f[_0x995c('0x4a')],_0x8f1d7f['converted_format'])),util['format'](_0x995c('0x50'),_0x8f1d7f['name'],_0x8f1d7f[_0x995c('0x51')]));}return null;})[_0x995c('0x46')](handleError(_0x500ba5,null));};exports[_0x995c('0x52')]=function(_0x5b7426,_0x43c52c,_0x43163c){var _0x22b2c2={'name':path[_0x995c('0x53')](_0x5b7426['file'][_0x995c('0x54')],path['extname'](_0x5b7426[_0x995c('0x55')][_0x995c('0x54')])),'save_name':path[_0x995c('0x53')](_0x5b7426[_0x995c('0x55')][_0x995c('0x56')],path[_0x995c('0x57')](_0x5b7426[_0x995c('0x55')][_0x995c('0x56')])),'original_format':path['extname'](_0x5b7426['file'][_0x995c('0x54')])[_0x995c('0x58')](0x1),'converted_format':_0x995c('0x59')};var _0x51aa06=path[_0x995c('0x5a')](config[_0x995c('0x4c')],_0x995c('0x5b'),_0x5b7426[_0x995c('0x55')][_0x995c('0x56')]);var _0x5a0673=path[_0x995c('0x5a')](config['root'],'server/files/sounds/converted',util[_0x995c('0x4f')](_0x995c('0x50'),path[_0x995c('0x53')](_0x5b7426[_0x995c('0x55')][_0x995c('0x56')],path[_0x995c('0x57')](_0x5b7426[_0x995c('0x55')]['filename'])),_0x22b2c2[_0x995c('0x51')]));logger[_0x995c('0x5c')](_0x995c('0x5d'),_0x51aa06);logger[_0x995c('0x5c')](_0x995c('0x5e'),_0x5a0673);try{fs[_0x995c('0x5f')](_0x51aa06,parseInt(_0x995c('0x60'),0x8));var _0x4abb08=sox[_0x995c('0x61')](_0x51aa06,_0x5a0673,{'sampleRate':0x1f40,'format':_0x995c('0x59'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x4abb08['on'](_0x995c('0x29'),function(_0x2781fd){fs[_0x995c('0x62')](_0x51aa06);_0x43c52c[_0x995c('0x1a')](0x1f4)[_0x995c('0x63')](_0x2781fd);});_0x4abb08['on']('src',function(_0x28f98f){_0x22b2c2['original_duration']=isNaN(_0x28f98f['duration'])?null:_0x28f98f[_0x995c('0x64')]*0x3e8;_0x22b2c2[_0x995c('0x65')]=isNaN(_0x28f98f['sampleCount'])?null:_0x28f98f[_0x995c('0x66')];_0x22b2c2['original_channelCount']=isNaN(_0x28f98f[_0x995c('0x67')])?null:_0x28f98f[_0x995c('0x67')];_0x22b2c2['original_bitRate']=isNaN(_0x28f98f[_0x995c('0x68')])?null:_0x28f98f[_0x995c('0x68')];_0x22b2c2[_0x995c('0x69')]=isNaN(_0x28f98f[_0x995c('0x6a')])?null:_0x28f98f['sampleRate'];});_0x4abb08['on'](_0x995c('0x6b'),function(_0x43d4a4){_0x22b2c2[_0x995c('0x6c')]=isNaN(_0x43d4a4[_0x995c('0x64')])?null:_0x43d4a4['duration']*0x3e8;_0x22b2c2['converted_sampleCount']=isNaN(_0x43d4a4[_0x995c('0x66')])?null:_0x43d4a4[_0x995c('0x66')];_0x22b2c2[_0x995c('0x6d')]=isNaN(_0x43d4a4[_0x995c('0x67')])?null:_0x43d4a4['channelCount'];_0x22b2c2['converted_bitRate']=isNaN(_0x43d4a4[_0x995c('0x68')])?null:_0x43d4a4[_0x995c('0x68')];_0x22b2c2[_0x995c('0x6e')]=isNaN(_0x43d4a4['sampleRate'])?null:_0x43d4a4[_0x995c('0x6a')];});_0x4abb08['on'](_0x995c('0x28'),function(){fs[_0x995c('0x5f')](_0x5a0673,parseInt('0777',0x8));return db[_0x995c('0x2c')][_0x995c('0x52')](_0x22b2c2)[_0x995c('0x24')](function(_0x2502dc){var _0x4d2c25={'role':_0x5b7426[_0x995c('0x6f')]['role'],'userProfileId':_0x5b7426[_0x995c('0x6f')][_0x995c('0x70')]};if(!_0x4d2c25)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4d2c25['role']===_0x995c('0x71')){var _0x36a435=_0x2502dc[_0x995c('0x26')]({'plain':!![]});return db[_0x995c('0x72')][_0x995c('0x73')]({'where':{'name':_0x995c('0x74'),'userProfileId':_0x4d2c25['userProfileId']},'raw':!![]})[_0x995c('0x24')](function(_0x247d69){if(_0x247d69&&_0x247d69[_0x995c('0x75')]===0x0){return db['UserProfileResource']['create']({'name':_0x36a435[_0x995c('0x2a')],'resourceId':_0x36a435['id'],'type':_0x247d69[_0x995c('0x2a')],'sectionId':_0x247d69['id']},{})[_0x995c('0x24')](function(){return _0x2502dc;});}else{return _0x2502dc;}})[_0x995c('0x46')](function(_0x137716){logger[_0x995c('0x29')](_0x995c('0x76'),_0x137716);throw _0x137716;});}return _0x2502dc;})['then'](respondWithResult(_0x43c52c,null))['catch'](handleError(_0x43c52c,null));});_0x4abb08[_0x995c('0x77')]();}catch(_0x34f507){_0x43c52c[_0x995c('0x1a')](0x1f4)[_0x995c('0x63')](_0x34f507);}};exports['update']=function(_0x23f609,_0x2a3493,_0x2d778e){return db[_0x995c('0x2c')]['find']({'where':{'id':_0x23f609[_0x995c('0x78')]['id']}})[_0x995c('0x24')](handleEntityNotFound(_0x2a3493,null))[_0x995c('0x24')](saveUpdates(_[_0x995c('0x3d')](_0x23f609['body'],['name',_0x995c('0x79')]),null))[_0x995c('0x24')](respondWithResult(_0x2a3493,null))[_0x995c('0x46')](handleError(_0x2a3493,null));};exports[_0x995c('0x7a')]=function(_0x53df81,_0x371784,_0x140302){return db[_0x995c('0x2c')][_0x995c('0x73')]({'where':{'id':_0x53df81[_0x995c('0x78')]['id']}})['then'](function(_0x576f05){if(_0x576f05){return _0x576f05[_0x995c('0x25')]();}})[_0x995c('0x24')](function(_0x4517c0){var _0x5bae74=path[_0x995c('0x5a')](config[_0x995c('0x4c')],'server/files/sounds/original',util[_0x995c('0x4f')](_0x995c('0x50'),_0x4517c0[_0x995c('0x4a')],_0x4517c0[_0x995c('0x7b')]));var _0x102ab1=path[_0x995c('0x5a')](config[_0x995c('0x4c')],_0x995c('0x4d'),util['format'](_0x995c('0x50'),_0x4517c0['save_name'],_0x4517c0[_0x995c('0x51')]));fs[_0x995c('0x62')](_0x5bae74);fs['unlinkSync'](_0x102ab1);return _0x4517c0;})[_0x995c('0x24')](function(_0x576334){if(_0x576334){return _0x371784['status'](0xcc)[_0x995c('0x28')]();}})[_0x995c('0x24')](handleEntityNotFound(_0x371784,null))['catch'](handleError(_0x371784,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index e4e075a..ae6a287 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 _0x4cca=['rimraf','../../config/environment','./sound.attributes','define','Sound','tools_sounds','lodash','../../config/logger','api','moment'];(function(_0x1afcfe,_0x2548e2){var _0x41351b=function(_0x1e7734){while(--_0x1e7734){_0x1afcfe['push'](_0x1afcfe['shift']());}};_0x41351b(++_0x2548e2);}(_0x4cca,0x150));var _0xa4cc=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x4cca[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xa4cc('0x0'));var util=require('util');var logger=require(_0xa4cc('0x1'))(_0xa4cc('0x2'));var moment=require(_0xa4cc('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xa4cc('0x4'));var config=require(_0xa4cc('0x5'));var attributes=require(_0xa4cc('0x6'));module['exports']=function(_0x197434,_0xd46333){return _0x197434[_0xa4cc('0x7')](_0xa4cc('0x8'),attributes,{'tableName':_0xa4cc('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd464=['define','Sound','tools_sounds','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','exports'];(function(_0x559d4a,_0x29471d){var _0x5aca02=function(_0x4aafe3){while(--_0x4aafe3){_0x559d4a['push'](_0x559d4a['shift']());}};_0x5aca02(++_0x29471d);}(_0xd464,0xc3));var _0x4d46=function(_0x8207,_0x11c9dc){_0x8207=_0x8207-0x0;var _0x3d0ac2=_0xd464[_0x8207];return _0x3d0ac2;};'use strict';var _=require('lodash');var util=require(_0x4d46('0x0'));var logger=require(_0x4d46('0x1'))(_0x4d46('0x2'));var moment=require(_0x4d46('0x3'));var BPromise=require(_0x4d46('0x4'));var rp=require(_0x4d46('0x5'));var fs=require('fs');var path=require(_0x4d46('0x6'));var rimraf=require('rimraf');var config=require(_0x4d46('0x7'));var attributes=require('./sound.attributes');module[_0x4d46('0x8')]=function(_0x36f806,_0x32c67a){return _0x36f806[_0x4d46('0x9')](_0x4d46('0xa'),attributes,{'tableName':_0x4d46('0xb'),'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 f899f1d..2536f25 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 _0x946a=['jayson/promise','client','http','request','info','Sound,\x20%s,\x20%s','request\x20sent','debug','Sound,\x20%s,\x20%s,\x20%s','stringify','code','error','message','catch','ShowSound','options','raw','where','attributes','include','map','model','then','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x31432b,_0x30ff39){var _0x22d703=function(_0x2639c2){while(--_0x2639c2){_0x31432b['push'](_0x31432b['shift']());}};_0x22d703(++_0x30ff39);}(_0x946a,0xf7));var _0xa946=function(_0x56be8e,_0xd07bbf){_0x56be8e=_0x56be8e-0x0;var _0x170540=_0x946a[_0x56be8e];return _0x170540;};'use strict';var _=require(_0xa946('0x0'));var util=require(_0xa946('0x1'));var moment=require(_0xa946('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa946('0x3'));var db=require(_0xa946('0x4'))['db'];var utils=require(_0xa946('0x5'));var logger=require(_0xa946('0x6'))(_0xa946('0x7'));var config=require(_0xa946('0x8'));var jayson=require(_0xa946('0x9'));var client=jayson[_0xa946('0xa')][_0xa946('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x38fc85,_0x595d6c,_0x20a6e3){return new BPromise(function(_0x44c9b1,_0x42d9dc){return client[_0xa946('0xc')](_0x38fc85,_0x20a6e3)['then'](function(_0x225e27){logger[_0xa946('0xd')](_0xa946('0xe'),_0x595d6c,_0xa946('0xf'));logger[_0xa946('0x10')](_0xa946('0x11'),_0x595d6c,'request\x20sent',JSON[_0xa946('0x12')](_0x225e27));if(_0x225e27['error']){if(_0x225e27['error'][_0xa946('0x13')]===0x1f4){logger[_0xa946('0x14')](_0xa946('0xe'),_0x595d6c,_0x225e27[_0xa946('0x14')][_0xa946('0x15')]);return _0x42d9dc(_0x225e27[_0xa946('0x14')][_0xa946('0x15')]);}logger[_0xa946('0x14')](_0xa946('0xe'),_0x595d6c,_0x225e27[_0xa946('0x14')][_0xa946('0x15')]);return _0x44c9b1(_0x225e27[_0xa946('0x14')]['message']);}else{logger[_0xa946('0xd')]('Sound,\x20%s,\x20%s',_0x595d6c,_0xa946('0xf'));_0x44c9b1(_0x225e27['result'][_0xa946('0x15')]);}})[_0xa946('0x16')](function(_0x37ac53){logger['error'](_0xa946('0xe'),_0x595d6c,_0x37ac53);_0x42d9dc(_0x37ac53);});});}exports[_0xa946('0x17')]=function(_0x343c43){var _0x2726ee=this;return new Promise(function(_0x229201,_0x226fed){return db['Sound']['find']({'raw':_0x343c43[_0xa946('0x18')]?_0x343c43['options'][_0xa946('0x19')]===undefined?!![]:![]:!![],'where':_0x343c43[_0xa946('0x18')]?_0x343c43[_0xa946('0x18')][_0xa946('0x1a')]||null:null,'attributes':_0x343c43[_0xa946('0x18')]?_0x343c43[_0xa946('0x18')][_0xa946('0x1b')]||null:null,'include':_0x343c43[_0xa946('0x18')]?_0x343c43[_0xa946('0x18')][_0xa946('0x1c')]?_[_0xa946('0x1d')](_0x343c43['options'][_0xa946('0x1c')],function(_0x5270c7){return{'model':db[_0x5270c7['model']],'as':_0x5270c7['as'],'attributes':_0x5270c7[_0xa946('0x1b')],'include':_0x5270c7[_0xa946('0x1c')]?_[_0xa946('0x1d')](_0x5270c7['include'],function(_0x2d5ac2){return{'model':db[_0x2d5ac2[_0xa946('0x1e')]],'as':_0x2d5ac2['as'],'attributes':_0x2d5ac2[_0xa946('0x1b')],'include':_0x2d5ac2[_0xa946('0x1c')]?_[_0xa946('0x1d')](_0x2d5ac2[_0xa946('0x1c')],function(_0x3566d9){return{'model':db[_0x3566d9[_0xa946('0x1e')]],'as':_0x3566d9['as'],'attributes':_0x3566d9[_0xa946('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xa946('0x1f')](function(_0x591a10){logger[_0xa946('0xd')](_0xa946('0x17'),_0x343c43);logger[_0xa946('0x10')]('ShowSound',_0x343c43,JSON['stringify'](_0x591a10));_0x229201(_0x591a10);})['catch'](function(_0x10181e){logger[_0xa946('0x14')](_0xa946('0x17'),_0x10181e[_0xa946('0x15')],_0x343c43);_0x226fed(_0x2726ee[_0xa946('0x14')](0x1f4,_0x10181e[_0xa946('0x15')]));});});}; \ No newline at end of file +var _0x60c1=['ShowSound','Sound','find','options','raw','where','include','attributes','map','model','catch','lodash','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','debug','Sound,\x20%s,\x20%s,\x20%s','stringify','error','code','Sound,\x20%s,\x20%s','message','request\x20sent'];(function(_0x4d1f69,_0x4a1749){var _0x40a64b=function(_0x52adaf){while(--_0x52adaf){_0x4d1f69['push'](_0x4d1f69['shift']());}};_0x40a64b(++_0x4a1749);}(_0x60c1,0x10b));var _0x160c=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0x60c1[_0x4e676e];return _0x336a3c;};'use strict';var _=require(_0x160c('0x0'));var util=require('util');var moment=require(_0x160c('0x1'));var BPromise=require(_0x160c('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x160c('0x3'))['db'];var utils=require(_0x160c('0x4'));var logger=require(_0x160c('0x5'))(_0x160c('0x6'));var config=require(_0x160c('0x7'));var jayson=require(_0x160c('0x8'));var client=jayson['client'][_0x160c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x52fd60,_0x5438db,_0x35aa27){return new BPromise(function(_0x156037,_0x43a21d){return client[_0x160c('0xa')](_0x52fd60,_0x35aa27)[_0x160c('0xb')](function(_0x325dd3){logger[_0x160c('0xc')]('Sound,\x20%s,\x20%s',_0x5438db,'request\x20sent');logger[_0x160c('0xd')](_0x160c('0xe'),_0x5438db,'request\x20sent',JSON[_0x160c('0xf')](_0x325dd3));if(_0x325dd3[_0x160c('0x10')]){if(_0x325dd3['error'][_0x160c('0x11')]===0x1f4){logger[_0x160c('0x10')](_0x160c('0x12'),_0x5438db,_0x325dd3[_0x160c('0x10')]['message']);return _0x43a21d(_0x325dd3[_0x160c('0x10')][_0x160c('0x13')]);}logger[_0x160c('0x10')]('Sound,\x20%s,\x20%s',_0x5438db,_0x325dd3[_0x160c('0x10')][_0x160c('0x13')]);return _0x156037(_0x325dd3[_0x160c('0x10')][_0x160c('0x13')]);}else{logger[_0x160c('0xc')]('Sound,\x20%s,\x20%s',_0x5438db,_0x160c('0x14'));_0x156037(_0x325dd3['result'][_0x160c('0x13')]);}})['catch'](function(_0x515fad){logger['error'](_0x160c('0x12'),_0x5438db,_0x515fad);_0x43a21d(_0x515fad);});});}exports[_0x160c('0x15')]=function(_0x51f0d){var _0x347e8f=this;return new Promise(function(_0x48f3c6,_0x2e8e93){return db[_0x160c('0x16')][_0x160c('0x17')]({'raw':_0x51f0d['options']?_0x51f0d[_0x160c('0x18')][_0x160c('0x19')]===undefined?!![]:![]:!![],'where':_0x51f0d[_0x160c('0x18')]?_0x51f0d[_0x160c('0x18')][_0x160c('0x1a')]||null:null,'attributes':_0x51f0d['options']?_0x51f0d['options']['attributes']||null:null,'include':_0x51f0d[_0x160c('0x18')]?_0x51f0d[_0x160c('0x18')]['include']?_['map'](_0x51f0d[_0x160c('0x18')][_0x160c('0x1b')],function(_0x3275d5){return{'model':db[_0x3275d5['model']],'as':_0x3275d5['as'],'attributes':_0x3275d5[_0x160c('0x1c')],'include':_0x3275d5[_0x160c('0x1b')]?_[_0x160c('0x1d')](_0x3275d5[_0x160c('0x1b')],function(_0x2e091c){return{'model':db[_0x2e091c['model']],'as':_0x2e091c['as'],'attributes':_0x2e091c[_0x160c('0x1c')],'include':_0x2e091c[_0x160c('0x1b')]?_['map'](_0x2e091c[_0x160c('0x1b')],function(_0x356356){return{'model':db[_0x356356[_0x160c('0x1e')]],'as':_0x356356['as'],'attributes':_0x356356[_0x160c('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x160c('0xb')](function(_0x465e97){logger[_0x160c('0xc')]('ShowSound',_0x51f0d);logger[_0x160c('0xd')](_0x160c('0x15'),_0x51f0d,JSON[_0x160c('0xf')](_0x465e97));_0x48f3c6(_0x465e97);})[_0x160c('0x1f')](function(_0xc50fd7){logger[_0x160c('0x10')]('ShowSound',_0xc50fd7['message'],_0x51f0d);_0x2e8e93(_0x347e8f[_0x160c('0x10')](0x1f4,_0xc50fd7['message']));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index d25a8dd..f73a194 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 _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(_0x253d2b,_0x49a0fb){var _0x3ce8bd=function(_0x3fcafe){while(--_0x3fcafe){_0x253d2b['push'](_0x253d2b['shift']());}};_0x3ce8bd(++_0x49a0fb);}(_0x2032,0xd9));var _0x2203=function(_0x1bdfde,_0x34e4ae){_0x1bdfde=_0x1bdfde-0x0;var _0x40aa24=_0x2032[_0x1bdfde];return _0x40aa24;};'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 +var _0xbaf0=['connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./squareMessage.controller','get','isAuthenticated','index','/:id','post','create','put','update','delete','destroy','exports','util','path'];(function(_0x24122c,_0x3e341e){var _0x3b9ad2=function(_0x935a85){while(--_0x935a85){_0x24122c['push'](_0x24122c['shift']());}};_0x3b9ad2(++_0x3e341e);}(_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['show']);router[_0x0baf('0xd')]('/',auth['isAuthenticated'](),controller[_0x0baf('0xe')]);router[_0x0baf('0xf')](_0x0baf('0xc'),auth[_0x0baf('0xa')](),controller[_0x0baf('0x10')]);router[_0x0baf('0x11')](_0x0baf('0xc'),auth[_0x0baf('0xa')](),controller[_0x0baf('0x12')]);module[_0x0baf('0x13')]=router; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.attributes.js b/server/api/squareMessage/squareMessage.attributes.js index 713abfc..68efe65 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 _0xe481=['out','STRING','exports','TEXT','ENUM'];(function(_0x3ab9ee,_0x4a74b8){var _0x82ee88=function(_0x6ccc7e){while(--_0x6ccc7e){_0x3ab9ee['push'](_0x3ab9ee['shift']());}};_0x82ee88(++_0x4a74b8);}(_0xe481,0x84));var _0x1e48=function(_0x411778,_0x524eed){_0x411778=_0x411778-0x0;var _0x8f616=_0xe481[_0x411778];return _0x8f616;};'use strict';var Sequelize=require('sequelize');module[_0x1e48('0x0')]={'uniqueid':{'type':Sequelize['STRING']},'body':{'type':Sequelize[_0x1e48('0x1')]('medium'),'allowNull':![]},'direction':{'type':Sequelize[_0x1e48('0x2')]('in','out'),'defaultValue':_0x1e48('0x3'),'allowNull':![]},'providerName':{'type':Sequelize[_0x1e48('0x4')]},'providerResponse':{'type':Sequelize[_0x1e48('0x1')]}}; \ No newline at end of file +var _0x71de=['ENUM','out','sequelize','exports','STRING','TEXT','medium'];(function(_0x3db704,_0x40edae){var _0x289e84=function(_0x58d376){while(--_0x58d376){_0x3db704['push'](_0x3db704['shift']());}};_0x289e84(++_0x40edae);}(_0x71de,0x136));var _0xe71d=function(_0x2350de,_0x237caa){_0x2350de=_0x2350de-0x0;var _0x23462d=_0x71de[_0x2350de];return _0x23462d;};'use strict';var Sequelize=require(_0xe71d('0x0'));module[_0xe71d('0x1')]={'uniqueid':{'type':Sequelize[_0xe71d('0x2')]},'body':{'type':Sequelize[_0xe71d('0x3')](_0xe71d('0x4')),'allowNull':![]},'direction':{'type':Sequelize[_0xe71d('0x5')]('in',_0xe71d('0x6')),'defaultValue':_0xe71d('0x6'),'allowNull':![]},'providerName':{'type':Sequelize[_0xe71d('0x2')]},'providerResponse':{'type':Sequelize[_0xe71d('0x3')]}}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index eca8652..d06d1f6 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 _0xcdc2=['params','create','body','update','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','undefined','limit','count','set','reject','save','destroy','then','name','send','index','rawAttributes','fieldName','type','key','model','keys','filters','intersection','attributes','fields','query','hasOwnProperty','order','sort','filter','where','merge','map','options','SquareMessage','includeAll','include','findAll','rows','catch'];(function(_0x25e48a,_0x4bc23b){var _0x445f58=function(_0x422a35){while(--_0x422a35){_0x25e48a['push'](_0x25e48a['shift']());}};_0x445f58(++_0x4bc23b);}(_0xcdc2,0x19d));var _0x2cdc=function(_0x16bec8,_0x4f9046){_0x16bec8=_0x16bec8-0x0;var _0x3f1d76=_0xcdc2[_0x16bec8];return _0x3f1d76;};'use strict';var emlformat=require(_0x2cdc('0x0'));var rimraf=require(_0x2cdc('0x1'));var zipdir=require(_0x2cdc('0x2'));var jsonpatch=require(_0x2cdc('0x3'));var rp=require(_0x2cdc('0x4'));var moment=require(_0x2cdc('0x5'));var BPromise=require(_0x2cdc('0x6'));var Mustache=require(_0x2cdc('0x7'));var util=require(_0x2cdc('0x8'));var path=require(_0x2cdc('0x9'));var sox=require(_0x2cdc('0xa'));var csv=require(_0x2cdc('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2cdc('0xc'));var squel=require('squel');var crypto=require(_0x2cdc('0xd'));var jsforce=require(_0x2cdc('0xe'));var deskjs=require(_0x2cdc('0xf'));var toCsv=require('to-csv');var querystring=require(_0x2cdc('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x2cdc('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2cdc('0x12'));var logger=require('../../config/logger')(_0x2cdc('0x13'));var utils=require(_0x2cdc('0x14'));var config=require(_0x2cdc('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4dd7d0,_0x53f515){_0x53f515=_0x53f515||0xcc;return function(_0x5951ca){if(_0x5951ca){return _0x4dd7d0[_0x2cdc('0x16')](_0x53f515);}return _0x4dd7d0[_0x2cdc('0x17')](_0x53f515)[_0x2cdc('0x18')]();};}function respondWithResult(_0x19c3d0,_0x4bf2f6){_0x4bf2f6=_0x4bf2f6||0xc8;return function(_0x4fb78b){if(_0x4fb78b){return _0x19c3d0[_0x2cdc('0x17')](_0x4bf2f6)[_0x2cdc('0x19')](_0x4fb78b);}};}function respondWithFilteredResult(_0x3cd5e0,_0x3715be){return function(_0x590fb4){if(_0x590fb4){var _0x570500=typeof _0x3715be[_0x2cdc('0x1a')]===_0x2cdc('0x1b')&&typeof _0x3715be[_0x2cdc('0x1c')]===_0x2cdc('0x1b');var _0x1d0633=_0x590fb4['count'];var _0x3a27bd=_0x570500?0x0:_0x3715be[_0x2cdc('0x1a')];var _0x4e3b93=_0x570500?_0x590fb4[_0x2cdc('0x1d')]:_0x3715be[_0x2cdc('0x1a')]+_0x3715be[_0x2cdc('0x1c')];var _0xa33fe6;if(_0x4e3b93>=_0x1d0633){_0x4e3b93=_0x1d0633;_0xa33fe6=0xc8;}else{_0xa33fe6=0xce;}_0x3cd5e0[_0x2cdc('0x17')](_0xa33fe6);return _0x3cd5e0[_0x2cdc('0x1e')]('Content-Range',_0x3a27bd+'-'+_0x4e3b93+'/'+_0x1d0633)['json'](_0x590fb4);}return null;};}function patchUpdates(_0x27bb5d){return function(_0x4f103c){try{jsonpatch['apply'](_0x4f103c,_0x27bb5d,!![]);}catch(_0x3ff658){return BPromise[_0x2cdc('0x1f')](_0x3ff658);}return _0x4f103c[_0x2cdc('0x20')]();};}function saveUpdates(_0x211eab,_0x3ce18a){return function(_0x22169c){if(_0x22169c){return _0x22169c['update'](_0x211eab)['then'](function(_0x19f1d6){return _0x19f1d6;});}return null;};}function removeEntity(_0x2ea200,_0x4bdb4d){return function(_0x202580){if(_0x202580){return _0x202580[_0x2cdc('0x21')]()[_0x2cdc('0x22')](function(){_0x2ea200[_0x2cdc('0x17')](0xcc)[_0x2cdc('0x18')]();});}};}function handleEntityNotFound(_0x480e57,_0x476c36){return function(_0x119936){if(!_0x119936){_0x480e57[_0x2cdc('0x16')](0x194);}return _0x119936;};}function handleError(_0x1afec9,_0x39203e){_0x39203e=_0x39203e||0x1f4;return function(_0x5468da){logger['error'](_0x5468da['stack']);if(_0x5468da[_0x2cdc('0x23')]){delete _0x5468da[_0x2cdc('0x23')];}_0x1afec9[_0x2cdc('0x17')](_0x39203e)[_0x2cdc('0x24')](_0x5468da);};}exports[_0x2cdc('0x25')]=function(_0x2433f5,_0x17316d){var _0x48224c={},_0x154761={},_0x564194={'count':0x0,'rows':[]};var _0x2acdd2=_['map'](db['SquareMessage'][_0x2cdc('0x26')],function(_0x2a58b0){return{'name':_0x2a58b0[_0x2cdc('0x27')],'type':_0x2a58b0[_0x2cdc('0x28')][_0x2cdc('0x29')]};});_0x154761[_0x2cdc('0x2a')]=_['map'](_0x2acdd2,_0x2cdc('0x23'));_0x154761['query']=_[_0x2cdc('0x2b')](_0x2433f5['query']);_0x154761[_0x2cdc('0x2c')]=_[_0x2cdc('0x2d')](_0x154761[_0x2cdc('0x2a')],_0x154761['query']);_0x48224c[_0x2cdc('0x2e')]=_[_0x2cdc('0x2d')](_0x154761['model'],qs['fields'](_0x2433f5['query'][_0x2cdc('0x2f')]));_0x48224c[_0x2cdc('0x2e')]=_0x48224c[_0x2cdc('0x2e')]['length']?_0x48224c[_0x2cdc('0x2e')]:_0x154761['model'];if(!_0x2433f5[_0x2cdc('0x30')][_0x2cdc('0x31')]('nolimit')){_0x48224c[_0x2cdc('0x1c')]=qs[_0x2cdc('0x1c')](_0x2433f5[_0x2cdc('0x30')]['limit']);_0x48224c[_0x2cdc('0x1a')]=qs['offset'](_0x2433f5[_0x2cdc('0x30')][_0x2cdc('0x1a')]);}_0x48224c[_0x2cdc('0x32')]=qs[_0x2cdc('0x33')](_0x2433f5['query'][_0x2cdc('0x33')]);_0x48224c['where']=qs[_0x2cdc('0x2c')](_['pick'](_0x2433f5['query'],_0x154761[_0x2cdc('0x2c')]),_0x2acdd2);if(_0x2433f5[_0x2cdc('0x30')][_0x2cdc('0x34')]){_0x48224c[_0x2cdc('0x35')]=_[_0x2cdc('0x36')](_0x48224c[_0x2cdc('0x35')],{'$or':_[_0x2cdc('0x37')](_0x2acdd2,function(_0x48e31e){if(_0x48e31e[_0x2cdc('0x28')]!=='VIRTUAL'){var _0x206c7e={};_0x206c7e[_0x48e31e[_0x2cdc('0x23')]]={'$like':'%'+_0x2433f5['query'][_0x2cdc('0x34')]+'%'};return _0x206c7e;}})});}_0x48224c=_[_0x2cdc('0x36')]({},_0x48224c,_0x2433f5[_0x2cdc('0x38')]);var _0x3356f7={'where':_0x48224c[_0x2cdc('0x35')]};return db[_0x2cdc('0x39')]['count'](_0x3356f7)['then'](function(_0x1d1f61){_0x564194['count']=_0x1d1f61;if(_0x2433f5[_0x2cdc('0x30')][_0x2cdc('0x3a')]){_0x48224c[_0x2cdc('0x3b')]=[{'all':!![]}];}return db[_0x2cdc('0x39')][_0x2cdc('0x3c')](_0x48224c);})[_0x2cdc('0x22')](function(_0x2b91a1){_0x564194[_0x2cdc('0x3d')]=_0x2b91a1;return _0x564194;})['then'](respondWithFilteredResult(_0x17316d,_0x48224c))[_0x2cdc('0x3e')](handleError(_0x17316d,null));};exports['show']=function(_0x3ab43b,_0x412217){var _0x4fdfe6={'raw':!![],'where':{'id':_0x3ab43b[_0x2cdc('0x3f')]['id']}},_0x50dc1b={};_0x50dc1b['model']=_[_0x2cdc('0x2b')](db['SquareMessage'][_0x2cdc('0x26')]);_0x50dc1b[_0x2cdc('0x30')]=_[_0x2cdc('0x2b')](_0x3ab43b['query']);_0x50dc1b[_0x2cdc('0x2c')]=_['intersection'](_0x50dc1b[_0x2cdc('0x2a')],_0x50dc1b['query']);_0x4fdfe6[_0x2cdc('0x2e')]=_[_0x2cdc('0x2d')](_0x50dc1b[_0x2cdc('0x2a')],qs[_0x2cdc('0x2f')](_0x3ab43b['query'][_0x2cdc('0x2f')]));_0x4fdfe6['attributes']=_0x4fdfe6[_0x2cdc('0x2e')]['length']?_0x4fdfe6[_0x2cdc('0x2e')]:_0x50dc1b[_0x2cdc('0x2a')];if(_0x3ab43b[_0x2cdc('0x30')][_0x2cdc('0x3a')]){_0x4fdfe6[_0x2cdc('0x3b')]=[{'all':!![]}];}_0x4fdfe6=_['merge']({},_0x4fdfe6,_0x3ab43b[_0x2cdc('0x38')]);return db[_0x2cdc('0x39')]['find'](_0x4fdfe6)[_0x2cdc('0x22')](handleEntityNotFound(_0x412217,null))['then'](respondWithResult(_0x412217,null))[_0x2cdc('0x3e')](handleError(_0x412217,null));};exports[_0x2cdc('0x40')]=function(_0x2136bc,_0x5ea543){return db[_0x2cdc('0x39')][_0x2cdc('0x40')](_0x2136bc[_0x2cdc('0x41')],{})[_0x2cdc('0x22')](respondWithResult(_0x5ea543,0xc9))[_0x2cdc('0x3e')](handleError(_0x5ea543,null));};exports[_0x2cdc('0x42')]=function(_0x37e1ea,_0x89bf5f){if(_0x37e1ea[_0x2cdc('0x41')]['id']){delete _0x37e1ea[_0x2cdc('0x41')]['id'];}return db['SquareMessage'][_0x2cdc('0x43')]({'where':{'id':_0x37e1ea[_0x2cdc('0x3f')]['id']}})[_0x2cdc('0x22')](handleEntityNotFound(_0x89bf5f,null))[_0x2cdc('0x22')](saveUpdates(_0x37e1ea[_0x2cdc('0x41')],null))['then'](respondWithResult(_0x89bf5f,null))[_0x2cdc('0x3e')](handleError(_0x89bf5f,null));};exports[_0x2cdc('0x21')]=function(_0x582487,_0x50174f){return db['SquareMessage'][_0x2cdc('0x43')]({'where':{'id':_0x582487[_0x2cdc('0x3f')]['id']}})[_0x2cdc('0x22')](handleEntityNotFound(_0x50174f,null))['then'](removeEntity(_0x50174f,null))[_0x2cdc('0x3e')](handleError(_0x50174f,null));}; \ No newline at end of file +var _0xdc73=['fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','status','json','limit','undefined','count','offset','set','reject','save','update','then','destroy','end','sendStatus','error','stack','name','send','index','map','SquareMessage','rawAttributes','fieldName','type','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','rows','catch','show','params','find','create','body','rimraf','zip-dir'];(function(_0x4c0bfe,_0x5124fd){var _0x1ada5c=function(_0x350ed2){while(--_0x350ed2){_0x4c0bfe['push'](_0x4c0bfe['shift']());}};_0x1ada5c(++_0x5124fd);}(_0xdc73,0x19c));var _0x3dc7=function(_0x3490f7,_0x46963a){_0x3490f7=_0x3490f7-0x0;var _0x5b3372=_0xdc73[_0x3490f7];return _0x5b3372;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3dc7('0x0'));var zipdir=require(_0x3dc7('0x1'));var jsonpatch=require(_0x3dc7('0x2'));var rp=require(_0x3dc7('0x3'));var moment=require(_0x3dc7('0x4'));var BPromise=require(_0x3dc7('0x5'));var Mustache=require(_0x3dc7('0x6'));var util=require('util');var path=require(_0x3dc7('0x7'));var sox=require('sox');var csv=require(_0x3dc7('0x8'));var ejs=require(_0x3dc7('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x3dc7('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x3dc7('0xb'));var toCsv=require(_0x3dc7('0x8'));var querystring=require(_0x3dc7('0xc'));var Papa=require('papaparse');var Redis=require(_0x3dc7('0xd'));var authService=require(_0x3dc7('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x3dc7('0xf'));var hardwareService=require(_0x3dc7('0x10'));var logger=require(_0x3dc7('0x11'))('api');var utils=require('../../config/utils');var config=require(_0x3dc7('0x12'));var licenseUtil=require(_0x3dc7('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x61345b,_0x597841){_0x597841=_0x597841||0xcc;return function(_0x31b283){if(_0x31b283){return _0x61345b['sendStatus'](_0x597841);}return _0x61345b[_0x3dc7('0x14')](_0x597841)['end']();};}function respondWithResult(_0x57f89e,_0x106482){_0x106482=_0x106482||0xc8;return function(_0x126eae){if(_0x126eae){return _0x57f89e[_0x3dc7('0x14')](_0x106482)[_0x3dc7('0x15')](_0x126eae);}};}function respondWithFilteredResult(_0x4631a4,_0x523eba){return function(_0x164e6a){if(_0x164e6a){var _0x541ea3=typeof _0x523eba['offset']==='undefined'&&typeof _0x523eba[_0x3dc7('0x16')]===_0x3dc7('0x17');var _0x3030f2=_0x164e6a[_0x3dc7('0x18')];var _0x37a609=_0x541ea3?0x0:_0x523eba['offset'];var _0x4f26fe=_0x541ea3?_0x164e6a['count']:_0x523eba[_0x3dc7('0x19')]+_0x523eba['limit'];var _0x115c0f;if(_0x4f26fe>=_0x3030f2){_0x4f26fe=_0x3030f2;_0x115c0f=0xc8;}else{_0x115c0f=0xce;}_0x4631a4['status'](_0x115c0f);return _0x4631a4[_0x3dc7('0x1a')]('Content-Range',_0x37a609+'-'+_0x4f26fe+'/'+_0x3030f2)['json'](_0x164e6a);}return null;};}function patchUpdates(_0xd177a2){return function(_0xfb05c3){try{jsonpatch['apply'](_0xfb05c3,_0xd177a2,!![]);}catch(_0x64166b){return BPromise[_0x3dc7('0x1b')](_0x64166b);}return _0xfb05c3[_0x3dc7('0x1c')]();};}function saveUpdates(_0x2f8149,_0x463a49){return function(_0x202062){if(_0x202062){return _0x202062[_0x3dc7('0x1d')](_0x2f8149)[_0x3dc7('0x1e')](function(_0x26fe36){return _0x26fe36;});}return null;};}function removeEntity(_0x3aa68e,_0x556dd0){return function(_0x4ba74b){if(_0x4ba74b){return _0x4ba74b[_0x3dc7('0x1f')]()[_0x3dc7('0x1e')](function(){_0x3aa68e[_0x3dc7('0x14')](0xcc)[_0x3dc7('0x20')]();});}};}function handleEntityNotFound(_0x285995,_0x5b9d96){return function(_0x32aef6){if(!_0x32aef6){_0x285995[_0x3dc7('0x21')](0x194);}return _0x32aef6;};}function handleError(_0x1eb267,_0x53afa5){_0x53afa5=_0x53afa5||0x1f4;return function(_0x3b7019){logger[_0x3dc7('0x22')](_0x3b7019[_0x3dc7('0x23')]);if(_0x3b7019[_0x3dc7('0x24')]){delete _0x3b7019['name'];}_0x1eb267[_0x3dc7('0x14')](_0x53afa5)[_0x3dc7('0x25')](_0x3b7019);};}exports[_0x3dc7('0x26')]=function(_0x2959cd,_0x4991b4){var _0x5a4c56={},_0x1f114d={},_0x19e6e7={'count':0x0,'rows':[]};var _0x4caf9c=_[_0x3dc7('0x27')](db[_0x3dc7('0x28')][_0x3dc7('0x29')],function(_0x2d28d8){return{'name':_0x2d28d8[_0x3dc7('0x2a')],'type':_0x2d28d8[_0x3dc7('0x2b')]['key']};});_0x1f114d['model']=_['map'](_0x4caf9c,_0x3dc7('0x24'));_0x1f114d[_0x3dc7('0x2c')]=_[_0x3dc7('0x2d')](_0x2959cd['query']);_0x1f114d[_0x3dc7('0x2e')]=_[_0x3dc7('0x2f')](_0x1f114d[_0x3dc7('0x30')],_0x1f114d[_0x3dc7('0x2c')]);_0x5a4c56[_0x3dc7('0x31')]=_[_0x3dc7('0x2f')](_0x1f114d[_0x3dc7('0x30')],qs[_0x3dc7('0x32')](_0x2959cd[_0x3dc7('0x2c')][_0x3dc7('0x32')]));_0x5a4c56[_0x3dc7('0x31')]=_0x5a4c56[_0x3dc7('0x31')][_0x3dc7('0x33')]?_0x5a4c56[_0x3dc7('0x31')]:_0x1f114d['model'];if(!_0x2959cd[_0x3dc7('0x2c')][_0x3dc7('0x34')]('nolimit')){_0x5a4c56[_0x3dc7('0x16')]=qs[_0x3dc7('0x16')](_0x2959cd[_0x3dc7('0x2c')][_0x3dc7('0x16')]);_0x5a4c56[_0x3dc7('0x19')]=qs[_0x3dc7('0x19')](_0x2959cd[_0x3dc7('0x2c')][_0x3dc7('0x19')]);}_0x5a4c56[_0x3dc7('0x35')]=qs[_0x3dc7('0x36')](_0x2959cd[_0x3dc7('0x2c')][_0x3dc7('0x36')]);_0x5a4c56[_0x3dc7('0x37')]=qs[_0x3dc7('0x2e')](_[_0x3dc7('0x38')](_0x2959cd[_0x3dc7('0x2c')],_0x1f114d[_0x3dc7('0x2e')]),_0x4caf9c);if(_0x2959cd['query'][_0x3dc7('0x39')]){_0x5a4c56['where']=_[_0x3dc7('0x3a')](_0x5a4c56['where'],{'$or':_[_0x3dc7('0x27')](_0x4caf9c,function(_0x46c904){if(_0x46c904['type']!==_0x3dc7('0x3b')){var _0x56223c={};_0x56223c[_0x46c904[_0x3dc7('0x24')]]={'$like':'%'+_0x2959cd[_0x3dc7('0x2c')][_0x3dc7('0x39')]+'%'};return _0x56223c;}})});}_0x5a4c56=_[_0x3dc7('0x3a')]({},_0x5a4c56,_0x2959cd[_0x3dc7('0x3c')]);var _0x5ba53f={'where':_0x5a4c56[_0x3dc7('0x37')]};return db[_0x3dc7('0x28')][_0x3dc7('0x18')](_0x5ba53f)[_0x3dc7('0x1e')](function(_0x2ac7d0){_0x19e6e7[_0x3dc7('0x18')]=_0x2ac7d0;if(_0x2959cd['query'][_0x3dc7('0x3d')]){_0x5a4c56['include']=[{'all':!![]}];}return db[_0x3dc7('0x28')]['findAll'](_0x5a4c56);})['then'](function(_0x599f89){_0x19e6e7[_0x3dc7('0x3e')]=_0x599f89;return _0x19e6e7;})[_0x3dc7('0x1e')](respondWithFilteredResult(_0x4991b4,_0x5a4c56))[_0x3dc7('0x3f')](handleError(_0x4991b4,null));};exports[_0x3dc7('0x40')]=function(_0x27181f,_0x406be6){var _0x281e01={'raw':!![],'where':{'id':_0x27181f[_0x3dc7('0x41')]['id']}},_0x2b2750={};_0x2b2750[_0x3dc7('0x30')]=_[_0x3dc7('0x2d')](db[_0x3dc7('0x28')][_0x3dc7('0x29')]);_0x2b2750[_0x3dc7('0x2c')]=_[_0x3dc7('0x2d')](_0x27181f[_0x3dc7('0x2c')]);_0x2b2750[_0x3dc7('0x2e')]=_[_0x3dc7('0x2f')](_0x2b2750[_0x3dc7('0x30')],_0x2b2750['query']);_0x281e01[_0x3dc7('0x31')]=_[_0x3dc7('0x2f')](_0x2b2750[_0x3dc7('0x30')],qs['fields'](_0x27181f[_0x3dc7('0x2c')]['fields']));_0x281e01[_0x3dc7('0x31')]=_0x281e01[_0x3dc7('0x31')]['length']?_0x281e01[_0x3dc7('0x31')]:_0x2b2750[_0x3dc7('0x30')];if(_0x27181f[_0x3dc7('0x2c')][_0x3dc7('0x3d')]){_0x281e01['include']=[{'all':!![]}];}_0x281e01=_['merge']({},_0x281e01,_0x27181f[_0x3dc7('0x3c')]);return db[_0x3dc7('0x28')][_0x3dc7('0x42')](_0x281e01)[_0x3dc7('0x1e')](handleEntityNotFound(_0x406be6,null))['then'](respondWithResult(_0x406be6,null))[_0x3dc7('0x3f')](handleError(_0x406be6,null));};exports['create']=function(_0x117681,_0xfba3e9){return db[_0x3dc7('0x28')][_0x3dc7('0x43')](_0x117681[_0x3dc7('0x44')],{})[_0x3dc7('0x1e')](respondWithResult(_0xfba3e9,0xc9))['catch'](handleError(_0xfba3e9,null));};exports[_0x3dc7('0x1d')]=function(_0x45f18a,_0x24764f){if(_0x45f18a[_0x3dc7('0x44')]['id']){delete _0x45f18a[_0x3dc7('0x44')]['id'];}return db[_0x3dc7('0x28')][_0x3dc7('0x42')]({'where':{'id':_0x45f18a[_0x3dc7('0x41')]['id']}})[_0x3dc7('0x1e')](handleEntityNotFound(_0x24764f,null))[_0x3dc7('0x1e')](saveUpdates(_0x45f18a[_0x3dc7('0x44')],null))['then'](respondWithResult(_0x24764f,null))['catch'](handleError(_0x24764f,null));};exports[_0x3dc7('0x1f')]=function(_0x45e5d4,_0x4e6feb){return db[_0x3dc7('0x28')][_0x3dc7('0x42')]({'where':{'id':_0x45e5d4['params']['id']}})[_0x3dc7('0x1e')](handleEntityNotFound(_0x4e6feb,null))['then'](removeEntity(_0x4e6feb,null))[_0x3dc7('0x3f')](handleError(_0x4e6feb,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index 0a754b9..c2bec15 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 _0x94fc=['../../config/environment','define','square_messages','lodash','util','../../config/logger','api','moment','bluebird','rimraf'];(function(_0x207d90,_0x27e800){var _0x45023b=function(_0x20e07c){while(--_0x20e07c){_0x207d90['push'](_0x207d90['shift']());}};_0x45023b(++_0x27e800);}(_0x94fc,0x1ed));var _0xc94f=function(_0x6445b1,_0x5d74ec){_0x6445b1=_0x6445b1-0x0;var _0x1f088d=_0x94fc[_0x6445b1];return _0x1f088d;};'use strict';var _=require(_0xc94f('0x0'));var util=require(_0xc94f('0x1'));var logger=require(_0xc94f('0x2'))(_0xc94f('0x3'));var moment=require(_0xc94f('0x4'));var BPromise=require(_0xc94f('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xc94f('0x6'));var config=require(_0xc94f('0x7'));var attributes=require('./squareMessage.attributes');module['exports']=function(_0x258cb4,_0x255508){return _0x258cb4[_0xc94f('0x8')]('SquareMessage',attributes,{'tableName':_0xc94f('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4311=['lodash','../../config/logger','api','moment','bluebird','path','./squareMessage.attributes','exports','SquareMessage'];(function(_0xabe64d,_0x2618da){var _0x59af04=function(_0x8e7866){while(--_0x8e7866){_0xabe64d['push'](_0xabe64d['shift']());}};_0x59af04(++_0x2618da);}(_0x4311,0x105));var _0x1431=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x4311[_0x432682];return _0x463d05;};'use strict';var _=require(_0x1431('0x0'));var util=require('util');var logger=require(_0x1431('0x1'))(_0x1431('0x2'));var moment=require(_0x1431('0x3'));var BPromise=require(_0x1431('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1431('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x1431('0x6'));module[_0x1431('0x7')]=function(_0x5d4d0c,_0x55c61f){return _0x5d4d0c['define'](_0x1431('0x8'),attributes,{'tableName':'square_messages','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 cb25ff6..b4fea70 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 _0x5550=['options','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','SquareMessage,\x20%s,\x20%s,\x20%s','error','code','SquareMessage,\x20%s,\x20%s','message','result','catch','CreateSquareMessage'];(function(_0x5f0d42,_0x2cfae7){var _0x2fbbb4=function(_0x3fe4be){while(--_0x3fe4be){_0x5f0d42['push'](_0x5f0d42['shift']());}};_0x2fbbb4(++_0x2cfae7);}(_0x5550,0x91));var _0x0555=function(_0x3e2053,_0x278f2b){_0x3e2053=_0x3e2053-0x0;var _0x2491c7=_0x5550[_0x3e2053];return _0x2491c7;};'use strict';var _=require(_0x0555('0x0'));var util=require(_0x0555('0x1'));var moment=require('moment');var BPromise=require(_0x0555('0x2'));var rs=require(_0x0555('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0555('0x4'))['db'];var utils=require(_0x0555('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x0555('0x6'));var jayson=require(_0x0555('0x7'));var client=jayson[_0x0555('0x8')][_0x0555('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x31d660,_0x19eeb3,_0x58c369){return new BPromise(function(_0x25cee6,_0x506df9){return client[_0x0555('0xa')](_0x31d660,_0x58c369)[_0x0555('0xb')](function(_0x3d26d5){logger[_0x0555('0xc')]('SquareMessage,\x20%s,\x20%s',_0x19eeb3,_0x0555('0xd'));logger[_0x0555('0xe')](_0x0555('0xf'),_0x19eeb3,_0x0555('0xd'),JSON['stringify'](_0x3d26d5));if(_0x3d26d5[_0x0555('0x10')]){if(_0x3d26d5[_0x0555('0x10')][_0x0555('0x11')]===0x1f4){logger['error'](_0x0555('0x12'),_0x19eeb3,_0x3d26d5[_0x0555('0x10')]['message']);return _0x506df9(_0x3d26d5[_0x0555('0x10')][_0x0555('0x13')]);}logger[_0x0555('0x10')](_0x0555('0x12'),_0x19eeb3,_0x3d26d5[_0x0555('0x10')]['message']);return _0x25cee6(_0x3d26d5['error'][_0x0555('0x13')]);}else{logger['info'](_0x0555('0x12'),_0x19eeb3,'request\x20sent');_0x25cee6(_0x3d26d5[_0x0555('0x14')][_0x0555('0x13')]);}})[_0x0555('0x15')](function(_0x1b79bc){logger[_0x0555('0x10')](_0x0555('0x12'),_0x19eeb3,_0x1b79bc);_0x506df9(_0x1b79bc);});});}exports[_0x0555('0x16')]=function(_0x426a86){var _0x3d3878=this;return new Promise(function(_0x177b85,_0x22a23f){return db['SquareMessage']['create'](_0x426a86['body'],{'raw':_0x426a86[_0x0555('0x17')]?_0x426a86['options']['raw']===undefined?!![]:![]:!![]})[_0x0555('0xb')](function(_0x3528f7){logger[_0x0555('0xc')]('CreateSquareMessage',_0x426a86);logger['debug'](_0x0555('0x16'),_0x426a86,JSON['stringify'](_0x3528f7));_0x177b85(_0x3528f7);})[_0x0555('0x15')](function(_0x57e54a){logger[_0x0555('0x10')]('CreateSquareMessage',_0x57e54a[_0x0555('0x13')],_0x426a86);_0x22a23f(_0x3d3878[_0x0555('0x10')](0x1f4,_0x57e54a['message']));});});}; \ No newline at end of file +var _0x5c66=['../../config/logger','rpc','jayson/promise','client','http','request','info','debug','SquareMessage,\x20%s,\x20%s,\x20%s','error','code','SquareMessage,\x20%s,\x20%s','message','request\x20sent','result','catch','CreateSquareMessage','SquareMessage','create','body','options','raw','then','stringify','lodash','bluebird','randomstring','ioredis','../../config/utils'];(function(_0x27da74,_0x210795){var _0x217dc9=function(_0x3301f3){while(--_0x3301f3){_0x27da74['push'](_0x27da74['shift']());}};_0x217dc9(++_0x210795);}(_0x5c66,0x174));var _0x65c6=function(_0x52f738,_0x1a59d2){_0x52f738=_0x52f738-0x0;var _0x44e552=_0x5c66[_0x52f738];return _0x44e552;};'use strict';var _=require(_0x65c6('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x65c6('0x1'));var rs=require(_0x65c6('0x2'));var fs=require('fs');var Redis=require(_0x65c6('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x65c6('0x4'));var logger=require(_0x65c6('0x5'))(_0x65c6('0x6'));var config=require('../../config/environment');var jayson=require(_0x65c6('0x7'));var client=jayson[_0x65c6('0x8')][_0x65c6('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x22ed9c,_0x66ba52,_0x327edb){return new BPromise(function(_0x45a8ac,_0x2b3a2b){return client[_0x65c6('0xa')](_0x22ed9c,_0x327edb)['then'](function(_0x1fc647){logger[_0x65c6('0xb')]('SquareMessage,\x20%s,\x20%s',_0x66ba52,'request\x20sent');logger[_0x65c6('0xc')](_0x65c6('0xd'),_0x66ba52,'request\x20sent',JSON['stringify'](_0x1fc647));if(_0x1fc647['error']){if(_0x1fc647[_0x65c6('0xe')][_0x65c6('0xf')]===0x1f4){logger[_0x65c6('0xe')](_0x65c6('0x10'),_0x66ba52,_0x1fc647[_0x65c6('0xe')]['message']);return _0x2b3a2b(_0x1fc647[_0x65c6('0xe')][_0x65c6('0x11')]);}logger['error'](_0x65c6('0x10'),_0x66ba52,_0x1fc647[_0x65c6('0xe')][_0x65c6('0x11')]);return _0x45a8ac(_0x1fc647[_0x65c6('0xe')][_0x65c6('0x11')]);}else{logger[_0x65c6('0xb')](_0x65c6('0x10'),_0x66ba52,_0x65c6('0x12'));_0x45a8ac(_0x1fc647[_0x65c6('0x13')][_0x65c6('0x11')]);}})[_0x65c6('0x14')](function(_0x2e63d2){logger['error'](_0x65c6('0x10'),_0x66ba52,_0x2e63d2);_0x2b3a2b(_0x2e63d2);});});}exports[_0x65c6('0x15')]=function(_0x1ce327){var _0x1a2029=this;return new Promise(function(_0x1ce01c,_0x540771){return db[_0x65c6('0x16')][_0x65c6('0x17')](_0x1ce327[_0x65c6('0x18')],{'raw':_0x1ce327[_0x65c6('0x19')]?_0x1ce327['options'][_0x65c6('0x1a')]===undefined?!![]:![]:!![]})[_0x65c6('0x1b')](function(_0x3a7d6e){logger['info']('CreateSquareMessage',_0x1ce327);logger['debug'](_0x65c6('0x15'),_0x1ce327,JSON[_0x65c6('0x1c')](_0x3a7d6e));_0x1ce01c(_0x3a7d6e);})[_0x65c6('0x14')](function(_0x40cc42){logger[_0x65c6('0xe')](_0x65c6('0x15'),_0x40cc42[_0x65c6('0x11')],_0x1ce327);_0x540771(_0x1a2029[_0x65c6('0xe')](0x1f4,_0x40cc42[_0x65c6('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index 21094d7..1ed21ec 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 _0x9abb=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareOdbc.controller','get','isAuthenticated','/:id','show','/:id/test','test','post','create','update','delete','destroy','multer','util','path'];(function(_0x32b542,_0x4512fa){var _0x554d54=function(_0x35cdfc){while(--_0x35cdfc){_0x32b542['push'](_0x32b542['shift']());}};_0x554d54(++_0x4512fa);}(_0x9abb,0x1e0));var _0xb9ab=function(_0x2ba62c,_0x1e443a){_0x2ba62c=_0x2ba62c-0x0;var _0x153ab5=_0x9abb[_0x2ba62c];return _0x153ab5;};'use strict';var multer=require(_0xb9ab('0x0'));var util=require(_0xb9ab('0x1'));var path=require(_0xb9ab('0x2'));var timeout=require('connect-timeout');var express=require(_0xb9ab('0x3'));var router=express[_0xb9ab('0x4')]();var fs_extra=require(_0xb9ab('0x5'));var auth=require(_0xb9ab('0x6'));var interaction=require(_0xb9ab('0x7'));var config=require(_0xb9ab('0x8'));var controller=require(_0xb9ab('0x9'));router[_0xb9ab('0xa')]('/',auth[_0xb9ab('0xb')](),controller['index']);router[_0xb9ab('0xa')](_0xb9ab('0xc'),auth[_0xb9ab('0xb')](),controller[_0xb9ab('0xd')]);router[_0xb9ab('0xa')](_0xb9ab('0xe'),auth[_0xb9ab('0xb')](),timeout('15s'),controller[_0xb9ab('0xf')]);router[_0xb9ab('0x10')]('/',auth['isAuthenticated'](),controller[_0xb9ab('0x11')]);router['put'](_0xb9ab('0xc'),auth[_0xb9ab('0xb')](),controller[_0xb9ab('0x12')]);router[_0xb9ab('0x13')]('/:id',auth['isAuthenticated'](),controller[_0xb9ab('0x14')]);module['exports']=router; \ No newline at end of file +var _0x2bf7=['./squareOdbc.controller','get','index','/:id','isAuthenticated','show','/:id/test','test','post','put','update','delete','destroy','exports','multer','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x58a4d8,_0x5be7ee){var _0x571334=function(_0x14c6c8){while(--_0x14c6c8){_0x58a4d8['push'](_0x58a4d8['shift']());}};_0x571334(++_0x5be7ee);}(_0x2bf7,0x1c7));var _0x72bf=function(_0x17ff87,_0x2a069d){_0x17ff87=_0x17ff87-0x0;var _0x181e07=_0x2bf7[_0x17ff87];return _0x181e07;};'use strict';var multer=require(_0x72bf('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x72bf('0x1'));var express=require(_0x72bf('0x2'));var router=express['Router']();var fs_extra=require(_0x72bf('0x3'));var auth=require(_0x72bf('0x4'));var interaction=require(_0x72bf('0x5'));var config=require(_0x72bf('0x6'));var controller=require(_0x72bf('0x7'));router[_0x72bf('0x8')]('/',auth['isAuthenticated'](),controller[_0x72bf('0x9')]);router[_0x72bf('0x8')](_0x72bf('0xa'),auth[_0x72bf('0xb')](),controller[_0x72bf('0xc')]);router['get'](_0x72bf('0xd'),auth['isAuthenticated'](),timeout('15s'),controller[_0x72bf('0xe')]);router[_0x72bf('0xf')]('/',auth[_0x72bf('0xb')](),controller['create']);router[_0x72bf('0x10')](_0x72bf('0xa'),auth[_0x72bf('0xb')](),controller[_0x72bf('0x11')]);router[_0x72bf('0x12')]('/:id',auth[_0x72bf('0xb')](),controller[_0x72bf('0x13')]);module[_0x72bf('0x14')]=router; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.attributes.js b/server/api/squareOdbc/squareOdbc.attributes.js index 1fae2b9..38a4394 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 _0x2494=['STRING','sequelize','exports','name'];(function(_0x19c64a,_0x5de14e){var _0x1b1a06=function(_0x5dd104){while(--_0x5dd104){_0x19c64a['push'](_0x19c64a['shift']());}};_0x1b1a06(++_0x5de14e);}(_0x2494,0x81));var _0x4249=function(_0x4a1856,_0x7a7551){_0x4a1856=_0x4a1856-0x0;var _0x3aba72=_0x2494[_0x4a1856];return _0x3aba72;};'use strict';var Sequelize=require(_0x4249('0x0'));module[_0x4249('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x4249('0x2'),'allowNull':![]},'dsn':{'type':Sequelize[_0x4249('0x3')]},'description':{'type':Sequelize[_0x4249('0x3')]}}; \ No newline at end of file +var _0x2ffe=['name','sequelize','exports','STRING'];(function(_0x1a351c,_0x3f2134){var _0x10bfc0=function(_0x2de818){while(--_0x2de818){_0x1a351c['push'](_0x1a351c['shift']());}};_0x10bfc0(++_0x3f2134);}(_0x2ffe,0x155));var _0xe2ff=function(_0x47f5bf,_0xbcccc0){_0x47f5bf=_0x47f5bf-0x0;var _0x1c027d=_0x2ffe[_0x47f5bf];return _0x1c027d;};'use strict';var Sequelize=require(_0xe2ff('0x0'));module[_0xe2ff('0x1')]={'name':{'type':Sequelize[_0xe2ff('0x2')],'unique':_0xe2ff('0x3'),'allowNull':![]},'dsn':{'type':Sequelize[_0xe2ff('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 9d75f46..8b36177 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 _0xc36a=['include','rows','catch','show','params','rawAttributes','length','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','UserProfileResource','update','body','dsn','odbc','closeSync','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','count','limit','Content-Range','reject','save','then','destroy','get','ODBC','end','sendStatus','error','stack','name','index','map','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','options','SquareOdbc','includeAll'];(function(_0x183ac6,_0x116612){var _0xd88667=function(_0x3528ab){while(--_0x3528ab){_0x183ac6['push'](_0x183ac6['shift']());}};_0xd88667(++_0x116612);}(_0xc36a,0x163));var _0xac36=function(_0x3d7500,_0x4a6784){_0x3d7500=_0x3d7500-0x0;var _0x26f5bc=_0xc36a[_0x3d7500];return _0x26f5bc;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xac36('0x0'));var zipdir=require(_0xac36('0x1'));var jsonpatch=require(_0xac36('0x2'));var rp=require('request-promise');var moment=require(_0xac36('0x3'));var BPromise=require(_0xac36('0x4'));var Mustache=require(_0xac36('0x5'));var util=require(_0xac36('0x6'));var path=require('path');var sox=require(_0xac36('0x7'));var csv=require(_0xac36('0x8'));var ejs=require(_0xac36('0x9'));var fs=require('fs');var fs_extra=require(_0xac36('0xa'));var _=require('lodash');var squel=require(_0xac36('0xb'));var crypto=require(_0xac36('0xc'));var jsforce=require(_0xac36('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xac36('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xac36('0xf'));var as=require(_0xac36('0x10'));var hardwareService=require(_0xac36('0x11'));var logger=require(_0xac36('0x12'))(_0xac36('0x13'));var utils=require(_0xac36('0x14'));var config=require(_0xac36('0x15'));var licenseUtil=require(_0xac36('0x16'));var db=require(_0xac36('0x17'))['db'];function respondWithStatusCode(_0x26b22d,_0xda68bb){_0xda68bb=_0xda68bb||0xcc;return function(_0x29c947){if(_0x29c947){return _0x26b22d['sendStatus'](_0xda68bb);}return _0x26b22d[_0xac36('0x18')](_0xda68bb)['end']();};}function respondWithResult(_0x1b14db,_0x54963b){_0x54963b=_0x54963b||0xc8;return function(_0x12d98e){if(_0x12d98e){return _0x1b14db[_0xac36('0x18')](_0x54963b)[_0xac36('0x19')](_0x12d98e);}};}function respondWithFilteredResult(_0x5d6bfe,_0x384864){return function(_0x37ef20){if(_0x37ef20){var _0x220ef7=typeof _0x384864[_0xac36('0x1a')]===_0xac36('0x1b')&&typeof _0x384864['limit']==='undefined';var _0x249d96=_0x37ef20[_0xac36('0x1c')];var _0x72a008=_0x220ef7?0x0:_0x384864[_0xac36('0x1a')];var _0x273b02=_0x220ef7?_0x37ef20['count']:_0x384864[_0xac36('0x1a')]+_0x384864[_0xac36('0x1d')];var _0x4bc7a8;if(_0x273b02>=_0x249d96){_0x273b02=_0x249d96;_0x4bc7a8=0xc8;}else{_0x4bc7a8=0xce;}_0x5d6bfe['status'](_0x4bc7a8);return _0x5d6bfe['set'](_0xac36('0x1e'),_0x72a008+'-'+_0x273b02+'/'+_0x249d96)[_0xac36('0x19')](_0x37ef20);}return null;};}function patchUpdates(_0xa03b18){return function(_0x2b7044){try{jsonpatch['apply'](_0x2b7044,_0xa03b18,!![]);}catch(_0x4b922d){return BPromise[_0xac36('0x1f')](_0x4b922d);}return _0x2b7044[_0xac36('0x20')]();};}function saveUpdates(_0x2abb2c,_0x2bcf98){return function(_0x3701ec){if(_0x3701ec){return _0x3701ec['update'](_0x2abb2c)[_0xac36('0x21')](function(_0x473645){return _0x473645;});}return null;};}function removeEntity(_0x280af5,_0x2982f9){return function(_0x956c7a){if(_0x956c7a){return _0x956c7a[_0xac36('0x22')]()[_0xac36('0x21')](function(){var _0x3508e3=_0x956c7a[_0xac36('0x23')]({'plain':!![]});var _0x9275a=_0xac36('0x24');return db['UserProfileResource'][_0xac36('0x22')]({'where':{'type':_0x9275a,'resourceId':_0x3508e3['id']}})[_0xac36('0x21')](function(){return _0x956c7a;});})[_0xac36('0x21')](function(){_0x280af5[_0xac36('0x18')](0xcc)[_0xac36('0x25')]();});}};}function handleEntityNotFound(_0x140d9b,_0x2bcd77){return function(_0x183062){if(!_0x183062){_0x140d9b[_0xac36('0x26')](0x194);}return _0x183062;};}function handleError(_0x3fb34b,_0x1d9e42){_0x1d9e42=_0x1d9e42||0x1f4;return function(_0x2b9e24){logger[_0xac36('0x27')](_0x2b9e24[_0xac36('0x28')]);if(_0x2b9e24[_0xac36('0x29')]){delete _0x2b9e24['name'];}_0x3fb34b[_0xac36('0x18')](_0x1d9e42)['send'](_0x2b9e24);};}exports[_0xac36('0x2a')]=function(_0xa13365,_0xace25d){var _0x1c6863={},_0x2d875c={},_0x1c0ffb={'count':0x0,'rows':[]};var _0x394395=_[_0xac36('0x2b')](db['SquareOdbc']['rawAttributes'],function(_0x54ce8a){return{'name':_0x54ce8a[_0xac36('0x2c')],'type':_0x54ce8a[_0xac36('0x2d')][_0xac36('0x2e')]};});_0x2d875c[_0xac36('0x2f')]=_[_0xac36('0x2b')](_0x394395,_0xac36('0x29'));_0x2d875c[_0xac36('0x30')]=_[_0xac36('0x31')](_0xa13365['query']);_0x2d875c[_0xac36('0x32')]=_[_0xac36('0x33')](_0x2d875c[_0xac36('0x2f')],_0x2d875c['query']);_0x1c6863[_0xac36('0x34')]=_['intersection'](_0x2d875c['model'],qs[_0xac36('0x35')](_0xa13365[_0xac36('0x30')][_0xac36('0x35')]));_0x1c6863[_0xac36('0x34')]=_0x1c6863[_0xac36('0x34')]['length']?_0x1c6863['attributes']:_0x2d875c['model'];if(!_0xa13365['query'][_0xac36('0x36')](_0xac36('0x37'))){_0x1c6863['limit']=qs['limit'](_0xa13365[_0xac36('0x30')][_0xac36('0x1d')]);_0x1c6863['offset']=qs[_0xac36('0x1a')](_0xa13365[_0xac36('0x30')][_0xac36('0x1a')]);}_0x1c6863[_0xac36('0x38')]=qs[_0xac36('0x39')](_0xa13365[_0xac36('0x30')][_0xac36('0x39')]);_0x1c6863['where']=qs[_0xac36('0x32')](_[_0xac36('0x3a')](_0xa13365[_0xac36('0x30')],_0x2d875c[_0xac36('0x32')]),_0x394395);if(_0xa13365['query']['filter']){_0x1c6863[_0xac36('0x3b')]=_[_0xac36('0x3c')](_0x1c6863[_0xac36('0x3b')],{'$or':_[_0xac36('0x2b')](_0x394395,function(_0x4fb5cc){if(_0x4fb5cc[_0xac36('0x2d')]!==_0xac36('0x3d')){var _0x40e49d={};_0x40e49d[_0x4fb5cc[_0xac36('0x29')]]={'$like':'%'+_0xa13365[_0xac36('0x30')]['filter']+'%'};return _0x40e49d;}})});}_0x1c6863=_[_0xac36('0x3c')]({},_0x1c6863,_0xa13365[_0xac36('0x3e')]);var _0x133579={'where':_0x1c6863[_0xac36('0x3b')]};return db[_0xac36('0x3f')][_0xac36('0x1c')](_0x133579)[_0xac36('0x21')](function(_0x39caed){_0x1c0ffb[_0xac36('0x1c')]=_0x39caed;if(_0xa13365[_0xac36('0x30')][_0xac36('0x40')]){_0x1c6863[_0xac36('0x41')]=[{'all':!![]}];}return db[_0xac36('0x3f')]['findAll'](_0x1c6863);})['then'](function(_0x39f99d){_0x1c0ffb[_0xac36('0x42')]=_0x39f99d;return _0x1c0ffb;})[_0xac36('0x21')](respondWithFilteredResult(_0xace25d,_0x1c6863))[_0xac36('0x43')](handleError(_0xace25d,null));};exports[_0xac36('0x44')]=function(_0x207387,_0x180814){var _0x5ac7ad={'raw':!![],'where':{'id':_0x207387[_0xac36('0x45')]['id']}},_0x46983d={};_0x46983d[_0xac36('0x2f')]=_['keys'](db[_0xac36('0x3f')][_0xac36('0x46')]);_0x46983d['query']=_[_0xac36('0x31')](_0x207387[_0xac36('0x30')]);_0x46983d[_0xac36('0x32')]=_[_0xac36('0x33')](_0x46983d['model'],_0x46983d[_0xac36('0x30')]);_0x5ac7ad[_0xac36('0x34')]=_[_0xac36('0x33')](_0x46983d[_0xac36('0x2f')],qs[_0xac36('0x35')](_0x207387[_0xac36('0x30')][_0xac36('0x35')]));_0x5ac7ad[_0xac36('0x34')]=_0x5ac7ad[_0xac36('0x34')][_0xac36('0x47')]?_0x5ac7ad[_0xac36('0x34')]:_0x46983d[_0xac36('0x2f')];if(_0x207387[_0xac36('0x30')][_0xac36('0x40')]){_0x5ac7ad['include']=[{'all':!![]}];}_0x5ac7ad=_[_0xac36('0x3c')]({},_0x5ac7ad,_0x207387[_0xac36('0x3e')]);return db['SquareOdbc'][_0xac36('0x48')](_0x5ac7ad)[_0xac36('0x21')](handleEntityNotFound(_0x180814,null))[_0xac36('0x21')](respondWithResult(_0x180814,null))[_0xac36('0x43')](handleError(_0x180814,null));};exports[_0xac36('0x49')]=function(_0x53b26c,_0x50415c){return db['SquareOdbc'][_0xac36('0x49')](_0x53b26c['body'],{})['then'](function(_0xf716){var _0x5251fc=_0x53b26c[_0xac36('0x4a')][_0xac36('0x23')]({'plain':!![]});if(!_0x5251fc)throw new Error(_0xac36('0x4b'));if(_0x5251fc['role']===_0xac36('0x4a')){var _0x306b0c=_0xf716[_0xac36('0x23')]({'plain':!![]});var _0x5c789f=_0xac36('0x24');return db[_0xac36('0x4c')][_0xac36('0x48')]({'where':{'name':_0x5c789f,'userProfileId':_0x5251fc['userProfileId']},'raw':!![]})[_0xac36('0x21')](function(_0x34e69b){if(_0x34e69b&&_0x34e69b[_0xac36('0x4d')]===0x0){return db[_0xac36('0x4e')][_0xac36('0x49')]({'name':_0x306b0c[_0xac36('0x29')],'resourceId':_0x306b0c['id'],'type':_0x34e69b['name'],'sectionId':_0x34e69b['id']},{})[_0xac36('0x21')](function(){return _0xf716;});}else{return _0xf716;}})[_0xac36('0x43')](function(_0xd29be4){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xd29be4);throw _0xd29be4;});}return _0xf716;})[_0xac36('0x21')](respondWithResult(_0x50415c,0xc9))['catch'](handleError(_0x50415c,null));};exports[_0xac36('0x4f')]=function(_0x12d8ea,_0x263a2a){if(_0x12d8ea[_0xac36('0x50')]['id']){delete _0x12d8ea[_0xac36('0x50')]['id'];}return db[_0xac36('0x3f')][_0xac36('0x48')]({'where':{'id':_0x12d8ea['params']['id']}})[_0xac36('0x21')](handleEntityNotFound(_0x263a2a,null))[_0xac36('0x21')](saveUpdates(_0x12d8ea['body'],null))[_0xac36('0x21')](respondWithResult(_0x263a2a,null))['catch'](handleError(_0x263a2a,null));};exports[_0xac36('0x22')]=function(_0x13d537,_0x430ef9){return db[_0xac36('0x3f')][_0xac36('0x48')]({'where':{'id':_0x13d537[_0xac36('0x45')]['id']}})[_0xac36('0x21')](handleEntityNotFound(_0x430ef9,null))[_0xac36('0x21')](removeEntity(_0x430ef9,null))[_0xac36('0x43')](handleError(_0x430ef9,null));};exports['test']=function(_0xa1c277,_0x1b9d72,_0x2bc17c){var _0x54c5cb;return db[_0xac36('0x3f')][_0xac36('0x48')]({'where':{'id':_0xa1c277['params']['id']},'attributes':['id',_0xac36('0x51')]})[_0xac36('0x21')](handleEntityNotFound(_0x1b9d72,null))[_0xac36('0x21')](function(_0x4c6506){if(_0x4c6506){var _0x29b83e=require(_0xac36('0x52'))();_0x29b83e['openSync'](_0x4c6506[_0xac36('0x51')]);_0x29b83e[_0xac36('0x53')]();return _0x4c6506;}})[_0xac36('0x21')](respondWithResult(_0x1b9d72,null))[_0xac36('0x43')](handleError(_0x1b9d72,null));}; \ No newline at end of file +var _0x6a9f=['map','SquareOdbc','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','merge','VIRTUAL','options','include','findAll','rows','params','includeAll','find','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','autoAssociation','update','test','dsn','odbc','closeSync','eml-format','request-promise','moment','mustache','path','sox','ejs','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','../../components/auth/service','../../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','reject','save','then','destroy','get','ODBC','UserProfileResource','stack','name','send'];(function(_0x5b8f39,_0x103579){var _0x1be276=function(_0x540fd1){while(--_0x540fd1){_0x5b8f39['push'](_0x5b8f39['shift']());}};_0x1be276(++_0x103579);}(_0x6a9f,0xcf));var _0xf6a9=function(_0x58ddd6,_0x5496a0){_0x58ddd6=_0x58ddd6-0x0;var _0x553775=_0x6a9f[_0x58ddd6];return _0x553775;};'use strict';var emlformat=require(_0xf6a9('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xf6a9('0x1'));var moment=require(_0xf6a9('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xf6a9('0x3'));var util=require('util');var path=require(_0xf6a9('0x4'));var sox=require(_0xf6a9('0x5'));var csv=require('to-csv');var ejs=require(_0xf6a9('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf6a9('0x7'));var squel=require(_0xf6a9('0x8'));var crypto=require(_0xf6a9('0x9'));var jsforce=require(_0xf6a9('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xf6a9('0xb'));var querystring=require(_0xf6a9('0xc'));var Papa=require(_0xf6a9('0xd'));var Redis=require('ioredis');var authService=require(_0xf6a9('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xf6a9('0xf'));var hardwareService=require(_0xf6a9('0x10'));var logger=require(_0xf6a9('0x11'))(_0xf6a9('0x12'));var utils=require(_0xf6a9('0x13'));var config=require(_0xf6a9('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xf6a9('0x15'))['db'];function respondWithStatusCode(_0xf16a50,_0x57ff5b){_0x57ff5b=_0x57ff5b||0xcc;return function(_0x4d8a18){if(_0x4d8a18){return _0xf16a50[_0xf6a9('0x16')](_0x57ff5b);}return _0xf16a50[_0xf6a9('0x17')](_0x57ff5b)[_0xf6a9('0x18')]();};}function respondWithResult(_0x4b8e69,_0x56b56f){_0x56b56f=_0x56b56f||0xc8;return function(_0x5ee9f7){if(_0x5ee9f7){return _0x4b8e69[_0xf6a9('0x17')](_0x56b56f)[_0xf6a9('0x19')](_0x5ee9f7);}};}function respondWithFilteredResult(_0x136504,_0x25acea){return function(_0x3884dc){if(_0x3884dc){var _0xd22700=typeof _0x25acea[_0xf6a9('0x1a')]===_0xf6a9('0x1b')&&typeof _0x25acea[_0xf6a9('0x1c')]===_0xf6a9('0x1b');var _0x1be8cb=_0x3884dc[_0xf6a9('0x1d')];var _0x4a81c9=_0xd22700?0x0:_0x25acea[_0xf6a9('0x1a')];var _0x5eee4b=_0xd22700?_0x3884dc['count']:_0x25acea[_0xf6a9('0x1a')]+_0x25acea['limit'];var _0x4e91f3;if(_0x5eee4b>=_0x1be8cb){_0x5eee4b=_0x1be8cb;_0x4e91f3=0xc8;}else{_0x4e91f3=0xce;}_0x136504[_0xf6a9('0x17')](_0x4e91f3);return _0x136504[_0xf6a9('0x1e')](_0xf6a9('0x1f'),_0x4a81c9+'-'+_0x5eee4b+'/'+_0x1be8cb)[_0xf6a9('0x19')](_0x3884dc);}return null;};}function patchUpdates(_0x2f9b1b){return function(_0x156a1){try{jsonpatch['apply'](_0x156a1,_0x2f9b1b,!![]);}catch(_0x395ad8){return BPromise[_0xf6a9('0x20')](_0x395ad8);}return _0x156a1[_0xf6a9('0x21')]();};}function saveUpdates(_0x23d58c,_0xc78830){return function(_0x482371){if(_0x482371){return _0x482371['update'](_0x23d58c)[_0xf6a9('0x22')](function(_0x4e1a65){return _0x4e1a65;});}return null;};}function removeEntity(_0x205e57,_0x2ef7ff){return function(_0x18737b){if(_0x18737b){return _0x18737b[_0xf6a9('0x23')]()[_0xf6a9('0x22')](function(){var _0x4387a=_0x18737b[_0xf6a9('0x24')]({'plain':!![]});var _0xe7f193=_0xf6a9('0x25');return db[_0xf6a9('0x26')][_0xf6a9('0x23')]({'where':{'type':_0xe7f193,'resourceId':_0x4387a['id']}})['then'](function(){return _0x18737b;});})['then'](function(){_0x205e57[_0xf6a9('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x18943f,_0xf92187){return function(_0x21bb86){if(!_0x21bb86){_0x18943f[_0xf6a9('0x16')](0x194);}return _0x21bb86;};}function handleError(_0x505f33,_0x2f2ae5){_0x2f2ae5=_0x2f2ae5||0x1f4;return function(_0x207868){logger['error'](_0x207868[_0xf6a9('0x27')]);if(_0x207868['name']){delete _0x207868[_0xf6a9('0x28')];}_0x505f33['status'](_0x2f2ae5)[_0xf6a9('0x29')](_0x207868);};}exports['index']=function(_0x29556e,_0x72d8e5){var _0x3125fe={},_0x50c03e={},_0x449472={'count':0x0,'rows':[]};var _0x5072af=_[_0xf6a9('0x2a')](db[_0xf6a9('0x2b')][_0xf6a9('0x2c')],function(_0x13f07b){return{'name':_0x13f07b[_0xf6a9('0x2d')],'type':_0x13f07b[_0xf6a9('0x2e')][_0xf6a9('0x2f')]};});_0x50c03e[_0xf6a9('0x30')]=_[_0xf6a9('0x2a')](_0x5072af,_0xf6a9('0x28'));_0x50c03e['query']=_[_0xf6a9('0x31')](_0x29556e[_0xf6a9('0x32')]);_0x50c03e[_0xf6a9('0x33')]=_[_0xf6a9('0x34')](_0x50c03e[_0xf6a9('0x30')],_0x50c03e['query']);_0x3125fe[_0xf6a9('0x35')]=_['intersection'](_0x50c03e[_0xf6a9('0x30')],qs[_0xf6a9('0x36')](_0x29556e[_0xf6a9('0x32')][_0xf6a9('0x36')]));_0x3125fe[_0xf6a9('0x35')]=_0x3125fe[_0xf6a9('0x35')][_0xf6a9('0x37')]?_0x3125fe[_0xf6a9('0x35')]:_0x50c03e[_0xf6a9('0x30')];if(!_0x29556e[_0xf6a9('0x32')]['hasOwnProperty'](_0xf6a9('0x38'))){_0x3125fe['limit']=qs[_0xf6a9('0x1c')](_0x29556e['query']['limit']);_0x3125fe[_0xf6a9('0x1a')]=qs[_0xf6a9('0x1a')](_0x29556e['query']['offset']);}_0x3125fe[_0xf6a9('0x39')]=qs[_0xf6a9('0x3a')](_0x29556e[_0xf6a9('0x32')][_0xf6a9('0x3a')]);_0x3125fe[_0xf6a9('0x3b')]=qs[_0xf6a9('0x33')](_['pick'](_0x29556e[_0xf6a9('0x32')],_0x50c03e['filters']),_0x5072af);if(_0x29556e[_0xf6a9('0x32')][_0xf6a9('0x3c')]){_0x3125fe['where']=_[_0xf6a9('0x3d')](_0x3125fe[_0xf6a9('0x3b')],{'$or':_[_0xf6a9('0x2a')](_0x5072af,function(_0x424efa){if(_0x424efa[_0xf6a9('0x2e')]!==_0xf6a9('0x3e')){var _0x5bf70d={};_0x5bf70d[_0x424efa['name']]={'$like':'%'+_0x29556e['query'][_0xf6a9('0x3c')]+'%'};return _0x5bf70d;}})});}_0x3125fe=_[_0xf6a9('0x3d')]({},_0x3125fe,_0x29556e[_0xf6a9('0x3f')]);var _0x3f0d7a={'where':_0x3125fe[_0xf6a9('0x3b')]};return db['SquareOdbc'][_0xf6a9('0x1d')](_0x3f0d7a)['then'](function(_0x411caf){_0x449472['count']=_0x411caf;if(_0x29556e[_0xf6a9('0x32')]['includeAll']){_0x3125fe[_0xf6a9('0x40')]=[{'all':!![]}];}return db[_0xf6a9('0x2b')][_0xf6a9('0x41')](_0x3125fe);})[_0xf6a9('0x22')](function(_0x42d2d4){_0x449472[_0xf6a9('0x42')]=_0x42d2d4;return _0x449472;})['then'](respondWithFilteredResult(_0x72d8e5,_0x3125fe))['catch'](handleError(_0x72d8e5,null));};exports['show']=function(_0x7ccffe,_0x1e4a2a){var _0x4d0f90={'raw':!![],'where':{'id':_0x7ccffe[_0xf6a9('0x43')]['id']}},_0x162bbe={};_0x162bbe['model']=_['keys'](db[_0xf6a9('0x2b')]['rawAttributes']);_0x162bbe[_0xf6a9('0x32')]=_[_0xf6a9('0x31')](_0x7ccffe[_0xf6a9('0x32')]);_0x162bbe[_0xf6a9('0x33')]=_['intersection'](_0x162bbe[_0xf6a9('0x30')],_0x162bbe[_0xf6a9('0x32')]);_0x4d0f90[_0xf6a9('0x35')]=_[_0xf6a9('0x34')](_0x162bbe[_0xf6a9('0x30')],qs[_0xf6a9('0x36')](_0x7ccffe[_0xf6a9('0x32')][_0xf6a9('0x36')]));_0x4d0f90[_0xf6a9('0x35')]=_0x4d0f90['attributes'][_0xf6a9('0x37')]?_0x4d0f90[_0xf6a9('0x35')]:_0x162bbe[_0xf6a9('0x30')];if(_0x7ccffe[_0xf6a9('0x32')][_0xf6a9('0x44')]){_0x4d0f90[_0xf6a9('0x40')]=[{'all':!![]}];}_0x4d0f90=_[_0xf6a9('0x3d')]({},_0x4d0f90,_0x7ccffe[_0xf6a9('0x3f')]);return db[_0xf6a9('0x2b')][_0xf6a9('0x45')](_0x4d0f90)['then'](handleEntityNotFound(_0x1e4a2a,null))[_0xf6a9('0x22')](respondWithResult(_0x1e4a2a,null))[_0xf6a9('0x46')](handleError(_0x1e4a2a,null));};exports[_0xf6a9('0x47')]=function(_0x2528e0,_0x4116dc){return db[_0xf6a9('0x2b')]['create'](_0x2528e0[_0xf6a9('0x48')],{})['then'](function(_0x3c27c8){var _0x580d49=_0x2528e0['user'][_0xf6a9('0x24')]({'plain':!![]});if(!_0x580d49)throw new Error(_0xf6a9('0x49'));if(_0x580d49[_0xf6a9('0x4a')]===_0xf6a9('0x4b')){var _0x551b91=_0x3c27c8[_0xf6a9('0x24')]({'plain':!![]});var _0xef368b='ODBC';return db['UserProfileSection'][_0xf6a9('0x45')]({'where':{'name':_0xef368b,'userProfileId':_0x580d49[_0xf6a9('0x4c')]},'raw':!![]})[_0xf6a9('0x22')](function(_0x38c3b8){if(_0x38c3b8&&_0x38c3b8[_0xf6a9('0x4d')]===0x0){return db[_0xf6a9('0x26')][_0xf6a9('0x47')]({'name':_0x551b91[_0xf6a9('0x28')],'resourceId':_0x551b91['id'],'type':_0x38c3b8[_0xf6a9('0x28')],'sectionId':_0x38c3b8['id']},{})[_0xf6a9('0x22')](function(){return _0x3c27c8;});}else{return _0x3c27c8;}})[_0xf6a9('0x46')](function(_0x3c10c2){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3c10c2);throw _0x3c10c2;});}return _0x3c27c8;})[_0xf6a9('0x22')](respondWithResult(_0x4116dc,0xc9))['catch'](handleError(_0x4116dc,null));};exports[_0xf6a9('0x4e')]=function(_0x12d2ec,_0x3b5615){if(_0x12d2ec['body']['id']){delete _0x12d2ec['body']['id'];}return db['SquareOdbc'][_0xf6a9('0x45')]({'where':{'id':_0x12d2ec[_0xf6a9('0x43')]['id']}})[_0xf6a9('0x22')](handleEntityNotFound(_0x3b5615,null))['then'](saveUpdates(_0x12d2ec['body'],null))[_0xf6a9('0x22')](respondWithResult(_0x3b5615,null))[_0xf6a9('0x46')](handleError(_0x3b5615,null));};exports[_0xf6a9('0x23')]=function(_0xda77d6,_0x426f53){return db[_0xf6a9('0x2b')][_0xf6a9('0x45')]({'where':{'id':_0xda77d6['params']['id']}})[_0xf6a9('0x22')](handleEntityNotFound(_0x426f53,null))[_0xf6a9('0x22')](removeEntity(_0x426f53,null))[_0xf6a9('0x46')](handleError(_0x426f53,null));};exports[_0xf6a9('0x4f')]=function(_0x37652c,_0xb3f418,_0x44a7f2){var _0x2015d4;return db[_0xf6a9('0x2b')][_0xf6a9('0x45')]({'where':{'id':_0x37652c[_0xf6a9('0x43')]['id']},'attributes':['id',_0xf6a9('0x50')]})[_0xf6a9('0x22')](handleEntityNotFound(_0xb3f418,null))[_0xf6a9('0x22')](function(_0x450c63){if(_0x450c63){var _0x5a2fd6=require(_0xf6a9('0x51'))();_0x5a2fd6['openSync'](_0x450c63[_0xf6a9('0x50')]);_0x5a2fd6[_0xf6a9('0x52')]();return _0x450c63;}})[_0xf6a9('0x22')](respondWithResult(_0xb3f418,null))[_0xf6a9('0x46')](handleError(_0xb3f418,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index 0e0fb97..44cd95c 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 _0x4edf=['api','moment','bluebird','request-promise','path','../../config/environment','./squareOdbc.attributes','exports','define','SquareOdbc','square_odbc','lodash','util'];(function(_0x87f53b,_0x3258f0){var _0x54c266=function(_0x4d10a4){while(--_0x4d10a4){_0x87f53b['push'](_0x87f53b['shift']());}};_0x54c266(++_0x3258f0);}(_0x4edf,0xe8));var _0xf4ed=function(_0x1e6e4e,_0x2b1b09){_0x1e6e4e=_0x1e6e4e-0x0;var _0x3d746b=_0x4edf[_0x1e6e4e];return _0x3d746b;};'use strict';var _=require(_0xf4ed('0x0'));var util=require(_0xf4ed('0x1'));var logger=require('../../config/logger')(_0xf4ed('0x2'));var moment=require(_0xf4ed('0x3'));var BPromise=require(_0xf4ed('0x4'));var rp=require(_0xf4ed('0x5'));var fs=require('fs');var path=require(_0xf4ed('0x6'));var rimraf=require('rimraf');var config=require(_0xf4ed('0x7'));var attributes=require(_0xf4ed('0x8'));module[_0xf4ed('0x9')]=function(_0x3ac930,_0x2f1844){return _0x3ac930[_0xf4ed('0xa')](_0xf4ed('0xb'),attributes,{'tableName':_0xf4ed('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd08b=['api','moment','request-promise','rimraf','exports','define','SquareOdbc','square_odbc','util','../../config/logger'];(function(_0x6287b6,_0x5682e7){var _0x5d6be4=function(_0x3e3975){while(--_0x3e3975){_0x6287b6['push'](_0x6287b6['shift']());}};_0x5d6be4(++_0x5682e7);}(_0xd08b,0xee));var _0xbd08=function(_0x197065,_0x2e79d0){_0x197065=_0x197065-0x0;var _0x3d9404=_0xd08b[_0x197065];return _0x3d9404;};'use strict';var _=require('lodash');var util=require(_0xbd08('0x0'));var logger=require(_0xbd08('0x1'))(_0xbd08('0x2'));var moment=require(_0xbd08('0x3'));var BPromise=require('bluebird');var rp=require(_0xbd08('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xbd08('0x5'));var config=require('../../config/environment');var attributes=require('./squareOdbc.attributes');module[_0xbd08('0x6')]=function(_0x2a1950,_0x49c784){return _0x2a1950[_0xbd08('0x7')](_0xbd08('0x8'),attributes,{'tableName':_0xbd08('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 2c3a25f..c138850 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 _0x8a33=['SquareOdbc','options','raw','where','attributes','include','model','map','info','stringify','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','SquareOdbc,\x20%s,\x20%s','request\x20sent','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','ShowSquareOdbc'];(function(_0x160dae,_0x22c724){var _0x468a71=function(_0x35024d){while(--_0x35024d){_0x160dae['push'](_0x160dae['shift']());}};_0x468a71(++_0x22c724);}(_0x8a33,0x1c4));var _0x38a3=function(_0x43f585,_0x3f8ba8){_0x43f585=_0x43f585-0x0;var _0x399005=_0x8a33[_0x43f585];return _0x399005;};'use strict';var _=require(_0x38a3('0x0'));var util=require('util');var moment=require(_0x38a3('0x1'));var BPromise=require(_0x38a3('0x2'));var rs=require(_0x38a3('0x3'));var fs=require('fs');var Redis=require(_0x38a3('0x4'));var db=require(_0x38a3('0x5'))['db'];var utils=require(_0x38a3('0x6'));var logger=require(_0x38a3('0x7'))(_0x38a3('0x8'));var config=require(_0x38a3('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x38a3('0xa')][_0x38a3('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x31fbef,_0x1de806,_0xb96d79){return new BPromise(function(_0x152ac4,_0x324bca){return client[_0x38a3('0xc')](_0x31fbef,_0xb96d79)[_0x38a3('0xd')](function(_0x2aad2a){logger['info'](_0x38a3('0xe'),_0x1de806,_0x38a3('0xf'));logger[_0x38a3('0x10')](_0x38a3('0x11'),_0x1de806,'request\x20sent',JSON['stringify'](_0x2aad2a));if(_0x2aad2a['error']){if(_0x2aad2a[_0x38a3('0x12')][_0x38a3('0x13')]===0x1f4){logger[_0x38a3('0x12')](_0x38a3('0xe'),_0x1de806,_0x2aad2a[_0x38a3('0x12')][_0x38a3('0x14')]);return _0x324bca(_0x2aad2a[_0x38a3('0x12')][_0x38a3('0x14')]);}logger[_0x38a3('0x12')](_0x38a3('0xe'),_0x1de806,_0x2aad2a[_0x38a3('0x12')][_0x38a3('0x14')]);return _0x152ac4(_0x2aad2a['error'][_0x38a3('0x14')]);}else{logger['info'](_0x38a3('0xe'),_0x1de806,_0x38a3('0xf'));_0x152ac4(_0x2aad2a[_0x38a3('0x15')][_0x38a3('0x14')]);}})[_0x38a3('0x16')](function(_0x5b4179){logger[_0x38a3('0x12')](_0x38a3('0xe'),_0x1de806,_0x5b4179);_0x324bca(_0x5b4179);});});}exports[_0x38a3('0x17')]=function(_0x34d5aa){var _0x1845d8=this;return new Promise(function(_0x3eb41d,_0x5b49bb){return db[_0x38a3('0x18')]['find']({'raw':_0x34d5aa[_0x38a3('0x19')]?_0x34d5aa['options'][_0x38a3('0x1a')]===undefined?!![]:![]:!![],'where':_0x34d5aa['options']?_0x34d5aa[_0x38a3('0x19')][_0x38a3('0x1b')]||null:null,'attributes':_0x34d5aa[_0x38a3('0x19')]?_0x34d5aa[_0x38a3('0x19')][_0x38a3('0x1c')]||null:null,'include':_0x34d5aa['options']?_0x34d5aa['options']['include']?_['map'](_0x34d5aa[_0x38a3('0x19')][_0x38a3('0x1d')],function(_0x13b687){return{'model':db[_0x13b687[_0x38a3('0x1e')]],'as':_0x13b687['as'],'attributes':_0x13b687[_0x38a3('0x1c')],'include':_0x13b687[_0x38a3('0x1d')]?_[_0x38a3('0x1f')](_0x13b687['include'],function(_0x15c28e){return{'model':db[_0x15c28e['model']],'as':_0x15c28e['as'],'attributes':_0x15c28e[_0x38a3('0x1c')],'include':_0x15c28e['include']?_[_0x38a3('0x1f')](_0x15c28e['include'],function(_0x8f3090){return{'model':db[_0x8f3090[_0x38a3('0x1e')]],'as':_0x8f3090['as'],'attributes':_0x8f3090[_0x38a3('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x38a3('0xd')](function(_0x11b04c){logger[_0x38a3('0x20')](_0x38a3('0x17'),_0x34d5aa);logger[_0x38a3('0x10')](_0x38a3('0x17'),_0x34d5aa,JSON[_0x38a3('0x21')](_0x11b04c));_0x3eb41d(_0x11b04c);})[_0x38a3('0x16')](function(_0x264444){logger[_0x38a3('0x12')](_0x38a3('0x17'),_0x264444[_0x38a3('0x14')],_0x34d5aa);_0x5b49bb(_0x1845d8[_0x38a3('0x12')](0x1f4,_0x264444['message']));});});}; \ No newline at end of file +var _0x34a4=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','http','request','then','info','SquareOdbc,\x20%s,\x20%s','request\x20sent','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','ShowSquareOdbc','options','include','model','attributes','map','stringify','util'];(function(_0x5e1459,_0x2d68ac){var _0x54c384=function(_0x2aa499){while(--_0x2aa499){_0x5e1459['push'](_0x5e1459['shift']());}};_0x54c384(++_0x2d68ac);}(_0x34a4,0x1b2));var _0x434a=function(_0x2f59f1,_0xdfe0c6){_0x2f59f1=_0x2f59f1-0x0;var _0x2ee114=_0x34a4[_0x2f59f1];return _0x2ee114;};'use strict';var _=require('lodash');var util=require(_0x434a('0x0'));var moment=require(_0x434a('0x1'));var BPromise=require(_0x434a('0x2'));var rs=require(_0x434a('0x3'));var fs=require('fs');var Redis=require(_0x434a('0x4'));var db=require(_0x434a('0x5'))['db'];var utils=require(_0x434a('0x6'));var logger=require('../../config/logger')(_0x434a('0x7'));var config=require(_0x434a('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x434a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x51093a,_0x16d3e0,_0x6fad18){return new BPromise(function(_0x337068,_0xf273c5){return client[_0x434a('0xa')](_0x51093a,_0x6fad18)[_0x434a('0xb')](function(_0x13b510){logger[_0x434a('0xc')](_0x434a('0xd'),_0x16d3e0,_0x434a('0xe'));logger[_0x434a('0xf')](_0x434a('0x10'),_0x16d3e0,_0x434a('0xe'),JSON['stringify'](_0x13b510));if(_0x13b510[_0x434a('0x11')]){if(_0x13b510[_0x434a('0x11')][_0x434a('0x12')]===0x1f4){logger[_0x434a('0x11')](_0x434a('0xd'),_0x16d3e0,_0x13b510[_0x434a('0x11')][_0x434a('0x13')]);return _0xf273c5(_0x13b510[_0x434a('0x11')][_0x434a('0x13')]);}logger[_0x434a('0x11')](_0x434a('0xd'),_0x16d3e0,_0x13b510[_0x434a('0x11')][_0x434a('0x13')]);return _0x337068(_0x13b510[_0x434a('0x11')][_0x434a('0x13')]);}else{logger['info']('SquareOdbc,\x20%s,\x20%s',_0x16d3e0,_0x434a('0xe'));_0x337068(_0x13b510[_0x434a('0x14')][_0x434a('0x13')]);}})[_0x434a('0x15')](function(_0x2f7d27){logger['error'](_0x434a('0xd'),_0x16d3e0,_0x2f7d27);_0xf273c5(_0x2f7d27);});});}exports[_0x434a('0x16')]=function(_0x7eb234){var _0x40b565=this;return new Promise(function(_0xc9f5d,_0x3188bb){return db['SquareOdbc']['find']({'raw':_0x7eb234[_0x434a('0x17')]?_0x7eb234[_0x434a('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x7eb234[_0x434a('0x17')]?_0x7eb234[_0x434a('0x17')]['where']||null:null,'attributes':_0x7eb234[_0x434a('0x17')]?_0x7eb234[_0x434a('0x17')]['attributes']||null:null,'include':_0x7eb234['options']?_0x7eb234[_0x434a('0x17')][_0x434a('0x18')]?_['map'](_0x7eb234[_0x434a('0x17')][_0x434a('0x18')],function(_0x19527d){return{'model':db[_0x19527d[_0x434a('0x19')]],'as':_0x19527d['as'],'attributes':_0x19527d[_0x434a('0x1a')],'include':_0x19527d[_0x434a('0x18')]?_['map'](_0x19527d[_0x434a('0x18')],function(_0x3da0f4){return{'model':db[_0x3da0f4[_0x434a('0x19')]],'as':_0x3da0f4['as'],'attributes':_0x3da0f4[_0x434a('0x1a')],'include':_0x3da0f4[_0x434a('0x18')]?_[_0x434a('0x1b')](_0x3da0f4[_0x434a('0x18')],function(_0x4cd37b){return{'model':db[_0x4cd37b[_0x434a('0x19')]],'as':_0x4cd37b['as'],'attributes':_0x4cd37b[_0x434a('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5cdfda){logger[_0x434a('0xc')](_0x434a('0x16'),_0x7eb234);logger[_0x434a('0xf')](_0x434a('0x16'),_0x7eb234,JSON[_0x434a('0x1c')](_0x5cdfda));_0xc9f5d(_0x5cdfda);})[_0x434a('0x15')](function(_0x54ed49){logger['error'](_0x434a('0x16'),_0x54ed49[_0x434a('0x13')],_0x7eb234);_0x3188bb(_0x40b565[_0x434a('0x11')](0x1f4,_0x54ed49[_0x434a('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index 46d088a..4f4ab66 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 _0x33f2=['connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','/:id','isAuthenticated','show','create','update','delete','destroy','exports','multer','util','path'];(function(_0x9ff331,_0x2323b0){var _0xc58534=function(_0x228218){while(--_0x228218){_0x9ff331['push'](_0x9ff331['shift']());}};_0xc58534(++_0x2323b0);}(_0x33f2,0x1c8));var _0x233f=function(_0x31a371,_0x50828e){_0x31a371=_0x31a371-0x0;var _0x2a5bd6=_0x33f2[_0x31a371];return _0x2a5bd6;};'use strict';var multer=require(_0x233f('0x0'));var util=require(_0x233f('0x1'));var path=require(_0x233f('0x2'));var timeout=require(_0x233f('0x3'));var express=require(_0x233f('0x4'));var router=express[_0x233f('0x5')]();var fs_extra=require(_0x233f('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x233f('0x7'));var config=require(_0x233f('0x8'));var controller=require('./squareProject.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x233f('0x9'),auth[_0x233f('0xa')](),controller[_0x233f('0xb')]);router['post']('/',auth[_0x233f('0xa')](),controller[_0x233f('0xc')]);router['put'](_0x233f('0x9'),auth[_0x233f('0xa')](),controller[_0x233f('0xd')]);router[_0x233f('0xe')]('/:id',auth[_0x233f('0xa')](),controller[_0x233f('0xf')]);module[_0x233f('0x10')]=router; \ No newline at end of file +var _0x0f9c=['/:id','show','post','create','put','update','delete','destroy','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareProject.controller','isAuthenticated','index'];(function(_0x3c6264,_0x4f6bd6){var _0x2b3b8f=function(_0x2b70ec){while(--_0x2b70ec){_0x3c6264['push'](_0x3c6264['shift']());}};_0x2b3b8f(++_0x4f6bd6);}(_0x0f9c,0xd1));var _0xc0f9=function(_0x497061,_0x126934){_0x497061=_0x497061-0x0;var _0x3c8b58=_0x0f9c[_0x497061];return _0x3c8b58;};'use strict';var multer=require(_0xc0f9('0x0'));var util=require(_0xc0f9('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xc0f9('0x2'));var router=express[_0xc0f9('0x3')]();var fs_extra=require(_0xc0f9('0x4'));var auth=require(_0xc0f9('0x5'));var interaction=require(_0xc0f9('0x6'));var config=require(_0xc0f9('0x7'));var controller=require(_0xc0f9('0x8'));router['get']('/',auth[_0xc0f9('0x9')](),controller[_0xc0f9('0xa')]);router['get'](_0xc0f9('0xb'),auth[_0xc0f9('0x9')](),controller[_0xc0f9('0xc')]);router[_0xc0f9('0xd')]('/',auth[_0xc0f9('0x9')](),controller[_0xc0f9('0xe')]);router[_0xc0f9('0xf')](_0xc0f9('0xb'),auth[_0xc0f9('0x9')](),controller[_0xc0f9('0x10')]);router[_0xc0f9('0x11')](_0xc0f9('0xb'),auth[_0xc0f9('0x9')](),controller[_0xc0f9('0x12')]);module[_0xc0f9('0x13')]=router; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.attributes.js b/server/api/squareProject/squareProject.attributes.js index 63de6f2..a382416 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 _0xa282=['production','utf8','DATE','sequelize','exports','STRING','name','TEXT','BLOB','long','getDataValue','preproduction','toString'];(function(_0x5ed54c,_0x2785e5){var _0x4d8371=function(_0x9a3eae){while(--_0x9a3eae){_0x5ed54c['push'](_0x5ed54c['shift']());}};_0x4d8371(++_0x2785e5);}(_0xa282,0x189));var _0x2a28=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0xa282[_0x5d6456];return _0x4d66c1;};'use strict';var Sequelize=require(_0x2a28('0x0'));module[_0x2a28('0x1')]={'name':{'type':Sequelize[_0x2a28('0x2')],'unique':_0x2a28('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x2a28('0x2')]},'notes':{'type':Sequelize[_0x2a28('0x4')]},'preproduction':{'type':Sequelize[_0x2a28('0x5')](_0x2a28('0x6')),'get':function(){if(this[_0x2a28('0x7')](_0x2a28('0x8'))){return this[_0x2a28('0x7')](_0x2a28('0x8'))[_0x2a28('0x9')]('utf8');}}},'production':{'type':Sequelize['BLOB'](_0x2a28('0x6')),'get':function(){if(this[_0x2a28('0x7')](_0x2a28('0xa'))){return this[_0x2a28('0x7')]('production')[_0x2a28('0x9')](_0x2a28('0xb'));}}},'savedAt':{'type':Sequelize[_0x2a28('0xc')]},'publishedAt':{'type':Sequelize[_0x2a28('0xc')]}}; \ No newline at end of file +var _0xcc66=['getDataValue','preproduction','toString','utf8','production','DATE','sequelize','exports','STRING','name','TEXT','BLOB','long'];(function(_0x102b0c,_0x33dee4){var _0x9b15ca=function(_0x42d504){while(--_0x42d504){_0x102b0c['push'](_0x102b0c['shift']());}};_0x9b15ca(++_0x33dee4);}(_0xcc66,0x1f4));var _0x6cc6=function(_0x4b7b69,_0x3ab075){_0x4b7b69=_0x4b7b69-0x0;var _0x173b4c=_0xcc66[_0x4b7b69];return _0x173b4c;};'use strict';var Sequelize=require(_0x6cc6('0x0'));module[_0x6cc6('0x1')]={'name':{'type':Sequelize[_0x6cc6('0x2')],'unique':_0x6cc6('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x6cc6('0x2')]},'notes':{'type':Sequelize[_0x6cc6('0x4')]},'preproduction':{'type':Sequelize[_0x6cc6('0x5')](_0x6cc6('0x6')),'get':function(){if(this['getDataValue']('preproduction')){return this[_0x6cc6('0x7')](_0x6cc6('0x8'))[_0x6cc6('0x9')](_0x6cc6('0xa'));}}},'production':{'type':Sequelize['BLOB'](_0x6cc6('0x6')),'get':function(){if(this[_0x6cc6('0x7')]('production')){return this['getDataValue'](_0x6cc6('0xb'))['toString'](_0x6cc6('0xa'));}}},'savedAt':{'type':Sequelize['DATE']},'publishedAt':{'type':Sequelize[_0x6cc6('0xc')]}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index 2b9edd2..cbba4ec 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 _0x3863=['role','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','production','ioredis','../../config/logger','api','../../mysqldb','redis','defaults','socket.io-emitter','./squareProject.socket','status','json','offset','undefined','limit','count','update','destroy','get','SquareProjects','publish','agi','stringify','then','end','sendStatus','error','stack','name','index','map','SquareProject','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','pick','filter','where','merge','options','includeAll','rows','catch','params','length','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user'];(function(_0x1d0499,_0x23e22f){var _0x153fb3=function(_0x40c19c){while(--_0x40c19c){_0x1d0499['push'](_0x1d0499['shift']());}};_0x153fb3(++_0x23e22f);}(_0x3863,0xcc));var _0x3386=function(_0x1eb4ca,_0x530bfa){_0x1eb4ca=_0x1eb4ca-0x0;var _0x234ca2=_0x3863[_0x1eb4ca];return _0x234ca2;};'use strict';var _=require('lodash');var Redis=require(_0x3386('0x0'));var qs=require('../../components/parsers/qs');var logger=require(_0x3386('0x1'))(_0x3386('0x2'));var config=require('../../config/environment');var db=require(_0x3386('0x3'))['db'];config[_0x3386('0x4')]=_[_0x3386('0x5')](config[_0x3386('0x4')],{'host':'localhost','port':0x18eb});var socket=require(_0x3386('0x6'))(new Redis(config['redis']));require(_0x3386('0x7'))['register'](socket);function respondWithResult(_0x266d1a,_0x5b09d5){_0x5b09d5=_0x5b09d5||0xc8;return function(_0x21de5b){if(_0x21de5b){return _0x266d1a[_0x3386('0x8')](_0x5b09d5)[_0x3386('0x9')](_0x21de5b);}};}function respondWithFilteredResult(_0x21ce31,_0x518eb0){return function(_0x1a2aea){if(_0x1a2aea){var _0x10e067=typeof _0x518eb0[_0x3386('0xa')]===_0x3386('0xb')&&typeof _0x518eb0[_0x3386('0xc')]===_0x3386('0xb');var _0x2654d0=_0x1a2aea[_0x3386('0xd')];var _0x407782=_0x10e067?0x0:_0x518eb0[_0x3386('0xa')];var _0x171edf=_0x10e067?_0x1a2aea[_0x3386('0xd')]:_0x518eb0[_0x3386('0xa')]+_0x518eb0[_0x3386('0xc')];var _0x370d92;if(_0x171edf>=_0x2654d0){_0x171edf=_0x2654d0;_0x370d92=0xc8;}else{_0x370d92=0xce;}_0x21ce31[_0x3386('0x8')](_0x370d92);return _0x21ce31['set']('Content-Range',_0x407782+'-'+_0x171edf+'/'+_0x2654d0)[_0x3386('0x9')](_0x1a2aea);}return null;};}function saveUpdates(_0x128499){return function(_0x2e593c){if(_0x2e593c){return _0x2e593c[_0x3386('0xe')](_0x128499)['then'](function(_0xda6dba){return _0xda6dba;});}return null;};}function removeEntity(_0x40c50a){return function(_0x431c63){if(_0x431c63){return _0x431c63[_0x3386('0xf')]()['then'](function(){var _0x2efd3b=_0x431c63[_0x3386('0x10')]({'plain':!![]});var _0x303036=_0x3386('0x11');return db['UserProfileResource'][_0x3386('0xf')]({'where':{'type':_0x303036,'resourceId':_0x2efd3b['id']}})['then'](function(){return _0x431c63;});})['then'](function(){var _0x317f04=new Redis(config['redis']);_0x317f04[_0x3386('0x12')](_0x3386('0x13'),JSON[_0x3386('0x14')]({'id':_0x431c63['id'],'deleted':!![]}));})[_0x3386('0x15')](function(){_0x40c50a[_0x3386('0x8')](0xcc)[_0x3386('0x16')]();});}};}function handleEntityNotFound(_0x54714d){return function(_0x28d267){if(!_0x28d267){_0x54714d[_0x3386('0x17')](0x194);}return _0x28d267;};}function handleError(_0x4cbc14,_0x4c4d9f){_0x4c4d9f=_0x4c4d9f||0x1f4;return function(_0x58c71a){logger[_0x3386('0x18')](_0x58c71a[_0x3386('0x19')]);if(_0x58c71a[_0x3386('0x1a')]){delete _0x58c71a[_0x3386('0x1a')];}_0x4cbc14[_0x3386('0x8')](_0x4c4d9f)['send'](_0x58c71a);};}exports[_0x3386('0x1b')]=function(_0x60aa09,_0x7be034){var _0xbc0d34={},_0x3b8e4c={},_0x5b8340={'count':0x0,'rows':[]};var _0x5957a0=_[_0x3386('0x1c')](db[_0x3386('0x1d')][_0x3386('0x1e')],function(_0x4cdd7a){return{'name':_0x4cdd7a[_0x3386('0x1f')],'type':_0x4cdd7a[_0x3386('0x20')][_0x3386('0x21')]};});_0x3b8e4c[_0x3386('0x22')]=_[_0x3386('0x1c')](_0x5957a0,_0x3386('0x1a'));_0x3b8e4c[_0x3386('0x23')]=_[_0x3386('0x24')](_0x60aa09[_0x3386('0x23')]);_0x3b8e4c[_0x3386('0x25')]=_[_0x3386('0x26')](_0x3b8e4c[_0x3386('0x22')],_0x3b8e4c['query']);_0xbc0d34[_0x3386('0x27')]=_[_0x3386('0x26')](_0x3b8e4c[_0x3386('0x22')],qs[_0x3386('0x28')](_0x60aa09[_0x3386('0x23')][_0x3386('0x28')]));_0xbc0d34['attributes']=_0xbc0d34[_0x3386('0x27')]['length']?_0xbc0d34[_0x3386('0x27')]:_0x3b8e4c[_0x3386('0x22')];if(!_0x60aa09[_0x3386('0x23')][_0x3386('0x29')](_0x3386('0x2a'))){_0xbc0d34[_0x3386('0xc')]=qs['limit'](_0x60aa09[_0x3386('0x23')][_0x3386('0xc')]);_0xbc0d34[_0x3386('0xa')]=qs[_0x3386('0xa')](_0x60aa09['query'][_0x3386('0xa')]);}_0xbc0d34['order']=qs[_0x3386('0x2b')](_0x60aa09['query'][_0x3386('0x2b')]);_0xbc0d34['where']=qs['filters'](_[_0x3386('0x2c')](_0x60aa09[_0x3386('0x23')],_0x3b8e4c[_0x3386('0x25')]),_0x5957a0);if(_0x60aa09[_0x3386('0x23')][_0x3386('0x2d')]){_0xbc0d34[_0x3386('0x2e')]=_[_0x3386('0x2f')](_0xbc0d34['where'],{'$or':_[_0x3386('0x1c')](_0x5957a0,function(_0x727283){if(_0x727283['type']!=='VIRTUAL'){var _0x41ed91={};_0x41ed91[_0x727283['name']]={'$like':'%'+_0x60aa09[_0x3386('0x23')][_0x3386('0x2d')]+'%'};return _0x41ed91;}})});}_0xbc0d34=_[_0x3386('0x2f')]({},_0xbc0d34,_0x60aa09[_0x3386('0x30')]);var _0x40ceab={'where':_0xbc0d34[_0x3386('0x2e')]};return db[_0x3386('0x1d')][_0x3386('0xd')](_0x40ceab)[_0x3386('0x15')](function(_0x27df0f){_0x5b8340[_0x3386('0xd')]=_0x27df0f;if(_0x60aa09['query'][_0x3386('0x31')]){_0xbc0d34['include']=[{'all':!![]}];}return db[_0x3386('0x1d')]['findAll'](_0xbc0d34);})[_0x3386('0x15')](function(_0x54caf7){_0x5b8340[_0x3386('0x32')]=_0x54caf7;return _0x5b8340;})[_0x3386('0x15')](respondWithFilteredResult(_0x7be034,_0xbc0d34))[_0x3386('0x33')](handleError(_0x7be034,null));};exports['show']=function(_0x11a4c9,_0xd5791b){var _0x5822a3={'raw':![],'where':{'id':_0x11a4c9[_0x3386('0x34')]['id']}},_0x31006a={};_0x31006a['model']=_[_0x3386('0x24')](db[_0x3386('0x1d')][_0x3386('0x1e')]);_0x31006a[_0x3386('0x23')]=_[_0x3386('0x24')](_0x11a4c9[_0x3386('0x23')]);_0x31006a['filters']=_[_0x3386('0x26')](_0x31006a[_0x3386('0x22')],_0x31006a[_0x3386('0x23')]);_0x5822a3[_0x3386('0x27')]=_[_0x3386('0x26')](_0x31006a['model'],qs[_0x3386('0x28')](_0x11a4c9[_0x3386('0x23')][_0x3386('0x28')]));_0x5822a3[_0x3386('0x27')]=_0x5822a3[_0x3386('0x27')][_0x3386('0x35')]?_0x5822a3[_0x3386('0x27')]:_0x31006a[_0x3386('0x22')];if(_0x11a4c9[_0x3386('0x23')][_0x3386('0x31')]){_0x5822a3[_0x3386('0x36')]=[{'all':!![]}];}_0x5822a3=_[_0x3386('0x2f')]({},_0x5822a3,_0x11a4c9[_0x3386('0x30')]);return db[_0x3386('0x1d')][_0x3386('0x37')](_0x5822a3)[_0x3386('0x15')](handleEntityNotFound(_0xd5791b,null))[_0x3386('0x15')](respondWithResult(_0xd5791b,null))[_0x3386('0x33')](handleError(_0xd5791b,null));};exports[_0x3386('0x38')]=function(_0x4e5062,_0x3f394d){return db['SquareProject']['create'](_0x4e5062[_0x3386('0x39')],{})[_0x3386('0x15')](function(_0x5b8209){var _0x3b825d=_0x4e5062[_0x3386('0x3a')]['get']({'plain':!![]});if(!_0x3b825d)throw new Error(_0x3386('0x3b'));if(_0x3b825d[_0x3386('0x3c')]==='user'){var _0x2ea2b8=_0x5b8209[_0x3386('0x10')]({'plain':!![]});var _0x360f42=_0x3386('0x11');return db[_0x3386('0x3d')][_0x3386('0x37')]({'where':{'name':_0x360f42,'userProfileId':_0x3b825d[_0x3386('0x3e')]},'raw':!![]})[_0x3386('0x15')](function(_0x463f80){if(_0x463f80&&_0x463f80['autoAssociation']===0x0){return db[_0x3386('0x3f')][_0x3386('0x38')]({'name':_0x2ea2b8[_0x3386('0x1a')],'resourceId':_0x2ea2b8['id'],'type':_0x463f80['name'],'sectionId':_0x463f80['id']},{})[_0x3386('0x15')](function(){return _0x5b8209;});}else{return _0x5b8209;}})[_0x3386('0x33')](function(_0x157fe2){logger[_0x3386('0x18')](_0x3386('0x40'),_0x157fe2);throw _0x157fe2;});}return _0x5b8209;})[_0x3386('0x15')](respondWithResult(_0x3f394d,0xc9))[_0x3386('0x33')](handleError(_0x3f394d,null));};exports[_0x3386('0xe')]=function(_0x2c8274,_0x690a65){if(_0x2c8274[_0x3386('0x39')]['id']){delete _0x2c8274['body']['id'];}return db[_0x3386('0x1d')][_0x3386('0x37')]({'where':{'id':_0x2c8274[_0x3386('0x34')]['id']}})[_0x3386('0x15')](handleEntityNotFound(_0x690a65,null))['then'](saveUpdates(_0x2c8274[_0x3386('0x39')],null))[_0x3386('0x15')](function(_0xee2c37){if(!_0xee2c37)return;var _0x17bb05=_0xee2c37[_0x3386('0x10')]({'plain':!![]});return _0x17bb05;})['then'](function(_0x1eb79d){var _0x8f6910=new Redis(config[_0x3386('0x4')]);_0x8f6910[_0x3386('0x12')](_0x3386('0x13'),JSON['stringify'](_[_0x3386('0x2c')](_0x1eb79d,['id',_0x3386('0x1a'),_0x3386('0x41')])));return _0x1eb79d;})['then'](respondWithResult(_0x690a65,null))[_0x3386('0x33')](handleError(_0x690a65,null));};exports[_0x3386('0xf')]=function(_0x497aef,_0x534105){return db[_0x3386('0x1d')][_0x3386('0x37')]({'where':{'id':_0x497aef[_0x3386('0x34')]['id']}})[_0x3386('0x15')](handleEntityNotFound(_0x534105,null))[_0x3386('0x15')](removeEntity(_0x534105,null))['catch'](handleError(_0x534105,null));}; \ No newline at end of file +var _0xdf72=['rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','name','options','SquareProject','includeAll','include','findAll','catch','length','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','pick','production','lodash','ioredis','../../config/logger','../../config/environment','../../mysqldb','redis','localhost','./squareProject.socket','register','status','json','undefined','offset','count','limit','set','Content-Range','update','then','destroy','SquareProjects','UserProfileResource','publish','agi','stringify','stack','send','index','map'];(function(_0x42bdad,_0x12836c){var _0x122626=function(_0x2eb29c){while(--_0x2eb29c){_0x42bdad['push'](_0x42bdad['shift']());}};_0x122626(++_0x12836c);}(_0xdf72,0x181));var _0x2df7=function(_0x46efd7,_0x43f84d){_0x46efd7=_0x46efd7-0x0;var _0x5637e4=_0xdf72[_0x46efd7];return _0x5637e4;};'use strict';var _=require(_0x2df7('0x0'));var Redis=require(_0x2df7('0x1'));var qs=require('../../components/parsers/qs');var logger=require(_0x2df7('0x2'))('api');var config=require(_0x2df7('0x3'));var db=require(_0x2df7('0x4'))['db'];config[_0x2df7('0x5')]=_['defaults'](config[_0x2df7('0x5')],{'host':_0x2df7('0x6'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x2df7('0x7'))[_0x2df7('0x8')](socket);function respondWithResult(_0x2d900a,_0x2d2f49){_0x2d2f49=_0x2d2f49||0xc8;return function(_0x19af37){if(_0x19af37){return _0x2d900a[_0x2df7('0x9')](_0x2d2f49)[_0x2df7('0xa')](_0x19af37);}};}function respondWithFilteredResult(_0x2d614d,_0x52b6bc){return function(_0x54c41e){if(_0x54c41e){var _0x464166=typeof _0x52b6bc['offset']==='undefined'&&typeof _0x52b6bc['limit']===_0x2df7('0xb');var _0x15b760=_0x54c41e['count'];var _0x36ecd4=_0x464166?0x0:_0x52b6bc[_0x2df7('0xc')];var _0x446a4d=_0x464166?_0x54c41e[_0x2df7('0xd')]:_0x52b6bc[_0x2df7('0xc')]+_0x52b6bc[_0x2df7('0xe')];var _0xf1d044;if(_0x446a4d>=_0x15b760){_0x446a4d=_0x15b760;_0xf1d044=0xc8;}else{_0xf1d044=0xce;}_0x2d614d[_0x2df7('0x9')](_0xf1d044);return _0x2d614d[_0x2df7('0xf')](_0x2df7('0x10'),_0x36ecd4+'-'+_0x446a4d+'/'+_0x15b760)['json'](_0x54c41e);}return null;};}function saveUpdates(_0x5c1b82){return function(_0x21bcac){if(_0x21bcac){return _0x21bcac[_0x2df7('0x11')](_0x5c1b82)[_0x2df7('0x12')](function(_0xe83263){return _0xe83263;});}return null;};}function removeEntity(_0x57aee3){return function(_0xbedfb7){if(_0xbedfb7){return _0xbedfb7[_0x2df7('0x13')]()[_0x2df7('0x12')](function(){var _0x171188=_0xbedfb7['get']({'plain':!![]});var _0x109db6=_0x2df7('0x14');return db[_0x2df7('0x15')][_0x2df7('0x13')]({'where':{'type':_0x109db6,'resourceId':_0x171188['id']}})[_0x2df7('0x12')](function(){return _0xbedfb7;});})[_0x2df7('0x12')](function(){var _0x24927d=new Redis(config['redis']);_0x24927d[_0x2df7('0x16')](_0x2df7('0x17'),JSON[_0x2df7('0x18')]({'id':_0xbedfb7['id'],'deleted':!![]}));})['then'](function(){_0x57aee3[_0x2df7('0x9')](0xcc)['end']();});}};}function handleEntityNotFound(_0xe013e2){return function(_0x2c02ce){if(!_0x2c02ce){_0xe013e2['sendStatus'](0x194);}return _0x2c02ce;};}function handleError(_0x3c7c99,_0x595ecc){_0x595ecc=_0x595ecc||0x1f4;return function(_0x539b37){logger['error'](_0x539b37[_0x2df7('0x19')]);if(_0x539b37['name']){delete _0x539b37['name'];}_0x3c7c99[_0x2df7('0x9')](_0x595ecc)[_0x2df7('0x1a')](_0x539b37);};}exports[_0x2df7('0x1b')]=function(_0x2dfb47,_0x1e3ad2){var _0x56631d={},_0x3e83dd={},_0x394ee8={'count':0x0,'rows':[]};var _0x5aa607=_[_0x2df7('0x1c')](db['SquareProject'][_0x2df7('0x1d')],function(_0x32be0c){return{'name':_0x32be0c[_0x2df7('0x1e')],'type':_0x32be0c[_0x2df7('0x1f')][_0x2df7('0x20')]};});_0x3e83dd[_0x2df7('0x21')]=_[_0x2df7('0x1c')](_0x5aa607,'name');_0x3e83dd[_0x2df7('0x22')]=_[_0x2df7('0x23')](_0x2dfb47[_0x2df7('0x22')]);_0x3e83dd[_0x2df7('0x24')]=_[_0x2df7('0x25')](_0x3e83dd[_0x2df7('0x21')],_0x3e83dd[_0x2df7('0x22')]);_0x56631d[_0x2df7('0x26')]=_[_0x2df7('0x25')](_0x3e83dd[_0x2df7('0x21')],qs[_0x2df7('0x27')](_0x2dfb47[_0x2df7('0x22')][_0x2df7('0x27')]));_0x56631d[_0x2df7('0x26')]=_0x56631d[_0x2df7('0x26')]['length']?_0x56631d[_0x2df7('0x26')]:_0x3e83dd[_0x2df7('0x21')];if(!_0x2dfb47[_0x2df7('0x22')][_0x2df7('0x28')](_0x2df7('0x29'))){_0x56631d[_0x2df7('0xe')]=qs[_0x2df7('0xe')](_0x2dfb47[_0x2df7('0x22')][_0x2df7('0xe')]);_0x56631d[_0x2df7('0xc')]=qs[_0x2df7('0xc')](_0x2dfb47['query'][_0x2df7('0xc')]);}_0x56631d[_0x2df7('0x2a')]=qs[_0x2df7('0x2b')](_0x2dfb47['query']['sort']);_0x56631d[_0x2df7('0x2c')]=qs[_0x2df7('0x24')](_['pick'](_0x2dfb47[_0x2df7('0x22')],_0x3e83dd['filters']),_0x5aa607);if(_0x2dfb47[_0x2df7('0x22')]['filter']){_0x56631d[_0x2df7('0x2c')]=_[_0x2df7('0x2d')](_0x56631d[_0x2df7('0x2c')],{'$or':_[_0x2df7('0x1c')](_0x5aa607,function(_0x4086d4){if(_0x4086d4['type']!==_0x2df7('0x2e')){var _0x2d0648={};_0x2d0648[_0x4086d4[_0x2df7('0x2f')]]={'$like':'%'+_0x2dfb47[_0x2df7('0x22')]['filter']+'%'};return _0x2d0648;}})});}_0x56631d=_['merge']({},_0x56631d,_0x2dfb47[_0x2df7('0x30')]);var _0x5610b4={'where':_0x56631d[_0x2df7('0x2c')]};return db[_0x2df7('0x31')][_0x2df7('0xd')](_0x5610b4)['then'](function(_0x1177a0){_0x394ee8[_0x2df7('0xd')]=_0x1177a0;if(_0x2dfb47['query'][_0x2df7('0x32')]){_0x56631d[_0x2df7('0x33')]=[{'all':!![]}];}return db['SquareProject'][_0x2df7('0x34')](_0x56631d);})[_0x2df7('0x12')](function(_0x4e0f8f){_0x394ee8['rows']=_0x4e0f8f;return _0x394ee8;})['then'](respondWithFilteredResult(_0x1e3ad2,_0x56631d))[_0x2df7('0x35')](handleError(_0x1e3ad2,null));};exports['show']=function(_0x273a97,_0x4f19f2){var _0x28ea02={'raw':![],'where':{'id':_0x273a97['params']['id']}},_0x163bb0={};_0x163bb0[_0x2df7('0x21')]=_[_0x2df7('0x23')](db[_0x2df7('0x31')][_0x2df7('0x1d')]);_0x163bb0[_0x2df7('0x22')]=_[_0x2df7('0x23')](_0x273a97[_0x2df7('0x22')]);_0x163bb0[_0x2df7('0x24')]=_[_0x2df7('0x25')](_0x163bb0['model'],_0x163bb0[_0x2df7('0x22')]);_0x28ea02[_0x2df7('0x26')]=_[_0x2df7('0x25')](_0x163bb0[_0x2df7('0x21')],qs['fields'](_0x273a97[_0x2df7('0x22')][_0x2df7('0x27')]));_0x28ea02['attributes']=_0x28ea02['attributes'][_0x2df7('0x36')]?_0x28ea02['attributes']:_0x163bb0['model'];if(_0x273a97[_0x2df7('0x22')]['includeAll']){_0x28ea02[_0x2df7('0x33')]=[{'all':!![]}];}_0x28ea02=_[_0x2df7('0x2d')]({},_0x28ea02,_0x273a97[_0x2df7('0x30')]);return db['SquareProject'][_0x2df7('0x37')](_0x28ea02)[_0x2df7('0x12')](handleEntityNotFound(_0x4f19f2,null))[_0x2df7('0x12')](respondWithResult(_0x4f19f2,null))[_0x2df7('0x35')](handleError(_0x4f19f2,null));};exports[_0x2df7('0x38')]=function(_0x5e4c43,_0x3516ff){return db['SquareProject'][_0x2df7('0x38')](_0x5e4c43['body'],{})[_0x2df7('0x12')](function(_0x2b7619){var _0x2e48d7=_0x5e4c43[_0x2df7('0x39')]['get']({'plain':!![]});if(!_0x2e48d7)throw new Error(_0x2df7('0x3a'));if(_0x2e48d7[_0x2df7('0x3b')]==='user'){var _0x5048d6=_0x2b7619[_0x2df7('0x3c')]({'plain':!![]});var _0x3e85b=_0x2df7('0x14');return db[_0x2df7('0x3d')][_0x2df7('0x37')]({'where':{'name':_0x3e85b,'userProfileId':_0x2e48d7[_0x2df7('0x3e')]},'raw':!![]})[_0x2df7('0x12')](function(_0x4d84b8){if(_0x4d84b8&&_0x4d84b8['autoAssociation']===0x0){return db[_0x2df7('0x15')][_0x2df7('0x38')]({'name':_0x5048d6[_0x2df7('0x2f')],'resourceId':_0x5048d6['id'],'type':_0x4d84b8[_0x2df7('0x2f')],'sectionId':_0x4d84b8['id']},{})[_0x2df7('0x12')](function(){return _0x2b7619;});}else{return _0x2b7619;}})[_0x2df7('0x35')](function(_0x1d7a1f){logger[_0x2df7('0x3f')](_0x2df7('0x40'),_0x1d7a1f);throw _0x1d7a1f;});}return _0x2b7619;})[_0x2df7('0x12')](respondWithResult(_0x3516ff,0xc9))['catch'](handleError(_0x3516ff,null));};exports[_0x2df7('0x11')]=function(_0x10b8b1,_0x3ed58c){if(_0x10b8b1[_0x2df7('0x41')]['id']){delete _0x10b8b1[_0x2df7('0x41')]['id'];}return db[_0x2df7('0x31')][_0x2df7('0x37')]({'where':{'id':_0x10b8b1[_0x2df7('0x42')]['id']}})[_0x2df7('0x12')](handleEntityNotFound(_0x3ed58c,null))[_0x2df7('0x12')](saveUpdates(_0x10b8b1[_0x2df7('0x41')],null))[_0x2df7('0x12')](function(_0x53ab25){if(!_0x53ab25)return;var _0x247a9b=_0x53ab25[_0x2df7('0x3c')]({'plain':!![]});return _0x247a9b;})[_0x2df7('0x12')](function(_0x15fe00){var _0x3d903e=new Redis(config[_0x2df7('0x5')]);_0x3d903e[_0x2df7('0x16')](_0x2df7('0x17'),JSON['stringify'](_[_0x2df7('0x43')](_0x15fe00,['id','name',_0x2df7('0x44')])));return _0x15fe00;})[_0x2df7('0x12')](respondWithResult(_0x3ed58c,null))[_0x2df7('0x35')](handleError(_0x3ed58c,null));};exports[_0x2df7('0x13')]=function(_0x52e2d3,_0x4239cb){return db[_0x2df7('0x31')][_0x2df7('0x37')]({'where':{'id':_0x52e2d3['params']['id']}})['then'](handleEntityNotFound(_0x4239cb,null))[_0x2df7('0x12')](removeEntity(_0x4239cb,null))['catch'](handleError(_0x4239cb,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index 86fbd67..0607500 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 _0x0bfd=['hook','exports','SquareProject','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x1ad9c6,_0x4042af){var _0x38d321=function(_0x1e66fa){while(--_0x1e66fa){_0x1ad9c6['push'](_0x1ad9c6['shift']());}};_0x38d321(++_0x4042af);}(_0x0bfd,0xa4));var _0xd0bf=function(_0x438281,_0x255640){_0x438281=_0x438281-0x0;var _0x1aed2d=_0x0bfd[_0x438281];return _0x1aed2d;};'use strict';var EventEmitter=require('events');var SquareProject=require('../../mysqldb')['db'][_0xd0bf('0x0')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0xd0bf('0x1')](0x0);var events={'afterCreate':_0xd0bf('0x2'),'afterUpdate':_0xd0bf('0x3'),'afterDestroy':_0xd0bf('0x4')};function emitEvent(_0x9f911d){return function(_0xf0ef0a,_0x2503cb,_0x1b4c28){SquareProjectEvents[_0xd0bf('0x5')](_0x9f911d+':'+_0xf0ef0a['id'],_0xf0ef0a);SquareProjectEvents[_0xd0bf('0x5')](_0x9f911d,_0xf0ef0a);_0x1b4c28(null);};}for(var e in events){if(events[_0xd0bf('0x6')](e)){var event=events[e];SquareProject[_0xd0bf('0x7')](e,emitEvent(event));}}module[_0xd0bf('0x8')]=SquareProjectEvents; \ No newline at end of file +var _0x235a=['remove','emit','exports','events','SquareProject','setMaxListeners','save','update'];(function(_0x48d3fe,_0x18c913){var _0x5f4219=function(_0x48e50e){while(--_0x48e50e){_0x48d3fe['push'](_0x48d3fe['shift']());}};_0x5f4219(++_0x18c913);}(_0x235a,0x193));var _0xa235=function(_0x5ed226,_0x1e1f0a){_0x5ed226=_0x5ed226-0x0;var _0x2e7859=_0x235a[_0x5ed226];return _0x2e7859;};'use strict';var EventEmitter=require(_0xa235('0x0'));var SquareProject=require('../../mysqldb')['db'][_0xa235('0x1')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0xa235('0x2')](0x0);var events={'afterCreate':_0xa235('0x3'),'afterUpdate':_0xa235('0x4'),'afterDestroy':_0xa235('0x5')};function emitEvent(_0x221aed){return function(_0x142a43,_0x17311d,_0x3bf1d5){SquareProjectEvents[_0xa235('0x6')](_0x221aed+':'+_0x142a43['id'],_0x142a43);SquareProjectEvents[_0xa235('0x6')](_0x221aed,_0x142a43);_0x3bf1d5(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SquareProject['hook'](e,emitEvent(event));}}module[_0xa235('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 16e6819..9a8bafa 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 _0x6e3a=['rimraf','./squareProject.attributes','exports','define','square_projects','changed','savedAt','format','YYYY-MM-DD\x20HH:mm:ss','production','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x48a809,_0x5bd939){var _0x5c0064=function(_0x7ff42c){while(--_0x7ff42c){_0x48a809['push'](_0x48a809['shift']());}};_0x5c0064(++_0x5bd939);}(_0x6e3a,0x13c));var _0xa6e3=function(_0x28d8bd,_0x2a9333){_0x28d8bd=_0x28d8bd-0x0;var _0x4eacd4=_0x6e3a[_0x28d8bd];return _0x4eacd4;};'use strict';var _=require(_0xa6e3('0x0'));var util=require(_0xa6e3('0x1'));var logger=require(_0xa6e3('0x2'))(_0xa6e3('0x3'));var moment=require(_0xa6e3('0x4'));var BPromise=require(_0xa6e3('0x5'));var rp=require(_0xa6e3('0x6'));var fs=require('fs');var path=require(_0xa6e3('0x7'));var rimraf=require(_0xa6e3('0x8'));var config=require('../../config/environment');var attributes=require(_0xa6e3('0x9'));module[_0xa6e3('0xa')]=function(_0x20bf92,_0x323249){return _0x20bf92[_0xa6e3('0xb')]('SquareProject',attributes,{'tableName':_0xa6e3('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x330a55,_0x2688d9,_0x526a31){if(_0x330a55[_0xa6e3('0xd')]('preproduction')){_0x330a55[_0xa6e3('0xe')]=moment()[_0xa6e3('0xf')](_0xa6e3('0x10'));}if(_0x330a55[_0xa6e3('0xd')](_0xa6e3('0x11'))){_0x330a55['publishedAt']=moment()[_0xa6e3('0xf')](_0xa6e3('0x10'));}_0x526a31(null,_0x330a55);}}});}; \ No newline at end of file +var _0x71de=['exports','changed','preproduction','savedAt','YYYY-MM-DD\x20HH:mm:ss','publishedAt','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./squareProject.attributes'];(function(_0x176a2e,_0x208408){var _0x57228a=function(_0x5961d3){while(--_0x5961d3){_0x176a2e['push'](_0x176a2e['shift']());}};_0x57228a(++_0x208408);}(_0x71de,0xb6));var _0xe71d=function(_0x3fa819,_0x38bc8e){_0x3fa819=_0x3fa819-0x0;var _0x403f35=_0x71de[_0x3fa819];return _0x403f35;};'use strict';var _=require(_0xe71d('0x0'));var util=require(_0xe71d('0x1'));var logger=require(_0xe71d('0x2'))(_0xe71d('0x3'));var moment=require(_0xe71d('0x4'));var BPromise=require(_0xe71d('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe71d('0x6'));var rimraf=require(_0xe71d('0x7'));var config=require(_0xe71d('0x8'));var attributes=require(_0xe71d('0x9'));module[_0xe71d('0xa')]=function(_0x2bfc7c,_0x4f1a09){return _0x2bfc7c['define']('SquareProject',attributes,{'tableName':'square_projects','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x489b27,_0xb8d7ac,_0x59a761){if(_0x489b27[_0xe71d('0xb')](_0xe71d('0xc'))){_0x489b27[_0xe71d('0xd')]=moment()['format'](_0xe71d('0xe'));}if(_0x489b27[_0xe71d('0xb')]('production')){_0x489b27[_0xe71d('0xf')]=moment()['format'](_0xe71d('0xe'));}_0x59a761(null,_0x489b27);}}});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index 153c1b0..39096f9 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 _0xcb6b=['info','stringify','lodash','../../mysqldb','rpc','../../config/environment','redis','defaults','localhost','socket.io-emitter','./squareProject.socket','register','SquareProject','options','raw','where','attributes','limit','include','map','model','GetSquareProjects','debug','catch','error','message','ShowSquareProject','find','then'];(function(_0x3fa469,_0x57cf49){var _0x2e27dc=function(_0x1ccc9b){while(--_0x1ccc9b){_0x3fa469['push'](_0x3fa469['shift']());}};_0x2e27dc(++_0x57cf49);}(_0xcb6b,0xea));var _0xbcb6=function(_0x4138c5,_0x16cdf4){_0x4138c5=_0x4138c5-0x0;var _0x376efc=_0xcb6b[_0x4138c5];return _0x376efc;};'use strict';var _=require(_0xbcb6('0x0'));var Redis=require('ioredis');var db=require(_0xbcb6('0x1'))['db'];var logger=require('../../config/logger')(_0xbcb6('0x2'));var config=require(_0xbcb6('0x3'));config[_0xbcb6('0x4')]=_[_0xbcb6('0x5')](config['redis'],{'host':_0xbcb6('0x6'),'port':0x18eb});var socket=require(_0xbcb6('0x7'))(new Redis(config[_0xbcb6('0x4')]));require(_0xbcb6('0x8'))[_0xbcb6('0x9')](socket);exports['GetSquareProjects']=function(_0x44ff9c){var _0x4dc735=this;return new Promise(function(_0xb0194,_0x54a114){return db[_0xbcb6('0xa')]['findAll']({'raw':_0x44ff9c['options']?_0x44ff9c[_0xbcb6('0xb')][_0xbcb6('0xc')]===undefined?!![]:![]:!![],'where':_0x44ff9c['options']?_0x44ff9c['options'][_0xbcb6('0xd')]||null:null,'attributes':_0x44ff9c[_0xbcb6('0xb')]?_0x44ff9c[_0xbcb6('0xb')][_0xbcb6('0xe')]||null:null,'limit':_0x44ff9c[_0xbcb6('0xb')]?_0x44ff9c['options'][_0xbcb6('0xf')]||null:null,'include':_0x44ff9c['options']?_0x44ff9c[_0xbcb6('0xb')][_0xbcb6('0x10')]?_[_0xbcb6('0x11')](_0x44ff9c[_0xbcb6('0xb')]['include'],function(_0x4b2a50){return{'model':db[_0x4b2a50[_0xbcb6('0x12')]],'as':_0x4b2a50['as'],'attributes':_0x4b2a50[_0xbcb6('0xe')],'include':_0x4b2a50[_0xbcb6('0x10')]?_[_0xbcb6('0x11')](_0x4b2a50[_0xbcb6('0x10')],function(_0x1c2144){return{'model':db[_0x1c2144[_0xbcb6('0x12')]],'as':_0x1c2144['as'],'attributes':_0x1c2144[_0xbcb6('0xe')],'include':_0x1c2144['include']?_[_0xbcb6('0x11')](_0x1c2144[_0xbcb6('0x10')],function(_0x59a806){return{'model':db[_0x59a806[_0xbcb6('0x12')]],'as':_0x59a806['as'],'attributes':_0x59a806[_0xbcb6('0xe')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x465b73){logger['info'](_0xbcb6('0x13'),_0x44ff9c);logger[_0xbcb6('0x14')](_0xbcb6('0x13'),_0x44ff9c,JSON['stringify'](_0x465b73));_0xb0194(_0x465b73);})[_0xbcb6('0x15')](function(_0xf39ed1){logger[_0xbcb6('0x16')](_0xbcb6('0x13'),_0xf39ed1[_0xbcb6('0x17')],_0x44ff9c);_0x54a114(_0x4dc735[_0xbcb6('0x16')](0x1f4,_0xf39ed1[_0xbcb6('0x17')]));});});};exports[_0xbcb6('0x18')]=function(_0x1b4790){var _0x53bfe6=this;return new Promise(function(_0x541929,_0xa08ed7){return db['SquareProject'][_0xbcb6('0x19')]({'raw':_0x1b4790[_0xbcb6('0xb')]?_0x1b4790[_0xbcb6('0xb')][_0xbcb6('0xc')]===undefined?!![]:![]:!![],'where':_0x1b4790['options']?_0x1b4790['options'][_0xbcb6('0xd')]||null:null,'attributes':_0x1b4790[_0xbcb6('0xb')]?_0x1b4790['options'][_0xbcb6('0xe')]||null:null,'include':_0x1b4790['options']?_0x1b4790['options'][_0xbcb6('0x10')]?_[_0xbcb6('0x11')](_0x1b4790['options'][_0xbcb6('0x10')],function(_0x4cebc2){return{'model':db[_0x4cebc2['model']],'as':_0x4cebc2['as'],'attributes':_0x4cebc2[_0xbcb6('0xe')],'include':_0x4cebc2[_0xbcb6('0x10')]?_[_0xbcb6('0x11')](_0x4cebc2[_0xbcb6('0x10')],function(_0x567696){return{'model':db[_0x567696[_0xbcb6('0x12')]],'as':_0x567696['as'],'attributes':_0x567696[_0xbcb6('0xe')],'include':_0x567696[_0xbcb6('0x10')]?_[_0xbcb6('0x11')](_0x567696['include'],function(_0x18a93e){return{'model':db[_0x18a93e['model']],'as':_0x18a93e['as'],'attributes':_0x18a93e['attributes']};}):[]};}):[]};}):[]:[]})[_0xbcb6('0x1a')](function(_0x2056c1){logger[_0xbcb6('0x1b')](_0xbcb6('0x18'),_0x1b4790);logger['debug']('ShowSquareProject',_0x1b4790,JSON[_0xbcb6('0x1c')](_0x2056c1));_0x541929(_0x2056c1);})[_0xbcb6('0x15')](function(_0x175b10){logger[_0xbcb6('0x16')]('ShowSquareProject',_0x175b10[_0xbcb6('0x17')],_0x1b4790);_0xa08ed7(_0x53bfe6[_0xbcb6('0x16')](0x1f4,_0x175b10['message']));});});}; \ No newline at end of file +var _0x372a=['./squareProject.socket','register','GetSquareProjects','SquareProject','raw','options','where','attributes','limit','include','map','model','then','info','debug','stringify','catch','message','error','ShowSquareProject','find','lodash','ioredis','../../config/logger','../../config/environment','redis','defaults','localhost','socket.io-emitter'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x372a,0xfd));var _0xa372=function(_0x4f9f0c,_0x499a73){_0x4f9f0c=_0x4f9f0c-0x0;var _0x366119=_0x372a[_0x4f9f0c];return _0x366119;};'use strict';var _=require(_0xa372('0x0'));var Redis=require(_0xa372('0x1'));var db=require('../../mysqldb')['db'];var logger=require(_0xa372('0x2'))('rpc');var config=require(_0xa372('0x3'));config[_0xa372('0x4')]=_[_0xa372('0x5')](config[_0xa372('0x4')],{'host':_0xa372('0x6'),'port':0x18eb});var socket=require(_0xa372('0x7'))(new Redis(config[_0xa372('0x4')]));require(_0xa372('0x8'))[_0xa372('0x9')](socket);exports[_0xa372('0xa')]=function(_0x2a674e){var _0xf1dbae=this;return new Promise(function(_0x311116,_0x1d29cf){return db[_0xa372('0xb')]['findAll']({'raw':_0x2a674e['options']?_0x2a674e['options'][_0xa372('0xc')]===undefined?!![]:![]:!![],'where':_0x2a674e['options']?_0x2a674e[_0xa372('0xd')][_0xa372('0xe')]||null:null,'attributes':_0x2a674e[_0xa372('0xd')]?_0x2a674e['options'][_0xa372('0xf')]||null:null,'limit':_0x2a674e[_0xa372('0xd')]?_0x2a674e['options'][_0xa372('0x10')]||null:null,'include':_0x2a674e['options']?_0x2a674e[_0xa372('0xd')][_0xa372('0x11')]?_[_0xa372('0x12')](_0x2a674e[_0xa372('0xd')]['include'],function(_0x571239){return{'model':db[_0x571239[_0xa372('0x13')]],'as':_0x571239['as'],'attributes':_0x571239['attributes'],'include':_0x571239[_0xa372('0x11')]?_['map'](_0x571239[_0xa372('0x11')],function(_0x3c6deb){return{'model':db[_0x3c6deb[_0xa372('0x13')]],'as':_0x3c6deb['as'],'attributes':_0x3c6deb[_0xa372('0xf')],'include':_0x3c6deb[_0xa372('0x11')]?_[_0xa372('0x12')](_0x3c6deb[_0xa372('0x11')],function(_0x591518){return{'model':db[_0x591518[_0xa372('0x13')]],'as':_0x591518['as'],'attributes':_0x591518[_0xa372('0xf')]};}):[]};}):[]};}):[]:[]})[_0xa372('0x14')](function(_0x20a33e){logger[_0xa372('0x15')]('GetSquareProjects',_0x2a674e);logger[_0xa372('0x16')](_0xa372('0xa'),_0x2a674e,JSON[_0xa372('0x17')](_0x20a33e));_0x311116(_0x20a33e);})[_0xa372('0x18')](function(_0x393cc3){logger['error']('GetSquareProjects',_0x393cc3[_0xa372('0x19')],_0x2a674e);_0x1d29cf(_0xf1dbae[_0xa372('0x1a')](0x1f4,_0x393cc3[_0xa372('0x19')]));});});};exports[_0xa372('0x1b')]=function(_0x57c8b9){var _0x45e480=this;return new Promise(function(_0x37c1c9,_0x497f35){return db[_0xa372('0xb')][_0xa372('0x1c')]({'raw':_0x57c8b9[_0xa372('0xd')]?_0x57c8b9[_0xa372('0xd')][_0xa372('0xc')]===undefined?!![]:![]:!![],'where':_0x57c8b9['options']?_0x57c8b9[_0xa372('0xd')][_0xa372('0xe')]||null:null,'attributes':_0x57c8b9[_0xa372('0xd')]?_0x57c8b9[_0xa372('0xd')][_0xa372('0xf')]||null:null,'include':_0x57c8b9[_0xa372('0xd')]?_0x57c8b9['options']['include']?_[_0xa372('0x12')](_0x57c8b9[_0xa372('0xd')][_0xa372('0x11')],function(_0x1be1f8){return{'model':db[_0x1be1f8[_0xa372('0x13')]],'as':_0x1be1f8['as'],'attributes':_0x1be1f8[_0xa372('0xf')],'include':_0x1be1f8[_0xa372('0x11')]?_['map'](_0x1be1f8[_0xa372('0x11')],function(_0x1f7831){return{'model':db[_0x1f7831[_0xa372('0x13')]],'as':_0x1f7831['as'],'attributes':_0x1f7831[_0xa372('0xf')],'include':_0x1f7831['include']?_[_0xa372('0x12')](_0x1f7831['include'],function(_0x18d5c5){return{'model':db[_0x18d5c5[_0xa372('0x13')]],'as':_0x18d5c5['as'],'attributes':_0x18d5c5[_0xa372('0xf')]};}):[]};}):[]};}):[]:[]})[_0xa372('0x14')](function(_0x37732c){logger[_0xa372('0x15')]('ShowSquareProject',_0x57c8b9);logger[_0xa372('0x16')](_0xa372('0x1b'),_0x57c8b9,JSON[_0xa372('0x17')](_0x37732c));_0x37c1c9(_0x37732c);})['catch'](function(_0x537061){logger[_0xa372('0x1a')](_0xa372('0x1b'),_0x537061[_0xa372('0x19')],_0x57c8b9);_0x497f35(_0x45e480[_0xa372('0x1a')](0x1f4,_0x537061['message']));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index 76431bb..361f457 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 _0x0afd=['emit','removeListener','length','./squareProject.events','save','remove'];(function(_0x586bb1,_0x5ae4a8){var _0x222252=function(_0x24b76b){while(--_0x24b76b){_0x586bb1['push'](_0x586bb1['shift']());}};_0x222252(++_0x5ae4a8);}(_0x0afd,0x129));var _0xd0af=function(_0x1fa33b,_0x7b3826){_0x1fa33b=_0x1fa33b-0x0;var _0x13ceb6=_0x0afd[_0x1fa33b];return _0x13ceb6;};'use strict';var SquareProjectEvents=require(_0xd0af('0x0'));var events=[_0xd0af('0x1'),_0xd0af('0x2'),'update'];function createListener(_0x378532,_0x1ac949){return function(_0x4ab497){_0x1ac949[_0xd0af('0x3')](_0x378532,_0x4ab497);};}function removeListener(_0x1a0171,_0x1152a6){return function(){SquareProjectEvents[_0xd0af('0x4')](_0x1a0171,_0x1152a6);};}exports['register']=function(_0x56c216){for(var _0x577849=0x0,_0x350677=events[_0xd0af('0x5')];_0x577849<_0x350677;_0x577849++){var _0x33c4cc=events[_0x577849];var _0x28c110=createListener('squareProject:'+_0x33c4cc,_0x56c216);SquareProjectEvents['on'](_0x33c4cc,_0x28c110);}}; \ No newline at end of file +var _0x000d=['save','remove','update','emit','length','./squareProject.events'];(function(_0x62dedc,_0xc903a7){var _0x4114ac=function(_0x515a34){while(--_0x515a34){_0x62dedc['push'](_0x62dedc['shift']());}};_0x4114ac(++_0xc903a7);}(_0x000d,0x15b));var _0xd000=function(_0x397aa5,_0x436a3c){_0x397aa5=_0x397aa5-0x0;var _0x194c61=_0x000d[_0x397aa5];return _0x194c61;};'use strict';var SquareProjectEvents=require(_0xd000('0x0'));var events=[_0xd000('0x1'),_0xd000('0x2'),_0xd000('0x3')];function createListener(_0x1b3087,_0x1d24a6){return function(_0x6a1bb7){_0x1d24a6[_0xd000('0x4')](_0x1b3087,_0x6a1bb7);};}function removeListener(_0x216952,_0x498cc5){return function(){SquareProjectEvents['removeListener'](_0x216952,_0x498cc5);};}exports['register']=function(_0x3daa8f){for(var _0x142c68=0x0,_0x5874a7=events[_0xd000('0x5')];_0x142c68<_0x5874a7;_0x142c68++){var _0x3f7782=events[_0x142c68];var _0x581c3c=createListener('squareProject:'+_0x3f7782,_0x3daa8f);SquareProjectEvents['on'](_0x3f7782,_0x581c3c);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index 995e96c..72c81ff 100644 --- a/server/api/squareRecording/index.js +++ b/server/api/squareRecording/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xabce=['util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','show','download','post','create','put','/:id','update','delete','destroy','exports','multer'];(function(_0x329684,_0x1124a9){var _0x47f5cb=function(_0x537f03){while(--_0x537f03){_0x329684['push'](_0x329684['shift']());}};_0x47f5cb(++_0x1124a9);}(_0xabce,0x103));var _0xeabc=function(_0x3635ce,_0x33a6f9){_0x3635ce=_0x3635ce-0x0;var _0x97ecd0=_0xabce[_0x3635ce];return _0x97ecd0;};'use strict';var multer=require(_0xeabc('0x0'));var util=require(_0xeabc('0x1'));var path=require(_0xeabc('0x2'));var timeout=require(_0xeabc('0x3'));var express=require(_0xeabc('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xeabc('0x5'));var interaction=require(_0xeabc('0x6'));var config=require(_0xeabc('0x7'));var controller=require('./squareRecording.controller');router['get']('/',auth[_0xeabc('0x8')](),controller['index']);router[_0xeabc('0x9')]('/:id',auth[_0xeabc('0x8')](),controller[_0xeabc('0xa')]);router[_0xeabc('0x9')]('/:id/download',auth[_0xeabc('0x8')](),controller[_0xeabc('0xb')]);router[_0xeabc('0xc')]('/',auth[_0xeabc('0x8')](),controller[_0xeabc('0xd')]);router[_0xeabc('0xe')](_0xeabc('0xf'),auth[_0xeabc('0x8')](),controller[_0xeabc('0x10')]);router[_0xeabc('0x11')](_0xeabc('0xf'),auth[_0xeabc('0x8')](),controller[_0xeabc('0x12')]);module[_0xeabc('0x13')]=router; \ No newline at end of file +var _0x5fab=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareRecording.controller','get','isAuthenticated','/:id','show','/:id/download','download','create','put','update','delete','destroy','multer','util','connect-timeout'];(function(_0x52d943,_0x28eae7){var _0x40c30c=function(_0x1de5c1){while(--_0x1de5c1){_0x52d943['push'](_0x52d943['shift']());}};_0x40c30c(++_0x28eae7);}(_0x5fab,0x177));var _0xb5fa=function(_0x7ea1fb,_0x2f0b74){_0x7ea1fb=_0x7ea1fb-0x0;var _0x478241=_0x5fab[_0x7ea1fb];return _0x478241;};'use strict';var multer=require(_0xb5fa('0x0'));var util=require(_0xb5fa('0x1'));var path=require('path');var timeout=require(_0xb5fa('0x2'));var express=require(_0xb5fa('0x3'));var router=express[_0xb5fa('0x4')]();var fs_extra=require(_0xb5fa('0x5'));var auth=require(_0xb5fa('0x6'));var interaction=require(_0xb5fa('0x7'));var config=require(_0xb5fa('0x8'));var controller=require(_0xb5fa('0x9'));router[_0xb5fa('0xa')]('/',auth[_0xb5fa('0xb')](),controller['index']);router['get'](_0xb5fa('0xc'),auth[_0xb5fa('0xb')](),controller[_0xb5fa('0xd')]);router['get'](_0xb5fa('0xe'),auth[_0xb5fa('0xb')](),controller[_0xb5fa('0xf')]);router['post']('/',auth['isAuthenticated'](),controller[_0xb5fa('0x10')]);router[_0xb5fa('0x11')](_0xb5fa('0xc'),auth[_0xb5fa('0xb')](),controller[_0xb5fa('0x12')]);router[_0xb5fa('0x13')](_0xb5fa('0xc'),auth[_0xb5fa('0xb')](),controller[_0xb5fa('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.attributes.js b/server/api/squareRecording/squareRecording.attributes.js index 33ec9ad..768b7aa 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 _0xe14b=['VIRTUAL','lastIndexOf','sequelize','exports','STRING'];(function(_0x753f66,_0x2844e9){var _0xe676d3=function(_0x4c5d7c){while(--_0x4c5d7c){_0x753f66['push'](_0x753f66['shift']());}};_0xe676d3(++_0x2844e9);}(_0xe14b,0x93));var _0xbe14=function(_0x5e14f5,_0x46fcba){_0x5e14f5=_0x5e14f5-0x0;var _0x2fef43=_0xe14b[_0x5e14f5];return _0x2fef43;};'use strict';var Sequelize=require(_0xbe14('0x0'));module[_0xbe14('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xbe14('0x2')]},'context':{'type':Sequelize[_0xbe14('0x2')]},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xbe14('0x2')]},'accountcode':{'type':Sequelize['STRING']},'dnid':{'type':Sequelize['STRING']},'projectName':{'type':Sequelize[_0xbe14('0x2')]},'saveName':{'type':Sequelize[_0xbe14('0x2')]},'filename':{'type':Sequelize[_0xbe14('0x2')]},'savePath':{'type':Sequelize[_0xbe14('0x2')]},'format':{'type':Sequelize[_0xbe14('0x3')],'get':function(){var _0x39387e='';var _0x196fca=this['getDataValue']('savePath');if(_0x196fca){_0x39387e=_0x196fca['substring'](_0x196fca[_0xbe14('0x4')]('.'));}return _0x39387e;}}}; \ No newline at end of file +var _0x9c5a=['getDataValue','savePath','lastIndexOf','sequelize','exports','STRING','VIRTUAL'];(function(_0x424b05,_0x526b5b){var _0x4c65cd=function(_0x59e1f3){while(--_0x59e1f3){_0x424b05['push'](_0x424b05['shift']());}};_0x4c65cd(++_0x526b5b);}(_0x9c5a,0x1c3));var _0xa9c5=function(_0x42075a,_0x1c7df3){_0x42075a=_0x42075a-0x0;var _0x5614d6=_0x9c5a[_0x42075a];return _0x5614d6;};'use strict';var Sequelize=require(_0xa9c5('0x0'));module[_0xa9c5('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0xa9c5('0x2')]},'calleridname':{'type':Sequelize[_0xa9c5('0x2')]},'context':{'type':Sequelize[_0xa9c5('0x2')]},'extension':{'type':Sequelize[_0xa9c5('0x2')]},'priority':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xa9c5('0x2')]},'dnid':{'type':Sequelize[_0xa9c5('0x2')]},'projectName':{'type':Sequelize['STRING']},'saveName':{'type':Sequelize[_0xa9c5('0x2')]},'filename':{'type':Sequelize['STRING']},'savePath':{'type':Sequelize[_0xa9c5('0x2')]},'format':{'type':Sequelize[_0xa9c5('0x3')],'get':function(){var _0x4cb597='';var _0x4b6db6=this[_0xa9c5('0x4')](_0xa9c5('0x5'));if(_0x4b6db6){_0x4cb597=_0x4b6db6['substring'](_0x4b6db6[_0xa9c5('0x6')]('.'));}return _0x4cb597;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index 2740bec..3cd49c4 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 _0x3be9=['fieldName','type','key','model','keys','query','filters','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','options','includeAll','include','rows','show','SquareRecording','attributes','find','catch','create','update','body','params','download','../../components/encryptor','uniqueid','savePath','filename','format','%s.cypher','decryptFile','secrets','recording','existsSync','Sequelize','unlink','message','SquareRecording\x20not\x20found','Not\x20found','destroy','isNil','Entity\x20not\x20found','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','info','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','offset','count','Content-Range','apply','save','then','error','stack','name','send','index','map','rawAttributes'];(function(_0xabf5c8,_0x160c31){var _0x5d5ffe=function(_0x2618b5){while(--_0x2618b5){_0xabf5c8['push'](_0xabf5c8['shift']());}};_0x5d5ffe(++_0x160c31);}(_0x3be9,0xfe));var _0x93be=function(_0xd21fe7,_0x225a39){_0xd21fe7=_0xd21fe7-0x0;var _0x14d570=_0x3be9[_0xd21fe7];return _0x14d570;};'use strict';var emlformat=require(_0x93be('0x0'));var rimraf=require(_0x93be('0x1'));var zipdir=require(_0x93be('0x2'));var jsonpatch=require(_0x93be('0x3'));var rp=require('request-promise');var moment=require(_0x93be('0x4'));var BPromise=require(_0x93be('0x5'));var Mustache=require(_0x93be('0x6'));var util=require(_0x93be('0x7'));var path=require('path');var sox=require(_0x93be('0x8'));var csv=require(_0x93be('0x9'));var ejs=require(_0x93be('0xa'));var fs=require('fs');var fs_extra=require(_0x93be('0xb'));var _=require(_0x93be('0xc'));var squel=require('squel');var crypto=require(_0x93be('0xd'));var jsforce=require(_0x93be('0xe'));var deskjs=require(_0x93be('0xf'));var toCsv=require(_0x93be('0x9'));var querystring=require(_0x93be('0x10'));var Papa=require(_0x93be('0x11'));var Redis=require(_0x93be('0x12'));var authService=require(_0x93be('0x13'));var qs=require(_0x93be('0x14'));var as=require(_0x93be('0x15'));var hardwareService=require(_0x93be('0x16'));var logger=require(_0x93be('0x17'))(_0x93be('0x18'));var utils=require('../../config/utils');var config=require(_0x93be('0x19'));var licenseUtil=require(_0x93be('0x1a'));var db=require(_0x93be('0x1b'))['db'];function respondWithStatusCode(_0x3a1393,_0x5e14a4){_0x5e14a4=_0x5e14a4||0xcc;return function(_0x5e3304){if(_0x5e3304){return _0x3a1393[_0x93be('0x1c')](_0x5e14a4);}return _0x3a1393[_0x93be('0x1d')](_0x5e14a4)[_0x93be('0x1e')]();};}function respondWithResult(_0x55e6ea,_0x1d8814){_0x1d8814=_0x1d8814||0xc8;return function(_0x153b1d){if(_0x153b1d){return _0x55e6ea[_0x93be('0x1d')](_0x1d8814)[_0x93be('0x1f')](_0x153b1d);}};}function respondWithFilteredResult(_0x313796,_0x220061){return function(_0x3702b4){if(_0x3702b4){var _0x4fc38d=typeof _0x220061['offset']==='undefined'&&typeof _0x220061[_0x93be('0x20')]==='undefined';var _0x3a5115=_0x3702b4['count'];var _0x12f8a3=_0x4fc38d?0x0:_0x220061[_0x93be('0x21')];var _0x2573a8=_0x4fc38d?_0x3702b4[_0x93be('0x22')]:_0x220061[_0x93be('0x21')]+_0x220061[_0x93be('0x20')];var _0x5a5ebe;if(_0x2573a8>=_0x3a5115){_0x2573a8=_0x3a5115;_0x5a5ebe=0xc8;}else{_0x5a5ebe=0xce;}_0x313796[_0x93be('0x1d')](_0x5a5ebe);return _0x313796['set'](_0x93be('0x23'),_0x12f8a3+'-'+_0x2573a8+'/'+_0x3a5115)[_0x93be('0x1f')](_0x3702b4);}return null;};}function patchUpdates(_0x3a2e22){return function(_0x4079ec){try{jsonpatch[_0x93be('0x24')](_0x4079ec,_0x3a2e22,!![]);}catch(_0x58b242){return BPromise['reject'](_0x58b242);}return _0x4079ec[_0x93be('0x25')]();};}function saveUpdates(_0x5b4a39,_0xff25e9){return function(_0x49e8b6){if(_0x49e8b6){return _0x49e8b6['update'](_0x5b4a39)[_0x93be('0x26')](function(_0xfda562){return _0xfda562;});}return null;};}function removeEntity(_0x3d0e9b,_0x217d3a){return function(_0x5d31c4){if(_0x5d31c4){return _0x5d31c4['destroy']()['then'](function(){_0x3d0e9b[_0x93be('0x1d')](0xcc)[_0x93be('0x1e')]();});}};}function handleEntityNotFound(_0x45414b,_0x11fa72){return function(_0x1cf338){if(!_0x1cf338){_0x45414b[_0x93be('0x1c')](0x194);}return _0x1cf338;};}function handleError(_0x9708da,_0x55484f){_0x55484f=_0x55484f||0x1f4;return function(_0x2b947c){logger[_0x93be('0x27')](_0x2b947c[_0x93be('0x28')]);if(_0x2b947c[_0x93be('0x29')]){delete _0x2b947c[_0x93be('0x29')];}_0x9708da[_0x93be('0x1d')](_0x55484f)[_0x93be('0x2a')](_0x2b947c);};}exports[_0x93be('0x2b')]=function(_0x11b126,_0x43d904){var _0x310233={},_0x506a27={},_0x2d0a21={'count':0x0,'rows':[]};var _0x82b6a5=_[_0x93be('0x2c')](db['SquareRecording'][_0x93be('0x2d')],function(_0x5454d6){return{'name':_0x5454d6[_0x93be('0x2e')],'type':_0x5454d6[_0x93be('0x2f')][_0x93be('0x30')]};});_0x506a27[_0x93be('0x31')]=_[_0x93be('0x2c')](_0x82b6a5,_0x93be('0x29'));_0x506a27['query']=_[_0x93be('0x32')](_0x11b126[_0x93be('0x33')]);_0x506a27[_0x93be('0x34')]=_[_0x93be('0x35')](_0x506a27['model'],_0x506a27[_0x93be('0x33')]);_0x310233['attributes']=_[_0x93be('0x35')](_0x506a27[_0x93be('0x31')],qs[_0x93be('0x36')](_0x11b126[_0x93be('0x33')][_0x93be('0x36')]));_0x310233['attributes']=_0x310233['attributes'][_0x93be('0x37')]?_0x310233['attributes']:_0x506a27[_0x93be('0x31')];if(!_0x11b126['query'][_0x93be('0x38')](_0x93be('0x39'))){_0x310233['limit']=qs[_0x93be('0x20')](_0x11b126[_0x93be('0x33')][_0x93be('0x20')]);_0x310233[_0x93be('0x21')]=qs['offset'](_0x11b126[_0x93be('0x33')][_0x93be('0x21')]);}_0x310233[_0x93be('0x3a')]=qs[_0x93be('0x3b')](_0x11b126[_0x93be('0x33')][_0x93be('0x3b')]);_0x310233[_0x93be('0x3c')]=qs[_0x93be('0x34')](_[_0x93be('0x3d')](_0x11b126[_0x93be('0x33')],_0x506a27[_0x93be('0x34')]),_0x82b6a5);if(_0x11b126[_0x93be('0x33')]['filter']){_0x310233[_0x93be('0x3c')]=_[_0x93be('0x3e')](_0x310233[_0x93be('0x3c')],{'$or':_['map'](_0x82b6a5,function(_0x4b8ae5){if(_0x4b8ae5[_0x93be('0x2f')]!=='VIRTUAL'){var _0x2b62c2={};_0x2b62c2[_0x4b8ae5[_0x93be('0x29')]]={'$like':'%'+_0x11b126[_0x93be('0x33')]['filter']+'%'};return _0x2b62c2;}})});}_0x310233=_[_0x93be('0x3e')]({},_0x310233,_0x11b126[_0x93be('0x3f')]);var _0x4d4717={'where':_0x310233['where']};return db['SquareRecording'][_0x93be('0x22')](_0x4d4717)[_0x93be('0x26')](function(_0x4b4b49){_0x2d0a21['count']=_0x4b4b49;if(_0x11b126['query'][_0x93be('0x40')]){_0x310233[_0x93be('0x41')]=[{'all':!![]}];}return db['SquareRecording']['findAll'](_0x310233);})[_0x93be('0x26')](function(_0x15efbb){_0x2d0a21[_0x93be('0x42')]=_0x15efbb;return _0x2d0a21;})[_0x93be('0x26')](respondWithFilteredResult(_0x43d904,_0x310233))['catch'](handleError(_0x43d904,null));};exports[_0x93be('0x43')]=function(_0x563678,_0x472e57){var _0x41cfab={'raw':!![],'where':{'id':_0x563678['params']['id']}},_0x1383b5={};_0x1383b5[_0x93be('0x31')]=_['keys'](db[_0x93be('0x44')][_0x93be('0x2d')]);_0x1383b5['query']=_[_0x93be('0x32')](_0x563678[_0x93be('0x33')]);_0x1383b5[_0x93be('0x34')]=_[_0x93be('0x35')](_0x1383b5[_0x93be('0x31')],_0x1383b5['query']);_0x41cfab[_0x93be('0x45')]=_[_0x93be('0x35')](_0x1383b5[_0x93be('0x31')],qs['fields'](_0x563678['query'][_0x93be('0x36')]));_0x41cfab[_0x93be('0x45')]=_0x41cfab[_0x93be('0x45')][_0x93be('0x37')]?_0x41cfab['attributes']:_0x1383b5[_0x93be('0x31')];if(_0x563678['query'][_0x93be('0x40')]){_0x41cfab[_0x93be('0x41')]=[{'all':!![]}];}_0x41cfab=_[_0x93be('0x3e')]({},_0x41cfab,_0x563678[_0x93be('0x3f')]);return db[_0x93be('0x44')][_0x93be('0x46')](_0x41cfab)['then'](handleEntityNotFound(_0x472e57,null))[_0x93be('0x26')](respondWithResult(_0x472e57,null))[_0x93be('0x47')](handleError(_0x472e57,null));};exports[_0x93be('0x48')]=function(_0x1d576a,_0x6cc73b){return db['SquareRecording']['create'](_0x1d576a['body'],{})['then'](respondWithResult(_0x6cc73b,0xc9))['catch'](handleError(_0x6cc73b,null));};exports[_0x93be('0x49')]=function(_0x484eaf,_0x790b21){if(_0x484eaf['body']['id']){delete _0x484eaf[_0x93be('0x4a')]['id'];}return db[_0x93be('0x44')][_0x93be('0x46')]({'where':{'id':_0x484eaf[_0x93be('0x4b')]['id']}})[_0x93be('0x26')](handleEntityNotFound(_0x790b21,null))['then'](saveUpdates(_0x484eaf[_0x93be('0x4a')],null))[_0x93be('0x26')](respondWithResult(_0x790b21,null))[_0x93be('0x47')](handleError(_0x790b21,null));};exports[_0x93be('0x4c')]=function(_0x31bcbd,_0x29cee6,_0x208412){var _0x56251c=require(_0x93be('0x4d'));var _0x2ceca8=![];var _0x4cdc12={};if(_0x31bcbd[_0x93be('0x33')][_0x93be('0x2f')]&&_0x31bcbd[_0x93be('0x33')]['type']===_0x93be('0x4e')){_0x4cdc12[_0x93be('0x4e')]=_0x31bcbd['params']['id'];}else{_0x4cdc12['id']=_0x31bcbd[_0x93be('0x4b')]['id'];}return db[_0x93be('0x44')]['find']({'where':_0x4cdc12,'attributes':['id',_0x93be('0x4f'),_0x93be('0x50')],'raw':!![]})[_0x93be('0x26')](handleEntityNotFound(_0x29cee6,null))['then'](function(_0x2ac519){if(_0x2ac519){var _0x3e4b04=_0x2ac519[_0x93be('0x4f')];var _0x476a0d=util[_0x93be('0x51')](_0x93be('0x52'),_0x3e4b04);if(fs['existsSync'](_0x476a0d)){_0x2ceca8=!![];return _0x56251c[_0x93be('0x53')](_0x476a0d,_0x3e4b04,config[_0x93be('0x54')][_0x93be('0x55')])[_0x93be('0x26')](function(){return _0x2ac519;});}return _0x2ac519;}})['then'](function(_0x6781d4){if(_0x6781d4){var _0x57c9a7=_0x6781d4[_0x93be('0x4f')];if(!fs[_0x93be('0x56')](_0x57c9a7)){throw new db[(_0x93be('0x57'))]['ValidationError']('SquareRecording\x20not\x20found');}if(_0x6781d4[_0x93be('0x50')]){return _0x29cee6[_0x93be('0x4c')](_0x57c9a7,_0x6781d4[_0x93be('0x50')]+path['extname'](_0x57c9a7),function(){if(_0x2ceca8){fs[_0x93be('0x58')](_0x57c9a7);}});}else{return _0x29cee6[_0x93be('0x4c')](_0x57c9a7,function(_0x1b265b){if(_0x2ceca8){fs['unlink'](_0x57c9a7);}});}}})[_0x93be('0x47')](function(_0xb69fd9){if(_0xb69fd9[_0x93be('0x59')]===_0x93be('0x5a')){_0x29cee6['status'](0x194)['send'](_0x93be('0x5b'));}else{return handleError(_0x29cee6,null);}});};exports[_0x93be('0x5c')]=function(_0x21c636,_0x1a2950){return db[_0x93be('0x44')][_0x93be('0x46')]({'where':{'id':_0x21c636[_0x93be('0x4b')]['id']}})[_0x93be('0x26')](function(_0x394df3){if(_[_0x93be('0x5d')](_0x394df3)){throw new ReferenceError(_0x93be('0x5e'));}return _0x394df3;})[_0x93be('0x26')](function(_0x2ebc40){var _0x3eb08b=_0x2ebc40[_0x93be('0x4f')];logger['info'](_0x93be('0x5f'),_0x3eb08b);if(!_[_0x93be('0x5d')](_0x2ebc40[_0x93be('0x4f')])&&fs[_0x93be('0x56')](_0x3eb08b)){logger['info'](_0x93be('0x60')+_0x3eb08b+_0x93be('0x61'));fs['unlinkSync'](_0x3eb08b);}_0x3eb08b=_0x3eb08b+'.cypher';if(!_['isNil'](_0x2ebc40[_0x93be('0x4f')])&&fs[_0x93be('0x56')](_0x3eb08b)){logger[_0x93be('0x62')]('File:\x20\x22'+_0x3eb08b+_0x93be('0x61'));fs[_0x93be('0x63')](_0x3eb08b);}return _0x2ebc40;})['then'](function(_0xdd1c41){if(!_0xdd1c41)throw new InternalError();return _0xdd1c41[_0x93be('0x5c')]();})[_0x93be('0x26')](function(){_0x1a2950[_0x93be('0x1d')](0xcc)['end']();})[_0x93be('0x47')](handleError(_0x1a2950,null));}; \ No newline at end of file +var _0xcb2a=['error','stack','name','send','map','SquareRecording','rawAttributes','type','key','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','filter','options','includeAll','include','findAll','rows','catch','show','params','create','body','find','download','../../components/encryptor','uniqueid','savePath','filename','format','%s.cypher','decryptFile','secrets','recording','existsSync','Sequelize','extname','unlink','Not\x20found','isNil','Entity\x20not\x20found','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','info','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','Content-Range','then','destroy'];(function(_0xc6d35,_0x445827){var _0x41a7cb=function(_0x2b2039){while(--_0x2b2039){_0xc6d35['push'](_0xc6d35['shift']());}};_0x41a7cb(++_0x445827);}(_0xcb2a,0xfc));var _0xacb2=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xcb2a[_0xa464c9];return _0x3d73c4;};'use strict';var emlformat=require(_0xacb2('0x0'));var rimraf=require(_0xacb2('0x1'));var zipdir=require(_0xacb2('0x2'));var jsonpatch=require(_0xacb2('0x3'));var rp=require(_0xacb2('0x4'));var moment=require(_0xacb2('0x5'));var BPromise=require(_0xacb2('0x6'));var Mustache=require(_0xacb2('0x7'));var util=require('util');var path=require(_0xacb2('0x8'));var sox=require(_0xacb2('0x9'));var csv=require(_0xacb2('0xa'));var ejs=require(_0xacb2('0xb'));var fs=require('fs');var fs_extra=require(_0xacb2('0xc'));var _=require(_0xacb2('0xd'));var squel=require(_0xacb2('0xe'));var crypto=require(_0xacb2('0xf'));var jsforce=require('jsforce');var deskjs=require(_0xacb2('0x10'));var toCsv=require(_0xacb2('0xa'));var querystring=require(_0xacb2('0x11'));var Papa=require(_0xacb2('0x12'));var Redis=require(_0xacb2('0x13'));var authService=require(_0xacb2('0x14'));var qs=require(_0xacb2('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xacb2('0x16'));var logger=require(_0xacb2('0x17'))(_0xacb2('0x18'));var utils=require(_0xacb2('0x19'));var config=require(_0xacb2('0x1a'));var licenseUtil=require(_0xacb2('0x1b'));var db=require(_0xacb2('0x1c'))['db'];function respondWithStatusCode(_0x531695,_0x3abe3e){_0x3abe3e=_0x3abe3e||0xcc;return function(_0x24b9c9){if(_0x24b9c9){return _0x531695[_0xacb2('0x1d')](_0x3abe3e);}return _0x531695[_0xacb2('0x1e')](_0x3abe3e)['end']();};}function respondWithResult(_0x181747,_0xa7e973){_0xa7e973=_0xa7e973||0xc8;return function(_0x230507){if(_0x230507){return _0x181747[_0xacb2('0x1e')](_0xa7e973)[_0xacb2('0x1f')](_0x230507);}};}function respondWithFilteredResult(_0x5241e5,_0x386fb7){return function(_0x5c6179){if(_0x5c6179){var _0x1df92d=typeof _0x386fb7[_0xacb2('0x20')]===_0xacb2('0x21')&&typeof _0x386fb7['limit']===_0xacb2('0x21');var _0x18ee31=_0x5c6179[_0xacb2('0x22')];var _0x3772ce=_0x1df92d?0x0:_0x386fb7['offset'];var _0x945dc1=_0x1df92d?_0x5c6179[_0xacb2('0x22')]:_0x386fb7[_0xacb2('0x20')]+_0x386fb7[_0xacb2('0x23')];var _0x561e91;if(_0x945dc1>=_0x18ee31){_0x945dc1=_0x18ee31;_0x561e91=0xc8;}else{_0x561e91=0xce;}_0x5241e5[_0xacb2('0x1e')](_0x561e91);return _0x5241e5['set'](_0xacb2('0x24'),_0x3772ce+'-'+_0x945dc1+'/'+_0x18ee31)['json'](_0x5c6179);}return null;};}function patchUpdates(_0x501fd9){return function(_0x573e79){try{jsonpatch['apply'](_0x573e79,_0x501fd9,!![]);}catch(_0x5c9f6b){return BPromise['reject'](_0x5c9f6b);}return _0x573e79['save']();};}function saveUpdates(_0x413c6a,_0x26341c){return function(_0x3fa799){if(_0x3fa799){return _0x3fa799['update'](_0x413c6a)[_0xacb2('0x25')](function(_0x1ee6c7){return _0x1ee6c7;});}return null;};}function removeEntity(_0x5bfa34,_0x3abe9c){return function(_0x9a8f09){if(_0x9a8f09){return _0x9a8f09[_0xacb2('0x26')]()[_0xacb2('0x25')](function(){_0x5bfa34[_0xacb2('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1d507a,_0x5d867f){return function(_0x426ebf){if(!_0x426ebf){_0x1d507a[_0xacb2('0x1d')](0x194);}return _0x426ebf;};}function handleError(_0x3a3de9,_0x51461d){_0x51461d=_0x51461d||0x1f4;return function(_0x535747){logger[_0xacb2('0x27')](_0x535747[_0xacb2('0x28')]);if(_0x535747[_0xacb2('0x29')]){delete _0x535747['name'];}_0x3a3de9[_0xacb2('0x1e')](_0x51461d)[_0xacb2('0x2a')](_0x535747);};}exports['index']=function(_0x518fe0,_0x20d879){var _0x42b185={},_0x1f385f={},_0x1241b5={'count':0x0,'rows':[]};var _0x55a47a=_[_0xacb2('0x2b')](db[_0xacb2('0x2c')][_0xacb2('0x2d')],function(_0x1104c6){return{'name':_0x1104c6['fieldName'],'type':_0x1104c6[_0xacb2('0x2e')][_0xacb2('0x2f')]};});_0x1f385f['model']=_[_0xacb2('0x2b')](_0x55a47a,_0xacb2('0x29'));_0x1f385f['query']=_[_0xacb2('0x30')](_0x518fe0[_0xacb2('0x31')]);_0x1f385f[_0xacb2('0x32')]=_[_0xacb2('0x33')](_0x1f385f[_0xacb2('0x34')],_0x1f385f[_0xacb2('0x31')]);_0x42b185[_0xacb2('0x35')]=_[_0xacb2('0x33')](_0x1f385f[_0xacb2('0x34')],qs[_0xacb2('0x36')](_0x518fe0[_0xacb2('0x31')][_0xacb2('0x36')]));_0x42b185['attributes']=_0x42b185[_0xacb2('0x35')][_0xacb2('0x37')]?_0x42b185['attributes']:_0x1f385f[_0xacb2('0x34')];if(!_0x518fe0[_0xacb2('0x31')][_0xacb2('0x38')](_0xacb2('0x39'))){_0x42b185[_0xacb2('0x23')]=qs[_0xacb2('0x23')](_0x518fe0['query']['limit']);_0x42b185['offset']=qs[_0xacb2('0x20')](_0x518fe0[_0xacb2('0x31')]['offset']);}_0x42b185['order']=qs[_0xacb2('0x3a')](_0x518fe0[_0xacb2('0x31')]['sort']);_0x42b185[_0xacb2('0x3b')]=qs[_0xacb2('0x32')](_[_0xacb2('0x3c')](_0x518fe0[_0xacb2('0x31')],_0x1f385f['filters']),_0x55a47a);if(_0x518fe0[_0xacb2('0x31')]['filter']){_0x42b185[_0xacb2('0x3b')]=_[_0xacb2('0x3d')](_0x42b185[_0xacb2('0x3b')],{'$or':_[_0xacb2('0x2b')](_0x55a47a,function(_0x463610){if(_0x463610['type']!=='VIRTUAL'){var _0x557446={};_0x557446[_0x463610[_0xacb2('0x29')]]={'$like':'%'+_0x518fe0[_0xacb2('0x31')][_0xacb2('0x3e')]+'%'};return _0x557446;}})});}_0x42b185=_[_0xacb2('0x3d')]({},_0x42b185,_0x518fe0[_0xacb2('0x3f')]);var _0x4b9b15={'where':_0x42b185[_0xacb2('0x3b')]};return db[_0xacb2('0x2c')]['count'](_0x4b9b15)[_0xacb2('0x25')](function(_0x1f322d){_0x1241b5[_0xacb2('0x22')]=_0x1f322d;if(_0x518fe0['query'][_0xacb2('0x40')]){_0x42b185[_0xacb2('0x41')]=[{'all':!![]}];}return db[_0xacb2('0x2c')][_0xacb2('0x42')](_0x42b185);})[_0xacb2('0x25')](function(_0x118762){_0x1241b5[_0xacb2('0x43')]=_0x118762;return _0x1241b5;})[_0xacb2('0x25')](respondWithFilteredResult(_0x20d879,_0x42b185))[_0xacb2('0x44')](handleError(_0x20d879,null));};exports[_0xacb2('0x45')]=function(_0x536999,_0x5ad8bd){var _0x5de46e={'raw':!![],'where':{'id':_0x536999[_0xacb2('0x46')]['id']}},_0x2611d6={};_0x2611d6[_0xacb2('0x34')]=_['keys'](db[_0xacb2('0x2c')][_0xacb2('0x2d')]);_0x2611d6[_0xacb2('0x31')]=_['keys'](_0x536999['query']);_0x2611d6[_0xacb2('0x32')]=_[_0xacb2('0x33')](_0x2611d6['model'],_0x2611d6[_0xacb2('0x31')]);_0x5de46e[_0xacb2('0x35')]=_['intersection'](_0x2611d6['model'],qs[_0xacb2('0x36')](_0x536999['query'][_0xacb2('0x36')]));_0x5de46e[_0xacb2('0x35')]=_0x5de46e[_0xacb2('0x35')][_0xacb2('0x37')]?_0x5de46e['attributes']:_0x2611d6['model'];if(_0x536999[_0xacb2('0x31')][_0xacb2('0x40')]){_0x5de46e['include']=[{'all':!![]}];}_0x5de46e=_[_0xacb2('0x3d')]({},_0x5de46e,_0x536999[_0xacb2('0x3f')]);return db[_0xacb2('0x2c')]['find'](_0x5de46e)[_0xacb2('0x25')](handleEntityNotFound(_0x5ad8bd,null))[_0xacb2('0x25')](respondWithResult(_0x5ad8bd,null))[_0xacb2('0x44')](handleError(_0x5ad8bd,null));};exports[_0xacb2('0x47')]=function(_0xb81a97,_0x39f55a){return db['SquareRecording'][_0xacb2('0x47')](_0xb81a97[_0xacb2('0x48')],{})[_0xacb2('0x25')](respondWithResult(_0x39f55a,0xc9))[_0xacb2('0x44')](handleError(_0x39f55a,null));};exports['update']=function(_0x80589b,_0x33a836){if(_0x80589b[_0xacb2('0x48')]['id']){delete _0x80589b['body']['id'];}return db[_0xacb2('0x2c')][_0xacb2('0x49')]({'where':{'id':_0x80589b[_0xacb2('0x46')]['id']}})[_0xacb2('0x25')](handleEntityNotFound(_0x33a836,null))[_0xacb2('0x25')](saveUpdates(_0x80589b['body'],null))[_0xacb2('0x25')](respondWithResult(_0x33a836,null))[_0xacb2('0x44')](handleError(_0x33a836,null));};exports[_0xacb2('0x4a')]=function(_0x241b32,_0x38011f,_0x37d1ca){var _0x41a6d6=require(_0xacb2('0x4b'));var _0x4372fa=![];var _0x4de8f6={};if(_0x241b32[_0xacb2('0x31')]['type']&&_0x241b32[_0xacb2('0x31')][_0xacb2('0x2e')]===_0xacb2('0x4c')){_0x4de8f6['uniqueid']=_0x241b32[_0xacb2('0x46')]['id'];}else{_0x4de8f6['id']=_0x241b32[_0xacb2('0x46')]['id'];}return db[_0xacb2('0x2c')][_0xacb2('0x49')]({'where':_0x4de8f6,'attributes':['id',_0xacb2('0x4d'),_0xacb2('0x4e')],'raw':!![]})['then'](handleEntityNotFound(_0x38011f,null))['then'](function(_0x3d5aae){if(_0x3d5aae){var _0x5a0a44=_0x3d5aae[_0xacb2('0x4d')];var _0x1177be=util[_0xacb2('0x4f')](_0xacb2('0x50'),_0x5a0a44);if(fs['existsSync'](_0x1177be)){_0x4372fa=!![];return _0x41a6d6[_0xacb2('0x51')](_0x1177be,_0x5a0a44,config[_0xacb2('0x52')][_0xacb2('0x53')])[_0xacb2('0x25')](function(){return _0x3d5aae;});}return _0x3d5aae;}})[_0xacb2('0x25')](function(_0x2f0d90){if(_0x2f0d90){var _0x288822=_0x2f0d90['savePath'];if(!fs[_0xacb2('0x54')](_0x288822)){throw new db[(_0xacb2('0x55'))]['ValidationError']('SquareRecording\x20not\x20found');}if(_0x2f0d90[_0xacb2('0x4e')]){return _0x38011f[_0xacb2('0x4a')](_0x288822,_0x2f0d90[_0xacb2('0x4e')]+path[_0xacb2('0x56')](_0x288822),function(){if(_0x4372fa){fs[_0xacb2('0x57')](_0x288822);}});}else{return _0x38011f[_0xacb2('0x4a')](_0x288822,function(_0x417387){if(_0x4372fa){fs['unlink'](_0x288822);}});}}})[_0xacb2('0x44')](function(_0x20268f){if(_0x20268f['message']==='SquareRecording\x20not\x20found'){_0x38011f[_0xacb2('0x1e')](0x194)[_0xacb2('0x2a')](_0xacb2('0x58'));}else{return handleError(_0x38011f,null);}});};exports[_0xacb2('0x26')]=function(_0x42d5b5,_0x7785b3){return db[_0xacb2('0x2c')]['find']({'where':{'id':_0x42d5b5['params']['id']}})[_0xacb2('0x25')](function(_0x379d32){if(_[_0xacb2('0x59')](_0x379d32)){throw new ReferenceError(_0xacb2('0x5a'));}return _0x379d32;})['then'](function(_0x1eb81e){var _0x3db2a2=_0x1eb81e['savePath'];logger['info'](_0xacb2('0x5b'),_0x3db2a2);if(!_[_0xacb2('0x59')](_0x1eb81e[_0xacb2('0x4d')])&&fs[_0xacb2('0x54')](_0x3db2a2)){logger['info'](_0xacb2('0x5c')+_0x3db2a2+_0xacb2('0x5d'));fs[_0xacb2('0x5e')](_0x3db2a2);}_0x3db2a2=_0x3db2a2+_0xacb2('0x5f');if(!_[_0xacb2('0x59')](_0x1eb81e[_0xacb2('0x4d')])&&fs[_0xacb2('0x54')](_0x3db2a2)){logger[_0xacb2('0x60')](_0xacb2('0x5c')+_0x3db2a2+_0xacb2('0x5d'));fs[_0xacb2('0x5e')](_0x3db2a2);}return _0x1eb81e;})['then'](function(_0x59e214){if(!_0x59e214)throw new InternalError();return _0x59e214[_0xacb2('0x26')]();})['then'](function(){_0x7785b3['status'](0xcc)['end']();})[_0xacb2('0x44')](handleError(_0x7785b3,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index f01ab6d..8c3afef 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 _0x2d72=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./squareRecording.attributes','exports','SquareRecording','square_recordings'];(function(_0x230cdf,_0x5e38c3){var _0xb89da8=function(_0x34197c){while(--_0x34197c){_0x230cdf['push'](_0x230cdf['shift']());}};_0xb89da8(++_0x5e38c3);}(_0x2d72,0xa8));var _0x22d7=function(_0xbec98d,_0x5d7675){_0xbec98d=_0xbec98d-0x0;var _0x17cfdf=_0x2d72[_0xbec98d];return _0x17cfdf;};'use strict';var _=require(_0x22d7('0x0'));var util=require(_0x22d7('0x1'));var logger=require(_0x22d7('0x2'))(_0x22d7('0x3'));var moment=require(_0x22d7('0x4'));var BPromise=require(_0x22d7('0x5'));var rp=require(_0x22d7('0x6'));var fs=require('fs');var path=require(_0x22d7('0x7'));var rimraf=require(_0x22d7('0x8'));var config=require(_0x22d7('0x9'));var attributes=require(_0x22d7('0xa'));module[_0x22d7('0xb')]=function(_0x208b5b,_0x100426){return _0x208b5b['define'](_0x22d7('0xc'),attributes,{'tableName':_0x22d7('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x89fb=['SquareRecording','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./squareRecording.attributes','exports'];(function(_0x52a6e3,_0x4a73b4){var _0x8910d0=function(_0x57e5ef){while(--_0x57e5ef){_0x52a6e3['push'](_0x52a6e3['shift']());}};_0x8910d0(++_0x4a73b4);}(_0x89fb,0x14b));var _0xb89f=function(_0x4fc0c6,_0x26afb4){_0x4fc0c6=_0x4fc0c6-0x0;var _0xdbb988=_0x89fb[_0x4fc0c6];return _0xdbb988;};'use strict';var _=require('lodash');var util=require(_0xb89f('0x0'));var logger=require(_0xb89f('0x1'))(_0xb89f('0x2'));var moment=require(_0xb89f('0x3'));var BPromise=require(_0xb89f('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb89f('0x5'));var rimraf=require(_0xb89f('0x6'));var config=require(_0xb89f('0x7'));var attributes=require(_0xb89f('0x8'));module[_0xb89f('0x9')]=function(_0x564ef3,_0x2ce32a){return _0x564ef3['define'](_0xb89f('0xa'),attributes,{'tableName':'square_recordings','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 81cd5ba..342ad78 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 _0x5f38=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','SquareRecording,\x20%s,\x20%s','message','catch','CreateSquareRecording','create','body','options','raw','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x604546,_0x38ccf9){var _0x17809a=function(_0x235b14){while(--_0x235b14){_0x604546['push'](_0x604546['shift']());}};_0x17809a(++_0x38ccf9);}(_0x5f38,0x19c));var _0x85f3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5f38[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x85f3('0x0'));var util=require(_0x85f3('0x1'));var moment=require('moment');var BPromise=require(_0x85f3('0x2'));var rs=require(_0x85f3('0x3'));var fs=require('fs');var Redis=require(_0x85f3('0x4'));var db=require(_0x85f3('0x5'))['db'];var utils=require(_0x85f3('0x6'));var logger=require(_0x85f3('0x7'))(_0x85f3('0x8'));var config=require(_0x85f3('0x9'));var jayson=require(_0x85f3('0xa'));var client=jayson[_0x85f3('0xb')][_0x85f3('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4463ab,_0x3f363c,_0x56ea33){return new BPromise(function(_0x585db2,_0x46cdc6){return client[_0x85f3('0xd')](_0x4463ab,_0x56ea33)[_0x85f3('0xe')](function(_0x437047){logger[_0x85f3('0xf')]('SquareRecording,\x20%s,\x20%s',_0x3f363c,_0x85f3('0x10'));logger[_0x85f3('0x11')](_0x85f3('0x12'),_0x3f363c,_0x85f3('0x10'),JSON[_0x85f3('0x13')](_0x437047));if(_0x437047['error']){if(_0x437047[_0x85f3('0x14')][_0x85f3('0x15')]===0x1f4){logger[_0x85f3('0x14')](_0x85f3('0x16'),_0x3f363c,_0x437047[_0x85f3('0x14')][_0x85f3('0x17')]);return _0x46cdc6(_0x437047[_0x85f3('0x14')][_0x85f3('0x17')]);}logger[_0x85f3('0x14')](_0x85f3('0x16'),_0x3f363c,_0x437047['error'][_0x85f3('0x17')]);return _0x585db2(_0x437047['error'][_0x85f3('0x17')]);}else{logger[_0x85f3('0xf')](_0x85f3('0x16'),_0x3f363c,_0x85f3('0x10'));_0x585db2(_0x437047['result'][_0x85f3('0x17')]);}})[_0x85f3('0x18')](function(_0x520e58){logger['error'](_0x85f3('0x16'),_0x3f363c,_0x520e58);_0x46cdc6(_0x520e58);});});}exports[_0x85f3('0x19')]=function(_0x1f85fd){var _0x39a38c=this;return new Promise(function(_0x2a5db2,_0x524b75){return db['SquareRecording'][_0x85f3('0x1a')](_0x1f85fd[_0x85f3('0x1b')],{'raw':_0x1f85fd[_0x85f3('0x1c')]?_0x1f85fd['options'][_0x85f3('0x1d')]===undefined?!![]:![]:!![]})[_0x85f3('0xe')](function(_0x22efdf){logger['info'](_0x85f3('0x19'),_0x1f85fd);logger['debug']('CreateSquareRecording',_0x1f85fd,JSON[_0x85f3('0x13')](_0x22efdf));_0x2a5db2(_0x22efdf);})[_0x85f3('0x18')](function(_0x42ad2b){logger[_0x85f3('0x14')](_0x85f3('0x19'),_0x42ad2b[_0x85f3('0x17')],_0x1f85fd);_0x524b75(_0x39a38c['error'](0x1f4,_0x42ad2b[_0x85f3('0x17')]));});});}; \ No newline at end of file +var _0xcf9a=['CreateSquareRecording','SquareRecording','create','options','lodash','moment','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','SquareRecording,\x20%s,\x20%s','request\x20sent','debug','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x4089fd,_0x460230){var _0x549185=function(_0x434c0e){while(--_0x434c0e){_0x4089fd['push'](_0x4089fd['shift']());}};_0x549185(++_0x460230);}(_0xcf9a,0x122));var _0xacf9=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0xcf9a[_0x53ccf2];return _0x5a2964;};'use strict';var _=require(_0xacf9('0x0'));var util=require('util');var moment=require(_0xacf9('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xacf9('0x2'));var db=require(_0xacf9('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xacf9('0x4'))(_0xacf9('0x5'));var config=require(_0xacf9('0x6'));var jayson=require(_0xacf9('0x7'));var client=jayson[_0xacf9('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5684a1,_0x1f1524,_0x22bf50){return new BPromise(function(_0x5c8b38,_0x12f332){return client[_0xacf9('0x9')](_0x5684a1,_0x22bf50)[_0xacf9('0xa')](function(_0x52573c){logger[_0xacf9('0xb')](_0xacf9('0xc'),_0x1f1524,_0xacf9('0xd'));logger[_0xacf9('0xe')](_0xacf9('0xf'),_0x1f1524,_0xacf9('0xd'),JSON[_0xacf9('0x10')](_0x52573c));if(_0x52573c[_0xacf9('0x11')]){if(_0x52573c[_0xacf9('0x11')][_0xacf9('0x12')]===0x1f4){logger[_0xacf9('0x11')]('SquareRecording,\x20%s,\x20%s',_0x1f1524,_0x52573c['error'][_0xacf9('0x13')]);return _0x12f332(_0x52573c[_0xacf9('0x11')][_0xacf9('0x13')]);}logger['error']('SquareRecording,\x20%s,\x20%s',_0x1f1524,_0x52573c[_0xacf9('0x11')]['message']);return _0x5c8b38(_0x52573c[_0xacf9('0x11')][_0xacf9('0x13')]);}else{logger[_0xacf9('0xb')](_0xacf9('0xc'),_0x1f1524,_0xacf9('0xd'));_0x5c8b38(_0x52573c[_0xacf9('0x14')][_0xacf9('0x13')]);}})[_0xacf9('0x15')](function(_0x468322){logger[_0xacf9('0x11')](_0xacf9('0xc'),_0x1f1524,_0x468322);_0x12f332(_0x468322);});});}exports[_0xacf9('0x16')]=function(_0x357cfa){var _0x2eff5c=this;return new Promise(function(_0x43828d,_0x4b8a7f){return db[_0xacf9('0x17')][_0xacf9('0x18')](_0x357cfa['body'],{'raw':_0x357cfa[_0xacf9('0x19')]?_0x357cfa['options']['raw']===undefined?!![]:![]:!![]})['then'](function(_0x1dec82){logger[_0xacf9('0xb')]('CreateSquareRecording',_0x357cfa);logger[_0xacf9('0xe')]('CreateSquareRecording',_0x357cfa,JSON[_0xacf9('0x10')](_0x1dec82));_0x43828d(_0x1dec82);})[_0xacf9('0x15')](function(_0x335e7d){logger['error'](_0xacf9('0x16'),_0x335e7d['message'],_0x357cfa);_0x4b8a7f(_0x2eff5c['error'](0x1f4,_0x335e7d[_0xacf9('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index f314abd..9fbc19f 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 _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(_0x2cfbcf,_0x2cf96f){var _0x41fc13=function(_0x4d7a26){while(--_0x4d7a26){_0x2cfbcf['push'](_0x2cfbcf['shift']());}};_0x41fc13(++_0x2cf96f);}(_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('./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 +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(_0x4596ef,_0x1e0b80){var _0x26c7b2=function(_0x3e0d75){while(--_0x3e0d75){_0x4596ef['push'](_0x4596ef['shift']());}};_0x26c7b2(++_0x1e0b80);}(_0xbaf0,0x12a));var _0x0baf=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xbaf0[_0x14add3];return _0x4a174f;};'use strict';var multer=require('multer');var util=require(_0x0baf('0x0'));var path=require(_0x0baf('0x1'));var timeout=require(_0x0baf('0x2'));var express=require(_0x0baf('0x3'));var router=express[_0x0baf('0x4')]();var fs_extra=require(_0x0baf('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var controller=require(_0x0baf('0x8'));router[_0x0baf('0x9')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0xb')]);router[_0x0baf('0x9')](_0x0baf('0xc'),auth[_0x0baf('0xa')](),controller['describe']);router[_0x0baf('0x9')]('/:id',auth[_0x0baf('0xa')](),controller[_0x0baf('0xd')]);router[_0x0baf('0xe')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0xf')]);router[_0x0baf('0x10')](_0x0baf('0x11'),auth[_0x0baf('0xa')](),controller[_0x0baf('0x12')]);router[_0x0baf('0x13')](_0x0baf('0x11'),auth['isAuthenticated'](),controller['destroy']);module[_0x0baf('0x14')]=router; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.attributes.js b/server/api/squareReport/squareReport.attributes.js index dde71ac..0b63502 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 _0x8c6a=['BOOLEAN','exports','STRING','DATE'];(function(_0x5c0503,_0x1d8608){var _0x4bf40f=function(_0x3f105d){while(--_0x3f105d){_0x5c0503['push'](_0x5c0503['shift']());}};_0x4bf40f(++_0x1d8608);}(_0x8c6a,0x1b5));var _0xa8c6=function(_0x28611e,_0x586726){_0x28611e=_0x28611e-0x0;var _0x530f69=_0x8c6a[_0x28611e];return _0x530f69;};'use strict';var Sequelize=require('sequelize');module[_0xa8c6('0x0')]={'network':{'type':Sequelize[_0xa8c6('0x1')]},'network_script':{'type':Sequelize[_0xa8c6('0x1')]},'request':{'type':Sequelize[_0xa8c6('0x1')]},'channel':{'type':Sequelize[_0xa8c6('0x1')]},'language':{'type':Sequelize[_0xa8c6('0x1')]},'type':{'type':Sequelize[_0xa8c6('0x1')]},'uniqueid':{'type':Sequelize[_0xa8c6('0x1')]},'version':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'callingpres':{'type':Sequelize[_0xa8c6('0x1')]},'callingani2':{'type':Sequelize[_0xa8c6('0x1')]},'callington':{'type':Sequelize[_0xa8c6('0x1')]},'callingtns':{'type':Sequelize[_0xa8c6('0x1')]},'dnid':{'type':Sequelize['STRING']},'rdnis':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xa8c6('0x1')]},'enhanced':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xa8c6('0x1')]},'threadid':{'type':Sequelize[_0xa8c6('0x1')]},'project_name':{'type':Sequelize[_0xa8c6('0x1')]},'joinAt':{'type':Sequelize[_0xa8c6('0x2')]},'leaveAt':{'type':Sequelize[_0xa8c6('0x2')]},'bot':{'type':Sequelize[_0xa8c6('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x2ca1=['STRING','DATE','sequelize','exports'];(function(_0x5a2635,_0x350231){var _0xbb4c68=function(_0x1ba0ec){while(--_0x1ba0ec){_0x5a2635['push'](_0x5a2635['shift']());}};_0xbb4c68(++_0x350231);}(_0x2ca1,0x116));var _0x12ca=function(_0x12d033,_0x25fa2f){_0x12d033=_0x12d033-0x0;var _0x3b4e80=_0x2ca1[_0x12d033];return _0x3b4e80;};'use strict';var Sequelize=require(_0x12ca('0x0'));module[_0x12ca('0x1')]={'network':{'type':Sequelize['STRING']},'network_script':{'type':Sequelize['STRING']},'request':{'type':Sequelize[_0x12ca('0x2')]},'channel':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x12ca('0x2')]},'type':{'type':Sequelize[_0x12ca('0x2')]},'uniqueid':{'type':Sequelize[_0x12ca('0x2')]},'version':{'type':Sequelize[_0x12ca('0x2')]},'callerid':{'type':Sequelize[_0x12ca('0x2')]},'calleridname':{'type':Sequelize[_0x12ca('0x2')]},'callingpres':{'type':Sequelize['STRING']},'callingani2':{'type':Sequelize['STRING']},'callington':{'type':Sequelize[_0x12ca('0x2')]},'callingtns':{'type':Sequelize[_0x12ca('0x2')]},'dnid':{'type':Sequelize[_0x12ca('0x2')]},'rdnis':{'type':Sequelize[_0x12ca('0x2')]},'context':{'type':Sequelize[_0x12ca('0x2')]},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x12ca('0x2')]},'enhanced':{'type':Sequelize[_0x12ca('0x2')]},'accountcode':{'type':Sequelize['STRING']},'threadid':{'type':Sequelize['STRING']},'project_name':{'type':Sequelize[_0x12ca('0x2')]},'joinAt':{'type':Sequelize[_0x12ca('0x3')]},'leaveAt':{'type':Sequelize[_0x12ca('0x3')]},'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 4c37829..b4d97c9 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 _0x751c=['eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','map','SquareReport','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','params','find','create','catch','body','describe'];(function(_0x11407c,_0x1d4209){var _0x5326b0=function(_0x423be8){while(--_0x423be8){_0x11407c['push'](_0x11407c['shift']());}};_0x5326b0(++_0x1d4209);}(_0x751c,0x1c8));var _0xc751=function(_0x1ac285,_0x25d523){_0x1ac285=_0x1ac285-0x0;var _0xfe3de4=_0x751c[_0x1ac285];return _0xfe3de4;};'use strict';var emlformat=require(_0xc751('0x0'));var rimraf=require(_0xc751('0x1'));var zipdir=require(_0xc751('0x2'));var jsonpatch=require(_0xc751('0x3'));var rp=require(_0xc751('0x4'));var moment=require('moment');var BPromise=require(_0xc751('0x5'));var Mustache=require(_0xc751('0x6'));var util=require('util');var path=require(_0xc751('0x7'));var sox=require(_0xc751('0x8'));var csv=require('to-csv');var ejs=require(_0xc751('0x9'));var fs=require('fs');var fs_extra=require(_0xc751('0xa'));var _=require(_0xc751('0xb'));var squel=require(_0xc751('0xc'));var crypto=require('crypto');var jsforce=require(_0xc751('0xd'));var deskjs=require(_0xc751('0xe'));var toCsv=require(_0xc751('0xf'));var querystring=require('querystring');var Papa=require(_0xc751('0x10'));var Redis=require('ioredis');var authService=require(_0xc751('0x11'));var qs=require(_0xc751('0x12'));var as=require(_0xc751('0x13'));var hardwareService=require(_0xc751('0x14'));var logger=require('../../config/logger')(_0xc751('0x15'));var utils=require(_0xc751('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xc751('0x17'))['db'];function respondWithStatusCode(_0x313f31,_0x3faba0){_0x3faba0=_0x3faba0||0xcc;return function(_0x2fccf7){if(_0x2fccf7){return _0x313f31[_0xc751('0x18')](_0x3faba0);}return _0x313f31[_0xc751('0x19')](_0x3faba0)[_0xc751('0x1a')]();};}function respondWithResult(_0x9e24ad,_0x2b2f93){_0x2b2f93=_0x2b2f93||0xc8;return function(_0x4295bc){if(_0x4295bc){return _0x9e24ad[_0xc751('0x19')](_0x2b2f93)['json'](_0x4295bc);}};}function respondWithFilteredResult(_0x33464a,_0x159272){return function(_0x200596){if(_0x200596){var _0x22c2b5=typeof _0x159272[_0xc751('0x1b')]===_0xc751('0x1c')&&typeof _0x159272[_0xc751('0x1d')]===_0xc751('0x1c');var _0x543906=_0x200596[_0xc751('0x1e')];var _0x510fb8=_0x22c2b5?0x0:_0x159272['offset'];var _0x21d1ff=_0x22c2b5?_0x200596[_0xc751('0x1e')]:_0x159272[_0xc751('0x1b')]+_0x159272[_0xc751('0x1d')];var _0x10cdf2;if(_0x21d1ff>=_0x543906){_0x21d1ff=_0x543906;_0x10cdf2=0xc8;}else{_0x10cdf2=0xce;}_0x33464a['status'](_0x10cdf2);return _0x33464a[_0xc751('0x1f')](_0xc751('0x20'),_0x510fb8+'-'+_0x21d1ff+'/'+_0x543906)['json'](_0x200596);}return null;};}function patchUpdates(_0x337f97){return function(_0xd84db7){try{jsonpatch[_0xc751('0x21')](_0xd84db7,_0x337f97,!![]);}catch(_0x1890fd){return BPromise[_0xc751('0x22')](_0x1890fd);}return _0xd84db7[_0xc751('0x23')]();};}function saveUpdates(_0x2774ac,_0x38af80){return function(_0xcd9114){if(_0xcd9114){return _0xcd9114[_0xc751('0x24')](_0x2774ac)[_0xc751('0x25')](function(_0x2b7ec1){return _0x2b7ec1;});}return null;};}function removeEntity(_0x16ac65,_0x25a031){return function(_0x3f8c71){if(_0x3f8c71){return _0x3f8c71[_0xc751('0x26')]()['then'](function(){_0x16ac65[_0xc751('0x19')](0xcc)[_0xc751('0x1a')]();});}};}function handleEntityNotFound(_0x55ebed,_0x2bf9c5){return function(_0x3c8071){if(!_0x3c8071){_0x55ebed[_0xc751('0x18')](0x194);}return _0x3c8071;};}function handleError(_0x2a615f,_0x46b171){_0x46b171=_0x46b171||0x1f4;return function(_0x53af77){logger[_0xc751('0x27')](_0x53af77['stack']);if(_0x53af77[_0xc751('0x28')]){delete _0x53af77[_0xc751('0x28')];}_0x2a615f['status'](_0x46b171)[_0xc751('0x29')](_0x53af77);};}exports[_0xc751('0x2a')]=function(_0x2ee2d4,_0x165d69){var _0x2f887f={},_0x2953c8={},_0x22449b={'count':0x0,'rows':[]};var _0x1be8b5=_[_0xc751('0x2b')](db[_0xc751('0x2c')][_0xc751('0x2d')],function(_0x765900){return{'name':_0x765900['fieldName'],'type':_0x765900[_0xc751('0x2e')][_0xc751('0x2f')]};});_0x2953c8[_0xc751('0x30')]=_[_0xc751('0x2b')](_0x1be8b5,'name');_0x2953c8[_0xc751('0x31')]=_[_0xc751('0x32')](_0x2ee2d4[_0xc751('0x31')]);_0x2953c8[_0xc751('0x33')]=_[_0xc751('0x34')](_0x2953c8['model'],_0x2953c8[_0xc751('0x31')]);_0x2f887f[_0xc751('0x35')]=_[_0xc751('0x34')](_0x2953c8[_0xc751('0x30')],qs[_0xc751('0x36')](_0x2ee2d4[_0xc751('0x31')]['fields']));_0x2f887f[_0xc751('0x35')]=_0x2f887f['attributes'][_0xc751('0x37')]?_0x2f887f[_0xc751('0x35')]:_0x2953c8[_0xc751('0x30')];if(!_0x2ee2d4[_0xc751('0x31')][_0xc751('0x38')](_0xc751('0x39'))){_0x2f887f[_0xc751('0x1d')]=qs[_0xc751('0x1d')](_0x2ee2d4[_0xc751('0x31')][_0xc751('0x1d')]);_0x2f887f[_0xc751('0x1b')]=qs[_0xc751('0x1b')](_0x2ee2d4[_0xc751('0x31')][_0xc751('0x1b')]);}_0x2f887f[_0xc751('0x3a')]=qs[_0xc751('0x3b')](_0x2ee2d4[_0xc751('0x31')][_0xc751('0x3b')]);_0x2f887f[_0xc751('0x3c')]=qs['filters'](_[_0xc751('0x3d')](_0x2ee2d4[_0xc751('0x31')],_0x2953c8[_0xc751('0x33')]),_0x1be8b5);if(_0x2ee2d4[_0xc751('0x31')][_0xc751('0x3e')]){_0x2f887f[_0xc751('0x3c')]=_[_0xc751('0x3f')](_0x2f887f[_0xc751('0x3c')],{'$or':_['map'](_0x1be8b5,function(_0xf6c26e){if(_0xf6c26e['type']!==_0xc751('0x40')){var _0x1dbab0={};_0x1dbab0[_0xf6c26e[_0xc751('0x28')]]={'$like':'%'+_0x2ee2d4[_0xc751('0x31')][_0xc751('0x3e')]+'%'};return _0x1dbab0;}})});}_0x2f887f=_[_0xc751('0x3f')]({},_0x2f887f,_0x2ee2d4[_0xc751('0x41')]);var _0x2585e8={'where':_0x2f887f[_0xc751('0x3c')]};return db[_0xc751('0x2c')][_0xc751('0x1e')](_0x2585e8)[_0xc751('0x25')](function(_0x52faf3){_0x22449b[_0xc751('0x1e')]=_0x52faf3;if(_0x2ee2d4['query'][_0xc751('0x42')]){_0x2f887f[_0xc751('0x43')]=[{'all':!![]}];}return db[_0xc751('0x2c')][_0xc751('0x44')](_0x2f887f);})[_0xc751('0x25')](function(_0x11110f){_0x22449b[_0xc751('0x45')]=_0x11110f;return _0x22449b;})['then'](respondWithFilteredResult(_0x165d69,_0x2f887f))['catch'](handleError(_0x165d69,null));};exports['show']=function(_0x37cc87,_0x2018c5){var _0x120bb8={'raw':!![],'where':{'id':_0x37cc87[_0xc751('0x46')]['id']}},_0xa99d3e={};_0xa99d3e[_0xc751('0x30')]=_[_0xc751('0x32')](db['SquareReport'][_0xc751('0x2d')]);_0xa99d3e[_0xc751('0x31')]=_[_0xc751('0x32')](_0x37cc87[_0xc751('0x31')]);_0xa99d3e[_0xc751('0x33')]=_['intersection'](_0xa99d3e[_0xc751('0x30')],_0xa99d3e[_0xc751('0x31')]);_0x120bb8['attributes']=_[_0xc751('0x34')](_0xa99d3e['model'],qs[_0xc751('0x36')](_0x37cc87[_0xc751('0x31')][_0xc751('0x36')]));_0x120bb8[_0xc751('0x35')]=_0x120bb8['attributes'][_0xc751('0x37')]?_0x120bb8[_0xc751('0x35')]:_0xa99d3e[_0xc751('0x30')];if(_0x37cc87[_0xc751('0x31')]['includeAll']){_0x120bb8[_0xc751('0x43')]=[{'all':!![]}];}_0x120bb8=_[_0xc751('0x3f')]({},_0x120bb8,_0x37cc87[_0xc751('0x41')]);return db[_0xc751('0x2c')][_0xc751('0x47')](_0x120bb8)[_0xc751('0x25')](handleEntityNotFound(_0x2018c5,null))[_0xc751('0x25')](respondWithResult(_0x2018c5,null))['catch'](handleError(_0x2018c5,null));};exports[_0xc751('0x48')]=function(_0x178acf,_0x3c80f5){return db[_0xc751('0x2c')]['create'](_0x178acf['body'],{})[_0xc751('0x25')](respondWithResult(_0x3c80f5,0xc9))[_0xc751('0x49')](handleError(_0x3c80f5,null));};exports[_0xc751('0x24')]=function(_0xb71f8e,_0x4b0495){if(_0xb71f8e[_0xc751('0x4a')]['id']){delete _0xb71f8e[_0xc751('0x4a')]['id'];}return db[_0xc751('0x2c')][_0xc751('0x47')]({'where':{'id':_0xb71f8e[_0xc751('0x46')]['id']}})['then'](handleEntityNotFound(_0x4b0495,null))['then'](saveUpdates(_0xb71f8e[_0xc751('0x4a')],null))[_0xc751('0x25')](respondWithResult(_0x4b0495,null))[_0xc751('0x49')](handleError(_0x4b0495,null));};exports[_0xc751('0x26')]=function(_0x27d3fd,_0x3cb7e7){return db['SquareReport']['find']({'where':{'id':_0x27d3fd['params']['id']}})[_0xc751('0x25')](handleEntityNotFound(_0x3cb7e7,null))[_0xc751('0x25')](removeEntity(_0x3cb7e7,null))[_0xc751('0x49')](handleError(_0x3cb7e7,null));};exports[_0xc751('0x4b')]=function(_0x474e22,_0x35e0f6){return db[_0xc751('0x2c')]['describe']()[_0xc751('0x25')](respondWithResult(_0x35e0f6,null))['catch'](handleError(_0x35e0f6,null));}; \ No newline at end of file +var _0xf73c=['to-csv','ejs','lodash','jsforce','desk.js','querystring','../../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','Content-Range','apply','reject','save','update','then','sendStatus','error','stack','name','send','index','map','SquareReport','rawAttributes','fieldName','type','key','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','keys','find','create','body','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox'];(function(_0x12a984,_0x41c519){var _0x4a625c=function(_0x1d0b99){while(--_0x1d0b99){_0x12a984['push'](_0x12a984['shift']());}};_0x4a625c(++_0x41c519);}(_0xf73c,0x8e));var _0xcf73=function(_0xe98afa,_0x578029){_0xe98afa=_0xe98afa-0x0;var _0x4a5af7=_0xf73c[_0xe98afa];return _0x4a5af7;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xcf73('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xcf73('0x1'));var rp=require(_0xcf73('0x2'));var moment=require(_0xcf73('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xcf73('0x4'));var util=require(_0xcf73('0x5'));var path=require(_0xcf73('0x6'));var sox=require(_0xcf73('0x7'));var csv=require(_0xcf73('0x8'));var ejs=require(_0xcf73('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xcf73('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xcf73('0xb'));var deskjs=require(_0xcf73('0xc'));var toCsv=require(_0xcf73('0x8'));var querystring=require(_0xcf73('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xcf73('0xe'));var qs=require(_0xcf73('0xf'));var as=require(_0xcf73('0x10'));var hardwareService=require(_0xcf73('0x11'));var logger=require('../../config/logger')(_0xcf73('0x12'));var utils=require(_0xcf73('0x13'));var config=require(_0xcf73('0x14'));var licenseUtil=require(_0xcf73('0x15'));var db=require(_0xcf73('0x16'))['db'];function respondWithStatusCode(_0x4c3e7a,_0x25242d){_0x25242d=_0x25242d||0xcc;return function(_0x55d6c9){if(_0x55d6c9){return _0x4c3e7a['sendStatus'](_0x25242d);}return _0x4c3e7a[_0xcf73('0x17')](_0x25242d)[_0xcf73('0x18')]();};}function respondWithResult(_0xea329f,_0x26d47d){_0x26d47d=_0x26d47d||0xc8;return function(_0x2e54ff){if(_0x2e54ff){return _0xea329f[_0xcf73('0x17')](_0x26d47d)[_0xcf73('0x19')](_0x2e54ff);}};}function respondWithFilteredResult(_0x363046,_0x30e9b0){return function(_0x3cb1b9){if(_0x3cb1b9){var _0x132a26=typeof _0x30e9b0[_0xcf73('0x1a')]===_0xcf73('0x1b')&&typeof _0x30e9b0[_0xcf73('0x1c')]===_0xcf73('0x1b');var _0xfe83b1=_0x3cb1b9[_0xcf73('0x1d')];var _0x45fbcc=_0x132a26?0x0:_0x30e9b0['offset'];var _0x34c585=_0x132a26?_0x3cb1b9[_0xcf73('0x1d')]:_0x30e9b0[_0xcf73('0x1a')]+_0x30e9b0[_0xcf73('0x1c')];var _0xcc9739;if(_0x34c585>=_0xfe83b1){_0x34c585=_0xfe83b1;_0xcc9739=0xc8;}else{_0xcc9739=0xce;}_0x363046[_0xcf73('0x17')](_0xcc9739);return _0x363046['set'](_0xcf73('0x1e'),_0x45fbcc+'-'+_0x34c585+'/'+_0xfe83b1)[_0xcf73('0x19')](_0x3cb1b9);}return null;};}function patchUpdates(_0x14b24a){return function(_0x3edb04){try{jsonpatch[_0xcf73('0x1f')](_0x3edb04,_0x14b24a,!![]);}catch(_0x16ea17){return BPromise[_0xcf73('0x20')](_0x16ea17);}return _0x3edb04[_0xcf73('0x21')]();};}function saveUpdates(_0x2e1cc3,_0x38ac4c){return function(_0xa369ee){if(_0xa369ee){return _0xa369ee[_0xcf73('0x22')](_0x2e1cc3)[_0xcf73('0x23')](function(_0x1d0407){return _0x1d0407;});}return null;};}function removeEntity(_0x42c983,_0x1e3f3b){return function(_0xef30f6){if(_0xef30f6){return _0xef30f6['destroy']()[_0xcf73('0x23')](function(){_0x42c983[_0xcf73('0x17')](0xcc)[_0xcf73('0x18')]();});}};}function handleEntityNotFound(_0x3a58b5,_0x336cb5){return function(_0x24e3e3){if(!_0x24e3e3){_0x3a58b5[_0xcf73('0x24')](0x194);}return _0x24e3e3;};}function handleError(_0x51f527,_0x175085){_0x175085=_0x175085||0x1f4;return function(_0x920091){logger[_0xcf73('0x25')](_0x920091[_0xcf73('0x26')]);if(_0x920091[_0xcf73('0x27')]){delete _0x920091[_0xcf73('0x27')];}_0x51f527[_0xcf73('0x17')](_0x175085)[_0xcf73('0x28')](_0x920091);};}exports[_0xcf73('0x29')]=function(_0x4ec508,_0x4b5097){var _0xc186b4={},_0x344a8e={},_0x24ba2c={'count':0x0,'rows':[]};var _0x229795=_[_0xcf73('0x2a')](db[_0xcf73('0x2b')][_0xcf73('0x2c')],function(_0x4b6aa4){return{'name':_0x4b6aa4[_0xcf73('0x2d')],'type':_0x4b6aa4[_0xcf73('0x2e')][_0xcf73('0x2f')]};});_0x344a8e['model']=_[_0xcf73('0x2a')](_0x229795,_0xcf73('0x27'));_0x344a8e['query']=_['keys'](_0x4ec508[_0xcf73('0x30')]);_0x344a8e[_0xcf73('0x31')]=_[_0xcf73('0x32')](_0x344a8e['model'],_0x344a8e[_0xcf73('0x30')]);_0xc186b4['attributes']=_[_0xcf73('0x32')](_0x344a8e[_0xcf73('0x33')],qs[_0xcf73('0x34')](_0x4ec508[_0xcf73('0x30')]['fields']));_0xc186b4['attributes']=_0xc186b4[_0xcf73('0x35')][_0xcf73('0x36')]?_0xc186b4[_0xcf73('0x35')]:_0x344a8e[_0xcf73('0x33')];if(!_0x4ec508[_0xcf73('0x30')][_0xcf73('0x37')](_0xcf73('0x38'))){_0xc186b4[_0xcf73('0x1c')]=qs[_0xcf73('0x1c')](_0x4ec508[_0xcf73('0x30')]['limit']);_0xc186b4[_0xcf73('0x1a')]=qs[_0xcf73('0x1a')](_0x4ec508['query'][_0xcf73('0x1a')]);}_0xc186b4[_0xcf73('0x39')]=qs['sort'](_0x4ec508[_0xcf73('0x30')][_0xcf73('0x3a')]);_0xc186b4['where']=qs[_0xcf73('0x31')](_[_0xcf73('0x3b')](_0x4ec508[_0xcf73('0x30')],_0x344a8e['filters']),_0x229795);if(_0x4ec508[_0xcf73('0x30')][_0xcf73('0x3c')]){_0xc186b4[_0xcf73('0x3d')]=_[_0xcf73('0x3e')](_0xc186b4[_0xcf73('0x3d')],{'$or':_[_0xcf73('0x2a')](_0x229795,function(_0x45cf6a){if(_0x45cf6a['type']!==_0xcf73('0x3f')){var _0xad65c8={};_0xad65c8[_0x45cf6a[_0xcf73('0x27')]]={'$like':'%'+_0x4ec508[_0xcf73('0x30')]['filter']+'%'};return _0xad65c8;}})});}_0xc186b4=_['merge']({},_0xc186b4,_0x4ec508[_0xcf73('0x40')]);var _0x10d161={'where':_0xc186b4[_0xcf73('0x3d')]};return db[_0xcf73('0x2b')][_0xcf73('0x1d')](_0x10d161)['then'](function(_0xb8aa0c){_0x24ba2c[_0xcf73('0x1d')]=_0xb8aa0c;if(_0x4ec508[_0xcf73('0x30')][_0xcf73('0x41')]){_0xc186b4[_0xcf73('0x42')]=[{'all':!![]}];}return db[_0xcf73('0x2b')]['findAll'](_0xc186b4);})[_0xcf73('0x23')](function(_0x4aaf8c){_0x24ba2c[_0xcf73('0x43')]=_0x4aaf8c;return _0x24ba2c;})[_0xcf73('0x23')](respondWithFilteredResult(_0x4b5097,_0xc186b4))[_0xcf73('0x44')](handleError(_0x4b5097,null));};exports[_0xcf73('0x45')]=function(_0x460b82,_0x4ab86f){var _0x4b9dc9={'raw':!![],'where':{'id':_0x460b82[_0xcf73('0x46')]['id']}},_0x2c94d7={};_0x2c94d7['model']=_['keys'](db[_0xcf73('0x2b')][_0xcf73('0x2c')]);_0x2c94d7[_0xcf73('0x30')]=_[_0xcf73('0x47')](_0x460b82['query']);_0x2c94d7['filters']=_[_0xcf73('0x32')](_0x2c94d7[_0xcf73('0x33')],_0x2c94d7[_0xcf73('0x30')]);_0x4b9dc9[_0xcf73('0x35')]=_[_0xcf73('0x32')](_0x2c94d7['model'],qs[_0xcf73('0x34')](_0x460b82[_0xcf73('0x30')][_0xcf73('0x34')]));_0x4b9dc9['attributes']=_0x4b9dc9[_0xcf73('0x35')]['length']?_0x4b9dc9[_0xcf73('0x35')]:_0x2c94d7[_0xcf73('0x33')];if(_0x460b82[_0xcf73('0x30')]['includeAll']){_0x4b9dc9['include']=[{'all':!![]}];}_0x4b9dc9=_[_0xcf73('0x3e')]({},_0x4b9dc9,_0x460b82[_0xcf73('0x40')]);return db['SquareReport'][_0xcf73('0x48')](_0x4b9dc9)['then'](handleEntityNotFound(_0x4ab86f,null))[_0xcf73('0x23')](respondWithResult(_0x4ab86f,null))['catch'](handleError(_0x4ab86f,null));};exports[_0xcf73('0x49')]=function(_0x42a020,_0x573217){return db['SquareReport'][_0xcf73('0x49')](_0x42a020['body'],{})[_0xcf73('0x23')](respondWithResult(_0x573217,0xc9))[_0xcf73('0x44')](handleError(_0x573217,null));};exports['update']=function(_0x15e703,_0x192a78){if(_0x15e703['body']['id']){delete _0x15e703[_0xcf73('0x4a')]['id'];}return db[_0xcf73('0x2b')][_0xcf73('0x48')]({'where':{'id':_0x15e703[_0xcf73('0x46')]['id']}})[_0xcf73('0x23')](handleEntityNotFound(_0x192a78,null))[_0xcf73('0x23')](saveUpdates(_0x15e703[_0xcf73('0x4a')],null))[_0xcf73('0x23')](respondWithResult(_0x192a78,null))[_0xcf73('0x44')](handleError(_0x192a78,null));};exports['destroy']=function(_0x1cf645,_0x1934f3){return db[_0xcf73('0x2b')][_0xcf73('0x48')]({'where':{'id':_0x1cf645[_0xcf73('0x46')]['id']}})[_0xcf73('0x23')](handleEntityNotFound(_0x1934f3,null))[_0xcf73('0x23')](removeEntity(_0x1934f3,null))[_0xcf73('0x44')](handleError(_0x1934f3,null));};exports['describe']=function(_0x1d17f1,_0x4a2e67){return db['SquareReport']['describe']()[_0xcf73('0x23')](respondWithResult(_0x4a2e67,null))[_0xcf73('0x44')](handleError(_0x4a2e67,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index 48966b1..5a4e3f0 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 _0x8897=['define','report_square','uniqueid','project_name','leaveAt','lodash','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./squareReport.attributes'];(function(_0x1f66a8,_0x1f25d4){var _0x99b2c3=function(_0x3a90bb){while(--_0x3a90bb){_0x1f66a8['push'](_0x1f66a8['shift']());}};_0x99b2c3(++_0x1f25d4);}(_0x8897,0x155));var _0x7889=function(_0x485fd8,_0x4845d5){_0x485fd8=_0x485fd8-0x0;var _0x3c3614=_0x8897[_0x485fd8];return _0x3c3614;};'use strict';var _=require(_0x7889('0x0'));var util=require(_0x7889('0x1'));var logger=require(_0x7889('0x2'))(_0x7889('0x3'));var moment=require(_0x7889('0x4'));var BPromise=require('bluebird');var rp=require(_0x7889('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7889('0x6'));var config=require(_0x7889('0x7'));var attributes=require(_0x7889('0x8'));module['exports']=function(_0x49704c,_0x5a7864){return _0x49704c[_0x7889('0x9')]('SquareReport',attributes,{'tableName':_0x7889('0xa'),'paranoid':![],'indexes':[{'name':'uid_pname','fields':[_0x7889('0xb'),_0x7889('0xc')]},{'name':_0x7889('0xd'),'fields':['leaveAt']}],'timestamps':!![]});}; \ No newline at end of file +var _0xdb4f=['SquareReport','report_square','uid_pname','uniqueid','project_name','leaveAt','util','../../config/logger','moment','../../config/environment','./squareReport.attributes','exports','define'];(function(_0x45f68b,_0x8fc70d){var _0x3c470a=function(_0x493684){while(--_0x493684){_0x45f68b['push'](_0x45f68b['shift']());}};_0x3c470a(++_0x8fc70d);}(_0xdb4f,0xd6));var _0xfdb4=function(_0x3c2722,_0x1c4748){_0x3c2722=_0x3c2722-0x0;var _0x99c954=_0xdb4f[_0x3c2722];return _0x99c954;};'use strict';var _=require('lodash');var util=require(_0xfdb4('0x0'));var logger=require(_0xfdb4('0x1'))('api');var moment=require(_0xfdb4('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xfdb4('0x3'));var attributes=require(_0xfdb4('0x4'));module[_0xfdb4('0x5')]=function(_0x2bcce8,_0x3b573e){return _0x2bcce8[_0xfdb4('0x6')](_0xfdb4('0x7'),attributes,{'tableName':_0xfdb4('0x8'),'paranoid':![],'indexes':[{'name':_0xfdb4('0x9'),'fields':[_0xfdb4('0xa'),_0xfdb4('0xb')]},{'name':_0xfdb4('0xc'),'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 ccb74cd..d0fd0d0 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 _0x1bce=['rpc','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','error','SquareReport,\x20%s,\x20%s','message','result','catch','CreateSquareReport','SquareReport','body','options','raw','stringify','UpdateSquareReport','update','where','limit','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x303c46,_0x7bb727){var _0x300fcd=function(_0x236821){while(--_0x236821){_0x303c46['push'](_0x303c46['shift']());}};_0x300fcd(++_0x7bb727);}(_0x1bce,0xf8));var _0xe1bc=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x1bce[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xe1bc('0x0'));var util=require(_0xe1bc('0x1'));var moment=require('moment');var BPromise=require(_0xe1bc('0x2'));var rs=require(_0xe1bc('0x3'));var fs=require('fs');var Redis=require(_0xe1bc('0x4'));var db=require(_0xe1bc('0x5'))['db'];var utils=require(_0xe1bc('0x6'));var logger=require(_0xe1bc('0x7'))(_0xe1bc('0x8'));var config=require(_0xe1bc('0x9'));var jayson=require(_0xe1bc('0xa'));var client=jayson['client'][_0xe1bc('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x302845,_0x4e92ba,_0x1611b8){return new BPromise(function(_0x473b2c,_0x447bb8){return client[_0xe1bc('0xc')](_0x302845,_0x1611b8)[_0xe1bc('0xd')](function(_0xfd2591){logger[_0xe1bc('0xe')]('SquareReport,\x20%s,\x20%s',_0x4e92ba,_0xe1bc('0xf'));logger[_0xe1bc('0x10')]('SquareReport,\x20%s,\x20%s,\x20%s',_0x4e92ba,_0xe1bc('0xf'),JSON['stringify'](_0xfd2591));if(_0xfd2591[_0xe1bc('0x11')]){if(_0xfd2591[_0xe1bc('0x11')]['code']===0x1f4){logger[_0xe1bc('0x11')](_0xe1bc('0x12'),_0x4e92ba,_0xfd2591['error']['message']);return _0x447bb8(_0xfd2591['error'][_0xe1bc('0x13')]);}logger[_0xe1bc('0x11')](_0xe1bc('0x12'),_0x4e92ba,_0xfd2591[_0xe1bc('0x11')][_0xe1bc('0x13')]);return _0x473b2c(_0xfd2591[_0xe1bc('0x11')][_0xe1bc('0x13')]);}else{logger[_0xe1bc('0xe')]('SquareReport,\x20%s,\x20%s',_0x4e92ba,_0xe1bc('0xf'));_0x473b2c(_0xfd2591[_0xe1bc('0x14')][_0xe1bc('0x13')]);}})[_0xe1bc('0x15')](function(_0x58544e){logger[_0xe1bc('0x11')]('SquareReport,\x20%s,\x20%s',_0x4e92ba,_0x58544e);_0x447bb8(_0x58544e);});});}exports[_0xe1bc('0x16')]=function(_0x141d7d){var _0x405a44=this;return new Promise(function(_0x152d0b,_0x14ed5b){return db[_0xe1bc('0x17')]['create'](_0x141d7d[_0xe1bc('0x18')],{'raw':_0x141d7d[_0xe1bc('0x19')]?_0x141d7d['options'][_0xe1bc('0x1a')]===undefined?!![]:![]:!![]})[_0xe1bc('0xd')](function(_0x11836b){logger[_0xe1bc('0xe')]('CreateSquareReport',_0x141d7d);logger[_0xe1bc('0x10')]('CreateSquareReport',_0x141d7d,JSON[_0xe1bc('0x1b')](_0x11836b));_0x152d0b(_0x11836b);})[_0xe1bc('0x15')](function(_0x41f8d1){logger[_0xe1bc('0x11')]('CreateSquareReport',_0x41f8d1[_0xe1bc('0x13')],_0x141d7d);_0x14ed5b(_0x405a44['error'](0x1f4,_0x41f8d1[_0xe1bc('0x13')]));});});};exports[_0xe1bc('0x1c')]=function(_0x1c43f8){var _0x2a32db=this;return new Promise(function(_0x9dc8ad,_0x3808db){return db[_0xe1bc('0x17')][_0xe1bc('0x1d')](_0x1c43f8[_0xe1bc('0x18')],{'raw':_0x1c43f8[_0xe1bc('0x19')]?_0x1c43f8['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1c43f8['options']?_0x1c43f8[_0xe1bc('0x19')][_0xe1bc('0x1e')]||null:null,'attributes':_0x1c43f8[_0xe1bc('0x19')]?_0x1c43f8[_0xe1bc('0x19')]['attributes']||null:null,'limit':_0x1c43f8['options']?_0x1c43f8[_0xe1bc('0x19')][_0xe1bc('0x1f')]||null:null})[_0xe1bc('0xd')](function(_0x3e730d){logger['info'](_0xe1bc('0x1c'),_0x1c43f8);logger['debug'](_0xe1bc('0x1c'),_0x1c43f8,JSON[_0xe1bc('0x1b')](_0x3e730d));_0x9dc8ad(_0x3e730d);})['catch'](function(_0xc9e82d){logger[_0xe1bc('0x11')](_0xe1bc('0x1c'),_0xc9e82d['message'],_0x1c43f8);_0x3808db(_0x2a32db[_0xe1bc('0x11')](0x1f4,_0xc9e82d[_0xe1bc('0x13')]));});});}; \ No newline at end of file +var _0xbb9d=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','info','SquareReport,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','SquareReport','create','options','raw','then','CreateSquareReport','update','body','where','UpdateSquareReport','lodash','util','moment','bluebird','randomstring'];(function(_0x49da8d,_0x16590e){var _0x2729b5=function(_0xe31f31){while(--_0xe31f31){_0x49da8d['push'](_0x49da8d['shift']());}};_0x2729b5(++_0x16590e);}(_0xbb9d,0x10b));var _0xdbb9=function(_0x514f32,_0x51e8f9){_0x514f32=_0x514f32-0x0;var _0x534c29=_0xbb9d[_0x514f32];return _0x534c29;};'use strict';var _=require(_0xdbb9('0x0'));var util=require(_0xdbb9('0x1'));var moment=require(_0xdbb9('0x2'));var BPromise=require(_0xdbb9('0x3'));var rs=require(_0xdbb9('0x4'));var fs=require('fs');var Redis=require(_0xdbb9('0x5'));var db=require(_0xdbb9('0x6'))['db'];var utils=require(_0xdbb9('0x7'));var logger=require(_0xdbb9('0x8'))(_0xdbb9('0x9'));var config=require(_0xdbb9('0xa'));var jayson=require('jayson/promise');var client=jayson[_0xdbb9('0xb')][_0xdbb9('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2b0e61,_0x54c81b,_0x5b4952){return new BPromise(function(_0x574971,_0x4d1289){return client[_0xdbb9('0xd')](_0x2b0e61,_0x5b4952)['then'](function(_0x5d5044){logger[_0xdbb9('0xe')](_0xdbb9('0xf'),_0x54c81b,'request\x20sent');logger[_0xdbb9('0x10')]('SquareReport,\x20%s,\x20%s,\x20%s',_0x54c81b,_0xdbb9('0x11'),JSON[_0xdbb9('0x12')](_0x5d5044));if(_0x5d5044[_0xdbb9('0x13')]){if(_0x5d5044[_0xdbb9('0x13')][_0xdbb9('0x14')]===0x1f4){logger[_0xdbb9('0x13')]('SquareReport,\x20%s,\x20%s',_0x54c81b,_0x5d5044[_0xdbb9('0x13')][_0xdbb9('0x15')]);return _0x4d1289(_0x5d5044[_0xdbb9('0x13')]['message']);}logger[_0xdbb9('0x13')](_0xdbb9('0xf'),_0x54c81b,_0x5d5044['error'][_0xdbb9('0x15')]);return _0x574971(_0x5d5044[_0xdbb9('0x13')][_0xdbb9('0x15')]);}else{logger[_0xdbb9('0xe')]('SquareReport,\x20%s,\x20%s',_0x54c81b,_0xdbb9('0x11'));_0x574971(_0x5d5044[_0xdbb9('0x16')]['message']);}})[_0xdbb9('0x17')](function(_0x500c09){logger[_0xdbb9('0x13')](_0xdbb9('0xf'),_0x54c81b,_0x500c09);_0x4d1289(_0x500c09);});});}exports['CreateSquareReport']=function(_0x173c12){var _0x2bbf34=this;return new Promise(function(_0x3173c1,_0xaebbf8){return db[_0xdbb9('0x18')][_0xdbb9('0x19')](_0x173c12['body'],{'raw':_0x173c12[_0xdbb9('0x1a')]?_0x173c12['options'][_0xdbb9('0x1b')]===undefined?!![]:![]:!![]})[_0xdbb9('0x1c')](function(_0x3e901a){logger[_0xdbb9('0xe')](_0xdbb9('0x1d'),_0x173c12);logger[_0xdbb9('0x10')]('CreateSquareReport',_0x173c12,JSON['stringify'](_0x3e901a));_0x3173c1(_0x3e901a);})[_0xdbb9('0x17')](function(_0x2619a4){logger['error'](_0xdbb9('0x1d'),_0x2619a4[_0xdbb9('0x15')],_0x173c12);_0xaebbf8(_0x2bbf34[_0xdbb9('0x13')](0x1f4,_0x2619a4['message']));});});};exports['UpdateSquareReport']=function(_0x41b069){var _0x42e0de=this;return new Promise(function(_0x3dd91d,_0x16f29e){return db[_0xdbb9('0x18')][_0xdbb9('0x1e')](_0x41b069[_0xdbb9('0x1f')],{'raw':_0x41b069['options']?_0x41b069[_0xdbb9('0x1a')][_0xdbb9('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x41b069[_0xdbb9('0x1a')]?_0x41b069[_0xdbb9('0x1a')][_0xdbb9('0x20')]||null:null,'attributes':_0x41b069[_0xdbb9('0x1a')]?_0x41b069[_0xdbb9('0x1a')]['attributes']||null:null,'limit':_0x41b069[_0xdbb9('0x1a')]?_0x41b069[_0xdbb9('0x1a')]['limit']||null:null})['then'](function(_0x4b2ac8){logger['info'](_0xdbb9('0x21'),_0x41b069);logger[_0xdbb9('0x10')]('UpdateSquareReport',_0x41b069,JSON[_0xdbb9('0x12')](_0x4b2ac8));_0x3dd91d(_0x4b2ac8);})[_0xdbb9('0x17')](function(_0x5ee796){logger[_0xdbb9('0x13')](_0xdbb9('0x21'),_0x5ee796[_0xdbb9('0x15')],_0x41b069);_0x16f29e(_0x42e0de[_0xdbb9('0x13')](0x1f4,_0x5ee796[_0xdbb9('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index 9f108b4..e08cdd1 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 _0x3a58=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReportDetail.controller','get','isAuthenticated','index','describe','/:id','post','create','update','delete','destroy','exports','path'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x3a58,0xaa));var _0x83a5=function(_0x3bd8cf,_0x3813fd){_0x3bd8cf=_0x3bd8cf-0x0;var _0x40a161=_0x3a58[_0x3bd8cf];return _0x40a161;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x83a5('0x0'));var timeout=require('connect-timeout');var express=require(_0x83a5('0x1'));var router=express[_0x83a5('0x2')]();var fs_extra=require(_0x83a5('0x3'));var auth=require(_0x83a5('0x4'));var interaction=require(_0x83a5('0x5'));var config=require(_0x83a5('0x6'));var controller=require(_0x83a5('0x7'));router[_0x83a5('0x8')]('/',auth[_0x83a5('0x9')](),controller[_0x83a5('0xa')]);router[_0x83a5('0x8')]('/describe',auth[_0x83a5('0x9')](),controller[_0x83a5('0xb')]);router[_0x83a5('0x8')](_0x83a5('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x83a5('0xd')]('/',auth[_0x83a5('0x9')](),controller[_0x83a5('0xe')]);router['put'](_0x83a5('0xc'),auth[_0x83a5('0x9')](),controller[_0x83a5('0xf')]);router[_0x83a5('0x10')](_0x83a5('0xc'),auth['isAuthenticated'](),controller[_0x83a5('0x11')]);module[_0x83a5('0x12')]=router; \ No newline at end of file +var _0xe5a8=['isAuthenticated','/describe','describe','/:id','show','post','create','put','update','delete','multer','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get'];(function(_0x14d896,_0x53578b){var _0x28679a=function(_0x14921f){while(--_0x14921f){_0x14d896['push'](_0x14d896['shift']());}};_0x28679a(++_0x53578b);}(_0xe5a8,0x64));var _0x8e5a=function(_0x5a907b,_0x142a25){_0x5a907b=_0x5a907b-0x0;var _0x40f067=_0xe5a8[_0x5a907b];return _0x40f067;};'use strict';var multer=require(_0x8e5a('0x0'));var util=require('util');var path=require(_0x8e5a('0x1'));var timeout=require(_0x8e5a('0x2'));var express=require(_0x8e5a('0x3'));var router=express[_0x8e5a('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x8e5a('0x5'));var config=require(_0x8e5a('0x6'));var controller=require('./squareReportDetail.controller');router[_0x8e5a('0x7')]('/',auth[_0x8e5a('0x8')](),controller['index']);router['get'](_0x8e5a('0x9'),auth['isAuthenticated'](),controller[_0x8e5a('0xa')]);router[_0x8e5a('0x7')](_0x8e5a('0xb'),auth[_0x8e5a('0x8')](),controller[_0x8e5a('0xc')]);router[_0x8e5a('0xd')]('/',auth[_0x8e5a('0x8')](),controller[_0x8e5a('0xe')]);router[_0x8e5a('0xf')](_0x8e5a('0xb'),auth[_0x8e5a('0x8')](),controller[_0x8e5a('0x10')]);router[_0x8e5a('0x11')]('/:id',auth[_0x8e5a('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.attributes.js b/server/api/squareReportDetail/squareReportDetail.attributes.js index f1fb3c7..4b663ca 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 _0x1f6e=['exports','STRING','TEXT'];(function(_0x46b37b,_0x222c44){var _0x2c5dac=function(_0x41625b){while(--_0x41625b){_0x46b37b['push'](_0x46b37b['shift']());}};_0x2c5dac(++_0x222c44);}(_0x1f6e,0x171));var _0xe1f6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1f6e[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0xe1f6('0x0')]={'uniqueid':{'type':Sequelize['STRING']},'node':{'type':Sequelize[_0xe1f6('0x1')]},'application':{'type':Sequelize['STRING']},'data':{'type':Sequelize[_0xe1f6('0x2')]},'project_name':{'type':Sequelize[_0xe1f6('0x1')]},'callerid':{'type':Sequelize[_0xe1f6('0x1')]}}; \ No newline at end of file +var _0x829f=['exports','STRING'];(function(_0x549d00,_0x5e5d79){var _0x248617=function(_0x4ba607){while(--_0x4ba607){_0x549d00['push'](_0x549d00['shift']());}};_0x248617(++_0x5e5d79);}(_0x829f,0x142));var _0xf829=function(_0x7b392a,_0x4c5bae){_0x7b392a=_0x7b392a-0x0;var _0x345400=_0x829f[_0x7b392a];return _0x345400;};'use strict';var Sequelize=require('sequelize');module[_0xf829('0x0')]={'uniqueid':{'type':Sequelize[_0xf829('0x1')]},'node':{'type':Sequelize[_0xf829('0x1')]},'application':{'type':Sequelize[_0xf829('0x1')]},'data':{'type':Sequelize['TEXT']},'project_name':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0xf829('0x1')]}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index bd6029b..c41d41c 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 _0x8fa4=['find','create','body','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','index','SquareDetailsReport','rawAttributes','type','key','map','query','keys','intersection','model','attributes','fields','nolimit','order','sort','where','filters','filter','merge','options','findAll','rows','catch','show','params','length'];(function(_0x41f882,_0x360760){var _0x402761=function(_0x325158){while(--_0x325158){_0x41f882['push'](_0x41f882['shift']());}};_0x402761(++_0x360760);}(_0x8fa4,0x175));var _0x48fa=function(_0x23c2ec,_0x5adc8e){_0x23c2ec=_0x23c2ec-0x0;var _0xece329=_0x8fa4[_0x23c2ec];return _0xece329;};'use strict';var emlformat=require(_0x48fa('0x0'));var rimraf=require(_0x48fa('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x48fa('0x2'));var rp=require(_0x48fa('0x3'));var moment=require(_0x48fa('0x4'));var BPromise=require(_0x48fa('0x5'));var Mustache=require(_0x48fa('0x6'));var util=require(_0x48fa('0x7'));var path=require(_0x48fa('0x8'));var sox=require(_0x48fa('0x9'));var csv=require('to-csv');var ejs=require(_0x48fa('0xa'));var fs=require('fs');var fs_extra=require(_0x48fa('0xb'));var _=require(_0x48fa('0xc'));var squel=require(_0x48fa('0xd'));var crypto=require('crypto');var jsforce=require(_0x48fa('0xe'));var deskjs=require(_0x48fa('0xf'));var toCsv=require('to-csv');var querystring=require(_0x48fa('0x10'));var Papa=require(_0x48fa('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x48fa('0x12'));var as=require(_0x48fa('0x13'));var hardwareService=require(_0x48fa('0x14'));var logger=require(_0x48fa('0x15'))('api');var utils=require(_0x48fa('0x16'));var config=require(_0x48fa('0x17'));var licenseUtil=require(_0x48fa('0x18'));var db=require(_0x48fa('0x19'))['db'];function respondWithStatusCode(_0x3de2e6,_0x2c5515){_0x2c5515=_0x2c5515||0xcc;return function(_0x1b4c85){if(_0x1b4c85){return _0x3de2e6[_0x48fa('0x1a')](_0x2c5515);}return _0x3de2e6[_0x48fa('0x1b')](_0x2c5515)[_0x48fa('0x1c')]();};}function respondWithResult(_0x447371,_0x13c8b7){_0x13c8b7=_0x13c8b7||0xc8;return function(_0x28becd){if(_0x28becd){return _0x447371[_0x48fa('0x1b')](_0x13c8b7)[_0x48fa('0x1d')](_0x28becd);}};}function respondWithFilteredResult(_0x3cea1b,_0xaddd8){return function(_0x25450b){if(_0x25450b){var _0xfb932b=typeof _0xaddd8['offset']===_0x48fa('0x1e')&&typeof _0xaddd8[_0x48fa('0x1f')]===_0x48fa('0x1e');var _0x6f4cf2=_0x25450b['count'];var _0x1e91f2=_0xfb932b?0x0:_0xaddd8['offset'];var _0x2df64e=_0xfb932b?_0x25450b[_0x48fa('0x20')]:_0xaddd8[_0x48fa('0x21')]+_0xaddd8[_0x48fa('0x1f')];var _0x446999;if(_0x2df64e>=_0x6f4cf2){_0x2df64e=_0x6f4cf2;_0x446999=0xc8;}else{_0x446999=0xce;}_0x3cea1b[_0x48fa('0x1b')](_0x446999);return _0x3cea1b[_0x48fa('0x22')](_0x48fa('0x23'),_0x1e91f2+'-'+_0x2df64e+'/'+_0x6f4cf2)[_0x48fa('0x1d')](_0x25450b);}return null;};}function patchUpdates(_0x1c1a65){return function(_0x5c02c8){try{jsonpatch[_0x48fa('0x24')](_0x5c02c8,_0x1c1a65,!![]);}catch(_0x3ba36c){return BPromise[_0x48fa('0x25')](_0x3ba36c);}return _0x5c02c8[_0x48fa('0x26')]();};}function saveUpdates(_0x37adbf,_0x4451f6){return function(_0x345f83){if(_0x345f83){return _0x345f83[_0x48fa('0x27')](_0x37adbf)['then'](function(_0x4abc7a){return _0x4abc7a;});}return null;};}function removeEntity(_0x29683a,_0x4253c2){return function(_0x12913f){if(_0x12913f){return _0x12913f[_0x48fa('0x28')]()[_0x48fa('0x29')](function(){_0x29683a[_0x48fa('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3c4a13,_0x4adec7){return function(_0x4e0763){if(!_0x4e0763){_0x3c4a13[_0x48fa('0x1a')](0x194);}return _0x4e0763;};}function handleError(_0x46ba52,_0x4d376d){_0x4d376d=_0x4d376d||0x1f4;return function(_0x3e57fa){logger[_0x48fa('0x2a')](_0x3e57fa[_0x48fa('0x2b')]);if(_0x3e57fa[_0x48fa('0x2c')]){delete _0x3e57fa[_0x48fa('0x2c')];}_0x46ba52[_0x48fa('0x1b')](_0x4d376d)['send'](_0x3e57fa);};}exports[_0x48fa('0x2d')]=function(_0x3f2a09,_0x2f170e){var _0x2328cb={},_0x1b98c9={},_0x55ea86={'count':0x0,'rows':[]};var _0x5a2f5f=_['map'](db[_0x48fa('0x2e')][_0x48fa('0x2f')],function(_0x199af0){return{'name':_0x199af0['fieldName'],'type':_0x199af0[_0x48fa('0x30')][_0x48fa('0x31')]};});_0x1b98c9['model']=_[_0x48fa('0x32')](_0x5a2f5f,_0x48fa('0x2c'));_0x1b98c9[_0x48fa('0x33')]=_[_0x48fa('0x34')](_0x3f2a09['query']);_0x1b98c9['filters']=_[_0x48fa('0x35')](_0x1b98c9[_0x48fa('0x36')],_0x1b98c9['query']);_0x2328cb[_0x48fa('0x37')]=_[_0x48fa('0x35')](_0x1b98c9['model'],qs[_0x48fa('0x38')](_0x3f2a09[_0x48fa('0x33')][_0x48fa('0x38')]));_0x2328cb[_0x48fa('0x37')]=_0x2328cb[_0x48fa('0x37')]['length']?_0x2328cb[_0x48fa('0x37')]:_0x1b98c9[_0x48fa('0x36')];if(!_0x3f2a09[_0x48fa('0x33')]['hasOwnProperty'](_0x48fa('0x39'))){_0x2328cb[_0x48fa('0x1f')]=qs['limit'](_0x3f2a09[_0x48fa('0x33')][_0x48fa('0x1f')]);_0x2328cb[_0x48fa('0x21')]=qs['offset'](_0x3f2a09[_0x48fa('0x33')][_0x48fa('0x21')]);}_0x2328cb[_0x48fa('0x3a')]=qs[_0x48fa('0x3b')](_0x3f2a09['query'][_0x48fa('0x3b')]);_0x2328cb[_0x48fa('0x3c')]=qs[_0x48fa('0x3d')](_['pick'](_0x3f2a09['query'],_0x1b98c9[_0x48fa('0x3d')]),_0x5a2f5f);if(_0x3f2a09[_0x48fa('0x33')][_0x48fa('0x3e')]){_0x2328cb[_0x48fa('0x3c')]=_[_0x48fa('0x3f')](_0x2328cb[_0x48fa('0x3c')],{'$or':_[_0x48fa('0x32')](_0x5a2f5f,function(_0x4a8780){if(_0x4a8780[_0x48fa('0x30')]!=='VIRTUAL'){var _0x3357f9={};_0x3357f9[_0x4a8780['name']]={'$like':'%'+_0x3f2a09[_0x48fa('0x33')][_0x48fa('0x3e')]+'%'};return _0x3357f9;}})});}_0x2328cb=_['merge']({},_0x2328cb,_0x3f2a09[_0x48fa('0x40')]);var _0x81d706={'where':_0x2328cb['where']};return db['SquareDetailsReport']['count'](_0x81d706)[_0x48fa('0x29')](function(_0x1cee69){_0x55ea86[_0x48fa('0x20')]=_0x1cee69;if(_0x3f2a09[_0x48fa('0x33')]['includeAll']){_0x2328cb['include']=[{'all':!![]}];}return db[_0x48fa('0x2e')][_0x48fa('0x41')](_0x2328cb);})['then'](function(_0xcffb9f){_0x55ea86[_0x48fa('0x42')]=_0xcffb9f;return _0x55ea86;})['then'](respondWithFilteredResult(_0x2f170e,_0x2328cb))[_0x48fa('0x43')](handleError(_0x2f170e,null));};exports[_0x48fa('0x44')]=function(_0x16dd23,_0x446861){var _0x5bc360={'raw':!![],'where':{'id':_0x16dd23[_0x48fa('0x45')]['id']}},_0x12e29a={};_0x12e29a[_0x48fa('0x36')]=_['keys'](db[_0x48fa('0x2e')][_0x48fa('0x2f')]);_0x12e29a[_0x48fa('0x33')]=_[_0x48fa('0x34')](_0x16dd23[_0x48fa('0x33')]);_0x12e29a['filters']=_['intersection'](_0x12e29a[_0x48fa('0x36')],_0x12e29a[_0x48fa('0x33')]);_0x5bc360[_0x48fa('0x37')]=_[_0x48fa('0x35')](_0x12e29a[_0x48fa('0x36')],qs[_0x48fa('0x38')](_0x16dd23[_0x48fa('0x33')][_0x48fa('0x38')]));_0x5bc360[_0x48fa('0x37')]=_0x5bc360[_0x48fa('0x37')][_0x48fa('0x46')]?_0x5bc360[_0x48fa('0x37')]:_0x12e29a[_0x48fa('0x36')];if(_0x16dd23[_0x48fa('0x33')]['includeAll']){_0x5bc360['include']=[{'all':!![]}];}_0x5bc360=_[_0x48fa('0x3f')]({},_0x5bc360,_0x16dd23[_0x48fa('0x40')]);return db[_0x48fa('0x2e')][_0x48fa('0x47')](_0x5bc360)[_0x48fa('0x29')](handleEntityNotFound(_0x446861,null))[_0x48fa('0x29')](respondWithResult(_0x446861,null))[_0x48fa('0x43')](handleError(_0x446861,null));};exports[_0x48fa('0x48')]=function(_0x1ffbcc,_0x247300){return db[_0x48fa('0x2e')]['create'](_0x1ffbcc[_0x48fa('0x49')],{})[_0x48fa('0x29')](respondWithResult(_0x247300,0xc9))['catch'](handleError(_0x247300,null));};exports[_0x48fa('0x27')]=function(_0x4e2e70,_0x44aea4){if(_0x4e2e70[_0x48fa('0x49')]['id']){delete _0x4e2e70['body']['id'];}return db[_0x48fa('0x2e')][_0x48fa('0x47')]({'where':{'id':_0x4e2e70[_0x48fa('0x45')]['id']}})['then'](handleEntityNotFound(_0x44aea4,null))[_0x48fa('0x29')](saveUpdates(_0x4e2e70[_0x48fa('0x49')],null))['then'](respondWithResult(_0x44aea4,null))['catch'](handleError(_0x44aea4,null));};exports['destroy']=function(_0x13ccb3,_0xe350a8){return db[_0x48fa('0x2e')][_0x48fa('0x47')]({'where':{'id':_0x13ccb3[_0x48fa('0x45')]['id']}})[_0x48fa('0x29')](handleEntityNotFound(_0xe350a8,null))[_0x48fa('0x29')](removeEntity(_0xe350a8,null))['catch'](handleError(_0xe350a8,null));};exports['describe']=function(_0x2739d6,_0x260f5f){return db[_0x48fa('0x2e')]['describe']()[_0x48fa('0x29')](respondWithResult(_0x260f5f,null))[_0x48fa('0x43')](handleError(_0x260f5f,null));}; \ No newline at end of file +var _0xaa3c=['end','status','offset','undefined','limit','count','set','Content-Range','json','reject','save','update','then','error','stack','name','send','map','SquareDetailsReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','rows','show','keys','find','catch','create','body','destroy','params','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus'];(function(_0x471ac7,_0x5c96da){var _0xe5b9b3=function(_0x459834){while(--_0x459834){_0x471ac7['push'](_0x471ac7['shift']());}};_0xe5b9b3(++_0x5c96da);}(_0xaa3c,0x120));var _0xcaa3=function(_0x42889a,_0x153e84){_0x42889a=_0x42889a-0x0;var _0x4022d0=_0xaa3c[_0x42889a];return _0x4022d0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xcaa3('0x0'));var zipdir=require(_0xcaa3('0x1'));var jsonpatch=require(_0xcaa3('0x2'));var rp=require(_0xcaa3('0x3'));var moment=require(_0xcaa3('0x4'));var BPromise=require(_0xcaa3('0x5'));var Mustache=require(_0xcaa3('0x6'));var util=require('util');var path=require(_0xcaa3('0x7'));var sox=require(_0xcaa3('0x8'));var csv=require(_0xcaa3('0x9'));var ejs=require(_0xcaa3('0xa'));var fs=require('fs');var fs_extra=require(_0xcaa3('0xb'));var _=require(_0xcaa3('0xc'));var squel=require(_0xcaa3('0xd'));var crypto=require(_0xcaa3('0xe'));var jsforce=require(_0xcaa3('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xcaa3('0x9'));var querystring=require(_0xcaa3('0x10'));var Papa=require('papaparse');var Redis=require(_0xcaa3('0x11'));var authService=require(_0xcaa3('0x12'));var qs=require(_0xcaa3('0x13'));var as=require(_0xcaa3('0x14'));var hardwareService=require(_0xcaa3('0x15'));var logger=require(_0xcaa3('0x16'))(_0xcaa3('0x17'));var utils=require(_0xcaa3('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xcaa3('0x19'));var db=require(_0xcaa3('0x1a'))['db'];function respondWithStatusCode(_0xed27d2,_0x126a5d){_0x126a5d=_0x126a5d||0xcc;return function(_0x82cfcb){if(_0x82cfcb){return _0xed27d2[_0xcaa3('0x1b')](_0x126a5d);}return _0xed27d2['status'](_0x126a5d)[_0xcaa3('0x1c')]();};}function respondWithResult(_0x58736e,_0x5dd078){_0x5dd078=_0x5dd078||0xc8;return function(_0x24838e){if(_0x24838e){return _0x58736e[_0xcaa3('0x1d')](_0x5dd078)['json'](_0x24838e);}};}function respondWithFilteredResult(_0x35bb68,_0xd4a2a2){return function(_0xd79a93){if(_0xd79a93){var _0x2e452d=typeof _0xd4a2a2[_0xcaa3('0x1e')]===_0xcaa3('0x1f')&&typeof _0xd4a2a2[_0xcaa3('0x20')]===_0xcaa3('0x1f');var _0x58556a=_0xd79a93[_0xcaa3('0x21')];var _0x4d0769=_0x2e452d?0x0:_0xd4a2a2['offset'];var _0x55ad3d=_0x2e452d?_0xd79a93[_0xcaa3('0x21')]:_0xd4a2a2[_0xcaa3('0x1e')]+_0xd4a2a2['limit'];var _0x4de7e9;if(_0x55ad3d>=_0x58556a){_0x55ad3d=_0x58556a;_0x4de7e9=0xc8;}else{_0x4de7e9=0xce;}_0x35bb68[_0xcaa3('0x1d')](_0x4de7e9);return _0x35bb68[_0xcaa3('0x22')](_0xcaa3('0x23'),_0x4d0769+'-'+_0x55ad3d+'/'+_0x58556a)[_0xcaa3('0x24')](_0xd79a93);}return null;};}function patchUpdates(_0x3e2d66){return function(_0x21220f){try{jsonpatch['apply'](_0x21220f,_0x3e2d66,!![]);}catch(_0x1f11b9){return BPromise[_0xcaa3('0x25')](_0x1f11b9);}return _0x21220f[_0xcaa3('0x26')]();};}function saveUpdates(_0x36b931,_0x2512fc){return function(_0x1bbbf7){if(_0x1bbbf7){return _0x1bbbf7[_0xcaa3('0x27')](_0x36b931)[_0xcaa3('0x28')](function(_0x53a506){return _0x53a506;});}return null;};}function removeEntity(_0x1157a9,_0x22a8d0){return function(_0x32f4da){if(_0x32f4da){return _0x32f4da['destroy']()[_0xcaa3('0x28')](function(){_0x1157a9['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x7fcf64,_0x314084){return function(_0x459f47){if(!_0x459f47){_0x7fcf64[_0xcaa3('0x1b')](0x194);}return _0x459f47;};}function handleError(_0x48d5a1,_0x44983e){_0x44983e=_0x44983e||0x1f4;return function(_0x5c5a16){logger[_0xcaa3('0x29')](_0x5c5a16[_0xcaa3('0x2a')]);if(_0x5c5a16[_0xcaa3('0x2b')]){delete _0x5c5a16[_0xcaa3('0x2b')];}_0x48d5a1[_0xcaa3('0x1d')](_0x44983e)[_0xcaa3('0x2c')](_0x5c5a16);};}exports['index']=function(_0x5f201f,_0x307cef){var _0x46b4de={},_0x3b0f73={},_0x4c7c0c={'count':0x0,'rows':[]};var _0x15a5ff=_[_0xcaa3('0x2d')](db[_0xcaa3('0x2e')][_0xcaa3('0x2f')],function(_0x594694){return{'name':_0x594694[_0xcaa3('0x30')],'type':_0x594694[_0xcaa3('0x31')][_0xcaa3('0x32')]};});_0x3b0f73[_0xcaa3('0x33')]=_[_0xcaa3('0x2d')](_0x15a5ff,_0xcaa3('0x2b'));_0x3b0f73[_0xcaa3('0x34')]=_['keys'](_0x5f201f[_0xcaa3('0x34')]);_0x3b0f73[_0xcaa3('0x35')]=_[_0xcaa3('0x36')](_0x3b0f73['model'],_0x3b0f73['query']);_0x46b4de['attributes']=_[_0xcaa3('0x36')](_0x3b0f73[_0xcaa3('0x33')],qs[_0xcaa3('0x37')](_0x5f201f[_0xcaa3('0x34')][_0xcaa3('0x37')]));_0x46b4de[_0xcaa3('0x38')]=_0x46b4de[_0xcaa3('0x38')][_0xcaa3('0x39')]?_0x46b4de[_0xcaa3('0x38')]:_0x3b0f73['model'];if(!_0x5f201f['query'][_0xcaa3('0x3a')]('nolimit')){_0x46b4de[_0xcaa3('0x20')]=qs[_0xcaa3('0x20')](_0x5f201f[_0xcaa3('0x34')]['limit']);_0x46b4de[_0xcaa3('0x1e')]=qs[_0xcaa3('0x1e')](_0x5f201f[_0xcaa3('0x34')][_0xcaa3('0x1e')]);}_0x46b4de[_0xcaa3('0x3b')]=qs[_0xcaa3('0x3c')](_0x5f201f['query'][_0xcaa3('0x3c')]);_0x46b4de['where']=qs['filters'](_[_0xcaa3('0x3d')](_0x5f201f[_0xcaa3('0x34')],_0x3b0f73[_0xcaa3('0x35')]),_0x15a5ff);if(_0x5f201f[_0xcaa3('0x34')][_0xcaa3('0x3e')]){_0x46b4de[_0xcaa3('0x3f')]=_[_0xcaa3('0x40')](_0x46b4de[_0xcaa3('0x3f')],{'$or':_[_0xcaa3('0x2d')](_0x15a5ff,function(_0x41a55c){if(_0x41a55c[_0xcaa3('0x31')]!==_0xcaa3('0x41')){var _0x1bbd57={};_0x1bbd57[_0x41a55c[_0xcaa3('0x2b')]]={'$like':'%'+_0x5f201f[_0xcaa3('0x34')][_0xcaa3('0x3e')]+'%'};return _0x1bbd57;}})});}_0x46b4de=_[_0xcaa3('0x40')]({},_0x46b4de,_0x5f201f[_0xcaa3('0x42')]);var _0x1f6fff={'where':_0x46b4de[_0xcaa3('0x3f')]};return db[_0xcaa3('0x2e')][_0xcaa3('0x21')](_0x1f6fff)[_0xcaa3('0x28')](function(_0x13d23b){_0x4c7c0c[_0xcaa3('0x21')]=_0x13d23b;if(_0x5f201f['query'][_0xcaa3('0x43')]){_0x46b4de[_0xcaa3('0x44')]=[{'all':!![]}];}return db[_0xcaa3('0x2e')]['findAll'](_0x46b4de);})[_0xcaa3('0x28')](function(_0x7a2b47){_0x4c7c0c[_0xcaa3('0x45')]=_0x7a2b47;return _0x4c7c0c;})['then'](respondWithFilteredResult(_0x307cef,_0x46b4de))['catch'](handleError(_0x307cef,null));};exports[_0xcaa3('0x46')]=function(_0x5d9899,_0x44081b){var _0xe49338={'raw':!![],'where':{'id':_0x5d9899['params']['id']}},_0x35f96a={};_0x35f96a[_0xcaa3('0x33')]=_[_0xcaa3('0x47')](db[_0xcaa3('0x2e')][_0xcaa3('0x2f')]);_0x35f96a[_0xcaa3('0x34')]=_[_0xcaa3('0x47')](_0x5d9899[_0xcaa3('0x34')]);_0x35f96a[_0xcaa3('0x35')]=_[_0xcaa3('0x36')](_0x35f96a[_0xcaa3('0x33')],_0x35f96a[_0xcaa3('0x34')]);_0xe49338['attributes']=_[_0xcaa3('0x36')](_0x35f96a['model'],qs[_0xcaa3('0x37')](_0x5d9899[_0xcaa3('0x34')][_0xcaa3('0x37')]));_0xe49338['attributes']=_0xe49338[_0xcaa3('0x38')]['length']?_0xe49338[_0xcaa3('0x38')]:_0x35f96a['model'];if(_0x5d9899['query']['includeAll']){_0xe49338[_0xcaa3('0x44')]=[{'all':!![]}];}_0xe49338=_[_0xcaa3('0x40')]({},_0xe49338,_0x5d9899[_0xcaa3('0x42')]);return db[_0xcaa3('0x2e')][_0xcaa3('0x48')](_0xe49338)[_0xcaa3('0x28')](handleEntityNotFound(_0x44081b,null))['then'](respondWithResult(_0x44081b,null))[_0xcaa3('0x49')](handleError(_0x44081b,null));};exports[_0xcaa3('0x4a')]=function(_0x58b562,_0x137929){return db[_0xcaa3('0x2e')]['create'](_0x58b562[_0xcaa3('0x4b')],{})[_0xcaa3('0x28')](respondWithResult(_0x137929,0xc9))[_0xcaa3('0x49')](handleError(_0x137929,null));};exports[_0xcaa3('0x27')]=function(_0x44fa0c,_0x295cba){if(_0x44fa0c[_0xcaa3('0x4b')]['id']){delete _0x44fa0c['body']['id'];}return db[_0xcaa3('0x2e')]['find']({'where':{'id':_0x44fa0c['params']['id']}})[_0xcaa3('0x28')](handleEntityNotFound(_0x295cba,null))['then'](saveUpdates(_0x44fa0c[_0xcaa3('0x4b')],null))[_0xcaa3('0x28')](respondWithResult(_0x295cba,null))[_0xcaa3('0x49')](handleError(_0x295cba,null));};exports[_0xcaa3('0x4c')]=function(_0x46fa8c,_0x52a651){return db[_0xcaa3('0x2e')]['find']({'where':{'id':_0x46fa8c[_0xcaa3('0x4d')]['id']}})[_0xcaa3('0x28')](handleEntityNotFound(_0x52a651,null))['then'](removeEntity(_0x52a651,null))[_0xcaa3('0x49')](handleError(_0x52a651,null));};exports[_0xcaa3('0x4e')]=function(_0x32cd12,_0x4c2da5){return db[_0xcaa3('0x2e')][_0xcaa3('0x4e')]()[_0xcaa3('0x28')](respondWithResult(_0x4c2da5,null))[_0xcaa3('0x49')](handleError(_0x4c2da5,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index 99cd01e..e68979e 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 _0x83c5=['../../config/logger','api','bluebird','request-promise','rimraf','./squareReportDetail.attributes','exports','define','SquareDetailsReport','report_square_details','lodash','util'];(function(_0x218978,_0x3437e8){var _0x3e1a94=function(_0x2151f9){while(--_0x2151f9){_0x218978['push'](_0x218978['shift']());}};_0x3e1a94(++_0x3437e8);}(_0x83c5,0x11e));var _0x583c=function(_0x59c135,_0x2324ac){_0x59c135=_0x59c135-0x0;var _0x1603eb=_0x83c5[_0x59c135];return _0x1603eb;};'use strict';var _=require(_0x583c('0x0'));var util=require(_0x583c('0x1'));var logger=require(_0x583c('0x2'))(_0x583c('0x3'));var moment=require('moment');var BPromise=require(_0x583c('0x4'));var rp=require(_0x583c('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x583c('0x6'));var config=require('../../config/environment');var attributes=require(_0x583c('0x7'));module[_0x583c('0x8')]=function(_0x12b73f,_0x2b2328){return _0x12b73f[_0x583c('0x9')](_0x583c('0xa'),attributes,{'tableName':_0x583c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7423=['SquareDetailsReport','report_square_details','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','exports','define'];(function(_0x2cba09,_0x23ee85){var _0x10d084=function(_0x11d2e4){while(--_0x11d2e4){_0x2cba09['push'](_0x2cba09['shift']());}};_0x10d084(++_0x23ee85);}(_0x7423,0x122));var _0x3742=function(_0x3fa02f,_0x332597){_0x3fa02f=_0x3fa02f-0x0;var _0x1b2d41=_0x7423[_0x3fa02f];return _0x1b2d41;};'use strict';var _=require(_0x3742('0x0'));var util=require('util');var logger=require(_0x3742('0x1'))(_0x3742('0x2'));var moment=require(_0x3742('0x3'));var BPromise=require(_0x3742('0x4'));var rp=require(_0x3742('0x5'));var fs=require('fs');var path=require(_0x3742('0x6'));var rimraf=require(_0x3742('0x7'));var config=require('../../config/environment');var attributes=require('./squareReportDetail.attributes');module[_0x3742('0x8')]=function(_0xebeb23,_0xfeb6a4){return _0xebeb23[_0x3742('0x9')](_0x3742('0xa'),attributes,{'tableName':_0x3742('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.rpc.js b/server/api/squareReportDetail/squareReportDetail.rpc.js index c812141..09acd7c 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 _0x6cb4=['raw','then','CreateSquareDetailsReport','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','info','request\x20sent','debug','stringify','error','SquareDetailsReport,\x20%s,\x20%s','message','result','catch','SquareDetailsReport','create','body','options'];(function(_0x874cf1,_0x2a4954){var _0x233579=function(_0xa6e939){while(--_0xa6e939){_0x874cf1['push'](_0x874cf1['shift']());}};_0x233579(++_0x2a4954);}(_0x6cb4,0xff));var _0x46cb=function(_0x26e310,_0x1460d0){_0x26e310=_0x26e310-0x0;var _0x1a520f=_0x6cb4[_0x26e310];return _0x1a520f;};'use strict';var _=require(_0x46cb('0x0'));var util=require(_0x46cb('0x1'));var moment=require(_0x46cb('0x2'));var BPromise=require(_0x46cb('0x3'));var rs=require(_0x46cb('0x4'));var fs=require('fs');var Redis=require(_0x46cb('0x5'));var db=require(_0x46cb('0x6'))['db'];var utils=require(_0x46cb('0x7'));var logger=require(_0x46cb('0x8'))('rpc');var config=require(_0x46cb('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x46cb('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x11262d,_0x148d0f,_0x31b35b){return new BPromise(function(_0x2d6c29,_0x24b4f5){return client[_0x46cb('0xb')](_0x11262d,_0x31b35b)['then'](function(_0x3d7663){logger[_0x46cb('0xc')]('SquareDetailsReport,\x20%s,\x20%s',_0x148d0f,_0x46cb('0xd'));logger[_0x46cb('0xe')]('SquareDetailsReport,\x20%s,\x20%s,\x20%s',_0x148d0f,_0x46cb('0xd'),JSON[_0x46cb('0xf')](_0x3d7663));if(_0x3d7663['error']){if(_0x3d7663['error']['code']===0x1f4){logger[_0x46cb('0x10')](_0x46cb('0x11'),_0x148d0f,_0x3d7663[_0x46cb('0x10')][_0x46cb('0x12')]);return _0x24b4f5(_0x3d7663['error'][_0x46cb('0x12')]);}logger[_0x46cb('0x10')](_0x46cb('0x11'),_0x148d0f,_0x3d7663[_0x46cb('0x10')][_0x46cb('0x12')]);return _0x2d6c29(_0x3d7663[_0x46cb('0x10')][_0x46cb('0x12')]);}else{logger[_0x46cb('0xc')](_0x46cb('0x11'),_0x148d0f,_0x46cb('0xd'));_0x2d6c29(_0x3d7663[_0x46cb('0x13')]['message']);}})[_0x46cb('0x14')](function(_0x5796d2){logger[_0x46cb('0x10')]('SquareDetailsReport,\x20%s,\x20%s',_0x148d0f,_0x5796d2);_0x24b4f5(_0x5796d2);});});}exports['CreateSquareDetailsReport']=function(_0x4e3454){var _0x1b6646=this;return new Promise(function(_0x1f2891,_0x4df1f0){return db[_0x46cb('0x15')][_0x46cb('0x16')](_0x4e3454[_0x46cb('0x17')],{'raw':_0x4e3454[_0x46cb('0x18')]?_0x4e3454[_0x46cb('0x18')][_0x46cb('0x19')]===undefined?!![]:![]:!![]})[_0x46cb('0x1a')](function(_0x149483){logger[_0x46cb('0xc')](_0x46cb('0x1b'),_0x4e3454);logger[_0x46cb('0xe')](_0x46cb('0x1b'),_0x4e3454,JSON[_0x46cb('0xf')](_0x149483));_0x1f2891(_0x149483);})[_0x46cb('0x14')](function(_0x1fb467){logger[_0x46cb('0x10')](_0x46cb('0x1b'),_0x1fb467[_0x46cb('0x12')],_0x4e3454);_0x4df1f0(_0x1b6646[_0x46cb('0x10')](0x1f4,_0x1fb467[_0x46cb('0x12')]));});});}; \ No newline at end of file +var _0x6a95=['message','result','catch','CreateSquareDetailsReport','SquareDetailsReport','create','body','options','raw','then','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','info','SquareDetailsReport,\x20%s,\x20%s','request\x20sent','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x57173f,_0x34c5d5){var _0x56b2a6=function(_0x369388){while(--_0x369388){_0x57173f['push'](_0x57173f['shift']());}};_0x56b2a6(++_0x34c5d5);}(_0x6a95,0x1db));var _0x56a9=function(_0x102e37,_0x14a181){_0x102e37=_0x102e37-0x0;var _0x35a07c=_0x6a95[_0x102e37];return _0x35a07c;};'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});function respondWithRpcPromise(_0x365093,_0xd8aa7c,_0x5d3e80){return new BPromise(function(_0x5f0dcb,_0x3ac626){return client[_0x56a9('0xc')](_0x365093,_0x5d3e80)['then'](function(_0xe4b98c){logger[_0x56a9('0xd')](_0x56a9('0xe'),_0xd8aa7c,_0x56a9('0xf'));logger[_0x56a9('0x10')](_0x56a9('0x11'),_0xd8aa7c,_0x56a9('0xf'),JSON[_0x56a9('0x12')](_0xe4b98c));if(_0xe4b98c[_0x56a9('0x13')]){if(_0xe4b98c['error'][_0x56a9('0x14')]===0x1f4){logger['error'](_0x56a9('0xe'),_0xd8aa7c,_0xe4b98c[_0x56a9('0x13')][_0x56a9('0x15')]);return _0x3ac626(_0xe4b98c[_0x56a9('0x13')][_0x56a9('0x15')]);}logger[_0x56a9('0x13')](_0x56a9('0xe'),_0xd8aa7c,_0xe4b98c[_0x56a9('0x13')][_0x56a9('0x15')]);return _0x5f0dcb(_0xe4b98c['error']['message']);}else{logger[_0x56a9('0xd')](_0x56a9('0xe'),_0xd8aa7c,_0x56a9('0xf'));_0x5f0dcb(_0xe4b98c[_0x56a9('0x16')]['message']);}})[_0x56a9('0x17')](function(_0x4853a3){logger['error']('SquareDetailsReport,\x20%s,\x20%s',_0xd8aa7c,_0x4853a3);_0x3ac626(_0x4853a3);});});}exports[_0x56a9('0x18')]=function(_0x576bdf){var _0x59c0ec=this;return new Promise(function(_0x105fe5,_0x459a87){return db[_0x56a9('0x19')][_0x56a9('0x1a')](_0x576bdf[_0x56a9('0x1b')],{'raw':_0x576bdf[_0x56a9('0x1c')]?_0x576bdf[_0x56a9('0x1c')][_0x56a9('0x1d')]===undefined?!![]:![]:!![]})[_0x56a9('0x1e')](function(_0x5f145f){logger['info'](_0x56a9('0x18'),_0x576bdf);logger[_0x56a9('0x10')](_0x56a9('0x18'),_0x576bdf,JSON[_0x56a9('0x12')](_0x5f145f));_0x105fe5(_0x5f145f);})['catch'](function(_0x6100fe){logger[_0x56a9('0x13')](_0x56a9('0x18'),_0x6100fe[_0x56a9('0x15')],_0x576bdf);_0x459a87(_0x59c0ec['error'](0x1f4,_0x6100fe[_0x56a9('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index 85fb291..38a8ede 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 _0xeadf=['get','isAuthenticated','index','killProcess','exports','express','../../components/auth/service'];(function(_0x2f2a02,_0x33101a){var _0x427b7b=function(_0x49a5be){while(--_0x49a5be){_0x2f2a02['push'](_0x2f2a02['shift']());}};_0x427b7b(++_0x33101a);}(_0xeadf,0xa6));var _0xfead=function(_0x1b8bda,_0x43ad31){_0x1b8bda=_0x1b8bda-0x0;var _0x1f7050=_0xeadf[_0x1b8bda];return _0x1f7050;};'use strict';var express=require(_0xfead('0x0'));var router=express['Router']();var auth=require(_0xfead('0x1'));var controller=require('./system.controller');router[_0xfead('0x2')]('/',auth[_0xfead('0x3')](),controller[_0xfead('0x4')]);router['get']('/process/:pid/kill',auth[_0xfead('0x3')](),controller[_0xfead('0x5')]);module[_0xfead('0x6')]=router; \ No newline at end of file +var _0xb150=['Router','get','isAuthenticated','index','/process/:pid/kill','killProcess','exports','express'];(function(_0x34a223,_0x5b0fe9){var _0x4a9a0e=function(_0x2f109a){while(--_0x2f109a){_0x34a223['push'](_0x34a223['shift']());}};_0x4a9a0e(++_0x5b0fe9);}(_0xb150,0xa7));var _0x0b15=function(_0x38d18b,_0x56df34){_0x38d18b=_0x38d18b-0x0;var _0xc432e1=_0xb150[_0x38d18b];return _0xc432e1;};'use strict';var express=require(_0x0b15('0x0'));var router=express[_0x0b15('0x1')]();var auth=require('../../components/auth/service');var controller=require('./system.controller');router[_0x0b15('0x2')]('/',auth[_0x0b15('0x3')](),controller[_0x0b15('0x4')]);router[_0x0b15('0x2')](_0x0b15('0x5'),auth[_0x0b15('0x3')](),controller[_0x0b15('0x6')]);module[_0x0b15('0x7')]=router; \ No newline at end of file diff --git a/server/api/system/system.controller.js b/server/api/system/system.controller.js index 3b9da8b..336cc57 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 _0x13d7=['indexOf','Process\x20with\x20pid\x20%s\x20not\x20found!','kill','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','systeminformation','child_process','api','util','bluebird','lodash','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','name','send','then','catch','status','json','killProcess','components/import/cm','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','pid','split','length'];(function(_0x4071b6,_0x92cb6e){var _0x576d62=function(_0x3095ec){while(--_0x3095ec){_0x4071b6['push'](_0x4071b6['shift']());}};_0x576d62(++_0x92cb6e);}(_0x13d7,0xa7));var _0x713d=function(_0x58f9e1,_0x1f45ba){_0x58f9e1=_0x58f9e1-0x0;var _0x235451=_0x13d7[_0x58f9e1];return _0x235451;};'use strict';var info=require(_0x713d('0x0'));var exec=require(_0x713d('0x1'))['exec'];var logger=require('../../config/logger')(_0x713d('0x2'));var util=require(_0x713d('0x3'));var BPromise=require(_0x713d('0x4'));var _=require(_0x713d('0x5'));function handleError(_0x596288,_0x2c4be9,_0x1c7af3){_0x2c4be9=_0x2c4be9||0x1f4;return function(_0x53c085){logger[_0x713d('0x6')](_0x713d('0x7'),_0x1c7af3,_0x2c4be9,util[_0x713d('0x8')](_0x53c085,{'showHidden':![],'depth':null}));delete _0x53c085[_0x713d('0x9')];_0x596288['status'](_0x2c4be9)[_0x713d('0xa')](_0x53c085);};}exports['index']=function(_0xaa7f69,_0x1da8a9){return info['getAllData']()[_0x713d('0xb')](function(_0x205458){return _0x1da8a9['status'](0xc8)['json'](_0x205458);})[_0x713d('0xc')](function(_0x2ea9e0){return _0x1da8a9[_0x713d('0xd')](0x1f4)[_0x713d('0xe')](_0x2ea9e0);});};exports[_0x713d('0xf')]=function(_0x2001f7,_0x423595){var _0x8d5275=[_0x713d('0x10')];return new BPromise(function(_0x219d10,_0x4dc8fa){return exec(util['format'](_0x713d('0x11'),_0x2001f7[_0x713d('0x12')][_0x713d('0x13')]),function(_0xf4e9e8,_0x292a6a,_0x3c8b84){if(_0xf4e9e8){return _0x4dc8fa(_0xf4e9e8);}return _0x219d10(_0x292a6a);});})[_0x713d('0xb')](function(_0x248c17){var _0x47e67c=![];var _0x4e5f6e=_0x248c17[_0x713d('0x14')](/\n/);for(var _0x302147=0x0,_0x4e6628=_0x8d5275[_0x713d('0x15')];_0x302147<_0x4e6628,_0x47e67c===![];_0x302147+=0x1){if(_0x248c17[_0x713d('0x16')](_0x8d5275[_0x302147])>=0x0){_0x47e67c=!![];}}if(!_0x47e67c){throw new Error(util['format'](_0x713d('0x17'),_0x2001f7[_0x713d('0x12')][_0x713d('0x13')]));}process[_0x713d('0x18')](_0x2001f7[_0x713d('0x12')][_0x713d('0x13')],_0x713d('0x19'));return _0x423595['status'](0xc8)[_0x713d('0xe')]({'message':util['format'](_0x713d('0x1a'),_0x2001f7[_0x713d('0x12')][_0x713d('0x13')])});})['catch'](handleError(_0x423595,null,_0x713d('0xf')));}; \ No newline at end of file +var _0x552d=['inspect','name','status','getAllData','then','json','catch','killProcess','components/import/cm','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','pid','split','Process\x20with\x20pid\x20%s\x20not\x20found!','kill','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','systeminformation','child_process','exec','../../config/logger','api','util','lodash','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s'];(function(_0x29f0da,_0x216858){var _0x152cd8=function(_0x548240){while(--_0x548240){_0x29f0da['push'](_0x29f0da['shift']());}};_0x152cd8(++_0x216858);}(_0x552d,0x105));var _0xd552=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x552d[_0x4b369d];return _0x571a98;};'use strict';var info=require(_0xd552('0x0'));var exec=require(_0xd552('0x1'))[_0xd552('0x2')];var logger=require(_0xd552('0x3'))(_0xd552('0x4'));var util=require(_0xd552('0x5'));var BPromise=require('bluebird');var _=require(_0xd552('0x6'));function handleError(_0x5c2bb9,_0x3192d0,_0x447003){_0x3192d0=_0x3192d0||0x1f4;return function(_0x5aea67){logger[_0xd552('0x7')](_0xd552('0x8'),_0x447003,_0x3192d0,util[_0xd552('0x9')](_0x5aea67,{'showHidden':![],'depth':null}));delete _0x5aea67[_0xd552('0xa')];_0x5c2bb9[_0xd552('0xb')](_0x3192d0)['send'](_0x5aea67);};}exports['index']=function(_0x41388e,_0x4e7abf){return info[_0xd552('0xc')]()[_0xd552('0xd')](function(_0x13cd9f){return _0x4e7abf['status'](0xc8)[_0xd552('0xe')](_0x13cd9f);})[_0xd552('0xf')](function(_0x2527b1){return _0x4e7abf[_0xd552('0xb')](0x1f4)[_0xd552('0xe')](_0x2527b1);});};exports[_0xd552('0x10')]=function(_0xb9d5e2,_0x1b24ea){var _0x50ced6=[_0xd552('0x11')];return new BPromise(function(_0x53d300,_0x23a09d){return exec(util[_0xd552('0x12')](_0xd552('0x13'),_0xb9d5e2[_0xd552('0x14')][_0xd552('0x15')]),function(_0x5bb048,_0x2b86ad,_0x5cbfad){if(_0x5bb048){return _0x23a09d(_0x5bb048);}return _0x53d300(_0x2b86ad);});})['then'](function(_0x58964e){var _0x5354a2=![];var _0xa4f83a=_0x58964e[_0xd552('0x16')](/\n/);for(var _0x44228c=0x0,_0xfea99d=_0x50ced6['length'];_0x44228c<_0xfea99d,_0x5354a2===![];_0x44228c+=0x1){if(_0x58964e['indexOf'](_0x50ced6[_0x44228c])>=0x0){_0x5354a2=!![];}}if(!_0x5354a2){throw new Error(util[_0xd552('0x12')](_0xd552('0x17'),_0xb9d5e2[_0xd552('0x14')][_0xd552('0x15')]));}process[_0xd552('0x18')](_0xb9d5e2['params']['pid'],_0xd552('0x19'));return _0x1b24ea[_0xd552('0xb')](0xc8)[_0xd552('0xe')]({'message':util[_0xd552('0x12')](_0xd552('0x1a'),_0xb9d5e2['params'][_0xd552('0x15')])});})['catch'](handleError(_0x1b24ea,null,_0xd552('0x10')));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index db36d84..85e80fc 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 _0xf5ec=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./tag.controller','get','isAuthenticated','index','/:id','show','post','create','update','delete','multer','util','path','express'];(function(_0x5f0089,_0x227e2c){var _0x193892=function(_0x24051f){while(--_0x24051f){_0x5f0089['push'](_0x5f0089['shift']());}};_0x193892(++_0x227e2c);}(_0xf5ec,0x165));var _0xcf5e=function(_0x52f271,_0x335ffb){_0x52f271=_0x52f271-0x0;var _0x5adc27=_0xf5ec[_0x52f271];return _0x5adc27;};'use strict';var multer=require(_0xcf5e('0x0'));var util=require(_0xcf5e('0x1'));var path=require(_0xcf5e('0x2'));var timeout=require('connect-timeout');var express=require(_0xcf5e('0x3'));var router=express[_0xcf5e('0x4')]();var fs_extra=require(_0xcf5e('0x5'));var auth=require(_0xcf5e('0x6'));var interaction=require(_0xcf5e('0x7'));var config=require(_0xcf5e('0x8'));var controller=require(_0xcf5e('0x9'));router[_0xcf5e('0xa')]('/',auth[_0xcf5e('0xb')](),controller[_0xcf5e('0xc')]);router['get'](_0xcf5e('0xd'),auth['isAuthenticated'](),controller[_0xcf5e('0xe')]);router[_0xcf5e('0xf')]('/',auth['isAuthenticated'](),controller[_0xcf5e('0x10')]);router['put'](_0xcf5e('0xd'),auth[_0xcf5e('0xb')](),controller[_0xcf5e('0x11')]);router[_0xcf5e('0x12')]('/:id',auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xd597=['index','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./tag.controller','get','isAuthenticated'];(function(_0x5f0fec,_0x28ac8c){var _0x2c8388=function(_0x5c249d){while(--_0x5c249d){_0x5f0fec['push'](_0x5f0fec['shift']());}};_0x2c8388(++_0x28ac8c);}(_0xd597,0x94));var _0x7d59=function(_0xdff7e8,_0x4c11be){_0xdff7e8=_0xdff7e8-0x0;var _0x2fceef=_0xd597[_0xdff7e8];return _0x2fceef;};'use strict';var multer=require(_0x7d59('0x0'));var util=require(_0x7d59('0x1'));var path=require(_0x7d59('0x2'));var timeout=require(_0x7d59('0x3'));var express=require(_0x7d59('0x4'));var router=express[_0x7d59('0x5')]();var fs_extra=require(_0x7d59('0x6'));var auth=require(_0x7d59('0x7'));var interaction=require(_0x7d59('0x8'));var config=require(_0x7d59('0x9'));var controller=require(_0x7d59('0xa'));router[_0x7d59('0xb')]('/',auth[_0x7d59('0xc')](),controller[_0x7d59('0xd')]);router[_0x7d59('0xb')](_0x7d59('0xe'),auth[_0x7d59('0xc')](),controller[_0x7d59('0xf')]);router[_0x7d59('0x10')]('/',auth[_0x7d59('0xc')](),controller[_0x7d59('0x11')]);router[_0x7d59('0x12')]('/:id',auth[_0x7d59('0xc')](),controller[_0x7d59('0x13')]);router[_0x7d59('0x14')]('/:id',auth['isAuthenticated'](),controller[_0x7d59('0x15')]);module[_0x7d59('0x16')]=router; \ No newline at end of file diff --git a/server/api/tag/tag.attributes.js b/server/api/tag/tag.attributes.js index fcda326..0ae8b5a 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 _0x5236=['name','sequelize','exports','STRING'];(function(_0x4543f8,_0x29face){var _0x5141f0=function(_0x3e5afa){while(--_0x3e5afa){_0x4543f8['push'](_0x4543f8['shift']());}};_0x5141f0(++_0x29face);}(_0x5236,0x109));var _0x6523=function(_0x1bab65,_0x4e223a){_0x1bab65=_0x1bab65-0x0;var _0x5ee2a1=_0x5236[_0x1bab65];return _0x5ee2a1;};'use strict';var Sequelize=require(_0x6523('0x0'));module[_0x6523('0x1')]={'name':{'type':Sequelize[_0x6523('0x2')],'unique':_0x6523('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x6523('0x2')],'defaultValue':'#0091EA'},'description':{'type':Sequelize[_0x6523('0x2')]}}; \ No newline at end of file +var _0xc4dd=['#0091EA','sequelize','exports','STRING'];(function(_0x23e7c1,_0x35110c){var _0x1add43=function(_0x238918){while(--_0x238918){_0x23e7c1['push'](_0x23e7c1['shift']());}};_0x1add43(++_0x35110c);}(_0xc4dd,0xad));var _0xdc4d=function(_0x59c1c8,_0x97355e){_0x59c1c8=_0x59c1c8-0x0;var _0x254820=_0xc4dd[_0x59c1c8];return _0x254820;};'use strict';var Sequelize=require(_0xdc4d('0x0'));module[_0xdc4d('0x1')]={'name':{'type':Sequelize[_0xdc4d('0x2')],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0xdc4d('0x2')],'defaultValue':_0xdc4d('0x3')},'description':{'type':Sequelize[_0xdc4d('0x2')]}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index c4abde9..f4b4d65 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 _0xb717=['keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','get','Tags','end','sendStatus','stack','name','send','map','Tag','rawAttributes','fieldName','type','model'];(function(_0x497568,_0x133550){var _0x63ca6d=function(_0x4b73ef){while(--_0x4b73ef){_0x497568['push'](_0x497568['shift']());}};_0x63ca6d(++_0x133550);}(_0xb717,0x1b4));var _0x7b71=function(_0x49ac9f,_0x5a4dc4){_0x49ac9f=_0x49ac9f-0x0;var _0x430a1c=_0xb717[_0x49ac9f];return _0x430a1c;};'use strict';var emlformat=require(_0x7b71('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7b71('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7b71('0x2'));var moment=require(_0x7b71('0x3'));var BPromise=require(_0x7b71('0x4'));var Mustache=require('mustache');var util=require(_0x7b71('0x5'));var path=require(_0x7b71('0x6'));var sox=require(_0x7b71('0x7'));var csv=require(_0x7b71('0x8'));var ejs=require(_0x7b71('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7b71('0xa'));var squel=require(_0x7b71('0xb'));var crypto=require(_0x7b71('0xc'));var jsforce=require(_0x7b71('0xd'));var deskjs=require(_0x7b71('0xe'));var toCsv=require('to-csv');var querystring=require(_0x7b71('0xf'));var Papa=require(_0x7b71('0x10'));var Redis=require('ioredis');var authService=require(_0x7b71('0x11'));var qs=require(_0x7b71('0x12'));var as=require(_0x7b71('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7b71('0x14'))('api');var utils=require(_0x7b71('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x7b71('0x16'));var db=require(_0x7b71('0x17'))['db'];function respondWithStatusCode(_0x291ba5,_0x101181){_0x101181=_0x101181||0xcc;return function(_0x45c890){if(_0x45c890){return _0x291ba5['sendStatus'](_0x101181);}return _0x291ba5[_0x7b71('0x18')](_0x101181)['end']();};}function respondWithResult(_0x121e8f,_0x22114a){_0x22114a=_0x22114a||0xc8;return function(_0x4f1f41){if(_0x4f1f41){return _0x121e8f[_0x7b71('0x18')](_0x22114a)[_0x7b71('0x19')](_0x4f1f41);}};}function respondWithFilteredResult(_0x4266e5,_0x5888f9){return function(_0x5e7c3a){if(_0x5e7c3a){var _0xadd51e=typeof _0x5888f9[_0x7b71('0x1a')]===_0x7b71('0x1b')&&typeof _0x5888f9[_0x7b71('0x1c')]==='undefined';var _0x268090=_0x5e7c3a['count'];var _0x4adce8=_0xadd51e?0x0:_0x5888f9[_0x7b71('0x1a')];var _0xbde25=_0xadd51e?_0x5e7c3a[_0x7b71('0x1d')]:_0x5888f9[_0x7b71('0x1a')]+_0x5888f9[_0x7b71('0x1c')];var _0x51d647;if(_0xbde25>=_0x268090){_0xbde25=_0x268090;_0x51d647=0xc8;}else{_0x51d647=0xce;}_0x4266e5[_0x7b71('0x18')](_0x51d647);return _0x4266e5[_0x7b71('0x1e')](_0x7b71('0x1f'),_0x4adce8+'-'+_0xbde25+'/'+_0x268090)[_0x7b71('0x19')](_0x5e7c3a);}return null;};}function patchUpdates(_0x206000){return function(_0x297918){try{jsonpatch['apply'](_0x297918,_0x206000,!![]);}catch(_0x459c8b){return BPromise[_0x7b71('0x20')](_0x459c8b);}return _0x297918[_0x7b71('0x21')]();};}function saveUpdates(_0x375f85,_0x47d933){return function(_0x55ed9c){if(_0x55ed9c){return _0x55ed9c[_0x7b71('0x22')](_0x375f85)[_0x7b71('0x23')](function(_0x467f1a){return _0x467f1a;});}return null;};}function removeEntity(_0x33ad80,_0x3aca34){return function(_0x478dd8){if(_0x478dd8){return _0x478dd8[_0x7b71('0x24')]()['then'](function(){var _0x16c1f3=_0x478dd8[_0x7b71('0x25')]({'plain':!![]});var _0x19a6f5=_0x7b71('0x26');return db['UserProfileResource']['destroy']({'where':{'type':_0x19a6f5,'resourceId':_0x16c1f3['id']}})[_0x7b71('0x23')](function(){return _0x478dd8;});})[_0x7b71('0x23')](function(){_0x33ad80['status'](0xcc)[_0x7b71('0x27')]();});}};}function handleEntityNotFound(_0x214555,_0x7c978b){return function(_0x2f9ca9){if(!_0x2f9ca9){_0x214555[_0x7b71('0x28')](0x194);}return _0x2f9ca9;};}function handleError(_0x5209b6,_0x55ae81){_0x55ae81=_0x55ae81||0x1f4;return function(_0x2b323b){logger['error'](_0x2b323b[_0x7b71('0x29')]);if(_0x2b323b['name']){delete _0x2b323b[_0x7b71('0x2a')];}_0x5209b6[_0x7b71('0x18')](_0x55ae81)[_0x7b71('0x2b')](_0x2b323b);};}exports['index']=function(_0x1e4e89,_0xc29e2b){var _0x21ef65={},_0x5b5a4b={},_0x5e11e1={'count':0x0,'rows':[]};var _0xd100d4=_[_0x7b71('0x2c')](db[_0x7b71('0x2d')][_0x7b71('0x2e')],function(_0x43925c){return{'name':_0x43925c[_0x7b71('0x2f')],'type':_0x43925c[_0x7b71('0x30')]['key']};});_0x5b5a4b[_0x7b71('0x31')]=_[_0x7b71('0x2c')](_0xd100d4,_0x7b71('0x2a'));_0x5b5a4b['query']=_[_0x7b71('0x32')](_0x1e4e89[_0x7b71('0x33')]);_0x5b5a4b[_0x7b71('0x34')]=_[_0x7b71('0x35')](_0x5b5a4b[_0x7b71('0x31')],_0x5b5a4b[_0x7b71('0x33')]);_0x21ef65['attributes']=_[_0x7b71('0x35')](_0x5b5a4b[_0x7b71('0x31')],qs[_0x7b71('0x36')](_0x1e4e89[_0x7b71('0x33')][_0x7b71('0x36')]));_0x21ef65['attributes']=_0x21ef65[_0x7b71('0x37')][_0x7b71('0x38')]?_0x21ef65[_0x7b71('0x37')]:_0x5b5a4b[_0x7b71('0x31')];if(!_0x1e4e89[_0x7b71('0x33')][_0x7b71('0x39')](_0x7b71('0x3a'))){_0x21ef65[_0x7b71('0x1c')]=qs['limit'](_0x1e4e89[_0x7b71('0x33')][_0x7b71('0x1c')]);_0x21ef65[_0x7b71('0x1a')]=qs[_0x7b71('0x1a')](_0x1e4e89[_0x7b71('0x33')][_0x7b71('0x1a')]);}_0x21ef65[_0x7b71('0x3b')]=qs['sort'](_0x1e4e89[_0x7b71('0x33')][_0x7b71('0x3c')]);_0x21ef65[_0x7b71('0x3d')]=qs[_0x7b71('0x34')](_['pick'](_0x1e4e89[_0x7b71('0x33')],_0x5b5a4b[_0x7b71('0x34')]),_0xd100d4);if(_0x1e4e89[_0x7b71('0x33')][_0x7b71('0x3e')]){_0x21ef65[_0x7b71('0x3d')]=_[_0x7b71('0x3f')](_0x21ef65[_0x7b71('0x3d')],{'$or':_[_0x7b71('0x2c')](_0xd100d4,function(_0x30e9d1){if(_0x30e9d1[_0x7b71('0x30')]!==_0x7b71('0x40')){var _0x154dd5={};_0x154dd5[_0x30e9d1['name']]={'$like':'%'+_0x1e4e89[_0x7b71('0x33')][_0x7b71('0x3e')]+'%'};return _0x154dd5;}})});}_0x21ef65=_['merge']({},_0x21ef65,_0x1e4e89[_0x7b71('0x41')]);var _0x411c57={'where':_0x21ef65[_0x7b71('0x3d')]};return db[_0x7b71('0x2d')][_0x7b71('0x1d')](_0x411c57)['then'](function(_0x37cf27){_0x5e11e1[_0x7b71('0x1d')]=_0x37cf27;if(_0x1e4e89[_0x7b71('0x33')][_0x7b71('0x42')]){_0x21ef65[_0x7b71('0x43')]=[{'all':!![]}];}return db['Tag']['findAll'](_0x21ef65);})[_0x7b71('0x23')](function(_0x541730){_0x5e11e1[_0x7b71('0x44')]=_0x541730;return _0x5e11e1;})[_0x7b71('0x23')](respondWithFilteredResult(_0xc29e2b,_0x21ef65))[_0x7b71('0x45')](handleError(_0xc29e2b,null));};exports[_0x7b71('0x46')]=function(_0x3c3ffb,_0x324b28){var _0x23a762={'raw':!![],'where':{'id':_0x3c3ffb[_0x7b71('0x47')]['id']}},_0x5b73a6={};_0x5b73a6[_0x7b71('0x31')]=_['keys'](db[_0x7b71('0x2d')][_0x7b71('0x2e')]);_0x5b73a6[_0x7b71('0x33')]=_[_0x7b71('0x32')](_0x3c3ffb[_0x7b71('0x33')]);_0x5b73a6[_0x7b71('0x34')]=_[_0x7b71('0x35')](_0x5b73a6[_0x7b71('0x31')],_0x5b73a6[_0x7b71('0x33')]);_0x23a762[_0x7b71('0x37')]=_[_0x7b71('0x35')](_0x5b73a6[_0x7b71('0x31')],qs[_0x7b71('0x36')](_0x3c3ffb['query'][_0x7b71('0x36')]));_0x23a762[_0x7b71('0x37')]=_0x23a762['attributes']['length']?_0x23a762['attributes']:_0x5b73a6[_0x7b71('0x31')];if(_0x3c3ffb[_0x7b71('0x33')][_0x7b71('0x42')]){_0x23a762['include']=[{'all':!![]}];}_0x23a762=_[_0x7b71('0x3f')]({},_0x23a762,_0x3c3ffb[_0x7b71('0x41')]);return db['Tag'][_0x7b71('0x48')](_0x23a762)[_0x7b71('0x23')](handleEntityNotFound(_0x324b28,null))[_0x7b71('0x23')](respondWithResult(_0x324b28,null))['catch'](handleError(_0x324b28,null));};exports[_0x7b71('0x49')]=function(_0x18cb19,_0x945c68){return db[_0x7b71('0x2d')][_0x7b71('0x49')](_0x18cb19[_0x7b71('0x4a')],{})[_0x7b71('0x23')](function(_0x30e8d8){var _0xdb438=_0x18cb19[_0x7b71('0x4b')][_0x7b71('0x25')]({'plain':!![]});if(!_0xdb438)throw new Error(_0x7b71('0x4c'));if(_0xdb438['role']===_0x7b71('0x4b')){var _0x504cdf=_0x30e8d8[_0x7b71('0x25')]({'plain':!![]});var _0x154f72=_0x7b71('0x26');return db[_0x7b71('0x4d')][_0x7b71('0x48')]({'where':{'name':_0x154f72,'userProfileId':_0xdb438[_0x7b71('0x4e')]},'raw':!![]})['then'](function(_0x318605){if(_0x318605&&_0x318605['autoAssociation']===0x0){return db['UserProfileResource'][_0x7b71('0x49')]({'name':_0x504cdf['name'],'resourceId':_0x504cdf['id'],'type':_0x318605[_0x7b71('0x2a')],'sectionId':_0x318605['id']},{})[_0x7b71('0x23')](function(){return _0x30e8d8;});}else{return _0x30e8d8;}})[_0x7b71('0x45')](function(_0x38cf0e){logger[_0x7b71('0x4f')](_0x7b71('0x50'),_0x38cf0e);throw _0x38cf0e;});}return _0x30e8d8;})[_0x7b71('0x23')](respondWithResult(_0x945c68,0xc9))[_0x7b71('0x45')](handleError(_0x945c68,null));};exports[_0x7b71('0x22')]=function(_0x38395a,_0xbb46b3){if(_0x38395a['body']['id']){delete _0x38395a['body']['id'];}return db[_0x7b71('0x2d')]['find']({'where':{'id':_0x38395a[_0x7b71('0x47')]['id']}})[_0x7b71('0x23')](handleEntityNotFound(_0xbb46b3,null))[_0x7b71('0x23')](saveUpdates(_0x38395a['body'],null))['then'](respondWithResult(_0xbb46b3,null))['catch'](handleError(_0xbb46b3,null));};exports[_0x7b71('0x24')]=function(_0x48b486,_0x1d3acf){return db[_0x7b71('0x2d')]['find']({'where':{'id':_0x48b486[_0x7b71('0x47')]['id']}})['then'](handleEntityNotFound(_0x1d3acf,null))[_0x7b71('0x23')](removeEntity(_0x1d3acf,null))['catch'](handleError(_0x1d3acf,null));}; \ No newline at end of file +var _0x4c4e=['util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','get','Tags','destroy','name','send','index','map','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','type','VIRTUAL','merge','options','Tag','includeAll','include','rows','catch','show','params','rawAttributes','keys','find','create','user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache'];(function(_0x1db831,_0x42b7b5){var _0x39ba56=function(_0x2c2dd3){while(--_0x2c2dd3){_0x1db831['push'](_0x1db831['shift']());}};_0x39ba56(++_0x42b7b5);}(_0x4c4e,0x152));var _0xe4c4=function(_0x457394,_0x294b51){_0x457394=_0x457394-0x0;var _0x4930fc=_0x4c4e[_0x457394];return _0x4930fc;};'use strict';var emlformat=require(_0xe4c4('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe4c4('0x1'));var jsonpatch=require(_0xe4c4('0x2'));var rp=require(_0xe4c4('0x3'));var moment=require('moment');var BPromise=require(_0xe4c4('0x4'));var Mustache=require(_0xe4c4('0x5'));var util=require(_0xe4c4('0x6'));var path=require('path');var sox=require(_0xe4c4('0x7'));var csv=require('to-csv');var ejs=require(_0xe4c4('0x8'));var fs=require('fs');var fs_extra=require(_0xe4c4('0x9'));var _=require(_0xe4c4('0xa'));var squel=require(_0xe4c4('0xb'));var crypto=require(_0xe4c4('0xc'));var jsforce=require(_0xe4c4('0xd'));var deskjs=require(_0xe4c4('0xe'));var toCsv=require(_0xe4c4('0xf'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xe4c4('0x10'));var authService=require(_0xe4c4('0x11'));var qs=require(_0xe4c4('0x12'));var as=require(_0xe4c4('0x13'));var hardwareService=require(_0xe4c4('0x14'));var logger=require(_0xe4c4('0x15'))('api');var utils=require(_0xe4c4('0x16'));var config=require(_0xe4c4('0x17'));var licenseUtil=require(_0xe4c4('0x18'));var db=require(_0xe4c4('0x19'))['db'];function respondWithStatusCode(_0x50bfab,_0x262083){_0x262083=_0x262083||0xcc;return function(_0x115802){if(_0x115802){return _0x50bfab['sendStatus'](_0x262083);}return _0x50bfab[_0xe4c4('0x1a')](_0x262083)[_0xe4c4('0x1b')]();};}function respondWithResult(_0x5aa89b,_0x42ce9e){_0x42ce9e=_0x42ce9e||0xc8;return function(_0x29766a){if(_0x29766a){return _0x5aa89b['status'](_0x42ce9e)[_0xe4c4('0x1c')](_0x29766a);}};}function respondWithFilteredResult(_0x465c9b,_0x26ea05){return function(_0x40a36e){if(_0x40a36e){var _0x19e59b=typeof _0x26ea05[_0xe4c4('0x1d')]===_0xe4c4('0x1e')&&typeof _0x26ea05[_0xe4c4('0x1f')]===_0xe4c4('0x1e');var _0x36b10c=_0x40a36e[_0xe4c4('0x20')];var _0x42242c=_0x19e59b?0x0:_0x26ea05[_0xe4c4('0x1d')];var _0x43a9ce=_0x19e59b?_0x40a36e[_0xe4c4('0x20')]:_0x26ea05['offset']+_0x26ea05[_0xe4c4('0x1f')];var _0x24f946;if(_0x43a9ce>=_0x36b10c){_0x43a9ce=_0x36b10c;_0x24f946=0xc8;}else{_0x24f946=0xce;}_0x465c9b[_0xe4c4('0x1a')](_0x24f946);return _0x465c9b[_0xe4c4('0x21')]('Content-Range',_0x42242c+'-'+_0x43a9ce+'/'+_0x36b10c)[_0xe4c4('0x1c')](_0x40a36e);}return null;};}function patchUpdates(_0x1cad5d){return function(_0x1727eb){try{jsonpatch[_0xe4c4('0x22')](_0x1727eb,_0x1cad5d,!![]);}catch(_0x2c5aea){return BPromise[_0xe4c4('0x23')](_0x2c5aea);}return _0x1727eb[_0xe4c4('0x24')]();};}function saveUpdates(_0x393c96,_0x21bbb1){return function(_0x1a7690){if(_0x1a7690){return _0x1a7690[_0xe4c4('0x25')](_0x393c96)[_0xe4c4('0x26')](function(_0x138ead){return _0x138ead;});}return null;};}function removeEntity(_0x1db719,_0x15873e){return function(_0x59498e){if(_0x59498e){return _0x59498e['destroy']()[_0xe4c4('0x26')](function(){var _0x4dc8cc=_0x59498e[_0xe4c4('0x27')]({'plain':!![]});var _0x5374fd=_0xe4c4('0x28');return db['UserProfileResource'][_0xe4c4('0x29')]({'where':{'type':_0x5374fd,'resourceId':_0x4dc8cc['id']}})['then'](function(){return _0x59498e;});})[_0xe4c4('0x26')](function(){_0x1db719['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4cea1f,_0x5d66ab){return function(_0x3221cd){if(!_0x3221cd){_0x4cea1f['sendStatus'](0x194);}return _0x3221cd;};}function handleError(_0x5b5ea5,_0xe2c1b4){_0xe2c1b4=_0xe2c1b4||0x1f4;return function(_0x11deab){logger['error'](_0x11deab['stack']);if(_0x11deab[_0xe4c4('0x2a')]){delete _0x11deab[_0xe4c4('0x2a')];}_0x5b5ea5['status'](_0xe2c1b4)[_0xe4c4('0x2b')](_0x11deab);};}exports[_0xe4c4('0x2c')]=function(_0x3f60fc,_0x48060e){var _0x5d49fd={},_0x46db7e={},_0x2c5652={'count':0x0,'rows':[]};var _0x12bde8=_[_0xe4c4('0x2d')](db['Tag']['rawAttributes'],function(_0x1731c8){return{'name':_0x1731c8[_0xe4c4('0x2e')],'type':_0x1731c8['type'][_0xe4c4('0x2f')]};});_0x46db7e[_0xe4c4('0x30')]=_[_0xe4c4('0x2d')](_0x12bde8,'name');_0x46db7e[_0xe4c4('0x31')]=_['keys'](_0x3f60fc[_0xe4c4('0x31')]);_0x46db7e[_0xe4c4('0x32')]=_[_0xe4c4('0x33')](_0x46db7e[_0xe4c4('0x30')],_0x46db7e[_0xe4c4('0x31')]);_0x5d49fd[_0xe4c4('0x34')]=_[_0xe4c4('0x33')](_0x46db7e[_0xe4c4('0x30')],qs[_0xe4c4('0x35')](_0x3f60fc[_0xe4c4('0x31')][_0xe4c4('0x35')]));_0x5d49fd[_0xe4c4('0x34')]=_0x5d49fd['attributes'][_0xe4c4('0x36')]?_0x5d49fd[_0xe4c4('0x34')]:_0x46db7e[_0xe4c4('0x30')];if(!_0x3f60fc['query'][_0xe4c4('0x37')](_0xe4c4('0x38'))){_0x5d49fd[_0xe4c4('0x1f')]=qs['limit'](_0x3f60fc[_0xe4c4('0x31')][_0xe4c4('0x1f')]);_0x5d49fd[_0xe4c4('0x1d')]=qs[_0xe4c4('0x1d')](_0x3f60fc[_0xe4c4('0x31')][_0xe4c4('0x1d')]);}_0x5d49fd[_0xe4c4('0x39')]=qs[_0xe4c4('0x3a')](_0x3f60fc[_0xe4c4('0x31')][_0xe4c4('0x3a')]);_0x5d49fd['where']=qs[_0xe4c4('0x32')](_[_0xe4c4('0x3b')](_0x3f60fc[_0xe4c4('0x31')],_0x46db7e[_0xe4c4('0x32')]),_0x12bde8);if(_0x3f60fc['query'][_0xe4c4('0x3c')]){_0x5d49fd[_0xe4c4('0x3d')]=_['merge'](_0x5d49fd[_0xe4c4('0x3d')],{'$or':_[_0xe4c4('0x2d')](_0x12bde8,function(_0x4db15d){if(_0x4db15d[_0xe4c4('0x3e')]!==_0xe4c4('0x3f')){var _0x127bcd={};_0x127bcd[_0x4db15d[_0xe4c4('0x2a')]]={'$like':'%'+_0x3f60fc[_0xe4c4('0x31')][_0xe4c4('0x3c')]+'%'};return _0x127bcd;}})});}_0x5d49fd=_[_0xe4c4('0x40')]({},_0x5d49fd,_0x3f60fc[_0xe4c4('0x41')]);var _0x1e457c={'where':_0x5d49fd[_0xe4c4('0x3d')]};return db[_0xe4c4('0x42')][_0xe4c4('0x20')](_0x1e457c)['then'](function(_0x3773dd){_0x2c5652[_0xe4c4('0x20')]=_0x3773dd;if(_0x3f60fc[_0xe4c4('0x31')][_0xe4c4('0x43')]){_0x5d49fd[_0xe4c4('0x44')]=[{'all':!![]}];}return db[_0xe4c4('0x42')]['findAll'](_0x5d49fd);})[_0xe4c4('0x26')](function(_0x526bef){_0x2c5652[_0xe4c4('0x45')]=_0x526bef;return _0x2c5652;})[_0xe4c4('0x26')](respondWithFilteredResult(_0x48060e,_0x5d49fd))[_0xe4c4('0x46')](handleError(_0x48060e,null));};exports[_0xe4c4('0x47')]=function(_0x48177f,_0x566eb7){var _0x55b527={'raw':!![],'where':{'id':_0x48177f[_0xe4c4('0x48')]['id']}},_0x23a668={};_0x23a668[_0xe4c4('0x30')]=_['keys'](db[_0xe4c4('0x42')][_0xe4c4('0x49')]);_0x23a668[_0xe4c4('0x31')]=_[_0xe4c4('0x4a')](_0x48177f['query']);_0x23a668[_0xe4c4('0x32')]=_[_0xe4c4('0x33')](_0x23a668[_0xe4c4('0x30')],_0x23a668[_0xe4c4('0x31')]);_0x55b527[_0xe4c4('0x34')]=_[_0xe4c4('0x33')](_0x23a668[_0xe4c4('0x30')],qs[_0xe4c4('0x35')](_0x48177f[_0xe4c4('0x31')]['fields']));_0x55b527[_0xe4c4('0x34')]=_0x55b527['attributes'][_0xe4c4('0x36')]?_0x55b527[_0xe4c4('0x34')]:_0x23a668[_0xe4c4('0x30')];if(_0x48177f[_0xe4c4('0x31')][_0xe4c4('0x43')]){_0x55b527[_0xe4c4('0x44')]=[{'all':!![]}];}_0x55b527=_[_0xe4c4('0x40')]({},_0x55b527,_0x48177f[_0xe4c4('0x41')]);return db[_0xe4c4('0x42')][_0xe4c4('0x4b')](_0x55b527)[_0xe4c4('0x26')](handleEntityNotFound(_0x566eb7,null))[_0xe4c4('0x26')](respondWithResult(_0x566eb7,null))[_0xe4c4('0x46')](handleError(_0x566eb7,null));};exports[_0xe4c4('0x4c')]=function(_0x535bcc,_0x4922f5){return db[_0xe4c4('0x42')][_0xe4c4('0x4c')](_0x535bcc['body'],{})[_0xe4c4('0x26')](function(_0x2853da){var _0x1211f9=_0x535bcc[_0xe4c4('0x4d')][_0xe4c4('0x27')]({'plain':!![]});if(!_0x1211f9)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1211f9[_0xe4c4('0x4e')]===_0xe4c4('0x4d')){var _0x4f6e03=_0x2853da[_0xe4c4('0x27')]({'plain':!![]});var _0x24b0e7='Tags';return db[_0xe4c4('0x4f')]['find']({'where':{'name':_0x24b0e7,'userProfileId':_0x1211f9[_0xe4c4('0x50')]},'raw':!![]})[_0xe4c4('0x26')](function(_0x2a54ef){if(_0x2a54ef&&_0x2a54ef[_0xe4c4('0x51')]===0x0){return db[_0xe4c4('0x52')]['create']({'name':_0x4f6e03[_0xe4c4('0x2a')],'resourceId':_0x4f6e03['id'],'type':_0x2a54ef[_0xe4c4('0x2a')],'sectionId':_0x2a54ef['id']},{})[_0xe4c4('0x26')](function(){return _0x2853da;});}else{return _0x2853da;}})[_0xe4c4('0x46')](function(_0x3c9fc4){logger[_0xe4c4('0x53')](_0xe4c4('0x54'),_0x3c9fc4);throw _0x3c9fc4;});}return _0x2853da;})[_0xe4c4('0x26')](respondWithResult(_0x4922f5,0xc9))[_0xe4c4('0x46')](handleError(_0x4922f5,null));};exports[_0xe4c4('0x25')]=function(_0x1fe354,_0x1940e3){if(_0x1fe354[_0xe4c4('0x55')]['id']){delete _0x1fe354[_0xe4c4('0x55')]['id'];}return db[_0xe4c4('0x42')][_0xe4c4('0x4b')]({'where':{'id':_0x1fe354['params']['id']}})[_0xe4c4('0x26')](handleEntityNotFound(_0x1940e3,null))[_0xe4c4('0x26')](saveUpdates(_0x1fe354[_0xe4c4('0x55')],null))['then'](respondWithResult(_0x1940e3,null))[_0xe4c4('0x46')](handleError(_0x1940e3,null));};exports[_0xe4c4('0x29')]=function(_0x35f750,_0x512ca9){return db[_0xe4c4('0x42')]['find']({'where':{'id':_0x35f750[_0xe4c4('0x48')]['id']}})[_0xe4c4('0x26')](handleEntityNotFound(_0x512ca9,null))[_0xe4c4('0x26')](removeEntity(_0x512ca9,null))['catch'](handleError(_0x512ca9,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index 0e13585..546b971 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 _0x4307=['rimraf','../../config/environment','exports','define','Tag','tools_tags','lodash','../../config/logger','moment','bluebird','request-promise'];(function(_0x4eebd7,_0x3e3b58){var _0x324aa9=function(_0x32a4eb){while(--_0x32a4eb){_0x4eebd7['push'](_0x4eebd7['shift']());}};_0x324aa9(++_0x3e3b58);}(_0x4307,0x145));var _0x7430=function(_0x20e77e,_0x3e0c74){_0x20e77e=_0x20e77e-0x0;var _0x213558=_0x4307[_0x20e77e];return _0x213558;};'use strict';var _=require(_0x7430('0x0'));var util=require('util');var logger=require(_0x7430('0x1'))('api');var moment=require(_0x7430('0x2'));var BPromise=require(_0x7430('0x3'));var rp=require(_0x7430('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7430('0x5'));var config=require(_0x7430('0x6'));var attributes=require('./tag.attributes');module[_0x7430('0x7')]=function(_0x573317,_0x1cab19){return _0x573317[_0x7430('0x8')](_0x7430('0x9'),attributes,{'tableName':_0x7430('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9a20=['rimraf','./tag.attributes','Tag','tools_tags','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x9a20,0x158));var _0x09a2=function(_0x169c31,_0x51237e){_0x169c31=_0x169c31-0x0;var _0x43da62=_0x9a20[_0x169c31];return _0x43da62;};'use strict';var _=require(_0x09a2('0x0'));var util=require(_0x09a2('0x1'));var logger=require(_0x09a2('0x2'))(_0x09a2('0x3'));var moment=require(_0x09a2('0x4'));var BPromise=require('bluebird');var rp=require(_0x09a2('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x09a2('0x6'));var config=require('../../config/environment');var attributes=require(_0x09a2('0x7'));module['exports']=function(_0x17caf0,_0x2289f2){return _0x17caf0['define'](_0x09a2('0x8'),attributes,{'tableName':_0x09a2('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/tag/tag.rpc.js b/server/api/tag/tag.rpc.js index b2c1df6..28757ef 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 _0x2121=['request\x20sent','stringify','error','message','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','Tag,\x20%s,\x20%s'];(function(_0x9bb1a4,_0x168d76){var _0x4c33dd=function(_0x1686f1){while(--_0x1686f1){_0x9bb1a4['push'](_0x9bb1a4['shift']());}};_0x4c33dd(++_0x168d76);}(_0x2121,0x1b4));var _0x1212=function(_0x1642e0,_0x379fc7){_0x1642e0=_0x1642e0-0x0;var _0x16a62a=_0x2121[_0x1642e0];return _0x16a62a;};'use strict';var _=require(_0x1212('0x0'));var util=require(_0x1212('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x1212('0x2'));var fs=require('fs');var Redis=require(_0x1212('0x3'));var db=require(_0x1212('0x4'))['db'];var utils=require(_0x1212('0x5'));var logger=require(_0x1212('0x6'))('rpc');var config=require(_0x1212('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x1212('0x8')][_0x1212('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x20fadc,_0x1b1ef5,_0x233a53){return new BPromise(function(_0x642ed5,_0x4a3d2a){return client[_0x1212('0xa')](_0x20fadc,_0x233a53)[_0x1212('0xb')](function(_0x434d23){logger[_0x1212('0xc')](_0x1212('0xd'),_0x1b1ef5,_0x1212('0xe'));logger['debug']('Tag,\x20%s,\x20%s,\x20%s',_0x1b1ef5,_0x1212('0xe'),JSON[_0x1212('0xf')](_0x434d23));if(_0x434d23[_0x1212('0x10')]){if(_0x434d23[_0x1212('0x10')]['code']===0x1f4){logger[_0x1212('0x10')](_0x1212('0xd'),_0x1b1ef5,_0x434d23[_0x1212('0x10')][_0x1212('0x11')]);return _0x4a3d2a(_0x434d23[_0x1212('0x10')][_0x1212('0x11')]);}logger[_0x1212('0x10')](_0x1212('0xd'),_0x1b1ef5,_0x434d23[_0x1212('0x10')][_0x1212('0x11')]);return _0x642ed5(_0x434d23[_0x1212('0x10')][_0x1212('0x11')]);}else{logger[_0x1212('0xc')](_0x1212('0xd'),_0x1b1ef5,_0x1212('0xe'));_0x642ed5(_0x434d23['result']['message']);}})['catch'](function(_0x3cfe21){logger[_0x1212('0x10')](_0x1212('0xd'),_0x1b1ef5,_0x3cfe21);_0x4a3d2a(_0x3cfe21);});});} \ No newline at end of file +var _0x6aa7=['result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','client','request','then','info','Tag,\x20%s,\x20%s','request\x20sent','debug','Tag,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x3f9f17,_0x1339d9){var _0x420462=function(_0x5b2c44){while(--_0x5b2c44){_0x3f9f17['push'](_0x3f9f17['shift']());}};_0x420462(++_0x1339d9);}(_0x6aa7,0x178));var _0x76aa=function(_0x1585d0,_0x340114){_0x1585d0=_0x1585d0-0x0;var _0x1c5bd6=_0x6aa7[_0x1585d0];return _0x1c5bd6;};'use strict';var _=require(_0x76aa('0x0'));var util=require('util');var moment=require(_0x76aa('0x1'));var BPromise=require(_0x76aa('0x2'));var rs=require(_0x76aa('0x3'));var fs=require('fs');var Redis=require(_0x76aa('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x76aa('0x5'));var logger=require(_0x76aa('0x6'))(_0x76aa('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x76aa('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x32dee5,_0x36d12b,_0xa9b695){return new BPromise(function(_0x56d6bc,_0x3dae33){return client[_0x76aa('0x9')](_0x32dee5,_0xa9b695)[_0x76aa('0xa')](function(_0x557d69){logger[_0x76aa('0xb')](_0x76aa('0xc'),_0x36d12b,_0x76aa('0xd'));logger[_0x76aa('0xe')](_0x76aa('0xf'),_0x36d12b,_0x76aa('0xd'),JSON[_0x76aa('0x10')](_0x557d69));if(_0x557d69[_0x76aa('0x11')]){if(_0x557d69[_0x76aa('0x11')][_0x76aa('0x12')]===0x1f4){logger['error'](_0x76aa('0xc'),_0x36d12b,_0x557d69['error'][_0x76aa('0x13')]);return _0x3dae33(_0x557d69[_0x76aa('0x11')][_0x76aa('0x13')]);}logger[_0x76aa('0x11')](_0x76aa('0xc'),_0x36d12b,_0x557d69['error']['message']);return _0x56d6bc(_0x557d69[_0x76aa('0x11')]['message']);}else{logger[_0x76aa('0xb')](_0x76aa('0xc'),_0x36d12b,'request\x20sent');_0x56d6bc(_0x557d69[_0x76aa('0x14')]['message']);}})[_0x76aa('0x15')](function(_0x5181d2){logger[_0x76aa('0x11')](_0x76aa('0xc'),_0x36d12b,_0x5181d2);_0x3dae33(_0x5181d2);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index 0610aec..616b1b9 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(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3e112d,_0x2bb132){_0x3e112d=_0x3e112d-0x0;var _0x531c31=_0xa9e0[_0x3e112d];return _0x531c31;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));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(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xa9e0,0x123));var _0x0a9e=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0xa9e0[_0xae7c2f];return _0x5d7001;};'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 f98f56a..1ffceee 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 _0x2032=['name','exports','STRING'];(function(_0xb78a58,_0x28eb90){var _0x6f4789=function(_0x4ae9af){while(--_0x4ae9af){_0xb78a58['push'](_0xb78a58['shift']());}};_0x6f4789(++_0x28eb90);}(_0x2032,0xd9));var _0x2203=function(_0x5814a2,_0x4ea77b){_0x5814a2=_0x5814a2-0x0;var _0x5d507f=_0x2032[_0x5814a2];return _0x5d507f;};'use strict';var Sequelize=require('sequelize');module[_0x2203('0x0')]={'name':{'type':Sequelize[_0x2203('0x1')],'allowNull':![],'unique':_0x2203('0x2')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xbaf0=['name','exports','STRING'];(function(_0x254076,_0x5e7b8d){var _0x21a93e=function(_0x26aa78){while(--_0x26aa78){_0x254076['push'](_0x254076['shift']());}};_0x21a93e(++_0x5e7b8d);}(_0xbaf0,0x12a));var _0x0baf=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xbaf0[_0x5ddb1c];return _0x354adc;};'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 e05aaa7..9f530e5 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 _0x6435=['./team.socket','register','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','update','then','error','name','send','index','map','Team','rawAttributes','fieldName','type','key','model','query','keys','attributes','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','VIRTUAL','options','include','findAll','show','params','intersection','fields','includeAll','merge','find','catch','create','body','get','role','user','Teams','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','destroy','transaction','sequelize','Sequelize','QueryTypes','SELECT','UserId','VoiceQueueId','UserVoiceQueue','SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20','UserMailQueue','SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20','SmsQueueId','SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20','ChatQueueId','UserChatQueue','SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20','UserFaxQueue','SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20','OpenchannelQueueId','WhatsappQueueId','UserWhatsappQueue','TeamVoicePrefix','UserVoicePrefix','VoicePrefixId','findOne','channel','isValidChannel','Unknown\x20channel','capitalize','Queue','toLowerCase','Queues','addQueues','ValidationError','add','ids','removeQueues','remove','addAgents','isArray','Voice','Chat','Mail','Fax','Openchannel','Whatsapp','through','penalty','QueueId','TeamVoiceQueue','User','emit','Queue:save','online','voicePause','interface','UserVoiceQueueRt','upsert','isNil','format','SIP/%s','all','spread','removeAgents','Sms','Queue:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter'];(function(_0x919445,_0x5467dc){var _0x511b3e=function(_0xde10f3){while(--_0xde10f3){_0x919445['push'](_0x919445['shift']());}};_0x511b3e(++_0x5467dc);}(_0x6435,0x82));var _0x5643=function(_0xdbf3b2,_0x1f5d85){_0xdbf3b2=_0xdbf3b2-0x0;var _0x59350a=_0x6435[_0xdbf3b2];return _0x59350a;};'use strict';var emlformat=require(_0x5643('0x0'));var rimraf=require(_0x5643('0x1'));var zipdir=require(_0x5643('0x2'));var jsonpatch=require(_0x5643('0x3'));var rp=require('request-promise');var moment=require(_0x5643('0x4'));var BPromise=require(_0x5643('0x5'));var Mustache=require(_0x5643('0x6'));var util=require(_0x5643('0x7'));var path=require(_0x5643('0x8'));var sox=require('sox');var csv=require(_0x5643('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5643('0xa'));var _=require(_0x5643('0xb'));var squel=require(_0x5643('0xc'));var crypto=require('crypto');var jsforce=require(_0x5643('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x5643('0xe'));var Papa=require(_0x5643('0xf'));var Redis=require(_0x5643('0x10'));var authService=require(_0x5643('0x11'));var qs=require(_0x5643('0x12'));var as=require(_0x5643('0x13'));var hardwareService=require(_0x5643('0x14'));var logger=require(_0x5643('0x15'))(_0x5643('0x16'));var utils=require(_0x5643('0x17'));var config=require(_0x5643('0x18'));var licenseUtil=require(_0x5643('0x19'));var db=require(_0x5643('0x1a'))['db'];config[_0x5643('0x1b')]=_[_0x5643('0x1c')](config[_0x5643('0x1b')],{'host':_0x5643('0x1d'),'port':0x18eb});var socket=require(_0x5643('0x1e'))(new Redis(config[_0x5643('0x1b')]));require(_0x5643('0x1f'))[_0x5643('0x20')](socket);function respondWithStatusCode(_0x1b7781,_0x3ca99c){_0x3ca99c=_0x3ca99c||0xcc;return function(_0x5c789b){if(_0x5c789b){return _0x1b7781[_0x5643('0x21')](_0x3ca99c);}return _0x1b7781[_0x5643('0x22')](_0x3ca99c)[_0x5643('0x23')]();};}function respondWithResult(_0x473f6d,_0x104937){_0x104937=_0x104937||0xc8;return function(_0x10f04e){if(_0x10f04e){return _0x473f6d['status'](_0x104937)[_0x5643('0x24')](_0x10f04e);}};}function respondWithFilteredResult(_0x5e32e4,_0x3fe772){return function(_0x27751d){if(_0x27751d){var _0x1a72d6=typeof _0x3fe772['offset']==='undefined'&&typeof _0x3fe772['limit']===_0x5643('0x25');var _0x54bdf7=_0x27751d[_0x5643('0x26')];var _0xf9e01c=_0x1a72d6?0x0:_0x3fe772[_0x5643('0x27')];var _0x526605=_0x1a72d6?_0x27751d[_0x5643('0x26')]:_0x3fe772[_0x5643('0x27')]+_0x3fe772[_0x5643('0x28')];var _0x3c99a1;if(_0x526605>=_0x54bdf7){_0x526605=_0x54bdf7;_0x3c99a1=0xc8;}else{_0x3c99a1=0xce;}_0x5e32e4[_0x5643('0x22')](_0x3c99a1);return _0x5e32e4[_0x5643('0x29')](_0x5643('0x2a'),_0xf9e01c+'-'+_0x526605+'/'+_0x54bdf7)['json'](_0x27751d);}return null;};}function patchUpdates(_0x39baad){return function(_0x20dc8b){try{jsonpatch[_0x5643('0x2b')](_0x20dc8b,_0x39baad,!![]);}catch(_0x1f3e59){return BPromise[_0x5643('0x2c')](_0x1f3e59);}return _0x20dc8b[_0x5643('0x2d')]();};}function saveUpdates(_0x2c7cd3,_0x229f7b){return function(_0x36cbb8){if(_0x36cbb8){return _0x36cbb8[_0x5643('0x2e')](_0x2c7cd3)[_0x5643('0x2f')](function(_0x272a75){return _0x272a75;});}return null;};}function handleEntityNotFound(_0xafc985,_0x353ce8){return function(_0x52ad2a){if(!_0x52ad2a){_0xafc985['sendStatus'](0x194);}return _0x52ad2a;};}function handleError(_0x249d4c,_0x509871){_0x509871=_0x509871||0x1f4;return function(_0x3599ff){logger[_0x5643('0x30')](_0x3599ff['stack']);if(_0x3599ff[_0x5643('0x31')]){delete _0x3599ff['name'];}_0x249d4c[_0x5643('0x22')](_0x509871)[_0x5643('0x32')](_0x3599ff);};}exports[_0x5643('0x33')]=function(_0x31d86b,_0x25e83e){var _0x5a6fb4={},_0x4a997d={},_0x49bc3b={'count':0x0,'rows':[]};var _0x26777d=_[_0x5643('0x34')](db[_0x5643('0x35')][_0x5643('0x36')],function(_0x3e1ef2){return{'name':_0x3e1ef2[_0x5643('0x37')],'type':_0x3e1ef2[_0x5643('0x38')][_0x5643('0x39')]};});_0x4a997d[_0x5643('0x3a')]=_[_0x5643('0x34')](_0x26777d,_0x5643('0x31'));_0x4a997d[_0x5643('0x3b')]=_[_0x5643('0x3c')](_0x31d86b[_0x5643('0x3b')]);_0x4a997d['filters']=_['intersection'](_0x4a997d[_0x5643('0x3a')],_0x4a997d[_0x5643('0x3b')]);_0x5a6fb4['attributes']=_['intersection'](_0x4a997d[_0x5643('0x3a')],qs['fields'](_0x31d86b['query']['fields']));_0x5a6fb4[_0x5643('0x3d')]=_0x5a6fb4[_0x5643('0x3d')][_0x5643('0x3e')]?_0x5a6fb4['attributes']:_0x4a997d['model'];if(!_0x31d86b[_0x5643('0x3b')][_0x5643('0x3f')](_0x5643('0x40'))){_0x5a6fb4[_0x5643('0x28')]=qs['limit'](_0x31d86b[_0x5643('0x3b')][_0x5643('0x28')]);_0x5a6fb4['offset']=qs[_0x5643('0x27')](_0x31d86b[_0x5643('0x3b')][_0x5643('0x27')]);}_0x5a6fb4[_0x5643('0x41')]=qs[_0x5643('0x42')](_0x31d86b[_0x5643('0x3b')][_0x5643('0x42')]);_0x5a6fb4['where']=qs[_0x5643('0x43')](_[_0x5643('0x44')](_0x31d86b[_0x5643('0x3b')],_0x4a997d[_0x5643('0x43')]),_0x26777d);if(_0x31d86b[_0x5643('0x3b')][_0x5643('0x45')]){_0x5a6fb4['where']=_['merge'](_0x5a6fb4[_0x5643('0x46')],{'$or':_[_0x5643('0x34')](_0x26777d,function(_0x13f779){if(_0x13f779[_0x5643('0x38')]!==_0x5643('0x47')){var _0x1ff71b={};_0x1ff71b[_0x13f779[_0x5643('0x31')]]={'$like':'%'+_0x31d86b[_0x5643('0x3b')][_0x5643('0x45')]+'%'};return _0x1ff71b;}})});}_0x5a6fb4=_['merge']({},_0x5a6fb4,_0x31d86b[_0x5643('0x48')]);var _0x251389={'where':_0x5a6fb4['where']};return db['Team']['count'](_0x251389)[_0x5643('0x2f')](function(_0x3a7fe7){_0x49bc3b[_0x5643('0x26')]=_0x3a7fe7;if(_0x31d86b[_0x5643('0x3b')]['includeAll']){_0x5a6fb4[_0x5643('0x49')]=[{'all':!![]}];}return db[_0x5643('0x35')][_0x5643('0x4a')](_0x5a6fb4);})[_0x5643('0x2f')](function(_0x118a40){_0x49bc3b['rows']=_0x118a40;return _0x49bc3b;})[_0x5643('0x2f')](respondWithFilteredResult(_0x25e83e,_0x5a6fb4))['catch'](handleError(_0x25e83e,null));};exports[_0x5643('0x4b')]=function(_0x322e1e,_0x35554a){var _0x3fd3eb={'raw':![],'where':{'id':_0x322e1e[_0x5643('0x4c')]['id']}},_0x394de8={};_0x394de8[_0x5643('0x3a')]=_['keys'](db[_0x5643('0x35')][_0x5643('0x36')]);_0x394de8['query']=_[_0x5643('0x3c')](_0x322e1e[_0x5643('0x3b')]);_0x394de8[_0x5643('0x43')]=_[_0x5643('0x4d')](_0x394de8[_0x5643('0x3a')],_0x394de8[_0x5643('0x3b')]);_0x3fd3eb[_0x5643('0x3d')]=_[_0x5643('0x4d')](_0x394de8['model'],qs[_0x5643('0x4e')](_0x322e1e[_0x5643('0x3b')][_0x5643('0x4e')]));_0x3fd3eb[_0x5643('0x3d')]=_0x3fd3eb[_0x5643('0x3d')][_0x5643('0x3e')]?_0x3fd3eb[_0x5643('0x3d')]:_0x394de8[_0x5643('0x3a')];if(_0x322e1e[_0x5643('0x3b')][_0x5643('0x4f')]){_0x3fd3eb['include']=[{'all':!![]}];}_0x3fd3eb=_[_0x5643('0x50')]({},_0x3fd3eb,_0x322e1e['options']);return db['Team'][_0x5643('0x51')](_0x3fd3eb)['then'](handleEntityNotFound(_0x35554a,null))[_0x5643('0x2f')](respondWithResult(_0x35554a,null))[_0x5643('0x52')](handleError(_0x35554a,null));};exports[_0x5643('0x53')]=function(_0x401d7a,_0x4cb9c6){return db[_0x5643('0x35')][_0x5643('0x53')](_0x401d7a[_0x5643('0x54')],{})[_0x5643('0x2f')](function(_0x127534){var _0x256704=_0x401d7a['user'][_0x5643('0x55')]({'plain':!![]});if(!_0x256704)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x256704[_0x5643('0x56')]===_0x5643('0x57')){var _0x5768ae=_0x127534[_0x5643('0x55')]({'plain':!![]});var _0x526a12=_0x5643('0x58');return db[_0x5643('0x59')][_0x5643('0x51')]({'where':{'name':_0x526a12,'userProfileId':_0x256704[_0x5643('0x5a')]},'raw':!![]})[_0x5643('0x2f')](function(_0x26a477){if(_0x26a477&&_0x26a477[_0x5643('0x5b')]===0x0){return db[_0x5643('0x5c')][_0x5643('0x53')]({'name':_0x5768ae['name'],'resourceId':_0x5768ae['id'],'type':_0x26a477[_0x5643('0x31')],'sectionId':_0x26a477['id']},{})[_0x5643('0x2f')](function(){return _0x127534;});}else{return _0x127534;}})[_0x5643('0x52')](function(_0x392f71){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x392f71);throw _0x392f71;});}return _0x127534;})[_0x5643('0x2f')](respondWithResult(_0x4cb9c6,0xc9))[_0x5643('0x52')](handleError(_0x4cb9c6,null));};exports[_0x5643('0x2e')]=function(_0x46ef36,_0xa48f2b){if(_0x46ef36[_0x5643('0x54')]['id']){delete _0x46ef36[_0x5643('0x54')]['id'];}return db['Team'][_0x5643('0x51')]({'where':{'id':_0x46ef36[_0x5643('0x4c')]['id']}})[_0x5643('0x2f')](handleEntityNotFound(_0xa48f2b,null))['then'](saveUpdates(_0x46ef36[_0x5643('0x54')],null))['then'](respondWithResult(_0xa48f2b,null))[_0x5643('0x52')](handleError(_0xa48f2b,null));};exports[_0x5643('0x5d')]=function(_0x48ac6f,_0x580c75){var _0x56e6ab=_0x48ac6f[_0x5643('0x4c')]['id'];var _0x4f5952=[];return db['sequelize'][_0x5643('0x5e')](function(_0x36032b){var _0x14659b='SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20'+_0x56e6ab;return db[_0x5643('0x5f')][_0x5643('0x3b')](_0x14659b,{'type':db[_0x5643('0x60')][_0x5643('0x61')][_0x5643('0x62')],'raw':!![],'transaction':_0x36032b})['then'](function(_0x2befda){_0x4f5952=_[_0x5643('0x34')](_0x2befda,function(_0x36d14f){return Number(_0x36d14f[_0x5643('0x63')]);});})[_0x5643('0x2f')](function(){var _0x4e302e='SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20'+_0x56e6ab;return db[_0x5643('0x5f')][_0x5643('0x3b')](_0x4e302e,{'type':db['Sequelize'][_0x5643('0x61')][_0x5643('0x62')],'raw':!![],'transaction':_0x36032b});})['then'](function(_0x5b6071){var _0x2f55ea=_[_0x5643('0x34')](_0x5b6071,function(_0x231117){return Number(_0x231117[_0x5643('0x64')]);});return db[_0x5643('0x65')][_0x5643('0x5d')]({'where':{'UserId':{'$in':_0x4f5952},'VoiceQueueId':{'$in':_0x2f55ea}},'transaction':_0x36032b});})[_0x5643('0x2f')](function(){var _0x3d209b=_0x5643('0x66')+_0x56e6ab;return db[_0x5643('0x5f')]['query'](_0x3d209b,{'type':db[_0x5643('0x60')][_0x5643('0x61')][_0x5643('0x62')],'raw':!![],'transaction':_0x36032b});})[_0x5643('0x2f')](function(_0x42422f){var _0x4706f4=_['map'](_0x42422f,function(_0x3c3a41){return Number(_0x3c3a41['MailQueueId']);});return db[_0x5643('0x67')][_0x5643('0x5d')]({'where':{'UserId':{'$in':_0x4f5952},'MailQueueId':{'$in':_0x4706f4}},'transaction':_0x36032b});})[_0x5643('0x2f')](function(){var _0x59bec4=_0x5643('0x68')+_0x56e6ab;return db[_0x5643('0x5f')]['query'](_0x59bec4,{'type':db[_0x5643('0x60')][_0x5643('0x61')]['SELECT'],'raw':!![],'transaction':_0x36032b});})['then'](function(_0x2654ac){var _0x5ef656=_[_0x5643('0x34')](_0x2654ac,function(_0x1fc569){return Number(_0x1fc569[_0x5643('0x69')]);});return db['UserSmsQueue'][_0x5643('0x5d')]({'where':{'UserId':{'$in':_0x4f5952},'SmsQueueId':{'$in':_0x5ef656}},'transaction':_0x36032b});})[_0x5643('0x2f')](function(){var _0x3e95df=_0x5643('0x6a')+_0x56e6ab;return db[_0x5643('0x5f')][_0x5643('0x3b')](_0x3e95df,{'type':db[_0x5643('0x60')]['QueryTypes'][_0x5643('0x62')],'raw':!![],'transaction':_0x36032b});})['then'](function(_0x2aeec1){var _0x331444=_[_0x5643('0x34')](_0x2aeec1,function(_0x2a0bd6){return Number(_0x2a0bd6[_0x5643('0x6b')]);});return db[_0x5643('0x6c')]['destroy']({'where':{'UserId':{'$in':_0x4f5952},'ChatQueueId':{'$in':_0x331444}},'transaction':_0x36032b});})[_0x5643('0x2f')](function(){var _0xfc3e6d=_0x5643('0x6d')+_0x56e6ab;return db['sequelize'][_0x5643('0x3b')](_0xfc3e6d,{'type':db[_0x5643('0x60')]['QueryTypes'][_0x5643('0x62')],'raw':!![],'transaction':_0x36032b});})['then'](function(_0x12ea3a){var _0x50d13c=_[_0x5643('0x34')](_0x12ea3a,function(_0x27e484){return Number(_0x27e484['FaxQueueId']);});return db[_0x5643('0x6e')][_0x5643('0x5d')]({'where':{'UserId':{'$in':_0x4f5952},'FaxQueueId':{'$in':_0x50d13c}},'transaction':_0x36032b});})[_0x5643('0x2f')](function(){var _0x51b203=_0x5643('0x6f')+_0x56e6ab;return db[_0x5643('0x5f')][_0x5643('0x3b')](_0x51b203,{'type':db[_0x5643('0x60')][_0x5643('0x61')][_0x5643('0x62')],'raw':!![],'transaction':_0x36032b});})[_0x5643('0x2f')](function(_0x2e72d6){var _0x146142=_[_0x5643('0x34')](_0x2e72d6,function(_0x2521db){return Number(_0x2521db[_0x5643('0x70')]);});return db['UserOpenchannelQueue'][_0x5643('0x5d')]({'where':{'UserId':{'$in':_0x4f5952},'OpenchannelQueueId':{'$in':_0x146142}},'transaction':_0x36032b});})[_0x5643('0x2f')](function(){var _0x58a2c2='SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20'+_0x56e6ab;return db['sequelize'][_0x5643('0x3b')](_0x58a2c2,{'type':db['Sequelize']['QueryTypes'][_0x5643('0x62')],'raw':!![],'transaction':_0x36032b});})[_0x5643('0x2f')](function(_0x25a854){var _0x481975=_['map'](_0x25a854,function(_0x1f15c3){return Number(_0x1f15c3[_0x5643('0x71')]);});return db[_0x5643('0x72')][_0x5643('0x5d')]({'where':{'UserId':{'$in':_0x4f5952},'WhatsappQueueId':{'$in':_0x481975}},'transaction':_0x36032b});})['then'](function(){return db[_0x5643('0x73')][_0x5643('0x51')]({'where':{'TeamId':_0x56e6ab}});})[_0x5643('0x2f')](function(_0x48fc35){if(_0x48fc35===null){return;}return db[_0x5643('0x74')][_0x5643('0x5d')]({'where':{'UserId':{'$in':_0x4f5952},'VoicePrefixId':_0x48fc35[_0x5643('0x75')]},'transaction':_0x36032b});})[_0x5643('0x2f')](function(){return db['Team'][_0x5643('0x5d')]({'where':{'id':_0x56e6ab},'cascade':!![],'transaction':_0x36032b});})[_0x5643('0x2f')](function(_0x403f3e){if(_0x403f3e===0x0){_0x580c75[_0x5643('0x21')](0x194);}else{return db[_0x5643('0x5c')][_0x5643('0x5d')]({'where':{'type':_0x5643('0x58'),'resourceId':_0x56e6ab},'cascade':!![],'transaction':_0x36032b})['then'](function(){_0x580c75['status'](0xcc)[_0x5643('0x23')]();});}})[_0x5643('0x52')](function(_0x136a49){_0x580c75[_0x5643('0x22')](0x1f4)[_0x5643('0x32')](_0x136a49);});});};exports['getQueues']=function(_0x2038a,_0x1c14b3,_0x3190cc){return db[_0x5643('0x35')][_0x5643('0x76')]({'where':{'id':_0x2038a['params']['id']}})[_0x5643('0x2f')](handleEntityNotFound(_0x1c14b3,null))[_0x5643('0x2f')](function(_0x471466){if(!_0x2038a[_0x5643('0x3b')][_0x5643('0x77')]||!utils[_0x5643('0x78')](_0x2038a[_0x5643('0x3b')]['channel'])){throw new db[(_0x5643('0x60'))]['ValidationError'](_0x5643('0x79'));}var _0x4817bc={};var _0x531b79={};_0x531b79[_0x5643('0x3a')]=_[_0x5643('0x3c')](db[_[_0x5643('0x7a')](_0x2038a[_0x5643('0x3b')]['channel']['toLowerCase']())+_0x5643('0x7b')]['rawAttributes']);_0x531b79[_0x5643('0x3b')]=_['keys'](_0x2038a[_0x5643('0x3b')]);_0x531b79[_0x5643('0x43')]=_[_0x5643('0x4d')](_0x531b79[_0x5643('0x3a')],_0x531b79['query']);_0x4817bc[_0x5643('0x3d')]=_[_0x5643('0x4d')](_0x531b79[_0x5643('0x3a')],qs[_0x5643('0x4e')](_0x2038a['query'][_0x5643('0x4e')]));_0x4817bc['attributes']=_0x4817bc[_0x5643('0x3d')][_0x5643('0x3e')]?_0x4817bc[_0x5643('0x3d')]:_0x531b79[_0x5643('0x3a')];_0x4817bc[_0x5643('0x28')]=qs[_0x5643('0x28')](_0x2038a[_0x5643('0x3b')][_0x5643('0x28')]);_0x4817bc[_0x5643('0x27')]=qs['offset'](_0x2038a[_0x5643('0x3b')][_0x5643('0x27')]);_0x4817bc[_0x5643('0x41')]=qs[_0x5643('0x42')](_0x2038a[_0x5643('0x3b')][_0x5643('0x42')]);_0x4817bc[_0x5643('0x46')]=qs[_0x5643('0x43')](_[_0x5643('0x44')](_0x2038a[_0x5643('0x3b')],_0x531b79['filters']));_0x4817bc=_[_0x5643('0x50')]({},_0x4817bc,_0x2038a[_0x5643('0x48')]);return _0x471466[_0x5643('0x55')+_[_0x5643('0x7a')](_0x2038a[_0x5643('0x3b')][_0x5643('0x77')][_0x5643('0x7c')]())+_0x5643('0x7d')](_0x4817bc);})[_0x5643('0x2f')](respondWithResult(_0x1c14b3,null))['catch'](handleError(_0x1c14b3,null));};exports[_0x5643('0x7e')]=function(_0x15d743,_0x1cb38d,_0x347a2c){return db['Team']['findOne']({'where':{'id':_0x15d743[_0x5643('0x4c')]['id']}})[_0x5643('0x2f')](function(_0x93e2a){if(_0x93e2a){if(!_0x15d743[_0x5643('0x54')]['channel']||!utils[_0x5643('0x78')](_0x15d743[_0x5643('0x54')]['channel'])){throw new db['Sequelize'][(_0x5643('0x7f'))](_0x5643('0x79'));}return _0x93e2a[_0x5643('0x80')+_[_0x5643('0x7a')](_0x15d743[_0x5643('0x54')][_0x5643('0x77')]['toLowerCase']())+_0x5643('0x7d')](_0x15d743[_0x5643('0x54')][_0x5643('0x81')]);}return null;})[_0x5643('0x2f')](handleEntityNotFound(_0x1cb38d,null))[_0x5643('0x2f')](respondWithStatusCode(_0x1cb38d,null))[_0x5643('0x52')](handleError(_0x1cb38d,null));};exports[_0x5643('0x82')]=function(_0x529374,_0x46b917,_0x520e0e){return db[_0x5643('0x35')][_0x5643('0x76')]({'where':{'id':_0x529374['params']['id']}})[_0x5643('0x2f')](function(_0x4bf269){if(_0x4bf269){if(!_0x529374[_0x5643('0x3b')][_0x5643('0x77')]||!utils[_0x5643('0x78')](_0x529374['query']['channel'])){throw new db[(_0x5643('0x60'))][(_0x5643('0x7f'))](_0x5643('0x79'));}return _0x4bf269[_0x5643('0x83')+_['capitalize'](_0x529374['query'][_0x5643('0x77')]['toLowerCase']())+_0x5643('0x7d')](_0x529374[_0x5643('0x3b')][_0x5643('0x81')]);}return null;})[_0x5643('0x2f')](handleEntityNotFound(_0x46b917,null))[_0x5643('0x2f')](respondWithStatusCode(_0x46b917,null))[_0x5643('0x52')](handleError(_0x46b917,null));};exports[_0x5643('0x84')]=function(_0x4bc00e,_0x4317fc){var _0x5d001c=_[_0x5643('0x85')](_0x4bc00e['body'][_0x5643('0x81')])?_0x4bc00e[_0x5643('0x54')][_0x5643('0x81')]:[_0x4bc00e['body'][_0x5643('0x81')]];var _0x483207=_0x4bc00e[_0x5643('0x4c')]['id'];return db[_0x5643('0x35')][_0x5643('0x51')]({'where':{'id':_0x483207}})[_0x5643('0x2f')](handleEntityNotFound(_0x4317fc,null))['then'](function(_0xe69508){if(_0xe69508){var _0x50b68d=[_0x5643('0x86'),_0x5643('0x87'),_0x5643('0x88'),'Sms',_0x5643('0x89'),_0x5643('0x8a'),_0x5643('0x8b')];return db[_0x5643('0x5f')]['transaction'](function(_0x3aa399){var _0x421e5d=_[_0x5643('0x34')](_0x50b68d,function(_0x1cb4ab){var _0x1b9299={'attributes':['id','name']};if(_0x1cb4ab==='Voice'){_0x1b9299[_0x5643('0x8c')]={'attributes':[_0x5643('0x8d')]};}return _0xe69508[_0x5643('0x55')+_0x1cb4ab+_0x5643('0x7d')](_0x1b9299)[_0x5643('0x2f')](function(_0xc70fe0){var _0x77dd1b=_['map'](_0xc70fe0,function(_0x3901c9){var _0x523deb=_[_0x5643('0x34')](_0x5d001c,function(_0x55b711){var _0x56f328={'where':{'UserId':_0x55b711,[_0x1cb4ab+_0x5643('0x8e')]:_0x3901c9['id']},'transaction':_0x3aa399};if(_0x1cb4ab==='Voice'){_0x56f328[_0x5643('0x1c')]={'penalty':_0x3901c9[_0x5643('0x8f')][_0x5643('0x8d')]};}return db[_0x5643('0x90')+_0x1cb4ab+_0x5643('0x7b')]['findOrCreate'](_0x56f328)['then'](function(){socket[_0x5643('0x91')](_0x5643('0x57')+_0x1cb4ab+_0x5643('0x92'),{'UserId':_0x55b711,[_0x1cb4ab+_0x5643('0x8e')]:_0x3901c9['id']});if(_0x1cb4ab!=='Voice'){return;}return db['User'][_0x5643('0x4a')]({'where':{'id':_0x5d001c,'online':0x1},'attributes':['id',_0x5643('0x31'),_0x5643('0x93'),_0x5643('0x94'),_0x5643('0x95')],'raw':!![]})[_0x5643('0x2f')](function(_0x2494dd){var _0x3d911a=_['map'](_0x2494dd,function(_0x4736a1){return db[_0x5643('0x96')][_0x5643('0x97')]({'membername':_0x4736a1[_0x5643('0x31')],'UserId':_0x4736a1['id'],'queue_name':_0x3901c9['name'],'VoiceQueueId':_0x3901c9['id'],'interface':_[_0x5643('0x98')](_0x4736a1[_0x5643('0x95')])?util[_0x5643('0x99')](_0x5643('0x9a'),_0x4736a1[_0x5643('0x31')]):_0x4736a1['interface'],'paused':_0x4736a1[_0x5643('0x94')]||![],'penalty':_0x3901c9[_0x5643('0x8f')][_0x5643('0x8d')]},{'transaction':_0x3aa399});});return Promise[_0x5643('0x9b')](_0x3d911a);});});});return Promise[_0x5643('0x9b')](_0x523deb);});return Promise[_0x5643('0x9b')](_0x77dd1b);})[_0x5643('0x2f')](function(){return db[_0x5643('0x73')]['findOne']({'where':{'teamId':_0x483207}})['then'](function(_0x234292){if(_0x234292){var _0x4f58e6=_[_0x5643('0x34')](_0x5d001c,function(_0x55452f){db['UserVoicePrefix'][_0x5643('0x97')]({'UserId':_0x55452f,'VoicePrefixId':_0x234292[_0x5643('0x75')]});});return Promise[_0x5643('0x9b')](_0x4f58e6);}});});});return Promise['all'](_0x421e5d)[_0x5643('0x2f')](function(){return _0xe69508[_0x5643('0x84')](_0x5d001c,{'transaction':_0x3aa399})[_0x5643('0x9c')](function(_0xd441ba){return _0xd441ba;});});});}})[_0x5643('0x2f')](respondWithResult(_0x4317fc,null))[_0x5643('0x52')](handleError(_0x4317fc,null));};exports[_0x5643('0x9d')]=function(_0x5aeff1,_0x5390ac){var _0x4aae77=_[_0x5643('0x85')](_0x5aeff1[_0x5643('0x3b')][_0x5643('0x81')])?_0x5aeff1[_0x5643('0x3b')][_0x5643('0x81')]:[_0x5aeff1['query'][_0x5643('0x81')]];var _0x40ce33=_0x5aeff1[_0x5643('0x4c')]['id'];return db[_0x5643('0x35')][_0x5643('0x51')]({'where':{'id':_0x40ce33}})[_0x5643('0x2f')](handleEntityNotFound(_0x5390ac,null))['then'](function(_0x8b7de7){if(_0x8b7de7){var _0x5e043b=[_0x5643('0x86'),'Chat',_0x5643('0x88'),_0x5643('0x9e'),'Fax',_0x5643('0x8a'),_0x5643('0x8b')];return db[_0x5643('0x5f')][_0x5643('0x5e')](function(_0x364f9f){var _0x93f4ea=_['map'](_0x5e043b,function(_0x5ef413){var _0x4f911e={'attributes':['id',_0x5643('0x31')]};return _0x8b7de7[_0x5643('0x55')+_0x5ef413+_0x5643('0x7d')](_0x4f911e)[_0x5643('0x2f')](function(_0x2933d0){var _0x1066e9=_['map'](_0x2933d0,function(_0x353895){return _0x353895[_0x5643('0x9d')](_0x4aae77,{'transaction':_0x364f9f})['then'](function(){var _0x2a6a48=_[_0x5643('0x34')](_0x4aae77,function(_0x2bccba){socket[_0x5643('0x91')](_0x5643('0x57')+_0x5ef413+_0x5643('0x9f'),{'UserId':Number(_0x2bccba),[_0x5ef413+_0x5643('0x8e')]:_0x353895['id']});if(_0x5ef413!==_0x5643('0x86')){return;}return db['UserVoiceQueueRt']['destroy']({'where':{'VoiceQueueId':_0x353895['id'],'UserId':_0x2bccba},'transaction':_0x364f9f});});return Promise[_0x5643('0x9b')](_0x2a6a48);});});return Promise[_0x5643('0x9b')](_0x1066e9);});});return Promise[_0x5643('0x9b')](_0x93f4ea)[_0x5643('0x2f')](function(){return _0x8b7de7[_0x5643('0x9d')](_0x4aae77,{'transaction':_0x364f9f});})[_0x5643('0x2f')](function(){return db[_0x5643('0x73')][_0x5643('0x76')]({'where':{'teamId':_0x40ce33}})['then'](function(_0x14acbb){if(_0x14acbb){var _0x51d1fb=_[_0x5643('0x34')](_0x4aae77,function(_0x33e67d){db[_0x5643('0x74')][_0x5643('0x5d')]({'where':{'UserId':_0x33e67d,'VoicePrefixId':_0x14acbb[_0x5643('0x75')]}});});return Promise[_0x5643('0x9b')](_0x51d1fb);}});});});}})[_0x5643('0x2f')](respondWithStatusCode(_0x5390ac,null))[_0x5643('0x52')](handleError(_0x5390ac,null));};exports[_0x5643('0xa0')]=function(_0x5bfad8,_0x61d6e2,_0xfda2af){var _0x4d7cfa={};var _0x3eda05={};var _0x57d175;var _0x4b9b98;return db[_0x5643('0x35')][_0x5643('0x76')]({'where':{'id':_0x5bfad8[_0x5643('0x4c')]['id']}})[_0x5643('0x2f')](handleEntityNotFound(_0x61d6e2,null))[_0x5643('0x2f')](function(_0xfaffbe){if(_0xfaffbe){_0x57d175=_0xfaffbe;_0x3eda05[_0x5643('0x3a')]=_[_0x5643('0x3c')](db[_0x5643('0x90')][_0x5643('0x36')]);_0x3eda05[_0x5643('0x3b')]=_[_0x5643('0x3c')](_0x5bfad8[_0x5643('0x3b')]);_0x3eda05[_0x5643('0x43')]=_[_0x5643('0x4d')](_0x3eda05[_0x5643('0x3a')],_0x3eda05[_0x5643('0x3b')]);_0x4d7cfa[_0x5643('0x3d')]=_[_0x5643('0x4d')](_0x3eda05[_0x5643('0x3a')],qs[_0x5643('0x4e')](_0x5bfad8['query'][_0x5643('0x4e')]));_0x4d7cfa[_0x5643('0x3d')]=_0x4d7cfa[_0x5643('0x3d')]['length']?_0x4d7cfa[_0x5643('0x3d')]:_0x3eda05[_0x5643('0x3a')];_0x4d7cfa[_0x5643('0x41')]=qs[_0x5643('0x42')](_0x5bfad8[_0x5643('0x3b')]['sort']);_0x4d7cfa['where']=qs[_0x5643('0x43')](_[_0x5643('0x44')](_0x5bfad8['query'],_0x3eda05['filters']));if(_0x5bfad8[_0x5643('0x3b')]['filter']){_0x4d7cfa[_0x5643('0x46')]=_['merge'](_0x4d7cfa[_0x5643('0x46')],{'$or':_[_0x5643('0x34')](_0x4d7cfa['attributes'],function(_0x4aa42d){var _0xab9708={};_0xab9708[_0x4aa42d]={'$like':'%'+_0x5bfad8[_0x5643('0x3b')][_0x5643('0x45')]+'%'};return _0xab9708;})});}_0x4d7cfa=_[_0x5643('0x50')]({},_0x4d7cfa,_0x5bfad8[_0x5643('0x48')]);return _0x57d175[_0x5643('0xa0')](_0x4d7cfa);}})[_0x5643('0x2f')](function(_0x37f3ce){if(_0x37f3ce){_0x4b9b98=_0x37f3ce[_0x5643('0x3e')];if(!_0x5bfad8[_0x5643('0x3b')][_0x5643('0x3f')](_0x5643('0x40'))){_0x4d7cfa[_0x5643('0x28')]=qs[_0x5643('0x28')](_0x5bfad8[_0x5643('0x3b')][_0x5643('0x28')]);_0x4d7cfa['offset']=qs[_0x5643('0x27')](_0x5bfad8[_0x5643('0x3b')][_0x5643('0x27')]);}return _0x57d175[_0x5643('0xa0')](_0x4d7cfa);}})[_0x5643('0x2f')](function(_0x18468e){if(_0x18468e){return _0x18468e?{'count':_0x4b9b98,'rows':_0x18468e}:null;}})[_0x5643('0x2f')](respondWithResult(_0x61d6e2,null))[_0x5643('0x52')](handleError(_0x61d6e2,null));}; \ No newline at end of file +var _0x5a47=['localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','map','Team','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','hasOwnProperty','nolimit','sort','where','merge','filter','options','count','includeAll','findAll','show','keys','fields','length','include','find','catch','create','user','get','role','Teams','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','body','sequelize','SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20','SELECT','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','Sequelize','VoiceQueueId','UserVoiceQueue','destroy','SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20','MailQueueId','SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20','SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20','QueryTypes','ChatQueueId','SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20','FaxQueueId','UserFaxQueue','OpenchannelQueueId','WhatsappQueueId','UserWhatsappQueue','TeamVoicePrefix','getQueues','channel','ValidationError','Queue','order','pick','toLowerCase','Queues','findOne','isValidChannel','Unknown\x20channel','add','capitalize','removeQueues','ids','addAgents','isArray','Voice','Chat','Mail','Sms','Fax','Whatsapp','transaction','QueueId','penalty','User','findOrCreate','voicePause','UserVoiceQueueRt','upsert','isNil','SIP/%s','interface','TeamVoiceQueue','all','UserVoicePrefix','VoicePrefixId','spread','removeAgents','Openchannel','emit','Queue:remove','getAgents','eml-format','fast-json-patch','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','redis','defaults'];(function(_0x2cc5c7,_0x1bcb0d){var _0x10a9e4=function(_0x321337){while(--_0x321337){_0x2cc5c7['push'](_0x2cc5c7['shift']());}};_0x10a9e4(++_0x1bcb0d);}(_0x5a47,0x1aa));var _0x75a4=function(_0x1bed6d,_0x14fa14){_0x1bed6d=_0x1bed6d-0x0;var _0x2042d6=_0x5a47[_0x1bed6d];return _0x2042d6;};'use strict';var emlformat=require(_0x75a4('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x75a4('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x75a4('0x2'));var Mustache=require(_0x75a4('0x3'));var util=require(_0x75a4('0x4'));var path=require('path');var sox=require(_0x75a4('0x5'));var csv=require('to-csv');var ejs=require(_0x75a4('0x6'));var fs=require('fs');var fs_extra=require(_0x75a4('0x7'));var _=require(_0x75a4('0x8'));var squel=require(_0x75a4('0x9'));var crypto=require('crypto');var jsforce=require(_0x75a4('0xa'));var deskjs=require(_0x75a4('0xb'));var toCsv=require(_0x75a4('0xc'));var querystring=require(_0x75a4('0xd'));var Papa=require(_0x75a4('0xe'));var Redis=require(_0x75a4('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x75a4('0x10'));var as=require(_0x75a4('0x11'));var hardwareService=require(_0x75a4('0x12'));var logger=require(_0x75a4('0x13'))('api');var utils=require(_0x75a4('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x75a4('0x15'));var db=require('../../mysqldb')['db'];config[_0x75a4('0x16')]=_[_0x75a4('0x17')](config['redis'],{'host':_0x75a4('0x18'),'port':0x18eb});var socket=require(_0x75a4('0x19'))(new Redis(config[_0x75a4('0x16')]));require('./team.socket')[_0x75a4('0x1a')](socket);function respondWithStatusCode(_0x3461f5,_0x250a7c){_0x250a7c=_0x250a7c||0xcc;return function(_0x4f1fb5){if(_0x4f1fb5){return _0x3461f5[_0x75a4('0x1b')](_0x250a7c);}return _0x3461f5[_0x75a4('0x1c')](_0x250a7c)[_0x75a4('0x1d')]();};}function respondWithResult(_0x12bff6,_0x33c98d){_0x33c98d=_0x33c98d||0xc8;return function(_0x31f780){if(_0x31f780){return _0x12bff6['status'](_0x33c98d)[_0x75a4('0x1e')](_0x31f780);}};}function respondWithFilteredResult(_0x43b8f7,_0x1667ab){return function(_0xac6dc2){if(_0xac6dc2){var _0x5ced51=typeof _0x1667ab[_0x75a4('0x1f')]===_0x75a4('0x20')&&typeof _0x1667ab['limit']==='undefined';var _0x1c68ad=_0xac6dc2['count'];var _0x2f0afd=_0x5ced51?0x0:_0x1667ab[_0x75a4('0x1f')];var _0x2768ff=_0x5ced51?_0xac6dc2['count']:_0x1667ab['offset']+_0x1667ab[_0x75a4('0x21')];var _0x1230d9;if(_0x2768ff>=_0x1c68ad){_0x2768ff=_0x1c68ad;_0x1230d9=0xc8;}else{_0x1230d9=0xce;}_0x43b8f7[_0x75a4('0x1c')](_0x1230d9);return _0x43b8f7[_0x75a4('0x22')](_0x75a4('0x23'),_0x2f0afd+'-'+_0x2768ff+'/'+_0x1c68ad)[_0x75a4('0x1e')](_0xac6dc2);}return null;};}function patchUpdates(_0xb41a4c){return function(_0x482ae9){try{jsonpatch[_0x75a4('0x24')](_0x482ae9,_0xb41a4c,!![]);}catch(_0x25f9b4){return BPromise[_0x75a4('0x25')](_0x25f9b4);}return _0x482ae9[_0x75a4('0x26')]();};}function saveUpdates(_0x4a8b20,_0x5c1dab){return function(_0x177166){if(_0x177166){return _0x177166[_0x75a4('0x27')](_0x4a8b20)[_0x75a4('0x28')](function(_0x44e27b){return _0x44e27b;});}return null;};}function handleEntityNotFound(_0x400fa1,_0x5d8e03){return function(_0x28c8e0){if(!_0x28c8e0){_0x400fa1[_0x75a4('0x1b')](0x194);}return _0x28c8e0;};}function handleError(_0x1209df,_0x110ae0){_0x110ae0=_0x110ae0||0x1f4;return function(_0x4b4b5a){logger[_0x75a4('0x29')](_0x4b4b5a[_0x75a4('0x2a')]);if(_0x4b4b5a[_0x75a4('0x2b')]){delete _0x4b4b5a[_0x75a4('0x2b')];}_0x1209df['status'](_0x110ae0)[_0x75a4('0x2c')](_0x4b4b5a);};}exports[_0x75a4('0x2d')]=function(_0x25d95b,_0x4b1e11){var _0x25c274={},_0x4f86ca={},_0x25ceb6={'count':0x0,'rows':[]};var _0xa9857=_[_0x75a4('0x2e')](db[_0x75a4('0x2f')][_0x75a4('0x30')],function(_0xde2e17){return{'name':_0xde2e17[_0x75a4('0x31')],'type':_0xde2e17[_0x75a4('0x32')][_0x75a4('0x33')]};});_0x4f86ca['model']=_[_0x75a4('0x2e')](_0xa9857,'name');_0x4f86ca[_0x75a4('0x34')]=_['keys'](_0x25d95b[_0x75a4('0x34')]);_0x4f86ca[_0x75a4('0x35')]=_[_0x75a4('0x36')](_0x4f86ca[_0x75a4('0x37')],_0x4f86ca[_0x75a4('0x34')]);_0x25c274[_0x75a4('0x38')]=_[_0x75a4('0x36')](_0x4f86ca[_0x75a4('0x37')],qs['fields'](_0x25d95b[_0x75a4('0x34')]['fields']));_0x25c274[_0x75a4('0x38')]=_0x25c274[_0x75a4('0x38')]['length']?_0x25c274['attributes']:_0x4f86ca[_0x75a4('0x37')];if(!_0x25d95b[_0x75a4('0x34')][_0x75a4('0x39')](_0x75a4('0x3a'))){_0x25c274[_0x75a4('0x21')]=qs[_0x75a4('0x21')](_0x25d95b['query'][_0x75a4('0x21')]);_0x25c274[_0x75a4('0x1f')]=qs[_0x75a4('0x1f')](_0x25d95b[_0x75a4('0x34')][_0x75a4('0x1f')]);}_0x25c274['order']=qs[_0x75a4('0x3b')](_0x25d95b[_0x75a4('0x34')][_0x75a4('0x3b')]);_0x25c274['where']=qs[_0x75a4('0x35')](_['pick'](_0x25d95b[_0x75a4('0x34')],_0x4f86ca[_0x75a4('0x35')]),_0xa9857);if(_0x25d95b[_0x75a4('0x34')]['filter']){_0x25c274[_0x75a4('0x3c')]=_[_0x75a4('0x3d')](_0x25c274[_0x75a4('0x3c')],{'$or':_[_0x75a4('0x2e')](_0xa9857,function(_0x1b2c8a){if(_0x1b2c8a[_0x75a4('0x32')]!=='VIRTUAL'){var _0x48b1d7={};_0x48b1d7[_0x1b2c8a['name']]={'$like':'%'+_0x25d95b[_0x75a4('0x34')][_0x75a4('0x3e')]+'%'};return _0x48b1d7;}})});}_0x25c274=_[_0x75a4('0x3d')]({},_0x25c274,_0x25d95b[_0x75a4('0x3f')]);var _0x281b69={'where':_0x25c274[_0x75a4('0x3c')]};return db[_0x75a4('0x2f')][_0x75a4('0x40')](_0x281b69)['then'](function(_0x34491c){_0x25ceb6[_0x75a4('0x40')]=_0x34491c;if(_0x25d95b[_0x75a4('0x34')][_0x75a4('0x41')]){_0x25c274['include']=[{'all':!![]}];}return db[_0x75a4('0x2f')][_0x75a4('0x42')](_0x25c274);})['then'](function(_0x2ae79f){_0x25ceb6['rows']=_0x2ae79f;return _0x25ceb6;})['then'](respondWithFilteredResult(_0x4b1e11,_0x25c274))['catch'](handleError(_0x4b1e11,null));};exports[_0x75a4('0x43')]=function(_0x56af33,_0x4c6a9e){var _0x2b1243={'raw':![],'where':{'id':_0x56af33['params']['id']}},_0x16e4a5={};_0x16e4a5[_0x75a4('0x37')]=_[_0x75a4('0x44')](db[_0x75a4('0x2f')][_0x75a4('0x30')]);_0x16e4a5[_0x75a4('0x34')]=_['keys'](_0x56af33[_0x75a4('0x34')]);_0x16e4a5[_0x75a4('0x35')]=_[_0x75a4('0x36')](_0x16e4a5[_0x75a4('0x37')],_0x16e4a5[_0x75a4('0x34')]);_0x2b1243[_0x75a4('0x38')]=_[_0x75a4('0x36')](_0x16e4a5['model'],qs['fields'](_0x56af33[_0x75a4('0x34')][_0x75a4('0x45')]));_0x2b1243[_0x75a4('0x38')]=_0x2b1243[_0x75a4('0x38')][_0x75a4('0x46')]?_0x2b1243[_0x75a4('0x38')]:_0x16e4a5[_0x75a4('0x37')];if(_0x56af33[_0x75a4('0x34')][_0x75a4('0x41')]){_0x2b1243[_0x75a4('0x47')]=[{'all':!![]}];}_0x2b1243=_[_0x75a4('0x3d')]({},_0x2b1243,_0x56af33[_0x75a4('0x3f')]);return db['Team'][_0x75a4('0x48')](_0x2b1243)[_0x75a4('0x28')](handleEntityNotFound(_0x4c6a9e,null))[_0x75a4('0x28')](respondWithResult(_0x4c6a9e,null))[_0x75a4('0x49')](handleError(_0x4c6a9e,null));};exports[_0x75a4('0x4a')]=function(_0x2d7600,_0x494580){return db[_0x75a4('0x2f')][_0x75a4('0x4a')](_0x2d7600['body'],{})[_0x75a4('0x28')](function(_0x1cbf33){var _0x2fbfca=_0x2d7600[_0x75a4('0x4b')][_0x75a4('0x4c')]({'plain':!![]});if(!_0x2fbfca)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2fbfca[_0x75a4('0x4d')]===_0x75a4('0x4b')){var _0x3ed209=_0x1cbf33[_0x75a4('0x4c')]({'plain':!![]});var _0x348f65=_0x75a4('0x4e');return db['UserProfileSection']['find']({'where':{'name':_0x348f65,'userProfileId':_0x2fbfca[_0x75a4('0x4f')]},'raw':!![]})[_0x75a4('0x28')](function(_0x146db3){if(_0x146db3&&_0x146db3[_0x75a4('0x50')]===0x0){return db[_0x75a4('0x51')]['create']({'name':_0x3ed209[_0x75a4('0x2b')],'resourceId':_0x3ed209['id'],'type':_0x146db3[_0x75a4('0x2b')],'sectionId':_0x146db3['id']},{})[_0x75a4('0x28')](function(){return _0x1cbf33;});}else{return _0x1cbf33;}})[_0x75a4('0x49')](function(_0x4d2242){logger['error'](_0x75a4('0x52'),_0x4d2242);throw _0x4d2242;});}return _0x1cbf33;})[_0x75a4('0x28')](respondWithResult(_0x494580,0xc9))[_0x75a4('0x49')](handleError(_0x494580,null));};exports['update']=function(_0x38074f,_0x30144d){if(_0x38074f['body']['id']){delete _0x38074f['body']['id'];}return db[_0x75a4('0x2f')]['find']({'where':{'id':_0x38074f[_0x75a4('0x53')]['id']}})[_0x75a4('0x28')](handleEntityNotFound(_0x30144d,null))[_0x75a4('0x28')](saveUpdates(_0x38074f[_0x75a4('0x54')],null))['then'](respondWithResult(_0x30144d,null))['catch'](handleError(_0x30144d,null));};exports['destroy']=function(_0x43285d,_0x1c307f){var _0x54e494=_0x43285d[_0x75a4('0x53')]['id'];var _0x1eb97b=[];return db[_0x75a4('0x55')]['transaction'](function(_0x4658ca){var _0xbb22f3=_0x75a4('0x56')+_0x54e494;return db[_0x75a4('0x55')][_0x75a4('0x34')](_0xbb22f3,{'type':db['Sequelize']['QueryTypes'][_0x75a4('0x57')],'raw':!![],'transaction':_0x4658ca})[_0x75a4('0x28')](function(_0x30a5c5){_0x1eb97b=_[_0x75a4('0x2e')](_0x30a5c5,function(_0xffc439){return Number(_0xffc439['UserId']);});})['then'](function(){var _0x325acc=_0x75a4('0x58')+_0x54e494;return db[_0x75a4('0x55')][_0x75a4('0x34')](_0x325acc,{'type':db[_0x75a4('0x59')]['QueryTypes'][_0x75a4('0x57')],'raw':!![],'transaction':_0x4658ca});})[_0x75a4('0x28')](function(_0x599c9e){var _0x4e8069=_['map'](_0x599c9e,function(_0x4ae951){return Number(_0x4ae951[_0x75a4('0x5a')]);});return db[_0x75a4('0x5b')][_0x75a4('0x5c')]({'where':{'UserId':{'$in':_0x1eb97b},'VoiceQueueId':{'$in':_0x4e8069}},'transaction':_0x4658ca});})[_0x75a4('0x28')](function(){var _0x5daaab=_0x75a4('0x5d')+_0x54e494;return db[_0x75a4('0x55')][_0x75a4('0x34')](_0x5daaab,{'type':db['Sequelize']['QueryTypes'][_0x75a4('0x57')],'raw':!![],'transaction':_0x4658ca});})['then'](function(_0x515e5b){var _0x57b32a=_[_0x75a4('0x2e')](_0x515e5b,function(_0x2baa89){return Number(_0x2baa89[_0x75a4('0x5e')]);});return db['UserMailQueue'][_0x75a4('0x5c')]({'where':{'UserId':{'$in':_0x1eb97b},'MailQueueId':{'$in':_0x57b32a}},'transaction':_0x4658ca});})['then'](function(){var _0x236373=_0x75a4('0x5f')+_0x54e494;return db['sequelize']['query'](_0x236373,{'type':db[_0x75a4('0x59')]['QueryTypes'][_0x75a4('0x57')],'raw':!![],'transaction':_0x4658ca});})['then'](function(_0xdfc9f8){var _0x3139ce=_[_0x75a4('0x2e')](_0xdfc9f8,function(_0x419c41){return Number(_0x419c41['SmsQueueId']);});return db['UserSmsQueue'][_0x75a4('0x5c')]({'where':{'UserId':{'$in':_0x1eb97b},'SmsQueueId':{'$in':_0x3139ce}},'transaction':_0x4658ca});})[_0x75a4('0x28')](function(){var _0x291bf9=_0x75a4('0x60')+_0x54e494;return db[_0x75a4('0x55')][_0x75a4('0x34')](_0x291bf9,{'type':db['Sequelize'][_0x75a4('0x61')]['SELECT'],'raw':!![],'transaction':_0x4658ca});})[_0x75a4('0x28')](function(_0x2adfb7){var _0x5214e7=_[_0x75a4('0x2e')](_0x2adfb7,function(_0x59dd8c){return Number(_0x59dd8c[_0x75a4('0x62')]);});return db['UserChatQueue'][_0x75a4('0x5c')]({'where':{'UserId':{'$in':_0x1eb97b},'ChatQueueId':{'$in':_0x5214e7}},'transaction':_0x4658ca});})[_0x75a4('0x28')](function(){var _0x3442df=_0x75a4('0x63')+_0x54e494;return db['sequelize'][_0x75a4('0x34')](_0x3442df,{'type':db[_0x75a4('0x59')][_0x75a4('0x61')]['SELECT'],'raw':!![],'transaction':_0x4658ca});})[_0x75a4('0x28')](function(_0x5db57b){var _0x4ee513=_[_0x75a4('0x2e')](_0x5db57b,function(_0x2d0d99){return Number(_0x2d0d99[_0x75a4('0x64')]);});return db[_0x75a4('0x65')][_0x75a4('0x5c')]({'where':{'UserId':{'$in':_0x1eb97b},'FaxQueueId':{'$in':_0x4ee513}},'transaction':_0x4658ca});})[_0x75a4('0x28')](function(){var _0x486366='SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20'+_0x54e494;return db[_0x75a4('0x55')][_0x75a4('0x34')](_0x486366,{'type':db[_0x75a4('0x59')][_0x75a4('0x61')]['SELECT'],'raw':!![],'transaction':_0x4658ca});})[_0x75a4('0x28')](function(_0xaa296c){var _0x53abc0=_[_0x75a4('0x2e')](_0xaa296c,function(_0x57fd37){return Number(_0x57fd37[_0x75a4('0x66')]);});return db['UserOpenchannelQueue']['destroy']({'where':{'UserId':{'$in':_0x1eb97b},'OpenchannelQueueId':{'$in':_0x53abc0}},'transaction':_0x4658ca});})[_0x75a4('0x28')](function(){var _0x18fab5='SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20'+_0x54e494;return db[_0x75a4('0x55')]['query'](_0x18fab5,{'type':db[_0x75a4('0x59')][_0x75a4('0x61')]['SELECT'],'raw':!![],'transaction':_0x4658ca});})['then'](function(_0xa56625){var _0x5ccc6d=_[_0x75a4('0x2e')](_0xa56625,function(_0x34e255){return Number(_0x34e255[_0x75a4('0x67')]);});return db[_0x75a4('0x68')][_0x75a4('0x5c')]({'where':{'UserId':{'$in':_0x1eb97b},'WhatsappQueueId':{'$in':_0x5ccc6d}},'transaction':_0x4658ca});})['then'](function(){return db[_0x75a4('0x69')][_0x75a4('0x48')]({'where':{'TeamId':_0x54e494}});})[_0x75a4('0x28')](function(_0x568de1){if(_0x568de1===null){return;}return db['UserVoicePrefix'][_0x75a4('0x5c')]({'where':{'UserId':{'$in':_0x1eb97b},'VoicePrefixId':_0x568de1['VoicePrefixId']},'transaction':_0x4658ca});})['then'](function(){return db['Team'][_0x75a4('0x5c')]({'where':{'id':_0x54e494},'cascade':!![],'transaction':_0x4658ca});})[_0x75a4('0x28')](function(_0x300f2a){if(_0x300f2a===0x0){_0x1c307f['sendStatus'](0x194);}else{return db['UserProfileResource'][_0x75a4('0x5c')]({'where':{'type':_0x75a4('0x4e'),'resourceId':_0x54e494},'cascade':!![],'transaction':_0x4658ca})[_0x75a4('0x28')](function(){_0x1c307f[_0x75a4('0x1c')](0xcc)[_0x75a4('0x1d')]();});}})['catch'](function(_0x505e54){_0x1c307f[_0x75a4('0x1c')](0x1f4)[_0x75a4('0x2c')](_0x505e54);});});};exports[_0x75a4('0x6a')]=function(_0xfbc298,_0x41f360,_0x50bdf5){return db[_0x75a4('0x2f')]['findOne']({'where':{'id':_0xfbc298['params']['id']}})['then'](handleEntityNotFound(_0x41f360,null))['then'](function(_0x131b8d){if(!_0xfbc298[_0x75a4('0x34')]['channel']||!utils['isValidChannel'](_0xfbc298[_0x75a4('0x34')][_0x75a4('0x6b')])){throw new db[(_0x75a4('0x59'))][(_0x75a4('0x6c'))]('Unknown\x20channel');}var _0x4a75a3={};var _0x36f71d={};_0x36f71d[_0x75a4('0x37')]=_[_0x75a4('0x44')](db[_['capitalize'](_0xfbc298['query'][_0x75a4('0x6b')]['toLowerCase']())+_0x75a4('0x6d')][_0x75a4('0x30')]);_0x36f71d[_0x75a4('0x34')]=_[_0x75a4('0x44')](_0xfbc298[_0x75a4('0x34')]);_0x36f71d[_0x75a4('0x35')]=_[_0x75a4('0x36')](_0x36f71d[_0x75a4('0x37')],_0x36f71d[_0x75a4('0x34')]);_0x4a75a3[_0x75a4('0x38')]=_['intersection'](_0x36f71d[_0x75a4('0x37')],qs[_0x75a4('0x45')](_0xfbc298[_0x75a4('0x34')][_0x75a4('0x45')]));_0x4a75a3[_0x75a4('0x38')]=_0x4a75a3[_0x75a4('0x38')][_0x75a4('0x46')]?_0x4a75a3[_0x75a4('0x38')]:_0x36f71d[_0x75a4('0x37')];_0x4a75a3[_0x75a4('0x21')]=qs[_0x75a4('0x21')](_0xfbc298[_0x75a4('0x34')][_0x75a4('0x21')]);_0x4a75a3[_0x75a4('0x1f')]=qs['offset'](_0xfbc298[_0x75a4('0x34')]['offset']);_0x4a75a3[_0x75a4('0x6e')]=qs['sort'](_0xfbc298[_0x75a4('0x34')][_0x75a4('0x3b')]);_0x4a75a3[_0x75a4('0x3c')]=qs[_0x75a4('0x35')](_[_0x75a4('0x6f')](_0xfbc298[_0x75a4('0x34')],_0x36f71d[_0x75a4('0x35')]));_0x4a75a3=_[_0x75a4('0x3d')]({},_0x4a75a3,_0xfbc298[_0x75a4('0x3f')]);return _0x131b8d[_0x75a4('0x4c')+_['capitalize'](_0xfbc298['query'][_0x75a4('0x6b')][_0x75a4('0x70')]())+_0x75a4('0x71')](_0x4a75a3);})[_0x75a4('0x28')](respondWithResult(_0x41f360,null))[_0x75a4('0x49')](handleError(_0x41f360,null));};exports['addQueues']=function(_0x2b2ab1,_0x7170ae,_0x4345b3){return db[_0x75a4('0x2f')][_0x75a4('0x72')]({'where':{'id':_0x2b2ab1[_0x75a4('0x53')]['id']}})['then'](function(_0x21d944){if(_0x21d944){if(!_0x2b2ab1[_0x75a4('0x54')][_0x75a4('0x6b')]||!utils[_0x75a4('0x73')](_0x2b2ab1[_0x75a4('0x54')]['channel'])){throw new db['Sequelize'][(_0x75a4('0x6c'))](_0x75a4('0x74'));}return _0x21d944[_0x75a4('0x75')+_[_0x75a4('0x76')](_0x2b2ab1['body'][_0x75a4('0x6b')][_0x75a4('0x70')]())+'Queues'](_0x2b2ab1[_0x75a4('0x54')]['ids']);}return null;})[_0x75a4('0x28')](handleEntityNotFound(_0x7170ae,null))['then'](respondWithStatusCode(_0x7170ae,null))[_0x75a4('0x49')](handleError(_0x7170ae,null));};exports[_0x75a4('0x77')]=function(_0x236956,_0x16abf5,_0x3eb365){return db[_0x75a4('0x2f')][_0x75a4('0x72')]({'where':{'id':_0x236956[_0x75a4('0x53')]['id']}})[_0x75a4('0x28')](function(_0x4c42f7){if(_0x4c42f7){if(!_0x236956[_0x75a4('0x34')][_0x75a4('0x6b')]||!utils[_0x75a4('0x73')](_0x236956['query'][_0x75a4('0x6b')])){throw new db[(_0x75a4('0x59'))][(_0x75a4('0x6c'))](_0x75a4('0x74'));}return _0x4c42f7['remove'+_['capitalize'](_0x236956[_0x75a4('0x34')][_0x75a4('0x6b')]['toLowerCase']())+'Queues'](_0x236956[_0x75a4('0x34')][_0x75a4('0x78')]);}return null;})[_0x75a4('0x28')](handleEntityNotFound(_0x16abf5,null))[_0x75a4('0x28')](respondWithStatusCode(_0x16abf5,null))['catch'](handleError(_0x16abf5,null));};exports[_0x75a4('0x79')]=function(_0x1667af,_0x40cd0c){var _0x4c7179=_[_0x75a4('0x7a')](_0x1667af[_0x75a4('0x54')][_0x75a4('0x78')])?_0x1667af[_0x75a4('0x54')][_0x75a4('0x78')]:[_0x1667af[_0x75a4('0x54')][_0x75a4('0x78')]];var _0x3d6b5f=_0x1667af[_0x75a4('0x53')]['id'];return db[_0x75a4('0x2f')][_0x75a4('0x48')]({'where':{'id':_0x3d6b5f}})['then'](handleEntityNotFound(_0x40cd0c,null))[_0x75a4('0x28')](function(_0x21b8d4){if(_0x21b8d4){var _0x4344dd=[_0x75a4('0x7b'),_0x75a4('0x7c'),_0x75a4('0x7d'),_0x75a4('0x7e'),_0x75a4('0x7f'),'Openchannel',_0x75a4('0x80')];return db['sequelize'][_0x75a4('0x81')](function(_0xc10d55){var _0x3ee53d=_[_0x75a4('0x2e')](_0x4344dd,function(_0x359687){var _0x5bc1e8={'attributes':['id',_0x75a4('0x2b')]};if(_0x359687==='Voice'){_0x5bc1e8['through']={'attributes':['penalty']};}return _0x21b8d4[_0x75a4('0x4c')+_0x359687+'Queues'](_0x5bc1e8)[_0x75a4('0x28')](function(_0x535404){var _0x765ba5=_[_0x75a4('0x2e')](_0x535404,function(_0x42ac43){var _0x2c6e=_['map'](_0x4c7179,function(_0x51c0a5){var _0x4fdbc1={'where':{'UserId':_0x51c0a5,[_0x359687+_0x75a4('0x82')]:_0x42ac43['id']},'transaction':_0xc10d55};if(_0x359687===_0x75a4('0x7b')){_0x4fdbc1[_0x75a4('0x17')]={'penalty':_0x42ac43['TeamVoiceQueue'][_0x75a4('0x83')]};}return db[_0x75a4('0x84')+_0x359687+_0x75a4('0x6d')][_0x75a4('0x85')](_0x4fdbc1)['then'](function(){socket['emit'](_0x75a4('0x4b')+_0x359687+'Queue:save',{'UserId':_0x51c0a5,[_0x359687+'QueueId']:_0x42ac43['id']});if(_0x359687!==_0x75a4('0x7b')){return;}return db[_0x75a4('0x84')]['findAll']({'where':{'id':_0x4c7179,'online':0x1},'attributes':['id','name','online',_0x75a4('0x86'),'interface'],'raw':!![]})[_0x75a4('0x28')](function(_0x2fee47){var _0x3a0f33=_[_0x75a4('0x2e')](_0x2fee47,function(_0x256a0d){return db[_0x75a4('0x87')][_0x75a4('0x88')]({'membername':_0x256a0d['name'],'UserId':_0x256a0d['id'],'queue_name':_0x42ac43[_0x75a4('0x2b')],'VoiceQueueId':_0x42ac43['id'],'interface':_[_0x75a4('0x89')](_0x256a0d['interface'])?util['format'](_0x75a4('0x8a'),_0x256a0d[_0x75a4('0x2b')]):_0x256a0d[_0x75a4('0x8b')],'paused':_0x256a0d[_0x75a4('0x86')]||![],'penalty':_0x42ac43[_0x75a4('0x8c')]['penalty']},{'transaction':_0xc10d55});});return Promise[_0x75a4('0x8d')](_0x3a0f33);});});});return Promise['all'](_0x2c6e);});return Promise[_0x75a4('0x8d')](_0x765ba5);})[_0x75a4('0x28')](function(){return db[_0x75a4('0x69')][_0x75a4('0x72')]({'where':{'teamId':_0x3d6b5f}})[_0x75a4('0x28')](function(_0x5b8c4f){if(_0x5b8c4f){var _0x12c30f=_['map'](_0x4c7179,function(_0x2c5340){db[_0x75a4('0x8e')][_0x75a4('0x88')]({'UserId':_0x2c5340,'VoicePrefixId':_0x5b8c4f[_0x75a4('0x8f')]});});return Promise[_0x75a4('0x8d')](_0x12c30f);}});});});return Promise[_0x75a4('0x8d')](_0x3ee53d)[_0x75a4('0x28')](function(){return _0x21b8d4[_0x75a4('0x79')](_0x4c7179,{'transaction':_0xc10d55})[_0x75a4('0x90')](function(_0xc32e80){return _0xc32e80;});});});}})[_0x75a4('0x28')](respondWithResult(_0x40cd0c,null))[_0x75a4('0x49')](handleError(_0x40cd0c,null));};exports[_0x75a4('0x91')]=function(_0x450d50,_0x2fa6a5){var _0x58f54f=_[_0x75a4('0x7a')](_0x450d50[_0x75a4('0x34')]['ids'])?_0x450d50[_0x75a4('0x34')][_0x75a4('0x78')]:[_0x450d50[_0x75a4('0x34')]['ids']];var _0x9af7c0=_0x450d50[_0x75a4('0x53')]['id'];return db[_0x75a4('0x2f')][_0x75a4('0x48')]({'where':{'id':_0x9af7c0}})[_0x75a4('0x28')](handleEntityNotFound(_0x2fa6a5,null))[_0x75a4('0x28')](function(_0x3d4e00){if(_0x3d4e00){var _0x1a3746=['Voice','Chat',_0x75a4('0x7d'),_0x75a4('0x7e'),_0x75a4('0x7f'),_0x75a4('0x92'),'Whatsapp'];return db['sequelize'][_0x75a4('0x81')](function(_0x55bf83){var _0x3c767f=_['map'](_0x1a3746,function(_0x91ffda){var _0x5d00c0={'attributes':['id',_0x75a4('0x2b')]};return _0x3d4e00[_0x75a4('0x4c')+_0x91ffda+_0x75a4('0x71')](_0x5d00c0)[_0x75a4('0x28')](function(_0x209ccc){var _0x4d746f=_[_0x75a4('0x2e')](_0x209ccc,function(_0x253b05){return _0x253b05[_0x75a4('0x91')](_0x58f54f,{'transaction':_0x55bf83})[_0x75a4('0x28')](function(){var _0x29c28e=_['map'](_0x58f54f,function(_0xba3b7){socket[_0x75a4('0x93')](_0x75a4('0x4b')+_0x91ffda+_0x75a4('0x94'),{'UserId':Number(_0xba3b7),[_0x91ffda+_0x75a4('0x82')]:_0x253b05['id']});if(_0x91ffda!==_0x75a4('0x7b')){return;}return db[_0x75a4('0x87')][_0x75a4('0x5c')]({'where':{'VoiceQueueId':_0x253b05['id'],'UserId':_0xba3b7},'transaction':_0x55bf83});});return Promise[_0x75a4('0x8d')](_0x29c28e);});});return Promise[_0x75a4('0x8d')](_0x4d746f);});});return Promise[_0x75a4('0x8d')](_0x3c767f)['then'](function(){return _0x3d4e00[_0x75a4('0x91')](_0x58f54f,{'transaction':_0x55bf83});})[_0x75a4('0x28')](function(){return db[_0x75a4('0x69')][_0x75a4('0x72')]({'where':{'teamId':_0x9af7c0}})['then'](function(_0x2b89de){if(_0x2b89de){var _0x3451c9=_[_0x75a4('0x2e')](_0x58f54f,function(_0xe1cb55){db[_0x75a4('0x8e')][_0x75a4('0x5c')]({'where':{'UserId':_0xe1cb55,'VoicePrefixId':_0x2b89de[_0x75a4('0x8f')]}});});return Promise[_0x75a4('0x8d')](_0x3451c9);}});});});}})['then'](respondWithStatusCode(_0x2fa6a5,null))[_0x75a4('0x49')](handleError(_0x2fa6a5,null));};exports['getAgents']=function(_0x3bf953,_0x112202,_0x4a2a08){var _0x37b5bb={};var _0x118daf={};var _0x1826bd;var _0x529087;return db['Team'][_0x75a4('0x72')]({'where':{'id':_0x3bf953['params']['id']}})[_0x75a4('0x28')](handleEntityNotFound(_0x112202,null))['then'](function(_0x59e89c){if(_0x59e89c){_0x1826bd=_0x59e89c;_0x118daf[_0x75a4('0x37')]=_[_0x75a4('0x44')](db['User']['rawAttributes']);_0x118daf['query']=_[_0x75a4('0x44')](_0x3bf953[_0x75a4('0x34')]);_0x118daf[_0x75a4('0x35')]=_[_0x75a4('0x36')](_0x118daf[_0x75a4('0x37')],_0x118daf[_0x75a4('0x34')]);_0x37b5bb[_0x75a4('0x38')]=_[_0x75a4('0x36')](_0x118daf[_0x75a4('0x37')],qs[_0x75a4('0x45')](_0x3bf953['query'][_0x75a4('0x45')]));_0x37b5bb['attributes']=_0x37b5bb[_0x75a4('0x38')][_0x75a4('0x46')]?_0x37b5bb[_0x75a4('0x38')]:_0x118daf['model'];_0x37b5bb['order']=qs['sort'](_0x3bf953[_0x75a4('0x34')][_0x75a4('0x3b')]);_0x37b5bb['where']=qs[_0x75a4('0x35')](_[_0x75a4('0x6f')](_0x3bf953['query'],_0x118daf['filters']));if(_0x3bf953[_0x75a4('0x34')][_0x75a4('0x3e')]){_0x37b5bb['where']=_[_0x75a4('0x3d')](_0x37b5bb[_0x75a4('0x3c')],{'$or':_[_0x75a4('0x2e')](_0x37b5bb[_0x75a4('0x38')],function(_0x2d7559){var _0x5c48ce={};_0x5c48ce[_0x2d7559]={'$like':'%'+_0x3bf953[_0x75a4('0x34')][_0x75a4('0x3e')]+'%'};return _0x5c48ce;})});}_0x37b5bb=_[_0x75a4('0x3d')]({},_0x37b5bb,_0x3bf953[_0x75a4('0x3f')]);return _0x1826bd[_0x75a4('0x95')](_0x37b5bb);}})['then'](function(_0x4f931e){if(_0x4f931e){_0x529087=_0x4f931e[_0x75a4('0x46')];if(!_0x3bf953[_0x75a4('0x34')]['hasOwnProperty'](_0x75a4('0x3a'))){_0x37b5bb['limit']=qs[_0x75a4('0x21')](_0x3bf953[_0x75a4('0x34')]['limit']);_0x37b5bb[_0x75a4('0x1f')]=qs['offset'](_0x3bf953[_0x75a4('0x34')]['offset']);}return _0x1826bd[_0x75a4('0x95')](_0x37b5bb);}})[_0x75a4('0x28')](function(_0x38436b){if(_0x38436b){return _0x38436b?{'count':_0x529087,'rows':_0x38436b}:null;}})[_0x75a4('0x28')](respondWithResult(_0x112202,null))[_0x75a4('0x49')](handleError(_0x112202,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index f9d96c4..cfe763f 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 _0x6696=['save','update','remove','hasOwnProperty','hook','events','../../mysqldb','Team'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x6696,0x155));var _0x6669=function(_0x4914e2,_0x48be8f){_0x4914e2=_0x4914e2-0x0;var _0x2dcd07=_0x6696[_0x4914e2];return _0x2dcd07;};'use strict';var EventEmitter=require(_0x6669('0x0'));var Team=require(_0x6669('0x1'))['db'][_0x6669('0x2')];var TeamEvents=new EventEmitter();TeamEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x6669('0x3'),'afterUpdate':_0x6669('0x4'),'afterDestroy':_0x6669('0x5')};function emitEvent(_0x5e4cb8){return function(_0x5bb362,_0x5f53aa,_0x31cf14){TeamEvents['emit'](_0x5e4cb8+':'+_0x5bb362['id'],_0x5bb362);TeamEvents['emit'](_0x5e4cb8,_0x5bb362);_0x31cf14(null);};}for(var e in events){if(events[_0x6669('0x6')](e)){var event=events[e];Team[_0x6669('0x7')](e,emitEvent(event));}}module['exports']=TeamEvents; \ No newline at end of file +var _0x1a0e=['save','remove','emit','hasOwnProperty','exports','../../mysqldb','setMaxListeners'];(function(_0x1fbb2b,_0x2a7fbd){var _0x29acf2=function(_0x5a6196){while(--_0x5a6196){_0x1fbb2b['push'](_0x1fbb2b['shift']());}};_0x29acf2(++_0x2a7fbd);}(_0x1a0e,0xbb));var _0xe1a0=function(_0x51b698,_0x2fd161){_0x51b698=_0x51b698-0x0;var _0xfa0590=_0x1a0e[_0x51b698];return _0xfa0590;};'use strict';var EventEmitter=require('events');var Team=require(_0xe1a0('0x0'))['db']['Team'];var TeamEvents=new EventEmitter();TeamEvents[_0xe1a0('0x1')](0x0);var events={'afterCreate':_0xe1a0('0x2'),'afterUpdate':'update','afterDestroy':_0xe1a0('0x3')};function emitEvent(_0x22c878){return function(_0x1bfde7,_0x152b0f,_0x4e4306){TeamEvents[_0xe1a0('0x4')](_0x22c878+':'+_0x1bfde7['id'],_0x1bfde7);TeamEvents[_0xe1a0('0x4')](_0x22c878,_0x1bfde7);_0x4e4306(null);};}for(var e in events){if(events[_0xe1a0('0x5')](e)){var event=events[e];Team['hook'](e,emitEvent(event));}}module[_0xe1a0('0x6')]=TeamEvents; \ No newline at end of file diff --git a/server/api/team/team.model.js b/server/api/team/team.model.js index 2fbc511..2cc8f76 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 _0x3925=['setDataValue','exports','define','Team','teams','Chat','Fax','Mail','Openchannel','Voice','resolve','then','all','catch','lodash','./team.attributes','get','Queues','map'];(function(_0x30584a,_0x43c31c){var _0x39532d=function(_0xeff0d4){while(--_0xeff0d4){_0x30584a['push'](_0x30584a['shift']());}};_0x39532d(++_0x43c31c);}(_0x3925,0x6d));var _0x5392=function(_0x233186,_0x896f00){_0x233186=_0x233186-0x0;var _0x7ef0d0=_0x3925[_0x233186];return _0x7ef0d0;};'use strict';var _=require(_0x5392('0x0'));var attributes=require(_0x5392('0x1'));function getQueuesByChannel(_0xffba49,_0x4899bb){var _0x58f9d9=_0x5392('0x2')+_0x4899bb+_0x5392('0x3');return _0xffba49[_0x58f9d9]()['then'](function(_0x3ac31c){return _[_0x5392('0x4')](_0x3ac31c,function(_0x5a4561){_0x5a4561[_0x5392('0x5')]('channel',_0x4899bb);return _0x5a4561;});})['catch'](function(_0x49c948){throw _0x49c948;});}module[_0x5392('0x6')]=function(_0x1fa843){return _0x1fa843[_0x5392('0x7')](_0x5392('0x8'),attributes,{'tableName':_0x5392('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x33a677=this;var _0x5ac6ff=[_0x5392('0xa'),_0x5392('0xb'),_0x5392('0xc'),_0x5392('0xd'),'Sms',_0x5392('0xe'),'Whatsapp'];return Promise[_0x5392('0xf')]()[_0x5392('0x10')](function(){var _0x438f00=_[_0x5392('0x4')](_0x5ac6ff,function(_0x47827f){return getQueuesByChannel(_0x33a677,_0x47827f);});return Promise[_0x5392('0x11')](_0x438f00);})[_0x5392('0x12')](function(_0x3799e2){throw _0x3799e2;});}}});}; \ No newline at end of file +var _0x12ad=['map','setDataValue','define','Team','teams','Fax','Mail','Sms','Voice','Whatsapp','resolve','all','catch','lodash','./team.attributes','get','then'];(function(_0x24bade,_0x211808){var _0x5cbbd5=function(_0x53535f){while(--_0x53535f){_0x24bade['push'](_0x24bade['shift']());}};_0x5cbbd5(++_0x211808);}(_0x12ad,0x1a5));var _0xd12a=function(_0x2cefd2,_0x3eed48){_0x2cefd2=_0x2cefd2-0x0;var _0x528537=_0x12ad[_0x2cefd2];return _0x528537;};'use strict';var _=require(_0xd12a('0x0'));var attributes=require(_0xd12a('0x1'));function getQueuesByChannel(_0x171d1d,_0x307679){var _0x49a830=_0xd12a('0x2')+_0x307679+'Queues';return _0x171d1d[_0x49a830]()[_0xd12a('0x3')](function(_0x27fa27){return _[_0xd12a('0x4')](_0x27fa27,function(_0xc8b0ea){_0xc8b0ea[_0xd12a('0x5')]('channel',_0x307679);return _0xc8b0ea;});})['catch'](function(_0x2fdf5a){throw _0x2fdf5a;});}module['exports']=function(_0x553413){return _0x553413[_0xd12a('0x6')](_0xd12a('0x7'),attributes,{'tableName':_0xd12a('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0xd1096d=this;var _0x449b5d=['Chat',_0xd12a('0x9'),_0xd12a('0xa'),'Openchannel',_0xd12a('0xb'),_0xd12a('0xc'),_0xd12a('0xd')];return Promise[_0xd12a('0xe')]()[_0xd12a('0x3')](function(){var _0x35b0b1=_[_0xd12a('0x4')](_0x449b5d,function(_0x279db7){return getQueuesByChannel(_0xd1096d,_0x279db7);});return Promise[_0xd12a('0xf')](_0x35b0b1);})[_0xd12a('0x10')](function(_0x5b64eb){throw _0x5b64eb;});}}});}; \ No newline at end of file diff --git a/server/api/team/team.rpc.js b/server/api/team/team.rpc.js index 25c72f9..a40c0c4 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 _0x0c9c=['localhost','./team.socket','register','request','info','debug','Team,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','Team,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0x0c9c,0x188));var _0xc0c9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0c9c[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xc0c9('0x0'));var util=require(_0xc0c9('0x1'));var moment=require(_0xc0c9('0x2'));var BPromise=require(_0xc0c9('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc0c9('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xc0c9('0x5'));var logger=require(_0xc0c9('0x6'))(_0xc0c9('0x7'));var config=require(_0xc0c9('0x8'));var jayson=require(_0xc0c9('0x9'));var client=jayson[_0xc0c9('0xa')][_0xc0c9('0xb')]({'port':0x232a});config[_0xc0c9('0xc')]=_[_0xc0c9('0xd')](config[_0xc0c9('0xc')],{'host':_0xc0c9('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc0c9('0xc')]));require(_0xc0c9('0xf'))[_0xc0c9('0x10')](socket);function respondWithRpcPromise(_0x2425cf,_0x55f57a,_0x1c409d){return new BPromise(function(_0xe9b883,_0x56fcce){return client[_0xc0c9('0x11')](_0x2425cf,_0x1c409d)['then'](function(_0x17ed3d){logger[_0xc0c9('0x12')]('Team,\x20%s,\x20%s',_0x55f57a,'request\x20sent');logger[_0xc0c9('0x13')](_0xc0c9('0x14'),_0x55f57a,_0xc0c9('0x15'),JSON[_0xc0c9('0x16')](_0x17ed3d));if(_0x17ed3d[_0xc0c9('0x17')]){if(_0x17ed3d[_0xc0c9('0x17')][_0xc0c9('0x18')]===0x1f4){logger[_0xc0c9('0x17')]('Team,\x20%s,\x20%s',_0x55f57a,_0x17ed3d['error'][_0xc0c9('0x19')]);return _0x56fcce(_0x17ed3d[_0xc0c9('0x17')][_0xc0c9('0x19')]);}logger[_0xc0c9('0x17')]('Team,\x20%s,\x20%s',_0x55f57a,_0x17ed3d[_0xc0c9('0x17')][_0xc0c9('0x19')]);return _0xe9b883(_0x17ed3d[_0xc0c9('0x17')][_0xc0c9('0x19')]);}else{logger['info'](_0xc0c9('0x1a'),_0x55f57a,_0xc0c9('0x15'));_0xe9b883(_0x17ed3d[_0xc0c9('0x1b')][_0xc0c9('0x19')]);}})[_0xc0c9('0x1c')](function(_0xf0327d){logger[_0xc0c9('0x17')](_0xc0c9('0x1a'),_0x55f57a,_0xf0327d);_0x56fcce(_0xf0327d);});});} \ No newline at end of file +var _0xfe55=['defaults','localhost','socket.io-emitter','./team.socket','info','Team,\x20%s,\x20%s','request\x20sent','debug','Team,\x20%s,\x20%s,\x20%s','error','code','message','result','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xfe55,0x9d));var _0x5fe5=function(_0x402c8f,_0x30cc1d){_0x402c8f=_0x402c8f-0x0;var _0x11e809=_0xfe55[_0x402c8f];return _0x11e809;};'use strict';var _=require('lodash');var util=require(_0x5fe5('0x0'));var moment=require(_0x5fe5('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5fe5('0x2'));var db=require(_0x5fe5('0x3'))['db'];var utils=require(_0x5fe5('0x4'));var logger=require(_0x5fe5('0x5'))(_0x5fe5('0x6'));var config=require(_0x5fe5('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x5fe5('0x8')][_0x5fe5('0x9')]({'port':0x232a});config[_0x5fe5('0xa')]=_[_0x5fe5('0xb')](config[_0x5fe5('0xa')],{'host':_0x5fe5('0xc'),'port':0x18eb});var socket=require(_0x5fe5('0xd'))(new Redis(config[_0x5fe5('0xa')]));require(_0x5fe5('0xe'))['register'](socket);function respondWithRpcPromise(_0x655c6a,_0x13a201,_0x21987b){return new BPromise(function(_0x59918d,_0x5d6532){return client['request'](_0x655c6a,_0x21987b)['then'](function(_0xac0d65){logger[_0x5fe5('0xf')](_0x5fe5('0x10'),_0x13a201,_0x5fe5('0x11'));logger[_0x5fe5('0x12')](_0x5fe5('0x13'),_0x13a201,'request\x20sent',JSON['stringify'](_0xac0d65));if(_0xac0d65[_0x5fe5('0x14')]){if(_0xac0d65[_0x5fe5('0x14')][_0x5fe5('0x15')]===0x1f4){logger['error'](_0x5fe5('0x10'),_0x13a201,_0xac0d65[_0x5fe5('0x14')]['message']);return _0x5d6532(_0xac0d65[_0x5fe5('0x14')][_0x5fe5('0x16')]);}logger['error']('Team,\x20%s,\x20%s',_0x13a201,_0xac0d65[_0x5fe5('0x14')]['message']);return _0x59918d(_0xac0d65['error'][_0x5fe5('0x16')]);}else{logger[_0x5fe5('0xf')](_0x5fe5('0x10'),_0x13a201,_0x5fe5('0x11'));_0x59918d(_0xac0d65[_0x5fe5('0x17')][_0x5fe5('0x16')]);}})['catch'](function(_0x204b8c){logger[_0x5fe5('0x14')]('Team,\x20%s,\x20%s',_0x13a201,_0x204b8c);_0x5d6532(_0x204b8c);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index 759c762..6e3c228 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 _0x6da1=['update','emit','removeListener','register','length','team:','save'];(function(_0x4e59de,_0x3d31bd){var _0x14b337=function(_0xe5ce1e){while(--_0xe5ce1e){_0x4e59de['push'](_0x4e59de['shift']());}};_0x14b337(++_0x3d31bd);}(_0x6da1,0x1b8));var _0x16da=function(_0x12a2a6,_0x374ff1){_0x12a2a6=_0x12a2a6-0x0;var _0x1754ae=_0x6da1[_0x12a2a6];return _0x1754ae;};'use strict';var TeamEvents=require('./team.events');var events=[_0x16da('0x0'),'remove',_0x16da('0x1')];function createListener(_0x202305,_0x4022ae){return function(_0x4c6c15){_0x4022ae[_0x16da('0x2')](_0x202305,_0x4c6c15);};}function removeListener(_0x2a27dc,_0x4990d9){return function(){TeamEvents[_0x16da('0x3')](_0x2a27dc,_0x4990d9);};}exports[_0x16da('0x4')]=function(_0x3058f2){for(var _0x57612f=0x0,_0x4aa4b0=events[_0x16da('0x5')];_0x57612f<_0x4aa4b0;_0x57612f++){var _0x9ced5c=events[_0x57612f];var _0x12df0e=createListener(_0x16da('0x6')+_0x9ced5c,_0x3058f2);TeamEvents['on'](_0x9ced5c,_0x12df0e);}}; \ No newline at end of file +var _0xc009=['update','emit','removeListener','register','length','./team.events','save'];(function(_0x5a5395,_0x5361f6){var _0x4da43d=function(_0x149941){while(--_0x149941){_0x5a5395['push'](_0x5a5395['shift']());}};_0x4da43d(++_0x5361f6);}(_0xc009,0xc9));var _0x9c00=function(_0x2523db,_0x5935c7){_0x2523db=_0x2523db-0x0;var _0x6fa64b=_0xc009[_0x2523db];return _0x6fa64b;};'use strict';var TeamEvents=require(_0x9c00('0x0'));var events=[_0x9c00('0x1'),'remove',_0x9c00('0x2')];function createListener(_0x45a262,_0x5a94dd){return function(_0x5c8be1){_0x5a94dd[_0x9c00('0x3')](_0x45a262,_0x5c8be1);};}function removeListener(_0x558af3,_0x429dba){return function(){TeamEvents[_0x9c00('0x4')](_0x558af3,_0x429dba);};}exports[_0x9c00('0x5')]=function(_0x3556b3){for(var _0x30aace=0x0,_0x54f6e4=events[_0x9c00('0x6')];_0x30aace<_0x54f6e4;_0x30aace++){var _0x558614=events[_0x30aace];var _0x1627e2=createListener('team:'+_0x558614,_0x3556b3);TeamEvents['on'](_0x558614,_0x1627e2);}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js b/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js index b6c99de..0e14301 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 _0x08e5=['exports','INTEGER','sequelize'];(function(_0x4fdfb3,_0x5956e3){var _0x4e0f0f=function(_0x191c60){while(--_0x191c60){_0x4fdfb3['push'](_0x4fdfb3['shift']());}};_0x4e0f0f(++_0x5956e3);}(_0x08e5,0x1a9));var _0x508e=function(_0x255d5b,_0x4f6f35){_0x255d5b=_0x255d5b-0x0;var _0x3e141a=_0x08e5[_0x255d5b];return _0x3e141a;};'use strict';var Sequelize=require(_0x508e('0x0'));module[_0x508e('0x1')]={'TeamId':{'type':Sequelize['INTEGER']},'VoicePrefixId':{'type':Sequelize[_0x508e('0x2')]}}; \ No newline at end of file +var _0xcc40=['INTEGER','sequelize'];(function(_0x68b042,_0x261e87){var _0x20c9be=function(_0x1d692b){while(--_0x1d692b){_0x68b042['push'](_0x68b042['shift']());}};_0x20c9be(++_0x261e87);}(_0xcc40,0x97));var _0x0cc4=function(_0x4aa9ed,_0x93e3a2){_0x4aa9ed=_0x4aa9ed-0x0;var _0x14c0a5=_0xcc40[_0x4aa9ed];return _0x14c0a5;};'use strict';var Sequelize=require(_0x0cc4('0x0'));module['exports']={'TeamId':{'type':Sequelize['INTEGER']},'VoicePrefixId':{'type':Sequelize[_0x0cc4('0x1')]}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.model.js b/server/api/teamVoicePrefix/teamVoicePrefix.model.js index 2fcf6eb..2cd2006 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 _0x8efc=['exports','TeamVoicePrefix','team_has_voice_prefixes','util','../../config/logger','api','moment','request-promise','path','rimraf','./teamVoicePrefix.attributes'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x8efc,0xb3));var _0xc8ef=function(_0x227cfb,_0x4f42cf){_0x227cfb=_0x227cfb-0x0;var _0x131407=_0x8efc[_0x227cfb];return _0x131407;};'use strict';var _=require('lodash');var util=require(_0xc8ef('0x0'));var logger=require(_0xc8ef('0x1'))(_0xc8ef('0x2'));var moment=require(_0xc8ef('0x3'));var BPromise=require('bluebird');var rp=require(_0xc8ef('0x4'));var fs=require('fs');var path=require(_0xc8ef('0x5'));var rimraf=require(_0xc8ef('0x6'));var config=require('../../config/environment');var attributes=require(_0xc8ef('0x7'));module[_0xc8ef('0x8')]=function(_0x1cd466,_0x13b433){return _0x1cd466['define'](_0xc8ef('0x9'),attributes,{'tableName':_0xc8ef('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb010=['rimraf','../../config/environment','./teamVoicePrefix.attributes','exports','define','TeamVoicePrefix','team_has_voice_prefixes','util','api','bluebird','path'];(function(_0x4b5933,_0x2f3f64){var _0x58c26f=function(_0x1929b8){while(--_0x1929b8){_0x4b5933['push'](_0x4b5933['shift']());}};_0x58c26f(++_0x2f3f64);}(_0xb010,0x8b));var _0x0b01=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xb010[_0x42cae2];return _0x5f256f;};'use strict';var _=require('lodash');var util=require(_0x0b01('0x0'));var logger=require('../../config/logger')(_0x0b01('0x1'));var moment=require('moment');var BPromise=require(_0x0b01('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0b01('0x3'));var rimraf=require(_0x0b01('0x4'));var config=require(_0x0b01('0x5'));var attributes=require(_0x0b01('0x6'));module[_0x0b01('0x7')]=function(_0x1eade9,_0x250f25){return _0x1eade9[_0x0b01('0x8')](_0x0b01('0x9'),attributes,{'tableName':_0x0b01('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 e54edcb..c26a1f1 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 _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x2a02be,_0x52b74c){var _0x47bb4b=function(_0x8e2478){while(--_0x8e2478){_0x2a02be['push'](_0x2a02be['shift']());}};_0x47bb4b(++_0x52b74c);}(_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(_0x4e4d4b,_0x3a85d4){var _0x7cd244=function(_0x4965ff){while(--_0x4965ff){_0x4e4d4b['push'](_0x4e4d4b['shift']());}};_0x7cd244(++_0x3a85d4);}(_0x70e0,0x17b));var _0x070e=function(_0x35ba87,_0xc7d66a){_0x35ba87=_0x35ba87-0x0;var _0x336d59=_0x70e0[_0x35ba87];return _0x336d59;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js b/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js index 9183192..c59f3a4 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 _0x22c0=['sequelize','exports'];(function(_0x525fc7,_0x13d6a9){var _0x97d47c=function(_0x32ca03){while(--_0x32ca03){_0x525fc7['push'](_0x525fc7['shift']());}};_0x97d47c(++_0x13d6a9);}(_0x22c0,0x1c4));var _0x022c=function(_0x4653f7,_0x3d3ae3){_0x4653f7=_0x4653f7-0x0;var _0x5454da=_0x22c0[_0x4653f7];return _0x5454da;};'use strict';var Sequelize=require(_0x022c('0x0'));module[_0x022c('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x937c=['sequelize','exports','INTEGER'];(function(_0x59a475,_0x4b607a){var _0x6695e7=function(_0x140809){while(--_0x140809){_0x59a475['push'](_0x59a475['shift']());}};_0x6695e7(++_0x4b607a);}(_0x937c,0x6c));var _0xc937=function(_0x519378,_0x6bec08){_0x519378=_0x519378-0x0;var _0x278456=_0x937c[_0x519378];return _0x278456;};'use strict';var Sequelize=require(_0xc937('0x0'));module[_0xc937('0x1')]={'penalty':{'type':Sequelize[_0xc937('0x2')],'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 d97c66e..944cc23 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 _0x3645=['TeamVoiceQueue','team_has_voice_queues','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./teamVoiceQueue.attributes','exports','define'];(function(_0x4880ff,_0x584169){var _0x4094d7=function(_0x4d66e3){while(--_0x4d66e3){_0x4880ff['push'](_0x4880ff['shift']());}};_0x4094d7(++_0x584169);}(_0x3645,0x154));var _0x5364=function(_0x1ae491,_0x5b83b9){_0x1ae491=_0x1ae491-0x0;var _0x4958a5=_0x3645[_0x1ae491];return _0x4958a5;};'use strict';var _=require('lodash');var util=require(_0x5364('0x0'));var logger=require(_0x5364('0x1'))(_0x5364('0x2'));var moment=require(_0x5364('0x3'));var BPromise=require(_0x5364('0x4'));var rp=require(_0x5364('0x5'));var fs=require('fs');var path=require(_0x5364('0x6'));var rimraf=require('rimraf');var config=require(_0x5364('0x7'));var attributes=require(_0x5364('0x8'));module[_0x5364('0x9')]=function(_0x1f9c6b,_0x417c44){return _0x1f9c6b[_0x5364('0xa')](_0x5364('0xb'),attributes,{'tableName':_0x5364('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x692c=['TeamVoiceQueue','team_has_voice_queues','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./teamVoiceQueue.attributes','exports'];(function(_0x56bf9f,_0x457fd0){var _0x29850c=function(_0xece461){while(--_0xece461){_0x56bf9f['push'](_0x56bf9f['shift']());}};_0x29850c(++_0x457fd0);}(_0x692c,0x6a));var _0xc692=function(_0x727995,_0x2f2d91){_0x727995=_0x727995-0x0;var _0x38458e=_0x692c[_0x727995];return _0x38458e;};'use strict';var _=require(_0xc692('0x0'));var util=require(_0xc692('0x1'));var logger=require(_0xc692('0x2'))(_0xc692('0x3'));var moment=require(_0xc692('0x4'));var BPromise=require(_0xc692('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc692('0x6'));var rimraf=require(_0xc692('0x7'));var config=require(_0xc692('0x8'));var attributes=require(_0xc692('0x9'));module[_0xc692('0xa')]=function(_0x1b54a9,_0x4f8759){return _0x1b54a9['define'](_0xc692('0xb'),attributes,{'tableName':_0xc692('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 23c0284..ce744a6 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 _0x5e61=['request\x20sent','debug','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','TeamVoiceQueue,\x20%s,\x20%s'];(function(_0x45a96c,_0x56ba3d){var _0x16cacc=function(_0x31630e){while(--_0x31630e){_0x45a96c['push'](_0x45a96c['shift']());}};_0x16cacc(++_0x56ba3d);}(_0x5e61,0xe2));var _0x15e6=function(_0x25d7fd,_0x7865e4){_0x25d7fd=_0x25d7fd-0x0;var _0x33b1ef=_0x5e61[_0x25d7fd];return _0x33b1ef;};'use strict';var _=require(_0x15e6('0x0'));var util=require(_0x15e6('0x1'));var moment=require('moment');var BPromise=require(_0x15e6('0x2'));var rs=require(_0x15e6('0x3'));var fs=require('fs');var Redis=require(_0x15e6('0x4'));var db=require(_0x15e6('0x5'))['db'];var utils=require(_0x15e6('0x6'));var logger=require(_0x15e6('0x7'))(_0x15e6('0x8'));var config=require(_0x15e6('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x15e6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x43d1fe,_0x4f926a,_0x5a2694){return new BPromise(function(_0x4bb14c,_0xbac773){return client[_0x15e6('0xb')](_0x43d1fe,_0x5a2694)[_0x15e6('0xc')](function(_0x254abc){logger['info'](_0x15e6('0xd'),_0x4f926a,_0x15e6('0xe'));logger[_0x15e6('0xf')](_0x15e6('0x10'),_0x4f926a,_0x15e6('0xe'),JSON[_0x15e6('0x11')](_0x254abc));if(_0x254abc[_0x15e6('0x12')]){if(_0x254abc['error'][_0x15e6('0x13')]===0x1f4){logger['error']('TeamVoiceQueue,\x20%s,\x20%s',_0x4f926a,_0x254abc['error']['message']);return _0xbac773(_0x254abc[_0x15e6('0x12')][_0x15e6('0x14')]);}logger[_0x15e6('0x12')](_0x15e6('0xd'),_0x4f926a,_0x254abc[_0x15e6('0x12')]['message']);return _0x4bb14c(_0x254abc[_0x15e6('0x12')][_0x15e6('0x14')]);}else{logger[_0x15e6('0x15')](_0x15e6('0xd'),_0x4f926a,_0x15e6('0xe'));_0x4bb14c(_0x254abc[_0x15e6('0x16')][_0x15e6('0x14')]);}})[_0x15e6('0x17')](function(_0x40b33f){logger[_0x15e6('0x12')](_0x15e6('0xd'),_0x4f926a,_0x40b33f);_0xbac773(_0x40b33f);});});} \ No newline at end of file +var _0x982c=['request\x20sent','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','util','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','request','then','info','TeamVoiceQueue,\x20%s,\x20%s'];(function(_0xec609d,_0x28de5b){var _0x5711c1=function(_0x59900c){while(--_0x59900c){_0xec609d['push'](_0xec609d['shift']());}};_0x5711c1(++_0x28de5b);}(_0x982c,0xd9));var _0xc982=function(_0x1600c3,_0x555b85){_0x1600c3=_0x1600c3-0x0;var _0x10f45d=_0x982c[_0x1600c3];return _0x10f45d;};'use strict';var _=require('lodash');var util=require(_0xc982('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xc982('0x1'));var fs=require('fs');var Redis=require(_0xc982('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xc982('0x3'));var logger=require(_0xc982('0x4'))(_0xc982('0x5'));var config=require('../../config/environment');var jayson=require(_0xc982('0x6'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1ce5ea,_0x55d698,_0x2dbf31){return new BPromise(function(_0x3545c1,_0x51974a){return client[_0xc982('0x7')](_0x1ce5ea,_0x2dbf31)[_0xc982('0x8')](function(_0xae94c8){logger[_0xc982('0x9')](_0xc982('0xa'),_0x55d698,_0xc982('0xb'));logger['debug'](_0xc982('0xc'),_0x55d698,_0xc982('0xb'),JSON[_0xc982('0xd')](_0xae94c8));if(_0xae94c8['error']){if(_0xae94c8['error'][_0xc982('0xe')]===0x1f4){logger[_0xc982('0xf')]('TeamVoiceQueue,\x20%s,\x20%s',_0x55d698,_0xae94c8[_0xc982('0xf')][_0xc982('0x10')]);return _0x51974a(_0xae94c8[_0xc982('0xf')]['message']);}logger[_0xc982('0xf')]('TeamVoiceQueue,\x20%s,\x20%s',_0x55d698,_0xae94c8[_0xc982('0xf')][_0xc982('0x10')]);return _0x3545c1(_0xae94c8[_0xc982('0xf')][_0xc982('0x10')]);}else{logger[_0xc982('0x9')](_0xc982('0xa'),_0x55d698,'request\x20sent');_0x3545c1(_0xae94c8[_0xc982('0x11')][_0xc982('0x10')]);}})[_0xc982('0x12')](function(_0x25a0fd){logger[_0xc982('0xf')](_0xc982('0xa'),_0x55d698,_0x25a0fd);_0x51974a(_0x25a0fd);});});} \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index 4e33e42..ad31b45 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 _0x89fb=['get','index','/:id','show','post','isAuthenticated','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./template.controller'];(function(_0x581af1,_0x4f02c5){var _0x54c22e=function(_0x5a7a5a){while(--_0x5a7a5a){_0x581af1['push'](_0x581af1['shift']());}};_0x54c22e(++_0x4f02c5);}(_0x89fb,0x14b));var _0xb89f=function(_0x4b99a7,_0x57a007){_0x4b99a7=_0x4b99a7-0x0;var _0x36aab0=_0x89fb[_0x4b99a7];return _0x36aab0;};'use strict';var multer=require('multer');var util=require(_0xb89f('0x0'));var path=require(_0xb89f('0x1'));var timeout=require(_0xb89f('0x2'));var express=require(_0xb89f('0x3'));var router=express[_0xb89f('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xb89f('0x5'));var interaction=require(_0xb89f('0x6'));var config=require(_0xb89f('0x7'));var controller=require(_0xb89f('0x8'));router[_0xb89f('0x9')]('/',auth['isAuthenticated'](),controller[_0xb89f('0xa')]);router['get'](_0xb89f('0xb'),auth['isAuthenticated'](),controller[_0xb89f('0xc')]);router[_0xb89f('0xd')]('/',auth[_0xb89f('0xe')](),controller['create']);router[_0xb89f('0xf')](_0xb89f('0xb'),auth[_0xb89f('0xe')](),controller[_0xb89f('0x10')]);router[_0xb89f('0x11')]('/:id',auth['isAuthenticated'](),controller[_0xb89f('0x12')]);module[_0xb89f('0x13')]=router; \ No newline at end of file +var _0xc43c=['update','delete','destroy','exports','multer','util','path','fs-extra','./template.controller','get','isAuthenticated','/:id','show','post','create','put'];(function(_0x51bb38,_0x4e57a0){var _0x51c09b=function(_0x3321e2){while(--_0x3321e2){_0x51bb38['push'](_0x51bb38['shift']());}};_0x51c09b(++_0x4e57a0);}(_0xc43c,0xd4));var _0xcc43=function(_0x2effc3,_0x49988c){_0x2effc3=_0x2effc3-0x0;var _0x56d065=_0xc43c[_0x2effc3];return _0x56d065;};'use strict';var multer=require(_0xcc43('0x0'));var util=require(_0xcc43('0x1'));var path=require(_0xcc43('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xcc43('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xcc43('0x4'));router[_0xcc43('0x5')]('/',auth[_0xcc43('0x6')](),controller['index']);router[_0xcc43('0x5')](_0xcc43('0x7'),auth[_0xcc43('0x6')](),controller[_0xcc43('0x8')]);router[_0xcc43('0x9')]('/',auth[_0xcc43('0x6')](),controller[_0xcc43('0xa')]);router[_0xcc43('0xb')]('/:id',auth[_0xcc43('0x6')](),controller[_0xcc43('0xc')]);router[_0xcc43('0xd')](_0xcc43('0x7'),auth[_0xcc43('0x6')](),controller[_0xcc43('0xe')]);module[_0xcc43('0xf')]=router; \ No newline at end of file diff --git a/server/api/template/template.attributes.js b/server/api/template/template.attributes.js index 077dc0c..90f72f0 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 _0x33e7=['TEXT','sequelize','exports','STRING'];(function(_0x1e6e4e,_0x2b1b09){var _0x3d746b=function(_0x4483dd){while(--_0x4483dd){_0x1e6e4e['push'](_0x1e6e4e['shift']());}};_0x3d746b(++_0x2b1b09);}(_0x33e7,0x1a1));var _0x733e=function(_0x56fe99,_0x1449da){_0x56fe99=_0x56fe99-0x0;var _0x322d78=_0x33e7[_0x56fe99];return _0x322d78;};'use strict';var Sequelize=require(_0x733e('0x0'));module[_0x733e('0x1')]={'name':{'type':Sequelize[_0x733e('0x2')]},'description':{'type':Sequelize[_0x733e('0x2')]},'html':{'type':Sequelize[_0x733e('0x3')]}}; \ No newline at end of file +var _0xdcde=['exports','STRING','TEXT','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdcde,0x97));var _0xedcd=function(_0x5713af,_0x8517b6){_0x5713af=_0x5713af-0x0;var _0x46e605=_0xdcde[_0x5713af];return _0x46e605;};'use strict';var Sequelize=require(_0xedcd('0x0'));module[_0xedcd('0x1')]={'name':{'type':Sequelize[_0xedcd('0x2')]},'description':{'type':Sequelize[_0xedcd('0x2')]},'html':{'type':Sequelize[_0xedcd('0x3')]}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index cce9628..0570e56 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 _0x5569=['userProfileId','autoAssociation','body','eml-format','rimraf','zip-dir','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','apply','reject','save','update','destroy','then','get','Templates','UserProfileResource','error','stack','name','send','index','Template','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','create','role','user','UserProfileSection','find'];(function(_0x2f8a7c,_0x3f65fd){var _0x257e01=function(_0x412826){while(--_0x412826){_0x2f8a7c['push'](_0x2f8a7c['shift']());}};_0x257e01(++_0x3f65fd);}(_0x5569,0xa9));var _0x9556=function(_0x64bbb9,_0x909c76){_0x64bbb9=_0x64bbb9-0x0;var _0x5c3707=_0x5569[_0x64bbb9];return _0x5c3707;};'use strict';var emlformat=require(_0x9556('0x0'));var rimraf=require(_0x9556('0x1'));var zipdir=require(_0x9556('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x9556('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x9556('0x4'));var util=require(_0x9556('0x5'));var path=require('path');var sox=require(_0x9556('0x6'));var csv=require(_0x9556('0x7'));var ejs=require(_0x9556('0x8'));var fs=require('fs');var fs_extra=require(_0x9556('0x9'));var _=require(_0x9556('0xa'));var squel=require(_0x9556('0xb'));var crypto=require(_0x9556('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x9556('0xd'));var toCsv=require(_0x9556('0x7'));var querystring=require(_0x9556('0xe'));var Papa=require('papaparse');var Redis=require(_0x9556('0xf'));var authService=require(_0x9556('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x9556('0x11'));var hardwareService=require(_0x9556('0x12'));var logger=require(_0x9556('0x13'))(_0x9556('0x14'));var utils=require('../../config/utils');var config=require(_0x9556('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x9556('0x16'))['db'];function respondWithStatusCode(_0x1ae8b3,_0x30234f){_0x30234f=_0x30234f||0xcc;return function(_0xb8c977){if(_0xb8c977){return _0x1ae8b3[_0x9556('0x17')](_0x30234f);}return _0x1ae8b3[_0x9556('0x18')](_0x30234f)[_0x9556('0x19')]();};}function respondWithResult(_0x405d81,_0xd531a){_0xd531a=_0xd531a||0xc8;return function(_0xe70270){if(_0xe70270){return _0x405d81[_0x9556('0x18')](_0xd531a)[_0x9556('0x1a')](_0xe70270);}};}function respondWithFilteredResult(_0xfe3f8c,_0x4584a1){return function(_0x5ad005){if(_0x5ad005){var _0x5f21b8=typeof _0x4584a1[_0x9556('0x1b')]===_0x9556('0x1c')&&typeof _0x4584a1['limit']===_0x9556('0x1c');var _0x3aa799=_0x5ad005[_0x9556('0x1d')];var _0x261ece=_0x5f21b8?0x0:_0x4584a1[_0x9556('0x1b')];var _0xfb5cb0=_0x5f21b8?_0x5ad005['count']:_0x4584a1['offset']+_0x4584a1[_0x9556('0x1e')];var _0x4d7af1;if(_0xfb5cb0>=_0x3aa799){_0xfb5cb0=_0x3aa799;_0x4d7af1=0xc8;}else{_0x4d7af1=0xce;}_0xfe3f8c['status'](_0x4d7af1);return _0xfe3f8c['set'](_0x9556('0x1f'),_0x261ece+'-'+_0xfb5cb0+'/'+_0x3aa799)[_0x9556('0x1a')](_0x5ad005);}return null;};}function patchUpdates(_0x435754){return function(_0x1ce1fa){try{jsonpatch[_0x9556('0x20')](_0x1ce1fa,_0x435754,!![]);}catch(_0x119b2e){return BPromise[_0x9556('0x21')](_0x119b2e);}return _0x1ce1fa[_0x9556('0x22')]();};}function saveUpdates(_0x553192,_0x50c3dc){return function(_0x4694c2){if(_0x4694c2){return _0x4694c2[_0x9556('0x23')](_0x553192)['then'](function(_0x1b55ae){return _0x1b55ae;});}return null;};}function removeEntity(_0x43e30a,_0x4caa95){return function(_0x24231c){if(_0x24231c){return _0x24231c[_0x9556('0x24')]()[_0x9556('0x25')](function(){var _0x5281f9=_0x24231c[_0x9556('0x26')]({'plain':!![]});var _0x5b2f98=_0x9556('0x27');return db[_0x9556('0x28')][_0x9556('0x24')]({'where':{'type':_0x5b2f98,'resourceId':_0x5281f9['id']}})[_0x9556('0x25')](function(){return _0x24231c;});})[_0x9556('0x25')](function(){_0x43e30a[_0x9556('0x18')](0xcc)[_0x9556('0x19')]();});}};}function handleEntityNotFound(_0x5796d4,_0x923010){return function(_0x1ec6a5){if(!_0x1ec6a5){_0x5796d4[_0x9556('0x17')](0x194);}return _0x1ec6a5;};}function handleError(_0x2f88ec,_0x52b7b6){_0x52b7b6=_0x52b7b6||0x1f4;return function(_0x98a3f){logger[_0x9556('0x29')](_0x98a3f[_0x9556('0x2a')]);if(_0x98a3f[_0x9556('0x2b')]){delete _0x98a3f[_0x9556('0x2b')];}_0x2f88ec[_0x9556('0x18')](_0x52b7b6)[_0x9556('0x2c')](_0x98a3f);};}exports[_0x9556('0x2d')]=function(_0x33fa0a,_0x46361d){var _0x13de5c={},_0x9b06ae={},_0x17f2eb={'count':0x0,'rows':[]};var _0x3d7fa4=_['map'](db[_0x9556('0x2e')]['rawAttributes'],function(_0x11488e){return{'name':_0x11488e[_0x9556('0x2f')],'type':_0x11488e[_0x9556('0x30')][_0x9556('0x31')]};});_0x9b06ae[_0x9556('0x32')]=_[_0x9556('0x33')](_0x3d7fa4,_0x9556('0x2b'));_0x9b06ae[_0x9556('0x34')]=_[_0x9556('0x35')](_0x33fa0a[_0x9556('0x34')]);_0x9b06ae[_0x9556('0x36')]=_[_0x9556('0x37')](_0x9b06ae[_0x9556('0x32')],_0x9b06ae[_0x9556('0x34')]);_0x13de5c[_0x9556('0x38')]=_['intersection'](_0x9b06ae[_0x9556('0x32')],qs['fields'](_0x33fa0a['query'][_0x9556('0x39')]));_0x13de5c['attributes']=_0x13de5c[_0x9556('0x38')][_0x9556('0x3a')]?_0x13de5c[_0x9556('0x38')]:_0x9b06ae['model'];if(!_0x33fa0a[_0x9556('0x34')]['hasOwnProperty'](_0x9556('0x3b'))){_0x13de5c['limit']=qs[_0x9556('0x1e')](_0x33fa0a[_0x9556('0x34')][_0x9556('0x1e')]);_0x13de5c[_0x9556('0x1b')]=qs[_0x9556('0x1b')](_0x33fa0a[_0x9556('0x34')][_0x9556('0x1b')]);}_0x13de5c['order']=qs[_0x9556('0x3c')](_0x33fa0a[_0x9556('0x34')]['sort']);_0x13de5c[_0x9556('0x3d')]=qs['filters'](_[_0x9556('0x3e')](_0x33fa0a[_0x9556('0x34')],_0x9b06ae[_0x9556('0x36')]),_0x3d7fa4);if(_0x33fa0a[_0x9556('0x34')][_0x9556('0x3f')]){_0x13de5c['where']=_[_0x9556('0x40')](_0x13de5c[_0x9556('0x3d')],{'$or':_['map'](_0x3d7fa4,function(_0x8c8e7c){if(_0x8c8e7c[_0x9556('0x30')]!==_0x9556('0x41')){var _0x10e1cf={};_0x10e1cf[_0x8c8e7c[_0x9556('0x2b')]]={'$like':'%'+_0x33fa0a['query']['filter']+'%'};return _0x10e1cf;}})});}_0x13de5c=_[_0x9556('0x40')]({},_0x13de5c,_0x33fa0a[_0x9556('0x42')]);var _0x25b18f={'where':_0x13de5c[_0x9556('0x3d')]};return db[_0x9556('0x2e')][_0x9556('0x1d')](_0x25b18f)[_0x9556('0x25')](function(_0x473e5e){_0x17f2eb[_0x9556('0x1d')]=_0x473e5e;if(_0x33fa0a[_0x9556('0x34')][_0x9556('0x43')]){_0x13de5c[_0x9556('0x44')]=[{'all':!![]}];}return db['Template'][_0x9556('0x45')](_0x13de5c);})[_0x9556('0x25')](function(_0xab6cbe){_0x17f2eb[_0x9556('0x46')]=_0xab6cbe;return _0x17f2eb;})[_0x9556('0x25')](respondWithFilteredResult(_0x46361d,_0x13de5c))[_0x9556('0x47')](handleError(_0x46361d,null));};exports[_0x9556('0x48')]=function(_0x2d9d0a,_0x8b6c6f){var _0x33b343={'raw':!![],'where':{'id':_0x2d9d0a[_0x9556('0x49')]['id']}},_0x40cc56={};_0x40cc56[_0x9556('0x32')]=_[_0x9556('0x35')](db[_0x9556('0x2e')][_0x9556('0x4a')]);_0x40cc56['query']=_['keys'](_0x2d9d0a[_0x9556('0x34')]);_0x40cc56['filters']=_[_0x9556('0x37')](_0x40cc56[_0x9556('0x32')],_0x40cc56[_0x9556('0x34')]);_0x33b343[_0x9556('0x38')]=_['intersection'](_0x40cc56[_0x9556('0x32')],qs['fields'](_0x2d9d0a[_0x9556('0x34')]['fields']));_0x33b343[_0x9556('0x38')]=_0x33b343['attributes'][_0x9556('0x3a')]?_0x33b343[_0x9556('0x38')]:_0x40cc56['model'];if(_0x2d9d0a[_0x9556('0x34')][_0x9556('0x43')]){_0x33b343[_0x9556('0x44')]=[{'all':!![]}];}_0x33b343=_[_0x9556('0x40')]({},_0x33b343,_0x2d9d0a[_0x9556('0x42')]);return db['Template']['find'](_0x33b343)[_0x9556('0x25')](handleEntityNotFound(_0x8b6c6f,null))[_0x9556('0x25')](respondWithResult(_0x8b6c6f,null))['catch'](handleError(_0x8b6c6f,null));};exports[_0x9556('0x4b')]=function(_0x6e8270,_0x11af37){return db[_0x9556('0x2e')][_0x9556('0x4b')](_0x6e8270['body'],{})['then'](function(_0x35e668){var _0x5f3ca4=_0x6e8270['user'][_0x9556('0x26')]({'plain':!![]});if(!_0x5f3ca4)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5f3ca4[_0x9556('0x4c')]===_0x9556('0x4d')){var _0x4f9144=_0x35e668['get']({'plain':!![]});var _0x2e4a3a=_0x9556('0x27');return db[_0x9556('0x4e')][_0x9556('0x4f')]({'where':{'name':_0x2e4a3a,'userProfileId':_0x5f3ca4[_0x9556('0x50')]},'raw':!![]})[_0x9556('0x25')](function(_0x56565c){if(_0x56565c&&_0x56565c[_0x9556('0x51')]===0x0){return db[_0x9556('0x28')][_0x9556('0x4b')]({'name':_0x4f9144[_0x9556('0x2b')],'resourceId':_0x4f9144['id'],'type':_0x56565c['name'],'sectionId':_0x56565c['id']},{})['then'](function(){return _0x35e668;});}else{return _0x35e668;}})[_0x9556('0x47')](function(_0x55121b){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x55121b);throw _0x55121b;});}return _0x35e668;})[_0x9556('0x25')](respondWithResult(_0x11af37,0xc9))[_0x9556('0x47')](handleError(_0x11af37,null));};exports['update']=function(_0x56e9e2,_0x41cecd){if(_0x56e9e2['body']['id']){delete _0x56e9e2[_0x9556('0x52')]['id'];}return db[_0x9556('0x2e')][_0x9556('0x4f')]({'where':{'id':_0x56e9e2[_0x9556('0x49')]['id']}})[_0x9556('0x25')](handleEntityNotFound(_0x41cecd,null))[_0x9556('0x25')](saveUpdates(_0x56e9e2[_0x9556('0x52')],null))[_0x9556('0x25')](respondWithResult(_0x41cecd,null))[_0x9556('0x47')](handleError(_0x41cecd,null));};exports[_0x9556('0x24')]=function(_0x327779,_0x834651){return db[_0x9556('0x2e')][_0x9556('0x4f')]({'where':{'id':_0x327779[_0x9556('0x49')]['id']}})[_0x9556('0x25')](handleEntityNotFound(_0x834651,null))[_0x9556('0x25')](removeEntity(_0x834651,null))['catch'](handleError(_0x834651,null));}; \ No newline at end of file +var _0x961b=['then','destroy','get','Templates','UserProfileResource','sendStatus','stack','name','send','index','map','Template','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','params','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','zip-dir','fast-json-patch','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','status','end','json','undefined','limit','count','offset','Content-Range','apply','reject','save','update'];(function(_0xc3a71f,_0x54fe71){var _0x46a474=function(_0x47e601){while(--_0x47e601){_0xc3a71f['push'](_0xc3a71f['shift']());}};_0x46a474(++_0x54fe71);}(_0x961b,0xda));var _0xb961=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0x961b[_0x110c3d];return _0x226d67;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb961('0x0'));var zipdir=require(_0xb961('0x1'));var jsonpatch=require(_0xb961('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xb961('0x3'));var Mustache=require(_0xb961('0x4'));var util=require('util');var path=require(_0xb961('0x5'));var sox=require(_0xb961('0x6'));var csv=require('to-csv');var ejs=require(_0xb961('0x7'));var fs=require('fs');var fs_extra=require(_0xb961('0x8'));var _=require(_0xb961('0x9'));var squel=require(_0xb961('0xa'));var crypto=require(_0xb961('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xb961('0xc'));var toCsv=require(_0xb961('0xd'));var querystring=require(_0xb961('0xe'));var Papa=require(_0xb961('0xf'));var Redis=require(_0xb961('0x10'));var authService=require(_0xb961('0x11'));var qs=require(_0xb961('0x12'));var as=require(_0xb961('0x13'));var hardwareService=require(_0xb961('0x14'));var logger=require(_0xb961('0x15'))('api');var utils=require(_0xb961('0x16'));var config=require(_0xb961('0x17'));var licenseUtil=require(_0xb961('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4cd204,_0x6b47d0){_0x6b47d0=_0x6b47d0||0xcc;return function(_0x2059ec){if(_0x2059ec){return _0x4cd204['sendStatus'](_0x6b47d0);}return _0x4cd204[_0xb961('0x19')](_0x6b47d0)[_0xb961('0x1a')]();};}function respondWithResult(_0x1bffc7,_0x1262fb){_0x1262fb=_0x1262fb||0xc8;return function(_0xd7ccd7){if(_0xd7ccd7){return _0x1bffc7[_0xb961('0x19')](_0x1262fb)[_0xb961('0x1b')](_0xd7ccd7);}};}function respondWithFilteredResult(_0x3f654f,_0x217e52){return function(_0x519db8){if(_0x519db8){var _0x2a96a2=typeof _0x217e52['offset']===_0xb961('0x1c')&&typeof _0x217e52[_0xb961('0x1d')]==='undefined';var _0x24e391=_0x519db8[_0xb961('0x1e')];var _0x3f323b=_0x2a96a2?0x0:_0x217e52[_0xb961('0x1f')];var _0x3bb556=_0x2a96a2?_0x519db8[_0xb961('0x1e')]:_0x217e52[_0xb961('0x1f')]+_0x217e52[_0xb961('0x1d')];var _0x3295a9;if(_0x3bb556>=_0x24e391){_0x3bb556=_0x24e391;_0x3295a9=0xc8;}else{_0x3295a9=0xce;}_0x3f654f[_0xb961('0x19')](_0x3295a9);return _0x3f654f['set'](_0xb961('0x20'),_0x3f323b+'-'+_0x3bb556+'/'+_0x24e391)[_0xb961('0x1b')](_0x519db8);}return null;};}function patchUpdates(_0x1b292b){return function(_0x17646c){try{jsonpatch[_0xb961('0x21')](_0x17646c,_0x1b292b,!![]);}catch(_0x108132){return BPromise[_0xb961('0x22')](_0x108132);}return _0x17646c[_0xb961('0x23')]();};}function saveUpdates(_0x177065,_0x30d000){return function(_0x4fa402){if(_0x4fa402){return _0x4fa402[_0xb961('0x24')](_0x177065)[_0xb961('0x25')](function(_0x10b1c6){return _0x10b1c6;});}return null;};}function removeEntity(_0x3f1380,_0x37b049){return function(_0x192e5e){if(_0x192e5e){return _0x192e5e[_0xb961('0x26')]()['then'](function(){var _0x139fb6=_0x192e5e[_0xb961('0x27')]({'plain':!![]});var _0x4a82c0=_0xb961('0x28');return db[_0xb961('0x29')][_0xb961('0x26')]({'where':{'type':_0x4a82c0,'resourceId':_0x139fb6['id']}})[_0xb961('0x25')](function(){return _0x192e5e;});})[_0xb961('0x25')](function(){_0x3f1380['status'](0xcc)[_0xb961('0x1a')]();});}};}function handleEntityNotFound(_0x2c1e88,_0x1c6411){return function(_0x51ac47){if(!_0x51ac47){_0x2c1e88[_0xb961('0x2a')](0x194);}return _0x51ac47;};}function handleError(_0x513506,_0x5ce33f){_0x5ce33f=_0x5ce33f||0x1f4;return function(_0x5aec8a){logger['error'](_0x5aec8a[_0xb961('0x2b')]);if(_0x5aec8a['name']){delete _0x5aec8a[_0xb961('0x2c')];}_0x513506[_0xb961('0x19')](_0x5ce33f)[_0xb961('0x2d')](_0x5aec8a);};}exports[_0xb961('0x2e')]=function(_0x411e86,_0x246ea2){var _0x850377={},_0x56f2d0={},_0x446c3e={'count':0x0,'rows':[]};var _0x11ae08=_[_0xb961('0x2f')](db[_0xb961('0x30')][_0xb961('0x31')],function(_0x59b59f){return{'name':_0x59b59f[_0xb961('0x32')],'type':_0x59b59f[_0xb961('0x33')][_0xb961('0x34')]};});_0x56f2d0[_0xb961('0x35')]=_['map'](_0x11ae08,_0xb961('0x2c'));_0x56f2d0[_0xb961('0x36')]=_[_0xb961('0x37')](_0x411e86[_0xb961('0x36')]);_0x56f2d0['filters']=_[_0xb961('0x38')](_0x56f2d0[_0xb961('0x35')],_0x56f2d0[_0xb961('0x36')]);_0x850377[_0xb961('0x39')]=_['intersection'](_0x56f2d0[_0xb961('0x35')],qs[_0xb961('0x3a')](_0x411e86[_0xb961('0x36')][_0xb961('0x3a')]));_0x850377[_0xb961('0x39')]=_0x850377[_0xb961('0x39')]['length']?_0x850377['attributes']:_0x56f2d0[_0xb961('0x35')];if(!_0x411e86[_0xb961('0x36')][_0xb961('0x3b')](_0xb961('0x3c'))){_0x850377[_0xb961('0x1d')]=qs[_0xb961('0x1d')](_0x411e86['query'][_0xb961('0x1d')]);_0x850377['offset']=qs[_0xb961('0x1f')](_0x411e86[_0xb961('0x36')][_0xb961('0x1f')]);}_0x850377['order']=qs[_0xb961('0x3d')](_0x411e86[_0xb961('0x36')][_0xb961('0x3d')]);_0x850377[_0xb961('0x3e')]=qs[_0xb961('0x3f')](_[_0xb961('0x40')](_0x411e86[_0xb961('0x36')],_0x56f2d0[_0xb961('0x3f')]),_0x11ae08);if(_0x411e86[_0xb961('0x36')][_0xb961('0x41')]){_0x850377[_0xb961('0x3e')]=_[_0xb961('0x42')](_0x850377[_0xb961('0x3e')],{'$or':_[_0xb961('0x2f')](_0x11ae08,function(_0x166e1e){if(_0x166e1e[_0xb961('0x33')]!==_0xb961('0x43')){var _0x492d66={};_0x492d66[_0x166e1e[_0xb961('0x2c')]]={'$like':'%'+_0x411e86['query'][_0xb961('0x41')]+'%'};return _0x492d66;}})});}_0x850377=_[_0xb961('0x42')]({},_0x850377,_0x411e86['options']);var _0x11ad8f={'where':_0x850377[_0xb961('0x3e')]};return db['Template']['count'](_0x11ad8f)['then'](function(_0x556f63){_0x446c3e[_0xb961('0x1e')]=_0x556f63;if(_0x411e86[_0xb961('0x36')][_0xb961('0x44')]){_0x850377[_0xb961('0x45')]=[{'all':!![]}];}return db['Template'][_0xb961('0x46')](_0x850377);})[_0xb961('0x25')](function(_0x13b55c){_0x446c3e[_0xb961('0x47')]=_0x13b55c;return _0x446c3e;})[_0xb961('0x25')](respondWithFilteredResult(_0x246ea2,_0x850377))[_0xb961('0x48')](handleError(_0x246ea2,null));};exports['show']=function(_0x207472,_0x54b892){var _0x11b905={'raw':!![],'where':{'id':_0x207472[_0xb961('0x49')]['id']}},_0x437a30={};_0x437a30[_0xb961('0x35')]=_[_0xb961('0x37')](db[_0xb961('0x30')]['rawAttributes']);_0x437a30[_0xb961('0x36')]=_[_0xb961('0x37')](_0x207472['query']);_0x437a30['filters']=_[_0xb961('0x38')](_0x437a30[_0xb961('0x35')],_0x437a30['query']);_0x11b905[_0xb961('0x39')]=_[_0xb961('0x38')](_0x437a30[_0xb961('0x35')],qs[_0xb961('0x3a')](_0x207472['query'][_0xb961('0x3a')]));_0x11b905['attributes']=_0x11b905[_0xb961('0x39')][_0xb961('0x4a')]?_0x11b905[_0xb961('0x39')]:_0x437a30['model'];if(_0x207472[_0xb961('0x36')][_0xb961('0x44')]){_0x11b905[_0xb961('0x45')]=[{'all':!![]}];}_0x11b905=_[_0xb961('0x42')]({},_0x11b905,_0x207472['options']);return db[_0xb961('0x30')][_0xb961('0x4b')](_0x11b905)['then'](handleEntityNotFound(_0x54b892,null))[_0xb961('0x25')](respondWithResult(_0x54b892,null))[_0xb961('0x48')](handleError(_0x54b892,null));};exports['create']=function(_0x117d1c,_0x440f38){return db['Template'][_0xb961('0x4c')](_0x117d1c[_0xb961('0x4d')],{})[_0xb961('0x25')](function(_0x4e1e64){var _0x268dec=_0x117d1c[_0xb961('0x4e')][_0xb961('0x27')]({'plain':!![]});if(!_0x268dec)throw new Error(_0xb961('0x4f'));if(_0x268dec[_0xb961('0x50')]===_0xb961('0x4e')){var _0x547b2b=_0x4e1e64[_0xb961('0x27')]({'plain':!![]});var _0x3fc36c='Templates';return db[_0xb961('0x51')][_0xb961('0x4b')]({'where':{'name':_0x3fc36c,'userProfileId':_0x268dec[_0xb961('0x52')]},'raw':!![]})[_0xb961('0x25')](function(_0x5777c5){if(_0x5777c5&&_0x5777c5['autoAssociation']===0x0){return db[_0xb961('0x29')][_0xb961('0x4c')]({'name':_0x547b2b['name'],'resourceId':_0x547b2b['id'],'type':_0x5777c5['name'],'sectionId':_0x5777c5['id']},{})[_0xb961('0x25')](function(){return _0x4e1e64;});}else{return _0x4e1e64;}})[_0xb961('0x48')](function(_0x280e9f){logger[_0xb961('0x53')](_0xb961('0x54'),_0x280e9f);throw _0x280e9f;});}return _0x4e1e64;})[_0xb961('0x25')](respondWithResult(_0x440f38,0xc9))[_0xb961('0x48')](handleError(_0x440f38,null));};exports['update']=function(_0x27da72,_0x289dad){if(_0x27da72[_0xb961('0x4d')]['id']){delete _0x27da72[_0xb961('0x4d')]['id'];}return db[_0xb961('0x30')]['find']({'where':{'id':_0x27da72[_0xb961('0x49')]['id']}})[_0xb961('0x25')](handleEntityNotFound(_0x289dad,null))[_0xb961('0x25')](saveUpdates(_0x27da72['body'],null))['then'](respondWithResult(_0x289dad,null))['catch'](handleError(_0x289dad,null));};exports[_0xb961('0x26')]=function(_0xea2a02,_0x194f99){return db['Template'][_0xb961('0x4b')]({'where':{'id':_0xea2a02[_0xb961('0x49')]['id']}})[_0xb961('0x25')](handleEntityNotFound(_0x194f99,null))[_0xb961('0x25')](removeEntity(_0x194f99,null))[_0xb961('0x48')](handleError(_0x194f99,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index e9408c0..3bb3603 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 _0x2f31=['../../config/logger','path','./template.attributes','Template','tools_templates','lodash'];(function(_0xb75fea,_0x3212f8){var _0x242ee4=function(_0x4c6b8e){while(--_0x4c6b8e){_0xb75fea['push'](_0xb75fea['shift']());}};_0x242ee4(++_0x3212f8);}(_0x2f31,0x119));var _0x12f3=function(_0x126dcd,_0x28c248){_0x126dcd=_0x126dcd-0x0;var _0x3f9913=_0x2f31[_0x126dcd];return _0x3f9913;};'use strict';var _=require(_0x12f3('0x0'));var util=require('util');var logger=require(_0x12f3('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x12f3('0x2'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x12f3('0x3'));module['exports']=function(_0x32a239,_0x4cfc0d){return _0x32a239['define'](_0x12f3('0x4'),attributes,{'tableName':_0x12f3('0x5'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8b34=['../../config/logger','api','bluebird','request-promise','path','../../config/environment','./template.attributes','exports','lodash','util'];(function(_0x1eb40a,_0x4fd90d){var _0x2262a9=function(_0x58de7d){while(--_0x58de7d){_0x1eb40a['push'](_0x1eb40a['shift']());}};_0x2262a9(++_0x4fd90d);}(_0x8b34,0x1f2));var _0x48b3=function(_0x5e94d9,_0x321598){_0x5e94d9=_0x5e94d9-0x0;var _0x515fb2=_0x8b34[_0x5e94d9];return _0x515fb2;};'use strict';var _=require(_0x48b3('0x0'));var util=require(_0x48b3('0x1'));var logger=require(_0x48b3('0x2'))(_0x48b3('0x3'));var moment=require('moment');var BPromise=require(_0x48b3('0x4'));var rp=require(_0x48b3('0x5'));var fs=require('fs');var path=require(_0x48b3('0x6'));var rimraf=require('rimraf');var config=require(_0x48b3('0x7'));var attributes=require(_0x48b3('0x8'));module[_0x48b3('0x9')]=function(_0x7e857d,_0x57e76a){return _0x7e857d['define']('Template',attributes,{'tableName':'tools_templates','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/template/template.rpc.js b/server/api/template/template.rpc.js index 68d1daf..f74d5d8 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 _0xec1c=['debug','Template,\x20%s,\x20%s,\x20%s','error','code','message','catch','Template','findAll','options','where','attributes','include','map','model','GetTemplate','stringify','util','moment','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','Template,\x20%s,\x20%s','request\x20sent'];(function(_0x1568e4,_0xe2e742){var _0x1e9092=function(_0x4b34ec){while(--_0x4b34ec){_0x1568e4['push'](_0x1568e4['shift']());}};_0x1e9092(++_0xe2e742);}(_0xec1c,0x1c3));var _0xcec1=function(_0x2b37aa,_0x1d40dc){_0x2b37aa=_0x2b37aa-0x0;var _0x52b73d=_0xec1c[_0x2b37aa];return _0x52b73d;};'use strict';var _=require('lodash');var util=require(_0xcec1('0x0'));var moment=require(_0xcec1('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xcec1('0x2'));var db=require(_0xcec1('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xcec1('0x4'))('rpc');var config=require(_0xcec1('0x5'));var jayson=require(_0xcec1('0x6'));var client=jayson['client'][_0xcec1('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x40682b,_0x2dac8e,_0x40c3dd){return new BPromise(function(_0x139832,_0x112347){return client[_0xcec1('0x8')](_0x40682b,_0x40c3dd)[_0xcec1('0x9')](function(_0x549f4a){logger[_0xcec1('0xa')](_0xcec1('0xb'),_0x2dac8e,_0xcec1('0xc'));logger[_0xcec1('0xd')](_0xcec1('0xe'),_0x2dac8e,'request\x20sent',JSON['stringify'](_0x549f4a));if(_0x549f4a[_0xcec1('0xf')]){if(_0x549f4a['error'][_0xcec1('0x10')]===0x1f4){logger['error'](_0xcec1('0xb'),_0x2dac8e,_0x549f4a[_0xcec1('0xf')][_0xcec1('0x11')]);return _0x112347(_0x549f4a[_0xcec1('0xf')][_0xcec1('0x11')]);}logger[_0xcec1('0xf')](_0xcec1('0xb'),_0x2dac8e,_0x549f4a[_0xcec1('0xf')][_0xcec1('0x11')]);return _0x139832(_0x549f4a['error'][_0xcec1('0x11')]);}else{logger['info'](_0xcec1('0xb'),_0x2dac8e,_0xcec1('0xc'));_0x139832(_0x549f4a['result']['message']);}})[_0xcec1('0x12')](function(_0x24ce7d){logger[_0xcec1('0xf')]('Template,\x20%s,\x20%s',_0x2dac8e,_0x24ce7d);_0x112347(_0x24ce7d);});});}exports['GetTemplate']=function(_0x2b741f){var _0x436fb9=this;return new Promise(function(_0x1f523c,_0x344a9b){return db[_0xcec1('0x13')][_0xcec1('0x14')]({'raw':_0x2b741f[_0xcec1('0x15')]?_0x2b741f[_0xcec1('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x2b741f['options']?_0x2b741f[_0xcec1('0x15')][_0xcec1('0x16')]||null:null,'attributes':_0x2b741f[_0xcec1('0x15')]?_0x2b741f[_0xcec1('0x15')][_0xcec1('0x17')]||null:null,'limit':_0x2b741f[_0xcec1('0x15')]?_0x2b741f[_0xcec1('0x15')]['limit']||null:null,'include':_0x2b741f['options']?_0x2b741f[_0xcec1('0x15')][_0xcec1('0x18')]?_[_0xcec1('0x19')](_0x2b741f['options'][_0xcec1('0x18')],function(_0x1e5528){return{'model':db[_0x1e5528[_0xcec1('0x1a')]],'as':_0x1e5528['as'],'attributes':_0x1e5528[_0xcec1('0x17')],'include':_0x1e5528['include']?_[_0xcec1('0x19')](_0x1e5528['include'],function(_0x21d6fb){return{'model':db[_0x21d6fb['model']],'as':_0x21d6fb['as'],'attributes':_0x21d6fb[_0xcec1('0x17')],'include':_0x21d6fb[_0xcec1('0x18')]?_['map'](_0x21d6fb[_0xcec1('0x18')],function(_0x5329b4){return{'model':db[_0x5329b4[_0xcec1('0x1a')]],'as':_0x5329b4['as'],'attributes':_0x5329b4[_0xcec1('0x17')]};}):[]};}):[]};}):[]:[]})[_0xcec1('0x9')](function(_0x48717a){logger[_0xcec1('0xa')](_0xcec1('0x1b'),_0x2b741f);logger['debug'](_0xcec1('0x1b'),_0x2b741f,JSON[_0xcec1('0x1c')](_0x48717a));_0x1f523c(_0x48717a);})['catch'](function(_0x171c05){logger[_0xcec1('0xf')](_0xcec1('0x1b'),_0x171c05['message'],_0x2b741f);_0x344a9b(_0x436fb9[_0xcec1('0xf')](0x1f4,_0x171c05['message']));});});}; \ No newline at end of file +var _0x2f91=['message','GetTemplate','options','where','attributes','limit','map','model','include','then','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','Template,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code'];(function(_0x2d4e89,_0x29665e){var _0x57ee47=function(_0x79351a){while(--_0x79351a){_0x2d4e89['push'](_0x2d4e89['shift']());}};_0x57ee47(++_0x29665e);}(_0x2f91,0xdd));var _0x12f9=function(_0x442f3c,_0x363ee7){_0x442f3c=_0x442f3c-0x0;var _0xa36cb9=_0x2f91[_0x442f3c];return _0xa36cb9;};'use strict';var _=require(_0x12f9('0x0'));var util=require(_0x12f9('0x1'));var moment=require(_0x12f9('0x2'));var BPromise=require(_0x12f9('0x3'));var rs=require(_0x12f9('0x4'));var fs=require('fs');var Redis=require(_0x12f9('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x12f9('0x6'))(_0x12f9('0x7'));var config=require(_0x12f9('0x8'));var jayson=require(_0x12f9('0x9'));var client=jayson['client'][_0x12f9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x17615f,_0x4ced59,_0x444e58){return new BPromise(function(_0x1b6b38,_0x289eff){return client[_0x12f9('0xb')](_0x17615f,_0x444e58)['then'](function(_0x6126e8){logger[_0x12f9('0xc')](_0x12f9('0xd'),_0x4ced59,'request\x20sent');logger[_0x12f9('0xe')]('Template,\x20%s,\x20%s,\x20%s',_0x4ced59,_0x12f9('0xf'),JSON[_0x12f9('0x10')](_0x6126e8));if(_0x6126e8[_0x12f9('0x11')]){if(_0x6126e8['error'][_0x12f9('0x12')]===0x1f4){logger['error']('Template,\x20%s,\x20%s',_0x4ced59,_0x6126e8[_0x12f9('0x11')][_0x12f9('0x13')]);return _0x289eff(_0x6126e8['error'][_0x12f9('0x13')]);}logger[_0x12f9('0x11')](_0x12f9('0xd'),_0x4ced59,_0x6126e8[_0x12f9('0x11')][_0x12f9('0x13')]);return _0x1b6b38(_0x6126e8[_0x12f9('0x11')]['message']);}else{logger[_0x12f9('0xc')](_0x12f9('0xd'),_0x4ced59,'request\x20sent');_0x1b6b38(_0x6126e8['result'][_0x12f9('0x13')]);}})['catch'](function(_0x320395){logger[_0x12f9('0x11')]('Template,\x20%s,\x20%s',_0x4ced59,_0x320395);_0x289eff(_0x320395);});});}exports[_0x12f9('0x14')]=function(_0x35ebe7){var _0x8b5495=this;return new Promise(function(_0x1f87a2,_0x1152b3){return db['Template']['findAll']({'raw':_0x35ebe7[_0x12f9('0x15')]?_0x35ebe7[_0x12f9('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x35ebe7[_0x12f9('0x15')]?_0x35ebe7[_0x12f9('0x15')][_0x12f9('0x16')]||null:null,'attributes':_0x35ebe7[_0x12f9('0x15')]?_0x35ebe7[_0x12f9('0x15')][_0x12f9('0x17')]||null:null,'limit':_0x35ebe7[_0x12f9('0x15')]?_0x35ebe7['options'][_0x12f9('0x18')]||null:null,'include':_0x35ebe7['options']?_0x35ebe7[_0x12f9('0x15')]['include']?_[_0x12f9('0x19')](_0x35ebe7[_0x12f9('0x15')]['include'],function(_0x4942d8){return{'model':db[_0x4942d8[_0x12f9('0x1a')]],'as':_0x4942d8['as'],'attributes':_0x4942d8['attributes'],'include':_0x4942d8[_0x12f9('0x1b')]?_[_0x12f9('0x19')](_0x4942d8[_0x12f9('0x1b')],function(_0x46da9b){return{'model':db[_0x46da9b['model']],'as':_0x46da9b['as'],'attributes':_0x46da9b[_0x12f9('0x17')],'include':_0x46da9b[_0x12f9('0x1b')]?_[_0x12f9('0x19')](_0x46da9b[_0x12f9('0x1b')],function(_0x3ee680){return{'model':db[_0x3ee680[_0x12f9('0x1a')]],'as':_0x3ee680['as'],'attributes':_0x3ee680[_0x12f9('0x17')]};}):[]};}):[]};}):[]:[]})[_0x12f9('0x1c')](function(_0x18c2ad){logger[_0x12f9('0xc')](_0x12f9('0x14'),_0x35ebe7);logger['debug'](_0x12f9('0x14'),_0x35ebe7,JSON[_0x12f9('0x10')](_0x18c2ad));_0x1f87a2(_0x18c2ad);})[_0x12f9('0x1d')](function(_0x918618){logger[_0x12f9('0x11')](_0x12f9('0x14'),_0x918618[_0x12f9('0x13')],_0x35ebe7);_0x1152b3(_0x8b5495[_0x12f9('0x11')](0x1f4,_0x918618[_0x12f9('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index a834d01..194b1fe 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 _0xf993=['getAnyConditions','getActions','post','addAllCondition','/:id/actions','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','./trigger.controller','get','isAuthenticated','/:id','show','/:id/all_conditions','/:id/any_conditions'];(function(_0xe5f810,_0x27722a){var _0x589c86=function(_0x5a1db5){while(--_0x5a1db5){_0xe5f810['push'](_0xe5f810['shift']());}};_0x589c86(++_0x27722a);}(_0xf993,0x1d5));var _0x3f99=function(_0x2c1082,_0x3a9379){_0x2c1082=_0x2c1082-0x0;var _0x659be9=_0xf993[_0x2c1082];return _0x659be9;};'use strict';var multer=require(_0x3f99('0x0'));var util=require(_0x3f99('0x1'));var path=require(_0x3f99('0x2'));var timeout=require(_0x3f99('0x3'));var express=require(_0x3f99('0x4'));var router=express[_0x3f99('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x3f99('0x6'));var config=require('../../config/environment');var controller=require(_0x3f99('0x7'));router[_0x3f99('0x8')]('/',auth[_0x3f99('0x9')](),controller['index']);router['get'](_0x3f99('0xa'),auth[_0x3f99('0x9')](),controller[_0x3f99('0xb')]);router['get'](_0x3f99('0xc'),auth[_0x3f99('0x9')](),controller['getAllConditions']);router['get'](_0x3f99('0xd'),auth[_0x3f99('0x9')](),controller[_0x3f99('0xe')]);router[_0x3f99('0x8')]('/:id/actions',auth[_0x3f99('0x9')](),controller[_0x3f99('0xf')]);router[_0x3f99('0x10')]('/',auth[_0x3f99('0x9')](),controller['create']);router[_0x3f99('0x10')]('/:id/all_conditions',auth[_0x3f99('0x9')](),controller[_0x3f99('0x11')]);router[_0x3f99('0x10')](_0x3f99('0xd'),auth[_0x3f99('0x9')](),controller['addAnyCondition']);router[_0x3f99('0x10')](_0x3f99('0x12'),auth[_0x3f99('0x9')](),controller['addAction']);router[_0x3f99('0x13')](_0x3f99('0xa'),auth[_0x3f99('0x9')](),controller[_0x3f99('0x14')]);router[_0x3f99('0x15')](_0x3f99('0xa'),auth['isAuthenticated'](),controller[_0x3f99('0x16')]);module['exports']=router; \ No newline at end of file +var _0xa937=['update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./trigger.controller','isAuthenticated','index','/:id','show','get','/:id/all_conditions','getAllConditions','/:id/any_conditions','create','addAllCondition','addAnyCondition','post','addAction','put'];(function(_0x204224,_0x564de0){var _0x2d2928=function(_0x482f38){while(--_0x482f38){_0x204224['push'](_0x204224['shift']());}};_0x2d2928(++_0x564de0);}(_0xa937,0x163));var _0x7a93=function(_0x961079,_0x47a743){_0x961079=_0x961079-0x0;var _0x58e624=_0xa937[_0x961079];return _0x58e624;};'use strict';var multer=require(_0x7a93('0x0'));var util=require('util');var path=require(_0x7a93('0x1'));var timeout=require(_0x7a93('0x2'));var express=require(_0x7a93('0x3'));var router=express[_0x7a93('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x7a93('0x5'));var interaction=require(_0x7a93('0x6'));var config=require(_0x7a93('0x7'));var controller=require(_0x7a93('0x8'));router['get']('/',auth[_0x7a93('0x9')](),controller[_0x7a93('0xa')]);router['get'](_0x7a93('0xb'),auth[_0x7a93('0x9')](),controller[_0x7a93('0xc')]);router[_0x7a93('0xd')](_0x7a93('0xe'),auth['isAuthenticated'](),controller[_0x7a93('0xf')]);router[_0x7a93('0xd')](_0x7a93('0x10'),auth[_0x7a93('0x9')](),controller['getAnyConditions']);router[_0x7a93('0xd')]('/:id/actions',auth[_0x7a93('0x9')](),controller['getActions']);router['post']('/',auth[_0x7a93('0x9')](),controller[_0x7a93('0x11')]);router['post']('/:id/all_conditions',auth[_0x7a93('0x9')](),controller[_0x7a93('0x12')]);router['post'](_0x7a93('0x10'),auth[_0x7a93('0x9')](),controller[_0x7a93('0x13')]);router[_0x7a93('0x14')]('/:id/actions',auth[_0x7a93('0x9')](),controller[_0x7a93('0x15')]);router[_0x7a93('0x16')](_0x7a93('0xb'),auth[_0x7a93('0x9')](),controller[_0x7a93('0x17')]);router[_0x7a93('0x18')](_0x7a93('0xb'),auth[_0x7a93('0x9')](),controller[_0x7a93('0x19')]);module[_0x7a93('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 1f67669..3f2838b 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 _0xd743=['BOOLEAN','exports','STRING'];(function(_0x339a1b,_0x5e938c){var _0x400b68=function(_0x2769b2){while(--_0x2769b2){_0x339a1b['push'](_0x339a1b['shift']());}};_0x400b68(++_0x5e938c);}(_0xd743,0xee));var _0x3d74=function(_0x1426f7,_0x3d0199){_0x1426f7=_0x1426f7-0x0;var _0x2c55bf=_0xd743[_0x1426f7];return _0x2c55bf;};'use strict';var Sequelize=require('sequelize');module[_0x3d74('0x0')]={'name':{'type':Sequelize[_0x3d74('0x1')]},'channel':{'type':Sequelize[_0x3d74('0x1')]},'description':{'type':Sequelize[_0x3d74('0x1')]},'status':{'type':Sequelize[_0x3d74('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0x965f=['sequelize','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x965f,0x19a));var _0xf965=function(_0x13503c,_0x29ea4c){_0x13503c=_0x13503c-0x0;var _0x1f587a=_0x965f[_0x13503c];return _0x1f587a;};'use strict';var Sequelize=require(_0xf965('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xf965('0x1')]},'description':{'type':Sequelize[_0xf965('0x1')]},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/trigger/trigger.controller.js b/server/api/trigger/trigger.controller.js index 4df0a64..cdc2ba4 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 _0x7227=['find','body','get','autoAssociation','create','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','TriggerAllId','Condition','addAnyCondition','findOne','hasOwnProperty','getAllConditions','getAnyConditions','addAction','TriggerId','Action','getActions','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','end','json','offset','limit','undefined','count','status','set','Content-Range','apply','reject','save','update','then','Triggers','UserProfileResource','destroy','name','send','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','options','Trigger','includeAll','findAll','catch','show'];(function(_0x4bb66f,_0x3cd682){var _0xf2772f=function(_0x2e3698){while(--_0x2e3698){_0x4bb66f['push'](_0x4bb66f['shift']());}};_0xf2772f(++_0x3cd682);}(_0x7227,0x1c6));var _0x7722=function(_0x1ab20a,_0x50a80a){_0x1ab20a=_0x1ab20a-0x0;var _0x42c089=_0x7227[_0x1ab20a];return _0x42c089;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7722('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7722('0x1'));var rp=require(_0x7722('0x2'));var moment=require(_0x7722('0x3'));var BPromise=require(_0x7722('0x4'));var Mustache=require(_0x7722('0x5'));var util=require('util');var path=require(_0x7722('0x6'));var sox=require('sox');var csv=require(_0x7722('0x7'));var ejs=require(_0x7722('0x8'));var fs=require('fs');var fs_extra=require(_0x7722('0x9'));var _=require(_0x7722('0xa'));var squel=require('squel');var crypto=require(_0x7722('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x7722('0xc'));var toCsv=require(_0x7722('0x7'));var querystring=require(_0x7722('0xd'));var Papa=require('papaparse');var Redis=require(_0x7722('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x7722('0xf'));var as=require(_0x7722('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7722('0x11'))(_0x7722('0x12'));var utils=require('../../config/utils');var config=require(_0x7722('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x7722('0x14'))['db'];function respondWithStatusCode(_0x382765,_0x31913b){_0x31913b=_0x31913b||0xcc;return function(_0x369f30){if(_0x369f30){return _0x382765[_0x7722('0x15')](_0x31913b);}return _0x382765['status'](_0x31913b)[_0x7722('0x16')]();};}function respondWithResult(_0x4fa198,_0xafc2b9){_0xafc2b9=_0xafc2b9||0xc8;return function(_0xf8cb77){if(_0xf8cb77){return _0x4fa198['status'](_0xafc2b9)[_0x7722('0x17')](_0xf8cb77);}};}function respondWithFilteredResult(_0x4da31d,_0x3de9e1){return function(_0x26f2ca){if(_0x26f2ca){var _0x1b3bbc=typeof _0x3de9e1[_0x7722('0x18')]==='undefined'&&typeof _0x3de9e1[_0x7722('0x19')]===_0x7722('0x1a');var _0x49d3e8=_0x26f2ca['count'];var _0x4fb349=_0x1b3bbc?0x0:_0x3de9e1[_0x7722('0x18')];var _0x5360c6=_0x1b3bbc?_0x26f2ca[_0x7722('0x1b')]:_0x3de9e1[_0x7722('0x18')]+_0x3de9e1[_0x7722('0x19')];var _0x3a74be;if(_0x5360c6>=_0x49d3e8){_0x5360c6=_0x49d3e8;_0x3a74be=0xc8;}else{_0x3a74be=0xce;}_0x4da31d[_0x7722('0x1c')](_0x3a74be);return _0x4da31d[_0x7722('0x1d')](_0x7722('0x1e'),_0x4fb349+'-'+_0x5360c6+'/'+_0x49d3e8)[_0x7722('0x17')](_0x26f2ca);}return null;};}function patchUpdates(_0x34c65f){return function(_0x55c7de){try{jsonpatch[_0x7722('0x1f')](_0x55c7de,_0x34c65f,!![]);}catch(_0x4991b7){return BPromise[_0x7722('0x20')](_0x4991b7);}return _0x55c7de[_0x7722('0x21')]();};}function saveUpdates(_0x55c5c6,_0x465352){return function(_0x7cc538){if(_0x7cc538){return _0x7cc538[_0x7722('0x22')](_0x55c5c6)[_0x7722('0x23')](function(_0x5c623d){return _0x5c623d;});}return null;};}function removeEntity(_0x205811,_0x335308){return function(_0x3f113e){if(_0x3f113e){return _0x3f113e['destroy']()[_0x7722('0x23')](function(){var _0x151d07=_0x3f113e['get']({'plain':!![]});var _0x45b7c9=_0x7722('0x24');return db[_0x7722('0x25')][_0x7722('0x26')]({'where':{'type':_0x45b7c9,'resourceId':_0x151d07['id']}})['then'](function(){return _0x3f113e;});})[_0x7722('0x23')](function(){_0x205811[_0x7722('0x1c')](0xcc)[_0x7722('0x16')]();});}};}function handleEntityNotFound(_0x4d719b,_0x1abfdc){return function(_0x4b544f){if(!_0x4b544f){_0x4d719b[_0x7722('0x15')](0x194);}return _0x4b544f;};}function handleError(_0x5a5bb3,_0x273ab1){_0x273ab1=_0x273ab1||0x1f4;return function(_0x110fee){logger['error'](_0x110fee['stack']);if(_0x110fee[_0x7722('0x27')]){delete _0x110fee[_0x7722('0x27')];}_0x5a5bb3['status'](_0x273ab1)[_0x7722('0x28')](_0x110fee);};}exports['index']=function(_0x2dda48,_0x257526){var _0xd80179={},_0x5621ee={},_0x25388c={'count':0x0,'rows':[]};var _0x66925=_[_0x7722('0x29')](db['Trigger'][_0x7722('0x2a')],function(_0x821bfe){return{'name':_0x821bfe[_0x7722('0x2b')],'type':_0x821bfe[_0x7722('0x2c')][_0x7722('0x2d')]};});_0x5621ee[_0x7722('0x2e')]=_[_0x7722('0x29')](_0x66925,'name');_0x5621ee[_0x7722('0x2f')]=_[_0x7722('0x30')](_0x2dda48[_0x7722('0x2f')]);_0x5621ee[_0x7722('0x31')]=_[_0x7722('0x32')](_0x5621ee[_0x7722('0x2e')],_0x5621ee[_0x7722('0x2f')]);_0xd80179[_0x7722('0x33')]=_[_0x7722('0x32')](_0x5621ee[_0x7722('0x2e')],qs[_0x7722('0x34')](_0x2dda48['query']['fields']));_0xd80179[_0x7722('0x33')]=_0xd80179[_0x7722('0x33')][_0x7722('0x35')]?_0xd80179[_0x7722('0x33')]:_0x5621ee[_0x7722('0x2e')];if(!_0x2dda48[_0x7722('0x2f')]['hasOwnProperty'](_0x7722('0x36'))){_0xd80179[_0x7722('0x19')]=qs[_0x7722('0x19')](_0x2dda48[_0x7722('0x2f')][_0x7722('0x19')]);_0xd80179['offset']=qs[_0x7722('0x18')](_0x2dda48[_0x7722('0x2f')]['offset']);}_0xd80179[_0x7722('0x37')]=qs['sort'](_0x2dda48['query'][_0x7722('0x38')]);_0xd80179['where']=qs[_0x7722('0x31')](_[_0x7722('0x39')](_0x2dda48[_0x7722('0x2f')],_0x5621ee['filters']),_0x66925);if(_0x2dda48[_0x7722('0x2f')]['filter']){_0xd80179[_0x7722('0x3a')]=_[_0x7722('0x3b')](_0xd80179[_0x7722('0x3a')],{'$or':_[_0x7722('0x29')](_0x66925,function(_0x1f8e64){if(_0x1f8e64['type']!==_0x7722('0x3c')){var _0x93d6f6={};_0x93d6f6[_0x1f8e64[_0x7722('0x27')]]={'$like':'%'+_0x2dda48[_0x7722('0x2f')][_0x7722('0x3d')]+'%'};return _0x93d6f6;}})});}_0xd80179=_['merge']({},_0xd80179,_0x2dda48[_0x7722('0x3e')]);var _0x3467bc={'where':_0xd80179[_0x7722('0x3a')]};return db[_0x7722('0x3f')][_0x7722('0x1b')](_0x3467bc)[_0x7722('0x23')](function(_0xe84593){_0x25388c[_0x7722('0x1b')]=_0xe84593;if(_0x2dda48[_0x7722('0x2f')][_0x7722('0x40')]){_0xd80179['include']=[{'all':!![]}];}return db['Trigger'][_0x7722('0x41')](_0xd80179);})[_0x7722('0x23')](function(_0x4f5a2c){_0x25388c['rows']=_0x4f5a2c;return _0x25388c;})[_0x7722('0x23')](respondWithFilteredResult(_0x257526,_0xd80179))[_0x7722('0x42')](handleError(_0x257526,null));};exports[_0x7722('0x43')]=function(_0x27bf50,_0x59f45e){var _0x124b54={'raw':![],'where':{'id':_0x27bf50['params']['id']}},_0x5afe80={};_0x5afe80[_0x7722('0x2e')]=_[_0x7722('0x30')](db[_0x7722('0x3f')]['rawAttributes']);_0x5afe80['query']=_[_0x7722('0x30')](_0x27bf50[_0x7722('0x2f')]);_0x5afe80[_0x7722('0x31')]=_[_0x7722('0x32')](_0x5afe80[_0x7722('0x2e')],_0x5afe80[_0x7722('0x2f')]);_0x124b54[_0x7722('0x33')]=_[_0x7722('0x32')](_0x5afe80[_0x7722('0x2e')],qs[_0x7722('0x34')](_0x27bf50[_0x7722('0x2f')][_0x7722('0x34')]));_0x124b54[_0x7722('0x33')]=_0x124b54[_0x7722('0x33')][_0x7722('0x35')]?_0x124b54['attributes']:_0x5afe80[_0x7722('0x2e')];if(_0x27bf50[_0x7722('0x2f')][_0x7722('0x40')]){_0x124b54['include']=[{'all':!![]}];}_0x124b54=_[_0x7722('0x3b')]({},_0x124b54,_0x27bf50['options']);return db[_0x7722('0x3f')][_0x7722('0x44')](_0x124b54)['then'](handleEntityNotFound(_0x59f45e,null))[_0x7722('0x23')](respondWithResult(_0x59f45e,null))[_0x7722('0x42')](handleError(_0x59f45e,null));};exports['create']=function(_0x32ffbc,_0x5b0236){return db[_0x7722('0x3f')]['create'](_0x32ffbc[_0x7722('0x45')],{})[_0x7722('0x23')](function(_0x475fcb){var _0x20ff65=_0x32ffbc['user'][_0x7722('0x46')]({'plain':!![]});if(!_0x20ff65)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x20ff65['role']==='user'){var _0x85e408=_0x475fcb[_0x7722('0x46')]({'plain':!![]});var _0xb2c051='Triggers';return db['UserProfileSection'][_0x7722('0x44')]({'where':{'name':_0xb2c051,'userProfileId':_0x20ff65['userProfileId']},'raw':!![]})['then'](function(_0x10f0db){if(_0x10f0db&&_0x10f0db[_0x7722('0x47')]===0x0){return db[_0x7722('0x25')][_0x7722('0x48')]({'name':_0x85e408[_0x7722('0x27')],'resourceId':_0x85e408['id'],'type':_0x10f0db[_0x7722('0x27')],'sectionId':_0x10f0db['id']},{})[_0x7722('0x23')](function(){return _0x475fcb;});}else{return _0x475fcb;}})[_0x7722('0x42')](function(_0x3d7b89){logger[_0x7722('0x49')](_0x7722('0x4a'),_0x3d7b89);throw _0x3d7b89;});}return _0x475fcb;})[_0x7722('0x23')](respondWithResult(_0x5b0236,0xc9))[_0x7722('0x42')](handleError(_0x5b0236,null));};exports[_0x7722('0x22')]=function(_0x390f95,_0x24b80f){if(_0x390f95[_0x7722('0x45')]['id']){delete _0x390f95['body']['id'];}return db[_0x7722('0x3f')][_0x7722('0x44')]({'where':{'id':_0x390f95[_0x7722('0x4b')]['id']}})['then'](handleEntityNotFound(_0x24b80f,null))['then'](saveUpdates(_0x390f95['body'],null))[_0x7722('0x23')](respondWithResult(_0x24b80f,null))['catch'](handleError(_0x24b80f,null));};exports['destroy']=function(_0x5800b6,_0x2cae4d){return db['Trigger'][_0x7722('0x44')]({'where':{'id':_0x5800b6['params']['id']}})['then'](handleEntityNotFound(_0x2cae4d,null))['then'](removeEntity(_0x2cae4d,null))[_0x7722('0x42')](handleError(_0x2cae4d,null));};exports['addAllCondition']=function(_0x1f37e1,_0x148de6,_0x2f3525){if(_0x1f37e1[_0x7722('0x45')]['id']){delete _0x1f37e1['body']['id'];}return db['Trigger'][_0x7722('0x44')]({'where':{'id':_0x1f37e1['params']['id']}})[_0x7722('0x23')](handleEntityNotFound(_0x148de6,null))[_0x7722('0x23')](function(_0x3a6666){if(_0x3a6666){_0x1f37e1['body'][_0x7722('0x4c')]=_0x3a6666['id'];return db[_0x7722('0x4d')]['create'](_0x1f37e1[_0x7722('0x45')]);}})['then'](respondWithResult(_0x148de6,null))[_0x7722('0x42')](handleError(_0x148de6,null));};exports[_0x7722('0x4e')]=function(_0x23bfd6,_0x21cd8c,_0x1e9c9f){if(_0x23bfd6[_0x7722('0x45')]['id']){delete _0x23bfd6[_0x7722('0x45')]['id'];}return db[_0x7722('0x3f')][_0x7722('0x44')]({'where':{'id':_0x23bfd6['params']['id']}})[_0x7722('0x23')](handleEntityNotFound(_0x21cd8c,null))[_0x7722('0x23')](function(_0x1f33ed){if(_0x1f33ed){_0x23bfd6[_0x7722('0x45')]['TriggerAnyId']=_0x1f33ed['id'];return db[_0x7722('0x4d')][_0x7722('0x48')](_0x23bfd6[_0x7722('0x45')]);}})[_0x7722('0x23')](respondWithResult(_0x21cd8c,null))[_0x7722('0x42')](handleError(_0x21cd8c,null));};exports['getAllConditions']=function(_0x46833a,_0x30eb9b,_0x3fdd87){var _0x438845={};var _0x5ac8d2={};var _0x34aba8;var _0x55d4c7;return db[_0x7722('0x3f')][_0x7722('0x4f')]({'where':{'id':_0x46833a[_0x7722('0x4b')]['id']}})['then'](handleEntityNotFound(_0x30eb9b,null))[_0x7722('0x23')](function(_0x1b5b7c){if(_0x1b5b7c){_0x34aba8=_0x1b5b7c;_0x5ac8d2['model']=_[_0x7722('0x30')](db[_0x7722('0x4d')][_0x7722('0x2a')]);_0x5ac8d2[_0x7722('0x2f')]=_['keys'](_0x46833a[_0x7722('0x2f')]);_0x5ac8d2[_0x7722('0x31')]=_[_0x7722('0x32')](_0x5ac8d2[_0x7722('0x2e')],_0x5ac8d2['query']);_0x438845[_0x7722('0x33')]=_['intersection'](_0x5ac8d2['model'],qs['fields'](_0x46833a['query'][_0x7722('0x34')]));_0x438845['attributes']=_0x438845[_0x7722('0x33')]['length']?_0x438845['attributes']:_0x5ac8d2[_0x7722('0x2e')];_0x438845[_0x7722('0x37')]=qs[_0x7722('0x38')](_0x46833a[_0x7722('0x2f')]['sort']);_0x438845[_0x7722('0x3a')]=qs[_0x7722('0x31')](_[_0x7722('0x39')](_0x46833a[_0x7722('0x2f')],_0x5ac8d2[_0x7722('0x31')]));if(_0x46833a[_0x7722('0x2f')]['filter']){_0x438845['where']=_[_0x7722('0x3b')](_0x438845[_0x7722('0x3a')],{'$or':_['map'](_0x438845[_0x7722('0x33')],function(_0x59da74){var _0x1b4902={};_0x1b4902[_0x59da74]={'$like':'%'+_0x46833a[_0x7722('0x2f')][_0x7722('0x3d')]+'%'};return _0x1b4902;})});}_0x438845=_[_0x7722('0x3b')]({},_0x438845,_0x46833a['options']);return _0x34aba8['getAllConditions'](_0x438845);}})[_0x7722('0x23')](function(_0x5f9101){if(_0x5f9101){_0x55d4c7=_0x5f9101[_0x7722('0x35')];if(!_0x46833a[_0x7722('0x2f')][_0x7722('0x50')](_0x7722('0x36'))){_0x438845['limit']=qs['limit'](_0x46833a[_0x7722('0x2f')][_0x7722('0x19')]);_0x438845[_0x7722('0x18')]=qs[_0x7722('0x18')](_0x46833a[_0x7722('0x2f')][_0x7722('0x18')]);}return _0x34aba8[_0x7722('0x51')](_0x438845);}})[_0x7722('0x23')](function(_0x3db9f0){if(_0x3db9f0){return _0x3db9f0?{'count':_0x55d4c7,'rows':_0x3db9f0}:null;}})[_0x7722('0x23')](respondWithResult(_0x30eb9b,null))[_0x7722('0x42')](handleError(_0x30eb9b,null));};exports[_0x7722('0x52')]=function(_0xd6e805,_0x1a9e42,_0x23c154){var _0x5220ef={};var _0x5e0601={};var _0x47e28c;var _0x2f0d24;return db['Trigger'][_0x7722('0x4f')]({'where':{'id':_0xd6e805[_0x7722('0x4b')]['id']}})[_0x7722('0x23')](handleEntityNotFound(_0x1a9e42,null))[_0x7722('0x23')](function(_0x4a799e){if(_0x4a799e){_0x47e28c=_0x4a799e;_0x5e0601[_0x7722('0x2e')]=_[_0x7722('0x30')](db[_0x7722('0x4d')][_0x7722('0x2a')]);_0x5e0601['query']=_[_0x7722('0x30')](_0xd6e805['query']);_0x5e0601[_0x7722('0x31')]=_['intersection'](_0x5e0601[_0x7722('0x2e')],_0x5e0601[_0x7722('0x2f')]);_0x5220ef[_0x7722('0x33')]=_[_0x7722('0x32')](_0x5e0601[_0x7722('0x2e')],qs[_0x7722('0x34')](_0xd6e805[_0x7722('0x2f')][_0x7722('0x34')]));_0x5220ef[_0x7722('0x33')]=_0x5220ef['attributes'][_0x7722('0x35')]?_0x5220ef[_0x7722('0x33')]:_0x5e0601[_0x7722('0x2e')];_0x5220ef[_0x7722('0x37')]=qs[_0x7722('0x38')](_0xd6e805[_0x7722('0x2f')][_0x7722('0x38')]);_0x5220ef[_0x7722('0x3a')]=qs[_0x7722('0x31')](_[_0x7722('0x39')](_0xd6e805[_0x7722('0x2f')],_0x5e0601[_0x7722('0x31')]));if(_0xd6e805[_0x7722('0x2f')][_0x7722('0x3d')]){_0x5220ef[_0x7722('0x3a')]=_[_0x7722('0x3b')](_0x5220ef[_0x7722('0x3a')],{'$or':_[_0x7722('0x29')](_0x5220ef[_0x7722('0x33')],function(_0x23cc4f){var _0x42c544={};_0x42c544[_0x23cc4f]={'$like':'%'+_0xd6e805[_0x7722('0x2f')]['filter']+'%'};return _0x42c544;})});}_0x5220ef=_['merge']({},_0x5220ef,_0xd6e805[_0x7722('0x3e')]);return _0x47e28c[_0x7722('0x52')](_0x5220ef);}})[_0x7722('0x23')](function(_0x2b3aa2){if(_0x2b3aa2){_0x2f0d24=_0x2b3aa2[_0x7722('0x35')];if(!_0xd6e805[_0x7722('0x2f')][_0x7722('0x50')](_0x7722('0x36'))){_0x5220ef[_0x7722('0x19')]=qs['limit'](_0xd6e805[_0x7722('0x2f')][_0x7722('0x19')]);_0x5220ef[_0x7722('0x18')]=qs[_0x7722('0x18')](_0xd6e805[_0x7722('0x2f')][_0x7722('0x18')]);}return _0x47e28c[_0x7722('0x52')](_0x5220ef);}})[_0x7722('0x23')](function(_0x51630f){if(_0x51630f){return _0x51630f?{'count':_0x2f0d24,'rows':_0x51630f}:null;}})[_0x7722('0x23')](respondWithResult(_0x1a9e42,null))[_0x7722('0x42')](handleError(_0x1a9e42,null));};exports[_0x7722('0x53')]=function(_0x296c24,_0x258699,_0x1ce374){if(_0x296c24[_0x7722('0x45')]['id']){delete _0x296c24[_0x7722('0x45')]['id'];}return db[_0x7722('0x3f')][_0x7722('0x44')]({'where':{'id':_0x296c24[_0x7722('0x4b')]['id']}})[_0x7722('0x23')](handleEntityNotFound(_0x258699,null))[_0x7722('0x23')](function(_0x3709de){if(_0x3709de){_0x296c24[_0x7722('0x45')][_0x7722('0x54')]=_0x3709de['id'];return db[_0x7722('0x55')][_0x7722('0x48')](_0x296c24[_0x7722('0x45')]);}})[_0x7722('0x23')](respondWithResult(_0x258699,null))['catch'](handleError(_0x258699,null));};exports[_0x7722('0x56')]=function(_0x130c11,_0x4b90a2,_0x396619){var _0x4ed576={};var _0xb6143f={};var _0x28ef56;var _0x533956;return db[_0x7722('0x3f')][_0x7722('0x4f')]({'where':{'id':_0x130c11[_0x7722('0x4b')]['id']}})[_0x7722('0x23')](handleEntityNotFound(_0x4b90a2,null))[_0x7722('0x23')](function(_0x50ba83){if(_0x50ba83){_0x28ef56=_0x50ba83;_0xb6143f[_0x7722('0x2e')]=_[_0x7722('0x30')](db['Action']['rawAttributes']);_0xb6143f['query']=_[_0x7722('0x30')](_0x130c11[_0x7722('0x2f')]);_0xb6143f['filters']=_[_0x7722('0x32')](_0xb6143f[_0x7722('0x2e')],_0xb6143f[_0x7722('0x2f')]);_0x4ed576['attributes']=_[_0x7722('0x32')](_0xb6143f[_0x7722('0x2e')],qs[_0x7722('0x34')](_0x130c11[_0x7722('0x2f')]['fields']));_0x4ed576[_0x7722('0x33')]=_0x4ed576[_0x7722('0x33')][_0x7722('0x35')]?_0x4ed576[_0x7722('0x33')]:_0xb6143f[_0x7722('0x2e')];_0x4ed576[_0x7722('0x37')]=qs[_0x7722('0x38')](_0x130c11['query']['sort']);_0x4ed576['where']=qs[_0x7722('0x31')](_[_0x7722('0x39')](_0x130c11[_0x7722('0x2f')],_0xb6143f[_0x7722('0x31')]));if(_0x130c11[_0x7722('0x2f')]['filter']){_0x4ed576[_0x7722('0x3a')]=_[_0x7722('0x3b')](_0x4ed576[_0x7722('0x3a')],{'$or':_[_0x7722('0x29')](_0x4ed576['attributes'],function(_0x3f6027){var _0xa264a7={};_0xa264a7[_0x3f6027]={'$like':'%'+_0x130c11[_0x7722('0x2f')][_0x7722('0x3d')]+'%'};return _0xa264a7;})});}_0x4ed576=_['merge']({},_0x4ed576,_0x130c11[_0x7722('0x3e')]);return _0x28ef56['getActions'](_0x4ed576);}})[_0x7722('0x23')](function(_0x4efdb8){if(_0x4efdb8){_0x533956=_0x4efdb8[_0x7722('0x35')];if(!_0x130c11['query'][_0x7722('0x50')](_0x7722('0x36'))){_0x4ed576[_0x7722('0x19')]=qs[_0x7722('0x19')](_0x130c11['query']['limit']);_0x4ed576['offset']=qs[_0x7722('0x18')](_0x130c11['query'][_0x7722('0x18')]);}return _0x28ef56['getActions'](_0x4ed576);}})[_0x7722('0x23')](function(_0x4a5ad2){if(_0x4a5ad2){return _0x4a5ad2?{'count':_0x533956,'rows':_0x4a5ad2}:null;}})['then'](respondWithResult(_0x4b90a2,null))[_0x7722('0x42')](handleError(_0x4b90a2,null));}; \ No newline at end of file +var _0xf036=['filters','filter','where','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Triggers','UserProfileSection','userProfileId','autoAssociation','Condition','addAnyCondition','getAllConditions','getAnyConditions','findOne','pick','TriggerId','Action','getActions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','end','error','name','send','index','Trigger','rawAttributes','fieldName','type','key','map','query','keys','model','intersection','fields','attributes','length','hasOwnProperty','order','sort'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xf036,0x1f0));var _0x6f03=function(_0x57f46b,_0x508960){_0x57f46b=_0x57f46b-0x0;var _0x2139b0=_0xf036[_0x57f46b];return _0x2139b0;};'use strict';var emlformat=require(_0x6f03('0x0'));var rimraf=require(_0x6f03('0x1'));var zipdir=require(_0x6f03('0x2'));var jsonpatch=require(_0x6f03('0x3'));var rp=require(_0x6f03('0x4'));var moment=require(_0x6f03('0x5'));var BPromise=require(_0x6f03('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x6f03('0x7'));var sox=require(_0x6f03('0x8'));var csv=require(_0x6f03('0x9'));var ejs=require(_0x6f03('0xa'));var fs=require('fs');var fs_extra=require(_0x6f03('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x6f03('0xc'));var jsforce=require(_0x6f03('0xd'));var deskjs=require(_0x6f03('0xe'));var toCsv=require(_0x6f03('0x9'));var querystring=require('querystring');var Papa=require(_0x6f03('0xf'));var Redis=require(_0x6f03('0x10'));var authService=require(_0x6f03('0x11'));var qs=require(_0x6f03('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6f03('0x13'));var logger=require(_0x6f03('0x14'))(_0x6f03('0x15'));var utils=require(_0x6f03('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x6f03('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x50214f,_0x1ad003){_0x1ad003=_0x1ad003||0xcc;return function(_0x340e8b){if(_0x340e8b){return _0x50214f[_0x6f03('0x18')](_0x1ad003);}return _0x50214f[_0x6f03('0x19')](_0x1ad003)['end']();};}function respondWithResult(_0x2cfea9,_0xc74090){_0xc74090=_0xc74090||0xc8;return function(_0x4a413a){if(_0x4a413a){return _0x2cfea9['status'](_0xc74090)[_0x6f03('0x1a')](_0x4a413a);}};}function respondWithFilteredResult(_0xf7fba9,_0x1eee42){return function(_0x27533b){if(_0x27533b){var _0x42e6a9=typeof _0x1eee42[_0x6f03('0x1b')]===_0x6f03('0x1c')&&typeof _0x1eee42['limit']===_0x6f03('0x1c');var _0x46b27b=_0x27533b[_0x6f03('0x1d')];var _0x55ac41=_0x42e6a9?0x0:_0x1eee42[_0x6f03('0x1b')];var _0x1f195e=_0x42e6a9?_0x27533b[_0x6f03('0x1d')]:_0x1eee42[_0x6f03('0x1b')]+_0x1eee42[_0x6f03('0x1e')];var _0x361693;if(_0x1f195e>=_0x46b27b){_0x1f195e=_0x46b27b;_0x361693=0xc8;}else{_0x361693=0xce;}_0xf7fba9[_0x6f03('0x19')](_0x361693);return _0xf7fba9[_0x6f03('0x1f')](_0x6f03('0x20'),_0x55ac41+'-'+_0x1f195e+'/'+_0x46b27b)[_0x6f03('0x1a')](_0x27533b);}return null;};}function patchUpdates(_0x59d9b8){return function(_0xa99fe){try{jsonpatch[_0x6f03('0x21')](_0xa99fe,_0x59d9b8,!![]);}catch(_0x5d985f){return BPromise[_0x6f03('0x22')](_0x5d985f);}return _0xa99fe[_0x6f03('0x23')]();};}function saveUpdates(_0x2409ed,_0x36852e){return function(_0xc344e6){if(_0xc344e6){return _0xc344e6[_0x6f03('0x24')](_0x2409ed)[_0x6f03('0x25')](function(_0x58d824){return _0x58d824;});}return null;};}function removeEntity(_0x53697d,_0x1659dd){return function(_0x5cb82c){if(_0x5cb82c){return _0x5cb82c[_0x6f03('0x26')]()[_0x6f03('0x25')](function(){var _0x53e257=_0x5cb82c[_0x6f03('0x27')]({'plain':!![]});var _0xfb6908='Triggers';return db[_0x6f03('0x28')][_0x6f03('0x26')]({'where':{'type':_0xfb6908,'resourceId':_0x53e257['id']}})[_0x6f03('0x25')](function(){return _0x5cb82c;});})['then'](function(){_0x53697d['status'](0xcc)[_0x6f03('0x29')]();});}};}function handleEntityNotFound(_0x28e519,_0x5bfa03){return function(_0x178763){if(!_0x178763){_0x28e519[_0x6f03('0x18')](0x194);}return _0x178763;};}function handleError(_0x480ddd,_0x309058){_0x309058=_0x309058||0x1f4;return function(_0x2c18e7){logger[_0x6f03('0x2a')](_0x2c18e7['stack']);if(_0x2c18e7[_0x6f03('0x2b')]){delete _0x2c18e7[_0x6f03('0x2b')];}_0x480ddd['status'](_0x309058)[_0x6f03('0x2c')](_0x2c18e7);};}exports[_0x6f03('0x2d')]=function(_0x558935,_0x2bce93){var _0x1dea21={},_0x4b96c0={},_0x38a9b6={'count':0x0,'rows':[]};var _0x42eddf=_['map'](db[_0x6f03('0x2e')][_0x6f03('0x2f')],function(_0x520da4){return{'name':_0x520da4[_0x6f03('0x30')],'type':_0x520da4[_0x6f03('0x31')][_0x6f03('0x32')]};});_0x4b96c0['model']=_[_0x6f03('0x33')](_0x42eddf,_0x6f03('0x2b'));_0x4b96c0[_0x6f03('0x34')]=_[_0x6f03('0x35')](_0x558935['query']);_0x4b96c0['filters']=_['intersection'](_0x4b96c0[_0x6f03('0x36')],_0x4b96c0[_0x6f03('0x34')]);_0x1dea21['attributes']=_[_0x6f03('0x37')](_0x4b96c0[_0x6f03('0x36')],qs['fields'](_0x558935[_0x6f03('0x34')][_0x6f03('0x38')]));_0x1dea21['attributes']=_0x1dea21[_0x6f03('0x39')][_0x6f03('0x3a')]?_0x1dea21[_0x6f03('0x39')]:_0x4b96c0[_0x6f03('0x36')];if(!_0x558935[_0x6f03('0x34')][_0x6f03('0x3b')]('nolimit')){_0x1dea21[_0x6f03('0x1e')]=qs['limit'](_0x558935[_0x6f03('0x34')]['limit']);_0x1dea21[_0x6f03('0x1b')]=qs['offset'](_0x558935[_0x6f03('0x34')][_0x6f03('0x1b')]);}_0x1dea21[_0x6f03('0x3c')]=qs[_0x6f03('0x3d')](_0x558935[_0x6f03('0x34')][_0x6f03('0x3d')]);_0x1dea21['where']=qs[_0x6f03('0x3e')](_['pick'](_0x558935[_0x6f03('0x34')],_0x4b96c0[_0x6f03('0x3e')]),_0x42eddf);if(_0x558935[_0x6f03('0x34')][_0x6f03('0x3f')]){_0x1dea21[_0x6f03('0x40')]=_[_0x6f03('0x41')](_0x1dea21[_0x6f03('0x40')],{'$or':_['map'](_0x42eddf,function(_0x3f0cfc){if(_0x3f0cfc['type']!==_0x6f03('0x42')){var _0x236573={};_0x236573[_0x3f0cfc[_0x6f03('0x2b')]]={'$like':'%'+_0x558935[_0x6f03('0x34')][_0x6f03('0x3f')]+'%'};return _0x236573;}})});}_0x1dea21=_[_0x6f03('0x41')]({},_0x1dea21,_0x558935[_0x6f03('0x43')]);var _0x333138={'where':_0x1dea21[_0x6f03('0x40')]};return db[_0x6f03('0x2e')][_0x6f03('0x1d')](_0x333138)['then'](function(_0x124ef4){_0x38a9b6['count']=_0x124ef4;if(_0x558935[_0x6f03('0x34')][_0x6f03('0x44')]){_0x1dea21['include']=[{'all':!![]}];}return db['Trigger'][_0x6f03('0x45')](_0x1dea21);})['then'](function(_0x13daa2){_0x38a9b6[_0x6f03('0x46')]=_0x13daa2;return _0x38a9b6;})[_0x6f03('0x25')](respondWithFilteredResult(_0x2bce93,_0x1dea21))[_0x6f03('0x47')](handleError(_0x2bce93,null));};exports[_0x6f03('0x48')]=function(_0x1a5798,_0x4aa2ce){var _0x12af7d={'raw':![],'where':{'id':_0x1a5798[_0x6f03('0x49')]['id']}},_0x3b4860={};_0x3b4860[_0x6f03('0x36')]=_[_0x6f03('0x35')](db[_0x6f03('0x2e')][_0x6f03('0x2f')]);_0x3b4860[_0x6f03('0x34')]=_[_0x6f03('0x35')](_0x1a5798[_0x6f03('0x34')]);_0x3b4860['filters']=_['intersection'](_0x3b4860['model'],_0x3b4860[_0x6f03('0x34')]);_0x12af7d['attributes']=_[_0x6f03('0x37')](_0x3b4860[_0x6f03('0x36')],qs[_0x6f03('0x38')](_0x1a5798['query'][_0x6f03('0x38')]));_0x12af7d[_0x6f03('0x39')]=_0x12af7d[_0x6f03('0x39')][_0x6f03('0x3a')]?_0x12af7d[_0x6f03('0x39')]:_0x3b4860[_0x6f03('0x36')];if(_0x1a5798[_0x6f03('0x34')][_0x6f03('0x44')]){_0x12af7d['include']=[{'all':!![]}];}_0x12af7d=_['merge']({},_0x12af7d,_0x1a5798[_0x6f03('0x43')]);return db[_0x6f03('0x2e')][_0x6f03('0x4a')](_0x12af7d)[_0x6f03('0x25')](handleEntityNotFound(_0x4aa2ce,null))[_0x6f03('0x25')](respondWithResult(_0x4aa2ce,null))['catch'](handleError(_0x4aa2ce,null));};exports[_0x6f03('0x4b')]=function(_0x78e428,_0x37c3c8){return db[_0x6f03('0x2e')][_0x6f03('0x4b')](_0x78e428[_0x6f03('0x4c')],{})[_0x6f03('0x25')](function(_0x4039c2){var _0x22a4f5=_0x78e428[_0x6f03('0x4d')][_0x6f03('0x27')]({'plain':!![]});if(!_0x22a4f5)throw new Error(_0x6f03('0x4e'));if(_0x22a4f5[_0x6f03('0x4f')]===_0x6f03('0x4d')){var _0x2c2fd4=_0x4039c2['get']({'plain':!![]});var _0x422b51=_0x6f03('0x50');return db[_0x6f03('0x51')][_0x6f03('0x4a')]({'where':{'name':_0x422b51,'userProfileId':_0x22a4f5[_0x6f03('0x52')]},'raw':!![]})[_0x6f03('0x25')](function(_0x4b4737){if(_0x4b4737&&_0x4b4737[_0x6f03('0x53')]===0x0){return db[_0x6f03('0x28')]['create']({'name':_0x2c2fd4[_0x6f03('0x2b')],'resourceId':_0x2c2fd4['id'],'type':_0x4b4737['name'],'sectionId':_0x4b4737['id']},{})[_0x6f03('0x25')](function(){return _0x4039c2;});}else{return _0x4039c2;}})['catch'](function(_0x10850e){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x10850e);throw _0x10850e;});}return _0x4039c2;})[_0x6f03('0x25')](respondWithResult(_0x37c3c8,0xc9))[_0x6f03('0x47')](handleError(_0x37c3c8,null));};exports['update']=function(_0x4c002c,_0x126c9b){if(_0x4c002c['body']['id']){delete _0x4c002c[_0x6f03('0x4c')]['id'];}return db[_0x6f03('0x2e')][_0x6f03('0x4a')]({'where':{'id':_0x4c002c[_0x6f03('0x49')]['id']}})['then'](handleEntityNotFound(_0x126c9b,null))[_0x6f03('0x25')](saveUpdates(_0x4c002c[_0x6f03('0x4c')],null))['then'](respondWithResult(_0x126c9b,null))[_0x6f03('0x47')](handleError(_0x126c9b,null));};exports['destroy']=function(_0x5a7370,_0x2a756b){return db['Trigger']['find']({'where':{'id':_0x5a7370[_0x6f03('0x49')]['id']}})[_0x6f03('0x25')](handleEntityNotFound(_0x2a756b,null))[_0x6f03('0x25')](removeEntity(_0x2a756b,null))[_0x6f03('0x47')](handleError(_0x2a756b,null));};exports['addAllCondition']=function(_0x4394b7,_0x1abed6,_0x48e063){if(_0x4394b7[_0x6f03('0x4c')]['id']){delete _0x4394b7[_0x6f03('0x4c')]['id'];}return db[_0x6f03('0x2e')]['find']({'where':{'id':_0x4394b7[_0x6f03('0x49')]['id']}})[_0x6f03('0x25')](handleEntityNotFound(_0x1abed6,null))['then'](function(_0x59ed36){if(_0x59ed36){_0x4394b7[_0x6f03('0x4c')]['TriggerAllId']=_0x59ed36['id'];return db[_0x6f03('0x54')][_0x6f03('0x4b')](_0x4394b7[_0x6f03('0x4c')]);}})[_0x6f03('0x25')](respondWithResult(_0x1abed6,null))[_0x6f03('0x47')](handleError(_0x1abed6,null));};exports[_0x6f03('0x55')]=function(_0x43428d,_0x2facd0,_0x4fc944){if(_0x43428d[_0x6f03('0x4c')]['id']){delete _0x43428d[_0x6f03('0x4c')]['id'];}return db[_0x6f03('0x2e')][_0x6f03('0x4a')]({'where':{'id':_0x43428d['params']['id']}})[_0x6f03('0x25')](handleEntityNotFound(_0x2facd0,null))[_0x6f03('0x25')](function(_0x42e53c){if(_0x42e53c){_0x43428d[_0x6f03('0x4c')]['TriggerAnyId']=_0x42e53c['id'];return db[_0x6f03('0x54')][_0x6f03('0x4b')](_0x43428d[_0x6f03('0x4c')]);}})[_0x6f03('0x25')](respondWithResult(_0x2facd0,null))[_0x6f03('0x47')](handleError(_0x2facd0,null));};exports['getAllConditions']=function(_0x5017f7,_0x50d89d,_0x196324){var _0x311e0b={};var _0x124710={};var _0x1a887e;var _0x594bae;return db[_0x6f03('0x2e')]['findOne']({'where':{'id':_0x5017f7['params']['id']}})[_0x6f03('0x25')](handleEntityNotFound(_0x50d89d,null))[_0x6f03('0x25')](function(_0x30c91a){if(_0x30c91a){_0x1a887e=_0x30c91a;_0x124710[_0x6f03('0x36')]=_[_0x6f03('0x35')](db[_0x6f03('0x54')][_0x6f03('0x2f')]);_0x124710[_0x6f03('0x34')]=_[_0x6f03('0x35')](_0x5017f7['query']);_0x124710['filters']=_[_0x6f03('0x37')](_0x124710[_0x6f03('0x36')],_0x124710[_0x6f03('0x34')]);_0x311e0b['attributes']=_['intersection'](_0x124710[_0x6f03('0x36')],qs[_0x6f03('0x38')](_0x5017f7[_0x6f03('0x34')][_0x6f03('0x38')]));_0x311e0b[_0x6f03('0x39')]=_0x311e0b[_0x6f03('0x39')]['length']?_0x311e0b['attributes']:_0x124710['model'];_0x311e0b[_0x6f03('0x3c')]=qs[_0x6f03('0x3d')](_0x5017f7[_0x6f03('0x34')][_0x6f03('0x3d')]);_0x311e0b[_0x6f03('0x40')]=qs['filters'](_['pick'](_0x5017f7[_0x6f03('0x34')],_0x124710[_0x6f03('0x3e')]));if(_0x5017f7[_0x6f03('0x34')][_0x6f03('0x3f')]){_0x311e0b[_0x6f03('0x40')]=_[_0x6f03('0x41')](_0x311e0b[_0x6f03('0x40')],{'$or':_['map'](_0x311e0b[_0x6f03('0x39')],function(_0x42ef6d){var _0x4aa4c9={};_0x4aa4c9[_0x42ef6d]={'$like':'%'+_0x5017f7[_0x6f03('0x34')][_0x6f03('0x3f')]+'%'};return _0x4aa4c9;})});}_0x311e0b=_[_0x6f03('0x41')]({},_0x311e0b,_0x5017f7['options']);return _0x1a887e[_0x6f03('0x56')](_0x311e0b);}})['then'](function(_0x16fd08){if(_0x16fd08){_0x594bae=_0x16fd08[_0x6f03('0x3a')];if(!_0x5017f7[_0x6f03('0x34')][_0x6f03('0x3b')]('nolimit')){_0x311e0b[_0x6f03('0x1e')]=qs[_0x6f03('0x1e')](_0x5017f7['query'][_0x6f03('0x1e')]);_0x311e0b[_0x6f03('0x1b')]=qs[_0x6f03('0x1b')](_0x5017f7[_0x6f03('0x34')][_0x6f03('0x1b')]);}return _0x1a887e['getAllConditions'](_0x311e0b);}})['then'](function(_0x3da882){if(_0x3da882){return _0x3da882?{'count':_0x594bae,'rows':_0x3da882}:null;}})[_0x6f03('0x25')](respondWithResult(_0x50d89d,null))[_0x6f03('0x47')](handleError(_0x50d89d,null));};exports[_0x6f03('0x57')]=function(_0x5574fe,_0x2a6999,_0x328334){var _0x2768ae={};var _0x198124={};var _0x153ce0;var _0x487801;return db[_0x6f03('0x2e')][_0x6f03('0x58')]({'where':{'id':_0x5574fe[_0x6f03('0x49')]['id']}})[_0x6f03('0x25')](handleEntityNotFound(_0x2a6999,null))['then'](function(_0x505b65){if(_0x505b65){_0x153ce0=_0x505b65;_0x198124[_0x6f03('0x36')]=_[_0x6f03('0x35')](db[_0x6f03('0x54')]['rawAttributes']);_0x198124[_0x6f03('0x34')]=_[_0x6f03('0x35')](_0x5574fe[_0x6f03('0x34')]);_0x198124['filters']=_['intersection'](_0x198124[_0x6f03('0x36')],_0x198124[_0x6f03('0x34')]);_0x2768ae[_0x6f03('0x39')]=_[_0x6f03('0x37')](_0x198124[_0x6f03('0x36')],qs['fields'](_0x5574fe[_0x6f03('0x34')][_0x6f03('0x38')]));_0x2768ae[_0x6f03('0x39')]=_0x2768ae['attributes'][_0x6f03('0x3a')]?_0x2768ae[_0x6f03('0x39')]:_0x198124[_0x6f03('0x36')];_0x2768ae['order']=qs[_0x6f03('0x3d')](_0x5574fe['query'][_0x6f03('0x3d')]);_0x2768ae['where']=qs['filters'](_[_0x6f03('0x59')](_0x5574fe[_0x6f03('0x34')],_0x198124[_0x6f03('0x3e')]));if(_0x5574fe[_0x6f03('0x34')][_0x6f03('0x3f')]){_0x2768ae[_0x6f03('0x40')]=_[_0x6f03('0x41')](_0x2768ae['where'],{'$or':_[_0x6f03('0x33')](_0x2768ae[_0x6f03('0x39')],function(_0x262ab1){var _0x3c4b90={};_0x3c4b90[_0x262ab1]={'$like':'%'+_0x5574fe['query'][_0x6f03('0x3f')]+'%'};return _0x3c4b90;})});}_0x2768ae=_['merge']({},_0x2768ae,_0x5574fe[_0x6f03('0x43')]);return _0x153ce0[_0x6f03('0x57')](_0x2768ae);}})['then'](function(_0x921389){if(_0x921389){_0x487801=_0x921389[_0x6f03('0x3a')];if(!_0x5574fe['query'][_0x6f03('0x3b')]('nolimit')){_0x2768ae[_0x6f03('0x1e')]=qs['limit'](_0x5574fe[_0x6f03('0x34')]['limit']);_0x2768ae[_0x6f03('0x1b')]=qs[_0x6f03('0x1b')](_0x5574fe[_0x6f03('0x34')][_0x6f03('0x1b')]);}return _0x153ce0[_0x6f03('0x57')](_0x2768ae);}})[_0x6f03('0x25')](function(_0x5a6e29){if(_0x5a6e29){return _0x5a6e29?{'count':_0x487801,'rows':_0x5a6e29}:null;}})[_0x6f03('0x25')](respondWithResult(_0x2a6999,null))[_0x6f03('0x47')](handleError(_0x2a6999,null));};exports['addAction']=function(_0x67f3bc,_0x57e9a1,_0x426551){if(_0x67f3bc[_0x6f03('0x4c')]['id']){delete _0x67f3bc['body']['id'];}return db['Trigger'][_0x6f03('0x4a')]({'where':{'id':_0x67f3bc[_0x6f03('0x49')]['id']}})[_0x6f03('0x25')](handleEntityNotFound(_0x57e9a1,null))[_0x6f03('0x25')](function(_0x5e477d){if(_0x5e477d){_0x67f3bc[_0x6f03('0x4c')][_0x6f03('0x5a')]=_0x5e477d['id'];return db[_0x6f03('0x5b')][_0x6f03('0x4b')](_0x67f3bc['body']);}})[_0x6f03('0x25')](respondWithResult(_0x57e9a1,null))[_0x6f03('0x47')](handleError(_0x57e9a1,null));};exports['getActions']=function(_0x310c5d,_0x6c0986,_0x5d9f83){var _0x3eafa3={};var _0x2ba7fa={};var _0x236bca;var _0xa22d2a;return db['Trigger'][_0x6f03('0x58')]({'where':{'id':_0x310c5d[_0x6f03('0x49')]['id']}})[_0x6f03('0x25')](handleEntityNotFound(_0x6c0986,null))[_0x6f03('0x25')](function(_0x3b7fd2){if(_0x3b7fd2){_0x236bca=_0x3b7fd2;_0x2ba7fa[_0x6f03('0x36')]=_[_0x6f03('0x35')](db['Action'][_0x6f03('0x2f')]);_0x2ba7fa[_0x6f03('0x34')]=_[_0x6f03('0x35')](_0x310c5d[_0x6f03('0x34')]);_0x2ba7fa[_0x6f03('0x3e')]=_[_0x6f03('0x37')](_0x2ba7fa[_0x6f03('0x36')],_0x2ba7fa[_0x6f03('0x34')]);_0x3eafa3[_0x6f03('0x39')]=_['intersection'](_0x2ba7fa[_0x6f03('0x36')],qs[_0x6f03('0x38')](_0x310c5d[_0x6f03('0x34')][_0x6f03('0x38')]));_0x3eafa3[_0x6f03('0x39')]=_0x3eafa3[_0x6f03('0x39')][_0x6f03('0x3a')]?_0x3eafa3[_0x6f03('0x39')]:_0x2ba7fa[_0x6f03('0x36')];_0x3eafa3[_0x6f03('0x3c')]=qs[_0x6f03('0x3d')](_0x310c5d[_0x6f03('0x34')][_0x6f03('0x3d')]);_0x3eafa3[_0x6f03('0x40')]=qs[_0x6f03('0x3e')](_[_0x6f03('0x59')](_0x310c5d[_0x6f03('0x34')],_0x2ba7fa['filters']));if(_0x310c5d['query']['filter']){_0x3eafa3[_0x6f03('0x40')]=_[_0x6f03('0x41')](_0x3eafa3[_0x6f03('0x40')],{'$or':_[_0x6f03('0x33')](_0x3eafa3[_0x6f03('0x39')],function(_0x24e10e){var _0x81e117={};_0x81e117[_0x24e10e]={'$like':'%'+_0x310c5d[_0x6f03('0x34')]['filter']+'%'};return _0x81e117;})});}_0x3eafa3=_[_0x6f03('0x41')]({},_0x3eafa3,_0x310c5d[_0x6f03('0x43')]);return _0x236bca[_0x6f03('0x5c')](_0x3eafa3);}})[_0x6f03('0x25')](function(_0xcd9cfe){if(_0xcd9cfe){_0xa22d2a=_0xcd9cfe[_0x6f03('0x3a')];if(!_0x310c5d[_0x6f03('0x34')][_0x6f03('0x3b')]('nolimit')){_0x3eafa3[_0x6f03('0x1e')]=qs[_0x6f03('0x1e')](_0x310c5d['query'][_0x6f03('0x1e')]);_0x3eafa3[_0x6f03('0x1b')]=qs[_0x6f03('0x1b')](_0x310c5d[_0x6f03('0x34')][_0x6f03('0x1b')]);}return _0x236bca[_0x6f03('0x5c')](_0x3eafa3);}})[_0x6f03('0x25')](function(_0x29c7d0){if(_0x29c7d0){return _0x29c7d0?{'count':_0xa22d2a,'rows':_0x29c7d0}:null;}})[_0x6f03('0x25')](respondWithResult(_0x6c0986,null))['catch'](handleError(_0x6c0986,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index 7eaafda..8b9c463 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 _0xfd2f=['lodash','util','../../config/logger','moment','request-promise','path','../../config/environment','./trigger.attributes','define','Trigger'];(function(_0x1bf913,_0x1540c9){var _0x24b24b=function(_0x2b3248){while(--_0x2b3248){_0x1bf913['push'](_0x1bf913['shift']());}};_0x24b24b(++_0x1540c9);}(_0xfd2f,0x14a));var _0xffd2=function(_0x54ba7a,_0x126889){_0x54ba7a=_0x54ba7a-0x0;var _0x3011f2=_0xfd2f[_0x54ba7a];return _0x3011f2;};'use strict';var _=require(_0xffd2('0x0'));var util=require(_0xffd2('0x1'));var logger=require(_0xffd2('0x2'))('api');var moment=require(_0xffd2('0x3'));var BPromise=require('bluebird');var rp=require(_0xffd2('0x4'));var fs=require('fs');var path=require(_0xffd2('0x5'));var rimraf=require('rimraf');var config=require(_0xffd2('0x6'));var attributes=require(_0xffd2('0x7'));module['exports']=function(_0x5955d2,_0x490a28){return _0x5955d2[_0xffd2('0x8')](_0xffd2('0x9'),attributes,{'tableName':'tools_triggers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1738=['exports','define','Trigger','tools_triggers','lodash','util','moment','bluebird','request-promise','../../config/environment','./trigger.attributes'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x1738,0x1bc));var _0x8173=function(_0x30981e,_0x35b32b){_0x30981e=_0x30981e-0x0;var _0x45ade2=_0x1738[_0x30981e];return _0x45ade2;};'use strict';var _=require(_0x8173('0x0'));var util=require(_0x8173('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x8173('0x2'));var BPromise=require(_0x8173('0x3'));var rp=require(_0x8173('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x8173('0x5'));var attributes=require(_0x8173('0x6'));module[_0x8173('0x7')]=function(_0x3cf9ac,_0x2220fd){return _0x3cf9ac[_0x8173('0x8')](_0x8173('0x9'),attributes,{'tableName':_0x8173('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 df21e47..43aa424 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 _0x0f27=['jayson/promise','http','request','then','info','Trigger,\x20%s,\x20%s','debug','Trigger,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','findAll','options','raw','where','attributes','limit','include','model','map','GetTrigger','Trigger','find','ShowTrigger','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x5aa0a3,_0x20d59b){var _0x5689cf=function(_0xbeeeca){while(--_0xbeeeca){_0x5aa0a3['push'](_0x5aa0a3['shift']());}};_0x5689cf(++_0x20d59b);}(_0x0f27,0xaf));var _0x70f2=function(_0x4aa7b8,_0xc69b67){_0x4aa7b8=_0x4aa7b8-0x0;var _0x310986=_0x0f27[_0x4aa7b8];return _0x310986;};'use strict';var _=require(_0x70f2('0x0'));var util=require(_0x70f2('0x1'));var moment=require(_0x70f2('0x2'));var BPromise=require(_0x70f2('0x3'));var rs=require(_0x70f2('0x4'));var fs=require('fs');var Redis=require(_0x70f2('0x5'));var db=require(_0x70f2('0x6'))['db'];var utils=require(_0x70f2('0x7'));var logger=require(_0x70f2('0x8'))(_0x70f2('0x9'));var config=require('../../config/environment');var jayson=require(_0x70f2('0xa'));var client=jayson['client'][_0x70f2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x11dedf,_0xf81cc,_0x1df8c5){return new BPromise(function(_0x77353,_0x25c191){return client[_0x70f2('0xc')](_0x11dedf,_0x1df8c5)[_0x70f2('0xd')](function(_0x25c5bb){logger[_0x70f2('0xe')](_0x70f2('0xf'),_0xf81cc,'request\x20sent');logger[_0x70f2('0x10')](_0x70f2('0x11'),_0xf81cc,_0x70f2('0x12'),JSON[_0x70f2('0x13')](_0x25c5bb));if(_0x25c5bb[_0x70f2('0x14')]){if(_0x25c5bb[_0x70f2('0x14')][_0x70f2('0x15')]===0x1f4){logger[_0x70f2('0x14')](_0x70f2('0xf'),_0xf81cc,_0x25c5bb[_0x70f2('0x14')][_0x70f2('0x16')]);return _0x25c191(_0x25c5bb[_0x70f2('0x14')][_0x70f2('0x16')]);}logger[_0x70f2('0x14')](_0x70f2('0xf'),_0xf81cc,_0x25c5bb['error']['message']);return _0x77353(_0x25c5bb[_0x70f2('0x14')][_0x70f2('0x16')]);}else{logger['info']('Trigger,\x20%s,\x20%s',_0xf81cc,_0x70f2('0x12'));_0x77353(_0x25c5bb['result'][_0x70f2('0x16')]);}})[_0x70f2('0x17')](function(_0x361b7f){logger['error'](_0x70f2('0xf'),_0xf81cc,_0x361b7f);_0x25c191(_0x361b7f);});});}exports['GetTrigger']=function(_0x41274e){var _0x45c719=this;return new Promise(function(_0x1bbdd8,_0x1e3125){return db['Trigger'][_0x70f2('0x18')]({'raw':_0x41274e[_0x70f2('0x19')]?_0x41274e[_0x70f2('0x19')][_0x70f2('0x1a')]===undefined?!![]:![]:!![],'where':_0x41274e['options']?_0x41274e[_0x70f2('0x19')][_0x70f2('0x1b')]||null:null,'attributes':_0x41274e[_0x70f2('0x19')]?_0x41274e[_0x70f2('0x19')][_0x70f2('0x1c')]||null:null,'limit':_0x41274e['options']?_0x41274e['options'][_0x70f2('0x1d')]||null:null,'include':_0x41274e[_0x70f2('0x19')]?_0x41274e[_0x70f2('0x19')][_0x70f2('0x1e')]?_['map'](_0x41274e['options'][_0x70f2('0x1e')],function(_0x11eb83){return{'model':db[_0x11eb83[_0x70f2('0x1f')]],'as':_0x11eb83['as'],'attributes':_0x11eb83[_0x70f2('0x1c')],'include':_0x11eb83[_0x70f2('0x1e')]?_[_0x70f2('0x20')](_0x11eb83[_0x70f2('0x1e')],function(_0x43b98a){return{'model':db[_0x43b98a[_0x70f2('0x1f')]],'as':_0x43b98a['as'],'attributes':_0x43b98a['attributes'],'include':_0x43b98a['include']?_[_0x70f2('0x20')](_0x43b98a[_0x70f2('0x1e')],function(_0x409368){return{'model':db[_0x409368['model']],'as':_0x409368['as'],'attributes':_0x409368['attributes']};}):[]};}):[]};}):[]:[]})[_0x70f2('0xd')](function(_0x368baf){logger[_0x70f2('0xe')](_0x70f2('0x21'),_0x41274e);logger[_0x70f2('0x10')](_0x70f2('0x21'),_0x41274e,JSON[_0x70f2('0x13')](_0x368baf));_0x1bbdd8(_0x368baf);})[_0x70f2('0x17')](function(_0x2bd691){logger['error'](_0x70f2('0x21'),_0x2bd691[_0x70f2('0x16')],_0x41274e);_0x1e3125(_0x45c719[_0x70f2('0x14')](0x1f4,_0x2bd691[_0x70f2('0x16')]));});});};exports['ShowTrigger']=function(_0x18df49){var _0x390cb8=this;return new Promise(function(_0x44a1b9,_0x2bc856){return db[_0x70f2('0x22')][_0x70f2('0x23')]({'raw':_0x18df49[_0x70f2('0x19')]?_0x18df49[_0x70f2('0x19')][_0x70f2('0x1a')]===undefined?!![]:![]:!![],'where':_0x18df49[_0x70f2('0x19')]?_0x18df49[_0x70f2('0x19')][_0x70f2('0x1b')]||null:null,'attributes':_0x18df49[_0x70f2('0x19')]?_0x18df49[_0x70f2('0x19')]['attributes']||null:null,'include':_0x18df49[_0x70f2('0x19')]?_0x18df49['options'][_0x70f2('0x1e')]?_[_0x70f2('0x20')](_0x18df49[_0x70f2('0x19')][_0x70f2('0x1e')],function(_0x449aa4){return{'model':db[_0x449aa4[_0x70f2('0x1f')]],'as':_0x449aa4['as'],'attributes':_0x449aa4[_0x70f2('0x1c')],'include':_0x449aa4[_0x70f2('0x1e')]?_[_0x70f2('0x20')](_0x449aa4[_0x70f2('0x1e')],function(_0x31eaaf){return{'model':db[_0x31eaaf[_0x70f2('0x1f')]],'as':_0x31eaaf['as'],'attributes':_0x31eaaf[_0x70f2('0x1c')],'include':_0x31eaaf[_0x70f2('0x1e')]?_[_0x70f2('0x20')](_0x31eaaf[_0x70f2('0x1e')],function(_0x448ab6){return{'model':db[_0x448ab6[_0x70f2('0x1f')]],'as':_0x448ab6['as'],'attributes':_0x448ab6[_0x70f2('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xe6f079){logger[_0x70f2('0xe')](_0x70f2('0x24'),_0x18df49);logger[_0x70f2('0x10')](_0x70f2('0x24'),_0x18df49,JSON['stringify'](_0xe6f079));_0x44a1b9(_0xe6f079);})['catch'](function(_0x29c466){logger[_0x70f2('0x14')]('ShowTrigger',_0x29c466[_0x70f2('0x16')],_0x18df49);_0x2bc856(_0x390cb8[_0x70f2('0x14')](0x1f4,_0x29c466['message']));});});}; \ No newline at end of file +var _0xbed1=['result','catch','Trigger,\x20%s,\x20%s','findAll','options','raw','where','attributes','limit','include','map','model','then','GetTrigger','ShowTrigger','Trigger','find','stringify','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','request\x20sent','debug','error','code','message'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbed1,0x1c2));var _0x1bed=function(_0x3f8282,_0x11b607){_0x3f8282=_0x3f8282-0x0;var _0x50f918=_0xbed1[_0x3f8282];return _0x50f918;};'use strict';var _=require(_0x1bed('0x0'));var util=require('util');var moment=require(_0x1bed('0x1'));var BPromise=require(_0x1bed('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1bed('0x3'));var db=require(_0x1bed('0x4'))['db'];var utils=require(_0x1bed('0x5'));var logger=require(_0x1bed('0x6'))(_0x1bed('0x7'));var config=require(_0x1bed('0x8'));var jayson=require(_0x1bed('0x9'));var client=jayson['client'][_0x1bed('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x27f309,_0x3956c9,_0x479340){return new BPromise(function(_0x2afa33,_0x1c906d){return client[_0x1bed('0xb')](_0x27f309,_0x479340)['then'](function(_0x10407){logger[_0x1bed('0xc')]('Trigger,\x20%s,\x20%s',_0x3956c9,_0x1bed('0xd'));logger[_0x1bed('0xe')]('Trigger,\x20%s,\x20%s,\x20%s',_0x3956c9,_0x1bed('0xd'),JSON['stringify'](_0x10407));if(_0x10407[_0x1bed('0xf')]){if(_0x10407[_0x1bed('0xf')][_0x1bed('0x10')]===0x1f4){logger['error']('Trigger,\x20%s,\x20%s',_0x3956c9,_0x10407[_0x1bed('0xf')]['message']);return _0x1c906d(_0x10407[_0x1bed('0xf')][_0x1bed('0x11')]);}logger[_0x1bed('0xf')]('Trigger,\x20%s,\x20%s',_0x3956c9,_0x10407[_0x1bed('0xf')][_0x1bed('0x11')]);return _0x2afa33(_0x10407['error'][_0x1bed('0x11')]);}else{logger[_0x1bed('0xc')]('Trigger,\x20%s,\x20%s',_0x3956c9,_0x1bed('0xd'));_0x2afa33(_0x10407[_0x1bed('0x12')]['message']);}})[_0x1bed('0x13')](function(_0x6f92b4){logger[_0x1bed('0xf')](_0x1bed('0x14'),_0x3956c9,_0x6f92b4);_0x1c906d(_0x6f92b4);});});}exports['GetTrigger']=function(_0x5844b3){var _0x1acaa9=this;return new Promise(function(_0x3d32af,_0x523797){return db['Trigger'][_0x1bed('0x15')]({'raw':_0x5844b3[_0x1bed('0x16')]?_0x5844b3[_0x1bed('0x16')][_0x1bed('0x17')]===undefined?!![]:![]:!![],'where':_0x5844b3[_0x1bed('0x16')]?_0x5844b3['options'][_0x1bed('0x18')]||null:null,'attributes':_0x5844b3['options']?_0x5844b3[_0x1bed('0x16')][_0x1bed('0x19')]||null:null,'limit':_0x5844b3[_0x1bed('0x16')]?_0x5844b3['options'][_0x1bed('0x1a')]||null:null,'include':_0x5844b3['options']?_0x5844b3[_0x1bed('0x16')][_0x1bed('0x1b')]?_[_0x1bed('0x1c')](_0x5844b3[_0x1bed('0x16')][_0x1bed('0x1b')],function(_0x173356){return{'model':db[_0x173356[_0x1bed('0x1d')]],'as':_0x173356['as'],'attributes':_0x173356[_0x1bed('0x19')],'include':_0x173356[_0x1bed('0x1b')]?_[_0x1bed('0x1c')](_0x173356[_0x1bed('0x1b')],function(_0x321239){return{'model':db[_0x321239['model']],'as':_0x321239['as'],'attributes':_0x321239[_0x1bed('0x19')],'include':_0x321239[_0x1bed('0x1b')]?_[_0x1bed('0x1c')](_0x321239['include'],function(_0x31e420){return{'model':db[_0x31e420[_0x1bed('0x1d')]],'as':_0x31e420['as'],'attributes':_0x31e420[_0x1bed('0x19')]};}):[]};}):[]};}):[]:[]})[_0x1bed('0x1e')](function(_0x40598a){logger[_0x1bed('0xc')](_0x1bed('0x1f'),_0x5844b3);logger[_0x1bed('0xe')](_0x1bed('0x1f'),_0x5844b3,JSON['stringify'](_0x40598a));_0x3d32af(_0x40598a);})['catch'](function(_0x685b60){logger[_0x1bed('0xf')](_0x1bed('0x1f'),_0x685b60[_0x1bed('0x11')],_0x5844b3);_0x523797(_0x1acaa9[_0x1bed('0xf')](0x1f4,_0x685b60[_0x1bed('0x11')]));});});};exports[_0x1bed('0x20')]=function(_0x287a71){var _0x13e82a=this;return new Promise(function(_0x215c3f,_0x4d1438){return db[_0x1bed('0x21')][_0x1bed('0x22')]({'raw':_0x287a71[_0x1bed('0x16')]?_0x287a71[_0x1bed('0x16')][_0x1bed('0x17')]===undefined?!![]:![]:!![],'where':_0x287a71[_0x1bed('0x16')]?_0x287a71[_0x1bed('0x16')]['where']||null:null,'attributes':_0x287a71['options']?_0x287a71[_0x1bed('0x16')]['attributes']||null:null,'include':_0x287a71[_0x1bed('0x16')]?_0x287a71['options'][_0x1bed('0x1b')]?_[_0x1bed('0x1c')](_0x287a71[_0x1bed('0x16')][_0x1bed('0x1b')],function(_0x2e46f9){return{'model':db[_0x2e46f9[_0x1bed('0x1d')]],'as':_0x2e46f9['as'],'attributes':_0x2e46f9[_0x1bed('0x19')],'include':_0x2e46f9[_0x1bed('0x1b')]?_['map'](_0x2e46f9[_0x1bed('0x1b')],function(_0x57a6f3){return{'model':db[_0x57a6f3[_0x1bed('0x1d')]],'as':_0x57a6f3['as'],'attributes':_0x57a6f3[_0x1bed('0x19')],'include':_0x57a6f3['include']?_['map'](_0x57a6f3[_0x1bed('0x1b')],function(_0x303037){return{'model':db[_0x303037[_0x1bed('0x1d')]],'as':_0x303037['as'],'attributes':_0x303037[_0x1bed('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5391e8){logger[_0x1bed('0xc')](_0x1bed('0x20'),_0x287a71);logger[_0x1bed('0xe')]('ShowTrigger',_0x287a71,JSON[_0x1bed('0x23')](_0x5391e8));_0x215c3f(_0x5391e8);})[_0x1bed('0x13')](function(_0x406bcd){logger['error']('ShowTrigger',_0x406bcd[_0x1bed('0x11')],_0x287a71);_0x4d1438(_0x13e82a[_0x1bed('0xf')](0x1f4,_0x406bcd[_0x1bed('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index c2700a9..013e702 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 _0x35c0=['/:id/clone','clone','post','create','put','update','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./trunk.controller','get','isAuthenticated','index','/:id'];(function(_0x87b0ff,_0x314389){var _0x3bc0b2=function(_0x41682b){while(--_0x41682b){_0x87b0ff['push'](_0x87b0ff['shift']());}};_0x3bc0b2(++_0x314389);}(_0x35c0,0x9a));var _0x035c=function(_0x18f9e1,_0x2763b3){_0x18f9e1=_0x18f9e1-0x0;var _0x61a32d=_0x35c0[_0x18f9e1];return _0x61a32d;};'use strict';var multer=require(_0x035c('0x0'));var util=require(_0x035c('0x1'));var path=require(_0x035c('0x2'));var timeout=require(_0x035c('0x3'));var express=require(_0x035c('0x4'));var router=express[_0x035c('0x5')]();var fs_extra=require(_0x035c('0x6'));var auth=require(_0x035c('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x035c('0x8'));var controller=require(_0x035c('0x9'));router[_0x035c('0xa')]('/',auth[_0x035c('0xb')](),controller[_0x035c('0xc')]);router[_0x035c('0xa')](_0x035c('0xd'),auth[_0x035c('0xb')](),controller['show']);router['post'](_0x035c('0xe'),auth['isAuthenticated'](),controller[_0x035c('0xf')]);router[_0x035c('0x10')]('/',auth[_0x035c('0xb')](),controller[_0x035c('0x11')]);router[_0x035c('0x12')](_0x035c('0xd'),auth[_0x035c('0xb')](),controller[_0x035c('0x13')]);router['delete'](_0x035c('0xd'),auth[_0x035c('0xb')](),controller['destroy']);module[_0x035c('0x14')]=router; \ No newline at end of file +var _0x2c43=['get','isAuthenticated','index','post','put','update','delete','/:id','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./trunk.controller'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x2c43,0xbd));var _0x32c4=function(_0xb042ac,_0x1541c5){_0xb042ac=_0xb042ac-0x0;var _0x34dc6c=_0x2c43[_0xb042ac];return _0x34dc6c;};'use strict';var multer=require(_0x32c4('0x0'));var util=require('util');var path=require(_0x32c4('0x1'));var timeout=require(_0x32c4('0x2'));var express=require(_0x32c4('0x3'));var router=express[_0x32c4('0x4')]();var fs_extra=require(_0x32c4('0x5'));var auth=require(_0x32c4('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x32c4('0x7'));var controller=require(_0x32c4('0x8'));router[_0x32c4('0x9')]('/',auth[_0x32c4('0xa')](),controller[_0x32c4('0xb')]);router[_0x32c4('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x32c4('0xc')]('/:id/clone',auth['isAuthenticated'](),controller['clone']);router[_0x32c4('0xc')]('/',auth[_0x32c4('0xa')](),controller['create']);router[_0x32c4('0xd')]('/:id',auth[_0x32c4('0xa')](),controller[_0x32c4('0xe')]);router[_0x32c4('0xf')](_0x32c4('0x10'),auth['isAuthenticated'](),controller['destroy']);module[_0x32c4('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 b0dbe12..8822cc5 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 _0x9b24=['name','ENUM','friend','peer','STRING','from-voip-provider','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','udp','setDataValue','join','transport','getDataValue','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','inband','yes','update','force_rport,comedia','nat','split','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','\x22\x22\x20<>','accept','refuse','originate','INTEGER','uac','uas','fingerprint','certificate','active','passive','actpass','dynamic','nonat','BOOLEAN','exports'];(function(_0x3c80c3,_0x40e427){var _0x5ce977=function(_0x3c355b){while(--_0x3c355b){_0x3c80c3['push'](_0x3c80c3['shift']());}};_0x5ce977(++_0x40e427);}(_0x9b24,0x92));var _0x49b2=function(_0x36dfa0,_0x4d87d){_0x36dfa0=_0x36dfa0-0x0;var _0x3796c7=_0x9b24[_0x36dfa0];return _0x3796c7;};'use strict';var Sequelize=require('sequelize');module[_0x49b2('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x49b2('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x49b2('0x2')](_0x49b2('0x3'),'user',_0x49b2('0x4')),'allowNull':![],'defaultValue':_0x49b2('0x3')},'context':{'type':Sequelize[_0x49b2('0x5')],'allowNull':![],'defaultValue':_0x49b2('0x6')},'callingpres':{'type':Sequelize[_0x49b2('0x2')](_0x49b2('0x7'),_0x49b2('0x8'),'ALLOWED_FAILED_SCREEN',_0x49b2('0x9'),_0x49b2('0xa'),_0x49b2('0xb'),'PROHIB_FAILED_SCREEN','PROHIB')},'deny':{'type':Sequelize['STRING']},'permit':{'type':Sequelize['STRING']},'secret':{'type':Sequelize[_0x49b2('0x5')]},'md5secret':{'type':Sequelize[_0x49b2('0x5')]},'remotesecret':{'type':Sequelize[_0x49b2('0x5')]},'transport':{'type':Sequelize[_0x49b2('0x5')],'defaultValue':_0x49b2('0xc'),'set':function(_0x429dfa){this[_0x49b2('0xd')]('transport',_0x429dfa?_0x429dfa[_0x49b2('0xe')](','):null);},'get':function(){return this['getDataValue'](_0x49b2('0xf'))?this[_0x49b2('0x10')](_0x49b2('0xf'))['split'](','):null;},'comment':_0x49b2('0x11')},'dtmfmode':{'type':Sequelize['ENUM'](_0x49b2('0x12'),_0x49b2('0x13'),_0x49b2('0x14'),_0x49b2('0x15'),'auto'),'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize[_0x49b2('0x2')](_0x49b2('0x16'),'no','nonat',_0x49b2('0x17'),'outgoing'),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x49b2('0x2')](_0x49b2('0x16'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x49b2('0x5')]},'directmediadeny':{'type':Sequelize[_0x49b2('0x5')]},'nat':{'type':Sequelize[_0x49b2('0x5')],'defaultValue':_0x49b2('0x18'),'set':function(_0x331e3f){this[_0x49b2('0xd')](_0x49b2('0x19'),_0x331e3f?_0x331e3f[_0x49b2('0xe')](','):null);},'get':function(){return this[_0x49b2('0x10')](_0x49b2('0x19'))?this[_0x49b2('0x10')](_0x49b2('0x19'))[_0x49b2('0x1a')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0x49b2('0x5')]},'namedcallgroup':{'type':Sequelize[_0x49b2('0x5')]},'pickupgroup':{'type':Sequelize[_0x49b2('0x5')]},'namedpickupgroup':{'type':Sequelize[_0x49b2('0x5')]},'language':{'type':Sequelize[_0x49b2('0x5')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x49b2('0x5')],'allowNull':!![]},'disallow':{'type':Sequelize[_0x49b2('0x5')],'defaultValue':_0x49b2('0x1b')},'allow':{'type':Sequelize[_0x49b2('0x5')],'allowNull':![],'defaultValue':_0x49b2('0x1c'),'set':function(_0x167854){this[_0x49b2('0xd')]('allow',_0x167854?_0x167854[_0x49b2('0xe')](';'):_0x49b2('0x1c'));},'get':function(){return this[_0x49b2('0x10')](_0x49b2('0x1d'))?this[_0x49b2('0x10')](_0x49b2('0x1d'))[_0x49b2('0x1a')](';'):null;},'comment':_0x49b2('0x1e')},'autoframing':{'type':Sequelize[_0x49b2('0x2')]('yes','no')},'insecure':{'type':Sequelize['STRING'],'defaultValue':'port,invite','set':function(_0x7122d8){this['setDataValue'](_0x49b2('0x1f'),_0x7122d8?_0x7122d8[_0x49b2('0xe')](','):null);},'get':function(){return this[_0x49b2('0x10')](_0x49b2('0x1f'))?this[_0x49b2('0x10')](_0x49b2('0x1f'))['split'](','):null;},'comment':_0x49b2('0x20')},'trustrpid':{'type':Sequelize[_0x49b2('0x2')]('yes','no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x49b2('0x2')](_0x49b2('0x16'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x49b2('0x2')](_0x49b2('0x16'),'no',_0x49b2('0x21'))},'promiscredir':{'type':Sequelize[_0x49b2('0x2')]('yes','no')},'useclientcode':{'type':Sequelize['ENUM'](_0x49b2('0x16'),'no')},'accountcode':{'type':Sequelize['INTEGER'](0xb)},'setvar':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x49b2('0x5')],'defaultValue':_0x49b2('0x22')},'amaflags':{'type':Sequelize[_0x49b2('0x5')]},'callcounter':{'type':Sequelize['ENUM'](_0x49b2('0x16'),'no'),'defaultValue':'yes'},'busylevel':{'type':Sequelize['INTEGER'](0xb)},'allowoverlap':{'type':Sequelize[_0x49b2('0x2')](_0x49b2('0x16'),'no')},'allowsubscribe':{'type':Sequelize['ENUM'](_0x49b2('0x16'),'no')},'allowtransfer':{'type':Sequelize[_0x49b2('0x2')](_0x49b2('0x16'),'no')},'ignoresdpversion':{'type':Sequelize[_0x49b2('0x2')](_0x49b2('0x16'),'no')},'subscribecontext':{'type':Sequelize[_0x49b2('0x5')]},'template':{'type':Sequelize[_0x49b2('0x5')]},'videosupport':{'type':Sequelize[_0x49b2('0x2')](_0x49b2('0x16'),'no','always'),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb)},'rfc2833compensate':{'type':Sequelize['ENUM'](_0x49b2('0x16'),'no')},'mailbox':{'type':Sequelize[_0x49b2('0x5')]},'session_timers':{'type':Sequelize['ENUM'](_0x49b2('0x23'),_0x49b2('0x24'),_0x49b2('0x25'))},'session_expires':{'type':Sequelize[_0x49b2('0x26')](0xb)},'session_minse':{'type':Sequelize['INTEGER'](0xb)},'session_refresher':{'type':Sequelize[_0x49b2('0x2')](_0x49b2('0x27'),_0x49b2('0x28')),'defaultValue':_0x49b2('0x28')},'t38pt_usertpsource':{'type':Sequelize[_0x49b2('0x5')]},'regexten':{'type':Sequelize['STRING']},'fromdomain':{'type':Sequelize['STRING']},'fromuser':{'type':Sequelize[_0x49b2('0x5')]},'port':{'type':Sequelize[_0x49b2('0x26')](0x5)},'qualify':{'type':Sequelize['ENUM'](_0x49b2('0x16'),'no'),'defaultValue':_0x49b2('0x16')},'keepalive':{'type':Sequelize['INTEGER'](0xb)},'defaultip':{'type':Sequelize[_0x49b2('0x5')]},'defaultuser':{'type':Sequelize[_0x49b2('0x5')]},'rtptimeout':{'type':Sequelize[_0x49b2('0x26')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0x49b2('0x26')](0xb)},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb)},'sendrpid':{'type':Sequelize['ENUM'](_0x49b2('0x16'),'no','pai'),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x49b2('0x5')]},'callbackextension':{'type':Sequelize[_0x49b2('0x5')]},'timert1':{'type':Sequelize[_0x49b2('0x26')](0xb)},'timerb':{'type':Sequelize['INTEGER'](0xb)},'qualifyfreq':{'type':Sequelize[_0x49b2('0x26')](0xb)},'contactpermit':{'type':Sequelize['STRING']},'contactdeny':{'type':Sequelize[_0x49b2('0x5')]},'contactacl':{'type':Sequelize[_0x49b2('0x5')]},'unsolicited_mailbox':{'type':Sequelize[_0x49b2('0x5')]},'use_q850_reason':{'type':Sequelize['STRING']},'maxforwards':{'type':Sequelize[_0x49b2('0x26')](0xb)},'encryption':{'type':Sequelize['ENUM'](_0x49b2('0x16'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x49b2('0x2')](_0x49b2('0x16'),'no')},'force_avp':{'type':Sequelize['ENUM'](_0x49b2('0x16'),'no')},'icesupport':{'type':Sequelize[_0x49b2('0x2')]('yes','no')},'dtlsenable':{'type':Sequelize[_0x49b2('0x2')](_0x49b2('0x16'),'no')},'dtlsverify':{'type':Sequelize[_0x49b2('0x2')](_0x49b2('0x16'),'no',_0x49b2('0x29'),_0x49b2('0x2a'))},'dtlsrekey':{'type':Sequelize[_0x49b2('0x26')](0xb)},'dtlscertfile':{'type':Sequelize[_0x49b2('0x5')]},'dtlsprivatekey':{'type':Sequelize[_0x49b2('0x5')]},'dtlscipher':{'type':Sequelize[_0x49b2('0x5')]},'dtlscafile':{'type':Sequelize['STRING']},'dtlscapath':{'type':Sequelize['STRING']},'dtlssetup':{'type':Sequelize[_0x49b2('0x2')](_0x49b2('0x2b'),_0x49b2('0x2c'),_0x49b2('0x2d')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x49b2('0x5')]},'usereqphone':{'type':Sequelize[_0x49b2('0x2')](_0x49b2('0x16'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x49b2('0x5')]},'recordofffeature':{'type':Sequelize[_0x49b2('0x5')]},'call_limit':{'type':Sequelize[_0x49b2('0x26')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0x49b2('0x2')](_0x49b2('0x16'),'no')},'subscribemwi':{'type':Sequelize[_0x49b2('0x2')]('yes','no')},'vmexten':{'type':Sequelize[_0x49b2('0x5')]},'mohinterpret':{'type':Sequelize[_0x49b2('0x5')]},'mohsuggest':{'type':Sequelize['STRING']},'parkinglot':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0x49b2('0x5')],'defaultValue':_0x49b2('0x2e')},'canreinvite':{'type':Sequelize[_0x49b2('0x2')]('yes','no',_0x49b2('0x2f'),_0x49b2('0x17'),'update,nonat'),'defaultValue':'no'},'registry':{'type':Sequelize[_0x49b2('0x5')]},'otherFields':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0x49b2('0x30')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x49b2('0x5')],'defaultValue':'no'}}; \ No newline at end of file +var _0xd4a0=['allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','port,invite','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','INTEGER','\x22\x22\x20<>','always','refuse','originate','uac','uas','pai','fingerprint','certificate','passive','actpass','nonat','sequelize','exports','STRING','name','friend','peer','from-voip-provider','ENUM','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_FAILED_SCREEN','PROHIB','udp','transport','join','getDataValue','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','auto','yes','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'];(function(_0x570e70,_0x379463){var _0x2a7be9=function(_0x537fc9){while(--_0x537fc9){_0x570e70['push'](_0x570e70['shift']());}};_0x2a7be9(++_0x379463);}(_0xd4a0,0x1e7));var _0x0d4a=function(_0x346f7b,_0x1ba839){_0x346f7b=_0x346f7b-0x0;var _0x1adb65=_0xd4a0[_0x346f7b];return _0x1adb65;};'use strict';var Sequelize=require(_0x0d4a('0x0'));module[_0x0d4a('0x1')]={'name':{'type':Sequelize[_0x0d4a('0x2')],'allowNull':![],'unique':_0x0d4a('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM'](_0x0d4a('0x4'),'user',_0x0d4a('0x5')),'allowNull':![],'defaultValue':_0x0d4a('0x4')},'context':{'type':Sequelize[_0x0d4a('0x2')],'allowNull':![],'defaultValue':_0x0d4a('0x6')},'callingpres':{'type':Sequelize[_0x0d4a('0x7')](_0x0d4a('0x8'),_0x0d4a('0x9'),_0x0d4a('0xa'),_0x0d4a('0xb'),_0x0d4a('0xc'),'PROHIB_PASSED_SCREEN',_0x0d4a('0xd'),_0x0d4a('0xe'))},'deny':{'type':Sequelize['STRING']},'permit':{'type':Sequelize['STRING']},'secret':{'type':Sequelize['STRING']},'md5secret':{'type':Sequelize['STRING']},'remotesecret':{'type':Sequelize[_0x0d4a('0x2')]},'transport':{'type':Sequelize[_0x0d4a('0x2')],'defaultValue':_0x0d4a('0xf'),'set':function(_0x306aa8){this['setDataValue'](_0x0d4a('0x10'),_0x306aa8?_0x306aa8[_0x0d4a('0x11')](','):null);},'get':function(){return this[_0x0d4a('0x12')](_0x0d4a('0x10'))?this[_0x0d4a('0x12')](_0x0d4a('0x10'))[_0x0d4a('0x13')](','):null;},'comment':_0x0d4a('0x14')},'dtmfmode':{'type':Sequelize['ENUM'](_0x0d4a('0x15'),_0x0d4a('0x16'),'shortinfo','inband',_0x0d4a('0x17')),'defaultValue':_0x0d4a('0x15')},'directmedia':{'type':Sequelize[_0x0d4a('0x7')](_0x0d4a('0x18'),'no','nonat',_0x0d4a('0x19'),_0x0d4a('0x1a')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x0d4a('0x7')]('yes','no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING']},'directmediadeny':{'type':Sequelize[_0x0d4a('0x2')]},'nat':{'type':Sequelize[_0x0d4a('0x2')],'defaultValue':_0x0d4a('0x1b'),'set':function(_0x569b3d){this[_0x0d4a('0x1c')](_0x0d4a('0x1d'),_0x569b3d?_0x569b3d['join'](','):null);},'get':function(){return this[_0x0d4a('0x12')](_0x0d4a('0x1d'))?this['getDataValue'](_0x0d4a('0x1d'))[_0x0d4a('0x13')](','):null;},'comment':_0x0d4a('0x1e')},'callgroup':{'type':Sequelize['STRING']},'namedcallgroup':{'type':Sequelize[_0x0d4a('0x2')]},'pickupgroup':{'type':Sequelize[_0x0d4a('0x2')]},'namedpickupgroup':{'type':Sequelize[_0x0d4a('0x2')]},'language':{'type':Sequelize[_0x0d4a('0x2')],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING'],'allowNull':!![]},'disallow':{'type':Sequelize[_0x0d4a('0x2')],'defaultValue':_0x0d4a('0x1f')},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x0d4a('0x20'),'set':function(_0x5e8b3f){this[_0x0d4a('0x1c')](_0x0d4a('0x21'),_0x5e8b3f?_0x5e8b3f[_0x0d4a('0x11')](';'):_0x0d4a('0x20'));},'get':function(){return this[_0x0d4a('0x12')](_0x0d4a('0x21'))?this[_0x0d4a('0x12')](_0x0d4a('0x21'))['split'](';'):null;},'comment':_0x0d4a('0x22')},'autoframing':{'type':Sequelize[_0x0d4a('0x7')]('yes','no')},'insecure':{'type':Sequelize[_0x0d4a('0x2')],'defaultValue':_0x0d4a('0x23'),'set':function(_0x27c4d2){this[_0x0d4a('0x1c')](_0x0d4a('0x24'),_0x27c4d2?_0x27c4d2[_0x0d4a('0x11')](','):null);},'get':function(){return this[_0x0d4a('0x12')](_0x0d4a('0x24'))?this['getDataValue'](_0x0d4a('0x24'))['split'](','):null;},'comment':_0x0d4a('0x25')},'trustrpid':{'type':Sequelize[_0x0d4a('0x7')]('yes','no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x0d4a('0x7')]('yes','no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x0d4a('0x7')](_0x0d4a('0x18'),'no',_0x0d4a('0x26'))},'promiscredir':{'type':Sequelize['ENUM'](_0x0d4a('0x18'),'no')},'useclientcode':{'type':Sequelize[_0x0d4a('0x7')](_0x0d4a('0x18'),'no')},'accountcode':{'type':Sequelize[_0x0d4a('0x27')](0xb)},'setvar':{'type':Sequelize[_0x0d4a('0x2')]},'callerid':{'type':Sequelize[_0x0d4a('0x2')],'defaultValue':_0x0d4a('0x28')},'amaflags':{'type':Sequelize[_0x0d4a('0x2')]},'callcounter':{'type':Sequelize[_0x0d4a('0x7')](_0x0d4a('0x18'),'no'),'defaultValue':'yes'},'busylevel':{'type':Sequelize[_0x0d4a('0x27')](0xb)},'allowoverlap':{'type':Sequelize[_0x0d4a('0x7')](_0x0d4a('0x18'),'no')},'allowsubscribe':{'type':Sequelize[_0x0d4a('0x7')](_0x0d4a('0x18'),'no')},'allowtransfer':{'type':Sequelize[_0x0d4a('0x7')](_0x0d4a('0x18'),'no')},'ignoresdpversion':{'type':Sequelize['ENUM'](_0x0d4a('0x18'),'no')},'subscribecontext':{'type':Sequelize['STRING']},'template':{'type':Sequelize[_0x0d4a('0x2')]},'videosupport':{'type':Sequelize[_0x0d4a('0x7')]('yes','no',_0x0d4a('0x29')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x0d4a('0x27')](0xb)},'rfc2833compensate':{'type':Sequelize['ENUM'](_0x0d4a('0x18'),'no')},'mailbox':{'type':Sequelize[_0x0d4a('0x2')]},'session_timers':{'type':Sequelize[_0x0d4a('0x7')]('accept',_0x0d4a('0x2a'),_0x0d4a('0x2b'))},'session_expires':{'type':Sequelize['INTEGER'](0xb)},'session_minse':{'type':Sequelize[_0x0d4a('0x27')](0xb)},'session_refresher':{'type':Sequelize[_0x0d4a('0x7')](_0x0d4a('0x2c'),'uas'),'defaultValue':_0x0d4a('0x2d')},'t38pt_usertpsource':{'type':Sequelize['STRING']},'regexten':{'type':Sequelize['STRING']},'fromdomain':{'type':Sequelize[_0x0d4a('0x2')]},'fromuser':{'type':Sequelize[_0x0d4a('0x2')]},'port':{'type':Sequelize['INTEGER'](0x5)},'qualify':{'type':Sequelize[_0x0d4a('0x7')](_0x0d4a('0x18'),'no'),'defaultValue':_0x0d4a('0x18')},'keepalive':{'type':Sequelize[_0x0d4a('0x27')](0xb)},'defaultip':{'type':Sequelize['STRING']},'defaultuser':{'type':Sequelize[_0x0d4a('0x2')]},'rtptimeout':{'type':Sequelize[_0x0d4a('0x27')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0x0d4a('0x27')](0xb)},'rtpkeepalive':{'type':Sequelize[_0x0d4a('0x27')](0xb)},'sendrpid':{'type':Sequelize[_0x0d4a('0x7')](_0x0d4a('0x18'),'no',_0x0d4a('0x2e')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x0d4a('0x2')]},'callbackextension':{'type':Sequelize['STRING']},'timert1':{'type':Sequelize[_0x0d4a('0x27')](0xb)},'timerb':{'type':Sequelize[_0x0d4a('0x27')](0xb)},'qualifyfreq':{'type':Sequelize['INTEGER'](0xb)},'contactpermit':{'type':Sequelize[_0x0d4a('0x2')]},'contactdeny':{'type':Sequelize['STRING']},'contactacl':{'type':Sequelize['STRING']},'unsolicited_mailbox':{'type':Sequelize['STRING']},'use_q850_reason':{'type':Sequelize['STRING']},'maxforwards':{'type':Sequelize[_0x0d4a('0x27')](0xb)},'encryption':{'type':Sequelize[_0x0d4a('0x7')]('yes','no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x0d4a('0x7')](_0x0d4a('0x18'),'no')},'force_avp':{'type':Sequelize[_0x0d4a('0x7')](_0x0d4a('0x18'),'no')},'icesupport':{'type':Sequelize['ENUM'](_0x0d4a('0x18'),'no')},'dtlsenable':{'type':Sequelize[_0x0d4a('0x7')](_0x0d4a('0x18'),'no')},'dtlsverify':{'type':Sequelize['ENUM'](_0x0d4a('0x18'),'no',_0x0d4a('0x2f'),_0x0d4a('0x30'))},'dtlsrekey':{'type':Sequelize[_0x0d4a('0x27')](0xb)},'dtlscertfile':{'type':Sequelize[_0x0d4a('0x2')]},'dtlsprivatekey':{'type':Sequelize[_0x0d4a('0x2')]},'dtlscipher':{'type':Sequelize[_0x0d4a('0x2')]},'dtlscafile':{'type':Sequelize[_0x0d4a('0x2')]},'dtlscapath':{'type':Sequelize[_0x0d4a('0x2')]},'dtlssetup':{'type':Sequelize[_0x0d4a('0x7')]('active',_0x0d4a('0x31'),_0x0d4a('0x32')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x0d4a('0x2')]},'usereqphone':{'type':Sequelize[_0x0d4a('0x7')](_0x0d4a('0x18'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x0d4a('0x2')]},'recordofffeature':{'type':Sequelize['STRING']},'call_limit':{'type':Sequelize[_0x0d4a('0x27')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0x0d4a('0x7')](_0x0d4a('0x18'),'no')},'subscribemwi':{'type':Sequelize['ENUM'](_0x0d4a('0x18'),'no')},'vmexten':{'type':Sequelize[_0x0d4a('0x2')]},'mohinterpret':{'type':Sequelize[_0x0d4a('0x2')]},'mohsuggest':{'type':Sequelize[_0x0d4a('0x2')]},'parkinglot':{'type':Sequelize[_0x0d4a('0x2')]},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize['STRING'],'defaultValue':'dynamic'},'canreinvite':{'type':Sequelize[_0x0d4a('0x7')](_0x0d4a('0x18'),'no',_0x0d4a('0x33'),_0x0d4a('0x19'),'update,nonat'),'defaultValue':'no'},'registry':{'type':Sequelize[_0x0d4a('0x2')]},'otherFields':{'type':Sequelize[_0x0d4a('0x2')]},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x0d4a('0x2')],'defaultValue':'no'}}; \ No newline at end of file diff --git a/server/api/trunk/trunk.controller.js b/server/api/trunk/trunk.controller.js index ed9dc57..30bddf7 100644 --- a/server/api/trunk/trunk.controller.js +++ b/server/api/trunk/trunk.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe14d=['options','includeAll','include','findAll','rows','params','keys','rawAttributes','find','omit','createdAt','updatedAt','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','join','server/files/templates/trunk.ejs','utf8','root','server/files/templates/registry.ejs','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','registry','Reload','UserProfileSection','autoAssociation','readFileSync','render','/etc/asterisk/sip_xcally_registers.conf','chan_sip.so','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','get','Trunks','UserProfileResource','destroy','stack','name','map','Trunk','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','nolimit','order','where','pick','filter','merge','VIRTUAL'];(function(_0x4a247a,_0x3cddab){var _0x224805=function(_0x55f64e){while(--_0x55f64e){_0x4a247a['push'](_0x4a247a['shift']());}};_0x224805(++_0x3cddab);}(_0xe14d,0x1ee));var _0xde14=function(_0x3ff085,_0x27c92e){_0x3ff085=_0x3ff085-0x0;var _0x2b68c3=_0xe14d[_0x3ff085];return _0x2b68c3;};'use strict';var emlformat=require(_0xde14('0x0'));var rimraf=require(_0xde14('0x1'));var zipdir=require(_0xde14('0x2'));var jsonpatch=require(_0xde14('0x3'));var rp=require('request-promise');var moment=require(_0xde14('0x4'));var BPromise=require(_0xde14('0x5'));var Mustache=require('mustache');var util=require(_0xde14('0x6'));var path=require(_0xde14('0x7'));var sox=require(_0xde14('0x8'));var csv=require(_0xde14('0x9'));var ejs=require(_0xde14('0xa'));var fs=require('fs');var fs_extra=require(_0xde14('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xde14('0xc'));var jsforce=require(_0xde14('0xd'));var deskjs=require(_0xde14('0xe'));var toCsv=require(_0xde14('0x9'));var querystring=require(_0xde14('0xf'));var Papa=require(_0xde14('0x10'));var Redis=require(_0xde14('0x11'));var authService=require(_0xde14('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xde14('0x13'));var hardwareService=require(_0xde14('0x14'));var logger=require(_0xde14('0x15'))(_0xde14('0x16'));var utils=require(_0xde14('0x17'));var config=require(_0xde14('0x18'));var licenseUtil=require(_0xde14('0x19'));var db=require(_0xde14('0x1a'))['db'];var jayson=require(_0xde14('0x1b'));var client=jayson[_0xde14('0x1c')][_0xde14('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x464624,_0x3521d4,_0x281c54,_0x1489e9){return new BPromise(function(_0x54c58b,_0x584959){var _0x23c878=_0x1489e9||client;return _0x23c878[_0xde14('0x1e')](_0x464624,_0x281c54)[_0xde14('0x1f')](function(_0x4c86ff){logger[_0xde14('0x20')](_0xde14('0x21'),_0x3521d4,_0xde14('0x22'));logger[_0xde14('0x23')](_0xde14('0x24'),_0x3521d4,_0xde14('0x22'),JSON[_0xde14('0x25')](_0x4c86ff));if(_0x4c86ff[_0xde14('0x26')]){if(_0x4c86ff[_0xde14('0x26')][_0xde14('0x27')]===0x1f4){logger['error'](_0xde14('0x21'),_0x3521d4,_0x4c86ff[_0xde14('0x26')][_0xde14('0x28')]);return _0x584959(_0x4c86ff[_0xde14('0x26')]['message']);}logger[_0xde14('0x26')]('Trunk,\x20%s,\x20%s',_0x3521d4,_0x4c86ff[_0xde14('0x26')]['message']);return _0x54c58b(_0x4c86ff[_0xde14('0x26')][_0xde14('0x28')]);}else{logger[_0xde14('0x20')](_0xde14('0x21'),_0x3521d4,_0xde14('0x22'));_0x54c58b(_0x4c86ff[_0xde14('0x29')][_0xde14('0x28')]);}})[_0xde14('0x2a')](function(_0xdd8d59){logger[_0xde14('0x26')](_0xde14('0x21'),_0x3521d4,_0xdd8d59);_0x584959(_0xdd8d59);});});}function respondWithStatusCode(_0xbaa078,_0x8f8033){_0x8f8033=_0x8f8033||0xcc;return function(_0x5ae4c1){if(_0x5ae4c1){return _0xbaa078[_0xde14('0x2b')](_0x8f8033);}return _0xbaa078[_0xde14('0x2c')](_0x8f8033)[_0xde14('0x2d')]();};}function respondWithResult(_0xbd05d6,_0x1bb7be){_0x1bb7be=_0x1bb7be||0xc8;return function(_0x21ef15){if(_0x21ef15){return _0xbd05d6[_0xde14('0x2c')](_0x1bb7be)[_0xde14('0x2e')](_0x21ef15);}};}function respondWithFilteredResult(_0x1618e1,_0x350a78){return function(_0x4eff65){if(_0x4eff65){var _0x309922=typeof _0x350a78[_0xde14('0x2f')]===_0xde14('0x30')&&typeof _0x350a78[_0xde14('0x31')]==='undefined';var _0x3fc2a4=_0x4eff65[_0xde14('0x32')];var _0x30c4a8=_0x309922?0x0:_0x350a78['offset'];var _0x4655fb=_0x309922?_0x4eff65['count']:_0x350a78[_0xde14('0x2f')]+_0x350a78[_0xde14('0x31')];var _0x3bb1da;if(_0x4655fb>=_0x3fc2a4){_0x4655fb=_0x3fc2a4;_0x3bb1da=0xc8;}else{_0x3bb1da=0xce;}_0x1618e1[_0xde14('0x2c')](_0x3bb1da);return _0x1618e1[_0xde14('0x33')](_0xde14('0x34'),_0x30c4a8+'-'+_0x4655fb+'/'+_0x3fc2a4)[_0xde14('0x2e')](_0x4eff65);}return null;};}function patchUpdates(_0x464666){return function(_0x4e7c5b){try{jsonpatch[_0xde14('0x35')](_0x4e7c5b,_0x464666,!![]);}catch(_0xbf49ac){return BPromise['reject'](_0xbf49ac);}return _0x4e7c5b[_0xde14('0x36')]();};}function saveUpdates(_0x4c9b15,_0x2e40ad){return function(_0x44e88a){if(_0x44e88a){return _0x44e88a[_0xde14('0x37')](_0x4c9b15)[_0xde14('0x1f')](function(_0x13c164){return _0x13c164;});}return null;};}function removeEntity(_0x57fc47,_0x26dfa9){return function(_0x57b98b){if(_0x57b98b){return _0x57b98b['destroy']()[_0xde14('0x1f')](function(){var _0x3c943b=_0x57b98b[_0xde14('0x38')]({'plain':!![]});var _0x319136=_0xde14('0x39');return db[_0xde14('0x3a')][_0xde14('0x3b')]({'where':{'type':_0x319136,'resourceId':_0x3c943b['id']}})[_0xde14('0x1f')](function(){return _0x57b98b;});})[_0xde14('0x1f')](function(){_0x57fc47['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1c7136,_0x403007){return function(_0x20913d){if(!_0x20913d){_0x1c7136[_0xde14('0x2b')](0x194);}return _0x20913d;};}function handleError(_0x31cad4,_0x23813f){_0x23813f=_0x23813f||0x1f4;return function(_0x1f42ab){logger[_0xde14('0x26')](_0x1f42ab[_0xde14('0x3c')]);if(_0x1f42ab['name']){delete _0x1f42ab[_0xde14('0x3d')];}_0x31cad4['status'](_0x23813f)['send'](_0x1f42ab);};}exports['index']=function(_0xb0eba6,_0x258759){var _0x398f63={},_0x152dab={},_0x1228d8={'count':0x0,'rows':[]};var _0x8b5bb4=_[_0xde14('0x3e')](db[_0xde14('0x3f')]['rawAttributes'],function(_0xc2a39d){return{'name':_0xc2a39d[_0xde14('0x40')],'type':_0xc2a39d[_0xde14('0x41')][_0xde14('0x42')]};});_0x152dab[_0xde14('0x43')]=_[_0xde14('0x3e')](_0x8b5bb4,_0xde14('0x3d'));_0x152dab[_0xde14('0x44')]=_['keys'](_0xb0eba6[_0xde14('0x44')]);_0x152dab[_0xde14('0x45')]=_[_0xde14('0x46')](_0x152dab[_0xde14('0x43')],_0x152dab['query']);_0x398f63['attributes']=_[_0xde14('0x46')](_0x152dab[_0xde14('0x43')],qs[_0xde14('0x47')](_0xb0eba6[_0xde14('0x44')][_0xde14('0x47')]));_0x398f63['attributes']=_0x398f63[_0xde14('0x48')][_0xde14('0x49')]?_0x398f63[_0xde14('0x48')]:_0x152dab['model'];if(!_0xb0eba6[_0xde14('0x44')]['hasOwnProperty'](_0xde14('0x4a'))){_0x398f63['limit']=qs[_0xde14('0x31')](_0xb0eba6[_0xde14('0x44')][_0xde14('0x31')]);_0x398f63[_0xde14('0x2f')]=qs[_0xde14('0x2f')](_0xb0eba6[_0xde14('0x44')][_0xde14('0x2f')]);}_0x398f63[_0xde14('0x4b')]=qs['sort'](_0xb0eba6[_0xde14('0x44')]['sort']);_0x398f63[_0xde14('0x4c')]=qs['filters'](_[_0xde14('0x4d')](_0xb0eba6[_0xde14('0x44')],_0x152dab[_0xde14('0x45')]),_0x8b5bb4);if(_0xb0eba6[_0xde14('0x44')][_0xde14('0x4e')]){_0x398f63[_0xde14('0x4c')]=_[_0xde14('0x4f')](_0x398f63[_0xde14('0x4c')],{'$or':_['map'](_0x8b5bb4,function(_0x15859c){if(_0x15859c[_0xde14('0x41')]!==_0xde14('0x50')){var _0x4b1ef7={};_0x4b1ef7[_0x15859c['name']]={'$like':'%'+_0xb0eba6[_0xde14('0x44')][_0xde14('0x4e')]+'%'};return _0x4b1ef7;}})});}_0x398f63=_[_0xde14('0x4f')]({},_0x398f63,_0xb0eba6[_0xde14('0x51')]);var _0x39572b={'where':_0x398f63[_0xde14('0x4c')]};return db['Trunk'][_0xde14('0x32')](_0x39572b)['then'](function(_0xa408ec){_0x1228d8[_0xde14('0x32')]=_0xa408ec;if(_0xb0eba6['query'][_0xde14('0x52')]){_0x398f63[_0xde14('0x53')]=[{'all':!![]}];}return db[_0xde14('0x3f')][_0xde14('0x54')](_0x398f63);})[_0xde14('0x1f')](function(_0x1c87e1){_0x1228d8[_0xde14('0x55')]=_0x1c87e1;return _0x1228d8;})['then'](respondWithFilteredResult(_0x258759,_0x398f63))[_0xde14('0x2a')](handleError(_0x258759,null));};exports['show']=function(_0xfa80c8,_0x6aa9ab){var _0x237be4={'raw':![],'where':{'id':_0xfa80c8[_0xde14('0x56')]['id']}},_0x235202={};_0x235202[_0xde14('0x43')]=_[_0xde14('0x57')](db[_0xde14('0x3f')][_0xde14('0x58')]);_0x235202[_0xde14('0x44')]=_['keys'](_0xfa80c8[_0xde14('0x44')]);_0x235202[_0xde14('0x45')]=_[_0xde14('0x46')](_0x235202[_0xde14('0x43')],_0x235202[_0xde14('0x44')]);_0x237be4['attributes']=_[_0xde14('0x46')](_0x235202['model'],qs[_0xde14('0x47')](_0xfa80c8[_0xde14('0x44')][_0xde14('0x47')]));_0x237be4[_0xde14('0x48')]=_0x237be4[_0xde14('0x48')]['length']?_0x237be4['attributes']:_0x235202[_0xde14('0x43')];if(_0xfa80c8['query'][_0xde14('0x52')]){_0x237be4[_0xde14('0x53')]=[{'all':!![]}];}_0x237be4=_[_0xde14('0x4f')]({},_0x237be4,_0xfa80c8[_0xde14('0x51')]);return db[_0xde14('0x3f')][_0xde14('0x59')](_0x237be4)[_0xde14('0x1f')](handleEntityNotFound(_0x6aa9ab,null))[_0xde14('0x1f')](respondWithResult(_0x6aa9ab,null))[_0xde14('0x2a')](handleError(_0x6aa9ab,null));};exports['clone']=function(_0x205a94,_0x2c972b){var _0x1ea6d2={'where':{'id':_0x205a94[_0xde14('0x56')]['id']}},_0x21d226={};_0x21d226['model']=_[_0xde14('0x57')](db['Trunk'][_0xde14('0x58')]);_0x1ea6d2[_0xde14('0x48')]=_[_0xde14('0x46')](_0x21d226[_0xde14('0x43')],qs[_0xde14('0x47')](_0x205a94[_0xde14('0x44')][_0xde14('0x47')]));_0x1ea6d2[_0xde14('0x48')]=_0x1ea6d2['attributes']['length']?_0x1ea6d2['attributes']:_0x21d226[_0xde14('0x43')];if(_0x205a94['query']['includeAll']){_0x1ea6d2[_0xde14('0x53')]=[{'all':!![]}];}_0x1ea6d2=_[_0xde14('0x4f')]({},_0x1ea6d2,_0x205a94[_0xde14('0x51')]);return db[_0xde14('0x3f')][_0xde14('0x59')](_0x1ea6d2)[_0xde14('0x1f')](handleEntityNotFound(_0x2c972b,null))[_0xde14('0x1f')](function(_0x13f698){if(_0x13f698){var _0x2dd108=_0x13f698['get']({'plain':!![]});_0x2dd108=qs[_0xde14('0x5a')](_0x2dd108,['id',_0xde14('0x5b'),_0xde14('0x5c')]);_0x205a94['body']=_[_0xde14('0x5a')](_0x205a94['body'],['id',_0xde14('0x5b'),_0xde14('0x5c')]);return db[_0xde14('0x3f')][_0xde14('0x5d')](_[_0xde14('0x4f')](_0x2dd108,_0x205a94[_0xde14('0x5e')]),{'include':_0x205a94[_0xde14('0x44')]['includeAll']?[{'all':!![]}]:undefined})[_0xde14('0x1f')](function(_0x25ba7e){var _0x1a0bb1=_0x205a94[_0xde14('0x5f')][_0xde14('0x38')]({'plain':!![]});if(!_0x1a0bb1)throw new Error(_0xde14('0x60'));if(_0x1a0bb1[_0xde14('0x61')]==='user'){var _0x4a9e85=_0x25ba7e[_0xde14('0x38')]({'plain':!![]});var _0x19a162=_0xde14('0x39');return db['UserProfileSection'][_0xde14('0x59')]({'where':{'name':_0x19a162,'userProfileId':_0x1a0bb1[_0xde14('0x62')]},'raw':!![]})[_0xde14('0x1f')](function(_0x32e075){if(_0x32e075&&_0x32e075['autoAssociation']===0x0){return db['UserProfileResource'][_0xde14('0x5d')]({'name':_0x4a9e85[_0xde14('0x3d')],'resourceId':_0x4a9e85['id'],'type':_0x32e075[_0xde14('0x3d')],'sectionId':_0x32e075['id']},{})[_0xde14('0x1f')](function(){return _0x25ba7e;});}else{return _0x25ba7e;}})[_0xde14('0x2a')](function(_0x120284){logger[_0xde14('0x26')](_0xde14('0x63'),_0x120284);throw _0x120284;});}return _0x25ba7e;});}})[_0xde14('0x1f')](respondWithResult(_0x2c972b,0xc9))[_0xde14('0x2a')](handleError(_0x2c972b,null));};exports[_0xde14('0x5d')]=function(_0x299b69,_0x1ff577,_0x42329a){var _0x6a641f;return db[_0xde14('0x3f')][_0xde14('0x5d')](_0x299b69[_0xde14('0x5e')],{'raw':!![]})[_0xde14('0x1f')](function(_0x1b5d70){_0x6a641f=_0x1b5d70;return db[_0xde14('0x3f')][_0xde14('0x54')]({'raw':!![]});})[_0xde14('0x1f')](function(_0x4809fa){var _0x1084fb=fs['readFileSync'](path[_0xde14('0x64')](config['root'],_0xde14('0x65')),_0xde14('0x66'));var _0x3aaba2=fs['readFileSync'](path['join'](config[_0xde14('0x67')],_0xde14('0x68')),_0xde14('0x66'));var _0x430bdb=ejs['render'](_0x1084fb,{'trunks':_0x4809fa||[]});fs[_0xde14('0x69')](_0xde14('0x6a'),_0x430bdb);if(_0x6a641f[_0xde14('0x6b')]){var _0x500344=ejs['render'](_0x3aaba2,{'trunks':_0x4809fa||[]});fs['writeFileSync']('/etc/asterisk/sip_xcally_registers.conf',_0x500344);}})[_0xde14('0x1f')](function(){return respondWithRpcPromise(_0xde14('0x6c'),_0xde14('0x5d'),{'module':'chan_sip.so'});})[_0xde14('0x1f')](function(){var _0x37f7c3=_0x299b69[_0xde14('0x5f')][_0xde14('0x38')]({'plain':!![]});if(!_0x37f7c3)throw new Error(_0xde14('0x60'));if(_0x37f7c3[_0xde14('0x61')]==='user'){var _0x579a6c=_0x6a641f[_0xde14('0x38')]({'plain':!![]});return db[_0xde14('0x6d')]['find']({'where':{'name':_0xde14('0x39'),'userProfileId':_0x37f7c3[_0xde14('0x62')]},'raw':!![]})[_0xde14('0x1f')](function(_0x367ede){if(_0x367ede&&_0x367ede[_0xde14('0x6e')]===0x0){return db[_0xde14('0x3a')][_0xde14('0x5d')]({'name':_0x579a6c['name'],'resourceId':_0x579a6c['id'],'type':_0x367ede['name'],'sectionId':_0x367ede['id']},{})['then'](function(){return _0x6a641f;});}else{return _0x6a641f;}})['catch'](function(_0x3dbda9){logger[_0xde14('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3dbda9);throw _0x3dbda9;});}return _0x6a641f;})['then'](respondWithResult(_0x1ff577,0xc9))[_0xde14('0x2a')](handleError(_0x1ff577,null));};exports[_0xde14('0x37')]=function(_0xe2b9f5,_0x5805ec,_0x1aa75d){var _0x2b1e2e;return db['Trunk'][_0xde14('0x59')]({'where':{'id':_0xe2b9f5[_0xde14('0x56')]['id']}})[_0xde14('0x1f')](handleEntityNotFound(_0x5805ec,null))[_0xde14('0x1f')](saveUpdates(_0xe2b9f5['body'],null))[_0xde14('0x1f')](function(_0x5a5b25){if(_0x5a5b25){_0x2b1e2e=_0x5a5b25;return db[_0xde14('0x3f')][_0xde14('0x54')]({'raw':!![]});}})[_0xde14('0x1f')](function(_0x5f49d1){if(_0x5f49d1){var _0x283eb8=fs[_0xde14('0x6f')](path[_0xde14('0x64')](config[_0xde14('0x67')],_0xde14('0x65')),'utf8');var _0x53433d=fs[_0xde14('0x6f')](path[_0xde14('0x64')](config[_0xde14('0x67')],'server/files/templates/registry.ejs'),_0xde14('0x66'));var _0x1a12b5=ejs[_0xde14('0x70')](_0x283eb8,{'trunks':_0x5f49d1||[]});fs[_0xde14('0x69')](_0xde14('0x6a'),_0x1a12b5);var _0x2cc5b7=ejs[_0xde14('0x70')](_0x53433d,{'trunks':_0x5f49d1||[]});fs['writeFileSync'](_0xde14('0x71'),_0x2cc5b7);return respondWithRpcPromise(_0xde14('0x6c'),_0xde14('0x37'),{'module':_0xde14('0x72')});}return null;})[_0xde14('0x1f')](function(_0x1732d0){if(_0x1732d0){return _0x2b1e2e;}})[_0xde14('0x1f')](respondWithResult(_0x5805ec,null))['catch'](handleError(_0x5805ec,null));};exports[_0xde14('0x3b')]=function(_0x1bdeae,_0x5f4b92,_0x4543f1){var _0x4a0108;return db[_0xde14('0x3f')]['find']({'where':{'id':_0x1bdeae[_0xde14('0x56')]['id']}})[_0xde14('0x1f')](handleEntityNotFound(_0x5f4b92,null))[_0xde14('0x1f')](removeEntity(_0x5f4b92,null))[_0xde14('0x1f')](function(){return db[_0xde14('0x3f')][_0xde14('0x54')]({'raw':!![]});})['then'](function(_0x43a155){var _0x58cf06=fs[_0xde14('0x6f')](path['join'](config[_0xde14('0x67')],_0xde14('0x65')),_0xde14('0x66'));var _0x4a1114=fs[_0xde14('0x6f')](path[_0xde14('0x64')](config[_0xde14('0x67')],'server/files/templates/registry.ejs'),'utf8');var _0x495741=ejs['render'](_0x58cf06,{'trunks':_0x43a155});var _0x381d6d=ejs[_0xde14('0x70')](_0x4a1114,{'trunks':_0x43a155});fs['writeFileSync'](_0xde14('0x6a'),_0x495741);fs[_0xde14('0x69')](_0xde14('0x71'),_0x381d6d);return respondWithRpcPromise(_0xde14('0x6c'),_0xde14('0x3b'),{'module':'chan_sip.so'});})[_0xde14('0x2a')](handleError(_0x5f4b92,null));}; \ No newline at end of file +var _0x4b84=['omit','createdAt','updatedAt','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','create','readFileSync','join','server/files/templates/trunk.ejs','utf8','root','server/files/templates/registry.ejs','render','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','registry','/etc/asterisk/sip_xcally_registers.conf','Reload','chan_sip.so','role','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','request-promise','mustache','util','path','fs-extra','squel','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','http','request','then','info','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Trunk,\x20%s,\x20%s','request\x20sent','result','sendStatus','end','status','undefined','limit','count','offset','set','Content-Range','json','apply','reject','save','update','destroy','Trunks','UserProfileResource','stack','name','send','index','Trunk','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','nolimit','sort','where','pick','filter','merge','map','VIRTUAL','options','include','findAll','rows','catch','show','params','length','find','includeAll','get'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x4b84,0x1cc));var _0x44b8=function(_0x2e9187,_0x3763f6){_0x2e9187=_0x2e9187-0x0;var _0x1fc3a8=_0x4b84[_0x2e9187];return _0x1fc3a8;};'use strict';var emlformat=require(_0x44b8('0x0'));var rimraf=require(_0x44b8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x44b8('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x44b8('0x3'));var util=require(_0x44b8('0x4'));var path=require(_0x44b8('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x44b8('0x6'));var _=require('lodash');var squel=require(_0x44b8('0x7'));var crypto=require('crypto');var jsforce=require(_0x44b8('0x8'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x44b8('0x9'));var Papa=require(_0x44b8('0xa'));var Redis=require(_0x44b8('0xb'));var authService=require('../../components/auth/service');var qs=require(_0x44b8('0xc'));var as=require(_0x44b8('0xd'));var hardwareService=require(_0x44b8('0xe'));var logger=require(_0x44b8('0xf'))(_0x44b8('0x10'));var utils=require(_0x44b8('0x11'));var config=require(_0x44b8('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x44b8('0x13'))['db'];var jayson=require(_0x44b8('0x14'));var client=jayson['client'][_0x44b8('0x15')]({'port':0x232a});function respondWithRpcPromise(_0x490bc6,_0x833ea3,_0x18d642,_0x4df670){return new BPromise(function(_0x63e8f6,_0x4be54c){var _0x54fa95=_0x4df670||client;return _0x54fa95[_0x44b8('0x16')](_0x490bc6,_0x18d642)[_0x44b8('0x17')](function(_0x1722da){logger[_0x44b8('0x18')]('Trunk,\x20%s,\x20%s',_0x833ea3,'request\x20sent');logger['debug'](_0x44b8('0x19'),_0x833ea3,'request\x20sent',JSON[_0x44b8('0x1a')](_0x1722da));if(_0x1722da[_0x44b8('0x1b')]){if(_0x1722da['error'][_0x44b8('0x1c')]===0x1f4){logger[_0x44b8('0x1b')]('Trunk,\x20%s,\x20%s',_0x833ea3,_0x1722da[_0x44b8('0x1b')][_0x44b8('0x1d')]);return _0x4be54c(_0x1722da['error'][_0x44b8('0x1d')]);}logger[_0x44b8('0x1b')](_0x44b8('0x1e'),_0x833ea3,_0x1722da[_0x44b8('0x1b')][_0x44b8('0x1d')]);return _0x63e8f6(_0x1722da[_0x44b8('0x1b')][_0x44b8('0x1d')]);}else{logger[_0x44b8('0x18')](_0x44b8('0x1e'),_0x833ea3,_0x44b8('0x1f'));_0x63e8f6(_0x1722da[_0x44b8('0x20')][_0x44b8('0x1d')]);}})['catch'](function(_0x56549a){logger[_0x44b8('0x1b')](_0x44b8('0x1e'),_0x833ea3,_0x56549a);_0x4be54c(_0x56549a);});});}function respondWithStatusCode(_0x1418db,_0x305a5c){_0x305a5c=_0x305a5c||0xcc;return function(_0x51a34a){if(_0x51a34a){return _0x1418db[_0x44b8('0x21')](_0x305a5c);}return _0x1418db['status'](_0x305a5c)[_0x44b8('0x22')]();};}function respondWithResult(_0x228c81,_0x25a0c1){_0x25a0c1=_0x25a0c1||0xc8;return function(_0x47689e){if(_0x47689e){return _0x228c81[_0x44b8('0x23')](_0x25a0c1)['json'](_0x47689e);}};}function respondWithFilteredResult(_0x474f01,_0x502acf){return function(_0x41d673){if(_0x41d673){var _0x350482=typeof _0x502acf['offset']===_0x44b8('0x24')&&typeof _0x502acf[_0x44b8('0x25')]===_0x44b8('0x24');var _0x59c1bf=_0x41d673[_0x44b8('0x26')];var _0x242342=_0x350482?0x0:_0x502acf['offset'];var _0x2e0174=_0x350482?_0x41d673['count']:_0x502acf[_0x44b8('0x27')]+_0x502acf['limit'];var _0x559f0b;if(_0x2e0174>=_0x59c1bf){_0x2e0174=_0x59c1bf;_0x559f0b=0xc8;}else{_0x559f0b=0xce;}_0x474f01['status'](_0x559f0b);return _0x474f01[_0x44b8('0x28')](_0x44b8('0x29'),_0x242342+'-'+_0x2e0174+'/'+_0x59c1bf)[_0x44b8('0x2a')](_0x41d673);}return null;};}function patchUpdates(_0x1bd1be){return function(_0x38cd17){try{jsonpatch[_0x44b8('0x2b')](_0x38cd17,_0x1bd1be,!![]);}catch(_0x2cf205){return BPromise[_0x44b8('0x2c')](_0x2cf205);}return _0x38cd17[_0x44b8('0x2d')]();};}function saveUpdates(_0x28f918,_0x5e1129){return function(_0x417d81){if(_0x417d81){return _0x417d81[_0x44b8('0x2e')](_0x28f918)['then'](function(_0x261ff2){return _0x261ff2;});}return null;};}function removeEntity(_0x538db7,_0x212983){return function(_0x1652cb){if(_0x1652cb){return _0x1652cb[_0x44b8('0x2f')]()[_0x44b8('0x17')](function(){var _0x1b63a7=_0x1652cb['get']({'plain':!![]});var _0x16b706=_0x44b8('0x30');return db[_0x44b8('0x31')][_0x44b8('0x2f')]({'where':{'type':_0x16b706,'resourceId':_0x1b63a7['id']}})[_0x44b8('0x17')](function(){return _0x1652cb;});})['then'](function(){_0x538db7[_0x44b8('0x23')](0xcc)[_0x44b8('0x22')]();});}};}function handleEntityNotFound(_0x1a30fc,_0x3e93af){return function(_0x140a79){if(!_0x140a79){_0x1a30fc[_0x44b8('0x21')](0x194);}return _0x140a79;};}function handleError(_0x2e8b88,_0x14a9d7){_0x14a9d7=_0x14a9d7||0x1f4;return function(_0x28c10d){logger[_0x44b8('0x1b')](_0x28c10d[_0x44b8('0x32')]);if(_0x28c10d[_0x44b8('0x33')]){delete _0x28c10d[_0x44b8('0x33')];}_0x2e8b88[_0x44b8('0x23')](_0x14a9d7)[_0x44b8('0x34')](_0x28c10d);};}exports[_0x44b8('0x35')]=function(_0x323c50,_0xeff999){var _0x28faa9={},_0x3984f8={},_0x2c02d6={'count':0x0,'rows':[]};var _0x282345=_['map'](db[_0x44b8('0x36')][_0x44b8('0x37')],function(_0x4fcfa0){return{'name':_0x4fcfa0[_0x44b8('0x38')],'type':_0x4fcfa0[_0x44b8('0x39')][_0x44b8('0x3a')]};});_0x3984f8[_0x44b8('0x3b')]=_['map'](_0x282345,_0x44b8('0x33'));_0x3984f8[_0x44b8('0x3c')]=_[_0x44b8('0x3d')](_0x323c50[_0x44b8('0x3c')]);_0x3984f8[_0x44b8('0x3e')]=_[_0x44b8('0x3f')](_0x3984f8[_0x44b8('0x3b')],_0x3984f8[_0x44b8('0x3c')]);_0x28faa9[_0x44b8('0x40')]=_[_0x44b8('0x3f')](_0x3984f8[_0x44b8('0x3b')],qs[_0x44b8('0x41')](_0x323c50[_0x44b8('0x3c')][_0x44b8('0x41')]));_0x28faa9[_0x44b8('0x40')]=_0x28faa9[_0x44b8('0x40')]['length']?_0x28faa9[_0x44b8('0x40')]:_0x3984f8[_0x44b8('0x3b')];if(!_0x323c50[_0x44b8('0x3c')]['hasOwnProperty'](_0x44b8('0x42'))){_0x28faa9[_0x44b8('0x25')]=qs[_0x44b8('0x25')](_0x323c50['query'][_0x44b8('0x25')]);_0x28faa9[_0x44b8('0x27')]=qs[_0x44b8('0x27')](_0x323c50[_0x44b8('0x3c')][_0x44b8('0x27')]);}_0x28faa9['order']=qs['sort'](_0x323c50[_0x44b8('0x3c')][_0x44b8('0x43')]);_0x28faa9[_0x44b8('0x44')]=qs[_0x44b8('0x3e')](_[_0x44b8('0x45')](_0x323c50[_0x44b8('0x3c')],_0x3984f8[_0x44b8('0x3e')]),_0x282345);if(_0x323c50[_0x44b8('0x3c')][_0x44b8('0x46')]){_0x28faa9[_0x44b8('0x44')]=_[_0x44b8('0x47')](_0x28faa9[_0x44b8('0x44')],{'$or':_[_0x44b8('0x48')](_0x282345,function(_0x1236c7){if(_0x1236c7[_0x44b8('0x39')]!==_0x44b8('0x49')){var _0xce06dc={};_0xce06dc[_0x1236c7[_0x44b8('0x33')]]={'$like':'%'+_0x323c50[_0x44b8('0x3c')]['filter']+'%'};return _0xce06dc;}})});}_0x28faa9=_['merge']({},_0x28faa9,_0x323c50[_0x44b8('0x4a')]);var _0x1df74b={'where':_0x28faa9[_0x44b8('0x44')]};return db[_0x44b8('0x36')][_0x44b8('0x26')](_0x1df74b)[_0x44b8('0x17')](function(_0x411ed6){_0x2c02d6['count']=_0x411ed6;if(_0x323c50[_0x44b8('0x3c')]['includeAll']){_0x28faa9[_0x44b8('0x4b')]=[{'all':!![]}];}return db[_0x44b8('0x36')][_0x44b8('0x4c')](_0x28faa9);})[_0x44b8('0x17')](function(_0x103d57){_0x2c02d6[_0x44b8('0x4d')]=_0x103d57;return _0x2c02d6;})['then'](respondWithFilteredResult(_0xeff999,_0x28faa9))[_0x44b8('0x4e')](handleError(_0xeff999,null));};exports[_0x44b8('0x4f')]=function(_0x10602c,_0x25d266){var _0x4ccc77={'raw':![],'where':{'id':_0x10602c[_0x44b8('0x50')]['id']}},_0x4e4ed1={};_0x4e4ed1[_0x44b8('0x3b')]=_[_0x44b8('0x3d')](db[_0x44b8('0x36')][_0x44b8('0x37')]);_0x4e4ed1['query']=_[_0x44b8('0x3d')](_0x10602c[_0x44b8('0x3c')]);_0x4e4ed1[_0x44b8('0x3e')]=_[_0x44b8('0x3f')](_0x4e4ed1[_0x44b8('0x3b')],_0x4e4ed1['query']);_0x4ccc77['attributes']=_[_0x44b8('0x3f')](_0x4e4ed1['model'],qs[_0x44b8('0x41')](_0x10602c['query'][_0x44b8('0x41')]));_0x4ccc77[_0x44b8('0x40')]=_0x4ccc77[_0x44b8('0x40')][_0x44b8('0x51')]?_0x4ccc77[_0x44b8('0x40')]:_0x4e4ed1[_0x44b8('0x3b')];if(_0x10602c[_0x44b8('0x3c')]['includeAll']){_0x4ccc77[_0x44b8('0x4b')]=[{'all':!![]}];}_0x4ccc77=_[_0x44b8('0x47')]({},_0x4ccc77,_0x10602c[_0x44b8('0x4a')]);return db['Trunk'][_0x44b8('0x52')](_0x4ccc77)[_0x44b8('0x17')](handleEntityNotFound(_0x25d266,null))[_0x44b8('0x17')](respondWithResult(_0x25d266,null))[_0x44b8('0x4e')](handleError(_0x25d266,null));};exports['clone']=function(_0x399d6b,_0x308f7b){var _0x4a6e55={'where':{'id':_0x399d6b[_0x44b8('0x50')]['id']}},_0x3de425={};_0x3de425[_0x44b8('0x3b')]=_[_0x44b8('0x3d')](db[_0x44b8('0x36')]['rawAttributes']);_0x4a6e55['attributes']=_[_0x44b8('0x3f')](_0x3de425[_0x44b8('0x3b')],qs[_0x44b8('0x41')](_0x399d6b[_0x44b8('0x3c')][_0x44b8('0x41')]));_0x4a6e55[_0x44b8('0x40')]=_0x4a6e55[_0x44b8('0x40')][_0x44b8('0x51')]?_0x4a6e55[_0x44b8('0x40')]:_0x3de425[_0x44b8('0x3b')];if(_0x399d6b[_0x44b8('0x3c')][_0x44b8('0x53')]){_0x4a6e55['include']=[{'all':!![]}];}_0x4a6e55=_[_0x44b8('0x47')]({},_0x4a6e55,_0x399d6b[_0x44b8('0x4a')]);return db[_0x44b8('0x36')][_0x44b8('0x52')](_0x4a6e55)[_0x44b8('0x17')](handleEntityNotFound(_0x308f7b,null))[_0x44b8('0x17')](function(_0x426a6a){if(_0x426a6a){var _0x172ff3=_0x426a6a[_0x44b8('0x54')]({'plain':!![]});_0x172ff3=qs[_0x44b8('0x55')](_0x172ff3,['id',_0x44b8('0x56'),_0x44b8('0x57')]);_0x399d6b[_0x44b8('0x58')]=_[_0x44b8('0x55')](_0x399d6b[_0x44b8('0x58')],['id',_0x44b8('0x56'),_0x44b8('0x57')]);return db[_0x44b8('0x36')]['create'](_[_0x44b8('0x47')](_0x172ff3,_0x399d6b[_0x44b8('0x58')]),{'include':_0x399d6b[_0x44b8('0x3c')][_0x44b8('0x53')]?[{'all':!![]}]:undefined})[_0x44b8('0x17')](function(_0x29ed5d){var _0x2ecf65=_0x399d6b['user'][_0x44b8('0x54')]({'plain':!![]});if(!_0x2ecf65)throw new Error(_0x44b8('0x59'));if(_0x2ecf65['role']===_0x44b8('0x5a')){var _0x3354bd=_0x29ed5d['get']({'plain':!![]});var _0x37e42e=_0x44b8('0x30');return db[_0x44b8('0x5b')]['find']({'where':{'name':_0x37e42e,'userProfileId':_0x2ecf65[_0x44b8('0x5c')]},'raw':!![]})['then'](function(_0x36cdd8){if(_0x36cdd8&&_0x36cdd8['autoAssociation']===0x0){return db[_0x44b8('0x31')][_0x44b8('0x5d')]({'name':_0x3354bd[_0x44b8('0x33')],'resourceId':_0x3354bd['id'],'type':_0x36cdd8[_0x44b8('0x33')],'sectionId':_0x36cdd8['id']},{})[_0x44b8('0x17')](function(){return _0x29ed5d;});}else{return _0x29ed5d;}})[_0x44b8('0x4e')](function(_0x4c7edd){logger[_0x44b8('0x1b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4c7edd);throw _0x4c7edd;});}return _0x29ed5d;});}})[_0x44b8('0x17')](respondWithResult(_0x308f7b,0xc9))[_0x44b8('0x4e')](handleError(_0x308f7b,null));};exports['create']=function(_0x3f9438,_0x1ee26b,_0x1cf31f){var _0x30d60f;return db[_0x44b8('0x36')][_0x44b8('0x5d')](_0x3f9438[_0x44b8('0x58')],{'raw':!![]})[_0x44b8('0x17')](function(_0x3f9102){_0x30d60f=_0x3f9102;return db[_0x44b8('0x36')][_0x44b8('0x4c')]({'raw':!![]});})[_0x44b8('0x17')](function(_0x52381a){var _0xd20d0=fs[_0x44b8('0x5e')](path[_0x44b8('0x5f')](config['root'],_0x44b8('0x60')),_0x44b8('0x61'));var _0x5bff09=fs[_0x44b8('0x5e')](path[_0x44b8('0x5f')](config[_0x44b8('0x62')],_0x44b8('0x63')),_0x44b8('0x61'));var _0x59060b=ejs[_0x44b8('0x64')](_0xd20d0,{'trunks':_0x52381a||[]});fs[_0x44b8('0x65')](_0x44b8('0x66'),_0x59060b);if(_0x30d60f[_0x44b8('0x67')]){var _0x2e02d7=ejs[_0x44b8('0x64')](_0x5bff09,{'trunks':_0x52381a||[]});fs[_0x44b8('0x65')](_0x44b8('0x68'),_0x2e02d7);}})['then'](function(){return respondWithRpcPromise(_0x44b8('0x69'),_0x44b8('0x5d'),{'module':_0x44b8('0x6a')});})[_0x44b8('0x17')](function(){var _0x5b26e8=_0x3f9438['user']['get']({'plain':!![]});if(!_0x5b26e8)throw new Error(_0x44b8('0x59'));if(_0x5b26e8[_0x44b8('0x6b')]===_0x44b8('0x5a')){var _0x46e20f=_0x30d60f[_0x44b8('0x54')]({'plain':!![]});return db['UserProfileSection'][_0x44b8('0x52')]({'where':{'name':'Trunks','userProfileId':_0x5b26e8[_0x44b8('0x5c')]},'raw':!![]})[_0x44b8('0x17')](function(_0xea2c3e){if(_0xea2c3e&&_0xea2c3e['autoAssociation']===0x0){return db['UserProfileResource'][_0x44b8('0x5d')]({'name':_0x46e20f[_0x44b8('0x33')],'resourceId':_0x46e20f['id'],'type':_0xea2c3e[_0x44b8('0x33')],'sectionId':_0xea2c3e['id']},{})['then'](function(){return _0x30d60f;});}else{return _0x30d60f;}})[_0x44b8('0x4e')](function(_0x36f217){logger[_0x44b8('0x1b')](_0x44b8('0x6c'),_0x36f217);throw _0x36f217;});}return _0x30d60f;})[_0x44b8('0x17')](respondWithResult(_0x1ee26b,0xc9))['catch'](handleError(_0x1ee26b,null));};exports[_0x44b8('0x2e')]=function(_0x1888f8,_0xbbdab9,_0x2a8ccc){var _0x220f1b;return db['Trunk'][_0x44b8('0x52')]({'where':{'id':_0x1888f8[_0x44b8('0x50')]['id']}})[_0x44b8('0x17')](handleEntityNotFound(_0xbbdab9,null))[_0x44b8('0x17')](saveUpdates(_0x1888f8[_0x44b8('0x58')],null))[_0x44b8('0x17')](function(_0x1c7ef2){if(_0x1c7ef2){_0x220f1b=_0x1c7ef2;return db['Trunk'][_0x44b8('0x4c')]({'raw':!![]});}})[_0x44b8('0x17')](function(_0x4c3fea){if(_0x4c3fea){var _0x3bb7d8=fs[_0x44b8('0x5e')](path['join'](config[_0x44b8('0x62')],'server/files/templates/trunk.ejs'),'utf8');var _0x31d3b6=fs[_0x44b8('0x5e')](path[_0x44b8('0x5f')](config['root'],'server/files/templates/registry.ejs'),'utf8');var _0x36334a=ejs[_0x44b8('0x64')](_0x3bb7d8,{'trunks':_0x4c3fea||[]});fs[_0x44b8('0x65')](_0x44b8('0x66'),_0x36334a);var _0x1a5621=ejs[_0x44b8('0x64')](_0x31d3b6,{'trunks':_0x4c3fea||[]});fs[_0x44b8('0x65')](_0x44b8('0x68'),_0x1a5621);return respondWithRpcPromise('Reload',_0x44b8('0x2e'),{'module':'chan_sip.so'});}return null;})['then'](function(_0x55f4e4){if(_0x55f4e4){return _0x220f1b;}})[_0x44b8('0x17')](respondWithResult(_0xbbdab9,null))['catch'](handleError(_0xbbdab9,null));};exports[_0x44b8('0x2f')]=function(_0x1e37fd,_0x268e1e,_0x306793){var _0x3a9780;return db[_0x44b8('0x36')][_0x44b8('0x52')]({'where':{'id':_0x1e37fd[_0x44b8('0x50')]['id']}})['then'](handleEntityNotFound(_0x268e1e,null))[_0x44b8('0x17')](removeEntity(_0x268e1e,null))[_0x44b8('0x17')](function(){return db[_0x44b8('0x36')][_0x44b8('0x4c')]({'raw':!![]});})[_0x44b8('0x17')](function(_0xee44b3){var _0x10034d=fs[_0x44b8('0x5e')](path[_0x44b8('0x5f')](config['root'],'server/files/templates/trunk.ejs'),_0x44b8('0x61'));var _0x553aa9=fs[_0x44b8('0x5e')](path[_0x44b8('0x5f')](config[_0x44b8('0x62')],'server/files/templates/registry.ejs'),'utf8');var _0x4b22e7=ejs[_0x44b8('0x64')](_0x10034d,{'trunks':_0xee44b3});var _0x4860af=ejs[_0x44b8('0x64')](_0x553aa9,{'trunks':_0xee44b3});fs[_0x44b8('0x65')](_0x44b8('0x66'),_0x4b22e7);fs[_0x44b8('0x65')](_0x44b8('0x68'),_0x4860af);return respondWithRpcPromise(_0x44b8('0x69'),_0x44b8('0x2f'),{'module':_0x44b8('0x6a')});})[_0x44b8('0x4e')](handleError(_0x268e1e,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index 571c415..b168fc3 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 _0xe1e4=['./trunk.attributes','exports','define','Trunk','tools_trunks','lodash','util','../../config/logger','api','moment','request-promise','rimraf'];(function(_0xe8d47b,_0x81283f){var _0x392563=function(_0x362728){while(--_0x362728){_0xe8d47b['push'](_0xe8d47b['shift']());}};_0x392563(++_0x81283f);}(_0xe1e4,0x185));var _0x4e1e=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0xe1e4[_0x4a9fb1];return _0x348672;};'use strict';var _=require(_0x4e1e('0x0'));var util=require(_0x4e1e('0x1'));var logger=require(_0x4e1e('0x2'))(_0x4e1e('0x3'));var moment=require(_0x4e1e('0x4'));var BPromise=require('bluebird');var rp=require(_0x4e1e('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4e1e('0x6'));var config=require('../../config/environment');var attributes=require(_0x4e1e('0x7'));module[_0x4e1e('0x8')]=function(_0x5e09ac,_0x412397){return _0x5e09ac[_0x4e1e('0x9')](_0x4e1e('0xa'),attributes,{'tableName':_0x4e1e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7a48=['path','../../config/environment','define','Trunk','lodash','util','../../config/logger','api','moment'];(function(_0x4e840e,_0x5a44c1){var _0x44f805=function(_0x507b3f){while(--_0x507b3f){_0x4e840e['push'](_0x4e840e['shift']());}};_0x44f805(++_0x5a44c1);}(_0x7a48,0x100));var _0x87a4=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x7a48[_0x4565bf];return _0x5610ba;};'use strict';var _=require(_0x87a4('0x0'));var util=require(_0x87a4('0x1'));var logger=require(_0x87a4('0x2'))(_0x87a4('0x3'));var moment=require(_0x87a4('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x87a4('0x5'));var rimraf=require('rimraf');var config=require(_0x87a4('0x6'));var attributes=require('./trunk.attributes');module['exports']=function(_0x4e4103,_0x504b7e){return _0x4e4103[_0x87a4('0x7')](_0x87a4('0x8'),attributes,{'tableName':'tools_trunks','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/trunk/trunk.rpc.js b/server/api/trunk/trunk.rpc.js index fa61d07..4d6c6f2 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 _0xd358=['error','code','message','result','GetTrunk','Trunk','findAll','options','where','attributes','limit','include','map','model','catch','find','raw','ShowTrunk','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','Trunk,\x20%s,\x20%s','debug','Trunk,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x4c31b0,_0x41057e){var _0x32d1ef=function(_0x394dc0){while(--_0x394dc0){_0x4c31b0['push'](_0x4c31b0['shift']());}};_0x32d1ef(++_0x41057e);}(_0xd358,0xd0));var _0x8d35=function(_0x3dc26,_0x4bc827){_0x3dc26=_0x3dc26-0x0;var _0x286075=_0xd358[_0x3dc26];return _0x286075;};'use strict';var _=require(_0x8d35('0x0'));var util=require(_0x8d35('0x1'));var moment=require(_0x8d35('0x2'));var BPromise=require(_0x8d35('0x3'));var rs=require(_0x8d35('0x4'));var fs=require('fs');var Redis=require(_0x8d35('0x5'));var db=require(_0x8d35('0x6'))['db'];var utils=require(_0x8d35('0x7'));var logger=require(_0x8d35('0x8'))('rpc');var config=require(_0x8d35('0x9'));var jayson=require(_0x8d35('0xa'));var client=jayson[_0x8d35('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x8687e7,_0x361812,_0x4fdcdb){return new BPromise(function(_0xadc353,_0x25add0){return client[_0x8d35('0xc')](_0x8687e7,_0x4fdcdb)[_0x8d35('0xd')](function(_0x8c9e9a){logger[_0x8d35('0xe')](_0x8d35('0xf'),_0x361812,'request\x20sent');logger[_0x8d35('0x10')](_0x8d35('0x11'),_0x361812,_0x8d35('0x12'),JSON[_0x8d35('0x13')](_0x8c9e9a));if(_0x8c9e9a[_0x8d35('0x14')]){if(_0x8c9e9a[_0x8d35('0x14')][_0x8d35('0x15')]===0x1f4){logger['error'](_0x8d35('0xf'),_0x361812,_0x8c9e9a[_0x8d35('0x14')][_0x8d35('0x16')]);return _0x25add0(_0x8c9e9a['error'][_0x8d35('0x16')]);}logger[_0x8d35('0x14')](_0x8d35('0xf'),_0x361812,_0x8c9e9a[_0x8d35('0x14')][_0x8d35('0x16')]);return _0xadc353(_0x8c9e9a[_0x8d35('0x14')]['message']);}else{logger['info'](_0x8d35('0xf'),_0x361812,_0x8d35('0x12'));_0xadc353(_0x8c9e9a[_0x8d35('0x17')][_0x8d35('0x16')]);}})['catch'](function(_0x2aee8c){logger[_0x8d35('0x14')](_0x8d35('0xf'),_0x361812,_0x2aee8c);_0x25add0(_0x2aee8c);});});}exports[_0x8d35('0x18')]=function(_0xc26b08){var _0x33bd14=this;return new Promise(function(_0x5545c8,_0x1790d1){return db[_0x8d35('0x19')][_0x8d35('0x1a')]({'raw':_0xc26b08[_0x8d35('0x1b')]?_0xc26b08[_0x8d35('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0xc26b08['options']?_0xc26b08[_0x8d35('0x1b')][_0x8d35('0x1c')]||null:null,'attributes':_0xc26b08[_0x8d35('0x1b')]?_0xc26b08[_0x8d35('0x1b')][_0x8d35('0x1d')]||null:null,'limit':_0xc26b08[_0x8d35('0x1b')]?_0xc26b08[_0x8d35('0x1b')][_0x8d35('0x1e')]||null:null,'include':_0xc26b08[_0x8d35('0x1b')]?_0xc26b08['options'][_0x8d35('0x1f')]?_[_0x8d35('0x20')](_0xc26b08['options'][_0x8d35('0x1f')],function(_0x350052){return{'model':db[_0x350052['model']],'as':_0x350052['as'],'attributes':_0x350052[_0x8d35('0x1d')],'include':_0x350052['include']?_['map'](_0x350052[_0x8d35('0x1f')],function(_0x4d8379){return{'model':db[_0x4d8379['model']],'as':_0x4d8379['as'],'attributes':_0x4d8379[_0x8d35('0x1d')],'include':_0x4d8379[_0x8d35('0x1f')]?_[_0x8d35('0x20')](_0x4d8379[_0x8d35('0x1f')],function(_0x41148d){return{'model':db[_0x41148d[_0x8d35('0x21')]],'as':_0x41148d['as'],'attributes':_0x41148d[_0x8d35('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x29c90b){logger[_0x8d35('0xe')](_0x8d35('0x18'),_0xc26b08);logger[_0x8d35('0x10')]('GetTrunk',_0xc26b08,JSON[_0x8d35('0x13')](_0x29c90b));_0x5545c8(_0x29c90b);})[_0x8d35('0x22')](function(_0x328878){logger[_0x8d35('0x14')](_0x8d35('0x18'),_0x328878[_0x8d35('0x16')],_0xc26b08);_0x1790d1(_0x33bd14['error'](0x1f4,_0x328878[_0x8d35('0x16')]));});});};exports['ShowTrunk']=function(_0x407502){var _0x3ff522=this;return new Promise(function(_0x2b76cd,_0x4ea885){return db[_0x8d35('0x19')][_0x8d35('0x23')]({'raw':_0x407502['options']?_0x407502['options'][_0x8d35('0x24')]===undefined?!![]:![]:!![],'where':_0x407502[_0x8d35('0x1b')]?_0x407502['options']['where']||null:null,'attributes':_0x407502[_0x8d35('0x1b')]?_0x407502[_0x8d35('0x1b')]['attributes']||null:null,'include':_0x407502[_0x8d35('0x1b')]?_0x407502[_0x8d35('0x1b')][_0x8d35('0x1f')]?_[_0x8d35('0x20')](_0x407502[_0x8d35('0x1b')][_0x8d35('0x1f')],function(_0x3562e7){return{'model':db[_0x3562e7['model']],'as':_0x3562e7['as'],'attributes':_0x3562e7['attributes'],'include':_0x3562e7['include']?_[_0x8d35('0x20')](_0x3562e7['include'],function(_0x4d5319){return{'model':db[_0x4d5319['model']],'as':_0x4d5319['as'],'attributes':_0x4d5319[_0x8d35('0x1d')],'include':_0x4d5319[_0x8d35('0x1f')]?_[_0x8d35('0x20')](_0x4d5319[_0x8d35('0x1f')],function(_0x53b3b9){return{'model':db[_0x53b3b9['model']],'as':_0x53b3b9['as'],'attributes':_0x53b3b9[_0x8d35('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x8d35('0xd')](function(_0x1aa76b){logger[_0x8d35('0xe')](_0x8d35('0x25'),_0x407502);logger[_0x8d35('0x10')]('ShowTrunk',_0x407502,JSON[_0x8d35('0x13')](_0x1aa76b));_0x2b76cd(_0x1aa76b);})[_0x8d35('0x22')](function(_0x348767){logger[_0x8d35('0x14')]('ShowTrunk',_0x348767['message'],_0x407502);_0x4ea885(_0x3ff522[_0x8d35('0x14')](0x1f4,_0x348767[_0x8d35('0x16')]));});});}; \ No newline at end of file +var _0xd6ab=['client','http','request','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','GetTrunk','Trunk','findAll','options','raw','attributes','limit','include','model','map','then','stringify','ShowTrunk','find','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x5111e8,_0x454afc){var _0x5ea361=function(_0x2b526b){while(--_0x2b526b){_0x5111e8['push'](_0x5111e8['shift']());}};_0x5ea361(++_0x454afc);}(_0xd6ab,0x10f));var _0xbd6a=function(_0x14af87,_0x149ac3){_0x14af87=_0x14af87-0x0;var _0x4ff770=_0xd6ab[_0x14af87];return _0x4ff770;};'use strict';var _=require('lodash');var util=require(_0xbd6a('0x0'));var moment=require(_0xbd6a('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbd6a('0x2'));var db=require(_0xbd6a('0x3'))['db'];var utils=require(_0xbd6a('0x4'));var logger=require(_0xbd6a('0x5'))(_0xbd6a('0x6'));var config=require(_0xbd6a('0x7'));var jayson=require(_0xbd6a('0x8'));var client=jayson[_0xbd6a('0x9')][_0xbd6a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x372179,_0x1f6d23,_0x19b487){return new BPromise(function(_0x534922,_0xa9f811){return client[_0xbd6a('0xb')](_0x372179,_0x19b487)['then'](function(_0x302782){logger[_0xbd6a('0xc')](_0xbd6a('0xd'),_0x1f6d23,_0xbd6a('0xe'));logger[_0xbd6a('0xf')]('Trunk,\x20%s,\x20%s,\x20%s',_0x1f6d23,_0xbd6a('0xe'),JSON['stringify'](_0x302782));if(_0x302782[_0xbd6a('0x10')]){if(_0x302782[_0xbd6a('0x10')][_0xbd6a('0x11')]===0x1f4){logger[_0xbd6a('0x10')]('Trunk,\x20%s,\x20%s',_0x1f6d23,_0x302782[_0xbd6a('0x10')][_0xbd6a('0x12')]);return _0xa9f811(_0x302782['error']['message']);}logger[_0xbd6a('0x10')](_0xbd6a('0xd'),_0x1f6d23,_0x302782[_0xbd6a('0x10')][_0xbd6a('0x12')]);return _0x534922(_0x302782[_0xbd6a('0x10')][_0xbd6a('0x12')]);}else{logger['info'](_0xbd6a('0xd'),_0x1f6d23,'request\x20sent');_0x534922(_0x302782[_0xbd6a('0x13')]['message']);}})[_0xbd6a('0x14')](function(_0x51c993){logger[_0xbd6a('0x10')](_0xbd6a('0xd'),_0x1f6d23,_0x51c993);_0xa9f811(_0x51c993);});});}exports[_0xbd6a('0x15')]=function(_0x667555){var _0x307514=this;return new Promise(function(_0x3845d3,_0x4704df){return db[_0xbd6a('0x16')][_0xbd6a('0x17')]({'raw':_0x667555['options']?_0x667555[_0xbd6a('0x18')][_0xbd6a('0x19')]===undefined?!![]:![]:!![],'where':_0x667555[_0xbd6a('0x18')]?_0x667555[_0xbd6a('0x18')]['where']||null:null,'attributes':_0x667555[_0xbd6a('0x18')]?_0x667555[_0xbd6a('0x18')][_0xbd6a('0x1a')]||null:null,'limit':_0x667555['options']?_0x667555['options'][_0xbd6a('0x1b')]||null:null,'include':_0x667555[_0xbd6a('0x18')]?_0x667555['options']['include']?_['map'](_0x667555[_0xbd6a('0x18')][_0xbd6a('0x1c')],function(_0x34191f){return{'model':db[_0x34191f[_0xbd6a('0x1d')]],'as':_0x34191f['as'],'attributes':_0x34191f[_0xbd6a('0x1a')],'include':_0x34191f[_0xbd6a('0x1c')]?_[_0xbd6a('0x1e')](_0x34191f[_0xbd6a('0x1c')],function(_0x3045f8){return{'model':db[_0x3045f8[_0xbd6a('0x1d')]],'as':_0x3045f8['as'],'attributes':_0x3045f8['attributes'],'include':_0x3045f8[_0xbd6a('0x1c')]?_['map'](_0x3045f8[_0xbd6a('0x1c')],function(_0x573749){return{'model':db[_0x573749['model']],'as':_0x573749['as'],'attributes':_0x573749[_0xbd6a('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xbd6a('0x1f')](function(_0x5e4d82){logger['info'](_0xbd6a('0x15'),_0x667555);logger[_0xbd6a('0xf')](_0xbd6a('0x15'),_0x667555,JSON[_0xbd6a('0x20')](_0x5e4d82));_0x3845d3(_0x5e4d82);})[_0xbd6a('0x14')](function(_0xdcadba){logger[_0xbd6a('0x10')]('GetTrunk',_0xdcadba[_0xbd6a('0x12')],_0x667555);_0x4704df(_0x307514['error'](0x1f4,_0xdcadba[_0xbd6a('0x12')]));});});};exports[_0xbd6a('0x21')]=function(_0x1c24d5){var _0x428d53=this;return new Promise(function(_0x55d30a,_0x307a44){return db[_0xbd6a('0x16')][_0xbd6a('0x22')]({'raw':_0x1c24d5[_0xbd6a('0x18')]?_0x1c24d5[_0xbd6a('0x18')][_0xbd6a('0x19')]===undefined?!![]:![]:!![],'where':_0x1c24d5[_0xbd6a('0x18')]?_0x1c24d5['options']['where']||null:null,'attributes':_0x1c24d5[_0xbd6a('0x18')]?_0x1c24d5['options'][_0xbd6a('0x1a')]||null:null,'include':_0x1c24d5[_0xbd6a('0x18')]?_0x1c24d5[_0xbd6a('0x18')][_0xbd6a('0x1c')]?_['map'](_0x1c24d5[_0xbd6a('0x18')][_0xbd6a('0x1c')],function(_0x2549cc){return{'model':db[_0x2549cc['model']],'as':_0x2549cc['as'],'attributes':_0x2549cc[_0xbd6a('0x1a')],'include':_0x2549cc[_0xbd6a('0x1c')]?_['map'](_0x2549cc[_0xbd6a('0x1c')],function(_0x41c89f){return{'model':db[_0x41c89f[_0xbd6a('0x1d')]],'as':_0x41c89f['as'],'attributes':_0x41c89f[_0xbd6a('0x1a')],'include':_0x41c89f[_0xbd6a('0x1c')]?_[_0xbd6a('0x1e')](_0x41c89f[_0xbd6a('0x1c')],function(_0x1c72b1){return{'model':db[_0x1c72b1[_0xbd6a('0x1d')]],'as':_0x1c72b1['as'],'attributes':_0x1c72b1[_0xbd6a('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xbd6a('0x1f')](function(_0x5b4216){logger[_0xbd6a('0xc')](_0xbd6a('0x21'),_0x1c24d5);logger[_0xbd6a('0xf')](_0xbd6a('0x21'),_0x1c24d5,JSON['stringify'](_0x5b4216));_0x55d30a(_0x5b4216);})[_0xbd6a('0x14')](function(_0x346c2f){logger[_0xbd6a('0x10')](_0xbd6a('0x21'),_0x346c2f[_0xbd6a('0x12')],_0x1c24d5);_0x307a44(_0x428d53[_0xbd6a('0x10')](0x1f4,_0x346c2f[_0xbd6a('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/user-setting/index.js b/server/api/user-setting/index.js index 0751d9e..4baa914 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 _0xb349=['/:id','isAuthenticated','exports','Router','../../components/auth/service','./user-setting.controller'];(function(_0x2e4aa2,_0x11956a){var _0x5e6092=function(_0x4c12c2){while(--_0x4c12c2){_0x2e4aa2['push'](_0x2e4aa2['shift']());}};_0x5e6092(++_0x11956a);}(_0xb349,0x99));var _0x9b34=function(_0x625a7,_0x50675d){_0x625a7=_0x625a7-0x0;var _0x42e440=_0xb349[_0x625a7];return _0x42e440;};'use strict';var express=require('express');var router=express[_0x9b34('0x0')]();var auth=require(_0x9b34('0x1'));var controller=require(_0x9b34('0x2'));router['put'](_0x9b34('0x3'),auth[_0x9b34('0x4')](),controller['update']);module[_0x9b34('0x5')]=router; \ No newline at end of file +var _0xaa32=['isAuthenticated','exports','Router','./user-setting.controller','/:id'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xaa32,0x70));var _0x2aa3=function(_0x420d8d,_0x78b67f){_0x420d8d=_0x420d8d-0x0;var _0x4865d7=_0xaa32[_0x420d8d];return _0x4865d7;};'use strict';var express=require('express');var router=express[_0x2aa3('0x0')]();var auth=require('../../components/auth/service');var controller=require(_0x2aa3('0x1'));router['put'](_0x2aa3('0x2'),auth[_0x2aa3('0x3')](),controller['update']);module[_0x2aa3('0x4')]=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 7e31734..ee651fe 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 _0x1f06=['sequelize','error','warning','info','debug','ENUM','BOOLEAN','DATE','INTEGER','UserId'];(function(_0x32189c,_0x4fa006){var _0x8da8f1=function(_0x239113){while(--_0x239113){_0x32189c['push'](_0x32189c['shift']());}};_0x8da8f1(++_0x4fa006);}(_0x1f06,0x8c));var _0x61f0=function(_0x4399f,_0x725f78){_0x4399f=_0x4399f-0x0;var _0x5b3506=_0x1f06[_0x4399f];return _0x5b3506;};'use strict';var Sequelize=require(_0x61f0('0x0'));const CLIENT_SIDE_LOG_LEVELS=[_0x61f0('0x1'),_0x61f0('0x2'),_0x61f0('0x3'),_0x61f0('0x4')];module['exports']={'clientSideLoggingLevel':{'type':Sequelize[_0x61f0('0x5')](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':_0x61f0('0x1'),'validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize[_0x61f0('0x6')],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize['TEXT'],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize[_0x61f0('0x7')],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize[_0x61f0('0x8')],'unique':_0x61f0('0x9')}}; \ No newline at end of file +var _0x9b38=['info','error','TEXT','INTEGER','sequelize','warning'];(function(_0x451bed,_0x17621c){var _0x338f53=function(_0x48f04e){while(--_0x48f04e){_0x451bed['push'](_0x451bed['shift']());}};_0x338f53(++_0x17621c);}(_0x9b38,0x172));var _0x89b3=function(_0x3ce9cc,_0x50fb18){_0x3ce9cc=_0x3ce9cc-0x0;var _0x279201=_0x9b38[_0x3ce9cc];return _0x279201;};'use strict';var Sequelize=require(_0x89b3('0x0'));const CLIENT_SIDE_LOG_LEVELS=['error',_0x89b3('0x1'),_0x89b3('0x2'),'debug'];module['exports']={'clientSideLoggingLevel':{'type':Sequelize['ENUM'](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':_0x89b3('0x3'),'validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize[_0x89b3('0x4')],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize['DATE'],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize[_0x89b3('0x5')],'unique':'UserId'}}; \ 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 7945eae..f1a7f12 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 _0xbe45=['status','json','update','then','error','name','user','role','admin','Unauthorized','params','Invalid\x20user\x20setting\x20id','find','body','catch','lodash','ioredis','api','../../config/environment','../../mysqldb','socket.io-emitter','redis','./user-setting.socket','defaults','localhost'];(function(_0x474e35,_0x2f8226){var _0x13062a=function(_0x53938f){while(--_0x53938f){_0x474e35['push'](_0x474e35['shift']());}};_0x13062a(++_0x2f8226);}(_0xbe45,0xf0));var _0x5be4=function(_0x3624e2,_0x41aa26){_0x3624e2=_0x3624e2-0x0;var _0x3e1316=_0xbe45[_0x3624e2];return _0x3e1316;};'use strict';var _=require(_0x5be4('0x0'));var Redis=require(_0x5be4('0x1'));var logger=require('../../config/logger')(_0x5be4('0x2'));var config=require(_0x5be4('0x3'));var db=require(_0x5be4('0x4'))['db'];var socket=require(_0x5be4('0x5'))(new Redis(config[_0x5be4('0x6')]));require(_0x5be4('0x7'))['register'](socket);config[_0x5be4('0x6')]=_[_0x5be4('0x8')](config[_0x5be4('0x6')],{'host':_0x5be4('0x9'),'port':0x18eb});function respondWithResult(_0xa883b2,_0x451a23){_0x451a23=_0x451a23||0xc8;return function(_0x2a2e93){if(_0x2a2e93){return _0xa883b2[_0x5be4('0xa')](_0x451a23)[_0x5be4('0xb')](_0x2a2e93);}};}function saveUpdates(_0x1e4ec5){return function(_0x4053e9){if(_0x4053e9){return _0x4053e9[_0x5be4('0xc')](_0x1e4ec5)[_0x5be4('0xd')](function(_0x4abb5d){return _0x4abb5d;});}return null;};}function handleEntityNotFound(_0xc75e87){return function(_0x47a9ad){if(!_0x47a9ad){_0xc75e87['sendStatus'](0x194);}return _0x47a9ad;};}function handleError(_0x35662a,_0x53c256){_0x53c256=_0x53c256||0x1f4;return function(_0x42bbee){logger[_0x5be4('0xe')](_0x42bbee['stack']);if(_0x42bbee[_0x5be4('0xf')]){delete _0x42bbee[_0x5be4('0xf')];}_0x35662a[_0x5be4('0xa')](_0x53c256)['send'](_0x42bbee);};}exports[_0x5be4('0xc')]=function(_0x4a84c5,_0x246d2e){if(_0x4a84c5[_0x5be4('0x10')][_0x5be4('0x11')]!==_0x5be4('0x12'))throw new Error(_0x5be4('0x13'));if(isNaN(Number(_0x4a84c5[_0x5be4('0x14')]['id'])))throw new Error(_0x5be4('0x15'));return db['UserSetting'][_0x5be4('0x16')]({'where':{'id':_0x4a84c5[_0x5be4('0x14')]['id']}})[_0x5be4('0xd')](handleEntityNotFound(_0x246d2e,null))[_0x5be4('0xd')](saveUpdates(_0x4a84c5[_0x5be4('0x17')],null))[_0x5be4('0xd')](respondWithResult(_0x246d2e,null))[_0x5be4('0x18')](handleError(_0x246d2e,null));}; \ No newline at end of file +var _0xe13a=['api','../../config/environment','socket.io-emitter','redis','./user-setting.socket','register','defaults','localhost','status','json','update','then','sendStatus','error','stack','name','send','admin','Unauthorized','params','Invalid\x20user\x20setting\x20id','UserSetting','find','body','catch','ioredis','../../config/logger'];(function(_0x3e37d2,_0x30679e){var _0x247a83=function(_0x5bee50){while(--_0x5bee50){_0x3e37d2['push'](_0x3e37d2['shift']());}};_0x247a83(++_0x30679e);}(_0xe13a,0x178));var _0xae13=function(_0x19331d,_0x29bede){_0x19331d=_0x19331d-0x0;var _0xc3583c=_0xe13a[_0x19331d];return _0xc3583c;};'use strict';var _=require('lodash');var Redis=require(_0xae13('0x0'));var logger=require(_0xae13('0x1'))(_0xae13('0x2'));var config=require(_0xae13('0x3'));var db=require('../../mysqldb')['db'];var socket=require(_0xae13('0x4'))(new Redis(config[_0xae13('0x5')]));require(_0xae13('0x6'))[_0xae13('0x7')](socket);config[_0xae13('0x5')]=_[_0xae13('0x8')](config[_0xae13('0x5')],{'host':_0xae13('0x9'),'port':0x18eb});function respondWithResult(_0x341ba4,_0x4ae51f){_0x4ae51f=_0x4ae51f||0xc8;return function(_0x2f6d10){if(_0x2f6d10){return _0x341ba4[_0xae13('0xa')](_0x4ae51f)[_0xae13('0xb')](_0x2f6d10);}};}function saveUpdates(_0x2a793f){return function(_0x22027e){if(_0x22027e){return _0x22027e[_0xae13('0xc')](_0x2a793f)[_0xae13('0xd')](function(_0x2d1149){return _0x2d1149;});}return null;};}function handleEntityNotFound(_0x1f3451){return function(_0x5990e3){if(!_0x5990e3){_0x1f3451[_0xae13('0xe')](0x194);}return _0x5990e3;};}function handleError(_0x83de98,_0x3d6a85){_0x3d6a85=_0x3d6a85||0x1f4;return function(_0x3a6d41){logger[_0xae13('0xf')](_0x3a6d41[_0xae13('0x10')]);if(_0x3a6d41[_0xae13('0x11')]){delete _0x3a6d41['name'];}_0x83de98[_0xae13('0xa')](_0x3d6a85)[_0xae13('0x12')](_0x3a6d41);};}exports['update']=function(_0x589803,_0x506411){if(_0x589803['user']['role']!==_0xae13('0x13'))throw new Error(_0xae13('0x14'));if(isNaN(Number(_0x589803[_0xae13('0x15')]['id'])))throw new Error(_0xae13('0x16'));return db[_0xae13('0x17')][_0xae13('0x18')]({'where':{'id':_0x589803['params']['id']}})[_0xae13('0xd')](handleEntityNotFound(_0x506411,null))['then'](saveUpdates(_0x589803[_0xae13('0x19')],null))[_0xae13('0xd')](respondWithResult(_0x506411,null))[_0xae13('0x1a')](handleError(_0x506411,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 d53b7e9..cae3486 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 _0x7882=['remove','emit','hook','exports','events','../../mysqldb','UserSetting','setMaxListeners','save','update'];(function(_0x4f3b96,_0x2ef96a){var _0x45a23e=function(_0x59cf68){while(--_0x59cf68){_0x4f3b96['push'](_0x4f3b96['shift']());}};_0x45a23e(++_0x2ef96a);}(_0x7882,0x16c));var _0x2788=function(_0x443f79,_0x33e446){_0x443f79=_0x443f79-0x0;var _0x3847e4=_0x7882[_0x443f79];return _0x3847e4;};'use strict';var EventEmitter=require(_0x2788('0x0'));var UserSetting=require(_0x2788('0x1'))['db'][_0x2788('0x2')];var UserSettingEvents=new EventEmitter();UserSettingEvents[_0x2788('0x3')](0x0);var events={'afterCreate':_0x2788('0x4'),'afterUpdate':_0x2788('0x5'),'afterDestroy':_0x2788('0x6')};function emitEvent(_0x2ab464){return function(_0x2bea83,_0x513267,_0x5c2f47){UserSettingEvents[_0x2788('0x7')](_0x2ab464+':'+_0x2bea83['id'],_0x2bea83);UserSettingEvents[_0x2788('0x7')](_0x2ab464,_0x2bea83);_0x5c2f47(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserSetting[_0x2788('0x8')](e,emitEvent(event));}}module[_0x2788('0x9')]=UserSettingEvents; \ No newline at end of file +var _0x2a01=['remove','emit','hasOwnProperty','hook','exports','events','UserSetting','setMaxListeners','save','update'];(function(_0x341be4,_0x11ccb1){var _0x5570e4=function(_0x2d6552){while(--_0x2d6552){_0x341be4['push'](_0x341be4['shift']());}};_0x5570e4(++_0x11ccb1);}(_0x2a01,0x113));var _0x12a0=function(_0x1928c9,_0x13a6d1){_0x1928c9=_0x1928c9-0x0;var _0x51b5fb=_0x2a01[_0x1928c9];return _0x51b5fb;};'use strict';var EventEmitter=require(_0x12a0('0x0'));var UserSetting=require('../../mysqldb')['db'][_0x12a0('0x1')];var UserSettingEvents=new EventEmitter();UserSettingEvents[_0x12a0('0x2')](0x0);var events={'afterCreate':_0x12a0('0x3'),'afterUpdate':_0x12a0('0x4'),'afterDestroy':_0x12a0('0x5')};function emitEvent(_0x3fb0df){return function(_0x17ca2b,_0x50be3c,_0x58c599){UserSettingEvents[_0x12a0('0x6')](_0x3fb0df+':'+_0x17ca2b['id'],_0x17ca2b);UserSettingEvents[_0x12a0('0x6')](_0x3fb0df,_0x17ca2b);_0x58c599(null);};}for(var e in events){if(events[_0x12a0('0x7')](e)){var event=events[e];UserSetting[_0x12a0('0x8')](e,emitEvent(event));}}module[_0x12a0('0x9')]=UserSettingEvents; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.model.js b/server/api/user-setting/user-setting.model.js index b481c62..923587d 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 _0x4e5c=['clientSideLoggingEnabledSince','./user-setting.attributes','UserSetting','user_settings'];(function(_0x2f169c,_0x130a86){var _0x39937f=function(_0x172407){while(--_0x172407){_0x2f169c['push'](_0x2f169c['shift']());}};_0x39937f(++_0x130a86);}(_0x4e5c,0x149));var _0xc4e5=function(_0x1694f5,_0x49b7c3){_0x1694f5=_0x1694f5-0x0;var _0x5b4321=_0x4e5c[_0x1694f5];return _0x5b4321;};'use strict';var attributes=require(_0xc4e5('0x0'));module['exports']=function(_0x1cf8d8){return _0x1cf8d8['define'](_0xc4e5('0x1'),attributes,{'tableName':_0xc4e5('0x2'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x253810){if(!_0x253810['clientSideLoggingEnabled'])_0x253810['clientSideLoggingEnabledSince']=null;else if(_0x253810['clientSideLoggingEnabledSince']===null)_0x253810[_0xc4e5('0x3')]=new Date();}}});}; \ No newline at end of file +var _0x9e6b=['exports','define','clientSideLoggingEnabled','clientSideLoggingEnabledSince','./user-setting.attributes'];(function(_0x4a6d6f,_0x275f37){var _0x71e7e5=function(_0x709a29){while(--_0x709a29){_0x4a6d6f['push'](_0x4a6d6f['shift']());}};_0x71e7e5(++_0x275f37);}(_0x9e6b,0x11c));var _0xb9e6=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x9e6b[_0xfae23b];return _0x200640;};'use strict';var attributes=require(_0xb9e6('0x0'));module[_0xb9e6('0x1')]=function(_0x5373ce){return _0x5373ce[_0xb9e6('0x2')]('UserSetting',attributes,{'tableName':'user_settings','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x33d064){if(!_0x33d064[_0xb9e6('0x3')])_0x33d064[_0xb9e6('0x4')]=null;else if(_0x33d064[_0xb9e6('0x4')]===null)_0x33d064['clientSideLoggingEnabledSince']=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 1bb2b34..ccfd82d 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 _0xd9a9=['emit','user-setting:update:user-','UserId','register','user-setting:','./user-setting.events','remove','update','user-setting:update'];(function(_0x204931,_0x53e846){var _0x9d95b8=function(_0x9faffa){while(--_0x9faffa){_0x204931['push'](_0x204931['shift']());}};_0x9d95b8(++_0x53e846);}(_0xd9a9,0x149));var _0x9d9a=function(_0x58ae03,_0x5396ef){_0x58ae03=_0x58ae03-0x0;var _0x9f4ddf=_0xd9a9[_0x58ae03];return _0x9f4ddf;};'use strict';var UserSettingEvents=require(_0x9d9a('0x0'));var events=['save',_0x9d9a('0x1'),_0x9d9a('0x2')];function createListener(_0x7ea251,_0x23453c){return function(_0x290114){_0x23453c['emit'](_0x7ea251,_0x290114);if(_0x7ea251===_0x9d9a('0x3')){_0x23453c[_0x9d9a('0x4')](_0x9d9a('0x5')+_0x290114[_0x9d9a('0x6')],_0x290114);}};}exports[_0x9d9a('0x7')]=function(_0x134546){for(var _0x398b97=0x0,_0x66cd01=events['length'];_0x398b97<_0x66cd01;_0x398b97++){var _0x1bd3d0=events[_0x398b97];var _0x2a6b19=createListener(_0x9d9a('0x8')+_0x1bd3d0,_0x134546);UserSettingEvents['on'](_0x1bd3d0,_0x2a6b19);}}; \ No newline at end of file +var _0x5f89=['user-setting:update','user-setting:update:user-','UserId','register','length','user-setting:','./user-setting.events','save','remove','emit'];(function(_0x468ad2,_0xc897f2){var _0x1e5289=function(_0x17a4f1){while(--_0x17a4f1){_0x468ad2['push'](_0x468ad2['shift']());}};_0x1e5289(++_0xc897f2);}(_0x5f89,0x7e));var _0x95f8=function(_0x141a50,_0x47c7d5){_0x141a50=_0x141a50-0x0;var _0x12a37f=_0x5f89[_0x141a50];return _0x12a37f;};'use strict';var UserSettingEvents=require(_0x95f8('0x0'));var events=[_0x95f8('0x1'),_0x95f8('0x2'),'update'];function createListener(_0xd4cdf3,_0x1ad9eb){return function(_0x535737){_0x1ad9eb[_0x95f8('0x3')](_0xd4cdf3,_0x535737);if(_0xd4cdf3===_0x95f8('0x4')){_0x1ad9eb[_0x95f8('0x3')](_0x95f8('0x5')+_0x535737[_0x95f8('0x6')],_0x535737);}};}exports[_0x95f8('0x7')]=function(_0x5c909a){for(var _0x193bdc=0x0,_0x37a5a6=events[_0x95f8('0x8')];_0x193bdc<_0x37a5a6;_0x193bdc++){var _0x5e7bed=events[_0x193bdc];var _0x443e96=createListener(_0x95f8('0x9')+_0x5e7bed,_0x5c909a);UserSettingEvents['on'](_0x5e7bed,_0x443e96);}}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index 236ba99..95c9555 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 _0x5373=['/:id/avatar','getAvatar','/:id/open_tabs','getOpenTabs','/:id/contacts','/:id/queues','getQueues','/:id/queues_rt','getVoiceQueuesRt','/:id/groups','getGroups','/:id/recordings','getRecordings','/:id/screen_recordings','getScreenRecordings','/:id/chat/interactions','getChatInteractions','getOpenchannelInteractions','getMailInteractions','/:id/sms/interactions','/:id/fax/interactions','getFaxInteractions','/:id/whatsapp/interactions','getWhatsappInteractions','/:id/teams','/:id/lists','getAgents','/:id/fax_accounts','getFaxAccounts','/:id/mail_accounts','getMailAccounts','/:id/openchannel_accounts','getOpenchannelAccounts','getSmsAccounts','getChatWebsites','/:id/whatsapp_accounts','getWhatsappAccounts','getScheduledCalls','/:id/api_key','post','addContacts','create','bulkCreate','addQueues','diskStorage','join','root','server/files/images/','format','%s-%s','now','single','/:id/login','/:id/logout','/:id/pause','pause','/:id/unpause','addTeams','/:id/chat_interactions','/:id/mail_interactions','/:id/fax_interactions','addFaxInteractions','addSmsInteractions','/:id/openchannel_interactions','addOpenchannelInteractions','/:id/whatsapp_interactions','addFaxAccounts','addOpenchannelAccounts','/:id/chat_websites','addWhatsappAccounts','createApiKey','put','/:id/password','changePassword','delete','removeQueues','removeTeams','destroy','removeChatInteractions','removeMailInteractions','removeFaxInteractions','/:id/sms_interactions','removeSmsInteractions','removeOpenchannelInteractions','removeWhatsappInteractions','removeFaxAccounts','removeOpenchannelAccounts','/:id/sms_accounts','removeSmsAccounts','removeWhatsappAccounts','removeApiKey','messengerSoundNotification','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./user.controller','get','index','/describe','/whoami','whoami','/presence','/:id','isAuthenticated','show'];(function(_0x53710e,_0x96b553){var _0x229d8d=function(_0x51f9c3){while(--_0x51f9c3){_0x53710e['push'](_0x53710e['shift']());}};_0x229d8d(++_0x96b553);}(_0x5373,0xcd));var _0x3537=function(_0x5c3936,_0x1dbb3e){_0x5c3936=_0x5c3936-0x0;var _0x4f6344=_0x5373[_0x5c3936];return _0x4f6344;};'use strict';var multer=require(_0x3537('0x0'));var util=require(_0x3537('0x1'));var path=require(_0x3537('0x2'));var timeout=require(_0x3537('0x3'));var express=require(_0x3537('0x4'));var router=express[_0x3537('0x5')]();var fs_extra=require(_0x3537('0x6'));var auth=require(_0x3537('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x3537('0x8'));var controller=require(_0x3537('0x9'));router[_0x3537('0xa')]('/',auth['isAuthenticated'](),controller[_0x3537('0xb')]);router[_0x3537('0xa')](_0x3537('0xc'),auth['isAuthenticated'](),controller['describe']);router[_0x3537('0xa')](_0x3537('0xd'),auth['isAuthenticated'](),controller[_0x3537('0xe')]);router['get'](_0x3537('0xf'),auth['isAuthenticated'](),controller['getPresence']);router['get'](_0x3537('0x10'),auth[_0x3537('0x11')](),controller[_0x3537('0x12')]);router[_0x3537('0xa')](_0x3537('0x13'),controller[_0x3537('0x14')]);router[_0x3537('0xa')](_0x3537('0x15'),auth[_0x3537('0x11')](),controller[_0x3537('0x16')]);router[_0x3537('0xa')](_0x3537('0x17'),auth['isAuthenticated'](),controller['getContacts']);router[_0x3537('0xa')](_0x3537('0x18'),auth[_0x3537('0x11')](),controller[_0x3537('0x19')]);router['get'](_0x3537('0x1a'),auth[_0x3537('0x11')](),controller[_0x3537('0x1b')]);router[_0x3537('0xa')](_0x3537('0x1c'),auth['isAuthenticated'](),controller[_0x3537('0x1d')]);router[_0x3537('0xa')](_0x3537('0x1e'),auth['isAuthenticated'](),controller[_0x3537('0x1f')]);router[_0x3537('0xa')](_0x3537('0x20'),auth[_0x3537('0x11')](),controller[_0x3537('0x21')]);router[_0x3537('0xa')](_0x3537('0x22'),auth[_0x3537('0x11')](),controller[_0x3537('0x23')]);router[_0x3537('0xa')]('/:id/openchannel/interactions',auth['isAuthenticated'](),controller[_0x3537('0x24')]);router[_0x3537('0xa')]('/:id/mail/interactions',auth[_0x3537('0x11')](),controller[_0x3537('0x25')]);router[_0x3537('0xa')](_0x3537('0x26'),auth[_0x3537('0x11')](),controller['getSmsInteractions']);router[_0x3537('0xa')](_0x3537('0x27'),auth['isAuthenticated'](),controller[_0x3537('0x28')]);router['get'](_0x3537('0x29'),auth[_0x3537('0x11')](),controller[_0x3537('0x2a')]);router[_0x3537('0xa')](_0x3537('0x2b'),auth['isAuthenticated'](),controller['getTeams']);router[_0x3537('0xa')](_0x3537('0x2c'),auth[_0x3537('0x11')](),controller['getLists']);router[_0x3537('0xa')]('/:id/agents',auth['isAuthenticated'](),controller[_0x3537('0x2d')]);router['get']('/:id/prefixes',auth[_0x3537('0x11')](),controller['getVoicePrefixes']);router[_0x3537('0xa')](_0x3537('0x2e'),auth[_0x3537('0x11')](),controller[_0x3537('0x2f')]);router[_0x3537('0xa')](_0x3537('0x30'),auth[_0x3537('0x11')](),controller[_0x3537('0x31')]);router[_0x3537('0xa')](_0x3537('0x32'),auth[_0x3537('0x11')](),controller[_0x3537('0x33')]);router[_0x3537('0xa')]('/:id/sms_accounts',auth[_0x3537('0x11')](),controller[_0x3537('0x34')]);router[_0x3537('0xa')]('/:id/chat_websites',auth[_0x3537('0x11')](),controller[_0x3537('0x35')]);router[_0x3537('0xa')](_0x3537('0x36'),auth['isAuthenticated'](),controller[_0x3537('0x37')]);router['get']('/:id/scheduled_calls',auth[_0x3537('0x11')](),controller[_0x3537('0x38')]);router[_0x3537('0xa')](_0x3537('0x39'),auth[_0x3537('0x11')](),controller['getApiKey']);router[_0x3537('0x3a')]('/:id/contacts',auth[_0x3537('0x11')](),controller[_0x3537('0x3b')]);router[_0x3537('0x3a')]('/',auth['isAuthenticated'](),controller[_0x3537('0x3c')]);router[_0x3537('0x3a')]('/create_many',auth[_0x3537('0x11')](),controller[_0x3537('0x3d')]);router[_0x3537('0x3a')](_0x3537('0x18'),auth[_0x3537('0x11')](),controller[_0x3537('0x3e')]);var upload=multer({'storage':multer[_0x3537('0x3f')]({'destination':function(_0x3b4fb4,_0x22713a,_0x49c496){_0x49c496(null,path[_0x3537('0x40')](config[_0x3537('0x41')],_0x3537('0x42')));},'filename':function(_0x575b2e,_0xdd240,_0x511433){_0x511433(null,util[_0x3537('0x43')](_0x3537('0x44'),Date[_0x3537('0x45')](),_0xdd240['originalname']));}})});router['post'](_0x3537('0x13'),upload[_0x3537('0x46')]('file'),controller['addAvatar']);router['post'](_0x3537('0x47'),auth[_0x3537('0x11')](),controller['login']);router['post'](_0x3537('0x48'),auth[_0x3537('0x11')](),controller['logout']);router[_0x3537('0x3a')](_0x3537('0x49'),auth[_0x3537('0x11')](),controller[_0x3537('0x4a')]);router['post'](_0x3537('0x4b'),auth[_0x3537('0x11')](),controller['unpause']);router[_0x3537('0x3a')](_0x3537('0x2b'),auth['isAuthenticated'](),controller[_0x3537('0x4c')]);router[_0x3537('0x3a')](_0x3537('0x4d'),auth[_0x3537('0x11')](),controller['addChatInteractions']);router[_0x3537('0x3a')](_0x3537('0x4e'),auth['isAuthenticated'](),controller['addMailInteractions']);router[_0x3537('0x3a')](_0x3537('0x4f'),auth[_0x3537('0x11')](),controller[_0x3537('0x50')]);router['post']('/:id/sms_interactions',auth['isAuthenticated'](),controller[_0x3537('0x51')]);router[_0x3537('0x3a')](_0x3537('0x52'),auth['isAuthenticated'](),controller[_0x3537('0x53')]);router['post'](_0x3537('0x54'),auth[_0x3537('0x11')](),controller['addWhatsappInteractions']);router[_0x3537('0x3a')](_0x3537('0x2e'),auth['isAuthenticated'](),controller[_0x3537('0x55')]);router[_0x3537('0x3a')]('/:id/mail_accounts',auth[_0x3537('0x11')](),controller['addMailAccounts']);router['post'](_0x3537('0x32'),auth[_0x3537('0x11')](),controller[_0x3537('0x56')]);router[_0x3537('0x3a')]('/:id/sms_accounts',auth['isAuthenticated'](),controller['addSmsAccounts']);router[_0x3537('0x3a')](_0x3537('0x57'),auth['isAuthenticated'](),controller['addChatWebsites']);router[_0x3537('0x3a')](_0x3537('0x36'),auth['isAuthenticated'](),controller[_0x3537('0x58')]);router['post'](_0x3537('0x39'),auth[_0x3537('0x11')](),controller[_0x3537('0x59')]);router[_0x3537('0x5a')](_0x3537('0x10'),auth[_0x3537('0x11')](),controller['update']);router[_0x3537('0x5a')](_0x3537('0x5b'),auth[_0x3537('0x11')](),controller[_0x3537('0x5c')]);router[_0x3537('0x5d')]('/:id/queues',auth[_0x3537('0x11')](),controller[_0x3537('0x5e')]);router['delete'](_0x3537('0x2b'),auth[_0x3537('0x11')](),controller[_0x3537('0x5f')]);router[_0x3537('0x5d')](_0x3537('0x10'),auth[_0x3537('0x11')](),controller[_0x3537('0x60')]);router[_0x3537('0x5d')](_0x3537('0x4d'),auth['isAuthenticated'](),controller[_0x3537('0x61')]);router[_0x3537('0x5d')](_0x3537('0x4e'),auth[_0x3537('0x11')](),controller[_0x3537('0x62')]);router[_0x3537('0x5d')](_0x3537('0x4f'),auth['isAuthenticated'](),controller[_0x3537('0x63')]);router[_0x3537('0x5d')](_0x3537('0x64'),auth['isAuthenticated'](),controller[_0x3537('0x65')]);router[_0x3537('0x5d')]('/:id/openchannel_interactions',auth['isAuthenticated'](),controller[_0x3537('0x66')]);router[_0x3537('0x5d')](_0x3537('0x54'),auth[_0x3537('0x11')](),controller[_0x3537('0x67')]);router['delete'](_0x3537('0x2e'),auth[_0x3537('0x11')](),controller[_0x3537('0x68')]);router[_0x3537('0x5d')](_0x3537('0x30'),auth[_0x3537('0x11')](),controller['removeMailAccounts']);router['delete'](_0x3537('0x32'),auth['isAuthenticated'](),controller[_0x3537('0x69')]);router[_0x3537('0x5d')](_0x3537('0x6a'),auth['isAuthenticated'](),controller[_0x3537('0x6b')]);router['delete'](_0x3537('0x57'),auth['isAuthenticated'](),controller['removeChatWebsites']);router[_0x3537('0x5d')](_0x3537('0x36'),auth[_0x3537('0x11')](),controller[_0x3537('0x6c')]);router[_0x3537('0x5d')]('/:id/api_key',auth[_0x3537('0x11')](),controller[_0x3537('0x6d')]);router[_0x3537('0x3a')]('/:id/messengerSoundNotification',auth[_0x3537('0x11')](),controller[_0x3537('0x6e')]);module[_0x3537('0x6f')]=router; \ No newline at end of file +var _0x4889=['whoami','/presence','getPresence','/:id','show','/:id/avatar','/:id/open_tabs','getOpenTabs','/:id/contacts','getContacts','getQueues','getVoiceQueuesRt','/:id/groups','getGroups','/:id/recordings','getRecordings','/:id/screen_recordings','getScreenRecordings','getChatInteractions','/:id/openchannel/interactions','getOpenchannelInteractions','/:id/mail/interactions','getMailInteractions','getSmsInteractions','getWhatsappInteractions','getTeams','/:id/lists','getLists','/:id/agents','getAgents','/:id/prefixes','getVoicePrefixes','/:id/fax_accounts','getFaxAccounts','getMailAccounts','/:id/openchannel_accounts','getOpenchannelAccounts','/:id/sms_accounts','getChatWebsites','/:id/whatsapp_accounts','getWhatsappAccounts','/:id/scheduled_calls','/:id/api_key','getApiKey','post','addContacts','create','/create_many','bulkCreate','/:id/queues','diskStorage','server/files/images/','format','%s-%s','now','originalname','single','file','addAvatar','/:id/login','login','logout','/:id/pause','pause','/:id/unpause','/:id/teams','addTeams','/:id/chat_interactions','addChatInteractions','/:id/mail_interactions','addMailInteractions','/:id/fax_interactions','addFaxInteractions','/:id/sms_interactions','addSmsInteractions','/:id/openchannel_interactions','addOpenchannelInteractions','/:id/whatsapp_interactions','addMailAccounts','addOpenchannelAccounts','addSmsAccounts','/:id/chat_websites','addWhatsappAccounts','put','/:id/password','changePassword','delete','removeQueues','removeTeams','removeChatInteractions','removeMailInteractions','removeSmsInteractions','removeOpenchannelInteractions','removeWhatsappInteractions','removeFaxAccounts','/:id/mail_accounts','removeMailAccounts','removeOpenchannelAccounts','removeSmsAccounts','removeChatWebsites','removeWhatsappAccounts','removeApiKey','/:id/messengerSoundNotification','messengerSoundNotification','exports','multer','util','connect-timeout','fs-extra','../../components/interaction/service','./user.controller','isAuthenticated','index','get'];(function(_0x52660b,_0xbdd628){var _0x24eac6=function(_0x2a0eca){while(--_0x2a0eca){_0x52660b['push'](_0x52660b['shift']());}};_0x24eac6(++_0xbdd628);}(_0x4889,0x69));var _0x9488=function(_0x491faa,_0x4f2907){_0x491faa=_0x491faa-0x0;var _0x414440=_0x4889[_0x491faa];return _0x414440;};'use strict';var multer=require(_0x9488('0x0'));var util=require(_0x9488('0x1'));var path=require('path');var timeout=require(_0x9488('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x9488('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x9488('0x4'));var config=require('../../config/environment');var controller=require(_0x9488('0x5'));router['get']('/',auth[_0x9488('0x6')](),controller[_0x9488('0x7')]);router[_0x9488('0x8')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x9488('0x8')]('/whoami',auth['isAuthenticated'](),controller[_0x9488('0x9')]);router[_0x9488('0x8')](_0x9488('0xa'),auth[_0x9488('0x6')](),controller[_0x9488('0xb')]);router[_0x9488('0x8')](_0x9488('0xc'),auth[_0x9488('0x6')](),controller[_0x9488('0xd')]);router[_0x9488('0x8')](_0x9488('0xe'),controller['getAvatar']);router[_0x9488('0x8')](_0x9488('0xf'),auth[_0x9488('0x6')](),controller[_0x9488('0x10')]);router[_0x9488('0x8')](_0x9488('0x11'),auth[_0x9488('0x6')](),controller[_0x9488('0x12')]);router['get']('/:id/queues',auth['isAuthenticated'](),controller[_0x9488('0x13')]);router[_0x9488('0x8')]('/:id/queues_rt',auth[_0x9488('0x6')](),controller[_0x9488('0x14')]);router[_0x9488('0x8')](_0x9488('0x15'),auth[_0x9488('0x6')](),controller[_0x9488('0x16')]);router[_0x9488('0x8')](_0x9488('0x17'),auth[_0x9488('0x6')](),controller[_0x9488('0x18')]);router[_0x9488('0x8')](_0x9488('0x19'),auth['isAuthenticated'](),controller[_0x9488('0x1a')]);router['get']('/:id/chat/interactions',auth[_0x9488('0x6')](),controller[_0x9488('0x1b')]);router[_0x9488('0x8')](_0x9488('0x1c'),auth[_0x9488('0x6')](),controller[_0x9488('0x1d')]);router['get'](_0x9488('0x1e'),auth['isAuthenticated'](),controller[_0x9488('0x1f')]);router[_0x9488('0x8')]('/:id/sms/interactions',auth[_0x9488('0x6')](),controller[_0x9488('0x20')]);router[_0x9488('0x8')]('/:id/fax/interactions',auth[_0x9488('0x6')](),controller['getFaxInteractions']);router[_0x9488('0x8')]('/:id/whatsapp/interactions',auth[_0x9488('0x6')](),controller[_0x9488('0x21')]);router[_0x9488('0x8')]('/:id/teams',auth[_0x9488('0x6')](),controller[_0x9488('0x22')]);router['get'](_0x9488('0x23'),auth['isAuthenticated'](),controller[_0x9488('0x24')]);router['get'](_0x9488('0x25'),auth[_0x9488('0x6')](),controller[_0x9488('0x26')]);router[_0x9488('0x8')](_0x9488('0x27'),auth[_0x9488('0x6')](),controller[_0x9488('0x28')]);router[_0x9488('0x8')](_0x9488('0x29'),auth['isAuthenticated'](),controller[_0x9488('0x2a')]);router[_0x9488('0x8')]('/:id/mail_accounts',auth[_0x9488('0x6')](),controller[_0x9488('0x2b')]);router['get'](_0x9488('0x2c'),auth[_0x9488('0x6')](),controller[_0x9488('0x2d')]);router[_0x9488('0x8')](_0x9488('0x2e'),auth[_0x9488('0x6')](),controller['getSmsAccounts']);router[_0x9488('0x8')]('/:id/chat_websites',auth[_0x9488('0x6')](),controller[_0x9488('0x2f')]);router[_0x9488('0x8')](_0x9488('0x30'),auth[_0x9488('0x6')](),controller[_0x9488('0x31')]);router['get'](_0x9488('0x32'),auth[_0x9488('0x6')](),controller['getScheduledCalls']);router['get'](_0x9488('0x33'),auth[_0x9488('0x6')](),controller[_0x9488('0x34')]);router[_0x9488('0x35')](_0x9488('0x11'),auth[_0x9488('0x6')](),controller[_0x9488('0x36')]);router[_0x9488('0x35')]('/',auth[_0x9488('0x6')](),controller[_0x9488('0x37')]);router['post'](_0x9488('0x38'),auth[_0x9488('0x6')](),controller[_0x9488('0x39')]);router[_0x9488('0x35')](_0x9488('0x3a'),auth[_0x9488('0x6')](),controller['addQueues']);var upload=multer({'storage':multer[_0x9488('0x3b')]({'destination':function(_0x407e57,_0x13467e,_0x3199c5){_0x3199c5(null,path['join'](config['root'],_0x9488('0x3c')));},'filename':function(_0x4cb536,_0xdbaee1,_0x3488a1){_0x3488a1(null,util[_0x9488('0x3d')](_0x9488('0x3e'),Date[_0x9488('0x3f')](),_0xdbaee1[_0x9488('0x40')]));}})});router[_0x9488('0x35')](_0x9488('0xe'),upload[_0x9488('0x41')](_0x9488('0x42')),controller[_0x9488('0x43')]);router['post'](_0x9488('0x44'),auth[_0x9488('0x6')](),controller[_0x9488('0x45')]);router[_0x9488('0x35')]('/:id/logout',auth[_0x9488('0x6')](),controller[_0x9488('0x46')]);router[_0x9488('0x35')](_0x9488('0x47'),auth[_0x9488('0x6')](),controller[_0x9488('0x48')]);router[_0x9488('0x35')](_0x9488('0x49'),auth[_0x9488('0x6')](),controller['unpause']);router[_0x9488('0x35')](_0x9488('0x4a'),auth[_0x9488('0x6')](),controller[_0x9488('0x4b')]);router[_0x9488('0x35')](_0x9488('0x4c'),auth['isAuthenticated'](),controller[_0x9488('0x4d')]);router[_0x9488('0x35')](_0x9488('0x4e'),auth[_0x9488('0x6')](),controller[_0x9488('0x4f')]);router['post'](_0x9488('0x50'),auth[_0x9488('0x6')](),controller[_0x9488('0x51')]);router[_0x9488('0x35')](_0x9488('0x52'),auth[_0x9488('0x6')](),controller[_0x9488('0x53')]);router['post'](_0x9488('0x54'),auth[_0x9488('0x6')](),controller[_0x9488('0x55')]);router[_0x9488('0x35')](_0x9488('0x56'),auth[_0x9488('0x6')](),controller['addWhatsappInteractions']);router['post'](_0x9488('0x29'),auth['isAuthenticated'](),controller['addFaxAccounts']);router[_0x9488('0x35')]('/:id/mail_accounts',auth[_0x9488('0x6')](),controller[_0x9488('0x57')]);router[_0x9488('0x35')](_0x9488('0x2c'),auth[_0x9488('0x6')](),controller[_0x9488('0x58')]);router[_0x9488('0x35')](_0x9488('0x2e'),auth[_0x9488('0x6')](),controller[_0x9488('0x59')]);router[_0x9488('0x35')](_0x9488('0x5a'),auth[_0x9488('0x6')](),controller['addChatWebsites']);router[_0x9488('0x35')](_0x9488('0x30'),auth[_0x9488('0x6')](),controller[_0x9488('0x5b')]);router[_0x9488('0x35')](_0x9488('0x33'),auth[_0x9488('0x6')](),controller['createApiKey']);router[_0x9488('0x5c')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x9488('0x5c')](_0x9488('0x5d'),auth[_0x9488('0x6')](),controller[_0x9488('0x5e')]);router[_0x9488('0x5f')]('/:id/queues',auth[_0x9488('0x6')](),controller[_0x9488('0x60')]);router[_0x9488('0x5f')](_0x9488('0x4a'),auth[_0x9488('0x6')](),controller[_0x9488('0x61')]);router[_0x9488('0x5f')](_0x9488('0xc'),auth[_0x9488('0x6')](),controller['destroy']);router[_0x9488('0x5f')](_0x9488('0x4c'),auth['isAuthenticated'](),controller[_0x9488('0x62')]);router[_0x9488('0x5f')](_0x9488('0x4e'),auth[_0x9488('0x6')](),controller[_0x9488('0x63')]);router[_0x9488('0x5f')](_0x9488('0x50'),auth[_0x9488('0x6')](),controller['removeFaxInteractions']);router[_0x9488('0x5f')](_0x9488('0x52'),auth[_0x9488('0x6')](),controller[_0x9488('0x64')]);router[_0x9488('0x5f')]('/:id/openchannel_interactions',auth['isAuthenticated'](),controller[_0x9488('0x65')]);router[_0x9488('0x5f')](_0x9488('0x56'),auth[_0x9488('0x6')](),controller[_0x9488('0x66')]);router['delete'](_0x9488('0x29'),auth[_0x9488('0x6')](),controller[_0x9488('0x67')]);router[_0x9488('0x5f')](_0x9488('0x68'),auth[_0x9488('0x6')](),controller[_0x9488('0x69')]);router[_0x9488('0x5f')](_0x9488('0x2c'),auth['isAuthenticated'](),controller[_0x9488('0x6a')]);router[_0x9488('0x5f')](_0x9488('0x2e'),auth['isAuthenticated'](),controller[_0x9488('0x6b')]);router['delete'](_0x9488('0x5a'),auth[_0x9488('0x6')](),controller[_0x9488('0x6c')]);router[_0x9488('0x5f')](_0x9488('0x30'),auth[_0x9488('0x6')](),controller[_0x9488('0x6d')]);router['delete'](_0x9488('0x33'),auth[_0x9488('0x6')](),controller[_0x9488('0x6e')]);router[_0x9488('0x35')](_0x9488('0x6f'),auth[_0x9488('0x6')](),controller[_0x9488('0x70')]);module[_0x9488('0x71')]=router; \ No newline at end of file diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index d0c30dd..8d7cd64 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 _0xe01d=['screenrecording','blocked','blockedAt','UNSIGNED','sequelize','moment','util','exports','STRING','name','setDataValue','fullname','callerid','format','\x22%s\x22\x20<%s>','getDataValue','email','toLowerCase','ENUM','admin','telephone','local','INTEGER','internal','accountcode','BOOLEAN','DATE','dynamic','friend','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB','udp','transport','join','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','shortinfo','inband','auto','yes','nonat','update','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','never','accept','refuse','originate','uas','fingerprint','certificate','passive','update,nonat','showWebBar','isArray','force_avp','dtlsenable','dtlsverify','dtlssetup','dtlscertfile','dtlsprivatekey','wss','encryption','avpf','icesupport','actpass','rtcp_mux','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','true','false'];(function(_0x226771,_0xf7e8b5){var _0x12dd08=function(_0x4bc657){while(--_0x4bc657){_0x226771['push'](_0x226771['shift']());}};_0x12dd08(++_0xf7e8b5);}(_0xe01d,0x160));var _0xde01=function(_0x2bbee4,_0x287798){_0x2bbee4=_0x2bbee4-0x0;var _0x209006=_0xe01d[_0x2bbee4];return _0x209006;};'use strict';var Sequelize=require(_0xde01('0x0'));var moment=require(_0xde01('0x1'));var util=require(_0xde01('0x2'));var _=require('lodash');module[_0xde01('0x3')]={'name':{'type':Sequelize[_0xde01('0x4')],'allowNull':![],'unique':_0xde01('0x5'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x1a89d3){this[_0xde01('0x6')](_0xde01('0x5'),_0x1a89d3);this[_0xde01('0x6')]('defaultuser',_0x1a89d3);},'comment':'The\x20name\x20of\x20the\x20user'},'fullname':{'type':Sequelize[_0xde01('0x4')],'allowNull':![],'set':function(_0xe5ed61){this[_0xde01('0x6')](_0xde01('0x7'),_0xe5ed61);this['setDataValue'](_0xde01('0x8'),util[_0xde01('0x9')](_0xde01('0xa'),_0xe5ed61,this[_0xde01('0xb')]('internal')));}},'alias':{'type':Sequelize[_0xde01('0x4')]},'email':{'type':Sequelize['STRING'],'allowNull':![],'unique':'email','validate':{'isEmail':!![]},'set':function(_0x1e5ee9){if(_0x1e5ee9){this[_0xde01('0x6')](_0xde01('0xc'),_0x1e5ee9[_0xde01('0xd')]());}}},'role':{'type':Sequelize[_0xde01('0xe')](_0xde01('0xf'),'user','agent',_0xde01('0x10')),'allowNull':![]},'password':{'type':Sequelize[_0xde01('0x4')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0xde01('0x4')],'defaultValue':_0xde01('0x11')},'internal':{'type':Sequelize[_0xde01('0x12')](0xb),'allowNull':![],'unique':_0xde01('0x13'),'set':function(_0x4221e9){this[_0xde01('0x6')]('internal',_0x4221e9);this[_0xde01('0x6')](_0xde01('0x14'),_0x4221e9);this[_0xde01('0x6')]('callerid',util['format'](_0xde01('0xa'),this[_0xde01('0xb')](_0xde01('0x7')),_0x4221e9));}},'salt':{'type':Sequelize[_0xde01('0x4')]},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize[_0xde01('0x4')]},'address':{'type':Sequelize[_0xde01('0x4')]},'zipcode':{'type':Sequelize['STRING']},'userpic':{'type':Sequelize[_0xde01('0x4')]},'city':{'type':Sequelize[_0xde01('0x4')]},'country':{'type':Sequelize['STRING']},'online':{'type':Sequelize[_0xde01('0x15')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0xde01('0x16')]},'voicePause':{'type':Sequelize[_0xde01('0x15')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0xde01('0x15')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0xde01('0x15')],'defaultValue':![]},'faxPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'smsPause':{'type':Sequelize[_0xde01('0x15')],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0xde01('0x15')],'defaultValue':![]},'openchannelPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'pauseType':{'type':Sequelize['STRING'],'defaultValue':'DEFAULT\x20PAUSE'},'lastPauseAt':{'type':Sequelize[_0xde01('0x16')]},'chatCapacity':{'type':Sequelize[_0xde01('0x12')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0xde01('0x12')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0xde01('0x12')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0xde01('0x12')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0xde01('0x15')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0xde01('0x15')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0xde01('0x12')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0xde01('0x12')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0xde01('0x15')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0xde01('0x12')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0xde01('0x15')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0xde01('0x15')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0xde01('0x15')],'defaultValue':![]},'description':{'type':Sequelize[_0xde01('0x4')],'allowNull':!![]},'host':{'type':Sequelize[_0xde01('0x4')],'allowNull':!![],'defaultValue':_0xde01('0x17')},'ipaddr':{'type':Sequelize[_0xde01('0x4')],'allowNull':!![]},'port':{'type':Sequelize[_0xde01('0x12')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0xde01('0x4')],'allowNull':!![]},'regserver':{'type':Sequelize[_0xde01('0x4')],'allowNull':!![]},'useragent':{'type':Sequelize[_0xde01('0x4')],'allowNull':!![]},'lastms':{'type':Sequelize[_0xde01('0x12')](0xb),'allowNull':!![]},'type':{'type':Sequelize['ENUM'](_0xde01('0x18'),'user','peer'),'allowNull':!![],'defaultValue':_0xde01('0x18')},'context':{'type':Sequelize[_0xde01('0x4')],'allowNull':!![],'defaultValue':_0xde01('0x19')},'callingpres':{'type':Sequelize['ENUM'](_0xde01('0x1a'),_0xde01('0x1b'),_0xde01('0x1c'),_0xde01('0x1d'),_0xde01('0x1e'),_0xde01('0x1f'),'PROHIB_FAILED_SCREEN',_0xde01('0x20')),'allowNull':!![]},'deny':{'type':Sequelize[_0xde01('0x4')],'allowNull':!![]},'permit':{'type':Sequelize['STRING'],'allowNull':!![]},'secret':{'type':Sequelize[_0xde01('0x4')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0xde01('0x4')],'allowNull':!![]},'remotesecret':{'type':Sequelize['STRING'],'allowNull':!![]},'transport':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0xde01('0x21'),'set':function(_0x27286c){this['setDataValue'](_0xde01('0x22'),_0x27286c?_0x27286c[_0xde01('0x23')](','):null);},'get':function(){return this['getDataValue'](_0xde01('0x22'))?this[_0xde01('0xb')]('transport')[_0xde01('0x24')](','):null;},'comment':_0xde01('0x25')},'dtmfmode':{'type':Sequelize[_0xde01('0xe')](_0xde01('0x26'),'info',_0xde01('0x27'),_0xde01('0x28'),_0xde01('0x29')),'allowNull':!![],'defaultValue':_0xde01('0x26')},'directmedia':{'type':Sequelize['ENUM'](_0xde01('0x2a'),'no',_0xde01('0x2b'),_0xde01('0x2c'),'outgoing'),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xde01('0xe')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xde01('0x4')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0xde01('0x4')],'allowNull':!![]},'nat':{'type':Sequelize[_0xde01('0x4')],'allowNull':!![],'defaultValue':_0xde01('0x2d'),'set':function(_0xc79b94){this[_0xde01('0x6')](_0xde01('0x2e'),_0xc79b94?_0xc79b94[_0xde01('0x23')](','):null);},'get':function(){return this[_0xde01('0xb')](_0xde01('0x2e'))?this[_0xde01('0xb')](_0xde01('0x2e'))[_0xde01('0x24')](','):null;},'comment':_0xde01('0x2f')},'callgroup':{'type':Sequelize[_0xde01('0x4')]},'namedcallgroup':{'type':Sequelize[_0xde01('0x4')]},'pickupgroup':{'type':Sequelize[_0xde01('0x4')]},'namedpickupgroup':{'type':Sequelize[_0xde01('0x4')]},'language':{'type':Sequelize[_0xde01('0x4')],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING']},'disallow':{'type':Sequelize[_0xde01('0x4')],'allowNull':![],'defaultValue':_0xde01('0x30')},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xde01('0x31'),'set':function(_0x4bb65d){this[_0xde01('0x6')](_0xde01('0x32'),_0x4bb65d?_0x4bb65d[_0xde01('0x23')](';'):_0xde01('0x31'));},'get':function(){return this[_0xde01('0xb')]('allow')?this[_0xde01('0xb')](_0xde01('0x32'))[_0xde01('0x24')](';'):null;},'comment':_0xde01('0x33')},'autoframing':{'type':Sequelize[_0xde01('0xe')](_0xde01('0x2a'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize['STRING'],'allowNull':!![],'set':function(_0x12d5fe){this['setDataValue'](_0xde01('0x34'),_0x12d5fe?_0x12d5fe[_0xde01('0x23')](','):null);},'get':function(){return this[_0xde01('0xb')]('insecure')?this['getDataValue'](_0xde01('0x34'))['split'](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize[_0xde01('0xe')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM'](_0xde01('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xde01('0xe')]('yes','no',_0xde01('0x35')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0xde01('0xe')](_0xde01('0x2a'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize['ENUM'](_0xde01('0x2a'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0xde01('0x12')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0xde01('0x4')],'allowNull':!![]},'callerid':{'type':Sequelize[_0xde01('0x4')],'allowNull':!![],'defaultValue':'\x22\x22\x20<>'},'amaflags':{'type':Sequelize['STRING'],'allowNull':!![]},'callcounter':{'type':Sequelize[_0xde01('0xe')]('yes','no'),'allowNull':!![],'defaultValue':_0xde01('0x2a')},'busylevel':{'type':Sequelize[_0xde01('0x12')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0xde01('0xe')](_0xde01('0x2a'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize['ENUM'](_0xde01('0x2a'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0xde01('0xe')]('yes','no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0xde01('0xe')](_0xde01('0x2a'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0xde01('0x4')],'allowNull':!![]},'template':{'type':Sequelize['STRING'],'allowNull':!![]},'videosupport':{'type':Sequelize[_0xde01('0xe')](_0xde01('0x2a'),'no','always'),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0xde01('0xe')](_0xde01('0x2a'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0xde01('0x4')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0xde01('0xe')](_0xde01('0x36'),_0xde01('0x37'),_0xde01('0x38')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0xde01('0x12')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0xde01('0x12')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize['ENUM']('uac',_0xde01('0x39')),'allowNull':!![],'defaultValue':_0xde01('0x39')},'t38pt_usertpsource':{'type':Sequelize['STRING'],'allowNull':!![]},'regexten':{'type':Sequelize[_0xde01('0x4')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0xde01('0x4')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0xde01('0x4')],'allowNull':!![]},'qualify':{'type':Sequelize['ENUM'](_0xde01('0x2a'),'no'),'allowNull':!![],'defaultValue':'yes'},'keepalive':{'type':Sequelize[_0xde01('0x12')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0xde01('0x4')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0xde01('0x4')],'allowNull':!![]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0xde01('0x12')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0xde01('0x12')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize['ENUM'](_0xde01('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xde01('0x4')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0xde01('0x4')],'allowNull':!![]},'timert1':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0xde01('0x12')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0xde01('0x12')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize['STRING'],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0xde01('0x4')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0xde01('0x4')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0xde01('0x4')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize['STRING'],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0xde01('0x12')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0xde01('0xe')](_0xde01('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0xde01('0xe')](_0xde01('0x2a'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0xde01('0xe')](_0xde01('0x2a'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0xde01('0xe')]('yes','no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0xde01('0xe')](_0xde01('0x2a'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0xde01('0xe')]('yes','no',_0xde01('0x3a'),_0xde01('0x3b')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0xde01('0x4')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0xde01('0x4')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0xde01('0x4')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0xde01('0x4')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0xde01('0x4')],'allowNull':!![]},'dtlssetup':{'type':Sequelize['ENUM']('active',_0xde01('0x3c'),'actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xde01('0x4')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0xde01('0xe')](_0xde01('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xde01('0x4')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0xde01('0x4')],'allowNull':!![]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0xde01('0xe')](_0xde01('0x2a'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0xde01('0xe')](_0xde01('0x2a'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0xde01('0x4')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0xde01('0x4')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0xde01('0x4')],'allowNull':!![]},'parkinglot':{'type':Sequelize['STRING'],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0xde01('0xe')]('yes','no',_0xde01('0x2b'),_0xde01('0x2c'),_0xde01('0x3d')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0xde01('0x15')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0xde01('0x4')]},'resetPasswordExpires':{'type':Sequelize[_0xde01('0x16')]},'passwordResetAt':{'type':Sequelize[_0xde01('0x16')],'defaultValue':null},'previousPasswords':{'type':Sequelize['TEXT']},'showWebBar':{'type':Sequelize[_0xde01('0x12')],'defaultValue':0x0,'set':function(_0x1e996c){this[_0xde01('0x6')](_0xde01('0x3e'),_0x1e996c);var _0x3221a1=this['get']({'plain':!![]});switch(_0x1e996c){case 0x0:case 0x1:var _0x50390e=_0x3221a1['transport']?_[_0xde01('0x3f')](_0x3221a1[_0xde01('0x22')])?_0x3221a1[_0xde01('0x22')][_0xde01('0x23')]():_0x3221a1[_0xde01('0x22')]:_0xde01('0x21');if(_0x50390e==='wss'){_0x50390e='udp';}this['setDataValue']('transport',_0x50390e);this[_0xde01('0x6')]('encryption','no');this['setDataValue']('avpf',null);this[_0xde01('0x6')](_0xde01('0x40'),null);this[_0xde01('0x6')]('icesupport',null);this[_0xde01('0x6')](_0xde01('0x41'),null);this[_0xde01('0x6')](_0xde01('0x42'),null);this[_0xde01('0x6')](_0xde01('0x43'),null);this[_0xde01('0x6')](_0xde01('0x44'),null);this[_0xde01('0x6')](_0xde01('0x45'),null);this[_0xde01('0x6')]('rtcp_mux','no');break;case 0x2:this[_0xde01('0x6')](_0xde01('0x22'),_0xde01('0x46'));this[_0xde01('0x6')](_0xde01('0x47'),_0xde01('0x2a'));this[_0xde01('0x6')](_0xde01('0x48'),_0xde01('0x2a'));this[_0xde01('0x6')](_0xde01('0x40'),'yes');this[_0xde01('0x6')](_0xde01('0x49'),_0xde01('0x2a'));this[_0xde01('0x6')](_0xde01('0x41'),_0xde01('0x2a'));this['setDataValue'](_0xde01('0x42'),'no');this[_0xde01('0x6')](_0xde01('0x43'),_0xde01('0x4a'));this[_0xde01('0x6')](_0xde01('0x44'),_0x3221a1[_0xde01('0x44')]||'/etc/pki/tls/certs/motion.crt');this[_0xde01('0x6')]('dtlsprivatekey',_0x3221a1[_0xde01('0x45')]||'/etc/pki/tls/private/motion.key');this[_0xde01('0x6')](_0xde01('0x4b'),'yes');break;default:}}},'permissions':{'type':Sequelize['TEXT'],'set':function(_0x2ecd05){this['setDataValue'](_0xde01('0x4c'),_0x2ecd05?_0x2ecd05[_0xde01('0x23')](','):[]);},'get':function(){return this[_0xde01('0xb')](_0xde01('0x4c'))?_[_0xde01('0x4d')](this['getDataValue'](_0xde01('0x4c'))['split'](','),function(_0x5660f4){return parseInt(_0x5660f4,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0xde01('0x4')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0xde01('0x4')]},'phoneBarBusyNumber':{'type':Sequelize[_0xde01('0x4')]},'phoneBarUnconditional':{'type':Sequelize[_0xde01('0x15')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0xde01('0x15')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0xde01('0x15')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0xde01('0x15')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0xde01('0x15')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0xde01('0x12')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0xde01('0x4')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0xde01('0x12')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0xde01('0xe')](_0xde01('0x2a'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0xde01('0x4')]},'phoneBarEnableJaws':{'type':Sequelize[_0xde01('0x15')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0xde01('0x4e')],'get':function(){return this[_0xde01('0xb')](_0xde01('0x4f'))?this[_0xde01('0xb')]('phoneBarEnableScreenRecordingByAgent'):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0xde01('0x15')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0xde01('0x15')],'defaultValue':![]},'interface':{'type':Sequelize[_0xde01('0x4')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0xde01('0x15')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0xde01('0x4')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0xde01('0x4')],'allowNull':!![]},'screenrecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0x2549cc){if(typeof _0x2549cc===_0xde01('0x50')){var _0x1f3d62=_0x2549cc==='1'?!![]:_0x2549cc==='0'?![]:_0x2549cc===_0xde01('0x51')?!![]:_0x2549cc===_0xde01('0x52')?![]:![];this[_0xde01('0x6')](_0xde01('0x53'),_0x1f3d62);}else{this['setDataValue'](_0xde01('0x53'),_0x2549cc);}}},'blocked':{'type':Sequelize[_0xde01('0x15')],'defaultValue':![],'set':function(_0x2d711b){this[_0xde01('0x6')](_0xde01('0x54'),_0x2d711b);if(_0x2d711b===!![]){this[_0xde01('0x6')]('blockedAt',moment());this[_0xde01('0x6')]('loginAttempts',0x0);}else{this[_0xde01('0x6')](_0xde01('0x55'),null);}}},'blockedAt':{'type':Sequelize[_0xde01('0x16')],'defaultValue':null},'loginAttempts':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'disabled':{'type':Sequelize[_0xde01('0x15')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0xde01('0x12')](0x5)[_0xde01('0x56')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0xde01('0x15')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0xde01('0x15')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0xde01('0x15')],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize[_0xde01('0x15')],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0xde01('0x15')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize[_0xde01('0x15')],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize[_0xde01('0x12')],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize[_0xde01('0x15')],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize[_0xde01('0x15')],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize[_0xde01('0x15')],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize[_0xde01('0x12')],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize[_0xde01('0x15')],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize[_0xde01('0x12')],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize[_0xde01('0x15')],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize[_0xde01('0x12')],'defaultValue':0x0},'messengerSoundNotification':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x9b50=['always','accept','uas','fingerprint','certificate','active','actpass','update','TEXT','get','wss','encryption','avpf','force_avp','icesupport','dtlsenable','dtlsverify','dtlssetup','dtlscertfile','dtlsprivatekey','rtcp_mux','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','permissions','map','phoneBarEnableScreenRecordingByAgent','string','false','screenrecording','blocked','blockedAt','loginAttempts','UNSIGNED','sequelize','util','lodash','STRING','name','setDataValue','callerid','format','\x22%s\x22\x20<%s>','getDataValue','internal','email','toLowerCase','ENUM','admin','user','agent','local','INTEGER','fullname','BOOLEAN','DATE','DEFAULT\x20PAUSE','dynamic','friend','peer','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','transport','join','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','info','shortinfo','inband','auto','rfc2833','yes','nonat','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<>'];(function(_0xd8d422,_0x2a29cb){var _0x554af6=function(_0x4f5385){while(--_0x4f5385){_0xd8d422['push'](_0xd8d422['shift']());}};_0x554af6(++_0x2a29cb);}(_0x9b50,0x78));var _0x09b5=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9b50[_0x6131cd];return _0x47e916;};'use strict';var Sequelize=require(_0x09b5('0x0'));var moment=require('moment');var util=require(_0x09b5('0x1'));var _=require(_0x09b5('0x2'));module['exports']={'name':{'type':Sequelize[_0x09b5('0x3')],'allowNull':![],'unique':_0x09b5('0x4'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x11b218){this[_0x09b5('0x5')](_0x09b5('0x4'),_0x11b218);this[_0x09b5('0x5')]('defaultuser',_0x11b218);},'comment':'The\x20name\x20of\x20the\x20user'},'fullname':{'type':Sequelize[_0x09b5('0x3')],'allowNull':![],'set':function(_0x119826){this[_0x09b5('0x5')]('fullname',_0x119826);this[_0x09b5('0x5')](_0x09b5('0x6'),util[_0x09b5('0x7')](_0x09b5('0x8'),_0x119826,this[_0x09b5('0x9')](_0x09b5('0xa'))));}},'alias':{'type':Sequelize[_0x09b5('0x3')]},'email':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x09b5('0xb'),'validate':{'isEmail':!![]},'set':function(_0x81dd32){if(_0x81dd32){this[_0x09b5('0x5')]('email',_0x81dd32[_0x09b5('0xc')]());}}},'role':{'type':Sequelize[_0x09b5('0xd')](_0x09b5('0xe'),_0x09b5('0xf'),_0x09b5('0x10'),'telephone'),'allowNull':![]},'password':{'type':Sequelize[_0x09b5('0x3')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize['STRING'],'defaultValue':_0x09b5('0x11')},'internal':{'type':Sequelize[_0x09b5('0x12')](0xb),'allowNull':![],'unique':_0x09b5('0xa'),'set':function(_0x4bb2b9){this['setDataValue'](_0x09b5('0xa'),_0x4bb2b9);this[_0x09b5('0x5')]('accountcode',_0x4bb2b9);this[_0x09b5('0x5')](_0x09b5('0x6'),util[_0x09b5('0x7')](_0x09b5('0x8'),this[_0x09b5('0x9')](_0x09b5('0x13')),_0x4bb2b9));}},'salt':{'type':Sequelize[_0x09b5('0x3')]},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize[_0x09b5('0x3')]},'address':{'type':Sequelize[_0x09b5('0x3')]},'zipcode':{'type':Sequelize[_0x09b5('0x3')]},'userpic':{'type':Sequelize[_0x09b5('0x3')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0x09b5('0x3')]},'online':{'type':Sequelize[_0x09b5('0x14')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x09b5('0x15')]},'voicePause':{'type':Sequelize[_0x09b5('0x14')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x09b5('0x14')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x09b5('0x14')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x09b5('0x14')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0x09b5('0x14')],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x09b5('0x14')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x09b5('0x14')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x09b5('0x3')],'defaultValue':_0x09b5('0x16')},'lastPauseAt':{'type':Sequelize[_0x09b5('0x15')]},'chatCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x09b5('0x12')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x09b5('0x14')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0x09b5('0x12')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x09b5('0x12')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize['INTEGER'],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x09b5('0x14')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x09b5('0x14')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x09b5('0x14')],'defaultValue':![]},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'host':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x09b5('0x17')},'ipaddr':{'type':Sequelize[_0x09b5('0x3')],'allowNull':!![]},'port':{'type':Sequelize[_0x09b5('0x12')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x09b5('0x12')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize['STRING'],'allowNull':!![]},'regserver':{'type':Sequelize[_0x09b5('0x3')],'allowNull':!![]},'useragent':{'type':Sequelize[_0x09b5('0x3')],'allowNull':!![]},'lastms':{'type':Sequelize[_0x09b5('0x12')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x09b5('0xd')](_0x09b5('0x18'),_0x09b5('0xf'),_0x09b5('0x19')),'allowNull':!![],'defaultValue':'friend'},'context':{'type':Sequelize[_0x09b5('0x3')],'allowNull':!![],'defaultValue':'from-sip'},'callingpres':{'type':Sequelize[_0x09b5('0xd')](_0x09b5('0x1a'),_0x09b5('0x1b'),'ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED',_0x09b5('0x1c'),_0x09b5('0x1d'),_0x09b5('0x1e')),'allowNull':!![]},'deny':{'type':Sequelize[_0x09b5('0x3')],'allowNull':!![]},'permit':{'type':Sequelize['STRING'],'allowNull':!![]},'secret':{'type':Sequelize[_0x09b5('0x3')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x09b5('0x3')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x09b5('0x3')],'allowNull':!![]},'transport':{'type':Sequelize[_0x09b5('0x3')],'allowNull':!![],'defaultValue':_0x09b5('0x1f'),'set':function(_0x3d3615){this[_0x09b5('0x5')](_0x09b5('0x20'),_0x3d3615?_0x3d3615[_0x09b5('0x21')](','):null);},'get':function(){return this[_0x09b5('0x9')](_0x09b5('0x20'))?this[_0x09b5('0x9')]('transport')[_0x09b5('0x22')](','):null;},'comment':_0x09b5('0x23')},'dtmfmode':{'type':Sequelize['ENUM']('rfc2833',_0x09b5('0x24'),_0x09b5('0x25'),_0x09b5('0x26'),_0x09b5('0x27')),'allowNull':!![],'defaultValue':_0x09b5('0x28')},'directmedia':{'type':Sequelize[_0x09b5('0xd')](_0x09b5('0x29'),'no',_0x09b5('0x2a'),'update',_0x09b5('0x2b')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x09b5('0xd')](_0x09b5('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x09b5('0x3')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x09b5('0x3')],'allowNull':!![]},'nat':{'type':Sequelize[_0x09b5('0x3')],'allowNull':!![],'defaultValue':_0x09b5('0x2c'),'set':function(_0x39b0fc){this['setDataValue'](_0x09b5('0x2d'),_0x39b0fc?_0x39b0fc[_0x09b5('0x21')](','):null);},'get':function(){return this[_0x09b5('0x9')]('nat')?this[_0x09b5('0x9')](_0x09b5('0x2d'))['split'](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0x09b5('0x3')]},'namedcallgroup':{'type':Sequelize[_0x09b5('0x3')]},'pickupgroup':{'type':Sequelize['STRING']},'namedpickupgroup':{'type':Sequelize[_0x09b5('0x3')]},'language':{'type':Sequelize[_0x09b5('0x3')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x09b5('0x3')]},'disallow':{'type':Sequelize[_0x09b5('0x3')],'allowNull':![],'defaultValue':_0x09b5('0x2e')},'allow':{'type':Sequelize[_0x09b5('0x3')],'allowNull':![],'defaultValue':_0x09b5('0x2f'),'set':function(_0xfc7927){this[_0x09b5('0x5')](_0x09b5('0x30'),_0xfc7927?_0xfc7927[_0x09b5('0x21')](';'):_0x09b5('0x2f'));},'get':function(){return this[_0x09b5('0x9')](_0x09b5('0x30'))?this['getDataValue'](_0x09b5('0x30'))[_0x09b5('0x22')](';'):null;},'comment':_0x09b5('0x31')},'autoframing':{'type':Sequelize['ENUM'](_0x09b5('0x29'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize['STRING'],'allowNull':!![],'set':function(_0x135708){this[_0x09b5('0x5')](_0x09b5('0x32'),_0x135708?_0x135708['join'](','):null);},'get':function(){return this[_0x09b5('0x9')]('insecure')?this[_0x09b5('0x9')](_0x09b5('0x32'))['split'](','):null;},'comment':_0x09b5('0x33')},'trustrpid':{'type':Sequelize['ENUM'](_0x09b5('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x09b5('0xd')](_0x09b5('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x09b5('0xd')]('yes','no',_0x09b5('0x34')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x09b5('0xd')]('yes','no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x09b5('0xd')](_0x09b5('0x29'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x09b5('0x12')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x09b5('0x3')],'allowNull':!![]},'callerid':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x09b5('0x35')},'amaflags':{'type':Sequelize[_0x09b5('0x3')],'allowNull':!![]},'callcounter':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![],'defaultValue':_0x09b5('0x29')},'busylevel':{'type':Sequelize[_0x09b5('0x12')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize['ENUM'](_0x09b5('0x29'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x09b5('0xd')](_0x09b5('0x29'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x09b5('0xd')](_0x09b5('0x29'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize['ENUM'](_0x09b5('0x29'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x09b5('0x3')],'allowNull':!![]},'template':{'type':Sequelize['STRING'],'allowNull':!![]},'videosupport':{'type':Sequelize['ENUM'](_0x09b5('0x29'),'no',_0x09b5('0x36')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x09b5('0xd')](_0x09b5('0x29'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x09b5('0x3')],'allowNull':!![]},'session_timers':{'type':Sequelize['ENUM'](_0x09b5('0x37'),'refuse','originate'),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x09b5('0x12')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x09b5('0x12')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x09b5('0xd')]('uac',_0x09b5('0x38')),'allowNull':!![],'defaultValue':_0x09b5('0x38')},'t38pt_usertpsource':{'type':Sequelize['STRING'],'allowNull':!![]},'regexten':{'type':Sequelize[_0x09b5('0x3')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x09b5('0x3')],'allowNull':!![]},'fromuser':{'type':Sequelize['STRING'],'allowNull':!![]},'qualify':{'type':Sequelize[_0x09b5('0xd')](_0x09b5('0x29'),'no'),'allowNull':!![],'defaultValue':'yes'},'keepalive':{'type':Sequelize[_0x09b5('0x12')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x09b5('0x3')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x09b5('0x3')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0x09b5('0x12')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x09b5('0x12')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x09b5('0x12')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x09b5('0xd')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize['STRING'],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x09b5('0x3')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x09b5('0x12')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x09b5('0x12')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x09b5('0x12')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x09b5('0x3')],'allowNull':!![]},'contactdeny':{'type':Sequelize['STRING'],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x09b5('0x3')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize['STRING'],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x09b5('0x3')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x09b5('0x12')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0x09b5('0xd')](_0x09b5('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x09b5('0xd')]('yes','no'),'allowNull':!![]},'force_avp':{'type':Sequelize['ENUM'](_0x09b5('0x29'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize['ENUM'](_0x09b5('0x29'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize['ENUM'](_0x09b5('0x29'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x09b5('0xd')](_0x09b5('0x29'),'no',_0x09b5('0x39'),_0x09b5('0x3a')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x09b5('0x12')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x09b5('0x3')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x09b5('0x3')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x09b5('0x3')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x09b5('0x3')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x09b5('0xd')](_0x09b5('0x3b'),'passive',_0x09b5('0x3c')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING'],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x09b5('0xd')](_0x09b5('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x09b5('0x3')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x09b5('0x3')],'allowNull':!![]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x09b5('0xd')]('yes','no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x09b5('0xd')](_0x09b5('0x29'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x09b5('0x3')],'allowNull':!![]},'mohinterpret':{'type':Sequelize['STRING'],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x09b5('0x3')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x09b5('0x3')],'allowNull':!![]},'canreinvite':{'type':Sequelize['ENUM'](_0x09b5('0x29'),'no',_0x09b5('0x2a'),_0x09b5('0x3d'),'update,nonat'),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x09b5('0x3')]},'resetPasswordExpires':{'type':Sequelize[_0x09b5('0x15')]},'passwordResetAt':{'type':Sequelize[_0x09b5('0x15')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0x09b5('0x3e')]},'showWebBar':{'type':Sequelize[_0x09b5('0x12')],'defaultValue':0x0,'set':function(_0xf1e12d){this[_0x09b5('0x5')]('showWebBar',_0xf1e12d);var _0x3cabd2=this[_0x09b5('0x3f')]({'plain':!![]});switch(_0xf1e12d){case 0x0:case 0x1:var _0x21ad15=_0x3cabd2[_0x09b5('0x20')]?_['isArray'](_0x3cabd2[_0x09b5('0x20')])?_0x3cabd2[_0x09b5('0x20')][_0x09b5('0x21')]():_0x3cabd2[_0x09b5('0x20')]:'udp';if(_0x21ad15===_0x09b5('0x40')){_0x21ad15=_0x09b5('0x1f');}this['setDataValue'](_0x09b5('0x20'),_0x21ad15);this[_0x09b5('0x5')](_0x09b5('0x41'),'no');this[_0x09b5('0x5')](_0x09b5('0x42'),null);this[_0x09b5('0x5')](_0x09b5('0x43'),null);this[_0x09b5('0x5')](_0x09b5('0x44'),null);this[_0x09b5('0x5')](_0x09b5('0x45'),null);this['setDataValue'](_0x09b5('0x46'),null);this[_0x09b5('0x5')](_0x09b5('0x47'),null);this[_0x09b5('0x5')](_0x09b5('0x48'),null);this['setDataValue'](_0x09b5('0x49'),null);this['setDataValue'](_0x09b5('0x4a'),'no');break;case 0x2:this['setDataValue'](_0x09b5('0x20'),_0x09b5('0x40'));this[_0x09b5('0x5')]('encryption','yes');this[_0x09b5('0x5')](_0x09b5('0x42'),_0x09b5('0x29'));this[_0x09b5('0x5')]('force_avp','yes');this[_0x09b5('0x5')](_0x09b5('0x44'),_0x09b5('0x29'));this[_0x09b5('0x5')](_0x09b5('0x45'),_0x09b5('0x29'));this[_0x09b5('0x5')]('dtlsverify','no');this[_0x09b5('0x5')](_0x09b5('0x47'),_0x09b5('0x3c'));this[_0x09b5('0x5')](_0x09b5('0x48'),_0x3cabd2[_0x09b5('0x48')]||_0x09b5('0x4b'));this[_0x09b5('0x5')](_0x09b5('0x49'),_0x3cabd2[_0x09b5('0x49')]||_0x09b5('0x4c'));this[_0x09b5('0x5')](_0x09b5('0x4a'),_0x09b5('0x29'));break;default:}}},'permissions':{'type':Sequelize['TEXT'],'set':function(_0x1f0a21){this['setDataValue'](_0x09b5('0x4d'),_0x1f0a21?_0x1f0a21[_0x09b5('0x21')](','):[]);},'get':function(){return this[_0x09b5('0x9')]('permissions')?_[_0x09b5('0x4e')](this[_0x09b5('0x9')](_0x09b5('0x4d'))[_0x09b5('0x22')](','),function(_0x4d9b78){return parseInt(_0x4d9b78,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize['STRING']},'phoneBarNoReplyNumber':{'type':Sequelize[_0x09b5('0x3')]},'phoneBarBusyNumber':{'type':Sequelize[_0x09b5('0x3')]},'phoneBarUnconditional':{'type':Sequelize[_0x09b5('0x14')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x09b5('0x14')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x09b5('0x14')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x09b5('0x14')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x09b5('0x14')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x09b5('0x3')],'defaultValue':''},'crudPermissions':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x09b5('0xd')]('yes','no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x09b5('0x14')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize['STRING']},'phoneBarEnableJaws':{'type':Sequelize[_0x09b5('0x14')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x09b5('0x14')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize['VIRTUAL'],'get':function(){return this['getDataValue'](_0x09b5('0x4f'))?this[_0x09b5('0x9')]('phoneBarEnableScreenRecordingByAgent'):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x09b5('0x14')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x09b5('0x14')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x09b5('0x14')],'defaultValue':![]},'interface':{'type':Sequelize['STRING'],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x09b5('0x14')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize['STRING'],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x09b5('0x3')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x09b5('0x14')],'defaultValue':![],'set':function(_0x4dfa6d){if(typeof _0x4dfa6d===_0x09b5('0x50')){var _0x178f27=_0x4dfa6d==='1'?!![]:_0x4dfa6d==='0'?![]:_0x4dfa6d==='true'?!![]:_0x4dfa6d===_0x09b5('0x51')?![]:![];this['setDataValue'](_0x09b5('0x52'),_0x178f27);}else{this[_0x09b5('0x5')](_0x09b5('0x52'),_0x4dfa6d);}}},'blocked':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0x21cf62){this['setDataValue'](_0x09b5('0x53'),_0x21cf62);if(_0x21cf62===!![]){this['setDataValue'](_0x09b5('0x54'),moment());this['setDataValue'](_0x09b5('0x55'),0x0);}else{this[_0x09b5('0x5')](_0x09b5('0x54'),null);}}},'blockedAt':{'type':Sequelize[_0x09b5('0x15')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x09b5('0x12')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x09b5('0x14')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0x09b5('0x14')],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0x09b5('0x12')](0x5)[_0x09b5('0x56')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0x09b5('0x14')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x09b5('0x14')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0x09b5('0x14')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x09b5('0x14')],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize[_0x09b5('0x14')],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize[_0x09b5('0x12')],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize[_0x09b5('0x14')],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize[_0x09b5('0x14')],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize[_0x09b5('0x12')],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize[_0x09b5('0x14')],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize[_0x09b5('0x12')],'defaultValue':0x0},'messengerSoundNotification':{'type':Sequelize[_0x09b5('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 3f53891..3e756f5 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 _0x898a=['fax','mail','whatsapp','all','catch','show','params','merge','options','body','describe','ids','omit','internal','findById','securePassword','password','max','isNil','min_internal','sequelize','length','from','voicemail','mailbox','fullname','email','permissions','101','102','103','113','110','104','105','106','108','109','100','111','114','create','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator','checkUserLimits','settingsEnabled','userProfileId','VoiceMail','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','bulkCreate','Unauthorized','some','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator','UserProfileSection','isEmpty','compact','changePassword','oldPassword','newPassword','ValidationError','Sequelize','Wrong\x20credentials','New\x20password\x20must\x20be\x20different\x20from\x20old\x20password','Invalid\x20body\x20format.\x20Use\x20newPassword','findOne','enforcePasswordHistory','passwordHistoryLimit','validatePasswordHistory','updatePasswordsHistory','addQueues','channel','online','loginInPause','voicePause','interface','isValidChannel','Unknown\x20channel','add','capitalize','Queues','penalty','spread','QueueId','toLowerCase','Queue:save','voice','VoiceQueue','format','SIP/%s','UserVoiceQueueRt','upsert','removeQueues','isArray','Queue:remove','addAvatar','userpic','file','getAvatar','root','server/files/images/logos/default_profile.png','download','join','server/files/images/','getOpenTabs','ChatOpenTabs','createdAt','FaxOpenTabs','FAX','OpenchannelOpenTabs','OPENCHANNEL','MailOpenTabs','SMS','WhatsappOpenTabs','WHATSAPP','concat','getContacts','User\x20with\x20id\x20%s\x20not\x20found','hasOwnProperty','CmList','Tag','Tags','color','tag','model','Queue','keys','filters','intersection','fields','order','sort','pick','Unknown\x20role','nolimit','getVoiceQueuesRt','getGroups','ChatGroup','getRecordings','VoiceRecording','UserId','getScreenRecordings','ChatInteraction','getChatInteractions','OpenchannelInteraction','getOpenchannelInteractions','MailInteraction','getSmsInteractions','SmsInteraction','getFaxInteractions','WhatsappInteraction','getWhatsappInteractions','mobile','intrf','user:forcelogout','x-forwarded-for','connection','remoteAddress','socket','User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method','getVoiceQueues','UserVoiceQueue.penalty','MemberReport','YYYY-MM-DD\x20HH:mm:ss','LOGIN','device','PAUSE','LOGININPAUSE','resolve','logout','forEach','pause','updateAttributes','type','DEFAULT\x20PAUSE','mailPause','chatPause','faxPause','openchannelPause','smsPause','whatsappPause','pauseType','lastPauseAt','getTeams','Team','addTeams','Body\x20parameter\x20\x27ids\x27\x20is\x20required','flattenDeep','addAgent','getDataValue','Voice','UserVoicePrefix','VoicePrefixId','getLists','values','You\x20can\x27t\x20delete\x20yourself','user_has_chat_interactions:save','removeChatInteractions','user_has_chat_interactions:remove','addMailInteractions','removeMailInteractions','user_has_mail_interactions:remove','addFaxInteractions','user_has_fax_interactions:save','removeFaxInteractions','user_has_fax_interactions:remove','addSmsInteractions','user_has_sms_interactions:save','removeSmsInteractions','user_has_sms_interactions:remove','addOpenchannelInteractions','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','addWhatsappInteractions','user_has_whatsapp_interactions:save','removeWhatsappInteractions','getVoicePrefixes','VoicePrefix','getFaxAccounts','FaxAccount','addFaxAccounts','removeFaxAccounts','MailAccount','getMailAccounts','addMailAccounts','removeMailAccounts','getOpenchannelAccounts','OpenchannelAccount','removeOpenchannelAccounts','SmsAccount','getSmsAccounts','addSmsAccounts','removeSmsAccounts','getChatWebsites','ChatWebsite','addChatWebsites','removeChatWebsites','getWhatsappAccounts','WhatsappAccount','addWhatsappAccounts','removeWhatsappAccounts','getScheduledCalls','CmHopper','$and','$or','$gte','$lt','$ne','$eq','$not','$notBetween','$notLike','$iLike','$notILike','$like','$contains','$contained','$any','lastName','phone','Contact','dialActive','getApiKey','retrieveApiKey','No\x20API\x20access\x20key\x20found!','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','createApiKey','generateApiKey','iat','nonce','token','removeApiKey','apiKeyIat','API\x20key\x20not\x20available','whoami','getUserSetting','getPresence','unknown','ringing','getAgents','flatten','lower','col','desc','asc','substring','uniqBy','orderBy','getRealtimeAgents','offline','unavailable','voiceStatus','slice','toUpperCase','QueryTypes','SELECT','select','field','ui.','InteractionId','ui.UserId\x20=\x20?','toString','OpenTabs','messengerSoundNotification','enabled','moment','util','ioredis','../../components/contacts','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','APIBadRequestError','../../errors/api','APINotFoundError','handleError','../../mysqldb','redis','./user.socket','register','defaults','localhost','sendStatus','status','end','json','offset','undefined','limit','count','set','update','role','emit','userNotification:recalc:','destroy','then','get','admin','Users','user','Agents','agent','Telephones','telephone','ignore','map','includes','find','value','error','stack','name','send','User','rawAttributes','fieldName','key','filter','salt','previousPasswords','resetPasswordToken','resetPasswordExpires','md5secret','index','getOptions','where','query','includeAll','include','userSetting','true','UserSetting','attributes','push','findAll','rows','openTabs','chat','dataValues','sms'];(function(_0x1bc7a9,_0x306daa){var _0xff3f2c=function(_0x1af475){while(--_0x1af475){_0x1bc7a9['push'](_0x1bc7a9['shift']());}};_0xff3f2c(++_0x306daa);}(_0x898a,0x132));var _0xa898=function(_0x5da220,_0x3c3503){_0x5da220=_0x5da220-0x0;var _0x3ac06f=_0x898a[_0x5da220];return _0x3ac06f;};'use strict';var moment=require(_0xa898('0x0'));var util=require(_0xa898('0x1'));var path=require('path');var fs=require('fs');var _=require('lodash');var squel=require('squel');var Redis=require(_0xa898('0x2'));var authService=require('../../components/auth/service');var contacts=require(_0xa898('0x3'));var qs=require('../../components/parsers/qs');var rta=require('../../components/realtime/agents');var logger=require(_0xa898('0x4'))(_0xa898('0x5'));var utils=require(_0xa898('0x6'));var config=require(_0xa898('0x7'));var licenseUtil=require(_0xa898('0x8'));var APIBadRequestError=require('../../errors/api')[_0xa898('0x9')];var APINotFoundError=require(_0xa898('0xa'))[_0xa898('0xb')];var APIHandleError=require(_0xa898('0xa'))[_0xa898('0xc')];var db=require(_0xa898('0xd'))['db'];var socket=require('socket.io-emitter')(new Redis(config[_0xa898('0xe')]));require(_0xa898('0xf'))[_0xa898('0x10')](socket);config[_0xa898('0xe')]=_[_0xa898('0x11')](config[_0xa898('0xe')],{'host':_0xa898('0x12'),'port':0x18eb});var values;function respondWithStatusCode(_0x372a6c,_0x3c09e3){_0x3c09e3=_0x3c09e3||0xcc;return function(_0x4c43c2){if(_0x4c43c2){return _0x372a6c[_0xa898('0x13')](_0x3c09e3);}return _0x372a6c[_0xa898('0x14')](_0x3c09e3)[_0xa898('0x15')]();};}function respondWithResult(_0x390fe6,_0x2f6eeb){_0x2f6eeb=_0x2f6eeb||0xc8;return function(_0x3da779){if(_0x3da779){return _0x390fe6[_0xa898('0x14')](_0x2f6eeb)[_0xa898('0x16')](_0x3da779);}};}function respondWithFilteredResult(_0x56fe3b,_0x630332){return function(_0x3beae0){if(_0x3beae0){var _0x19a26f=typeof _0x630332[_0xa898('0x17')]===_0xa898('0x18')&&typeof _0x630332[_0xa898('0x19')]===_0xa898('0x18');var _0x54e44f=_0x3beae0[_0xa898('0x1a')];var _0x19d123=_0x19a26f?0x0:_0x630332[_0xa898('0x17')];var _0x43702b=_0x19a26f?_0x3beae0[_0xa898('0x1a')]:_0x630332[_0xa898('0x17')]+_0x630332['limit'];var _0x13c137;if(_0x43702b>=_0x54e44f){_0x43702b=_0x54e44f;_0x13c137=0xc8;}else{_0x13c137=0xce;}_0x56fe3b[_0xa898('0x14')](_0x13c137);return _0x56fe3b[_0xa898('0x1b')]('Content-Range',_0x19d123+'-'+_0x43702b+'/'+_0x54e44f)[_0xa898('0x16')](_0x3beae0);}return null;};}function saveUpdates(_0x281705){return function(_0x3e496d){if(_0x3e496d){return _0x3e496d[_0xa898('0x1c')](_0x281705)['then'](function(_0x1446d8){if(_0x1446d8[_0xa898('0x1d')]==='agent'){socket[_0xa898('0x1e')](_0xa898('0x1f')+_0x1446d8['id'],_0x1446d8);}return _0x1446d8;});}return null;};}function removeEntity(_0x3cd749){return function(_0x5ce2ad){if(_0x5ce2ad){return _0x5ce2ad[_0xa898('0x20')]()[_0xa898('0x21')](function(){var _0x5c389c=_0x5ce2ad[_0xa898('0x22')]({'plain':!![]});if(_0x5c389c['role']===_0xa898('0x23'))return;var _0x38193c=[{'name':_0xa898('0x24'),'value':_0xa898('0x25'),'ignore':!![]},{'name':_0xa898('0x26'),'value':_0xa898('0x27'),'ignore':![]},{'name':_0xa898('0x28'),'value':_0xa898('0x29'),'ignore':![]}];var _0x3ad482=_(_0x38193c)['filter'](_0xa898('0x2a'))[_0xa898('0x2b')]('value')['value']();if(_[_0xa898('0x2c')](_0x3ad482,_0x5c389c[_0xa898('0x1d')])){return;}var _0x443b4e=_[_0xa898('0x2d')](_0x38193c,[_0xa898('0x2e'),_0x5c389c[_0xa898('0x1d')]])['name'];return db['UserProfileResource'][_0xa898('0x20')]({'where':{'type':_0x443b4e,'resourceId':_0x5c389c['id']}})['then'](function(){return _0x5ce2ad;});})['then'](function(){_0x3cd749[_0xa898('0x14')](0xcc)[_0xa898('0x15')]();});}};}function handleEntityNotFound(_0x7fc1ef){return function(_0x44780c){if(!_0x44780c){_0x7fc1ef[_0xa898('0x13')](0x194);}return _0x44780c;};}function handleError(_0x507a90,_0x597881){_0x597881=_0x597881||0x1f4;return function(_0x200ab2){logger[_0xa898('0x2f')](_0x200ab2[_0xa898('0x30')]);if(_0x200ab2[_0xa898('0x31')]){delete _0x200ab2[_0xa898('0x31')];}_0x507a90['status'](_0x597881)[_0xa898('0x32')](_0x200ab2);};}function getUserAttributes(){return _(db[_0xa898('0x33')][_0xa898('0x34')])['map'](function(_0x4dd1a7){return{'name':_0x4dd1a7[_0xa898('0x35')],'type':_0x4dd1a7['type'][_0xa898('0x36')]};})[_0xa898('0x37')](function(_0x518049){return!['password',_0xa898('0x38'),_0xa898('0x39'),_0xa898('0x3a'),_0xa898('0x3b'),_0xa898('0x3c')]['includes'](_0x518049[_0xa898('0x31')]);})[_0xa898('0x2e')]();}exports[_0xa898('0x3d')]=function(_0x153a22,_0x149f17){var _0xa5aaf2={},_0x598397={'count':0x0,'rows':[]};var _0x1a569f=getUserAttributes();_0xa5aaf2=qs[_0xa898('0x3e')](_0x1a569f,_0x153a22);var _0x30b9a8={'where':_0xa5aaf2[_0xa898('0x3f')]};return db[_0xa898('0x33')][_0xa898('0x1a')](_0x30b9a8)[_0xa898('0x21')](function(_0x38c082){_0x598397[_0xa898('0x1a')]=_0x38c082;if(_0x153a22[_0xa898('0x40')][_0xa898('0x41')]){_0xa5aaf2[_0xa898('0x42')]=[{'all':!![]}];}if(_0x153a22[_0xa898('0x40')][_0xa898('0x43')]===_0xa898('0x44')){_0xa5aaf2['include']=[{'model':db[_0xa898('0x45')],'as':'userSetting'}];}if(!_[_0xa898('0x2c')](_0xa5aaf2[_0xa898('0x46')],'id')){_0xa5aaf2[_0xa898('0x46')][_0xa898('0x47')]('id');}return db['User'][_0xa898('0x48')](_0xa5aaf2);})['then'](function(_0x25626e){_0x598397[_0xa898('0x49')]=_0x25626e;if(_0x153a22['query'][_0xa898('0x4a')]===_0xa898('0x44')){var _0x219d01=[];for(var _0xcf520c=0x0;_0xcf520c<_0x598397['rows']['length'];_0xcf520c++){_0x219d01[_0xa898('0x47')](get_open_tabs(_0xa898('0x4b'),_0x598397['rows'][_0xcf520c][_0xa898('0x4c')]));_0x219d01[_0xa898('0x47')](get_open_tabs(_0xa898('0x4d'),_0x598397[_0xa898('0x49')][_0xcf520c][_0xa898('0x4c')]));_0x219d01[_0xa898('0x47')](get_open_tabs(_0xa898('0x4e'),_0x598397['rows'][_0xcf520c][_0xa898('0x4c')]));_0x219d01[_0xa898('0x47')](get_open_tabs(_0xa898('0x4f'),_0x598397[_0xa898('0x49')][_0xcf520c][_0xa898('0x4c')]));_0x219d01[_0xa898('0x47')](get_open_tabs('openchannel',_0x598397[_0xa898('0x49')][_0xcf520c][_0xa898('0x4c')]));_0x219d01[_0xa898('0x47')](get_open_tabs(_0xa898('0x50'),_0x598397[_0xa898('0x49')][_0xcf520c][_0xa898('0x4c')]));}return Promise[_0xa898('0x51')](_0x219d01)[_0xa898('0x21')](function(){return _0x598397;});}else{return _0x598397;}})[_0xa898('0x21')](respondWithFilteredResult(_0x149f17,_0xa5aaf2))[_0xa898('0x52')](handleError(_0x149f17,null));};exports[_0xa898('0x53')]=function(_0x3a90e6,_0x420d92){var _0x3b1c80=getUserAttributes();_0x3a90e6[_0xa898('0x40')]['id']=_0x3a90e6[_0xa898('0x54')]['id'];var _0x443895=qs['getOptions'](_0x3b1c80,_0x3a90e6);if(_0x3a90e6[_0xa898('0x40')][_0xa898('0x41')]){_0x443895[_0xa898('0x42')]=[{'all':!![]}];}if(_0x3a90e6[_0xa898('0x40')][_0xa898('0x43')]==='true'){_0x443895[_0xa898('0x42')]=[{'model':db[_0xa898('0x45')],'as':'userSetting'}];}_0x443895=_[_0xa898('0x55')]({},_0x443895,_0x3a90e6[_0xa898('0x56')]);if(!_['includes'](_0x443895[_0xa898('0x46')],'id')){_0x443895[_0xa898('0x46')][_0xa898('0x47')]('id');}return db['User'][_0xa898('0x2d')](_0x443895)['then'](handleEntityNotFound(_0x420d92,null))[_0xa898('0x21')](function(_0x22a071){var _0x3191ce=[];values=_0x22a071;if(_0x3a90e6[_0xa898('0x40')][_0xa898('0x4a')]==='true'){_0x3191ce['push'](get_open_tabs(_0xa898('0x4b'),_0x22a071[_0xa898('0x4c')]));_0x3191ce[_0xa898('0x47')](get_open_tabs(_0xa898('0x4d'),_0x22a071[_0xa898('0x4c')]));_0x3191ce['push'](get_open_tabs('openchannel',_0x22a071[_0xa898('0x4c')]));_0x3191ce[_0xa898('0x47')](get_open_tabs(_0xa898('0x50'),_0x22a071[_0xa898('0x4c')]));_0x3191ce[_0xa898('0x47')](get_open_tabs(_0xa898('0x4e'),_0x22a071[_0xa898('0x4c')]));_0x3191ce[_0xa898('0x47')](get_open_tabs(_0xa898('0x4f'),_0x22a071[_0xa898('0x4c')]));return Promise['all'](_0x3191ce);}else{return values;}})['then'](function(){return values;})[_0xa898('0x21')](respondWithResult(_0x420d92,null))[_0xa898('0x52')](handleError(_0x420d92,null));};exports[_0xa898('0x1c')]=function(_0x1519e5,_0x172b92){if(_0x1519e5[_0xa898('0x57')]['id']){delete _0x1519e5['body']['id'];}delete _0x1519e5['body'][_0xa898('0x1d')];return db[_0xa898('0x33')][_0xa898('0x2d')]({'where':{'id':_0x1519e5[_0xa898('0x54')]['id']}})[_0xa898('0x21')](handleEntityNotFound(_0x172b92,null))[_0xa898('0x21')](saveUpdates(_0x1519e5[_0xa898('0x57')],null))[_0xa898('0x21')](respondWithResult(_0x172b92,null))[_0xa898('0x52')](handleError(_0x172b92,null));};exports[_0xa898('0x58')]=function(_0x2afa8d,_0x3a8517){return db[_0xa898('0x33')][_0xa898('0x58')]()[_0xa898('0x21')](respondWithResult(_0x3a8517,null))[_0xa898('0x52')](handleError(_0x3a8517,null));};exports['addContacts']=function(_0x2722c9,_0x29fb75){return db['User'][_0xa898('0x2d')]({'where':{'id':_0x2722c9[_0xa898('0x54')]['id']}})['then'](handleEntityNotFound(_0x29fb75,null))['then'](function(_0x432b65){if(_0x432b65){return _0x432b65['addContacts'](_0x2722c9[_0xa898('0x57')][_0xa898('0x59')],_[_0xa898('0x5a')](_0x2722c9['body'],[_0xa898('0x59'),'id'])||{});}})[_0xa898('0x21')](respondWithResult(_0x29fb75,null))[_0xa898('0x52')](handleError(_0x29fb75,null));};function validateUser(_0x40ac04){return new Promise(function(_0x256327,_0x1bbcb0){if(_0x40ac04[_0xa898('0x5b')])return _0x256327(_0x40ac04);return db['Setting'][_0xa898('0x5c')](0x1)[_0xa898('0x21')](function(_0x5ed17e){if(_0x5ed17e[_0xa898('0x5d')])authService['validatePasswordPattern'](_0x40ac04[_0xa898('0x5e')]);db['User'][_0xa898('0x5f')](_0xa898('0x5b'))[_0xa898('0x21')](function(_0x204d1f){if(_[_0xa898('0x60')](_0x204d1f)){_0x40ac04[_0xa898('0x5b')]=_0x5ed17e['min_internal']||0x1;return;}if(_[_0xa898('0x60')](_0x5ed17e[_0xa898('0x61')])||_0x5ed17e[_0xa898('0x61')]===_0x204d1f){_0x40ac04[_0xa898('0x5b')]=_0x204d1f+0x1;return;}if(_0x5ed17e[_0xa898('0x61')]>_0x204d1f){_0x40ac04['internal']=_0x5ed17e[_0xa898('0x61')];return;}return db['sequelize'][_0xa898('0x40')]('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)',{'type':db[_0xa898('0x62')]['QueryTypes']['SELECT']})[_0xa898('0x21')](function(_0x1b2365){if(_0x1b2365&&_0x1b2365[_0xa898('0x63')]){for(var _0x400813=0x0,_0x2b41c4=_0x1b2365[_0xa898('0x63')];_0x400813<_0x2b41c4&&_[_0xa898('0x60')](_0x40ac04[_0xa898('0x5b')]);_0x400813++){if(_0x5ed17e['min_internal']<=_0x1b2365[_0x400813][_0xa898('0x64')]){_0x40ac04[_0xa898('0x5b')]=_0x1b2365[_0x400813][_0xa898('0x64')];}else if(_0x5ed17e[_0xa898('0x61')]>_0x1b2365[_0x400813][_0xa898('0x64')]&&_0x5ed17e[_0xa898('0x61')]<=_0x1b2365[_0x400813]['to']){_0x40ac04[_0xa898('0x5b')]=_0x5ed17e['min_internal'];}}}if(_[_0xa898('0x60')](_0x40ac04[_0xa898('0x5b')])){_0x40ac04['internal']=_0x204d1f+0x1;}return _0x256327(_0x40ac04);});});})[_0xa898('0x52')](function(_0x553f8f){_0x1bbcb0(_0x553f8f);});});}function updateUser(_0xa923cb){return new Promise(function(_0x3ce410,_0x76c912){try{if(_0xa923cb[_0xa898('0x65')]){_0xa923cb[_0xa898('0x66')]=_0xa923cb[_0xa898('0x5b')];_0xa923cb['VoiceMail']={'mailbox':_0xa923cb[_0xa898('0x5b')],'password':_0xa923cb['password'],'fullname':_0xa923cb[_0xa898('0x67')],'email':_0xa923cb[_0xa898('0x68')]};}if(_0xa923cb['role']===_0xa898('0x27')){if(!_0xa923cb[_0xa898('0x69')])_0xa923cb[_0xa898('0x69')]=[_0xa898('0x6a'),_0xa898('0x6b'),_0xa898('0x6c'),_0xa898('0x6d'),_0xa898('0x6e'),_0xa898('0x6f'),_0xa898('0x70'),_0xa898('0x71'),'107',_0xa898('0x72'),_0xa898('0x73'),_0xa898('0x74'),_0xa898('0x75'),_0xa898('0x76'),'115'];}_0x3ce410(_0xa923cb);}catch(_0x2b713b){_0x76c912(_0x2b713b);}});}exports[_0xa898('0x77')]=function(_0x596809,_0x556a3){if(_0x596809[_0xa898('0x25')]['role']===_0xa898('0x27'))throw new Error('Unauthorized');if(_0x596809[_0xa898('0x57')][_0xa898('0x1d')]===_0xa898('0x25')&&_0x596809[_0xa898('0x25')][_0xa898('0x1d')]!==_0xa898('0x23')){throw new Error(_0xa898('0x78'));}if(_0x596809['body'][_0xa898('0x1d')]===_0xa898('0x23')&&_0x596809['user']['role']!==_0xa898('0x23')){throw new Error(_0xa898('0x79'));}return licenseUtil[_0xa898('0x7a')]([_0x596809[_0xa898('0x57')]])[_0xa898('0x21')](function(){return validateUser(_0x596809[_0xa898('0x57')]);})[_0xa898('0x21')](function(_0x31d64d){return updateUser(_0x31d64d)[_0xa898('0x21')](function(_0x100160){if(_0x100160[_0xa898('0x1d')]===_0xa898('0x23')){_0x100160[_0xa898('0x7b')]=_0x596809[_0xa898('0x25')]['settingsEnabled'];delete _0x100160[_0xa898('0x7c')];}return _0x100160;});})['then'](function(_0x373a18){return db['User'][_0xa898('0x77')](_0x373a18,{'include':[{'model':db[_0xa898('0x7d')],'as':_0xa898('0x7d')}]});})[_0xa898('0x21')](function(_0x4c14bb){if(_0x596809['body'][_0xa898('0x1d')]===_0xa898('0x25'))return _0x4c14bb;if(_0x596809['user'][_0xa898('0x1d')]!==_0xa898('0x25'))return _0x4c14bb;return db['UserProfileSection'][_0xa898('0x2d')]({'where':{'name':_0x4c14bb['role']===_0xa898('0x27')?_0xa898('0x26'):_0xa898('0x28'),'userProfileId':_0x596809[_0xa898('0x25')][_0xa898('0x7c')]},'raw':!![]})['then'](function(_0x33f13a){if(!_0x33f13a||_0x33f13a[_0xa898('0x7e')]!=0x0)return _0x4c14bb;return db[_0xa898('0x7f')][_0xa898('0x77')]({'name':_0x4c14bb[_0xa898('0x31')],'resourceId':_0x4c14bb['id'],'type':_0x33f13a[_0xa898('0x31')],'sectionId':_0x33f13a['id']},{})['then'](function(){return _0x4c14bb;});})[_0xa898('0x52')](function(_0x20d8f7){logger[_0xa898('0x2f')](_0xa898('0x80'),_0x20d8f7);throw _0x20d8f7;});})[_0xa898('0x21')](respondWithResult(_0x556a3,0xc9))['catch'](handleError(_0x556a3,null));};exports[_0xa898('0x81')]=function(_0x9b5b9c,_0x5b9952){var _0x37885d=_0x9b5b9c[_0xa898('0x57')];var _0xd2fd9b=[];if(_0x9b5b9c[_0xa898('0x25')]['role']===_0xa898('0x27'))throw new Error(_0xa898('0x82'));if(_[_0xa898('0x83')](_0x37885d,[_0xa898('0x1d'),_0xa898('0x25')])&&_0x9b5b9c['user'][_0xa898('0x1d')]!==_0xa898('0x23')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user');}if(_[_0xa898('0x83')](_0x37885d,[_0xa898('0x1d'),_0xa898('0x23')])&&_0x9b5b9c['user'][_0xa898('0x1d')]!==_0xa898('0x23')){throw new Error(_0xa898('0x84'));}return licenseUtil[_0xa898('0x7a')](_0x37885d)[_0xa898('0x21')](function(){return validateUser(_0x37885d[0x0]);})[_0xa898('0x21')](function(){for(var _0x2506ee=0x1;_0x2506ee<_0x37885d[_0xa898('0x63')];_0x2506ee++){var _0x3d417c=_0x37885d[_0x2506ee-0x1][_0xa898('0x5b')];if(!_0x37885d[_0x2506ee][_0xa898('0x5b')])_0x37885d[_0x2506ee][_0xa898('0x5b')]=_0x3d417c+0x1;_0xd2fd9b[_0xa898('0x47')](validateUser(_0x37885d[_0x2506ee]));}return Promise[_0xa898('0x51')](_0xd2fd9b);})[_0xa898('0x21')](function(){_0xd2fd9b=[];for(var _0x5cfd50=0x0;_0x5cfd50<_0x37885d['length'];_0x5cfd50++){_0xd2fd9b[_0xa898('0x47')](updateUser(_0x37885d[_0x5cfd50]));}return Promise[_0xa898('0x51')](_0xd2fd9b);})[_0xa898('0x21')](function(){_0xd2fd9b=_0x37885d[_0xa898('0x2b')](function(_0x58d32c){return db[_0xa898('0x33')][_0xa898('0x77')](_0x58d32c,{'include':[{'model':db[_0xa898('0x7d')],'as':_0xa898('0x7d')}]})[_0xa898('0x21')](function(_0x158a0e){_0x58d32c['id']=_0x158a0e['id'];return _0x58d32c;});});return Promise[_0xa898('0x51')](_0xd2fd9b);})[_0xa898('0x21')](function(_0x4e641b){if(_0x9b5b9c[_0xa898('0x57')][_0xa898('0x1d')]==='user')return _0x4e641b;if(_0x9b5b9c[_0xa898('0x25')]['role']!==_0xa898('0x25'))return _0x4e641b;var _0x2b5865=_[_0xa898('0x83')](_0x4e641b,function(_0x2e05b6){return _0x2e05b6[_0xa898('0x1d')]===_0xa898('0x27')||_0x2e05b6['role']===_0xa898('0x29');});if(!_0x2b5865)return _0x4e641b;return db[_0xa898('0x85')][_0xa898('0x48')]({'where':{'name':{'$or':['Agents','Telephones']},'userProfileId':_0x9b5b9c[_0xa898('0x25')]['userProfileId']},'raw':!![]})[_0xa898('0x21')](function(_0x5366a5){if(_[_0xa898('0x86')](_0x5366a5)||!_[_0xa898('0x83')](_0x5366a5,['autoAssociation',0x0]))return _0x4e641b;_0xd2fd9b=[];var _0xfa4ddd=_(_0x5366a5)['map'](function(_0x29a979){if(_0x29a979[_0xa898('0x7e')]===0x1)return;return _0x29a979[_0xa898('0x31')]===_0xa898('0x26')?'agent':_0xa898('0x29');})[_0xa898('0x87')]()[_0xa898('0x2e')]();for(var _0x30cd24=0x0;_0x30cd24<_0x4e641b['length'];_0x30cd24++){if(!_[_0xa898('0x2c')](_0xfa4ddd,_0x4e641b[_0x30cd24][_0xa898('0x1d')]))return;var _0x37288f=_0x4e641b[_0x30cd24][_0xa898('0x1d')]===_0xa898('0x27')?_0xa898('0x26'):_0xa898('0x28');_0xd2fd9b[_0xa898('0x47')](db[_0xa898('0x7f')][_0xa898('0x77')]({'name':_0x4e641b[_0x30cd24][_0xa898('0x31')],'resourceId':_0x4e641b[_0x30cd24]['id'],'type':_0x37288f,'sectionId':_[_0xa898('0x2d')](_0x5366a5,[_0xa898('0x31'),_0x37288f])['id']},{}));}return Promise[_0xa898('0x51')](_0xd2fd9b);});})[_0xa898('0x21')](respondWithResult(_0x5b9952,0xc9))[_0xa898('0x52')](handleError(_0x5b9952,null));};exports[_0xa898('0x88')]=function(_0x3a106d,_0x289b9a){if(_0x3a106d['body']['id']){delete _0x3a106d[_0xa898('0x57')]['id'];}return db['User'][_0xa898('0x2d')]({'where':{'id':_0x3a106d['params']['id']}})[_0xa898('0x21')](function(_0x3e75f8){if(!_0x3e75f8)return null;if(_0x3e75f8['id']===_0x3a106d[_0xa898('0x25')]['id']){if(!_0x3a106d[_0xa898('0x57')][_0xa898('0x89')]||!_0x3a106d[_0xa898('0x57')][_0xa898('0x8a')]){throw new db['Sequelize'][(_0xa898('0x8b'))]('Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword');}if(!_0x3e75f8['authenticate'](_0x3a106d[_0xa898('0x57')][_0xa898('0x89')])){throw new db[(_0xa898('0x8c'))]['ValidationError'](_0xa898('0x8d'));}if(_0x3a106d[_0xa898('0x57')][_0xa898('0x89')]===_0x3a106d['body']['newPassword']){throw new db[(_0xa898('0x8c'))]['ValidationError'](_0xa898('0x8e'));}}else if(_0x3a106d['user'][_0xa898('0x1d')]==='admin'){if(!_0x3a106d['body'][_0xa898('0x8a')]){throw new db['Sequelize'][(_0xa898('0x8b'))](_0xa898('0x8f'));}}else if(_0x3a106d[_0xa898('0x25')][_0xa898('0x1d')]===_0xa898('0x25')){if(!_0x3a106d[_0xa898('0x57')]['newPassword']){throw new db[(_0xa898('0x8c'))][(_0xa898('0x8b'))](_0xa898('0x8f'));}if(_0x3e75f8[_0xa898('0x1d')]!=='agent'){throw new db[(_0xa898('0x8c'))][(_0xa898('0x8b'))](_0xa898('0x82'));}}else{throw new db[(_0xa898('0x8c'))][(_0xa898('0x8b'))](_0xa898('0x82'));}return _0x3e75f8;})[_0xa898('0x21')](handleEntityNotFound(_0x289b9a,null))['then'](function(_0x5ce8bd){return db['Setting'][_0xa898('0x90')]({'attributes':['id',_0xa898('0x5d'),_0xa898('0x91'),_0xa898('0x92')]})[_0xa898('0x21')](function(_0x458f99){if(_0x458f99[_0xa898('0x5d')])authService['validatePasswordPattern'](_0x3a106d[_0xa898('0x57')][_0xa898('0x8a')]);if(!_0x458f99[_0xa898('0x91')]||!_0x5ce8bd[_0xa898('0x39')])return _0x5ce8bd;authService[_0xa898('0x93')](_0x3a106d[_0xa898('0x57')]['newPassword'],_0x5ce8bd['previousPasswords'],_0x458f99[_0xa898('0x92')]);return _0x5ce8bd;})[_0xa898('0x21')](saveUpdates({'password':_0x3a106d[_0xa898('0x57')][_0xa898('0x8a')],'passwordResetAt':_0x3a106d[_0xa898('0x25')]['id']==_0x3a106d[_0xa898('0x54')]['id']?moment():null,'previousPasswords':authService[_0xa898('0x94')](_0x3a106d['body'][_0xa898('0x8a')],_0x5ce8bd[_0xa898('0x39')])},null));})[_0xa898('0x21')](respondWithResult(_0x289b9a,null))[_0xa898('0x52')](handleError(_0x289b9a,null));};exports[_0xa898('0x95')]=function(_0x2f0926,_0x3b34a3){var _0x3a6736=_0x2f0926[_0xa898('0x57')][_0xa898('0x96')];return db['User'][_0xa898('0x2d')]({'where':{'id':_0x2f0926[_0xa898('0x54')]['id']},'attributes':['id','name','role',_0xa898('0x97'),_0xa898('0x98'),_0xa898('0x99'),_0xa898('0x9a')]})[_0xa898('0x21')](handleEntityNotFound(_0x3b34a3,null))[_0xa898('0x21')](function(_0x22f0c6){if(_0x22f0c6){if(!utils[_0xa898('0x9b')](_0x3a6736)){throw new db[(_0xa898('0x8c'))]['ValidationError'](_0xa898('0x9c'));}return _0x22f0c6[_0xa898('0x9d')+_[_0xa898('0x9e')](_0x3a6736['toLowerCase']())+_0xa898('0x9f')](_0x2f0926[_0xa898('0x57')][_0xa898('0x59')],{'penalty':_0x2f0926[_0xa898('0x57')][_0xa898('0xa0')]||0x0})[_0xa898('0xa1')](function(_0x34f2ba){for(var _0x3a7e76=0x0;_0x3a7e76<_0x2f0926[_0xa898('0x57')]['ids'][_0xa898('0x63')];_0x3a7e76+=0x1){var _0x352aa5={'UserId':Number(_0x2f0926['params']['id'])};_0x352aa5[_[_0xa898('0x9e')](_0x3a6736['toLowerCase']())+_0xa898('0xa2')]=Number(_0x2f0926[_0xa898('0x57')][_0xa898('0x59')][_0x3a7e76]);socket[_0xa898('0x1e')](_0xa898('0x25')+_[_0xa898('0x9e')](_0x3a6736[_0xa898('0xa3')]())+_0xa898('0xa4'),_0x352aa5);}return _0x34f2ba;})['then'](function(){if(_0x3a6736===_0xa898('0xa5')){return db[_0xa898('0xa6')][_0xa898('0x48')]({'where':{'id':_0x2f0926['body'][_0xa898('0x59')]||[]},'raw':!![],'attributes':['id','name']});}})['then'](function(_0x13c51c){var _0x27fbb2=_0x22f0c6['get']({'plain':!![]});var _0x4410d3=[];if(_0x3a6736==='voice'&&_0x27fbb2[_0xa898('0x1d')]===_0xa898('0x27')&&_0x27fbb2[_0xa898('0x97')]){for(let _0x3daa9f=0x0;_0x3daa9f<_0x13c51c[_0xa898('0x63')];_0x3daa9f+=0x1){_0x4410d3[_0xa898('0x47')]({'membername':_0x27fbb2[_0xa898('0x31')],'UserId':_0x27fbb2['id'],'queue_name':_0x13c51c[_0x3daa9f]['name'],'VoiceQueueId':_0x13c51c[_0x3daa9f]['id'],'interface':_[_0xa898('0x60')](_0x27fbb2['interface'])?util[_0xa898('0xa7')](_0xa898('0xa8'),_0x27fbb2['name']):_0x27fbb2['interface'],'paused':_0x27fbb2[_0xa898('0x99')]||![],'penalty':_0x2f0926[_0xa898('0x57')]['penalty']||0x0});}return Promise[_0xa898('0x51')](_0x4410d3[_0xa898('0x2b')](function(_0x2dfbec){return db[_0xa898('0xa9')][_0xa898('0xaa')](_0x2dfbec);}));}return _0x22f0c6;});}})[_0xa898('0x21')](respondWithStatusCode(_0x3b34a3,null))[_0xa898('0x52')](handleError(_0x3b34a3,null));};exports[_0xa898('0xab')]=function(_0x3b11ca,_0x454bc0){var _0x4cff46,_0x3d404f;return db['User'][_0xa898('0x2d')]({'where':{'id':_0x3b11ca[_0xa898('0x54')]['id']},'attributes':['id',_0xa898('0x31'),'role']})[_0xa898('0x21')](handleEntityNotFound(_0x454bc0,null))['then'](function(_0x15b0dd){if(_0x15b0dd){_0x4cff46=_0x15b0dd;if(!_0x3b11ca[_0xa898('0x40')][_0xa898('0x96')]||!utils[_0xa898('0x9b')](_0x3b11ca['query'][_0xa898('0x96')])){throw new db['Sequelize'][(_0xa898('0x8b'))](_0xa898('0x9c'));}return _0x15b0dd['remove'+_['capitalize'](_0x3b11ca[_0xa898('0x40')]['channel'][_0xa898('0xa3')]())+_0xa898('0x9f')](_0x3b11ca[_0xa898('0x40')][_0xa898('0x59')]);}})[_0xa898('0x21')](function(_0x11662f){if(_[_0xa898('0xac')](_0x3b11ca['query']['ids'])){for(var _0x1a2190=0x0;_0x1a2190<_0x3b11ca[_0xa898('0x40')][_0xa898('0x59')][_0xa898('0x63')];_0x1a2190+=0x1){_0x3d404f={'UserId':Number(_0x3b11ca[_0xa898('0x54')]['id'])};_0x3d404f[_[_0xa898('0x9e')](_0x3b11ca[_0xa898('0x40')][_0xa898('0x96')][_0xa898('0xa3')]())+_0xa898('0xa2')]=Number(_0x3b11ca[_0xa898('0x40')]['ids'][_0x1a2190]);socket[_0xa898('0x1e')](_0xa898('0x25')+_[_0xa898('0x9e')](_0x3b11ca['query'][_0xa898('0x96')][_0xa898('0xa3')]())+_0xa898('0xad'),_0x3d404f);}}else{_0x3d404f={'UserId':Number(_0x3b11ca[_0xa898('0x54')]['id'])};_0x3d404f[_[_0xa898('0x9e')](_0x3b11ca['query']['channel'][_0xa898('0xa3')]())+'QueueId']=Number(_0x3b11ca['query'][_0xa898('0x59')]);socket['emit']('user'+_[_0xa898('0x9e')](_0x3b11ca['query'][_0xa898('0x96')][_0xa898('0xa3')]())+_0xa898('0xad'),_0x3d404f);}return _0x11662f;})[_0xa898('0x21')](function(){if(_0x3b11ca[_0xa898('0x40')][_0xa898('0x96')]===_0xa898('0xa5')){return db[_0xa898('0xa9')][_0xa898('0x20')]({'where':{'UserId':_0x3b11ca[_0xa898('0x54')]['id'],'VoiceQueueId':_0x3b11ca[_0xa898('0x40')][_0xa898('0x59')]},'individualHooks':!![]})[_0xa898('0x21')](function(){return _0x4cff46;});}return _0x4cff46;})[_0xa898('0x21')](respondWithStatusCode(_0x454bc0,null))['catch'](handleError(_0x454bc0,null));};exports[_0xa898('0xae')]=function(_0x42c48b,_0x2da574){_0x42c48b['body'][_0xa898('0xaf')]=_0x42c48b[_0xa898('0xb0')]['filename'];return db['User'][_0xa898('0x2d')]({'where':{'id':_0x42c48b['params']['id']}})[_0xa898('0x21')](handleEntityNotFound(_0x2da574,null))[_0xa898('0x21')](saveUpdates(_0x42c48b[_0xa898('0x57')],null))['then'](respondWithResult(_0x2da574,null))[_0xa898('0x52')](handleError(_0x2da574,null));};exports[_0xa898('0xb1')]=function(_0x25254c,_0x43692c){var _0x5a8bd7=path['join'](config[_0xa898('0xb2')],_0xa898('0xb3'));return db[_0xa898('0x33')][_0xa898('0x2d')]({'where':{'id':_0x25254c[_0xa898('0x54')]['id']},'attributes':['id',_0xa898('0xaf')],'raw':!![]})[_0xa898('0x21')](handleEntityNotFound(_0x43692c,null))['then'](function(_0x546258){if(_0x546258){if(_['isNil'](_0x546258[_0xa898('0xaf')])){return _0x43692c[_0xa898('0xb4')](_0x5a8bd7);}else{if(!fs['existsSync'](path[_0xa898('0xb5')](config['root'],_0xa898('0xb6'),_0x546258[_0xa898('0xaf')]))){return _0x43692c['download'](_0x5a8bd7);}return _0x43692c['download'](path[_0xa898('0xb5')](config[_0xa898('0xb2')],'server/files/images/',_0x546258[_0xa898('0xaf')]));}}})[_0xa898('0x52')](handleError(_0x43692c,null));};exports[_0xa898('0xb7')]=function(_0x5cbdf1,_0x1c1d32){return db[_0xa898('0x33')][_0xa898('0x2d')]({'where':{'id':_0x5cbdf1[_0xa898('0x54')]['id']},'attributes':['id']})[_0xa898('0x21')](handleEntityNotFound(_0x1c1d32,null))[_0xa898('0x21')](function(_0x82a59a){var _0x50d3cb=[];values=_0x82a59a[_0xa898('0x4c')];_0x50d3cb[_0xa898('0x47')](get_open_tabs(_0xa898('0x4b'),_0x82a59a[_0xa898('0x4c')]));_0x50d3cb[_0xa898('0x47')](get_open_tabs('sms',_0x82a59a[_0xa898('0x4c')]));_0x50d3cb['push'](get_open_tabs('openchannel',_0x82a59a[_0xa898('0x4c')]));_0x50d3cb[_0xa898('0x47')](get_open_tabs(_0xa898('0x50'),_0x82a59a[_0xa898('0x4c')]));_0x50d3cb[_0xa898('0x47')](get_open_tabs(_0xa898('0x4e'),_0x82a59a[_0xa898('0x4c')]));_0x50d3cb[_0xa898('0x47')](get_open_tabs('mail',_0x82a59a[_0xa898('0x4c')]));return Promise[_0xa898('0x51')](_0x50d3cb);})[_0xa898('0x21')](function(_0x2cb0e3){if(_0x2cb0e3){var _0x4dc19e=_[_0xa898('0x2b')](values[_0xa898('0xb8')],function(_0x34e9d2){return{'channel':'CHAT','id':_0x34e9d2['id'],'createdAt':_0x34e9d2[_0xa898('0xb9')]};});var _0x378cb0=_[_0xa898('0x2b')](values[_0xa898('0xba')],function(_0x53d90d){return{'channel':_0xa898('0xbb'),'id':_0x53d90d['id'],'createdAt':_0x53d90d['createdAt']};});var _0x48b467=_[_0xa898('0x2b')](values[_0xa898('0xbc')],function(_0x48ba65){return{'channel':_0xa898('0xbd'),'id':_0x48ba65['id'],'createdAt':_0x48ba65[_0xa898('0xb9')]};});var _0x2859a6=_['map'](values[_0xa898('0xbe')],function(_0x838601){return{'channel':'MAIL','id':_0x838601['id'],'createdAt':_0x838601[_0xa898('0xb9')]};});var _0x577b05=_[_0xa898('0x2b')](values['SmsOpenTabs'],function(_0x4f8179){return{'channel':_0xa898('0xbf'),'id':_0x4f8179['id'],'createdAt':_0x4f8179[_0xa898('0xb9')]};});var _0x3dc59f=_[_0xa898('0x2b')](values[_0xa898('0xc0')],function(_0x37d456){return{'channel':_0xa898('0xc1'),'id':_0x37d456['id'],'createdAt':_0x37d456[_0xa898('0xb9')]};});var _0x59b6ee=_[_0xa898('0xc2')](_0x4dc19e,_0x378cb0,_0x48b467,_0x2859a6,_0x577b05,_0x3dc59f);var _0x31cfb6={'count':_0x59b6ee[_0xa898('0x63')],'rows':_0x59b6ee};return _0x31cfb6;}else return null;})[_0xa898('0x21')](respondWithResult(_0x1c1d32,null))['catch'](handleError(_0x1c1d32,null));};exports[_0xa898('0xc3')]=function(_0x249211,_0x279ada){var _0x351eba={};return db[_0xa898('0x33')]['findOne']({'where':{'id':_0x249211[_0xa898('0x54')]['id']}})[_0xa898('0x21')](function(_0x30e5f1){if(!_0x30e5f1){throw new APINotFoundError(util[_0xa898('0xa7')](_0xa898('0xc4'),_0x249211['params']['id']));}return contacts[_0xa898('0x58')]();})['then'](function(_0xd05470){_0x249211[_0xa898('0x40')][_0xa898('0x33')]=_0x249211[_0xa898('0x54')]['id'];_0x351eba=qs[_0xa898('0x3e')](_0xd05470,_0x249211);if(_0x249211[_0xa898('0x40')][_0xa898('0xc5')]('includeAll')){_0x351eba['include']=[{'model':db[_0xa898('0xc6')],'as':'List','required':![]},{'model':db[_0xa898('0xc7')],'as':_0xa898('0xc8'),'attributes':['id',_0xa898('0x31'),_0xa898('0xc9')],'where':_0x249211['query']['tag']?{'id':_0x249211[_0xa898('0x40')][_0xa898('0xca')]}:undefined,'required':_0x249211[_0xa898('0x40')][_0xa898('0xca')]?!![]:![]}];}return contacts['findAll'](_0x249211['query'],_0x249211[_0xa898('0x25')],_0x351eba,_0xd05470);})[_0xa898('0x21')](respondWithFilteredResult(_0x279ada,_0x351eba))[_0xa898('0x52')](APIHandleError(_0x279ada));};exports['getQueues']=function(_0x3a5c1f,_0x5b7a87){var _0x5e88f4;var _0x5be7e2={};var _0x40f6ef;return db['User']['findOne']({'where':{'id':_0x3a5c1f['params']['id']},'attributes':['id','name','role']})[_0xa898('0x21')](handleEntityNotFound(_0x5b7a87,null))[_0xa898('0x21')](function(_0x4bb208){if(!utils['isValidChannel'](_0x3a5c1f[_0xa898('0x40')][_0xa898('0x96')])){throw new db[(_0xa898('0x8c'))][(_0xa898('0x8b'))]('Unknown\x20channel');}_0x5e88f4=_0x4bb208;var _0x3237ab={};_0x3237ab[_0xa898('0xcb')]=_['keys'](db[_[_0xa898('0x9e')](_0x3a5c1f[_0xa898('0x40')][_0xa898('0x96')])+_0xa898('0xcc')][_0xa898('0x34')]);_0x3237ab[_0xa898('0x40')]=_[_0xa898('0xcd')](_0x3a5c1f[_0xa898('0x40')]);_0x3237ab[_0xa898('0xce')]=_[_0xa898('0xcf')](_0x3237ab[_0xa898('0xcb')],_0x3237ab[_0xa898('0x40')]);_0x5be7e2[_0xa898('0x46')]=_['intersection'](_0x3237ab[_0xa898('0xcb')],qs[_0xa898('0xd0')](_0x3a5c1f[_0xa898('0x40')][_0xa898('0xd0')]));_0x5be7e2['attributes']=_0x5be7e2[_0xa898('0x46')][_0xa898('0x63')]?_0x5be7e2[_0xa898('0x46')]:_0x3237ab[_0xa898('0xcb')];_0x5be7e2[_0xa898('0xd1')]=qs[_0xa898('0xd2')](_0x3a5c1f[_0xa898('0x40')][_0xa898('0xd2')]);_0x5be7e2[_0xa898('0x3f')]=qs['filters'](_[_0xa898('0xd3')](_0x3a5c1f['query'],_0x3237ab[_0xa898('0xce')]));if(_0x3a5c1f[_0xa898('0x40')]['filter']){_0x5be7e2['where']=_['merge'](_0x5be7e2['where'],{'$or':_[_0xa898('0x2b')](_0x5be7e2[_0xa898('0x46')],function(_0x2375f2){var _0x8501cf={};_0x8501cf[_0x2375f2]={'$like':'%'+_0x3a5c1f[_0xa898('0x40')]['filter']+'%'};return _0x8501cf;})});}_0x5be7e2=_[_0xa898('0x55')]({},_0x5be7e2,_0x3a5c1f['options']);switch(_0x5e88f4['role']){case _0xa898('0x23'):return db[_['capitalize'](_0x3a5c1f['query'][_0xa898('0x96')])+_0xa898('0xcc')][_0xa898('0x48')](_0x5be7e2);case _0xa898('0x25'):case _0xa898('0x27'):return _0x5e88f4[_0xa898('0x22')+_[_0xa898('0x9e')](_0x3a5c1f[_0xa898('0x40')][_0xa898('0x96')])+'Queues'](_0x5be7e2);default:throw new db[(_0xa898('0x8c'))][(_0xa898('0x8b'))](_0xa898('0xd4'));}})[_0xa898('0x21')](function(_0x20da31){_0x40f6ef=_0x20da31[_0xa898('0x63')];if(!_0x3a5c1f['query'][_0xa898('0xc5')](_0xa898('0xd5'))){_0x5be7e2[_0xa898('0x19')]=qs[_0xa898('0x19')](_0x3a5c1f[_0xa898('0x40')]['limit']);_0x5be7e2[_0xa898('0x17')]=qs[_0xa898('0x17')](_0x3a5c1f['query'][_0xa898('0x17')]);}switch(_0x5e88f4['role']){case _0xa898('0x23'):return db[_[_0xa898('0x9e')](_0x3a5c1f[_0xa898('0x40')][_0xa898('0x96')])+_0xa898('0xcc')]['findAll'](_0x5be7e2);case _0xa898('0x25'):case _0xa898('0x27'):return _0x5e88f4[_0xa898('0x22')+_[_0xa898('0x9e')](_0x3a5c1f['query'][_0xa898('0x96')])+'Queues'](_0x5be7e2);}})['then'](function(_0x118d65){return{'count':_0x40f6ef,'rows':_0x118d65};})[_0xa898('0x21')](respondWithResult(_0x5b7a87,null))[_0xa898('0x52')](handleError(_0x5b7a87,null));};exports[_0xa898('0xd6')]=function(_0x4f7aeb,_0x3e635b){var _0x24933a={};var _0x5c9dcd={};var _0x471d80;var _0x2c7553;return db[_0xa898('0x33')][_0xa898('0x90')]({'where':{'id':_0x4f7aeb[_0xa898('0x54')]['id']}})[_0xa898('0x21')](handleEntityNotFound(_0x3e635b,null))['then'](function(_0x38697f){if(_0x38697f){_0x471d80=_0x38697f;_0x5c9dcd['model']=_['keys'](db['UserVoiceQueueRt'][_0xa898('0x34')]);_0x5c9dcd[_0xa898('0x40')]=_[_0xa898('0xcd')](_0x4f7aeb['query']);_0x5c9dcd[_0xa898('0xce')]=_['intersection'](_0x5c9dcd[_0xa898('0xcb')],_0x5c9dcd[_0xa898('0x40')]);_0x24933a[_0xa898('0x46')]=_['intersection'](_0x5c9dcd[_0xa898('0xcb')],qs['fields'](_0x4f7aeb[_0xa898('0x40')][_0xa898('0xd0')]));_0x24933a[_0xa898('0x46')]=_0x24933a[_0xa898('0x46')][_0xa898('0x63')]?_0x24933a[_0xa898('0x46')]:_0x5c9dcd[_0xa898('0xcb')];_0x24933a[_0xa898('0xd1')]=qs[_0xa898('0xd2')](_0x4f7aeb[_0xa898('0x40')][_0xa898('0xd2')]);_0x24933a[_0xa898('0x3f')]=qs[_0xa898('0xce')](_['pick'](_0x4f7aeb[_0xa898('0x40')],_0x5c9dcd[_0xa898('0xce')]));if(_0x4f7aeb['query'][_0xa898('0x37')]){_0x24933a[_0xa898('0x3f')]=_['merge'](_0x24933a[_0xa898('0x3f')],{'$or':_[_0xa898('0x2b')](_0x24933a[_0xa898('0x46')],function(_0x330945){var _0x8618fe={};_0x8618fe[_0x330945]={'$like':'%'+_0x4f7aeb[_0xa898('0x40')][_0xa898('0x37')]+'%'};return _0x8618fe;})});}_0x24933a=_['merge']({},_0x24933a,_0x4f7aeb[_0xa898('0x56')]);return _0x471d80[_0xa898('0xd6')](_0x24933a);}})[_0xa898('0x21')](function(_0x218b8f){if(_0x218b8f){_0x2c7553=_0x218b8f[_0xa898('0x63')];if(!_0x4f7aeb[_0xa898('0x40')][_0xa898('0xc5')]('nolimit')){_0x24933a[_0xa898('0x19')]=qs[_0xa898('0x19')](_0x4f7aeb[_0xa898('0x40')][_0xa898('0x19')]);_0x24933a[_0xa898('0x17')]=qs['offset'](_0x4f7aeb[_0xa898('0x40')][_0xa898('0x17')]);}return _0x471d80[_0xa898('0xd6')](_0x24933a);}})[_0xa898('0x21')](function(_0x53394c){if(_0x53394c){return _0x53394c?{'count':_0x2c7553,'rows':_0x53394c}:null;}})[_0xa898('0x21')](respondWithResult(_0x3e635b,null))[_0xa898('0x52')](handleError(_0x3e635b,null));};exports[_0xa898('0xd7')]=function(_0x46a5bd,_0x51a388){var _0x37efaa={};var _0x5a474b={};var _0x197d7b;var _0x3949a2;return db[_0xa898('0x33')][_0xa898('0x90')]({'where':{'id':_0x46a5bd[_0xa898('0x54')]['id']}})['then'](handleEntityNotFound(_0x51a388,null))['then'](function(_0x57b352){if(_0x57b352){_0x197d7b=_0x57b352;_0x5a474b[_0xa898('0xcb')]=_[_0xa898('0xcd')](db[_0xa898('0xd8')][_0xa898('0x34')]);_0x5a474b[_0xa898('0x40')]=_[_0xa898('0xcd')](_0x46a5bd[_0xa898('0x40')]);_0x5a474b['filters']=_[_0xa898('0xcf')](_0x5a474b[_0xa898('0xcb')],_0x5a474b[_0xa898('0x40')]);_0x37efaa[_0xa898('0x46')]=_['intersection'](_0x5a474b[_0xa898('0xcb')],qs['fields'](_0x46a5bd[_0xa898('0x40')][_0xa898('0xd0')]));_0x37efaa[_0xa898('0x46')]=_0x37efaa['attributes']['length']?_0x37efaa[_0xa898('0x46')]:_0x5a474b[_0xa898('0xcb')];_0x37efaa[_0xa898('0xd1')]=qs[_0xa898('0xd2')](_0x46a5bd[_0xa898('0x40')]['sort']);_0x37efaa[_0xa898('0x3f')]=qs[_0xa898('0xce')](_[_0xa898('0xd3')](_0x46a5bd[_0xa898('0x40')],_0x5a474b[_0xa898('0xce')]));if(_0x46a5bd[_0xa898('0x40')][_0xa898('0x37')]){_0x37efaa[_0xa898('0x3f')]=_[_0xa898('0x55')](_0x37efaa['where'],{'$or':_[_0xa898('0x2b')](_0x37efaa['attributes'],function(_0x26aacd){var _0x31d31b={};_0x31d31b[_0x26aacd]={'$like':'%'+_0x46a5bd[_0xa898('0x40')][_0xa898('0x37')]+'%'};return _0x31d31b;})});}_0x37efaa=_[_0xa898('0x55')]({},_0x37efaa,_0x46a5bd[_0xa898('0x56')]);return _0x197d7b[_0xa898('0xd7')](_0x37efaa);}})['then'](function(_0x377528){if(_0x377528){_0x3949a2=_0x377528['length'];if(!_0x46a5bd[_0xa898('0x40')][_0xa898('0xc5')](_0xa898('0xd5'))){_0x37efaa['limit']=qs['limit'](_0x46a5bd[_0xa898('0x40')][_0xa898('0x19')]);_0x37efaa['offset']=qs[_0xa898('0x17')](_0x46a5bd[_0xa898('0x40')][_0xa898('0x17')]);}return _0x197d7b[_0xa898('0xd7')](_0x37efaa);}})['then'](function(_0x417cb9){if(_0x417cb9){return _0x417cb9?{'count':_0x3949a2,'rows':_0x417cb9}:null;}})[_0xa898('0x21')](respondWithResult(_0x51a388,null))['catch'](handleError(_0x51a388,null));};exports[_0xa898('0xd9')]=function(_0x408555,_0x26d7e1){var _0x270551={'raw':!![],'where':{}};var _0x2d3d96={};var _0x1a3fcc={'count':0x0,'rows':[]};return db[_0xa898('0x33')][_0xa898('0x90')]({'where':{'id':_0x408555[_0xa898('0x54')]['id']}})['then'](handleEntityNotFound(_0x26d7e1,null))[_0xa898('0x21')](function(_0x528bd4){if(_0x528bd4){_0x2d3d96[_0xa898('0xcb')]=_[_0xa898('0xcd')](db[_0xa898('0xda')]['rawAttributes']);_0x2d3d96[_0xa898('0x40')]=_[_0xa898('0xcd')](_0x408555[_0xa898('0x40')]);_0x2d3d96[_0xa898('0xce')]=_[_0xa898('0xcf')](_0x2d3d96[_0xa898('0xcb')],_0x2d3d96[_0xa898('0x40')]);_0x270551[_0xa898('0x46')]=_[_0xa898('0xcf')](_0x2d3d96['model'],qs[_0xa898('0xd0')](_0x408555['query'][_0xa898('0xd0')]));_0x270551[_0xa898('0x46')]=_0x270551['attributes'][_0xa898('0x63')]?_0x270551[_0xa898('0x46')]:_0x2d3d96[_0xa898('0xcb')];if(!_0x408555[_0xa898('0x40')]['hasOwnProperty'](_0xa898('0xd5'))){_0x270551[_0xa898('0x19')]=qs[_0xa898('0x19')](_0x408555[_0xa898('0x40')][_0xa898('0x19')]);_0x270551[_0xa898('0x17')]=qs[_0xa898('0x17')](_0x408555['query'][_0xa898('0x17')]);}_0x270551[_0xa898('0xd1')]=qs[_0xa898('0xd2')](_0x408555[_0xa898('0x40')]['sort']);_0x270551[_0xa898('0x3f')]=qs[_0xa898('0xce')](_[_0xa898('0xd3')](_0x408555[_0xa898('0x40')],_0x2d3d96['filters']));_0x270551[_0xa898('0x3f')][_0xa898('0xdb')]=_0x528bd4['id'];if(_0x408555['query'][_0xa898('0x37')]){_0x270551[_0xa898('0x3f')]=_[_0xa898('0x55')](_0x270551[_0xa898('0x3f')],{'$or':_[_0xa898('0x2b')](_0x270551[_0xa898('0x46')],function(_0x579f79){var _0x2b77d7={};_0x2b77d7[_0x579f79]={'$like':'%'+_0x408555[_0xa898('0x40')][_0xa898('0x37')]+'%'};return _0x2b77d7;})});}_0x270551=_[_0xa898('0x55')]({},_0x270551,_0x408555[_0xa898('0x56')]);return db[_0xa898('0xda')]['count']({'where':_0x270551[_0xa898('0x3f')]})['then'](function(_0x3dd2ec){_0x1a3fcc['count']=_0x3dd2ec;if(_0x408555[_0xa898('0x40')][_0xa898('0x41')]){_0x270551[_0xa898('0x42')]=[{'all':!![]}];}return db[_0xa898('0xda')][_0xa898('0x48')](_0x270551);})[_0xa898('0x21')](function(_0x15d083){_0x1a3fcc[_0xa898('0x49')]=_0x15d083;return _0x1a3fcc;});}})[_0xa898('0x21')](respondWithFilteredResult(_0x26d7e1,_0x270551))[_0xa898('0x52')](handleError(_0x26d7e1,null));};exports[_0xa898('0xdc')]=function(_0x2cff86,_0x33966e){var _0x3451d4={'raw':!![],'where':{}};var _0xe297d2={};var _0x572b23={'count':0x0,'rows':[]};return db['User'][_0xa898('0x90')]({'where':{'id':_0x2cff86[_0xa898('0x54')]['id']}})[_0xa898('0x21')](handleEntityNotFound(_0x33966e,null))['then'](function(_0x53a4be){if(_0x53a4be){_0xe297d2['model']=_[_0xa898('0xcd')](db['ScreenRecording'][_0xa898('0x34')]);_0xe297d2['query']=_[_0xa898('0xcd')](_0x2cff86[_0xa898('0x40')]);_0xe297d2[_0xa898('0xce')]=_[_0xa898('0xcf')](_0xe297d2[_0xa898('0xcb')],_0xe297d2[_0xa898('0x40')]);_0x3451d4[_0xa898('0x46')]=_[_0xa898('0xcf')](_0xe297d2[_0xa898('0xcb')],qs[_0xa898('0xd0')](_0x2cff86[_0xa898('0x40')]['fields']));_0x3451d4['attributes']=_0x3451d4[_0xa898('0x46')][_0xa898('0x63')]?_0x3451d4[_0xa898('0x46')]:_0xe297d2['model'];if(!_0x2cff86['query']['hasOwnProperty']('nolimit')){_0x3451d4[_0xa898('0x19')]=qs[_0xa898('0x19')](_0x2cff86['query'][_0xa898('0x19')]);_0x3451d4[_0xa898('0x17')]=qs['offset'](_0x2cff86[_0xa898('0x40')][_0xa898('0x17')]);}_0x3451d4[_0xa898('0xd1')]=qs[_0xa898('0xd2')](_0x2cff86[_0xa898('0x40')][_0xa898('0xd2')]);_0x3451d4[_0xa898('0x3f')]=qs[_0xa898('0xce')](_[_0xa898('0xd3')](_0x2cff86[_0xa898('0x40')],_0xe297d2['filters']));_0x3451d4[_0xa898('0x3f')]['UserId']=_0x53a4be['id'];if(_0x2cff86['query']['filter']){_0x3451d4[_0xa898('0x3f')]=_[_0xa898('0x55')](_0x3451d4['where'],{'$or':_[_0xa898('0x2b')](_0x3451d4[_0xa898('0x46')],function(_0x31f743){var _0x3fa8b9={};_0x3fa8b9[_0x31f743]={'$like':'%'+_0x2cff86['query'][_0xa898('0x37')]+'%'};return _0x3fa8b9;})});}_0x3451d4=_[_0xa898('0x55')]({},_0x3451d4,_0x2cff86[_0xa898('0x56')]);return db['ScreenRecording'][_0xa898('0x1a')]({'where':_0x3451d4[_0xa898('0x3f')]})['then'](function(_0xb062a7){_0x572b23[_0xa898('0x1a')]=_0xb062a7;if(_0x2cff86[_0xa898('0x40')][_0xa898('0x41')]){_0x3451d4[_0xa898('0x42')]=[{'all':!![]}];}return db['ScreenRecording']['findAll'](_0x3451d4);})[_0xa898('0x21')](function(_0x4a3d57){_0x572b23['rows']=_0x4a3d57;return _0x572b23;});}})[_0xa898('0x21')](respondWithFilteredResult(_0x33966e,_0x3451d4))[_0xa898('0x52')](handleError(_0x33966e,null));};exports['getChatInteractions']=function(_0xe98fe8,_0x523602){var _0x4c73c0={};var _0xb595ef={};var _0x294bd9;var _0x11fa98;return db['User'][_0xa898('0x90')]({'where':{'id':_0xe98fe8['params']['id']}})[_0xa898('0x21')](handleEntityNotFound(_0x523602,null))['then'](function(_0xf026ad){if(_0xf026ad){_0x294bd9=_0xf026ad;_0xb595ef[_0xa898('0xcb')]=_['keys'](db[_0xa898('0xdd')][_0xa898('0x34')]);_0xb595ef[_0xa898('0x40')]=_[_0xa898('0xcd')](_0xe98fe8['query']);_0xb595ef[_0xa898('0xce')]=_['intersection'](_0xb595ef[_0xa898('0xcb')],_0xb595ef['query']);_0x4c73c0['attributes']=_['intersection'](_0xb595ef[_0xa898('0xcb')],qs[_0xa898('0xd0')](_0xe98fe8['query'][_0xa898('0xd0')]));_0x4c73c0['attributes']=_0x4c73c0['attributes']['length']?_0x4c73c0[_0xa898('0x46')]:_0xb595ef['model'];_0x4c73c0['order']=qs['sort'](_0xe98fe8[_0xa898('0x40')][_0xa898('0xd2')]);_0x4c73c0['where']=qs[_0xa898('0xce')](_[_0xa898('0xd3')](_0xe98fe8[_0xa898('0x40')],_0xb595ef[_0xa898('0xce')]));if(_0xe98fe8[_0xa898('0x40')][_0xa898('0x37')]){_0x4c73c0[_0xa898('0x3f')]=_[_0xa898('0x55')](_0x4c73c0[_0xa898('0x3f')],{'$or':_[_0xa898('0x2b')](_0x4c73c0['attributes'],function(_0x2e6916){var _0x15a25e={};_0x15a25e[_0x2e6916]={'$like':'%'+_0xe98fe8[_0xa898('0x40')][_0xa898('0x37')]+'%'};return _0x15a25e;})});}_0x4c73c0=_[_0xa898('0x55')]({},_0x4c73c0,_0xe98fe8[_0xa898('0x56')]);return _0x294bd9['getChatInteractions'](_0x4c73c0);}})['then'](function(_0x389f74){if(_0x389f74){_0x11fa98=_0x389f74[_0xa898('0x63')];if(!_0xe98fe8[_0xa898('0x40')]['hasOwnProperty'](_0xa898('0xd5'))){_0x4c73c0[_0xa898('0x19')]=qs[_0xa898('0x19')](_0xe98fe8[_0xa898('0x40')][_0xa898('0x19')]);_0x4c73c0['offset']=qs[_0xa898('0x17')](_0xe98fe8[_0xa898('0x40')][_0xa898('0x17')]);}return _0x294bd9[_0xa898('0xde')](_0x4c73c0);}})['then'](function(_0x25b02a){if(_0x25b02a){return _0x25b02a?{'count':_0x11fa98,'rows':_0x25b02a}:null;}})[_0xa898('0x21')](respondWithResult(_0x523602,null))['catch'](handleError(_0x523602,null));};exports['getOpenchannelInteractions']=function(_0x203276,_0x4ef7b5){var _0x57955c={};var _0x51ce14={};var _0x39ade9;var _0xe1c8b6;return db[_0xa898('0x33')][_0xa898('0x90')]({'where':{'id':_0x203276[_0xa898('0x54')]['id']}})[_0xa898('0x21')](handleEntityNotFound(_0x4ef7b5,null))[_0xa898('0x21')](function(_0x32ff03){if(_0x32ff03){_0x39ade9=_0x32ff03;_0x51ce14[_0xa898('0xcb')]=_[_0xa898('0xcd')](db[_0xa898('0xdf')][_0xa898('0x34')]);_0x51ce14[_0xa898('0x40')]=_[_0xa898('0xcd')](_0x203276[_0xa898('0x40')]);_0x51ce14['filters']=_[_0xa898('0xcf')](_0x51ce14[_0xa898('0xcb')],_0x51ce14['query']);_0x57955c[_0xa898('0x46')]=_[_0xa898('0xcf')](_0x51ce14[_0xa898('0xcb')],qs['fields'](_0x203276['query'][_0xa898('0xd0')]));_0x57955c[_0xa898('0x46')]=_0x57955c[_0xa898('0x46')][_0xa898('0x63')]?_0x57955c[_0xa898('0x46')]:_0x51ce14[_0xa898('0xcb')];_0x57955c[_0xa898('0xd1')]=qs[_0xa898('0xd2')](_0x203276[_0xa898('0x40')][_0xa898('0xd2')]);_0x57955c[_0xa898('0x3f')]=qs[_0xa898('0xce')](_['pick'](_0x203276[_0xa898('0x40')],_0x51ce14[_0xa898('0xce')]));if(_0x203276[_0xa898('0x40')][_0xa898('0x37')]){_0x57955c[_0xa898('0x3f')]=_[_0xa898('0x55')](_0x57955c[_0xa898('0x3f')],{'$or':_[_0xa898('0x2b')](_0x57955c[_0xa898('0x46')],function(_0x10be04){var _0x11cd8a={};_0x11cd8a[_0x10be04]={'$like':'%'+_0x203276[_0xa898('0x40')][_0xa898('0x37')]+'%'};return _0x11cd8a;})});}_0x57955c=_['merge']({},_0x57955c,_0x203276['options']);return _0x39ade9[_0xa898('0xe0')](_0x57955c);}})[_0xa898('0x21')](function(_0x1fdf8f){if(_0x1fdf8f){_0xe1c8b6=_0x1fdf8f[_0xa898('0x63')];if(!_0x203276[_0xa898('0x40')]['hasOwnProperty']('nolimit')){_0x57955c[_0xa898('0x19')]=qs['limit'](_0x203276[_0xa898('0x40')][_0xa898('0x19')]);_0x57955c[_0xa898('0x17')]=qs[_0xa898('0x17')](_0x203276[_0xa898('0x40')]['offset']);}return _0x39ade9[_0xa898('0xe0')](_0x57955c);}})[_0xa898('0x21')](function(_0x31eb35){if(_0x31eb35){return _0x31eb35?{'count':_0xe1c8b6,'rows':_0x31eb35}:null;}})[_0xa898('0x21')](respondWithResult(_0x4ef7b5,null))['catch'](handleError(_0x4ef7b5,null));};exports['getMailInteractions']=function(_0xe1c44,_0x20043c){var _0x2a0c7b={'raw':!![],'where':{}};var _0x2d4616={};var _0x17a13b={'count':0x0,'rows':[]};return db['User']['findOne']({'where':{'id':_0xe1c44[_0xa898('0x54')]['id']}})[_0xa898('0x21')](handleEntityNotFound(_0x20043c,null))[_0xa898('0x21')](function(_0x494ee2){if(_0x494ee2){_0x2d4616[_0xa898('0xcb')]=_[_0xa898('0xcd')](db[_0xa898('0xe1')][_0xa898('0x34')]);_0x2d4616['query']=_[_0xa898('0xcd')](_0xe1c44[_0xa898('0x40')]);_0x2d4616[_0xa898('0xce')]=_[_0xa898('0xcf')](_0x2d4616[_0xa898('0xcb')],_0x2d4616[_0xa898('0x40')]);_0x2a0c7b[_0xa898('0x46')]=_[_0xa898('0xcf')](_0x2d4616[_0xa898('0xcb')],qs[_0xa898('0xd0')](_0xe1c44[_0xa898('0x40')]['fields']));_0x2a0c7b[_0xa898('0x46')]=_0x2a0c7b[_0xa898('0x46')][_0xa898('0x63')]?_0x2a0c7b[_0xa898('0x46')]:_0x2d4616[_0xa898('0xcb')];if(!_0xe1c44['query'][_0xa898('0xc5')](_0xa898('0xd5'))){_0x2a0c7b[_0xa898('0x19')]=qs['limit'](_0xe1c44[_0xa898('0x40')]['limit']);_0x2a0c7b['offset']=qs[_0xa898('0x17')](_0xe1c44['query']['offset']);}_0x2a0c7b[_0xa898('0xd1')]=qs[_0xa898('0xd2')](_0xe1c44[_0xa898('0x40')][_0xa898('0xd2')]);_0x2a0c7b[_0xa898('0x3f')]=qs['filters'](_[_0xa898('0xd3')](_0xe1c44['query'],_0x2d4616[_0xa898('0xce')]));_0x2a0c7b[_0xa898('0x3f')][_0xa898('0xdb')]=_0x494ee2['id'];if(_0xe1c44[_0xa898('0x40')][_0xa898('0x37')]){_0x2a0c7b[_0xa898('0x3f')]=_[_0xa898('0x55')](_0x2a0c7b['where'],{'$or':_[_0xa898('0x2b')](_0x2a0c7b[_0xa898('0x46')],function(_0x4bb00c){var _0x310ea3={};_0x310ea3[_0x4bb00c]={'$like':'%'+_0xe1c44[_0xa898('0x40')][_0xa898('0x37')]+'%'};return _0x310ea3;})});}_0x2a0c7b=_[_0xa898('0x55')]({},_0x2a0c7b,_0xe1c44['options']);return db[_0xa898('0xe1')]['count']({'where':_0x2a0c7b[_0xa898('0x3f')]})[_0xa898('0x21')](function(_0x33af84){_0x17a13b[_0xa898('0x1a')]=_0x33af84;if(_0xe1c44['query'][_0xa898('0x41')]){_0x2a0c7b[_0xa898('0x42')]=[{'all':!![]}];}return db[_0xa898('0xe1')][_0xa898('0x48')](_0x2a0c7b);})[_0xa898('0x21')](function(_0x502da1){_0x17a13b['rows']=_0x502da1;return _0x17a13b;});}})['then'](respondWithFilteredResult(_0x20043c,_0x2a0c7b))[_0xa898('0x52')](handleError(_0x20043c,null));};exports[_0xa898('0xe2')]=function(_0x32deda,_0x3355b5){var _0x859c06={};var _0x4d329c={};var _0x45a87a;var _0x2c788a;return db['User'][_0xa898('0x90')]({'where':{'id':_0x32deda['params']['id']}})[_0xa898('0x21')](handleEntityNotFound(_0x3355b5,null))[_0xa898('0x21')](function(_0x6d343c){if(_0x6d343c){_0x45a87a=_0x6d343c;_0x4d329c['model']=_['keys'](db[_0xa898('0xe3')][_0xa898('0x34')]);_0x4d329c[_0xa898('0x40')]=_[_0xa898('0xcd')](_0x32deda[_0xa898('0x40')]);_0x4d329c['filters']=_[_0xa898('0xcf')](_0x4d329c[_0xa898('0xcb')],_0x4d329c['query']);_0x859c06[_0xa898('0x46')]=_[_0xa898('0xcf')](_0x4d329c[_0xa898('0xcb')],qs[_0xa898('0xd0')](_0x32deda[_0xa898('0x40')][_0xa898('0xd0')]));_0x859c06[_0xa898('0x46')]=_0x859c06[_0xa898('0x46')][_0xa898('0x63')]?_0x859c06[_0xa898('0x46')]:_0x4d329c['model'];_0x859c06[_0xa898('0xd1')]=qs[_0xa898('0xd2')](_0x32deda[_0xa898('0x40')]['sort']);_0x859c06[_0xa898('0x3f')]=qs['filters'](_['pick'](_0x32deda[_0xa898('0x40')],_0x4d329c[_0xa898('0xce')]));if(_0x32deda[_0xa898('0x40')]['filter']){_0x859c06[_0xa898('0x3f')]=_[_0xa898('0x55')](_0x859c06[_0xa898('0x3f')],{'$or':_[_0xa898('0x2b')](_0x859c06[_0xa898('0x46')],function(_0x479767){var _0x57c114={};_0x57c114[_0x479767]={'$like':'%'+_0x32deda[_0xa898('0x40')]['filter']+'%'};return _0x57c114;})});}_0x859c06=_['merge']({},_0x859c06,_0x32deda[_0xa898('0x56')]);return _0x45a87a[_0xa898('0xe2')](_0x859c06);}})['then'](function(_0x2a3d1b){if(_0x2a3d1b){_0x2c788a=_0x2a3d1b[_0xa898('0x63')];if(!_0x32deda[_0xa898('0x40')][_0xa898('0xc5')](_0xa898('0xd5'))){_0x859c06[_0xa898('0x19')]=qs[_0xa898('0x19')](_0x32deda[_0xa898('0x40')][_0xa898('0x19')]);_0x859c06[_0xa898('0x17')]=qs[_0xa898('0x17')](_0x32deda['query'][_0xa898('0x17')]);}return _0x45a87a[_0xa898('0xe2')](_0x859c06);}})['then'](function(_0x16d391){if(_0x16d391){return _0x16d391?{'count':_0x2c788a,'rows':_0x16d391}:null;}})['then'](respondWithResult(_0x3355b5,null))[_0xa898('0x52')](handleError(_0x3355b5,null));};exports['getFaxInteractions']=function(_0x113efd,_0x12c34d){var _0x1d09e9={};var _0x100664={};var _0x3719f0;var _0x5c7e86;return db[_0xa898('0x33')][_0xa898('0x90')]({'where':{'id':_0x113efd[_0xa898('0x54')]['id']}})[_0xa898('0x21')](handleEntityNotFound(_0x12c34d,null))['then'](function(_0x4a7308){if(_0x4a7308){_0x3719f0=_0x4a7308;_0x100664[_0xa898('0xcb')]=_[_0xa898('0xcd')](db['FaxInteraction'][_0xa898('0x34')]);_0x100664['query']=_[_0xa898('0xcd')](_0x113efd[_0xa898('0x40')]);_0x100664['filters']=_[_0xa898('0xcf')](_0x100664[_0xa898('0xcb')],_0x100664[_0xa898('0x40')]);_0x1d09e9[_0xa898('0x46')]=_[_0xa898('0xcf')](_0x100664[_0xa898('0xcb')],qs[_0xa898('0xd0')](_0x113efd[_0xa898('0x40')]['fields']));_0x1d09e9[_0xa898('0x46')]=_0x1d09e9[_0xa898('0x46')][_0xa898('0x63')]?_0x1d09e9['attributes']:_0x100664[_0xa898('0xcb')];_0x1d09e9['order']=qs[_0xa898('0xd2')](_0x113efd['query'][_0xa898('0xd2')]);_0x1d09e9[_0xa898('0x3f')]=qs[_0xa898('0xce')](_[_0xa898('0xd3')](_0x113efd['query'],_0x100664[_0xa898('0xce')]));if(_0x113efd[_0xa898('0x40')][_0xa898('0x37')]){_0x1d09e9[_0xa898('0x3f')]=_[_0xa898('0x55')](_0x1d09e9['where'],{'$or':_[_0xa898('0x2b')](_0x1d09e9[_0xa898('0x46')],function(_0x2080d0){var _0x11d491={};_0x11d491[_0x2080d0]={'$like':'%'+_0x113efd[_0xa898('0x40')][_0xa898('0x37')]+'%'};return _0x11d491;})});}_0x1d09e9=_[_0xa898('0x55')]({},_0x1d09e9,_0x113efd[_0xa898('0x56')]);return _0x3719f0[_0xa898('0xe4')](_0x1d09e9);}})[_0xa898('0x21')](function(_0x4a49a5){if(_0x4a49a5){_0x5c7e86=_0x4a49a5[_0xa898('0x63')];if(!_0x113efd[_0xa898('0x40')][_0xa898('0xc5')](_0xa898('0xd5'))){_0x1d09e9[_0xa898('0x19')]=qs[_0xa898('0x19')](_0x113efd[_0xa898('0x40')][_0xa898('0x19')]);_0x1d09e9['offset']=qs[_0xa898('0x17')](_0x113efd['query'][_0xa898('0x17')]);}return _0x3719f0['getFaxInteractions'](_0x1d09e9);}})[_0xa898('0x21')](function(_0x5ab88c){if(_0x5ab88c){return _0x5ab88c?{'count':_0x5c7e86,'rows':_0x5ab88c}:null;}})[_0xa898('0x21')](respondWithResult(_0x12c34d,null))['catch'](handleError(_0x12c34d,null));};exports['getWhatsappInteractions']=function(_0x1147a8,_0x1dcb75){var _0x6491d8={};var _0x21344e={};var _0x405760;var _0x2a860d;return db[_0xa898('0x33')][_0xa898('0x90')]({'where':{'id':_0x1147a8[_0xa898('0x54')]['id']}})[_0xa898('0x21')](handleEntityNotFound(_0x1dcb75,null))['then'](function(_0x1db2be){if(_0x1db2be){_0x405760=_0x1db2be;_0x21344e[_0xa898('0xcb')]=_[_0xa898('0xcd')](db[_0xa898('0xe5')][_0xa898('0x34')]);_0x21344e[_0xa898('0x40')]=_[_0xa898('0xcd')](_0x1147a8[_0xa898('0x40')]);_0x21344e[_0xa898('0xce')]=_[_0xa898('0xcf')](_0x21344e[_0xa898('0xcb')],_0x21344e[_0xa898('0x40')]);_0x6491d8['attributes']=_[_0xa898('0xcf')](_0x21344e[_0xa898('0xcb')],qs[_0xa898('0xd0')](_0x1147a8[_0xa898('0x40')]['fields']));_0x6491d8[_0xa898('0x46')]=_0x6491d8[_0xa898('0x46')]['length']?_0x6491d8[_0xa898('0x46')]:_0x21344e[_0xa898('0xcb')];_0x6491d8[_0xa898('0xd1')]=qs['sort'](_0x1147a8[_0xa898('0x40')][_0xa898('0xd2')]);_0x6491d8[_0xa898('0x3f')]=qs[_0xa898('0xce')](_[_0xa898('0xd3')](_0x1147a8[_0xa898('0x40')],_0x21344e[_0xa898('0xce')]));if(_0x1147a8[_0xa898('0x40')][_0xa898('0x37')]){_0x6491d8['where']=_['merge'](_0x6491d8[_0xa898('0x3f')],{'$or':_['map'](_0x6491d8[_0xa898('0x46')],function(_0x25e1b5){var _0x331b26={};_0x331b26[_0x25e1b5]={'$like':'%'+_0x1147a8[_0xa898('0x40')][_0xa898('0x37')]+'%'};return _0x331b26;})});}_0x6491d8=_[_0xa898('0x55')]({},_0x6491d8,_0x1147a8[_0xa898('0x56')]);return _0x405760[_0xa898('0xe6')](_0x6491d8);}})['then'](function(_0x1af00a){if(_0x1af00a){_0x2a860d=_0x1af00a[_0xa898('0x63')];if(!_0x1147a8[_0xa898('0x40')][_0xa898('0xc5')](_0xa898('0xd5'))){_0x6491d8[_0xa898('0x19')]=qs[_0xa898('0x19')](_0x1147a8['query'][_0xa898('0x19')]);_0x6491d8['offset']=qs[_0xa898('0x17')](_0x1147a8['query'][_0xa898('0x17')]);}return _0x405760[_0xa898('0xe6')](_0x6491d8);}})[_0xa898('0x21')](function(_0x416d61){if(_0x416d61){return _0x416d61?{'count':_0x2a860d,'rows':_0x416d61}:null;}})['then'](respondWithResult(_0x1dcb75,null))[_0xa898('0x52')](handleError(_0x1dcb75,null));};exports['login']=function(_0x3eb78b,_0x58d4c3,_0x1ca280){var _0x447362;var _0x16e340;var _0x3305dd;var _0xfb78db=!_[_0xa898('0x60')](_0x3eb78b[_0xa898('0x54')]['id'])?_0x3eb78b['params']['id']:!_[_0xa898('0x60')](_0x3eb78b[_0xa898('0x25')]['id'])?_0x3eb78b[_0xa898('0x25')]['id']:null;return db[_0xa898('0x33')]['find']({'where':{'id':_0xfb78db,'role':{'$or':[_0xa898('0x23'),_0xa898('0x25'),'agent']}},'attributes':['id','name','phone',_0xa898('0xe7'),_0xa898('0x1d'),_0xa898('0x5b'),_0xa898('0x98')]})[_0xa898('0x21')](function(_0x1f6445){if(_0x1f6445){if(_0x1f6445['role']===_0xa898('0x27')){_0x447362=_0x1f6445;if(_0x3eb78b['body']['interface']){_0x3305dd=util[_0xa898('0xa7')]('LOCAL/%s@from-sip/n',_0x447362[_0x3eb78b[_0xa898('0x57')][_0xa898('0x9a')]]);}else if(_0x3eb78b['body']['intrf']){_0x3305dd=util[_0xa898('0xa7')](_0xa898('0xa8'),_0x3eb78b[_0xa898('0x57')][_0xa898('0xe8')]);}else{_0x3305dd=util[_0xa898('0xa7')](_0xa898('0xa8'),_0x447362[_0xa898('0x31')]);}socket['to'](util[_0xa898('0xa7')]('user:%s',_0x447362[_0xa898('0x31')]))['emit'](_0xa898('0xe9'),{'user':{'id':_0x447362['id'],'name':_0x447362[_0xa898('0x31')]},'ip':_0x3eb78b['headers'][_0xa898('0xea')]||_0x3eb78b[_0xa898('0xeb')][_0xa898('0xec')]||_0x3eb78b[_0xa898('0xed')][_0xa898('0xec')]||_0x3eb78b[_0xa898('0xeb')][_0xa898('0xed')][_0xa898('0xec')]});return db[_0xa898('0xa9')]['destroy']({'where':{'membername':_0x447362['name']},'individualHooks':!![]});}}else{throw new db[(_0xa898('0x8c'))][(_0xa898('0x8b'))](_0xa898('0xee'));}})[_0xa898('0x21')](function(){if(_0x447362){return _0x447362[_0xa898('0xef')]({'raw':!![]});}})[_0xa898('0x21')](function(_0x4d030d){if(_0x447362){if(_0x4d030d){_0x16e340=_0x4d030d;if(_0x16e340[_0xa898('0x63')]){var _0x20ac6a=_0x16e340[_0xa898('0x2b')](function(_0x49b56d){var _0x885fe7={'membername':_0x447362[_0xa898('0x31')],'UserId':_0x447362['id'],'queue_name':_0x49b56d[_0xa898('0x31')],'VoiceQueueId':_0x49b56d['id'],'interface':_0x3305dd,'paused':_0x447362[_0xa898('0x98')]||![],'penalty':_0x49b56d[_0xa898('0xf0')]||0x0};return db['UserVoiceQueueRt'][_0xa898('0xaa')](_0x885fe7);});return Promise[_0xa898('0x51')](_0x20ac6a);}}}})[_0xa898('0x21')](function(){if(_0x447362){return db[_0xa898('0xf1')][_0xa898('0x48')]({'where':{'membername':_0x447362[_0xa898('0x31')],'exitAt':null}});}})['then'](function(_0x5406f7){if(_0x447362){var _0x5156a7=[];_0x5406f7['forEach'](function(_0x23dd8e){_0x5156a7[_0xa898('0x47')](_0x23dd8e['update']({'exitAt':moment()[_0xa898('0xa7')]('YYYY-MM-DD\x20HH:mm:ss')}));});return Promise[_0xa898('0x51')](_0x5156a7);}})[_0xa898('0x21')](function(){if(_0x447362){var _0x449c2b=[];var _0x3add47=[];var _0x51edfc=utils['getChannels']();var _0x2b5c72={'membername':_0x447362[_0xa898('0x31')],'interface':_0x3305dd,'enterAt':moment()[_0xa898('0xa7')](_0xa898('0xf2')),'role':_0x447362[_0xa898('0x1d')],'internal':_0x447362['internal']};_0x51edfc['forEach'](function(_0x4bae03){_0x449c2b['push'](_[_0xa898('0x55')]({'channel':_0x4bae03,'type':_0xa898('0xf3'),'data1':_0x3eb78b[_0xa898('0x57')][_0xa898('0xf4')],'data2':_0x3305dd},_0x2b5c72));if(_0x447362['loginInPause']){_0x3add47[_0xa898('0x47')](_[_0xa898('0x55')]({'channel':_0x4bae03,'type':_0xa898('0xf5'),'data1':_0xa898('0xf6')},_0x2b5c72));}});return db[_0xa898('0xf1')][_0xa898('0x81')](_0x449c2b[_0xa898('0xc2')](_0x3add47),{'individualHooks':!![]});}})['then'](function(){if(_0x447362){return _0x447362['update']({'online':!![],'lastLoginAt':moment()['format'](_0xa898('0xf2')),'voicePause':_0x447362[_0xa898('0x98')]||![],'mailPause':_0x447362['loginInPause']||![],'chatPause':_0x447362['loginInPause']||![],'faxPause':_0x447362['loginInPause']||![],'smsPause':_0x447362['loginInPause']||![],'openchannelPause':_0x447362['loginInPause']||![],'whatsappPause':_0x447362[_0xa898('0x98')]||![],'pauseType':_0x447362[_0xa898('0x98')]?_0xa898('0xf6'):null,'interface':_0x3305dd,'lastPauseAt':moment()[_0xa898('0xa7')](_0xa898('0xf2'))});}})[_0xa898('0x21')](function(_0x3c379c){if(_0x3eb78b['isMiddleware']){return _0x1ca280();}else{return Promise[_0xa898('0xf7')](_0x3c379c)[_0xa898('0x21')](respondWithResult(_0x58d4c3,null));}})[_0xa898('0x52')](handleError(_0x58d4c3,null));};exports[_0xa898('0xf8')]=function(_0x1f9185,_0x4c80e2){var _0x3edee9;return db['User']['find']({'where':{'id':_0x1f9185[_0xa898('0x54')]['id'],'role':_0xa898('0x27')},'attributes':['id',_0xa898('0x31'),_0xa898('0x1d')]})['then'](handleEntityNotFound(_0x4c80e2,null))[_0xa898('0x21')](function(_0xcdc236){if(_0xcdc236){_0x3edee9=_0xcdc236;return db[_0xa898('0xa9')][_0xa898('0x20')]({'where':{'membername':_0x3edee9[_0xa898('0x31')]},'individualHooks':!![]});}})[_0xa898('0x21')](function(){return db[_0xa898('0xf1')][_0xa898('0x48')]({'where':{'membername':_0x3edee9[_0xa898('0x31')],'exitAt':null}});})['then'](function(_0x55d494){var _0x2bf181=[];_0x55d494[_0xa898('0xf9')](function(_0x1ad907){_0x2bf181[_0xa898('0x47')](_0x1ad907[_0xa898('0x1c')]({'exitAt':moment()[_0xa898('0xa7')](_0xa898('0xf2'))}));});return Promise['all'](_0x2bf181);})['then'](function(){return _0x3edee9['update']({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0xa898('0x21')](respondWithResult(_0x4c80e2,null))['catch'](handleError(_0x4c80e2,null));};exports[_0xa898('0xfa')]=function(_0x27d79b,_0x359fa0){var _0x4f095b;return db['UserVoiceQueueRt'][_0xa898('0x1c')]({'paused':0x1},{'where':{'UserId':_0x27d79b['params']['id']},'individualHooks':!![]})[_0xa898('0x21')](function(){return db[_0xa898('0x33')][_0xa898('0x2d')]({'where':{'id':_0x27d79b[_0xa898('0x54')]['id'],'role':'agent'},'attributes':['id','name',_0xa898('0x1d'),_0xa898('0x5b'),_0xa898('0x9a'),_0xa898('0x97')]});})[_0xa898('0x21')](handleEntityNotFound(_0x359fa0,null))[_0xa898('0x21')](function(_0x236775){if(_0x236775){_0x4f095b=_0x236775;return db[_0xa898('0xf1')][_0xa898('0x48')]({'where':{'membername':_0x4f095b[_0xa898('0x31')],'type':_0xa898('0xf5'),'exitAt':null}});}})[_0xa898('0x21')](function(_0x6204e3){if(_0x6204e3[_0xa898('0x63')]){var _0x22b8ef=moment()[_0xa898('0xa7')](_0xa898('0xf2'));for(var _0x5d6570=0x0,_0x24efd6=_0x6204e3[_0xa898('0x63')];_0x5d6570<_0x24efd6;_0x5d6570++){_0x6204e3[_0x5d6570][_0xa898('0xfb')]({'exitAt':_0x22b8ef});}}})[_0xa898('0x21')](function(){var _0x24ea18=[];var _0x4747d1=utils['getChannels']();_0x4747d1[_0xa898('0xf9')](function(_0x1ac4d2){_0x24ea18[_0xa898('0x47')]({'channel':_0x1ac4d2,'membername':_0x4f095b['name'],'interface':_[_0xa898('0x60')](_0x4f095b[_0xa898('0x9a')])?util[_0xa898('0xa7')](_0xa898('0xa8'),_0x4f095b[_0xa898('0x31')]):_0x4f095b[_0xa898('0x9a')],'type':_0xa898('0xf5'),'enterAt':moment()[_0xa898('0xa7')](_0xa898('0xf2')),'data1':_0x27d79b[_0xa898('0x57')][_0xa898('0xfc')]||_0xa898('0xfd'),'role':_0x4f095b[_0xa898('0x1d')],'internal':_0x4f095b[_0xa898('0x5b')]});});return db[_0xa898('0xf1')][_0xa898('0x81')](_0x24ea18,{'individualHooks':!![]});})['then'](function(){return _0x4f095b['update']({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x27d79b[_0xa898('0x57')][_0xa898('0xfc')]||_0xa898('0xfd'),'lastPauseAt':moment()[_0xa898('0xa7')](_0xa898('0xf2'))});})['then'](respondWithResult(_0x359fa0,null))['catch'](handleError(_0x359fa0,null));};exports['unpause']=function(_0x390600,_0x211110){if(_0x390600[_0xa898('0x57')][_0xa898('0x96')]&&!utils[_0xa898('0x9b')](_0x390600[_0xa898('0x57')][_0xa898('0x96')])){throw new APIBadRequestError(util[_0xa898('0xa7')]('Channel\x20parameter\x20%s\x20is\x20invalid',_0x390600[_0xa898('0x57')][_0xa898('0x96')]));}return db[_0xa898('0x33')][_0xa898('0x2d')]({'where':{'id':_0x390600['params']['id']},'attributes':['id','name',_0xa898('0x1d'),_0xa898('0x5b'),_0xa898('0x9a'),'online',_0xa898('0x99'),_0xa898('0xfe'),_0xa898('0xff'),_0xa898('0x100'),_0xa898('0x101'),_0xa898('0x102'),_0xa898('0x103'),_0xa898('0x104'),_0xa898('0x105')]})[_0xa898('0x21')](function(_0x13e43){if(!_0x13e43){throw new APINotFoundError(util[_0xa898('0xa7')](_0xa898('0xc4'),_0x390600[_0xa898('0x54')]['id']));}return _0x13e43['unpause'](_0x390600[_0xa898('0x57')][_0xa898('0x96')]);})[_0xa898('0x21')](respondWithResult(_0x211110,null))[_0xa898('0x52')](APIHandleError(_0x211110));};exports[_0xa898('0x106')]=function(_0x528792,_0x4e3464){var _0x382a9e={};var _0x3a8bd0={};var _0x3b9fcb;var _0x2f5a32;return db[_0xa898('0x33')][_0xa898('0x90')]({'where':{'id':_0x528792['params']['id']}})[_0xa898('0x21')](handleEntityNotFound(_0x4e3464,null))['then'](function(_0x2c05f9){if(_0x2c05f9){_0x3b9fcb=_0x2c05f9;_0x3a8bd0[_0xa898('0xcb')]=_['keys'](db[_0xa898('0x107')][_0xa898('0x34')]);_0x3a8bd0[_0xa898('0x40')]=_[_0xa898('0xcd')](_0x528792[_0xa898('0x40')]);_0x3a8bd0[_0xa898('0xce')]=_[_0xa898('0xcf')](_0x3a8bd0[_0xa898('0xcb')],_0x3a8bd0[_0xa898('0x40')]);_0x382a9e[_0xa898('0x46')]=_[_0xa898('0xcf')](_0x3a8bd0[_0xa898('0xcb')],qs[_0xa898('0xd0')](_0x528792[_0xa898('0x40')][_0xa898('0xd0')]));_0x382a9e[_0xa898('0x46')]=_0x382a9e[_0xa898('0x46')][_0xa898('0x63')]?_0x382a9e[_0xa898('0x46')]:_0x3a8bd0[_0xa898('0xcb')];_0x382a9e['order']=qs[_0xa898('0xd2')](_0x528792[_0xa898('0x40')][_0xa898('0xd2')]);_0x382a9e[_0xa898('0x3f')]=qs[_0xa898('0xce')](_['pick'](_0x528792[_0xa898('0x40')],_0x3a8bd0[_0xa898('0xce')]));if(_0x528792[_0xa898('0x40')][_0xa898('0x37')]){_0x382a9e['where']=_[_0xa898('0x55')](_0x382a9e[_0xa898('0x3f')],{'$or':_[_0xa898('0x2b')](_0x382a9e[_0xa898('0x46')],function(_0xd83c2b){var _0x14ce98={};_0x14ce98[_0xd83c2b]={'$like':'%'+_0x528792[_0xa898('0x40')][_0xa898('0x37')]+'%'};return _0x14ce98;})});}_0x382a9e=_[_0xa898('0x55')]({},_0x382a9e,_0x528792[_0xa898('0x56')]);return _0x3b9fcb[_0xa898('0x106')](_0x382a9e);}})['then'](function(_0x17106e){if(_0x17106e){_0x2f5a32=_0x17106e[_0xa898('0x63')];if(!_0x528792[_0xa898('0x40')][_0xa898('0xc5')]('nolimit')){_0x382a9e['limit']=qs['limit'](_0x528792[_0xa898('0x40')][_0xa898('0x19')]);_0x382a9e['offset']=qs['offset'](_0x528792[_0xa898('0x40')][_0xa898('0x17')]);}return _0x3b9fcb['getTeams'](_0x382a9e);}})[_0xa898('0x21')](function(_0x318f66){if(_0x318f66){return _0x318f66?{'count':_0x2f5a32,'rows':_0x318f66}:null;}})[_0xa898('0x21')](respondWithResult(_0x4e3464,null))[_0xa898('0x52')](handleError(_0x4e3464,null));};exports[_0xa898('0x108')]=function(_0x1e32c9,_0x1c22a4){var _0x40cea4=_0x1e32c9[_0xa898('0x54')]['id'];var _0x36b90a=_0x1e32c9[_0xa898('0x57')]?_0x1e32c9[_0xa898('0x57')][_0xa898('0x59')]:null;var _0x9ef97a=[];return Promise[_0xa898('0xf7')]()['then'](function(){if(!_0x36b90a)throw new APIBadRequestError(_0xa898('0x109'));})[_0xa898('0x21')](function(){return db['User'][_0xa898('0x90')]({'where':{'id':_0x40cea4}});})[_0xa898('0x21')](function(_0x2fe81d){if(!_0x2fe81d)throw new APINotFoundError(util[_0xa898('0xa7')]('User\x20with\x20id\x20%s\x20not\x20found',_0x1e32c9[_0xa898('0x54')]['id']));return db['sequelize']['transaction'](function(_0x13e820){return _0x2fe81d[_0xa898('0x108')](_0x36b90a,{'transaction':_0x13e820})[_0xa898('0x21')](function(){return db[_0xa898('0x107')][_0xa898('0x48')]({'where':{'id':{'$in':_0x36b90a}}});})[_0xa898('0x21')](function(_0x414e4f){var _0x17ba08=_[_0xa898('0x2b')](_0x414e4f,function(_0x9a71bc){return _0x9a71bc['getAssociatedQueues']();});return Promise[_0xa898('0x51')](_0x17ba08);})['then'](function(_0x5e5ff3){_0x9ef97a=_[_0xa898('0x10a')](_0x5e5ff3);var _0x10a1c0=_['map'](_0x9ef97a,function(_0x126bc1){return _0x126bc1[_0xa898('0x10b')](_0x2fe81d['id'],{'transaction':_0x13e820});});return Promise[_0xa898('0x51')](_0x10a1c0);})[_0xa898('0x21')](function(){if(!_0x2fe81d[_0xa898('0x97')])return;var _0x47cbfb=_[_0xa898('0x37')](_0x9ef97a,function(_0x4e09ff){return _0x4e09ff[_0xa898('0x10c')](_0xa898('0x96'))===_0xa898('0x10d');});var _0x4b7df=_[_0xa898('0x2b')](_0x47cbfb,function(_0x3dd1ea){return db[_0xa898('0xa9')][_0xa898('0xaa')]({'membername':_0x2fe81d[_0xa898('0x31')],'UserId':_0x2fe81d['id'],'queue_name':_0x3dd1ea['name'],'VoiceQueueId':_0x3dd1ea['id'],'interface':_[_0xa898('0x60')](_0x2fe81d['interface'])?util[_0xa898('0xa7')]('SIP/%s',_0x2fe81d['name']):_0x2fe81d['interface'],'paused':_0x2fe81d[_0xa898('0x99')]||![],'penalty':_0x2fe81d[_0xa898('0xa0')]},{'transaction':_0x13e820});});return Promise[_0xa898('0x51')](_0x4b7df);})[_0xa898('0x21')](function(){return db['TeamVoicePrefix']['findAll']({'where':{'teamId':{'$in':_0x36b90a}}});})[_0xa898('0x21')](function(_0x37617f){var _0x57651f=_[_0xa898('0x2b')](_0x37617f,function(_0x3efb67){return db[_0xa898('0x10e')][_0xa898('0x77')]({'UserId':_0x2fe81d['id'],'VoicePrefixId':_0x3efb67[_0xa898('0x10f')]},{'transaction':_0x13e820});});return Promise[_0xa898('0x51')](_0x57651f);});});})[_0xa898('0x21')](function(){for(var _0x1584a6=0x0;_0x1584a6<_0x9ef97a[_0xa898('0x63')];_0x1584a6++){var _0xbe68fc=_0x9ef97a[_0x1584a6][_0xa898('0x10c')](_0xa898('0x96'));var _0x4f8e31=_0xbe68fc+_0xa898('0xa2');socket[_0xa898('0x1e')](_0xa898('0x25')+_0xbe68fc+_0xa898('0xa4'),{'UserId':_0x40cea4,['queueField']:_0x9ef97a[_0x1584a6]['id']});}})[_0xa898('0x21')](respondWithStatusCode(_0x1c22a4,null))[_0xa898('0x52')](APIHandleError(_0x1c22a4));};exports['removeTeams']=function(_0x337415,_0x1a157f){var _0x2bc387=_0x337415[_0xa898('0x54')]['id'];var _0x3ddfc5=null;if(_0x337415[_0xa898('0x40')][_0xa898('0x59')]){_0x3ddfc5=_[_0xa898('0xac')](_0x337415[_0xa898('0x40')][_0xa898('0x59')])?_0x337415[_0xa898('0x40')][_0xa898('0x59')]:[_0x337415[_0xa898('0x40')]['ids']];}var _0x568805=[];return Promise['resolve']()[_0xa898('0x21')](function(){if(!_0x3ddfc5)throw new APIBadRequestError('Query\x20parameter\x20\x27ids\x27\x20is\x20required');})[_0xa898('0x21')](function(){return db[_0xa898('0x33')][_0xa898('0x90')]({'where':{'id':_0x2bc387}});})[_0xa898('0x21')](function(_0x444b79){if(!_0x444b79)throw new APINotFoundError(util[_0xa898('0xa7')](_0xa898('0xc4'),_0x337415[_0xa898('0x54')]['id']));return db[_0xa898('0x62')]['transaction'](function(_0x135096){return _0x444b79['removeTeams'](_0x3ddfc5,{'transaction':_0x135096})['then'](function(){return db[_0xa898('0x107')][_0xa898('0x48')]({'where':{'id':{'$in':_0x3ddfc5}}});})['then'](function(_0x5088b0){var _0xc9e24f=_[_0xa898('0x2b')](_0x5088b0,function(_0x272f9c){return _0x272f9c['getAssociatedQueues']();});return Promise[_0xa898('0x51')](_0xc9e24f);})[_0xa898('0x21')](function(_0x1c593b){_0x568805=_[_0xa898('0x10a')](_0x1c593b);var _0x185a30=_[_0xa898('0x2b')](_0x568805,function(_0x414a5b){return _0x414a5b['removeAgent'](_0x444b79['id'],{'transaction':_0x135096});});return Promise[_0xa898('0x51')](_0x185a30);})[_0xa898('0x21')](function(){if(!_0x444b79[_0xa898('0x97')])return;var _0x10cc15=_[_0xa898('0x37')](_0x568805,function(_0x378b3f){return _0x378b3f['getDataValue'](_0xa898('0x96'))===_0xa898('0x10d');});var _0x290bef=_[_0xa898('0x2b')](_0x10cc15,function(_0x34c16d){return db['UserVoiceQueueRt'][_0xa898('0x20')]({'where':{'VoiceQueueId':_0x34c16d['id'],'UserId':_0x444b79['id']},'transaction':_0x135096});});return Promise[_0xa898('0x51')](_0x290bef);})[_0xa898('0x21')](function(){return db['TeamVoicePrefix']['findAll']({'where':{'teamId':{'$in':_0x3ddfc5}}});})['then'](function(_0x46854a){var _0x28d8d1=_['map'](_0x46854a,function(_0x548cc1){return db[_0xa898('0x10e')][_0xa898('0x20')]({'where':{'UserId':_0x444b79['id'],'VoicePrefixId':_0x548cc1['VoicePrefixId']}},{'transaction':_0x135096});});return Promise[_0xa898('0x51')](_0x28d8d1);});});})[_0xa898('0x21')](function(){for(var _0x4d55c6=0x0;_0x4d55c6<_0x568805[_0xa898('0x63')];_0x4d55c6++){var _0x4d2748=_0x568805[_0x4d55c6][_0xa898('0x10c')](_0xa898('0x96'));var _0x572d03=_0x4d2748+_0xa898('0xa2');socket[_0xa898('0x1e')](_0xa898('0x25')+_0x4d2748+'Queue:remove',{'UserId':_0x2bc387,['queueField']:_0x568805[_0x4d55c6]['id']});}})['then'](respondWithStatusCode(_0x1a157f,null))[_0xa898('0x52')](APIHandleError(_0x1a157f));};exports[_0xa898('0x110')]=function(_0x1728b7,_0x20730c){var _0x226a2c={};var _0x1a2fe6={};var _0x21e6a9;var _0x5e9e45;return db[_0xa898('0x33')][_0xa898('0x90')]({'where':{'id':_0x1728b7[_0xa898('0x54')]['id']}})[_0xa898('0x21')](handleEntityNotFound(_0x20730c,null))[_0xa898('0x21')](function(_0xda2378){if(_0xda2378){_0x21e6a9=_0xda2378;_0x1a2fe6[_0xa898('0xcb')]=_['keys'](db[_0xa898('0xc6')][_0xa898('0x34')]);_0x1a2fe6[_0xa898('0x40')]=_[_0xa898('0xcd')](_0x1728b7['query']);_0x1a2fe6[_0xa898('0xce')]=_[_0xa898('0xcf')](_0x1a2fe6[_0xa898('0xcb')],_0x1a2fe6[_0xa898('0x40')]);_0x226a2c[_0xa898('0x46')]=_['intersection'](_0x1a2fe6[_0xa898('0xcb')],qs[_0xa898('0xd0')](_0x1728b7[_0xa898('0x40')][_0xa898('0xd0')]));_0x226a2c['attributes']=_0x226a2c['attributes'][_0xa898('0x63')]?_0x226a2c[_0xa898('0x46')]:_0x1a2fe6[_0xa898('0xcb')];_0x226a2c[_0xa898('0xd1')]=qs[_0xa898('0xd2')](_0x1728b7[_0xa898('0x40')][_0xa898('0xd2')]);_0x226a2c[_0xa898('0x3f')]=qs[_0xa898('0xce')](_[_0xa898('0xd3')](_0x1728b7[_0xa898('0x40')],_0x1a2fe6[_0xa898('0xce')]));if(_0x1728b7['query']['filter']){_0x226a2c[_0xa898('0x3f')]=_[_0xa898('0x55')](_0x226a2c[_0xa898('0x3f')],{'$or':_[_0xa898('0x2b')](_0x226a2c[_0xa898('0x46')],function(_0x439fbe){var _0x4659dc={};_0x4659dc[_0x439fbe]={'$like':'%'+_0x1728b7['query']['filter']+'%'};return _0x4659dc;})});}_0x226a2c=_[_0xa898('0x55')]({},_0x226a2c,_0x1728b7[_0xa898('0x56')]);return _0x21e6a9[_0xa898('0x110')](_0x226a2c);}})[_0xa898('0x21')](function(_0x2d2dc8){if(_0x2d2dc8){_0x5e9e45=_0x2d2dc8[_0xa898('0x63')];if(!_0x1728b7[_0xa898('0x40')][_0xa898('0xc5')](_0xa898('0xd5'))){_0x226a2c['limit']=qs['limit'](_0x1728b7[_0xa898('0x40')]['limit']);_0x226a2c[_0xa898('0x17')]=qs['offset'](_0x1728b7[_0xa898('0x40')]['offset']);}return _0x21e6a9[_0xa898('0x110')](_0x226a2c);}})[_0xa898('0x21')](function(_0x1723c9){if(_0x1723c9){return _0x1723c9?{'count':_0x5e9e45,'rows':_0x1723c9}:null;}})['then'](respondWithResult(_0x20730c,null))[_0xa898('0x52')](handleError(_0x20730c,null));};exports['getAgents']=function(_0x15bc91,_0x5503a3){var _0x19e09c={};var _0x2c47f8={};var _0x8b6184;return db['User'][_0xa898('0x90')]({'where':{'id':_0x15bc91[_0xa898('0x54')]['id']}})[_0xa898('0x21')](handleEntityNotFound(_0x5503a3,null))[_0xa898('0x21')](function(_0x4bb1ca){if(_0x4bb1ca){_0x8b6184=_0x4bb1ca;_0x2c47f8[_0xa898('0xcb')]=_[_0xa898('0xcd')](db['User'][_0xa898('0x34')]);_0x2c47f8[_0xa898('0x40')]=_[_0xa898('0xcd')](_0x15bc91[_0xa898('0x40')]);_0x2c47f8['filters']=_[_0xa898('0xcf')](_0x2c47f8[_0xa898('0xcb')],_0x2c47f8[_0xa898('0x40')]);_0x19e09c[_0xa898('0x46')]=_['intersection'](_0x2c47f8[_0xa898('0xcb')],qs[_0xa898('0xd0')](_0x15bc91['query']['fields']));_0x19e09c['attributes']=_0x19e09c[_0xa898('0x46')][_0xa898('0x63')]?_0x19e09c[_0xa898('0x46')]:_0x2c47f8[_0xa898('0xcb')];_0x19e09c['order']=qs[_0xa898('0xd2')](_0x15bc91[_0xa898('0x40')]['sort']);_0x19e09c['where']=qs[_0xa898('0xce')](_['pick'](_0x15bc91['query'],_0x2c47f8[_0xa898('0xce')]));if(_0x15bc91['query'][_0xa898('0x37')]){_0x19e09c['where']=_[_0xa898('0x55')](_0x19e09c[_0xa898('0x3f')],{'$or':_[_0xa898('0x2b')](_0x19e09c[_0xa898('0x46')],function(_0x320457){var _0x47aa9c={};_0x47aa9c[_0x320457]={'$like':'%'+_0x15bc91[_0xa898('0x40')][_0xa898('0x37')]+'%'};return _0x47aa9c;})});}_0x19e09c[_0xa898('0xcb')]=db[_0xa898('0x33')];_0x19e09c['as']=_0xa898('0x26');_0x19e09c=_[_0xa898('0x55')]({},_0x19e09c,_0x15bc91[_0xa898('0x56')]);return _0x8b6184['getVoiceQueues']({'include':[_0x19e09c]});}})['then'](function(_0x156811){if(_0x156811){var _0xce9d38={},_0x3cffca=[];for(var _0x424193=0x0;_0x424193<_0x156811[_0xa898('0x63')];_0x424193+=0x1){for(var _0x981e7b=0x0,_0x20a9b5;_0x981e7b<_0x156811[_0x424193][_0xa898('0x26')]['length'];_0x981e7b+=0x1){_0x20a9b5=_0x156811[_0x424193][_0xa898('0x26')][_0x981e7b][_0xa898('0x22')]({'plain':!![]});_0xce9d38[_0x20a9b5['id']]=_0x20a9b5;}}_0xce9d38=_[_0xa898('0x111')](_0xce9d38);for(var _0x12327c=qs[_0xa898('0x17')](_0x15bc91[_0xa898('0x40')]['offset']);_0x12327c<_0xce9d38[_0xa898('0x63')]&&_0x3cffca['length']=_0x197a2a){_0x201323=_0x197a2a;_0x30ae81=0xc8;}else{_0x30ae81=0xce;}_0x3754a9[_0x3bd0('0x14')](_0x30ae81);return _0x3754a9[_0x3bd0('0x1a')]('Content-Range',_0x1aa0e5+'-'+_0x201323+'/'+_0x197a2a)[_0x3bd0('0x16')](_0x459462);}return null;};}function saveUpdates(_0x29b69b){return function(_0x22d9b8){if(_0x22d9b8){return _0x22d9b8['update'](_0x29b69b)[_0x3bd0('0x1b')](function(_0x5946c4){if(_0x5946c4[_0x3bd0('0x1c')]===_0x3bd0('0x1d')){socket[_0x3bd0('0x1e')](_0x3bd0('0x1f')+_0x5946c4['id'],_0x5946c4);}return _0x5946c4;});}return null;};}function removeEntity(_0x2476c8){return function(_0x1688a2){if(_0x1688a2){return _0x1688a2[_0x3bd0('0x20')]()[_0x3bd0('0x1b')](function(){var _0x47c589=_0x1688a2[_0x3bd0('0x21')]({'plain':!![]});if(_0x47c589[_0x3bd0('0x1c')]===_0x3bd0('0x22'))return;var _0x2ba955=[{'name':'Users','value':_0x3bd0('0x23'),'ignore':!![]},{'name':_0x3bd0('0x24'),'value':_0x3bd0('0x1d'),'ignore':![]},{'name':_0x3bd0('0x25'),'value':_0x3bd0('0x26'),'ignore':![]}];var _0x37feaf=_(_0x2ba955)[_0x3bd0('0x27')](_0x3bd0('0x28'))['map'](_0x3bd0('0x29'))[_0x3bd0('0x29')]();if(_[_0x3bd0('0x2a')](_0x37feaf,_0x47c589['role'])){return;}var _0x3b3f09=_[_0x3bd0('0x2b')](_0x2ba955,['value',_0x47c589[_0x3bd0('0x1c')]])[_0x3bd0('0x2c')];return db['UserProfileResource'][_0x3bd0('0x20')]({'where':{'type':_0x3b3f09,'resourceId':_0x47c589['id']}})['then'](function(){return _0x1688a2;});})[_0x3bd0('0x1b')](function(){_0x2476c8[_0x3bd0('0x14')](0xcc)[_0x3bd0('0x15')]();});}};}function handleEntityNotFound(_0x5a2b7c){return function(_0x333372){if(!_0x333372){_0x5a2b7c['sendStatus'](0x194);}return _0x333372;};}function handleError(_0x5eefec,_0x268242){_0x268242=_0x268242||0x1f4;return function(_0x4fe0bb){logger[_0x3bd0('0x2d')](_0x4fe0bb[_0x3bd0('0x2e')]);if(_0x4fe0bb[_0x3bd0('0x2c')]){delete _0x4fe0bb['name'];}_0x5eefec[_0x3bd0('0x14')](_0x268242)[_0x3bd0('0x2f')](_0x4fe0bb);};}function getUserAttributes(){return _(db[_0x3bd0('0x30')][_0x3bd0('0x31')])[_0x3bd0('0x32')](function(_0x3f51b1){return{'name':_0x3f51b1[_0x3bd0('0x33')],'type':_0x3f51b1[_0x3bd0('0x34')][_0x3bd0('0x35')]};})['filter'](function(_0x3f0b98){return![_0x3bd0('0x36'),_0x3bd0('0x37'),_0x3bd0('0x38'),_0x3bd0('0x39'),_0x3bd0('0x3a'),_0x3bd0('0x3b')][_0x3bd0('0x2a')](_0x3f0b98[_0x3bd0('0x2c')]);})[_0x3bd0('0x29')]();}exports['index']=function(_0x3d52a1,_0x3c896e){var _0x5412ab={},_0x418d39={'count':0x0,'rows':[]};var _0x2e7016=getUserAttributes();_0x5412ab=qs[_0x3bd0('0x3c')](_0x2e7016,_0x3d52a1);var _0x97b9ed={'where':_0x5412ab[_0x3bd0('0x3d')]};return db[_0x3bd0('0x30')]['count'](_0x97b9ed)[_0x3bd0('0x1b')](function(_0x4edced){_0x418d39['count']=_0x4edced;if(_0x3d52a1[_0x3bd0('0x3e')][_0x3bd0('0x3f')]){_0x5412ab[_0x3bd0('0x40')]=[{'all':!![]}];}if(_0x3d52a1[_0x3bd0('0x3e')]['userSetting']===_0x3bd0('0x41')){_0x5412ab[_0x3bd0('0x40')]=[{'model':db[_0x3bd0('0x42')],'as':_0x3bd0('0x43')}];}if(!_[_0x3bd0('0x2a')](_0x5412ab[_0x3bd0('0x44')],'id')){_0x5412ab[_0x3bd0('0x44')][_0x3bd0('0x45')]('id');}return db[_0x3bd0('0x30')]['findAll'](_0x5412ab);})[_0x3bd0('0x1b')](function(_0x5f151b){_0x418d39[_0x3bd0('0x46')]=_0x5f151b;if(_0x3d52a1[_0x3bd0('0x3e')][_0x3bd0('0x47')]===_0x3bd0('0x41')){var _0x537061=[];for(var _0x2a2056=0x0;_0x2a2056<_0x418d39[_0x3bd0('0x46')][_0x3bd0('0x48')];_0x2a2056++){_0x537061[_0x3bd0('0x45')](get_open_tabs(_0x3bd0('0x49'),_0x418d39[_0x3bd0('0x46')][_0x2a2056][_0x3bd0('0x4a')]));_0x537061[_0x3bd0('0x45')](get_open_tabs('sms',_0x418d39[_0x3bd0('0x46')][_0x2a2056][_0x3bd0('0x4a')]));_0x537061[_0x3bd0('0x45')](get_open_tabs(_0x3bd0('0x4b'),_0x418d39[_0x3bd0('0x46')][_0x2a2056][_0x3bd0('0x4a')]));_0x537061[_0x3bd0('0x45')](get_open_tabs(_0x3bd0('0x4c'),_0x418d39[_0x3bd0('0x46')][_0x2a2056][_0x3bd0('0x4a')]));_0x537061['push'](get_open_tabs(_0x3bd0('0x4d'),_0x418d39[_0x3bd0('0x46')][_0x2a2056][_0x3bd0('0x4a')]));_0x537061[_0x3bd0('0x45')](get_open_tabs(_0x3bd0('0x4e'),_0x418d39[_0x3bd0('0x46')][_0x2a2056][_0x3bd0('0x4a')]));}return Promise[_0x3bd0('0x4f')](_0x537061)[_0x3bd0('0x1b')](function(){return _0x418d39;});}else{return _0x418d39;}})['then'](respondWithFilteredResult(_0x3c896e,_0x5412ab))[_0x3bd0('0x50')](handleError(_0x3c896e,null));};exports[_0x3bd0('0x51')]=function(_0x2fad79,_0x3192b2){var _0x189bfd=getUserAttributes();_0x2fad79[_0x3bd0('0x3e')]['id']=_0x2fad79['params']['id'];var _0x338b98=qs[_0x3bd0('0x3c')](_0x189bfd,_0x2fad79);if(_0x2fad79[_0x3bd0('0x3e')][_0x3bd0('0x3f')]){_0x338b98[_0x3bd0('0x40')]=[{'all':!![]}];}if(_0x2fad79[_0x3bd0('0x3e')][_0x3bd0('0x43')]===_0x3bd0('0x41')){_0x338b98[_0x3bd0('0x40')]=[{'model':db[_0x3bd0('0x42')],'as':_0x3bd0('0x43')}];}_0x338b98=_[_0x3bd0('0x52')]({},_0x338b98,_0x2fad79['options']);if(!_[_0x3bd0('0x2a')](_0x338b98['attributes'],'id')){_0x338b98[_0x3bd0('0x44')][_0x3bd0('0x45')]('id');}return db[_0x3bd0('0x30')][_0x3bd0('0x2b')](_0x338b98)['then'](handleEntityNotFound(_0x3192b2,null))[_0x3bd0('0x1b')](function(_0x3e213a){var _0x352442=[];values=_0x3e213a;if(_0x2fad79[_0x3bd0('0x3e')][_0x3bd0('0x47')]===_0x3bd0('0x41')){_0x352442[_0x3bd0('0x45')](get_open_tabs('chat',_0x3e213a['dataValues']));_0x352442[_0x3bd0('0x45')](get_open_tabs('sms',_0x3e213a[_0x3bd0('0x4a')]));_0x352442['push'](get_open_tabs(_0x3bd0('0x4d'),_0x3e213a[_0x3bd0('0x4a')]));_0x352442[_0x3bd0('0x45')](get_open_tabs('whatsapp',_0x3e213a[_0x3bd0('0x4a')]));_0x352442[_0x3bd0('0x45')](get_open_tabs(_0x3bd0('0x4b'),_0x3e213a[_0x3bd0('0x4a')]));_0x352442[_0x3bd0('0x45')](get_open_tabs(_0x3bd0('0x4c'),_0x3e213a[_0x3bd0('0x4a')]));return Promise[_0x3bd0('0x4f')](_0x352442);}else{return values;}})[_0x3bd0('0x1b')](function(){return values;})[_0x3bd0('0x1b')](respondWithResult(_0x3192b2,null))[_0x3bd0('0x50')](handleError(_0x3192b2,null));};exports[_0x3bd0('0x53')]=function(_0x8b6867,_0x24d1b3){if(_0x8b6867[_0x3bd0('0x54')]['id']){delete _0x8b6867[_0x3bd0('0x54')]['id'];}delete _0x8b6867[_0x3bd0('0x54')][_0x3bd0('0x1c')];return db[_0x3bd0('0x30')][_0x3bd0('0x2b')]({'where':{'id':_0x8b6867[_0x3bd0('0x55')]['id']}})[_0x3bd0('0x1b')](handleEntityNotFound(_0x24d1b3,null))[_0x3bd0('0x1b')](saveUpdates(_0x8b6867[_0x3bd0('0x54')],null))['then'](respondWithResult(_0x24d1b3,null))[_0x3bd0('0x50')](handleError(_0x24d1b3,null));};exports[_0x3bd0('0x56')]=function(_0x2bc4ba,_0x49e30b){return db['User'][_0x3bd0('0x56')]()[_0x3bd0('0x1b')](respondWithResult(_0x49e30b,null))[_0x3bd0('0x50')](handleError(_0x49e30b,null));};exports[_0x3bd0('0x57')]=function(_0x29c50b,_0x5463c9){return db[_0x3bd0('0x30')]['find']({'where':{'id':_0x29c50b['params']['id']}})['then'](handleEntityNotFound(_0x5463c9,null))['then'](function(_0x4b8d13){if(_0x4b8d13){return _0x4b8d13[_0x3bd0('0x57')](_0x29c50b[_0x3bd0('0x54')][_0x3bd0('0x58')],_[_0x3bd0('0x59')](_0x29c50b[_0x3bd0('0x54')],[_0x3bd0('0x58'),'id'])||{});}})[_0x3bd0('0x1b')](respondWithResult(_0x5463c9,null))[_0x3bd0('0x50')](handleError(_0x5463c9,null));};function validateUser(_0x1eed02){return new Promise(function(_0x112ae5,_0x38f103){if(_0x1eed02['internal'])return _0x112ae5(_0x1eed02);return db[_0x3bd0('0x5a')][_0x3bd0('0x5b')](0x1)[_0x3bd0('0x1b')](function(_0x19b33b){if(_0x19b33b[_0x3bd0('0x5c')])authService['validatePasswordPattern'](_0x1eed02['password']);db[_0x3bd0('0x30')][_0x3bd0('0x5d')](_0x3bd0('0x5e'))[_0x3bd0('0x1b')](function(_0x2eb87e){if(_['isNil'](_0x2eb87e)){_0x1eed02[_0x3bd0('0x5e')]=_0x19b33b[_0x3bd0('0x5f')]||0x1;return;}if(_[_0x3bd0('0x60')](_0x19b33b[_0x3bd0('0x5f')])||_0x19b33b[_0x3bd0('0x5f')]===_0x2eb87e){_0x1eed02[_0x3bd0('0x5e')]=_0x2eb87e+0x1;return;}if(_0x19b33b['min_internal']>_0x2eb87e){_0x1eed02[_0x3bd0('0x5e')]=_0x19b33b[_0x3bd0('0x5f')];return;}return db[_0x3bd0('0x61')][_0x3bd0('0x3e')](_0x3bd0('0x62'),{'type':db[_0x3bd0('0x61')]['QueryTypes'][_0x3bd0('0x63')]})[_0x3bd0('0x1b')](function(_0x531832){if(_0x531832&&_0x531832[_0x3bd0('0x48')]){for(var _0x594443=0x0,_0x4cb12d=_0x531832[_0x3bd0('0x48')];_0x594443<_0x4cb12d&&_[_0x3bd0('0x60')](_0x1eed02['internal']);_0x594443++){if(_0x19b33b[_0x3bd0('0x5f')]<=_0x531832[_0x594443]['from']){_0x1eed02[_0x3bd0('0x5e')]=_0x531832[_0x594443][_0x3bd0('0x64')];}else if(_0x19b33b[_0x3bd0('0x5f')]>_0x531832[_0x594443]['from']&&_0x19b33b['min_internal']<=_0x531832[_0x594443]['to']){_0x1eed02['internal']=_0x19b33b[_0x3bd0('0x5f')];}}}if(_[_0x3bd0('0x60')](_0x1eed02['internal'])){_0x1eed02[_0x3bd0('0x5e')]=_0x2eb87e+0x1;}return _0x112ae5(_0x1eed02);});});})[_0x3bd0('0x50')](function(_0x513e26){_0x38f103(_0x513e26);});});}function updateUser(_0x24e6b8){return new Promise(function(_0x724597,_0x50b990){try{if(_0x24e6b8[_0x3bd0('0x65')]){_0x24e6b8['mailbox']=_0x24e6b8['internal'];_0x24e6b8[_0x3bd0('0x66')]={'mailbox':_0x24e6b8['internal'],'password':_0x24e6b8[_0x3bd0('0x36')],'fullname':_0x24e6b8[_0x3bd0('0x67')],'email':_0x24e6b8[_0x3bd0('0x68')]};}if(_0x24e6b8['role']==='agent'){if(!_0x24e6b8[_0x3bd0('0x69')])_0x24e6b8[_0x3bd0('0x69')]=[_0x3bd0('0x6a'),_0x3bd0('0x6b'),_0x3bd0('0x6c'),_0x3bd0('0x6d'),'110',_0x3bd0('0x6e'),_0x3bd0('0x6f'),_0x3bd0('0x70'),'107','108',_0x3bd0('0x71'),_0x3bd0('0x72'),_0x3bd0('0x73'),_0x3bd0('0x74'),'115'];}_0x724597(_0x24e6b8);}catch(_0x4dae56){_0x50b990(_0x4dae56);}});}exports[_0x3bd0('0x75')]=function(_0x622012,_0x56bcc3){if(_0x622012[_0x3bd0('0x23')]['role']===_0x3bd0('0x1d'))throw new Error(_0x3bd0('0x76'));if(_0x622012[_0x3bd0('0x54')][_0x3bd0('0x1c')]===_0x3bd0('0x23')&&_0x622012[_0x3bd0('0x23')][_0x3bd0('0x1c')]!==_0x3bd0('0x22')){throw new Error(_0x3bd0('0x77'));}if(_0x622012[_0x3bd0('0x54')]['role']==='admin'&&_0x622012['user'][_0x3bd0('0x1c')]!==_0x3bd0('0x22')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator');}return licenseUtil[_0x3bd0('0x78')]([_0x622012[_0x3bd0('0x54')]])[_0x3bd0('0x1b')](function(){return validateUser(_0x622012[_0x3bd0('0x54')]);})[_0x3bd0('0x1b')](function(_0x518d23){return updateUser(_0x518d23)[_0x3bd0('0x1b')](function(_0x253112){if(_0x253112[_0x3bd0('0x1c')]===_0x3bd0('0x22')){_0x253112[_0x3bd0('0x79')]=_0x622012[_0x3bd0('0x23')][_0x3bd0('0x79')];delete _0x253112[_0x3bd0('0x7a')];}return _0x253112;});})[_0x3bd0('0x1b')](function(_0x52ed76){return db['User'][_0x3bd0('0x75')](_0x52ed76,{'include':[{'model':db[_0x3bd0('0x66')],'as':_0x3bd0('0x66')}]});})[_0x3bd0('0x1b')](function(_0x4bc45e){if(_0x622012['body']['role']===_0x3bd0('0x23'))return _0x4bc45e;if(_0x622012[_0x3bd0('0x23')][_0x3bd0('0x1c')]!==_0x3bd0('0x23'))return _0x4bc45e;return db[_0x3bd0('0x7b')][_0x3bd0('0x2b')]({'where':{'name':_0x4bc45e[_0x3bd0('0x1c')]==='agent'?_0x3bd0('0x24'):_0x3bd0('0x25'),'userProfileId':_0x622012[_0x3bd0('0x23')][_0x3bd0('0x7a')]},'raw':!![]})[_0x3bd0('0x1b')](function(_0x2c53c9){if(!_0x2c53c9||_0x2c53c9[_0x3bd0('0x7c')]!=0x0)return _0x4bc45e;return db[_0x3bd0('0x7d')]['create']({'name':_0x4bc45e['name'],'resourceId':_0x4bc45e['id'],'type':_0x2c53c9[_0x3bd0('0x2c')],'sectionId':_0x2c53c9['id']},{})['then'](function(){return _0x4bc45e;});})[_0x3bd0('0x50')](function(_0x561614){logger[_0x3bd0('0x2d')](_0x3bd0('0x7e'),_0x561614);throw _0x561614;});})[_0x3bd0('0x1b')](respondWithResult(_0x56bcc3,0xc9))[_0x3bd0('0x50')](handleError(_0x56bcc3,null));};exports[_0x3bd0('0x7f')]=function(_0x4dd6f6,_0xb1e7fa){var _0x43afc7=_0x4dd6f6[_0x3bd0('0x54')];var _0x1f1864=[];if(_0x4dd6f6[_0x3bd0('0x23')][_0x3bd0('0x1c')]===_0x3bd0('0x1d'))throw new Error(_0x3bd0('0x76'));if(_['some'](_0x43afc7,['role',_0x3bd0('0x23')])&&_0x4dd6f6[_0x3bd0('0x23')]['role']!=='admin'){throw new Error(_0x3bd0('0x77'));}if(_[_0x3bd0('0x80')](_0x43afc7,[_0x3bd0('0x1c'),_0x3bd0('0x22')])&&_0x4dd6f6[_0x3bd0('0x23')][_0x3bd0('0x1c')]!=='admin'){throw new Error(_0x3bd0('0x81'));}return licenseUtil[_0x3bd0('0x78')](_0x43afc7)['then'](function(){return validateUser(_0x43afc7[0x0]);})[_0x3bd0('0x1b')](function(){for(var _0x32ab97=0x1;_0x32ab97<_0x43afc7['length'];_0x32ab97++){var _0x53968c=_0x43afc7[_0x32ab97-0x1][_0x3bd0('0x5e')];if(!_0x43afc7[_0x32ab97][_0x3bd0('0x5e')])_0x43afc7[_0x32ab97][_0x3bd0('0x5e')]=_0x53968c+0x1;_0x1f1864[_0x3bd0('0x45')](validateUser(_0x43afc7[_0x32ab97]));}return Promise[_0x3bd0('0x4f')](_0x1f1864);})['then'](function(){_0x1f1864=[];for(var _0x5bf4f9=0x0;_0x5bf4f9<_0x43afc7[_0x3bd0('0x48')];_0x5bf4f9++){_0x1f1864[_0x3bd0('0x45')](updateUser(_0x43afc7[_0x5bf4f9]));}return Promise[_0x3bd0('0x4f')](_0x1f1864);})[_0x3bd0('0x1b')](function(){_0x1f1864=_0x43afc7['map'](function(_0x5aef6b){return db[_0x3bd0('0x30')][_0x3bd0('0x75')](_0x5aef6b,{'include':[{'model':db['VoiceMail'],'as':_0x3bd0('0x66')}]})[_0x3bd0('0x1b')](function(_0x559b1d){_0x5aef6b['id']=_0x559b1d['id'];return _0x5aef6b;});});return Promise[_0x3bd0('0x4f')](_0x1f1864);})['then'](function(_0x3bcf30){if(_0x4dd6f6['body'][_0x3bd0('0x1c')]===_0x3bd0('0x23'))return _0x3bcf30;if(_0x4dd6f6[_0x3bd0('0x23')][_0x3bd0('0x1c')]!=='user')return _0x3bcf30;var _0x370038=_[_0x3bd0('0x80')](_0x3bcf30,function(_0xd8f0b4){return _0xd8f0b4[_0x3bd0('0x1c')]==='agent'||_0xd8f0b4[_0x3bd0('0x1c')]===_0x3bd0('0x26');});if(!_0x370038)return _0x3bcf30;return db[_0x3bd0('0x7b')][_0x3bd0('0x82')]({'where':{'name':{'$or':[_0x3bd0('0x24'),'Telephones']},'userProfileId':_0x4dd6f6[_0x3bd0('0x23')][_0x3bd0('0x7a')]},'raw':!![]})[_0x3bd0('0x1b')](function(_0xbec164){if(_[_0x3bd0('0x83')](_0xbec164)||!_[_0x3bd0('0x80')](_0xbec164,['autoAssociation',0x0]))return _0x3bcf30;_0x1f1864=[];var _0x4460a8=_(_0xbec164)[_0x3bd0('0x32')](function(_0xfb530f){if(_0xfb530f[_0x3bd0('0x7c')]===0x1)return;return _0xfb530f['name']===_0x3bd0('0x24')?'agent':_0x3bd0('0x26');})['compact']()[_0x3bd0('0x29')]();for(var _0x4d3c76=0x0;_0x4d3c76<_0x3bcf30[_0x3bd0('0x48')];_0x4d3c76++){if(!_[_0x3bd0('0x2a')](_0x4460a8,_0x3bcf30[_0x4d3c76]['role']))return;var _0x1ec960=_0x3bcf30[_0x4d3c76][_0x3bd0('0x1c')]===_0x3bd0('0x1d')?_0x3bd0('0x24'):_0x3bd0('0x25');_0x1f1864[_0x3bd0('0x45')](db['UserProfileResource'][_0x3bd0('0x75')]({'name':_0x3bcf30[_0x4d3c76][_0x3bd0('0x2c')],'resourceId':_0x3bcf30[_0x4d3c76]['id'],'type':_0x1ec960,'sectionId':_[_0x3bd0('0x2b')](_0xbec164,[_0x3bd0('0x2c'),_0x1ec960])['id']},{}));}return Promise[_0x3bd0('0x4f')](_0x1f1864);});})[_0x3bd0('0x1b')](respondWithResult(_0xb1e7fa,0xc9))[_0x3bd0('0x50')](handleError(_0xb1e7fa,null));};exports[_0x3bd0('0x84')]=function(_0x5cbd25,_0x60754){if(_0x5cbd25[_0x3bd0('0x54')]['id']){delete _0x5cbd25[_0x3bd0('0x54')]['id'];}return db[_0x3bd0('0x30')][_0x3bd0('0x2b')]({'where':{'id':_0x5cbd25[_0x3bd0('0x55')]['id']}})[_0x3bd0('0x1b')](function(_0x56cc83){if(!_0x56cc83)return null;if(_0x56cc83['id']===_0x5cbd25[_0x3bd0('0x23')]['id']){if(!_0x5cbd25[_0x3bd0('0x54')][_0x3bd0('0x85')]||!_0x5cbd25[_0x3bd0('0x54')][_0x3bd0('0x86')]){throw new db[(_0x3bd0('0x87'))]['ValidationError'](_0x3bd0('0x88'));}if(!_0x56cc83['authenticate'](_0x5cbd25[_0x3bd0('0x54')]['oldPassword'])){throw new db[(_0x3bd0('0x87'))][(_0x3bd0('0x89'))]('Wrong\x20credentials');}if(_0x5cbd25[_0x3bd0('0x54')][_0x3bd0('0x85')]===_0x5cbd25[_0x3bd0('0x54')][_0x3bd0('0x86')]){throw new db['Sequelize'][(_0x3bd0('0x89'))](_0x3bd0('0x8a'));}}else if(_0x5cbd25[_0x3bd0('0x23')][_0x3bd0('0x1c')]===_0x3bd0('0x22')){if(!_0x5cbd25[_0x3bd0('0x54')][_0x3bd0('0x86')]){throw new db[(_0x3bd0('0x87'))][(_0x3bd0('0x89'))](_0x3bd0('0x8b'));}}else if(_0x5cbd25['user'][_0x3bd0('0x1c')]===_0x3bd0('0x23')){if(!_0x5cbd25[_0x3bd0('0x54')][_0x3bd0('0x86')]){throw new db['Sequelize'][(_0x3bd0('0x89'))](_0x3bd0('0x8b'));}if(_0x56cc83[_0x3bd0('0x1c')]!==_0x3bd0('0x1d')){throw new db['Sequelize']['ValidationError'](_0x3bd0('0x76'));}}else{throw new db[(_0x3bd0('0x87'))]['ValidationError'](_0x3bd0('0x76'));}return _0x56cc83;})[_0x3bd0('0x1b')](handleEntityNotFound(_0x60754,null))[_0x3bd0('0x1b')](function(_0x3eec6b){return db[_0x3bd0('0x5a')][_0x3bd0('0x8c')]({'attributes':['id',_0x3bd0('0x5c'),'enforcePasswordHistory',_0x3bd0('0x8d')]})[_0x3bd0('0x1b')](function(_0xfe6b12){if(_0xfe6b12[_0x3bd0('0x5c')])authService[_0x3bd0('0x8e')](_0x5cbd25[_0x3bd0('0x54')]['newPassword']);if(!_0xfe6b12[_0x3bd0('0x8f')]||!_0x3eec6b[_0x3bd0('0x38')])return _0x3eec6b;authService[_0x3bd0('0x90')](_0x5cbd25[_0x3bd0('0x54')][_0x3bd0('0x86')],_0x3eec6b[_0x3bd0('0x38')],_0xfe6b12[_0x3bd0('0x8d')]);return _0x3eec6b;})['then'](saveUpdates({'password':_0x5cbd25['body'][_0x3bd0('0x86')],'passwordResetAt':_0x5cbd25[_0x3bd0('0x23')]['id']==_0x5cbd25[_0x3bd0('0x55')]['id']?moment():null,'previousPasswords':authService[_0x3bd0('0x91')](_0x5cbd25[_0x3bd0('0x54')]['newPassword'],_0x3eec6b[_0x3bd0('0x38')])},null));})[_0x3bd0('0x1b')](respondWithResult(_0x60754,null))[_0x3bd0('0x50')](handleError(_0x60754,null));};exports[_0x3bd0('0x92')]=function(_0x4201e6,_0x51ed02){var _0x122d02=_0x4201e6['body'][_0x3bd0('0x93')];return db[_0x3bd0('0x30')]['find']({'where':{'id':_0x4201e6[_0x3bd0('0x55')]['id']},'attributes':['id',_0x3bd0('0x2c'),'role','online',_0x3bd0('0x94'),_0x3bd0('0x95'),'interface']})['then'](handleEntityNotFound(_0x51ed02,null))[_0x3bd0('0x1b')](function(_0x2a75d5){if(_0x2a75d5){if(!utils[_0x3bd0('0x96')](_0x122d02)){throw new db[(_0x3bd0('0x87'))][(_0x3bd0('0x89'))](_0x3bd0('0x97'));}return _0x2a75d5[_0x3bd0('0x98')+_['capitalize'](_0x122d02[_0x3bd0('0x99')]())+_0x3bd0('0x9a')](_0x4201e6[_0x3bd0('0x54')]['ids'],{'penalty':_0x4201e6[_0x3bd0('0x54')]['penalty']||0x0})[_0x3bd0('0x9b')](function(_0x1b773a){for(var _0x1d0577=0x0;_0x1d0577<_0x4201e6['body'][_0x3bd0('0x58')][_0x3bd0('0x48')];_0x1d0577+=0x1){var _0x49ef5f={'UserId':Number(_0x4201e6['params']['id'])};_0x49ef5f[_[_0x3bd0('0x9c')](_0x122d02['toLowerCase']())+'QueueId']=Number(_0x4201e6['body'][_0x3bd0('0x58')][_0x1d0577]);socket[_0x3bd0('0x1e')](_0x3bd0('0x23')+_[_0x3bd0('0x9c')](_0x122d02['toLowerCase']())+'Queue:save',_0x49ef5f);}return _0x1b773a;})['then'](function(){if(_0x122d02===_0x3bd0('0x9d')){return db[_0x3bd0('0x9e')]['findAll']({'where':{'id':_0x4201e6['body'][_0x3bd0('0x58')]||[]},'raw':!![],'attributes':['id',_0x3bd0('0x2c')]});}})[_0x3bd0('0x1b')](function(_0x1c1209){var _0x56b561=_0x2a75d5[_0x3bd0('0x21')]({'plain':!![]});var _0x34b16c=[];if(_0x122d02===_0x3bd0('0x9d')&&_0x56b561[_0x3bd0('0x1c')]===_0x3bd0('0x1d')&&_0x56b561[_0x3bd0('0x9f')]){for(let _0x42cd26=0x0;_0x42cd26<_0x1c1209[_0x3bd0('0x48')];_0x42cd26+=0x1){_0x34b16c[_0x3bd0('0x45')]({'membername':_0x56b561['name'],'UserId':_0x56b561['id'],'queue_name':_0x1c1209[_0x42cd26][_0x3bd0('0x2c')],'VoiceQueueId':_0x1c1209[_0x42cd26]['id'],'interface':_[_0x3bd0('0x60')](_0x56b561[_0x3bd0('0xa0')])?util[_0x3bd0('0xa1')](_0x3bd0('0xa2'),_0x56b561[_0x3bd0('0x2c')]):_0x56b561[_0x3bd0('0xa0')],'paused':_0x56b561[_0x3bd0('0x95')]||![],'penalty':_0x4201e6[_0x3bd0('0x54')][_0x3bd0('0xa3')]||0x0});}return Promise['all'](_0x34b16c[_0x3bd0('0x32')](function(_0xee0b91){return db[_0x3bd0('0xa4')]['upsert'](_0xee0b91);}));}return _0x2a75d5;});}})[_0x3bd0('0x1b')](respondWithStatusCode(_0x51ed02,null))['catch'](handleError(_0x51ed02,null));};exports[_0x3bd0('0xa5')]=function(_0x5027ec,_0xd62853){var _0x200823,_0x12ba41;return db[_0x3bd0('0x30')][_0x3bd0('0x2b')]({'where':{'id':_0x5027ec[_0x3bd0('0x55')]['id']},'attributes':['id',_0x3bd0('0x2c'),_0x3bd0('0x1c')]})[_0x3bd0('0x1b')](handleEntityNotFound(_0xd62853,null))[_0x3bd0('0x1b')](function(_0xa49fa3){if(_0xa49fa3){_0x200823=_0xa49fa3;if(!_0x5027ec['query']['channel']||!utils[_0x3bd0('0x96')](_0x5027ec[_0x3bd0('0x3e')][_0x3bd0('0x93')])){throw new db[(_0x3bd0('0x87'))]['ValidationError']('Unknown\x20channel');}return _0xa49fa3[_0x3bd0('0xa6')+_[_0x3bd0('0x9c')](_0x5027ec[_0x3bd0('0x3e')][_0x3bd0('0x93')][_0x3bd0('0x99')]())+_0x3bd0('0x9a')](_0x5027ec[_0x3bd0('0x3e')][_0x3bd0('0x58')]);}})[_0x3bd0('0x1b')](function(_0x5cb5f4){if(_[_0x3bd0('0xa7')](_0x5027ec[_0x3bd0('0x3e')]['ids'])){for(var _0x42024f=0x0;_0x42024f<_0x5027ec['query']['ids'][_0x3bd0('0x48')];_0x42024f+=0x1){_0x12ba41={'UserId':Number(_0x5027ec[_0x3bd0('0x55')]['id'])};_0x12ba41[_[_0x3bd0('0x9c')](_0x5027ec[_0x3bd0('0x3e')][_0x3bd0('0x93')][_0x3bd0('0x99')]())+_0x3bd0('0xa8')]=Number(_0x5027ec[_0x3bd0('0x3e')][_0x3bd0('0x58')][_0x42024f]);socket[_0x3bd0('0x1e')](_0x3bd0('0x23')+_[_0x3bd0('0x9c')](_0x5027ec[_0x3bd0('0x3e')][_0x3bd0('0x93')]['toLowerCase']())+_0x3bd0('0xa9'),_0x12ba41);}}else{_0x12ba41={'UserId':Number(_0x5027ec['params']['id'])};_0x12ba41[_['capitalize'](_0x5027ec[_0x3bd0('0x3e')][_0x3bd0('0x93')]['toLowerCase']())+_0x3bd0('0xa8')]=Number(_0x5027ec[_0x3bd0('0x3e')][_0x3bd0('0x58')]);socket['emit'](_0x3bd0('0x23')+_[_0x3bd0('0x9c')](_0x5027ec['query'][_0x3bd0('0x93')][_0x3bd0('0x99')]())+'Queue:remove',_0x12ba41);}return _0x5cb5f4;})[_0x3bd0('0x1b')](function(){if(_0x5027ec[_0x3bd0('0x3e')][_0x3bd0('0x93')]==='voice'){return db['UserVoiceQueueRt'][_0x3bd0('0x20')]({'where':{'UserId':_0x5027ec[_0x3bd0('0x55')]['id'],'VoiceQueueId':_0x5027ec[_0x3bd0('0x3e')][_0x3bd0('0x58')]},'individualHooks':!![]})[_0x3bd0('0x1b')](function(){return _0x200823;});}return _0x200823;})[_0x3bd0('0x1b')](respondWithStatusCode(_0xd62853,null))['catch'](handleError(_0xd62853,null));};exports[_0x3bd0('0xaa')]=function(_0xfe5378,_0x41b755){_0xfe5378['body'][_0x3bd0('0xab')]=_0xfe5378[_0x3bd0('0xac')][_0x3bd0('0xad')];return db['User']['find']({'where':{'id':_0xfe5378['params']['id']}})[_0x3bd0('0x1b')](handleEntityNotFound(_0x41b755,null))['then'](saveUpdates(_0xfe5378[_0x3bd0('0x54')],null))['then'](respondWithResult(_0x41b755,null))[_0x3bd0('0x50')](handleError(_0x41b755,null));};exports['getAvatar']=function(_0x6cf494,_0x1c98c3){var _0x5087c8=path['join'](config[_0x3bd0('0xae')],_0x3bd0('0xaf'));return db['User'][_0x3bd0('0x2b')]({'where':{'id':_0x6cf494['params']['id']},'attributes':['id',_0x3bd0('0xab')],'raw':!![]})[_0x3bd0('0x1b')](handleEntityNotFound(_0x1c98c3,null))[_0x3bd0('0x1b')](function(_0x279956){if(_0x279956){if(_[_0x3bd0('0x60')](_0x279956[_0x3bd0('0xab')])){return _0x1c98c3['download'](_0x5087c8);}else{if(!fs[_0x3bd0('0xb0')](path[_0x3bd0('0xb1')](config[_0x3bd0('0xae')],'server/files/images/',_0x279956[_0x3bd0('0xab')]))){return _0x1c98c3[_0x3bd0('0xb2')](_0x5087c8);}return _0x1c98c3['download'](path[_0x3bd0('0xb1')](config[_0x3bd0('0xae')],'server/files/images/',_0x279956[_0x3bd0('0xab')]));}}})[_0x3bd0('0x50')](handleError(_0x1c98c3,null));};exports['getOpenTabs']=function(_0x7590b0,_0xe3ba41){return db[_0x3bd0('0x30')][_0x3bd0('0x2b')]({'where':{'id':_0x7590b0['params']['id']},'attributes':['id']})['then'](handleEntityNotFound(_0xe3ba41,null))['then'](function(_0x483495){var _0xec2b42=[];values=_0x483495[_0x3bd0('0x4a')];_0xec2b42[_0x3bd0('0x45')](get_open_tabs(_0x3bd0('0x49'),_0x483495[_0x3bd0('0x4a')]));_0xec2b42[_0x3bd0('0x45')](get_open_tabs(_0x3bd0('0xb3'),_0x483495[_0x3bd0('0x4a')]));_0xec2b42[_0x3bd0('0x45')](get_open_tabs(_0x3bd0('0x4d'),_0x483495['dataValues']));_0xec2b42[_0x3bd0('0x45')](get_open_tabs(_0x3bd0('0x4e'),_0x483495[_0x3bd0('0x4a')]));_0xec2b42[_0x3bd0('0x45')](get_open_tabs(_0x3bd0('0x4b'),_0x483495[_0x3bd0('0x4a')]));_0xec2b42[_0x3bd0('0x45')](get_open_tabs('mail',_0x483495['dataValues']));return Promise[_0x3bd0('0x4f')](_0xec2b42);})[_0x3bd0('0x1b')](function(_0x1dd1e2){if(_0x1dd1e2){var _0x1588fa=_['map'](values[_0x3bd0('0xb4')],function(_0x3553b9){return{'channel':_0x3bd0('0xb5'),'id':_0x3553b9['id'],'createdAt':_0x3553b9[_0x3bd0('0xb6')]};});var _0x1262f6=_['map'](values[_0x3bd0('0xb7')],function(_0x1822d2){return{'channel':'FAX','id':_0x1822d2['id'],'createdAt':_0x1822d2['createdAt']};});var _0x38cbf5=_[_0x3bd0('0x32')](values[_0x3bd0('0xb8')],function(_0x3d5560){return{'channel':_0x3bd0('0xb9'),'id':_0x3d5560['id'],'createdAt':_0x3d5560['createdAt']};});var _0x2b91a1=_['map'](values[_0x3bd0('0xba')],function(_0x544b28){return{'channel':_0x3bd0('0xbb'),'id':_0x544b28['id'],'createdAt':_0x544b28[_0x3bd0('0xb6')]};});var _0x55bd9e=_['map'](values[_0x3bd0('0xbc')],function(_0x4b4a87){return{'channel':_0x3bd0('0xbd'),'id':_0x4b4a87['id'],'createdAt':_0x4b4a87['createdAt']};});var _0x16c8df=_['map'](values[_0x3bd0('0xbe')],function(_0x19e5c7){return{'channel':_0x3bd0('0xbf'),'id':_0x19e5c7['id'],'createdAt':_0x19e5c7[_0x3bd0('0xb6')]};});var _0x56f662=_[_0x3bd0('0xc0')](_0x1588fa,_0x1262f6,_0x38cbf5,_0x2b91a1,_0x55bd9e,_0x16c8df);var _0x1bef2b={'count':_0x56f662[_0x3bd0('0x48')],'rows':_0x56f662};return _0x1bef2b;}else return null;})[_0x3bd0('0x1b')](respondWithResult(_0xe3ba41,null))['catch'](handleError(_0xe3ba41,null));};exports['getContacts']=function(_0x11d118,_0x3fd04b){var _0x2fed7c={};return db[_0x3bd0('0x30')][_0x3bd0('0x8c')]({'where':{'id':_0x11d118[_0x3bd0('0x55')]['id']}})[_0x3bd0('0x1b')](function(_0x23337f){if(!_0x23337f){throw new APINotFoundError(util[_0x3bd0('0xa1')](_0x3bd0('0xc1'),_0x11d118[_0x3bd0('0x55')]['id']));}return contacts['describe']();})['then'](function(_0x409500){_0x11d118[_0x3bd0('0x3e')][_0x3bd0('0x30')]=_0x11d118[_0x3bd0('0x55')]['id'];_0x2fed7c=qs[_0x3bd0('0x3c')](_0x409500,_0x11d118);if(_0x11d118[_0x3bd0('0x3e')][_0x3bd0('0xc2')](_0x3bd0('0x3f'))){_0x2fed7c[_0x3bd0('0x40')]=[{'model':db[_0x3bd0('0xc3')],'as':'List','required':![]},{'model':db[_0x3bd0('0xc4')],'as':_0x3bd0('0xc5'),'attributes':['id',_0x3bd0('0x2c'),'color'],'where':_0x11d118[_0x3bd0('0x3e')]['tag']?{'id':_0x11d118['query'][_0x3bd0('0xc6')]}:undefined,'required':_0x11d118[_0x3bd0('0x3e')][_0x3bd0('0xc6')]?!![]:![]}];}return contacts[_0x3bd0('0x82')](_0x11d118[_0x3bd0('0x3e')],_0x11d118[_0x3bd0('0x23')],_0x2fed7c,_0x409500);})[_0x3bd0('0x1b')](respondWithFilteredResult(_0x3fd04b,_0x2fed7c))[_0x3bd0('0x50')](APIHandleError(_0x3fd04b));};exports['getQueues']=function(_0x3a026f,_0x11b320){var _0x27e46c;var _0x2e5758={};var _0x3b646f;return db[_0x3bd0('0x30')][_0x3bd0('0x8c')]({'where':{'id':_0x3a026f[_0x3bd0('0x55')]['id']},'attributes':['id','name','role']})['then'](handleEntityNotFound(_0x11b320,null))[_0x3bd0('0x1b')](function(_0xc87256){if(!utils[_0x3bd0('0x96')](_0x3a026f['query']['channel'])){throw new db['Sequelize'][(_0x3bd0('0x89'))](_0x3bd0('0x97'));}_0x27e46c=_0xc87256;var _0x25f399={};_0x25f399[_0x3bd0('0xc7')]=_[_0x3bd0('0xc8')](db[_['capitalize'](_0x3a026f[_0x3bd0('0x3e')][_0x3bd0('0x93')])+_0x3bd0('0xc9')][_0x3bd0('0x31')]);_0x25f399['query']=_[_0x3bd0('0xc8')](_0x3a026f[_0x3bd0('0x3e')]);_0x25f399[_0x3bd0('0xca')]=_[_0x3bd0('0xcb')](_0x25f399[_0x3bd0('0xc7')],_0x25f399['query']);_0x2e5758['attributes']=_['intersection'](_0x25f399[_0x3bd0('0xc7')],qs[_0x3bd0('0xcc')](_0x3a026f[_0x3bd0('0x3e')][_0x3bd0('0xcc')]));_0x2e5758[_0x3bd0('0x44')]=_0x2e5758[_0x3bd0('0x44')][_0x3bd0('0x48')]?_0x2e5758['attributes']:_0x25f399['model'];_0x2e5758[_0x3bd0('0xcd')]=qs['sort'](_0x3a026f[_0x3bd0('0x3e')]['sort']);_0x2e5758[_0x3bd0('0x3d')]=qs[_0x3bd0('0xca')](_[_0x3bd0('0xce')](_0x3a026f[_0x3bd0('0x3e')],_0x25f399[_0x3bd0('0xca')]));if(_0x3a026f[_0x3bd0('0x3e')][_0x3bd0('0x27')]){_0x2e5758[_0x3bd0('0x3d')]=_[_0x3bd0('0x52')](_0x2e5758[_0x3bd0('0x3d')],{'$or':_[_0x3bd0('0x32')](_0x2e5758[_0x3bd0('0x44')],function(_0x5a9e3f){var _0x5a39fa={};_0x5a39fa[_0x5a9e3f]={'$like':'%'+_0x3a026f[_0x3bd0('0x3e')][_0x3bd0('0x27')]+'%'};return _0x5a39fa;})});}_0x2e5758=_[_0x3bd0('0x52')]({},_0x2e5758,_0x3a026f[_0x3bd0('0xcf')]);switch(_0x27e46c['role']){case'admin':return db[_[_0x3bd0('0x9c')](_0x3a026f[_0x3bd0('0x3e')][_0x3bd0('0x93')])+'Queue'][_0x3bd0('0x82')](_0x2e5758);case _0x3bd0('0x23'):case _0x3bd0('0x1d'):return _0x27e46c['get'+_[_0x3bd0('0x9c')](_0x3a026f[_0x3bd0('0x3e')]['channel'])+'Queues'](_0x2e5758);default:throw new db[(_0x3bd0('0x87'))][(_0x3bd0('0x89'))]('Unknown\x20role');}})['then'](function(_0x5807de){_0x3b646f=_0x5807de['length'];if(!_0x3a026f[_0x3bd0('0x3e')][_0x3bd0('0xc2')](_0x3bd0('0xd0'))){_0x2e5758[_0x3bd0('0x18')]=qs['limit'](_0x3a026f[_0x3bd0('0x3e')][_0x3bd0('0x18')]);_0x2e5758['offset']=qs[_0x3bd0('0x17')](_0x3a026f[_0x3bd0('0x3e')][_0x3bd0('0x17')]);}switch(_0x27e46c[_0x3bd0('0x1c')]){case _0x3bd0('0x22'):return db[_[_0x3bd0('0x9c')](_0x3a026f[_0x3bd0('0x3e')][_0x3bd0('0x93')])+_0x3bd0('0xc9')][_0x3bd0('0x82')](_0x2e5758);case'user':case _0x3bd0('0x1d'):return _0x27e46c['get'+_[_0x3bd0('0x9c')](_0x3a026f[_0x3bd0('0x3e')]['channel'])+_0x3bd0('0x9a')](_0x2e5758);}})[_0x3bd0('0x1b')](function(_0x41b613){return{'count':_0x3b646f,'rows':_0x41b613};})[_0x3bd0('0x1b')](respondWithResult(_0x11b320,null))[_0x3bd0('0x50')](handleError(_0x11b320,null));};exports[_0x3bd0('0xd1')]=function(_0x4f481e,_0xf7e7ca){var _0x42d914={};var _0x4e367c={};var _0x242732;var _0x20e37d;return db[_0x3bd0('0x30')]['findOne']({'where':{'id':_0x4f481e['params']['id']}})[_0x3bd0('0x1b')](handleEntityNotFound(_0xf7e7ca,null))[_0x3bd0('0x1b')](function(_0x2de590){if(_0x2de590){_0x242732=_0x2de590;_0x4e367c[_0x3bd0('0xc7')]=_['keys'](db[_0x3bd0('0xa4')][_0x3bd0('0x31')]);_0x4e367c[_0x3bd0('0x3e')]=_[_0x3bd0('0xc8')](_0x4f481e[_0x3bd0('0x3e')]);_0x4e367c[_0x3bd0('0xca')]=_['intersection'](_0x4e367c[_0x3bd0('0xc7')],_0x4e367c['query']);_0x42d914[_0x3bd0('0x44')]=_[_0x3bd0('0xcb')](_0x4e367c['model'],qs['fields'](_0x4f481e[_0x3bd0('0x3e')]['fields']));_0x42d914[_0x3bd0('0x44')]=_0x42d914['attributes']['length']?_0x42d914['attributes']:_0x4e367c[_0x3bd0('0xc7')];_0x42d914[_0x3bd0('0xcd')]=qs['sort'](_0x4f481e[_0x3bd0('0x3e')][_0x3bd0('0xd2')]);_0x42d914[_0x3bd0('0x3d')]=qs[_0x3bd0('0xca')](_[_0x3bd0('0xce')](_0x4f481e[_0x3bd0('0x3e')],_0x4e367c[_0x3bd0('0xca')]));if(_0x4f481e[_0x3bd0('0x3e')][_0x3bd0('0x27')]){_0x42d914[_0x3bd0('0x3d')]=_['merge'](_0x42d914[_0x3bd0('0x3d')],{'$or':_[_0x3bd0('0x32')](_0x42d914[_0x3bd0('0x44')],function(_0x5b990c){var _0x3c49b2={};_0x3c49b2[_0x5b990c]={'$like':'%'+_0x4f481e[_0x3bd0('0x3e')][_0x3bd0('0x27')]+'%'};return _0x3c49b2;})});}_0x42d914=_[_0x3bd0('0x52')]({},_0x42d914,_0x4f481e[_0x3bd0('0xcf')]);return _0x242732['getVoiceQueuesRt'](_0x42d914);}})['then'](function(_0xe9e81e){if(_0xe9e81e){_0x20e37d=_0xe9e81e[_0x3bd0('0x48')];if(!_0x4f481e[_0x3bd0('0x3e')]['hasOwnProperty']('nolimit')){_0x42d914[_0x3bd0('0x18')]=qs[_0x3bd0('0x18')](_0x4f481e[_0x3bd0('0x3e')]['limit']);_0x42d914[_0x3bd0('0x17')]=qs['offset'](_0x4f481e['query'][_0x3bd0('0x17')]);}return _0x242732[_0x3bd0('0xd1')](_0x42d914);}})[_0x3bd0('0x1b')](function(_0x586b0f){if(_0x586b0f){return _0x586b0f?{'count':_0x20e37d,'rows':_0x586b0f}:null;}})[_0x3bd0('0x1b')](respondWithResult(_0xf7e7ca,null))[_0x3bd0('0x50')](handleError(_0xf7e7ca,null));};exports[_0x3bd0('0xd3')]=function(_0x26d15e,_0x2e5482){var _0x2c8b88={};var _0x2e8cbd={};var _0x478c1;var _0x185630;return db[_0x3bd0('0x30')]['findOne']({'where':{'id':_0x26d15e[_0x3bd0('0x55')]['id']}})['then'](handleEntityNotFound(_0x2e5482,null))[_0x3bd0('0x1b')](function(_0x1f4a54){if(_0x1f4a54){_0x478c1=_0x1f4a54;_0x2e8cbd[_0x3bd0('0xc7')]=_[_0x3bd0('0xc8')](db[_0x3bd0('0xd4')][_0x3bd0('0x31')]);_0x2e8cbd['query']=_[_0x3bd0('0xc8')](_0x26d15e[_0x3bd0('0x3e')]);_0x2e8cbd[_0x3bd0('0xca')]=_[_0x3bd0('0xcb')](_0x2e8cbd[_0x3bd0('0xc7')],_0x2e8cbd[_0x3bd0('0x3e')]);_0x2c8b88[_0x3bd0('0x44')]=_[_0x3bd0('0xcb')](_0x2e8cbd[_0x3bd0('0xc7')],qs['fields'](_0x26d15e[_0x3bd0('0x3e')]['fields']));_0x2c8b88[_0x3bd0('0x44')]=_0x2c8b88[_0x3bd0('0x44')][_0x3bd0('0x48')]?_0x2c8b88['attributes']:_0x2e8cbd[_0x3bd0('0xc7')];_0x2c8b88[_0x3bd0('0xcd')]=qs[_0x3bd0('0xd2')](_0x26d15e[_0x3bd0('0x3e')][_0x3bd0('0xd2')]);_0x2c8b88[_0x3bd0('0x3d')]=qs[_0x3bd0('0xca')](_[_0x3bd0('0xce')](_0x26d15e[_0x3bd0('0x3e')],_0x2e8cbd[_0x3bd0('0xca')]));if(_0x26d15e[_0x3bd0('0x3e')][_0x3bd0('0x27')]){_0x2c8b88['where']=_[_0x3bd0('0x52')](_0x2c8b88[_0x3bd0('0x3d')],{'$or':_[_0x3bd0('0x32')](_0x2c8b88[_0x3bd0('0x44')],function(_0x2f30fd){var _0x33a777={};_0x33a777[_0x2f30fd]={'$like':'%'+_0x26d15e[_0x3bd0('0x3e')][_0x3bd0('0x27')]+'%'};return _0x33a777;})});}_0x2c8b88=_[_0x3bd0('0x52')]({},_0x2c8b88,_0x26d15e[_0x3bd0('0xcf')]);return _0x478c1[_0x3bd0('0xd3')](_0x2c8b88);}})[_0x3bd0('0x1b')](function(_0x52468a){if(_0x52468a){_0x185630=_0x52468a[_0x3bd0('0x48')];if(!_0x26d15e[_0x3bd0('0x3e')][_0x3bd0('0xc2')]('nolimit')){_0x2c8b88['limit']=qs['limit'](_0x26d15e[_0x3bd0('0x3e')][_0x3bd0('0x18')]);_0x2c8b88[_0x3bd0('0x17')]=qs[_0x3bd0('0x17')](_0x26d15e[_0x3bd0('0x3e')]['offset']);}return _0x478c1[_0x3bd0('0xd3')](_0x2c8b88);}})[_0x3bd0('0x1b')](function(_0x2a79a3){if(_0x2a79a3){return _0x2a79a3?{'count':_0x185630,'rows':_0x2a79a3}:null;}})['then'](respondWithResult(_0x2e5482,null))[_0x3bd0('0x50')](handleError(_0x2e5482,null));};exports['getRecordings']=function(_0x5beda9,_0x41a5c4){var _0x3204c1={'raw':!![],'where':{}};var _0x8393d8={};var _0x1731a0={'count':0x0,'rows':[]};return db[_0x3bd0('0x30')][_0x3bd0('0x8c')]({'where':{'id':_0x5beda9[_0x3bd0('0x55')]['id']}})[_0x3bd0('0x1b')](handleEntityNotFound(_0x41a5c4,null))[_0x3bd0('0x1b')](function(_0x3b3a9f){if(_0x3b3a9f){_0x8393d8[_0x3bd0('0xc7')]=_[_0x3bd0('0xc8')](db['VoiceRecording']['rawAttributes']);_0x8393d8[_0x3bd0('0x3e')]=_[_0x3bd0('0xc8')](_0x5beda9[_0x3bd0('0x3e')]);_0x8393d8[_0x3bd0('0xca')]=_[_0x3bd0('0xcb')](_0x8393d8['model'],_0x8393d8[_0x3bd0('0x3e')]);_0x3204c1[_0x3bd0('0x44')]=_['intersection'](_0x8393d8[_0x3bd0('0xc7')],qs['fields'](_0x5beda9[_0x3bd0('0x3e')][_0x3bd0('0xcc')]));_0x3204c1[_0x3bd0('0x44')]=_0x3204c1[_0x3bd0('0x44')]['length']?_0x3204c1[_0x3bd0('0x44')]:_0x8393d8['model'];if(!_0x5beda9[_0x3bd0('0x3e')][_0x3bd0('0xc2')](_0x3bd0('0xd0'))){_0x3204c1[_0x3bd0('0x18')]=qs[_0x3bd0('0x18')](_0x5beda9[_0x3bd0('0x3e')][_0x3bd0('0x18')]);_0x3204c1['offset']=qs[_0x3bd0('0x17')](_0x5beda9[_0x3bd0('0x3e')][_0x3bd0('0x17')]);}_0x3204c1[_0x3bd0('0xcd')]=qs[_0x3bd0('0xd2')](_0x5beda9[_0x3bd0('0x3e')][_0x3bd0('0xd2')]);_0x3204c1[_0x3bd0('0x3d')]=qs['filters'](_[_0x3bd0('0xce')](_0x5beda9[_0x3bd0('0x3e')],_0x8393d8[_0x3bd0('0xca')]));_0x3204c1[_0x3bd0('0x3d')][_0x3bd0('0xd5')]=_0x3b3a9f['id'];if(_0x5beda9['query'][_0x3bd0('0x27')]){_0x3204c1[_0x3bd0('0x3d')]=_['merge'](_0x3204c1[_0x3bd0('0x3d')],{'$or':_[_0x3bd0('0x32')](_0x3204c1['attributes'],function(_0x2424ef){var _0x8cd91e={};_0x8cd91e[_0x2424ef]={'$like':'%'+_0x5beda9[_0x3bd0('0x3e')][_0x3bd0('0x27')]+'%'};return _0x8cd91e;})});}_0x3204c1=_[_0x3bd0('0x52')]({},_0x3204c1,_0x5beda9[_0x3bd0('0xcf')]);return db['VoiceRecording'][_0x3bd0('0x19')]({'where':_0x3204c1['where']})['then'](function(_0xd445e8){_0x1731a0[_0x3bd0('0x19')]=_0xd445e8;if(_0x5beda9['query']['includeAll']){_0x3204c1['include']=[{'all':!![]}];}return db[_0x3bd0('0xd6')][_0x3bd0('0x82')](_0x3204c1);})[_0x3bd0('0x1b')](function(_0x5e2479){_0x1731a0[_0x3bd0('0x46')]=_0x5e2479;return _0x1731a0;});}})['then'](respondWithFilteredResult(_0x41a5c4,_0x3204c1))['catch'](handleError(_0x41a5c4,null));};exports['getScreenRecordings']=function(_0x37b45b,_0x589355){var _0x38e75f={'raw':!![],'where':{}};var _0x4ec808={};var _0x4cf62b={'count':0x0,'rows':[]};return db[_0x3bd0('0x30')][_0x3bd0('0x8c')]({'where':{'id':_0x37b45b[_0x3bd0('0x55')]['id']}})['then'](handleEntityNotFound(_0x589355,null))['then'](function(_0x143c20){if(_0x143c20){_0x4ec808['model']=_[_0x3bd0('0xc8')](db[_0x3bd0('0xd7')]['rawAttributes']);_0x4ec808[_0x3bd0('0x3e')]=_[_0x3bd0('0xc8')](_0x37b45b[_0x3bd0('0x3e')]);_0x4ec808[_0x3bd0('0xca')]=_['intersection'](_0x4ec808[_0x3bd0('0xc7')],_0x4ec808[_0x3bd0('0x3e')]);_0x38e75f[_0x3bd0('0x44')]=_[_0x3bd0('0xcb')](_0x4ec808['model'],qs[_0x3bd0('0xcc')](_0x37b45b[_0x3bd0('0x3e')][_0x3bd0('0xcc')]));_0x38e75f[_0x3bd0('0x44')]=_0x38e75f[_0x3bd0('0x44')][_0x3bd0('0x48')]?_0x38e75f[_0x3bd0('0x44')]:_0x4ec808[_0x3bd0('0xc7')];if(!_0x37b45b[_0x3bd0('0x3e')]['hasOwnProperty']('nolimit')){_0x38e75f[_0x3bd0('0x18')]=qs[_0x3bd0('0x18')](_0x37b45b['query']['limit']);_0x38e75f[_0x3bd0('0x17')]=qs[_0x3bd0('0x17')](_0x37b45b[_0x3bd0('0x3e')][_0x3bd0('0x17')]);}_0x38e75f[_0x3bd0('0xcd')]=qs[_0x3bd0('0xd2')](_0x37b45b[_0x3bd0('0x3e')]['sort']);_0x38e75f['where']=qs[_0x3bd0('0xca')](_['pick'](_0x37b45b[_0x3bd0('0x3e')],_0x4ec808['filters']));_0x38e75f[_0x3bd0('0x3d')]['UserId']=_0x143c20['id'];if(_0x37b45b[_0x3bd0('0x3e')][_0x3bd0('0x27')]){_0x38e75f[_0x3bd0('0x3d')]=_[_0x3bd0('0x52')](_0x38e75f['where'],{'$or':_[_0x3bd0('0x32')](_0x38e75f[_0x3bd0('0x44')],function(_0x291070){var _0x30f7fc={};_0x30f7fc[_0x291070]={'$like':'%'+_0x37b45b[_0x3bd0('0x3e')][_0x3bd0('0x27')]+'%'};return _0x30f7fc;})});}_0x38e75f=_[_0x3bd0('0x52')]({},_0x38e75f,_0x37b45b[_0x3bd0('0xcf')]);return db[_0x3bd0('0xd7')][_0x3bd0('0x19')]({'where':_0x38e75f[_0x3bd0('0x3d')]})[_0x3bd0('0x1b')](function(_0x4afb04){_0x4cf62b[_0x3bd0('0x19')]=_0x4afb04;if(_0x37b45b[_0x3bd0('0x3e')][_0x3bd0('0x3f')]){_0x38e75f[_0x3bd0('0x40')]=[{'all':!![]}];}return db[_0x3bd0('0xd7')][_0x3bd0('0x82')](_0x38e75f);})[_0x3bd0('0x1b')](function(_0x41530d){_0x4cf62b[_0x3bd0('0x46')]=_0x41530d;return _0x4cf62b;});}})['then'](respondWithFilteredResult(_0x589355,_0x38e75f))[_0x3bd0('0x50')](handleError(_0x589355,null));};exports[_0x3bd0('0xd8')]=function(_0x11056b,_0x2f9e0b){var _0xc8f040={};var _0x14f4ad={};var _0x3daa04;var _0x5f512e;return db[_0x3bd0('0x30')][_0x3bd0('0x8c')]({'where':{'id':_0x11056b['params']['id']}})[_0x3bd0('0x1b')](handleEntityNotFound(_0x2f9e0b,null))[_0x3bd0('0x1b')](function(_0x213352){if(_0x213352){_0x3daa04=_0x213352;_0x14f4ad['model']=_[_0x3bd0('0xc8')](db['ChatInteraction']['rawAttributes']);_0x14f4ad['query']=_[_0x3bd0('0xc8')](_0x11056b[_0x3bd0('0x3e')]);_0x14f4ad[_0x3bd0('0xca')]=_[_0x3bd0('0xcb')](_0x14f4ad[_0x3bd0('0xc7')],_0x14f4ad['query']);_0xc8f040[_0x3bd0('0x44')]=_['intersection'](_0x14f4ad[_0x3bd0('0xc7')],qs['fields'](_0x11056b['query'][_0x3bd0('0xcc')]));_0xc8f040[_0x3bd0('0x44')]=_0xc8f040[_0x3bd0('0x44')]['length']?_0xc8f040[_0x3bd0('0x44')]:_0x14f4ad['model'];_0xc8f040[_0x3bd0('0xcd')]=qs[_0x3bd0('0xd2')](_0x11056b['query'][_0x3bd0('0xd2')]);_0xc8f040[_0x3bd0('0x3d')]=qs[_0x3bd0('0xca')](_[_0x3bd0('0xce')](_0x11056b[_0x3bd0('0x3e')],_0x14f4ad[_0x3bd0('0xca')]));if(_0x11056b[_0x3bd0('0x3e')][_0x3bd0('0x27')]){_0xc8f040[_0x3bd0('0x3d')]=_['merge'](_0xc8f040[_0x3bd0('0x3d')],{'$or':_[_0x3bd0('0x32')](_0xc8f040[_0x3bd0('0x44')],function(_0x2e2f6a){var _0xe51eef={};_0xe51eef[_0x2e2f6a]={'$like':'%'+_0x11056b[_0x3bd0('0x3e')][_0x3bd0('0x27')]+'%'};return _0xe51eef;})});}_0xc8f040=_['merge']({},_0xc8f040,_0x11056b[_0x3bd0('0xcf')]);return _0x3daa04[_0x3bd0('0xd8')](_0xc8f040);}})[_0x3bd0('0x1b')](function(_0x10d244){if(_0x10d244){_0x5f512e=_0x10d244['length'];if(!_0x11056b[_0x3bd0('0x3e')][_0x3bd0('0xc2')](_0x3bd0('0xd0'))){_0xc8f040[_0x3bd0('0x18')]=qs[_0x3bd0('0x18')](_0x11056b[_0x3bd0('0x3e')][_0x3bd0('0x18')]);_0xc8f040[_0x3bd0('0x17')]=qs[_0x3bd0('0x17')](_0x11056b[_0x3bd0('0x3e')][_0x3bd0('0x17')]);}return _0x3daa04[_0x3bd0('0xd8')](_0xc8f040);}})[_0x3bd0('0x1b')](function(_0x273f37){if(_0x273f37){return _0x273f37?{'count':_0x5f512e,'rows':_0x273f37}:null;}})['then'](respondWithResult(_0x2f9e0b,null))[_0x3bd0('0x50')](handleError(_0x2f9e0b,null));};exports[_0x3bd0('0xd9')]=function(_0x1c18c0,_0x464a2f){var _0x2ca6af={};var _0x44ccba={};var _0x255da8;var _0x1f797c;return db[_0x3bd0('0x30')]['findOne']({'where':{'id':_0x1c18c0['params']['id']}})[_0x3bd0('0x1b')](handleEntityNotFound(_0x464a2f,null))[_0x3bd0('0x1b')](function(_0x5d4091){if(_0x5d4091){_0x255da8=_0x5d4091;_0x44ccba['model']=_[_0x3bd0('0xc8')](db[_0x3bd0('0xda')][_0x3bd0('0x31')]);_0x44ccba['query']=_[_0x3bd0('0xc8')](_0x1c18c0[_0x3bd0('0x3e')]);_0x44ccba[_0x3bd0('0xca')]=_[_0x3bd0('0xcb')](_0x44ccba[_0x3bd0('0xc7')],_0x44ccba[_0x3bd0('0x3e')]);_0x2ca6af[_0x3bd0('0x44')]=_[_0x3bd0('0xcb')](_0x44ccba['model'],qs[_0x3bd0('0xcc')](_0x1c18c0[_0x3bd0('0x3e')]['fields']));_0x2ca6af[_0x3bd0('0x44')]=_0x2ca6af[_0x3bd0('0x44')][_0x3bd0('0x48')]?_0x2ca6af[_0x3bd0('0x44')]:_0x44ccba[_0x3bd0('0xc7')];_0x2ca6af[_0x3bd0('0xcd')]=qs['sort'](_0x1c18c0['query'][_0x3bd0('0xd2')]);_0x2ca6af[_0x3bd0('0x3d')]=qs[_0x3bd0('0xca')](_[_0x3bd0('0xce')](_0x1c18c0[_0x3bd0('0x3e')],_0x44ccba[_0x3bd0('0xca')]));if(_0x1c18c0[_0x3bd0('0x3e')][_0x3bd0('0x27')]){_0x2ca6af['where']=_[_0x3bd0('0x52')](_0x2ca6af['where'],{'$or':_[_0x3bd0('0x32')](_0x2ca6af[_0x3bd0('0x44')],function(_0x512309){var _0x21f891={};_0x21f891[_0x512309]={'$like':'%'+_0x1c18c0['query'][_0x3bd0('0x27')]+'%'};return _0x21f891;})});}_0x2ca6af=_[_0x3bd0('0x52')]({},_0x2ca6af,_0x1c18c0['options']);return _0x255da8[_0x3bd0('0xd9')](_0x2ca6af);}})['then'](function(_0x49c465){if(_0x49c465){_0x1f797c=_0x49c465['length'];if(!_0x1c18c0[_0x3bd0('0x3e')][_0x3bd0('0xc2')]('nolimit')){_0x2ca6af[_0x3bd0('0x18')]=qs['limit'](_0x1c18c0['query'][_0x3bd0('0x18')]);_0x2ca6af['offset']=qs[_0x3bd0('0x17')](_0x1c18c0['query'][_0x3bd0('0x17')]);}return _0x255da8[_0x3bd0('0xd9')](_0x2ca6af);}})[_0x3bd0('0x1b')](function(_0x36349f){if(_0x36349f){return _0x36349f?{'count':_0x1f797c,'rows':_0x36349f}:null;}})[_0x3bd0('0x1b')](respondWithResult(_0x464a2f,null))[_0x3bd0('0x50')](handleError(_0x464a2f,null));};exports[_0x3bd0('0xdb')]=function(_0x24ef0b,_0x34d2d3){var _0x372c1d={'raw':!![],'where':{}};var _0x5972ac={};var _0x1b8044={'count':0x0,'rows':[]};return db['User']['findOne']({'where':{'id':_0x24ef0b[_0x3bd0('0x55')]['id']}})['then'](handleEntityNotFound(_0x34d2d3,null))[_0x3bd0('0x1b')](function(_0xd3354){if(_0xd3354){_0x5972ac[_0x3bd0('0xc7')]=_[_0x3bd0('0xc8')](db['MailInteraction'][_0x3bd0('0x31')]);_0x5972ac[_0x3bd0('0x3e')]=_[_0x3bd0('0xc8')](_0x24ef0b[_0x3bd0('0x3e')]);_0x5972ac[_0x3bd0('0xca')]=_[_0x3bd0('0xcb')](_0x5972ac['model'],_0x5972ac[_0x3bd0('0x3e')]);_0x372c1d[_0x3bd0('0x44')]=_['intersection'](_0x5972ac[_0x3bd0('0xc7')],qs[_0x3bd0('0xcc')](_0x24ef0b[_0x3bd0('0x3e')][_0x3bd0('0xcc')]));_0x372c1d['attributes']=_0x372c1d[_0x3bd0('0x44')][_0x3bd0('0x48')]?_0x372c1d[_0x3bd0('0x44')]:_0x5972ac[_0x3bd0('0xc7')];if(!_0x24ef0b[_0x3bd0('0x3e')][_0x3bd0('0xc2')]('nolimit')){_0x372c1d[_0x3bd0('0x18')]=qs['limit'](_0x24ef0b[_0x3bd0('0x3e')][_0x3bd0('0x18')]);_0x372c1d['offset']=qs[_0x3bd0('0x17')](_0x24ef0b[_0x3bd0('0x3e')][_0x3bd0('0x17')]);}_0x372c1d[_0x3bd0('0xcd')]=qs[_0x3bd0('0xd2')](_0x24ef0b[_0x3bd0('0x3e')][_0x3bd0('0xd2')]);_0x372c1d[_0x3bd0('0x3d')]=qs[_0x3bd0('0xca')](_[_0x3bd0('0xce')](_0x24ef0b[_0x3bd0('0x3e')],_0x5972ac[_0x3bd0('0xca')]));_0x372c1d[_0x3bd0('0x3d')][_0x3bd0('0xd5')]=_0xd3354['id'];if(_0x24ef0b[_0x3bd0('0x3e')][_0x3bd0('0x27')]){_0x372c1d['where']=_['merge'](_0x372c1d['where'],{'$or':_['map'](_0x372c1d[_0x3bd0('0x44')],function(_0x5b76f0){var _0x516fda={};_0x516fda[_0x5b76f0]={'$like':'%'+_0x24ef0b['query']['filter']+'%'};return _0x516fda;})});}_0x372c1d=_[_0x3bd0('0x52')]({},_0x372c1d,_0x24ef0b[_0x3bd0('0xcf')]);return db['MailInteraction'][_0x3bd0('0x19')]({'where':_0x372c1d[_0x3bd0('0x3d')]})[_0x3bd0('0x1b')](function(_0x539b8f){_0x1b8044[_0x3bd0('0x19')]=_0x539b8f;if(_0x24ef0b[_0x3bd0('0x3e')][_0x3bd0('0x3f')]){_0x372c1d['include']=[{'all':!![]}];}return db[_0x3bd0('0xdc')]['findAll'](_0x372c1d);})[_0x3bd0('0x1b')](function(_0x3440fe){_0x1b8044[_0x3bd0('0x46')]=_0x3440fe;return _0x1b8044;});}})[_0x3bd0('0x1b')](respondWithFilteredResult(_0x34d2d3,_0x372c1d))[_0x3bd0('0x50')](handleError(_0x34d2d3,null));};exports[_0x3bd0('0xdd')]=function(_0x23654a,_0x50aeee){var _0x4a0873={};var _0x350d65={};var _0x52b15f;var _0x45885e;return db[_0x3bd0('0x30')][_0x3bd0('0x8c')]({'where':{'id':_0x23654a[_0x3bd0('0x55')]['id']}})[_0x3bd0('0x1b')](handleEntityNotFound(_0x50aeee,null))[_0x3bd0('0x1b')](function(_0x82dcc9){if(_0x82dcc9){_0x52b15f=_0x82dcc9;_0x350d65['model']=_[_0x3bd0('0xc8')](db[_0x3bd0('0xde')][_0x3bd0('0x31')]);_0x350d65['query']=_['keys'](_0x23654a[_0x3bd0('0x3e')]);_0x350d65[_0x3bd0('0xca')]=_[_0x3bd0('0xcb')](_0x350d65[_0x3bd0('0xc7')],_0x350d65[_0x3bd0('0x3e')]);_0x4a0873['attributes']=_[_0x3bd0('0xcb')](_0x350d65[_0x3bd0('0xc7')],qs[_0x3bd0('0xcc')](_0x23654a[_0x3bd0('0x3e')]['fields']));_0x4a0873['attributes']=_0x4a0873[_0x3bd0('0x44')]['length']?_0x4a0873[_0x3bd0('0x44')]:_0x350d65[_0x3bd0('0xc7')];_0x4a0873[_0x3bd0('0xcd')]=qs[_0x3bd0('0xd2')](_0x23654a[_0x3bd0('0x3e')]['sort']);_0x4a0873['where']=qs[_0x3bd0('0xca')](_[_0x3bd0('0xce')](_0x23654a[_0x3bd0('0x3e')],_0x350d65[_0x3bd0('0xca')]));if(_0x23654a[_0x3bd0('0x3e')]['filter']){_0x4a0873[_0x3bd0('0x3d')]=_[_0x3bd0('0x52')](_0x4a0873['where'],{'$or':_[_0x3bd0('0x32')](_0x4a0873[_0x3bd0('0x44')],function(_0xe95568){var _0x5a79e3={};_0x5a79e3[_0xe95568]={'$like':'%'+_0x23654a[_0x3bd0('0x3e')][_0x3bd0('0x27')]+'%'};return _0x5a79e3;})});}_0x4a0873=_[_0x3bd0('0x52')]({},_0x4a0873,_0x23654a['options']);return _0x52b15f[_0x3bd0('0xdd')](_0x4a0873);}})[_0x3bd0('0x1b')](function(_0x5cbab6){if(_0x5cbab6){_0x45885e=_0x5cbab6['length'];if(!_0x23654a['query']['hasOwnProperty']('nolimit')){_0x4a0873[_0x3bd0('0x18')]=qs['limit'](_0x23654a['query']['limit']);_0x4a0873[_0x3bd0('0x17')]=qs[_0x3bd0('0x17')](_0x23654a[_0x3bd0('0x3e')]['offset']);}return _0x52b15f[_0x3bd0('0xdd')](_0x4a0873);}})[_0x3bd0('0x1b')](function(_0x487371){if(_0x487371){return _0x487371?{'count':_0x45885e,'rows':_0x487371}:null;}})[_0x3bd0('0x1b')](respondWithResult(_0x50aeee,null))[_0x3bd0('0x50')](handleError(_0x50aeee,null));};exports[_0x3bd0('0xdf')]=function(_0x13ed4d,_0x55d9a6){var _0x508c6c={};var _0x37f48c={};var _0x4acdb8;var _0x3ce534;return db[_0x3bd0('0x30')][_0x3bd0('0x8c')]({'where':{'id':_0x13ed4d['params']['id']}})[_0x3bd0('0x1b')](handleEntityNotFound(_0x55d9a6,null))['then'](function(_0x10cf84){if(_0x10cf84){_0x4acdb8=_0x10cf84;_0x37f48c[_0x3bd0('0xc7')]=_[_0x3bd0('0xc8')](db[_0x3bd0('0xe0')]['rawAttributes']);_0x37f48c[_0x3bd0('0x3e')]=_[_0x3bd0('0xc8')](_0x13ed4d[_0x3bd0('0x3e')]);_0x37f48c['filters']=_['intersection'](_0x37f48c['model'],_0x37f48c[_0x3bd0('0x3e')]);_0x508c6c[_0x3bd0('0x44')]=_[_0x3bd0('0xcb')](_0x37f48c[_0x3bd0('0xc7')],qs[_0x3bd0('0xcc')](_0x13ed4d[_0x3bd0('0x3e')][_0x3bd0('0xcc')]));_0x508c6c['attributes']=_0x508c6c[_0x3bd0('0x44')][_0x3bd0('0x48')]?_0x508c6c[_0x3bd0('0x44')]:_0x37f48c['model'];_0x508c6c[_0x3bd0('0xcd')]=qs['sort'](_0x13ed4d[_0x3bd0('0x3e')][_0x3bd0('0xd2')]);_0x508c6c[_0x3bd0('0x3d')]=qs[_0x3bd0('0xca')](_[_0x3bd0('0xce')](_0x13ed4d[_0x3bd0('0x3e')],_0x37f48c[_0x3bd0('0xca')]));if(_0x13ed4d[_0x3bd0('0x3e')]['filter']){_0x508c6c[_0x3bd0('0x3d')]=_[_0x3bd0('0x52')](_0x508c6c[_0x3bd0('0x3d')],{'$or':_[_0x3bd0('0x32')](_0x508c6c[_0x3bd0('0x44')],function(_0xe06427){var _0xf7b6da={};_0xf7b6da[_0xe06427]={'$like':'%'+_0x13ed4d[_0x3bd0('0x3e')]['filter']+'%'};return _0xf7b6da;})});}_0x508c6c=_[_0x3bd0('0x52')]({},_0x508c6c,_0x13ed4d['options']);return _0x4acdb8[_0x3bd0('0xdf')](_0x508c6c);}})[_0x3bd0('0x1b')](function(_0x42c5bd){if(_0x42c5bd){_0x3ce534=_0x42c5bd['length'];if(!_0x13ed4d[_0x3bd0('0x3e')]['hasOwnProperty']('nolimit')){_0x508c6c['limit']=qs[_0x3bd0('0x18')](_0x13ed4d['query']['limit']);_0x508c6c['offset']=qs[_0x3bd0('0x17')](_0x13ed4d['query'][_0x3bd0('0x17')]);}return _0x4acdb8[_0x3bd0('0xdf')](_0x508c6c);}})[_0x3bd0('0x1b')](function(_0xf26d4e){if(_0xf26d4e){return _0xf26d4e?{'count':_0x3ce534,'rows':_0xf26d4e}:null;}})[_0x3bd0('0x1b')](respondWithResult(_0x55d9a6,null))[_0x3bd0('0x50')](handleError(_0x55d9a6,null));};exports[_0x3bd0('0xe1')]=function(_0x9a25e,_0x2fd53b){var _0xb1843b={};var _0x276f7a={};var _0x4a2446;var _0x5e6288;return db[_0x3bd0('0x30')][_0x3bd0('0x8c')]({'where':{'id':_0x9a25e['params']['id']}})[_0x3bd0('0x1b')](handleEntityNotFound(_0x2fd53b,null))[_0x3bd0('0x1b')](function(_0x3641b2){if(_0x3641b2){_0x4a2446=_0x3641b2;_0x276f7a[_0x3bd0('0xc7')]=_[_0x3bd0('0xc8')](db[_0x3bd0('0xe2')][_0x3bd0('0x31')]);_0x276f7a[_0x3bd0('0x3e')]=_[_0x3bd0('0xc8')](_0x9a25e[_0x3bd0('0x3e')]);_0x276f7a[_0x3bd0('0xca')]=_[_0x3bd0('0xcb')](_0x276f7a['model'],_0x276f7a[_0x3bd0('0x3e')]);_0xb1843b[_0x3bd0('0x44')]=_[_0x3bd0('0xcb')](_0x276f7a['model'],qs[_0x3bd0('0xcc')](_0x9a25e[_0x3bd0('0x3e')][_0x3bd0('0xcc')]));_0xb1843b[_0x3bd0('0x44')]=_0xb1843b[_0x3bd0('0x44')][_0x3bd0('0x48')]?_0xb1843b['attributes']:_0x276f7a[_0x3bd0('0xc7')];_0xb1843b['order']=qs[_0x3bd0('0xd2')](_0x9a25e[_0x3bd0('0x3e')][_0x3bd0('0xd2')]);_0xb1843b['where']=qs['filters'](_[_0x3bd0('0xce')](_0x9a25e[_0x3bd0('0x3e')],_0x276f7a['filters']));if(_0x9a25e[_0x3bd0('0x3e')][_0x3bd0('0x27')]){_0xb1843b[_0x3bd0('0x3d')]=_['merge'](_0xb1843b[_0x3bd0('0x3d')],{'$or':_[_0x3bd0('0x32')](_0xb1843b[_0x3bd0('0x44')],function(_0x48fbbf){var _0xde53a3={};_0xde53a3[_0x48fbbf]={'$like':'%'+_0x9a25e[_0x3bd0('0x3e')][_0x3bd0('0x27')]+'%'};return _0xde53a3;})});}_0xb1843b=_[_0x3bd0('0x52')]({},_0xb1843b,_0x9a25e[_0x3bd0('0xcf')]);return _0x4a2446[_0x3bd0('0xe1')](_0xb1843b);}})[_0x3bd0('0x1b')](function(_0x4a6c63){if(_0x4a6c63){_0x5e6288=_0x4a6c63[_0x3bd0('0x48')];if(!_0x9a25e[_0x3bd0('0x3e')][_0x3bd0('0xc2')](_0x3bd0('0xd0'))){_0xb1843b['limit']=qs[_0x3bd0('0x18')](_0x9a25e[_0x3bd0('0x3e')]['limit']);_0xb1843b[_0x3bd0('0x17')]=qs[_0x3bd0('0x17')](_0x9a25e['query'][_0x3bd0('0x17')]);}return _0x4a2446[_0x3bd0('0xe1')](_0xb1843b);}})[_0x3bd0('0x1b')](function(_0x234b37){if(_0x234b37){return _0x234b37?{'count':_0x5e6288,'rows':_0x234b37}:null;}})[_0x3bd0('0x1b')](respondWithResult(_0x2fd53b,null))[_0x3bd0('0x50')](handleError(_0x2fd53b,null));};exports['login']=function(_0xce427,_0x141e65,_0x46a798){var _0x506df3;var _0x3864e2;var _0x32cad7;var _0x36df62=!_[_0x3bd0('0x60')](_0xce427['params']['id'])?_0xce427[_0x3bd0('0x55')]['id']:!_[_0x3bd0('0x60')](_0xce427['user']['id'])?_0xce427[_0x3bd0('0x23')]['id']:null;return db['User'][_0x3bd0('0x2b')]({'where':{'id':_0x36df62,'role':{'$or':[_0x3bd0('0x22'),_0x3bd0('0x23'),_0x3bd0('0x1d')]}},'attributes':['id',_0x3bd0('0x2c'),'phone',_0x3bd0('0xe3'),'role','internal',_0x3bd0('0x94')]})[_0x3bd0('0x1b')](function(_0x2f3bfa){if(_0x2f3bfa){if(_0x2f3bfa['role']===_0x3bd0('0x1d')){_0x506df3=_0x2f3bfa;if(_0xce427[_0x3bd0('0x54')]['interface']){_0x32cad7=util[_0x3bd0('0xa1')]('LOCAL/%s@from-sip/n',_0x506df3[_0xce427[_0x3bd0('0x54')]['interface']]);}else if(_0xce427[_0x3bd0('0x54')]['intrf']){_0x32cad7=util[_0x3bd0('0xa1')](_0x3bd0('0xa2'),_0xce427[_0x3bd0('0x54')]['intrf']);}else{_0x32cad7=util[_0x3bd0('0xa1')](_0x3bd0('0xa2'),_0x506df3['name']);}socket['to'](util['format'](_0x3bd0('0xe4'),_0x506df3[_0x3bd0('0x2c')]))[_0x3bd0('0x1e')]('user:forcelogout',{'user':{'id':_0x506df3['id'],'name':_0x506df3[_0x3bd0('0x2c')]},'ip':_0xce427['headers'][_0x3bd0('0xe5')]||_0xce427['connection'][_0x3bd0('0xe6')]||_0xce427[_0x3bd0('0xe7')][_0x3bd0('0xe6')]||_0xce427[_0x3bd0('0xe8')]['socket'][_0x3bd0('0xe6')]});return db[_0x3bd0('0xa4')][_0x3bd0('0x20')]({'where':{'membername':_0x506df3[_0x3bd0('0x2c')]},'individualHooks':!![]});}}else{throw new db[(_0x3bd0('0x87'))][(_0x3bd0('0x89'))](_0x3bd0('0xe9'));}})[_0x3bd0('0x1b')](function(){if(_0x506df3){return _0x506df3[_0x3bd0('0xea')]({'raw':!![]});}})['then'](function(_0x5d6074){if(_0x506df3){if(_0x5d6074){_0x3864e2=_0x5d6074;if(_0x3864e2['length']){var _0x38de65=_0x3864e2[_0x3bd0('0x32')](function(_0x5506e0){var _0x3f3ba7={'membername':_0x506df3[_0x3bd0('0x2c')],'UserId':_0x506df3['id'],'queue_name':_0x5506e0[_0x3bd0('0x2c')],'VoiceQueueId':_0x5506e0['id'],'interface':_0x32cad7,'paused':_0x506df3[_0x3bd0('0x94')]||![],'penalty':_0x5506e0[_0x3bd0('0xeb')]||0x0};return db[_0x3bd0('0xa4')]['upsert'](_0x3f3ba7);});return Promise[_0x3bd0('0x4f')](_0x38de65);}}}})[_0x3bd0('0x1b')](function(){if(_0x506df3){return db['MemberReport'][_0x3bd0('0x82')]({'where':{'membername':_0x506df3[_0x3bd0('0x2c')],'exitAt':null}});}})[_0x3bd0('0x1b')](function(_0x56b572){if(_0x506df3){var _0x374dda=[];_0x56b572[_0x3bd0('0xec')](function(_0x142a55){_0x374dda[_0x3bd0('0x45')](_0x142a55[_0x3bd0('0x53')]({'exitAt':moment()[_0x3bd0('0xa1')](_0x3bd0('0xed'))}));});return Promise[_0x3bd0('0x4f')](_0x374dda);}})[_0x3bd0('0x1b')](function(){if(_0x506df3){var _0x40d1f4=[];var _0x4b4e6a=[];var _0x256a98=utils['getChannels']();var _0x37b3d7={'membername':_0x506df3[_0x3bd0('0x2c')],'interface':_0x32cad7,'enterAt':moment()[_0x3bd0('0xa1')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x506df3[_0x3bd0('0x1c')],'internal':_0x506df3['internal']};_0x256a98[_0x3bd0('0xec')](function(_0x357aa5){_0x40d1f4[_0x3bd0('0x45')](_[_0x3bd0('0x52')]({'channel':_0x357aa5,'type':_0x3bd0('0xee'),'data1':_0xce427[_0x3bd0('0x54')][_0x3bd0('0xef')],'data2':_0x32cad7},_0x37b3d7));if(_0x506df3['loginInPause']){_0x4b4e6a[_0x3bd0('0x45')](_['merge']({'channel':_0x357aa5,'type':_0x3bd0('0xf0'),'data1':_0x3bd0('0xf1')},_0x37b3d7));}});return db[_0x3bd0('0xf2')][_0x3bd0('0x7f')](_0x40d1f4[_0x3bd0('0xc0')](_0x4b4e6a),{'individualHooks':!![]});}})[_0x3bd0('0x1b')](function(){if(_0x506df3){return _0x506df3[_0x3bd0('0x53')]({'online':!![],'lastLoginAt':moment()['format'](_0x3bd0('0xed')),'voicePause':_0x506df3['loginInPause']||![],'mailPause':_0x506df3[_0x3bd0('0x94')]||![],'chatPause':_0x506df3[_0x3bd0('0x94')]||![],'faxPause':_0x506df3[_0x3bd0('0x94')]||![],'smsPause':_0x506df3[_0x3bd0('0x94')]||![],'openchannelPause':_0x506df3[_0x3bd0('0x94')]||![],'whatsappPause':_0x506df3[_0x3bd0('0x94')]||![],'pauseType':_0x506df3[_0x3bd0('0x94')]?_0x3bd0('0xf1'):null,'interface':_0x32cad7,'lastPauseAt':moment()[_0x3bd0('0xa1')](_0x3bd0('0xed'))});}})['then'](function(_0x4888e3){if(_0xce427[_0x3bd0('0xf3')]){return _0x46a798();}else{return Promise['resolve'](_0x4888e3)[_0x3bd0('0x1b')](respondWithResult(_0x141e65,null));}})[_0x3bd0('0x50')](handleError(_0x141e65,null));};exports['logout']=function(_0x1e34c8,_0x5c6178){var _0x4f1d22;return db[_0x3bd0('0x30')][_0x3bd0('0x2b')]({'where':{'id':_0x1e34c8[_0x3bd0('0x55')]['id'],'role':_0x3bd0('0x1d')},'attributes':['id',_0x3bd0('0x2c'),_0x3bd0('0x1c')]})[_0x3bd0('0x1b')](handleEntityNotFound(_0x5c6178,null))[_0x3bd0('0x1b')](function(_0x5f214c){if(_0x5f214c){_0x4f1d22=_0x5f214c;return db[_0x3bd0('0xa4')]['destroy']({'where':{'membername':_0x4f1d22['name']},'individualHooks':!![]});}})[_0x3bd0('0x1b')](function(){return db[_0x3bd0('0xf2')]['findAll']({'where':{'membername':_0x4f1d22[_0x3bd0('0x2c')],'exitAt':null}});})[_0x3bd0('0x1b')](function(_0x39f129){var _0x27d2fe=[];_0x39f129[_0x3bd0('0xec')](function(_0x5fa440){_0x27d2fe[_0x3bd0('0x45')](_0x5fa440[_0x3bd0('0x53')]({'exitAt':moment()[_0x3bd0('0xa1')]('YYYY-MM-DD\x20HH:mm:ss')}));});return Promise[_0x3bd0('0x4f')](_0x27d2fe);})['then'](function(){return _0x4f1d22['update']({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0x3bd0('0x1b')](respondWithResult(_0x5c6178,null))[_0x3bd0('0x50')](handleError(_0x5c6178,null));};exports[_0x3bd0('0xf4')]=function(_0x52afb7,_0x36a189){var _0x2a7a36;return db[_0x3bd0('0xa4')]['update']({'paused':0x1},{'where':{'UserId':_0x52afb7[_0x3bd0('0x55')]['id']},'individualHooks':!![]})[_0x3bd0('0x1b')](function(){return db[_0x3bd0('0x30')]['find']({'where':{'id':_0x52afb7[_0x3bd0('0x55')]['id'],'role':'agent'},'attributes':['id',_0x3bd0('0x2c'),_0x3bd0('0x1c'),_0x3bd0('0x5e'),_0x3bd0('0xa0'),'online']});})[_0x3bd0('0x1b')](handleEntityNotFound(_0x36a189,null))[_0x3bd0('0x1b')](function(_0x171138){if(_0x171138){_0x2a7a36=_0x171138;return db[_0x3bd0('0xf2')][_0x3bd0('0x82')]({'where':{'membername':_0x2a7a36[_0x3bd0('0x2c')],'type':_0x3bd0('0xf0'),'exitAt':null}});}})[_0x3bd0('0x1b')](function(_0x45d2f0){if(_0x45d2f0[_0x3bd0('0x48')]){var _0x16509c=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');for(var _0x262c2d=0x0,_0x568842=_0x45d2f0['length'];_0x262c2d<_0x568842;_0x262c2d++){_0x45d2f0[_0x262c2d][_0x3bd0('0xf5')]({'exitAt':_0x16509c});}}})[_0x3bd0('0x1b')](function(){var _0x419495=[];var _0x15be9a=utils[_0x3bd0('0xf6')]();_0x15be9a[_0x3bd0('0xec')](function(_0xa71f61){_0x419495[_0x3bd0('0x45')]({'channel':_0xa71f61,'membername':_0x2a7a36[_0x3bd0('0x2c')],'interface':_['isNil'](_0x2a7a36[_0x3bd0('0xa0')])?util[_0x3bd0('0xa1')](_0x3bd0('0xa2'),_0x2a7a36['name']):_0x2a7a36[_0x3bd0('0xa0')],'type':_0x3bd0('0xf0'),'enterAt':moment()[_0x3bd0('0xa1')]('YYYY-MM-DD\x20HH:mm:ss'),'data1':_0x52afb7[_0x3bd0('0x54')]['type']||'DEFAULT\x20PAUSE','role':_0x2a7a36[_0x3bd0('0x1c')],'internal':_0x2a7a36[_0x3bd0('0x5e')]});});return db[_0x3bd0('0xf2')][_0x3bd0('0x7f')](_0x419495,{'individualHooks':!![]});})['then'](function(){return _0x2a7a36[_0x3bd0('0x53')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x52afb7[_0x3bd0('0x54')]['type']||_0x3bd0('0xf7'),'lastPauseAt':moment()[_0x3bd0('0xa1')](_0x3bd0('0xed'))});})[_0x3bd0('0x1b')](respondWithResult(_0x36a189,null))[_0x3bd0('0x50')](handleError(_0x36a189,null));};exports[_0x3bd0('0xf8')]=function(_0x107030,_0x2d2522){if(_0x107030[_0x3bd0('0x54')][_0x3bd0('0x93')]&&!utils[_0x3bd0('0x96')](_0x107030[_0x3bd0('0x54')][_0x3bd0('0x93')])){throw new APIBadRequestError(util[_0x3bd0('0xa1')](_0x3bd0('0xf9'),_0x107030[_0x3bd0('0x54')]['channel']));}return db[_0x3bd0('0x30')][_0x3bd0('0x2b')]({'where':{'id':_0x107030['params']['id']},'attributes':['id','name',_0x3bd0('0x1c'),_0x3bd0('0x5e'),_0x3bd0('0xa0'),_0x3bd0('0x9f'),'voicePause',_0x3bd0('0xfa'),_0x3bd0('0xfb'),_0x3bd0('0xfc'),_0x3bd0('0xfd'),_0x3bd0('0xfe'),'whatsappPause',_0x3bd0('0xff'),_0x3bd0('0x100')]})['then'](function(_0x2c398f){if(!_0x2c398f){throw new APINotFoundError(util['format']('User\x20with\x20id\x20%s\x20not\x20found',_0x107030[_0x3bd0('0x55')]['id']));}return _0x2c398f['unpause'](_0x107030[_0x3bd0('0x54')][_0x3bd0('0x93')]);})[_0x3bd0('0x1b')](respondWithResult(_0x2d2522,null))[_0x3bd0('0x50')](APIHandleError(_0x2d2522));};exports[_0x3bd0('0x101')]=function(_0x2ef423,_0x31674b){var _0x5f4f83={};var _0x547c68={};var _0x21c0cc;var _0x9f0e8e;return db[_0x3bd0('0x30')][_0x3bd0('0x8c')]({'where':{'id':_0x2ef423[_0x3bd0('0x55')]['id']}})[_0x3bd0('0x1b')](handleEntityNotFound(_0x31674b,null))[_0x3bd0('0x1b')](function(_0x261601){if(_0x261601){_0x21c0cc=_0x261601;_0x547c68['model']=_['keys'](db[_0x3bd0('0x102')][_0x3bd0('0x31')]);_0x547c68[_0x3bd0('0x3e')]=_[_0x3bd0('0xc8')](_0x2ef423[_0x3bd0('0x3e')]);_0x547c68[_0x3bd0('0xca')]=_['intersection'](_0x547c68[_0x3bd0('0xc7')],_0x547c68['query']);_0x5f4f83[_0x3bd0('0x44')]=_[_0x3bd0('0xcb')](_0x547c68[_0x3bd0('0xc7')],qs[_0x3bd0('0xcc')](_0x2ef423['query'][_0x3bd0('0xcc')]));_0x5f4f83[_0x3bd0('0x44')]=_0x5f4f83['attributes'][_0x3bd0('0x48')]?_0x5f4f83[_0x3bd0('0x44')]:_0x547c68[_0x3bd0('0xc7')];_0x5f4f83[_0x3bd0('0xcd')]=qs[_0x3bd0('0xd2')](_0x2ef423[_0x3bd0('0x3e')]['sort']);_0x5f4f83['where']=qs[_0x3bd0('0xca')](_[_0x3bd0('0xce')](_0x2ef423['query'],_0x547c68[_0x3bd0('0xca')]));if(_0x2ef423['query'][_0x3bd0('0x27')]){_0x5f4f83['where']=_[_0x3bd0('0x52')](_0x5f4f83['where'],{'$or':_[_0x3bd0('0x32')](_0x5f4f83[_0x3bd0('0x44')],function(_0x328858){var _0x857a97={};_0x857a97[_0x328858]={'$like':'%'+_0x2ef423[_0x3bd0('0x3e')][_0x3bd0('0x27')]+'%'};return _0x857a97;})});}_0x5f4f83=_['merge']({},_0x5f4f83,_0x2ef423[_0x3bd0('0xcf')]);return _0x21c0cc['getTeams'](_0x5f4f83);}})[_0x3bd0('0x1b')](function(_0x5738a1){if(_0x5738a1){_0x9f0e8e=_0x5738a1[_0x3bd0('0x48')];if(!_0x2ef423[_0x3bd0('0x3e')][_0x3bd0('0xc2')](_0x3bd0('0xd0'))){_0x5f4f83['limit']=qs[_0x3bd0('0x18')](_0x2ef423[_0x3bd0('0x3e')][_0x3bd0('0x18')]);_0x5f4f83[_0x3bd0('0x17')]=qs[_0x3bd0('0x17')](_0x2ef423[_0x3bd0('0x3e')][_0x3bd0('0x17')]);}return _0x21c0cc['getTeams'](_0x5f4f83);}})[_0x3bd0('0x1b')](function(_0x351333){if(_0x351333){return _0x351333?{'count':_0x9f0e8e,'rows':_0x351333}:null;}})[_0x3bd0('0x1b')](respondWithResult(_0x31674b,null))[_0x3bd0('0x50')](handleError(_0x31674b,null));};exports[_0x3bd0('0x103')]=function(_0x179a73,_0x26ffbd){var _0x14de87=_0x179a73[_0x3bd0('0x55')]['id'];var _0x2578fd=_0x179a73[_0x3bd0('0x54')]?_0x179a73[_0x3bd0('0x54')]['ids']:null;var _0x344e5a=[];return Promise[_0x3bd0('0x104')]()['then'](function(){if(!_0x2578fd)throw new APIBadRequestError('Body\x20parameter\x20\x27ids\x27\x20is\x20required');})[_0x3bd0('0x1b')](function(){return db[_0x3bd0('0x30')][_0x3bd0('0x8c')]({'where':{'id':_0x14de87}});})['then'](function(_0x5f1e8e){if(!_0x5f1e8e)throw new APINotFoundError(util[_0x3bd0('0xa1')](_0x3bd0('0xc1'),_0x179a73[_0x3bd0('0x55')]['id']));return db['sequelize'][_0x3bd0('0x105')](function(_0x461dba){return _0x5f1e8e['addTeams'](_0x2578fd,{'transaction':_0x461dba})['then'](function(){return db[_0x3bd0('0x102')][_0x3bd0('0x82')]({'where':{'id':{'$in':_0x2578fd}}});})[_0x3bd0('0x1b')](function(_0x2f9c2e){var _0x8208c3=_['map'](_0x2f9c2e,function(_0x1fc052){return _0x1fc052[_0x3bd0('0x106')]();});return Promise[_0x3bd0('0x4f')](_0x8208c3);})[_0x3bd0('0x1b')](function(_0x1ac03e){_0x344e5a=_[_0x3bd0('0x107')](_0x1ac03e);var _0x35db04=_[_0x3bd0('0x32')](_0x344e5a,function(_0x2e1a92){return _0x2e1a92[_0x3bd0('0x108')](_0x5f1e8e['id'],{'transaction':_0x461dba});});return Promise[_0x3bd0('0x4f')](_0x35db04);})[_0x3bd0('0x1b')](function(){if(!_0x5f1e8e[_0x3bd0('0x9f')])return;var _0x387b7a=_[_0x3bd0('0x27')](_0x344e5a,function(_0x2ec79b){return _0x2ec79b['getDataValue'](_0x3bd0('0x93'))===_0x3bd0('0x109');});var _0x10b529=_[_0x3bd0('0x32')](_0x387b7a,function(_0xc16233){return db['UserVoiceQueueRt']['upsert']({'membername':_0x5f1e8e[_0x3bd0('0x2c')],'UserId':_0x5f1e8e['id'],'queue_name':_0xc16233[_0x3bd0('0x2c')],'VoiceQueueId':_0xc16233['id'],'interface':_['isNil'](_0x5f1e8e[_0x3bd0('0xa0')])?util[_0x3bd0('0xa1')](_0x3bd0('0xa2'),_0x5f1e8e[_0x3bd0('0x2c')]):_0x5f1e8e[_0x3bd0('0xa0')],'paused':_0x5f1e8e[_0x3bd0('0x95')]||![],'penalty':_0x5f1e8e[_0x3bd0('0xa3')]},{'transaction':_0x461dba});});return Promise[_0x3bd0('0x4f')](_0x10b529);})[_0x3bd0('0x1b')](function(){return db[_0x3bd0('0x10a')]['findAll']({'where':{'teamId':{'$in':_0x2578fd}}});})[_0x3bd0('0x1b')](function(_0x3de85e){var _0xd0766=_[_0x3bd0('0x32')](_0x3de85e,function(_0x4bd264){return db['UserVoicePrefix'][_0x3bd0('0x75')]({'UserId':_0x5f1e8e['id'],'VoicePrefixId':_0x4bd264[_0x3bd0('0x10b')]},{'transaction':_0x461dba});});return Promise[_0x3bd0('0x4f')](_0xd0766);});});})[_0x3bd0('0x1b')](function(){for(var _0x19489b=0x0;_0x19489b<_0x344e5a[_0x3bd0('0x48')];_0x19489b++){var _0x46bf1d=_0x344e5a[_0x19489b][_0x3bd0('0x10c')](_0x3bd0('0x93'));var _0x2df8f9=_0x46bf1d+_0x3bd0('0xa8');socket['emit'](_0x3bd0('0x23')+_0x46bf1d+_0x3bd0('0x10d'),{'UserId':_0x14de87,['queueField']:_0x344e5a[_0x19489b]['id']});}})[_0x3bd0('0x1b')](respondWithStatusCode(_0x26ffbd,null))['catch'](APIHandleError(_0x26ffbd));};exports[_0x3bd0('0x10e')]=function(_0xc2dadf,_0x2f9357){var _0x2da3e6=_0xc2dadf['params']['id'];var _0x3686ec=null;if(_0xc2dadf['query']['ids']){_0x3686ec=_[_0x3bd0('0xa7')](_0xc2dadf[_0x3bd0('0x3e')][_0x3bd0('0x58')])?_0xc2dadf[_0x3bd0('0x3e')][_0x3bd0('0x58')]:[_0xc2dadf['query'][_0x3bd0('0x58')]];}var _0x257c16=[];return Promise[_0x3bd0('0x104')]()[_0x3bd0('0x1b')](function(){if(!_0x3686ec)throw new APIBadRequestError(_0x3bd0('0x10f'));})['then'](function(){return db[_0x3bd0('0x30')][_0x3bd0('0x8c')]({'where':{'id':_0x2da3e6}});})[_0x3bd0('0x1b')](function(_0xaa3fd9){if(!_0xaa3fd9)throw new APINotFoundError(util['format']('User\x20with\x20id\x20%s\x20not\x20found',_0xc2dadf[_0x3bd0('0x55')]['id']));return db['sequelize'][_0x3bd0('0x105')](function(_0xb0ba58){return _0xaa3fd9[_0x3bd0('0x10e')](_0x3686ec,{'transaction':_0xb0ba58})['then'](function(){return db['Team'][_0x3bd0('0x82')]({'where':{'id':{'$in':_0x3686ec}}});})[_0x3bd0('0x1b')](function(_0x35a2d2){var _0x5cb13c=_['map'](_0x35a2d2,function(_0x287979){return _0x287979[_0x3bd0('0x106')]();});return Promise[_0x3bd0('0x4f')](_0x5cb13c);})[_0x3bd0('0x1b')](function(_0x45b403){_0x257c16=_[_0x3bd0('0x107')](_0x45b403);var _0x2ea7b6=_['map'](_0x257c16,function(_0x215aa2){return _0x215aa2['removeAgent'](_0xaa3fd9['id'],{'transaction':_0xb0ba58});});return Promise['all'](_0x2ea7b6);})[_0x3bd0('0x1b')](function(){if(!_0xaa3fd9[_0x3bd0('0x9f')])return;var _0x39cf8d=_[_0x3bd0('0x27')](_0x257c16,function(_0x1e7404){return _0x1e7404[_0x3bd0('0x10c')](_0x3bd0('0x93'))==='Voice';});var _0x40166a=_[_0x3bd0('0x32')](_0x39cf8d,function(_0x2c1b70){return db[_0x3bd0('0xa4')][_0x3bd0('0x20')]({'where':{'VoiceQueueId':_0x2c1b70['id'],'UserId':_0xaa3fd9['id']},'transaction':_0xb0ba58});});return Promise[_0x3bd0('0x4f')](_0x40166a);})[_0x3bd0('0x1b')](function(){return db[_0x3bd0('0x10a')][_0x3bd0('0x82')]({'where':{'teamId':{'$in':_0x3686ec}}});})[_0x3bd0('0x1b')](function(_0x24d5b9){var _0x384041=_[_0x3bd0('0x32')](_0x24d5b9,function(_0x25b849){return db['UserVoicePrefix'][_0x3bd0('0x20')]({'where':{'UserId':_0xaa3fd9['id'],'VoicePrefixId':_0x25b849['VoicePrefixId']}},{'transaction':_0xb0ba58});});return Promise[_0x3bd0('0x4f')](_0x384041);});});})[_0x3bd0('0x1b')](function(){for(var _0x2b6003=0x0;_0x2b6003<_0x257c16[_0x3bd0('0x48')];_0x2b6003++){var _0x40cdba=_0x257c16[_0x2b6003][_0x3bd0('0x10c')](_0x3bd0('0x93'));var _0x9b311d=_0x40cdba+_0x3bd0('0xa8');socket[_0x3bd0('0x1e')](_0x3bd0('0x23')+_0x40cdba+'Queue:remove',{'UserId':_0x2da3e6,['queueField']:_0x257c16[_0x2b6003]['id']});}})[_0x3bd0('0x1b')](respondWithStatusCode(_0x2f9357,null))['catch'](APIHandleError(_0x2f9357));};exports[_0x3bd0('0x110')]=function(_0x3345b7,_0x9f1c8a){var _0x17baa2={};var _0x5c5cb2={};var _0x4487c5;var _0x465df6;return db[_0x3bd0('0x30')][_0x3bd0('0x8c')]({'where':{'id':_0x3345b7[_0x3bd0('0x55')]['id']}})[_0x3bd0('0x1b')](handleEntityNotFound(_0x9f1c8a,null))['then'](function(_0x1b6975){if(_0x1b6975){_0x4487c5=_0x1b6975;_0x5c5cb2[_0x3bd0('0xc7')]=_[_0x3bd0('0xc8')](db[_0x3bd0('0xc3')][_0x3bd0('0x31')]);_0x5c5cb2[_0x3bd0('0x3e')]=_[_0x3bd0('0xc8')](_0x3345b7['query']);_0x5c5cb2['filters']=_['intersection'](_0x5c5cb2[_0x3bd0('0xc7')],_0x5c5cb2[_0x3bd0('0x3e')]);_0x17baa2[_0x3bd0('0x44')]=_['intersection'](_0x5c5cb2[_0x3bd0('0xc7')],qs[_0x3bd0('0xcc')](_0x3345b7['query'][_0x3bd0('0xcc')]));_0x17baa2[_0x3bd0('0x44')]=_0x17baa2[_0x3bd0('0x44')][_0x3bd0('0x48')]?_0x17baa2['attributes']:_0x5c5cb2['model'];_0x17baa2[_0x3bd0('0xcd')]=qs[_0x3bd0('0xd2')](_0x3345b7[_0x3bd0('0x3e')][_0x3bd0('0xd2')]);_0x17baa2[_0x3bd0('0x3d')]=qs[_0x3bd0('0xca')](_[_0x3bd0('0xce')](_0x3345b7['query'],_0x5c5cb2[_0x3bd0('0xca')]));if(_0x3345b7[_0x3bd0('0x3e')][_0x3bd0('0x27')]){_0x17baa2[_0x3bd0('0x3d')]=_[_0x3bd0('0x52')](_0x17baa2[_0x3bd0('0x3d')],{'$or':_[_0x3bd0('0x32')](_0x17baa2[_0x3bd0('0x44')],function(_0x71be7a){var _0xfb27cc={};_0xfb27cc[_0x71be7a]={'$like':'%'+_0x3345b7[_0x3bd0('0x3e')]['filter']+'%'};return _0xfb27cc;})});}_0x17baa2=_[_0x3bd0('0x52')]({},_0x17baa2,_0x3345b7['options']);return _0x4487c5[_0x3bd0('0x110')](_0x17baa2);}})[_0x3bd0('0x1b')](function(_0x87c049){if(_0x87c049){_0x465df6=_0x87c049[_0x3bd0('0x48')];if(!_0x3345b7[_0x3bd0('0x3e')][_0x3bd0('0xc2')](_0x3bd0('0xd0'))){_0x17baa2['limit']=qs[_0x3bd0('0x18')](_0x3345b7['query'][_0x3bd0('0x18')]);_0x17baa2[_0x3bd0('0x17')]=qs[_0x3bd0('0x17')](_0x3345b7[_0x3bd0('0x3e')][_0x3bd0('0x17')]);}return _0x4487c5['getLists'](_0x17baa2);}})['then'](function(_0x858b00){if(_0x858b00){return _0x858b00?{'count':_0x465df6,'rows':_0x858b00}:null;}})['then'](respondWithResult(_0x9f1c8a,null))[_0x3bd0('0x50')](handleError(_0x9f1c8a,null));};exports['getAgents']=function(_0x477b4f,_0xe65f50){var _0x31a34f={};var _0x13f774={};var _0x4ef333;return db['User']['findOne']({'where':{'id':_0x477b4f[_0x3bd0('0x55')]['id']}})['then'](handleEntityNotFound(_0xe65f50,null))[_0x3bd0('0x1b')](function(_0x4032f4){if(_0x4032f4){_0x4ef333=_0x4032f4;_0x13f774[_0x3bd0('0xc7')]=_[_0x3bd0('0xc8')](db[_0x3bd0('0x30')][_0x3bd0('0x31')]);_0x13f774[_0x3bd0('0x3e')]=_[_0x3bd0('0xc8')](_0x477b4f[_0x3bd0('0x3e')]);_0x13f774[_0x3bd0('0xca')]=_[_0x3bd0('0xcb')](_0x13f774['model'],_0x13f774['query']);_0x31a34f['attributes']=_[_0x3bd0('0xcb')](_0x13f774[_0x3bd0('0xc7')],qs[_0x3bd0('0xcc')](_0x477b4f[_0x3bd0('0x3e')][_0x3bd0('0xcc')]));_0x31a34f[_0x3bd0('0x44')]=_0x31a34f['attributes'][_0x3bd0('0x48')]?_0x31a34f[_0x3bd0('0x44')]:_0x13f774[_0x3bd0('0xc7')];_0x31a34f[_0x3bd0('0xcd')]=qs[_0x3bd0('0xd2')](_0x477b4f[_0x3bd0('0x3e')]['sort']);_0x31a34f[_0x3bd0('0x3d')]=qs[_0x3bd0('0xca')](_[_0x3bd0('0xce')](_0x477b4f[_0x3bd0('0x3e')],_0x13f774[_0x3bd0('0xca')]));if(_0x477b4f[_0x3bd0('0x3e')]['filter']){_0x31a34f[_0x3bd0('0x3d')]=_['merge'](_0x31a34f[_0x3bd0('0x3d')],{'$or':_[_0x3bd0('0x32')](_0x31a34f[_0x3bd0('0x44')],function(_0x50f15d){var _0x463cd4={};_0x463cd4[_0x50f15d]={'$like':'%'+_0x477b4f[_0x3bd0('0x3e')][_0x3bd0('0x27')]+'%'};return _0x463cd4;})});}_0x31a34f['model']=db[_0x3bd0('0x30')];_0x31a34f['as']=_0x3bd0('0x24');_0x31a34f=_[_0x3bd0('0x52')]({},_0x31a34f,_0x477b4f[_0x3bd0('0xcf')]);return _0x4ef333[_0x3bd0('0xea')]({'include':[_0x31a34f]});}})[_0x3bd0('0x1b')](function(_0x385344){if(_0x385344){var _0x5c02db={},_0x266926=[];for(var _0x299259=0x0;_0x299259<_0x385344['length'];_0x299259+=0x1){for(var _0x5809ac=0x0,_0x3a7aa3;_0x5809ac<_0x385344[_0x299259][_0x3bd0('0x24')][_0x3bd0('0x48')];_0x5809ac+=0x1){_0x3a7aa3=_0x385344[_0x299259][_0x3bd0('0x24')][_0x5809ac][_0x3bd0('0x21')]({'plain':!![]});_0x5c02db[_0x3a7aa3['id']]=_0x3a7aa3;}}_0x5c02db=_[_0x3bd0('0x111')](_0x5c02db);for(var _0x4cf1aa=qs[_0x3bd0('0x17')](_0x477b4f[_0x3bd0('0x3e')]['offset']);_0x4cf1aa<_0x5c02db[_0x3bd0('0x48')]&&_0x266926[_0x3bd0('0x48')]=_0x28b418[_0xdebc('0x4d')]){throw new Error(_0xdebc('0x4e'));}})[_0xdebc('0x19')](function(){if(_0x443432){return db['UserVoiceQueueRt'][_0xdebc('0x4f')]({'where':{'membername':_0x443432[_0xdebc('0x24')]},'individualHooks':!![]});}})[_0xdebc('0x19')](function(){if(_0x443432){return _0x443432[_0xdebc('0x50')]({'raw':!![]});}})['then'](function(_0x56c601){if(_0x443432){if(_0x56c601){var _0x1a09ec=[];_0x75b82d=_0x56c601;if(_0x75b82d[_0xdebc('0x2d')]){for(var _0x2c29fe=0x0;_0x2c29fe<_0x75b82d[_0xdebc('0x2d')];_0x2c29fe++){_0x1a09ec[_0xdebc('0x31')](db['UserVoiceQueueRt'][_0xdebc('0x51')]({'membername':_0x443432[_0xdebc('0x24')],'UserId':_0x443432['id'],'queue_name':_0x75b82d[_0x2c29fe][_0xdebc('0x24')],'VoiceQueueId':_0x75b82d[_0x2c29fe]['id'],'interface':_0x3b4c1b,'paused':_0x443432['loginInPause']||![],'penalty':_0x75b82d[_0x2c29fe][_0xdebc('0x52')]||0x0}));}return BPromise[_0xdebc('0x53')](_0x1a09ec);}}}})[_0xdebc('0x19')](function(){if(_0x443432){return db[_0xdebc('0x2c')]['findAll']({'where':{'membername':_0x443432['name'],'exitAt':null}});}})[_0xdebc('0x19')](function(_0x357d52){if(_0x443432){if(_0x357d52&&_0x357d52[_0xdebc('0x2d')]){var _0xf7c2b0=[];_0x357d52[_0xdebc('0x30')](function(_0x5828b1){_0xf7c2b0[_0xdebc('0x31')](_0x5828b1[_0xdebc('0x2b')]({'exitAt':moment()['format'](_0xdebc('0x2e'))}));});return BPromise['all'](_0xf7c2b0);}}})[_0xdebc('0x19')](function(){if(_0x443432){var _0x116d54=[];var _0x28a884=[];var _0x49ce0f=utils[_0xdebc('0x54')]();var _0x372182={'membername':_0x443432[_0xdebc('0x24')],'interface':_0x3b4c1b,'enterAt':moment()[_0xdebc('0x27')](_0xdebc('0x2e')),'role':_0x443432[_0xdebc('0x25')],'internal':_0x443432[_0xdebc('0x3d')]};_0x49ce0f[_0xdebc('0x30')](function(_0x4efbde){_0x116d54[_0xdebc('0x31')](_[_0xdebc('0x55')]({'channel':_0x4efbde,'type':_0xdebc('0x56'),'data1':_0xdebc('0x57'),'data2':_0x3b4c1b},_0x372182));if(_0x443432[_0xdebc('0x49')]){_0x28a884[_0xdebc('0x31')](_['merge']({'channel':_0x4efbde,'type':_0xdebc('0x58'),'data1':_0xdebc('0x59')},_0x372182));}});return db[_0xdebc('0x2c')][_0xdebc('0x36')](_0x116d54[_0xdebc('0x5a')](_0x28a884),{'individualHooks':!![]});}})[_0xdebc('0x19')](function(){if(_0x443432){return _0x443432[_0xdebc('0x2b')]({'online':!![],'lastLoginAt':moment()[_0xdebc('0x27')](_0xdebc('0x2e')),'voicePause':_0x443432[_0xdebc('0x49')]||![],'mailPause':_0x443432[_0xdebc('0x49')]||![],'chatPause':_0x443432[_0xdebc('0x49')]||![],'faxPause':_0x443432[_0xdebc('0x49')]||![],'smsPause':_0x443432[_0xdebc('0x49')]||![],'openchannelPause':_0x443432[_0xdebc('0x49')]||![],'pauseType':_0x443432[_0xdebc('0x49')]?_0xdebc('0x59'):null,'lastPauseAt':moment()[_0xdebc('0x27')](_0xdebc('0x2e')),'interface':_0x3b4c1b});}})['then'](function(_0x5869b5){_0x38458a(_0x5869b5);})['catch'](function(_0x5d2be3){_0x3f8b9d(_0xfcbaaa[_0xdebc('0x21')](0x1f4,_0x5d2be3[_0xdebc('0x1d')]));});});}; \ No newline at end of file +var _0xe114=['error','message','User','find','raw','ShowUser','PauseUser','name','role','internal','interface','format','UserVoiceQueueRt','update','MemberReport','PAUSE','length','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','getChannels','forEach','push','isNil','SIP/%s','body','type','DEFAULT\x20PAUSE','uniqueid','bulkCreate','UnpauseUser','resolve','isValidChannel','Channel\x20parameter\x20%s\x20is\x20invalid','channel','findOne','online','voicePause','chatPause','faxPause','smsPause','whatsappPause','pauseType','lastPauseAt','User\x20with\x20id\x20%s\x20not\x20found','params','unpause','system','LogoutUser','destroy','all','LoginUser','mobile','phone','loginInPause','count','agent','../../config/license/util','getLicense','agents','Maximum\x20login\x20has\x20been\x20reached','getVoiceQueues','upsert','UserVoiceQueue.penalty','callysquare','merge','concat','LOGININPAUSE','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','redis','socket.io-emitter','register','findAll','options','where','attributes','limit','include','map','model','then','info','GetUser','stringify','catch'];(function(_0x266618,_0x18f637){var _0x54dbf5=function(_0x1f7985){while(--_0x1f7985){_0x266618['push'](_0x266618['shift']());}};_0x54dbf5(++_0x18f637);}(_0xe114,0x1b3));var _0x4e11=function(_0x1c28a3,_0x13217e){_0x1c28a3=_0x1c28a3-0x0;var _0x3a9d73=_0xe114[_0x1c28a3];return _0x3a9d73;};'use strict';var _=require(_0x4e11('0x0'));var util=require('util');var moment=require(_0x4e11('0x1'));var BPromise=require(_0x4e11('0x2'));var Redis=require(_0x4e11('0x3'));var db=require(_0x4e11('0x4'))['db'];var utils=require(_0x4e11('0x5'));var logger=require(_0x4e11('0x6'))(_0x4e11('0x7'));var config=require(_0x4e11('0x8'));config[_0x4e11('0x9')]=_['defaults'](config[_0x4e11('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x4e11('0xa'))(new Redis(config[_0x4e11('0x9')]));require('./user.socket')[_0x4e11('0xb')](socket);exports['GetUser']=function(_0x202fc0){var _0x5f1b86=this;return new Promise(function(_0x4b8b41,_0x17ac9e){return db['User'][_0x4e11('0xc')]({'raw':_0x202fc0['options']?_0x202fc0['options']['raw']===undefined?!![]:![]:!![],'where':_0x202fc0[_0x4e11('0xd')]?_0x202fc0['options'][_0x4e11('0xe')]||null:null,'attributes':_0x202fc0[_0x4e11('0xd')]?_0x202fc0[_0x4e11('0xd')][_0x4e11('0xf')]||null:null,'limit':_0x202fc0[_0x4e11('0xd')]?_0x202fc0['options'][_0x4e11('0x10')]||null:null,'include':_0x202fc0[_0x4e11('0xd')]?_0x202fc0[_0x4e11('0xd')][_0x4e11('0x11')]?_[_0x4e11('0x12')](_0x202fc0['options'][_0x4e11('0x11')],function(_0x1a0763){return{'model':db[_0x1a0763[_0x4e11('0x13')]],'as':_0x1a0763['as'],'attributes':_0x1a0763['attributes'],'include':_0x1a0763[_0x4e11('0x11')]?_['map'](_0x1a0763['include'],function(_0x5c35d7){return{'model':db[_0x5c35d7[_0x4e11('0x13')]],'as':_0x5c35d7['as'],'attributes':_0x5c35d7[_0x4e11('0xf')],'include':_0x5c35d7[_0x4e11('0x11')]?_[_0x4e11('0x12')](_0x5c35d7[_0x4e11('0x11')],function(_0x7d54d){return{'model':db[_0x7d54d['model']],'as':_0x7d54d['as'],'attributes':_0x7d54d['attributes']};}):[]};}):[]};}):[]:[]})[_0x4e11('0x14')](function(_0x43665f){logger[_0x4e11('0x15')](_0x4e11('0x16'),_0x202fc0);logger['debug'](_0x4e11('0x16'),_0x202fc0,JSON[_0x4e11('0x17')](_0x43665f));_0x4b8b41(_0x43665f);})[_0x4e11('0x18')](function(_0x4c62c8){logger[_0x4e11('0x19')](_0x4e11('0x16'),_0x4c62c8[_0x4e11('0x1a')],_0x202fc0);_0x17ac9e(_0x5f1b86[_0x4e11('0x19')](0x1f4,_0x4c62c8[_0x4e11('0x1a')]));});});};exports['ShowUser']=function(_0x55055a){var _0x545dea=this;return new Promise(function(_0x12a565,_0xb04569){return db[_0x4e11('0x1b')][_0x4e11('0x1c')]({'raw':_0x55055a[_0x4e11('0xd')]?_0x55055a[_0x4e11('0xd')][_0x4e11('0x1d')]===undefined?!![]:![]:!![],'where':_0x55055a[_0x4e11('0xd')]?_0x55055a['options'][_0x4e11('0xe')]||null:null,'attributes':_0x55055a[_0x4e11('0xd')]?_0x55055a[_0x4e11('0xd')][_0x4e11('0xf')]||null:null,'include':_0x55055a[_0x4e11('0xd')]?_0x55055a[_0x4e11('0xd')]['include']?_['map'](_0x55055a[_0x4e11('0xd')][_0x4e11('0x11')],function(_0x24f820){return{'model':db[_0x24f820[_0x4e11('0x13')]],'as':_0x24f820['as'],'attributes':_0x24f820[_0x4e11('0xf')],'include':_0x24f820[_0x4e11('0x11')]?_[_0x4e11('0x12')](_0x24f820[_0x4e11('0x11')],function(_0x5d6d08){return{'model':db[_0x5d6d08[_0x4e11('0x13')]],'as':_0x5d6d08['as'],'attributes':_0x5d6d08[_0x4e11('0xf')],'include':_0x5d6d08[_0x4e11('0x11')]?_['map'](_0x5d6d08['include'],function(_0x473cf8){return{'model':db[_0x473cf8[_0x4e11('0x13')]],'as':_0x473cf8['as'],'attributes':_0x473cf8[_0x4e11('0xf')]};}):[]};}):[]};}):[]:[]})[_0x4e11('0x14')](function(_0x3f889c){logger[_0x4e11('0x15')](_0x4e11('0x1e'),_0x55055a);logger['debug'](_0x4e11('0x1e'),_0x55055a,JSON[_0x4e11('0x17')](_0x3f889c));_0x12a565(_0x3f889c);})['catch'](function(_0x5df5af){logger['error'](_0x4e11('0x1e'),_0x5df5af[_0x4e11('0x1a')],_0x55055a);_0xb04569(_0x545dea['error'](0x1f4,_0x5df5af[_0x4e11('0x1a')]));});});};exports[_0x4e11('0x1f')]=function(_0xf9d15d){var _0x523553;return db['User']['find']({'where':_0xf9d15d[_0x4e11('0xd')][_0x4e11('0xe')]||{},'attributes':['id',_0x4e11('0x20'),_0x4e11('0x21'),_0x4e11('0x22'),_0x4e11('0x23')]})['then'](function(_0x102bbc){if(!_0x102bbc){throw new Error(util[_0x4e11('0x24')]('User\x20with\x20id\x20%s\x20not\x20found',_0xf9d15d['params']['id']));}_0x523553=_0x102bbc;return db[_0x4e11('0x25')][_0x4e11('0x26')]({'paused':0x1},{'where':{'UserId':_0x523553['id']},'individualHooks':!![]});})[_0x4e11('0x14')](function(){return db[_0x4e11('0x27')]['findAll']({'where':{'membername':_0x523553[_0x4e11('0x20')],'type':_0x4e11('0x28'),'exitAt':null}});})['then'](function(_0x1148ff){if(_0x1148ff&&_0x1148ff[_0x4e11('0x29')]){var _0x3169d0=moment()['format'](_0x4e11('0x2a'));for(var _0x3f89e2=0x0,_0x445beb=_0x1148ff[_0x4e11('0x29')];_0x3f89e2<_0x445beb;_0x3f89e2++){_0x1148ff[_0x3f89e2][_0x4e11('0x2b')]({'exitAt':_0x3169d0});}}})[_0x4e11('0x14')](function(){var _0x3abb03=[];var _0x3f5fbc=utils[_0x4e11('0x2c')]();_0x3f5fbc[_0x4e11('0x2d')](function(_0xfb915){_0x3abb03[_0x4e11('0x2e')]({'channel':_0xfb915,'membername':_0x523553[_0x4e11('0x20')],'interface':_[_0x4e11('0x2f')](_0x523553[_0x4e11('0x23')])?util[_0x4e11('0x24')](_0x4e11('0x30'),_0x523553['name']):_0x523553[_0x4e11('0x23')],'type':_0x4e11('0x28'),'enterAt':moment()[_0x4e11('0x24')](_0x4e11('0x2a')),'data1':_0xf9d15d[_0x4e11('0x31')][_0x4e11('0x32')]||_0x4e11('0x33'),'role':_0x523553[_0x4e11('0x21')],'internal':_0x523553[_0x4e11('0x22')],'uniqueid':_0xf9d15d[_0x4e11('0x31')][_0x4e11('0x34')]||null});});return db[_0x4e11('0x27')][_0x4e11('0x35')](_0x3abb03,{'individualHooks':!![]});})['then'](function(){return _0x523553[_0x4e11('0x26')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'whatsappPause':!![],'pauseType':_0xf9d15d[_0x4e11('0x31')][_0x4e11('0x32')]||'DEFAULT\x20PAUSE','lastPauseAt':moment()[_0x4e11('0x24')](_0x4e11('0x2a'))});})[_0x4e11('0x18')](function(_0x138cc3){throw _0x138cc3;});};exports[_0x4e11('0x36')]=function(_0x8e87df){return Promise[_0x4e11('0x37')]()[_0x4e11('0x14')](function(){if(_0x8e87df[_0x4e11('0x31')]['channel']&&!utils[_0x4e11('0x38')](_0x8e87df[_0x4e11('0x31')]['channel'])){throw new Error(util[_0x4e11('0x24')](_0x4e11('0x39'),_0x8e87df[_0x4e11('0x31')][_0x4e11('0x3a')]));}return db[_0x4e11('0x1b')][_0x4e11('0x3b')]({'where':_0x8e87df[_0x4e11('0xd')][_0x4e11('0xe')]||{},'attributes':['id',_0x4e11('0x20'),_0x4e11('0x21'),_0x4e11('0x22'),_0x4e11('0x23'),_0x4e11('0x3c'),_0x4e11('0x3d'),'mailPause',_0x4e11('0x3e'),_0x4e11('0x3f'),'openchannelPause',_0x4e11('0x40'),_0x4e11('0x41'),_0x4e11('0x42'),_0x4e11('0x43')]});})['then'](function(_0x2ff298){if(!_0x2ff298){throw new Error(util[_0x4e11('0x24')](_0x4e11('0x44'),_0x8e87df[_0x4e11('0x45')]['id']));}return _0x2ff298[_0x4e11('0x46')](_0x8e87df[_0x4e11('0x31')][_0x4e11('0x3a')],_0x4e11('0x47'));})[_0x4e11('0x18')](function(_0xf2b55a){throw _0xf2b55a;});};exports[_0x4e11('0x48')]=function(_0x14c656){var _0x3b6b68=this;return new Promise(function(_0x267619,_0x2f2f2a){var _0x2d2587;return db['User'][_0x4e11('0x3b')]({'where':_0x14c656[_0x4e11('0xd')][_0x4e11('0xe')]||{},'attributes':['id','name']})['then'](function(_0x3671fa){if(_0x3671fa){_0x2d2587=_0x3671fa;return db[_0x4e11('0x25')][_0x4e11('0x49')]({'where':{'membername':_0x2d2587[_0x4e11('0x20')]},'individualHooks':!![]});}})[_0x4e11('0x14')](function(){if(_0x2d2587){return db[_0x4e11('0x27')]['findAll']({'where':{'membername':_0x2d2587[_0x4e11('0x20')],'exitAt':null}});}})[_0x4e11('0x14')](function(_0x46b9f2){if(_0x2d2587){if(_0x46b9f2&&_0x46b9f2['length']){var _0x40573f=[];_0x46b9f2[_0x4e11('0x2d')](function(_0x521ca5){_0x40573f[_0x4e11('0x2e')](_0x521ca5[_0x4e11('0x26')]({'exitAt':moment()['format'](_0x4e11('0x2a'))}));});return BPromise[_0x4e11('0x4a')](_0x40573f);}}})[_0x4e11('0x14')](function(){if(_0x2d2587){return _0x2d2587[_0x4e11('0x26')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})[_0x4e11('0x14')](function(_0x6d3182){_0x267619(_0x6d3182);})[_0x4e11('0x18')](function(_0x126a71){_0x2f2f2a(_0x3b6b68[_0x4e11('0x19')](0x1f4,_0x126a71[_0x4e11('0x1a')]));});});};exports[_0x4e11('0x4b')]=function(_0xedd9da){var _0x2c9e7f=this;return new Promise(function(_0x38849b,_0x2004a7){var _0x54be0a;var _0x1d58c7;var _0x26cd6b;var _0xf4bb57;return db['User']['findOne']({'where':_0xedd9da[_0x4e11('0xd')]['where']||{},'attributes':['id',_0x4e11('0x20'),_0x4e11('0x21'),_0x4e11('0x4c'),_0x4e11('0x4d'),_0x4e11('0x22'),_0x4e11('0x4e'),'interface']})[_0x4e11('0x14')](function(_0x2be516){if(_0x2be516){_0x54be0a=_0x2be516;_0xf4bb57=_0xedd9da[_0x4e11('0x31')]['interface']?_0xedd9da['body'][_0x4e11('0x23')]:util[_0x4e11('0x24')](_0x4e11('0x30'),_0x54be0a[_0x4e11('0x20')]);return db['User'][_0x4e11('0x4f')]({'where':{'role':_0x4e11('0x50'),'online':!![],'id':{'$ne':_0x54be0a['id']}}});}})[_0x4e11('0x14')](function(_0x5ad497){if(_0x5ad497){_0x26cd6b=_0x5ad497;return require(_0x4e11('0x51'))[_0x4e11('0x52')]();}})[_0x4e11('0x14')](function(_0x518bcd){if(_0x518bcd&&_0x518bcd['agents']&&_0x26cd6b>=_0x518bcd[_0x4e11('0x53')]){throw new Error(_0x4e11('0x54'));}})['then'](function(){if(_0x54be0a){return db['UserVoiceQueueRt'][_0x4e11('0x49')]({'where':{'membername':_0x54be0a[_0x4e11('0x20')]},'individualHooks':!![]});}})[_0x4e11('0x14')](function(){if(_0x54be0a){return _0x54be0a[_0x4e11('0x55')]({'raw':!![]});}})['then'](function(_0xd4477e){if(_0x54be0a){if(_0xd4477e){var _0x384472=[];_0x1d58c7=_0xd4477e;if(_0x1d58c7[_0x4e11('0x29')]){for(var _0x31d5b1=0x0;_0x31d5b1<_0x1d58c7['length'];_0x31d5b1++){_0x384472['push'](db[_0x4e11('0x25')][_0x4e11('0x56')]({'membername':_0x54be0a['name'],'UserId':_0x54be0a['id'],'queue_name':_0x1d58c7[_0x31d5b1][_0x4e11('0x20')],'VoiceQueueId':_0x1d58c7[_0x31d5b1]['id'],'interface':_0xf4bb57,'paused':_0x54be0a[_0x4e11('0x4e')]||![],'penalty':_0x1d58c7[_0x31d5b1][_0x4e11('0x57')]||0x0}));}return BPromise[_0x4e11('0x4a')](_0x384472);}}}})[_0x4e11('0x14')](function(){if(_0x54be0a){return db['MemberReport'][_0x4e11('0xc')]({'where':{'membername':_0x54be0a[_0x4e11('0x20')],'exitAt':null}});}})[_0x4e11('0x14')](function(_0x3f2787){if(_0x54be0a){if(_0x3f2787&&_0x3f2787[_0x4e11('0x29')]){var _0x13f30d=[];_0x3f2787['forEach'](function(_0x19a03f){_0x13f30d[_0x4e11('0x2e')](_0x19a03f[_0x4e11('0x26')]({'exitAt':moment()['format'](_0x4e11('0x2a'))}));});return BPromise[_0x4e11('0x4a')](_0x13f30d);}}})[_0x4e11('0x14')](function(){if(_0x54be0a){var _0x42321d=[];var _0xe7004f=[];var _0x212472=utils['getChannels']();var _0x58cda3={'membername':_0x54be0a[_0x4e11('0x20')],'interface':_0xf4bb57,'enterAt':moment()['format'](_0x4e11('0x2a')),'role':_0x54be0a['role'],'internal':_0x54be0a[_0x4e11('0x22')]};_0x212472[_0x4e11('0x2d')](function(_0x33efc9){_0x42321d['push'](_['merge']({'channel':_0x33efc9,'type':'LOGIN','data1':_0x4e11('0x58'),'data2':_0xf4bb57},_0x58cda3));if(_0x54be0a[_0x4e11('0x4e')]){_0xe7004f[_0x4e11('0x2e')](_[_0x4e11('0x59')]({'channel':_0x33efc9,'type':_0x4e11('0x28'),'data1':'LOGININPAUSE'},_0x58cda3));}});return db['MemberReport'][_0x4e11('0x35')](_0x42321d[_0x4e11('0x5a')](_0xe7004f),{'individualHooks':!![]});}})[_0x4e11('0x14')](function(){if(_0x54be0a){return _0x54be0a['update']({'online':!![],'lastLoginAt':moment()[_0x4e11('0x24')]('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0x54be0a[_0x4e11('0x4e')]||![],'mailPause':_0x54be0a[_0x4e11('0x4e')]||![],'chatPause':_0x54be0a[_0x4e11('0x4e')]||![],'faxPause':_0x54be0a['loginInPause']||![],'smsPause':_0x54be0a[_0x4e11('0x4e')]||![],'openchannelPause':_0x54be0a[_0x4e11('0x4e')]||![],'pauseType':_0x54be0a[_0x4e11('0x4e')]?_0x4e11('0x5b'):null,'lastPauseAt':moment()[_0x4e11('0x24')](_0x4e11('0x2a')),'interface':_0xf4bb57});}})[_0x4e11('0x14')](function(_0x51b7ec){_0x38849b(_0x51b7ec);})[_0x4e11('0x18')](function(_0x4cbf49){_0x2004a7(_0x2c9e7f['error'](0x1f4,_0x4cbf49['message']));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index d7b885b..08fc1ac 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 _0xdb77=['emit','removeListener','register','user:','save','remove'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xdb77,0xb8));var _0x7db7=function(_0x25bfc0,_0x2a9e01){_0x25bfc0=_0x25bfc0-0x0;var _0x41395d=_0xdb77[_0x25bfc0];return _0x41395d;};'use strict';var UserEvents=require('./user.events');var events=[_0x7db7('0x0'),_0x7db7('0x1'),'update'];function createListener(_0x1aa7e9,_0x126906){return function(_0x39c787){_0x126906[_0x7db7('0x2')](_0x1aa7e9,_0x39c787);};}function removeListener(_0x478f15,_0x4ff382){return function(){UserEvents[_0x7db7('0x3')](_0x478f15,_0x4ff382);};}exports[_0x7db7('0x4')]=function(_0x30d6d6){for(var _0x101305=0x0,_0x2f70f7=events['length'];_0x101305<_0x2f70f7;_0x101305++){var _0x1915a7=events[_0x101305];var _0x5727f2=createListener(_0x7db7('0x5')+_0x1915a7,_0x30d6d6);UserEvents['on'](_0x1915a7,_0x5727f2);}}; \ No newline at end of file +var _0x2e95=['length','user:','./user.events','remove','update','emit','register'];(function(_0x183245,_0xecb018){var _0x72a0c1=function(_0x56c74a){while(--_0x56c74a){_0x183245['push'](_0x183245['shift']());}};_0x72a0c1(++_0xecb018);}(_0x2e95,0x1ad));var _0x52e9=function(_0x3df223,_0x1740fc){_0x3df223=_0x3df223-0x0;var _0x562d11=_0x2e95[_0x3df223];return _0x562d11;};'use strict';var UserEvents=require(_0x52e9('0x0'));var events=['save',_0x52e9('0x1'),_0x52e9('0x2')];function createListener(_0x48c645,_0x239fed){return function(_0x13fde3){_0x239fed[_0x52e9('0x3')](_0x48c645,_0x13fde3);};}function removeListener(_0x814104,_0x3ad589){return function(){UserEvents['removeListener'](_0x814104,_0x3ad589);};}exports[_0x52e9('0x4')]=function(_0x221dd3){for(var _0x5cba6c=0x0,_0x4c2e17=events[_0x52e9('0x5')];_0x5cba6c<_0x4c2e17;_0x5cba6c++){var _0x5b3b94=events[_0x5cba6c];var _0x5de067=createListener(_0x52e9('0x6')+_0x5b3b94,_0x221dd3);UserEvents['on'](_0x5b3b94,_0x5de067);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index f10b455..2cbac31 100644 --- a/server/api/userChatQueue/index.js +++ b/server/api/userChatQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x109de0,_0x110f6d){var _0x118357=function(_0x3ef478){while(--_0x3ef478){_0x109de0['push'](_0x109de0['shift']());}};_0x118357(++_0x110f6d);}(_0xe706,0xa3));var _0x6e70=function(_0x3a7bdf,_0x58bdd8){_0x3a7bdf=_0x3a7bdf-0x0;var _0x35a9a8=_0xe706[_0x3a7bdf];return _0x35a9a8;};'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 _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x599856,_0x37d1df){var _0x5d9917=function(_0x49e0f3){while(--_0x49e0f3){_0x599856['push'](_0x599856['shift']());}};_0x5d9917(++_0x37d1df);}(_0x70e0,0x17b));var _0x070e=function(_0x1bbaf0,_0x592f6a){_0x1bbaf0=_0x1bbaf0-0x0;var _0x498d48=_0x70e0[_0x1bbaf0];return _0x498d48;};'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/userChatQueue/userChatQueue.attributes.js b/server/api/userChatQueue/userChatQueue.attributes.js index 58798e3..f8fb223 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 _0xea85=['INTEGER','sequelize','exports'];(function(_0x474058,_0x4e1fc5){var _0x15f033=function(_0x172070){while(--_0x172070){_0x474058['push'](_0x474058['shift']());}};_0x15f033(++_0x4e1fc5);}(_0xea85,0x1ea));var _0x5ea8=function(_0x127771,_0x26020a){_0x127771=_0x127771-0x0;var _0x948cee=_0xea85[_0x127771];return _0x948cee;};'use strict';var Sequelize=require(_0x5ea8('0x0'));module[_0x5ea8('0x1')]={'penalty':{'type':Sequelize[_0x5ea8('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xdae9=['exports','sequelize'];(function(_0x24dfb7,_0x2bf1bf){var _0x525851=function(_0xa8a946){while(--_0xa8a946){_0x24dfb7['push'](_0x24dfb7['shift']());}};_0x525851(++_0x2bf1bf);}(_0xdae9,0x12b));var _0x9dae=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0xdae9[_0x47a7d0];return _0xb9bd08;};'use strict';var Sequelize=require(_0x9dae('0x0'));module[_0x9dae('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'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 5259942..fe4148f 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 _0x50f0=['define','UserChatQueue','user_has_chat_queues','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./userChatQueue.attributes','exports'];(function(_0x6a89d9,_0x57b654){var _0x56d771=function(_0x4dc322){while(--_0x4dc322){_0x6a89d9['push'](_0x6a89d9['shift']());}};_0x56d771(++_0x57b654);}(_0x50f0,0x1bd));var _0x050f=function(_0x1f3aec,_0x24c18e){_0x1f3aec=_0x1f3aec-0x0;var _0x409f0d=_0x50f0[_0x1f3aec];return _0x409f0d;};'use strict';var _=require('lodash');var util=require(_0x050f('0x0'));var logger=require(_0x050f('0x1'))(_0x050f('0x2'));var moment=require('moment');var BPromise=require(_0x050f('0x3'));var rp=require(_0x050f('0x4'));var fs=require('fs');var path=require(_0x050f('0x5'));var rimraf=require(_0x050f('0x6'));var config=require(_0x050f('0x7'));var attributes=require(_0x050f('0x8'));module[_0x050f('0x9')]=function(_0x4d5bee,_0x4e8a65){return _0x4d5bee[_0x050f('0xa')](_0x050f('0xb'),attributes,{'tableName':_0x050f('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x384c=['rimraf','../../config/environment','./userChatQueue.attributes','exports','define','UserChatQueue','lodash','util','../../config/logger','request-promise','path'];(function(_0x576312,_0x5ab20c){var _0x266476=function(_0x153e9f){while(--_0x153e9f){_0x576312['push'](_0x576312['shift']());}};_0x266476(++_0x5ab20c);}(_0x384c,0x166));var _0xc384=function(_0x310316,_0x475b0c){_0x310316=_0x310316-0x0;var _0x1b280a=_0x384c[_0x310316];return _0x1b280a;};'use strict';var _=require(_0xc384('0x0'));var util=require(_0xc384('0x1'));var logger=require(_0xc384('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xc384('0x3'));var fs=require('fs');var path=require(_0xc384('0x4'));var rimraf=require(_0xc384('0x5'));var config=require(_0xc384('0x6'));var attributes=require(_0xc384('0x7'));module[_0xc384('0x8')]=function(_0x13332c,_0x6babd4){return _0x13332c[_0xc384('0x9')](_0xc384('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 76e27da..cc8477e 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 _0x2712=['rpc','../../config/environment','jayson/promise','request','then','info','UserChatQueue,\x20%s,\x20%s','request\x20sent','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2712,0x19e));var _0x2271=function(_0x4b769c,_0x541b21){_0x4b769c=_0x4b769c-0x0;var _0x490a31=_0x2712[_0x4b769c];return _0x490a31;};'use strict';var _=require(_0x2271('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x2271('0x1'));var rs=require(_0x2271('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2271('0x3'))['db'];var utils=require(_0x2271('0x4'));var logger=require(_0x2271('0x5'))(_0x2271('0x6'));var config=require(_0x2271('0x7'));var jayson=require(_0x2271('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x546d1c,_0x3a671f,_0x78c076){return new BPromise(function(_0x526b31,_0x3c5680){return client[_0x2271('0x9')](_0x546d1c,_0x78c076)[_0x2271('0xa')](function(_0x8165e1){logger[_0x2271('0xb')](_0x2271('0xc'),_0x3a671f,_0x2271('0xd'));logger[_0x2271('0xe')](_0x2271('0xf'),_0x3a671f,'request\x20sent',JSON[_0x2271('0x10')](_0x8165e1));if(_0x8165e1[_0x2271('0x11')]){if(_0x8165e1[_0x2271('0x11')]['code']===0x1f4){logger[_0x2271('0x11')](_0x2271('0xc'),_0x3a671f,_0x8165e1['error']['message']);return _0x3c5680(_0x8165e1[_0x2271('0x11')][_0x2271('0x12')]);}logger[_0x2271('0x11')](_0x2271('0xc'),_0x3a671f,_0x8165e1['error']['message']);return _0x526b31(_0x8165e1[_0x2271('0x11')][_0x2271('0x12')]);}else{logger[_0x2271('0xb')]('UserChatQueue,\x20%s,\x20%s',_0x3a671f,'request\x20sent');_0x526b31(_0x8165e1[_0x2271('0x13')][_0x2271('0x12')]);}})['catch'](function(_0x5be2ef){logger[_0x2271('0x11')](_0x2271('0xc'),_0x3a671f,_0x5be2ef);_0x3c5680(_0x5be2ef);});});} \ No newline at end of file +var _0x0ca9=['ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','UserChatQueue,\x20%s,\x20%s','request\x20sent','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','error','code','message','info','result','util','moment','bluebird','randomstring'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x0ca9,0xee));var _0x90ca=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x0ca9[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require(_0x90ca('0x0'));var moment=require(_0x90ca('0x1'));var BPromise=require(_0x90ca('0x2'));var rs=require(_0x90ca('0x3'));var fs=require('fs');var Redis=require(_0x90ca('0x4'));var db=require(_0x90ca('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x90ca('0x6'))(_0x90ca('0x7'));var config=require(_0x90ca('0x8'));var jayson=require(_0x90ca('0x9'));var client=jayson['client'][_0x90ca('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3dd5c6,_0xa1c53a,_0x456481){return new BPromise(function(_0xb09b17,_0x389069){return client[_0x90ca('0xb')](_0x3dd5c6,_0x456481)[_0x90ca('0xc')](function(_0x4a473f){logger['info'](_0x90ca('0xd'),_0xa1c53a,_0x90ca('0xe'));logger[_0x90ca('0xf')](_0x90ca('0x10'),_0xa1c53a,_0x90ca('0xe'),JSON['stringify'](_0x4a473f));if(_0x4a473f[_0x90ca('0x11')]){if(_0x4a473f[_0x90ca('0x11')][_0x90ca('0x12')]===0x1f4){logger[_0x90ca('0x11')]('UserChatQueue,\x20%s,\x20%s',_0xa1c53a,_0x4a473f[_0x90ca('0x11')][_0x90ca('0x13')]);return _0x389069(_0x4a473f[_0x90ca('0x11')][_0x90ca('0x13')]);}logger['error'](_0x90ca('0xd'),_0xa1c53a,_0x4a473f[_0x90ca('0x11')][_0x90ca('0x13')]);return _0xb09b17(_0x4a473f[_0x90ca('0x11')][_0x90ca('0x13')]);}else{logger[_0x90ca('0x14')](_0x90ca('0xd'),_0xa1c53a,_0x90ca('0xe'));_0xb09b17(_0x4a473f[_0x90ca('0x15')]['message']);}})['catch'](function(_0x51bfe2){logger[_0x90ca('0x11')](_0x90ca('0xd'),_0xa1c53a,_0x51bfe2);_0x389069(_0x51bfe2);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index fd0c920..de14361 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 _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x3fa4b4,_0x435846){var _0x160c23=function(_0x371c51){while(--_0x371c51){_0x3fa4b4['push'](_0x3fa4b4['shift']());}};_0x160c23(++_0x435846);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x328534,_0x33b41e){_0x328534=_0x328534-0x0;var _0x2796c0=_0xcb91[_0x328534];return _0x2796c0;};'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 _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x3180da,_0x53a63d){var _0x10f321=function(_0x18bd07){while(--_0x18bd07){_0x3180da['push'](_0x3180da['shift']());}};_0x10f321(++_0x53a63d);}(_0xe706,0xa3));var _0x6e70=function(_0x3216f5,_0xe32e8a){_0x3216f5=_0x3216f5-0x0;var _0x17035a=_0xe706[_0x3216f5];return _0x17035a;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.attributes.js b/server/api/userFaxQueue/userFaxQueue.attributes.js index 3a89261..2d6ce17 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 _0x87c2=['exports','INTEGER','STRING'];(function(_0x710d6f,_0x469528){var _0x1c2271=function(_0x11d047){while(--_0x11d047){_0x710d6f['push'](_0x710d6f['shift']());}};_0x1c2271(++_0x469528);}(_0x87c2,0xbd));var _0x287c=function(_0x12b896,_0x842bfd){_0x12b896=_0x12b896-0x0;var _0x19884c=_0x87c2[_0x12b896];return _0x19884c;};'use strict';var Sequelize=require('sequelize');module[_0x287c('0x0')]={'penalty':{'type':Sequelize[_0x287c('0x1')],'defaultValue':0x0},'assigned':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'queue':{'type':Sequelize[_0x287c('0x2')]}}; \ No newline at end of file +var _0x97e2=['INTEGER','exports'];(function(_0x13e758,_0x317d23){var _0x5b53c3=function(_0x103e80){while(--_0x103e80){_0x13e758['push'](_0x13e758['shift']());}};_0x5b53c3(++_0x317d23);}(_0x97e2,0x1ef));var _0x297e=function(_0x3da359,_0x42cf0f){_0x3da359=_0x3da359-0x0;var _0x4f8a10=_0x97e2[_0x3da359];return _0x4f8a10;};'use strict';var Sequelize=require('sequelize');module[_0x297e('0x0')]={'penalty':{'type':Sequelize[_0x297e('0x1')],'defaultValue':0x0},'assigned':{'type':Sequelize['INTEGER'],'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 1d1231d..ca35eec 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 _0xdf69=['../../config/logger','bluebird','request-promise','path','../../config/environment','./userFaxQueue.attributes','exports','define','lodash'];(function(_0x4ca7c2,_0x3928b9){var _0x2a3d78=function(_0x627669){while(--_0x627669){_0x4ca7c2['push'](_0x4ca7c2['shift']());}};_0x2a3d78(++_0x3928b9);}(_0xdf69,0xe9));var _0x9df6=function(_0x2f33b3,_0x1c789d){_0x2f33b3=_0x2f33b3-0x0;var _0x31276c=_0xdf69[_0x2f33b3];return _0x31276c;};'use strict';var _=require(_0x9df6('0x0'));var util=require('util');var logger=require(_0x9df6('0x1'))('api');var moment=require('moment');var BPromise=require(_0x9df6('0x2'));var rp=require(_0x9df6('0x3'));var fs=require('fs');var path=require(_0x9df6('0x4'));var rimraf=require('rimraf');var config=require(_0x9df6('0x5'));var attributes=require(_0x9df6('0x6'));module[_0x9df6('0x7')]=function(_0x4cfab4,_0x16dd03){return _0x4cfab4[_0x9df6('0x8')]('UserFaxQueue',attributes,{'tableName':'user_has_fax_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1322=['../../config/environment','./userFaxQueue.attributes','exports','define','UserFaxQueue','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x21aec3,_0x5c97e9){var _0x288bbc=function(_0x2283fe){while(--_0x2283fe){_0x21aec3['push'](_0x21aec3['shift']());}};_0x288bbc(++_0x5c97e9);}(_0x1322,0xfc));var _0x2132=function(_0xb24a3e,_0x4a3594){_0xb24a3e=_0xb24a3e-0x0;var _0x4038d7=_0x1322[_0xb24a3e];return _0x4038d7;};'use strict';var _=require(_0x2132('0x0'));var util=require(_0x2132('0x1'));var logger=require(_0x2132('0x2'))(_0x2132('0x3'));var moment=require(_0x2132('0x4'));var BPromise=require('bluebird');var rp=require(_0x2132('0x5'));var fs=require('fs');var path=require(_0x2132('0x6'));var rimraf=require(_0x2132('0x7'));var config=require(_0x2132('0x8'));var attributes=require(_0x2132('0x9'));module[_0x2132('0xa')]=function(_0x18b85a,_0xf35e6b){return _0x18b85a[_0x2132('0xb')](_0x2132('0xc'),attributes,{'tableName':'user_has_fax_queues','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 b6a54e1..6e95181 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 _0x31ba=['UserFaxQueue,\x20%s,\x20%s','request\x20sent','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x31ba,0x69));var _0xa31b=function(_0x132558,_0x521d93){_0x132558=_0x132558-0x0;var _0x34f138=_0x31ba[_0x132558];return _0x34f138;};'use strict';var _=require('lodash');var util=require(_0xa31b('0x0'));var moment=require(_0xa31b('0x1'));var BPromise=require(_0xa31b('0x2'));var rs=require(_0xa31b('0x3'));var fs=require('fs');var Redis=require(_0xa31b('0x4'));var db=require(_0xa31b('0x5'))['db'];var utils=require(_0xa31b('0x6'));var logger=require(_0xa31b('0x7'))('rpc');var config=require(_0xa31b('0x8'));var jayson=require(_0xa31b('0x9'));var client=jayson[_0xa31b('0xa')][_0xa31b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3105e3,_0x4334b2,_0x2cb403){return new BPromise(function(_0x4d15c6,_0x532818){return client[_0xa31b('0xc')](_0x3105e3,_0x2cb403)[_0xa31b('0xd')](function(_0x1e1210){logger[_0xa31b('0xe')](_0xa31b('0xf'),_0x4334b2,_0xa31b('0x10'));logger[_0xa31b('0x11')](_0xa31b('0x12'),_0x4334b2,_0xa31b('0x10'),JSON[_0xa31b('0x13')](_0x1e1210));if(_0x1e1210['error']){if(_0x1e1210[_0xa31b('0x14')][_0xa31b('0x15')]===0x1f4){logger[_0xa31b('0x14')](_0xa31b('0xf'),_0x4334b2,_0x1e1210[_0xa31b('0x14')][_0xa31b('0x16')]);return _0x532818(_0x1e1210[_0xa31b('0x14')][_0xa31b('0x16')]);}logger[_0xa31b('0x14')]('UserFaxQueue,\x20%s,\x20%s',_0x4334b2,_0x1e1210['error'][_0xa31b('0x16')]);return _0x4d15c6(_0x1e1210[_0xa31b('0x14')]['message']);}else{logger['info'](_0xa31b('0xf'),_0x4334b2,_0xa31b('0x10'));_0x4d15c6(_0x1e1210['result']['message']);}})[_0xa31b('0x17')](function(_0x5419b9){logger['error']('UserFaxQueue,\x20%s,\x20%s',_0x4334b2,_0x5419b9);_0x532818(_0x5419b9);});});} \ No newline at end of file +var _0x21b8=['message','info','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','http','then','UserFaxQueue,\x20%s,\x20%s','request\x20sent','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x2295fa,_0x53f01b){var _0xcdd3b7=function(_0x3dbd2e){while(--_0x3dbd2e){_0x2295fa['push'](_0x2295fa['shift']());}};_0xcdd3b7(++_0x53f01b);}(_0x21b8,0xf6));var _0x821b=function(_0x357287,_0x368265){_0x357287=_0x357287-0x0;var _0x168be1=_0x21b8[_0x357287];return _0x168be1;};'use strict';var _=require(_0x821b('0x0'));var util=require(_0x821b('0x1'));var moment=require(_0x821b('0x2'));var BPromise=require('bluebird');var rs=require(_0x821b('0x3'));var fs=require('fs');var Redis=require(_0x821b('0x4'));var db=require(_0x821b('0x5'))['db'];var utils=require(_0x821b('0x6'));var logger=require('../../config/logger')(_0x821b('0x7'));var config=require('../../config/environment');var jayson=require(_0x821b('0x8'));var client=jayson['client'][_0x821b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x459b18,_0xa961c2,_0x556803){return new BPromise(function(_0x3194b6,_0x556198){return client['request'](_0x459b18,_0x556803)[_0x821b('0xa')](function(_0x16e9a8){logger['info'](_0x821b('0xb'),_0xa961c2,_0x821b('0xc'));logger[_0x821b('0xd')](_0x821b('0xe'),_0xa961c2,_0x821b('0xc'),JSON[_0x821b('0xf')](_0x16e9a8));if(_0x16e9a8[_0x821b('0x10')]){if(_0x16e9a8[_0x821b('0x10')][_0x821b('0x11')]===0x1f4){logger['error'](_0x821b('0xb'),_0xa961c2,_0x16e9a8[_0x821b('0x10')]['message']);return _0x556198(_0x16e9a8[_0x821b('0x10')][_0x821b('0x12')]);}logger[_0x821b('0x10')](_0x821b('0xb'),_0xa961c2,_0x16e9a8['error'][_0x821b('0x12')]);return _0x3194b6(_0x16e9a8[_0x821b('0x10')][_0x821b('0x12')]);}else{logger[_0x821b('0x13')](_0x821b('0xb'),_0xa961c2,_0x821b('0xc'));_0x3194b6(_0x16e9a8[_0x821b('0x14')][_0x821b('0x12')]);}})[_0x821b('0x15')](function(_0x1fe776){logger[_0x821b('0x10')](_0x821b('0xb'),_0xa961c2,_0x1fe776);_0x556198(_0x1fe776);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index d5762f0..b3bbce3 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 _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x568fc4,_0x3d32ed){var _0x4b6254=function(_0x3aee45){while(--_0x3aee45){_0x568fc4['push'](_0x568fc4['shift']());}};_0x4b6254(++_0x3d32ed);}(_0x70e0,0x17b));var _0x070e=function(_0x1e3c6f,_0x1d6113){_0x1e3c6f=_0x1e3c6f-0x0;var _0x253464=_0x70e0[_0x1e3c6f];return _0x253464;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file +var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0xb98d8d,_0x481423){var _0x489b15=function(_0x409a13){while(--_0x409a13){_0xb98d8d['push'](_0xb98d8d['shift']());}};_0x489b15(++_0x481423);}(_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/userMailQueue/userMailQueue.attributes.js b/server/api/userMailQueue/userMailQueue.attributes.js index 04405c1..4d8b098 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 _0xb9ce=['sequelize','exports'];(function(_0x35960a,_0x4f7957){var _0x3c2913=function(_0x11354f){while(--_0x11354f){_0x35960a['push'](_0x35960a['shift']());}};_0x3c2913(++_0x4f7957);}(_0xb9ce,0x10c));var _0xeb9c=function(_0x4f7773,_0x47f366){_0x4f7773=_0x4f7773-0x0;var _0x50dab8=_0xb9ce[_0x4f7773];return _0x50dab8;};'use strict';var Sequelize=require(_0xeb9c('0x0'));module[_0xeb9c('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x1a2a=['exports','INTEGER','sequelize'];(function(_0x359def,_0x5abd96){var _0x30412d=function(_0x4a4725){while(--_0x4a4725){_0x359def['push'](_0x359def['shift']());}};_0x30412d(++_0x5abd96);}(_0x1a2a,0x83));var _0xa1a2=function(_0x125425,_0x4b6bab){_0x125425=_0x125425-0x0;var _0xd04dc4=_0x1a2a[_0x125425];return _0xd04dc4;};'use strict';var Sequelize=require(_0xa1a2('0x0'));module[_0xa1a2('0x1')]={'penalty':{'type':Sequelize[_0xa1a2('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 4e1280a..d68c6db 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 _0xeeff=['moment','request-promise','rimraf','../../config/environment','./userMailQueue.attributes','exports','UserMailQueue','user_has_mail_queues','lodash','api'];(function(_0x23af31,_0x8a1add){var _0x49b82f=function(_0x5d08d5){while(--_0x5d08d5){_0x23af31['push'](_0x23af31['shift']());}};_0x49b82f(++_0x8a1add);}(_0xeeff,0xd0));var _0xfeef=function(_0x2a3872,_0x44ccd4){_0x2a3872=_0x2a3872-0x0;var _0x59ffb2=_0xeeff[_0x2a3872];return _0x59ffb2;};'use strict';var _=require(_0xfeef('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xfeef('0x1'));var moment=require(_0xfeef('0x2'));var BPromise=require('bluebird');var rp=require(_0xfeef('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xfeef('0x4'));var config=require(_0xfeef('0x5'));var attributes=require(_0xfeef('0x6'));module[_0xfeef('0x7')]=function(_0x57b406,_0x308fa3){return _0x57b406['define'](_0xfeef('0x8'),attributes,{'tableName':_0xfeef('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcc89=['./userMailQueue.attributes','define','user_has_mail_queues','lodash','../../config/logger','moment','../../config/environment'];(function(_0x531b1e,_0x301978){var _0x1208b6=function(_0x3af74a){while(--_0x3af74a){_0x531b1e['push'](_0x531b1e['shift']());}};_0x1208b6(++_0x301978);}(_0xcc89,0x1df));var _0x9cc8=function(_0x2c9874,_0x1b596e){_0x2c9874=_0x2c9874-0x0;var _0x4f52e7=_0xcc89[_0x2c9874];return _0x4f52e7;};'use strict';var _=require(_0x9cc8('0x0'));var util=require('util');var logger=require(_0x9cc8('0x1'))('api');var moment=require(_0x9cc8('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x9cc8('0x3'));var attributes=require(_0x9cc8('0x4'));module['exports']=function(_0x2d6990,_0x58b55a){return _0x2d6990[_0x9cc8('0x5')]('UserMailQueue',attributes,{'tableName':_0x9cc8('0x6'),'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 5cb4526..37a1c72 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 _0x6aa7=['result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','client','request','then','info','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x289457,_0x39dc5d){var _0x125568=function(_0x4dd4c4){while(--_0x4dd4c4){_0x289457['push'](_0x289457['shift']());}};_0x125568(++_0x39dc5d);}(_0x6aa7,0x178));var _0x76aa=function(_0x414da9,_0x414e99){_0x414da9=_0x414da9-0x0;var _0x3bb7db=_0x6aa7[_0x414da9];return _0x3bb7db;};'use strict';var _=require(_0x76aa('0x0'));var util=require('util');var moment=require(_0x76aa('0x1'));var BPromise=require(_0x76aa('0x2'));var rs=require(_0x76aa('0x3'));var fs=require('fs');var Redis=require(_0x76aa('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x76aa('0x5'));var logger=require(_0x76aa('0x6'))(_0x76aa('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x76aa('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x32dee5,_0x36d12b,_0xa9b695){return new BPromise(function(_0x56d6bc,_0x3dae33){return client[_0x76aa('0x9')](_0x32dee5,_0xa9b695)[_0x76aa('0xa')](function(_0x557d69){logger[_0x76aa('0xb')](_0x76aa('0xc'),_0x36d12b,_0x76aa('0xd'));logger[_0x76aa('0xe')](_0x76aa('0xf'),_0x36d12b,_0x76aa('0xd'),JSON[_0x76aa('0x10')](_0x557d69));if(_0x557d69[_0x76aa('0x11')]){if(_0x557d69[_0x76aa('0x11')][_0x76aa('0x12')]===0x1f4){logger['error'](_0x76aa('0xc'),_0x36d12b,_0x557d69['error'][_0x76aa('0x13')]);return _0x3dae33(_0x557d69[_0x76aa('0x11')][_0x76aa('0x13')]);}logger[_0x76aa('0x11')](_0x76aa('0xc'),_0x36d12b,_0x557d69['error']['message']);return _0x56d6bc(_0x557d69[_0x76aa('0x11')]['message']);}else{logger[_0x76aa('0xb')](_0x76aa('0xc'),_0x36d12b,'request\x20sent');_0x56d6bc(_0x557d69[_0x76aa('0x14')]['message']);}})[_0x76aa('0x15')](function(_0x5181d2){logger[_0x76aa('0x11')](_0x76aa('0xc'),_0x36d12b,_0x5181d2);_0x3dae33(_0x5181d2);});});} \ No newline at end of file +var _0x6aa7=['result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','client','request','then','info','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x566c8a,_0x34da6c){var _0xc82ae8=function(_0xa8795c){while(--_0xa8795c){_0x566c8a['push'](_0x566c8a['shift']());}};_0xc82ae8(++_0x34da6c);}(_0x6aa7,0x178));var _0x76aa=function(_0x2cd4fd,_0x4cbc8b){_0x2cd4fd=_0x2cd4fd-0x0;var _0x406b68=_0x6aa7[_0x2cd4fd];return _0x406b68;};'use strict';var _=require(_0x76aa('0x0'));var util=require('util');var moment=require(_0x76aa('0x1'));var BPromise=require(_0x76aa('0x2'));var rs=require(_0x76aa('0x3'));var fs=require('fs');var Redis=require(_0x76aa('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x76aa('0x5'));var logger=require(_0x76aa('0x6'))(_0x76aa('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x76aa('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x32dee5,_0x36d12b,_0xa9b695){return new BPromise(function(_0x56d6bc,_0x3dae33){return client[_0x76aa('0x9')](_0x32dee5,_0xa9b695)[_0x76aa('0xa')](function(_0x557d69){logger[_0x76aa('0xb')](_0x76aa('0xc'),_0x36d12b,_0x76aa('0xd'));logger[_0x76aa('0xe')](_0x76aa('0xf'),_0x36d12b,_0x76aa('0xd'),JSON[_0x76aa('0x10')](_0x557d69));if(_0x557d69[_0x76aa('0x11')]){if(_0x557d69[_0x76aa('0x11')][_0x76aa('0x12')]===0x1f4){logger['error'](_0x76aa('0xc'),_0x36d12b,_0x557d69['error'][_0x76aa('0x13')]);return _0x3dae33(_0x557d69[_0x76aa('0x11')][_0x76aa('0x13')]);}logger[_0x76aa('0x11')](_0x76aa('0xc'),_0x36d12b,_0x557d69['error']['message']);return _0x56d6bc(_0x557d69[_0x76aa('0x11')]['message']);}else{logger[_0x76aa('0xb')](_0x76aa('0xc'),_0x36d12b,'request\x20sent');_0x56d6bc(_0x557d69[_0x76aa('0x14')]['message']);}})[_0x76aa('0x15')](function(_0x5181d2){logger[_0x76aa('0x11')](_0x76aa('0xc'),_0x36d12b,_0x5181d2);_0x3dae33(_0x5181d2);});});} \ No newline at end of file diff --git a/server/api/userNotification/index.js b/server/api/userNotification/index.js index 8b7e0be..e495add 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 _0x2200=['../../components/interaction/service','../../config/environment','./userNotification.controller','post','isAuthenticated','util','path','connect-timeout','Router','fs-extra','../../components/auth/service'];(function(_0x32f05c,_0x273aef){var _0x4307ed=function(_0x1be4da){while(--_0x1be4da){_0x32f05c['push'](_0x32f05c['shift']());}};_0x4307ed(++_0x273aef);}(_0x2200,0x144));var _0x0220=function(_0x3ccdf8,_0x584ceb){_0x3ccdf8=_0x3ccdf8-0x0;var _0x243dab=_0x2200[_0x3ccdf8];return _0x243dab;};'use strict';var multer=require('multer');var util=require(_0x0220('0x0'));var path=require(_0x0220('0x1'));var timeout=require(_0x0220('0x2'));var express=require('express');var router=express[_0x0220('0x3')]();var fs_extra=require(_0x0220('0x4'));var auth=require(_0x0220('0x5'));var interaction=require(_0x0220('0x6'));var config=require(_0x0220('0x7'));var controller=require(_0x0220('0x8'));router[_0x0220('0x9')]('/',auth[_0x0220('0xa')](),controller['sendUserNotification']);module['exports']=router; \ No newline at end of file +var _0xc838=['../../components/auth/service','./userNotification.controller','isAuthenticated','sendUserNotification','exports','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x5bb1ed,_0x488623){var _0x357bdb=function(_0x3e4662){while(--_0x3e4662){_0x5bb1ed['push'](_0x5bb1ed['shift']());}};_0x357bdb(++_0x488623);}(_0xc838,0x179));var _0x8c83=function(_0x1935bc,_0x160450){_0x1935bc=_0x1935bc-0x0;var _0x1a04d8=_0xc838[_0x1935bc];return _0x1a04d8;};'use strict';var multer=require(_0x8c83('0x0'));var util=require(_0x8c83('0x1'));var path=require(_0x8c83('0x2'));var timeout=require(_0x8c83('0x3'));var express=require(_0x8c83('0x4'));var router=express[_0x8c83('0x5')]();var fs_extra=require(_0x8c83('0x6'));var auth=require(_0x8c83('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x8c83('0x8'));router['post']('/',auth[_0x8c83('0x9')](),controller[_0x8c83('0xa')]);module[_0x8c83('0xb')]=router; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.attributes.js b/server/api/userNotification/userNotification.attributes.js index f3f4cdc..7b09fe5 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 _0x398c=['TEXT','STRING','sequelize','exports'];(function(_0x1a8bf0,_0x50d0dd){var _0x1d7007=function(_0x1ac3fb){while(--_0x1ac3fb){_0x1a8bf0['push'](_0x1a8bf0['shift']());}};_0x1d7007(++_0x50d0dd);}(_0x398c,0xfe));var _0xc398=function(_0x381665,_0x1bbc3a){_0x381665=_0x381665-0x0;var _0x23f81d=_0x398c[_0x381665];return _0x23f81d;};'use strict';var Sequelize=require(_0xc398('0x0'));module[_0xc398('0x1')]={'body':{'type':Sequelize[_0xc398('0x2')]},'senderName':{'type':Sequelize[_0xc398('0x3')]},'recipientsId':{'type':Sequelize[_0xc398('0x2')]},'recipientsDescription':{'type':Sequelize[_0xc398('0x3')]},'beep':{'type':Sequelize['BOOLEAN']}}; \ No newline at end of file +var _0x4b12=['TEXT','STRING'];(function(_0x268421,_0x29336d){var _0x46ace0=function(_0x8cd6ec){while(--_0x8cd6ec){_0x268421['push'](_0x268421['shift']());}};_0x46ace0(++_0x29336d);}(_0x4b12,0xda));var _0x24b1=function(_0x25ca60,_0x5ea135){_0x25ca60=_0x25ca60-0x0;var _0x1088e6=_0x4b12[_0x25ca60];return _0x1088e6;};'use strict';var Sequelize=require('sequelize');module['exports']={'body':{'type':Sequelize[_0x24b1('0x0')]},'senderName':{'type':Sequelize[_0x24b1('0x1')]},'recipientsId':{'type':Sequelize[_0x24b1('0x0')]},'recipientsDescription':{'type':Sequelize[_0x24b1('0x1')]},'beep':{'type':Sequelize['BOOLEAN']}}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.controller.js b/server/api/userNotification/userNotification.controller.js index a5b48a6..b0d50f8 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 _0x0edb=['User','ids','queue','replace','Queue','push','union','flatten','eml-format','fast-json-patch','moment','bluebird','mustache','util','path','sox','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','defaults','redis','localhost','./userNotification.socket','sendStatus','status','end','offset','undefined','limit','count','json','apply','update','then','destroy','error','stack','name','send','sendUserNotification','body','hasOwnProperty','text','TemplateId','Sequelize','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','view','Missing\x20\x27view\x27\x20parameter','recipients','Missing\x20\x27recipients\x27\x20parameter','Invalid\x20\x27recipients\x27\x20object','faxqueue','mailqueue','openchannelqueue','smsqueue','voicequeue','whatsappqueue','team','user','some','includes','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname','recipientsDescription','beep','recipientsId','sortBy','join','UserNotification','create','forEach','recipient','emit','catch','findOne','Invalid\x20\x27TemplateId\x27\x20parameter','render'];(function(_0x12347c,_0x574f79){var _0x2a656e=function(_0x255d50){while(--_0x255d50){_0x12347c['push'](_0x12347c['shift']());}};_0x2a656e(++_0x574f79);}(_0x0edb,0x67));var _0xb0ed=function(_0x136e6e,_0xd871e4){_0x136e6e=_0x136e6e-0x0;var _0x43086e=_0x0edb[_0x136e6e];return _0x43086e;};'use strict';var emlformat=require(_0xb0ed('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xb0ed('0x1'));var rp=require('request-promise');var moment=require(_0xb0ed('0x2'));var BPromise=require(_0xb0ed('0x3'));var Mustache=require(_0xb0ed('0x4'));var util=require(_0xb0ed('0x5'));var path=require(_0xb0ed('0x6'));var sox=require(_0xb0ed('0x7'));var csv=require('to-csv');var ejs=require(_0xb0ed('0x8'));var fs=require('fs');var fs_extra=require(_0xb0ed('0x9'));var _=require(_0xb0ed('0xa'));var squel=require(_0xb0ed('0xb'));var crypto=require('crypto');var jsforce=require(_0xb0ed('0xc'));var deskjs=require(_0xb0ed('0xd'));var toCsv=require(_0xb0ed('0xe'));var querystring=require(_0xb0ed('0xf'));var Papa=require('papaparse');var Redis=require(_0xb0ed('0x10'));var authService=require(_0xb0ed('0x11'));var qs=require(_0xb0ed('0x12'));var as=require(_0xb0ed('0x13'));var hardwareService=require(_0xb0ed('0x14'));var logger=require(_0xb0ed('0x15'))(_0xb0ed('0x16'));var utils=require(_0xb0ed('0x17'));var config=require(_0xb0ed('0x18'));var licenseUtil=require(_0xb0ed('0x19'));var db=require('../../mysqldb')['db'];config['redis']=_[_0xb0ed('0x1a')](config[_0xb0ed('0x1b')],{'host':_0xb0ed('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xb0ed('0x1d'))['register'](socket);function respondWithStatusCode(_0x3e4f12,_0x2d2a06){_0x2d2a06=_0x2d2a06||0xcc;return function(_0x2e303a){if(_0x2e303a){return _0x3e4f12[_0xb0ed('0x1e')](_0x2d2a06);}return _0x3e4f12[_0xb0ed('0x1f')](_0x2d2a06)[_0xb0ed('0x20')]();};}function respondWithResult(_0x4a7cc5,_0x58321a){_0x58321a=_0x58321a||0xc8;return function(_0x175296){if(_0x175296){return _0x4a7cc5[_0xb0ed('0x1f')](_0x58321a)['json'](_0x175296);}};}function respondWithFilteredResult(_0x37dbf2,_0x3aa7a1){return function(_0x1c65bc){if(_0x1c65bc){var _0x338079=typeof _0x3aa7a1[_0xb0ed('0x21')]===_0xb0ed('0x22')&&typeof _0x3aa7a1[_0xb0ed('0x23')]===_0xb0ed('0x22');var _0x568b32=_0x1c65bc[_0xb0ed('0x24')];var _0x43e969=_0x338079?0x0:_0x3aa7a1[_0xb0ed('0x21')];var _0x1292c0=_0x338079?_0x1c65bc['count']:_0x3aa7a1[_0xb0ed('0x21')]+_0x3aa7a1['limit'];var _0x46ab71;if(_0x1292c0>=_0x568b32){_0x1292c0=_0x568b32;_0x46ab71=0xc8;}else{_0x46ab71=0xce;}_0x37dbf2[_0xb0ed('0x1f')](_0x46ab71);return _0x37dbf2['set']('Content-Range',_0x43e969+'-'+_0x1292c0+'/'+_0x568b32)[_0xb0ed('0x25')](_0x1c65bc);}return null;};}function patchUpdates(_0x132ed2){return function(_0x126ac1){try{jsonpatch[_0xb0ed('0x26')](_0x126ac1,_0x132ed2,!![]);}catch(_0x323f5e){return BPromise['reject'](_0x323f5e);}return _0x126ac1['save']();};}function saveUpdates(_0xc19fca,_0x7f7363){return function(_0x1d9996){if(_0x1d9996){return _0x1d9996[_0xb0ed('0x27')](_0xc19fca)[_0xb0ed('0x28')](function(_0x5e00b0){return _0x5e00b0;});}return null;};}function removeEntity(_0x430bd8,_0x790721){return function(_0x3eb9dd){if(_0x3eb9dd){return _0x3eb9dd[_0xb0ed('0x29')]()['then'](function(){_0x430bd8[_0xb0ed('0x1f')](0xcc)[_0xb0ed('0x20')]();});}};}function handleEntityNotFound(_0x4905b4,_0x37fef6){return function(_0x30490a){if(!_0x30490a){_0x4905b4[_0xb0ed('0x1e')](0x194);}return _0x30490a;};}function handleError(_0x2f8602,_0x5e8022){_0x5e8022=_0x5e8022||0x1f4;return function(_0x420cd9){logger[_0xb0ed('0x2a')](_0x420cd9[_0xb0ed('0x2b')]);if(_0x420cd9['name']){delete _0x420cd9[_0xb0ed('0x2c')];}_0x2f8602[_0xb0ed('0x1f')](_0x5e8022)[_0xb0ed('0x2d')](_0x420cd9);};}exports[_0xb0ed('0x2e')]=function(_0x34ab0b,_0x99bc1b,_0xa57a96){if(!_0x34ab0b[_0xb0ed('0x2f')][_0xb0ed('0x30')](_0xb0ed('0x31'))&&!_0x34ab0b[_0xb0ed('0x2f')]['hasOwnProperty'](_0xb0ed('0x32'))){throw new db[(_0xb0ed('0x33'))][(_0xb0ed('0x34'))](_0xb0ed('0x35'));}else{if(_0x34ab0b[_0xb0ed('0x2f')][_0xb0ed('0x30')](_0xb0ed('0x32'))&&!_0x34ab0b['body'][_0xb0ed('0x30')](_0xb0ed('0x36'))){throw new db[(_0xb0ed('0x33'))][(_0xb0ed('0x34'))](_0xb0ed('0x37'));}if(!_0x34ab0b[_0xb0ed('0x2f')][_0xb0ed('0x30')](_0xb0ed('0x38'))){throw new db[(_0xb0ed('0x33'))]['ValidationError'](_0xb0ed('0x39'));}else{try{var _0x5a825b=JSON['parse'](_0x34ab0b[_0xb0ed('0x2f')][_0xb0ed('0x38')]);}catch(_0x50b00d){logger['error'](_0x50b00d);throw new db[(_0xb0ed('0x33'))]['ValidationError'](_0xb0ed('0x3a'));}var _0xf83e11=['chatqueue',_0xb0ed('0x3b'),_0xb0ed('0x3c'),_0xb0ed('0x3d'),_0xb0ed('0x3e'),_0xb0ed('0x3f'),_0xb0ed('0x40'),_0xb0ed('0x41'),_0xb0ed('0x42')];if(_[_0xb0ed('0x43')](_0x5a825b,function(_0x36097b){return!_[_0xb0ed('0x44')](_0xf83e11,_0x36097b['model'][_0xb0ed('0x45')]());})){throw new db[(_0xb0ed('0x33'))][(_0xb0ed('0x34'))](_0xb0ed('0x46'));}}}var _0x118fd9={};_0x118fd9[_0xb0ed('0x47')]=_0x34ab0b[_0xb0ed('0x2f')][_0xb0ed('0x30')](_0xb0ed('0x47'))?_0x34ab0b[_0xb0ed('0x2f')][_0xb0ed('0x47')]:_0x34ab0b[_0xb0ed('0x42')][_0xb0ed('0x48')];_0x118fd9[_0xb0ed('0x49')]=_['isEmpty'](_0x34ab0b['body'][_0xb0ed('0x49')])?null:_0x34ab0b[_0xb0ed('0x2f')][_0xb0ed('0x49')];_0x118fd9[_0xb0ed('0x4a')]=_0x34ab0b[_0xb0ed('0x2f')][_0xb0ed('0x4a')]||![];_0x118fd9['SenderId']=_0x34ab0b[_0xb0ed('0x42')]['id'];return getContent(_0x34ab0b[_0xb0ed('0x2f')])['then'](function(_0xc8c723){_0x118fd9['body']=_0xc8c723;return getRecipients(_0x5a825b);})['then'](function(_0x1fe50e){_0x118fd9[_0xb0ed('0x4b')]=_[_0xb0ed('0x4c')](_0x1fe50e)[_0xb0ed('0x4d')](',');return db['sequelize']['transaction'](function(_0x4526aa){return db[_0xb0ed('0x4e')][_0xb0ed('0x4f')](_0x118fd9,{'raw':!![],'transaction':_0x4526aa})[_0xb0ed('0x28')](function(_0x50cd00){var _0x1c9d2b={'sender':_0x118fd9['senderName'],'description':_0x118fd9[_0xb0ed('0x49')],'content':_0x118fd9['body'],'beep':_0x118fd9[_0xb0ed('0x4a')]};_0x1fe50e[_0xb0ed('0x50')](function(_0x321222){_0x1c9d2b[_0xb0ed('0x51')]=_0x321222;socket[_0xb0ed('0x52')]('userNotification:send',_0x1c9d2b);});return _0x50cd00;});});})['then'](respondWithResult(_0x99bc1b,0xc9))[_0xb0ed('0x53')](handleError(_0x99bc1b,null));};function getContent(_0x508f2e){return new BPromise(function(_0x4ec15b,_0x2315e4){if(_0x508f2e['text']){_0x4ec15b(_0x508f2e[_0xb0ed('0x31')]);return;}return db['Template'][_0xb0ed('0x54')]({'attributes':['html'],'where':{'id':_0x508f2e[_0xb0ed('0x32')]},'raw':!![]})[_0xb0ed('0x28')](function(_0x51f21e){if(!_0x51f21e)throw new db['Sequelize'][(_0xb0ed('0x34'))](_0xb0ed('0x55'));var _0x5e0460=Mustache[_0xb0ed('0x56')](_0x51f21e['html'],_0x508f2e[_0xb0ed('0x36')]);_0x4ec15b(_0x5e0460);})['catch'](function(_0x2795df){_0x2315e4(_0x2795df);});});}function getRecipients(_0x34dbd9){return new BPromise(function(_0x506ea8,_0x5d15a4){var _0x32c4bc=[];var _0x222ed4=[];_0x34dbd9[_0xb0ed('0x50')](function(_0x2c3c38){var _0x5b1345=_['startCase'](_0x2c3c38['model']['toLowerCase']());if(_0x5b1345===_0xb0ed('0x57')){_0x32c4bc=_['union'](_0x32c4bc,_0x2c3c38[_0xb0ed('0x58')]);}else{if(_[_0xb0ed('0x44')](_0x5b1345,_0xb0ed('0x59')))_0x5b1345=_0x5b1345[_0xb0ed('0x5a')]('queue',_0xb0ed('0x5b'));_0x2c3c38[_0xb0ed('0x58')]['forEach'](function(_0x332526){_0x222ed4[_0xb0ed('0x5c')](getAgents(_0x5b1345,_0x332526));});}});return BPromise['all'](_0x222ed4)[_0xb0ed('0x28')](function(_0x242148){_0x32c4bc=_[_0xb0ed('0x5d')](_0x32c4bc,_[_0xb0ed('0x5e')](_0x242148));_0x506ea8(_0x32c4bc);})[_0xb0ed('0x53')](function(_0x40b411){_0x5d15a4(_0x40b411);});});}function getAgents(_0x1623f1,_0x50ea36){return new BPromise(function(_0x2cfcca,_0x37b77e){return db[_0x1623f1][_0xb0ed('0x54')]({'where':{'id':_0x50ea36}})[_0xb0ed('0x28')](function(_0x57c0a4){return _0x57c0a4['getAgents']({'attributes':['id'],'raw':!![]})[_0xb0ed('0x28')](function(_0x1fff0){var _0xfb39f=_['map'](_0x1fff0,'id');_0x2cfcca(_0xfb39f);});})[_0xb0ed('0x53')](function(_0x3be817){_0x37b77e(_0x3be817);});});} \ No newline at end of file +var _0xe6cd=['sendUserNotification','body','text','TemplateId','ValidationError','hasOwnProperty','Sequelize','Missing\x20\x27view\x27\x20parameter','recipients','Missing\x20\x27recipients\x27\x20parameter','parse','Invalid\x20\x27recipients\x27\x20object','chatqueue','faxqueue','openchannelqueue','smsqueue','whatsappqueue','team','user','model','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','recipientsDescription','beep','SenderId','sortBy','sequelize','transaction','UserNotification','create','forEach','recipient','emit','userNotification:send','catch','Template','findOne','render','html','view','startCase','User','union','ids','includes','queue','replace','Queue','push','all','flatten','map','rimraf','zip-dir','bluebird','mustache','path','sox','to-csv','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','update','destroy','then','sendStatus','error','name','send'];(function(_0x1f825a,_0x36ad38){var _0x3e4958=function(_0x3fcfd3){while(--_0x3fcfd3){_0x1f825a['push'](_0x1f825a['shift']());}};_0x3e4958(++_0x36ad38);}(_0xe6cd,0x1bd));var _0xde6c=function(_0xbf8f73,_0x2ca243){_0xbf8f73=_0xbf8f73-0x0;var _0x53d9a9=_0xe6cd[_0xbf8f73];return _0x53d9a9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xde6c('0x0'));var zipdir=require(_0xde6c('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xde6c('0x2'));var Mustache=require(_0xde6c('0x3'));var util=require('util');var path=require(_0xde6c('0x4'));var sox=require(_0xde6c('0x5'));var csv=require(_0xde6c('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xde6c('0x7'));var squel=require('squel');var crypto=require(_0xde6c('0x8'));var jsforce=require(_0xde6c('0x9'));var deskjs=require(_0xde6c('0xa'));var toCsv=require(_0xde6c('0x6'));var querystring=require(_0xde6c('0xb'));var Papa=require('papaparse');var Redis=require(_0xde6c('0xc'));var authService=require(_0xde6c('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0xde6c('0xe'));var hardwareService=require(_0xde6c('0xf'));var logger=require(_0xde6c('0x10'))(_0xde6c('0x11'));var utils=require(_0xde6c('0x12'));var config=require(_0xde6c('0x13'));var licenseUtil=require(_0xde6c('0x14'));var db=require(_0xde6c('0x15'))['db'];config[_0xde6c('0x16')]=_[_0xde6c('0x17')](config[_0xde6c('0x16')],{'host':_0xde6c('0x18'),'port':0x18eb});var socket=require(_0xde6c('0x19'))(new Redis(config[_0xde6c('0x16')]));require('./userNotification.socket')[_0xde6c('0x1a')](socket);function respondWithStatusCode(_0x5b98fb,_0x400f1b){_0x400f1b=_0x400f1b||0xcc;return function(_0x2ce1b6){if(_0x2ce1b6){return _0x5b98fb['sendStatus'](_0x400f1b);}return _0x5b98fb[_0xde6c('0x1b')](_0x400f1b)[_0xde6c('0x1c')]();};}function respondWithResult(_0x421ac2,_0x3ab8c6){_0x3ab8c6=_0x3ab8c6||0xc8;return function(_0x159ccc){if(_0x159ccc){return _0x421ac2[_0xde6c('0x1b')](_0x3ab8c6)[_0xde6c('0x1d')](_0x159ccc);}};}function respondWithFilteredResult(_0x937ec,_0x4f8275){return function(_0x1ce909){if(_0x1ce909){var _0x5d194a=typeof _0x4f8275[_0xde6c('0x1e')]===_0xde6c('0x1f')&&typeof _0x4f8275['limit']===_0xde6c('0x1f');var _0x433e5e=_0x1ce909[_0xde6c('0x20')];var _0x440744=_0x5d194a?0x0:_0x4f8275[_0xde6c('0x1e')];var _0x228cd8=_0x5d194a?_0x1ce909[_0xde6c('0x20')]:_0x4f8275[_0xde6c('0x1e')]+_0x4f8275[_0xde6c('0x21')];var _0x329034;if(_0x228cd8>=_0x433e5e){_0x228cd8=_0x433e5e;_0x329034=0xc8;}else{_0x329034=0xce;}_0x937ec[_0xde6c('0x1b')](_0x329034);return _0x937ec[_0xde6c('0x22')](_0xde6c('0x23'),_0x440744+'-'+_0x228cd8+'/'+_0x433e5e)[_0xde6c('0x1d')](_0x1ce909);}return null;};}function patchUpdates(_0x167cc8){return function(_0x5d3d5f){try{jsonpatch[_0xde6c('0x24')](_0x5d3d5f,_0x167cc8,!![]);}catch(_0x5ea8bc){return BPromise[_0xde6c('0x25')](_0x5ea8bc);}return _0x5d3d5f['save']();};}function saveUpdates(_0x1040b,_0x3377d3){return function(_0x1b10c2){if(_0x1b10c2){return _0x1b10c2[_0xde6c('0x26')](_0x1040b)['then'](function(_0xe1b1b9){return _0xe1b1b9;});}return null;};}function removeEntity(_0x500d2f,_0x185d06){return function(_0x397f4d){if(_0x397f4d){return _0x397f4d[_0xde6c('0x27')]()[_0xde6c('0x28')](function(){_0x500d2f[_0xde6c('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x272ece,_0x109e58){return function(_0x2c170a){if(!_0x2c170a){_0x272ece[_0xde6c('0x29')](0x194);}return _0x2c170a;};}function handleError(_0x502df0,_0x1411a7){_0x1411a7=_0x1411a7||0x1f4;return function(_0x483a13){logger[_0xde6c('0x2a')](_0x483a13['stack']);if(_0x483a13['name']){delete _0x483a13[_0xde6c('0x2b')];}_0x502df0[_0xde6c('0x1b')](_0x1411a7)[_0xde6c('0x2c')](_0x483a13);};}exports[_0xde6c('0x2d')]=function(_0x522b21,_0x127d7d,_0x5eea2c){if(!_0x522b21[_0xde6c('0x2e')]['hasOwnProperty'](_0xde6c('0x2f'))&&!_0x522b21[_0xde6c('0x2e')]['hasOwnProperty'](_0xde6c('0x30'))){throw new db['Sequelize'][(_0xde6c('0x31'))]('Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27');}else{if(_0x522b21[_0xde6c('0x2e')][_0xde6c('0x32')]('TemplateId')&&!_0x522b21[_0xde6c('0x2e')][_0xde6c('0x32')]('view')){throw new db[(_0xde6c('0x33'))]['ValidationError'](_0xde6c('0x34'));}if(!_0x522b21[_0xde6c('0x2e')][_0xde6c('0x32')](_0xde6c('0x35'))){throw new db[(_0xde6c('0x33'))][(_0xde6c('0x31'))](_0xde6c('0x36'));}else{try{var _0x1e30f7=JSON[_0xde6c('0x37')](_0x522b21[_0xde6c('0x2e')][_0xde6c('0x35')]);}catch(_0x20233b){logger[_0xde6c('0x2a')](_0x20233b);throw new db['Sequelize'][(_0xde6c('0x31'))](_0xde6c('0x38'));}var _0x3814bc=[_0xde6c('0x39'),_0xde6c('0x3a'),'mailqueue',_0xde6c('0x3b'),_0xde6c('0x3c'),'voicequeue',_0xde6c('0x3d'),_0xde6c('0x3e'),_0xde6c('0x3f')];if(_['some'](_0x1e30f7,function(_0x278566){return!_['includes'](_0x3814bc,_0x278566[_0xde6c('0x40')][_0xde6c('0x41')]());})){throw new db['Sequelize'][(_0xde6c('0x31'))](_0xde6c('0x42'));}}}var _0x2fa946={};_0x2fa946[_0xde6c('0x43')]=_0x522b21['body']['hasOwnProperty'](_0xde6c('0x43'))?_0x522b21[_0xde6c('0x2e')][_0xde6c('0x43')]:_0x522b21['user']['fullname'];_0x2fa946[_0xde6c('0x44')]=_['isEmpty'](_0x522b21[_0xde6c('0x2e')][_0xde6c('0x44')])?null:_0x522b21[_0xde6c('0x2e')][_0xde6c('0x44')];_0x2fa946[_0xde6c('0x45')]=_0x522b21[_0xde6c('0x2e')][_0xde6c('0x45')]||![];_0x2fa946[_0xde6c('0x46')]=_0x522b21[_0xde6c('0x3f')]['id'];return getContent(_0x522b21['body'])[_0xde6c('0x28')](function(_0x1f13a4){_0x2fa946['body']=_0x1f13a4;return getRecipients(_0x1e30f7);})[_0xde6c('0x28')](function(_0x5ae755){_0x2fa946['recipientsId']=_[_0xde6c('0x47')](_0x5ae755)['join'](',');return db[_0xde6c('0x48')][_0xde6c('0x49')](function(_0x24caac){return db[_0xde6c('0x4a')][_0xde6c('0x4b')](_0x2fa946,{'raw':!![],'transaction':_0x24caac})[_0xde6c('0x28')](function(_0x34a7a9){var _0x28c561={'sender':_0x2fa946[_0xde6c('0x43')],'description':_0x2fa946[_0xde6c('0x44')],'content':_0x2fa946[_0xde6c('0x2e')],'beep':_0x2fa946[_0xde6c('0x45')]};_0x5ae755[_0xde6c('0x4c')](function(_0x4bfccb){_0x28c561[_0xde6c('0x4d')]=_0x4bfccb;socket[_0xde6c('0x4e')](_0xde6c('0x4f'),_0x28c561);});return _0x34a7a9;});});})[_0xde6c('0x28')](respondWithResult(_0x127d7d,0xc9))[_0xde6c('0x50')](handleError(_0x127d7d,null));};function getContent(_0x372b67){return new BPromise(function(_0x521629,_0x5f47c6){if(_0x372b67['text']){_0x521629(_0x372b67[_0xde6c('0x2f')]);return;}return db[_0xde6c('0x51')][_0xde6c('0x52')]({'attributes':['html'],'where':{'id':_0x372b67['TemplateId']},'raw':!![]})['then'](function(_0x421604){if(!_0x421604)throw new db[(_0xde6c('0x33'))][(_0xde6c('0x31'))]('Invalid\x20\x27TemplateId\x27\x20parameter');var _0x4301a0=Mustache[_0xde6c('0x53')](_0x421604[_0xde6c('0x54')],_0x372b67[_0xde6c('0x55')]);_0x521629(_0x4301a0);})[_0xde6c('0x50')](function(_0x186723){_0x5f47c6(_0x186723);});});}function getRecipients(_0x571398){return new BPromise(function(_0x35da7b,_0xbeb213){var _0x54be17=[];var _0x4b1ac2=[];_0x571398['forEach'](function(_0x36a323){var _0x120870=_[_0xde6c('0x56')](_0x36a323[_0xde6c('0x40')][_0xde6c('0x41')]());if(_0x120870===_0xde6c('0x57')){_0x54be17=_[_0xde6c('0x58')](_0x54be17,_0x36a323[_0xde6c('0x59')]);}else{if(_[_0xde6c('0x5a')](_0x120870,_0xde6c('0x5b')))_0x120870=_0x120870[_0xde6c('0x5c')](_0xde6c('0x5b'),_0xde6c('0x5d'));_0x36a323[_0xde6c('0x59')][_0xde6c('0x4c')](function(_0x3ac01e){_0x4b1ac2[_0xde6c('0x5e')](getAgents(_0x120870,_0x3ac01e));});}});return BPromise[_0xde6c('0x5f')](_0x4b1ac2)[_0xde6c('0x28')](function(_0x27dba8){_0x54be17=_[_0xde6c('0x58')](_0x54be17,_[_0xde6c('0x60')](_0x27dba8));_0x35da7b(_0x54be17);})['catch'](function(_0x4a19f9){_0xbeb213(_0x4a19f9);});});}function getAgents(_0x43777b,_0x3ffa2e){return new BPromise(function(_0x58d924,_0x3637dc){return db[_0x43777b][_0xde6c('0x52')]({'where':{'id':_0x3ffa2e}})[_0xde6c('0x28')](function(_0x2c19e5){return _0x2c19e5['getAgents']({'attributes':['id'],'raw':!![]})[_0xde6c('0x28')](function(_0x32246d){var _0x23627f=_[_0xde6c('0x61')](_0x32246d,'id');_0x58d924(_0x23627f);});})[_0xde6c('0x50')](function(_0x3d5b46){_0x3637dc(_0x3d5b46);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.events.js b/server/api/userNotification/userNotification.events.js index a1f1fd7..6d0027d 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 _0x4f5f=['../../mysqldb','UserNotification','setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x381aba,_0x308216){var _0x3f0abd=function(_0xb20b85){while(--_0xb20b85){_0x381aba['push'](_0x381aba['shift']());}};_0x3f0abd(++_0x308216);}(_0x4f5f,0x135));var _0xf4f5=function(_0x33080e,_0x1c600a){_0x33080e=_0x33080e-0x0;var _0x407395=_0x4f5f[_0x33080e];return _0x407395;};'use strict';var EventEmitter=require(_0xf4f5('0x0'));var UserNotification=require(_0xf4f5('0x1'))['db'][_0xf4f5('0x2')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0xf4f5('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xf4f5('0x4'),'afterDestroy':_0xf4f5('0x5')};function emitEvent(_0x2e90f8){return function(_0x2101b5,_0x27a22b,_0x41402f){UserNotificationEvents[_0xf4f5('0x6')](_0x2e90f8+':'+_0x2101b5['id'],_0x2101b5);UserNotificationEvents['emit'](_0x2e90f8,_0x2101b5);_0x41402f(null);};}for(var e in events){if(events[_0xf4f5('0x7')](e)){var event=events[e];UserNotification[_0xf4f5('0x8')](e,emitEvent(event));}}module[_0xf4f5('0x9')]=UserNotificationEvents; \ No newline at end of file +var _0x707b=['hook','events','../../mysqldb','setMaxListeners','update','remove','emit','hasOwnProperty'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x707b,0x1d1));var _0xb707=function(_0x49fcfb,_0x504dec){_0x49fcfb=_0x49fcfb-0x0;var _0x964926=_0x707b[_0x49fcfb];return _0x964926;};'use strict';var EventEmitter=require(_0xb707('0x0'));var UserNotification=require(_0xb707('0x1'))['db']['UserNotification'];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0xb707('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xb707('0x3'),'afterDestroy':_0xb707('0x4')};function emitEvent(_0x5a0709){return function(_0x258af7,_0x30f09e,_0x2cfc35){UserNotificationEvents['emit'](_0x5a0709+':'+_0x258af7['id'],_0x258af7);UserNotificationEvents[_0xb707('0x5')](_0x5a0709,_0x258af7);_0x2cfc35(null);};}for(var e in events){if(events[_0xb707('0x6')](e)){var event=events[e];UserNotification[_0xb707('0x7')](e,emitEvent(event));}}module['exports']=UserNotificationEvents; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.model.js b/server/api/userNotification/userNotification.model.js index b0e6829..31ae3ca 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 _0x7096=['path','rimraf','../../config/environment','exports','define','UserNotification','utf8mb4_unicode_ci','lodash','util','../../config/logger','bluebird','request-promise'];(function(_0x92a987,_0x4415b6){var _0x331f4c=function(_0x223e9d){while(--_0x223e9d){_0x92a987['push'](_0x92a987['shift']());}};_0x331f4c(++_0x4415b6);}(_0x7096,0x1f3));var _0x6709=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x7096[_0x397e5f];return _0x5302b8;};'use strict';var _=require(_0x6709('0x0'));var util=require(_0x6709('0x1'));var logger=require(_0x6709('0x2'))('api');var moment=require('moment');var BPromise=require(_0x6709('0x3'));var rp=require(_0x6709('0x4'));var fs=require('fs');var path=require(_0x6709('0x5'));var rimraf=require(_0x6709('0x6'));var config=require(_0x6709('0x7'));var attributes=require('./userNotification.attributes');module[_0x6709('0x8')]=function(_0x3cb3ab,_0x27fbf9){return _0x3cb3ab[_0x6709('0x9')](_0x6709('0xa'),attributes,{'tableName':'userNotifications','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x6709('0xb')});}; \ No newline at end of file +var _0xcd2c=['exports','define','UserNotification','userNotifications','utf8mb4','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x51020b,_0x38c2c7){var _0x371e47=function(_0x2a538f){while(--_0x2a538f){_0x51020b['push'](_0x51020b['shift']());}};_0x371e47(++_0x38c2c7);}(_0xcd2c,0x1e5));var _0xccd2=function(_0x113350,_0x21bf5e){_0x113350=_0x113350-0x0;var _0x3b7aae=_0xcd2c[_0x113350];return _0x3b7aae;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xccd2('0x0'))(_0xccd2('0x1'));var moment=require('moment');var BPromise=require(_0xccd2('0x2'));var rp=require(_0xccd2('0x3'));var fs=require('fs');var path=require(_0xccd2('0x4'));var rimraf=require(_0xccd2('0x5'));var config=require(_0xccd2('0x6'));var attributes=require('./userNotification.attributes');module[_0xccd2('0x7')]=function(_0x879139,_0x2446f4){return _0x879139[_0xccd2('0x8')](_0xccd2('0x9'),attributes,{'tableName':_0xccd2('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xccd2('0xb'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.rpc.js b/server/api/userNotification/userNotification.rpc.js index 26c3742..fd536d6 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 _0x216f=['../../config/logger','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./userNotification.socket','register','request','info','UserNotification,\x20%s,\x20%s','debug','UserNotification,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils'];(function(_0x1a7de8,_0x19088c){var _0x1d6cbf=function(_0x3319d4){while(--_0x3319d4){_0x1a7de8['push'](_0x1a7de8['shift']());}};_0x1d6cbf(++_0x19088c);}(_0x216f,0xd9));var _0xf216=function(_0x929887,_0x5480e3){_0x929887=_0x929887-0x0;var _0x557305=_0x216f[_0x929887];return _0x557305;};'use strict';var _=require(_0xf216('0x0'));var util=require(_0xf216('0x1'));var moment=require(_0xf216('0x2'));var BPromise=require(_0xf216('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf216('0x4'));var db=require(_0xf216('0x5'))['db'];var utils=require(_0xf216('0x6'));var logger=require(_0xf216('0x7'))('rpc');var config=require(_0xf216('0x8'));var jayson=require(_0xf216('0x9'));var client=jayson[_0xf216('0xa')]['http']({'port':0x232a});config[_0xf216('0xb')]=_[_0xf216('0xc')](config[_0xf216('0xb')],{'host':_0xf216('0xd'),'port':0x18eb});var socket=require(_0xf216('0xe'))(new Redis(config[_0xf216('0xb')]));require(_0xf216('0xf'))[_0xf216('0x10')](socket);function respondWithRpcPromise(_0x437701,_0x827461,_0x5df0fb){return new BPromise(function(_0xe30585,_0x318f58){return client[_0xf216('0x11')](_0x437701,_0x5df0fb)['then'](function(_0x2189f4){logger[_0xf216('0x12')](_0xf216('0x13'),_0x827461,'request\x20sent');logger[_0xf216('0x14')](_0xf216('0x15'),_0x827461,_0xf216('0x16'),JSON[_0xf216('0x17')](_0x2189f4));if(_0x2189f4['error']){if(_0x2189f4[_0xf216('0x18')][_0xf216('0x19')]===0x1f4){logger[_0xf216('0x18')](_0xf216('0x13'),_0x827461,_0x2189f4[_0xf216('0x18')]['message']);return _0x318f58(_0x2189f4[_0xf216('0x18')][_0xf216('0x1a')]);}logger['error'](_0xf216('0x13'),_0x827461,_0x2189f4[_0xf216('0x18')]['message']);return _0xe30585(_0x2189f4['error'][_0xf216('0x1a')]);}else{logger[_0xf216('0x12')]('UserNotification,\x20%s,\x20%s',_0x827461,'request\x20sent');_0xe30585(_0x2189f4[_0xf216('0x1b')]['message']);}})['catch'](function(_0xd9f79d){logger[_0xf216('0x18')](_0xf216('0x13'),_0x827461,_0xd9f79d);_0x318f58(_0xd9f79d);});});} \ No newline at end of file +var _0x73cb=['../../config/environment','client','redis','defaults','localhost','./userNotification.socket','register','request','then','info','request\x20sent','debug','UserNotification,\x20%s,\x20%s,\x20%s','stringify','code','error','UserNotification,\x20%s,\x20%s','message','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x28d6b9,_0xbe9964){var _0x1e2bee=function(_0xc75f76){while(--_0xc75f76){_0x28d6b9['push'](_0x28d6b9['shift']());}};_0x1e2bee(++_0xbe9964);}(_0x73cb,0x130));var _0xb73c=function(_0x50de8c,_0x292a72){_0x50de8c=_0x50de8c-0x0;var _0x1eed36=_0x73cb[_0x50de8c];return _0x1eed36;};'use strict';var _=require(_0xb73c('0x0'));var util=require('util');var moment=require(_0xb73c('0x1'));var BPromise=require(_0xb73c('0x2'));var rs=require(_0xb73c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb73c('0x4'))['db'];var utils=require(_0xb73c('0x5'));var logger=require(_0xb73c('0x6'))(_0xb73c('0x7'));var config=require(_0xb73c('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xb73c('0x9')]['http']({'port':0x232a});config[_0xb73c('0xa')]=_[_0xb73c('0xb')](config['redis'],{'host':_0xb73c('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xb73c('0xd'))[_0xb73c('0xe')](socket);function respondWithRpcPromise(_0x436ef2,_0x3feb16,_0x46f3af){return new BPromise(function(_0xb20ea7,_0x2df14d){return client[_0xb73c('0xf')](_0x436ef2,_0x46f3af)[_0xb73c('0x10')](function(_0x5748a3){logger[_0xb73c('0x11')]('UserNotification,\x20%s,\x20%s',_0x3feb16,_0xb73c('0x12'));logger[_0xb73c('0x13')](_0xb73c('0x14'),_0x3feb16,_0xb73c('0x12'),JSON[_0xb73c('0x15')](_0x5748a3));if(_0x5748a3['error']){if(_0x5748a3['error'][_0xb73c('0x16')]===0x1f4){logger[_0xb73c('0x17')](_0xb73c('0x18'),_0x3feb16,_0x5748a3[_0xb73c('0x17')]['message']);return _0x2df14d(_0x5748a3[_0xb73c('0x17')][_0xb73c('0x19')]);}logger[_0xb73c('0x17')](_0xb73c('0x18'),_0x3feb16,_0x5748a3[_0xb73c('0x17')][_0xb73c('0x19')]);return _0xb20ea7(_0x5748a3[_0xb73c('0x17')]['message']);}else{logger[_0xb73c('0x11')](_0xb73c('0x18'),_0x3feb16,_0xb73c('0x12'));_0xb20ea7(_0x5748a3['result'][_0xb73c('0x19')]);}})['catch'](function(_0x2ea05b){logger[_0xb73c('0x17')](_0xb73c('0x18'),_0x3feb16,_0x2ea05b);_0x2df14d(_0x2ea05b);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.socket.js b/server/api/userNotification/userNotification.socket.js index 5a72237..3969e8e 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 _0xbd88=['./userNotification.events','remove','update','emit','removeListener','register','userNotification:'];(function(_0x486b88,_0x10faca){var _0x20dee9=function(_0x5130a3){while(--_0x5130a3){_0x486b88['push'](_0x486b88['shift']());}};_0x20dee9(++_0x10faca);}(_0xbd88,0xfc));var _0x8bd8=function(_0x36eaaa,_0x326732){_0x36eaaa=_0x36eaaa-0x0;var _0x461349=_0xbd88[_0x36eaaa];return _0x461349;};'use strict';var UserNotificationEvents=require(_0x8bd8('0x0'));var events=['save',_0x8bd8('0x1'),_0x8bd8('0x2')];function createListener(_0x11ec7b,_0x45d1ad){return function(_0x516764){_0x45d1ad[_0x8bd8('0x3')](_0x11ec7b,_0x516764);};}function removeListener(_0x4e143e,_0x581365){return function(){UserNotificationEvents[_0x8bd8('0x4')](_0x4e143e,_0x581365);};}exports[_0x8bd8('0x5')]=function(_0x1c4520){for(var _0x2334f9=0x0,_0x340739=events['length'];_0x2334f9<_0x340739;_0x2334f9++){var _0x4400e8=events[_0x2334f9];var _0x2c6f33=createListener(_0x8bd8('0x6')+_0x4400e8,_0x1c4520);UserNotificationEvents['on'](_0x4400e8,_0x2c6f33);}}; \ No newline at end of file +var _0x7611=['remove','update','emit','removeListener','./userNotification.events','save'];(function(_0x11d85a,_0x4a908e){var _0x5b5638=function(_0x1d8b30){while(--_0x1d8b30){_0x11d85a['push'](_0x11d85a['shift']());}};_0x5b5638(++_0x4a908e);}(_0x7611,0x1cc));var _0x1761=function(_0x57e496,_0x1fa5e1){_0x57e496=_0x57e496-0x0;var _0x168769=_0x7611[_0x57e496];return _0x168769;};'use strict';var UserNotificationEvents=require(_0x1761('0x0'));var events=[_0x1761('0x1'),_0x1761('0x2'),_0x1761('0x3')];function createListener(_0x107d24,_0x235605){return function(_0x389c76){_0x235605[_0x1761('0x4')](_0x107d24,_0x389c76);};}function removeListener(_0x518db3,_0x5b8ab8){return function(){UserNotificationEvents[_0x1761('0x5')](_0x518db3,_0x5b8ab8);};}exports['register']=function(_0xab4028){for(var _0x274c39=0x0,_0x399978=events['length'];_0x274c39<_0x399978;_0x274c39++){var _0x451d26=events[_0x274c39];var _0x39225f=createListener('userNotification:'+_0x451d26,_0xab4028);UserNotificationEvents['on'](_0x451d26,_0x39225f);}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index 31256da..b3fd41f 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(_0x3e9115,_0x316b4c){var _0xa0007c=function(_0x545059){while(--_0x545059){_0x3e9115['push'](_0x3e9115['shift']());}};_0xa0007c(++_0x316b4c);}(_0xe706,0xa3));var _0x6e70=function(_0x4c49c0,_0x4adb76){_0x4c49c0=_0x4c49c0-0x0;var _0x596b70=_0xe706[_0x4c49c0];return _0x596b70;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file +var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x18979e,_0x7b37e3){var _0x5e7630=function(_0x469dc4){while(--_0x469dc4){_0x18979e['push'](_0x18979e['shift']());}};_0x5e7630(++_0x7b37e3);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js index 3e5adf9..3219ac5 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 _0xc3ee=['INTEGER','exports'];(function(_0x57cd77,_0x100760){var _0x437a56=function(_0x30251d){while(--_0x30251d){_0x57cd77['push'](_0x57cd77['shift']());}};_0x437a56(++_0x100760);}(_0xc3ee,0x1df));var _0xec3e=function(_0xa3ad33,_0x2e4d84){_0xa3ad33=_0xa3ad33-0x0;var _0xb57604=_0xc3ee[_0xa3ad33];return _0xb57604;};'use strict';var Sequelize=require('sequelize');module[_0xec3e('0x0')]={'penalty':{'type':Sequelize[_0xec3e('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x889d=['INTEGER','sequelize','exports'];(function(_0x3ff339,_0x4f5443){var _0x181daa=function(_0x548c5a){while(--_0x548c5a){_0x3ff339['push'](_0x3ff339['shift']());}};_0x181daa(++_0x4f5443);}(_0x889d,0x142));var _0xd889=function(_0x22e976,_0x3a9adb){_0x22e976=_0x22e976-0x0;var _0x41037d=_0x889d[_0x22e976];return _0x41037d;};'use strict';var Sequelize=require(_0xd889('0x0'));module[_0xd889('0x1')]={'penalty':{'type':Sequelize[_0xd889('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 bea242d..00a5ac3 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 _0xf09b=['util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userOpenchannelQueue.attributes','UserOpenchannelQueue','user_has_openchannel_queues'];(function(_0x414bfc,_0x38a127){var _0xc6b723=function(_0x12d409){while(--_0x12d409){_0x414bfc['push'](_0x414bfc['shift']());}};_0xc6b723(++_0x38a127);}(_0xf09b,0x13f));var _0xbf09=function(_0x53872d,_0x360520){_0x53872d=_0x53872d-0x0;var _0x2867c6=_0xf09b[_0x53872d];return _0x2867c6;};'use strict';var _=require('lodash');var util=require(_0xbf09('0x0'));var logger=require('../../config/logger')(_0xbf09('0x1'));var moment=require(_0xbf09('0x2'));var BPromise=require(_0xbf09('0x3'));var rp=require(_0xbf09('0x4'));var fs=require('fs');var path=require(_0xbf09('0x5'));var rimraf=require(_0xbf09('0x6'));var config=require(_0xbf09('0x7'));var attributes=require(_0xbf09('0x8'));module['exports']=function(_0x298530,_0x1acaf9){return _0x298530['define'](_0xbf09('0x9'),attributes,{'tableName':_0xbf09('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc198=['user_has_openchannel_queues','lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userOpenchannelQueue.attributes','exports','define','UserOpenchannelQueue'];(function(_0x49d7a7,_0x473232){var _0x3e0944=function(_0x3dbbe6){while(--_0x3dbbe6){_0x49d7a7['push'](_0x49d7a7['shift']());}};_0x3e0944(++_0x473232);}(_0xc198,0xde));var _0x8c19=function(_0x54b7bc,_0x1f5b38){_0x54b7bc=_0x54b7bc-0x0;var _0x38810c=_0xc198[_0x54b7bc];return _0x38810c;};'use strict';var _=require(_0x8c19('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x8c19('0x1'));var moment=require(_0x8c19('0x2'));var BPromise=require(_0x8c19('0x3'));var rp=require(_0x8c19('0x4'));var fs=require('fs');var path=require(_0x8c19('0x5'));var rimraf=require(_0x8c19('0x6'));var config=require(_0x8c19('0x7'));var attributes=require(_0x8c19('0x8'));module[_0x8c19('0x9')]=function(_0x56479d,_0x260ec2){return _0x56479d[_0x8c19('0xa')](_0x8c19('0xb'),attributes,{'tableName':_0x8c19('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.rpc.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.rpc.js index 0c7abc9..14dd6b7 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 _0xd33f=['code','message','info','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x4c4042,_0x1ea485){var _0xbd10dc=function(_0x164b20){while(--_0x164b20){_0x4c4042['push'](_0x4c4042['shift']());}};_0xbd10dc(++_0x1ea485);}(_0xd33f,0xd4));var _0xfd33=function(_0x598b9d,_0x2f6c55){_0x598b9d=_0x598b9d-0x0;var _0x43055b=_0xd33f[_0x598b9d];return _0x43055b;};'use strict';var _=require('lodash');var util=require(_0xfd33('0x0'));var moment=require(_0xfd33('0x1'));var BPromise=require(_0xfd33('0x2'));var rs=require(_0xfd33('0x3'));var fs=require('fs');var Redis=require(_0xfd33('0x4'));var db=require(_0xfd33('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xfd33('0x6'))(_0xfd33('0x7'));var config=require(_0xfd33('0x8'));var jayson=require(_0xfd33('0x9'));var client=jayson[_0xfd33('0xa')][_0xfd33('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x10cb91,_0x5e774d,_0x5d9798){return new BPromise(function(_0x3f0327,_0x1f1d1f){return client['request'](_0x10cb91,_0x5d9798)['then'](function(_0x6c94c1){logger['info'](_0xfd33('0xc'),_0x5e774d,_0xfd33('0xd'));logger[_0xfd33('0xe')](_0xfd33('0xf'),_0x5e774d,_0xfd33('0xd'),JSON[_0xfd33('0x10')](_0x6c94c1));if(_0x6c94c1[_0xfd33('0x11')]){if(_0x6c94c1[_0xfd33('0x11')][_0xfd33('0x12')]===0x1f4){logger[_0xfd33('0x11')](_0xfd33('0xc'),_0x5e774d,_0x6c94c1[_0xfd33('0x11')][_0xfd33('0x13')]);return _0x1f1d1f(_0x6c94c1[_0xfd33('0x11')]['message']);}logger[_0xfd33('0x11')](_0xfd33('0xc'),_0x5e774d,_0x6c94c1[_0xfd33('0x11')]['message']);return _0x3f0327(_0x6c94c1[_0xfd33('0x11')][_0xfd33('0x13')]);}else{logger[_0xfd33('0x14')](_0xfd33('0xc'),_0x5e774d,_0xfd33('0xd'));_0x3f0327(_0x6c94c1[_0xfd33('0x15')][_0xfd33('0x13')]);}})[_0xfd33('0x16')](function(_0x135af0){logger[_0xfd33('0x11')](_0xfd33('0xc'),_0x5e774d,_0x135af0);_0x1f1d1f(_0x135af0);});});} \ No newline at end of file +var _0x7c6f=['message','result','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x5cbace,_0x33943c){var _0x6de5b8=function(_0x5aae38){while(--_0x5aae38){_0x5cbace['push'](_0x5cbace['shift']());}};_0x6de5b8(++_0x33943c);}(_0x7c6f,0x178));var _0xf7c6=function(_0x7049c7,_0x35761f){_0x7049c7=_0x7049c7-0x0;var _0x2d6408=_0x7c6f[_0x7049c7];return _0x2d6408;};'use strict';var _=require('lodash');var util=require(_0xf7c6('0x0'));var moment=require(_0xf7c6('0x1'));var BPromise=require(_0xf7c6('0x2'));var rs=require(_0xf7c6('0x3'));var fs=require('fs');var Redis=require(_0xf7c6('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xf7c6('0x5'));var logger=require(_0xf7c6('0x6'))('rpc');var config=require(_0xf7c6('0x7'));var jayson=require(_0xf7c6('0x8'));var client=jayson['client'][_0xf7c6('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x24d7ef,_0x51bbef,_0x45dd9b){return new BPromise(function(_0x23f23f,_0x347e08){return client[_0xf7c6('0xa')](_0x24d7ef,_0x45dd9b)[_0xf7c6('0xb')](function(_0x116f1d){logger[_0xf7c6('0xc')](_0xf7c6('0xd'),_0x51bbef,_0xf7c6('0xe'));logger[_0xf7c6('0xf')](_0xf7c6('0x10'),_0x51bbef,_0xf7c6('0xe'),JSON[_0xf7c6('0x11')](_0x116f1d));if(_0x116f1d[_0xf7c6('0x12')]){if(_0x116f1d[_0xf7c6('0x12')][_0xf7c6('0x13')]===0x1f4){logger[_0xf7c6('0x12')](_0xf7c6('0xd'),_0x51bbef,_0x116f1d[_0xf7c6('0x12')][_0xf7c6('0x14')]);return _0x347e08(_0x116f1d[_0xf7c6('0x12')][_0xf7c6('0x14')]);}logger[_0xf7c6('0x12')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x51bbef,_0x116f1d[_0xf7c6('0x12')][_0xf7c6('0x14')]);return _0x23f23f(_0x116f1d[_0xf7c6('0x12')][_0xf7c6('0x14')]);}else{logger[_0xf7c6('0xc')](_0xf7c6('0xd'),_0x51bbef,_0xf7c6('0xe'));_0x23f23f(_0x116f1d[_0xf7c6('0x15')]['message']);}})['catch'](function(_0x981122){logger[_0xf7c6('0x12')](_0xf7c6('0xd'),_0x51bbef,_0x981122);_0x347e08(_0x981122);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index 1bc6d63..3b4eec1 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 _0x49aa=['./userProfile.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/sections','getSections','/:id/resources','getResources','post','create','clone','addSections','addResources','put','delete','removeResources','exports','util','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x17bb31,_0x2fc6f8){var _0x505c71=function(_0x5013cf){while(--_0x5013cf){_0x17bb31['push'](_0x17bb31['shift']());}};_0x505c71(++_0x2fc6f8);}(_0x49aa,0x10e));var _0xa49a=function(_0x443c86,_0x1d01af){_0x443c86=_0x443c86-0x0;var _0x4d0e21=_0x49aa[_0x443c86];return _0x4d0e21;};'use strict';var multer=require('multer');var util=require(_0xa49a('0x0'));var path=require('path');var timeout=require(_0xa49a('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xa49a('0x2'));var interaction=require(_0xa49a('0x3'));var config=require(_0xa49a('0x4'));var controller=require(_0xa49a('0x5'));router[_0xa49a('0x6')]('/',auth[_0xa49a('0x7')](),controller['index']);router[_0xa49a('0x6')](_0xa49a('0x8'),auth[_0xa49a('0x7')](),controller[_0xa49a('0x9')]);router['get'](_0xa49a('0xa'),auth[_0xa49a('0x7')](),controller[_0xa49a('0xb')]);router[_0xa49a('0x6')](_0xa49a('0xc'),auth[_0xa49a('0x7')](),controller[_0xa49a('0xd')]);router[_0xa49a('0x6')](_0xa49a('0xe'),auth['isAuthenticated'](),controller[_0xa49a('0xf')]);router[_0xa49a('0x10')]('/',auth[_0xa49a('0x7')](),controller[_0xa49a('0x11')]);router[_0xa49a('0x10')]('/:id/clone',auth['isAuthenticated'](),controller[_0xa49a('0x12')]);router[_0xa49a('0x10')](_0xa49a('0xc'),auth[_0xa49a('0x7')](),controller[_0xa49a('0x13')]);router['post']('/:id/resources',auth[_0xa49a('0x7')](),controller[_0xa49a('0x14')]);router[_0xa49a('0x15')](_0xa49a('0xa'),auth[_0xa49a('0x7')](),controller['update']);router[_0xa49a('0x16')](_0xa49a('0xa'),auth['isAuthenticated'](),controller['destroy']);router[_0xa49a('0x16')](_0xa49a('0xc'),auth[_0xa49a('0x7')](),controller['removeSections']);router[_0xa49a('0x16')]('/:id/resources',auth['isAuthenticated'](),controller[_0xa49a('0x17')]);module[_0xa49a('0x18')]=router; \ No newline at end of file +var _0x6b14=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfile.controller','get','isAuthenticated','index','describe','/:id','show','/:id/sections','getSections','/:id/resources','post','create','/:id/clone','clone','addSections','addResources','delete','destroy','removeSections','removeResources','exports','util','path','connect-timeout'];(function(_0x5e3124,_0x1e9c4c){var _0x2195c2=function(_0x5d57a8){while(--_0x5d57a8){_0x5e3124['push'](_0x5e3124['shift']());}};_0x2195c2(++_0x1e9c4c);}(_0x6b14,0x102));var _0x46b1=function(_0x14622c,_0x1a39a8){_0x14622c=_0x14622c-0x0;var _0x20e47b=_0x6b14[_0x14622c];return _0x20e47b;};'use strict';var multer=require('multer');var util=require(_0x46b1('0x0'));var path=require(_0x46b1('0x1'));var timeout=require(_0x46b1('0x2'));var express=require(_0x46b1('0x3'));var router=express[_0x46b1('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x46b1('0x5'));var interaction=require(_0x46b1('0x6'));var config=require(_0x46b1('0x7'));var controller=require(_0x46b1('0x8'));router[_0x46b1('0x9')]('/',auth[_0x46b1('0xa')](),controller[_0x46b1('0xb')]);router['get']('/describe',auth[_0x46b1('0xa')](),controller[_0x46b1('0xc')]);router[_0x46b1('0x9')](_0x46b1('0xd'),auth[_0x46b1('0xa')](),controller[_0x46b1('0xe')]);router[_0x46b1('0x9')](_0x46b1('0xf'),auth[_0x46b1('0xa')](),controller[_0x46b1('0x10')]);router[_0x46b1('0x9')](_0x46b1('0x11'),auth[_0x46b1('0xa')](),controller['getResources']);router[_0x46b1('0x12')]('/',auth[_0x46b1('0xa')](),controller[_0x46b1('0x13')]);router[_0x46b1('0x12')](_0x46b1('0x14'),auth[_0x46b1('0xa')](),controller[_0x46b1('0x15')]);router[_0x46b1('0x12')](_0x46b1('0xf'),auth['isAuthenticated'](),controller[_0x46b1('0x16')]);router['post'](_0x46b1('0x11'),auth[_0x46b1('0xa')](),controller[_0x46b1('0x17')]);router['put'](_0x46b1('0xd'),auth[_0x46b1('0xa')](),controller['update']);router[_0x46b1('0x18')](_0x46b1('0xd'),auth['isAuthenticated'](),controller[_0x46b1('0x19')]);router[_0x46b1('0x18')](_0x46b1('0xf'),auth['isAuthenticated'](),controller[_0x46b1('0x1a')]);router[_0x46b1('0x18')]('/:id/resources',auth[_0x46b1('0xa')](),controller[_0x46b1('0x1b')]);module[_0x46b1('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 07f20c7..03cfe5f 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 _0x6a8a=['crudPermissions','join','getDataValue','split','BOOLEAN','sequelize','STRING','name'];(function(_0x19409d,_0xf48905){var _0x5de146=function(_0x117745){while(--_0x117745){_0x19409d['push'](_0x19409d['shift']());}};_0x5de146(++_0xf48905);}(_0x6a8a,0x105));var _0xa6a8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6a8a[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xa6a8('0x0'));module['exports']={'name':{'type':Sequelize[_0xa6a8('0x1')],'allowNull':![],'unique':_0xa6a8('0x2')},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0xada9a0){this['setDataValue'](_0xa6a8('0x3'),_0xada9a0?_0xada9a0[_0xa6a8('0x4')](''):[]);},'get':function(){return this['getDataValue'](_0xa6a8('0x3'))?this[_0xa6a8('0x5')](_0xa6a8('0x3'))[_0xa6a8('0x6')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'privacyEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0xa6a8('0x7')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0xa6a8('0x7')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0xa6a8('0x7')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0xa6a8('0x7')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0xa6a8('0x7')],'defaultValue':!![]}}; \ No newline at end of file +var _0xe918=['setDataValue','crudPermissions','join','getDataValue','split','BOOLEAN','sequelize','exports','STRING'];(function(_0x57a81,_0x43b6cb){var _0x1f3d77=function(_0x454fc9){while(--_0x454fc9){_0x57a81['push'](_0x57a81['shift']());}};_0x1f3d77(++_0x43b6cb);}(_0xe918,0x114));var _0x8e91=function(_0x4c21c0,_0x1a7559){_0x4c21c0=_0x4c21c0-0x0;var _0x428a0b=_0xe918[_0x4c21c0];return _0x428a0b;};'use strict';var Sequelize=require(_0x8e91('0x0'));module[_0x8e91('0x1')]={'name':{'type':Sequelize[_0x8e91('0x2')],'allowNull':![],'unique':'name'},'crudPermissions':{'type':Sequelize[_0x8e91('0x2')],'set':function(_0x43c235){this[_0x8e91('0x3')](_0x8e91('0x4'),_0x43c235?_0x43c235[_0x8e91('0x5')](''):[]);},'get':function(){return this[_0x8e91('0x6')](_0x8e91('0x4'))?this[_0x8e91('0x6')](_0x8e91('0x4'))[_0x8e91('0x7')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x8e91('0x2')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0x8e91('0x8')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0x8e91('0x8')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0x8e91('0x8')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0x8e91('0x8')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x8e91('0x8')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0x8e91('0x8')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x8e91('0x8')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.controller.js b/server/api/userProfile/userProfile.controller.js index c27b8eb..ad2390e 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 _0xb88b=['Dashboard','forEach','resourceId','Plugin','addResources','bulkCreate','filter','removeResources','getResources','section','Missing\x20section\x20parameter','No\x20User\x20Profile\x20found\x20for\x20id\x20','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','socket.io-emitter','register','sendStatus','status','json','offset','undefined','limit','count','set','apply','save','update','then','destroy','end','stack','send','map','UserProfile','rawAttributes','fieldName','key','name','query','keys','intersection','fields','attributes','model','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','create','clone','params','omit','updatedAt','body','createdAt','sequelize','transaction','get','each','autoAssociation','UserProfileResource','sectionId','userProfileId','Resources','UserProfileSection','describe','addSections','find','push','ids','enabled','includes','isEmpty','subsections','concat','findOne'];(function(_0x30ae7b,_0x3a718f){var _0xa9d0cf=function(_0x8102a1){while(--_0x8102a1){_0x30ae7b['push'](_0x30ae7b['shift']());}};_0xa9d0cf(++_0x3a718f);}(_0xb88b,0x1c8));var _0xbb88=function(_0x54787e,_0xcdfd2c){_0x54787e=_0x54787e-0x0;var _0x5f4876=_0xb88b[_0x54787e];return _0x5f4876;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xbb88('0x0'));var zipdir=require(_0xbb88('0x1'));var jsonpatch=require(_0xbb88('0x2'));var rp=require('request-promise');var moment=require(_0xbb88('0x3'));var BPromise=require(_0xbb88('0x4'));var Mustache=require('mustache');var util=require(_0xbb88('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0xbb88('0x6'));var ejs=require(_0xbb88('0x7'));var fs=require('fs');var fs_extra=require(_0xbb88('0x8'));var _=require(_0xbb88('0x9'));var squel=require(_0xbb88('0xa'));var crypto=require('crypto');var jsforce=require(_0xbb88('0xb'));var deskjs=require(_0xbb88('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xbb88('0xd'));var Redis=require(_0xbb88('0xe'));var authService=require(_0xbb88('0xf'));var qs=require(_0xbb88('0x10'));var as=require(_0xbb88('0x11'));var hardwareService=require(_0xbb88('0x12'));var logger=require(_0xbb88('0x13'))('api');var utils=require(_0xbb88('0x14'));var config=require(_0xbb88('0x15'));var licenseUtil=require(_0xbb88('0x16'));var db=require(_0xbb88('0x17'))['db'];config['redis']=_[_0xbb88('0x18')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xbb88('0x19'))(new Redis(config['redis']));require('./userProfile.socket')[_0xbb88('0x1a')](socket);function respondWithStatusCode(_0x28870b,_0x164ee9){_0x164ee9=_0x164ee9||0xcc;return function(_0x4bf486){if(_0x4bf486){return _0x28870b[_0xbb88('0x1b')](_0x164ee9);}return _0x28870b[_0xbb88('0x1c')](_0x164ee9)['end']();};}function respondWithResult(_0x1731c3,_0x1d5f74){_0x1d5f74=_0x1d5f74||0xc8;return function(_0x492e02){if(_0x492e02){return _0x1731c3[_0xbb88('0x1c')](_0x1d5f74)[_0xbb88('0x1d')](_0x492e02);}};}function respondWithFilteredResult(_0x3996b1,_0x563940){return function(_0x3788ef){if(_0x3788ef){var _0x3f9f4f=typeof _0x563940[_0xbb88('0x1e')]===_0xbb88('0x1f')&&typeof _0x563940[_0xbb88('0x20')]===_0xbb88('0x1f');var _0x3eebfa=_0x3788ef['count'];var _0xa21e82=_0x3f9f4f?0x0:_0x563940[_0xbb88('0x1e')];var _0x4d17b3=_0x3f9f4f?_0x3788ef[_0xbb88('0x21')]:_0x563940[_0xbb88('0x1e')]+_0x563940[_0xbb88('0x20')];var _0x3cfe6d;if(_0x4d17b3>=_0x3eebfa){_0x4d17b3=_0x3eebfa;_0x3cfe6d=0xc8;}else{_0x3cfe6d=0xce;}_0x3996b1[_0xbb88('0x1c')](_0x3cfe6d);return _0x3996b1[_0xbb88('0x22')]('Content-Range',_0xa21e82+'-'+_0x4d17b3+'/'+_0x3eebfa)['json'](_0x3788ef);}return null;};}function patchUpdates(_0x5525f7){return function(_0x4fa982){try{jsonpatch[_0xbb88('0x23')](_0x4fa982,_0x5525f7,!![]);}catch(_0x19742f){return BPromise['reject'](_0x19742f);}return _0x4fa982[_0xbb88('0x24')]();};}function saveUpdates(_0xb896c6,_0x2e6e40){return function(_0x502a87){if(_0x502a87){return _0x502a87[_0xbb88('0x25')](_0xb896c6)[_0xbb88('0x26')](function(_0x8a7f29){return _0x8a7f29;});}return null;};}function removeEntity(_0x17bac2,_0x2abcd0){return function(_0x52a408){if(_0x52a408){return _0x52a408[_0xbb88('0x27')]()[_0xbb88('0x26')](function(){_0x17bac2['status'](0xcc)[_0xbb88('0x28')]();});}};}function handleEntityNotFound(_0x165b7c,_0xdc9d6e){return function(_0x4f499f){if(!_0x4f499f){_0x165b7c['sendStatus'](0x194);}return _0x4f499f;};}function handleError(_0x22d159,_0x1f4f42){_0x1f4f42=_0x1f4f42||0x1f4;return function(_0x52fd49){logger['error'](_0x52fd49[_0xbb88('0x29')]);if(_0x52fd49['name']){delete _0x52fd49['name'];}_0x22d159[_0xbb88('0x1c')](_0x1f4f42)[_0xbb88('0x2a')](_0x52fd49);};}exports['index']=function(_0x53528f,_0x34d271){var _0x30415b={},_0x565cd3={},_0x4be7bc={'count':0x0,'rows':[]};var _0x45b90e=_[_0xbb88('0x2b')](db[_0xbb88('0x2c')][_0xbb88('0x2d')],function(_0xcfe3c2){return{'name':_0xcfe3c2[_0xbb88('0x2e')],'type':_0xcfe3c2['type'][_0xbb88('0x2f')]};});_0x565cd3['model']=_[_0xbb88('0x2b')](_0x45b90e,_0xbb88('0x30'));_0x565cd3[_0xbb88('0x31')]=_[_0xbb88('0x32')](_0x53528f[_0xbb88('0x31')]);_0x565cd3['filters']=_[_0xbb88('0x33')](_0x565cd3['model'],_0x565cd3['query']);_0x30415b['attributes']=_[_0xbb88('0x33')](_0x565cd3['model'],qs[_0xbb88('0x34')](_0x53528f['query'][_0xbb88('0x34')]));_0x30415b[_0xbb88('0x35')]=_0x30415b[_0xbb88('0x35')]['length']?_0x30415b[_0xbb88('0x35')]:_0x565cd3[_0xbb88('0x36')];if(!_0x53528f[_0xbb88('0x31')][_0xbb88('0x37')](_0xbb88('0x38'))){_0x30415b['limit']=qs[_0xbb88('0x20')](_0x53528f[_0xbb88('0x31')][_0xbb88('0x20')]);_0x30415b[_0xbb88('0x1e')]=qs[_0xbb88('0x1e')](_0x53528f[_0xbb88('0x31')][_0xbb88('0x1e')]);}_0x30415b[_0xbb88('0x39')]=qs[_0xbb88('0x3a')](_0x53528f[_0xbb88('0x31')][_0xbb88('0x3a')]);_0x30415b[_0xbb88('0x3b')]=qs[_0xbb88('0x3c')](_[_0xbb88('0x3d')](_0x53528f[_0xbb88('0x31')],_0x565cd3['filters']),_0x45b90e);if(_0x53528f[_0xbb88('0x31')]['filter']){_0x30415b[_0xbb88('0x3b')]=_[_0xbb88('0x3e')](_0x30415b[_0xbb88('0x3b')],{'$or':_[_0xbb88('0x2b')](_0x45b90e,function(_0x5a20d0){if(_0x5a20d0['type']!==_0xbb88('0x3f')){var _0x2db78a={};_0x2db78a[_0x5a20d0[_0xbb88('0x30')]]={'$like':'%'+_0x53528f[_0xbb88('0x31')]['filter']+'%'};return _0x2db78a;}})});}_0x30415b=_[_0xbb88('0x3e')]({},_0x30415b,_0x53528f[_0xbb88('0x40')]);var _0x1c6769={'where':_0x30415b[_0xbb88('0x3b')]};return db[_0xbb88('0x2c')][_0xbb88('0x21')](_0x1c6769)[_0xbb88('0x26')](function(_0x56df38){_0x4be7bc[_0xbb88('0x21')]=_0x56df38;if(_0x53528f[_0xbb88('0x31')][_0xbb88('0x41')]){_0x30415b[_0xbb88('0x42')]=[{'all':!![]}];}return db['UserProfile'][_0xbb88('0x43')](_0x30415b);})[_0xbb88('0x26')](function(_0x331d20){_0x4be7bc[_0xbb88('0x44')]=_0x331d20;return _0x4be7bc;})['then'](respondWithFilteredResult(_0x34d271,_0x30415b))[_0xbb88('0x45')](handleError(_0x34d271,null));};exports[_0xbb88('0x46')]=function(_0x2217d0,_0x11644f){var _0x594f5a={'raw':![],'where':{'id':_0x2217d0['params']['id']}},_0x32788f={};_0x32788f['model']=_['keys'](db[_0xbb88('0x2c')][_0xbb88('0x2d')]);_0x32788f[_0xbb88('0x31')]=_['keys'](_0x2217d0[_0xbb88('0x31')]);_0x32788f[_0xbb88('0x3c')]=_['intersection'](_0x32788f[_0xbb88('0x36')],_0x32788f['query']);_0x594f5a[_0xbb88('0x35')]=_[_0xbb88('0x33')](_0x32788f['model'],qs[_0xbb88('0x34')](_0x2217d0[_0xbb88('0x31')]['fields']));_0x594f5a[_0xbb88('0x35')]=_0x594f5a[_0xbb88('0x35')]['length']?_0x594f5a[_0xbb88('0x35')]:_0x32788f['model'];if(_0x2217d0['query'][_0xbb88('0x41')]){_0x594f5a[_0xbb88('0x42')]=[{'all':!![]}];}_0x594f5a=_[_0xbb88('0x3e')]({},_0x594f5a,_0x2217d0['options']);return db[_0xbb88('0x2c')]['find'](_0x594f5a)[_0xbb88('0x26')](handleEntityNotFound(_0x11644f,null))[_0xbb88('0x26')](respondWithResult(_0x11644f,null))[_0xbb88('0x45')](handleError(_0x11644f,null));};exports[_0xbb88('0x47')]=function(_0x25efda,_0x4ba153){return db[_0xbb88('0x2c')][_0xbb88('0x47')](_0x25efda['body'],{})['then'](respondWithResult(_0x4ba153,0xc9))[_0xbb88('0x45')](handleError(_0x4ba153,null));};exports[_0xbb88('0x48')]=function(_0x268d86,_0x581774){var _0x5a22f6={'where':{'id':_0x268d86[_0xbb88('0x49')]['id']}},_0x628ea2={};_0x628ea2[_0xbb88('0x36')]=_['keys'](db['UserProfile']['rawAttributes']);_0x5a22f6[_0xbb88('0x35')]=_[_0xbb88('0x33')](_0x628ea2[_0xbb88('0x36')],qs['fields'](_0x268d86[_0xbb88('0x31')][_0xbb88('0x34')]));_0x5a22f6[_0xbb88('0x35')]=_0x5a22f6[_0xbb88('0x35')]['length']?_0x5a22f6[_0xbb88('0x35')]:_0x628ea2[_0xbb88('0x36')];if(_0x268d86['query'][_0xbb88('0x41')]){_0x5a22f6[_0xbb88('0x42')]=[{'all':!![]}];}_0x5a22f6=_[_0xbb88('0x3e')]({},_0x5a22f6,_0x268d86[_0xbb88('0x40')]);return db[_0xbb88('0x2c')]['find'](_0x5a22f6)[_0xbb88('0x26')](handleEntityNotFound(_0x581774,null))[_0xbb88('0x26')](function(_0x2197f3){if(_0x2197f3){var _0x57465=_0x2197f3['get']({'plain':!![]});_0x57465=qs[_0xbb88('0x4a')](_0x57465,['id','createdAt',_0xbb88('0x4b'),'crudPermissions']);_0x268d86[_0xbb88('0x4c')]=_[_0xbb88('0x4a')](_0x268d86[_0xbb88('0x4c')],['id',_0xbb88('0x4d'),_0xbb88('0x4b')]);return db[_0xbb88('0x4e')][_0xbb88('0x4f')](function(_0x139941){return db['UserProfile'][_0xbb88('0x47')](_[_0xbb88('0x3e')](_0x57465,_0x268d86['body']),{'include':_0x268d86['query']['includeAll']?[{'all':!![]}]:undefined,'transaction':_0x139941})[_0xbb88('0x26')](function(_0x42acfc){var _0xc52d4a=_0x42acfc[_0xbb88('0x50')]({'plain':!![]});return db['UserProfileSection'][_0xbb88('0x43')]({'where':{'userProfileId':_0x268d86[_0xbb88('0x49')]['id']},'raw':!![]})[_0xbb88('0x26')](function(_0x4ce63b){if(_0x4ce63b){return BPromise[_0xbb88('0x51')](_0x4ce63b,function(_0x595a3f){return new BPromise(function(_0x456f1b,_0x4af2ff){if(_0x595a3f[_0xbb88('0x52')]===null||_0x595a3f[_0xbb88('0x52')]===0x1)_0x456f1b(null);return db[_0xbb88('0x53')]['findAll']({'where':{'sectionId':_0x595a3f['id']},'raw':!![]})['then'](function(_0x223ff1){var _0x51ca41=_['map'](_0x223ff1,function(_0x3a95e1){return qs[_0xbb88('0x4a')](_0x3a95e1,['id',_0xbb88('0x4d'),_0xbb88('0x4b'),_0xbb88('0x54')]);});_0x456f1b(_0x51ca41);})['catch'](function(_0x1f61af){_0x4af2ff(_0x1f61af);});})[_0xbb88('0x26')](function(_0x249809){var _0x4f761f=qs[_0xbb88('0x4a')](_0x595a3f,['id',_0xbb88('0x4d'),_0xbb88('0x4b')]);_0x4f761f[_0xbb88('0x55')]=_0xc52d4a['id'];if(_0x249809)_0x4f761f[_0xbb88('0x56')]=_0x249809;return _0x4f761f;})[_0xbb88('0x26')](function(_0x2ef2be){return db[_0xbb88('0x57')][_0xbb88('0x47')](_0x2ef2be,{'include':[{'model':db[_0xbb88('0x53')],'as':'Resources'}],'raw':!![],'transaction':_0x139941});});})[_0xbb88('0x26')](function(){return _0xc52d4a;});}});});});}})[_0xbb88('0x26')](respondWithResult(_0x581774,0xc9))[_0xbb88('0x45')](handleError(_0x581774,null));};exports['update']=function(_0x2ca0d9,_0x5c2265){if(_0x2ca0d9[_0xbb88('0x4c')]['id']){delete _0x2ca0d9['body']['id'];}return db['UserProfile']['find']({'where':{'id':_0x2ca0d9[_0xbb88('0x49')]['id']}})[_0xbb88('0x26')](handleEntityNotFound(_0x5c2265,null))[_0xbb88('0x26')](saveUpdates(_0x2ca0d9[_0xbb88('0x4c')],null))[_0xbb88('0x26')](respondWithResult(_0x5c2265,null))[_0xbb88('0x45')](handleError(_0x5c2265,null));};exports[_0xbb88('0x27')]=function(_0x2a3ae8,_0x5666ff){return db[_0xbb88('0x2c')]['find']({'where':{'id':_0x2a3ae8['params']['id']}})[_0xbb88('0x26')](handleEntityNotFound(_0x5666ff,null))[_0xbb88('0x26')](removeEntity(_0x5666ff,null))['catch'](handleError(_0x5666ff,null));};exports[_0xbb88('0x58')]=function(_0x535f89,_0x3c0060){return db[_0xbb88('0x2c')]['describe']()[_0xbb88('0x26')](respondWithResult(_0x3c0060,null))[_0xbb88('0x45')](handleError(_0x3c0060,null));};exports[_0xbb88('0x59')]=function(_0x45ee08,_0x2b3961){var _0x2cac46=_0x45ee08[_0xbb88('0x4c')];return db[_0xbb88('0x2c')][_0xbb88('0x5a')]({'where':{'id':_0x45ee08['params']['id']}})[_0xbb88('0x26')](handleEntityNotFound(_0x2b3961,null))[_0xbb88('0x26')](function(_0x5d19ee){if(_0x5d19ee){return db[_0xbb88('0x4e')][_0xbb88('0x4f')](function(_0x2d807f){return db['UserProfileSection'][_0xbb88('0x27')]({'where':{'userProfileId':_0x45ee08[_0xbb88('0x49')]['id'],'sectionId':_[_0xbb88('0x2b')](_0x2cac46,function(_0x3b401c){return _0x3b401c['sectionId'];})},'transaction':_0x2d807f})[_0xbb88('0x26')](function(){var _0x756b52=_[_0xbb88('0x2b')](_0x2cac46,function(_0x1ee0ac){_0x1ee0ac[_0xbb88('0x55')]=_0x45ee08[_0xbb88('0x49')]['id'];return _0x1ee0ac;});var _0x3996dd=[];return BPromise[_0xbb88('0x51')](_0x756b52,function(_0x16d9b4){return db[_0xbb88('0x57')][_0xbb88('0x47')](_0x16d9b4,{'include':[{'model':db[_0xbb88('0x53')],'as':'Resources'}],'raw':!![],'transaction':_0x2d807f})[_0xbb88('0x26')](function(_0x335069){_0x3996dd[_0xbb88('0x5b')](_0x335069[_0xbb88('0x50')]({'plain':!![]}));});})[_0xbb88('0x26')](function(){return _0x3996dd;});});});}})[_0xbb88('0x26')](function(_0x52cd0f){return _0x52cd0f;})[_0xbb88('0x26')](respondWithResult(_0x2b3961,null))[_0xbb88('0x45')](handleError(_0x2b3961,null));};exports['removeSections']=function(_0x193bad,_0x539129){var _0x4e3a68;return db[_0xbb88('0x2c')][_0xbb88('0x5a')]({'where':{'id':_0x193bad[_0xbb88('0x49')]['id']},'attributes':['id',_0xbb88('0x30')]})[_0xbb88('0x26')](handleEntityNotFound(_0x539129,null))[_0xbb88('0x26')](function(_0x53b3c7){if(_0x53b3c7){_0x4e3a68=_0x53b3c7;return db['UserProfileSection'][_0xbb88('0x27')]({'where':{'userProfileId':_0x193bad[_0xbb88('0x49')]['id'],'sectionId':_0x193bad[_0xbb88('0x31')][_0xbb88('0x5c')]}});}})[_0xbb88('0x26')](function(){return _0x4e3a68;})[_0xbb88('0x26')](respondWithStatusCode(_0x539129,null))[_0xbb88('0x45')](handleError(_0x539129,null));};exports['getSections']=function(_0x13bfb9,_0x2cd5ce){var _0x3b5483=[];var _0x4111b7=[];return db[_0xbb88('0x57')][_0xbb88('0x43')]({'where':{'userProfileId':_0x13bfb9[_0xbb88('0x49')]['id']},'raw':!![]})[_0xbb88('0x26')](function(_0x308133){_0x3b5483=_['filter'](_0x308133,function(_0x3e6fb1){return _0x3e6fb1[_0xbb88('0x5d')]===0x1||_[_0xbb88('0x5e')]([0x3eb,0x709],_0x3e6fb1[_0xbb88('0x54')]);});if(!_[_0xbb88('0x5f')](_0x3b5483)){return _[_0xbb88('0x2b')](_0x3b5483,function(_0xfd5b1c){return _0xfd5b1c[_0xbb88('0x54')];});}else{return;}})[_0xbb88('0x26')](function(_0x4465a4){if(_0x4465a4)_0x4111b7=_0x4465a4;if(_[_0xbb88('0x5e')](_0x4111b7,0x64)){var _0x2327e4=_['find'](_0x3b5483,{'sectionId':0x64});return hasDefaultDashboard(_0x2327e4)[_0xbb88('0x26')](function(_0x3401d2){return _[_0xbb88('0x2b')](_0x3b5483,function(_0x2624aa){if(_0x2624aa[_0xbb88('0x54')]===0x64){_0x2624aa[_0xbb88('0x60')]=_0x3401d2;}return _0x2624aa;});});}else{return;}})[_0xbb88('0x26')](function(_0x330f91){if(_0x330f91)_0x3b5483=_0x330f91;if(_['includes'](_0x4111b7,0x3eb)){var _0x3413ea=_[_0xbb88('0x5a')](_0x3b5483,{'sectionId':0x3eb});return getCustomDashboards(_0x3413ea)[_0xbb88('0x26')](function(_0x9a5c30){return _[_0xbb88('0x2b')](_0x3b5483,function(_0x3b36ec){if(_0x3413ea[_0xbb88('0x5d')]){if(_0x3b36ec[_0xbb88('0x54')]===0x3eb){_0x3b36ec['subsections']=_0x9a5c30;}}else{if(_0x3b36ec[_0xbb88('0x54')]===0x64){if(!_0x3b36ec[_0xbb88('0x60')]){_0x3b36ec[_0xbb88('0x60')]=[];}_0x3b36ec[_0xbb88('0x60')]=_0x3b36ec[_0xbb88('0x60')][_0xbb88('0x61')](_0x9a5c30);}}return _0x3b36ec;});});}else{return;}})[_0xbb88('0x26')](function(_0x3974ca){if(_0x3974ca)_0x3b5483=_0x3974ca;if(_[_0xbb88('0x5e')](_0x4111b7,0x709)){var _0x118557=_[_0xbb88('0x5a')](_0x3b5483,{'sectionId':0x709});return getPlugins(_0x118557)['then'](function(_0x43be2c){if(_0x118557[_0xbb88('0x5d')]){return _[_0xbb88('0x2b')](_0x3b5483,function(_0x4179bc){if(_0x4179bc[_0xbb88('0x54')]===0x709){_0x4179bc[_0xbb88('0x60')]=_0x43be2c;}return _0x4179bc;});}else{var _0x53c0a2={'sectionId':0x76c,'enabled':0x1,'subsections':_0x43be2c};var _0x41d4c2=_[_0xbb88('0x2b')](_0x3b5483);_0x41d4c2[_0xbb88('0x5b')](_0x53c0a2);return _0x41d4c2;}});}else{return;}})[_0xbb88('0x26')](function(_0x1068ad){if(_0x1068ad)_0x3b5483=_0x1068ad;return _['filter'](_0x3b5483,[_0xbb88('0x5d'),0x1]);})[_0xbb88('0x26')](respondWithResult(_0x2cd5ce,null))[_0xbb88('0x45')](handleError(_0x2cd5ce,null));};function hasDefaultDashboard(_0x353baa){var _0x1aad1f=[0x65];return new BPromise(function(_0x2f7e4f,_0x28877c){try{if(_0x353baa[_0xbb88('0x52')]){_0x2f7e4f(_0x1aad1f);}else{return db[_0xbb88('0x53')][_0xbb88('0x62')]({'where':{'sectionId':_0x353baa['id']},'raw':!![]})[_0xbb88('0x26')](function(_0x24976f){_0x24976f?_0x2f7e4f(_0x1aad1f):_0x2f7e4f();});}}catch(_0x5e3c24){_0x28877c(_0x5e3c24);}});}function getCustomDashboards(_0x440abc){var _0x1a8628=[];return new BPromise(function(_0x122bec,_0x41958a){try{if(_0x440abc[_0xbb88('0x52')]){return db[_0xbb88('0x63')][_0xbb88('0x43')]({'raw':!![]})['then'](function(_0x4b3aa9){_0x4b3aa9['forEach'](function(_0x1d277d){_0x1a8628[_0xbb88('0x5b')](_0x1d277d['id']+0x1869f);});_0x122bec(_0x1a8628);});}else{return db[_0xbb88('0x53')][_0xbb88('0x43')]({'where':{'sectionId':_0x440abc['id']},'raw':!![]})[_0xbb88('0x26')](function(_0x3e256b){_0x3e256b[_0xbb88('0x64')](function(_0x1c860e){_0x1a8628[_0xbb88('0x5b')](_0x1c860e[_0xbb88('0x65')]+0x1869f);});_0x122bec(_0x1a8628);});}}catch(_0x593466){_0x41958a(_0x593466);}});}function getPlugins(_0x5f1e84){var _0x4e1b96=[];return new BPromise(function(_0x3582ce,_0x598c93){try{if(_0x5f1e84['autoAssociation']){return db[_0xbb88('0x66')]['findAll']({'raw':!![]})[_0xbb88('0x26')](function(_0x2dffa7){_0x2dffa7[_0xbb88('0x64')](function(_0x49d84a){_0x4e1b96['push'](_0x49d84a['id']+0x15b38);});_0x3582ce(_0x4e1b96);});}else{return db[_0xbb88('0x53')][_0xbb88('0x43')]({'where':{'sectionId':_0x5f1e84['id']},'raw':!![]})['then'](function(_0x308a00){_0x308a00['forEach'](function(_0x5b328e){_0x4e1b96[_0xbb88('0x5b')](_0x5b328e[_0xbb88('0x65')]+0x15b38);});_0x3582ce(_0x4e1b96);});}}catch(_0xb90634){_0x598c93(_0xb90634);}});}exports[_0xbb88('0x67')]=function(_0x6acd5f,_0x188531){return db[_0xbb88('0x2c')][_0xbb88('0x5a')]({'where':{'id':_0x6acd5f[_0xbb88('0x49')]['id']}})[_0xbb88('0x26')](handleEntityNotFound(_0x188531,null))['then'](function(_0x42ef89){if(_0x42ef89){return db[_0xbb88('0x4e')][_0xbb88('0x4f')](function(_0x3d637d){return db[_0xbb88('0x57')][_0xbb88('0x43')]({'where':{'userProfileId':_0x6acd5f[_0xbb88('0x49')]['id']},'attributes':['id'],'raw':!![]})[_0xbb88('0x26')](function(_0x367d6d){if(_0x367d6d){return db['UserProfileSection'][_0xbb88('0x27')]({'where':{'userProfileId':_0x6acd5f[_0xbb88('0x49')]['id'],'id':_[_0xbb88('0x2b')](_0x367d6d,function(_0x2928e5){return _0x2928e5['id'];})},'transaction':_0x3d637d});}})['then'](function(_0x234cd5){var _0x44ecfa=_[_0xbb88('0x2b')](_0x6acd5f[_0xbb88('0x4c')],function(_0x3574c8){_0x3574c8[_0xbb88('0x55')]=_0x6acd5f[_0xbb88('0x49')]['id'];return _0x3574c8;});return db[_0xbb88('0x57')][_0xbb88('0x68')](_0x44ecfa,{'raw':!![],'transaction':_0x3d637d});})[_0xbb88('0x26')](function(_0x245264){var _0x4ec11d=_[_0xbb88('0x69')](_['map'](_0x245264,function(_0x2729e5){return _0x2729e5[_0xbb88('0x50')]({'plain':!![]});}),{'includeAll':![]});if(_0x4ec11d){return db[_0xbb88('0x57')][_0xbb88('0x43')]({'where':{'userProfileId':_0x6acd5f[_0xbb88('0x49')]['id'],'sectionId':_[_0xbb88('0x2b')](_0x4ec11d,function(_0x326b4b){return _0x326b4b[_0xbb88('0x54')];})},'attributes':['id',_0xbb88('0x54')],'raw':!![]})[_0xbb88('0x26')](function(_0x463bc9){var _0x2e05e3=_[_0xbb88('0x2b')](_0x6acd5f[_0xbb88('0x4c')],function(_0x3a9443){_0x3a9443[_0xbb88('0x55')]=_0x6acd5f[_0xbb88('0x49')]['id'];return _0x3a9443;});return db[_0xbb88('0x53')][_0xbb88('0x68')](_0x2e05e3,{'raw':!![],'transaction':_0x3d637d});});}})['catch'](handleError(_0x188531,null));});}})[_0xbb88('0x26')](function(_0x36032){var _0x44ce52=_['map'](_0x36032,function(_0x5ad215){return _0x5ad215['get']({'plain':!![]});});})[_0xbb88('0x26')](respondWithResult(_0x188531,null))[_0xbb88('0x45')](handleError(_0x188531,null));};exports[_0xbb88('0x6a')]=function(_0xecfd43,_0x9e5583,_0x7c85dc){return db[_0xbb88('0x2c')][_0xbb88('0x5a')]({'where':{'id':_0xecfd43[_0xbb88('0x49')]['id']}})[_0xbb88('0x26')](handleEntityNotFound(_0x9e5583,null))[_0xbb88('0x26')](function(_0x102d4b){if(_0x102d4b){return _0x102d4b[_0xbb88('0x6a')](_0xecfd43[_0xbb88('0x31')][_0xbb88('0x5c')]);}})['then'](respondWithStatusCode(_0x9e5583,null))[_0xbb88('0x45')](handleError(_0x9e5583,null));};exports[_0xbb88('0x6b')]=function(_0x4ddc9f,_0x4b58f2){var _0x40da35={};if(!_0x4ddc9f[_0xbb88('0x31')][_0xbb88('0x6c')])throw new Error(_0xbb88('0x6d'));if(!_0x4ddc9f[_0xbb88('0x31')]['hasOwnProperty']('nolimit')){_0x40da35[_0xbb88('0x20')]=qs[_0xbb88('0x20')](_0x4ddc9f[_0xbb88('0x31')][_0xbb88('0x20')]);_0x40da35[_0xbb88('0x1e')]=qs[_0xbb88('0x1e')](_0x4ddc9f[_0xbb88('0x31')][_0xbb88('0x1e')]);}return db['UserProfile'][_0xbb88('0x5a')]({'where':{'id':_0x4ddc9f[_0xbb88('0x49')]['id']}})['then'](function(_0x3cf73c){if(!_0x3cf73c)throw new Error(_0xbb88('0x6e')+_0x4ddc9f[_0xbb88('0x49')]['id']);return db[_0xbb88('0x2c')][_0xbb88('0x6b')](_0x4ddc9f);})[_0xbb88('0x26')](respondWithFilteredResult(_0x4b58f2,_0x40da35))['catch'](handleError(_0x4b58f2,null));}; \ No newline at end of file +var _0x6e29=['../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./userProfile.socket','register','sendStatus','status','json','undefined','limit','count','offset','Content-Range','apply','reject','save','then','end','error','name','send','index','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','options','include','UserProfile','findAll','rows','show','params','includeAll','find','create','body','catch','clone','omit','updatedAt','crudPermissions','transaction','get','UserProfileSection','each','autoAssociation','UserProfileResource','createdAt','userProfileId','Resources','update','describe','addSections','destroy','sectionId','push','removeSections','ids','getSections','enabled','includes','subsections','concat','findOne','Dashboard','forEach','resourceId','sequelize','bulkCreate','removeResources','section','Missing\x20section\x20parameter','getResources','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api'];(function(_0x38b890,_0x5d5148){var _0x299d72=function(_0x5dbeb4){while(--_0x5dbeb4){_0x38b890['push'](_0x38b890['shift']());}};_0x299d72(++_0x5d5148);}(_0x6e29,0x1cd));var _0x96e2=function(_0x27e539,_0x4cf05f){_0x27e539=_0x27e539-0x0;var _0x1d081b=_0x6e29[_0x27e539];return _0x1d081b;};'use strict';var emlformat=require(_0x96e2('0x0'));var rimraf=require(_0x96e2('0x1'));var zipdir=require(_0x96e2('0x2'));var jsonpatch=require(_0x96e2('0x3'));var rp=require(_0x96e2('0x4'));var moment=require(_0x96e2('0x5'));var BPromise=require(_0x96e2('0x6'));var Mustache=require(_0x96e2('0x7'));var util=require('util');var path=require(_0x96e2('0x8'));var sox=require(_0x96e2('0x9'));var csv=require(_0x96e2('0xa'));var ejs=require(_0x96e2('0xb'));var fs=require('fs');var fs_extra=require(_0x96e2('0xc'));var _=require(_0x96e2('0xd'));var squel=require(_0x96e2('0xe'));var crypto=require(_0x96e2('0xf'));var jsforce=require(_0x96e2('0x10'));var deskjs=require(_0x96e2('0x11'));var toCsv=require(_0x96e2('0xa'));var querystring=require(_0x96e2('0x12'));var Papa=require(_0x96e2('0x13'));var Redis=require(_0x96e2('0x14'));var authService=require(_0x96e2('0x15'));var qs=require(_0x96e2('0x16'));var as=require(_0x96e2('0x17'));var hardwareService=require(_0x96e2('0x18'));var logger=require(_0x96e2('0x19'))(_0x96e2('0x1a'));var utils=require('../../config/utils');var config=require(_0x96e2('0x1b'));var licenseUtil=require(_0x96e2('0x1c'));var db=require(_0x96e2('0x1d'))['db'];config['redis']=_[_0x96e2('0x1e')](config[_0x96e2('0x1f')],{'host':_0x96e2('0x20'),'port':0x18eb});var socket=require(_0x96e2('0x21'))(new Redis(config[_0x96e2('0x1f')]));require(_0x96e2('0x22'))[_0x96e2('0x23')](socket);function respondWithStatusCode(_0x17a0c8,_0x18ee32){_0x18ee32=_0x18ee32||0xcc;return function(_0x7fd164){if(_0x7fd164){return _0x17a0c8[_0x96e2('0x24')](_0x18ee32);}return _0x17a0c8[_0x96e2('0x25')](_0x18ee32)['end']();};}function respondWithResult(_0x535887,_0x249dde){_0x249dde=_0x249dde||0xc8;return function(_0x545bd8){if(_0x545bd8){return _0x535887[_0x96e2('0x25')](_0x249dde)[_0x96e2('0x26')](_0x545bd8);}};}function respondWithFilteredResult(_0x4efe72,_0x56a3a9){return function(_0x5c0ad0){if(_0x5c0ad0){var _0x3652fe=typeof _0x56a3a9['offset']===_0x96e2('0x27')&&typeof _0x56a3a9[_0x96e2('0x28')]===_0x96e2('0x27');var _0xb23d37=_0x5c0ad0[_0x96e2('0x29')];var _0x45433d=_0x3652fe?0x0:_0x56a3a9[_0x96e2('0x2a')];var _0x3b39a1=_0x3652fe?_0x5c0ad0[_0x96e2('0x29')]:_0x56a3a9['offset']+_0x56a3a9[_0x96e2('0x28')];var _0x1c5687;if(_0x3b39a1>=_0xb23d37){_0x3b39a1=_0xb23d37;_0x1c5687=0xc8;}else{_0x1c5687=0xce;}_0x4efe72[_0x96e2('0x25')](_0x1c5687);return _0x4efe72['set'](_0x96e2('0x2b'),_0x45433d+'-'+_0x3b39a1+'/'+_0xb23d37)[_0x96e2('0x26')](_0x5c0ad0);}return null;};}function patchUpdates(_0x34b461){return function(_0x24fb5d){try{jsonpatch[_0x96e2('0x2c')](_0x24fb5d,_0x34b461,!![]);}catch(_0x10aebb){return BPromise[_0x96e2('0x2d')](_0x10aebb);}return _0x24fb5d[_0x96e2('0x2e')]();};}function saveUpdates(_0x435d44,_0x50fb31){return function(_0x54fc29){if(_0x54fc29){return _0x54fc29['update'](_0x435d44)[_0x96e2('0x2f')](function(_0x55b8d9){return _0x55b8d9;});}return null;};}function removeEntity(_0x546de6,_0x4874ad){return function(_0x29d022){if(_0x29d022){return _0x29d022['destroy']()['then'](function(){_0x546de6[_0x96e2('0x25')](0xcc)[_0x96e2('0x30')]();});}};}function handleEntityNotFound(_0x3a47c8,_0x270d4b){return function(_0x2381bf){if(!_0x2381bf){_0x3a47c8[_0x96e2('0x24')](0x194);}return _0x2381bf;};}function handleError(_0xcdf7ea,_0x56f5ab){_0x56f5ab=_0x56f5ab||0x1f4;return function(_0x72a052){logger[_0x96e2('0x31')](_0x72a052['stack']);if(_0x72a052[_0x96e2('0x32')]){delete _0x72a052[_0x96e2('0x32')];}_0xcdf7ea[_0x96e2('0x25')](_0x56f5ab)[_0x96e2('0x33')](_0x72a052);};}exports[_0x96e2('0x34')]=function(_0x53d716,_0x43800b){var _0x840137={},_0x1a44aa={},_0x36cd94={'count':0x0,'rows':[]};var _0x3fe040=_['map'](db['UserProfile'][_0x96e2('0x35')],function(_0x4dcaa8){return{'name':_0x4dcaa8[_0x96e2('0x36')],'type':_0x4dcaa8[_0x96e2('0x37')]['key']};});_0x1a44aa[_0x96e2('0x38')]=_[_0x96e2('0x39')](_0x3fe040,'name');_0x1a44aa[_0x96e2('0x3a')]=_[_0x96e2('0x3b')](_0x53d716['query']);_0x1a44aa[_0x96e2('0x3c')]=_[_0x96e2('0x3d')](_0x1a44aa[_0x96e2('0x38')],_0x1a44aa[_0x96e2('0x3a')]);_0x840137[_0x96e2('0x3e')]=_['intersection'](_0x1a44aa['model'],qs['fields'](_0x53d716[_0x96e2('0x3a')][_0x96e2('0x3f')]));_0x840137[_0x96e2('0x3e')]=_0x840137[_0x96e2('0x3e')][_0x96e2('0x40')]?_0x840137[_0x96e2('0x3e')]:_0x1a44aa[_0x96e2('0x38')];if(!_0x53d716[_0x96e2('0x3a')][_0x96e2('0x41')](_0x96e2('0x42'))){_0x840137[_0x96e2('0x28')]=qs[_0x96e2('0x28')](_0x53d716[_0x96e2('0x3a')][_0x96e2('0x28')]);_0x840137['offset']=qs['offset'](_0x53d716['query'][_0x96e2('0x2a')]);}_0x840137[_0x96e2('0x43')]=qs['sort'](_0x53d716['query'][_0x96e2('0x44')]);_0x840137[_0x96e2('0x45')]=qs['filters'](_[_0x96e2('0x46')](_0x53d716['query'],_0x1a44aa[_0x96e2('0x3c')]),_0x3fe040);if(_0x53d716[_0x96e2('0x3a')]['filter']){_0x840137[_0x96e2('0x45')]=_['merge'](_0x840137[_0x96e2('0x45')],{'$or':_[_0x96e2('0x39')](_0x3fe040,function(_0x4d7a3d){if(_0x4d7a3d[_0x96e2('0x37')]!==_0x96e2('0x47')){var _0xeb9f55={};_0xeb9f55[_0x4d7a3d[_0x96e2('0x32')]]={'$like':'%'+_0x53d716[_0x96e2('0x3a')][_0x96e2('0x48')]+'%'};return _0xeb9f55;}})});}_0x840137=_[_0x96e2('0x49')]({},_0x840137,_0x53d716[_0x96e2('0x4a')]);var _0x1389ca={'where':_0x840137[_0x96e2('0x45')]};return db['UserProfile'][_0x96e2('0x29')](_0x1389ca)[_0x96e2('0x2f')](function(_0x4f0ad3){_0x36cd94[_0x96e2('0x29')]=_0x4f0ad3;if(_0x53d716[_0x96e2('0x3a')]['includeAll']){_0x840137[_0x96e2('0x4b')]=[{'all':!![]}];}return db[_0x96e2('0x4c')][_0x96e2('0x4d')](_0x840137);})[_0x96e2('0x2f')](function(_0xaae9c7){_0x36cd94[_0x96e2('0x4e')]=_0xaae9c7;return _0x36cd94;})[_0x96e2('0x2f')](respondWithFilteredResult(_0x43800b,_0x840137))['catch'](handleError(_0x43800b,null));};exports[_0x96e2('0x4f')]=function(_0x19ebf0,_0x417b5f){var _0x243344={'raw':![],'where':{'id':_0x19ebf0[_0x96e2('0x50')]['id']}},_0x5c3768={};_0x5c3768[_0x96e2('0x38')]=_[_0x96e2('0x3b')](db[_0x96e2('0x4c')][_0x96e2('0x35')]);_0x5c3768[_0x96e2('0x3a')]=_['keys'](_0x19ebf0['query']);_0x5c3768['filters']=_['intersection'](_0x5c3768[_0x96e2('0x38')],_0x5c3768[_0x96e2('0x3a')]);_0x243344[_0x96e2('0x3e')]=_['intersection'](_0x5c3768[_0x96e2('0x38')],qs['fields'](_0x19ebf0[_0x96e2('0x3a')][_0x96e2('0x3f')]));_0x243344[_0x96e2('0x3e')]=_0x243344[_0x96e2('0x3e')][_0x96e2('0x40')]?_0x243344[_0x96e2('0x3e')]:_0x5c3768['model'];if(_0x19ebf0['query'][_0x96e2('0x51')]){_0x243344[_0x96e2('0x4b')]=[{'all':!![]}];}_0x243344=_['merge']({},_0x243344,_0x19ebf0[_0x96e2('0x4a')]);return db[_0x96e2('0x4c')][_0x96e2('0x52')](_0x243344)[_0x96e2('0x2f')](handleEntityNotFound(_0x417b5f,null))[_0x96e2('0x2f')](respondWithResult(_0x417b5f,null))['catch'](handleError(_0x417b5f,null));};exports[_0x96e2('0x53')]=function(_0x95ea82,_0x54b379){return db['UserProfile'][_0x96e2('0x53')](_0x95ea82[_0x96e2('0x54')],{})[_0x96e2('0x2f')](respondWithResult(_0x54b379,0xc9))[_0x96e2('0x55')](handleError(_0x54b379,null));};exports[_0x96e2('0x56')]=function(_0x345e15,_0x4320bd){var _0x339403={'where':{'id':_0x345e15['params']['id']}},_0x300252={};_0x300252[_0x96e2('0x38')]=_[_0x96e2('0x3b')](db[_0x96e2('0x4c')][_0x96e2('0x35')]);_0x339403[_0x96e2('0x3e')]=_['intersection'](_0x300252[_0x96e2('0x38')],qs[_0x96e2('0x3f')](_0x345e15[_0x96e2('0x3a')]['fields']));_0x339403[_0x96e2('0x3e')]=_0x339403[_0x96e2('0x3e')][_0x96e2('0x40')]?_0x339403[_0x96e2('0x3e')]:_0x300252[_0x96e2('0x38')];if(_0x345e15[_0x96e2('0x3a')][_0x96e2('0x51')]){_0x339403[_0x96e2('0x4b')]=[{'all':!![]}];}_0x339403=_[_0x96e2('0x49')]({},_0x339403,_0x345e15[_0x96e2('0x4a')]);return db[_0x96e2('0x4c')]['find'](_0x339403)[_0x96e2('0x2f')](handleEntityNotFound(_0x4320bd,null))[_0x96e2('0x2f')](function(_0x7eab15){if(_0x7eab15){var _0x291529=_0x7eab15['get']({'plain':!![]});_0x291529=qs[_0x96e2('0x57')](_0x291529,['id','createdAt',_0x96e2('0x58'),_0x96e2('0x59')]);_0x345e15[_0x96e2('0x54')]=_['omit'](_0x345e15[_0x96e2('0x54')],['id','createdAt','updatedAt']);return db['sequelize'][_0x96e2('0x5a')](function(_0x4cd817){return db['UserProfile']['create'](_[_0x96e2('0x49')](_0x291529,_0x345e15[_0x96e2('0x54')]),{'include':_0x345e15[_0x96e2('0x3a')][_0x96e2('0x51')]?[{'all':!![]}]:undefined,'transaction':_0x4cd817})['then'](function(_0xb9aac8){var _0x290d83=_0xb9aac8[_0x96e2('0x5b')]({'plain':!![]});return db[_0x96e2('0x5c')]['findAll']({'where':{'userProfileId':_0x345e15['params']['id']},'raw':!![]})[_0x96e2('0x2f')](function(_0x1c4b8d){if(_0x1c4b8d){return BPromise[_0x96e2('0x5d')](_0x1c4b8d,function(_0x20cad9){return new BPromise(function(_0x3b3ed2,_0x120263){if(_0x20cad9[_0x96e2('0x5e')]===null||_0x20cad9[_0x96e2('0x5e')]===0x1)_0x3b3ed2(null);return db[_0x96e2('0x5f')][_0x96e2('0x4d')]({'where':{'sectionId':_0x20cad9['id']},'raw':!![]})[_0x96e2('0x2f')](function(_0x3913c9){var _0x5110d7=_[_0x96e2('0x39')](_0x3913c9,function(_0x3725fb){return qs[_0x96e2('0x57')](_0x3725fb,['id','createdAt',_0x96e2('0x58'),'sectionId']);});_0x3b3ed2(_0x5110d7);})[_0x96e2('0x55')](function(_0x992ecb){_0x120263(_0x992ecb);});})[_0x96e2('0x2f')](function(_0xac65da){var _0x546af4=qs[_0x96e2('0x57')](_0x20cad9,['id',_0x96e2('0x60'),_0x96e2('0x58')]);_0x546af4[_0x96e2('0x61')]=_0x290d83['id'];if(_0xac65da)_0x546af4[_0x96e2('0x62')]=_0xac65da;return _0x546af4;})[_0x96e2('0x2f')](function(_0xed0b1){return db[_0x96e2('0x5c')]['create'](_0xed0b1,{'include':[{'model':db[_0x96e2('0x5f')],'as':_0x96e2('0x62')}],'raw':!![],'transaction':_0x4cd817});});})['then'](function(){return _0x290d83;});}});});});}})[_0x96e2('0x2f')](respondWithResult(_0x4320bd,0xc9))[_0x96e2('0x55')](handleError(_0x4320bd,null));};exports[_0x96e2('0x63')]=function(_0x32f1d9,_0x2ad68a){if(_0x32f1d9['body']['id']){delete _0x32f1d9['body']['id'];}return db[_0x96e2('0x4c')][_0x96e2('0x52')]({'where':{'id':_0x32f1d9[_0x96e2('0x50')]['id']}})[_0x96e2('0x2f')](handleEntityNotFound(_0x2ad68a,null))['then'](saveUpdates(_0x32f1d9[_0x96e2('0x54')],null))[_0x96e2('0x2f')](respondWithResult(_0x2ad68a,null))[_0x96e2('0x55')](handleError(_0x2ad68a,null));};exports['destroy']=function(_0x1c8fde,_0x59a0cf){return db['UserProfile'][_0x96e2('0x52')]({'where':{'id':_0x1c8fde[_0x96e2('0x50')]['id']}})[_0x96e2('0x2f')](handleEntityNotFound(_0x59a0cf,null))[_0x96e2('0x2f')](removeEntity(_0x59a0cf,null))['catch'](handleError(_0x59a0cf,null));};exports[_0x96e2('0x64')]=function(_0xe7309,_0x58804e){return db[_0x96e2('0x4c')][_0x96e2('0x64')]()[_0x96e2('0x2f')](respondWithResult(_0x58804e,null))[_0x96e2('0x55')](handleError(_0x58804e,null));};exports[_0x96e2('0x65')]=function(_0x21226f,_0x26a2ab){var _0x22a4b1=_0x21226f[_0x96e2('0x54')];return db[_0x96e2('0x4c')]['find']({'where':{'id':_0x21226f[_0x96e2('0x50')]['id']}})['then'](handleEntityNotFound(_0x26a2ab,null))['then'](function(_0x101ed7){if(_0x101ed7){return db['sequelize']['transaction'](function(_0x5f27cd){return db[_0x96e2('0x5c')][_0x96e2('0x66')]({'where':{'userProfileId':_0x21226f[_0x96e2('0x50')]['id'],'sectionId':_[_0x96e2('0x39')](_0x22a4b1,function(_0x38b656){return _0x38b656[_0x96e2('0x67')];})},'transaction':_0x5f27cd})[_0x96e2('0x2f')](function(){var _0x4a2bbd=_['map'](_0x22a4b1,function(_0x22ce6d){_0x22ce6d['userProfileId']=_0x21226f[_0x96e2('0x50')]['id'];return _0x22ce6d;});var _0x11dd25=[];return BPromise[_0x96e2('0x5d')](_0x4a2bbd,function(_0x1c3ead){return db[_0x96e2('0x5c')][_0x96e2('0x53')](_0x1c3ead,{'include':[{'model':db['UserProfileResource'],'as':_0x96e2('0x62')}],'raw':!![],'transaction':_0x5f27cd})[_0x96e2('0x2f')](function(_0x506a09){_0x11dd25[_0x96e2('0x68')](_0x506a09[_0x96e2('0x5b')]({'plain':!![]}));});})[_0x96e2('0x2f')](function(){return _0x11dd25;});});});}})[_0x96e2('0x2f')](function(_0xe9f5fc){return _0xe9f5fc;})[_0x96e2('0x2f')](respondWithResult(_0x26a2ab,null))[_0x96e2('0x55')](handleError(_0x26a2ab,null));};exports[_0x96e2('0x69')]=function(_0x259583,_0x14e147){var _0x8cbf74;return db[_0x96e2('0x4c')][_0x96e2('0x52')]({'where':{'id':_0x259583['params']['id']},'attributes':['id','name']})['then'](handleEntityNotFound(_0x14e147,null))[_0x96e2('0x2f')](function(_0x3cb7f3){if(_0x3cb7f3){_0x8cbf74=_0x3cb7f3;return db[_0x96e2('0x5c')][_0x96e2('0x66')]({'where':{'userProfileId':_0x259583['params']['id'],'sectionId':_0x259583[_0x96e2('0x3a')][_0x96e2('0x6a')]}});}})[_0x96e2('0x2f')](function(){return _0x8cbf74;})[_0x96e2('0x2f')](respondWithStatusCode(_0x14e147,null))['catch'](handleError(_0x14e147,null));};exports[_0x96e2('0x6b')]=function(_0x1f57f4,_0x110c25){var _0x1deccb=[];var _0x19d00c=[];return db['UserProfileSection'][_0x96e2('0x4d')]({'where':{'userProfileId':_0x1f57f4[_0x96e2('0x50')]['id']},'raw':!![]})[_0x96e2('0x2f')](function(_0x16e4f0){_0x1deccb=_[_0x96e2('0x48')](_0x16e4f0,function(_0x1cc6e){return _0x1cc6e[_0x96e2('0x6c')]===0x1||_[_0x96e2('0x6d')]([0x3eb,0x709],_0x1cc6e[_0x96e2('0x67')]);});if(!_['isEmpty'](_0x1deccb)){return _[_0x96e2('0x39')](_0x1deccb,function(_0x1b5c97){return _0x1b5c97[_0x96e2('0x67')];});}else{return;}})[_0x96e2('0x2f')](function(_0x4e7df6){if(_0x4e7df6)_0x19d00c=_0x4e7df6;if(_[_0x96e2('0x6d')](_0x19d00c,0x64)){var _0x9f58b0=_[_0x96e2('0x52')](_0x1deccb,{'sectionId':0x64});return hasDefaultDashboard(_0x9f58b0)['then'](function(_0x16a67d){return _[_0x96e2('0x39')](_0x1deccb,function(_0x547fdf){if(_0x547fdf['sectionId']===0x64){_0x547fdf[_0x96e2('0x6e')]=_0x16a67d;}return _0x547fdf;});});}else{return;}})['then'](function(_0x562d6f){if(_0x562d6f)_0x1deccb=_0x562d6f;if(_[_0x96e2('0x6d')](_0x19d00c,0x3eb)){var _0x3a8be6=_[_0x96e2('0x52')](_0x1deccb,{'sectionId':0x3eb});return getCustomDashboards(_0x3a8be6)[_0x96e2('0x2f')](function(_0x4a1838){return _[_0x96e2('0x39')](_0x1deccb,function(_0x477759){if(_0x3a8be6[_0x96e2('0x6c')]){if(_0x477759[_0x96e2('0x67')]===0x3eb){_0x477759[_0x96e2('0x6e')]=_0x4a1838;}}else{if(_0x477759[_0x96e2('0x67')]===0x64){if(!_0x477759['subsections']){_0x477759[_0x96e2('0x6e')]=[];}_0x477759['subsections']=_0x477759[_0x96e2('0x6e')][_0x96e2('0x6f')](_0x4a1838);}}return _0x477759;});});}else{return;}})['then'](function(_0x1c0b68){if(_0x1c0b68)_0x1deccb=_0x1c0b68;if(_[_0x96e2('0x6d')](_0x19d00c,0x709)){var _0x27b0f7=_[_0x96e2('0x52')](_0x1deccb,{'sectionId':0x709});return getPlugins(_0x27b0f7)[_0x96e2('0x2f')](function(_0x3b39f1){if(_0x27b0f7[_0x96e2('0x6c')]){return _[_0x96e2('0x39')](_0x1deccb,function(_0x1521de){if(_0x1521de['sectionId']===0x709){_0x1521de['subsections']=_0x3b39f1;}return _0x1521de;});}else{var _0x398d42={'sectionId':0x76c,'enabled':0x1,'subsections':_0x3b39f1};var _0x40e0d1=_[_0x96e2('0x39')](_0x1deccb);_0x40e0d1[_0x96e2('0x68')](_0x398d42);return _0x40e0d1;}});}else{return;}})[_0x96e2('0x2f')](function(_0x33dfb5){if(_0x33dfb5)_0x1deccb=_0x33dfb5;return _[_0x96e2('0x48')](_0x1deccb,[_0x96e2('0x6c'),0x1]);})[_0x96e2('0x2f')](respondWithResult(_0x110c25,null))['catch'](handleError(_0x110c25,null));};function hasDefaultDashboard(_0x588271){var _0x59491e=[0x65];return new BPromise(function(_0x515313,_0x1f9f0c){try{if(_0x588271['autoAssociation']){_0x515313(_0x59491e);}else{return db['UserProfileResource'][_0x96e2('0x70')]({'where':{'sectionId':_0x588271['id']},'raw':!![]})['then'](function(_0x4a5f28){_0x4a5f28?_0x515313(_0x59491e):_0x515313();});}}catch(_0x9ae0f){_0x1f9f0c(_0x9ae0f);}});}function getCustomDashboards(_0x1833f4){var _0x122a66=[];return new BPromise(function(_0x5ddaca,_0x5ccfba){try{if(_0x1833f4[_0x96e2('0x5e')]){return db[_0x96e2('0x71')][_0x96e2('0x4d')]({'raw':!![]})[_0x96e2('0x2f')](function(_0x38e063){_0x38e063[_0x96e2('0x72')](function(_0x4dfbfd){_0x122a66[_0x96e2('0x68')](_0x4dfbfd['id']+0x1869f);});_0x5ddaca(_0x122a66);});}else{return db[_0x96e2('0x5f')]['findAll']({'where':{'sectionId':_0x1833f4['id']},'raw':!![]})[_0x96e2('0x2f')](function(_0x432b34){_0x432b34[_0x96e2('0x72')](function(_0x41edd0){_0x122a66[_0x96e2('0x68')](_0x41edd0['resourceId']+0x1869f);});_0x5ddaca(_0x122a66);});}}catch(_0x1c7964){_0x5ccfba(_0x1c7964);}});}function getPlugins(_0x36e178){var _0x195203=[];return new BPromise(function(_0x431975,_0x214f32){try{if(_0x36e178[_0x96e2('0x5e')]){return db['Plugin'][_0x96e2('0x4d')]({'raw':!![]})[_0x96e2('0x2f')](function(_0x192552){_0x192552[_0x96e2('0x72')](function(_0x38a98e){_0x195203[_0x96e2('0x68')](_0x38a98e['id']+0x15b38);});_0x431975(_0x195203);});}else{return db[_0x96e2('0x5f')][_0x96e2('0x4d')]({'where':{'sectionId':_0x36e178['id']},'raw':!![]})[_0x96e2('0x2f')](function(_0x36f8ba){_0x36f8ba['forEach'](function(_0xab15fb){_0x195203[_0x96e2('0x68')](_0xab15fb[_0x96e2('0x73')]+0x15b38);});_0x431975(_0x195203);});}}catch(_0x1385db){_0x214f32(_0x1385db);}});}exports['addResources']=function(_0x211294,_0x1ab780){return db[_0x96e2('0x4c')]['find']({'where':{'id':_0x211294[_0x96e2('0x50')]['id']}})['then'](handleEntityNotFound(_0x1ab780,null))[_0x96e2('0x2f')](function(_0x42eef2){if(_0x42eef2){return db[_0x96e2('0x74')][_0x96e2('0x5a')](function(_0x185ec9){return db[_0x96e2('0x5c')][_0x96e2('0x4d')]({'where':{'userProfileId':_0x211294['params']['id']},'attributes':['id'],'raw':!![]})[_0x96e2('0x2f')](function(_0x9492f1){if(_0x9492f1){return db[_0x96e2('0x5c')][_0x96e2('0x66')]({'where':{'userProfileId':_0x211294[_0x96e2('0x50')]['id'],'id':_['map'](_0x9492f1,function(_0x12a97f){return _0x12a97f['id'];})},'transaction':_0x185ec9});}})[_0x96e2('0x2f')](function(_0x25fbb7){var _0x3fddd6=_[_0x96e2('0x39')](_0x211294[_0x96e2('0x54')],function(_0x36d415){_0x36d415[_0x96e2('0x61')]=_0x211294['params']['id'];return _0x36d415;});return db[_0x96e2('0x5c')][_0x96e2('0x75')](_0x3fddd6,{'raw':!![],'transaction':_0x185ec9});})['then'](function(_0x5e8b8e){var _0x155cc1=_[_0x96e2('0x48')](_[_0x96e2('0x39')](_0x5e8b8e,function(_0x458363){return _0x458363[_0x96e2('0x5b')]({'plain':!![]});}),{'includeAll':![]});if(_0x155cc1){return db[_0x96e2('0x5c')][_0x96e2('0x4d')]({'where':{'userProfileId':_0x211294[_0x96e2('0x50')]['id'],'sectionId':_[_0x96e2('0x39')](_0x155cc1,function(_0x506ac9){return _0x506ac9[_0x96e2('0x67')];})},'attributes':['id',_0x96e2('0x67')],'raw':!![]})[_0x96e2('0x2f')](function(_0x40a0a2){var _0x5269ca=_[_0x96e2('0x39')](_0x211294['body'],function(_0x2ceede){_0x2ceede[_0x96e2('0x61')]=_0x211294['params']['id'];return _0x2ceede;});return db[_0x96e2('0x5f')][_0x96e2('0x75')](_0x5269ca,{'raw':!![],'transaction':_0x185ec9});});}})[_0x96e2('0x55')](handleError(_0x1ab780,null));});}})[_0x96e2('0x2f')](function(_0x3d036a){var _0x322548=_[_0x96e2('0x39')](_0x3d036a,function(_0x1570ab){return _0x1570ab[_0x96e2('0x5b')]({'plain':!![]});});})[_0x96e2('0x2f')](respondWithResult(_0x1ab780,null))[_0x96e2('0x55')](handleError(_0x1ab780,null));};exports['removeResources']=function(_0x436697,_0x86400,_0x39b7f0){return db['UserProfile'][_0x96e2('0x52')]({'where':{'id':_0x436697['params']['id']}})[_0x96e2('0x2f')](handleEntityNotFound(_0x86400,null))[_0x96e2('0x2f')](function(_0x23e2c5){if(_0x23e2c5){return _0x23e2c5[_0x96e2('0x76')](_0x436697[_0x96e2('0x3a')][_0x96e2('0x6a')]);}})[_0x96e2('0x2f')](respondWithStatusCode(_0x86400,null))['catch'](handleError(_0x86400,null));};exports['getResources']=function(_0x3bf78e,_0x1a2590){var _0x4e62b8={};if(!_0x3bf78e[_0x96e2('0x3a')][_0x96e2('0x77')])throw new Error(_0x96e2('0x78'));if(!_0x3bf78e['query']['hasOwnProperty'](_0x96e2('0x42'))){_0x4e62b8['limit']=qs[_0x96e2('0x28')](_0x3bf78e[_0x96e2('0x3a')]['limit']);_0x4e62b8[_0x96e2('0x2a')]=qs['offset'](_0x3bf78e[_0x96e2('0x3a')][_0x96e2('0x2a')]);}return db['UserProfile'][_0x96e2('0x52')]({'where':{'id':_0x3bf78e[_0x96e2('0x50')]['id']}})[_0x96e2('0x2f')](function(_0x4d4cf7){if(!_0x4d4cf7)throw new Error('No\x20User\x20Profile\x20found\x20for\x20id\x20'+_0x3bf78e[_0x96e2('0x50')]['id']);return db[_0x96e2('0x4c')][_0x96e2('0x79')](_0x3bf78e);})[_0x96e2('0x2f')](respondWithFilteredResult(_0x1a2590,_0x4e62b8))[_0x96e2('0x55')](handleError(_0x1a2590,null));}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index af5d957..a4869fa 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 _0x539d=['hasOwnProperty','hook','exports','events','UserProfile','setMaxListeners','remove','emit'];(function(_0x24164d,_0x12e3f2){var _0x4e0441=function(_0x3241ad){while(--_0x3241ad){_0x24164d['push'](_0x24164d['shift']());}};_0x4e0441(++_0x12e3f2);}(_0x539d,0x17b));var _0xd539=function(_0x144b30,_0x77072d){_0x144b30=_0x144b30-0x0;var _0x1bb7bc=_0x539d[_0x144b30];return _0x1bb7bc;};'use strict';var EventEmitter=require(_0xd539('0x0'));var UserProfile=require('../../mysqldb')['db'][_0xd539('0x1')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0xd539('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xd539('0x3')};function emitEvent(_0x2a38d5){return function(_0xe8e6e4,_0x19ae25,_0x2f9d1f){UserProfileEvents['emit'](_0x2a38d5+':'+_0xe8e6e4['id'],_0xe8e6e4);UserProfileEvents[_0xd539('0x4')](_0x2a38d5,_0xe8e6e4);_0x2f9d1f(null);};}for(var e in events){if(events[_0xd539('0x5')](e)){var event=events[e];UserProfile[_0xd539('0x6')](e,emitEvent(event));}}module[_0xd539('0x7')]=UserProfileEvents; \ No newline at end of file +var _0x7524=['emit','hasOwnProperty','hook','../../mysqldb','UserProfile','save','update'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x7524,0xce));var _0x4752=function(_0x173137,_0x5f3278){_0x173137=_0x173137-0x0;var _0x4930be=_0x7524[_0x173137];return _0x4930be;};'use strict';var EventEmitter=require('events');var UserProfile=require(_0x4752('0x0'))['db'][_0x4752('0x1')];var UserProfileEvents=new EventEmitter();UserProfileEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x4752('0x2'),'afterUpdate':_0x4752('0x3'),'afterDestroy':'remove'};function emitEvent(_0x599e2b){return function(_0x3eae1a,_0x4d5e05,_0x3884b9){UserProfileEvents[_0x4752('0x4')](_0x599e2b+':'+_0x3eae1a['id'],_0x3eae1a);UserProfileEvents[_0x4752('0x4')](_0x599e2b,_0x3eae1a);_0x3884b9(null);};}for(var e in events){if(events[_0x4752('0x5')](e)){var event=events[e];UserProfile[_0x4752('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 7f20703..4b6aaab 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 _0xf435=['SmsAccount','whatsappqueues','whatsappaccounts','WhatsappAccount','Team','queuecampaigns','users','telephones','Users','user','Telephones','ZendeskAccount','SalesforceAccount','freshdeskaccounts','sugarcrmaccounts','SugarcrmAccount','deskaccounts','DeskAccount','ZohoAccount','vtigeraccounts','cannedanswers','CannedAnswer','Disposition','customdashboards','Dashboard','intervals','Interval','pauses','Pause','scheduler','sounds','tags','templates','Template','triggers','Trigger','Trunk','variables','Variable','Plugin','extractedreports','Reports','reportId','metrics','charAt','toUpperCase','slice','Sequelize','SELECT','select','InteractionId','ui.createdAt','from','_interactions','where','ui.UserId\x20=\x20?','sequelize','query','OpenTabs','define','UserProfile','user_profiles','../../components/parsers/qs','raw','isEmpty','length','push','UserProfileSection','find','params','all','ignore','union','autoAssociation','rawAttributes','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','limit','offset','order','sort','pick','merge','VIRTUAL','foreignKey','options','AnalyticExtractedReport','include','forEach','reportType','default','DefaultReports','custom','count','ids','customSorting','extraQueryConditions','includeAll','Tag','ThroughTags','color','tag','chat','rows','dataValues','sms','fax','openchannel','whatsapp','lodash','./userProfile.attributes','squel','exports','filter','field','value','findAll','then','associatedResources','catch','model','map','name','resolve','UserProfileResource','resourceId','type','squareprojects','childModel','SquareProject','odbc','SquareOdbc','squarerecordings','SquareRecording','parentSections','SquareProjects','projects','JscriptyProject','contacts','CmContact','Lists','ListId','lists','CmList','CmCompany','globalcustomfields','CmCustomField','chatqueues','ChatQueue','faxqueues','FaxQueue','faxaccounts','inboundroutes','internalroutes','outboundroutes','VoiceExtension','contexts','VoiceContext','voicemails','VoiceMail','Agents','membername','User','role','agent','telephone','VoiceQueues','queue','VoiceQueue','inbound','QueueCampaigns','outbound','musiconholds','VoiceMusicOnHold','chanspies','VoiceChanSpy','voiceprefixes','VoicePrefix','ivrcampaigns','Campaign','mailqueues','MailQueue','mailaccounts','MailAccount','MailSubstatus','openchannelqueues','openchannelaccounts','OpenchannelAccount','smsqueues','SmsQueue','smsaccounts'];(function(_0x5dc234,_0x8bfeef){var _0x4e4b39=function(_0x2a671f){while(--_0x2a671f){_0x5dc234['push'](_0x5dc234['shift']());}};_0x4e4b39(++_0x8bfeef);}(_0xf435,0x136));var _0x5f43=function(_0x56c864,_0x7b8e4){_0x56c864=_0x56c864-0x0;var _0x2b5df4=_0xf435[_0x56c864];return _0x2b5df4;};'use strict';var _=require(_0x5f43('0x0'));var attributes=require(_0x5f43('0x1'));var squel=require(_0x5f43('0x2'));module[_0x5f43('0x3')]=function(_0x24a542){var _0x5354d1=_0x24a542['models'];function _0xe85167(_0x2ce0f2,_0x4edb78){return new Promise(function(_0x5b5279,_0x556618){if(!_0x4edb78)return _0x5b5279(null);var _0x12b68f=_0x4edb78[_0x5f43('0x4')]?{[_0x4edb78[_0x5f43('0x4')][_0x5f43('0x5')]]:_0x4edb78[_0x5f43('0x4')][_0x5f43('0x6')]}:undefined;return _0x5354d1[_0x2ce0f2][_0x5f43('0x7')]({'where':_0x12b68f,'raw':!![]})[_0x5f43('0x8')](function(_0x1a3f0c){_0x4edb78[_0x5f43('0x9')]=_['map'](_0x1a3f0c,'id');_0x5b5279(_0x4edb78);})[_0x5f43('0xa')](function(_0x113142){_0x556618(_0x113142);});});}function _0xa27ec4(_0xc41ab2,_0x11bd76){return new Promise(function(_0x41fb35,_0x3b55ea){var _0x2f8745=_0xc41ab2[_0x5f43('0x4')]?{[_0xc41ab2[_0x5f43('0x4')][_0x5f43('0x5')]]:_0xc41ab2[_0x5f43('0x4')][_0x5f43('0x6')]}:undefined;return _0x5354d1[_0xc41ab2[_0x5f43('0xb')]][_0x5f43('0x7')]({'where':_0x2f8745,'raw':!![]})[_0x5f43('0x8')](function(_0x4abff5){_0x11bd76[_0x5f43('0x9')]=_[_0x5f43('0xc')](_0x4abff5,function(_0x5c0ecc){return _0x5c0ecc[_0x5f43('0xd')];});_0x41fb35(_0x11bd76);})['catch'](function(_0x405d0b){_0x3b55ea(_0x405d0b);});});}function _0x2c88ee(_0x1d1542,_0x2b6d05,_0x2ff099){if(!_0x2b6d05)return Promise[_0x5f43('0xe')](null);return new Promise(function(_0x2c151b,_0x3d9532){return _0x5354d1[_0x5f43('0xf')]['findAll']({'where':{'sectionId':_0x2b6d05['id']},'raw':!![]})[_0x5f43('0x8')](function(_0x596582){if(_0x1d1542['field']&&_0x1d1542[_0x5f43('0x5')]!=='id'){_0x2b6d05[_0x5f43('0x9')]=_[_0x5f43('0xc')](_0x596582,function(_0x1cbbfa){return _0x1cbbfa[_0x1d1542[_0x5f43('0x5')]];});}else{if(_0x2ff099==='AnalyticExtractedReport'){_0x2b6d05[_0x5f43('0x9')]=_['map'](_0x596582,function(_0x402496){return{'id':_0x402496[_0x5f43('0x10')],'type':_0x402496[_0x5f43('0x11')]};});}else{_0x2b6d05[_0x5f43('0x9')]=_[_0x5f43('0xc')](_0x596582,function(_0x56069c){return _0x56069c[_0x5f43('0x10')];});}}_0x2c151b(_0x2b6d05);})[_0x5f43('0xa')](function(_0x581874){_0x3d9532(_0x581874);});});}function _0x3bca9e(_0x244c8f,_0x3b20fb){var _0xff3e22={'parentSections':[]};switch(_0x244c8f['toLowerCase']()){case _0x5f43('0x12'):_0xff3e22[_0x5f43('0x13')]=_0x5f43('0x14');break;case _0x5f43('0x15'):_0xff3e22['childModel']=_0x5f43('0x16');break;case _0x5f43('0x17'):_0xff3e22[_0x5f43('0x13')]=_0x5f43('0x18');_0xff3e22[_0x5f43('0x19')]=[{'name':_0x5f43('0x1a'),'field':_0x5f43('0xd'),'foreignKey':'projectName'}];break;case _0x5f43('0x1b'):_0xff3e22['childModel']=_0x5f43('0x1c');break;case _0x5f43('0x1d'):_0xff3e22[_0x5f43('0x13')]=_0x5f43('0x1e');_0xff3e22[_0x5f43('0x19')]=[{'name':_0x5f43('0x1f'),'field':'id','foreignKey':_0x5f43('0x20')}];break;case _0x5f43('0x21'):_0xff3e22[_0x5f43('0x13')]=_0x5f43('0x22');break;case'companies':_0xff3e22[_0x5f43('0x13')]=_0x5f43('0x23');break;case _0x5f43('0x24'):_0xff3e22[_0x5f43('0x13')]=_0x5f43('0x25');break;case _0x5f43('0x26'):_0xff3e22['childModel']=_0x5f43('0x27');break;case'chatwebsites':_0xff3e22[_0x5f43('0x13')]='ChatWebsite';break;case _0x5f43('0x28'):_0xff3e22[_0x5f43('0x13')]=_0x5f43('0x29');break;case _0x5f43('0x2a'):_0xff3e22[_0x5f43('0x13')]='FaxAccount';break;case _0x5f43('0x2b'):case _0x5f43('0x2c'):case _0x5f43('0x2d'):_0xff3e22[_0x5f43('0x13')]=_0x5f43('0x2e');break;case _0x5f43('0x2f'):_0xff3e22[_0x5f43('0x13')]=_0x5f43('0x30');break;case _0x5f43('0x31'):_0xff3e22['childModel']=_0x5f43('0x32');break;case'voicerecordings':_0xff3e22[_0x5f43('0x13')]='VoiceRecording';_0xff3e22['parentSections']=[{'name':_0x5f43('0x33'),'field':_0x5f43('0xd'),'foreignKey':_0x5f43('0x34'),'model':_0x5f43('0x35'),'filter':{'field':_0x5f43('0x36'),'value':[_0x5f43('0x37')]}},{'name':'Telephones','field':_0x5f43('0xd'),'foreignKey':_0x5f43('0x34'),'model':_0x5f43('0x35'),'filter':{'field':_0x5f43('0x36'),'value':[_0x5f43('0x38')]}},{'name':_0x5f43('0x39'),'field':_0x5f43('0xd'),'foreignKey':_0x5f43('0x3a'),'model':_0x5f43('0x3b'),'filter':{'field':_0x5f43('0x11'),'value':[_0x5f43('0x3c')]}},{'name':_0x5f43('0x3d'),'field':_0x5f43('0xd'),'foreignKey':_0x5f43('0x3a'),'model':_0x5f43('0x3b'),'filter':{'field':_0x5f43('0x11'),'value':[_0x5f43('0x3e')]}}];break;case _0x5f43('0x3f'):_0xff3e22[_0x5f43('0x13')]=_0x5f43('0x40');break;case _0x5f43('0x41'):_0xff3e22[_0x5f43('0x13')]=_0x5f43('0x42');break;case _0x5f43('0x43'):_0xff3e22['childModel']=_0x5f43('0x44');break;case _0x5f43('0x45'):_0xff3e22[_0x5f43('0x13')]=_0x5f43('0x46');break;case _0x5f43('0x47'):_0xff3e22[_0x5f43('0x13')]=_0x5f43('0x48');break;case _0x5f43('0x49'):_0xff3e22[_0x5f43('0x13')]=_0x5f43('0x4a');break;case'mailsubstatuses':_0xff3e22[_0x5f43('0x13')]=_0x5f43('0x4b');break;case _0x5f43('0x4c'):_0xff3e22['childModel']='OpenchannelQueue';break;case _0x5f43('0x4d'):_0xff3e22[_0x5f43('0x13')]=_0x5f43('0x4e');break;case _0x5f43('0x4f'):_0xff3e22['childModel']=_0x5f43('0x50');break;case _0x5f43('0x51'):_0xff3e22[_0x5f43('0x13')]=_0x5f43('0x52');break;case _0x5f43('0x53'):_0xff3e22[_0x5f43('0x13')]='WhatsappQueue';break;case _0x5f43('0x54'):_0xff3e22['childModel']=_0x5f43('0x55');break;case'teams':_0xff3e22[_0x5f43('0x13')]=_0x5f43('0x56');break;case'voicequeues':case _0x5f43('0x57'):_0xff3e22['childModel']=_0x5f43('0x3b');if(_0x3b20fb){_0xff3e22[_0x5f43('0x19')]=[{'name':_0x5f43('0x39')},{'name':_0x5f43('0x3d')}];}break;case _0x5f43('0x58'):case'agents':case _0x5f43('0x59'):_0xff3e22[_0x5f43('0x13')]=_0x5f43('0x35');if(_0x3b20fb){_0xff3e22[_0x5f43('0x19')]=[{'name':_0x5f43('0x5a'),'filter':{'field':_0x5f43('0x36'),'value':['admin',_0x5f43('0x5b')]},'ignore':!![]},{'name':_0x5f43('0x33')},{'name':_0x5f43('0x5c')}];}break;case'zendeskaccounts':_0xff3e22[_0x5f43('0x13')]=_0x5f43('0x5d');break;case'salesforceaccounts':_0xff3e22['childModel']=_0x5f43('0x5e');break;case _0x5f43('0x5f'):_0xff3e22['childModel']='FreshdeskAccount';break;case _0x5f43('0x60'):_0xff3e22[_0x5f43('0x13')]=_0x5f43('0x61');break;case _0x5f43('0x62'):_0xff3e22[_0x5f43('0x13')]=_0x5f43('0x63');break;case'zohoaccounts':_0xff3e22['childModel']=_0x5f43('0x64');break;case _0x5f43('0x65'):_0xff3e22['childModel']=_0x5f43('0x35');break;case _0x5f43('0x66'):_0xff3e22[_0x5f43('0x13')]=_0x5f43('0x67');break;case'dispositions':_0xff3e22[_0x5f43('0x13')]=_0x5f43('0x68');break;case _0x5f43('0x69'):_0xff3e22[_0x5f43('0x13')]=_0x5f43('0x6a');break;case _0x5f43('0x6b'):_0xff3e22[_0x5f43('0x13')]=_0x5f43('0x6c');break;case _0x5f43('0x6d'):_0xff3e22[_0x5f43('0x13')]=_0x5f43('0x6e');break;case _0x5f43('0x6f'):_0xff3e22[_0x5f43('0x13')]='Schedule';break;case _0x5f43('0x70'):_0xff3e22[_0x5f43('0x13')]='Sound';break;case _0x5f43('0x71'):_0xff3e22['childModel']='Tag';break;case _0x5f43('0x72'):_0xff3e22[_0x5f43('0x13')]=_0x5f43('0x73');break;case _0x5f43('0x74'):_0xff3e22[_0x5f43('0x13')]=_0x5f43('0x75');break;case'trunks':_0xff3e22[_0x5f43('0x13')]=_0x5f43('0x76');break;case _0x5f43('0x77'):_0xff3e22[_0x5f43('0x13')]=_0x5f43('0x78');break;case'plugins':_0xff3e22['childModel']=_0x5f43('0x79');break;case _0x5f43('0x7a'):_0xff3e22[_0x5f43('0x13')]='AnalyticExtractedReport';_0xff3e22[_0x5f43('0x19')]=[{'name':_0x5f43('0x7b'),'field':'id','foreignKey':_0x5f43('0x7c')}];break;case _0x5f43('0x7d'):_0xff3e22['childModel']='AnalyticMetric';break;}return _0xff3e22;}function _0x262231(_0x3c98bf,_0x106628){var _0x1d706f=_0x3c98bf[_0x5f43('0x7e')](0x0)[_0x5f43('0x7f')]()+_0x3c98bf[_0x5f43('0x80')](0x1);var _0x49ade3={'type':_0x5354d1[_0x5f43('0x81')]['QueryTypes'][_0x5f43('0x82')],'raw':!![]};return new Promise(function(_0x7cbe6f,_0x335dc5){var _0x28815e=squel[_0x5f43('0x83')]()[_0x5f43('0x5')]('ui.'+_0x1d706f+_0x5f43('0x84'),'id')[_0x5f43('0x5')](_0x5f43('0x85'))[_0x5f43('0x86')]('user_has_'+_0x3c98bf+_0x5f43('0x87'),'ui')[_0x5f43('0x88')](_0x5f43('0x89'),_0x106628['id']);return _0x5354d1[_0x5f43('0x8a')][_0x5f43('0x8b')](_0x28815e['toString'](),_0x49ade3)[_0x5f43('0x8')](function(_0x360b64){_0x106628[_0x1d706f+_0x5f43('0x8c')]=_0x360b64;_0x7cbe6f(_0x360b64);})[_0x5f43('0xa')](function(_0x4c8e5c){_0x335dc5(_0x4c8e5c);});});}return _0x24a542[_0x5f43('0x8d')](_0x5f43('0x8e'),attributes,{'tableName':_0x5f43('0x8f'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x15b092){var _0x40e97b=require(_0x5f43('0x90'));var _0xb22f3f={'raw':_0x15b092[_0x5f43('0x8b')][_0x5f43('0x91')],'where':{}};var _0x59fb88={};var _0x3ec929={'count':0x0,'rows':[]};var _0x52f065=_0x15b092['query']['section'];var _0x1ee4e3=_0x15b092['query']['mergeResources']||![];var _0x267224=_0x3bca9e(_0x52f065,_0x1ee4e3);if(!_0x267224[_0x5f43('0x13')])throw new Error('Invalid\x20section\x20\x27'+_0x52f065+'\x27');var _0x3d8d60=[{'name':_0x52f065}];if(!_[_0x5f43('0x92')](_0x267224[_0x5f43('0x19')]))_0x3d8d60=_0x267224[_0x5f43('0x19')];var _0x294a25=[];for(var _0xa0f7a4=0x0;_0xa0f7a4<_0x3d8d60[_0x5f43('0x93')];_0xa0f7a4++){_0x294a25[_0x5f43('0x94')](_0x5354d1[_0x5f43('0x95')][_0x5f43('0x96')]({'where':{'userProfileId':_0x15b092[_0x5f43('0x97')]['id'],'name':_0x3d8d60[_0xa0f7a4][_0x5f43('0xd')]},'raw':!![]}));}return Promise[_0x5f43('0x98')](_0x294a25)[_0x5f43('0x8')](function(_0x2fee94){var _0x103183=_[_0x5f43('0x4')](_0x2fee94,function(_0x5e3eaf){return _0x5e3eaf?_0x5e3eaf:undefined;});var _0x2b5917=_[_0x5f43('0x4')](_0x3d8d60,[_0x5f43('0x99'),!![]]);var _0x9cd90c=_[_0x5f43('0x92')](_0x103183)&&_[_0x5f43('0x92')](_0x2b5917)?null:_[_0x5f43('0x9a')](_0x2b5917,_0x103183);if(!_0x9cd90c)return null;var _0x9d06a2=[];for(var _0x41e15a=0x0;_0x41e15a<_0x9cd90c[_0x5f43('0x93')];_0x41e15a++){var _0x114c90=_['find'](_0x3d8d60,function(_0x301200){return _0x9cd90c[_0x41e15a]?_0x301200[_0x5f43('0xd')]===_0x9cd90c[_0x41e15a][_0x5f43('0xd')]:null;});if(_0x114c90){if(_0x9cd90c[_0x41e15a]['ignore']){_0x9d06a2[_0x5f43('0x94')](_0xe85167(_0x267224['childModel'],_0x9cd90c[_0x41e15a]));}else{if(!_0x9cd90c[_0x41e15a][_0x5f43('0x9b')]){_0x9d06a2['push'](_0x2c88ee(_0x114c90,_0x9cd90c[_0x41e15a],_0x267224[_0x5f43('0x13')]));}else{if(_0x114c90[_0x5f43('0xb')]){_0x9d06a2[_0x5f43('0x94')](_0xa27ec4(_0x114c90,_0x9cd90c[_0x41e15a]));}}}}}return Promise['all'](_0x9d06a2);})[_0x5f43('0x8')](function(_0x80b270){var _0x3684d4=_0x80b270;var _0x291ae1=null;if(_0x3684d4){_0x291ae1=_0x3684d4[_0x5f43('0x93')]===0x1?_0x3684d4[0x0]:null;}if(!_0x291ae1&&!_0x3684d4)return _0x3ec929;var _0x4a3be3=_0x5354d1[_0x267224[_0x5f43('0x13')]][_0x5f43('0x9c')];_0x59fb88[_0x5f43('0xb')]=_[_0x5f43('0x9d')](_0x4a3be3);_0x59fb88['query']=_['keys'](_0x15b092[_0x5f43('0x8b')]);_0x59fb88[_0x5f43('0x9e')]=_['intersection'](_0x59fb88[_0x5f43('0xb')],_0x59fb88[_0x5f43('0x8b')]);_0xb22f3f['attributes']=_[_0x5f43('0x9f')](_0x59fb88[_0x5f43('0xb')],_0x40e97b['fields'](_0x15b092[_0x5f43('0x8b')][_0x5f43('0xa0')]));_0xb22f3f[_0x5f43('0xa1')]=_0xb22f3f[_0x5f43('0xa1')][_0x5f43('0x93')]?_0xb22f3f['attributes']:_0x59fb88['model'];if(!_0x15b092[_0x5f43('0x8b')][_0x5f43('0xa2')](_0x5f43('0xa3'))){_0xb22f3f['limit']=_0x40e97b[_0x5f43('0xa4')](_0x15b092[_0x5f43('0x8b')]['limit']);_0xb22f3f[_0x5f43('0xa5')]=_0x40e97b[_0x5f43('0xa5')](_0x15b092[_0x5f43('0x8b')][_0x5f43('0xa5')]);}_0xb22f3f[_0x5f43('0xa6')]=_0x40e97b[_0x5f43('0xa7')](_0x15b092[_0x5f43('0x8b')]['sort']);_0xb22f3f[_0x5f43('0x88')]=_0x40e97b[_0x5f43('0x9e')](_[_0x5f43('0xa8')](_0x15b092[_0x5f43('0x8b')],_0x59fb88[_0x5f43('0x9e')]));if(_0x15b092[_0x5f43('0x8b')]['filter']){_0xb22f3f[_0x5f43('0x88')]=_[_0x5f43('0xa9')](_0xb22f3f[_0x5f43('0x88')],{'$or':_[_0x5f43('0xc')](_0x4a3be3,function(_0x4aae5a){if(_0x4aae5a[_0x5f43('0x11')]['key']!==_0x5f43('0xaa')){var _0x48120a={};_0x48120a[_0x4aae5a[_0x5f43('0x5')]]={'$like':'%'+_0x15b092['query']['filter']+'%'};return _0x48120a;}})});}var _0x51d37d=[];var _0x488397=null;var _0x286193={};if(_0x291ae1){_0x488397=_['find'](_0x3d8d60,['name',_0x291ae1[_0x5f43('0xd')]]);if(_0x488397['field']){_0x286193={};if(_0x267224[_0x5f43('0x13')]==='AnalyticExtractedReport'){_0x286193[_0x488397[_0x5f43('0xab')]]=_['map'](_0x291ae1['associatedResources'],'id');}else{_0x286193[_0x488397[_0x5f43('0xab')]]=_0x291ae1[_0x5f43('0x9')];}_0x51d37d['push'](_0x286193);}else{_0xb22f3f[_0x5f43('0x88')]['id']=_0x291ae1[_0x5f43('0x9')];}}else{for(var _0x2a7648=0x0;_0x2a7648<_0x3684d4[_0x5f43('0x93')];_0x2a7648++){_0x488397=_[_0x5f43('0x96')](_0x3d8d60,[_0x5f43('0xd'),_0x3684d4[_0x2a7648][_0x5f43('0xd')]]);if(_0x488397[_0x5f43('0x5')]){_0x286193={};_0x286193[_0x488397[_0x5f43('0xab')]]=_0x3684d4[_0x2a7648]['associatedResources'];_0x51d37d[_0x5f43('0x94')](_0x286193);}else{if(!_0xb22f3f['where']['id'])_0xb22f3f[_0x5f43('0x88')]['id']=[];_0x3684d4[_0x2a7648][_0x5f43('0x9')]['forEach'](function(_0x20b7b0){_0xb22f3f['where']['id']['push'](_0x20b7b0);});}}}if(!_[_0x5f43('0x92')](_0x51d37d)){_0xb22f3f[_0x5f43('0x88')]=_[_0x5f43('0xa9')](_0xb22f3f['where'],{'$and':{'$or':_0x51d37d}});}_0xb22f3f=_['merge']({},_0xb22f3f,_0x15b092[_0x5f43('0xac')]);if(_0x291ae1&&!_0x291ae1['autoAssociation']&&_0x267224[_0x5f43('0x13')]===_0x5f43('0xad')){if(_0x15b092['query']['includeAll']){_0xb22f3f[_0x5f43('0xae')]=[{'all':!![]}];}return _0x5354d1[_0x267224[_0x5f43('0x13')]][_0x5f43('0x7')](_0xb22f3f)[_0x5f43('0x8')](function(_0x5c737f){var _0x31905a=[];_0x5c737f[_0x5f43('0xaf')](function(_0x15de8f){var _0x3cf845;switch(_0x15de8f[_0x5f43('0xb0')]){case _0x5f43('0xb1'):_0x3cf845=_[_0x5f43('0x96')](_0x291ae1['associatedResources'],function(_0x31bf33){return _0x31bf33['id']===_0x15de8f[_0x5f43('0x7c')]&&_0x31bf33[_0x5f43('0x11')]===_0x5f43('0xb2');});break;case _0x5f43('0xb3'):_0x3cf845=_['find'](_0x291ae1[_0x5f43('0x9')],function(_0x5c5308){return _0x5c5308['id']===_0x15de8f['reportId']&&_0x5c5308['type']==='CustomReports';});break;}if(_0x3cf845)_0x31905a[_0x5f43('0x94')](_0x15de8f);});_0x3ec929[_0x5f43('0xb4')]=_0x31905a[_0x5f43('0x93')];_0x3ec929['rows']=_0x31905a;return _0x3ec929;});}else{if(!_['isEmpty'](_0x15b092[_0x5f43('0x8b')][_0x5f43('0xb5')])){_0xb22f3f[_0x5f43('0x88')]['id']=_0xb22f3f['where']['id']?_['intersection'](_0xb22f3f[_0x5f43('0x88')]['id'],_0x15b092[_0x5f43('0x8b')][_0x5f43('0xb5')]):_0x15b092[_0x5f43('0x8b')][_0x5f43('0xb5')];if(_0x15b092['query'][_0x5f43('0xb6')]){_0xb22f3f['order']=_0x15b092[_0x5f43('0x8b')][_0x5f43('0xb6')];}}if(_0x15b092['query'][_0x5f43('0xb7')]){_0xb22f3f[_0x5f43('0x88')]=_[_0x5f43('0xa9')](_0xb22f3f[_0x5f43('0x88')],{'$and':_0x15b092[_0x5f43('0x8b')][_0x5f43('0xb7')]});}return _0x5354d1[_0x267224[_0x5f43('0x13')]][_0x5f43('0xb4')]({'where':_0xb22f3f[_0x5f43('0x88')]})[_0x5f43('0x8')](function(_0x15c33b){_0x3ec929[_0x5f43('0xb4')]=_0x15c33b;if(_0x15b092[_0x5f43('0x8b')][_0x5f43('0xb8')]){if(_0x267224[_0x5f43('0x13')]==='CmContact'){_0xb22f3f[_0x5f43('0xae')]=[{'model':_0x5354d1[_0x5f43('0xb9')],'as':'Tags','attributes':['id','name','color'],'required':_0x15b092['query']['tag']?!![]:![]},{'model':_0x5354d1[_0x5f43('0xb9')],'as':_0x5f43('0xba'),'attributes':['id',_0x5f43('0xd'),_0x5f43('0xbb')],'through':_0x15b092[_0x5f43('0x8b')][_0x5f43('0xbc')]?{'attributes':[],'where':{'TagId':_0x15b092[_0x5f43('0x8b')][_0x5f43('0xbc')]||undefined}}:{},'required':_0x15b092['query']['tag']?!![]:![]}];}else{_0xb22f3f[_0x5f43('0xae')]=[{'all':!![]}];}}return _0x5354d1[_0x267224[_0x5f43('0x13')]][_0x5f43('0x7')](_0xb22f3f);})[_0x5f43('0x8')](function(_0x19411e){_0x3ec929['rows']=_0x19411e;if(_0x52f065===_0x5f43('0x33')&&_0x15b092[_0x5f43('0x8b')]['openTabs']==='true'){var _0x32e627=[];for(var _0x54b634=0x0;_0x54b634<_0x3ec929['rows'][_0x5f43('0x93')];_0x54b634++){_0x32e627['push'](_0x262231(_0x5f43('0xbd'),_0x3ec929[_0x5f43('0xbe')][_0x54b634][_0x5f43('0xbf')]));_0x32e627[_0x5f43('0x94')](_0x262231(_0x5f43('0xc0'),_0x3ec929[_0x5f43('0xbe')][_0x54b634][_0x5f43('0xbf')]));_0x32e627[_0x5f43('0x94')](_0x262231(_0x5f43('0xc1'),_0x3ec929[_0x5f43('0xbe')][_0x54b634][_0x5f43('0xbf')]));_0x32e627[_0x5f43('0x94')](_0x262231('mail',_0x3ec929[_0x5f43('0xbe')][_0x54b634][_0x5f43('0xbf')]));_0x32e627[_0x5f43('0x94')](_0x262231(_0x5f43('0xc2'),_0x3ec929[_0x5f43('0xbe')][_0x54b634][_0x5f43('0xbf')]));_0x32e627['push'](_0x262231(_0x5f43('0xc3'),_0x3ec929[_0x5f43('0xbe')][_0x54b634]['dataValues']));}return Promise[_0x5f43('0x98')](_0x32e627)[_0x5f43('0x8')](function(){return _0x3ec929;});}return _0x3ec929;});}});}}});}; \ No newline at end of file +var _0x8a62=['internalroutes','outboundroutes','VoiceExtension','contexts','VoiceContext','voicerecordings','VoiceRecording','membername','User','role','Telephones','telephone','VoiceQueue','type','QueueCampaigns','queue','outbound','musiconholds','VoiceMusicOnHold','chanspies','VoiceChanSpy','VoicePrefix','ivrcampaigns','Campaign','MailQueue','mailaccounts','MailAccount','mailsubstatuses','MailSubstatus','openchannelqueues','OpenchannelQueue','OpenchannelAccount','smsqueues','smsaccounts','SmsAccount','whatsappqueues','WhatsappQueue','whatsappaccounts','Team','voicequeues','queuecampaigns','VoiceQueues','users','agents','Users','admin','SalesforceAccount','freshdeskaccounts','FreshdeskAccount','deskaccounts','DeskAccount','zohoaccounts','vtigeraccounts','cannedanswers','CannedAnswer','dispositions','Disposition','customdashboards','Dashboard','intervals','Interval','pauses','Pause','scheduler','Schedule','sounds','Sound','tags','Tag','templates','Template','trunks','Trunk','variables','plugins','Plugin','extractedreports','Reports','reportId','charAt','select','ui.','InteractionId','ui.createdAt','_interactions','where','ui.UserId\x20=\x20?','OpenTabs','define','UserProfile','query','section','mergeResources','Invalid\x20section\x20\x27','push','UserProfileSection','find','params','all','isEmpty','union','length','rawAttributes','keys','filters','intersection','fields','attributes','limit','offset','order','sort','pick','merge','VIRTUAL','foreignKey','forEach','options','autoAssociation','includeAll','include','DefaultReports','custom','CustomReports','count','rows','ids','customSorting','extraQueryConditions','color','tag','ThroughTags','Agents','openTabs','chat','dataValues','sms','openchannel','whatsapp','lodash','./userProfile.attributes','exports','models','filter','field','value','findAll','map','catch','model','then','associatedResources','name','resolve','UserProfileResource','AnalyticExtractedReport','resourceId','toLowerCase','squareprojects','childModel','odbc','squarerecordings','SquareRecording','parentSections','SquareProjects','projectName','JscriptyProject','contacts','ListId','lists','CmList','companies','chatqueues','ChatQueue','chatwebsites','faxqueues','faxaccounts','inboundroutes'];(function(_0x3585fb,_0x5df075){var _0x48fb79=function(_0x595516){while(--_0x595516){_0x3585fb['push'](_0x3585fb['shift']());}};_0x48fb79(++_0x5df075);}(_0x8a62,0x1ef));var _0x28a6=function(_0x4348c4,_0x5a76a1){_0x4348c4=_0x4348c4-0x0;var _0x5a978c=_0x8a62[_0x4348c4];return _0x5a978c;};'use strict';var _=require(_0x28a6('0x0'));var attributes=require(_0x28a6('0x1'));var squel=require('squel');module[_0x28a6('0x2')]=function(_0x1d915c){var _0x50adad=_0x1d915c[_0x28a6('0x3')];function _0x487417(_0x52c0a7,_0x513f1e){return new Promise(function(_0x420858,_0x429e0f){if(!_0x513f1e)return _0x420858(null);var _0x36a0ba=_0x513f1e['filter']?{[_0x513f1e[_0x28a6('0x4')][_0x28a6('0x5')]]:_0x513f1e['filter'][_0x28a6('0x6')]}:undefined;return _0x50adad[_0x52c0a7][_0x28a6('0x7')]({'where':_0x36a0ba,'raw':!![]})['then'](function(_0x2871ce){_0x513f1e['associatedResources']=_[_0x28a6('0x8')](_0x2871ce,'id');_0x420858(_0x513f1e);})[_0x28a6('0x9')](function(_0x851ef5){_0x429e0f(_0x851ef5);});});}function _0x3b5b3d(_0x22c58a,_0x42a557){return new Promise(function(_0x3c9b41,_0x2546ed){var _0x40fe8b=_0x22c58a[_0x28a6('0x4')]?{[_0x22c58a[_0x28a6('0x4')][_0x28a6('0x5')]]:_0x22c58a[_0x28a6('0x4')][_0x28a6('0x6')]}:undefined;return _0x50adad[_0x22c58a[_0x28a6('0xa')]][_0x28a6('0x7')]({'where':_0x40fe8b,'raw':!![]})[_0x28a6('0xb')](function(_0x5c810f){_0x42a557[_0x28a6('0xc')]=_[_0x28a6('0x8')](_0x5c810f,function(_0x42202f){return _0x42202f[_0x28a6('0xd')];});_0x3c9b41(_0x42a557);})[_0x28a6('0x9')](function(_0x4f4117){_0x2546ed(_0x4f4117);});});}function _0x4c1c0a(_0x385983,_0x50af5c,_0x10d0a1){if(!_0x50af5c)return Promise[_0x28a6('0xe')](null);return new Promise(function(_0x46197d,_0x442897){return _0x50adad[_0x28a6('0xf')][_0x28a6('0x7')]({'where':{'sectionId':_0x50af5c['id']},'raw':!![]})['then'](function(_0x2155e5){if(_0x385983[_0x28a6('0x5')]&&_0x385983[_0x28a6('0x5')]!=='id'){_0x50af5c[_0x28a6('0xc')]=_[_0x28a6('0x8')](_0x2155e5,function(_0xe50159){return _0xe50159[_0x385983['field']];});}else{if(_0x10d0a1===_0x28a6('0x10')){_0x50af5c['associatedResources']=_[_0x28a6('0x8')](_0x2155e5,function(_0x42799d){return{'id':_0x42799d['resourceId'],'type':_0x42799d['type']};});}else{_0x50af5c[_0x28a6('0xc')]=_[_0x28a6('0x8')](_0x2155e5,function(_0x313536){return _0x313536[_0x28a6('0x11')];});}}_0x46197d(_0x50af5c);})[_0x28a6('0x9')](function(_0x3f7217){_0x442897(_0x3f7217);});});}function _0x15cb95(_0x41d40f,_0x33efac){var _0x5c4bc1={'parentSections':[]};switch(_0x41d40f[_0x28a6('0x12')]()){case _0x28a6('0x13'):_0x5c4bc1[_0x28a6('0x14')]='SquareProject';break;case _0x28a6('0x15'):_0x5c4bc1[_0x28a6('0x14')]='SquareOdbc';break;case _0x28a6('0x16'):_0x5c4bc1['childModel']=_0x28a6('0x17');_0x5c4bc1[_0x28a6('0x18')]=[{'name':_0x28a6('0x19'),'field':_0x28a6('0xd'),'foreignKey':_0x28a6('0x1a')}];break;case'projects':_0x5c4bc1['childModel']=_0x28a6('0x1b');break;case _0x28a6('0x1c'):_0x5c4bc1[_0x28a6('0x14')]='CmContact';_0x5c4bc1['parentSections']=[{'name':'Lists','field':'id','foreignKey':_0x28a6('0x1d')}];break;case _0x28a6('0x1e'):_0x5c4bc1[_0x28a6('0x14')]=_0x28a6('0x1f');break;case _0x28a6('0x20'):_0x5c4bc1[_0x28a6('0x14')]='CmCompany';break;case'globalcustomfields':_0x5c4bc1['childModel']='CmCustomField';break;case _0x28a6('0x21'):_0x5c4bc1['childModel']=_0x28a6('0x22');break;case _0x28a6('0x23'):_0x5c4bc1[_0x28a6('0x14')]='ChatWebsite';break;case _0x28a6('0x24'):_0x5c4bc1[_0x28a6('0x14')]='FaxQueue';break;case _0x28a6('0x25'):_0x5c4bc1['childModel']='FaxAccount';break;case _0x28a6('0x26'):case _0x28a6('0x27'):case _0x28a6('0x28'):_0x5c4bc1[_0x28a6('0x14')]=_0x28a6('0x29');break;case _0x28a6('0x2a'):_0x5c4bc1[_0x28a6('0x14')]=_0x28a6('0x2b');break;case'voicemails':_0x5c4bc1[_0x28a6('0x14')]='VoiceMail';break;case _0x28a6('0x2c'):_0x5c4bc1[_0x28a6('0x14')]=_0x28a6('0x2d');_0x5c4bc1[_0x28a6('0x18')]=[{'name':'Agents','field':_0x28a6('0xd'),'foreignKey':_0x28a6('0x2e'),'model':_0x28a6('0x2f'),'filter':{'field':_0x28a6('0x30'),'value':['agent']}},{'name':_0x28a6('0x31'),'field':_0x28a6('0xd'),'foreignKey':_0x28a6('0x2e'),'model':_0x28a6('0x2f'),'filter':{'field':'role','value':[_0x28a6('0x32')]}},{'name':'VoiceQueues','field':_0x28a6('0xd'),'foreignKey':'queue','model':_0x28a6('0x33'),'filter':{'field':_0x28a6('0x34'),'value':['inbound']}},{'name':_0x28a6('0x35'),'field':'name','foreignKey':_0x28a6('0x36'),'model':'VoiceQueue','filter':{'field':_0x28a6('0x34'),'value':[_0x28a6('0x37')]}}];break;case _0x28a6('0x38'):_0x5c4bc1[_0x28a6('0x14')]=_0x28a6('0x39');break;case _0x28a6('0x3a'):_0x5c4bc1['childModel']=_0x28a6('0x3b');break;case'voiceprefixes':_0x5c4bc1[_0x28a6('0x14')]=_0x28a6('0x3c');break;case _0x28a6('0x3d'):_0x5c4bc1[_0x28a6('0x14')]=_0x28a6('0x3e');break;case'mailqueues':_0x5c4bc1[_0x28a6('0x14')]=_0x28a6('0x3f');break;case _0x28a6('0x40'):_0x5c4bc1[_0x28a6('0x14')]=_0x28a6('0x41');break;case _0x28a6('0x42'):_0x5c4bc1['childModel']=_0x28a6('0x43');break;case _0x28a6('0x44'):_0x5c4bc1['childModel']=_0x28a6('0x45');break;case'openchannelaccounts':_0x5c4bc1['childModel']=_0x28a6('0x46');break;case _0x28a6('0x47'):_0x5c4bc1[_0x28a6('0x14')]='SmsQueue';break;case _0x28a6('0x48'):_0x5c4bc1[_0x28a6('0x14')]=_0x28a6('0x49');break;case _0x28a6('0x4a'):_0x5c4bc1[_0x28a6('0x14')]=_0x28a6('0x4b');break;case _0x28a6('0x4c'):_0x5c4bc1[_0x28a6('0x14')]='WhatsappAccount';break;case'teams':_0x5c4bc1[_0x28a6('0x14')]=_0x28a6('0x4d');break;case _0x28a6('0x4e'):case _0x28a6('0x4f'):_0x5c4bc1['childModel']=_0x28a6('0x33');if(_0x33efac){_0x5c4bc1[_0x28a6('0x18')]=[{'name':_0x28a6('0x50')},{'name':_0x28a6('0x35')}];}break;case _0x28a6('0x51'):case _0x28a6('0x52'):case'telephones':_0x5c4bc1[_0x28a6('0x14')]='User';if(_0x33efac){_0x5c4bc1[_0x28a6('0x18')]=[{'name':_0x28a6('0x53'),'filter':{'field':_0x28a6('0x30'),'value':[_0x28a6('0x54'),'user']},'ignore':!![]},{'name':'Agents'},{'name':_0x28a6('0x31')}];}break;case'zendeskaccounts':_0x5c4bc1['childModel']='ZendeskAccount';break;case'salesforceaccounts':_0x5c4bc1[_0x28a6('0x14')]=_0x28a6('0x55');break;case _0x28a6('0x56'):_0x5c4bc1[_0x28a6('0x14')]=_0x28a6('0x57');break;case'sugarcrmaccounts':_0x5c4bc1[_0x28a6('0x14')]='SugarcrmAccount';break;case _0x28a6('0x58'):_0x5c4bc1['childModel']=_0x28a6('0x59');break;case _0x28a6('0x5a'):_0x5c4bc1[_0x28a6('0x14')]='ZohoAccount';break;case _0x28a6('0x5b'):_0x5c4bc1[_0x28a6('0x14')]=_0x28a6('0x2f');break;case _0x28a6('0x5c'):_0x5c4bc1[_0x28a6('0x14')]=_0x28a6('0x5d');break;case _0x28a6('0x5e'):_0x5c4bc1[_0x28a6('0x14')]=_0x28a6('0x5f');break;case _0x28a6('0x60'):_0x5c4bc1[_0x28a6('0x14')]=_0x28a6('0x61');break;case _0x28a6('0x62'):_0x5c4bc1[_0x28a6('0x14')]=_0x28a6('0x63');break;case _0x28a6('0x64'):_0x5c4bc1[_0x28a6('0x14')]=_0x28a6('0x65');break;case _0x28a6('0x66'):_0x5c4bc1[_0x28a6('0x14')]=_0x28a6('0x67');break;case _0x28a6('0x68'):_0x5c4bc1[_0x28a6('0x14')]=_0x28a6('0x69');break;case _0x28a6('0x6a'):_0x5c4bc1['childModel']=_0x28a6('0x6b');break;case _0x28a6('0x6c'):_0x5c4bc1[_0x28a6('0x14')]=_0x28a6('0x6d');break;case'triggers':_0x5c4bc1['childModel']='Trigger';break;case _0x28a6('0x6e'):_0x5c4bc1[_0x28a6('0x14')]=_0x28a6('0x6f');break;case _0x28a6('0x70'):_0x5c4bc1['childModel']='Variable';break;case _0x28a6('0x71'):_0x5c4bc1[_0x28a6('0x14')]=_0x28a6('0x72');break;case _0x28a6('0x73'):_0x5c4bc1[_0x28a6('0x14')]=_0x28a6('0x10');_0x5c4bc1[_0x28a6('0x18')]=[{'name':_0x28a6('0x74'),'field':'id','foreignKey':_0x28a6('0x75')}];break;case'metrics':_0x5c4bc1[_0x28a6('0x14')]='AnalyticMetric';break;}return _0x5c4bc1;}function _0xb3ce00(_0x35e1e9,_0x2d84ab){var _0x3405c5=_0x35e1e9[_0x28a6('0x76')](0x0)['toUpperCase']()+_0x35e1e9['slice'](0x1);var _0x48f300={'type':_0x50adad['Sequelize']['QueryTypes']['SELECT'],'raw':!![]};return new Promise(function(_0x5cc720,_0x3da05f){var _0x1b5e24=squel[_0x28a6('0x77')]()[_0x28a6('0x5')](_0x28a6('0x78')+_0x3405c5+_0x28a6('0x79'),'id')[_0x28a6('0x5')](_0x28a6('0x7a'))['from']('user_has_'+_0x35e1e9+_0x28a6('0x7b'),'ui')[_0x28a6('0x7c')](_0x28a6('0x7d'),_0x2d84ab['id']);return _0x50adad['sequelize']['query'](_0x1b5e24['toString'](),_0x48f300)[_0x28a6('0xb')](function(_0x2254eb){_0x2d84ab[_0x3405c5+_0x28a6('0x7e')]=_0x2254eb;_0x5cc720(_0x2254eb);})[_0x28a6('0x9')](function(_0x5c9bdc){_0x3da05f(_0x5c9bdc);});});}return _0x1d915c[_0x28a6('0x7f')](_0x28a6('0x80'),attributes,{'tableName':'user_profiles','paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x1c2243){var _0x31a138=require('../../components/parsers/qs');var _0x59ef6b={'raw':_0x1c2243[_0x28a6('0x81')]['raw'],'where':{}};var _0x4a9b40={};var _0x3661fa={'count':0x0,'rows':[]};var _0x2f88cb=_0x1c2243[_0x28a6('0x81')][_0x28a6('0x82')];var _0x4be869=_0x1c2243[_0x28a6('0x81')][_0x28a6('0x83')]||![];var _0x2239c6=_0x15cb95(_0x2f88cb,_0x4be869);if(!_0x2239c6[_0x28a6('0x14')])throw new Error(_0x28a6('0x84')+_0x2f88cb+'\x27');var _0x314501=[{'name':_0x2f88cb}];if(!_['isEmpty'](_0x2239c6[_0x28a6('0x18')]))_0x314501=_0x2239c6['parentSections'];var _0x3e39c5=[];for(var _0xb56b90=0x0;_0xb56b90<_0x314501['length'];_0xb56b90++){_0x3e39c5[_0x28a6('0x85')](_0x50adad[_0x28a6('0x86')][_0x28a6('0x87')]({'where':{'userProfileId':_0x1c2243[_0x28a6('0x88')]['id'],'name':_0x314501[_0xb56b90][_0x28a6('0xd')]},'raw':!![]}));}return Promise[_0x28a6('0x89')](_0x3e39c5)['then'](function(_0x26078e){var _0x528277=_['filter'](_0x26078e,function(_0x57561c){return _0x57561c?_0x57561c:undefined;});var _0x1282ed=_['filter'](_0x314501,['ignore',!![]]);var _0x3788be=_[_0x28a6('0x8a')](_0x528277)&&_['isEmpty'](_0x1282ed)?null:_[_0x28a6('0x8b')](_0x1282ed,_0x528277);if(!_0x3788be)return null;var _0x5347ed=[];for(var _0x13eeb7=0x0;_0x13eeb7<_0x3788be[_0x28a6('0x8c')];_0x13eeb7++){var _0x3aaa92=_['find'](_0x314501,function(_0x183fa8){return _0x3788be[_0x13eeb7]?_0x183fa8[_0x28a6('0xd')]===_0x3788be[_0x13eeb7][_0x28a6('0xd')]:null;});if(_0x3aaa92){if(_0x3788be[_0x13eeb7]['ignore']){_0x5347ed[_0x28a6('0x85')](_0x487417(_0x2239c6[_0x28a6('0x14')],_0x3788be[_0x13eeb7]));}else{if(!_0x3788be[_0x13eeb7]['autoAssociation']){_0x5347ed[_0x28a6('0x85')](_0x4c1c0a(_0x3aaa92,_0x3788be[_0x13eeb7],_0x2239c6[_0x28a6('0x14')]));}else{if(_0x3aaa92[_0x28a6('0xa')]){_0x5347ed[_0x28a6('0x85')](_0x3b5b3d(_0x3aaa92,_0x3788be[_0x13eeb7]));}}}}}return Promise[_0x28a6('0x89')](_0x5347ed);})[_0x28a6('0xb')](function(_0x23378f){var _0x326efb=_0x23378f;var _0x338e26=null;if(_0x326efb){_0x338e26=_0x326efb[_0x28a6('0x8c')]===0x1?_0x326efb[0x0]:null;}if(!_0x338e26&&!_0x326efb)return _0x3661fa;var _0x314dab=_0x50adad[_0x2239c6['childModel']][_0x28a6('0x8d')];_0x4a9b40[_0x28a6('0xa')]=_[_0x28a6('0x8e')](_0x314dab);_0x4a9b40[_0x28a6('0x81')]=_[_0x28a6('0x8e')](_0x1c2243[_0x28a6('0x81')]);_0x4a9b40[_0x28a6('0x8f')]=_['intersection'](_0x4a9b40[_0x28a6('0xa')],_0x4a9b40['query']);_0x59ef6b['attributes']=_[_0x28a6('0x90')](_0x4a9b40['model'],_0x31a138[_0x28a6('0x91')](_0x1c2243[_0x28a6('0x81')]['fields']));_0x59ef6b[_0x28a6('0x92')]=_0x59ef6b[_0x28a6('0x92')][_0x28a6('0x8c')]?_0x59ef6b[_0x28a6('0x92')]:_0x4a9b40[_0x28a6('0xa')];if(!_0x1c2243[_0x28a6('0x81')]['hasOwnProperty']('nolimit')){_0x59ef6b['limit']=_0x31a138[_0x28a6('0x93')](_0x1c2243[_0x28a6('0x81')][_0x28a6('0x93')]);_0x59ef6b['offset']=_0x31a138['offset'](_0x1c2243[_0x28a6('0x81')][_0x28a6('0x94')]);}_0x59ef6b[_0x28a6('0x95')]=_0x31a138[_0x28a6('0x96')](_0x1c2243[_0x28a6('0x81')][_0x28a6('0x96')]);_0x59ef6b[_0x28a6('0x7c')]=_0x31a138[_0x28a6('0x8f')](_[_0x28a6('0x97')](_0x1c2243[_0x28a6('0x81')],_0x4a9b40[_0x28a6('0x8f')]));if(_0x1c2243[_0x28a6('0x81')][_0x28a6('0x4')]){_0x59ef6b[_0x28a6('0x7c')]=_[_0x28a6('0x98')](_0x59ef6b[_0x28a6('0x7c')],{'$or':_[_0x28a6('0x8')](_0x314dab,function(_0x368aa6){if(_0x368aa6[_0x28a6('0x34')]['key']!==_0x28a6('0x99')){var _0x3427bb={};_0x3427bb[_0x368aa6[_0x28a6('0x5')]]={'$like':'%'+_0x1c2243[_0x28a6('0x81')][_0x28a6('0x4')]+'%'};return _0x3427bb;}})});}var _0x53b503=[];var _0x2bfc35=null;var _0xfe5390={};if(_0x338e26){_0x2bfc35=_[_0x28a6('0x87')](_0x314501,[_0x28a6('0xd'),_0x338e26[_0x28a6('0xd')]]);if(_0x2bfc35[_0x28a6('0x5')]){_0xfe5390={};if(_0x2239c6[_0x28a6('0x14')]===_0x28a6('0x10')){_0xfe5390[_0x2bfc35['foreignKey']]=_[_0x28a6('0x8')](_0x338e26[_0x28a6('0xc')],'id');}else{_0xfe5390[_0x2bfc35[_0x28a6('0x9a')]]=_0x338e26[_0x28a6('0xc')];}_0x53b503[_0x28a6('0x85')](_0xfe5390);}else{_0x59ef6b[_0x28a6('0x7c')]['id']=_0x338e26['associatedResources'];}}else{for(var _0x3b2e6e=0x0;_0x3b2e6e<_0x326efb[_0x28a6('0x8c')];_0x3b2e6e++){_0x2bfc35=_[_0x28a6('0x87')](_0x314501,[_0x28a6('0xd'),_0x326efb[_0x3b2e6e][_0x28a6('0xd')]]);if(_0x2bfc35[_0x28a6('0x5')]){_0xfe5390={};_0xfe5390[_0x2bfc35[_0x28a6('0x9a')]]=_0x326efb[_0x3b2e6e][_0x28a6('0xc')];_0x53b503['push'](_0xfe5390);}else{if(!_0x59ef6b['where']['id'])_0x59ef6b[_0x28a6('0x7c')]['id']=[];_0x326efb[_0x3b2e6e]['associatedResources'][_0x28a6('0x9b')](function(_0xcb0921){_0x59ef6b['where']['id']['push'](_0xcb0921);});}}}if(!_[_0x28a6('0x8a')](_0x53b503)){_0x59ef6b[_0x28a6('0x7c')]=_[_0x28a6('0x98')](_0x59ef6b[_0x28a6('0x7c')],{'$and':{'$or':_0x53b503}});}_0x59ef6b=_[_0x28a6('0x98')]({},_0x59ef6b,_0x1c2243[_0x28a6('0x9c')]);if(_0x338e26&&!_0x338e26[_0x28a6('0x9d')]&&_0x2239c6['childModel']==='AnalyticExtractedReport'){if(_0x1c2243['query'][_0x28a6('0x9e')]){_0x59ef6b[_0x28a6('0x9f')]=[{'all':!![]}];}return _0x50adad[_0x2239c6[_0x28a6('0x14')]][_0x28a6('0x7')](_0x59ef6b)[_0x28a6('0xb')](function(_0xebe998){var _0x2a0e22=[];_0xebe998[_0x28a6('0x9b')](function(_0x26aa53){var _0x1cd5ac;switch(_0x26aa53['reportType']){case'default':_0x1cd5ac=_['find'](_0x338e26[_0x28a6('0xc')],function(_0x314133){return _0x314133['id']===_0x26aa53[_0x28a6('0x75')]&&_0x314133[_0x28a6('0x34')]===_0x28a6('0xa0');});break;case _0x28a6('0xa1'):_0x1cd5ac=_[_0x28a6('0x87')](_0x338e26[_0x28a6('0xc')],function(_0x54b6d6){return _0x54b6d6['id']===_0x26aa53[_0x28a6('0x75')]&&_0x54b6d6[_0x28a6('0x34')]===_0x28a6('0xa2');});break;}if(_0x1cd5ac)_0x2a0e22['push'](_0x26aa53);});_0x3661fa[_0x28a6('0xa3')]=_0x2a0e22['length'];_0x3661fa[_0x28a6('0xa4')]=_0x2a0e22;return _0x3661fa;});}else{if(!_[_0x28a6('0x8a')](_0x1c2243[_0x28a6('0x81')][_0x28a6('0xa5')])){_0x59ef6b[_0x28a6('0x7c')]['id']=_0x59ef6b['where']['id']?_[_0x28a6('0x90')](_0x59ef6b['where']['id'],_0x1c2243[_0x28a6('0x81')][_0x28a6('0xa5')]):_0x1c2243['query']['ids'];if(_0x1c2243[_0x28a6('0x81')][_0x28a6('0xa6')]){_0x59ef6b[_0x28a6('0x95')]=_0x1c2243[_0x28a6('0x81')][_0x28a6('0xa6')];}}if(_0x1c2243[_0x28a6('0x81')][_0x28a6('0xa7')]){_0x59ef6b[_0x28a6('0x7c')]=_[_0x28a6('0x98')](_0x59ef6b[_0x28a6('0x7c')],{'$and':_0x1c2243[_0x28a6('0x81')][_0x28a6('0xa7')]});}return _0x50adad[_0x2239c6[_0x28a6('0x14')]][_0x28a6('0xa3')]({'where':_0x59ef6b[_0x28a6('0x7c')]})[_0x28a6('0xb')](function(_0x294f0a){_0x3661fa[_0x28a6('0xa3')]=_0x294f0a;if(_0x1c2243[_0x28a6('0x81')][_0x28a6('0x9e')]){if(_0x2239c6['childModel']==='CmContact'){_0x59ef6b['include']=[{'model':_0x50adad[_0x28a6('0x6b')],'as':'Tags','attributes':['id',_0x28a6('0xd'),_0x28a6('0xa8')],'required':_0x1c2243[_0x28a6('0x81')][_0x28a6('0xa9')]?!![]:![]},{'model':_0x50adad[_0x28a6('0x6b')],'as':_0x28a6('0xaa'),'attributes':['id',_0x28a6('0xd'),_0x28a6('0xa8')],'through':_0x1c2243['query'][_0x28a6('0xa9')]?{'attributes':[],'where':{'TagId':_0x1c2243[_0x28a6('0x81')][_0x28a6('0xa9')]||undefined}}:{},'required':_0x1c2243[_0x28a6('0x81')][_0x28a6('0xa9')]?!![]:![]}];}else{_0x59ef6b[_0x28a6('0x9f')]=[{'all':!![]}];}}return _0x50adad[_0x2239c6['childModel']]['findAll'](_0x59ef6b);})[_0x28a6('0xb')](function(_0x1a74b2){_0x3661fa[_0x28a6('0xa4')]=_0x1a74b2;if(_0x2f88cb===_0x28a6('0xab')&&_0x1c2243[_0x28a6('0x81')][_0x28a6('0xac')]==='true'){var _0x254ea5=[];for(var _0x233247=0x0;_0x233247<_0x3661fa[_0x28a6('0xa4')][_0x28a6('0x8c')];_0x233247++){_0x254ea5['push'](_0xb3ce00(_0x28a6('0xad'),_0x3661fa[_0x28a6('0xa4')][_0x233247][_0x28a6('0xae')]));_0x254ea5[_0x28a6('0x85')](_0xb3ce00(_0x28a6('0xaf'),_0x3661fa[_0x28a6('0xa4')][_0x233247][_0x28a6('0xae')]));_0x254ea5[_0x28a6('0x85')](_0xb3ce00('fax',_0x3661fa[_0x28a6('0xa4')][_0x233247][_0x28a6('0xae')]));_0x254ea5[_0x28a6('0x85')](_0xb3ce00('mail',_0x3661fa['rows'][_0x233247][_0x28a6('0xae')]));_0x254ea5[_0x28a6('0x85')](_0xb3ce00(_0x28a6('0xb0'),_0x3661fa[_0x28a6('0xa4')][_0x233247][_0x28a6('0xae')]));_0x254ea5['push'](_0xb3ce00(_0x28a6('0xb1'),_0x3661fa[_0x28a6('0xa4')][_0x233247][_0x28a6('0xae')]));}return Promise[_0x28a6('0x89')](_0x254ea5)[_0x28a6('0xb')](function(){return _0x3661fa;});}return _0x3661fa;});}});}}});}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.rpc.js b/server/api/userProfile/userProfile.rpc.js index cb9b66e..52e5476 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 _0xf40b=['request\x20sent','debug','UserProfile,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','socket.io-emitter','./userProfile.socket','register','request','then','info','UserProfile,\x20%s,\x20%s'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xf40b,0xb0));var _0xbf40=function(_0x4863bc,_0x26dd88){_0x4863bc=_0x4863bc-0x0;var _0xa20d45=_0xf40b[_0x4863bc];return _0xa20d45;};'use strict';var _=require('lodash');var util=require(_0xbf40('0x0'));var moment=require(_0xbf40('0x1'));var BPromise=require(_0xbf40('0x2'));var rs=require(_0xbf40('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbf40('0x4'))['db'];var utils=require(_0xbf40('0x5'));var logger=require(_0xbf40('0x6'))(_0xbf40('0x7'));var config=require(_0xbf40('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xbf40('0x9')][_0xbf40('0xa')]({'port':0x232a});config[_0xbf40('0xb')]=_[_0xbf40('0xc')](config[_0xbf40('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xbf40('0xd'))(new Redis(config[_0xbf40('0xb')]));require(_0xbf40('0xe'))[_0xbf40('0xf')](socket);function respondWithRpcPromise(_0x11c5be,_0x7ed794,_0x2cc598){return new BPromise(function(_0x20b14e,_0x500300){return client[_0xbf40('0x10')](_0x11c5be,_0x2cc598)[_0xbf40('0x11')](function(_0x40ee4a){logger[_0xbf40('0x12')](_0xbf40('0x13'),_0x7ed794,_0xbf40('0x14'));logger[_0xbf40('0x15')](_0xbf40('0x16'),_0x7ed794,'request\x20sent',JSON['stringify'](_0x40ee4a));if(_0x40ee4a[_0xbf40('0x17')]){if(_0x40ee4a[_0xbf40('0x17')][_0xbf40('0x18')]===0x1f4){logger[_0xbf40('0x17')]('UserProfile,\x20%s,\x20%s',_0x7ed794,_0x40ee4a[_0xbf40('0x17')][_0xbf40('0x19')]);return _0x500300(_0x40ee4a[_0xbf40('0x17')][_0xbf40('0x19')]);}logger[_0xbf40('0x17')](_0xbf40('0x13'),_0x7ed794,_0x40ee4a[_0xbf40('0x17')][_0xbf40('0x19')]);return _0x20b14e(_0x40ee4a['error'][_0xbf40('0x19')]);}else{logger[_0xbf40('0x12')](_0xbf40('0x13'),_0x7ed794,_0xbf40('0x14'));_0x20b14e(_0x40ee4a[_0xbf40('0x1a')][_0xbf40('0x19')]);}})[_0xbf40('0x1b')](function(_0x3cca3c){logger['error'](_0xbf40('0x13'),_0x7ed794,_0x3cca3c);_0x500300(_0x3cca3c);});});} \ No newline at end of file +var _0xa809=['randomstring','../../config/logger','rpc','../../config/environment','jayson/promise','http','defaults','redis','socket.io-emitter','./userProfile.socket','register','request','then','info','request\x20sent','debug','UserProfile,\x20%s,\x20%s,\x20%s','stringify','error','code','UserProfile,\x20%s,\x20%s','message','result','catch','util'];(function(_0x3c2166,_0x41fc16){var _0x30ccc3=function(_0x689bc3){while(--_0x689bc3){_0x3c2166['push'](_0x3c2166['shift']());}};_0x30ccc3(++_0x41fc16);}(_0xa809,0x1f3));var _0x9a80=function(_0x12f288,_0x325616){_0x12f288=_0x12f288-0x0;var _0x5e25d0=_0xa809[_0x12f288];return _0x5e25d0;};'use strict';var _=require('lodash');var util=require(_0x9a80('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x9a80('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x9a80('0x2'))(_0x9a80('0x3'));var config=require(_0x9a80('0x4'));var jayson=require(_0x9a80('0x5'));var client=jayson['client'][_0x9a80('0x6')]({'port':0x232a});config['redis']=_[_0x9a80('0x7')](config[_0x9a80('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0x9a80('0x9'))(new Redis(config[_0x9a80('0x8')]));require(_0x9a80('0xa'))[_0x9a80('0xb')](socket);function respondWithRpcPromise(_0x596b93,_0x3d5aba,_0x1e0017){return new BPromise(function(_0x396fc5,_0x3277f6){return client[_0x9a80('0xc')](_0x596b93,_0x1e0017)[_0x9a80('0xd')](function(_0x1504ae){logger[_0x9a80('0xe')]('UserProfile,\x20%s,\x20%s',_0x3d5aba,_0x9a80('0xf'));logger[_0x9a80('0x10')](_0x9a80('0x11'),_0x3d5aba,_0x9a80('0xf'),JSON[_0x9a80('0x12')](_0x1504ae));if(_0x1504ae[_0x9a80('0x13')]){if(_0x1504ae[_0x9a80('0x13')][_0x9a80('0x14')]===0x1f4){logger['error'](_0x9a80('0x15'),_0x3d5aba,_0x1504ae['error'][_0x9a80('0x16')]);return _0x3277f6(_0x1504ae[_0x9a80('0x13')][_0x9a80('0x16')]);}logger['error'](_0x9a80('0x15'),_0x3d5aba,_0x1504ae[_0x9a80('0x13')][_0x9a80('0x16')]);return _0x396fc5(_0x1504ae[_0x9a80('0x13')][_0x9a80('0x16')]);}else{logger['info'](_0x9a80('0x15'),_0x3d5aba,'request\x20sent');_0x396fc5(_0x1504ae[_0x9a80('0x17')][_0x9a80('0x16')]);}})[_0x9a80('0x18')](function(_0x3c2ae0){logger['error']('UserProfile,\x20%s,\x20%s',_0x3d5aba,_0x3c2ae0);_0x3277f6(_0x3c2ae0);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index f3ba1be..b5e5e62 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 _0xa330=['save','update','register','length','userProfile:','./userProfile.events'];(function(_0x732bac,_0xd7f7bb){var _0x385ac9=function(_0x42844a){while(--_0x42844a){_0x732bac['push'](_0x732bac['shift']());}};_0x385ac9(++_0xd7f7bb);}(_0xa330,0x155));var _0x0a33=function(_0x2112d4,_0x3c863c){_0x2112d4=_0x2112d4-0x0;var _0x434972=_0xa330[_0x2112d4];return _0x434972;};'use strict';var UserProfileEvents=require(_0x0a33('0x0'));var events=[_0x0a33('0x1'),'remove',_0x0a33('0x2')];function createListener(_0x489956,_0x138e1a){return function(_0x4bf4d7){_0x138e1a['emit'](_0x489956,_0x4bf4d7);};}function removeListener(_0x35fd16,_0x522ace){return function(){UserProfileEvents['removeListener'](_0x35fd16,_0x522ace);};}exports[_0x0a33('0x3')]=function(_0x4b86d2){for(var _0x1e784f=0x0,_0x5e3057=events[_0x0a33('0x4')];_0x1e784f<_0x5e3057;_0x1e784f++){var _0x25f608=events[_0x1e784f];var _0xb9c6f2=createListener(_0x0a33('0x5')+_0x25f608,_0x4b86d2);UserProfileEvents['on'](_0x25f608,_0xb9c6f2);}}; \ No newline at end of file +var _0xaa11=['removeListener','register','userProfile:','./userProfile.events','save','remove','emit'];(function(_0x17c55f,_0x3e1a19){var _0xfd98fa=function(_0x3d26fb){while(--_0x3d26fb){_0x17c55f['push'](_0x17c55f['shift']());}};_0xfd98fa(++_0x3e1a19);}(_0xaa11,0xb2));var _0x1aa1=function(_0x4c7c25,_0x1e16a8){_0x4c7c25=_0x4c7c25-0x0;var _0x297619=_0xaa11[_0x4c7c25];return _0x297619;};'use strict';var UserProfileEvents=require(_0x1aa1('0x0'));var events=[_0x1aa1('0x1'),_0x1aa1('0x2'),'update'];function createListener(_0x5de2bf,_0x237aaf){return function(_0x2a4b76){_0x237aaf[_0x1aa1('0x3')](_0x5de2bf,_0x2a4b76);};}function removeListener(_0x56ccc9,_0x5282b0){return function(){UserProfileEvents[_0x1aa1('0x4')](_0x56ccc9,_0x5282b0);};}exports[_0x1aa1('0x5')]=function(_0x493ee8){for(var _0x55dfea=0x0,_0x3e45cd=events['length'];_0x55dfea<_0x3e45cd;_0x55dfea++){var _0x43ff50=events[_0x55dfea];var _0x314e1d=createListener(_0x1aa1('0x6')+_0x43ff50,_0x493ee8);UserProfileEvents['on'](_0x43ff50,_0x314e1d);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index 5332736..4d163ea 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 _0x287d=['./userProfileResource.controller','isAuthenticated','index','get','describe','show','post','create','put','/:id','update','destroy','multer','util','connect-timeout','express','Router'];(function(_0x51020b,_0x38c2c7){var _0x371e47=function(_0x2a538f){while(--_0x2a538f){_0x51020b['push'](_0x51020b['shift']());}};_0x371e47(++_0x38c2c7);}(_0x287d,0x83));var _0xd287=function(_0x5caabb,_0x2b0cc1){_0x5caabb=_0x5caabb-0x0;var _0x2929d8=_0x287d[_0x5caabb];return _0x2929d8;};'use strict';var multer=require(_0xd287('0x0'));var util=require(_0xd287('0x1'));var path=require('path');var timeout=require(_0xd287('0x2'));var express=require(_0xd287('0x3'));var router=express[_0xd287('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xd287('0x5'));router['get']('/',auth[_0xd287('0x6')](),controller[_0xd287('0x7')]);router[_0xd287('0x8')]('/describe',auth[_0xd287('0x6')](),controller[_0xd287('0x9')]);router[_0xd287('0x8')]('/:id',auth['isAuthenticated'](),controller[_0xd287('0xa')]);router[_0xd287('0xb')]('/',auth[_0xd287('0x6')](),controller[_0xd287('0xc')]);router[_0xd287('0xd')](_0xd287('0xe'),auth[_0xd287('0x6')](),controller[_0xd287('0xf')]);router['delete'](_0xd287('0xe'),auth[_0xd287('0x6')](),controller[_0xd287('0x10')]);module['exports']=router; \ No newline at end of file +var _0xa3d8=['put','/:id','update','delete','destroy','exports','multer','util','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./userProfileResource.controller','get','isAuthenticated','/describe','show','post','create'];(function(_0x204809,_0x2fc643){var _0x3bbbf5=function(_0x3b7989){while(--_0x3b7989){_0x204809['push'](_0x204809['shift']());}};_0x3bbbf5(++_0x2fc643);}(_0xa3d8,0xa6));var _0x8a3d=function(_0x2a77d4,_0x8a7e75){_0x2a77d4=_0x2a77d4-0x0;var _0x4205e6=_0xa3d8[_0x2a77d4];return _0x4205e6;};'use strict';var multer=require(_0x8a3d('0x0'));var util=require(_0x8a3d('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x8a3d('0x2'));var router=express[_0x8a3d('0x3')]();var fs_extra=require(_0x8a3d('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x8a3d('0x5'));var config=require(_0x8a3d('0x6'));var controller=require(_0x8a3d('0x7'));router[_0x8a3d('0x8')]('/',auth[_0x8a3d('0x9')](),controller['index']);router[_0x8a3d('0x8')](_0x8a3d('0xa'),auth[_0x8a3d('0x9')](),controller['describe']);router[_0x8a3d('0x8')]('/:id',auth[_0x8a3d('0x9')](),controller[_0x8a3d('0xb')]);router[_0x8a3d('0xc')]('/',auth[_0x8a3d('0x9')](),controller[_0x8a3d('0xd')]);router[_0x8a3d('0xe')](_0x8a3d('0xf'),auth['isAuthenticated'](),controller[_0x8a3d('0x10')]);router[_0x8a3d('0x11')](_0x8a3d('0xf'),auth[_0x8a3d('0x9')](),controller[_0x8a3d('0x12')]);module[_0x8a3d('0x13')]=router; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.attributes.js b/server/api/userProfileResource/userProfileResource.attributes.js index 1be82f4..1542e91 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 _0xd5cd=['exports','STRING','INTEGER'];(function(_0x1203f,_0x554bbc){var _0x365f0a=function(_0x3531d0){while(--_0x3531d0){_0x1203f['push'](_0x1203f['shift']());}};_0x365f0a(++_0x554bbc);}(_0xd5cd,0x120));var _0xdd5c=function(_0x24ef7e,_0x82a220){_0x24ef7e=_0x24ef7e-0x0;var _0x2ca201=_0xd5cd[_0x24ef7e];return _0x2ca201;};'use strict';var Sequelize=require('sequelize');module[_0xdd5c('0x0')]={'name':{'type':Sequelize[_0xdd5c('0x1')],'allowNull':![]},'resourceId':{'type':Sequelize[_0xdd5c('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xdd5c('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x862c=['sequelize','exports','STRING','INTEGER'];(function(_0x1e54bd,_0x7915f3){var _0x33bda2=function(_0x5fcdef){while(--_0x5fcdef){_0x1e54bd['push'](_0x1e54bd['shift']());}};_0x33bda2(++_0x7915f3);}(_0x862c,0xa4));var _0xc862=function(_0x15c083,_0x9e73d3){_0x15c083=_0x15c083-0x0;var _0x1320c5=_0x862c[_0x15c083];return _0x1320c5;};'use strict';var Sequelize=require(_0xc862('0x0'));module[_0xc862('0x1')]={'name':{'type':Sequelize[_0xc862('0x2')],'allowNull':![]},'resourceId':{'type':Sequelize[_0xc862('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xc862('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 fb00049..e0680e6 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 _0x0295=['params','intersection','include','find','create','body','eml-format','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','end','status','json','offset','undefined','limit','count','set','apply','save','update','then','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','UserProfileResource','includeAll','rows','catch','show'];(function(_0x552192,_0x4d9370){var _0x6b7953=function(_0x4bccbf){while(--_0x4bccbf){_0x552192['push'](_0x552192['shift']());}};_0x6b7953(++_0x4d9370);}(_0x0295,0x1f0));var _0x5029=function(_0x5ba549,_0x425afd){_0x5ba549=_0x5ba549-0x0;var _0x36e3a1=_0x0295[_0x5ba549];return _0x36e3a1;};'use strict';var emlformat=require(_0x5029('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x5029('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x5029('0x2'));var Mustache=require(_0x5029('0x3'));var util=require(_0x5029('0x4'));var path=require(_0x5029('0x5'));var sox=require(_0x5029('0x6'));var csv=require(_0x5029('0x7'));var ejs=require(_0x5029('0x8'));var fs=require('fs');var fs_extra=require(_0x5029('0x9'));var _=require(_0x5029('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x5029('0xb'));var toCsv=require('to-csv');var querystring=require(_0x5029('0xc'));var Papa=require('papaparse');var Redis=require(_0x5029('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x5029('0xe'));var as=require(_0x5029('0xf'));var hardwareService=require(_0x5029('0x10'));var logger=require('../../config/logger')(_0x5029('0x11'));var utils=require(_0x5029('0x12'));var config=require(_0x5029('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x5029('0x14'))['db'];function respondWithStatusCode(_0x2442b2,_0x4cced9){_0x4cced9=_0x4cced9||0xcc;return function(_0x4fa22d){if(_0x4fa22d){return _0x2442b2['sendStatus'](_0x4cced9);}return _0x2442b2['status'](_0x4cced9)[_0x5029('0x15')]();};}function respondWithResult(_0x2e0369,_0x12c237){_0x12c237=_0x12c237||0xc8;return function(_0x434630){if(_0x434630){return _0x2e0369[_0x5029('0x16')](_0x12c237)[_0x5029('0x17')](_0x434630);}};}function respondWithFilteredResult(_0xe278b7,_0x317c20){return function(_0x10bf55){if(_0x10bf55){var _0x326923=typeof _0x317c20[_0x5029('0x18')]===_0x5029('0x19')&&typeof _0x317c20[_0x5029('0x1a')]===_0x5029('0x19');var _0x343918=_0x10bf55['count'];var _0x1ed567=_0x326923?0x0:_0x317c20[_0x5029('0x18')];var _0x35de81=_0x326923?_0x10bf55[_0x5029('0x1b')]:_0x317c20[_0x5029('0x18')]+_0x317c20[_0x5029('0x1a')];var _0xaba461;if(_0x35de81>=_0x343918){_0x35de81=_0x343918;_0xaba461=0xc8;}else{_0xaba461=0xce;}_0xe278b7['status'](_0xaba461);return _0xe278b7[_0x5029('0x1c')]('Content-Range',_0x1ed567+'-'+_0x35de81+'/'+_0x343918)[_0x5029('0x17')](_0x10bf55);}return null;};}function patchUpdates(_0x8a414c){return function(_0x2710aa){try{jsonpatch[_0x5029('0x1d')](_0x2710aa,_0x8a414c,!![]);}catch(_0x4b5854){return BPromise['reject'](_0x4b5854);}return _0x2710aa[_0x5029('0x1e')]();};}function saveUpdates(_0x4a49b6,_0x3f657d){return function(_0x853a34){if(_0x853a34){return _0x853a34[_0x5029('0x1f')](_0x4a49b6)[_0x5029('0x20')](function(_0x16bd22){return _0x16bd22;});}return null;};}function removeEntity(_0x3a3e52,_0x125c26){return function(_0x356dac){if(_0x356dac){return _0x356dac[_0x5029('0x21')]()['then'](function(){_0x3a3e52['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x588d90,_0x45666c){return function(_0x51093c){if(!_0x51093c){_0x588d90['sendStatus'](0x194);}return _0x51093c;};}function handleError(_0x181da0,_0x1e7e61){_0x1e7e61=_0x1e7e61||0x1f4;return function(_0x36d810){logger['error'](_0x36d810[_0x5029('0x22')]);if(_0x36d810[_0x5029('0x23')]){delete _0x36d810['name'];}_0x181da0[_0x5029('0x16')](_0x1e7e61)[_0x5029('0x24')](_0x36d810);};}exports[_0x5029('0x25')]=function(_0x4a24b9,_0x32da06){var _0x251f99={},_0xe5313e={},_0x4b6f92={'count':0x0,'rows':[]};var _0x2cedf6=_[_0x5029('0x26')](db['UserProfileResource'][_0x5029('0x27')],function(_0x25032b){return{'name':_0x25032b[_0x5029('0x28')],'type':_0x25032b[_0x5029('0x29')][_0x5029('0x2a')]};});_0xe5313e[_0x5029('0x2b')]=_[_0x5029('0x26')](_0x2cedf6,_0x5029('0x23'));_0xe5313e[_0x5029('0x2c')]=_[_0x5029('0x2d')](_0x4a24b9[_0x5029('0x2c')]);_0xe5313e[_0x5029('0x2e')]=_['intersection'](_0xe5313e[_0x5029('0x2b')],_0xe5313e['query']);_0x251f99[_0x5029('0x2f')]=_['intersection'](_0xe5313e['model'],qs[_0x5029('0x30')](_0x4a24b9[_0x5029('0x2c')][_0x5029('0x30')]));_0x251f99['attributes']=_0x251f99[_0x5029('0x2f')][_0x5029('0x31')]?_0x251f99[_0x5029('0x2f')]:_0xe5313e[_0x5029('0x2b')];if(!_0x4a24b9[_0x5029('0x2c')][_0x5029('0x32')](_0x5029('0x33'))){_0x251f99[_0x5029('0x1a')]=qs[_0x5029('0x1a')](_0x4a24b9['query'][_0x5029('0x1a')]);_0x251f99[_0x5029('0x18')]=qs[_0x5029('0x18')](_0x4a24b9[_0x5029('0x2c')]['offset']);}_0x251f99[_0x5029('0x34')]=qs[_0x5029('0x35')](_0x4a24b9[_0x5029('0x2c')]['sort']);_0x251f99['where']=qs[_0x5029('0x2e')](_[_0x5029('0x36')](_0x4a24b9['query'],_0xe5313e['filters']),_0x2cedf6);if(_0x4a24b9[_0x5029('0x2c')][_0x5029('0x37')]){_0x251f99[_0x5029('0x38')]=_[_0x5029('0x39')](_0x251f99[_0x5029('0x38')],{'$or':_[_0x5029('0x26')](_0x2cedf6,function(_0x3cb84e){if(_0x3cb84e[_0x5029('0x29')]!==_0x5029('0x3a')){var _0x3effa4={};_0x3effa4[_0x3cb84e[_0x5029('0x23')]]={'$like':'%'+_0x4a24b9[_0x5029('0x2c')][_0x5029('0x37')]+'%'};return _0x3effa4;}})});}_0x251f99=_[_0x5029('0x39')]({},_0x251f99,_0x4a24b9['options']);var _0x57c2b5={'where':_0x251f99[_0x5029('0x38')]};return db[_0x5029('0x3b')][_0x5029('0x1b')](_0x57c2b5)['then'](function(_0x32d8a3){_0x4b6f92[_0x5029('0x1b')]=_0x32d8a3;if(_0x4a24b9['query'][_0x5029('0x3c')]){_0x251f99['include']=[{'all':!![]}];}return db[_0x5029('0x3b')]['findAll'](_0x251f99);})[_0x5029('0x20')](function(_0x359838){_0x4b6f92[_0x5029('0x3d')]=_0x359838;return _0x4b6f92;})[_0x5029('0x20')](respondWithFilteredResult(_0x32da06,_0x251f99))[_0x5029('0x3e')](handleError(_0x32da06,null));};exports[_0x5029('0x3f')]=function(_0x4b2219,_0x1021ea){var _0x2ae047={'raw':![],'where':{'id':_0x4b2219[_0x5029('0x40')]['id']}},_0x5a3e4d={};_0x5a3e4d[_0x5029('0x2b')]=_[_0x5029('0x2d')](db[_0x5029('0x3b')][_0x5029('0x27')]);_0x5a3e4d[_0x5029('0x2c')]=_['keys'](_0x4b2219[_0x5029('0x2c')]);_0x5a3e4d[_0x5029('0x2e')]=_[_0x5029('0x41')](_0x5a3e4d[_0x5029('0x2b')],_0x5a3e4d[_0x5029('0x2c')]);_0x2ae047['attributes']=_[_0x5029('0x41')](_0x5a3e4d[_0x5029('0x2b')],qs[_0x5029('0x30')](_0x4b2219[_0x5029('0x2c')][_0x5029('0x30')]));_0x2ae047[_0x5029('0x2f')]=_0x2ae047[_0x5029('0x2f')][_0x5029('0x31')]?_0x2ae047[_0x5029('0x2f')]:_0x5a3e4d['model'];if(_0x4b2219[_0x5029('0x2c')][_0x5029('0x3c')]){_0x2ae047[_0x5029('0x42')]=[{'all':!![]}];}_0x2ae047=_[_0x5029('0x39')]({},_0x2ae047,_0x4b2219['options']);return db['UserProfileResource'][_0x5029('0x43')](_0x2ae047)[_0x5029('0x20')](handleEntityNotFound(_0x1021ea,null))[_0x5029('0x20')](respondWithResult(_0x1021ea,null))[_0x5029('0x3e')](handleError(_0x1021ea,null));};exports[_0x5029('0x44')]=function(_0x3dfc08,_0x2bb7fc){return db[_0x5029('0x3b')][_0x5029('0x44')](_0x3dfc08[_0x5029('0x45')],{})[_0x5029('0x20')](respondWithResult(_0x2bb7fc,0xc9))[_0x5029('0x3e')](handleError(_0x2bb7fc,null));};exports[_0x5029('0x1f')]=function(_0x18f1f5,_0x3168bd){if(_0x18f1f5[_0x5029('0x45')]['id']){delete _0x18f1f5[_0x5029('0x45')]['id'];}return db[_0x5029('0x3b')][_0x5029('0x43')]({'where':{'id':_0x18f1f5[_0x5029('0x40')]['id']}})[_0x5029('0x20')](handleEntityNotFound(_0x3168bd,null))['then'](saveUpdates(_0x18f1f5[_0x5029('0x45')],null))['then'](respondWithResult(_0x3168bd,null))[_0x5029('0x3e')](handleError(_0x3168bd,null));};exports[_0x5029('0x21')]=function(_0x4d788a,_0x5343c6){return db[_0x5029('0x3b')]['find']({'where':{'id':_0x4d788a['params']['id']}})[_0x5029('0x20')](handleEntityNotFound(_0x5343c6,null))[_0x5029('0x20')](removeEntity(_0x5343c6,null))[_0x5029('0x3e')](handleError(_0x5343c6,null));};exports['describe']=function(_0x544fb3,_0x1510bb){return db[_0x5029('0x3b')]['describe']()[_0x5029('0x20')](respondWithResult(_0x1510bb,null))['catch'](handleError(_0x1510bb,null));}; \ No newline at end of file +var _0xef0f=['json','apply','reject','save','update','destroy','then','error','stack','name','send','index','map','UserProfileResource','key','model','filters','intersection','query','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','params','keys','rawAttributes','find','create','body','catch','describe','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','Content-Range'];(function(_0x13d1d4,_0x43f857){var _0x3957a5=function(_0x21a87c){while(--_0x21a87c){_0x13d1d4['push'](_0x13d1d4['shift']());}};_0x3957a5(++_0x43f857);}(_0xef0f,0x168));var _0xfef0=function(_0x3ca0d4,_0x37c881){_0x3ca0d4=_0x3ca0d4-0x0;var _0x5e21b2=_0xef0f[_0x3ca0d4];return _0x5e21b2;};'use strict';var emlformat=require(_0xfef0('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xfef0('0x1'));var jsonpatch=require(_0xfef0('0x2'));var rp=require(_0xfef0('0x3'));var moment=require('moment');var BPromise=require(_0xfef0('0x4'));var Mustache=require(_0xfef0('0x5'));var util=require(_0xfef0('0x6'));var path=require('path');var sox=require(_0xfef0('0x7'));var csv=require(_0xfef0('0x8'));var ejs=require(_0xfef0('0x9'));var fs=require('fs');var fs_extra=require(_0xfef0('0xa'));var _=require(_0xfef0('0xb'));var squel=require(_0xfef0('0xc'));var crypto=require('crypto');var jsforce=require(_0xfef0('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xfef0('0x8'));var querystring=require(_0xfef0('0xe'));var Papa=require(_0xfef0('0xf'));var Redis=require(_0xfef0('0x10'));var authService=require(_0xfef0('0x11'));var qs=require(_0xfef0('0x12'));var as=require(_0xfef0('0x13'));var hardwareService=require(_0xfef0('0x14'));var logger=require(_0xfef0('0x15'))(_0xfef0('0x16'));var utils=require(_0xfef0('0x17'));var config=require(_0xfef0('0x18'));var licenseUtil=require(_0xfef0('0x19'));var db=require(_0xfef0('0x1a'))['db'];function respondWithStatusCode(_0x546c7a,_0x3135ab){_0x3135ab=_0x3135ab||0xcc;return function(_0x2f4e23){if(_0x2f4e23){return _0x546c7a[_0xfef0('0x1b')](_0x3135ab);}return _0x546c7a[_0xfef0('0x1c')](_0x3135ab)[_0xfef0('0x1d')]();};}function respondWithResult(_0x45599a,_0xa9f040){_0xa9f040=_0xa9f040||0xc8;return function(_0x573ae7){if(_0x573ae7){return _0x45599a[_0xfef0('0x1c')](_0xa9f040)['json'](_0x573ae7);}};}function respondWithFilteredResult(_0x4b5bcf,_0x5acdd0){return function(_0x118b8d){if(_0x118b8d){var _0x284b6d=typeof _0x5acdd0[_0xfef0('0x1e')]===_0xfef0('0x1f')&&typeof _0x5acdd0[_0xfef0('0x20')]===_0xfef0('0x1f');var _0x155833=_0x118b8d[_0xfef0('0x21')];var _0x581459=_0x284b6d?0x0:_0x5acdd0[_0xfef0('0x1e')];var _0x1642cd=_0x284b6d?_0x118b8d[_0xfef0('0x21')]:_0x5acdd0[_0xfef0('0x1e')]+_0x5acdd0[_0xfef0('0x20')];var _0x55912f;if(_0x1642cd>=_0x155833){_0x1642cd=_0x155833;_0x55912f=0xc8;}else{_0x55912f=0xce;}_0x4b5bcf[_0xfef0('0x1c')](_0x55912f);return _0x4b5bcf['set'](_0xfef0('0x22'),_0x581459+'-'+_0x1642cd+'/'+_0x155833)[_0xfef0('0x23')](_0x118b8d);}return null;};}function patchUpdates(_0x28dee1){return function(_0x48408a){try{jsonpatch[_0xfef0('0x24')](_0x48408a,_0x28dee1,!![]);}catch(_0x4c304d){return BPromise[_0xfef0('0x25')](_0x4c304d);}return _0x48408a[_0xfef0('0x26')]();};}function saveUpdates(_0x52b93b,_0x4897af){return function(_0x4b8b22){if(_0x4b8b22){return _0x4b8b22[_0xfef0('0x27')](_0x52b93b)['then'](function(_0x1f9970){return _0x1f9970;});}return null;};}function removeEntity(_0x46b34a,_0x1a8d66){return function(_0x4483f2){if(_0x4483f2){return _0x4483f2[_0xfef0('0x28')]()[_0xfef0('0x29')](function(){_0x46b34a['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x316e20,_0x1ffaa4){return function(_0x924f6e){if(!_0x924f6e){_0x316e20[_0xfef0('0x1b')](0x194);}return _0x924f6e;};}function handleError(_0xab231c,_0xf60f2){_0xf60f2=_0xf60f2||0x1f4;return function(_0x5df04f){logger[_0xfef0('0x2a')](_0x5df04f[_0xfef0('0x2b')]);if(_0x5df04f['name']){delete _0x5df04f[_0xfef0('0x2c')];}_0xab231c[_0xfef0('0x1c')](_0xf60f2)[_0xfef0('0x2d')](_0x5df04f);};}exports[_0xfef0('0x2e')]=function(_0x37921f,_0x1ac4a3){var _0x3e3c4c={},_0x3e026a={},_0x26cb9a={'count':0x0,'rows':[]};var _0x213a91=_[_0xfef0('0x2f')](db[_0xfef0('0x30')]['rawAttributes'],function(_0x445625){return{'name':_0x445625['fieldName'],'type':_0x445625['type'][_0xfef0('0x31')]};});_0x3e026a[_0xfef0('0x32')]=_['map'](_0x213a91,'name');_0x3e026a['query']=_['keys'](_0x37921f['query']);_0x3e026a[_0xfef0('0x33')]=_[_0xfef0('0x34')](_0x3e026a[_0xfef0('0x32')],_0x3e026a['query']);_0x3e3c4c['attributes']=_['intersection'](_0x3e026a[_0xfef0('0x32')],qs['fields'](_0x37921f[_0xfef0('0x35')][_0xfef0('0x36')]));_0x3e3c4c[_0xfef0('0x37')]=_0x3e3c4c['attributes'][_0xfef0('0x38')]?_0x3e3c4c['attributes']:_0x3e026a[_0xfef0('0x32')];if(!_0x37921f[_0xfef0('0x35')][_0xfef0('0x39')](_0xfef0('0x3a'))){_0x3e3c4c[_0xfef0('0x20')]=qs[_0xfef0('0x20')](_0x37921f[_0xfef0('0x35')][_0xfef0('0x20')]);_0x3e3c4c['offset']=qs[_0xfef0('0x1e')](_0x37921f[_0xfef0('0x35')][_0xfef0('0x1e')]);}_0x3e3c4c[_0xfef0('0x3b')]=qs[_0xfef0('0x3c')](_0x37921f[_0xfef0('0x35')][_0xfef0('0x3c')]);_0x3e3c4c[_0xfef0('0x3d')]=qs[_0xfef0('0x33')](_[_0xfef0('0x3e')](_0x37921f[_0xfef0('0x35')],_0x3e026a[_0xfef0('0x33')]),_0x213a91);if(_0x37921f[_0xfef0('0x35')]['filter']){_0x3e3c4c[_0xfef0('0x3d')]=_['merge'](_0x3e3c4c[_0xfef0('0x3d')],{'$or':_[_0xfef0('0x2f')](_0x213a91,function(_0x1ddce6){if(_0x1ddce6['type']!==_0xfef0('0x3f')){var _0x29469e={};_0x29469e[_0x1ddce6[_0xfef0('0x2c')]]={'$like':'%'+_0x37921f['query'][_0xfef0('0x40')]+'%'};return _0x29469e;}})});}_0x3e3c4c=_[_0xfef0('0x41')]({},_0x3e3c4c,_0x37921f[_0xfef0('0x42')]);var _0x5577f4={'where':_0x3e3c4c[_0xfef0('0x3d')]};return db['UserProfileResource']['count'](_0x5577f4)[_0xfef0('0x29')](function(_0x547a5d){_0x26cb9a['count']=_0x547a5d;if(_0x37921f[_0xfef0('0x35')][_0xfef0('0x43')]){_0x3e3c4c[_0xfef0('0x44')]=[{'all':!![]}];}return db[_0xfef0('0x30')][_0xfef0('0x45')](_0x3e3c4c);})[_0xfef0('0x29')](function(_0x4dd8f8){_0x26cb9a[_0xfef0('0x46')]=_0x4dd8f8;return _0x26cb9a;})[_0xfef0('0x29')](respondWithFilteredResult(_0x1ac4a3,_0x3e3c4c))['catch'](handleError(_0x1ac4a3,null));};exports['show']=function(_0x1d554e,_0x5dc824){var _0x1fc518={'raw':![],'where':{'id':_0x1d554e[_0xfef0('0x47')]['id']}},_0x22c940={};_0x22c940[_0xfef0('0x32')]=_[_0xfef0('0x48')](db[_0xfef0('0x30')][_0xfef0('0x49')]);_0x22c940[_0xfef0('0x35')]=_['keys'](_0x1d554e[_0xfef0('0x35')]);_0x22c940['filters']=_['intersection'](_0x22c940[_0xfef0('0x32')],_0x22c940[_0xfef0('0x35')]);_0x1fc518['attributes']=_[_0xfef0('0x34')](_0x22c940['model'],qs[_0xfef0('0x36')](_0x1d554e[_0xfef0('0x35')][_0xfef0('0x36')]));_0x1fc518[_0xfef0('0x37')]=_0x1fc518['attributes'][_0xfef0('0x38')]?_0x1fc518[_0xfef0('0x37')]:_0x22c940['model'];if(_0x1d554e['query'][_0xfef0('0x43')]){_0x1fc518['include']=[{'all':!![]}];}_0x1fc518=_[_0xfef0('0x41')]({},_0x1fc518,_0x1d554e[_0xfef0('0x42')]);return db[_0xfef0('0x30')][_0xfef0('0x4a')](_0x1fc518)[_0xfef0('0x29')](handleEntityNotFound(_0x5dc824,null))[_0xfef0('0x29')](respondWithResult(_0x5dc824,null))['catch'](handleError(_0x5dc824,null));};exports[_0xfef0('0x4b')]=function(_0x559a28,_0x5a417e){return db[_0xfef0('0x30')][_0xfef0('0x4b')](_0x559a28[_0xfef0('0x4c')],{})['then'](respondWithResult(_0x5a417e,0xc9))[_0xfef0('0x4d')](handleError(_0x5a417e,null));};exports['update']=function(_0x5dd26b,_0x51f207){if(_0x5dd26b[_0xfef0('0x4c')]['id']){delete _0x5dd26b[_0xfef0('0x4c')]['id'];}return db[_0xfef0('0x30')][_0xfef0('0x4a')]({'where':{'id':_0x5dd26b[_0xfef0('0x47')]['id']}})[_0xfef0('0x29')](handleEntityNotFound(_0x51f207,null))[_0xfef0('0x29')](saveUpdates(_0x5dd26b[_0xfef0('0x4c')],null))[_0xfef0('0x29')](respondWithResult(_0x51f207,null))['catch'](handleError(_0x51f207,null));};exports['destroy']=function(_0x2bebec,_0x18e5ba){return db[_0xfef0('0x30')][_0xfef0('0x4a')]({'where':{'id':_0x2bebec[_0xfef0('0x47')]['id']}})[_0xfef0('0x29')](handleEntityNotFound(_0x18e5ba,null))[_0xfef0('0x29')](removeEntity(_0x18e5ba,null))[_0xfef0('0x4d')](handleError(_0x18e5ba,null));};exports['describe']=function(_0x2466e7,_0x19e449){return db[_0xfef0('0x30')][_0xfef0('0x4e')]()[_0xfef0('0x29')](respondWithResult(_0x19e449,null))['catch'](handleError(_0x19e449,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index 52ceefd..8adcff1 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 _0x1184=['../../config/environment','./userProfileResource.attributes','exports','user_profile_has_resources','compositeIndex','resourceId','sectionId','util','../../config/logger','api','moment','request-promise','path'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x1184,0xe4));var _0x4118=function(_0x193d1a,_0x249662){_0x193d1a=_0x193d1a-0x0;var _0x35399a=_0x1184[_0x193d1a];return _0x35399a;};'use strict';var _=require('lodash');var util=require(_0x4118('0x0'));var logger=require(_0x4118('0x1'))(_0x4118('0x2'));var moment=require(_0x4118('0x3'));var BPromise=require('bluebird');var rp=require(_0x4118('0x4'));var fs=require('fs');var path=require(_0x4118('0x5'));var rimraf=require('rimraf');var config=require(_0x4118('0x6'));var attributes=require(_0x4118('0x7'));module[_0x4118('0x8')]=function(_0x3c32d7,_0xd89651){return _0x3c32d7['define']('UserProfileResource',attributes,{'tableName':_0x4118('0x9'),'paranoid':![],'indexes':[{'name':_0x4118('0xa'),'fields':[_0x4118('0xb'),_0x4118('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4684=['UserProfileResource','user_profile_has_resources','sectionId','util','api','moment','bluebird','path','../../config/environment','exports','define'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x4684,0x142));var _0x4468=function(_0x58aae3,_0x3fbc1b){_0x58aae3=_0x58aae3-0x0;var _0x5c1c8a=_0x4684[_0x58aae3];return _0x5c1c8a;};'use strict';var _=require('lodash');var util=require(_0x4468('0x0'));var logger=require('../../config/logger')(_0x4468('0x1'));var moment=require(_0x4468('0x2'));var BPromise=require(_0x4468('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4468('0x4'));var rimraf=require('rimraf');var config=require(_0x4468('0x5'));var attributes=require('./userProfileResource.attributes');module[_0x4468('0x6')]=function(_0x1051b8,_0x3664c0){return _0x1051b8[_0x4468('0x7')](_0x4468('0x8'),attributes,{'tableName':_0x4468('0x9'),'paranoid':![],'indexes':[{'name':'compositeIndex','fields':['resourceId',_0x4468('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.rpc.js b/server/api/userProfileResource/userProfileResource.rpc.js index 41af879..c82af17 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 _0x6453=['debug','stringify','code','error','message','result','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','http','then','info','UserProfileResource,\x20%s,\x20%s','request\x20sent'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x6453,0x1c0));var _0x3645=function(_0x32f26d,_0x2c0b5d){_0x32f26d=_0x32f26d-0x0;var _0x5d9ddc=_0x6453[_0x32f26d];return _0x5d9ddc;};'use strict';var _=require(_0x3645('0x0'));var util=require(_0x3645('0x1'));var moment=require(_0x3645('0x2'));var BPromise=require(_0x3645('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3645('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x3645('0x5'));var logger=require(_0x3645('0x6'))(_0x3645('0x7'));var config=require('../../config/environment');var jayson=require(_0x3645('0x8'));var client=jayson['client'][_0x3645('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4e4ed6,_0x34c468,_0x2d2fbf){return new BPromise(function(_0x4342ea,_0x1f2ee3){return client['request'](_0x4e4ed6,_0x2d2fbf)[_0x3645('0xa')](function(_0x2b38b5){logger[_0x3645('0xb')](_0x3645('0xc'),_0x34c468,_0x3645('0xd'));logger[_0x3645('0xe')]('UserProfileResource,\x20%s,\x20%s,\x20%s',_0x34c468,_0x3645('0xd'),JSON[_0x3645('0xf')](_0x2b38b5));if(_0x2b38b5['error']){if(_0x2b38b5['error'][_0x3645('0x10')]===0x1f4){logger[_0x3645('0x11')]('UserProfileResource,\x20%s,\x20%s',_0x34c468,_0x2b38b5[_0x3645('0x11')][_0x3645('0x12')]);return _0x1f2ee3(_0x2b38b5[_0x3645('0x11')][_0x3645('0x12')]);}logger[_0x3645('0x11')]('UserProfileResource,\x20%s,\x20%s',_0x34c468,_0x2b38b5[_0x3645('0x11')][_0x3645('0x12')]);return _0x4342ea(_0x2b38b5[_0x3645('0x11')][_0x3645('0x12')]);}else{logger['info']('UserProfileResource,\x20%s,\x20%s',_0x34c468,_0x3645('0xd'));_0x4342ea(_0x2b38b5[_0x3645('0x13')]['message']);}})[_0x3645('0x14')](function(_0x3289ef){logger[_0x3645('0x11')](_0x3645('0xc'),_0x34c468,_0x3289ef);_0x1f2ee3(_0x3289ef);});});} \ No newline at end of file +var _0x2842=['debug','UserProfileResource,\x20%s,\x20%s,\x20%s','error','UserProfileResource,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','then','info','request\x20sent'];(function(_0x5054c8,_0x482d9c){var _0x1c1acf=function(_0x541c82){while(--_0x541c82){_0x5054c8['push'](_0x5054c8['shift']());}};_0x1c1acf(++_0x482d9c);}(_0x2842,0x1e1));var _0x2284=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x2842[_0x618414];return _0x21c19a;};'use strict';var _=require(_0x2284('0x0'));var util=require(_0x2284('0x1'));var moment=require(_0x2284('0x2'));var BPromise=require(_0x2284('0x3'));var rs=require(_0x2284('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2284('0x5'))['db'];var utils=require(_0x2284('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x2284('0x7'));var jayson=require(_0x2284('0x8'));var client=jayson[_0x2284('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2dec7e,_0xed0889,_0x47dc9b){return new BPromise(function(_0x27473d,_0x1105c7){return client['request'](_0x2dec7e,_0x47dc9b)[_0x2284('0xa')](function(_0x37e378){logger[_0x2284('0xb')]('UserProfileResource,\x20%s,\x20%s',_0xed0889,_0x2284('0xc'));logger[_0x2284('0xd')](_0x2284('0xe'),_0xed0889,_0x2284('0xc'),JSON['stringify'](_0x37e378));if(_0x37e378['error']){if(_0x37e378['error']['code']===0x1f4){logger[_0x2284('0xf')](_0x2284('0x10'),_0xed0889,_0x37e378[_0x2284('0xf')][_0x2284('0x11')]);return _0x1105c7(_0x37e378[_0x2284('0xf')][_0x2284('0x11')]);}logger[_0x2284('0xf')](_0x2284('0x10'),_0xed0889,_0x37e378['error']['message']);return _0x27473d(_0x37e378[_0x2284('0xf')]['message']);}else{logger[_0x2284('0xb')]('UserProfileResource,\x20%s,\x20%s',_0xed0889,_0x2284('0xc'));_0x27473d(_0x37e378['result'][_0x2284('0x11')]);}})[_0x2284('0x12')](function(_0x26b23a){logger[_0x2284('0xf')](_0x2284('0x10'),_0xed0889,_0x26b23a);_0x1105c7(_0x26b23a);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index ea19ee5..b53e393 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 _0xbb3c=['express','Router','fs-extra','../../components/auth/service','../../config/environment','./userProfileSection.controller','get','isAuthenticated','index','/describe','/:id','post','create','put','update','destroy','exports','multer','util','path','connect-timeout'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0xbb3c,0xa4));var _0xcbb3=function(_0x766881,_0x754ca6){_0x766881=_0x766881-0x0;var _0x35df53=_0xbb3c[_0x766881];return _0x35df53;};'use strict';var multer=require(_0xcbb3('0x0'));var util=require(_0xcbb3('0x1'));var path=require(_0xcbb3('0x2'));var timeout=require(_0xcbb3('0x3'));var express=require(_0xcbb3('0x4'));var router=express[_0xcbb3('0x5')]();var fs_extra=require(_0xcbb3('0x6'));var auth=require(_0xcbb3('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xcbb3('0x8'));var controller=require(_0xcbb3('0x9'));router[_0xcbb3('0xa')]('/',auth[_0xcbb3('0xb')](),controller[_0xcbb3('0xc')]);router[_0xcbb3('0xa')](_0xcbb3('0xd'),auth[_0xcbb3('0xb')](),controller['describe']);router[_0xcbb3('0xa')](_0xcbb3('0xe'),auth[_0xcbb3('0xb')](),controller['show']);router[_0xcbb3('0xf')]('/',auth[_0xcbb3('0xb')](),controller[_0xcbb3('0x10')]);router[_0xcbb3('0x11')](_0xcbb3('0xe'),auth[_0xcbb3('0xb')](),controller[_0xcbb3('0x12')]);router['delete']('/:id',auth[_0xcbb3('0xb')](),controller[_0xcbb3('0x13')]);module[_0xcbb3('0x14')]=router; \ No newline at end of file +var _0x6e46=['/describe','describe','/:id','show','post','put','update','delete','destroy','exports','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./userProfileSection.controller','get','isAuthenticated','index'];(function(_0x95c573,_0x284e8f){var _0x52daf0=function(_0x3891f9){while(--_0x3891f9){_0x95c573['push'](_0x95c573['shift']());}};_0x52daf0(++_0x284e8f);}(_0x6e46,0x186));var _0x66e4=function(_0x144071,_0x33edf1){_0x144071=_0x144071-0x0;var _0x2dc87c=_0x6e46[_0x144071];return _0x2dc87c;};'use strict';var multer=require('multer');var util=require(_0x66e4('0x0'));var path=require('path');var timeout=require(_0x66e4('0x1'));var express=require('express');var router=express[_0x66e4('0x2')]();var fs_extra=require(_0x66e4('0x3'));var auth=require(_0x66e4('0x4'));var interaction=require(_0x66e4('0x5'));var config=require('../../config/environment');var controller=require(_0x66e4('0x6'));router[_0x66e4('0x7')]('/',auth[_0x66e4('0x8')](),controller[_0x66e4('0x9')]);router[_0x66e4('0x7')](_0x66e4('0xa'),auth[_0x66e4('0x8')](),controller[_0x66e4('0xb')]);router['get'](_0x66e4('0xc'),auth[_0x66e4('0x8')](),controller[_0x66e4('0xd')]);router[_0x66e4('0xe')]('/',auth[_0x66e4('0x8')](),controller['create']);router[_0x66e4('0xf')](_0x66e4('0xc'),auth['isAuthenticated'](),controller[_0x66e4('0x10')]);router[_0x66e4('0x11')](_0x66e4('0xc'),auth[_0x66e4('0x8')](),controller[_0x66e4('0x12')]);module[_0x66e4('0x13')]=router; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.attributes.js b/server/api/userProfileSection/userProfileSection.attributes.js index 851ad07..d1b39f1 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 _0x282b=['setDataValue','crudPermissions','join','getDataValue','sequelize','exports','STRING','INTEGER'];(function(_0x4de43d,_0x3d422e){var _0x81f2d8=function(_0x42f0dc){while(--_0x42f0dc){_0x4de43d['push'](_0x4de43d['shift']());}};_0x81f2d8(++_0x3d422e);}(_0x282b,0xec));var _0xb282=function(_0xa67057,_0x1a02d6){_0xa67057=_0xa67057-0x0;var _0x1277ef=_0x282b[_0xa67057];return _0x1277ef;};'use strict';var Sequelize=require(_0xb282('0x0'));module[_0xb282('0x1')]={'name':{'type':Sequelize[_0xb282('0x2')],'allowNull':![]},'category':{'type':Sequelize[_0xb282('0x2')],'allowNull':![]},'sectionId':{'type':Sequelize[_0xb282('0x3')],'allowNull':![]},'enabled':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'autoAssociation':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0xb282('0x2')],'set':function(_0x5cadd7){this[_0xb282('0x4')](_0xb282('0x5'),_0x5cadd7?_0x5cadd7[_0xb282('0x6')](''):[]);},'get':function(){return this[_0xb282('0x7')](_0xb282('0x5'))?this[_0xb282('0x7')]('crudPermissions')['split'](''):[];}}}; \ No newline at end of file +var _0x4213=['getDataValue','split','sequelize','exports','STRING','INTEGER','BOOLEAN','crudPermissions','join'];(function(_0x8a4546,_0x1786c5){var _0x4ee16d=function(_0x4d88c){while(--_0x4d88c){_0x8a4546['push'](_0x8a4546['shift']());}};_0x4ee16d(++_0x1786c5);}(_0x4213,0x77));var _0x3421=function(_0x2b3659,_0x4850f0){_0x2b3659=_0x2b3659-0x0;var _0x5e1f19=_0x4213[_0x2b3659];return _0x5e1f19;};'use strict';var Sequelize=require(_0x3421('0x0'));module[_0x3421('0x1')]={'name':{'type':Sequelize[_0x3421('0x2')],'allowNull':![]},'category':{'type':Sequelize[_0x3421('0x2')],'allowNull':![]},'sectionId':{'type':Sequelize[_0x3421('0x3')],'allowNull':![]},'enabled':{'type':Sequelize[_0x3421('0x4')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x3421('0x4')],'defaultValue':null},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0xdbd54e){this['setDataValue'](_0x3421('0x5'),_0xdbd54e?_0xdbd54e[_0x3421('0x6')](''):[]);},'get':function(){return this[_0x3421('0x7')](_0x3421('0x5'))?this['getDataValue'](_0x3421('0x5'))[_0x3421('0x8')](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index 39dd7fc..9abba18 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 _0x7c33=['model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','include','findAll','rows','show','includeAll','catch','create','body','find','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','json','offset','undefined','count','limit','status','set','Content-Range','apply','save','update','then','destroy','end','error','stack','name','index','map','UserProfileSection','rawAttributes','type','key'];(function(_0x5c4f56,_0x3c12ad){var _0x4d917a=function(_0x43bee8){while(--_0x43bee8){_0x5c4f56['push'](_0x5c4f56['shift']());}};_0x4d917a(++_0x3c12ad);}(_0x7c33,0x19c));var _0x37c3=function(_0x334841,_0x2bbc4c){_0x334841=_0x334841-0x0;var _0x5beb4b=_0x7c33[_0x334841];return _0x5beb4b;};'use strict';var emlformat=require(_0x37c3('0x0'));var rimraf=require(_0x37c3('0x1'));var zipdir=require(_0x37c3('0x2'));var jsonpatch=require(_0x37c3('0x3'));var rp=require(_0x37c3('0x4'));var moment=require(_0x37c3('0x5'));var BPromise=require(_0x37c3('0x6'));var Mustache=require(_0x37c3('0x7'));var util=require(_0x37c3('0x8'));var path=require(_0x37c3('0x9'));var sox=require(_0x37c3('0xa'));var csv=require(_0x37c3('0xb'));var ejs=require(_0x37c3('0xc'));var fs=require('fs');var fs_extra=require(_0x37c3('0xd'));var _=require(_0x37c3('0xe'));var squel=require('squel');var crypto=require(_0x37c3('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x37c3('0x10'));var toCsv=require('to-csv');var querystring=require(_0x37c3('0x11'));var Papa=require(_0x37c3('0x12'));var Redis=require(_0x37c3('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x37c3('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x37c3('0x15'));var logger=require(_0x37c3('0x16'))(_0x37c3('0x17'));var utils=require('../../config/utils');var config=require(_0x37c3('0x18'));var licenseUtil=require(_0x37c3('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1257af,_0x27525b){_0x27525b=_0x27525b||0xcc;return function(_0x279118){if(_0x279118){return _0x1257af[_0x37c3('0x1a')](_0x27525b);}return _0x1257af['status'](_0x27525b)['end']();};}function respondWithResult(_0x2efa7e,_0x324f3b){_0x324f3b=_0x324f3b||0xc8;return function(_0x31eab9){if(_0x31eab9){return _0x2efa7e['status'](_0x324f3b)[_0x37c3('0x1b')](_0x31eab9);}};}function respondWithFilteredResult(_0x50ba1d,_0x4d9028){return function(_0x9d1086){if(_0x9d1086){var _0x927730=typeof _0x4d9028[_0x37c3('0x1c')]===_0x37c3('0x1d')&&typeof _0x4d9028['limit']==='undefined';var _0x587925=_0x9d1086['count'];var _0x23e0bb=_0x927730?0x0:_0x4d9028['offset'];var _0x7fa8b5=_0x927730?_0x9d1086[_0x37c3('0x1e')]:_0x4d9028[_0x37c3('0x1c')]+_0x4d9028[_0x37c3('0x1f')];var _0x22965a;if(_0x7fa8b5>=_0x587925){_0x7fa8b5=_0x587925;_0x22965a=0xc8;}else{_0x22965a=0xce;}_0x50ba1d[_0x37c3('0x20')](_0x22965a);return _0x50ba1d[_0x37c3('0x21')](_0x37c3('0x22'),_0x23e0bb+'-'+_0x7fa8b5+'/'+_0x587925)[_0x37c3('0x1b')](_0x9d1086);}return null;};}function patchUpdates(_0x5bc139){return function(_0x52cb9a){try{jsonpatch[_0x37c3('0x23')](_0x52cb9a,_0x5bc139,!![]);}catch(_0xfca85c){return BPromise['reject'](_0xfca85c);}return _0x52cb9a[_0x37c3('0x24')]();};}function saveUpdates(_0xc71071,_0x61fd02){return function(_0xbe5180){if(_0xbe5180){return _0xbe5180[_0x37c3('0x25')](_0xc71071)[_0x37c3('0x26')](function(_0xff1b30){return _0xff1b30;});}return null;};}function removeEntity(_0x344fc9,_0x5a3053){return function(_0x28a0b0){if(_0x28a0b0){return _0x28a0b0[_0x37c3('0x27')]()[_0x37c3('0x26')](function(){_0x344fc9[_0x37c3('0x20')](0xcc)[_0x37c3('0x28')]();});}};}function handleEntityNotFound(_0x424e7e,_0x2a7919){return function(_0x533b98){if(!_0x533b98){_0x424e7e[_0x37c3('0x1a')](0x194);}return _0x533b98;};}function handleError(_0x3d65ca,_0xf8a58b){_0xf8a58b=_0xf8a58b||0x1f4;return function(_0x4e7eda){logger[_0x37c3('0x29')](_0x4e7eda[_0x37c3('0x2a')]);if(_0x4e7eda[_0x37c3('0x2b')]){delete _0x4e7eda['name'];}_0x3d65ca[_0x37c3('0x20')](_0xf8a58b)['send'](_0x4e7eda);};}exports[_0x37c3('0x2c')]=function(_0x55975c,_0x4306f5){var _0x42b705={},_0xf38f48={},_0x295e58={'count':0x0,'rows':[]};var _0x1994dd=_[_0x37c3('0x2d')](db[_0x37c3('0x2e')][_0x37c3('0x2f')],function(_0x4a866c){return{'name':_0x4a866c['fieldName'],'type':_0x4a866c[_0x37c3('0x30')][_0x37c3('0x31')]};});_0xf38f48[_0x37c3('0x32')]=_[_0x37c3('0x2d')](_0x1994dd,_0x37c3('0x2b'));_0xf38f48[_0x37c3('0x33')]=_[_0x37c3('0x34')](_0x55975c['query']);_0xf38f48[_0x37c3('0x35')]=_[_0x37c3('0x36')](_0xf38f48[_0x37c3('0x32')],_0xf38f48[_0x37c3('0x33')]);_0x42b705['attributes']=_['intersection'](_0xf38f48['model'],qs['fields'](_0x55975c['query'][_0x37c3('0x37')]));_0x42b705[_0x37c3('0x38')]=_0x42b705[_0x37c3('0x38')]['length']?_0x42b705[_0x37c3('0x38')]:_0xf38f48[_0x37c3('0x32')];if(!_0x55975c[_0x37c3('0x33')][_0x37c3('0x39')](_0x37c3('0x3a'))){_0x42b705['limit']=qs[_0x37c3('0x1f')](_0x55975c[_0x37c3('0x33')][_0x37c3('0x1f')]);_0x42b705[_0x37c3('0x1c')]=qs[_0x37c3('0x1c')](_0x55975c[_0x37c3('0x33')][_0x37c3('0x1c')]);}_0x42b705[_0x37c3('0x3b')]=qs[_0x37c3('0x3c')](_0x55975c['query'][_0x37c3('0x3c')]);_0x42b705[_0x37c3('0x3d')]=qs['filters'](_['pick'](_0x55975c[_0x37c3('0x33')],_0xf38f48[_0x37c3('0x35')]),_0x1994dd);if(_0x55975c[_0x37c3('0x33')][_0x37c3('0x3e')]){_0x42b705['where']=_[_0x37c3('0x3f')](_0x42b705[_0x37c3('0x3d')],{'$or':_['map'](_0x1994dd,function(_0x51f878){if(_0x51f878[_0x37c3('0x30')]!==_0x37c3('0x40')){var _0x510674={};_0x510674[_0x51f878['name']]={'$like':'%'+_0x55975c[_0x37c3('0x33')][_0x37c3('0x3e')]+'%'};return _0x510674;}})});}_0x42b705=_[_0x37c3('0x3f')]({},_0x42b705,_0x55975c[_0x37c3('0x41')]);var _0x559a2b={'where':_0x42b705[_0x37c3('0x3d')]};return db['UserProfileSection'][_0x37c3('0x1e')](_0x559a2b)[_0x37c3('0x26')](function(_0x7e89fc){_0x295e58[_0x37c3('0x1e')]=_0x7e89fc;if(_0x55975c['query']['includeAll']){_0x42b705[_0x37c3('0x42')]=[{'all':!![]}];}return db[_0x37c3('0x2e')][_0x37c3('0x43')](_0x42b705);})[_0x37c3('0x26')](function(_0xc8364){_0x295e58[_0x37c3('0x44')]=_0xc8364;return _0x295e58;})[_0x37c3('0x26')](respondWithFilteredResult(_0x4306f5,_0x42b705))['catch'](handleError(_0x4306f5,null));};exports[_0x37c3('0x45')]=function(_0x3ab428,_0x57daa1){var _0x4b1ede={'raw':![],'where':{'id':_0x3ab428['params']['id']}},_0x1b7d1a={};_0x1b7d1a[_0x37c3('0x32')]=_[_0x37c3('0x34')](db[_0x37c3('0x2e')][_0x37c3('0x2f')]);_0x1b7d1a[_0x37c3('0x33')]=_[_0x37c3('0x34')](_0x3ab428[_0x37c3('0x33')]);_0x1b7d1a[_0x37c3('0x35')]=_[_0x37c3('0x36')](_0x1b7d1a['model'],_0x1b7d1a[_0x37c3('0x33')]);_0x4b1ede[_0x37c3('0x38')]=_[_0x37c3('0x36')](_0x1b7d1a['model'],qs['fields'](_0x3ab428['query'][_0x37c3('0x37')]));_0x4b1ede[_0x37c3('0x38')]=_0x4b1ede[_0x37c3('0x38')]['length']?_0x4b1ede[_0x37c3('0x38')]:_0x1b7d1a[_0x37c3('0x32')];if(_0x3ab428['query'][_0x37c3('0x46')]){_0x4b1ede[_0x37c3('0x42')]=[{'all':!![]}];}_0x4b1ede=_[_0x37c3('0x3f')]({},_0x4b1ede,_0x3ab428['options']);return db[_0x37c3('0x2e')]['find'](_0x4b1ede)[_0x37c3('0x26')](handleEntityNotFound(_0x57daa1,null))['then'](respondWithResult(_0x57daa1,null))[_0x37c3('0x47')](handleError(_0x57daa1,null));};exports[_0x37c3('0x48')]=function(_0x4d51d3,_0x19640d){return db[_0x37c3('0x2e')]['create'](_0x4d51d3[_0x37c3('0x49')],{})[_0x37c3('0x26')](respondWithResult(_0x19640d,0xc9))[_0x37c3('0x47')](handleError(_0x19640d,null));};exports[_0x37c3('0x25')]=function(_0x571695,_0x51be15){if(_0x571695['body']['id']){delete _0x571695[_0x37c3('0x49')]['id'];}return db[_0x37c3('0x2e')]['find']({'where':{'id':_0x571695['params']['id']}})[_0x37c3('0x26')](handleEntityNotFound(_0x51be15,null))[_0x37c3('0x26')](saveUpdates(_0x571695['body'],null))[_0x37c3('0x26')](respondWithResult(_0x51be15,null))['catch'](handleError(_0x51be15,null));};exports[_0x37c3('0x27')]=function(_0xa70f8c,_0x29ff35){return db[_0x37c3('0x2e')][_0x37c3('0x4a')]({'where':{'id':_0xa70f8c[_0x37c3('0x4b')]['id']}})[_0x37c3('0x26')](handleEntityNotFound(_0x29ff35,null))[_0x37c3('0x26')](removeEntity(_0x29ff35,null))[_0x37c3('0x47')](handleError(_0x29ff35,null));};exports[_0x37c3('0x4c')]=function(_0x2f025f,_0x13a742){return db['UserProfileSection'][_0x37c3('0x4c')]()['then'](respondWithResult(_0x13a742,null))['catch'](handleError(_0x13a742,null));}; \ No newline at end of file +var _0xf8a9=['options','then','includeAll','include','findAll','catch','params','fields','find','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','ejs','fs-extra','lodash','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','destroy','sendStatus','error','name','send','map','UserProfileSection','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','length','order','where','filter','VIRTUAL','merge'];(function(_0x25b6b5,_0x50744f){var _0x82b1ef=function(_0x32d0da){while(--_0x32d0da){_0x25b6b5['push'](_0x25b6b5['shift']());}};_0x82b1ef(++_0x50744f);}(_0xf8a9,0x169));var _0x9f8a=function(_0x10e485,_0x4ee577){_0x10e485=_0x10e485-0x0;var _0x540f38=_0xf8a9[_0x10e485];return _0x540f38;};'use strict';var emlformat=require(_0x9f8a('0x0'));var rimraf=require(_0x9f8a('0x1'));var zipdir=require(_0x9f8a('0x2'));var jsonpatch=require(_0x9f8a('0x3'));var rp=require('request-promise');var moment=require(_0x9f8a('0x4'));var BPromise=require(_0x9f8a('0x5'));var Mustache=require('mustache');var util=require(_0x9f8a('0x6'));var path=require(_0x9f8a('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x9f8a('0x8'));var fs=require('fs');var fs_extra=require(_0x9f8a('0x9'));var _=require(_0x9f8a('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x9f8a('0xb'));var deskjs=require(_0x9f8a('0xc'));var toCsv=require(_0x9f8a('0xd'));var querystring=require(_0x9f8a('0xe'));var Papa=require('papaparse');var Redis=require(_0x9f8a('0xf'));var authService=require(_0x9f8a('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9f8a('0x11'));var logger=require(_0x9f8a('0x12'))(_0x9f8a('0x13'));var utils=require(_0x9f8a('0x14'));var config=require(_0x9f8a('0x15'));var licenseUtil=require(_0x9f8a('0x16'));var db=require(_0x9f8a('0x17'))['db'];function respondWithStatusCode(_0x46b230,_0x4ec0a2){_0x4ec0a2=_0x4ec0a2||0xcc;return function(_0x5cfaa6){if(_0x5cfaa6){return _0x46b230['sendStatus'](_0x4ec0a2);}return _0x46b230[_0x9f8a('0x18')](_0x4ec0a2)[_0x9f8a('0x19')]();};}function respondWithResult(_0x568fee,_0x7fa3ba){_0x7fa3ba=_0x7fa3ba||0xc8;return function(_0x92ebc){if(_0x92ebc){return _0x568fee[_0x9f8a('0x18')](_0x7fa3ba)[_0x9f8a('0x1a')](_0x92ebc);}};}function respondWithFilteredResult(_0x13c31e,_0x254b96){return function(_0xf59bd6){if(_0xf59bd6){var _0x2b0be0=typeof _0x254b96[_0x9f8a('0x1b')]===_0x9f8a('0x1c')&&typeof _0x254b96[_0x9f8a('0x1d')]===_0x9f8a('0x1c');var _0x40ded8=_0xf59bd6[_0x9f8a('0x1e')];var _0x27e08a=_0x2b0be0?0x0:_0x254b96[_0x9f8a('0x1b')];var _0x8dab6c=_0x2b0be0?_0xf59bd6['count']:_0x254b96[_0x9f8a('0x1b')]+_0x254b96[_0x9f8a('0x1d')];var _0x7cbbf0;if(_0x8dab6c>=_0x40ded8){_0x8dab6c=_0x40ded8;_0x7cbbf0=0xc8;}else{_0x7cbbf0=0xce;}_0x13c31e[_0x9f8a('0x18')](_0x7cbbf0);return _0x13c31e[_0x9f8a('0x1f')]('Content-Range',_0x27e08a+'-'+_0x8dab6c+'/'+_0x40ded8)[_0x9f8a('0x1a')](_0xf59bd6);}return null;};}function patchUpdates(_0x391158){return function(_0x410a99){try{jsonpatch[_0x9f8a('0x20')](_0x410a99,_0x391158,!![]);}catch(_0x2b1247){return BPromise[_0x9f8a('0x21')](_0x2b1247);}return _0x410a99[_0x9f8a('0x22')]();};}function saveUpdates(_0x2c51d6,_0x3445f8){return function(_0x20a083){if(_0x20a083){return _0x20a083[_0x9f8a('0x23')](_0x2c51d6)['then'](function(_0x1cdee7){return _0x1cdee7;});}return null;};}function removeEntity(_0x435b68,_0x1d92dd){return function(_0x120ae7){if(_0x120ae7){return _0x120ae7[_0x9f8a('0x24')]()['then'](function(){_0x435b68[_0x9f8a('0x18')](0xcc)[_0x9f8a('0x19')]();});}};}function handleEntityNotFound(_0x4f798f,_0x4e4746){return function(_0xb961b){if(!_0xb961b){_0x4f798f[_0x9f8a('0x25')](0x194);}return _0xb961b;};}function handleError(_0x2dfd35,_0x34b57f){_0x34b57f=_0x34b57f||0x1f4;return function(_0x1f44ca){logger[_0x9f8a('0x26')](_0x1f44ca['stack']);if(_0x1f44ca[_0x9f8a('0x27')]){delete _0x1f44ca[_0x9f8a('0x27')];}_0x2dfd35[_0x9f8a('0x18')](_0x34b57f)[_0x9f8a('0x28')](_0x1f44ca);};}exports['index']=function(_0x661ebf,_0x530a34){var _0x496185={},_0x2deeee={},_0x594baa={'count':0x0,'rows':[]};var _0x13438a=_[_0x9f8a('0x29')](db[_0x9f8a('0x2a')][_0x9f8a('0x2b')],function(_0xebed9){return{'name':_0xebed9[_0x9f8a('0x2c')],'type':_0xebed9[_0x9f8a('0x2d')][_0x9f8a('0x2e')]};});_0x2deeee[_0x9f8a('0x2f')]=_['map'](_0x13438a,_0x9f8a('0x27'));_0x2deeee['query']=_[_0x9f8a('0x30')](_0x661ebf[_0x9f8a('0x31')]);_0x2deeee[_0x9f8a('0x32')]=_[_0x9f8a('0x33')](_0x2deeee[_0x9f8a('0x2f')],_0x2deeee[_0x9f8a('0x31')]);_0x496185[_0x9f8a('0x34')]=_[_0x9f8a('0x33')](_0x2deeee['model'],qs['fields'](_0x661ebf[_0x9f8a('0x31')]['fields']));_0x496185[_0x9f8a('0x34')]=_0x496185[_0x9f8a('0x34')][_0x9f8a('0x35')]?_0x496185[_0x9f8a('0x34')]:_0x2deeee[_0x9f8a('0x2f')];if(!_0x661ebf[_0x9f8a('0x31')]['hasOwnProperty']('nolimit')){_0x496185[_0x9f8a('0x1d')]=qs[_0x9f8a('0x1d')](_0x661ebf[_0x9f8a('0x31')][_0x9f8a('0x1d')]);_0x496185[_0x9f8a('0x1b')]=qs[_0x9f8a('0x1b')](_0x661ebf[_0x9f8a('0x31')][_0x9f8a('0x1b')]);}_0x496185[_0x9f8a('0x36')]=qs['sort'](_0x661ebf['query']['sort']);_0x496185[_0x9f8a('0x37')]=qs[_0x9f8a('0x32')](_['pick'](_0x661ebf[_0x9f8a('0x31')],_0x2deeee[_0x9f8a('0x32')]),_0x13438a);if(_0x661ebf['query'][_0x9f8a('0x38')]){_0x496185[_0x9f8a('0x37')]=_['merge'](_0x496185[_0x9f8a('0x37')],{'$or':_['map'](_0x13438a,function(_0x122b9f){if(_0x122b9f[_0x9f8a('0x2d')]!==_0x9f8a('0x39')){var _0x2c9806={};_0x2c9806[_0x122b9f['name']]={'$like':'%'+_0x661ebf[_0x9f8a('0x31')][_0x9f8a('0x38')]+'%'};return _0x2c9806;}})});}_0x496185=_[_0x9f8a('0x3a')]({},_0x496185,_0x661ebf[_0x9f8a('0x3b')]);var _0x4a42a5={'where':_0x496185[_0x9f8a('0x37')]};return db[_0x9f8a('0x2a')][_0x9f8a('0x1e')](_0x4a42a5)[_0x9f8a('0x3c')](function(_0x5780ad){_0x594baa[_0x9f8a('0x1e')]=_0x5780ad;if(_0x661ebf[_0x9f8a('0x31')][_0x9f8a('0x3d')]){_0x496185[_0x9f8a('0x3e')]=[{'all':!![]}];}return db['UserProfileSection'][_0x9f8a('0x3f')](_0x496185);})[_0x9f8a('0x3c')](function(_0x51af3b){_0x594baa['rows']=_0x51af3b;return _0x594baa;})['then'](respondWithFilteredResult(_0x530a34,_0x496185))[_0x9f8a('0x40')](handleError(_0x530a34,null));};exports['show']=function(_0xb70fe3,_0x4bdb8a){var _0x17fda9={'raw':![],'where':{'id':_0xb70fe3[_0x9f8a('0x41')]['id']}},_0x48bc83={};_0x48bc83['model']=_[_0x9f8a('0x30')](db[_0x9f8a('0x2a')][_0x9f8a('0x2b')]);_0x48bc83['query']=_['keys'](_0xb70fe3[_0x9f8a('0x31')]);_0x48bc83[_0x9f8a('0x32')]=_[_0x9f8a('0x33')](_0x48bc83[_0x9f8a('0x2f')],_0x48bc83[_0x9f8a('0x31')]);_0x17fda9[_0x9f8a('0x34')]=_['intersection'](_0x48bc83[_0x9f8a('0x2f')],qs['fields'](_0xb70fe3['query'][_0x9f8a('0x42')]));_0x17fda9[_0x9f8a('0x34')]=_0x17fda9['attributes']['length']?_0x17fda9['attributes']:_0x48bc83[_0x9f8a('0x2f')];if(_0xb70fe3['query'][_0x9f8a('0x3d')]){_0x17fda9['include']=[{'all':!![]}];}_0x17fda9=_[_0x9f8a('0x3a')]({},_0x17fda9,_0xb70fe3['options']);return db[_0x9f8a('0x2a')][_0x9f8a('0x43')](_0x17fda9)[_0x9f8a('0x3c')](handleEntityNotFound(_0x4bdb8a,null))[_0x9f8a('0x3c')](respondWithResult(_0x4bdb8a,null))[_0x9f8a('0x40')](handleError(_0x4bdb8a,null));};exports['create']=function(_0x2db8f3,_0x3e211a){return db[_0x9f8a('0x2a')]['create'](_0x2db8f3[_0x9f8a('0x44')],{})['then'](respondWithResult(_0x3e211a,0xc9))[_0x9f8a('0x40')](handleError(_0x3e211a,null));};exports[_0x9f8a('0x23')]=function(_0x24f33f,_0x189687){if(_0x24f33f[_0x9f8a('0x44')]['id']){delete _0x24f33f[_0x9f8a('0x44')]['id'];}return db['UserProfileSection'][_0x9f8a('0x43')]({'where':{'id':_0x24f33f[_0x9f8a('0x41')]['id']}})[_0x9f8a('0x3c')](handleEntityNotFound(_0x189687,null))['then'](saveUpdates(_0x24f33f[_0x9f8a('0x44')],null))['then'](respondWithResult(_0x189687,null))['catch'](handleError(_0x189687,null));};exports[_0x9f8a('0x24')]=function(_0x516a1e,_0x1c8345){return db['UserProfileSection'][_0x9f8a('0x43')]({'where':{'id':_0x516a1e[_0x9f8a('0x41')]['id']}})[_0x9f8a('0x3c')](handleEntityNotFound(_0x1c8345,null))[_0x9f8a('0x3c')](removeEntity(_0x1c8345,null))[_0x9f8a('0x40')](handleError(_0x1c8345,null));};exports[_0x9f8a('0x45')]=function(_0x10fb05,_0xc5a67){return db[_0x9f8a('0x2a')][_0x9f8a('0x45')]()[_0x9f8a('0x3c')](respondWithResult(_0xc5a67,null))[_0x9f8a('0x40')](handleError(_0xc5a67,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index f8a7bd3..b29718e 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 _0x5dfc=['UserProfileSection','compositeIndex','sectionId','userProfileId','lodash','api','moment','bluebird','path','rimraf','./userProfileSection.attributes','exports','define'];(function(_0x51a945,_0x287210){var _0x42d523=function(_0x38efc8){while(--_0x38efc8){_0x51a945['push'](_0x51a945['shift']());}};_0x42d523(++_0x287210);}(_0x5dfc,0x1d8));var _0xc5df=function(_0x3bef2c,_0x5a86fd){_0x3bef2c=_0x3bef2c-0x0;var _0x331503=_0x5dfc[_0x3bef2c];return _0x331503;};'use strict';var _=require(_0xc5df('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xc5df('0x1'));var moment=require(_0xc5df('0x2'));var BPromise=require(_0xc5df('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc5df('0x4'));var rimraf=require(_0xc5df('0x5'));var config=require('../../config/environment');var attributes=require(_0xc5df('0x6'));module[_0xc5df('0x7')]=function(_0x33fe5e,_0x2d099d){return _0x33fe5e[_0xc5df('0x8')](_0xc5df('0x9'),attributes,{'tableName':'user_profile_has_sections','paranoid':![],'indexes':[{'name':_0xc5df('0xa'),'fields':[_0xc5df('0xb'),_0xc5df('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf325=['user_profile_has_sections','compositeIndex','sectionId','userProfileId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./userProfileSection.attributes','exports','UserProfileSection'];(function(_0x2b082e,_0x12aead){var _0x246043=function(_0x348ef5){while(--_0x348ef5){_0x2b082e['push'](_0x2b082e['shift']());}};_0x246043(++_0x12aead);}(_0xf325,0x164));var _0x5f32=function(_0x32f7d7,_0x54231b){_0x32f7d7=_0x32f7d7-0x0;var _0x133d09=_0xf325[_0x32f7d7];return _0x133d09;};'use strict';var _=require(_0x5f32('0x0'));var util=require(_0x5f32('0x1'));var logger=require(_0x5f32('0x2'))(_0x5f32('0x3'));var moment=require(_0x5f32('0x4'));var BPromise=require(_0x5f32('0x5'));var rp=require(_0x5f32('0x6'));var fs=require('fs');var path=require(_0x5f32('0x7'));var rimraf=require(_0x5f32('0x8'));var config=require('../../config/environment');var attributes=require(_0x5f32('0x9'));module[_0x5f32('0xa')]=function(_0x27988e,_0x43b861){return _0x27988e['define'](_0x5f32('0xb'),attributes,{'tableName':_0x5f32('0xc'),'paranoid':![],'indexes':[{'name':_0x5f32('0xd'),'fields':[_0x5f32('0xe'),_0x5f32('0xf')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.rpc.js b/server/api/userProfileSection/userProfileSection.rpc.js index a33ef83..8200422 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 _0x9e07=['error','code','message','UserProfileSection,\x20%s,\x20%s','request\x20sent','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','info','debug','UserProfileSection,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x353abb,_0x194c80){var _0x43c9c5=function(_0x456b74){while(--_0x456b74){_0x353abb['push'](_0x353abb['shift']());}};_0x43c9c5(++_0x194c80);}(_0x9e07,0x1cf));var _0x79e0=function(_0x2d1369,_0x45e78a){_0x2d1369=_0x2d1369-0x0;var _0x3ba6e6=_0x9e07[_0x2d1369];return _0x3ba6e6;};'use strict';var _=require(_0x79e0('0x0'));var util=require(_0x79e0('0x1'));var moment=require('moment');var BPromise=require(_0x79e0('0x2'));var rs=require(_0x79e0('0x3'));var fs=require('fs');var Redis=require(_0x79e0('0x4'));var db=require(_0x79e0('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x79e0('0x6'))(_0x79e0('0x7'));var config=require(_0x79e0('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x79e0('0x9')][_0x79e0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x49d6d5,_0x1fd7cf,_0x581934){return new BPromise(function(_0x445b8c,_0x6b7585){return client[_0x79e0('0xb')](_0x49d6d5,_0x581934)[_0x79e0('0xc')](function(_0x58a0bd){logger[_0x79e0('0xd')]('UserProfileSection,\x20%s,\x20%s',_0x1fd7cf,'request\x20sent');logger[_0x79e0('0xe')](_0x79e0('0xf'),_0x1fd7cf,'request\x20sent',JSON[_0x79e0('0x10')](_0x58a0bd));if(_0x58a0bd[_0x79e0('0x11')]){if(_0x58a0bd[_0x79e0('0x11')][_0x79e0('0x12')]===0x1f4){logger['error']('UserProfileSection,\x20%s,\x20%s',_0x1fd7cf,_0x58a0bd[_0x79e0('0x11')]['message']);return _0x6b7585(_0x58a0bd[_0x79e0('0x11')][_0x79e0('0x13')]);}logger[_0x79e0('0x11')](_0x79e0('0x14'),_0x1fd7cf,_0x58a0bd[_0x79e0('0x11')][_0x79e0('0x13')]);return _0x445b8c(_0x58a0bd[_0x79e0('0x11')]['message']);}else{logger[_0x79e0('0xd')](_0x79e0('0x14'),_0x1fd7cf,_0x79e0('0x15'));_0x445b8c(_0x58a0bd[_0x79e0('0x16')][_0x79e0('0x13')]);}})[_0x79e0('0x17')](function(_0x43685c){logger[_0x79e0('0x11')](_0x79e0('0x14'),_0x1fd7cf,_0x43685c);_0x6b7585(_0x43685c);});});} \ No newline at end of file +var _0x54be=['info','catch','lodash','util','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','UserProfileSection,\x20%s,\x20%s','request\x20sent','debug','UserProfileSection,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x16551f,_0x19b73b){var _0xd0df68=function(_0x4741a7){while(--_0x4741a7){_0x16551f['push'](_0x16551f['shift']());}};_0xd0df68(++_0x19b73b);}(_0x54be,0x1ba));var _0xe54b=function(_0x3eb8df,_0x3b967f){_0x3eb8df=_0x3eb8df-0x0;var _0x4de9c5=_0x54be[_0x3eb8df];return _0x4de9c5;};'use strict';var _=require(_0xe54b('0x0'));var util=require(_0xe54b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe54b('0x2'));var db=require(_0xe54b('0x3'))['db'];var utils=require(_0xe54b('0x4'));var logger=require(_0xe54b('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0xe54b('0x6'));var client=jayson[_0xe54b('0x7')][_0xe54b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5072f6,_0x395a38,_0x534b75){return new BPromise(function(_0x3e7dcf,_0x4938e0){return client[_0xe54b('0x9')](_0x5072f6,_0x534b75)[_0xe54b('0xa')](function(_0x3e2696){logger['info'](_0xe54b('0xb'),_0x395a38,_0xe54b('0xc'));logger[_0xe54b('0xd')](_0xe54b('0xe'),_0x395a38,_0xe54b('0xc'),JSON[_0xe54b('0xf')](_0x3e2696));if(_0x3e2696['error']){if(_0x3e2696[_0xe54b('0x10')]['code']===0x1f4){logger[_0xe54b('0x10')]('UserProfileSection,\x20%s,\x20%s',_0x395a38,_0x3e2696[_0xe54b('0x10')][_0xe54b('0x11')]);return _0x4938e0(_0x3e2696['error'][_0xe54b('0x11')]);}logger[_0xe54b('0x10')](_0xe54b('0xb'),_0x395a38,_0x3e2696['error'][_0xe54b('0x11')]);return _0x3e7dcf(_0x3e2696[_0xe54b('0x10')][_0xe54b('0x11')]);}else{logger[_0xe54b('0x12')](_0xe54b('0xb'),_0x395a38,_0xe54b('0xc'));_0x3e7dcf(_0x3e2696['result'][_0xe54b('0x11')]);}})[_0xe54b('0x13')](function(_0x56189e){logger[_0xe54b('0x10')](_0xe54b('0xb'),_0x395a38,_0x56189e);_0x4938e0(_0x56189e);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index c733039..dbc3590 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 _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x3690f8,_0x27f95b){var _0xd97dea=function(_0x4273f3){while(--_0x4273f3){_0x3690f8['push'](_0x3690f8['shift']());}};_0xd97dea(++_0x27f95b);}(_0xedd9,0xfc));var _0x9edd=function(_0x59aedf,_0x1e5baa){_0x59aedf=_0x59aedf-0x0;var _0x465a37=_0xedd9[_0x59aedf];return _0x465a37;};'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 _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x55b68b,_0x1c3dad){var _0x46fceb=function(_0x3cddbc){while(--_0x3cddbc){_0x55b68b['push'](_0x55b68b['shift']());}};_0x46fceb(++_0x1c3dad);}(_0x70e0,0x17b));var _0x070e=function(_0x423b0f,_0x5298b5){_0x423b0f=_0x423b0f-0x0;var _0x1945cd=_0x70e0[_0x423b0f];return _0x1945cd;};'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/userSmsQueue/userSmsQueue.attributes.js b/server/api/userSmsQueue/userSmsQueue.attributes.js index cab85db..d123940 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 _0x84cc=['sequelize','INTEGER'];(function(_0x24f019,_0x50189c){var _0x436cf1=function(_0x2dc7c2){while(--_0x2dc7c2){_0x24f019['push'](_0x24f019['shift']());}};_0x436cf1(++_0x50189c);}(_0x84cc,0x1c6));var _0xc84c=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x84cc[_0x3b380d];return _0x54502b;};'use strict';var Sequelize=require(_0xc84c('0x0'));module['exports']={'penalty':{'type':Sequelize[_0xc84c('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xaac4=['sequelize','exports','INTEGER'];(function(_0x2e7a5d,_0x16d072){var _0x1e8c25=function(_0x4ff798){while(--_0x4ff798){_0x2e7a5d['push'](_0x2e7a5d['shift']());}};_0x1e8c25(++_0x16d072);}(_0xaac4,0x72));var _0x4aac=function(_0x7b341f,_0x11e481){_0x7b341f=_0x7b341f-0x0;var _0x46d0a1=_0xaac4[_0x7b341f];return _0x46d0a1;};'use strict';var Sequelize=require(_0x4aac('0x0'));module[_0x4aac('0x1')]={'penalty':{'type':Sequelize[_0x4aac('0x2')],'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 f1a3455..1d2bd8e 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 _0xc6ac=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userSmsQueue.attributes','exports','UserSmsQueue','user_has_sms_queues','lodash','util','../../config/logger'];(function(_0x368fb9,_0x1a9895){var _0x4892fb=function(_0x28d735){while(--_0x28d735){_0x368fb9['push'](_0x368fb9['shift']());}};_0x4892fb(++_0x1a9895);}(_0xc6ac,0x15b));var _0xcc6a=function(_0x5bcdee,_0x416727){_0x5bcdee=_0x5bcdee-0x0;var _0x1e85a4=_0xc6ac[_0x5bcdee];return _0x1e85a4;};'use strict';var _=require(_0xcc6a('0x0'));var util=require(_0xcc6a('0x1'));var logger=require(_0xcc6a('0x2'))(_0xcc6a('0x3'));var moment=require(_0xcc6a('0x4'));var BPromise=require(_0xcc6a('0x5'));var rp=require(_0xcc6a('0x6'));var fs=require('fs');var path=require(_0xcc6a('0x7'));var rimraf=require(_0xcc6a('0x8'));var config=require(_0xcc6a('0x9'));var attributes=require(_0xcc6a('0xa'));module[_0xcc6a('0xb')]=function(_0x12330e,_0x197bd7){return _0x12330e['define'](_0xcc6a('0xc'),attributes,{'tableName':_0xcc6a('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd8fb=['lodash','util','../../config/logger','api','path','rimraf','./userSmsQueue.attributes','exports','UserSmsQueue'];(function(_0x4f62a8,_0x28e774){var _0x5b7315=function(_0x4d2953){while(--_0x4d2953){_0x4f62a8['push'](_0x4f62a8['shift']());}};_0x5b7315(++_0x28e774);}(_0xd8fb,0x99));var _0xbd8f=function(_0x1d5fbd,_0x38bbf0){_0x1d5fbd=_0x1d5fbd-0x0;var _0x3be8b5=_0xd8fb[_0x1d5fbd];return _0x3be8b5;};'use strict';var _=require(_0xbd8f('0x0'));var util=require(_0xbd8f('0x1'));var logger=require(_0xbd8f('0x2'))(_0xbd8f('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xbd8f('0x4'));var rimraf=require(_0xbd8f('0x5'));var config=require('../../config/environment');var attributes=require(_0xbd8f('0x6'));module[_0xbd8f('0x7')]=function(_0x5543b2,_0x33d541){return _0x5543b2['define'](_0xbd8f('0x8'),attributes,{'tableName':'user_has_sms_queues','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 33509a5..44a91ad 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 _0x9495=['then','info','UserSmsQueue,\x20%s,\x20%s','request\x20sent','UserSmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','http','request'];(function(_0x2de0eb,_0x286a1e){var _0x54458b=function(_0x363953){while(--_0x363953){_0x2de0eb['push'](_0x2de0eb['shift']());}};_0x54458b(++_0x286a1e);}(_0x9495,0x186));var _0x5949=function(_0x3fe2be,_0x24cfba){_0x3fe2be=_0x3fe2be-0x0;var _0x16b3ca=_0x9495[_0x3fe2be];return _0x16b3ca;};'use strict';var _=require(_0x5949('0x0'));var util=require('util');var moment=require(_0x5949('0x1'));var BPromise=require(_0x5949('0x2'));var rs=require(_0x5949('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5949('0x4'))['db'];var utils=require(_0x5949('0x5'));var logger=require('../../config/logger')(_0x5949('0x6'));var config=require('../../config/environment');var jayson=require(_0x5949('0x7'));var client=jayson['client'][_0x5949('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x38562a,_0x2c99a4,_0x435225){return new BPromise(function(_0x349c44,_0x382920){return client[_0x5949('0x9')](_0x38562a,_0x435225)[_0x5949('0xa')](function(_0x2eab20){logger[_0x5949('0xb')](_0x5949('0xc'),_0x2c99a4,_0x5949('0xd'));logger['debug'](_0x5949('0xe'),_0x2c99a4,_0x5949('0xd'),JSON[_0x5949('0xf')](_0x2eab20));if(_0x2eab20[_0x5949('0x10')]){if(_0x2eab20['error']['code']===0x1f4){logger[_0x5949('0x10')](_0x5949('0xc'),_0x2c99a4,_0x2eab20['error'][_0x5949('0x11')]);return _0x382920(_0x2eab20[_0x5949('0x10')][_0x5949('0x11')]);}logger[_0x5949('0x10')]('UserSmsQueue,\x20%s,\x20%s',_0x2c99a4,_0x2eab20[_0x5949('0x10')][_0x5949('0x11')]);return _0x349c44(_0x2eab20['error']['message']);}else{logger[_0x5949('0xb')](_0x5949('0xc'),_0x2c99a4,_0x5949('0xd'));_0x349c44(_0x2eab20[_0x5949('0x12')][_0x5949('0x11')]);}})[_0x5949('0x13')](function(_0x2318f0){logger['error'](_0x5949('0xc'),_0x2c99a4,_0x2318f0);_0x382920(_0x2318f0);});});} \ No newline at end of file +var _0xabf5=['UserSmsQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','UserSmsQueue,\x20%s,\x20%s','request\x20sent','debug'];(function(_0xb2e35d,_0xce8450){var _0xf8748a=function(_0x2d7de7){while(--_0x2d7de7){_0xb2e35d['push'](_0xb2e35d['shift']());}};_0xf8748a(++_0xce8450);}(_0xabf5,0x1d2));var _0x5abf=function(_0x15497f,_0x15ecb3){_0x15497f=_0x15497f-0x0;var _0x3dff4e=_0xabf5[_0x15497f];return _0x3dff4e;};'use strict';var _=require(_0x5abf('0x0'));var util=require(_0x5abf('0x1'));var moment=require(_0x5abf('0x2'));var BPromise=require(_0x5abf('0x3'));var rs=require(_0x5abf('0x4'));var fs=require('fs');var Redis=require(_0x5abf('0x5'));var db=require(_0x5abf('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x5abf('0x7'))('rpc');var config=require(_0x5abf('0x8'));var jayson=require(_0x5abf('0x9'));var client=jayson['client'][_0x5abf('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xc7fa01,_0x146e9c,_0x18ef38){return new BPromise(function(_0x26850f,_0x3e95a6){return client[_0x5abf('0xb')](_0xc7fa01,_0x18ef38)[_0x5abf('0xc')](function(_0x2720ed){logger[_0x5abf('0xd')](_0x5abf('0xe'),_0x146e9c,_0x5abf('0xf'));logger[_0x5abf('0x10')](_0x5abf('0x11'),_0x146e9c,_0x5abf('0xf'),JSON['stringify'](_0x2720ed));if(_0x2720ed[_0x5abf('0x12')]){if(_0x2720ed[_0x5abf('0x12')][_0x5abf('0x13')]===0x1f4){logger['error'](_0x5abf('0xe'),_0x146e9c,_0x2720ed[_0x5abf('0x12')][_0x5abf('0x14')]);return _0x3e95a6(_0x2720ed['error'][_0x5abf('0x14')]);}logger[_0x5abf('0x12')](_0x5abf('0xe'),_0x146e9c,_0x2720ed[_0x5abf('0x12')]['message']);return _0x26850f(_0x2720ed[_0x5abf('0x12')][_0x5abf('0x14')]);}else{logger['info'](_0x5abf('0xe'),_0x146e9c,'request\x20sent');_0x26850f(_0x2720ed[_0x5abf('0x15')]['message']);}})[_0x5abf('0x16')](function(_0x6cdabb){logger['error'](_0x5abf('0xe'),_0x146e9c,_0x6cdabb);_0x3e95a6(_0x6cdabb);});});} \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.attributes.js b/server/api/userVoicePrefix/userVoicePrefix.attributes.js index 2502256..7bb80e0 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 _0x2cee=['INTEGER','sequelize','exports'];(function(_0x263f4c,_0x438626){var _0x3a78d3=function(_0xbdb00f){while(--_0xbdb00f){_0x263f4c['push'](_0x263f4c['shift']());}};_0x3a78d3(++_0x438626);}(_0x2cee,0x6d));var _0xe2ce=function(_0x4811c0,_0x125228){_0x4811c0=_0x4811c0-0x0;var _0x5ddf51=_0x2cee[_0x4811c0];return _0x5ddf51;};'use strict';var Sequelize=require(_0xe2ce('0x0'));module[_0xe2ce('0x1')]={'UserId':{'type':Sequelize[_0xe2ce('0x2')]},'VoicePrefixId':{'type':Sequelize[_0xe2ce('0x2')]}}; \ No newline at end of file +var _0xf686=['INTEGER','exports'];(function(_0x3f56af,_0x2fb687){var _0x21ef73=function(_0x5203e3){while(--_0x5203e3){_0x3f56af['push'](_0x3f56af['shift']());}};_0x21ef73(++_0x2fb687);}(_0xf686,0x1e9));var _0x6f68=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xf686[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require('sequelize');module[_0x6f68('0x0')]={'UserId':{'type':Sequelize['INTEGER']},'VoicePrefixId':{'type':Sequelize[_0x6f68('0x1')]}}; \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.model.js b/server/api/userVoicePrefix/userVoicePrefix.model.js index 4c9f9f9..ee745ec 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(_0x223512,_0x1a0d90){var _0x1f3684=function(_0x55627e){while(--_0x55627e){_0x223512['push'](_0x223512['shift']());}};_0x1f3684(++_0x1a0d90);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2160a9,_0x3cbd9e){_0x2160a9=_0x2160a9-0x0;var _0xa88cf7=_0xa9e0[_0x2160a9];return _0xa88cf7;};'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(_0x2bcdd2,_0x3e732f){var _0x476f23=function(_0x1250f8){while(--_0x1250f8){_0x2bcdd2['push'](_0x2bcdd2['shift']());}};_0x476f23(++_0x3e732f);}(_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 7f3a1e2..71b01fb 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(_0x2fdc81,_0x3dbe8e){var _0x4bd8f7=function(_0x594709){while(--_0x594709){_0x2fdc81['push'](_0x2fdc81['shift']());}};_0x4bd8f7(++_0x3dbe8e);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file +var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x2f2388,_0x4ea55c){var _0x451e17=function(_0x3a81e0){while(--_0x3a81e0){_0x2f2388['push'](_0x2f2388['shift']());}};_0x451e17(++_0x4ea55c);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.attributes.js b/server/api/userVoiceQueue/userVoiceQueue.attributes.js index b231353..f606d84 100644 --- a/server/api/userVoiceQueue/userVoiceQueue.attributes.js +++ b/server/api/userVoiceQueue/userVoiceQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4584=['INTEGER','exports'];(function(_0x2e661e,_0x4e45fb){var _0x3349de=function(_0x340510){while(--_0x340510){_0x2e661e['push'](_0x2e661e['shift']());}};_0x3349de(++_0x4e45fb);}(_0x4584,0x18b));var _0x4458=function(_0x38642c,_0x45a9b6){_0x38642c=_0x38642c-0x0;var _0x1d7856=_0x4584[_0x38642c];return _0x1d7856;};'use strict';var Sequelize=require('sequelize');module[_0x4458('0x0')]={'penalty':{'type':Sequelize[_0x4458('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xc22d=['INTEGER','exports'];(function(_0x5e88a9,_0x2104ce){var _0x232b1f=function(_0x27af90){while(--_0x27af90){_0x5e88a9['push'](_0x5e88a9['shift']());}};_0x232b1f(++_0x2104ce);}(_0xc22d,0x151));var _0xdc22=function(_0x51129c,_0x41591a){_0x51129c=_0x51129c-0x0;var _0x58cac4=_0xc22d[_0x51129c];return _0x58cac4;};'use strict';var Sequelize=require('sequelize');module[_0xdc22('0x0')]={'penalty':{'type':Sequelize[_0xdc22('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.model.js b/server/api/userVoiceQueue/userVoiceQueue.model.js index 3520cd5..9665594 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 _0xb93b=['define','UserVoiceQueue','user_has_voice_queues','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x13e34c,_0xc1ab89){var _0x4191da=function(_0x197952){while(--_0x197952){_0x13e34c['push'](_0x13e34c['shift']());}};_0x4191da(++_0xc1ab89);}(_0xb93b,0x147));var _0xbb93=function(_0x285b48,_0x41b4c6){_0x285b48=_0x285b48-0x0;var _0x5020e9=_0xb93b[_0x285b48];return _0x5020e9;};'use strict';var _=require('lodash');var util=require(_0xbb93('0x0'));var logger=require(_0xbb93('0x1'))(_0xbb93('0x2'));var moment=require(_0xbb93('0x3'));var BPromise=require('bluebird');var rp=require(_0xbb93('0x4'));var fs=require('fs');var path=require(_0xbb93('0x5'));var rimraf=require(_0xbb93('0x6'));var config=require(_0xbb93('0x7'));var attributes=require('./userVoiceQueue.attributes');module[_0xbb93('0x8')]=function(_0x367ba0,_0x9ac840){return _0x367ba0[_0xbb93('0x9')](_0xbb93('0xa'),attributes,{'tableName':_0xbb93('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xab3c=['api','moment','request-promise','../../config/environment','exports','define','UserVoiceQueue','lodash','util','../../config/logger'];(function(_0x4a8cbb,_0x40177c){var _0x36b5b1=function(_0x436ef1){while(--_0x436ef1){_0x4a8cbb['push'](_0x4a8cbb['shift']());}};_0x36b5b1(++_0x40177c);}(_0xab3c,0x6b));var _0xcab3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xab3c[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xcab3('0x0'));var util=require(_0xcab3('0x1'));var logger=require(_0xcab3('0x2'))(_0xcab3('0x3'));var moment=require(_0xcab3('0x4'));var BPromise=require('bluebird');var rp=require(_0xcab3('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xcab3('0x6'));var attributes=require('./userVoiceQueue.attributes');module[_0xcab3('0x7')]=function(_0x20d0ae,_0x1854c4){return _0x20d0ae[_0xcab3('0x8')](_0xcab3('0x9'),attributes,{'tableName':'user_has_voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.rpc.js b/server/api/userVoiceQueue/userVoiceQueue.rpc.js index 39e3b62..5066d07 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 _0xdaae=['UserVoiceQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','info','UserVoiceQueue,\x20%s,\x20%s','debug'];(function(_0x515e2c,_0x5d9e61){var _0xadc630=function(_0x8486e9){while(--_0x8486e9){_0x515e2c['push'](_0x515e2c['shift']());}};_0xadc630(++_0x5d9e61);}(_0xdaae,0x110));var _0xedaa=function(_0x5a9fb9,_0xb126c4){_0x5a9fb9=_0x5a9fb9-0x0;var _0x110430=_0xdaae[_0x5a9fb9];return _0x110430;};'use strict';var _=require(_0xedaa('0x0'));var util=require(_0xedaa('0x1'));var moment=require(_0xedaa('0x2'));var BPromise=require(_0xedaa('0x3'));var rs=require(_0xedaa('0x4'));var fs=require('fs');var Redis=require(_0xedaa('0x5'));var db=require(_0xedaa('0x6'))['db'];var utils=require(_0xedaa('0x7'));var logger=require('../../config/logger')(_0xedaa('0x8'));var config=require(_0xedaa('0x9'));var jayson=require(_0xedaa('0xa'));var client=jayson[_0xedaa('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x36b5e3,_0x1cafc7,_0x52d373){return new BPromise(function(_0x5a8aa9,_0x3ef8b0){return client[_0xedaa('0xc')](_0x36b5e3,_0x52d373)['then'](function(_0x4b7358){logger[_0xedaa('0xd')](_0xedaa('0xe'),_0x1cafc7,'request\x20sent');logger[_0xedaa('0xf')](_0xedaa('0x10'),_0x1cafc7,_0xedaa('0x11'),JSON[_0xedaa('0x12')](_0x4b7358));if(_0x4b7358[_0xedaa('0x13')]){if(_0x4b7358[_0xedaa('0x13')][_0xedaa('0x14')]===0x1f4){logger[_0xedaa('0x13')]('UserVoiceQueue,\x20%s,\x20%s',_0x1cafc7,_0x4b7358[_0xedaa('0x13')][_0xedaa('0x15')]);return _0x3ef8b0(_0x4b7358[_0xedaa('0x13')][_0xedaa('0x15')]);}logger['error'](_0xedaa('0xe'),_0x1cafc7,_0x4b7358['error'][_0xedaa('0x15')]);return _0x5a8aa9(_0x4b7358[_0xedaa('0x13')]['message']);}else{logger[_0xedaa('0xd')](_0xedaa('0xe'),_0x1cafc7,_0xedaa('0x11'));_0x5a8aa9(_0x4b7358[_0xedaa('0x16')][_0xedaa('0x15')]);}})[_0xedaa('0x17')](function(_0x4a3174){logger[_0xedaa('0x13')](_0xedaa('0xe'),_0x1cafc7,_0x4a3174);_0x3ef8b0(_0x4a3174);});});} \ No newline at end of file +var _0xef8c=['http','request','then','info','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x4b452b,_0x38556b){var _0x2c1f6f=function(_0x4e0560){while(--_0x4e0560){_0x4b452b['push'](_0x4b452b['shift']());}};_0x2c1f6f(++_0x38556b);}(_0xef8c,0xdb));var _0xcef8=function(_0x39187b,_0x2a6214){_0x39187b=_0x39187b-0x0;var _0x2cf25f=_0xef8c[_0x39187b];return _0x2cf25f;};'use strict';var _=require(_0xcef8('0x0'));var util=require('util');var moment=require(_0xcef8('0x1'));var BPromise=require(_0xcef8('0x2'));var rs=require(_0xcef8('0x3'));var fs=require('fs');var Redis=require(_0xcef8('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xcef8('0x5'));var logger=require(_0xcef8('0x6'))(_0xcef8('0x7'));var config=require(_0xcef8('0x8'));var jayson=require(_0xcef8('0x9'));var client=jayson[_0xcef8('0xa')][_0xcef8('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x17a585,_0x2e2d1d,_0x5853c7){return new BPromise(function(_0x126286,_0x128712){return client[_0xcef8('0xc')](_0x17a585,_0x5853c7)[_0xcef8('0xd')](function(_0x5a793b){logger[_0xcef8('0xe')](_0xcef8('0xf'),_0x2e2d1d,_0xcef8('0x10'));logger[_0xcef8('0x11')](_0xcef8('0x12'),_0x2e2d1d,_0xcef8('0x10'),JSON['stringify'](_0x5a793b));if(_0x5a793b[_0xcef8('0x13')]){if(_0x5a793b[_0xcef8('0x13')]['code']===0x1f4){logger[_0xcef8('0x13')](_0xcef8('0xf'),_0x2e2d1d,_0x5a793b[_0xcef8('0x13')][_0xcef8('0x14')]);return _0x128712(_0x5a793b[_0xcef8('0x13')][_0xcef8('0x14')]);}logger[_0xcef8('0x13')](_0xcef8('0xf'),_0x2e2d1d,_0x5a793b[_0xcef8('0x13')]['message']);return _0x126286(_0x5a793b[_0xcef8('0x13')][_0xcef8('0x14')]);}else{logger['info'](_0xcef8('0xf'),_0x2e2d1d,_0xcef8('0x10'));_0x126286(_0x5a793b[_0xcef8('0x15')][_0xcef8('0x14')]);}})[_0xcef8('0x16')](function(_0x3a4eed){logger['error'](_0xcef8('0xf'),_0x2e2d1d,_0x3a4eed);_0x128712(_0x3a4eed);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index 99f48e8..c04af3a 100644 --- a/server/api/userVoiceQueueRt/index.js +++ b/server/api/userVoiceQueueRt/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x2d1451,_0x5c5cf9){var _0x231908=function(_0xe7955d){while(--_0xe7955d){_0x2d1451['push'](_0x2d1451['shift']());}};_0x231908(++_0x5c5cf9);}(_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 +var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x1b2465,_0x22e4a9){var _0x4aa387=function(_0x534863){while(--_0x534863){_0x1b2465['push'](_0x1b2465['shift']());}};_0x4aa387(++_0x22e4a9);}(_0xcb91,0x1a9));var _0x1cb9=function(_0xbf8ebe,_0x3b69a5){_0xbf8ebe=_0xbf8ebe-0x0;var _0x1e25e8=_0xcb91[_0xbf8ebe];return _0x1e25e8;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js index 2dd41c4..edb3111 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 _0x864a=['sequelize','INTEGER','Required\x20by\x20Asterisk','STRING','queue_interface'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x864a,0x172));var _0xa864=function(_0x146a9c,_0x350c07){_0x146a9c=_0x146a9c-0x0;var _0x1943a0=_0x864a[_0x146a9c];return _0x1943a0;};'use strict';var Sequelize=require(_0xa864('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xa864('0x1')],'primaryKey':!![],'autoIncrement':!![],'comment':_0xa864('0x2')},'membername':{'type':Sequelize[_0xa864('0x3')],'allowNull':![],'comment':_0xa864('0x2')},'UserId':{'type':Sequelize[_0xa864('0x1')],'allowNull':![]},'queue_name':{'type':Sequelize[_0xa864('0x3')],'allowNull':![],'unique':_0xa864('0x4'),'comment':_0xa864('0x2')},'VoiceQueueId':{'type':Sequelize[_0xa864('0x1')],'allowNull':![]},'interface':{'type':Sequelize[_0xa864('0x3')],'allowNull':![],'unique':_0xa864('0x4'),'comment':_0xa864('0x2')},'penalty':{'type':Sequelize[_0xa864('0x1')](0xb),'defaultValue':0x0,'comment':_0xa864('0x2')},'paused':{'type':Sequelize[_0xa864('0x1')](0xb),'defaultValue':0x0,'comment':_0xa864('0x2')}}; \ No newline at end of file +var _0x05d9=['Required\x20by\x20Asterisk','STRING','queue_interface','sequelize','INTEGER'];(function(_0x557d81,_0x2a6677){var _0x13fb9c=function(_0x421b67){while(--_0x421b67){_0x557d81['push'](_0x557d81['shift']());}};_0x13fb9c(++_0x2a6677);}(_0x05d9,0xb2));var _0x905d=function(_0x4a84c8,_0x3d1627){_0x4a84c8=_0x4a84c8-0x0;var _0x23e210=_0x05d9[_0x4a84c8];return _0x23e210;};'use strict';var Sequelize=require(_0x905d('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x905d('0x1')],'primaryKey':!![],'autoIncrement':!![],'comment':_0x905d('0x2')},'membername':{'type':Sequelize['STRING'],'allowNull':![],'comment':_0x905d('0x2')},'UserId':{'type':Sequelize[_0x905d('0x1')],'allowNull':![]},'queue_name':{'type':Sequelize[_0x905d('0x3')],'allowNull':![],'unique':_0x905d('0x4'),'comment':_0x905d('0x2')},'VoiceQueueId':{'type':Sequelize[_0x905d('0x1')],'allowNull':![]},'interface':{'type':Sequelize[_0x905d('0x3')],'allowNull':![],'unique':_0x905d('0x4'),'comment':_0x905d('0x2')},'penalty':{'type':Sequelize[_0x905d('0x1')](0xb),'defaultValue':0x0,'comment':_0x905d('0x2')},'paused':{'type':Sequelize[_0x905d('0x1')](0xb),'defaultValue':0x0,'comment':_0x905d('0x2')}}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js index 8a54eb1..ccc00fa 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 _0xcb5c=['../../mysqldb','UserVoiceQueueRt','setMaxListeners','save','emit','hasOwnProperty','hook','exports','events'];(function(_0x5d293d,_0x5a6e7e){var _0x10386b=function(_0x7c3e25){while(--_0x7c3e25){_0x5d293d['push'](_0x5d293d['shift']());}};_0x10386b(++_0x5a6e7e);}(_0xcb5c,0x182));var _0xccb5=function(_0x187769,_0x59385d){_0x187769=_0x187769-0x0;var _0x46da28=_0xcb5c[_0x187769];return _0x46da28;};'use strict';var EventEmitter=require(_0xccb5('0x0'));var UserVoiceQueueRt=require(_0xccb5('0x1'))['db'][_0xccb5('0x2')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0xccb5('0x3')](0x0);var events={'afterCreate':_0xccb5('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x9ffd38){return function(_0x120ce6,_0xb3afcf,_0x1f6615){UserVoiceQueueRtEvents[_0xccb5('0x5')](_0x9ffd38+':'+_0x120ce6['id'],_0x120ce6);UserVoiceQueueRtEvents[_0xccb5('0x5')](_0x9ffd38,_0x120ce6);_0x1f6615(null);};}for(var e in events){if(events[_0xccb5('0x6')](e)){var event=events[e];UserVoiceQueueRt[_0xccb5('0x7')](e,emitEvent(event));}}module[_0xccb5('0x8')]=UserVoiceQueueRtEvents; \ No newline at end of file +var _0x9efd=['setMaxListeners','update','remove','emit','hasOwnProperty','exports','events','UserVoiceQueueRt'];(function(_0x487b0c,_0x14ff74){var _0x1adbdc=function(_0x2e7b9d){while(--_0x2e7b9d){_0x487b0c['push'](_0x487b0c['shift']());}};_0x1adbdc(++_0x14ff74);}(_0x9efd,0x1c6));var _0xd9ef=function(_0x428499,_0x5a7cf9){_0x428499=_0x428499-0x0;var _0x604083=_0x9efd[_0x428499];return _0x604083;};'use strict';var EventEmitter=require(_0xd9ef('0x0'));var UserVoiceQueueRt=require('../../mysqldb')['db'][_0xd9ef('0x1')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0xd9ef('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xd9ef('0x3'),'afterDestroy':_0xd9ef('0x4')};function emitEvent(_0x4fc2a8){return function(_0xaaf64a,_0x367730,_0x302947){UserVoiceQueueRtEvents[_0xd9ef('0x5')](_0x4fc2a8+':'+_0xaaf64a['id'],_0xaaf64a);UserVoiceQueueRtEvents[_0xd9ef('0x5')](_0x4fc2a8,_0xaaf64a);_0x302947(null);};}for(var e in events){if(events[_0xd9ef('0x6')](e)){var event=events[e];UserVoiceQueueRt['hook'](e,emitEvent(event));}}module[_0xd9ef('0x7')]=UserVoiceQueueRtEvents; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js index 227c9b9..030d8d7 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 _0xd3e4=['rimraf','../../config/environment','./userVoiceQueueRt.attributes','define','UserVoiceQueueRt','user_has_voice_queues_rt','lodash','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x48cbfc,_0x1d067f){var _0x392a9d=function(_0x1dcfce){while(--_0x1dcfce){_0x48cbfc['push'](_0x48cbfc['shift']());}};_0x392a9d(++_0x1d067f);}(_0xd3e4,0x1e6));var _0x4d3e=function(_0x4e4529,_0x33f07b){_0x4e4529=_0x4e4529-0x0;var _0x100460=_0xd3e4[_0x4e4529];return _0x100460;};'use strict';var _=require(_0x4d3e('0x0'));var util=require('util');var logger=require(_0x4d3e('0x1'))('api');var moment=require(_0x4d3e('0x2'));var BPromise=require(_0x4d3e('0x3'));var rp=require(_0x4d3e('0x4'));var fs=require('fs');var path=require(_0x4d3e('0x5'));var rimraf=require(_0x4d3e('0x6'));var config=require(_0x4d3e('0x7'));var attributes=require(_0x4d3e('0x8'));module['exports']=function(_0xade955,_0xa91da5){return _0xade955[_0x4d3e('0x9')](_0x4d3e('0xa'),attributes,{'tableName':_0x4d3e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3ea7=['../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./userVoiceQueueRt.attributes','exports','define','UserVoiceQueueRt','lodash','util'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x3ea7,0x1de));var _0x73ea=function(_0x390a19,_0x5dd137){_0x390a19=_0x390a19-0x0;var _0x5d8230=_0x3ea7[_0x390a19];return _0x5d8230;};'use strict';var _=require(_0x73ea('0x0'));var util=require(_0x73ea('0x1'));var logger=require(_0x73ea('0x2'))(_0x73ea('0x3'));var moment=require(_0x73ea('0x4'));var BPromise=require('bluebird');var rp=require(_0x73ea('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x73ea('0x6'));var config=require(_0x73ea('0x7'));var attributes=require(_0x73ea('0x8'));module[_0x73ea('0x9')]=function(_0x3c76e1,_0x4bc16e){return _0x3c76e1[_0x73ea('0xa')](_0x73ea('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 a021235..0211a85 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 _0x8df8=['options','where','sequelize','COUNT','literal','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','defaults','localhost','./userVoiceQueueRt.socket','register','then','info','UserVoiceQueueRt,\x20%s,\x20%s','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','catch','GetVoiceQueueRtPauses','UserVoiceQueueRt','findAll'];(function(_0x12fe24,_0x4061cd){var _0x309501=function(_0x2c91d8){while(--_0x2c91d8){_0x12fe24['push'](_0x12fe24['shift']());}};_0x309501(++_0x4061cd);}(_0x8df8,0x1ef));var _0x88df=function(_0x4b216b,_0xa2909c){_0x4b216b=_0x4b216b-0x0;var _0x375163=_0x8df8[_0x4b216b];return _0x375163;};'use strict';var _=require(_0x88df('0x0'));var util=require(_0x88df('0x1'));var moment=require(_0x88df('0x2'));var BPromise=require('bluebird');var rs=require(_0x88df('0x3'));var fs=require('fs');var Redis=require(_0x88df('0x4'));var db=require(_0x88df('0x5'))['db'];var utils=require(_0x88df('0x6'));var logger=require(_0x88df('0x7'))(_0x88df('0x8'));var config=require(_0x88df('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x88df('0xa')][_0x88df('0xb')]({'port':0x232a});config['redis']=_[_0x88df('0xc')](config['redis'],{'host':_0x88df('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x88df('0xe'))[_0x88df('0xf')](socket);function respondWithRpcPromise(_0x205d0e,_0x1f21ba,_0x3e480c){return new BPromise(function(_0x47319e,_0x502eb8){return client['request'](_0x205d0e,_0x3e480c)[_0x88df('0x10')](function(_0x95acfc){logger[_0x88df('0x11')](_0x88df('0x12'),_0x1f21ba,'request\x20sent');logger[_0x88df('0x13')](_0x88df('0x14'),_0x1f21ba,'request\x20sent',JSON[_0x88df('0x15')](_0x95acfc));if(_0x95acfc[_0x88df('0x16')]){if(_0x95acfc['error'][_0x88df('0x17')]===0x1f4){logger[_0x88df('0x16')](_0x88df('0x12'),_0x1f21ba,_0x95acfc[_0x88df('0x16')][_0x88df('0x18')]);return _0x502eb8(_0x95acfc[_0x88df('0x16')][_0x88df('0x18')]);}logger[_0x88df('0x16')](_0x88df('0x12'),_0x1f21ba,_0x95acfc['error']['message']);return _0x47319e(_0x95acfc[_0x88df('0x16')][_0x88df('0x18')]);}else{logger['info'](_0x88df('0x12'),_0x1f21ba,_0x88df('0x19'));_0x47319e(_0x95acfc['result'][_0x88df('0x18')]);}})[_0x88df('0x1a')](function(_0x4d62a1){logger[_0x88df('0x16')](_0x88df('0x12'),_0x1f21ba,_0x4d62a1);_0x502eb8(_0x4d62a1);});});}exports[_0x88df('0x1b')]=function(_0x148ae4){var _0x471d7f=this;return new Promise(function(_0x28a4a6,_0x53018f){return db[_0x88df('0x1c')][_0x88df('0x1d')]({'raw':_0x148ae4[_0x88df('0x1e')]?_0x148ae4[_0x88df('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x148ae4[_0x88df('0x1e')]?_0x148ae4['options'][_0x88df('0x1f')]||null:null,'attributes':[[db[_0x88df('0x20')]['fn'](_0x88df('0x21'),db['sequelize']['fn']('IF',db[_0x88df('0x20')][_0x88df('0x22')]('`paused`\x20=\x201,\x201,\x20null'))),'outboundQueuePauses']]})[_0x88df('0x10')](function(_0x43a2ba){logger[_0x88df('0x11')]('GetVoiceQueueRtPauses',_0x148ae4);logger[_0x88df('0x13')](_0x88df('0x1b'),_0x148ae4,JSON['stringify'](_0x43a2ba));_0x28a4a6(_0x43a2ba);})[_0x88df('0x1a')](function(_0x258348){logger[_0x88df('0x16')](_0x88df('0x1b'),_0x258348[_0x88df('0x18')],_0x148ae4);_0x53018f(_0x471d7f[_0x88df('0x16')](0x1f4,_0x258348[_0x88df('0x18')]));});});}; \ No newline at end of file +var _0xaae6=['error','code','message','info','result','catch','GetVoiceQueueRtPauses','UserVoiceQueueRt','findAll','options','raw','where','COUNT','sequelize','outboundQueuePauses','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./userVoiceQueueRt.socket','register','request','then','UserVoiceQueueRt,\x20%s,\x20%s','debug','request\x20sent','stringify'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xaae6,0x84));var _0x6aae=function(_0x362566,_0x381629){_0x362566=_0x362566-0x0;var _0x55edfa=_0xaae6[_0x362566];return _0x55edfa;};'use strict';var _=require(_0x6aae('0x0'));var util=require(_0x6aae('0x1'));var moment=require(_0x6aae('0x2'));var BPromise=require(_0x6aae('0x3'));var rs=require(_0x6aae('0x4'));var fs=require('fs');var Redis=require(_0x6aae('0x5'));var db=require(_0x6aae('0x6'))['db'];var utils=require(_0x6aae('0x7'));var logger=require(_0x6aae('0x8'))(_0x6aae('0x9'));var config=require('../../config/environment');var jayson=require(_0x6aae('0xa'));var client=jayson['client'][_0x6aae('0xb')]({'port':0x232a});config[_0x6aae('0xc')]=_[_0x6aae('0xd')](config[_0x6aae('0xc')],{'host':_0x6aae('0xe'),'port':0x18eb});var socket=require(_0x6aae('0xf'))(new Redis(config[_0x6aae('0xc')]));require(_0x6aae('0x10'))[_0x6aae('0x11')](socket);function respondWithRpcPromise(_0x2c449b,_0x162e02,_0x3e4181){return new BPromise(function(_0x4764bf,_0x4eddc0){return client[_0x6aae('0x12')](_0x2c449b,_0x3e4181)[_0x6aae('0x13')](function(_0x160cc7){logger['info'](_0x6aae('0x14'),_0x162e02,'request\x20sent');logger[_0x6aae('0x15')]('UserVoiceQueueRt,\x20%s,\x20%s,\x20%s',_0x162e02,_0x6aae('0x16'),JSON[_0x6aae('0x17')](_0x160cc7));if(_0x160cc7[_0x6aae('0x18')]){if(_0x160cc7['error'][_0x6aae('0x19')]===0x1f4){logger[_0x6aae('0x18')](_0x6aae('0x14'),_0x162e02,_0x160cc7['error'][_0x6aae('0x1a')]);return _0x4eddc0(_0x160cc7[_0x6aae('0x18')]['message']);}logger[_0x6aae('0x18')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x162e02,_0x160cc7[_0x6aae('0x18')][_0x6aae('0x1a')]);return _0x4764bf(_0x160cc7[_0x6aae('0x18')][_0x6aae('0x1a')]);}else{logger[_0x6aae('0x1b')](_0x6aae('0x14'),_0x162e02,_0x6aae('0x16'));_0x4764bf(_0x160cc7[_0x6aae('0x1c')][_0x6aae('0x1a')]);}})[_0x6aae('0x1d')](function(_0x2b8b55){logger[_0x6aae('0x18')](_0x6aae('0x14'),_0x162e02,_0x2b8b55);_0x4eddc0(_0x2b8b55);});});}exports[_0x6aae('0x1e')]=function(_0x486e6e){var _0x779a0a=this;return new Promise(function(_0x153943,_0x4fa7d0){return db[_0x6aae('0x1f')][_0x6aae('0x20')]({'raw':_0x486e6e[_0x6aae('0x21')]?_0x486e6e[_0x6aae('0x21')][_0x6aae('0x22')]===undefined?!![]:![]:!![],'where':_0x486e6e[_0x6aae('0x21')]?_0x486e6e[_0x6aae('0x21')][_0x6aae('0x23')]||null:null,'attributes':[[db['sequelize']['fn'](_0x6aae('0x24'),db[_0x6aae('0x25')]['fn']('IF',db[_0x6aae('0x25')]['literal']('`paused`\x20=\x201,\x201,\x20null'))),_0x6aae('0x26')]]})[_0x6aae('0x13')](function(_0x8fa9aa){logger[_0x6aae('0x1b')]('GetVoiceQueueRtPauses',_0x486e6e);logger[_0x6aae('0x15')](_0x6aae('0x1e'),_0x486e6e,JSON[_0x6aae('0x17')](_0x8fa9aa));_0x153943(_0x8fa9aa);})[_0x6aae('0x1d')](function(_0x295784){logger['error']('GetVoiceQueueRtPauses',_0x295784[_0x6aae('0x1a')],_0x486e6e);_0x4fa7d0(_0x779a0a[_0x6aae('0x18')](0x1f4,_0x295784['message']));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index 2371401..49105ce 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 _0x5c1f=['emit','register','length','./userVoiceQueueRt.events','remove','update'];(function(_0x211a02,_0x3b5362){var _0x13d91c=function(_0x559b49){while(--_0x559b49){_0x211a02['push'](_0x211a02['shift']());}};_0x13d91c(++_0x3b5362);}(_0x5c1f,0x1b3));var _0xf5c1=function(_0x247fa1,_0x4ec37c){_0x247fa1=_0x247fa1-0x0;var _0x244f35=_0x5c1f[_0x247fa1];return _0x244f35;};'use strict';var UserVoiceQueueRtEvents=require(_0xf5c1('0x0'));var events=['save',_0xf5c1('0x1'),_0xf5c1('0x2')];function createListener(_0x5dc804,_0x245264){return function(_0xcc7e35){_0x245264[_0xf5c1('0x3')](_0x5dc804,_0xcc7e35);};}function removeListener(_0x51ea7a,_0x5c0515){return function(){UserVoiceQueueRtEvents['removeListener'](_0x51ea7a,_0x5c0515);};}exports[_0xf5c1('0x4')]=function(_0x3a7475){for(var _0x52e4cb=0x0,_0x34a073=events[_0xf5c1('0x5')];_0x52e4cb<_0x34a073;_0x52e4cb++){var _0x12128b=events[_0x52e4cb];var _0x40cad7=createListener('userVoiceQueueRt:'+_0x12128b,_0x3a7475);UserVoiceQueueRtEvents['on'](_0x12128b,_0x40cad7);}}; \ No newline at end of file +var _0x49df=['emit','removeListener','register','length','userVoiceQueueRt:','remove','update'];(function(_0x1d1fa6,_0x331dc0){var _0x5e1a83=function(_0x526ece){while(--_0x526ece){_0x1d1fa6['push'](_0x1d1fa6['shift']());}};_0x5e1a83(++_0x331dc0);}(_0x49df,0xad));var _0xf49d=function(_0x22fc16,_0x53cf38){_0x22fc16=_0x22fc16-0x0;var _0x24e7b3=_0x49df[_0x22fc16];return _0x24e7b3;};'use strict';var UserVoiceQueueRtEvents=require('./userVoiceQueueRt.events');var events=['save',_0xf49d('0x0'),_0xf49d('0x1')];function createListener(_0x4e297,_0x21eb98){return function(_0x3d07cf){_0x21eb98[_0xf49d('0x2')](_0x4e297,_0x3d07cf);};}function removeListener(_0x44b37e,_0x59cb9d){return function(){UserVoiceQueueRtEvents[_0xf49d('0x3')](_0x44b37e,_0x59cb9d);};}exports[_0xf49d('0x4')]=function(_0x325c19){for(var _0xca1090=0x0,_0x1aaf37=events[_0xf49d('0x5')];_0xca1090<_0x1aaf37;_0xca1090++){var _0x4e8b5e=events[_0xca1090];var _0xadfde5=createListener(_0xf49d('0x6')+_0x4e8b5e,_0x325c19);UserVoiceQueueRtEvents['on'](_0x4e8b5e,_0xadfde5);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index 941a883..1ad8bc7 100644 --- a/server/api/userWhatsappQueue/index.js +++ b/server/api/userWhatsappQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x47d060,_0x4a2b1d){var _0xb2d051=function(_0x3434e7){while(--_0x3434e7){_0x47d060['push'](_0x47d060['shift']());}};_0xb2d051(++_0x4a2b1d);}(_0x9c44,0x178));var _0x49c4=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0x9c44[_0x53ccf2];return _0x5a2964;};'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 _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x5b91d9,_0x2d1e3a){var _0x232963=function(_0x27ebf5){while(--_0x27ebf5){_0x5b91d9['push'](_0x5b91d9['shift']());}};_0x232963(++_0x2d1e3a);}(_0xedd9,0xfc));var _0x9edd=function(_0x53b4c,_0x255bf6){_0x53b4c=_0x53b4c-0x0;var _0x223533=_0xedd9[_0x53b4c];return _0x223533;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');module[_0x9edd('0x8')]=router; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js index fb8f2d6..d4a4ce0 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 _0x2c43=['sequelize','exports'];(function(_0x1f9a44,_0x572d0f){var _0xed2749=function(_0x39546e){while(--_0x39546e){_0x1f9a44['push'](_0x1f9a44['shift']());}};_0xed2749(++_0x572d0f);}(_0x2c43,0x128));var _0x32c4=function(_0x2350d7,_0x5ee5d1){_0x2350d7=_0x2350d7-0x0;var _0xe0be2f=_0x2c43[_0x2350d7];return _0xe0be2f;};'use strict';var Sequelize=require(_0x32c4('0x0'));module[_0x32c4('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x737e=['INTEGER','exports'];(function(_0x10dc9b,_0x173b34){var _0x1f767e=function(_0x51fe8c){while(--_0x51fe8c){_0x10dc9b['push'](_0x10dc9b['shift']());}};_0x1f767e(++_0x173b34);}(_0x737e,0xb9));var _0xe737=function(_0xb8901a,_0x36bada){_0xb8901a=_0xb8901a-0x0;var _0x4bc168=_0x737e[_0xb8901a];return _0x4bc168;};'use strict';var Sequelize=require('sequelize');module[_0xe737('0x0')]={'penalty':{'type':Sequelize[_0xe737('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.model.js b/server/api/userWhatsappQueue/userWhatsappQueue.model.js index 368c8ba..e8307f5 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 _0xc1e6=['exports','define','UserWhatsappQueue','user_has_whatsapp_queues','util','api','request-promise','rimraf','../../config/environment','./userWhatsappQueue.attributes'];(function(_0x1967b8,_0x2ce618){var _0xeacbb7=function(_0x4e5c73){while(--_0x4e5c73){_0x1967b8['push'](_0x1967b8['shift']());}};_0xeacbb7(++_0x2ce618);}(_0xc1e6,0xe0));var _0x6c1e=function(_0x1c19b6,_0xddf7cc){_0x1c19b6=_0x1c19b6-0x0;var _0x59d560=_0xc1e6[_0x1c19b6];return _0x59d560;};'use strict';var _=require('lodash');var util=require(_0x6c1e('0x0'));var logger=require('../../config/logger')(_0x6c1e('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x6c1e('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6c1e('0x3'));var config=require(_0x6c1e('0x4'));var attributes=require(_0x6c1e('0x5'));module[_0x6c1e('0x6')]=function(_0x1aa07c,_0x3550c4){return _0x1aa07c[_0x6c1e('0x7')](_0x6c1e('0x8'),attributes,{'tableName':_0x6c1e('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1026=['../../config/logger','moment','path','./userWhatsappQueue.attributes','define','lodash','util'];(function(_0x3597ce,_0x53f918){var _0x3d258b=function(_0x123d18){while(--_0x123d18){_0x3597ce['push'](_0x3597ce['shift']());}};_0x3d258b(++_0x53f918);}(_0x1026,0x14e));var _0x6102=function(_0x11ba46,_0x1d6752){_0x11ba46=_0x11ba46-0x0;var _0x1c8c6f=_0x1026[_0x11ba46];return _0x1c8c6f;};'use strict';var _=require(_0x6102('0x0'));var util=require(_0x6102('0x1'));var logger=require(_0x6102('0x2'))('api');var moment=require(_0x6102('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x6102('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x6102('0x5'));module['exports']=function(_0x478b18,_0x3f29cd){return _0x478b18[_0x6102('0x6')]('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 4b1d34f..0d964af 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 _0x4288=['moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','error','code','message','lodash'];(function(_0x161212,_0x38dd6f){var _0x368b24=function(_0x5da9f7){while(--_0x5da9f7){_0x161212['push'](_0x161212['shift']());}};_0x368b24(++_0x38dd6f);}(_0x4288,0x1e2));var _0x8428=function(_0x5b2219,_0x30fae9){_0x5b2219=_0x5b2219-0x0;var _0x6a4978=_0x4288[_0x5b2219];return _0x6a4978;};'use strict';var _=require(_0x8428('0x0'));var util=require('util');var moment=require(_0x8428('0x1'));var BPromise=require('bluebird');var rs=require(_0x8428('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8428('0x3'))['db'];var utils=require(_0x8428('0x4'));var logger=require(_0x8428('0x5'))(_0x8428('0x6'));var config=require(_0x8428('0x7'));var jayson=require(_0x8428('0x8'));var client=jayson[_0x8428('0x9')][_0x8428('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x27b566,_0x4291aa,_0x5b3cfd){return new BPromise(function(_0x51b04b,_0xac7ecb){return client[_0x8428('0xb')](_0x27b566,_0x5b3cfd)[_0x8428('0xc')](function(_0x5aef7b){logger[_0x8428('0xd')](_0x8428('0xe'),_0x4291aa,_0x8428('0xf'));logger[_0x8428('0x10')](_0x8428('0x11'),_0x4291aa,'request\x20sent',JSON['stringify'](_0x5aef7b));if(_0x5aef7b[_0x8428('0x12')]){if(_0x5aef7b[_0x8428('0x12')][_0x8428('0x13')]===0x1f4){logger['error'](_0x8428('0xe'),_0x4291aa,_0x5aef7b['error'][_0x8428('0x14')]);return _0xac7ecb(_0x5aef7b[_0x8428('0x12')][_0x8428('0x14')]);}logger[_0x8428('0x12')](_0x8428('0xe'),_0x4291aa,_0x5aef7b[_0x8428('0x12')]['message']);return _0x51b04b(_0x5aef7b[_0x8428('0x12')][_0x8428('0x14')]);}else{logger[_0x8428('0xd')]('UserWhatsappQueue,\x20%s,\x20%s',_0x4291aa,_0x8428('0xf'));_0x51b04b(_0x5aef7b['result']['message']);}})['catch'](function(_0x31796e){logger[_0x8428('0x12')](_0x8428('0xe'),_0x4291aa,_0x31796e);_0xac7ecb(_0x31796e);});});} \ No newline at end of file +var _0x6500=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','UserWhatsappQueue,\x20%s,\x20%s','debug','code','error','message','request\x20sent','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x4e4919,_0x56e6e8){var _0x521e71=function(_0x2e5407){while(--_0x2e5407){_0x4e4919['push'](_0x4e4919['shift']());}};_0x521e71(++_0x56e6e8);}(_0x6500,0x84));var _0x0650=function(_0x15b0d4,_0x5333b1){_0x15b0d4=_0x15b0d4-0x0;var _0x5d594e=_0x6500[_0x15b0d4];return _0x5d594e;};'use strict';var _=require(_0x0650('0x0'));var util=require('util');var moment=require(_0x0650('0x1'));var BPromise=require(_0x0650('0x2'));var rs=require(_0x0650('0x3'));var fs=require('fs');var Redis=require(_0x0650('0x4'));var db=require(_0x0650('0x5'))['db'];var utils=require(_0x0650('0x6'));var logger=require(_0x0650('0x7'))(_0x0650('0x8'));var config=require(_0x0650('0x9'));var jayson=require(_0x0650('0xa'));var client=jayson[_0x0650('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x594281,_0x5b9a48,_0x3bf3d1){return new BPromise(function(_0x37f670,_0x3aea0f){return client[_0x0650('0xc')](_0x594281,_0x3bf3d1)[_0x0650('0xd')](function(_0x55be48){logger[_0x0650('0xe')](_0x0650('0xf'),_0x5b9a48,'request\x20sent');logger[_0x0650('0x10')]('UserWhatsappQueue,\x20%s,\x20%s,\x20%s',_0x5b9a48,'request\x20sent',JSON['stringify'](_0x55be48));if(_0x55be48['error']){if(_0x55be48['error'][_0x0650('0x11')]===0x1f4){logger['error'](_0x0650('0xf'),_0x5b9a48,_0x55be48[_0x0650('0x12')][_0x0650('0x13')]);return _0x3aea0f(_0x55be48[_0x0650('0x12')][_0x0650('0x13')]);}logger[_0x0650('0x12')](_0x0650('0xf'),_0x5b9a48,_0x55be48[_0x0650('0x12')][_0x0650('0x13')]);return _0x37f670(_0x55be48[_0x0650('0x12')][_0x0650('0x13')]);}else{logger[_0x0650('0xe')]('UserWhatsappQueue,\x20%s,\x20%s',_0x5b9a48,_0x0650('0x14'));_0x37f670(_0x55be48[_0x0650('0x15')][_0x0650('0x13')]);}})[_0x0650('0x16')](function(_0x4e1136){logger['error'](_0x0650('0xf'),_0x5b9a48,_0x4e1136);_0x3aea0f(_0x4e1136);});});} \ No newline at end of file diff --git a/server/api/variable/index.js b/server/api/variable/index.js index 7f80d66..d39ea20 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 _0xc718=['post','put','update','delete','destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../config/environment','index','/:id','isAuthenticated','show'];(function(_0x3b9d5f,_0x2e9039){var _0x39924e=function(_0x5752ee){while(--_0x5752ee){_0x3b9d5f['push'](_0x3b9d5f['shift']());}};_0x39924e(++_0x2e9039);}(_0xc718,0xb6));var _0x8c71=function(_0x4df6bd,_0x30d543){_0x4df6bd=_0x4df6bd-0x0;var _0x322dcb=_0xc718[_0x4df6bd];return _0x322dcb;};'use strict';var multer=require(_0x8c71('0x0'));var util=require('util');var path=require(_0x8c71('0x1'));var timeout=require(_0x8c71('0x2'));var express=require('express');var router=express[_0x8c71('0x3')]();var fs_extra=require(_0x8c71('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x8c71('0x5'));var controller=require('./variable.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x8c71('0x6')]);router['get'](_0x8c71('0x7'),auth[_0x8c71('0x8')](),controller[_0x8c71('0x9')]);router[_0x8c71('0xa')]('/',auth[_0x8c71('0x8')](),controller['create']);router[_0x8c71('0xb')](_0x8c71('0x7'),auth[_0x8c71('0x8')](),controller[_0x8c71('0xc')]);router[_0x8c71('0xd')](_0x8c71('0x7'),auth[_0x8c71('0x8')](),controller[_0x8c71('0xe')]);module[_0x8c71('0xf')]=router; \ No newline at end of file +var _0x5b7f=['../../components/auth/service','../../components/interaction/service','../../config/environment','./variable.controller','get','isAuthenticated','index','/:id','show','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x513aa5,_0x1fba79){var _0x1a1a7c=function(_0x240e3f){while(--_0x240e3f){_0x513aa5['push'](_0x513aa5['shift']());}};_0x1a1a7c(++_0x1fba79);}(_0x5b7f,0x8c));var _0xf5b7=function(_0x1ac4bb,_0x1ab73a){_0x1ac4bb=_0x1ac4bb-0x0;var _0x348d0c=_0x5b7f[_0x1ac4bb];return _0x348d0c;};'use strict';var multer=require(_0xf5b7('0x0'));var util=require(_0xf5b7('0x1'));var path=require(_0xf5b7('0x2'));var timeout=require(_0xf5b7('0x3'));var express=require(_0xf5b7('0x4'));var router=express[_0xf5b7('0x5')]();var fs_extra=require(_0xf5b7('0x6'));var auth=require(_0xf5b7('0x7'));var interaction=require(_0xf5b7('0x8'));var config=require(_0xf5b7('0x9'));var controller=require(_0xf5b7('0xa'));router[_0xf5b7('0xb')]('/',auth[_0xf5b7('0xc')](),controller[_0xf5b7('0xd')]);router[_0xf5b7('0xb')](_0xf5b7('0xe'),auth[_0xf5b7('0xc')](),controller[_0xf5b7('0xf')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xf5b7('0x10')](_0xf5b7('0xe'),auth[_0xf5b7('0xc')](),controller[_0xf5b7('0x11')]);router[_0xf5b7('0x12')](_0xf5b7('0xe'),auth[_0xf5b7('0xc')](),controller[_0xf5b7('0x13')]);module[_0xf5b7('0x14')]=router; \ No newline at end of file diff --git a/server/api/variable/variable.attributes.js b/server/api/variable/variable.attributes.js index 61f3f5f..c4ac6e6 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 _0x5034=['sequelize','exports','STRING'];(function(_0x4e5af7,_0x373dca){var _0x8e6750=function(_0x3ec8d6){while(--_0x3ec8d6){_0x4e5af7['push'](_0x4e5af7['shift']());}};_0x8e6750(++_0x373dca);}(_0x5034,0x8d));var _0x4503=function(_0x4d9fae,_0x3bf732){_0x4d9fae=_0x4d9fae-0x0;var _0x17e846=_0x5034[_0x4d9fae];return _0x17e846;};'use strict';var Sequelize=require(_0x4503('0x0'));module[_0x4503('0x1')]={'name':{'type':Sequelize[_0x4503('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x4503('0x2')]}}; \ No newline at end of file +var _0x41a6=['STRING','name'];(function(_0x4d431e,_0x4b37c9){var _0x887d02=function(_0xe6b7b){while(--_0xe6b7b){_0x4d431e['push'](_0x4d431e['shift']());}};_0x887d02(++_0x4b37c9);}(_0x41a6,0x16b));var _0x641a=function(_0x77a42b,_0x25c9b3){_0x77a42b=_0x77a42b-0x0;var _0x8f2a8a=_0x41a6[_0x77a42b];return _0x8f2a8a;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x641a('0x0'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x641a('0x1')]}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index 98eb4fd..2366461 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 _0x4e9e=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','undefined','limit','count','offset','set','json','apply','then','get','Variables','UserProfileResource','stack','name','send','map','Variable','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','merge','filter','includeAll','include','findAll','rows','show','params','length','find','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','destroy','eml-format','rimraf','zip-dir','moment','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','papaparse','ioredis','../../components/auth/service'];(function(_0x18ab2a,_0x4debcd){var _0x16dcee=function(_0x10107a){while(--_0x10107a){_0x18ab2a['push'](_0x18ab2a['shift']());}};_0x16dcee(++_0x4debcd);}(_0x4e9e,0x132));var _0xe4e9=function(_0xf3c843,_0x8ff24e){_0xf3c843=_0xf3c843-0x0;var _0x3191c6=_0x4e9e[_0xf3c843];return _0x3191c6;};'use strict';var emlformat=require(_0xe4e9('0x0'));var rimraf=require(_0xe4e9('0x1'));var zipdir=require(_0xe4e9('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xe4e9('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xe4e9('0x4'));var util=require(_0xe4e9('0x5'));var path=require(_0xe4e9('0x6'));var sox=require(_0xe4e9('0x7'));var csv=require('to-csv');var ejs=require(_0xe4e9('0x8'));var fs=require('fs');var fs_extra=require(_0xe4e9('0x9'));var _=require(_0xe4e9('0xa'));var squel=require(_0xe4e9('0xb'));var crypto=require(_0xe4e9('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xe4e9('0xd'));var toCsv=require(_0xe4e9('0xe'));var querystring=require('querystring');var Papa=require(_0xe4e9('0xf'));var Redis=require(_0xe4e9('0x10'));var authService=require(_0xe4e9('0x11'));var qs=require(_0xe4e9('0x12'));var as=require(_0xe4e9('0x13'));var hardwareService=require(_0xe4e9('0x14'));var logger=require('../../config/logger')(_0xe4e9('0x15'));var utils=require(_0xe4e9('0x16'));var config=require(_0xe4e9('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xe4e9('0x18'))['db'];function respondWithStatusCode(_0x58fcca,_0x2b089b){_0x2b089b=_0x2b089b||0xcc;return function(_0x4e4dc4){if(_0x4e4dc4){return _0x58fcca[_0xe4e9('0x19')](_0x2b089b);}return _0x58fcca['status'](_0x2b089b)[_0xe4e9('0x1a')]();};}function respondWithResult(_0x154ae2,_0xaa5314){_0xaa5314=_0xaa5314||0xc8;return function(_0x8ce314){if(_0x8ce314){return _0x154ae2[_0xe4e9('0x1b')](_0xaa5314)['json'](_0x8ce314);}};}function respondWithFilteredResult(_0x14efbc,_0x3d8ea3){return function(_0x394b58){if(_0x394b58){var _0x118c86=typeof _0x3d8ea3['offset']===_0xe4e9('0x1c')&&typeof _0x3d8ea3[_0xe4e9('0x1d')]===_0xe4e9('0x1c');var _0x55cfd5=_0x394b58[_0xe4e9('0x1e')];var _0x2f4433=_0x118c86?0x0:_0x3d8ea3[_0xe4e9('0x1f')];var _0x4df416=_0x118c86?_0x394b58['count']:_0x3d8ea3[_0xe4e9('0x1f')]+_0x3d8ea3['limit'];var _0x58da97;if(_0x4df416>=_0x55cfd5){_0x4df416=_0x55cfd5;_0x58da97=0xc8;}else{_0x58da97=0xce;}_0x14efbc[_0xe4e9('0x1b')](_0x58da97);return _0x14efbc[_0xe4e9('0x20')]('Content-Range',_0x2f4433+'-'+_0x4df416+'/'+_0x55cfd5)[_0xe4e9('0x21')](_0x394b58);}return null;};}function patchUpdates(_0x2d01b5){return function(_0x39e4ca){try{jsonpatch[_0xe4e9('0x22')](_0x39e4ca,_0x2d01b5,!![]);}catch(_0x2a1533){return BPromise['reject'](_0x2a1533);}return _0x39e4ca['save']();};}function saveUpdates(_0x3920e5,_0x56f672){return function(_0x468d97){if(_0x468d97){return _0x468d97['update'](_0x3920e5)['then'](function(_0x4b4221){return _0x4b4221;});}return null;};}function removeEntity(_0x13c760,_0x4140a3){return function(_0x3769bc){if(_0x3769bc){return _0x3769bc['destroy']()[_0xe4e9('0x23')](function(){var _0xa49088=_0x3769bc[_0xe4e9('0x24')]({'plain':!![]});var _0x2cf3ed=_0xe4e9('0x25');return db[_0xe4e9('0x26')]['destroy']({'where':{'type':_0x2cf3ed,'resourceId':_0xa49088['id']}})[_0xe4e9('0x23')](function(){return _0x3769bc;});})[_0xe4e9('0x23')](function(){_0x13c760['status'](0xcc)[_0xe4e9('0x1a')]();});}};}function handleEntityNotFound(_0x1ce50c,_0x327215){return function(_0x5072aa){if(!_0x5072aa){_0x1ce50c[_0xe4e9('0x19')](0x194);}return _0x5072aa;};}function handleError(_0x5bd71e,_0x1b6003){_0x1b6003=_0x1b6003||0x1f4;return function(_0x19f650){logger['error'](_0x19f650[_0xe4e9('0x27')]);if(_0x19f650[_0xe4e9('0x28')]){delete _0x19f650['name'];}_0x5bd71e[_0xe4e9('0x1b')](_0x1b6003)[_0xe4e9('0x29')](_0x19f650);};}exports['index']=function(_0x5d8c79,_0x289ab3){var _0x4c0b21={},_0x32c049={},_0x5a8eeb={'count':0x0,'rows':[]};var _0x251c74=_[_0xe4e9('0x2a')](db[_0xe4e9('0x2b')][_0xe4e9('0x2c')],function(_0x4b8d4e){return{'name':_0x4b8d4e[_0xe4e9('0x2d')],'type':_0x4b8d4e[_0xe4e9('0x2e')]['key']};});_0x32c049[_0xe4e9('0x2f')]=_[_0xe4e9('0x2a')](_0x251c74,_0xe4e9('0x28'));_0x32c049[_0xe4e9('0x30')]=_[_0xe4e9('0x31')](_0x5d8c79['query']);_0x32c049[_0xe4e9('0x32')]=_[_0xe4e9('0x33')](_0x32c049[_0xe4e9('0x2f')],_0x32c049[_0xe4e9('0x30')]);_0x4c0b21[_0xe4e9('0x34')]=_[_0xe4e9('0x33')](_0x32c049[_0xe4e9('0x2f')],qs[_0xe4e9('0x35')](_0x5d8c79[_0xe4e9('0x30')]['fields']));_0x4c0b21[_0xe4e9('0x34')]=_0x4c0b21[_0xe4e9('0x34')]['length']?_0x4c0b21[_0xe4e9('0x34')]:_0x32c049['model'];if(!_0x5d8c79[_0xe4e9('0x30')][_0xe4e9('0x36')]('nolimit')){_0x4c0b21[_0xe4e9('0x1d')]=qs['limit'](_0x5d8c79[_0xe4e9('0x30')]['limit']);_0x4c0b21[_0xe4e9('0x1f')]=qs[_0xe4e9('0x1f')](_0x5d8c79[_0xe4e9('0x30')][_0xe4e9('0x1f')]);}_0x4c0b21[_0xe4e9('0x37')]=qs[_0xe4e9('0x38')](_0x5d8c79[_0xe4e9('0x30')][_0xe4e9('0x38')]);_0x4c0b21[_0xe4e9('0x39')]=qs['filters'](_[_0xe4e9('0x3a')](_0x5d8c79[_0xe4e9('0x30')],_0x32c049[_0xe4e9('0x32')]),_0x251c74);if(_0x5d8c79['query']['filter']){_0x4c0b21[_0xe4e9('0x39')]=_[_0xe4e9('0x3b')](_0x4c0b21[_0xe4e9('0x39')],{'$or':_[_0xe4e9('0x2a')](_0x251c74,function(_0x58ec08){if(_0x58ec08['type']!=='VIRTUAL'){var _0x1e55dd={};_0x1e55dd[_0x58ec08['name']]={'$like':'%'+_0x5d8c79[_0xe4e9('0x30')][_0xe4e9('0x3c')]+'%'};return _0x1e55dd;}})});}_0x4c0b21=_[_0xe4e9('0x3b')]({},_0x4c0b21,_0x5d8c79['options']);var _0x2347bb={'where':_0x4c0b21[_0xe4e9('0x39')]};return db[_0xe4e9('0x2b')][_0xe4e9('0x1e')](_0x2347bb)[_0xe4e9('0x23')](function(_0x43cfc4){_0x5a8eeb[_0xe4e9('0x1e')]=_0x43cfc4;if(_0x5d8c79['query'][_0xe4e9('0x3d')]){_0x4c0b21[_0xe4e9('0x3e')]=[{'all':!![]}];}return db[_0xe4e9('0x2b')][_0xe4e9('0x3f')](_0x4c0b21);})[_0xe4e9('0x23')](function(_0x5e0ee7){_0x5a8eeb[_0xe4e9('0x40')]=_0x5e0ee7;return _0x5a8eeb;})[_0xe4e9('0x23')](respondWithFilteredResult(_0x289ab3,_0x4c0b21))['catch'](handleError(_0x289ab3,null));};exports[_0xe4e9('0x41')]=function(_0xbc1d2d,_0x2050ec){var _0x3d5840={'raw':!![],'where':{'id':_0xbc1d2d[_0xe4e9('0x42')]['id']}},_0x27fbcf={};_0x27fbcf[_0xe4e9('0x2f')]=_[_0xe4e9('0x31')](db[_0xe4e9('0x2b')][_0xe4e9('0x2c')]);_0x27fbcf[_0xe4e9('0x30')]=_[_0xe4e9('0x31')](_0xbc1d2d['query']);_0x27fbcf[_0xe4e9('0x32')]=_[_0xe4e9('0x33')](_0x27fbcf[_0xe4e9('0x2f')],_0x27fbcf[_0xe4e9('0x30')]);_0x3d5840['attributes']=_['intersection'](_0x27fbcf['model'],qs[_0xe4e9('0x35')](_0xbc1d2d['query'][_0xe4e9('0x35')]));_0x3d5840[_0xe4e9('0x34')]=_0x3d5840[_0xe4e9('0x34')][_0xe4e9('0x43')]?_0x3d5840[_0xe4e9('0x34')]:_0x27fbcf[_0xe4e9('0x2f')];if(_0xbc1d2d['query'][_0xe4e9('0x3d')]){_0x3d5840[_0xe4e9('0x3e')]=[{'all':!![]}];}_0x3d5840=_[_0xe4e9('0x3b')]({},_0x3d5840,_0xbc1d2d['options']);return db[_0xe4e9('0x2b')][_0xe4e9('0x44')](_0x3d5840)[_0xe4e9('0x23')](handleEntityNotFound(_0x2050ec,null))['then'](respondWithResult(_0x2050ec,null))[_0xe4e9('0x45')](handleError(_0x2050ec,null));};exports[_0xe4e9('0x46')]=function(_0x564ad8,_0x9b8da9){return db[_0xe4e9('0x2b')][_0xe4e9('0x46')](_0x564ad8['body'],{})[_0xe4e9('0x23')](function(_0x5dea7f){var _0x14b70a=_0x564ad8[_0xe4e9('0x47')]['get']({'plain':!![]});if(!_0x14b70a)throw new Error(_0xe4e9('0x48'));if(_0x14b70a[_0xe4e9('0x49')]==='user'){var _0x14ca53=_0x5dea7f[_0xe4e9('0x24')]({'plain':!![]});var _0x27647b=_0xe4e9('0x25');return db[_0xe4e9('0x4a')]['find']({'where':{'name':_0x27647b,'userProfileId':_0x14b70a[_0xe4e9('0x4b')]},'raw':!![]})[_0xe4e9('0x23')](function(_0x1ff250){if(_0x1ff250&&_0x1ff250[_0xe4e9('0x4c')]===0x0){return db[_0xe4e9('0x26')][_0xe4e9('0x46')]({'name':_0x14ca53[_0xe4e9('0x28')],'resourceId':_0x14ca53['id'],'type':_0x1ff250['name'],'sectionId':_0x1ff250['id']},{})[_0xe4e9('0x23')](function(){return _0x5dea7f;});}else{return _0x5dea7f;}})[_0xe4e9('0x45')](function(_0xc06dd8){logger[_0xe4e9('0x4d')](_0xe4e9('0x4e'),_0xc06dd8);throw _0xc06dd8;});}return _0x5dea7f;})[_0xe4e9('0x23')](respondWithResult(_0x9b8da9,0xc9))['catch'](handleError(_0x9b8da9,null));};exports['update']=function(_0x5ed5f5,_0x339b32){if(_0x5ed5f5[_0xe4e9('0x4f')]['id']){delete _0x5ed5f5['body']['id'];}return db[_0xe4e9('0x2b')]['find']({'where':{'id':_0x5ed5f5[_0xe4e9('0x42')]['id']}})[_0xe4e9('0x23')](handleEntityNotFound(_0x339b32,null))[_0xe4e9('0x23')](saveUpdates(_0x5ed5f5['body'],null))[_0xe4e9('0x23')](respondWithResult(_0x339b32,null))[_0xe4e9('0x45')](handleError(_0x339b32,null));};exports[_0xe4e9('0x50')]=function(_0x57553c,_0x5d41cb){return db[_0xe4e9('0x2b')][_0xe4e9('0x44')]({'where':{'id':_0x57553c['params']['id']}})[_0xe4e9('0x23')](handleEntityNotFound(_0x5d41cb,null))[_0xe4e9('0x23')](removeEntity(_0x5d41cb,null))[_0xe4e9('0x45')](handleError(_0x5d41cb,null));}; \ No newline at end of file +var _0x2125=['update','then','destroy','get','Variables','error','stack','name','send','index','map','Variable','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','find','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','UserProfileResource','create','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply'];(function(_0xcdfc26,_0x2949e0){var _0x38ad7f=function(_0x3f9841){while(--_0x3f9841){_0xcdfc26['push'](_0xcdfc26['shift']());}};_0x38ad7f(++_0x2949e0);}(_0x2125,0x85));var _0x5212=function(_0x249d9f,_0x17d2b2){_0x249d9f=_0x249d9f-0x0;var _0x24e8bd=_0x2125[_0x249d9f];return _0x24e8bd;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x5212('0x0'));var jsonpatch=require(_0x5212('0x1'));var rp=require(_0x5212('0x2'));var moment=require(_0x5212('0x3'));var BPromise=require(_0x5212('0x4'));var Mustache=require(_0x5212('0x5'));var util=require(_0x5212('0x6'));var path=require(_0x5212('0x7'));var sox=require(_0x5212('0x8'));var csv=require(_0x5212('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5212('0xa'));var _=require('lodash');var squel=require(_0x5212('0xb'));var crypto=require(_0x5212('0xc'));var jsforce=require(_0x5212('0xd'));var deskjs=require(_0x5212('0xe'));var toCsv=require(_0x5212('0x9'));var querystring=require(_0x5212('0xf'));var Papa=require(_0x5212('0x10'));var Redis=require(_0x5212('0x11'));var authService=require(_0x5212('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5212('0x13'));var logger=require(_0x5212('0x14'))(_0x5212('0x15'));var utils=require(_0x5212('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x5212('0x17'))['db'];function respondWithStatusCode(_0x481e18,_0x331071){_0x331071=_0x331071||0xcc;return function(_0x10e265){if(_0x10e265){return _0x481e18[_0x5212('0x18')](_0x331071);}return _0x481e18[_0x5212('0x19')](_0x331071)[_0x5212('0x1a')]();};}function respondWithResult(_0x404cc9,_0x56ef54){_0x56ef54=_0x56ef54||0xc8;return function(_0x36c6ac){if(_0x36c6ac){return _0x404cc9[_0x5212('0x19')](_0x56ef54)[_0x5212('0x1b')](_0x36c6ac);}};}function respondWithFilteredResult(_0x819fbd,_0x1e2b96){return function(_0x29f1d8){if(_0x29f1d8){var _0x46ab04=typeof _0x1e2b96[_0x5212('0x1c')]===_0x5212('0x1d')&&typeof _0x1e2b96[_0x5212('0x1e')]===_0x5212('0x1d');var _0x15c4d1=_0x29f1d8[_0x5212('0x1f')];var _0x3c3306=_0x46ab04?0x0:_0x1e2b96[_0x5212('0x1c')];var _0x128bdb=_0x46ab04?_0x29f1d8[_0x5212('0x1f')]:_0x1e2b96[_0x5212('0x1c')]+_0x1e2b96[_0x5212('0x1e')];var _0x4de94e;if(_0x128bdb>=_0x15c4d1){_0x128bdb=_0x15c4d1;_0x4de94e=0xc8;}else{_0x4de94e=0xce;}_0x819fbd['status'](_0x4de94e);return _0x819fbd[_0x5212('0x20')](_0x5212('0x21'),_0x3c3306+'-'+_0x128bdb+'/'+_0x15c4d1)[_0x5212('0x1b')](_0x29f1d8);}return null;};}function patchUpdates(_0x4bf7ac){return function(_0x4638e8){try{jsonpatch[_0x5212('0x22')](_0x4638e8,_0x4bf7ac,!![]);}catch(_0x5b6431){return BPromise['reject'](_0x5b6431);}return _0x4638e8['save']();};}function saveUpdates(_0x11fa46,_0x1d6c3b){return function(_0x4c0cee){if(_0x4c0cee){return _0x4c0cee[_0x5212('0x23')](_0x11fa46)[_0x5212('0x24')](function(_0x4b4224){return _0x4b4224;});}return null;};}function removeEntity(_0x11083a,_0x1a329c){return function(_0x4b836e){if(_0x4b836e){return _0x4b836e[_0x5212('0x25')]()[_0x5212('0x24')](function(){var _0x50122a=_0x4b836e[_0x5212('0x26')]({'plain':!![]});var _0x4a8041=_0x5212('0x27');return db['UserProfileResource'][_0x5212('0x25')]({'where':{'type':_0x4a8041,'resourceId':_0x50122a['id']}})[_0x5212('0x24')](function(){return _0x4b836e;});})[_0x5212('0x24')](function(){_0x11083a[_0x5212('0x19')](0xcc)[_0x5212('0x1a')]();});}};}function handleEntityNotFound(_0x1cacea,_0x5f1651){return function(_0x2d5207){if(!_0x2d5207){_0x1cacea['sendStatus'](0x194);}return _0x2d5207;};}function handleError(_0x546833,_0x154c59){_0x154c59=_0x154c59||0x1f4;return function(_0x58d855){logger[_0x5212('0x28')](_0x58d855[_0x5212('0x29')]);if(_0x58d855[_0x5212('0x2a')]){delete _0x58d855[_0x5212('0x2a')];}_0x546833['status'](_0x154c59)[_0x5212('0x2b')](_0x58d855);};}exports[_0x5212('0x2c')]=function(_0x3bd55c,_0x209a31){var _0x1fef06={},_0x5b026f={},_0xb51953={'count':0x0,'rows':[]};var _0xc866a=_[_0x5212('0x2d')](db[_0x5212('0x2e')][_0x5212('0x2f')],function(_0xc1b238){return{'name':_0xc1b238[_0x5212('0x30')],'type':_0xc1b238[_0x5212('0x31')][_0x5212('0x32')]};});_0x5b026f[_0x5212('0x33')]=_['map'](_0xc866a,'name');_0x5b026f['query']=_[_0x5212('0x34')](_0x3bd55c[_0x5212('0x35')]);_0x5b026f[_0x5212('0x36')]=_[_0x5212('0x37')](_0x5b026f[_0x5212('0x33')],_0x5b026f[_0x5212('0x35')]);_0x1fef06[_0x5212('0x38')]=_[_0x5212('0x37')](_0x5b026f[_0x5212('0x33')],qs[_0x5212('0x39')](_0x3bd55c[_0x5212('0x35')][_0x5212('0x39')]));_0x1fef06['attributes']=_0x1fef06['attributes'][_0x5212('0x3a')]?_0x1fef06[_0x5212('0x38')]:_0x5b026f['model'];if(!_0x3bd55c[_0x5212('0x35')]['hasOwnProperty'](_0x5212('0x3b'))){_0x1fef06[_0x5212('0x1e')]=qs[_0x5212('0x1e')](_0x3bd55c[_0x5212('0x35')][_0x5212('0x1e')]);_0x1fef06['offset']=qs[_0x5212('0x1c')](_0x3bd55c[_0x5212('0x35')][_0x5212('0x1c')]);}_0x1fef06[_0x5212('0x3c')]=qs[_0x5212('0x3d')](_0x3bd55c[_0x5212('0x35')]['sort']);_0x1fef06[_0x5212('0x3e')]=qs[_0x5212('0x36')](_[_0x5212('0x3f')](_0x3bd55c['query'],_0x5b026f[_0x5212('0x36')]),_0xc866a);if(_0x3bd55c[_0x5212('0x35')][_0x5212('0x40')]){_0x1fef06['where']=_['merge'](_0x1fef06[_0x5212('0x3e')],{'$or':_['map'](_0xc866a,function(_0xe1d907){if(_0xe1d907['type']!==_0x5212('0x41')){var _0x2375e8={};_0x2375e8[_0xe1d907[_0x5212('0x2a')]]={'$like':'%'+_0x3bd55c[_0x5212('0x35')][_0x5212('0x40')]+'%'};return _0x2375e8;}})});}_0x1fef06=_[_0x5212('0x42')]({},_0x1fef06,_0x3bd55c[_0x5212('0x43')]);var _0x467690={'where':_0x1fef06['where']};return db['Variable'][_0x5212('0x1f')](_0x467690)[_0x5212('0x24')](function(_0x729b4f){_0xb51953['count']=_0x729b4f;if(_0x3bd55c[_0x5212('0x35')][_0x5212('0x44')]){_0x1fef06[_0x5212('0x45')]=[{'all':!![]}];}return db[_0x5212('0x2e')][_0x5212('0x46')](_0x1fef06);})[_0x5212('0x24')](function(_0x289f65){_0xb51953[_0x5212('0x47')]=_0x289f65;return _0xb51953;})[_0x5212('0x24')](respondWithFilteredResult(_0x209a31,_0x1fef06))[_0x5212('0x48')](handleError(_0x209a31,null));};exports[_0x5212('0x49')]=function(_0x33815d,_0xfe4f71){var _0x2f1137={'raw':!![],'where':{'id':_0x33815d[_0x5212('0x4a')]['id']}},_0x3effea={};_0x3effea[_0x5212('0x33')]=_['keys'](db[_0x5212('0x2e')][_0x5212('0x2f')]);_0x3effea[_0x5212('0x35')]=_['keys'](_0x33815d[_0x5212('0x35')]);_0x3effea[_0x5212('0x36')]=_['intersection'](_0x3effea[_0x5212('0x33')],_0x3effea[_0x5212('0x35')]);_0x2f1137[_0x5212('0x38')]=_[_0x5212('0x37')](_0x3effea[_0x5212('0x33')],qs['fields'](_0x33815d['query'][_0x5212('0x39')]));_0x2f1137[_0x5212('0x38')]=_0x2f1137[_0x5212('0x38')]['length']?_0x2f1137[_0x5212('0x38')]:_0x3effea[_0x5212('0x33')];if(_0x33815d[_0x5212('0x35')][_0x5212('0x44')]){_0x2f1137[_0x5212('0x45')]=[{'all':!![]}];}_0x2f1137=_[_0x5212('0x42')]({},_0x2f1137,_0x33815d[_0x5212('0x43')]);return db['Variable'][_0x5212('0x4b')](_0x2f1137)[_0x5212('0x24')](handleEntityNotFound(_0xfe4f71,null))[_0x5212('0x24')](respondWithResult(_0xfe4f71,null))[_0x5212('0x48')](handleError(_0xfe4f71,null));};exports['create']=function(_0x501b42,_0x476ee7){return db[_0x5212('0x2e')]['create'](_0x501b42[_0x5212('0x4c')],{})[_0x5212('0x24')](function(_0x153376){var _0x19db1e=_0x501b42[_0x5212('0x4d')][_0x5212('0x26')]({'plain':!![]});if(!_0x19db1e)throw new Error(_0x5212('0x4e'));if(_0x19db1e[_0x5212('0x4f')]==='user'){var _0x36ca29=_0x153376['get']({'plain':!![]});var _0x47465e=_0x5212('0x27');return db[_0x5212('0x50')][_0x5212('0x4b')]({'where':{'name':_0x47465e,'userProfileId':_0x19db1e['userProfileId']},'raw':!![]})[_0x5212('0x24')](function(_0xf71acb){if(_0xf71acb&&_0xf71acb[_0x5212('0x51')]===0x0){return db[_0x5212('0x52')][_0x5212('0x53')]({'name':_0x36ca29['name'],'resourceId':_0x36ca29['id'],'type':_0xf71acb[_0x5212('0x2a')],'sectionId':_0xf71acb['id']},{})[_0x5212('0x24')](function(){return _0x153376;});}else{return _0x153376;}})[_0x5212('0x48')](function(_0x116bd2){logger[_0x5212('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x116bd2);throw _0x116bd2;});}return _0x153376;})[_0x5212('0x24')](respondWithResult(_0x476ee7,0xc9))[_0x5212('0x48')](handleError(_0x476ee7,null));};exports[_0x5212('0x23')]=function(_0x46a91e,_0x13c2ea){if(_0x46a91e[_0x5212('0x4c')]['id']){delete _0x46a91e[_0x5212('0x4c')]['id'];}return db[_0x5212('0x2e')][_0x5212('0x4b')]({'where':{'id':_0x46a91e[_0x5212('0x4a')]['id']}})[_0x5212('0x24')](handleEntityNotFound(_0x13c2ea,null))[_0x5212('0x24')](saveUpdates(_0x46a91e[_0x5212('0x4c')],null))[_0x5212('0x24')](respondWithResult(_0x13c2ea,null))[_0x5212('0x48')](handleError(_0x13c2ea,null));};exports['destroy']=function(_0x83e628,_0x14793d){return db[_0x5212('0x2e')]['find']({'where':{'id':_0x83e628['params']['id']}})[_0x5212('0x24')](handleEntityNotFound(_0x14793d,null))[_0x5212('0x24')](removeEntity(_0x14793d,null))['catch'](handleError(_0x14793d,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index 6a0e638..0403340 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 _0x1194=['../../config/environment','./variable.attributes','exports','Variable','tools_variables','lodash','util','../../config/logger','api','moment','bluebird','path'];(function(_0x348bd3,_0x16c57d){var _0x3de464=function(_0x55203c){while(--_0x55203c){_0x348bd3['push'](_0x348bd3['shift']());}};_0x3de464(++_0x16c57d);}(_0x1194,0x1d9));var _0x4119=function(_0x34919b,_0x1e409a){_0x34919b=_0x34919b-0x0;var _0x505b56=_0x1194[_0x34919b];return _0x505b56;};'use strict';var _=require(_0x4119('0x0'));var util=require(_0x4119('0x1'));var logger=require(_0x4119('0x2'))(_0x4119('0x3'));var moment=require(_0x4119('0x4'));var BPromise=require(_0x4119('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4119('0x6'));var rimraf=require('rimraf');var config=require(_0x4119('0x7'));var attributes=require(_0x4119('0x8'));module[_0x4119('0x9')]=function(_0x311b8b,_0x5c60aa){return _0x311b8b['define'](_0x4119('0xa'),attributes,{'tableName':_0x4119('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe0a9=['./variable.attributes','Variable','tools_variables','lodash','../../config/logger','moment','request-promise','../../config/environment'];(function(_0x22fe1d,_0xda3ae9){var _0x6e6b29=function(_0x4e489c){while(--_0x4e489c){_0x22fe1d['push'](_0x22fe1d['shift']());}};_0x6e6b29(++_0xda3ae9);}(_0xe0a9,0x8b));var _0x9e0a=function(_0x12cbad,_0x1d5de4){_0x12cbad=_0x12cbad-0x0;var _0x593568=_0xe0a9[_0x12cbad];return _0x593568;};'use strict';var _=require(_0x9e0a('0x0'));var util=require('util');var logger=require(_0x9e0a('0x1'))('api');var moment=require(_0x9e0a('0x2'));var BPromise=require('bluebird');var rp=require(_0x9e0a('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x9e0a('0x4'));var attributes=require(_0x9e0a('0x5'));module['exports']=function(_0x319d09,_0x4f3721){return _0x319d09['define'](_0x9e0a('0x6'),attributes,{'tableName':_0x9e0a('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/variable/variable.rpc.js b/server/api/variable/variable.rpc.js index 84a2917..b5405fa 100644 --- a/server/api/variable/variable.rpc.js +++ b/server/api/variable/variable.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7fbe=['stringify','error','code','message','result','catch','Variable','find','options','where','attributes','include','map','model','info','ShowVariable','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s'];(function(_0x5bece3,_0x53fbe0){var _0x208326=function(_0x5036df){while(--_0x5036df){_0x5bece3['push'](_0x5bece3['shift']());}};_0x208326(++_0x53fbe0);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x13cd20,_0x1d9211){_0x13cd20=_0x13cd20-0x0;var _0x22b6de=_0x7fbe[_0x13cd20];return _0x22b6de;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe7fb('0x0'));var BPromise=require(_0xe7fb('0x1'));var rs=require(_0xe7fb('0x2'));var fs=require('fs');var Redis=require(_0xe7fb('0x3'));var db=require(_0xe7fb('0x4'))['db'];var utils=require(_0xe7fb('0x5'));var logger=require(_0xe7fb('0x6'))(_0xe7fb('0x7'));var config=require(_0xe7fb('0x8'));var jayson=require(_0xe7fb('0x9'));var client=jayson[_0xe7fb('0xa')][_0xe7fb('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x24cd67,_0x1f943f,_0x5ad75b){return new BPromise(function(_0x213ebc,_0x228f6b){return client[_0xe7fb('0xc')](_0x24cd67,_0x5ad75b)[_0xe7fb('0xd')](function(_0x4ba197){logger['info'](_0xe7fb('0xe'),_0x1f943f,_0xe7fb('0xf'));logger[_0xe7fb('0x10')](_0xe7fb('0x11'),_0x1f943f,_0xe7fb('0xf'),JSON[_0xe7fb('0x12')](_0x4ba197));if(_0x4ba197[_0xe7fb('0x13')]){if(_0x4ba197[_0xe7fb('0x13')][_0xe7fb('0x14')]===0x1f4){logger[_0xe7fb('0x13')](_0xe7fb('0xe'),_0x1f943f,_0x4ba197[_0xe7fb('0x13')][_0xe7fb('0x15')]);return _0x228f6b(_0x4ba197[_0xe7fb('0x13')][_0xe7fb('0x15')]);}logger['error'](_0xe7fb('0xe'),_0x1f943f,_0x4ba197[_0xe7fb('0x13')]['message']);return _0x213ebc(_0x4ba197[_0xe7fb('0x13')][_0xe7fb('0x15')]);}else{logger['info'](_0xe7fb('0xe'),_0x1f943f,'request\x20sent');_0x213ebc(_0x4ba197[_0xe7fb('0x16')][_0xe7fb('0x15')]);}})[_0xe7fb('0x17')](function(_0x17e8a8){logger['error'](_0xe7fb('0xe'),_0x1f943f,_0x17e8a8);_0x228f6b(_0x17e8a8);});});}exports['ShowVariable']=function(_0x293a47){var _0x546463=this;return new Promise(function(_0x1e77fd,_0x4708f7){return db[_0xe7fb('0x18')][_0xe7fb('0x19')]({'raw':_0x293a47['options']?_0x293a47[_0xe7fb('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x293a47[_0xe7fb('0x1a')]?_0x293a47['options'][_0xe7fb('0x1b')]||null:null,'attributes':_0x293a47['options']?_0x293a47[_0xe7fb('0x1a')][_0xe7fb('0x1c')]||null:null,'include':_0x293a47['options']?_0x293a47[_0xe7fb('0x1a')][_0xe7fb('0x1d')]?_[_0xe7fb('0x1e')](_0x293a47['options'][_0xe7fb('0x1d')],function(_0x469ead){return{'model':db[_0x469ead['model']],'as':_0x469ead['as'],'attributes':_0x469ead['attributes'],'include':_0x469ead['include']?_[_0xe7fb('0x1e')](_0x469ead['include'],function(_0x49b219){return{'model':db[_0x49b219[_0xe7fb('0x1f')]],'as':_0x49b219['as'],'attributes':_0x49b219[_0xe7fb('0x1c')],'include':_0x49b219[_0xe7fb('0x1d')]?_['map'](_0x49b219[_0xe7fb('0x1d')],function(_0x2b69c4){return{'model':db[_0x2b69c4[_0xe7fb('0x1f')]],'as':_0x2b69c4['as'],'attributes':_0x2b69c4[_0xe7fb('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xe7fb('0xd')](function(_0x16237a){logger[_0xe7fb('0x20')]('ShowVariable',_0x293a47);logger['debug'](_0xe7fb('0x21'),_0x293a47,JSON[_0xe7fb('0x12')](_0x16237a));_0x1e77fd(_0x16237a);})[_0xe7fb('0x17')](function(_0x4fd290){logger[_0xe7fb('0x13')](_0xe7fb('0x21'),_0x4fd290[_0xe7fb('0x15')],_0x293a47);_0x4708f7(_0x546463[_0xe7fb('0x13')](0x1f4,_0x4fd290[_0xe7fb('0x15')]));});});}; \ No newline at end of file +var _0x814b=['model','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','ShowVariable','options','where','include','map','attributes'];(function(_0x407473,_0x1921d3){var _0xa1e5aa=function(_0x478e17){while(--_0x478e17){_0x407473['push'](_0x407473['shift']());}};_0xa1e5aa(++_0x1921d3);}(_0x814b,0x1a2));var _0xb814=function(_0x8a7e38,_0x473a5d){_0x8a7e38=_0x8a7e38-0x0;var _0x228609=_0x814b[_0x8a7e38];return _0x228609;};'use strict';var _=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var moment=require(_0xb814('0x2'));var BPromise=require(_0xb814('0x3'));var rs=require(_0xb814('0x4'));var fs=require('fs');var Redis=require(_0xb814('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xb814('0x6'));var logger=require(_0xb814('0x7'))(_0xb814('0x8'));var config=require(_0xb814('0x9'));var jayson=require(_0xb814('0xa'));var client=jayson[_0xb814('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3b0829,_0x2e6272,_0x5c8539){return new BPromise(function(_0x271af9,_0x2913a6){return client[_0xb814('0xc')](_0x3b0829,_0x5c8539)[_0xb814('0xd')](function(_0x1fea33){logger[_0xb814('0xe')](_0xb814('0xf'),_0x2e6272,_0xb814('0x10'));logger[_0xb814('0x11')](_0xb814('0x12'),_0x2e6272,_0xb814('0x10'),JSON['stringify'](_0x1fea33));if(_0x1fea33[_0xb814('0x13')]){if(_0x1fea33['error'][_0xb814('0x14')]===0x1f4){logger[_0xb814('0x13')](_0xb814('0xf'),_0x2e6272,_0x1fea33[_0xb814('0x13')][_0xb814('0x15')]);return _0x2913a6(_0x1fea33[_0xb814('0x13')][_0xb814('0x15')]);}logger[_0xb814('0x13')](_0xb814('0xf'),_0x2e6272,_0x1fea33[_0xb814('0x13')][_0xb814('0x15')]);return _0x271af9(_0x1fea33[_0xb814('0x13')][_0xb814('0x15')]);}else{logger[_0xb814('0xe')](_0xb814('0xf'),_0x2e6272,_0xb814('0x10'));_0x271af9(_0x1fea33[_0xb814('0x16')][_0xb814('0x15')]);}})[_0xb814('0x17')](function(_0x21b73f){logger[_0xb814('0x13')]('Variable,\x20%s,\x20%s',_0x2e6272,_0x21b73f);_0x2913a6(_0x21b73f);});});}exports[_0xb814('0x18')]=function(_0x55ba16){var _0x270598=this;return new Promise(function(_0xfac75b,_0x4c3007){return db['Variable']['find']({'raw':_0x55ba16[_0xb814('0x19')]?_0x55ba16['options']['raw']===undefined?!![]:![]:!![],'where':_0x55ba16[_0xb814('0x19')]?_0x55ba16[_0xb814('0x19')][_0xb814('0x1a')]||null:null,'attributes':_0x55ba16['options']?_0x55ba16[_0xb814('0x19')]['attributes']||null:null,'include':_0x55ba16[_0xb814('0x19')]?_0x55ba16[_0xb814('0x19')][_0xb814('0x1b')]?_[_0xb814('0x1c')](_0x55ba16[_0xb814('0x19')][_0xb814('0x1b')],function(_0x1f5d40){return{'model':db[_0x1f5d40['model']],'as':_0x1f5d40['as'],'attributes':_0x1f5d40[_0xb814('0x1d')],'include':_0x1f5d40['include']?_[_0xb814('0x1c')](_0x1f5d40[_0xb814('0x1b')],function(_0x31c7ec){return{'model':db[_0x31c7ec[_0xb814('0x1e')]],'as':_0x31c7ec['as'],'attributes':_0x31c7ec[_0xb814('0x1d')],'include':_0x31c7ec[_0xb814('0x1b')]?_[_0xb814('0x1c')](_0x31c7ec['include'],function(_0x392222){return{'model':db[_0x392222[_0xb814('0x1e')]],'as':_0x392222['as'],'attributes':_0x392222[_0xb814('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xb814('0xd')](function(_0x32ed56){logger[_0xb814('0xe')](_0xb814('0x18'),_0x55ba16);logger[_0xb814('0x11')]('ShowVariable',_0x55ba16,JSON[_0xb814('0x1f')](_0x32ed56));_0xfac75b(_0x32ed56);})[_0xb814('0x17')](function(_0x52ed64){logger[_0xb814('0x13')](_0xb814('0x18'),_0x52ed64[_0xb814('0x15')],_0x55ba16);_0x4c3007(_0x270598['error'](0x1f4,_0x52ed64[_0xb814('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/version/index.js b/server/api/version/index.js index de876cb..f5f14bc 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 _0x3fa3=['canUpdate','fetch','/reset','reset','/pull','pull','/restart','restart','/migrations','exports','express','../../components/auth/service','./version.controller','get','/fetch','isAuthenticated'];(function(_0x57f1a3,_0xdb8a32){var _0x24b255=function(_0xac3f58){while(--_0xac3f58){_0x57f1a3['push'](_0x57f1a3['shift']());}};_0x24b255(++_0xdb8a32);}(_0x3fa3,0x9a));var _0x33fa=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x3fa3[_0x14add3];return _0x4a174f;};'use strict';var express=require(_0x33fa('0x0'));var router=express['Router']();var auth=require(_0x33fa('0x1'));var controller=require(_0x33fa('0x2'));router[_0x33fa('0x3')]('/',controller['index']);router[_0x33fa('0x3')](_0x33fa('0x4'),auth[_0x33fa('0x5')](),auth[_0x33fa('0x6')](),controller[_0x33fa('0x7')]);router[_0x33fa('0x3')](_0x33fa('0x8'),auth[_0x33fa('0x5')](),auth[_0x33fa('0x6')](),controller[_0x33fa('0x9')]);router['get'](_0x33fa('0xa'),auth[_0x33fa('0x5')](),auth[_0x33fa('0x6')](),controller[_0x33fa('0xb')]);router[_0x33fa('0x3')](_0x33fa('0xc'),auth[_0x33fa('0x5')](),controller[_0x33fa('0xd')]);router[_0x33fa('0x3')](_0x33fa('0xe'),controller['migrations']);module[_0x33fa('0xf')]=router; \ No newline at end of file +var _0x041f=['isAuthenticated','/reset','reset','/restart','restart','/migrations','migrations','exports','Router','../../components/auth/service','./version.controller','get','index','/fetch'];(function(_0x472efd,_0x187147){var _0x2a6d15=function(_0x25bd29){while(--_0x25bd29){_0x472efd['push'](_0x472efd['shift']());}};_0x2a6d15(++_0x187147);}(_0x041f,0x94));var _0xf041=function(_0x3411ad,_0x1f2fe2){_0x3411ad=_0x3411ad-0x0;var _0x18edca=_0x041f[_0x3411ad];return _0x18edca;};'use strict';var express=require('express');var router=express[_0xf041('0x0')]();var auth=require(_0xf041('0x1'));var controller=require(_0xf041('0x2'));router[_0xf041('0x3')]('/',controller[_0xf041('0x4')]);router[_0xf041('0x3')](_0xf041('0x5'),auth[_0xf041('0x6')](),auth['canUpdate'](),controller['fetch']);router[_0xf041('0x3')](_0xf041('0x7'),auth[_0xf041('0x6')](),auth['canUpdate'](),controller[_0xf041('0x8')]);router[_0xf041('0x3')]('/pull',auth[_0xf041('0x6')](),auth['canUpdate'](),controller['pull']);router[_0xf041('0x3')](_0xf041('0x9'),auth[_0xf041('0x6')](),controller[_0xf041('0xa')]);router['get'](_0xf041('0xb'),controller[_0xf041('0xc')]);module[_0xf041('0xd')]=router; \ No newline at end of file diff --git a/server/api/version/version.controller.js b/server/api/version/version.controller.js index 2555388..9242f48 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 _0xf943=['npm\x20install\x20--production','restart','motion2','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','migrations','readdirSync','join','server','replace','.js','exports','push','length','sequelize','Migration','getQueryInterface','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','map','then','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','last','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','path','lodash','pkginfo','version','compare-versions','child_process','exec','../../config/pm2','../../config/logger','update','simple-git','root','index','query','latest','fetch','tags','2.0.0','status','json','origin','error','info','git\x20fetch','git\x20fetch\x20origin\x20master','reset','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','pull'];(function(_0x4bdb34,_0x58ef2b){var _0x6f3405=function(_0x2b4f6f){while(--_0x2b4f6f){_0x4bdb34['push'](_0x4bdb34['shift']());}};_0x6f3405(++_0x58ef2b);}(_0xf943,0x1a2));var _0x3f94=function(_0x1e69b4,_0x5b369c){_0x1e69b4=_0x1e69b4-0x0;var _0x5f4ccb=_0xf943[_0x1e69b4];return _0x5f4ccb;};'use strict';var Umzug=require(_0x3f94('0x0'));var path=require(_0x3f94('0x1'));var fs=require('fs');var _=require(_0x3f94('0x2'));var pkginfo=require(_0x3f94('0x3'))(module,_0x3f94('0x4'));var compareVersions=require(_0x3f94('0x5'));var exec=require(_0x3f94('0x6'))[_0x3f94('0x7')];var db=require('../../mysqldb')['db'];var config=require('../../config/environment');var pm2=require(_0x3f94('0x8'));var logger=require(_0x3f94('0x9'))(_0x3f94('0xa'));var git=require(_0x3f94('0xb'))(config[_0x3f94('0xc')]);exports[_0x3f94('0xd')]=function(_0x3e13d6,_0x1b9336){var _0x1ea220={'current':module['exports'][_0x3f94('0x4')],'phonebar':0x2};if(_0x3e13d6[_0x3f94('0xe')]&&_0x3e13d6[_0x3f94('0xe')][_0x3f94('0xf')]){return git[_0x3f94('0x10')]()[_0x3f94('0x11')](function(_0xe2abbe,_0x439ab8){_0x1ea220['latest']=(_0xe2abbe?module['exports'][_0x3f94('0x4')]:_0x439ab8[_0x3f94('0xf')])||_0x3f94('0x12');return _0x1b9336['status'](0xc8)['json'](_0x1ea220);});}else{return _0x1b9336[_0x3f94('0x13')](0xc8)[_0x3f94('0x14')](_0x1ea220);}};exports['fetch']=function(_0x231346,_0x5dc234){return git[_0x3f94('0x10')]([_0x3f94('0x15'),'master'],function(_0x2c89e3){if(_0x2c89e3){logger[_0x3f94('0x16')](_0x2c89e3);return _0x5dc234[_0x3f94('0x13')](0x1f4)[_0x3f94('0x14')](_0x2c89e3);}logger[_0x3f94('0x17')](_0x3f94('0x18'));return _0x5dc234[_0x3f94('0x13')](0xc8)['json']({'output':_0x3f94('0x19')});});};exports[_0x3f94('0x1a')]=function(_0x242e8a,_0x32def1){return git[_0x3f94('0x1a')](['--hard','FETCH_HEAD'],function(_0x45ea40){if(_0x45ea40){logger['error'](_0x45ea40);return _0x32def1[_0x3f94('0x13')](0x1f4)[_0x3f94('0x14')](_0x45ea40);}logger[_0x3f94('0x17')](_0x3f94('0x1b'));return _0x32def1[_0x3f94('0x13')](0xc8)[_0x3f94('0x14')]({'output':_0x3f94('0x1c')});});};exports[_0x3f94('0x1d')]=function(_0x1e3151,_0x2aeda3){exec(_0x3f94('0x1e'),function(_0x2c1665,_0x5bc856,_0x424cc9){logger[_0x3f94('0x17')](_0x5bc856);logger['info'](_0x424cc9);if(_0x2c1665){logger['error'](_0x2c1665);return _0x2aeda3[_0x3f94('0x13')](0x1f4)[_0x3f94('0x14')](_0x2c1665);}return _0x2aeda3[_0x3f94('0x13')](0xc8)[_0x3f94('0x14')]({'output':_0x5bc856});});};exports['restart']=function(_0x5545fe,_0x50d5e2){return pm2[_0x3f94('0x1f')](_0x3f94('0x20'))['then'](function(_0x1a23c0){logger['info'](_0x3f94('0x21'),_0x1a23c0);return _0x50d5e2[_0x3f94('0x13')](0xc8)[_0x3f94('0x14')]({'output':_0x3f94('0x22')});})[_0x3f94('0x23')](function(_0x41be64){logger[_0x3f94('0x16')](_0x41be64);return _0x50d5e2[_0x3f94('0x13')](0x1f4)['json'](_0x41be64);});};exports[_0x3f94('0x24')]=function(_0x571390,_0x3344a){var _0x31cc30=fs[_0x3f94('0x25')](path[_0x3f94('0x26')](config[_0x3f94('0xc')],_0x3f94('0x27'),_0x3f94('0x24')));var _0x57df27=[];for(var _0x4e5697=0x0;_0x4e5697<_0x31cc30['length'];_0x4e5697++){var _0x4cbe26=_0x31cc30[_0x4e5697][_0x3f94('0x28')](_0x3f94('0x29'),'');if(compareVersions(module[_0x3f94('0x2a')][_0x3f94('0x4')],_0x4cbe26)===-0x1){_0x57df27[_0x3f94('0x2b')](_0x4cbe26);}}if(_0x57df27[_0x3f94('0x2c')]){var _0x5efd90=_0x57df27['sort'](compareVersions);var _0x3af2ad=new Umzug({'storage':_0x3f94('0x2d'),'storageOptions':{'model':db[_0x3f94('0x2e')],'modelName':_0x3f94('0x2e'),'columnName':_0x3f94('0x4')},'migrations':{'params':[db['sequelize'][_0x3f94('0x2f')](),db[_0x3f94('0x2d')]['constructor'],function(){throw new Error(_0x3f94('0x30'));}],'path':path[_0x3f94('0x26')](config[_0x3f94('0xc')],'server',_0x3f94('0x24')),'pattern':/\.js$/}});_0x3af2ad['up']({'migrations':_[_0x3f94('0x31')](_0x5efd90,function(_0x2af69c){return _0x2af69c+_0x3f94('0x29');})})[_0x3f94('0x32')](function(){return _0x3344a['status'](0xc8)[_0x3f94('0x14')]({'output':_0x3f94('0x33')+module[_0x3f94('0x2a')][_0x3f94('0x4')]+_0x3f94('0x34')+_[_0x3f94('0x35')](_0x5efd90),'migrations':_[_0x3f94('0x26')](_0x5efd90)});})['catch'](function(_0x55f704){if(_0x55f704 instanceof db[_0x3f94('0x2d')][_0x3f94('0x36')]){return _0x3344a[_0x3f94('0x13')](0xc8)['json']({'output':_0x3f94('0x37')});}else{return _0x3344a['status'](0x1f4)['json'](_0x55f704);}});}else{return _0x3344a[_0x3f94('0x13')](0xc8)['json']({'output':'Database\x20already\x20up-to-date'});}}; \ No newline at end of file +var _0xc3c0=['npm\x20install\x20--production','info','restart','motion2','then','join','server','replace','.js','length','sequelize','constructor','migrations','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','last','catch','Database\x20already\x20up-to-date','lodash','version','compare-versions','exec','../../config/pm2','../../config/logger','update','simple-git','root','index','query','latest','fetch','tags','exports','2.0.0','status','json','origin','master','error','git\x20fetch','git\x20fetch\x20origin\x20master','reset','--hard','FETCH_HEAD','git\x20reset\x20--hard','pull'];(function(_0x5e8f4b,_0x9fdac4){var _0x368d10=function(_0x1574ad){while(--_0x1574ad){_0x5e8f4b['push'](_0x5e8f4b['shift']());}};_0x368d10(++_0x9fdac4);}(_0xc3c0,0x1b0));var _0x0c3c=function(_0x350658,_0x5cc88d){_0x350658=_0x350658-0x0;var _0x6e49d6=_0xc3c0[_0x350658];return _0x6e49d6;};'use strict';var Umzug=require('umzug');var path=require('path');var fs=require('fs');var _=require(_0x0c3c('0x0'));var pkginfo=require('pkginfo')(module,_0x0c3c('0x1'));var compareVersions=require(_0x0c3c('0x2'));var exec=require('child_process')[_0x0c3c('0x3')];var db=require('../../mysqldb')['db'];var config=require('../../config/environment');var pm2=require(_0x0c3c('0x4'));var logger=require(_0x0c3c('0x5'))(_0x0c3c('0x6'));var git=require(_0x0c3c('0x7'))(config[_0x0c3c('0x8')]);exports[_0x0c3c('0x9')]=function(_0x261f04,_0xfdff3d){var _0x1dc7d6={'current':module['exports'][_0x0c3c('0x1')],'phonebar':0x2};if(_0x261f04[_0x0c3c('0xa')]&&_0x261f04[_0x0c3c('0xa')][_0x0c3c('0xb')]){return git[_0x0c3c('0xc')]()[_0x0c3c('0xd')](function(_0x55a315,_0x14781a){_0x1dc7d6[_0x0c3c('0xb')]=(_0x55a315?module[_0x0c3c('0xe')][_0x0c3c('0x1')]:_0x14781a[_0x0c3c('0xb')])||_0x0c3c('0xf');return _0xfdff3d[_0x0c3c('0x10')](0xc8)[_0x0c3c('0x11')](_0x1dc7d6);});}else{return _0xfdff3d[_0x0c3c('0x10')](0xc8)[_0x0c3c('0x11')](_0x1dc7d6);}};exports['fetch']=function(_0x39be6a,_0x4425b2){return git[_0x0c3c('0xc')]([_0x0c3c('0x12'),_0x0c3c('0x13')],function(_0x45e7dd){if(_0x45e7dd){logger[_0x0c3c('0x14')](_0x45e7dd);return _0x4425b2[_0x0c3c('0x10')](0x1f4)['json'](_0x45e7dd);}logger['info'](_0x0c3c('0x15'));return _0x4425b2[_0x0c3c('0x10')](0xc8)[_0x0c3c('0x11')]({'output':_0x0c3c('0x16')});});};exports[_0x0c3c('0x17')]=function(_0x10e2ca,_0x577be5){return git[_0x0c3c('0x17')]([_0x0c3c('0x18'),_0x0c3c('0x19')],function(_0xf7da30){if(_0xf7da30){logger[_0x0c3c('0x14')](_0xf7da30);return _0x577be5[_0x0c3c('0x10')](0x1f4)[_0x0c3c('0x11')](_0xf7da30);}logger['info']('git\x20reset\x20--hard\x20FETCH_HEAD');return _0x577be5[_0x0c3c('0x10')](0xc8)[_0x0c3c('0x11')]({'output':_0x0c3c('0x1a')});});};exports[_0x0c3c('0x1b')]=function(_0x216ef5,_0x5ae86c){exec(_0x0c3c('0x1c'),function(_0x248fea,_0x1d031e,_0x427f1f){logger[_0x0c3c('0x1d')](_0x1d031e);logger['info'](_0x427f1f);if(_0x248fea){logger['error'](_0x248fea);return _0x5ae86c[_0x0c3c('0x10')](0x1f4)['json'](_0x248fea);}return _0x5ae86c['status'](0xc8)[_0x0c3c('0x11')]({'output':_0x1d031e});});};exports[_0x0c3c('0x1e')]=function(_0x1b2ff9,_0x2c9c7d){return pm2['restart'](_0x0c3c('0x1f'))[_0x0c3c('0x20')](function(_0x3825c1){logger[_0x0c3c('0x1d')]('pm2\x20restart\x20motion\x20%s',_0x3825c1);return _0x2c9c7d[_0x0c3c('0x10')](0xc8)[_0x0c3c('0x11')]({'output':'Your\x20system\x20has\x20been\x20restart\x20successfully'});})['catch'](function(_0x22e1b3){logger[_0x0c3c('0x14')](_0x22e1b3);return _0x2c9c7d['status'](0x1f4)[_0x0c3c('0x11')](_0x22e1b3);});};exports['migrations']=function(_0x3ad541,_0x3f7306){var _0x300366=fs['readdirSync'](path[_0x0c3c('0x21')](config[_0x0c3c('0x8')],_0x0c3c('0x22'),'migrations'));var _0x17d312=[];for(var _0x1bbb77=0x0;_0x1bbb77<_0x300366['length'];_0x1bbb77++){var _0xadbf=_0x300366[_0x1bbb77][_0x0c3c('0x23')](_0x0c3c('0x24'),'');if(compareVersions(module[_0x0c3c('0xe')][_0x0c3c('0x1')],_0xadbf)===-0x1){_0x17d312['push'](_0xadbf);}}if(_0x17d312[_0x0c3c('0x25')]){var _0x59b36f=_0x17d312['sort'](compareVersions);var _0x3e329e=new Umzug({'storage':'sequelize','storageOptions':{'model':db['Migration'],'modelName':'Migration','columnName':_0x0c3c('0x1')},'migrations':{'params':[db[_0x0c3c('0x26')]['getQueryInterface'](),db[_0x0c3c('0x26')][_0x0c3c('0x27')],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[_0x0c3c('0x21')](config[_0x0c3c('0x8')],_0x0c3c('0x22'),_0x0c3c('0x28')),'pattern':/\.js$/}});_0x3e329e['up']({'migrations':_['map'](_0x59b36f,function(_0x4c34ab){return _0x4c34ab+_0x0c3c('0x24');})})[_0x0c3c('0x20')](function(){return _0x3f7306['status'](0xc8)[_0x0c3c('0x11')]({'output':_0x0c3c('0x29')+module[_0x0c3c('0xe')][_0x0c3c('0x1')]+_0x0c3c('0x2a')+_[_0x0c3c('0x2b')](_0x59b36f),'migrations':_['join'](_0x59b36f)});})[_0x0c3c('0x2c')](function(_0x2c3e4f){if(_0x2c3e4f instanceof db['sequelize']['UniqueConstraintError']){return _0x3f7306[_0x0c3c('0x10')](0xc8)[_0x0c3c('0x11')]({'output':_0x0c3c('0x2d')});}else{return _0x3f7306[_0x0c3c('0x10')](0x1f4)[_0x0c3c('0x11')](_0x2c3e4f);}});}else{return _0x3f7306[_0x0c3c('0x10')](0xc8)['json']({'output':_0x0c3c('0x2d')});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index d5449cb..0436cd9 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 _0x5686=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceAgentReport.controller','get','isAuthenticated','/describe','describe','show','post','create','put','delete','/:id','exports','util','connect-timeout','express','Router'];(function(_0x4f4426,_0x37331d){var _0x4715aa=function(_0x366403){while(--_0x366403){_0x4f4426['push'](_0x4f4426['shift']());}};_0x4715aa(++_0x37331d);}(_0x5686,0x1a0));var _0x6568=function(_0x28258a,_0x22f398){_0x28258a=_0x28258a-0x0;var _0x4e968e=_0x5686[_0x28258a];return _0x4e968e;};'use strict';var multer=require('multer');var util=require(_0x6568('0x0'));var path=require('path');var timeout=require(_0x6568('0x1'));var express=require(_0x6568('0x2'));var router=express[_0x6568('0x3')]();var fs_extra=require(_0x6568('0x4'));var auth=require(_0x6568('0x5'));var interaction=require(_0x6568('0x6'));var config=require(_0x6568('0x7'));var controller=require(_0x6568('0x8'));router[_0x6568('0x9')]('/',auth[_0x6568('0xa')](),controller['index']);router[_0x6568('0x9')](_0x6568('0xb'),auth[_0x6568('0xa')](),controller[_0x6568('0xc')]);router[_0x6568('0x9')]('/:id',auth[_0x6568('0xa')](),controller[_0x6568('0xd')]);router[_0x6568('0xe')]('/',auth[_0x6568('0xa')](),controller[_0x6568('0xf')]);router[_0x6568('0x10')]('/:id',auth[_0x6568('0xa')](),controller['update']);router[_0x6568('0x11')](_0x6568('0x12'),auth['isAuthenticated'](),controller['destroy']);module[_0x6568('0x13')]=router; \ No newline at end of file +var _0xba33=['util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','post','put','update','destroy'];(function(_0x5e9817,_0xa29439){var _0x25b437=function(_0x46851b){while(--_0x46851b){_0x5e9817['push'](_0x5e9817['shift']());}};_0x25b437(++_0xa29439);}(_0xba33,0x120));var _0x3ba3=function(_0x5697ed,_0x2351ab){_0x5697ed=_0x5697ed-0x0;var _0x15db26=_0xba33[_0x5697ed];return _0x15db26;};'use strict';var multer=require('multer');var util=require(_0x3ba3('0x0'));var path=require('path');var timeout=require(_0x3ba3('0x1'));var express=require('express');var router=express[_0x3ba3('0x2')]();var fs_extra=require(_0x3ba3('0x3'));var auth=require(_0x3ba3('0x4'));var interaction=require(_0x3ba3('0x5'));var config=require(_0x3ba3('0x6'));var controller=require('./voiceAgentReport.controller');router[_0x3ba3('0x7')]('/',auth[_0x3ba3('0x8')](),controller[_0x3ba3('0x9')]);router[_0x3ba3('0x7')](_0x3ba3('0xa'),auth['isAuthenticated'](),controller[_0x3ba3('0xb')]);router[_0x3ba3('0x7')](_0x3ba3('0xc'),auth[_0x3ba3('0x8')](),controller[_0x3ba3('0xd')]);router[_0x3ba3('0xe')]('/',auth[_0x3ba3('0x8')](),controller['create']);router[_0x3ba3('0xf')](_0x3ba3('0xc'),auth[_0x3ba3('0x8')](),controller[_0x3ba3('0x10')]);router['delete'](_0x3ba3('0xc'),auth[_0x3ba3('0x8')](),controller[_0x3ba3('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.attributes.js b/server/api/voiceAgentReport/voiceAgentReport.attributes.js index 1d4a1c6..780976d 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 _0x4fc2=['sequelize','exports','STRING','DATE','BOOLEAN','INTEGER','FORWARD,\x20BLIND,\x20ATTENDED'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4fc2,0x111));var _0x24fc=function(_0x1c2ad4,_0x42b3bb){_0x1c2ad4=_0x1c2ad4-0x0;var _0x129a4e=_0x4fc2[_0x1c2ad4];return _0x129a4e;};'use strict';var Sequelize=require(_0x24fc('0x0'));module[_0x24fc('0x1')]={'type':{'type':Sequelize[_0x24fc('0x2')]},'uniqueid':{'type':Sequelize[_0x24fc('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x24fc('0x2')]},'queue':{'type':Sequelize[_0x24fc('0x2')]},'interface':{'type':Sequelize[_0x24fc('0x2')]},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize[_0x24fc('0x3')]},'agentconnectAt':{'type':Sequelize[_0x24fc('0x3')]},'agentcompleteAt':{'type':Sequelize['DATE']},'agentringnoanswerAt':{'type':Sequelize[_0x24fc('0x3')]},'agentdumpAt':{'type':Sequelize[_0x24fc('0x3')]},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize[_0x24fc('0x4')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0x24fc('0x4')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0x24fc('0x4')],'defaultValue':![]},'talktime':{'type':Sequelize[_0x24fc('0x5')]},'agentacw':{'type':Sequelize[_0x24fc('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x24fc('0x5')]},'reason':{'type':Sequelize['STRING']},'lastevent':{'type':Sequelize[_0x24fc('0x2')]},'channel':{'type':Sequelize[_0x24fc('0x2')]},'channelstate':{'type':Sequelize[_0x24fc('0x5')]},'channelstatedesc':{'type':Sequelize[_0x24fc('0x2')]},'connectedlinenum':{'type':Sequelize[_0x24fc('0x2')]},'connectedlinename':{'type':Sequelize[_0x24fc('0x2')]},'language':{'type':Sequelize[_0x24fc('0x2')]},'accountcode':{'type':Sequelize[_0x24fc('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x24fc('0x2')]},'priority':{'type':Sequelize[_0x24fc('0x2')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0x24fc('0x5')]},'destchannelstatedesc':{'type':Sequelize[_0x24fc('0x2')]},'destcalleridnum':{'type':Sequelize[_0x24fc('0x2')]},'destcalleridname':{'type':Sequelize[_0x24fc('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x24fc('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x24fc('0x2')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0x24fc('0x2')]},'destcontext':{'type':Sequelize[_0x24fc('0x2')]},'destexten':{'type':Sequelize[_0x24fc('0x2')]},'destpriority':{'type':Sequelize[_0x24fc('0x2')]},'destuniqueid':{'type':Sequelize['STRING']},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0x24fc('0x2')]},'answeredelsewheremembername':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize[_0x24fc('0x4')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x24fc('0x2')],'comment':_0x24fc('0x6')},'transferexten':{'type':Sequelize[_0x24fc('0x2')]},'transferuniqueid':{'type':Sequelize[_0x24fc('0x2')]},'agententerreason':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x8952=['DATE','BOOLEAN','INTEGER','FORWARD,\x20BLIND,\x20ATTENDED','exports','STRING'];(function(_0x5cc0c8,_0x403e0e){var _0x3b3f67=function(_0x4c743f){while(--_0x4c743f){_0x5cc0c8['push'](_0x5cc0c8['shift']());}};_0x3b3f67(++_0x403e0e);}(_0x8952,0x17e));var _0x2895=function(_0x155371,_0x4501a9){_0x155371=_0x155371-0x0;var _0xfd5c1f=_0x8952[_0x155371];return _0xfd5c1f;};'use strict';var Sequelize=require('sequelize');module[_0x2895('0x0')]={'type':{'type':Sequelize[_0x2895('0x1')]},'uniqueid':{'type':Sequelize[_0x2895('0x1')]},'calleridnum':{'type':Sequelize[_0x2895('0x1')]},'calleridname':{'type':Sequelize[_0x2895('0x1')]},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0x2895('0x1')]},'membername':{'type':Sequelize[_0x2895('0x1')]},'agentcalledAt':{'type':Sequelize[_0x2895('0x2')]},'agentconnectAt':{'type':Sequelize['DATE']},'agentcompleteAt':{'type':Sequelize[_0x2895('0x2')]},'agentringnoanswerAt':{'type':Sequelize[_0x2895('0x2')]},'agentdumpAt':{'type':Sequelize[_0x2895('0x2')]},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0x2895('0x3')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0x2895('0x3')],'defaultValue':![]},'talktime':{'type':Sequelize[_0x2895('0x4')]},'agentacw':{'type':Sequelize[_0x2895('0x3')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x2895('0x4')]},'reason':{'type':Sequelize['STRING']},'lastevent':{'type':Sequelize[_0x2895('0x1')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0x2895('0x4')]},'channelstatedesc':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x2895('0x1')]},'accountcode':{'type':Sequelize[_0x2895('0x1')]},'context':{'type':Sequelize[_0x2895('0x1')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x2895('0x1')]},'destchannel':{'type':Sequelize[_0x2895('0x1')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0x2895('0x1')]},'destcalleridnum':{'type':Sequelize[_0x2895('0x1')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0x2895('0x1')]},'destlanguage':{'type':Sequelize[_0x2895('0x1')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0x2895('0x1')]},'destexten':{'type':Sequelize[_0x2895('0x1')]},'destpriority':{'type':Sequelize[_0x2895('0x1')]},'destuniqueid':{'type':Sequelize[_0x2895('0x1')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0x2895('0x1')]},'answeredelsewheremembername':{'type':Sequelize[_0x2895('0x1')]},'transfer':{'type':Sequelize[_0x2895('0x3')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x2895('0x1')],'comment':_0x2895('0x5')},'transferexten':{'type':Sequelize[_0x2895('0x1')]},'transferuniqueid':{'type':Sequelize[_0x2895('0x1')]},'agententerreason':{'type':Sequelize[_0x2895('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 1afc490..67cd184 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(_0xfa634c,_0x414e0e){var _0x73e478=function(_0xac2a51){while(--_0xac2a51){_0xfa634c['push'](_0xfa634c['shift']());}};_0x73e478(++_0x414e0e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x32d457,_0x1a39c9){_0x32d457=_0x32d457-0x0;var _0x338386=_0xa9e0[_0x32d457];return _0x338386;};'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(_0x2235bf,_0x3a06a7){var _0x4c3a64=function(_0x3b3bb6){while(--_0x3b3bb6){_0x2235bf['push'](_0x2235bf['shift']());}};_0x4c3a64(++_0x3a06a7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x29b609,_0x19d388){_0x29b609=_0x29b609-0x0;var _0x54c952=_0xa9e0[_0x29b609];return _0x54c952;};'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 788bbcb..17c1a49 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 _0xd5b2=['util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','VoiceAgentReport','uniqueid'];(function(_0x308d11,_0x127248){var _0x19a106=function(_0x2a4447){while(--_0x2a4447){_0x308d11['push'](_0x308d11['shift']());}};_0x19a106(++_0x127248);}(_0xd5b2,0x10e));var _0x2d5b=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0xd5b2[_0x46aff0];return _0x9d78cf;};'use strict';var _=require('lodash');var util=require(_0x2d5b('0x0'));var logger=require(_0x2d5b('0x1'))('api');var moment=require(_0x2d5b('0x2'));var BPromise=require(_0x2d5b('0x3'));var rp=require(_0x2d5b('0x4'));var fs=require('fs');var path=require(_0x2d5b('0x5'));var rimraf=require(_0x2d5b('0x6'));var config=require(_0x2d5b('0x7'));var attributes=require('./voiceAgentReport.attributes');module['exports']=function(_0x58cff9,_0x2e1867){return _0x58cff9['define'](_0x2d5b('0x8'),attributes,{'tableName':'report_agent','paranoid':![],'indexes':[{'fields':[_0x2d5b('0x9'),'destuniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xb182=['destuniqueid','util','../../config/logger','api','request-promise','path','rimraf','./voiceAgentReport.attributes','exports','define','VoiceAgentReport','report_agent'];(function(_0x4ecd76,_0x79f1f3){var _0x240f34=function(_0x563f79){while(--_0x563f79){_0x4ecd76['push'](_0x4ecd76['shift']());}};_0x240f34(++_0x79f1f3);}(_0xb182,0x121));var _0x2b18=function(_0xe39824,_0xbdf61f){_0xe39824=_0xe39824-0x0;var _0x4bc31e=_0xb182[_0xe39824];return _0x4bc31e;};'use strict';var _=require('lodash');var util=require(_0x2b18('0x0'));var logger=require(_0x2b18('0x1'))(_0x2b18('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x2b18('0x3'));var fs=require('fs');var path=require(_0x2b18('0x4'));var rimraf=require(_0x2b18('0x5'));var config=require('../../config/environment');var attributes=require(_0x2b18('0x6'));module[_0x2b18('0x7')]=function(_0x22eae8,_0x31236f){return _0x22eae8[_0x2b18('0x8')](_0x2b18('0x9'),attributes,{'tableName':_0x2b18('0xa'),'paranoid':![],'indexes':[{'fields':['uniqueid',_0x2b18('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 d204b3b..70ac0fb 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 _0x38b9=['result','catch','CreateVoiceAgentReport','VoiceAgentReport','create','options','raw','UpdateVoiceAgentReport','update','where','attributes','limit','moment','bluebird','../../mysqldb','../../config/logger','rpc','client','http','request','then','info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x5eaa93,_0x2789be){var _0x476be3=function(_0x1da0bb){while(--_0x1da0bb){_0x5eaa93['push'](_0x5eaa93['shift']());}};_0x476be3(++_0x2789be);}(_0x38b9,0x66));var _0x938b=function(_0x34b195,_0x1fea3a){_0x34b195=_0x34b195-0x0;var _0x9dd4e7=_0x38b9[_0x34b195];return _0x9dd4e7;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x938b('0x0'));var BPromise=require(_0x938b('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x938b('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0x938b('0x3'))(_0x938b('0x4'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x938b('0x5')][_0x938b('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x324b64,_0x49cb58,_0x2a6fb9){return new BPromise(function(_0x27f5bc,_0x12d947){return client[_0x938b('0x7')](_0x324b64,_0x2a6fb9)[_0x938b('0x8')](function(_0x4aa57f){logger[_0x938b('0x9')](_0x938b('0xa'),_0x49cb58,_0x938b('0xb'));logger[_0x938b('0xc')](_0x938b('0xd'),_0x49cb58,_0x938b('0xb'),JSON[_0x938b('0xe')](_0x4aa57f));if(_0x4aa57f[_0x938b('0xf')]){if(_0x4aa57f[_0x938b('0xf')][_0x938b('0x10')]===0x1f4){logger['error'](_0x938b('0xa'),_0x49cb58,_0x4aa57f[_0x938b('0xf')][_0x938b('0x11')]);return _0x12d947(_0x4aa57f[_0x938b('0xf')][_0x938b('0x11')]);}logger[_0x938b('0xf')]('VoiceAgentReport,\x20%s,\x20%s',_0x49cb58,_0x4aa57f[_0x938b('0xf')][_0x938b('0x11')]);return _0x27f5bc(_0x4aa57f[_0x938b('0xf')][_0x938b('0x11')]);}else{logger[_0x938b('0x9')](_0x938b('0xa'),_0x49cb58,_0x938b('0xb'));_0x27f5bc(_0x4aa57f[_0x938b('0x12')]['message']);}})[_0x938b('0x13')](function(_0x4378c0){logger[_0x938b('0xf')]('VoiceAgentReport,\x20%s,\x20%s',_0x49cb58,_0x4378c0);_0x12d947(_0x4378c0);});});}exports[_0x938b('0x14')]=function(_0x4f0055){var _0x90fb36=this;return new Promise(function(_0x3be7b7,_0x421893){return db[_0x938b('0x15')][_0x938b('0x16')](_0x4f0055['body'],{'raw':_0x4f0055['options']?_0x4f0055[_0x938b('0x17')][_0x938b('0x18')]===undefined?!![]:![]:!![]})[_0x938b('0x8')](function(_0x13d918){logger['info'](_0x938b('0x14'),_0x4f0055);logger[_0x938b('0xc')](_0x938b('0x14'),_0x4f0055,JSON[_0x938b('0xe')](_0x13d918));_0x3be7b7(_0x13d918);})[_0x938b('0x13')](function(_0x3a336c){logger[_0x938b('0xf')](_0x938b('0x14'),_0x3a336c[_0x938b('0x11')],_0x4f0055);_0x421893(_0x90fb36[_0x938b('0xf')](0x1f4,_0x3a336c['message']));});});};exports[_0x938b('0x19')]=function(_0xeac4e7){var _0x5b9eb5=this;return new Promise(function(_0x3b996f,_0x2d9252){return db[_0x938b('0x15')][_0x938b('0x1a')](_0xeac4e7['body'],{'raw':_0xeac4e7[_0x938b('0x17')]?_0xeac4e7[_0x938b('0x17')][_0x938b('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xeac4e7['options']?_0xeac4e7['options'][_0x938b('0x1b')]||null:null,'attributes':_0xeac4e7[_0x938b('0x17')]?_0xeac4e7[_0x938b('0x17')][_0x938b('0x1c')]||null:null,'limit':_0xeac4e7[_0x938b('0x17')]?_0xeac4e7[_0x938b('0x17')][_0x938b('0x1d')]||null:null})[_0x938b('0x8')](function(_0x4a6d83){logger[_0x938b('0x9')](_0x938b('0x19'),_0xeac4e7);logger[_0x938b('0xc')](_0x938b('0x19'),_0xeac4e7,JSON[_0x938b('0xe')](_0x4a6d83));_0x3b996f(_0x4a6d83);})[_0x938b('0x13')](function(_0x358dfe){logger[_0x938b('0xf')](_0x938b('0x19'),_0x358dfe[_0x938b('0x11')],_0xeac4e7);_0x2d9252(_0x5b9eb5[_0x938b('0xf')](0x1f4,_0x358dfe[_0x938b('0x11')]));});});}; \ No newline at end of file +var _0x6476=['../../config/environment','client','request','then','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','VoiceAgentReport','body','options','raw','CreateVoiceAgentReport','debug','UpdateVoiceAgentReport','where','attributes','limit','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x1e9ace,_0xbcc2eb){var _0x8b6958=function(_0x1898d0){while(--_0x1898d0){_0x1e9ace['push'](_0x1e9ace['shift']());}};_0x8b6958(++_0xbcc2eb);}(_0x6476,0x139));var _0x6647=function(_0x550d12,_0x5384bd){_0x550d12=_0x550d12-0x0;var _0x12103d=_0x6476[_0x550d12];return _0x12103d;};'use strict';var _=require(_0x6647('0x0'));var util=require('util');var moment=require(_0x6647('0x1'));var BPromise=require('bluebird');var rs=require(_0x6647('0x2'));var fs=require('fs');var Redis=require(_0x6647('0x3'));var db=require(_0x6647('0x4'))['db'];var utils=require(_0x6647('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x6647('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x6647('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4f7a3e,_0x5c3a4a,_0x148a1b){return new BPromise(function(_0x37f966,_0x413f1d){return client[_0x6647('0x8')](_0x4f7a3e,_0x148a1b)[_0x6647('0x9')](function(_0x3f65cb){logger['info'](_0x6647('0xa'),_0x5c3a4a,_0x6647('0xb'));logger['debug'](_0x6647('0xc'),_0x5c3a4a,_0x6647('0xb'),JSON[_0x6647('0xd')](_0x3f65cb));if(_0x3f65cb[_0x6647('0xe')]){if(_0x3f65cb[_0x6647('0xe')][_0x6647('0xf')]===0x1f4){logger[_0x6647('0xe')](_0x6647('0xa'),_0x5c3a4a,_0x3f65cb[_0x6647('0xe')][_0x6647('0x10')]);return _0x413f1d(_0x3f65cb[_0x6647('0xe')][_0x6647('0x10')]);}logger['error'](_0x6647('0xa'),_0x5c3a4a,_0x3f65cb[_0x6647('0xe')][_0x6647('0x10')]);return _0x37f966(_0x3f65cb[_0x6647('0xe')][_0x6647('0x10')]);}else{logger[_0x6647('0x11')](_0x6647('0xa'),_0x5c3a4a,_0x6647('0xb'));_0x37f966(_0x3f65cb['result'][_0x6647('0x10')]);}})[_0x6647('0x12')](function(_0x3499b8){logger[_0x6647('0xe')]('VoiceAgentReport,\x20%s,\x20%s',_0x5c3a4a,_0x3499b8);_0x413f1d(_0x3499b8);});});}exports['CreateVoiceAgentReport']=function(_0x3bac09){var _0xcc9a75=this;return new Promise(function(_0x36d400,_0x152103){return db[_0x6647('0x13')]['create'](_0x3bac09[_0x6647('0x14')],{'raw':_0x3bac09['options']?_0x3bac09[_0x6647('0x15')][_0x6647('0x16')]===undefined?!![]:![]:!![]})[_0x6647('0x9')](function(_0x202100){logger[_0x6647('0x11')](_0x6647('0x17'),_0x3bac09);logger[_0x6647('0x18')](_0x6647('0x17'),_0x3bac09,JSON[_0x6647('0xd')](_0x202100));_0x36d400(_0x202100);})[_0x6647('0x12')](function(_0x4270c3){logger[_0x6647('0xe')]('CreateVoiceAgentReport',_0x4270c3[_0x6647('0x10')],_0x3bac09);_0x152103(_0xcc9a75['error'](0x1f4,_0x4270c3['message']));});});};exports[_0x6647('0x19')]=function(_0x114886){var _0x565218=this;return new Promise(function(_0x436fce,_0x7849c6){return db['VoiceAgentReport']['update'](_0x114886[_0x6647('0x14')],{'raw':_0x114886[_0x6647('0x15')]?_0x114886[_0x6647('0x15')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x114886['options']?_0x114886[_0x6647('0x15')][_0x6647('0x1a')]||null:null,'attributes':_0x114886[_0x6647('0x15')]?_0x114886['options'][_0x6647('0x1b')]||null:null,'limit':_0x114886[_0x6647('0x15')]?_0x114886['options'][_0x6647('0x1c')]||null:null})[_0x6647('0x9')](function(_0x336cf2){logger[_0x6647('0x11')](_0x6647('0x19'),_0x114886);logger[_0x6647('0x18')](_0x6647('0x19'),_0x114886,JSON[_0x6647('0xd')](_0x336cf2));_0x436fce(_0x336cf2);})[_0x6647('0x12')](function(_0x3eb7ec){logger[_0x6647('0xe')](_0x6647('0x19'),_0x3eb7ec['message'],_0x114886);_0x7849c6(_0x565218[_0x6647('0xe')](0x1f4,_0x3eb7ec[_0x6647('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index 1a8921a..77c94be 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 _0xac9d=['../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','show','post','create','put','/:id','update','exports','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xac9d,0x14d));var _0xdac9=function(_0xcdfc4f,_0x8a111a){_0xcdfc4f=_0xcdfc4f-0x0;var _0x3f70d1=_0xac9d[_0xcdfc4f];return _0x3f70d1;};'use strict';var multer=require(_0xdac9('0x0'));var util=require(_0xdac9('0x1'));var path=require(_0xdac9('0x2'));var timeout=require(_0xdac9('0x3'));var express=require(_0xdac9('0x4'));var router=express[_0xdac9('0x5')]();var fs_extra=require(_0xdac9('0x6'));var auth=require(_0xdac9('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xdac9('0x8'));var controller=require('./voiceCallReport.controller');router[_0xdac9('0x9')]('/',auth[_0xdac9('0xa')](),controller[_0xdac9('0xb')]);router[_0xdac9('0x9')](_0xdac9('0xc'),auth[_0xdac9('0xa')](),controller['describe']);router[_0xdac9('0x9')]('/:id',auth[_0xdac9('0xa')](),controller[_0xdac9('0xd')]);router[_0xdac9('0xe')]('/',auth[_0xdac9('0xa')](),controller[_0xdac9('0xf')]);router[_0xdac9('0x10')](_0xdac9('0x11'),auth[_0xdac9('0xa')](),controller[_0xdac9('0x12')]);router['delete'](_0xdac9('0x11'),auth[_0xdac9('0xa')](),controller['destroy']);module[_0xdac9('0x13')]=router; \ No newline at end of file +var _0xb138=['connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceCallReport.controller','isAuthenticated','index','/describe','describe','/:id','create','put','delete','destroy','exports','multer','util','path'];(function(_0x2627df,_0x3887e9){var _0x388825=function(_0x303291){while(--_0x303291){_0x2627df['push'](_0x2627df['shift']());}};_0x388825(++_0x3887e9);}(_0xb138,0x1dd));var _0x8b13=function(_0x133a18,_0x14ba98){_0x133a18=_0x133a18-0x0;var _0x394b44=_0xb138[_0x133a18];return _0x394b44;};'use strict';var multer=require(_0x8b13('0x0'));var util=require(_0x8b13('0x1'));var path=require(_0x8b13('0x2'));var timeout=require(_0x8b13('0x3'));var express=require(_0x8b13('0x4'));var router=express[_0x8b13('0x5')]();var fs_extra=require(_0x8b13('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x8b13('0x7'));var config=require(_0x8b13('0x8'));var controller=require(_0x8b13('0x9'));router['get']('/',auth[_0x8b13('0xa')](),controller[_0x8b13('0xb')]);router['get'](_0x8b13('0xc'),auth[_0x8b13('0xa')](),controller[_0x8b13('0xd')]);router['get'](_0x8b13('0xe'),auth[_0x8b13('0xa')](),controller['show']);router['post']('/',auth[_0x8b13('0xa')](),controller[_0x8b13('0xf')]);router[_0x8b13('0x10')](_0x8b13('0xe'),auth[_0x8b13('0xa')](),controller['update']);router[_0x8b13('0x11')](_0x8b13('0xe'),auth[_0x8b13('0xa')](),controller[_0x8b13('0x12')]);module[_0x8b13('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.attributes.js b/server/api/voiceCallReport/voiceCallReport.attributes.js index c5b27f9..d5705ac 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 _0x33ad=['internal','outbound','inbound-fax','TEXT','DATE','INTEGER','exports','STRING','ENUM','inbound'];(function(_0x24e049,_0x2fd934){var _0x50cd38=function(_0x1853e7){while(--_0x1853e7){_0x24e049['push'](_0x24e049['shift']());}};_0x50cd38(++_0x2fd934);}(_0x33ad,0x74));var _0xd33a=function(_0x153d2f,_0x2182bb){_0x153d2f=_0x153d2f-0x0;var _0x410a29=_0x33ad[_0x153d2f];return _0x410a29;};'use strict';var Sequelize=require('sequelize');module[_0xd33a('0x0')]={'uniqueid':{'type':Sequelize[_0xd33a('0x1')]},'type':{'type':Sequelize[_0xd33a('0x2')](_0xd33a('0x3'),_0xd33a('0x4'),_0xd33a('0x5'),_0xd33a('0x6'),'outbound-fax','dialer')},'tag':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize['STRING']},'source':{'type':Sequelize[_0xd33a('0x1')]},'destination':{'type':Sequelize[_0xd33a('0x1')]},'destinationcontext':{'type':Sequelize[_0xd33a('0x1')]},'callerid':{'type':Sequelize[_0xd33a('0x1')]},'channel':{'type':Sequelize[_0xd33a('0x1')]},'destinationchannel':{'type':Sequelize['STRING']},'lastapplication':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize[_0xd33a('0x7')]},'starttime':{'type':Sequelize[_0xd33a('0x8')]},'systemanswertime':{'type':Sequelize[_0xd33a('0x8')]},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0xd33a('0x8')]},'duration':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize[_0xd33a('0x9')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xd33a('0x1')]},'amaflags':{'type':Sequelize[_0xd33a('0x1')]},'userfield':{'type':Sequelize[_0xd33a('0x1')]},'userDisposition':{'type':Sequelize[_0xd33a('0x1')]},'userSecondDisposition':{'type':Sequelize[_0xd33a('0x1')]},'userThirdDisposition':{'type':Sequelize[_0xd33a('0x1')]},'note':{'type':Sequelize[_0xd33a('0x1')]},'prefix':{'type':Sequelize[_0xd33a('0x1')]},'routeid':{'type':Sequelize[_0xd33a('0x9')]},'sipcallid':{'type':Sequelize[_0xd33a('0x1')]}}; \ No newline at end of file +var _0xaf3f=['STRING','ENUM','inbound','internal','outbound','inbound-fax','outbound-fax','dialer','DATE','INTEGER','sequelize','exports'];(function(_0x365714,_0x44e99a){var _0xe4e943=function(_0x24436d){while(--_0x24436d){_0x365714['push'](_0x365714['shift']());}};_0xe4e943(++_0x44e99a);}(_0xaf3f,0x11e));var _0xfaf3=function(_0x58b4e4,_0x2e3672){_0x58b4e4=_0x58b4e4-0x0;var _0x136827=_0xaf3f[_0x58b4e4];return _0x136827;};'use strict';var Sequelize=require(_0xfaf3('0x0'));module[_0xfaf3('0x1')]={'uniqueid':{'type':Sequelize[_0xfaf3('0x2')]},'type':{'type':Sequelize[_0xfaf3('0x3')](_0xfaf3('0x4'),_0xfaf3('0x5'),_0xfaf3('0x6'),_0xfaf3('0x7'),_0xfaf3('0x8'),_0xfaf3('0x9'))},'tag':{'type':Sequelize[_0xfaf3('0x2')]},'accountcode':{'type':Sequelize[_0xfaf3('0x2')]},'source':{'type':Sequelize['STRING']},'destination':{'type':Sequelize[_0xfaf3('0x2')]},'destinationcontext':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xfaf3('0x2')]},'destinationchannel':{'type':Sequelize[_0xfaf3('0x2')]},'lastapplication':{'type':Sequelize[_0xfaf3('0x2')]},'lastdata':{'type':Sequelize['TEXT']},'starttime':{'type':Sequelize['DATE']},'systemanswertime':{'type':Sequelize[_0xfaf3('0xa')]},'answertime':{'type':Sequelize[_0xfaf3('0xa')]},'endtime':{'type':Sequelize[_0xfaf3('0xa')]},'duration':{'type':Sequelize[_0xfaf3('0xb')]},'billableseconds':{'type':Sequelize[_0xfaf3('0xb')]},'mohtime':{'type':Sequelize[_0xfaf3('0xb')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xfaf3('0x2')]},'amaflags':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize[_0xfaf3('0x2')]},'userDisposition':{'type':Sequelize[_0xfaf3('0x2')]},'userSecondDisposition':{'type':Sequelize[_0xfaf3('0x2')]},'userThirdDisposition':{'type':Sequelize[_0xfaf3('0x2')]},'note':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize[_0xfaf3('0x2')]},'routeid':{'type':Sequelize['INTEGER']},'sipcallid':{'type':Sequelize[_0xfaf3('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index 60f4b98..1947191 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 _0x2ef3=['pick','filter','merge','options','VoiceCallReport','then','includeAll','include','fullname','alias','User','findAll','rows','catch','show','params','keys','find','create','destroy','describe','body','uniqueid','user','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where'];(function(_0x5a95fa,_0x4a2fc9){var _0x1a61b8=function(_0x59f119){while(--_0x59f119){_0x5a95fa['push'](_0x5a95fa['shift']());}};_0x1a61b8(++_0x4a2fc9);}(_0x2ef3,0xba));var _0x32ef=function(_0x52f7dd,_0x421149){_0x52f7dd=_0x52f7dd-0x0;var _0x5c9dda=_0x2ef3[_0x52f7dd];return _0x5c9dda;};'use strict';var emlformat=require(_0x32ef('0x0'));var rimraf=require(_0x32ef('0x1'));var zipdir=require(_0x32ef('0x2'));var jsonpatch=require(_0x32ef('0x3'));var rp=require(_0x32ef('0x4'));var moment=require(_0x32ef('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x32ef('0x6'));var util=require(_0x32ef('0x7'));var path=require('path');var sox=require(_0x32ef('0x8'));var csv=require(_0x32ef('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x32ef('0xa'));var squel=require(_0x32ef('0xb'));var crypto=require(_0x32ef('0xc'));var jsforce=require(_0x32ef('0xd'));var deskjs=require(_0x32ef('0xe'));var toCsv=require(_0x32ef('0x9'));var querystring=require(_0x32ef('0xf'));var Papa=require(_0x32ef('0x10'));var Redis=require(_0x32ef('0x11'));var authService=require(_0x32ef('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x32ef('0x13'));var logger=require(_0x32ef('0x14'))(_0x32ef('0x15'));var utils=require(_0x32ef('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x32ef('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1a5106,_0x49d590){_0x49d590=_0x49d590||0xcc;return function(_0x3e98df){if(_0x3e98df){return _0x1a5106[_0x32ef('0x18')](_0x49d590);}return _0x1a5106['status'](_0x49d590)['end']();};}function respondWithResult(_0x19ce1,_0x4d8009){_0x4d8009=_0x4d8009||0xc8;return function(_0x326fce){if(_0x326fce){return _0x19ce1[_0x32ef('0x19')](_0x4d8009)[_0x32ef('0x1a')](_0x326fce);}};}function respondWithFilteredResult(_0x54c7f5,_0x57aff1){return function(_0x55bf0b){if(_0x55bf0b){var _0x531e30=typeof _0x57aff1[_0x32ef('0x1b')]===_0x32ef('0x1c')&&typeof _0x57aff1[_0x32ef('0x1d')]==='undefined';var _0x5d559b=_0x55bf0b[_0x32ef('0x1e')];var _0x1a9476=_0x531e30?0x0:_0x57aff1[_0x32ef('0x1b')];var _0x57863c=_0x531e30?_0x55bf0b[_0x32ef('0x1e')]:_0x57aff1[_0x32ef('0x1b')]+_0x57aff1['limit'];var _0x304505;if(_0x57863c>=_0x5d559b){_0x57863c=_0x5d559b;_0x304505=0xc8;}else{_0x304505=0xce;}_0x54c7f5[_0x32ef('0x19')](_0x304505);return _0x54c7f5[_0x32ef('0x1f')](_0x32ef('0x20'),_0x1a9476+'-'+_0x57863c+'/'+_0x5d559b)[_0x32ef('0x1a')](_0x55bf0b);}return null;};}function patchUpdates(_0x3aec05){return function(_0x4de441){try{jsonpatch[_0x32ef('0x21')](_0x4de441,_0x3aec05,!![]);}catch(_0x5cc3ef){return BPromise[_0x32ef('0x22')](_0x5cc3ef);}return _0x4de441[_0x32ef('0x23')]();};}function saveUpdates(_0x49f2d8,_0x1af371){return function(_0x97780){if(_0x97780){return _0x97780[_0x32ef('0x24')](_0x49f2d8)['then'](function(_0x57f5e5){return _0x57f5e5;});}return null;};}function removeEntity(_0x22f2d7,_0xb30fab){return function(_0x225feb){if(_0x225feb){return _0x225feb['destroy']()['then'](function(){_0x22f2d7[_0x32ef('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x51a412,_0x278495){return function(_0x14d4b3){if(!_0x14d4b3){_0x51a412[_0x32ef('0x18')](0x194);}return _0x14d4b3;};}function handleError(_0x1dbe98,_0x15ce54){_0x15ce54=_0x15ce54||0x1f4;return function(_0x234175){logger[_0x32ef('0x25')](_0x234175[_0x32ef('0x26')]);if(_0x234175[_0x32ef('0x27')]){delete _0x234175[_0x32ef('0x27')];}_0x1dbe98[_0x32ef('0x19')](_0x15ce54)[_0x32ef('0x28')](_0x234175);};}exports['index']=function(_0xd65fde,_0x2f5d06){var _0x5a04cd={},_0x12de1a={},_0x3c569d={'count':0x0,'rows':[]};var _0x30b250=_[_0x32ef('0x29')](db['VoiceCallReport'][_0x32ef('0x2a')],function(_0x22bf86){return{'name':_0x22bf86[_0x32ef('0x2b')],'type':_0x22bf86[_0x32ef('0x2c')][_0x32ef('0x2d')]};});_0x12de1a[_0x32ef('0x2e')]=_[_0x32ef('0x29')](_0x30b250,'name');_0x12de1a[_0x32ef('0x2f')]=_['keys'](_0xd65fde[_0x32ef('0x2f')]);_0x12de1a[_0x32ef('0x30')]=_['intersection'](_0x12de1a[_0x32ef('0x2e')],_0x12de1a[_0x32ef('0x2f')]);_0x5a04cd[_0x32ef('0x31')]=_[_0x32ef('0x32')](_0x12de1a[_0x32ef('0x2e')],qs['fields'](_0xd65fde['query'][_0x32ef('0x33')]));_0x5a04cd['attributes']=_0x5a04cd[_0x32ef('0x31')][_0x32ef('0x34')]?_0x5a04cd[_0x32ef('0x31')]:_0x12de1a[_0x32ef('0x2e')];if(!_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x35')]('nolimit')){_0x5a04cd['limit']=qs['limit'](_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x1d')]);_0x5a04cd[_0x32ef('0x1b')]=qs['offset'](_0xd65fde['query'][_0x32ef('0x1b')]);}_0x5a04cd[_0x32ef('0x36')]=qs[_0x32ef('0x37')](_0xd65fde['query']['sort']);_0x5a04cd[_0x32ef('0x38')]=qs[_0x32ef('0x30')](_[_0x32ef('0x39')](_0xd65fde[_0x32ef('0x2f')],_0x12de1a[_0x32ef('0x30')]),_0x30b250);if(_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x3a')]){_0x5a04cd[_0x32ef('0x38')]=_[_0x32ef('0x3b')](_0x5a04cd['where'],{'$or':_[_0x32ef('0x29')](_0x30b250,function(_0x36e374){if(_0x36e374[_0x32ef('0x2c')]!=='VIRTUAL'){var _0x365125={};_0x365125[_0x36e374[_0x32ef('0x27')]]={'$like':'%'+_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x3a')]+'%'};return _0x365125;}})});}_0x5a04cd=_[_0x32ef('0x3b')]({},_0x5a04cd,_0xd65fde[_0x32ef('0x3c')]);var _0x256c40={'where':_0x5a04cd[_0x32ef('0x38')]};return db[_0x32ef('0x3d')][_0x32ef('0x1e')](_0x256c40)[_0x32ef('0x3e')](function(_0x4615b4){_0x3c569d['count']=_0x4615b4;if(_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x3f')]){_0x5a04cd[_0x32ef('0x40')]=[{'attributes':['id',_0x32ef('0x27'),_0x32ef('0x41'),_0x32ef('0x42')],'model':db[_0x32ef('0x43')],'as':'User'}];}return db['VoiceCallReport'][_0x32ef('0x44')](_0x5a04cd);})[_0x32ef('0x3e')](function(_0x2a33dd){_0x3c569d[_0x32ef('0x45')]=_0x2a33dd;return _0x3c569d;})['then'](respondWithFilteredResult(_0x2f5d06,_0x5a04cd))[_0x32ef('0x46')](handleError(_0x2f5d06,null));};exports[_0x32ef('0x47')]=function(_0x5d2f06,_0x4744ba){var _0x4bc5bc={'raw':!![],'where':{'id':_0x5d2f06[_0x32ef('0x48')]['id']}},_0xcb3c08={};_0xcb3c08[_0x32ef('0x2e')]=_[_0x32ef('0x49')](db[_0x32ef('0x3d')][_0x32ef('0x2a')]);_0xcb3c08[_0x32ef('0x2f')]=_[_0x32ef('0x49')](_0x5d2f06[_0x32ef('0x2f')]);_0xcb3c08[_0x32ef('0x30')]=_['intersection'](_0xcb3c08[_0x32ef('0x2e')],_0xcb3c08['query']);_0x4bc5bc[_0x32ef('0x31')]=_[_0x32ef('0x32')](_0xcb3c08[_0x32ef('0x2e')],qs['fields'](_0x5d2f06[_0x32ef('0x2f')][_0x32ef('0x33')]));_0x4bc5bc[_0x32ef('0x31')]=_0x4bc5bc[_0x32ef('0x31')][_0x32ef('0x34')]?_0x4bc5bc[_0x32ef('0x31')]:_0xcb3c08[_0x32ef('0x2e')];if(_0x5d2f06['query']['includeAll']){_0x4bc5bc[_0x32ef('0x40')]=[{'all':!![]}];}_0x4bc5bc=_[_0x32ef('0x3b')]({},_0x4bc5bc,_0x5d2f06[_0x32ef('0x3c')]);return db[_0x32ef('0x3d')][_0x32ef('0x4a')](_0x4bc5bc)[_0x32ef('0x3e')](handleEntityNotFound(_0x4744ba,null))[_0x32ef('0x3e')](respondWithResult(_0x4744ba,null))[_0x32ef('0x46')](handleError(_0x4744ba,null));};exports[_0x32ef('0x4b')]=function(_0x1ebedf,_0x35a294){return db[_0x32ef('0x3d')][_0x32ef('0x4b')](_0x1ebedf['body'],{})[_0x32ef('0x3e')](respondWithResult(_0x35a294,0xc9))[_0x32ef('0x46')](handleError(_0x35a294,null));};exports[_0x32ef('0x4c')]=function(_0xd42609,_0x1cc9f3){return db[_0x32ef('0x3d')][_0x32ef('0x4a')]({'where':{'id':_0xd42609[_0x32ef('0x48')]['id']}})[_0x32ef('0x3e')](handleEntityNotFound(_0x1cc9f3,null))[_0x32ef('0x3e')](removeEntity(_0x1cc9f3,null))[_0x32ef('0x46')](handleError(_0x1cc9f3,null));};exports[_0x32ef('0x4d')]=function(_0x272377,_0x326445){return db[_0x32ef('0x3d')][_0x32ef('0x4d')]()[_0x32ef('0x3e')](respondWithResult(_0x326445,null))[_0x32ef('0x46')](handleError(_0x326445,null));};exports['update']=function(_0x515ac9,_0x179c2f){if(_0x515ac9[_0x32ef('0x4e')][_0x32ef('0x4f')]){delete _0x515ac9[_0x32ef('0x4e')][_0x32ef('0x4f')];}return db[_0x32ef('0x3d')][_0x32ef('0x4a')]({'where':{'uniqueid':_0x515ac9[_0x32ef('0x48')]['id'],'UserId':{'$or':[null,_0x515ac9[_0x32ef('0x50')]['id']]}}})[_0x32ef('0x3e')](handleEntityNotFound(_0x179c2f,null))[_0x32ef('0x3e')](saveUpdates(_0x515ac9['body'],null))[_0x32ef('0x3e')](respondWithResult(_0x179c2f,null))[_0x32ef('0x46')](handleError(_0x179c2f,null));}; \ No newline at end of file +var _0xadb5=['filter','VIRTUAL','merge','options','includeAll','include','fullname','User','findAll','rows','show','rawAttributes','length','find','catch','body','params','describe','uniqueid','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','end','stack','name','send','index','map','VoiceCallReport','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filters'];(function(_0x4370c7,_0x5dbfb0){var _0xce78a9=function(_0x157b2c){while(--_0x157b2c){_0x4370c7['push'](_0x4370c7['shift']());}};_0xce78a9(++_0x5dbfb0);}(_0xadb5,0xad));var _0x5adb=function(_0x3d600c,_0x416db8){_0x3d600c=_0x3d600c-0x0;var _0x5efa88=_0xadb5[_0x3d600c];return _0x5efa88;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5adb('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5adb('0x1'));var rp=require(_0x5adb('0x2'));var moment=require(_0x5adb('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x5adb('0x4'));var util=require(_0x5adb('0x5'));var path=require(_0x5adb('0x6'));var sox=require('sox');var csv=require(_0x5adb('0x7'));var ejs=require(_0x5adb('0x8'));var fs=require('fs');var fs_extra=require(_0x5adb('0x9'));var _=require(_0x5adb('0xa'));var squel=require(_0x5adb('0xb'));var crypto=require(_0x5adb('0xc'));var jsforce=require(_0x5adb('0xd'));var deskjs=require(_0x5adb('0xe'));var toCsv=require(_0x5adb('0x7'));var querystring=require(_0x5adb('0xf'));var Papa=require(_0x5adb('0x10'));var Redis=require(_0x5adb('0x11'));var authService=require(_0x5adb('0x12'));var qs=require(_0x5adb('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x5adb('0x14'))(_0x5adb('0x15'));var utils=require(_0x5adb('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x5adb('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2a0b70,_0x5433bf){_0x5433bf=_0x5433bf||0xcc;return function(_0x8cfcc6){if(_0x8cfcc6){return _0x2a0b70[_0x5adb('0x18')](_0x5433bf);}return _0x2a0b70[_0x5adb('0x19')](_0x5433bf)['end']();};}function respondWithResult(_0x2a545b,_0x34af2c){_0x34af2c=_0x34af2c||0xc8;return function(_0xf82f72){if(_0xf82f72){return _0x2a545b['status'](_0x34af2c)[_0x5adb('0x1a')](_0xf82f72);}};}function respondWithFilteredResult(_0x518823,_0x367d82){return function(_0x42a482){if(_0x42a482){var _0x30614e=typeof _0x367d82[_0x5adb('0x1b')]===_0x5adb('0x1c')&&typeof _0x367d82[_0x5adb('0x1d')]===_0x5adb('0x1c');var _0x42f4c6=_0x42a482[_0x5adb('0x1e')];var _0x529b65=_0x30614e?0x0:_0x367d82[_0x5adb('0x1b')];var _0x5de028=_0x30614e?_0x42a482[_0x5adb('0x1e')]:_0x367d82['offset']+_0x367d82[_0x5adb('0x1d')];var _0x50e84f;if(_0x5de028>=_0x42f4c6){_0x5de028=_0x42f4c6;_0x50e84f=0xc8;}else{_0x50e84f=0xce;}_0x518823['status'](_0x50e84f);return _0x518823[_0x5adb('0x1f')](_0x5adb('0x20'),_0x529b65+'-'+_0x5de028+'/'+_0x42f4c6)[_0x5adb('0x1a')](_0x42a482);}return null;};}function patchUpdates(_0x1fd4a7){return function(_0x99bc6c){try{jsonpatch['apply'](_0x99bc6c,_0x1fd4a7,!![]);}catch(_0x3255b3){return BPromise['reject'](_0x3255b3);}return _0x99bc6c['save']();};}function saveUpdates(_0x3754cc,_0x379b33){return function(_0x1a38d3){if(_0x1a38d3){return _0x1a38d3[_0x5adb('0x21')](_0x3754cc)[_0x5adb('0x22')](function(_0x413911){return _0x413911;});}return null;};}function removeEntity(_0xfd9bb9,_0x4ca150){return function(_0x4b1957){if(_0x4b1957){return _0x4b1957[_0x5adb('0x23')]()[_0x5adb('0x22')](function(){_0xfd9bb9[_0x5adb('0x19')](0xcc)[_0x5adb('0x24')]();});}};}function handleEntityNotFound(_0x49f203,_0x2fee18){return function(_0x2e1e63){if(!_0x2e1e63){_0x49f203['sendStatus'](0x194);}return _0x2e1e63;};}function handleError(_0x1feecf,_0x1ded9f){_0x1ded9f=_0x1ded9f||0x1f4;return function(_0x1a0acd){logger['error'](_0x1a0acd[_0x5adb('0x25')]);if(_0x1a0acd[_0x5adb('0x26')]){delete _0x1a0acd[_0x5adb('0x26')];}_0x1feecf[_0x5adb('0x19')](_0x1ded9f)[_0x5adb('0x27')](_0x1a0acd);};}exports[_0x5adb('0x28')]=function(_0x4a5d46,_0x49992e){var _0x5d457e={},_0x39bddd={},_0x1eac55={'count':0x0,'rows':[]};var _0x60a672=_[_0x5adb('0x29')](db[_0x5adb('0x2a')]['rawAttributes'],function(_0x11ec2a){return{'name':_0x11ec2a[_0x5adb('0x2b')],'type':_0x11ec2a[_0x5adb('0x2c')][_0x5adb('0x2d')]};});_0x39bddd[_0x5adb('0x2e')]=_[_0x5adb('0x29')](_0x60a672,_0x5adb('0x26'));_0x39bddd[_0x5adb('0x2f')]=_[_0x5adb('0x30')](_0x4a5d46[_0x5adb('0x2f')]);_0x39bddd['filters']=_[_0x5adb('0x31')](_0x39bddd['model'],_0x39bddd[_0x5adb('0x2f')]);_0x5d457e[_0x5adb('0x32')]=_['intersection'](_0x39bddd[_0x5adb('0x2e')],qs[_0x5adb('0x33')](_0x4a5d46[_0x5adb('0x2f')]['fields']));_0x5d457e[_0x5adb('0x32')]=_0x5d457e[_0x5adb('0x32')]['length']?_0x5d457e['attributes']:_0x39bddd[_0x5adb('0x2e')];if(!_0x4a5d46['query'][_0x5adb('0x34')](_0x5adb('0x35'))){_0x5d457e[_0x5adb('0x1d')]=qs[_0x5adb('0x1d')](_0x4a5d46[_0x5adb('0x2f')]['limit']);_0x5d457e[_0x5adb('0x1b')]=qs[_0x5adb('0x1b')](_0x4a5d46[_0x5adb('0x2f')]['offset']);}_0x5d457e['order']=qs[_0x5adb('0x36')](_0x4a5d46[_0x5adb('0x2f')]['sort']);_0x5d457e[_0x5adb('0x37')]=qs['filters'](_[_0x5adb('0x38')](_0x4a5d46['query'],_0x39bddd[_0x5adb('0x39')]),_0x60a672);if(_0x4a5d46['query'][_0x5adb('0x3a')]){_0x5d457e[_0x5adb('0x37')]=_['merge'](_0x5d457e[_0x5adb('0x37')],{'$or':_['map'](_0x60a672,function(_0xadbe37){if(_0xadbe37[_0x5adb('0x2c')]!==_0x5adb('0x3b')){var _0x50edd1={};_0x50edd1[_0xadbe37[_0x5adb('0x26')]]={'$like':'%'+_0x4a5d46[_0x5adb('0x2f')][_0x5adb('0x3a')]+'%'};return _0x50edd1;}})});}_0x5d457e=_[_0x5adb('0x3c')]({},_0x5d457e,_0x4a5d46[_0x5adb('0x3d')]);var _0x52d74f={'where':_0x5d457e['where']};return db['VoiceCallReport']['count'](_0x52d74f)[_0x5adb('0x22')](function(_0x2fbe14){_0x1eac55[_0x5adb('0x1e')]=_0x2fbe14;if(_0x4a5d46[_0x5adb('0x2f')][_0x5adb('0x3e')]){_0x5d457e[_0x5adb('0x3f')]=[{'attributes':['id',_0x5adb('0x26'),_0x5adb('0x40'),'alias'],'model':db['User'],'as':_0x5adb('0x41')}];}return db['VoiceCallReport'][_0x5adb('0x42')](_0x5d457e);})[_0x5adb('0x22')](function(_0x299746){_0x1eac55[_0x5adb('0x43')]=_0x299746;return _0x1eac55;})[_0x5adb('0x22')](respondWithFilteredResult(_0x49992e,_0x5d457e))['catch'](handleError(_0x49992e,null));};exports[_0x5adb('0x44')]=function(_0x565b03,_0x508690){var _0x4160ad={'raw':!![],'where':{'id':_0x565b03['params']['id']}},_0x1a256c={};_0x1a256c[_0x5adb('0x2e')]=_[_0x5adb('0x30')](db[_0x5adb('0x2a')][_0x5adb('0x45')]);_0x1a256c[_0x5adb('0x2f')]=_[_0x5adb('0x30')](_0x565b03[_0x5adb('0x2f')]);_0x1a256c['filters']=_['intersection'](_0x1a256c[_0x5adb('0x2e')],_0x1a256c[_0x5adb('0x2f')]);_0x4160ad[_0x5adb('0x32')]=_[_0x5adb('0x31')](_0x1a256c['model'],qs['fields'](_0x565b03[_0x5adb('0x2f')][_0x5adb('0x33')]));_0x4160ad[_0x5adb('0x32')]=_0x4160ad[_0x5adb('0x32')][_0x5adb('0x46')]?_0x4160ad['attributes']:_0x1a256c[_0x5adb('0x2e')];if(_0x565b03[_0x5adb('0x2f')]['includeAll']){_0x4160ad[_0x5adb('0x3f')]=[{'all':!![]}];}_0x4160ad=_[_0x5adb('0x3c')]({},_0x4160ad,_0x565b03[_0x5adb('0x3d')]);return db[_0x5adb('0x2a')][_0x5adb('0x47')](_0x4160ad)[_0x5adb('0x22')](handleEntityNotFound(_0x508690,null))[_0x5adb('0x22')](respondWithResult(_0x508690,null))[_0x5adb('0x48')](handleError(_0x508690,null));};exports['create']=function(_0x3a925b,_0x57dc8b){return db['VoiceCallReport']['create'](_0x3a925b[_0x5adb('0x49')],{})[_0x5adb('0x22')](respondWithResult(_0x57dc8b,0xc9))[_0x5adb('0x48')](handleError(_0x57dc8b,null));};exports['destroy']=function(_0x2ad69d,_0x5cbab5){return db[_0x5adb('0x2a')][_0x5adb('0x47')]({'where':{'id':_0x2ad69d[_0x5adb('0x4a')]['id']}})['then'](handleEntityNotFound(_0x5cbab5,null))[_0x5adb('0x22')](removeEntity(_0x5cbab5,null))['catch'](handleError(_0x5cbab5,null));};exports[_0x5adb('0x4b')]=function(_0x6dc067,_0x55c535){return db[_0x5adb('0x2a')][_0x5adb('0x4b')]()[_0x5adb('0x22')](respondWithResult(_0x55c535,null))[_0x5adb('0x48')](handleError(_0x55c535,null));};exports[_0x5adb('0x21')]=function(_0x4cb36c,_0x36b847){if(_0x4cb36c[_0x5adb('0x49')][_0x5adb('0x4c')]){delete _0x4cb36c[_0x5adb('0x49')]['uniqueid'];}return db[_0x5adb('0x2a')][_0x5adb('0x47')]({'where':{'uniqueid':_0x4cb36c[_0x5adb('0x4a')]['id'],'UserId':{'$or':[null,_0x4cb36c['user']['id']]}}})[_0x5adb('0x22')](handleEntityNotFound(_0x36b847,null))[_0x5adb('0x22')](saveUpdates(_0x4cb36c[_0x5adb('0x49')],null))[_0x5adb('0x22')](respondWithResult(_0x36b847,null))['catch'](handleError(_0x36b847,null));}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index 6a2d41d..f9b25f7 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 _0xa9ea=['define','VoiceCallReport','report_call','uniqueid','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./voiceCallReport.attributes','exports'];(function(_0x9dcf2d,_0x20ff2a){var _0x4c856c=function(_0x441f81){while(--_0x441f81){_0x9dcf2d['push'](_0x9dcf2d['shift']());}};_0x4c856c(++_0x20ff2a);}(_0xa9ea,0x1b6));var _0xaa9e=function(_0x21af3a,_0x386e1d){_0x21af3a=_0x21af3a-0x0;var _0x268a49=_0xa9ea[_0x21af3a];return _0x268a49;};'use strict';var _=require('lodash');var util=require(_0xaa9e('0x0'));var logger=require(_0xaa9e('0x1'))(_0xaa9e('0x2'));var moment=require(_0xaa9e('0x3'));var BPromise=require(_0xaa9e('0x4'));var rp=require(_0xaa9e('0x5'));var fs=require('fs');var path=require(_0xaa9e('0x6'));var rimraf=require(_0xaa9e('0x7'));var config=require('../../config/environment');var attributes=require(_0xaa9e('0x8'));module[_0xaa9e('0x9')]=function(_0x2cf6b7,_0x1ce8cd){return _0x2cf6b7[_0xaa9e('0xa')](_0xaa9e('0xb'),attributes,{'tableName':_0xaa9e('0xc'),'paranoid':![],'indexes':[{'fields':[_0xaa9e('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2516=['request-promise','../../config/environment','./voiceCallReport.attributes','exports','define','VoiceCallReport','uniqueid','lodash','util','../../config/logger','api','bluebird'];(function(_0x221188,_0x2691b7){var _0x1bd725=function(_0x4b7811){while(--_0x4b7811){_0x221188['push'](_0x221188['shift']());}};_0x1bd725(++_0x2691b7);}(_0x2516,0x16f));var _0x6251=function(_0x68ee8b,_0x3cc6c5){_0x68ee8b=_0x68ee8b-0x0;var _0x5148f7=_0x2516[_0x68ee8b];return _0x5148f7;};'use strict';var _=require(_0x6251('0x0'));var util=require(_0x6251('0x1'));var logger=require(_0x6251('0x2'))(_0x6251('0x3'));var moment=require('moment');var BPromise=require(_0x6251('0x4'));var rp=require(_0x6251('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x6251('0x6'));var attributes=require(_0x6251('0x7'));module[_0x6251('0x8')]=function(_0x3d3ff5,_0x34aba1){return _0x3d3ff5[_0x6251('0x9')](_0x6251('0xa'),attributes,{'tableName':'report_call','paranoid':![],'indexes':[{'fields':[_0x6251('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.rpc.js b/server/api/voiceCallReport/voiceCallReport.rpc.js index f068c64..b8e9047 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 _0xb5a6=['GetVoiceCallReport','CreateVoiceCallReport','create','body','raw','UpdateVoiceCallReport','update','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','VoiceCallReport,\x20%s,\x20%s','request\x20sent','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','VoiceCallReport','findAll','options','where','attributes','include','map','model','then'];(function(_0x387583,_0x127b08){var _0x45d2f9=function(_0x1d82ac){while(--_0x1d82ac){_0x387583['push'](_0x387583['shift']());}};_0x45d2f9(++_0x127b08);}(_0xb5a6,0xa3));var _0x6b5a=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xb5a6[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0x6b5a('0x0'));var util=require(_0x6b5a('0x1'));var moment=require(_0x6b5a('0x2'));var BPromise=require(_0x6b5a('0x3'));var rs=require(_0x6b5a('0x4'));var fs=require('fs');var Redis=require(_0x6b5a('0x5'));var db=require(_0x6b5a('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x6b5a('0x7'))(_0x6b5a('0x8'));var config=require(_0x6b5a('0x9'));var jayson=require(_0x6b5a('0xa'));var client=jayson[_0x6b5a('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x51ecbe,_0x2b276e,_0x36ae74){return new BPromise(function(_0xc942d9,_0xf1675c){return client[_0x6b5a('0xc')](_0x51ecbe,_0x36ae74)['then'](function(_0x553754){logger[_0x6b5a('0xd')](_0x6b5a('0xe'),_0x2b276e,_0x6b5a('0xf'));logger[_0x6b5a('0x10')](_0x6b5a('0x11'),_0x2b276e,_0x6b5a('0xf'),JSON[_0x6b5a('0x12')](_0x553754));if(_0x553754['error']){if(_0x553754[_0x6b5a('0x13')]['code']===0x1f4){logger['error'](_0x6b5a('0xe'),_0x2b276e,_0x553754['error']['message']);return _0xf1675c(_0x553754[_0x6b5a('0x13')][_0x6b5a('0x14')]);}logger[_0x6b5a('0x13')](_0x6b5a('0xe'),_0x2b276e,_0x553754[_0x6b5a('0x13')][_0x6b5a('0x14')]);return _0xc942d9(_0x553754['error']['message']);}else{logger['info']('VoiceCallReport,\x20%s,\x20%s',_0x2b276e,_0x6b5a('0xf'));_0xc942d9(_0x553754[_0x6b5a('0x15')][_0x6b5a('0x14')]);}})[_0x6b5a('0x16')](function(_0x3d4c46){logger[_0x6b5a('0x13')](_0x6b5a('0xe'),_0x2b276e,_0x3d4c46);_0xf1675c(_0x3d4c46);});});}exports['GetVoiceCallReport']=function(_0x5ea82f){var _0x51b248=this;return new Promise(function(_0x5b26ad,_0x3ebade){return db[_0x6b5a('0x17')][_0x6b5a('0x18')]({'raw':_0x5ea82f[_0x6b5a('0x19')]?_0x5ea82f[_0x6b5a('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x5ea82f[_0x6b5a('0x19')]?_0x5ea82f[_0x6b5a('0x19')][_0x6b5a('0x1a')]||null:null,'attributes':_0x5ea82f['options']?_0x5ea82f['options'][_0x6b5a('0x1b')]||null:null,'limit':_0x5ea82f['options']?_0x5ea82f['options']['limit']||null:null,'include':_0x5ea82f[_0x6b5a('0x19')]?_0x5ea82f[_0x6b5a('0x19')]['include']?_['map'](_0x5ea82f[_0x6b5a('0x19')][_0x6b5a('0x1c')],function(_0x19e1f6){return{'model':db[_0x19e1f6['model']],'as':_0x19e1f6['as'],'attributes':_0x19e1f6['attributes'],'include':_0x19e1f6['include']?_[_0x6b5a('0x1d')](_0x19e1f6[_0x6b5a('0x1c')],function(_0x32c736){return{'model':db[_0x32c736[_0x6b5a('0x1e')]],'as':_0x32c736['as'],'attributes':_0x32c736[_0x6b5a('0x1b')],'include':_0x32c736['include']?_['map'](_0x32c736['include'],function(_0x51baa9){return{'model':db[_0x51baa9[_0x6b5a('0x1e')]],'as':_0x51baa9['as'],'attributes':_0x51baa9[_0x6b5a('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x6b5a('0x1f')](function(_0x28225f){logger[_0x6b5a('0xd')](_0x6b5a('0x20'),_0x5ea82f);logger[_0x6b5a('0x10')](_0x6b5a('0x20'),_0x5ea82f,JSON['stringify'](_0x28225f));_0x5b26ad(_0x28225f);})['catch'](function(_0x54a193){logger['error'](_0x6b5a('0x20'),_0x54a193[_0x6b5a('0x14')],_0x5ea82f);_0x3ebade(_0x51b248[_0x6b5a('0x13')](0x1f4,_0x54a193[_0x6b5a('0x14')]));});});};exports[_0x6b5a('0x21')]=function(_0xba2b92){var _0x40ae70=this;return new Promise(function(_0x5b35c1,_0x33b59a){return db[_0x6b5a('0x17')][_0x6b5a('0x22')](_0xba2b92[_0x6b5a('0x23')],{'raw':_0xba2b92[_0x6b5a('0x19')]?_0xba2b92['options'][_0x6b5a('0x24')]===undefined?!![]:![]:!![]})[_0x6b5a('0x1f')](function(_0x2ea0ba){logger[_0x6b5a('0xd')](_0x6b5a('0x21'),_0xba2b92);logger[_0x6b5a('0x10')](_0x6b5a('0x21'),_0xba2b92,JSON[_0x6b5a('0x12')](_0x2ea0ba));_0x5b35c1(_0x2ea0ba);})['catch'](function(_0x5545c2){logger['error'](_0x6b5a('0x21'),_0x5545c2[_0x6b5a('0x14')],_0xba2b92);_0x33b59a(_0x40ae70[_0x6b5a('0x13')](0x1f4,_0x5545c2['message']));});});};exports[_0x6b5a('0x25')]=function(_0x3d32e6){var _0x5b386c=this;return new Promise(function(_0x59149c,_0x13cabc){return db[_0x6b5a('0x17')][_0x6b5a('0x26')](_0x3d32e6[_0x6b5a('0x23')],{'raw':_0x3d32e6[_0x6b5a('0x19')]?_0x3d32e6['options'][_0x6b5a('0x24')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3d32e6[_0x6b5a('0x19')]?_0x3d32e6[_0x6b5a('0x19')][_0x6b5a('0x1a')]||null:null,'attributes':_0x3d32e6[_0x6b5a('0x19')]?_0x3d32e6[_0x6b5a('0x19')]['attributes']||null:null,'limit':_0x3d32e6[_0x6b5a('0x19')]?_0x3d32e6[_0x6b5a('0x19')]['limit']||null:null})[_0x6b5a('0x1f')](function(_0x4e281d){logger[_0x6b5a('0xd')]('UpdateVoiceCallReport',_0x3d32e6);logger[_0x6b5a('0x10')]('UpdateVoiceCallReport',_0x3d32e6,JSON[_0x6b5a('0x12')](_0x4e281d));_0x59149c(_0x4e281d);})[_0x6b5a('0x16')](function(_0x7f80aa){logger['error'](_0x6b5a('0x25'),_0x7f80aa[_0x6b5a('0x14')],_0x3d32e6);_0x13cabc(_0x5b386c[_0x6b5a('0x13')](0x1f4,_0x7f80aa[_0x6b5a('0x14')]));});});}; \ No newline at end of file +var _0xa5f4=['message','VoiceCallReport,\x20%s,\x20%s','result','catch','VoiceCallReport','options','raw','attributes','limit','include','map','model','GetVoiceCallReport','debug','create','body','CreateVoiceCallReport','update','where','UpdateVoiceCallReport','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/environment','request','then','info','VoiceCallReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x6ca07c,_0x5cc954){var _0x32f9b7=function(_0x33ab17){while(--_0x33ab17){_0x6ca07c['push'](_0x6ca07c['shift']());}};_0x32f9b7(++_0x5cc954);}(_0xa5f4,0x134));var _0x4a5f=function(_0x25b9a9,_0x2aeeb4){_0x25b9a9=_0x25b9a9-0x0;var _0x3bceb6=_0xa5f4[_0x25b9a9];return _0x3bceb6;};'use strict';var _=require(_0x4a5f('0x0'));var util=require(_0x4a5f('0x1'));var moment=require(_0x4a5f('0x2'));var BPromise=require(_0x4a5f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4a5f('0x4'));var db=require(_0x4a5f('0x5'))['db'];var utils=require(_0x4a5f('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x4a5f('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x17a9fe,_0x4853ee,_0x3cfe90){return new BPromise(function(_0x51ace6,_0x364ddc){return client[_0x4a5f('0x8')](_0x17a9fe,_0x3cfe90)[_0x4a5f('0x9')](function(_0x75d23c){logger[_0x4a5f('0xa')]('VoiceCallReport,\x20%s,\x20%s',_0x4853ee,'request\x20sent');logger['debug'](_0x4a5f('0xb'),_0x4853ee,_0x4a5f('0xc'),JSON[_0x4a5f('0xd')](_0x75d23c));if(_0x75d23c[_0x4a5f('0xe')]){if(_0x75d23c['error'][_0x4a5f('0xf')]===0x1f4){logger[_0x4a5f('0xe')]('VoiceCallReport,\x20%s,\x20%s',_0x4853ee,_0x75d23c[_0x4a5f('0xe')][_0x4a5f('0x10')]);return _0x364ddc(_0x75d23c[_0x4a5f('0xe')]['message']);}logger['error'](_0x4a5f('0x11'),_0x4853ee,_0x75d23c[_0x4a5f('0xe')][_0x4a5f('0x10')]);return _0x51ace6(_0x75d23c[_0x4a5f('0xe')][_0x4a5f('0x10')]);}else{logger[_0x4a5f('0xa')](_0x4a5f('0x11'),_0x4853ee,_0x4a5f('0xc'));_0x51ace6(_0x75d23c[_0x4a5f('0x12')][_0x4a5f('0x10')]);}})[_0x4a5f('0x13')](function(_0x381c41){logger['error'](_0x4a5f('0x11'),_0x4853ee,_0x381c41);_0x364ddc(_0x381c41);});});}exports['GetVoiceCallReport']=function(_0x4f42ba){var _0x3eb838=this;return new Promise(function(_0x54176c,_0x1e1694){return db[_0x4a5f('0x14')]['findAll']({'raw':_0x4f42ba[_0x4a5f('0x15')]?_0x4f42ba[_0x4a5f('0x15')][_0x4a5f('0x16')]===undefined?!![]:![]:!![],'where':_0x4f42ba[_0x4a5f('0x15')]?_0x4f42ba[_0x4a5f('0x15')]['where']||null:null,'attributes':_0x4f42ba[_0x4a5f('0x15')]?_0x4f42ba['options'][_0x4a5f('0x17')]||null:null,'limit':_0x4f42ba[_0x4a5f('0x15')]?_0x4f42ba[_0x4a5f('0x15')][_0x4a5f('0x18')]||null:null,'include':_0x4f42ba[_0x4a5f('0x15')]?_0x4f42ba[_0x4a5f('0x15')][_0x4a5f('0x19')]?_[_0x4a5f('0x1a')](_0x4f42ba['options'][_0x4a5f('0x19')],function(_0x30f822){return{'model':db[_0x30f822['model']],'as':_0x30f822['as'],'attributes':_0x30f822[_0x4a5f('0x17')],'include':_0x30f822[_0x4a5f('0x19')]?_[_0x4a5f('0x1a')](_0x30f822['include'],function(_0x3e943c){return{'model':db[_0x3e943c[_0x4a5f('0x1b')]],'as':_0x3e943c['as'],'attributes':_0x3e943c[_0x4a5f('0x17')],'include':_0x3e943c['include']?_[_0x4a5f('0x1a')](_0x3e943c['include'],function(_0x5fea59){return{'model':db[_0x5fea59[_0x4a5f('0x1b')]],'as':_0x5fea59['as'],'attributes':_0x5fea59[_0x4a5f('0x17')]};}):[]};}):[]};}):[]:[]})[_0x4a5f('0x9')](function(_0x5d3af3){logger[_0x4a5f('0xa')](_0x4a5f('0x1c'),_0x4f42ba);logger[_0x4a5f('0x1d')]('GetVoiceCallReport',_0x4f42ba,JSON['stringify'](_0x5d3af3));_0x54176c(_0x5d3af3);})[_0x4a5f('0x13')](function(_0x3e7a8d){logger[_0x4a5f('0xe')](_0x4a5f('0x1c'),_0x3e7a8d['message'],_0x4f42ba);_0x1e1694(_0x3eb838[_0x4a5f('0xe')](0x1f4,_0x3e7a8d[_0x4a5f('0x10')]));});});};exports['CreateVoiceCallReport']=function(_0x44789a){var _0x3277ca=this;return new Promise(function(_0x1cb6b8,_0x2db6df){return db[_0x4a5f('0x14')][_0x4a5f('0x1e')](_0x44789a[_0x4a5f('0x1f')],{'raw':_0x44789a[_0x4a5f('0x15')]?_0x44789a['options'][_0x4a5f('0x16')]===undefined?!![]:![]:!![]})['then'](function(_0xe3c52a){logger[_0x4a5f('0xa')](_0x4a5f('0x20'),_0x44789a);logger[_0x4a5f('0x1d')](_0x4a5f('0x20'),_0x44789a,JSON[_0x4a5f('0xd')](_0xe3c52a));_0x1cb6b8(_0xe3c52a);})[_0x4a5f('0x13')](function(_0x4f3260){logger['error']('CreateVoiceCallReport',_0x4f3260['message'],_0x44789a);_0x2db6df(_0x3277ca[_0x4a5f('0xe')](0x1f4,_0x4f3260['message']));});});};exports['UpdateVoiceCallReport']=function(_0x4f1ee1){var _0x138519=this;return new Promise(function(_0x2653c2,_0x45776e){return db[_0x4a5f('0x14')][_0x4a5f('0x21')](_0x4f1ee1[_0x4a5f('0x1f')],{'raw':_0x4f1ee1[_0x4a5f('0x15')]?_0x4f1ee1[_0x4a5f('0x15')][_0x4a5f('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4f1ee1[_0x4a5f('0x15')]?_0x4f1ee1['options'][_0x4a5f('0x22')]||null:null,'attributes':_0x4f1ee1['options']?_0x4f1ee1[_0x4a5f('0x15')][_0x4a5f('0x17')]||null:null,'limit':_0x4f1ee1[_0x4a5f('0x15')]?_0x4f1ee1[_0x4a5f('0x15')]['limit']||null:null})[_0x4a5f('0x9')](function(_0x2aecaa){logger[_0x4a5f('0xa')](_0x4a5f('0x23'),_0x4f1ee1);logger[_0x4a5f('0x1d')](_0x4a5f('0x23'),_0x4f1ee1,JSON[_0x4a5f('0xd')](_0x2aecaa));_0x2653c2(_0x2aecaa);})[_0x4a5f('0x13')](function(_0x392e02){logger[_0x4a5f('0xe')]('UpdateVoiceCallReport',_0x392e02['message'],_0x4f1ee1);_0x45776e(_0x138519['error'](0x1f4,_0x392e02[_0x4a5f('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index 96c72f9..400bfb4 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 _0xdea3=['create','put','delete','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','show','post'];(function(_0x5bca07,_0x593e5d){var _0x304ee7=function(_0x25e488){while(--_0x25e488){_0x5bca07['push'](_0x5bca07['shift']());}};_0x304ee7(++_0x593e5d);}(_0xdea3,0xdb));var _0x3dea=function(_0x478cc9,_0x4ff046){_0x478cc9=_0x478cc9-0x0;var _0x36c548=_0xdea3[_0x478cc9];return _0x36c548;};'use strict';var multer=require(_0x3dea('0x0'));var util=require(_0x3dea('0x1'));var path=require(_0x3dea('0x2'));var timeout=require(_0x3dea('0x3'));var express=require('express');var router=express[_0x3dea('0x4')]();var fs_extra=require(_0x3dea('0x5'));var auth=require(_0x3dea('0x6'));var interaction=require(_0x3dea('0x7'));var config=require(_0x3dea('0x8'));var controller=require('./voiceChanSpy.controller');router['get']('/',auth[_0x3dea('0x9')](),controller[_0x3dea('0xa')]);router[_0x3dea('0xb')](_0x3dea('0xc'),auth[_0x3dea('0x9')](),controller[_0x3dea('0xd')]);router[_0x3dea('0xe')]('/',auth[_0x3dea('0x9')](),controller[_0x3dea('0xf')]);router[_0x3dea('0x10')](_0x3dea('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x3dea('0x11')](_0x3dea('0xc'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x21cc=['isAuthenticated','get','/:id','show','post','create','put','update','delete','destroy','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceChanSpy.controller'];(function(_0x4b9900,_0x17e382){var _0x114982=function(_0x509206){while(--_0x509206){_0x4b9900['push'](_0x4b9900['shift']());}};_0x114982(++_0x17e382);}(_0x21cc,0xd0));var _0xc21c=function(_0x536eca,_0x18b615){_0x536eca=_0x536eca-0x0;var _0x28f35f=_0x21cc[_0x536eca];return _0x28f35f;};'use strict';var multer=require('multer');var util=require(_0xc21c('0x0'));var path=require('path');var timeout=require(_0xc21c('0x1'));var express=require(_0xc21c('0x2'));var router=express['Router']();var fs_extra=require(_0xc21c('0x3'));var auth=require(_0xc21c('0x4'));var interaction=require(_0xc21c('0x5'));var config=require(_0xc21c('0x6'));var controller=require(_0xc21c('0x7'));router['get']('/',auth[_0xc21c('0x8')](),controller['index']);router[_0xc21c('0x9')](_0xc21c('0xa'),auth[_0xc21c('0x8')](),controller[_0xc21c('0xb')]);router[_0xc21c('0xc')]('/',auth['isAuthenticated'](),controller[_0xc21c('0xd')]);router[_0xc21c('0xe')](_0xc21c('0xa'),auth[_0xc21c('0x8')](),controller[_0xc21c('0xf')]);router[_0xc21c('0x10')](_0xc21c('0xa'),auth[_0xc21c('0x8')](),controller[_0xc21c('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.attributes.js b/server/api/voiceChanSpy/voiceChanSpy.attributes.js index 0449d8d..e9d2baa 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 _0x6a21=['setDataValue','options','join','getDataValue','BOOLEAN','STRING','name'];(function(_0x3ba5ad,_0xff6b43){var _0x15bcf8=function(_0x5cec89){while(--_0x5cec89){_0x3ba5ad['push'](_0x3ba5ad['shift']());}};_0x15bcf8(++_0xff6b43);}(_0x6a21,0x163));var _0x16a2=function(_0x3c3ce0,_0x2a3b1a){_0x3c3ce0=_0x3c3ce0-0x0;var _0x1f8d5f=_0x6a21[_0x3c3ce0];return _0x1f8d5f;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x16a2('0x0')]},'prefix':{'type':Sequelize[_0x16a2('0x0')],'unique':_0x16a2('0x1'),'allowNull':![]},'options':{'type':Sequelize[_0x16a2('0x0')],'set':function(_0x5e4e34){this[_0x16a2('0x2')](_0x16a2('0x3'),_0x5e4e34?_0x5e4e34[_0x16a2('0x4')](''):[]);},'get':function(){return this[_0x16a2('0x5')](_0x16a2('0x3'))?this[_0x16a2('0x5')](_0x16a2('0x3'))['split'](''):[];}},'auth':{'type':Sequelize[_0x16a2('0x6')],'defaultValue':![]},'password':{'type':Sequelize[_0x16a2('0x0')]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'recordingFormat':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x16a2('0x0')]}}; \ No newline at end of file +var _0x62c0=['BOOLEAN','sequelize','exports','STRING','name','options','join','getDataValue'];(function(_0x32fc4e,_0x5e9884){var _0x508311=function(_0x35b41f){while(--_0x35b41f){_0x32fc4e['push'](_0x32fc4e['shift']());}};_0x508311(++_0x5e9884);}(_0x62c0,0x151));var _0x062c=function(_0x54a9e3,_0x4a3813){_0x54a9e3=_0x54a9e3-0x0;var _0x247cce=_0x62c0[_0x54a9e3];return _0x247cce;};'use strict';var Sequelize=require(_0x062c('0x0'));module[_0x062c('0x1')]={'name':{'type':Sequelize[_0x062c('0x2')]},'prefix':{'type':Sequelize[_0x062c('0x2')],'unique':_0x062c('0x3'),'allowNull':![]},'options':{'type':Sequelize['STRING'],'set':function(_0x41bd42){this['setDataValue'](_0x062c('0x4'),_0x41bd42?_0x41bd42[_0x062c('0x5')](''):[]);},'get':function(){return this[_0x062c('0x6')](_0x062c('0x4'))?this[_0x062c('0x6')](_0x062c('0x4'))['split'](''):[];}},'auth':{'type':Sequelize[_0x062c('0x7')],'defaultValue':![]},'password':{'type':Sequelize[_0x062c('0x2')]},'record':{'type':Sequelize[_0x062c('0x7')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0x062c('0x2')]},'description':{'type':Sequelize[_0x062c('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index 37e48e8..df6788a 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 _0x3e25=['intersection','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','reject','update','destroy','then','get','ChanSpies','stack','name','VoiceChanSpy','rawAttributes','fieldName','type','key','map','query','keys','filters','model','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params'];(function(_0x334841,_0x2bbc4c){var _0x5beb4b=function(_0x4bea72){while(--_0x4bea72){_0x334841['push'](_0x334841['shift']());}};_0x5beb4b(++_0x2bbc4c);}(_0x3e25,0x14f));var _0x53e2=function(_0x8a4fb2,_0x1b3efa){_0x8a4fb2=_0x8a4fb2-0x0;var _0x37b4d2=_0x3e25[_0x8a4fb2];return _0x37b4d2;};'use strict';var emlformat=require(_0x53e2('0x0'));var rimraf=require(_0x53e2('0x1'));var zipdir=require(_0x53e2('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x53e2('0x3'));var moment=require('moment');var BPromise=require(_0x53e2('0x4'));var Mustache=require('mustache');var util=require(_0x53e2('0x5'));var path=require(_0x53e2('0x6'));var sox=require(_0x53e2('0x7'));var csv=require(_0x53e2('0x8'));var ejs=require(_0x53e2('0x9'));var fs=require('fs');var fs_extra=require(_0x53e2('0xa'));var _=require(_0x53e2('0xb'));var squel=require(_0x53e2('0xc'));var crypto=require(_0x53e2('0xd'));var jsforce=require(_0x53e2('0xe'));var deskjs=require(_0x53e2('0xf'));var toCsv=require(_0x53e2('0x8'));var querystring=require(_0x53e2('0x10'));var Papa=require(_0x53e2('0x11'));var Redis=require(_0x53e2('0x12'));var authService=require(_0x53e2('0x13'));var qs=require(_0x53e2('0x14'));var as=require(_0x53e2('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x53e2('0x16'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x53e2('0x17'));var db=require(_0x53e2('0x18'))['db'];function respondWithStatusCode(_0x1fef05,_0xb04b6b){_0xb04b6b=_0xb04b6b||0xcc;return function(_0x1e6e15){if(_0x1e6e15){return _0x1fef05[_0x53e2('0x19')](_0xb04b6b);}return _0x1fef05[_0x53e2('0x1a')](_0xb04b6b)[_0x53e2('0x1b')]();};}function respondWithResult(_0x39ad21,_0x5d16e2){_0x5d16e2=_0x5d16e2||0xc8;return function(_0xeaf527){if(_0xeaf527){return _0x39ad21[_0x53e2('0x1a')](_0x5d16e2)[_0x53e2('0x1c')](_0xeaf527);}};}function respondWithFilteredResult(_0xb657a0,_0x28f96e){return function(_0x223ad5){if(_0x223ad5){var _0x528355=typeof _0x28f96e[_0x53e2('0x1d')]==='undefined'&&typeof _0x28f96e[_0x53e2('0x1e')]===_0x53e2('0x1f');var _0x7a3cf1=_0x223ad5[_0x53e2('0x20')];var _0x52bae6=_0x528355?0x0:_0x28f96e[_0x53e2('0x1d')];var _0x323e53=_0x528355?_0x223ad5['count']:_0x28f96e[_0x53e2('0x1d')]+_0x28f96e['limit'];var _0x9ddfe4;if(_0x323e53>=_0x7a3cf1){_0x323e53=_0x7a3cf1;_0x9ddfe4=0xc8;}else{_0x9ddfe4=0xce;}_0xb657a0['status'](_0x9ddfe4);return _0xb657a0['set'](_0x53e2('0x21'),_0x52bae6+'-'+_0x323e53+'/'+_0x7a3cf1)[_0x53e2('0x1c')](_0x223ad5);}return null;};}function patchUpdates(_0x3454c9){return function(_0x2dac03){try{jsonpatch['apply'](_0x2dac03,_0x3454c9,!![]);}catch(_0x24c58d){return BPromise[_0x53e2('0x22')](_0x24c58d);}return _0x2dac03['save']();};}function saveUpdates(_0x2bdd38,_0x51be71){return function(_0x2073b8){if(_0x2073b8){return _0x2073b8[_0x53e2('0x23')](_0x2bdd38)['then'](function(_0x23c97e){return _0x23c97e;});}return null;};}function removeEntity(_0x2be367,_0x9c5566){return function(_0x282d7b){if(_0x282d7b){return _0x282d7b[_0x53e2('0x24')]()[_0x53e2('0x25')](function(){var _0x1375eb=_0x282d7b[_0x53e2('0x26')]({'plain':!![]});var _0x4e5101=_0x53e2('0x27');return db['UserProfileResource'][_0x53e2('0x24')]({'where':{'type':_0x4e5101,'resourceId':_0x1375eb['id']}})['then'](function(){return _0x282d7b;});})['then'](function(){_0x2be367[_0x53e2('0x1a')](0xcc)[_0x53e2('0x1b')]();});}};}function handleEntityNotFound(_0x5ddc53,_0x33fc6a){return function(_0x9ad531){if(!_0x9ad531){_0x5ddc53['sendStatus'](0x194);}return _0x9ad531;};}function handleError(_0x619b6d,_0x1d09a3){_0x1d09a3=_0x1d09a3||0x1f4;return function(_0x39b214){logger['error'](_0x39b214[_0x53e2('0x28')]);if(_0x39b214[_0x53e2('0x29')]){delete _0x39b214[_0x53e2('0x29')];}_0x619b6d['status'](_0x1d09a3)['send'](_0x39b214);};}exports['index']=function(_0x493335,_0x3f32ce){var _0x472925={},_0x4b915a={},_0x264c70={'count':0x0,'rows':[]};var _0x2768d1=_['map'](db[_0x53e2('0x2a')][_0x53e2('0x2b')],function(_0x4eb61d){return{'name':_0x4eb61d[_0x53e2('0x2c')],'type':_0x4eb61d[_0x53e2('0x2d')][_0x53e2('0x2e')]};});_0x4b915a['model']=_[_0x53e2('0x2f')](_0x2768d1,_0x53e2('0x29'));_0x4b915a[_0x53e2('0x30')]=_[_0x53e2('0x31')](_0x493335['query']);_0x4b915a[_0x53e2('0x32')]=_['intersection'](_0x4b915a[_0x53e2('0x33')],_0x4b915a['query']);_0x472925['attributes']=_['intersection'](_0x4b915a[_0x53e2('0x33')],qs['fields'](_0x493335['query'][_0x53e2('0x34')]));_0x472925[_0x53e2('0x35')]=_0x472925[_0x53e2('0x35')]['length']?_0x472925[_0x53e2('0x35')]:_0x4b915a[_0x53e2('0x33')];if(!_0x493335['query'][_0x53e2('0x36')](_0x53e2('0x37'))){_0x472925[_0x53e2('0x1e')]=qs[_0x53e2('0x1e')](_0x493335[_0x53e2('0x30')][_0x53e2('0x1e')]);_0x472925[_0x53e2('0x1d')]=qs[_0x53e2('0x1d')](_0x493335[_0x53e2('0x30')][_0x53e2('0x1d')]);}_0x472925[_0x53e2('0x38')]=qs[_0x53e2('0x39')](_0x493335['query']['sort']);_0x472925[_0x53e2('0x3a')]=qs['filters'](_[_0x53e2('0x3b')](_0x493335['query'],_0x4b915a[_0x53e2('0x32')]),_0x2768d1);if(_0x493335[_0x53e2('0x30')][_0x53e2('0x3c')]){_0x472925['where']=_['merge'](_0x472925[_0x53e2('0x3a')],{'$or':_[_0x53e2('0x2f')](_0x2768d1,function(_0x498975){if(_0x498975[_0x53e2('0x2d')]!=='VIRTUAL'){var _0x582238={};_0x582238[_0x498975[_0x53e2('0x29')]]={'$like':'%'+_0x493335[_0x53e2('0x30')][_0x53e2('0x3c')]+'%'};return _0x582238;}})});}_0x472925=_[_0x53e2('0x3d')]({},_0x472925,_0x493335[_0x53e2('0x3e')]);var _0x3be1aa={'where':_0x472925[_0x53e2('0x3a')]};return db[_0x53e2('0x2a')][_0x53e2('0x20')](_0x3be1aa)[_0x53e2('0x25')](function(_0x2ccc90){_0x264c70[_0x53e2('0x20')]=_0x2ccc90;if(_0x493335[_0x53e2('0x30')][_0x53e2('0x3f')]){_0x472925[_0x53e2('0x40')]=[{'all':!![]}];}return db['VoiceChanSpy'][_0x53e2('0x41')](_0x472925);})[_0x53e2('0x25')](function(_0x19ee61){_0x264c70[_0x53e2('0x42')]=_0x19ee61;return _0x264c70;})['then'](respondWithFilteredResult(_0x3f32ce,_0x472925))[_0x53e2('0x43')](handleError(_0x3f32ce,null));};exports[_0x53e2('0x44')]=function(_0x3b3acd,_0x1adf5a){var _0x45074c={'raw':![],'where':{'id':_0x3b3acd[_0x53e2('0x45')]['id']}},_0x13bb8c={};_0x13bb8c[_0x53e2('0x33')]=_[_0x53e2('0x31')](db[_0x53e2('0x2a')][_0x53e2('0x2b')]);_0x13bb8c[_0x53e2('0x30')]=_[_0x53e2('0x31')](_0x3b3acd[_0x53e2('0x30')]);_0x13bb8c[_0x53e2('0x32')]=_[_0x53e2('0x46')](_0x13bb8c['model'],_0x13bb8c[_0x53e2('0x30')]);_0x45074c[_0x53e2('0x35')]=_['intersection'](_0x13bb8c[_0x53e2('0x33')],qs[_0x53e2('0x34')](_0x3b3acd[_0x53e2('0x30')]['fields']));_0x45074c[_0x53e2('0x35')]=_0x45074c[_0x53e2('0x35')]['length']?_0x45074c[_0x53e2('0x35')]:_0x13bb8c[_0x53e2('0x33')];if(_0x3b3acd[_0x53e2('0x30')][_0x53e2('0x3f')]){_0x45074c[_0x53e2('0x40')]=[{'all':!![]}];}_0x45074c=_['merge']({},_0x45074c,_0x3b3acd[_0x53e2('0x3e')]);return db[_0x53e2('0x2a')][_0x53e2('0x47')](_0x45074c)['then'](handleEntityNotFound(_0x1adf5a,null))[_0x53e2('0x25')](respondWithResult(_0x1adf5a,null))['catch'](handleError(_0x1adf5a,null));};exports[_0x53e2('0x48')]=function(_0x4ee742,_0xa5c6b1){return db[_0x53e2('0x2a')][_0x53e2('0x48')](_0x4ee742[_0x53e2('0x49')],{})[_0x53e2('0x25')](function(_0x1ed8c4){var _0x4a9860=_0x4ee742['user'][_0x53e2('0x26')]({'plain':!![]});if(!_0x4a9860)throw new Error(_0x53e2('0x4a'));if(_0x4a9860['role']==='user'){var _0xd5075f=_0x1ed8c4[_0x53e2('0x26')]({'plain':!![]});var _0x1704ca=_0x53e2('0x27');return db[_0x53e2('0x4b')][_0x53e2('0x47')]({'where':{'name':_0x1704ca,'userProfileId':_0x4a9860[_0x53e2('0x4c')]},'raw':!![]})[_0x53e2('0x25')](function(_0x42663e){if(_0x42663e&&_0x42663e[_0x53e2('0x4d')]===0x0){return db[_0x53e2('0x4e')][_0x53e2('0x48')]({'name':_0xd5075f['name'],'resourceId':_0xd5075f['id'],'type':_0x42663e['name'],'sectionId':_0x42663e['id']},{})[_0x53e2('0x25')](function(){return _0x1ed8c4;});}else{return _0x1ed8c4;}})[_0x53e2('0x43')](function(_0x2f7d01){logger[_0x53e2('0x4f')](_0x53e2('0x50'),_0x2f7d01);throw _0x2f7d01;});}return _0x1ed8c4;})['then'](respondWithResult(_0xa5c6b1,0xc9))[_0x53e2('0x43')](handleError(_0xa5c6b1,null));};exports[_0x53e2('0x23')]=function(_0x3cb93e,_0x1d249e){if(_0x3cb93e[_0x53e2('0x49')]['id']){delete _0x3cb93e[_0x53e2('0x49')]['id'];}return db[_0x53e2('0x2a')][_0x53e2('0x47')]({'where':{'id':_0x3cb93e[_0x53e2('0x45')]['id']}})[_0x53e2('0x25')](handleEntityNotFound(_0x1d249e,null))[_0x53e2('0x25')](saveUpdates(_0x3cb93e[_0x53e2('0x49')],null))[_0x53e2('0x25')](respondWithResult(_0x1d249e,null))[_0x53e2('0x43')](handleError(_0x1d249e,null));};exports[_0x53e2('0x24')]=function(_0x1cef46,_0x2bedc0){return db['VoiceChanSpy'][_0x53e2('0x47')]({'where':{'id':_0x1cef46[_0x53e2('0x45')]['id']}})[_0x53e2('0x25')](handleEntityNotFound(_0x2bedc0,null))[_0x53e2('0x25')](removeEntity(_0x2bedc0,null))['catch'](handleError(_0x2bedc0,null));}; \ No newline at end of file +var _0x3657=['reject','save','update','then','destroy','get','UserProfileResource','end','stack','name','index','map','VoiceChanSpy','rawAttributes','fieldName','key','query','intersection','model','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filters','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','keys','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','offset','undefined','count','limit','set','Content-Range','json','apply'];(function(_0xbd0f73,_0x4c8037){var _0x184fdc=function(_0x272e91){while(--_0x272e91){_0xbd0f73['push'](_0xbd0f73['shift']());}};_0x184fdc(++_0x4c8037);}(_0x3657,0x183));var _0x7365=function(_0x28e424,_0x4d6508){_0x28e424=_0x28e424-0x0;var _0x25ab59=_0x3657[_0x28e424];return _0x25ab59;};'use strict';var emlformat=require(_0x7365('0x0'));var rimraf=require(_0x7365('0x1'));var zipdir=require(_0x7365('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7365('0x3'));var moment=require(_0x7365('0x4'));var BPromise=require(_0x7365('0x5'));var Mustache=require(_0x7365('0x6'));var util=require('util');var path=require(_0x7365('0x7'));var sox=require(_0x7365('0x8'));var csv=require(_0x7365('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7365('0xa'));var _=require(_0x7365('0xb'));var squel=require(_0x7365('0xc'));var crypto=require('crypto');var jsforce=require(_0x7365('0xd'));var deskjs=require(_0x7365('0xe'));var toCsv=require(_0x7365('0x9'));var querystring=require('querystring');var Papa=require(_0x7365('0xf'));var Redis=require(_0x7365('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x7365('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7365('0x12'));var logger=require(_0x7365('0x13'))(_0x7365('0x14'));var utils=require('../../config/utils');var config=require(_0x7365('0x15'));var licenseUtil=require(_0x7365('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1179b8,_0x33b248){_0x33b248=_0x33b248||0xcc;return function(_0x30c2a1){if(_0x30c2a1){return _0x1179b8[_0x7365('0x17')](_0x33b248);}return _0x1179b8[_0x7365('0x18')](_0x33b248)['end']();};}function respondWithResult(_0x2ba19c,_0x52f309){_0x52f309=_0x52f309||0xc8;return function(_0x39faaf){if(_0x39faaf){return _0x2ba19c['status'](_0x52f309)['json'](_0x39faaf);}};}function respondWithFilteredResult(_0xf753a3,_0x21548f){return function(_0x26cf47){if(_0x26cf47){var _0xb73d63=typeof _0x21548f[_0x7365('0x19')]==='undefined'&&typeof _0x21548f['limit']===_0x7365('0x1a');var _0x32980a=_0x26cf47['count'];var _0x337e7f=_0xb73d63?0x0:_0x21548f[_0x7365('0x19')];var _0x30dfe9=_0xb73d63?_0x26cf47[_0x7365('0x1b')]:_0x21548f[_0x7365('0x19')]+_0x21548f[_0x7365('0x1c')];var _0x3f52aa;if(_0x30dfe9>=_0x32980a){_0x30dfe9=_0x32980a;_0x3f52aa=0xc8;}else{_0x3f52aa=0xce;}_0xf753a3[_0x7365('0x18')](_0x3f52aa);return _0xf753a3[_0x7365('0x1d')](_0x7365('0x1e'),_0x337e7f+'-'+_0x30dfe9+'/'+_0x32980a)[_0x7365('0x1f')](_0x26cf47);}return null;};}function patchUpdates(_0x463d01){return function(_0x3d9027){try{jsonpatch[_0x7365('0x20')](_0x3d9027,_0x463d01,!![]);}catch(_0x3434bf){return BPromise[_0x7365('0x21')](_0x3434bf);}return _0x3d9027[_0x7365('0x22')]();};}function saveUpdates(_0x577bc3,_0x5da4fb){return function(_0x3c3571){if(_0x3c3571){return _0x3c3571[_0x7365('0x23')](_0x577bc3)[_0x7365('0x24')](function(_0x45cfe1){return _0x45cfe1;});}return null;};}function removeEntity(_0x43670f,_0x431fa1){return function(_0x582b65){if(_0x582b65){return _0x582b65[_0x7365('0x25')]()[_0x7365('0x24')](function(){var _0x3c9e48=_0x582b65[_0x7365('0x26')]({'plain':!![]});var _0x680d5b='ChanSpies';return db[_0x7365('0x27')][_0x7365('0x25')]({'where':{'type':_0x680d5b,'resourceId':_0x3c9e48['id']}})[_0x7365('0x24')](function(){return _0x582b65;});})[_0x7365('0x24')](function(){_0x43670f['status'](0xcc)[_0x7365('0x28')]();});}};}function handleEntityNotFound(_0xf4cdb6,_0x4a29f0){return function(_0x4dceeb){if(!_0x4dceeb){_0xf4cdb6[_0x7365('0x17')](0x194);}return _0x4dceeb;};}function handleError(_0x41a04f,_0x4e5242){_0x4e5242=_0x4e5242||0x1f4;return function(_0x3d1e72){logger['error'](_0x3d1e72[_0x7365('0x29')]);if(_0x3d1e72[_0x7365('0x2a')]){delete _0x3d1e72['name'];}_0x41a04f[_0x7365('0x18')](_0x4e5242)['send'](_0x3d1e72);};}exports[_0x7365('0x2b')]=function(_0x41b97a,_0x29277b){var _0x2af1fc={},_0x2f1c40={},_0xbdb78c={'count':0x0,'rows':[]};var _0x3439ae=_[_0x7365('0x2c')](db[_0x7365('0x2d')][_0x7365('0x2e')],function(_0x433c38){return{'name':_0x433c38[_0x7365('0x2f')],'type':_0x433c38['type'][_0x7365('0x30')]};});_0x2f1c40['model']=_[_0x7365('0x2c')](_0x3439ae,_0x7365('0x2a'));_0x2f1c40[_0x7365('0x31')]=_['keys'](_0x41b97a['query']);_0x2f1c40['filters']=_[_0x7365('0x32')](_0x2f1c40[_0x7365('0x33')],_0x2f1c40[_0x7365('0x31')]);_0x2af1fc[_0x7365('0x34')]=_[_0x7365('0x32')](_0x2f1c40[_0x7365('0x33')],qs['fields'](_0x41b97a[_0x7365('0x31')][_0x7365('0x35')]));_0x2af1fc[_0x7365('0x34')]=_0x2af1fc['attributes']['length']?_0x2af1fc['attributes']:_0x2f1c40[_0x7365('0x33')];if(!_0x41b97a[_0x7365('0x31')][_0x7365('0x36')](_0x7365('0x37'))){_0x2af1fc[_0x7365('0x1c')]=qs[_0x7365('0x1c')](_0x41b97a[_0x7365('0x31')][_0x7365('0x1c')]);_0x2af1fc[_0x7365('0x19')]=qs[_0x7365('0x19')](_0x41b97a[_0x7365('0x31')]['offset']);}_0x2af1fc['order']=qs[_0x7365('0x38')](_0x41b97a['query'][_0x7365('0x38')]);_0x2af1fc[_0x7365('0x39')]=qs['filters'](_[_0x7365('0x3a')](_0x41b97a['query'],_0x2f1c40[_0x7365('0x3b')]),_0x3439ae);if(_0x41b97a[_0x7365('0x31')][_0x7365('0x3c')]){_0x2af1fc[_0x7365('0x39')]=_[_0x7365('0x3d')](_0x2af1fc[_0x7365('0x39')],{'$or':_[_0x7365('0x2c')](_0x3439ae,function(_0x19a33b){if(_0x19a33b[_0x7365('0x3e')]!==_0x7365('0x3f')){var _0x493d4f={};_0x493d4f[_0x19a33b[_0x7365('0x2a')]]={'$like':'%'+_0x41b97a['query']['filter']+'%'};return _0x493d4f;}})});}_0x2af1fc=_[_0x7365('0x3d')]({},_0x2af1fc,_0x41b97a[_0x7365('0x40')]);var _0x266c35={'where':_0x2af1fc[_0x7365('0x39')]};return db[_0x7365('0x2d')][_0x7365('0x1b')](_0x266c35)[_0x7365('0x24')](function(_0x4e646e){_0xbdb78c[_0x7365('0x1b')]=_0x4e646e;if(_0x41b97a[_0x7365('0x31')][_0x7365('0x41')]){_0x2af1fc[_0x7365('0x42')]=[{'all':!![]}];}return db[_0x7365('0x2d')][_0x7365('0x43')](_0x2af1fc);})[_0x7365('0x24')](function(_0x3276c8){_0xbdb78c[_0x7365('0x44')]=_0x3276c8;return _0xbdb78c;})[_0x7365('0x24')](respondWithFilteredResult(_0x29277b,_0x2af1fc))[_0x7365('0x45')](handleError(_0x29277b,null));};exports['show']=function(_0x4b9f1a,_0x5aaf16){var _0x35b966={'raw':![],'where':{'id':_0x4b9f1a[_0x7365('0x46')]['id']}},_0x75e2e1={};_0x75e2e1[_0x7365('0x33')]=_[_0x7365('0x47')](db[_0x7365('0x2d')][_0x7365('0x2e')]);_0x75e2e1['query']=_[_0x7365('0x47')](_0x4b9f1a[_0x7365('0x31')]);_0x75e2e1['filters']=_[_0x7365('0x32')](_0x75e2e1['model'],_0x75e2e1['query']);_0x35b966[_0x7365('0x34')]=_[_0x7365('0x32')](_0x75e2e1[_0x7365('0x33')],qs[_0x7365('0x35')](_0x4b9f1a['query'][_0x7365('0x35')]));_0x35b966[_0x7365('0x34')]=_0x35b966[_0x7365('0x34')][_0x7365('0x48')]?_0x35b966[_0x7365('0x34')]:_0x75e2e1[_0x7365('0x33')];if(_0x4b9f1a['query']['includeAll']){_0x35b966[_0x7365('0x42')]=[{'all':!![]}];}_0x35b966=_[_0x7365('0x3d')]({},_0x35b966,_0x4b9f1a['options']);return db['VoiceChanSpy'][_0x7365('0x49')](_0x35b966)[_0x7365('0x24')](handleEntityNotFound(_0x5aaf16,null))[_0x7365('0x24')](respondWithResult(_0x5aaf16,null))[_0x7365('0x45')](handleError(_0x5aaf16,null));};exports[_0x7365('0x4a')]=function(_0x4333a9,_0x4543af){return db['VoiceChanSpy'][_0x7365('0x4a')](_0x4333a9[_0x7365('0x4b')],{})[_0x7365('0x24')](function(_0x3ff5b9){var _0x3ef995=_0x4333a9[_0x7365('0x4c')]['get']({'plain':!![]});if(!_0x3ef995)throw new Error(_0x7365('0x4d'));if(_0x3ef995[_0x7365('0x4e')]===_0x7365('0x4c')){var _0x38e9ff=_0x3ff5b9[_0x7365('0x26')]({'plain':!![]});var _0x4f4eda='ChanSpies';return db[_0x7365('0x4f')][_0x7365('0x49')]({'where':{'name':_0x4f4eda,'userProfileId':_0x3ef995[_0x7365('0x50')]},'raw':!![]})['then'](function(_0x2e100b){if(_0x2e100b&&_0x2e100b[_0x7365('0x51')]===0x0){return db[_0x7365('0x27')][_0x7365('0x4a')]({'name':_0x38e9ff['name'],'resourceId':_0x38e9ff['id'],'type':_0x2e100b[_0x7365('0x2a')],'sectionId':_0x2e100b['id']},{})[_0x7365('0x24')](function(){return _0x3ff5b9;});}else{return _0x3ff5b9;}})[_0x7365('0x45')](function(_0x3ec79c){logger[_0x7365('0x52')](_0x7365('0x53'),_0x3ec79c);throw _0x3ec79c;});}return _0x3ff5b9;})[_0x7365('0x24')](respondWithResult(_0x4543af,0xc9))[_0x7365('0x45')](handleError(_0x4543af,null));};exports[_0x7365('0x23')]=function(_0x3522f0,_0x5b9726){if(_0x3522f0[_0x7365('0x4b')]['id']){delete _0x3522f0[_0x7365('0x4b')]['id'];}return db['VoiceChanSpy'][_0x7365('0x49')]({'where':{'id':_0x3522f0[_0x7365('0x46')]['id']}})[_0x7365('0x24')](handleEntityNotFound(_0x5b9726,null))[_0x7365('0x24')](saveUpdates(_0x3522f0['body'],null))[_0x7365('0x24')](respondWithResult(_0x5b9726,null))['catch'](handleError(_0x5b9726,null));};exports[_0x7365('0x25')]=function(_0xf7af20,_0x10808e){return db['VoiceChanSpy'][_0x7365('0x49')]({'where':{'id':_0xf7af20['params']['id']}})[_0x7365('0x24')](handleEntityNotFound(_0x10808e,null))[_0x7365('0x24')](removeEntity(_0x10808e,null))[_0x7365('0x45')](handleError(_0x10808e,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index bd2e042..9a3663a 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 _0x1fd1=['merge','MixMonitor','${UNIQUEID}.%s,a','recordingFormat','auth','Authenticate','password','push','ChanSpy','SIP/%s,%s','name','options','join','length','concat','internal','User','findAll','agent','catch','exports','models','VoiceChanSpy','then','VoiceExtension','destroy','bulkCreate','lodash','bluebird','./voiceChanSpy.attributes','context','from-sip','format','prefix','system','Set','CDR(type)=%s','chanspy','record'];(function(_0x63f3f1,_0x1d41c6){var _0x5832b2=function(_0x4951ba){while(--_0x4951ba){_0x63f3f1['push'](_0x63f3f1['shift']());}};_0x5832b2(++_0x1d41c6);}(_0x1fd1,0x1a1));var _0x11fd=function(_0x67525b,_0x414383){_0x67525b=_0x67525b-0x0;var _0x552b2b=_0x1fd1[_0x67525b];return _0x552b2b;};'use strict';var _=require(_0x11fd('0x0'));var util=require('util');var BPromise=require(_0x11fd('0x1'));var attributes=require(_0x11fd('0x2'));var getUserApplications=function(_0xf88203,_0x2bfc67,_0x3624b4){var _0x596667=0x1;var _0x165764=[];var _0x99c577={'context':_0x2bfc67[_0x11fd('0x3')]||_0x11fd('0x4'),'exten':util[_0x11fd('0x5')]('%s%s',_0xf88203[_0x11fd('0x6')],_0x3624b4),'type':_0x11fd('0x7'),'isApp':![],'ChanSpyId':_0xf88203['id'],'UserId':_0x2bfc67['id']};_0x165764['push'](_['merge']({'app':_0x11fd('0x8'),'appdata':util['format'](_0x11fd('0x9'),_0x11fd('0xa')),'priority':_0x596667++},_0x99c577));if(_0xf88203[_0x11fd('0xb')]){_0x165764['push'](_[_0x11fd('0xc')]({'app':_0x11fd('0xd'),'appdata':util['format'](_0x11fd('0xe'),_0xf88203[_0x11fd('0xf')]),'priority':_0x596667++},_0x99c577));}if(_0xf88203[_0x11fd('0x10')]){_0x165764['push'](_[_0x11fd('0xc')]({'app':_0x11fd('0x11'),'appdata':_0xf88203[_0x11fd('0x12')],'priority':_0x596667++},_0x99c577));}_0x165764[_0x11fd('0x13')](_[_0x11fd('0xc')]({'app':_0x11fd('0x14'),'appdata':util[_0x11fd('0x5')](_0x11fd('0x15'),_0x2bfc67[_0x11fd('0x16')],_0xf88203[_0x11fd('0x17')]?_0xf88203[_0x11fd('0x17')][_0x11fd('0x18')](''):''),'priority':_0x596667++},_0x99c577));if(_0xf88203[_0x11fd('0xb')]){_0x165764[_0x11fd('0x13')](_[_0x11fd('0xc')]({'app':'StopMixMonitor','priority':_0x596667++},_0x99c577));}return _0x165764;};var getChanSpyApplications=function(_0x30921e,_0x33b1fd){var _0x1dcd46=[];for(var _0x5449f2=0x0,_0x1c4afb=0x1;_0x5449f2<_0x33b1fd[_0x11fd('0x19')];_0x5449f2++,_0x1c4afb=0x1){_0x1dcd46=_0x1dcd46[_0x11fd('0x1a')](getUserApplications(_0x30921e,_0x33b1fd[_0x5449f2],_0x33b1fd[_0x5449f2][_0x11fd('0x1b')]));if(_0x33b1fd[_0x5449f2][_0x11fd('0x1b')]!=_0x33b1fd[_0x5449f2][_0x11fd('0x16')]){_0x1dcd46=_0x1dcd46['concat'](getUserApplications(_0x30921e,_0x33b1fd[_0x5449f2],_0x33b1fd[_0x5449f2][_0x11fd('0x16')]));}}return _0x1dcd46;};var getChanSpyPromise=function(_0x25b92b,_0x3f6667){return new BPromise(function(_0x5b292d,_0x19a77e){return _0x25b92b[_0x11fd('0x1c')][_0x11fd('0x1d')]({'attributes':['id',_0x11fd('0x16'),'internal'],'where':{'role':_0x11fd('0x1e'),'chanspy':!![]},'raw':!![]})['then'](function(_0x2cfe43){if(_0x2cfe43){return _0x5b292d(getChanSpyApplications(_0x3f6667,_0x2cfe43));}return _0x5b292d([]);})[_0x11fd('0x1f')](function(_0x8c8036){_0x19a77e(_0x8c8036);});});};module[_0x11fd('0x20')]=function(_0x1d0829,_0x4e57bf){var _0x563825=_0x1d0829[_0x11fd('0x21')];return _0x1d0829['define'](_0x11fd('0x22'),attributes,{'tableName':'voice_chanspy','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x3fa269,_0x270bc6,_0x423f86){return getChanSpyPromise(_0x563825,_0x3fa269)[_0x11fd('0x23')](function(_0x1b78c0){if(_0x1b78c0&&_0x1b78c0[_0x11fd('0x19')]){return _0x563825[_0x11fd('0x24')]['bulkCreate'](_0x1b78c0);}})[_0x11fd('0x23')](function(){_0x423f86();})[_0x11fd('0x1f')](function(_0x23be25){_0x423f86(_0x23be25);});},'afterUpdate':function(_0x472465,_0x44a85f,_0x1fb57c){return _0x563825[_0x11fd('0x24')][_0x11fd('0x25')]({'where':{'ChanSpyId':_0x472465['id']}})['then'](function(){return getChanSpyPromise(_0x563825,_0x472465);})[_0x11fd('0x23')](function(_0x485466){if(_0x485466&&_0x485466[_0x11fd('0x19')]){return _0x563825[_0x11fd('0x24')][_0x11fd('0x26')](_0x485466);}})[_0x11fd('0x23')](function(){_0x1fb57c();})['catch'](function(_0x2936ee){_0x1fb57c(_0x2936ee);});},'afterDestroy':function(_0x53d553,_0x371414,_0x383918){return _0x563825[_0x11fd('0x24')][_0x11fd('0x25')]({'where':{'ChanSpyId':_0x53d553['id']}})['then'](function(){_0x383918();})[_0x11fd('0x1f')](function(_0x302e75){_0x383918(_0x302e75);});}}});}; \ No newline at end of file +var _0x6d43=['%s%s','prefix','system','merge','format','CDR(type)=%s','chanspy','MixMonitor','${UNIQUEID}.%s,a','recordingFormat','Authenticate','push','SIP/%s,%s','name','options','join','record','StopMixMonitor','length','internal','concat','findAll','agent','catch','exports','models','define','VoiceChanSpy','voice_chanspy','then','VoiceExtension','bulkCreate','destroy','lodash','util','context','from-sip'];(function(_0x292419,_0x298ef2){var _0x20dc90=function(_0x2e468a){while(--_0x2e468a){_0x292419['push'](_0x292419['shift']());}};_0x20dc90(++_0x298ef2);}(_0x6d43,0x124));var _0x36d4=function(_0x378930,_0x2d5b88){_0x378930=_0x378930-0x0;var _0x2b6a1e=_0x6d43[_0x378930];return _0x2b6a1e;};'use strict';var _=require(_0x36d4('0x0'));var util=require(_0x36d4('0x1'));var BPromise=require('bluebird');var attributes=require('./voiceChanSpy.attributes');var getUserApplications=function(_0x1e6082,_0x529c26,_0x20df09){var _0x5501b3=0x1;var _0x6b24f4=[];var _0x360e5e={'context':_0x529c26[_0x36d4('0x2')]||_0x36d4('0x3'),'exten':util['format'](_0x36d4('0x4'),_0x1e6082[_0x36d4('0x5')],_0x20df09),'type':_0x36d4('0x6'),'isApp':![],'ChanSpyId':_0x1e6082['id'],'UserId':_0x529c26['id']};_0x6b24f4['push'](_[_0x36d4('0x7')]({'app':'Set','appdata':util[_0x36d4('0x8')](_0x36d4('0x9'),_0x36d4('0xa')),'priority':_0x5501b3++},_0x360e5e));if(_0x1e6082['record']){_0x6b24f4['push'](_[_0x36d4('0x7')]({'app':_0x36d4('0xb'),'appdata':util[_0x36d4('0x8')](_0x36d4('0xc'),_0x1e6082[_0x36d4('0xd')]),'priority':_0x5501b3++},_0x360e5e));}if(_0x1e6082['auth']){_0x6b24f4['push'](_['merge']({'app':_0x36d4('0xe'),'appdata':_0x1e6082['password'],'priority':_0x5501b3++},_0x360e5e));}_0x6b24f4[_0x36d4('0xf')](_['merge']({'app':'ChanSpy','appdata':util['format'](_0x36d4('0x10'),_0x529c26[_0x36d4('0x11')],_0x1e6082['options']?_0x1e6082[_0x36d4('0x12')][_0x36d4('0x13')](''):''),'priority':_0x5501b3++},_0x360e5e));if(_0x1e6082[_0x36d4('0x14')]){_0x6b24f4[_0x36d4('0xf')](_[_0x36d4('0x7')]({'app':_0x36d4('0x15'),'priority':_0x5501b3++},_0x360e5e));}return _0x6b24f4;};var getChanSpyApplications=function(_0x36a209,_0x4e79db){var _0x456288=[];for(var _0x370426=0x0,_0x2282b0=0x1;_0x370426<_0x4e79db[_0x36d4('0x16')];_0x370426++,_0x2282b0=0x1){_0x456288=_0x456288['concat'](getUserApplications(_0x36a209,_0x4e79db[_0x370426],_0x4e79db[_0x370426][_0x36d4('0x17')]));if(_0x4e79db[_0x370426]['internal']!=_0x4e79db[_0x370426][_0x36d4('0x11')]){_0x456288=_0x456288[_0x36d4('0x18')](getUserApplications(_0x36a209,_0x4e79db[_0x370426],_0x4e79db[_0x370426][_0x36d4('0x11')]));}}return _0x456288;};var getChanSpyPromise=function(_0x441248,_0x15c894){return new BPromise(function(_0x101517,_0x13ceb2){return _0x441248['User'][_0x36d4('0x19')]({'attributes':['id','name','internal'],'where':{'role':_0x36d4('0x1a'),'chanspy':!![]},'raw':!![]})['then'](function(_0x1cf7fc){if(_0x1cf7fc){return _0x101517(getChanSpyApplications(_0x15c894,_0x1cf7fc));}return _0x101517([]);})[_0x36d4('0x1b')](function(_0x3e55bd){_0x13ceb2(_0x3e55bd);});});};module[_0x36d4('0x1c')]=function(_0x418a3a,_0xc976f7){var _0x34be56=_0x418a3a[_0x36d4('0x1d')];return _0x418a3a[_0x36d4('0x1e')](_0x36d4('0x1f'),attributes,{'tableName':_0x36d4('0x20'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x28c923,_0x5e6a12,_0x59bcd5){return getChanSpyPromise(_0x34be56,_0x28c923)[_0x36d4('0x21')](function(_0x2d62b8){if(_0x2d62b8&&_0x2d62b8[_0x36d4('0x16')]){return _0x34be56[_0x36d4('0x22')][_0x36d4('0x23')](_0x2d62b8);}})['then'](function(){_0x59bcd5();})['catch'](function(_0x1f9614){_0x59bcd5(_0x1f9614);});},'afterUpdate':function(_0x4ee097,_0x383c91,_0x345ff6){return _0x34be56[_0x36d4('0x22')][_0x36d4('0x24')]({'where':{'ChanSpyId':_0x4ee097['id']}})[_0x36d4('0x21')](function(){return getChanSpyPromise(_0x34be56,_0x4ee097);})['then'](function(_0x443dc5){if(_0x443dc5&&_0x443dc5[_0x36d4('0x16')]){return _0x34be56[_0x36d4('0x22')]['bulkCreate'](_0x443dc5);}})['then'](function(){_0x345ff6();})[_0x36d4('0x1b')](function(_0x52a59e){_0x345ff6(_0x52a59e);});},'afterDestroy':function(_0x168c03,_0x568b1b,_0x350bc2){return _0x34be56[_0x36d4('0x22')][_0x36d4('0x24')]({'where':{'ChanSpyId':_0x168c03['id']}})[_0x36d4('0x21')](function(){_0x350bc2();})['catch'](function(_0x590f63){_0x350bc2(_0x590f63);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index 1053352..e792bd4 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 _0x5eb1=['../../config/environment','jayson/promise','http','request','then','info','VoiceChanSpy,\x20%s,\x20%s','request\x20sent','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','stringify','error','message','result','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc'];(function(_0x2c7618,_0x26be9c){var _0x5ce3f0=function(_0x1837b3){while(--_0x1837b3){_0x2c7618['push'](_0x2c7618['shift']());}};_0x5ce3f0(++_0x26be9c);}(_0x5eb1,0x7c));var _0x15eb=function(_0x3c5fec,_0x4fecdf){_0x3c5fec=_0x3c5fec-0x0;var _0x47eafa=_0x5eb1[_0x3c5fec];return _0x47eafa;};'use strict';var _=require('lodash');var util=require(_0x15eb('0x0'));var moment=require(_0x15eb('0x1'));var BPromise=require(_0x15eb('0x2'));var rs=require(_0x15eb('0x3'));var fs=require('fs');var Redis=require(_0x15eb('0x4'));var db=require(_0x15eb('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x15eb('0x6'))(_0x15eb('0x7'));var config=require(_0x15eb('0x8'));var jayson=require(_0x15eb('0x9'));var client=jayson['client'][_0x15eb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x212692,_0x594f54,_0xe4d8ce){return new BPromise(function(_0x160879,_0x730b12){return client[_0x15eb('0xb')](_0x212692,_0xe4d8ce)[_0x15eb('0xc')](function(_0x2ad2c1){logger[_0x15eb('0xd')](_0x15eb('0xe'),_0x594f54,_0x15eb('0xf'));logger[_0x15eb('0x10')](_0x15eb('0x11'),_0x594f54,_0x15eb('0xf'),JSON[_0x15eb('0x12')](_0x2ad2c1));if(_0x2ad2c1['error']){if(_0x2ad2c1[_0x15eb('0x13')]['code']===0x1f4){logger['error']('VoiceChanSpy,\x20%s,\x20%s',_0x594f54,_0x2ad2c1[_0x15eb('0x13')][_0x15eb('0x14')]);return _0x730b12(_0x2ad2c1[_0x15eb('0x13')][_0x15eb('0x14')]);}logger['error'](_0x15eb('0xe'),_0x594f54,_0x2ad2c1[_0x15eb('0x13')][_0x15eb('0x14')]);return _0x160879(_0x2ad2c1[_0x15eb('0x13')]['message']);}else{logger['info']('VoiceChanSpy,\x20%s,\x20%s',_0x594f54,'request\x20sent');_0x160879(_0x2ad2c1[_0x15eb('0x15')]['message']);}})['catch'](function(_0x3a78e9){logger['error'](_0x15eb('0xe'),_0x594f54,_0x3a78e9);_0x730b12(_0x3a78e9);});});} \ No newline at end of file +var _0x2356=['then','info','VoiceChanSpy,\x20%s,\x20%s','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','util','moment','ioredis','../../mysqldb','rpc','client','http'];(function(_0xb054e3,_0x235c2f){var _0x3e6c59=function(_0x58a6cc){while(--_0x58a6cc){_0xb054e3['push'](_0xb054e3['shift']());}};_0x3e6c59(++_0x235c2f);}(_0x2356,0x14f));var _0x6235=function(_0x42df18,_0x57ce64){_0x42df18=_0x42df18-0x0;var _0x1f5a27=_0x2356[_0x42df18];return _0x1f5a27;};'use strict';var _=require('lodash');var util=require(_0x6235('0x0'));var moment=require(_0x6235('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6235('0x2'));var db=require(_0x6235('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x6235('0x4'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x6235('0x5')][_0x6235('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x3663e7,_0x47f3a5,_0x4c15c6){return new BPromise(function(_0x547159,_0x3a5750){return client['request'](_0x3663e7,_0x4c15c6)[_0x6235('0x7')](function(_0x11d1f9){logger[_0x6235('0x8')](_0x6235('0x9'),_0x47f3a5,'request\x20sent');logger[_0x6235('0xa')](_0x6235('0xb'),_0x47f3a5,_0x6235('0xc'),JSON[_0x6235('0xd')](_0x11d1f9));if(_0x11d1f9[_0x6235('0xe')]){if(_0x11d1f9['error'][_0x6235('0xf')]===0x1f4){logger[_0x6235('0xe')](_0x6235('0x9'),_0x47f3a5,_0x11d1f9[_0x6235('0xe')]['message']);return _0x3a5750(_0x11d1f9[_0x6235('0xe')][_0x6235('0x10')]);}logger['error'](_0x6235('0x9'),_0x47f3a5,_0x11d1f9['error'][_0x6235('0x10')]);return _0x547159(_0x11d1f9[_0x6235('0xe')]['message']);}else{logger[_0x6235('0x8')](_0x6235('0x9'),_0x47f3a5,_0x6235('0xc'));_0x547159(_0x11d1f9[_0x6235('0x11')]['message']);}})[_0x6235('0x12')](function(_0x190d7c){logger[_0x6235('0xe')](_0x6235('0x9'),_0x47f3a5,_0x190d7c);_0x3a5750(_0x190d7c);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index 40c56a2..5b307a8 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 _0xd146=['path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceContext.controller','isAuthenticated','/:id','post','put','update','delete','exports','util'];(function(_0xdc9aa0,_0x2c11ea){var _0xf47e4=function(_0xf5756f){while(--_0xf5756f){_0xdc9aa0['push'](_0xdc9aa0['shift']());}};_0xf47e4(++_0x2c11ea);}(_0xd146,0x15f));var _0x6d14=function(_0x2316e5,_0x21ad35){_0x2316e5=_0x2316e5-0x0;var _0x29c9c6=_0xd146[_0x2316e5];return _0x29c9c6;};'use strict';var multer=require('multer');var util=require(_0x6d14('0x0'));var path=require(_0x6d14('0x1'));var timeout=require('connect-timeout');var express=require(_0x6d14('0x2'));var router=express[_0x6d14('0x3')]();var fs_extra=require(_0x6d14('0x4'));var auth=require(_0x6d14('0x5'));var interaction=require(_0x6d14('0x6'));var config=require(_0x6d14('0x7'));var controller=require(_0x6d14('0x8'));router['get']('/',auth[_0x6d14('0x9')](),controller['index']);router['get'](_0x6d14('0xa'),auth[_0x6d14('0x9')](),controller['show']);router[_0x6d14('0xb')]('/',auth[_0x6d14('0x9')](),controller['create']);router[_0x6d14('0xc')](_0x6d14('0xa'),auth[_0x6d14('0x9')](),controller[_0x6d14('0xd')]);router[_0x6d14('0xe')](_0x6d14('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0x6d14('0xf')]=router; \ No newline at end of file +var _0x51f6=['exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceContext.controller','get','index','/:id','isAuthenticated','post','create','put','update','delete','destroy'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x51f6,0x169));var _0x651f=function(_0xf61301,_0x4d93a9){_0xf61301=_0xf61301-0x0;var _0x7201f4=_0x51f6[_0xf61301];return _0x7201f4;};'use strict';var multer=require(_0x651f('0x0'));var util=require(_0x651f('0x1'));var path=require(_0x651f('0x2'));var timeout=require('connect-timeout');var express=require(_0x651f('0x3'));var router=express[_0x651f('0x4')]();var fs_extra=require(_0x651f('0x5'));var auth=require(_0x651f('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x651f('0x7'));var controller=require(_0x651f('0x8'));router[_0x651f('0x9')]('/',auth['isAuthenticated'](),controller[_0x651f('0xa')]);router['get'](_0x651f('0xb'),auth[_0x651f('0xc')](),controller['show']);router[_0x651f('0xd')]('/',auth[_0x651f('0xc')](),controller[_0x651f('0xe')]);router[_0x651f('0xf')](_0x651f('0xb'),auth[_0x651f('0xc')](),controller[_0x651f('0x10')]);router[_0x651f('0x11')]('/:id',auth[_0x651f('0xc')](),controller[_0x651f('0x12')]);module[_0x651f('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.attributes.js b/server/api/voiceContext/voiceContext.attributes.js index 8fe3ef1..e527844 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 _0x894d=['sequelize','exports','STRING'];(function(_0x1deed5,_0x57fe60){var _0x3ac891=function(_0x209a6d){while(--_0x209a6d){_0x1deed5['push'](_0x1deed5['shift']());}};_0x3ac891(++_0x57fe60);}(_0x894d,0x129));var _0xd894=function(_0x436d19,_0x3369c2){_0x436d19=_0x436d19-0x0;var _0x4c403c=_0x894d[_0x436d19];return _0x4c403c;};'use strict';var Sequelize=require(_0xd894('0x0'));module[_0xd894('0x1')]={'name':{'type':Sequelize[_0xd894('0x2')],'unique':'name'},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultEntry':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0}}; \ No newline at end of file +var _0x2d3e=['exports','STRING','name','BOOLEAN'];(function(_0x2d8fc2,_0x1c461d){var _0x3a9e53=function(_0x18941c){while(--_0x18941c){_0x2d8fc2['push'](_0x2d8fc2['shift']());}};_0x3a9e53(++_0x1c461d);}(_0x2d3e,0x1b8));var _0xe2d3=function(_0x2bba5f,_0x4e0e85){_0x2bba5f=_0x2bba5f-0x0;var _0x475de7=_0x2d3e[_0x2bba5f];return _0x475de7;};'use strict';var Sequelize=require('sequelize');module[_0xe2d3('0x0')]={'name':{'type':Sequelize[_0xe2d3('0x1')],'unique':_0xe2d3('0x2')},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0xe2d3('0x3')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.controller.js b/server/api/voiceContext/voiceContext.controller.js index 5faebdc..7661631 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 _0x62c9=['rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','jayson/promise','client','http','request','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','end','status','offset','undefined','limit','count','json','apply','reject','save','update','then','get','Contexts','destroy','stack','name','send','index','map','VoiceContext','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','show','params','keys','create','body','findAll','readFileSync','join','root','server/files/templates/context.ejs','/etc/asterisk/extensions_xcally_contexts.conf','Reload','chan_sip.so','user','role','UserProfileSection','find','autoAssociation','render','writeFileSync','eml-format'];(function(_0x24ca51,_0x4d69dd){var _0x58d4da=function(_0x4497c4){while(--_0x4497c4){_0x24ca51['push'](_0x24ca51['shift']());}};_0x58d4da(++_0x4d69dd);}(_0x62c9,0x66));var _0x962c=function(_0x6c4017,_0x6a3ab1){_0x6c4017=_0x6c4017-0x0;var _0x2b8983=_0x62c9[_0x6c4017];return _0x2b8983;};'use strict';var emlformat=require(_0x962c('0x0'));var rimraf=require(_0x962c('0x1'));var zipdir=require(_0x962c('0x2'));var jsonpatch=require(_0x962c('0x3'));var rp=require('request-promise');var moment=require(_0x962c('0x4'));var BPromise=require(_0x962c('0x5'));var Mustache=require(_0x962c('0x6'));var util=require('util');var path=require(_0x962c('0x7'));var sox=require('sox');var csv=require(_0x962c('0x8'));var ejs=require(_0x962c('0x9'));var fs=require('fs');var fs_extra=require(_0x962c('0xa'));var _=require(_0x962c('0xb'));var squel=require(_0x962c('0xc'));var crypto=require(_0x962c('0xd'));var jsforce=require(_0x962c('0xe'));var deskjs=require(_0x962c('0xf'));var toCsv=require(_0x962c('0x8'));var querystring=require(_0x962c('0x10'));var Papa=require('papaparse');var Redis=require(_0x962c('0x11'));var authService=require(_0x962c('0x12'));var qs=require(_0x962c('0x13'));var as=require(_0x962c('0x14'));var hardwareService=require(_0x962c('0x15'));var logger=require('../../config/logger')(_0x962c('0x16'));var utils=require('../../config/utils');var config=require(_0x962c('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var jayson=require(_0x962c('0x18'));var client=jayson[_0x962c('0x19')][_0x962c('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0xf73a5d,_0x4474c9,_0x59696a,_0x39b4c7){return new BPromise(function(_0x1171f9,_0x4d1a26){var _0x422bcd=_0x39b4c7||client;return _0x422bcd[_0x962c('0x1b')](_0xf73a5d,_0x59696a)['then'](function(_0x23c9f4){logger[_0x962c('0x1c')](_0x962c('0x1d'),_0x4474c9,_0x962c('0x1e'));logger[_0x962c('0x1f')](_0x962c('0x20'),_0x4474c9,_0x962c('0x1e'),JSON['stringify'](_0x23c9f4));if(_0x23c9f4[_0x962c('0x21')]){if(_0x23c9f4[_0x962c('0x21')][_0x962c('0x22')]===0x1f4){logger[_0x962c('0x21')](_0x962c('0x1d'),_0x4474c9,_0x23c9f4['error']['message']);return _0x4d1a26(_0x23c9f4[_0x962c('0x21')]['message']);}logger['error'](_0x962c('0x1d'),_0x4474c9,_0x23c9f4[_0x962c('0x21')][_0x962c('0x23')]);return _0x1171f9(_0x23c9f4['error']['message']);}else{logger['info']('VoiceContext,\x20%s,\x20%s',_0x4474c9,_0x962c('0x1e'));_0x1171f9(_0x23c9f4[_0x962c('0x24')]['message']);}})[_0x962c('0x25')](function(_0x3e12d9){logger['error'](_0x962c('0x1d'),_0x4474c9,_0x3e12d9);_0x4d1a26(_0x3e12d9);});});}function respondWithStatusCode(_0x3f54b1,_0xcbb09d){_0xcbb09d=_0xcbb09d||0xcc;return function(_0x2ad8d8){if(_0x2ad8d8){return _0x3f54b1[_0x962c('0x26')](_0xcbb09d);}return _0x3f54b1['status'](_0xcbb09d)[_0x962c('0x27')]();};}function respondWithResult(_0x267596,_0x1b8376){_0x1b8376=_0x1b8376||0xc8;return function(_0x48e74b){if(_0x48e74b){return _0x267596[_0x962c('0x28')](_0x1b8376)['json'](_0x48e74b);}};}function respondWithFilteredResult(_0x38fae1,_0x582630){return function(_0x45ef71){if(_0x45ef71){var _0x51cc0c=typeof _0x582630[_0x962c('0x29')]===_0x962c('0x2a')&&typeof _0x582630[_0x962c('0x2b')]===_0x962c('0x2a');var _0x247050=_0x45ef71['count'];var _0x3e107b=_0x51cc0c?0x0:_0x582630['offset'];var _0x50d55c=_0x51cc0c?_0x45ef71[_0x962c('0x2c')]:_0x582630[_0x962c('0x29')]+_0x582630['limit'];var _0x2364d6;if(_0x50d55c>=_0x247050){_0x50d55c=_0x247050;_0x2364d6=0xc8;}else{_0x2364d6=0xce;}_0x38fae1[_0x962c('0x28')](_0x2364d6);return _0x38fae1['set']('Content-Range',_0x3e107b+'-'+_0x50d55c+'/'+_0x247050)[_0x962c('0x2d')](_0x45ef71);}return null;};}function patchUpdates(_0xdaafe5){return function(_0x59bfdc){try{jsonpatch[_0x962c('0x2e')](_0x59bfdc,_0xdaafe5,!![]);}catch(_0x4199a1){return BPromise[_0x962c('0x2f')](_0x4199a1);}return _0x59bfdc[_0x962c('0x30')]();};}function saveUpdates(_0x51cbf7,_0x30493f){return function(_0x29aa4a){if(_0x29aa4a){return _0x29aa4a[_0x962c('0x31')](_0x51cbf7)[_0x962c('0x32')](function(_0x352c69){return _0x352c69;});}return null;};}function removeEntity(_0x25af91,_0x25a846){return function(_0xeb62f8){if(_0xeb62f8){return _0xeb62f8['destroy']()[_0x962c('0x32')](function(){var _0x35e06e=_0xeb62f8[_0x962c('0x33')]({'plain':!![]});var _0x1d8d6b=_0x962c('0x34');return db['UserProfileResource'][_0x962c('0x35')]({'where':{'type':_0x1d8d6b,'resourceId':_0x35e06e['id']}})[_0x962c('0x32')](function(){return _0xeb62f8;});})['then'](function(){_0x25af91['status'](0xcc)[_0x962c('0x27')]();});}};}function handleEntityNotFound(_0xfa1e62,_0x1e5a46){return function(_0x24c3ba){if(!_0x24c3ba){_0xfa1e62['sendStatus'](0x194);}return _0x24c3ba;};}function handleError(_0x1e1d20,_0x5bfd5d){_0x5bfd5d=_0x5bfd5d||0x1f4;return function(_0x4da90f){logger[_0x962c('0x21')](_0x4da90f[_0x962c('0x36')]);if(_0x4da90f['name']){delete _0x4da90f[_0x962c('0x37')];}_0x1e1d20[_0x962c('0x28')](_0x5bfd5d)[_0x962c('0x38')](_0x4da90f);};}exports[_0x962c('0x39')]=function(_0x4eff71,_0x4a8735){var _0x945895={},_0xc25e62={},_0x34aa4c={'count':0x0,'rows':[]};var _0x301e73=_[_0x962c('0x3a')](db[_0x962c('0x3b')][_0x962c('0x3c')],function(_0x53f3ea){return{'name':_0x53f3ea[_0x962c('0x3d')],'type':_0x53f3ea[_0x962c('0x3e')]['key']};});_0xc25e62[_0x962c('0x3f')]=_[_0x962c('0x3a')](_0x301e73,_0x962c('0x37'));_0xc25e62[_0x962c('0x40')]=_['keys'](_0x4eff71['query']);_0xc25e62[_0x962c('0x41')]=_[_0x962c('0x42')](_0xc25e62[_0x962c('0x3f')],_0xc25e62[_0x962c('0x40')]);_0x945895[_0x962c('0x43')]=_[_0x962c('0x42')](_0xc25e62['model'],qs['fields'](_0x4eff71[_0x962c('0x40')][_0x962c('0x44')]));_0x945895['attributes']=_0x945895[_0x962c('0x43')][_0x962c('0x45')]?_0x945895['attributes']:_0xc25e62[_0x962c('0x3f')];if(!_0x4eff71[_0x962c('0x40')][_0x962c('0x46')](_0x962c('0x47'))){_0x945895[_0x962c('0x2b')]=qs[_0x962c('0x2b')](_0x4eff71[_0x962c('0x40')][_0x962c('0x2b')]);_0x945895[_0x962c('0x29')]=qs[_0x962c('0x29')](_0x4eff71[_0x962c('0x40')]['offset']);}_0x945895[_0x962c('0x48')]=qs[_0x962c('0x49')](_0x4eff71['query'][_0x962c('0x49')]);_0x945895[_0x962c('0x4a')]=qs[_0x962c('0x41')](_[_0x962c('0x4b')](_0x4eff71[_0x962c('0x40')],_0xc25e62[_0x962c('0x41')]),_0x301e73);if(_0x4eff71[_0x962c('0x40')][_0x962c('0x4c')]){_0x945895[_0x962c('0x4a')]=_[_0x962c('0x4d')](_0x945895[_0x962c('0x4a')],{'$or':_[_0x962c('0x3a')](_0x301e73,function(_0x4cea5e){if(_0x4cea5e[_0x962c('0x3e')]!==_0x962c('0x4e')){var _0x1609b3={};_0x1609b3[_0x4cea5e[_0x962c('0x37')]]={'$like':'%'+_0x4eff71[_0x962c('0x40')][_0x962c('0x4c')]+'%'};return _0x1609b3;}})});}_0x945895=_[_0x962c('0x4d')]({},_0x945895,_0x4eff71[_0x962c('0x4f')]);var _0x45be81={'where':_0x945895[_0x962c('0x4a')]};return db[_0x962c('0x3b')]['count'](_0x45be81)['then'](function(_0x1672f0){_0x34aa4c[_0x962c('0x2c')]=_0x1672f0;if(_0x4eff71[_0x962c('0x40')][_0x962c('0x50')]){_0x945895[_0x962c('0x51')]=[{'all':!![]}];}return db[_0x962c('0x3b')]['findAll'](_0x945895);})['then'](function(_0x1eb15c){_0x34aa4c[_0x962c('0x52')]=_0x1eb15c;return _0x34aa4c;})[_0x962c('0x32')](respondWithFilteredResult(_0x4a8735,_0x945895))[_0x962c('0x25')](handleError(_0x4a8735,null));};exports[_0x962c('0x53')]=function(_0x5492e5,_0x43983d){var _0x44d60c={'raw':![],'where':{'id':_0x5492e5[_0x962c('0x54')]['id']}},_0x57fed9={};_0x57fed9[_0x962c('0x3f')]=_[_0x962c('0x55')](db['VoiceContext'][_0x962c('0x3c')]);_0x57fed9[_0x962c('0x40')]=_[_0x962c('0x55')](_0x5492e5[_0x962c('0x40')]);_0x57fed9[_0x962c('0x41')]=_[_0x962c('0x42')](_0x57fed9[_0x962c('0x3f')],_0x57fed9[_0x962c('0x40')]);_0x44d60c[_0x962c('0x43')]=_[_0x962c('0x42')](_0x57fed9['model'],qs[_0x962c('0x44')](_0x5492e5[_0x962c('0x40')]['fields']));_0x44d60c[_0x962c('0x43')]=_0x44d60c[_0x962c('0x43')][_0x962c('0x45')]?_0x44d60c[_0x962c('0x43')]:_0x57fed9[_0x962c('0x3f')];if(_0x5492e5[_0x962c('0x40')][_0x962c('0x50')]){_0x44d60c['include']=[{'all':!![]}];}_0x44d60c=_[_0x962c('0x4d')]({},_0x44d60c,_0x5492e5['options']);return db[_0x962c('0x3b')]['find'](_0x44d60c)[_0x962c('0x32')](handleEntityNotFound(_0x43983d,null))[_0x962c('0x32')](respondWithResult(_0x43983d,null))[_0x962c('0x25')](handleError(_0x43983d,null));};exports[_0x962c('0x56')]=function(_0x331822,_0xffe010,_0x348c42){var _0x586858;return db[_0x962c('0x3b')][_0x962c('0x56')](_0x331822[_0x962c('0x57')],{'raw':!![]})[_0x962c('0x32')](function(_0xc13969){_0x586858=_0xc13969;return db[_0x962c('0x3b')][_0x962c('0x58')]({'raw':!![]});})[_0x962c('0x32')](function(_0x2a9c50){var _0x8f9bc7=fs[_0x962c('0x59')](path[_0x962c('0x5a')](config[_0x962c('0x5b')],_0x962c('0x5c')),'utf8');var _0x1f4071=ejs['render'](_0x8f9bc7,{'contexts':_0x2a9c50||[]});fs['writeFileSync'](_0x962c('0x5d'),_0x1f4071);})['then'](function(){return respondWithRpcPromise(_0x962c('0x5e'),'create',{'module':_0x962c('0x5f')});})[_0x962c('0x32')](function(){var _0xeed9c3=_0x331822[_0x962c('0x60')][_0x962c('0x33')]({'plain':!![]});if(!_0xeed9c3)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xeed9c3[_0x962c('0x61')]==='user'){var _0x29faf0=_0x586858[_0x962c('0x33')]({'plain':!![]});return db[_0x962c('0x62')][_0x962c('0x63')]({'where':{'name':'Contexts','userProfileId':_0xeed9c3['userProfileId']},'raw':!![]})['then'](function(_0x363a27){if(_0x363a27&&_0x363a27[_0x962c('0x64')]===0x0){return db['UserProfileResource'][_0x962c('0x56')]({'name':_0x29faf0[_0x962c('0x37')],'resourceId':_0x29faf0['id'],'type':_0x363a27[_0x962c('0x37')],'sectionId':_0x363a27['id']},{})[_0x962c('0x32')](function(){return _0x586858;});}else{return _0x586858;}})[_0x962c('0x25')](function(_0xc6aae4){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xc6aae4);throw _0xc6aae4;});}return _0x586858;})[_0x962c('0x32')](respondWithResult(_0xffe010,0xc9))[_0x962c('0x25')](handleError(_0xffe010,null));};exports[_0x962c('0x31')]=function(_0x4635fc,_0x397bd2,_0x5fbcc4){var _0x3f84d7;return db['VoiceContext'][_0x962c('0x63')]({'where':{'id':_0x4635fc[_0x962c('0x54')]['id']}})[_0x962c('0x32')](handleEntityNotFound(_0x397bd2,null))['then'](saveUpdates(_0x4635fc[_0x962c('0x57')],null))[_0x962c('0x32')](function(_0x358664){if(_0x358664){_0x3f84d7=_0x358664;return db[_0x962c('0x3b')][_0x962c('0x58')]({'raw':!![]});}})[_0x962c('0x32')](function(_0x23f1de){var _0x3b43e1=fs['readFileSync'](path['join'](config[_0x962c('0x5b')],'server/files/templates/context.ejs'),'utf8');var _0x25f5f0=ejs[_0x962c('0x65')](_0x3b43e1,{'contexts':_0x23f1de||[]});fs[_0x962c('0x66')](_0x962c('0x5d'),_0x25f5f0);})[_0x962c('0x32')](function(){return respondWithRpcPromise(_0x962c('0x5e'),'update',{'module':_0x962c('0x5f')});})[_0x962c('0x32')](function(){return _0x3f84d7;})['then'](respondWithResult(_0x397bd2,null))[_0x962c('0x25')](handleError(_0x397bd2,null));};exports[_0x962c('0x35')]=function(_0x3def9a,_0x4450d9,_0x273e81){var _0x10b5d1;return db[_0x962c('0x3b')]['find']({'where':{'id':_0x3def9a[_0x962c('0x54')]['id']}})[_0x962c('0x32')](handleEntityNotFound(_0x4450d9,null))['then'](removeEntity(_0x4450d9,null))[_0x962c('0x32')](function(){return db[_0x962c('0x3b')][_0x962c('0x58')]({'raw':!![]});})[_0x962c('0x32')](function(_0x1d11cc){var _0x339ab0=fs[_0x962c('0x59')](path[_0x962c('0x5a')](config['root'],_0x962c('0x5c')),'utf8');var _0x1530c7=ejs[_0x962c('0x65')](_0x339ab0,{'contexts':_0x1d11cc});fs[_0x962c('0x66')]('/etc/asterisk/extensions_xcally_contexts.conf',_0x1530c7);return respondWithRpcPromise(_0x962c('0x5e'),'destroy',{'module':_0x962c('0x5f')});})[_0x962c('0x25')](handleError(_0x4450d9,null));}; \ No newline at end of file +var _0x671d=['end','json','offset','undefined','count','limit','Content-Range','apply','reject','save','update','get','Contexts','destroy','sendStatus','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','type','VIRTUAL','includeAll','include','VoiceContext','rows','show','params','fields','options','create','body','findAll','root','utf8','render','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','chan_sip.so','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readFileSync','join','server/files/templates/context.ejs','Reload','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','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/environment','../../config/license/util','jayson/promise','client','http','request','then','info','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','message','VoiceContext,\x20%s,\x20%s','result','catch','status'];(function(_0x387e50,_0x106d75){var _0xa79d84=function(_0x308ec7){while(--_0x308ec7){_0x387e50['push'](_0x387e50['shift']());}};_0xa79d84(++_0x106d75);}(_0x671d,0x1f4));var _0xd671=function(_0x1b658,_0x344b6a){_0x1b658=_0x1b658-0x0;var _0x1d17e5=_0x671d[_0x1b658];return _0x1d17e5;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd671('0x0'));var zipdir=require(_0xd671('0x1'));var jsonpatch=require(_0xd671('0x2'));var rp=require(_0xd671('0x3'));var moment=require(_0xd671('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xd671('0x5'));var util=require('util');var path=require('path');var sox=require(_0xd671('0x6'));var csv=require(_0xd671('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd671('0x8'));var _=require('lodash');var squel=require(_0xd671('0x9'));var crypto=require(_0xd671('0xa'));var jsforce=require(_0xd671('0xb'));var deskjs=require(_0xd671('0xc'));var toCsv=require(_0xd671('0x7'));var querystring=require(_0xd671('0xd'));var Papa=require(_0xd671('0xe'));var Redis=require(_0xd671('0xf'));var authService=require(_0xd671('0x10'));var qs=require(_0xd671('0x11'));var as=require(_0xd671('0x12'));var hardwareService=require(_0xd671('0x13'));var logger=require(_0xd671('0x14'))(_0xd671('0x15'));var utils=require('../../config/utils');var config=require(_0xd671('0x16'));var licenseUtil=require(_0xd671('0x17'));var db=require('../../mysqldb')['db'];var jayson=require(_0xd671('0x18'));var client=jayson[_0xd671('0x19')][_0xd671('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x168576,_0x1ca4a8,_0x4123d1,_0x2962ad){return new BPromise(function(_0x5b30b8,_0x5d24cd){var _0x4ca511=_0x2962ad||client;return _0x4ca511[_0xd671('0x1b')](_0x168576,_0x4123d1)[_0xd671('0x1c')](function(_0x3b0537){logger[_0xd671('0x1d')]('VoiceContext,\x20%s,\x20%s',_0x1ca4a8,_0xd671('0x1e'));logger[_0xd671('0x1f')](_0xd671('0x20'),_0x1ca4a8,_0xd671('0x1e'),JSON[_0xd671('0x21')](_0x3b0537));if(_0x3b0537[_0xd671('0x22')]){if(_0x3b0537[_0xd671('0x22')]['code']===0x1f4){logger[_0xd671('0x22')]('VoiceContext,\x20%s,\x20%s',_0x1ca4a8,_0x3b0537[_0xd671('0x22')][_0xd671('0x23')]);return _0x5d24cd(_0x3b0537['error']['message']);}logger[_0xd671('0x22')](_0xd671('0x24'),_0x1ca4a8,_0x3b0537['error']['message']);return _0x5b30b8(_0x3b0537['error'][_0xd671('0x23')]);}else{logger['info'](_0xd671('0x24'),_0x1ca4a8,_0xd671('0x1e'));_0x5b30b8(_0x3b0537[_0xd671('0x25')]['message']);}})[_0xd671('0x26')](function(_0x3c0e2a){logger[_0xd671('0x22')](_0xd671('0x24'),_0x1ca4a8,_0x3c0e2a);_0x5d24cd(_0x3c0e2a);});});}function respondWithStatusCode(_0x406d87,_0x57a35d){_0x57a35d=_0x57a35d||0xcc;return function(_0x529cfd){if(_0x529cfd){return _0x406d87['sendStatus'](_0x57a35d);}return _0x406d87[_0xd671('0x27')](_0x57a35d)[_0xd671('0x28')]();};}function respondWithResult(_0x42b2a4,_0x9d11c8){_0x9d11c8=_0x9d11c8||0xc8;return function(_0x1c439c){if(_0x1c439c){return _0x42b2a4[_0xd671('0x27')](_0x9d11c8)[_0xd671('0x29')](_0x1c439c);}};}function respondWithFilteredResult(_0x1caf01,_0x5b4d62){return function(_0x11124c){if(_0x11124c){var _0x20d180=typeof _0x5b4d62[_0xd671('0x2a')]===_0xd671('0x2b')&&typeof _0x5b4d62['limit']===_0xd671('0x2b');var _0x4f6158=_0x11124c['count'];var _0x1f1ea4=_0x20d180?0x0:_0x5b4d62[_0xd671('0x2a')];var _0x5529b3=_0x20d180?_0x11124c[_0xd671('0x2c')]:_0x5b4d62[_0xd671('0x2a')]+_0x5b4d62[_0xd671('0x2d')];var _0x47de27;if(_0x5529b3>=_0x4f6158){_0x5529b3=_0x4f6158;_0x47de27=0xc8;}else{_0x47de27=0xce;}_0x1caf01[_0xd671('0x27')](_0x47de27);return _0x1caf01['set'](_0xd671('0x2e'),_0x1f1ea4+'-'+_0x5529b3+'/'+_0x4f6158)[_0xd671('0x29')](_0x11124c);}return null;};}function patchUpdates(_0x5c3f27){return function(_0x4b725e){try{jsonpatch[_0xd671('0x2f')](_0x4b725e,_0x5c3f27,!![]);}catch(_0x3a880d){return BPromise[_0xd671('0x30')](_0x3a880d);}return _0x4b725e[_0xd671('0x31')]();};}function saveUpdates(_0x4758e0,_0x4871e3){return function(_0x2201ec){if(_0x2201ec){return _0x2201ec[_0xd671('0x32')](_0x4758e0)[_0xd671('0x1c')](function(_0x41cc8e){return _0x41cc8e;});}return null;};}function removeEntity(_0x1554a0,_0x4678d8){return function(_0x5c5d01){if(_0x5c5d01){return _0x5c5d01['destroy']()[_0xd671('0x1c')](function(){var _0xe92860=_0x5c5d01[_0xd671('0x33')]({'plain':!![]});var _0x487568=_0xd671('0x34');return db['UserProfileResource'][_0xd671('0x35')]({'where':{'type':_0x487568,'resourceId':_0xe92860['id']}})['then'](function(){return _0x5c5d01;});})[_0xd671('0x1c')](function(){_0x1554a0[_0xd671('0x27')](0xcc)[_0xd671('0x28')]();});}};}function handleEntityNotFound(_0x3626c7,_0x4fbdf8){return function(_0x15db36){if(!_0x15db36){_0x3626c7[_0xd671('0x36')](0x194);}return _0x15db36;};}function handleError(_0x10875f,_0x15b306){_0x15b306=_0x15b306||0x1f4;return function(_0x3b9ce7){logger[_0xd671('0x22')](_0x3b9ce7[_0xd671('0x37')]);if(_0x3b9ce7[_0xd671('0x38')]){delete _0x3b9ce7[_0xd671('0x38')];}_0x10875f[_0xd671('0x27')](_0x15b306)[_0xd671('0x39')](_0x3b9ce7);};}exports[_0xd671('0x3a')]=function(_0x86964,_0x56892e){var _0x352588={},_0x847652={},_0x2a9c20={'count':0x0,'rows':[]};var _0x281022=_[_0xd671('0x3b')](db['VoiceContext'][_0xd671('0x3c')],function(_0x1cfb6a){return{'name':_0x1cfb6a[_0xd671('0x3d')],'type':_0x1cfb6a['type'][_0xd671('0x3e')]};});_0x847652[_0xd671('0x3f')]=_[_0xd671('0x3b')](_0x281022,_0xd671('0x38'));_0x847652[_0xd671('0x40')]=_[_0xd671('0x41')](_0x86964['query']);_0x847652[_0xd671('0x42')]=_[_0xd671('0x43')](_0x847652['model'],_0x847652[_0xd671('0x40')]);_0x352588[_0xd671('0x44')]=_['intersection'](_0x847652[_0xd671('0x3f')],qs['fields'](_0x86964[_0xd671('0x40')]['fields']));_0x352588[_0xd671('0x44')]=_0x352588[_0xd671('0x44')][_0xd671('0x45')]?_0x352588['attributes']:_0x847652[_0xd671('0x3f')];if(!_0x86964[_0xd671('0x40')][_0xd671('0x46')](_0xd671('0x47'))){_0x352588['limit']=qs['limit'](_0x86964['query'][_0xd671('0x2d')]);_0x352588[_0xd671('0x2a')]=qs[_0xd671('0x2a')](_0x86964['query'][_0xd671('0x2a')]);}_0x352588[_0xd671('0x48')]=qs[_0xd671('0x49')](_0x86964[_0xd671('0x40')][_0xd671('0x49')]);_0x352588['where']=qs[_0xd671('0x42')](_[_0xd671('0x4a')](_0x86964[_0xd671('0x40')],_0x847652['filters']),_0x281022);if(_0x86964[_0xd671('0x40')][_0xd671('0x4b')]){_0x352588[_0xd671('0x4c')]=_[_0xd671('0x4d')](_0x352588[_0xd671('0x4c')],{'$or':_[_0xd671('0x3b')](_0x281022,function(_0x295edf){if(_0x295edf[_0xd671('0x4e')]!==_0xd671('0x4f')){var _0x5964b2={};_0x5964b2[_0x295edf[_0xd671('0x38')]]={'$like':'%'+_0x86964['query'][_0xd671('0x4b')]+'%'};return _0x5964b2;}})});}_0x352588=_['merge']({},_0x352588,_0x86964['options']);var _0x12ba3a={'where':_0x352588['where']};return db['VoiceContext'][_0xd671('0x2c')](_0x12ba3a)[_0xd671('0x1c')](function(_0x433922){_0x2a9c20['count']=_0x433922;if(_0x86964[_0xd671('0x40')][_0xd671('0x50')]){_0x352588[_0xd671('0x51')]=[{'all':!![]}];}return db[_0xd671('0x52')]['findAll'](_0x352588);})['then'](function(_0x8c8423){_0x2a9c20[_0xd671('0x53')]=_0x8c8423;return _0x2a9c20;})[_0xd671('0x1c')](respondWithFilteredResult(_0x56892e,_0x352588))[_0xd671('0x26')](handleError(_0x56892e,null));};exports[_0xd671('0x54')]=function(_0x10189a,_0x2b10ce){var _0x271dd0={'raw':![],'where':{'id':_0x10189a[_0xd671('0x55')]['id']}},_0xafaff4={};_0xafaff4[_0xd671('0x3f')]=_[_0xd671('0x41')](db[_0xd671('0x52')][_0xd671('0x3c')]);_0xafaff4[_0xd671('0x40')]=_[_0xd671('0x41')](_0x10189a['query']);_0xafaff4[_0xd671('0x42')]=_[_0xd671('0x43')](_0xafaff4[_0xd671('0x3f')],_0xafaff4[_0xd671('0x40')]);_0x271dd0[_0xd671('0x44')]=_['intersection'](_0xafaff4[_0xd671('0x3f')],qs[_0xd671('0x56')](_0x10189a['query'][_0xd671('0x56')]));_0x271dd0['attributes']=_0x271dd0['attributes'][_0xd671('0x45')]?_0x271dd0[_0xd671('0x44')]:_0xafaff4[_0xd671('0x3f')];if(_0x10189a[_0xd671('0x40')][_0xd671('0x50')]){_0x271dd0[_0xd671('0x51')]=[{'all':!![]}];}_0x271dd0=_[_0xd671('0x4d')]({},_0x271dd0,_0x10189a[_0xd671('0x57')]);return db[_0xd671('0x52')]['find'](_0x271dd0)['then'](handleEntityNotFound(_0x2b10ce,null))[_0xd671('0x1c')](respondWithResult(_0x2b10ce,null))[_0xd671('0x26')](handleError(_0x2b10ce,null));};exports[_0xd671('0x58')]=function(_0x571487,_0x3e9652,_0xdf49dc){var _0x1f34c9;return db[_0xd671('0x52')][_0xd671('0x58')](_0x571487[_0xd671('0x59')],{'raw':!![]})[_0xd671('0x1c')](function(_0xfd8089){_0x1f34c9=_0xfd8089;return db['VoiceContext'][_0xd671('0x5a')]({'raw':!![]});})['then'](function(_0xbc48bd){var _0x1be8e3=fs['readFileSync'](path['join'](config[_0xd671('0x5b')],'server/files/templates/context.ejs'),_0xd671('0x5c'));var _0x138590=ejs[_0xd671('0x5d')](_0x1be8e3,{'contexts':_0xbc48bd||[]});fs[_0xd671('0x5e')](_0xd671('0x5f'),_0x138590);})['then'](function(){return respondWithRpcPromise('Reload',_0xd671('0x58'),{'module':_0xd671('0x60')});})[_0xd671('0x1c')](function(){var _0x19ea9e=_0x571487[_0xd671('0x61')][_0xd671('0x33')]({'plain':!![]});if(!_0x19ea9e)throw new Error(_0xd671('0x62'));if(_0x19ea9e['role']===_0xd671('0x61')){var _0x3c3f29=_0x1f34c9[_0xd671('0x33')]({'plain':!![]});return db[_0xd671('0x63')][_0xd671('0x64')]({'where':{'name':_0xd671('0x34'),'userProfileId':_0x19ea9e['userProfileId']},'raw':!![]})[_0xd671('0x1c')](function(_0x578aa6){if(_0x578aa6&&_0x578aa6[_0xd671('0x65')]===0x0){return db[_0xd671('0x66')][_0xd671('0x58')]({'name':_0x3c3f29[_0xd671('0x38')],'resourceId':_0x3c3f29['id'],'type':_0x578aa6[_0xd671('0x38')],'sectionId':_0x578aa6['id']},{})[_0xd671('0x1c')](function(){return _0x1f34c9;});}else{return _0x1f34c9;}})['catch'](function(_0x41563a){logger[_0xd671('0x22')](_0xd671('0x67'),_0x41563a);throw _0x41563a;});}return _0x1f34c9;})[_0xd671('0x1c')](respondWithResult(_0x3e9652,0xc9))[_0xd671('0x26')](handleError(_0x3e9652,null));};exports[_0xd671('0x32')]=function(_0x42212a,_0x459a65,_0x2a8fd9){var _0x5f3cf5;return db[_0xd671('0x52')][_0xd671('0x64')]({'where':{'id':_0x42212a[_0xd671('0x55')]['id']}})[_0xd671('0x1c')](handleEntityNotFound(_0x459a65,null))[_0xd671('0x1c')](saveUpdates(_0x42212a[_0xd671('0x59')],null))[_0xd671('0x1c')](function(_0x20c7ce){if(_0x20c7ce){_0x5f3cf5=_0x20c7ce;return db[_0xd671('0x52')]['findAll']({'raw':!![]});}})['then'](function(_0x5d818a){var _0x4e4f98=fs[_0xd671('0x68')](path[_0xd671('0x69')](config[_0xd671('0x5b')],_0xd671('0x6a')),_0xd671('0x5c'));var _0x2cf1ac=ejs[_0xd671('0x5d')](_0x4e4f98,{'contexts':_0x5d818a||[]});fs[_0xd671('0x5e')](_0xd671('0x5f'),_0x2cf1ac);})['then'](function(){return respondWithRpcPromise(_0xd671('0x6b'),_0xd671('0x32'),{'module':'chan_sip.so'});})[_0xd671('0x1c')](function(){return _0x5f3cf5;})[_0xd671('0x1c')](respondWithResult(_0x459a65,null))[_0xd671('0x26')](handleError(_0x459a65,null));};exports[_0xd671('0x35')]=function(_0x45c19b,_0x37ef1f,_0x24bdc6){var _0xdfebe7;return db[_0xd671('0x52')][_0xd671('0x64')]({'where':{'id':_0x45c19b[_0xd671('0x55')]['id']}})['then'](handleEntityNotFound(_0x37ef1f,null))['then'](removeEntity(_0x37ef1f,null))[_0xd671('0x1c')](function(){return db[_0xd671('0x52')]['findAll']({'raw':!![]});})['then'](function(_0x2d2dff){var _0x13f13c=fs[_0xd671('0x68')](path[_0xd671('0x69')](config['root'],_0xd671('0x6a')),_0xd671('0x5c'));var _0x4a9440=ejs[_0xd671('0x5d')](_0x13f13c,{'contexts':_0x2d2dff});fs['writeFileSync'](_0xd671('0x5f'),_0x4a9440);return respondWithRpcPromise('Reload',_0xd671('0x35'),{'module':_0xd671('0x60')});})['catch'](handleError(_0x37ef1f,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index 62a3efd..c730066 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 _0x905b=['path','rimraf','../../config/environment','exports','voice_contexts','lodash','util','../../config/logger','api','request-promise'];(function(_0x1b7297,_0x488719){var _0x2c8eb4=function(_0x5252a4){while(--_0x5252a4){_0x1b7297['push'](_0x1b7297['shift']());}};_0x2c8eb4(++_0x488719);}(_0x905b,0x87));var _0xb905=function(_0x115f3d,_0x963277){_0x115f3d=_0x115f3d-0x0;var _0x6e69f9=_0x905b[_0x115f3d];return _0x6e69f9;};'use strict';var _=require(_0xb905('0x0'));var util=require(_0xb905('0x1'));var logger=require(_0xb905('0x2'))(_0xb905('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xb905('0x4'));var fs=require('fs');var path=require(_0xb905('0x5'));var rimraf=require(_0xb905('0x6'));var config=require(_0xb905('0x7'));var attributes=require('./voiceContext.attributes');module[_0xb905('0x8')]=function(_0x294506,_0x5b89c2){return _0x294506['define']('VoiceContext',attributes,{'tableName':_0xb905('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3164=['./voiceContext.attributes','exports','voice_contexts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x139578,_0x3607ff){var _0x25b6d9=function(_0x581a34){while(--_0x581a34){_0x139578['push'](_0x139578['shift']());}};_0x25b6d9(++_0x3607ff);}(_0x3164,0x85));var _0x4316=function(_0x574912,_0x3e903e){_0x574912=_0x574912-0x0;var _0x246891=_0x3164[_0x574912];return _0x246891;};'use strict';var _=require(_0x4316('0x0'));var util=require(_0x4316('0x1'));var logger=require(_0x4316('0x2'))(_0x4316('0x3'));var moment=require(_0x4316('0x4'));var BPromise=require(_0x4316('0x5'));var rp=require(_0x4316('0x6'));var fs=require('fs');var path=require(_0x4316('0x7'));var rimraf=require(_0x4316('0x8'));var config=require(_0x4316('0x9'));var attributes=require(_0x4316('0xa'));module[_0x4316('0xb')]=function(_0x3f82c4,_0x364941){return _0x3f82c4['define']('VoiceContext',attributes,{'tableName':_0x4316('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 7acc179..3a847ab 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 _0x5433=['error','code','message','VoiceContext,\x20%s,\x20%s','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info','request\x20sent','VoiceContext,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x3c5a60,_0x327a29){var _0x1ece60=function(_0x350827){while(--_0x350827){_0x3c5a60['push'](_0x3c5a60['shift']());}};_0x1ece60(++_0x327a29);}(_0x5433,0x9f));var _0x3543=function(_0x3c9ccb,_0xe17a4f){_0x3c9ccb=_0x3c9ccb-0x0;var _0xb5a2ba=_0x5433[_0x3c9ccb];return _0xb5a2ba;};'use strict';var _=require(_0x3543('0x0'));var util=require(_0x3543('0x1'));var moment=require(_0x3543('0x2'));var BPromise=require(_0x3543('0x3'));var rs=require(_0x3543('0x4'));var fs=require('fs');var Redis=require(_0x3543('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x3543('0x6'));var logger=require(_0x3543('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x3543('0x8'));var client=jayson[_0x3543('0x9')][_0x3543('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x34abfe,_0x5e8b5d,_0x24794a){return new BPromise(function(_0x13339f,_0x4b8027){return client[_0x3543('0xb')](_0x34abfe,_0x24794a)[_0x3543('0xc')](function(_0x382389){logger[_0x3543('0xd')]('VoiceContext,\x20%s,\x20%s',_0x5e8b5d,_0x3543('0xe'));logger['debug'](_0x3543('0xf'),_0x5e8b5d,_0x3543('0xe'),JSON[_0x3543('0x10')](_0x382389));if(_0x382389[_0x3543('0x11')]){if(_0x382389[_0x3543('0x11')][_0x3543('0x12')]===0x1f4){logger[_0x3543('0x11')]('VoiceContext,\x20%s,\x20%s',_0x5e8b5d,_0x382389['error'][_0x3543('0x13')]);return _0x4b8027(_0x382389['error'][_0x3543('0x13')]);}logger[_0x3543('0x11')](_0x3543('0x14'),_0x5e8b5d,_0x382389['error'][_0x3543('0x13')]);return _0x13339f(_0x382389['error'][_0x3543('0x13')]);}else{logger[_0x3543('0xd')](_0x3543('0x14'),_0x5e8b5d,_0x3543('0xe'));_0x13339f(_0x382389['result']['message']);}})[_0x3543('0x15')](function(_0xb315bb){logger['error'](_0x3543('0x14'),_0x5e8b5d,_0xb315bb);_0x4b8027(_0xb315bb);});});} \ No newline at end of file +var _0xeeeb=['client','http','request\x20sent','debug','stringify','error','code','VoiceContext,\x20%s,\x20%s','message','info','result','util','moment','bluebird','randomstring','ioredis','../../config/utils','jayson/promise'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0xeeeb,0x1bb));var _0xbeee=function(_0x1e58bc,_0x8cddd3){_0x1e58bc=_0x1e58bc-0x0;var _0x41efa1=_0xeeeb[_0x1e58bc];return _0x41efa1;};'use strict';var _=require('lodash');var util=require(_0xbeee('0x0'));var moment=require(_0xbeee('0x1'));var BPromise=require(_0xbeee('0x2'));var rs=require(_0xbeee('0x3'));var fs=require('fs');var Redis=require(_0xbeee('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xbeee('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xbeee('0x6'));var client=jayson[_0xbeee('0x7')][_0xbeee('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x377323,_0x2bf12e,_0x14ba0c){return new BPromise(function(_0x4dc25f,_0x236be1){return client['request'](_0x377323,_0x14ba0c)['then'](function(_0xfa37bd){logger['info']('VoiceContext,\x20%s,\x20%s',_0x2bf12e,_0xbeee('0x9'));logger[_0xbeee('0xa')]('VoiceContext,\x20%s,\x20%s,\x20%s',_0x2bf12e,_0xbeee('0x9'),JSON[_0xbeee('0xb')](_0xfa37bd));if(_0xfa37bd[_0xbeee('0xc')]){if(_0xfa37bd[_0xbeee('0xc')][_0xbeee('0xd')]===0x1f4){logger[_0xbeee('0xc')](_0xbeee('0xe'),_0x2bf12e,_0xfa37bd[_0xbeee('0xc')][_0xbeee('0xf')]);return _0x236be1(_0xfa37bd['error'][_0xbeee('0xf')]);}logger[_0xbeee('0xc')]('VoiceContext,\x20%s,\x20%s',_0x2bf12e,_0xfa37bd[_0xbeee('0xc')]['message']);return _0x4dc25f(_0xfa37bd[_0xbeee('0xc')]['message']);}else{logger[_0xbeee('0x10')](_0xbeee('0xe'),_0x2bf12e,_0xbeee('0x9'));_0x4dc25f(_0xfa37bd[_0xbeee('0x11')]['message']);}})['catch'](function(_0x3ac978){logger[_0xbeee('0xc')]('VoiceContext,\x20%s,\x20%s',_0x2bf12e,_0x3ac978);_0x236be1(_0x3ac978);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index b3234d7..88b622f 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 _0x9292=['express','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceDialReport.controller','get','isAuthenticated','/describe','/:id','create','put','delete','destroy','multer','util','path','connect-timeout'];(function(_0x30ab7e,_0x2d6c1d){var _0x23810b=function(_0x350b3e){while(--_0x350b3e){_0x30ab7e['push'](_0x30ab7e['shift']());}};_0x23810b(++_0x2d6c1d);}(_0x9292,0x176));var _0x2929=function(_0x3acbc1,_0x38c359){_0x3acbc1=_0x3acbc1-0x0;var _0x16afeb=_0x9292[_0x3acbc1];return _0x16afeb;};'use strict';var multer=require(_0x2929('0x0'));var util=require(_0x2929('0x1'));var path=require(_0x2929('0x2'));var timeout=require(_0x2929('0x3'));var express=require(_0x2929('0x4'));var router=express[_0x2929('0x5')]();var fs_extra=require(_0x2929('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x2929('0x7'));var config=require(_0x2929('0x8'));var controller=require(_0x2929('0x9'));router[_0x2929('0xa')]('/',auth[_0x2929('0xb')](),controller['index']);router[_0x2929('0xa')](_0x2929('0xc'),auth[_0x2929('0xb')](),controller['describe']);router['get'](_0x2929('0xd'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0x2929('0xb')](),controller[_0x2929('0xe')]);router[_0x2929('0xf')](_0x2929('0xd'),auth[_0x2929('0xb')](),controller['update']);router[_0x2929('0x10')]('/:id',auth[_0x2929('0xb')](),controller[_0x2929('0x11')]);module['exports']=router; \ No newline at end of file +var _0xe0db=['exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceDialReport.controller','get','isAuthenticated','/describe','describe','show','post','create','/:id','delete','destroy'];(function(_0x737a1f,_0x235fef){var _0x16eba1=function(_0x292aa8){while(--_0x292aa8){_0x737a1f['push'](_0x737a1f['shift']());}};_0x16eba1(++_0x235fef);}(_0xe0db,0x65));var _0xbe0d=function(_0x1eda20,_0x1149f4){_0x1eda20=_0x1eda20-0x0;var _0x31b953=_0xe0db[_0x1eda20];return _0x31b953;};'use strict';var multer=require(_0xbe0d('0x0'));var util=require('util');var path=require(_0xbe0d('0x1'));var timeout=require(_0xbe0d('0x2'));var express=require(_0xbe0d('0x3'));var router=express[_0xbe0d('0x4')]();var fs_extra=require(_0xbe0d('0x5'));var auth=require(_0xbe0d('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xbe0d('0x7'));var controller=require(_0xbe0d('0x8'));router[_0xbe0d('0x9')]('/',auth[_0xbe0d('0xa')](),controller['index']);router[_0xbe0d('0x9')](_0xbe0d('0xb'),auth[_0xbe0d('0xa')](),controller[_0xbe0d('0xc')]);router[_0xbe0d('0x9')]('/:id',auth[_0xbe0d('0xa')](),controller[_0xbe0d('0xd')]);router[_0xbe0d('0xe')]('/',auth[_0xbe0d('0xa')](),controller[_0xbe0d('0xf')]);router['put'](_0xbe0d('0x10'),auth[_0xbe0d('0xa')](),controller['update']);router[_0xbe0d('0x11')](_0xbe0d('0x10'),auth[_0xbe0d('0xa')](),controller[_0xbe0d('0x12')]);module[_0xbe0d('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.attributes.js b/server/api/voiceDialReport/voiceDialReport.attributes.js index 9480beb..c6bc5c2 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 _0xedd9=['DATE','called,connect,complete','exports','STRING','INTEGER'];(function(_0x515608,_0xb33751){var _0x16aa3d=function(_0x27fe55){while(--_0x27fe55){_0x515608['push'](_0x515608['shift']());}};_0x16aa3d(++_0xb33751);}(_0xedd9,0xfc));var _0x9edd=function(_0x404b4f,_0x3615fe){_0x404b4f=_0x404b4f-0x0;var _0x563ad2=_0xedd9[_0x404b4f];return _0x563ad2;};'use strict';var Sequelize=require('sequelize');module[_0x9edd('0x0')]={'privilege':{'type':Sequelize[_0x9edd('0x1')]},'channel':{'type':Sequelize[_0x9edd('0x1')]},'channelstate':{'type':Sequelize[_0x9edd('0x2')]},'channelstatedesc':{'type':Sequelize[_0x9edd('0x1')]},'calleridnum':{'type':Sequelize[_0x9edd('0x1')]},'calleridname':{'type':Sequelize[_0x9edd('0x1')]},'connectedlinenum':{'type':Sequelize[_0x9edd('0x1')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x9edd('0x1')]},'accountcode':{'type':Sequelize[_0x9edd('0x1')]},'context':{'type':Sequelize[_0x9edd('0x1')]},'exten':{'type':Sequelize[_0x9edd('0x1')]},'priority':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize[_0x9edd('0x1')]},'linkedid':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0x9edd('0x1')]},'destchannelstate':{'type':Sequelize[_0x9edd('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0x9edd('0x1')]},'destcalleridnum':{'type':Sequelize[_0x9edd('0x1')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0x9edd('0x1')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0x9edd('0x1')]},'destaccountcode':{'type':Sequelize[_0x9edd('0x1')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0x9edd('0x1')]},'destpriority':{'type':Sequelize[_0x9edd('0x2')]},'destuniqueid':{'type':Sequelize['STRING']},'destlinkedid':{'type':Sequelize[_0x9edd('0x1')]},'dialstring':{'type':Sequelize[_0x9edd('0x1')]},'dialstatus':{'type':Sequelize[_0x9edd('0x1')]},'starttime':{'type':Sequelize[_0x9edd('0x3')]},'answertime':{'type':Sequelize[_0x9edd('0x3')]},'endtime':{'type':Sequelize[_0x9edd('0x3')]},'lastevent':{'type':Sequelize[_0x9edd('0x1')],'comment':_0x9edd('0x4')},'routeId':{'type':Sequelize['INTEGER']},'duration':{'type':Sequelize[_0x9edd('0x2')]},'holdtime':{'type':Sequelize[_0x9edd('0x2')]},'billableseconds':{'type':Sequelize[_0x9edd('0x2')]}}; \ No newline at end of file +var _0xe5b3=['STRING','INTEGER','DATE','exports'];(function(_0x957b63,_0x73eef6){var _0x1e5224=function(_0x468295){while(--_0x468295){_0x957b63['push'](_0x957b63['shift']());}};_0x1e5224(++_0x73eef6);}(_0xe5b3,0x133));var _0x3e5b=function(_0xaf74e9,_0x1095cb){_0xaf74e9=_0xaf74e9-0x0;var _0x305840=_0xe5b3[_0xaf74e9];return _0x305840;};'use strict';var Sequelize=require('sequelize');module[_0x3e5b('0x0')]={'privilege':{'type':Sequelize[_0x3e5b('0x1')]},'channel':{'type':Sequelize[_0x3e5b('0x1')]},'channelstate':{'type':Sequelize[_0x3e5b('0x2')]},'channelstatedesc':{'type':Sequelize[_0x3e5b('0x1')]},'calleridnum':{'type':Sequelize[_0x3e5b('0x1')]},'calleridname':{'type':Sequelize[_0x3e5b('0x1')]},'connectedlinenum':{'type':Sequelize[_0x3e5b('0x1')]},'connectedlinename':{'type':Sequelize[_0x3e5b('0x1')]},'language':{'type':Sequelize[_0x3e5b('0x1')]},'accountcode':{'type':Sequelize[_0x3e5b('0x1')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x3e5b('0x1')]},'priority':{'type':Sequelize[_0x3e5b('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize[_0x3e5b('0x1')]},'destchannel':{'type':Sequelize[_0x3e5b('0x1')]},'destchannelstate':{'type':Sequelize[_0x3e5b('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0x3e5b('0x1')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0x3e5b('0x1')]},'destconnectedlinename':{'type':Sequelize[_0x3e5b('0x1')]},'destlanguage':{'type':Sequelize[_0x3e5b('0x1')]},'destaccountcode':{'type':Sequelize[_0x3e5b('0x1')]},'destcontext':{'type':Sequelize[_0x3e5b('0x1')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0x3e5b('0x2')]},'destuniqueid':{'type':Sequelize['STRING']},'destlinkedid':{'type':Sequelize[_0x3e5b('0x1')]},'dialstring':{'type':Sequelize[_0x3e5b('0x1')]},'dialstatus':{'type':Sequelize[_0x3e5b('0x1')]},'starttime':{'type':Sequelize[_0x3e5b('0x3')]},'answertime':{'type':Sequelize[_0x3e5b('0x3')]},'endtime':{'type':Sequelize[_0x3e5b('0x3')]},'lastevent':{'type':Sequelize[_0x3e5b('0x1')],'comment':'called,connect,complete'},'routeId':{'type':Sequelize[_0x3e5b('0x2')]},'duration':{'type':Sequelize['INTEGER']},'holdtime':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index 925b776..9edd452 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 _0xd028=['../../mysqldb','end','offset','undefined','count','limit','status','set','Content-Range','json','apply','reject','save','update','then','sendStatus','name','map','VoiceDialReport','rawAttributes','fieldName','type','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','findAll','catch','show','include','find','create','body','params','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util'];(function(_0x38d1e9,_0x4870a3){var _0x57c48d=function(_0x3974e8){while(--_0x3974e8){_0x38d1e9['push'](_0x38d1e9['shift']());}};_0x57c48d(++_0x4870a3);}(_0xd028,0x15f));var _0x8d02=function(_0x29f01f,_0x4f9429){_0x29f01f=_0x29f01f-0x0;var _0x404444=_0xd028[_0x29f01f];return _0x404444;};'use strict';var emlformat=require(_0x8d02('0x0'));var rimraf=require(_0x8d02('0x1'));var zipdir=require(_0x8d02('0x2'));var jsonpatch=require(_0x8d02('0x3'));var rp=require('request-promise');var moment=require(_0x8d02('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x8d02('0x5'));var util=require(_0x8d02('0x6'));var path=require(_0x8d02('0x7'));var sox=require(_0x8d02('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8d02('0x9'));var _=require(_0x8d02('0xa'));var squel=require(_0x8d02('0xb'));var crypto=require(_0x8d02('0xc'));var jsforce=require(_0x8d02('0xd'));var deskjs=require(_0x8d02('0xe'));var toCsv=require('to-csv');var querystring=require(_0x8d02('0xf'));var Papa=require(_0x8d02('0x10'));var Redis=require(_0x8d02('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x8d02('0x12'));var as=require(_0x8d02('0x13'));var hardwareService=require(_0x8d02('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x8d02('0x15'));var config=require(_0x8d02('0x16'));var licenseUtil=require(_0x8d02('0x17'));var db=require(_0x8d02('0x18'))['db'];function respondWithStatusCode(_0x49a70e,_0x3b4c0d){_0x3b4c0d=_0x3b4c0d||0xcc;return function(_0x287981){if(_0x287981){return _0x49a70e['sendStatus'](_0x3b4c0d);}return _0x49a70e['status'](_0x3b4c0d)[_0x8d02('0x19')]();};}function respondWithResult(_0x2186e6,_0x2e3886){_0x2e3886=_0x2e3886||0xc8;return function(_0x38db5b){if(_0x38db5b){return _0x2186e6['status'](_0x2e3886)['json'](_0x38db5b);}};}function respondWithFilteredResult(_0x1e9ce5,_0x141075){return function(_0x3bd720){if(_0x3bd720){var _0x39d61a=typeof _0x141075[_0x8d02('0x1a')]===_0x8d02('0x1b')&&typeof _0x141075['limit']===_0x8d02('0x1b');var _0x301d1e=_0x3bd720[_0x8d02('0x1c')];var _0x2ffbec=_0x39d61a?0x0:_0x141075[_0x8d02('0x1a')];var _0x4faf6e=_0x39d61a?_0x3bd720['count']:_0x141075[_0x8d02('0x1a')]+_0x141075[_0x8d02('0x1d')];var _0xcd4688;if(_0x4faf6e>=_0x301d1e){_0x4faf6e=_0x301d1e;_0xcd4688=0xc8;}else{_0xcd4688=0xce;}_0x1e9ce5[_0x8d02('0x1e')](_0xcd4688);return _0x1e9ce5[_0x8d02('0x1f')](_0x8d02('0x20'),_0x2ffbec+'-'+_0x4faf6e+'/'+_0x301d1e)[_0x8d02('0x21')](_0x3bd720);}return null;};}function patchUpdates(_0x56f9a3){return function(_0x5b607f){try{jsonpatch[_0x8d02('0x22')](_0x5b607f,_0x56f9a3,!![]);}catch(_0x5eefcf){return BPromise[_0x8d02('0x23')](_0x5eefcf);}return _0x5b607f[_0x8d02('0x24')]();};}function saveUpdates(_0xa86207,_0x375c6c){return function(_0xe8fc9f){if(_0xe8fc9f){return _0xe8fc9f[_0x8d02('0x25')](_0xa86207)[_0x8d02('0x26')](function(_0x56aad7){return _0x56aad7;});}return null;};}function removeEntity(_0x2068c4,_0x4ef4f8){return function(_0x3bfcb0){if(_0x3bfcb0){return _0x3bfcb0['destroy']()[_0x8d02('0x26')](function(){_0x2068c4[_0x8d02('0x1e')](0xcc)[_0x8d02('0x19')]();});}};}function handleEntityNotFound(_0x33c237,_0x39563f){return function(_0x128f19){if(!_0x128f19){_0x33c237[_0x8d02('0x27')](0x194);}return _0x128f19;};}function handleError(_0x9a792b,_0x1cc6f7){_0x1cc6f7=_0x1cc6f7||0x1f4;return function(_0x357d13){logger['error'](_0x357d13['stack']);if(_0x357d13[_0x8d02('0x28')]){delete _0x357d13[_0x8d02('0x28')];}_0x9a792b[_0x8d02('0x1e')](_0x1cc6f7)['send'](_0x357d13);};}exports['index']=function(_0x3e6724,_0x2959a3){var _0x4cb3f6={},_0x2388ed={},_0x45c27f={'count':0x0,'rows':[]};var _0x519f1d=_[_0x8d02('0x29')](db[_0x8d02('0x2a')][_0x8d02('0x2b')],function(_0x416059){return{'name':_0x416059[_0x8d02('0x2c')],'type':_0x416059[_0x8d02('0x2d')][_0x8d02('0x2e')]};});_0x2388ed[_0x8d02('0x2f')]=_[_0x8d02('0x29')](_0x519f1d,_0x8d02('0x28'));_0x2388ed['query']=_[_0x8d02('0x30')](_0x3e6724[_0x8d02('0x31')]);_0x2388ed['filters']=_[_0x8d02('0x32')](_0x2388ed[_0x8d02('0x2f')],_0x2388ed['query']);_0x4cb3f6[_0x8d02('0x33')]=_[_0x8d02('0x32')](_0x2388ed[_0x8d02('0x2f')],qs[_0x8d02('0x34')](_0x3e6724[_0x8d02('0x31')][_0x8d02('0x34')]));_0x4cb3f6[_0x8d02('0x33')]=_0x4cb3f6[_0x8d02('0x33')][_0x8d02('0x35')]?_0x4cb3f6['attributes']:_0x2388ed[_0x8d02('0x2f')];if(!_0x3e6724['query'][_0x8d02('0x36')](_0x8d02('0x37'))){_0x4cb3f6[_0x8d02('0x1d')]=qs[_0x8d02('0x1d')](_0x3e6724[_0x8d02('0x31')][_0x8d02('0x1d')]);_0x4cb3f6[_0x8d02('0x1a')]=qs['offset'](_0x3e6724[_0x8d02('0x31')][_0x8d02('0x1a')]);}_0x4cb3f6[_0x8d02('0x38')]=qs[_0x8d02('0x39')](_0x3e6724[_0x8d02('0x31')][_0x8d02('0x39')]);_0x4cb3f6[_0x8d02('0x3a')]=qs[_0x8d02('0x3b')](_['pick'](_0x3e6724[_0x8d02('0x31')],_0x2388ed['filters']),_0x519f1d);if(_0x3e6724['query'][_0x8d02('0x3c')]){_0x4cb3f6['where']=_[_0x8d02('0x3d')](_0x4cb3f6[_0x8d02('0x3a')],{'$or':_[_0x8d02('0x29')](_0x519f1d,function(_0x43581d){if(_0x43581d[_0x8d02('0x2d')]!==_0x8d02('0x3e')){var _0x10a321={};_0x10a321[_0x43581d[_0x8d02('0x28')]]={'$like':'%'+_0x3e6724[_0x8d02('0x31')]['filter']+'%'};return _0x10a321;}})});}_0x4cb3f6=_[_0x8d02('0x3d')]({},_0x4cb3f6,_0x3e6724[_0x8d02('0x3f')]);var _0x434894={'where':_0x4cb3f6['where']};return db[_0x8d02('0x2a')]['count'](_0x434894)['then'](function(_0x56aa0d){_0x45c27f[_0x8d02('0x1c')]=_0x56aa0d;if(_0x3e6724[_0x8d02('0x31')][_0x8d02('0x40')]){_0x4cb3f6['include']=[{'all':!![]}];}return db[_0x8d02('0x2a')][_0x8d02('0x41')](_0x4cb3f6);})[_0x8d02('0x26')](function(_0xdad2f1){_0x45c27f['rows']=_0xdad2f1;return _0x45c27f;})['then'](respondWithFilteredResult(_0x2959a3,_0x4cb3f6))[_0x8d02('0x42')](handleError(_0x2959a3,null));};exports[_0x8d02('0x43')]=function(_0x5c326a,_0x302152){var _0x45cde8={'raw':!![],'where':{'id':_0x5c326a['params']['id']}},_0x2be391={};_0x2be391[_0x8d02('0x2f')]=_[_0x8d02('0x30')](db[_0x8d02('0x2a')][_0x8d02('0x2b')]);_0x2be391[_0x8d02('0x31')]=_[_0x8d02('0x30')](_0x5c326a['query']);_0x2be391[_0x8d02('0x3b')]=_[_0x8d02('0x32')](_0x2be391[_0x8d02('0x2f')],_0x2be391[_0x8d02('0x31')]);_0x45cde8[_0x8d02('0x33')]=_[_0x8d02('0x32')](_0x2be391['model'],qs[_0x8d02('0x34')](_0x5c326a['query'][_0x8d02('0x34')]));_0x45cde8[_0x8d02('0x33')]=_0x45cde8[_0x8d02('0x33')]['length']?_0x45cde8[_0x8d02('0x33')]:_0x2be391[_0x8d02('0x2f')];if(_0x5c326a['query'][_0x8d02('0x40')]){_0x45cde8[_0x8d02('0x44')]=[{'all':!![]}];}_0x45cde8=_['merge']({},_0x45cde8,_0x5c326a[_0x8d02('0x3f')]);return db[_0x8d02('0x2a')][_0x8d02('0x45')](_0x45cde8)[_0x8d02('0x26')](handleEntityNotFound(_0x302152,null))[_0x8d02('0x26')](respondWithResult(_0x302152,null))[_0x8d02('0x42')](handleError(_0x302152,null));};exports['create']=function(_0x59d122,_0x3a6e20){return db['VoiceDialReport'][_0x8d02('0x46')](_0x59d122['body'],{})[_0x8d02('0x26')](respondWithResult(_0x3a6e20,0xc9))[_0x8d02('0x42')](handleError(_0x3a6e20,null));};exports[_0x8d02('0x25')]=function(_0x1d36c4,_0x35aaad){if(_0x1d36c4['body']['id']){delete _0x1d36c4[_0x8d02('0x47')]['id'];}return db[_0x8d02('0x2a')][_0x8d02('0x45')]({'where':{'id':_0x1d36c4[_0x8d02('0x48')]['id']}})['then'](handleEntityNotFound(_0x35aaad,null))['then'](saveUpdates(_0x1d36c4[_0x8d02('0x47')],null))[_0x8d02('0x26')](respondWithResult(_0x35aaad,null))[_0x8d02('0x42')](handleError(_0x35aaad,null));};exports[_0x8d02('0x49')]=function(_0x2a863f,_0xb3d262){return db[_0x8d02('0x2a')][_0x8d02('0x45')]({'where':{'id':_0x2a863f['params']['id']}})[_0x8d02('0x26')](handleEntityNotFound(_0xb3d262,null))[_0x8d02('0x26')](removeEntity(_0xb3d262,null))[_0x8d02('0x42')](handleError(_0xb3d262,null));};exports[_0x8d02('0x4a')]=function(_0x3ead24,_0x5d4fe5){return db[_0x8d02('0x2a')]['describe']()[_0x8d02('0x26')](respondWithResult(_0x5d4fe5,null))[_0x8d02('0x42')](handleError(_0x5d4fe5,null));}; \ No newline at end of file +var _0x00d3=['fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','fs-extra','lodash','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','json','undefined','limit','offset','set','update','then','end','sendStatus','error','stack','name','send','index','map','VoiceDialReport','rawAttributes','fieldName','keys','query','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','count','includeAll','include','findAll','catch','show','params','find','create','body','destroy','describe','eml-format'];(function(_0xdf6d86,_0x357d29){var _0x1a7467=function(_0x259c1b){while(--_0x259c1b){_0xdf6d86['push'](_0xdf6d86['shift']());}};_0x1a7467(++_0x357d29);}(_0x00d3,0x11b));var _0x300d=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x00d3[_0x397e5f];return _0x5302b8;};'use strict';var emlformat=require(_0x300d('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x300d('0x1'));var rp=require(_0x300d('0x2'));var moment=require(_0x300d('0x3'));var BPromise=require(_0x300d('0x4'));var Mustache=require(_0x300d('0x5'));var util=require('util');var path=require(_0x300d('0x6'));var sox=require('sox');var csv=require(_0x300d('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x300d('0x8'));var _=require(_0x300d('0x9'));var squel=require(_0x300d('0xa'));var crypto=require(_0x300d('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x300d('0xc'));var toCsv=require(_0x300d('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x300d('0xd'));var authService=require(_0x300d('0xe'));var qs=require(_0x300d('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x300d('0x10'));var logger=require(_0x300d('0x11'))(_0x300d('0x12'));var utils=require(_0x300d('0x13'));var config=require(_0x300d('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x300d('0x15'))['db'];function respondWithStatusCode(_0x302fc6,_0x195ce7){_0x195ce7=_0x195ce7||0xcc;return function(_0x4866b3){if(_0x4866b3){return _0x302fc6['sendStatus'](_0x195ce7);}return _0x302fc6[_0x300d('0x16')](_0x195ce7)['end']();};}function respondWithResult(_0x14c16b,_0x27978e){_0x27978e=_0x27978e||0xc8;return function(_0x5d7ef6){if(_0x5d7ef6){return _0x14c16b['status'](_0x27978e)[_0x300d('0x17')](_0x5d7ef6);}};}function respondWithFilteredResult(_0x5f2752,_0x45727){return function(_0x2a9d2a){if(_0x2a9d2a){var _0xd92711=typeof _0x45727['offset']===_0x300d('0x18')&&typeof _0x45727[_0x300d('0x19')]==='undefined';var _0x413000=_0x2a9d2a['count'];var _0x38eca4=_0xd92711?0x0:_0x45727[_0x300d('0x1a')];var _0x46118d=_0xd92711?_0x2a9d2a['count']:_0x45727['offset']+_0x45727['limit'];var _0x3cbfc7;if(_0x46118d>=_0x413000){_0x46118d=_0x413000;_0x3cbfc7=0xc8;}else{_0x3cbfc7=0xce;}_0x5f2752[_0x300d('0x16')](_0x3cbfc7);return _0x5f2752[_0x300d('0x1b')]('Content-Range',_0x38eca4+'-'+_0x46118d+'/'+_0x413000)[_0x300d('0x17')](_0x2a9d2a);}return null;};}function patchUpdates(_0x320c2c){return function(_0x21c194){try{jsonpatch['apply'](_0x21c194,_0x320c2c,!![]);}catch(_0x2d44bc){return BPromise['reject'](_0x2d44bc);}return _0x21c194['save']();};}function saveUpdates(_0x10a898,_0x3c09f8){return function(_0x5a5409){if(_0x5a5409){return _0x5a5409[_0x300d('0x1c')](_0x10a898)[_0x300d('0x1d')](function(_0x2ce6e6){return _0x2ce6e6;});}return null;};}function removeEntity(_0x31ac43,_0x159ee3){return function(_0x206a2b){if(_0x206a2b){return _0x206a2b['destroy']()[_0x300d('0x1d')](function(){_0x31ac43[_0x300d('0x16')](0xcc)[_0x300d('0x1e')]();});}};}function handleEntityNotFound(_0x5db2c0,_0x19430f){return function(_0x10ed9b){if(!_0x10ed9b){_0x5db2c0[_0x300d('0x1f')](0x194);}return _0x10ed9b;};}function handleError(_0x2e0550,_0x30b4db){_0x30b4db=_0x30b4db||0x1f4;return function(_0x3154fe){logger[_0x300d('0x20')](_0x3154fe[_0x300d('0x21')]);if(_0x3154fe[_0x300d('0x22')]){delete _0x3154fe[_0x300d('0x22')];}_0x2e0550[_0x300d('0x16')](_0x30b4db)[_0x300d('0x23')](_0x3154fe);};}exports[_0x300d('0x24')]=function(_0x2bbc56,_0xfad49f){var _0x52444c={},_0xaa63ac={},_0x35fe18={'count':0x0,'rows':[]};var _0x2ed0ef=_[_0x300d('0x25')](db[_0x300d('0x26')][_0x300d('0x27')],function(_0x4d4fe6){return{'name':_0x4d4fe6[_0x300d('0x28')],'type':_0x4d4fe6['type']['key']};});_0xaa63ac['model']=_[_0x300d('0x25')](_0x2ed0ef,_0x300d('0x22'));_0xaa63ac['query']=_[_0x300d('0x29')](_0x2bbc56[_0x300d('0x2a')]);_0xaa63ac[_0x300d('0x2b')]=_[_0x300d('0x2c')](_0xaa63ac[_0x300d('0x2d')],_0xaa63ac[_0x300d('0x2a')]);_0x52444c[_0x300d('0x2e')]=_[_0x300d('0x2c')](_0xaa63ac[_0x300d('0x2d')],qs[_0x300d('0x2f')](_0x2bbc56[_0x300d('0x2a')][_0x300d('0x2f')]));_0x52444c['attributes']=_0x52444c[_0x300d('0x2e')][_0x300d('0x30')]?_0x52444c[_0x300d('0x2e')]:_0xaa63ac['model'];if(!_0x2bbc56['query']['hasOwnProperty'](_0x300d('0x31'))){_0x52444c[_0x300d('0x19')]=qs['limit'](_0x2bbc56['query'][_0x300d('0x19')]);_0x52444c[_0x300d('0x1a')]=qs[_0x300d('0x1a')](_0x2bbc56['query'][_0x300d('0x1a')]);}_0x52444c[_0x300d('0x32')]=qs[_0x300d('0x33')](_0x2bbc56[_0x300d('0x2a')]['sort']);_0x52444c[_0x300d('0x34')]=qs[_0x300d('0x2b')](_[_0x300d('0x35')](_0x2bbc56[_0x300d('0x2a')],_0xaa63ac['filters']),_0x2ed0ef);if(_0x2bbc56['query'][_0x300d('0x36')]){_0x52444c[_0x300d('0x34')]=_[_0x300d('0x37')](_0x52444c['where'],{'$or':_['map'](_0x2ed0ef,function(_0x5e58cd){if(_0x5e58cd[_0x300d('0x38')]!==_0x300d('0x39')){var _0x5106ba={};_0x5106ba[_0x5e58cd[_0x300d('0x22')]]={'$like':'%'+_0x2bbc56[_0x300d('0x2a')][_0x300d('0x36')]+'%'};return _0x5106ba;}})});}_0x52444c=_[_0x300d('0x37')]({},_0x52444c,_0x2bbc56[_0x300d('0x3a')]);var _0x43fb54={'where':_0x52444c['where']};return db['VoiceDialReport'][_0x300d('0x3b')](_0x43fb54)['then'](function(_0x52ef33){_0x35fe18[_0x300d('0x3b')]=_0x52ef33;if(_0x2bbc56['query'][_0x300d('0x3c')]){_0x52444c[_0x300d('0x3d')]=[{'all':!![]}];}return db[_0x300d('0x26')][_0x300d('0x3e')](_0x52444c);})[_0x300d('0x1d')](function(_0x1ef9fc){_0x35fe18['rows']=_0x1ef9fc;return _0x35fe18;})[_0x300d('0x1d')](respondWithFilteredResult(_0xfad49f,_0x52444c))[_0x300d('0x3f')](handleError(_0xfad49f,null));};exports[_0x300d('0x40')]=function(_0x434d37,_0x554b72){var _0x5b5d0f={'raw':!![],'where':{'id':_0x434d37[_0x300d('0x41')]['id']}},_0x115fe9={};_0x115fe9[_0x300d('0x2d')]=_[_0x300d('0x29')](db[_0x300d('0x26')][_0x300d('0x27')]);_0x115fe9[_0x300d('0x2a')]=_[_0x300d('0x29')](_0x434d37['query']);_0x115fe9[_0x300d('0x2b')]=_[_0x300d('0x2c')](_0x115fe9[_0x300d('0x2d')],_0x115fe9['query']);_0x5b5d0f[_0x300d('0x2e')]=_[_0x300d('0x2c')](_0x115fe9[_0x300d('0x2d')],qs['fields'](_0x434d37[_0x300d('0x2a')][_0x300d('0x2f')]));_0x5b5d0f[_0x300d('0x2e')]=_0x5b5d0f[_0x300d('0x2e')][_0x300d('0x30')]?_0x5b5d0f['attributes']:_0x115fe9[_0x300d('0x2d')];if(_0x434d37[_0x300d('0x2a')]['includeAll']){_0x5b5d0f[_0x300d('0x3d')]=[{'all':!![]}];}_0x5b5d0f=_['merge']({},_0x5b5d0f,_0x434d37[_0x300d('0x3a')]);return db[_0x300d('0x26')][_0x300d('0x42')](_0x5b5d0f)[_0x300d('0x1d')](handleEntityNotFound(_0x554b72,null))[_0x300d('0x1d')](respondWithResult(_0x554b72,null))[_0x300d('0x3f')](handleError(_0x554b72,null));};exports[_0x300d('0x43')]=function(_0x12b200,_0x5c0cc5){return db[_0x300d('0x26')][_0x300d('0x43')](_0x12b200[_0x300d('0x44')],{})['then'](respondWithResult(_0x5c0cc5,0xc9))[_0x300d('0x3f')](handleError(_0x5c0cc5,null));};exports[_0x300d('0x1c')]=function(_0x22ab19,_0x3e6b37){if(_0x22ab19[_0x300d('0x44')]['id']){delete _0x22ab19[_0x300d('0x44')]['id'];}return db[_0x300d('0x26')][_0x300d('0x42')]({'where':{'id':_0x22ab19[_0x300d('0x41')]['id']}})[_0x300d('0x1d')](handleEntityNotFound(_0x3e6b37,null))[_0x300d('0x1d')](saveUpdates(_0x22ab19['body'],null))['then'](respondWithResult(_0x3e6b37,null))[_0x300d('0x3f')](handleError(_0x3e6b37,null));};exports[_0x300d('0x45')]=function(_0x5ed0b9,_0x348d33){return db[_0x300d('0x26')]['find']({'where':{'id':_0x5ed0b9[_0x300d('0x41')]['id']}})['then'](handleEntityNotFound(_0x348d33,null))[_0x300d('0x1d')](removeEntity(_0x348d33,null))[_0x300d('0x3f')](handleError(_0x348d33,null));};exports[_0x300d('0x46')]=function(_0x3fe32d,_0x243eb7){return db['VoiceDialReport']['describe']()[_0x300d('0x1d')](respondWithResult(_0x243eb7,null))[_0x300d('0x3f')](handleError(_0x243eb7,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index dfce5b4..6e86812 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 _0x19b3=['path','rimraf','../../config/environment','./voiceDialReport.attributes','exports','define','VoiceDialReport','uniqueid','util','../../config/logger','moment'];(function(_0x24061a,_0x1c9f4d){var _0x82054e=function(_0x2ec346){while(--_0x2ec346){_0x24061a['push'](_0x24061a['shift']());}};_0x82054e(++_0x1c9f4d);}(_0x19b3,0x194));var _0x319b=function(_0x19aa84,_0x549537){_0x19aa84=_0x19aa84-0x0;var _0x536146=_0x19b3[_0x19aa84];return _0x536146;};'use strict';var _=require('lodash');var util=require(_0x319b('0x0'));var logger=require(_0x319b('0x1'))('api');var moment=require(_0x319b('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x319b('0x3'));var rimraf=require(_0x319b('0x4'));var config=require(_0x319b('0x5'));var attributes=require(_0x319b('0x6'));module[_0x319b('0x7')]=function(_0x23d053,_0x1afe5d){return _0x23d053[_0x319b('0x8')](_0x319b('0x9'),attributes,{'tableName':'report_dial','paranoid':![],'indexes':[{'fields':[_0x319b('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x33a7=['define','VoiceDialReport','uniqueid','util','../../config/logger','api','moment','bluebird','../../config/environment','./voiceDialReport.attributes'];(function(_0x5f429d,_0x71a169){var _0x2563f6=function(_0x71e4b1){while(--_0x71e4b1){_0x5f429d['push'](_0x5f429d['shift']());}};_0x2563f6(++_0x71a169);}(_0x33a7,0xfd));var _0x733a=function(_0x4a4a43,_0x115ccf){_0x4a4a43=_0x4a4a43-0x0;var _0x5893a6=_0x33a7[_0x4a4a43];return _0x5893a6;};'use strict';var _=require('lodash');var util=require(_0x733a('0x0'));var logger=require(_0x733a('0x1'))(_0x733a('0x2'));var moment=require(_0x733a('0x3'));var BPromise=require(_0x733a('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x733a('0x5'));var attributes=require(_0x733a('0x6'));module['exports']=function(_0x15ea97,_0x47af2f){return _0x15ea97[_0x733a('0x7')](_0x733a('0x8'),attributes,{'tableName':'report_dial','paranoid':![],'indexes':[{'fields':[_0x733a('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.rpc.js b/server/api/voiceDialReport/voiceDialReport.rpc.js index ae49003..198f737 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 _0xe448=['lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','debug','request\x20sent','error','code','VoiceDialReport,\x20%s,\x20%s','message','info','result','CreateVoiceDialReport','VoiceDialReport','create','body','options','stringify','catch','raw','where','attributes','limit','UpdateVoiceDialReport'];(function(_0x24da10,_0x2dbd25){var _0x11ae58=function(_0x5d9782){while(--_0x5d9782){_0x24da10['push'](_0x24da10['shift']());}};_0x11ae58(++_0x2dbd25);}(_0xe448,0x1dc));var _0x8e44=function(_0x49fef1,_0x2cee9f){_0x49fef1=_0x49fef1-0x0;var _0x407e54=_0xe448[_0x49fef1];return _0x407e54;};'use strict';var _=require(_0x8e44('0x0'));var util=require(_0x8e44('0x1'));var moment=require(_0x8e44('0x2'));var BPromise=require(_0x8e44('0x3'));var rs=require(_0x8e44('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x8e44('0x5'));var logger=require(_0x8e44('0x6'))(_0x8e44('0x7'));var config=require(_0x8e44('0x8'));var jayson=require(_0x8e44('0x9'));var client=jayson[_0x8e44('0xa')][_0x8e44('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x13a054,_0x20853d,_0x26f3e2){return new BPromise(function(_0x331f1b,_0x47eb2e){return client[_0x8e44('0xc')](_0x13a054,_0x26f3e2)[_0x8e44('0xd')](function(_0x2bab9d){logger['info']('VoiceDialReport,\x20%s,\x20%s',_0x20853d,'request\x20sent');logger[_0x8e44('0xe')]('VoiceDialReport,\x20%s,\x20%s,\x20%s',_0x20853d,_0x8e44('0xf'),JSON['stringify'](_0x2bab9d));if(_0x2bab9d[_0x8e44('0x10')]){if(_0x2bab9d[_0x8e44('0x10')][_0x8e44('0x11')]===0x1f4){logger['error'](_0x8e44('0x12'),_0x20853d,_0x2bab9d[_0x8e44('0x10')]['message']);return _0x47eb2e(_0x2bab9d[_0x8e44('0x10')]['message']);}logger['error'](_0x8e44('0x12'),_0x20853d,_0x2bab9d[_0x8e44('0x10')][_0x8e44('0x13')]);return _0x331f1b(_0x2bab9d[_0x8e44('0x10')][_0x8e44('0x13')]);}else{logger[_0x8e44('0x14')]('VoiceDialReport,\x20%s,\x20%s',_0x20853d,_0x8e44('0xf'));_0x331f1b(_0x2bab9d[_0x8e44('0x15')][_0x8e44('0x13')]);}})['catch'](function(_0x437ae4){logger[_0x8e44('0x10')]('VoiceDialReport,\x20%s,\x20%s',_0x20853d,_0x437ae4);_0x47eb2e(_0x437ae4);});});}exports[_0x8e44('0x16')]=function(_0x26ec76){var _0x414c56=this;return new Promise(function(_0x4ca3ca,_0x34a13e){return db[_0x8e44('0x17')][_0x8e44('0x18')](_0x26ec76[_0x8e44('0x19')],{'raw':_0x26ec76['options']?_0x26ec76[_0x8e44('0x1a')]['raw']===undefined?!![]:![]:!![]})[_0x8e44('0xd')](function(_0x42891e){logger['info']('CreateVoiceDialReport',_0x26ec76);logger[_0x8e44('0xe')](_0x8e44('0x16'),_0x26ec76,JSON[_0x8e44('0x1b')](_0x42891e));_0x4ca3ca(_0x42891e);})[_0x8e44('0x1c')](function(_0x45037a){logger['error'](_0x8e44('0x16'),_0x45037a[_0x8e44('0x13')],_0x26ec76);_0x34a13e(_0x414c56[_0x8e44('0x10')](0x1f4,_0x45037a[_0x8e44('0x13')]));});});};exports['UpdateVoiceDialReport']=function(_0xfdc09f){var _0x1d6598=this;return new Promise(function(_0x12e189,_0x55e3dc){return db[_0x8e44('0x17')]['update'](_0xfdc09f[_0x8e44('0x19')],{'raw':_0xfdc09f[_0x8e44('0x1a')]?_0xfdc09f['options'][_0x8e44('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xfdc09f['options']?_0xfdc09f[_0x8e44('0x1a')][_0x8e44('0x1e')]||null:null,'attributes':_0xfdc09f['options']?_0xfdc09f[_0x8e44('0x1a')][_0x8e44('0x1f')]||null:null,'limit':_0xfdc09f['options']?_0xfdc09f[_0x8e44('0x1a')][_0x8e44('0x20')]||null:null})[_0x8e44('0xd')](function(_0x45663a){logger[_0x8e44('0x14')](_0x8e44('0x21'),_0xfdc09f);logger[_0x8e44('0xe')](_0x8e44('0x21'),_0xfdc09f,JSON['stringify'](_0x45663a));_0x12e189(_0x45663a);})[_0x8e44('0x1c')](function(_0x3d17ae){logger[_0x8e44('0x10')]('UpdateVoiceDialReport',_0x3d17ae['message'],_0xfdc09f);_0x55e3dc(_0x1d6598[_0x8e44('0x10')](0x1f4,_0x3d17ae[_0x8e44('0x13')]));});});}; \ No newline at end of file +var _0x00c7=['then','UpdateVoiceDialReport','util','moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','info','VoiceDialReport,\x20%s,\x20%s','request\x20sent','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreateVoiceDialReport','VoiceDialReport','create','body','options','raw','catch','update','where'];(function(_0x1c02f5,_0x2cda5c){var _0x186eb2=function(_0x44cd8c){while(--_0x44cd8c){_0x1c02f5['push'](_0x1c02f5['shift']());}};_0x186eb2(++_0x2cda5c);}(_0x00c7,0x1b4));var _0x700c=function(_0x3f3bad,_0x193f06){_0x3f3bad=_0x3f3bad-0x0;var _0x4f0801=_0x00c7[_0x3f3bad];return _0x4f0801;};'use strict';var _=require('lodash');var util=require(_0x700c('0x0'));var moment=require(_0x700c('0x1'));var BPromise=require('bluebird');var rs=require(_0x700c('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x700c('0x3'))['db'];var utils=require(_0x700c('0x4'));var logger=require('../../config/logger')(_0x700c('0x5'));var config=require(_0x700c('0x6'));var jayson=require(_0x700c('0x7'));var client=jayson['client'][_0x700c('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x25ecde,_0x41c307,_0x54ff40){return new BPromise(function(_0x15cf60,_0x23557b){return client[_0x700c('0x9')](_0x25ecde,_0x54ff40)['then'](function(_0x257da0){logger[_0x700c('0xa')](_0x700c('0xb'),_0x41c307,_0x700c('0xc'));logger[_0x700c('0xd')](_0x700c('0xe'),_0x41c307,_0x700c('0xc'),JSON[_0x700c('0xf')](_0x257da0));if(_0x257da0[_0x700c('0x10')]){if(_0x257da0[_0x700c('0x10')][_0x700c('0x11')]===0x1f4){logger[_0x700c('0x10')]('VoiceDialReport,\x20%s,\x20%s',_0x41c307,_0x257da0[_0x700c('0x10')]['message']);return _0x23557b(_0x257da0[_0x700c('0x10')]['message']);}logger['error'](_0x700c('0xb'),_0x41c307,_0x257da0[_0x700c('0x10')][_0x700c('0x12')]);return _0x15cf60(_0x257da0['error'][_0x700c('0x12')]);}else{logger[_0x700c('0xa')](_0x700c('0xb'),_0x41c307,_0x700c('0xc'));_0x15cf60(_0x257da0[_0x700c('0x13')][_0x700c('0x12')]);}})['catch'](function(_0x4a5bb4){logger[_0x700c('0x10')]('VoiceDialReport,\x20%s,\x20%s',_0x41c307,_0x4a5bb4);_0x23557b(_0x4a5bb4);});});}exports[_0x700c('0x14')]=function(_0x1c2af5){var _0x5f2dec=this;return new Promise(function(_0x151a20,_0x5ecc04){return db[_0x700c('0x15')][_0x700c('0x16')](_0x1c2af5[_0x700c('0x17')],{'raw':_0x1c2af5[_0x700c('0x18')]?_0x1c2af5[_0x700c('0x18')][_0x700c('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x2e2a0f){logger['info'](_0x700c('0x14'),_0x1c2af5);logger[_0x700c('0xd')](_0x700c('0x14'),_0x1c2af5,JSON['stringify'](_0x2e2a0f));_0x151a20(_0x2e2a0f);})[_0x700c('0x1a')](function(_0x21bdb4){logger[_0x700c('0x10')](_0x700c('0x14'),_0x21bdb4[_0x700c('0x12')],_0x1c2af5);_0x5ecc04(_0x5f2dec[_0x700c('0x10')](0x1f4,_0x21bdb4[_0x700c('0x12')]));});});};exports['UpdateVoiceDialReport']=function(_0x2b5cad){var _0xb79a7c=this;return new Promise(function(_0x37baaf,_0x21e01c){return db[_0x700c('0x15')][_0x700c('0x1b')](_0x2b5cad['body'],{'raw':_0x2b5cad['options']?_0x2b5cad[_0x700c('0x18')][_0x700c('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2b5cad[_0x700c('0x18')]?_0x2b5cad['options'][_0x700c('0x1c')]||null:null,'attributes':_0x2b5cad[_0x700c('0x18')]?_0x2b5cad[_0x700c('0x18')]['attributes']||null:null,'limit':_0x2b5cad[_0x700c('0x18')]?_0x2b5cad[_0x700c('0x18')]['limit']||null:null})[_0x700c('0x1d')](function(_0x3a454c){logger[_0x700c('0xa')](_0x700c('0x1e'),_0x2b5cad);logger[_0x700c('0xd')](_0x700c('0x1e'),_0x2b5cad,JSON[_0x700c('0xf')](_0x3a454c));_0x37baaf(_0x3a454c);})[_0x700c('0x1a')](function(_0x450984){logger[_0x700c('0x10')](_0x700c('0x1e'),_0x450984[_0x700c('0x12')],_0x2b5cad);_0x21e01c(_0xb79a7c[_0x700c('0x10')](0x1f4,_0x450984[_0x700c('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index 2b16397..64cf128 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 _0x50ce=['destroy','exports','multer','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','index','get','/:id','isAuthenticated','show','post','/:id/applications','put','update'];(function(_0x55bf96,_0x7267a7){var _0x5092ef=function(_0x3ed3f1){while(--_0x3ed3f1){_0x55bf96['push'](_0x55bf96['shift']());}};_0x5092ef(++_0x7267a7);}(_0x50ce,0x9b));var _0xe50c=function(_0x5e6515,_0x2954b1){_0x5e6515=_0x5e6515-0x0;var _0xd33ce2=_0x50ce[_0x5e6515];return _0xd33ce2;};'use strict';var multer=require(_0xe50c('0x0'));var util=require('util');var path=require(_0xe50c('0x1'));var timeout=require(_0xe50c('0x2'));var express=require('express');var router=express[_0xe50c('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xe50c('0x4'));var config=require(_0xe50c('0x5'));var controller=require('./voiceExtension.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xe50c('0x6')]);router[_0xe50c('0x7')](_0xe50c('0x8'),auth[_0xe50c('0x9')](),controller[_0xe50c('0xa')]);router[_0xe50c('0xb')]('/',auth[_0xe50c('0x9')](),controller['create']);router[_0xe50c('0xb')](_0xe50c('0xc'),auth['isAuthenticated'](),controller['addApplications']);router[_0xe50c('0xd')](_0xe50c('0x8'),auth['isAuthenticated'](),controller[_0xe50c('0xe')]);router['delete'](_0xe50c('0x8'),auth['isAuthenticated'](),controller[_0xe50c('0xf')]);module[_0xe50c('0x10')]=router; \ No newline at end of file +var _0x4639=['/:id','update','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','isAuthenticated','index','get','show','post','create','/:id/applications','addApplications','put'];(function(_0xb9a64f,_0x4e5ce3){var _0x34a9f5=function(_0x2575d4){while(--_0x2575d4){_0xb9a64f['push'](_0xb9a64f['shift']());}};_0x34a9f5(++_0x4e5ce3);}(_0x4639,0x9b));var _0x9463=function(_0x45493c,_0x39478b){_0x45493c=_0x45493c-0x0;var _0xe89240=_0x4639[_0x45493c];return _0xe89240;};'use strict';var multer=require(_0x9463('0x0'));var util=require(_0x9463('0x1'));var path=require(_0x9463('0x2'));var timeout=require(_0x9463('0x3'));var express=require('express');var router=express[_0x9463('0x4')]();var fs_extra=require(_0x9463('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x9463('0x6'));var config=require('../../config/environment');var controller=require('./voiceExtension.controller');router['get']('/',auth[_0x9463('0x7')](),controller[_0x9463('0x8')]);router[_0x9463('0x9')]('/:id',auth[_0x9463('0x7')](),controller[_0x9463('0xa')]);router[_0x9463('0xb')]('/',auth[_0x9463('0x7')](),controller[_0x9463('0xc')]);router[_0x9463('0xb')](_0x9463('0xd'),auth[_0x9463('0x7')](),controller[_0x9463('0xe')]);router[_0x9463('0xf')](_0x9463('0x10'),auth[_0x9463('0x7')](),controller[_0x9463('0x11')]);router['delete']('/:id',auth[_0x9463('0x7')](),controller['destroy']);module[_0x9463('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.attributes.js b/server/api/voiceExtension/voiceExtension.attributes.js index e9e6e24..9c6f0ec 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 _0xe38e=['*,*,*,*','INTEGER','BOOLEAN','VIRTUAL','sequelize','exports','compositeIndex','STRING','ENUM','inbound','outbound','internal','outbound-fax','system','any'];(function(_0x1694f5,_0x49b7c3){var _0x5b4321=function(_0x58c183){while(--_0x58c183){_0x1694f5['push'](_0x1694f5['shift']());}};_0x5b4321(++_0x49b7c3);}(_0xe38e,0x15d));var _0xee38=function(_0xf9836c,_0x2aeb62){_0xf9836c=_0xf9836c-0x0;var _0x3b679b=_0xe38e[_0xf9836c];return _0x3b679b;};'use strict';var Sequelize=require(_0xee38('0x0'));module[_0xee38('0x1')]={'context':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xee38('0x2'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0xee38('0x3')],'allowNull':![],'unique':_0xee38('0x2')},'priority':{'type':Sequelize[_0xee38('0x3')],'allowNull':![],'defaultValue':'1','unique':'compositeIndex'},'tag':{'type':Sequelize[_0xee38('0x3')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'NoOp'},'appdata':{'type':Sequelize[_0xee38('0x3')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0xee38('0x4')](_0xee38('0x5'),_0xee38('0x6'),_0xee38('0x7'),'inbound-fax',_0xee38('0x8'),_0xee38('0x9'),_0xee38('0xa')),'allowNull':![]},'description':{'type':Sequelize[_0xee38('0x3')]},'interval':{'type':Sequelize[_0xee38('0x3')],'allowNull':![],'defaultValue':_0xee38('0xb')},'IntervalId':{'type':Sequelize[_0xee38('0xc')]},'isApp':{'type':Sequelize[_0xee38('0xd')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0xee38('0x3')],'defaultValue':null},'callerID':{'type':Sequelize[_0xee38('0x3')],'allowNull':!![]},'record':{'type':Sequelize[_0xee38('0xd')],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0xee38('0xc')]},'recordingFormat':{'type':Sequelize['STRING'],'defaultValue':'wav'},'answer':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'name':{'type':Sequelize[_0xee38('0xe')],'get':function(_0x4ca5e3){return this['getDataValue']('exten');}},'alias':{'type':Sequelize[_0xee38('0x3')],'allowNull':!![]}}; \ No newline at end of file +var _0xe363=['STRING','compositeIndex','ENUM','outbound','inbound-fax','outbound-fax','system','any','*,*,*,*','INTEGER','BOOLEAN','wav','VIRTUAL','getDataValue','exten','sequelize','exports'];(function(_0x1b5ee6,_0xc4c347){var _0x533919=function(_0x5934bb){while(--_0x5934bb){_0x1b5ee6['push'](_0x1b5ee6['shift']());}};_0x533919(++_0xc4c347);}(_0xe363,0x10e));var _0x3e36=function(_0x149c69,_0xa04536){_0x149c69=_0x149c69-0x0;var _0x10289c=_0xe363[_0x149c69];return _0x10289c;};'use strict';var Sequelize=require(_0x3e36('0x0'));module[_0x3e36('0x1')]={'context':{'type':Sequelize[_0x3e36('0x2')],'allowNull':![],'unique':_0x3e36('0x3'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0x3e36('0x2')],'allowNull':![],'unique':_0x3e36('0x3')},'priority':{'type':Sequelize[_0x3e36('0x2')],'allowNull':![],'defaultValue':'1','unique':_0x3e36('0x3')},'tag':{'type':Sequelize[_0x3e36('0x2')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x3e36('0x2')],'allowNull':![],'defaultValue':'NoOp'},'appdata':{'type':Sequelize[_0x3e36('0x2')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0x3e36('0x4')]('inbound',_0x3e36('0x5'),'internal',_0x3e36('0x6'),_0x3e36('0x7'),_0x3e36('0x8'),_0x3e36('0x9')),'allowNull':![]},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x3e36('0x2')],'allowNull':![],'defaultValue':_0x3e36('0xa')},'IntervalId':{'type':Sequelize[_0x3e36('0xb')]},'isApp':{'type':Sequelize[_0x3e36('0xc')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0x3e36('0x2')],'defaultValue':null},'callerID':{'type':Sequelize[_0x3e36('0x2')],'allowNull':!![]},'record':{'type':Sequelize[_0x3e36('0xc')],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0x3e36('0xb')]},'recordingFormat':{'type':Sequelize[_0x3e36('0x2')],'defaultValue':_0x3e36('0xd')},'answer':{'type':Sequelize[_0x3e36('0xc')],'defaultValue':!![]},'name':{'type':Sequelize[_0x3e36('0xe')],'get':function(_0x3cfac9){return this[_0x3e36('0xf')](_0x3e36('0x10'));}},'alias':{'type':Sequelize[_0x3e36('0x2')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.controller.js b/server/api/voiceExtension/voiceExtension.controller.js index 595dfd5..61d2b3c 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 _0xc232=['startsWith','exten','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','InboundRoutes','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','pick','context','description','recordingFormat','cutdigits','mandatoryDisposition','alias','sequelize','Transaction','READ_COMMITTED','findOne','VoiceExtensionId','isApp','createRouting','bulkCreate','findAndCountAll','finally','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','status','end','json','undefined','count','offset','limit','Content-Range','destroy','then','get','inbound','OutboundRoutes','outbound','InternalRoutes','internal','filter','ignore','map','value','type','find','name','sendStatus','send','VoiceExtension','fieldName','key','query','keys','filters','intersection','model','attributes','length','nolimit','order','sort','where','merge','VIRTUAL','options','include','rows','catch','show','params','fields','includeAll','create','body'];(function(_0x58fad2,_0xb39887){var _0x49f947=function(_0x1b22c2){while(--_0x1b22c2){_0x58fad2['push'](_0x58fad2['shift']());}};_0x49f947(++_0xb39887);}(_0xc232,0x76));var _0x2c23=function(_0x35d445,_0x288824){_0x35d445=_0x35d445-0x0;var _0x15c27e=_0xc232[_0x35d445];return _0x15c27e;};'use strict';var _=require(_0x2c23('0x0'));var Redis=require(_0x2c23('0x1'));var qs=require(_0x2c23('0x2'));var logger=require(_0x2c23('0x3'))(_0x2c23('0x4'));var config=require('../../config/environment');var db=require(_0x2c23('0x5'))['db'];config[_0x2c23('0x6')]=_[_0x2c23('0x7')](config[_0x2c23('0x6')],{'host':_0x2c23('0x8'),'port':0x18eb});var socket=require(_0x2c23('0x9'))(new Redis(config[_0x2c23('0x6')]));require(_0x2c23('0xa'))['register'](socket);function respondWithStatusCode(_0x22f10e,_0x4f7155){_0x4f7155=_0x4f7155||0xcc;return function(_0x260334){if(_0x260334){return _0x22f10e['sendStatus'](_0x4f7155);}return _0x22f10e[_0x2c23('0xb')](_0x4f7155)[_0x2c23('0xc')]();};}function respondWithResult(_0x16183d,_0x23d507){_0x23d507=_0x23d507||0xc8;return function(_0x5052f9){if(_0x5052f9){return _0x16183d[_0x2c23('0xb')](_0x23d507)[_0x2c23('0xd')](_0x5052f9);}};}function respondWithFilteredResult(_0x3b9a3c,_0xbb357){return function(_0x4d01d7){if(_0x4d01d7){var _0x5b5b85=typeof _0xbb357['offset']===_0x2c23('0xe')&&typeof _0xbb357['limit']==='undefined';var _0x277c9d=_0x4d01d7[_0x2c23('0xf')];var _0x583a84=_0x5b5b85?0x0:_0xbb357[_0x2c23('0x10')];var _0x19f9e0=_0x5b5b85?_0x4d01d7[_0x2c23('0xf')]:_0xbb357[_0x2c23('0x10')]+_0xbb357[_0x2c23('0x11')];var _0x2fbfb4;if(_0x19f9e0>=_0x277c9d){_0x19f9e0=_0x277c9d;_0x2fbfb4=0xc8;}else{_0x2fbfb4=0xce;}_0x3b9a3c['status'](_0x2fbfb4);return _0x3b9a3c['set'](_0x2c23('0x12'),_0x583a84+'-'+_0x19f9e0+'/'+_0x277c9d)[_0x2c23('0xd')](_0x4d01d7);}return null;};}function removeEntity(_0x4c78f2){return function(_0x20acc9){if(_0x20acc9){return _0x20acc9[_0x2c23('0x13')]()[_0x2c23('0x14')](function(){var _0x43036a=_0x20acc9[_0x2c23('0x15')]({'plain':!![]});var _0x34761e=[{'name':'InboundRoutes','value':_0x2c23('0x16'),'ignore':![]},{'name':_0x2c23('0x17'),'value':_0x2c23('0x18'),'ignore':![]},{'name':_0x2c23('0x19'),'value':_0x2c23('0x1a'),'ignore':![]}];var _0x124664=_(_0x34761e)[_0x2c23('0x1b')](_0x2c23('0x1c'))[_0x2c23('0x1d')](_0x2c23('0x1e'))[_0x2c23('0x1e')]();if(_['includes'](_0x124664,_0x43036a[_0x2c23('0x1f')])){return;}var _0x12e96b=_[_0x2c23('0x20')](_0x34761e,[_0x2c23('0x1e'),_0x43036a[_0x2c23('0x1f')]])[_0x2c23('0x21')];return db['UserProfileResource']['destroy']({'where':{'type':_0x12e96b,'resourceId':_0x43036a['id']}})[_0x2c23('0x14')](function(){return _0x20acc9;});})[_0x2c23('0x14')](function(){_0x4c78f2[_0x2c23('0xb')](0xcc)['end']();});}};}function handleEntityNotFound(_0x228680){return function(_0x582625){if(!_0x582625){_0x228680[_0x2c23('0x22')](0x194);}return _0x582625;};}function handleError(_0x111498,_0x676b3a){_0x676b3a=_0x676b3a||0x1f4;return function(_0x3fb2c4){logger['error'](_0x3fb2c4['stack']);if(_0x3fb2c4[_0x2c23('0x21')]){delete _0x3fb2c4[_0x2c23('0x21')];}_0x111498[_0x2c23('0xb')](_0x676b3a)[_0x2c23('0x23')](_0x3fb2c4);};}exports['index']=function(_0x1090df,_0x53e4d3){var _0x4385d1={},_0x533a4b={},_0x5e320e={'count':0x0,'rows':[]};var _0x446f0a=_[_0x2c23('0x1d')](db[_0x2c23('0x24')]['rawAttributes'],function(_0x50b666){return{'name':_0x50b666[_0x2c23('0x25')],'type':_0x50b666[_0x2c23('0x1f')][_0x2c23('0x26')]};});_0x533a4b['model']=_[_0x2c23('0x1d')](_0x446f0a,_0x2c23('0x21'));_0x533a4b[_0x2c23('0x27')]=_[_0x2c23('0x28')](_0x1090df[_0x2c23('0x27')]);_0x533a4b[_0x2c23('0x29')]=_[_0x2c23('0x2a')](_0x533a4b[_0x2c23('0x2b')],_0x533a4b[_0x2c23('0x27')]);_0x4385d1[_0x2c23('0x2c')]=_[_0x2c23('0x2a')](_0x533a4b[_0x2c23('0x2b')],qs['fields'](_0x1090df[_0x2c23('0x27')]['fields']));_0x4385d1[_0x2c23('0x2c')]=_0x4385d1[_0x2c23('0x2c')][_0x2c23('0x2d')]?_0x4385d1[_0x2c23('0x2c')]:_0x533a4b['model'];if(!_0x1090df['query']['hasOwnProperty'](_0x2c23('0x2e'))){_0x4385d1[_0x2c23('0x11')]=qs[_0x2c23('0x11')](_0x1090df['query'][_0x2c23('0x11')]);_0x4385d1[_0x2c23('0x10')]=qs[_0x2c23('0x10')](_0x1090df[_0x2c23('0x27')][_0x2c23('0x10')]);}_0x4385d1[_0x2c23('0x2f')]=qs[_0x2c23('0x30')](_0x1090df['query'][_0x2c23('0x30')]);_0x4385d1[_0x2c23('0x31')]=qs[_0x2c23('0x29')](_['pick'](_0x1090df[_0x2c23('0x27')],_0x533a4b['filters']),_0x446f0a);if(_0x1090df['query'][_0x2c23('0x1b')]){_0x4385d1[_0x2c23('0x31')]=_[_0x2c23('0x32')](_0x4385d1[_0x2c23('0x31')],{'$or':_[_0x2c23('0x1d')](_0x446f0a,function(_0x37deb0){if(_0x37deb0['type']!==_0x2c23('0x33')){var _0x1d390f={};_0x1d390f[_0x37deb0[_0x2c23('0x21')]]={'$like':'%'+_0x1090df['query'][_0x2c23('0x1b')]+'%'};return _0x1d390f;}})});}_0x4385d1=_['merge']({},_0x4385d1,_0x1090df[_0x2c23('0x34')]);var _0x42ec30={'where':_0x4385d1[_0x2c23('0x31')]};return db[_0x2c23('0x24')][_0x2c23('0xf')](_0x42ec30)[_0x2c23('0x14')](function(_0x245d48){_0x5e320e[_0x2c23('0xf')]=_0x245d48;if(_0x1090df[_0x2c23('0x27')]['includeAll']){_0x4385d1[_0x2c23('0x35')]=[{'all':!![]}];}return db['VoiceExtension']['findAll'](_0x4385d1);})[_0x2c23('0x14')](function(_0x1cc55d){_0x5e320e[_0x2c23('0x36')]=_0x1cc55d;return _0x5e320e;})[_0x2c23('0x14')](respondWithFilteredResult(_0x53e4d3,_0x4385d1))[_0x2c23('0x37')](handleError(_0x53e4d3,null));};exports[_0x2c23('0x38')]=function(_0x5332a2,_0x3d54a4){var _0x5195b9={'raw':![],'where':{'id':_0x5332a2[_0x2c23('0x39')]['id']}},_0x277ef7={};_0x277ef7[_0x2c23('0x2b')]=_[_0x2c23('0x28')](db['VoiceExtension']['rawAttributes']);_0x277ef7['query']=_['keys'](_0x5332a2[_0x2c23('0x27')]);_0x277ef7['filters']=_['intersection'](_0x277ef7[_0x2c23('0x2b')],_0x277ef7[_0x2c23('0x27')]);_0x5195b9[_0x2c23('0x2c')]=_[_0x2c23('0x2a')](_0x277ef7[_0x2c23('0x2b')],qs[_0x2c23('0x3a')](_0x5332a2[_0x2c23('0x27')][_0x2c23('0x3a')]));_0x5195b9['attributes']=_0x5195b9[_0x2c23('0x2c')]['length']?_0x5195b9['attributes']:_0x277ef7[_0x2c23('0x2b')];if(_0x5332a2[_0x2c23('0x27')][_0x2c23('0x3b')]){_0x5195b9['include']=[{'all':!![]}];}_0x5195b9=_[_0x2c23('0x32')]({},_0x5195b9,_0x5332a2[_0x2c23('0x34')]);return db[_0x2c23('0x24')][_0x2c23('0x20')](_0x5195b9)[_0x2c23('0x14')](handleEntityNotFound(_0x3d54a4,null))['then'](respondWithResult(_0x3d54a4,null))['catch'](handleError(_0x3d54a4,null));};exports['destroy']=function(_0xfcc455,_0x51ddd6){return db['VoiceExtension'][_0x2c23('0x20')]({'where':{'id':_0xfcc455[_0x2c23('0x39')]['id']}})[_0x2c23('0x14')](handleEntityNotFound(_0x51ddd6,null))[_0x2c23('0x14')](removeEntity(_0x51ddd6,null))[_0x2c23('0x37')](handleError(_0x51ddd6,null));};exports[_0x2c23('0x3c')]=function(_0x1f3971,_0x1a1822){if(_0x1f3971[_0x2c23('0x3d')][_0x2c23('0x1f')]===_0x2c23('0x18')&&!_[_0x2c23('0x3e')](_0x1f3971['body'][_0x2c23('0x3f')],'_')){_0x1f3971[_0x2c23('0x3d')][_0x2c23('0x3f')]='_'['concat'](_0x1f3971['body'][_0x2c23('0x3f')]);}return db[_0x2c23('0x24')][_0x2c23('0x3c')](_0x1f3971['body'],{'raw':![]})[_0x2c23('0x14')](function(_0x2b2db0){var _0x25f7b3=_0x1f3971[_0x2c23('0x40')][_0x2c23('0x15')]({'plain':!![]});if(!_0x25f7b3)throw new Error(_0x2c23('0x41'));if(_0x25f7b3[_0x2c23('0x42')]===_0x2c23('0x40')){var _0x6c25ba=_0x2b2db0[_0x2c23('0x15')]({'plain':!![]});var _0x25d0d3=[{'name':_0x2c23('0x43'),'value':'inbound'},{'name':_0x2c23('0x17'),'value':_0x2c23('0x18')},{'name':_0x2c23('0x19'),'value':'internal'}];var _0x3458aa=_[_0x2c23('0x20')](_0x25d0d3,[_0x2c23('0x1e'),_0x6c25ba[_0x2c23('0x1f')]])[_0x2c23('0x21')];return db[_0x2c23('0x44')]['find']({'where':{'name':_0x3458aa,'userProfileId':_0x25f7b3['userProfileId']},'raw':!![]})[_0x2c23('0x14')](function(_0x4c3360){if(_0x4c3360&&_0x4c3360[_0x2c23('0x45')]===0x0){return db[_0x2c23('0x46')]['create']({'name':_0x6c25ba[_0x2c23('0x21')],'resourceId':_0x6c25ba['id'],'type':_0x4c3360[_0x2c23('0x21')],'sectionId':_0x4c3360['id']},{})['then'](function(){return _0x2b2db0;});}else{return _0x2b2db0;}})[_0x2c23('0x37')](function(_0x5181b9){logger['error'](_0x2c23('0x47'),_0x5181b9);throw _0x5181b9;});}return _0x2b2db0;})['then'](respondWithResult(_0x1a1822,0xc9))['catch'](handleError(_0x1a1822,null));};exports[_0x2c23('0x48')]=function(_0x1bbafa,_0x3bf3b3){if(_0x1bbafa['body']['id']){delete _0x1bbafa[_0x2c23('0x3d')]['id'];}return db[_0x2c23('0x24')][_0x2c23('0x20')]({'where':{'id':_0x1bbafa[_0x2c23('0x39')]['id']}})['then'](handleEntityNotFound(_0x3bf3b3,null))[_0x2c23('0x14')](function(_0x5602ac){if(_0x5602ac){return db[_0x2c23('0x24')][_0x2c23('0x48')](_[_0x2c23('0x49')](_0x1bbafa[_0x2c23('0x3d')],[_0x2c23('0x3f'),_0x2c23('0x4a'),_0x2c23('0x4b'),_0x2c23('0x4c'),_0x2c23('0x4d'),_0x2c23('0x4e'),_0x2c23('0x4f')]),{'where':{'context':_0x5602ac['context'],'exten':_0x5602ac[_0x2c23('0x3f')]},'individualHooks':!![]})['then'](function(_0x4a5c06){return _0x4a5c06;});}return null;})[_0x2c23('0x14')](respondWithStatusCode(_0x3bf3b3,null))['catch'](handleError(_0x3bf3b3,null));};exports['addApplications']=function(_0x5e851d,_0x4c7396){var _0x69cadd=_0x5e851d[_0x2c23('0x39')]['id'];var _0x26f759=_0x5e851d['body'];var _0x30a975=0xc8;var _0x384341=null;return db[_0x2c23('0x50')]['transaction']({'isolationLevel':db[_0x2c23('0x50')][_0x2c23('0x51')]['ISOLATION_LEVELS'][_0x2c23('0x52')]},function(_0x24873d){return db[_0x2c23('0x24')][_0x2c23('0x53')]({'where':{'id':_0x69cadd},'transaction':_0x24873d})['then'](function(_0xa5ffc0){if(_0xa5ffc0){return db['VoiceExtension'][_0x2c23('0x13')]({'where':{'VoiceExtensionId':_0x69cadd},'transaction':_0x24873d})['then'](function(){var _0x5c6a3a=_['map'](_0x26f759,function(_0x278ba3){_0x278ba3[_0x2c23('0x54')]=_0x69cadd;_0x278ba3[_0x2c23('0x55')]=!![];return _0x278ba3;});return _0xa5ffc0[_0x2c23('0x56')](_0x5c6a3a);})[_0x2c23('0x14')](function(_0x1ba863){return db[_0x2c23('0x24')][_0x2c23('0x57')](_0x1ba863,{'transaction':_0x24873d});});}else{_0x30a975=0x194;_0x384341=[];}});})[_0x2c23('0x14')](function(){if(_0x30a975!==0x194){return db[_0x2c23('0x24')][_0x2c23('0x58')]({'where':{'isApp':!![],'VoiceExtensionId':_0x69cadd},'order':'cast(priority\x20as\x20unsigned)'})[_0x2c23('0x14')](function(_0x448dbd){_0x384341=_0x448dbd;});}})['catch'](function(_0x19b998){_0x30a975=0x1f4;logger['error'](_0x19b998['stack']);if(_0x19b998['name']){delete _0x19b998[_0x2c23('0x21')];}_0x384341=_0x19b998;})[_0x2c23('0x59')](function(){if(_0x384341===null){_0x4c7396[_0x2c23('0x22')](_0x30a975);}else{if(_0x30a975===0x1f4){_0x4c7396[_0x2c23('0xb')](_0x30a975)[_0x2c23('0x23')](_0x384341);}else{_0x4c7396[_0x2c23('0xb')](_0x30a975)[_0x2c23('0xd')](_0x384341);}}});}; \ No newline at end of file +var _0x4660=['OutboundRoutes','outbound','InternalRoutes','internal','filter','ignore','map','value','includes','find','type','name','then','error','stack','send','index','VoiceExtension','rawAttributes','key','query','intersection','model','fields','attributes','length','order','sort','filters','pick','where','merge','includeAll','include','findAll','catch','show','params','keys','options','create','body','startsWith','exten','concat','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','cutdigits','mandatoryDisposition','context','addApplications','sequelize','ISOLATION_LEVELS','READ_COMMITTED','findOne','VoiceExtensionId','isApp','createRouting','bulkCreate','findAndCountAll','cast(priority\x20as\x20unsigned)','finally','lodash','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./voiceExtension.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','destroy','get','InboundRoutes','inbound'];(function(_0x599f41,_0x4db732){var _0x2e4d58=function(_0x14c882){while(--_0x14c882){_0x599f41['push'](_0x599f41['shift']());}};_0x2e4d58(++_0x4db732);}(_0x4660,0xf9));var _0x0466=function(_0x18fe4e,_0xf5e00f){_0x18fe4e=_0x18fe4e-0x0;var _0x463dfb=_0x4660[_0x18fe4e];return _0x463dfb;};'use strict';var _=require(_0x0466('0x0'));var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var logger=require(_0x0466('0x1'))(_0x0466('0x2'));var config=require(_0x0466('0x3'));var db=require(_0x0466('0x4'))['db'];config[_0x0466('0x5')]=_[_0x0466('0x6')](config[_0x0466('0x5')],{'host':'localhost','port':0x18eb});var socket=require(_0x0466('0x7'))(new Redis(config[_0x0466('0x5')]));require(_0x0466('0x8'))[_0x0466('0x9')](socket);function respondWithStatusCode(_0x2fa0cc,_0x31f963){_0x31f963=_0x31f963||0xcc;return function(_0x3a1ddc){if(_0x3a1ddc){return _0x2fa0cc[_0x0466('0xa')](_0x31f963);}return _0x2fa0cc[_0x0466('0xb')](_0x31f963)[_0x0466('0xc')]();};}function respondWithResult(_0x158054,_0xcc3fda){_0xcc3fda=_0xcc3fda||0xc8;return function(_0x489e85){if(_0x489e85){return _0x158054[_0x0466('0xb')](_0xcc3fda)[_0x0466('0xd')](_0x489e85);}};}function respondWithFilteredResult(_0x48d0dd,_0x24dcf0){return function(_0x20a5cb){if(_0x20a5cb){var _0x867271=typeof _0x24dcf0[_0x0466('0xe')]===_0x0466('0xf')&&typeof _0x24dcf0[_0x0466('0x10')]===_0x0466('0xf');var _0x40fc99=_0x20a5cb[_0x0466('0x11')];var _0x2c3d42=_0x867271?0x0:_0x24dcf0[_0x0466('0xe')];var _0x3eef06=_0x867271?_0x20a5cb[_0x0466('0x11')]:_0x24dcf0['offset']+_0x24dcf0[_0x0466('0x10')];var _0x4480b1;if(_0x3eef06>=_0x40fc99){_0x3eef06=_0x40fc99;_0x4480b1=0xc8;}else{_0x4480b1=0xce;}_0x48d0dd[_0x0466('0xb')](_0x4480b1);return _0x48d0dd[_0x0466('0x12')](_0x0466('0x13'),_0x2c3d42+'-'+_0x3eef06+'/'+_0x40fc99)['json'](_0x20a5cb);}return null;};}function removeEntity(_0x37c1b6){return function(_0x28e4a8){if(_0x28e4a8){return _0x28e4a8[_0x0466('0x14')]()['then'](function(){var _0x541b06=_0x28e4a8[_0x0466('0x15')]({'plain':!![]});var _0x1b11c3=[{'name':_0x0466('0x16'),'value':_0x0466('0x17'),'ignore':![]},{'name':_0x0466('0x18'),'value':_0x0466('0x19'),'ignore':![]},{'name':_0x0466('0x1a'),'value':_0x0466('0x1b'),'ignore':![]}];var _0xe70398=_(_0x1b11c3)[_0x0466('0x1c')](_0x0466('0x1d'))[_0x0466('0x1e')](_0x0466('0x1f'))[_0x0466('0x1f')]();if(_[_0x0466('0x20')](_0xe70398,_0x541b06['type'])){return;}var _0x38e337=_[_0x0466('0x21')](_0x1b11c3,[_0x0466('0x1f'),_0x541b06[_0x0466('0x22')]])[_0x0466('0x23')];return db['UserProfileResource']['destroy']({'where':{'type':_0x38e337,'resourceId':_0x541b06['id']}})['then'](function(){return _0x28e4a8;});})[_0x0466('0x24')](function(){_0x37c1b6[_0x0466('0xb')](0xcc)[_0x0466('0xc')]();});}};}function handleEntityNotFound(_0x199ae6){return function(_0x3c391c){if(!_0x3c391c){_0x199ae6[_0x0466('0xa')](0x194);}return _0x3c391c;};}function handleError(_0xd328a7,_0xe46173){_0xe46173=_0xe46173||0x1f4;return function(_0x414b58){logger[_0x0466('0x25')](_0x414b58[_0x0466('0x26')]);if(_0x414b58['name']){delete _0x414b58[_0x0466('0x23')];}_0xd328a7[_0x0466('0xb')](_0xe46173)[_0x0466('0x27')](_0x414b58);};}exports[_0x0466('0x28')]=function(_0x46bc29,_0x242741){var _0x5d7303={},_0x5053cb={},_0x3a9235={'count':0x0,'rows':[]};var _0xbabfe0=_[_0x0466('0x1e')](db[_0x0466('0x29')][_0x0466('0x2a')],function(_0x426f4c){return{'name':_0x426f4c['fieldName'],'type':_0x426f4c[_0x0466('0x22')][_0x0466('0x2b')]};});_0x5053cb['model']=_[_0x0466('0x1e')](_0xbabfe0,_0x0466('0x23'));_0x5053cb[_0x0466('0x2c')]=_['keys'](_0x46bc29[_0x0466('0x2c')]);_0x5053cb['filters']=_[_0x0466('0x2d')](_0x5053cb[_0x0466('0x2e')],_0x5053cb[_0x0466('0x2c')]);_0x5d7303['attributes']=_[_0x0466('0x2d')](_0x5053cb[_0x0466('0x2e')],qs[_0x0466('0x2f')](_0x46bc29[_0x0466('0x2c')][_0x0466('0x2f')]));_0x5d7303['attributes']=_0x5d7303[_0x0466('0x30')][_0x0466('0x31')]?_0x5d7303[_0x0466('0x30')]:_0x5053cb[_0x0466('0x2e')];if(!_0x46bc29['query']['hasOwnProperty']('nolimit')){_0x5d7303['limit']=qs[_0x0466('0x10')](_0x46bc29[_0x0466('0x2c')][_0x0466('0x10')]);_0x5d7303[_0x0466('0xe')]=qs['offset'](_0x46bc29[_0x0466('0x2c')][_0x0466('0xe')]);}_0x5d7303[_0x0466('0x32')]=qs[_0x0466('0x33')](_0x46bc29[_0x0466('0x2c')]['sort']);_0x5d7303['where']=qs[_0x0466('0x34')](_[_0x0466('0x35')](_0x46bc29[_0x0466('0x2c')],_0x5053cb[_0x0466('0x34')]),_0xbabfe0);if(_0x46bc29[_0x0466('0x2c')][_0x0466('0x1c')]){_0x5d7303[_0x0466('0x36')]=_[_0x0466('0x37')](_0x5d7303[_0x0466('0x36')],{'$or':_[_0x0466('0x1e')](_0xbabfe0,function(_0x4d79d2){if(_0x4d79d2['type']!=='VIRTUAL'){var _0x18749e={};_0x18749e[_0x4d79d2[_0x0466('0x23')]]={'$like':'%'+_0x46bc29[_0x0466('0x2c')]['filter']+'%'};return _0x18749e;}})});}_0x5d7303=_[_0x0466('0x37')]({},_0x5d7303,_0x46bc29['options']);var _0xd9269e={'where':_0x5d7303[_0x0466('0x36')]};return db[_0x0466('0x29')][_0x0466('0x11')](_0xd9269e)[_0x0466('0x24')](function(_0x235cd3){_0x3a9235[_0x0466('0x11')]=_0x235cd3;if(_0x46bc29[_0x0466('0x2c')][_0x0466('0x38')]){_0x5d7303[_0x0466('0x39')]=[{'all':!![]}];}return db['VoiceExtension'][_0x0466('0x3a')](_0x5d7303);})['then'](function(_0x3c6457){_0x3a9235['rows']=_0x3c6457;return _0x3a9235;})[_0x0466('0x24')](respondWithFilteredResult(_0x242741,_0x5d7303))[_0x0466('0x3b')](handleError(_0x242741,null));};exports[_0x0466('0x3c')]=function(_0x281e5a,_0x219712){var _0x628bca={'raw':![],'where':{'id':_0x281e5a[_0x0466('0x3d')]['id']}},_0x78fe12={};_0x78fe12[_0x0466('0x2e')]=_[_0x0466('0x3e')](db[_0x0466('0x29')][_0x0466('0x2a')]);_0x78fe12[_0x0466('0x2c')]=_[_0x0466('0x3e')](_0x281e5a['query']);_0x78fe12[_0x0466('0x34')]=_['intersection'](_0x78fe12[_0x0466('0x2e')],_0x78fe12[_0x0466('0x2c')]);_0x628bca[_0x0466('0x30')]=_[_0x0466('0x2d')](_0x78fe12['model'],qs['fields'](_0x281e5a[_0x0466('0x2c')][_0x0466('0x2f')]));_0x628bca[_0x0466('0x30')]=_0x628bca[_0x0466('0x30')][_0x0466('0x31')]?_0x628bca['attributes']:_0x78fe12[_0x0466('0x2e')];if(_0x281e5a[_0x0466('0x2c')]['includeAll']){_0x628bca[_0x0466('0x39')]=[{'all':!![]}];}_0x628bca=_[_0x0466('0x37')]({},_0x628bca,_0x281e5a[_0x0466('0x3f')]);return db[_0x0466('0x29')][_0x0466('0x21')](_0x628bca)['then'](handleEntityNotFound(_0x219712,null))['then'](respondWithResult(_0x219712,null))['catch'](handleError(_0x219712,null));};exports['destroy']=function(_0x7f4f8c,_0x293bf6){return db[_0x0466('0x29')][_0x0466('0x21')]({'where':{'id':_0x7f4f8c['params']['id']}})[_0x0466('0x24')](handleEntityNotFound(_0x293bf6,null))[_0x0466('0x24')](removeEntity(_0x293bf6,null))[_0x0466('0x3b')](handleError(_0x293bf6,null));};exports[_0x0466('0x40')]=function(_0x512fe1,_0x2c1819){if(_0x512fe1[_0x0466('0x41')]['type']==='outbound'&&!_[_0x0466('0x42')](_0x512fe1['body'][_0x0466('0x43')],'_')){_0x512fe1[_0x0466('0x41')][_0x0466('0x43')]='_'[_0x0466('0x44')](_0x512fe1[_0x0466('0x41')][_0x0466('0x43')]);}return db[_0x0466('0x29')][_0x0466('0x40')](_0x512fe1['body'],{'raw':![]})[_0x0466('0x24')](function(_0x23aff3){var _0x559c9b=_0x512fe1[_0x0466('0x45')][_0x0466('0x15')]({'plain':!![]});if(!_0x559c9b)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x559c9b['role']===_0x0466('0x45')){var _0x3a19ed=_0x23aff3['get']({'plain':!![]});var _0x2222ce=[{'name':_0x0466('0x16'),'value':_0x0466('0x17')},{'name':'OutboundRoutes','value':_0x0466('0x19')},{'name':_0x0466('0x1a'),'value':_0x0466('0x1b')}];var _0x5a21fb=_[_0x0466('0x21')](_0x2222ce,[_0x0466('0x1f'),_0x3a19ed[_0x0466('0x22')]])[_0x0466('0x23')];return db[_0x0466('0x46')][_0x0466('0x21')]({'where':{'name':_0x5a21fb,'userProfileId':_0x559c9b[_0x0466('0x47')]},'raw':!![]})[_0x0466('0x24')](function(_0x13d235){if(_0x13d235&&_0x13d235[_0x0466('0x48')]===0x0){return db[_0x0466('0x49')]['create']({'name':_0x3a19ed['name'],'resourceId':_0x3a19ed['id'],'type':_0x13d235[_0x0466('0x23')],'sectionId':_0x13d235['id']},{})[_0x0466('0x24')](function(){return _0x23aff3;});}else{return _0x23aff3;}})[_0x0466('0x3b')](function(_0x3cb817){logger[_0x0466('0x25')](_0x0466('0x4a'),_0x3cb817);throw _0x3cb817;});}return _0x23aff3;})[_0x0466('0x24')](respondWithResult(_0x2c1819,0xc9))['catch'](handleError(_0x2c1819,null));};exports[_0x0466('0x4b')]=function(_0x4ff979,_0x41f6b4){if(_0x4ff979['body']['id']){delete _0x4ff979[_0x0466('0x41')]['id'];}return db['VoiceExtension']['find']({'where':{'id':_0x4ff979['params']['id']}})[_0x0466('0x24')](handleEntityNotFound(_0x41f6b4,null))[_0x0466('0x24')](function(_0x4c1d73){if(_0x4c1d73){return db[_0x0466('0x29')][_0x0466('0x4b')](_[_0x0466('0x35')](_0x4ff979[_0x0466('0x41')],[_0x0466('0x43'),'context','description','recordingFormat',_0x0466('0x4c'),_0x0466('0x4d'),'alias']),{'where':{'context':_0x4c1d73[_0x0466('0x4e')],'exten':_0x4c1d73[_0x0466('0x43')]},'individualHooks':!![]})[_0x0466('0x24')](function(_0x1a2d24){return _0x1a2d24;});}return null;})[_0x0466('0x24')](respondWithStatusCode(_0x41f6b4,null))[_0x0466('0x3b')](handleError(_0x41f6b4,null));};exports[_0x0466('0x4f')]=function(_0x246e95,_0x7f5928){var _0x2c0739=_0x246e95['params']['id'];var _0x23cb41=_0x246e95['body'];var _0x1ddfa3=0xc8;var _0x2202f1=null;return db['sequelize']['transaction']({'isolationLevel':db[_0x0466('0x50')]['Transaction'][_0x0466('0x51')][_0x0466('0x52')]},function(_0x2f74f2){return db[_0x0466('0x29')][_0x0466('0x53')]({'where':{'id':_0x2c0739},'transaction':_0x2f74f2})['then'](function(_0x536660){if(_0x536660){return db[_0x0466('0x29')][_0x0466('0x14')]({'where':{'VoiceExtensionId':_0x2c0739},'transaction':_0x2f74f2})[_0x0466('0x24')](function(){var _0x3057d6=_[_0x0466('0x1e')](_0x23cb41,function(_0x349547){_0x349547[_0x0466('0x54')]=_0x2c0739;_0x349547[_0x0466('0x55')]=!![];return _0x349547;});return _0x536660[_0x0466('0x56')](_0x3057d6);})[_0x0466('0x24')](function(_0x42429b){return db['VoiceExtension'][_0x0466('0x57')](_0x42429b,{'transaction':_0x2f74f2});});}else{_0x1ddfa3=0x194;_0x2202f1=[];}});})[_0x0466('0x24')](function(){if(_0x1ddfa3!==0x194){return db[_0x0466('0x29')][_0x0466('0x58')]({'where':{'isApp':!![],'VoiceExtensionId':_0x2c0739},'order':_0x0466('0x59')})[_0x0466('0x24')](function(_0x1eea1c){_0x2202f1=_0x1eea1c;});}})['catch'](function(_0x1d66a1){_0x1ddfa3=0x1f4;logger[_0x0466('0x25')](_0x1d66a1[_0x0466('0x26')]);if(_0x1d66a1['name']){delete _0x1d66a1[_0x0466('0x23')];}_0x2202f1=_0x1d66a1;})[_0x0466('0x5a')](function(){if(_0x2202f1===null){_0x7f5928[_0x0466('0xa')](_0x1ddfa3);}else{if(_0x1ddfa3===0x1f4){_0x7f5928[_0x0466('0xb')](_0x1ddfa3)[_0x0466('0x27')](_0x2202f1);}else{_0x7f5928[_0x0466('0xb')](_0x1ddfa3)[_0x0466('0xd')](_0x2202f1);}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index 9a752e0..6a840d9 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 _0x5090=['hook','exports','events','../../mysqldb','VoiceExtension','setMaxListeners','save','update','emit','hasOwnProperty'];(function(_0x487085,_0x13ffeb){var _0xd08cb8=function(_0x1922e5){while(--_0x1922e5){_0x487085['push'](_0x487085['shift']());}};_0xd08cb8(++_0x13ffeb);}(_0x5090,0x7a));var _0x0509=function(_0x5c0cdc,_0x12e039){_0x5c0cdc=_0x5c0cdc-0x0;var _0x19ec84=_0x5090[_0x5c0cdc];return _0x19ec84;};'use strict';var EventEmitter=require(_0x0509('0x0'));var VoiceExtension=require(_0x0509('0x1'))['db'][_0x0509('0x2')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x0509('0x3')](0x0);var events={'afterCreate':_0x0509('0x4'),'afterUpdate':_0x0509('0x5'),'afterDestroy':'remove'};function emitEvent(_0x21c970){return function(_0x288f56,_0xd37982,_0x4d5fb7){VoiceExtensionEvents[_0x0509('0x6')](_0x21c970+':'+_0x288f56['id'],_0x288f56);VoiceExtensionEvents[_0x0509('0x6')](_0x21c970,_0x288f56);_0x4d5fb7(null);};}for(var e in events){if(events[_0x0509('0x7')](e)){var event=events[e];VoiceExtension[_0x0509('0x8')](e,emitEvent(event));}}module[_0x0509('0x9')]=VoiceExtensionEvents; \ No newline at end of file +var _0x79b7=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','VoiceExtension','setMaxListeners','save','update','remove'];(function(_0x9a7796,_0xe30784){var _0x2e73a0=function(_0x120615){while(--_0x120615){_0x9a7796['push'](_0x9a7796['shift']());}};_0x2e73a0(++_0xe30784);}(_0x79b7,0x17a));var _0x779b=function(_0x410be5,_0x12f2b7){_0x410be5=_0x410be5-0x0;var _0x1403af=_0x79b7[_0x410be5];return _0x1403af;};'use strict';var EventEmitter=require(_0x779b('0x0'));var VoiceExtension=require(_0x779b('0x1'))['db'][_0x779b('0x2')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x779b('0x3')](0x0);var events={'afterCreate':_0x779b('0x4'),'afterUpdate':_0x779b('0x5'),'afterDestroy':_0x779b('0x6')};function emitEvent(_0x4e1245){return function(_0x4f948a,_0x1aa991,_0x1d3511){VoiceExtensionEvents[_0x779b('0x7')](_0x4e1245+':'+_0x4f948a['id'],_0x4f948a);VoiceExtensionEvents[_0x779b('0x7')](_0x4e1245,_0x4f948a);_0x1d3511(null);};}for(var e in events){if(events[_0x779b('0x8')](e)){var event=events[e];VoiceExtension[_0x779b('0x9')](e,emitEvent(event));}}module[_0x779b('0xa')]=VoiceExtensionEvents; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.model.js b/server/api/voiceExtension/voiceExtension.model.js index 0c12513..be65fd0 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 _0x3611=['tag','ExecIf','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','callerID','Set(CALLERID(all)=','NoOp(No\x20number\x20available)','answer','queue','playback','includes','app','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','outboundDial','appdata','agi','XMCS-UNIQUEID=${CHANNEL(LINKEDID)}','priority','concat','last','catch','define','VoiceExtension','voice_extensions','get','Hangup','lodash','type','Set','CDR(type)=','context','alias','NoOp','CDR(routeAlias)=','No\x20alias\x20set','exten','push','inbound','CDR(routeid)=','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','CDR(type)=outbound','outbound','cutdigits','${EXTEN:','${EXTEN}','XCALLY-MOTION-ANSWER=0','outboundrouteid=','hasOwnProperty','recordingFormat','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','trunk','options','url','length','name','param','split','phone','prefix','SIP','none','indexOf','U(xcally-mixmonitor-context)','join','isEmpty','Interval','findAll','interval','IntervalId','then','intervals','map','filter','toLowerCase'];(function(_0x5bec2a,_0x16e1c7){var _0x58b6bc=function(_0x7520fa){while(--_0x7520fa){_0x5bec2a['push'](_0x5bec2a['shift']());}};_0x58b6bc(++_0x16e1c7);}(_0x3611,0x11d));var _0x1361=function(_0x1a4d93,_0x3b5097){_0x1a4d93=_0x1a4d93-0x0;var _0x476ddc=_0x3611[_0x1a4d93];return _0x476ddc;};'use strict';var _=require(_0x1361('0x0'));var attributes=require('./voiceExtension.attributes');module['exports']=function(_0x2d8bf1){var _0x37681e=_0x2d8bf1['models'];function _0x5b58dc(_0x21c3f0){var _0x27236e=0x2;var _0x4b7eb4=[{'type':_0x21c3f0[_0x1361('0x1')],'app':_0x1361('0x2'),'appdata':_0x1361('0x3')+_0x21c3f0['type'],'context':_0x21c3f0[_0x1361('0x4')],'exten':_0x21c3f0['exten'],'priority':_0x27236e++,'VoiceExtensionId':_0x21c3f0['id']},{'type':_0x21c3f0[_0x1361('0x1')],'app':_0x21c3f0[_0x1361('0x5')]?_0x1361('0x2'):_0x1361('0x6'),'appdata':_0x21c3f0[_0x1361('0x5')]?_0x1361('0x7')+_0x21c3f0[_0x1361('0x5')]:_0x1361('0x8'),'context':_0x21c3f0[_0x1361('0x4')],'exten':_0x21c3f0[_0x1361('0x9')],'priority':_0x27236e++,'VoiceExtensionId':_0x21c3f0['id']}];if(_0x21c3f0[_0x1361('0x1')]==='inbound'){_0x4b7eb4[_0x1361('0xa')]({'type':_0x1361('0xb'),'app':_0x1361('0x2'),'appdata':_0x1361('0xc')+_0x21c3f0['id'],'context':_0x21c3f0[_0x1361('0x4')],'exten':_0x21c3f0[_0x1361('0x9')],'priority':_0x27236e++,'VoiceExtensionId':_0x21c3f0['id']});}_0x4b7eb4['push']({'type':_0x21c3f0['type'],'app':_0x1361('0x2'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x21c3f0[_0x1361('0x4')],'exten':_0x21c3f0['exten'],'priority':_0x27236e++,'VoiceExtensionId':_0x21c3f0['id']},{'type':_0x21c3f0[_0x1361('0x1')],'app':_0x1361('0x2'),'appdata':_0x1361('0xd'),'context':_0x21c3f0[_0x1361('0x4')],'exten':_0x21c3f0[_0x1361('0x9')],'priority':_0x27236e++,'VoiceExtensionId':_0x21c3f0['id']},{'type':_0x21c3f0[_0x1361('0x1')],'app':_0x1361('0x2'),'appdata':_0x1361('0xe'),'context':_0x21c3f0[_0x1361('0x4')],'exten':_0x21c3f0[_0x1361('0x9')],'priority':_0x27236e++,'VoiceExtensionId':_0x21c3f0['id']});return _0x4b7eb4;}function _0x1cb2b0(_0x15bc02){var _0x1650c0=0x2;var _0x1da464=[{'type':'outbound','app':_0x1361('0x2'),'appdata':_0x1361('0xf'),'context':_0x15bc02[_0x1361('0x4')],'exten':_0x15bc02['exten'],'priority':_0x1650c0++,'VoiceExtensionId':_0x15bc02['id']},{'type':_0x1361('0x10'),'app':_0x15bc02[_0x1361('0x5')]?'Set':'NoOp','appdata':_0x15bc02[_0x1361('0x5')]?_0x1361('0x7')+_0x15bc02[_0x1361('0x5')]:_0x1361('0x8'),'context':_0x15bc02[_0x1361('0x4')],'exten':_0x15bc02[_0x1361('0x9')],'priority':_0x1650c0++,'VoiceExtensionId':_0x15bc02['id']},{'type':_0x1361('0x10'),'app':_0x1361('0x2'),'appdata':'CDR(destination)='+(_0x15bc02[_0x1361('0x11')]?_0x1361('0x12')+_0x15bc02[_0x1361('0x11')]+'}':_0x1361('0x13')),'context':_0x15bc02['context'],'exten':_0x15bc02[_0x1361('0x9')],'priority':_0x1650c0++,'VoiceExtensionId':_0x15bc02['id']},{'type':'outbound','app':_0x1361('0x2'),'appdata':_0x1361('0xc')+_0x15bc02['id'],'context':_0x15bc02[_0x1361('0x4')],'exten':_0x15bc02['exten'],'priority':_0x1650c0++,'VoiceExtensionId':_0x15bc02['id']},{'type':_0x1361('0x10'),'app':'ExecIf','appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0x1650c0+0x2)+'):Goto('+(_0x1650c0+0x1)+')','context':_0x15bc02[_0x1361('0x4')],'exten':_0x15bc02['exten'],'priority':_0x1650c0++,'VoiceExtensionId':_0x15bc02['id']},{'type':'outbound','app':_0x1361('0x2'),'appdata':_0x15bc02[_0x1361('0x11')]?'CDR(prefix)=${EXTEN:0:'+_0x15bc02[_0x1361('0x11')]+'}':'CDR(prefix)=noprefix','context':_0x15bc02[_0x1361('0x4')],'exten':_0x15bc02['exten'],'priority':_0x1650c0++,'VoiceExtensionId':_0x15bc02['id']},{'type':_0x1361('0x10'),'app':_0x1361('0x2'),'appdata':_0x1361('0x14'),'context':_0x15bc02[_0x1361('0x4')],'exten':_0x15bc02[_0x1361('0x9')],'priority':_0x1650c0++,'VoiceExtensionId':_0x15bc02['id']},{'type':_0x1361('0x10'),'app':'Set','appdata':_0x1361('0xd'),'context':_0x15bc02[_0x1361('0x4')],'exten':_0x15bc02['exten'],'priority':_0x1650c0++,'VoiceExtensionId':_0x15bc02['id']},{'type':_0x1361('0x10'),'app':_0x1361('0x2'),'appdata':_0x1361('0xe'),'context':_0x15bc02[_0x1361('0x4')],'exten':_0x15bc02['exten'],'priority':_0x1650c0++,'VoiceExtensionId':_0x15bc02['id']},{'type':_0x1361('0x10'),'app':_0x1361('0x2'),'appdata':_0x1361('0x15')+_0x15bc02['id'],'context':_0x15bc02[_0x1361('0x4')],'exten':_0x15bc02[_0x1361('0x9')],'priority':_0x1650c0++,'VoiceExtensionId':_0x15bc02['id']}];if(_0x15bc02[_0x1361('0x16')](_0x1361('0x17'))&&_0x15bc02[_0x1361('0x17')]!=='none'){_0x1da464[_0x1361('0xa')]({'type':_0x1361('0x10'),'app':_0x1361('0x2'),'appdata':_0x1361('0x18'),'context':_0x15bc02[_0x1361('0x4')],'exten':_0x15bc02['exten'],'priority':_0x1650c0++,'VoiceExtensionId':_0x15bc02['id']},{'type':_0x1361('0x10'),'app':_0x1361('0x2'),'appdata':_0x1361('0x19')+_0x15bc02[_0x1361('0x17')]||_0x1361('0x1a'),'context':_0x15bc02['context'],'exten':_0x15bc02['exten'],'priority':_0x1650c0++,'VoiceExtensionId':_0x15bc02['id']});}return _0x1da464;}function _0x593170(_0xab3808,_0x41ff5a){var _0x47bd91=[{'name':_0x1361('0x1b'),'param':0x0},{'name':'timeout','param':0x1},{'name':_0x1361('0x1c'),'param':0x2},{'name':_0x1361('0x1d'),'param':0x3}];var _0x3e6b20={};var _0x582af8=_0x41ff5a['split'](',');var _0x225d63=[];for(var _0x21a6f7=0x0;_0x21a6f7<_0x47bd91[_0x1361('0x1e')];_0x21a6f7++){switch(_0x47bd91[_0x21a6f7][_0x1361('0x1f')]){case _0x1361('0x1b'):_0x3e6b20['trunk']=_0x582af8[_0x47bd91[_0x21a6f7][_0x1361('0x20')]][_0x1361('0x21')]('/')[0x1];_0x3e6b20[_0x1361('0x22')]=_0x582af8[_0x47bd91[_0x21a6f7][_0x1361('0x20')]]['split']('/')[0x2];_0x3e6b20[_0x1361('0x23')]=_0x3e6b20[_0x1361('0x22')]?_0x3e6b20['phone'][_0x1361('0x21')]('$')[0x0]:undefined;_0x3e6b20[_0x1361('0x22')]=_0xab3808[_0x1361('0x11')]?(_0x3e6b20[_0x1361('0x23')]||'')+_0x1361('0x12')+_0xab3808[_0x1361('0x11')]+'}':(_0x3e6b20[_0x1361('0x23')]||'')+'${EXTEN}';_0x225d63[_0x47bd91[_0x21a6f7][_0x1361('0x20')]]=[_0x1361('0x24'),_0x3e6b20[_0x1361('0x1b')],_0x3e6b20[_0x1361('0x22')]]['join']('/');break;case _0x1361('0x1c'):_0x3e6b20[_0x1361('0x1c')]=_0x582af8[_0x47bd91[_0x21a6f7][_0x1361('0x20')]];if(_0xab3808[_0x1361('0x17')]!==_0x1361('0x25')){if(_0x3e6b20[_0x1361('0x1c')][_0x1361('0x26')](_0x1361('0x27'))<0x0){_0x3e6b20[_0x1361('0x1c')]+='U(xcally-mixmonitor-context)';}}else{_0x3e6b20[_0x1361('0x1c')]=_0x3e6b20[_0x1361('0x1c')]['replace'](_0x1361('0x27'),'');}_0x225d63[_0x47bd91[_0x21a6f7][_0x1361('0x20')]]=_0x3e6b20[_0x1361('0x1c')];break;default:_0x225d63[_0x47bd91[_0x21a6f7][_0x1361('0x20')]]=_0x582af8[_0x47bd91[_0x21a6f7]['param']];}}return _0x225d63[_0x1361('0x28')](',');}function _0x1c8ef0(_0x1ddc42,_0x9c1eb2,_0x20f845){return new Promise(function(_0x3d166b,_0x225d6b){var _0x10c6cd=[];if(_[_0x1361('0x29')](_0x9c1eb2))return _0x3d166b(_0x10c6cd);_0x37681e[_0x1361('0x2a')][_0x1361('0x2b')]({'attributes':['id',_0x1361('0x2c'),_0x1361('0x2d')],'raw':!![]})[_0x1361('0x2e')](function(_0x1a9481){for(var _0x5c8111=0x0,_0x1152b8=0x0;_0x5c8111<_0x9c1eb2[_0x1361('0x1e')];_0x5c8111++,_0x1152b8=0x0){var _0x4ce0e1=_0x9c1eb2[_0x5c8111];var _0x7b1bc9=[];var _0x2e600c=[];delete _0x4ce0e1['id'];if(_0x4ce0e1[_0x1361('0x2c')]!=='*,*,*,*'){_0x4ce0e1[_0x1361('0x2f')]=[_0x4ce0e1[_0x1361('0x2c')]];}else{_0x4ce0e1['intervals']=_0x4ce0e1[_0x1361('0x2d')]?_[_0x1361('0x30')](_[_0x1361('0x31')](_0x1a9481,{'IntervalId':_0x4ce0e1[_0x1361('0x2d')]}),_0x1361('0x2c')):[];}_0x4ce0e1[_0x1361('0x4')]=_0x1ddc42['context'];_0x4ce0e1[_0x1361('0x9')]=_0x1ddc42[_0x1361('0x9')];if(_0x4ce0e1['type'])_0x4ce0e1[_0x1361('0x1')]=_0x4ce0e1['type'][_0x1361('0x32')]();if(_0x1ddc42[_0x1361('0x1')]===_0x1361('0x10')){if(_0x4ce0e1[_0x1361('0x16')]('tag')&&_0x4ce0e1[_0x1361('0x33')]&&_0x4ce0e1['tag']!=='--'){_0x7b1bc9['push']({'type':_0x4ce0e1[_0x1361('0x1')][_0x1361('0x32')](),'app':_0x1361('0x2'),'appdata':'CDR(tag)='+_0x4ce0e1['tag'],'context':_0x1ddc42[_0x1361('0x4')],'exten':_0x1ddc42[_0x1361('0x9')],'priority':_0x4ce0e1[_0x1361('0x2f')][_0x1361('0x1e')]+_0x20f845+_0x1152b8++,'VoiceExtensionId':_0x1ddc42['id']});}_0x7b1bc9['push']({'type':_0x4ce0e1[_0x1361('0x1')][_0x1361('0x32')](),'app':_0x1361('0x34'),'appdata':_0x1361('0x35')+(_0x4ce0e1[_0x1361('0x36')]?_0x1361('0x37')+_0x4ce0e1[_0x1361('0x36')]+')':_0x1361('0x38')),'context':_0x1ddc42[_0x1361('0x4')],'exten':_0x1ddc42[_0x1361('0x9')],'priority':_0x4ce0e1[_0x1361('0x2f')][_0x1361('0x1e')]+_0x20f845+_0x1152b8++,'VoiceExtensionId':_0x1ddc42['id']});}else{if(_0x4ce0e1[_0x1361('0x16')](_0x1361('0x39'))){if([_0x1361('0x3a'),_0x1361('0x3b')][_0x1361('0x3c')](_0x4ce0e1[_0x1361('0x3d')]['toLowerCase']())&&_0x4ce0e1[_0x1361('0x3e')]!==_0x1361('0x3f')){if(_0x4ce0e1[_0x1361('0x39')]){_0x7b1bc9['push']({'type':_0x4ce0e1[_0x1361('0x1')]['toLowerCase'](),'app':'ExecIf','appdata':_0x1361('0x40'),'context':_0x1ddc42[_0x1361('0x4')],'exten':_0x1ddc42[_0x1361('0x9')],'priority':_0x4ce0e1[_0x1361('0x2f')][_0x1361('0x1e')]+_0x20f845+_0x1152b8++,'VoiceExtensionId':_0x1ddc42['id']});_0x7b1bc9['push']({'type':_0x4ce0e1['type'][_0x1361('0x32')](),'app':_0x1361('0x2'),'appdata':_0x1361('0x41'),'context':_0x1ddc42[_0x1361('0x4')],'exten':_0x1ddc42[_0x1361('0x9')],'priority':_0x4ce0e1[_0x1361('0x2f')][_0x1361('0x1e')]+_0x20f845+_0x1152b8++,'VoiceExtensionId':_0x1ddc42['id']});}else{_0x7b1bc9[_0x1361('0xa')]({'type':_0x4ce0e1[_0x1361('0x1')][_0x1361('0x32')](),'app':_0x1361('0x34'),'appdata':_0x1361('0x42'),'context':_0x1ddc42[_0x1361('0x4')],'exten':_0x1ddc42[_0x1361('0x9')],'priority':_0x4ce0e1[_0x1361('0x2f')]['length']+_0x20f845+_0x1152b8++,'VoiceExtensionId':_0x1ddc42['id']});_0x7b1bc9[_0x1361('0xa')]({'type':_0x4ce0e1[_0x1361('0x1')][_0x1361('0x32')](),'app':_0x1361('0x2'),'appdata':_0x1361('0x43'),'context':_0x1ddc42[_0x1361('0x4')],'exten':_0x1ddc42[_0x1361('0x9')],'priority':_0x4ce0e1[_0x1361('0x2f')][_0x1361('0x1e')]+_0x20f845+_0x1152b8++,'VoiceExtensionId':_0x1ddc42['id']});}}}}for(var _0x5af22f=0x0;_0x5af22f<_0x4ce0e1[_0x1361('0x2f')][_0x1361('0x1e')];_0x5af22f++){var _0xe8844a=_0x20f845+_0x4ce0e1[_0x1361('0x2f')]['length'];var _0x5a3cb4=_0x5af22f===_0x4ce0e1[_0x1361('0x2f')][_0x1361('0x1e')]-0x1?_0x20f845+_0x7b1bc9[_0x1361('0x1e')]+_0x2e600c['length']+0x2:_0x20f845+_0x5af22f+0x1;_0x7b1bc9[_0x1361('0x44')](_0x5af22f,0x0,{'type':_0x1ddc42[_0x1361('0x1')],'app':_0x1361('0x45'),'appdata':_0x4ce0e1[_0x1361('0x2f')][_0x5af22f]+'?'+_0x1ddc42[_0x1361('0x4')]+',${EXTEN},'+_0xe8844a+':'+_0x1ddc42[_0x1361('0x4')]+_0x1361('0x46')+_0x5a3cb4,'exten':_0x1ddc42[_0x1361('0x9')],'context':_0x1ddc42[_0x1361('0x4')],'priority':_0x20f845+_0x5af22f,'VoiceExtensionId':_0x1ddc42['id']});}if(_0x4ce0e1[_0x1361('0x3e')]===_0x1361('0x47')){_0x4ce0e1[_0x1361('0x48')]=_0x593170(_0x1ddc42,_0x4ce0e1[_0x1361('0x48')]);}if(_0x4ce0e1['appType']===_0x1361('0x49')){_0x7b1bc9[_0x1361('0xa')]({'type':_0x4ce0e1['type'][_0x1361('0x32')](),'app':_0x1361('0x2'),'appdata':_0x1361('0x4a'),'context':_0x1ddc42[_0x1361('0x4')],'exten':_0x1ddc42['exten'],'priority':_0x4ce0e1[_0x1361('0x2f')][_0x1361('0x1e')]+_0x20f845+_0x1152b8++,'VoiceExtensionId':_0x1ddc42['id']});}_0x4ce0e1[_0x1361('0x4b')]=_0x7b1bc9['length']?_['last'](_0x7b1bc9)[_0x1361('0x4b')]+0x1:_0x20f845;_0x10c6cd=_[_0x1361('0x4c')](_0x10c6cd,_0x7b1bc9,[_0x4ce0e1],_0x2e600c);_0x20f845=_[_0x1361('0x4d')](_0x10c6cd)[_0x1361('0x4b')]+0x1;}return _0x3d166b(_0x10c6cd);})[_0x1361('0x4e')](function(_0x3f5ad4){_0x225d6b(_0x3f5ad4);});});}return _0x2d8bf1[_0x1361('0x4f')](_0x1361('0x50'),attributes,{'tableName':_0x1361('0x51'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x2a68c8){var _0x26bfe1=this[_0x1361('0x52')]({'plain':!![]});var _0xf70c33=_0x26bfe1[_0x1361('0x1')]==='outbound'?_0x1cb2b0(_0x26bfe1):_0x5b58dc(_0x26bfe1);return _0x1c8ef0(_0x26bfe1,_0x2a68c8,_['last'](_0xf70c33)[_0x1361('0x4b')]+0x1)['then'](function(_0x2d74e6){var _0x26ba00=_[_0x1361('0x4c')](_0xf70c33,_0x2d74e6);_0x26ba00['push']({'type':_0x26bfe1[_0x1361('0x1')],'app':_0x1361('0x53'),'exten':_0x26bfe1[_0x1361('0x9')],'context':_0x26bfe1['context'],'priority':_[_0x1361('0x4d')](_0x26ba00)[_0x1361('0x4b')]+0x1,'VoiceExtensionId':_0x26bfe1['id']});return _0x26ba00;});}}});}; \ No newline at end of file +var _0x809e=['queue','playback','app','custom','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','GotoIfTime','appType','appdata','agi','XMCS-UNIQUEID=${CHANNEL(LINKEDID)}','priority','last','concat','catch','define','VoiceExtension','voice_extensions','get','lodash','./voiceExtension.attributes','exports','models','type','Set','context','exten','alias','NoOp','CDR(routeAlias)=','No\x20alias\x20set','inbound','push','XCALLY-MOTION-ANSWER=0','outbound','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','CDR(routeid)=','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=noprefix','XCALLY-MOTION-PROGRESS=0','outboundrouteid=','hasOwnProperty','none','_XCALLY_MIXMONITOR_FORMAT=','recordingFormat','wav','trunk','timeout','options','url','split','length','name','param','prefix','phone','join','U(xcally-mixmonitor-context)','Interval','findAll','interval','IntervalId','intervals','map','toLowerCase','tag','CDR(tag)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','callerID','Set(CALLERID(all)=','NoOp(No\x20number\x20available)','answer'];(function(_0xaa9dc0,_0x3bff6a){var _0x5ee2f8=function(_0x1ff53f){while(--_0x1ff53f){_0xaa9dc0['push'](_0xaa9dc0['shift']());}};_0x5ee2f8(++_0x3bff6a);}(_0x809e,0x1e8));var _0xe809=function(_0x247024,_0xae82fb){_0x247024=_0x247024-0x0;var _0x59b429=_0x809e[_0x247024];return _0x59b429;};'use strict';var _=require(_0xe809('0x0'));var attributes=require(_0xe809('0x1'));module[_0xe809('0x2')]=function(_0x182d56){var _0x1f1e6c=_0x182d56[_0xe809('0x3')];function _0x814e61(_0x1d2fdf){var _0x4d51d7=0x2;var _0x2fc7b6=[{'type':_0x1d2fdf[_0xe809('0x4')],'app':_0xe809('0x5'),'appdata':'CDR(type)='+_0x1d2fdf[_0xe809('0x4')],'context':_0x1d2fdf[_0xe809('0x6')],'exten':_0x1d2fdf[_0xe809('0x7')],'priority':_0x4d51d7++,'VoiceExtensionId':_0x1d2fdf['id']},{'type':_0x1d2fdf[_0xe809('0x4')],'app':_0x1d2fdf[_0xe809('0x8')]?'Set':_0xe809('0x9'),'appdata':_0x1d2fdf[_0xe809('0x8')]?_0xe809('0xa')+_0x1d2fdf[_0xe809('0x8')]:_0xe809('0xb'),'context':_0x1d2fdf['context'],'exten':_0x1d2fdf[_0xe809('0x7')],'priority':_0x4d51d7++,'VoiceExtensionId':_0x1d2fdf['id']}];if(_0x1d2fdf[_0xe809('0x4')]===_0xe809('0xc')){_0x2fc7b6[_0xe809('0xd')]({'type':_0xe809('0xc'),'app':'Set','appdata':'CDR(routeid)='+_0x1d2fdf['id'],'context':_0x1d2fdf['context'],'exten':_0x1d2fdf[_0xe809('0x7')],'priority':_0x4d51d7++,'VoiceExtensionId':_0x1d2fdf['id']});}_0x2fc7b6[_0xe809('0xd')]({'type':_0x1d2fdf[_0xe809('0x4')],'app':_0xe809('0x5'),'appdata':_0xe809('0xe'),'context':_0x1d2fdf[_0xe809('0x6')],'exten':_0x1d2fdf[_0xe809('0x7')],'priority':_0x4d51d7++,'VoiceExtensionId':_0x1d2fdf['id']},{'type':_0x1d2fdf['type'],'app':_0xe809('0x5'),'appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x1d2fdf['context'],'exten':_0x1d2fdf[_0xe809('0x7')],'priority':_0x4d51d7++,'VoiceExtensionId':_0x1d2fdf['id']},{'type':_0x1d2fdf[_0xe809('0x4')],'app':_0xe809('0x5'),'appdata':'MONITOR_OPTIONS=ab','context':_0x1d2fdf[_0xe809('0x6')],'exten':_0x1d2fdf['exten'],'priority':_0x4d51d7++,'VoiceExtensionId':_0x1d2fdf['id']});return _0x2fc7b6;}function _0x4da0f0(_0x3d1dce){var _0x1f790c=0x2;var _0x428796=[{'type':_0xe809('0xf'),'app':_0xe809('0x5'),'appdata':'CDR(type)=outbound','context':_0x3d1dce['context'],'exten':_0x3d1dce[_0xe809('0x7')],'priority':_0x1f790c++,'VoiceExtensionId':_0x3d1dce['id']},{'type':'outbound','app':_0x3d1dce[_0xe809('0x8')]?_0xe809('0x5'):'NoOp','appdata':_0x3d1dce[_0xe809('0x8')]?_0xe809('0xa')+_0x3d1dce[_0xe809('0x8')]:_0xe809('0xb'),'context':_0x3d1dce[_0xe809('0x6')],'exten':_0x3d1dce[_0xe809('0x7')],'priority':_0x1f790c++,'VoiceExtensionId':_0x3d1dce['id']},{'type':_0xe809('0xf'),'app':_0xe809('0x5'),'appdata':_0xe809('0x10')+(_0x3d1dce[_0xe809('0x11')]?_0xe809('0x12')+_0x3d1dce['cutdigits']+'}':_0xe809('0x13')),'context':_0x3d1dce[_0xe809('0x6')],'exten':_0x3d1dce[_0xe809('0x7')],'priority':_0x1f790c++,'VoiceExtensionId':_0x3d1dce['id']},{'type':_0xe809('0xf'),'app':_0xe809('0x5'),'appdata':_0xe809('0x14')+_0x3d1dce['id'],'context':_0x3d1dce['context'],'exten':_0x3d1dce[_0xe809('0x7')],'priority':_0x1f790c++,'VoiceExtensionId':_0x3d1dce['id']},{'type':'outbound','app':_0xe809('0x15'),'appdata':_0xe809('0x16')+(_0x1f790c+0x2)+_0xe809('0x17')+(_0x1f790c+0x1)+')','context':_0x3d1dce[_0xe809('0x6')],'exten':_0x3d1dce['exten'],'priority':_0x1f790c++,'VoiceExtensionId':_0x3d1dce['id']},{'type':'outbound','app':_0xe809('0x5'),'appdata':_0x3d1dce[_0xe809('0x11')]?'CDR(prefix)=${EXTEN:0:'+_0x3d1dce[_0xe809('0x11')]+'}':_0xe809('0x18'),'context':_0x3d1dce[_0xe809('0x6')],'exten':_0x3d1dce['exten'],'priority':_0x1f790c++,'VoiceExtensionId':_0x3d1dce['id']},{'type':_0xe809('0xf'),'app':_0xe809('0x5'),'appdata':_0xe809('0xe'),'context':_0x3d1dce[_0xe809('0x6')],'exten':_0x3d1dce[_0xe809('0x7')],'priority':_0x1f790c++,'VoiceExtensionId':_0x3d1dce['id']},{'type':_0xe809('0xf'),'app':_0xe809('0x5'),'appdata':_0xe809('0x19'),'context':_0x3d1dce[_0xe809('0x6')],'exten':_0x3d1dce[_0xe809('0x7')],'priority':_0x1f790c++,'VoiceExtensionId':_0x3d1dce['id']},{'type':'outbound','app':_0xe809('0x5'),'appdata':'MONITOR_OPTIONS=ab','context':_0x3d1dce[_0xe809('0x6')],'exten':_0x3d1dce['exten'],'priority':_0x1f790c++,'VoiceExtensionId':_0x3d1dce['id']},{'type':_0xe809('0xf'),'app':'Set','appdata':_0xe809('0x1a')+_0x3d1dce['id'],'context':_0x3d1dce['context'],'exten':_0x3d1dce[_0xe809('0x7')],'priority':_0x1f790c++,'VoiceExtensionId':_0x3d1dce['id']}];if(_0x3d1dce[_0xe809('0x1b')]('recordingFormat')&&_0x3d1dce['recordingFormat']!==_0xe809('0x1c')){_0x428796[_0xe809('0xd')]({'type':_0xe809('0xf'),'app':_0xe809('0x5'),'appdata':'_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','context':_0x3d1dce[_0xe809('0x6')],'exten':_0x3d1dce[_0xe809('0x7')],'priority':_0x1f790c++,'VoiceExtensionId':_0x3d1dce['id']},{'type':_0xe809('0xf'),'app':_0xe809('0x5'),'appdata':_0xe809('0x1d')+_0x3d1dce[_0xe809('0x1e')]||_0xe809('0x1f'),'context':_0x3d1dce['context'],'exten':_0x3d1dce['exten'],'priority':_0x1f790c++,'VoiceExtensionId':_0x3d1dce['id']});}return _0x428796;}function _0xeb18a6(_0x2a583d,_0x51d1d0){var _0x212e28=[{'name':_0xe809('0x20'),'param':0x0},{'name':_0xe809('0x21'),'param':0x1},{'name':_0xe809('0x22'),'param':0x2},{'name':_0xe809('0x23'),'param':0x3}];var _0x516c4c={};var _0xb43ff=_0x51d1d0[_0xe809('0x24')](',');var _0x56c2ea=[];for(var _0x6d8152=0x0;_0x6d8152<_0x212e28[_0xe809('0x25')];_0x6d8152++){switch(_0x212e28[_0x6d8152][_0xe809('0x26')]){case _0xe809('0x20'):_0x516c4c[_0xe809('0x20')]=_0xb43ff[_0x212e28[_0x6d8152][_0xe809('0x27')]][_0xe809('0x24')]('/')[0x1];_0x516c4c['phone']=_0xb43ff[_0x212e28[_0x6d8152]['param']][_0xe809('0x24')]('/')[0x2];_0x516c4c[_0xe809('0x28')]=_0x516c4c[_0xe809('0x29')]?_0x516c4c[_0xe809('0x29')][_0xe809('0x24')]('$')[0x0]:undefined;_0x516c4c[_0xe809('0x29')]=_0x2a583d[_0xe809('0x11')]?(_0x516c4c['prefix']||'')+'${EXTEN:'+_0x2a583d[_0xe809('0x11')]+'}':(_0x516c4c[_0xe809('0x28')]||'')+_0xe809('0x13');_0x56c2ea[_0x212e28[_0x6d8152][_0xe809('0x27')]]=['SIP',_0x516c4c[_0xe809('0x20')],_0x516c4c[_0xe809('0x29')]][_0xe809('0x2a')]('/');break;case _0xe809('0x22'):_0x516c4c[_0xe809('0x22')]=_0xb43ff[_0x212e28[_0x6d8152]['param']];if(_0x2a583d['recordingFormat']!==_0xe809('0x1c')){if(_0x516c4c[_0xe809('0x22')]['indexOf'](_0xe809('0x2b'))<0x0){_0x516c4c['options']+=_0xe809('0x2b');}}else{_0x516c4c[_0xe809('0x22')]=_0x516c4c[_0xe809('0x22')]['replace'](_0xe809('0x2b'),'');}_0x56c2ea[_0x212e28[_0x6d8152][_0xe809('0x27')]]=_0x516c4c['options'];break;default:_0x56c2ea[_0x212e28[_0x6d8152][_0xe809('0x27')]]=_0xb43ff[_0x212e28[_0x6d8152][_0xe809('0x27')]];}}return _0x56c2ea[_0xe809('0x2a')](',');}function _0x2f5a77(_0x38dabc,_0x1ef1da,_0x223522){return new Promise(function(_0xb673dd,_0x44b99e){var _0x502621=[];if(_['isEmpty'](_0x1ef1da))return _0xb673dd(_0x502621);_0x1f1e6c[_0xe809('0x2c')][_0xe809('0x2d')]({'attributes':['id',_0xe809('0x2e'),_0xe809('0x2f')],'raw':!![]})['then'](function(_0x5725f1){for(var _0x3001c8=0x0,_0x4729a3=0x0;_0x3001c8<_0x1ef1da[_0xe809('0x25')];_0x3001c8++,_0x4729a3=0x0){var _0x5ae640=_0x1ef1da[_0x3001c8];var _0xe62bbe=[];var _0x5a6a0d=[];delete _0x5ae640['id'];if(_0x5ae640[_0xe809('0x2e')]!=='*,*,*,*'){_0x5ae640['intervals']=[_0x5ae640[_0xe809('0x2e')]];}else{_0x5ae640[_0xe809('0x30')]=_0x5ae640[_0xe809('0x2f')]?_[_0xe809('0x31')](_['filter'](_0x5725f1,{'IntervalId':_0x5ae640[_0xe809('0x2f')]}),_0xe809('0x2e')):[];}_0x5ae640['context']=_0x38dabc[_0xe809('0x6')];_0x5ae640['exten']=_0x38dabc[_0xe809('0x7')];if(_0x5ae640[_0xe809('0x4')])_0x5ae640['type']=_0x5ae640[_0xe809('0x4')][_0xe809('0x32')]();if(_0x38dabc[_0xe809('0x4')]===_0xe809('0xf')){if(_0x5ae640[_0xe809('0x1b')](_0xe809('0x33'))&&_0x5ae640[_0xe809('0x33')]&&_0x5ae640[_0xe809('0x33')]!=='--'){_0xe62bbe[_0xe809('0xd')]({'type':_0x5ae640[_0xe809('0x4')][_0xe809('0x32')](),'app':'Set','appdata':_0xe809('0x34')+_0x5ae640['tag'],'context':_0x38dabc[_0xe809('0x6')],'exten':_0x38dabc[_0xe809('0x7')],'priority':_0x5ae640['intervals'][_0xe809('0x25')]+_0x223522+_0x4729a3++,'VoiceExtensionId':_0x38dabc['id']});}_0xe62bbe[_0xe809('0xd')]({'type':_0x5ae640[_0xe809('0x4')][_0xe809('0x32')](),'app':'ExecIf','appdata':_0xe809('0x35')+(_0x5ae640[_0xe809('0x36')]?_0xe809('0x37')+_0x5ae640[_0xe809('0x36')]+')':_0xe809('0x38')),'context':_0x38dabc['context'],'exten':_0x38dabc[_0xe809('0x7')],'priority':_0x5ae640[_0xe809('0x30')][_0xe809('0x25')]+_0x223522+_0x4729a3++,'VoiceExtensionId':_0x38dabc['id']});}else{if(_0x5ae640[_0xe809('0x1b')](_0xe809('0x39'))){if([_0xe809('0x3a'),_0xe809('0x3b')]['includes'](_0x5ae640[_0xe809('0x3c')][_0xe809('0x32')]())&&_0x5ae640['appType']!==_0xe809('0x3d')){if(_0x5ae640[_0xe809('0x39')]){_0xe62bbe['push']({'type':_0x5ae640[_0xe809('0x4')][_0xe809('0x32')](),'app':'ExecIf','appdata':'$[${XCALLY-MOTION-ANSWER}=0]?Answer','context':_0x38dabc[_0xe809('0x6')],'exten':_0x38dabc[_0xe809('0x7')],'priority':_0x5ae640[_0xe809('0x30')][_0xe809('0x25')]+_0x223522+_0x4729a3++,'VoiceExtensionId':_0x38dabc['id']});_0xe62bbe[_0xe809('0xd')]({'type':_0x5ae640['type']['toLowerCase'](),'app':_0xe809('0x5'),'appdata':_0xe809('0x3e'),'context':_0x38dabc[_0xe809('0x6')],'exten':_0x38dabc[_0xe809('0x7')],'priority':_0x5ae640[_0xe809('0x30')]['length']+_0x223522+_0x4729a3++,'VoiceExtensionId':_0x38dabc['id']});}else{_0xe62bbe['push']({'type':_0x5ae640[_0xe809('0x4')]['toLowerCase'](),'app':'ExecIf','appdata':_0xe809('0x3f'),'context':_0x38dabc[_0xe809('0x6')],'exten':_0x38dabc[_0xe809('0x7')],'priority':_0x5ae640['intervals'][_0xe809('0x25')]+_0x223522+_0x4729a3++,'VoiceExtensionId':_0x38dabc['id']});_0xe62bbe[_0xe809('0xd')]({'type':_0x5ae640['type'][_0xe809('0x32')](),'app':_0xe809('0x5'),'appdata':_0xe809('0x40'),'context':_0x38dabc['context'],'exten':_0x38dabc[_0xe809('0x7')],'priority':_0x5ae640[_0xe809('0x30')][_0xe809('0x25')]+_0x223522+_0x4729a3++,'VoiceExtensionId':_0x38dabc['id']});}}}}for(var _0x262688=0x0;_0x262688<_0x5ae640[_0xe809('0x30')][_0xe809('0x25')];_0x262688++){var _0x540932=_0x223522+_0x5ae640['intervals'][_0xe809('0x25')];var _0xea5dbc=_0x262688===_0x5ae640[_0xe809('0x30')]['length']-0x1?_0x223522+_0xe62bbe['length']+_0x5a6a0d['length']+0x2:_0x223522+_0x262688+0x1;_0xe62bbe['splice'](_0x262688,0x0,{'type':_0x38dabc[_0xe809('0x4')],'app':_0xe809('0x41'),'appdata':_0x5ae640[_0xe809('0x30')][_0x262688]+'?'+_0x38dabc['context']+',${EXTEN},'+_0x540932+':'+_0x38dabc[_0xe809('0x6')]+',${EXTEN},'+_0xea5dbc,'exten':_0x38dabc[_0xe809('0x7')],'context':_0x38dabc[_0xe809('0x6')],'priority':_0x223522+_0x262688,'VoiceExtensionId':_0x38dabc['id']});}if(_0x5ae640[_0xe809('0x42')]==='outboundDial'){_0x5ae640[_0xe809('0x43')]=_0xeb18a6(_0x38dabc,_0x5ae640[_0xe809('0x43')]);}if(_0x5ae640[_0xe809('0x42')]===_0xe809('0x44')){_0xe62bbe['push']({'type':_0x5ae640['type']['toLowerCase'](),'app':_0xe809('0x5'),'appdata':_0xe809('0x45'),'context':_0x38dabc[_0xe809('0x6')],'exten':_0x38dabc[_0xe809('0x7')],'priority':_0x5ae640[_0xe809('0x30')][_0xe809('0x25')]+_0x223522+_0x4729a3++,'VoiceExtensionId':_0x38dabc['id']});}_0x5ae640[_0xe809('0x46')]=_0xe62bbe[_0xe809('0x25')]?_[_0xe809('0x47')](_0xe62bbe)[_0xe809('0x46')]+0x1:_0x223522;_0x502621=_[_0xe809('0x48')](_0x502621,_0xe62bbe,[_0x5ae640],_0x5a6a0d);_0x223522=_[_0xe809('0x47')](_0x502621)['priority']+0x1;}return _0xb673dd(_0x502621);})[_0xe809('0x49')](function(_0x4937fe){_0x44b99e(_0x4937fe);});});}return _0x182d56[_0xe809('0x4a')](_0xe809('0x4b'),attributes,{'tableName':_0xe809('0x4c'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x360f98){var _0x498bcd=this[_0xe809('0x4d')]({'plain':!![]});var _0x50cbff=_0x498bcd[_0xe809('0x4')]===_0xe809('0xf')?_0x4da0f0(_0x498bcd):_0x814e61(_0x498bcd);return _0x2f5a77(_0x498bcd,_0x360f98,_[_0xe809('0x47')](_0x50cbff)['priority']+0x1)['then'](function(_0x224961){var _0x12b71c=_[_0xe809('0x48')](_0x50cbff,_0x224961);_0x12b71c[_0xe809('0xd')]({'type':_0x498bcd[_0xe809('0x4')],'app':'Hangup','exten':_0x498bcd[_0xe809('0x7')],'context':_0x498bcd[_0xe809('0x6')],'priority':_[_0xe809('0x47')](_0x12b71c)[_0xe809('0x46')]+0x1,'VoiceExtensionId':_0x498bcd['id']});return _0x12b71c;});}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.rpc.js b/server/api/voiceExtension/voiceExtension.rpc.js index c99d535..cd3304a 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 _0xab86=['attributes','limit','include','map','model','stringify','lodash','util','moment','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','register','request','then','info','VoiceExtension,\x20%s,\x20%s','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','GetVoiceExtension','VoiceExtension','findAll','options','where'];(function(_0x1d2362,_0x83aa1a){var _0x8741c=function(_0xf2ba7){while(--_0xf2ba7){_0x1d2362['push'](_0x1d2362['shift']());}};_0x8741c(++_0x83aa1a);}(_0xab86,0x13e));var _0x6ab8=function(_0xe35a3,_0x4973eb){_0xe35a3=_0xe35a3-0x0;var _0x4ba2d2=_0xab86[_0xe35a3];return _0x4ba2d2;};'use strict';var _=require(_0x6ab8('0x0'));var util=require(_0x6ab8('0x1'));var moment=require(_0x6ab8('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6ab8('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x6ab8('0x4'));var logger=require('../../config/logger')(_0x6ab8('0x5'));var config=require(_0x6ab8('0x6'));var jayson=require(_0x6ab8('0x7'));var client=jayson[_0x6ab8('0x8')][_0x6ab8('0x9')]({'port':0x232a});config[_0x6ab8('0xa')]=_[_0x6ab8('0xb')](config[_0x6ab8('0xa')],{'host':_0x6ab8('0xc'),'port':0x18eb});var socket=require(_0x6ab8('0xd'))(new Redis(config[_0x6ab8('0xa')]));require(_0x6ab8('0xe'))[_0x6ab8('0xf')](socket);function respondWithRpcPromise(_0x5127eb,_0x5ea6e6,_0x383594){return new BPromise(function(_0x5b7732,_0x18d3a3){return client[_0x6ab8('0x10')](_0x5127eb,_0x383594)[_0x6ab8('0x11')](function(_0x52d636){logger[_0x6ab8('0x12')](_0x6ab8('0x13'),_0x5ea6e6,'request\x20sent');logger[_0x6ab8('0x14')](_0x6ab8('0x15'),_0x5ea6e6,_0x6ab8('0x16'),JSON['stringify'](_0x52d636));if(_0x52d636[_0x6ab8('0x17')]){if(_0x52d636[_0x6ab8('0x17')][_0x6ab8('0x18')]===0x1f4){logger[_0x6ab8('0x17')](_0x6ab8('0x13'),_0x5ea6e6,_0x52d636[_0x6ab8('0x17')][_0x6ab8('0x19')]);return _0x18d3a3(_0x52d636[_0x6ab8('0x17')][_0x6ab8('0x19')]);}logger['error'](_0x6ab8('0x13'),_0x5ea6e6,_0x52d636[_0x6ab8('0x17')][_0x6ab8('0x19')]);return _0x5b7732(_0x52d636['error'][_0x6ab8('0x19')]);}else{logger[_0x6ab8('0x12')]('VoiceExtension,\x20%s,\x20%s',_0x5ea6e6,'request\x20sent');_0x5b7732(_0x52d636[_0x6ab8('0x1a')]['message']);}})[_0x6ab8('0x1b')](function(_0x292b36){logger[_0x6ab8('0x17')]('VoiceExtension,\x20%s,\x20%s',_0x5ea6e6,_0x292b36);_0x18d3a3(_0x292b36);});});}exports[_0x6ab8('0x1c')]=function(_0x3de5b3){var _0x2d2a80=this;return new Promise(function(_0x312183,_0x5227c6){return db[_0x6ab8('0x1d')][_0x6ab8('0x1e')]({'raw':_0x3de5b3['options']?_0x3de5b3['options']['raw']===undefined?!![]:![]:!![],'where':_0x3de5b3[_0x6ab8('0x1f')]?_0x3de5b3[_0x6ab8('0x1f')][_0x6ab8('0x20')]||null:null,'attributes':_0x3de5b3['options']?_0x3de5b3[_0x6ab8('0x1f')][_0x6ab8('0x21')]||null:null,'limit':_0x3de5b3['options']?_0x3de5b3['options'][_0x6ab8('0x22')]||null:null,'include':_0x3de5b3[_0x6ab8('0x1f')]?_0x3de5b3['options'][_0x6ab8('0x23')]?_[_0x6ab8('0x24')](_0x3de5b3[_0x6ab8('0x1f')][_0x6ab8('0x23')],function(_0x3ddaeb){return{'model':db[_0x3ddaeb[_0x6ab8('0x25')]],'as':_0x3ddaeb['as'],'attributes':_0x3ddaeb[_0x6ab8('0x21')],'include':_0x3ddaeb[_0x6ab8('0x23')]?_['map'](_0x3ddaeb['include'],function(_0x334e21){return{'model':db[_0x334e21['model']],'as':_0x334e21['as'],'attributes':_0x334e21[_0x6ab8('0x21')],'include':_0x334e21[_0x6ab8('0x23')]?_[_0x6ab8('0x24')](_0x334e21['include'],function(_0x525687){return{'model':db[_0x525687['model']],'as':_0x525687['as'],'attributes':_0x525687[_0x6ab8('0x21')]};}):[]};}):[]};}):[]:[]})[_0x6ab8('0x11')](function(_0x3723a7){logger[_0x6ab8('0x12')](_0x6ab8('0x1c'),_0x3de5b3);logger[_0x6ab8('0x14')](_0x6ab8('0x1c'),_0x3de5b3,JSON[_0x6ab8('0x26')](_0x3723a7));_0x312183(_0x3723a7);})[_0x6ab8('0x1b')](function(_0x1f6dbc){logger[_0x6ab8('0x17')](_0x6ab8('0x1c'),_0x1f6dbc[_0x6ab8('0x19')],_0x3de5b3);_0x5227c6(_0x2d2a80['error'](0x1f4,_0x1f6dbc['message']));});});}; \ No newline at end of file +var _0x2675=['findAll','options','where','limit','include','map','model','attributes','catch','lodash','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','then','info','VoiceExtension,\x20%s,\x20%s','request\x20sent','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetVoiceExtension','VoiceExtension'];(function(_0x47c97a,_0x23d388){var _0x296a19=function(_0x5971f6){while(--_0x5971f6){_0x47c97a['push'](_0x47c97a['shift']());}};_0x296a19(++_0x23d388);}(_0x2675,0x75));var _0x5267=function(_0xd7a37d,_0x3b2141){_0xd7a37d=_0xd7a37d-0x0;var _0x3b1898=_0x2675[_0xd7a37d];return _0x3b1898;};'use strict';var _=require(_0x5267('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x5267('0x1'));var fs=require('fs');var Redis=require(_0x5267('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x5267('0x3'));var logger=require(_0x5267('0x4'))('rpc');var config=require(_0x5267('0x5'));var jayson=require(_0x5267('0x6'));var client=jayson[_0x5267('0x7')][_0x5267('0x8')]({'port':0x232a});config[_0x5267('0x9')]=_[_0x5267('0xa')](config['redis'],{'host':_0x5267('0xb'),'port':0x18eb});var socket=require(_0x5267('0xc'))(new Redis(config['redis']));require(_0x5267('0xd'))['register'](socket);function respondWithRpcPromise(_0x3ff4e9,_0x207d47,_0x26e22b){return new BPromise(function(_0x534c2b,_0x3e6964){return client['request'](_0x3ff4e9,_0x26e22b)[_0x5267('0xe')](function(_0x5bbf00){logger[_0x5267('0xf')](_0x5267('0x10'),_0x207d47,_0x5267('0x11'));logger[_0x5267('0x12')](_0x5267('0x13'),_0x207d47,_0x5267('0x11'),JSON[_0x5267('0x14')](_0x5bbf00));if(_0x5bbf00[_0x5267('0x15')]){if(_0x5bbf00[_0x5267('0x15')][_0x5267('0x16')]===0x1f4){logger[_0x5267('0x15')](_0x5267('0x10'),_0x207d47,_0x5bbf00[_0x5267('0x15')]['message']);return _0x3e6964(_0x5bbf00['error'][_0x5267('0x17')]);}logger[_0x5267('0x15')](_0x5267('0x10'),_0x207d47,_0x5bbf00[_0x5267('0x15')][_0x5267('0x17')]);return _0x534c2b(_0x5bbf00[_0x5267('0x15')][_0x5267('0x17')]);}else{logger[_0x5267('0xf')](_0x5267('0x10'),_0x207d47,_0x5267('0x11'));_0x534c2b(_0x5bbf00[_0x5267('0x18')][_0x5267('0x17')]);}})['catch'](function(_0x18f32e){logger[_0x5267('0x15')]('VoiceExtension,\x20%s,\x20%s',_0x207d47,_0x18f32e);_0x3e6964(_0x18f32e);});});}exports[_0x5267('0x19')]=function(_0x56733e){var _0x1cf835=this;return new Promise(function(_0x1019e7,_0x39c0c3){return db[_0x5267('0x1a')][_0x5267('0x1b')]({'raw':_0x56733e['options']?_0x56733e[_0x5267('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x56733e[_0x5267('0x1c')]?_0x56733e[_0x5267('0x1c')][_0x5267('0x1d')]||null:null,'attributes':_0x56733e['options']?_0x56733e['options']['attributes']||null:null,'limit':_0x56733e['options']?_0x56733e['options'][_0x5267('0x1e')]||null:null,'include':_0x56733e[_0x5267('0x1c')]?_0x56733e[_0x5267('0x1c')][_0x5267('0x1f')]?_[_0x5267('0x20')](_0x56733e[_0x5267('0x1c')][_0x5267('0x1f')],function(_0x220e03){return{'model':db[_0x220e03[_0x5267('0x21')]],'as':_0x220e03['as'],'attributes':_0x220e03['attributes'],'include':_0x220e03['include']?_[_0x5267('0x20')](_0x220e03[_0x5267('0x1f')],function(_0x5abf95){return{'model':db[_0x5abf95[_0x5267('0x21')]],'as':_0x5abf95['as'],'attributes':_0x5abf95['attributes'],'include':_0x5abf95['include']?_[_0x5267('0x20')](_0x5abf95[_0x5267('0x1f')],function(_0x1f33b7){return{'model':db[_0x1f33b7[_0x5267('0x21')]],'as':_0x1f33b7['as'],'attributes':_0x1f33b7[_0x5267('0x22')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5e87eb){logger[_0x5267('0xf')](_0x5267('0x19'),_0x56733e);logger[_0x5267('0x12')]('GetVoiceExtension',_0x56733e,JSON['stringify'](_0x5e87eb));_0x1019e7(_0x5e87eb);})[_0x5267('0x23')](function(_0x3ef2a8){logger[_0x5267('0x15')]('GetVoiceExtension',_0x3ef2a8['message'],_0x56733e);_0x39c0c3(_0x1cf835[_0x5267('0x15')](0x1f4,_0x3ef2a8[_0x5267('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index 616cf60..1b0eb2d 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 _0x5fc3=['./voiceExtension.events','save','update','emit','removeListener','register','voiceExtension:'];(function(_0x463bbe,_0xf91af8){var _0x2af9cc=function(_0x1a5870){while(--_0x1a5870){_0x463bbe['push'](_0x463bbe['shift']());}};_0x2af9cc(++_0xf91af8);}(_0x5fc3,0xa8));var _0x35fc=function(_0x11a55c,_0x4eced9){_0x11a55c=_0x11a55c-0x0;var _0x26c390=_0x5fc3[_0x11a55c];return _0x26c390;};'use strict';var VoiceExtensionEvents=require(_0x35fc('0x0'));var events=[_0x35fc('0x1'),'remove',_0x35fc('0x2')];function createListener(_0x2ac6da,_0x196bc2){return function(_0x91d024){_0x196bc2[_0x35fc('0x3')](_0x2ac6da,_0x91d024);};}function removeListener(_0x5e75e6,_0x2d1404){return function(){VoiceExtensionEvents[_0x35fc('0x4')](_0x5e75e6,_0x2d1404);};}exports[_0x35fc('0x5')]=function(_0x5b85ad){for(var _0x5754be=0x0,_0x19a0d1=events['length'];_0x5754be<_0x19a0d1;_0x5754be++){var _0x16e153=events[_0x5754be];var _0x27524f=createListener(_0x35fc('0x6')+_0x16e153,_0x5b85ad);VoiceExtensionEvents['on'](_0x16e153,_0x27524f);}}; \ No newline at end of file +var _0xf494=['save','remove','emit','removeListener','register','voiceExtension:','./voiceExtension.events'];(function(_0x3e376e,_0x2b44ed){var _0x1a8b09=function(_0x24a083){while(--_0x24a083){_0x3e376e['push'](_0x3e376e['shift']());}};_0x1a8b09(++_0x2b44ed);}(_0xf494,0x1c6));var _0x4f49=function(_0x2f87c2,_0x5b1e5c){_0x2f87c2=_0x2f87c2-0x0;var _0x2aaa28=_0xf494[_0x2f87c2];return _0x2aaa28;};'use strict';var VoiceExtensionEvents=require(_0x4f49('0x0'));var events=[_0x4f49('0x1'),_0x4f49('0x2'),'update'];function createListener(_0x3aeeb8,_0x1d54cc){return function(_0x423b25){_0x1d54cc[_0x4f49('0x3')](_0x3aeeb8,_0x423b25);};}function removeListener(_0x20c0d7,_0x2a15fb){return function(){VoiceExtensionEvents[_0x4f49('0x4')](_0x20c0d7,_0x2a15fb);};}exports[_0x4f49('0x5')]=function(_0xc5e778){for(var _0x413530=0x0,_0x42b0e8=events['length'];_0x413530<_0x42b0e8;_0x413530++){var _0x58e9a0=events[_0x413530];var _0x169c95=createListener(_0x4f49('0x6')+_0x58e9a0,_0xc5e778);VoiceExtensionEvents['on'](_0x58e9a0,_0x169c95);}}; \ No newline at end of file diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index b593178..493abdf 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 _0x32f4=['multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceMail.controller','get','isAuthenticated','/:id','getMessages','post','create','update','exports'];(function(_0x3e3f09,_0x564b0e){var _0x462a5e=function(_0x234b70){while(--_0x234b70){_0x3e3f09['push'](_0x3e3f09['shift']());}};_0x462a5e(++_0x564b0e);}(_0x32f4,0x154));var _0x432f=function(_0x16bc7f,_0x525713){_0x16bc7f=_0x16bc7f-0x0;var _0x15833e=_0x32f4[_0x16bc7f];return _0x15833e;};'use strict';var multer=require(_0x432f('0x0'));var util=require(_0x432f('0x1'));var path=require(_0x432f('0x2'));var timeout=require(_0x432f('0x3'));var express=require('express');var router=express[_0x432f('0x4')]();var fs_extra=require(_0x432f('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x432f('0x6'));var config=require(_0x432f('0x7'));var controller=require(_0x432f('0x8'));router[_0x432f('0x9')]('/',auth[_0x432f('0xa')](),controller['index']);router['get'](_0x432f('0xb'),auth[_0x432f('0xa')](),controller['show']);router[_0x432f('0x9')]('/:id/messages',auth[_0x432f('0xa')](),controller[_0x432f('0xc')]);router[_0x432f('0xd')]('/',auth[_0x432f('0xa')](),controller[_0x432f('0xe')]);router['put'](_0x432f('0xb'),auth['isAuthenticated'](),controller[_0x432f('0xf')]);router['delete'](_0x432f('0xb'),auth[_0x432f('0xa')](),controller['destroy']);module[_0x432f('0x10')]=router; \ No newline at end of file +var _0x958a=['Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id','show','getMessages','post','create','put','update','delete','destroy','multer','util','connect-timeout','express'];(function(_0x291d8c,_0x27f577){var _0x382aea=function(_0x1de38f){while(--_0x1de38f){_0x291d8c['push'](_0x291d8c['shift']());}};_0x382aea(++_0x27f577);}(_0x958a,0x128));var _0xa958=function(_0x2d22d4,_0x39d5fb){_0x2d22d4=_0x2d22d4-0x0;var _0x427a3f=_0x958a[_0x2d22d4];return _0x427a3f;};'use strict';var multer=require(_0xa958('0x0'));var util=require(_0xa958('0x1'));var path=require('path');var timeout=require(_0xa958('0x2'));var express=require(_0xa958('0x3'));var router=express[_0xa958('0x4')]();var fs_extra=require(_0xa958('0x5'));var auth=require(_0xa958('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xa958('0x7'));var controller=require('./voiceMail.controller');router[_0xa958('0x8')]('/',auth[_0xa958('0x9')](),controller[_0xa958('0xa')]);router[_0xa958('0x8')](_0xa958('0xb'),auth[_0xa958('0x9')](),controller[_0xa958('0xc')]);router['get']('/:id/messages',auth[_0xa958('0x9')](),controller[_0xa958('0xd')]);router[_0xa958('0xe')]('/',auth[_0xa958('0x9')](),controller[_0xa958('0xf')]);router[_0xa958('0x10')](_0xa958('0xb'),auth[_0xa958('0x9')](),controller[_0xa958('0x11')]);router[_0xa958('0x12')](_0xa958('0xb'),auth[_0xa958('0x9')](),controller[_0xa958('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.attributes.js b/server/api/voiceMail/voiceMail.attributes.js index bbc9a36..a651fd9 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 _0xe8c0=['sequelize','exports','STRING','from-voicemail','contest_mailbox','setDataValue','string','trim','central','yes','ENUM','TIMESTAMP','INTEGER','VIRTUAL','getDataValue','fullname','\x20-\x20','mailbox'];(function(_0xd511d,_0x3546b9){var _0x3f148e=function(_0x51f35f){while(--_0x51f35f){_0xd511d['push'](_0xd511d['shift']());}};_0x3f148e(++_0x3546b9);}(_0xe8c0,0x168));var _0x0e8c=function(_0x5d8f15,_0x382d47){_0x5d8f15=_0x5d8f15-0x0;var _0x5a798e=_0xe8c0[_0x5d8f15];return _0x5a798e;};'use strict';var Sequelize=require(_0x0e8c('0x0'));module[_0x0e8c('0x1')]={'customer_id':{'type':Sequelize[_0x0e8c('0x2')]},'context':{'type':Sequelize[_0x0e8c('0x2')],'defaultValue':_0x0e8c('0x3'),'unique':'contest_mailbox'},'mailbox':{'type':Sequelize[_0x0e8c('0x2')],'defaultValue':'','allowNull':![],'unique':_0x0e8c('0x4')},'password':{'type':Sequelize['STRING']},'fullname':{'type':Sequelize[_0x0e8c('0x2')]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]},'set':function(_0x15571d){this[_0x0e8c('0x5')]('email',typeof _0x15571d===_0x0e8c('0x6')&&_0x15571d[_0x0e8c('0x7')]()?_0x15571d[_0x0e8c('0x7')]():null);}},'pager':{'type':Sequelize[_0x0e8c('0x2')]},'tz':{'type':Sequelize[_0x0e8c('0x2')],'defaultValue':_0x0e8c('0x8')},'attach':{'type':Sequelize['ENUM'](_0x0e8c('0x9'),'no'),'defaultValue':'yes','allowNull':![]},'saycid':{'type':Sequelize['ENUM'](_0x0e8c('0x9'),'no'),'defaultValue':_0x0e8c('0x9'),'allowNull':![]},'dialout':{'type':Sequelize[_0x0e8c('0x2')]},'callback':{'type':Sequelize[_0x0e8c('0x2')]},'review':{'type':Sequelize['ENUM'](_0x0e8c('0x9'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize['ENUM'](_0x0e8c('0x9'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x0e8c('0xa')](_0x0e8c('0x9'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x0e8c('0xa')](_0x0e8c('0x9'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':'TINYINT(4)','defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize['ENUM'](_0x0e8c('0x9'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x0e8c('0xa')]('yes','no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x0e8c('0xa')](_0x0e8c('0x9'),'no'),'defaultValue':_0x0e8c('0x9'),'allowNull':![]},'forcename':{'type':Sequelize[_0x0e8c('0xa')](_0x0e8c('0x9'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize['ENUM'](_0x0e8c('0x9'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x0e8c('0xa')](_0x0e8c('0x9'),'no'),'defaultValue':_0x0e8c('0x9'),'allowNull':![]},'stamp':{'type':_0x0e8c('0xb')},'emailsubject':{'type':Sequelize[_0x0e8c('0x2')]},'emailbody':{'type':Sequelize[_0x0e8c('0x2')]},'maxsecs':{'type':Sequelize[_0x0e8c('0xc')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x0e8c('0xc')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x0e8c('0xd')],'get':function(){return this[_0x0e8c('0xe')](_0x0e8c('0xf'))+_0x0e8c('0x10')+this['getDataValue'](_0x0e8c('0x11'));}}}; \ No newline at end of file +var _0x5edb=['INTEGER','getDataValue','fullname','\x20-\x20','mailbox','exports','STRING','from-voicemail','contest_mailbox','setDataValue','email','trim','central','yes','ENUM','TIMESTAMP'];(function(_0x246701,_0x45d903){var _0x2e3cde=function(_0x3c61bb){while(--_0x3c61bb){_0x246701['push'](_0x246701['shift']());}};_0x2e3cde(++_0x45d903);}(_0x5edb,0xb5));var _0xb5ed=function(_0x23f7f7,_0x1e4f85){_0x23f7f7=_0x23f7f7-0x0;var _0xfd12e0=_0x5edb[_0x23f7f7];return _0xfd12e0;};'use strict';var Sequelize=require('sequelize');module[_0xb5ed('0x0')]={'customer_id':{'type':Sequelize[_0xb5ed('0x1')]},'context':{'type':Sequelize[_0xb5ed('0x1')],'defaultValue':_0xb5ed('0x2'),'unique':_0xb5ed('0x3')},'mailbox':{'type':Sequelize[_0xb5ed('0x1')],'defaultValue':'','allowNull':![],'unique':_0xb5ed('0x3')},'password':{'type':Sequelize[_0xb5ed('0x1')]},'fullname':{'type':Sequelize[_0xb5ed('0x1')]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]},'set':function(_0x32d98c){this[_0xb5ed('0x4')](_0xb5ed('0x5'),typeof _0x32d98c==='string'&&_0x32d98c[_0xb5ed('0x6')]()?_0x32d98c[_0xb5ed('0x6')]():null);}},'pager':{'type':Sequelize[_0xb5ed('0x1')]},'tz':{'type':Sequelize['STRING'],'defaultValue':_0xb5ed('0x7')},'attach':{'type':Sequelize['ENUM'](_0xb5ed('0x8'),'no'),'defaultValue':_0xb5ed('0x8'),'allowNull':![]},'saycid':{'type':Sequelize[_0xb5ed('0x9')]('yes','no'),'defaultValue':_0xb5ed('0x8'),'allowNull':![]},'dialout':{'type':Sequelize[_0xb5ed('0x1')]},'callback':{'type':Sequelize[_0xb5ed('0x1')]},'review':{'type':Sequelize[_0xb5ed('0x9')]('yes','no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0xb5ed('0x9')]('yes','no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0xb5ed('0x9')](_0xb5ed('0x8'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0xb5ed('0x9')]('yes','no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':'TINYINT(4)','defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0xb5ed('0x9')](_0xb5ed('0x8'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize['ENUM'](_0xb5ed('0x8'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0xb5ed('0x9')]('yes','no'),'defaultValue':_0xb5ed('0x8'),'allowNull':![]},'forcename':{'type':Sequelize[_0xb5ed('0x9')]('yes','no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0xb5ed('0x9')](_0xb5ed('0x8'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0xb5ed('0x9')]('yes','no'),'defaultValue':_0xb5ed('0x8'),'allowNull':![]},'stamp':{'type':_0xb5ed('0xa')},'emailsubject':{'type':Sequelize['STRING']},'emailbody':{'type':Sequelize[_0xb5ed('0x1')]},'maxsecs':{'type':Sequelize[_0xb5ed('0xb')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0xb5ed('0xc')](_0xb5ed('0xd'))+_0xb5ed('0xe')+this[_0xb5ed('0xc')](_0xb5ed('0xf'));}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index c542cd2..d1a7e4f 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 _0x2f68=['desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','update','then','Voicemails','error','stack','name','send','index','VoiceMail','rawAttributes','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','rows','catch','show','params','find','create','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','body','destroy','getMessages','findOne','VoiceMailMessage','findAndCountAll','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','to-csv','ejs','squel'];(function(_0x5e548d,_0x5f4e1c){var _0x1d4390=function(_0x321854){while(--_0x321854){_0x5e548d['push'](_0x5e548d['shift']());}};_0x1d4390(++_0x5f4e1c);}(_0x2f68,0x9a));var _0x82f6=function(_0x120477,_0x2d0d39){_0x120477=_0x120477-0x0;var _0x1ec058=_0x2f68[_0x120477];return _0x1ec058;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x82f6('0x0'));var zipdir=require(_0x82f6('0x1'));var jsonpatch=require(_0x82f6('0x2'));var rp=require(_0x82f6('0x3'));var moment=require('moment');var BPromise=require(_0x82f6('0x4'));var Mustache=require('mustache');var util=require(_0x82f6('0x5'));var path=require(_0x82f6('0x6'));var sox=require('sox');var csv=require(_0x82f6('0x7'));var ejs=require(_0x82f6('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x82f6('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x82f6('0xa'));var toCsv=require(_0x82f6('0x7'));var querystring=require(_0x82f6('0xb'));var Papa=require('papaparse');var Redis=require(_0x82f6('0xc'));var authService=require(_0x82f6('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0x82f6('0xe'));var hardwareService=require(_0x82f6('0xf'));var logger=require(_0x82f6('0x10'))(_0x82f6('0x11'));var utils=require(_0x82f6('0x12'));var config=require(_0x82f6('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x82f6('0x14'))['db'];function respondWithStatusCode(_0x442262,_0x4cc967){_0x4cc967=_0x4cc967||0xcc;return function(_0x194da7){if(_0x194da7){return _0x442262[_0x82f6('0x15')](_0x4cc967);}return _0x442262[_0x82f6('0x16')](_0x4cc967)[_0x82f6('0x17')]();};}function respondWithResult(_0x371481,_0xa00275){_0xa00275=_0xa00275||0xc8;return function(_0x115c7b){if(_0x115c7b){return _0x371481[_0x82f6('0x16')](_0xa00275)[_0x82f6('0x18')](_0x115c7b);}};}function respondWithFilteredResult(_0x55b58e,_0x389949){return function(_0x5d0827){if(_0x5d0827){var _0x249222=typeof _0x389949[_0x82f6('0x19')]===_0x82f6('0x1a')&&typeof _0x389949[_0x82f6('0x1b')]===_0x82f6('0x1a');var _0x2326ae=_0x5d0827[_0x82f6('0x1c')];var _0xcbc95f=_0x249222?0x0:_0x389949[_0x82f6('0x19')];var _0x2bfd57=_0x249222?_0x5d0827[_0x82f6('0x1c')]:_0x389949[_0x82f6('0x19')]+_0x389949[_0x82f6('0x1b')];var _0x4fe226;if(_0x2bfd57>=_0x2326ae){_0x2bfd57=_0x2326ae;_0x4fe226=0xc8;}else{_0x4fe226=0xce;}_0x55b58e[_0x82f6('0x16')](_0x4fe226);return _0x55b58e['set'](_0x82f6('0x1d'),_0xcbc95f+'-'+_0x2bfd57+'/'+_0x2326ae)[_0x82f6('0x18')](_0x5d0827);}return null;};}function patchUpdates(_0x55cbce){return function(_0x2b03ad){try{jsonpatch[_0x82f6('0x1e')](_0x2b03ad,_0x55cbce,!![]);}catch(_0x46713a){return BPromise[_0x82f6('0x1f')](_0x46713a);}return _0x2b03ad['save']();};}function saveUpdates(_0xdc4dea,_0x4beccf){return function(_0x8668bb){if(_0x8668bb){return _0x8668bb[_0x82f6('0x20')](_0xdc4dea)['then'](function(_0x516deb){return _0x516deb;});}return null;};}function removeEntity(_0x3af5f7,_0x1d96d5){return function(_0x4c57c5){if(_0x4c57c5){return _0x4c57c5['destroy']()[_0x82f6('0x21')](function(){var _0x31face=_0x4c57c5['get']({'plain':!![]});var _0xfd8b68=_0x82f6('0x22');return db['UserProfileResource']['destroy']({'where':{'type':_0xfd8b68,'resourceId':_0x31face['id']}})[_0x82f6('0x21')](function(){return _0x4c57c5;});})['then'](function(){_0x3af5f7[_0x82f6('0x16')](0xcc)[_0x82f6('0x17')]();});}};}function handleEntityNotFound(_0x54ce11,_0x3795ef){return function(_0x15c9b7){if(!_0x15c9b7){_0x54ce11[_0x82f6('0x15')](0x194);}return _0x15c9b7;};}function handleError(_0x1125a0,_0x4f9fa4){_0x4f9fa4=_0x4f9fa4||0x1f4;return function(_0x40a071){logger[_0x82f6('0x23')](_0x40a071[_0x82f6('0x24')]);if(_0x40a071[_0x82f6('0x25')]){delete _0x40a071[_0x82f6('0x25')];}_0x1125a0[_0x82f6('0x16')](_0x4f9fa4)[_0x82f6('0x26')](_0x40a071);};}exports[_0x82f6('0x27')]=function(_0x1e1aa4,_0x402449){var _0x3c9419={},_0x20d1c5={},_0x6ce179={'count':0x0,'rows':[]};var _0x91117b=_['map'](db[_0x82f6('0x28')][_0x82f6('0x29')],function(_0x418f34){return{'name':_0x418f34['fieldName'],'type':_0x418f34[_0x82f6('0x2a')][_0x82f6('0x2b')]};});_0x20d1c5[_0x82f6('0x2c')]=_[_0x82f6('0x2d')](_0x91117b,_0x82f6('0x25'));_0x20d1c5[_0x82f6('0x2e')]=_[_0x82f6('0x2f')](_0x1e1aa4[_0x82f6('0x2e')]);_0x20d1c5[_0x82f6('0x30')]=_[_0x82f6('0x31')](_0x20d1c5[_0x82f6('0x2c')],_0x20d1c5[_0x82f6('0x2e')]);_0x3c9419[_0x82f6('0x32')]=_[_0x82f6('0x31')](_0x20d1c5['model'],qs[_0x82f6('0x33')](_0x1e1aa4[_0x82f6('0x2e')][_0x82f6('0x33')]));_0x3c9419[_0x82f6('0x32')]=_0x3c9419[_0x82f6('0x32')][_0x82f6('0x34')]?_0x3c9419[_0x82f6('0x32')]:_0x20d1c5[_0x82f6('0x2c')];if(!_0x1e1aa4[_0x82f6('0x2e')][_0x82f6('0x35')](_0x82f6('0x36'))){_0x3c9419[_0x82f6('0x1b')]=qs[_0x82f6('0x1b')](_0x1e1aa4[_0x82f6('0x2e')]['limit']);_0x3c9419[_0x82f6('0x19')]=qs['offset'](_0x1e1aa4['query'][_0x82f6('0x19')]);}_0x3c9419[_0x82f6('0x37')]=qs['sort'](_0x1e1aa4[_0x82f6('0x2e')][_0x82f6('0x38')]);_0x3c9419[_0x82f6('0x39')]=qs['filters'](_[_0x82f6('0x3a')](_0x1e1aa4['query'],_0x20d1c5[_0x82f6('0x30')]),_0x91117b);if(_0x1e1aa4['query'][_0x82f6('0x3b')]){_0x3c9419['where']=_[_0x82f6('0x3c')](_0x3c9419[_0x82f6('0x39')],{'$or':_['map'](_0x91117b,function(_0xfce1dd){if(_0xfce1dd[_0x82f6('0x2a')]!==_0x82f6('0x3d')){var _0x43dcd1={};_0x43dcd1[_0xfce1dd['name']]={'$like':'%'+_0x1e1aa4[_0x82f6('0x2e')][_0x82f6('0x3b')]+'%'};return _0x43dcd1;}})});}_0x3c9419=_[_0x82f6('0x3c')]({},_0x3c9419,_0x1e1aa4[_0x82f6('0x3e')]);var _0x55ecd4={'where':_0x3c9419[_0x82f6('0x39')]};return db[_0x82f6('0x28')]['count'](_0x55ecd4)[_0x82f6('0x21')](function(_0x699803){_0x6ce179[_0x82f6('0x1c')]=_0x699803;if(_0x1e1aa4[_0x82f6('0x2e')][_0x82f6('0x3f')]){_0x3c9419['include']=[{'all':!![]}];}return db[_0x82f6('0x28')]['findAll'](_0x3c9419);})[_0x82f6('0x21')](function(_0x38e82d){_0x6ce179[_0x82f6('0x40')]=_0x38e82d;return _0x6ce179;})[_0x82f6('0x21')](respondWithFilteredResult(_0x402449,_0x3c9419))[_0x82f6('0x41')](handleError(_0x402449,null));};exports[_0x82f6('0x42')]=function(_0x43fefc,_0x47a0d1){var _0x165493={'raw':!![],'where':{'id':_0x43fefc[_0x82f6('0x43')]['id']}},_0x297cda={};_0x297cda[_0x82f6('0x2c')]=_['keys'](db[_0x82f6('0x28')]['rawAttributes']);_0x297cda[_0x82f6('0x2e')]=_[_0x82f6('0x2f')](_0x43fefc[_0x82f6('0x2e')]);_0x297cda[_0x82f6('0x30')]=_[_0x82f6('0x31')](_0x297cda[_0x82f6('0x2c')],_0x297cda['query']);_0x165493[_0x82f6('0x32')]=_[_0x82f6('0x31')](_0x297cda[_0x82f6('0x2c')],qs[_0x82f6('0x33')](_0x43fefc[_0x82f6('0x2e')][_0x82f6('0x33')]));_0x165493[_0x82f6('0x32')]=_0x165493[_0x82f6('0x32')]['length']?_0x165493[_0x82f6('0x32')]:_0x297cda[_0x82f6('0x2c')];if(_0x43fefc['query'][_0x82f6('0x3f')]){_0x165493['include']=[{'all':!![]}];}_0x165493=_[_0x82f6('0x3c')]({},_0x165493,_0x43fefc['options']);return db[_0x82f6('0x28')][_0x82f6('0x44')](_0x165493)[_0x82f6('0x21')](handleEntityNotFound(_0x47a0d1,null))[_0x82f6('0x21')](respondWithResult(_0x47a0d1,null))[_0x82f6('0x41')](handleError(_0x47a0d1,null));};exports[_0x82f6('0x45')]=function(_0x53f7d4,_0x3cb1f0){return db[_0x82f6('0x28')]['create'](_0x53f7d4['body'],{})[_0x82f6('0x21')](function(_0x2a6366){var _0x2c2b64=_0x53f7d4['user'][_0x82f6('0x46')]({'plain':!![]});if(!_0x2c2b64)throw new Error(_0x82f6('0x47'));if(_0x2c2b64[_0x82f6('0x48')]===_0x82f6('0x49')){var _0x4e9e13=_0x2a6366['get']({'plain':!![]});var _0x1695ea=_0x82f6('0x22');return db[_0x82f6('0x4a')]['find']({'where':{'name':_0x1695ea,'userProfileId':_0x2c2b64[_0x82f6('0x4b')]},'raw':!![]})[_0x82f6('0x21')](function(_0x4bc646){if(_0x4bc646&&_0x4bc646['autoAssociation']===0x0){return db['UserProfileResource'][_0x82f6('0x45')]({'name':_0x4e9e13['name'],'resourceId':_0x4e9e13['id'],'type':_0x4bc646[_0x82f6('0x25')],'sectionId':_0x4bc646['id']},{})['then'](function(){return _0x2a6366;});}else{return _0x2a6366;}})[_0x82f6('0x41')](function(_0x4f69de){logger[_0x82f6('0x23')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4f69de);throw _0x4f69de;});}return _0x2a6366;})[_0x82f6('0x21')](respondWithResult(_0x3cb1f0,0xc9))[_0x82f6('0x41')](handleError(_0x3cb1f0,null));};exports[_0x82f6('0x20')]=function(_0x1633cf,_0xb8d7d8){if(_0x1633cf[_0x82f6('0x4c')]['id']){delete _0x1633cf['body']['id'];}return db[_0x82f6('0x28')][_0x82f6('0x44')]({'where':{'id':_0x1633cf[_0x82f6('0x43')]['id']}})['then'](handleEntityNotFound(_0xb8d7d8,null))['then'](saveUpdates(_0x1633cf[_0x82f6('0x4c')],null))[_0x82f6('0x21')](respondWithResult(_0xb8d7d8,null))[_0x82f6('0x41')](handleError(_0xb8d7d8,null));};exports[_0x82f6('0x4d')]=function(_0x49a204,_0x2c1c0e){return db[_0x82f6('0x28')][_0x82f6('0x44')]({'where':{'id':_0x49a204['params']['id']}})['then'](handleEntityNotFound(_0x2c1c0e,null))['then'](removeEntity(_0x2c1c0e,null))[_0x82f6('0x41')](handleError(_0x2c1c0e,null));};exports[_0x82f6('0x4e')]=function(_0x221cfc,_0x59176d,_0x4013f0){return db[_0x82f6('0x28')][_0x82f6('0x4f')]({'where':{'id':_0x221cfc[_0x82f6('0x43')]['id']}})['then'](handleEntityNotFound(_0x59176d,null))[_0x82f6('0x21')](function(_0x94aed4){var _0x12a5b9;var _0x33591b={},_0x4a8bdb={};_0x4a8bdb['model']=_[_0x82f6('0x2f')](db[_0x82f6('0x50')]['rawAttributes']);_0x4a8bdb[_0x82f6('0x2e')]=_[_0x82f6('0x2f')](_0x221cfc[_0x82f6('0x2e')]);_0x4a8bdb['filters']=_[_0x82f6('0x31')](_0x4a8bdb[_0x82f6('0x2c')],_0x4a8bdb[_0x82f6('0x2e')]);_0x33591b[_0x82f6('0x32')]=_[_0x82f6('0x31')](_0x4a8bdb[_0x82f6('0x2c')],qs['fields'](_0x221cfc[_0x82f6('0x2e')][_0x82f6('0x33')]));_0x33591b[_0x82f6('0x32')]=_0x33591b[_0x82f6('0x32')][_0x82f6('0x34')]?_0x33591b['attributes']:_0x4a8bdb[_0x82f6('0x2c')];if(!_0x221cfc[_0x82f6('0x2e')][_0x82f6('0x35')](_0x82f6('0x36'))){_0x33591b[_0x82f6('0x1b')]=qs[_0x82f6('0x1b')](_0x221cfc[_0x82f6('0x2e')][_0x82f6('0x1b')]);_0x33591b['offset']=qs[_0x82f6('0x19')](_0x221cfc['query'][_0x82f6('0x19')]);}_0x33591b[_0x82f6('0x37')]=qs['sort'](_0x221cfc[_0x82f6('0x2e')][_0x82f6('0x38')]);_0x33591b[_0x82f6('0x39')]=qs['filters'](_['pick'](_0x221cfc[_0x82f6('0x2e')],_0x4a8bdb[_0x82f6('0x30')]));if(_0x221cfc['query']['filter']){_0x33591b[_0x82f6('0x39')]=_[_0x82f6('0x3c')](_0x33591b[_0x82f6('0x39')],{'$or':_[_0x82f6('0x2d')](_0x33591b[_0x82f6('0x32')],function(_0x11581c){var _0xc1d784={};_0xc1d784[_0x11581c]={'$like':'%'+_0x221cfc[_0x82f6('0x2e')][_0x82f6('0x3b')]+'%'};return _0xc1d784;})});}_0x33591b[_0x82f6('0x39')]=_[_0x82f6('0x3c')](_0x33591b[_0x82f6('0x39')],{'mailboxuser':_0x94aed4['mailbox']});_0x33591b=_[_0x82f6('0x3c')]({},_0x33591b,_0x221cfc[_0x82f6('0x3e')]);return db[_0x82f6('0x50')][_0x82f6('0x51')](_0x33591b)[_0x82f6('0x21')](respondWithFilteredResult(_0x59176d,_0x33591b));})['catch'](handleError(_0x59176d,null));}; \ No newline at end of file +var _0x91a7=['status','json','offset','undefined','count','set','Content-Range','apply','save','update','then','destroy','get','Voicemails','error','stack','name','send','index','map','VoiceMail','rawAttributes','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','filter','merge','includeAll','catch','show','params','include','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','body','getMessages','findOne','VoiceMailMessage','order','mailbox','options','findAndCountAll','rimraf','zip-dir','fast-json-patch','moment','mustache','sox','to-csv','fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end'];(function(_0x1ca9eb,_0x99a10b){var _0x2e284e=function(_0x1196a4){while(--_0x1196a4){_0x1ca9eb['push'](_0x1ca9eb['shift']());}};_0x2e284e(++_0x99a10b);}(_0x91a7,0xe7));var _0x791a=function(_0x36650f,_0x233480){_0x36650f=_0x36650f-0x0;var _0x4ca8bf=_0x91a7[_0x36650f];return _0x4ca8bf;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x791a('0x0'));var zipdir=require(_0x791a('0x1'));var jsonpatch=require(_0x791a('0x2'));var rp=require('request-promise');var moment=require(_0x791a('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x791a('0x4'));var util=require('util');var path=require('path');var sox=require(_0x791a('0x5'));var csv=require(_0x791a('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x791a('0x7'));var _=require('lodash');var squel=require(_0x791a('0x8'));var crypto=require(_0x791a('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x791a('0xa'));var toCsv=require(_0x791a('0x6'));var querystring=require(_0x791a('0xb'));var Papa=require(_0x791a('0xc'));var Redis=require(_0x791a('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x791a('0xe'));var as=require(_0x791a('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x791a('0x10'))(_0x791a('0x11'));var utils=require(_0x791a('0x12'));var config=require(_0x791a('0x13'));var licenseUtil=require(_0x791a('0x14'));var db=require(_0x791a('0x15'))['db'];function respondWithStatusCode(_0x53dc41,_0x5daecd){_0x5daecd=_0x5daecd||0xcc;return function(_0xc92016){if(_0xc92016){return _0x53dc41[_0x791a('0x16')](_0x5daecd);}return _0x53dc41['status'](_0x5daecd)[_0x791a('0x17')]();};}function respondWithResult(_0x3a2ec6,_0x5d5b11){_0x5d5b11=_0x5d5b11||0xc8;return function(_0x2887f0){if(_0x2887f0){return _0x3a2ec6[_0x791a('0x18')](_0x5d5b11)[_0x791a('0x19')](_0x2887f0);}};}function respondWithFilteredResult(_0x5cdf2,_0x55e845){return function(_0x2ce2e0){if(_0x2ce2e0){var _0x575d11=typeof _0x55e845[_0x791a('0x1a')]===_0x791a('0x1b')&&typeof _0x55e845['limit']===_0x791a('0x1b');var _0x5bea2e=_0x2ce2e0[_0x791a('0x1c')];var _0x52941d=_0x575d11?0x0:_0x55e845['offset'];var _0x588d00=_0x575d11?_0x2ce2e0[_0x791a('0x1c')]:_0x55e845['offset']+_0x55e845['limit'];var _0x39c60b;if(_0x588d00>=_0x5bea2e){_0x588d00=_0x5bea2e;_0x39c60b=0xc8;}else{_0x39c60b=0xce;}_0x5cdf2[_0x791a('0x18')](_0x39c60b);return _0x5cdf2[_0x791a('0x1d')](_0x791a('0x1e'),_0x52941d+'-'+_0x588d00+'/'+_0x5bea2e)['json'](_0x2ce2e0);}return null;};}function patchUpdates(_0x189c0d){return function(_0xcb5e66){try{jsonpatch[_0x791a('0x1f')](_0xcb5e66,_0x189c0d,!![]);}catch(_0x280f1e){return BPromise['reject'](_0x280f1e);}return _0xcb5e66[_0x791a('0x20')]();};}function saveUpdates(_0x2054c6,_0x25bae5){return function(_0x9e17b5){if(_0x9e17b5){return _0x9e17b5[_0x791a('0x21')](_0x2054c6)[_0x791a('0x22')](function(_0x2241a0){return _0x2241a0;});}return null;};}function removeEntity(_0x45a67d,_0x323c6a){return function(_0xe8e452){if(_0xe8e452){return _0xe8e452[_0x791a('0x23')]()['then'](function(){var _0x1102c9=_0xe8e452[_0x791a('0x24')]({'plain':!![]});var _0x380329=_0x791a('0x25');return db['UserProfileResource'][_0x791a('0x23')]({'where':{'type':_0x380329,'resourceId':_0x1102c9['id']}})[_0x791a('0x22')](function(){return _0xe8e452;});})['then'](function(){_0x45a67d[_0x791a('0x18')](0xcc)[_0x791a('0x17')]();});}};}function handleEntityNotFound(_0x16dbaf,_0x4c1626){return function(_0x29194d){if(!_0x29194d){_0x16dbaf[_0x791a('0x16')](0x194);}return _0x29194d;};}function handleError(_0x2b0784,_0x395376){_0x395376=_0x395376||0x1f4;return function(_0x4f423){logger[_0x791a('0x26')](_0x4f423[_0x791a('0x27')]);if(_0x4f423[_0x791a('0x28')]){delete _0x4f423['name'];}_0x2b0784[_0x791a('0x18')](_0x395376)[_0x791a('0x29')](_0x4f423);};}exports[_0x791a('0x2a')]=function(_0x59d2c0,_0x1cdda9){var _0x5df656={},_0xc59f5e={},_0x2e4ec8={'count':0x0,'rows':[]};var _0xcde862=_[_0x791a('0x2b')](db[_0x791a('0x2c')][_0x791a('0x2d')],function(_0x15ff6e){return{'name':_0x15ff6e['fieldName'],'type':_0x15ff6e[_0x791a('0x2e')][_0x791a('0x2f')]};});_0xc59f5e[_0x791a('0x30')]=_[_0x791a('0x2b')](_0xcde862,_0x791a('0x28'));_0xc59f5e['query']=_[_0x791a('0x31')](_0x59d2c0[_0x791a('0x32')]);_0xc59f5e[_0x791a('0x33')]=_[_0x791a('0x34')](_0xc59f5e[_0x791a('0x30')],_0xc59f5e['query']);_0x5df656[_0x791a('0x35')]=_[_0x791a('0x34')](_0xc59f5e[_0x791a('0x30')],qs[_0x791a('0x36')](_0x59d2c0[_0x791a('0x32')]['fields']));_0x5df656[_0x791a('0x35')]=_0x5df656['attributes'][_0x791a('0x37')]?_0x5df656['attributes']:_0xc59f5e['model'];if(!_0x59d2c0[_0x791a('0x32')][_0x791a('0x38')](_0x791a('0x39'))){_0x5df656[_0x791a('0x3a')]=qs[_0x791a('0x3a')](_0x59d2c0[_0x791a('0x32')][_0x791a('0x3a')]);_0x5df656['offset']=qs[_0x791a('0x1a')](_0x59d2c0['query'][_0x791a('0x1a')]);}_0x5df656['order']=qs[_0x791a('0x3b')](_0x59d2c0[_0x791a('0x32')]['sort']);_0x5df656[_0x791a('0x3c')]=qs[_0x791a('0x33')](_['pick'](_0x59d2c0[_0x791a('0x32')],_0xc59f5e[_0x791a('0x33')]),_0xcde862);if(_0x59d2c0[_0x791a('0x32')][_0x791a('0x3d')]){_0x5df656[_0x791a('0x3c')]=_[_0x791a('0x3e')](_0x5df656[_0x791a('0x3c')],{'$or':_[_0x791a('0x2b')](_0xcde862,function(_0xc0fb63){if(_0xc0fb63[_0x791a('0x2e')]!=='VIRTUAL'){var _0x15f066={};_0x15f066[_0xc0fb63[_0x791a('0x28')]]={'$like':'%'+_0x59d2c0[_0x791a('0x32')]['filter']+'%'};return _0x15f066;}})});}_0x5df656=_[_0x791a('0x3e')]({},_0x5df656,_0x59d2c0['options']);var _0x5bad7d={'where':_0x5df656['where']};return db[_0x791a('0x2c')][_0x791a('0x1c')](_0x5bad7d)['then'](function(_0x415c44){_0x2e4ec8[_0x791a('0x1c')]=_0x415c44;if(_0x59d2c0[_0x791a('0x32')][_0x791a('0x3f')]){_0x5df656['include']=[{'all':!![]}];}return db['VoiceMail']['findAll'](_0x5df656);})[_0x791a('0x22')](function(_0x216dd3){_0x2e4ec8['rows']=_0x216dd3;return _0x2e4ec8;})[_0x791a('0x22')](respondWithFilteredResult(_0x1cdda9,_0x5df656))[_0x791a('0x40')](handleError(_0x1cdda9,null));};exports[_0x791a('0x41')]=function(_0x954164,_0x508727){var _0x11263d={'raw':!![],'where':{'id':_0x954164[_0x791a('0x42')]['id']}},_0x5911db={};_0x5911db[_0x791a('0x30')]=_[_0x791a('0x31')](db[_0x791a('0x2c')][_0x791a('0x2d')]);_0x5911db['query']=_[_0x791a('0x31')](_0x954164[_0x791a('0x32')]);_0x5911db[_0x791a('0x33')]=_[_0x791a('0x34')](_0x5911db[_0x791a('0x30')],_0x5911db['query']);_0x11263d[_0x791a('0x35')]=_[_0x791a('0x34')](_0x5911db['model'],qs['fields'](_0x954164[_0x791a('0x32')][_0x791a('0x36')]));_0x11263d[_0x791a('0x35')]=_0x11263d['attributes']['length']?_0x11263d[_0x791a('0x35')]:_0x5911db[_0x791a('0x30')];if(_0x954164['query'][_0x791a('0x3f')]){_0x11263d[_0x791a('0x43')]=[{'all':!![]}];}_0x11263d=_[_0x791a('0x3e')]({},_0x11263d,_0x954164['options']);return db['VoiceMail'][_0x791a('0x44')](_0x11263d)[_0x791a('0x22')](handleEntityNotFound(_0x508727,null))[_0x791a('0x22')](respondWithResult(_0x508727,null))[_0x791a('0x40')](handleError(_0x508727,null));};exports['create']=function(_0x2d7c7d,_0x9f768a){return db[_0x791a('0x2c')][_0x791a('0x45')](_0x2d7c7d['body'],{})[_0x791a('0x22')](function(_0x19654d){var _0xe0696b=_0x2d7c7d[_0x791a('0x46')][_0x791a('0x24')]({'plain':!![]});if(!_0xe0696b)throw new Error(_0x791a('0x47'));if(_0xe0696b[_0x791a('0x48')]==='user'){var _0xdcb1b=_0x19654d[_0x791a('0x24')]({'plain':!![]});var _0x4bffa6=_0x791a('0x25');return db[_0x791a('0x49')]['find']({'where':{'name':_0x4bffa6,'userProfileId':_0xe0696b[_0x791a('0x4a')]},'raw':!![]})[_0x791a('0x22')](function(_0x12178e){if(_0x12178e&&_0x12178e[_0x791a('0x4b')]===0x0){return db[_0x791a('0x4c')]['create']({'name':_0xdcb1b['name'],'resourceId':_0xdcb1b['id'],'type':_0x12178e['name'],'sectionId':_0x12178e['id']},{})[_0x791a('0x22')](function(){return _0x19654d;});}else{return _0x19654d;}})['catch'](function(_0x4c7555){logger[_0x791a('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4c7555);throw _0x4c7555;});}return _0x19654d;})[_0x791a('0x22')](respondWithResult(_0x9f768a,0xc9))[_0x791a('0x40')](handleError(_0x9f768a,null));};exports['update']=function(_0x5166b5,_0x3599f6){if(_0x5166b5['body']['id']){delete _0x5166b5[_0x791a('0x4d')]['id'];}return db[_0x791a('0x2c')][_0x791a('0x44')]({'where':{'id':_0x5166b5['params']['id']}})[_0x791a('0x22')](handleEntityNotFound(_0x3599f6,null))[_0x791a('0x22')](saveUpdates(_0x5166b5['body'],null))[_0x791a('0x22')](respondWithResult(_0x3599f6,null))[_0x791a('0x40')](handleError(_0x3599f6,null));};exports[_0x791a('0x23')]=function(_0x34d53c,_0x450ad8){return db[_0x791a('0x2c')]['find']({'where':{'id':_0x34d53c['params']['id']}})[_0x791a('0x22')](handleEntityNotFound(_0x450ad8,null))['then'](removeEntity(_0x450ad8,null))[_0x791a('0x40')](handleError(_0x450ad8,null));};exports[_0x791a('0x4e')]=function(_0x18ad89,_0xf11dea,_0x3b760c){return db[_0x791a('0x2c')][_0x791a('0x4f')]({'where':{'id':_0x18ad89['params']['id']}})[_0x791a('0x22')](handleEntityNotFound(_0xf11dea,null))[_0x791a('0x22')](function(_0xc34c5b){var _0x1a4376;var _0x2d671f={},_0xe062f1={};_0xe062f1[_0x791a('0x30')]=_['keys'](db[_0x791a('0x50')]['rawAttributes']);_0xe062f1['query']=_[_0x791a('0x31')](_0x18ad89[_0x791a('0x32')]);_0xe062f1[_0x791a('0x33')]=_[_0x791a('0x34')](_0xe062f1[_0x791a('0x30')],_0xe062f1[_0x791a('0x32')]);_0x2d671f[_0x791a('0x35')]=_[_0x791a('0x34')](_0xe062f1[_0x791a('0x30')],qs[_0x791a('0x36')](_0x18ad89[_0x791a('0x32')][_0x791a('0x36')]));_0x2d671f[_0x791a('0x35')]=_0x2d671f[_0x791a('0x35')][_0x791a('0x37')]?_0x2d671f[_0x791a('0x35')]:_0xe062f1[_0x791a('0x30')];if(!_0x18ad89[_0x791a('0x32')][_0x791a('0x38')](_0x791a('0x39'))){_0x2d671f['limit']=qs[_0x791a('0x3a')](_0x18ad89[_0x791a('0x32')][_0x791a('0x3a')]);_0x2d671f[_0x791a('0x1a')]=qs[_0x791a('0x1a')](_0x18ad89['query'][_0x791a('0x1a')]);}_0x2d671f[_0x791a('0x51')]=qs[_0x791a('0x3b')](_0x18ad89[_0x791a('0x32')]['sort']);_0x2d671f[_0x791a('0x3c')]=qs['filters'](_['pick'](_0x18ad89['query'],_0xe062f1['filters']));if(_0x18ad89[_0x791a('0x32')][_0x791a('0x3d')]){_0x2d671f[_0x791a('0x3c')]=_[_0x791a('0x3e')](_0x2d671f[_0x791a('0x3c')],{'$or':_[_0x791a('0x2b')](_0x2d671f[_0x791a('0x35')],function(_0x5dca78){var _0x522cb8={};_0x522cb8[_0x5dca78]={'$like':'%'+_0x18ad89[_0x791a('0x32')][_0x791a('0x3d')]+'%'};return _0x522cb8;})});}_0x2d671f['where']=_['merge'](_0x2d671f[_0x791a('0x3c')],{'mailboxuser':_0xc34c5b[_0x791a('0x52')]});_0x2d671f=_['merge']({},_0x2d671f,_0x18ad89[_0x791a('0x53')]);return db[_0x791a('0x50')][_0x791a('0x54')](_0x2d671f)[_0x791a('0x22')](respondWithFilteredResult(_0xf11dea,_0x2d671f));})['catch'](handleError(_0xf11dea,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index d1e3a99..9599dc8 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 _0x5821=['context','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./voiceMail.attributes','exports','VoiceMail','voice_voicemail','mailbox_context','mailbox'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5821,0x14b));var _0x1582=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x5821[_0x501510];return _0x1e6ee5;};'use strict';var _=require('lodash');var util=require(_0x1582('0x0'));var logger=require(_0x1582('0x1'))(_0x1582('0x2'));var moment=require(_0x1582('0x3'));var BPromise=require(_0x1582('0x4'));var rp=require(_0x1582('0x5'));var fs=require('fs');var path=require(_0x1582('0x6'));var rimraf=require('rimraf');var config=require(_0x1582('0x7'));var attributes=require(_0x1582('0x8'));module[_0x1582('0x9')]=function(_0x7058e4,_0x584655){return _0x7058e4['define'](_0x1582('0xa'),attributes,{'tableName':_0x1582('0xb'),'paranoid':![],'indexes':[{'name':_0x1582('0xc'),'fields':[_0x1582('0xd'),_0x1582('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x26ed=['../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','VoiceMail','voice_voicemail','mailbox_context','mailbox','context','lodash','util'];(function(_0x178f52,_0x5d9675){var _0x556f99=function(_0x4a7b17){while(--_0x4a7b17){_0x178f52['push'](_0x178f52['shift']());}};_0x556f99(++_0x5d9675);}(_0x26ed,0x193));var _0xd26e=function(_0x1b02bb,_0x3d9fde){_0x1b02bb=_0x1b02bb-0x0;var _0x131245=_0x26ed[_0x1b02bb];return _0x131245;};'use strict';var _=require(_0xd26e('0x0'));var util=require(_0xd26e('0x1'));var logger=require(_0xd26e('0x2'))('api');var moment=require(_0xd26e('0x3'));var BPromise=require(_0xd26e('0x4'));var rp=require(_0xd26e('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd26e('0x6'));var config=require(_0xd26e('0x7'));var attributes=require('./voiceMail.attributes');module[_0xd26e('0x8')]=function(_0x2acda4,_0x5052b6){return _0x2acda4[_0xd26e('0x9')](_0xd26e('0xa'),attributes,{'tableName':_0xd26e('0xb'),'paranoid':![],'indexes':[{'name':_0xd26e('0xc'),'fields':[_0xd26e('0xd'),_0xd26e('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.rpc.js b/server/api/voiceMail/voiceMail.rpc.js index d77f3b7..24d0c5d 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 _0x3736=['error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','info','VoiceMail,\x20%s,\x20%s','request\x20sent','debug','VoiceMail,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x422065,_0x5b1aa9){var _0x39eada=function(_0x1e30e9){while(--_0x1e30e9){_0x422065['push'](_0x422065['shift']());}};_0x39eada(++_0x5b1aa9);}(_0x3736,0xdd));var _0x6373=function(_0x5e80be,_0x20d699){_0x5e80be=_0x5e80be-0x0;var _0x5e8ade=_0x3736[_0x5e80be];return _0x5e8ade;};'use strict';var _=require(_0x6373('0x0'));var util=require(_0x6373('0x1'));var moment=require('moment');var BPromise=require(_0x6373('0x2'));var rs=require(_0x6373('0x3'));var fs=require('fs');var Redis=require(_0x6373('0x4'));var db=require(_0x6373('0x5'))['db'];var utils=require(_0x6373('0x6'));var logger=require(_0x6373('0x7'))(_0x6373('0x8'));var config=require('../../config/environment');var jayson=require(_0x6373('0x9'));var client=jayson[_0x6373('0xa')][_0x6373('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x565ae4,_0x5b8d0a,_0x2fd8d0){return new BPromise(function(_0x3c4788,_0x25a729){return client[_0x6373('0xc')](_0x565ae4,_0x2fd8d0)['then'](function(_0x4e6b9c){logger[_0x6373('0xd')](_0x6373('0xe'),_0x5b8d0a,_0x6373('0xf'));logger[_0x6373('0x10')](_0x6373('0x11'),_0x5b8d0a,_0x6373('0xf'),JSON[_0x6373('0x12')](_0x4e6b9c));if(_0x4e6b9c[_0x6373('0x13')]){if(_0x4e6b9c[_0x6373('0x13')][_0x6373('0x14')]===0x1f4){logger['error'](_0x6373('0xe'),_0x5b8d0a,_0x4e6b9c[_0x6373('0x13')][_0x6373('0x15')]);return _0x25a729(_0x4e6b9c['error'][_0x6373('0x15')]);}logger['error'](_0x6373('0xe'),_0x5b8d0a,_0x4e6b9c['error'][_0x6373('0x15')]);return _0x3c4788(_0x4e6b9c[_0x6373('0x13')][_0x6373('0x15')]);}else{logger[_0x6373('0xd')]('VoiceMail,\x20%s,\x20%s',_0x5b8d0a,_0x6373('0xf'));_0x3c4788(_0x4e6b9c[_0x6373('0x16')][_0x6373('0x15')]);}})[_0x6373('0x17')](function(_0x21be7a){logger[_0x6373('0x13')](_0x6373('0xe'),_0x5b8d0a,_0x21be7a);_0x25a729(_0x21be7a);});});} \ No newline at end of file +var _0x929c=['request\x20sent','debug','stringify','error','code','message','VoiceMail,\x20%s,\x20%s','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','info'];(function(_0x2576d7,_0x167624){var _0x16a08c=function(_0x19de1e){while(--_0x19de1e){_0x2576d7['push'](_0x2576d7['shift']());}};_0x16a08c(++_0x167624);}(_0x929c,0x193));var _0xc929=function(_0x45a2c2,_0x308ce6){_0x45a2c2=_0x45a2c2-0x0;var _0x36d360=_0x929c[_0x45a2c2];return _0x36d360;};'use strict';var _=require('lodash');var util=require(_0xc929('0x0'));var moment=require(_0xc929('0x1'));var BPromise=require(_0xc929('0x2'));var rs=require(_0xc929('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc929('0x4'))['db'];var utils=require(_0xc929('0x5'));var logger=require(_0xc929('0x6'))('rpc');var config=require(_0xc929('0x7'));var jayson=require(_0xc929('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2fae73,_0x2a2361,_0x4c62a5){return new BPromise(function(_0x1c734e,_0x45b713){return client[_0xc929('0x9')](_0x2fae73,_0x4c62a5)['then'](function(_0xdbdaf9){logger[_0xc929('0xa')]('VoiceMail,\x20%s,\x20%s',_0x2a2361,_0xc929('0xb'));logger[_0xc929('0xc')]('VoiceMail,\x20%s,\x20%s,\x20%s',_0x2a2361,_0xc929('0xb'),JSON[_0xc929('0xd')](_0xdbdaf9));if(_0xdbdaf9[_0xc929('0xe')]){if(_0xdbdaf9['error'][_0xc929('0xf')]===0x1f4){logger[_0xc929('0xe')]('VoiceMail,\x20%s,\x20%s',_0x2a2361,_0xdbdaf9[_0xc929('0xe')][_0xc929('0x10')]);return _0x45b713(_0xdbdaf9['error'][_0xc929('0x10')]);}logger['error'](_0xc929('0x11'),_0x2a2361,_0xdbdaf9[_0xc929('0xe')][_0xc929('0x10')]);return _0x1c734e(_0xdbdaf9[_0xc929('0xe')]['message']);}else{logger['info'](_0xc929('0x11'),_0x2a2361,_0xc929('0xb'));_0x1c734e(_0xdbdaf9['result']['message']);}})['catch'](function(_0x4c3835){logger['error'](_0xc929('0x11'),_0x2a2361,_0x4c3835);_0x45b713(_0x4c3835);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index d6ec6c3..0a190c7 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 _0x3c21=['connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','/:id/download','download','post','create','put','update','delete','destroy','exports','multer','util','path'];(function(_0x302f26,_0x1ad303){var _0x2a09ef=function(_0x17f035){while(--_0x17f035){_0x302f26['push'](_0x302f26['shift']());}};_0x2a09ef(++_0x1ad303);}(_0x3c21,0x177));var _0x13c2=function(_0x24a051,_0x4e6169){_0x24a051=_0x24a051-0x0;var _0x5acb0f=_0x3c21[_0x24a051];return _0x5acb0f;};'use strict';var multer=require(_0x13c2('0x0'));var util=require(_0x13c2('0x1'));var path=require(_0x13c2('0x2'));var timeout=require(_0x13c2('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x13c2('0x4'));var auth=require(_0x13c2('0x5'));var interaction=require(_0x13c2('0x6'));var config=require(_0x13c2('0x7'));var controller=require('./voiceMailMessage.controller');router[_0x13c2('0x8')]('/',auth[_0x13c2('0x9')](),controller[_0x13c2('0xa')]);router['get'](_0x13c2('0xb'),auth[_0x13c2('0x9')](),controller['show']);router[_0x13c2('0x8')](_0x13c2('0xc'),auth[_0x13c2('0x9')](),controller[_0x13c2('0xd')]);router[_0x13c2('0xe')]('/',auth[_0x13c2('0x9')](),controller[_0x13c2('0xf')]);router[_0x13c2('0x10')](_0x13c2('0xb'),auth[_0x13c2('0x9')](),controller[_0x13c2('0x11')]);router[_0x13c2('0x12')](_0x13c2('0xb'),auth[_0x13c2('0x9')](),controller[_0x13c2('0x13')]);module[_0x13c2('0x14')]=router; \ No newline at end of file +var _0xddef=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','isAuthenticated','show','/:id/download','download','post','create','put','update','delete','/:id','destroy','multer','path'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xddef,0x1cc));var _0xfdde=function(_0x35b08a,_0xd824d1){_0x35b08a=_0x35b08a-0x0;var _0x20bc1a=_0xddef[_0x35b08a];return _0x20bc1a;};'use strict';var multer=require(_0xfdde('0x0'));var util=require('util');var path=require(_0xfdde('0x1'));var timeout=require(_0xfdde('0x2'));var express=require(_0xfdde('0x3'));var router=express[_0xfdde('0x4')]();var fs_extra=require(_0xfdde('0x5'));var auth=require(_0xfdde('0x6'));var interaction=require(_0xfdde('0x7'));var config=require(_0xfdde('0x8'));var controller=require('./voiceMailMessage.controller');router[_0xfdde('0x9')]('/',auth['isAuthenticated'](),controller[_0xfdde('0xa')]);router[_0xfdde('0x9')]('/:id',auth[_0xfdde('0xb')](),controller[_0xfdde('0xc')]);router[_0xfdde('0x9')](_0xfdde('0xd'),auth[_0xfdde('0xb')](),controller[_0xfdde('0xe')]);router[_0xfdde('0xf')]('/',auth[_0xfdde('0xb')](),controller[_0xfdde('0x10')]);router[_0xfdde('0x11')]('/:id',auth['isAuthenticated'](),controller[_0xfdde('0x12')]);router[_0xfdde('0x13')](_0xfdde('0x14'),auth[_0xfdde('0xb')](),controller[_0xfdde('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index 344d0f4..b56610b 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 _0x1cb2=['long','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','exports','getDataValue','INTEGER','STRING','BLOB'];(function(_0x54eab6,_0x5e262f){var _0x1e7435=function(_0x468c91){while(--_0x468c91){_0x54eab6['push'](_0x54eab6['shift']());}};_0x1e7435(++_0x5e262f);}(_0x1cb2,0x1e5));var _0x21cb=function(_0x119280,_0x439c3e){_0x119280=_0x119280-0x0;var _0x481797=_0x1cb2[_0x119280];return _0x481797;};'use strict';var Sequelize=require('sequelize');module[_0x21cb('0x0')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x281525){return this[_0x21cb('0x1')]('id');}},'msgnum':{'type':Sequelize[_0x21cb('0x2')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0x21cb('0x3')],'defaultValue':''},'context':{'type':Sequelize[_0x21cb('0x3')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0x21cb('0x3')],'defaultValue':''},'callerid':{'type':Sequelize['STRING'],'defaultValue':''},'origtime':{'type':Sequelize['STRING'],'defaultValue':''},'duration':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0x21cb('0x3')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0x21cb('0x3')],'defaultValue':''},'recording':{'type':Sequelize[_0x21cb('0x4')](_0x21cb('0x5')),'defaultValue':null},'flag':{'type':Sequelize[_0x21cb('0x3')],'defaultValue':''},'msg_id':{'type':Sequelize[_0x21cb('0x3')],'defaultValue':''},'stamp':{'type':'TIMESTAMP','defaultValue':Sequelize['literal'](_0x21cb('0x6'))}}; \ No newline at end of file +var _0xe74b=['INTEGER','STRING','BLOB','long','TIMESTAMP','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','VIRTUAL','getDataValue'];(function(_0x382c73,_0x199cab){var _0x1dd0bf=function(_0x358747){while(--_0x358747){_0x382c73['push'](_0x382c73['shift']());}};_0x1dd0bf(++_0x199cab);}(_0xe74b,0xd6));var _0xbe74=function(_0x40b32e,_0x1aa3ec){_0x40b32e=_0x40b32e-0x0;var _0xf51c48=_0xe74b[_0x40b32e];return _0xf51c48;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xbe74('0x0')],'get':function(_0x505a1f){return this[_0xbe74('0x1')]('id');}},'msgnum':{'type':Sequelize[_0xbe74('0x2')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize['STRING'],'defaultValue':''},'context':{'type':Sequelize[_0xbe74('0x3')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0xbe74('0x3')],'defaultValue':''},'callerid':{'type':Sequelize['STRING'],'defaultValue':''},'origtime':{'type':Sequelize[_0xbe74('0x3')],'defaultValue':''},'duration':{'type':Sequelize[_0xbe74('0x3')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0xbe74('0x3')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0xbe74('0x3')],'defaultValue':''},'recording':{'type':Sequelize[_0xbe74('0x4')](_0xbe74('0x5')),'defaultValue':null},'flag':{'type':Sequelize['STRING'],'defaultValue':''},'msg_id':{'type':Sequelize[_0xbe74('0x3')],'defaultValue':''},'stamp':{'type':_0xbe74('0x6'),'defaultValue':Sequelize[_0xbe74('0x7')](_0xbe74('0x8'))}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index f217655..290452b 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 _0x7dfa=['type','key','model','query','keys','intersection','attributes','fields','length','limit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','VoiceMailMessage','findAll','rows','catch','show','params','find','create','body','download','msg_id','recording','ValidationError','VoiceMailMessage\x20not\x20found','attachment','attachment;\x20filename=\x22','.wav\x22','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','apply','reject','update','then','destroy','error','stack','name','send','index','map','rawAttributes'];(function(_0x350fd7,_0x57eb45){var _0x10be78=function(_0x38e630){while(--_0x38e630){_0x350fd7['push'](_0x350fd7['shift']());}};_0x10be78(++_0x57eb45);}(_0x7dfa,0x176));var _0xa7df=function(_0xfedc72,_0x292f02){_0xfedc72=_0xfedc72-0x0;var _0x2c7c78=_0x7dfa[_0xfedc72];return _0x2c7c78;};'use strict';var emlformat=require(_0xa7df('0x0'));var rimraf=require(_0xa7df('0x1'));var zipdir=require(_0xa7df('0x2'));var jsonpatch=require(_0xa7df('0x3'));var rp=require(_0xa7df('0x4'));var moment=require(_0xa7df('0x5'));var BPromise=require(_0xa7df('0x6'));var Mustache=require(_0xa7df('0x7'));var util=require(_0xa7df('0x8'));var path=require('path');var sox=require(_0xa7df('0x9'));var csv=require(_0xa7df('0xa'));var ejs=require(_0xa7df('0xb'));var fs=require('fs');var fs_extra=require(_0xa7df('0xc'));var _=require(_0xa7df('0xd'));var squel=require('squel');var crypto=require(_0xa7df('0xe'));var jsforce=require(_0xa7df('0xf'));var deskjs=require(_0xa7df('0x10'));var toCsv=require(_0xa7df('0xa'));var querystring=require('querystring');var Papa=require(_0xa7df('0x11'));var Redis=require('ioredis');var authService=require(_0xa7df('0x12'));var qs=require(_0xa7df('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa7df('0x14'));var logger=require(_0xa7df('0x15'))(_0xa7df('0x16'));var utils=require(_0xa7df('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xa7df('0x18'));var db=require(_0xa7df('0x19'))['db'];function respondWithStatusCode(_0x3b7f1f,_0x1c4dcf){_0x1c4dcf=_0x1c4dcf||0xcc;return function(_0x3fe048){if(_0x3fe048){return _0x3b7f1f[_0xa7df('0x1a')](_0x1c4dcf);}return _0x3b7f1f[_0xa7df('0x1b')](_0x1c4dcf)[_0xa7df('0x1c')]();};}function respondWithResult(_0x3004da,_0x424120){_0x424120=_0x424120||0xc8;return function(_0xd11990){if(_0xd11990){return _0x3004da['status'](_0x424120)[_0xa7df('0x1d')](_0xd11990);}};}function respondWithFilteredResult(_0x1c8298,_0xd9546b){return function(_0x5a1e8f){if(_0x5a1e8f){var _0x123cae=typeof _0xd9546b[_0xa7df('0x1e')]===_0xa7df('0x1f')&&typeof _0xd9546b['limit']===_0xa7df('0x1f');var _0x38a697=_0x5a1e8f[_0xa7df('0x20')];var _0xd154c9=_0x123cae?0x0:_0xd9546b[_0xa7df('0x1e')];var _0x46ea3f=_0x123cae?_0x5a1e8f[_0xa7df('0x20')]:_0xd9546b[_0xa7df('0x1e')]+_0xd9546b['limit'];var _0x32e518;if(_0x46ea3f>=_0x38a697){_0x46ea3f=_0x38a697;_0x32e518=0xc8;}else{_0x32e518=0xce;}_0x1c8298[_0xa7df('0x1b')](_0x32e518);return _0x1c8298[_0xa7df('0x21')]('Content-Range',_0xd154c9+'-'+_0x46ea3f+'/'+_0x38a697)[_0xa7df('0x1d')](_0x5a1e8f);}return null;};}function patchUpdates(_0x210c28){return function(_0x49cb5a){try{jsonpatch[_0xa7df('0x22')](_0x49cb5a,_0x210c28,!![]);}catch(_0x22ca57){return BPromise[_0xa7df('0x23')](_0x22ca57);}return _0x49cb5a['save']();};}function saveUpdates(_0x385fdb,_0x54380f){return function(_0x46b619){if(_0x46b619){return _0x46b619[_0xa7df('0x24')](_0x385fdb)[_0xa7df('0x25')](function(_0x26c905){return _0x26c905;});}return null;};}function removeEntity(_0x458ede,_0x59b223){return function(_0x4118af){if(_0x4118af){return _0x4118af[_0xa7df('0x26')]()[_0xa7df('0x25')](function(){_0x458ede['status'](0xcc)[_0xa7df('0x1c')]();});}};}function handleEntityNotFound(_0x35b06,_0x4131fe){return function(_0x443a9e){if(!_0x443a9e){_0x35b06[_0xa7df('0x1a')](0x194);}return _0x443a9e;};}function handleError(_0x53076d,_0x1eb91c){_0x1eb91c=_0x1eb91c||0x1f4;return function(_0x18c9f7){logger[_0xa7df('0x27')](_0x18c9f7[_0xa7df('0x28')]);if(_0x18c9f7[_0xa7df('0x29')]){delete _0x18c9f7[_0xa7df('0x29')];}_0x53076d[_0xa7df('0x1b')](_0x1eb91c)[_0xa7df('0x2a')](_0x18c9f7);};}exports[_0xa7df('0x2b')]=function(_0x2b1ad6,_0x49b32d){var _0x359708={},_0x5b2db9={},_0x2fcc9d={'count':0x0,'rows':[]};var _0x2a6e4b=_[_0xa7df('0x2c')](db['VoiceMailMessage'][_0xa7df('0x2d')],function(_0x47b2cb){return{'name':_0x47b2cb['fieldName'],'type':_0x47b2cb[_0xa7df('0x2e')][_0xa7df('0x2f')]};});_0x5b2db9[_0xa7df('0x30')]=_['differenceBy'](_['map'](_0x2a6e4b,'name'),['name']);_0x5b2db9[_0xa7df('0x31')]=_[_0xa7df('0x32')](_0x2b1ad6['query']);_0x5b2db9['filters']=_[_0xa7df('0x33')](_0x5b2db9['model'],_0x5b2db9[_0xa7df('0x31')]);_0x359708[_0xa7df('0x34')]=_[_0xa7df('0x33')](_0x5b2db9[_0xa7df('0x30')],qs[_0xa7df('0x35')](_0x2b1ad6['query'][_0xa7df('0x35')]));_0x359708[_0xa7df('0x34')]=_0x359708[_0xa7df('0x34')][_0xa7df('0x36')]?_0x359708['attributes']:_0x5b2db9[_0xa7df('0x30')];if(!_0x2b1ad6[_0xa7df('0x31')]['hasOwnProperty']('nolimit')){_0x359708['limit']=qs[_0xa7df('0x37')](_0x2b1ad6[_0xa7df('0x31')][_0xa7df('0x37')]);_0x359708['offset']=qs[_0xa7df('0x1e')](_0x2b1ad6[_0xa7df('0x31')][_0xa7df('0x1e')]);}_0x359708[_0xa7df('0x38')]=qs['sort'](_0x2b1ad6['query'][_0xa7df('0x39')]);_0x359708[_0xa7df('0x3a')]=qs[_0xa7df('0x3b')](_[_0xa7df('0x3c')](_0x2b1ad6[_0xa7df('0x31')],_0x5b2db9[_0xa7df('0x3b')]),_0x2a6e4b);if(_0x2b1ad6[_0xa7df('0x31')][_0xa7df('0x3d')]){_0x359708[_0xa7df('0x3a')]=_[_0xa7df('0x3e')](_0x359708[_0xa7df('0x3a')],{'$or':_[_0xa7df('0x2c')](_0x2a6e4b,function(_0x35b338){if(_0x35b338[_0xa7df('0x2e')]!==_0xa7df('0x3f')){var _0x5166d3={};_0x5166d3[_0x35b338[_0xa7df('0x29')]]={'$like':'%'+_0x2b1ad6[_0xa7df('0x31')][_0xa7df('0x3d')]+'%'};return _0x5166d3;}})});}_0x359708=_[_0xa7df('0x3e')]({},_0x359708,_0x2b1ad6[_0xa7df('0x40')]);var _0x588985={'where':_0x359708[_0xa7df('0x3a')]};return db['VoiceMailMessage']['count'](_0x588985)[_0xa7df('0x25')](function(_0x3d005a){_0x2fcc9d[_0xa7df('0x20')]=_0x3d005a;if(_0x2b1ad6[_0xa7df('0x31')][_0xa7df('0x41')]){_0x359708[_0xa7df('0x42')]=[{'all':!![]}];}return db[_0xa7df('0x43')][_0xa7df('0x44')](_0x359708);})[_0xa7df('0x25')](function(_0x2d4f9e){_0x2fcc9d[_0xa7df('0x45')]=_0x2d4f9e;return _0x2fcc9d;})[_0xa7df('0x25')](respondWithFilteredResult(_0x49b32d,_0x359708))[_0xa7df('0x46')](handleError(_0x49b32d,null));};exports[_0xa7df('0x47')]=function(_0x59af09,_0x1edc5c){var _0x4e43ab={'raw':!![],'where':{'id':_0x59af09[_0xa7df('0x48')]['id']}},_0x91e28={};_0x91e28[_0xa7df('0x30')]=_['keys'](db['VoiceMailMessage'][_0xa7df('0x2d')]);_0x91e28[_0xa7df('0x31')]=_[_0xa7df('0x32')](_0x59af09[_0xa7df('0x31')]);_0x91e28[_0xa7df('0x3b')]=_[_0xa7df('0x33')](_0x91e28['model'],_0x91e28[_0xa7df('0x31')]);_0x4e43ab[_0xa7df('0x34')]=_[_0xa7df('0x33')](_0x91e28['model'],qs[_0xa7df('0x35')](_0x59af09[_0xa7df('0x31')][_0xa7df('0x35')]));_0x4e43ab[_0xa7df('0x34')]=_0x4e43ab[_0xa7df('0x34')][_0xa7df('0x36')]?_0x4e43ab['attributes']:_0x91e28[_0xa7df('0x30')];if(_0x59af09[_0xa7df('0x31')][_0xa7df('0x41')]){_0x4e43ab[_0xa7df('0x42')]=[{'all':!![]}];}_0x4e43ab=_[_0xa7df('0x3e')]({},_0x4e43ab,_0x59af09[_0xa7df('0x40')]);return db[_0xa7df('0x43')][_0xa7df('0x49')](_0x4e43ab)[_0xa7df('0x25')](handleEntityNotFound(_0x1edc5c,null))[_0xa7df('0x25')](respondWithResult(_0x1edc5c,null))[_0xa7df('0x46')](handleError(_0x1edc5c,null));};exports[_0xa7df('0x4a')]=function(_0x10d276,_0x517bb9){return db[_0xa7df('0x43')]['create'](_0x10d276['body'],{})[_0xa7df('0x25')](respondWithResult(_0x517bb9,0xc9))[_0xa7df('0x46')](handleError(_0x517bb9,null));};exports[_0xa7df('0x24')]=function(_0x50e093,_0x26e7a0){if(_0x50e093['body']['id']){delete _0x50e093[_0xa7df('0x4b')]['id'];}return db[_0xa7df('0x43')][_0xa7df('0x49')]({'where':{'id':_0x50e093['params']['id']}})[_0xa7df('0x25')](handleEntityNotFound(_0x26e7a0,null))[_0xa7df('0x25')](saveUpdates(_0x50e093[_0xa7df('0x4b')],null))[_0xa7df('0x25')](respondWithResult(_0x26e7a0,null))[_0xa7df('0x46')](handleError(_0x26e7a0,null));};exports['destroy']=function(_0x2b7b16,_0x3e72f0){return db[_0xa7df('0x43')]['find']({'where':{'id':_0x2b7b16[_0xa7df('0x48')]['id']}})[_0xa7df('0x25')](handleEntityNotFound(_0x3e72f0,null))[_0xa7df('0x25')](removeEntity(_0x3e72f0,null))[_0xa7df('0x46')](handleError(_0x3e72f0,null));};exports[_0xa7df('0x4c')]=function(_0x20f0a7,_0x1225b1,_0x15de9a){return db[_0xa7df('0x43')][_0xa7df('0x49')]({'where':{'id':_0x20f0a7[_0xa7df('0x48')]['id']},'attributes':['id','recording',_0xa7df('0x4d')]})[_0xa7df('0x25')](handleEntityNotFound(_0x1225b1,null))[_0xa7df('0x25')](function(_0x259176){if(_0x259176){if(!_0x259176[_0xa7df('0x4e')]){throw new db['Sequelize'][(_0xa7df('0x4f'))](_0xa7df('0x50'));}var _0x144789={'Content-Type':'audio/wav','Content-Disposition':_0xa7df('0x51')};if(_0x259176[_0xa7df('0x4d')]){_0x144789['Content-Disposition']=_0xa7df('0x52')+_0x259176[_0xa7df('0x4d')]+_0xa7df('0x53');}_0x1225b1[_0xa7df('0x21')](_0x144789);return _0x1225b1[_0xa7df('0x2a')](new Buffer(_0x259176['recording']));}})[_0xa7df('0x46')](handleError(_0x1225b1,null));}; \ No newline at end of file +var _0xc4c3=['where','map','VIRTUAL','filter','merge','options','includeAll','include','findAll','catch','keys','rawAttributes','find','create','update','body','params','download','recording','msg_id','Sequelize','ValidationError','audio/wav','attachment','Content-Disposition','attachment;\x20filename=\x22','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','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','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','destroy','then','error','stack','name','send','VoiceMailMessage','fieldName','type','key','differenceBy','query','intersection','model','fields','attributes','length','hasOwnProperty','order','sort','pick','filters'];(function(_0x31b26f,_0x4c2f38){var _0x4c1816=function(_0x2b1c92){while(--_0x2b1c92){_0x31b26f['push'](_0x31b26f['shift']());}};_0x4c1816(++_0x4c2f38);}(_0xc4c3,0xcc));var _0x3c4c=function(_0x32998b,_0x204eeb){_0x32998b=_0x32998b-0x0;var _0x3463ed=_0xc4c3[_0x32998b];return _0x3463ed;};'use strict';var emlformat=require(_0x3c4c('0x0'));var rimraf=require(_0x3c4c('0x1'));var zipdir=require(_0x3c4c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3c4c('0x3'));var moment=require(_0x3c4c('0x4'));var BPromise=require(_0x3c4c('0x5'));var Mustache=require(_0x3c4c('0x6'));var util=require(_0x3c4c('0x7'));var path=require(_0x3c4c('0x8'));var sox=require(_0x3c4c('0x9'));var csv=require('to-csv');var ejs=require(_0x3c4c('0xa'));var fs=require('fs');var fs_extra=require(_0x3c4c('0xb'));var _=require(_0x3c4c('0xc'));var squel=require(_0x3c4c('0xd'));var crypto=require(_0x3c4c('0xe'));var jsforce=require(_0x3c4c('0xf'));var deskjs=require(_0x3c4c('0x10'));var toCsv=require(_0x3c4c('0x11'));var querystring=require('querystring');var Papa=require(_0x3c4c('0x12'));var Redis=require(_0x3c4c('0x13'));var authService=require(_0x3c4c('0x14'));var qs=require(_0x3c4c('0x15'));var as=require(_0x3c4c('0x16'));var hardwareService=require(_0x3c4c('0x17'));var logger=require(_0x3c4c('0x18'))('api');var utils=require(_0x3c4c('0x19'));var config=require(_0x3c4c('0x1a'));var licenseUtil=require(_0x3c4c('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x16f24e,_0x6a471c){_0x6a471c=_0x6a471c||0xcc;return function(_0x84004f){if(_0x84004f){return _0x16f24e[_0x3c4c('0x1c')](_0x6a471c);}return _0x16f24e[_0x3c4c('0x1d')](_0x6a471c)[_0x3c4c('0x1e')]();};}function respondWithResult(_0x282326,_0x35fcbc){_0x35fcbc=_0x35fcbc||0xc8;return function(_0x5a6764){if(_0x5a6764){return _0x282326['status'](_0x35fcbc)[_0x3c4c('0x1f')](_0x5a6764);}};}function respondWithFilteredResult(_0x571da,_0x21a340){return function(_0x388303){if(_0x388303){var _0x25ed25=typeof _0x21a340[_0x3c4c('0x20')]==='undefined'&&typeof _0x21a340[_0x3c4c('0x21')]===_0x3c4c('0x22');var _0x558d84=_0x388303[_0x3c4c('0x23')];var _0x53a1e6=_0x25ed25?0x0:_0x21a340[_0x3c4c('0x20')];var _0x50b6f7=_0x25ed25?_0x388303[_0x3c4c('0x23')]:_0x21a340[_0x3c4c('0x20')]+_0x21a340[_0x3c4c('0x21')];var _0x45005d;if(_0x50b6f7>=_0x558d84){_0x50b6f7=_0x558d84;_0x45005d=0xc8;}else{_0x45005d=0xce;}_0x571da[_0x3c4c('0x1d')](_0x45005d);return _0x571da[_0x3c4c('0x24')](_0x3c4c('0x25'),_0x53a1e6+'-'+_0x50b6f7+'/'+_0x558d84)[_0x3c4c('0x1f')](_0x388303);}return null;};}function patchUpdates(_0x5c28d6){return function(_0x5c059c){try{jsonpatch[_0x3c4c('0x26')](_0x5c059c,_0x5c28d6,!![]);}catch(_0x1810f5){return BPromise[_0x3c4c('0x27')](_0x1810f5);}return _0x5c059c[_0x3c4c('0x28')]();};}function saveUpdates(_0x489562,_0x93ae5c){return function(_0x309a57){if(_0x309a57){return _0x309a57['update'](_0x489562)['then'](function(_0x41d134){return _0x41d134;});}return null;};}function removeEntity(_0xc3e3ac,_0x50a367){return function(_0x1b6034){if(_0x1b6034){return _0x1b6034[_0x3c4c('0x29')]()[_0x3c4c('0x2a')](function(){_0xc3e3ac['status'](0xcc)[_0x3c4c('0x1e')]();});}};}function handleEntityNotFound(_0x231652,_0x1d2dd2){return function(_0xaa522c){if(!_0xaa522c){_0x231652[_0x3c4c('0x1c')](0x194);}return _0xaa522c;};}function handleError(_0x4de857,_0x1b89e1){_0x1b89e1=_0x1b89e1||0x1f4;return function(_0xfbf0dd){logger[_0x3c4c('0x2b')](_0xfbf0dd[_0x3c4c('0x2c')]);if(_0xfbf0dd[_0x3c4c('0x2d')]){delete _0xfbf0dd[_0x3c4c('0x2d')];}_0x4de857[_0x3c4c('0x1d')](_0x1b89e1)[_0x3c4c('0x2e')](_0xfbf0dd);};}exports['index']=function(_0x55bfc3,_0x48a722){var _0x437ec3={},_0x5ce899={},_0x57d7a6={'count':0x0,'rows':[]};var _0x52ed98=_['map'](db[_0x3c4c('0x2f')]['rawAttributes'],function(_0x2e2bfc){return{'name':_0x2e2bfc[_0x3c4c('0x30')],'type':_0x2e2bfc[_0x3c4c('0x31')][_0x3c4c('0x32')]};});_0x5ce899['model']=_[_0x3c4c('0x33')](_['map'](_0x52ed98,'name'),['name']);_0x5ce899[_0x3c4c('0x34')]=_['keys'](_0x55bfc3[_0x3c4c('0x34')]);_0x5ce899['filters']=_[_0x3c4c('0x35')](_0x5ce899[_0x3c4c('0x36')],_0x5ce899[_0x3c4c('0x34')]);_0x437ec3['attributes']=_[_0x3c4c('0x35')](_0x5ce899[_0x3c4c('0x36')],qs[_0x3c4c('0x37')](_0x55bfc3[_0x3c4c('0x34')][_0x3c4c('0x37')]));_0x437ec3['attributes']=_0x437ec3[_0x3c4c('0x38')][_0x3c4c('0x39')]?_0x437ec3[_0x3c4c('0x38')]:_0x5ce899['model'];if(!_0x55bfc3[_0x3c4c('0x34')][_0x3c4c('0x3a')]('nolimit')){_0x437ec3[_0x3c4c('0x21')]=qs['limit'](_0x55bfc3[_0x3c4c('0x34')][_0x3c4c('0x21')]);_0x437ec3[_0x3c4c('0x20')]=qs[_0x3c4c('0x20')](_0x55bfc3[_0x3c4c('0x34')]['offset']);}_0x437ec3[_0x3c4c('0x3b')]=qs[_0x3c4c('0x3c')](_0x55bfc3[_0x3c4c('0x34')]['sort']);_0x437ec3['where']=qs['filters'](_[_0x3c4c('0x3d')](_0x55bfc3[_0x3c4c('0x34')],_0x5ce899[_0x3c4c('0x3e')]),_0x52ed98);if(_0x55bfc3[_0x3c4c('0x34')]['filter']){_0x437ec3[_0x3c4c('0x3f')]=_['merge'](_0x437ec3['where'],{'$or':_[_0x3c4c('0x40')](_0x52ed98,function(_0x4287b4){if(_0x4287b4[_0x3c4c('0x31')]!==_0x3c4c('0x41')){var _0x53c2a4={};_0x53c2a4[_0x4287b4[_0x3c4c('0x2d')]]={'$like':'%'+_0x55bfc3[_0x3c4c('0x34')][_0x3c4c('0x42')]+'%'};return _0x53c2a4;}})});}_0x437ec3=_[_0x3c4c('0x43')]({},_0x437ec3,_0x55bfc3[_0x3c4c('0x44')]);var _0x287965={'where':_0x437ec3[_0x3c4c('0x3f')]};return db[_0x3c4c('0x2f')][_0x3c4c('0x23')](_0x287965)['then'](function(_0x1057ee){_0x57d7a6[_0x3c4c('0x23')]=_0x1057ee;if(_0x55bfc3[_0x3c4c('0x34')][_0x3c4c('0x45')]){_0x437ec3[_0x3c4c('0x46')]=[{'all':!![]}];}return db[_0x3c4c('0x2f')][_0x3c4c('0x47')](_0x437ec3);})[_0x3c4c('0x2a')](function(_0x3006e2){_0x57d7a6['rows']=_0x3006e2;return _0x57d7a6;})[_0x3c4c('0x2a')](respondWithFilteredResult(_0x48a722,_0x437ec3))[_0x3c4c('0x48')](handleError(_0x48a722,null));};exports['show']=function(_0x429a6e,_0x285059){var _0x1f71cf={'raw':!![],'where':{'id':_0x429a6e['params']['id']}},_0x11615c={};_0x11615c[_0x3c4c('0x36')]=_[_0x3c4c('0x49')](db['VoiceMailMessage'][_0x3c4c('0x4a')]);_0x11615c[_0x3c4c('0x34')]=_['keys'](_0x429a6e[_0x3c4c('0x34')]);_0x11615c[_0x3c4c('0x3e')]=_[_0x3c4c('0x35')](_0x11615c[_0x3c4c('0x36')],_0x11615c[_0x3c4c('0x34')]);_0x1f71cf['attributes']=_[_0x3c4c('0x35')](_0x11615c[_0x3c4c('0x36')],qs['fields'](_0x429a6e[_0x3c4c('0x34')]['fields']));_0x1f71cf[_0x3c4c('0x38')]=_0x1f71cf[_0x3c4c('0x38')][_0x3c4c('0x39')]?_0x1f71cf['attributes']:_0x11615c[_0x3c4c('0x36')];if(_0x429a6e['query'][_0x3c4c('0x45')]){_0x1f71cf[_0x3c4c('0x46')]=[{'all':!![]}];}_0x1f71cf=_[_0x3c4c('0x43')]({},_0x1f71cf,_0x429a6e['options']);return db['VoiceMailMessage'][_0x3c4c('0x4b')](_0x1f71cf)[_0x3c4c('0x2a')](handleEntityNotFound(_0x285059,null))[_0x3c4c('0x2a')](respondWithResult(_0x285059,null))[_0x3c4c('0x48')](handleError(_0x285059,null));};exports[_0x3c4c('0x4c')]=function(_0x4f61a4,_0x51a7e6){return db['VoiceMailMessage'][_0x3c4c('0x4c')](_0x4f61a4['body'],{})[_0x3c4c('0x2a')](respondWithResult(_0x51a7e6,0xc9))[_0x3c4c('0x48')](handleError(_0x51a7e6,null));};exports[_0x3c4c('0x4d')]=function(_0x324dbd,_0x20637f){if(_0x324dbd[_0x3c4c('0x4e')]['id']){delete _0x324dbd['body']['id'];}return db[_0x3c4c('0x2f')]['find']({'where':{'id':_0x324dbd[_0x3c4c('0x4f')]['id']}})[_0x3c4c('0x2a')](handleEntityNotFound(_0x20637f,null))[_0x3c4c('0x2a')](saveUpdates(_0x324dbd['body'],null))[_0x3c4c('0x2a')](respondWithResult(_0x20637f,null))[_0x3c4c('0x48')](handleError(_0x20637f,null));};exports[_0x3c4c('0x29')]=function(_0x4cb527,_0x58d882){return db[_0x3c4c('0x2f')][_0x3c4c('0x4b')]({'where':{'id':_0x4cb527['params']['id']}})[_0x3c4c('0x2a')](handleEntityNotFound(_0x58d882,null))[_0x3c4c('0x2a')](removeEntity(_0x58d882,null))['catch'](handleError(_0x58d882,null));};exports[_0x3c4c('0x50')]=function(_0x213acd,_0x3d257e,_0x33de5d){return db[_0x3c4c('0x2f')][_0x3c4c('0x4b')]({'where':{'id':_0x213acd[_0x3c4c('0x4f')]['id']},'attributes':['id',_0x3c4c('0x51'),_0x3c4c('0x52')]})[_0x3c4c('0x2a')](handleEntityNotFound(_0x3d257e,null))['then'](function(_0x5b76bb){if(_0x5b76bb){if(!_0x5b76bb['recording']){throw new db[(_0x3c4c('0x53'))][(_0x3c4c('0x54'))]('VoiceMailMessage\x20not\x20found');}var _0x43af54={'Content-Type':_0x3c4c('0x55'),'Content-Disposition':_0x3c4c('0x56')};if(_0x5b76bb[_0x3c4c('0x52')]){_0x43af54[_0x3c4c('0x57')]=_0x3c4c('0x58')+_0x5b76bb['msg_id']+'.wav\x22';}_0x3d257e['set'](_0x43af54);return _0x3d257e[_0x3c4c('0x2e')](new Buffer(_0x5b76bb['recording']));}})[_0x3c4c('0x48')](handleError(_0x3d257e,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index b2ad77d..4e5b584 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 _0x6895=['../../config/environment','./voiceMailMessage.attributes','exports','define','voice_voicemail_messages','dir','lodash','util','api','bluebird','request-promise','path','rimraf'];(function(_0x5e801a,_0x51bdab){var _0x70d9bf=function(_0x58d8a6){while(--_0x58d8a6){_0x5e801a['push'](_0x5e801a['shift']());}};_0x70d9bf(++_0x51bdab);}(_0x6895,0x158));var _0x5689=function(_0xd3617f,_0x1f8b09){_0xd3617f=_0xd3617f-0x0;var _0x4358db=_0x6895[_0xd3617f];return _0x4358db;};'use strict';var _=require(_0x5689('0x0'));var util=require(_0x5689('0x1'));var logger=require('../../config/logger')(_0x5689('0x2'));var moment=require('moment');var BPromise=require(_0x5689('0x3'));var rp=require(_0x5689('0x4'));var fs=require('fs');var path=require(_0x5689('0x5'));var rimraf=require(_0x5689('0x6'));var config=require(_0x5689('0x7'));var attributes=require(_0x5689('0x8'));module[_0x5689('0x9')]=function(_0x4ccf9a,_0x268c68){return _0x4ccf9a[_0x5689('0xa')]('VoiceMailMessage',attributes,{'tableName':_0x5689('0xb'),'paranoid':![],'indexes':[{'name':_0x5689('0xc'),'fields':['dir']}],'timestamps':![]});}; \ No newline at end of file +var _0xdc88=['path','rimraf','../../config/environment','define','VoiceMailMessage','dir','../../config/logger','api','bluebird','request-promise'];(function(_0x1e655e,_0x1e9e21){var _0x10b355=function(_0xa8a8fa){while(--_0xa8a8fa){_0x1e655e['push'](_0x1e655e['shift']());}};_0x10b355(++_0x1e9e21);}(_0xdc88,0xa6));var _0x8dc8=function(_0x2a60e4,_0x496d64){_0x2a60e4=_0x2a60e4-0x0;var _0x4a433a=_0xdc88[_0x2a60e4];return _0x4a433a;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x8dc8('0x0'))(_0x8dc8('0x1'));var moment=require('moment');var BPromise=require(_0x8dc8('0x2'));var rp=require(_0x8dc8('0x3'));var fs=require('fs');var path=require(_0x8dc8('0x4'));var rimraf=require(_0x8dc8('0x5'));var config=require(_0x8dc8('0x6'));var attributes=require('./voiceMailMessage.attributes');module['exports']=function(_0xc28fd0,_0x1356bd){return _0xc28fd0[_0x8dc8('0x7')](_0x8dc8('0x8'),attributes,{'tableName':'voice_voicemail_messages','paranoid':![],'indexes':[{'name':_0x8dc8('0x9'),'fields':[_0x8dc8('0x9')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.rpc.js b/server/api/voiceMailMessage/voiceMailMessage.rpc.js index a8679f9..6e789a1 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 _0x76a5=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','VoiceMailMessage,\x20%s,\x20%s','debug','VoiceMailMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','lodash'];(function(_0x525513,_0x44220c){var _0x17f77f=function(_0x28473e){while(--_0x28473e){_0x525513['push'](_0x525513['shift']());}};_0x17f77f(++_0x44220c);}(_0x76a5,0xa7));var _0x576a=function(_0x36fe46,_0x40010c){_0x36fe46=_0x36fe46-0x0;var _0x4d2e9c=_0x76a5[_0x36fe46];return _0x4d2e9c;};'use strict';var _=require(_0x576a('0x0'));var util=require(_0x576a('0x1'));var moment=require(_0x576a('0x2'));var BPromise=require(_0x576a('0x3'));var rs=require(_0x576a('0x4'));var fs=require('fs');var Redis=require(_0x576a('0x5'));var db=require(_0x576a('0x6'))['db'];var utils=require(_0x576a('0x7'));var logger=require(_0x576a('0x8'))(_0x576a('0x9'));var config=require(_0x576a('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x576a('0xb')][_0x576a('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x455ab5,_0x28156d,_0x414e7b){return new BPromise(function(_0x7bbecf,_0x515cc2){return client[_0x576a('0xd')](_0x455ab5,_0x414e7b)[_0x576a('0xe')](function(_0x3f0412){logger[_0x576a('0xf')](_0x576a('0x10'),_0x28156d,'request\x20sent');logger[_0x576a('0x11')](_0x576a('0x12'),_0x28156d,_0x576a('0x13'),JSON[_0x576a('0x14')](_0x3f0412));if(_0x3f0412[_0x576a('0x15')]){if(_0x3f0412[_0x576a('0x15')]['code']===0x1f4){logger[_0x576a('0x15')]('VoiceMailMessage,\x20%s,\x20%s',_0x28156d,_0x3f0412[_0x576a('0x15')][_0x576a('0x16')]);return _0x515cc2(_0x3f0412[_0x576a('0x15')][_0x576a('0x16')]);}logger['error']('VoiceMailMessage,\x20%s,\x20%s',_0x28156d,_0x3f0412[_0x576a('0x15')]['message']);return _0x7bbecf(_0x3f0412['error'][_0x576a('0x16')]);}else{logger[_0x576a('0xf')]('VoiceMailMessage,\x20%s,\x20%s',_0x28156d,_0x576a('0x13'));_0x7bbecf(_0x3f0412[_0x576a('0x17')][_0x576a('0x16')]);}})['catch'](function(_0x3ccbed){logger['error'](_0x576a('0x10'),_0x28156d,_0x3ccbed);_0x515cc2(_0x3ccbed);});});} \ No newline at end of file +var _0xc0ba=['request','then','info','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','debug','VoiceMailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client'];(function(_0x1e2e0a,_0xe026c2){var _0x51980a=function(_0x54bb2d){while(--_0x54bb2d){_0x1e2e0a['push'](_0x1e2e0a['shift']());}};_0x51980a(++_0xe026c2);}(_0xc0ba,0x18c));var _0xac0b=function(_0x36665f,_0x4f9488){_0x36665f=_0x36665f-0x0;var _0x481d25=_0xc0ba[_0x36665f];return _0x481d25;};'use strict';var _=require(_0xac0b('0x0'));var util=require(_0xac0b('0x1'));var moment=require(_0xac0b('0x2'));var BPromise=require(_0xac0b('0x3'));var rs=require(_0xac0b('0x4'));var fs=require('fs');var Redis=require(_0xac0b('0x5'));var db=require(_0xac0b('0x6'))['db'];var utils=require(_0xac0b('0x7'));var logger=require(_0xac0b('0x8'))(_0xac0b('0x9'));var config=require('../../config/environment');var jayson=require(_0xac0b('0xa'));var client=jayson[_0xac0b('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x9ee9dd,_0x314e01,_0x588c45){return new BPromise(function(_0x453302,_0x555554){return client[_0xac0b('0xc')](_0x9ee9dd,_0x588c45)[_0xac0b('0xd')](function(_0x5f48e3){logger[_0xac0b('0xe')](_0xac0b('0xf'),_0x314e01,_0xac0b('0x10'));logger[_0xac0b('0x11')](_0xac0b('0x12'),_0x314e01,_0xac0b('0x10'),JSON[_0xac0b('0x13')](_0x5f48e3));if(_0x5f48e3[_0xac0b('0x14')]){if(_0x5f48e3['error'][_0xac0b('0x15')]===0x1f4){logger[_0xac0b('0x14')]('VoiceMailMessage,\x20%s,\x20%s',_0x314e01,_0x5f48e3[_0xac0b('0x14')]['message']);return _0x555554(_0x5f48e3['error'][_0xac0b('0x16')]);}logger['error'](_0xac0b('0xf'),_0x314e01,_0x5f48e3[_0xac0b('0x14')][_0xac0b('0x16')]);return _0x453302(_0x5f48e3[_0xac0b('0x14')]['message']);}else{logger[_0xac0b('0xe')]('VoiceMailMessage,\x20%s,\x20%s',_0x314e01,_0xac0b('0x10'));_0x453302(_0x5f48e3['result'][_0xac0b('0x16')]);}})[_0xac0b('0x17')](function(_0x2be3ba){logger[_0xac0b('0x14')]('VoiceMailMessage,\x20%s,\x20%s',_0x314e01,_0x2be3ba);_0x555554(_0x2be3ba);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index e3351ff..1b7344b 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 _0x88be=['index','/:id','show','/:id/sounds','post','create','put','update','delete','/:id/sounds/:id2','removeSound','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated'];(function(_0xee7e34,_0xff9a){var _0x3258c4=function(_0x2b1fbd){while(--_0x2b1fbd){_0xee7e34['push'](_0xee7e34['shift']());}};_0x3258c4(++_0xff9a);}(_0x88be,0x1af));var _0xe88b=function(_0x363ef8,_0x4ecb1a){_0x363ef8=_0x363ef8-0x0;var _0x148822=_0x88be[_0x363ef8];return _0x148822;};'use strict';var multer=require(_0xe88b('0x0'));var util=require('util');var path=require(_0xe88b('0x1'));var timeout=require(_0xe88b('0x2'));var express=require(_0xe88b('0x3'));var router=express[_0xe88b('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xe88b('0x5'));var interaction=require(_0xe88b('0x6'));var config=require(_0xe88b('0x7'));var controller=require('./voiceMusicOnHold.controller');router[_0xe88b('0x8')]('/',auth[_0xe88b('0x9')](),controller[_0xe88b('0xa')]);router['get'](_0xe88b('0xb'),auth[_0xe88b('0x9')](),controller[_0xe88b('0xc')]);router[_0xe88b('0x8')](_0xe88b('0xd'),auth[_0xe88b('0x9')](),controller['getSounds']);router[_0xe88b('0xe')]('/',auth[_0xe88b('0x9')](),controller[_0xe88b('0xf')]);router[_0xe88b('0xe')](_0xe88b('0xd'),auth[_0xe88b('0x9')](),controller['addSound']);router[_0xe88b('0x10')]('/:id',auth[_0xe88b('0x9')](),controller[_0xe88b('0x11')]);router['delete']('/:id',auth[_0xe88b('0x9')](),controller['destroy']);router[_0xe88b('0x12')](_0xe88b('0x13'),auth[_0xe88b('0x9')](),controller[_0xe88b('0x14')]);module['exports']=router; \ No newline at end of file +var _0x7ce0=['put','update','delete','/:id','destroy','/:id/sounds/:id2','removeSound','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','./voiceMusicOnHold.controller','get','isAuthenticated','index','show','getSounds','post','create','/:id/sounds','addSound'];(function(_0x10b65d,_0x2015f1){var _0x2ed8ba=function(_0x20ee23){while(--_0x20ee23){_0x10b65d['push'](_0x10b65d['shift']());}};_0x2ed8ba(++_0x2015f1);}(_0x7ce0,0x1ca));var _0x07ce=function(_0x2df507,_0x553862){_0x2df507=_0x2df507-0x0;var _0x1f7167=_0x7ce0[_0x2df507];return _0x1f7167;};'use strict';var multer=require(_0x07ce('0x0'));var util=require(_0x07ce('0x1'));var path=require(_0x07ce('0x2'));var timeout=require('connect-timeout');var express=require(_0x07ce('0x3'));var router=express[_0x07ce('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x07ce('0x5'));var interaction=require(_0x07ce('0x6'));var config=require('../../config/environment');var controller=require(_0x07ce('0x7'));router[_0x07ce('0x8')]('/',auth[_0x07ce('0x9')](),controller[_0x07ce('0xa')]);router[_0x07ce('0x8')]('/:id',auth[_0x07ce('0x9')](),controller[_0x07ce('0xb')]);router[_0x07ce('0x8')]('/:id/sounds',auth[_0x07ce('0x9')](),controller[_0x07ce('0xc')]);router[_0x07ce('0xd')]('/',auth[_0x07ce('0x9')](),controller[_0x07ce('0xe')]);router[_0x07ce('0xd')](_0x07ce('0xf'),auth[_0x07ce('0x9')](),controller[_0x07ce('0x10')]);router[_0x07ce('0x11')]('/:id',auth[_0x07ce('0x9')](),controller[_0x07ce('0x12')]);router[_0x07ce('0x13')](_0x07ce('0x14'),auth[_0x07ce('0x9')](),controller[_0x07ce('0x15')]);router['delete'](_0x07ce('0x16'),auth[_0x07ce('0x9')](),controller[_0x07ce('0x17')]);module[_0x07ce('0x18')]=router; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js index e22a990..b3a0227 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 _0x079d=['STRING','alpha','BOOLEAN','sequelize','name','ENUM','files','mp3nb','quietmp3','mp3'];(function(_0xa949c1,_0xcd9fd8){var _0x1dc656=function(_0x3b482a){while(--_0x3b482a){_0xa949c1['push'](_0xa949c1['shift']());}};_0x1dc656(++_0xcd9fd8);}(_0x079d,0x125));var _0xd079=function(_0x43ccfa,_0x24119c){_0x43ccfa=_0x43ccfa-0x0;var _0x2a0206=_0x079d[_0x43ccfa];return _0x2a0206;};'use strict';var Sequelize=require(_0xd079('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xd079('0x1')},'mode':{'type':Sequelize[_0xd079('0x2')]('custom',_0xd079('0x3'),_0xd079('0x4'),'quietmp3nb',_0xd079('0x5'),_0xd079('0x6')),'allowNull':!![],'defaultValue':_0xd079('0x3')},'directory':{'type':Sequelize['STRING'],'allowNull':!![]},'application':{'type':Sequelize[_0xd079('0x7')],'allowNull':!![]},'digit':{'type':Sequelize['STRING'],'allowNull':!![]},'sort':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0xd079('0x8')},'format':{'type':Sequelize[_0xd079('0x7')],'allowNull':!![]},'stamp':{'type':'TIMESTAMP'},'defaultEntry':{'type':Sequelize[_0xd079('0x9')],'defaultValue':0x0}}; \ No newline at end of file +var _0x3f38=['TIMESTAMP','BOOLEAN','exports','STRING','name','mp3nb','quietmp3nb','quietmp3','mp3','files','alpha'];(function(_0xbd08b4,_0x4790ed){var _0x314f1e=function(_0x161589){while(--_0x161589){_0xbd08b4['push'](_0xbd08b4['shift']());}};_0x314f1e(++_0x4790ed);}(_0x3f38,0x86));var _0x83f3=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x3f38[_0x3ab51d];return _0x29a04e;};'use strict';var Sequelize=require('sequelize');module[_0x83f3('0x0')]={'name':{'type':Sequelize[_0x83f3('0x1')],'allowNull':![],'unique':_0x83f3('0x2')},'mode':{'type':Sequelize['ENUM']('custom','files',_0x83f3('0x3'),_0x83f3('0x4'),_0x83f3('0x5'),_0x83f3('0x6')),'allowNull':!![],'defaultValue':_0x83f3('0x7')},'directory':{'type':Sequelize[_0x83f3('0x1')],'allowNull':!![]},'application':{'type':Sequelize[_0x83f3('0x1')],'allowNull':!![]},'digit':{'type':Sequelize[_0x83f3('0x1')],'allowNull':!![]},'sort':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x83f3('0x8')},'format':{'type':Sequelize[_0x83f3('0x1')],'allowNull':!![]},'stamp':{'type':_0x83f3('0x9')},'defaultEntry':{'type':Sequelize[_0x83f3('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 3f4a80f..7499cac 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 _0x035a=['extname','format','symlinkSync','Sequelize','findOne','removeSound','id2','%s.%s','getSounds','eml-format','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','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','get','MusicOnHolds','UserProfileResource','stack','name','send','index','VoiceMusicOnHold','rawAttributes','fieldName','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','options','includeAll','include','findAll','show','params','catch','body','create','sequelize','mode','files','directory','join','root','server/files/moh','0777','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','transaction','readdirSync','unlinkSync','ValidationError','message','addSound','Sound','converted_format','server/files/sounds/converted','save_name'];(function(_0x5adca1,_0x52e9d3){var _0x442afe=function(_0x32180d){while(--_0x32180d){_0x5adca1['push'](_0x5adca1['shift']());}};_0x442afe(++_0x52e9d3);}(_0x035a,0x7d));var _0xa035=function(_0x133a1e,_0x3e9a94){_0x133a1e=_0x133a1e-0x0;var _0x4bc62c=_0x035a[_0x133a1e];return _0x4bc62c;};'use strict';var emlformat=require(_0xa035('0x0'));var rimraf=require(_0xa035('0x1'));var zipdir=require(_0xa035('0x2'));var jsonpatch=require(_0xa035('0x3'));var rp=require(_0xa035('0x4'));var moment=require(_0xa035('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xa035('0x6'));var util=require(_0xa035('0x7'));var path=require(_0xa035('0x8'));var sox=require(_0xa035('0x9'));var csv=require(_0xa035('0xa'));var ejs=require(_0xa035('0xb'));var fs=require('fs');var fs_extra=require(_0xa035('0xc'));var _=require(_0xa035('0xd'));var squel=require(_0xa035('0xe'));var crypto=require(_0xa035('0xf'));var jsforce=require(_0xa035('0x10'));var deskjs=require(_0xa035('0x11'));var toCsv=require(_0xa035('0xa'));var querystring=require(_0xa035('0x12'));var Papa=require(_0xa035('0x13'));var Redis=require('ioredis');var authService=require(_0xa035('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xa035('0x15'));var hardwareService=require(_0xa035('0x16'));var logger=require(_0xa035('0x17'))(_0xa035('0x18'));var utils=require('../../config/utils');var config=require(_0xa035('0x19'));var licenseUtil=require(_0xa035('0x1a'));var db=require(_0xa035('0x1b'))['db'];function respondWithStatusCode(_0x3627ad,_0x5815cb){_0x5815cb=_0x5815cb||0xcc;return function(_0x3d9fa7){if(_0x3d9fa7){return _0x3627ad[_0xa035('0x1c')](_0x5815cb);}return _0x3627ad[_0xa035('0x1d')](_0x5815cb)[_0xa035('0x1e')]();};}function respondWithResult(_0x580a5e,_0x471f1b){_0x471f1b=_0x471f1b||0xc8;return function(_0x360baa){if(_0x360baa){return _0x580a5e[_0xa035('0x1d')](_0x471f1b)[_0xa035('0x1f')](_0x360baa);}};}function respondWithFilteredResult(_0x49e133,_0x3deb12){return function(_0x34fdaa){if(_0x34fdaa){var _0x2b33ac=typeof _0x3deb12[_0xa035('0x20')]===_0xa035('0x21')&&typeof _0x3deb12[_0xa035('0x22')]===_0xa035('0x21');var _0x142224=_0x34fdaa[_0xa035('0x23')];var _0xc19583=_0x2b33ac?0x0:_0x3deb12['offset'];var _0x57df0c=_0x2b33ac?_0x34fdaa['count']:_0x3deb12[_0xa035('0x20')]+_0x3deb12[_0xa035('0x22')];var _0x175eaf;if(_0x57df0c>=_0x142224){_0x57df0c=_0x142224;_0x175eaf=0xc8;}else{_0x175eaf=0xce;}_0x49e133['status'](_0x175eaf);return _0x49e133[_0xa035('0x24')](_0xa035('0x25'),_0xc19583+'-'+_0x57df0c+'/'+_0x142224)[_0xa035('0x1f')](_0x34fdaa);}return null;};}function patchUpdates(_0x434ae9){return function(_0xc4f785){try{jsonpatch[_0xa035('0x26')](_0xc4f785,_0x434ae9,!![]);}catch(_0x50c33c){return BPromise['reject'](_0x50c33c);}return _0xc4f785[_0xa035('0x27')]();};}function saveUpdates(_0x57bae3,_0x1ad430){return function(_0x4b79dd){if(_0x4b79dd){return _0x4b79dd[_0xa035('0x28')](_0x57bae3)[_0xa035('0x29')](function(_0x4e237d){return _0x4e237d;});}return null;};}function removeEntity(_0x562842,_0x54071b){return function(_0x3505fc){if(_0x3505fc){return _0x3505fc[_0xa035('0x2a')]()['then'](function(){var _0x1dd3ca=_0x3505fc[_0xa035('0x2b')]({'plain':!![]});var _0x5da2be=_0xa035('0x2c');return db[_0xa035('0x2d')][_0xa035('0x2a')]({'where':{'type':_0x5da2be,'resourceId':_0x1dd3ca['id']}})[_0xa035('0x29')](function(){return _0x3505fc;});})['then'](function(){_0x562842[_0xa035('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4b833d,_0x3685b5){return function(_0x755f33){if(!_0x755f33){_0x4b833d[_0xa035('0x1c')](0x194);}return _0x755f33;};}function handleError(_0x354d50,_0x168673){_0x168673=_0x168673||0x1f4;return function(_0x5be07c){logger['error'](_0x5be07c[_0xa035('0x2e')]);if(_0x5be07c['name']){delete _0x5be07c[_0xa035('0x2f')];}_0x354d50[_0xa035('0x1d')](_0x168673)[_0xa035('0x30')](_0x5be07c);};}exports[_0xa035('0x31')]=function(_0x1935c7,_0x59f987){var _0x2e4031={},_0x268c70={},_0x4cb469={'count':0x0,'rows':[]};var _0x58d137=_['map'](db[_0xa035('0x32')][_0xa035('0x33')],function(_0x3aa4fc){return{'name':_0x3aa4fc[_0xa035('0x34')],'type':_0x3aa4fc['type']['key']};});_0x268c70[_0xa035('0x35')]=_[_0xa035('0x36')](_0x58d137,_0xa035('0x2f'));_0x268c70[_0xa035('0x37')]=_[_0xa035('0x38')](_0x1935c7['query']);_0x268c70[_0xa035('0x39')]=_[_0xa035('0x3a')](_0x268c70[_0xa035('0x35')],_0x268c70['query']);_0x2e4031[_0xa035('0x3b')]=_['intersection'](_0x268c70['model'],qs[_0xa035('0x3c')](_0x1935c7[_0xa035('0x37')][_0xa035('0x3c')]));_0x2e4031[_0xa035('0x3b')]=_0x2e4031[_0xa035('0x3b')][_0xa035('0x3d')]?_0x2e4031['attributes']:_0x268c70[_0xa035('0x35')];if(!_0x1935c7['query'][_0xa035('0x3e')](_0xa035('0x3f'))){_0x2e4031[_0xa035('0x22')]=qs[_0xa035('0x22')](_0x1935c7[_0xa035('0x37')][_0xa035('0x22')]);_0x2e4031['offset']=qs[_0xa035('0x20')](_0x1935c7[_0xa035('0x37')]['offset']);}_0x2e4031[_0xa035('0x40')]=qs[_0xa035('0x41')](_0x1935c7[_0xa035('0x37')][_0xa035('0x41')]);delete _0x1935c7['query'][_0xa035('0x41')];_0x2e4031[_0xa035('0x42')]=qs['filters'](_[_0xa035('0x43')](_0x1935c7['query'],_0x268c70[_0xa035('0x39')]),_0x58d137);if(_0x1935c7[_0xa035('0x37')][_0xa035('0x44')]){_0x2e4031[_0xa035('0x42')]=_[_0xa035('0x45')](_0x2e4031[_0xa035('0x42')],{'$or':_[_0xa035('0x36')](_0x58d137,function(_0x303458){if(_0x303458[_0xa035('0x46')]!=='VIRTUAL'){var _0x513e29={};_0x513e29[_0x303458[_0xa035('0x2f')]]={'$like':'%'+_0x1935c7[_0xa035('0x37')]['filter']+'%'};return _0x513e29;}})});}_0x2e4031=_[_0xa035('0x45')]({},_0x2e4031,_0x1935c7[_0xa035('0x47')]);var _0x329d1f={'where':_0x2e4031[_0xa035('0x42')]};return db[_0xa035('0x32')]['count'](_0x329d1f)['then'](function(_0x41a8d7){_0x4cb469['count']=_0x41a8d7;if(_0x1935c7['query'][_0xa035('0x48')]){_0x2e4031[_0xa035('0x49')]=[{'all':!![]}];}return db['VoiceMusicOnHold'][_0xa035('0x4a')](_0x2e4031);})[_0xa035('0x29')](function(_0x13b8be){_0x4cb469['rows']=_0x13b8be;return _0x4cb469;})[_0xa035('0x29')](respondWithFilteredResult(_0x59f987,_0x2e4031))['catch'](handleError(_0x59f987,null));};exports[_0xa035('0x4b')]=function(_0x9b2cfd,_0x59c8b1){var _0x348ecd={'raw':![],'where':{'id':_0x9b2cfd[_0xa035('0x4c')]['id']}},_0x56f002={};_0x56f002[_0xa035('0x35')]=_['keys'](db[_0xa035('0x32')][_0xa035('0x33')]);_0x56f002['query']=_['keys'](_0x9b2cfd[_0xa035('0x37')]);_0x56f002[_0xa035('0x39')]=_[_0xa035('0x3a')](_0x56f002[_0xa035('0x35')],_0x56f002['query']);_0x348ecd[_0xa035('0x3b')]=_[_0xa035('0x3a')](_0x56f002[_0xa035('0x35')],qs[_0xa035('0x3c')](_0x9b2cfd[_0xa035('0x37')][_0xa035('0x3c')]));_0x348ecd[_0xa035('0x3b')]=_0x348ecd[_0xa035('0x3b')][_0xa035('0x3d')]?_0x348ecd[_0xa035('0x3b')]:_0x56f002[_0xa035('0x35')];if(_0x9b2cfd[_0xa035('0x37')][_0xa035('0x48')]){_0x348ecd[_0xa035('0x49')]=[{'all':!![]}];}_0x348ecd=_['merge']({},_0x348ecd,_0x9b2cfd['options']);return db['VoiceMusicOnHold']['find'](_0x348ecd)[_0xa035('0x29')](handleEntityNotFound(_0x59c8b1,null))[_0xa035('0x29')](respondWithResult(_0x59c8b1,null))[_0xa035('0x4d')](handleError(_0x59c8b1,null));};exports[_0xa035('0x28')]=function(_0xfec8d1,_0x5d4a07){if(_0xfec8d1[_0xa035('0x4e')]['id']){delete _0xfec8d1[_0xa035('0x4e')]['id'];}return db['VoiceMusicOnHold']['find']({'where':{'id':_0xfec8d1[_0xa035('0x4c')]['id']}})['then'](handleEntityNotFound(_0x5d4a07,null))[_0xa035('0x29')](saveUpdates(_0xfec8d1['body'],null))[_0xa035('0x29')](respondWithResult(_0x5d4a07,null))['catch'](handleError(_0x5d4a07,null));};exports[_0xa035('0x4f')]=function(_0x55fdbf,_0x5f1a14,_0x2c9e46){return db[_0xa035('0x50')]['transaction'](function(_0x31a52e){if(_0x55fdbf[_0xa035('0x4e')][_0xa035('0x51')]===_0xa035('0x52')){_0x55fdbf['body'][_0xa035('0x53')]=path[_0xa035('0x54')](config[_0xa035('0x55')],_0xa035('0x56'),_0x55fdbf[_0xa035('0x4e')][_0xa035('0x2f')]);}return db[_0xa035('0x32')]['create'](_0x55fdbf[_0xa035('0x4e')],{'transaction':_0x31a52e})[_0xa035('0x29')](function(_0xa9fc9){if(_0x55fdbf[_0xa035('0x4e')][_0xa035('0x51')]==='files'){fs['mkdirSync'](_0xa9fc9['directory'],parseInt(_0xa035('0x57'),0x8));}var _0x179eed=_0x55fdbf[_0xa035('0x58')][_0xa035('0x2b')]({'plain':!![]});if(!_0x179eed)throw new Error(_0xa035('0x59'));if(_0x179eed[_0xa035('0x5a')]===_0xa035('0x58')){var _0x20308e=_0xa9fc9[_0xa035('0x2b')]({'plain':!![]});return db[_0xa035('0x5b')][_0xa035('0x5c')]({'where':{'name':'MusicOnHolds','userProfileId':_0x179eed[_0xa035('0x5d')]},'raw':!![]})[_0xa035('0x29')](function(_0x4e566a){if(_0x4e566a&&_0x4e566a[_0xa035('0x5e')]===0x0){return db[_0xa035('0x2d')]['create']({'name':_0x20308e['name'],'resourceId':_0x20308e['id'],'type':_0x4e566a[_0xa035('0x2f')],'sectionId':_0x4e566a['id']},{})['then'](function(){return _0xa9fc9;});}else{return _0xa9fc9;}})[_0xa035('0x4d')](function(_0x475baa){logger[_0xa035('0x5f')](_0xa035('0x60'),_0x475baa);});}return _0xa9fc9;});})[_0xa035('0x29')](respondWithResult(_0x5f1a14,0xc9))[_0xa035('0x4d')](handleError(_0x5f1a14,null));};exports[_0xa035('0x2a')]=function(_0x469b43,_0x2ffaa9,_0x13c428){var _0xf70cb8;return db[_0xa035('0x32')]['find']({'where':{'id':_0x469b43['params']['id']}})[_0xa035('0x29')](function(_0x222712){if(_0x222712){return db[_0xa035('0x50')][_0xa035('0x61')](function(_0x5be789){return _0x222712[_0xa035('0x2a')]({'transaction':_0x5be789,'raw':!![]})[_0xa035('0x29')](function(_0x534330){if(_0x534330[_0xa035('0x53')]){fs[_0xa035('0x62')](_0x534330[_0xa035('0x53')])['forEach'](function(_0x1852c9){fs[_0xa035('0x63')](path['join'](_0x534330[_0xa035('0x53')],_0x1852c9));});fs['rmdirSync'](_0x534330[_0xa035('0x53')]);}return _0x534330;});})[_0xa035('0x4d')](function(_0x2c6404){throw new db['Sequelize'][(_0xa035('0x64'))](_0x2c6404[_0xa035('0x65')]);});}})[_0xa035('0x29')](handleEntityNotFound(_0x2ffaa9,null))[_0xa035('0x29')](removeEntity(_0x2ffaa9,null))['catch'](handleError(_0x2ffaa9,null));};exports[_0xa035('0x66')]=function(_0x24f255,_0x2e6033,_0x5f001a){return db[_0xa035('0x50')][_0xa035('0x61')](function(_0x1eafd8){var _0x4bdfb9;return db[_0xa035('0x32')]['find']({'where':{'id':_0x24f255['params']['id']}})[_0xa035('0x29')](function(_0x22881f){if(_0x22881f){_0x4bdfb9=_0x22881f;return _0x22881f['addSound'](_0x24f255[_0xa035('0x4e')]['id'],{'transaction':_0x1eafd8});}})[_0xa035('0x29')](function(_0x240461){if(_0x240461){return db[_0xa035('0x67')]['findOne']({'where':{'id':_0x24f255[_0xa035('0x4e')]['id']},'attributes':['id',_0xa035('0x2f'),'save_name',_0xa035('0x68'),'createdAt'],'raw':!![]});}})['then'](function(_0x1ae482){if(_0x1ae482){var _0xaa2d75=path[_0xa035('0x54')](config[_0xa035('0x55')],_0xa035('0x69'),util['format']('%s.%s',path['basename'](_0x1ae482[_0xa035('0x6a')],path[_0xa035('0x6b')](_0x1ae482['save_name'])),_0x1ae482[_0xa035('0x68')]));var _0x259c60=path[_0xa035('0x54')](config[_0xa035('0x55')],'server/files/moh',_0x4bdfb9[_0xa035('0x2f')],util[_0xa035('0x6c')]('%s.%s',_0x1ae482[_0xa035('0x2f')],_0x1ae482[_0xa035('0x68')]));fs[_0xa035('0x6d')](_0xaa2d75,_0x259c60);return _0x1ae482;}})[_0xa035('0x4d')](function(_0x7da265){throw new db[(_0xa035('0x6e'))]['ValidationError'](_0x7da265[_0xa035('0x65')]);});})['then'](handleEntityNotFound(_0x2e6033,null))[_0xa035('0x29')](respondWithResult(_0x2e6033,0xc9))[_0xa035('0x4d')](handleError(_0x2e6033,null));};exports['removeSound']=function(_0x2b8016,_0x23ad89,_0x1f0a72){return db['sequelize'][_0xa035('0x61')](function(_0xd04940){var _0x2459e9;return db[_0xa035('0x32')][_0xa035('0x6f')]({'where':{'id':_0x2b8016[_0xa035('0x4c')]['id']}})[_0xa035('0x29')](handleEntityNotFound(_0x23ad89,null))[_0xa035('0x29')](function(_0x4c3ef0){if(_0x4c3ef0){_0x2459e9=_0x4c3ef0;return _0x4c3ef0[_0xa035('0x70')](_0x2b8016['params'][_0xa035('0x71')]);}})['then'](function(_0x345437){if(_0x345437){return db[_0xa035('0x67')][_0xa035('0x6f')]({'where':{'id':_0x2b8016[_0xa035('0x4c')][_0xa035('0x71')]},'attributes':['id',_0xa035('0x2f'),_0xa035('0x6a'),_0xa035('0x68'),'createdAt'],'raw':!![]});}})['then'](function(_0x5ac93e){if(_0x5ac93e){fs[_0xa035('0x63')](path[_0xa035('0x54')](_0x2459e9[_0xa035('0x53')],util['format'](_0xa035('0x72'),_0x5ac93e[_0xa035('0x2f')],_0x5ac93e[_0xa035('0x68')])));return _0x5ac93e;}})[_0xa035('0x4d')](function(_0x36877a){throw new db['Sequelize'][(_0xa035('0x64'))](_0x36877a[_0xa035('0x65')]);});})['then'](handleEntityNotFound(_0x23ad89,null))[_0xa035('0x29')](respondWithStatusCode(_0x23ad89,0xcc))['catch'](handleError(_0x23ad89,null));};exports[_0xa035('0x73')]=function(_0x8698e1,_0x235188,_0x34ca3e){var _0x4c39b5={};var _0x281948={};var _0x264b05;var _0x5567b7;return db[_0xa035('0x32')][_0xa035('0x6f')]({'where':{'id':_0x8698e1[_0xa035('0x4c')]['id']}})[_0xa035('0x29')](handleEntityNotFound(_0x235188,null))[_0xa035('0x29')](function(_0x50e397){if(_0x50e397){_0x264b05=_0x50e397;_0x281948[_0xa035('0x35')]=_['keys'](db[_0xa035('0x67')]['rawAttributes']);_0x281948['query']=_[_0xa035('0x38')](_0x8698e1[_0xa035('0x37')]);_0x281948[_0xa035('0x39')]=_[_0xa035('0x3a')](_0x281948[_0xa035('0x35')],_0x281948[_0xa035('0x37')]);_0x4c39b5[_0xa035('0x3b')]=_[_0xa035('0x3a')](_0x281948[_0xa035('0x35')],qs['fields'](_0x8698e1[_0xa035('0x37')][_0xa035('0x3c')]));_0x4c39b5['attributes']=_0x4c39b5[_0xa035('0x3b')][_0xa035('0x3d')]?_0x4c39b5[_0xa035('0x3b')]:_0x281948[_0xa035('0x35')];_0x4c39b5[_0xa035('0x40')]=qs[_0xa035('0x41')](_0x8698e1['query']['sort']);_0x4c39b5['where']=qs[_0xa035('0x39')](_[_0xa035('0x43')](_0x8698e1[_0xa035('0x37')],_0x281948[_0xa035('0x39')]));if(_0x8698e1[_0xa035('0x37')][_0xa035('0x44')]){_0x4c39b5[_0xa035('0x42')]=_[_0xa035('0x45')](_0x4c39b5[_0xa035('0x42')],{'$or':_[_0xa035('0x36')](_0x4c39b5[_0xa035('0x3b')],function(_0x35d062){var _0x3b745f={};_0x3b745f[_0x35d062]={'$like':'%'+_0x8698e1['query']['filter']+'%'};return _0x3b745f;})});}_0x4c39b5=_[_0xa035('0x45')]({},_0x4c39b5,_0x8698e1[_0xa035('0x47')]);return _0x264b05[_0xa035('0x73')](_0x4c39b5);}})[_0xa035('0x29')](function(_0x558935){if(_0x558935){_0x5567b7=_0x558935['length'];if(!_0x8698e1[_0xa035('0x37')][_0xa035('0x3e')]('nolimit')){_0x4c39b5[_0xa035('0x22')]=qs[_0xa035('0x22')](_0x8698e1[_0xa035('0x37')][_0xa035('0x22')]);_0x4c39b5[_0xa035('0x20')]=qs[_0xa035('0x20')](_0x8698e1[_0xa035('0x37')][_0xa035('0x20')]);}return _0x264b05[_0xa035('0x73')](_0x4c39b5);}})['then'](function(_0x5b2636){if(_0x5b2636){return _0x5b2636?{'count':_0x5567b7,'rows':_0x5b2636}:null;}})['then'](respondWithResult(_0x235188,null))['catch'](handleError(_0x235188,null));}; \ No newline at end of file +var _0x1575=['mkdirSync','directory','0777','user','role','autoAssociation','error','readdirSync','forEach','unlinkSync','Sequelize','ValidationError','message','addSound','Sound','findOne','save_name','converted_format','createdAt','server/files/sounds/converted','format','%s.%s','basename','extname','root','symlinkSync','removeSound','id2','getSounds','nolimit','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','save','update','destroy','then','get','MusicOnHolds','UserProfileResource','stack','name','send','index','map','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','length','order','sort','where','pick','filter','VIRTUAL','merge','VoiceMusicOnHold','include','findAll','rows','catch','params','fields','options','find','body','create','sequelize','transaction','files','join'];(function(_0x373dee,_0x1a8c45){var _0x46798f=function(_0xc389f0){while(--_0xc389f0){_0x373dee['push'](_0x373dee['shift']());}};_0x46798f(++_0x1a8c45);}(_0x1575,0x1da));var _0x5157=function(_0x2532a6,_0x25e8e9){_0x2532a6=_0x2532a6-0x0;var _0x1d6b92=_0x1575[_0x2532a6];return _0x1d6b92;};'use strict';var emlformat=require(_0x5157('0x0'));var rimraf=require(_0x5157('0x1'));var zipdir=require(_0x5157('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5157('0x3'));var moment=require(_0x5157('0x4'));var BPromise=require(_0x5157('0x5'));var Mustache=require('mustache');var util=require(_0x5157('0x6'));var path=require(_0x5157('0x7'));var sox=require(_0x5157('0x8'));var csv=require(_0x5157('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5157('0xa'));var _=require(_0x5157('0xb'));var squel=require(_0x5157('0xc'));var crypto=require(_0x5157('0xd'));var jsforce=require(_0x5157('0xe'));var deskjs=require(_0x5157('0xf'));var toCsv=require(_0x5157('0x9'));var querystring=require('querystring');var Papa=require(_0x5157('0x10'));var Redis=require('ioredis');var authService=require(_0x5157('0x11'));var qs=require(_0x5157('0x12'));var as=require(_0x5157('0x13'));var hardwareService=require(_0x5157('0x14'));var logger=require('../../config/logger')(_0x5157('0x15'));var utils=require(_0x5157('0x16'));var config=require(_0x5157('0x17'));var licenseUtil=require(_0x5157('0x18'));var db=require(_0x5157('0x19'))['db'];function respondWithStatusCode(_0x9f4c8a,_0x5565b2){_0x5565b2=_0x5565b2||0xcc;return function(_0x4d15a0){if(_0x4d15a0){return _0x9f4c8a[_0x5157('0x1a')](_0x5565b2);}return _0x9f4c8a[_0x5157('0x1b')](_0x5565b2)[_0x5157('0x1c')]();};}function respondWithResult(_0x1c0b66,_0x3f8efc){_0x3f8efc=_0x3f8efc||0xc8;return function(_0x3a6f90){if(_0x3a6f90){return _0x1c0b66[_0x5157('0x1b')](_0x3f8efc)['json'](_0x3a6f90);}};}function respondWithFilteredResult(_0x5402a1,_0x5580d1){return function(_0x3153d2){if(_0x3153d2){var _0x4632de=typeof _0x5580d1[_0x5157('0x1d')]===_0x5157('0x1e')&&typeof _0x5580d1[_0x5157('0x1f')]===_0x5157('0x1e');var _0x4e6aa5=_0x3153d2[_0x5157('0x20')];var _0x513044=_0x4632de?0x0:_0x5580d1[_0x5157('0x1d')];var _0x216e84=_0x4632de?_0x3153d2[_0x5157('0x20')]:_0x5580d1[_0x5157('0x1d')]+_0x5580d1[_0x5157('0x1f')];var _0x3e28ce;if(_0x216e84>=_0x4e6aa5){_0x216e84=_0x4e6aa5;_0x3e28ce=0xc8;}else{_0x3e28ce=0xce;}_0x5402a1['status'](_0x3e28ce);return _0x5402a1[_0x5157('0x21')](_0x5157('0x22'),_0x513044+'-'+_0x216e84+'/'+_0x4e6aa5)[_0x5157('0x23')](_0x3153d2);}return null;};}function patchUpdates(_0x11e68c){return function(_0x2a45ba){try{jsonpatch[_0x5157('0x24')](_0x2a45ba,_0x11e68c,!![]);}catch(_0x2b2463){return BPromise['reject'](_0x2b2463);}return _0x2a45ba[_0x5157('0x25')]();};}function saveUpdates(_0x42a474,_0x27a65d){return function(_0x2c83ca){if(_0x2c83ca){return _0x2c83ca[_0x5157('0x26')](_0x42a474)['then'](function(_0x1c81ae){return _0x1c81ae;});}return null;};}function removeEntity(_0x2a6901,_0x293f53){return function(_0x1fa8cf){if(_0x1fa8cf){return _0x1fa8cf[_0x5157('0x27')]()[_0x5157('0x28')](function(){var _0x13ae1b=_0x1fa8cf[_0x5157('0x29')]({'plain':!![]});var _0x551caf=_0x5157('0x2a');return db[_0x5157('0x2b')][_0x5157('0x27')]({'where':{'type':_0x551caf,'resourceId':_0x13ae1b['id']}})[_0x5157('0x28')](function(){return _0x1fa8cf;});})['then'](function(){_0x2a6901[_0x5157('0x1b')](0xcc)[_0x5157('0x1c')]();});}};}function handleEntityNotFound(_0x40f7d7,_0x4d79fc){return function(_0x595ef0){if(!_0x595ef0){_0x40f7d7['sendStatus'](0x194);}return _0x595ef0;};}function handleError(_0x717eb7,_0x5d8436){_0x5d8436=_0x5d8436||0x1f4;return function(_0x424d27){logger['error'](_0x424d27[_0x5157('0x2c')]);if(_0x424d27[_0x5157('0x2d')]){delete _0x424d27[_0x5157('0x2d')];}_0x717eb7[_0x5157('0x1b')](_0x5d8436)[_0x5157('0x2e')](_0x424d27);};}exports[_0x5157('0x2f')]=function(_0x58a962,_0x5da464){var _0x5110f0={},_0x4aabeb={},_0x3d435c={'count':0x0,'rows':[]};var _0x66178d=_[_0x5157('0x30')](db['VoiceMusicOnHold'][_0x5157('0x31')],function(_0x25de4e){return{'name':_0x25de4e['fieldName'],'type':_0x25de4e[_0x5157('0x32')][_0x5157('0x33')]};});_0x4aabeb[_0x5157('0x34')]=_[_0x5157('0x30')](_0x66178d,'name');_0x4aabeb[_0x5157('0x35')]=_[_0x5157('0x36')](_0x58a962['query']);_0x4aabeb[_0x5157('0x37')]=_[_0x5157('0x38')](_0x4aabeb[_0x5157('0x34')],_0x4aabeb['query']);_0x5110f0[_0x5157('0x39')]=_[_0x5157('0x38')](_0x4aabeb[_0x5157('0x34')],qs['fields'](_0x58a962['query']['fields']));_0x5110f0[_0x5157('0x39')]=_0x5110f0['attributes'][_0x5157('0x3a')]?_0x5110f0[_0x5157('0x39')]:_0x4aabeb[_0x5157('0x34')];if(!_0x58a962[_0x5157('0x35')]['hasOwnProperty']('nolimit')){_0x5110f0['limit']=qs[_0x5157('0x1f')](_0x58a962['query'][_0x5157('0x1f')]);_0x5110f0[_0x5157('0x1d')]=qs[_0x5157('0x1d')](_0x58a962['query']['offset']);}_0x5110f0[_0x5157('0x3b')]=qs[_0x5157('0x3c')](_0x58a962[_0x5157('0x35')][_0x5157('0x3c')]);delete _0x58a962['query']['sort'];_0x5110f0[_0x5157('0x3d')]=qs[_0x5157('0x37')](_[_0x5157('0x3e')](_0x58a962[_0x5157('0x35')],_0x4aabeb[_0x5157('0x37')]),_0x66178d);if(_0x58a962[_0x5157('0x35')][_0x5157('0x3f')]){_0x5110f0[_0x5157('0x3d')]=_['merge'](_0x5110f0[_0x5157('0x3d')],{'$or':_[_0x5157('0x30')](_0x66178d,function(_0x5b0149){if(_0x5b0149[_0x5157('0x32')]!==_0x5157('0x40')){var _0x341e1b={};_0x341e1b[_0x5b0149['name']]={'$like':'%'+_0x58a962[_0x5157('0x35')][_0x5157('0x3f')]+'%'};return _0x341e1b;}})});}_0x5110f0=_[_0x5157('0x41')]({},_0x5110f0,_0x58a962['options']);var _0x3d12a0={'where':_0x5110f0[_0x5157('0x3d')]};return db[_0x5157('0x42')][_0x5157('0x20')](_0x3d12a0)[_0x5157('0x28')](function(_0x4e3618){_0x3d435c['count']=_0x4e3618;if(_0x58a962[_0x5157('0x35')]['includeAll']){_0x5110f0[_0x5157('0x43')]=[{'all':!![]}];}return db[_0x5157('0x42')][_0x5157('0x44')](_0x5110f0);})[_0x5157('0x28')](function(_0x2e2ce8){_0x3d435c[_0x5157('0x45')]=_0x2e2ce8;return _0x3d435c;})[_0x5157('0x28')](respondWithFilteredResult(_0x5da464,_0x5110f0))[_0x5157('0x46')](handleError(_0x5da464,null));};exports['show']=function(_0x150abb,_0x3eb3bd){var _0x3d88f8={'raw':![],'where':{'id':_0x150abb[_0x5157('0x47')]['id']}},_0x2d9285={};_0x2d9285[_0x5157('0x34')]=_[_0x5157('0x36')](db['VoiceMusicOnHold'][_0x5157('0x31')]);_0x2d9285['query']=_[_0x5157('0x36')](_0x150abb[_0x5157('0x35')]);_0x2d9285[_0x5157('0x37')]=_[_0x5157('0x38')](_0x2d9285[_0x5157('0x34')],_0x2d9285[_0x5157('0x35')]);_0x3d88f8[_0x5157('0x39')]=_['intersection'](_0x2d9285[_0x5157('0x34')],qs[_0x5157('0x48')](_0x150abb[_0x5157('0x35')][_0x5157('0x48')]));_0x3d88f8[_0x5157('0x39')]=_0x3d88f8[_0x5157('0x39')][_0x5157('0x3a')]?_0x3d88f8[_0x5157('0x39')]:_0x2d9285[_0x5157('0x34')];if(_0x150abb['query']['includeAll']){_0x3d88f8['include']=[{'all':!![]}];}_0x3d88f8=_[_0x5157('0x41')]({},_0x3d88f8,_0x150abb[_0x5157('0x49')]);return db[_0x5157('0x42')][_0x5157('0x4a')](_0x3d88f8)[_0x5157('0x28')](handleEntityNotFound(_0x3eb3bd,null))[_0x5157('0x28')](respondWithResult(_0x3eb3bd,null))[_0x5157('0x46')](handleError(_0x3eb3bd,null));};exports['update']=function(_0x193d7e,_0x15e9d2){if(_0x193d7e[_0x5157('0x4b')]['id']){delete _0x193d7e[_0x5157('0x4b')]['id'];}return db['VoiceMusicOnHold'][_0x5157('0x4a')]({'where':{'id':_0x193d7e[_0x5157('0x47')]['id']}})[_0x5157('0x28')](handleEntityNotFound(_0x15e9d2,null))[_0x5157('0x28')](saveUpdates(_0x193d7e[_0x5157('0x4b')],null))[_0x5157('0x28')](respondWithResult(_0x15e9d2,null))[_0x5157('0x46')](handleError(_0x15e9d2,null));};exports[_0x5157('0x4c')]=function(_0x30c6dd,_0x4a1886,_0x3797a5){return db[_0x5157('0x4d')][_0x5157('0x4e')](function(_0x3a4e67){if(_0x30c6dd[_0x5157('0x4b')]['mode']===_0x5157('0x4f')){_0x30c6dd[_0x5157('0x4b')]['directory']=path[_0x5157('0x50')](config['root'],'server/files/moh',_0x30c6dd[_0x5157('0x4b')][_0x5157('0x2d')]);}return db[_0x5157('0x42')]['create'](_0x30c6dd[_0x5157('0x4b')],{'transaction':_0x3a4e67})['then'](function(_0x2e0775){if(_0x30c6dd[_0x5157('0x4b')]['mode']===_0x5157('0x4f')){fs[_0x5157('0x51')](_0x2e0775[_0x5157('0x52')],parseInt(_0x5157('0x53'),0x8));}var _0x3200e7=_0x30c6dd[_0x5157('0x54')][_0x5157('0x29')]({'plain':!![]});if(!_0x3200e7)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3200e7[_0x5157('0x55')]==='user'){var _0x19e97a=_0x2e0775[_0x5157('0x29')]({'plain':!![]});return db['UserProfileSection'][_0x5157('0x4a')]({'where':{'name':'MusicOnHolds','userProfileId':_0x3200e7['userProfileId']},'raw':!![]})[_0x5157('0x28')](function(_0x15a8ac){if(_0x15a8ac&&_0x15a8ac[_0x5157('0x56')]===0x0){return db['UserProfileResource'][_0x5157('0x4c')]({'name':_0x19e97a[_0x5157('0x2d')],'resourceId':_0x19e97a['id'],'type':_0x15a8ac['name'],'sectionId':_0x15a8ac['id']},{})[_0x5157('0x28')](function(){return _0x2e0775;});}else{return _0x2e0775;}})[_0x5157('0x46')](function(_0x573808){logger[_0x5157('0x57')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x573808);});}return _0x2e0775;});})['then'](respondWithResult(_0x4a1886,0xc9))[_0x5157('0x46')](handleError(_0x4a1886,null));};exports['destroy']=function(_0x41e553,_0x3cfafd,_0x34746c){var _0x1efc8e;return db[_0x5157('0x42')][_0x5157('0x4a')]({'where':{'id':_0x41e553[_0x5157('0x47')]['id']}})[_0x5157('0x28')](function(_0x555023){if(_0x555023){return db[_0x5157('0x4d')][_0x5157('0x4e')](function(_0x43b3bc){return _0x555023[_0x5157('0x27')]({'transaction':_0x43b3bc,'raw':!![]})[_0x5157('0x28')](function(_0x3c6d16){if(_0x3c6d16[_0x5157('0x52')]){fs[_0x5157('0x58')](_0x3c6d16[_0x5157('0x52')])[_0x5157('0x59')](function(_0x3f88f6){fs[_0x5157('0x5a')](path[_0x5157('0x50')](_0x3c6d16[_0x5157('0x52')],_0x3f88f6));});fs['rmdirSync'](_0x3c6d16[_0x5157('0x52')]);}return _0x3c6d16;});})[_0x5157('0x46')](function(_0x2d8245){throw new db[(_0x5157('0x5b'))][(_0x5157('0x5c'))](_0x2d8245[_0x5157('0x5d')]);});}})['then'](handleEntityNotFound(_0x3cfafd,null))[_0x5157('0x28')](removeEntity(_0x3cfafd,null))[_0x5157('0x46')](handleError(_0x3cfafd,null));};exports['addSound']=function(_0x144fec,_0x48c49b,_0x2f0554){return db[_0x5157('0x4d')][_0x5157('0x4e')](function(_0x843ab0){var _0x40e2c2;return db[_0x5157('0x42')][_0x5157('0x4a')]({'where':{'id':_0x144fec[_0x5157('0x47')]['id']}})[_0x5157('0x28')](function(_0x413fca){if(_0x413fca){_0x40e2c2=_0x413fca;return _0x413fca[_0x5157('0x5e')](_0x144fec[_0x5157('0x4b')]['id'],{'transaction':_0x843ab0});}})[_0x5157('0x28')](function(_0x159494){if(_0x159494){return db[_0x5157('0x5f')][_0x5157('0x60')]({'where':{'id':_0x144fec[_0x5157('0x4b')]['id']},'attributes':['id',_0x5157('0x2d'),_0x5157('0x61'),_0x5157('0x62'),_0x5157('0x63')],'raw':!![]});}})[_0x5157('0x28')](function(_0x406885){if(_0x406885){var _0x2f3ef7=path[_0x5157('0x50')](config['root'],_0x5157('0x64'),util[_0x5157('0x65')](_0x5157('0x66'),path[_0x5157('0x67')](_0x406885[_0x5157('0x61')],path[_0x5157('0x68')](_0x406885[_0x5157('0x61')])),_0x406885['converted_format']));var _0x4c0c13=path[_0x5157('0x50')](config[_0x5157('0x69')],'server/files/moh',_0x40e2c2[_0x5157('0x2d')],util[_0x5157('0x65')](_0x5157('0x66'),_0x406885['name'],_0x406885[_0x5157('0x62')]));fs[_0x5157('0x6a')](_0x2f3ef7,_0x4c0c13);return _0x406885;}})[_0x5157('0x46')](function(_0x2cd462){throw new db[(_0x5157('0x5b'))]['ValidationError'](_0x2cd462['message']);});})[_0x5157('0x28')](handleEntityNotFound(_0x48c49b,null))[_0x5157('0x28')](respondWithResult(_0x48c49b,0xc9))['catch'](handleError(_0x48c49b,null));};exports[_0x5157('0x6b')]=function(_0x12e85d,_0x1d2ea4,_0x546b8b){return db[_0x5157('0x4d')][_0x5157('0x4e')](function(_0x5694b3){var _0x393593;return db[_0x5157('0x42')][_0x5157('0x60')]({'where':{'id':_0x12e85d[_0x5157('0x47')]['id']}})[_0x5157('0x28')](handleEntityNotFound(_0x1d2ea4,null))['then'](function(_0x2f5e90){if(_0x2f5e90){_0x393593=_0x2f5e90;return _0x2f5e90[_0x5157('0x6b')](_0x12e85d[_0x5157('0x47')][_0x5157('0x6c')]);}})[_0x5157('0x28')](function(_0x2418de){if(_0x2418de){return db[_0x5157('0x5f')]['findOne']({'where':{'id':_0x12e85d[_0x5157('0x47')][_0x5157('0x6c')]},'attributes':['id',_0x5157('0x2d'),_0x5157('0x61'),_0x5157('0x62'),'createdAt'],'raw':!![]});}})['then'](function(_0x2dc30d){if(_0x2dc30d){fs[_0x5157('0x5a')](path[_0x5157('0x50')](_0x393593[_0x5157('0x52')],util['format']('%s.%s',_0x2dc30d[_0x5157('0x2d')],_0x2dc30d[_0x5157('0x62')])));return _0x2dc30d;}})[_0x5157('0x46')](function(_0x6e9382){throw new db[(_0x5157('0x5b'))][(_0x5157('0x5c'))](_0x6e9382[_0x5157('0x5d')]);});})['then'](handleEntityNotFound(_0x1d2ea4,null))[_0x5157('0x28')](respondWithStatusCode(_0x1d2ea4,0xcc))[_0x5157('0x46')](handleError(_0x1d2ea4,null));};exports[_0x5157('0x6d')]=function(_0x556db6,_0x2c0779,_0x19be93){var _0xc4bdfc={};var _0xae4571={};var _0x2b9935;var _0x2f7ed3;return db[_0x5157('0x42')][_0x5157('0x60')]({'where':{'id':_0x556db6[_0x5157('0x47')]['id']}})[_0x5157('0x28')](handleEntityNotFound(_0x2c0779,null))[_0x5157('0x28')](function(_0x2daf1e){if(_0x2daf1e){_0x2b9935=_0x2daf1e;_0xae4571[_0x5157('0x34')]=_[_0x5157('0x36')](db[_0x5157('0x5f')][_0x5157('0x31')]);_0xae4571[_0x5157('0x35')]=_[_0x5157('0x36')](_0x556db6[_0x5157('0x35')]);_0xae4571['filters']=_[_0x5157('0x38')](_0xae4571[_0x5157('0x34')],_0xae4571[_0x5157('0x35')]);_0xc4bdfc[_0x5157('0x39')]=_[_0x5157('0x38')](_0xae4571['model'],qs[_0x5157('0x48')](_0x556db6[_0x5157('0x35')][_0x5157('0x48')]));_0xc4bdfc['attributes']=_0xc4bdfc[_0x5157('0x39')][_0x5157('0x3a')]?_0xc4bdfc[_0x5157('0x39')]:_0xae4571[_0x5157('0x34')];_0xc4bdfc[_0x5157('0x3b')]=qs['sort'](_0x556db6['query'][_0x5157('0x3c')]);_0xc4bdfc[_0x5157('0x3d')]=qs[_0x5157('0x37')](_[_0x5157('0x3e')](_0x556db6[_0x5157('0x35')],_0xae4571[_0x5157('0x37')]));if(_0x556db6[_0x5157('0x35')]['filter']){_0xc4bdfc[_0x5157('0x3d')]=_['merge'](_0xc4bdfc['where'],{'$or':_[_0x5157('0x30')](_0xc4bdfc[_0x5157('0x39')],function(_0x40d3c4){var _0x56415a={};_0x56415a[_0x40d3c4]={'$like':'%'+_0x556db6[_0x5157('0x35')]['filter']+'%'};return _0x56415a;})});}_0xc4bdfc=_[_0x5157('0x41')]({},_0xc4bdfc,_0x556db6[_0x5157('0x49')]);return _0x2b9935[_0x5157('0x6d')](_0xc4bdfc);}})[_0x5157('0x28')](function(_0x1ca997){if(_0x1ca997){_0x2f7ed3=_0x1ca997[_0x5157('0x3a')];if(!_0x556db6[_0x5157('0x35')]['hasOwnProperty'](_0x5157('0x6e'))){_0xc4bdfc[_0x5157('0x1f')]=qs[_0x5157('0x1f')](_0x556db6[_0x5157('0x35')]['limit']);_0xc4bdfc[_0x5157('0x1d')]=qs[_0x5157('0x1d')](_0x556db6[_0x5157('0x35')][_0x5157('0x1d')]);}return _0x2b9935[_0x5157('0x6d')](_0xc4bdfc);}})['then'](function(_0x5e6dd7){if(_0x5e6dd7){return _0x5e6dd7?{'count':_0x2f7ed3,'rows':_0x5e6dd7}:null;}})[_0x5157('0x28')](respondWithResult(_0x2c0779,null))[_0x5157('0x46')](handleError(_0x2c0779,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index 925fc1b..88deffc 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 _0x9911=['define','VoiceMusicOnHold','voice_musiconhold','util','api','moment','bluebird','rimraf','../../config/environment','./voiceMusicOnHold.attributes'];(function(_0x16b9ed,_0x56517a){var _0x66b1f8=function(_0x1c883){while(--_0x1c883){_0x16b9ed['push'](_0x16b9ed['shift']());}};_0x66b1f8(++_0x56517a);}(_0x9911,0xc1));var _0x1991=function(_0x181777,_0x226350){_0x181777=_0x181777-0x0;var _0x43c330=_0x9911[_0x181777];return _0x43c330;};'use strict';var _=require('lodash');var util=require(_0x1991('0x0'));var logger=require('../../config/logger')(_0x1991('0x1'));var moment=require(_0x1991('0x2'));var BPromise=require(_0x1991('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x1991('0x4'));var config=require(_0x1991('0x5'));var attributes=require(_0x1991('0x6'));module['exports']=function(_0x339a70,_0x5ea7d6){return _0x339a70[_0x1991('0x7')](_0x1991('0x8'),attributes,{'tableName':_0x1991('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc9c5=['../../config/environment','./voiceMusicOnHold.attributes','exports','define','VoiceMusicOnHold','voice_musiconhold','lodash','api','moment','bluebird','path'];(function(_0x80e80,_0x3c044b){var _0xa774b8=function(_0x70e45d){while(--_0x70e45d){_0x80e80['push'](_0x80e80['shift']());}};_0xa774b8(++_0x3c044b);}(_0xc9c5,0x150));var _0x5c9c=function(_0x55cdc5,_0x2b2297){_0x55cdc5=_0x55cdc5-0x0;var _0x29acd5=_0xc9c5[_0x55cdc5];return _0x29acd5;};'use strict';var _=require(_0x5c9c('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x5c9c('0x1'));var moment=require(_0x5c9c('0x2'));var BPromise=require(_0x5c9c('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5c9c('0x4'));var rimraf=require('rimraf');var config=require(_0x5c9c('0x5'));var attributes=require(_0x5c9c('0x6'));module[_0x5c9c('0x7')]=function(_0x55bf4a,_0x2d13e1){return _0x55bf4a[_0x5c9c('0x8')](_0x5c9c('0x9'),attributes,{'tableName':_0x5c9c('0xa'),'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 826c30a..b198951 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 _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(_0x44cb4c,_0x587962){var _0x40adca=function(_0x15ebc7){while(--_0x15ebc7){_0x44cb4c['push'](_0x44cb4c['shift']());}};_0x40adca(++_0x587962);}(_0xedd9,0xfc));var _0x9edd=function(_0x5db499,_0x336195){_0x5db499=_0x5db499-0x0;var _0xac20f3=_0xedd9[_0x5db499];return _0xac20f3;};'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 +var _0x0713=['VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0xb3086f,_0x1d3710){var _0x3b4f7a=function(_0x416735){while(--_0x416735){_0xb3086f['push'](_0xb3086f['shift']());}};_0x3b4f7a(++_0x1d3710);}(_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 moment=require(_0x3071('0x0'));var BPromise=require(_0x3071('0x1'));var rs=require(_0x3071('0x2'));var fs=require('fs');var Redis=require(_0x3071('0x3'));var db=require(_0x3071('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x3071('0x5'))(_0x3071('0x6'));var config=require(_0x3071('0x7'));var jayson=require(_0x3071('0x8'));var client=jayson[_0x3071('0x9')][_0x3071('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1d3dd6,_0x2f1e87,_0xbd737f){return new BPromise(function(_0x22274c,_0x3e9a5e){return client[_0x3071('0xb')](_0x1d3dd6,_0xbd737f)[_0x3071('0xc')](function(_0x4a36ec){logger[_0x3071('0xd')](_0x3071('0xe'),_0x2f1e87,_0x3071('0xf'));logger[_0x3071('0x10')](_0x3071('0x11'),_0x2f1e87,'request\x20sent',JSON[_0x3071('0x12')](_0x4a36ec));if(_0x4a36ec[_0x3071('0x13')]){if(_0x4a36ec[_0x3071('0x13')][_0x3071('0x14')]===0x1f4){logger[_0x3071('0x13')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec['error'][_0x3071('0x15')]);return _0x3e9a5e(_0x4a36ec['error'][_0x3071('0x15')]);}logger[_0x3071('0x13')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec[_0x3071('0x13')]['message']);return _0x22274c(_0x4a36ec[_0x3071('0x13')][_0x3071('0x15')]);}else{logger[_0x3071('0xd')](_0x3071('0xe'),_0x2f1e87,_0x3071('0xf'));_0x22274c(_0x4a36ec[_0x3071('0x16')][_0x3071('0x15')]);}})[_0x3071('0x17')](function(_0x21aad3){logger[_0x3071('0x13')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x2f1e87,_0x21aad3);_0x3e9a5e(_0x21aad3);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/index.js b/server/api/voicePrefix/index.js index 0361c4b..74e81fa 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 _0xb91a=['getTeams','post','create','addAgents','addTeams','put','update','delete','/:id','destroy','removeTeams','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voicePrefix.controller','get','isAuthenticated','index','describe','show','/:id/users','getAgents','/:id/teams'];(function(_0x39d474,_0x280fb6){var _0x5915ca=function(_0x5233c1){while(--_0x5233c1){_0x39d474['push'](_0x39d474['shift']());}};_0x5915ca(++_0x280fb6);}(_0xb91a,0xf4));var _0xab91=function(_0x408c7e,_0x4013ad){_0x408c7e=_0x408c7e-0x0;var _0x1c94f=_0xb91a[_0x408c7e];return _0x1c94f;};'use strict';var multer=require(_0xab91('0x0'));var util=require(_0xab91('0x1'));var path=require(_0xab91('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xab91('0x3')]();var fs_extra=require(_0xab91('0x4'));var auth=require(_0xab91('0x5'));var interaction=require(_0xab91('0x6'));var config=require(_0xab91('0x7'));var controller=require(_0xab91('0x8'));router[_0xab91('0x9')]('/',auth[_0xab91('0xa')](),controller[_0xab91('0xb')]);router[_0xab91('0x9')]('/describe',auth[_0xab91('0xa')](),controller[_0xab91('0xc')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xab91('0xd')]);router[_0xab91('0x9')](_0xab91('0xe'),auth[_0xab91('0xa')](),controller[_0xab91('0xf')]);router[_0xab91('0x9')](_0xab91('0x10'),auth[_0xab91('0xa')](),controller[_0xab91('0x11')]);router[_0xab91('0x12')]('/',auth[_0xab91('0xa')](),controller[_0xab91('0x13')]);router[_0xab91('0x12')]('/:id/users',auth['isAuthenticated'](),controller[_0xab91('0x14')]);router[_0xab91('0x12')](_0xab91('0x10'),auth[_0xab91('0xa')](),controller[_0xab91('0x15')]);router[_0xab91('0x16')]('/:id',auth['isAuthenticated'](),controller[_0xab91('0x17')]);router[_0xab91('0x18')](_0xab91('0x19'),auth[_0xab91('0xa')](),controller[_0xab91('0x1a')]);router[_0xab91('0x18')](_0xab91('0xe'),auth[_0xab91('0xa')](),controller['removeAgents']);router['delete'](_0xab91('0x10'),auth['isAuthenticated'](),controller[_0xab91('0x1b')]);module[_0xab91('0x1c')]=router; \ No newline at end of file +var _0xd6d6=['../../components/auth/service','../../components/interaction/service','../../config/environment','./voicePrefix.controller','get','index','/describe','isAuthenticated','describe','/:id','/:id/users','getAgents','getTeams','create','post','addAgents','/:id/teams','put','update','delete','removeTeams','exports','multer','util','path','connect-timeout','Router','fs-extra'];(function(_0x5f7c05,_0x55ef27){var _0x58fcdc=function(_0x2a5d99){while(--_0x2a5d99){_0x5f7c05['push'](_0x5f7c05['shift']());}};_0x58fcdc(++_0x55ef27);}(_0xd6d6,0xbe));var _0x6d6d=function(_0x4f2c68,_0x18d1b2){_0x4f2c68=_0x4f2c68-0x0;var _0x42234f=_0xd6d6[_0x4f2c68];return _0x42234f;};'use strict';var multer=require(_0x6d6d('0x0'));var util=require(_0x6d6d('0x1'));var path=require(_0x6d6d('0x2'));var timeout=require(_0x6d6d('0x3'));var express=require('express');var router=express[_0x6d6d('0x4')]();var fs_extra=require(_0x6d6d('0x5'));var auth=require(_0x6d6d('0x6'));var interaction=require(_0x6d6d('0x7'));var config=require(_0x6d6d('0x8'));var controller=require(_0x6d6d('0x9'));router[_0x6d6d('0xa')]('/',auth['isAuthenticated'](),controller[_0x6d6d('0xb')]);router[_0x6d6d('0xa')](_0x6d6d('0xc'),auth[_0x6d6d('0xd')](),controller[_0x6d6d('0xe')]);router[_0x6d6d('0xa')](_0x6d6d('0xf'),auth['isAuthenticated'](),controller['show']);router[_0x6d6d('0xa')](_0x6d6d('0x10'),auth[_0x6d6d('0xd')](),controller[_0x6d6d('0x11')]);router[_0x6d6d('0xa')]('/:id/teams',auth[_0x6d6d('0xd')](),controller[_0x6d6d('0x12')]);router['post']('/',auth['isAuthenticated'](),controller[_0x6d6d('0x13')]);router[_0x6d6d('0x14')](_0x6d6d('0x10'),auth[_0x6d6d('0xd')](),controller[_0x6d6d('0x15')]);router[_0x6d6d('0x14')](_0x6d6d('0x16'),auth[_0x6d6d('0xd')](),controller['addTeams']);router[_0x6d6d('0x17')](_0x6d6d('0xf'),auth[_0x6d6d('0xd')](),controller[_0x6d6d('0x18')]);router[_0x6d6d('0x19')]('/:id',auth[_0x6d6d('0xd')](),controller['destroy']);router[_0x6d6d('0x19')](_0x6d6d('0x10'),auth[_0x6d6d('0xd')](),controller['removeAgents']);router['delete'](_0x6d6d('0x16'),auth[_0x6d6d('0xd')](),controller[_0x6d6d('0x1a')]);module[_0x6d6d('0x1b')]=router; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.attributes.js b/server/api/voicePrefix/voicePrefix.attributes.js index 541e506..916ed84 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 _0xfa40=['getDataValue','name','INTEGER','sequelize','STRING','VIRTUAL','system-'];(function(_0x38fb0d,_0x52b5db){var _0x30a5d6=function(_0x31eba6){while(--_0x31eba6){_0x38fb0d['push'](_0x38fb0d['shift']());}};_0x30a5d6(++_0x52b5db);}(_0xfa40,0xce));var _0x0fa4=function(_0x3c2a69,_0x4c8b41){_0x3c2a69=_0x3c2a69-0x0;var _0x596bc8=_0xfa40[_0x3c2a69];return _0x596bc8;};'use strict';var Sequelize=require(_0x0fa4('0x0'));module['exports']={'name':{'type':Sequelize[_0x0fa4('0x1')],'allowNull':![],'unique':'name'},'prefix':{'type':Sequelize[_0x0fa4('0x2')],'get':function(_0x2910fa){return _0x0fa4('0x3')+this[_0x0fa4('0x4')](_0x0fa4('0x5'))+'-';}},'description':{'type':Sequelize[_0x0fa4('0x1')]},'callerIdAll':{'type':Sequelize[_0x0fa4('0x1')]},'VoiceExtensionId':{'type':Sequelize[_0x0fa4('0x6')]}}; \ No newline at end of file +var _0x2d49=['exports','STRING','name','VIRTUAL','INTEGER'];(function(_0x5834bc,_0x3d4801){var _0x3e183a=function(_0x18b023){while(--_0x18b023){_0x5834bc['push'](_0x5834bc['shift']());}};_0x3e183a(++_0x3d4801);}(_0x2d49,0xc8));var _0x92d4=function(_0x1a9e10,_0x113c78){_0x1a9e10=_0x1a9e10-0x0;var _0x32707a=_0x2d49[_0x1a9e10];return _0x32707a;};'use strict';var Sequelize=require('sequelize');module[_0x92d4('0x0')]={'name':{'type':Sequelize[_0x92d4('0x1')],'allowNull':![],'unique':_0x92d4('0x2')},'prefix':{'type':Sequelize[_0x92d4('0x3')],'get':function(_0x4e3023){return'system-'+this['getDataValue'](_0x92d4('0x2'))+'-';}},'description':{'type':Sequelize[_0x92d4('0x1')]},'callerIdAll':{'type':Sequelize['STRING']},'VoiceExtensionId':{'type':Sequelize[_0x92d4('0x4')]}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index 53e647f..2ae61d8 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 _0xda2d=['UserProfileResource','destroy','stack','name','index','fieldName','type','key','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','where','merge','VIRTUAL','filter','VoicePrefix','includeAll','findAll','catch','show','params','rawAttributes','include','find','describe','create','sequelize','body','VoiceExtension','VoiceExtensionId','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','system','description','Voice\x20Prefix\x20Extension','priority','appdata','prefix','NoOp','Voice\x20Prefix','VoicePrefixId','bulkCreate','push','Set','PREFIX-CALLERIDALL=','${EXTEN:','charAt','update','system-','transaction','findById','addAgents','ids','omit','spread','emit','removeAgents','isArray','userVoicePrefix:remove','getAgents','User','options','getTeams','findOne','Team','online','voicePause','interface','flatMap','Agents','addTeams','each','UserVoicePrefix','forEach','userVoicePrefix:save','removeTeams','field','tq.TeamId','from','user_has_teams','VoicePrefixId\x20=\x20?','clone','toString','TeamId','includes','all','union','compact','value','isEmpty','rimraf','zip-dir','fast-json-patch','request-promise','moment','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','defaults','redis','localhost','socket.io-emitter','./voicePrefix.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','then','get','VoicePrefixes'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xda2d,0x102));var _0xdda2=function(_0x283e36,_0x4db06e){_0x283e36=_0x283e36-0x0;var _0x1d86f5=_0xda2d[_0x283e36];return _0x1d86f5;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xdda2('0x0'));var zipdir=require(_0xdda2('0x1'));var jsonpatch=require(_0xdda2('0x2'));var rp=require(_0xdda2('0x3'));var moment=require(_0xdda2('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xdda2('0x5'));var sox=require(_0xdda2('0x6'));var csv=require(_0xdda2('0x7'));var ejs=require(_0xdda2('0x8'));var fs=require('fs');var fs_extra=require(_0xdda2('0x9'));var _=require(_0xdda2('0xa'));var squel=require(_0xdda2('0xb'));var crypto=require(_0xdda2('0xc'));var jsforce=require(_0xdda2('0xd'));var deskjs=require(_0xdda2('0xe'));var toCsv=require('to-csv');var querystring=require(_0xdda2('0xf'));var Papa=require(_0xdda2('0x10'));var Redis=require('ioredis');var authService=require(_0xdda2('0x11'));var qs=require(_0xdda2('0x12'));var as=require(_0xdda2('0x13'));var hardwareService=require(_0xdda2('0x14'));var logger=require(_0xdda2('0x15'))(_0xdda2('0x16'));var utils=require(_0xdda2('0x17'));var config=require(_0xdda2('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config['redis']=_[_0xdda2('0x19')](config[_0xdda2('0x1a')],{'host':_0xdda2('0x1b'),'port':0x18eb});var socket=require(_0xdda2('0x1c'))(new Redis(config[_0xdda2('0x1a')]));require(_0xdda2('0x1d'))[_0xdda2('0x1e')](socket);function respondWithStatusCode(_0x4df902,_0x79c6d4){_0x79c6d4=_0x79c6d4||0xcc;return function(_0x4b0220){if(_0x4b0220){return _0x4df902[_0xdda2('0x1f')](_0x79c6d4);}return _0x4df902[_0xdda2('0x20')](_0x79c6d4)[_0xdda2('0x21')]();};}function respondWithResult(_0x457764,_0x1922b1){_0x1922b1=_0x1922b1||0xc8;return function(_0x5d8a83){if(_0x5d8a83){return _0x457764['status'](_0x1922b1)[_0xdda2('0x22')](_0x5d8a83);}};}function respondWithFilteredResult(_0x518c6d,_0x1a5192){return function(_0x1a3b35){if(_0x1a3b35){var _0x335fb5=typeof _0x1a5192[_0xdda2('0x23')]===_0xdda2('0x24')&&typeof _0x1a5192[_0xdda2('0x25')]===_0xdda2('0x24');var _0x351151=_0x1a3b35[_0xdda2('0x26')];var _0x337b0b=_0x335fb5?0x0:_0x1a5192[_0xdda2('0x23')];var _0x6fdede=_0x335fb5?_0x1a3b35['count']:_0x1a5192[_0xdda2('0x23')]+_0x1a5192['limit'];var _0xc4567c;if(_0x6fdede>=_0x351151){_0x6fdede=_0x351151;_0xc4567c=0xc8;}else{_0xc4567c=0xce;}_0x518c6d[_0xdda2('0x20')](_0xc4567c);return _0x518c6d[_0xdda2('0x27')]('Content-Range',_0x337b0b+'-'+_0x6fdede+'/'+_0x351151)[_0xdda2('0x22')](_0x1a3b35);}return null;};}function patchUpdates(_0x5a9bb8){return function(_0x425489){try{jsonpatch[_0xdda2('0x28')](_0x425489,_0x5a9bb8,!![]);}catch(_0x4ac3eb){return BPromise[_0xdda2('0x29')](_0x4ac3eb);}return _0x425489[_0xdda2('0x2a')]();};}function saveUpdates(_0x2528d7,_0x13b0f3){return function(_0x45ee9d){if(_0x45ee9d){return _0x45ee9d['update'](_0x2528d7)[_0xdda2('0x2b')](function(_0x4be5ea){return _0x4be5ea;});}return null;};}function removeEntity(_0x2391a5,_0x31d48b){return function(_0x5436d1){if(_0x5436d1){return _0x5436d1['destroy']()[_0xdda2('0x2b')](function(){var _0x4567e7=_0x5436d1[_0xdda2('0x2c')]({'plain':!![]});var _0x5e9e74=_0xdda2('0x2d');return db[_0xdda2('0x2e')][_0xdda2('0x2f')]({'where':{'type':_0x5e9e74,'resourceId':_0x4567e7['id']}})[_0xdda2('0x2b')](function(){return _0x5436d1;});})[_0xdda2('0x2b')](function(){_0x2391a5[_0xdda2('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x24c37d,_0x255bbc){return function(_0x53acb5){if(!_0x53acb5){_0x24c37d[_0xdda2('0x1f')](0x194);}return _0x53acb5;};}function handleError(_0x2cfaca,_0x3b18b8){_0x3b18b8=_0x3b18b8||0x1f4;return function(_0x15e511){logger['error'](_0x15e511[_0xdda2('0x30')]);if(_0x15e511[_0xdda2('0x31')]){delete _0x15e511['name'];}_0x2cfaca[_0xdda2('0x20')](_0x3b18b8)['send'](_0x15e511);};}exports[_0xdda2('0x32')]=function(_0x55809a,_0x53ff76){var _0x510b7b={},_0x239c25={},_0x5bfc17={'count':0x0,'rows':[]};var _0x1b13f4=_['map'](db['VoicePrefix']['rawAttributes'],function(_0x4637c1){return{'name':_0x4637c1[_0xdda2('0x33')],'type':_0x4637c1[_0xdda2('0x34')][_0xdda2('0x35')]};});_0x239c25[_0xdda2('0x36')]=_[_0xdda2('0x37')](_0x1b13f4,_0xdda2('0x31'));_0x239c25[_0xdda2('0x38')]=_[_0xdda2('0x39')](_0x55809a[_0xdda2('0x38')]);_0x239c25['filters']=_[_0xdda2('0x3a')](_0x239c25[_0xdda2('0x36')],_0x239c25[_0xdda2('0x38')]);_0x510b7b[_0xdda2('0x3b')]=_[_0xdda2('0x3a')](_0x239c25[_0xdda2('0x36')],qs[_0xdda2('0x3c')](_0x55809a['query']['fields']));_0x510b7b[_0xdda2('0x3b')]=_0x510b7b[_0xdda2('0x3b')][_0xdda2('0x3d')]?_0x510b7b['attributes']:_0x239c25['model'];if(!_0x55809a[_0xdda2('0x38')][_0xdda2('0x3e')](_0xdda2('0x3f'))){_0x510b7b[_0xdda2('0x25')]=qs[_0xdda2('0x25')](_0x55809a['query'][_0xdda2('0x25')]);_0x510b7b[_0xdda2('0x23')]=qs['offset'](_0x55809a['query'][_0xdda2('0x23')]);}_0x510b7b[_0xdda2('0x40')]=qs[_0xdda2('0x41')](_0x55809a[_0xdda2('0x38')][_0xdda2('0x41')]);_0x510b7b['where']=qs[_0xdda2('0x42')](_[_0xdda2('0x43')](_0x55809a[_0xdda2('0x38')],_0x239c25[_0xdda2('0x42')]),_0x1b13f4);if(_0x55809a['query']['filter']){_0x510b7b[_0xdda2('0x44')]=_[_0xdda2('0x45')](_0x510b7b[_0xdda2('0x44')],{'$or':_['map'](_0x1b13f4,function(_0x1bb2a7){if(_0x1bb2a7['type']!==_0xdda2('0x46')){var _0x4c68d7={};_0x4c68d7[_0x1bb2a7[_0xdda2('0x31')]]={'$like':'%'+_0x55809a[_0xdda2('0x38')][_0xdda2('0x47')]+'%'};return _0x4c68d7;}})});}_0x510b7b=_[_0xdda2('0x45')]({},_0x510b7b,_0x55809a['options']);var _0x1c5195={'where':_0x510b7b['where']};return db[_0xdda2('0x48')]['count'](_0x1c5195)[_0xdda2('0x2b')](function(_0x12589b){_0x5bfc17[_0xdda2('0x26')]=_0x12589b;if(_0x55809a[_0xdda2('0x38')][_0xdda2('0x49')]){_0x510b7b['include']=[{'all':!![]}];}return db[_0xdda2('0x48')][_0xdda2('0x4a')](_0x510b7b);})['then'](function(_0x2caced){_0x5bfc17['rows']=_0x2caced;return _0x5bfc17;})[_0xdda2('0x2b')](respondWithFilteredResult(_0x53ff76,_0x510b7b))[_0xdda2('0x4b')](handleError(_0x53ff76,null));};exports[_0xdda2('0x4c')]=function(_0x355b6a,_0x3f1f9b){var _0x6718ea={'raw':![],'where':{'id':_0x355b6a[_0xdda2('0x4d')]['id']}},_0x550351={};_0x550351[_0xdda2('0x36')]=_[_0xdda2('0x39')](db[_0xdda2('0x48')][_0xdda2('0x4e')]);_0x550351[_0xdda2('0x38')]=_['keys'](_0x355b6a['query']);_0x550351['filters']=_[_0xdda2('0x3a')](_0x550351[_0xdda2('0x36')],_0x550351['query']);_0x6718ea[_0xdda2('0x3b')]=_[_0xdda2('0x3a')](_0x550351[_0xdda2('0x36')],qs['fields'](_0x355b6a[_0xdda2('0x38')][_0xdda2('0x3c')]));_0x6718ea['attributes']=_0x6718ea['attributes'][_0xdda2('0x3d')]?_0x6718ea['attributes']:_0x550351[_0xdda2('0x36')];if(_0x355b6a['query'][_0xdda2('0x49')]){_0x6718ea[_0xdda2('0x4f')]=[{'all':!![]}];}_0x6718ea=_['merge']({},_0x6718ea,_0x355b6a['options']);return db[_0xdda2('0x48')][_0xdda2('0x50')](_0x6718ea)[_0xdda2('0x2b')](handleEntityNotFound(_0x3f1f9b,null))[_0xdda2('0x2b')](respondWithResult(_0x3f1f9b,null))['catch'](handleError(_0x3f1f9b,null));};exports[_0xdda2('0x2f')]=function(_0x3bba94,_0x3d2cb0){return db[_0xdda2('0x48')][_0xdda2('0x50')]({'where':{'id':_0x3bba94['params']['id']}})[_0xdda2('0x2b')](handleEntityNotFound(_0x3d2cb0,null))[_0xdda2('0x2b')](removeEntity(_0x3d2cb0,null))['catch'](handleError(_0x3d2cb0,null));};exports[_0xdda2('0x51')]=function(_0x123c2d,_0x143670){return db[_0xdda2('0x48')][_0xdda2('0x51')]()[_0xdda2('0x2b')](respondWithResult(_0x143670,null))['catch'](handleError(_0x143670,null));};exports[_0xdda2('0x52')]=function(_0x4a9814,_0x361038){var _0x4a70ff;return db[_0xdda2('0x53')]['transaction'](function(_0x3b5bbf){return db[_0xdda2('0x48')][_0xdda2('0x52')](_0x4a9814[_0xdda2('0x54')],{'transaction':_0x3b5bbf})[_0xdda2('0x2b')](function(_0x2b45f3){_0x4a70ff=_0x2b45f3[_0xdda2('0x2c')]({'plain':!![]});return db[_0xdda2('0x55')]['find']({'where':{'id':_0x4a70ff[_0xdda2('0x56')]},'raw':!![]})[_0xdda2('0x2b')](function(_0x1b24f2){return createVoicePrefixExtensions(_0x4a70ff,_0x1b24f2,_0x3b5bbf);});});})['then'](function(){var _0xf380b0=_0x4a9814[_0xdda2('0x57')]['get']({'plain':!![]});if(!_0xf380b0)throw new Error(_0xdda2('0x58'));if(_0xf380b0['role']===_0xdda2('0x57')){var _0x10fbac=_0x4a70ff;return db[_0xdda2('0x59')][_0xdda2('0x50')]({'where':{'name':_0xdda2('0x2d'),'userProfileId':_0xf380b0['userProfileId']},'raw':!![]})['then'](function(_0x5c2cb2){if(_0x5c2cb2&&_0x5c2cb2[_0xdda2('0x5a')]===0x0){return db[_0xdda2('0x2e')]['create']({'name':_0x10fbac[_0xdda2('0x31')],'resourceId':_0x10fbac['id'],'type':_0x5c2cb2[_0xdda2('0x31')],'sectionId':_0x5c2cb2['id']},{})[_0xdda2('0x2b')](function(){return _0x4a70ff;});}else{return _0x4a70ff;}})['catch'](function(_0x3fd76c){logger[_0xdda2('0x5b')](_0xdda2('0x5c'),_0x3fd76c);throw _0x3fd76c;});}return _0x4a70ff;})['then'](respondWithResult(_0x361038,null))[_0xdda2('0x4b')](handleError(_0x361038,null));};function Extension(_0x4495e5,_0x7eb83f,_0x25c9a9,_0x5d8602){this[_0xdda2('0x5d')]='from-sip';this['exten']=_0x4495e5;this['app']=_0x25c9a9;this[_0xdda2('0x34')]=_0xdda2('0x5e');this[_0xdda2('0x5f')]=_0xdda2('0x60');this[_0xdda2('0x61')]=_0x7eb83f;this[_0xdda2('0x62')]=_0x5d8602;}function createVoicePrefixExtensions(_0x29a739,_0x3ac33a,_0x269ad1){return new BPromise(function(_0x138c2f,_0x26e7de){var _0x5e6dcf=new Extension(formatPrefixName(_0x29a739[_0xdda2('0x63')]),0x1,_0xdda2('0x64'),_0xdda2('0x65'));_0x5e6dcf[_0xdda2('0x66')]=_0x29a739['id'];return db[_0xdda2('0x55')][_0xdda2('0x52')](_0x5e6dcf,{'transaction':_0x269ad1})[_0xdda2('0x2b')](function(_0x57fb41){var _0x23518f=_0x57fb41[_0xdda2('0x2c')]({'plain':!![]});var _0x19e650=_[_0xdda2('0x37')](addVoicePrefixExtensions(_0x29a739,_0x3ac33a),function(_0x44f619){_0x44f619['VoiceExtensionId']=_0x23518f['id'];_0x44f619[_0xdda2('0x66')]=_0x29a739['id'];return _0x44f619;});return db[_0xdda2('0x55')][_0xdda2('0x67')](_0x19e650,{'transaction':_0x269ad1})[_0xdda2('0x2b')](function(_0x21d0e4){if(!_0x21d0e4){return _0x26e7de('Extensions\x20creation\x20failed');}else{return _0x138c2f(_0x21d0e4);}})[_0xdda2('0x4b')](function(_0x18d251){return _0x26e7de(_0x18d251);});});;});};function addVoicePrefixExtensions(_0x3d49e8,_0x4530b7){var _0x1ac15a=[];var _0x5d34d7=formatPrefixName(_0x3d49e8[_0xdda2('0x63')]);_0x1ac15a[_0xdda2('0x68')](new Extension(_0x5d34d7,0x2,_0xdda2('0x69'),'CDR(prefix)='+_0x3d49e8[_0xdda2('0x31')]));if(_0x3d49e8['callerIdAll']){_0x1ac15a[_0xdda2('0x68')](new Extension(_0x5d34d7,0x3,_0xdda2('0x69'),_0xdda2('0x6a')+_0x3d49e8['callerIdAll']));}else{_0x1ac15a[_0xdda2('0x68')](new Extension(_0x5d34d7,0x3,_0xdda2('0x64'),'No\x20callerid\x20available'));}_0x1ac15a[_0xdda2('0x68')](new Extension(_0x5d34d7,0x4,'goto',_0x4530b7[_0xdda2('0x5d')]+','+_0xdda2('0x6b')+(0x8+_0x3d49e8[_0xdda2('0x31')][_0xdda2('0x3d')])+'}'+','+0x1));return _0x1ac15a;}function formatPrefixName(_0x10d1de){var _0x4a061a='_';for(var _0x586ca1=0x0;_0x586ca1<_0x10d1de[_0xdda2('0x3d')];_0x586ca1++){if(_0x10d1de[_0xdda2('0x6c')](_0x586ca1)=='-'){_0x4a061a+=_0x10d1de['charAt'](_0x586ca1);}else{_0x4a061a+='['+_0x10d1de['charAt'](_0x586ca1)+']';}}_0x4a061a+='.';return _0x4a061a;}exports[_0xdda2('0x6d')]=function(_0x501336,_0x12a052,_0x1a33ba){var _0x4910a6=_0x501336[_0xdda2('0x54')];_0x4910a6[_0xdda2('0x63')]=_0xdda2('0x6e')+_0x4910a6[_0xdda2('0x31')]+'-';return db[_0xdda2('0x53')][_0xdda2('0x6f')](function(_0x4eebb0){return db[_0xdda2('0x48')][_0xdda2('0x6d')](_0x4910a6,{'where':{'id':_0x4910a6['id']},'transaction':_0x4eebb0})[_0xdda2('0x2b')](function(){return db['VoiceExtension'][_0xdda2('0x2f')]({'where':{'VoicePrefixId':_0x4910a6['id']},'transaction':_0x4eebb0})[_0xdda2('0x2b')](function(){return db['VoiceExtension']['find']({'where':{'id':_0x4910a6[_0xdda2('0x56')]},'raw':!![]})[_0xdda2('0x2b')](function(_0x2f03b9){return createVoicePrefixExtensions(_0x4910a6,_0x2f03b9,_0x4eebb0);});});});})['then'](function(){return db['VoicePrefix'][_0xdda2('0x70')](_0x4910a6['id']);})['then'](respondWithResult(_0x12a052,null))[_0xdda2('0x4b')](handleError(_0x12a052,null));};exports[_0xdda2('0x71')]=function(_0x19d92e,_0x12fd67,_0x597b09){return db[_0xdda2('0x48')]['find']({'where':{'id':_0x19d92e['params']['id']}})[_0xdda2('0x2b')](handleEntityNotFound(_0x12fd67,null))['then'](function(_0x2de01c){if(_0x2de01c){return _0x2de01c[_0xdda2('0x71')](_0x19d92e[_0xdda2('0x54')][_0xdda2('0x72')],_[_0xdda2('0x73')](_0x19d92e[_0xdda2('0x54')],[_0xdda2('0x72'),'id'])||{})[_0xdda2('0x74')](function(_0x37c547){for(var _0x495a28=0x0;_0x495a28<_0x19d92e[_0xdda2('0x54')][_0xdda2('0x72')][_0xdda2('0x3d')];_0x495a28+=0x1){socket[_0xdda2('0x75')]('userVoicePrefix:save',{'UserId':Number(_0x19d92e[_0xdda2('0x54')][_0xdda2('0x72')][_0x495a28]),'VoicePrefixId':Number(_0x19d92e[_0xdda2('0x4d')]['id'])});}return _0x37c547;});}})[_0xdda2('0x2b')](respondWithResult(_0x12fd67,null))['catch'](handleError(_0x12fd67,null));};exports['removeAgents']=function(_0xe4110b,_0xdef266,_0x423e1f){return db[_0xdda2('0x48')]['find']({'where':{'id':_0xe4110b[_0xdda2('0x4d')]['id']}})[_0xdda2('0x2b')](handleEntityNotFound(_0xdef266,null))[_0xdda2('0x2b')](function(_0x152ba3){if(_0x152ba3){return _0x152ba3[_0xdda2('0x76')](_0xe4110b[_0xdda2('0x38')][_0xdda2('0x72')])[_0xdda2('0x2b')](function(){if(_[_0xdda2('0x77')](_0xe4110b[_0xdda2('0x38')][_0xdda2('0x72')])){for(var _0x23a80a=0x0;_0x23a80a<_0xe4110b[_0xdda2('0x38')][_0xdda2('0x72')][_0xdda2('0x3d')];_0x23a80a+=0x1){socket['emit'](_0xdda2('0x78'),{'UserId':Number(_0xe4110b[_0xdda2('0x38')]['ids'][_0x23a80a]),'VoicePrefixId':Number(_0xe4110b['params']['id'])});}}else{socket[_0xdda2('0x75')](_0xdda2('0x78'),{'UserId':Number(_0xe4110b[_0xdda2('0x38')][_0xdda2('0x72')]),'VoicePrefixId':Number(_0xe4110b[_0xdda2('0x4d')]['id'])});}});}})[_0xdda2('0x2b')](respondWithStatusCode(_0xdef266,null))['catch'](handleError(_0xdef266,null));};exports[_0xdda2('0x79')]=function(_0x1f3abe,_0x447bd2,_0x2bb4f3){var _0x563be8={};var _0xbf1248={};var _0x5c3d67;var _0x20ebf7;return db[_0xdda2('0x48')]['findOne']({'where':{'id':_0x1f3abe[_0xdda2('0x4d')]['id']}})[_0xdda2('0x2b')](handleEntityNotFound(_0x447bd2,null))[_0xdda2('0x2b')](function(_0x1dfe6d){if(_0x1dfe6d){_0x5c3d67=_0x1dfe6d;_0xbf1248[_0xdda2('0x36')]=_[_0xdda2('0x39')](db[_0xdda2('0x7a')][_0xdda2('0x4e')]);_0xbf1248[_0xdda2('0x38')]=_[_0xdda2('0x39')](_0x1f3abe[_0xdda2('0x38')]);_0xbf1248['filters']=_[_0xdda2('0x3a')](_0xbf1248[_0xdda2('0x36')],_0xbf1248[_0xdda2('0x38')]);_0x563be8[_0xdda2('0x3b')]=_[_0xdda2('0x3a')](_0xbf1248['model'],qs[_0xdda2('0x3c')](_0x1f3abe[_0xdda2('0x38')]['fields']));_0x563be8[_0xdda2('0x3b')]=_0x563be8[_0xdda2('0x3b')]['length']?_0x563be8['attributes']:_0xbf1248[_0xdda2('0x36')];_0x563be8[_0xdda2('0x40')]=qs[_0xdda2('0x41')](_0x1f3abe[_0xdda2('0x38')][_0xdda2('0x41')]);_0x563be8[_0xdda2('0x44')]=qs['filters'](_[_0xdda2('0x43')](_0x1f3abe[_0xdda2('0x38')],_0xbf1248['filters']));if(_0x1f3abe[_0xdda2('0x38')][_0xdda2('0x47')]){_0x563be8['where']=_[_0xdda2('0x45')](_0x563be8[_0xdda2('0x44')],{'$or':_[_0xdda2('0x37')](_0x563be8['attributes'],function(_0xe6f37b){var _0x4a34ee={};_0x4a34ee[_0xe6f37b]={'$like':'%'+_0x1f3abe[_0xdda2('0x38')][_0xdda2('0x47')]+'%'};return _0x4a34ee;})});}_0x563be8=_[_0xdda2('0x45')]({},_0x563be8,_0x1f3abe[_0xdda2('0x7b')]);return _0x5c3d67['getAgents'](_0x563be8);}})['then'](function(_0x2b8c0c){if(_0x2b8c0c){_0x20ebf7=_0x2b8c0c[_0xdda2('0x3d')];if(!_0x1f3abe['query'][_0xdda2('0x3e')](_0xdda2('0x3f'))){_0x563be8[_0xdda2('0x25')]=qs[_0xdda2('0x25')](_0x1f3abe[_0xdda2('0x38')][_0xdda2('0x25')]);_0x563be8[_0xdda2('0x23')]=qs[_0xdda2('0x23')](_0x1f3abe[_0xdda2('0x38')][_0xdda2('0x23')]);}return _0x5c3d67[_0xdda2('0x79')](_0x563be8);}})[_0xdda2('0x2b')](function(_0x528185){if(_0x528185){return _0x528185?{'count':_0x20ebf7,'rows':_0x528185}:null;}})['then'](respondWithResult(_0x447bd2,null))['catch'](handleError(_0x447bd2,null));};exports[_0xdda2('0x7c')]=function(_0x4edf20,_0x2910b0,_0x323af8){var _0x2f18a0={};var _0xe797aa={};var _0x558ab6;var _0x374fc4;return db[_0xdda2('0x48')][_0xdda2('0x7d')]({'where':{'id':_0x4edf20['params']['id']}})[_0xdda2('0x2b')](handleEntityNotFound(_0x2910b0,null))[_0xdda2('0x2b')](function(_0x2588f5){if(_0x2588f5){_0x558ab6=_0x2588f5;_0xe797aa['model']=_['keys'](db[_0xdda2('0x7e')][_0xdda2('0x4e')]);_0xe797aa[_0xdda2('0x38')]=_['keys'](_0x4edf20[_0xdda2('0x38')]);_0xe797aa[_0xdda2('0x42')]=_[_0xdda2('0x3a')](_0xe797aa[_0xdda2('0x36')],_0xe797aa[_0xdda2('0x38')]);_0x2f18a0[_0xdda2('0x3b')]=_[_0xdda2('0x3a')](_0xe797aa['model'],qs[_0xdda2('0x3c')](_0x4edf20[_0xdda2('0x38')][_0xdda2('0x3c')]));_0x2f18a0[_0xdda2('0x3b')]=_0x2f18a0['attributes'][_0xdda2('0x3d')]?_0x2f18a0[_0xdda2('0x3b')]:_0xe797aa[_0xdda2('0x36')];_0x2f18a0[_0xdda2('0x40')]=qs['sort'](_0x4edf20['query']['sort']);_0x2f18a0[_0xdda2('0x44')]=qs[_0xdda2('0x42')](_[_0xdda2('0x43')](_0x4edf20[_0xdda2('0x38')],_0xe797aa[_0xdda2('0x42')]));if(_0x4edf20[_0xdda2('0x38')]['filter']){_0x2f18a0[_0xdda2('0x44')]=_[_0xdda2('0x45')](_0x2f18a0[_0xdda2('0x44')],{'$or':_[_0xdda2('0x37')](_0x2f18a0[_0xdda2('0x3b')],function(_0x39ee74){var _0xcbf57f={};_0xcbf57f[_0x39ee74]={'$like':'%'+_0x4edf20[_0xdda2('0x38')]['filter']+'%'};return _0xcbf57f;})});}_0x2f18a0=_[_0xdda2('0x45')]({},_0x2f18a0,_0x4edf20['options']);return _0x558ab6[_0xdda2('0x7c')](_0x2f18a0);}})['then'](function(_0x15066f){if(_0x15066f){_0x374fc4=_0x15066f['length'];if(!_0x4edf20[_0xdda2('0x38')][_0xdda2('0x3e')](_0xdda2('0x3f'))){_0x2f18a0[_0xdda2('0x25')]=qs[_0xdda2('0x25')](_0x4edf20[_0xdda2('0x38')][_0xdda2('0x25')]);_0x2f18a0[_0xdda2('0x23')]=qs[_0xdda2('0x23')](_0x4edf20['query'][_0xdda2('0x23')]);}return _0x558ab6[_0xdda2('0x7c')](_0x2f18a0);}})['then'](function(_0x42db44){if(_0x42db44){return _0x42db44?{'count':_0x374fc4,'rows':_0x42db44}:null;}})[_0xdda2('0x2b')](respondWithResult(_0x2910b0,null))[_0xdda2('0x4b')](handleError(_0x2910b0,null));};exports['addTeams']=function(_0x1702ae,_0x21ade3,_0x251408){var _0x311e34=_0x1702ae[_0xdda2('0x54')][_0xdda2('0x72')];var _0x4124a5;return db[_0xdda2('0x7e')][_0xdda2('0x4a')]({'where':{'id':_0x311e34},'attributes':['id'],'include':[{'model':db[_0xdda2('0x7a')],'as':'Agents','attributes':['id',_0xdda2('0x31'),_0xdda2('0x7f'),_0xdda2('0x80'),_0xdda2('0x81')],'raw':!![]}]})[_0xdda2('0x2b')](function(_0x4c540d){if(_0x4c540d){_0x4124a5=_0x4c540d;var _0x320cf1=_[_0xdda2('0x82')](_0x4c540d,function(_0xdd343d){var _0x56cd13=_0xdd343d[_0xdda2('0x2c')]({'plain':!![]});return _0x56cd13[_0xdda2('0x83')];});return db[_0xdda2('0x48')]['find']({'where':{'id':_0x1702ae[_0xdda2('0x4d')]['id']}})['then'](function(_0x579fc9){return db[_0xdda2('0x53')][_0xdda2('0x6f')](function(_0x3752bf){return _0x579fc9[_0xdda2('0x84')](_0x311e34,{'transaction':_0x3752bf})[_0xdda2('0x2b')](function(){return BPromise[_0xdda2('0x85')](_0x4124a5,function(_0x14baa0){return db['TeamVoicePrefix']['upsert']({'TeamId':_0x14baa0['id'],'VoicePrefixId':_0x1702ae[_0xdda2('0x4d')]['id']},{'transaction':_0x3752bf});});})[_0xdda2('0x2b')](function(){return BPromise[_0xdda2('0x85')](_0x320cf1,function(_0x16b910){return db[_0xdda2('0x86')]['findOrCreate']({'where':{'UserId':_0x16b910['id'],'VoicePrefixId':_0x1702ae[_0xdda2('0x4d')]['id']},'transaction':_0x3752bf});});})[_0xdda2('0x2b')](function(){_0x320cf1[_0xdda2('0x87')](function(_0x233494){socket[_0xdda2('0x75')](_0xdda2('0x88'),{'UserId':_0x233494['id'],'VoicePrefixId':_0x579fc9['id']});});});});});}})[_0xdda2('0x2b')](respondWithStatusCode(_0x21ade3,null))[_0xdda2('0x4b')](handleError(_0x21ade3,null));};exports[_0xdda2('0x89')]=function(_0x44e93d,_0x2defb2,_0x53c44d){return db[_0xdda2('0x7e')][_0xdda2('0x4a')]({'where':{'id':_0x44e93d[_0xdda2('0x38')][_0xdda2('0x72')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0xdda2('0x83'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x2defb2,null))[_0xdda2('0x2b')](function(_0x4f2d5c){var _0x240048=_['map'](_0x4f2d5c,'id');var _0x1da0dd=[];var _0xb93d3b=[];var _0x3d59cb=squel['select']();_0x3d59cb[_0xdda2('0x8a')](_0xdda2('0x8b'))[_0xdda2('0x8c')]('team_has_voice_prefixes','tq')['join'](_0xdda2('0x8d'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0xdda2('0x44')](_0xdda2('0x8e'),_0x44e93d[_0xdda2('0x4d')]['id']);for(var _0x182570=0x0;_0x182570<_0x4f2d5c['length'];_0x182570+=0x1){let _0x28a217=_0x4f2d5c[_0x182570];for(var _0x54cd55=0x0;_0x54cd55<_0x28a217['Agents']['length'];_0x54cd55+=0x1){let _0x5235d5=_0x28a217[_0xdda2('0x83')][_0x54cd55];var _0x4a6058=_0x3d59cb[_0xdda2('0x8f')]();_0x4a6058[_0xdda2('0x44')]('ut.UserId\x20=\x20?',_0x5235d5['id']);_0xb93d3b['push'](db[_0xdda2('0x53')][_0xdda2('0x38')](_0x4a6058[_0xdda2('0x90')](),{'type':db[_0xdda2('0x53')]['QueryTypes']['SELECT']})[_0xdda2('0x2b')](function(_0x19c1eb){if(_0x19c1eb[_0xdda2('0x3d')]===0x1){return _0x5235d5['id'];}else{var _0x22e01a=_['every'](_[_0xdda2('0x37')](_0x19c1eb,_0xdda2('0x91')),function(_0x3867b3){return _[_0xdda2('0x92')](_0x240048,_0x3867b3);});if(_0x22e01a){return _0x5235d5['id'];}}}));}}return BPromise[_0xdda2('0x93')](_0xb93d3b)[_0xdda2('0x2b')](function(_0xa798dc){_0x1da0dd=_(_0x1da0dd)[_0xdda2('0x94')](_0xa798dc)[_0xdda2('0x95')]()[_0xdda2('0x96')]();return db[_0xdda2('0x48')][_0xdda2('0x50')]({'where':{'id':_0x44e93d[_0xdda2('0x4d')]['id']}})[_0xdda2('0x2b')](function(_0x3cb988){return db[_0xdda2('0x53')]['transaction'](function(_0xe54b68){return _0x3cb988[_0xdda2('0x89')](_0x44e93d[_0xdda2('0x38')][_0xdda2('0x72')],{'transaction':_0xe54b68})[_0xdda2('0x2b')](function(){if(!_[_0xdda2('0x97')](_0x1da0dd)){return _0x3cb988[_0xdda2('0x76')](_0x1da0dd,{'transaction':_0xe54b68});}})[_0xdda2('0x2b')](function(){_0x1da0dd[_0xdda2('0x87')](function(_0x1c008c){socket[_0xdda2('0x75')](_0xdda2('0x78'),{'UserId':_0x1c008c,'VoicePrefixId':_0x3cb988['id']});});});});});});})[_0xdda2('0x2b')](respondWithStatusCode(_0x2defb2,null))[_0xdda2('0x4b')](handleError(_0x2defb2,null));}; \ No newline at end of file +var _0x4b17=['status','end','json','offset','limit','undefined','count','set','apply','reject','save','update','then','destroy','get','VoicePrefixes','error','stack','name','send','map','VoicePrefix','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','include','findAll','catch','params','rawAttributes','includeAll','options','find','describe','create','sequelize','transaction','VoiceExtension','VoiceExtensionId','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','UserProfileResource','context','from-sip','exten','app','type','system','description','Voice\x20Prefix\x20Extension','priority','appdata','prefix','VoicePrefixId','bulkCreate','Extensions\x20creation\x20failed','push','CDR(prefix)=','callerIdAll','Set','NoOp','No\x20callerid\x20available','goto','${EXTEN:','charAt','body','system-','findById','addAgents','ids','omit','spread','emit','userVoicePrefix:save','removeAgents','userVoicePrefix:remove','getAgents','findOne','User','Team','getTeams','addTeams','Agents','voicePause','flatMap','each','upsert','findOrCreate','forEach','removeTeams','field','tq.TeamId','team_has_voice_prefixes','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoicePrefixId\x20=\x20?','clone','toString','QueryTypes','SELECT','every','TeamId','isEmpty','eml-format','zip-dir','request-promise','moment','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','register','sendStatus'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0x4b17,0x10f));var _0x74b1=function(_0x28be72,_0x2b83af){_0x28be72=_0x28be72-0x0;var _0x46c5da=_0x4b17[_0x28be72];return _0x46c5da;};'use strict';var emlformat=require(_0x74b1('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x74b1('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x74b1('0x2'));var moment=require(_0x74b1('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x74b1('0x4'));var util=require('util');var path=require('path');var sox=require(_0x74b1('0x5'));var csv=require(_0x74b1('0x6'));var ejs=require(_0x74b1('0x7'));var fs=require('fs');var fs_extra=require(_0x74b1('0x8'));var _=require(_0x74b1('0x9'));var squel=require(_0x74b1('0xa'));var crypto=require(_0x74b1('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x74b1('0xc'));var toCsv=require(_0x74b1('0x6'));var querystring=require(_0x74b1('0xd'));var Papa=require(_0x74b1('0xe'));var Redis=require(_0x74b1('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x74b1('0x10'));var as=require(_0x74b1('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x74b1('0x12'))(_0x74b1('0x13'));var utils=require(_0x74b1('0x14'));var config=require(_0x74b1('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x74b1('0x16'))['db'];config['redis']=_['defaults'](config[_0x74b1('0x17')],{'host':_0x74b1('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./voicePrefix.socket')[_0x74b1('0x19')](socket);function respondWithStatusCode(_0x5c12eb,_0x4e289b){_0x4e289b=_0x4e289b||0xcc;return function(_0x2ccba6){if(_0x2ccba6){return _0x5c12eb[_0x74b1('0x1a')](_0x4e289b);}return _0x5c12eb[_0x74b1('0x1b')](_0x4e289b)[_0x74b1('0x1c')]();};}function respondWithResult(_0x16b147,_0x10138e){_0x10138e=_0x10138e||0xc8;return function(_0x528e8c){if(_0x528e8c){return _0x16b147[_0x74b1('0x1b')](_0x10138e)[_0x74b1('0x1d')](_0x528e8c);}};}function respondWithFilteredResult(_0x1a0851,_0x2cfcc3){return function(_0xde2736){if(_0xde2736){var _0x8c9510=typeof _0x2cfcc3[_0x74b1('0x1e')]==='undefined'&&typeof _0x2cfcc3[_0x74b1('0x1f')]===_0x74b1('0x20');var _0x524ece=_0xde2736[_0x74b1('0x21')];var _0x38d932=_0x8c9510?0x0:_0x2cfcc3[_0x74b1('0x1e')];var _0x25704e=_0x8c9510?_0xde2736[_0x74b1('0x21')]:_0x2cfcc3[_0x74b1('0x1e')]+_0x2cfcc3[_0x74b1('0x1f')];var _0xaac5f7;if(_0x25704e>=_0x524ece){_0x25704e=_0x524ece;_0xaac5f7=0xc8;}else{_0xaac5f7=0xce;}_0x1a0851['status'](_0xaac5f7);return _0x1a0851[_0x74b1('0x22')]('Content-Range',_0x38d932+'-'+_0x25704e+'/'+_0x524ece)['json'](_0xde2736);}return null;};}function patchUpdates(_0x481bf2){return function(_0x27fd1a){try{jsonpatch[_0x74b1('0x23')](_0x27fd1a,_0x481bf2,!![]);}catch(_0x405a22){return BPromise[_0x74b1('0x24')](_0x405a22);}return _0x27fd1a[_0x74b1('0x25')]();};}function saveUpdates(_0x4ee88b,_0x3c78e5){return function(_0x4eca36){if(_0x4eca36){return _0x4eca36[_0x74b1('0x26')](_0x4ee88b)[_0x74b1('0x27')](function(_0xb5af0){return _0xb5af0;});}return null;};}function removeEntity(_0x14a651,_0x3239d8){return function(_0x322de5){if(_0x322de5){return _0x322de5[_0x74b1('0x28')]()[_0x74b1('0x27')](function(){var _0x4c7f05=_0x322de5[_0x74b1('0x29')]({'plain':!![]});var _0x42b69d=_0x74b1('0x2a');return db['UserProfileResource'][_0x74b1('0x28')]({'where':{'type':_0x42b69d,'resourceId':_0x4c7f05['id']}})[_0x74b1('0x27')](function(){return _0x322de5;});})[_0x74b1('0x27')](function(){_0x14a651[_0x74b1('0x1b')](0xcc)[_0x74b1('0x1c')]();});}};}function handleEntityNotFound(_0x273ff1,_0x436eda){return function(_0x3ce043){if(!_0x3ce043){_0x273ff1['sendStatus'](0x194);}return _0x3ce043;};}function handleError(_0xe74c82,_0x40b32a){_0x40b32a=_0x40b32a||0x1f4;return function(_0x51ce6d){logger[_0x74b1('0x2b')](_0x51ce6d[_0x74b1('0x2c')]);if(_0x51ce6d[_0x74b1('0x2d')]){delete _0x51ce6d['name'];}_0xe74c82[_0x74b1('0x1b')](_0x40b32a)[_0x74b1('0x2e')](_0x51ce6d);};}exports['index']=function(_0x3dbf18,_0x33ec7c){var _0x2211b2={},_0x31c321={},_0x68a3bd={'count':0x0,'rows':[]};var _0x32a8d6=_[_0x74b1('0x2f')](db[_0x74b1('0x30')]['rawAttributes'],function(_0x3d5fc0){return{'name':_0x3d5fc0['fieldName'],'type':_0x3d5fc0['type'][_0x74b1('0x31')]};});_0x31c321['model']=_['map'](_0x32a8d6,_0x74b1('0x2d'));_0x31c321[_0x74b1('0x32')]=_[_0x74b1('0x33')](_0x3dbf18[_0x74b1('0x32')]);_0x31c321[_0x74b1('0x34')]=_[_0x74b1('0x35')](_0x31c321[_0x74b1('0x36')],_0x31c321[_0x74b1('0x32')]);_0x2211b2['attributes']=_['intersection'](_0x31c321['model'],qs[_0x74b1('0x37')](_0x3dbf18['query']['fields']));_0x2211b2[_0x74b1('0x38')]=_0x2211b2[_0x74b1('0x38')][_0x74b1('0x39')]?_0x2211b2['attributes']:_0x31c321[_0x74b1('0x36')];if(!_0x3dbf18['query'][_0x74b1('0x3a')](_0x74b1('0x3b'))){_0x2211b2['limit']=qs['limit'](_0x3dbf18[_0x74b1('0x32')][_0x74b1('0x1f')]);_0x2211b2['offset']=qs['offset'](_0x3dbf18[_0x74b1('0x32')]['offset']);}_0x2211b2[_0x74b1('0x3c')]=qs[_0x74b1('0x3d')](_0x3dbf18[_0x74b1('0x32')][_0x74b1('0x3d')]);_0x2211b2[_0x74b1('0x3e')]=qs['filters'](_[_0x74b1('0x3f')](_0x3dbf18['query'],_0x31c321[_0x74b1('0x34')]),_0x32a8d6);if(_0x3dbf18['query'][_0x74b1('0x40')]){_0x2211b2['where']=_['merge'](_0x2211b2[_0x74b1('0x3e')],{'$or':_[_0x74b1('0x2f')](_0x32a8d6,function(_0x2725fd){if(_0x2725fd['type']!==_0x74b1('0x41')){var _0x327334={};_0x327334[_0x2725fd[_0x74b1('0x2d')]]={'$like':'%'+_0x3dbf18['query'][_0x74b1('0x40')]+'%'};return _0x327334;}})});}_0x2211b2=_[_0x74b1('0x42')]({},_0x2211b2,_0x3dbf18['options']);var _0x48ac05={'where':_0x2211b2[_0x74b1('0x3e')]};return db[_0x74b1('0x30')][_0x74b1('0x21')](_0x48ac05)[_0x74b1('0x27')](function(_0x1d9f5b){_0x68a3bd[_0x74b1('0x21')]=_0x1d9f5b;if(_0x3dbf18[_0x74b1('0x32')]['includeAll']){_0x2211b2[_0x74b1('0x43')]=[{'all':!![]}];}return db[_0x74b1('0x30')][_0x74b1('0x44')](_0x2211b2);})[_0x74b1('0x27')](function(_0x17a44f){_0x68a3bd['rows']=_0x17a44f;return _0x68a3bd;})[_0x74b1('0x27')](respondWithFilteredResult(_0x33ec7c,_0x2211b2))[_0x74b1('0x45')](handleError(_0x33ec7c,null));};exports['show']=function(_0x50d9de,_0x1b7a58){var _0x3c3c3c={'raw':![],'where':{'id':_0x50d9de[_0x74b1('0x46')]['id']}},_0x54c94b={};_0x54c94b[_0x74b1('0x36')]=_[_0x74b1('0x33')](db[_0x74b1('0x30')][_0x74b1('0x47')]);_0x54c94b[_0x74b1('0x32')]=_[_0x74b1('0x33')](_0x50d9de['query']);_0x54c94b['filters']=_['intersection'](_0x54c94b[_0x74b1('0x36')],_0x54c94b[_0x74b1('0x32')]);_0x3c3c3c[_0x74b1('0x38')]=_[_0x74b1('0x35')](_0x54c94b[_0x74b1('0x36')],qs['fields'](_0x50d9de[_0x74b1('0x32')][_0x74b1('0x37')]));_0x3c3c3c[_0x74b1('0x38')]=_0x3c3c3c[_0x74b1('0x38')][_0x74b1('0x39')]?_0x3c3c3c[_0x74b1('0x38')]:_0x54c94b[_0x74b1('0x36')];if(_0x50d9de[_0x74b1('0x32')][_0x74b1('0x48')]){_0x3c3c3c[_0x74b1('0x43')]=[{'all':!![]}];}_0x3c3c3c=_[_0x74b1('0x42')]({},_0x3c3c3c,_0x50d9de[_0x74b1('0x49')]);return db['VoicePrefix'][_0x74b1('0x4a')](_0x3c3c3c)[_0x74b1('0x27')](handleEntityNotFound(_0x1b7a58,null))['then'](respondWithResult(_0x1b7a58,null))[_0x74b1('0x45')](handleError(_0x1b7a58,null));};exports['destroy']=function(_0x4b1add,_0x2073eb){return db['VoicePrefix'][_0x74b1('0x4a')]({'where':{'id':_0x4b1add[_0x74b1('0x46')]['id']}})[_0x74b1('0x27')](handleEntityNotFound(_0x2073eb,null))['then'](removeEntity(_0x2073eb,null))[_0x74b1('0x45')](handleError(_0x2073eb,null));};exports[_0x74b1('0x4b')]=function(_0x1b2d51,_0x3d199b){return db[_0x74b1('0x30')]['describe']()[_0x74b1('0x27')](respondWithResult(_0x3d199b,null))['catch'](handleError(_0x3d199b,null));};exports[_0x74b1('0x4c')]=function(_0x4085b8,_0x5e458c){var _0x1be639;return db[_0x74b1('0x4d')][_0x74b1('0x4e')](function(_0x54a221){return db[_0x74b1('0x30')][_0x74b1('0x4c')](_0x4085b8['body'],{'transaction':_0x54a221})[_0x74b1('0x27')](function(_0x4fdd6b){_0x1be639=_0x4fdd6b['get']({'plain':!![]});return db[_0x74b1('0x4f')][_0x74b1('0x4a')]({'where':{'id':_0x1be639[_0x74b1('0x50')]},'raw':!![]})[_0x74b1('0x27')](function(_0x41b45f){return createVoicePrefixExtensions(_0x1be639,_0x41b45f,_0x54a221);});});})['then'](function(){var _0x145ce3=_0x4085b8[_0x74b1('0x51')]['get']({'plain':!![]});if(!_0x145ce3)throw new Error(_0x74b1('0x52'));if(_0x145ce3[_0x74b1('0x53')]===_0x74b1('0x51')){var _0x5634d1=_0x1be639;return db[_0x74b1('0x54')][_0x74b1('0x4a')]({'where':{'name':_0x74b1('0x2a'),'userProfileId':_0x145ce3['userProfileId']},'raw':!![]})[_0x74b1('0x27')](function(_0x3b4338){if(_0x3b4338&&_0x3b4338[_0x74b1('0x55')]===0x0){return db[_0x74b1('0x56')][_0x74b1('0x4c')]({'name':_0x5634d1[_0x74b1('0x2d')],'resourceId':_0x5634d1['id'],'type':_0x3b4338['name'],'sectionId':_0x3b4338['id']},{})[_0x74b1('0x27')](function(){return _0x1be639;});}else{return _0x1be639;}})['catch'](function(_0x5343c4){logger[_0x74b1('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5343c4);throw _0x5343c4;});}return _0x1be639;})['then'](respondWithResult(_0x5e458c,null))[_0x74b1('0x45')](handleError(_0x5e458c,null));};function Extension(_0x29ab63,_0x16db5c,_0x515a8e,_0x204b7d){this[_0x74b1('0x57')]=_0x74b1('0x58');this[_0x74b1('0x59')]=_0x29ab63;this[_0x74b1('0x5a')]=_0x515a8e;this[_0x74b1('0x5b')]=_0x74b1('0x5c');this[_0x74b1('0x5d')]=_0x74b1('0x5e');this[_0x74b1('0x5f')]=_0x16db5c;this[_0x74b1('0x60')]=_0x204b7d;}function createVoicePrefixExtensions(_0x112721,_0x516e44,_0x598daa){return new BPromise(function(_0x2a46ca,_0x553615){var _0x15eb38=new Extension(formatPrefixName(_0x112721[_0x74b1('0x61')]),0x1,'NoOp','Voice\x20Prefix');_0x15eb38[_0x74b1('0x62')]=_0x112721['id'];return db[_0x74b1('0x4f')][_0x74b1('0x4c')](_0x15eb38,{'transaction':_0x598daa})[_0x74b1('0x27')](function(_0x3dd0c3){var _0x1f879f=_0x3dd0c3[_0x74b1('0x29')]({'plain':!![]});var _0x1fb137=_[_0x74b1('0x2f')](addVoicePrefixExtensions(_0x112721,_0x516e44),function(_0x128a7e){_0x128a7e[_0x74b1('0x50')]=_0x1f879f['id'];_0x128a7e[_0x74b1('0x62')]=_0x112721['id'];return _0x128a7e;});return db['VoiceExtension'][_0x74b1('0x63')](_0x1fb137,{'transaction':_0x598daa})[_0x74b1('0x27')](function(_0x378f63){if(!_0x378f63){return _0x553615(_0x74b1('0x64'));}else{return _0x2a46ca(_0x378f63);}})['catch'](function(_0x308b98){return _0x553615(_0x308b98);});});;});};function addVoicePrefixExtensions(_0x1709d9,_0x5ada76){var _0x425f9f=[];var _0x4d2fcb=formatPrefixName(_0x1709d9[_0x74b1('0x61')]);_0x425f9f[_0x74b1('0x65')](new Extension(_0x4d2fcb,0x2,'Set',_0x74b1('0x66')+_0x1709d9[_0x74b1('0x2d')]));if(_0x1709d9[_0x74b1('0x67')]){_0x425f9f['push'](new Extension(_0x4d2fcb,0x3,_0x74b1('0x68'),'PREFIX-CALLERIDALL='+_0x1709d9[_0x74b1('0x67')]));}else{_0x425f9f[_0x74b1('0x65')](new Extension(_0x4d2fcb,0x3,_0x74b1('0x69'),_0x74b1('0x6a')));}_0x425f9f[_0x74b1('0x65')](new Extension(_0x4d2fcb,0x4,_0x74b1('0x6b'),_0x5ada76[_0x74b1('0x57')]+','+_0x74b1('0x6c')+(0x8+_0x1709d9[_0x74b1('0x2d')][_0x74b1('0x39')])+'}'+','+0x1));return _0x425f9f;}function formatPrefixName(_0x8b4902){var _0x44563d='_';for(var _0x2a33c9=0x0;_0x2a33c9<_0x8b4902['length'];_0x2a33c9++){if(_0x8b4902[_0x74b1('0x6d')](_0x2a33c9)=='-'){_0x44563d+=_0x8b4902[_0x74b1('0x6d')](_0x2a33c9);}else{_0x44563d+='['+_0x8b4902[_0x74b1('0x6d')](_0x2a33c9)+']';}}_0x44563d+='.';return _0x44563d;}exports[_0x74b1('0x26')]=function(_0x30692c,_0x228f8f,_0x2e94d6){var _0x7e2bcc=_0x30692c[_0x74b1('0x6e')];_0x7e2bcc['prefix']=_0x74b1('0x6f')+_0x7e2bcc['name']+'-';return db[_0x74b1('0x4d')]['transaction'](function(_0x5886d1){return db[_0x74b1('0x30')][_0x74b1('0x26')](_0x7e2bcc,{'where':{'id':_0x7e2bcc['id']},'transaction':_0x5886d1})[_0x74b1('0x27')](function(){return db['VoiceExtension'][_0x74b1('0x28')]({'where':{'VoicePrefixId':_0x7e2bcc['id']},'transaction':_0x5886d1})[_0x74b1('0x27')](function(){return db['VoiceExtension'][_0x74b1('0x4a')]({'where':{'id':_0x7e2bcc[_0x74b1('0x50')]},'raw':!![]})[_0x74b1('0x27')](function(_0x21e767){return createVoicePrefixExtensions(_0x7e2bcc,_0x21e767,_0x5886d1);});});});})[_0x74b1('0x27')](function(){return db[_0x74b1('0x30')][_0x74b1('0x70')](_0x7e2bcc['id']);})[_0x74b1('0x27')](respondWithResult(_0x228f8f,null))[_0x74b1('0x45')](handleError(_0x228f8f,null));};exports[_0x74b1('0x71')]=function(_0x542ee7,_0x2b1119,_0x3267ef){return db[_0x74b1('0x30')]['find']({'where':{'id':_0x542ee7[_0x74b1('0x46')]['id']}})[_0x74b1('0x27')](handleEntityNotFound(_0x2b1119,null))[_0x74b1('0x27')](function(_0x1a6a70){if(_0x1a6a70){return _0x1a6a70[_0x74b1('0x71')](_0x542ee7['body'][_0x74b1('0x72')],_[_0x74b1('0x73')](_0x542ee7[_0x74b1('0x6e')],[_0x74b1('0x72'),'id'])||{})[_0x74b1('0x74')](function(_0x36733f){for(var _0x359e05=0x0;_0x359e05<_0x542ee7[_0x74b1('0x6e')]['ids'][_0x74b1('0x39')];_0x359e05+=0x1){socket[_0x74b1('0x75')](_0x74b1('0x76'),{'UserId':Number(_0x542ee7['body']['ids'][_0x359e05]),'VoicePrefixId':Number(_0x542ee7[_0x74b1('0x46')]['id'])});}return _0x36733f;});}})[_0x74b1('0x27')](respondWithResult(_0x2b1119,null))[_0x74b1('0x45')](handleError(_0x2b1119,null));};exports[_0x74b1('0x77')]=function(_0x2de935,_0x5d8729,_0x42a630){return db['VoicePrefix']['find']({'where':{'id':_0x2de935[_0x74b1('0x46')]['id']}})[_0x74b1('0x27')](handleEntityNotFound(_0x5d8729,null))[_0x74b1('0x27')](function(_0x2da0f2){if(_0x2da0f2){return _0x2da0f2[_0x74b1('0x77')](_0x2de935[_0x74b1('0x32')][_0x74b1('0x72')])[_0x74b1('0x27')](function(){if(_['isArray'](_0x2de935['query']['ids'])){for(var _0x7ec28f=0x0;_0x7ec28f<_0x2de935[_0x74b1('0x32')][_0x74b1('0x72')][_0x74b1('0x39')];_0x7ec28f+=0x1){socket[_0x74b1('0x75')](_0x74b1('0x78'),{'UserId':Number(_0x2de935[_0x74b1('0x32')][_0x74b1('0x72')][_0x7ec28f]),'VoicePrefixId':Number(_0x2de935[_0x74b1('0x46')]['id'])});}}else{socket[_0x74b1('0x75')](_0x74b1('0x78'),{'UserId':Number(_0x2de935[_0x74b1('0x32')]['ids']),'VoicePrefixId':Number(_0x2de935[_0x74b1('0x46')]['id'])});}});}})[_0x74b1('0x27')](respondWithStatusCode(_0x5d8729,null))[_0x74b1('0x45')](handleError(_0x5d8729,null));};exports[_0x74b1('0x79')]=function(_0x25f929,_0x138f79,_0x5a07a6){var _0x2567d7={};var _0x32eb2d={};var _0x21c54f;var _0x4b025c;return db[_0x74b1('0x30')][_0x74b1('0x7a')]({'where':{'id':_0x25f929[_0x74b1('0x46')]['id']}})[_0x74b1('0x27')](handleEntityNotFound(_0x138f79,null))['then'](function(_0x7d3f08){if(_0x7d3f08){_0x21c54f=_0x7d3f08;_0x32eb2d[_0x74b1('0x36')]=_[_0x74b1('0x33')](db[_0x74b1('0x7b')][_0x74b1('0x47')]);_0x32eb2d['query']=_[_0x74b1('0x33')](_0x25f929[_0x74b1('0x32')]);_0x32eb2d['filters']=_[_0x74b1('0x35')](_0x32eb2d[_0x74b1('0x36')],_0x32eb2d['query']);_0x2567d7[_0x74b1('0x38')]=_[_0x74b1('0x35')](_0x32eb2d[_0x74b1('0x36')],qs[_0x74b1('0x37')](_0x25f929['query']['fields']));_0x2567d7[_0x74b1('0x38')]=_0x2567d7[_0x74b1('0x38')][_0x74b1('0x39')]?_0x2567d7['attributes']:_0x32eb2d[_0x74b1('0x36')];_0x2567d7[_0x74b1('0x3c')]=qs['sort'](_0x25f929['query'][_0x74b1('0x3d')]);_0x2567d7[_0x74b1('0x3e')]=qs[_0x74b1('0x34')](_['pick'](_0x25f929[_0x74b1('0x32')],_0x32eb2d[_0x74b1('0x34')]));if(_0x25f929[_0x74b1('0x32')][_0x74b1('0x40')]){_0x2567d7['where']=_['merge'](_0x2567d7[_0x74b1('0x3e')],{'$or':_[_0x74b1('0x2f')](_0x2567d7['attributes'],function(_0x1bf4a4){var _0x258b8f={};_0x258b8f[_0x1bf4a4]={'$like':'%'+_0x25f929[_0x74b1('0x32')][_0x74b1('0x40')]+'%'};return _0x258b8f;})});}_0x2567d7=_[_0x74b1('0x42')]({},_0x2567d7,_0x25f929[_0x74b1('0x49')]);return _0x21c54f[_0x74b1('0x79')](_0x2567d7);}})[_0x74b1('0x27')](function(_0x21453e){if(_0x21453e){_0x4b025c=_0x21453e[_0x74b1('0x39')];if(!_0x25f929['query'][_0x74b1('0x3a')](_0x74b1('0x3b'))){_0x2567d7[_0x74b1('0x1f')]=qs[_0x74b1('0x1f')](_0x25f929[_0x74b1('0x32')][_0x74b1('0x1f')]);_0x2567d7['offset']=qs[_0x74b1('0x1e')](_0x25f929['query'][_0x74b1('0x1e')]);}return _0x21c54f[_0x74b1('0x79')](_0x2567d7);}})[_0x74b1('0x27')](function(_0x4fcd9a){if(_0x4fcd9a){return _0x4fcd9a?{'count':_0x4b025c,'rows':_0x4fcd9a}:null;}})[_0x74b1('0x27')](respondWithResult(_0x138f79,null))[_0x74b1('0x45')](handleError(_0x138f79,null));};exports['getTeams']=function(_0x4a9ec5,_0x5c02fc,_0x1cbfde){var _0x6ac5ae={};var _0x1a223d={};var _0x25624b;var _0xb24035;return db[_0x74b1('0x30')][_0x74b1('0x7a')]({'where':{'id':_0x4a9ec5[_0x74b1('0x46')]['id']}})[_0x74b1('0x27')](handleEntityNotFound(_0x5c02fc,null))[_0x74b1('0x27')](function(_0x220cbf){if(_0x220cbf){_0x25624b=_0x220cbf;_0x1a223d[_0x74b1('0x36')]=_['keys'](db[_0x74b1('0x7c')][_0x74b1('0x47')]);_0x1a223d[_0x74b1('0x32')]=_['keys'](_0x4a9ec5[_0x74b1('0x32')]);_0x1a223d[_0x74b1('0x34')]=_[_0x74b1('0x35')](_0x1a223d['model'],_0x1a223d[_0x74b1('0x32')]);_0x6ac5ae[_0x74b1('0x38')]=_[_0x74b1('0x35')](_0x1a223d['model'],qs[_0x74b1('0x37')](_0x4a9ec5[_0x74b1('0x32')][_0x74b1('0x37')]));_0x6ac5ae[_0x74b1('0x38')]=_0x6ac5ae[_0x74b1('0x38')][_0x74b1('0x39')]?_0x6ac5ae[_0x74b1('0x38')]:_0x1a223d[_0x74b1('0x36')];_0x6ac5ae[_0x74b1('0x3c')]=qs[_0x74b1('0x3d')](_0x4a9ec5[_0x74b1('0x32')][_0x74b1('0x3d')]);_0x6ac5ae[_0x74b1('0x3e')]=qs[_0x74b1('0x34')](_[_0x74b1('0x3f')](_0x4a9ec5[_0x74b1('0x32')],_0x1a223d[_0x74b1('0x34')]));if(_0x4a9ec5['query'][_0x74b1('0x40')]){_0x6ac5ae[_0x74b1('0x3e')]=_['merge'](_0x6ac5ae[_0x74b1('0x3e')],{'$or':_[_0x74b1('0x2f')](_0x6ac5ae[_0x74b1('0x38')],function(_0x3e3dfb){var _0x1a5c1e={};_0x1a5c1e[_0x3e3dfb]={'$like':'%'+_0x4a9ec5[_0x74b1('0x32')]['filter']+'%'};return _0x1a5c1e;})});}_0x6ac5ae=_['merge']({},_0x6ac5ae,_0x4a9ec5[_0x74b1('0x49')]);return _0x25624b[_0x74b1('0x7d')](_0x6ac5ae);}})[_0x74b1('0x27')](function(_0x401599){if(_0x401599){_0xb24035=_0x401599[_0x74b1('0x39')];if(!_0x4a9ec5[_0x74b1('0x32')]['hasOwnProperty'](_0x74b1('0x3b'))){_0x6ac5ae[_0x74b1('0x1f')]=qs[_0x74b1('0x1f')](_0x4a9ec5[_0x74b1('0x32')]['limit']);_0x6ac5ae[_0x74b1('0x1e')]=qs[_0x74b1('0x1e')](_0x4a9ec5['query'][_0x74b1('0x1e')]);}return _0x25624b[_0x74b1('0x7d')](_0x6ac5ae);}})[_0x74b1('0x27')](function(_0x29de45){if(_0x29de45){return _0x29de45?{'count':_0xb24035,'rows':_0x29de45}:null;}})[_0x74b1('0x27')](respondWithResult(_0x5c02fc,null))[_0x74b1('0x45')](handleError(_0x5c02fc,null));};exports[_0x74b1('0x7e')]=function(_0x33b136,_0x4f9b6a,_0x8366b){var _0x2d356c=_0x33b136['body'][_0x74b1('0x72')];var _0x3719d7;return db[_0x74b1('0x7c')][_0x74b1('0x44')]({'where':{'id':_0x2d356c},'attributes':['id'],'include':[{'model':db[_0x74b1('0x7b')],'as':_0x74b1('0x7f'),'attributes':['id',_0x74b1('0x2d'),'online',_0x74b1('0x80'),'interface'],'raw':!![]}]})[_0x74b1('0x27')](function(_0x3bd788){if(_0x3bd788){_0x3719d7=_0x3bd788;var _0x5b4ecf=_[_0x74b1('0x81')](_0x3bd788,function(_0x5dbc1f){var _0x4aa62a=_0x5dbc1f[_0x74b1('0x29')]({'plain':!![]});return _0x4aa62a['Agents'];});return db[_0x74b1('0x30')]['find']({'where':{'id':_0x33b136[_0x74b1('0x46')]['id']}})['then'](function(_0x5b8ba6){return db[_0x74b1('0x4d')]['transaction'](function(_0x2ea97c){return _0x5b8ba6[_0x74b1('0x7e')](_0x2d356c,{'transaction':_0x2ea97c})[_0x74b1('0x27')](function(){return BPromise[_0x74b1('0x82')](_0x3719d7,function(_0x433293){return db['TeamVoicePrefix'][_0x74b1('0x83')]({'TeamId':_0x433293['id'],'VoicePrefixId':_0x33b136['params']['id']},{'transaction':_0x2ea97c});});})[_0x74b1('0x27')](function(){return BPromise[_0x74b1('0x82')](_0x5b4ecf,function(_0x110bb6){return db['UserVoicePrefix'][_0x74b1('0x84')]({'where':{'UserId':_0x110bb6['id'],'VoicePrefixId':_0x33b136[_0x74b1('0x46')]['id']},'transaction':_0x2ea97c});});})['then'](function(){_0x5b4ecf[_0x74b1('0x85')](function(_0xbaf7f4){socket[_0x74b1('0x75')](_0x74b1('0x76'),{'UserId':_0xbaf7f4['id'],'VoicePrefixId':_0x5b8ba6['id']});});});});});}})['then'](respondWithStatusCode(_0x4f9b6a,null))[_0x74b1('0x45')](handleError(_0x4f9b6a,null));};exports[_0x74b1('0x86')]=function(_0x1f2add,_0x1ab4ea,_0x5b3ae9){return db[_0x74b1('0x7c')][_0x74b1('0x44')]({'where':{'id':_0x1f2add['query'][_0x74b1('0x72')]},'attributes':['id'],'include':[{'model':db[_0x74b1('0x7b')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x74b1('0x27')](handleEntityNotFound(_0x1ab4ea,null))[_0x74b1('0x27')](function(_0x39354d){var _0x484368=_['map'](_0x39354d,'id');var _0xfcd9b=[];var _0x1b3847=[];var _0x4880f6=squel['select']();_0x4880f6[_0x74b1('0x87')](_0x74b1('0x88'))['from'](_0x74b1('0x89'),'tq')[_0x74b1('0x8a')](_0x74b1('0x8b'),'ut',_0x74b1('0x8c'))[_0x74b1('0x3e')](_0x74b1('0x8d'),_0x1f2add[_0x74b1('0x46')]['id']);for(var _0x523ec1=0x0;_0x523ec1<_0x39354d[_0x74b1('0x39')];_0x523ec1+=0x1){let _0x304756=_0x39354d[_0x523ec1];for(var _0x3039d7=0x0;_0x3039d7<_0x304756[_0x74b1('0x7f')][_0x74b1('0x39')];_0x3039d7+=0x1){let _0x367373=_0x304756[_0x74b1('0x7f')][_0x3039d7];var _0x2ee3a7=_0x4880f6[_0x74b1('0x8e')]();_0x2ee3a7[_0x74b1('0x3e')]('ut.UserId\x20=\x20?',_0x367373['id']);_0x1b3847['push'](db['sequelize'][_0x74b1('0x32')](_0x2ee3a7[_0x74b1('0x8f')](),{'type':db['sequelize'][_0x74b1('0x90')][_0x74b1('0x91')]})[_0x74b1('0x27')](function(_0x399c7c){if(_0x399c7c['length']===0x1){return _0x367373['id'];}else{var _0xe421dc=_[_0x74b1('0x92')](_[_0x74b1('0x2f')](_0x399c7c,_0x74b1('0x93')),function(_0x58896f){return _['includes'](_0x484368,_0x58896f);});if(_0xe421dc){return _0x367373['id'];}}}));}}return BPromise['all'](_0x1b3847)[_0x74b1('0x27')](function(_0x20f41b){_0xfcd9b=_(_0xfcd9b)['union'](_0x20f41b)['compact']()['value']();return db[_0x74b1('0x30')]['find']({'where':{'id':_0x1f2add[_0x74b1('0x46')]['id']}})[_0x74b1('0x27')](function(_0x1326b3){return db['sequelize'][_0x74b1('0x4e')](function(_0x155534){return _0x1326b3['removeTeams'](_0x1f2add[_0x74b1('0x32')][_0x74b1('0x72')],{'transaction':_0x155534})[_0x74b1('0x27')](function(){if(!_[_0x74b1('0x94')](_0xfcd9b)){return _0x1326b3['removeAgents'](_0xfcd9b,{'transaction':_0x155534});}})[_0x74b1('0x27')](function(){_0xfcd9b[_0x74b1('0x85')](function(_0x4a9046){socket[_0x74b1('0x75')]('userVoicePrefix:remove',{'UserId':_0x4a9046,'VoicePrefixId':_0x1326b3['id']});});});});});});})[_0x74b1('0x27')](respondWithStatusCode(_0x1ab4ea,null))[_0x74b1('0x45')](handleError(_0x1ab4ea,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index 9898901..3c941b3 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 _0x4e5e=['hasOwnProperty','hook','exports','events','../../mysqldb','VoicePrefix','setMaxListeners','update','remove','emit'];(function(_0x1916ea,_0x4f312c){var _0x1373f0=function(_0x25bd5e){while(--_0x25bd5e){_0x1916ea['push'](_0x1916ea['shift']());}};_0x1373f0(++_0x4f312c);}(_0x4e5e,0x193));var _0xe4e5=function(_0x51924d,_0x356028){_0x51924d=_0x51924d-0x0;var _0x52ed00=_0x4e5e[_0x51924d];return _0x52ed00;};'use strict';var EventEmitter=require(_0xe4e5('0x0'));var VoicePrefix=require(_0xe4e5('0x1'))['db'][_0xe4e5('0x2')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0xe4e5('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xe4e5('0x4'),'afterDestroy':_0xe4e5('0x5')};function emitEvent(_0x3daa35){return function(_0x5ebdfb,_0x5d3b56,_0x5122ab){VoicePrefixEvents[_0xe4e5('0x6')](_0x3daa35+':'+_0x5ebdfb['id'],_0x5ebdfb);VoicePrefixEvents[_0xe4e5('0x6')](_0x3daa35,_0x5ebdfb);_0x5122ab(null);};}for(var e in events){if(events[_0xe4e5('0x7')](e)){var event=events[e];VoicePrefix[_0xe4e5('0x8')](e,emitEvent(event));}}module[_0xe4e5('0x9')]=VoicePrefixEvents; \ No newline at end of file +var _0x6d3b=['hook','exports','events','../../mysqldb','save','remove','emit','hasOwnProperty'];(function(_0x341088,_0x5b3366){var _0x4f1da4=function(_0x3f4b7d){while(--_0x3f4b7d){_0x341088['push'](_0x341088['shift']());}};_0x4f1da4(++_0x5b3366);}(_0x6d3b,0x10a));var _0xb6d3=function(_0x29c440,_0x32e6b1){_0x29c440=_0x29c440-0x0;var _0x45879e=_0x6d3b[_0x29c440];return _0x45879e;};'use strict';var EventEmitter=require(_0xb6d3('0x0'));var VoicePrefix=require(_0xb6d3('0x1'))['db']['VoicePrefix'];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xb6d3('0x2'),'afterUpdate':'update','afterDestroy':_0xb6d3('0x3')};function emitEvent(_0x4951ec){return function(_0x5f0a70,_0x36533b,_0x5d3428){VoicePrefixEvents[_0xb6d3('0x4')](_0x4951ec+':'+_0x5f0a70['id'],_0x5f0a70);VoicePrefixEvents[_0xb6d3('0x4')](_0x4951ec,_0x5f0a70);_0x5d3428(null);};}for(var e in events){if(events[_0xb6d3('0x5')](e)){var event=events[e];VoicePrefix[_0xb6d3('0x6')](e,emitEvent(event));}}module[_0xb6d3('0x7')]=VoicePrefixEvents; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.model.js b/server/api/voicePrefix/voicePrefix.model.js index 97a0286..86ff09d 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 _0xb907=['define','VoicePrefix','voice_prefixes','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./voicePrefix.attributes','exports'];(function(_0x460162,_0x32d95c){var _0xafe415=function(_0x1c1d09){while(--_0x1c1d09){_0x460162['push'](_0x460162['shift']());}};_0xafe415(++_0x32d95c);}(_0xb907,0x1ed));var _0x7b90=function(_0x12248d,_0x3d7302){_0x12248d=_0x12248d-0x0;var _0x3c4803=_0xb907[_0x12248d];return _0x3c4803;};'use strict';var _=require(_0x7b90('0x0'));var util=require(_0x7b90('0x1'));var logger=require(_0x7b90('0x2'))(_0x7b90('0x3'));var moment=require(_0x7b90('0x4'));var BPromise=require(_0x7b90('0x5'));var rp=require(_0x7b90('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7b90('0x7'));var config=require(_0x7b90('0x8'));var attributes=require(_0x7b90('0x9'));module[_0x7b90('0xa')]=function(_0x3a8f65,_0x259d61){return _0x3a8f65[_0x7b90('0xb')](_0x7b90('0xc'),attributes,{'tableName':_0x7b90('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa8d5=['request-promise','path','rimraf','../../config/environment','exports','define','VoicePrefix','lodash','../../config/logger','api','moment','bluebird'];(function(_0x212fad,_0x57222f){var _0x330849=function(_0x76ba07){while(--_0x76ba07){_0x212fad['push'](_0x212fad['shift']());}};_0x330849(++_0x57222f);}(_0xa8d5,0x193));var _0x5a8d=function(_0x151d07,_0x3d388e){_0x151d07=_0x151d07-0x0;var _0x4fa6f2=_0xa8d5[_0x151d07];return _0x4fa6f2;};'use strict';var _=require(_0x5a8d('0x0'));var util=require('util');var logger=require(_0x5a8d('0x1'))(_0x5a8d('0x2'));var moment=require(_0x5a8d('0x3'));var BPromise=require(_0x5a8d('0x4'));var rp=require(_0x5a8d('0x5'));var fs=require('fs');var path=require(_0x5a8d('0x6'));var rimraf=require(_0x5a8d('0x7'));var config=require(_0x5a8d('0x8'));var attributes=require('./voicePrefix.attributes');module[_0x5a8d('0x9')]=function(_0x1dc9e2,_0x4ff055){return _0x1dc9e2[_0x5a8d('0xa')](_0x5a8d('0xb'),attributes,{'tableName':'voice_prefixes','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.rpc.js b/server/api/voicePrefix/voicePrefix.rpc.js index e373536..19e80e2 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 _0xd2f5=['result','catch','lodash','util','moment','bluebird','ioredis','../../config/logger','rpc','../../config/environment','client','http','redis','localhost','socket.io-emitter','register','then','VoicePrefix,\x20%s,\x20%s','request\x20sent','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','message','info'];(function(_0x324012,_0x23f45f){var _0x435cf2=function(_0x378a82){while(--_0x378a82){_0x324012['push'](_0x324012['shift']());}};_0x435cf2(++_0x23f45f);}(_0xd2f5,0x12e));var _0x5d2f=function(_0x5f34e6,_0x10c45f){_0x5f34e6=_0x5f34e6-0x0;var _0x59ff52=_0xd2f5[_0x5f34e6];return _0x59ff52;};'use strict';var _=require(_0x5d2f('0x0'));var util=require(_0x5d2f('0x1'));var moment=require(_0x5d2f('0x2'));var BPromise=require(_0x5d2f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5d2f('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x5d2f('0x5'))(_0x5d2f('0x6'));var config=require(_0x5d2f('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x5d2f('0x8')][_0x5d2f('0x9')]({'port':0x232a});config[_0x5d2f('0xa')]=_['defaults'](config[_0x5d2f('0xa')],{'host':_0x5d2f('0xb'),'port':0x18eb});var socket=require(_0x5d2f('0xc'))(new Redis(config['redis']));require('./voicePrefix.socket')[_0x5d2f('0xd')](socket);function respondWithRpcPromise(_0x133332,_0x575f72,_0x1ee975){return new BPromise(function(_0x35f701,_0x5d7327){return client['request'](_0x133332,_0x1ee975)[_0x5d2f('0xe')](function(_0x458f43){logger['info'](_0x5d2f('0xf'),_0x575f72,_0x5d2f('0x10'));logger[_0x5d2f('0x11')](_0x5d2f('0x12'),_0x575f72,_0x5d2f('0x10'),JSON[_0x5d2f('0x13')](_0x458f43));if(_0x458f43[_0x5d2f('0x14')]){if(_0x458f43['error']['code']===0x1f4){logger['error']('VoicePrefix,\x20%s,\x20%s',_0x575f72,_0x458f43[_0x5d2f('0x14')]['message']);return _0x5d7327(_0x458f43[_0x5d2f('0x14')][_0x5d2f('0x15')]);}logger[_0x5d2f('0x14')](_0x5d2f('0xf'),_0x575f72,_0x458f43['error'][_0x5d2f('0x15')]);return _0x35f701(_0x458f43[_0x5d2f('0x14')]['message']);}else{logger[_0x5d2f('0x16')](_0x5d2f('0xf'),_0x575f72,_0x5d2f('0x10'));_0x35f701(_0x458f43[_0x5d2f('0x17')][_0x5d2f('0x15')]);}})[_0x5d2f('0x18')](function(_0x12c3e3){logger[_0x5d2f('0x14')](_0x5d2f('0xf'),_0x575f72,_0x12c3e3);_0x5d7327(_0x12c3e3);});});} \ No newline at end of file +var _0xcdd2=['./voicePrefix.socket','request','then','info','VoicePrefix,\x20%s,\x20%s','VoicePrefix,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','redis','defaults'];(function(_0x3495e3,_0x32fe58){var _0x21f6f1=function(_0x4ad057){while(--_0x4ad057){_0x3495e3['push'](_0x3495e3['shift']());}};_0x21f6f1(++_0x32fe58);}(_0xcdd2,0x83));var _0x2cdd=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcdd2[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x2cdd('0x0'));var util=require(_0x2cdd('0x1'));var moment=require(_0x2cdd('0x2'));var BPromise=require(_0x2cdd('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2cdd('0x4'));var db=require(_0x2cdd('0x5'))['db'];var utils=require(_0x2cdd('0x6'));var logger=require(_0x2cdd('0x7'))('rpc');var config=require(_0x2cdd('0x8'));var jayson=require(_0x2cdd('0x9'));var client=jayson['client'][_0x2cdd('0xa')]({'port':0x232a});config[_0x2cdd('0xb')]=_[_0x2cdd('0xc')](config[_0x2cdd('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x2cdd('0xd'))['register'](socket);function respondWithRpcPromise(_0x12cdca,_0x3e3cf0,_0x370b33){return new BPromise(function(_0x555ba7,_0x3feff9){return client[_0x2cdd('0xe')](_0x12cdca,_0x370b33)[_0x2cdd('0xf')](function(_0x20ab30){logger[_0x2cdd('0x10')](_0x2cdd('0x11'),_0x3e3cf0,'request\x20sent');logger['debug'](_0x2cdd('0x12'),_0x3e3cf0,_0x2cdd('0x13'),JSON['stringify'](_0x20ab30));if(_0x20ab30[_0x2cdd('0x14')]){if(_0x20ab30[_0x2cdd('0x14')][_0x2cdd('0x15')]===0x1f4){logger[_0x2cdd('0x14')](_0x2cdd('0x11'),_0x3e3cf0,_0x20ab30['error'][_0x2cdd('0x16')]);return _0x3feff9(_0x20ab30[_0x2cdd('0x14')]['message']);}logger[_0x2cdd('0x14')](_0x2cdd('0x11'),_0x3e3cf0,_0x20ab30[_0x2cdd('0x14')][_0x2cdd('0x16')]);return _0x555ba7(_0x20ab30[_0x2cdd('0x14')][_0x2cdd('0x16')]);}else{logger['info'](_0x2cdd('0x11'),_0x3e3cf0,_0x2cdd('0x13'));_0x555ba7(_0x20ab30[_0x2cdd('0x17')][_0x2cdd('0x16')]);}})['catch'](function(_0x23f7a6){logger[_0x2cdd('0x14')](_0x2cdd('0x11'),_0x3e3cf0,_0x23f7a6);_0x3feff9(_0x23f7a6);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index 4a53742..d2a7a88 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 _0x6594=['register','voicePrefix:','emit'];(function(_0x355d05,_0x510a0b){var _0x4d63a4=function(_0x1db624){while(--_0x1db624){_0x355d05['push'](_0x355d05['shift']());}};_0x4d63a4(++_0x510a0b);}(_0x6594,0xcb));var _0x4659=function(_0x2166a3,_0x237c50){_0x2166a3=_0x2166a3-0x0;var _0x260035=_0x6594[_0x2166a3];return _0x260035;};'use strict';var VoicePrefixEvents=require('./voicePrefix.events');var events=['save','remove','update'];function createListener(_0x309638,_0xda9ca2){return function(_0x365816){_0xda9ca2[_0x4659('0x0')](_0x309638,_0x365816);};}function removeListener(_0x2fa78c,_0x4eedfc){return function(){VoicePrefixEvents['removeListener'](_0x2fa78c,_0x4eedfc);};}exports[_0x4659('0x1')]=function(_0x2f59ce){for(var _0x246729=0x0,_0x45d2e8=events['length'];_0x246729<_0x45d2e8;_0x246729++){var _0x3adf40=events[_0x246729];var _0x39b740=createListener(_0x4659('0x2')+_0x3adf40,_0x2f59ce);VoicePrefixEvents['on'](_0x3adf40,_0x39b740);}}; \ No newline at end of file +var _0xc5ba=['length','./voicePrefix.events','save','remove','update','emit','removeListener','register'];(function(_0x4e0dae,_0x5e96b5){var _0x1e9dec=function(_0x1bb51e){while(--_0x1bb51e){_0x4e0dae['push'](_0x4e0dae['shift']());}};_0x1e9dec(++_0x5e96b5);}(_0xc5ba,0xb9));var _0xac5b=function(_0x12d812,_0x496bb7){_0x12d812=_0x12d812-0x0;var _0x3711ab=_0xc5ba[_0x12d812];return _0x3711ab;};'use strict';var VoicePrefixEvents=require(_0xac5b('0x0'));var events=[_0xac5b('0x1'),_0xac5b('0x2'),_0xac5b('0x3')];function createListener(_0x2faba9,_0x34fad9){return function(_0x3158cd){_0x34fad9[_0xac5b('0x4')](_0x2faba9,_0x3158cd);};}function removeListener(_0x3d0dc6,_0x3c48f1){return function(){VoicePrefixEvents[_0xac5b('0x5')](_0x3d0dc6,_0x3c48f1);};}exports[_0xac5b('0x6')]=function(_0x23cf2f){for(var _0x17fcf3=0x0,_0x38602a=events[_0xac5b('0x7')];_0x17fcf3<_0x38602a;_0x17fcf3++){var _0xc193a7=events[_0x17fcf3];var _0x4a7fc7=createListener('voicePrefix:'+_0xc193a7,_0x23cf2f);VoicePrefixEvents['on'](_0xc193a7,_0x4a7fc7);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index 6172d73..50bf196 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 _0xb10b=['express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','index','isAuthenticated','show','/:id/hoppers','getHoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperBlacks','/:id/teams','getTeams','/:id/users','getAgents','/:id/members','getMembers','/:id/lists','/:id/blacklists','getBlackLists','post','create','/:id/clone','addTeams','addAgents','addLists','addBlackLists','put','/:id','update','delete','removeTeams','removeAgents','removeLists','removeBlackLists','exports','multer','path','connect-timeout'];(function(_0x340c13,_0x595d66){var _0x5a7d96=function(_0x250118){while(--_0x250118){_0x340c13['push'](_0x340c13['shift']());}};_0x5a7d96(++_0x595d66);}(_0xb10b,0x12a));var _0xbb10=function(_0x502a32,_0x23d261){_0x502a32=_0x502a32-0x0;var _0x30191c=_0xb10b[_0x502a32];return _0x30191c;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var fs_extra=require(_0xbb10('0x4'));var auth=require(_0xbb10('0x5'));var interaction=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var controller=require(_0xbb10('0x8'));router[_0xbb10('0x9')]('/',auth['isAuthenticated'](),controller[_0xbb10('0xa')]);router[_0xbb10('0x9')]('/:id',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0x9')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0x9')](_0xbb10('0xf'),auth['isAuthenticated'](),controller['getHopperHistories']);router[_0xbb10('0x9')](_0xbb10('0x10'),auth[_0xbb10('0xb')](),controller['getHopperFinals']);router[_0xbb10('0x9')]('/:id/hopper_black',auth[_0xbb10('0xb')](),controller[_0xbb10('0x11')]);router[_0xbb10('0x9')](_0xbb10('0x12'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x13')]);router['get'](_0xbb10('0x14'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x15')]);router[_0xbb10('0x9')](_0xbb10('0x16'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x17')]);router[_0xbb10('0x9')](_0xbb10('0x18'),auth[_0xbb10('0xb')](),controller['getLists']);router[_0xbb10('0x9')](_0xbb10('0x19'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1a')]);router[_0xbb10('0x1b')]('/',auth[_0xbb10('0xb')](),controller[_0xbb10('0x1c')]);router[_0xbb10('0x1b')](_0xbb10('0x1d'),auth[_0xbb10('0xb')](),controller['clone']);router[_0xbb10('0x1b')](_0xbb10('0x12'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1e')]);router[_0xbb10('0x1b')](_0xbb10('0x14'),auth['isAuthenticated'](),controller[_0xbb10('0x1f')]);router[_0xbb10('0x1b')]('/:id/lists',auth['isAuthenticated'](),controller[_0xbb10('0x20')]);router[_0xbb10('0x1b')](_0xbb10('0x19'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x21')]);router[_0xbb10('0x22')](_0xbb10('0x23'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x24')]);router[_0xbb10('0x25')](_0xbb10('0x23'),auth[_0xbb10('0xb')](),controller['destroy']);router['delete']('/:id/teams',auth[_0xbb10('0xb')](),controller[_0xbb10('0x26')]);router[_0xbb10('0x25')]('/:id/users',auth[_0xbb10('0xb')](),controller[_0xbb10('0x27')]);router[_0xbb10('0x25')](_0xbb10('0x18'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x28')]);router[_0xbb10('0x25')]('/:id/blacklists',auth[_0xbb10('0xb')](),controller[_0xbb10('0x29')]);module[_0xbb10('0x2a')]=router; \ No newline at end of file +var _0xb10b=['express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','index','isAuthenticated','show','/:id/hoppers','getHoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperBlacks','/:id/teams','getTeams','/:id/users','getAgents','/:id/members','getMembers','/:id/lists','/:id/blacklists','getBlackLists','post','create','/:id/clone','addTeams','addAgents','addLists','addBlackLists','put','/:id','update','delete','removeTeams','removeAgents','removeLists','removeBlackLists','exports','multer','path','connect-timeout'];(function(_0x47e549,_0x2e53d6){var _0x251374=function(_0x400458){while(--_0x400458){_0x47e549['push'](_0x47e549['shift']());}};_0x251374(++_0x2e53d6);}(_0xb10b,0x12a));var _0xbb10=function(_0x48bc0d,_0x30becd){_0x48bc0d=_0x48bc0d-0x0;var _0x35f641=_0xb10b[_0x48bc0d];return _0x35f641;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var fs_extra=require(_0xbb10('0x4'));var auth=require(_0xbb10('0x5'));var interaction=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var controller=require(_0xbb10('0x8'));router[_0xbb10('0x9')]('/',auth['isAuthenticated'](),controller[_0xbb10('0xa')]);router[_0xbb10('0x9')]('/:id',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0x9')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0x9')](_0xbb10('0xf'),auth['isAuthenticated'](),controller['getHopperHistories']);router[_0xbb10('0x9')](_0xbb10('0x10'),auth[_0xbb10('0xb')](),controller['getHopperFinals']);router[_0xbb10('0x9')]('/:id/hopper_black',auth[_0xbb10('0xb')](),controller[_0xbb10('0x11')]);router[_0xbb10('0x9')](_0xbb10('0x12'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x13')]);router['get'](_0xbb10('0x14'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x15')]);router[_0xbb10('0x9')](_0xbb10('0x16'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x17')]);router[_0xbb10('0x9')](_0xbb10('0x18'),auth[_0xbb10('0xb')](),controller['getLists']);router[_0xbb10('0x9')](_0xbb10('0x19'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1a')]);router[_0xbb10('0x1b')]('/',auth[_0xbb10('0xb')](),controller[_0xbb10('0x1c')]);router[_0xbb10('0x1b')](_0xbb10('0x1d'),auth[_0xbb10('0xb')](),controller['clone']);router[_0xbb10('0x1b')](_0xbb10('0x12'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1e')]);router[_0xbb10('0x1b')](_0xbb10('0x14'),auth['isAuthenticated'](),controller[_0xbb10('0x1f')]);router[_0xbb10('0x1b')]('/:id/lists',auth['isAuthenticated'](),controller[_0xbb10('0x20')]);router[_0xbb10('0x1b')](_0xbb10('0x19'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x21')]);router[_0xbb10('0x22')](_0xbb10('0x23'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x24')]);router[_0xbb10('0x25')](_0xbb10('0x23'),auth[_0xbb10('0xb')](),controller['destroy']);router['delete']('/:id/teams',auth[_0xbb10('0xb')](),controller[_0xbb10('0x26')]);router[_0xbb10('0x25')]('/:id/users',auth[_0xbb10('0xb')](),controller[_0xbb10('0x27')]);router[_0xbb10('0x25')](_0xbb10('0x18'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x28')]);router[_0xbb10('0x25')]('/:id/blacklists',auth[_0xbb10('0xb')](),controller[_0xbb10('0x29')]);module[_0xbb10('0x2a')]=router; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.attributes.js b/server/api/voiceQueue/voiceQueue.attributes.js index 1308d11..9b6027d 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 _0x382e=['strategy','rrmemory','getDataValue','type','dialMethod','preview','booked','roundrobin','INTEGER','yes','all','once','periodic_announce','split','joinempty','leavewhenempty','join','BOOLEAN','wrapuptime','Active/Disactive\x20Campaign','power','predictive','progressive','Dial\x20Method.','UNSIGNED','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','FLOAT','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','dropRate','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','tTxX','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','always','never','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','#RecallMe\x20Timeout\x20(min:1)','Active/Disactive\x20Recall\x20In\x20Queue','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','ENUM','inbound','outbound','STRING','default','leastrecent','fewestcalls','random','linear','wrandom','rrordered','ringall','setDataValue'];(function(_0x428800,_0x14f0b6){var _0x17e16e=function(_0x30b186){while(--_0x30b186){_0x428800['push'](_0x428800['shift']());}};_0x17e16e(++_0x14f0b6);}(_0x382e,0x17c));var _0xe382=function(_0x34b0a,_0x18640f){_0x34b0a=_0x34b0a-0x0;var _0x2e27f8=_0x382e[_0x34b0a];return _0x2e27f8;};'use strict';var Sequelize=require(_0xe382('0x0'));module[_0xe382('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xe382('0x2')](_0xe382('0x3'),_0xe382('0x4')),'allowNull':![],'defaultValue':_0xe382('0x3')},'musiconhold':{'type':Sequelize[_0xe382('0x5')],'defaultValue':_0xe382('0x6')},'announce':{'type':Sequelize['STRING'],'defaultValue':''},'strategy':{'type':Sequelize[_0xe382('0x2')]('rr','ringall',_0xe382('0x7'),_0xe382('0x8'),_0xe382('0x9'),'rrmemory',_0xe382('0xa'),_0xe382('0xb'),_0xe382('0xc')),'allowNull':![],'defaultValue':_0xe382('0xd'),'set':function(_0x32cbd7){this[_0xe382('0xe')](_0xe382('0xf'),_0x32cbd7?_0x32cbd7:_0xe382('0x10'));},'get':function(){var _0x9a2872=this[_0xe382('0x11')](_0xe382('0x12'));var _0x445349=this[_0xe382('0x11')](_0xe382('0x13'));var _0x3cfc93=this[_0xe382('0x11')]('strategy');if(_0x9a2872===_0xe382('0x4')){if(_0x445349===_0xe382('0x14')){return null;}if(_0x445349===_0xe382('0x15')&&![_0xe382('0x10'),_0xe382('0x16')]['includes'](_0x3cfc93)){this[_0xe382('0xe')](_0xe382('0xf'),'rrmemory');}}return _0x3cfc93;}},'servicelevel':{'type':Sequelize[_0xe382('0x17')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0xe382('0x5')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0xe382('0x17')](0xb)},'timeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0xe382('0x17')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize['STRING']},'weight':{'type':Sequelize[_0xe382('0x17')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0xe382('0x2')](_0xe382('0x18'),'no'),'defaultValue':_0xe382('0x18')},'autopause':{'type':Sequelize[_0xe382('0x2')](_0xe382('0x18'),'no',_0xe382('0x19')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0xe382('0x17')](0xb)},'autopausebusy':{'type':Sequelize[_0xe382('0x2')](_0xe382('0x18'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0xe382('0x2')](_0xe382('0x18'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0xe382('0x17')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0xe382('0x2')](_0xe382('0x18'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0xe382('0x2')](_0xe382('0x18'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize['ENUM'](_0xe382('0x18'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0xe382('0x2')](_0xe382('0x18'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0xe382('0x5')],'allowNull':!![]},'membergosub':{'type':Sequelize['STRING'],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0xe382('0x17')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0xe382('0x17')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0xe382('0x17')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0xe382('0x2')](_0xe382('0x18'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0xe382('0x2')](_0xe382('0x18'),'no'),'defaultValue':'yes'},'announce_holdtime':{'type':Sequelize[_0xe382('0x2')](_0xe382('0x18'),'no',_0xe382('0x1a')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0xe382('0x5')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0xe382('0x2')](_0xe382('0x18'),'no')},'announce_position_limit':{'type':Sequelize[_0xe382('0x17')](0xb)},'announce_round_seconds':{'type':Sequelize[_0xe382('0x2')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize['STRING'],'defaultValue':''},'monitor_type':{'type':Sequelize[_0xe382('0x5')]},'queue_youarenext':{'type':Sequelize[_0xe382('0x5')],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0xe382('0x5')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize['STRING'],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0xe382('0x5')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0xe382('0x5')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0xe382('0x5')],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0xe382('0x5')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0xe382('0x5')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0xe382('0x5')]},'queue_quantity1':{'type':Sequelize['STRING']},'queue_quantity2':{'type':Sequelize[_0xe382('0x5')]},'queue_periodic_announce':{'type':Sequelize[_0xe382('0x5')]},'queue_less_than':{'type':Sequelize['STRING']},'periodic_announce':{'type':Sequelize['TEXT'],'set':function(_0x4358d0){this[_0xe382('0xe')](_0xe382('0x1b'),_0x4358d0?_0x4358d0['join'](','):[]);},'get':function(){return this[_0xe382('0x11')](_0xe382('0x1b'))?this['getDataValue'](_0xe382('0x1b'))[_0xe382('0x1c')](','):[];}},'joinempty':{'type':Sequelize['STRING'],'defaultValue':'yes','set':function(_0x28f7b6){this[_0xe382('0xe')](_0xe382('0x1d'),_0x28f7b6?_0x28f7b6['join'](','):undefined);},'get':function(){return this[_0xe382('0x11')](_0xe382('0x1d'))?this[_0xe382('0x11')](_0xe382('0x1d'))[_0xe382('0x1c')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0xe382('0x5')],'defaultValue':'no','set':function(_0x3c6629){this[_0xe382('0xe')](_0xe382('0x1e'),_0x3c6629?_0x3c6629[_0xe382('0x1f')](','):undefined);},'get':function(){return this['getDataValue'](_0xe382('0x1e'))?this[_0xe382('0x11')](_0xe382('0x1e'))[_0xe382('0x1c')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0xe382('0x2')](_0xe382('0x18'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0xe382('0x2')]('yes','no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0xe382('0x2')](_0xe382('0x18'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0xe382('0x5')]},'description':{'type':Sequelize[_0xe382('0x5')]},'acw':{'type':Sequelize[_0xe382('0x20')],'defaultValue':0x0,'set':function(_0x4290b5){this[_0xe382('0xe')]('acw',_0x4290b5);if(_0x4290b5){if(this['getDataValue'](_0xe382('0x21'))<0x2){this['setDataValue'](_0xe382('0x21'),0x2);}}}},'acwTimeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0xe382('0x20')],'defaultValue':0x0,'comment':_0xe382('0x22')},'dialMethod':{'type':Sequelize[_0xe382('0x2')](_0xe382('0x14'),'progressive',_0xe382('0x23'),_0xe382('0x24'),_0xe382('0x15')),'defaultValue':_0xe382('0x25'),'comment':_0xe382('0x26')},'dialLimitChannel':{'type':Sequelize[_0xe382('0x17')](0x4)[_0xe382('0x27')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':'Max\x209999\x20channels,\x200\x20means\x20unlimited.'},'dialLimitQueue':{'type':Sequelize[_0xe382('0x17')](0x4)['UNSIGNED'],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0xe382('0x28')},'dialPowerLevel':{'type':Sequelize[_0xe382('0x29')](0x2)[_0xe382('0x27')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0xe382('0x2a')},'dialPredictiveOptimization':{'type':Sequelize[_0xe382('0x2')]('agentBusyFactor','dropRate'),'defaultValue':_0xe382('0x2b'),'comment':'Only\x20for\x20predictive\x20method.'},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0xe382('0x29')](0x2)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0xe382('0x2c')},'dialPredictiveInterval':{'type':Sequelize[_0xe382('0x17')](0x3)['UNSIGNED'],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':'Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)'},'dialOriginateCallerIdName':{'type':Sequelize[_0xe382('0x5')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xe382('0x5')]},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)[_0xe382('0x27')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xe382('0x2d')},'dialQueueOptions':{'type':Sequelize[_0xe382('0x5')],'defaultValue':_0xe382('0x2e'),'comment':_0xe382('0x2f')},'dialQueueTimeout':{'type':Sequelize[_0xe382('0x17')](0x3)[_0xe382('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialQueueProject':{'type':Sequelize[_0xe382('0x5')],'comment':_0xe382('0x30')},'dialCongestionMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xe382('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize[_0xe382('0x17')](0x5)[_0xe382('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xe382('0x31')},'dialBusyMaxRetry':{'type':Sequelize[_0xe382('0x17')](0x3)[_0xe382('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize[_0xe382('0x17')](0x5)[_0xe382('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xe382('0x32')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xe382('0x17')](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':'#NoAnswer\x20Retry\x20(min:1,\x20max:999)'},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xe382('0x17')](0x5)[_0xe382('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xe382('0x33')},'dialGlobalMaxRetry':{'type':Sequelize[_0xe382('0x17')](0x3)[_0xe382('0x27')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xe382('0x34')},'dialTimezone':{'type':Sequelize[_0xe382('0x5')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xe382('0x5')],'defaultValue':'07:00-22:00,*,*,*'},'dialPrefix':{'type':Sequelize[_0xe382('0x5')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0xe382('0x2')](_0xe382('0x35'),_0xe382('0x36'),_0xe382('0x37')),'defaultValue':'always'},'dialAMDActive':{'type':Sequelize[_0xe382('0x20')],'defaultValue':0x0,'comment':_0xe382('0x38')},'dialAMDInitialSilence':{'type':Sequelize['INTEGER'](0x9)[_0xe382('0x27')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xe382('0x39')},'dialAMDGreeting':{'type':Sequelize[_0xe382('0x17')](0x9)[_0xe382('0x27')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xe382('0x3a')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xe382('0x17')](0x9)[_0xe382('0x27')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xe382('0x3b')},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)[_0xe382('0x27')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xe382('0x3c')},'dialAMDMinWordLength':{'type':Sequelize['INTEGER'](0x9)[_0xe382('0x27')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xe382('0x3d')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xe382('0x17')](0x9)[_0xe382('0x27')],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xe382('0x17')](0x9)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xe382('0x3e')},'dialAMDMaximumWordLength':{'type':Sequelize[_0xe382('0x17')](0x9)[_0xe382('0x27')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xe382('0x3f')},'dialRecallMeTimeout':{'type':Sequelize[_0xe382('0x17')](0x5)[_0xe382('0x27')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0xe382('0x40')},'dialRecallInQueue':{'type':Sequelize[_0xe382('0x20')],'defaultValue':0x0,'comment':_0xe382('0x41')},'dialOrderByScheduledAt':{'type':Sequelize[_0xe382('0x2')](_0xe382('0x42'),_0xe382('0x43')),'defaultValue':'DESC'},'dialQueueProject2':{'type':Sequelize[_0xe382('0x5')],'comment':_0xe382('0x30')},'dialAgiAfterHangupClient':{'type':Sequelize[_0xe382('0x20')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0xe382('0x20')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xe382('0x17')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xe382('0x44')},'dialCutDigit':{'type':Sequelize[_0xe382('0x17')](0x3)[_0xe382('0x27')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xe382('0x45')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xe382('0x17')](0x3)[_0xe382('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xe382('0x17')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xe382('0x46')},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xe382('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Drop\x20Retry\x20(min:1,\x20max:999)'},'dialDropRetryFrequency':{'type':Sequelize[_0xe382('0x17')](0x5)[_0xe382('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xe382('0x47')},'dialAbandonedMaxRetry':{'type':Sequelize[_0xe382('0x17')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xe382('0x48')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xe382('0x17')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xe382('0x49')},'dialMachineMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xe382('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize[_0xe382('0x17')](0x5)[_0xe382('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xe382('0x4a')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xe382('0x17')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#AgentReject\x20Retry\x20(min:1,\x20max:999)'},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xe382('0x17')](0x5)[_0xe382('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xe382('0x4b')},'mandatoryDispositionPauseId':{'type':Sequelize[_0xe382('0x17')],'allowNull':!![],'comment':_0xe382('0x4c')},'mandatoryDisposition':{'type':Sequelize[_0xe382('0x20')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x257350){if(!_0x257350)this[_0xe382('0xe')](_0xe382('0x4d'),null);this[_0xe382('0xe')](_0xe382('0x4e'),_0x257350);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0xe382('0x17')](0x3)['UNSIGNED'],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0xe382('0x17')](0x3)[_0xe382('0x27')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize[_0xe382('0x20')],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize[_0xe382('0x17')](0x3)[_0xe382('0x27')],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize[_0xe382('0x20')],'defaultValue':![]}}; \ No newline at end of file +var _0x1758=['tTxX','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','never','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','Active/Disactive\x20Recall\x20In\x20Queue','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','NoSuchNumber\x20Retry\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','mandatoryDisposition','sequelize','exports','STRING','name','ENUM','inbound','outbound','default','ringall','leastrecent','random','rrmemory','linear','rrordered','strategy','getDataValue','type','dialMethod','preview','booked','roundrobin','includes','setDataValue','INTEGER','yes','TEXT','periodic_announce','join','split','joinempty','leavewhenempty','BOOLEAN','wrapuptime','Active/Disactive\x20Campaign','predictive','UNSIGNED','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','FLOAT','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','dropRate','Only\x20for\x20predictive\x20method.','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)'];(function(_0x2e628b,_0xc7920){var _0x4beb0f=function(_0x4f1be1){while(--_0x4f1be1){_0x2e628b['push'](_0x2e628b['shift']());}};_0x4beb0f(++_0xc7920);}(_0x1758,0x111));var _0x8175=function(_0x4a456f,_0x283d9){_0x4a456f=_0x4a456f-0x0;var _0x4c6ca7=_0x1758[_0x4a456f];return _0x4c6ca7;};'use strict';var Sequelize=require(_0x8175('0x0'));module[_0x8175('0x1')]={'name':{'type':Sequelize[_0x8175('0x2')],'allowNull':![],'unique':_0x8175('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x8175('0x4')](_0x8175('0x5'),_0x8175('0x6')),'allowNull':![],'defaultValue':_0x8175('0x5')},'musiconhold':{'type':Sequelize['STRING'],'defaultValue':_0x8175('0x7')},'announce':{'type':Sequelize[_0x8175('0x2')],'defaultValue':''},'strategy':{'type':Sequelize[_0x8175('0x4')]('rr',_0x8175('0x8'),_0x8175('0x9'),'fewestcalls',_0x8175('0xa'),_0x8175('0xb'),_0x8175('0xc'),'wrandom',_0x8175('0xd')),'allowNull':![],'defaultValue':_0x8175('0x8'),'set':function(_0x2b088c){this['setDataValue'](_0x8175('0xe'),_0x2b088c?_0x2b088c:_0x8175('0xb'));},'get':function(){var _0x5bcb69=this[_0x8175('0xf')](_0x8175('0x10'));var _0x5688b7=this['getDataValue'](_0x8175('0x11'));var _0x30e066=this[_0x8175('0xf')](_0x8175('0xe'));if(_0x5bcb69===_0x8175('0x6')){if(_0x5688b7===_0x8175('0x12')){return null;}if(_0x5688b7===_0x8175('0x13')&&![_0x8175('0xb'),_0x8175('0x14')][_0x8175('0x15')](_0x30e066)){this[_0x8175('0x16')](_0x8175('0xe'),_0x8175('0xb'));}}return _0x30e066;}},'servicelevel':{'type':Sequelize[_0x8175('0x17')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x8175('0x2')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0x8175('0x17')](0xb)},'timeout':{'type':Sequelize[_0x8175('0x17')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0x8175('0x17')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x8175('0x2')]},'weight':{'type':Sequelize[_0x8175('0x17')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0x8175('0x17')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x8175('0x4')](_0x8175('0x18'),'no'),'defaultValue':_0x8175('0x18')},'autopause':{'type':Sequelize[_0x8175('0x4')](_0x8175('0x18'),'no','all'),'defaultValue':'no'},'autopausedelay':{'type':Sequelize['INTEGER'](0xb)},'autopausebusy':{'type':Sequelize['ENUM'](_0x8175('0x18'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0x8175('0x17')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0x8175('0x4')](_0x8175('0x18'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize['ENUM']('yes','no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0x8175('0x4')](_0x8175('0x18'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize['ENUM'](_0x8175('0x18'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0x8175('0x2')],'allowNull':!![]},'membergosub':{'type':Sequelize['STRING'],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0x8175('0x17')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0x8175('0x17')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0x8175('0x4')]('yes','no'),'defaultValue':_0x8175('0x18')},'announce_holdtime':{'type':Sequelize['ENUM']('yes','no','once'),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0x8175('0x2')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0x8175('0x4')](_0x8175('0x18'),'no')},'announce_position_limit':{'type':Sequelize[_0x8175('0x17')](0xb)},'announce_round_seconds':{'type':Sequelize['ENUM']('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize['STRING'],'defaultValue':''},'monitor_type':{'type':Sequelize[_0x8175('0x2')]},'queue_youarenext':{'type':Sequelize['STRING'],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0x8175('0x2')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize['STRING'],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0x8175('0x2')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x8175('0x2')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize['STRING'],'defaultValue':null},'queue_seconds':{'type':Sequelize['STRING'],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x8175('0x2')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0x8175('0x2')]},'queue_quantity1':{'type':Sequelize[_0x8175('0x2')]},'queue_quantity2':{'type':Sequelize[_0x8175('0x2')]},'queue_periodic_announce':{'type':Sequelize['STRING']},'queue_less_than':{'type':Sequelize[_0x8175('0x2')]},'periodic_announce':{'type':Sequelize[_0x8175('0x19')],'set':function(_0xd9fd45){this[_0x8175('0x16')](_0x8175('0x1a'),_0xd9fd45?_0xd9fd45[_0x8175('0x1b')](','):[]);},'get':function(){return this[_0x8175('0xf')](_0x8175('0x1a'))?this[_0x8175('0xf')](_0x8175('0x1a'))[_0x8175('0x1c')](','):[];}},'joinempty':{'type':Sequelize['STRING'],'defaultValue':'yes','set':function(_0x3d460b){this[_0x8175('0x16')](_0x8175('0x1d'),_0x3d460b?_0x3d460b['join'](','):undefined);},'get':function(){return this[_0x8175('0xf')](_0x8175('0x1d'))?this[_0x8175('0xf')](_0x8175('0x1d'))[_0x8175('0x1c')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0x8175('0x2')],'defaultValue':'no','set':function(_0x4fc2ad){this[_0x8175('0x16')](_0x8175('0x1e'),_0x4fc2ad?_0x4fc2ad['join'](','):undefined);},'get':function(){return this[_0x8175('0xf')](_0x8175('0x1e'))?this[_0x8175('0xf')](_0x8175('0x1e'))['split'](','):undefined;}},'reportholdtime':{'type':Sequelize[_0x8175('0x4')](_0x8175('0x18'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0x8175('0x4')](_0x8175('0x18'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0x8175('0x17')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize['ENUM'](_0x8175('0x18'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x8175('0x2')]},'description':{'type':Sequelize['STRING']},'acw':{'type':Sequelize[_0x8175('0x1f')],'defaultValue':0x0,'set':function(_0x157e1a){this[_0x8175('0x16')]('acw',_0x157e1a);if(_0x157e1a){if(this[_0x8175('0xf')](_0x8175('0x20'))<0x2){this[_0x8175('0x16')](_0x8175('0x20'),0x2);}}}},'acwTimeout':{'type':Sequelize[_0x8175('0x17')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x8175('0x1f')],'defaultValue':0x0,'comment':_0x8175('0x21')},'dialMethod':{'type':Sequelize[_0x8175('0x4')]('preview','progressive','power',_0x8175('0x22'),_0x8175('0x13')),'defaultValue':'progressive','comment':'Dial\x20Method.'},'dialLimitChannel':{'type':Sequelize[_0x8175('0x17')](0x4)[_0x8175('0x23')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':'Max\x209999\x20channels,\x200\x20means\x20unlimited.'},'dialLimitQueue':{'type':Sequelize[_0x8175('0x17')](0x4)[_0x8175('0x23')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x8175('0x24')},'dialPowerLevel':{'type':Sequelize[_0x8175('0x25')](0x2)['UNSIGNED'],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0x8175('0x26')},'dialPredictiveOptimization':{'type':Sequelize['ENUM']('agentBusyFactor',_0x8175('0x27')),'defaultValue':_0x8175('0x27'),'comment':_0x8175('0x28')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0x8175('0x25')](0x2)[_0x8175('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0x8175('0x29')},'dialPredictiveInterval':{'type':Sequelize[_0x8175('0x17')](0x3)[_0x8175('0x23')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0x8175('0x2a')},'dialOriginateCallerIdName':{'type':Sequelize[_0x8175('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x8175('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0x8175('0x17')](0x3)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':'Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialQueueOptions':{'type':Sequelize['STRING'],'defaultValue':_0x8175('0x2b'),'comment':_0x8175('0x2c')},'dialQueueTimeout':{'type':Sequelize[_0x8175('0x17')](0x3)[_0x8175('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialQueueProject':{'type':Sequelize['STRING'],'comment':_0x8175('0x2d')},'dialCongestionMaxRetry':{'type':Sequelize[_0x8175('0x17')](0x3)[_0x8175('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x8175('0x2e')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x8175('0x17')](0x5)[_0x8175('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x8175('0x2f')},'dialBusyMaxRetry':{'type':Sequelize[_0x8175('0x17')](0x3)[_0x8175('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x8175('0x30')},'dialBusyRetryFrequency':{'type':Sequelize[_0x8175('0x17')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x8175('0x31')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x8175('0x17')](0x3)[_0x8175('0x23')],'defaultValue':0x3,'comment':_0x8175('0x32')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x8175('0x17')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x8175('0x33')},'dialGlobalMaxRetry':{'type':Sequelize[_0x8175('0x17')](0x3)['UNSIGNED'],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x8175('0x34')},'dialTimezone':{'type':Sequelize[_0x8175('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x8175('0x2')],'defaultValue':_0x8175('0x35')},'dialPrefix':{'type':Sequelize[_0x8175('0x2')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0x8175('0x4')](_0x8175('0x36'),_0x8175('0x37'),_0x8175('0x38')),'defaultValue':_0x8175('0x36')},'dialAMDActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x8175('0x39')},'dialAMDInitialSilence':{'type':Sequelize[_0x8175('0x17')](0x9)[_0x8175('0x23')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x8175('0x3a')},'dialAMDGreeting':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':'#AMD\x20Greeting'},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x8175('0x17')](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x8175('0x3b')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x8175('0x17')](0x9)[_0x8175('0x23')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x8175('0x3c')},'dialAMDMinWordLength':{'type':Sequelize[_0x8175('0x17')](0x9)[_0x8175('0x23')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x8175('0x3d')},'dialAMDBetweenWordsSilence':{'type':Sequelize['INTEGER'](0x9)[_0x8175('0x23')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x8175('0x3e')},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x8175('0x3f')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x8175('0x17')](0x5)[_0x8175('0x23')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x8175('0x40')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x8175('0x17')](0x9)[_0x8175('0x23')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialRecallMeTimeout':{'type':Sequelize[_0x8175('0x17')](0x5)[_0x8175('0x23')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':'#RecallMe\x20Timeout\x20(min:1)'},'dialRecallInQueue':{'type':Sequelize[_0x8175('0x1f')],'defaultValue':0x0,'comment':_0x8175('0x41')},'dialOrderByScheduledAt':{'type':Sequelize[_0x8175('0x4')](_0x8175('0x42'),_0x8175('0x43')),'defaultValue':_0x8175('0x42')},'dialQueueProject2':{'type':Sequelize['STRING'],'comment':_0x8175('0x2d')},'dialAgiAfterHangupClient':{'type':Sequelize[_0x8175('0x1f')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x8175('0x17')](0x3)[_0x8175('0x23')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x8175('0x44')},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)[_0x8175('0x23')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x8175('0x45')},'dialNoSuchNumberMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x8175('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x8175('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x8175('0x46')},'dialDropMaxRetry':{'type':Sequelize[_0x8175('0x17')](0x3)[_0x8175('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Drop\x20Retry\x20(min:1,\x20max:999)'},'dialDropRetryFrequency':{'type':Sequelize[_0x8175('0x17')](0x5)[_0x8175('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAbandonedMaxRetry':{'type':Sequelize[_0x8175('0x17')](0x3)[_0x8175('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x8175('0x47')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x8175('0x17')](0x5)[_0x8175('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x8175('0x48')},'dialMachineMaxRetry':{'type':Sequelize[_0x8175('0x17')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x8175('0x49')},'dialMachineRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x8175('0x17')](0x3)[_0x8175('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x8175('0x4a')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x8175('0x17')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x8175('0x4b')},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'comment':_0x8175('0x4c')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x8175('0x4d'),'set':function(_0x3dd205){if(!_0x3dd205)this[_0x8175('0x16')]('mandatoryDispositionPauseId',null);this[_0x8175('0x16')](_0x8175('0x4e'),_0x3dd205);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0x8175('0x17')](0x3)[_0x8175('0x23')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0x8175('0x17')](0x3)[_0x8175('0x23')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize[_0x8175('0x1f')],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize['INTEGER'](0x3)[_0x8175('0x23')],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize[_0x8175('0x1f')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.controller.js b/server/api/voiceQueue/voiceQueue.controller.js index 8cd5762..93e7149 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 _0x4b84=['type','find','UserProfileResource','stack','name','send','index','rawAttributes','fieldName','key','getOptions','where','VoiceQueue','include','findAll','rows','catch','show','params','model','keys','query','filters','intersection','attributes','fields','length','includeAll','merge','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','userProfileId','findOne','hasOwnProperty','nolimit','order','sort','VoiceQueueId','CmHopper','getHopperHistories','pick','CmHopperHistory','CmHopperFinal','CmHopperBlack','getTeams','Team','addTeams','User','Agents','voicePause','interface','forEach','penalty','transaction','TeamVoiceQueue','each','UserVoiceQueue','UserVoiceQueueRt','upsert','format','SIP/%s','emit','ids','field','from','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','sequelize','SELECT','TeamId','all','removeTeams','isEmpty','removeAgents','addAgents','spread','userVoiceQueue:save','online','isNil','isArray','userVoiceQueue:remove','getAgents','getMembers','getLists','CmList','addLists','dialCheckDuplicateType','fromQuery','phone','scheduledAt','ContactId','ListId','select','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','CmListId','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','COALESCE(phone,\x27\x27)','cm_hopper','onlyIfOpen','insert','into','CmHopperId','OrderBy','h.id','ci.item','ci.OrderBy+1','cm_contact_has_items','h.scheduledat=?','ci.ItemClass=?','removeLists','getBlackLists','NOW()','removeBlackLists','moment','bluebird','squel','../../config/logger','api','../../config/environment','redis','socket.io-emitter','./voiceQueue.socket','sendStatus','end','status','json','undefined','count','offset','limit','update','destroy','then','get','VoiceQueues','inbound','QueueCampaigns','outbound','filter','ignore','map','value'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4b84,0x1cc));var _0x44b8=function(_0x23c6f2,_0x4e033c){_0x23c6f2=_0x23c6f2-0x0;var _0x4c270b=_0x4b84[_0x23c6f2];return _0x4c270b;};'use strict';var moment=require(_0x44b8('0x0'));var BPromise=require(_0x44b8('0x1'));var util=require('util');var _=require('lodash');var squel=require(_0x44b8('0x2'));var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var logger=require(_0x44b8('0x3'))(_0x44b8('0x4'));var config=require(_0x44b8('0x5'));var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config[_0x44b8('0x6')],{'host':'localhost','port':0x18eb});var socket=require(_0x44b8('0x7'))(new Redis(config['redis']));require(_0x44b8('0x8'))['register'](socket);function respondWithStatusCode(_0x5034b6,_0x41d515){_0x41d515=_0x41d515||0xcc;return function(_0x42319d){if(_0x42319d){return _0x5034b6[_0x44b8('0x9')](_0x41d515);}return _0x5034b6['status'](_0x41d515)[_0x44b8('0xa')]();};}function respondWithResult(_0x2cc74b,_0x4315f6){_0x4315f6=_0x4315f6||0xc8;return function(_0x9b6048){if(_0x9b6048){return _0x2cc74b[_0x44b8('0xb')](_0x4315f6)[_0x44b8('0xc')](_0x9b6048);}};}function respondWithFilteredResult(_0xe9a025,_0x4ae8a1){return function(_0x147529){if(_0x147529){var _0x4301a6=typeof _0x4ae8a1['offset']===_0x44b8('0xd')&&typeof _0x4ae8a1['limit']===_0x44b8('0xd');var _0x18d642=_0x147529['count'];var _0x63e8f6=_0x4301a6?0x0:_0x4ae8a1['offset'];var _0x54fa95=_0x4301a6?_0x147529[_0x44b8('0xe')]:_0x4ae8a1[_0x44b8('0xf')]+_0x4ae8a1[_0x44b8('0x10')];var _0x41ab46;if(_0x54fa95>=_0x18d642){_0x54fa95=_0x18d642;_0x41ab46=0xc8;}else{_0x41ab46=0xce;}_0xe9a025['status'](_0x41ab46);return _0xe9a025['set']('Content-Range',_0x63e8f6+'-'+_0x54fa95+'/'+_0x18d642)[_0x44b8('0xc')](_0x147529);}return null;};}function saveUpdates(_0x5b7803){return function(_0x28ef36){if(_0x28ef36){return _0x28ef36[_0x44b8('0x11')](_0x5b7803)['then'](function(_0x36743e){return _0x36743e;});}return null;};}function removeEntity(_0xe3de8f){return function(_0x5103f5){if(_0x5103f5){return _0x5103f5[_0x44b8('0x12')]()[_0x44b8('0x13')](function(){var _0x4b600f=_0x5103f5[_0x44b8('0x14')]({'plain':!![]});var _0x8b4301=[{'name':_0x44b8('0x15'),'value':_0x44b8('0x16'),'ignore':![]},{'name':_0x44b8('0x17'),'value':_0x44b8('0x18'),'ignore':![]}];var _0x452f2f=_(_0x8b4301)[_0x44b8('0x19')](_0x44b8('0x1a'))[_0x44b8('0x1b')](_0x44b8('0x1c'))[_0x44b8('0x1c')]();if(_['includes'](_0x452f2f,_0x4b600f[_0x44b8('0x1d')])){return;}var _0x3a8aa4=_[_0x44b8('0x1e')](_0x8b4301,[_0x44b8('0x1c'),_0x4b600f[_0x44b8('0x1d')]])['name'];return db[_0x44b8('0x1f')]['destroy']({'where':{'type':_0x3a8aa4,'resourceId':_0x4b600f['id']}})[_0x44b8('0x13')](function(){return _0x5103f5;});})[_0x44b8('0x13')](function(){_0xe3de8f[_0x44b8('0xb')](0xcc)[_0x44b8('0xa')]();});}};}function handleEntityNotFound(_0x230a3d){return function(_0x59acbc){if(!_0x59acbc){_0x230a3d[_0x44b8('0x9')](0x194);}return _0x59acbc;};}function handleError(_0x502acf,_0x41d673){_0x41d673=_0x41d673||0x1f4;return function(_0x350482){logger['error'](_0x350482[_0x44b8('0x20')]);if(_0x350482[_0x44b8('0x21')]){delete _0x350482[_0x44b8('0x21')];}_0x502acf['status'](_0x41d673)[_0x44b8('0x22')](_0x350482);};}exports[_0x44b8('0x23')]=function(_0x53d9c7,_0x2e0174){var _0x4a182d={};var _0xfb0028={'count':0x0,'rows':[]};var _0x5a544c=_['map'](db['VoiceQueue'][_0x44b8('0x24')],function(_0x29b18d){return{'name':_0x29b18d[_0x44b8('0x25')],'type':_0x29b18d[_0x44b8('0x1d')][_0x44b8('0x26')]};});_0x4a182d=qs[_0x44b8('0x27')](_0x5a544c,_0x53d9c7);var _0x2cf205={'where':_0x4a182d[_0x44b8('0x28')]};return db[_0x44b8('0x29')][_0x44b8('0xe')](_0x2cf205)[_0x44b8('0x13')](function(_0x417d81){_0xfb0028[_0x44b8('0xe')]=_0x417d81;_0x4a182d['include']=qs[_0x44b8('0x2a')](_0x53d9c7['query']);return db[_0x44b8('0x29')][_0x44b8('0x2b')](_0x4a182d);})[_0x44b8('0x13')](function(_0xb64609){_0xfb0028[_0x44b8('0x2c')]=_0xb64609;return _0xfb0028;})['then'](respondWithFilteredResult(_0x2e0174,_0x4a182d))[_0x44b8('0x2d')](handleError(_0x2e0174,null));};exports[_0x44b8('0x2e')]=function(_0x26265f,_0x339f0f){var _0x46b008={'raw':![],'where':{'id':_0x26265f[_0x44b8('0x2f')]['id']}},_0x5f541d={};_0x5f541d[_0x44b8('0x30')]=_[_0x44b8('0x31')](db[_0x44b8('0x29')][_0x44b8('0x24')]);_0x5f541d[_0x44b8('0x32')]=_[_0x44b8('0x31')](_0x26265f[_0x44b8('0x32')]);_0x5f541d[_0x44b8('0x33')]=_[_0x44b8('0x34')](_0x5f541d[_0x44b8('0x30')],_0x5f541d[_0x44b8('0x32')]);_0x46b008[_0x44b8('0x35')]=_[_0x44b8('0x34')](_0x5f541d[_0x44b8('0x30')],qs[_0x44b8('0x36')](_0x26265f[_0x44b8('0x32')][_0x44b8('0x36')]));_0x46b008[_0x44b8('0x35')]=_0x46b008[_0x44b8('0x35')][_0x44b8('0x37')]?_0x46b008[_0x44b8('0x35')]:_0x5f541d['model'];if(_0x26265f[_0x44b8('0x32')][_0x44b8('0x38')]){_0x46b008['include']=[{'all':!![]}];}_0x46b008=_[_0x44b8('0x39')]({},_0x46b008,_0x26265f[_0x44b8('0x3a')]);return db[_0x44b8('0x29')][_0x44b8('0x1e')](_0x46b008)['then'](handleEntityNotFound(_0x339f0f,null))[_0x44b8('0x13')](respondWithResult(_0x339f0f,null))[_0x44b8('0x2d')](handleError(_0x339f0f,null));};exports[_0x44b8('0x3b')]=function(_0x1ee3cc,_0x9cb2a){return db[_0x44b8('0x29')][_0x44b8('0x3b')](_0x1ee3cc[_0x44b8('0x3c')],{})[_0x44b8('0x13')](function(_0x3d1be1){var _0x1c9983=_0x1ee3cc[_0x44b8('0x3d')][_0x44b8('0x14')]({'plain':!![]});if(!_0x1c9983)throw new Error(_0x44b8('0x3e'));if(_0x1c9983[_0x44b8('0x3f')]===_0x44b8('0x3d')){var _0x57d8c4=_0x3d1be1[_0x44b8('0x14')]({'plain':!![]});var _0x43e43a=[{'name':_0x44b8('0x15'),'value':'inbound'},{'name':_0x44b8('0x17'),'value':_0x44b8('0x18')}];var _0x229cc9=_['find'](_0x43e43a,[_0x44b8('0x1c'),_0x57d8c4[_0x44b8('0x1d')]])[_0x44b8('0x21')];return db[_0x44b8('0x40')][_0x44b8('0x1e')]({'where':{'name':_0x229cc9,'userProfileId':_0x1c9983['userProfileId']},'raw':!![]})['then'](function(_0x215f7b){if(_0x215f7b&&_0x215f7b[_0x44b8('0x41')]===0x0){return db[_0x44b8('0x1f')][_0x44b8('0x3b')]({'name':_0x57d8c4[_0x44b8('0x21')],'resourceId':_0x57d8c4['id'],'type':_0x215f7b[_0x44b8('0x21')],'sectionId':_0x215f7b['id']},{})[_0x44b8('0x13')](function(){return _0x3d1be1;});}else{return _0x3d1be1;}})[_0x44b8('0x2d')](function(_0x455fd6){logger[_0x44b8('0x42')](_0x44b8('0x43'),_0x455fd6);throw _0x455fd6;});}return _0x3d1be1;})[_0x44b8('0x13')](respondWithResult(_0x9cb2a,0xc9))[_0x44b8('0x2d')](handleError(_0x9cb2a,null));};exports[_0x44b8('0x44')]=function(_0x149731,_0x60eeb2){var _0xce06dc={'where':{'id':_0x149731[_0x44b8('0x2f')]['id']}},_0x3b3d5d={};_0x3b3d5d['model']=_['keys'](db[_0x44b8('0x29')][_0x44b8('0x24')]);_0xce06dc[_0x44b8('0x35')]=_[_0x44b8('0x34')](_0x3b3d5d[_0x44b8('0x30')],qs[_0x44b8('0x36')](_0x149731[_0x44b8('0x32')]['fields']));_0xce06dc[_0x44b8('0x35')]=_0xce06dc['attributes'][_0x44b8('0x37')]?_0xce06dc[_0x44b8('0x35')]:_0x3b3d5d[_0x44b8('0x30')];if(_0x149731[_0x44b8('0x32')][_0x44b8('0x38')]){_0xce06dc[_0x44b8('0x2a')]=[{'all':!![]}];}_0xce06dc=_['merge']({},_0xce06dc,_0x149731[_0x44b8('0x3a')]);return db[_0x44b8('0x29')][_0x44b8('0x1e')](_0xce06dc)[_0x44b8('0x13')](handleEntityNotFound(_0x60eeb2,null))['then'](function(_0x4e4ed1){if(_0x4e4ed1){var _0x2f549d=_0x4e4ed1[_0x44b8('0x14')]({'plain':!![]});_0x2f549d=qs[_0x44b8('0x45')](_0x2f549d,['id',_0x44b8('0x46'),_0x44b8('0x47')]);_0x149731['body']=_[_0x44b8('0x45')](_0x149731[_0x44b8('0x3c')],['id',_0x44b8('0x46'),_0x44b8('0x47')]);return db[_0x44b8('0x29')]['create'](_['merge'](_0x2f549d,_0x149731[_0x44b8('0x3c')]),{'include':_0x149731['query'][_0x44b8('0x38')]?[{'all':!![]}]:undefined})['then'](function(_0x40164d){var _0x434d6a=_0x149731[_0x44b8('0x3d')][_0x44b8('0x14')]({'plain':!![]});if(!_0x434d6a)throw new Error(_0x44b8('0x3e'));if(_0x434d6a[_0x44b8('0x3f')]===_0x44b8('0x3d')){var _0x533967=_0x40164d[_0x44b8('0x14')]({'plain':!![]});var _0x37b2c2=[{'name':_0x44b8('0x15'),'value':'inbound'},{'name':_0x44b8('0x17'),'value':_0x44b8('0x18')}];var _0x45f9a0=_[_0x44b8('0x1e')](_0x37b2c2,['value',_0x533967[_0x44b8('0x1d')]])[_0x44b8('0x21')];return db['UserProfileSection'][_0x44b8('0x1e')]({'where':{'name':_0x45f9a0,'userProfileId':_0x434d6a[_0x44b8('0x48')]},'raw':!![]})[_0x44b8('0x13')](function(_0x3df6aa){if(_0x3df6aa&&_0x3df6aa[_0x44b8('0x41')]===0x0){return db['UserProfileResource']['create']({'name':_0x533967[_0x44b8('0x21')],'resourceId':_0x533967['id'],'type':_0x3df6aa[_0x44b8('0x21')],'sectionId':_0x3df6aa['id']},{})[_0x44b8('0x13')](function(){return _0x40164d;});}else{return _0x40164d;}})[_0x44b8('0x2d')](function(_0x765e45){logger[_0x44b8('0x42')](_0x44b8('0x43'),_0x765e45);throw _0x765e45;});}return _0x40164d;});}})[_0x44b8('0x13')](respondWithResult(_0x60eeb2,0xc9))[_0x44b8('0x2d')](handleError(_0x60eeb2,null));};exports[_0x44b8('0x11')]=function(_0x16c628,_0x3f7576){if(_0x16c628['body']['id']){delete _0x16c628[_0x44b8('0x3c')]['id'];}return db[_0x44b8('0x29')][_0x44b8('0x1e')]({'where':{'id':_0x16c628[_0x44b8('0x2f')]['id']}})[_0x44b8('0x13')](handleEntityNotFound(_0x3f7576,null))[_0x44b8('0x13')](saveUpdates(_0x16c628[_0x44b8('0x3c')],null))[_0x44b8('0x13')](respondWithResult(_0x3f7576,null))[_0x44b8('0x2d')](handleError(_0x3f7576,null));};exports[_0x44b8('0x12')]=function(_0x2ecff9,_0x15bcba){return db[_0x44b8('0x29')][_0x44b8('0x1e')]({'where':{'id':_0x2ecff9[_0x44b8('0x2f')]['id']}})[_0x44b8('0x13')](handleEntityNotFound(_0x15bcba,null))[_0x44b8('0x13')](removeEntity(_0x15bcba,null))[_0x44b8('0x2d')](handleError(_0x15bcba,null));};exports['getHoppers']=function(_0x1ec516,_0x3aac51){var _0x10e519={'raw':![],'where':{}};var _0x2b37e={};var _0x51f763={'count':0x0,'rows':[]};return db[_0x44b8('0x29')][_0x44b8('0x49')]({'where':{'id':_0x1ec516['params']['id']}})[_0x44b8('0x13')](handleEntityNotFound(_0x3aac51,null))[_0x44b8('0x13')](function(_0x5df821){if(_0x5df821){_0x2b37e[_0x44b8('0x30')]=_[_0x44b8('0x31')](db['CmHopper'][_0x44b8('0x24')]);_0x2b37e[_0x44b8('0x32')]=_[_0x44b8('0x31')](_0x1ec516['query']);_0x2b37e[_0x44b8('0x33')]=_['intersection'](_0x2b37e[_0x44b8('0x30')],_0x2b37e['query']);_0x10e519[_0x44b8('0x35')]=_[_0x44b8('0x34')](_0x2b37e[_0x44b8('0x30')],qs[_0x44b8('0x36')](_0x1ec516[_0x44b8('0x32')][_0x44b8('0x36')]));_0x10e519['attributes']=_0x10e519[_0x44b8('0x35')]['length']?_0x10e519[_0x44b8('0x35')]:_0x2b37e[_0x44b8('0x30')];if(!_0x1ec516['query'][_0x44b8('0x4a')](_0x44b8('0x4b'))){_0x10e519[_0x44b8('0x10')]=qs[_0x44b8('0x10')](_0x1ec516[_0x44b8('0x32')][_0x44b8('0x10')]);_0x10e519[_0x44b8('0xf')]=qs[_0x44b8('0xf')](_0x1ec516[_0x44b8('0x32')][_0x44b8('0xf')]);}_0x10e519[_0x44b8('0x4c')]=qs[_0x44b8('0x4d')](_0x1ec516['query'][_0x44b8('0x4d')]);_0x10e519[_0x44b8('0x28')]=qs[_0x44b8('0x33')](_['pick'](_0x1ec516[_0x44b8('0x32')],_0x2b37e[_0x44b8('0x33')]));_0x10e519['where'][_0x44b8('0x4e')]=_0x5df821['id'];if(_0x1ec516[_0x44b8('0x32')][_0x44b8('0x19')]){_0x10e519[_0x44b8('0x28')]=_[_0x44b8('0x39')](_0x10e519['where'],{'$or':_[_0x44b8('0x1b')](_0x10e519[_0x44b8('0x35')],function(_0x279753){var _0x270224={};_0x270224[_0x279753]={'$like':'%'+_0x1ec516[_0x44b8('0x32')][_0x44b8('0x19')]+'%'};return _0x270224;})});}_0x10e519=_[_0x44b8('0x39')]({},_0x10e519,_0x1ec516[_0x44b8('0x3a')]);return db['CmHopper'][_0x44b8('0xe')]({'where':_0x10e519[_0x44b8('0x28')]})[_0x44b8('0x13')](function(_0x3ce76e){_0x51f763['count']=_0x3ce76e;if(_0x1ec516['query']['includeAll']){_0x10e519[_0x44b8('0x2a')]=[{'all':!![]}];}return db[_0x44b8('0x4f')][_0x44b8('0x2b')](_0x10e519);})[_0x44b8('0x13')](function(_0x32e630){_0x51f763['rows']=_0x32e630;return _0x51f763;});}})[_0x44b8('0x13')](respondWithFilteredResult(_0x3aac51,_0x10e519))['catch'](handleError(_0x3aac51,null));};exports[_0x44b8('0x50')]=function(_0x155bcf,_0xea2c3e){var _0x5da034={'raw':!![],'where':{}};var _0x4cac12={};var _0xb4c6dc={'count':0x0,'rows':[]};return db[_0x44b8('0x29')][_0x44b8('0x49')]({'where':{'id':_0x155bcf['params']['id']}})[_0x44b8('0x13')](handleEntityNotFound(_0xea2c3e,null))[_0x44b8('0x13')](function(_0x1258c2){if(_0x1258c2){_0x4cac12[_0x44b8('0x30')]=_[_0x44b8('0x31')](db['CmHopperHistory'][_0x44b8('0x24')]);_0x4cac12[_0x44b8('0x32')]=_[_0x44b8('0x31')](_0x155bcf[_0x44b8('0x32')]);_0x4cac12[_0x44b8('0x33')]=_['intersection'](_0x4cac12[_0x44b8('0x30')],_0x4cac12[_0x44b8('0x32')]);_0x5da034[_0x44b8('0x35')]=_[_0x44b8('0x34')](_0x4cac12[_0x44b8('0x30')],qs[_0x44b8('0x36')](_0x155bcf[_0x44b8('0x32')]['fields']));_0x5da034[_0x44b8('0x35')]=_0x5da034[_0x44b8('0x35')]['length']?_0x5da034[_0x44b8('0x35')]:_0x4cac12[_0x44b8('0x30')];if(!_0x155bcf['query'][_0x44b8('0x4a')]('nolimit')){_0x5da034['limit']=qs[_0x44b8('0x10')](_0x155bcf[_0x44b8('0x32')][_0x44b8('0x10')]);_0x5da034['offset']=qs['offset'](_0x155bcf['query'][_0x44b8('0xf')]);}_0x5da034[_0x44b8('0x4c')]=qs[_0x44b8('0x4d')](_0x155bcf[_0x44b8('0x32')][_0x44b8('0x4d')]);_0x5da034[_0x44b8('0x28')]=qs[_0x44b8('0x33')](_[_0x44b8('0x51')](_0x155bcf['query'],_0x4cac12[_0x44b8('0x33')]));_0x5da034['where']['VoiceQueueId']=_0x1258c2['id'];if(_0x155bcf['query'][_0x44b8('0x19')]){_0x5da034['where']=_[_0x44b8('0x39')](_0x5da034[_0x44b8('0x28')],{'$or':_[_0x44b8('0x1b')](_0x5da034[_0x44b8('0x35')],function(_0x3a9780){var _0x245ba3={};_0x245ba3[_0x3a9780]={'$like':'%'+_0x155bcf[_0x44b8('0x32')][_0x44b8('0x19')]+'%'};return _0x245ba3;})});}_0x5da034=_['merge']({},_0x5da034,_0x155bcf[_0x44b8('0x3a')]);return db[_0x44b8('0x52')][_0x44b8('0xe')]({'where':_0x5da034[_0x44b8('0x28')]})[_0x44b8('0x13')](function(_0xee44b3){_0xb4c6dc[_0x44b8('0xe')]=_0xee44b3;if(_0x155bcf[_0x44b8('0x32')][_0x44b8('0x38')]){_0x5da034['include']=[{'all':!![]}];}return db['CmHopperHistory'][_0x44b8('0x2b')](_0x5da034);})['then'](function(_0x531d65){_0xb4c6dc[_0x44b8('0x2c')]=_0x531d65;return _0xb4c6dc;});}})[_0x44b8('0x13')](respondWithFilteredResult(_0xea2c3e,_0x5da034))['catch'](handleError(_0xea2c3e,null));};exports['getHopperFinals']=function(_0x4b22e7,_0x2e0289){var _0x4860af={'raw':!![],'where':{}};var _0x353ff1={};var _0x2812da={'count':0x0,'rows':[]};return db[_0x44b8('0x29')][_0x44b8('0x49')]({'where':{'id':_0x4b22e7[_0x44b8('0x2f')]['id']}})[_0x44b8('0x13')](handleEntityNotFound(_0x2e0289,null))[_0x44b8('0x13')](function(_0x3a7229){if(_0x3a7229){_0x353ff1[_0x44b8('0x30')]=_[_0x44b8('0x31')](db[_0x44b8('0x53')][_0x44b8('0x24')]);_0x353ff1[_0x44b8('0x32')]=_[_0x44b8('0x31')](_0x4b22e7['query']);_0x353ff1[_0x44b8('0x33')]=_[_0x44b8('0x34')](_0x353ff1[_0x44b8('0x30')],_0x353ff1[_0x44b8('0x32')]);_0x4860af[_0x44b8('0x35')]=_[_0x44b8('0x34')](_0x353ff1[_0x44b8('0x30')],qs[_0x44b8('0x36')](_0x4b22e7[_0x44b8('0x32')][_0x44b8('0x36')]));_0x4860af[_0x44b8('0x35')]=_0x4860af[_0x44b8('0x35')][_0x44b8('0x37')]?_0x4860af['attributes']:_0x353ff1[_0x44b8('0x30')];if(!_0x4b22e7[_0x44b8('0x32')][_0x44b8('0x4a')]('nolimit')){_0x4860af['limit']=qs[_0x44b8('0x10')](_0x4b22e7[_0x44b8('0x32')][_0x44b8('0x10')]);_0x4860af['offset']=qs[_0x44b8('0xf')](_0x4b22e7[_0x44b8('0x32')][_0x44b8('0xf')]);}_0x4860af[_0x44b8('0x4c')]=qs[_0x44b8('0x4d')](_0x4b22e7[_0x44b8('0x32')][_0x44b8('0x4d')]);_0x4860af[_0x44b8('0x28')]=qs['filters'](_[_0x44b8('0x51')](_0x4b22e7[_0x44b8('0x32')],_0x353ff1[_0x44b8('0x33')]));_0x4860af[_0x44b8('0x28')][_0x44b8('0x4e')]=_0x3a7229['id'];if(_0x4b22e7[_0x44b8('0x32')][_0x44b8('0x19')]){_0x4860af['where']=_['merge'](_0x4860af['where'],{'$or':_[_0x44b8('0x1b')](_0x4860af[_0x44b8('0x35')],function(_0x2d74ee){var _0x312f4c={};_0x312f4c[_0x2d74ee]={'$like':'%'+_0x4b22e7[_0x44b8('0x32')][_0x44b8('0x19')]+'%'};return _0x312f4c;})});}_0x4860af=_[_0x44b8('0x39')]({},_0x4860af,_0x4b22e7[_0x44b8('0x3a')]);return db[_0x44b8('0x53')]['count']({'where':_0x4860af[_0x44b8('0x28')]})[_0x44b8('0x13')](function(_0x4b8036){_0x2812da['count']=_0x4b8036;if(_0x4b22e7[_0x44b8('0x32')]['includeAll']){_0x4860af[_0x44b8('0x2a')]=[{'all':!![]}];}return db[_0x44b8('0x53')][_0x44b8('0x2b')](_0x4860af);})['then'](function(_0x3f4a2a){_0x2812da[_0x44b8('0x2c')]=_0x3f4a2a;return _0x2812da;});}})[_0x44b8('0x13')](respondWithFilteredResult(_0x2e0289,_0x4860af))[_0x44b8('0x2d')](handleError(_0x2e0289,null));};exports['getHopperBlacks']=function(_0x216030,_0x584ae3){var _0x38c0c5={'raw':!![],'where':{}};var _0x2f2923={};var _0x2d9d62={'count':0x0,'rows':[]};return db[_0x44b8('0x29')][_0x44b8('0x49')]({'where':{'id':_0x216030[_0x44b8('0x2f')]['id']}})[_0x44b8('0x13')](handleEntityNotFound(_0x584ae3,null))['then'](function(_0x4d3b82){if(_0x4d3b82){_0x2f2923['model']=_[_0x44b8('0x31')](db[_0x44b8('0x54')][_0x44b8('0x24')]);_0x2f2923[_0x44b8('0x32')]=_[_0x44b8('0x31')](_0x216030[_0x44b8('0x32')]);_0x2f2923[_0x44b8('0x33')]=_[_0x44b8('0x34')](_0x2f2923[_0x44b8('0x30')],_0x2f2923[_0x44b8('0x32')]);_0x38c0c5[_0x44b8('0x35')]=_[_0x44b8('0x34')](_0x2f2923[_0x44b8('0x30')],qs[_0x44b8('0x36')](_0x216030[_0x44b8('0x32')][_0x44b8('0x36')]));_0x38c0c5[_0x44b8('0x35')]=_0x38c0c5[_0x44b8('0x35')]['length']?_0x38c0c5[_0x44b8('0x35')]:_0x2f2923['model'];if(!_0x216030[_0x44b8('0x32')]['hasOwnProperty']('nolimit')){_0x38c0c5[_0x44b8('0x10')]=qs['limit'](_0x216030['query']['limit']);_0x38c0c5['offset']=qs['offset'](_0x216030[_0x44b8('0x32')][_0x44b8('0xf')]);}_0x38c0c5[_0x44b8('0x4c')]=qs[_0x44b8('0x4d')](_0x216030['query'][_0x44b8('0x4d')]);_0x38c0c5[_0x44b8('0x28')]=qs['filters'](_['pick'](_0x216030[_0x44b8('0x32')],_0x2f2923[_0x44b8('0x33')]));_0x38c0c5[_0x44b8('0x28')]['VoiceQueueId']=_0x4d3b82['id'];if(_0x216030[_0x44b8('0x32')][_0x44b8('0x19')]){_0x38c0c5[_0x44b8('0x28')]=_[_0x44b8('0x39')](_0x38c0c5[_0x44b8('0x28')],{'$or':_[_0x44b8('0x1b')](_0x38c0c5[_0x44b8('0x35')],function(_0x16344b){var _0x21057f={};_0x21057f[_0x16344b]={'$like':'%'+_0x216030['query'][_0x44b8('0x19')]+'%'};return _0x21057f;})});}_0x38c0c5=_[_0x44b8('0x39')]({},_0x38c0c5,_0x216030['options']);return db[_0x44b8('0x54')][_0x44b8('0xe')]({'where':_0x38c0c5[_0x44b8('0x28')]})['then'](function(_0x3a09e4){_0x2d9d62['count']=_0x3a09e4;if(_0x216030[_0x44b8('0x32')][_0x44b8('0x38')]){_0x38c0c5['include']=[{'all':!![]}];}return db[_0x44b8('0x54')][_0x44b8('0x2b')](_0x38c0c5);})[_0x44b8('0x13')](function(_0x37871e){_0x2d9d62['rows']=_0x37871e;return _0x2d9d62;});}})[_0x44b8('0x13')](respondWithFilteredResult(_0x584ae3,_0x38c0c5))[_0x44b8('0x2d')](handleError(_0x584ae3,null));};exports[_0x44b8('0x55')]=function(_0x35d46c,_0x2d4a8a){var _0x1d666e={};var _0x10a66a={};var _0x1e608f;var _0x470f90;return db['VoiceQueue']['findOne']({'where':{'id':_0x35d46c[_0x44b8('0x2f')]['id']}})[_0x44b8('0x13')](handleEntityNotFound(_0x2d4a8a,null))[_0x44b8('0x13')](function(_0x3539f9){if(_0x3539f9){_0x1e608f=_0x3539f9;_0x10a66a[_0x44b8('0x30')]=_['keys'](db[_0x44b8('0x56')]['rawAttributes']);_0x10a66a[_0x44b8('0x32')]=_['keys'](_0x35d46c[_0x44b8('0x32')]);_0x10a66a[_0x44b8('0x33')]=_[_0x44b8('0x34')](_0x10a66a[_0x44b8('0x30')],_0x10a66a[_0x44b8('0x32')]);_0x1d666e[_0x44b8('0x35')]=_[_0x44b8('0x34')](_0x10a66a[_0x44b8('0x30')],qs[_0x44b8('0x36')](_0x35d46c['query'][_0x44b8('0x36')]));_0x1d666e[_0x44b8('0x35')]=_0x1d666e[_0x44b8('0x35')][_0x44b8('0x37')]?_0x1d666e['attributes']:_0x10a66a['model'];_0x1d666e['order']=qs[_0x44b8('0x4d')](_0x35d46c['query']['sort']);_0x1d666e[_0x44b8('0x28')]=qs[_0x44b8('0x33')](_[_0x44b8('0x51')](_0x35d46c[_0x44b8('0x32')],_0x10a66a[_0x44b8('0x33')]));if(_0x35d46c[_0x44b8('0x32')][_0x44b8('0x19')]){_0x1d666e[_0x44b8('0x28')]=_['merge'](_0x1d666e[_0x44b8('0x28')],{'$or':_[_0x44b8('0x1b')](_0x1d666e[_0x44b8('0x35')],function(_0x2594bf){var _0x5f0c0c={};_0x5f0c0c[_0x2594bf]={'$like':'%'+_0x35d46c[_0x44b8('0x32')][_0x44b8('0x19')]+'%'};return _0x5f0c0c;})});}_0x1d666e=_[_0x44b8('0x39')]({},_0x1d666e,_0x35d46c['options']);return _0x1e608f['getTeams'](_0x1d666e);}})[_0x44b8('0x13')](function(_0xae9b10){if(_0xae9b10){_0x470f90=_0xae9b10[_0x44b8('0x37')];if(!_0x35d46c[_0x44b8('0x32')][_0x44b8('0x4a')]('nolimit')){_0x1d666e[_0x44b8('0x10')]=qs[_0x44b8('0x10')](_0x35d46c['query'][_0x44b8('0x10')]);_0x1d666e[_0x44b8('0xf')]=qs[_0x44b8('0xf')](_0x35d46c[_0x44b8('0x32')]['offset']);}return _0x1e608f[_0x44b8('0x55')](_0x1d666e);}})['then'](function(_0x4464d3){if(_0x4464d3){return _0x4464d3?{'count':_0x470f90,'rows':_0x4464d3}:null;}})[_0x44b8('0x13')](respondWithResult(_0x2d4a8a,null))[_0x44b8('0x2d')](handleError(_0x2d4a8a,null));};exports[_0x44b8('0x57')]=function(_0x45ff62,_0x343c5c){var _0x3cb290=_0x45ff62[_0x44b8('0x3c')]['teams'];var _0x2d27bf=_[_0x44b8('0x1b')](_0x3cb290,'id');return db[_0x44b8('0x56')][_0x44b8('0x2b')]({'where':{'id':_0x2d27bf},'attributes':['id'],'include':[{'model':db[_0x44b8('0x58')],'as':_0x44b8('0x59'),'attributes':['id','name','online',_0x44b8('0x5a'),_0x44b8('0x5b')],'raw':!![]}]})['then'](function(_0x41f732){if(_0x41f732){var _0x16074e=_['flatMap'](_0x41f732,function(_0x1ec23e){var _0x3208b4=_0x1ec23e[_0x44b8('0x14')]({'plain':!![]});_0x3208b4[_0x44b8('0x59')][_0x44b8('0x5c')](function(_0x43f416){_0x43f416[_0x44b8('0x5d')]=_[_0x44b8('0x1e')](_0x3cb290,{'id':_0x3208b4['id']})[_0x44b8('0x5d')];});return _0x3208b4[_0x44b8('0x59')];});return db[_0x44b8('0x29')][_0x44b8('0x1e')]({'where':{'id':_0x45ff62[_0x44b8('0x2f')]['id']}})[_0x44b8('0x13')](function(_0x15365d){return db['sequelize'][_0x44b8('0x5e')](function(_0x3d92a9){return _0x15365d[_0x44b8('0x57')](_0x2d27bf,{'transaction':_0x3d92a9})[_0x44b8('0x13')](function(){return BPromise['each'](_0x3cb290,function(_0x611876){return db[_0x44b8('0x5f')]['upsert']({'TeamId':_0x611876['id'],'VoiceQueueId':_0x45ff62[_0x44b8('0x2f')]['id'],'penalty':_0x611876['penalty']},{'transaction':_0x3d92a9});});})[_0x44b8('0x13')](function(){return BPromise[_0x44b8('0x60')](_0x16074e,function(_0x5a508f){return db[_0x44b8('0x61')]['findOrCreate']({'where':{'UserId':_0x5a508f['id'],'VoiceQueueId':_0x45ff62['params']['id']},'defaults':{'penalty':_0x5a508f[_0x44b8('0x5d')]},'transaction':_0x3d92a9});});})[_0x44b8('0x13')](function(){return BPromise['each'](_['filter'](_0x16074e,{'online':!![]}),function(_0x52af57){return db[_0x44b8('0x62')][_0x44b8('0x63')]({'membername':_0x52af57[_0x44b8('0x21')],'UserId':_0x52af57['id'],'queue_name':_0x15365d['name'],'VoiceQueueId':_0x15365d['id'],'interface':_['isNil'](_0x52af57[_0x44b8('0x5b')])?util[_0x44b8('0x64')](_0x44b8('0x65'),_0x52af57[_0x44b8('0x21')]):_0x52af57[_0x44b8('0x5b')],'paused':_0x52af57[_0x44b8('0x5a')]||![],'penalty':_0x52af57[_0x44b8('0x5d')]},{'transaction':_0x3d92a9});});})[_0x44b8('0x13')](function(){_0x16074e[_0x44b8('0x5c')](function(_0x4ed62f){socket[_0x44b8('0x66')]('userVoiceQueue:save',{'UserId':_0x4ed62f['id'],'VoiceQueueId':_0x15365d['id']});});});});});}})[_0x44b8('0x13')](respondWithStatusCode(_0x343c5c,null))['catch'](handleError(_0x343c5c,null));};exports['removeTeams']=function(_0x1fb070,_0x224071){return db[_0x44b8('0x56')][_0x44b8('0x2b')]({'where':{'id':_0x1fb070[_0x44b8('0x32')][_0x44b8('0x67')]},'attributes':['id'],'include':[{'model':db[_0x44b8('0x58')],'as':_0x44b8('0x59'),'attributes':['id'],'raw':!![]}]})[_0x44b8('0x13')](handleEntityNotFound(_0x224071,null))['then'](function(_0x1eb0a8){var _0x1e3b5f=_[_0x44b8('0x1b')](_0x1eb0a8,'id');var _0x536d1d=[];var _0x5bc747=[];var _0x3e44ea=squel['select']();_0x3e44ea[_0x44b8('0x68')]('tq.TeamId')[_0x44b8('0x69')]('team_has_voice_queues','tq')['join'](_0x44b8('0x6a'),'ut',_0x44b8('0x6b'))['where'](_0x44b8('0x6c'),_0x1fb070[_0x44b8('0x2f')]['id']);for(var _0x276dfc=0x0;_0x276dfc<_0x1eb0a8[_0x44b8('0x37')];_0x276dfc+=0x1){let _0x291617=_0x1eb0a8[_0x276dfc];for(var _0x57b73f=0x0;_0x57b73f<_0x291617[_0x44b8('0x59')]['length'];_0x57b73f+=0x1){let _0x595af5=_0x291617['Agents'][_0x57b73f];var _0x3015f9=_0x3e44ea[_0x44b8('0x44')]();_0x3015f9['where'](_0x44b8('0x6d'),_0x595af5['id']);_0x5bc747[_0x44b8('0x6e')](db['sequelize']['query'](_0x3015f9[_0x44b8('0x6f')](),{'type':db[_0x44b8('0x70')]['QueryTypes'][_0x44b8('0x71')]})[_0x44b8('0x13')](function(_0x5e2d3b){if(_0x5e2d3b[_0x44b8('0x37')]===0x1){return _0x595af5['id'];}else{var _0x97f4=_['every'](_[_0x44b8('0x1b')](_0x5e2d3b,_0x44b8('0x72')),function(_0xdb42f2){return _['includes'](_0x1e3b5f,_0xdb42f2);});if(_0x97f4){return _0x595af5['id'];}}}));}}return BPromise[_0x44b8('0x73')](_0x5bc747)['then'](function(_0x2ea49d){_0x536d1d=_(_0x536d1d)['union'](_0x2ea49d)['compact']()[_0x44b8('0x1c')]();return db[_0x44b8('0x29')][_0x44b8('0x1e')]({'where':{'id':_0x1fb070[_0x44b8('0x2f')]['id']}})[_0x44b8('0x13')](function(_0x1db2cf){return db[_0x44b8('0x70')][_0x44b8('0x5e')](function(_0x1b7826){return _0x1db2cf[_0x44b8('0x74')](_0x1fb070[_0x44b8('0x32')]['ids'],{'transaction':_0x1b7826})[_0x44b8('0x13')](function(){if(!_[_0x44b8('0x75')](_0x536d1d)){return _0x1db2cf[_0x44b8('0x76')](_0x536d1d,{'transaction':_0x1b7826})[_0x44b8('0x13')](function(){return db[_0x44b8('0x62')][_0x44b8('0x12')]({'where':{'VoiceQueueId':_0x1fb070[_0x44b8('0x2f')]['id'],'UserId':_0x536d1d},'transaction':_0x1b7826});});}})[_0x44b8('0x13')](function(){_0x536d1d['forEach'](function(_0x4234bc){socket[_0x44b8('0x66')]('userVoiceQueue:remove',{'UserId':_0x4234bc,'VoiceQueueId':_0x1db2cf['id']});});});});});});})[_0x44b8('0x13')](respondWithStatusCode(_0x224071,null))[_0x44b8('0x2d')](handleError(_0x224071,null));};exports[_0x44b8('0x77')]=function(_0x5596c0,_0x4b2b8f){var _0x18cd30,_0x133da8;return db['VoiceQueue']['find']({'where':{'id':_0x5596c0[_0x44b8('0x2f')]['id']}})[_0x44b8('0x13')](handleEntityNotFound(_0x4b2b8f,null))[_0x44b8('0x13')](function(_0x2bccf9){if(_0x2bccf9){_0x133da8=_0x2bccf9;return _0x2bccf9[_0x44b8('0x77')](_0x5596c0['body'][_0x44b8('0x67')],_['omit'](_0x5596c0[_0x44b8('0x3c')],[_0x44b8('0x67'),'id'])||{})[_0x44b8('0x78')](function(_0x156a60){for(var _0x3cbec9=0x0;_0x3cbec9<_0x5596c0[_0x44b8('0x3c')]['ids'][_0x44b8('0x37')];_0x3cbec9+=0x1){socket['emit'](_0x44b8('0x79'),{'UserId':Number(_0x5596c0[_0x44b8('0x3c')]['ids'][_0x3cbec9]),'VoiceQueueId':Number(_0x5596c0[_0x44b8('0x2f')]['id'])});}return _0x156a60;});}})['then'](function(_0x42b0c9){_0x18cd30=_0x42b0c9||[];if(_0x133da8){return db[_0x44b8('0x58')][_0x44b8('0x2b')]({'where':{'id':_0x5596c0['body'][_0x44b8('0x67')]},'attributes':['id',_0x44b8('0x21'),'online',_0x44b8('0x5a'),'interface'],'raw':!![]});}})['then'](function(_0x4220b5){if(!_['isEmpty'](_0x4220b5)){var _0x336436=[];for(var _0x51add5=0x0;_0x51add5<_0x4220b5[_0x44b8('0x37')];_0x51add5++){if(_0x4220b5[_0x51add5][_0x44b8('0x7a')]){_0x336436['push'](db[_0x44b8('0x62')][_0x44b8('0x63')]({'membername':_0x4220b5[_0x51add5]['name'],'UserId':_0x4220b5[_0x51add5]['id'],'queue_name':_0x133da8['name'],'VoiceQueueId':_0x133da8['id'],'interface':_[_0x44b8('0x7b')](_0x4220b5[_0x51add5][_0x44b8('0x5b')])?util[_0x44b8('0x64')](_0x44b8('0x65'),_0x4220b5[_0x51add5]['name']):_0x4220b5[_0x51add5][_0x44b8('0x5b')],'paused':_0x4220b5[_0x51add5][_0x44b8('0x5a')]||![],'penalty':_0x5596c0[_0x44b8('0x3c')][_0x44b8('0x5d')]||0x0}));}}return BPromise['all'](_0x336436);}})['then'](function(){return _0x18cd30;})[_0x44b8('0x13')](respondWithResult(_0x4b2b8f,null))[_0x44b8('0x2d')](handleError(_0x4b2b8f,null));};exports[_0x44b8('0x76')]=function(_0x4cf4a0,_0x1443bd){return db[_0x44b8('0x29')]['find']({'where':{'id':_0x4cf4a0[_0x44b8('0x2f')]['id']}})[_0x44b8('0x13')](handleEntityNotFound(_0x1443bd,null))[_0x44b8('0x13')](function(_0x2cb698){if(_0x2cb698){return _0x2cb698[_0x44b8('0x76')](_0x4cf4a0[_0x44b8('0x32')]['ids'])['then'](function(){if(_[_0x44b8('0x7c')](_0x4cf4a0['query'][_0x44b8('0x67')])){for(var _0x4dc333=0x0;_0x4dc333<_0x4cf4a0[_0x44b8('0x32')][_0x44b8('0x67')][_0x44b8('0x37')];_0x4dc333+=0x1){socket[_0x44b8('0x66')](_0x44b8('0x7d'),{'UserId':Number(_0x4cf4a0[_0x44b8('0x32')][_0x44b8('0x67')][_0x4dc333]),'VoiceQueueId':Number(_0x4cf4a0[_0x44b8('0x2f')]['id'])});}}else{socket[_0x44b8('0x66')](_0x44b8('0x7d'),{'UserId':Number(_0x4cf4a0[_0x44b8('0x32')][_0x44b8('0x67')]),'VoiceQueueId':Number(_0x4cf4a0[_0x44b8('0x2f')]['id'])});}});}})[_0x44b8('0x13')](function(_0x4026d7){return db[_0x44b8('0x62')]['destroy']({'where':{'VoiceQueueId':_0x4cf4a0[_0x44b8('0x2f')]['id'],'UserId':_0x4cf4a0['query'][_0x44b8('0x67')]}})[_0x44b8('0x13')](function(){return _0x4026d7;});})[_0x44b8('0x13')](respondWithStatusCode(_0x1443bd,null))[_0x44b8('0x2d')](handleError(_0x1443bd,null));};exports[_0x44b8('0x7e')]=function(_0x22e5ae,_0x2f3340){var _0x4d98de={};var _0x597139={};var _0x2fffd5;var _0x3c90c2;return db[_0x44b8('0x29')][_0x44b8('0x49')]({'where':{'id':_0x22e5ae[_0x44b8('0x2f')]['id']}})['then'](handleEntityNotFound(_0x2f3340,null))[_0x44b8('0x13')](function(_0x208c53){if(_0x208c53){_0x2fffd5=_0x208c53;_0x597139[_0x44b8('0x30')]=_[_0x44b8('0x31')](db[_0x44b8('0x58')][_0x44b8('0x24')]);_0x597139['query']=_[_0x44b8('0x31')](_0x22e5ae[_0x44b8('0x32')]);_0x597139[_0x44b8('0x33')]=_[_0x44b8('0x34')](_0x597139[_0x44b8('0x30')],_0x597139['query']);_0x4d98de['attributes']=_[_0x44b8('0x34')](_0x597139[_0x44b8('0x30')],qs['fields'](_0x22e5ae['query'][_0x44b8('0x36')]));_0x4d98de['attributes']=_0x4d98de[_0x44b8('0x35')][_0x44b8('0x37')]?_0x4d98de[_0x44b8('0x35')]:_0x597139[_0x44b8('0x30')];_0x4d98de[_0x44b8('0x4c')]=qs[_0x44b8('0x4d')](_0x22e5ae[_0x44b8('0x32')][_0x44b8('0x4d')]);_0x4d98de['where']=qs[_0x44b8('0x33')](_[_0x44b8('0x51')](_0x22e5ae[_0x44b8('0x32')],_0x597139['filters']));if(_0x22e5ae[_0x44b8('0x32')][_0x44b8('0x19')]){_0x4d98de['where']=_['merge'](_0x4d98de['where'],{'$or':_['map'](_0x4d98de[_0x44b8('0x35')],function(_0x5e423c){var _0x48065d={};_0x48065d[_0x5e423c]={'$like':'%'+_0x22e5ae[_0x44b8('0x32')][_0x44b8('0x19')]+'%'};return _0x48065d;})});}_0x4d98de=_[_0x44b8('0x39')]({},_0x4d98de,_0x22e5ae['options']);return _0x2fffd5[_0x44b8('0x7e')](_0x4d98de);}})['then'](function(_0x230407){if(_0x230407){_0x3c90c2=_0x230407[_0x44b8('0x37')];if(!_0x22e5ae[_0x44b8('0x32')][_0x44b8('0x4a')]('nolimit')){_0x4d98de[_0x44b8('0x10')]=qs[_0x44b8('0x10')](_0x22e5ae[_0x44b8('0x32')][_0x44b8('0x10')]);_0x4d98de['offset']=qs['offset'](_0x22e5ae[_0x44b8('0x32')][_0x44b8('0xf')]);}return _0x2fffd5['getAgents'](_0x4d98de);}})[_0x44b8('0x13')](function(_0x188744){if(_0x188744){return _0x188744?{'count':_0x3c90c2,'rows':_0x188744}:null;}})[_0x44b8('0x13')](respondWithResult(_0x2f3340,null))[_0x44b8('0x2d')](handleError(_0x2f3340,null));};exports[_0x44b8('0x7f')]=function(_0x2da727,_0x319520){var _0x2f7550={};var _0x57d24f={};var _0x223e54;var _0x3e5fa8;return db[_0x44b8('0x29')]['findOne']({'where':{'id':_0x2da727[_0x44b8('0x2f')]['id']}})['then'](handleEntityNotFound(_0x319520,null))[_0x44b8('0x13')](function(_0x5370a5){if(_0x5370a5){_0x223e54=_0x5370a5;_0x57d24f[_0x44b8('0x30')]=_[_0x44b8('0x31')](db[_0x44b8('0x62')][_0x44b8('0x24')]);_0x57d24f[_0x44b8('0x32')]=_[_0x44b8('0x31')](_0x2da727[_0x44b8('0x32')]);_0x57d24f[_0x44b8('0x33')]=_[_0x44b8('0x34')](_0x57d24f[_0x44b8('0x30')],_0x57d24f[_0x44b8('0x32')]);_0x2f7550[_0x44b8('0x35')]=_['intersection'](_0x57d24f[_0x44b8('0x30')],qs['fields'](_0x2da727[_0x44b8('0x32')]['fields']));_0x2f7550[_0x44b8('0x35')]=_0x2f7550[_0x44b8('0x35')][_0x44b8('0x37')]?_0x2f7550[_0x44b8('0x35')]:_0x57d24f[_0x44b8('0x30')];_0x2f7550[_0x44b8('0x4c')]=qs[_0x44b8('0x4d')](_0x2da727['query'][_0x44b8('0x4d')]);_0x2f7550[_0x44b8('0x28')]=qs[_0x44b8('0x33')](_[_0x44b8('0x51')](_0x2da727[_0x44b8('0x32')],_0x57d24f[_0x44b8('0x33')]));if(_0x2da727[_0x44b8('0x32')][_0x44b8('0x19')]){_0x2f7550[_0x44b8('0x28')]=_[_0x44b8('0x39')](_0x2f7550[_0x44b8('0x28')],{'$or':_[_0x44b8('0x1b')](_0x2f7550[_0x44b8('0x35')],function(_0x4281a6){var _0x4bb399={};_0x4bb399[_0x4281a6]={'$like':'%'+_0x2da727[_0x44b8('0x32')][_0x44b8('0x19')]+'%'};return _0x4bb399;})});}_0x2f7550=_['merge']({},_0x2f7550,_0x2da727[_0x44b8('0x3a')]);return _0x223e54[_0x44b8('0x7f')](_0x2f7550);}})[_0x44b8('0x13')](function(_0x1f389e){if(_0x1f389e){_0x3e5fa8=_0x1f389e[_0x44b8('0x37')];if(!_0x2da727['query'][_0x44b8('0x4a')](_0x44b8('0x4b'))){_0x2f7550[_0x44b8('0x10')]=qs[_0x44b8('0x10')](_0x2da727['query'][_0x44b8('0x10')]);_0x2f7550[_0x44b8('0xf')]=qs['offset'](_0x2da727['query']['offset']);}return _0x223e54['getMembers'](_0x2f7550);}})[_0x44b8('0x13')](function(_0x5824a8){return _0x5824a8?{'count':_0x3e5fa8,'rows':_0x5824a8}:null;})['then'](respondWithResult(_0x319520,null))[_0x44b8('0x2d')](handleError(_0x319520,null));};exports[_0x44b8('0x80')]=function(_0x87a38,_0x54adf9){var _0x44dc3d={};var _0x32dafb={};var _0x3c8e0c;var _0x21ea61;return db['VoiceQueue'][_0x44b8('0x49')]({'where':{'id':_0x87a38['params']['id']}})[_0x44b8('0x13')](handleEntityNotFound(_0x54adf9,null))[_0x44b8('0x13')](function(_0x56cfa5){if(_0x56cfa5){_0x3c8e0c=_0x56cfa5;_0x32dafb[_0x44b8('0x30')]=_[_0x44b8('0x31')](db[_0x44b8('0x81')][_0x44b8('0x24')]);_0x32dafb[_0x44b8('0x32')]=_['keys'](_0x87a38['query']);_0x32dafb[_0x44b8('0x33')]=_[_0x44b8('0x34')](_0x32dafb[_0x44b8('0x30')],_0x32dafb[_0x44b8('0x32')]);_0x44dc3d[_0x44b8('0x35')]=_[_0x44b8('0x34')](_0x32dafb[_0x44b8('0x30')],qs[_0x44b8('0x36')](_0x87a38[_0x44b8('0x32')][_0x44b8('0x36')]));_0x44dc3d[_0x44b8('0x35')]=_0x44dc3d[_0x44b8('0x35')]['length']?_0x44dc3d['attributes']:_0x32dafb[_0x44b8('0x30')];_0x44dc3d['order']=qs[_0x44b8('0x4d')](_0x87a38[_0x44b8('0x32')][_0x44b8('0x4d')]);_0x44dc3d['where']=qs[_0x44b8('0x33')](_[_0x44b8('0x51')](_0x87a38[_0x44b8('0x32')],_0x32dafb[_0x44b8('0x33')]));if(_0x87a38[_0x44b8('0x32')][_0x44b8('0x19')]){_0x44dc3d['where']=_[_0x44b8('0x39')](_0x44dc3d[_0x44b8('0x28')],{'$or':_['map'](_0x44dc3d[_0x44b8('0x35')],function(_0x1ffa05){var _0x22edd7={};_0x22edd7[_0x1ffa05]={'$like':'%'+_0x87a38[_0x44b8('0x32')][_0x44b8('0x19')]+'%'};return _0x22edd7;})});}_0x44dc3d=_['merge']({},_0x44dc3d,_0x87a38[_0x44b8('0x3a')]);return _0x3c8e0c[_0x44b8('0x80')](_0x44dc3d);}})[_0x44b8('0x13')](function(_0x2fca1a){if(_0x2fca1a){_0x21ea61=_0x2fca1a[_0x44b8('0x37')];if(!_0x87a38[_0x44b8('0x32')][_0x44b8('0x4a')](_0x44b8('0x4b'))){_0x44dc3d[_0x44b8('0x10')]=qs[_0x44b8('0x10')](_0x87a38['query'][_0x44b8('0x10')]);_0x44dc3d[_0x44b8('0xf')]=qs[_0x44b8('0xf')](_0x87a38['query']['offset']);}return _0x3c8e0c[_0x44b8('0x80')](_0x44dc3d);}})['then'](function(_0x9458fb){if(_0x9458fb){return _0x9458fb?{'count':_0x21ea61,'rows':_0x9458fb}:null;}})[_0x44b8('0x13')](respondWithResult(_0x54adf9,null))[_0x44b8('0x2d')](handleError(_0x54adf9,null));};exports[_0x44b8('0x82')]=function(_0x2eb6ce,_0x105ca0){var _0x25f364=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');var _0x77c009,_0x161362;return db[_0x44b8('0x29')][_0x44b8('0x1e')]({'where':{'id':_0x2eb6ce[_0x44b8('0x2f')]['id']}})[_0x44b8('0x13')](handleEntityNotFound(_0x105ca0,null))['then'](function(_0x4d88a6){if(_0x4d88a6){_0x161362=_0x4d88a6;return _0x4d88a6[_0x44b8('0x82')](_0x2eb6ce[_0x44b8('0x3c')][_0x44b8('0x67')],_[_0x44b8('0x45')](_0x2eb6ce[_0x44b8('0x3c')],[_0x44b8('0x67'),'id'])||{});}return null;})[_0x44b8('0x78')](function(_0x4b49df){var _0xbf96c1;_0x77c009=_0x4b49df||[];var _0x1f6244=[];if(_0x4b49df){for(var _0x96a3cd=0x0;_0x96a3cd<_0x4b49df['length'];_0x96a3cd+=0x1){var _0x16721d=_0x4b49df[_0x96a3cd][_0x44b8('0x14')]({'plain':!![]});_0x161362[_0x44b8('0x83')]=_0x2eb6ce[_0x44b8('0x3c')]['dialCheckDuplicateType']?_0x2eb6ce[_0x44b8('0x3c')][_0x44b8('0x83')]:_0x161362[_0x44b8('0x83')];switch(_0x161362['dialCheckDuplicateType']){case'always':_0xbf96c1=squel['insert']()['into']('cm_hopper')[_0x44b8('0x84')]([_0x44b8('0x85'),_0x44b8('0x86'),_0x44b8('0x87'),_0x44b8('0x88'),_0x44b8('0x4e'),_0x44b8('0x46'),_0x44b8('0x47')],squel[_0x44b8('0x89')]()[_0x44b8('0x68')](_0x44b8('0x85'),'phone')[_0x44b8('0x68')]('\x27'+_0x25f364+'\x27',_0x44b8('0x86'))[_0x44b8('0x68')]('id',_0x44b8('0x87'))[_0x44b8('0x68')](_0x16721d['CmListId'][_0x44b8('0x6f')](),'ListId')[_0x44b8('0x68')](_0x2eb6ce[_0x44b8('0x2f')]['id'][_0x44b8('0x6f')](),'VoiceQueueId')[_0x44b8('0x68')]('\x27'+_0x25f364+'\x27',_0x44b8('0x46'))['field']('\x27'+_0x25f364+'\x27',_0x44b8('0x47'))[_0x44b8('0x69')](_0x44b8('0x8a'))['where'](_0x44b8('0x8b'))['where'](_0x44b8('0x8c'),_0x16721d[_0x44b8('0x8d')][_0x44b8('0x6f')]())['where'](_0x44b8('0x8e'))['where'](_0x44b8('0x8f'),squel[_0x44b8('0x89')]()[_0x44b8('0x68')](_0x44b8('0x90'))[_0x44b8('0x69')](_0x44b8('0x91'))['where'](_0x44b8('0x6c'),_0x2eb6ce[_0x44b8('0x2f')]['id'][_0x44b8('0x6f')]()))[_0x44b8('0x28')]('phone\x20NOT\x20IN\x20(?)',squel[_0x44b8('0x89')]()[_0x44b8('0x68')](_0x44b8('0x92'))[_0x44b8('0x69')](_0x44b8('0x93'))[_0x44b8('0x28')](_0x44b8('0x6c'),_0x2eb6ce[_0x44b8('0x2f')]['id'][_0x44b8('0x6f')]())))[_0x44b8('0x6f')]();break;case _0x44b8('0x94'):_0xbf96c1=squel[_0x44b8('0x95')]()['into'](_0x44b8('0x93'))[_0x44b8('0x84')]([_0x44b8('0x85'),_0x44b8('0x86'),'ContactId',_0x44b8('0x88'),'VoiceQueueId',_0x44b8('0x46'),_0x44b8('0x47')],squel[_0x44b8('0x89')]()['field'](_0x44b8('0x85'),_0x44b8('0x85'))[_0x44b8('0x68')]('\x27'+_0x25f364+'\x27',_0x44b8('0x86'))[_0x44b8('0x68')]('id','ContactId')[_0x44b8('0x68')](_0x16721d[_0x44b8('0x8d')][_0x44b8('0x6f')](),_0x44b8('0x88'))[_0x44b8('0x68')](_0x2eb6ce['params']['id'][_0x44b8('0x6f')](),_0x44b8('0x4e'))[_0x44b8('0x68')]('\x27'+_0x25f364+'\x27',_0x44b8('0x46'))[_0x44b8('0x68')]('\x27'+_0x25f364+'\x27',_0x44b8('0x47'))[_0x44b8('0x69')]('cm_contacts')['where']('deletedAt\x20IS\x20NULL')[_0x44b8('0x28')](_0x44b8('0x8c'),_0x16721d[_0x44b8('0x8d')]['toString']())['where'](_0x44b8('0x8e'))[_0x44b8('0x28')](_0x44b8('0x8f'),squel[_0x44b8('0x89')]()[_0x44b8('0x68')]('COALESCE(phone,\x27\x27)')['from']('cm_hopper')['where'](_0x44b8('0x6c'),_0x2eb6ce[_0x44b8('0x2f')]['id'][_0x44b8('0x6f')]())))[_0x44b8('0x6f')]();break;default:_0xbf96c1=squel[_0x44b8('0x95')]()[_0x44b8('0x96')]('cm_hopper')[_0x44b8('0x84')](['phone',_0x44b8('0x86'),_0x44b8('0x87'),_0x44b8('0x88'),'VoiceQueueId','createdAt',_0x44b8('0x47')],squel[_0x44b8('0x89')]()['field']('phone',_0x44b8('0x85'))[_0x44b8('0x68')]('\x27'+_0x25f364+'\x27',_0x44b8('0x86'))[_0x44b8('0x68')]('id',_0x44b8('0x87'))['field'](_0x16721d[_0x44b8('0x8d')][_0x44b8('0x6f')](),_0x44b8('0x88'))[_0x44b8('0x68')](_0x2eb6ce[_0x44b8('0x2f')]['id'][_0x44b8('0x6f')](),_0x44b8('0x4e'))['field']('\x27'+_0x25f364+'\x27',_0x44b8('0x46'))[_0x44b8('0x68')]('\x27'+_0x25f364+'\x27',_0x44b8('0x47'))[_0x44b8('0x69')](_0x44b8('0x8a'))[_0x44b8('0x28')]('deletedAt\x20IS\x20NULL')[_0x44b8('0x28')](_0x44b8('0x8c'),_0x16721d[_0x44b8('0x8d')][_0x44b8('0x6f')]())['where'](_0x44b8('0x8e')))[_0x44b8('0x6f')]();}_0x1f6244[_0x44b8('0x6e')](db[_0x44b8('0x70')]['query'](_0xbf96c1));}return BPromise['all'](_0x1f6244);}})[_0x44b8('0x13')](function(){var _0x2ad4ab=[];var _0x196b4b=squel[_0x44b8('0x95')]()[_0x44b8('0x96')]('cm_hopper_additional_phones')[_0x44b8('0x84')]([_0x44b8('0x97'),_0x44b8('0x85'),_0x44b8('0x98'),_0x44b8('0x46'),_0x44b8('0x47')],squel['select']()[_0x44b8('0x68')](_0x44b8('0x99'))[_0x44b8('0x68')](_0x44b8('0x9a'))[_0x44b8('0x68')](_0x44b8('0x9b'))[_0x44b8('0x68')]('\x27'+_0x25f364+'\x27','createdAt')[_0x44b8('0x68')]('\x27'+_0x25f364+'\x27',_0x44b8('0x47'))[_0x44b8('0x69')](_0x44b8('0x9c'),'ci')['join'](_0x44b8('0x93'),'h','h.ContactId=ci.CmContactId')[_0x44b8('0x28')](_0x44b8('0x9d'),_0x25f364)[_0x44b8('0x28')](_0x44b8('0x9e'),'PHONE'))[_0x44b8('0x6f')]();_0x2ad4ab[_0x44b8('0x6e')](db[_0x44b8('0x70')]['query'](_0x196b4b));return BPromise[_0x44b8('0x73')](_0x2ad4ab);})[_0x44b8('0x13')](function(){return _0x77c009;})[_0x44b8('0x13')](respondWithResult(_0x105ca0,null))[_0x44b8('0x2d')](handleError(_0x105ca0,null));};exports[_0x44b8('0x9f')]=function(_0x257702,_0x17560c){return db[_0x44b8('0x29')][_0x44b8('0x1e')]({'where':{'id':_0x257702[_0x44b8('0x2f')]['id']}})['then'](handleEntityNotFound(_0x17560c,null))[_0x44b8('0x13')](function(_0x4d11d5){if(_0x4d11d5){return _0x4d11d5[_0x44b8('0x9f')](_0x257702[_0x44b8('0x32')][_0x44b8('0x67')]);}})[_0x44b8('0x13')](function(_0xafca17){if(_0xafca17){return db['CmHopper']['destroy']({'where':{'ListId':_0x257702['query'][_0x44b8('0x67')],'VoiceQueueId':_0x257702[_0x44b8('0x2f')]['id']}})[_0x44b8('0x13')](function(){return _0xafca17;});}})[_0x44b8('0x13')](respondWithStatusCode(_0x17560c,null))[_0x44b8('0x2d')](handleError(_0x17560c,null));};exports[_0x44b8('0xa0')]=function(_0x513302,_0xfdb408){var _0x119dda={};var _0x5834fe={};var _0xe5cc1e;var _0x4c55e6;return db[_0x44b8('0x29')][_0x44b8('0x49')]({'where':{'id':_0x513302['params']['id']}})[_0x44b8('0x13')](handleEntityNotFound(_0xfdb408,null))[_0x44b8('0x13')](function(_0x537eab){if(_0x537eab){_0xe5cc1e=_0x537eab;_0x5834fe[_0x44b8('0x30')]=_[_0x44b8('0x31')](db[_0x44b8('0x81')][_0x44b8('0x24')]);_0x5834fe['query']=_[_0x44b8('0x31')](_0x513302[_0x44b8('0x32')]);_0x5834fe[_0x44b8('0x33')]=_[_0x44b8('0x34')](_0x5834fe[_0x44b8('0x30')],_0x5834fe[_0x44b8('0x32')]);_0x119dda[_0x44b8('0x35')]=_['intersection'](_0x5834fe[_0x44b8('0x30')],qs[_0x44b8('0x36')](_0x513302[_0x44b8('0x32')]['fields']));_0x119dda[_0x44b8('0x35')]=_0x119dda[_0x44b8('0x35')]['length']?_0x119dda[_0x44b8('0x35')]:_0x5834fe[_0x44b8('0x30')];_0x119dda[_0x44b8('0x4c')]=qs[_0x44b8('0x4d')](_0x513302['query'][_0x44b8('0x4d')]);_0x119dda[_0x44b8('0x28')]=qs[_0x44b8('0x33')](_[_0x44b8('0x51')](_0x513302[_0x44b8('0x32')],_0x5834fe['filters']));if(_0x513302[_0x44b8('0x32')][_0x44b8('0x19')]){_0x119dda['where']=_[_0x44b8('0x39')](_0x119dda[_0x44b8('0x28')],{'$or':_[_0x44b8('0x1b')](_0x119dda[_0x44b8('0x35')],function(_0x4e9376){var _0x25f31c={};_0x25f31c[_0x4e9376]={'$like':'%'+_0x513302[_0x44b8('0x32')][_0x44b8('0x19')]+'%'};return _0x25f31c;})});}_0x119dda=_[_0x44b8('0x39')]({},_0x119dda,_0x513302[_0x44b8('0x3a')]);return _0xe5cc1e[_0x44b8('0xa0')](_0x119dda);}})[_0x44b8('0x13')](function(_0x57e3c9){if(_0x57e3c9){_0x4c55e6=_0x57e3c9[_0x44b8('0x37')];if(!_0x513302[_0x44b8('0x32')][_0x44b8('0x4a')](_0x44b8('0x4b'))){_0x119dda['limit']=qs[_0x44b8('0x10')](_0x513302[_0x44b8('0x32')][_0x44b8('0x10')]);_0x119dda['offset']=qs['offset'](_0x513302[_0x44b8('0x32')][_0x44b8('0xf')]);}return _0xe5cc1e[_0x44b8('0xa0')](_0x119dda);}})[_0x44b8('0x13')](function(_0x4a5916){if(_0x4a5916){return _0x4a5916?{'count':_0x4c55e6,'rows':_0x4a5916}:null;}})[_0x44b8('0x13')](respondWithResult(_0xfdb408,null))[_0x44b8('0x2d')](handleError(_0xfdb408,null));};exports['addBlackLists']=function(_0xd19a35,_0x2439f2){var _0x22a624;return db['VoiceQueue'][_0x44b8('0x1e')]({'where':{'id':_0xd19a35[_0x44b8('0x2f')]['id']}})[_0x44b8('0x13')](handleEntityNotFound(_0x2439f2,null))[_0x44b8('0x13')](function(_0x14c021){if(_0x14c021){return _0x14c021['addBlackLists'](_0xd19a35[_0x44b8('0x3c')][_0x44b8('0x67')],_['omit'](_0xd19a35[_0x44b8('0x3c')],[_0x44b8('0x67'),'id'])||{});}return null;})[_0x44b8('0x78')](function(_0x3b9cd2){var _0xb6cadf;_0x22a624=_0x3b9cd2||[];var _0x2024eb=[];if(_0x3b9cd2){for(var _0x29af58=0x0;_0x29af58<_0x3b9cd2[_0x44b8('0x37')];_0x29af58+=0x1){var _0x3870a9=_0x3b9cd2[_0x29af58]['get']({'plain':!![]});_0xb6cadf=squel['insert']()['into']('cm_hopper_black')[_0x44b8('0x84')]([_0x44b8('0x85'),'ContactId',_0x44b8('0x88'),_0x44b8('0x4e'),_0x44b8('0x46'),_0x44b8('0x47')],squel[_0x44b8('0x89')]()[_0x44b8('0x68')]('phone',_0x44b8('0x85'))['field']('id','ContactId')[_0x44b8('0x68')](_0x3870a9[_0x44b8('0x8d')][_0x44b8('0x6f')](),_0x44b8('0x88'))[_0x44b8('0x68')](_0xd19a35['params']['id'][_0x44b8('0x6f')](),_0x44b8('0x4e'))[_0x44b8('0x68')](_0x44b8('0xa1'),_0x44b8('0x46'))[_0x44b8('0x68')](_0x44b8('0xa1'),'updatedAt')[_0x44b8('0x69')](_0x44b8('0x8a'))[_0x44b8('0x28')]('deletedAt\x20IS\x20NULL')[_0x44b8('0x28')](_0x44b8('0x8c'),_0x3870a9[_0x44b8('0x8d')][_0x44b8('0x6f')]())[_0x44b8('0x28')](_0x44b8('0x8e')))[_0x44b8('0x6f')]();_0x2024eb[_0x44b8('0x6e')](db['sequelize'][_0x44b8('0x32')](_0xb6cadf));}return BPromise[_0x44b8('0x73')](_0x2024eb);}})[_0x44b8('0x13')](function(){return _0x22a624;})[_0x44b8('0x13')](respondWithResult(_0x2439f2,null))[_0x44b8('0x2d')](handleError(_0x2439f2,null));};exports[_0x44b8('0xa2')]=function(_0x4ec799,_0x3fa943){return db[_0x44b8('0x29')]['find']({'where':{'id':_0x4ec799[_0x44b8('0x2f')]['id']}})[_0x44b8('0x13')](handleEntityNotFound(_0x3fa943,null))[_0x44b8('0x13')](function(_0x3b1643){if(_0x3b1643){return _0x3b1643['removeBlackLists'](_0x4ec799[_0x44b8('0x32')]['ids']);}})['then'](function(_0x9a5734){if(_0x9a5734){return db[_0x44b8('0x54')][_0x44b8('0x12')]({'where':{'ListId':_0x4ec799[_0x44b8('0x32')][_0x44b8('0x67')],'VoiceQueueId':_0x4ec799['params']['id']}})['then'](function(){return _0x9a5734;});}})['then'](respondWithStatusCode(_0x3fa943,null))[_0x44b8('0x2d')](handleError(_0x3fa943,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(_0x2464c4,_0x3423e6){var _0x167c42=function(_0x112dd5){while(--_0x112dd5){_0x2464c4['push'](_0x2464c4['shift']());}};_0x167c42(++_0x3423e6);}(_0x8ef6,0xf2));var _0x68ef=function(_0x17f1a6,_0xc3a43c){_0x17f1a6=_0x17f1a6-0x0;var _0x4a0bf7=_0x8ef6[_0x17f1a6];return _0x4a0bf7;};'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 eb569fb..caa2e07 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 _0x3c24=['VoiceQueue','setMaxListeners','save','update','remove','emit','exports','events'];(function(_0x465b28,_0x2014d8){var _0x324114=function(_0x522638){while(--_0x522638){_0x465b28['push'](_0x465b28['shift']());}};_0x324114(++_0x2014d8);}(_0x3c24,0x1af));var _0x43c2=function(_0x550d12,_0x5384bd){_0x550d12=_0x550d12-0x0;var _0x12103d=_0x3c24[_0x550d12];return _0x12103d;};'use strict';var EventEmitter=require(_0x43c2('0x0'));var VoiceQueue=require('../../mysqldb')['db'][_0x43c2('0x1')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0x43c2('0x2')](0x0);var events={'afterCreate':_0x43c2('0x3'),'afterUpdate':_0x43c2('0x4'),'afterDestroy':_0x43c2('0x5')};function emitEvent(_0x19835a){return function(_0x206419,_0x3aaf61,_0x22371e){VoiceQueueEvents['emit'](_0x19835a+':'+_0x206419['id'],_0x206419);VoiceQueueEvents[_0x43c2('0x6')](_0x19835a,_0x206419);_0x22371e(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueue['hook'](e,emitEvent(event));}}module[_0x43c2('0x7')]=VoiceQueueEvents; \ No newline at end of file +var _0x6069=['update','remove','emit','hook','exports','events','VoiceQueue','save'];(function(_0x5a6e36,_0x211d86){var _0x5e1670=function(_0x1be644){while(--_0x1be644){_0x5a6e36['push'](_0x5a6e36['shift']());}};_0x5e1670(++_0x211d86);}(_0x6069,0x1e5));var _0x9606=function(_0x3dd07f,_0x535554){_0x3dd07f=_0x3dd07f-0x0;var _0x2d7820=_0x6069[_0x3dd07f];return _0x2d7820;};'use strict';var EventEmitter=require(_0x9606('0x0'));var VoiceQueue=require('../../mysqldb')['db'][_0x9606('0x1')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x9606('0x2'),'afterUpdate':_0x9606('0x3'),'afterDestroy':_0x9606('0x4')};function emitEvent(_0x68a040){return function(_0x35c671,_0x3fe077,_0x1eae00){VoiceQueueEvents[_0x9606('0x5')](_0x68a040+':'+_0x35c671['id'],_0x35c671);VoiceQueueEvents[_0x9606('0x5')](_0x68a040,_0x35c671);_0x1eae00(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueue[_0x9606('0x6')](e,emitEvent(event));}}module[_0x9606('0x7')]=VoiceQueueEvents; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.model.js b/server/api/voiceQueue/voiceQueue.model.js index 27cfe02..af8b461 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 _0xa9e0=['../../config/environment','./voiceQueue.attributes','exports','define','VoiceQueue','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x11fbea,_0x1a75b2){var _0x3b0db9=function(_0x574ba7){while(--_0x574ba7){_0x11fbea['push'](_0x11fbea['shift']());}};_0x3b0db9(++_0x1a75b2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x40ac5e,_0x2de228){_0x40ac5e=_0x40ac5e-0x0;var _0x2839d6=_0xa9e0[_0x40ac5e];return _0x2839d6;};'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':'voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x70e0=['voice_queues','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','./voiceQueue.attributes'];(function(_0x2fbb34,_0x358b15){var _0x26914a=function(_0x240fc1){while(--_0x240fc1){_0x2fbb34['push'](_0x2fbb34['shift']());}};_0x26914a(++_0x358b15);}(_0x70e0,0x17b));var _0x070e=function(_0x7c1cfb,_0x50d170){_0x7c1cfb=_0x7c1cfb-0x0;var _0x31a441=_0x70e0[_0x7c1cfb];return _0x31a441;};'use strict';var _=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var logger=require(_0x070e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x070e('0x3'));var rp=require(_0x070e('0x4'));var fs=require('fs');var path=require(_0x070e('0x5'));var rimraf=require(_0x070e('0x6'));var config=require('../../config/environment');var attributes=require(_0x070e('0x7'));module['exports']=function(_0x46fe68,_0x4b041d){return _0x46fe68['define']('VoiceQueue',attributes,{'tableName':_0x070e('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.rpc.js b/server/api/voiceQueue/voiceQueue.rpc.js index d6d5473..32f4eba 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 _0x75cc=['GetVoiceQueue','findAll','options','raw','where','attributes','include','map','model','ShowVoiceQueue','VoiceQueue','find','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','defaults','socket.io-emitter','redis','register','request','then','info','VoiceQueue,\x20%s,\x20%s','request\x20sent','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x75cc,0xd4));var _0xc75c=function(_0x1ee286,_0x36de03){_0x1ee286=_0x1ee286-0x0;var _0x397326=_0x75cc[_0x1ee286];return _0x397326;};'use strict';var _=require('lodash');var util=require(_0xc75c('0x0'));var moment=require(_0xc75c('0x1'));var BPromise=require('bluebird');var rs=require(_0xc75c('0x2'));var fs=require('fs');var Redis=require(_0xc75c('0x3'));var db=require(_0xc75c('0x4'))['db'];var utils=require(_0xc75c('0x5'));var logger=require(_0xc75c('0x6'))(_0xc75c('0x7'));var config=require('../../config/environment');var jayson=require(_0xc75c('0x8'));var client=jayson[_0xc75c('0x9')][_0xc75c('0xa')]({'port':0x232a});config['redis']=_[_0xc75c('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xc75c('0xc'))(new Redis(config[_0xc75c('0xd')]));require('./voiceQueue.socket')[_0xc75c('0xe')](socket);function respondWithRpcPromise(_0x1061e5,_0x3a1b5c,_0x30ed2e){return new BPromise(function(_0x1ba8bf,_0x2f8c46){return client[_0xc75c('0xf')](_0x1061e5,_0x30ed2e)[_0xc75c('0x10')](function(_0x14217d){logger[_0xc75c('0x11')](_0xc75c('0x12'),_0x3a1b5c,_0xc75c('0x13'));logger[_0xc75c('0x14')](_0xc75c('0x15'),_0x3a1b5c,_0xc75c('0x13'),JSON[_0xc75c('0x16')](_0x14217d));if(_0x14217d[_0xc75c('0x17')]){if(_0x14217d['error'][_0xc75c('0x18')]===0x1f4){logger[_0xc75c('0x17')](_0xc75c('0x12'),_0x3a1b5c,_0x14217d[_0xc75c('0x17')]['message']);return _0x2f8c46(_0x14217d['error'][_0xc75c('0x19')]);}logger[_0xc75c('0x17')](_0xc75c('0x12'),_0x3a1b5c,_0x14217d[_0xc75c('0x17')][_0xc75c('0x19')]);return _0x1ba8bf(_0x14217d[_0xc75c('0x17')]['message']);}else{logger[_0xc75c('0x11')]('VoiceQueue,\x20%s,\x20%s',_0x3a1b5c,'request\x20sent');_0x1ba8bf(_0x14217d[_0xc75c('0x1a')][_0xc75c('0x19')]);}})[_0xc75c('0x1b')](function(_0x4ec7b9){logger['error'](_0xc75c('0x12'),_0x3a1b5c,_0x4ec7b9);_0x2f8c46(_0x4ec7b9);});});}exports[_0xc75c('0x1c')]=function(_0x21d387){var _0x499f8c=this;return new Promise(function(_0x1f8ce0,_0x40df49){return db['VoiceQueue'][_0xc75c('0x1d')]({'raw':_0x21d387[_0xc75c('0x1e')]?_0x21d387[_0xc75c('0x1e')][_0xc75c('0x1f')]===undefined?!![]:![]:!![],'where':_0x21d387['options']?_0x21d387['options'][_0xc75c('0x20')]||null:null,'attributes':_0x21d387[_0xc75c('0x1e')]?_0x21d387['options'][_0xc75c('0x21')]||null:null,'limit':_0x21d387['options']?_0x21d387['options']['limit']||null:null,'include':_0x21d387['options']?_0x21d387[_0xc75c('0x1e')][_0xc75c('0x22')]?_[_0xc75c('0x23')](_0x21d387[_0xc75c('0x1e')][_0xc75c('0x22')],function(_0x238657){return{'model':db[_0x238657['model']],'as':_0x238657['as'],'attributes':_0x238657[_0xc75c('0x21')],'include':_0x238657['include']?_[_0xc75c('0x23')](_0x238657[_0xc75c('0x22')],function(_0x1c4785){return{'model':db[_0x1c4785['model']],'as':_0x1c4785['as'],'attributes':_0x1c4785[_0xc75c('0x21')],'include':_0x1c4785[_0xc75c('0x22')]?_[_0xc75c('0x23')](_0x1c4785['include'],function(_0x53953f){return{'model':db[_0x53953f[_0xc75c('0x24')]],'as':_0x53953f['as'],'attributes':_0x53953f['attributes']};}):[]};}):[]};}):[]:[]})[_0xc75c('0x10')](function(_0x4d60dd){logger[_0xc75c('0x11')](_0xc75c('0x1c'),_0x21d387);logger[_0xc75c('0x14')]('GetVoiceQueue',_0x21d387,JSON[_0xc75c('0x16')](_0x4d60dd));_0x1f8ce0(_0x4d60dd);})[_0xc75c('0x1b')](function(_0x23dcfa){logger[_0xc75c('0x17')](_0xc75c('0x1c'),_0x23dcfa['message'],_0x21d387);_0x40df49(_0x499f8c[_0xc75c('0x17')](0x1f4,_0x23dcfa['message']));});});};exports[_0xc75c('0x25')]=function(_0x519cf0){var _0x2acc58=this;return new Promise(function(_0x22cde5,_0x22e8f6){return db[_0xc75c('0x26')][_0xc75c('0x27')]({'raw':_0x519cf0[_0xc75c('0x1e')]?_0x519cf0[_0xc75c('0x1e')][_0xc75c('0x1f')]===undefined?!![]:![]:!![],'where':_0x519cf0[_0xc75c('0x1e')]?_0x519cf0[_0xc75c('0x1e')][_0xc75c('0x20')]||null:null,'attributes':_0x519cf0[_0xc75c('0x1e')]?_0x519cf0[_0xc75c('0x1e')][_0xc75c('0x21')]||null:null,'include':_0x519cf0['options']?_0x519cf0[_0xc75c('0x1e')]['include']?_['map'](_0x519cf0['options'][_0xc75c('0x22')],function(_0x122f69){return{'model':db[_0x122f69['model']],'as':_0x122f69['as'],'attributes':_0x122f69[_0xc75c('0x21')],'include':_0x122f69['include']?_[_0xc75c('0x23')](_0x122f69[_0xc75c('0x22')],function(_0x530259){return{'model':db[_0x530259['model']],'as':_0x530259['as'],'attributes':_0x530259[_0xc75c('0x21')],'include':_0x530259[_0xc75c('0x22')]?_[_0xc75c('0x23')](_0x530259[_0xc75c('0x22')],function(_0x3581c9){return{'model':db[_0x3581c9[_0xc75c('0x24')]],'as':_0x3581c9['as'],'attributes':_0x3581c9[_0xc75c('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x27cb49){logger[_0xc75c('0x11')]('ShowVoiceQueue',_0x519cf0);logger[_0xc75c('0x14')](_0xc75c('0x25'),_0x519cf0,JSON[_0xc75c('0x16')](_0x27cb49));_0x22cde5(_0x27cb49);})[_0xc75c('0x1b')](function(_0x1a2e8e){logger[_0xc75c('0x17')]('ShowVoiceQueue',_0x1a2e8e[_0xc75c('0x19')],_0x519cf0);_0x22e8f6(_0x2acc58[_0xc75c('0x17')](0x1f4,_0x1a2e8e[_0xc75c('0x19')]));});});}; \ No newline at end of file +var _0x4c48=['util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','register','info','VoiceQueue,\x20%s,\x20%s','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','catch','GetVoiceQueue','VoiceQueue','findAll','options','where','attributes','limit','include','map','model','then','ShowVoiceQueue','find','raw','lodash'];(function(_0x22ae6d,_0xc5b751){var _0x1716ff=function(_0x4dc4e4){while(--_0x4dc4e4){_0x22ae6d['push'](_0x22ae6d['shift']());}};_0x1716ff(++_0xc5b751);}(_0x4c48,0xcc));var _0x84c4=function(_0x1fb1c1,_0x4ebe69){_0x1fb1c1=_0x1fb1c1-0x0;var _0x1622df=_0x4c48[_0x1fb1c1];return _0x1622df;};'use strict';var _=require(_0x84c4('0x0'));var util=require(_0x84c4('0x1'));var moment=require(_0x84c4('0x2'));var BPromise=require('bluebird');var rs=require(_0x84c4('0x3'));var fs=require('fs');var Redis=require(_0x84c4('0x4'));var db=require(_0x84c4('0x5'))['db'];var utils=require(_0x84c4('0x6'));var logger=require(_0x84c4('0x7'))(_0x84c4('0x8'));var config=require(_0x84c4('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x84c4('0xa')][_0x84c4('0xb')]({'port':0x232a});config[_0x84c4('0xc')]=_[_0x84c4('0xd')](config[_0x84c4('0xc')],{'host':_0x84c4('0xe'),'port':0x18eb});var socket=require(_0x84c4('0xf'))(new Redis(config[_0x84c4('0xc')]));require('./voiceQueue.socket')[_0x84c4('0x10')](socket);function respondWithRpcPromise(_0x153494,_0x23957e,_0x5e94f4){return new BPromise(function(_0x297dc4,_0x506312){return client['request'](_0x153494,_0x5e94f4)['then'](function(_0x5ab187){logger[_0x84c4('0x11')](_0x84c4('0x12'),_0x23957e,'request\x20sent');logger[_0x84c4('0x13')](_0x84c4('0x14'),_0x23957e,'request\x20sent',JSON[_0x84c4('0x15')](_0x5ab187));if(_0x5ab187[_0x84c4('0x16')]){if(_0x5ab187[_0x84c4('0x16')][_0x84c4('0x17')]===0x1f4){logger[_0x84c4('0x16')](_0x84c4('0x12'),_0x23957e,_0x5ab187[_0x84c4('0x16')]['message']);return _0x506312(_0x5ab187[_0x84c4('0x16')][_0x84c4('0x18')]);}logger[_0x84c4('0x16')](_0x84c4('0x12'),_0x23957e,_0x5ab187['error'][_0x84c4('0x18')]);return _0x297dc4(_0x5ab187[_0x84c4('0x16')][_0x84c4('0x18')]);}else{logger[_0x84c4('0x11')](_0x84c4('0x12'),_0x23957e,_0x84c4('0x19'));_0x297dc4(_0x5ab187['result'][_0x84c4('0x18')]);}})[_0x84c4('0x1a')](function(_0xda80bb){logger[_0x84c4('0x16')](_0x84c4('0x12'),_0x23957e,_0xda80bb);_0x506312(_0xda80bb);});});}exports[_0x84c4('0x1b')]=function(_0x48a59b){var _0x42bc69=this;return new Promise(function(_0x5a1236,_0x16a19a){return db[_0x84c4('0x1c')][_0x84c4('0x1d')]({'raw':_0x48a59b[_0x84c4('0x1e')]?_0x48a59b[_0x84c4('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x48a59b[_0x84c4('0x1e')]?_0x48a59b[_0x84c4('0x1e')][_0x84c4('0x1f')]||null:null,'attributes':_0x48a59b[_0x84c4('0x1e')]?_0x48a59b['options'][_0x84c4('0x20')]||null:null,'limit':_0x48a59b[_0x84c4('0x1e')]?_0x48a59b['options'][_0x84c4('0x21')]||null:null,'include':_0x48a59b[_0x84c4('0x1e')]?_0x48a59b[_0x84c4('0x1e')][_0x84c4('0x22')]?_[_0x84c4('0x23')](_0x48a59b[_0x84c4('0x1e')][_0x84c4('0x22')],function(_0x5aeb35){return{'model':db[_0x5aeb35[_0x84c4('0x24')]],'as':_0x5aeb35['as'],'attributes':_0x5aeb35[_0x84c4('0x20')],'include':_0x5aeb35['include']?_[_0x84c4('0x23')](_0x5aeb35['include'],function(_0xc391a3){return{'model':db[_0xc391a3[_0x84c4('0x24')]],'as':_0xc391a3['as'],'attributes':_0xc391a3[_0x84c4('0x20')],'include':_0xc391a3[_0x84c4('0x22')]?_['map'](_0xc391a3[_0x84c4('0x22')],function(_0x1ec81c){return{'model':db[_0x1ec81c[_0x84c4('0x24')]],'as':_0x1ec81c['as'],'attributes':_0x1ec81c['attributes']};}):[]};}):[]};}):[]:[]})[_0x84c4('0x25')](function(_0x1f50c2){logger['info'](_0x84c4('0x1b'),_0x48a59b);logger['debug'](_0x84c4('0x1b'),_0x48a59b,JSON[_0x84c4('0x15')](_0x1f50c2));_0x5a1236(_0x1f50c2);})[_0x84c4('0x1a')](function(_0x112e4e){logger[_0x84c4('0x16')]('GetVoiceQueue',_0x112e4e[_0x84c4('0x18')],_0x48a59b);_0x16a19a(_0x42bc69['error'](0x1f4,_0x112e4e[_0x84c4('0x18')]));});});};exports[_0x84c4('0x26')]=function(_0x5120b4){var _0x21f6f=this;return new Promise(function(_0x2aaf2f,_0x7feac1){return db[_0x84c4('0x1c')][_0x84c4('0x27')]({'raw':_0x5120b4['options']?_0x5120b4[_0x84c4('0x1e')][_0x84c4('0x28')]===undefined?!![]:![]:!![],'where':_0x5120b4[_0x84c4('0x1e')]?_0x5120b4[_0x84c4('0x1e')][_0x84c4('0x1f')]||null:null,'attributes':_0x5120b4[_0x84c4('0x1e')]?_0x5120b4[_0x84c4('0x1e')]['attributes']||null:null,'include':_0x5120b4['options']?_0x5120b4[_0x84c4('0x1e')]['include']?_[_0x84c4('0x23')](_0x5120b4[_0x84c4('0x1e')][_0x84c4('0x22')],function(_0xc3a557){return{'model':db[_0xc3a557[_0x84c4('0x24')]],'as':_0xc3a557['as'],'attributes':_0xc3a557[_0x84c4('0x20')],'include':_0xc3a557[_0x84c4('0x22')]?_[_0x84c4('0x23')](_0xc3a557[_0x84c4('0x22')],function(_0x23bcc9){return{'model':db[_0x23bcc9[_0x84c4('0x24')]],'as':_0x23bcc9['as'],'attributes':_0x23bcc9[_0x84c4('0x20')],'include':_0x23bcc9['include']?_[_0x84c4('0x23')](_0x23bcc9[_0x84c4('0x22')],function(_0xf50582){return{'model':db[_0xf50582['model']],'as':_0xf50582['as'],'attributes':_0xf50582['attributes']};}):[]};}):[]};}):[]:[]})[_0x84c4('0x25')](function(_0x385f33){logger[_0x84c4('0x11')](_0x84c4('0x26'),_0x5120b4);logger[_0x84c4('0x13')](_0x84c4('0x26'),_0x5120b4,JSON['stringify'](_0x385f33));_0x2aaf2f(_0x385f33);})[_0x84c4('0x1a')](function(_0x2a628c){logger[_0x84c4('0x16')](_0x84c4('0x26'),_0x2a628c[_0x84c4('0x18')],_0x5120b4);_0x7feac1(_0x21f6f['error'](0x1f4,_0x2a628c[_0x84c4('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index ee4a81e..0d3b969 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 _0x36a0=['remove','removeListener','register','save'];(function(_0x500419,_0x549162){var _0x241c1a=function(_0x3bea1a){while(--_0x3bea1a){_0x500419['push'](_0x500419['shift']());}};_0x241c1a(++_0x549162);}(_0x36a0,0x17b));var _0x036a=function(_0x2ae655,_0x9dae){_0x2ae655=_0x2ae655-0x0;var _0x388125=_0x36a0[_0x2ae655];return _0x388125;};'use strict';var VoiceQueueEvents=require('./voiceQueue.events');var events=[_0x036a('0x0'),_0x036a('0x1'),'update'];function createListener(_0x31177e,_0x35dc71){return function(_0x25f288){_0x35dc71['emit'](_0x31177e,_0x25f288);};}function removeListener(_0x3857f1,_0x1a5b95){return function(){VoiceQueueEvents[_0x036a('0x2')](_0x3857f1,_0x1a5b95);};}exports[_0x036a('0x3')]=function(_0x53a51d){for(var _0x33ca91=0x0,_0x2c623d=events['length'];_0x33ca91<_0x2c623d;_0x33ca91++){var _0x106d13=events[_0x33ca91];var _0x7ed5e5=createListener('voiceQueue:'+_0x106d13,_0x53a51d);VoiceQueueEvents['on'](_0x106d13,_0x7ed5e5);}}; \ No newline at end of file +var _0xb64f=['length','voiceQueue:','./voiceQueue.events','update','emit','removeListener'];(function(_0x52baf2,_0x342873){var _0x3740f3=function(_0x33248c){while(--_0x33248c){_0x52baf2['push'](_0x52baf2['shift']());}};_0x3740f3(++_0x342873);}(_0xb64f,0x1a6));var _0xfb64=function(_0x3afe18,_0x26922c){_0x3afe18=_0x3afe18-0x0;var _0x19ed1f=_0xb64f[_0x3afe18];return _0x19ed1f;};'use strict';var VoiceQueueEvents=require(_0xfb64('0x0'));var events=['save','remove',_0xfb64('0x1')];function createListener(_0x2b829b,_0x17a415){return function(_0x220dd9){_0x17a415[_0xfb64('0x2')](_0x2b829b,_0x220dd9);};}function removeListener(_0x9da130,_0x2d6e0f){return function(){VoiceQueueEvents[_0xfb64('0x3')](_0x9da130,_0x2d6e0f);};}exports['register']=function(_0x306912){for(var _0x3a93eb=0x0,_0x57ca1c=events[_0xfb64('0x4')];_0x3a93eb<_0x57ca1c;_0x3a93eb++){var _0x4eb419=events[_0x3a93eb];var _0x59b95b=createListener(_0xfb64('0x5')+_0x4eb419,_0x306912);VoiceQueueEvents['on'](_0x4eb419,_0x59b95b);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index 7458453..fd8e7fb 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 _0xee58=['update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceQueueReport.controller','get','isAuthenticated','index','/index','/:id','show','post'];(function(_0xed8ae6,_0x1eb5f0){var _0xc3b924=function(_0x3b2ded){while(--_0x3b2ded){_0xed8ae6['push'](_0xed8ae6['shift']());}};_0xc3b924(++_0x1eb5f0);}(_0xee58,0xe0));var _0x8ee5=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xee58[_0x3947c9];return _0x2e7871;};'use strict';var multer=require('multer');var util=require(_0x8ee5('0x0'));var path=require(_0x8ee5('0x1'));var timeout=require(_0x8ee5('0x2'));var express=require(_0x8ee5('0x3'));var router=express[_0x8ee5('0x4')]();var fs_extra=require(_0x8ee5('0x5'));var auth=require(_0x8ee5('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x8ee5('0x7'));var controller=require(_0x8ee5('0x8'));router[_0x8ee5('0x9')]('/',auth[_0x8ee5('0xa')](),controller[_0x8ee5('0xb')]);router['get']('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x8ee5('0x9')](_0x8ee5('0xc'),auth[_0x8ee5('0xa')](),controller['getVoiceQueuesReport']);router[_0x8ee5('0x9')](_0x8ee5('0xd'),auth[_0x8ee5('0xa')](),controller[_0x8ee5('0xe')]);router[_0x8ee5('0xf')]('/',auth[_0x8ee5('0xa')](),controller['create']);router['put'](_0x8ee5('0xd'),auth[_0x8ee5('0xa')](),controller[_0x8ee5('0x10')]);router[_0x8ee5('0x11')](_0x8ee5('0xd'),auth[_0x8ee5('0xa')](),controller[_0x8ee5('0x12')]);module[_0x8ee5('0x13')]=router; \ No newline at end of file +var _0x9890=['destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','./voiceQueueReport.controller','get','isAuthenticated','index','describe','/index','getVoiceQueuesReport','/:id','post','create','put','update','delete'];(function(_0x193e2a,_0x109411){var _0x10ed8f=function(_0x55c2c5){while(--_0x55c2c5){_0x193e2a['push'](_0x193e2a['shift']());}};_0x10ed8f(++_0x109411);}(_0x9890,0x144));var _0x0989=function(_0x1b7003,_0x52f380){_0x1b7003=_0x1b7003-0x0;var _0x144a89=_0x9890[_0x1b7003];return _0x144a89;};'use strict';var multer=require(_0x0989('0x0'));var util=require(_0x0989('0x1'));var path=require(_0x0989('0x2'));var timeout=require(_0x0989('0x3'));var express=require(_0x0989('0x4'));var router=express[_0x0989('0x5')]();var fs_extra=require(_0x0989('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x0989('0x7'));var controller=require(_0x0989('0x8'));router[_0x0989('0x9')]('/',auth[_0x0989('0xa')](),controller[_0x0989('0xb')]);router['get']('/describe',auth[_0x0989('0xa')](),controller[_0x0989('0xc')]);router['get'](_0x0989('0xd'),auth[_0x0989('0xa')](),controller[_0x0989('0xe')]);router[_0x0989('0x9')](_0x0989('0xf'),auth[_0x0989('0xa')](),controller['show']);router[_0x0989('0x10')]('/',auth[_0x0989('0xa')](),controller[_0x0989('0x11')]);router[_0x0989('0x12')]('/:id',auth[_0x0989('0xa')](),controller[_0x0989('0x13')]);router[_0x0989('0x14')]('/:id',auth['isAuthenticated'](),controller[_0x0989('0x15')]);module[_0x0989('0x16')]=router; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.attributes.js b/server/api/voiceQueueReport/voiceQueueReport.attributes.js index 599fd55..78afd50 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 _0xece3=['BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','STRING','DATE','getDataValue','queuecallerjoinAt','format','YYYY-MM-DD\x20HH:mm:ss','diff','seconds','setDataValue','queuecallerleaveAt','INTEGER'];(function(_0x2a1e2d,_0x195473){var _0x32b8cc=function(_0x57582d){while(--_0x57582d){_0x2a1e2d['push'](_0x2a1e2d['shift']());}};_0x32b8cc(++_0x195473);}(_0xece3,0x1d0));var _0x3ece=function(_0x29d2d2,_0x3344){_0x29d2d2=_0x29d2d2-0x0;var _0x3f6476=_0xece3[_0x29d2d2];return _0x3f6476;};'use strict';var Sequelize=require(_0x3ece('0x0'));var moment=require('moment');module['exports']={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x3ece('0x1')]},'calleridnum':{'type':Sequelize[_0x3ece('0x1')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x3ece('0x1')]},'queuecallerjoinAt':{'type':Sequelize['DATE']},'queuecallerleaveAt':{'type':Sequelize[_0x3ece('0x2')],'set':function(_0x382650){var _0x28b1cd=moment(_0x382650);var _0x2cbf0e=moment(this[_0x3ece('0x3')](_0x3ece('0x4')))[_0x3ece('0x5')](_0x3ece('0x6'));var _0x1afc24=_0x28b1cd[_0x3ece('0x7')](_0x2cbf0e,_0x3ece('0x8'));this[_0x3ece('0x9')](_0x3ece('0xa'),_0x382650);this[_0x3ece('0x9')]('holdtime',_0x1afc24||null);}},'position':{'type':Sequelize[_0x3ece('0xb')]},'count':{'type':Sequelize[_0x3ece('0xb')]},'queuecallerabandon':{'type':Sequelize[_0x3ece('0xc')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x3ece('0x2')]},'queuecallercomplete':{'type':Sequelize[_0x3ece('0xc')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x3ece('0x2')]},'queuecallerexit':{'type':Sequelize[_0x3ece('0xc')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize['DATE']},'queuecallerexitreason':{'type':Sequelize[_0x3ece('0x1')],'comment':'COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT'},'originalposition':{'type':Sequelize['INTEGER']},'channel':{'type':Sequelize[_0x3ece('0x1')]},'connectedlinenum':{'type':Sequelize[_0x3ece('0x1')]},'connectedlinename':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x3ece('0x1')]},'exten':{'type':Sequelize[_0x3ece('0x1')]},'priority':{'type':Sequelize['STRING']},'holdtime':{'type':Sequelize[_0x3ece('0xb')]},'mohtime':{'type':Sequelize[_0x3ece('0xb')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x3ece('0xc')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x3ece('0x1')]},'transfer':{'type':Sequelize[_0x3ece('0xc')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x3ece('0x1')],'comment':_0x3ece('0xd')},'transferexten':{'type':Sequelize[_0x3ece('0x1')]},'transferuniqueid':{'type':Sequelize[_0x3ece('0x1')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x3ece('0x1')]},'thirdDisposition':{'type':Sequelize['STRING']},'queuecallerenterreason':{'type':Sequelize[_0x3ece('0xb')],'defaultValue':0x0},'note':{'type':Sequelize[_0x3ece('0x1')]}}; \ No newline at end of file +var _0xbed5=['STRING','DATE','queuecallerjoinAt','format','seconds','setDataValue','queuecallerleaveAt','holdtime','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','moment','exports'];(function(_0x41a53a,_0x867c6c){var _0x244374=function(_0x35afe5){while(--_0x35afe5){_0x41a53a['push'](_0x41a53a['shift']());}};_0x244374(++_0x867c6c);}(_0xbed5,0x1bf));var _0x5bed=function(_0x12daf7,_0x4acb2d){_0x12daf7=_0x12daf7-0x0;var _0x4a979d=_0xbed5[_0x12daf7];return _0x4a979d;};'use strict';var Sequelize=require(_0x5bed('0x0'));var moment=require(_0x5bed('0x1'));module[_0x5bed('0x2')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x5bed('0x3')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x5bed('0x3')]},'queue':{'type':Sequelize[_0x5bed('0x3')]},'queuecallerjoinAt':{'type':Sequelize[_0x5bed('0x4')]},'queuecallerleaveAt':{'type':Sequelize[_0x5bed('0x4')],'set':function(_0x270e0c){var _0x4cba65=moment(_0x270e0c);var _0x2d21b4=moment(this['getDataValue'](_0x5bed('0x5')))[_0x5bed('0x6')]('YYYY-MM-DD\x20HH:mm:ss');var _0x5773bc=_0x4cba65['diff'](_0x2d21b4,_0x5bed('0x7'));this[_0x5bed('0x8')](_0x5bed('0x9'),_0x270e0c);this[_0x5bed('0x8')](_0x5bed('0xa'),_0x5773bc||null);}},'position':{'type':Sequelize[_0x5bed('0xb')]},'count':{'type':Sequelize[_0x5bed('0xb')]},'queuecallerabandon':{'type':Sequelize[_0x5bed('0xc')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize['DATE']},'queuecallercomplete':{'type':Sequelize[_0x5bed('0xc')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x5bed('0x4')]},'queuecallerexit':{'type':Sequelize[_0x5bed('0xc')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x5bed('0x4')]},'queuecallerexitreason':{'type':Sequelize[_0x5bed('0x3')],'comment':_0x5bed('0xd')},'originalposition':{'type':Sequelize[_0x5bed('0xb')]},'channel':{'type':Sequelize[_0x5bed('0x3')]},'connectedlinenum':{'type':Sequelize[_0x5bed('0x3')]},'connectedlinename':{'type':Sequelize[_0x5bed('0x3')]},'accountcode':{'type':Sequelize[_0x5bed('0x3')]},'context':{'type':Sequelize[_0x5bed('0x3')]},'exten':{'type':Sequelize[_0x5bed('0x3')]},'priority':{'type':Sequelize[_0x5bed('0x3')]},'holdtime':{'type':Sequelize[_0x5bed('0xb')]},'mohtime':{'type':Sequelize[_0x5bed('0xb')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x5bed('0xc')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x5bed('0x3')]},'transfer':{'type':Sequelize[_0x5bed('0xc')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x5bed('0x3')],'comment':_0x5bed('0xe')},'transferexten':{'type':Sequelize[_0x5bed('0x3')]},'transferuniqueid':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x5bed('0x3')]},'thirdDisposition':{'type':Sequelize[_0x5bed('0x3')]},'queuecallerenterreason':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'note':{'type':Sequelize[_0x5bed('0x3')]}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.controller.js b/server/api/voiceQueueReport/voiceQueueReport.controller.js index 45a0138..9282985 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 _0xd026=['rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./voiceQueueReport.socket','register','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','destroy','then','end','error','send','map','fieldName','key','model','name','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','VIRTUAL','options','include','VoiceQueueReport','rows','catch','find','create','body','params','describe','rawAttributes','pick','includeAll','findAll','getVoiceQueuesReport','eml-format'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xd026,0xa3));var _0x6d02=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0xd026[_0x47b58b];return _0x46bebe;};'use strict';var emlformat=require(_0x6d02('0x0'));var rimraf=require(_0x6d02('0x1'));var zipdir=require(_0x6d02('0x2'));var jsonpatch=require(_0x6d02('0x3'));var rp=require(_0x6d02('0x4'));var moment=require('moment');var BPromise=require(_0x6d02('0x5'));var Mustache=require('mustache');var util=require(_0x6d02('0x6'));var path=require(_0x6d02('0x7'));var sox=require(_0x6d02('0x8'));var csv=require(_0x6d02('0x9'));var ejs=require(_0x6d02('0xa'));var fs=require('fs');var fs_extra=require(_0x6d02('0xb'));var _=require(_0x6d02('0xc'));var squel=require('squel');var crypto=require(_0x6d02('0xd'));var jsforce=require(_0x6d02('0xe'));var deskjs=require(_0x6d02('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x6d02('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x6d02('0x11'));var as=require(_0x6d02('0x12'));var hardwareService=require(_0x6d02('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x6d02('0x14'));var config=require(_0x6d02('0x15'));var licenseUtil=require(_0x6d02('0x16'));var db=require(_0x6d02('0x17'))['db'];config[_0x6d02('0x18')]=_[_0x6d02('0x19')](config[_0x6d02('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0x6d02('0x1a'))(new Redis(config[_0x6d02('0x18')]));require(_0x6d02('0x1b'))[_0x6d02('0x1c')](socket);function respondWithStatusCode(_0x3d197f,_0x2c7a8e){_0x2c7a8e=_0x2c7a8e||0xcc;return function(_0x2f7979){if(_0x2f7979){return _0x3d197f[_0x6d02('0x1d')](_0x2c7a8e);}return _0x3d197f[_0x6d02('0x1e')](_0x2c7a8e)['end']();};}function respondWithResult(_0x5e3706,_0x5b42c6){_0x5b42c6=_0x5b42c6||0xc8;return function(_0x4027cd){if(_0x4027cd){return _0x5e3706[_0x6d02('0x1e')](_0x5b42c6)[_0x6d02('0x1f')](_0x4027cd);}};}function respondWithFilteredResult(_0x33901e,_0x594669){return function(_0x378c9e){if(_0x378c9e){var _0x3c839a=typeof _0x594669[_0x6d02('0x20')]===_0x6d02('0x21')&&typeof _0x594669['limit']===_0x6d02('0x21');var _0x46f12c=_0x378c9e[_0x6d02('0x22')];var _0x2fdcb5=_0x3c839a?0x0:_0x594669[_0x6d02('0x20')];var _0x1e8baf=_0x3c839a?_0x378c9e[_0x6d02('0x22')]:_0x594669[_0x6d02('0x20')]+_0x594669[_0x6d02('0x23')];var _0x2064ec;if(_0x1e8baf>=_0x46f12c){_0x1e8baf=_0x46f12c;_0x2064ec=0xc8;}else{_0x2064ec=0xce;}_0x33901e['status'](_0x2064ec);return _0x33901e[_0x6d02('0x24')](_0x6d02('0x25'),_0x2fdcb5+'-'+_0x1e8baf+'/'+_0x46f12c)[_0x6d02('0x1f')](_0x378c9e);}return null;};}function patchUpdates(_0x2b9db1){return function(_0x11f018){try{jsonpatch[_0x6d02('0x26')](_0x11f018,_0x2b9db1,!![]);}catch(_0x2e824c){return BPromise[_0x6d02('0x27')](_0x2e824c);}return _0x11f018[_0x6d02('0x28')]();};}function saveUpdates(_0x27f78a,_0x537396){return function(_0x54ca7d){if(_0x54ca7d){return _0x54ca7d['update'](_0x27f78a)['then'](function(_0x284d80){return _0x284d80;});}return null;};}function removeEntity(_0x2e67c8,_0x531b13){return function(_0x58fb4f){if(_0x58fb4f){return _0x58fb4f[_0x6d02('0x29')]()[_0x6d02('0x2a')](function(){_0x2e67c8[_0x6d02('0x1e')](0xcc)[_0x6d02('0x2b')]();});}};}function handleEntityNotFound(_0xe05c2f,_0x2c5438){return function(_0x3a6cb6){if(!_0x3a6cb6){_0xe05c2f[_0x6d02('0x1d')](0x194);}return _0x3a6cb6;};}function handleError(_0x42ec8e,_0x1becb3){_0x1becb3=_0x1becb3||0x1f4;return function(_0x5717a9){logger[_0x6d02('0x2c')](_0x5717a9['stack']);if(_0x5717a9['name']){delete _0x5717a9['name'];}_0x42ec8e[_0x6d02('0x1e')](_0x1becb3)[_0x6d02('0x2d')](_0x5717a9);};}exports['index']=function(_0x44f91a,_0x4cd22a){var _0x35fcd6={},_0x401b3d={},_0x456a9a={'count':0x0,'rows':[]};var _0xd2ecee=_[_0x6d02('0x2e')](db['VoiceQueueReport']['rawAttributes'],function(_0x82113c){return{'name':_0x82113c[_0x6d02('0x2f')],'type':_0x82113c['type'][_0x6d02('0x30')]};});_0x401b3d[_0x6d02('0x31')]=_[_0x6d02('0x2e')](_0xd2ecee,_0x6d02('0x32'));_0x401b3d[_0x6d02('0x33')]=_[_0x6d02('0x34')](_0x44f91a[_0x6d02('0x33')]);_0x401b3d[_0x6d02('0x35')]=_[_0x6d02('0x36')](_0x401b3d[_0x6d02('0x31')],_0x401b3d[_0x6d02('0x33')]);_0x35fcd6['attributes']=_[_0x6d02('0x36')](_0x401b3d['model'],qs[_0x6d02('0x37')](_0x44f91a['query'][_0x6d02('0x37')]));_0x35fcd6[_0x6d02('0x38')]=_0x35fcd6[_0x6d02('0x38')][_0x6d02('0x39')]?_0x35fcd6['attributes']:_0x401b3d['model'];if(!_0x44f91a[_0x6d02('0x33')][_0x6d02('0x3a')](_0x6d02('0x3b'))){_0x35fcd6[_0x6d02('0x23')]=qs['limit'](_0x44f91a[_0x6d02('0x33')][_0x6d02('0x23')]);_0x35fcd6[_0x6d02('0x20')]=qs['offset'](_0x44f91a['query'][_0x6d02('0x20')]);}_0x35fcd6[_0x6d02('0x3c')]=qs[_0x6d02('0x3d')](_0x44f91a['query']['sort']);_0x35fcd6[_0x6d02('0x3e')]=qs[_0x6d02('0x35')](_['pick'](_0x44f91a['query'],_0x401b3d[_0x6d02('0x35')]),_0xd2ecee);if(_0x44f91a[_0x6d02('0x33')][_0x6d02('0x3f')]){_0x35fcd6[_0x6d02('0x3e')]=_[_0x6d02('0x40')](_0x35fcd6[_0x6d02('0x3e')],{'$or':_['map'](_0xd2ecee,function(_0x2fbc5b){if(_0x2fbc5b[_0x6d02('0x41')]!==_0x6d02('0x42')){var _0x4b3202={};_0x4b3202[_0x2fbc5b[_0x6d02('0x32')]]={'$like':'%'+_0x44f91a[_0x6d02('0x33')][_0x6d02('0x3f')]+'%'};return _0x4b3202;}})});}_0x35fcd6=_[_0x6d02('0x40')]({},_0x35fcd6,_0x44f91a[_0x6d02('0x43')]);var _0xcfbd2={'where':_0x35fcd6[_0x6d02('0x3e')]};return db['VoiceQueueReport']['count'](_0xcfbd2)[_0x6d02('0x2a')](function(_0x1ac1d7){_0x456a9a['count']=_0x1ac1d7;if(_0x44f91a[_0x6d02('0x33')]['includeAll']){_0x35fcd6[_0x6d02('0x44')]=[{'all':!![]}];}return db[_0x6d02('0x45')]['findAll'](_0x35fcd6);})[_0x6d02('0x2a')](function(_0x31be3a){_0x456a9a[_0x6d02('0x46')]=_0x31be3a;return _0x456a9a;})[_0x6d02('0x2a')](respondWithFilteredResult(_0x4cd22a,_0x35fcd6))[_0x6d02('0x47')](handleError(_0x4cd22a,null));};exports['show']=function(_0x5f1246,_0x47ab4c){var _0x5bd210={'raw':![],'where':{'id':_0x5f1246['params']['id']}},_0x33f3c0={};_0x33f3c0['model']=_[_0x6d02('0x34')](db[_0x6d02('0x45')]['rawAttributes']);_0x33f3c0[_0x6d02('0x33')]=_[_0x6d02('0x34')](_0x5f1246[_0x6d02('0x33')]);_0x33f3c0[_0x6d02('0x35')]=_['intersection'](_0x33f3c0[_0x6d02('0x31')],_0x33f3c0[_0x6d02('0x33')]);_0x5bd210['attributes']=_[_0x6d02('0x36')](_0x33f3c0[_0x6d02('0x31')],qs[_0x6d02('0x37')](_0x5f1246[_0x6d02('0x33')][_0x6d02('0x37')]));_0x5bd210['attributes']=_0x5bd210[_0x6d02('0x38')]['length']?_0x5bd210[_0x6d02('0x38')]:_0x33f3c0[_0x6d02('0x31')];if(_0x5f1246[_0x6d02('0x33')]['includeAll']){_0x5bd210[_0x6d02('0x44')]=[{'all':!![]}];}_0x5bd210=_[_0x6d02('0x40')]({},_0x5bd210,_0x5f1246[_0x6d02('0x43')]);return db[_0x6d02('0x45')][_0x6d02('0x48')](_0x5bd210)[_0x6d02('0x2a')](handleEntityNotFound(_0x47ab4c,null))[_0x6d02('0x2a')](respondWithResult(_0x47ab4c,null))[_0x6d02('0x47')](handleError(_0x47ab4c,null));};exports[_0x6d02('0x49')]=function(_0x2f9ee6,_0x29909e){return db[_0x6d02('0x45')][_0x6d02('0x49')](_0x2f9ee6['body'],{})['then'](respondWithResult(_0x29909e,0xc9))[_0x6d02('0x47')](handleError(_0x29909e,null));};exports['update']=function(_0x5ce41f,_0x4da002){if(_0x5ce41f['body']['id']){delete _0x5ce41f[_0x6d02('0x4a')]['id'];}return db[_0x6d02('0x45')][_0x6d02('0x48')]({'where':{'id':_0x5ce41f[_0x6d02('0x4b')]['id']}})[_0x6d02('0x2a')](handleEntityNotFound(_0x4da002,null))['then'](saveUpdates(_0x5ce41f[_0x6d02('0x4a')],null))[_0x6d02('0x2a')](respondWithResult(_0x4da002,null))[_0x6d02('0x47')](handleError(_0x4da002,null));};exports[_0x6d02('0x29')]=function(_0x5e83fb,_0x258cad){return db['VoiceQueueReport'][_0x6d02('0x48')]({'where':{'id':_0x5e83fb[_0x6d02('0x4b')]['id']}})[_0x6d02('0x2a')](handleEntityNotFound(_0x258cad,null))[_0x6d02('0x2a')](removeEntity(_0x258cad,null))[_0x6d02('0x47')](handleError(_0x258cad,null));};exports[_0x6d02('0x4c')]=function(_0x269ebb,_0x548579){return db[_0x6d02('0x45')][_0x6d02('0x4c')]()[_0x6d02('0x2a')](respondWithResult(_0x548579,null))[_0x6d02('0x47')](handleError(_0x548579,null));};exports['getVoiceQueuesReport']=function(_0x4a80b5,_0x3d3b84){var _0x266262={},_0x5471de={},_0x2acd96={'count':0x0,'rows':[]};_0x5471de[_0x6d02('0x31')]=_[_0x6d02('0x34')](db['VoiceQueueReport'][_0x6d02('0x4d')]);_0x5471de[_0x6d02('0x33')]=_[_0x6d02('0x34')](_0x4a80b5[_0x6d02('0x33')]);_0x5471de[_0x6d02('0x35')]=_[_0x6d02('0x36')](_0x5471de[_0x6d02('0x31')],_0x5471de[_0x6d02('0x33')]);_0x266262[_0x6d02('0x38')]=_['intersection'](_0x5471de[_0x6d02('0x31')],qs[_0x6d02('0x37')](_0x4a80b5['query'][_0x6d02('0x37')]));_0x266262['attributes']=_0x266262['attributes']['length']?_0x266262[_0x6d02('0x38')]:_0x5471de[_0x6d02('0x31')];if(!_0x4a80b5[_0x6d02('0x33')][_0x6d02('0x3a')]('nolimit')){_0x266262[_0x6d02('0x23')]=qs[_0x6d02('0x23')](_0x4a80b5[_0x6d02('0x33')][_0x6d02('0x23')]);_0x266262[_0x6d02('0x20')]=qs[_0x6d02('0x20')](_0x4a80b5['query'][_0x6d02('0x20')]);}_0x266262[_0x6d02('0x3c')]=qs[_0x6d02('0x3d')](_0x4a80b5['query'][_0x6d02('0x3d')]);_0x266262[_0x6d02('0x3e')]=qs[_0x6d02('0x35')](_[_0x6d02('0x4e')](_0x4a80b5[_0x6d02('0x33')],_0x5471de[_0x6d02('0x35')]));if(_0x4a80b5[_0x6d02('0x33')][_0x6d02('0x3f')]){_0x266262['where']=_[_0x6d02('0x40')](_0x266262[_0x6d02('0x3e')],{'$or':_[_0x6d02('0x2e')](_0x266262['attributes'],function(_0x3b7659){var _0x52d5d2={};_0x52d5d2[_0x3b7659]={'$like':'%'+_0x4a80b5[_0x6d02('0x33')][_0x6d02('0x3f')]+'%'};return _0x52d5d2;})});}_0x266262=_['merge']({},_0x266262,_0x4a80b5['options']);var _0x5d1194={'where':_0x266262[_0x6d02('0x3e')]};return db[_0x6d02('0x45')][_0x6d02('0x22')](_0x5d1194)[_0x6d02('0x2a')](function(_0x476a87){_0x2acd96[_0x6d02('0x22')]=_0x476a87;if(_0x4a80b5[_0x6d02('0x33')][_0x6d02('0x4f')]){_0x266262[_0x6d02('0x44')]=[{'all':!![]}];}return db['VoiceQueueReport'][_0x6d02('0x50')](_0x266262);})[_0x6d02('0x2a')](function(_0x5a627d){_0x2acd96[_0x6d02('0x46')]=_0x5a627d;return _0x2acd96;})[_0x6d02('0x2a')](respondWithFilteredResult(_0x3d3b84,_0x266262,_0x6d02('0x51')))[_0x6d02('0x47')](handleError(_0x3d3b84,null,'getVoiceQueuesReport'));}; \ No newline at end of file +var _0xe666=['error','stack','name','send','map','VoiceQueueReport','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','find','create','body','params','describe','getVoiceQueuesReport','order','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','lodash','squel','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./voiceQueueReport.socket','register','status','end','json','limit','undefined','count','offset','Content-Range','apply','save','update','then','destroy'];(function(_0x2c680e,_0x463721){var _0x3d2191=function(_0x181ae7){while(--_0x181ae7){_0x2c680e['push'](_0x2c680e['shift']());}};_0x3d2191(++_0x463721);}(_0xe666,0x1ad));var _0x6e66=function(_0x1a3cb9,_0x3e513a){_0x1a3cb9=_0x1a3cb9-0x0;var _0x2004a1=_0xe666[_0x1a3cb9];return _0x2004a1;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x6e66('0x0'));var jsonpatch=require(_0x6e66('0x1'));var rp=require(_0x6e66('0x2'));var moment=require('moment');var BPromise=require(_0x6e66('0x3'));var Mustache=require('mustache');var util=require(_0x6e66('0x4'));var path=require(_0x6e66('0x5'));var sox=require(_0x6e66('0x6'));var csv=require(_0x6e66('0x7'));var ejs=require(_0x6e66('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6e66('0x9'));var squel=require(_0x6e66('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x6e66('0xb'));var toCsv=require(_0x6e66('0x7'));var querystring=require('querystring');var Papa=require(_0x6e66('0xc'));var Redis=require('ioredis');var authService=require(_0x6e66('0xd'));var qs=require(_0x6e66('0xe'));var as=require(_0x6e66('0xf'));var hardwareService=require(_0x6e66('0x10'));var logger=require(_0x6e66('0x11'))('api');var utils=require(_0x6e66('0x12'));var config=require(_0x6e66('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x6e66('0x14'))['db'];config['redis']=_['defaults'](config[_0x6e66('0x15')],{'host':_0x6e66('0x16'),'port':0x18eb});var socket=require(_0x6e66('0x17'))(new Redis(config[_0x6e66('0x15')]));require(_0x6e66('0x18'))[_0x6e66('0x19')](socket);function respondWithStatusCode(_0x5deae7,_0x129abe){_0x129abe=_0x129abe||0xcc;return function(_0x4227a9){if(_0x4227a9){return _0x5deae7['sendStatus'](_0x129abe);}return _0x5deae7[_0x6e66('0x1a')](_0x129abe)[_0x6e66('0x1b')]();};}function respondWithResult(_0xc96f27,_0x10a28b){_0x10a28b=_0x10a28b||0xc8;return function(_0x55bae8){if(_0x55bae8){return _0xc96f27[_0x6e66('0x1a')](_0x10a28b)[_0x6e66('0x1c')](_0x55bae8);}};}function respondWithFilteredResult(_0x1650f1,_0x2cb11c){return function(_0x579097){if(_0x579097){var _0x3194ae=typeof _0x2cb11c['offset']==='undefined'&&typeof _0x2cb11c[_0x6e66('0x1d')]===_0x6e66('0x1e');var _0x173784=_0x579097[_0x6e66('0x1f')];var _0x212c00=_0x3194ae?0x0:_0x2cb11c[_0x6e66('0x20')];var _0x502e63=_0x3194ae?_0x579097[_0x6e66('0x1f')]:_0x2cb11c[_0x6e66('0x20')]+_0x2cb11c[_0x6e66('0x1d')];var _0x34f0a6;if(_0x502e63>=_0x173784){_0x502e63=_0x173784;_0x34f0a6=0xc8;}else{_0x34f0a6=0xce;}_0x1650f1[_0x6e66('0x1a')](_0x34f0a6);return _0x1650f1['set'](_0x6e66('0x21'),_0x212c00+'-'+_0x502e63+'/'+_0x173784)[_0x6e66('0x1c')](_0x579097);}return null;};}function patchUpdates(_0x4330e7){return function(_0x5ea2ff){try{jsonpatch[_0x6e66('0x22')](_0x5ea2ff,_0x4330e7,!![]);}catch(_0x1c3b69){return BPromise['reject'](_0x1c3b69);}return _0x5ea2ff[_0x6e66('0x23')]();};}function saveUpdates(_0x5842a8,_0x85685f){return function(_0x14a96f){if(_0x14a96f){return _0x14a96f[_0x6e66('0x24')](_0x5842a8)[_0x6e66('0x25')](function(_0x4d1e23){return _0x4d1e23;});}return null;};}function removeEntity(_0x498f67,_0x3665d7){return function(_0x1575b5){if(_0x1575b5){return _0x1575b5[_0x6e66('0x26')]()[_0x6e66('0x25')](function(){_0x498f67[_0x6e66('0x1a')](0xcc)[_0x6e66('0x1b')]();});}};}function handleEntityNotFound(_0x235a98,_0x163110){return function(_0x3cc84e){if(!_0x3cc84e){_0x235a98['sendStatus'](0x194);}return _0x3cc84e;};}function handleError(_0xa57b32,_0x4a0e4c){_0x4a0e4c=_0x4a0e4c||0x1f4;return function(_0x171840){logger[_0x6e66('0x27')](_0x171840[_0x6e66('0x28')]);if(_0x171840[_0x6e66('0x29')]){delete _0x171840[_0x6e66('0x29')];}_0xa57b32[_0x6e66('0x1a')](_0x4a0e4c)[_0x6e66('0x2a')](_0x171840);};}exports['index']=function(_0x14d593,_0x250d44){var _0x409783={},_0x400329={},_0x583c5f={'count':0x0,'rows':[]};var _0x280b06=_[_0x6e66('0x2b')](db[_0x6e66('0x2c')][_0x6e66('0x2d')],function(_0x183646){return{'name':_0x183646[_0x6e66('0x2e')],'type':_0x183646['type'][_0x6e66('0x2f')]};});_0x400329[_0x6e66('0x30')]=_[_0x6e66('0x2b')](_0x280b06,_0x6e66('0x29'));_0x400329[_0x6e66('0x31')]=_[_0x6e66('0x32')](_0x14d593[_0x6e66('0x31')]);_0x400329[_0x6e66('0x33')]=_[_0x6e66('0x34')](_0x400329[_0x6e66('0x30')],_0x400329[_0x6e66('0x31')]);_0x409783[_0x6e66('0x35')]=_[_0x6e66('0x34')](_0x400329['model'],qs[_0x6e66('0x36')](_0x14d593[_0x6e66('0x31')]['fields']));_0x409783[_0x6e66('0x35')]=_0x409783[_0x6e66('0x35')][_0x6e66('0x37')]?_0x409783[_0x6e66('0x35')]:_0x400329[_0x6e66('0x30')];if(!_0x14d593[_0x6e66('0x31')][_0x6e66('0x38')](_0x6e66('0x39'))){_0x409783[_0x6e66('0x1d')]=qs[_0x6e66('0x1d')](_0x14d593[_0x6e66('0x31')]['limit']);_0x409783['offset']=qs[_0x6e66('0x20')](_0x14d593['query']['offset']);}_0x409783['order']=qs[_0x6e66('0x3a')](_0x14d593[_0x6e66('0x31')]['sort']);_0x409783[_0x6e66('0x3b')]=qs[_0x6e66('0x33')](_[_0x6e66('0x3c')](_0x14d593['query'],_0x400329['filters']),_0x280b06);if(_0x14d593[_0x6e66('0x31')][_0x6e66('0x3d')]){_0x409783['where']=_[_0x6e66('0x3e')](_0x409783[_0x6e66('0x3b')],{'$or':_[_0x6e66('0x2b')](_0x280b06,function(_0x1efe38){if(_0x1efe38['type']!==_0x6e66('0x3f')){var _0x33356b={};_0x33356b[_0x1efe38[_0x6e66('0x29')]]={'$like':'%'+_0x14d593[_0x6e66('0x31')][_0x6e66('0x3d')]+'%'};return _0x33356b;}})});}_0x409783=_[_0x6e66('0x3e')]({},_0x409783,_0x14d593[_0x6e66('0x40')]);var _0x506f97={'where':_0x409783[_0x6e66('0x3b')]};return db[_0x6e66('0x2c')]['count'](_0x506f97)[_0x6e66('0x25')](function(_0x368f13){_0x583c5f[_0x6e66('0x1f')]=_0x368f13;if(_0x14d593[_0x6e66('0x31')][_0x6e66('0x41')]){_0x409783[_0x6e66('0x42')]=[{'all':!![]}];}return db['VoiceQueueReport'][_0x6e66('0x43')](_0x409783);})[_0x6e66('0x25')](function(_0xc4ebfc){_0x583c5f[_0x6e66('0x44')]=_0xc4ebfc;return _0x583c5f;})[_0x6e66('0x25')](respondWithFilteredResult(_0x250d44,_0x409783))[_0x6e66('0x45')](handleError(_0x250d44,null));};exports[_0x6e66('0x46')]=function(_0x47472d,_0x55d122){var _0x5b95ce={'raw':![],'where':{'id':_0x47472d['params']['id']}},_0x515d2a={};_0x515d2a[_0x6e66('0x30')]=_[_0x6e66('0x32')](db['VoiceQueueReport'][_0x6e66('0x2d')]);_0x515d2a['query']=_[_0x6e66('0x32')](_0x47472d[_0x6e66('0x31')]);_0x515d2a[_0x6e66('0x33')]=_[_0x6e66('0x34')](_0x515d2a[_0x6e66('0x30')],_0x515d2a['query']);_0x5b95ce[_0x6e66('0x35')]=_[_0x6e66('0x34')](_0x515d2a[_0x6e66('0x30')],qs[_0x6e66('0x36')](_0x47472d[_0x6e66('0x31')]['fields']));_0x5b95ce[_0x6e66('0x35')]=_0x5b95ce[_0x6e66('0x35')][_0x6e66('0x37')]?_0x5b95ce[_0x6e66('0x35')]:_0x515d2a[_0x6e66('0x30')];if(_0x47472d['query'][_0x6e66('0x41')]){_0x5b95ce[_0x6e66('0x42')]=[{'all':!![]}];}_0x5b95ce=_['merge']({},_0x5b95ce,_0x47472d['options']);return db[_0x6e66('0x2c')][_0x6e66('0x47')](_0x5b95ce)[_0x6e66('0x25')](handleEntityNotFound(_0x55d122,null))[_0x6e66('0x25')](respondWithResult(_0x55d122,null))[_0x6e66('0x45')](handleError(_0x55d122,null));};exports[_0x6e66('0x48')]=function(_0x45b87b,_0x3bfd4a){return db[_0x6e66('0x2c')][_0x6e66('0x48')](_0x45b87b['body'],{})[_0x6e66('0x25')](respondWithResult(_0x3bfd4a,0xc9))['catch'](handleError(_0x3bfd4a,null));};exports[_0x6e66('0x24')]=function(_0x49288f,_0x2c80cc){if(_0x49288f[_0x6e66('0x49')]['id']){delete _0x49288f[_0x6e66('0x49')]['id'];}return db[_0x6e66('0x2c')]['find']({'where':{'id':_0x49288f[_0x6e66('0x4a')]['id']}})[_0x6e66('0x25')](handleEntityNotFound(_0x2c80cc,null))[_0x6e66('0x25')](saveUpdates(_0x49288f[_0x6e66('0x49')],null))[_0x6e66('0x25')](respondWithResult(_0x2c80cc,null))[_0x6e66('0x45')](handleError(_0x2c80cc,null));};exports[_0x6e66('0x26')]=function(_0x539281,_0x3adfe8){return db['VoiceQueueReport'][_0x6e66('0x47')]({'where':{'id':_0x539281[_0x6e66('0x4a')]['id']}})[_0x6e66('0x25')](handleEntityNotFound(_0x3adfe8,null))['then'](removeEntity(_0x3adfe8,null))[_0x6e66('0x45')](handleError(_0x3adfe8,null));};exports[_0x6e66('0x4b')]=function(_0x215c26,_0x529442){return db[_0x6e66('0x2c')]['describe']()[_0x6e66('0x25')](respondWithResult(_0x529442,null))[_0x6e66('0x45')](handleError(_0x529442,null));};exports[_0x6e66('0x4c')]=function(_0x2c0b51,_0x188924){var _0x4b7df3={},_0x2bd139={},_0x48dc42={'count':0x0,'rows':[]};_0x2bd139[_0x6e66('0x30')]=_['keys'](db['VoiceQueueReport'][_0x6e66('0x2d')]);_0x2bd139['query']=_['keys'](_0x2c0b51['query']);_0x2bd139[_0x6e66('0x33')]=_[_0x6e66('0x34')](_0x2bd139[_0x6e66('0x30')],_0x2bd139['query']);_0x4b7df3[_0x6e66('0x35')]=_[_0x6e66('0x34')](_0x2bd139[_0x6e66('0x30')],qs['fields'](_0x2c0b51[_0x6e66('0x31')][_0x6e66('0x36')]));_0x4b7df3[_0x6e66('0x35')]=_0x4b7df3[_0x6e66('0x35')][_0x6e66('0x37')]?_0x4b7df3[_0x6e66('0x35')]:_0x2bd139['model'];if(!_0x2c0b51[_0x6e66('0x31')][_0x6e66('0x38')](_0x6e66('0x39'))){_0x4b7df3[_0x6e66('0x1d')]=qs[_0x6e66('0x1d')](_0x2c0b51['query'][_0x6e66('0x1d')]);_0x4b7df3['offset']=qs[_0x6e66('0x20')](_0x2c0b51['query']['offset']);}_0x4b7df3[_0x6e66('0x4d')]=qs[_0x6e66('0x3a')](_0x2c0b51['query']['sort']);_0x4b7df3[_0x6e66('0x3b')]=qs[_0x6e66('0x33')](_['pick'](_0x2c0b51[_0x6e66('0x31')],_0x2bd139[_0x6e66('0x33')]));if(_0x2c0b51['query']['filter']){_0x4b7df3[_0x6e66('0x3b')]=_[_0x6e66('0x3e')](_0x4b7df3[_0x6e66('0x3b')],{'$or':_['map'](_0x4b7df3[_0x6e66('0x35')],function(_0x2517c3){var _0x6ee0e={};_0x6ee0e[_0x2517c3]={'$like':'%'+_0x2c0b51[_0x6e66('0x31')]['filter']+'%'};return _0x6ee0e;})});}_0x4b7df3=_[_0x6e66('0x3e')]({},_0x4b7df3,_0x2c0b51[_0x6e66('0x40')]);var _0x140f6a={'where':_0x4b7df3[_0x6e66('0x3b')]};return db[_0x6e66('0x2c')][_0x6e66('0x1f')](_0x140f6a)['then'](function(_0x11bc34){_0x48dc42[_0x6e66('0x1f')]=_0x11bc34;if(_0x2c0b51['query'][_0x6e66('0x41')]){_0x4b7df3[_0x6e66('0x42')]=[{'all':!![]}];}return db['VoiceQueueReport'][_0x6e66('0x43')](_0x4b7df3);})[_0x6e66('0x25')](function(_0xa0ac7c){_0x48dc42[_0x6e66('0x44')]=_0xa0ac7c;return _0x48dc42;})[_0x6e66('0x25')](respondWithFilteredResult(_0x188924,_0x4b7df3,_0x6e66('0x4c')))[_0x6e66('0x45')](handleError(_0x188924,null,_0x6e66('0x4c')));}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.events.js b/server/api/voiceQueueReport/voiceQueueReport.events.js index 9baf4da..29a7915 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 _0x2cc5=['../../mysqldb','setMaxListeners','save','update','remove','emit','hook','exports'];(function(_0x4f8a18,_0x4a5d74){var _0x4c5092=function(_0xec3d73){while(--_0xec3d73){_0x4f8a18['push'](_0x4f8a18['shift']());}};_0x4c5092(++_0x4a5d74);}(_0x2cc5,0x80));var _0x52cc=function(_0x2f823d,_0x2e39f6){_0x2f823d=_0x2f823d-0x0;var _0x2d5a59=_0x2cc5[_0x2f823d];return _0x2d5a59;};'use strict';var EventEmitter=require('events');var VoiceQueueReport=require(_0x52cc('0x0'))['db']['VoiceQueueReport'];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0x52cc('0x1')](0x0);var events={'afterCreate':_0x52cc('0x2'),'afterUpdate':_0x52cc('0x3'),'afterDestroy':_0x52cc('0x4')};function emitEvent(_0x494113){return function(_0x61c95f,_0x546322,_0x5b780b){VoiceQueueReportEvents[_0x52cc('0x5')](_0x494113+':'+_0x61c95f['id'],_0x61c95f);VoiceQueueReportEvents[_0x52cc('0x5')](_0x494113,_0x61c95f);_0x5b780b(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueueReport[_0x52cc('0x6')](e,emitEvent(event));}}module[_0x52cc('0x7')]=VoiceQueueReportEvents; \ No newline at end of file +var _0x49d2=['save','update','remove','emit','hook','exports','events','../../mysqldb','VoiceQueueReport','setMaxListeners'];(function(_0x29076f,_0x1f763e){var _0x41090c=function(_0x55f12b){while(--_0x55f12b){_0x29076f['push'](_0x29076f['shift']());}};_0x41090c(++_0x1f763e);}(_0x49d2,0x1e6));var _0x249d=function(_0x35d8af,_0x14fd75){_0x35d8af=_0x35d8af-0x0;var _0x1d08b0=_0x49d2[_0x35d8af];return _0x1d08b0;};'use strict';var EventEmitter=require(_0x249d('0x0'));var VoiceQueueReport=require(_0x249d('0x1'))['db'][_0x249d('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0x249d('0x3')](0x0);var events={'afterCreate':_0x249d('0x4'),'afterUpdate':_0x249d('0x5'),'afterDestroy':_0x249d('0x6')};function emitEvent(_0x41df2f){return function(_0x380034,_0x15627b,_0x32c62c){VoiceQueueReportEvents[_0x249d('0x7')](_0x41df2f+':'+_0x380034['id'],_0x380034);VoiceQueueReportEvents[_0x249d('0x7')](_0x41df2f,_0x380034);_0x32c62c(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueueReport[_0x249d('0x8')](e,emitEvent(event));}}module[_0x249d('0x9')]=VoiceQueueReportEvents; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.model.js b/server/api/voiceQueueReport/voiceQueueReport.model.js index a21a86e..88457fc 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 _0x64dc=['path','rimraf','../../config/environment','./voiceQueueReport.attributes','exports','define','VoiceQueueReport','report_queue','uniqueid','lodash','util','api','bluebird','request-promise'];(function(_0x25390b,_0x1771ca){var _0x490180=function(_0x54d40f){while(--_0x54d40f){_0x25390b['push'](_0x25390b['shift']());}};_0x490180(++_0x1771ca);}(_0x64dc,0x1d7));var _0xc64d=function(_0x37e368,_0x3b1ec9){_0x37e368=_0x37e368-0x0;var _0x43a1a3=_0x64dc[_0x37e368];return _0x43a1a3;};'use strict';var _=require(_0xc64d('0x0'));var util=require(_0xc64d('0x1'));var logger=require('../../config/logger')(_0xc64d('0x2'));var moment=require('moment');var BPromise=require(_0xc64d('0x3'));var rp=require(_0xc64d('0x4'));var fs=require('fs');var path=require(_0xc64d('0x5'));var rimraf=require(_0xc64d('0x6'));var config=require(_0xc64d('0x7'));var attributes=require(_0xc64d('0x8'));module[_0xc64d('0x9')]=function(_0x14d280,_0x5967bd){return _0x14d280[_0xc64d('0xa')](_0xc64d('0xb'),attributes,{'tableName':_0xc64d('0xc'),'paranoid':![],'indexes':[{'fields':[_0xc64d('0xd')]},{'fields':['calleridnum']}],'timestamps':!![]});}; \ No newline at end of file +var _0xb88b=['uniqueid','calleridnum','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./voiceQueueReport.attributes','VoiceQueueReport','report_queue'];(function(_0x4ddbd0,_0x4c7b11){var _0x260b32=function(_0x525f0d){while(--_0x525f0d){_0x4ddbd0['push'](_0x4ddbd0['shift']());}};_0x260b32(++_0x4c7b11);}(_0xb88b,0x1c2));var _0xbb88=function(_0x437462,_0x54ad8d){_0x437462=_0x437462-0x0;var _0xb5e19a=_0xb88b[_0x437462];return _0xb5e19a;};'use strict';var _=require(_0xbb88('0x0'));var util=require(_0xbb88('0x1'));var logger=require(_0xbb88('0x2'))(_0xbb88('0x3'));var moment=require(_0xbb88('0x4'));var BPromise=require('bluebird');var rp=require(_0xbb88('0x5'));var fs=require('fs');var path=require(_0xbb88('0x6'));var rimraf=require(_0xbb88('0x7'));var config=require(_0xbb88('0x8'));var attributes=require(_0xbb88('0x9'));module['exports']=function(_0x3da421,_0x41520c){return _0x3da421['define'](_0xbb88('0xa'),attributes,{'tableName':_0xbb88('0xb'),'paranoid':![],'indexes':[{'fields':[_0xbb88('0xc')]},{'fields':[_0xbb88('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.rpc.js b/server/api/voiceQueueReport/voiceQueueReport.rpc.js index 44d3d78..12a9d74 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 _0xa828=['../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','redis','defaults','socket.io-emitter','./voiceQueueReport.socket','register','request','info','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','GetVoiceQueueReport','VoiceQueueReport','findAll','options','raw','attributes','include','map','model','then','CreateVoiceQueueReport','create','body','stringify','UpdateVoiceQueueReport','update','where','lodash','bluebird','randomstring'];(function(_0x42bdad,_0x12836c){var _0x122626=function(_0x2eb29c){while(--_0x2eb29c){_0x42bdad['push'](_0x42bdad['shift']());}};_0x122626(++_0x12836c);}(_0xa828,0xa1));var _0x8a82=function(_0x3e255a,_0x18a2c3){_0x3e255a=_0x3e255a-0x0;var _0xf0f7d3=_0xa828[_0x3e255a];return _0xf0f7d3;};'use strict';var _=require(_0x8a82('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x8a82('0x1'));var rs=require(_0x8a82('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8a82('0x3'))['db'];var utils=require(_0x8a82('0x4'));var logger=require(_0x8a82('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x8a82('0x6'));var client=jayson[_0x8a82('0x7')]['http']({'port':0x232a});config[_0x8a82('0x8')]=_[_0x8a82('0x9')](config[_0x8a82('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0x8a82('0xa'))(new Redis(config[_0x8a82('0x8')]));require(_0x8a82('0xb'))[_0x8a82('0xc')](socket);function respondWithRpcPromise(_0x27fe9,_0x303001,_0x7bd625){return new BPromise(function(_0x9d9579,_0x3bb4c1){return client[_0x8a82('0xd')](_0x27fe9,_0x7bd625)['then'](function(_0x1f1f06){logger[_0x8a82('0xe')](_0x8a82('0xf'),_0x303001,_0x8a82('0x10'));logger[_0x8a82('0x11')](_0x8a82('0x12'),_0x303001,_0x8a82('0x10'),JSON['stringify'](_0x1f1f06));if(_0x1f1f06['error']){if(_0x1f1f06['error'][_0x8a82('0x13')]===0x1f4){logger[_0x8a82('0x14')](_0x8a82('0xf'),_0x303001,_0x1f1f06['error'][_0x8a82('0x15')]);return _0x3bb4c1(_0x1f1f06[_0x8a82('0x14')][_0x8a82('0x15')]);}logger['error'](_0x8a82('0xf'),_0x303001,_0x1f1f06[_0x8a82('0x14')][_0x8a82('0x15')]);return _0x9d9579(_0x1f1f06[_0x8a82('0x14')][_0x8a82('0x15')]);}else{logger[_0x8a82('0xe')](_0x8a82('0xf'),_0x303001,_0x8a82('0x10'));_0x9d9579(_0x1f1f06[_0x8a82('0x16')]['message']);}})[_0x8a82('0x17')](function(_0x42f620){logger[_0x8a82('0x14')](_0x8a82('0xf'),_0x303001,_0x42f620);_0x3bb4c1(_0x42f620);});});}exports[_0x8a82('0x18')]=function(_0x30545a){var _0xeaefe3=this;return new Promise(function(_0x156ca8,_0x531b0f){return db[_0x8a82('0x19')][_0x8a82('0x1a')]({'raw':_0x30545a[_0x8a82('0x1b')]?_0x30545a[_0x8a82('0x1b')][_0x8a82('0x1c')]===undefined?!![]:![]:!![],'where':_0x30545a[_0x8a82('0x1b')]?_0x30545a[_0x8a82('0x1b')]['where']||null:null,'attributes':_0x30545a[_0x8a82('0x1b')]?_0x30545a[_0x8a82('0x1b')][_0x8a82('0x1d')]||null:null,'limit':_0x30545a['options']?_0x30545a[_0x8a82('0x1b')]['limit']||null:null,'include':_0x30545a[_0x8a82('0x1b')]?_0x30545a[_0x8a82('0x1b')][_0x8a82('0x1e')]?_[_0x8a82('0x1f')](_0x30545a['options'][_0x8a82('0x1e')],function(_0xcbaaf5){return{'model':db[_0xcbaaf5[_0x8a82('0x20')]],'as':_0xcbaaf5['as'],'attributes':_0xcbaaf5[_0x8a82('0x1d')],'include':_0xcbaaf5['include']?_['map'](_0xcbaaf5[_0x8a82('0x1e')],function(_0x5f079e){return{'model':db[_0x5f079e['model']],'as':_0x5f079e['as'],'attributes':_0x5f079e[_0x8a82('0x1d')],'include':_0x5f079e[_0x8a82('0x1e')]?_[_0x8a82('0x1f')](_0x5f079e[_0x8a82('0x1e')],function(_0x2bfcb4){return{'model':db[_0x2bfcb4[_0x8a82('0x20')]],'as':_0x2bfcb4['as'],'attributes':_0x2bfcb4[_0x8a82('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x8a82('0x21')](function(_0x40ec83){logger[_0x8a82('0xe')](_0x8a82('0x18'),_0x30545a);logger[_0x8a82('0x11')](_0x8a82('0x18'),_0x30545a,JSON['stringify'](_0x40ec83));_0x156ca8(_0x40ec83);})['catch'](function(_0x81a651){logger['error'](_0x8a82('0x18'),_0x81a651[_0x8a82('0x15')],_0x30545a);_0x531b0f(_0xeaefe3[_0x8a82('0x14')](0x1f4,_0x81a651[_0x8a82('0x15')]));});});};exports[_0x8a82('0x22')]=function(_0x3339b0){var _0x1c5da7=this;return new Promise(function(_0x606092,_0x5e7c9c){return db[_0x8a82('0x19')][_0x8a82('0x23')](_0x3339b0[_0x8a82('0x24')],{'raw':_0x3339b0[_0x8a82('0x1b')]?_0x3339b0['options'][_0x8a82('0x1c')]===undefined?!![]:![]:!![]})[_0x8a82('0x21')](function(_0x979a06){logger[_0x8a82('0xe')]('CreateVoiceQueueReport',_0x3339b0);logger['debug']('CreateVoiceQueueReport',_0x3339b0,JSON[_0x8a82('0x25')](_0x979a06));_0x606092(_0x979a06);})[_0x8a82('0x17')](function(_0x367a64){logger[_0x8a82('0x14')](_0x8a82('0x22'),_0x367a64[_0x8a82('0x15')],_0x3339b0);_0x5e7c9c(_0x1c5da7[_0x8a82('0x14')](0x1f4,_0x367a64[_0x8a82('0x15')]));});});};exports[_0x8a82('0x26')]=function(_0x4d0131){var _0x1cf234=this;return new Promise(function(_0x516d5b,_0x3265bc){return db[_0x8a82('0x19')][_0x8a82('0x27')](_0x4d0131[_0x8a82('0x24')],{'raw':_0x4d0131[_0x8a82('0x1b')]?_0x4d0131[_0x8a82('0x1b')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4d0131[_0x8a82('0x1b')]?_0x4d0131[_0x8a82('0x1b')][_0x8a82('0x28')]||null:null,'attributes':_0x4d0131[_0x8a82('0x1b')]?_0x4d0131[_0x8a82('0x1b')][_0x8a82('0x1d')]||null:null,'limit':_0x4d0131[_0x8a82('0x1b')]?_0x4d0131[_0x8a82('0x1b')]['limit']||null:null})['then'](function(_0x2816d4){logger[_0x8a82('0xe')](_0x8a82('0x26'),_0x4d0131);logger[_0x8a82('0x11')](_0x8a82('0x26'),_0x4d0131,JSON['stringify'](_0x2816d4));_0x516d5b(_0x2816d4);})[_0x8a82('0x17')](function(_0x495fc4){logger['error'](_0x8a82('0x26'),_0x495fc4[_0x8a82('0x15')],_0x4d0131);_0x3265bc(_0x1cf234[_0x8a82('0x14')](0x1f4,_0x495fc4['message']));});});}; \ No newline at end of file +var _0x4d4c=['../../config/environment','jayson/promise','client','http','redis','socket.io-emitter','./voiceQueueReport.socket','register','request','then','info','request\x20sent','error','code','VoiceQueueReport,\x20%s,\x20%s','message','result','catch','GetVoiceQueueReport','VoiceQueueReport','options','raw','where','attributes','limit','map','include','model','debug','CreateVoiceQueueReport','body','stringify','UpdateVoiceQueueReport','update','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x4d4c,0x14f));var _0xc4d4=function(_0x1b51ea,_0x394fd9){_0x1b51ea=_0x1b51ea-0x0;var _0x18bbdc=_0x4d4c[_0x1b51ea];return _0x18bbdc;};'use strict';var _=require(_0xc4d4('0x0'));var util=require(_0xc4d4('0x1'));var moment=require(_0xc4d4('0x2'));var BPromise=require(_0xc4d4('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc4d4('0x4'));var db=require(_0xc4d4('0x5'))['db'];var utils=require(_0xc4d4('0x6'));var logger=require(_0xc4d4('0x7'))(_0xc4d4('0x8'));var config=require(_0xc4d4('0x9'));var jayson=require(_0xc4d4('0xa'));var client=jayson[_0xc4d4('0xb')][_0xc4d4('0xc')]({'port':0x232a});config[_0xc4d4('0xd')]=_['defaults'](config[_0xc4d4('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0xc4d4('0xe'))(new Redis(config[_0xc4d4('0xd')]));require(_0xc4d4('0xf'))[_0xc4d4('0x10')](socket);function respondWithRpcPromise(_0x58af05,_0xb4ac89,_0x35d09d){return new BPromise(function(_0x491b8b,_0x47a0fb){return client[_0xc4d4('0x11')](_0x58af05,_0x35d09d)[_0xc4d4('0x12')](function(_0x244605){logger[_0xc4d4('0x13')]('VoiceQueueReport,\x20%s,\x20%s',_0xb4ac89,'request\x20sent');logger['debug']('VoiceQueueReport,\x20%s,\x20%s,\x20%s',_0xb4ac89,_0xc4d4('0x14'),JSON['stringify'](_0x244605));if(_0x244605[_0xc4d4('0x15')]){if(_0x244605['error'][_0xc4d4('0x16')]===0x1f4){logger['error'](_0xc4d4('0x17'),_0xb4ac89,_0x244605[_0xc4d4('0x15')][_0xc4d4('0x18')]);return _0x47a0fb(_0x244605[_0xc4d4('0x15')]['message']);}logger[_0xc4d4('0x15')](_0xc4d4('0x17'),_0xb4ac89,_0x244605[_0xc4d4('0x15')]['message']);return _0x491b8b(_0x244605[_0xc4d4('0x15')][_0xc4d4('0x18')]);}else{logger[_0xc4d4('0x13')](_0xc4d4('0x17'),_0xb4ac89,_0xc4d4('0x14'));_0x491b8b(_0x244605[_0xc4d4('0x19')]['message']);}})[_0xc4d4('0x1a')](function(_0x57895d){logger[_0xc4d4('0x15')](_0xc4d4('0x17'),_0xb4ac89,_0x57895d);_0x47a0fb(_0x57895d);});});}exports[_0xc4d4('0x1b')]=function(_0x4b22d4){var _0x38e4fe=this;return new Promise(function(_0x15036c,_0x140af4){return db[_0xc4d4('0x1c')]['findAll']({'raw':_0x4b22d4[_0xc4d4('0x1d')]?_0x4b22d4['options'][_0xc4d4('0x1e')]===undefined?!![]:![]:!![],'where':_0x4b22d4[_0xc4d4('0x1d')]?_0x4b22d4['options'][_0xc4d4('0x1f')]||null:null,'attributes':_0x4b22d4[_0xc4d4('0x1d')]?_0x4b22d4['options'][_0xc4d4('0x20')]||null:null,'limit':_0x4b22d4[_0xc4d4('0x1d')]?_0x4b22d4[_0xc4d4('0x1d')][_0xc4d4('0x21')]||null:null,'include':_0x4b22d4[_0xc4d4('0x1d')]?_0x4b22d4[_0xc4d4('0x1d')]['include']?_[_0xc4d4('0x22')](_0x4b22d4[_0xc4d4('0x1d')][_0xc4d4('0x23')],function(_0x39bbb4){return{'model':db[_0x39bbb4[_0xc4d4('0x24')]],'as':_0x39bbb4['as'],'attributes':_0x39bbb4[_0xc4d4('0x20')],'include':_0x39bbb4[_0xc4d4('0x23')]?_[_0xc4d4('0x22')](_0x39bbb4[_0xc4d4('0x23')],function(_0x3ea7b0){return{'model':db[_0x3ea7b0[_0xc4d4('0x24')]],'as':_0x3ea7b0['as'],'attributes':_0x3ea7b0['attributes'],'include':_0x3ea7b0[_0xc4d4('0x23')]?_[_0xc4d4('0x22')](_0x3ea7b0[_0xc4d4('0x23')],function(_0x2e2d72){return{'model':db[_0x2e2d72[_0xc4d4('0x24')]],'as':_0x2e2d72['as'],'attributes':_0x2e2d72[_0xc4d4('0x20')]};}):[]};}):[]};}):[]:[]})[_0xc4d4('0x12')](function(_0x1d036c){logger['info']('GetVoiceQueueReport',_0x4b22d4);logger[_0xc4d4('0x25')](_0xc4d4('0x1b'),_0x4b22d4,JSON['stringify'](_0x1d036c));_0x15036c(_0x1d036c);})[_0xc4d4('0x1a')](function(_0x2847a8){logger[_0xc4d4('0x15')]('GetVoiceQueueReport',_0x2847a8[_0xc4d4('0x18')],_0x4b22d4);_0x140af4(_0x38e4fe['error'](0x1f4,_0x2847a8[_0xc4d4('0x18')]));});});};exports[_0xc4d4('0x26')]=function(_0x232c7a){var _0x32bd38=this;return new Promise(function(_0x51b2b1,_0x1f8cf4){return db[_0xc4d4('0x1c')]['create'](_0x232c7a[_0xc4d4('0x27')],{'raw':_0x232c7a[_0xc4d4('0x1d')]?_0x232c7a[_0xc4d4('0x1d')]['raw']===undefined?!![]:![]:!![]})[_0xc4d4('0x12')](function(_0x26e725){logger['info'](_0xc4d4('0x26'),_0x232c7a);logger['debug'](_0xc4d4('0x26'),_0x232c7a,JSON[_0xc4d4('0x28')](_0x26e725));_0x51b2b1(_0x26e725);})[_0xc4d4('0x1a')](function(_0x3eb121){logger[_0xc4d4('0x15')](_0xc4d4('0x26'),_0x3eb121['message'],_0x232c7a);_0x1f8cf4(_0x32bd38['error'](0x1f4,_0x3eb121['message']));});});};exports[_0xc4d4('0x29')]=function(_0x59ae80){var _0x39d05e=this;return new Promise(function(_0x4b10da,_0x321f86){return db[_0xc4d4('0x1c')][_0xc4d4('0x2a')](_0x59ae80[_0xc4d4('0x27')],{'raw':_0x59ae80[_0xc4d4('0x1d')]?_0x59ae80[_0xc4d4('0x1d')][_0xc4d4('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x59ae80[_0xc4d4('0x1d')]?_0x59ae80[_0xc4d4('0x1d')][_0xc4d4('0x1f')]||null:null,'attributes':_0x59ae80[_0xc4d4('0x1d')]?_0x59ae80[_0xc4d4('0x1d')][_0xc4d4('0x20')]||null:null,'limit':_0x59ae80[_0xc4d4('0x1d')]?_0x59ae80['options'][_0xc4d4('0x21')]||null:null})[_0xc4d4('0x12')](function(_0x23c7da){logger[_0xc4d4('0x13')](_0xc4d4('0x29'),_0x59ae80);logger[_0xc4d4('0x25')](_0xc4d4('0x29'),_0x59ae80,JSON[_0xc4d4('0x28')](_0x23c7da));_0x4b10da(_0x23c7da);})[_0xc4d4('0x1a')](function(_0x4369a8){logger[_0xc4d4('0x15')](_0xc4d4('0x29'),_0x4369a8[_0xc4d4('0x18')],_0x59ae80);_0x321f86(_0x39d05e['error'](0x1f4,_0x4369a8[_0xc4d4('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index b4df861..fb3320b 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 _0x3937=['register','length','./voiceQueueReport.events','remove','update','emit','removeListener'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x3937,0xbf));var _0x7393=function(_0x31a171,_0x1bf70f){_0x31a171=_0x31a171-0x0;var _0x21f35e=_0x3937[_0x31a171];return _0x21f35e;};'use strict';var VoiceQueueReportEvents=require(_0x7393('0x0'));var events=['save',_0x7393('0x1'),_0x7393('0x2')];function createListener(_0x49aa96,_0x45cd02){return function(_0x503841){_0x45cd02[_0x7393('0x3')](_0x49aa96,_0x503841);};}function removeListener(_0x4c9c71,_0x992b15){return function(){VoiceQueueReportEvents[_0x7393('0x4')](_0x4c9c71,_0x992b15);};}exports[_0x7393('0x5')]=function(_0x1f538f){for(var _0x15eabd=0x0,_0x42bdd1=events[_0x7393('0x6')];_0x15eabd<_0x42bdd1;_0x15eabd++){var _0x26668a=events[_0x15eabd];var _0x944b0b=createListener('voiceQueueReport:'+_0x26668a,_0x1f538f);VoiceQueueReportEvents['on'](_0x26668a,_0x944b0b);}}; \ No newline at end of file +var _0x6ec9=['./voiceQueueReport.events','remove','register','voiceQueueReport:'];(function(_0x4ff1f9,_0x3963b8){var _0x4393f7=function(_0x583d86){while(--_0x583d86){_0x4ff1f9['push'](_0x4ff1f9['shift']());}};_0x4393f7(++_0x3963b8);}(_0x6ec9,0x174));var _0x96ec=function(_0x2be44a,_0x788a2f){_0x2be44a=_0x2be44a-0x0;var _0x52b27f=_0x6ec9[_0x2be44a];return _0x52b27f;};'use strict';var VoiceQueueReportEvents=require(_0x96ec('0x0'));var events=['save',_0x96ec('0x1'),'update'];function createListener(_0x37c970,_0x4e91e7){return function(_0x15e89a){_0x4e91e7['emit'](_0x37c970,_0x15e89a);};}function removeListener(_0x112569,_0x286bd7){return function(){VoiceQueueReportEvents['removeListener'](_0x112569,_0x286bd7);};}exports[_0x96ec('0x2')]=function(_0x41a215){for(var _0x2fcbb7=0x0,_0x5bc079=events['length'];_0x2fcbb7<_0x5bc079;_0x2fcbb7++){var _0x5ee7a3=events[_0x2fcbb7];var _0x8214b2=createListener(_0x96ec('0x3')+_0x5ee7a3,_0x41a215);VoiceQueueReportEvents['on'](_0x5ee7a3,_0x8214b2);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index 1584461..ba52d12 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 _0x62ee=['isAuthenticated','show','post','create','/:id','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','./voiceQueuesLog.controller','get','index'];(function(_0xeeaea0,_0x26add7){var _0xc42514=function(_0x26bff9){while(--_0x26bff9){_0xeeaea0['push'](_0xeeaea0['shift']());}};_0xc42514(++_0x26add7);}(_0x62ee,0x13a));var _0xe62e=function(_0x43a493,_0x5e38e9){_0x43a493=_0x43a493-0x0;var _0x296719=_0x62ee[_0x43a493];return _0x296719;};'use strict';var multer=require(_0xe62e('0x0'));var util=require(_0xe62e('0x1'));var path=require(_0xe62e('0x2'));var timeout=require(_0xe62e('0x3'));var express=require('express');var router=express[_0xe62e('0x4')]();var fs_extra=require(_0xe62e('0x5'));var auth=require(_0xe62e('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xe62e('0x7'));router[_0xe62e('0x8')]('/',auth['isAuthenticated'](),controller[_0xe62e('0x9')]);router[_0xe62e('0x8')]('/:id',auth[_0xe62e('0xa')](),controller[_0xe62e('0xb')]);router[_0xe62e('0xc')]('/',auth[_0xe62e('0xa')](),controller[_0xe62e('0xd')]);router['put'](_0xe62e('0xe'),auth['isAuthenticated'](),controller['update']);router[_0xe62e('0xf')](_0xe62e('0xe'),auth[_0xe62e('0xa')](),controller[_0xe62e('0x10')]);module[_0xe62e('0x11')]=router; \ No newline at end of file +var _0x0e37=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueuesLog.controller','isAuthenticated','post','create','put','/:id','update','delete','exports','util','connect-timeout','express'];(function(_0x584291,_0x34e012){var _0x289305=function(_0x5d9b12){while(--_0x5d9b12){_0x584291['push'](_0x584291['shift']());}};_0x289305(++_0x34e012);}(_0x0e37,0xc9));var _0x70e3=function(_0x2e7517,_0x95b591){_0x2e7517=_0x2e7517-0x0;var _0x42f135=_0x0e37[_0x2e7517];return _0x42f135;};'use strict';var multer=require('multer');var util=require(_0x70e3('0x0'));var path=require('path');var timeout=require(_0x70e3('0x1'));var express=require(_0x70e3('0x2'));var router=express[_0x70e3('0x3')]();var fs_extra=require(_0x70e3('0x4'));var auth=require(_0x70e3('0x5'));var interaction=require(_0x70e3('0x6'));var config=require(_0x70e3('0x7'));var controller=require(_0x70e3('0x8'));router['get']('/',auth[_0x70e3('0x9')](),controller['index']);router['get']('/:id',auth['isAuthenticated'](),controller['show']);router[_0x70e3('0xa')]('/',auth['isAuthenticated'](),controller[_0x70e3('0xb')]);router[_0x70e3('0xc')](_0x70e3('0xd'),auth[_0x70e3('0x9')](),controller[_0x70e3('0xe')]);router[_0x70e3('0xf')](_0x70e3('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0x70e3('0x10')]=router; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js b/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js index c9c1c0c..3dd7980 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 _0x6e6b=['CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','moment','STRING','DATE'];(function(_0x274e82,_0x2b3e01){var _0x361183=function(_0x419b3c){while(--_0x419b3c){_0x274e82['push'](_0x274e82['shift']());}};_0x361183(++_0x2b3e01);}(_0x6e6b,0x131));var _0xb6e6=function(_0x1655b9,_0xaa1be5){_0x1655b9=_0x1655b9-0x0;var _0x51988d=_0x6e6b[_0x1655b9];return _0x51988d;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xb6e6('0x0'));module['exports']={'time':{'type':Sequelize['STRING']},'callid':{'type':Sequelize[_0xb6e6('0x1')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0xb6e6('0x1')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0xb6e6('0x1')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0xb6e6('0x1')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0xb6e6('0x1')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0xb6e6('0x1')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0xb6e6('0x1')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0xb6e6('0x1')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0xb6e6('0x2')],'allowNull':![],'defaultValue':Sequelize['literal'](_0xb6e6('0x3'))}}; \ No newline at end of file +var _0x5c54=['STRING','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','moment','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5c54,0x1b1));var _0x45c5=function(_0x9c5524,_0x2912b9){_0x9c5524=_0x9c5524-0x0;var _0x25f8a7=_0x5c54[_0x9c5524];return _0x25f8a7;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x45c5('0x0'));module[_0x45c5('0x1')]={'time':{'type':Sequelize['STRING']},'callid':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x45c5('0x2')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x45c5('0x2')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0x45c5('0x2')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x45c5('0x2')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x45c5('0x2')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x45c5('0x2')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x45c5('0x2')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0x45c5('0x2')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x45c5('0x3')](_0x45c5('0x4'))}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index f24cc2f..8c29a44 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 _0xdd83=['to-csv','jsforce','querystring','papaparse','../../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','Content-Range','apply','reject','save','then','error','stack','name','send','map','VoiceQueuesLog','rawAttributes','fieldName','model','query','keys','intersection','fields','attributes','nolimit','sort','filters','filter','where','type','VIRTUAL','merge','options','includeAll','include','rows','length','find','catch','create','body','params','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox'];(function(_0x4816df,_0x49a7fa){var _0x4cc86b=function(_0x622b41){while(--_0x622b41){_0x4816df['push'](_0x4816df['shift']());}};_0x4cc86b(++_0x49a7fa);}(_0xdd83,0xc4));var _0x3dd8=function(_0x82129b,_0x484ae9){_0x82129b=_0x82129b-0x0;var _0x2ae5dc=_0xdd83[_0x82129b];return _0x2ae5dc;};'use strict';var emlformat=require(_0x3dd8('0x0'));var rimraf=require(_0x3dd8('0x1'));var zipdir=require(_0x3dd8('0x2'));var jsonpatch=require(_0x3dd8('0x3'));var rp=require(_0x3dd8('0x4'));var moment=require(_0x3dd8('0x5'));var BPromise=require(_0x3dd8('0x6'));var Mustache=require(_0x3dd8('0x7'));var util=require(_0x3dd8('0x8'));var path=require(_0x3dd8('0x9'));var sox=require(_0x3dd8('0xa'));var csv=require(_0x3dd8('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x3dd8('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x3dd8('0xb'));var querystring=require(_0x3dd8('0xd'));var Papa=require(_0x3dd8('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x3dd8('0xf'));var as=require(_0x3dd8('0x10'));var hardwareService=require(_0x3dd8('0x11'));var logger=require(_0x3dd8('0x12'))('api');var utils=require(_0x3dd8('0x13'));var config=require(_0x3dd8('0x14'));var licenseUtil=require(_0x3dd8('0x15'));var db=require(_0x3dd8('0x16'))['db'];function respondWithStatusCode(_0x4390a5,_0x4d460c){_0x4d460c=_0x4d460c||0xcc;return function(_0x23361b){if(_0x23361b){return _0x4390a5[_0x3dd8('0x17')](_0x4d460c);}return _0x4390a5[_0x3dd8('0x18')](_0x4d460c)[_0x3dd8('0x19')]();};}function respondWithResult(_0x373516,_0x57044c){_0x57044c=_0x57044c||0xc8;return function(_0x445d00){if(_0x445d00){return _0x373516[_0x3dd8('0x18')](_0x57044c)[_0x3dd8('0x1a')](_0x445d00);}};}function respondWithFilteredResult(_0x390d8e,_0x56af76){return function(_0x5a70e4){if(_0x5a70e4){var _0x266d11=typeof _0x56af76[_0x3dd8('0x1b')]==='undefined'&&typeof _0x56af76['limit']===_0x3dd8('0x1c');var _0xd107e9=_0x5a70e4[_0x3dd8('0x1d')];var _0x1c427b=_0x266d11?0x0:_0x56af76[_0x3dd8('0x1b')];var _0x481b0e=_0x266d11?_0x5a70e4[_0x3dd8('0x1d')]:_0x56af76[_0x3dd8('0x1b')]+_0x56af76[_0x3dd8('0x1e')];var _0xd5013a;if(_0x481b0e>=_0xd107e9){_0x481b0e=_0xd107e9;_0xd5013a=0xc8;}else{_0xd5013a=0xce;}_0x390d8e[_0x3dd8('0x18')](_0xd5013a);return _0x390d8e['set'](_0x3dd8('0x1f'),_0x1c427b+'-'+_0x481b0e+'/'+_0xd107e9)[_0x3dd8('0x1a')](_0x5a70e4);}return null;};}function patchUpdates(_0x12a130){return function(_0x1b9186){try{jsonpatch[_0x3dd8('0x20')](_0x1b9186,_0x12a130,!![]);}catch(_0xc185a0){return BPromise[_0x3dd8('0x21')](_0xc185a0);}return _0x1b9186[_0x3dd8('0x22')]();};}function saveUpdates(_0x581c6a,_0x1f2cf9){return function(_0x3788a9){if(_0x3788a9){return _0x3788a9['update'](_0x581c6a)[_0x3dd8('0x23')](function(_0x44aa30){return _0x44aa30;});}return null;};}function removeEntity(_0xc264e8,_0x1584a1){return function(_0xa54c6){if(_0xa54c6){return _0xa54c6['destroy']()[_0x3dd8('0x23')](function(){_0xc264e8[_0x3dd8('0x18')](0xcc)[_0x3dd8('0x19')]();});}};}function handleEntityNotFound(_0x178c10,_0x52114f){return function(_0x1602e5){if(!_0x1602e5){_0x178c10['sendStatus'](0x194);}return _0x1602e5;};}function handleError(_0xc961cc,_0xc5c57c){_0xc5c57c=_0xc5c57c||0x1f4;return function(_0x587525){logger[_0x3dd8('0x24')](_0x587525[_0x3dd8('0x25')]);if(_0x587525[_0x3dd8('0x26')]){delete _0x587525[_0x3dd8('0x26')];}_0xc961cc[_0x3dd8('0x18')](_0xc5c57c)[_0x3dd8('0x27')](_0x587525);};}exports['index']=function(_0x433920,_0x16e9ac){var _0xdf2643={},_0x522396={},_0x30db0c={'count':0x0,'rows':[]};var _0x56f652=_[_0x3dd8('0x28')](db[_0x3dd8('0x29')][_0x3dd8('0x2a')],function(_0x56614b){return{'name':_0x56614b[_0x3dd8('0x2b')],'type':_0x56614b['type']['key']};});_0x522396[_0x3dd8('0x2c')]=_[_0x3dd8('0x28')](_0x56f652,_0x3dd8('0x26'));_0x522396[_0x3dd8('0x2d')]=_[_0x3dd8('0x2e')](_0x433920['query']);_0x522396['filters']=_[_0x3dd8('0x2f')](_0x522396[_0x3dd8('0x2c')],_0x522396[_0x3dd8('0x2d')]);_0xdf2643['attributes']=_[_0x3dd8('0x2f')](_0x522396[_0x3dd8('0x2c')],qs[_0x3dd8('0x30')](_0x433920['query']['fields']));_0xdf2643[_0x3dd8('0x31')]=_0xdf2643['attributes']['length']?_0xdf2643[_0x3dd8('0x31')]:_0x522396[_0x3dd8('0x2c')];if(!_0x433920['query']['hasOwnProperty'](_0x3dd8('0x32'))){_0xdf2643[_0x3dd8('0x1e')]=qs[_0x3dd8('0x1e')](_0x433920[_0x3dd8('0x2d')][_0x3dd8('0x1e')]);_0xdf2643[_0x3dd8('0x1b')]=qs['offset'](_0x433920[_0x3dd8('0x2d')][_0x3dd8('0x1b')]);}_0xdf2643['order']=qs[_0x3dd8('0x33')](_0x433920[_0x3dd8('0x2d')][_0x3dd8('0x33')]);_0xdf2643['where']=qs[_0x3dd8('0x34')](_['pick'](_0x433920[_0x3dd8('0x2d')],_0x522396[_0x3dd8('0x34')]),_0x56f652);if(_0x433920['query'][_0x3dd8('0x35')]){_0xdf2643[_0x3dd8('0x36')]=_['merge'](_0xdf2643[_0x3dd8('0x36')],{'$or':_['map'](_0x56f652,function(_0x381e44){if(_0x381e44[_0x3dd8('0x37')]!==_0x3dd8('0x38')){var _0x3de15b={};_0x3de15b[_0x381e44[_0x3dd8('0x26')]]={'$like':'%'+_0x433920['query'][_0x3dd8('0x35')]+'%'};return _0x3de15b;}})});}_0xdf2643=_[_0x3dd8('0x39')]({},_0xdf2643,_0x433920[_0x3dd8('0x3a')]);var _0x206680={'where':_0xdf2643[_0x3dd8('0x36')]};return db[_0x3dd8('0x29')][_0x3dd8('0x1d')](_0x206680)['then'](function(_0x1bb4c5){_0x30db0c['count']=_0x1bb4c5;if(_0x433920['query'][_0x3dd8('0x3b')]){_0xdf2643[_0x3dd8('0x3c')]=[{'all':!![]}];}return db[_0x3dd8('0x29')]['findAll'](_0xdf2643);})[_0x3dd8('0x23')](function(_0x10ad48){_0x30db0c[_0x3dd8('0x3d')]=_0x10ad48;return _0x30db0c;})[_0x3dd8('0x23')](respondWithFilteredResult(_0x16e9ac,_0xdf2643))['catch'](handleError(_0x16e9ac,null));};exports['show']=function(_0x2e2d8b,_0x322739){var _0x162dcb={'raw':!![],'where':{'id':_0x2e2d8b['params']['id']}},_0x23a189={};_0x23a189['model']=_[_0x3dd8('0x2e')](db[_0x3dd8('0x29')][_0x3dd8('0x2a')]);_0x23a189['query']=_[_0x3dd8('0x2e')](_0x2e2d8b[_0x3dd8('0x2d')]);_0x23a189[_0x3dd8('0x34')]=_['intersection'](_0x23a189[_0x3dd8('0x2c')],_0x23a189['query']);_0x162dcb[_0x3dd8('0x31')]=_[_0x3dd8('0x2f')](_0x23a189[_0x3dd8('0x2c')],qs[_0x3dd8('0x30')](_0x2e2d8b[_0x3dd8('0x2d')]['fields']));_0x162dcb[_0x3dd8('0x31')]=_0x162dcb[_0x3dd8('0x31')][_0x3dd8('0x3e')]?_0x162dcb['attributes']:_0x23a189[_0x3dd8('0x2c')];if(_0x2e2d8b[_0x3dd8('0x2d')][_0x3dd8('0x3b')]){_0x162dcb['include']=[{'all':!![]}];}_0x162dcb=_[_0x3dd8('0x39')]({},_0x162dcb,_0x2e2d8b['options']);return db['VoiceQueuesLog'][_0x3dd8('0x3f')](_0x162dcb)[_0x3dd8('0x23')](handleEntityNotFound(_0x322739,null))[_0x3dd8('0x23')](respondWithResult(_0x322739,null))[_0x3dd8('0x40')](handleError(_0x322739,null));};exports[_0x3dd8('0x41')]=function(_0xfd0f35,_0x5e3625){return db['VoiceQueuesLog'][_0x3dd8('0x41')](_0xfd0f35[_0x3dd8('0x42')],{})[_0x3dd8('0x23')](respondWithResult(_0x5e3625,0xc9))[_0x3dd8('0x40')](handleError(_0x5e3625,null));};exports['update']=function(_0x1c96d2,_0x28bf2d){if(_0x1c96d2['body']['id']){delete _0x1c96d2['body']['id'];}return db[_0x3dd8('0x29')][_0x3dd8('0x3f')]({'where':{'id':_0x1c96d2[_0x3dd8('0x43')]['id']}})['then'](handleEntityNotFound(_0x28bf2d,null))[_0x3dd8('0x23')](saveUpdates(_0x1c96d2[_0x3dd8('0x42')],null))[_0x3dd8('0x23')](respondWithResult(_0x28bf2d,null))[_0x3dd8('0x40')](handleError(_0x28bf2d,null));};exports[_0x3dd8('0x44')]=function(_0x514af6,_0x37bdfa){return db[_0x3dd8('0x29')][_0x3dd8('0x3f')]({'where':{'id':_0x514af6[_0x3dd8('0x43')]['id']}})[_0x3dd8('0x23')](handleEntityNotFound(_0x37bdfa,null))[_0x3dd8('0x23')](removeEntity(_0x37bdfa,null))['catch'](handleError(_0x37bdfa,null));}; \ No newline at end of file +var _0x4d73=['keys','query','filters','intersection','attributes','fields','length','nolimit','order','where','pick','filter','merge','options','VoiceQueuesLog','includeAll','include','findAll','catch','show','params','find','create','body','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','status','send','map','rawAttributes','fieldName','type','key','model'];(function(_0x51020b,_0x38c2c7){var _0x371e47=function(_0x2a538f){while(--_0x2a538f){_0x51020b['push'](_0x51020b['shift']());}};_0x371e47(++_0x38c2c7);}(_0x4d73,0x148));var _0x34d7=function(_0x228344,_0x4bbf3d){_0x228344=_0x228344-0x0;var _0x23df35=_0x4d73[_0x228344];return _0x23df35;};'use strict';var emlformat=require(_0x34d7('0x0'));var rimraf=require(_0x34d7('0x1'));var zipdir=require(_0x34d7('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x34d7('0x3'));var moment=require('moment');var BPromise=require(_0x34d7('0x4'));var Mustache=require(_0x34d7('0x5'));var util=require(_0x34d7('0x6'));var path=require('path');var sox=require(_0x34d7('0x7'));var csv=require(_0x34d7('0x8'));var ejs=require(_0x34d7('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x34d7('0xa'));var squel=require('squel');var crypto=require(_0x34d7('0xb'));var jsforce=require(_0x34d7('0xc'));var deskjs=require(_0x34d7('0xd'));var toCsv=require(_0x34d7('0x8'));var querystring=require(_0x34d7('0xe'));var Papa=require(_0x34d7('0xf'));var Redis=require(_0x34d7('0x10'));var authService=require(_0x34d7('0x11'));var qs=require(_0x34d7('0x12'));var as=require(_0x34d7('0x13'));var hardwareService=require(_0x34d7('0x14'));var logger=require('../../config/logger')(_0x34d7('0x15'));var utils=require(_0x34d7('0x16'));var config=require(_0x34d7('0x17'));var licenseUtil=require(_0x34d7('0x18'));var db=require(_0x34d7('0x19'))['db'];function respondWithStatusCode(_0x1ad5e1,_0xc5ce63){_0xc5ce63=_0xc5ce63||0xcc;return function(_0x38d253){if(_0x38d253){return _0x1ad5e1[_0x34d7('0x1a')](_0xc5ce63);}return _0x1ad5e1['status'](_0xc5ce63)[_0x34d7('0x1b')]();};}function respondWithResult(_0x959a9f,_0x1415e8){_0x1415e8=_0x1415e8||0xc8;return function(_0x581e4c){if(_0x581e4c){return _0x959a9f['status'](_0x1415e8)[_0x34d7('0x1c')](_0x581e4c);}};}function respondWithFilteredResult(_0xf3f9b3,_0x5716a1){return function(_0xde3e96){if(_0xde3e96){var _0x3ae028=typeof _0x5716a1['offset']===_0x34d7('0x1d')&&typeof _0x5716a1[_0x34d7('0x1e')]==='undefined';var _0x8769a7=_0xde3e96[_0x34d7('0x1f')];var _0x15c9b5=_0x3ae028?0x0:_0x5716a1[_0x34d7('0x20')];var _0x2b1699=_0x3ae028?_0xde3e96['count']:_0x5716a1['offset']+_0x5716a1['limit'];var _0x73fddd;if(_0x2b1699>=_0x8769a7){_0x2b1699=_0x8769a7;_0x73fddd=0xc8;}else{_0x73fddd=0xce;}_0xf3f9b3['status'](_0x73fddd);return _0xf3f9b3[_0x34d7('0x21')](_0x34d7('0x22'),_0x15c9b5+'-'+_0x2b1699+'/'+_0x8769a7)[_0x34d7('0x1c')](_0xde3e96);}return null;};}function patchUpdates(_0x3fbee8){return function(_0x59422d){try{jsonpatch[_0x34d7('0x23')](_0x59422d,_0x3fbee8,!![]);}catch(_0x374df0){return BPromise[_0x34d7('0x24')](_0x374df0);}return _0x59422d[_0x34d7('0x25')]();};}function saveUpdates(_0x4dde64,_0x5a9ccc){return function(_0x402b44){if(_0x402b44){return _0x402b44[_0x34d7('0x26')](_0x4dde64)['then'](function(_0x433505){return _0x433505;});}return null;};}function removeEntity(_0x361189,_0x2fa7ff){return function(_0x58232e){if(_0x58232e){return _0x58232e[_0x34d7('0x27')]()[_0x34d7('0x28')](function(){_0x361189['status'](0xcc)[_0x34d7('0x1b')]();});}};}function handleEntityNotFound(_0x27cbae,_0x595c99){return function(_0x1c2d23){if(!_0x1c2d23){_0x27cbae[_0x34d7('0x1a')](0x194);}return _0x1c2d23;};}function handleError(_0x43f0d4,_0x44e711){_0x44e711=_0x44e711||0x1f4;return function(_0x5112ef){logger[_0x34d7('0x29')](_0x5112ef[_0x34d7('0x2a')]);if(_0x5112ef[_0x34d7('0x2b')]){delete _0x5112ef[_0x34d7('0x2b')];}_0x43f0d4[_0x34d7('0x2c')](_0x44e711)[_0x34d7('0x2d')](_0x5112ef);};}exports['index']=function(_0x2a22b0,_0x47bd7e){var _0x55501a={},_0x34b9fd={},_0x3ead60={'count':0x0,'rows':[]};var _0x2f6e27=_[_0x34d7('0x2e')](db['VoiceQueuesLog'][_0x34d7('0x2f')],function(_0x255bde){return{'name':_0x255bde[_0x34d7('0x30')],'type':_0x255bde[_0x34d7('0x31')][_0x34d7('0x32')]};});_0x34b9fd[_0x34d7('0x33')]=_[_0x34d7('0x2e')](_0x2f6e27,_0x34d7('0x2b'));_0x34b9fd['query']=_[_0x34d7('0x34')](_0x2a22b0[_0x34d7('0x35')]);_0x34b9fd[_0x34d7('0x36')]=_[_0x34d7('0x37')](_0x34b9fd['model'],_0x34b9fd[_0x34d7('0x35')]);_0x55501a[_0x34d7('0x38')]=_[_0x34d7('0x37')](_0x34b9fd[_0x34d7('0x33')],qs['fields'](_0x2a22b0['query'][_0x34d7('0x39')]));_0x55501a['attributes']=_0x55501a[_0x34d7('0x38')][_0x34d7('0x3a')]?_0x55501a['attributes']:_0x34b9fd['model'];if(!_0x2a22b0[_0x34d7('0x35')]['hasOwnProperty'](_0x34d7('0x3b'))){_0x55501a[_0x34d7('0x1e')]=qs[_0x34d7('0x1e')](_0x2a22b0['query']['limit']);_0x55501a[_0x34d7('0x20')]=qs[_0x34d7('0x20')](_0x2a22b0['query'][_0x34d7('0x20')]);}_0x55501a[_0x34d7('0x3c')]=qs['sort'](_0x2a22b0[_0x34d7('0x35')]['sort']);_0x55501a[_0x34d7('0x3d')]=qs[_0x34d7('0x36')](_[_0x34d7('0x3e')](_0x2a22b0[_0x34d7('0x35')],_0x34b9fd['filters']),_0x2f6e27);if(_0x2a22b0[_0x34d7('0x35')][_0x34d7('0x3f')]){_0x55501a[_0x34d7('0x3d')]=_[_0x34d7('0x40')](_0x55501a[_0x34d7('0x3d')],{'$or':_['map'](_0x2f6e27,function(_0x35170d){if(_0x35170d[_0x34d7('0x31')]!=='VIRTUAL'){var _0x1796ee={};_0x1796ee[_0x35170d[_0x34d7('0x2b')]]={'$like':'%'+_0x2a22b0[_0x34d7('0x35')][_0x34d7('0x3f')]+'%'};return _0x1796ee;}})});}_0x55501a=_[_0x34d7('0x40')]({},_0x55501a,_0x2a22b0[_0x34d7('0x41')]);var _0x104f6e={'where':_0x55501a[_0x34d7('0x3d')]};return db[_0x34d7('0x42')][_0x34d7('0x1f')](_0x104f6e)['then'](function(_0xe3c0a1){_0x3ead60[_0x34d7('0x1f')]=_0xe3c0a1;if(_0x2a22b0['query'][_0x34d7('0x43')]){_0x55501a[_0x34d7('0x44')]=[{'all':!![]}];}return db[_0x34d7('0x42')][_0x34d7('0x45')](_0x55501a);})[_0x34d7('0x28')](function(_0xa9aa1b){_0x3ead60['rows']=_0xa9aa1b;return _0x3ead60;})[_0x34d7('0x28')](respondWithFilteredResult(_0x47bd7e,_0x55501a))[_0x34d7('0x46')](handleError(_0x47bd7e,null));};exports[_0x34d7('0x47')]=function(_0x56ab5a,_0x599c62){var _0x15eb94={'raw':!![],'where':{'id':_0x56ab5a[_0x34d7('0x48')]['id']}},_0xf4ec12={};_0xf4ec12[_0x34d7('0x33')]=_['keys'](db['VoiceQueuesLog']['rawAttributes']);_0xf4ec12[_0x34d7('0x35')]=_['keys'](_0x56ab5a[_0x34d7('0x35')]);_0xf4ec12['filters']=_['intersection'](_0xf4ec12['model'],_0xf4ec12['query']);_0x15eb94[_0x34d7('0x38')]=_[_0x34d7('0x37')](_0xf4ec12['model'],qs[_0x34d7('0x39')](_0x56ab5a['query'][_0x34d7('0x39')]));_0x15eb94[_0x34d7('0x38')]=_0x15eb94['attributes'][_0x34d7('0x3a')]?_0x15eb94[_0x34d7('0x38')]:_0xf4ec12[_0x34d7('0x33')];if(_0x56ab5a[_0x34d7('0x35')][_0x34d7('0x43')]){_0x15eb94[_0x34d7('0x44')]=[{'all':!![]}];}_0x15eb94=_[_0x34d7('0x40')]({},_0x15eb94,_0x56ab5a['options']);return db[_0x34d7('0x42')][_0x34d7('0x49')](_0x15eb94)[_0x34d7('0x28')](handleEntityNotFound(_0x599c62,null))[_0x34d7('0x28')](respondWithResult(_0x599c62,null))[_0x34d7('0x46')](handleError(_0x599c62,null));};exports[_0x34d7('0x4a')]=function(_0x49cfac,_0x392e74){return db[_0x34d7('0x42')][_0x34d7('0x4a')](_0x49cfac['body'],{})[_0x34d7('0x28')](respondWithResult(_0x392e74,0xc9))[_0x34d7('0x46')](handleError(_0x392e74,null));};exports[_0x34d7('0x26')]=function(_0x517a4,_0x3f884d){if(_0x517a4['body']['id']){delete _0x517a4[_0x34d7('0x4b')]['id'];}return db['VoiceQueuesLog']['find']({'where':{'id':_0x517a4[_0x34d7('0x48')]['id']}})[_0x34d7('0x28')](handleEntityNotFound(_0x3f884d,null))['then'](saveUpdates(_0x517a4[_0x34d7('0x4b')],null))[_0x34d7('0x28')](respondWithResult(_0x3f884d,null))[_0x34d7('0x46')](handleError(_0x3f884d,null));};exports[_0x34d7('0x27')]=function(_0x5755c9,_0x44488f){return db[_0x34d7('0x42')][_0x34d7('0x49')]({'where':{'id':_0x5755c9[_0x34d7('0x48')]['id']}})[_0x34d7('0x28')](handleEntityNotFound(_0x44488f,null))[_0x34d7('0x28')](removeEntity(_0x44488f,null))['catch'](handleError(_0x44488f,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index e4ba095..182c621 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 _0x8d4c=['../../config/environment','./voiceQueuesLog.attributes','exports','define','VoiceQueuesLog','event_dtm','event','lodash','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x4294ce,_0x277093){var _0x232aaa=function(_0x3f5916){while(--_0x3f5916){_0x4294ce['push'](_0x4294ce['shift']());}};_0x232aaa(++_0x277093);}(_0x8d4c,0x173));var _0xc8d4=function(_0x47c0c1,_0x2fd98f){_0x47c0c1=_0x47c0c1-0x0;var _0x48e551=_0x8d4c[_0x47c0c1];return _0x48e551;};'use strict';var _=require(_0xc8d4('0x0'));var util=require('util');var logger=require(_0xc8d4('0x1'))(_0xc8d4('0x2'));var moment=require(_0xc8d4('0x3'));var BPromise=require('bluebird');var rp=require(_0xc8d4('0x4'));var fs=require('fs');var path=require(_0xc8d4('0x5'));var rimraf=require(_0xc8d4('0x6'));var config=require(_0xc8d4('0x7'));var attributes=require(_0xc8d4('0x8'));module[_0xc8d4('0x9')]=function(_0x1838f5,_0x4258ec){return _0x1838f5[_0xc8d4('0xa')](_0xc8d4('0xb'),attributes,{'tableName':'voice_queues_log','paranoid':![],'indexes':[{'name':_0xc8d4('0xc'),'fields':[_0xc8d4('0xd'),'dtm']}],'timestamps':![]});}; \ No newline at end of file +var _0x40d4=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','event','dtm'];(function(_0x5f09c5,_0x2bfca0){var _0x426ad9=function(_0x18fe5f){while(--_0x18fe5f){_0x5f09c5['push'](_0x5f09c5['shift']());}};_0x426ad9(++_0x2bfca0);}(_0x40d4,0x16c));var _0x440d=function(_0x203d9f,_0x139878){_0x203d9f=_0x203d9f-0x0;var _0x4feb78=_0x40d4[_0x203d9f];return _0x4feb78;};'use strict';var _=require(_0x440d('0x0'));var util=require(_0x440d('0x1'));var logger=require(_0x440d('0x2'))(_0x440d('0x3'));var moment=require(_0x440d('0x4'));var BPromise=require(_0x440d('0x5'));var rp=require(_0x440d('0x6'));var fs=require('fs');var path=require(_0x440d('0x7'));var rimraf=require(_0x440d('0x8'));var config=require(_0x440d('0x9'));var attributes=require('./voiceQueuesLog.attributes');module[_0x440d('0xa')]=function(_0x15e3de,_0x3602b8){return _0x15e3de['define']('VoiceQueuesLog',attributes,{'tableName':'voice_queues_log','paranoid':![],'indexes':[{'name':'event_dtm','fields':[_0x440d('0xb'),_0x440d('0xc')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js index 4a381f8..e912252 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 _0x622f=['info','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','http','then'];(function(_0x509c83,_0x511882){var _0x534626=function(_0x9d21cf){while(--_0x9d21cf){_0x509c83['push'](_0x509c83['shift']());}};_0x534626(++_0x511882);}(_0x622f,0x172));var _0xf622=function(_0x395073,_0x2ee068){_0x395073=_0x395073-0x0;var _0x1300d3=_0x622f[_0x395073];return _0x1300d3;};'use strict';var _=require(_0xf622('0x0'));var util=require(_0xf622('0x1'));var moment=require('moment');var BPromise=require(_0xf622('0x2'));var rs=require(_0xf622('0x3'));var fs=require('fs');var Redis=require(_0xf622('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xf622('0x5'));var logger=require('../../config/logger')(_0xf622('0x6'));var config=require(_0xf622('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xf622('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x847984,_0x540b19,_0x4211d8){return new BPromise(function(_0x8b4fab,_0x54a7bc){return client['request'](_0x847984,_0x4211d8)[_0xf622('0x9')](function(_0x54f10a){logger[_0xf622('0xa')](_0xf622('0xb'),_0x540b19,_0xf622('0xc'));logger[_0xf622('0xd')]('VoiceQueuesLog,\x20%s,\x20%s,\x20%s',_0x540b19,_0xf622('0xc'),JSON[_0xf622('0xe')](_0x54f10a));if(_0x54f10a[_0xf622('0xf')]){if(_0x54f10a[_0xf622('0xf')]['code']===0x1f4){logger[_0xf622('0xf')](_0xf622('0xb'),_0x540b19,_0x54f10a[_0xf622('0xf')]['message']);return _0x54a7bc(_0x54f10a[_0xf622('0xf')][_0xf622('0x10')]);}logger[_0xf622('0xf')](_0xf622('0xb'),_0x540b19,_0x54f10a[_0xf622('0xf')][_0xf622('0x10')]);return _0x8b4fab(_0x54f10a['error'][_0xf622('0x10')]);}else{logger['info'](_0xf622('0xb'),_0x540b19,'request\x20sent');_0x8b4fab(_0x54f10a[_0xf622('0x11')][_0xf622('0x10')]);}})[_0xf622('0x12')](function(_0x52c66f){logger[_0xf622('0xf')](_0xf622('0xb'),_0x540b19,_0x52c66f);_0x54a7bc(_0x52c66f);});});} \ No newline at end of file +var _0x781f=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','bluebird'];(function(_0x44e00a,_0x248bbc){var _0x2bdfba=function(_0x5e66c4){while(--_0x5e66c4){_0x44e00a['push'](_0x44e00a['shift']());}};_0x2bdfba(++_0x248bbc);}(_0x781f,0x13f));var _0xf781=function(_0x470f63,_0x48d80b){_0x470f63=_0x470f63-0x0;var _0x4f09e2=_0x781f[_0x470f63];return _0x4f09e2;};'use strict';var _=require(_0xf781('0x0'));var util=require(_0xf781('0x1'));var moment=require('moment');var BPromise=require(_0xf781('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf781('0x3'));var db=require(_0xf781('0x4'))['db'];var utils=require(_0xf781('0x5'));var logger=require(_0xf781('0x6'))(_0xf781('0x7'));var config=require(_0xf781('0x8'));var jayson=require(_0xf781('0x9'));var client=jayson[_0xf781('0xa')][_0xf781('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x33b958,_0x595a3a,_0x21b450){return new BPromise(function(_0x51678a,_0x3df5b0){return client[_0xf781('0xc')](_0x33b958,_0x21b450)['then'](function(_0x404523){logger[_0xf781('0xd')](_0xf781('0xe'),_0x595a3a,_0xf781('0xf'));logger[_0xf781('0x10')](_0xf781('0x11'),_0x595a3a,_0xf781('0xf'),JSON[_0xf781('0x12')](_0x404523));if(_0x404523[_0xf781('0x13')]){if(_0x404523[_0xf781('0x13')][_0xf781('0x14')]===0x1f4){logger[_0xf781('0x13')](_0xf781('0xe'),_0x595a3a,_0x404523['error']['message']);return _0x3df5b0(_0x404523[_0xf781('0x13')]['message']);}logger['error']('VoiceQueuesLog,\x20%s,\x20%s',_0x595a3a,_0x404523[_0xf781('0x13')][_0xf781('0x15')]);return _0x51678a(_0x404523['error'][_0xf781('0x15')]);}else{logger['info'](_0xf781('0xe'),_0x595a3a,_0xf781('0xf'));_0x51678a(_0x404523[_0xf781('0x16')][_0xf781('0x15')]);}})['catch'](function(_0x3e95e4){logger['error'](_0xf781('0xe'),_0x595a3a,_0x3e95e4);_0x3df5b0(_0x3e95e4);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index bd242ae..c043022 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 _0x81a4=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','show','/:id/download','download','/:id/downloads','/:id/transcribe','post','create','runTranscribe','put','/:id','destroy','exports','util','path','express','Router'];(function(_0x4bd835,_0x49b203){var _0x3d1bc4=function(_0x5f15c){while(--_0x5f15c){_0x4bd835['push'](_0x4bd835['shift']());}};_0x3d1bc4(++_0x49b203);}(_0x81a4,0x110));var _0x481a=function(_0x4207f4,_0x1f778b){_0x4207f4=_0x4207f4-0x0;var _0x29a621=_0x81a4[_0x4207f4];return _0x29a621;};'use strict';var multer=require('multer');var util=require(_0x481a('0x0'));var path=require(_0x481a('0x1'));var timeout=require('connect-timeout');var express=require(_0x481a('0x2'));var router=express[_0x481a('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x481a('0x4'));var interaction=require(_0x481a('0x5'));var config=require(_0x481a('0x6'));var controller=require('./voiceRecording.controller');router[_0x481a('0x7')]('/',auth[_0x481a('0x8')](),controller[_0x481a('0x9')]);router[_0x481a('0x7')](_0x481a('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x481a('0x7')]('/:id',auth[_0x481a('0x8')](),controller[_0x481a('0xb')]);router[_0x481a('0x7')](_0x481a('0xc'),auth['isAuthenticated'](),controller[_0x481a('0xd')]);router[_0x481a('0x7')](_0x481a('0xe'),controller['downloads']);router[_0x481a('0x7')](_0x481a('0xf'),auth['isAuthenticated'](),controller['downloadTranscribe']);router[_0x481a('0x10')]('/',auth[_0x481a('0x8')](),controller[_0x481a('0x11')]);router[_0x481a('0x10')]('/:id/transcribe',auth[_0x481a('0x8')](),controller[_0x481a('0x12')]);router[_0x481a('0x13')](_0x481a('0x14'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x481a('0x14'),auth[_0x481a('0x8')](),controller[_0x481a('0x15')]);module[_0x481a('0x16')]=router; \ No newline at end of file +var _0x9651=['show','downloads','post','create','/:id/transcribe','runTranscribe','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../config/environment','./voiceRecording.controller','get','isAuthenticated','index','/describe','/:id'];(function(_0x314dd6,_0x8576aa){var _0x53b99c=function(_0x2d4c47){while(--_0x2d4c47){_0x314dd6['push'](_0x314dd6['shift']());}};_0x53b99c(++_0x8576aa);}(_0x9651,0x1bb));var _0x1965=function(_0x20cf4d,_0x3babd6){_0x20cf4d=_0x20cf4d-0x0;var _0x13f0ca=_0x9651[_0x20cf4d];return _0x13f0ca;};'use strict';var multer=require(_0x1965('0x0'));var util=require(_0x1965('0x1'));var path=require(_0x1965('0x2'));var timeout=require(_0x1965('0x3'));var express=require(_0x1965('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x1965('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x1965('0x6'));var controller=require(_0x1965('0x7'));router[_0x1965('0x8')]('/',auth[_0x1965('0x9')](),controller[_0x1965('0xa')]);router[_0x1965('0x8')](_0x1965('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0x1965('0x8')](_0x1965('0xc'),auth[_0x1965('0x9')](),controller[_0x1965('0xd')]);router[_0x1965('0x8')]('/:id/download',auth[_0x1965('0x9')](),controller['download']);router[_0x1965('0x8')]('/:id/downloads',controller[_0x1965('0xe')]);router['get']('/:id/transcribe',auth[_0x1965('0x9')](),controller['downloadTranscribe']);router[_0x1965('0xf')]('/',auth[_0x1965('0x9')](),controller[_0x1965('0x10')]);router[_0x1965('0xf')](_0x1965('0x11'),auth['isAuthenticated'](),controller[_0x1965('0x12')]);router[_0x1965('0x13')](_0x1965('0xc'),auth[_0x1965('0x9')](),controller[_0x1965('0x14')]);router[_0x1965('0x15')](_0x1965('0xc'),auth[_0x1965('0x9')](),controller[_0x1965('0x16')]);module[_0x1965('0x17')]=router; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.attributes.js b/server/api/voiceRecording/voiceRecording.attributes.js index a0b15d1..1002d79 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(_0x45d3f0,_0x4be53f){var _0x314b79=function(_0x563d32){while(--_0x563d32){_0x45d3f0['push'](_0x45d3f0['shift']());}};_0x314b79(++_0x4be53f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x45e98e,_0x169b60){_0x45e98e=_0x45e98e-0x0;var _0x374dba=_0xa9e0[_0x45e98e];return _0x374dba;};'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(_0xbd08b4,_0x4790ed){var _0x314f1e=function(_0x161589){while(--_0x161589){_0xbd08b4['push'](_0xbd08b4['shift']());}};_0x314f1e(++_0x4790ed);}(_0xa9e0,0x123));var _0x0a9e=function(_0x9df060,_0x253d33){_0x9df060=_0x9df060-0x0;var _0x338dfe=_0xa9e0[_0x9df060];return _0x338dfe;};'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 d6b8133..0bcb612 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 _0xee4c=['filename','download','unlink','message','downloads','sequelize','MD5','token','$and','push','secrets','recording','Sequelize','extname','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','isNil','File:\x20\x22','unlinkSync','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','createBucket','TranscribeService','startTranscriptionJob','basename','readFileSync','Location','bucket','Bucket','location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','TranscriptionJobName','transcribeName','TranscriptionJobStatus','runTranscribe','findOne','Setting','transcribe','transcribeAccountId','transcribeRegion','language','Transcribe\x20not\x20configured','runSentiment','sentiment','sentimentAccountId','sentimentRegion','data1','data2','Cloud\x20Provider\x20not\x20configured','Buckets','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','transcribeStatus','tempSentiment','updateAttributes','writeFile','fileText','root','Transcript\x20not\x20available','eml-format','zip-dir','request-promise','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','aws-sdk','uuid/v4','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','end','status','json','offset','limit','undefined','count','set','apply','reject','update','then','destroy','error','name','send','index','map','rawAttributes','fieldName','model','differenceBy','format','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','type','VIRTUAL','merge','options','VoiceRecording','includeAll','findAll','rows','catch','params','include','find','create','body','describe','../../components/encryptor','uniqueid','value','%s.cypher','existsSync','decryptFile','ValidationError','VoiceRecording\x20not\x20found'];(function(_0x12f451,_0x3b618f){var _0x5e9589=function(_0x3153d2){while(--_0x3153d2){_0x12f451['push'](_0x12f451['shift']());}};_0x5e9589(++_0x3b618f);}(_0xee4c,0x1f3));var _0xcee4=function(_0x57d5a8,_0x21553a){_0x57d5a8=_0x57d5a8-0x0;var _0x46fdc7=_0xee4c[_0x57d5a8];return _0x46fdc7;};'use strict';var emlformat=require(_0xcee4('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xcee4('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xcee4('0x2'));var moment=require('moment');var BPromise=require(_0xcee4('0x3'));var Mustache=require('mustache');var util=require(_0xcee4('0x4'));var path=require('path');var sox=require(_0xcee4('0x5'));var csv=require(_0xcee4('0x6'));var ejs=require(_0xcee4('0x7'));var fs=require('fs');var fs_extra=require(_0xcee4('0x8'));var _=require(_0xcee4('0x9'));var squel=require(_0xcee4('0xa'));var crypto=require(_0xcee4('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xcee4('0x6'));var querystring=require(_0xcee4('0xc'));var Papa=require(_0xcee4('0xd'));var AWS=require(_0xcee4('0xe'));var uuidv4=require(_0xcee4('0xf'));var Redis=require('ioredis');var authService=require(_0xcee4('0x10'));var qs=require(_0xcee4('0x11'));var as=require(_0xcee4('0x12'));var hardwareService=require(_0xcee4('0x13'));var logger=require(_0xcee4('0x14'))(_0xcee4('0x15'));var utils=require(_0xcee4('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xcee4('0x17'))['db'];function respondWithStatusCode(_0x4a8880,_0x398b2d){_0x398b2d=_0x398b2d||0xcc;return function(_0x3a792e){if(_0x3a792e){return _0x4a8880[_0xcee4('0x18')](_0x398b2d);}return _0x4a8880['status'](_0x398b2d)[_0xcee4('0x19')]();};}function respondWithResult(_0x5e7f2f,_0x157962){_0x157962=_0x157962||0xc8;return function(_0x5aedd4){if(_0x5aedd4){return _0x5e7f2f[_0xcee4('0x1a')](_0x157962)[_0xcee4('0x1b')](_0x5aedd4);}};}function respondWithFilteredResult(_0x5b76cf,_0x1d8208){return function(_0x381143){if(_0x381143){var _0x45144a=typeof _0x1d8208[_0xcee4('0x1c')]==='undefined'&&typeof _0x1d8208[_0xcee4('0x1d')]===_0xcee4('0x1e');var _0x82eb35=_0x381143['count'];var _0x3674be=_0x45144a?0x0:_0x1d8208[_0xcee4('0x1c')];var _0x522bc9=_0x45144a?_0x381143[_0xcee4('0x1f')]:_0x1d8208[_0xcee4('0x1c')]+_0x1d8208[_0xcee4('0x1d')];var _0x51ce68;if(_0x522bc9>=_0x82eb35){_0x522bc9=_0x82eb35;_0x51ce68=0xc8;}else{_0x51ce68=0xce;}_0x5b76cf['status'](_0x51ce68);return _0x5b76cf[_0xcee4('0x20')]('Content-Range',_0x3674be+'-'+_0x522bc9+'/'+_0x82eb35)['json'](_0x381143);}return null;};}function patchUpdates(_0x40f43c){return function(_0x3b7e45){try{jsonpatch[_0xcee4('0x21')](_0x3b7e45,_0x40f43c,!![]);}catch(_0x379b33){return BPromise[_0xcee4('0x22')](_0x379b33);}return _0x3b7e45['save']();};}function saveUpdates(_0x2f3483,_0x137371){return function(_0x1d9e74){if(_0x1d9e74){return _0x1d9e74[_0xcee4('0x23')](_0x2f3483)[_0xcee4('0x24')](function(_0x24967a){return _0x24967a;});}return null;};}function removeEntity(_0x15cca5,_0x3f9477){return function(_0xb12efe){if(_0xb12efe){return _0xb12efe[_0xcee4('0x25')]()[_0xcee4('0x24')](function(){_0x15cca5[_0xcee4('0x1a')](0xcc)[_0xcee4('0x19')]();});}};}function handleEntityNotFound(_0x259747,_0x25dbbd){return function(_0x335e1e){if(!_0x335e1e){_0x259747[_0xcee4('0x18')](0x194);}return _0x335e1e;};}function handleError(_0x39aa06,_0x115ee6){_0x115ee6=_0x115ee6||0x1f4;return function(_0x24f72c){logger[_0xcee4('0x26')](_0x24f72c['stack']);if(_0x24f72c[_0xcee4('0x27')]){delete _0x24f72c[_0xcee4('0x27')];}_0x39aa06['status'](_0x115ee6)[_0xcee4('0x28')](_0x24f72c);};}exports[_0xcee4('0x29')]=function(_0x14c490,_0x74ba6){var _0x56fc00={},_0x47f66b={},_0x18d988={'count':0x0,'rows':[]};var _0x579222=_[_0xcee4('0x2a')](db['VoiceRecording'][_0xcee4('0x2b')],function(_0x5cb8b8){return{'name':_0x5cb8b8[_0xcee4('0x2c')],'type':_0x5cb8b8['type']['key']};});_0x47f66b[_0xcee4('0x2d')]=_[_0xcee4('0x2e')](_[_0xcee4('0x2a')](_0x579222,'name'),[_0xcee4('0x2f')]);_0x47f66b[_0xcee4('0x30')]=_[_0xcee4('0x31')](_0x14c490[_0xcee4('0x30')]);_0x47f66b['filters']=_['intersection'](_0x47f66b['model'],_0x47f66b[_0xcee4('0x30')]);_0x56fc00[_0xcee4('0x32')]=_[_0xcee4('0x33')](_0x47f66b[_0xcee4('0x2d')],qs[_0xcee4('0x34')](_0x14c490[_0xcee4('0x30')]['fields']));_0x56fc00[_0xcee4('0x32')]=_0x56fc00[_0xcee4('0x32')][_0xcee4('0x35')]?_0x56fc00['attributes']:_0x47f66b[_0xcee4('0x2d')];if(!_0x14c490[_0xcee4('0x30')][_0xcee4('0x36')](_0xcee4('0x37'))){_0x56fc00[_0xcee4('0x1d')]=qs['limit'](_0x14c490[_0xcee4('0x30')][_0xcee4('0x1d')]);_0x56fc00[_0xcee4('0x1c')]=qs[_0xcee4('0x1c')](_0x14c490[_0xcee4('0x30')]['offset']);}_0x56fc00[_0xcee4('0x38')]=qs['sort'](_0x14c490[_0xcee4('0x30')][_0xcee4('0x39')]);_0x56fc00['where']=qs[_0xcee4('0x3a')](_[_0xcee4('0x3b')](_0x14c490[_0xcee4('0x30')],_0x47f66b['filters']),_0x579222);if(_0x14c490[_0xcee4('0x30')][_0xcee4('0x3c')]){_0x56fc00[_0xcee4('0x3d')]=_['merge'](_0x56fc00[_0xcee4('0x3d')],{'$or':_[_0xcee4('0x2a')](_0x579222,function(_0x5e5ad8){if(_0x5e5ad8[_0xcee4('0x3e')]!==_0xcee4('0x3f')){var _0x1d39ad={};_0x1d39ad[_0x5e5ad8[_0xcee4('0x27')]]={'$like':'%'+_0x14c490['query'][_0xcee4('0x3c')]+'%'};return _0x1d39ad;}})});}_0x56fc00=_[_0xcee4('0x40')]({},_0x56fc00,_0x14c490[_0xcee4('0x41')]);var _0x2aecad={'where':_0x56fc00['where']};return db[_0xcee4('0x42')][_0xcee4('0x1f')](_0x2aecad)[_0xcee4('0x24')](function(_0x41a7ff){_0x18d988[_0xcee4('0x1f')]=_0x41a7ff;if(_0x14c490[_0xcee4('0x30')][_0xcee4('0x43')]){_0x56fc00['include']=[{'all':!![]}];}return db[_0xcee4('0x42')][_0xcee4('0x44')](_0x56fc00);})[_0xcee4('0x24')](function(_0xf6aab0){_0x18d988[_0xcee4('0x45')]=_0xf6aab0;return _0x18d988;})['then'](respondWithFilteredResult(_0x74ba6,_0x56fc00))[_0xcee4('0x46')](handleError(_0x74ba6,null));};exports['show']=function(_0x431074,_0x4a897b){var _0x236b24={'raw':![],'where':{'id':_0x431074[_0xcee4('0x47')]['id']}},_0x34b3e2={};_0x34b3e2[_0xcee4('0x2d')]=_[_0xcee4('0x31')](db[_0xcee4('0x42')][_0xcee4('0x2b')]);_0x34b3e2[_0xcee4('0x30')]=_['keys'](_0x431074['query']);_0x34b3e2[_0xcee4('0x3a')]=_[_0xcee4('0x33')](_0x34b3e2[_0xcee4('0x2d')],_0x34b3e2[_0xcee4('0x30')]);_0x236b24['attributes']=_[_0xcee4('0x33')](_0x34b3e2[_0xcee4('0x2d')],qs[_0xcee4('0x34')](_0x431074['query'][_0xcee4('0x34')]));_0x236b24[_0xcee4('0x32')]=_0x236b24[_0xcee4('0x32')][_0xcee4('0x35')]?_0x236b24[_0xcee4('0x32')]:_0x34b3e2['model'];if(_0x431074['query']['includeAll']){_0x236b24[_0xcee4('0x48')]=[{'all':!![]}];}_0x236b24=_['merge']({},_0x236b24,_0x431074[_0xcee4('0x41')]);return db[_0xcee4('0x42')][_0xcee4('0x49')](_0x236b24)[_0xcee4('0x24')](handleEntityNotFound(_0x4a897b,null))[_0xcee4('0x24')](respondWithResult(_0x4a897b,null))[_0xcee4('0x46')](handleError(_0x4a897b,null));};exports[_0xcee4('0x4a')]=function(_0x1b299a,_0x58d3f9){return db[_0xcee4('0x42')][_0xcee4('0x4a')](_0x1b299a[_0xcee4('0x4b')],{})[_0xcee4('0x24')](respondWithResult(_0x58d3f9,0xc9))[_0xcee4('0x46')](handleError(_0x58d3f9,null));};exports['update']=function(_0x3b2399,_0x57349e){if(_0x3b2399[_0xcee4('0x4b')]['id']){delete _0x3b2399[_0xcee4('0x4b')]['id'];}return db[_0xcee4('0x42')]['find']({'where':{'id':_0x3b2399[_0xcee4('0x47')]['id']}})[_0xcee4('0x24')](handleEntityNotFound(_0x57349e,null))[_0xcee4('0x24')](saveUpdates(_0x3b2399[_0xcee4('0x4b')],null))['then'](respondWithResult(_0x57349e,null))[_0xcee4('0x46')](handleError(_0x57349e,null));};exports[_0xcee4('0x4c')]=function(_0x30d80d,_0x1f1706){return db[_0xcee4('0x42')][_0xcee4('0x4c')]()[_0xcee4('0x24')](respondWithResult(_0x1f1706,null))[_0xcee4('0x46')](handleError(_0x1f1706,null));};exports['download']=function(_0x435667,_0x4825f9,_0x51dad7){var _0x218cae=require(_0xcee4('0x4d'));var _0x569b97=![];var _0x2a04af={};if(_0x435667['query'][_0xcee4('0x3e')]&&_0x435667[_0xcee4('0x30')][_0xcee4('0x3e')]===_0xcee4('0x4e')){_0x2a04af[_0xcee4('0x4e')]=_0x435667['params']['id'];}else{_0x2a04af['id']=_0x435667[_0xcee4('0x47')]['id'];}return db[_0xcee4('0x42')][_0xcee4('0x49')]({'where':_0x2a04af,'attributes':['id',_0xcee4('0x4f')],'raw':!![]})['then'](handleEntityNotFound(_0x4825f9,null))[_0xcee4('0x24')](function(_0x5830c2){if(_0x5830c2){var _0x4c9f33=_0x5830c2[_0xcee4('0x4f')];var _0xdfc55b=util[_0xcee4('0x2f')](_0xcee4('0x50'),_0x4c9f33);if(fs[_0xcee4('0x51')](_0xdfc55b)){_0x569b97=!![];return _0x218cae[_0xcee4('0x52')](_0xdfc55b,_0x4c9f33,config['secrets']['recording'])[_0xcee4('0x24')](function(){return _0x5830c2;});}return _0x5830c2;}})[_0xcee4('0x24')](function(_0x2da1b2){if(_0x2da1b2){var _0x447fac=_0x2da1b2['value'];if(!fs[_0xcee4('0x51')](_0x447fac)){throw new db['Sequelize'][(_0xcee4('0x53'))](_0xcee4('0x54'));}if(_0x2da1b2[_0xcee4('0x55')]){return _0x4825f9[_0xcee4('0x56')](_0x447fac,_0x2da1b2[_0xcee4('0x55')]+path['extname'](_0x447fac),function(){if(_0x569b97){fs[_0xcee4('0x57')](_0x447fac);}});}else{return _0x4825f9[_0xcee4('0x56')](_0x447fac,function(_0x2e9df8){if(_0x569b97){fs[_0xcee4('0x57')](_0x447fac);}});}}})[_0xcee4('0x46')](function(_0x46c422){if(_0x46c422[_0xcee4('0x58')]===_0xcee4('0x54')){_0x4825f9[_0xcee4('0x1a')](0x194)[_0xcee4('0x28')]('Not\x20found');}else{return handleError(_0x4825f9,null);}});};exports[_0xcee4('0x59')]=function(_0x3b88c5,_0x23e32b,_0x35c1c9){var _0x1434eb=require(_0xcee4('0x4d'));var _0x500b02=![];var _0x1abf86={'$and':[db[_0xcee4('0x5a')][_0xcee4('0x3d')](db[_0xcee4('0x5a')]['fn'](_0xcee4('0x5b'),db[_0xcee4('0x5a')]['col']('uniqueid')),_0x3b88c5[_0xcee4('0x30')][_0xcee4('0x5c')])]};if(_0x3b88c5[_0xcee4('0x30')]['type']&&_0x3b88c5['query'][_0xcee4('0x3e')]===_0xcee4('0x4e')){_0x1abf86[_0xcee4('0x5d')][_0xcee4('0x5e')]({'uniqueid':_0x3b88c5[_0xcee4('0x47')]['id']});}else{_0x1abf86[_0xcee4('0x5d')]['push']({'id':_0x3b88c5[_0xcee4('0x47')]['id']});}return db[_0xcee4('0x42')]['find']({'where':_0x1abf86,'attributes':['id','value'],'raw':!![]})[_0xcee4('0x24')](handleEntityNotFound(_0x23e32b,null))[_0xcee4('0x24')](function(_0x49db3c){if(_0x49db3c){var _0x1a4ecb=util[_0xcee4('0x2f')](_0xcee4('0x50'),_0x49db3c[_0xcee4('0x4f')]);if(fs['existsSync'](_0x1a4ecb)){_0x500b02=!![];return _0x1434eb[_0xcee4('0x52')](_0x1a4ecb,_0x49db3c['value'],config[_0xcee4('0x5f')][_0xcee4('0x60')])[_0xcee4('0x24')](function(){return _0x49db3c;});}return _0x49db3c;}})[_0xcee4('0x24')](function(_0x49f65b){if(_0x49f65b){if(!fs[_0xcee4('0x51')](_0x49f65b[_0xcee4('0x4f')])){throw new db[(_0xcee4('0x61'))][(_0xcee4('0x53'))](_0xcee4('0x54'));}if(_0x49f65b[_0xcee4('0x55')]){return _0x23e32b['download'](_0x49f65b['value'],_0x49f65b[_0xcee4('0x55')]+path[_0xcee4('0x62')](_0x49f65b[_0xcee4('0x4f')]),function(){if(_0x500b02){fs[_0xcee4('0x57')](_0x49f65b[_0xcee4('0x4f')]);}});}else{return _0x23e32b[_0xcee4('0x56')](_0x49f65b[_0xcee4('0x4f')],function(_0x54a681){if(_0x500b02){fs[_0xcee4('0x57')](_0x49f65b[_0xcee4('0x4f')]);}});}}})[_0xcee4('0x46')](handleError(_0x23e32b,null));};exports[_0xcee4('0x25')]=function(_0x4d2e98,_0x387547){return db[_0xcee4('0x42')][_0xcee4('0x49')]({'where':{'id':_0x4d2e98[_0xcee4('0x47')]['id']}})[_0xcee4('0x24')](function(_0x3c2082){if(_['isNil'](_0x3c2082)){throw new ReferenceError(_0xcee4('0x63'));}return _0x3c2082;})[_0xcee4('0x24')](function(_0x302dc3){var _0x428167=_0x302dc3[_0xcee4('0x4f')];logger[_0xcee4('0x64')](_0xcee4('0x65'),_0x428167);if(!_[_0xcee4('0x66')](_0x302dc3[_0xcee4('0x4f')])&&fs['existsSync'](_0x428167)){logger[_0xcee4('0x64')](_0xcee4('0x67')+_0x428167+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0xcee4('0x68')](_0x428167);}_0x428167=_0x428167+'.cypher';if(!_[_0xcee4('0x66')](_0x302dc3['value'])&&fs[_0xcee4('0x51')](_0x428167)){logger['info']('File:\x20\x22'+_0x428167+_0xcee4('0x69'));fs['unlinkSync'](_0x428167);}return _0x302dc3;})[_0xcee4('0x24')](function(_0x5b9368){if(!_0x5b9368)throw new InternalError();return _0x5b9368[_0xcee4('0x25')]();})[_0xcee4('0x24')](function(){_0x387547[_0xcee4('0x1a')](0xcc)[_0xcee4('0x19')]();})['catch'](handleError(_0x387547,null));};function getBucketslist(_0x128e25,_0x4e24a7,_0x2f65ea){return new Promise(function(_0x3a751e,_0x3bf0f5){var _0x1e9dec=new AWS['S3']({'accessKeyId':_0x4e24a7,'secretAccessKey':_0x128e25,'region':_0x2f65ea});_0x1e9dec['listBuckets']({},function(_0x4c5b99,_0x1f36c4){if(_0x4c5b99){return _0x3bf0f5(_0x4c5b99);}else{return _0x3a751e(_0x1f36c4);}});});}function createBucket(_0x167608,_0x5b77e4,_0x4f165e,_0x379804){return new Promise(function(_0x13ba9d,_0x18faf1){var _0xc04649=new AWS['S3']({'accessKeyId':_0x5b77e4,'secretAccessKey':_0x167608,'region':_0x4f165e});_0xc04649[_0xcee4('0x6a')]({'Bucket':_0x379804},function(_0x294a86,_0x3b5f5b){if(_0x294a86){return _0x18faf1(_0x294a86);}else{return _0x13ba9d(_0x3b5f5b);}});});}function uploadFile(_0x29f9a2,_0x513cd1,_0x22ed07,_0xc4fe1c,_0x408661,_0x567e21){return new Promise(function(_0x4a3014,_0x4d2df9){var _0x56cba1=new AWS['S3']({'accessKeyId':_0x513cd1,'secretAccessKey':_0x29f9a2,'region':_0x22ed07});_0x56cba1['upload']({'Bucket':_0xc4fe1c,'Key':_0x408661,'Body':_0x567e21},function(_0x1fdb7c,_0x1923a0){if(_0x1fdb7c){return _0x4d2df9(_0x1fdb7c);}else{return _0x4a3014(_0x1923a0);}});});}function startTranscribe(_0x2d1647,_0x43416a,_0x36adb4,_0x10f6fa,_0x2df8c2,_0x347829){return new Promise(function(_0x1e9c8c,_0x2ed883){var _0x243e7d=new AWS[(_0xcee4('0x6b'))]({'accessKeyId':_0x43416a,'secretAccessKey':_0x2d1647,'region':_0x36adb4});_0x243e7d[_0xcee4('0x6c')]({'TranscriptionJobName':_0x10f6fa,'LanguageCode':_0x2df8c2,'Media':{'MediaFileUri':_0x347829}},function(_0x4994a0,_0x22356f){if(_0x4994a0){return _0x2ed883(_0x4994a0);}else{return _0x1e9c8c(_0x22356f);}});});}function transcribe(_0x462125,_0x4574c0,_0x1682c5,_0x311162,_0x3a05f4,_0x4cda4e,_0x19d701){return new Promise(function(_0x4512ff,_0x2fdce5){var _0x523d8={};logger[_0xcee4('0x64')](util[_0xcee4('0x2f')]('[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s',_0x462125,_0x3a05f4));return uploadFile(_0x4574c0,_0x1682c5,_0x311162,_0x3a05f4,path[_0xcee4('0x6d')](_0x4cda4e),fs[_0xcee4('0x6e')](_0x4cda4e))[_0xcee4('0x24')](function(_0x51bd60){logger[_0xcee4('0x64')](util[_0xcee4('0x2f')]('[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)',_0x462125,_0x3a05f4,_0x51bd60[_0xcee4('0x6f')]));_0x523d8[_0xcee4('0x70')]=_0x51bd60[_0xcee4('0x71')];_0x523d8[_0xcee4('0x72')]=_0x51bd60[_0xcee4('0x6f')];logger[_0xcee4('0x64')](util[_0xcee4('0x2f')](_0xcee4('0x73'),_0x462125));return startTranscribe(_0x4574c0,_0x1682c5,_0x311162,uuidv4(),_0x19d701,_0x51bd60['Location']);})[_0xcee4('0x24')](function(_0x407ef5){logger[_0xcee4('0x64')](util['format'](_0xcee4('0x74'),_0x462125,_0x407ef5[_0xcee4('0x75')][_0xcee4('0x76')]));_0x523d8[_0xcee4('0x77')]=_0x407ef5['TranscriptionJob'][_0xcee4('0x76')];_0x523d8['transcribeStatus']=_0x407ef5[_0xcee4('0x75')][_0xcee4('0x78')];return _0x4512ff(_0x523d8);})[_0xcee4('0x46')](function(_0x1c7881){return _0x2fdce5(_0x1c7881);});});}exports[_0xcee4('0x79')]=function(_0x221b1b,_0x39caae,_0x8e092c){var _0x577c01;var _0xfe3b54;var _0x376402;var _0x323648=require(_0xcee4('0x4d'));return db['VoiceRecording'][_0xcee4('0x7a')]({'where':{'id':_0x221b1b['params']['id']}})[_0xcee4('0x24')](function(_0x11810d){if(_0x11810d){var _0x13e7f8=util['format'](_0xcee4('0x50'),_0x11810d[_0xcee4('0x4f')]);if(fs['existsSync'](_0x13e7f8)){cypher=!![];return _0x323648['decryptFile'](_0x13e7f8,_0x11810d[_0xcee4('0x4f')],config[_0xcee4('0x5f')]['recording'])[_0xcee4('0x24')](function(){return _0x11810d;});}return _0x11810d;}})[_0xcee4('0x24')](function(_0x4f72b4){if(!_0x4f72b4){throw new db[(_0xcee4('0x61'))]['ValidationError']('Voice\x20Recording\x20not\x20found');}_0xfe3b54=_0x4f72b4;return db[_0xcee4('0x7b')]['findOne']({'where':{'id':0x1}});})[_0xcee4('0x24')](handleEntityNotFound(_0x39caae,null))['then'](function(_0x5f5325){if(_0x5f5325){_0x577c01=_0x5f5325;if(!_0x577c01[_0xcee4('0x7c')]||!_0x577c01[_0xcee4('0x7d')]||!_0x577c01[_0xcee4('0x7e')]||!_0x577c01[_0xcee4('0x7f')]||!_0x577c01[_0xcee4('0x70')]){throw new db['Sequelize'][(_0xcee4('0x53'))](_0xcee4('0x80'));}if(_0x221b1b[_0xcee4('0x4b')][_0xcee4('0x81')]&&(!_0x577c01[_0xcee4('0x82')]||!_0x577c01[_0xcee4('0x83')]||!_0x577c01[_0xcee4('0x84')]||!_0x577c01[_0xcee4('0x7f')]||!_0x577c01[_0xcee4('0x70')])){throw new db['Sequelize'][(_0xcee4('0x53'))]('Sentiment\x20Analysis\x20not\x20configured');}return db['CloudProvider'][_0xcee4('0x7a')]({'where':{'id':_0x577c01[_0xcee4('0x7d')]}});}})['then'](function(_0xf8c7dd){if(!_0xf8c7dd){throw new db['Sequelize'][(_0xcee4('0x53'))]('Cloud\x20Provider\x20not\x20available');}if(!_0xf8c7dd[_0xcee4('0x85')]||!_0xf8c7dd[_0xcee4('0x86')]){throw new db['Sequelize'][(_0xcee4('0x53'))](_0xcee4('0x87'));}_0x376402=_0xf8c7dd;return getBucketslist(_0x376402[_0xcee4('0x85')],_0x376402[_0xcee4('0x86')],_0x577c01[_0xcee4('0x7e')]);})[_0xcee4('0x24')](function(_0x4a3b95){if(_0x4a3b95&&_0x4a3b95[_0xcee4('0x88')]){var _0x430f09=_['find'](_0x4a3b95[_0xcee4('0x88')],function(_0x478351){return _0x478351['Name']===_0x577c01[_0xcee4('0x70')];});if(!_0x430f09){logger[_0xcee4('0x64')](util[_0xcee4('0x2f')](_0xcee4('0x89'),_0x221b1b['params']['id'],_0x577c01[_0xcee4('0x70')]));return createBucket(_0x376402['data1'],_0x376402[_0xcee4('0x86')],_0x577c01[_0xcee4('0x7e')],_0x577c01[_0xcee4('0x70')]);}logger['info'](util[_0xcee4('0x2f')](_0xcee4('0x8a'),_0x221b1b[_0xcee4('0x47')]['id'],_0x577c01[_0xcee4('0x70')]));return;}})['then'](function(_0x11d93a){if(_0xfe3b54[_0xcee4('0x8b')]==='NEW'){return transcribe(_0x221b1b[_0xcee4('0x47')]['id'],_0x376402['data1'],_0x376402['data2'],_0x577c01[_0xcee4('0x7e')],_0x577c01['bucket'],_0xfe3b54['value'],_0x577c01[_0xcee4('0x7f')]);}else{logger[_0xcee4('0x64')](util[_0xcee4('0x2f')]('[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested',_0x221b1b['params']['id']));return{'transcribeStatus':'IN_PROGRESS'};}})[_0xcee4('0x24')](function(_0x394163){if(_0x394163){_0x394163[_0xcee4('0x8c')]=_0x221b1b[_0xcee4('0x4b')][_0xcee4('0x81')];return _0xfe3b54[_0xcee4('0x8d')](_0x394163);}})[_0xcee4('0x24')](respondWithResult(_0x39caae,null))[_0xcee4('0x46')](handleError(_0x39caae,null));};function writeFile(_0x2850d9,_0x12e121){return new Promise(function(_0x1e1503,_0x4212a0){fs[_0xcee4('0x8e')](_0x12e121,_0x2850d9,function(_0x59c38a,_0x44372d){if(_0x59c38a){return _0x4212a0(_0x59c38a);}else{return _0x1e1503(_0x44372d);}});});}exports['downloadTranscribe']=function(_0x4a620b,_0x5ebd05,_0x3a265d){return db[_0xcee4('0x42')][_0xcee4('0x7a')]({'where':{'id':_0x4a620b[_0xcee4('0x47')]['id']}})[_0xcee4('0x24')](handleEntityNotFound(_0x5ebd05))[_0xcee4('0x24')](function(_0x27305f){if(_0x27305f&&_0x27305f[_0xcee4('0x8f')]){var _0x4215d3=_0x27305f[_0xcee4('0x8f')];var _0x1116ba=config[_0xcee4('0x90')]+'/server/files/transcribes/transcribe_'+_0x27305f['id']+'.txt';if(fs[_0xcee4('0x51')](_0x1116ba)){return _0x1116ba;}return writeFile(_0x4215d3,_0x1116ba)[_0xcee4('0x24')](function(){return _0x1116ba;});}else{throw new db[(_0xcee4('0x61'))]['ValidationError'](_0xcee4('0x91'));}})[_0xcee4('0x24')](function(_0x45ce7f){return _0x5ebd05[_0xcee4('0x56')](_0x45ce7f);})[_0xcee4('0x46')](handleError(_0x5ebd05));}; \ No newline at end of file +var _0x9851=['TranscriptionJob','TranscriptionJobName','transcribeName','transcribeStatus','TranscriptionJobStatus','runTranscribe','findOne','Setting','transcribe','transcribeAccountId','transcribeRegion','language','Transcribe\x20not\x20configured','sentiment','sentimentAccountId','sentimentRegion','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','Cloud\x20Provider\x20not\x20available','data1','data2','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','runSentiment','updateAttributes','fileText','root','/server/files/transcribes/transcribe_','.txt','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','desk.js','querystring','papaparse','aws-sdk','uuid/v4','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','count','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','fieldName','key','model','map','format','query','keys','filters','attributes','intersection','fields','nolimit','sort','where','filter','merge','type','VIRTUAL','options','VoiceRecording','includeAll','include','findAll','rows','catch','show','params','rawAttributes','length','find','create','body','describe','download','../../components/encryptor','uniqueid','value','%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize','VoiceRecording\x20not\x20found','filename','unlink','message','Not\x20found','downloads','sequelize','MD5','col','token','$and','ValidationError','extname','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','unlinkSync','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','createBucket','upload','TranscribeService','basename','readFileSync','bucket','location','Location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created'];(function(_0x1808b2,_0x35f5a6){var _0x498147=function(_0x17d30a){while(--_0x17d30a){_0x1808b2['push'](_0x1808b2['shift']());}};_0x498147(++_0x35f5a6);}(_0x9851,0x14c));var _0x1985=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9851[_0x3dd15e];return _0x231fd0;};'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(_0x1985('0x0'));var moment=require(_0x1985('0x1'));var BPromise=require(_0x1985('0x2'));var Mustache=require(_0x1985('0x3'));var util=require(_0x1985('0x4'));var path=require(_0x1985('0x5'));var sox=require(_0x1985('0x6'));var csv=require(_0x1985('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1985('0x8'));var _=require(_0x1985('0x9'));var squel=require('squel');var crypto=require(_0x1985('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x1985('0xb'));var toCsv=require('to-csv');var querystring=require(_0x1985('0xc'));var Papa=require(_0x1985('0xd'));var AWS=require(_0x1985('0xe'));var uuidv4=require(_0x1985('0xf'));var Redis=require(_0x1985('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x1985('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1985('0x12'));var logger=require(_0x1985('0x13'))(_0x1985('0x14'));var utils=require(_0x1985('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x1985('0x16'));var db=require(_0x1985('0x17'))['db'];function respondWithStatusCode(_0x2d46e9,_0x2baaee){_0x2baaee=_0x2baaee||0xcc;return function(_0x907835){if(_0x907835){return _0x2d46e9[_0x1985('0x18')](_0x2baaee);}return _0x2d46e9[_0x1985('0x19')](_0x2baaee)[_0x1985('0x1a')]();};}function respondWithResult(_0x147be6,_0x4a9eed){_0x4a9eed=_0x4a9eed||0xc8;return function(_0x23922b){if(_0x23922b){return _0x147be6[_0x1985('0x19')](_0x4a9eed)[_0x1985('0x1b')](_0x23922b);}};}function respondWithFilteredResult(_0x24e97d,_0x357bc7){return function(_0x38c9e0){if(_0x38c9e0){var _0x31dc9c=typeof _0x357bc7[_0x1985('0x1c')]==='undefined'&&typeof _0x357bc7[_0x1985('0x1d')]==='undefined';var _0x56e7bc=_0x38c9e0[_0x1985('0x1e')];var _0x1f0900=_0x31dc9c?0x0:_0x357bc7[_0x1985('0x1c')];var _0x384b7b=_0x31dc9c?_0x38c9e0[_0x1985('0x1e')]:_0x357bc7[_0x1985('0x1c')]+_0x357bc7[_0x1985('0x1d')];var _0x1e6ffa;if(_0x384b7b>=_0x56e7bc){_0x384b7b=_0x56e7bc;_0x1e6ffa=0xc8;}else{_0x1e6ffa=0xce;}_0x24e97d[_0x1985('0x19')](_0x1e6ffa);return _0x24e97d['set'](_0x1985('0x1f'),_0x1f0900+'-'+_0x384b7b+'/'+_0x56e7bc)[_0x1985('0x1b')](_0x38c9e0);}return null;};}function patchUpdates(_0x44b335){return function(_0x562b5b){try{jsonpatch[_0x1985('0x20')](_0x562b5b,_0x44b335,!![]);}catch(_0x15817d){return BPromise[_0x1985('0x21')](_0x15817d);}return _0x562b5b[_0x1985('0x22')]();};}function saveUpdates(_0x3a85ca,_0x2fa182){return function(_0x1dfb9e){if(_0x1dfb9e){return _0x1dfb9e[_0x1985('0x23')](_0x3a85ca)[_0x1985('0x24')](function(_0x201560){return _0x201560;});}return null;};}function removeEntity(_0xcafc6d,_0x57cd83){return function(_0x49923f){if(_0x49923f){return _0x49923f[_0x1985('0x25')]()[_0x1985('0x24')](function(){_0xcafc6d['status'](0xcc)[_0x1985('0x1a')]();});}};}function handleEntityNotFound(_0x25c3b5,_0x56854f){return function(_0x552d56){if(!_0x552d56){_0x25c3b5['sendStatus'](0x194);}return _0x552d56;};}function handleError(_0x59a648,_0x38c463){_0x38c463=_0x38c463||0x1f4;return function(_0x29bc0c){logger[_0x1985('0x26')](_0x29bc0c['stack']);if(_0x29bc0c[_0x1985('0x27')]){delete _0x29bc0c[_0x1985('0x27')];}_0x59a648[_0x1985('0x19')](_0x38c463)[_0x1985('0x28')](_0x29bc0c);};}exports[_0x1985('0x29')]=function(_0x66eb37,_0x14c887){var _0x3eabdc={},_0x361e0e={},_0x3a9334={'count':0x0,'rows':[]};var _0xec70fc=_['map'](db['VoiceRecording']['rawAttributes'],function(_0x28ec5a){return{'name':_0x28ec5a[_0x1985('0x2a')],'type':_0x28ec5a['type'][_0x1985('0x2b')]};});_0x361e0e[_0x1985('0x2c')]=_['differenceBy'](_[_0x1985('0x2d')](_0xec70fc,_0x1985('0x27')),[_0x1985('0x2e')]);_0x361e0e[_0x1985('0x2f')]=_[_0x1985('0x30')](_0x66eb37[_0x1985('0x2f')]);_0x361e0e[_0x1985('0x31')]=_['intersection'](_0x361e0e[_0x1985('0x2c')],_0x361e0e[_0x1985('0x2f')]);_0x3eabdc[_0x1985('0x32')]=_[_0x1985('0x33')](_0x361e0e[_0x1985('0x2c')],qs[_0x1985('0x34')](_0x66eb37[_0x1985('0x2f')]['fields']));_0x3eabdc['attributes']=_0x3eabdc['attributes']['length']?_0x3eabdc['attributes']:_0x361e0e[_0x1985('0x2c')];if(!_0x66eb37[_0x1985('0x2f')]['hasOwnProperty'](_0x1985('0x35'))){_0x3eabdc[_0x1985('0x1d')]=qs[_0x1985('0x1d')](_0x66eb37[_0x1985('0x2f')][_0x1985('0x1d')]);_0x3eabdc[_0x1985('0x1c')]=qs['offset'](_0x66eb37['query'][_0x1985('0x1c')]);}_0x3eabdc['order']=qs['sort'](_0x66eb37[_0x1985('0x2f')][_0x1985('0x36')]);_0x3eabdc[_0x1985('0x37')]=qs[_0x1985('0x31')](_['pick'](_0x66eb37[_0x1985('0x2f')],_0x361e0e[_0x1985('0x31')]),_0xec70fc);if(_0x66eb37['query'][_0x1985('0x38')]){_0x3eabdc[_0x1985('0x37')]=_[_0x1985('0x39')](_0x3eabdc[_0x1985('0x37')],{'$or':_[_0x1985('0x2d')](_0xec70fc,function(_0x15bbd3){if(_0x15bbd3[_0x1985('0x3a')]!==_0x1985('0x3b')){var _0x5b5125={};_0x5b5125[_0x15bbd3['name']]={'$like':'%'+_0x66eb37['query'][_0x1985('0x38')]+'%'};return _0x5b5125;}})});}_0x3eabdc=_[_0x1985('0x39')]({},_0x3eabdc,_0x66eb37[_0x1985('0x3c')]);var _0x1efcb1={'where':_0x3eabdc[_0x1985('0x37')]};return db[_0x1985('0x3d')][_0x1985('0x1e')](_0x1efcb1)['then'](function(_0x1b6a7a){_0x3a9334['count']=_0x1b6a7a;if(_0x66eb37[_0x1985('0x2f')][_0x1985('0x3e')]){_0x3eabdc[_0x1985('0x3f')]=[{'all':!![]}];}return db['VoiceRecording'][_0x1985('0x40')](_0x3eabdc);})['then'](function(_0x53667f){_0x3a9334[_0x1985('0x41')]=_0x53667f;return _0x3a9334;})[_0x1985('0x24')](respondWithFilteredResult(_0x14c887,_0x3eabdc))[_0x1985('0x42')](handleError(_0x14c887,null));};exports[_0x1985('0x43')]=function(_0x2aa6dd,_0x239651){var _0x9f0d82={'raw':![],'where':{'id':_0x2aa6dd[_0x1985('0x44')]['id']}},_0x4cf60d={};_0x4cf60d[_0x1985('0x2c')]=_[_0x1985('0x30')](db[_0x1985('0x3d')][_0x1985('0x45')]);_0x4cf60d[_0x1985('0x2f')]=_[_0x1985('0x30')](_0x2aa6dd[_0x1985('0x2f')]);_0x4cf60d['filters']=_[_0x1985('0x33')](_0x4cf60d[_0x1985('0x2c')],_0x4cf60d[_0x1985('0x2f')]);_0x9f0d82[_0x1985('0x32')]=_['intersection'](_0x4cf60d[_0x1985('0x2c')],qs[_0x1985('0x34')](_0x2aa6dd['query'][_0x1985('0x34')]));_0x9f0d82['attributes']=_0x9f0d82['attributes'][_0x1985('0x46')]?_0x9f0d82['attributes']:_0x4cf60d[_0x1985('0x2c')];if(_0x2aa6dd[_0x1985('0x2f')][_0x1985('0x3e')]){_0x9f0d82['include']=[{'all':!![]}];}_0x9f0d82=_['merge']({},_0x9f0d82,_0x2aa6dd['options']);return db[_0x1985('0x3d')][_0x1985('0x47')](_0x9f0d82)['then'](handleEntityNotFound(_0x239651,null))['then'](respondWithResult(_0x239651,null))[_0x1985('0x42')](handleError(_0x239651,null));};exports[_0x1985('0x48')]=function(_0x3460dc,_0x16e94a){return db[_0x1985('0x3d')][_0x1985('0x48')](_0x3460dc[_0x1985('0x49')],{})[_0x1985('0x24')](respondWithResult(_0x16e94a,0xc9))[_0x1985('0x42')](handleError(_0x16e94a,null));};exports['update']=function(_0xdfb6c9,_0x45452e){if(_0xdfb6c9[_0x1985('0x49')]['id']){delete _0xdfb6c9['body']['id'];}return db['VoiceRecording'][_0x1985('0x47')]({'where':{'id':_0xdfb6c9['params']['id']}})[_0x1985('0x24')](handleEntityNotFound(_0x45452e,null))['then'](saveUpdates(_0xdfb6c9[_0x1985('0x49')],null))[_0x1985('0x24')](respondWithResult(_0x45452e,null))[_0x1985('0x42')](handleError(_0x45452e,null));};exports['describe']=function(_0x2d3d38,_0x1bc0d4){return db['VoiceRecording'][_0x1985('0x4a')]()[_0x1985('0x24')](respondWithResult(_0x1bc0d4,null))[_0x1985('0x42')](handleError(_0x1bc0d4,null));};exports[_0x1985('0x4b')]=function(_0x5aa8c3,_0x12fdc6,_0x26ffcd){var _0x9c6f9d=require(_0x1985('0x4c'));var _0xe122bb=![];var _0x5ec719={};if(_0x5aa8c3[_0x1985('0x2f')]['type']&&_0x5aa8c3[_0x1985('0x2f')][_0x1985('0x3a')]===_0x1985('0x4d')){_0x5ec719[_0x1985('0x4d')]=_0x5aa8c3[_0x1985('0x44')]['id'];}else{_0x5ec719['id']=_0x5aa8c3[_0x1985('0x44')]['id'];}return db['VoiceRecording'][_0x1985('0x47')]({'where':_0x5ec719,'attributes':['id','value'],'raw':!![]})['then'](handleEntityNotFound(_0x12fdc6,null))[_0x1985('0x24')](function(_0xb8a459){if(_0xb8a459){var _0x2bbfbf=_0xb8a459[_0x1985('0x4e')];var _0x1ede83=util[_0x1985('0x2e')](_0x1985('0x4f'),_0x2bbfbf);if(fs[_0x1985('0x50')](_0x1ede83)){_0xe122bb=!![];return _0x9c6f9d[_0x1985('0x51')](_0x1ede83,_0x2bbfbf,config[_0x1985('0x52')][_0x1985('0x53')])[_0x1985('0x24')](function(){return _0xb8a459;});}return _0xb8a459;}})['then'](function(_0x6f33ad){if(_0x6f33ad){var _0x47928e=_0x6f33ad[_0x1985('0x4e')];if(!fs[_0x1985('0x50')](_0x47928e)){throw new db[(_0x1985('0x54'))]['ValidationError'](_0x1985('0x55'));}if(_0x6f33ad[_0x1985('0x56')]){return _0x12fdc6[_0x1985('0x4b')](_0x47928e,_0x6f33ad[_0x1985('0x56')]+path['extname'](_0x47928e),function(){if(_0xe122bb){fs['unlink'](_0x47928e);}});}else{return _0x12fdc6[_0x1985('0x4b')](_0x47928e,function(_0x388462){if(_0xe122bb){fs[_0x1985('0x57')](_0x47928e);}});}}})['catch'](function(_0x5de5e4){if(_0x5de5e4[_0x1985('0x58')]===_0x1985('0x55')){_0x12fdc6[_0x1985('0x19')](0x194)[_0x1985('0x28')](_0x1985('0x59'));}else{return handleError(_0x12fdc6,null);}});};exports[_0x1985('0x5a')]=function(_0xd83593,_0xde3beb,_0x39e69d){var _0x5d7d5a=require(_0x1985('0x4c'));var _0x3f3722=![];var _0x4432cb={'$and':[db[_0x1985('0x5b')]['where'](db[_0x1985('0x5b')]['fn'](_0x1985('0x5c'),db[_0x1985('0x5b')][_0x1985('0x5d')](_0x1985('0x4d'))),_0xd83593['query'][_0x1985('0x5e')])]};if(_0xd83593[_0x1985('0x2f')][_0x1985('0x3a')]&&_0xd83593[_0x1985('0x2f')][_0x1985('0x3a')]===_0x1985('0x4d')){_0x4432cb[_0x1985('0x5f')]['push']({'uniqueid':_0xd83593['params']['id']});}else{_0x4432cb[_0x1985('0x5f')]['push']({'id':_0xd83593[_0x1985('0x44')]['id']});}return db[_0x1985('0x3d')][_0x1985('0x47')]({'where':_0x4432cb,'attributes':['id',_0x1985('0x4e')],'raw':!![]})[_0x1985('0x24')](handleEntityNotFound(_0xde3beb,null))[_0x1985('0x24')](function(_0x40f944){if(_0x40f944){var _0x629cef=util['format'](_0x1985('0x4f'),_0x40f944[_0x1985('0x4e')]);if(fs[_0x1985('0x50')](_0x629cef)){_0x3f3722=!![];return _0x5d7d5a[_0x1985('0x51')](_0x629cef,_0x40f944[_0x1985('0x4e')],config[_0x1985('0x52')][_0x1985('0x53')])[_0x1985('0x24')](function(){return _0x40f944;});}return _0x40f944;}})[_0x1985('0x24')](function(_0x703f){if(_0x703f){if(!fs[_0x1985('0x50')](_0x703f[_0x1985('0x4e')])){throw new db[(_0x1985('0x54'))][(_0x1985('0x60'))]('VoiceRecording\x20not\x20found');}if(_0x703f[_0x1985('0x56')]){return _0xde3beb[_0x1985('0x4b')](_0x703f[_0x1985('0x4e')],_0x703f['filename']+path[_0x1985('0x61')](_0x703f[_0x1985('0x4e')]),function(){if(_0x3f3722){fs[_0x1985('0x57')](_0x703f[_0x1985('0x4e')]);}});}else{return _0xde3beb[_0x1985('0x4b')](_0x703f[_0x1985('0x4e')],function(_0x1769a7){if(_0x3f3722){fs[_0x1985('0x57')](_0x703f['value']);}});}}})[_0x1985('0x42')](handleError(_0xde3beb,null));};exports[_0x1985('0x25')]=function(_0x24a66d,_0x1fc723){return db[_0x1985('0x3d')][_0x1985('0x47')]({'where':{'id':_0x24a66d['params']['id']}})['then'](function(_0x5227e1){if(_[_0x1985('0x62')](_0x5227e1)){throw new ReferenceError(_0x1985('0x63'));}return _0x5227e1;})[_0x1985('0x24')](function(_0x2199b1){var _0x341ac8=_0x2199b1[_0x1985('0x4e')];logger[_0x1985('0x64')](_0x1985('0x65'),_0x341ac8);if(!_[_0x1985('0x62')](_0x2199b1['value'])&&fs[_0x1985('0x50')](_0x341ac8)){logger[_0x1985('0x64')](_0x1985('0x66')+_0x341ac8+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x1985('0x67')](_0x341ac8);}_0x341ac8=_0x341ac8+'.cypher';if(!_[_0x1985('0x62')](_0x2199b1[_0x1985('0x4e')])&&fs[_0x1985('0x50')](_0x341ac8)){logger[_0x1985('0x64')]('File:\x20\x22'+_0x341ac8+_0x1985('0x68'));fs['unlinkSync'](_0x341ac8);}return _0x2199b1;})['then'](function(_0x1a3d2e){if(!_0x1a3d2e)throw new InternalError();return _0x1a3d2e[_0x1985('0x25')]();})[_0x1985('0x24')](function(){_0x1fc723['status'](0xcc)[_0x1985('0x1a')]();})[_0x1985('0x42')](handleError(_0x1fc723,null));};function getBucketslist(_0x3b00b7,_0x423712,_0x2b68cf){return new Promise(function(_0xbca468,_0x28d967){var _0x2c0003=new AWS['S3']({'accessKeyId':_0x423712,'secretAccessKey':_0x3b00b7,'region':_0x2b68cf});_0x2c0003['listBuckets']({},function(_0x4b3e7e,_0x1b2a48){if(_0x4b3e7e){return _0x28d967(_0x4b3e7e);}else{return _0xbca468(_0x1b2a48);}});});}function createBucket(_0x5268f5,_0x2383d8,_0x4385f7,_0x39da33){return new Promise(function(_0x4f8814,_0x55badd){var _0x55f4aa=new AWS['S3']({'accessKeyId':_0x2383d8,'secretAccessKey':_0x5268f5,'region':_0x4385f7});_0x55f4aa[_0x1985('0x69')]({'Bucket':_0x39da33},function(_0x52e7a8,_0x2e0645){if(_0x52e7a8){return _0x55badd(_0x52e7a8);}else{return _0x4f8814(_0x2e0645);}});});}function uploadFile(_0x22ee4d,_0xa74cb3,_0x27f363,_0x1debac,_0x4279dd,_0x563dce){return new Promise(function(_0x52d8c6,_0x312976){var _0x2f8c51=new AWS['S3']({'accessKeyId':_0xa74cb3,'secretAccessKey':_0x22ee4d,'region':_0x27f363});_0x2f8c51[_0x1985('0x6a')]({'Bucket':_0x1debac,'Key':_0x4279dd,'Body':_0x563dce},function(_0x1d3133,_0x2ec281){if(_0x1d3133){return _0x312976(_0x1d3133);}else{return _0x52d8c6(_0x2ec281);}});});}function startTranscribe(_0x2cb23e,_0x5c97a9,_0x39f9d0,_0x1fe55e,_0x5b9552,_0x30fd9e){return new Promise(function(_0xbb9aee,_0x352d84){var _0x52aa0b=new AWS[(_0x1985('0x6b'))]({'accessKeyId':_0x5c97a9,'secretAccessKey':_0x2cb23e,'region':_0x39f9d0});_0x52aa0b['startTranscriptionJob']({'TranscriptionJobName':_0x1fe55e,'LanguageCode':_0x5b9552,'Media':{'MediaFileUri':_0x30fd9e}},function(_0x31bfb6,_0xb5b430){if(_0x31bfb6){return _0x352d84(_0x31bfb6);}else{return _0xbb9aee(_0xb5b430);}});});}function transcribe(_0x33014f,_0x24be6e,_0x5e5fbf,_0x3f10a2,_0x416544,_0x58015a,_0x1ec9cd){return new Promise(function(_0x3f8970,_0x4cccc3){var _0x50a161={};logger[_0x1985('0x64')](util[_0x1985('0x2e')]('[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s',_0x33014f,_0x416544));return uploadFile(_0x24be6e,_0x5e5fbf,_0x3f10a2,_0x416544,path[_0x1985('0x6c')](_0x58015a),fs[_0x1985('0x6d')](_0x58015a))[_0x1985('0x24')](function(_0x36aee3){logger['info'](util['format']('[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)',_0x33014f,_0x416544,_0x36aee3['Location']));_0x50a161[_0x1985('0x6e')]=_0x36aee3['Bucket'];_0x50a161[_0x1985('0x6f')]=_0x36aee3[_0x1985('0x70')];logger[_0x1985('0x64')](util[_0x1985('0x2e')](_0x1985('0x71'),_0x33014f));return startTranscribe(_0x24be6e,_0x5e5fbf,_0x3f10a2,uuidv4(),_0x1ec9cd,_0x36aee3[_0x1985('0x70')]);})['then'](function(_0x257bf7){logger[_0x1985('0x64')](util['format'](_0x1985('0x72'),_0x33014f,_0x257bf7[_0x1985('0x73')][_0x1985('0x74')]));_0x50a161[_0x1985('0x75')]=_0x257bf7[_0x1985('0x73')][_0x1985('0x74')];_0x50a161[_0x1985('0x76')]=_0x257bf7[_0x1985('0x73')][_0x1985('0x77')];return _0x3f8970(_0x50a161);})[_0x1985('0x42')](function(_0x4e7d4b){return _0x4cccc3(_0x4e7d4b);});});}exports[_0x1985('0x78')]=function(_0x4aeb5d,_0x52a252,_0x5da780){var _0x483926;var _0xcb5455;var _0x2076c8;var _0x3c1a41=require(_0x1985('0x4c'));return db[_0x1985('0x3d')][_0x1985('0x79')]({'where':{'id':_0x4aeb5d[_0x1985('0x44')]['id']}})[_0x1985('0x24')](function(_0x409dcb){if(_0x409dcb){var _0x27f32f=util[_0x1985('0x2e')]('%s.cypher',_0x409dcb[_0x1985('0x4e')]);if(fs[_0x1985('0x50')](_0x27f32f)){cypher=!![];return _0x3c1a41[_0x1985('0x51')](_0x27f32f,_0x409dcb[_0x1985('0x4e')],config[_0x1985('0x52')][_0x1985('0x53')])[_0x1985('0x24')](function(){return _0x409dcb;});}return _0x409dcb;}})[_0x1985('0x24')](function(_0xad50dc){if(!_0xad50dc){throw new db['Sequelize'][(_0x1985('0x60'))]('Voice\x20Recording\x20not\x20found');}_0xcb5455=_0xad50dc;return db[_0x1985('0x7a')][_0x1985('0x79')]({'where':{'id':0x1}});})[_0x1985('0x24')](handleEntityNotFound(_0x52a252,null))[_0x1985('0x24')](function(_0x5a6d78){if(_0x5a6d78){_0x483926=_0x5a6d78;if(!_0x483926[_0x1985('0x7b')]||!_0x483926[_0x1985('0x7c')]||!_0x483926[_0x1985('0x7d')]||!_0x483926[_0x1985('0x7e')]||!_0x483926[_0x1985('0x6e')]){throw new db['Sequelize'][(_0x1985('0x60'))](_0x1985('0x7f'));}if(_0x4aeb5d[_0x1985('0x49')]['runSentiment']&&(!_0x483926[_0x1985('0x80')]||!_0x483926[_0x1985('0x81')]||!_0x483926[_0x1985('0x82')]||!_0x483926['language']||!_0x483926[_0x1985('0x6e')])){throw new db[(_0x1985('0x54'))][(_0x1985('0x60'))](_0x1985('0x83'));}return db[_0x1985('0x84')][_0x1985('0x79')]({'where':{'id':_0x483926[_0x1985('0x7c')]}});}})[_0x1985('0x24')](function(_0x57e805){if(!_0x57e805){throw new db[(_0x1985('0x54'))][(_0x1985('0x60'))](_0x1985('0x85'));}if(!_0x57e805[_0x1985('0x86')]||!_0x57e805['data2']){throw new db[(_0x1985('0x54'))][(_0x1985('0x60'))]('Cloud\x20Provider\x20not\x20configured');}_0x2076c8=_0x57e805;return getBucketslist(_0x2076c8[_0x1985('0x86')],_0x2076c8[_0x1985('0x87')],_0x483926[_0x1985('0x7d')]);})[_0x1985('0x24')](function(_0x5ee8b7){if(_0x5ee8b7&&_0x5ee8b7[_0x1985('0x88')]){var _0x1a9fa3=_[_0x1985('0x47')](_0x5ee8b7['Buckets'],function(_0x29e422){return _0x29e422[_0x1985('0x89')]===_0x483926[_0x1985('0x6e')];});if(!_0x1a9fa3){logger['info'](util['format'](_0x1985('0x8a'),_0x4aeb5d['params']['id'],_0x483926['bucket']));return createBucket(_0x2076c8[_0x1985('0x86')],_0x2076c8['data2'],_0x483926[_0x1985('0x7d')],_0x483926[_0x1985('0x6e')]);}logger[_0x1985('0x64')](util[_0x1985('0x2e')](_0x1985('0x8b'),_0x4aeb5d['params']['id'],_0x483926['bucket']));return;}})[_0x1985('0x24')](function(_0x105559){if(_0xcb5455[_0x1985('0x76')]===_0x1985('0x8c')){return transcribe(_0x4aeb5d['params']['id'],_0x2076c8[_0x1985('0x86')],_0x2076c8[_0x1985('0x87')],_0x483926[_0x1985('0x7d')],_0x483926[_0x1985('0x6e')],_0xcb5455[_0x1985('0x4e')],_0x483926[_0x1985('0x7e')]);}else{logger['info'](util['format'](_0x1985('0x8d'),_0x4aeb5d[_0x1985('0x44')]['id']));return{'transcribeStatus':_0x1985('0x8e')};}})[_0x1985('0x24')](function(_0x1200e9){if(_0x1200e9){_0x1200e9['tempSentiment']=_0x4aeb5d[_0x1985('0x49')][_0x1985('0x8f')];return _0xcb5455[_0x1985('0x90')](_0x1200e9);}})['then'](respondWithResult(_0x52a252,null))[_0x1985('0x42')](handleError(_0x52a252,null));};function writeFile(_0x2e1684,_0x5a3444){return new Promise(function(_0x2fbb00,_0x29d09d){fs['writeFile'](_0x5a3444,_0x2e1684,function(_0x577d24,_0x612928){if(_0x577d24){return _0x29d09d(_0x577d24);}else{return _0x2fbb00(_0x612928);}});});}exports['downloadTranscribe']=function(_0x345683,_0x2194fe,_0x3e376a){return db['VoiceRecording'][_0x1985('0x79')]({'where':{'id':_0x345683[_0x1985('0x44')]['id']}})['then'](handleEntityNotFound(_0x2194fe))[_0x1985('0x24')](function(_0x169341){if(_0x169341&&_0x169341[_0x1985('0x91')]){var _0x239a03=_0x169341[_0x1985('0x91')];var _0x5cc2f9=config[_0x1985('0x92')]+_0x1985('0x93')+_0x169341['id']+_0x1985('0x94');if(fs[_0x1985('0x50')](_0x5cc2f9)){return _0x5cc2f9;}return writeFile(_0x239a03,_0x5cc2f9)[_0x1985('0x24')](function(){return _0x5cc2f9;});}else{throw new db[(_0x1985('0x54'))][(_0x1985('0x60'))]('Transcript\x20not\x20available');}})[_0x1985('0x24')](function(_0x47dd69){return _0x2194fe[_0x1985('0x4b')](_0x47dd69);})['catch'](handleError(_0x2194fe));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index 853a276..31ea6d0 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 _0x6ddd=['uniqueid','transcribeStatus','define','VoiceRecording'];(function(_0x428b5c,_0x5bf52){var _0x28f7f3=function(_0x546df5){while(--_0x546df5){_0x428b5c['push'](_0x428b5c['shift']());}};_0x28f7f3(++_0x5bf52);}(_0x6ddd,0xae));var _0xd6dd=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x6ddd[_0x3947c9];return _0x2e7871;};'use strict';var attributes=require('./voiceRecording.attributes');module['exports']=function(_0x468b4c,_0x3f88f7){return _0x468b4c[_0xd6dd('0x0')](_0xd6dd('0x1'),attributes,{'tableName':'voice_recordings','paranoid':![],'indexes':[{'name':_0xd6dd('0x2'),'fields':['uniqueid']},{'name':_0xd6dd('0x3'),'fields':['transcribeStatus']}],'timestamps':!![]});}; \ No newline at end of file +var _0x8a9c=['transcribeStatus','./voiceRecording.attributes','exports','define','voice_recordings','uniqueid'];(function(_0x478365,_0x2164ee){var _0x172e1a=function(_0x238975){while(--_0x238975){_0x478365['push'](_0x478365['shift']());}};_0x172e1a(++_0x2164ee);}(_0x8a9c,0x12d));var _0xc8a9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8a9c[_0x3dd15e];return _0x231fd0;};'use strict';var attributes=require(_0xc8a9('0x0'));module[_0xc8a9('0x1')]=function(_0x358e57,_0x788c0f){return _0x358e57[_0xc8a9('0x2')]('VoiceRecording',attributes,{'tableName':_0xc8a9('0x3'),'paranoid':![],'indexes':[{'name':_0xc8a9('0x4'),'fields':['uniqueid']},{'name':_0xc8a9('0x5'),'fields':[_0xc8a9('0x5')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.rpc.js b/server/api/voiceRecording/voiceRecording.rpc.js index fc1357b..2b73215 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 _0x5430=['info','request\x20sent','debug','stringify','error','code','VoiceRecording,\x20%s,\x20%s','message','result','UpdateVoiceRecording','VoiceRecording','options','raw','limit','catch','CreateVoiceRecording','../../components/encryptor','findOne','callRecordingEncryption','create','body','existsSync','format','%s.cypher','value','encryptFile','secrets','CreateVoiceRecording\x20file\x20encrypted','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','jayson/promise','client','http','request','then'];(function(_0x8267d3,_0x123e50){var _0x4343b9=function(_0x44a174){while(--_0x44a174){_0x8267d3['push'](_0x8267d3['shift']());}};_0x4343b9(++_0x123e50);}(_0x5430,0x10c));var _0x0543=function(_0xf79383,_0x35ace4){_0xf79383=_0xf79383-0x0;var _0x22b937=_0x5430[_0xf79383];return _0x22b937;};'use strict';var _=require(_0x0543('0x0'));var util=require(_0x0543('0x1'));var moment=require(_0x0543('0x2'));var BPromise=require(_0x0543('0x3'));var rs=require(_0x0543('0x4'));var fs=require('fs');var Redis=require(_0x0543('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x0543('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x0543('0x7'));var client=jayson[_0x0543('0x8')][_0x0543('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x319568,_0x46bca7,_0x5ac352){return new BPromise(function(_0x372974,_0x7b8280){return client[_0x0543('0xa')](_0x319568,_0x5ac352)[_0x0543('0xb')](function(_0x2fb723){logger[_0x0543('0xc')]('VoiceRecording,\x20%s,\x20%s',_0x46bca7,_0x0543('0xd'));logger[_0x0543('0xe')]('VoiceRecording,\x20%s,\x20%s,\x20%s',_0x46bca7,_0x0543('0xd'),JSON[_0x0543('0xf')](_0x2fb723));if(_0x2fb723[_0x0543('0x10')]){if(_0x2fb723[_0x0543('0x10')][_0x0543('0x11')]===0x1f4){logger[_0x0543('0x10')](_0x0543('0x12'),_0x46bca7,_0x2fb723[_0x0543('0x10')][_0x0543('0x13')]);return _0x7b8280(_0x2fb723[_0x0543('0x10')][_0x0543('0x13')]);}logger[_0x0543('0x10')]('VoiceRecording,\x20%s,\x20%s',_0x46bca7,_0x2fb723[_0x0543('0x10')][_0x0543('0x13')]);return _0x372974(_0x2fb723['error']['message']);}else{logger[_0x0543('0xc')](_0x0543('0x12'),_0x46bca7,_0x0543('0xd'));_0x372974(_0x2fb723[_0x0543('0x14')][_0x0543('0x13')]);}})['catch'](function(_0xe69a3d){logger[_0x0543('0x10')](_0x0543('0x12'),_0x46bca7,_0xe69a3d);_0x7b8280(_0xe69a3d);});});}exports[_0x0543('0x15')]=function(_0x20b396){var _0x285080=this;return new Promise(function(_0x577cf0,_0x5eb03e){return db[_0x0543('0x16')]['update'](_0x20b396['body'],{'raw':_0x20b396[_0x0543('0x17')]?_0x20b396[_0x0543('0x17')][_0x0543('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x20b396['options']?_0x20b396[_0x0543('0x17')]['where']||null:null,'attributes':_0x20b396[_0x0543('0x17')]?_0x20b396[_0x0543('0x17')]['attributes']||null:null,'limit':_0x20b396[_0x0543('0x17')]?_0x20b396[_0x0543('0x17')][_0x0543('0x19')]||null:null})[_0x0543('0xb')](function(_0x37347e){logger[_0x0543('0xc')]('UpdateVoiceRecording',_0x20b396);logger['debug']('UpdateVoiceRecording',_0x20b396,JSON[_0x0543('0xf')](_0x37347e));_0x577cf0(_0x37347e);})[_0x0543('0x1a')](function(_0x15ebeb){logger[_0x0543('0x10')](_0x0543('0x15'),_0x15ebeb[_0x0543('0x13')],_0x20b396);_0x5eb03e(_0x285080[_0x0543('0x10')](0x1f4,_0x15ebeb[_0x0543('0x13')]));});});};exports[_0x0543('0x1b')]=function(_0xf1eccf){var _0x40a261=this;return new Promise(function(_0x21fc63,_0x547a88){var _0x25e6f1=require(_0x0543('0x1c'));var _0x30ad9e;return db['Setting'][_0x0543('0x1d')]({'attributes':['id',_0x0543('0x1e')],'where':{'id':0x1},'raw':!![]})[_0x0543('0xb')](function(_0x10b881){_0x30ad9e=_0x10b881;return db['VoiceRecording'][_0x0543('0x1f')](_0xf1eccf[_0x0543('0x20')]);})['then'](function(_0x576084){if(_0x30ad9e[_0x0543('0x1e')]&&fs[_0x0543('0x21')](_0x576084['value'])){var _0x3b879b=util[_0x0543('0x22')](_0x0543('0x23'),_0x576084[_0x0543('0x24')]);return _0x25e6f1[_0x0543('0x25')](_0x576084[_0x0543('0x24')],_0x3b879b,config[_0x0543('0x26')]['recording'])[_0x0543('0xb')](function(){fs['unlink'](_0x576084[_0x0543('0x24')]);logger[_0x0543('0xc')](_0x0543('0x27'));return _0x576084;});}return _0x576084;})[_0x0543('0xb')](function(_0x28307f){logger['info'](_0x0543('0x1b'),_0xf1eccf);logger['debug'](_0x0543('0x1b'),_0xf1eccf,JSON[_0x0543('0xf')](_0x28307f));_0x21fc63(_0x28307f);})[_0x0543('0x1a')](function(_0x327027){logger['error'](_0x0543('0x1b'),_0x327027['message'],_0xf1eccf);_0x547a88(_0x40a261[_0x0543('0x10')](0x1f4,_0x327027[_0x0543('0x13')]));});});}; \ No newline at end of file +var _0xd943=['info','request\x20sent','VoiceRecording,\x20%s,\x20%s,\x20%s','error','code','VoiceRecording,\x20%s,\x20%s','message','result','catch','UpdateVoiceRecording','VoiceRecording','body','options','raw','where','attributes','debug','stringify','CreateVoiceRecording','../../components/encryptor','Setting','findOne','callRecordingEncryption','existsSync','value','format','secrets','recording','CreateVoiceRecording\x20file\x20encrypted','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','then'];(function(_0xbf09ab,_0x251a19){var _0x2a9aef=function(_0x22d793){while(--_0x22d793){_0xbf09ab['push'](_0xbf09ab['shift']());}};_0x2a9aef(++_0x251a19);}(_0xd943,0x15d));var _0x3d94=function(_0x1dc177,_0x3a2324){_0x1dc177=_0x1dc177-0x0;var _0x4da3dc=_0xd943[_0x1dc177];return _0x4da3dc;};'use strict';var _=require(_0x3d94('0x0'));var util=require(_0x3d94('0x1'));var moment=require(_0x3d94('0x2'));var BPromise=require(_0x3d94('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3d94('0x4'));var db=require(_0x3d94('0x5'))['db'];var utils=require(_0x3d94('0x6'));var logger=require(_0x3d94('0x7'))(_0x3d94('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x3d94('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x54e81f,_0x4d29e7,_0x20f4d1){return new BPromise(function(_0x35d36a,_0x5244c3){return client['request'](_0x54e81f,_0x20f4d1)[_0x3d94('0xa')](function(_0x27e381){logger[_0x3d94('0xb')]('VoiceRecording,\x20%s,\x20%s',_0x4d29e7,_0x3d94('0xc'));logger['debug'](_0x3d94('0xd'),_0x4d29e7,_0x3d94('0xc'),JSON['stringify'](_0x27e381));if(_0x27e381[_0x3d94('0xe')]){if(_0x27e381[_0x3d94('0xe')][_0x3d94('0xf')]===0x1f4){logger[_0x3d94('0xe')](_0x3d94('0x10'),_0x4d29e7,_0x27e381['error'][_0x3d94('0x11')]);return _0x5244c3(_0x27e381[_0x3d94('0xe')][_0x3d94('0x11')]);}logger['error'](_0x3d94('0x10'),_0x4d29e7,_0x27e381[_0x3d94('0xe')][_0x3d94('0x11')]);return _0x35d36a(_0x27e381['error'][_0x3d94('0x11')]);}else{logger[_0x3d94('0xb')](_0x3d94('0x10'),_0x4d29e7,_0x3d94('0xc'));_0x35d36a(_0x27e381[_0x3d94('0x12')][_0x3d94('0x11')]);}})[_0x3d94('0x13')](function(_0x9893cb){logger['error'](_0x3d94('0x10'),_0x4d29e7,_0x9893cb);_0x5244c3(_0x9893cb);});});}exports[_0x3d94('0x14')]=function(_0x2acee3){var _0x1c35a8=this;return new Promise(function(_0x4afc92,_0x3ca0e3){return db[_0x3d94('0x15')]['update'](_0x2acee3[_0x3d94('0x16')],{'raw':_0x2acee3['options']?_0x2acee3[_0x3d94('0x17')][_0x3d94('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2acee3[_0x3d94('0x17')]?_0x2acee3[_0x3d94('0x17')][_0x3d94('0x19')]||null:null,'attributes':_0x2acee3['options']?_0x2acee3['options'][_0x3d94('0x1a')]||null:null,'limit':_0x2acee3[_0x3d94('0x17')]?_0x2acee3[_0x3d94('0x17')]['limit']||null:null})[_0x3d94('0xa')](function(_0x2e8c91){logger[_0x3d94('0xb')](_0x3d94('0x14'),_0x2acee3);logger[_0x3d94('0x1b')](_0x3d94('0x14'),_0x2acee3,JSON[_0x3d94('0x1c')](_0x2e8c91));_0x4afc92(_0x2e8c91);})[_0x3d94('0x13')](function(_0xee7b8d){logger[_0x3d94('0xe')](_0x3d94('0x14'),_0xee7b8d[_0x3d94('0x11')],_0x2acee3);_0x3ca0e3(_0x1c35a8[_0x3d94('0xe')](0x1f4,_0xee7b8d[_0x3d94('0x11')]));});});};exports[_0x3d94('0x1d')]=function(_0x5b3b31){var _0x123183=this;return new Promise(function(_0x558fd2,_0x28a698){var _0x1d0a7a=require(_0x3d94('0x1e'));var _0x439173;return db[_0x3d94('0x1f')][_0x3d94('0x20')]({'attributes':['id',_0x3d94('0x21')],'where':{'id':0x1},'raw':!![]})['then'](function(_0x584c4a){_0x439173=_0x584c4a;return db[_0x3d94('0x15')]['create'](_0x5b3b31['body']);})[_0x3d94('0xa')](function(_0x58c0d0){if(_0x439173[_0x3d94('0x21')]&&fs[_0x3d94('0x22')](_0x58c0d0[_0x3d94('0x23')])){var _0x4cef9c=util[_0x3d94('0x24')]('%s.cypher',_0x58c0d0[_0x3d94('0x23')]);return _0x1d0a7a['encryptFile'](_0x58c0d0[_0x3d94('0x23')],_0x4cef9c,config[_0x3d94('0x25')][_0x3d94('0x26')])[_0x3d94('0xa')](function(){fs['unlink'](_0x58c0d0[_0x3d94('0x23')]);logger['info'](_0x3d94('0x27'));return _0x58c0d0;});}return _0x58c0d0;})[_0x3d94('0xa')](function(_0x51d308){logger['info'](_0x3d94('0x1d'),_0x5b3b31);logger[_0x3d94('0x1b')](_0x3d94('0x1d'),_0x5b3b31,JSON['stringify'](_0x51d308));_0x558fd2(_0x51d308);})[_0x3d94('0x13')](function(_0x3d29fd){logger['error'](_0x3d94('0x1d'),_0x3d29fd[_0x3d94('0x11')],_0x5b3b31);_0x28a698(_0x123183[_0x3d94('0xe')](0x1f4,_0x3d29fd[_0x3d94('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/index.js b/server/api/voiceTransferReport/index.js index bd9d598..a8ab05c 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 _0xfc32=['/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','../../config/environment','./voiceTransferReport.controller','get','isAuthenticated','index'];(function(_0x397cfb,_0xb8f317){var _0x15fed9=function(_0x3eba43){while(--_0x3eba43){_0x397cfb['push'](_0x397cfb['shift']());}};_0x15fed9(++_0xb8f317);}(_0xfc32,0xa1));var _0x2fc3=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0xfc32[_0x46e363];return _0x3fb059;};'use strict';var multer=require(_0x2fc3('0x0'));var util=require(_0x2fc3('0x1'));var path=require(_0x2fc3('0x2'));var timeout=require(_0x2fc3('0x3'));var express=require(_0x2fc3('0x4'));var router=express[_0x2fc3('0x5')]();var fs_extra=require(_0x2fc3('0x6'));var auth=require(_0x2fc3('0x7'));var interaction=require(_0x2fc3('0x8'));var config=require(_0x2fc3('0x9'));var controller=require(_0x2fc3('0xa'));router[_0x2fc3('0xb')]('/',auth[_0x2fc3('0xc')](),controller[_0x2fc3('0xd')]);router['get'](_0x2fc3('0xe'),auth[_0x2fc3('0xc')](),controller[_0x2fc3('0xf')]);router[_0x2fc3('0xb')](_0x2fc3('0x10'),auth[_0x2fc3('0xc')](),controller[_0x2fc3('0x11')]);router[_0x2fc3('0x12')]('/',auth[_0x2fc3('0xc')](),controller[_0x2fc3('0x13')]);router[_0x2fc3('0x14')](_0x2fc3('0x10'),auth[_0x2fc3('0xc')](),controller[_0x2fc3('0x15')]);router[_0x2fc3('0x16')](_0x2fc3('0x10'),auth['isAuthenticated'](),controller[_0x2fc3('0x17')]);module[_0x2fc3('0x18')]=router; \ No newline at end of file +var _0x4353=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceTransferReport.controller','isAuthenticated','get','/describe','describe','/:id','post','update','delete','multer'];(function(_0x192014,_0x446e6f){var _0x5b511b=function(_0x311f5f){while(--_0x311f5f){_0x192014['push'](_0x192014['shift']());}};_0x5b511b(++_0x446e6f);}(_0x4353,0xe3));var _0x3435=function(_0x40087e,_0x29a342){_0x40087e=_0x40087e-0x0;var _0x379ce0=_0x4353[_0x40087e];return _0x379ce0;};'use strict';var multer=require(_0x3435('0x0'));var util=require(_0x3435('0x1'));var path=require(_0x3435('0x2'));var timeout=require(_0x3435('0x3'));var express=require(_0x3435('0x4'));var router=express[_0x3435('0x5')]();var fs_extra=require(_0x3435('0x6'));var auth=require(_0x3435('0x7'));var interaction=require(_0x3435('0x8'));var config=require(_0x3435('0x9'));var controller=require(_0x3435('0xa'));router['get']('/',auth[_0x3435('0xb')](),controller['index']);router[_0x3435('0xc')](_0x3435('0xd'),auth['isAuthenticated'](),controller[_0x3435('0xe')]);router[_0x3435('0xc')](_0x3435('0xf'),auth[_0x3435('0xb')](),controller['show']);router[_0x3435('0x10')]('/',auth[_0x3435('0xb')](),controller['create']);router['put'](_0x3435('0xf'),auth[_0x3435('0xb')](),controller[_0x3435('0x11')]);router[_0x3435('0x12')](_0x3435('0xf'),auth['isAuthenticated'](),controller['destroy']);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 0b5ef6a..b58c814 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 _0x9d77=['moment','exports','blind','attended','STRING','ENUM','Yes'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x9d77,0x9a));var _0x79d7=function(_0x56b492,_0x3c7eee){_0x56b492=_0x56b492-0x0;var _0x1e250c=_0x9d77[_0x56b492];return _0x1e250c;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x79d7('0x0'));module[_0x79d7('0x1')]={'type':{'type':Sequelize['ENUM'](_0x79d7('0x2'),_0x79d7('0x3'))},'result':{'type':Sequelize[_0x79d7('0x4')]},'transfererchannel':{'type':Sequelize[_0x79d7('0x4')]},'transferercalleridnum':{'type':Sequelize[_0x79d7('0x4')]},'transferercalleridname':{'type':Sequelize[_0x79d7('0x4')]},'transfererconnectedlinenum':{'type':Sequelize[_0x79d7('0x4')]},'transfererconnectedlinename':{'type':Sequelize['STRING']},'transfereraccountcode':{'type':Sequelize[_0x79d7('0x4')]},'transferercontext':{'type':Sequelize['STRING']},'transfererexten':{'type':Sequelize['STRING']},'transfererlinkedid':{'type':Sequelize[_0x79d7('0x4')]},'transfereechannel':{'type':Sequelize[_0x79d7('0x4')]},'transfereecalleridnum':{'type':Sequelize[_0x79d7('0x4')]},'transfereecalleridname':{'type':Sequelize[_0x79d7('0x4')]},'transfereeconnectedlinenum':{'type':Sequelize[_0x79d7('0x4')]},'transfereeconnectedlinename':{'type':Sequelize['STRING']},'transfereeaccountcode':{'type':Sequelize[_0x79d7('0x4')]},'transfereecontext':{'type':Sequelize[_0x79d7('0x4')]},'transfereeexten':{'type':Sequelize[_0x79d7('0x4')]},'transfereelinkedid':{'type':Sequelize[_0x79d7('0x4')]},'isexternal':{'type':Sequelize[_0x79d7('0x5')](_0x79d7('0x6'),'No')},'context':{'type':Sequelize[_0x79d7('0x4')]},'extension':{'type':Sequelize[_0x79d7('0x4')]}}; \ No newline at end of file +var _0xa940=['ENUM','blind','attended','STRING','Yes','sequelize'];(function(_0x48a6c3,_0x2f00c5){var _0x5546fb=function(_0x2262e5){while(--_0x2262e5){_0x48a6c3['push'](_0x48a6c3['shift']());}};_0x5546fb(++_0x2f00c5);}(_0xa940,0x10d));var _0x0a94=function(_0x4b3300,_0x1137f1){_0x4b3300=_0x4b3300-0x0;var _0x2d26d3=_0xa940[_0x4b3300];return _0x2d26d3;};'use strict';var Sequelize=require(_0x0a94('0x0'));var moment=require('moment');module['exports']={'type':{'type':Sequelize[_0x0a94('0x1')](_0x0a94('0x2'),_0x0a94('0x3'))},'result':{'type':Sequelize['STRING']},'transfererchannel':{'type':Sequelize[_0x0a94('0x4')]},'transferercalleridnum':{'type':Sequelize[_0x0a94('0x4')]},'transferercalleridname':{'type':Sequelize[_0x0a94('0x4')]},'transfererconnectedlinenum':{'type':Sequelize[_0x0a94('0x4')]},'transfererconnectedlinename':{'type':Sequelize[_0x0a94('0x4')]},'transfereraccountcode':{'type':Sequelize['STRING']},'transferercontext':{'type':Sequelize[_0x0a94('0x4')]},'transfererexten':{'type':Sequelize[_0x0a94('0x4')]},'transfererlinkedid':{'type':Sequelize[_0x0a94('0x4')]},'transfereechannel':{'type':Sequelize['STRING']},'transfereecalleridnum':{'type':Sequelize[_0x0a94('0x4')]},'transfereecalleridname':{'type':Sequelize[_0x0a94('0x4')]},'transfereeconnectedlinenum':{'type':Sequelize['STRING']},'transfereeconnectedlinename':{'type':Sequelize['STRING']},'transfereeaccountcode':{'type':Sequelize[_0x0a94('0x4')]},'transfereecontext':{'type':Sequelize[_0x0a94('0x4')]},'transfereeexten':{'type':Sequelize[_0x0a94('0x4')]},'transfereelinkedid':{'type':Sequelize['STRING']},'isexternal':{'type':Sequelize['ENUM'](_0x0a94('0x5'),'No')},'context':{'type':Sequelize[_0x0a94('0x4')]},'extension':{'type':Sequelize[_0x0a94('0x4')]}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index fe42285..0465954 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 _0x7274=['desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','error','stack','name','rawAttributes','fieldName','model','map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','VIRTUAL','filter','VoiceTransferReport','include','findAll','rows','catch','show','params','includeAll','options','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','lodash','squel'];(function(_0x16dfa3,_0x118719){var _0x1209aa=function(_0x104df2){while(--_0x104df2){_0x16dfa3['push'](_0x16dfa3['shift']());}};_0x1209aa(++_0x118719);}(_0x7274,0x8d));var _0x4727=function(_0x2428e8,_0x30492c){_0x2428e8=_0x2428e8-0x0;var _0x42500b=_0x7274[_0x2428e8];return _0x42500b;};'use strict';var emlformat=require(_0x4727('0x0'));var rimraf=require(_0x4727('0x1'));var zipdir=require(_0x4727('0x2'));var jsonpatch=require(_0x4727('0x3'));var rp=require(_0x4727('0x4'));var moment=require(_0x4727('0x5'));var BPromise=require(_0x4727('0x6'));var Mustache=require('mustache');var util=require(_0x4727('0x7'));var path=require(_0x4727('0x8'));var sox=require(_0x4727('0x9'));var csv=require(_0x4727('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4727('0xb'));var squel=require(_0x4727('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x4727('0xd'));var toCsv=require(_0x4727('0xa'));var querystring=require('querystring');var Papa=require(_0x4727('0xe'));var Redis=require(_0x4727('0xf'));var authService=require(_0x4727('0x10'));var qs=require(_0x4727('0x11'));var as=require(_0x4727('0x12'));var hardwareService=require(_0x4727('0x13'));var logger=require('../../config/logger')(_0x4727('0x14'));var utils=require(_0x4727('0x15'));var config=require(_0x4727('0x16'));var licenseUtil=require(_0x4727('0x17'));var db=require(_0x4727('0x18'))['db'];function respondWithStatusCode(_0x417672,_0x3faf71){_0x3faf71=_0x3faf71||0xcc;return function(_0x2d947f){if(_0x2d947f){return _0x417672[_0x4727('0x19')](_0x3faf71);}return _0x417672['status'](_0x3faf71)[_0x4727('0x1a')]();};}function respondWithResult(_0x3d791c,_0x2cc9a9){_0x2cc9a9=_0x2cc9a9||0xc8;return function(_0x369c1f){if(_0x369c1f){return _0x3d791c[_0x4727('0x1b')](_0x2cc9a9)[_0x4727('0x1c')](_0x369c1f);}};}function respondWithFilteredResult(_0x5d055c,_0x4408a7){return function(_0xd802ef){if(_0xd802ef){var _0x86e98a=typeof _0x4408a7[_0x4727('0x1d')]===_0x4727('0x1e')&&typeof _0x4408a7[_0x4727('0x1f')]===_0x4727('0x1e');var _0x5cb4a0=_0xd802ef[_0x4727('0x20')];var _0x33edf8=_0x86e98a?0x0:_0x4408a7['offset'];var _0xae2862=_0x86e98a?_0xd802ef[_0x4727('0x20')]:_0x4408a7[_0x4727('0x1d')]+_0x4408a7['limit'];var _0x119191;if(_0xae2862>=_0x5cb4a0){_0xae2862=_0x5cb4a0;_0x119191=0xc8;}else{_0x119191=0xce;}_0x5d055c[_0x4727('0x1b')](_0x119191);return _0x5d055c[_0x4727('0x21')](_0x4727('0x22'),_0x33edf8+'-'+_0xae2862+'/'+_0x5cb4a0)[_0x4727('0x1c')](_0xd802ef);}return null;};}function patchUpdates(_0x5f15c5){return function(_0x2aa0b5){try{jsonpatch[_0x4727('0x23')](_0x2aa0b5,_0x5f15c5,!![]);}catch(_0x7ffa56){return BPromise['reject'](_0x7ffa56);}return _0x2aa0b5[_0x4727('0x24')]();};}function saveUpdates(_0x5ca89a,_0x57ec2b){return function(_0x54c189){if(_0x54c189){return _0x54c189[_0x4727('0x25')](_0x5ca89a)[_0x4727('0x26')](function(_0x4da850){return _0x4da850;});}return null;};}function removeEntity(_0xbc6b6b,_0x20618f){return function(_0x496cdb){if(_0x496cdb){return _0x496cdb[_0x4727('0x27')]()['then'](function(){_0xbc6b6b['status'](0xcc)[_0x4727('0x1a')]();});}};}function handleEntityNotFound(_0x20bc7a,_0x4fa291){return function(_0xb9eacf){if(!_0xb9eacf){_0x20bc7a['sendStatus'](0x194);}return _0xb9eacf;};}function handleError(_0x3c0c2c,_0x31cd6b){_0x31cd6b=_0x31cd6b||0x1f4;return function(_0x1889d3){logger[_0x4727('0x28')](_0x1889d3[_0x4727('0x29')]);if(_0x1889d3['name']){delete _0x1889d3[_0x4727('0x2a')];}_0x3c0c2c['status'](_0x31cd6b)['send'](_0x1889d3);};}exports['index']=function(_0x5c662e,_0x207308){var _0x6a480d={},_0x447e4d={},_0x1019b5={'count':0x0,'rows':[]};var _0x5c04c5=_['map'](db['VoiceTransferReport'][_0x4727('0x2b')],function(_0x16814a){return{'name':_0x16814a[_0x4727('0x2c')],'type':_0x16814a['type']['key']};});_0x447e4d[_0x4727('0x2d')]=_[_0x4727('0x2e')](_0x5c04c5,'name');_0x447e4d['query']=_[_0x4727('0x2f')](_0x5c662e[_0x4727('0x30')]);_0x447e4d[_0x4727('0x31')]=_[_0x4727('0x32')](_0x447e4d[_0x4727('0x2d')],_0x447e4d[_0x4727('0x30')]);_0x6a480d[_0x4727('0x33')]=_['intersection'](_0x447e4d[_0x4727('0x2d')],qs[_0x4727('0x34')](_0x5c662e[_0x4727('0x30')][_0x4727('0x34')]));_0x6a480d[_0x4727('0x33')]=_0x6a480d['attributes'][_0x4727('0x35')]?_0x6a480d[_0x4727('0x33')]:_0x447e4d[_0x4727('0x2d')];if(!_0x5c662e[_0x4727('0x30')][_0x4727('0x36')](_0x4727('0x37'))){_0x6a480d[_0x4727('0x1f')]=qs[_0x4727('0x1f')](_0x5c662e[_0x4727('0x30')]['limit']);_0x6a480d[_0x4727('0x1d')]=qs['offset'](_0x5c662e[_0x4727('0x30')][_0x4727('0x1d')]);}_0x6a480d[_0x4727('0x38')]=qs[_0x4727('0x39')](_0x5c662e[_0x4727('0x30')]['sort']);_0x6a480d[_0x4727('0x3a')]=qs[_0x4727('0x31')](_[_0x4727('0x3b')](_0x5c662e[_0x4727('0x30')],_0x447e4d[_0x4727('0x31')]),_0x5c04c5);if(_0x5c662e[_0x4727('0x30')]['filter']){_0x6a480d['where']=_[_0x4727('0x3c')](_0x6a480d[_0x4727('0x3a')],{'$or':_[_0x4727('0x2e')](_0x5c04c5,function(_0x452cf6){if(_0x452cf6[_0x4727('0x3d')]!==_0x4727('0x3e')){var _0x122481={};_0x122481[_0x452cf6[_0x4727('0x2a')]]={'$like':'%'+_0x5c662e['query'][_0x4727('0x3f')]+'%'};return _0x122481;}})});}_0x6a480d=_[_0x4727('0x3c')]({},_0x6a480d,_0x5c662e['options']);var _0x26b8dd={'where':_0x6a480d['where']};return db[_0x4727('0x40')][_0x4727('0x20')](_0x26b8dd)[_0x4727('0x26')](function(_0x3ec12b){_0x1019b5[_0x4727('0x20')]=_0x3ec12b;if(_0x5c662e[_0x4727('0x30')]['includeAll']){_0x6a480d[_0x4727('0x41')]=[{'all':!![]}];}return db[_0x4727('0x40')][_0x4727('0x42')](_0x6a480d);})['then'](function(_0x415731){_0x1019b5[_0x4727('0x43')]=_0x415731;return _0x1019b5;})[_0x4727('0x26')](respondWithFilteredResult(_0x207308,_0x6a480d))[_0x4727('0x44')](handleError(_0x207308,null));};exports[_0x4727('0x45')]=function(_0x4b7f48,_0x1e197a){var _0x282d6d={'raw':!![],'where':{'id':_0x4b7f48[_0x4727('0x46')]['id']}},_0x469f7a={};_0x469f7a[_0x4727('0x2d')]=_[_0x4727('0x2f')](db['VoiceTransferReport']['rawAttributes']);_0x469f7a[_0x4727('0x30')]=_[_0x4727('0x2f')](_0x4b7f48[_0x4727('0x30')]);_0x469f7a[_0x4727('0x31')]=_['intersection'](_0x469f7a['model'],_0x469f7a[_0x4727('0x30')]);_0x282d6d['attributes']=_[_0x4727('0x32')](_0x469f7a[_0x4727('0x2d')],qs[_0x4727('0x34')](_0x4b7f48['query'][_0x4727('0x34')]));_0x282d6d['attributes']=_0x282d6d[_0x4727('0x33')]['length']?_0x282d6d[_0x4727('0x33')]:_0x469f7a['model'];if(_0x4b7f48[_0x4727('0x30')][_0x4727('0x47')]){_0x282d6d[_0x4727('0x41')]=[{'all':!![]}];}_0x282d6d=_['merge']({},_0x282d6d,_0x4b7f48[_0x4727('0x48')]);return db['VoiceTransferReport']['find'](_0x282d6d)[_0x4727('0x26')](handleEntityNotFound(_0x1e197a,null))['then'](respondWithResult(_0x1e197a,null))[_0x4727('0x44')](handleError(_0x1e197a,null));};exports[_0x4727('0x49')]=function(_0x454d80,_0xcad93d){return db[_0x4727('0x40')]['create'](_0x454d80[_0x4727('0x4a')],{})['then'](respondWithResult(_0xcad93d,0xc9))[_0x4727('0x44')](handleError(_0xcad93d,null));};exports[_0x4727('0x25')]=function(_0x289376,_0x2b654a){if(_0x289376[_0x4727('0x4a')]['id']){delete _0x289376[_0x4727('0x4a')]['id'];}return db[_0x4727('0x40')][_0x4727('0x4b')]({'where':{'id':_0x289376['params']['id']}})[_0x4727('0x26')](handleEntityNotFound(_0x2b654a,null))['then'](saveUpdates(_0x289376[_0x4727('0x4a')],null))[_0x4727('0x26')](respondWithResult(_0x2b654a,null))[_0x4727('0x44')](handleError(_0x2b654a,null));};exports['destroy']=function(_0x126dfd,_0x3a00cf){return db[_0x4727('0x40')][_0x4727('0x4b')]({'where':{'id':_0x126dfd[_0x4727('0x46')]['id']}})[_0x4727('0x26')](handleEntityNotFound(_0x3a00cf,null))[_0x4727('0x26')](removeEntity(_0x3a00cf,null))[_0x4727('0x44')](handleError(_0x3a00cf,null));};exports[_0x4727('0x4c')]=function(_0x408589,_0x343b61){return db[_0x4727('0x40')]['describe']()[_0x4727('0x26')](respondWithResult(_0x343b61,null))[_0x4727('0x44')](handleError(_0x343b61,null));}; \ No newline at end of file +var _0x08de=['include','VoiceTransferReport','rows','catch','params','length','create','body','find','describe','rimraf','request-promise','moment','bluebird','mustache','util','path','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','sendStatus','status','json','offset','limit','undefined','set','Content-Range','reject','save','update','then','end','error','name','send','rawAttributes','type','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','map','options','count','includeAll'];(function(_0x1e6011,_0x42aa38){var _0x10112e=function(_0x466611){while(--_0x466611){_0x1e6011['push'](_0x1e6011['shift']());}};_0x10112e(++_0x42aa38);}(_0x08de,0x15e));var _0xe08d=function(_0x356e8d,_0x24c719){_0x356e8d=_0x356e8d-0x0;var _0x39e65a=_0x08de[_0x356e8d];return _0x39e65a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe08d('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xe08d('0x1'));var moment=require(_0xe08d('0x2'));var BPromise=require(_0xe08d('0x3'));var Mustache=require(_0xe08d('0x4'));var util=require(_0xe08d('0x5'));var path=require(_0xe08d('0x6'));var sox=require('sox');var csv=require(_0xe08d('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe08d('0x8'));var squel=require(_0xe08d('0x9'));var crypto=require(_0xe08d('0xa'));var jsforce=require(_0xe08d('0xb'));var deskjs=require(_0xe08d('0xc'));var toCsv=require(_0xe08d('0x7'));var querystring=require(_0xe08d('0xd'));var Papa=require(_0xe08d('0xe'));var Redis=require(_0xe08d('0xf'));var authService=require(_0xe08d('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xe08d('0x11'));var hardwareService=require(_0xe08d('0x12'));var logger=require('../../config/logger')(_0xe08d('0x13'));var utils=require(_0xe08d('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xe08d('0x15'))['db'];function respondWithStatusCode(_0x869915,_0x48e6e1){_0x48e6e1=_0x48e6e1||0xcc;return function(_0x25a7c3){if(_0x25a7c3){return _0x869915[_0xe08d('0x16')](_0x48e6e1);}return _0x869915[_0xe08d('0x17')](_0x48e6e1)['end']();};}function respondWithResult(_0x21410c,_0xa1c01b){_0xa1c01b=_0xa1c01b||0xc8;return function(_0x108271){if(_0x108271){return _0x21410c['status'](_0xa1c01b)[_0xe08d('0x18')](_0x108271);}};}function respondWithFilteredResult(_0x936c80,_0x4e322a){return function(_0x1e1fc1){if(_0x1e1fc1){var _0x433b8b=typeof _0x4e322a[_0xe08d('0x19')]==='undefined'&&typeof _0x4e322a[_0xe08d('0x1a')]===_0xe08d('0x1b');var _0x4d4bf0=_0x1e1fc1['count'];var _0x4455d3=_0x433b8b?0x0:_0x4e322a[_0xe08d('0x19')];var _0x556e03=_0x433b8b?_0x1e1fc1['count']:_0x4e322a[_0xe08d('0x19')]+_0x4e322a[_0xe08d('0x1a')];var _0x3a9bf4;if(_0x556e03>=_0x4d4bf0){_0x556e03=_0x4d4bf0;_0x3a9bf4=0xc8;}else{_0x3a9bf4=0xce;}_0x936c80[_0xe08d('0x17')](_0x3a9bf4);return _0x936c80[_0xe08d('0x1c')](_0xe08d('0x1d'),_0x4455d3+'-'+_0x556e03+'/'+_0x4d4bf0)[_0xe08d('0x18')](_0x1e1fc1);}return null;};}function patchUpdates(_0x11cc5e){return function(_0x259c1c){try{jsonpatch['apply'](_0x259c1c,_0x11cc5e,!![]);}catch(_0x2146fa){return BPromise[_0xe08d('0x1e')](_0x2146fa);}return _0x259c1c[_0xe08d('0x1f')]();};}function saveUpdates(_0x18af45,_0x1d1ad6){return function(_0x2ca943){if(_0x2ca943){return _0x2ca943[_0xe08d('0x20')](_0x18af45)[_0xe08d('0x21')](function(_0x95f5bf){return _0x95f5bf;});}return null;};}function removeEntity(_0x4c14c8,_0x3bf712){return function(_0x14f585){if(_0x14f585){return _0x14f585['destroy']()[_0xe08d('0x21')](function(){_0x4c14c8['status'](0xcc)[_0xe08d('0x22')]();});}};}function handleEntityNotFound(_0x18d5ca,_0x1b99ee){return function(_0x271b3e){if(!_0x271b3e){_0x18d5ca['sendStatus'](0x194);}return _0x271b3e;};}function handleError(_0x38b29e,_0x1923f5){_0x1923f5=_0x1923f5||0x1f4;return function(_0x3e2cd7){logger[_0xe08d('0x23')](_0x3e2cd7['stack']);if(_0x3e2cd7[_0xe08d('0x24')]){delete _0x3e2cd7[_0xe08d('0x24')];}_0x38b29e[_0xe08d('0x17')](_0x1923f5)[_0xe08d('0x25')](_0x3e2cd7);};}exports['index']=function(_0x4ea446,_0x22737d){var _0x34dfea={},_0x1cdeb5={},_0x1f7ef9={'count':0x0,'rows':[]};var _0x48adec=_['map'](db['VoiceTransferReport'][_0xe08d('0x26')],function(_0x325726){return{'name':_0x325726['fieldName'],'type':_0x325726[_0xe08d('0x27')]['key']};});_0x1cdeb5[_0xe08d('0x28')]=_['map'](_0x48adec,_0xe08d('0x24'));_0x1cdeb5['query']=_[_0xe08d('0x29')](_0x4ea446[_0xe08d('0x2a')]);_0x1cdeb5[_0xe08d('0x2b')]=_[_0xe08d('0x2c')](_0x1cdeb5[_0xe08d('0x28')],_0x1cdeb5[_0xe08d('0x2a')]);_0x34dfea[_0xe08d('0x2d')]=_[_0xe08d('0x2c')](_0x1cdeb5[_0xe08d('0x28')],qs[_0xe08d('0x2e')](_0x4ea446['query']['fields']));_0x34dfea[_0xe08d('0x2d')]=_0x34dfea[_0xe08d('0x2d')]['length']?_0x34dfea[_0xe08d('0x2d')]:_0x1cdeb5['model'];if(!_0x4ea446[_0xe08d('0x2a')][_0xe08d('0x2f')](_0xe08d('0x30'))){_0x34dfea[_0xe08d('0x1a')]=qs['limit'](_0x4ea446[_0xe08d('0x2a')]['limit']);_0x34dfea[_0xe08d('0x19')]=qs[_0xe08d('0x19')](_0x4ea446[_0xe08d('0x2a')][_0xe08d('0x19')]);}_0x34dfea[_0xe08d('0x31')]=qs[_0xe08d('0x32')](_0x4ea446[_0xe08d('0x2a')][_0xe08d('0x32')]);_0x34dfea[_0xe08d('0x33')]=qs[_0xe08d('0x2b')](_['pick'](_0x4ea446['query'],_0x1cdeb5[_0xe08d('0x2b')]),_0x48adec);if(_0x4ea446[_0xe08d('0x2a')][_0xe08d('0x34')]){_0x34dfea[_0xe08d('0x33')]=_[_0xe08d('0x35')](_0x34dfea[_0xe08d('0x33')],{'$or':_[_0xe08d('0x36')](_0x48adec,function(_0x2be462){if(_0x2be462['type']!=='VIRTUAL'){var _0x507a1c={};_0x507a1c[_0x2be462[_0xe08d('0x24')]]={'$like':'%'+_0x4ea446[_0xe08d('0x2a')][_0xe08d('0x34')]+'%'};return _0x507a1c;}})});}_0x34dfea=_[_0xe08d('0x35')]({},_0x34dfea,_0x4ea446[_0xe08d('0x37')]);var _0x2701c7={'where':_0x34dfea[_0xe08d('0x33')]};return db['VoiceTransferReport']['count'](_0x2701c7)[_0xe08d('0x21')](function(_0x1b3e42){_0x1f7ef9[_0xe08d('0x38')]=_0x1b3e42;if(_0x4ea446[_0xe08d('0x2a')][_0xe08d('0x39')]){_0x34dfea[_0xe08d('0x3a')]=[{'all':!![]}];}return db[_0xe08d('0x3b')]['findAll'](_0x34dfea);})[_0xe08d('0x21')](function(_0x495394){_0x1f7ef9[_0xe08d('0x3c')]=_0x495394;return _0x1f7ef9;})['then'](respondWithFilteredResult(_0x22737d,_0x34dfea))[_0xe08d('0x3d')](handleError(_0x22737d,null));};exports['show']=function(_0x3f926f,_0x3f6148){var _0x429414={'raw':!![],'where':{'id':_0x3f926f[_0xe08d('0x3e')]['id']}},_0x4fa651={};_0x4fa651['model']=_[_0xe08d('0x29')](db['VoiceTransferReport'][_0xe08d('0x26')]);_0x4fa651[_0xe08d('0x2a')]=_[_0xe08d('0x29')](_0x3f926f[_0xe08d('0x2a')]);_0x4fa651['filters']=_['intersection'](_0x4fa651[_0xe08d('0x28')],_0x4fa651[_0xe08d('0x2a')]);_0x429414[_0xe08d('0x2d')]=_[_0xe08d('0x2c')](_0x4fa651[_0xe08d('0x28')],qs['fields'](_0x3f926f['query'][_0xe08d('0x2e')]));_0x429414[_0xe08d('0x2d')]=_0x429414['attributes'][_0xe08d('0x3f')]?_0x429414['attributes']:_0x4fa651[_0xe08d('0x28')];if(_0x3f926f[_0xe08d('0x2a')]['includeAll']){_0x429414['include']=[{'all':!![]}];}_0x429414=_['merge']({},_0x429414,_0x3f926f[_0xe08d('0x37')]);return db[_0xe08d('0x3b')]['find'](_0x429414)[_0xe08d('0x21')](handleEntityNotFound(_0x3f6148,null))[_0xe08d('0x21')](respondWithResult(_0x3f6148,null))[_0xe08d('0x3d')](handleError(_0x3f6148,null));};exports[_0xe08d('0x40')]=function(_0xd91a29,_0xedcff6){return db[_0xe08d('0x3b')]['create'](_0xd91a29[_0xe08d('0x41')],{})['then'](respondWithResult(_0xedcff6,0xc9))[_0xe08d('0x3d')](handleError(_0xedcff6,null));};exports[_0xe08d('0x20')]=function(_0x170a1c,_0x49fb62){if(_0x170a1c[_0xe08d('0x41')]['id']){delete _0x170a1c['body']['id'];}return db['VoiceTransferReport']['find']({'where':{'id':_0x170a1c['params']['id']}})[_0xe08d('0x21')](handleEntityNotFound(_0x49fb62,null))[_0xe08d('0x21')](saveUpdates(_0x170a1c[_0xe08d('0x41')],null))[_0xe08d('0x21')](respondWithResult(_0x49fb62,null))[_0xe08d('0x3d')](handleError(_0x49fb62,null));};exports['destroy']=function(_0x10b329,_0x2ea702){return db['VoiceTransferReport'][_0xe08d('0x42')]({'where':{'id':_0x10b329['params']['id']}})[_0xe08d('0x21')](handleEntityNotFound(_0x2ea702,null))[_0xe08d('0x21')](removeEntity(_0x2ea702,null))[_0xe08d('0x3d')](handleError(_0x2ea702,null));};exports[_0xe08d('0x43')]=function(_0x1a1e57,_0x50df59){return db[_0xe08d('0x3b')][_0xe08d('0x43')]()[_0xe08d('0x21')](respondWithResult(_0x50df59,null))[_0xe08d('0x3d')](handleError(_0x50df59,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index d459569..debff67 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 _0x1bf0=['exports','define','VoiceTransferReport','report_call_transfer','lodash','util','../../config/logger','api','bluebird','path','../../config/environment','./voiceTransferReport.attributes'];(function(_0x4b40a2,_0x4a8b83){var _0x5d2478=function(_0x3255f4){while(--_0x3255f4){_0x4b40a2['push'](_0x4b40a2['shift']());}};_0x5d2478(++_0x4a8b83);}(_0x1bf0,0x10c));var _0x01bf=function(_0xcb179d,_0x4e4fc8){_0xcb179d=_0xcb179d-0x0;var _0x41a6b5=_0x1bf0[_0xcb179d];return _0x41a6b5;};'use strict';var _=require(_0x01bf('0x0'));var util=require(_0x01bf('0x1'));var logger=require(_0x01bf('0x2'))(_0x01bf('0x3'));var moment=require('moment');var BPromise=require(_0x01bf('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x01bf('0x5'));var rimraf=require('rimraf');var config=require(_0x01bf('0x6'));var attributes=require(_0x01bf('0x7'));module[_0x01bf('0x8')]=function(_0x446979,_0x443094){return _0x446979[_0x01bf('0x9')](_0x01bf('0xa'),attributes,{'tableName':_0x01bf('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5647=['bluebird','request-promise','path','../../config/environment','./voiceTransferReport.attributes','exports','define','VoiceTransferReport','report_call_transfer','lodash','../../config/logger','api','moment'];(function(_0xa30c0f,_0x37e076){var _0x7d45f3=function(_0x1ac992){while(--_0x1ac992){_0xa30c0f['push'](_0xa30c0f['shift']());}};_0x7d45f3(++_0x37e076);}(_0x5647,0x15b));var _0x7564=function(_0x115af5,_0x59dc08){_0x115af5=_0x115af5-0x0;var _0x55cbcd=_0x5647[_0x115af5];return _0x55cbcd;};'use strict';var _=require(_0x7564('0x0'));var util=require('util');var logger=require(_0x7564('0x1'))(_0x7564('0x2'));var moment=require(_0x7564('0x3'));var BPromise=require(_0x7564('0x4'));var rp=require(_0x7564('0x5'));var fs=require('fs');var path=require(_0x7564('0x6'));var rimraf=require('rimraf');var config=require(_0x7564('0x7'));var attributes=require(_0x7564('0x8'));module[_0x7564('0x9')]=function(_0x49bd4a,_0x255b29){return _0x49bd4a[_0x7564('0xa')](_0x7564('0xb'),attributes,{'tableName':_0x7564('0xc'),'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 67455bf..01410d9 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 _0x86d7=['request\x20sent','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceTransferReport,\x20%s,\x20%s','message','result','catch','CreateVoiceTransferReport','VoiceTransferReport','create','body','options','raw','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','request','then','info'];(function(_0x5769ff,_0x199df5){var _0x4341b0=function(_0x1762cb){while(--_0x1762cb){_0x5769ff['push'](_0x5769ff['shift']());}};_0x4341b0(++_0x199df5);}(_0x86d7,0xe8));var _0x786d=function(_0x198a85,_0x31bf8b){_0x198a85=_0x198a85-0x0;var _0x4ca50d=_0x86d7[_0x198a85];return _0x4ca50d;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x786d('0x0'));var BPromise=require('bluebird');var rs=require(_0x786d('0x1'));var fs=require('fs');var Redis=require(_0x786d('0x2'));var db=require(_0x786d('0x3'))['db'];var utils=require(_0x786d('0x4'));var logger=require(_0x786d('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x786d('0x6'));var client=jayson[_0x786d('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4ae2d9,_0x4f5f31,_0x3843db){return new BPromise(function(_0x41dbaf,_0xae38c1){return client[_0x786d('0x8')](_0x4ae2d9,_0x3843db)[_0x786d('0x9')](function(_0x4107c0){logger[_0x786d('0xa')]('VoiceTransferReport,\x20%s,\x20%s',_0x4f5f31,_0x786d('0xb'));logger[_0x786d('0xc')](_0x786d('0xd'),_0x4f5f31,_0x786d('0xb'),JSON[_0x786d('0xe')](_0x4107c0));if(_0x4107c0[_0x786d('0xf')]){if(_0x4107c0[_0x786d('0xf')][_0x786d('0x10')]===0x1f4){logger[_0x786d('0xf')](_0x786d('0x11'),_0x4f5f31,_0x4107c0[_0x786d('0xf')][_0x786d('0x12')]);return _0xae38c1(_0x4107c0[_0x786d('0xf')][_0x786d('0x12')]);}logger[_0x786d('0xf')](_0x786d('0x11'),_0x4f5f31,_0x4107c0[_0x786d('0xf')][_0x786d('0x12')]);return _0x41dbaf(_0x4107c0[_0x786d('0xf')][_0x786d('0x12')]);}else{logger[_0x786d('0xa')]('VoiceTransferReport,\x20%s,\x20%s',_0x4f5f31,'request\x20sent');_0x41dbaf(_0x4107c0[_0x786d('0x13')][_0x786d('0x12')]);}})[_0x786d('0x14')](function(_0x5849ca){logger[_0x786d('0xf')](_0x786d('0x11'),_0x4f5f31,_0x5849ca);_0xae38c1(_0x5849ca);});});}exports[_0x786d('0x15')]=function(_0x11b922){var _0x51f120=this;return new Promise(function(_0x44dac3,_0x126d84){return db[_0x786d('0x16')][_0x786d('0x17')](_0x11b922[_0x786d('0x18')],{'raw':_0x11b922[_0x786d('0x19')]?_0x11b922[_0x786d('0x19')][_0x786d('0x1a')]===undefined?!![]:![]:!![]})[_0x786d('0x9')](function(_0x50f16d){logger[_0x786d('0xa')]('CreateVoiceTransferReport',_0x11b922);logger['debug']('CreateVoiceTransferReport',_0x11b922,JSON['stringify'](_0x50f16d));_0x44dac3(_0x50f16d);})[_0x786d('0x14')](function(_0x48a6e0){logger[_0x786d('0xf')](_0x786d('0x15'),_0x48a6e0[_0x786d('0x12')],_0x11b922);_0x126d84(_0x51f120[_0x786d('0xf')](0x1f4,_0x48a6e0[_0x786d('0x12')]));});});}; \ No newline at end of file +var _0xf841=['message','CreateVoiceTransferReport','VoiceTransferReport','options','raw','catch','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code'];(function(_0x3dc126,_0x13e0d7){var _0x451c2c=function(_0x5a69a9){while(--_0x5a69a9){_0x3dc126['push'](_0x3dc126['shift']());}};_0x451c2c(++_0x13e0d7);}(_0xf841,0x19e));var _0x1f84=function(_0x318410,_0x451962){_0x318410=_0x318410-0x0;var _0x2898a3=_0xf841[_0x318410];return _0x2898a3;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1f84('0x0'));var BPromise=require(_0x1f84('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1f84('0x2'));var db=require(_0x1f84('0x3'))['db'];var utils=require(_0x1f84('0x4'));var logger=require(_0x1f84('0x5'))(_0x1f84('0x6'));var config=require(_0x1f84('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x1f84('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x8cc7c2,_0x1d00c3,_0x1a35bb){return new BPromise(function(_0x43b207,_0x4ca235){return client[_0x1f84('0x9')](_0x8cc7c2,_0x1a35bb)[_0x1f84('0xa')](function(_0x416638){logger[_0x1f84('0xb')](_0x1f84('0xc'),_0x1d00c3,_0x1f84('0xd'));logger[_0x1f84('0xe')]('VoiceTransferReport,\x20%s,\x20%s,\x20%s',_0x1d00c3,'request\x20sent',JSON[_0x1f84('0xf')](_0x416638));if(_0x416638['error']){if(_0x416638[_0x1f84('0x10')][_0x1f84('0x11')]===0x1f4){logger[_0x1f84('0x10')](_0x1f84('0xc'),_0x1d00c3,_0x416638[_0x1f84('0x10')][_0x1f84('0x12')]);return _0x4ca235(_0x416638[_0x1f84('0x10')][_0x1f84('0x12')]);}logger[_0x1f84('0x10')]('VoiceTransferReport,\x20%s,\x20%s',_0x1d00c3,_0x416638[_0x1f84('0x10')][_0x1f84('0x12')]);return _0x43b207(_0x416638['error'][_0x1f84('0x12')]);}else{logger[_0x1f84('0xb')](_0x1f84('0xc'),_0x1d00c3,_0x1f84('0xd'));_0x43b207(_0x416638['result'][_0x1f84('0x12')]);}})['catch'](function(_0x83677a){logger[_0x1f84('0x10')](_0x1f84('0xc'),_0x1d00c3,_0x83677a);_0x4ca235(_0x83677a);});});}exports[_0x1f84('0x13')]=function(_0x5520de){var _0x538362=this;return new Promise(function(_0x1036ac,_0x44162a){return db[_0x1f84('0x14')]['create'](_0x5520de['body'],{'raw':_0x5520de[_0x1f84('0x15')]?_0x5520de[_0x1f84('0x15')][_0x1f84('0x16')]===undefined?!![]:![]:!![]})[_0x1f84('0xa')](function(_0x3306f4){logger[_0x1f84('0xb')]('CreateVoiceTransferReport',_0x5520de);logger[_0x1f84('0xe')](_0x1f84('0x13'),_0x5520de,JSON[_0x1f84('0xf')](_0x3306f4));_0x1036ac(_0x3306f4);})[_0x1f84('0x17')](function(_0x1c29d7){logger[_0x1f84('0x10')](_0x1f84('0x13'),_0x1c29d7[_0x1f84('0x12')],_0x5520de);_0x44162a(_0x538362[_0x1f84('0x10')](0x1f4,_0x1c29d7['message']));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index 9d748e3..07f46b0 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 _0x54ef=['unhold','/calls','/transfer','transfer','express','Router','../../components/auth/service','post','/originate','isAuthenticated','isWebrtcLicence','originate','/hangup','hangup','/answer','/hold','hold','/unhold'];(function(_0x5ca8fa,_0x58516a){var _0x4cf9c1=function(_0x2dc668){while(--_0x2dc668){_0x5ca8fa['push'](_0x5ca8fa['shift']());}};_0x4cf9c1(++_0x58516a);}(_0x54ef,0x112));var _0xf54e=function(_0x20bc28,_0x268791){_0x20bc28=_0x20bc28-0x0;var _0x337859=_0x54ef[_0x20bc28];return _0x337859;};'use strict';var express=require(_0xf54e('0x0'));var router=express[_0xf54e('0x1')]();var auth=require(_0xf54e('0x2'));var controller=require('./webbar.controller');router[_0xf54e('0x3')](_0xf54e('0x4'),auth[_0xf54e('0x5')](),auth[_0xf54e('0x6')](),controller[_0xf54e('0x7')]);router[_0xf54e('0x3')](_0xf54e('0x8'),auth['isAuthenticated'](),auth['isWebrtcLicence'](),controller[_0xf54e('0x9')]);router[_0xf54e('0x3')](_0xf54e('0xa'),auth['isAuthenticated'](),auth[_0xf54e('0x6')](),controller['answer']);router[_0xf54e('0x3')](_0xf54e('0xb'),auth['isAuthenticated'](),auth[_0xf54e('0x6')](),controller[_0xf54e('0xc')]);router[_0xf54e('0x3')](_0xf54e('0xd'),auth['isAuthenticated'](),auth[_0xf54e('0x6')](),controller[_0xf54e('0xe')]);router[_0xf54e('0x3')](_0xf54e('0xf'),auth['isAuthenticated'](),auth[_0xf54e('0x6')](),controller['calls']);router['post'](_0xf54e('0x10'),auth[_0xf54e('0x5')](),auth[_0xf54e('0x6')](),controller[_0xf54e('0x11')]);module['exports']=router; \ No newline at end of file +var _0x9c44=['/answer','answer','/hold','/unhold','unhold','/transfer','transfer','exports','../../components/auth/service','./webbar.controller','post','/originate','isAuthenticated','isWebrtcLicence','/hangup','hangup'];(function(_0x145b3c,_0x31ea4a){var _0x1b6e36=function(_0xfccee6){while(--_0xfccee6){_0x145b3c['push'](_0x145b3c['shift']());}};_0x1b6e36(++_0x31ea4a);}(_0x9c44,0x178));var _0x49c4=function(_0x15bc81,_0x4d4f77){_0x15bc81=_0x15bc81-0x0;var _0x59440e=_0x9c44[_0x15bc81];return _0x59440e;};'use strict';var express=require('express');var router=express['Router']();var auth=require(_0x49c4('0x0'));var controller=require(_0x49c4('0x1'));router[_0x49c4('0x2')](_0x49c4('0x3'),auth[_0x49c4('0x4')](),auth[_0x49c4('0x5')](),controller['originate']);router['post'](_0x49c4('0x6'),auth['isAuthenticated'](),auth[_0x49c4('0x5')](),controller[_0x49c4('0x7')]);router[_0x49c4('0x2')](_0x49c4('0x8'),auth[_0x49c4('0x4')](),auth['isWebrtcLicence'](),controller[_0x49c4('0x9')]);router[_0x49c4('0x2')](_0x49c4('0xa'),auth[_0x49c4('0x4')](),auth['isWebrtcLicence'](),controller['hold']);router[_0x49c4('0x2')](_0x49c4('0xb'),auth['isAuthenticated'](),auth[_0x49c4('0x5')](),controller[_0x49c4('0xc')]);router['post']('/calls',auth[_0x49c4('0x4')](),auth[_0x49c4('0x5')](),controller['calls']);router[_0x49c4('0x2')](_0x49c4('0xd'),auth['isAuthenticated'](),auth[_0x49c4('0x5')](),controller[_0x49c4('0xe')]);module[_0x49c4('0xf')]=router; \ No newline at end of file diff --git a/server/api/webbar/webbar.controller.js b/server/api/webbar/webbar.controller.js index 47d0630..1e0cda7 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 _0xa588=['client','http','../../config/logger','ioredis','redis','defaults','localhost','socket.io-emitter','validate','userId\x20is\x20required','string','callNumber\x20is\x20required','number','sessionId\x20is\x20required','emit','handleError:','error','name','status','send','NotFound','request','then','code','message','result','catch','User','findOne','VoiceChannels','all','filter','rows','UserId','sessionId','length','sessionId\x20','\x20not\x20found!','originate','info','originate\x20fired:','body','json','userId','callNumber','callbackUrl','entityFound:','format','user:%s','webbar:originate','originate\x20executed!','hangup','hangup\x20fired:','webbar:hangup','answer','answer\x20fired:','webbar:answer','hold','hold\x20fired:','webbar:hold','hold\x20executed!','unhold\x20fired:','webbar:unhold','unhold\x20executed!','calls','calls\x20fired:','conference','transfer','transferNumber','webbar:transfer','transfer\x20executed!','lodash','../../mysqldb','../../config/environment','util','bluebird','jayson/promise'];(function(_0x502036,_0x502686){var _0x485247=function(_0x135ee3){while(--_0x135ee3){_0x502036['push'](_0x502036['shift']());}};_0x485247(++_0x502686);}(_0xa588,0xe1));var _0x8a58=function(_0x59ab65,_0x410a52){_0x59ab65=_0x59ab65-0x0;var _0x57db9b=_0xa588[_0x59ab65];return _0x57db9b;};'use strict';var path=require('path');var fs=require('fs');var _=require(_0x8a58('0x0'));var db=require(_0x8a58('0x1'))['db'];var config=require(_0x8a58('0x2'));var util=require(_0x8a58('0x3'));var BPromise=require(_0x8a58('0x4'));var jayson=require(_0x8a58('0x5'));var amiClient=jayson[_0x8a58('0x6')][_0x8a58('0x7')]({'port':0x232a});var logger=require(_0x8a58('0x8'))('webbarapi');var Redis=require(_0x8a58('0x9'));config[_0x8a58('0xa')]=_[_0x8a58('0xb')](config[_0x8a58('0xa')],{'host':_0x8a58('0xc'),'port':0x18eb});var io=require(_0x8a58('0xd'))(new Redis(config[_0x8a58('0xa')]));var Schema=require(_0x8a58('0xe'));var originateValidation=new Schema({'userId':{'type':'number','required':[!![],_0x8a58('0xf')]},'callNumber':{'type':_0x8a58('0x10'),'required':[!![],_0x8a58('0x11')]},'callerId':{'type':_0x8a58('0x10')},'callbackUrl':{'type':_0x8a58('0x10')}});var hangupValidation=new Schema({'userId':{'type':'number','required':[!![],_0x8a58('0xf')]},'sessionId':{'type':_0x8a58('0x10'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0x8a58('0x12'),'required':[!![],_0x8a58('0xf')]},'sessionId':{'type':'string','required':![]}});var transferValidation=new Schema({'userId':{'type':'number','required':[!![],_0x8a58('0xf')]},'sessionId':{'type':'string','required':[!![],_0x8a58('0x13')]},'transferNumber':{'type':_0x8a58('0x10'),'required':[!![],'transferNumber\x20is\x20required']}});var holdValidation=new Schema({'userId':{'type':_0x8a58('0x12'),'required':[!![],_0x8a58('0xf')]},'sessionId':{'type':'string','required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x8a58('0x12'),'required':[!![],_0x8a58('0xf')]},'sessionId':{'type':'string','required':![]}});var callsValidation=new Schema({'userId':{'type':_0x8a58('0x12'),'required':[!![],_0x8a58('0xf')]}});var conferenceValidation=new Schema({'userId':{'type':_0x8a58('0x12'),'required':[!![],_0x8a58('0xf')]}});function emit(_0x26e3a8,_0xd967db,_0xddfaae){logger['info'](_0x26e3a8,_0xd967db,JSON['stringify'](_0xddfaae));io['to'](_0x26e3a8)[_0x8a58('0x14')](_0xd967db,_0xddfaae);}function handleError(_0x107e0a){return function(_0x18a14d){console['log'](_0x8a58('0x15'),_0x18a14d,_0x18a14d instanceof RangeError);logger[_0x8a58('0x16')](_0x18a14d['stack']);if(_0x18a14d instanceof RangeError){if(_0x18a14d[_0x8a58('0x17')]){delete _0x18a14d[_0x8a58('0x17')];}_0x107e0a[_0x8a58('0x18')](0x194)[_0x8a58('0x19')](_0x18a14d);}else{if(_0x18a14d[_0x8a58('0x17')]){delete _0x18a14d[_0x8a58('0x17')];}_0x107e0a[_0x8a58('0x18')](0x1f4)[_0x8a58('0x19')](_0x18a14d);}};}function checkError(){return function(_0x92951){if(!_0x92951){throw new RangeError(_0x8a58('0x1a'));}return _0x92951;};}function respondWithRpcPromise(_0xb20cfe,_0x844b58){return new BPromise(function(_0x3758fa,_0x34adb8){var _0x561a9a=amiClient;return _0x561a9a[_0x8a58('0x1b')](_0xb20cfe,_0x844b58)[_0x8a58('0x1c')](function(_0x20a6c5){if(_0x20a6c5[_0x8a58('0x16')]){if(_0x20a6c5[_0x8a58('0x16')][_0x8a58('0x1d')]===0x1f4){return _0x34adb8(_0x20a6c5[_0x8a58('0x16')]['message']);}return _0x3758fa(_0x20a6c5[_0x8a58('0x16')][_0x8a58('0x1e')]);}else{_0x3758fa(_0x20a6c5[_0x8a58('0x1f')]);}})[_0x8a58('0x20')](function(_0x4fb0fb){_0x34adb8(_0x4fb0fb);});});}function getAgent(_0x1e9c3b){return db[_0x8a58('0x21')][_0x8a58('0x22')]({'where':{'id':_0x1e9c3b,'role':'agent'}})[_0x8a58('0x1c')](checkError());}function getAgentCheckSession(_0x31abcc,_0x4426ff){return new BPromise(function(_0x27d7c8,_0x367aec){var _0x3e317f=respondWithRpcPromise(_0x8a58('0x23'));var _0x4d5041=getAgent(_0x31abcc);Promise[_0x8a58('0x24')]([_0x3e317f,_0x4d5041])['then'](function(_0x501aa1){var _0x5e7265=_0x501aa1[0x0];var _0x4cfc96=_0x501aa1[0x1];var _0x5a9c53=_[_0x8a58('0x25')](_0x5e7265[_0x8a58('0x26')],function(_0x1b2d9e){return _0x1b2d9e[_0x8a58('0x27')]==_0x4cfc96['id']&&_0x1b2d9e[_0x8a58('0x28')]==_0x4426ff;});if(_0x5a9c53[_0x8a58('0x29')]==0x1){_0x27d7c8(_0x4cfc96);}else{_0x367aec(new RangeError(_0x8a58('0x2a')+_0x4426ff+_0x8a58('0x2b')));}});});}exports[_0x8a58('0x2c')]=function(_0x3d9e3a,_0x8ab99c){logger[_0x8a58('0x2d')](_0x8a58('0x2e'),_0x3d9e3a['body']);var _0x330e8a=originateValidation[_0x8a58('0xe')](_0x3d9e3a[_0x8a58('0x2f')]);if(_0x330e8a[_0x8a58('0x29')]>0x0){return _0x8ab99c[_0x8a58('0x18')](0x190)[_0x8a58('0x30')](_0x330e8a);}var _0x50c73d=_0x3d9e3a[_0x8a58('0x2f')][_0x8a58('0x31')];var _0x25ecd6=_0x3d9e3a[_0x8a58('0x2f')][_0x8a58('0x32')];var _0x264cc7=_0x3d9e3a[_0x8a58('0x2f')]['callerId'];var _0x3d1fb0=_0x3d9e3a[_0x8a58('0x2f')][_0x8a58('0x33')];return getAgent(_0x50c73d)['then'](function(_0x5ecfea){logger['info'](_0x8a58('0x34'),_0x5ecfea[_0x8a58('0x17')]);emit(util[_0x8a58('0x35')](_0x8a58('0x36'),_0x5ecfea['name']),_0x8a58('0x37'),{'callNumber':_0x25ecd6,'callerId':_0x264cc7,'callbackUrl':_0x3d1fb0});return _0x8ab99c[_0x8a58('0x18')](0xc8)[_0x8a58('0x30')]({'error':![],'message':_0x8a58('0x38')});})['catch'](handleError(_0x8ab99c));};exports[_0x8a58('0x39')]=function(_0x2a7c70,_0x5aad83){logger[_0x8a58('0x2d')](_0x8a58('0x3a'),_0x2a7c70[_0x8a58('0x2f')]);var _0x35d930=hangupValidation[_0x8a58('0xe')](_0x2a7c70[_0x8a58('0x2f')]);if(_0x35d930['length']>0x0){return _0x5aad83['status'](0x190)[_0x8a58('0x30')](_0x35d930);}var _0x31b8fe=_0x2a7c70['body'][_0x8a58('0x31')];var _0x2e1d71=_0x2a7c70[_0x8a58('0x2f')][_0x8a58('0x28')];return getAgent(_0x31b8fe)[_0x8a58('0x1c')](function(_0x4e9e04){logger[_0x8a58('0x2d')]('entityFound:',_0x4e9e04[_0x8a58('0x17')]);emit(util[_0x8a58('0x35')](_0x8a58('0x36'),_0x4e9e04[_0x8a58('0x17')]),_0x8a58('0x3b'),{'sessionId':_0x2e1d71});return _0x5aad83[_0x8a58('0x18')](0xc8)[_0x8a58('0x30')]({'error':![],'message':'hangup\x20executed!'});})['catch'](handleError(_0x5aad83));};exports[_0x8a58('0x3c')]=function(_0x54e454,_0x53fd19){logger[_0x8a58('0x2d')](_0x8a58('0x3d'),_0x54e454[_0x8a58('0x2f')]);var _0x573cd3=answerValidation['validate'](_0x54e454[_0x8a58('0x2f')]);if(_0x573cd3['length']>0x0){return _0x53fd19[_0x8a58('0x18')](0x190)[_0x8a58('0x30')](_0x573cd3);}var _0x3feec0=_0x54e454[_0x8a58('0x2f')]['userId'];var _0x417951=_0x54e454[_0x8a58('0x2f')]['sessionId'];return getAgent(_0x3feec0)[_0x8a58('0x1c')](function(_0xba52de){logger[_0x8a58('0x2d')](_0x8a58('0x34'),_0xba52de['name']);emit(util[_0x8a58('0x35')]('user:%s',_0xba52de[_0x8a58('0x17')]),_0x8a58('0x3e'),{'sessionId':_0x417951});return _0x53fd19['status'](0xc8)[_0x8a58('0x30')]({'error':![],'message':'answer\x20executed!'});})['catch'](handleError(_0x53fd19));};exports[_0x8a58('0x3f')]=function(_0x417b08,_0x177ba9){logger[_0x8a58('0x2d')](_0x8a58('0x40'),_0x417b08[_0x8a58('0x2f')]);var _0x507423=holdValidation['validate'](_0x417b08[_0x8a58('0x2f')]);if(_0x507423[_0x8a58('0x29')]>0x0){return _0x177ba9[_0x8a58('0x18')](0x190)[_0x8a58('0x30')](_0x507423);}var _0x1ec51b=_0x417b08[_0x8a58('0x2f')][_0x8a58('0x31')];var _0x903c85=_0x417b08[_0x8a58('0x2f')][_0x8a58('0x28')];return getAgent(_0x1ec51b)[_0x8a58('0x1c')](function(_0x392c32){logger[_0x8a58('0x2d')](_0x8a58('0x34'),_0x392c32['name']);emit(util[_0x8a58('0x35')](_0x8a58('0x36'),_0x392c32[_0x8a58('0x17')]),_0x8a58('0x41'),{'sessionId':_0x903c85});return _0x177ba9[_0x8a58('0x18')](0xc8)[_0x8a58('0x30')]({'error':![],'message':_0x8a58('0x42')});})['catch'](handleError(_0x177ba9));};exports['unhold']=function(_0x5ab682,_0x31e12a){logger[_0x8a58('0x2d')](_0x8a58('0x43'),_0x5ab682['body']);var _0x3883ee=unholdValidation[_0x8a58('0xe')](_0x5ab682[_0x8a58('0x2f')]);if(_0x3883ee[_0x8a58('0x29')]>0x0){return _0x31e12a[_0x8a58('0x18')](0x190)[_0x8a58('0x30')](_0x3883ee);}var _0x22f5aa=_0x5ab682[_0x8a58('0x2f')][_0x8a58('0x31')];var _0x2f48ef=_0x5ab682[_0x8a58('0x2f')][_0x8a58('0x28')];return getAgent(_0x22f5aa)['then'](function(_0xf44eaa){logger[_0x8a58('0x2d')]('entityFound:',_0xf44eaa[_0x8a58('0x17')]);emit(util[_0x8a58('0x35')](_0x8a58('0x36'),_0xf44eaa['name']),_0x8a58('0x44'),{'sessionId':_0x2f48ef});return _0x31e12a['status'](0xc8)[_0x8a58('0x30')]({'error':![],'message':_0x8a58('0x45')});})[_0x8a58('0x20')](handleError(_0x31e12a));};exports[_0x8a58('0x46')]=function(_0x3c7225,_0xfd0229){logger[_0x8a58('0x2d')](_0x8a58('0x47'),_0xfd0229[_0x8a58('0x2f')]);var _0x53fbde=callsValidation[_0x8a58('0xe')](_0x3c7225[_0x8a58('0x2f')]);if(_0x53fbde[_0x8a58('0x29')]>0x0){return _0xfd0229[_0x8a58('0x18')](0x190)[_0x8a58('0x30')](_0x53fbde);}var _0x57adf4=_0x3c7225[_0x8a58('0x2f')][_0x8a58('0x31')];var _0xa01a37=respondWithRpcPromise(_0x8a58('0x23'));var _0x1022d5=getAgent(_0x57adf4);return Promise[_0x8a58('0x24')]([_0xa01a37,_0x1022d5])[_0x8a58('0x1c')](function(_0x38e435){var _0x515f26=_0x38e435[0x0];var _0x415dea=_0x38e435[0x1];var _0xbf6332=_[_0x8a58('0x25')](_0x515f26['rows'],function(_0x229e68){return _0x229e68['UserId']==_0x415dea['id'];});return _0xfd0229[_0x8a58('0x18')](0xc8)[_0x8a58('0x30')]({'count':_0xbf6332[_0x8a58('0x29')],'rows':_0xbf6332});})[_0x8a58('0x20')](handleError(_0xfd0229));};exports[_0x8a58('0x48')]=function(_0x2f653d,_0x1b8292){logger[_0x8a58('0x2d')]('conference\x20fired:',_0x2f653d['body']);var _0x455aeb=conferenceValidation[_0x8a58('0xe')](_0x2f653d[_0x8a58('0x2f')]);if(_0x455aeb[_0x8a58('0x29')]>0x0){return _0x1b8292[_0x8a58('0x18')](0x190)[_0x8a58('0x30')](_0x455aeb);}var _0x1b4f68=_0x2f653d['body'][_0x8a58('0x31')];return getAgent(_0x1b4f68)[_0x8a58('0x1c')](function(_0x493ccd){logger[_0x8a58('0x2d')](_0x8a58('0x34'),_0x493ccd[_0x8a58('0x17')]);emit(util[_0x8a58('0x35')](_0x8a58('0x36'),_0x493ccd[_0x8a58('0x17')]),'webbar:conference');return _0x1b8292[_0x8a58('0x18')](0xc8)[_0x8a58('0x30')]({'error':![],'message':'conference\x20executed!'});})[_0x8a58('0x20')](handleError(_0x1b8292));};exports[_0x8a58('0x49')]=function(_0x19e256,_0x26b333){logger['info']('transfer\x20fired:',_0x19e256[_0x8a58('0x2f')]);var _0x5ce699=transferValidation[_0x8a58('0xe')](_0x19e256[_0x8a58('0x2f')]);if(_0x5ce699[_0x8a58('0x29')]>0x0){return _0x26b333[_0x8a58('0x18')](0x190)['json'](_0x5ce699);}var _0xb0b5da=_0x19e256[_0x8a58('0x2f')][_0x8a58('0x31')];var _0x371930=_0x19e256[_0x8a58('0x2f')][_0x8a58('0x28')];var _0x9046f1=_0x19e256[_0x8a58('0x2f')][_0x8a58('0x4a')];return getAgent(_0xb0b5da)[_0x8a58('0x1c')](function(_0x318acd){logger[_0x8a58('0x2d')](_0x8a58('0x34'),_0x318acd['name']);emit(util[_0x8a58('0x35')](_0x8a58('0x36'),_0x318acd[_0x8a58('0x17')]),_0x8a58('0x4b'),{'sessionId':_0x371930,'transferNumber':_0x9046f1});return _0x26b333[_0x8a58('0x18')](0xc8)[_0x8a58('0x30')]({'error':![],'message':_0x8a58('0x4c')});})[_0x8a58('0x20')](handleError(_0x26b333));}; \ No newline at end of file +var _0x61a5=['redis','defaults','localhost','socket.io-emitter','number','string','callNumber\x20is\x20required','userId\x20is\x20required','sessionId\x20is\x20required','transferNumber\x20is\x20required','info','stringify','emit','log','error','stack','name','send','NotFound','request','then','code','message','result','catch','User','findOne','agent','VoiceChannels','all','filter','UserId','sessionId','sessionId\x20','\x20not\x20found!','originate','originate\x20fired:','body','validate','length','status','json','userId','callerId','callbackUrl','entityFound:','format','user:%s','webbar:originate','originate\x20executed!','hangup','hangup\x20fired:','webbar:hangup','hangup\x20executed!','answer','answer\x20fired:','webbar:answer','answer\x20executed!','hold\x20fired:','webbar:hold','hold\x20executed!','unhold','webbar:unhold','unhold\x20executed!','calls','calls\x20fired:','rows','conference\x20fired:','webbar:conference','transfer','transfer\x20fired:','transferNumber','webbar:transfer','transfer\x20executed!','path','../../mysqldb','../../config/environment','util','bluebird','jayson/promise','http','../../config/logger','ioredis'];(function(_0x35a59c,_0x3c08ef){var _0x11bf0e=function(_0x154cec){while(--_0x154cec){_0x35a59c['push'](_0x35a59c['shift']());}};_0x11bf0e(++_0x3c08ef);}(_0x61a5,0xf0));var _0x561a=function(_0x3145af,_0x53a1d5){_0x3145af=_0x3145af-0x0;var _0x37758a=_0x61a5[_0x3145af];return _0x37758a;};'use strict';var path=require(_0x561a('0x0'));var fs=require('fs');var _=require('lodash');var db=require(_0x561a('0x1'))['db'];var config=require(_0x561a('0x2'));var util=require(_0x561a('0x3'));var BPromise=require(_0x561a('0x4'));var jayson=require(_0x561a('0x5'));var amiClient=jayson['client'][_0x561a('0x6')]({'port':0x232a});var logger=require(_0x561a('0x7'))('webbarapi');var Redis=require(_0x561a('0x8'));config[_0x561a('0x9')]=_[_0x561a('0xa')](config[_0x561a('0x9')],{'host':_0x561a('0xb'),'port':0x18eb});var io=require(_0x561a('0xc'))(new Redis(config[_0x561a('0x9')]));var Schema=require('validate');var originateValidation=new Schema({'userId':{'type':_0x561a('0xd'),'required':[!![],'userId\x20is\x20required']},'callNumber':{'type':_0x561a('0xe'),'required':[!![],_0x561a('0xf')]},'callerId':{'type':'string'},'callbackUrl':{'type':_0x561a('0xe')}});var hangupValidation=new Schema({'userId':{'type':_0x561a('0xd'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x561a('0xe'),'required':![]}});var answerValidation=new Schema({'userId':{'type':'number','required':[!![],_0x561a('0x10')]},'sessionId':{'type':_0x561a('0xe'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0x561a('0xd'),'required':[!![],_0x561a('0x10')]},'sessionId':{'type':_0x561a('0xe'),'required':[!![],_0x561a('0x11')]},'transferNumber':{'type':_0x561a('0xe'),'required':[!![],_0x561a('0x12')]}});var holdValidation=new Schema({'userId':{'type':_0x561a('0xd'),'required':[!![],_0x561a('0x10')]},'sessionId':{'type':_0x561a('0xe'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x561a('0xd'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x561a('0xe'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0x561a('0xd'),'required':[!![],_0x561a('0x10')]}});var conferenceValidation=new Schema({'userId':{'type':_0x561a('0xd'),'required':[!![],_0x561a('0x10')]}});function emit(_0x28ad8b,_0x3d91be,_0x14f141){logger[_0x561a('0x13')](_0x28ad8b,_0x3d91be,JSON[_0x561a('0x14')](_0x14f141));io['to'](_0x28ad8b)[_0x561a('0x15')](_0x3d91be,_0x14f141);}function handleError(_0x48df6a){return function(_0x43c5aa){console[_0x561a('0x16')]('handleError:',_0x43c5aa,_0x43c5aa instanceof RangeError);logger[_0x561a('0x17')](_0x43c5aa[_0x561a('0x18')]);if(_0x43c5aa instanceof RangeError){if(_0x43c5aa['name']){delete _0x43c5aa[_0x561a('0x19')];}_0x48df6a['status'](0x194)['send'](_0x43c5aa);}else{if(_0x43c5aa[_0x561a('0x19')]){delete _0x43c5aa[_0x561a('0x19')];}_0x48df6a['status'](0x1f4)[_0x561a('0x1a')](_0x43c5aa);}};}function checkError(){return function(_0x88b2b5){if(!_0x88b2b5){throw new RangeError(_0x561a('0x1b'));}return _0x88b2b5;};}function respondWithRpcPromise(_0x3cf6c8,_0x345941){return new BPromise(function(_0x1bb8df,_0x4f9c3a){var _0x3e5509=amiClient;return _0x3e5509[_0x561a('0x1c')](_0x3cf6c8,_0x345941)[_0x561a('0x1d')](function(_0x527207){if(_0x527207['error']){if(_0x527207[_0x561a('0x17')][_0x561a('0x1e')]===0x1f4){return _0x4f9c3a(_0x527207[_0x561a('0x17')][_0x561a('0x1f')]);}return _0x1bb8df(_0x527207[_0x561a('0x17')][_0x561a('0x1f')]);}else{_0x1bb8df(_0x527207[_0x561a('0x20')]);}})[_0x561a('0x21')](function(_0x5bf2fa){_0x4f9c3a(_0x5bf2fa);});});}function getAgent(_0x4c2752){return db[_0x561a('0x22')][_0x561a('0x23')]({'where':{'id':_0x4c2752,'role':_0x561a('0x24')}})[_0x561a('0x1d')](checkError());}function getAgentCheckSession(_0x5a0acd,_0x186862){return new BPromise(function(_0x3f0789,_0x44c851){var _0x23b489=respondWithRpcPromise(_0x561a('0x25'));var _0x47f93a=getAgent(_0x5a0acd);Promise[_0x561a('0x26')]([_0x23b489,_0x47f93a])[_0x561a('0x1d')](function(_0x4f0b23){var _0x401636=_0x4f0b23[0x0];var _0x276ae7=_0x4f0b23[0x1];var _0x58db23=_[_0x561a('0x27')](_0x401636['rows'],function(_0x54a47a){return _0x54a47a[_0x561a('0x28')]==_0x276ae7['id']&&_0x54a47a[_0x561a('0x29')]==_0x186862;});if(_0x58db23['length']==0x1){_0x3f0789(_0x276ae7);}else{_0x44c851(new RangeError(_0x561a('0x2a')+_0x186862+_0x561a('0x2b')));}});});}exports[_0x561a('0x2c')]=function(_0x278c7e,_0x169243){logger[_0x561a('0x13')](_0x561a('0x2d'),_0x278c7e[_0x561a('0x2e')]);var _0x506c2e=originateValidation[_0x561a('0x2f')](_0x278c7e[_0x561a('0x2e')]);if(_0x506c2e[_0x561a('0x30')]>0x0){return _0x169243[_0x561a('0x31')](0x190)[_0x561a('0x32')](_0x506c2e);}var _0x4ab97f=_0x278c7e[_0x561a('0x2e')][_0x561a('0x33')];var _0x2d0063=_0x278c7e[_0x561a('0x2e')]['callNumber'];var _0x9ea469=_0x278c7e[_0x561a('0x2e')][_0x561a('0x34')];var _0x48f470=_0x278c7e['body'][_0x561a('0x35')];return getAgent(_0x4ab97f)['then'](function(_0x5a45a4){logger['info'](_0x561a('0x36'),_0x5a45a4[_0x561a('0x19')]);emit(util[_0x561a('0x37')](_0x561a('0x38'),_0x5a45a4[_0x561a('0x19')]),_0x561a('0x39'),{'callNumber':_0x2d0063,'callerId':_0x9ea469,'callbackUrl':_0x48f470});return _0x169243['status'](0xc8)['json']({'error':![],'message':_0x561a('0x3a')});})[_0x561a('0x21')](handleError(_0x169243));};exports[_0x561a('0x3b')]=function(_0x4e7d95,_0x4d81f7){logger[_0x561a('0x13')](_0x561a('0x3c'),_0x4e7d95[_0x561a('0x2e')]);var _0x5865c7=hangupValidation[_0x561a('0x2f')](_0x4e7d95[_0x561a('0x2e')]);if(_0x5865c7[_0x561a('0x30')]>0x0){return _0x4d81f7[_0x561a('0x31')](0x190)['json'](_0x5865c7);}var _0xbd11c4=_0x4e7d95[_0x561a('0x2e')][_0x561a('0x33')];var _0x5c59dc=_0x4e7d95[_0x561a('0x2e')][_0x561a('0x29')];return getAgent(_0xbd11c4)[_0x561a('0x1d')](function(_0x16779d){logger[_0x561a('0x13')](_0x561a('0x36'),_0x16779d[_0x561a('0x19')]);emit(util['format'](_0x561a('0x38'),_0x16779d[_0x561a('0x19')]),_0x561a('0x3d'),{'sessionId':_0x5c59dc});return _0x4d81f7[_0x561a('0x31')](0xc8)[_0x561a('0x32')]({'error':![],'message':_0x561a('0x3e')});})['catch'](handleError(_0x4d81f7));};exports[_0x561a('0x3f')]=function(_0xd991f8,_0x3f0f44){logger[_0x561a('0x13')](_0x561a('0x40'),_0xd991f8[_0x561a('0x2e')]);var _0x293e11=answerValidation[_0x561a('0x2f')](_0xd991f8[_0x561a('0x2e')]);if(_0x293e11['length']>0x0){return _0x3f0f44[_0x561a('0x31')](0x190)[_0x561a('0x32')](_0x293e11);}var _0x5197b1=_0xd991f8[_0x561a('0x2e')]['userId'];var _0x141971=_0xd991f8[_0x561a('0x2e')][_0x561a('0x29')];return getAgent(_0x5197b1)[_0x561a('0x1d')](function(_0x93103b){logger['info'](_0x561a('0x36'),_0x93103b[_0x561a('0x19')]);emit(util[_0x561a('0x37')](_0x561a('0x38'),_0x93103b[_0x561a('0x19')]),_0x561a('0x41'),{'sessionId':_0x141971});return _0x3f0f44['status'](0xc8)['json']({'error':![],'message':_0x561a('0x42')});})['catch'](handleError(_0x3f0f44));};exports['hold']=function(_0x4d7a38,_0x5e9e37){logger['info'](_0x561a('0x43'),_0x4d7a38[_0x561a('0x2e')]);var _0x21858b=holdValidation['validate'](_0x4d7a38[_0x561a('0x2e')]);if(_0x21858b['length']>0x0){return _0x5e9e37['status'](0x190)[_0x561a('0x32')](_0x21858b);}var _0x13a2ad=_0x4d7a38[_0x561a('0x2e')]['userId'];var _0x3bfd1b=_0x4d7a38['body'][_0x561a('0x29')];return getAgent(_0x13a2ad)['then'](function(_0x1bd3df){logger[_0x561a('0x13')](_0x561a('0x36'),_0x1bd3df[_0x561a('0x19')]);emit(util[_0x561a('0x37')](_0x561a('0x38'),_0x1bd3df[_0x561a('0x19')]),_0x561a('0x44'),{'sessionId':_0x3bfd1b});return _0x5e9e37[_0x561a('0x31')](0xc8)['json']({'error':![],'message':_0x561a('0x45')});})[_0x561a('0x21')](handleError(_0x5e9e37));};exports[_0x561a('0x46')]=function(_0x48ed34,_0x14fe1b){logger[_0x561a('0x13')]('unhold\x20fired:',_0x48ed34[_0x561a('0x2e')]);var _0x99dc7f=unholdValidation[_0x561a('0x2f')](_0x48ed34['body']);if(_0x99dc7f[_0x561a('0x30')]>0x0){return _0x14fe1b[_0x561a('0x31')](0x190)[_0x561a('0x32')](_0x99dc7f);}var _0x2cd4e0=_0x48ed34[_0x561a('0x2e')][_0x561a('0x33')];var _0x3d9b63=_0x48ed34['body'][_0x561a('0x29')];return getAgent(_0x2cd4e0)[_0x561a('0x1d')](function(_0x2dc1a3){logger[_0x561a('0x13')](_0x561a('0x36'),_0x2dc1a3[_0x561a('0x19')]);emit(util[_0x561a('0x37')]('user:%s',_0x2dc1a3[_0x561a('0x19')]),_0x561a('0x47'),{'sessionId':_0x3d9b63});return _0x14fe1b[_0x561a('0x31')](0xc8)['json']({'error':![],'message':_0x561a('0x48')});})['catch'](handleError(_0x14fe1b));};exports[_0x561a('0x49')]=function(_0x3d03c5,_0x2e0351){logger[_0x561a('0x13')](_0x561a('0x4a'),_0x2e0351[_0x561a('0x2e')]);var _0x29d981=callsValidation['validate'](_0x3d03c5['body']);if(_0x29d981[_0x561a('0x30')]>0x0){return _0x2e0351[_0x561a('0x31')](0x190)[_0x561a('0x32')](_0x29d981);}var _0x2945c1=_0x3d03c5[_0x561a('0x2e')][_0x561a('0x33')];var _0x4d13c8=respondWithRpcPromise(_0x561a('0x25'));var _0x1b0ecf=getAgent(_0x2945c1);return Promise['all']([_0x4d13c8,_0x1b0ecf])[_0x561a('0x1d')](function(_0x574ee2){var _0x5194d5=_0x574ee2[0x0];var _0xc7447e=_0x574ee2[0x1];var _0x16daeb=_[_0x561a('0x27')](_0x5194d5[_0x561a('0x4b')],function(_0x4a714c){return _0x4a714c[_0x561a('0x28')]==_0xc7447e['id'];});return _0x2e0351['status'](0xc8)[_0x561a('0x32')]({'count':_0x16daeb[_0x561a('0x30')],'rows':_0x16daeb});})[_0x561a('0x21')](handleError(_0x2e0351));};exports['conference']=function(_0x4ec13c,_0x52074a){logger['info'](_0x561a('0x4c'),_0x4ec13c[_0x561a('0x2e')]);var _0x485b80=conferenceValidation[_0x561a('0x2f')](_0x4ec13c[_0x561a('0x2e')]);if(_0x485b80[_0x561a('0x30')]>0x0){return _0x52074a['status'](0x190)[_0x561a('0x32')](_0x485b80);}var _0xb046d8=_0x4ec13c[_0x561a('0x2e')][_0x561a('0x33')];return getAgent(_0xb046d8)[_0x561a('0x1d')](function(_0x849fe){logger[_0x561a('0x13')](_0x561a('0x36'),_0x849fe[_0x561a('0x19')]);emit(util[_0x561a('0x37')](_0x561a('0x38'),_0x849fe['name']),_0x561a('0x4d'));return _0x52074a[_0x561a('0x31')](0xc8)['json']({'error':![],'message':'conference\x20executed!'});})[_0x561a('0x21')](handleError(_0x52074a));};exports[_0x561a('0x4e')]=function(_0x565867,_0x40f22e){logger[_0x561a('0x13')](_0x561a('0x4f'),_0x565867[_0x561a('0x2e')]);var _0x30d2a7=transferValidation[_0x561a('0x2f')](_0x565867['body']);if(_0x30d2a7['length']>0x0){return _0x40f22e[_0x561a('0x31')](0x190)[_0x561a('0x32')](_0x30d2a7);}var _0x3c8b20=_0x565867[_0x561a('0x2e')][_0x561a('0x33')];var _0x1656b=_0x565867['body']['sessionId'];var _0x53a93a=_0x565867[_0x561a('0x2e')][_0x561a('0x50')];return getAgent(_0x3c8b20)[_0x561a('0x1d')](function(_0x57bffc){logger['info']('entityFound:',_0x57bffc['name']);emit(util[_0x561a('0x37')](_0x561a('0x38'),_0x57bffc['name']),_0x561a('0x51'),{'sessionId':_0x1656b,'transferNumber':_0x53a93a});return _0x40f22e['status'](0xc8)['json']({'error':![],'message':_0x561a('0x52')});})[_0x561a('0x21')](handleError(_0x40f22e));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index 3b6c4e6..354fb49 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 _0xd135=['./whatsappAccount.controller','get','index','describe','isAuthenticated','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','create','post','addDisposition','addAnswer','/:id/users','addAgents','addApplications','/:id/notify','notify','/:id/send','send','put','/:id','update','delete','removeAnswers','removeAgents','exports','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment'];(function(_0x429a87,_0x3a32da){var _0x2a7cd2=function(_0x29e2f1){while(--_0x29e2f1){_0x429a87['push'](_0x429a87['shift']());}};_0x2a7cd2(++_0x3a32da);}(_0xd135,0xd1));var _0x5d13=function(_0x496ec2,_0x2aabee){_0x496ec2=_0x496ec2-0x0;var _0x32653a=_0xd135[_0x496ec2];return _0x32653a;};'use strict';var multer=require('multer');var util=require(_0x5d13('0x0'));var path=require(_0x5d13('0x1'));var timeout=require('connect-timeout');var express=require(_0x5d13('0x2'));var router=express[_0x5d13('0x3')]();var fs_extra=require(_0x5d13('0x4'));var auth=require(_0x5d13('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x5d13('0x6'));var controller=require(_0x5d13('0x7'));router[_0x5d13('0x8')]('/',auth['isAuthenticated'](),controller[_0x5d13('0x9')]);router[_0x5d13('0x8')]('/describe',auth['isAuthenticated'](),controller[_0x5d13('0xa')]);router[_0x5d13('0x8')]('/:id',auth[_0x5d13('0xb')](),controller['show']);router[_0x5d13('0x8')](_0x5d13('0xc'),auth[_0x5d13('0xb')](),controller[_0x5d13('0xd')]);router[_0x5d13('0x8')](_0x5d13('0xe'),auth[_0x5d13('0xb')](),controller[_0x5d13('0xf')]);router[_0x5d13('0x8')]('/:id/users',auth['isAuthenticated'](),controller['getAgents']);router[_0x5d13('0x8')](_0x5d13('0x10'),auth['isAuthenticated'](),controller[_0x5d13('0x11')]);router['post']('/',auth[_0x5d13('0xb')](),controller[_0x5d13('0x12')]);router[_0x5d13('0x13')](_0x5d13('0xc'),auth[_0x5d13('0xb')](),controller[_0x5d13('0x14')]);router[_0x5d13('0x13')](_0x5d13('0xe'),auth[_0x5d13('0xb')](),controller[_0x5d13('0x15')]);router[_0x5d13('0x13')](_0x5d13('0x16'),auth[_0x5d13('0xb')](),controller[_0x5d13('0x17')]);router[_0x5d13('0x13')](_0x5d13('0x10'),auth[_0x5d13('0xb')](),controller[_0x5d13('0x18')]);router['post'](_0x5d13('0x19'),controller[_0x5d13('0x1a')]);router['post'](_0x5d13('0x1b'),auth[_0x5d13('0xb')](),controller[_0x5d13('0x1c')]);router[_0x5d13('0x1d')](_0x5d13('0x1e'),auth[_0x5d13('0xb')](),controller[_0x5d13('0x1f')]);router[_0x5d13('0x20')](_0x5d13('0x1e'),auth[_0x5d13('0xb')](),controller['destroy']);router[_0x5d13('0x20')](_0x5d13('0xc'),auth[_0x5d13('0xb')](),controller['removeDispositions']);router[_0x5d13('0x20')](_0x5d13('0xe'),auth['isAuthenticated'](),controller[_0x5d13('0x21')]);router['delete'](_0x5d13('0x16'),auth[_0x5d13('0xb')](),controller[_0x5d13('0x22')]);module[_0x5d13('0x23')]=router; \ No newline at end of file +var _0x6091=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappAccount.controller','isAuthenticated','index','get','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','/:id/users','getAgents','/:id/applications','addDisposition','addAnswer','post','addApplications','notify','/:id/send','send','update','delete','destroy','removeAnswers','multer','express','Router'];(function(_0x3ceb54,_0x5bddfd){var _0x26d8a6=function(_0x32e484){while(--_0x32e484){_0x3ceb54['push'](_0x3ceb54['shift']());}};_0x26d8a6(++_0x5bddfd);}(_0x6091,0x9d));var _0x1609=function(_0x1b349a,_0x22222c){_0x1b349a=_0x1b349a-0x0;var _0x5d1f7c=_0x6091[_0x1b349a];return _0x5d1f7c;};'use strict';var multer=require(_0x1609('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x1609('0x1'));var router=express[_0x1609('0x2')]();var fs_extra=require(_0x1609('0x3'));var auth=require(_0x1609('0x4'));var interaction=require(_0x1609('0x5'));var config=require(_0x1609('0x6'));var controller=require(_0x1609('0x7'));router['get']('/',auth[_0x1609('0x8')](),controller[_0x1609('0x9')]);router[_0x1609('0xa')](_0x1609('0xb'),auth[_0x1609('0x8')](),controller[_0x1609('0xc')]);router[_0x1609('0xa')](_0x1609('0xd'),auth[_0x1609('0x8')](),controller[_0x1609('0xe')]);router[_0x1609('0xa')](_0x1609('0xf'),auth['isAuthenticated'](),controller[_0x1609('0x10')]);router[_0x1609('0xa')](_0x1609('0x11'),auth['isAuthenticated'](),controller['getAnswers']);router[_0x1609('0xa')](_0x1609('0x12'),auth[_0x1609('0x8')](),controller[_0x1609('0x13')]);router[_0x1609('0xa')](_0x1609('0x14'),auth[_0x1609('0x8')](),controller['getApplications']);router['post']('/',auth[_0x1609('0x8')](),controller['create']);router['post'](_0x1609('0xf'),auth['isAuthenticated'](),controller[_0x1609('0x15')]);router['post']('/:id/canned_answers',auth[_0x1609('0x8')](),controller[_0x1609('0x16')]);router[_0x1609('0x17')](_0x1609('0x12'),auth['isAuthenticated'](),controller['addAgents']);router[_0x1609('0x17')](_0x1609('0x14'),auth[_0x1609('0x8')](),controller[_0x1609('0x18')]);router[_0x1609('0x17')]('/:id/notify',controller[_0x1609('0x19')]);router[_0x1609('0x17')](_0x1609('0x1a'),auth[_0x1609('0x8')](),controller[_0x1609('0x1b')]);router['put'](_0x1609('0xd'),auth[_0x1609('0x8')](),controller[_0x1609('0x1c')]);router[_0x1609('0x1d')](_0x1609('0xd'),auth[_0x1609('0x8')](),controller[_0x1609('0x1e')]);router[_0x1609('0x1d')](_0x1609('0xf'),auth['isAuthenticated'](),controller['removeDispositions']);router[_0x1609('0x1d')](_0x1609('0x11'),auth[_0x1609('0x8')](),controller[_0x1609('0x1f')]);router[_0x1609('0x1d')](_0x1609('0x12'),auth[_0x1609('0x8')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.attributes.js b/server/api/whatsappAccount/whatsappAccount.attributes.js index c4b91fd..58eda3b 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 _0x3df2=['twilio','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','randomstring','exports','STRING','name','generate'];(function(_0x429a21,_0x43b4e0){var _0x3a8c04=function(_0x589489){while(--_0x589489){_0x429a21['push'](_0x429a21['shift']());}};_0x3a8c04(++_0x43b4e0);}(_0x3df2,0x97));var _0x23df=function(_0x2f142d,_0xf79993){_0x2f142d=_0x2f142d-0x0;var _0x2fc586=_0x3df2[_0x2f142d];return _0x2fc586;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x23df('0x0'));module[_0x23df('0x1')]={'name':{'type':Sequelize[_0x23df('0x2')],'unique':_0x23df('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0x23df('0x2')],'allowNull':![]},'remote':{'type':Sequelize[_0x23df('0x2')],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x23df('0x4')]();}},'phone':{'type':Sequelize[_0x23df('0x2')]},'type':{'type':Sequelize['ENUM'](_0x23df('0x5'),'sinch')},'accountSid':{'type':Sequelize[_0x23df('0x2')]},'baseUrl':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize[_0x23df('0x2')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x23df('0x6')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0x23df('0x6')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x23df('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x23df('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x23df('0x6')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x23df('0x7')],'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[_0x23df('0x7')],'comment':_0x23df('0x8')},'mandatoryDisposition':{'type':Sequelize[_0x23df('0x6')],'defaultValue':![],'comment':_0x23df('0x9'),'set':function(_0x30b1ba){if(!_0x30b1ba){this[_0x23df('0xa')](_0x23df('0xb'),null);}this['setDataValue']('mandatoryDisposition',_0x30b1ba);}},'description':{'type':Sequelize[_0x23df('0x2')]}}; \ No newline at end of file +var _0x5092=['Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','sequelize','randomstring','exports','STRING','generate','ENUM','sinch','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER'];(function(_0x5bbae9,_0xa7e306){var _0x117aec=function(_0x46a18f){while(--_0x46a18f){_0x5bbae9['push'](_0x5bbae9['shift']());}};_0x117aec(++_0xa7e306);}(_0x5092,0x147));var _0x2509=function(_0x31a58b,_0x24eec0){_0x31a58b=_0x31a58b-0x0;var _0x3b5f61=_0x5092[_0x31a58b];return _0x3b5f61;};'use strict';var Sequelize=require(_0x2509('0x0'));var rs=require(_0x2509('0x1'));module[_0x2509('0x2')]={'name':{'type':Sequelize[_0x2509('0x3')],'unique':'name','allowNull':![]},'key':{'type':Sequelize[_0x2509('0x3')],'allowNull':![]},'remote':{'type':Sequelize[_0x2509('0x3')],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x2509('0x4')]();}},'phone':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x2509('0x5')]('twilio',_0x2509('0x6'))},'accountSid':{'type':Sequelize[_0x2509('0x3')]},'baseUrl':{'type':Sequelize[_0x2509('0x3')]},'authToken':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0x2509('0x7')],'defaultValue':function(){return _0x2509('0x8');}},'notificationSound':{'type':Sequelize[_0x2509('0x9')],'defaultValue':![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x2509('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x2509('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x2509('0x9')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x2509('0x9')],'defaultValue':![],'comment':_0x2509('0xb'),'set':function(_0x29172e){if(!_0x29172e){this[_0x2509('0xc')]('mandatoryDispositionPauseId',null);}this['setDataValue']('mandatoryDisposition',_0x29172e);}},'description':{'type':Sequelize[_0x2509('0x3')]}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index 9b846a9..47d50b5 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 _0x3df4=['user','WhatsappAccounts','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','mandatoryDispositionPause','body','describe','WhatsappAccountId','Disposition','findOne','order','pick','removeDispositions','addAnswer','CannedAnswer','getAnswers','removeAnswers','addAgents','ids','spread','userWhatsappAccount:save','removeAgents','emit','userWhatsappAccount:remove','getAgents','User','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','WhatsappApplication','findAndCountAll','priority','stack','getApplications','notify','Applications','account','statuses','state','WhatsappMessage','timestamp','message_id','orderBy','CmContact','Sequelize','ValidationError','difference','createdAt','updatedAt','CompanyId','mobile','twilio','from','From','whatsapp:','MessageSid','notifications','messageId','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','ListId','Contacts','DESC','list','omit','WhatsappInteraction','interaction','created','autoclose','applications','push','close','*,*,*,*','ContactId','AttachmentId','UserId','unshift','agent','waitForTheAssignedAgent','WhatsappQueue','queue','waitForTheAssignedQueue','Start','startRouting','WhatsappAccount,\x20%s,\x20%s,\x20%s','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','Content-Type','text/xml','to\x20is\x20mandatory','List','out','dataValues','Messages','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','util','path','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','defaults','redis','localhost','socket.io-emitter','./whatsappAccount.socket','jayson/promise','client','http','then','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','destroy','get','UserProfileResource','name','send','Pause','map','rawAttributes','fieldName','type','key','query','keys','intersection','model','attributes','hasOwnProperty','nolimit','sort','where','filters','filter','merge','VIRTUAL','options','include','WhatsappAccount','findAll','rows','show','params','fields','length','includeAll','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role'];(function(_0x3816a7,_0x24ab6b){var _0x1ade71=function(_0x1859e9){while(--_0x1859e9){_0x3816a7['push'](_0x3816a7['shift']());}};_0x1ade71(++_0x24ab6b);}(_0x3df4,0x12b));var _0x43df=function(_0x3e7721,_0x20cafc){_0x3e7721=_0x3e7721-0x0;var _0x2a7fc3=_0x3df4[_0x3e7721];return _0x2a7fc3;};'use strict';var emlformat=require(_0x43df('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x43df('0x1'));var jsonpatch=require(_0x43df('0x2'));var rp=require(_0x43df('0x3'));var moment=require('moment');var BPromise=require(_0x43df('0x4'));var Mustache=require('mustache');var util=require(_0x43df('0x5'));var path=require(_0x43df('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x43df('0x7'));var _=require('lodash');var squel=require(_0x43df('0x8'));var crypto=require(_0x43df('0x9'));var jsforce=require(_0x43df('0xa'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x43df('0xb'));var Papa=require(_0x43df('0xc'));var Redis=require(_0x43df('0xd'));var authService=require(_0x43df('0xe'));var qs=require(_0x43df('0xf'));var as=require(_0x43df('0x10'));var hardwareService=require(_0x43df('0x11'));var logger=require('../../config/logger')(_0x43df('0x12'));var utils=require(_0x43df('0x13'));var config=require(_0x43df('0x14'));var licenseUtil=require(_0x43df('0x15'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x43df('0x16')](config[_0x43df('0x17')],{'host':_0x43df('0x18'),'port':0x18eb});var socket=require(_0x43df('0x19'))(new Redis(config[_0x43df('0x17')]));require(_0x43df('0x1a'))['register'](socket);var jayson=require(_0x43df('0x1b'));var client=jayson[_0x43df('0x1c')][_0x43df('0x1d')]({'port':0x232c});function respondWithRpcPromise(_0x5b8f37,_0x2021a7,_0x4be769,_0x929881){return new BPromise(function(_0x39fe52,_0x3a4c92){var _0x25b0d7=_0x929881||client;return _0x25b0d7['request'](_0x5b8f37,_0x4be769)[_0x43df('0x1e')](function(_0x42da28){logger['info'](_0x43df('0x1f'),_0x2021a7,_0x43df('0x20'));logger[_0x43df('0x21')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x2021a7,_0x43df('0x20'),JSON[_0x43df('0x22')](_0x42da28));if(_0x42da28[_0x43df('0x23')]){if(_0x42da28['error'][_0x43df('0x24')]===0x1f4){logger[_0x43df('0x23')]('WhatsappAccount,\x20%s,\x20%s',_0x2021a7,_0x42da28[_0x43df('0x23')][_0x43df('0x25')]);return _0x3a4c92(_0x42da28['error'][_0x43df('0x25')]);}logger['error'](_0x43df('0x1f'),_0x2021a7,_0x42da28[_0x43df('0x23')][_0x43df('0x25')]);return _0x39fe52(_0x42da28['error'][_0x43df('0x25')]);}else{logger['info'](_0x43df('0x1f'),_0x2021a7,_0x43df('0x20'));_0x39fe52(_0x42da28[_0x43df('0x26')]['message']);}})[_0x43df('0x27')](function(_0x1dad9c){logger['error']('WhatsappAccount,\x20%s,\x20%s',_0x2021a7,_0x1dad9c);_0x3a4c92(_0x1dad9c);});});}function respondWithStatusCode(_0x29dece,_0x24990a){_0x24990a=_0x24990a||0xcc;return function(_0xb72c9e){if(_0xb72c9e){return _0x29dece[_0x43df('0x28')](_0x24990a);}return _0x29dece[_0x43df('0x29')](_0x24990a)[_0x43df('0x2a')]();};}function respondWithResult(_0x414388,_0x350a1f){_0x350a1f=_0x350a1f||0xc8;return function(_0x130568){if(_0x130568){return _0x414388[_0x43df('0x29')](_0x350a1f)[_0x43df('0x2b')](_0x130568);}};}function respondWithFilteredResult(_0x1df6c2,_0x265f59){return function(_0x3e5846){if(_0x3e5846){var _0x17d9f2=typeof _0x265f59[_0x43df('0x2c')]===_0x43df('0x2d')&&typeof _0x265f59[_0x43df('0x2e')]===_0x43df('0x2d');var _0x2870e0=_0x3e5846['count'];var _0x52222f=_0x17d9f2?0x0:_0x265f59[_0x43df('0x2c')];var _0x3c8c1c=_0x17d9f2?_0x3e5846[_0x43df('0x2f')]:_0x265f59[_0x43df('0x2c')]+_0x265f59[_0x43df('0x2e')];var _0x1e8a78;if(_0x3c8c1c>=_0x2870e0){_0x3c8c1c=_0x2870e0;_0x1e8a78=0xc8;}else{_0x1e8a78=0xce;}_0x1df6c2['status'](_0x1e8a78);return _0x1df6c2[_0x43df('0x30')](_0x43df('0x31'),_0x52222f+'-'+_0x3c8c1c+'/'+_0x2870e0)['json'](_0x3e5846);}return null;};}function patchUpdates(_0x54cb26){return function(_0x25012c){try{jsonpatch[_0x43df('0x32')](_0x25012c,_0x54cb26,!![]);}catch(_0x123c36){return BPromise['reject'](_0x123c36);}return _0x25012c[_0x43df('0x33')]();};}function saveUpdates(_0x5f4a5a,_0xb35698){return function(_0x345a6f){if(_0x345a6f){return _0x345a6f[_0x43df('0x34')](_0x5f4a5a)[_0x43df('0x1e')](function(_0xb9a5e2){return _0xb9a5e2;});}return null;};}function removeEntity(_0x169670,_0x311e36){return function(_0x248341){if(_0x248341){return _0x248341[_0x43df('0x35')]()[_0x43df('0x1e')](function(){var _0xb96012=_0x248341[_0x43df('0x36')]({'plain':!![]});var _0x5a4bea='WhatsappAccounts';return db[_0x43df('0x37')][_0x43df('0x35')]({'where':{'type':_0x5a4bea,'resourceId':_0xb96012['id']}})[_0x43df('0x1e')](function(){return _0x248341;});})[_0x43df('0x1e')](function(){_0x169670['status'](0xcc)[_0x43df('0x2a')]();});}};}function handleEntityNotFound(_0x1c2e26,_0x51e9e0){return function(_0x364a5c){if(!_0x364a5c){_0x1c2e26[_0x43df('0x28')](0x194);}return _0x364a5c;};}function handleError(_0xbf2f52,_0x3f3869){_0x3f3869=_0x3f3869||0x1f4;return function(_0x369891){logger[_0x43df('0x23')](_0x369891['stack']);if(_0x369891[_0x43df('0x38')]){delete _0x369891[_0x43df('0x38')];}_0xbf2f52['status'](_0x3f3869)[_0x43df('0x39')](_0x369891);};}exports['index']=function(_0x2c612d,_0x1da30a){var _0x32eb24={'include':[{'model':db[_0x43df('0x3a')],'as':'mandatoryDispositionPause'}]},_0x2fff0d={},_0x3ff779={'count':0x0,'rows':[]};var _0xc81c5e=_[_0x43df('0x3b')](db['WhatsappAccount'][_0x43df('0x3c')],function(_0x3546cc){return{'name':_0x3546cc[_0x43df('0x3d')],'type':_0x3546cc[_0x43df('0x3e')][_0x43df('0x3f')]};});_0x2fff0d['model']=_[_0x43df('0x3b')](_0xc81c5e,_0x43df('0x38'));_0x2fff0d[_0x43df('0x40')]=_[_0x43df('0x41')](_0x2c612d[_0x43df('0x40')]);_0x2fff0d['filters']=_[_0x43df('0x42')](_0x2fff0d[_0x43df('0x43')],_0x2fff0d[_0x43df('0x40')]);_0x32eb24['attributes']=_[_0x43df('0x42')](_0x2fff0d[_0x43df('0x43')],qs['fields'](_0x2c612d[_0x43df('0x40')]['fields']));_0x32eb24[_0x43df('0x44')]=_0x32eb24['attributes']['length']?_0x32eb24[_0x43df('0x44')]:_0x2fff0d[_0x43df('0x43')];if(!_0x2c612d[_0x43df('0x40')][_0x43df('0x45')](_0x43df('0x46'))){_0x32eb24[_0x43df('0x2e')]=qs[_0x43df('0x2e')](_0x2c612d[_0x43df('0x40')][_0x43df('0x2e')]);_0x32eb24[_0x43df('0x2c')]=qs['offset'](_0x2c612d['query'][_0x43df('0x2c')]);}_0x32eb24['order']=qs[_0x43df('0x47')](_0x2c612d[_0x43df('0x40')][_0x43df('0x47')]);_0x32eb24[_0x43df('0x48')]=qs[_0x43df('0x49')](_['pick'](_0x2c612d[_0x43df('0x40')],_0x2fff0d[_0x43df('0x49')]),_0xc81c5e);if(_0x2c612d[_0x43df('0x40')][_0x43df('0x4a')]){_0x32eb24[_0x43df('0x48')]=_[_0x43df('0x4b')](_0x32eb24[_0x43df('0x48')],{'$or':_[_0x43df('0x3b')](_0xc81c5e,function(_0x2a01bf){if(_0x2a01bf[_0x43df('0x3e')]!==_0x43df('0x4c')){var _0xaa86da={};_0xaa86da[_0x2a01bf[_0x43df('0x38')]]={'$like':'%'+_0x2c612d['query']['filter']+'%'};return _0xaa86da;}})});}_0x32eb24=_[_0x43df('0x4b')]({},_0x32eb24,_0x2c612d[_0x43df('0x4d')]);var _0x5c4182={'where':_0x32eb24[_0x43df('0x48')]};return db['WhatsappAccount'][_0x43df('0x2f')](_0x5c4182)[_0x43df('0x1e')](function(_0x57abdd){_0x3ff779[_0x43df('0x2f')]=_0x57abdd;if(_0x2c612d[_0x43df('0x40')]['includeAll']){_0x32eb24[_0x43df('0x4e')]=[{'all':!![]}];}return db[_0x43df('0x4f')][_0x43df('0x50')](_0x32eb24);})[_0x43df('0x1e')](function(_0x67410e){_0x3ff779[_0x43df('0x51')]=_0x67410e;return _0x3ff779;})[_0x43df('0x1e')](respondWithFilteredResult(_0x1da30a,_0x32eb24))[_0x43df('0x27')](handleError(_0x1da30a,null));};exports[_0x43df('0x52')]=function(_0x230a62,_0x144328){var _0x32db9a={'raw':![],'where':{'id':_0x230a62[_0x43df('0x53')]['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x4bc54e={};_0x4bc54e[_0x43df('0x43')]=_[_0x43df('0x41')](db[_0x43df('0x4f')][_0x43df('0x3c')]);_0x4bc54e['query']=_[_0x43df('0x41')](_0x230a62[_0x43df('0x40')]);_0x4bc54e['filters']=_[_0x43df('0x42')](_0x4bc54e[_0x43df('0x43')],_0x4bc54e[_0x43df('0x40')]);_0x32db9a[_0x43df('0x44')]=_[_0x43df('0x42')](_0x4bc54e['model'],qs[_0x43df('0x54')](_0x230a62[_0x43df('0x40')]['fields']));_0x32db9a[_0x43df('0x44')]=_0x32db9a[_0x43df('0x44')][_0x43df('0x55')]?_0x32db9a[_0x43df('0x44')]:_0x4bc54e[_0x43df('0x43')];if(_0x230a62[_0x43df('0x40')][_0x43df('0x56')]){_0x32db9a[_0x43df('0x4e')]=[{'all':!![]}];}_0x32db9a=_[_0x43df('0x4b')]({},_0x32db9a,_0x230a62[_0x43df('0x4d')]);return db['WhatsappAccount'][_0x43df('0x57')](_0x32db9a)[_0x43df('0x1e')](handleEntityNotFound(_0x144328,null))[_0x43df('0x1e')](respondWithResult(_0x144328,null))[_0x43df('0x27')](handleError(_0x144328,null));};exports[_0x43df('0x58')]=function(_0x28d890,_0x5a2e81){return db[_0x43df('0x4f')][_0x43df('0x58')](_0x28d890['body'],{})[_0x43df('0x1e')](function(_0x359137){var _0x443c0b=_0x28d890['user'][_0x43df('0x36')]({'plain':!![]});if(!_0x443c0b)throw new Error(_0x43df('0x59'));if(_0x443c0b[_0x43df('0x5a')]===_0x43df('0x5b')){var _0xa78e36=_0x359137[_0x43df('0x36')]({'plain':!![]});var _0x437b3e=_0x43df('0x5c');return db['UserProfileSection'][_0x43df('0x57')]({'where':{'name':_0x437b3e,'userProfileId':_0x443c0b[_0x43df('0x5d')]},'raw':!![]})[_0x43df('0x1e')](function(_0x2f5a3a){if(_0x2f5a3a&&_0x2f5a3a[_0x43df('0x5e')]===0x0){return db[_0x43df('0x37')]['create']({'name':_0xa78e36[_0x43df('0x38')],'resourceId':_0xa78e36['id'],'type':_0x2f5a3a[_0x43df('0x38')],'sectionId':_0x2f5a3a['id']},{})[_0x43df('0x1e')](function(){return _0x359137;});}else{return _0x359137;}})[_0x43df('0x27')](function(_0x4958e8){logger[_0x43df('0x23')](_0x43df('0x5f'),_0x4958e8);throw _0x4958e8;});}return _0x359137;})[_0x43df('0x1e')](respondWithResult(_0x5a2e81,0xc9))['catch'](handleError(_0x5a2e81,null));};exports['update']=function(_0x2b8526,_0x180161){if(_0x2b8526['body']['id']){delete _0x2b8526['body']['id'];}return db['WhatsappAccount'][_0x43df('0x57')]({'where':{'id':_0x2b8526[_0x43df('0x53')]['id']},'include':[{'model':db[_0x43df('0x3a')],'as':_0x43df('0x60')}]})['then'](handleEntityNotFound(_0x180161,null))[_0x43df('0x1e')](saveUpdates(_0x2b8526[_0x43df('0x61')],null))[_0x43df('0x1e')](respondWithResult(_0x180161,null))['catch'](handleError(_0x180161,null));};exports['destroy']=function(_0x393927,_0x33503f){return db[_0x43df('0x4f')][_0x43df('0x57')]({'where':{'id':_0x393927[_0x43df('0x53')]['id']}})[_0x43df('0x1e')](handleEntityNotFound(_0x33503f,null))[_0x43df('0x1e')](removeEntity(_0x33503f,null))[_0x43df('0x27')](handleError(_0x33503f,null));};exports[_0x43df('0x62')]=function(_0xa734b9,_0x1ec510){return db['WhatsappAccount'][_0x43df('0x62')]()['then'](respondWithResult(_0x1ec510,null))[_0x43df('0x27')](handleError(_0x1ec510,null));};exports['addDisposition']=function(_0x48c8ea,_0x1a0cdc,_0x44c3de){if(_0x48c8ea[_0x43df('0x61')]['id']){delete _0x48c8ea[_0x43df('0x61')]['id'];}return db[_0x43df('0x4f')][_0x43df('0x57')]({'where':{'id':_0x48c8ea[_0x43df('0x53')]['id']}})[_0x43df('0x1e')](handleEntityNotFound(_0x1a0cdc,null))[_0x43df('0x1e')](function(_0x4a068a){if(_0x4a068a){_0x48c8ea['body'][_0x43df('0x63')]=_0x4a068a['id'];return db[_0x43df('0x64')][_0x43df('0x58')](_0x48c8ea[_0x43df('0x61')]);}})[_0x43df('0x1e')](respondWithResult(_0x1a0cdc,null))[_0x43df('0x27')](handleError(_0x1a0cdc,null));};exports['getDispositions']=function(_0x1cb474,_0xaa55ba,_0x9a7dc6){var _0x45e70e={'raw':![],'where':{}};var _0x49bd19={};var _0x24dda1={'count':0x0,'rows':[]};return db[_0x43df('0x4f')][_0x43df('0x65')]({'where':{'id':_0x1cb474[_0x43df('0x53')]['id']}})[_0x43df('0x1e')](handleEntityNotFound(_0xaa55ba,null))[_0x43df('0x1e')](function(_0x4b048f){if(_0x4b048f){_0x49bd19['model']=_['keys'](db[_0x43df('0x64')]['rawAttributes']);_0x49bd19[_0x43df('0x40')]=_[_0x43df('0x41')](_0x1cb474[_0x43df('0x40')]);_0x49bd19[_0x43df('0x49')]=_[_0x43df('0x42')](_0x49bd19[_0x43df('0x43')],_0x49bd19[_0x43df('0x40')]);_0x45e70e['attributes']=_[_0x43df('0x42')](_0x49bd19[_0x43df('0x43')],qs['fields'](_0x1cb474[_0x43df('0x40')][_0x43df('0x54')]));_0x45e70e['attributes']=_0x45e70e[_0x43df('0x44')]['length']?_0x45e70e[_0x43df('0x44')]:_0x49bd19[_0x43df('0x43')];if(!_0x1cb474[_0x43df('0x40')][_0x43df('0x45')](_0x43df('0x46'))){_0x45e70e[_0x43df('0x2e')]=qs[_0x43df('0x2e')](_0x1cb474[_0x43df('0x40')]['limit']);_0x45e70e[_0x43df('0x2c')]=qs[_0x43df('0x2c')](_0x1cb474[_0x43df('0x40')][_0x43df('0x2c')]);}_0x45e70e[_0x43df('0x66')]=qs[_0x43df('0x47')](_0x1cb474[_0x43df('0x40')][_0x43df('0x47')]);_0x45e70e[_0x43df('0x48')]=qs['filters'](_[_0x43df('0x67')](_0x1cb474[_0x43df('0x40')],_0x49bd19[_0x43df('0x49')]));_0x45e70e[_0x43df('0x48')][_0x43df('0x63')]=_0x4b048f['id'];if(_0x1cb474['query'][_0x43df('0x4a')]){_0x45e70e[_0x43df('0x48')]=_[_0x43df('0x4b')](_0x45e70e['where'],{'$or':_[_0x43df('0x3b')](_0x45e70e[_0x43df('0x44')],function(_0x2bb96c){var _0x9578bf={};_0x9578bf[_0x2bb96c]={'$like':'%'+_0x1cb474['query'][_0x43df('0x4a')]+'%'};return _0x9578bf;})});}_0x45e70e=_[_0x43df('0x4b')]({},_0x45e70e,_0x1cb474[_0x43df('0x4d')]);return db[_0x43df('0x64')][_0x43df('0x2f')]({'where':_0x45e70e[_0x43df('0x48')]})[_0x43df('0x1e')](function(_0x5b3401){_0x24dda1[_0x43df('0x2f')]=_0x5b3401;if(_0x1cb474[_0x43df('0x40')][_0x43df('0x56')]){_0x45e70e['include']=[{'all':!![]}];}return db[_0x43df('0x64')][_0x43df('0x50')](_0x45e70e);})[_0x43df('0x1e')](function(_0x5a850f){_0x24dda1['rows']=_0x5a850f;return _0x24dda1;});}})[_0x43df('0x1e')](respondWithFilteredResult(_0xaa55ba,_0x45e70e))[_0x43df('0x27')](handleError(_0xaa55ba,null));};exports['removeDispositions']=function(_0x32469b,_0x244176,_0x3e95e2){return db[_0x43df('0x4f')][_0x43df('0x57')]({'where':{'id':_0x32469b[_0x43df('0x53')]['id']}})['then'](handleEntityNotFound(_0x244176,null))[_0x43df('0x1e')](function(_0x2826ae){if(_0x2826ae){return _0x2826ae[_0x43df('0x68')](_0x32469b[_0x43df('0x40')]['ids']);}})[_0x43df('0x1e')](respondWithStatusCode(_0x244176,null))['catch'](handleError(_0x244176,null));};exports[_0x43df('0x69')]=function(_0x22f414,_0x41cb07,_0xf6567a){if(_0x22f414[_0x43df('0x61')]['id']){delete _0x22f414[_0x43df('0x61')]['id'];}return db['WhatsappAccount'][_0x43df('0x57')]({'where':{'id':_0x22f414[_0x43df('0x53')]['id']}})['then'](handleEntityNotFound(_0x41cb07,null))[_0x43df('0x1e')](function(_0x20162a){if(_0x20162a){_0x22f414['body'][_0x43df('0x63')]=_0x20162a['id'];return db[_0x43df('0x6a')]['create'](_0x22f414[_0x43df('0x61')]);}})[_0x43df('0x1e')](respondWithResult(_0x41cb07,null))[_0x43df('0x27')](handleError(_0x41cb07,null));};exports[_0x43df('0x6b')]=function(_0x756ddf,_0x351358,_0x459de7){var _0x6b5b69={'raw':![],'where':{}};var _0x2d3570={};var _0x2ba1da={'count':0x0,'rows':[]};return db[_0x43df('0x4f')][_0x43df('0x65')]({'where':{'id':_0x756ddf['params']['id']}})[_0x43df('0x1e')](handleEntityNotFound(_0x351358,null))[_0x43df('0x1e')](function(_0x46d480){if(_0x46d480){_0x2d3570[_0x43df('0x43')]=_[_0x43df('0x41')](db[_0x43df('0x6a')]['rawAttributes']);_0x2d3570[_0x43df('0x40')]=_['keys'](_0x756ddf[_0x43df('0x40')]);_0x2d3570['filters']=_['intersection'](_0x2d3570[_0x43df('0x43')],_0x2d3570[_0x43df('0x40')]);_0x6b5b69[_0x43df('0x44')]=_['intersection'](_0x2d3570[_0x43df('0x43')],qs['fields'](_0x756ddf[_0x43df('0x40')][_0x43df('0x54')]));_0x6b5b69[_0x43df('0x44')]=_0x6b5b69[_0x43df('0x44')][_0x43df('0x55')]?_0x6b5b69[_0x43df('0x44')]:_0x2d3570[_0x43df('0x43')];if(!_0x756ddf[_0x43df('0x40')][_0x43df('0x45')](_0x43df('0x46'))){_0x6b5b69['limit']=qs[_0x43df('0x2e')](_0x756ddf[_0x43df('0x40')][_0x43df('0x2e')]);_0x6b5b69['offset']=qs['offset'](_0x756ddf[_0x43df('0x40')][_0x43df('0x2c')]);}_0x6b5b69[_0x43df('0x66')]=qs['sort'](_0x756ddf[_0x43df('0x40')]['sort']);_0x6b5b69[_0x43df('0x48')]=qs[_0x43df('0x49')](_[_0x43df('0x67')](_0x756ddf[_0x43df('0x40')],_0x2d3570[_0x43df('0x49')]));_0x6b5b69[_0x43df('0x48')]['WhatsappAccountId']=_0x46d480['id'];if(_0x756ddf['query'][_0x43df('0x4a')]){_0x6b5b69[_0x43df('0x48')]=_[_0x43df('0x4b')](_0x6b5b69[_0x43df('0x48')],{'$or':_[_0x43df('0x3b')](_0x6b5b69[_0x43df('0x44')],function(_0x32ed8b){var _0x4163e9={};_0x4163e9[_0x32ed8b]={'$like':'%'+_0x756ddf[_0x43df('0x40')][_0x43df('0x4a')]+'%'};return _0x4163e9;})});}_0x6b5b69=_[_0x43df('0x4b')]({},_0x6b5b69,_0x756ddf['options']);return db['CannedAnswer'][_0x43df('0x2f')]({'where':_0x6b5b69[_0x43df('0x48')]})[_0x43df('0x1e')](function(_0x29169c){_0x2ba1da['count']=_0x29169c;if(_0x756ddf[_0x43df('0x40')][_0x43df('0x56')]){_0x6b5b69['include']=[{'all':!![]}];}return db[_0x43df('0x6a')][_0x43df('0x50')](_0x6b5b69);})[_0x43df('0x1e')](function(_0x298453){_0x2ba1da[_0x43df('0x51')]=_0x298453;return _0x2ba1da;});}})[_0x43df('0x1e')](respondWithFilteredResult(_0x351358,_0x6b5b69))[_0x43df('0x27')](handleError(_0x351358,null));};exports[_0x43df('0x6c')]=function(_0x197f5b,_0x2e130c,_0x16fd0d){return db[_0x43df('0x4f')][_0x43df('0x57')]({'where':{'id':_0x197f5b['params']['id']}})['then'](handleEntityNotFound(_0x2e130c,null))[_0x43df('0x1e')](function(_0x5227d0){if(_0x5227d0){return _0x5227d0[_0x43df('0x6c')](_0x197f5b['query']['ids']);}})['then'](respondWithStatusCode(_0x2e130c,null))[_0x43df('0x27')](handleError(_0x2e130c,null));};exports[_0x43df('0x6d')]=function(_0x9539d7,_0x519452,_0x54b97d){return db[_0x43df('0x4f')]['find']({'where':{'id':_0x9539d7[_0x43df('0x53')]['id']}})[_0x43df('0x1e')](handleEntityNotFound(_0x519452,null))[_0x43df('0x1e')](function(_0x5d3efc){if(_0x5d3efc){return _0x5d3efc[_0x43df('0x6d')](_0x9539d7[_0x43df('0x61')][_0x43df('0x6e')],_['omit'](_0x9539d7['body'],[_0x43df('0x6e'),'id'])||{})[_0x43df('0x6f')](function(_0x4e8673){for(var _0x1ff682=0x0;_0x1ff682<_0x9539d7[_0x43df('0x61')]['ids']['length'];_0x1ff682+=0x1){socket['emit'](_0x43df('0x70'),{'UserId':Number(_0x9539d7[_0x43df('0x61')][_0x43df('0x6e')][_0x1ff682]),'WhatsappAccountId':Number(_0x9539d7['params']['id'])});}return _0x4e8673;});}})['then'](respondWithResult(_0x519452,null))[_0x43df('0x27')](handleError(_0x519452,null));};exports[_0x43df('0x71')]=function(_0x58fdd8,_0xb26bc6,_0x4ddf27){return db['WhatsappAccount'][_0x43df('0x57')]({'where':{'id':_0x58fdd8[_0x43df('0x53')]['id']}})[_0x43df('0x1e')](handleEntityNotFound(_0xb26bc6,null))['then'](function(_0x5e6121){if(_0x5e6121){return _0x5e6121[_0x43df('0x71')](_0x58fdd8['query'][_0x43df('0x6e')])['then'](function(){if(_['isArray'](_0x58fdd8[_0x43df('0x40')][_0x43df('0x6e')])){for(var _0x4bfab1=0x0;_0x4bfab1<_0x58fdd8[_0x43df('0x40')]['ids'][_0x43df('0x55')];_0x4bfab1+=0x1){socket[_0x43df('0x72')](_0x43df('0x73'),{'UserId':Number(_0x58fdd8[_0x43df('0x40')][_0x43df('0x6e')][_0x4bfab1]),'WhatsappAccountId':Number(_0x58fdd8[_0x43df('0x53')]['id'])});}}else{socket[_0x43df('0x72')](_0x43df('0x73'),{'UserId':Number(_0x58fdd8[_0x43df('0x40')][_0x43df('0x6e')]),'WhatsappAccountId':Number(_0x58fdd8[_0x43df('0x53')]['id'])});}});}})['then'](respondWithStatusCode(_0xb26bc6,null))[_0x43df('0x27')](handleError(_0xb26bc6,null));};exports[_0x43df('0x74')]=function(_0x1126ba,_0x5b4e64,_0x20f95b){var _0x3f7fcd={};var _0x2bae9b={};var _0xd7ee95;var _0x106bfc;return db[_0x43df('0x4f')][_0x43df('0x65')]({'where':{'id':_0x1126ba[_0x43df('0x53')]['id']}})[_0x43df('0x1e')](handleEntityNotFound(_0x5b4e64,null))[_0x43df('0x1e')](function(_0x117156){if(_0x117156){_0xd7ee95=_0x117156;_0x2bae9b['model']=_[_0x43df('0x41')](db[_0x43df('0x75')][_0x43df('0x3c')]);_0x2bae9b['query']=_[_0x43df('0x41')](_0x1126ba[_0x43df('0x40')]);_0x2bae9b[_0x43df('0x49')]=_[_0x43df('0x42')](_0x2bae9b[_0x43df('0x43')],_0x2bae9b[_0x43df('0x40')]);_0x3f7fcd[_0x43df('0x44')]=_[_0x43df('0x42')](_0x2bae9b[_0x43df('0x43')],qs['fields'](_0x1126ba[_0x43df('0x40')]['fields']));_0x3f7fcd[_0x43df('0x44')]=_0x3f7fcd[_0x43df('0x44')][_0x43df('0x55')]?_0x3f7fcd[_0x43df('0x44')]:_0x2bae9b[_0x43df('0x43')];_0x3f7fcd[_0x43df('0x66')]=qs[_0x43df('0x47')](_0x1126ba[_0x43df('0x40')][_0x43df('0x47')]);_0x3f7fcd[_0x43df('0x48')]=qs['filters'](_[_0x43df('0x67')](_0x1126ba[_0x43df('0x40')],_0x2bae9b['filters']));if(_0x1126ba[_0x43df('0x40')][_0x43df('0x4a')]){_0x3f7fcd[_0x43df('0x48')]=_['merge'](_0x3f7fcd[_0x43df('0x48')],{'$or':_[_0x43df('0x3b')](_0x3f7fcd[_0x43df('0x44')],function(_0x580491){var _0x4322ad={};_0x4322ad[_0x580491]={'$like':'%'+_0x1126ba[_0x43df('0x40')]['filter']+'%'};return _0x4322ad;})});}_0x3f7fcd=_[_0x43df('0x4b')]({},_0x3f7fcd,_0x1126ba[_0x43df('0x4d')]);return _0xd7ee95['getAgents'](_0x3f7fcd);}})[_0x43df('0x1e')](function(_0x258a1f){if(_0x258a1f){_0x106bfc=_0x258a1f[_0x43df('0x55')];if(!_0x1126ba[_0x43df('0x40')][_0x43df('0x45')](_0x43df('0x46'))){_0x3f7fcd[_0x43df('0x2e')]=qs[_0x43df('0x2e')](_0x1126ba[_0x43df('0x40')][_0x43df('0x2e')]);_0x3f7fcd[_0x43df('0x2c')]=qs[_0x43df('0x2c')](_0x1126ba['query']['offset']);}return _0xd7ee95[_0x43df('0x74')](_0x3f7fcd);}})[_0x43df('0x1e')](function(_0x3a36ca){if(_0x3a36ca){return _0x3a36ca?{'count':_0x106bfc,'rows':_0x3a36ca}:null;}})[_0x43df('0x1e')](respondWithResult(_0x5b4e64,null))[_0x43df('0x27')](handleError(_0x5b4e64,null));};exports[_0x43df('0x76')]=function(_0x52d8b4,_0x34e49f){var _0x2d5fe4=_0x52d8b4['params']['id'];var _0x496c3f=_0x52d8b4[_0x43df('0x61')];var _0x41fea3=0xc8;var _0x5a4334=null;return db[_0x43df('0x77')][_0x43df('0x78')]({'isolationLevel':db['sequelize'][_0x43df('0x79')][_0x43df('0x7a')][_0x43df('0x7b')]},function(_0xbe9208){return db[_0x43df('0x4f')][_0x43df('0x65')]({'where':{'id':_0x2d5fe4},'transaction':_0xbe9208})[_0x43df('0x1e')](function(_0x15adbe){if(_0x15adbe){return db[_0x43df('0x7c')]['destroy']({'where':{'WhatsappAccountId':_0x2d5fe4},'transaction':_0xbe9208})[_0x43df('0x1e')](function(){var _0x11f850=_[_0x43df('0x3b')](_0x496c3f,function(_0x3e2f68){_0x3e2f68[_0x43df('0x63')]=_0x2d5fe4;return _0x3e2f68;});return db[_0x43df('0x7c')]['bulkCreate'](_0x11f850,{'transaction':_0xbe9208});});}else{_0x41fea3=0x194;_0x5a4334=[];}});})['then'](function(){if(_0x41fea3!==0x194){return db[_0x43df('0x7c')][_0x43df('0x7d')]({'where':{'WhatsappAccountId':_0x2d5fe4},'order':_0x43df('0x7e')})['then'](function(_0x10df8e){_0x5a4334=_0x10df8e;});}})[_0x43df('0x27')](function(_0xa25412){_0x41fea3=0x1f4;logger[_0x43df('0x23')](_0xa25412[_0x43df('0x7f')]);if(_0xa25412[_0x43df('0x38')]){delete _0xa25412[_0x43df('0x38')];}_0x5a4334=_0xa25412;})['finally'](function(){if(_0x5a4334===null){_0x34e49f['sendStatus'](_0x41fea3);}else{if(_0x41fea3===0x1f4){_0x34e49f['status'](_0x41fea3)[_0x43df('0x39')](_0x5a4334);}else{_0x34e49f[_0x43df('0x29')](_0x41fea3)[_0x43df('0x2b')](_0x5a4334);}}});};exports[_0x43df('0x80')]=function(_0x311761,_0x272d4f,_0x4f056d){var _0x15c2d7={};var _0x3faeb2={};var _0x19e6b9;var _0x27d4b0;return db[_0x43df('0x4f')]['findOne']({'where':{'id':_0x311761[_0x43df('0x53')]['id']}})[_0x43df('0x1e')](handleEntityNotFound(_0x272d4f,null))[_0x43df('0x1e')](function(_0x30108b){if(_0x30108b){_0x19e6b9=_0x30108b;_0x3faeb2[_0x43df('0x43')]=_['keys'](db[_0x43df('0x7c')]['rawAttributes']);_0x3faeb2[_0x43df('0x40')]=_[_0x43df('0x41')](_0x311761[_0x43df('0x40')]);_0x3faeb2[_0x43df('0x49')]=_[_0x43df('0x42')](_0x3faeb2[_0x43df('0x43')],_0x3faeb2[_0x43df('0x40')]);_0x15c2d7[_0x43df('0x44')]=_[_0x43df('0x42')](_0x3faeb2[_0x43df('0x43')],qs['fields'](_0x311761[_0x43df('0x40')]['fields']));_0x15c2d7[_0x43df('0x44')]=_0x15c2d7['attributes'][_0x43df('0x55')]?_0x15c2d7['attributes']:_0x3faeb2[_0x43df('0x43')];_0x15c2d7[_0x43df('0x66')]=qs[_0x43df('0x47')](_0x311761[_0x43df('0x40')][_0x43df('0x47')]);_0x15c2d7[_0x43df('0x48')]=qs[_0x43df('0x49')](_[_0x43df('0x67')](_0x311761[_0x43df('0x40')],_0x3faeb2[_0x43df('0x49')]));if(_0x311761['query'][_0x43df('0x4a')]){_0x15c2d7[_0x43df('0x48')]=_[_0x43df('0x4b')](_0x15c2d7[_0x43df('0x48')],{'$or':_[_0x43df('0x3b')](_0x15c2d7['attributes'],function(_0xe1bd27){var _0x3c0b6c={};_0x3c0b6c[_0xe1bd27]={'$like':'%'+_0x311761['query'][_0x43df('0x4a')]+'%'};return _0x3c0b6c;})});}_0x15c2d7=_[_0x43df('0x4b')]({},_0x15c2d7,_0x311761['options']);return _0x19e6b9[_0x43df('0x80')](_0x15c2d7);}})['then'](function(_0x390ca8){if(_0x390ca8){_0x27d4b0=_0x390ca8[_0x43df('0x55')];if(!_0x311761[_0x43df('0x40')][_0x43df('0x45')](_0x43df('0x46'))){_0x15c2d7[_0x43df('0x2e')]=qs['limit'](_0x311761[_0x43df('0x40')][_0x43df('0x2e')]);_0x15c2d7[_0x43df('0x2c')]=qs['offset'](_0x311761[_0x43df('0x40')][_0x43df('0x2c')]);}return _0x19e6b9[_0x43df('0x80')](_0x15c2d7);}})[_0x43df('0x1e')](function(_0x26ce2f){if(_0x26ce2f){return _0x26ce2f?{'count':_0x27d4b0,'rows':_0x26ce2f}:null;}})['then'](respondWithResult(_0x272d4f,null))[_0x43df('0x27')](handleError(_0x272d4f,null));};exports[_0x43df('0x81')]=function(_0x3d6e20,_0x4514ad,_0x7a13a6){var _0x661d25={'channel':'whatsapp'};var _0x2b6a66=[];var _0x4dbd41=[];var _0x17e149={};return db[_0x43df('0x4f')]['find']({'where':{'id':_0x3d6e20[_0x43df('0x53')]['id']},'include':[{'model':db['WhatsappApplication'],'as':_0x43df('0x82')}]})[_0x43df('0x1e')](handleEntityNotFound(_0x4514ad,null))[_0x43df('0x1e')](function(_0x391632){_0x661d25[_0x43df('0x83')]=_0x391632;if(_0x661d25['account']&&_0x661d25[_0x43df('0x83')]['type']==='sinch'&&_0x3d6e20[_0x43df('0x61')]['statuses']){if(_0x3d6e20[_0x43df('0x61')][_0x43df('0x84')][_0x43df('0x55')]===0x0)return;if(_0x3d6e20[_0x43df('0x61')][_0x43df('0x84')][0x0][_0x43df('0x85')]!=='read')return;return db[_0x43df('0x86')][_0x43df('0x34')]({'read':!![],'readAt':_0x3d6e20['body'][_0x43df('0x84')][0x0][_0x43df('0x87')]},{'where':{'messageId':_0x3d6e20['body'][_0x43df('0x84')][0x0][_0x43df('0x88')]},'individualHooks':!![]})['then'](function(_0x21cd09){return _0x4514ad['status'](0xc8)[_0x43df('0x2b')](_0x21cd09);});}_0x661d25['applications']=_[_0x43df('0x89')](_0x391632[_0x43df('0x82')],[_0x43df('0x7e')],['asc']);if(_0x661d25[_0x43df('0x83')][_0x43df('0x82')]){delete _0x661d25[_0x43df('0x83')][_0x43df('0x82')];}return db[_0x43df('0x8a')]['describe']()[_0x43df('0x1e')](function(_0x3a4663){if(!_0x3a4663){throw new db[(_0x43df('0x8b'))][(_0x43df('0x8c'))]('no\x20available\x20attributes');}_0x2b6a66=_[_0x43df('0x8d')](_['keys'](_0x3a4663),[_0x43df('0x8e'),'updatedAt']);_0x4dbd41=_[_0x43df('0x8d')](_['keys'](_0x3a4663),[_0x43df('0x8e'),_0x43df('0x8f'),_0x43df('0x90'),'ListId']);_0x661d25[_0x43df('0x61')]={'mapKey':_0x43df('0x91')};if(_0x661d25[_0x43df('0x83')]&&_0x661d25['account'][_0x43df('0x3e')]===_0x43df('0x92')){_0x661d25[_0x43df('0x61')][_0x43df('0x93')]=_0x3d6e20[_0x43df('0x61')][_0x43df('0x94')]['replace'](_0x43df('0x95'),'');_0x661d25[_0x43df('0x61')]['body']=_0x3d6e20[_0x43df('0x61')]['Body'];_0x661d25[_0x43df('0x61')]['messageId']=_0x3d6e20[_0x43df('0x61')][_0x43df('0x96')];}if(_0x661d25[_0x43df('0x83')]&&_0x661d25[_0x43df('0x83')][_0x43df('0x3e')]==='sinch'){_0x661d25[_0x43df('0x61')][_0x43df('0x93')]=_0x3d6e20[_0x43df('0x61')]['notifications'][0x0]['from'];_0x661d25[_0x43df('0x61')][_0x43df('0x61')]=_0x3d6e20[_0x43df('0x61')][_0x43df('0x97')][0x0][_0x43df('0x25')][_0x43df('0x61')];_0x661d25[_0x43df('0x61')][_0x43df('0x98')]=_0x3d6e20[_0x43df('0x61')]['notifications'][0x0][_0x43df('0x88')];}if(_0x661d25[_0x43df('0x61')]['id']){delete _0x661d25[_0x43df('0x61')]['id'];}if(_[_0x43df('0x99')](_0x661d25[_0x43df('0x61')][_0x43df('0x93')])){throw new db[(_0x43df('0x8b'))][(_0x43df('0x8c'))](_0x43df('0x9a'));}if(_[_0x43df('0x99')](_0x661d25['body'][_0x43df('0x61')])||_0x661d25['body'][_0x43df('0x61')]===''){throw new db[(_0x43df('0x8b'))][(_0x43df('0x8c'))](_0x43df('0x9b'));}if(_[_0x43df('0x99')](_0x661d25[_0x43df('0x61')][_0x43df('0x9c')])){throw new db[(_0x43df('0x8b'))]['ValidationError'](_0x43df('0x9d')+_0x4dbd41);}if(!_[_0x43df('0x9e')](_0x4dbd41,_0x661d25[_0x43df('0x61')][_0x43df('0x9c')])){throw new db[(_0x43df('0x8b'))]['ValidationError'](_0x43df('0x9f')+_0x4dbd41);}_0x17e149[_0x661d25[_0x43df('0x61')][_0x43df('0x9c')]]=_0x661d25[_0x43df('0x61')]['from'];return db[_0x43df('0xa0')]['find']({'where':{'id':_0x661d25['account'][_0x43df('0xa1')]},'include':[{'model':db[_0x43df('0x8a')],'as':_0x43df('0xa2'),'where':_0x17e149,'limit':0x1,'order':[['updatedAt',_0x43df('0xa3')]]}]});})[_0x43df('0x1e')](handleEntityNotFound(_0x4514ad,null))[_0x43df('0x1e')](function(_0x319253){if(_0x319253){_0x661d25[_0x43df('0xa4')]=_[_0x43df('0xa5')](_0x319253,[_0x43df('0xa2')]);if(_0x319253[_0x43df('0xa2')][_0x43df('0x55')]){return _0x319253[_0x43df('0xa2')][0x0];}var _0x4ca568=_[_0x43df('0x16')](_0x661d25[_0x43df('0x61')],{'firstName':_0x661d25[_0x43df('0x61')]['from'],'ListId':_0x319253['id']});_0x4ca568[_0x661d25[_0x43df('0x61')][_0x43df('0x9c')]]=_0x661d25[_0x43df('0x61')]['from'];return db[_0x43df('0x8a')][_0x43df('0x58')](_0x4ca568,{'fields':_0x2b6a66,'raw':!![]});}})[_0x43df('0x1e')](handleEntityNotFound(_0x4514ad,null))[_0x43df('0x1e')](function(_0x22437f){if(_0x22437f){_0x661d25['contact']=_0x22437f;var _0x2be04b={'ContactId':_0x22437f['id'],'phone':_0x661d25[_0x43df('0x61')]['from'],'WhatsappAccountId':_0x3d6e20[_0x43df('0x53')]['id']};var _0x40bb74={'ContactId':_0x22437f['id'],'WhatsappAccountId':_0x3d6e20[_0x43df('0x53')]['id'],'closed':![]};return db[_0x43df('0xa6')][_0x43df('0x57')]({'where':_0x40bb74})[_0x43df('0x1e')](function(_0x43d56f){if(_0x43d56f){return[_0x43d56f,![]];}return db[_0x43df('0xa6')][_0x43df('0x58')](_0x2be04b)[_0x43df('0x1e')](function(_0x153b8e){return[_0x153b8e,!![]];});});}})[_0x43df('0x6f')](function(_0x2e4103,_0x5552c8){_0x661d25[_0x43df('0xa7')]=_0x2e4103[_0x43df('0x36')]({'plain':!![]});_0x661d25[_0x43df('0xa7')][_0x43df('0xa8')]=![];if(_0x5552c8){if(_0x661d25[_0x43df('0x83')][_0x43df('0xa9')]){_0x661d25[_0x43df('0xaa')][_0x43df('0xab')]({'id':0x0,'priority':_0x661d25[_0x43df('0xaa')]['length']+0x1,'app':_0x43df('0xac'),'appdata':'unmanaged','interval':_0x43df('0xad')});}_0x661d25[_0x43df('0xa7')][_0x43df('0xa8')]=!![];}return db[_0x43df('0x86')][_0x43df('0x58')]({'phone':_0x661d25[_0x43df('0x61')][_0x43df('0x93')],'messageId':_0x661d25[_0x43df('0x61')][_0x43df('0x98')],'body':_0x661d25['body']['body'],'WhatsappAccountId':_0x3d6e20['params']['id'],'WhatsappInteractionId':_0x2e4103['id'],'direction':'in','ContactId':_0x2e4103[_0x43df('0xae')],'AttachmentId':_0x661d25[_0x43df('0x61')][_0x43df('0xaf')]});})[_0x43df('0x1e')](function(_0x4592ef){_0x661d25[_0x43df('0x25')]=_0x4592ef;if(!_0x661d25[_0x43df('0xa7')][_0x43df('0xb0')])return;return db[_0x43df('0x75')][_0x43df('0x57')]({'attributes':['id',_0x43df('0x38')],'where':{'id':_0x661d25[_0x43df('0xa7')][_0x43df('0xb0')]}});})['then'](function(_0x5db347){if(_0x5db347){_0x661d25[_0x43df('0xaa')][_0x43df('0xb1')]({'id':0x0,'priority':0x0,'app':_0x43df('0xb2'),'appdata':_0x5db347[_0x43df('0x38')]+','+(_0x661d25[_0x43df('0x83')][_0x43df('0xb3')]||0xa),'interval':_0x43df('0xad')});}if(!_0x661d25[_0x43df('0xa7')]['queueId'])return;return db[_0x43df('0xb4')][_0x43df('0x57')]({'attributes':['id',_0x43df('0x38')],'where':{'id':_0x661d25[_0x43df('0xa7')]['queueId']}});})[_0x43df('0x1e')](function(_0x3e2099){if(_0x3e2099){_0x661d25[_0x43df('0xaa')][_0x43df('0xb1')]({'id':0x0,'priority':0x1,'app':_0x43df('0xb5'),'appdata':_0x3e2099[_0x43df('0x38')]+','+(_0x661d25[_0x43df('0x83')][_0x43df('0xb6')]||0x12c),'interval':_0x43df('0xad')});}return respondWithRpcPromise(_0x43df('0xb7'),_0x43df('0xb8'),_0x661d25);})['then'](function(_0x300d2c){if(_0x300d2c){var _0x1aeb0e=0xc8;var _0x2ea899='receiveMessage';logger['info'](_0x43df('0xb9'),_0x2ea899,_0x1aeb0e,_0x43df('0xba'));logger['debug'](_0x43df('0xbb'),_0x2ea899,_0x1aeb0e,_0x43df('0xba'),JSON[_0x43df('0x22')](_0x300d2c));if(_0x661d25[_0x43df('0x83')]['type']===_0x43df('0x92')){return _0x4514ad[_0x43df('0x29')](_0x1aeb0e)[_0x43df('0x30')](_0x43df('0xbc'),_0x43df('0xbd'))['send']('\x0a');}else{return _0x4514ad['status'](_0x1aeb0e)[_0x43df('0x2b')](_0x300d2c);}}});})['catch'](handleError(_0x4514ad,null));};exports[_0x43df('0x39')]=function(_0x15eff8,_0x1afe2a,_0x5cf45c){var _0x310c21,_0x1901ff,_0x105f5e;if(_[_0x43df('0x99')](_0x15eff8[_0x43df('0x61')][_0x43df('0x61')])||_0x15eff8['body']['body']===''){throw new db[(_0x43df('0x8b'))][(_0x43df('0x8c'))](_0x43df('0x9b'));}if(_[_0x43df('0x99')](_0x15eff8[_0x43df('0x61')]['to'])){throw new db[(_0x43df('0x8b'))][(_0x43df('0x8c'))](_0x43df('0xbe'));}_0x310c21=_0x15eff8[_0x43df('0x61')]['to'];return db[_0x43df('0x4f')][_0x43df('0x57')]({'where':{'id':_0x15eff8[_0x43df('0x53')]['id']},'include':[{'model':db[_0x43df('0xa0')],'as':'List','include':[{'model':db[_0x43df('0x8a')],'as':_0x43df('0xa2'),'where':{'mobile':_0x310c21},'limit':0x1,'order':[['updatedAt',_0x43df('0xa3')]]}]}]})[_0x43df('0x1e')](handleEntityNotFound(_0x1afe2a,null))['then'](function(_0x51c2f4){if(_0x51c2f4&&_0x51c2f4[_0x43df('0xbf')]){_0x1901ff=_0x51c2f4['get']({'plain':!![]});if(_0x1901ff[_0x43df('0xbf')]&&_0x1901ff[_0x43df('0xbf')][_0x43df('0xa2')]['length']){return _0x1901ff[_0x43df('0xbf')][_0x43df('0xa2')][0x0];}return db[_0x43df('0x8a')]['create'](_['defaults'](_0x15eff8['body'],{'firstName':_0x310c21,'mobile':_0x310c21,'phone':_0x310c21,'ListId':_0x1901ff['ListId']}));}})['then'](handleEntityNotFound(_0x1afe2a,null))[_0x43df('0x1e')](function(_0x2e730e){if(_0x2e730e){_0x105f5e=_0x2e730e;return db[_0x43df('0xa6')]['find']({'where':{'ContactId':_0x105f5e['id'],'closed':![],'WhatsappAccountId':_0x1901ff['id']}})[_0x43df('0x1e')](function(_0x40ddb3){if(_0x40ddb3){return[_0x40ddb3,![]];}return db['WhatsappInteraction']['create']({'UserId':_0x15eff8['user']['id'],'ContactId':_0x105f5e['id'],'WhatsappAccountId':_0x1901ff['id'],'phone':_0x310c21,'firstMsgDirection':_0x43df('0xc0'),'Messages':[_[_0x43df('0x4b')](_0x15eff8[_0x43df('0x61')],{'read':![],'body':_0x15eff8[_0x43df('0x61')][_0x43df('0x61')],'phone':_0x310c21,'WhatsappAccountId':_0x1901ff['id'],'UserId':_0x15eff8[_0x43df('0x5b')]['id'],'ContactId':_0x105f5e['id']})]},{'include':[{'model':db[_0x43df('0x86')],'as':'Messages'}]})[_0x43df('0x1e')](function(_0x3777e5){return[_0x3777e5,!![]];});});}})[_0x43df('0x6f')](function(_0x1655dd,_0x35b414){if(_0x35b414){return _0x1655dd;}return db['WhatsappMessage'][_0x43df('0x58')](_[_0x43df('0x4b')](_0x15eff8['body'],{'read':![],'body':_0x15eff8[_0x43df('0x61')][_0x43df('0x61')],'phone':_0x310c21,'WhatsappAccountId':_0x1901ff['id'],'WhatsappInteractionId':_0x1655dd['id'],'UserId':_0x15eff8[_0x43df('0x5b')]['id'],'ContactId':_0x105f5e['id']}))[_0x43df('0x1e')](function(_0x16ffdb){_0x1655dd[_0x43df('0xc1')][_0x43df('0xc2')]=[];_0x1655dd['dataValues'][_0x43df('0xc2')]['push'](_0x16ffdb['dataValues']);return _0x1655dd;});})['then'](respondWithResult(_0x1afe2a,null))[_0x43df('0x27')](handleError(_0x1afe2a,null));}; \ No newline at end of file +var _0x9158=['request\x20sent','stringify','error','code','message','WhatsappAccount,\x20%s,\x20%s','result','catch','sendStatus','status','end','json','undefined','limit','count','offset','set','save','update','then','get','UserProfileResource','destroy','stack','name','send','index','Pause','mandatoryDispositionPause','map','fieldName','type','key','query','filters','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','WhatsappAccount','includeAll','findAll','rows','show','keys','rawAttributes','intersection','include','options','find','create','user','role','WhatsappAccounts','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','describe','addDisposition','WhatsappAccountId','Disposition','getDispositions','removeDispositions','ids','addAnswer','CannedAnswer','findOne','removeAnswers','omit','spread','emit','userWhatsappAccount:save','removeAgents','isArray','userWhatsappAccount:remove','getAgents','User','addApplications','transaction','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','WhatsappApplication','findAndCountAll','priority','notify','whatsapp','Applications','account','sinch','statuses','state','read','WhatsappMessage','timestamp','applications','asc','Sequelize','ValidationError','no\x20available\x20attributes','createdAt','updatedAt','difference','ListId','mobile','twilio','from','From','whatsapp:','messageId','MessageSid','notifications','message_id','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','CmContact','Contacts','DESC','list','contact','WhatsappInteraction','interaction','created','push','close','unmanaged','*,*,*,*','AttachmentId','UserId','unshift','agent','waitForTheAssignedAgent','queueId','WhatsappQueue','queue','waitForTheAssignedQueue','Start','startRouting','receiveMessage','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','Content-Type','text/xml','\x0a','to\x20is\x20mandatory','List','out','dataValues','Messages','eml-format','rimraf','zip-dir','request-promise','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','socket.io-emitter','./whatsappAccount.socket','jayson/promise','client','http','request','info','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s'];(function(_0x2e4ca1,_0x317525){var _0x1a47e1=function(_0x38806f){while(--_0x38806f){_0x2e4ca1['push'](_0x2e4ca1['shift']());}};_0x1a47e1(++_0x317525);}(_0x9158,0x16e));var _0x8915=function(_0x5725e3,_0x4c7413){_0x5725e3=_0x5725e3-0x0;var _0x3fbb60=_0x9158[_0x5725e3];return _0x3fbb60;};'use strict';var emlformat=require(_0x8915('0x0'));var rimraf=require(_0x8915('0x1'));var zipdir=require(_0x8915('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8915('0x3'));var moment=require('moment');var BPromise=require(_0x8915('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x8915('0x5'));var sox=require(_0x8915('0x6'));var csv=require(_0x8915('0x7'));var ejs=require(_0x8915('0x8'));var fs=require('fs');var fs_extra=require(_0x8915('0x9'));var _=require(_0x8915('0xa'));var squel=require(_0x8915('0xb'));var crypto=require(_0x8915('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x8915('0xd'));var toCsv=require(_0x8915('0x7'));var querystring=require(_0x8915('0xe'));var Papa=require(_0x8915('0xf'));var Redis=require(_0x8915('0x10'));var authService=require(_0x8915('0x11'));var qs=require(_0x8915('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x8915('0x13'))(_0x8915('0x14'));var utils=require(_0x8915('0x15'));var config=require(_0x8915('0x16'));var licenseUtil=require(_0x8915('0x17'));var db=require(_0x8915('0x18'))['db'];config['redis']=_[_0x8915('0x19')](config[_0x8915('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0x8915('0x1b'))(new Redis(config['redis']));require(_0x8915('0x1c'))['register'](socket);var jayson=require(_0x8915('0x1d'));var client=jayson[_0x8915('0x1e')][_0x8915('0x1f')]({'port':0x232c});function respondWithRpcPromise(_0x430741,_0x8dff4d,_0x57c012,_0x343b9f){return new BPromise(function(_0x30591f,_0xba802f){var _0x3f541c=_0x343b9f||client;return _0x3f541c[_0x8915('0x20')](_0x430741,_0x57c012)['then'](function(_0x1a0e04){logger[_0x8915('0x21')]('WhatsappAccount,\x20%s,\x20%s',_0x8dff4d,'request\x20sent');logger[_0x8915('0x22')](_0x8915('0x23'),_0x8dff4d,_0x8915('0x24'),JSON[_0x8915('0x25')](_0x1a0e04));if(_0x1a0e04[_0x8915('0x26')]){if(_0x1a0e04[_0x8915('0x26')][_0x8915('0x27')]===0x1f4){logger[_0x8915('0x26')]('WhatsappAccount,\x20%s,\x20%s',_0x8dff4d,_0x1a0e04['error'][_0x8915('0x28')]);return _0xba802f(_0x1a0e04[_0x8915('0x26')][_0x8915('0x28')]);}logger[_0x8915('0x26')]('WhatsappAccount,\x20%s,\x20%s',_0x8dff4d,_0x1a0e04[_0x8915('0x26')][_0x8915('0x28')]);return _0x30591f(_0x1a0e04[_0x8915('0x26')][_0x8915('0x28')]);}else{logger[_0x8915('0x21')](_0x8915('0x29'),_0x8dff4d,_0x8915('0x24'));_0x30591f(_0x1a0e04[_0x8915('0x2a')]['message']);}})[_0x8915('0x2b')](function(_0x4e5973){logger[_0x8915('0x26')](_0x8915('0x29'),_0x8dff4d,_0x4e5973);_0xba802f(_0x4e5973);});});}function respondWithStatusCode(_0x4bfcd2,_0x24d707){_0x24d707=_0x24d707||0xcc;return function(_0x3d5754){if(_0x3d5754){return _0x4bfcd2[_0x8915('0x2c')](_0x24d707);}return _0x4bfcd2[_0x8915('0x2d')](_0x24d707)[_0x8915('0x2e')]();};}function respondWithResult(_0x1a9ba2,_0x49373f){_0x49373f=_0x49373f||0xc8;return function(_0x5ea00f){if(_0x5ea00f){return _0x1a9ba2[_0x8915('0x2d')](_0x49373f)[_0x8915('0x2f')](_0x5ea00f);}};}function respondWithFilteredResult(_0x499e80,_0x2124cc){return function(_0x54d3c7){if(_0x54d3c7){var _0x3b133c=typeof _0x2124cc['offset']===_0x8915('0x30')&&typeof _0x2124cc[_0x8915('0x31')]==='undefined';var _0x33c87f=_0x54d3c7[_0x8915('0x32')];var _0x18296c=_0x3b133c?0x0:_0x2124cc[_0x8915('0x33')];var _0xd3eccb=_0x3b133c?_0x54d3c7['count']:_0x2124cc[_0x8915('0x33')]+_0x2124cc['limit'];var _0x37d151;if(_0xd3eccb>=_0x33c87f){_0xd3eccb=_0x33c87f;_0x37d151=0xc8;}else{_0x37d151=0xce;}_0x499e80[_0x8915('0x2d')](_0x37d151);return _0x499e80[_0x8915('0x34')]('Content-Range',_0x18296c+'-'+_0xd3eccb+'/'+_0x33c87f)['json'](_0x54d3c7);}return null;};}function patchUpdates(_0xbeab87){return function(_0x42d20c){try{jsonpatch['apply'](_0x42d20c,_0xbeab87,!![]);}catch(_0x3be0f0){return BPromise['reject'](_0x3be0f0);}return _0x42d20c[_0x8915('0x35')]();};}function saveUpdates(_0xdfb21b,_0x404c9c){return function(_0xca39df){if(_0xca39df){return _0xca39df[_0x8915('0x36')](_0xdfb21b)[_0x8915('0x37')](function(_0x135b73){return _0x135b73;});}return null;};}function removeEntity(_0x158151,_0x28f0d0){return function(_0x1bc7e7){if(_0x1bc7e7){return _0x1bc7e7['destroy']()[_0x8915('0x37')](function(){var _0x366686=_0x1bc7e7[_0x8915('0x38')]({'plain':!![]});var _0x480ab1='WhatsappAccounts';return db[_0x8915('0x39')][_0x8915('0x3a')]({'where':{'type':_0x480ab1,'resourceId':_0x366686['id']}})[_0x8915('0x37')](function(){return _0x1bc7e7;});})[_0x8915('0x37')](function(){_0x158151[_0x8915('0x2d')](0xcc)[_0x8915('0x2e')]();});}};}function handleEntityNotFound(_0x38b27e,_0x50d9c0){return function(_0x388843){if(!_0x388843){_0x38b27e[_0x8915('0x2c')](0x194);}return _0x388843;};}function handleError(_0x42b1d2,_0x15f1d4){_0x15f1d4=_0x15f1d4||0x1f4;return function(_0x2e55c0){logger[_0x8915('0x26')](_0x2e55c0[_0x8915('0x3b')]);if(_0x2e55c0[_0x8915('0x3c')]){delete _0x2e55c0[_0x8915('0x3c')];}_0x42b1d2[_0x8915('0x2d')](_0x15f1d4)[_0x8915('0x3d')](_0x2e55c0);};}exports[_0x8915('0x3e')]=function(_0xa04761,_0x5e7a61){var _0x1cb7da={'include':[{'model':db[_0x8915('0x3f')],'as':_0x8915('0x40')}]},_0x4caed3={},_0x764d8a={'count':0x0,'rows':[]};var _0x5f07de=_[_0x8915('0x41')](db['WhatsappAccount']['rawAttributes'],function(_0x2edfc0){return{'name':_0x2edfc0[_0x8915('0x42')],'type':_0x2edfc0[_0x8915('0x43')][_0x8915('0x44')]};});_0x4caed3['model']=_['map'](_0x5f07de,_0x8915('0x3c'));_0x4caed3[_0x8915('0x45')]=_['keys'](_0xa04761[_0x8915('0x45')]);_0x4caed3[_0x8915('0x46')]=_['intersection'](_0x4caed3['model'],_0x4caed3[_0x8915('0x45')]);_0x1cb7da[_0x8915('0x47')]=_['intersection'](_0x4caed3[_0x8915('0x48')],qs['fields'](_0xa04761[_0x8915('0x45')][_0x8915('0x49')]));_0x1cb7da[_0x8915('0x47')]=_0x1cb7da[_0x8915('0x47')][_0x8915('0x4a')]?_0x1cb7da['attributes']:_0x4caed3[_0x8915('0x48')];if(!_0xa04761[_0x8915('0x45')][_0x8915('0x4b')](_0x8915('0x4c'))){_0x1cb7da['limit']=qs[_0x8915('0x31')](_0xa04761[_0x8915('0x45')]['limit']);_0x1cb7da[_0x8915('0x33')]=qs[_0x8915('0x33')](_0xa04761['query']['offset']);}_0x1cb7da[_0x8915('0x4d')]=qs[_0x8915('0x4e')](_0xa04761[_0x8915('0x45')][_0x8915('0x4e')]);_0x1cb7da[_0x8915('0x4f')]=qs['filters'](_[_0x8915('0x50')](_0xa04761['query'],_0x4caed3[_0x8915('0x46')]),_0x5f07de);if(_0xa04761[_0x8915('0x45')][_0x8915('0x51')]){_0x1cb7da[_0x8915('0x4f')]=_[_0x8915('0x52')](_0x1cb7da[_0x8915('0x4f')],{'$or':_[_0x8915('0x41')](_0x5f07de,function(_0x5b9adc){if(_0x5b9adc[_0x8915('0x43')]!==_0x8915('0x53')){var _0x1f6b36={};_0x1f6b36[_0x5b9adc[_0x8915('0x3c')]]={'$like':'%'+_0xa04761[_0x8915('0x45')][_0x8915('0x51')]+'%'};return _0x1f6b36;}})});}_0x1cb7da=_[_0x8915('0x52')]({},_0x1cb7da,_0xa04761['options']);var _0x31e2e0={'where':_0x1cb7da[_0x8915('0x4f')]};return db[_0x8915('0x54')][_0x8915('0x32')](_0x31e2e0)[_0x8915('0x37')](function(_0x5672ba){_0x764d8a['count']=_0x5672ba;if(_0xa04761[_0x8915('0x45')][_0x8915('0x55')]){_0x1cb7da['include']=[{'all':!![]}];}return db[_0x8915('0x54')][_0x8915('0x56')](_0x1cb7da);})[_0x8915('0x37')](function(_0x5eab00){_0x764d8a[_0x8915('0x57')]=_0x5eab00;return _0x764d8a;})[_0x8915('0x37')](respondWithFilteredResult(_0x5e7a61,_0x1cb7da))['catch'](handleError(_0x5e7a61,null));};exports[_0x8915('0x58')]=function(_0x235bf7,_0x20c198){var _0x33e91e={'raw':![],'where':{'id':_0x235bf7['params']['id']},'include':[{'model':db[_0x8915('0x3f')],'as':'mandatoryDispositionPause'}]},_0x5a2822={};_0x5a2822['model']=_[_0x8915('0x59')](db[_0x8915('0x54')][_0x8915('0x5a')]);_0x5a2822[_0x8915('0x45')]=_[_0x8915('0x59')](_0x235bf7[_0x8915('0x45')]);_0x5a2822[_0x8915('0x46')]=_[_0x8915('0x5b')](_0x5a2822['model'],_0x5a2822[_0x8915('0x45')]);_0x33e91e[_0x8915('0x47')]=_[_0x8915('0x5b')](_0x5a2822[_0x8915('0x48')],qs[_0x8915('0x49')](_0x235bf7[_0x8915('0x45')][_0x8915('0x49')]));_0x33e91e[_0x8915('0x47')]=_0x33e91e[_0x8915('0x47')][_0x8915('0x4a')]?_0x33e91e[_0x8915('0x47')]:_0x5a2822['model'];if(_0x235bf7['query'][_0x8915('0x55')]){_0x33e91e[_0x8915('0x5c')]=[{'all':!![]}];}_0x33e91e=_[_0x8915('0x52')]({},_0x33e91e,_0x235bf7[_0x8915('0x5d')]);return db[_0x8915('0x54')][_0x8915('0x5e')](_0x33e91e)[_0x8915('0x37')](handleEntityNotFound(_0x20c198,null))[_0x8915('0x37')](respondWithResult(_0x20c198,null))[_0x8915('0x2b')](handleError(_0x20c198,null));};exports[_0x8915('0x5f')]=function(_0x5067dc,_0x26d035){return db['WhatsappAccount']['create'](_0x5067dc['body'],{})[_0x8915('0x37')](function(_0x7f760b){var _0x3b5ef6=_0x5067dc[_0x8915('0x60')][_0x8915('0x38')]({'plain':!![]});if(!_0x3b5ef6)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3b5ef6[_0x8915('0x61')]===_0x8915('0x60')){var _0x4df730=_0x7f760b[_0x8915('0x38')]({'plain':!![]});var _0x272966=_0x8915('0x62');return db[_0x8915('0x63')][_0x8915('0x5e')]({'where':{'name':_0x272966,'userProfileId':_0x3b5ef6['userProfileId']},'raw':!![]})[_0x8915('0x37')](function(_0x419985){if(_0x419985&&_0x419985[_0x8915('0x64')]===0x0){return db[_0x8915('0x39')][_0x8915('0x5f')]({'name':_0x4df730[_0x8915('0x3c')],'resourceId':_0x4df730['id'],'type':_0x419985[_0x8915('0x3c')],'sectionId':_0x419985['id']},{})[_0x8915('0x37')](function(){return _0x7f760b;});}else{return _0x7f760b;}})['catch'](function(_0x33b88e){logger['error'](_0x8915('0x65'),_0x33b88e);throw _0x33b88e;});}return _0x7f760b;})[_0x8915('0x37')](respondWithResult(_0x26d035,0xc9))['catch'](handleError(_0x26d035,null));};exports[_0x8915('0x36')]=function(_0x29926c,_0x2d1694){if(_0x29926c[_0x8915('0x66')]['id']){delete _0x29926c[_0x8915('0x66')]['id'];}return db[_0x8915('0x54')][_0x8915('0x5e')]({'where':{'id':_0x29926c[_0x8915('0x67')]['id']},'include':[{'model':db[_0x8915('0x3f')],'as':_0x8915('0x40')}]})[_0x8915('0x37')](handleEntityNotFound(_0x2d1694,null))['then'](saveUpdates(_0x29926c[_0x8915('0x66')],null))[_0x8915('0x37')](respondWithResult(_0x2d1694,null))[_0x8915('0x2b')](handleError(_0x2d1694,null));};exports['destroy']=function(_0x763454,_0x6c8883){return db[_0x8915('0x54')]['find']({'where':{'id':_0x763454[_0x8915('0x67')]['id']}})[_0x8915('0x37')](handleEntityNotFound(_0x6c8883,null))[_0x8915('0x37')](removeEntity(_0x6c8883,null))[_0x8915('0x2b')](handleError(_0x6c8883,null));};exports[_0x8915('0x68')]=function(_0x2d6021,_0x3bf252){return db[_0x8915('0x54')][_0x8915('0x68')]()[_0x8915('0x37')](respondWithResult(_0x3bf252,null))[_0x8915('0x2b')](handleError(_0x3bf252,null));};exports[_0x8915('0x69')]=function(_0x51f060,_0x4912c1,_0x6fdd9e){if(_0x51f060[_0x8915('0x66')]['id']){delete _0x51f060['body']['id'];}return db[_0x8915('0x54')][_0x8915('0x5e')]({'where':{'id':_0x51f060['params']['id']}})[_0x8915('0x37')](handleEntityNotFound(_0x4912c1,null))[_0x8915('0x37')](function(_0x473870){if(_0x473870){_0x51f060[_0x8915('0x66')][_0x8915('0x6a')]=_0x473870['id'];return db[_0x8915('0x6b')][_0x8915('0x5f')](_0x51f060[_0x8915('0x66')]);}})[_0x8915('0x37')](respondWithResult(_0x4912c1,null))[_0x8915('0x2b')](handleError(_0x4912c1,null));};exports[_0x8915('0x6c')]=function(_0x3d0330,_0x305fdf,_0x1fd4cc){var _0x2f1fc8={'raw':![],'where':{}};var _0x830289={};var _0x73aec5={'count':0x0,'rows':[]};return db['WhatsappAccount']['findOne']({'where':{'id':_0x3d0330[_0x8915('0x67')]['id']}})[_0x8915('0x37')](handleEntityNotFound(_0x305fdf,null))['then'](function(_0x1d2266){if(_0x1d2266){_0x830289[_0x8915('0x48')]=_[_0x8915('0x59')](db['Disposition'][_0x8915('0x5a')]);_0x830289[_0x8915('0x45')]=_[_0x8915('0x59')](_0x3d0330[_0x8915('0x45')]);_0x830289['filters']=_['intersection'](_0x830289[_0x8915('0x48')],_0x830289[_0x8915('0x45')]);_0x2f1fc8[_0x8915('0x47')]=_['intersection'](_0x830289['model'],qs[_0x8915('0x49')](_0x3d0330['query'][_0x8915('0x49')]));_0x2f1fc8[_0x8915('0x47')]=_0x2f1fc8[_0x8915('0x47')][_0x8915('0x4a')]?_0x2f1fc8[_0x8915('0x47')]:_0x830289[_0x8915('0x48')];if(!_0x3d0330['query']['hasOwnProperty'](_0x8915('0x4c'))){_0x2f1fc8[_0x8915('0x31')]=qs[_0x8915('0x31')](_0x3d0330[_0x8915('0x45')][_0x8915('0x31')]);_0x2f1fc8[_0x8915('0x33')]=qs[_0x8915('0x33')](_0x3d0330['query'][_0x8915('0x33')]);}_0x2f1fc8[_0x8915('0x4d')]=qs[_0x8915('0x4e')](_0x3d0330[_0x8915('0x45')][_0x8915('0x4e')]);_0x2f1fc8[_0x8915('0x4f')]=qs[_0x8915('0x46')](_[_0x8915('0x50')](_0x3d0330[_0x8915('0x45')],_0x830289[_0x8915('0x46')]));_0x2f1fc8['where'][_0x8915('0x6a')]=_0x1d2266['id'];if(_0x3d0330[_0x8915('0x45')][_0x8915('0x51')]){_0x2f1fc8[_0x8915('0x4f')]=_[_0x8915('0x52')](_0x2f1fc8[_0x8915('0x4f')],{'$or':_[_0x8915('0x41')](_0x2f1fc8[_0x8915('0x47')],function(_0x2fc657){var _0x2a6d83={};_0x2a6d83[_0x2fc657]={'$like':'%'+_0x3d0330[_0x8915('0x45')]['filter']+'%'};return _0x2a6d83;})});}_0x2f1fc8=_['merge']({},_0x2f1fc8,_0x3d0330['options']);return db[_0x8915('0x6b')][_0x8915('0x32')]({'where':_0x2f1fc8['where']})['then'](function(_0x3cd8fb){_0x73aec5[_0x8915('0x32')]=_0x3cd8fb;if(_0x3d0330[_0x8915('0x45')][_0x8915('0x55')]){_0x2f1fc8[_0x8915('0x5c')]=[{'all':!![]}];}return db[_0x8915('0x6b')][_0x8915('0x56')](_0x2f1fc8);})['then'](function(_0x12e496){_0x73aec5[_0x8915('0x57')]=_0x12e496;return _0x73aec5;});}})[_0x8915('0x37')](respondWithFilteredResult(_0x305fdf,_0x2f1fc8))[_0x8915('0x2b')](handleError(_0x305fdf,null));};exports[_0x8915('0x6d')]=function(_0x10efb3,_0x2ea13e,_0x425ca6){return db[_0x8915('0x54')]['find']({'where':{'id':_0x10efb3[_0x8915('0x67')]['id']}})['then'](handleEntityNotFound(_0x2ea13e,null))[_0x8915('0x37')](function(_0x15fcc0){if(_0x15fcc0){return _0x15fcc0[_0x8915('0x6d')](_0x10efb3[_0x8915('0x45')][_0x8915('0x6e')]);}})[_0x8915('0x37')](respondWithStatusCode(_0x2ea13e,null))[_0x8915('0x2b')](handleError(_0x2ea13e,null));};exports[_0x8915('0x6f')]=function(_0x1c6447,_0x3450dd,_0x9b7cfa){if(_0x1c6447[_0x8915('0x66')]['id']){delete _0x1c6447[_0x8915('0x66')]['id'];}return db[_0x8915('0x54')]['find']({'where':{'id':_0x1c6447[_0x8915('0x67')]['id']}})[_0x8915('0x37')](handleEntityNotFound(_0x3450dd,null))[_0x8915('0x37')](function(_0x22beed){if(_0x22beed){_0x1c6447[_0x8915('0x66')][_0x8915('0x6a')]=_0x22beed['id'];return db[_0x8915('0x70')]['create'](_0x1c6447[_0x8915('0x66')]);}})[_0x8915('0x37')](respondWithResult(_0x3450dd,null))[_0x8915('0x2b')](handleError(_0x3450dd,null));};exports['getAnswers']=function(_0x35e769,_0x202075,_0x4cbd38){var _0xdc805d={'raw':![],'where':{}};var _0x48a068={};var _0x4f4f50={'count':0x0,'rows':[]};return db['WhatsappAccount'][_0x8915('0x71')]({'where':{'id':_0x35e769[_0x8915('0x67')]['id']}})[_0x8915('0x37')](handleEntityNotFound(_0x202075,null))['then'](function(_0x1deb41){if(_0x1deb41){_0x48a068[_0x8915('0x48')]=_[_0x8915('0x59')](db['CannedAnswer']['rawAttributes']);_0x48a068['query']=_[_0x8915('0x59')](_0x35e769[_0x8915('0x45')]);_0x48a068[_0x8915('0x46')]=_['intersection'](_0x48a068[_0x8915('0x48')],_0x48a068[_0x8915('0x45')]);_0xdc805d['attributes']=_['intersection'](_0x48a068[_0x8915('0x48')],qs[_0x8915('0x49')](_0x35e769[_0x8915('0x45')][_0x8915('0x49')]));_0xdc805d[_0x8915('0x47')]=_0xdc805d[_0x8915('0x47')][_0x8915('0x4a')]?_0xdc805d[_0x8915('0x47')]:_0x48a068[_0x8915('0x48')];if(!_0x35e769[_0x8915('0x45')]['hasOwnProperty'](_0x8915('0x4c'))){_0xdc805d[_0x8915('0x31')]=qs[_0x8915('0x31')](_0x35e769[_0x8915('0x45')][_0x8915('0x31')]);_0xdc805d[_0x8915('0x33')]=qs[_0x8915('0x33')](_0x35e769['query']['offset']);}_0xdc805d[_0x8915('0x4d')]=qs[_0x8915('0x4e')](_0x35e769['query'][_0x8915('0x4e')]);_0xdc805d[_0x8915('0x4f')]=qs[_0x8915('0x46')](_[_0x8915('0x50')](_0x35e769[_0x8915('0x45')],_0x48a068[_0x8915('0x46')]));_0xdc805d[_0x8915('0x4f')]['WhatsappAccountId']=_0x1deb41['id'];if(_0x35e769['query'][_0x8915('0x51')]){_0xdc805d[_0x8915('0x4f')]=_[_0x8915('0x52')](_0xdc805d[_0x8915('0x4f')],{'$or':_['map'](_0xdc805d[_0x8915('0x47')],function(_0x1139a4){var _0x38fa7f={};_0x38fa7f[_0x1139a4]={'$like':'%'+_0x35e769[_0x8915('0x45')]['filter']+'%'};return _0x38fa7f;})});}_0xdc805d=_[_0x8915('0x52')]({},_0xdc805d,_0x35e769[_0x8915('0x5d')]);return db[_0x8915('0x70')]['count']({'where':_0xdc805d[_0x8915('0x4f')]})[_0x8915('0x37')](function(_0x2f0a6d){_0x4f4f50[_0x8915('0x32')]=_0x2f0a6d;if(_0x35e769[_0x8915('0x45')][_0x8915('0x55')]){_0xdc805d[_0x8915('0x5c')]=[{'all':!![]}];}return db[_0x8915('0x70')]['findAll'](_0xdc805d);})[_0x8915('0x37')](function(_0x3c169b){_0x4f4f50[_0x8915('0x57')]=_0x3c169b;return _0x4f4f50;});}})['then'](respondWithFilteredResult(_0x202075,_0xdc805d))['catch'](handleError(_0x202075,null));};exports['removeAnswers']=function(_0x3858d7,_0x23dfad,_0x2a1828){return db[_0x8915('0x54')][_0x8915('0x5e')]({'where':{'id':_0x3858d7[_0x8915('0x67')]['id']}})[_0x8915('0x37')](handleEntityNotFound(_0x23dfad,null))['then'](function(_0x4127c8){if(_0x4127c8){return _0x4127c8[_0x8915('0x72')](_0x3858d7[_0x8915('0x45')][_0x8915('0x6e')]);}})[_0x8915('0x37')](respondWithStatusCode(_0x23dfad,null))[_0x8915('0x2b')](handleError(_0x23dfad,null));};exports['addAgents']=function(_0x2d0471,_0x5194f2,_0x2d3e5e){return db[_0x8915('0x54')][_0x8915('0x5e')]({'where':{'id':_0x2d0471[_0x8915('0x67')]['id']}})[_0x8915('0x37')](handleEntityNotFound(_0x5194f2,null))[_0x8915('0x37')](function(_0x25056f){if(_0x25056f){return _0x25056f['addAgents'](_0x2d0471[_0x8915('0x66')]['ids'],_[_0x8915('0x73')](_0x2d0471[_0x8915('0x66')],[_0x8915('0x6e'),'id'])||{})[_0x8915('0x74')](function(_0x3ba5e8){for(var _0x326463=0x0;_0x326463<_0x2d0471[_0x8915('0x66')][_0x8915('0x6e')][_0x8915('0x4a')];_0x326463+=0x1){socket[_0x8915('0x75')](_0x8915('0x76'),{'UserId':Number(_0x2d0471[_0x8915('0x66')][_0x8915('0x6e')][_0x326463]),'WhatsappAccountId':Number(_0x2d0471[_0x8915('0x67')]['id'])});}return _0x3ba5e8;});}})[_0x8915('0x37')](respondWithResult(_0x5194f2,null))['catch'](handleError(_0x5194f2,null));};exports[_0x8915('0x77')]=function(_0x49a520,_0x1fe13e,_0x2dcab2){return db[_0x8915('0x54')]['find']({'where':{'id':_0x49a520['params']['id']}})[_0x8915('0x37')](handleEntityNotFound(_0x1fe13e,null))['then'](function(_0xffcd81){if(_0xffcd81){return _0xffcd81[_0x8915('0x77')](_0x49a520['query'][_0x8915('0x6e')])[_0x8915('0x37')](function(){if(_[_0x8915('0x78')](_0x49a520['query'][_0x8915('0x6e')])){for(var _0x9a7844=0x0;_0x9a7844<_0x49a520[_0x8915('0x45')][_0x8915('0x6e')][_0x8915('0x4a')];_0x9a7844+=0x1){socket['emit']('userWhatsappAccount:remove',{'UserId':Number(_0x49a520['query']['ids'][_0x9a7844]),'WhatsappAccountId':Number(_0x49a520[_0x8915('0x67')]['id'])});}}else{socket[_0x8915('0x75')](_0x8915('0x79'),{'UserId':Number(_0x49a520[_0x8915('0x45')][_0x8915('0x6e')]),'WhatsappAccountId':Number(_0x49a520[_0x8915('0x67')]['id'])});}});}})[_0x8915('0x37')](respondWithStatusCode(_0x1fe13e,null))[_0x8915('0x2b')](handleError(_0x1fe13e,null));};exports[_0x8915('0x7a')]=function(_0x24cfad,_0x5e26ff,_0x4df8d6){var _0x32783a={};var _0x253081={};var _0x3d8feb;var _0x5dab30;return db[_0x8915('0x54')][_0x8915('0x71')]({'where':{'id':_0x24cfad[_0x8915('0x67')]['id']}})[_0x8915('0x37')](handleEntityNotFound(_0x5e26ff,null))[_0x8915('0x37')](function(_0x1637c6){if(_0x1637c6){_0x3d8feb=_0x1637c6;_0x253081[_0x8915('0x48')]=_['keys'](db[_0x8915('0x7b')][_0x8915('0x5a')]);_0x253081[_0x8915('0x45')]=_[_0x8915('0x59')](_0x24cfad[_0x8915('0x45')]);_0x253081[_0x8915('0x46')]=_[_0x8915('0x5b')](_0x253081['model'],_0x253081[_0x8915('0x45')]);_0x32783a[_0x8915('0x47')]=_['intersection'](_0x253081[_0x8915('0x48')],qs['fields'](_0x24cfad[_0x8915('0x45')][_0x8915('0x49')]));_0x32783a[_0x8915('0x47')]=_0x32783a['attributes'][_0x8915('0x4a')]?_0x32783a[_0x8915('0x47')]:_0x253081['model'];_0x32783a[_0x8915('0x4d')]=qs[_0x8915('0x4e')](_0x24cfad[_0x8915('0x45')][_0x8915('0x4e')]);_0x32783a[_0x8915('0x4f')]=qs[_0x8915('0x46')](_[_0x8915('0x50')](_0x24cfad[_0x8915('0x45')],_0x253081['filters']));if(_0x24cfad[_0x8915('0x45')][_0x8915('0x51')]){_0x32783a[_0x8915('0x4f')]=_[_0x8915('0x52')](_0x32783a['where'],{'$or':_[_0x8915('0x41')](_0x32783a[_0x8915('0x47')],function(_0x32688f){var _0x259c23={};_0x259c23[_0x32688f]={'$like':'%'+_0x24cfad[_0x8915('0x45')][_0x8915('0x51')]+'%'};return _0x259c23;})});}_0x32783a=_['merge']({},_0x32783a,_0x24cfad['options']);return _0x3d8feb[_0x8915('0x7a')](_0x32783a);}})[_0x8915('0x37')](function(_0x50da3d){if(_0x50da3d){_0x5dab30=_0x50da3d[_0x8915('0x4a')];if(!_0x24cfad['query'][_0x8915('0x4b')](_0x8915('0x4c'))){_0x32783a[_0x8915('0x31')]=qs[_0x8915('0x31')](_0x24cfad[_0x8915('0x45')][_0x8915('0x31')]);_0x32783a[_0x8915('0x33')]=qs[_0x8915('0x33')](_0x24cfad[_0x8915('0x45')][_0x8915('0x33')]);}return _0x3d8feb[_0x8915('0x7a')](_0x32783a);}})[_0x8915('0x37')](function(_0x13af36){if(_0x13af36){return _0x13af36?{'count':_0x5dab30,'rows':_0x13af36}:null;}})[_0x8915('0x37')](respondWithResult(_0x5e26ff,null))[_0x8915('0x2b')](handleError(_0x5e26ff,null));};exports[_0x8915('0x7c')]=function(_0x28e90b,_0x26e748){var _0x59f127=_0x28e90b[_0x8915('0x67')]['id'];var _0x3a1798=_0x28e90b[_0x8915('0x66')];var _0x30c761=0xc8;var _0x224242=null;return db['sequelize'][_0x8915('0x7d')]({'isolationLevel':db[_0x8915('0x7e')][_0x8915('0x7f')][_0x8915('0x80')][_0x8915('0x81')]},function(_0x202ded){return db[_0x8915('0x54')][_0x8915('0x71')]({'where':{'id':_0x59f127},'transaction':_0x202ded})[_0x8915('0x37')](function(_0x2b3b3f){if(_0x2b3b3f){return db[_0x8915('0x82')][_0x8915('0x3a')]({'where':{'WhatsappAccountId':_0x59f127},'transaction':_0x202ded})[_0x8915('0x37')](function(){var _0x4e591e=_[_0x8915('0x41')](_0x3a1798,function(_0x554479){_0x554479['WhatsappAccountId']=_0x59f127;return _0x554479;});return db[_0x8915('0x82')]['bulkCreate'](_0x4e591e,{'transaction':_0x202ded});});}else{_0x30c761=0x194;_0x224242=[];}});})[_0x8915('0x37')](function(){if(_0x30c761!==0x194){return db['WhatsappApplication'][_0x8915('0x83')]({'where':{'WhatsappAccountId':_0x59f127},'order':_0x8915('0x84')})['then'](function(_0x5c4c04){_0x224242=_0x5c4c04;});}})[_0x8915('0x2b')](function(_0x5d2bb9){_0x30c761=0x1f4;logger['error'](_0x5d2bb9[_0x8915('0x3b')]);if(_0x5d2bb9['name']){delete _0x5d2bb9[_0x8915('0x3c')];}_0x224242=_0x5d2bb9;})['finally'](function(){if(_0x224242===null){_0x26e748[_0x8915('0x2c')](_0x30c761);}else{if(_0x30c761===0x1f4){_0x26e748[_0x8915('0x2d')](_0x30c761)[_0x8915('0x3d')](_0x224242);}else{_0x26e748['status'](_0x30c761)[_0x8915('0x2f')](_0x224242);}}});};exports['getApplications']=function(_0x420d2d,_0x28875b,_0x412189){var _0x484a62={};var _0x5063cc={};var _0x4200c3;var _0x4adadc;return db[_0x8915('0x54')]['findOne']({'where':{'id':_0x420d2d[_0x8915('0x67')]['id']}})['then'](handleEntityNotFound(_0x28875b,null))[_0x8915('0x37')](function(_0x2a6c7a){if(_0x2a6c7a){_0x4200c3=_0x2a6c7a;_0x5063cc[_0x8915('0x48')]=_['keys'](db['WhatsappApplication'][_0x8915('0x5a')]);_0x5063cc[_0x8915('0x45')]=_[_0x8915('0x59')](_0x420d2d[_0x8915('0x45')]);_0x5063cc['filters']=_[_0x8915('0x5b')](_0x5063cc[_0x8915('0x48')],_0x5063cc[_0x8915('0x45')]);_0x484a62[_0x8915('0x47')]=_[_0x8915('0x5b')](_0x5063cc['model'],qs[_0x8915('0x49')](_0x420d2d['query']['fields']));_0x484a62['attributes']=_0x484a62[_0x8915('0x47')][_0x8915('0x4a')]?_0x484a62[_0x8915('0x47')]:_0x5063cc[_0x8915('0x48')];_0x484a62[_0x8915('0x4d')]=qs[_0x8915('0x4e')](_0x420d2d[_0x8915('0x45')][_0x8915('0x4e')]);_0x484a62[_0x8915('0x4f')]=qs[_0x8915('0x46')](_[_0x8915('0x50')](_0x420d2d[_0x8915('0x45')],_0x5063cc[_0x8915('0x46')]));if(_0x420d2d[_0x8915('0x45')]['filter']){_0x484a62[_0x8915('0x4f')]=_['merge'](_0x484a62[_0x8915('0x4f')],{'$or':_[_0x8915('0x41')](_0x484a62[_0x8915('0x47')],function(_0x7916c7){var _0x4a7687={};_0x4a7687[_0x7916c7]={'$like':'%'+_0x420d2d[_0x8915('0x45')][_0x8915('0x51')]+'%'};return _0x4a7687;})});}_0x484a62=_['merge']({},_0x484a62,_0x420d2d[_0x8915('0x5d')]);return _0x4200c3['getApplications'](_0x484a62);}})['then'](function(_0x22f9da){if(_0x22f9da){_0x4adadc=_0x22f9da[_0x8915('0x4a')];if(!_0x420d2d['query'][_0x8915('0x4b')](_0x8915('0x4c'))){_0x484a62[_0x8915('0x31')]=qs[_0x8915('0x31')](_0x420d2d[_0x8915('0x45')]['limit']);_0x484a62['offset']=qs[_0x8915('0x33')](_0x420d2d[_0x8915('0x45')]['offset']);}return _0x4200c3['getApplications'](_0x484a62);}})[_0x8915('0x37')](function(_0x5dca0f){if(_0x5dca0f){return _0x5dca0f?{'count':_0x4adadc,'rows':_0x5dca0f}:null;}})['then'](respondWithResult(_0x28875b,null))[_0x8915('0x2b')](handleError(_0x28875b,null));};exports[_0x8915('0x85')]=function(_0x24ec63,_0x5ac0d2,_0x22b227){var _0x212458={'channel':_0x8915('0x86')};var _0x522296=[];var _0x36fccd=[];var _0x4175c1={};return db['WhatsappAccount'][_0x8915('0x5e')]({'where':{'id':_0x24ec63[_0x8915('0x67')]['id']},'include':[{'model':db[_0x8915('0x82')],'as':_0x8915('0x87')}]})[_0x8915('0x37')](handleEntityNotFound(_0x5ac0d2,null))[_0x8915('0x37')](function(_0x5b2a68){_0x212458['account']=_0x5b2a68;if(_0x212458[_0x8915('0x88')]&&_0x212458[_0x8915('0x88')][_0x8915('0x43')]===_0x8915('0x89')&&_0x24ec63['body'][_0x8915('0x8a')]){if(_0x24ec63[_0x8915('0x66')][_0x8915('0x8a')][_0x8915('0x4a')]===0x0)return;if(_0x24ec63[_0x8915('0x66')][_0x8915('0x8a')][0x0][_0x8915('0x8b')]!==_0x8915('0x8c'))return;return db[_0x8915('0x8d')][_0x8915('0x36')]({'read':!![],'readAt':_0x24ec63[_0x8915('0x66')]['statuses'][0x0][_0x8915('0x8e')]},{'where':{'messageId':_0x24ec63[_0x8915('0x66')][_0x8915('0x8a')][0x0]['message_id']},'individualHooks':!![]})['then'](function(_0x5517da){return _0x5ac0d2[_0x8915('0x2d')](0xc8)[_0x8915('0x2f')](_0x5517da);});}_0x212458[_0x8915('0x8f')]=_['orderBy'](_0x5b2a68[_0x8915('0x87')],[_0x8915('0x84')],[_0x8915('0x90')]);if(_0x212458[_0x8915('0x88')][_0x8915('0x87')]){delete _0x212458['account'][_0x8915('0x87')];}return db['CmContact']['describe']()[_0x8915('0x37')](function(_0x218852){if(!_0x218852){throw new db[(_0x8915('0x91'))][(_0x8915('0x92'))](_0x8915('0x93'));}_0x522296=_['difference'](_[_0x8915('0x59')](_0x218852),[_0x8915('0x94'),_0x8915('0x95')]);_0x36fccd=_[_0x8915('0x96')](_[_0x8915('0x59')](_0x218852),['createdAt','updatedAt','CompanyId',_0x8915('0x97')]);_0x212458[_0x8915('0x66')]={'mapKey':_0x8915('0x98')};if(_0x212458[_0x8915('0x88')]&&_0x212458['account'][_0x8915('0x43')]===_0x8915('0x99')){_0x212458['body'][_0x8915('0x9a')]=_0x24ec63[_0x8915('0x66')][_0x8915('0x9b')]['replace'](_0x8915('0x9c'),'');_0x212458['body'][_0x8915('0x66')]=_0x24ec63[_0x8915('0x66')]['Body'];_0x212458['body'][_0x8915('0x9d')]=_0x24ec63[_0x8915('0x66')][_0x8915('0x9e')];}if(_0x212458[_0x8915('0x88')]&&_0x212458[_0x8915('0x88')][_0x8915('0x43')]==='sinch'){_0x212458[_0x8915('0x66')]['from']=_0x24ec63[_0x8915('0x66')]['notifications'][0x0][_0x8915('0x9a')];_0x212458['body']['body']=_0x24ec63[_0x8915('0x66')][_0x8915('0x9f')][0x0][_0x8915('0x28')][_0x8915('0x66')];_0x212458['body'][_0x8915('0x9d')]=_0x24ec63[_0x8915('0x66')][_0x8915('0x9f')][0x0][_0x8915('0xa0')];}if(_0x212458['body']['id']){delete _0x212458[_0x8915('0x66')]['id'];}if(_[_0x8915('0xa1')](_0x212458[_0x8915('0x66')][_0x8915('0x9a')])){throw new db[(_0x8915('0x91'))][(_0x8915('0x92'))](_0x8915('0xa2'));}if(_[_0x8915('0xa1')](_0x212458[_0x8915('0x66')][_0x8915('0x66')])||_0x212458['body'][_0x8915('0x66')]===''){throw new db[(_0x8915('0x91'))][(_0x8915('0x92'))](_0x8915('0xa3'));}if(_[_0x8915('0xa1')](_0x212458[_0x8915('0x66')][_0x8915('0xa4')])){throw new db[(_0x8915('0x91'))][(_0x8915('0x92'))](_0x8915('0xa5')+_0x36fccd);}if(!_['includes'](_0x36fccd,_0x212458[_0x8915('0x66')][_0x8915('0xa4')])){throw new db[(_0x8915('0x91'))][(_0x8915('0x92'))](_0x8915('0xa6')+_0x36fccd);}_0x4175c1[_0x212458[_0x8915('0x66')][_0x8915('0xa4')]]=_0x212458['body'][_0x8915('0x9a')];return db[_0x8915('0xa7')][_0x8915('0x5e')]({'where':{'id':_0x212458[_0x8915('0x88')][_0x8915('0x97')]},'include':[{'model':db[_0x8915('0xa8')],'as':_0x8915('0xa9'),'where':_0x4175c1,'limit':0x1,'order':[[_0x8915('0x95'),_0x8915('0xaa')]]}]});})[_0x8915('0x37')](handleEntityNotFound(_0x5ac0d2,null))['then'](function(_0x4033d6){if(_0x4033d6){_0x212458[_0x8915('0xab')]=_['omit'](_0x4033d6,[_0x8915('0xa9')]);if(_0x4033d6[_0x8915('0xa9')][_0x8915('0x4a')]){return _0x4033d6[_0x8915('0xa9')][0x0];}var _0x4d56c9=_[_0x8915('0x19')](_0x212458[_0x8915('0x66')],{'firstName':_0x212458[_0x8915('0x66')]['from'],'ListId':_0x4033d6['id']});_0x4d56c9[_0x212458[_0x8915('0x66')][_0x8915('0xa4')]]=_0x212458[_0x8915('0x66')]['from'];return db['CmContact'][_0x8915('0x5f')](_0x4d56c9,{'fields':_0x522296,'raw':!![]});}})[_0x8915('0x37')](handleEntityNotFound(_0x5ac0d2,null))[_0x8915('0x37')](function(_0x5303bd){if(_0x5303bd){_0x212458[_0x8915('0xac')]=_0x5303bd;var _0x4e3fe0={'ContactId':_0x5303bd['id'],'phone':_0x212458[_0x8915('0x66')][_0x8915('0x9a')],'WhatsappAccountId':_0x24ec63['params']['id']};var _0x28e9fc={'ContactId':_0x5303bd['id'],'WhatsappAccountId':_0x24ec63['params']['id'],'closed':![]};return db[_0x8915('0xad')][_0x8915('0x5e')]({'where':_0x28e9fc})[_0x8915('0x37')](function(_0x55d145){if(_0x55d145){return[_0x55d145,![]];}return db[_0x8915('0xad')][_0x8915('0x5f')](_0x4e3fe0)[_0x8915('0x37')](function(_0x155ee3){return[_0x155ee3,!![]];});});}})[_0x8915('0x74')](function(_0x373241,_0x193e67){_0x212458[_0x8915('0xae')]=_0x373241[_0x8915('0x38')]({'plain':!![]});_0x212458['interaction'][_0x8915('0xaf')]=![];if(_0x193e67){if(_0x212458[_0x8915('0x88')]['autoclose']){_0x212458[_0x8915('0x8f')][_0x8915('0xb0')]({'id':0x0,'priority':_0x212458[_0x8915('0x8f')]['length']+0x1,'app':_0x8915('0xb1'),'appdata':_0x8915('0xb2'),'interval':_0x8915('0xb3')});}_0x212458['interaction']['created']=!![];}return db['WhatsappMessage'][_0x8915('0x5f')]({'phone':_0x212458[_0x8915('0x66')]['from'],'messageId':_0x212458[_0x8915('0x66')][_0x8915('0x9d')],'body':_0x212458[_0x8915('0x66')]['body'],'WhatsappAccountId':_0x24ec63['params']['id'],'WhatsappInteractionId':_0x373241['id'],'direction':'in','ContactId':_0x373241['ContactId'],'AttachmentId':_0x212458[_0x8915('0x66')][_0x8915('0xb4')]});})[_0x8915('0x37')](function(_0x2de1b1){_0x212458[_0x8915('0x28')]=_0x2de1b1;if(!_0x212458[_0x8915('0xae')][_0x8915('0xb5')])return;return db['User'][_0x8915('0x5e')]({'attributes':['id',_0x8915('0x3c')],'where':{'id':_0x212458[_0x8915('0xae')][_0x8915('0xb5')]}});})[_0x8915('0x37')](function(_0x300a44){if(_0x300a44){_0x212458[_0x8915('0x8f')][_0x8915('0xb6')]({'id':0x0,'priority':0x0,'app':_0x8915('0xb7'),'appdata':_0x300a44[_0x8915('0x3c')]+','+(_0x212458[_0x8915('0x88')][_0x8915('0xb8')]||0xa),'interval':_0x8915('0xb3')});}if(!_0x212458[_0x8915('0xae')][_0x8915('0xb9')])return;return db[_0x8915('0xba')]['find']({'attributes':['id',_0x8915('0x3c')],'where':{'id':_0x212458['interaction'][_0x8915('0xb9')]}});})['then'](function(_0x4453af){if(_0x4453af){_0x212458[_0x8915('0x8f')]['unshift']({'id':0x0,'priority':0x1,'app':_0x8915('0xbb'),'appdata':_0x4453af[_0x8915('0x3c')]+','+(_0x212458['account'][_0x8915('0xbc')]||0x12c),'interval':_0x8915('0xb3')});}return respondWithRpcPromise(_0x8915('0xbd'),_0x8915('0xbe'),_0x212458);})['then'](function(_0x28fbe2){if(_0x28fbe2){var _0x2280d1=0xc8;var _0x5773b6=_0x8915('0xbf');logger['info'](_0x8915('0x23'),_0x5773b6,_0x2280d1,'entity\x20found');logger[_0x8915('0x22')](_0x8915('0xc0'),_0x5773b6,_0x2280d1,'entity\x20found',JSON[_0x8915('0x25')](_0x28fbe2));if(_0x212458[_0x8915('0x88')][_0x8915('0x43')]===_0x8915('0x99')){return _0x5ac0d2[_0x8915('0x2d')](_0x2280d1)[_0x8915('0x34')](_0x8915('0xc1'),_0x8915('0xc2'))[_0x8915('0x3d')](_0x8915('0xc3'));}else{return _0x5ac0d2[_0x8915('0x2d')](_0x2280d1)[_0x8915('0x2f')](_0x28fbe2);}}});})['catch'](handleError(_0x5ac0d2,null));};exports[_0x8915('0x3d')]=function(_0x5c5bdb,_0x11a301,_0x8a1ec3){var _0x581acb,_0x3edf64,_0x4d23ed;if(_[_0x8915('0xa1')](_0x5c5bdb[_0x8915('0x66')][_0x8915('0x66')])||_0x5c5bdb[_0x8915('0x66')]['body']===''){throw new db['Sequelize'][(_0x8915('0x92'))](_0x8915('0xa3'));}if(_['isNil'](_0x5c5bdb[_0x8915('0x66')]['to'])){throw new db[(_0x8915('0x91'))]['ValidationError'](_0x8915('0xc4'));}_0x581acb=_0x5c5bdb[_0x8915('0x66')]['to'];return db[_0x8915('0x54')][_0x8915('0x5e')]({'where':{'id':_0x5c5bdb[_0x8915('0x67')]['id']},'include':[{'model':db['CmList'],'as':_0x8915('0xc5'),'include':[{'model':db[_0x8915('0xa8')],'as':'Contacts','where':{'mobile':_0x581acb},'limit':0x1,'order':[[_0x8915('0x95'),'DESC']]}]}]})[_0x8915('0x37')](handleEntityNotFound(_0x11a301,null))['then'](function(_0x2cabf6){if(_0x2cabf6&&_0x2cabf6[_0x8915('0xc5')]){_0x3edf64=_0x2cabf6['get']({'plain':!![]});if(_0x3edf64[_0x8915('0xc5')]&&_0x3edf64['List'][_0x8915('0xa9')]['length']){return _0x3edf64['List'][_0x8915('0xa9')][0x0];}return db[_0x8915('0xa8')][_0x8915('0x5f')](_[_0x8915('0x19')](_0x5c5bdb['body'],{'firstName':_0x581acb,'mobile':_0x581acb,'phone':_0x581acb,'ListId':_0x3edf64[_0x8915('0x97')]}));}})[_0x8915('0x37')](handleEntityNotFound(_0x11a301,null))[_0x8915('0x37')](function(_0x33ef59){if(_0x33ef59){_0x4d23ed=_0x33ef59;return db[_0x8915('0xad')][_0x8915('0x5e')]({'where':{'ContactId':_0x4d23ed['id'],'closed':![],'WhatsappAccountId':_0x3edf64['id']}})[_0x8915('0x37')](function(_0x172a09){if(_0x172a09){return[_0x172a09,![]];}return db[_0x8915('0xad')][_0x8915('0x5f')]({'UserId':_0x5c5bdb[_0x8915('0x60')]['id'],'ContactId':_0x4d23ed['id'],'WhatsappAccountId':_0x3edf64['id'],'phone':_0x581acb,'firstMsgDirection':_0x8915('0xc6'),'Messages':[_[_0x8915('0x52')](_0x5c5bdb['body'],{'read':![],'body':_0x5c5bdb[_0x8915('0x66')][_0x8915('0x66')],'phone':_0x581acb,'WhatsappAccountId':_0x3edf64['id'],'UserId':_0x5c5bdb[_0x8915('0x60')]['id'],'ContactId':_0x4d23ed['id']})]},{'include':[{'model':db[_0x8915('0x8d')],'as':'Messages'}]})[_0x8915('0x37')](function(_0x4d464c){return[_0x4d464c,!![]];});});}})['spread'](function(_0x1abd5a,_0x1dd96f){if(_0x1dd96f){return _0x1abd5a;}return db[_0x8915('0x8d')]['create'](_[_0x8915('0x52')](_0x5c5bdb['body'],{'read':![],'body':_0x5c5bdb['body']['body'],'phone':_0x581acb,'WhatsappAccountId':_0x3edf64['id'],'WhatsappInteractionId':_0x1abd5a['id'],'UserId':_0x5c5bdb[_0x8915('0x60')]['id'],'ContactId':_0x4d23ed['id']}))[_0x8915('0x37')](function(_0x1a7a56){_0x1abd5a[_0x8915('0xc7')]['Messages']=[];_0x1abd5a['dataValues'][_0x8915('0xc8')][_0x8915('0xb0')](_0x1a7a56['dataValues']);return _0x1abd5a;});})[_0x8915('0x37')](respondWithResult(_0x11a301,null))[_0x8915('0x2b')](handleError(_0x11a301,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index e99ee40..90618fc 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 _0xa476=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','WhatsappAccount','save','update','remove'];(function(_0x37a513,_0xfbf741){var _0x59d8a5=function(_0x2d4683){while(--_0x2d4683){_0x37a513['push'](_0x37a513['shift']());}};_0x59d8a5(++_0xfbf741);}(_0xa476,0x9a));var _0x6a47=function(_0x430645,_0x453b78){_0x430645=_0x430645-0x0;var _0x478100=_0xa476[_0x430645];return _0x478100;};'use strict';var EventEmitter=require(_0x6a47('0x0'));var WhatsappAccount=require(_0x6a47('0x1'))['db'][_0x6a47('0x2')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x6a47('0x3'),'afterUpdate':_0x6a47('0x4'),'afterDestroy':_0x6a47('0x5')};function emitEvent(_0x2ad929){return function(_0x52ff5e,_0x2112e4,_0x41cf10){WhatsappAccountEvents['emit'](_0x2ad929+':'+_0x52ff5e['id'],_0x52ff5e);WhatsappAccountEvents[_0x6a47('0x6')](_0x2ad929,_0x52ff5e);_0x41cf10(null);};}for(var e in events){if(events[_0x6a47('0x7')](e)){var event=events[e];WhatsappAccount[_0x6a47('0x8')](e,emitEvent(event));}}module[_0x6a47('0x9')]=WhatsappAccountEvents; \ No newline at end of file +var _0xf697=['save','update','remove','emit','hasOwnProperty','events','../../mysqldb','WhatsappAccount','setMaxListeners'];(function(_0x1e6e4e,_0x2b1b09){var _0x3d746b=function(_0x4483dd){while(--_0x4483dd){_0x1e6e4e['push'](_0x1e6e4e['shift']());}};_0x3d746b(++_0x2b1b09);}(_0xf697,0x1c7));var _0x7f69=function(_0x4cd00b,_0x483633){_0x4cd00b=_0x4cd00b-0x0;var _0x488623=_0xf697[_0x4cd00b];return _0x488623;};'use strict';var EventEmitter=require(_0x7f69('0x0'));var WhatsappAccount=require(_0x7f69('0x1'))['db'][_0x7f69('0x2')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0x7f69('0x3')](0x0);var events={'afterCreate':_0x7f69('0x4'),'afterUpdate':_0x7f69('0x5'),'afterDestroy':_0x7f69('0x6')};function emitEvent(_0x21b103){return function(_0x4bf7a3,_0x3bfbe5,_0x38f049){WhatsappAccountEvents[_0x7f69('0x7')](_0x21b103+':'+_0x4bf7a3['id'],_0x4bf7a3);WhatsappAccountEvents[_0x7f69('0x7')](_0x21b103,_0x4bf7a3);_0x38f049(null);};}for(var e in events){if(events[_0x7f69('0x8')](e)){var event=events[e];WhatsappAccount['hook'](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 ad2a48c..5c546fb 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 _0xed78=['whatsapp_accounts','lodash','util','../../config/logger','api','bluebird','path','rimraf','./whatsappAccount.attributes','exports','define','WhatsappAccount'];(function(_0x18ab2a,_0x4debcd){var _0x16dcee=function(_0x10107a){while(--_0x10107a){_0x18ab2a['push'](_0x18ab2a['shift']());}};_0x16dcee(++_0x4debcd);}(_0xed78,0xd9));var _0x8ed7=function(_0x373f8c,_0x427eae){_0x373f8c=_0x373f8c-0x0;var _0xc86f7a=_0xed78[_0x373f8c];return _0xc86f7a;};'use strict';var _=require(_0x8ed7('0x0'));var util=require(_0x8ed7('0x1'));var logger=require(_0x8ed7('0x2'))(_0x8ed7('0x3'));var moment=require('moment');var BPromise=require(_0x8ed7('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8ed7('0x5'));var rimraf=require(_0x8ed7('0x6'));var config=require('../../config/environment');var attributes=require(_0x8ed7('0x7'));module[_0x8ed7('0x8')]=function(_0x29ee44,_0x5f0b1a){return _0x29ee44[_0x8ed7('0x9')](_0x8ed7('0xa'),attributes,{'tableName':_0x8ed7('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x572f=['util','api','bluebird','path','rimraf','../../config/environment','./whatsappAccount.attributes','exports','whatsapp_accounts','lodash'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x572f,0x15d));var _0xf572=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x572f[_0x2641f9];return _0x585741;};'use strict';var _=require(_0xf572('0x0'));var util=require(_0xf572('0x1'));var logger=require('../../config/logger')(_0xf572('0x2'));var moment=require('moment');var BPromise=require(_0xf572('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf572('0x4'));var rimraf=require(_0xf572('0x5'));var config=require(_0xf572('0x6'));var attributes=require(_0xf572('0x7'));module[_0xf572('0x8')]=function(_0x29b816,_0x52bb75){return _0x29b816['define']('WhatsappAccount',attributes,{'tableName':_0xf572('0x9'),'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 1a38e4f..6771212 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 _0x7017=['WhatsappAccount,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','ShowWhatsappAccount','find','options','where','attributes','include','model','map','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','localhost','socket.io-emitter','request','then','info'];(function(_0x3590a4,_0x2eea94){var _0x17a579=function(_0x185371){while(--_0x185371){_0x3590a4['push'](_0x3590a4['shift']());}};_0x17a579(++_0x2eea94);}(_0x7017,0x187));var _0x7701=function(_0x5c2e3e,_0x26ecd3){_0x5c2e3e=_0x5c2e3e-0x0;var _0x53f64a=_0x7017[_0x5c2e3e];return _0x53f64a;};'use strict';var _=require('lodash');var util=require(_0x7701('0x0'));var moment=require(_0x7701('0x1'));var BPromise=require(_0x7701('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7701('0x3'));var db=require(_0x7701('0x4'))['db'];var utils=require(_0x7701('0x5'));var logger=require(_0x7701('0x6'))(_0x7701('0x7'));var config=require(_0x7701('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x7701('0x9')][_0x7701('0xa')]({'port':0x232a});config[_0x7701('0xb')]=_['defaults'](config[_0x7701('0xb')],{'host':_0x7701('0xc'),'port':0x18eb});var socket=require(_0x7701('0xd'))(new Redis(config[_0x7701('0xb')]));require('./whatsappAccount.socket')['register'](socket);function respondWithRpcPromise(_0x50b54a,_0x233ab8,_0x34b1e9){return new BPromise(function(_0x28ad43,_0x42f29e){return client[_0x7701('0xe')](_0x50b54a,_0x34b1e9)[_0x7701('0xf')](function(_0x1306e1){logger[_0x7701('0x10')](_0x7701('0x11'),_0x233ab8,'request\x20sent');logger[_0x7701('0x12')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x233ab8,_0x7701('0x13'),JSON[_0x7701('0x14')](_0x1306e1));if(_0x1306e1[_0x7701('0x15')]){if(_0x1306e1[_0x7701('0x15')][_0x7701('0x16')]===0x1f4){logger[_0x7701('0x15')](_0x7701('0x11'),_0x233ab8,_0x1306e1[_0x7701('0x15')][_0x7701('0x17')]);return _0x42f29e(_0x1306e1[_0x7701('0x15')][_0x7701('0x17')]);}logger['error'](_0x7701('0x11'),_0x233ab8,_0x1306e1[_0x7701('0x15')][_0x7701('0x17')]);return _0x28ad43(_0x1306e1['error'][_0x7701('0x17')]);}else{logger[_0x7701('0x10')]('WhatsappAccount,\x20%s,\x20%s',_0x233ab8,'request\x20sent');_0x28ad43(_0x1306e1[_0x7701('0x18')][_0x7701('0x17')]);}})[_0x7701('0x19')](function(_0x455645){logger[_0x7701('0x15')](_0x7701('0x11'),_0x233ab8,_0x455645);_0x42f29e(_0x455645);});});}exports[_0x7701('0x1a')]=function(_0x3f3740){var _0x309e90=this;return new Promise(function(_0x490ff1,_0x579801){return db['WhatsappAccount'][_0x7701('0x1b')]({'raw':_0x3f3740[_0x7701('0x1c')]?_0x3f3740[_0x7701('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x3f3740['options']?_0x3f3740[_0x7701('0x1c')][_0x7701('0x1d')]||null:null,'attributes':_0x3f3740[_0x7701('0x1c')]?_0x3f3740[_0x7701('0x1c')][_0x7701('0x1e')]||null:null,'include':_0x3f3740[_0x7701('0x1c')]?_0x3f3740[_0x7701('0x1c')][_0x7701('0x1f')]?_['map'](_0x3f3740[_0x7701('0x1c')][_0x7701('0x1f')],function(_0x16fe06){return{'model':db[_0x16fe06[_0x7701('0x20')]],'as':_0x16fe06['as'],'attributes':_0x16fe06[_0x7701('0x1e')],'include':_0x16fe06[_0x7701('0x1f')]?_[_0x7701('0x21')](_0x16fe06[_0x7701('0x1f')],function(_0xe3c9a8){return{'model':db[_0xe3c9a8[_0x7701('0x20')]],'as':_0xe3c9a8['as'],'attributes':_0xe3c9a8['attributes'],'include':_0xe3c9a8[_0x7701('0x1f')]?_[_0x7701('0x21')](_0xe3c9a8['include'],function(_0x1ccc79){return{'model':db[_0x1ccc79[_0x7701('0x20')]],'as':_0x1ccc79['as'],'attributes':_0x1ccc79[_0x7701('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x7701('0xf')](function(_0x1b50da){logger[_0x7701('0x10')](_0x7701('0x1a'),_0x3f3740);logger['debug'](_0x7701('0x1a'),_0x3f3740,JSON[_0x7701('0x14')](_0x1b50da));_0x490ff1(_0x1b50da);})[_0x7701('0x19')](function(_0xf00fe1){logger[_0x7701('0x15')]('ShowWhatsappAccount',_0xf00fe1[_0x7701('0x17')],_0x3f3740);_0x579801(_0x309e90[_0x7701('0x15')](0x1f4,_0xf00fe1['message']));});});}; \ No newline at end of file +var _0xaa35=['code','message','info','result','ShowWhatsappAccount','WhatsappAccount','find','options','raw','where','attributes','include','map','model','stringify','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./whatsappAccount.socket','request','then','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','error'];(function(_0x4d9952,_0x53c3d1){var _0x18c159=function(_0x4a42ad){while(--_0x4a42ad){_0x4d9952['push'](_0x4d9952['shift']());}};_0x18c159(++_0x53c3d1);}(_0xaa35,0x112));var _0x5aa3=function(_0x36f47c,_0x38ef4d){_0x36f47c=_0x36f47c-0x0;var _0x296c55=_0xaa35[_0x36f47c];return _0x296c55;};'use strict';var _=require(_0x5aa3('0x0'));var util=require('util');var moment=require(_0x5aa3('0x1'));var BPromise=require('bluebird');var rs=require(_0x5aa3('0x2'));var fs=require('fs');var Redis=require(_0x5aa3('0x3'));var db=require(_0x5aa3('0x4'))['db'];var utils=require(_0x5aa3('0x5'));var logger=require('../../config/logger')(_0x5aa3('0x6'));var config=require(_0x5aa3('0x7'));var jayson=require(_0x5aa3('0x8'));var client=jayson[_0x5aa3('0x9')][_0x5aa3('0xa')]({'port':0x232a});config[_0x5aa3('0xb')]=_[_0x5aa3('0xc')](config[_0x5aa3('0xb')],{'host':_0x5aa3('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x5aa3('0xb')]));require(_0x5aa3('0xe'))['register'](socket);function respondWithRpcPromise(_0xeaea5e,_0x4e94cd,_0x4d1b51){return new BPromise(function(_0x2cc5f7,_0x3b7697){return client[_0x5aa3('0xf')](_0xeaea5e,_0x4d1b51)[_0x5aa3('0x10')](function(_0x5d5b2d){logger['info'](_0x5aa3('0x11'),_0x4e94cd,_0x5aa3('0x12'));logger[_0x5aa3('0x13')](_0x5aa3('0x14'),_0x4e94cd,_0x5aa3('0x12'),JSON['stringify'](_0x5d5b2d));if(_0x5d5b2d[_0x5aa3('0x15')]){if(_0x5d5b2d[_0x5aa3('0x15')][_0x5aa3('0x16')]===0x1f4){logger['error'](_0x5aa3('0x11'),_0x4e94cd,_0x5d5b2d[_0x5aa3('0x15')][_0x5aa3('0x17')]);return _0x3b7697(_0x5d5b2d[_0x5aa3('0x15')]['message']);}logger[_0x5aa3('0x15')](_0x5aa3('0x11'),_0x4e94cd,_0x5d5b2d['error'][_0x5aa3('0x17')]);return _0x2cc5f7(_0x5d5b2d[_0x5aa3('0x15')][_0x5aa3('0x17')]);}else{logger[_0x5aa3('0x18')](_0x5aa3('0x11'),_0x4e94cd,_0x5aa3('0x12'));_0x2cc5f7(_0x5d5b2d[_0x5aa3('0x19')][_0x5aa3('0x17')]);}})['catch'](function(_0x4d1dd2){logger[_0x5aa3('0x15')](_0x5aa3('0x11'),_0x4e94cd,_0x4d1dd2);_0x3b7697(_0x4d1dd2);});});}exports[_0x5aa3('0x1a')]=function(_0x40a8bf){var _0x433106=this;return new Promise(function(_0x1bf9cf,_0x4574bc){return db[_0x5aa3('0x1b')][_0x5aa3('0x1c')]({'raw':_0x40a8bf[_0x5aa3('0x1d')]?_0x40a8bf[_0x5aa3('0x1d')][_0x5aa3('0x1e')]===undefined?!![]:![]:!![],'where':_0x40a8bf[_0x5aa3('0x1d')]?_0x40a8bf['options'][_0x5aa3('0x1f')]||null:null,'attributes':_0x40a8bf['options']?_0x40a8bf['options'][_0x5aa3('0x20')]||null:null,'include':_0x40a8bf['options']?_0x40a8bf[_0x5aa3('0x1d')][_0x5aa3('0x21')]?_[_0x5aa3('0x22')](_0x40a8bf[_0x5aa3('0x1d')][_0x5aa3('0x21')],function(_0x46af2e){return{'model':db[_0x46af2e[_0x5aa3('0x23')]],'as':_0x46af2e['as'],'attributes':_0x46af2e[_0x5aa3('0x20')],'include':_0x46af2e[_0x5aa3('0x21')]?_[_0x5aa3('0x22')](_0x46af2e[_0x5aa3('0x21')],function(_0x72fd68){return{'model':db[_0x72fd68[_0x5aa3('0x23')]],'as':_0x72fd68['as'],'attributes':_0x72fd68[_0x5aa3('0x20')],'include':_0x72fd68[_0x5aa3('0x21')]?_[_0x5aa3('0x22')](_0x72fd68[_0x5aa3('0x21')],function(_0x4a1706){return{'model':db[_0x4a1706[_0x5aa3('0x23')]],'as':_0x4a1706['as'],'attributes':_0x4a1706['attributes']};}):[]};}):[]};}):[]:[]})[_0x5aa3('0x10')](function(_0x2cedf2){logger[_0x5aa3('0x18')](_0x5aa3('0x1a'),_0x40a8bf);logger[_0x5aa3('0x13')](_0x5aa3('0x1a'),_0x40a8bf,JSON[_0x5aa3('0x24')](_0x2cedf2));_0x1bf9cf(_0x2cedf2);})['catch'](function(_0x59e8ae){logger['error'](_0x5aa3('0x1a'),_0x59e8ae['message'],_0x40a8bf);_0x4574bc(_0x433106[_0x5aa3('0x15')](0x1f4,_0x59e8ae[_0x5aa3('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index e9fe0dc..8d3ecb5 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 _0xebf9=['whatsappAccount:','save','remove','update','emit','removeListener','length'];(function(_0x45efc3,_0x21cf51){var _0x34f990=function(_0x4b6f81){while(--_0x4b6f81){_0x45efc3['push'](_0x45efc3['shift']());}};_0x34f990(++_0x21cf51);}(_0xebf9,0x143));var _0x9ebf=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xebf9[_0x20a584];return _0x4b41a8;};'use strict';var WhatsappAccountEvents=require('./whatsappAccount.events');var events=[_0x9ebf('0x0'),_0x9ebf('0x1'),_0x9ebf('0x2')];function createListener(_0x4ee8c3,_0x3ad430){return function(_0xcf9f82){_0x3ad430[_0x9ebf('0x3')](_0x4ee8c3,_0xcf9f82);};}function removeListener(_0x30040f,_0x3da1f5){return function(){WhatsappAccountEvents[_0x9ebf('0x4')](_0x30040f,_0x3da1f5);};}exports['register']=function(_0x23548f){for(var _0x2633ff=0x0,_0x131b63=events[_0x9ebf('0x5')];_0x2633ff<_0x131b63;_0x2633ff++){var _0x511953=events[_0x2633ff];var _0x269e20=createListener(_0x9ebf('0x6')+_0x511953,_0x23548f);WhatsappAccountEvents['on'](_0x511953,_0x269e20);}}; \ No newline at end of file +var _0x5672=['./whatsappAccount.events','remove','update','emit','removeListener','register','length','whatsappAccount:'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x5672,0xe0));var _0x2567=function(_0x255b94,_0x352b45){_0x255b94=_0x255b94-0x0;var _0xc5806b=_0x5672[_0x255b94];return _0xc5806b;};'use strict';var WhatsappAccountEvents=require(_0x2567('0x0'));var events=['save',_0x2567('0x1'),_0x2567('0x2')];function createListener(_0x482b47,_0x358c05){return function(_0x39f6f4){_0x358c05[_0x2567('0x3')](_0x482b47,_0x39f6f4);};}function removeListener(_0x47c357,_0x353e84){return function(){WhatsappAccountEvents[_0x2567('0x4')](_0x47c357,_0x353e84);};}exports[_0x2567('0x5')]=function(_0x368fc6){for(var _0x504082=0x0,_0x4d5291=events[_0x2567('0x6')];_0x504082<_0x4d5291;_0x504082++){var _0x2681cf=events[_0x504082];var _0x58be7a=createListener(_0x2567('0x7')+_0x2681cf,_0x368fc6);WhatsappAccountEvents['on'](_0x2681cf,_0x58be7a);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index c1c86c6..2ee11a2 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 _0x6373=['path','connect-timeout','express','Router','fs-extra','isAuthenticated','get','/:id','show','post','create','put','update','delete','destroy','multer','util'];(function(_0xfae484,_0x252de4){var _0x1718d7=function(_0x1cc401){while(--_0x1cc401){_0xfae484['push'](_0xfae484['shift']());}};_0x1718d7(++_0x252de4);}(_0x6373,0x1b8));var _0x3637=function(_0x3ad0fa,_0x1de705){_0x3ad0fa=_0x3ad0fa-0x0;var _0x358665=_0x6373[_0x3ad0fa];return _0x358665;};'use strict';var multer=require(_0x3637('0x0'));var util=require(_0x3637('0x1'));var path=require(_0x3637('0x2'));var timeout=require(_0x3637('0x3'));var express=require(_0x3637('0x4'));var router=express[_0x3637('0x5')]();var fs_extra=require(_0x3637('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./whatsappApplication.controller');router['get']('/',auth[_0x3637('0x7')](),controller['index']);router[_0x3637('0x8')](_0x3637('0x9'),auth[_0x3637('0x7')](),controller[_0x3637('0xa')]);router[_0x3637('0xb')]('/',auth['isAuthenticated'](),controller[_0x3637('0xc')]);router[_0x3637('0xd')](_0x3637('0x9'),auth[_0x3637('0x7')](),controller[_0x3637('0xe')]);router[_0x3637('0xf')]('/:id',auth[_0x3637('0x7')](),controller[_0x3637('0x10')]);module['exports']=router; \ No newline at end of file +var _0x8e18=['exports','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','show','create','put','delete','destroy'];(function(_0x561f25,_0x2d95c1){var _0x150e4c=function(_0x266e99){while(--_0x266e99){_0x561f25['push'](_0x561f25['shift']());}};_0x150e4c(++_0x2d95c1);}(_0x8e18,0x1e1));var _0x88e1=function(_0x4a8826,_0x554de4){_0x4a8826=_0x4a8826-0x0;var _0x7fd780=_0x8e18[_0x4a8826];return _0x7fd780;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x88e1('0x0'));var timeout=require('connect-timeout');var express=require(_0x88e1('0x1'));var router=express['Router']();var fs_extra=require(_0x88e1('0x2'));var auth=require(_0x88e1('0x3'));var interaction=require(_0x88e1('0x4'));var config=require('../../config/environment');var controller=require('./whatsappApplication.controller');router[_0x88e1('0x5')]('/',auth[_0x88e1('0x6')](),controller[_0x88e1('0x7')]);router[_0x88e1('0x5')](_0x88e1('0x8'),auth[_0x88e1('0x6')](),controller[_0x88e1('0x9')]);router['post']('/',auth[_0x88e1('0x6')](),controller[_0x88e1('0xa')]);router[_0x88e1('0xb')](_0x88e1('0x8'),auth[_0x88e1('0x6')](),controller['update']);router[_0x88e1('0xc')](_0x88e1('0x8'),auth[_0x88e1('0x6')](),controller[_0x88e1('0xd')]);module[_0x88e1('0xe')]=router; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.attributes.js b/server/api/whatsappApplication/whatsappApplication.attributes.js index 18045be..299622a 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 _0xb4f6=['exports','INTEGER','STRING','noop','TEXT','sequelize'];(function(_0x3d703a,_0x4f627d){var _0x5a39cd=function(_0x5c57e2){while(--_0x5c57e2){_0x3d703a['push'](_0x3d703a['shift']());}};_0x5a39cd(++_0x4f627d);}(_0xb4f6,0x197));var _0x6b4f=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xb4f6[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0x6b4f('0x0'));module[_0x6b4f('0x1')]={'priority':{'type':Sequelize[_0x6b4f('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x6b4f('0x3')],'allowNull':![],'defaultValue':_0x6b4f('0x4')},'appdata':{'type':Sequelize[_0x6b4f('0x5')]()},'description':{'type':Sequelize[_0x6b4f('0x3')]},'interval':{'type':Sequelize[_0x6b4f('0x3')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0xeca9=['*,*,*,*','sequelize','exports','STRING','noop'];(function(_0x2c19de,_0x3a276e){var _0x361d14=function(_0x15597c){while(--_0x15597c){_0x2c19de['push'](_0x2c19de['shift']());}};_0x361d14(++_0x3a276e);}(_0xeca9,0x79));var _0x9eca=function(_0x382684,_0x51b6fc){_0x382684=_0x382684-0x0;var _0x25d7a8=_0xeca9[_0x382684];return _0x25d7a8;};'use strict';var Sequelize=require(_0x9eca('0x0'));module[_0x9eca('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x9eca('0x2')],'allowNull':![],'defaultValue':_0x9eca('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x9eca('0x2')],'defaultValue':_0x9eca('0x4')}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index f295d45..55cdf09 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 _0xc648=['include','find','create','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','set','apply','reject','save','update','destroy','then','error','name','send','index','map','WhatsappApplication','rawAttributes','model','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','findAll','rows','catch','show','params','keys','fields'];(function(_0xfb42e6,_0x5f5d4b){var _0x27265b=function(_0x163e81){while(--_0x163e81){_0xfb42e6['push'](_0xfb42e6['shift']());}};_0x27265b(++_0x5f5d4b);}(_0xc648,0x171));var _0x8c64=function(_0x512c97,_0x2f105d){_0x512c97=_0x512c97-0x0;var _0x5c80d3=_0xc648[_0x512c97];return _0x5c80d3;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8c64('0x0'));var zipdir=require(_0x8c64('0x1'));var jsonpatch=require(_0x8c64('0x2'));var rp=require(_0x8c64('0x3'));var moment=require(_0x8c64('0x4'));var BPromise=require(_0x8c64('0x5'));var Mustache=require(_0x8c64('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x8c64('0x7'));var ejs=require(_0x8c64('0x8'));var fs=require('fs');var fs_extra=require(_0x8c64('0x9'));var _=require(_0x8c64('0xa'));var squel=require('squel');var crypto=require(_0x8c64('0xb'));var jsforce=require(_0x8c64('0xc'));var deskjs=require(_0x8c64('0xd'));var toCsv=require(_0x8c64('0x7'));var querystring=require(_0x8c64('0xe'));var Papa=require('papaparse');var Redis=require(_0x8c64('0xf'));var authService=require(_0x8c64('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x8c64('0x11'));var hardwareService=require(_0x8c64('0x12'));var logger=require(_0x8c64('0x13'))(_0x8c64('0x14'));var utils=require(_0x8c64('0x15'));var config=require(_0x8c64('0x16'));var licenseUtil=require(_0x8c64('0x17'));var db=require(_0x8c64('0x18'))['db'];function respondWithStatusCode(_0x3834e6,_0x19a173){_0x19a173=_0x19a173||0xcc;return function(_0x54e0f0){if(_0x54e0f0){return _0x3834e6[_0x8c64('0x19')](_0x19a173);}return _0x3834e6[_0x8c64('0x1a')](_0x19a173)[_0x8c64('0x1b')]();};}function respondWithResult(_0x36e227,_0x3a4cbf){_0x3a4cbf=_0x3a4cbf||0xc8;return function(_0xeb374){if(_0xeb374){return _0x36e227[_0x8c64('0x1a')](_0x3a4cbf)['json'](_0xeb374);}};}function respondWithFilteredResult(_0x14df4a,_0x16c84e){return function(_0x4dbf8d){if(_0x4dbf8d){var _0xfacf06=typeof _0x16c84e[_0x8c64('0x1c')]==='undefined'&&typeof _0x16c84e[_0x8c64('0x1d')]===_0x8c64('0x1e');var _0x511608=_0x4dbf8d['count'];var _0x20931c=_0xfacf06?0x0:_0x16c84e[_0x8c64('0x1c')];var _0x4be59b=_0xfacf06?_0x4dbf8d[_0x8c64('0x1f')]:_0x16c84e[_0x8c64('0x1c')]+_0x16c84e['limit'];var _0x4d7350;if(_0x4be59b>=_0x511608){_0x4be59b=_0x511608;_0x4d7350=0xc8;}else{_0x4d7350=0xce;}_0x14df4a['status'](_0x4d7350);return _0x14df4a[_0x8c64('0x20')]('Content-Range',_0x20931c+'-'+_0x4be59b+'/'+_0x511608)['json'](_0x4dbf8d);}return null;};}function patchUpdates(_0x45839d){return function(_0x6d288f){try{jsonpatch[_0x8c64('0x21')](_0x6d288f,_0x45839d,!![]);}catch(_0x2c837c){return BPromise[_0x8c64('0x22')](_0x2c837c);}return _0x6d288f[_0x8c64('0x23')]();};}function saveUpdates(_0x4e7853,_0x28b7dd){return function(_0x51c459){if(_0x51c459){return _0x51c459[_0x8c64('0x24')](_0x4e7853)['then'](function(_0x2624dc){return _0x2624dc;});}return null;};}function removeEntity(_0x3f9a8a,_0x4b2f7b){return function(_0x400bf7){if(_0x400bf7){return _0x400bf7[_0x8c64('0x25')]()[_0x8c64('0x26')](function(){_0x3f9a8a['status'](0xcc)[_0x8c64('0x1b')]();});}};}function handleEntityNotFound(_0x4ddd8f,_0x282f6e){return function(_0xd3001c){if(!_0xd3001c){_0x4ddd8f[_0x8c64('0x19')](0x194);}return _0xd3001c;};}function handleError(_0x153d86,_0x328da5){_0x328da5=_0x328da5||0x1f4;return function(_0x56e847){logger[_0x8c64('0x27')](_0x56e847['stack']);if(_0x56e847['name']){delete _0x56e847[_0x8c64('0x28')];}_0x153d86['status'](_0x328da5)[_0x8c64('0x29')](_0x56e847);};}exports[_0x8c64('0x2a')]=function(_0x1cf017,_0x5570cf){var _0x87f610={},_0x2d7548={},_0x13f0b0={'count':0x0,'rows':[]};var _0x1bb974=_[_0x8c64('0x2b')](db[_0x8c64('0x2c')][_0x8c64('0x2d')],function(_0x1e2706){return{'name':_0x1e2706['fieldName'],'type':_0x1e2706['type']['key']};});_0x2d7548[_0x8c64('0x2e')]=_[_0x8c64('0x2b')](_0x1bb974,_0x8c64('0x28'));_0x2d7548[_0x8c64('0x2f')]=_['keys'](_0x1cf017[_0x8c64('0x2f')]);_0x2d7548[_0x8c64('0x30')]=_['intersection'](_0x2d7548[_0x8c64('0x2e')],_0x2d7548['query']);_0x87f610['attributes']=_[_0x8c64('0x31')](_0x2d7548[_0x8c64('0x2e')],qs['fields'](_0x1cf017['query']['fields']));_0x87f610[_0x8c64('0x32')]=_0x87f610[_0x8c64('0x32')][_0x8c64('0x33')]?_0x87f610[_0x8c64('0x32')]:_0x2d7548[_0x8c64('0x2e')];if(!_0x1cf017[_0x8c64('0x2f')][_0x8c64('0x34')](_0x8c64('0x35'))){_0x87f610[_0x8c64('0x1d')]=qs['limit'](_0x1cf017[_0x8c64('0x2f')][_0x8c64('0x1d')]);_0x87f610[_0x8c64('0x1c')]=qs['offset'](_0x1cf017[_0x8c64('0x2f')][_0x8c64('0x1c')]);}_0x87f610[_0x8c64('0x36')]=qs['sort'](_0x1cf017[_0x8c64('0x2f')][_0x8c64('0x37')]);_0x87f610[_0x8c64('0x38')]=qs[_0x8c64('0x30')](_[_0x8c64('0x39')](_0x1cf017[_0x8c64('0x2f')],_0x2d7548[_0x8c64('0x30')]),_0x1bb974);if(_0x1cf017[_0x8c64('0x2f')][_0x8c64('0x3a')]){_0x87f610[_0x8c64('0x38')]=_[_0x8c64('0x3b')](_0x87f610[_0x8c64('0x38')],{'$or':_[_0x8c64('0x2b')](_0x1bb974,function(_0x3142ee){if(_0x3142ee['type']!=='VIRTUAL'){var _0x444a5b={};_0x444a5b[_0x3142ee[_0x8c64('0x28')]]={'$like':'%'+_0x1cf017[_0x8c64('0x2f')][_0x8c64('0x3a')]+'%'};return _0x444a5b;}})});}_0x87f610=_['merge']({},_0x87f610,_0x1cf017[_0x8c64('0x3c')]);var _0x430d82={'where':_0x87f610[_0x8c64('0x38')]};return db[_0x8c64('0x2c')][_0x8c64('0x1f')](_0x430d82)['then'](function(_0x3b9f51){_0x13f0b0[_0x8c64('0x1f')]=_0x3b9f51;if(_0x1cf017['query'][_0x8c64('0x3d')]){_0x87f610['include']=[{'all':!![]}];}return db['WhatsappApplication'][_0x8c64('0x3e')](_0x87f610);})[_0x8c64('0x26')](function(_0x5f3c6d){_0x13f0b0[_0x8c64('0x3f')]=_0x5f3c6d;return _0x13f0b0;})[_0x8c64('0x26')](respondWithFilteredResult(_0x5570cf,_0x87f610))[_0x8c64('0x40')](handleError(_0x5570cf,null));};exports[_0x8c64('0x41')]=function(_0x15bb03,_0x452644){var _0x433d5b={'raw':!![],'where':{'id':_0x15bb03[_0x8c64('0x42')]['id']}},_0x311803={};_0x311803[_0x8c64('0x2e')]=_[_0x8c64('0x43')](db['WhatsappApplication'][_0x8c64('0x2d')]);_0x311803[_0x8c64('0x2f')]=_[_0x8c64('0x43')](_0x15bb03['query']);_0x311803[_0x8c64('0x30')]=_[_0x8c64('0x31')](_0x311803[_0x8c64('0x2e')],_0x311803['query']);_0x433d5b[_0x8c64('0x32')]=_[_0x8c64('0x31')](_0x311803[_0x8c64('0x2e')],qs[_0x8c64('0x44')](_0x15bb03[_0x8c64('0x2f')][_0x8c64('0x44')]));_0x433d5b['attributes']=_0x433d5b[_0x8c64('0x32')][_0x8c64('0x33')]?_0x433d5b[_0x8c64('0x32')]:_0x311803[_0x8c64('0x2e')];if(_0x15bb03[_0x8c64('0x2f')][_0x8c64('0x3d')]){_0x433d5b[_0x8c64('0x45')]=[{'all':!![]}];}_0x433d5b=_[_0x8c64('0x3b')]({},_0x433d5b,_0x15bb03[_0x8c64('0x3c')]);return db[_0x8c64('0x2c')][_0x8c64('0x46')](_0x433d5b)[_0x8c64('0x26')](handleEntityNotFound(_0x452644,null))[_0x8c64('0x26')](respondWithResult(_0x452644,null))[_0x8c64('0x40')](handleError(_0x452644,null));};exports[_0x8c64('0x47')]=function(_0x4f7f1b,_0x163a29){return db[_0x8c64('0x2c')][_0x8c64('0x47')](_0x4f7f1b[_0x8c64('0x48')],{})[_0x8c64('0x26')](respondWithResult(_0x163a29,0xc9))[_0x8c64('0x40')](handleError(_0x163a29,null));};exports['update']=function(_0x2503a7,_0x19d248){if(_0x2503a7[_0x8c64('0x48')]['id']){delete _0x2503a7[_0x8c64('0x48')]['id'];}return db[_0x8c64('0x2c')][_0x8c64('0x46')]({'where':{'id':_0x2503a7[_0x8c64('0x42')]['id']}})['then'](handleEntityNotFound(_0x19d248,null))[_0x8c64('0x26')](saveUpdates(_0x2503a7[_0x8c64('0x48')],null))['then'](respondWithResult(_0x19d248,null))['catch'](handleError(_0x19d248,null));};exports[_0x8c64('0x25')]=function(_0x2987cb,_0x219494){return db[_0x8c64('0x2c')][_0x8c64('0x46')]({'where':{'id':_0x2987cb[_0x8c64('0x42')]['id']}})[_0x8c64('0x26')](handleEntityNotFound(_0x219494,null))['then'](removeEntity(_0x219494,null))[_0x8c64('0x40')](handleError(_0x219494,null));}; \ No newline at end of file +var _0xb8cb=['lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','reject','save','then','destroy','error','name','index','map','WhatsappApplication','rawAttributes','fieldName','type','key','query','keys','filters','model','attributes','intersection','fields','length','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','find','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','ejs','fs-extra'];(function(_0x1dd3a9,_0xa4d964){var _0x49bfa5=function(_0x2ca222){while(--_0x2ca222){_0x1dd3a9['push'](_0x1dd3a9['shift']());}};_0x49bfa5(++_0xa4d964);}(_0xb8cb,0xd9));var _0xbb8c=function(_0x505db3,_0x31b596){_0x505db3=_0x505db3-0x0;var _0x10abb1=_0xb8cb[_0x505db3];return _0x10abb1;};'use strict';var emlformat=require(_0xbb8c('0x0'));var rimraf=require(_0xbb8c('0x1'));var zipdir=require(_0xbb8c('0x2'));var jsonpatch=require(_0xbb8c('0x3'));var rp=require(_0xbb8c('0x4'));var moment=require(_0xbb8c('0x5'));var BPromise=require(_0xbb8c('0x6'));var Mustache=require('mustache');var util=require(_0xbb8c('0x7'));var path=require(_0xbb8c('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xbb8c('0x9'));var fs=require('fs');var fs_extra=require(_0xbb8c('0xa'));var _=require(_0xbb8c('0xb'));var squel=require('squel');var crypto=require(_0xbb8c('0xc'));var jsforce=require(_0xbb8c('0xd'));var deskjs=require(_0xbb8c('0xe'));var toCsv=require(_0xbb8c('0xf'));var querystring=require(_0xbb8c('0x10'));var Papa=require(_0xbb8c('0x11'));var Redis=require(_0xbb8c('0x12'));var authService=require(_0xbb8c('0x13'));var qs=require(_0xbb8c('0x14'));var as=require(_0xbb8c('0x15'));var hardwareService=require(_0xbb8c('0x16'));var logger=require(_0xbb8c('0x17'))('api');var utils=require(_0xbb8c('0x18'));var config=require(_0xbb8c('0x19'));var licenseUtil=require(_0xbb8c('0x1a'));var db=require(_0xbb8c('0x1b'))['db'];function respondWithStatusCode(_0x3ac367,_0x57e624){_0x57e624=_0x57e624||0xcc;return function(_0x275252){if(_0x275252){return _0x3ac367[_0xbb8c('0x1c')](_0x57e624);}return _0x3ac367[_0xbb8c('0x1d')](_0x57e624)[_0xbb8c('0x1e')]();};}function respondWithResult(_0x3a0fe2,_0x151bf2){_0x151bf2=_0x151bf2||0xc8;return function(_0x1de932){if(_0x1de932){return _0x3a0fe2['status'](_0x151bf2)[_0xbb8c('0x1f')](_0x1de932);}};}function respondWithFilteredResult(_0x1e6dc9,_0x425891){return function(_0x403710){if(_0x403710){var _0x2cc079=typeof _0x425891[_0xbb8c('0x20')]===_0xbb8c('0x21')&&typeof _0x425891[_0xbb8c('0x22')]===_0xbb8c('0x21');var _0x187ee5=_0x403710['count'];var _0x67712e=_0x2cc079?0x0:_0x425891[_0xbb8c('0x20')];var _0x2a02c9=_0x2cc079?_0x403710[_0xbb8c('0x23')]:_0x425891[_0xbb8c('0x20')]+_0x425891[_0xbb8c('0x22')];var _0x520ea9;if(_0x2a02c9>=_0x187ee5){_0x2a02c9=_0x187ee5;_0x520ea9=0xc8;}else{_0x520ea9=0xce;}_0x1e6dc9[_0xbb8c('0x1d')](_0x520ea9);return _0x1e6dc9[_0xbb8c('0x24')]('Content-Range',_0x67712e+'-'+_0x2a02c9+'/'+_0x187ee5)[_0xbb8c('0x1f')](_0x403710);}return null;};}function patchUpdates(_0x5e2803){return function(_0x44a56e){try{jsonpatch['apply'](_0x44a56e,_0x5e2803,!![]);}catch(_0x32b961){return BPromise[_0xbb8c('0x25')](_0x32b961);}return _0x44a56e[_0xbb8c('0x26')]();};}function saveUpdates(_0x546215,_0x4b4100){return function(_0x10f265){if(_0x10f265){return _0x10f265['update'](_0x546215)[_0xbb8c('0x27')](function(_0x1b764d){return _0x1b764d;});}return null;};}function removeEntity(_0x36163c,_0xec7fb5){return function(_0x362a2f){if(_0x362a2f){return _0x362a2f[_0xbb8c('0x28')]()[_0xbb8c('0x27')](function(){_0x36163c['status'](0xcc)[_0xbb8c('0x1e')]();});}};}function handleEntityNotFound(_0x5f4f96,_0x4a5684){return function(_0xe7475d){if(!_0xe7475d){_0x5f4f96['sendStatus'](0x194);}return _0xe7475d;};}function handleError(_0x47fb37,_0x26ea5f){_0x26ea5f=_0x26ea5f||0x1f4;return function(_0x283ec3){logger[_0xbb8c('0x29')](_0x283ec3['stack']);if(_0x283ec3['name']){delete _0x283ec3[_0xbb8c('0x2a')];}_0x47fb37[_0xbb8c('0x1d')](_0x26ea5f)['send'](_0x283ec3);};}exports[_0xbb8c('0x2b')]=function(_0x23bf3d,_0x292f11){var _0x4f0f13={},_0x271ad7={},_0x1e0e3={'count':0x0,'rows':[]};var _0x219976=_[_0xbb8c('0x2c')](db[_0xbb8c('0x2d')][_0xbb8c('0x2e')],function(_0x2f3db6){return{'name':_0x2f3db6[_0xbb8c('0x2f')],'type':_0x2f3db6[_0xbb8c('0x30')][_0xbb8c('0x31')]};});_0x271ad7['model']=_['map'](_0x219976,_0xbb8c('0x2a'));_0x271ad7[_0xbb8c('0x32')]=_[_0xbb8c('0x33')](_0x23bf3d[_0xbb8c('0x32')]);_0x271ad7[_0xbb8c('0x34')]=_['intersection'](_0x271ad7[_0xbb8c('0x35')],_0x271ad7[_0xbb8c('0x32')]);_0x4f0f13[_0xbb8c('0x36')]=_[_0xbb8c('0x37')](_0x271ad7[_0xbb8c('0x35')],qs[_0xbb8c('0x38')](_0x23bf3d[_0xbb8c('0x32')][_0xbb8c('0x38')]));_0x4f0f13[_0xbb8c('0x36')]=_0x4f0f13['attributes'][_0xbb8c('0x39')]?_0x4f0f13[_0xbb8c('0x36')]:_0x271ad7[_0xbb8c('0x35')];if(!_0x23bf3d['query']['hasOwnProperty'](_0xbb8c('0x3a'))){_0x4f0f13[_0xbb8c('0x22')]=qs[_0xbb8c('0x22')](_0x23bf3d[_0xbb8c('0x32')]['limit']);_0x4f0f13[_0xbb8c('0x20')]=qs[_0xbb8c('0x20')](_0x23bf3d[_0xbb8c('0x32')][_0xbb8c('0x20')]);}_0x4f0f13[_0xbb8c('0x3b')]=qs['sort'](_0x23bf3d[_0xbb8c('0x32')][_0xbb8c('0x3c')]);_0x4f0f13[_0xbb8c('0x3d')]=qs[_0xbb8c('0x34')](_['pick'](_0x23bf3d[_0xbb8c('0x32')],_0x271ad7[_0xbb8c('0x34')]),_0x219976);if(_0x23bf3d[_0xbb8c('0x32')][_0xbb8c('0x3e')]){_0x4f0f13[_0xbb8c('0x3d')]=_[_0xbb8c('0x3f')](_0x4f0f13[_0xbb8c('0x3d')],{'$or':_[_0xbb8c('0x2c')](_0x219976,function(_0x423bba){if(_0x423bba[_0xbb8c('0x30')]!==_0xbb8c('0x40')){var _0x1f4d03={};_0x1f4d03[_0x423bba['name']]={'$like':'%'+_0x23bf3d[_0xbb8c('0x32')][_0xbb8c('0x3e')]+'%'};return _0x1f4d03;}})});}_0x4f0f13=_[_0xbb8c('0x3f')]({},_0x4f0f13,_0x23bf3d[_0xbb8c('0x41')]);var _0x55a698={'where':_0x4f0f13[_0xbb8c('0x3d')]};return db['WhatsappApplication']['count'](_0x55a698)[_0xbb8c('0x27')](function(_0x1c5197){_0x1e0e3[_0xbb8c('0x23')]=_0x1c5197;if(_0x23bf3d['query'][_0xbb8c('0x42')]){_0x4f0f13[_0xbb8c('0x43')]=[{'all':!![]}];}return db['WhatsappApplication'][_0xbb8c('0x44')](_0x4f0f13);})[_0xbb8c('0x27')](function(_0x3b8311){_0x1e0e3[_0xbb8c('0x45')]=_0x3b8311;return _0x1e0e3;})['then'](respondWithFilteredResult(_0x292f11,_0x4f0f13))[_0xbb8c('0x46')](handleError(_0x292f11,null));};exports[_0xbb8c('0x47')]=function(_0x17ffa5,_0x5b662e){var _0xa601d5={'raw':!![],'where':{'id':_0x17ffa5['params']['id']}},_0xff11d5={};_0xff11d5['model']=_[_0xbb8c('0x33')](db[_0xbb8c('0x2d')]['rawAttributes']);_0xff11d5['query']=_[_0xbb8c('0x33')](_0x17ffa5['query']);_0xff11d5[_0xbb8c('0x34')]=_['intersection'](_0xff11d5[_0xbb8c('0x35')],_0xff11d5['query']);_0xa601d5[_0xbb8c('0x36')]=_[_0xbb8c('0x37')](_0xff11d5[_0xbb8c('0x35')],qs[_0xbb8c('0x38')](_0x17ffa5[_0xbb8c('0x32')][_0xbb8c('0x38')]));_0xa601d5['attributes']=_0xa601d5[_0xbb8c('0x36')]['length']?_0xa601d5[_0xbb8c('0x36')]:_0xff11d5[_0xbb8c('0x35')];if(_0x17ffa5[_0xbb8c('0x32')][_0xbb8c('0x42')]){_0xa601d5[_0xbb8c('0x43')]=[{'all':!![]}];}_0xa601d5=_[_0xbb8c('0x3f')]({},_0xa601d5,_0x17ffa5['options']);return db['WhatsappApplication'][_0xbb8c('0x48')](_0xa601d5)[_0xbb8c('0x27')](handleEntityNotFound(_0x5b662e,null))['then'](respondWithResult(_0x5b662e,null))[_0xbb8c('0x46')](handleError(_0x5b662e,null));};exports[_0xbb8c('0x49')]=function(_0x3f0a8b,_0x599e51){return db[_0xbb8c('0x2d')]['create'](_0x3f0a8b[_0xbb8c('0x4a')],{})[_0xbb8c('0x27')](respondWithResult(_0x599e51,0xc9))[_0xbb8c('0x46')](handleError(_0x599e51,null));};exports['update']=function(_0x1953f7,_0x295bb0){if(_0x1953f7[_0xbb8c('0x4a')]['id']){delete _0x1953f7[_0xbb8c('0x4a')]['id'];}return db[_0xbb8c('0x2d')][_0xbb8c('0x48')]({'where':{'id':_0x1953f7[_0xbb8c('0x4b')]['id']}})[_0xbb8c('0x27')](handleEntityNotFound(_0x295bb0,null))[_0xbb8c('0x27')](saveUpdates(_0x1953f7[_0xbb8c('0x4a')],null))['then'](respondWithResult(_0x295bb0,null))[_0xbb8c('0x46')](handleError(_0x295bb0,null));};exports[_0xbb8c('0x28')]=function(_0x4400c7,_0x5c3373){return db[_0xbb8c('0x2d')][_0xbb8c('0x48')]({'where':{'id':_0x4400c7[_0xbb8c('0x4b')]['id']}})[_0xbb8c('0x27')](handleEntityNotFound(_0x5c3373,null))[_0xbb8c('0x27')](removeEntity(_0x5c3373,null))[_0xbb8c('0x46')](handleError(_0x5c3373,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index 6ffdff4..bf229fd 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 _0xb7cf=['path','rimraf','../../config/environment','./whatsappApplication.attributes','exports','define','WhatsappApplication','whatsapp_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x1d211b,_0x475f3b){var _0x47c88b=function(_0x3126f5){while(--_0x3126f5){_0x1d211b['push'](_0x1d211b['shift']());}};_0x47c88b(++_0x475f3b);}(_0xb7cf,0xca));var _0xfb7c=function(_0x3b59d5,_0x1e23f2){_0x3b59d5=_0x3b59d5-0x0;var _0x30cc91=_0xb7cf[_0x3b59d5];return _0x30cc91;};'use strict';var _=require(_0xfb7c('0x0'));var util=require(_0xfb7c('0x1'));var logger=require(_0xfb7c('0x2'))(_0xfb7c('0x3'));var moment=require(_0xfb7c('0x4'));var BPromise=require('bluebird');var rp=require(_0xfb7c('0x5'));var fs=require('fs');var path=require(_0xfb7c('0x6'));var rimraf=require(_0xfb7c('0x7'));var config=require(_0xfb7c('0x8'));var attributes=require(_0xfb7c('0x9'));module[_0xfb7c('0xa')]=function(_0x2e245c,_0x135394){return _0x2e245c[_0xfb7c('0xb')](_0xfb7c('0xc'),attributes,{'tableName':_0xfb7c('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xfb7c('0xe'),'collate':_0xfb7c('0xf')});}; \ No newline at end of file +var _0xd4b6=['lodash','util','api','moment','request-promise','./whatsappApplication.attributes','exports','define','WhatsappApplication','whatsapp_applications','utf8mb4'];(function(_0x11c294,_0x562d9d){var _0x5e7302=function(_0x360920){while(--_0x360920){_0x11c294['push'](_0x11c294['shift']());}};_0x5e7302(++_0x562d9d);}(_0xd4b6,0x13f));var _0x6d4b=function(_0x5f3806,_0x248ff1){_0x5f3806=_0x5f3806-0x0;var _0x5de6d6=_0xd4b6[_0x5f3806];return _0x5de6d6;};'use strict';var _=require(_0x6d4b('0x0'));var util=require(_0x6d4b('0x1'));var logger=require('../../config/logger')(_0x6d4b('0x2'));var moment=require(_0x6d4b('0x3'));var BPromise=require('bluebird');var rp=require(_0x6d4b('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x6d4b('0x5'));module[_0x6d4b('0x6')]=function(_0x442164,_0x5daf08){return _0x442164[_0x6d4b('0x7')](_0x6d4b('0x8'),attributes,{'tableName':_0x6d4b('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x6d4b('0xa'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.rpc.js b/server/api/whatsappApplication/whatsappApplication.rpc.js index e9f61a3..0ee50c5 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 _0x9bde=['code','message','WhatsappApplication,\x20%s,\x20%s','result','catch','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','request\x20sent','error'];(function(_0x5658af,_0x5e6939){var _0x6ef8ad=function(_0x596028){while(--_0x596028){_0x5658af['push'](_0x5658af['shift']());}};_0x6ef8ad(++_0x5e6939);}(_0x9bde,0xe1));var _0xe9bd=function(_0x56b624,_0x47f71d){_0x56b624=_0x56b624-0x0;var _0x17bc9c=_0x9bde[_0x56b624];return _0x17bc9c;};'use strict';var _=require('lodash');var util=require(_0xe9bd('0x0'));var moment=require('moment');var BPromise=require(_0xe9bd('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe9bd('0x2'));var db=require(_0xe9bd('0x3'))['db'];var utils=require(_0xe9bd('0x4'));var logger=require(_0xe9bd('0x5'))(_0xe9bd('0x6'));var config=require(_0xe9bd('0x7'));var jayson=require(_0xe9bd('0x8'));var client=jayson['client'][_0xe9bd('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5f18fe,_0x22a438,_0xa66ae2){return new BPromise(function(_0x2d5c75,_0x3ef9e3){return client[_0xe9bd('0xa')](_0x5f18fe,_0xa66ae2)[_0xe9bd('0xb')](function(_0x439abc){logger[_0xe9bd('0xc')]('WhatsappApplication,\x20%s,\x20%s',_0x22a438,'request\x20sent');logger[_0xe9bd('0xd')](_0xe9bd('0xe'),_0x22a438,_0xe9bd('0xf'),JSON['stringify'](_0x439abc));if(_0x439abc[_0xe9bd('0x10')]){if(_0x439abc[_0xe9bd('0x10')][_0xe9bd('0x11')]===0x1f4){logger[_0xe9bd('0x10')]('WhatsappApplication,\x20%s,\x20%s',_0x22a438,_0x439abc[_0xe9bd('0x10')]['message']);return _0x3ef9e3(_0x439abc[_0xe9bd('0x10')][_0xe9bd('0x12')]);}logger[_0xe9bd('0x10')]('WhatsappApplication,\x20%s,\x20%s',_0x22a438,_0x439abc['error'][_0xe9bd('0x12')]);return _0x2d5c75(_0x439abc[_0xe9bd('0x10')][_0xe9bd('0x12')]);}else{logger[_0xe9bd('0xc')](_0xe9bd('0x13'),_0x22a438,_0xe9bd('0xf'));_0x2d5c75(_0x439abc[_0xe9bd('0x14')]['message']);}})[_0xe9bd('0x15')](function(_0x464a1b){logger[_0xe9bd('0x10')]('WhatsappApplication,\x20%s,\x20%s',_0x22a438,_0x464a1b);_0x3ef9e3(_0x464a1b);});});} \ No newline at end of file +var _0xeec6=['then','info','WhatsappApplication,\x20%s,\x20%s,\x20%s','request\x20sent','error','WhatsappApplication,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http'];(function(_0x77d310,_0x2b2fe7){var _0x2cdce4=function(_0xbaa481){while(--_0xbaa481){_0x77d310['push'](_0x77d310['shift']());}};_0x2cdce4(++_0x2b2fe7);}(_0xeec6,0x1c2));var _0x6eec=function(_0x5f3905,_0x43a651){_0x5f3905=_0x5f3905-0x0;var _0x2923b1=_0xeec6[_0x5f3905];return _0x2923b1;};'use strict';var _=require(_0x6eec('0x0'));var util=require(_0x6eec('0x1'));var moment=require(_0x6eec('0x2'));var BPromise=require(_0x6eec('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6eec('0x4'));var db=require(_0x6eec('0x5'))['db'];var utils=require(_0x6eec('0x6'));var logger=require(_0x6eec('0x7'))(_0x6eec('0x8'));var config=require(_0x6eec('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x6eec('0xa')][_0x6eec('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x48064a,_0x5a5e47,_0x1c810e){return new BPromise(function(_0x3443c2,_0x834c2){return client['request'](_0x48064a,_0x1c810e)[_0x6eec('0xc')](function(_0x3aca38){logger[_0x6eec('0xd')]('WhatsappApplication,\x20%s,\x20%s',_0x5a5e47,'request\x20sent');logger['debug'](_0x6eec('0xe'),_0x5a5e47,_0x6eec('0xf'),JSON['stringify'](_0x3aca38));if(_0x3aca38['error']){if(_0x3aca38[_0x6eec('0x10')]['code']===0x1f4){logger[_0x6eec('0x10')](_0x6eec('0x11'),_0x5a5e47,_0x3aca38[_0x6eec('0x10')][_0x6eec('0x12')]);return _0x834c2(_0x3aca38[_0x6eec('0x10')]['message']);}logger[_0x6eec('0x10')](_0x6eec('0x11'),_0x5a5e47,_0x3aca38[_0x6eec('0x10')][_0x6eec('0x12')]);return _0x3443c2(_0x3aca38[_0x6eec('0x10')][_0x6eec('0x12')]);}else{logger[_0x6eec('0xd')](_0x6eec('0x11'),_0x5a5e47,_0x6eec('0xf'));_0x3443c2(_0x3aca38[_0x6eec('0x13')]['message']);}})[_0x6eec('0x14')](function(_0x5f1f33){logger[_0x6eec('0x10')](_0x6eec('0x11'),_0x5a5e47,_0x5f1f33);_0x834c2(_0x5f1f33);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index d547d27..dd1d3b7 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 _0x3baf=['put','/:id','tracked','whatsappinteraction:update','delete','whatsappinteraction:destroy','destroy','removeTags','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappInteraction.controller','get','isAuthenticated','index','show','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','whatsapp','whatsappinteraction:addtags','addTags'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x3baf,0xf7));var _0xf3ba=function(_0x11a2dd,_0x5bf4bc){_0x11a2dd=_0x11a2dd-0x0;var _0x4bc0e2=_0x3baf[_0x11a2dd];return _0x4bc0e2;};'use strict';var multer=require(_0xf3ba('0x0'));var util=require(_0xf3ba('0x1'));var path=require(_0xf3ba('0x2'));var timeout=require(_0xf3ba('0x3'));var express=require(_0xf3ba('0x4'));var router=express[_0xf3ba('0x5')]();var fs_extra=require(_0xf3ba('0x6'));var auth=require(_0xf3ba('0x7'));var interaction=require(_0xf3ba('0x8'));var config=require(_0xf3ba('0x9'));var controller=require(_0xf3ba('0xa'));router[_0xf3ba('0xb')]('/',auth[_0xf3ba('0xc')](),controller[_0xf3ba('0xd')]);router[_0xf3ba('0xb')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0xf3ba('0xb')]('/:id',auth[_0xf3ba('0xc')](),controller[_0xf3ba('0xe')]);router[_0xf3ba('0xb')](_0xf3ba('0xf'),auth[_0xf3ba('0xc')](),controller[_0xf3ba('0x10')]);router[_0xf3ba('0xb')](_0xf3ba('0x11'),auth[_0xf3ba('0xc')](),controller[_0xf3ba('0x12')]);router[_0xf3ba('0x13')]('/',auth[_0xf3ba('0xc')](),controller[_0xf3ba('0x14')]);router[_0xf3ba('0x13')](_0xf3ba('0xf'),auth[_0xf3ba('0xc')](),controller[_0xf3ba('0x15')]);router[_0xf3ba('0x13')]('/:id/tags',auth[_0xf3ba('0xc')](),interaction['tracked'](_0xf3ba('0x16'),_0xf3ba('0x17')),controller[_0xf3ba('0x18')]);router[_0xf3ba('0x19')](_0xf3ba('0x1a'),auth['isAuthenticated'](),interaction[_0xf3ba('0x1b')](_0xf3ba('0x16'),_0xf3ba('0x1c')),controller['update']);router[_0xf3ba('0x1d')](_0xf3ba('0x1a'),auth[_0xf3ba('0xc')](),interaction[_0xf3ba('0x1b')]('whatsapp',_0xf3ba('0x1e')),controller[_0xf3ba('0x1f')]);router['delete']('/:id/tags',auth[_0xf3ba('0xc')](),controller[_0xf3ba('0x20')]);module[_0xf3ba('0x21')]=router; \ No newline at end of file +var _0xe132=['index','get','/describe','describe','/:id','show','/:id/messages','getMessages','/:id/download','download','create','post','addMessage','tracked','whatsapp','addTags','put','whatsappinteraction:update','whatsappinteraction:destroy','destroy','delete','/:id/tags','removeTags','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','isAuthenticated'];(function(_0x3431df,_0x308f9f){var _0x1b2d6f=function(_0x202975){while(--_0x202975){_0x3431df['push'](_0x3431df['shift']());}};_0x1b2d6f(++_0x308f9f);}(_0xe132,0x162));var _0x2e13=function(_0x4f2f1a,_0x467eba){_0x4f2f1a=_0x4f2f1a-0x0;var _0x2244ec=_0xe132[_0x4f2f1a];return _0x2244ec;};'use strict';var multer=require(_0x2e13('0x0'));var util=require('util');var path=require(_0x2e13('0x1'));var timeout=require(_0x2e13('0x2'));var express=require(_0x2e13('0x3'));var router=express[_0x2e13('0x4')]();var fs_extra=require(_0x2e13('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x2e13('0x6'));var config=require(_0x2e13('0x7'));var controller=require('./whatsappInteraction.controller');router['get']('/',auth[_0x2e13('0x8')](),controller[_0x2e13('0x9')]);router[_0x2e13('0xa')](_0x2e13('0xb'),auth[_0x2e13('0x8')](),controller[_0x2e13('0xc')]);router[_0x2e13('0xa')](_0x2e13('0xd'),auth[_0x2e13('0x8')](),controller[_0x2e13('0xe')]);router['get'](_0x2e13('0xf'),auth[_0x2e13('0x8')](),controller[_0x2e13('0x10')]);router[_0x2e13('0xa')](_0x2e13('0x11'),auth[_0x2e13('0x8')](),controller[_0x2e13('0x12')]);router['post']('/',auth[_0x2e13('0x8')](),controller[_0x2e13('0x13')]);router[_0x2e13('0x14')](_0x2e13('0xf'),auth[_0x2e13('0x8')](),controller[_0x2e13('0x15')]);router[_0x2e13('0x14')]('/:id/tags',auth[_0x2e13('0x8')](),interaction[_0x2e13('0x16')](_0x2e13('0x17'),'whatsappinteraction:addtags'),controller[_0x2e13('0x18')]);router[_0x2e13('0x19')](_0x2e13('0xd'),auth['isAuthenticated'](),interaction[_0x2e13('0x16')](_0x2e13('0x17'),_0x2e13('0x1a')),controller['update']);router['delete'](_0x2e13('0xd'),auth[_0x2e13('0x8')](),interaction[_0x2e13('0x16')](_0x2e13('0x17'),_0x2e13('0x1b')),controller[_0x2e13('0x1c')]);router[_0x2e13('0x1d')](_0x2e13('0x1e'),auth['isAuthenticated'](),controller[_0x2e13('0x1f')]);module[_0x2e13('0x20')]=router; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.attributes.js b/server/api/whatsappInteraction/whatsappInteraction.attributes.js index 25eecb9..4f57cce 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 _0xf7d9=['out','INTEGER','sequelize','moment','exports','BOOLEAN','STRING','DATE','ENUM'];(function(_0x5ea887,_0x5bb376){var _0x45c71b=function(_0x2353a3){while(--_0x2353a3){_0x5ea887['push'](_0x5ea887['shift']());}};_0x45c71b(++_0x5bb376);}(_0xf7d9,0x122));var _0x9f7d=function(_0x28010c,_0x358367){_0x28010c=_0x28010c-0x0;var _0x5b0de6=_0xf7d9[_0x28010c];return _0x5b0de6;};'use strict';var Sequelize=require(_0x9f7d('0x0'));var moment=require(_0x9f7d('0x1'));module[_0x9f7d('0x2')]={'closed':{'type':Sequelize[_0x9f7d('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x9f7d('0x4')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x9f7d('0x4')]},'phone':{'type':Sequelize[_0x9f7d('0x4')]},'read1stAt':{'type':Sequelize[_0x9f7d('0x5')]},'firstMsgDirection':{'type':Sequelize[_0x9f7d('0x6')]('in',_0x9f7d('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x9f7d('0x7')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x9f7d('0x3')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x9f7d('0x8')]}}; \ No newline at end of file +var _0x61d0=['exports','BOOLEAN','STRING','DATE','ENUM','out','sequelize'];(function(_0x363803,_0x1cd8e9){var _0x1a08c6=function(_0x2790f3){while(--_0x2790f3){_0x363803['push'](_0x363803['shift']());}};_0x1a08c6(++_0x1cd8e9);}(_0x61d0,0x187));var _0x061d=function(_0x26bf51,_0x5e261a){_0x26bf51=_0x26bf51-0x0;var _0x503415=_0x61d0[_0x26bf51];return _0x503415;};'use strict';var Sequelize=require(_0x061d('0x0'));var moment=require('moment');module[_0x061d('0x1')]={'closed':{'type':Sequelize[_0x061d('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x061d('0x3')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x061d('0x3')]},'note':{'type':Sequelize[_0x061d('0x3')]},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x061d('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x061d('0x5')]('in',_0x061d('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x061d('0x4')]},'lastMsgDirection':{'type':Sequelize[_0x061d('0x5')]('in',_0x061d('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x061d('0x2')],'defaultValue':![]},'queueId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.controller.js b/server/api/whatsappInteraction/whatsappInteraction.controller.js index 76a2f37..c6c794c 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 _0xb793=['length','includeAll','include','merge','options','find','create','body','describe','addMessage','ids','omit','getMessages','findOne','WhatsappMessage','hasOwnProperty','nolimit','order','sort','where','pick','WhatsappInteractionId','filter','$gte','split','YYYY-MM-DD\x20HH:mm:ss','rows','addTags','setTags','spread','Tag','color','emit','removeTags','unix','toString','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','User','push','Contact','firstName','lastName','Attachment','createdAt','direction','read','Owner','fullname','get','mkdirSync','Whatsapp','Account','N.A.','format','closed','disposition','Messages','basename','pipe','createWriteStream','System','out','secret','value','renderFile','views','downloadInteraction.ejs','transcript-','createPdfFromHTML','unlinkSync','rimraf','zip-dir','moment','bluebird','util','path','ejs','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../config/environment','socket.io-emitter','redis','./whatsappInteraction.socket','register','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','update','destroy','end','error','name','send','index','map','WhatsappInteraction','rawAttributes','fieldName','key','getOptions','findAll','whatsapp','query','then','catch','show','params','keys','filters','intersection','model','fields','attributes'];(function(_0x4bfade,_0xb26c0e){var _0x272465=function(_0x3b38cb){while(--_0x3b38cb){_0x4bfade['push'](_0x4bfade['shift']());}};_0x272465(++_0xb26c0e);}(_0xb793,0x1d2));var _0x3b79=function(_0x1195f8,_0x22dadc){_0x1195f8=_0x1195f8-0x0;var _0x36629b=_0xb793[_0x1195f8];return _0x36629b;};'use strict';var rimraf=require(_0x3b79('0x0'));var zipdir=require(_0x3b79('0x1'));var moment=require(_0x3b79('0x2'));var BPromise=require(_0x3b79('0x3'));var util=require(_0x3b79('0x4'));var path=require(_0x3b79('0x5'));var ejs=require(_0x3b79('0x6'));var fs=require('fs');var _=require(_0x3b79('0x7'));var Redis=require(_0x3b79('0x8'));var interaction=require(_0x3b79('0x9'));var qs=require(_0x3b79('0xa'));var pdf=require(_0x3b79('0xb'));var logger=require(_0x3b79('0xc'))(_0x3b79('0xd'));var config=require(_0x3b79('0xe'));var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x3b79('0xf'))(new Redis(config[_0x3b79('0x10')]));require(_0x3b79('0x11'))[_0x3b79('0x12')](socket);function respondWithStatusCode(_0x42a0a1,_0x26c599){_0x26c599=_0x26c599||0xcc;return function(_0x36b24f){if(_0x36b24f){return _0x42a0a1[_0x3b79('0x13')](_0x26c599);}return _0x42a0a1[_0x3b79('0x14')](_0x26c599)['end']();};}function respondWithResult(_0x872811,_0x365fbc){_0x365fbc=_0x365fbc||0xc8;return function(_0x738474){if(_0x738474){return _0x872811['status'](_0x365fbc)[_0x3b79('0x15')](_0x738474);}};}function respondWithFilteredResult(_0x1b4654,_0x48ae2e){return function(_0x21985e){if(_0x21985e){var _0x354a3d=typeof _0x48ae2e[_0x3b79('0x16')]===_0x3b79('0x17')&&typeof _0x48ae2e['limit']===_0x3b79('0x17');var _0x394ef3=_0x21985e[_0x3b79('0x18')];var _0x40576c=_0x354a3d?0x0:_0x48ae2e['offset'];var _0x38c269=_0x354a3d?_0x21985e[_0x3b79('0x18')]:_0x48ae2e[_0x3b79('0x16')]+_0x48ae2e[_0x3b79('0x19')];var _0x55bac5;if(_0x38c269>=_0x394ef3){_0x38c269=_0x394ef3;_0x55bac5=0xc8;}else{_0x55bac5=0xce;}_0x1b4654['status'](_0x55bac5);return _0x1b4654[_0x3b79('0x1a')](_0x3b79('0x1b'),_0x40576c+'-'+_0x38c269+'/'+_0x394ef3)[_0x3b79('0x15')](_0x21985e);}return null;};}function saveUpdates(_0x6d029c){return function(_0x10ab7d){if(_0x10ab7d){return _0x10ab7d[_0x3b79('0x1c')](_0x6d029c)['then'](function(_0x219bd3){return _0x219bd3;});}return null;};}function removeEntity(_0x2344a0){return function(_0x4ee633){if(_0x4ee633){return _0x4ee633[_0x3b79('0x1d')]()['then'](function(){_0x2344a0['status'](0xcc)[_0x3b79('0x1e')]();});}};}function handleEntityNotFound(_0x12c669){return function(_0x1b38d4){if(!_0x1b38d4){_0x12c669[_0x3b79('0x13')](0x194);}return _0x1b38d4;};}function handleError(_0x4f18e7,_0x5a6cb1){_0x5a6cb1=_0x5a6cb1||0x1f4;return function(_0x3b4fed){logger[_0x3b79('0x1f')](_0x3b4fed['stack']);if(_0x3b4fed[_0x3b79('0x20')]){delete _0x3b4fed[_0x3b79('0x20')];}_0x4f18e7[_0x3b79('0x14')](_0x5a6cb1)[_0x3b79('0x21')](_0x3b4fed);};}exports[_0x3b79('0x22')]=function(_0x4cd5ac,_0x4754ca){var _0x310ae8={};var _0x4b2b0e=_[_0x3b79('0x23')](db[_0x3b79('0x24')][_0x3b79('0x25')],function(_0x1a247e){return{'name':_0x1a247e[_0x3b79('0x26')],'type':_0x1a247e['type'][_0x3b79('0x27')]};});_0x310ae8=qs[_0x3b79('0x28')](_0x4b2b0e,_0x4cd5ac);return interaction[_0x3b79('0x29')](_0x3b79('0x2a'),_0x4cd5ac[_0x3b79('0x2b')],_0x4cd5ac['user'],_0x310ae8,_0x4b2b0e)[_0x3b79('0x2c')](respondWithFilteredResult(_0x4754ca,_0x310ae8))[_0x3b79('0x2d')](handleError(_0x4754ca,null));};exports[_0x3b79('0x2e')]=function(_0x29a933,_0x33e519){var _0x539b8c={'raw':![],'where':{'id':_0x29a933[_0x3b79('0x2f')]['id']}},_0x4e4ac9={};_0x4e4ac9['model']=_[_0x3b79('0x30')](db['WhatsappInteraction'][_0x3b79('0x25')]);_0x4e4ac9[_0x3b79('0x2b')]=_[_0x3b79('0x30')](_0x29a933[_0x3b79('0x2b')]);_0x4e4ac9[_0x3b79('0x31')]=_[_0x3b79('0x32')](_0x4e4ac9[_0x3b79('0x33')],_0x4e4ac9['query']);_0x539b8c['attributes']=_[_0x3b79('0x32')](_0x4e4ac9['model'],qs[_0x3b79('0x34')](_0x29a933[_0x3b79('0x2b')][_0x3b79('0x34')]));_0x539b8c['attributes']=_0x539b8c[_0x3b79('0x35')][_0x3b79('0x36')]?_0x539b8c[_0x3b79('0x35')]:_0x4e4ac9[_0x3b79('0x33')];if(_0x29a933[_0x3b79('0x2b')][_0x3b79('0x37')]){_0x539b8c[_0x3b79('0x38')]=[{'all':!![]}];}_0x539b8c=_[_0x3b79('0x39')]({},_0x539b8c,_0x29a933[_0x3b79('0x3a')]);return db[_0x3b79('0x24')][_0x3b79('0x3b')](_0x539b8c)['then'](handleEntityNotFound(_0x33e519,null))[_0x3b79('0x2c')](respondWithResult(_0x33e519,null))['catch'](handleError(_0x33e519,null));};exports['create']=function(_0x30f3b2,_0x448cec){return db[_0x3b79('0x24')][_0x3b79('0x3c')](_0x30f3b2[_0x3b79('0x3d')],{})[_0x3b79('0x2c')](respondWithResult(_0x448cec,0xc9))[_0x3b79('0x2d')](handleError(_0x448cec,null));};exports[_0x3b79('0x1c')]=function(_0x251b5f,_0x15acb6){if(_0x251b5f['body']['id']){delete _0x251b5f[_0x3b79('0x3d')]['id'];}return db[_0x3b79('0x24')][_0x3b79('0x3b')]({'where':{'id':_0x251b5f[_0x3b79('0x2f')]['id']}})['then'](handleEntityNotFound(_0x15acb6,null))[_0x3b79('0x2c')](saveUpdates(_0x251b5f['body'],null))[_0x3b79('0x2c')](respondWithResult(_0x15acb6,null))[_0x3b79('0x2d')](handleError(_0x15acb6,null));};exports['destroy']=function(_0x4e0bb5,_0x59b8d3){return db[_0x3b79('0x24')]['find']({'where':{'id':_0x4e0bb5[_0x3b79('0x2f')]['id']}})[_0x3b79('0x2c')](handleEntityNotFound(_0x59b8d3,null))[_0x3b79('0x2c')](removeEntity(_0x59b8d3,null))[_0x3b79('0x2d')](handleError(_0x59b8d3,null));};exports[_0x3b79('0x3e')]=function(_0x52aaae,_0x3d7b66){return db[_0x3b79('0x24')]['describe']()[_0x3b79('0x2c')](respondWithResult(_0x3d7b66,null))[_0x3b79('0x2d')](handleError(_0x3d7b66,null));};exports[_0x3b79('0x3f')]=function(_0x36fb79,_0x448d6e){return db['WhatsappMessage'][_0x3b79('0x3b')]({'where':{'id':_0x36fb79[_0x3b79('0x2f')]['id']}})[_0x3b79('0x2c')](handleEntityNotFound(_0x448d6e,null))[_0x3b79('0x2c')](function(_0x5cf9c8){if(_0x5cf9c8){return _0x5cf9c8[_0x3b79('0x3f')](_0x36fb79['body'][_0x3b79('0x40')],_[_0x3b79('0x41')](_0x36fb79[_0x3b79('0x3d')],[_0x3b79('0x40'),'id'])||{});}})['then'](respondWithResult(_0x448d6e,null))[_0x3b79('0x2d')](handleError(_0x448d6e,null));};exports[_0x3b79('0x42')]=function(_0xa199c4,_0x413098){var _0x356ba1={'raw':![],'where':{}};var _0x3ad51f={};var _0xce0f0f={'count':0x0,'rows':[]};return db['WhatsappInteraction'][_0x3b79('0x43')]({'where':{'id':_0xa199c4['params']['id']}})['then'](handleEntityNotFound(_0x413098,null))[_0x3b79('0x2c')](function(_0x39cfcf){if(_0x39cfcf){_0x3ad51f[_0x3b79('0x33')]=_[_0x3b79('0x30')](db[_0x3b79('0x44')][_0x3b79('0x25')]);_0x3ad51f[_0x3b79('0x2b')]=_[_0x3b79('0x30')](_0xa199c4[_0x3b79('0x2b')]);_0x3ad51f['filters']=_[_0x3b79('0x32')](_0x3ad51f[_0x3b79('0x33')],_0x3ad51f['query']);_0x356ba1[_0x3b79('0x35')]=_['intersection'](_0x3ad51f[_0x3b79('0x33')],qs[_0x3b79('0x34')](_0xa199c4[_0x3b79('0x2b')][_0x3b79('0x34')]));_0x356ba1[_0x3b79('0x35')]=_0x356ba1[_0x3b79('0x35')]['length']?_0x356ba1['attributes']:_0x3ad51f[_0x3b79('0x33')];if(!_0xa199c4[_0x3b79('0x2b')][_0x3b79('0x45')](_0x3b79('0x46'))){_0x356ba1[_0x3b79('0x19')]=qs[_0x3b79('0x19')](_0xa199c4[_0x3b79('0x2b')][_0x3b79('0x19')]);_0x356ba1[_0x3b79('0x16')]=qs[_0x3b79('0x16')](_0xa199c4[_0x3b79('0x2b')][_0x3b79('0x16')]);}_0x356ba1[_0x3b79('0x47')]=qs[_0x3b79('0x48')](_0xa199c4[_0x3b79('0x2b')]['sort']);_0x356ba1[_0x3b79('0x49')]=qs[_0x3b79('0x31')](_[_0x3b79('0x4a')](_0xa199c4[_0x3b79('0x2b')],_0x3ad51f[_0x3b79('0x31')]));_0x356ba1[_0x3b79('0x49')][_0x3b79('0x4b')]=_0x39cfcf['id'];if(_0xa199c4[_0x3b79('0x2b')][_0x3b79('0x4c')]){_0x356ba1[_0x3b79('0x49')]=_['merge'](_0x356ba1['where'],{'$or':_[_0x3b79('0x23')](_0x356ba1[_0x3b79('0x35')],function(_0x1ee1ce){var _0x4a8f1d={};_0x4a8f1d[_0x1ee1ce]={'$like':'%'+_0xa199c4[_0x3b79('0x2b')][_0x3b79('0x4c')]+'%'};return _0x4a8f1d;})});}if(_0xa199c4[_0x3b79('0x2b')][_0x3b79('0x4d')]){var _0x3a80ff=_0xa199c4[_0x3b79('0x2b')]['$gte'][_0x3b79('0x4e')](',');var _0x41d58c={};_0x41d58c[_0x3a80ff[0x0]]={'$gte':moment(_0x3a80ff[0x1])['format'](_0x3b79('0x4f'))};_0x356ba1['where']=_[_0x3b79('0x39')](_0x356ba1[_0x3b79('0x49')],_0x41d58c);}_0x356ba1=_[_0x3b79('0x39')]({},_0x356ba1,_0xa199c4[_0x3b79('0x3a')]);return db['WhatsappMessage'][_0x3b79('0x18')]({'where':_0x356ba1[_0x3b79('0x49')]})[_0x3b79('0x2c')](function(_0x7b7213){_0xce0f0f[_0x3b79('0x18')]=_0x7b7213;if(_0xa199c4[_0x3b79('0x2b')][_0x3b79('0x37')]){_0x356ba1[_0x3b79('0x38')]=[{'all':!![]}];}return db[_0x3b79('0x44')]['findAll'](_0x356ba1);})[_0x3b79('0x2c')](function(_0x3f1fba){_0xce0f0f[_0x3b79('0x50')]=_0x3f1fba;return _0xce0f0f;});}})[_0x3b79('0x2c')](respondWithFilteredResult(_0x413098,_0x356ba1))[_0x3b79('0x2d')](handleError(_0x413098,null));};exports[_0x3b79('0x51')]=function(_0x2cb615,_0x358431){return db[_0x3b79('0x24')][_0x3b79('0x3b')]({'where':{'id':_0x2cb615['params']['id']}})[_0x3b79('0x2c')](handleEntityNotFound(_0x358431,null))[_0x3b79('0x2c')](function(_0x5e67ad){if(_0x5e67ad){return _0x5e67ad[_0x3b79('0x52')](_0x2cb615['body']['ids'],_['omit'](_0x2cb615['body'],[_0x3b79('0x40'),'id'])||{})[_0x3b79('0x53')](function(){return db[_0x3b79('0x54')][_0x3b79('0x29')]({'attributes':['id',_0x3b79('0x20'),_0x3b79('0x55')],'where':{'id':_0x2cb615[_0x3b79('0x3d')][_0x3b79('0x40')]}});})[_0x3b79('0x2c')](function(_0x5ca909){socket[_0x3b79('0x56')]('whatsappInteractionTags:save',{'id':Number(_0x2cb615['params']['id']),'tags':_0x5ca909||[]});return{'id':Number(_0x2cb615[_0x3b79('0x2f')]['id']),'tags':_0x5ca909||[]};});}})[_0x3b79('0x2c')](respondWithResult(_0x358431,null))['catch'](handleError(_0x358431,null));};exports[_0x3b79('0x57')]=function(_0x8f8878,_0x2158f3){return db['WhatsappInteraction'][_0x3b79('0x3b')]({'where':{'id':_0x8f8878['params']['id']}})[_0x3b79('0x2c')](handleEntityNotFound(_0x2158f3,null))['then'](function(_0x4f1498){if(_0x4f1498){return _0x4f1498['removeTags'](_0x8f8878[_0x3b79('0x2b')][_0x3b79('0x40')]);}})[_0x3b79('0x2c')](respondWithStatusCode(_0x2158f3,null))[_0x3b79('0x2d')](handleError(_0x2158f3,null));};exports['download']=function(_0x3dd50d,_0x7d1ec8){var _0x1204b0=moment()[_0x3b79('0x58')]()[_0x3b79('0x59')]();var _0x1fa711=path[_0x3b79('0x5a')](config[_0x3b79('0x5b')],_0x3b79('0x5c'),_0x3b79('0x5d'),_0x3b79('0x5e'));var _0x304487=path['join'](config[_0x3b79('0x5b')],_0x3b79('0x5c'),_0x3b79('0x5d'),_0x3b79('0x5f'));var _0x278751=path[_0x3b79('0x5a')](_0x1fa711,_0x1204b0);var _0x3a97b0=util['format'](_0x3b79('0x60'),_0x3dd50d['params']['id'],_0x1204b0);var _0x4ca1c6=path[_0x3b79('0x5a')](_0x1fa711,_0x3a97b0);var _0x33c187=[];_0x33c187['push']({'model':db[_0x3b79('0x61')],'as':_0x3b79('0x61'),'attributes':['id','fullname'],'raw':!![]});_0x33c187[_0x3b79('0x62')]({'model':db['CmContact'],'as':_0x3b79('0x63'),'attributes':['id',_0x3b79('0x64'),_0x3b79('0x65')],'raw':!![]});if(_0x3dd50d[_0x3b79('0x2b')][_0x3b79('0x5f')]){_0x33c187['push']({'model':db['Attachment'],'as':_0x3b79('0x66'),'raw':!![]});}var _0x2c34a2=[{'model':db[_0x3b79('0x44')],'as':'Messages','attributes':['id',_0x3b79('0x3d'),_0x3b79('0x67'),_0x3b79('0x68'),'secret',_0x3b79('0x69')],'include':_0x33c187}];_0x2c34a2[_0x3b79('0x62')]({'model':db['WhatsappAccount'],'as':'Account','attributes':['id',_0x3b79('0x20')]});_0x2c34a2[_0x3b79('0x62')]({'model':db[_0x3b79('0x61')],'as':_0x3b79('0x6a'),'attributes':['id',_0x3b79('0x6b')]});return db[_0x3b79('0x24')][_0x3b79('0x3b')]({'where':{'id':_0x3dd50d[_0x3b79('0x2f')]['id']},'include':_0x2c34a2})[_0x3b79('0x2c')](handleEntityNotFound(_0x7d1ec8,null))[_0x3b79('0x2c')](function(_0x1285d4){if(_0x1285d4){var _0x4daec6=_0x1285d4[_0x3b79('0x6c')]({'plain':!![]});fs[_0x3b79('0x6d')](_0x278751);var _0x3d7681={'channel':_0x3b79('0x6e'),'account':_0x4daec6[_0x3b79('0x6f')][_0x3b79('0x20')],'agent':_0x4daec6['Owner']?_0x4daec6[_0x3b79('0x6a')]['fullname']:_0x3b79('0x70'),'createdAt':moment(_0x4daec6[_0x3b79('0x67')])[_0x3b79('0x71')]('YYYY-MM-DD\x20HH:mm:ss')[_0x3b79('0x59')](),'closedAt':_0x4daec6[_0x3b79('0x72')]?moment(_0x4daec6['closedAt'])['format'](_0x3b79('0x4f'))['toString']():'','disposition':_0x4daec6[_0x3b79('0x73')],'messages':_(_0x4daec6[_0x3b79('0x74')])[_0x3b79('0x4c')]({'secret':![]})[_0x3b79('0x23')](function(_0x18120d){if(_0x18120d[_0x3b79('0x66')]){var _0x388d24=path['join'](_0x304487,_0x18120d[_0x3b79('0x66')][_0x3b79('0x75')]);if(fs['existsSync'](_0x388d24)){fs['createReadStream'](_0x388d24)[_0x3b79('0x76')](fs[_0x3b79('0x77')](path['join'](_0x278751,_0x18120d[_0x3b79('0x66')][_0x3b79('0x75')])));}}return{'date':moment(_0x18120d[_0x3b79('0x67')])[_0x3b79('0x71')](_0x3b79('0x4f'))[_0x3b79('0x59')](),'sender':_0x18120d[_0x3b79('0x68')]==='out'?_0x18120d[_0x3b79('0x61')]?_0x18120d[_0x3b79('0x61')][_0x3b79('0x6b')]:_0x3b79('0x78'):_0x18120d['Contact'][_0x3b79('0x64')]+(_0x18120d[_0x3b79('0x63')][_0x3b79('0x65')]?'\x20'+_0x18120d[_0x3b79('0x63')]['lastName']:''),'body':_0x18120d[_0x3b79('0x66')]?_0x18120d[_0x3b79('0x66')][_0x3b79('0x75')]:_0x18120d[_0x3b79('0x3d')],'direction':_0x18120d['direction']===_0x3b79('0x79')?'A':'C','secret':_0x18120d[_0x3b79('0x7a')],'read':_0x18120d[_0x3b79('0x69')],'attachment':_0x18120d[_0x3b79('0x66')]};})[_0x3b79('0x7b')]()};return ejs[_0x3b79('0x7c')](path[_0x3b79('0x5a')](config[_0x3b79('0x5b')],'server',_0x3b79('0x7d'),_0x3b79('0x7e')),{'interaction':_0x3d7681})[_0x3b79('0x2c')](function(_0x456f3b){var _0x534e96=path[_0x3b79('0x5a')](_0x278751,_0x3b79('0x7f')+_0x4daec6['id']+'-'+_0x1204b0+'.pdf');var _0x1ddd37={'path':_0x534e96,'channel':'Whatsapp','interactionId':_0x4daec6['id']};return pdf[_0x3b79('0x80')](_0x456f3b,_0x1ddd37);})[_0x3b79('0x2c')](function(){return new BPromise(function(_0x5420bd,_0x363720){zipdir(_0x278751,{'saveTo':_0x4ca1c6},function(_0x1f68ef,_0x4e6e5){if(_0x1f68ef)return _0x363720(_0x1f68ef);return _0x5420bd(_0x4e6e5);});})[_0x3b79('0x2c')](function(){return new BPromise(function(_0x4c5450,_0x260f0f){rimraf(_0x278751,function(_0x4d1007){if(_0x4d1007)_0x260f0f(_0x4d1007);return _0x4c5450();});});})[_0x3b79('0x2c')](function(){return _0x7d1ec8['download'](_0x4ca1c6,_0x3a97b0,function(_0x25715e){if(_0x25715e){console['log']('err',_0x25715e);}else{fs[_0x3b79('0x81')](_0x4ca1c6);}});});});}else{return _0x7d1ec8[_0x3b79('0x13')](0xc8);}})[_0x3b79('0x2d')](handleError(_0x7d1ec8,null));}; \ No newline at end of file +var _0x1534=['whatsapp','query','catch','params','model','WhatsappInteraction','keys','attributes','fields','length','include','merge','options','find','create','body','update','describe','addMessage','WhatsappMessage','ids','omit','getMessages','findOne','nolimit','order','sort','where','filters','pick','filter','$gte','split','format','includeAll','rows','setTags','spread','Tag','whatsappInteractionTags:save','removeTags','download','unix','toString','root','server','files','tmp','join','attachments','transcript-%d-%s.zip','push','User','fullname','CmContact','Contact','lastName','Attachment','Messages','createdAt','secret','read','Account','Owner','mkdirSync','Whatsapp','N.A.','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','disposition','basename','createReadStream','pipe','createWriteStream','direction','out','System','firstName','value','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','log','err','unlinkSync','rimraf','zip-dir','moment','util','path','lodash','ioredis','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','register','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','destroy','then','error','stack','name','send','map','rawAttributes','key','getOptions','findAll'];(function(_0x441a06,_0x3b5fc5){var _0x4559ce=function(_0x22dac6){while(--_0x22dac6){_0x441a06['push'](_0x441a06['shift']());}};_0x4559ce(++_0x3b5fc5);}(_0x1534,0xda));var _0x4153=function(_0x2565a4,_0x5d6a87){_0x2565a4=_0x2565a4-0x0;var _0x5e87f4=_0x1534[_0x2565a4];return _0x5e87f4;};'use strict';var rimraf=require(_0x4153('0x0'));var zipdir=require(_0x4153('0x1'));var moment=require(_0x4153('0x2'));var BPromise=require('bluebird');var util=require(_0x4153('0x3'));var path=require(_0x4153('0x4'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x4153('0x5'));var Redis=require(_0x4153('0x6'));var interaction=require('../../components/interaction/service');var qs=require(_0x4153('0x7'));var pdf=require(_0x4153('0x8'));var logger=require(_0x4153('0x9'))(_0x4153('0xa'));var config=require(_0x4153('0xb'));var db=require(_0x4153('0xc'))['db'];config[_0x4153('0xd')]=_[_0x4153('0xe')](config[_0x4153('0xd')],{'host':_0x4153('0xf'),'port':0x18eb});var socket=require(_0x4153('0x10'))(new Redis(config['redis']));require(_0x4153('0x11'))[_0x4153('0x12')](socket);function respondWithStatusCode(_0x552ab8,_0x14c61d){_0x14c61d=_0x14c61d||0xcc;return function(_0x711e82){if(_0x711e82){return _0x552ab8[_0x4153('0x13')](_0x14c61d);}return _0x552ab8[_0x4153('0x14')](_0x14c61d)[_0x4153('0x15')]();};}function respondWithResult(_0x298649,_0x11a61c){_0x11a61c=_0x11a61c||0xc8;return function(_0xd1d003){if(_0xd1d003){return _0x298649[_0x4153('0x14')](_0x11a61c)[_0x4153('0x16')](_0xd1d003);}};}function respondWithFilteredResult(_0x264be4,_0x2b12ed){return function(_0x21d6a8){if(_0x21d6a8){var _0x135df8=typeof _0x2b12ed['offset']===_0x4153('0x17')&&typeof _0x2b12ed[_0x4153('0x18')]===_0x4153('0x17');var _0x33b78c=_0x21d6a8[_0x4153('0x19')];var _0x3d2a57=_0x135df8?0x0:_0x2b12ed[_0x4153('0x1a')];var _0x403dfe=_0x135df8?_0x21d6a8[_0x4153('0x19')]:_0x2b12ed[_0x4153('0x1a')]+_0x2b12ed[_0x4153('0x18')];var _0x4ed10b;if(_0x403dfe>=_0x33b78c){_0x403dfe=_0x33b78c;_0x4ed10b=0xc8;}else{_0x4ed10b=0xce;}_0x264be4['status'](_0x4ed10b);return _0x264be4[_0x4153('0x1b')](_0x4153('0x1c'),_0x3d2a57+'-'+_0x403dfe+'/'+_0x33b78c)['json'](_0x21d6a8);}return null;};}function saveUpdates(_0x3273bf){return function(_0x40004f){if(_0x40004f){return _0x40004f['update'](_0x3273bf)['then'](function(_0x1c06cc){return _0x1c06cc;});}return null;};}function removeEntity(_0x51790c){return function(_0x1bc5df){if(_0x1bc5df){return _0x1bc5df[_0x4153('0x1d')]()[_0x4153('0x1e')](function(){_0x51790c[_0x4153('0x14')](0xcc)[_0x4153('0x15')]();});}};}function handleEntityNotFound(_0x597013){return function(_0x3fc4d7){if(!_0x3fc4d7){_0x597013[_0x4153('0x13')](0x194);}return _0x3fc4d7;};}function handleError(_0x330ce7,_0xff6977){_0xff6977=_0xff6977||0x1f4;return function(_0x4bdd14){logger[_0x4153('0x1f')](_0x4bdd14[_0x4153('0x20')]);if(_0x4bdd14[_0x4153('0x21')]){delete _0x4bdd14['name'];}_0x330ce7[_0x4153('0x14')](_0xff6977)[_0x4153('0x22')](_0x4bdd14);};}exports['index']=function(_0x3ae872,_0x303465){var _0x4dd7a9={};var _0x50b73c=_[_0x4153('0x23')](db['WhatsappInteraction'][_0x4153('0x24')],function(_0x41b4f5){return{'name':_0x41b4f5['fieldName'],'type':_0x41b4f5['type'][_0x4153('0x25')]};});_0x4dd7a9=qs[_0x4153('0x26')](_0x50b73c,_0x3ae872);return interaction[_0x4153('0x27')](_0x4153('0x28'),_0x3ae872[_0x4153('0x29')],_0x3ae872['user'],_0x4dd7a9,_0x50b73c)['then'](respondWithFilteredResult(_0x303465,_0x4dd7a9))[_0x4153('0x2a')](handleError(_0x303465,null));};exports['show']=function(_0x7f8e20,_0x46417e){var _0x10a95b={'raw':![],'where':{'id':_0x7f8e20[_0x4153('0x2b')]['id']}},_0xf1bd76={};_0xf1bd76[_0x4153('0x2c')]=_['keys'](db[_0x4153('0x2d')]['rawAttributes']);_0xf1bd76['query']=_[_0x4153('0x2e')](_0x7f8e20[_0x4153('0x29')]);_0xf1bd76['filters']=_['intersection'](_0xf1bd76[_0x4153('0x2c')],_0xf1bd76[_0x4153('0x29')]);_0x10a95b[_0x4153('0x2f')]=_['intersection'](_0xf1bd76['model'],qs[_0x4153('0x30')](_0x7f8e20['query'][_0x4153('0x30')]));_0x10a95b[_0x4153('0x2f')]=_0x10a95b[_0x4153('0x2f')][_0x4153('0x31')]?_0x10a95b[_0x4153('0x2f')]:_0xf1bd76[_0x4153('0x2c')];if(_0x7f8e20[_0x4153('0x29')]['includeAll']){_0x10a95b[_0x4153('0x32')]=[{'all':!![]}];}_0x10a95b=_[_0x4153('0x33')]({},_0x10a95b,_0x7f8e20[_0x4153('0x34')]);return db['WhatsappInteraction'][_0x4153('0x35')](_0x10a95b)[_0x4153('0x1e')](handleEntityNotFound(_0x46417e,null))[_0x4153('0x1e')](respondWithResult(_0x46417e,null))[_0x4153('0x2a')](handleError(_0x46417e,null));};exports[_0x4153('0x36')]=function(_0xebc76,_0xbf5095){return db[_0x4153('0x2d')][_0x4153('0x36')](_0xebc76[_0x4153('0x37')],{})[_0x4153('0x1e')](respondWithResult(_0xbf5095,0xc9))['catch'](handleError(_0xbf5095,null));};exports[_0x4153('0x38')]=function(_0x375498,_0x127340){if(_0x375498[_0x4153('0x37')]['id']){delete _0x375498[_0x4153('0x37')]['id'];}return db[_0x4153('0x2d')][_0x4153('0x35')]({'where':{'id':_0x375498[_0x4153('0x2b')]['id']}})[_0x4153('0x1e')](handleEntityNotFound(_0x127340,null))[_0x4153('0x1e')](saveUpdates(_0x375498[_0x4153('0x37')],null))[_0x4153('0x1e')](respondWithResult(_0x127340,null))[_0x4153('0x2a')](handleError(_0x127340,null));};exports[_0x4153('0x1d')]=function(_0x10bc35,_0x55a342){return db[_0x4153('0x2d')][_0x4153('0x35')]({'where':{'id':_0x10bc35['params']['id']}})['then'](handleEntityNotFound(_0x55a342,null))[_0x4153('0x1e')](removeEntity(_0x55a342,null))[_0x4153('0x2a')](handleError(_0x55a342,null));};exports['describe']=function(_0x36f28e,_0x577cb3){return db[_0x4153('0x2d')][_0x4153('0x39')]()[_0x4153('0x1e')](respondWithResult(_0x577cb3,null))[_0x4153('0x2a')](handleError(_0x577cb3,null));};exports[_0x4153('0x3a')]=function(_0x1da423,_0x5ac0e3){return db[_0x4153('0x3b')]['find']({'where':{'id':_0x1da423[_0x4153('0x2b')]['id']}})[_0x4153('0x1e')](handleEntityNotFound(_0x5ac0e3,null))[_0x4153('0x1e')](function(_0x429325){if(_0x429325){return _0x429325[_0x4153('0x3a')](_0x1da423[_0x4153('0x37')][_0x4153('0x3c')],_[_0x4153('0x3d')](_0x1da423[_0x4153('0x37')],[_0x4153('0x3c'),'id'])||{});}})[_0x4153('0x1e')](respondWithResult(_0x5ac0e3,null))['catch'](handleError(_0x5ac0e3,null));};exports[_0x4153('0x3e')]=function(_0x1f3898,_0x59f0e6){var _0x29ed32={'raw':![],'where':{}};var _0x5c211c={};var _0x333dfc={'count':0x0,'rows':[]};return db['WhatsappInteraction'][_0x4153('0x3f')]({'where':{'id':_0x1f3898[_0x4153('0x2b')]['id']}})[_0x4153('0x1e')](handleEntityNotFound(_0x59f0e6,null))[_0x4153('0x1e')](function(_0x2a0c0d){if(_0x2a0c0d){_0x5c211c[_0x4153('0x2c')]=_[_0x4153('0x2e')](db['WhatsappMessage'][_0x4153('0x24')]);_0x5c211c[_0x4153('0x29')]=_['keys'](_0x1f3898[_0x4153('0x29')]);_0x5c211c['filters']=_['intersection'](_0x5c211c[_0x4153('0x2c')],_0x5c211c[_0x4153('0x29')]);_0x29ed32[_0x4153('0x2f')]=_['intersection'](_0x5c211c[_0x4153('0x2c')],qs[_0x4153('0x30')](_0x1f3898[_0x4153('0x29')][_0x4153('0x30')]));_0x29ed32[_0x4153('0x2f')]=_0x29ed32[_0x4153('0x2f')][_0x4153('0x31')]?_0x29ed32[_0x4153('0x2f')]:_0x5c211c[_0x4153('0x2c')];if(!_0x1f3898[_0x4153('0x29')]['hasOwnProperty'](_0x4153('0x40'))){_0x29ed32['limit']=qs[_0x4153('0x18')](_0x1f3898['query']['limit']);_0x29ed32['offset']=qs['offset'](_0x1f3898['query'][_0x4153('0x1a')]);}_0x29ed32[_0x4153('0x41')]=qs[_0x4153('0x42')](_0x1f3898['query'][_0x4153('0x42')]);_0x29ed32[_0x4153('0x43')]=qs[_0x4153('0x44')](_[_0x4153('0x45')](_0x1f3898['query'],_0x5c211c[_0x4153('0x44')]));_0x29ed32[_0x4153('0x43')]['WhatsappInteractionId']=_0x2a0c0d['id'];if(_0x1f3898[_0x4153('0x29')][_0x4153('0x46')]){_0x29ed32[_0x4153('0x43')]=_['merge'](_0x29ed32['where'],{'$or':_[_0x4153('0x23')](_0x29ed32[_0x4153('0x2f')],function(_0x46ae1a){var _0x3bd058={};_0x3bd058[_0x46ae1a]={'$like':'%'+_0x1f3898['query'][_0x4153('0x46')]+'%'};return _0x3bd058;})});}if(_0x1f3898[_0x4153('0x29')][_0x4153('0x47')]){var _0x1c98ab=_0x1f3898[_0x4153('0x29')]['$gte'][_0x4153('0x48')](',');var _0x13d8db={};_0x13d8db[_0x1c98ab[0x0]]={'$gte':moment(_0x1c98ab[0x1])[_0x4153('0x49')]('YYYY-MM-DD\x20HH:mm:ss')};_0x29ed32[_0x4153('0x43')]=_[_0x4153('0x33')](_0x29ed32[_0x4153('0x43')],_0x13d8db);}_0x29ed32=_[_0x4153('0x33')]({},_0x29ed32,_0x1f3898[_0x4153('0x34')]);return db[_0x4153('0x3b')][_0x4153('0x19')]({'where':_0x29ed32[_0x4153('0x43')]})['then'](function(_0x2f6de8){_0x333dfc[_0x4153('0x19')]=_0x2f6de8;if(_0x1f3898['query'][_0x4153('0x4a')]){_0x29ed32[_0x4153('0x32')]=[{'all':!![]}];}return db[_0x4153('0x3b')][_0x4153('0x27')](_0x29ed32);})[_0x4153('0x1e')](function(_0x28e090){_0x333dfc[_0x4153('0x4b')]=_0x28e090;return _0x333dfc;});}})[_0x4153('0x1e')](respondWithFilteredResult(_0x59f0e6,_0x29ed32))[_0x4153('0x2a')](handleError(_0x59f0e6,null));};exports['addTags']=function(_0x32a72b,_0x195aaa){return db[_0x4153('0x2d')]['find']({'where':{'id':_0x32a72b[_0x4153('0x2b')]['id']}})[_0x4153('0x1e')](handleEntityNotFound(_0x195aaa,null))[_0x4153('0x1e')](function(_0x8246df){if(_0x8246df){return _0x8246df[_0x4153('0x4c')](_0x32a72b[_0x4153('0x37')][_0x4153('0x3c')],_[_0x4153('0x3d')](_0x32a72b[_0x4153('0x37')],[_0x4153('0x3c'),'id'])||{})[_0x4153('0x4d')](function(){return db[_0x4153('0x4e')][_0x4153('0x27')]({'attributes':['id',_0x4153('0x21'),'color'],'where':{'id':_0x32a72b[_0x4153('0x37')][_0x4153('0x3c')]}});})['then'](function(_0x2c70cc){socket['emit'](_0x4153('0x4f'),{'id':Number(_0x32a72b[_0x4153('0x2b')]['id']),'tags':_0x2c70cc||[]});return{'id':Number(_0x32a72b[_0x4153('0x2b')]['id']),'tags':_0x2c70cc||[]};});}})[_0x4153('0x1e')](respondWithResult(_0x195aaa,null))[_0x4153('0x2a')](handleError(_0x195aaa,null));};exports[_0x4153('0x50')]=function(_0x230126,_0x5ae906){return db[_0x4153('0x2d')][_0x4153('0x35')]({'where':{'id':_0x230126[_0x4153('0x2b')]['id']}})['then'](handleEntityNotFound(_0x5ae906,null))[_0x4153('0x1e')](function(_0x1921c1){if(_0x1921c1){return _0x1921c1[_0x4153('0x50')](_0x230126['query']['ids']);}})[_0x4153('0x1e')](respondWithStatusCode(_0x5ae906,null))['catch'](handleError(_0x5ae906,null));};exports[_0x4153('0x51')]=function(_0x13e491,_0x48c236){var _0x2a595e=moment()[_0x4153('0x52')]()[_0x4153('0x53')]();var _0x3bec52=path['join'](config[_0x4153('0x54')],_0x4153('0x55'),_0x4153('0x56'),_0x4153('0x57'));var _0x27692d=path[_0x4153('0x58')](config['root'],_0x4153('0x55'),_0x4153('0x56'),_0x4153('0x59'));var _0x50d5b0=path['join'](_0x3bec52,_0x2a595e);var _0x42ae18=util[_0x4153('0x49')](_0x4153('0x5a'),_0x13e491[_0x4153('0x2b')]['id'],_0x2a595e);var _0x5515e8=path[_0x4153('0x58')](_0x3bec52,_0x42ae18);var _0x3b8879=[];_0x3b8879[_0x4153('0x5b')]({'model':db[_0x4153('0x5c')],'as':_0x4153('0x5c'),'attributes':['id',_0x4153('0x5d')],'raw':!![]});_0x3b8879[_0x4153('0x5b')]({'model':db[_0x4153('0x5e')],'as':_0x4153('0x5f'),'attributes':['id','firstName',_0x4153('0x60')],'raw':!![]});if(_0x13e491[_0x4153('0x29')][_0x4153('0x59')]){_0x3b8879[_0x4153('0x5b')]({'model':db[_0x4153('0x61')],'as':_0x4153('0x61'),'raw':!![]});}var _0x4108b1=[{'model':db[_0x4153('0x3b')],'as':_0x4153('0x62'),'attributes':['id',_0x4153('0x37'),_0x4153('0x63'),'direction',_0x4153('0x64'),_0x4153('0x65')],'include':_0x3b8879}];_0x4108b1[_0x4153('0x5b')]({'model':db['WhatsappAccount'],'as':_0x4153('0x66'),'attributes':['id',_0x4153('0x21')]});_0x4108b1[_0x4153('0x5b')]({'model':db[_0x4153('0x5c')],'as':_0x4153('0x67'),'attributes':['id',_0x4153('0x5d')]});return db[_0x4153('0x2d')][_0x4153('0x35')]({'where':{'id':_0x13e491[_0x4153('0x2b')]['id']},'include':_0x4108b1})['then'](handleEntityNotFound(_0x48c236,null))[_0x4153('0x1e')](function(_0x5997b9){if(_0x5997b9){var _0x4da1f1=_0x5997b9['get']({'plain':!![]});fs[_0x4153('0x68')](_0x50d5b0);var _0xd845d={'channel':_0x4153('0x69'),'account':_0x4da1f1[_0x4153('0x66')]['name'],'agent':_0x4da1f1[_0x4153('0x67')]?_0x4da1f1[_0x4153('0x67')]['fullname']:_0x4153('0x6a'),'createdAt':moment(_0x4da1f1[_0x4153('0x63')])[_0x4153('0x49')](_0x4153('0x6b'))['toString'](),'closedAt':_0x4da1f1[_0x4153('0x6c')]?moment(_0x4da1f1[_0x4153('0x6d')])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0x4153('0x53')]():'','disposition':_0x4da1f1[_0x4153('0x6e')],'messages':_(_0x4da1f1[_0x4153('0x62')])[_0x4153('0x46')]({'secret':![]})[_0x4153('0x23')](function(_0x19fb4b){if(_0x19fb4b[_0x4153('0x61')]){var _0x11a691=path[_0x4153('0x58')](_0x27692d,_0x19fb4b[_0x4153('0x61')][_0x4153('0x6f')]);if(fs['existsSync'](_0x11a691)){fs[_0x4153('0x70')](_0x11a691)[_0x4153('0x71')](fs[_0x4153('0x72')](path['join'](_0x50d5b0,_0x19fb4b[_0x4153('0x61')][_0x4153('0x6f')])));}}return{'date':moment(_0x19fb4b[_0x4153('0x63')])[_0x4153('0x49')](_0x4153('0x6b'))[_0x4153('0x53')](),'sender':_0x19fb4b[_0x4153('0x73')]===_0x4153('0x74')?_0x19fb4b['User']?_0x19fb4b[_0x4153('0x5c')]['fullname']:_0x4153('0x75'):_0x19fb4b[_0x4153('0x5f')][_0x4153('0x76')]+(_0x19fb4b[_0x4153('0x5f')][_0x4153('0x60')]?'\x20'+_0x19fb4b[_0x4153('0x5f')][_0x4153('0x60')]:''),'body':_0x19fb4b['Attachment']?_0x19fb4b[_0x4153('0x61')]['basename']:_0x19fb4b[_0x4153('0x37')],'direction':_0x19fb4b['direction']===_0x4153('0x74')?'A':'C','secret':_0x19fb4b[_0x4153('0x64')],'read':_0x19fb4b[_0x4153('0x65')],'attachment':_0x19fb4b['Attachment']};})[_0x4153('0x77')]()};return ejs[_0x4153('0x78')](path[_0x4153('0x58')](config[_0x4153('0x54')],'server',_0x4153('0x79'),_0x4153('0x7a')),{'interaction':_0xd845d})[_0x4153('0x1e')](function(_0x2d64ff){var _0x508fcc=path[_0x4153('0x58')](_0x50d5b0,_0x4153('0x7b')+_0x4da1f1['id']+'-'+_0x2a595e+_0x4153('0x7c'));var _0xbe6be2={'path':_0x508fcc,'channel':'Whatsapp','interactionId':_0x4da1f1['id']};return pdf[_0x4153('0x7d')](_0x2d64ff,_0xbe6be2);})[_0x4153('0x1e')](function(){return new BPromise(function(_0x5960d7,_0x52b208){zipdir(_0x50d5b0,{'saveTo':_0x5515e8},function(_0x4ea60e,_0x2961f0){if(_0x4ea60e)return _0x52b208(_0x4ea60e);return _0x5960d7(_0x2961f0);});})[_0x4153('0x1e')](function(){return new BPromise(function(_0x49d57d,_0x246338){rimraf(_0x50d5b0,function(_0x8bb00d){if(_0x8bb00d)_0x246338(_0x8bb00d);return _0x49d57d();});});})['then'](function(){return _0x48c236[_0x4153('0x51')](_0x5515e8,_0x42ae18,function(_0x42ccc2){if(_0x42ccc2){console[_0x4153('0x7e')](_0x4153('0x7f'),_0x42ccc2);}else{fs[_0x4153('0x80')](_0x5515e8);}});});});}else{return _0x48c236[_0x4153('0x13')](0xc8);}})[_0x4153('0x2a')](handleError(_0x48c236,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index 6a5e7d1..c737636 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 _0xcc73=['unreadMessages','length','emit','hook','../../mysqldb','WhatsappInteraction','setMaxListeners','update','getUsers','then','setDataValue','Users','map'];(function(_0x41bdd4,_0x3d5c76){var _0x5c03a6=function(_0x59634a){while(--_0x59634a){_0x41bdd4['push'](_0x41bdd4['shift']());}};_0x5c03a6(++_0x3d5c76);}(_0xcc73,0x1cb));var _0x3cc7=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xcc73[_0x6c993a];return _0x27f547;};'use strict';var EventEmitter=require('events');var WhatsappInteraction=require(_0x3cc7('0x0'))['db'][_0x3cc7('0x1')];var WhatsappMessage=require('../../mysqldb')['db']['WhatsappMessage'];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0x3cc7('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x3cc7('0x3'),'afterDestroy':'remove'};function emitEvent(_0x5de4be){return function(_0x3c87d4,_0xd060f7,_0x1ccad1){_0x3c87d4[_0x3cc7('0x4')]({'attributes':['id'],'raw':!![]})[_0x3cc7('0x5')](function(_0x5604df){_0x3c87d4[_0x3cc7('0x6')](_0x3cc7('0x7'),_0x5604df[_0x3cc7('0x8')](function(_0x26aa1a){return{'id':_0x26aa1a['id']};}));return WhatsappMessage['findAll']({'where':{'WhatsappInteractionId':_0x3c87d4['id'],'direction':'in','read':![]},'raw':!![]});})[_0x3cc7('0x5')](function(_0x44005b){_0x3c87d4[_0x3cc7('0x6')](_0x3cc7('0x9'),_0x44005b[_0x3cc7('0xa')]);WhatsappInteractionEvents[_0x3cc7('0xb')](_0x5de4be+':'+_0x3c87d4['id'],_0x3c87d4);WhatsappInteractionEvents[_0x3cc7('0xb')](_0x5de4be,_0x3c87d4);_0x1ccad1(null);})['catch'](_0x1ccad1(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappInteraction[_0x3cc7('0xc')](e,emitEvent(event));}}module['exports']=WhatsappInteractionEvents; \ No newline at end of file +var _0x8b2b=['WhatsappInteraction','WhatsappMessage','setMaxListeners','save','update','remove','getUsers','then','map','findAll','unreadMessages','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x8b2b,0x1c0));var _0xb8b2=function(_0x2f7dda,_0x55b113){_0x2f7dda=_0x2f7dda-0x0;var _0x29dc08=_0x8b2b[_0x2f7dda];return _0x29dc08;};'use strict';var EventEmitter=require(_0xb8b2('0x0'));var WhatsappInteraction=require(_0xb8b2('0x1'))['db'][_0xb8b2('0x2')];var WhatsappMessage=require('../../mysqldb')['db'][_0xb8b2('0x3')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0xb8b2('0x4')](0x0);var events={'afterCreate':_0xb8b2('0x5'),'afterUpdate':_0xb8b2('0x6'),'afterDestroy':_0xb8b2('0x7')};function emitEvent(_0x2928a7){return function(_0x570c5d,_0x5bf172,_0xba7734){_0x570c5d[_0xb8b2('0x8')]({'attributes':['id'],'raw':!![]})[_0xb8b2('0x9')](function(_0x3590c8){_0x570c5d['setDataValue']('Users',_0x3590c8[_0xb8b2('0xa')](function(_0x1c8046){return{'id':_0x1c8046['id']};}));return WhatsappMessage[_0xb8b2('0xb')]({'where':{'WhatsappInteractionId':_0x570c5d['id'],'direction':'in','read':![]},'raw':!![]});})[_0xb8b2('0x9')](function(_0x3542b6){_0x570c5d['setDataValue'](_0xb8b2('0xc'),_0x3542b6['length']);WhatsappInteractionEvents['emit'](_0x2928a7+':'+_0x570c5d['id'],_0x570c5d);WhatsappInteractionEvents[_0xb8b2('0xd')](_0x2928a7,_0x570c5d);_0xba7734(null);})[_0xb8b2('0xe')](_0xba7734(null));};}for(var e in events){if(events[_0xb8b2('0xf')](e)){var event=events[e];WhatsappInteraction[_0xb8b2('0x10')](e,emitEvent(event));}}module[_0xb8b2('0x11')]=WhatsappInteractionEvents; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.model.js b/server/api/whatsappInteraction/whatsappInteraction.model.js index 3ac9587..c29e3c8 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 _0x76d8=['YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./whatsappInteraction.attributes','exports','define','WhatsappInteraction','whatsapp_interactions','changed','closed','format'];(function(_0x2b8a4e,_0x5bad23){var _0x28cb72=function(_0x318e7e){while(--_0x318e7e){_0x2b8a4e['push'](_0x2b8a4e['shift']());}};_0x28cb72(++_0x5bad23);}(_0x76d8,0xbc));var _0x876d=function(_0x29bedf,_0x3e6957){_0x29bedf=_0x29bedf-0x0;var _0xa73d4b=_0x76d8[_0x29bedf];return _0xa73d4b;};'use strict';var _=require(_0x876d('0x0'));var util=require(_0x876d('0x1'));var logger=require(_0x876d('0x2'))(_0x876d('0x3'));var moment=require('moment');var BPromise=require(_0x876d('0x4'));var rp=require(_0x876d('0x5'));var fs=require('fs');var path=require(_0x876d('0x6'));var rimraf=require(_0x876d('0x7'));var config=require('../../config/environment');var attributes=require(_0x876d('0x8'));module[_0x876d('0x9')]=function(_0x306ff2,_0x3ae91f){return _0x306ff2[_0x876d('0xa')](_0x876d('0xb'),attributes,{'tableName':_0x876d('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3e3942,_0x1e8bf5,_0x17b685){if(_0x3e3942[_0x876d('0xd')](_0x876d('0xe'))){_0x3e3942['closedAt']=moment()[_0x876d('0xf')](_0x876d('0x10'));}_0x17b685(null,_0x3e3942);}}});}; \ No newline at end of file +var _0x1f92=['../../config/environment','./whatsappInteraction.attributes','exports','define','WhatsappInteraction','whatsapp_interactions','changed','closed','YYYY-MM-DD\x20HH:mm:ss','lodash','../../config/logger','api','request-promise','path','rimraf'];(function(_0x546a8a,_0x178ab4){var _0x33d008=function(_0x3c7227){while(--_0x3c7227){_0x546a8a['push'](_0x546a8a['shift']());}};_0x33d008(++_0x178ab4);}(_0x1f92,0x1ad));var _0x21f9=function(_0x2bf893,_0x4cd1b2){_0x2bf893=_0x2bf893-0x0;var _0x47daf7=_0x1f92[_0x2bf893];return _0x47daf7;};'use strict';var _=require(_0x21f9('0x0'));var util=require('util');var logger=require(_0x21f9('0x1'))(_0x21f9('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x21f9('0x3'));var fs=require('fs');var path=require(_0x21f9('0x4'));var rimraf=require(_0x21f9('0x5'));var config=require(_0x21f9('0x6'));var attributes=require(_0x21f9('0x7'));module[_0x21f9('0x8')]=function(_0x259f4e,_0x3be0f2){return _0x259f4e[_0x21f9('0x9')](_0x21f9('0xa'),attributes,{'tableName':_0x21f9('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x261881,_0x4abee7,_0x43d2ab){if(_0x261881[_0x21f9('0xc')](_0x21f9('0xd'))){_0x261881['closedAt']=moment()['format'](_0x21f9('0xe'));}_0x43d2ab(null,_0x261881);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index 0105140..095772a 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 _0x8574=['update','body','options','raw','then','AddTagsToWhatsappInteraction','WhatsappInteraction','find','addTags','ids','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','client','http','redis','localhost','socket.io-emitter','./whatsappInteraction.socket','register','request','info','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','UpdateWhatsappInteraction'];(function(_0x393b45,_0xca6983){var _0x50e652=function(_0xba738b){while(--_0xba738b){_0x393b45['push'](_0x393b45['shift']());}};_0x50e652(++_0xca6983);}(_0x8574,0xfd));var _0x4857=function(_0x271191,_0x3486bf){_0x271191=_0x271191-0x0;var _0x2765db=_0x8574[_0x271191];return _0x2765db;};'use strict';var _=require(_0x4857('0x0'));var util=require(_0x4857('0x1'));var moment=require(_0x4857('0x2'));var BPromise=require(_0x4857('0x3'));var rs=require(_0x4857('0x4'));var fs=require('fs');var Redis=require(_0x4857('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x4857('0x6'));var logger=require(_0x4857('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x4857('0x8')][_0x4857('0x9')]({'port':0x232a});config[_0x4857('0xa')]=_['defaults'](config[_0x4857('0xa')],{'host':_0x4857('0xb'),'port':0x18eb});var socket=require(_0x4857('0xc'))(new Redis(config[_0x4857('0xa')]));require(_0x4857('0xd'))[_0x4857('0xe')](socket);function respondWithRpcPromise(_0x429c46,_0xd8face,_0x28c836){return new BPromise(function(_0x2bd6ed,_0x4db0a6){return client[_0x4857('0xf')](_0x429c46,_0x28c836)['then'](function(_0x152ac4){logger[_0x4857('0x10')](_0x4857('0x11'),_0xd8face,_0x4857('0x12'));logger[_0x4857('0x13')](_0x4857('0x14'),_0xd8face,_0x4857('0x12'),JSON[_0x4857('0x15')](_0x152ac4));if(_0x152ac4[_0x4857('0x16')]){if(_0x152ac4[_0x4857('0x16')][_0x4857('0x17')]===0x1f4){logger[_0x4857('0x16')]('WhatsappInteraction,\x20%s,\x20%s',_0xd8face,_0x152ac4['error'][_0x4857('0x18')]);return _0x4db0a6(_0x152ac4[_0x4857('0x16')]['message']);}logger['error'](_0x4857('0x11'),_0xd8face,_0x152ac4[_0x4857('0x16')][_0x4857('0x18')]);return _0x2bd6ed(_0x152ac4[_0x4857('0x16')][_0x4857('0x18')]);}else{logger[_0x4857('0x10')](_0x4857('0x11'),_0xd8face,_0x4857('0x12'));_0x2bd6ed(_0x152ac4['result'][_0x4857('0x18')]);}})[_0x4857('0x19')](function(_0x3d83eb){logger[_0x4857('0x16')](_0x4857('0x11'),_0xd8face,_0x3d83eb);_0x4db0a6(_0x3d83eb);});});}exports[_0x4857('0x1a')]=function(_0x36a7af){var _0x5ce267=this;return new Promise(function(_0xcf5957,_0x2dfaf9){return db['WhatsappInteraction'][_0x4857('0x1b')](_0x36a7af[_0x4857('0x1c')],{'raw':_0x36a7af['options']?_0x36a7af[_0x4857('0x1d')][_0x4857('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x36a7af['options']?_0x36a7af[_0x4857('0x1d')]['where']||null:null,'attributes':_0x36a7af[_0x4857('0x1d')]?_0x36a7af[_0x4857('0x1d')]['attributes']||null:null,'limit':_0x36a7af[_0x4857('0x1d')]?_0x36a7af[_0x4857('0x1d')]['limit']||null:null})[_0x4857('0x1f')](function(_0x2403d1){logger[_0x4857('0x10')](_0x4857('0x1a'),_0x36a7af);logger[_0x4857('0x13')](_0x4857('0x1a'),_0x36a7af,JSON[_0x4857('0x15')](_0x2403d1));_0xcf5957(_0x2403d1);})[_0x4857('0x19')](function(_0xbb0887){logger['error'](_0x4857('0x1a'),_0xbb0887['message'],_0x36a7af);_0x2dfaf9(_0x5ce267[_0x4857('0x16')](0x1f4,_0xbb0887[_0x4857('0x18')]));});});};exports[_0x4857('0x20')]=function(_0x23e2a0){return new Promise(function(_0xecbc3,_0x5d3824){return db[_0x4857('0x21')][_0x4857('0x22')]({'where':_0x23e2a0['options']?_0x23e2a0[_0x4857('0x1d')]['where']||null:null})['then'](function(_0x17b8a2){if(_0x17b8a2){return _0x17b8a2[_0x4857('0x23')](_0x23e2a0[_0x4857('0x1c')][_0x4857('0x24')],_[_0x4857('0x25')](_0x23e2a0['body'],['ids','id'])||{});}})[_0x4857('0x26')](function(_0x2b5915){logger[_0x4857('0x10')](_0x4857('0x27'),_0x23e2a0);logger[_0x4857('0x13')](_0x4857('0x27'),_0x23e2a0,JSON[_0x4857('0x15')](_0x2b5915));_0xecbc3(_0x2b5915);})[_0x4857('0x19')](function(_0x2a2a1c){logger[_0x4857('0x16')](_0x4857('0x27'),_0x2a2a1c['message'],_0x23e2a0);_0x5d3824(_this['error'](0x1f4,_0x2a2a1c[_0x4857('0x18')]));});});}; \ No newline at end of file +var _0x6603=['register','request','then','info','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','WhatsappInteraction,\x20%s,\x20%s','message','result','UpdateWhatsappInteraction','WhatsappInteraction','update','body','options','where','attributes','limit','stringify','find','addTags','ids','spread','AddTags','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','redis','defaults','localhost','./whatsappInteraction.socket'];(function(_0x2451ae,_0x2ff3a4){var _0x5d6db9=function(_0x1b0200){while(--_0x1b0200){_0x2451ae['push'](_0x2451ae['shift']());}};_0x5d6db9(++_0x2ff3a4);}(_0x6603,0x6a));var _0x3660=function(_0x512b62,_0x14df68){_0x512b62=_0x512b62-0x0;var _0x18b39e=_0x6603[_0x512b62];return _0x18b39e;};'use strict';var _=require('lodash');var util=require(_0x3660('0x0'));var moment=require(_0x3660('0x1'));var BPromise=require('bluebird');var rs=require(_0x3660('0x2'));var fs=require('fs');var Redis=require(_0x3660('0x3'));var db=require(_0x3660('0x4'))['db'];var utils=require(_0x3660('0x5'));var logger=require(_0x3660('0x6'))(_0x3660('0x7'));var config=require('../../config/environment');var jayson=require(_0x3660('0x8'));var client=jayson['client'][_0x3660('0x9')]({'port':0x232a});config[_0x3660('0xa')]=_[_0x3660('0xb')](config['redis'],{'host':_0x3660('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3660('0xa')]));require(_0x3660('0xd'))[_0x3660('0xe')](socket);function respondWithRpcPromise(_0x4abc4d,_0x335571,_0x2b15c9){return new BPromise(function(_0x12d1f1,_0x495252){return client[_0x3660('0xf')](_0x4abc4d,_0x2b15c9)[_0x3660('0x10')](function(_0x54730c){logger[_0x3660('0x11')]('WhatsappInteraction,\x20%s,\x20%s',_0x335571,'request\x20sent');logger[_0x3660('0x12')](_0x3660('0x13'),_0x335571,_0x3660('0x14'),JSON['stringify'](_0x54730c));if(_0x54730c['error']){if(_0x54730c[_0x3660('0x15')][_0x3660('0x16')]===0x1f4){logger[_0x3660('0x15')](_0x3660('0x17'),_0x335571,_0x54730c[_0x3660('0x15')][_0x3660('0x18')]);return _0x495252(_0x54730c[_0x3660('0x15')][_0x3660('0x18')]);}logger[_0x3660('0x15')]('WhatsappInteraction,\x20%s,\x20%s',_0x335571,_0x54730c[_0x3660('0x15')]['message']);return _0x12d1f1(_0x54730c[_0x3660('0x15')][_0x3660('0x18')]);}else{logger[_0x3660('0x11')](_0x3660('0x17'),_0x335571,'request\x20sent');_0x12d1f1(_0x54730c[_0x3660('0x19')][_0x3660('0x18')]);}})['catch'](function(_0x40b148){logger[_0x3660('0x15')]('WhatsappInteraction,\x20%s,\x20%s',_0x335571,_0x40b148);_0x495252(_0x40b148);});});}exports[_0x3660('0x1a')]=function(_0x570c0b){var _0x13bdc4=this;return new Promise(function(_0x370375,_0x5d0e99){return db[_0x3660('0x1b')][_0x3660('0x1c')](_0x570c0b[_0x3660('0x1d')],{'raw':_0x570c0b[_0x3660('0x1e')]?_0x570c0b[_0x3660('0x1e')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x570c0b[_0x3660('0x1e')]?_0x570c0b[_0x3660('0x1e')][_0x3660('0x1f')]||null:null,'attributes':_0x570c0b[_0x3660('0x1e')]?_0x570c0b[_0x3660('0x1e')][_0x3660('0x20')]||null:null,'limit':_0x570c0b[_0x3660('0x1e')]?_0x570c0b[_0x3660('0x1e')][_0x3660('0x21')]||null:null})[_0x3660('0x10')](function(_0x337ce6){logger['info'](_0x3660('0x1a'),_0x570c0b);logger[_0x3660('0x12')](_0x3660('0x1a'),_0x570c0b,JSON[_0x3660('0x22')](_0x337ce6));_0x370375(_0x337ce6);})['catch'](function(_0x2bcd28){logger[_0x3660('0x15')]('UpdateWhatsappInteraction',_0x2bcd28['message'],_0x570c0b);_0x5d0e99(_0x13bdc4[_0x3660('0x15')](0x1f4,_0x2bcd28[_0x3660('0x18')]));});});};exports['AddTagsToWhatsappInteraction']=function(_0x9d5eb0){return new Promise(function(_0x581cce,_0x3cca4d){return db[_0x3660('0x1b')][_0x3660('0x23')]({'where':_0x9d5eb0[_0x3660('0x1e')]?_0x9d5eb0[_0x3660('0x1e')][_0x3660('0x1f')]||null:null})[_0x3660('0x10')](function(_0x343eb6){if(_0x343eb6){return _0x343eb6[_0x3660('0x24')](_0x9d5eb0[_0x3660('0x1d')]['ids'],_['omit'](_0x9d5eb0[_0x3660('0x1d')],[_0x3660('0x25'),'id'])||{});}})[_0x3660('0x26')](function(_0x2e7d8e){logger['info']('AddTags',_0x9d5eb0);logger[_0x3660('0x12')](_0x3660('0x27'),_0x9d5eb0,JSON['stringify'](_0x2e7d8e));_0x581cce(_0x2e7d8e);})['catch'](function(_0x326c45){logger[_0x3660('0x15')](_0x3660('0x27'),_0x326c45['message'],_0x9d5eb0);_0x3cca4d(_this[_0x3660('0x15')](0x1f4,_0x326c45[_0x3660('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index 30bdd51..34ff2db 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 _0xbe40=['save','remove','update','emit','removeListener','length'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xbe40,0xea));var _0x0be4=function(_0x251624,_0xff4d0b){_0x251624=_0x251624-0x0;var _0x59a3a4=_0xbe40[_0x251624];return _0x59a3a4;};'use strict';var WhatsappInteractionEvents=require('./whatsappInteraction.events');var events=[_0x0be4('0x0'),_0x0be4('0x1'),_0x0be4('0x2')];function createListener(_0x4e33b3,_0x3e89ea){return function(_0x5aa2d6){_0x3e89ea[_0x0be4('0x3')](_0x4e33b3,_0x5aa2d6);};}function removeListener(_0x4a9ad0,_0xddacca){return function(){WhatsappInteractionEvents[_0x0be4('0x4')](_0x4a9ad0,_0xddacca);};}exports['register']=function(_0x49a765){for(var _0x4dcdd2=0x0,_0x35efb6=events[_0x0be4('0x5')];_0x4dcdd2<_0x35efb6;_0x4dcdd2++){var _0x36db5a=events[_0x4dcdd2];var _0x16eff5=createListener('whatsappInteraction:'+_0x36db5a,_0x49a765);WhatsappInteractionEvents['on'](_0x36db5a,_0x16eff5);}}; \ No newline at end of file +var _0xc3f7=['emit','removeListener','register','whatsappInteraction:','remove','update'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xc3f7,0x1c6));var _0x7c3f=function(_0x4d4a75,_0x513936){_0x4d4a75=_0x4d4a75-0x0;var _0x28a512=_0xc3f7[_0x4d4a75];return _0x28a512;};'use strict';var WhatsappInteractionEvents=require('./whatsappInteraction.events');var events=['save',_0x7c3f('0x0'),_0x7c3f('0x1')];function createListener(_0x436621,_0x49dfe0){return function(_0x3fccaf){_0x49dfe0[_0x7c3f('0x2')](_0x436621,_0x3fccaf);};}function removeListener(_0x3c8039,_0xfb6553){return function(){WhatsappInteractionEvents[_0x7c3f('0x3')](_0x3c8039,_0xfb6553);};}exports[_0x7c3f('0x4')]=function(_0x2b7e35){for(var _0x79f8c=0x0,_0xb45014=events['length'];_0x79f8c<_0xb45014;_0x79f8c++){var _0x47330b=events[_0x79f8c];var _0x32854d=createListener(_0x7c3f('0x5')+_0x47330b,_0x2b7e35);WhatsappInteractionEvents['on'](_0x47330b,_0x32854d);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index b0932d1..81ae51f 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 _0x5492=['fs-extra','../../components/interaction/service','get','isAuthenticated','index','describe','/:id','post','tracked','whatsapp','create','status','put','update','/:id/accept','reject','destroy','multer','path','connect-timeout','express','Router'];(function(_0x22ffd9,_0x3a7b97){var _0x4f6586=function(_0x125b50){while(--_0x125b50){_0x22ffd9['push'](_0x22ffd9['shift']());}};_0x4f6586(++_0x3a7b97);}(_0x5492,0xab));var _0x2549=function(_0x2b7dcf,_0x4f9a4f){_0x2b7dcf=_0x2b7dcf-0x0;var _0x448baf=_0x5492[_0x2b7dcf];return _0x448baf;};'use strict';var multer=require(_0x2549('0x0'));var util=require('util');var path=require(_0x2549('0x1'));var timeout=require(_0x2549('0x2'));var express=require(_0x2549('0x3'));var router=express[_0x2549('0x4')]();var fs_extra=require(_0x2549('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x2549('0x6'));var config=require('../../config/environment');var controller=require('./whatsappMessage.controller');router[_0x2549('0x7')]('/',auth[_0x2549('0x8')](),controller[_0x2549('0x9')]);router[_0x2549('0x7')]('/describe',auth[_0x2549('0x8')](),controller[_0x2549('0xa')]);router[_0x2549('0x7')](_0x2549('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x2549('0xc')]('/',auth[_0x2549('0x8')](),interaction[_0x2549('0xd')](_0x2549('0xe'),'whatsappmessage:create'),controller[_0x2549('0xf')]);router[_0x2549('0xc')]('/:id/status',controller[_0x2549('0x10')]);router[_0x2549('0x11')](_0x2549('0xb'),auth['isAuthenticated'](),controller[_0x2549('0x12')]);router[_0x2549('0x11')](_0x2549('0x13'),auth['isAuthenticated'](),controller['accept']);router['put']('/:id/reject',auth[_0x2549('0x8')](),controller[_0x2549('0x14')]);router['delete'](_0x2549('0xb'),auth[_0x2549('0x8')](),controller[_0x2549('0x15')]);module['exports']=router; \ No newline at end of file +var _0x46ce=['put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','whatsapp','create','post','/:id/status','status'];(function(_0x1b1dca,_0x3abce4){var _0x43bec8=function(_0x53995f){while(--_0x53995f){_0x1b1dca['push'](_0x1b1dca['shift']());}};_0x43bec8(++_0x3abce4);}(_0x46ce,0x1da));var _0xe46c=function(_0x4328fd,_0x5da64a){_0x4328fd=_0x4328fd-0x0;var _0x3fdaa7=_0x46ce[_0x4328fd];return _0x3fdaa7;};'use strict';var multer=require(_0xe46c('0x0'));var util=require(_0xe46c('0x1'));var path=require(_0xe46c('0x2'));var timeout=require(_0xe46c('0x3'));var express=require(_0xe46c('0x4'));var router=express[_0xe46c('0x5')]();var fs_extra=require(_0xe46c('0x6'));var auth=require(_0xe46c('0x7'));var interaction=require(_0xe46c('0x8'));var config=require(_0xe46c('0x9'));var controller=require('./whatsappMessage.controller');router[_0xe46c('0xa')]('/',auth[_0xe46c('0xb')](),controller[_0xe46c('0xc')]);router[_0xe46c('0xa')](_0xe46c('0xd'),auth['isAuthenticated'](),controller[_0xe46c('0xe')]);router['get'](_0xe46c('0xf'),auth['isAuthenticated'](),controller[_0xe46c('0x10')]);router['post']('/',auth[_0xe46c('0xb')](),interaction['tracked'](_0xe46c('0x11'),'whatsappmessage:create'),controller[_0xe46c('0x12')]);router[_0xe46c('0x13')](_0xe46c('0x14'),controller[_0xe46c('0x15')]);router[_0xe46c('0x16')]('/:id',auth[_0xe46c('0xb')](),controller[_0xe46c('0x17')]);router['put'](_0xe46c('0x18'),auth['isAuthenticated'](),controller[_0xe46c('0x19')]);router['put'](_0xe46c('0x1a'),auth[_0xe46c('0xb')](),controller[_0xe46c('0x1b')]);router[_0xe46c('0x1c')](_0xe46c('0xf'),auth[_0xe46c('0xb')](),controller[_0xe46c('0x1d')]);module[_0xe46c('0x1e')]=router; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.attributes.js b/server/api/whatsappMessage/whatsappMessage.attributes.js index 97df5fc..abfcc7e 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 _0x064e=['STRING','DATE','BOOLEAN','sequelize','exports','TEXT','medium','ENUM','out'];(function(_0x3fcd6a,_0xa644a2){var _0x41996c=function(_0x35e404){while(--_0x35e404){_0x3fcd6a['push'](_0x3fcd6a['shift']());}};_0x41996c(++_0xa644a2);}(_0x064e,0xd2));var _0xe064=function(_0x2d3c54,_0x3692ce){_0x2d3c54=_0x2d3c54-0x0;var _0xbe006=_0x064e[_0x2d3c54];return _0xbe006;};'use strict';var Sequelize=require(_0xe064('0x0'));module[_0xe064('0x1')]={'body':{'type':Sequelize[_0xe064('0x2')](_0xe064('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0xe064('0x4')]('in',_0xe064('0x5')),'defaultValue':_0xe064('0x5'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize[_0xe064('0x6')]},'readAt':{'type':Sequelize[_0xe064('0x7')]},'secret':{'type':Sequelize[_0xe064('0x8')],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0xe064('0x2')]}}; \ No newline at end of file +var _0x7248=['BOOLEAN','ENUM','out','STRING','DATE','TEXT','sequelize','exports','medium'];(function(_0x586064,_0x1ef061){var _0x3a48c4=function(_0x4c37bb){while(--_0x4c37bb){_0x586064['push'](_0x586064['shift']());}};_0x3a48c4(++_0x1ef061);}(_0x7248,0x1b6));var _0x8724=function(_0x3dd0b9,_0x1d6c92){_0x3dd0b9=_0x3dd0b9-0x0;var _0x4c0351=_0x7248[_0x3dd0b9];return _0x4c0351;};'use strict';var Sequelize=require(_0x8724('0x0'));module[_0x8724('0x1')]={'body':{'type':Sequelize['TEXT'](_0x8724('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x8724('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x8724('0x4')]('in',_0x8724('0x5')),'defaultValue':_0x8724('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0x8724('0x6')](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize[_0x8724('0x7')]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'providerName':{'type':Sequelize[_0x8724('0x6')]},'providerResponse':{'type':Sequelize[_0x8724('0x8')]}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.controller.js b/server/api/whatsappMessage/whatsappMessage.controller.js index 7714ee4..027fe92 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 _0xa03d=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappMessage.socket','jayson/promise','client','http','request','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','destroy','stack','name','send','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','WhatsappMessage','includeAll','findAll','params','keys','include','create','body','update','find','describe','whatsapp-interactions','accept','whatsapp','read','readAt','format','UserId','user','get','WhatsappInteractionId','isNil','read1stAt','YYYY-MM-DD\x20HH:mm:ss','interaction','role','null','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','agent','fullname','email','internal','manual','interface','SIP/%s','channel','motionChannel','EventManager','acceptmessage','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','event','rejectmessage','WhatsappAccount','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','messageId','MessageStatus','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xa03d,0x79));var _0xda03=function(_0x39c4d8,_0x5b71d3){_0x39c4d8=_0x39c4d8-0x0;var _0x262245=_0xa03d[_0x39c4d8];return _0x262245;};'use strict';var emlformat=require(_0xda03('0x0'));var rimraf=require(_0xda03('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xda03('0x2'));var rp=require(_0xda03('0x3'));var moment=require(_0xda03('0x4'));var BPromise=require(_0xda03('0x5'));var Mustache=require('mustache');var util=require(_0xda03('0x6'));var path=require(_0xda03('0x7'));var sox=require(_0xda03('0x8'));var csv=require(_0xda03('0x9'));var ejs=require(_0xda03('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xda03('0xb'));var squel=require('squel');var crypto=require(_0xda03('0xc'));var jsforce=require(_0xda03('0xd'));var deskjs=require(_0xda03('0xe'));var toCsv=require(_0xda03('0x9'));var querystring=require(_0xda03('0xf'));var Papa=require(_0xda03('0x10'));var Redis=require('ioredis');var authService=require(_0xda03('0x11'));var qs=require(_0xda03('0x12'));var as=require(_0xda03('0x13'));var hardwareService=require(_0xda03('0x14'));var logger=require('../../config/logger')(_0xda03('0x15'));var utils=require(_0xda03('0x16'));var config=require(_0xda03('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xda03('0x18'))['db'];config[_0xda03('0x19')]=_[_0xda03('0x1a')](config['redis'],{'host':_0xda03('0x1b'),'port':0x18eb});var socket=require(_0xda03('0x1c'))(new Redis(config['redis']));require(_0xda03('0x1d'))['register'](socket);var jayson=require(_0xda03('0x1e'));var client=jayson[_0xda03('0x1f')]['http']({'port':0x232c});var client9002=jayson[_0xda03('0x1f')][_0xda03('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x324c94,_0x682cf6,_0x36079a,_0x4c7fbf){return new BPromise(function(_0x3ff167,_0x4fac46){var _0x42ddfe=_0x4c7fbf||client;return _0x42ddfe[_0xda03('0x21')](_0x324c94,_0x36079a)[_0xda03('0x22')](function(_0x10852d){logger[_0xda03('0x23')](_0xda03('0x24'),_0x682cf6,_0xda03('0x25'));logger[_0xda03('0x26')](_0xda03('0x27'),_0x682cf6,_0xda03('0x25'),JSON['stringify'](_0x10852d));if(_0x10852d[_0xda03('0x28')]){if(_0x10852d[_0xda03('0x28')][_0xda03('0x29')]===0x1f4){logger[_0xda03('0x28')](_0xda03('0x24'),_0x682cf6,_0x10852d[_0xda03('0x28')][_0xda03('0x2a')]);return _0x4fac46(_0x10852d[_0xda03('0x28')][_0xda03('0x2a')]);}logger[_0xda03('0x28')](_0xda03('0x24'),_0x682cf6,_0x10852d['error'][_0xda03('0x2a')]);return _0x3ff167(_0x10852d[_0xda03('0x28')][_0xda03('0x2a')]);}else{logger[_0xda03('0x23')]('WhatsappMessage,\x20%s,\x20%s',_0x682cf6,_0xda03('0x25'));_0x3ff167(_0x10852d[_0xda03('0x2b')][_0xda03('0x2a')]);}})[_0xda03('0x2c')](function(_0x350465){logger[_0xda03('0x28')](_0xda03('0x24'),_0x682cf6,_0x350465);_0x4fac46(_0x350465);});});}function respondWithStatusCode(_0x45c784,_0x5333d6){_0x5333d6=_0x5333d6||0xcc;return function(_0x38d673){if(_0x38d673){return _0x45c784[_0xda03('0x2d')](_0x5333d6);}return _0x45c784[_0xda03('0x2e')](_0x5333d6)[_0xda03('0x2f')]();};}function respondWithResult(_0x374a3b,_0xef715e){_0xef715e=_0xef715e||0xc8;return function(_0x50115e){if(_0x50115e){return _0x374a3b[_0xda03('0x2e')](_0xef715e)[_0xda03('0x30')](_0x50115e);}};}function respondWithFilteredResult(_0xd33d,_0x35a86f){return function(_0x4f82d0){if(_0x4f82d0){var _0x3b24b5=typeof _0x35a86f[_0xda03('0x31')]==='undefined'&&typeof _0x35a86f['limit']===_0xda03('0x32');var _0x52558=_0x4f82d0[_0xda03('0x33')];var _0x4f334b=_0x3b24b5?0x0:_0x35a86f['offset'];var _0x3b0c23=_0x3b24b5?_0x4f82d0[_0xda03('0x33')]:_0x35a86f[_0xda03('0x31')]+_0x35a86f[_0xda03('0x34')];var _0x3e0f93;if(_0x3b0c23>=_0x52558){_0x3b0c23=_0x52558;_0x3e0f93=0xc8;}else{_0x3e0f93=0xce;}_0xd33d[_0xda03('0x2e')](_0x3e0f93);return _0xd33d[_0xda03('0x35')](_0xda03('0x36'),_0x4f334b+'-'+_0x3b0c23+'/'+_0x52558)[_0xda03('0x30')](_0x4f82d0);}return null;};}function patchUpdates(_0x232bc2){return function(_0x44f1e6){try{jsonpatch[_0xda03('0x37')](_0x44f1e6,_0x232bc2,!![]);}catch(_0x209bd7){return BPromise[_0xda03('0x38')](_0x209bd7);}return _0x44f1e6['save']();};}function saveUpdates(_0x5dcd78,_0xf0f098){return function(_0x59cc7f){if(_0x59cc7f){return _0x59cc7f['update'](_0x5dcd78)[_0xda03('0x22')](function(_0x4235be){return _0x4235be;});}return null;};}function removeEntity(_0x3e5ca7,_0xe108d6){return function(_0x239939){if(_0x239939){return _0x239939[_0xda03('0x39')]()[_0xda03('0x22')](function(){_0x3e5ca7[_0xda03('0x2e')](0xcc)[_0xda03('0x2f')]();});}};}function handleEntityNotFound(_0x539514,_0x10a395){return function(_0x2afb3b){if(!_0x2afb3b){_0x539514[_0xda03('0x2d')](0x194);}return _0x2afb3b;};}function handleError(_0x1c7754,_0x43d7b6){_0x43d7b6=_0x43d7b6||0x1f4;return function(_0x50f619){logger[_0xda03('0x28')](_0x50f619[_0xda03('0x3a')]);if(_0x50f619[_0xda03('0x3b')]){delete _0x50f619[_0xda03('0x3b')];}_0x1c7754[_0xda03('0x2e')](_0x43d7b6)[_0xda03('0x3c')](_0x50f619);};}exports['index']=function(_0x474897,_0x1f89f1){var _0x1a5fbe={},_0x376857={},_0x332191={'count':0x0,'rows':[]};var _0x2d50b3=_['map'](db['WhatsappMessage'][_0xda03('0x3d')],function(_0x3023e2){return{'name':_0x3023e2[_0xda03('0x3e')],'type':_0x3023e2[_0xda03('0x3f')][_0xda03('0x40')]};});_0x376857[_0xda03('0x41')]=_[_0xda03('0x42')](_0x2d50b3,_0xda03('0x3b'));_0x376857[_0xda03('0x43')]=_['keys'](_0x474897['query']);_0x376857[_0xda03('0x44')]=_[_0xda03('0x45')](_0x376857[_0xda03('0x41')],_0x376857['query']);_0x1a5fbe[_0xda03('0x46')]=_[_0xda03('0x45')](_0x376857[_0xda03('0x41')],qs['fields'](_0x474897[_0xda03('0x43')][_0xda03('0x47')]));_0x1a5fbe[_0xda03('0x46')]=_0x1a5fbe[_0xda03('0x46')][_0xda03('0x48')]?_0x1a5fbe[_0xda03('0x46')]:_0x376857[_0xda03('0x41')];if(!_0x474897['query'][_0xda03('0x49')](_0xda03('0x4a'))){_0x1a5fbe[_0xda03('0x34')]=qs['limit'](_0x474897[_0xda03('0x43')][_0xda03('0x34')]);_0x1a5fbe[_0xda03('0x31')]=qs[_0xda03('0x31')](_0x474897[_0xda03('0x43')][_0xda03('0x31')]);}_0x1a5fbe[_0xda03('0x4b')]=qs[_0xda03('0x4c')](_0x474897['query'][_0xda03('0x4c')]);_0x1a5fbe[_0xda03('0x4d')]=qs[_0xda03('0x44')](_[_0xda03('0x4e')](_0x474897[_0xda03('0x43')],_0x376857['filters']),_0x2d50b3);if(_0x474897[_0xda03('0x43')][_0xda03('0x4f')]){_0x1a5fbe[_0xda03('0x4d')]=_[_0xda03('0x50')](_0x1a5fbe[_0xda03('0x4d')],{'$or':_[_0xda03('0x42')](_0x2d50b3,function(_0x59ae71){if(_0x59ae71[_0xda03('0x3f')]!=='VIRTUAL'){var _0x47103e={};_0x47103e[_0x59ae71['name']]={'$like':'%'+_0x474897[_0xda03('0x43')][_0xda03('0x4f')]+'%'};return _0x47103e;}})});}_0x1a5fbe=_[_0xda03('0x50')]({},_0x1a5fbe,_0x474897[_0xda03('0x51')]);var _0x409f3f={'where':_0x1a5fbe[_0xda03('0x4d')]};return db[_0xda03('0x52')][_0xda03('0x33')](_0x409f3f)[_0xda03('0x22')](function(_0x1606e4){_0x332191['count']=_0x1606e4;if(_0x474897['query'][_0xda03('0x53')]){_0x1a5fbe['include']=[{'all':!![]}];}return db[_0xda03('0x52')][_0xda03('0x54')](_0x1a5fbe);})[_0xda03('0x22')](function(_0x5ec23e){_0x332191['rows']=_0x5ec23e;return _0x332191;})[_0xda03('0x22')](respondWithFilteredResult(_0x1f89f1,_0x1a5fbe))['catch'](handleError(_0x1f89f1,null));};exports['show']=function(_0x4e5a57,_0x1b6ab2){var _0x5cd269={'raw':!![],'where':{'id':_0x4e5a57[_0xda03('0x55')]['id']}},_0x8926b5={};_0x8926b5[_0xda03('0x41')]=_[_0xda03('0x56')](db['WhatsappMessage']['rawAttributes']);_0x8926b5[_0xda03('0x43')]=_['keys'](_0x4e5a57[_0xda03('0x43')]);_0x8926b5[_0xda03('0x44')]=_[_0xda03('0x45')](_0x8926b5[_0xda03('0x41')],_0x8926b5[_0xda03('0x43')]);_0x5cd269[_0xda03('0x46')]=_[_0xda03('0x45')](_0x8926b5[_0xda03('0x41')],qs[_0xda03('0x47')](_0x4e5a57[_0xda03('0x43')][_0xda03('0x47')]));_0x5cd269[_0xda03('0x46')]=_0x5cd269[_0xda03('0x46')][_0xda03('0x48')]?_0x5cd269[_0xda03('0x46')]:_0x8926b5['model'];if(_0x4e5a57['query'][_0xda03('0x53')]){_0x5cd269[_0xda03('0x57')]=[{'all':!![]}];}_0x5cd269=_[_0xda03('0x50')]({},_0x5cd269,_0x4e5a57[_0xda03('0x51')]);return db[_0xda03('0x52')]['find'](_0x5cd269)['then'](handleEntityNotFound(_0x1b6ab2,null))[_0xda03('0x22')](respondWithResult(_0x1b6ab2,null))[_0xda03('0x2c')](handleError(_0x1b6ab2,null));};exports[_0xda03('0x58')]=function(_0x204905,_0x5aadde){return db[_0xda03('0x52')][_0xda03('0x58')](_0x204905[_0xda03('0x59')],{})['then'](respondWithResult(_0x5aadde,0xc9))[_0xda03('0x2c')](handleError(_0x5aadde,null));};exports[_0xda03('0x5a')]=function(_0x106f77,_0x228951){if(_0x106f77[_0xda03('0x59')]['id']){delete _0x106f77['body']['id'];}return db[_0xda03('0x52')][_0xda03('0x5b')]({'where':{'id':_0x106f77['params']['id']}})[_0xda03('0x22')](handleEntityNotFound(_0x228951,null))['then'](saveUpdates(_0x106f77[_0xda03('0x59')],null))[_0xda03('0x22')](respondWithResult(_0x228951,null))[_0xda03('0x2c')](handleError(_0x228951,null));};exports['destroy']=function(_0x5e8c4e,_0x4dda6a){return db[_0xda03('0x52')][_0xda03('0x5b')]({'where':{'id':_0x5e8c4e[_0xda03('0x55')]['id']}})[_0xda03('0x22')](handleEntityNotFound(_0x4dda6a,null))['then'](removeEntity(_0x4dda6a,null))[_0xda03('0x2c')](handleError(_0x4dda6a,null));};exports[_0xda03('0x5c')]=function(_0x4eeedb,_0xfda7f4){return db[_0xda03('0x52')]['describe']()['then'](respondWithResult(_0xfda7f4,null))['catch'](handleError(_0xfda7f4,null));};var interaction_log=require('../../config/logger')(_0xda03('0x5d'));exports[_0xda03('0x5e')]=function(_0x5e167a,_0x4a90f1,_0x5c5ef9){var _0x17d18d={'agent':{},'channel':_0xda03('0x5f')};if(_0x5e167a[_0xda03('0x59')]['id']){delete _0x5e167a[_0xda03('0x59')]['id'];}_0x5e167a[_0xda03('0x59')][_0xda03('0x60')]=!![];_0x5e167a[_0xda03('0x59')][_0xda03('0x61')]=moment()[_0xda03('0x62')]('YYYY-MM-DD\x20HH:mm:ss');_0x5e167a[_0xda03('0x59')]['UserId']=_0x5e167a[_0xda03('0x59')][_0xda03('0x63')]||_0x5e167a[_0xda03('0x64')]['id'];_0x17d18d['agent']['id']=_0x5e167a[_0xda03('0x59')][_0xda03('0x63')];return db[_0xda03('0x52')][_0xda03('0x5b')]({'where':{'id':_0x5e167a[_0xda03('0x55')]['id'],'UserId':null}})[_0xda03('0x22')](handleEntityNotFound(_0x4a90f1,null))[_0xda03('0x22')](saveUpdates(_0x5e167a[_0xda03('0x59')],null))[_0xda03('0x22')](function(_0x106ef0){if(_0x106ef0){_0x17d18d[_0xda03('0x2a')]=_0x106ef0[_0xda03('0x65')]({'plain':!![]});return db['WhatsappInteraction'][_0xda03('0x5b')]({'where':{'id':_0x106ef0[_0xda03('0x66')]}});}return null;})['then'](handleEntityNotFound(_0x4a90f1,null))[_0xda03('0x22')](function(_0x3e78df){if(_0x3e78df){return _0x3e78df[_0xda03('0x5a')]({'UserId':_0x5e167a[_0xda03('0x59')][_0xda03('0x63')],'read1stAt':_[_0xda03('0x67')](_0x3e78df[_0xda03('0x68')])?moment()[_0xda03('0x62')](_0xda03('0x69')):undefined});}return null;})[_0xda03('0x22')](function(_0x5dfa1a){if(_0x5dfa1a){_0x17d18d[_0xda03('0x6a')]=_0x5dfa1a[_0xda03('0x65')]({'plain':!![]});interaction_log[_0xda03('0x23')]('[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x5e167a[_0xda03('0x64')]['id'],_0x5e167a[_0xda03('0x64')]['name'],_0x5e167a[_0xda03('0x64')][_0xda03('0x6b')],_0x17d18d['interaction']['id'],_0x5e167a[_0xda03('0x59')]?JSON['stringify'](_0x5e167a[_0xda03('0x59')]):_0xda03('0x6c'));return respondWithRpcPromise(_0xda03('0x6d'),'acceptMessage',_0x17d18d);}return null;})['then'](function(_0x4e761d){var _0x47221e=_0xda03('0x6e')+_0x4e761d[_0xda03('0x2a')][_0xda03('0x6f')];return db[_0xda03('0x70')][_0xda03('0x43')](_0x47221e,{'type':db[_0xda03('0x71')][_0xda03('0x72')][_0xda03('0x73')],'raw':!![]})[_0xda03('0x22')](function(_0x108003){return _0x108003;});})[_0xda03('0x22')](function(_0x4cb514){if(_0x4cb514){_0x17d18d[_0xda03('0x2a')][_0xda03('0x74')]=_0x4cb514[0x0];if(!_0x5e167a[_0xda03('0x59')][_0xda03('0x63')])return;return db['User'][_0xda03('0x5b')]({'where':{'id':_0x5e167a[_0xda03('0x59')][_0xda03('0x63')],'role':_0xda03('0x75')},'attributes':['id',_0xda03('0x3b'),_0xda03('0x76'),_0xda03('0x77'),_0xda03('0x78')],'raw':!![]});}return null;})[_0xda03('0x22')](function(_0x4e3915){if(!_0x4e3915)return null;_0x17d18d[_0xda03('0x2a')][_0xda03('0x75')]=_0x4e3915;return _0x17d18d;})[_0xda03('0x22')](function(_0x2af1e4){if(_0x2af1e4){if(_0x5e167a[_0xda03('0x59')][_0xda03('0x79')]){_0x17d18d[_0xda03('0x2a')][_0xda03('0x7a')]=util['format'](_0xda03('0x7b'),_0x5e167a['user'][_0xda03('0x3b')]);_0x17d18d['message'][_0xda03('0x7c')]=_0x17d18d[_0xda03('0x7c')];_0x17d18d[_0xda03('0x2a')][_0xda03('0x7d')]=_0x17d18d[_0xda03('0x7c')];_0x17d18d[_0xda03('0x2a')]['event']=_0xda03('0x5e');return respondWithRpcPromise('EventManager',_0xda03('0x7e'),{'event':_0xda03('0x7f'),'message':_0x17d18d['message']},client9002)[_0xda03('0x22')](function(){return _0x17d18d;});}return _0x17d18d;}return null;})['then'](respondWithResult(_0x4a90f1,null))[_0xda03('0x2c')](handleError(_0x4a90f1,null));};var interaction_log=require('../../config/logger')('whatsapp-interactions');exports['reject']=function(_0x369787,_0x19536f,_0x511238){var _0x52cca5={'agent':{},'channel':_0xda03('0x5f')};if(_0x369787[_0xda03('0x59')]['id']){delete _0x369787[_0xda03('0x59')]['id'];}_0x369787['body'][_0xda03('0x63')]=_0x369787[_0xda03('0x59')][_0xda03('0x63')]||_0x369787[_0xda03('0x64')]['id'];_0x52cca5[_0xda03('0x75')]['id']=_0x369787[_0xda03('0x59')][_0xda03('0x63')];return db[_0xda03('0x52')]['find']({'where':{'id':_0x369787[_0xda03('0x55')]['id'],'UserId':null}})[_0xda03('0x22')](handleEntityNotFound(_0x19536f,null))[_0xda03('0x22')](function(_0xace867){if(_0xace867){_0x52cca5[_0xda03('0x2a')]=_0xace867['get']({'plain':!![]});return db['WhatsappInteraction'][_0xda03('0x5b')]({'where':{'id':_0xace867[_0xda03('0x66')]}});}return null;})[_0xda03('0x22')](handleEntityNotFound(_0x19536f,null))[_0xda03('0x22')](function(_0xd3642){if(_0xd3642){_0x52cca5[_0xda03('0x6a')]=_0xd3642['get']({'plain':!![]});interaction_log['info'](_0xda03('0x80'),_0x369787[_0xda03('0x64')]['id'],_0x369787[_0xda03('0x64')][_0xda03('0x3b')],_0x369787[_0xda03('0x64')]['role'],_0x52cca5[_0xda03('0x6a')]['id'],_0x369787[_0xda03('0x59')]?JSON['stringify'](_0x369787[_0xda03('0x59')]):_0xda03('0x6c'));return respondWithRpcPromise(_0xda03('0x81'),'rejectMessage',_0x52cca5);}return null;})[_0xda03('0x22')](function(_0x1a3d27){var _0x5be866=_0xda03('0x6e')+_0x1a3d27[_0xda03('0x2a')][_0xda03('0x6f')];return db[_0xda03('0x70')][_0xda03('0x43')](_0x5be866,{'type':db['Sequelize'][_0xda03('0x72')][_0xda03('0x73')],'raw':!![]})['then'](function(_0x1f9429){return _0x1f9429;});})[_0xda03('0x22')](function(_0x59bd80){if(_0x59bd80){_0x52cca5[_0xda03('0x2a')][_0xda03('0x74')]=_0x59bd80[0x0];if(!_0x369787['body'][_0xda03('0x63')])return;return db['User']['find']({'where':{'id':_0x369787[_0xda03('0x59')][_0xda03('0x63')],'role':'agent'},'attributes':['id',_0xda03('0x3b'),'fullname',_0xda03('0x77'),_0xda03('0x78')],'raw':!![]});}return null;})['then'](function(_0x47f752){if(!_0x47f752)return null;_0x52cca5[_0xda03('0x2a')][_0xda03('0x75')]=_0x47f752;return _0x52cca5;})[_0xda03('0x22')](function(_0x4d9369){if(_0x4d9369){_0x4d9369['message'][_0xda03('0x7a')]=util[_0xda03('0x62')](_0xda03('0x7b'),_0x369787['user'][_0xda03('0x3b')]);_0x4d9369['message'][_0xda03('0x7c')]=_0x52cca5[_0xda03('0x7c')];_0x4d9369[_0xda03('0x2a')][_0xda03('0x7d')]=_0x52cca5['channel'];_0x4d9369[_0xda03('0x2a')][_0xda03('0x82')]=_0xda03('0x38');respondWithRpcPromise('EventManager',_0xda03('0x7e'),{'event':_0xda03('0x83'),'message':_0x4d9369['message']},client9002);return _0x52cca5;}return null;})[_0xda03('0x22')](respondWithResult(_0x19536f,null))['catch'](handleError(_0x19536f,null));};exports['status']=function(_0xce66ef,_0x23131f,_0x54ed5e){if(_0xce66ef[_0xda03('0x59')]['id']){delete _0xce66ef['body']['id'];}var _0x51331a;return db[_0xda03('0x52')][_0xda03('0x5b')]({'where':{'id':_0xce66ef['params']['id']}})[_0xda03('0x22')](handleEntityNotFound(_0x23131f,null))[_0xda03('0x22')](function(_0x1f50df){if(_0x1f50df){_0x51331a=_0x1f50df;return db[_0xda03('0x84')][_0xda03('0x5b')]({'where':{'id':_0x1f50df['WhatsappAccountId']}});}})[_0xda03('0x22')](handleEntityNotFound(_0x23131f,null))[_0xda03('0x22')](function(_0x17c570){if(_0x17c570){logger['debug'](_0xda03('0x85'),_0xda03('0x2e'),_0xda03('0x86'),_0x17c570['type'],util[_0xda03('0x87')](_0xce66ef[_0xda03('0x59')],{'showHidden':![],'depth':null}));switch(_0x17c570[_0xda03('0x3f')]){case'twilio':if(_0xce66ef[_0xda03('0x59')]['MessageSid']&&_0xce66ef[_0xda03('0x59')]['MessageSid']===_0x51331a[_0xda03('0x88')]&&_0xce66ef[_0xda03('0x59')][_0xda03('0x89')]&&_0xce66ef['body']['MessageStatus']===_0xda03('0x60')){return _0x51331a[_0xda03('0x5a')]({'read':!![]});}else{logger['error']('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0xda03('0x2e'),'twilio',util[_0xda03('0x87')](_0xce66ef[_0xda03('0x59')],{'showHidden':![],'depth':null}));}break;}return _0x51331a;}})[_0xda03('0x22')](respondWithResult(_0x23131f,null))['catch'](handleError(_0x23131f,null));}; \ No newline at end of file +var _0xa24f=['acceptmessage','reject','WhatsappInteractionId','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','Sequelize','SELECT','User','internal','interface','event','WhatsappAccount','WhatsappAccountId','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','http','client','request','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','save','update','name','send','WhatsappMessage','rawAttributes','fieldName','key','model','map','query','keys','filters','attributes','intersection','length','hasOwnProperty','nolimit','sort','where','pick','merge','type','filter','options','includeAll','catch','show','params','fields','include','find','create','body','destroy','describe','../../config/logger','whatsapp-interactions','accept','whatsapp','read','format','YYYY-MM-DD\x20HH:mm:ss','UserId','agent','get','WhatsappInteraction','isNil','read1stAt','interaction','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','null','AcceptMessage','acceptMessage','ContactId','sequelize','QueryTypes','contact','fullname','email','SIP/%s','channel','motionChannel','EventManager'];(function(_0x4ccd32,_0x3b11c9){var _0x30b693=function(_0x1b816f){while(--_0x1b816f){_0x4ccd32['push'](_0x4ccd32['shift']());}};_0x30b693(++_0x3b11c9);}(_0xa24f,0x1cc));var _0xfa24=function(_0x4553e8,_0x480e3c){_0x4553e8=_0x4553e8-0x0;var _0x99e41=_0xa24f[_0x4553e8];return _0x99e41;};'use strict';var emlformat=require(_0xfa24('0x0'));var rimraf=require(_0xfa24('0x1'));var zipdir=require(_0xfa24('0x2'));var jsonpatch=require(_0xfa24('0x3'));var rp=require(_0xfa24('0x4'));var moment=require(_0xfa24('0x5'));var BPromise=require(_0xfa24('0x6'));var Mustache=require(_0xfa24('0x7'));var util=require(_0xfa24('0x8'));var path=require('path');var sox=require(_0xfa24('0x9'));var csv=require(_0xfa24('0xa'));var ejs=require(_0xfa24('0xb'));var fs=require('fs');var fs_extra=require(_0xfa24('0xc'));var _=require(_0xfa24('0xd'));var squel=require(_0xfa24('0xe'));var crypto=require(_0xfa24('0xf'));var jsforce=require('jsforce');var deskjs=require(_0xfa24('0x10'));var toCsv=require(_0xfa24('0xa'));var querystring=require(_0xfa24('0x11'));var Papa=require(_0xfa24('0x12'));var Redis=require(_0xfa24('0x13'));var authService=require(_0xfa24('0x14'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xfa24('0x15'));var logger=require('../../config/logger')(_0xfa24('0x16'));var utils=require(_0xfa24('0x17'));var config=require(_0xfa24('0x18'));var licenseUtil=require(_0xfa24('0x19'));var db=require(_0xfa24('0x1a'))['db'];config[_0xfa24('0x1b')]=_[_0xfa24('0x1c')](config[_0xfa24('0x1b')],{'host':_0xfa24('0x1d'),'port':0x18eb});var socket=require(_0xfa24('0x1e'))(new Redis(config[_0xfa24('0x1b')]));require('./whatsappMessage.socket')[_0xfa24('0x1f')](socket);var jayson=require(_0xfa24('0x20'));var client=jayson['client'][_0xfa24('0x21')]({'port':0x232c});var client9002=jayson[_0xfa24('0x22')][_0xfa24('0x21')]({'port':0x232a});function respondWithRpcPromise(_0x4141c7,_0xfb15ae,_0x40de67,_0x14db47){return new BPromise(function(_0x1ee827,_0x54e6f9){var _0x932a12=_0x14db47||client;return _0x932a12[_0xfa24('0x23')](_0x4141c7,_0x40de67)[_0xfa24('0x24')](function(_0x4f25c8){logger[_0xfa24('0x25')](_0xfa24('0x26'),_0xfb15ae,_0xfa24('0x27'));logger[_0xfa24('0x28')](_0xfa24('0x29'),_0xfb15ae,'request\x20sent',JSON[_0xfa24('0x2a')](_0x4f25c8));if(_0x4f25c8[_0xfa24('0x2b')]){if(_0x4f25c8[_0xfa24('0x2b')][_0xfa24('0x2c')]===0x1f4){logger[_0xfa24('0x2b')](_0xfa24('0x26'),_0xfb15ae,_0x4f25c8[_0xfa24('0x2b')][_0xfa24('0x2d')]);return _0x54e6f9(_0x4f25c8[_0xfa24('0x2b')]['message']);}logger[_0xfa24('0x2b')](_0xfa24('0x26'),_0xfb15ae,_0x4f25c8[_0xfa24('0x2b')][_0xfa24('0x2d')]);return _0x1ee827(_0x4f25c8[_0xfa24('0x2b')][_0xfa24('0x2d')]);}else{logger[_0xfa24('0x25')](_0xfa24('0x26'),_0xfb15ae,_0xfa24('0x27'));_0x1ee827(_0x4f25c8[_0xfa24('0x2e')]['message']);}})['catch'](function(_0xc82b23){logger[_0xfa24('0x2b')](_0xfa24('0x26'),_0xfb15ae,_0xc82b23);_0x54e6f9(_0xc82b23);});});}function respondWithStatusCode(_0x27fca5,_0x494533){_0x494533=_0x494533||0xcc;return function(_0x390403){if(_0x390403){return _0x27fca5[_0xfa24('0x2f')](_0x494533);}return _0x27fca5[_0xfa24('0x30')](_0x494533)[_0xfa24('0x31')]();};}function respondWithResult(_0x5f197a,_0x12e90d){_0x12e90d=_0x12e90d||0xc8;return function(_0x1a468d){if(_0x1a468d){return _0x5f197a[_0xfa24('0x30')](_0x12e90d)[_0xfa24('0x32')](_0x1a468d);}};}function respondWithFilteredResult(_0x561e69,_0x46c0cf){return function(_0x201330){if(_0x201330){var _0xda18e3=typeof _0x46c0cf[_0xfa24('0x33')]==='undefined'&&typeof _0x46c0cf[_0xfa24('0x34')]===_0xfa24('0x35');var _0x5bba66=_0x201330[_0xfa24('0x36')];var _0x203887=_0xda18e3?0x0:_0x46c0cf[_0xfa24('0x33')];var _0x2e9cac=_0xda18e3?_0x201330['count']:_0x46c0cf[_0xfa24('0x33')]+_0x46c0cf[_0xfa24('0x34')];var _0x5960c2;if(_0x2e9cac>=_0x5bba66){_0x2e9cac=_0x5bba66;_0x5960c2=0xc8;}else{_0x5960c2=0xce;}_0x561e69['status'](_0x5960c2);return _0x561e69[_0xfa24('0x37')](_0xfa24('0x38'),_0x203887+'-'+_0x2e9cac+'/'+_0x5bba66)['json'](_0x201330);}return null;};}function patchUpdates(_0x197fff){return function(_0x1a4df1){try{jsonpatch[_0xfa24('0x39')](_0x1a4df1,_0x197fff,!![]);}catch(_0x5124e1){return BPromise['reject'](_0x5124e1);}return _0x1a4df1[_0xfa24('0x3a')]();};}function saveUpdates(_0x1440c5,_0x4c6eee){return function(_0x6f95ce){if(_0x6f95ce){return _0x6f95ce[_0xfa24('0x3b')](_0x1440c5)[_0xfa24('0x24')](function(_0x17026e){return _0x17026e;});}return null;};}function removeEntity(_0x533693,_0x574507){return function(_0x14c3a6){if(_0x14c3a6){return _0x14c3a6['destroy']()['then'](function(){_0x533693[_0xfa24('0x30')](0xcc)[_0xfa24('0x31')]();});}};}function handleEntityNotFound(_0x57afaa,_0xae401e){return function(_0x97787){if(!_0x97787){_0x57afaa[_0xfa24('0x2f')](0x194);}return _0x97787;};}function handleError(_0x589432,_0x46b097){_0x46b097=_0x46b097||0x1f4;return function(_0x47cda7){logger[_0xfa24('0x2b')](_0x47cda7['stack']);if(_0x47cda7['name']){delete _0x47cda7[_0xfa24('0x3c')];}_0x589432[_0xfa24('0x30')](_0x46b097)[_0xfa24('0x3d')](_0x47cda7);};}exports['index']=function(_0x5a3f4b,_0x4880fd){var _0x2e6ffd={},_0x1d9370={},_0x386409={'count':0x0,'rows':[]};var _0x517a7a=_['map'](db[_0xfa24('0x3e')][_0xfa24('0x3f')],function(_0x4bd2e9){return{'name':_0x4bd2e9[_0xfa24('0x40')],'type':_0x4bd2e9['type'][_0xfa24('0x41')]};});_0x1d9370[_0xfa24('0x42')]=_[_0xfa24('0x43')](_0x517a7a,_0xfa24('0x3c'));_0x1d9370[_0xfa24('0x44')]=_[_0xfa24('0x45')](_0x5a3f4b['query']);_0x1d9370[_0xfa24('0x46')]=_['intersection'](_0x1d9370[_0xfa24('0x42')],_0x1d9370[_0xfa24('0x44')]);_0x2e6ffd[_0xfa24('0x47')]=_[_0xfa24('0x48')](_0x1d9370[_0xfa24('0x42')],qs['fields'](_0x5a3f4b[_0xfa24('0x44')]['fields']));_0x2e6ffd[_0xfa24('0x47')]=_0x2e6ffd[_0xfa24('0x47')][_0xfa24('0x49')]?_0x2e6ffd[_0xfa24('0x47')]:_0x1d9370['model'];if(!_0x5a3f4b['query'][_0xfa24('0x4a')](_0xfa24('0x4b'))){_0x2e6ffd[_0xfa24('0x34')]=qs[_0xfa24('0x34')](_0x5a3f4b[_0xfa24('0x44')][_0xfa24('0x34')]);_0x2e6ffd['offset']=qs[_0xfa24('0x33')](_0x5a3f4b[_0xfa24('0x44')]['offset']);}_0x2e6ffd['order']=qs[_0xfa24('0x4c')](_0x5a3f4b[_0xfa24('0x44')]['sort']);_0x2e6ffd[_0xfa24('0x4d')]=qs['filters'](_[_0xfa24('0x4e')](_0x5a3f4b[_0xfa24('0x44')],_0x1d9370[_0xfa24('0x46')]),_0x517a7a);if(_0x5a3f4b[_0xfa24('0x44')]['filter']){_0x2e6ffd[_0xfa24('0x4d')]=_[_0xfa24('0x4f')](_0x2e6ffd[_0xfa24('0x4d')],{'$or':_[_0xfa24('0x43')](_0x517a7a,function(_0x49eec0){if(_0x49eec0[_0xfa24('0x50')]!=='VIRTUAL'){var _0x7b91bf={};_0x7b91bf[_0x49eec0[_0xfa24('0x3c')]]={'$like':'%'+_0x5a3f4b[_0xfa24('0x44')][_0xfa24('0x51')]+'%'};return _0x7b91bf;}})});}_0x2e6ffd=_[_0xfa24('0x4f')]({},_0x2e6ffd,_0x5a3f4b[_0xfa24('0x52')]);var _0x44fbd0={'where':_0x2e6ffd[_0xfa24('0x4d')]};return db[_0xfa24('0x3e')][_0xfa24('0x36')](_0x44fbd0)[_0xfa24('0x24')](function(_0x5a36f3){_0x386409[_0xfa24('0x36')]=_0x5a36f3;if(_0x5a3f4b[_0xfa24('0x44')][_0xfa24('0x53')]){_0x2e6ffd['include']=[{'all':!![]}];}return db[_0xfa24('0x3e')]['findAll'](_0x2e6ffd);})[_0xfa24('0x24')](function(_0x4086ab){_0x386409['rows']=_0x4086ab;return _0x386409;})[_0xfa24('0x24')](respondWithFilteredResult(_0x4880fd,_0x2e6ffd))[_0xfa24('0x54')](handleError(_0x4880fd,null));};exports[_0xfa24('0x55')]=function(_0x3befc8,_0x541b2e){var _0x35d7f8={'raw':!![],'where':{'id':_0x3befc8[_0xfa24('0x56')]['id']}},_0x35c3e9={};_0x35c3e9[_0xfa24('0x42')]=_[_0xfa24('0x45')](db['WhatsappMessage']['rawAttributes']);_0x35c3e9[_0xfa24('0x44')]=_[_0xfa24('0x45')](_0x3befc8[_0xfa24('0x44')]);_0x35c3e9[_0xfa24('0x46')]=_['intersection'](_0x35c3e9[_0xfa24('0x42')],_0x35c3e9[_0xfa24('0x44')]);_0x35d7f8['attributes']=_['intersection'](_0x35c3e9[_0xfa24('0x42')],qs['fields'](_0x3befc8['query'][_0xfa24('0x57')]));_0x35d7f8[_0xfa24('0x47')]=_0x35d7f8[_0xfa24('0x47')][_0xfa24('0x49')]?_0x35d7f8[_0xfa24('0x47')]:_0x35c3e9['model'];if(_0x3befc8['query']['includeAll']){_0x35d7f8[_0xfa24('0x58')]=[{'all':!![]}];}_0x35d7f8=_[_0xfa24('0x4f')]({},_0x35d7f8,_0x3befc8[_0xfa24('0x52')]);return db[_0xfa24('0x3e')][_0xfa24('0x59')](_0x35d7f8)[_0xfa24('0x24')](handleEntityNotFound(_0x541b2e,null))[_0xfa24('0x24')](respondWithResult(_0x541b2e,null))[_0xfa24('0x54')](handleError(_0x541b2e,null));};exports[_0xfa24('0x5a')]=function(_0x43bfe5,_0x1a8d75){return db[_0xfa24('0x3e')]['create'](_0x43bfe5[_0xfa24('0x5b')],{})[_0xfa24('0x24')](respondWithResult(_0x1a8d75,0xc9))['catch'](handleError(_0x1a8d75,null));};exports['update']=function(_0x46fa51,_0x135fae){if(_0x46fa51[_0xfa24('0x5b')]['id']){delete _0x46fa51[_0xfa24('0x5b')]['id'];}return db[_0xfa24('0x3e')][_0xfa24('0x59')]({'where':{'id':_0x46fa51['params']['id']}})['then'](handleEntityNotFound(_0x135fae,null))[_0xfa24('0x24')](saveUpdates(_0x46fa51[_0xfa24('0x5b')],null))[_0xfa24('0x24')](respondWithResult(_0x135fae,null))[_0xfa24('0x54')](handleError(_0x135fae,null));};exports[_0xfa24('0x5c')]=function(_0x175b08,_0x49ea7b){return db[_0xfa24('0x3e')][_0xfa24('0x59')]({'where':{'id':_0x175b08['params']['id']}})[_0xfa24('0x24')](handleEntityNotFound(_0x49ea7b,null))[_0xfa24('0x24')](removeEntity(_0x49ea7b,null))['catch'](handleError(_0x49ea7b,null));};exports[_0xfa24('0x5d')]=function(_0x42b303,_0x203550){return db[_0xfa24('0x3e')]['describe']()[_0xfa24('0x24')](respondWithResult(_0x203550,null))['catch'](handleError(_0x203550,null));};var interaction_log=require(_0xfa24('0x5e'))(_0xfa24('0x5f'));exports[_0xfa24('0x60')]=function(_0x3483a0,_0x142cde,_0x124bff){var _0x5f2fd9={'agent':{},'channel':_0xfa24('0x61')};if(_0x3483a0[_0xfa24('0x5b')]['id']){delete _0x3483a0['body']['id'];}_0x3483a0[_0xfa24('0x5b')][_0xfa24('0x62')]=!![];_0x3483a0['body']['readAt']=moment()[_0xfa24('0x63')](_0xfa24('0x64'));_0x3483a0[_0xfa24('0x5b')][_0xfa24('0x65')]=_0x3483a0[_0xfa24('0x5b')][_0xfa24('0x65')]||_0x3483a0['user']['id'];_0x5f2fd9[_0xfa24('0x66')]['id']=_0x3483a0['body']['UserId'];return db[_0xfa24('0x3e')][_0xfa24('0x59')]({'where':{'id':_0x3483a0[_0xfa24('0x56')]['id'],'UserId':null}})[_0xfa24('0x24')](handleEntityNotFound(_0x142cde,null))[_0xfa24('0x24')](saveUpdates(_0x3483a0['body'],null))['then'](function(_0x18ee71){if(_0x18ee71){_0x5f2fd9[_0xfa24('0x2d')]=_0x18ee71[_0xfa24('0x67')]({'plain':!![]});return db[_0xfa24('0x68')][_0xfa24('0x59')]({'where':{'id':_0x18ee71['WhatsappInteractionId']}});}return null;})[_0xfa24('0x24')](handleEntityNotFound(_0x142cde,null))['then'](function(_0x51105e){if(_0x51105e){return _0x51105e[_0xfa24('0x3b')]({'UserId':_0x3483a0[_0xfa24('0x5b')][_0xfa24('0x65')],'read1stAt':_[_0xfa24('0x69')](_0x51105e[_0xfa24('0x6a')])?moment()['format'](_0xfa24('0x64')):undefined});}return null;})[_0xfa24('0x24')](function(_0x39495c){if(_0x39495c){_0x5f2fd9[_0xfa24('0x6b')]=_0x39495c[_0xfa24('0x67')]({'plain':!![]});interaction_log[_0xfa24('0x25')](_0xfa24('0x6c'),_0x3483a0[_0xfa24('0x6d')]['id'],_0x3483a0[_0xfa24('0x6d')]['name'],_0x3483a0[_0xfa24('0x6d')][_0xfa24('0x6e')],_0x5f2fd9[_0xfa24('0x6b')]['id'],_0x3483a0[_0xfa24('0x5b')]?JSON[_0xfa24('0x2a')](_0x3483a0['body']):_0xfa24('0x6f'));return respondWithRpcPromise(_0xfa24('0x70'),_0xfa24('0x71'),_0x5f2fd9);}return null;})['then'](function(_0x229f4d){var _0x46784f='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x229f4d[_0xfa24('0x2d')][_0xfa24('0x72')];return db[_0xfa24('0x73')][_0xfa24('0x44')](_0x46784f,{'type':db['Sequelize'][_0xfa24('0x74')]['SELECT'],'raw':!![]})[_0xfa24('0x24')](function(_0x3a30c8){return _0x3a30c8;});})[_0xfa24('0x24')](function(_0x29cd1c){if(_0x29cd1c){_0x5f2fd9[_0xfa24('0x2d')][_0xfa24('0x75')]=_0x29cd1c[0x0];if(!_0x3483a0[_0xfa24('0x5b')][_0xfa24('0x65')])return;return db['User']['find']({'where':{'id':_0x3483a0[_0xfa24('0x5b')][_0xfa24('0x65')],'role':_0xfa24('0x66')},'attributes':['id','name',_0xfa24('0x76'),_0xfa24('0x77'),'internal'],'raw':!![]});}return null;})['then'](function(_0x229470){if(!_0x229470)return null;_0x5f2fd9[_0xfa24('0x2d')][_0xfa24('0x66')]=_0x229470;return _0x5f2fd9;})[_0xfa24('0x24')](function(_0x4e805c){if(_0x4e805c){if(_0x3483a0[_0xfa24('0x5b')]['manual']){_0x5f2fd9['message']['interface']=util[_0xfa24('0x63')](_0xfa24('0x78'),_0x3483a0[_0xfa24('0x6d')][_0xfa24('0x3c')]);_0x5f2fd9['message'][_0xfa24('0x79')]=_0x5f2fd9[_0xfa24('0x79')];_0x5f2fd9[_0xfa24('0x2d')][_0xfa24('0x7a')]=_0x5f2fd9['channel'];_0x5f2fd9[_0xfa24('0x2d')]['event']='accept';return respondWithRpcPromise('EventManager',_0xfa24('0x7b'),{'event':_0xfa24('0x7c'),'message':_0x5f2fd9[_0xfa24('0x2d')]},client9002)[_0xfa24('0x24')](function(){return _0x5f2fd9;});}return _0x5f2fd9;}return null;})[_0xfa24('0x24')](respondWithResult(_0x142cde,null))[_0xfa24('0x54')](handleError(_0x142cde,null));};var interaction_log=require(_0xfa24('0x5e'))(_0xfa24('0x5f'));exports[_0xfa24('0x7d')]=function(_0x2f5b93,_0x3430e8,_0x190388){var _0x166233={'agent':{},'channel':_0xfa24('0x61')};if(_0x2f5b93[_0xfa24('0x5b')]['id']){delete _0x2f5b93['body']['id'];}_0x2f5b93['body'][_0xfa24('0x65')]=_0x2f5b93[_0xfa24('0x5b')][_0xfa24('0x65')]||_0x2f5b93[_0xfa24('0x6d')]['id'];_0x166233[_0xfa24('0x66')]['id']=_0x2f5b93[_0xfa24('0x5b')][_0xfa24('0x65')];return db[_0xfa24('0x3e')][_0xfa24('0x59')]({'where':{'id':_0x2f5b93[_0xfa24('0x56')]['id'],'UserId':null}})[_0xfa24('0x24')](handleEntityNotFound(_0x3430e8,null))[_0xfa24('0x24')](function(_0x6b5049){if(_0x6b5049){_0x166233[_0xfa24('0x2d')]=_0x6b5049[_0xfa24('0x67')]({'plain':!![]});return db['WhatsappInteraction'][_0xfa24('0x59')]({'where':{'id':_0x6b5049[_0xfa24('0x7e')]}});}return null;})[_0xfa24('0x24')](handleEntityNotFound(_0x3430e8,null))[_0xfa24('0x24')](function(_0x184ac4){if(_0x184ac4){_0x166233['interaction']=_0x184ac4['get']({'plain':!![]});interaction_log[_0xfa24('0x25')](_0xfa24('0x7f'),_0x2f5b93[_0xfa24('0x6d')]['id'],_0x2f5b93[_0xfa24('0x6d')]['name'],_0x2f5b93['user']['role'],_0x166233[_0xfa24('0x6b')]['id'],_0x2f5b93['body']?JSON[_0xfa24('0x2a')](_0x2f5b93[_0xfa24('0x5b')]):'null');return respondWithRpcPromise(_0xfa24('0x80'),_0xfa24('0x81'),_0x166233);}return null;})[_0xfa24('0x24')](function(_0x14adb9){var _0x12f486=_0xfa24('0x82')+_0x14adb9[_0xfa24('0x2d')][_0xfa24('0x72')];return db['sequelize']['query'](_0x12f486,{'type':db[_0xfa24('0x83')][_0xfa24('0x74')][_0xfa24('0x84')],'raw':!![]})[_0xfa24('0x24')](function(_0x1cca6e){return _0x1cca6e;});})[_0xfa24('0x24')](function(_0xf5fed){if(_0xf5fed){_0x166233['message']['contact']=_0xf5fed[0x0];if(!_0x2f5b93[_0xfa24('0x5b')][_0xfa24('0x65')])return;return db[_0xfa24('0x85')]['find']({'where':{'id':_0x2f5b93[_0xfa24('0x5b')][_0xfa24('0x65')],'role':'agent'},'attributes':['id',_0xfa24('0x3c'),_0xfa24('0x76'),'email',_0xfa24('0x86')],'raw':!![]});}return null;})[_0xfa24('0x24')](function(_0x139e1f){if(!_0x139e1f)return null;_0x166233['message'][_0xfa24('0x66')]=_0x139e1f;return _0x166233;})['then'](function(_0x542f0a){if(_0x542f0a){_0x542f0a[_0xfa24('0x2d')][_0xfa24('0x87')]=util['format'](_0xfa24('0x78'),_0x2f5b93[_0xfa24('0x6d')]['name']);_0x542f0a[_0xfa24('0x2d')][_0xfa24('0x79')]=_0x166233['channel'];_0x542f0a[_0xfa24('0x2d')][_0xfa24('0x7a')]=_0x166233[_0xfa24('0x79')];_0x542f0a['message'][_0xfa24('0x88')]=_0xfa24('0x7d');respondWithRpcPromise(_0xfa24('0x7b'),_0xfa24('0x7b'),{'event':'rejectmessage','message':_0x542f0a[_0xfa24('0x2d')]},client9002);return _0x166233;}return null;})[_0xfa24('0x24')](respondWithResult(_0x3430e8,null))[_0xfa24('0x54')](handleError(_0x3430e8,null));};exports[_0xfa24('0x30')]=function(_0x18422d,_0x405176,_0x58bba1){if(_0x18422d[_0xfa24('0x5b')]['id']){delete _0x18422d[_0xfa24('0x5b')]['id'];}var _0x23ca78;return db[_0xfa24('0x3e')][_0xfa24('0x59')]({'where':{'id':_0x18422d[_0xfa24('0x56')]['id']}})['then'](handleEntityNotFound(_0x405176,null))['then'](function(_0xab6769){if(_0xab6769){_0x23ca78=_0xab6769;return db[_0xfa24('0x89')][_0xfa24('0x59')]({'where':{'id':_0xab6769[_0xfa24('0x8a')]}});}})[_0xfa24('0x24')](handleEntityNotFound(_0x405176,null))['then'](function(_0x25d76f){if(_0x25d76f){logger[_0xfa24('0x28')](_0xfa24('0x8b'),_0xfa24('0x30'),_0xfa24('0x8c'),_0x25d76f[_0xfa24('0x50')],util[_0xfa24('0x8d')](_0x18422d[_0xfa24('0x5b')],{'showHidden':![],'depth':null}));switch(_0x25d76f[_0xfa24('0x50')]){case _0xfa24('0x8e'):if(_0x18422d[_0xfa24('0x5b')][_0xfa24('0x8f')]&&_0x18422d[_0xfa24('0x5b')]['MessageSid']===_0x23ca78['messageId']&&_0x18422d[_0xfa24('0x5b')][_0xfa24('0x90')]&&_0x18422d['body'][_0xfa24('0x90')]==='read'){return _0x23ca78['update']({'read':!![]});}else{logger[_0xfa24('0x2b')](_0xfa24('0x91'),_0xfa24('0x30'),_0xfa24('0x8e'),util[_0xfa24('0x8d')](_0x18422d['body'],{'showHidden':![],'depth':null}));}break;}return _0x23ca78;}})[_0xfa24('0x24')](respondWithResult(_0x405176,null))['catch'](handleError(_0x405176,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index 4f0442b..8bb67d6 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 _0x24cf=['WhatsappMessage','setMaxListeners','save','update','remove','emit','exports'];(function(_0x217605,_0x347798){var _0x13b50e=function(_0x462e40){while(--_0x462e40){_0x217605['push'](_0x217605['shift']());}};_0x13b50e(++_0x347798);}(_0x24cf,0x1d5));var _0xf24c=function(_0xb5401d,_0x16617e){_0xb5401d=_0xb5401d-0x0;var _0x3ec2c8=_0x24cf[_0xb5401d];return _0x3ec2c8;};'use strict';var EventEmitter=require('events');var WhatsappMessage=require('../../mysqldb')['db'][_0xf24c('0x0')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0xf24c('0x1')](0x0);var events={'afterCreate':_0xf24c('0x2'),'afterUpdate':_0xf24c('0x3'),'afterDestroy':_0xf24c('0x4')};function emitEvent(_0x4cc9b1){return function(_0x3cfc01,_0x417bb2,_0x1eafb4){WhatsappMessageEvents[_0xf24c('0x5')](_0x4cc9b1+':'+_0x3cfc01['id'],_0x3cfc01);WhatsappMessageEvents['emit'](_0x4cc9b1,_0x3cfc01);_0x1eafb4(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappMessage['hook'](e,emitEvent(event));}}module[_0xf24c('0x6')]=WhatsappMessageEvents; \ No newline at end of file +var _0x657b=['../../mysqldb','WhatsappMessage','setMaxListeners','save','remove','emit','hasOwnProperty','exports','events'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x657b,0x131));var _0xb657=function(_0x1fadb1,_0x1cefa0){_0x1fadb1=_0x1fadb1-0x0;var _0x456764=_0x657b[_0x1fadb1];return _0x456764;};'use strict';var EventEmitter=require(_0xb657('0x0'));var WhatsappMessage=require(_0xb657('0x1'))['db'][_0xb657('0x2')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0xb657('0x3')](0x0);var events={'afterCreate':_0xb657('0x4'),'afterUpdate':'update','afterDestroy':_0xb657('0x5')};function emitEvent(_0xa41497){return function(_0x5da1bc,_0x175072,_0x322e57){WhatsappMessageEvents[_0xb657('0x6')](_0xa41497+':'+_0x5da1bc['id'],_0x5da1bc);WhatsappMessageEvents[_0xb657('0x6')](_0xa41497,_0x5da1bc);_0x322e57(null);};}for(var e in events){if(events[_0xb657('0x7')](e)){var event=events[e];WhatsappMessage['hook'](e,emitEvent(event));}}module[_0xb657('0x8')]=WhatsappMessageEvents; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.model.js b/server/api/whatsappMessage/whatsappMessage.model.js index 4694290..d6b899a 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 _0x63a3=['baseUrl','/whatsapp/v1/','/messages/','POST','Bearer\x20','statuses','message_id','err','WhatsappMessage,\x20%s','finally','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','exports','define','WhatsappMessage','whatsapp_messages','messageId','fti_whatsapp_messages','FULLTEXT','get','direction','toLowerCase','out','secret','isNil','UserId','findOne','then','update','catch','error','WhatsappAccount','find','twilio','accountSid','authToken','phone','create','whatsapp:','remote','/api/whatsapp/messages/','/status?token=','sid','afterCreate','inspect','WhatsappMessage,\x20%s,\x20%s,\x20%s','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','sinch'];(function(_0x3635ce,_0x33a6f9){var _0x97ecd0=function(_0x123d98){while(--_0x123d98){_0x3635ce['push'](_0x3635ce['shift']());}};_0x97ecd0(++_0x33a6f9);}(_0x63a3,0x15b));var _0x363a=function(_0x57486e,_0x32283b){_0x57486e=_0x57486e-0x0;var _0x5f110b=_0x63a3[_0x57486e];return _0x5f110b;};'use strict';var _=require(_0x363a('0x0'));var util=require(_0x363a('0x1'));var logger=require(_0x363a('0x2'))(_0x363a('0x3'));var moment=require(_0x363a('0x4'));var BPromise=require(_0x363a('0x5'));var rp=require(_0x363a('0x6'));var fetch=require('node-fetch');var fs=require('fs');var path=require(_0x363a('0x7'));var rimraf=require(_0x363a('0x8'));var config=require('../../config/environment');var attributes=require('./whatsappMessage.attributes');module[_0x363a('0x9')]=function(_0x31cbc9,_0x12c445){return _0x31cbc9[_0x363a('0xa')](_0x363a('0xb'),attributes,{'tableName':_0x363a('0xc'),'paranoid':![],'indexes':[{'name':_0x363a('0xd'),'fields':['messageId']},{'name':_0x363a('0xe'),'fields':['body'],'type':_0x363a('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x54cc8f,_0x1f226e,_0x275ff4){var _0x4f21e5=_0x31cbc9['models'];var _0x4be9ec=_0x54cc8f[_0x363a('0x10')]({'plain':!![]});if(_0x4be9ec[_0x363a('0x11')][_0x363a('0x12')]()==='in'||_0x4be9ec[_0x363a('0x11')][_0x363a('0x12')]()===_0x363a('0x13')&&!_0x4be9ec[_0x363a('0x14')]&&!_[_0x363a('0x15')](_0x4be9ec[_0x363a('0x16')])){_0x4f21e5['WhatsappInteraction'][_0x363a('0x17')]({'where':{'id':_0x4be9ec['WhatsappInteractionId']}})[_0x363a('0x18')](function(_0x28ec14){if(_0x28ec14){_0x28ec14[_0x363a('0x19')]({'lastMsgAt':_0x4be9ec['createdAt'],'lastMsgDirection':_0x4be9ec[_0x363a('0x11')][_0x363a('0x12')]()});}})[_0x363a('0x1a')](function(_0x25b655){console[_0x363a('0x1b')](_0x25b655);});}if(_0x4be9ec[_0x363a('0x11')]===_0x363a('0x13')&&!_0x4be9ec[_0x363a('0x14')]){var _0x3f41fd;_0x4f21e5[_0x363a('0x1c')][_0x363a('0x1d')]({'where':{'id':_0x4be9ec['WhatsappAccountId']},'raw':!![]})[_0x363a('0x18')](function(_0x508629){_0x3f41fd=_0x508629;if(_0x3f41fd&&_0x3f41fd['type']){switch(_0x3f41fd['type']){case _0x363a('0x1e'):var _0x32cf19=require('twilio');if(_0x3f41fd[_0x363a('0x1f')]&&_0x3f41fd[_0x363a('0x20')]&&_0x3f41fd[_0x363a('0x21')]){var _0x5c4770=new _0x32cf19(_0x3f41fd[_0x363a('0x1f')],_0x3f41fd['authToken']);_0x5c4770['messages'][_0x363a('0x22')]({'body':_0x4be9ec['body'],'to':_0x363a('0x23')+_0x4be9ec[_0x363a('0x21')],'from':'whatsapp:'+_0x3f41fd['phone'],'statusCallback':_0x3f41fd[_0x363a('0x24')]+_0x363a('0x25')+_0x4be9ec['id']+_0x363a('0x26')+_0x3f41fd['token']})[_0x363a('0x18')](function(_0x11801a){if(_0x11801a[_0x363a('0x27')]){return _0x54cc8f['update']({'messageId':_0x11801a['sid']});}})[_0x363a('0x1a')](function(_0x23b5ac){logger[_0x363a('0x1b')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x363a('0x28'),'twilio',util[_0x363a('0x29')](_0x23b5ac,{'showHidden':![],'depth':null}));});}else{logger[_0x363a('0x1b')](_0x363a('0x2a'),_0x363a('0x28'),_0x363a('0x1e'),_0x363a('0x2b'));}break;case _0x363a('0x2c'):var _0x43820a=_0x3f41fd[_0x363a('0x1f')];var _0x21c4e1=_0x3f41fd[_0x363a('0x20')];var _0x51d476=_0x3f41fd[_0x363a('0x2d')]+_0x363a('0x2e')+_0x43820a+_0x363a('0x2f');var _0x3ece3f={'to':[_0x4be9ec[_0x363a('0x21')]],'message':{'type':'text','text':_0x4be9ec['body']}};var _0x50cb90={'method':_0x363a('0x30'),'uri':_0x51d476,'headers':{'Authorization':_0x363a('0x31')+_0x21c4e1,'Content-Type':'application/json'},'body':_0x3ece3f,'json':!![]};rp(_0x50cb90)['then'](function(_0x1d16a6){if(_0x1d16a6[_0x363a('0x32')][0x0]['message_id']){return _0x54cc8f['update']({'messageId':_0x1d16a6['statuses'][0x0][_0x363a('0x33')]});}})[_0x363a('0x1a')](function(_0x57dd6e){logger[_0x363a('0x34')](_0x363a('0x35'),_0x57dd6e);});break;}}})[_0x363a('0x36')](function(){_0x275ff4();});}else{_0x275ff4();}}},'charset':'utf8mb4','collate':_0x363a('0x37')});}; \ No newline at end of file +var _0x3e67=['isNil','UserId','WhatsappInteraction','findOne','WhatsappInteractionId','then','update','createdAt','error','WhatsappAccount','WhatsappAccountId','type','twilio','accountSid','phone','authToken','messages','create','whatsapp:','remote','/api/whatsapp/messages/','/status?token=','token','sid','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','sinch','baseUrl','/whatsapp/v1/','/messages/','POST','Bearer\x20','application/json','statuses','message_id','catch','err','finally','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappMessage.attributes','define','messageId','fti_whatsapp_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret'];(function(_0x2bd0be,_0xf63d47){var _0x3e8e85=function(_0xdc0fbc){while(--_0xdc0fbc){_0x2bd0be['push'](_0x2bd0be['shift']());}};_0x3e8e85(++_0xf63d47);}(_0x3e67,0xa5));var _0x73e6=function(_0x8e8ca7,_0x5a5e07){_0x8e8ca7=_0x8e8ca7-0x0;var _0x561381=_0x3e67[_0x8e8ca7];return _0x561381;};'use strict';var _=require('lodash');var util=require(_0x73e6('0x0'));var logger=require(_0x73e6('0x1'))(_0x73e6('0x2'));var moment=require(_0x73e6('0x3'));var BPromise=require(_0x73e6('0x4'));var rp=require(_0x73e6('0x5'));var fetch=require('node-fetch');var fs=require('fs');var path=require(_0x73e6('0x6'));var rimraf=require(_0x73e6('0x7'));var config=require(_0x73e6('0x8'));var attributes=require(_0x73e6('0x9'));module['exports']=function(_0x2947d3,_0x4b39df){return _0x2947d3[_0x73e6('0xa')]('WhatsappMessage',attributes,{'tableName':'whatsapp_messages','paranoid':![],'indexes':[{'name':_0x73e6('0xb'),'fields':[_0x73e6('0xb')]},{'name':_0x73e6('0xc'),'fields':[_0x73e6('0xd')],'type':_0x73e6('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x26a312,_0x5d4ec4,_0x484439){var _0x18e64f=_0x2947d3[_0x73e6('0xf')];var _0x528d12=_0x26a312[_0x73e6('0x10')]({'plain':!![]});if(_0x528d12['direction']['toLowerCase']()==='in'||_0x528d12[_0x73e6('0x11')][_0x73e6('0x12')]()===_0x73e6('0x13')&&!_0x528d12[_0x73e6('0x14')]&&!_[_0x73e6('0x15')](_0x528d12[_0x73e6('0x16')])){_0x18e64f[_0x73e6('0x17')][_0x73e6('0x18')]({'where':{'id':_0x528d12[_0x73e6('0x19')]}})[_0x73e6('0x1a')](function(_0x5d9348){if(_0x5d9348){_0x5d9348[_0x73e6('0x1b')]({'lastMsgAt':_0x528d12[_0x73e6('0x1c')],'lastMsgDirection':_0x528d12[_0x73e6('0x11')][_0x73e6('0x12')]()});}})['catch'](function(_0x1960e3){console[_0x73e6('0x1d')](_0x1960e3);});}if(_0x528d12[_0x73e6('0x11')]==='out'&&!_0x528d12[_0x73e6('0x14')]){var _0xc0fb7b;_0x18e64f[_0x73e6('0x1e')]['find']({'where':{'id':_0x528d12[_0x73e6('0x1f')]},'raw':!![]})['then'](function(_0x3358d8){_0xc0fb7b=_0x3358d8;if(_0xc0fb7b&&_0xc0fb7b['type']){switch(_0xc0fb7b[_0x73e6('0x20')]){case _0x73e6('0x21'):var _0x4f701b=require(_0x73e6('0x21'));if(_0xc0fb7b[_0x73e6('0x22')]&&_0xc0fb7b['authToken']&&_0xc0fb7b[_0x73e6('0x23')]){var _0x416e29=new _0x4f701b(_0xc0fb7b[_0x73e6('0x22')],_0xc0fb7b[_0x73e6('0x24')]);_0x416e29[_0x73e6('0x25')][_0x73e6('0x26')]({'body':_0x528d12[_0x73e6('0xd')],'to':_0x73e6('0x27')+_0x528d12[_0x73e6('0x23')],'from':_0x73e6('0x27')+_0xc0fb7b[_0x73e6('0x23')],'statusCallback':_0xc0fb7b[_0x73e6('0x28')]+_0x73e6('0x29')+_0x528d12['id']+_0x73e6('0x2a')+_0xc0fb7b[_0x73e6('0x2b')]})['then'](function(_0x89b6d){if(_0x89b6d[_0x73e6('0x2c')]){return _0x26a312[_0x73e6('0x1b')]({'messageId':_0x89b6d[_0x73e6('0x2c')]});}})['catch'](function(_0x4be204){logger['error'](_0x73e6('0x2d'),_0x73e6('0x2e'),'twilio',util['inspect'](_0x4be204,{'showHidden':![],'depth':null}));});}else{logger[_0x73e6('0x1d')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x73e6('0x2e'),_0x73e6('0x21'),_0x73e6('0x2f'));}break;case _0x73e6('0x30'):var _0x3b00fc=_0xc0fb7b[_0x73e6('0x22')];var _0x3597d7=_0xc0fb7b[_0x73e6('0x24')];var _0x41585c=_0xc0fb7b[_0x73e6('0x31')]+_0x73e6('0x32')+_0x3b00fc+_0x73e6('0x33');var _0x338f6a={'to':[_0x528d12['phone']],'message':{'type':'text','text':_0x528d12[_0x73e6('0xd')]}};var _0x41a946={'method':_0x73e6('0x34'),'uri':_0x41585c,'headers':{'Authorization':_0x73e6('0x35')+_0x3597d7,'Content-Type':_0x73e6('0x36')},'body':_0x338f6a,'json':!![]};rp(_0x41a946)[_0x73e6('0x1a')](function(_0x3ff2ff){if(_0x3ff2ff[_0x73e6('0x37')][0x0][_0x73e6('0x38')]){return _0x26a312[_0x73e6('0x1b')]({'messageId':_0x3ff2ff[_0x73e6('0x37')][0x0][_0x73e6('0x38')]});}})[_0x73e6('0x39')](function(_0x1e7303){logger[_0x73e6('0x3a')]('WhatsappMessage,\x20%s',_0x1e7303);});break;}}})[_0x73e6('0x3b')](function(){_0x484439();});}else{_0x484439();}}},'charset':_0x73e6('0x3c'),'collate':_0x73e6('0x3d')});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.rpc.js b/server/api/whatsappMessage/whatsappMessage.rpc.js index a793dac..36785be 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 _0xd5c6=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./whatsappMessage.socket','request','then','info','request\x20sent','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappMessage,\x20%s,\x20%s','message','result','catch','CreateWhatsappMessage','WhatsappMessage','create','options','debug','lodash','util'];(function(_0xa8ae60,_0x36af36){var _0x340cd9=function(_0x51372a){while(--_0x51372a){_0xa8ae60['push'](_0xa8ae60['shift']());}};_0x340cd9(++_0x36af36);}(_0xd5c6,0x15c));var _0x6d5c=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xd5c6[_0x4565bf];return _0x5610ba;};'use strict';var _=require(_0x6d5c('0x0'));var util=require(_0x6d5c('0x1'));var moment=require(_0x6d5c('0x2'));var BPromise=require(_0x6d5c('0x3'));var rs=require(_0x6d5c('0x4'));var fs=require('fs');var Redis=require(_0x6d5c('0x5'));var db=require(_0x6d5c('0x6'))['db'];var utils=require(_0x6d5c('0x7'));var logger=require(_0x6d5c('0x8'))(_0x6d5c('0x9'));var config=require('../../config/environment');var jayson=require(_0x6d5c('0xa'));var client=jayson[_0x6d5c('0xb')][_0x6d5c('0xc')]({'port':0x232a});config['redis']=_[_0x6d5c('0xd')](config[_0x6d5c('0xe')],{'host':_0x6d5c('0xf'),'port':0x18eb});var socket=require(_0x6d5c('0x10'))(new Redis(config['redis']));require(_0x6d5c('0x11'))['register'](socket);function respondWithRpcPromise(_0x10307c,_0x5a9d66,_0x5b04e3){return new BPromise(function(_0x20ad1a,_0x27126a){return client[_0x6d5c('0x12')](_0x10307c,_0x5b04e3)[_0x6d5c('0x13')](function(_0x540d17){logger[_0x6d5c('0x14')]('WhatsappMessage,\x20%s,\x20%s',_0x5a9d66,_0x6d5c('0x15'));logger['debug'](_0x6d5c('0x16'),_0x5a9d66,_0x6d5c('0x15'),JSON[_0x6d5c('0x17')](_0x540d17));if(_0x540d17[_0x6d5c('0x18')]){if(_0x540d17['error'][_0x6d5c('0x19')]===0x1f4){logger[_0x6d5c('0x18')](_0x6d5c('0x1a'),_0x5a9d66,_0x540d17[_0x6d5c('0x18')][_0x6d5c('0x1b')]);return _0x27126a(_0x540d17[_0x6d5c('0x18')]['message']);}logger[_0x6d5c('0x18')]('WhatsappMessage,\x20%s,\x20%s',_0x5a9d66,_0x540d17[_0x6d5c('0x18')]['message']);return _0x20ad1a(_0x540d17[_0x6d5c('0x18')]['message']);}else{logger[_0x6d5c('0x14')](_0x6d5c('0x1a'),_0x5a9d66,_0x6d5c('0x15'));_0x20ad1a(_0x540d17[_0x6d5c('0x1c')][_0x6d5c('0x1b')]);}})[_0x6d5c('0x1d')](function(_0x4d88d4){logger[_0x6d5c('0x18')](_0x6d5c('0x1a'),_0x5a9d66,_0x4d88d4);_0x27126a(_0x4d88d4);});});}exports[_0x6d5c('0x1e')]=function(_0x398263){var _0x307c77=this;return new Promise(function(_0xbf2c42,_0x508202){return db[_0x6d5c('0x1f')][_0x6d5c('0x20')](_0x398263['body'],{'raw':_0x398263[_0x6d5c('0x21')]?_0x398263[_0x6d5c('0x21')]['raw']===undefined?!![]:![]:!![]})[_0x6d5c('0x13')](function(_0x8c4cb9){logger[_0x6d5c('0x14')](_0x6d5c('0x1e'),_0x398263);logger[_0x6d5c('0x22')]('CreateWhatsappMessage',_0x398263,JSON['stringify'](_0x8c4cb9));_0xbf2c42(_0x8c4cb9);})[_0x6d5c('0x1d')](function(_0x82877a){logger[_0x6d5c('0x18')](_0x6d5c('0x1e'),_0x82877a[_0x6d5c('0x1b')],_0x398263);_0x508202(_0x307c77[_0x6d5c('0x18')](0x1f4,_0x82877a[_0x6d5c('0x1b')]));});});}; \ No newline at end of file +var _0xb75e=['ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateWhatsappMessage','WhatsappMessage','create','options','raw','info','lodash','moment','bluebird'];(function(_0x4a5349,_0x156289){var _0x4075d0=function(_0x296748){while(--_0x296748){_0x4a5349['push'](_0x4a5349['shift']());}};_0x4075d0(++_0x156289);}(_0xb75e,0xe4));var _0xeb75=function(_0x99b0ac,_0x2aab96){_0x99b0ac=_0x99b0ac-0x0;var _0x59fa3a=_0xb75e[_0x99b0ac];return _0x59fa3a;};'use strict';var _=require(_0xeb75('0x0'));var util=require('util');var moment=require(_0xeb75('0x1'));var BPromise=require(_0xeb75('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xeb75('0x3'));var db=require(_0xeb75('0x4'))['db'];var utils=require(_0xeb75('0x5'));var logger=require(_0xeb75('0x6'))('rpc');var config=require(_0xeb75('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xeb75('0x8')][_0xeb75('0x9')]({'port':0x232a});config[_0xeb75('0xa')]=_[_0xeb75('0xb')](config[_0xeb75('0xa')],{'host':_0xeb75('0xc'),'port':0x18eb});var socket=require(_0xeb75('0xd'))(new Redis(config[_0xeb75('0xa')]));require('./whatsappMessage.socket')[_0xeb75('0xe')](socket);function respondWithRpcPromise(_0x223d89,_0x558776,_0x39419d){return new BPromise(function(_0x30f277,_0x48dc15){return client[_0xeb75('0xf')](_0x223d89,_0x39419d)[_0xeb75('0x10')](function(_0x5261be){logger['info'](_0xeb75('0x11'),_0x558776,_0xeb75('0x12'));logger[_0xeb75('0x13')](_0xeb75('0x14'),_0x558776,'request\x20sent',JSON[_0xeb75('0x15')](_0x5261be));if(_0x5261be['error']){if(_0x5261be[_0xeb75('0x16')][_0xeb75('0x17')]===0x1f4){logger[_0xeb75('0x16')](_0xeb75('0x11'),_0x558776,_0x5261be[_0xeb75('0x16')][_0xeb75('0x18')]);return _0x48dc15(_0x5261be[_0xeb75('0x16')][_0xeb75('0x18')]);}logger['error'](_0xeb75('0x11'),_0x558776,_0x5261be[_0xeb75('0x16')][_0xeb75('0x18')]);return _0x30f277(_0x5261be[_0xeb75('0x16')][_0xeb75('0x18')]);}else{logger['info'](_0xeb75('0x11'),_0x558776,_0xeb75('0x12'));_0x30f277(_0x5261be[_0xeb75('0x19')][_0xeb75('0x18')]);}})[_0xeb75('0x1a')](function(_0x3ab44e){logger[_0xeb75('0x16')](_0xeb75('0x11'),_0x558776,_0x3ab44e);_0x48dc15(_0x3ab44e);});});}exports[_0xeb75('0x1b')]=function(_0x11b3b0){var _0x5dd926=this;return new Promise(function(_0x390f80,_0x15415f){return db[_0xeb75('0x1c')][_0xeb75('0x1d')](_0x11b3b0['body'],{'raw':_0x11b3b0[_0xeb75('0x1e')]?_0x11b3b0['options'][_0xeb75('0x1f')]===undefined?!![]:![]:!![]})['then'](function(_0x348868){logger[_0xeb75('0x20')](_0xeb75('0x1b'),_0x11b3b0);logger['debug']('CreateWhatsappMessage',_0x11b3b0,JSON[_0xeb75('0x15')](_0x348868));_0x390f80(_0x348868);})[_0xeb75('0x1a')](function(_0x5deef5){logger['error']('CreateWhatsappMessage',_0x5deef5[_0xeb75('0x18')],_0x11b3b0);_0x15415f(_0x5dd926['error'](0x1f4,_0x5deef5[_0xeb75('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index 92e303b..7de7c18 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 _0x6bc4=['removeListener','register','length','./whatsappMessage.events','remove','update'];(function(_0xa392f8,_0x37f8e7){var _0xc5216c=function(_0x16964d){while(--_0x16964d){_0xa392f8['push'](_0xa392f8['shift']());}};_0xc5216c(++_0x37f8e7);}(_0x6bc4,0x195));var _0x46bc=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x6bc4[_0x14add3];return _0x4a174f;};'use strict';var WhatsappMessageEvents=require(_0x46bc('0x0'));var events=['save',_0x46bc('0x1'),_0x46bc('0x2')];function createListener(_0x7372f7,_0x35147d){return function(_0x21a6ad){_0x35147d['emit'](_0x7372f7,_0x21a6ad);};}function removeListener(_0x183646,_0x4b61ec){return function(){WhatsappMessageEvents[_0x46bc('0x3')](_0x183646,_0x4b61ec);};}exports[_0x46bc('0x4')]=function(_0x42888c){for(var _0x461dd9=0x0,_0x4c5d20=events[_0x46bc('0x5')];_0x461dd9<_0x4c5d20;_0x461dd9++){var _0x70233c=events[_0x461dd9];var _0x4fe10c=createListener('whatsappMessage:'+_0x70233c,_0x42888c);WhatsappMessageEvents['on'](_0x70233c,_0x4fe10c);}}; \ No newline at end of file +var _0x1364=['register','length','whatsappMessage:','save','remove','update','emit','removeListener'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1364,0xab));var _0x4136=function(_0x22627b,_0x1d78d5){_0x22627b=_0x22627b-0x0;var _0x28419e=_0x1364[_0x22627b];return _0x28419e;};'use strict';var WhatsappMessageEvents=require('./whatsappMessage.events');var events=[_0x4136('0x0'),_0x4136('0x1'),_0x4136('0x2')];function createListener(_0x42be4b,_0x8887ec){return function(_0xee6d7b){_0x8887ec[_0x4136('0x3')](_0x42be4b,_0xee6d7b);};}function removeListener(_0x499d01,_0x599967){return function(){WhatsappMessageEvents[_0x4136('0x4')](_0x499d01,_0x599967);};}exports[_0x4136('0x5')]=function(_0x1a1808){for(var _0x34494d=0x0,_0x5d2a02=events[_0x4136('0x6')];_0x34494d<_0x5d2a02;_0x34494d++){var _0x36f4f1=events[_0x34494d];var _0x10f168=createListener(_0x4136('0x7')+_0x36f4f1,_0x1a1808);WhatsappMessageEvents['on'](_0x36f4f1,_0x10f168);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index 4ce2134..882b353 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 _0x1dc0=['delete','removeTeams','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','describe','getMembers','/:id/teams','getTeams','post','addTeams','/:id/users','put','/:id','update','destroy'];(function(_0x2e7cba,_0x3771c3){var _0x32a862=function(_0x4fcc34){while(--_0x4fcc34){_0x2e7cba['push'](_0x2e7cba['shift']());}};_0x32a862(++_0x3771c3);}(_0x1dc0,0x1ce));var _0x01dc=function(_0x36e26f,_0x93ce22){_0x36e26f=_0x36e26f-0x0;var _0x2dd6c2=_0x1dc0[_0x36e26f];return _0x2dd6c2;};'use strict';var multer=require('multer');var util=require(_0x01dc('0x0'));var path=require(_0x01dc('0x1'));var timeout=require(_0x01dc('0x2'));var express=require(_0x01dc('0x3'));var router=express['Router']();var fs_extra=require(_0x01dc('0x4'));var auth=require(_0x01dc('0x5'));var interaction=require(_0x01dc('0x6'));var config=require('../../config/environment');var controller=require('./whatsappQueue.controller');router[_0x01dc('0x7')]('/',auth[_0x01dc('0x8')](),controller[_0x01dc('0x9')]);router[_0x01dc('0x7')]('/describe',auth[_0x01dc('0x8')](),controller[_0x01dc('0xa')]);router[_0x01dc('0x7')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x01dc('0x7')]('/:id/members',auth[_0x01dc('0x8')](),controller[_0x01dc('0xb')]);router['get'](_0x01dc('0xc'),auth[_0x01dc('0x8')](),controller[_0x01dc('0xd')]);router[_0x01dc('0x7')]('/:id/users',auth['isAuthenticated'](),controller['getAgents']);router[_0x01dc('0xe')]('/',auth[_0x01dc('0x8')](),controller['create']);router['post'](_0x01dc('0xc'),auth[_0x01dc('0x8')](),controller[_0x01dc('0xf')]);router[_0x01dc('0xe')](_0x01dc('0x10'),auth['isAuthenticated'](),controller['addAgents']);router[_0x01dc('0x11')](_0x01dc('0x12'),auth['isAuthenticated'](),controller[_0x01dc('0x13')]);router['delete'](_0x01dc('0x12'),auth[_0x01dc('0x8')](),controller[_0x01dc('0x14')]);router[_0x01dc('0x15')](_0x01dc('0xc'),auth[_0x01dc('0x8')](),controller[_0x01dc('0x16')]);router[_0x01dc('0x15')]('/:id/users',auth[_0x01dc('0x8')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file +var _0x681a=['../../components/interaction/service','./whatsappQueue.controller','get','isAuthenticated','index','/describe','getMembers','/:id/teams','getTeams','getAgents','post','addTeams','addAgents','put','/:id','update','destroy','delete','removeTeams','removeAgents','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x2c6991,_0x4b5775){var _0x4de9fa=function(_0x4ad213){while(--_0x4ad213){_0x2c6991['push'](_0x2c6991['shift']());}};_0x4de9fa(++_0x4b5775);}(_0x681a,0xff));var _0xa681=function(_0x3b7a0c,_0xf1a4c2){_0x3b7a0c=_0x3b7a0c-0x0;var _0x3bb70f=_0x681a[_0x3b7a0c];return _0x3bb70f;};'use strict';var multer=require(_0xa681('0x0'));var util=require(_0xa681('0x1'));var path=require(_0xa681('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa681('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xa681('0x4'));var interaction=require(_0xa681('0x5'));var config=require('../../config/environment');var controller=require(_0xa681('0x6'));router[_0xa681('0x7')]('/',auth[_0xa681('0x8')](),controller[_0xa681('0x9')]);router[_0xa681('0x7')](_0xa681('0xa'),auth[_0xa681('0x8')](),controller['describe']);router['get']('/:id',auth[_0xa681('0x8')](),controller['show']);router[_0xa681('0x7')]('/:id/members',auth[_0xa681('0x8')](),controller[_0xa681('0xb')]);router['get'](_0xa681('0xc'),auth[_0xa681('0x8')](),controller[_0xa681('0xd')]);router[_0xa681('0x7')]('/:id/users',auth[_0xa681('0x8')](),controller[_0xa681('0xe')]);router[_0xa681('0xf')]('/',auth[_0xa681('0x8')](),controller['create']);router[_0xa681('0xf')](_0xa681('0xc'),auth[_0xa681('0x8')](),controller[_0xa681('0x10')]);router['post']('/:id/users',auth['isAuthenticated'](),controller[_0xa681('0x11')]);router[_0xa681('0x12')](_0xa681('0x13'),auth[_0xa681('0x8')](),controller[_0xa681('0x14')]);router['delete'](_0xa681('0x13'),auth['isAuthenticated'](),controller[_0xa681('0x15')]);router[_0xa681('0x16')](_0xa681('0xc'),auth[_0xa681('0x8')](),controller[_0xa681('0x17')]);router[_0xa681('0x16')]('/:id/users',auth['isAuthenticated'](),controller[_0xa681('0x18')]);module[_0xa681('0x19')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.attributes.js b/server/api/whatsappQueue/whatsappQueue.attributes.js index 07bb2da..426205d 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 _0x0b40=['ENUM','rrmemory','beepall','roundrobin','exports','STRING','INTEGER'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0x0b40,0xba));var _0x00b4=function(_0x2d89ce,_0x24d58d){_0x2d89ce=_0x2d89ce-0x0;var _0x3fad10=_0x0b40[_0x2d89ce];return _0x3fad10;};'use strict';var Sequelize=require('sequelize');module[_0x00b4('0x0')]={'name':{'type':Sequelize[_0x00b4('0x1')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0x00b4('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x00b4('0x3')](_0x00b4('0x4'),_0x00b4('0x5'),_0x00b4('0x6'))},'description':{'type':Sequelize[_0x00b4('0x1')]}}; \ No newline at end of file +var _0x757f=['name','INTEGER','ENUM','rrmemory','beepall','roundrobin','sequelize','STRING'];(function(_0xc02aa5,_0x1c36bc){var _0x31f6a2=function(_0x32425d){while(--_0x32425d){_0xc02aa5['push'](_0xc02aa5['shift']());}};_0x31f6a2(++_0x1c36bc);}(_0x757f,0xee));var _0xf757=function(_0xeaba4b,_0x1eab4b){_0xeaba4b=_0xeaba4b-0x0;var _0x32f4fd=_0x757f[_0xeaba4b];return _0x32f4fd;};'use strict';var Sequelize=require(_0xf757('0x0'));module['exports']={'name':{'type':Sequelize[_0xf757('0x1')],'unique':_0xf757('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0xf757('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xf757('0x4')](_0xf757('0x5'),_0xf757('0x6'),_0xf757('0x7'))},'description':{'type':Sequelize[_0xf757('0x1')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index 1271fc2..45f0ccf 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 _0x9090=['key','getOptions','where','include','findAll','rows','catch','params','query','keys','filters','intersection','model','attributes','fields','length','includeAll','merge','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','describe','findOne','UserWhatsappQueue','hasOwnProperty','nolimit','order','sort','pick','WhatsappQueueId','filter','User','findAndCountAll','UserId','agent','updatedAt','createdAt','format','%s/%s','SIP','whatsappPause','getTeams','Team','options','addTeams','voicePause','interface','sequelize','transaction','each','forEach','emit','ids','Agents','select','field','tq.TeamId','team_has_whatsapp_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','QueryTypes','SELECT','includes','all','removeTeams','isEmpty','userWhatsappQueue:remove','addAgents','omit','spread','userWhatsappQueue:save','isArray','getAgents','bluebird','util','lodash','squel','ioredis','../../components/parsers/qs','../../config/logger','api','../../mysqldb','redis','localhost','socket.io-emitter','./whatsappQueue.socket','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','get','WhatsappQueues','UserProfileResource','error','name','send','index','map','WhatsappQueue','rawAttributes','fieldName'];(function(_0x16b9ed,_0x56517a){var _0x66b1f8=function(_0x1c883){while(--_0x1c883){_0x16b9ed['push'](_0x16b9ed['shift']());}};_0x66b1f8(++_0x56517a);}(_0x9090,0x1bf));var _0x0909=function(_0x53bd6e,_0x4565d7){_0x53bd6e=_0x53bd6e-0x0;var _0x452812=_0x9090[_0x53bd6e];return _0x452812;};'use strict';var BPromise=require(_0x0909('0x0'));var util=require(_0x0909('0x1'));var _=require(_0x0909('0x2'));var squel=require(_0x0909('0x3'));var Redis=require(_0x0909('0x4'));var qs=require(_0x0909('0x5'));var logger=require(_0x0909('0x6'))(_0x0909('0x7'));var config=require('../../config/environment');var db=require(_0x0909('0x8'))['db'];config['redis']=_['defaults'](config[_0x0909('0x9')],{'host':_0x0909('0xa'),'port':0x18eb});var socket=require(_0x0909('0xb'))(new Redis(config['redis']));require(_0x0909('0xc'))['register'](socket);function respondWithStatusCode(_0x428b65,_0x31e8bf){_0x31e8bf=_0x31e8bf||0xcc;return function(_0x3d0325){if(_0x3d0325){return _0x428b65[_0x0909('0xd')](_0x31e8bf);}return _0x428b65['status'](_0x31e8bf)[_0x0909('0xe')]();};}function respondWithResult(_0x191315,_0x525ee7){_0x525ee7=_0x525ee7||0xc8;return function(_0x1b529b){if(_0x1b529b){return _0x191315[_0x0909('0xf')](_0x525ee7)[_0x0909('0x10')](_0x1b529b);}};}function respondWithFilteredResult(_0x5e519e,_0x381d72){return function(_0x540b18){if(_0x540b18){var _0x6287ef=typeof _0x381d72[_0x0909('0x11')]===_0x0909('0x12')&&typeof _0x381d72[_0x0909('0x13')]===_0x0909('0x12');var _0x2810e4=_0x540b18[_0x0909('0x14')];var _0x3b87ae=_0x6287ef?0x0:_0x381d72[_0x0909('0x11')];var _0x36fb2e=_0x6287ef?_0x540b18[_0x0909('0x14')]:_0x381d72['offset']+_0x381d72[_0x0909('0x13')];var _0x194139;if(_0x36fb2e>=_0x2810e4){_0x36fb2e=_0x2810e4;_0x194139=0xc8;}else{_0x194139=0xce;}_0x5e519e[_0x0909('0xf')](_0x194139);return _0x5e519e[_0x0909('0x15')](_0x0909('0x16'),_0x3b87ae+'-'+_0x36fb2e+'/'+_0x2810e4)[_0x0909('0x10')](_0x540b18);}return null;};}function saveUpdates(_0x5de227){return function(_0x489bc8){if(_0x489bc8){return _0x489bc8[_0x0909('0x17')](_0x5de227)[_0x0909('0x18')](function(_0x47c3bf){return _0x47c3bf;});}return null;};}function removeEntity(_0x31f5f4){return function(_0xc9876b){if(_0xc9876b){return _0xc9876b[_0x0909('0x19')]()[_0x0909('0x18')](function(){var _0x5b8c3b=_0xc9876b[_0x0909('0x1a')]({'plain':!![]});var _0x364415=_0x0909('0x1b');return db[_0x0909('0x1c')][_0x0909('0x19')]({'where':{'type':_0x364415,'resourceId':_0x5b8c3b['id']}})[_0x0909('0x18')](function(){return _0xc9876b;});})[_0x0909('0x18')](function(){_0x31f5f4['status'](0xcc)[_0x0909('0xe')]();});}};}function handleEntityNotFound(_0x5880ad){return function(_0x49cd96){if(!_0x49cd96){_0x5880ad[_0x0909('0xd')](0x194);}return _0x49cd96;};}function handleError(_0xfa7d06,_0x66bd93){_0x66bd93=_0x66bd93||0x1f4;return function(_0x4f8fa1){logger[_0x0909('0x1d')](_0x4f8fa1['stack']);if(_0x4f8fa1[_0x0909('0x1e')]){delete _0x4f8fa1[_0x0909('0x1e')];}_0xfa7d06[_0x0909('0xf')](_0x66bd93)[_0x0909('0x1f')](_0x4f8fa1);};}exports[_0x0909('0x20')]=function(_0x3b3dbc,_0x3fa297){var _0x21f5e4={};var _0x4534ad={'count':0x0,'rows':[]};var _0x504969=_[_0x0909('0x21')](db[_0x0909('0x22')][_0x0909('0x23')],function(_0x361ecc){return{'name':_0x361ecc[_0x0909('0x24')],'type':_0x361ecc['type'][_0x0909('0x25')]};});_0x21f5e4=qs[_0x0909('0x26')](_0x504969,_0x3b3dbc);var _0x221db6={'where':_0x21f5e4[_0x0909('0x27')]};return db[_0x0909('0x22')][_0x0909('0x14')](_0x221db6)[_0x0909('0x18')](function(_0x5b9669){_0x4534ad[_0x0909('0x14')]=_0x5b9669;_0x21f5e4['include']=qs[_0x0909('0x28')](_0x3b3dbc['query']);return db[_0x0909('0x22')][_0x0909('0x29')](_0x21f5e4);})[_0x0909('0x18')](function(_0x96b62){_0x4534ad[_0x0909('0x2a')]=_0x96b62;return _0x4534ad;})[_0x0909('0x18')](respondWithFilteredResult(_0x3fa297,_0x21f5e4))[_0x0909('0x2b')](handleError(_0x3fa297,null));};exports['show']=function(_0x547eff,_0x40f092){var _0x16caa0={'raw':!![],'where':{'id':_0x547eff[_0x0909('0x2c')]['id']}},_0x6639d1={};_0x6639d1['model']=_['keys'](db[_0x0909('0x22')][_0x0909('0x23')]);_0x6639d1[_0x0909('0x2d')]=_[_0x0909('0x2e')](_0x547eff['query']);_0x6639d1[_0x0909('0x2f')]=_[_0x0909('0x30')](_0x6639d1[_0x0909('0x31')],_0x6639d1[_0x0909('0x2d')]);_0x16caa0[_0x0909('0x32')]=_[_0x0909('0x30')](_0x6639d1[_0x0909('0x31')],qs['fields'](_0x547eff[_0x0909('0x2d')][_0x0909('0x33')]));_0x16caa0[_0x0909('0x32')]=_0x16caa0[_0x0909('0x32')][_0x0909('0x34')]?_0x16caa0[_0x0909('0x32')]:_0x6639d1[_0x0909('0x31')];if(_0x547eff[_0x0909('0x2d')][_0x0909('0x35')]){_0x16caa0[_0x0909('0x28')]=[{'all':!![]}];}_0x16caa0=_[_0x0909('0x36')]({},_0x16caa0,_0x547eff['options']);return db[_0x0909('0x22')][_0x0909('0x37')](_0x16caa0)[_0x0909('0x18')](handleEntityNotFound(_0x40f092,null))['then'](respondWithResult(_0x40f092,null))['catch'](handleError(_0x40f092,null));};exports[_0x0909('0x38')]=function(_0x29205d,_0x2ff370){return db[_0x0909('0x22')][_0x0909('0x38')](_0x29205d[_0x0909('0x39')],{})[_0x0909('0x18')](function(_0x538aa7){var _0x5950fa=_0x29205d[_0x0909('0x3a')][_0x0909('0x1a')]({'plain':!![]});if(!_0x5950fa)throw new Error(_0x0909('0x3b'));if(_0x5950fa[_0x0909('0x3c')]===_0x0909('0x3a')){var _0x3a9315=_0x538aa7['get']({'plain':!![]});var _0x23ff6b='WhatsappQueues';return db[_0x0909('0x3d')]['find']({'where':{'name':_0x23ff6b,'userProfileId':_0x5950fa[_0x0909('0x3e')]},'raw':!![]})[_0x0909('0x18')](function(_0x50cdf0){if(_0x50cdf0&&_0x50cdf0[_0x0909('0x3f')]===0x0){return db[_0x0909('0x1c')][_0x0909('0x38')]({'name':_0x3a9315[_0x0909('0x1e')],'resourceId':_0x3a9315['id'],'type':_0x50cdf0['name'],'sectionId':_0x50cdf0['id']},{})[_0x0909('0x18')](function(){return _0x538aa7;});}else{return _0x538aa7;}})[_0x0909('0x2b')](function(_0x113354){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x113354);throw _0x113354;});}return _0x538aa7;})[_0x0909('0x18')](respondWithResult(_0x2ff370,0xc9))[_0x0909('0x2b')](handleError(_0x2ff370,null));};exports[_0x0909('0x17')]=function(_0x562a16,_0x2b3889){if(_0x562a16[_0x0909('0x39')]['id']){delete _0x562a16[_0x0909('0x39')]['id'];}return db[_0x0909('0x22')][_0x0909('0x37')]({'where':{'id':_0x562a16[_0x0909('0x2c')]['id']}})[_0x0909('0x18')](handleEntityNotFound(_0x2b3889,null))[_0x0909('0x18')](saveUpdates(_0x562a16['body'],null))[_0x0909('0x18')](respondWithResult(_0x2b3889,null))[_0x0909('0x2b')](handleError(_0x2b3889,null));};exports[_0x0909('0x19')]=function(_0x41dab1,_0x5232ca){return db[_0x0909('0x22')][_0x0909('0x37')]({'where':{'id':_0x41dab1[_0x0909('0x2c')]['id']}})[_0x0909('0x18')](handleEntityNotFound(_0x5232ca,null))['then'](removeEntity(_0x5232ca,null))[_0x0909('0x2b')](handleError(_0x5232ca,null));};exports[_0x0909('0x40')]=function(_0x3d701e,_0x208286){return db['WhatsappQueue'][_0x0909('0x40')]()[_0x0909('0x18')](respondWithResult(_0x208286,null))[_0x0909('0x2b')](handleError(_0x208286,null));};exports['getMembers']=function(_0x2fc061,_0x39a654){var _0x51dd54={'raw':!![],'where':{}},_0x167b62={},_0x3b826e;return db[_0x0909('0x22')][_0x0909('0x41')]({'where':{'id':_0x2fc061[_0x0909('0x2c')]['id']}})[_0x0909('0x18')](handleEntityNotFound(_0x39a654,null))[_0x0909('0x18')](function(_0x47742d){if(_0x47742d){_0x3b826e=_0x47742d[_0x0909('0x1a')]({'plain':!![]});_0x167b62[_0x0909('0x31')]=_[_0x0909('0x2e')](db[_0x0909('0x42')][_0x0909('0x23')]);_0x167b62[_0x0909('0x2d')]=_[_0x0909('0x2e')](_0x2fc061[_0x0909('0x2d')]);_0x167b62[_0x0909('0x2f')]=_[_0x0909('0x30')](_0x167b62[_0x0909('0x31')],_0x167b62['query']);_0x51dd54[_0x0909('0x32')]=_['intersection'](_0x167b62['model'],qs[_0x0909('0x33')](_0x2fc061[_0x0909('0x2d')][_0x0909('0x33')]));_0x51dd54[_0x0909('0x32')]=_0x51dd54[_0x0909('0x32')][_0x0909('0x34')]?_0x51dd54[_0x0909('0x32')]:_0x167b62['model'];if(!_0x2fc061[_0x0909('0x2d')][_0x0909('0x43')](_0x0909('0x44'))){_0x51dd54[_0x0909('0x13')]=qs[_0x0909('0x13')](_0x2fc061[_0x0909('0x2d')][_0x0909('0x13')]);_0x51dd54[_0x0909('0x11')]=qs[_0x0909('0x11')](_0x2fc061[_0x0909('0x2d')][_0x0909('0x11')]);}_0x51dd54[_0x0909('0x45')]=qs['sort'](_0x2fc061[_0x0909('0x2d')][_0x0909('0x46')]);_0x51dd54['where']=qs[_0x0909('0x2f')](_[_0x0909('0x47')](_0x2fc061[_0x0909('0x2d')],_0x167b62[_0x0909('0x2f')]));_0x51dd54[_0x0909('0x27')][_0x0909('0x48')]=_0x47742d['id'];if(_0x2fc061[_0x0909('0x2d')][_0x0909('0x49')]){_0x51dd54[_0x0909('0x27')]=_[_0x0909('0x36')](_0x51dd54[_0x0909('0x27')],{'$or':_[_0x0909('0x21')](_0x51dd54[_0x0909('0x32')],function(_0x329a3b){var _0x1f747e={};_0x1f747e[_0x329a3b]={'$like':'%'+_0x2fc061[_0x0909('0x2d')][_0x0909('0x49')]+'%'};return _0x1f747e;})});}_0x51dd54=_[_0x0909('0x36')]({},_0x51dd54,_0x2fc061['options']);return db['UserWhatsappQueue'][_0x0909('0x29')](_0x51dd54);}})['then'](function(_0x22577e){if(_0x22577e){return db[_0x0909('0x4a')][_0x0909('0x4b')]({'where':{'id':_[_0x0909('0x21')](_0x22577e,_0x0909('0x4c')),'role':_0x0909('0x4d')},'attributes':['id',_0x0909('0x1e'),'whatsappPause',_0x0909('0x4e'),_0x0909('0x4f')]});}})[_0x0909('0x18')](function(_0x243181){if(_0x243181){return{'count':_0x243181[_0x0909('0x14')],'rows':_[_0x0909('0x21')](_0x243181[_0x0909('0x2a')],function(_0x114828){return{'membername':_0x114828[_0x0909('0x1e')],'UserId':_0x114828['id'],'queue_name':_0x3b826e[_0x0909('0x1e')],'WhatsappQueueId':_0x3b826e['id'],'interface':util[_0x0909('0x50')](_0x0909('0x51'),_0x0909('0x52'),_0x114828[_0x0909('0x1e')]),'penalty':0x0,'paused':_0x114828[_0x0909('0x53')],'createdAt':_0x114828[_0x0909('0x4f')],'updatedAt':_0x114828[_0x0909('0x4e')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x0909('0x18')](respondWithFilteredResult(_0x39a654,_0x51dd54))[_0x0909('0x2b')](handleError(_0x39a654,null));};exports[_0x0909('0x54')]=function(_0x4ddf00,_0x12c4ac){var _0x4cedbe={};var _0x50f23d={};var _0x4a16e5;var _0x19bca2;return db[_0x0909('0x22')][_0x0909('0x41')]({'where':{'id':_0x4ddf00[_0x0909('0x2c')]['id']}})[_0x0909('0x18')](handleEntityNotFound(_0x12c4ac,null))[_0x0909('0x18')](function(_0x5d7cf4){if(_0x5d7cf4){_0x4a16e5=_0x5d7cf4;_0x50f23d['model']=_['keys'](db[_0x0909('0x55')][_0x0909('0x23')]);_0x50f23d[_0x0909('0x2d')]=_[_0x0909('0x2e')](_0x4ddf00[_0x0909('0x2d')]);_0x50f23d[_0x0909('0x2f')]=_[_0x0909('0x30')](_0x50f23d[_0x0909('0x31')],_0x50f23d[_0x0909('0x2d')]);_0x4cedbe[_0x0909('0x32')]=_[_0x0909('0x30')](_0x50f23d[_0x0909('0x31')],qs[_0x0909('0x33')](_0x4ddf00[_0x0909('0x2d')][_0x0909('0x33')]));_0x4cedbe[_0x0909('0x32')]=_0x4cedbe[_0x0909('0x32')][_0x0909('0x34')]?_0x4cedbe['attributes']:_0x50f23d[_0x0909('0x31')];_0x4cedbe[_0x0909('0x45')]=qs['sort'](_0x4ddf00['query'][_0x0909('0x46')]);_0x4cedbe[_0x0909('0x27')]=qs[_0x0909('0x2f')](_[_0x0909('0x47')](_0x4ddf00[_0x0909('0x2d')],_0x50f23d[_0x0909('0x2f')]));if(_0x4ddf00[_0x0909('0x2d')][_0x0909('0x49')]){_0x4cedbe['where']=_['merge'](_0x4cedbe[_0x0909('0x27')],{'$or':_[_0x0909('0x21')](_0x4cedbe[_0x0909('0x32')],function(_0x35b7a8){var _0x402c1a={};_0x402c1a[_0x35b7a8]={'$like':'%'+_0x4ddf00[_0x0909('0x2d')]['filter']+'%'};return _0x402c1a;})});}_0x4cedbe=_[_0x0909('0x36')]({},_0x4cedbe,_0x4ddf00[_0x0909('0x56')]);return _0x4a16e5[_0x0909('0x54')](_0x4cedbe);}})[_0x0909('0x18')](function(_0x2203eb){if(_0x2203eb){_0x19bca2=_0x2203eb['length'];if(!_0x4ddf00[_0x0909('0x2d')][_0x0909('0x43')]('nolimit')){_0x4cedbe['limit']=qs[_0x0909('0x13')](_0x4ddf00['query']['limit']);_0x4cedbe[_0x0909('0x11')]=qs[_0x0909('0x11')](_0x4ddf00['query'][_0x0909('0x11')]);}return _0x4a16e5[_0x0909('0x54')](_0x4cedbe);}})[_0x0909('0x18')](function(_0x5eec4d){if(_0x5eec4d){return _0x5eec4d?{'count':_0x19bca2,'rows':_0x5eec4d}:null;}})[_0x0909('0x18')](respondWithResult(_0x12c4ac,null))['catch'](handleError(_0x12c4ac,null));};exports[_0x0909('0x57')]=function(_0x585776,_0x250977){var _0x3d6988=_0x585776[_0x0909('0x39')]['ids'];return db[_0x0909('0x55')]['findAll']({'where':{'id':_0x3d6988},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id',_0x0909('0x1e'),'online',_0x0909('0x58'),_0x0909('0x59')],'raw':!![]}]})[_0x0909('0x18')](function(_0x1d63e1){if(_0x1d63e1){var _0x412e5f=_['flatMap'](_0x1d63e1,function(_0x5b81d7){var _0x5bd961=_0x5b81d7['get']({'plain':!![]});return _0x5bd961['Agents'];});return db['WhatsappQueue']['find']({'where':{'id':_0x585776[_0x0909('0x2c')]['id']}})['then'](function(_0x5c3bb){return db[_0x0909('0x5a')][_0x0909('0x5b')](function(_0x1a30d5){return _0x5c3bb[_0x0909('0x57')](_0x3d6988,{'transaction':_0x1a30d5})[_0x0909('0x18')](function(){return BPromise[_0x0909('0x5c')](_0x412e5f,function(_0x4535ed){return db[_0x0909('0x42')]['findOrCreate']({'where':{'UserId':_0x4535ed['id'],'WhatsappQueueId':_0x585776[_0x0909('0x2c')]['id']},'transaction':_0x1a30d5});});})['then'](function(){_0x412e5f[_0x0909('0x5d')](function(_0x3b5719){socket[_0x0909('0x5e')]('userWhatsappQueue:save',{'UserId':_0x3b5719['id'],'WhatsappQueueId':_0x5c3bb['id']});});});});});}})[_0x0909('0x18')](respondWithStatusCode(_0x250977,null))[_0x0909('0x2b')](handleError(_0x250977,null));};exports['removeTeams']=function(_0x266f84,_0x48407b){return db[_0x0909('0x55')][_0x0909('0x29')]({'where':{'id':_0x266f84[_0x0909('0x2d')][_0x0909('0x5f')]},'attributes':['id'],'include':[{'model':db[_0x0909('0x4a')],'as':_0x0909('0x60'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x48407b,null))[_0x0909('0x18')](function(_0x3b3e80){var _0x420194=_[_0x0909('0x21')](_0x3b3e80,'id');var _0x2b1b31=[];var _0x1f73dd=[];var _0x44fe6d=squel[_0x0909('0x61')]();_0x44fe6d[_0x0909('0x62')](_0x0909('0x63'))['from'](_0x0909('0x64'),'tq')[_0x0909('0x65')](_0x0909('0x66'),'ut',_0x0909('0x67'))['where'](_0x0909('0x68'),_0x266f84[_0x0909('0x2c')]['id']);for(var _0x4ac299=0x0;_0x4ac299<_0x3b3e80[_0x0909('0x34')];_0x4ac299+=0x1){let _0x56ab0e=_0x3b3e80[_0x4ac299];for(var _0x250810=0x0;_0x250810<_0x56ab0e[_0x0909('0x60')]['length'];_0x250810+=0x1){let _0x3a0e3e=_0x56ab0e[_0x0909('0x60')][_0x250810];var _0x575e34=_0x44fe6d[_0x0909('0x69')]();_0x575e34[_0x0909('0x27')](_0x0909('0x6a'),_0x3a0e3e['id']);_0x1f73dd[_0x0909('0x6b')](db[_0x0909('0x5a')][_0x0909('0x2d')](_0x575e34['toString'](),{'type':db[_0x0909('0x5a')][_0x0909('0x6c')][_0x0909('0x6d')]})[_0x0909('0x18')](function(_0x8d9b52){if(_0x8d9b52[_0x0909('0x34')]===0x1){return _0x3a0e3e['id'];}else{var _0x269834=_['every'](_[_0x0909('0x21')](_0x8d9b52,'TeamId'),function(_0x318673){return _[_0x0909('0x6e')](_0x420194,_0x318673);});if(_0x269834){return _0x3a0e3e['id'];}}}));}}return BPromise[_0x0909('0x6f')](_0x1f73dd)[_0x0909('0x18')](function(_0x2146ab){_0x2b1b31=_(_0x2b1b31)['union'](_0x2146ab)['compact']()['value']();return db[_0x0909('0x22')]['find']({'where':{'id':_0x266f84[_0x0909('0x2c')]['id']}})[_0x0909('0x18')](function(_0x3382f6){return db[_0x0909('0x5a')][_0x0909('0x5b')](function(_0x393ff2){return _0x3382f6[_0x0909('0x70')](_0x266f84['query'][_0x0909('0x5f')],{'transaction':_0x393ff2})['then'](function(){if(!_[_0x0909('0x71')](_0x2b1b31)){return _0x3382f6['removeAgents'](_0x2b1b31,{'transaction':_0x393ff2});}})[_0x0909('0x18')](function(){_0x2b1b31[_0x0909('0x5d')](function(_0x449893){socket[_0x0909('0x5e')](_0x0909('0x72'),{'UserId':_0x449893,'WhatsappQueueId':_0x3382f6['id']});});});});});});})['then'](respondWithStatusCode(_0x48407b,null))[_0x0909('0x2b')](handleError(_0x48407b,null));};exports[_0x0909('0x73')]=function(_0x1cc5fb,_0x22ca64){return db[_0x0909('0x22')][_0x0909('0x37')]({'where':{'id':_0x1cc5fb['params']['id']}})[_0x0909('0x18')](handleEntityNotFound(_0x22ca64,null))[_0x0909('0x18')](function(_0x34b772){if(_0x34b772){return _0x34b772[_0x0909('0x73')](_0x1cc5fb[_0x0909('0x39')][_0x0909('0x5f')],_[_0x0909('0x74')](_0x1cc5fb['body'],[_0x0909('0x5f'),'id'])||{})[_0x0909('0x75')](function(_0x2aadd2){for(var _0x54df04=0x0;_0x54df04<_0x1cc5fb[_0x0909('0x39')][_0x0909('0x5f')][_0x0909('0x34')];_0x54df04+=0x1){socket[_0x0909('0x5e')](_0x0909('0x76'),{'UserId':Number(_0x1cc5fb[_0x0909('0x39')]['ids'][_0x54df04]),'WhatsappQueueId':Number(_0x1cc5fb[_0x0909('0x2c')]['id'])});}return _0x2aadd2;});}})[_0x0909('0x18')](respondWithResult(_0x22ca64,null))[_0x0909('0x2b')](handleError(_0x22ca64,null));};exports['removeAgents']=function(_0x3151e0,_0x160356){return db[_0x0909('0x22')][_0x0909('0x37')]({'where':{'id':_0x3151e0[_0x0909('0x2c')]['id']}})['then'](handleEntityNotFound(_0x160356,null))[_0x0909('0x18')](function(_0x479262){if(_0x479262){return _0x479262['removeAgents'](_0x3151e0[_0x0909('0x2d')][_0x0909('0x5f')])[_0x0909('0x18')](function(){if(_[_0x0909('0x77')](_0x3151e0[_0x0909('0x2d')][_0x0909('0x5f')])){for(var _0x1117a5=0x0;_0x1117a5<_0x3151e0[_0x0909('0x2d')][_0x0909('0x5f')][_0x0909('0x34')];_0x1117a5+=0x1){socket[_0x0909('0x5e')]('userWhatsappQueue:remove',{'UserId':Number(_0x3151e0[_0x0909('0x2d')]['ids'][_0x1117a5]),'WhatsappQueueId':Number(_0x3151e0[_0x0909('0x2c')]['id'])});}}else{socket[_0x0909('0x5e')]('userWhatsappQueue:remove',{'UserId':Number(_0x3151e0[_0x0909('0x2d')][_0x0909('0x5f')]),'WhatsappQueueId':Number(_0x3151e0['params']['id'])});}});}})[_0x0909('0x18')](respondWithStatusCode(_0x160356,null))[_0x0909('0x2b')](handleError(_0x160356,null));};exports['getAgents']=function(_0x540cad,_0x4fc3ce){var _0x9def75={};var _0x490c4a={};var _0x51752c;var _0x58661f;return db['WhatsappQueue'][_0x0909('0x41')]({'where':{'id':_0x540cad[_0x0909('0x2c')]['id']}})[_0x0909('0x18')](handleEntityNotFound(_0x4fc3ce,null))[_0x0909('0x18')](function(_0x5be934){if(_0x5be934){_0x51752c=_0x5be934;_0x490c4a['model']=_[_0x0909('0x2e')](db[_0x0909('0x4a')][_0x0909('0x23')]);_0x490c4a[_0x0909('0x2d')]=_[_0x0909('0x2e')](_0x540cad[_0x0909('0x2d')]);_0x490c4a['filters']=_[_0x0909('0x30')](_0x490c4a[_0x0909('0x31')],_0x490c4a[_0x0909('0x2d')]);_0x9def75[_0x0909('0x32')]=_[_0x0909('0x30')](_0x490c4a[_0x0909('0x31')],qs[_0x0909('0x33')](_0x540cad['query'][_0x0909('0x33')]));_0x9def75[_0x0909('0x32')]=_0x9def75['attributes']['length']?_0x9def75[_0x0909('0x32')]:_0x490c4a[_0x0909('0x31')];_0x9def75[_0x0909('0x45')]=qs[_0x0909('0x46')](_0x540cad[_0x0909('0x2d')][_0x0909('0x46')]);_0x9def75[_0x0909('0x27')]=qs['filters'](_[_0x0909('0x47')](_0x540cad[_0x0909('0x2d')],_0x490c4a[_0x0909('0x2f')]));if(_0x540cad[_0x0909('0x2d')][_0x0909('0x49')]){_0x9def75[_0x0909('0x27')]=_[_0x0909('0x36')](_0x9def75[_0x0909('0x27')],{'$or':_[_0x0909('0x21')](_0x9def75[_0x0909('0x32')],function(_0x37396d){var _0x4fd6d9={};_0x4fd6d9[_0x37396d]={'$like':'%'+_0x540cad[_0x0909('0x2d')][_0x0909('0x49')]+'%'};return _0x4fd6d9;})});}_0x9def75=_['merge']({},_0x9def75,_0x540cad[_0x0909('0x56')]);return _0x51752c[_0x0909('0x78')](_0x9def75);}})['then'](function(_0x4b0e32){if(_0x4b0e32){_0x58661f=_0x4b0e32['length'];if(!_0x540cad[_0x0909('0x2d')][_0x0909('0x43')](_0x0909('0x44'))){_0x9def75[_0x0909('0x13')]=qs[_0x0909('0x13')](_0x540cad[_0x0909('0x2d')][_0x0909('0x13')]);_0x9def75['offset']=qs[_0x0909('0x11')](_0x540cad[_0x0909('0x2d')][_0x0909('0x11')]);}return _0x51752c['getAgents'](_0x9def75);}})[_0x0909('0x18')](function(_0x19108b){if(_0x19108b){return _0x19108b?{'count':_0x58661f,'rows':_0x19108b}:null;}})['then'](respondWithResult(_0x4fc3ce,null))[_0x0909('0x2b')](handleError(_0x4fc3ce,null));}; \ No newline at end of file +var _0x3572=['autoAssociation','describe','getMembers','findOne','UserWhatsappQueue','length','hasOwnProperty','nolimit','order','sort','pick','WhatsappQueueId','filter','options','findAll','User','findAndCountAll','UserId','whatsappPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','Team','addTeams','ids','online','voicePause','Agents','sequelize','transaction','each','findOrCreate','emit','select','field','tq.TeamId','from','team_has_whatsapp_queues','join','user_has_teams','WhatsappQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','QueryTypes','every','TeamId','includes','all','union','compact','isEmpty','removeAgents','forEach','userWhatsappQueue:remove','addAgents','spread','userWhatsappQueue:save','isArray','getAgents','util','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','defaults','redis','socket.io-emitter','register','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','update','then','get','WhatsappQueues','UserProfileResource','destroy','error','stack','name','index','map','WhatsappQueue','rawAttributes','fieldName','type','getOptions','where','include','query','rows','catch','show','params','model','keys','filters','intersection','attributes','fields','merge','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3572,0x1ad));var _0x2357=function(_0x4ae5f9,_0x2023be){_0x4ae5f9=_0x4ae5f9-0x0;var _0x184bca=_0x3572[_0x4ae5f9];return _0x184bca;};'use strict';var BPromise=require('bluebird');var util=require(_0x2357('0x0'));var _=require(_0x2357('0x1'));var squel=require('squel');var Redis=require(_0x2357('0x2'));var qs=require(_0x2357('0x3'));var logger=require(_0x2357('0x4'))(_0x2357('0x5'));var config=require(_0x2357('0x6'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x2357('0x7')](config[_0x2357('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0x2357('0x9'))(new Redis(config['redis']));require('./whatsappQueue.socket')[_0x2357('0xa')](socket);function respondWithStatusCode(_0x271f50,_0xa5cd5d){_0xa5cd5d=_0xa5cd5d||0xcc;return function(_0xb1e626){if(_0xb1e626){return _0x271f50[_0x2357('0xb')](_0xa5cd5d);}return _0x271f50['status'](_0xa5cd5d)[_0x2357('0xc')]();};}function respondWithResult(_0x7ac535,_0xe1df09){_0xe1df09=_0xe1df09||0xc8;return function(_0x8d639c){if(_0x8d639c){return _0x7ac535[_0x2357('0xd')](_0xe1df09)[_0x2357('0xe')](_0x8d639c);}};}function respondWithFilteredResult(_0x48544f,_0x435c9b){return function(_0x2ddfb2){if(_0x2ddfb2){var _0x19a344=typeof _0x435c9b[_0x2357('0xf')]===_0x2357('0x10')&&typeof _0x435c9b[_0x2357('0x11')]===_0x2357('0x10');var _0x98ac50=_0x2ddfb2[_0x2357('0x12')];var _0x20028c=_0x19a344?0x0:_0x435c9b[_0x2357('0xf')];var _0x332b77=_0x19a344?_0x2ddfb2[_0x2357('0x12')]:_0x435c9b[_0x2357('0xf')]+_0x435c9b[_0x2357('0x11')];var _0x503562;if(_0x332b77>=_0x98ac50){_0x332b77=_0x98ac50;_0x503562=0xc8;}else{_0x503562=0xce;}_0x48544f[_0x2357('0xd')](_0x503562);return _0x48544f[_0x2357('0x13')](_0x2357('0x14'),_0x20028c+'-'+_0x332b77+'/'+_0x98ac50)[_0x2357('0xe')](_0x2ddfb2);}return null;};}function saveUpdates(_0x3451b4){return function(_0x4e9000){if(_0x4e9000){return _0x4e9000[_0x2357('0x15')](_0x3451b4)[_0x2357('0x16')](function(_0x1bc70a){return _0x1bc70a;});}return null;};}function removeEntity(_0x223d23){return function(_0x17792f){if(_0x17792f){return _0x17792f['destroy']()['then'](function(){var _0xce1101=_0x17792f[_0x2357('0x17')]({'plain':!![]});var _0x10cc1b=_0x2357('0x18');return db[_0x2357('0x19')][_0x2357('0x1a')]({'where':{'type':_0x10cc1b,'resourceId':_0xce1101['id']}})[_0x2357('0x16')](function(){return _0x17792f;});})[_0x2357('0x16')](function(){_0x223d23[_0x2357('0xd')](0xcc)['end']();});}};}function handleEntityNotFound(_0xa0a8d2){return function(_0xad19bd){if(!_0xad19bd){_0xa0a8d2[_0x2357('0xb')](0x194);}return _0xad19bd;};}function handleError(_0x1044fa,_0x31cb8f){_0x31cb8f=_0x31cb8f||0x1f4;return function(_0x4584ac){logger[_0x2357('0x1b')](_0x4584ac[_0x2357('0x1c')]);if(_0x4584ac[_0x2357('0x1d')]){delete _0x4584ac['name'];}_0x1044fa['status'](_0x31cb8f)['send'](_0x4584ac);};}exports[_0x2357('0x1e')]=function(_0x50676f,_0x4152f2){var _0x4a1871={};var _0x2d3060={'count':0x0,'rows':[]};var _0xa966a7=_[_0x2357('0x1f')](db[_0x2357('0x20')][_0x2357('0x21')],function(_0xdedf43){return{'name':_0xdedf43[_0x2357('0x22')],'type':_0xdedf43[_0x2357('0x23')]['key']};});_0x4a1871=qs[_0x2357('0x24')](_0xa966a7,_0x50676f);var _0x536ca5={'where':_0x4a1871[_0x2357('0x25')]};return db['WhatsappQueue'][_0x2357('0x12')](_0x536ca5)[_0x2357('0x16')](function(_0x5445f3){_0x2d3060['count']=_0x5445f3;_0x4a1871[_0x2357('0x26')]=qs[_0x2357('0x26')](_0x50676f[_0x2357('0x27')]);return db[_0x2357('0x20')]['findAll'](_0x4a1871);})[_0x2357('0x16')](function(_0x141440){_0x2d3060[_0x2357('0x28')]=_0x141440;return _0x2d3060;})['then'](respondWithFilteredResult(_0x4152f2,_0x4a1871))[_0x2357('0x29')](handleError(_0x4152f2,null));};exports[_0x2357('0x2a')]=function(_0x5c47fc,_0x142ea0){var _0x4a6ebf={'raw':!![],'where':{'id':_0x5c47fc[_0x2357('0x2b')]['id']}},_0x1dee4e={};_0x1dee4e[_0x2357('0x2c')]=_[_0x2357('0x2d')](db[_0x2357('0x20')][_0x2357('0x21')]);_0x1dee4e[_0x2357('0x27')]=_['keys'](_0x5c47fc[_0x2357('0x27')]);_0x1dee4e[_0x2357('0x2e')]=_[_0x2357('0x2f')](_0x1dee4e['model'],_0x1dee4e['query']);_0x4a6ebf[_0x2357('0x30')]=_[_0x2357('0x2f')](_0x1dee4e['model'],qs['fields'](_0x5c47fc[_0x2357('0x27')][_0x2357('0x31')]));_0x4a6ebf[_0x2357('0x30')]=_0x4a6ebf[_0x2357('0x30')]['length']?_0x4a6ebf['attributes']:_0x1dee4e[_0x2357('0x2c')];if(_0x5c47fc[_0x2357('0x27')]['includeAll']){_0x4a6ebf[_0x2357('0x26')]=[{'all':!![]}];}_0x4a6ebf=_[_0x2357('0x32')]({},_0x4a6ebf,_0x5c47fc['options']);return db[_0x2357('0x20')][_0x2357('0x33')](_0x4a6ebf)['then'](handleEntityNotFound(_0x142ea0,null))['then'](respondWithResult(_0x142ea0,null))['catch'](handleError(_0x142ea0,null));};exports[_0x2357('0x34')]=function(_0x307ccd,_0x54acdd){return db[_0x2357('0x20')]['create'](_0x307ccd[_0x2357('0x35')],{})[_0x2357('0x16')](function(_0x2a9d61){var _0x312b7a=_0x307ccd[_0x2357('0x36')][_0x2357('0x17')]({'plain':!![]});if(!_0x312b7a)throw new Error(_0x2357('0x37'));if(_0x312b7a[_0x2357('0x38')]===_0x2357('0x36')){var _0x57a31f=_0x2a9d61[_0x2357('0x17')]({'plain':!![]});var _0x123d10=_0x2357('0x18');return db[_0x2357('0x39')][_0x2357('0x33')]({'where':{'name':_0x123d10,'userProfileId':_0x312b7a[_0x2357('0x3a')]},'raw':!![]})[_0x2357('0x16')](function(_0x562db){if(_0x562db&&_0x562db[_0x2357('0x3b')]===0x0){return db[_0x2357('0x19')]['create']({'name':_0x57a31f['name'],'resourceId':_0x57a31f['id'],'type':_0x562db['name'],'sectionId':_0x562db['id']},{})[_0x2357('0x16')](function(){return _0x2a9d61;});}else{return _0x2a9d61;}})[_0x2357('0x29')](function(_0x344319){logger[_0x2357('0x1b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x344319);throw _0x344319;});}return _0x2a9d61;})['then'](respondWithResult(_0x54acdd,0xc9))['catch'](handleError(_0x54acdd,null));};exports['update']=function(_0x81f3c4,_0x52b724){if(_0x81f3c4[_0x2357('0x35')]['id']){delete _0x81f3c4[_0x2357('0x35')]['id'];}return db[_0x2357('0x20')][_0x2357('0x33')]({'where':{'id':_0x81f3c4[_0x2357('0x2b')]['id']}})[_0x2357('0x16')](handleEntityNotFound(_0x52b724,null))[_0x2357('0x16')](saveUpdates(_0x81f3c4[_0x2357('0x35')],null))[_0x2357('0x16')](respondWithResult(_0x52b724,null))[_0x2357('0x29')](handleError(_0x52b724,null));};exports[_0x2357('0x1a')]=function(_0x122d5d,_0x22bf00){return db['WhatsappQueue'][_0x2357('0x33')]({'where':{'id':_0x122d5d[_0x2357('0x2b')]['id']}})[_0x2357('0x16')](handleEntityNotFound(_0x22bf00,null))[_0x2357('0x16')](removeEntity(_0x22bf00,null))[_0x2357('0x29')](handleError(_0x22bf00,null));};exports[_0x2357('0x3c')]=function(_0x4ca473,_0x540e38){return db[_0x2357('0x20')]['describe']()[_0x2357('0x16')](respondWithResult(_0x540e38,null))[_0x2357('0x29')](handleError(_0x540e38,null));};exports[_0x2357('0x3d')]=function(_0x91f06,_0x41d6b0){var _0x520faa={'raw':!![],'where':{}},_0x5b7319={},_0x4fa082;return db[_0x2357('0x20')][_0x2357('0x3e')]({'where':{'id':_0x91f06[_0x2357('0x2b')]['id']}})[_0x2357('0x16')](handleEntityNotFound(_0x41d6b0,null))[_0x2357('0x16')](function(_0x3b5b21){if(_0x3b5b21){_0x4fa082=_0x3b5b21[_0x2357('0x17')]({'plain':!![]});_0x5b7319['model']=_[_0x2357('0x2d')](db[_0x2357('0x3f')][_0x2357('0x21')]);_0x5b7319[_0x2357('0x27')]=_[_0x2357('0x2d')](_0x91f06[_0x2357('0x27')]);_0x5b7319[_0x2357('0x2e')]=_['intersection'](_0x5b7319[_0x2357('0x2c')],_0x5b7319[_0x2357('0x27')]);_0x520faa[_0x2357('0x30')]=_[_0x2357('0x2f')](_0x5b7319[_0x2357('0x2c')],qs[_0x2357('0x31')](_0x91f06[_0x2357('0x27')][_0x2357('0x31')]));_0x520faa['attributes']=_0x520faa[_0x2357('0x30')][_0x2357('0x40')]?_0x520faa[_0x2357('0x30')]:_0x5b7319[_0x2357('0x2c')];if(!_0x91f06['query'][_0x2357('0x41')](_0x2357('0x42'))){_0x520faa[_0x2357('0x11')]=qs[_0x2357('0x11')](_0x91f06['query'][_0x2357('0x11')]);_0x520faa[_0x2357('0xf')]=qs[_0x2357('0xf')](_0x91f06[_0x2357('0x27')][_0x2357('0xf')]);}_0x520faa[_0x2357('0x43')]=qs[_0x2357('0x44')](_0x91f06[_0x2357('0x27')]['sort']);_0x520faa[_0x2357('0x25')]=qs[_0x2357('0x2e')](_[_0x2357('0x45')](_0x91f06[_0x2357('0x27')],_0x5b7319['filters']));_0x520faa['where'][_0x2357('0x46')]=_0x3b5b21['id'];if(_0x91f06['query'][_0x2357('0x47')]){_0x520faa[_0x2357('0x25')]=_[_0x2357('0x32')](_0x520faa[_0x2357('0x25')],{'$or':_[_0x2357('0x1f')](_0x520faa[_0x2357('0x30')],function(_0x3e0f22){var _0x2eccb7={};_0x2eccb7[_0x3e0f22]={'$like':'%'+_0x91f06['query'][_0x2357('0x47')]+'%'};return _0x2eccb7;})});}_0x520faa=_[_0x2357('0x32')]({},_0x520faa,_0x91f06[_0x2357('0x48')]);return db[_0x2357('0x3f')][_0x2357('0x49')](_0x520faa);}})['then'](function(_0x14b73a){if(_0x14b73a){return db[_0x2357('0x4a')][_0x2357('0x4b')]({'where':{'id':_[_0x2357('0x1f')](_0x14b73a,_0x2357('0x4c')),'role':'agent'},'attributes':['id',_0x2357('0x1d'),_0x2357('0x4d'),_0x2357('0x4e'),_0x2357('0x4f')]});}})[_0x2357('0x16')](function(_0x35982f){if(_0x35982f){return{'count':_0x35982f[_0x2357('0x12')],'rows':_['map'](_0x35982f['rows'],function(_0x4b2439){return{'membername':_0x4b2439[_0x2357('0x1d')],'UserId':_0x4b2439['id'],'queue_name':_0x4fa082[_0x2357('0x1d')],'WhatsappQueueId':_0x4fa082['id'],'interface':util[_0x2357('0x50')](_0x2357('0x51'),_0x2357('0x52'),_0x4b2439[_0x2357('0x1d')]),'penalty':0x0,'paused':_0x4b2439[_0x2357('0x4d')],'createdAt':_0x4b2439['createdAt'],'updatedAt':_0x4b2439['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x2357('0x16')](respondWithFilteredResult(_0x41d6b0,_0x520faa))['catch'](handleError(_0x41d6b0,null));};exports[_0x2357('0x53')]=function(_0x86293,_0x30efd6){var _0x241faf={};var _0x536558={};var _0x399b78;var _0x393faf;return db[_0x2357('0x20')][_0x2357('0x3e')]({'where':{'id':_0x86293[_0x2357('0x2b')]['id']}})[_0x2357('0x16')](handleEntityNotFound(_0x30efd6,null))['then'](function(_0x431666){if(_0x431666){_0x399b78=_0x431666;_0x536558[_0x2357('0x2c')]=_['keys'](db[_0x2357('0x54')][_0x2357('0x21')]);_0x536558[_0x2357('0x27')]=_['keys'](_0x86293['query']);_0x536558['filters']=_[_0x2357('0x2f')](_0x536558['model'],_0x536558[_0x2357('0x27')]);_0x241faf['attributes']=_[_0x2357('0x2f')](_0x536558[_0x2357('0x2c')],qs['fields'](_0x86293[_0x2357('0x27')]['fields']));_0x241faf[_0x2357('0x30')]=_0x241faf['attributes']['length']?_0x241faf[_0x2357('0x30')]:_0x536558[_0x2357('0x2c')];_0x241faf[_0x2357('0x43')]=qs['sort'](_0x86293['query'][_0x2357('0x44')]);_0x241faf[_0x2357('0x25')]=qs[_0x2357('0x2e')](_[_0x2357('0x45')](_0x86293[_0x2357('0x27')],_0x536558['filters']));if(_0x86293[_0x2357('0x27')][_0x2357('0x47')]){_0x241faf[_0x2357('0x25')]=_[_0x2357('0x32')](_0x241faf['where'],{'$or':_['map'](_0x241faf[_0x2357('0x30')],function(_0x120f48){var _0x1a2869={};_0x1a2869[_0x120f48]={'$like':'%'+_0x86293['query'][_0x2357('0x47')]+'%'};return _0x1a2869;})});}_0x241faf=_[_0x2357('0x32')]({},_0x241faf,_0x86293[_0x2357('0x48')]);return _0x399b78['getTeams'](_0x241faf);}})[_0x2357('0x16')](function(_0x3c3935){if(_0x3c3935){_0x393faf=_0x3c3935['length'];if(!_0x86293['query']['hasOwnProperty']('nolimit')){_0x241faf['limit']=qs[_0x2357('0x11')](_0x86293[_0x2357('0x27')][_0x2357('0x11')]);_0x241faf[_0x2357('0xf')]=qs[_0x2357('0xf')](_0x86293[_0x2357('0x27')][_0x2357('0xf')]);}return _0x399b78[_0x2357('0x53')](_0x241faf);}})[_0x2357('0x16')](function(_0x3536c1){if(_0x3536c1){return _0x3536c1?{'count':_0x393faf,'rows':_0x3536c1}:null;}})[_0x2357('0x16')](respondWithResult(_0x30efd6,null))[_0x2357('0x29')](handleError(_0x30efd6,null));};exports[_0x2357('0x55')]=function(_0xe0ab5e,_0x504df4){var _0xad4f31=_0xe0ab5e[_0x2357('0x35')][_0x2357('0x56')];return db[_0x2357('0x54')][_0x2357('0x49')]({'where':{'id':_0xad4f31},'attributes':['id'],'include':[{'model':db[_0x2357('0x4a')],'as':'Agents','attributes':['id',_0x2357('0x1d'),_0x2357('0x57'),_0x2357('0x58'),'interface'],'raw':!![]}]})[_0x2357('0x16')](function(_0x383e93){if(_0x383e93){var _0x81b271=_['flatMap'](_0x383e93,function(_0x549f80){var _0x183e6f=_0x549f80['get']({'plain':!![]});return _0x183e6f[_0x2357('0x59')];});return db[_0x2357('0x20')]['find']({'where':{'id':_0xe0ab5e[_0x2357('0x2b')]['id']}})[_0x2357('0x16')](function(_0x216297){return db[_0x2357('0x5a')][_0x2357('0x5b')](function(_0x5a92e3){return _0x216297[_0x2357('0x55')](_0xad4f31,{'transaction':_0x5a92e3})[_0x2357('0x16')](function(){return BPromise[_0x2357('0x5c')](_0x81b271,function(_0x1ecbec){return db[_0x2357('0x3f')][_0x2357('0x5d')]({'where':{'UserId':_0x1ecbec['id'],'WhatsappQueueId':_0xe0ab5e[_0x2357('0x2b')]['id']},'transaction':_0x5a92e3});});})[_0x2357('0x16')](function(){_0x81b271['forEach'](function(_0x4570bf){socket[_0x2357('0x5e')]('userWhatsappQueue:save',{'UserId':_0x4570bf['id'],'WhatsappQueueId':_0x216297['id']});});});});});}})['then'](respondWithStatusCode(_0x504df4,null))['catch'](handleError(_0x504df4,null));};exports['removeTeams']=function(_0x424b48,_0x24c73f){return db['Team'][_0x2357('0x49')]({'where':{'id':_0x424b48['query'][_0x2357('0x56')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x2357('0x59'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x24c73f,null))[_0x2357('0x16')](function(_0xa81aca){var _0x3e8e73=_[_0x2357('0x1f')](_0xa81aca,'id');var _0x360c78=[];var _0x34af76=[];var _0x5c08c4=squel[_0x2357('0x5f')]();_0x5c08c4[_0x2357('0x60')](_0x2357('0x61'))[_0x2357('0x62')](_0x2357('0x63'),'tq')[_0x2357('0x64')](_0x2357('0x65'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x2357('0x25')](_0x2357('0x66'),_0x424b48[_0x2357('0x2b')]['id']);for(var _0x3b6202=0x0;_0x3b6202<_0xa81aca['length'];_0x3b6202+=0x1){let _0x42bfb6=_0xa81aca[_0x3b6202];for(var _0x3555a3=0x0;_0x3555a3<_0x42bfb6[_0x2357('0x59')][_0x2357('0x40')];_0x3555a3+=0x1){let _0xf7d916=_0x42bfb6[_0x2357('0x59')][_0x3555a3];var _0x1577df=_0x5c08c4[_0x2357('0x67')]();_0x1577df[_0x2357('0x25')](_0x2357('0x68'),_0xf7d916['id']);_0x34af76['push'](db[_0x2357('0x5a')][_0x2357('0x27')](_0x1577df[_0x2357('0x69')](),{'type':db['sequelize'][_0x2357('0x6a')]['SELECT']})[_0x2357('0x16')](function(_0x1396b3){if(_0x1396b3['length']===0x1){return _0xf7d916['id'];}else{var _0x60e1ee=_[_0x2357('0x6b')](_[_0x2357('0x1f')](_0x1396b3,_0x2357('0x6c')),function(_0xd06bd4){return _[_0x2357('0x6d')](_0x3e8e73,_0xd06bd4);});if(_0x60e1ee){return _0xf7d916['id'];}}}));}}return BPromise[_0x2357('0x6e')](_0x34af76)[_0x2357('0x16')](function(_0x44a8c8){_0x360c78=_(_0x360c78)[_0x2357('0x6f')](_0x44a8c8)[_0x2357('0x70')]()['value']();return db[_0x2357('0x20')][_0x2357('0x33')]({'where':{'id':_0x424b48[_0x2357('0x2b')]['id']}})[_0x2357('0x16')](function(_0x5800c1){return db[_0x2357('0x5a')][_0x2357('0x5b')](function(_0x3f5047){return _0x5800c1['removeTeams'](_0x424b48[_0x2357('0x27')][_0x2357('0x56')],{'transaction':_0x3f5047})['then'](function(){if(!_[_0x2357('0x71')](_0x360c78)){return _0x5800c1[_0x2357('0x72')](_0x360c78,{'transaction':_0x3f5047});}})[_0x2357('0x16')](function(){_0x360c78[_0x2357('0x73')](function(_0x3194ca){socket[_0x2357('0x5e')](_0x2357('0x74'),{'UserId':_0x3194ca,'WhatsappQueueId':_0x5800c1['id']});});});});});});})['then'](respondWithStatusCode(_0x24c73f,null))[_0x2357('0x29')](handleError(_0x24c73f,null));};exports[_0x2357('0x75')]=function(_0x5109a8,_0x2f7d48){return db['WhatsappQueue'][_0x2357('0x33')]({'where':{'id':_0x5109a8[_0x2357('0x2b')]['id']}})[_0x2357('0x16')](handleEntityNotFound(_0x2f7d48,null))['then'](function(_0x3806c7){if(_0x3806c7){return _0x3806c7['addAgents'](_0x5109a8[_0x2357('0x35')][_0x2357('0x56')],_['omit'](_0x5109a8['body'],[_0x2357('0x56'),'id'])||{})[_0x2357('0x76')](function(_0x524ade){for(var _0x486afd=0x0;_0x486afd<_0x5109a8[_0x2357('0x35')][_0x2357('0x56')][_0x2357('0x40')];_0x486afd+=0x1){socket[_0x2357('0x5e')](_0x2357('0x77'),{'UserId':Number(_0x5109a8['body']['ids'][_0x486afd]),'WhatsappQueueId':Number(_0x5109a8[_0x2357('0x2b')]['id'])});}return _0x524ade;});}})[_0x2357('0x16')](respondWithResult(_0x2f7d48,null))[_0x2357('0x29')](handleError(_0x2f7d48,null));};exports['removeAgents']=function(_0x996e7e,_0x11beaa){return db['WhatsappQueue'][_0x2357('0x33')]({'where':{'id':_0x996e7e['params']['id']}})[_0x2357('0x16')](handleEntityNotFound(_0x11beaa,null))[_0x2357('0x16')](function(_0x52f5c9){if(_0x52f5c9){return _0x52f5c9[_0x2357('0x72')](_0x996e7e[_0x2357('0x27')]['ids'])[_0x2357('0x16')](function(){if(_[_0x2357('0x78')](_0x996e7e[_0x2357('0x27')][_0x2357('0x56')])){for(var _0x206a0d=0x0;_0x206a0d<_0x996e7e[_0x2357('0x27')][_0x2357('0x56')][_0x2357('0x40')];_0x206a0d+=0x1){socket[_0x2357('0x5e')](_0x2357('0x74'),{'UserId':Number(_0x996e7e[_0x2357('0x27')][_0x2357('0x56')][_0x206a0d]),'WhatsappQueueId':Number(_0x996e7e[_0x2357('0x2b')]['id'])});}}else{socket[_0x2357('0x5e')](_0x2357('0x74'),{'UserId':Number(_0x996e7e[_0x2357('0x27')][_0x2357('0x56')]),'WhatsappQueueId':Number(_0x996e7e[_0x2357('0x2b')]['id'])});}});}})[_0x2357('0x16')](respondWithStatusCode(_0x11beaa,null))[_0x2357('0x29')](handleError(_0x11beaa,null));};exports[_0x2357('0x79')]=function(_0x5940a8,_0x2688d9){var _0x3e2148={};var _0x30f37e={};var _0x19f224;var _0x519d45;return db[_0x2357('0x20')][_0x2357('0x3e')]({'where':{'id':_0x5940a8[_0x2357('0x2b')]['id']}})[_0x2357('0x16')](handleEntityNotFound(_0x2688d9,null))['then'](function(_0x4b9637){if(_0x4b9637){_0x19f224=_0x4b9637;_0x30f37e[_0x2357('0x2c')]=_[_0x2357('0x2d')](db['User'][_0x2357('0x21')]);_0x30f37e['query']=_[_0x2357('0x2d')](_0x5940a8['query']);_0x30f37e[_0x2357('0x2e')]=_[_0x2357('0x2f')](_0x30f37e[_0x2357('0x2c')],_0x30f37e[_0x2357('0x27')]);_0x3e2148['attributes']=_['intersection'](_0x30f37e['model'],qs['fields'](_0x5940a8[_0x2357('0x27')][_0x2357('0x31')]));_0x3e2148[_0x2357('0x30')]=_0x3e2148[_0x2357('0x30')][_0x2357('0x40')]?_0x3e2148[_0x2357('0x30')]:_0x30f37e[_0x2357('0x2c')];_0x3e2148[_0x2357('0x43')]=qs[_0x2357('0x44')](_0x5940a8[_0x2357('0x27')]['sort']);_0x3e2148['where']=qs[_0x2357('0x2e')](_[_0x2357('0x45')](_0x5940a8['query'],_0x30f37e[_0x2357('0x2e')]));if(_0x5940a8['query'][_0x2357('0x47')]){_0x3e2148[_0x2357('0x25')]=_['merge'](_0x3e2148['where'],{'$or':_['map'](_0x3e2148['attributes'],function(_0x2a0e18){var _0x41d683={};_0x41d683[_0x2a0e18]={'$like':'%'+_0x5940a8[_0x2357('0x27')]['filter']+'%'};return _0x41d683;})});}_0x3e2148=_['merge']({},_0x3e2148,_0x5940a8[_0x2357('0x48')]);return _0x19f224[_0x2357('0x79')](_0x3e2148);}})[_0x2357('0x16')](function(_0x507206){if(_0x507206){_0x519d45=_0x507206['length'];if(!_0x5940a8[_0x2357('0x27')][_0x2357('0x41')]('nolimit')){_0x3e2148['limit']=qs['limit'](_0x5940a8['query'][_0x2357('0x11')]);_0x3e2148[_0x2357('0xf')]=qs[_0x2357('0xf')](_0x5940a8[_0x2357('0x27')][_0x2357('0xf')]);}return _0x19f224[_0x2357('0x79')](_0x3e2148);}})['then'](function(_0x35153e){if(_0x35153e){return _0x35153e?{'count':_0x519d45,'rows':_0x35153e}:null;}})[_0x2357('0x16')](respondWithResult(_0x2688d9,null))['catch'](handleError(_0x2688d9,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index 4276fc5..7941981 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 _0xdfa2=['update','emit','hook','exports','events','../../mysqldb','WhatsappQueue','setMaxListeners','save'];(function(_0x36a469,_0x59d84c){var _0x3347fc=function(_0x3860e7){while(--_0x3860e7){_0x36a469['push'](_0x36a469['shift']());}};_0x3347fc(++_0x59d84c);}(_0xdfa2,0x187));var _0x2dfa=function(_0x14ee9f,_0x346b12){_0x14ee9f=_0x14ee9f-0x0;var _0x3b69ba=_0xdfa2[_0x14ee9f];return _0x3b69ba;};'use strict';var EventEmitter=require(_0x2dfa('0x0'));var WhatsappQueue=require(_0x2dfa('0x1'))['db'][_0x2dfa('0x2')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0x2dfa('0x3')](0x0);var events={'afterCreate':_0x2dfa('0x4'),'afterUpdate':_0x2dfa('0x5'),'afterDestroy':'remove'};function emitEvent(_0x4995c3){return function(_0x251a16,_0x33ffdf,_0xd4a517){WhatsappQueueEvents[_0x2dfa('0x6')](_0x4995c3+':'+_0x251a16['id'],_0x251a16);WhatsappQueueEvents['emit'](_0x4995c3,_0x251a16);_0xd4a517(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappQueue[_0x2dfa('0x7')](e,emitEvent(event));}}module[_0x2dfa('0x8')]=WhatsappQueueEvents; \ No newline at end of file +var _0x0f8f=['setMaxListeners','save','update','remove','emit','hook','exports','events'];(function(_0x205722,_0x211278){var _0x4da59c=function(_0x3e070e){while(--_0x3e070e){_0x205722['push'](_0x205722['shift']());}};_0x4da59c(++_0x211278);}(_0x0f8f,0x1af));var _0xf0f8=function(_0x3d9176,_0x399d6f){_0x3d9176=_0x3d9176-0x0;var _0x12adc5=_0x0f8f[_0x3d9176];return _0x12adc5;};'use strict';var EventEmitter=require(_0xf0f8('0x0'));var WhatsappQueue=require('../../mysqldb')['db']['WhatsappQueue'];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0xf0f8('0x1')](0x0);var events={'afterCreate':_0xf0f8('0x2'),'afterUpdate':_0xf0f8('0x3'),'afterDestroy':_0xf0f8('0x4')};function emitEvent(_0x437b4e){return function(_0x8df88d,_0x59ebe2,_0x2b4b83){WhatsappQueueEvents[_0xf0f8('0x5')](_0x437b4e+':'+_0x8df88d['id'],_0x8df88d);WhatsappQueueEvents['emit'](_0x437b4e,_0x8df88d);_0x2b4b83(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappQueue[_0xf0f8('0x6')](e,emitEvent(event));}}module[_0xf0f8('0x7')]=WhatsappQueueEvents; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.model.js b/server/api/whatsappQueue/whatsappQueue.model.js index f3a568e..11ceaca 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 _0xca4e=['util','../../config/logger','api','moment','bluebird','path','./whatsappQueue.attributes','exports','define','whatsapp_queues','lodash'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xca4e,0x1e3));var _0xeca4=function(_0x51acb8,_0x345f17){_0x51acb8=_0x51acb8-0x0;var _0x325396=_0xca4e[_0x51acb8];return _0x325396;};'use strict';var _=require(_0xeca4('0x0'));var util=require(_0xeca4('0x1'));var logger=require(_0xeca4('0x2'))(_0xeca4('0x3'));var moment=require(_0xeca4('0x4'));var BPromise=require(_0xeca4('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xeca4('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xeca4('0x7'));module[_0xeca4('0x8')]=function(_0x59e6ec,_0x21d80e){return _0x59e6ec[_0xeca4('0x9')]('WhatsappQueue',attributes,{'tableName':_0xeca4('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfc24=['rimraf','../../config/environment','./whatsappQueue.attributes','define','WhatsappQueue','whatsapp_queues','lodash','../../config/logger','api','moment','request-promise','path'];(function(_0x231b2e,_0x2a33f9){var _0x3feb2a=function(_0x5aa472){while(--_0x5aa472){_0x231b2e['push'](_0x231b2e['shift']());}};_0x3feb2a(++_0x2a33f9);}(_0xfc24,0x132));var _0x4fc2=function(_0x10f6e8,_0x351db6){_0x10f6e8=_0x10f6e8-0x0;var _0x35bb3c=_0xfc24[_0x10f6e8];return _0x35bb3c;};'use strict';var _=require(_0x4fc2('0x0'));var util=require('util');var logger=require(_0x4fc2('0x1'))(_0x4fc2('0x2'));var moment=require(_0x4fc2('0x3'));var BPromise=require('bluebird');var rp=require(_0x4fc2('0x4'));var fs=require('fs');var path=require(_0x4fc2('0x5'));var rimraf=require(_0x4fc2('0x6'));var config=require(_0x4fc2('0x7'));var attributes=require(_0x4fc2('0x8'));module['exports']=function(_0x552f4e,_0x240b3c){return _0x552f4e[_0x4fc2('0x9')](_0x4fc2('0xa'),attributes,{'tableName':_0x4fc2('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.rpc.js b/server/api/whatsappQueue/whatsappQueue.rpc.js index f8a5a5f..947aba2 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 _0x5b43=['request\x20sent','WhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','code','error','WhatsappQueue,\x20%s,\x20%s','message','result','catch','GetWhatsappQueue','findAll','options','attributes','limit','include','model','info','debug','ShowWhatsappQueue','WhatsappQueue','find','raw','where','map','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./whatsappQueue.socket','register','request','then'];(function(_0x3826ad,_0x49a30d){var _0x17b900=function(_0x38474f){while(--_0x38474f){_0x3826ad['push'](_0x3826ad['shift']());}};_0x17b900(++_0x49a30d);}(_0x5b43,0x1f1));var _0x35b4=function(_0x51feb8,_0x111afa){_0x51feb8=_0x51feb8-0x0;var _0xdc900e=_0x5b43[_0x51feb8];return _0xdc900e;};'use strict';var _=require(_0x35b4('0x0'));var util=require(_0x35b4('0x1'));var moment=require(_0x35b4('0x2'));var BPromise=require(_0x35b4('0x3'));var rs=require(_0x35b4('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x35b4('0x5'))['db'];var utils=require(_0x35b4('0x6'));var logger=require('../../config/logger')(_0x35b4('0x7'));var config=require(_0x35b4('0x8'));var jayson=require(_0x35b4('0x9'));var client=jayson[_0x35b4('0xa')][_0x35b4('0xb')]({'port':0x232a});config[_0x35b4('0xc')]=_['defaults'](config['redis'],{'host':_0x35b4('0xd'),'port':0x18eb});var socket=require(_0x35b4('0xe'))(new Redis(config['redis']));require(_0x35b4('0xf'))[_0x35b4('0x10')](socket);function respondWithRpcPromise(_0x58cb5d,_0x507700,_0x4c9a8a){return new BPromise(function(_0x40efb5,_0x8a232){return client[_0x35b4('0x11')](_0x58cb5d,_0x4c9a8a)[_0x35b4('0x12')](function(_0x9e4126){logger['info']('WhatsappQueue,\x20%s,\x20%s',_0x507700,_0x35b4('0x13'));logger['debug'](_0x35b4('0x14'),_0x507700,_0x35b4('0x13'),JSON[_0x35b4('0x15')](_0x9e4126));if(_0x9e4126['error']){if(_0x9e4126['error'][_0x35b4('0x16')]===0x1f4){logger[_0x35b4('0x17')](_0x35b4('0x18'),_0x507700,_0x9e4126[_0x35b4('0x17')][_0x35b4('0x19')]);return _0x8a232(_0x9e4126['error']['message']);}logger[_0x35b4('0x17')]('WhatsappQueue,\x20%s,\x20%s',_0x507700,_0x9e4126[_0x35b4('0x17')][_0x35b4('0x19')]);return _0x40efb5(_0x9e4126[_0x35b4('0x17')][_0x35b4('0x19')]);}else{logger['info'](_0x35b4('0x18'),_0x507700,_0x35b4('0x13'));_0x40efb5(_0x9e4126[_0x35b4('0x1a')][_0x35b4('0x19')]);}})[_0x35b4('0x1b')](function(_0x12c4bf){logger[_0x35b4('0x17')](_0x35b4('0x18'),_0x507700,_0x12c4bf);_0x8a232(_0x12c4bf);});});}exports[_0x35b4('0x1c')]=function(_0x2f5234){var _0x64e748=this;return new Promise(function(_0x27c19e,_0x57bafc){return db['WhatsappQueue'][_0x35b4('0x1d')]({'raw':_0x2f5234[_0x35b4('0x1e')]?_0x2f5234[_0x35b4('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x2f5234[_0x35b4('0x1e')]?_0x2f5234[_0x35b4('0x1e')]['where']||null:null,'attributes':_0x2f5234[_0x35b4('0x1e')]?_0x2f5234['options'][_0x35b4('0x1f')]||null:null,'limit':_0x2f5234[_0x35b4('0x1e')]?_0x2f5234[_0x35b4('0x1e')][_0x35b4('0x20')]||null:null,'include':_0x2f5234[_0x35b4('0x1e')]?_0x2f5234[_0x35b4('0x1e')][_0x35b4('0x21')]?_['map'](_0x2f5234['options'][_0x35b4('0x21')],function(_0x537e58){return{'model':db[_0x537e58[_0x35b4('0x22')]],'as':_0x537e58['as'],'attributes':_0x537e58[_0x35b4('0x1f')],'include':_0x537e58['include']?_['map'](_0x537e58[_0x35b4('0x21')],function(_0x17fc1f){return{'model':db[_0x17fc1f[_0x35b4('0x22')]],'as':_0x17fc1f['as'],'attributes':_0x17fc1f['attributes'],'include':_0x17fc1f[_0x35b4('0x21')]?_['map'](_0x17fc1f[_0x35b4('0x21')],function(_0x5cba2b){return{'model':db[_0x5cba2b[_0x35b4('0x22')]],'as':_0x5cba2b['as'],'attributes':_0x5cba2b[_0x35b4('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x35b4('0x12')](function(_0x39391a){logger[_0x35b4('0x23')]('GetWhatsappQueue',_0x2f5234);logger[_0x35b4('0x24')](_0x35b4('0x1c'),_0x2f5234,JSON['stringify'](_0x39391a));_0x27c19e(_0x39391a);})['catch'](function(_0x2ca3e2){logger[_0x35b4('0x17')](_0x35b4('0x1c'),_0x2ca3e2[_0x35b4('0x19')],_0x2f5234);_0x57bafc(_0x64e748[_0x35b4('0x17')](0x1f4,_0x2ca3e2[_0x35b4('0x19')]));});});};exports[_0x35b4('0x25')]=function(_0x500e1f){var _0x37ba10=this;return new Promise(function(_0x1204ad,_0x3bd4b5){return db[_0x35b4('0x26')][_0x35b4('0x27')]({'raw':_0x500e1f['options']?_0x500e1f[_0x35b4('0x1e')][_0x35b4('0x28')]===undefined?!![]:![]:!![],'where':_0x500e1f[_0x35b4('0x1e')]?_0x500e1f[_0x35b4('0x1e')][_0x35b4('0x29')]||null:null,'attributes':_0x500e1f[_0x35b4('0x1e')]?_0x500e1f[_0x35b4('0x1e')][_0x35b4('0x1f')]||null:null,'include':_0x500e1f[_0x35b4('0x1e')]?_0x500e1f[_0x35b4('0x1e')][_0x35b4('0x21')]?_['map'](_0x500e1f['options']['include'],function(_0x421ca5){return{'model':db[_0x421ca5[_0x35b4('0x22')]],'as':_0x421ca5['as'],'attributes':_0x421ca5[_0x35b4('0x1f')],'include':_0x421ca5[_0x35b4('0x21')]?_['map'](_0x421ca5[_0x35b4('0x21')],function(_0x1d03c2){return{'model':db[_0x1d03c2['model']],'as':_0x1d03c2['as'],'attributes':_0x1d03c2[_0x35b4('0x1f')],'include':_0x1d03c2['include']?_[_0x35b4('0x2a')](_0x1d03c2[_0x35b4('0x21')],function(_0x14a87e){return{'model':db[_0x14a87e['model']],'as':_0x14a87e['as'],'attributes':_0x14a87e[_0x35b4('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x21ed73){logger[_0x35b4('0x23')](_0x35b4('0x25'),_0x500e1f);logger[_0x35b4('0x24')]('ShowWhatsappQueue',_0x500e1f,JSON['stringify'](_0x21ed73));_0x1204ad(_0x21ed73);})['catch'](function(_0x4071f1){logger['error']('ShowWhatsappQueue',_0x4071f1[_0x35b4('0x19')],_0x500e1f);_0x3bd4b5(_0x37ba10[_0x35b4('0x17')](0x1f4,_0x4071f1[_0x35b4('0x19')]));});});}; \ No newline at end of file +var _0xe480=['catch','GetWhatsappQueue','findAll','options','raw','where','attributes','limit','model','include','map','ShowWhatsappQueue','find','then','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','redis','defaults','localhost','socket.io-emitter','./whatsappQueue.socket','register','request','info','request\x20sent','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappQueue,\x20%s,\x20%s','message','result'];(function(_0x11b516,_0x556ecb){var _0x98b5d8=function(_0x1372d){while(--_0x1372d){_0x11b516['push'](_0x11b516['shift']());}};_0x98b5d8(++_0x556ecb);}(_0xe480,0x89));var _0x0e48=function(_0x4be445,_0x590c14){_0x4be445=_0x4be445-0x0;var _0x3557d6=_0xe480[_0x4be445];return _0x3557d6;};'use strict';var _=require(_0x0e48('0x0'));var util=require('util');var moment=require(_0x0e48('0x1'));var BPromise=require(_0x0e48('0x2'));var rs=require(_0x0e48('0x3'));var fs=require('fs');var Redis=require(_0x0e48('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x0e48('0x5'));var logger=require(_0x0e48('0x6'))(_0x0e48('0x7'));var config=require(_0x0e48('0x8'));var jayson=require(_0x0e48('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0x0e48('0xa')]=_[_0x0e48('0xb')](config[_0x0e48('0xa')],{'host':_0x0e48('0xc'),'port':0x18eb});var socket=require(_0x0e48('0xd'))(new Redis(config[_0x0e48('0xa')]));require(_0x0e48('0xe'))[_0x0e48('0xf')](socket);function respondWithRpcPromise(_0x165eab,_0x1c4ba7,_0x1aec59){return new BPromise(function(_0x1f06d7,_0x45a2b6){return client[_0x0e48('0x10')](_0x165eab,_0x1aec59)['then'](function(_0x5253bd){logger[_0x0e48('0x11')]('WhatsappQueue,\x20%s,\x20%s',_0x1c4ba7,_0x0e48('0x12'));logger[_0x0e48('0x13')](_0x0e48('0x14'),_0x1c4ba7,'request\x20sent',JSON[_0x0e48('0x15')](_0x5253bd));if(_0x5253bd[_0x0e48('0x16')]){if(_0x5253bd[_0x0e48('0x16')][_0x0e48('0x17')]===0x1f4){logger['error'](_0x0e48('0x18'),_0x1c4ba7,_0x5253bd[_0x0e48('0x16')][_0x0e48('0x19')]);return _0x45a2b6(_0x5253bd[_0x0e48('0x16')][_0x0e48('0x19')]);}logger[_0x0e48('0x16')](_0x0e48('0x18'),_0x1c4ba7,_0x5253bd[_0x0e48('0x16')][_0x0e48('0x19')]);return _0x1f06d7(_0x5253bd['error'][_0x0e48('0x19')]);}else{logger['info'](_0x0e48('0x18'),_0x1c4ba7,_0x0e48('0x12'));_0x1f06d7(_0x5253bd[_0x0e48('0x1a')][_0x0e48('0x19')]);}})[_0x0e48('0x1b')](function(_0x16f5cb){logger['error']('WhatsappQueue,\x20%s,\x20%s',_0x1c4ba7,_0x16f5cb);_0x45a2b6(_0x16f5cb);});});}exports[_0x0e48('0x1c')]=function(_0x35468b){var _0x2dd8af=this;return new Promise(function(_0x4a0453,_0x36ae5a){return db['WhatsappQueue'][_0x0e48('0x1d')]({'raw':_0x35468b[_0x0e48('0x1e')]?_0x35468b[_0x0e48('0x1e')][_0x0e48('0x1f')]===undefined?!![]:![]:!![],'where':_0x35468b[_0x0e48('0x1e')]?_0x35468b['options'][_0x0e48('0x20')]||null:null,'attributes':_0x35468b[_0x0e48('0x1e')]?_0x35468b[_0x0e48('0x1e')][_0x0e48('0x21')]||null:null,'limit':_0x35468b[_0x0e48('0x1e')]?_0x35468b['options'][_0x0e48('0x22')]||null:null,'include':_0x35468b[_0x0e48('0x1e')]?_0x35468b[_0x0e48('0x1e')]['include']?_['map'](_0x35468b[_0x0e48('0x1e')]['include'],function(_0x2ff6ba){return{'model':db[_0x2ff6ba[_0x0e48('0x23')]],'as':_0x2ff6ba['as'],'attributes':_0x2ff6ba[_0x0e48('0x21')],'include':_0x2ff6ba[_0x0e48('0x24')]?_['map'](_0x2ff6ba['include'],function(_0x498de6){return{'model':db[_0x498de6[_0x0e48('0x23')]],'as':_0x498de6['as'],'attributes':_0x498de6['attributes'],'include':_0x498de6[_0x0e48('0x24')]?_[_0x0e48('0x25')](_0x498de6['include'],function(_0x1eb87e){return{'model':db[_0x1eb87e['model']],'as':_0x1eb87e['as'],'attributes':_0x1eb87e[_0x0e48('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x93ea1d){logger['info'](_0x0e48('0x1c'),_0x35468b);logger[_0x0e48('0x13')](_0x0e48('0x1c'),_0x35468b,JSON[_0x0e48('0x15')](_0x93ea1d));_0x4a0453(_0x93ea1d);})[_0x0e48('0x1b')](function(_0x4d8745){logger[_0x0e48('0x16')](_0x0e48('0x1c'),_0x4d8745[_0x0e48('0x19')],_0x35468b);_0x36ae5a(_0x2dd8af[_0x0e48('0x16')](0x1f4,_0x4d8745[_0x0e48('0x19')]));});});};exports[_0x0e48('0x26')]=function(_0x40d992){var _0x5be978=this;return new Promise(function(_0x3137bd,_0x357973){return db['WhatsappQueue'][_0x0e48('0x27')]({'raw':_0x40d992[_0x0e48('0x1e')]?_0x40d992['options'][_0x0e48('0x1f')]===undefined?!![]:![]:!![],'where':_0x40d992['options']?_0x40d992['options'][_0x0e48('0x20')]||null:null,'attributes':_0x40d992['options']?_0x40d992[_0x0e48('0x1e')]['attributes']||null:null,'include':_0x40d992['options']?_0x40d992[_0x0e48('0x1e')][_0x0e48('0x24')]?_[_0x0e48('0x25')](_0x40d992[_0x0e48('0x1e')][_0x0e48('0x24')],function(_0x5be415){return{'model':db[_0x5be415[_0x0e48('0x23')]],'as':_0x5be415['as'],'attributes':_0x5be415[_0x0e48('0x21')],'include':_0x5be415['include']?_[_0x0e48('0x25')](_0x5be415['include'],function(_0x15650f){return{'model':db[_0x15650f[_0x0e48('0x23')]],'as':_0x15650f['as'],'attributes':_0x15650f[_0x0e48('0x21')],'include':_0x15650f[_0x0e48('0x24')]?_[_0x0e48('0x25')](_0x15650f[_0x0e48('0x24')],function(_0x42c99a){return{'model':db[_0x42c99a[_0x0e48('0x23')]],'as':_0x42c99a['as'],'attributes':_0x42c99a['attributes']};}):[]};}):[]};}):[]:[]})[_0x0e48('0x28')](function(_0x4c531e){logger[_0x0e48('0x11')](_0x0e48('0x26'),_0x40d992);logger[_0x0e48('0x13')](_0x0e48('0x26'),_0x40d992,JSON['stringify'](_0x4c531e));_0x3137bd(_0x4c531e);})[_0x0e48('0x1b')](function(_0x5e8ed5){logger[_0x0e48('0x16')](_0x0e48('0x26'),_0x5e8ed5['message'],_0x40d992);_0x357973(_0x5be978['error'](0x1f4,_0x5e8ed5[_0x0e48('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index a6f7d3c..0ee48ae 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 _0x5b63=['emit','register','length','whatsappQueue:','save','update'];(function(_0x353b9d,_0x2c89df){var _0x22fde7=function(_0x102e86){while(--_0x102e86){_0x353b9d['push'](_0x353b9d['shift']());}};_0x22fde7(++_0x2c89df);}(_0x5b63,0x172));var _0x35b6=function(_0x4ddd4a,_0x23cae2){_0x4ddd4a=_0x4ddd4a-0x0;var _0x13c9aa=_0x5b63[_0x4ddd4a];return _0x13c9aa;};'use strict';var WhatsappQueueEvents=require('./whatsappQueue.events');var events=[_0x35b6('0x0'),'remove',_0x35b6('0x1')];function createListener(_0x177b07,_0x3ab9c7){return function(_0x716024){_0x3ab9c7[_0x35b6('0x2')](_0x177b07,_0x716024);};}function removeListener(_0x34860c,_0x2a8eec){return function(){WhatsappQueueEvents['removeListener'](_0x34860c,_0x2a8eec);};}exports[_0x35b6('0x3')]=function(_0xd1f042){for(var _0x4fbcb2=0x0,_0x2e62ba=events[_0x35b6('0x4')];_0x4fbcb2<_0x2e62ba;_0x4fbcb2++){var _0x4bf573=events[_0x4fbcb2];var _0x24ee09=createListener(_0x35b6('0x5')+_0x4bf573,_0xd1f042);WhatsappQueueEvents['on'](_0x4bf573,_0x24ee09);}}; \ No newline at end of file +var _0x3c6e=['register','length','whatsappQueue:','./whatsappQueue.events','save','remove','emit','removeListener'];(function(_0x2515db,_0x2715c){var _0x4d69dc=function(_0x346630){while(--_0x346630){_0x2515db['push'](_0x2515db['shift']());}};_0x4d69dc(++_0x2715c);}(_0x3c6e,0x16b));var _0xe3c6=function(_0x41c63b,_0x5be343){_0x41c63b=_0x41c63b-0x0;var _0x16ca9f=_0x3c6e[_0x41c63b];return _0x16ca9f;};'use strict';var WhatsappQueueEvents=require(_0xe3c6('0x0'));var events=[_0xe3c6('0x1'),_0xe3c6('0x2'),'update'];function createListener(_0x40ecb1,_0x4fb62d){return function(_0x276cdb){_0x4fb62d[_0xe3c6('0x3')](_0x40ecb1,_0x276cdb);};}function removeListener(_0x15392d,_0x22fe2e){return function(){WhatsappQueueEvents[_0xe3c6('0x4')](_0x15392d,_0x22fe2e);};}exports[_0xe3c6('0x5')]=function(_0x18a1d4){for(var _0x5190c2=0x0,_0x58bb94=events[_0xe3c6('0x6')];_0x5190c2<_0x58bb94;_0x5190c2++){var _0x4cd1e4=events[_0x5190c2];var _0x23b757=createListener(_0xe3c6('0x7')+_0x4cd1e4,_0x18a1d4);WhatsappQueueEvents['on'](_0x4cd1e4,_0x23b757);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index bda32b7..e83ca85 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 _0x3e10=['put','delete','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0x3e10,0x1a4));var _0x03e1=function(_0x78306e,_0xe7d336){_0x78306e=_0x78306e-0x0;var _0x3da728=_0x3e10[_0x78306e];return _0x3da728;};'use strict';var multer=require('multer');var util=require(_0x03e1('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x03e1('0x1'));var router=express[_0x03e1('0x2')]();var fs_extra=require(_0x03e1('0x3'));var auth=require(_0x03e1('0x4'));var interaction=require(_0x03e1('0x5'));var config=require(_0x03e1('0x6'));var controller=require(_0x03e1('0x7'));router[_0x03e1('0x8')]('/',auth[_0x03e1('0x9')](),controller[_0x03e1('0xa')]);router[_0x03e1('0x8')](_0x03e1('0xb'),auth[_0x03e1('0x9')](),controller[_0x03e1('0xc')]);router[_0x03e1('0x8')](_0x03e1('0xd'),auth['isAuthenticated'](),controller[_0x03e1('0xe')]);router[_0x03e1('0xf')]('/',auth[_0x03e1('0x9')](),controller[_0x03e1('0x10')]);router[_0x03e1('0x11')](_0x03e1('0xd'),auth[_0x03e1('0x9')](),controller['update']);router[_0x03e1('0x12')](_0x03e1('0xd'),auth[_0x03e1('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xfe7b=['delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueueReport.controller','isAuthenticated','index','get','/describe','describe','/:id','show','post','create','put'];(function(_0x905c53,_0x34c448){var _0x3b334e=function(_0x226b8e){while(--_0x226b8e){_0x905c53['push'](_0x905c53['shift']());}};_0x3b334e(++_0x34c448);}(_0xfe7b,0x8d));var _0xbfe7=function(_0x51bda1,_0x44f80d){_0x51bda1=_0x51bda1-0x0;var _0x1ce08c=_0xfe7b[_0x51bda1];return _0x1ce08c;};'use strict';var multer=require(_0xbfe7('0x0'));var util=require(_0xbfe7('0x1'));var path=require(_0xbfe7('0x2'));var timeout=require(_0xbfe7('0x3'));var express=require('express');var router=express[_0xbfe7('0x4')]();var fs_extra=require(_0xbfe7('0x5'));var auth=require(_0xbfe7('0x6'));var interaction=require(_0xbfe7('0x7'));var config=require(_0xbfe7('0x8'));var controller=require(_0xbfe7('0x9'));router['get']('/',auth[_0xbfe7('0xa')](),controller[_0xbfe7('0xb')]);router[_0xbfe7('0xc')](_0xbfe7('0xd'),auth[_0xbfe7('0xa')](),controller[_0xbfe7('0xe')]);router[_0xbfe7('0xc')](_0xbfe7('0xf'),auth[_0xbfe7('0xa')](),controller[_0xbfe7('0x10')]);router[_0xbfe7('0x11')]('/',auth[_0xbfe7('0xa')](),controller[_0xbfe7('0x12')]);router[_0xbfe7('0x13')](_0xbfe7('0xf'),auth['isAuthenticated'](),controller['update']);router[_0xbfe7('0x14')](_0xbfe7('0xf'),auth['isAuthenticated'](),controller[_0xbfe7('0x15')]);module[_0xbfe7('0x16')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js index d56878d..0a7598d 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(_0x240460,_0x426f69){var _0x30b289=function(_0x19b8ba){while(--_0x19b8ba){_0x240460['push'](_0x240460['shift']());}};_0x30b289(++_0x426f69);}(_0x7a54,0x106));var _0x47a5=function(_0x464e16,_0x3ec8f7){_0x464e16=_0x464e16-0x0;var _0x59d8a1=_0x7a54[_0x464e16];return _0x59d8a1;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'uniqueid':{'type':Sequelize[_0x47a5('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x47a5('0x3')]},'leaveAt':{'type':Sequelize[_0x47a5('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x47a5('0x3')]},'reason':{'type':Sequelize[_0x47a5('0x2')]}}; \ No newline at end of file +var _0x9957=['exports','STRING','DATE','sequelize'];(function(_0x742f0c,_0x464bcb){var _0x1e87dc=function(_0x24a875){while(--_0x24a875){_0x742f0c['push'](_0x742f0c['shift']());}};_0x1e87dc(++_0x464bcb);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'uniqueid':{'type':Sequelize[_0x7995('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x7995('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x7995('0x3')]},'acceptAt':{'type':Sequelize[_0x7995('0x3')]},'exitAt':{'type':Sequelize[_0x7995('0x3')]},'reason':{'type':Sequelize[_0x7995('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.controller.js b/server/api/whatsappQueueReport/whatsappQueueReport.controller.js index fd4c9dd..2971956 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 _0xbaf0=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','error','stack','name','send','index','map','WhatsappQueueReport','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','then','includeAll','include','findAll','rows','show','params','find','catch','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x377ead,_0x33321c){var _0x135bc3=function(_0x19491c){while(--_0x19491c){_0x377ead['push'](_0x377ead['shift']());}};_0x135bc3(++_0x33321c);}(_0xbaf0,0x12a));var _0x0baf=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xbaf0[_0x1facfa];return _0x9ec701;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0baf('0x0'));var zipdir=require(_0x0baf('0x1'));var jsonpatch=require(_0x0baf('0x2'));var rp=require(_0x0baf('0x3'));var moment=require(_0x0baf('0x4'));var BPromise=require(_0x0baf('0x5'));var Mustache=require('mustache');var util=require(_0x0baf('0x6'));var path=require(_0x0baf('0x7'));var sox=require(_0x0baf('0x8'));var csv=require(_0x0baf('0x9'));var ejs=require(_0x0baf('0xa'));var fs=require('fs');var fs_extra=require(_0x0baf('0xb'));var _=require(_0x0baf('0xc'));var squel=require(_0x0baf('0xd'));var crypto=require(_0x0baf('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x0baf('0xf'));var toCsv=require('to-csv');var querystring=require(_0x0baf('0x10'));var Papa=require(_0x0baf('0x11'));var Redis=require(_0x0baf('0x12'));var authService=require(_0x0baf('0x13'));var qs=require(_0x0baf('0x14'));var as=require(_0x0baf('0x15'));var hardwareService=require(_0x0baf('0x16'));var logger=require(_0x0baf('0x17'))(_0x0baf('0x18'));var utils=require(_0x0baf('0x19'));var config=require(_0x0baf('0x1a'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x465dd7,_0xe4378c){_0xe4378c=_0xe4378c||0xcc;return function(_0x5db689){if(_0x5db689){return _0x465dd7[_0x0baf('0x1b')](_0xe4378c);}return _0x465dd7['status'](_0xe4378c)[_0x0baf('0x1c')]();};}function respondWithResult(_0x49e44b,_0x1c76a8){_0x1c76a8=_0x1c76a8||0xc8;return function(_0x1f50c3){if(_0x1f50c3){return _0x49e44b[_0x0baf('0x1d')](_0x1c76a8)[_0x0baf('0x1e')](_0x1f50c3);}};}function respondWithFilteredResult(_0xb8339e,_0x469599){return function(_0x4f80a8){if(_0x4f80a8){var _0x4cd79d=typeof _0x469599[_0x0baf('0x1f')]===_0x0baf('0x20')&&typeof _0x469599[_0x0baf('0x21')]===_0x0baf('0x20');var _0x2cf7da=_0x4f80a8[_0x0baf('0x22')];var _0x53c338=_0x4cd79d?0x0:_0x469599[_0x0baf('0x1f')];var _0xfbecec=_0x4cd79d?_0x4f80a8[_0x0baf('0x22')]:_0x469599[_0x0baf('0x1f')]+_0x469599[_0x0baf('0x21')];var _0x42b7f2;if(_0xfbecec>=_0x2cf7da){_0xfbecec=_0x2cf7da;_0x42b7f2=0xc8;}else{_0x42b7f2=0xce;}_0xb8339e['status'](_0x42b7f2);return _0xb8339e['set'](_0x0baf('0x23'),_0x53c338+'-'+_0xfbecec+'/'+_0x2cf7da)[_0x0baf('0x1e')](_0x4f80a8);}return null;};}function patchUpdates(_0x32e839){return function(_0x1848e8){try{jsonpatch[_0x0baf('0x24')](_0x1848e8,_0x32e839,!![]);}catch(_0x3e3e20){return BPromise[_0x0baf('0x25')](_0x3e3e20);}return _0x1848e8[_0x0baf('0x26')]();};}function saveUpdates(_0x2c42e2,_0x15a2c3){return function(_0x54f2fa){if(_0x54f2fa){return _0x54f2fa[_0x0baf('0x27')](_0x2c42e2)['then'](function(_0xf6c158){return _0xf6c158;});}return null;};}function removeEntity(_0x5dbf00,_0x4de74c){return function(_0x2ef0aa){if(_0x2ef0aa){return _0x2ef0aa['destroy']()['then'](function(){_0x5dbf00[_0x0baf('0x1d')](0xcc)[_0x0baf('0x1c')]();});}};}function handleEntityNotFound(_0x34e264,_0x19d9fd){return function(_0x3a1ba1){if(!_0x3a1ba1){_0x34e264['sendStatus'](0x194);}return _0x3a1ba1;};}function handleError(_0x448617,_0x4681c5){_0x4681c5=_0x4681c5||0x1f4;return function(_0x1ca35a){logger[_0x0baf('0x28')](_0x1ca35a[_0x0baf('0x29')]);if(_0x1ca35a[_0x0baf('0x2a')]){delete _0x1ca35a[_0x0baf('0x2a')];}_0x448617['status'](_0x4681c5)[_0x0baf('0x2b')](_0x1ca35a);};}exports[_0x0baf('0x2c')]=function(_0xcaf13d,_0x265915){var _0x55c715={},_0x29dbdf={},_0x34a58a={'count':0x0,'rows':[]};var _0x5d9d7f=_[_0x0baf('0x2d')](db[_0x0baf('0x2e')][_0x0baf('0x2f')],function(_0xb4dbb1){return{'name':_0xb4dbb1[_0x0baf('0x30')],'type':_0xb4dbb1[_0x0baf('0x31')][_0x0baf('0x32')]};});_0x29dbdf['model']=_[_0x0baf('0x2d')](_0x5d9d7f,_0x0baf('0x2a'));_0x29dbdf[_0x0baf('0x33')]=_[_0x0baf('0x34')](_0xcaf13d[_0x0baf('0x33')]);_0x29dbdf[_0x0baf('0x35')]=_[_0x0baf('0x36')](_0x29dbdf[_0x0baf('0x37')],_0x29dbdf[_0x0baf('0x33')]);_0x55c715[_0x0baf('0x38')]=_[_0x0baf('0x36')](_0x29dbdf[_0x0baf('0x37')],qs[_0x0baf('0x39')](_0xcaf13d[_0x0baf('0x33')]['fields']));_0x55c715[_0x0baf('0x38')]=_0x55c715['attributes'][_0x0baf('0x3a')]?_0x55c715[_0x0baf('0x38')]:_0x29dbdf[_0x0baf('0x37')];if(!_0xcaf13d[_0x0baf('0x33')]['hasOwnProperty'](_0x0baf('0x3b'))){_0x55c715[_0x0baf('0x21')]=qs['limit'](_0xcaf13d[_0x0baf('0x33')][_0x0baf('0x21')]);_0x55c715[_0x0baf('0x1f')]=qs[_0x0baf('0x1f')](_0xcaf13d[_0x0baf('0x33')][_0x0baf('0x1f')]);}_0x55c715[_0x0baf('0x3c')]=qs[_0x0baf('0x3d')](_0xcaf13d['query'][_0x0baf('0x3d')]);_0x55c715[_0x0baf('0x3e')]=qs['filters'](_[_0x0baf('0x3f')](_0xcaf13d['query'],_0x29dbdf['filters']),_0x5d9d7f);if(_0xcaf13d[_0x0baf('0x33')][_0x0baf('0x40')]){_0x55c715['where']=_['merge'](_0x55c715[_0x0baf('0x3e')],{'$or':_[_0x0baf('0x2d')](_0x5d9d7f,function(_0x3412bc){if(_0x3412bc[_0x0baf('0x31')]!==_0x0baf('0x41')){var _0x2028ad={};_0x2028ad[_0x3412bc[_0x0baf('0x2a')]]={'$like':'%'+_0xcaf13d[_0x0baf('0x33')][_0x0baf('0x40')]+'%'};return _0x2028ad;}})});}_0x55c715=_[_0x0baf('0x42')]({},_0x55c715,_0xcaf13d[_0x0baf('0x43')]);var _0x148540={'where':_0x55c715[_0x0baf('0x3e')]};return db[_0x0baf('0x2e')]['count'](_0x148540)[_0x0baf('0x44')](function(_0x1435d5){_0x34a58a['count']=_0x1435d5;if(_0xcaf13d[_0x0baf('0x33')][_0x0baf('0x45')]){_0x55c715[_0x0baf('0x46')]=[{'all':!![]}];}return db[_0x0baf('0x2e')][_0x0baf('0x47')](_0x55c715);})[_0x0baf('0x44')](function(_0x57b581){_0x34a58a[_0x0baf('0x48')]=_0x57b581;return _0x34a58a;})[_0x0baf('0x44')](respondWithFilteredResult(_0x265915,_0x55c715))['catch'](handleError(_0x265915,null));};exports[_0x0baf('0x49')]=function(_0x412e6f,_0x45c6aa){var _0x57903e={'raw':!![],'where':{'id':_0x412e6f[_0x0baf('0x4a')]['id']}},_0x504031={};_0x504031[_0x0baf('0x37')]=_[_0x0baf('0x34')](db[_0x0baf('0x2e')][_0x0baf('0x2f')]);_0x504031[_0x0baf('0x33')]=_[_0x0baf('0x34')](_0x412e6f[_0x0baf('0x33')]);_0x504031[_0x0baf('0x35')]=_[_0x0baf('0x36')](_0x504031['model'],_0x504031[_0x0baf('0x33')]);_0x57903e[_0x0baf('0x38')]=_[_0x0baf('0x36')](_0x504031[_0x0baf('0x37')],qs[_0x0baf('0x39')](_0x412e6f['query'][_0x0baf('0x39')]));_0x57903e[_0x0baf('0x38')]=_0x57903e[_0x0baf('0x38')][_0x0baf('0x3a')]?_0x57903e[_0x0baf('0x38')]:_0x504031['model'];if(_0x412e6f[_0x0baf('0x33')][_0x0baf('0x45')]){_0x57903e[_0x0baf('0x46')]=[{'all':!![]}];}_0x57903e=_[_0x0baf('0x42')]({},_0x57903e,_0x412e6f[_0x0baf('0x43')]);return db[_0x0baf('0x2e')][_0x0baf('0x4b')](_0x57903e)['then'](handleEntityNotFound(_0x45c6aa,null))[_0x0baf('0x44')](respondWithResult(_0x45c6aa,null))[_0x0baf('0x4c')](handleError(_0x45c6aa,null));};exports[_0x0baf('0x4d')]=function(_0x57008f,_0x3c9de3){return db[_0x0baf('0x2e')][_0x0baf('0x4d')](_0x57008f[_0x0baf('0x4e')],{})[_0x0baf('0x44')](respondWithResult(_0x3c9de3,0xc9))[_0x0baf('0x4c')](handleError(_0x3c9de3,null));};exports[_0x0baf('0x27')]=function(_0x5a54bb,_0x22c451){if(_0x5a54bb[_0x0baf('0x4e')]['id']){delete _0x5a54bb[_0x0baf('0x4e')]['id'];}return db[_0x0baf('0x2e')][_0x0baf('0x4b')]({'where':{'id':_0x5a54bb[_0x0baf('0x4a')]['id']}})[_0x0baf('0x44')](handleEntityNotFound(_0x22c451,null))[_0x0baf('0x44')](saveUpdates(_0x5a54bb[_0x0baf('0x4e')],null))[_0x0baf('0x44')](respondWithResult(_0x22c451,null))[_0x0baf('0x4c')](handleError(_0x22c451,null));};exports['destroy']=function(_0x528ff6,_0x354329){return db[_0x0baf('0x2e')][_0x0baf('0x4b')]({'where':{'id':_0x528ff6[_0x0baf('0x4a')]['id']}})[_0x0baf('0x44')](handleEntityNotFound(_0x354329,null))[_0x0baf('0x44')](removeEntity(_0x354329,null))[_0x0baf('0x4c')](handleError(_0x354329,null));};exports['describe']=function(_0x3fe534,_0x2ef4c1){return db[_0x0baf('0x2e')][_0x0baf('0x4f')]()[_0x0baf('0x44')](respondWithResult(_0x2ef4c1,null))[_0x0baf('0x4c')](handleError(_0x2ef4c1,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(_0x1ac120,_0x3e7e45){var _0x19b703=function(_0x5f32cb){while(--_0x5f32cb){_0x1ac120['push'](_0x1ac120['shift']());}};_0x19b703(++_0x3e7e45);}(_0x4024,0x89));var _0x4402=function(_0x42cd74,_0x3d6956){_0x42cd74=_0x42cd74-0x0;var _0xe3b978=_0x4024[_0x42cd74];return _0xe3b978;};'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 104553e..7e392c7 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 _0xdcbd=['util','../../config/logger','api','moment','./whatsappQueueReport.attributes','exports','WhatsappQueueReport','report_whatsapp_queue','uniqueid','lodash'];(function(_0x36ecbb,_0x1d44d9){var _0x324b0e=function(_0x1454d1){while(--_0x1454d1){_0x36ecbb['push'](_0x36ecbb['shift']());}};_0x324b0e(++_0x1d44d9);}(_0xdcbd,0x199));var _0xddcb=function(_0x3cc244,_0x20461e){_0x3cc244=_0x3cc244-0x0;var _0x6856b0=_0xdcbd[_0x3cc244];return _0x6856b0;};'use strict';var _=require(_0xddcb('0x0'));var util=require(_0xddcb('0x1'));var logger=require(_0xddcb('0x2'))(_0xddcb('0x3'));var moment=require(_0xddcb('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(_0xddcb('0x5'));module[_0xddcb('0x6')]=function(_0x3bd062,_0x197add){return _0x3bd062['define'](_0xddcb('0x7'),attributes,{'tableName':_0xddcb('0x8'),'paranoid':![],'indexes':[{'name':_0xddcb('0x9'),'fields':[_0xddcb('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa862=['../../config/logger','moment','bluebird','request-promise','path','../../config/environment','exports','define','WhatsappQueueReport','report_whatsapp_queue','uniqueid','lodash'];(function(_0x53e3de,_0x13da7b){var _0x7b905b=function(_0x29b56a){while(--_0x29b56a){_0x53e3de['push'](_0x53e3de['shift']());}};_0x7b905b(++_0x13da7b);}(_0xa862,0x15b));var _0x2a86=function(_0xaa1b3e,_0x47d976){_0xaa1b3e=_0xaa1b3e-0x0;var _0x454d7d=_0xa862[_0xaa1b3e];return _0x454d7d;};'use strict';var _=require(_0x2a86('0x0'));var util=require('util');var logger=require(_0x2a86('0x1'))('api');var moment=require(_0x2a86('0x2'));var BPromise=require(_0x2a86('0x3'));var rp=require(_0x2a86('0x4'));var fs=require('fs');var path=require(_0x2a86('0x5'));var rimraf=require('rimraf');var config=require(_0x2a86('0x6'));var attributes=require('./whatsappQueueReport.attributes');module[_0x2a86('0x7')]=function(_0x4b0149,_0x588728){return _0x4b0149[_0x2a86('0x8')](_0x2a86('0x9'),attributes,{'tableName':_0x2a86('0xa'),'paranoid':![],'indexes':[{'name':_0x2a86('0xb'),'fields':[_0x2a86('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 e2f0d71..bd0bc68 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 _0xf2a4=['http','request','info','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','WhatsappQueueReport','create','body','options','raw','then','CreateWhatsappQueueReport','catch','UpdateWhatsappQueueReport','where','attributes','limit','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client'];(function(_0x5440ca,_0x12fe99){var _0x57b432=function(_0x4ca1b7){while(--_0x4ca1b7){_0x5440ca['push'](_0x5440ca['shift']());}};_0x57b432(++_0x12fe99);}(_0xf2a4,0xfe));var _0x4f2a=function(_0x486579,_0x77e571){_0x486579=_0x486579-0x0;var _0x4821e8=_0xf2a4[_0x486579];return _0x4821e8;};'use strict';var _=require(_0x4f2a('0x0'));var util=require(_0x4f2a('0x1'));var moment=require('moment');var BPromise=require(_0x4f2a('0x2'));var rs=require(_0x4f2a('0x3'));var fs=require('fs');var Redis=require(_0x4f2a('0x4'));var db=require(_0x4f2a('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x4f2a('0x6'))(_0x4f2a('0x7'));var config=require('../../config/environment');var jayson=require(_0x4f2a('0x8'));var client=jayson[_0x4f2a('0x9')][_0x4f2a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3e6757,_0x511463,_0x4bd1a7){return new BPromise(function(_0x465bfb,_0x2e3bd2){return client[_0x4f2a('0xb')](_0x3e6757,_0x4bd1a7)['then'](function(_0x3ab9f0){logger[_0x4f2a('0xc')](_0x4f2a('0xd'),_0x511463,_0x4f2a('0xe'));logger[_0x4f2a('0xf')]('WhatsappQueueReport,\x20%s,\x20%s,\x20%s',_0x511463,_0x4f2a('0xe'),JSON[_0x4f2a('0x10')](_0x3ab9f0));if(_0x3ab9f0[_0x4f2a('0x11')]){if(_0x3ab9f0[_0x4f2a('0x11')][_0x4f2a('0x12')]===0x1f4){logger[_0x4f2a('0x11')]('WhatsappQueueReport,\x20%s,\x20%s',_0x511463,_0x3ab9f0[_0x4f2a('0x11')][_0x4f2a('0x13')]);return _0x2e3bd2(_0x3ab9f0[_0x4f2a('0x11')]['message']);}logger[_0x4f2a('0x11')]('WhatsappQueueReport,\x20%s,\x20%s',_0x511463,_0x3ab9f0['error'][_0x4f2a('0x13')]);return _0x465bfb(_0x3ab9f0[_0x4f2a('0x11')][_0x4f2a('0x13')]);}else{logger[_0x4f2a('0xc')](_0x4f2a('0xd'),_0x511463,_0x4f2a('0xe'));_0x465bfb(_0x3ab9f0[_0x4f2a('0x14')][_0x4f2a('0x13')]);}})['catch'](function(_0x18980b){logger[_0x4f2a('0x11')](_0x4f2a('0xd'),_0x511463,_0x18980b);_0x2e3bd2(_0x18980b);});});}exports['CreateWhatsappQueueReport']=function(_0x388f7b){var _0x505a6e=this;return new Promise(function(_0x48573a,_0x4451c2){return db[_0x4f2a('0x15')][_0x4f2a('0x16')](_0x388f7b[_0x4f2a('0x17')],{'raw':_0x388f7b[_0x4f2a('0x18')]?_0x388f7b['options'][_0x4f2a('0x19')]===undefined?!![]:![]:!![]})[_0x4f2a('0x1a')](function(_0x2ebc8c){logger[_0x4f2a('0xc')](_0x4f2a('0x1b'),_0x388f7b);logger[_0x4f2a('0xf')](_0x4f2a('0x1b'),_0x388f7b,JSON[_0x4f2a('0x10')](_0x2ebc8c));_0x48573a(_0x2ebc8c);})[_0x4f2a('0x1c')](function(_0x55d715){logger[_0x4f2a('0x11')](_0x4f2a('0x1b'),_0x55d715[_0x4f2a('0x13')],_0x388f7b);_0x4451c2(_0x505a6e[_0x4f2a('0x11')](0x1f4,_0x55d715[_0x4f2a('0x13')]));});});};exports[_0x4f2a('0x1d')]=function(_0xcf156b){var _0x4ec9ef=this;return new Promise(function(_0x7b67b5,_0x548d62){return db[_0x4f2a('0x15')]['update'](_0xcf156b[_0x4f2a('0x17')],{'raw':_0xcf156b[_0x4f2a('0x18')]?_0xcf156b[_0x4f2a('0x18')][_0x4f2a('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xcf156b[_0x4f2a('0x18')]?_0xcf156b[_0x4f2a('0x18')][_0x4f2a('0x1e')]||null:null,'attributes':_0xcf156b['options']?_0xcf156b['options'][_0x4f2a('0x1f')]||null:null,'limit':_0xcf156b[_0x4f2a('0x18')]?_0xcf156b['options'][_0x4f2a('0x20')]||null:null})['then'](function(_0xa53711){logger[_0x4f2a('0xc')]('UpdateWhatsappQueueReport',_0xcf156b);logger[_0x4f2a('0xf')]('UpdateWhatsappQueueReport',_0xcf156b,JSON[_0x4f2a('0x10')](_0xa53711));_0x7b67b5(_0xa53711);})[_0x4f2a('0x1c')](function(_0x494919){logger['error']('UpdateWhatsappQueueReport',_0x494919[_0x4f2a('0x13')],_0xcf156b);_0x548d62(_0x4ec9ef[_0x4f2a('0x11')](0x1f4,_0x494919[_0x4f2a('0x13')]));});});}; \ No newline at end of file +var _0x93dc=['message','result','catch','WhatsappQueueReport','create','body','options','raw','CreateWhatsappQueueReport','update','where','attributes','UpdateWhatsappQueueReport','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','info','WhatsappQueueReport,\x20%s,\x20%s','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error'];(function(_0x521785,_0x2d6d56){var _0x1ff0fe=function(_0x98614e){while(--_0x98614e){_0x521785['push'](_0x521785['shift']());}};_0x1ff0fe(++_0x2d6d56);}(_0x93dc,0x161));var _0xc93d=function(_0x46d073,_0x11fb1f){_0x46d073=_0x46d073-0x0;var _0x2d21af=_0x93dc[_0x46d073];return _0x2d21af;};'use strict';var _=require(_0xc93d('0x0'));var util=require(_0xc93d('0x1'));var moment=require(_0xc93d('0x2'));var BPromise=require('bluebird');var rs=require(_0xc93d('0x3'));var fs=require('fs');var Redis=require(_0xc93d('0x4'));var db=require(_0xc93d('0x5'))['db'];var utils=require(_0xc93d('0x6'));var logger=require('../../config/logger')(_0xc93d('0x7'));var config=require(_0xc93d('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xc93d('0x9')][_0xc93d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x8d7548,_0x5c935b,_0x28972f){return new BPromise(function(_0x4f3f8a,_0x4392ec){return client[_0xc93d('0xb')](_0x8d7548,_0x28972f)[_0xc93d('0xc')](function(_0x31bd87){logger[_0xc93d('0xd')](_0xc93d('0xe'),_0x5c935b,'request\x20sent');logger[_0xc93d('0xf')](_0xc93d('0x10'),_0x5c935b,_0xc93d('0x11'),JSON[_0xc93d('0x12')](_0x31bd87));if(_0x31bd87['error']){if(_0x31bd87['error'][_0xc93d('0x13')]===0x1f4){logger[_0xc93d('0x14')](_0xc93d('0xe'),_0x5c935b,_0x31bd87['error'][_0xc93d('0x15')]);return _0x4392ec(_0x31bd87[_0xc93d('0x14')]['message']);}logger['error'](_0xc93d('0xe'),_0x5c935b,_0x31bd87['error'][_0xc93d('0x15')]);return _0x4f3f8a(_0x31bd87[_0xc93d('0x14')][_0xc93d('0x15')]);}else{logger['info']('WhatsappQueueReport,\x20%s,\x20%s',_0x5c935b,'request\x20sent');_0x4f3f8a(_0x31bd87[_0xc93d('0x16')][_0xc93d('0x15')]);}})[_0xc93d('0x17')](function(_0x4547ae){logger[_0xc93d('0x14')](_0xc93d('0xe'),_0x5c935b,_0x4547ae);_0x4392ec(_0x4547ae);});});}exports['CreateWhatsappQueueReport']=function(_0x30883a){var _0x5b3d2f=this;return new Promise(function(_0x5471ea,_0x1822f9){return db[_0xc93d('0x18')][_0xc93d('0x19')](_0x30883a[_0xc93d('0x1a')],{'raw':_0x30883a[_0xc93d('0x1b')]?_0x30883a[_0xc93d('0x1b')][_0xc93d('0x1c')]===undefined?!![]:![]:!![]})[_0xc93d('0xc')](function(_0x26fb2c){logger[_0xc93d('0xd')](_0xc93d('0x1d'),_0x30883a);logger['debug'](_0xc93d('0x1d'),_0x30883a,JSON[_0xc93d('0x12')](_0x26fb2c));_0x5471ea(_0x26fb2c);})[_0xc93d('0x17')](function(_0x5c211e){logger[_0xc93d('0x14')](_0xc93d('0x1d'),_0x5c211e['message'],_0x30883a);_0x1822f9(_0x5b3d2f[_0xc93d('0x14')](0x1f4,_0x5c211e[_0xc93d('0x15')]));});});};exports['UpdateWhatsappQueueReport']=function(_0x6f9d01){var _0x3e1783=this;return new Promise(function(_0x178d45,_0x48dd65){return db[_0xc93d('0x18')][_0xc93d('0x1e')](_0x6f9d01[_0xc93d('0x1a')],{'raw':_0x6f9d01['options']?_0x6f9d01['options'][_0xc93d('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x6f9d01['options']?_0x6f9d01[_0xc93d('0x1b')][_0xc93d('0x1f')]||null:null,'attributes':_0x6f9d01['options']?_0x6f9d01[_0xc93d('0x1b')][_0xc93d('0x20')]||null:null,'limit':_0x6f9d01[_0xc93d('0x1b')]?_0x6f9d01[_0xc93d('0x1b')]['limit']||null:null})[_0xc93d('0xc')](function(_0x6843e){logger[_0xc93d('0xd')](_0xc93d('0x21'),_0x6f9d01);logger['debug']('UpdateWhatsappQueueReport',_0x6f9d01,JSON[_0xc93d('0x12')](_0x6843e));_0x178d45(_0x6843e);})['catch'](function(_0xcb689d){logger[_0xc93d('0x14')](_0xc93d('0x21'),_0xcb689d[_0xc93d('0x15')],_0x6f9d01);_0x48dd65(_0x3e1783[_0xc93d('0x14')](0x1f4,_0xcb689d[_0xc93d('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index ab36f05..e7fa522 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 _0x2941=['path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./whatsappTransferReport.controller','index','get','isAuthenticated','/:id','create','put','update','delete','multer'];(function(_0x38a94d,_0x236266){var _0x3dcef3=function(_0x44ba6f){while(--_0x44ba6f){_0x38a94d['push'](_0x38a94d['shift']());}};_0x3dcef3(++_0x236266);}(_0x2941,0x1cf));var _0x1294=function(_0x18d50f,_0x124aff){_0x18d50f=_0x18d50f-0x0;var _0x8ce385=_0x2941[_0x18d50f];return _0x8ce385;};'use strict';var multer=require(_0x1294('0x0'));var util=require('util');var path=require(_0x1294('0x1'));var timeout=require(_0x1294('0x2'));var express=require(_0x1294('0x3'));var router=express['Router']();var fs_extra=require(_0x1294('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x1294('0x5'));var config=require(_0x1294('0x6'));var controller=require(_0x1294('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x1294('0x8')]);router[_0x1294('0x9')]('/describe',auth[_0x1294('0xa')](),controller['describe']);router[_0x1294('0x9')](_0x1294('0xb'),auth[_0x1294('0xa')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x1294('0xc')]);router[_0x1294('0xd')](_0x1294('0xb'),auth[_0x1294('0xa')](),controller[_0x1294('0xe')]);router[_0x1294('0xf')](_0x1294('0xb'),auth[_0x1294('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x7435=['path','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe','describe','post','create','put','/:id','update','delete','destroy','exports','multer','util'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x7435,0x1f2));var _0x5743=function(_0x14b072,_0x61759){_0x14b072=_0x14b072-0x0;var _0x2b1459=_0x7435[_0x14b072];return _0x2b1459;};'use strict';var multer=require(_0x5743('0x0'));var util=require(_0x5743('0x1'));var path=require(_0x5743('0x2'));var timeout=require(_0x5743('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x5743('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x5743('0x5'));var config=require(_0x5743('0x6'));var controller=require('./whatsappTransferReport.controller');router['get']('/',auth[_0x5743('0x7')](),controller[_0x5743('0x8')]);router[_0x5743('0x9')](_0x5743('0xa'),auth['isAuthenticated'](),controller[_0x5743('0xb')]);router[_0x5743('0x9')]('/:id',auth[_0x5743('0x7')](),controller['show']);router[_0x5743('0xc')]('/',auth[_0x5743('0x7')](),controller[_0x5743('0xd')]);router[_0x5743('0xe')](_0x5743('0xf'),auth[_0x5743('0x7')](),controller[_0x5743('0x10')]);router[_0x5743('0x11')](_0x5743('0xf'),auth[_0x5743('0x7')](),controller[_0x5743('0x12')]);module[_0x5743('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 8de6422..d64c3ce 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 _0x5236=['exports','STRING','ENUM','account','queue','DATE','sequelize'];(function(_0x9fc0cb,_0x2bffa0){var _0xb201c0=function(_0x3f82b9){while(--_0x3f82b9){_0x9fc0cb['push'](_0x9fc0cb['shift']());}};_0xb201c0(++_0x2bffa0);}(_0x5236,0x109));var _0x6523=function(_0x225ffa,_0xa92946){_0x225ffa=_0x225ffa-0x0;var _0x5f560a=_0x5236[_0x225ffa];return _0x5f560a;};'use strict';var Sequelize=require(_0x6523('0x0'));module[_0x6523('0x1')]={'uniqueid':{'type':Sequelize[_0x6523('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x6523('0x3')](_0x6523('0x4'),'agent',_0x6523('0x5')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0x6523('0x6')]}}; \ No newline at end of file +var _0x87bc=['queue','sequelize','exports','ENUM'];(function(_0x3ec822,_0x59a9c2){var _0x5927c6=function(_0x56a240){while(--_0x56a240){_0x3ec822['push'](_0x3ec822['shift']());}};_0x5927c6(++_0x59a9c2);}(_0x87bc,0x189));var _0xc87b=function(_0x5bb3bd,_0x20afe3){_0x5bb3bd=_0x5bb3bd-0x0;var _0x477534=_0x87bc[_0x5bb3bd];return _0x477534;};'use strict';var Sequelize=require(_0xc87b('0x0'));module[_0xc87b('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xc87b('0x2')]('account','agent',_0xc87b('0x3')),'allowNull':![]},'transferredAt':{'type':Sequelize['DATE']}}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js index 4680196..c3ea7dc 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 _0xbbbc=['query','intersection','fields','attributes','length','order','sort','where','merge','VIRTUAL','filter','options','findAll','rows','catch','params','keys','filters','includeAll','include','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','save','update','then','destroy','error','name','send','index','map','WhatsappTransferReport','rawAttributes','fieldName','type','key','model'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xbbbc,0xf6));var _0xcbbb=function(_0x1f1611,_0x8e92b0){_0x1f1611=_0x1f1611-0x0;var _0xd79ac6=_0xbbbc[_0x1f1611];return _0xd79ac6;};'use strict';var emlformat=require(_0xcbbb('0x0'));var rimraf=require(_0xcbbb('0x1'));var zipdir=require(_0xcbbb('0x2'));var jsonpatch=require(_0xcbbb('0x3'));var rp=require(_0xcbbb('0x4'));var moment=require(_0xcbbb('0x5'));var BPromise=require(_0xcbbb('0x6'));var Mustache=require('mustache');var util=require(_0xcbbb('0x7'));var path=require(_0xcbbb('0x8'));var sox=require(_0xcbbb('0x9'));var csv=require(_0xcbbb('0xa'));var ejs=require(_0xcbbb('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xcbbb('0xc'));var squel=require(_0xcbbb('0xd'));var crypto=require(_0xcbbb('0xe'));var jsforce=require(_0xcbbb('0xf'));var deskjs=require(_0xcbbb('0x10'));var toCsv=require(_0xcbbb('0xa'));var querystring=require(_0xcbbb('0x11'));var Papa=require('papaparse');var Redis=require(_0xcbbb('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xcbbb('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xcbbb('0x14'))('api');var utils=require(_0xcbbb('0x15'));var config=require(_0xcbbb('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xcbbb('0x17'))['db'];function respondWithStatusCode(_0x53e651,_0x56f81){_0x56f81=_0x56f81||0xcc;return function(_0x523c50){if(_0x523c50){return _0x53e651[_0xcbbb('0x18')](_0x56f81);}return _0x53e651[_0xcbbb('0x19')](_0x56f81)[_0xcbbb('0x1a')]();};}function respondWithResult(_0x47ea6a,_0x27ba56){_0x27ba56=_0x27ba56||0xc8;return function(_0x3ff767){if(_0x3ff767){return _0x47ea6a[_0xcbbb('0x19')](_0x27ba56)[_0xcbbb('0x1b')](_0x3ff767);}};}function respondWithFilteredResult(_0x47e679,_0x5af226){return function(_0x1bba39){if(_0x1bba39){var _0x30297d=typeof _0x5af226[_0xcbbb('0x1c')]===_0xcbbb('0x1d')&&typeof _0x5af226['limit']===_0xcbbb('0x1d');var _0x4ff973=_0x1bba39[_0xcbbb('0x1e')];var _0x3436af=_0x30297d?0x0:_0x5af226[_0xcbbb('0x1c')];var _0x5052df=_0x30297d?_0x1bba39['count']:_0x5af226['offset']+_0x5af226[_0xcbbb('0x1f')];var _0x3ae91b;if(_0x5052df>=_0x4ff973){_0x5052df=_0x4ff973;_0x3ae91b=0xc8;}else{_0x3ae91b=0xce;}_0x47e679[_0xcbbb('0x19')](_0x3ae91b);return _0x47e679[_0xcbbb('0x20')](_0xcbbb('0x21'),_0x3436af+'-'+_0x5052df+'/'+_0x4ff973)[_0xcbbb('0x1b')](_0x1bba39);}return null;};}function patchUpdates(_0x45de5f){return function(_0x2be36c){try{jsonpatch[_0xcbbb('0x22')](_0x2be36c,_0x45de5f,!![]);}catch(_0x2d4335){return BPromise['reject'](_0x2d4335);}return _0x2be36c[_0xcbbb('0x23')]();};}function saveUpdates(_0xe07b0,_0x159c62){return function(_0x42aaf1){if(_0x42aaf1){return _0x42aaf1[_0xcbbb('0x24')](_0xe07b0)[_0xcbbb('0x25')](function(_0x297eae){return _0x297eae;});}return null;};}function removeEntity(_0xabb565,_0x3ca570){return function(_0x5e3970){if(_0x5e3970){return _0x5e3970[_0xcbbb('0x26')]()[_0xcbbb('0x25')](function(){_0xabb565['status'](0xcc)[_0xcbbb('0x1a')]();});}};}function handleEntityNotFound(_0x4ffa80,_0x48dfc4){return function(_0x575d56){if(!_0x575d56){_0x4ffa80[_0xcbbb('0x18')](0x194);}return _0x575d56;};}function handleError(_0x548440,_0x59c422){_0x59c422=_0x59c422||0x1f4;return function(_0x5499a1){logger[_0xcbbb('0x27')](_0x5499a1['stack']);if(_0x5499a1['name']){delete _0x5499a1[_0xcbbb('0x28')];}_0x548440[_0xcbbb('0x19')](_0x59c422)[_0xcbbb('0x29')](_0x5499a1);};}exports[_0xcbbb('0x2a')]=function(_0x372024,_0x39ba8b){var _0x3d4c0d={},_0x1c986d={},_0x2a023f={'count':0x0,'rows':[]};var _0x26c05e=_[_0xcbbb('0x2b')](db[_0xcbbb('0x2c')][_0xcbbb('0x2d')],function(_0x1ce741){return{'name':_0x1ce741[_0xcbbb('0x2e')],'type':_0x1ce741[_0xcbbb('0x2f')][_0xcbbb('0x30')]};});_0x1c986d[_0xcbbb('0x31')]=_['map'](_0x26c05e,_0xcbbb('0x28'));_0x1c986d[_0xcbbb('0x32')]=_['keys'](_0x372024[_0xcbbb('0x32')]);_0x1c986d['filters']=_[_0xcbbb('0x33')](_0x1c986d[_0xcbbb('0x31')],_0x1c986d[_0xcbbb('0x32')]);_0x3d4c0d['attributes']=_[_0xcbbb('0x33')](_0x1c986d[_0xcbbb('0x31')],qs[_0xcbbb('0x34')](_0x372024[_0xcbbb('0x32')][_0xcbbb('0x34')]));_0x3d4c0d[_0xcbbb('0x35')]=_0x3d4c0d[_0xcbbb('0x35')][_0xcbbb('0x36')]?_0x3d4c0d[_0xcbbb('0x35')]:_0x1c986d[_0xcbbb('0x31')];if(!_0x372024['query']['hasOwnProperty']('nolimit')){_0x3d4c0d['limit']=qs[_0xcbbb('0x1f')](_0x372024[_0xcbbb('0x32')][_0xcbbb('0x1f')]);_0x3d4c0d[_0xcbbb('0x1c')]=qs[_0xcbbb('0x1c')](_0x372024[_0xcbbb('0x32')][_0xcbbb('0x1c')]);}_0x3d4c0d[_0xcbbb('0x37')]=qs[_0xcbbb('0x38')](_0x372024[_0xcbbb('0x32')][_0xcbbb('0x38')]);_0x3d4c0d[_0xcbbb('0x39')]=qs['filters'](_['pick'](_0x372024[_0xcbbb('0x32')],_0x1c986d['filters']),_0x26c05e);if(_0x372024['query']['filter']){_0x3d4c0d[_0xcbbb('0x39')]=_[_0xcbbb('0x3a')](_0x3d4c0d[_0xcbbb('0x39')],{'$or':_[_0xcbbb('0x2b')](_0x26c05e,function(_0x38e59d){if(_0x38e59d[_0xcbbb('0x2f')]!==_0xcbbb('0x3b')){var _0x14c1a2={};_0x14c1a2[_0x38e59d[_0xcbbb('0x28')]]={'$like':'%'+_0x372024[_0xcbbb('0x32')][_0xcbbb('0x3c')]+'%'};return _0x14c1a2;}})});}_0x3d4c0d=_['merge']({},_0x3d4c0d,_0x372024[_0xcbbb('0x3d')]);var _0x55d349={'where':_0x3d4c0d[_0xcbbb('0x39')]};return db[_0xcbbb('0x2c')][_0xcbbb('0x1e')](_0x55d349)[_0xcbbb('0x25')](function(_0x433065){_0x2a023f[_0xcbbb('0x1e')]=_0x433065;if(_0x372024['query']['includeAll']){_0x3d4c0d['include']=[{'all':!![]}];}return db[_0xcbbb('0x2c')][_0xcbbb('0x3e')](_0x3d4c0d);})[_0xcbbb('0x25')](function(_0x162979){_0x2a023f[_0xcbbb('0x3f')]=_0x162979;return _0x2a023f;})[_0xcbbb('0x25')](respondWithFilteredResult(_0x39ba8b,_0x3d4c0d))[_0xcbbb('0x40')](handleError(_0x39ba8b,null));};exports['show']=function(_0x1a7799,_0x22076a){var _0x5550d2={'raw':!![],'where':{'id':_0x1a7799[_0xcbbb('0x41')]['id']}},_0x15b3bc={};_0x15b3bc[_0xcbbb('0x31')]=_[_0xcbbb('0x42')](db[_0xcbbb('0x2c')]['rawAttributes']);_0x15b3bc[_0xcbbb('0x32')]=_['keys'](_0x1a7799['query']);_0x15b3bc[_0xcbbb('0x43')]=_[_0xcbbb('0x33')](_0x15b3bc[_0xcbbb('0x31')],_0x15b3bc[_0xcbbb('0x32')]);_0x5550d2[_0xcbbb('0x35')]=_[_0xcbbb('0x33')](_0x15b3bc[_0xcbbb('0x31')],qs[_0xcbbb('0x34')](_0x1a7799[_0xcbbb('0x32')][_0xcbbb('0x34')]));_0x5550d2[_0xcbbb('0x35')]=_0x5550d2[_0xcbbb('0x35')][_0xcbbb('0x36')]?_0x5550d2[_0xcbbb('0x35')]:_0x15b3bc['model'];if(_0x1a7799[_0xcbbb('0x32')][_0xcbbb('0x44')]){_0x5550d2[_0xcbbb('0x45')]=[{'all':!![]}];}_0x5550d2=_[_0xcbbb('0x3a')]({},_0x5550d2,_0x1a7799['options']);return db['WhatsappTransferReport']['find'](_0x5550d2)[_0xcbbb('0x25')](handleEntityNotFound(_0x22076a,null))[_0xcbbb('0x25')](respondWithResult(_0x22076a,null))[_0xcbbb('0x40')](handleError(_0x22076a,null));};exports[_0xcbbb('0x46')]=function(_0x146f37,_0x1ef25b){return db[_0xcbbb('0x2c')]['create'](_0x146f37[_0xcbbb('0x47')],{})[_0xcbbb('0x25')](respondWithResult(_0x1ef25b,0xc9))[_0xcbbb('0x40')](handleError(_0x1ef25b,null));};exports[_0xcbbb('0x24')]=function(_0x478c22,_0x3378cd){if(_0x478c22[_0xcbbb('0x47')]['id']){delete _0x478c22[_0xcbbb('0x47')]['id'];}return db[_0xcbbb('0x2c')]['find']({'where':{'id':_0x478c22['params']['id']}})[_0xcbbb('0x25')](handleEntityNotFound(_0x3378cd,null))[_0xcbbb('0x25')](saveUpdates(_0x478c22[_0xcbbb('0x47')],null))['then'](respondWithResult(_0x3378cd,null))['catch'](handleError(_0x3378cd,null));};exports['destroy']=function(_0x189a40,_0x3070d9){return db['WhatsappTransferReport'][_0xcbbb('0x48')]({'where':{'id':_0x189a40[_0xcbbb('0x41')]['id']}})[_0xcbbb('0x25')](handleEntityNotFound(_0x3070d9,null))[_0xcbbb('0x25')](removeEntity(_0x3070d9,null))['catch'](handleError(_0x3070d9,null));};exports[_0xcbbb('0x49')]=function(_0x1e4bb0,_0x39640d){return db[_0xcbbb('0x2c')][_0xcbbb('0x49')]()[_0xcbbb('0x25')](respondWithResult(_0x39640d,null))[_0xcbbb('0x40')](handleError(_0x39640d,null));}; \ No newline at end of file +var _0x0e89=['rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','filter','where','merge','VIRTUAL','includeAll','include','rows','catch','show','params','length','options','find','create','body','update','describe','eml-format','zip-dir','request-promise','moment','bluebird','mustache','sox','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','count','limit','set','Content-Range','apply','save','destroy','then','error','stack','name','send','index','map','WhatsappTransferReport'];(function(_0x4a0de1,_0x576d60){var _0x423190=function(_0x410d49){while(--_0x410d49){_0x4a0de1['push'](_0x4a0de1['shift']());}};_0x423190(++_0x576d60);}(_0x0e89,0x69));var _0x90e8=function(_0x173441,_0x26b0d9){_0x173441=_0x173441-0x0;var _0x2423a8=_0x0e89[_0x173441];return _0x2423a8;};'use strict';var emlformat=require(_0x90e8('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x90e8('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x90e8('0x2'));var moment=require(_0x90e8('0x3'));var BPromise=require(_0x90e8('0x4'));var Mustache=require(_0x90e8('0x5'));var util=require('util');var path=require('path');var sox=require(_0x90e8('0x6'));var csv=require(_0x90e8('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x90e8('0x8'));var squel=require(_0x90e8('0x9'));var crypto=require('crypto');var jsforce=require(_0x90e8('0xa'));var deskjs=require(_0x90e8('0xb'));var toCsv=require('to-csv');var querystring=require(_0x90e8('0xc'));var Papa=require(_0x90e8('0xd'));var Redis=require(_0x90e8('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x90e8('0xf'));var as=require(_0x90e8('0x10'));var hardwareService=require(_0x90e8('0x11'));var logger=require(_0x90e8('0x12'))(_0x90e8('0x13'));var utils=require(_0x90e8('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x90e8('0x15'));var db=require(_0x90e8('0x16'))['db'];function respondWithStatusCode(_0x275497,_0x407c17){_0x407c17=_0x407c17||0xcc;return function(_0x255d39){if(_0x255d39){return _0x275497[_0x90e8('0x17')](_0x407c17);}return _0x275497[_0x90e8('0x18')](_0x407c17)[_0x90e8('0x19')]();};}function respondWithResult(_0x3b7141,_0x5b1148){_0x5b1148=_0x5b1148||0xc8;return function(_0x275063){if(_0x275063){return _0x3b7141[_0x90e8('0x18')](_0x5b1148)[_0x90e8('0x1a')](_0x275063);}};}function respondWithFilteredResult(_0x441643,_0x5b548e){return function(_0xb3d39b){if(_0xb3d39b){var _0xadb22e=typeof _0x5b548e[_0x90e8('0x1b')]==='undefined'&&typeof _0x5b548e['limit']==='undefined';var _0x494a4a=_0xb3d39b['count'];var _0x1128d6=_0xadb22e?0x0:_0x5b548e[_0x90e8('0x1b')];var _0x1c548a=_0xadb22e?_0xb3d39b[_0x90e8('0x1c')]:_0x5b548e[_0x90e8('0x1b')]+_0x5b548e[_0x90e8('0x1d')];var _0x333667;if(_0x1c548a>=_0x494a4a){_0x1c548a=_0x494a4a;_0x333667=0xc8;}else{_0x333667=0xce;}_0x441643[_0x90e8('0x18')](_0x333667);return _0x441643[_0x90e8('0x1e')](_0x90e8('0x1f'),_0x1128d6+'-'+_0x1c548a+'/'+_0x494a4a)[_0x90e8('0x1a')](_0xb3d39b);}return null;};}function patchUpdates(_0xd17942){return function(_0xcdf7cd){try{jsonpatch[_0x90e8('0x20')](_0xcdf7cd,_0xd17942,!![]);}catch(_0x428e92){return BPromise['reject'](_0x428e92);}return _0xcdf7cd[_0x90e8('0x21')]();};}function saveUpdates(_0x1171d6,_0x860ada){return function(_0x49211c){if(_0x49211c){return _0x49211c['update'](_0x1171d6)['then'](function(_0x379169){return _0x379169;});}return null;};}function removeEntity(_0x3df59b,_0x4e86c7){return function(_0x480e55){if(_0x480e55){return _0x480e55[_0x90e8('0x22')]()[_0x90e8('0x23')](function(){_0x3df59b[_0x90e8('0x18')](0xcc)[_0x90e8('0x19')]();});}};}function handleEntityNotFound(_0x96b8f4,_0x5195f8){return function(_0x309e2a){if(!_0x309e2a){_0x96b8f4[_0x90e8('0x17')](0x194);}return _0x309e2a;};}function handleError(_0x12d0b8,_0x20badc){_0x20badc=_0x20badc||0x1f4;return function(_0x226762){logger[_0x90e8('0x24')](_0x226762[_0x90e8('0x25')]);if(_0x226762['name']){delete _0x226762[_0x90e8('0x26')];}_0x12d0b8[_0x90e8('0x18')](_0x20badc)[_0x90e8('0x27')](_0x226762);};}exports[_0x90e8('0x28')]=function(_0x1dd730,_0x2c2001){var _0x2acedf={},_0x58851b={},_0x17f659={'count':0x0,'rows':[]};var _0x155f9d=_[_0x90e8('0x29')](db[_0x90e8('0x2a')][_0x90e8('0x2b')],function(_0x275b34){return{'name':_0x275b34[_0x90e8('0x2c')],'type':_0x275b34[_0x90e8('0x2d')][_0x90e8('0x2e')]};});_0x58851b[_0x90e8('0x2f')]=_[_0x90e8('0x29')](_0x155f9d,'name');_0x58851b[_0x90e8('0x30')]=_[_0x90e8('0x31')](_0x1dd730[_0x90e8('0x30')]);_0x58851b[_0x90e8('0x32')]=_[_0x90e8('0x33')](_0x58851b[_0x90e8('0x2f')],_0x58851b['query']);_0x2acedf[_0x90e8('0x34')]=_['intersection'](_0x58851b['model'],qs['fields'](_0x1dd730[_0x90e8('0x30')][_0x90e8('0x35')]));_0x2acedf[_0x90e8('0x34')]=_0x2acedf['attributes']['length']?_0x2acedf[_0x90e8('0x34')]:_0x58851b[_0x90e8('0x2f')];if(!_0x1dd730[_0x90e8('0x30')]['hasOwnProperty'](_0x90e8('0x36'))){_0x2acedf[_0x90e8('0x1d')]=qs[_0x90e8('0x1d')](_0x1dd730[_0x90e8('0x30')][_0x90e8('0x1d')]);_0x2acedf['offset']=qs[_0x90e8('0x1b')](_0x1dd730[_0x90e8('0x30')][_0x90e8('0x1b')]);}_0x2acedf[_0x90e8('0x37')]=qs['sort'](_0x1dd730['query'][_0x90e8('0x38')]);_0x2acedf['where']=qs[_0x90e8('0x32')](_['pick'](_0x1dd730[_0x90e8('0x30')],_0x58851b[_0x90e8('0x32')]),_0x155f9d);if(_0x1dd730[_0x90e8('0x30')][_0x90e8('0x39')]){_0x2acedf[_0x90e8('0x3a')]=_[_0x90e8('0x3b')](_0x2acedf[_0x90e8('0x3a')],{'$or':_['map'](_0x155f9d,function(_0x4884d2){if(_0x4884d2[_0x90e8('0x2d')]!==_0x90e8('0x3c')){var _0x8b7898={};_0x8b7898[_0x4884d2[_0x90e8('0x26')]]={'$like':'%'+_0x1dd730[_0x90e8('0x30')][_0x90e8('0x39')]+'%'};return _0x8b7898;}})});}_0x2acedf=_[_0x90e8('0x3b')]({},_0x2acedf,_0x1dd730['options']);var _0x39d0a9={'where':_0x2acedf[_0x90e8('0x3a')]};return db['WhatsappTransferReport']['count'](_0x39d0a9)[_0x90e8('0x23')](function(_0x18e5e7){_0x17f659[_0x90e8('0x1c')]=_0x18e5e7;if(_0x1dd730['query'][_0x90e8('0x3d')]){_0x2acedf[_0x90e8('0x3e')]=[{'all':!![]}];}return db[_0x90e8('0x2a')]['findAll'](_0x2acedf);})['then'](function(_0x20163b){_0x17f659[_0x90e8('0x3f')]=_0x20163b;return _0x17f659;})[_0x90e8('0x23')](respondWithFilteredResult(_0x2c2001,_0x2acedf))[_0x90e8('0x40')](handleError(_0x2c2001,null));};exports[_0x90e8('0x41')]=function(_0x6cf84b,_0x5b1479){var _0x339651={'raw':!![],'where':{'id':_0x6cf84b[_0x90e8('0x42')]['id']}},_0x9017de={};_0x9017de[_0x90e8('0x2f')]=_['keys'](db[_0x90e8('0x2a')]['rawAttributes']);_0x9017de[_0x90e8('0x30')]=_[_0x90e8('0x31')](_0x6cf84b[_0x90e8('0x30')]);_0x9017de[_0x90e8('0x32')]=_[_0x90e8('0x33')](_0x9017de['model'],_0x9017de[_0x90e8('0x30')]);_0x339651[_0x90e8('0x34')]=_['intersection'](_0x9017de[_0x90e8('0x2f')],qs['fields'](_0x6cf84b['query']['fields']));_0x339651[_0x90e8('0x34')]=_0x339651[_0x90e8('0x34')][_0x90e8('0x43')]?_0x339651[_0x90e8('0x34')]:_0x9017de[_0x90e8('0x2f')];if(_0x6cf84b[_0x90e8('0x30')]['includeAll']){_0x339651[_0x90e8('0x3e')]=[{'all':!![]}];}_0x339651=_[_0x90e8('0x3b')]({},_0x339651,_0x6cf84b[_0x90e8('0x44')]);return db[_0x90e8('0x2a')][_0x90e8('0x45')](_0x339651)[_0x90e8('0x23')](handleEntityNotFound(_0x5b1479,null))['then'](respondWithResult(_0x5b1479,null))[_0x90e8('0x40')](handleError(_0x5b1479,null));};exports[_0x90e8('0x46')]=function(_0x1d4779,_0x4423c8){return db[_0x90e8('0x2a')][_0x90e8('0x46')](_0x1d4779[_0x90e8('0x47')],{})[_0x90e8('0x23')](respondWithResult(_0x4423c8,0xc9))[_0x90e8('0x40')](handleError(_0x4423c8,null));};exports[_0x90e8('0x48')]=function(_0x4c5168,_0x2c33b8){if(_0x4c5168[_0x90e8('0x47')]['id']){delete _0x4c5168[_0x90e8('0x47')]['id'];}return db[_0x90e8('0x2a')][_0x90e8('0x45')]({'where':{'id':_0x4c5168[_0x90e8('0x42')]['id']}})['then'](handleEntityNotFound(_0x2c33b8,null))[_0x90e8('0x23')](saveUpdates(_0x4c5168[_0x90e8('0x47')],null))['then'](respondWithResult(_0x2c33b8,null))[_0x90e8('0x40')](handleError(_0x2c33b8,null));};exports[_0x90e8('0x22')]=function(_0x5b2404,_0x468c7c){return db[_0x90e8('0x2a')][_0x90e8('0x45')]({'where':{'id':_0x5b2404[_0x90e8('0x42')]['id']}})['then'](handleEntityNotFound(_0x468c7c,null))[_0x90e8('0x23')](removeEntity(_0x468c7c,null))[_0x90e8('0x40')](handleError(_0x468c7c,null));};exports['describe']=function(_0x574bcb,_0x30f82b){return db[_0x90e8('0x2a')][_0x90e8('0x49')]()[_0x90e8('0x23')](respondWithResult(_0x30f82b,null))[_0x90e8('0x40')](handleError(_0x30f82b,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index 75a6c33..e248f6a 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 _0x214f=['./whatsappTransferReport.attributes','exports','define','WhatsappTransferReport','uniqueid','util','../../config/logger','api','moment','request-promise','path','../../config/environment'];(function(_0x56fd4d,_0x2b1ade){var _0x2a5fbf=function(_0x386a03){while(--_0x386a03){_0x56fd4d['push'](_0x56fd4d['shift']());}};_0x2a5fbf(++_0x2b1ade);}(_0x214f,0x155));var _0xf214=function(_0x5cd3d4,_0x282954){_0x5cd3d4=_0x5cd3d4-0x0;var _0xaf9193=_0x214f[_0x5cd3d4];return _0xaf9193;};'use strict';var _=require('lodash');var util=require(_0xf214('0x0'));var logger=require(_0xf214('0x1'))(_0xf214('0x2'));var moment=require(_0xf214('0x3'));var BPromise=require('bluebird');var rp=require(_0xf214('0x4'));var fs=require('fs');var path=require(_0xf214('0x5'));var rimraf=require('rimraf');var config=require(_0xf214('0x6'));var attributes=require(_0xf214('0x7'));module[_0xf214('0x8')]=function(_0x3e78dd,_0xf2d852){return _0x3e78dd[_0xf214('0x9')](_0xf214('0xa'),attributes,{'tableName':'report_whatsapp_transfer','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xf214('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7381=['request-promise','path','rimraf','../../config/environment','./whatsappTransferReport.attributes','exports','define','WhatsappTransferReport','uniqueid','lodash','util','../../config/logger','moment'];(function(_0x56ca38,_0xb8c2b7){var _0x139a5b=function(_0x2cb8a3){while(--_0x2cb8a3){_0x56ca38['push'](_0x56ca38['shift']());}};_0x139a5b(++_0xb8c2b7);}(_0x7381,0x1dd));var _0x1738=function(_0xf9a6cf,_0x11870e){_0xf9a6cf=_0xf9a6cf-0x0;var _0x59e2bc=_0x7381[_0xf9a6cf];return _0x59e2bc;};'use strict';var _=require(_0x1738('0x0'));var util=require(_0x1738('0x1'));var logger=require(_0x1738('0x2'))('api');var moment=require(_0x1738('0x3'));var BPromise=require('bluebird');var rp=require(_0x1738('0x4'));var fs=require('fs');var path=require(_0x1738('0x5'));var rimraf=require(_0x1738('0x6'));var config=require(_0x1738('0x7'));var attributes=require(_0x1738('0x8'));module[_0x1738('0x9')]=function(_0x3557e9,_0x2e55e6){return _0x3557e9[_0x1738('0xa')](_0x1738('0xb'),attributes,{'tableName':'report_whatsapp_transfer','paranoid':![],'indexes':[{'name':_0x1738('0xc'),'fields':[_0x1738('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js b/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js index 4d0365f..574adae 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 _0x24db=['info','WhatsappTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','result','message','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','then'];(function(_0x806a28,_0x132ee5){var _0x59ebbd=function(_0x50f840){while(--_0x50f840){_0x806a28['push'](_0x806a28['shift']());}};_0x59ebbd(++_0x132ee5);}(_0x24db,0x11b));var _0xb24d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x24db[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xb24d('0x0'));var moment=require(_0xb24d('0x1'));var BPromise=require(_0xb24d('0x2'));var rs=require(_0xb24d('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb24d('0x4'))['db'];var utils=require(_0xb24d('0x5'));var logger=require(_0xb24d('0x6'))(_0xb24d('0x7'));var config=require(_0xb24d('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xb24d('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1e6fa9,_0xf0dd7a,_0x3f36be){return new BPromise(function(_0x425abc,_0x1ac481){return client['request'](_0x1e6fa9,_0x3f36be)[_0xb24d('0xa')](function(_0x1bd5a7){logger[_0xb24d('0xb')](_0xb24d('0xc'),_0xf0dd7a,_0xb24d('0xd'));logger[_0xb24d('0xe')]('WhatsappTransferReport,\x20%s,\x20%s,\x20%s',_0xf0dd7a,_0xb24d('0xd'),JSON[_0xb24d('0xf')](_0x1bd5a7));if(_0x1bd5a7['error']){if(_0x1bd5a7[_0xb24d('0x10')][_0xb24d('0x11')]===0x1f4){logger['error'](_0xb24d('0xc'),_0xf0dd7a,_0x1bd5a7[_0xb24d('0x10')]['message']);return _0x1ac481(_0x1bd5a7['error']['message']);}logger[_0xb24d('0x10')](_0xb24d('0xc'),_0xf0dd7a,_0x1bd5a7[_0xb24d('0x10')]['message']);return _0x425abc(_0x1bd5a7[_0xb24d('0x10')]['message']);}else{logger[_0xb24d('0xb')](_0xb24d('0xc'),_0xf0dd7a,_0xb24d('0xd'));_0x425abc(_0x1bd5a7[_0xb24d('0x12')][_0xb24d('0x13')]);}})[_0xb24d('0x14')](function(_0x429bf8){logger[_0xb24d('0x10')](_0xb24d('0xc'),_0xf0dd7a,_0x429bf8);_0x1ac481(_0x429bf8);});});} \ No newline at end of file +var _0x961b=['message','info','result','catch','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','request','then','WhatsappTransferReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x116be2,_0x1d65cc){var _0x489558=function(_0x11b3ba){while(--_0x11b3ba){_0x116be2['push'](_0x116be2['shift']());}};_0x489558(++_0x1d65cc);}(_0x961b,0x115));var _0xb961=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0x961b[_0x4154a6];return _0x3b2786;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xb961('0x0'));var rs=require(_0xb961('0x1'));var fs=require('fs');var Redis=require(_0xb961('0x2'));var db=require(_0xb961('0x3'))['db'];var utils=require(_0xb961('0x4'));var logger=require('../../config/logger')(_0xb961('0x5'));var config=require('../../config/environment');var jayson=require(_0xb961('0x6'));var client=jayson[_0xb961('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5961db,_0x2729a3,_0x261467){return new BPromise(function(_0x5d2b1d,_0x1f170c){return client[_0xb961('0x8')](_0x5961db,_0x261467)[_0xb961('0x9')](function(_0xc224b4){logger['info'](_0xb961('0xa'),_0x2729a3,_0xb961('0xb'));logger[_0xb961('0xc')](_0xb961('0xd'),_0x2729a3,_0xb961('0xb'),JSON[_0xb961('0xe')](_0xc224b4));if(_0xc224b4[_0xb961('0xf')]){if(_0xc224b4[_0xb961('0xf')][_0xb961('0x10')]===0x1f4){logger['error']('WhatsappTransferReport,\x20%s,\x20%s',_0x2729a3,_0xc224b4[_0xb961('0xf')][_0xb961('0x11')]);return _0x1f170c(_0xc224b4[_0xb961('0xf')]['message']);}logger[_0xb961('0xf')](_0xb961('0xa'),_0x2729a3,_0xc224b4['error'][_0xb961('0x11')]);return _0x5d2b1d(_0xc224b4['error'][_0xb961('0x11')]);}else{logger[_0xb961('0x12')]('WhatsappTransferReport,\x20%s,\x20%s',_0x2729a3,'request\x20sent');_0x5d2b1d(_0xc224b4[_0xb961('0x13')][_0xb961('0x11')]);}})[_0xb961('0x14')](function(_0x140cf4){logger[_0xb961('0xf')](_0xb961('0xa'),_0x2729a3,_0x140cf4);_0x1f170c(_0x140cf4);});});} \ No newline at end of file diff --git a/server/app.js b/server/app.js index 448c3c5..a5de943 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x93bb=['map','pm2_env','name','Online\x20apps:','online','join','Offline\x20apps:','None','log','App\x20Ready!','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','lodash','./mysqldb','./config/seedDB','./config/license','./rpc','./config/environment','./config/logger','app','./config/pm2','./config/pm2/config','./config/schedule/chat','./config/schedule/whatsapp','./config/schedule/cloud-provider','sequelize','then','seedDB','default','listen','info','start','filter','exitCode','number','length'];(function(_0x2b5eae,_0x55010d){var _0x5f3ac9=function(_0x397bfc){while(--_0x397bfc){_0x2b5eae['push'](_0x2b5eae['shift']());}};_0x5f3ac9(++_0x55010d);}(_0x93bb,0x135));var _0xb93b=function(_0xfcffa0,_0x24e248){_0xfcffa0=_0xfcffa0-0x0;var _0x2c1745=_0x93bb[_0xfcffa0];return _0x2c1745;};'use strict';var _=require(_0xb93b('0x0'));var db=require(_0xb93b('0x1'))['db'];var seedDb=require(_0xb93b('0x2'));var checkLicense=require(_0xb93b('0x3'));var rpc=require(_0xb93b('0x4'));var config=require(_0xb93b('0x5'));var logger=require(_0xb93b('0x6'))(_0xb93b('0x7'));var pm2=require(_0xb93b('0x8'));var pm2Config=require(_0xb93b('0x9'));var schedule=require('./config/schedule');var chat=require(_0xb93b('0xa'));var whatsapp=require(_0xb93b('0xb'));var transcribe=require('./config/schedule/transcribe');var provider=require(_0xb93b('0xc'));function main(){return db[_0xb93b('0xd')]['sync']()[_0xb93b('0xe')](function(){if(config[_0xb93b('0xf')]){return seedDb[_0xb93b('0x10')]();}})[_0xb93b('0xe')](function(){return checkLicense[_0xb93b('0x10')]();})[_0xb93b('0xe')](function(){return rpc[_0xb93b('0x11')]();})[_0xb93b('0xe')](function(_0x22a3d6){logger[_0xb93b('0x12')](_0x22a3d6);return chat[_0xb93b('0x13')]();})['then'](function(){return whatsapp[_0xb93b('0x13')]();})[_0xb93b('0xe')](function(){return schedule[_0xb93b('0x13')]();})[_0xb93b('0xe')](function(){return transcribe['start']();})[_0xb93b('0xe')](function(){return provider[_0xb93b('0x13')]();})[_0xb93b('0xe')](function(_0x33b53){logger[_0xb93b('0x12')](_0x33b53);return pm2[_0xb93b('0x13')](pm2Config);})[_0xb93b('0xe')](function(_0x58c73b){var _0x1155ef=_0x58c73b[_0xb93b('0x14')](function(_0x4281b6){return typeof _0x4281b6[_0xb93b('0x15')]===_0xb93b('0x16')&&_0x4281b6[_0xb93b('0x15')]>=0x0;});if(_0x1155ef['length']>0x0){throw new Error(_0x1155ef[_0xb93b('0x17')]+'\x20processes\x20failed\x20at\x20startup:\x20'+_[_0xb93b('0x18')](_0x1155ef,function(_0x1f4300){return'\x22'+_0x1f4300[_0xb93b('0x19')][_0xb93b('0x1a')]+'\x22';}));}logger[_0xb93b('0x12')](_0xb93b('0x1b'),_['map'](_[_0xb93b('0x14')](_0x58c73b,{'status':_0xb93b('0x1c')}),_0xb93b('0x1a'))[_0xb93b('0x1d')]());logger[_0xb93b('0x12')](_0xb93b('0x1e'),_['map'](_['filter'](_0x58c73b,function(_0x50f944){return _0x50f944['status']!==_0xb93b('0x1c');}),'name')['join']()||_0xb93b('0x1f'));console[_0xb93b('0x20')](_0xb93b('0x21'));})['catch'](function(_0x2a3e28){console[_0xb93b('0x20')]('Server\x20failed\x20to\x20start\x20due\x20to\x20error!',_0x2a3e28);logger[_0xb93b('0x22')](_0xb93b('0x23'),_0x2a3e28);process[_0xb93b('0x24')](0x1);});}main(); \ No newline at end of file +var _0xfc91=['pm2_env','name','Online\x20apps:','map','online','join','Offline\x20apps:','None','catch','error','exit','./mysqldb','./config/license','./rpc','./config/environment','./config/logger','app','./config/pm2','./config/pm2/config','./config/schedule','./config/schedule/chat','./config/schedule/whatsapp','./config/schedule/transcribe','./config/schedule/cloud-provider','sync','default','then','listen','info','start','filter','exitCode','length','\x20processes\x20failed\x20at\x20startup:\x20'];(function(_0x37715d,_0xdb0d52){var _0x2caac8=function(_0x4a18e9){while(--_0x4a18e9){_0x37715d['push'](_0x37715d['shift']());}};_0x2caac8(++_0xdb0d52);}(_0xfc91,0xb5));var _0x1fc9=function(_0x38b944,_0x1b7a21){_0x38b944=_0x38b944-0x0;var _0x353d04=_0xfc91[_0x38b944];return _0x353d04;};'use strict';var _=require('lodash');var db=require(_0x1fc9('0x0'))['db'];var seedDb=require('./config/seedDB');var checkLicense=require(_0x1fc9('0x1'));var rpc=require(_0x1fc9('0x2'));var config=require(_0x1fc9('0x3'));var logger=require(_0x1fc9('0x4'))(_0x1fc9('0x5'));var pm2=require(_0x1fc9('0x6'));var pm2Config=require(_0x1fc9('0x7'));var schedule=require(_0x1fc9('0x8'));var chat=require(_0x1fc9('0x9'));var whatsapp=require(_0x1fc9('0xa'));var transcribe=require(_0x1fc9('0xb'));var provider=require(_0x1fc9('0xc'));function main(){return db['sequelize'][_0x1fc9('0xd')]()['then'](function(){if(config['seedDB']){return seedDb[_0x1fc9('0xe')]();}})[_0x1fc9('0xf')](function(){return checkLicense[_0x1fc9('0xe')]();})[_0x1fc9('0xf')](function(){return rpc[_0x1fc9('0x10')]();})[_0x1fc9('0xf')](function(_0x43e0f0){logger[_0x1fc9('0x11')](_0x43e0f0);return chat[_0x1fc9('0x12')]();})[_0x1fc9('0xf')](function(){return whatsapp[_0x1fc9('0x12')]();})[_0x1fc9('0xf')](function(){return schedule[_0x1fc9('0x12')]();})[_0x1fc9('0xf')](function(){return transcribe[_0x1fc9('0x12')]();})[_0x1fc9('0xf')](function(){return provider[_0x1fc9('0x12')]();})['then'](function(_0xeafb47){logger[_0x1fc9('0x11')](_0xeafb47);return pm2['start'](pm2Config);})[_0x1fc9('0xf')](function(_0x39fe61){var _0x2d55ae=_0x39fe61[_0x1fc9('0x13')](function(_0x3e0c75){return typeof _0x3e0c75[_0x1fc9('0x14')]==='number'&&_0x3e0c75['exitCode']>=0x0;});if(_0x2d55ae[_0x1fc9('0x15')]>0x0){throw new Error(_0x2d55ae['length']+_0x1fc9('0x16')+_['map'](_0x2d55ae,function(_0x533635){return'\x22'+_0x533635[_0x1fc9('0x17')][_0x1fc9('0x18')]+'\x22';}));}logger[_0x1fc9('0x11')](_0x1fc9('0x19'),_[_0x1fc9('0x1a')](_[_0x1fc9('0x13')](_0x39fe61,{'status':_0x1fc9('0x1b')}),_0x1fc9('0x18'))[_0x1fc9('0x1c')]());logger[_0x1fc9('0x11')](_0x1fc9('0x1d'),_[_0x1fc9('0x1a')](_[_0x1fc9('0x13')](_0x39fe61,function(_0x19d9bd){return _0x19d9bd['status']!=='online';}),_0x1fc9('0x18'))[_0x1fc9('0x1c')]()||_0x1fc9('0x1e'));console['log']('App\x20Ready!');})[_0x1fc9('0x1f')](function(_0x4f8493){console['log']('Server\x20failed\x20to\x20start\x20due\x20to\x20error!',_0x4f8493);logger[_0x1fc9('0x20')]('Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s',_0x4f8493);process[_0x1fc9('0x21')](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index 63271ba..498051a 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 _0x4cf8=['Setting','allowedLoginAttempts','blockDuration','isEqual','apiKeyNonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','Invalid\x20API\x20access\x20key','blocked','blockedAt','add','minutes','catch','User\x20object\x20not\x20found.','update','isWebrtcLicence','getLicense','webrtc','Forbidden','isMiddleware','signToken','setTokenCookie','cookie','motion.token','redirect','/dashboards/general','retrieveApiKey','isNil','apiKeyIat','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','test','ValidationError','validatePasswordHistory','decryptString','split','toLowerCase','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','Sequelize','updatePasswordsHistory','length','splice','unshift','encryptString','join','sign','secret','session','options','promisify','verify','randomBytes','toString','HS512','../../mysqldb','../../config/environment','../../config/license/hardware','../../config/license/util','../encryptor','lodash','jsonwebtoken','express-jwt','composable-middleware','basic-auth','crypto','bluebird','secrets','role','fullname','internal','email','permissions','md5secret','voicePause','chatPause','faxPause','smsPause','showWebBar','lastLoginAt','lastPauseAt','crudPermissions','allowmessenger','passwordResetAt','alias','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControl','phoneBarRemoteControlPort','hotdesk','interface','privacyEnabled','settingsEnabled','wssPort','downloadVoiceRecordings','downloadOmnichannelInteractions','downloadAttachments','ignorePauseForPreviewCalls','chatAutoanswerDelay','emailAutoanswer','emailAutoanswerDelay','smsAutoanswer','smsAutoanswerDelay','openchannelAutoanswerDelay','faxAutoanswer','faxAutoanswerDelay','whatsappAutoanswer','whatsappAutoanswerDelay','isChatInteractionAuthorized','isAuthenticated','use','user','findOne','params','closed','disposition','then','status','unmanaged','Unmanaged.','Forbidden.','headers','authorization','startsWith','Basic','User','authenticate','pass','json','Wrong\x20credentials.','Unknown\x20authorization\x20format','query','apikey','getUuid','find','sub'];(function(_0x263a2f,_0x1e81e3){var _0x8020e8=function(_0x39f91a){while(--_0x39f91a){_0x263a2f['push'](_0x263a2f['shift']());}};_0x8020e8(++_0x1e81e3);}(_0x4cf8,0x1e1));var _0x84cf=function(_0x367995,_0x129ae2){_0x367995=_0x367995-0x0;var _0x22daa8=_0x4cf8[_0x367995];return _0x22daa8;};'use strict';var db=require(_0x84cf('0x0'))['db'];var config=require(_0x84cf('0x1'));var hardwareConf=require(_0x84cf('0x2'));var licenseUtil=require(_0x84cf('0x3'));var encryptor=require(_0x84cf('0x4'));var _=require(_0x84cf('0x5'));var jwt=require(_0x84cf('0x6'));var expressJwt=require(_0x84cf('0x7'));var compose=require(_0x84cf('0x8'));var basicAuth=require(_0x84cf('0x9'));var crypto=require(_0x84cf('0xa'));var BPromise=require(_0x84cf('0xb'));var util=require('util');var moment=require('moment');var validateJwt=expressJwt({'secret':config[_0x84cf('0xc')]['session']});var userAttributes=['id',_0x84cf('0xd'),_0x84cf('0xe'),'name',_0x84cf('0xf'),_0x84cf('0x10'),'userpic',_0x84cf('0x11'),_0x84cf('0x12'),_0x84cf('0x13'),_0x84cf('0x14'),'mailPause',_0x84cf('0x15'),_0x84cf('0x16'),'openchannelPause','pauseType',_0x84cf('0x17'),_0x84cf('0x18'),_0x84cf('0x19'),_0x84cf('0x1a'),_0x84cf('0x1b'),_0x84cf('0x1c'),_0x84cf('0x1d'),_0x84cf('0x1e'),_0x84cf('0x1f'),_0x84cf('0x20'),_0x84cf('0x21'),_0x84cf('0x22'),_0x84cf('0x23'),_0x84cf('0x24'),_0x84cf('0x25'),_0x84cf('0x26'),_0x84cf('0x27'),_0x84cf('0x28'),_0x84cf('0x29'),'userProfileId',_0x84cf('0x2a'),_0x84cf('0x2b'),_0x84cf('0x2c'),_0x84cf('0x2d'),_0x84cf('0x2e'),_0x84cf('0x2f'),_0x84cf('0x30'),'selectRecallMeCampaign','chatAutoanswer',_0x84cf('0x31'),_0x84cf('0x32'),_0x84cf('0x33'),_0x84cf('0x34'),_0x84cf('0x35'),'openchannelAutoanswer',_0x84cf('0x36'),_0x84cf('0x37'),_0x84cf('0x38'),_0x84cf('0x39'),_0x84cf('0x3a'),'messengerSoundNotification'];exports[_0x84cf('0x3b')]=function(){return this[_0x84cf('0x3c')](!![])[_0x84cf('0x3d')](function(_0x23e1e7,_0x3e5e94,_0x29e9e1){if(_0x23e1e7[_0x84cf('0x3e')]){_0x29e9e1();}else{return db['ChatInteraction'][_0x84cf('0x3f')]({'where':{'id':_0x23e1e7[_0x84cf('0x40')]['id']},'attributes':['id',_0x84cf('0x41'),_0x84cf('0x42')],'raw':!![]})[_0x84cf('0x43')](function(_0x44d4bf){if(_0x44d4bf&&_0x44d4bf[_0x84cf('0x41')]){return _0x3e5e94[_0x84cf('0x44')](_0x44d4bf[_0x84cf('0x42')]===_0x84cf('0x45')?0x195:0x193)['json']({'message':_0x44d4bf[_0x84cf('0x42')]===_0x84cf('0x45')?_0x84cf('0x46'):_0x84cf('0x47')});}else{_0x29e9e1();}})['catch'](function(_0x1595dd){_0x29e9e1(_0x1595dd);});}});};exports['isAuthenticated']=function isAuthenticated(_0x29455e){return compose()[_0x84cf('0x3d')](function(_0x43b41b,_0xc15298,_0x51adcf){var _0x20de4b;if(_0x43b41b[_0x84cf('0x48')][_0x84cf('0x49')]){if(_[_0x84cf('0x4a')](_0x43b41b[_0x84cf('0x48')][_0x84cf('0x49')],_0x84cf('0x4b'))){var _0x18243d=basicAuth(_0x43b41b);db[_0x84cf('0x4c')]['find']({'where':{'name':_0x18243d['name']}})[_0x84cf('0x43')](function(_0x25de3a){if(!_0x25de3a||!_0x25de3a[_0x84cf('0x4d')](_0x18243d[_0x84cf('0x4e')])){return _0xc15298[_0x84cf('0x44')](0x191)[_0x84cf('0x4f')]({'message':_0x84cf('0x50')});}_0x43b41b[_0x84cf('0x3e')]={'id':_0x25de3a['id']};_0x51adcf();})['catch'](function(_0x113b3e){_0x51adcf(_0x113b3e);});}else if(_[_0x84cf('0x4a')](_0x43b41b['headers'][_0x84cf('0x49')],'Bearer')){validateJwt(_0x43b41b,_0xc15298,_0x51adcf);}else{if(_0x29455e){_0x51adcf();}else{return _0xc15298[_0x84cf('0x44')](0x193)[_0x84cf('0x4f')]({'message':_0x84cf('0x51')});}}}else if(_0x43b41b[_0x84cf('0x52')][_0x84cf('0x53')]){try{var _0x49d415={'audience':hardwareConf[_0x84cf('0x54')](),'issuer':hardwareConf['getUuid']()};verifyJwt(_0x43b41b['query'][_0x84cf('0x53')],_0x49d415)[_0x84cf('0x43')](function(_0x4c4676){return db[_0x84cf('0x4c')][_0x84cf('0x55')]({'where':{'id':_0x4c4676[_0x84cf('0x56')]}})[_0x84cf('0x43')](function(_0xd13908){_0x20de4b=_0xd13908;return db[_0x84cf('0x57')]['findOne']({'where':{'id':0x1},'attributes':[_0x84cf('0x58'),_0x84cf('0x59')],'raw':!![]});})[_0x84cf('0x43')](function(_0x32cff6){if(!_0x20de4b||!_[_0x84cf('0x5a')](_0x20de4b[_0x84cf('0x5b')],_0x4c4676['nonce'])){return _0xc15298[_0x84cf('0x44')](0x191)['json']({'message':_0x84cf('0x5c')});}if(_0x20de4b[_0x84cf('0x5d')]){return _0xc15298[_0x84cf('0x44')](0x191)[_0x84cf('0x4f')]({'message':_0x84cf('0x5e')});}if(_0x20de4b[_0x84cf('0x5f')]){if(_0x32cff6[_0x84cf('0x59')]>0x0){if(moment(_0x20de4b[_0x84cf('0x60')])[_0x84cf('0x61')](_0x32cff6['blockDuration'],_0x84cf('0x62'))>moment()){return _0xc15298['status'](0x191)[_0x84cf('0x4f')]({'message':_0x84cf('0x5e')});}}else{return _0xc15298['status'](0x191)[_0x84cf('0x4f')]({'message':'Invalid\x20API\x20access\x20key'});}}_0x43b41b[_0x84cf('0x3e')]={'id':_0x20de4b['id']};_0x51adcf();});})['catch'](function(){return _0xc15298[_0x84cf('0x44')](0x191)['json']({'message':_0x84cf('0x5e')});});}catch(_0x40ae50){_0x51adcf(_0x40ae50);}}else if(_0x29455e){_0x51adcf();}else{return _0xc15298['status'](0x193)[_0x84cf('0x4f')]({'message':_0x84cf('0x51')});}})[_0x84cf('0x3d')](function(_0x5ef5fb,_0x3c1314,_0x5f1b8e){if(_0x5ef5fb[_0x84cf('0x3e')]){db['User']['find']({'where':{'id':_0x5ef5fb['user']['id']},'attributes':userAttributes})[_0x84cf('0x43')](function(_0xcf14ba){if(!_0xcf14ba){return _0x3c1314['status'](0x194)[_0x84cf('0x4f')]({'message':'User\x20not\x20found.'});}_0x5ef5fb[_0x84cf('0x3e')]=_0xcf14ba;_0x5f1b8e();})[_0x84cf('0x63')](function(_0x5ce309){_0x5f1b8e(_0x5ce309);});}else if(_0x29455e){_0x5f1b8e();}else{return _0x3c1314[_0x84cf('0x44')](0x194)['json']({'message':_0x84cf('0x64')});}});};exports['canUpdate']=function canUpdate(){return compose()['use'](function(_0x5d8b69,_0x5498ec,_0x585644){return licenseUtil['getLicense']()['then'](function(_0x210d9b){if(_0x210d9b[_0x84cf('0x65')]){_0x585644();}else{return _0x5498ec[_0x84cf('0x44')](0x193)[_0x84cf('0x4f')]({'message':'Forbidden'});}})[_0x84cf('0x63')](function(_0x4af229){_0x585644(_0x4af229);});});};exports[_0x84cf('0x66')]=function isWebrtcLicence(){return compose()[_0x84cf('0x3d')](function(_0x1533a7,_0x253464,_0x121bb9){return licenseUtil[_0x84cf('0x67')]()['then'](function(_0x2f7da6){if(_0x2f7da6[_0x84cf('0x68')]){_0x121bb9();}else{return _0x253464['status'](0x193)[_0x84cf('0x4f')]({'message':_0x84cf('0x69')});}})[_0x84cf('0x63')](function(_0x5212ec){_0x121bb9(_0x5212ec);});});};exports['isMiddleware']=function(_0x5499f9,_0x1cf3f6,_0x104421){_0x5499f9[_0x84cf('0x6a')]=!![];return _0x104421();};exports[_0x84cf('0x6b')]=function signToken(_0x271cc3){return signJwt(_0x271cc3);};exports[_0x84cf('0x6c')]=function(_0x51d725,_0x350985){if(!_0x51d725['user']){return _0x350985[_0x84cf('0x44')](0x194)['json']({'message':'It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.'});}var _0x46c595={'payload':{'id':_0x51d725[_0x84cf('0x3e')]['id'],'role':_0x51d725[_0x84cf('0x3e')]['role']},'options':{'expiresIn':0x15180}};return signJwt(_0x46c595)['then'](function(_0x290a4d){_0x350985[_0x84cf('0x6d')](_0x84cf('0x6e'),_0x290a4d);_0x350985[_0x84cf('0x6f')](_0x84cf('0x70'));})['catch'](function(_0xcfe28f){return _0x350985[_0x84cf('0x44')](0x1f4)['send'](_0xcfe28f);});};exports[_0x84cf('0x71')]=function(_0x5baea8){if(_['isNil'](_0x5baea8[_0x84cf('0x5b')])||_[_0x84cf('0x72')](_0x5baea8['apiKeyIat'])){return null;}else{return createJwt(_0x5baea8);}};exports['generateApiKey']=function(_0x31176c){_0x31176c[_0x84cf('0x5b')]=generateNonce();_0x31176c[_0x84cf('0x73')]=generateIssuedAt();return createJwt(_0x31176c);};exports[_0x84cf('0x74')]=function(_0x406c33,_0x3edaec){var _0x3a0eb4=_0x406c33[_0x84cf('0x52')]['apikey'];if(_0x3a0eb4){var _0x1bc15c={'nonce':_0x3edaec[_0x84cf('0x5b')],'iat':_0x3edaec['apiKeyIat'],'audience':hardwareConf['getUuid'](),'issuer':hardwareConf[_0x84cf('0x54')]()};return verifyJwt(_0x3a0eb4,_0x1bc15c)[_0x84cf('0x43')](function(){return generateApiKey(_0x3edaec);});}else{throw{'message':_0x84cf('0x75')};}};exports[_0x84cf('0x76')]=function(_0x340915){var _0xfec87d=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0xfec87d[_0x84cf('0x77')](_0x340915))throw new db['Sequelize'][(_0x84cf('0x78'))]('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[_0x84cf('0x79')]=function(_0x5c0122,_0x2a60bc,_0x1c2f1b){var _0x55d8c4=encryptor[_0x84cf('0x7a')](_0x2a60bc)[_0x84cf('0x7b')](',');for(var _0x52a3f1=0x0;_0x52a3f1<_0x1c2f1b;_0x52a3f1++){if(!_0x55d8c4[_0x52a3f1])break;if(_0x5c0122[_0x84cf('0x7c')]()===_0x55d8c4[_0x52a3f1]['toLowerCase']()){var _0x577d55=util['format']('The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.',_0x1c2f1b);if(_0x1c2f1b===0x1){_0x577d55=_0x84cf('0x7d');}throw new db[(_0x84cf('0x7e'))][(_0x84cf('0x78'))](_0x577d55);}}return;};exports[_0x84cf('0x7f')]=function(_0x480c3e,_0x32aa8b){var _0x3c1c55=_0x32aa8b?encryptor['decryptString'](_0x32aa8b)[_0x84cf('0x7b')](','):[];if(_0x3c1c55[_0x84cf('0x80')]===0x5){_0x3c1c55[_0x84cf('0x81')](-0x1,0x1);}_0x3c1c55[_0x84cf('0x82')](_0x480c3e);return encryptor[_0x84cf('0x83')](_0x3c1c55[_0x84cf('0x84')](','));};function signJwt(_0x1f1f76){var _0x39a336=BPromise['promisify'](jwt[_0x84cf('0x85')],{'context':jwt});var _0x58a96a=_0x1f1f76[_0x84cf('0x86')]||config[_0x84cf('0xc')][_0x84cf('0x87')];return new BPromise(function(_0x276ab1,_0x2602b7){_0x39a336(_0x1f1f76['payload'],_0x58a96a,_0x1f1f76[_0x84cf('0x88')])[_0x84cf('0x43')](function(_0xe1a1d9){_0x276ab1(_0xe1a1d9);})['catch'](function(_0xdb9b0c){_0x2602b7(_0xdb9b0c);});});}function verifyJwt(_0x240cca,_0x4e6077,_0x84d9cb){var _0x482958=BPromise[_0x84cf('0x89')](jwt[_0x84cf('0x8a')],{'context':jwt});var _0x57f1f2=_0x84d9cb||config[_0x84cf('0xc')][_0x84cf('0x87')];return new BPromise(function(_0x4a7905,_0x40b33e){_0x482958(_0x240cca,_0x57f1f2,_0x4e6077)[_0x84cf('0x43')](function(_0x262ae1){_0x4a7905(_0x262ae1);})[_0x84cf('0x63')](function(_0x577ade){_0x40b33e(_0x577ade);});});}function generateNonce(){return crypto[_0x84cf('0x8b')](0x10)[_0x84cf('0x8c')]('hex');}function generateIssuedAt(){return Math['floor'](Date['now']()/0x3e8)[_0x84cf('0x8c')]();}function createJwt(_0x8399f4){var _0xfcd0d={'payload':{'iat':_0x8399f4['apiKeyIat'],'nonce':_0x8399f4['apiKeyNonce']},'options':{'algorithm':_0x84cf('0x8d'),'subject':_0x8399f4['id'][_0x84cf('0x8c')](),'issuer':hardwareConf[_0x84cf('0x54')](),'audience':hardwareConf[_0x84cf('0x54')]()}};return signJwt(_0xfcd0d)[_0x84cf('0x43')](function(_0x39bd44){return{'iat':_0x8399f4[_0x84cf('0x73')],'nonce':_0x8399f4[_0x84cf('0x5b')],'token':_0x39bd44};});} \ No newline at end of file +var _0x2032=['interface','userProfileId','settingsEnabled','wssPort','downloadOmnichannelInteractions','downloadAttachments','selectRecallMeCampaign','chatAutoanswerDelay','emailAutoanswer','emailAutoanswerDelay','smsAutoanswer','smsAutoanswerDelay','openchannelAutoanswer','faxAutoanswer','whatsappAutoanswerDelay','isChatInteractionAuthorized','isAuthenticated','user','ChatInteraction','findOne','params','closed','disposition','then','status','unmanaged','Forbidden.','catch','use','headers','authorization','Basic','find','authenticate','json','Wrong\x20credentials.','Unknown\x20authorization\x20format','query','apikey','getUuid','sub','Setting','isEqual','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','blockedAt','add','blockDuration','minutes','Invalid\x20API\x20access\x20key','User','User\x20not\x20found.','User\x20object\x20not\x20found.','Forbidden','isWebrtcLicence','getLicense','isMiddleware','signToken','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','cookie','motion.token','retrieveApiKey','apiKeyNonce','isNil','apiKeyIat','generateApiKey','regenerateApiKey','test','ValidationError','decryptString','split','toLowerCase','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','Sequelize','updatePasswordsHistory','length','splice','unshift','promisify','sign','secret','payload','verify','randomBytes','hex','floor','now','HS512','../../config/environment','../../config/license/hardware','../../config/license/util','lodash','jsonwebtoken','composable-middleware','basic-auth','crypto','bluebird','util','moment','secrets','session','role','fullname','name','userpic','md5secret','voicePause','chatPause','faxPause','openchannelPause','showWebBar','lastLoginAt','phoneBarAutoAnswer','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControl','phoneBarRemoteControlPort','hotdesk'];(function(_0x3970a6,_0x446ce1){var _0x2e00d2=function(_0x1541ed){while(--_0x1541ed){_0x3970a6['push'](_0x3970a6['shift']());}};_0x2e00d2(++_0x446ce1);}(_0x2032,0xd9));var _0x2203=function(_0x405581,_0x1cf70e){_0x405581=_0x405581-0x0;var _0x1eac4e=_0x2032[_0x405581];return _0x1eac4e;};'use strict';var db=require('../../mysqldb')['db'];var config=require(_0x2203('0x0'));var hardwareConf=require(_0x2203('0x1'));var licenseUtil=require(_0x2203('0x2'));var encryptor=require('../encryptor');var _=require(_0x2203('0x3'));var jwt=require(_0x2203('0x4'));var expressJwt=require('express-jwt');var compose=require(_0x2203('0x5'));var basicAuth=require(_0x2203('0x6'));var crypto=require(_0x2203('0x7'));var BPromise=require(_0x2203('0x8'));var util=require(_0x2203('0x9'));var moment=require(_0x2203('0xa'));var validateJwt=expressJwt({'secret':config[_0x2203('0xb')][_0x2203('0xc')]});var userAttributes=['id',_0x2203('0xd'),_0x2203('0xe'),_0x2203('0xf'),'internal','email',_0x2203('0x10'),'permissions',_0x2203('0x11'),_0x2203('0x12'),_0x2203('0x13'),'mailPause',_0x2203('0x14'),'smsPause',_0x2203('0x15'),'pauseType',_0x2203('0x16'),_0x2203('0x17'),'lastPauseAt','crudPermissions','allowmessenger','passwordResetAt','alias',_0x2203('0x18'),'phoneBarAutoAnswerDelay','phoneBarDnd',_0x2203('0x19'),_0x2203('0x1a'),_0x2203('0x1b'),_0x2203('0x1c'),_0x2203('0x1d'),_0x2203('0x1e'),_0x2203('0x1f'),_0x2203('0x20'),_0x2203('0x21'),_0x2203('0x22'),'privacyEnabled',_0x2203('0x23'),_0x2203('0x24'),'downloadVoiceRecordings',_0x2203('0x25'),_0x2203('0x26'),'ignorePauseForPreviewCalls',_0x2203('0x27'),'chatAutoanswer',_0x2203('0x28'),_0x2203('0x29'),_0x2203('0x2a'),_0x2203('0x2b'),_0x2203('0x2c'),_0x2203('0x2d'),'openchannelAutoanswerDelay',_0x2203('0x2e'),'faxAutoanswerDelay','whatsappAutoanswer',_0x2203('0x2f'),'messengerSoundNotification'];exports[_0x2203('0x30')]=function(){return this[_0x2203('0x31')](!![])['use'](function(_0x3ee25b,_0x5e29cd,_0x5c8da9){if(_0x3ee25b[_0x2203('0x32')]){_0x5c8da9();}else{return db[_0x2203('0x33')][_0x2203('0x34')]({'where':{'id':_0x3ee25b[_0x2203('0x35')]['id']},'attributes':['id',_0x2203('0x36'),_0x2203('0x37')],'raw':!![]})[_0x2203('0x38')](function(_0x250349){if(_0x250349&&_0x250349['closed']){return _0x5e29cd[_0x2203('0x39')](_0x250349[_0x2203('0x37')]===_0x2203('0x3a')?0x195:0x193)['json']({'message':_0x250349[_0x2203('0x37')]===_0x2203('0x3a')?'Unmanaged.':_0x2203('0x3b')});}else{_0x5c8da9();}})[_0x2203('0x3c')](function(_0x1c6a77){_0x5c8da9(_0x1c6a77);});}});};exports[_0x2203('0x31')]=function isAuthenticated(_0x28ae02){return compose()[_0x2203('0x3d')](function(_0x9c53f,_0x5a95c1,_0x34b8ba){var _0x616ed8;if(_0x9c53f[_0x2203('0x3e')][_0x2203('0x3f')]){if(_['startsWith'](_0x9c53f[_0x2203('0x3e')][_0x2203('0x3f')],_0x2203('0x40'))){var _0xf59954=basicAuth(_0x9c53f);db['User'][_0x2203('0x41')]({'where':{'name':_0xf59954[_0x2203('0xf')]}})['then'](function(_0x5c0157){if(!_0x5c0157||!_0x5c0157[_0x2203('0x42')](_0xf59954['pass'])){return _0x5a95c1['status'](0x191)[_0x2203('0x43')]({'message':_0x2203('0x44')});}_0x9c53f[_0x2203('0x32')]={'id':_0x5c0157['id']};_0x34b8ba();})[_0x2203('0x3c')](function(_0xf2801d){_0x34b8ba(_0xf2801d);});}else if(_['startsWith'](_0x9c53f[_0x2203('0x3e')][_0x2203('0x3f')],'Bearer')){validateJwt(_0x9c53f,_0x5a95c1,_0x34b8ba);}else{if(_0x28ae02){_0x34b8ba();}else{return _0x5a95c1[_0x2203('0x39')](0x193)[_0x2203('0x43')]({'message':_0x2203('0x45')});}}}else if(_0x9c53f[_0x2203('0x46')][_0x2203('0x47')]){try{var _0x24d138={'audience':hardwareConf[_0x2203('0x48')](),'issuer':hardwareConf[_0x2203('0x48')]()};verifyJwt(_0x9c53f[_0x2203('0x46')]['apikey'],_0x24d138)[_0x2203('0x38')](function(_0x347d3e){return db['User']['find']({'where':{'id':_0x347d3e[_0x2203('0x49')]}})['then'](function(_0x25cc97){_0x616ed8=_0x25cc97;return db[_0x2203('0x4a')][_0x2203('0x34')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts','blockDuration'],'raw':!![]});})[_0x2203('0x38')](function(_0x47c93a){if(!_0x616ed8||!_[_0x2203('0x4b')](_0x616ed8['apiKeyNonce'],_0x347d3e[_0x2203('0x4c')])){return _0x5a95c1['status'](0x191)[_0x2203('0x43')]({'message':_0x2203('0x4d')});}if(_0x616ed8[_0x2203('0x4e')]){return _0x5a95c1[_0x2203('0x39')](0x191)[_0x2203('0x43')]({'message':'Invalid\x20API\x20access\x20key'});}if(_0x616ed8['blocked']){if(_0x47c93a['blockDuration']>0x0){if(moment(_0x616ed8[_0x2203('0x4f')])[_0x2203('0x50')](_0x47c93a[_0x2203('0x51')],_0x2203('0x52'))>moment()){return _0x5a95c1[_0x2203('0x39')](0x191)[_0x2203('0x43')]({'message':_0x2203('0x53')});}}else{return _0x5a95c1['status'](0x191)[_0x2203('0x43')]({'message':_0x2203('0x53')});}}_0x9c53f[_0x2203('0x32')]={'id':_0x616ed8['id']};_0x34b8ba();});})[_0x2203('0x3c')](function(){return _0x5a95c1['status'](0x191)['json']({'message':_0x2203('0x53')});});}catch(_0x5494a1){_0x34b8ba(_0x5494a1);}}else if(_0x28ae02){_0x34b8ba();}else{return _0x5a95c1[_0x2203('0x39')](0x193)[_0x2203('0x43')]({'message':_0x2203('0x45')});}})['use'](function(_0x5bba52,_0x1e7ebc,_0x3739f6){if(_0x5bba52[_0x2203('0x32')]){db[_0x2203('0x54')][_0x2203('0x41')]({'where':{'id':_0x5bba52[_0x2203('0x32')]['id']},'attributes':userAttributes})['then'](function(_0x15d3b6){if(!_0x15d3b6){return _0x1e7ebc[_0x2203('0x39')](0x194)[_0x2203('0x43')]({'message':_0x2203('0x55')});}_0x5bba52[_0x2203('0x32')]=_0x15d3b6;_0x3739f6();})[_0x2203('0x3c')](function(_0x5b4842){_0x3739f6(_0x5b4842);});}else if(_0x28ae02){_0x3739f6();}else{return _0x1e7ebc[_0x2203('0x39')](0x194)[_0x2203('0x43')]({'message':_0x2203('0x56')});}});};exports['canUpdate']=function canUpdate(){return compose()[_0x2203('0x3d')](function(_0x24e773,_0x4aab80,_0x3b9981){return licenseUtil['getLicense']()['then'](function(_0x1c6661){if(_0x1c6661['update']){_0x3b9981();}else{return _0x4aab80[_0x2203('0x39')](0x193)[_0x2203('0x43')]({'message':_0x2203('0x57')});}})[_0x2203('0x3c')](function(_0x594148){_0x3b9981(_0x594148);});});};exports[_0x2203('0x58')]=function isWebrtcLicence(){return compose()[_0x2203('0x3d')](function(_0x5cd8c6,_0x29bd91,_0x381b3e){return licenseUtil[_0x2203('0x59')]()[_0x2203('0x38')](function(_0x5a71a5){if(_0x5a71a5['webrtc']){_0x381b3e();}else{return _0x29bd91[_0x2203('0x39')](0x193)['json']({'message':'Forbidden'});}})[_0x2203('0x3c')](function(_0x33b7b5){_0x381b3e(_0x33b7b5);});});};exports[_0x2203('0x5a')]=function(_0x49823a,_0x4c1496,_0x131aec){_0x49823a[_0x2203('0x5a')]=!![];return _0x131aec();};exports[_0x2203('0x5b')]=function signToken(_0x21d2d7){return signJwt(_0x21d2d7);};exports[_0x2203('0x5c')]=function(_0x21fd78,_0x4a7f4e){if(!_0x21fd78[_0x2203('0x32')]){return _0x4a7f4e['status'](0x194)[_0x2203('0x43')]({'message':_0x2203('0x5d')});}var _0x246aff={'payload':{'id':_0x21fd78[_0x2203('0x32')]['id'],'role':_0x21fd78['user']['role']},'options':{'expiresIn':0x15180}};return signJwt(_0x246aff)[_0x2203('0x38')](function(_0x1f772d){_0x4a7f4e[_0x2203('0x5e')](_0x2203('0x5f'),_0x1f772d);_0x4a7f4e['redirect']('/dashboards/general');})['catch'](function(_0x4064d5){return _0x4a7f4e[_0x2203('0x39')](0x1f4)['send'](_0x4064d5);});};exports[_0x2203('0x60')]=function(_0x267627){if(_['isNil'](_0x267627[_0x2203('0x61')])||_[_0x2203('0x62')](_0x267627[_0x2203('0x63')])){return null;}else{return createJwt(_0x267627);}};exports[_0x2203('0x64')]=function(_0x4bb6f1){_0x4bb6f1[_0x2203('0x61')]=generateNonce();_0x4bb6f1['apiKeyIat']=generateIssuedAt();return createJwt(_0x4bb6f1);};exports[_0x2203('0x65')]=function(_0x1de713,_0x4ee8cf){var _0x428b18=_0x1de713[_0x2203('0x46')][_0x2203('0x47')];if(_0x428b18){var _0x378132={'nonce':_0x4ee8cf[_0x2203('0x61')],'iat':_0x4ee8cf[_0x2203('0x63')],'audience':hardwareConf['getUuid'](),'issuer':hardwareConf['getUuid']()};return verifyJwt(_0x428b18,_0x378132)[_0x2203('0x38')](function(){return generateApiKey(_0x4ee8cf);});}else{throw{'message':'Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one'};}};exports['validatePasswordPattern']=function(_0xfddc3b){var _0x33e5eb=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x33e5eb[_0x2203('0x66')](_0xfddc3b))throw new db['Sequelize'][(_0x2203('0x67'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');return;};exports['validatePasswordHistory']=function(_0xeb6b44,_0x5be4b6,_0x54ec71){var _0x5efc59=encryptor[_0x2203('0x68')](_0x5be4b6)[_0x2203('0x69')](',');for(var _0x367122=0x0;_0x367122<_0x54ec71;_0x367122++){if(!_0x5efc59[_0x367122])break;if(_0xeb6b44[_0x2203('0x6a')]()===_0x5efc59[_0x367122][_0x2203('0x6a')]()){var _0x32f593=util[_0x2203('0x6b')](_0x2203('0x6c'),_0x54ec71);if(_0x54ec71===0x1){_0x32f593=_0x2203('0x6d');}throw new db[(_0x2203('0x6e'))][(_0x2203('0x67'))](_0x32f593);}}return;};exports[_0x2203('0x6f')]=function(_0x58ff57,_0x585bde){var _0x2cd752=_0x585bde?encryptor[_0x2203('0x68')](_0x585bde)[_0x2203('0x69')](','):[];if(_0x2cd752[_0x2203('0x70')]===0x5){_0x2cd752[_0x2203('0x71')](-0x1,0x1);}_0x2cd752[_0x2203('0x72')](_0x58ff57);return encryptor['encryptString'](_0x2cd752['join'](','));};function signJwt(_0xb49120){var _0x34358e=BPromise[_0x2203('0x73')](jwt[_0x2203('0x74')],{'context':jwt});var _0xcab922=_0xb49120[_0x2203('0x75')]||config[_0x2203('0xb')][_0x2203('0xc')];return new BPromise(function(_0x2c6bcc,_0x135272){_0x34358e(_0xb49120[_0x2203('0x76')],_0xcab922,_0xb49120['options'])[_0x2203('0x38')](function(_0x3ae12e){_0x2c6bcc(_0x3ae12e);})[_0x2203('0x3c')](function(_0x407fc2){_0x135272(_0x407fc2);});});}function verifyJwt(_0x41a938,_0x44e7ab,_0x52c159){var _0x544756=BPromise[_0x2203('0x73')](jwt[_0x2203('0x77')],{'context':jwt});var _0x49e795=_0x52c159||config[_0x2203('0xb')][_0x2203('0xc')];return new BPromise(function(_0x24179a,_0xc193b7){_0x544756(_0x41a938,_0x49e795,_0x44e7ab)[_0x2203('0x38')](function(_0x1e44c){_0x24179a(_0x1e44c);})[_0x2203('0x3c')](function(_0x8a9282){_0xc193b7(_0x8a9282);});});}function generateNonce(){return crypto[_0x2203('0x78')](0x10)['toString'](_0x2203('0x79'));}function generateIssuedAt(){return Math[_0x2203('0x7a')](Date[_0x2203('0x7b')]()/0x3e8)['toString']();}function createJwt(_0x68855d){var _0x3f73e1={'payload':{'iat':_0x68855d[_0x2203('0x63')],'nonce':_0x68855d[_0x2203('0x61')]},'options':{'algorithm':_0x2203('0x7c'),'subject':_0x68855d['id']['toString'](),'issuer':hardwareConf[_0x2203('0x48')](),'audience':hardwareConf[_0x2203('0x48')]()}};return signJwt(_0x3f73e1)[_0x2203('0x38')](function(_0x4dde80){return{'iat':_0x68855d['apiKeyIat'],'nonce':_0x68855d['apiKeyNonce'],'token':_0x4dde80};});} \ No newline at end of file diff --git a/server/components/contacts/index.js b/server/components/contacts/index.js index 63f4bf3..ef68168 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 _0x6c3d=['describe','keys','filter','startsWith','CmCustomField','findOne','slice','all','length','cf_','fieldType','type','lodash','./sql-utils','../../mysqldb','skipContactsQuery','search','parseAdvancedSearchFilter','then','where','default','user','tags','skip','checkListsRestrictions','ids','count','User','fields','clause','getFilteredContacts','rows','catch'];(function(_0x136a7b,_0x4ec17f){var _0x302ce3=function(_0x1a1e54){while(--_0x1a1e54){_0x136a7b['push'](_0x136a7b['shift']());}};_0x302ce3(++_0x4ec17f);}(_0x6c3d,0xb1));var _0xd6c3=function(_0x5a6e9c,_0x2ebafe){_0x5a6e9c=_0x5a6e9c-0x0;var _0x566fc5=_0x6c3d[_0x5a6e9c];return _0x566fc5;};'use strict';var _=require(_0xd6c3('0x0'));var sqlUtils=require(_0xd6c3('0x1'));var db=require(_0xd6c3('0x2'))['db'];exports['findAll']=function(_0x491065,_0x545e29,_0x26dc03,_0x19c17e){var _0x46dee3={'count':0x0,'rows':[]};var _0x5a1d3b=sqlUtils[_0xd6c3('0x3')](_0x545e29,_0x491065);if(_0x5a1d3b){return Promise['resolve'](_0x46dee3);}var _0x5720ae=sqlUtils['getContactsSubquery']();var _0x489af5={};var _0x52b244=![];var _0x2ba6c0=![];return Promise['resolve']()['then'](function(){if(_0x491065[_0xd6c3('0x4')]){return sqlUtils[_0xd6c3('0x5')](_0x491065[_0xd6c3('0x4')],_0x19c17e);}else{return sqlUtils['parseQueryParameters'](_0x491065,_0x19c17e);}})[_0xd6c3('0x6')](function(_0x4b39e9){_0x5720ae[_0xd6c3('0x7')](_0x4b39e9[_0xd6c3('0x8')]);_0x5720ae[_0xd6c3('0x7')](_0x4b39e9['fields']);_0x5720ae[_0xd6c3('0x7')](_0x4b39e9['filter']);_0x5720ae[_0xd6c3('0x7')](_0x4b39e9[_0xd6c3('0x9')]['clause']);_0x489af5=_0x4b39e9[_0xd6c3('0xa')];_0x2ba6c0=_0x4b39e9[_0xd6c3('0x9')][_0xd6c3('0xb')];return sqlUtils[_0xd6c3('0xc')](_0x545e29,_0x491065,_0x2ba6c0);})['then'](function(_0x21a90a){_0x5720ae[_0xd6c3('0x7')](_0x21a90a);var _0x192639=_0x491065[_0xd6c3('0x4')]?_0x489af5[_0xd6c3('0xd')]:_0x491065['tag'];_0x52b244=_0x192639?!![]:![];return sqlUtils['countFilteredContacts'](_0x5720ae,_0x192639);})[_0xd6c3('0x6')](function(_0x14c51f){_0x46dee3['count']=_0x14c51f;if(_0x46dee3[_0xd6c3('0xe')]===0x0){return;}if(_0x491065[_0xd6c3('0xf')]){_0x2ba6c0=!![];}return sqlUtils['buildContactsQuery'](_0x5720ae,_0x491065[_0xd6c3('0x10')],_0x26dc03,_0x52b244,_0x489af5[_0xd6c3('0x11')],_0x2ba6c0);})[_0xd6c3('0x6')](function(_0x386af6){if(!_0x386af6){return[];}return sqlUtils[_0xd6c3('0x12')](_0x386af6,_0x491065,_0x26dc03);})[_0xd6c3('0x6')](function(_0x16ecf4){_0x46dee3[_0xd6c3('0x13')]=_0x16ecf4;return _0x46dee3;})[_0xd6c3('0x14')](function(_0x2b1f5){throw _0x2b1f5;});};exports[_0xd6c3('0x15')]=function(){var _0x41e6a8={};var _0x5358b5=[];return db['CmContact'][_0xd6c3('0x15')]()['then'](function(_0x363950){_0x41e6a8=_0x363950;var _0x15f222=Object[_0xd6c3('0x16')](_0x41e6a8)[_0xd6c3('0x17')](function(_0x3378be){return _[_0xd6c3('0x18')](_0x3378be,'cf_')?_0x3378be:undefined;});var _0x349a8b=_0x15f222['map'](function(_0x5218c0){return db[_0xd6c3('0x19')][_0xd6c3('0x1a')]({'where':{'id':_0x5218c0[_0xd6c3('0x1b')](0x3)},'raw':!![]});});return Promise[_0xd6c3('0x1c')](_0x349a8b);})[_0xd6c3('0x6')](function(_0xef2607){for(var _0x465e4c=0x0;_0x465e4c<_0xef2607[_0xd6c3('0x1d')];_0x465e4c++){if(_0xef2607[_0x465e4c]){var _0x38ffa2=_0xd6c3('0x1e')+_0xef2607[_0x465e4c]['id'];_0x41e6a8[_0x38ffa2][_0xd6c3('0x1f')]=_0xef2607[_0x465e4c][_0xd6c3('0x20')];}}_0x5358b5=_['map'](Object[_0xd6c3('0x16')](_0x41e6a8),function(_0x4888fa){return{'name':_0x4888fa,'type':_0x41e6a8[_0x4888fa]['type']};});return _0x5358b5;})[_0xd6c3('0x14')](function(_0x5da468){throw _0x5da468;});}; \ No newline at end of file +var _0x910b=['buildContactsQuery','getFilteredContacts','rows','CmContact','describe','startsWith','map','CmCustomField','slice','all','length','cf_','type','keys','catch','lodash','../../mysqldb','findAll','skipContactsQuery','resolve','getContactsSubquery','then','parseAdvancedSearchFilter','search','parseQueryParameters','where','default','fields','filter','user','clause','tags','skip','checkListsRestrictions','ids','count','User'];(function(_0x232a49,_0x13ecf9){var _0x3bdc0e=function(_0x281aae){while(--_0x281aae){_0x232a49['push'](_0x232a49['shift']());}};_0x3bdc0e(++_0x13ecf9);}(_0x910b,0x1cb));var _0xb910=function(_0x4756d5,_0x20560a){_0x4756d5=_0x4756d5-0x0;var _0xf834a8=_0x910b[_0x4756d5];return _0xf834a8;};'use strict';var _=require(_0xb910('0x0'));var sqlUtils=require('./sql-utils');var db=require(_0xb910('0x1'))['db'];exports[_0xb910('0x2')]=function(_0x112cc6,_0x65e23a,_0x48e687,_0x5cebde){var _0x3a7ea9={'count':0x0,'rows':[]};var _0xd1513f=sqlUtils[_0xb910('0x3')](_0x65e23a,_0x112cc6);if(_0xd1513f){return Promise[_0xb910('0x4')](_0x3a7ea9);}var _0x30e0c7=sqlUtils[_0xb910('0x5')]();var _0x536f7d={};var _0x19c2ae=![];var _0x41e6e5=![];return Promise[_0xb910('0x4')]()[_0xb910('0x6')](function(){if(_0x112cc6['search']){return sqlUtils[_0xb910('0x7')](_0x112cc6[_0xb910('0x8')],_0x5cebde);}else{return sqlUtils[_0xb910('0x9')](_0x112cc6,_0x5cebde);}})['then'](function(_0x183dbe){_0x30e0c7[_0xb910('0xa')](_0x183dbe[_0xb910('0xb')]);_0x30e0c7['where'](_0x183dbe[_0xb910('0xc')]);_0x30e0c7['where'](_0x183dbe[_0xb910('0xd')]);_0x30e0c7[_0xb910('0xa')](_0x183dbe[_0xb910('0xe')][_0xb910('0xf')]);_0x536f7d=_0x183dbe[_0xb910('0x10')];_0x41e6e5=_0x183dbe[_0xb910('0xe')][_0xb910('0x11')];return sqlUtils[_0xb910('0x12')](_0x65e23a,_0x112cc6,_0x41e6e5);})[_0xb910('0x6')](function(_0x361051){_0x30e0c7[_0xb910('0xa')](_0x361051);var _0x16391e=_0x112cc6[_0xb910('0x8')]?_0x536f7d[_0xb910('0x13')]:_0x112cc6['tag'];_0x19c2ae=_0x16391e?!![]:![];return sqlUtils['countFilteredContacts'](_0x30e0c7,_0x16391e);})[_0xb910('0x6')](function(_0x4cd5b9){_0x3a7ea9[_0xb910('0x14')]=_0x4cd5b9;if(_0x3a7ea9[_0xb910('0x14')]===0x0){return;}if(_0x112cc6[_0xb910('0x15')]){_0x41e6e5=!![];}return sqlUtils[_0xb910('0x16')](_0x30e0c7,_0x112cc6[_0xb910('0xc')],_0x48e687,_0x19c2ae,_0x536f7d[_0xb910('0xf')],_0x41e6e5);})[_0xb910('0x6')](function(_0x217f88){if(!_0x217f88){return[];}return sqlUtils[_0xb910('0x17')](_0x217f88,_0x112cc6,_0x48e687);})[_0xb910('0x6')](function(_0x396c24){_0x3a7ea9[_0xb910('0x18')]=_0x396c24;return _0x3a7ea9;})['catch'](function(_0xea6e6d){throw _0xea6e6d;});};exports['describe']=function(){var _0x29e7de={};var _0x224fc7=[];return db[_0xb910('0x19')][_0xb910('0x1a')]()[_0xb910('0x6')](function(_0x14508b){_0x29e7de=_0x14508b;var _0x7c9ae1=Object['keys'](_0x29e7de)['filter'](function(_0x544188){return _[_0xb910('0x1b')](_0x544188,'cf_')?_0x544188:undefined;});var _0x3bd096=_0x7c9ae1[_0xb910('0x1c')](function(_0x57e9e6){return db[_0xb910('0x1d')]['findOne']({'where':{'id':_0x57e9e6[_0xb910('0x1e')](0x3)},'raw':!![]});});return Promise[_0xb910('0x1f')](_0x3bd096);})['then'](function(_0x4dc03c){for(var _0x1f07f0=0x0;_0x1f07f0<_0x4dc03c[_0xb910('0x20')];_0x1f07f0++){if(_0x4dc03c[_0x1f07f0]){var _0xad6b02=_0xb910('0x21')+_0x4dc03c[_0x1f07f0]['id'];_0x29e7de[_0xad6b02]['fieldType']=_0x4dc03c[_0x1f07f0][_0xb910('0x22')];}}_0x224fc7=_[_0xb910('0x1c')](Object[_0xb910('0x23')](_0x29e7de),function(_0x129059){return{'name':_0x129059,'type':_0x29e7de[_0x129059]['type']};});return _0x224fc7;})[_0xb910('0x24')](function(_0x23407e){throw _0x23407e;});}; \ No newline at end of file diff --git a/server/components/contacts/sql-utils.js b/server/components/contacts/sql-utils.js index eb4fc7b..2f122ad 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 _0x1fc3=['order','DESC','subqry.','findAll','color','keyBy','Sequelize','QueryTypes','CmContact','sequelize','query','toString','Tags','clone','COUNT(*)','isEmpty','where','t.id\x20IN\x20?','SELECT','lodash','squel','../parsers/advancedSearch','../parsers/qs','../interaction/utils','../../mysqldb','role','agent','autocomplete','true','from','cm_contacts','c.deletedAt\x20IS\x20NULL','cm_user_has_contacts','uc.CmContactId\x20=\x20','.id','left_join','ct.CmContactId\x20=\x20','tools_tags','subqry','fax','email','CompanyId','updatedAt','deletedAt','TagIds','push','forEach','field','GROUP_CONCAT(DISTINCT\x20t.id)','expr','getSelectedTags','CONCAT(\x27,\x27,\x20subqry.TagIds,\x20\x27,\x27)\x20LIKE\x20?','replace','split','length','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','isNumeric','c.id\x20LIKE\x20?','c.phone\x20LIKE\x20?','c.mobile\x20LIKE\x20?','c.fax\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','c.firstName\x20LIKE\x20?','c.lastName\x20LIKE\x20?','sqlOperator','conditions','find','name','fieldType','datetime','castTo','DATE','default','value','start','map','tags','clause','and','ids','User','uc.UserId\x20=\x20?','user','keys','some','compact','Contact','ListId','c.ListId\x20IN\x20?','concat','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','resolve','then','fields','tag','filter','search','attributes','group','c.id','limit','offset','subqry.id','having'];(function(_0x112cfd,_0x546fcf){var _0xe1b824=function(_0xb15f0e){while(--_0xb15f0e){_0x112cfd['push'](_0x112cfd['shift']());}};_0xe1b824(++_0x546fcf);}(_0x1fc3,0xe7));var _0x31fc=function(_0x1c20f6,_0x257bc5){_0x1c20f6=_0x1c20f6-0x0;var _0x5e6a21=_0x1fc3[_0x1c20f6];return _0x5e6a21;};'use strict';var _=require(_0x31fc('0x0'));var squel=require(_0x31fc('0x1'));var as=require(_0x31fc('0x2'));var qs=require(_0x31fc('0x3'));var utils=require(_0x31fc('0x4'));var db=require(_0x31fc('0x5'))['db'];function skipContactsQuery(_0x29ca00,_0x294f9f){var _0x2bc6cf=![];if(_0x29ca00[_0x31fc('0x6')]===_0x31fc('0x7')&&!_0x294f9f['search']&&!_0x294f9f['ListId']&&_0x294f9f[_0x31fc('0x8')]!==_0x31fc('0x9')){_0x2bc6cf=!![];}return _0x2bc6cf;}function getContactsSubquery(){return squel['select']()[_0x31fc('0xa')](_0x31fc('0xb'),'c')['where'](_0x31fc('0xc'));}function applyJoinClauses(_0x217352,_0x36c9c9){var _0x56e909=_0x36c9c9?'c':'subqry';_0x217352['left_join'](_0x31fc('0xd'),'uc',_0x31fc('0xe')+_0x56e909+_0x31fc('0xf'))[_0x31fc('0x10')]('cm_contact_has_tags','ct',_0x31fc('0x11')+_0x56e909+'.id')[_0x31fc('0x10')](_0x31fc('0x12'),'t','t.id\x20=\x20ct.TagId');return _0x217352;}function addFieldsToQuery(_0x36503c,_0x4738d7,_0x57dce3,_0x395320,_0x322afb){var _0x376b83=_0x322afb?'c':_0x31fc('0x13');if(!_0x4738d7){_0x4738d7=['id','firstName','lastName','phone','mobile',_0x31fc('0x14'),_0x31fc('0x15'),'ListId',_0x31fc('0x16'),'createdAt',_0x31fc('0x17'),_0x31fc('0x18'),_0x31fc('0x19')];}else if(!_0x4738d7['includes']('id')){_0x4738d7[_0x31fc('0x1a')]('id');}var _0x3ee906=_0x57dce3&&_0x322afb||!_0x57dce3&&!_0x322afb;if(_0x395320){_0x3ee906=_0x395320&&_0x322afb||!_0x395320&&!_0x322afb;}_0x4738d7[_0x31fc('0x1b')](function(_0x3b9573){if(_0x3b9573===_0x31fc('0x19')){if(_0x3ee906){_0x36503c[_0x31fc('0x1c')](_0x31fc('0x1d'),_0x3b9573);}else if(_0x57dce3||_0x395320){_0x36503c['field'](_0x376b83+'.'+_0x3b9573);}}else{_0x36503c[_0x31fc('0x1c')](_0x376b83+'.'+_0x3b9573);}});return _0x36503c;}function getSqlClauses(){var _0x4857a0={'default':squel[_0x31fc('0x1e')](),'fields':squel[_0x31fc('0x1e')](),'filter':squel[_0x31fc('0x1e')](),'tags':{'clause':squel[_0x31fc('0x1e')](),'ids':null},'user':{'clause':squel['expr'](),'skip':![]}};return _0x4857a0;}function parseTagParameter(_0x5cb01d){var _0xc296d=squel[_0x31fc('0x1e')]();if(_0x5cb01d){var _0x8efbf5=utils[_0x31fc('0x1f')](_0x5cb01d);_0x8efbf5[_0x31fc('0x1b')](function(_0x5b0bfe){_0xc296d['or'](_0x31fc('0x20'),'%,'+_0x5b0bfe+',%');});}return _0xc296d;}function parseSearchFilter(_0x37238f){var _0x134b95=squel[_0x31fc('0x1e')]();if(_0x37238f){var _0x178134=_0x37238f[_0x31fc('0x21')]('\x5c','\x5c\x5c')[_0x31fc('0x21')](/'/g,'\x27\x27');if(_0x178134[_0x31fc('0x22')]('\x20')[_0x31fc('0x23')]>0x1){_0x134b95['or'](_0x31fc('0x24'),qs[_0x31fc('0x25')](_0x178134,!![]),null);}else{if(qs[_0x31fc('0x26')](_0x178134)){_0x134b95['or'](_0x31fc('0x27'),_0x178134+'%');_0x134b95['or'](_0x31fc('0x28'),_0x178134+'%');_0x134b95['or'](_0x31fc('0x29'),_0x178134+'%');_0x134b95['or'](_0x31fc('0x2a'),_0x178134+'%');}else if(qs[_0x31fc('0x2b')](_0x178134)){_0x134b95['or'](_0x31fc('0x2c'),_0x178134+'%');}else{_0x134b95['or'](_0x31fc('0x2d'),'%'+_0x178134+'%');_0x134b95['or'](_0x31fc('0x2e'),'%'+_0x178134+'%');_0x134b95['or'](_0x31fc('0x2c'),'%'+_0x178134+'%');}}}return _0x134b95;}function parseAdvancedSearchFilter(_0x1953cc,_0x55232e){var _0x547cae=getSqlClauses();var _0x4f7924=as['parseSearch'](_0x1953cc);var _0x111893=_0x4f7924[_0x31fc('0x2f')];for(var _0x4d9cc0=0x0;_0x4d9cc0<_0x4f7924[_0x31fc('0x30')][_0x31fc('0x23')];_0x4d9cc0++){var _0xbcb292=_0x4f7924[_0x31fc('0x30')][_0x4d9cc0];var _0x15c307='c';var _0x574a31=_[_0x31fc('0x31')](_0x55232e,[_0x31fc('0x32'),_0xbcb292[_0x31fc('0x1c')]]);if(_0x574a31){if(_0xbcb292[_0x31fc('0x1c')]==='dateOfBirth'||_0x574a31[_0x31fc('0x33')]===_0x31fc('0x34')){_0xbcb292[_0x31fc('0x35')]=_0x31fc('0x36');}var _0x307cb0=as['buildExpression'](_0x15c307,_0x574a31['type'],_0xbcb292);_0x547cae[_0x31fc('0x37')][_0x111893](_0x307cb0['text'],_0x307cb0[_0x31fc('0x38')][_0x31fc('0x39')],_0x307cb0['value']['end']);}else{if(_0xbcb292[_0x31fc('0x1c')]==='Tag'){var _0x4b5856=_0xbcb292[_0x31fc('0x38')][_0x31fc('0x22')](',')[_0x31fc('0x3a')](function(_0x31eaff){return Number(_0x31eaff);});var _0x211381=parseTagParameter(_0x4b5856);_0x547cae[_0x31fc('0x3b')][_0x31fc('0x3c')][_0x31fc('0x3d')](_0x211381);_0x547cae[_0x31fc('0x3b')][_0x31fc('0x3e')]=_0x4b5856;}else if(_0xbcb292[_0x31fc('0x1c')]===_0x31fc('0x3f')){_0x547cae['user'][_0x31fc('0x3c')]['and'](_0x31fc('0x40'),_0xbcb292[_0x31fc('0x38')]);_0x547cae[_0x31fc('0x41')]['skip']=!![];}}}return _0x547cae;}function parseModelFields(_0x158af5,_0x109bdd){var _0x40fa1e=squel[_0x31fc('0x1e')]();var _0x2537bf=_(_0x158af5)[_0x31fc('0x42')]()[_0x31fc('0x3a')](function(_0x2c1eda){return _[_0x31fc('0x43')](_0x109bdd,[_0x31fc('0x32'),_0x2c1eda])?_0x2c1eda:undefined;})[_0x31fc('0x44')]()[_0x31fc('0x38')]();if(_0x158af5[_0x31fc('0x45')]){_0x2537bf[_0x31fc('0x1a')]('Contact');}if(_0x158af5[_0x31fc('0x3f')]){_0x2537bf[_0x31fc('0x1a')](_0x31fc('0x3f'));}if(_0x2537bf[_0x31fc('0x23')]>0x0){_0x2537bf[_0x31fc('0x1b')](function(_0x5bc99a){if(_0x5bc99a===_0x31fc('0x46')){_0x40fa1e['and'](_0x31fc('0x47'),[][_0x31fc('0x48')](_0x158af5[_0x5bc99a]));}else if(_0x5bc99a==='Contact'){var _0x3484e5='%'+_0x158af5[_0x5bc99a]+'%';_0x40fa1e[_0x31fc('0x3d')](_0x31fc('0x49'),_0x3484e5);}else if(_0x5bc99a==='User'){_0x40fa1e[_0x31fc('0x3d')](_0x31fc('0x40'),_0x158af5[_0x5bc99a]);}else{_0x40fa1e[_0x31fc('0x3d')]('c.'+_0x5bc99a+'\x20=\x20?',_0x158af5[_0x5bc99a]);}});}return _0x40fa1e;}function parseQueryParameters(_0x157210,_0x2f489d){var _0x3a464f=getSqlClauses();return Promise[_0x31fc('0x4a')]()[_0x31fc('0x4b')](function(){return parseModelFields(_0x157210,_0x2f489d);})[_0x31fc('0x4b')](function(_0xae9ff4){_0x3a464f[_0x31fc('0x4c')]['and'](_0xae9ff4);return parseTagParameter(_0x157210[_0x31fc('0x4d')]);})[_0x31fc('0x4b')](function(_0x4148ac){_0x3a464f[_0x31fc('0x3b')][_0x31fc('0x3c')][_0x31fc('0x3d')](_0x4148ac);return parseSearchFilter(_0x157210[_0x31fc('0x4e')]);})[_0x31fc('0x4b')](function(_0x2957f8){_0x3a464f[_0x31fc('0x4e')]=_0x2957f8;return _0x3a464f;});}function checkListsRestrictions(_0x2e0d7f,_0x188a79,_0x25e66e){var _0x48c2c6=squel['expr']();return Promise['resolve']()[_0x31fc('0x4b')](function(){if(_0x188a79[_0x31fc('0x4f')]&&_0x2e0d7f[_0x31fc('0x6')]===_0x31fc('0x7')&&!_0x25e66e){return _0x2e0d7f['getLists']({'attributes':['id'],'raw':!![]});}})[_0x31fc('0x4b')](function(_0x12507e){if(_0x12507e){if(_0x12507e[_0x31fc('0x23')]===0x0){_0x48c2c6[_0x31fc('0x3d')]('c.ListId\x20IS\x20NULL');}else{_0x48c2c6[_0x31fc('0x3d')](_0x31fc('0x47'),_[_0x31fc('0x3a')](_0x12507e,'id'));}}})[_0x31fc('0x4b')](function(){return _0x48c2c6;});}function buildContactsQuery(_0x3a94e8,_0x315b1c,_0x373a7,_0x58b66c,_0x749bb8,_0x1d1631){if(_0x315b1c){_0x315b1c=_0x373a7[_0x31fc('0x50')];}_0x3a94e8=addFieldsToQuery(_0x3a94e8,_0x315b1c,_0x58b66c,_0x1d1631,!![]);var _0x1c2180=squel['select']();_0x1c2180=addFieldsToQuery(_0x1c2180,_0x315b1c,_0x58b66c,_0x1d1631,![]);if(_0x58b66c||_0x1d1631){_0x3a94e8=applyJoinClauses(_0x3a94e8,!![]);_0x3a94e8[_0x31fc('0x51')](_0x31fc('0x52'));if(_0x373a7[_0x31fc('0x53')]){_0x1c2180[_0x31fc('0x53')](_0x373a7[_0x31fc('0x53')]);}if(_0x373a7[_0x31fc('0x54')]){_0x1c2180[_0x31fc('0x54')](_0x373a7['offset']);}}else{_0x1c2180=applyJoinClauses(_0x1c2180,![]);_0x1c2180[_0x31fc('0x51')](_0x31fc('0x55'));if(_0x373a7[_0x31fc('0x53')]){_0x3a94e8[_0x31fc('0x53')](_0x373a7[_0x31fc('0x53')]);}if(_0x373a7[_0x31fc('0x54')]){_0x3a94e8[_0x31fc('0x54')](_0x373a7['offset']);}}_0x1c2180[_0x31fc('0x56')](_0x749bb8);if(_0x373a7['order']){_0x373a7[_0x31fc('0x57')][_0x31fc('0x1b')](function(_0xc2ea4c){_0x3a94e8['order']('c.'+_0xc2ea4c[0x0],_0xc2ea4c[0x1]===_0x31fc('0x58')?![]:!![]);_0x1c2180[_0x31fc('0x57')](_0x31fc('0x59')+_0xc2ea4c[0x0],_0xc2ea4c[0x1]==='DESC'?![]:!![]);});}_0x1c2180[_0x31fc('0xa')](_0x3a94e8,_0x31fc('0x13'));return _0x1c2180;}function getFilteredContacts(_0x50bced){var _0x2daba9=[];return db['Tag'][_0x31fc('0x5a')]({'attributes':['id',_0x31fc('0x32'),_0x31fc('0x5b')],'raw':!![]})[_0x31fc('0x4b')](function(_0x410bd2){_0x2daba9=_[_0x31fc('0x5c')](_0x410bd2,'id');var _0x28f759={'type':db[_0x31fc('0x5d')][_0x31fc('0x5e')]['SELECT'],'model':db[_0x31fc('0x5f')],'mapToModel':!![],'nest':!![],'raw':!![]};return db[_0x31fc('0x60')][_0x31fc('0x61')](_0x50bced[_0x31fc('0x62')](),_0x28f759);})[_0x31fc('0x4b')](function(_0x1908a0){_0x1908a0['forEach'](function(_0x5b907c){if(_0x5b907c[_0x31fc('0x19')]){_0x5b907c[_0x31fc('0x63')]=[];_0x5b907c[_0x31fc('0x19')][_0x31fc('0x22')](',')['forEach'](function(_0x5c45f2){_0x5b907c[_0x31fc('0x63')][_0x31fc('0x1a')](_0x2daba9[_0x5c45f2]);});}delete _0x5b907c[_0x31fc('0x19')];});return _0x1908a0;});}function countFilteredContacts(_0x5c2b7f,_0x28595b){var _0x5b81ae=_0x5c2b7f[_0x31fc('0x64')]();_0x5b81ae[_0x31fc('0x1c')](_0x31fc('0x65'));_0x5b81ae=applyJoinClauses(_0x5b81ae,!![]);_0x5c2b7f[_0x31fc('0x51')](_0x31fc('0x52'));var _0x1c65ef=utils['getSelectedTags'](_0x28595b);if(!_[_0x31fc('0x66')](_0x1c65ef)){_0x5b81ae[_0x31fc('0x67')](_0x31fc('0x68'),_0x1c65ef);}var _0x34318e={'type':db[_0x31fc('0x5d')][_0x31fc('0x5e')][_0x31fc('0x69')],'raw':!![]};return db[_0x31fc('0x60')][_0x31fc('0x61')](_0x5b81ae[_0x31fc('0x62')](),_0x34318e)[_0x31fc('0x4b')](function(_0x412502){return _0x412502[0x0]['COUNT(*)'];});}module['exports']={'buildContactsQuery':buildContactsQuery,'checkListsRestrictions':checkListsRestrictions,'countFilteredContacts':countFilteredContacts,'getContactsSubquery':getContactsSubquery,'getFilteredContacts':getFilteredContacts,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipContactsQuery':skipContactsQuery}; \ No newline at end of file +var _0x9972=['start','map','tags','clause','and','user','uc.UserId\x20=\x20?','keys','some','Contact','User','c.ListId\x20IN\x20?','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','\x20=\x20?','resolve','then','fields','filter','getLists','c.ListId\x20IS\x20NULL','attributes','group','c.id','limit','offset','having','order','DESC','Tag','findAll','color','keyBy','Sequelize','SELECT','sequelize','clone','COUNT(*)','isEmpty','t.id\x20IN\x20?','query','toString','exports','lodash','squel','../parsers/advancedSearch','../interaction/utils','role','agent','search','ListId','autocomplete','true','select','from','cm_contacts','where','c.deletedAt\x20IS\x20NULL','subqry','left_join','cm_user_has_contacts','uc.CmContactId\x20=\x20','.id','cm_contact_has_tags','ct.CmContactId\x20=\x20','tools_tags','t.id\x20=\x20ct.TagId','firstName','phone','mobile','fax','email','CompanyId','createdAt','updatedAt','deletedAt','TagIds','includes','push','forEach','field','GROUP_CONCAT(DISTINCT\x20t.id)','expr','getSelectedTags','replace','split','length','getFullTextValue','c.id\x20LIKE\x20?','c.phone\x20LIKE\x20?','c.mobile\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','c.firstName\x20LIKE\x20?','c.lastName\x20LIKE\x20?','parseSearch','sqlOperator','conditions','find','name','dateOfBirth','castTo','buildExpression','default','text','value'];(function(_0x32b993,_0x1c5989){var _0x482780=function(_0x404179){while(--_0x404179){_0x32b993['push'](_0x32b993['shift']());}};_0x482780(++_0x1c5989);}(_0x9972,0xfc));var _0x2997=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x9972[_0x40a045];return _0x1a687c;};'use strict';var _=require(_0x2997('0x0'));var squel=require(_0x2997('0x1'));var as=require(_0x2997('0x2'));var qs=require('../parsers/qs');var utils=require(_0x2997('0x3'));var db=require('../../mysqldb')['db'];function skipContactsQuery(_0x4be996,_0x293400){var _0x29c9fa=![];if(_0x4be996[_0x2997('0x4')]===_0x2997('0x5')&&!_0x293400[_0x2997('0x6')]&&!_0x293400[_0x2997('0x7')]&&_0x293400[_0x2997('0x8')]!==_0x2997('0x9')){_0x29c9fa=!![];}return _0x29c9fa;}function getContactsSubquery(){return squel[_0x2997('0xa')]()[_0x2997('0xb')](_0x2997('0xc'),'c')[_0x2997('0xd')](_0x2997('0xe'));}function applyJoinClauses(_0x3a8c2e,_0x59304d){var _0x58b3ed=_0x59304d?'c':_0x2997('0xf');_0x3a8c2e[_0x2997('0x10')](_0x2997('0x11'),'uc',_0x2997('0x12')+_0x58b3ed+_0x2997('0x13'))[_0x2997('0x10')](_0x2997('0x14'),'ct',_0x2997('0x15')+_0x58b3ed+_0x2997('0x13'))[_0x2997('0x10')](_0x2997('0x16'),'t',_0x2997('0x17'));return _0x3a8c2e;}function addFieldsToQuery(_0x301c02,_0x3768a3,_0x222432,_0xb9c10f,_0x314a71){var _0x4bee2f=_0x314a71?'c':_0x2997('0xf');if(!_0x3768a3){_0x3768a3=['id',_0x2997('0x18'),'lastName',_0x2997('0x19'),_0x2997('0x1a'),_0x2997('0x1b'),_0x2997('0x1c'),'ListId',_0x2997('0x1d'),_0x2997('0x1e'),_0x2997('0x1f'),_0x2997('0x20'),_0x2997('0x21')];}else if(!_0x3768a3[_0x2997('0x22')]('id')){_0x3768a3[_0x2997('0x23')]('id');}var _0x56cc1e=_0x222432&&_0x314a71||!_0x222432&&!_0x314a71;if(_0xb9c10f){_0x56cc1e=_0xb9c10f&&_0x314a71||!_0xb9c10f&&!_0x314a71;}_0x3768a3[_0x2997('0x24')](function(_0x3ff808){if(_0x3ff808==='TagIds'){if(_0x56cc1e){_0x301c02[_0x2997('0x25')](_0x2997('0x26'),_0x3ff808);}else if(_0x222432||_0xb9c10f){_0x301c02[_0x2997('0x25')](_0x4bee2f+'.'+_0x3ff808);}}else{_0x301c02[_0x2997('0x25')](_0x4bee2f+'.'+_0x3ff808);}});return _0x301c02;}function getSqlClauses(){var _0x21ee02={'default':squel[_0x2997('0x27')](),'fields':squel[_0x2997('0x27')](),'filter':squel[_0x2997('0x27')](),'tags':{'clause':squel[_0x2997('0x27')](),'ids':null},'user':{'clause':squel[_0x2997('0x27')](),'skip':![]}};return _0x21ee02;}function parseTagParameter(_0xd59bba){var _0x1d8c0e=squel[_0x2997('0x27')]();if(_0xd59bba){var _0x4277d9=utils[_0x2997('0x28')](_0xd59bba);_0x4277d9[_0x2997('0x24')](function(_0xe99c80){_0x1d8c0e['or']('CONCAT(\x27,\x27,\x20subqry.TagIds,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0xe99c80+',%');});}return _0x1d8c0e;}function parseSearchFilter(_0x22adc5){var _0x4fd59e=squel[_0x2997('0x27')]();if(_0x22adc5){var _0x19be10=_0x22adc5[_0x2997('0x29')]('\x5c','\x5c\x5c')[_0x2997('0x29')](/'/g,'\x27\x27');if(_0x19be10[_0x2997('0x2a')]('\x20')[_0x2997('0x2b')]>0x1){_0x4fd59e['or']('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x2997('0x2c')](_0x19be10,!![]),null);}else{if(qs['isNumeric'](_0x19be10)){_0x4fd59e['or'](_0x2997('0x2d'),_0x19be10+'%');_0x4fd59e['or'](_0x2997('0x2e'),_0x19be10+'%');_0x4fd59e['or'](_0x2997('0x2f'),_0x19be10+'%');_0x4fd59e['or']('c.fax\x20LIKE\x20?',_0x19be10+'%');}else if(qs[_0x2997('0x30')](_0x19be10)){_0x4fd59e['or'](_0x2997('0x31'),_0x19be10+'%');}else{_0x4fd59e['or'](_0x2997('0x32'),'%'+_0x19be10+'%');_0x4fd59e['or'](_0x2997('0x33'),'%'+_0x19be10+'%');_0x4fd59e['or']('c.email\x20LIKE\x20?','%'+_0x19be10+'%');}}}return _0x4fd59e;}function parseAdvancedSearchFilter(_0x2f7bab,_0x329ac1){var _0x383346=getSqlClauses();var _0x272373=as[_0x2997('0x34')](_0x2f7bab);var _0x53e7ef=_0x272373[_0x2997('0x35')];for(var _0x14213e=0x0;_0x14213e<_0x272373[_0x2997('0x36')][_0x2997('0x2b')];_0x14213e++){var _0x50bfb6=_0x272373['conditions'][_0x14213e];var _0x50d64d='c';var _0x2c34c2=_[_0x2997('0x37')](_0x329ac1,[_0x2997('0x38'),_0x50bfb6[_0x2997('0x25')]]);if(_0x2c34c2){if(_0x50bfb6[_0x2997('0x25')]===_0x2997('0x39')||_0x2c34c2['fieldType']==='datetime'){_0x50bfb6[_0x2997('0x3a')]='DATE';}var _0x1c21d5=as[_0x2997('0x3b')](_0x50d64d,_0x2c34c2['type'],_0x50bfb6);_0x383346[_0x2997('0x3c')][_0x53e7ef](_0x1c21d5[_0x2997('0x3d')],_0x1c21d5[_0x2997('0x3e')][_0x2997('0x3f')],_0x1c21d5[_0x2997('0x3e')]['end']);}else{if(_0x50bfb6[_0x2997('0x25')]==='Tag'){var _0x86ea24=_0x50bfb6[_0x2997('0x3e')]['split'](',')[_0x2997('0x40')](function(_0xf8e482){return Number(_0xf8e482);});var _0x45ff4e=parseTagParameter(_0x86ea24);_0x383346[_0x2997('0x41')][_0x2997('0x42')][_0x2997('0x43')](_0x45ff4e);_0x383346[_0x2997('0x41')]['ids']=_0x86ea24;}else if(_0x50bfb6[_0x2997('0x25')]==='User'){_0x383346[_0x2997('0x44')][_0x2997('0x42')][_0x2997('0x43')](_0x2997('0x45'),_0x50bfb6['value']);_0x383346[_0x2997('0x44')]['skip']=!![];}}}return _0x383346;}function parseModelFields(_0x25c25a,_0x15abfa){var _0x505814=squel['expr']();var _0x585dda=_(_0x25c25a)[_0x2997('0x46')]()[_0x2997('0x40')](function(_0x57b9b0){return _[_0x2997('0x47')](_0x15abfa,[_0x2997('0x38'),_0x57b9b0])?_0x57b9b0:undefined;})['compact']()[_0x2997('0x3e')]();if(_0x25c25a[_0x2997('0x48')]){_0x585dda[_0x2997('0x23')]('Contact');}if(_0x25c25a['User']){_0x585dda[_0x2997('0x23')](_0x2997('0x49'));}if(_0x585dda[_0x2997('0x2b')]>0x0){_0x585dda['forEach'](function(_0x5b7d50){if(_0x5b7d50===_0x2997('0x7')){_0x505814[_0x2997('0x43')](_0x2997('0x4a'),[]['concat'](_0x25c25a[_0x5b7d50]));}else if(_0x5b7d50==='Contact'){var _0x61bcab='%'+_0x25c25a[_0x5b7d50]+'%';_0x505814[_0x2997('0x43')](_0x2997('0x4b'),_0x61bcab);}else if(_0x5b7d50===_0x2997('0x49')){_0x505814[_0x2997('0x43')](_0x2997('0x45'),_0x25c25a[_0x5b7d50]);}else{_0x505814[_0x2997('0x43')]('c.'+_0x5b7d50+_0x2997('0x4c'),_0x25c25a[_0x5b7d50]);}});}return _0x505814;}function parseQueryParameters(_0x4b1952,_0x275f09){var _0x572211=getSqlClauses();return Promise[_0x2997('0x4d')]()['then'](function(){return parseModelFields(_0x4b1952,_0x275f09);})[_0x2997('0x4e')](function(_0x203e95){_0x572211[_0x2997('0x4f')][_0x2997('0x43')](_0x203e95);return parseTagParameter(_0x4b1952['tag']);})[_0x2997('0x4e')](function(_0x39cd84){_0x572211[_0x2997('0x41')][_0x2997('0x42')][_0x2997('0x43')](_0x39cd84);return parseSearchFilter(_0x4b1952['filter']);})['then'](function(_0x3ba441){_0x572211[_0x2997('0x50')]=_0x3ba441;return _0x572211;});}function checkListsRestrictions(_0x3e58ca,_0x40645f,_0x304b20){var _0xcca2a8=squel[_0x2997('0x27')]();return Promise[_0x2997('0x4d')]()[_0x2997('0x4e')](function(){if(_0x40645f[_0x2997('0x6')]&&_0x3e58ca['role']===_0x2997('0x5')&&!_0x304b20){return _0x3e58ca[_0x2997('0x51')]({'attributes':['id'],'raw':!![]});}})['then'](function(_0x36ff31){if(_0x36ff31){if(_0x36ff31['length']===0x0){_0xcca2a8[_0x2997('0x43')](_0x2997('0x52'));}else{_0xcca2a8[_0x2997('0x43')](_0x2997('0x4a'),_[_0x2997('0x40')](_0x36ff31,'id'));}}})[_0x2997('0x4e')](function(){return _0xcca2a8;});}function buildContactsQuery(_0x815db3,_0x3f0f6d,_0xe335c5,_0x33f507,_0x4cdb37,_0x5ba907){if(_0x3f0f6d){_0x3f0f6d=_0xe335c5[_0x2997('0x53')];}_0x815db3=addFieldsToQuery(_0x815db3,_0x3f0f6d,_0x33f507,_0x5ba907,!![]);var _0x2bba25=squel[_0x2997('0xa')]();_0x2bba25=addFieldsToQuery(_0x2bba25,_0x3f0f6d,_0x33f507,_0x5ba907,![]);if(_0x33f507||_0x5ba907){_0x815db3=applyJoinClauses(_0x815db3,!![]);_0x815db3[_0x2997('0x54')](_0x2997('0x55'));if(_0xe335c5[_0x2997('0x56')]){_0x2bba25[_0x2997('0x56')](_0xe335c5[_0x2997('0x56')]);}if(_0xe335c5[_0x2997('0x57')]){_0x2bba25['offset'](_0xe335c5[_0x2997('0x57')]);}}else{_0x2bba25=applyJoinClauses(_0x2bba25,![]);_0x2bba25[_0x2997('0x54')]('subqry.id');if(_0xe335c5[_0x2997('0x56')]){_0x815db3['limit'](_0xe335c5['limit']);}if(_0xe335c5['offset']){_0x815db3[_0x2997('0x57')](_0xe335c5[_0x2997('0x57')]);}}_0x2bba25[_0x2997('0x58')](_0x4cdb37);if(_0xe335c5['order']){_0xe335c5[_0x2997('0x59')][_0x2997('0x24')](function(_0x2aa78c){_0x815db3[_0x2997('0x59')]('c.'+_0x2aa78c[0x0],_0x2aa78c[0x1]==='DESC'?![]:!![]);_0x2bba25[_0x2997('0x59')]('subqry.'+_0x2aa78c[0x0],_0x2aa78c[0x1]===_0x2997('0x5a')?![]:!![]);});}_0x2bba25[_0x2997('0xb')](_0x815db3,_0x2997('0xf'));return _0x2bba25;}function getFilteredContacts(_0x3936fc){var _0x37a798=[];return db[_0x2997('0x5b')][_0x2997('0x5c')]({'attributes':['id',_0x2997('0x38'),_0x2997('0x5d')],'raw':!![]})[_0x2997('0x4e')](function(_0x2090ef){_0x37a798=_[_0x2997('0x5e')](_0x2090ef,'id');var _0x3a3405={'type':db[_0x2997('0x5f')]['QueryTypes'][_0x2997('0x60')],'model':db['CmContact'],'mapToModel':!![],'nest':!![],'raw':!![]};return db[_0x2997('0x61')]['query'](_0x3936fc['toString'](),_0x3a3405);})['then'](function(_0x419268){_0x419268[_0x2997('0x24')](function(_0x1efba3){if(_0x1efba3[_0x2997('0x21')]){_0x1efba3['Tags']=[];_0x1efba3[_0x2997('0x21')][_0x2997('0x2a')](',')['forEach'](function(_0x23fb65){_0x1efba3['Tags'][_0x2997('0x23')](_0x37a798[_0x23fb65]);});}delete _0x1efba3[_0x2997('0x21')];});return _0x419268;});}function countFilteredContacts(_0x48afd9,_0x41076a){var _0x3a6d4b=_0x48afd9[_0x2997('0x62')]();_0x3a6d4b[_0x2997('0x25')](_0x2997('0x63'));_0x3a6d4b=applyJoinClauses(_0x3a6d4b,!![]);_0x48afd9[_0x2997('0x54')](_0x2997('0x55'));var _0x3b0af7=utils[_0x2997('0x28')](_0x41076a);if(!_[_0x2997('0x64')](_0x3b0af7)){_0x3a6d4b[_0x2997('0xd')](_0x2997('0x65'),_0x3b0af7);}var _0x5539a3={'type':db[_0x2997('0x5f')]['QueryTypes'][_0x2997('0x60')],'raw':!![]};return db[_0x2997('0x61')][_0x2997('0x66')](_0x3a6d4b[_0x2997('0x67')](),_0x5539a3)[_0x2997('0x4e')](function(_0x4a9ce4){return _0x4a9ce4[0x0][_0x2997('0x63')];});}module[_0x2997('0x68')]={'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 c21c79b..29af737 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 _0xcf0c=['write','end','close','unlink','decryptFile','createWriteStream','createDecipher','data','secret','base64','final','decryptString','utf8','bluebird','lodash','../../config/logger','secrets','session','aes-256-ctr','aes192','encrypt','algorithm','error','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','getCiphers','filter','hasOwnProperty','encryptFile','createReadStream','createCipher','update','binary'];(function(_0x594483,_0x55b15b){var _0x1b0efc=function(_0x329c6f){while(--_0x329c6f){_0x594483['push'](_0x594483['shift']());}};_0x1b0efc(++_0x55b15b);}(_0xcf0c,0x18d));var _0xccf0=function(_0x31ced5,_0x5d5415){_0x31ced5=_0x31ced5-0x0;var _0x10d9e5=_0xcf0c[_0x31ced5];return _0x10d9e5;};'use strict';var crypto=require('crypto');var fs=require('fs');var BPromise=require(_0xccf0('0x0'));var _=require(_0xccf0('0x1'));var config=require('../../config/environment');var logger=require(_0xccf0('0x2'))('app');const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0xccf0('0x3')][_0xccf0('0x4')],'algorithm':_0xccf0('0x5')};const fileOptions={'algorithm':_0xccf0('0x6')};if(config['encrypt']&&config[_0xccf0('0x7')]['algorithm']){var isSupported=isAlgorithmSupported(config[_0xccf0('0x7')][_0xccf0('0x8')]);if(isSupported){fileOptions['algorithm']=config[_0xccf0('0x7')][_0xccf0('0x8')];}else{var supportedAlgorithms=getSupportedCiphers()['join'](',\x20');logger[_0xccf0('0x9')](config[_0xccf0('0x7')][_0xccf0('0x8')],_0xccf0('0xa'),supportedAlgorithms);}}function isASupportedCipher(_0x40d61f){return AES_SUPPORTED_RX['test'](_0x40d61f);}function getSupportedCiphers(){return crypto[_0xccf0('0xb')]()[_0xccf0('0xc')](isASupportedCipher);}function isAlgorithmSupported(_0x231d86){return getSupportedCiphers()['indexOf'](_0x231d86)>-0x1;}function combineOptions(_0x319078){var _0x13c771={};for(var _0xb87d4c in fileOptions){if(fileOptions[_0xccf0('0xd')](_0xb87d4c)){_0x13c771[_0xb87d4c]=fileOptions[_0xb87d4c];}}if(_0x319078){for(var _0x29771d in _0x319078){if(_0x319078[_0xccf0('0xd')](_0x29771d)){_0x13c771[_0x29771d]=_0x319078[_0x29771d];}}}return _0x13c771;}exports[_0xccf0('0xe')]=function(_0xa5baa6,_0x4464fe,_0x5fba07,_0x393a0c){return new BPromise(function(_0x30cf44,_0x503a95){_0x393a0c=combineOptions(_0x393a0c);var _0x7316c3=new Buffer(_0x5fba07);var _0x5d186d=fs[_0xccf0('0xf')](_0xa5baa6);var _0x51849a=fs['createWriteStream'](_0x4464fe);var _0x248885=crypto[_0xccf0('0x10')](_0x393a0c['algorithm'],_0x7316c3);_0x5d186d['on']('data',function(_0x4fd39b){var _0xc008e2=new Buffer(_0x248885[_0xccf0('0x11')](_0x4fd39b),_0xccf0('0x12'));_0x51849a[_0xccf0('0x13')](_0xc008e2);});_0x5d186d['on'](_0xccf0('0x14'),function(){try{var _0x5709e2=new Buffer(_0x248885['final'](_0xccf0('0x12')),_0xccf0('0x12'));_0x51849a[_0xccf0('0x13')](_0x5709e2);_0x51849a[_0xccf0('0x14')]();_0x51849a['on'](_0xccf0('0x15'),function(){return _0x30cf44(_0x4464fe);});}catch(_0x259332){fs[_0xccf0('0x16')](_0x4464fe);return _0x503a95(_0x259332);}});});};exports[_0xccf0('0x17')]=function(_0x483426,_0x21ceea,_0x462514,_0x3ed08a){return new BPromise(function(_0x4c042a,_0x3a6d76){_0x3ed08a=combineOptions(_0x3ed08a);var _0x34b3f1=new Buffer(_0x462514);var _0x4a66be=fs[_0xccf0('0xf')](_0x483426);var _0x5e876e=fs[_0xccf0('0x18')](_0x21ceea);var _0x357d40=crypto[_0xccf0('0x19')](_0x3ed08a[_0xccf0('0x8')],_0x34b3f1);_0x4a66be['on'](_0xccf0('0x1a'),function(_0x21a6ff){var _0x4b70cd=new Buffer(_0x357d40['update'](_0x21a6ff),_0xccf0('0x12'));_0x5e876e[_0xccf0('0x13')](_0x4b70cd);});_0x4a66be['on']('end',function(){try{var _0xd758bc=new Buffer(_0x357d40['final']('binary'),_0xccf0('0x12'));_0x5e876e[_0xccf0('0x13')](_0xd758bc);_0x5e876e[_0xccf0('0x14')]();_0x5e876e['on'](_0xccf0('0x15'),function(){return _0x4c042a(_0x21ceea);});}catch(_0x232213){fs['unlink'](_0x21ceea);return _0x3a6d76(_0x232213);}});});};exports['encryptString']=function(_0x138731,_0x191a3b,_0x397545){var _0xaa8a3b=_0x397545||stringOptions[_0xccf0('0x8')];var _0x45420d=_0x191a3b||stringOptions[_0xccf0('0x1b')];var _0x46e45f=crypto[_0xccf0('0x10')](_0xaa8a3b,_0x45420d);var _0x1df34a=_0x46e45f['update'](_0x138731,'utf8',_0xccf0('0x1c'));_0x1df34a+=_0x46e45f[_0xccf0('0x1d')]('base64');return _0x1df34a;};exports[_0xccf0('0x1e')]=function(_0x4da1c0,_0x3df233,_0x14773c){var _0x331aed=_0x14773c||stringOptions[_0xccf0('0x8')];var _0x5c8835=_0x3df233||stringOptions['secret'];var _0x3634d3=crypto['createDecipher'](_0x331aed,_0x5c8835);var _0xf9f1df=_0x3634d3[_0xccf0('0x11')](_0x4da1c0,_0xccf0('0x1c'),_0xccf0('0x1f'));_0xf9f1df+=_0x3634d3['final'](_0xccf0('0x1f'));return _0xf9f1df;}; \ No newline at end of file +var _0xe96e=['final','close','unlink','decryptFile','createWriteStream','createDecipher','encryptString','secret','base64','decryptString','utf8','lodash','../../config/environment','../../config/logger','app','secrets','session','aes-256-ctr','aes192','encrypt','algorithm','join','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','test','getCiphers','filter','indexOf','encryptFile','createReadStream','createCipher','data','update','binary','write','end'];(function(_0xf31767,_0x381746){var _0x24bd0c=function(_0x3b3472){while(--_0x3b3472){_0xf31767['push'](_0xf31767['shift']());}};_0x24bd0c(++_0x381746);}(_0xe96e,0x146));var _0xee96=function(_0x940cb5,_0x5836ab){_0x940cb5=_0x940cb5-0x0;var _0x4d1e99=_0xe96e[_0x940cb5];return _0x4d1e99;};'use strict';var crypto=require('crypto');var fs=require('fs');var BPromise=require('bluebird');var _=require(_0xee96('0x0'));var config=require(_0xee96('0x1'));var logger=require(_0xee96('0x2'))(_0xee96('0x3'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0xee96('0x4')][_0xee96('0x5')],'algorithm':_0xee96('0x6')};const fileOptions={'algorithm':_0xee96('0x7')};if(config[_0xee96('0x8')]&&config['encrypt'][_0xee96('0x9')]){var isSupported=isAlgorithmSupported(config[_0xee96('0x8')]['algorithm']);if(isSupported){fileOptions[_0xee96('0x9')]=config[_0xee96('0x8')]['algorithm'];}else{var supportedAlgorithms=getSupportedCiphers()[_0xee96('0xa')](',\x20');logger['error'](config[_0xee96('0x8')][_0xee96('0x9')],_0xee96('0xb'),supportedAlgorithms);}}function isASupportedCipher(_0x6855ba){return AES_SUPPORTED_RX[_0xee96('0xc')](_0x6855ba);}function getSupportedCiphers(){return crypto[_0xee96('0xd')]()[_0xee96('0xe')](isASupportedCipher);}function isAlgorithmSupported(_0x274fa9){return getSupportedCiphers()[_0xee96('0xf')](_0x274fa9)>-0x1;}function combineOptions(_0x3b49cc){var _0x33e4af={};for(var _0x50e519 in fileOptions){if(fileOptions['hasOwnProperty'](_0x50e519)){_0x33e4af[_0x50e519]=fileOptions[_0x50e519];}}if(_0x3b49cc){for(var _0x5cd08b in _0x3b49cc){if(_0x3b49cc['hasOwnProperty'](_0x5cd08b)){_0x33e4af[_0x5cd08b]=_0x3b49cc[_0x5cd08b];}}}return _0x33e4af;}exports[_0xee96('0x10')]=function(_0x54daff,_0x359a37,_0x280d9f,_0x945b8e){return new BPromise(function(_0x3390ce,_0xde018b){_0x945b8e=combineOptions(_0x945b8e);var _0x376684=new Buffer(_0x280d9f);var _0x539d01=fs[_0xee96('0x11')](_0x54daff);var _0x3e481d=fs['createWriteStream'](_0x359a37);var _0x50ae49=crypto[_0xee96('0x12')](_0x945b8e[_0xee96('0x9')],_0x376684);_0x539d01['on'](_0xee96('0x13'),function(_0x54e7ec){var _0x1aae11=new Buffer(_0x50ae49[_0xee96('0x14')](_0x54e7ec),_0xee96('0x15'));_0x3e481d[_0xee96('0x16')](_0x1aae11);});_0x539d01['on'](_0xee96('0x17'),function(){try{var _0x673997=new Buffer(_0x50ae49[_0xee96('0x18')](_0xee96('0x15')),_0xee96('0x15'));_0x3e481d[_0xee96('0x16')](_0x673997);_0x3e481d[_0xee96('0x17')]();_0x3e481d['on'](_0xee96('0x19'),function(){return _0x3390ce(_0x359a37);});}catch(_0x4cf29b){fs[_0xee96('0x1a')](_0x359a37);return _0xde018b(_0x4cf29b);}});});};exports[_0xee96('0x1b')]=function(_0x6918be,_0x4b6953,_0x178bcf,_0x12c1b1){return new BPromise(function(_0x4f8c5b,_0x35cff4){_0x12c1b1=combineOptions(_0x12c1b1);var _0x35057d=new Buffer(_0x178bcf);var _0x5be4dd=fs['createReadStream'](_0x6918be);var _0x1b0496=fs[_0xee96('0x1c')](_0x4b6953);var _0x6146f0=crypto[_0xee96('0x1d')](_0x12c1b1[_0xee96('0x9')],_0x35057d);_0x5be4dd['on'](_0xee96('0x13'),function(_0x5c9e05){var _0x48af47=new Buffer(_0x6146f0['update'](_0x5c9e05),_0xee96('0x15'));_0x1b0496[_0xee96('0x16')](_0x48af47);});_0x5be4dd['on'](_0xee96('0x17'),function(){try{var _0x5ab2c8=new Buffer(_0x6146f0[_0xee96('0x18')]('binary'),_0xee96('0x15'));_0x1b0496[_0xee96('0x16')](_0x5ab2c8);_0x1b0496[_0xee96('0x17')]();_0x1b0496['on']('close',function(){return _0x4f8c5b(_0x4b6953);});}catch(_0x356b50){fs[_0xee96('0x1a')](_0x4b6953);return _0x35cff4(_0x356b50);}});});};exports[_0xee96('0x1e')]=function(_0x26728e,_0x2fa913,_0x147859){var _0x1f9cee=_0x147859||stringOptions[_0xee96('0x9')];var _0x3f9552=_0x2fa913||stringOptions[_0xee96('0x1f')];var _0x2c4224=crypto[_0xee96('0x12')](_0x1f9cee,_0x3f9552);var _0x2775bb=_0x2c4224[_0xee96('0x14')](_0x26728e,'utf8',_0xee96('0x20'));_0x2775bb+=_0x2c4224[_0xee96('0x18')](_0xee96('0x20'));return _0x2775bb;};exports[_0xee96('0x21')]=function(_0x36ebf8,_0x444f06,_0x1bcef9){var _0x32eea2=_0x1bcef9||stringOptions['algorithm'];var _0xa2bfd5=_0x444f06||stringOptions[_0xee96('0x1f')];var _0x4e9e99=crypto[_0xee96('0x1d')](_0x32eea2,_0xa2bfd5);var _0x3863da=_0x4e9e99[_0xee96('0x14')](_0x36ebf8,_0xee96('0x20'),_0xee96('0x22'));_0x3863da+=_0x4e9e99[_0xee96('0x18')](_0xee96('0x22'));return _0x3863da;}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index daad650..c7de07d 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 _0x0c20=['range','isInteger','forEach','sequelize','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','push','basename','.csv','existsSync','join','each','%s%d.%s','csv','%s.%s','writeFileSync','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','catch','Failed','finally','exit','util','path','to-csv','bluebird','zip-dir','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','Setting','splitSizeCsv','then','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','SELECT','num','Empty','split','length'];(function(_0x13d815,_0x5572c2){var _0x4fd8c3=function(_0x598d0b){while(--_0x598d0b){_0x13d815['push'](_0x13d815['shift']());}};_0x4fd8c3(++_0x5572c2);}(_0x0c20,0xad));var _0x00c2=function(_0xe05571,_0x392c0e){_0xe05571=_0xe05571-0x0;var _0x67ca7f=_0x0c20[_0xe05571];return _0x67ca7f;};'use strict';var util=require(_0x00c2('0x0'));var path=require(_0x00c2('0x1'));var _=require('lodash');var csv=require(_0x00c2('0x2'));var fs=require('fs');var BPromise=require(_0x00c2('0x3'));var zipdir=require(_0x00c2('0x4'));var rimraf=require('rimraf');var db=require(_0x00c2('0x5'))['db'];var dbH=require(_0x00c2('0x5'))[_0x00c2('0x6')];var logger=require(_0x00c2('0x7'))(_0x00c2('0x8'));var EXTRACTED_REPORT_ID=Number(process[_0x00c2('0x9')][0x2]);var QUERY=process[_0x00c2('0x9')][0x3];var PATH=process['argv'][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x272ebb,_0x5f50bb){var _0x370db5={'status':_0x272ebb};var _0x108803={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x5f50bb){_0x370db5[_0x00c2('0xa')]=_0x5f50bb;}return db[_0x00c2('0xb')][_0x00c2('0xc')](_0x370db5,_0x108803);}function main(){var _0x3d1f8f=0x1388;var _0x12a5b8;logger[_0x00c2('0xd')](util[_0x00c2('0xe')](_0x00c2('0xf'),EXTRACTED_REPORT_ID,_0x00c2('0x10')));return db[_0x00c2('0x11')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0x00c2('0x12')]})[_0x00c2('0x13')](function(_0xc55927){if(_0xc55927){_0x12a5b8=_0xc55927;_0x3d1f8f=_0x12a5b8[_0x00c2('0x12')]||0x1388;}})['then'](function(){return dbH['sequelize'][_0x00c2('0x14')](util[_0x00c2('0xe')](_0x00c2('0x15'),QUERY),{'type':dbH['sequelize']['QueryTypes'][_0x00c2('0x16')]});})[_0x00c2('0x13')](function(_0x5c50cc){if(!_0x5c50cc[0x0][_0x00c2('0x17')]){return analyticExtractedReport(_0x00c2('0x18'));}var _0x4e15d1=[];var _0x54fd91=0x0;if(_0x12a5b8[_0x00c2('0x19')]){if(_0x5c50cc&&_0x5c50cc[_0x00c2('0x1a')]){var _0x2a0de5=_[_0x00c2('0x1b')](_0x5c50cc[0x0][_0x00c2('0x17')]/_0x3d1f8f);var _0x21ce24=Number[_0x00c2('0x1c')](_0x5c50cc[0x0]['num']/_0x3d1f8f)?_0x5c50cc[0x0]['num']%_0x3d1f8f:0x0;_0x2a0de5[_0x00c2('0x1d')](function(_0x418d4c){if(_0x418d4c>0x0){_0x54fd91+=_0x3d1f8f;}_0x4e15d1['push'](dbH[_0x00c2('0x1e')][_0x00c2('0x14')](util[_0x00c2('0xe')](_0x00c2('0x1f'),QUERY,_0x3d1f8f,_0x54fd91),{'type':dbH[_0x00c2('0x1e')][_0x00c2('0x20')]['SELECT']}));});if(_0x21ce24>0x0){_0x54fd91+=_0x3d1f8f;_0x4e15d1[_0x00c2('0x21')](dbH[_0x00c2('0x1e')]['query'](util[_0x00c2('0xe')](_0x00c2('0x1f'),QUERY,_0x21ce24,_0x54fd91),{'type':dbH[_0x00c2('0x1e')][_0x00c2('0x20')]['SELECT']}));}}}else{_0x4e15d1[_0x00c2('0x21')](dbH[_0x00c2('0x1e')][_0x00c2('0x14')](QUERY,{'type':dbH['sequelize'][_0x00c2('0x20')][_0x00c2('0x16')]}));}var _0x3c9714=path['dirname'](PATH);var _0x12835f=path[_0x00c2('0x22')](PATH,_0x00c2('0x23'));var _0x140641=_0x12a5b8[_0x00c2('0x19')]&&_0x4e15d1[_0x00c2('0x1a')]>0x1;var _0x5637d4=[];if(!fs[_0x00c2('0x24')](path['join'](_0x3c9714,_0x12835f))&&_0x140641){fs['mkdirSync'](path[_0x00c2('0x25')](_0x3c9714,_0x12835f));}return BPromise[_0x00c2('0x26')](_0x4e15d1,function(_0x13d9c3){_0x5637d4[_0x00c2('0x21')](_0x13d9c3);})[_0x00c2('0x13')](function(){for(var _0x47cc4f=0x0;_0x47cc4f<_0x5637d4[_0x00c2('0x1a')];_0x47cc4f+=0x1){var _0x312c02;var _0xc0d738=_0x5637d4[_0x47cc4f];if(_0x140641){_0x312c02=path[_0x00c2('0x25')](_0x3c9714,_0x12835f,util[_0x00c2('0xe')](_0x00c2('0x27'),_0x12835f,_0x47cc4f,_0x00c2('0x28')));}else{_0x312c02=path['join'](_0x3c9714,util['format'](_0x00c2('0x29'),_0x12835f,'csv'));}fs[_0x00c2('0x2a')](_0x312c02,csv(_0xc0d738));}})[_0x00c2('0x13')](function(){if(_0x140641){return new Promise(function(_0x8b0815){zipdir(path[_0x00c2('0x25')](_0x3c9714,_0x12835f),{'saveTo':path[_0x00c2('0x25')](_0x3c9714,util[_0x00c2('0xe')](_0x00c2('0x29'),_0x12835f,'zip'))},function(_0x13bf36,_0x37171d){rimraf(path['join'](_0x3c9714,_0x12835f),function(){});_0x8b0815(_0x00c2('0x2b'));});});}})[_0x00c2('0x13')](function(){logger['info'](util[_0x00c2('0xe')](_0x00c2('0x2c'),EXTRACTED_REPORT_ID,_0x00c2('0x10')));return analyticExtractedReport(_0x00c2('0x2d'),_0x140641?util['format'](_0x00c2('0x29'),_0x12835f,_0x140641?'zip':_0x00c2('0x28')):null);});})[_0x00c2('0x2e')](function(_0x5ae55a){logger[_0x00c2('0xd')](util[_0x00c2('0xe')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x00c2('0x10')),util['inspect'](_0x5ae55a,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x00c2('0x2f'));})[_0x00c2('0x30')](function(){process[_0x00c2('0x31')](EXIT_CODE);});}main(); \ No newline at end of file +var _0xfb8b=['length','range','isInteger','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','SELECT','QueryTypes','dirname','basename','.csv','join','mkdirSync','%s%d.%s','csv','writeFileSync','%s.%s','zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','catch','info','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','exit','util','path','lodash','to-csv','bluebird','zip-dir','rimraf','../../mysqldb','dbH','analytics','argv','AnalyticExtractedReport','update','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','Setting','find','split','splitSizeCsv','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','num','Empty'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xfb8b,0x124));var _0xbfb8=function(_0x45072a,_0x1aaec4){_0x45072a=_0x45072a-0x0;var _0x3e4c64=_0xfb8b[_0x45072a];return _0x3e4c64;};'use strict';var util=require(_0xbfb8('0x0'));var path=require(_0xbfb8('0x1'));var _=require(_0xbfb8('0x2'));var csv=require(_0xbfb8('0x3'));var fs=require('fs');var BPromise=require(_0xbfb8('0x4'));var zipdir=require(_0xbfb8('0x5'));var rimraf=require(_0xbfb8('0x6'));var db=require(_0xbfb8('0x7'))['db'];var dbH=require(_0xbfb8('0x7'))[_0xbfb8('0x8')];var logger=require('../../config/logger')(_0xbfb8('0x9'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0xbfb8('0xa')][0x3];var PATH=process[_0xbfb8('0xa')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x50967d,_0x1051e8){var _0x43b903={'status':_0x50967d};var _0x810037={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x1051e8){_0x43b903['savename']=_0x1051e8;}return db[_0xbfb8('0xb')][_0xbfb8('0xc')](_0x43b903,_0x810037);}function main(){var _0xce232b=0x1388;var _0x13aaa4;logger['info'](util[_0xbfb8('0xd')](_0xbfb8('0xe'),EXTRACTED_REPORT_ID,_0xbfb8('0xf')));return db[_0xbfb8('0x10')][_0xbfb8('0x11')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xbfb8('0x12'),_0xbfb8('0x13')]})[_0xbfb8('0x14')](function(_0x4ce9b9){if(_0x4ce9b9){_0x13aaa4=_0x4ce9b9;_0xce232b=_0x13aaa4['splitSizeCsv']||0x1388;}})['then'](function(){return dbH[_0xbfb8('0x15')][_0xbfb8('0x16')](util[_0xbfb8('0xd')](_0xbfb8('0x17'),QUERY),{'type':dbH[_0xbfb8('0x15')]['QueryTypes']['SELECT']});})[_0xbfb8('0x14')](function(_0x1a354a){if(!_0x1a354a[0x0][_0xbfb8('0x18')]){return analyticExtractedReport(_0xbfb8('0x19'));}var _0xc912a5=[];var _0x4bf17a=0x0;if(_0x13aaa4['split']){if(_0x1a354a&&_0x1a354a[_0xbfb8('0x1a')]){var _0x4e222e=_[_0xbfb8('0x1b')](_0x1a354a[0x0][_0xbfb8('0x18')]/_0xce232b);var _0x3a77fe=Number[_0xbfb8('0x1c')](_0x1a354a[0x0]['num']/_0xce232b)?_0x1a354a[0x0][_0xbfb8('0x18')]%_0xce232b:0x0;_0x4e222e[_0xbfb8('0x1d')](function(_0x4cbbcd){if(_0x4cbbcd>0x0){_0x4bf17a+=_0xce232b;}_0xc912a5[_0xbfb8('0x1e')](dbH[_0xbfb8('0x15')][_0xbfb8('0x16')](util[_0xbfb8('0xd')](_0xbfb8('0x1f'),QUERY,_0xce232b,_0x4bf17a),{'type':dbH[_0xbfb8('0x15')]['QueryTypes'][_0xbfb8('0x20')]}));});if(_0x3a77fe>0x0){_0x4bf17a+=_0xce232b;_0xc912a5['push'](dbH[_0xbfb8('0x15')][_0xbfb8('0x16')](util[_0xbfb8('0xd')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x3a77fe,_0x4bf17a),{'type':dbH[_0xbfb8('0x15')][_0xbfb8('0x21')]['SELECT']}));}}}else{_0xc912a5[_0xbfb8('0x1e')](dbH['sequelize']['query'](QUERY,{'type':dbH['sequelize']['QueryTypes'][_0xbfb8('0x20')]}));}var _0x16f25c=path[_0xbfb8('0x22')](PATH);var _0x1de36e=path[_0xbfb8('0x23')](PATH,_0xbfb8('0x24'));var _0x434aa9=_0x13aaa4[_0xbfb8('0x12')]&&_0xc912a5[_0xbfb8('0x1a')]>0x1;var _0x5e4b16=[];if(!fs['existsSync'](path[_0xbfb8('0x25')](_0x16f25c,_0x1de36e))&&_0x434aa9){fs[_0xbfb8('0x26')](path[_0xbfb8('0x25')](_0x16f25c,_0x1de36e));}return BPromise['each'](_0xc912a5,function(_0x5d1c44){_0x5e4b16[_0xbfb8('0x1e')](_0x5d1c44);})[_0xbfb8('0x14')](function(){for(var _0x2a70ba=0x0;_0x2a70ba<_0x5e4b16[_0xbfb8('0x1a')];_0x2a70ba+=0x1){var _0x2a5ef1;var _0x2d4b1f=_0x5e4b16[_0x2a70ba];if(_0x434aa9){_0x2a5ef1=path['join'](_0x16f25c,_0x1de36e,util['format'](_0xbfb8('0x27'),_0x1de36e,_0x2a70ba,_0xbfb8('0x28')));}else{_0x2a5ef1=path[_0xbfb8('0x25')](_0x16f25c,util[_0xbfb8('0xd')]('%s.%s',_0x1de36e,_0xbfb8('0x28')));}fs[_0xbfb8('0x29')](_0x2a5ef1,csv(_0x2d4b1f));}})['then'](function(){if(_0x434aa9){return new Promise(function(_0x48b387){zipdir(path[_0xbfb8('0x25')](_0x16f25c,_0x1de36e),{'saveTo':path[_0xbfb8('0x25')](_0x16f25c,util[_0xbfb8('0xd')](_0xbfb8('0x2a'),_0x1de36e,_0xbfb8('0x2b')))},function(_0x14567d,_0x304047){rimraf(path[_0xbfb8('0x25')](_0x16f25c,_0x1de36e),function(){});_0x48b387(_0xbfb8('0x2c'));});});}})[_0xbfb8('0x14')](function(){logger['info'](util[_0xbfb8('0xd')](_0xbfb8('0x2d'),EXTRACTED_REPORT_ID,_0xbfb8('0xf')));return analyticExtractedReport('Completed',_0x434aa9?util[_0xbfb8('0xd')](_0xbfb8('0x2a'),_0x1de36e,_0x434aa9?_0xbfb8('0x2b'):_0xbfb8('0x28')):null);});})[_0xbfb8('0x2e')](function(_0x3b5799){logger[_0xbfb8('0x2f')](util[_0xbfb8('0xd')](_0xbfb8('0x30'),EXTRACTED_REPORT_ID,_0xbfb8('0xf')),util[_0xbfb8('0x31')](_0x3b5799,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xbfb8('0x32'));})[_0xbfb8('0x33')](function(){process[_0xbfb8('0x34')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index e5fc7d6..ad6c0ae 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 _0x8279=['.pdf','join','flatten','createPdfKitDocument','%s%d.%s','pdf','all','%s.%s','zip\x20finished','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','PDF','zip','AnalyticExtractedReport','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','inspect','finally','exit','/fonts/arial-regular.ttf','/fonts/arial-bold.ttf','/fonts/arial-bold-italic.ttf','%s\x20#%d','channel','interactionId','center','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','pipe','finish','error','end','createPdfFromHTML','lodash','util','path','moment','html-to-pdfmake','zip-dir','JSDOM','../../mysqldb','dbH','../../config/logger','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','update','map','pick','toString','value','fill','length','auto','body','concat','chunk','keys','forEach','push','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','startDate','format','endDate','header','landscape','footer','Arial','black','right','num','Empty','Setting','find','split','splitSizePdf','then','isInteger','sequelize','query','QueryTypes','SELECT'];(function(_0x265eb3,_0x16940a){var _0x11981e=function(_0x3c8849){while(--_0x3c8849){_0x265eb3['push'](_0x265eb3['shift']());}};_0x11981e(++_0x16940a);}(_0x8279,0x164));var _0x9827=function(_0x2ea2b9,_0x48f001){_0x2ea2b9=_0x2ea2b9-0x0;var _0xa3e4b0=_0x8279[_0x2ea2b9];return _0xa3e4b0;};'use strict';var _=require(_0x9827('0x0'));var fs=require('fs');var util=require(_0x9827('0x1'));var path=require(_0x9827('0x2'));var moment=require(_0x9827('0x3'));var htmlToPdfmake=require(_0x9827('0x4'));var PdfPrinter=require('pdfmake/src/printer');var zipdir=require(_0x9827('0x5'));var rimraf=require('rimraf');var JSDOM=require('jsdom')[_0x9827('0x6')];var window=new JSDOM('')['window'];var BPromise=require('bluebird');var db=require(_0x9827('0x7'))['db'];var dbH=require(_0x9827('0x7'))[_0x9827('0x8')];var logger=require(_0x9827('0x9'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0x9827('0xa')][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0x9827('0xa')][0x4];var NAME=process[_0x9827('0xa')][0x5];var FORMAT=_0x9827('0xb');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x24458e,_0xa862e7){var _0x42ef43={'status':_0x24458e};var _0x375980={'where':{'id':EXTRACTED_REPORT_ID}};if(_0xa862e7){_0x42ef43['savename']=_0xa862e7;}return db['AnalyticExtractedReport'][_0x9827('0xc')](_0x42ef43,_0x375980);}function getHeaders(_0x3f2907){return _[_0x9827('0xd')](_0x3f2907,function(_0xbc4880){return{'text':_0xbc4880,'style':'tableHeader'};});}function getRows(_0x1adc27,_0x513a06){return _[_0x9827('0xd')](_0x513a06,function(_0x18009a){return _(_0x18009a)[_0x9827('0xe')](_0x1adc27)[_0x9827('0xd')](function(_0x16a460){return _0x16a460?_[_0x9827('0xf')](_0x16a460):'';})[_0x9827('0x10')]();});}function createTable(_0x3ab88a,_0x2dccfb){var _0x1dde93={'widths':_[_0x9827('0x11')](Array(_0x3ab88a[_0x9827('0x12')]),0x91),'heights':function(_0x46ceae){return _0x46ceae===0x0?_0x9827('0x13'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x44be18=getHeaders(_0x3ab88a);_0x1dde93[_0x9827('0x14')]['push'](_0x44be18);var _0x47adf9=getRows(_0x3ab88a,_0x2dccfb);_0x1dde93['body']=_0x1dde93[_0x9827('0x14')][_0x9827('0x15')](_0x47adf9);return _0x1dde93;}function createTables(_0x3d6cad){var _0x23d651=[];var _0x5d0fa5=_[_0x9827('0x16')](Object[_0x9827('0x17')](_0x3d6cad[0x0]),0x5);_0x5d0fa5[_0x9827('0x18')](function(_0x5b40b6){_0x23d651[_0x9827('0x19')](createTable(_0x5b40b6,_0x3d6cad));});return _0x23d651;}function getPDFDocDefinition(_0x549200){var _0x279957=util['format'](_0x9827('0x1a'),NAME,EXTRACTED_REPORT[_0x9827('0x1b')],moment(EXTRACTED_REPORT[_0x9827('0x1c')])[_0x9827('0x1d')](FORMAT),moment(EXTRACTED_REPORT[_0x9827('0x1e')])[_0x9827('0x1d')](FORMAT));var _0x17b4c8=[];for(var _0x5863fe=0x0;_0x5863fe<_0x549200[_0x9827('0x12')];_0x5863fe++){var _0x48bcd1=[];if(_0x5863fe===0x0){_0x48bcd1[_0x9827('0x19')]({'text':_0x279957,'style':_0x9827('0x1f')});}var _0x2a87a6={'table':_0x549200[_0x5863fe]};if(_0x5863fe>0x0){_0x2a87a6['pageBreak']='before';_0x2a87a6['margin']=[0x0,0x46,0x0,0x0];}_0x48bcd1[_0x9827('0x19')](_0x2a87a6);_0x17b4c8[_0x9827('0x19')](_0x48bcd1);}return{'pageSize':'A4','pageOrientation':_0x9827('0x20'),'content':_0x17b4c8,'footer':function(_0x3b03ac,_0x2c766a){return{'text':_0x3b03ac['toString']()+'\x20/\x20'+_0x2c766a,'style':_0x9827('0x21')};},'defaultStyle':{'font':_0x9827('0x22')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0x9827('0x23')},'footer':{'alignment':_0x9827('0x24'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x2f9765){var _0x4b8a7b=0x1388;var _0x5da253;if(!_0x2f9765[0x0][_0x9827('0x25')]){return analyticExtractedReport(_0x9827('0x26'));}return db[_0x9827('0x27')][_0x9827('0x28')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x9827('0x29'),_0x9827('0x2a')]})[_0x9827('0x2b')](function(_0x5d5c7d){if(_0x5d5c7d){_0x5da253=_0x5d5c7d;_0x4b8a7b=_0x5da253[_0x9827('0x2a')]||0x3e8;}})['then'](function(){var _0x3f0bfa=[];var _0x2cfef9=0x0;if(_0x5da253[_0x9827('0x29')]){if(_0x2f9765&&_0x2f9765[_0x9827('0x12')]){var _0x3571a4=_['range'](_0x2f9765[0x0][_0x9827('0x25')]/_0x4b8a7b);var _0x4134e7=Number[_0x9827('0x2c')](_0x2f9765[0x0][_0x9827('0x25')]/_0x4b8a7b)?_0x2f9765[0x0]['num']%_0x4b8a7b:0x0;_0x3571a4[_0x9827('0x18')](function(_0x355aea){if(_0x355aea>0x0){_0x2cfef9+=_0x4b8a7b;}_0x3f0bfa[_0x9827('0x19')](dbH[_0x9827('0x2d')][_0x9827('0x2e')](util[_0x9827('0x1d')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x4b8a7b,_0x2cfef9),{'type':dbH[_0x9827('0x2d')][_0x9827('0x2f')][_0x9827('0x30')]}));});if(_0x4134e7>0x0){_0x2cfef9+=_0x4b8a7b;_0x3f0bfa[_0x9827('0x19')](dbH[_0x9827('0x2d')][_0x9827('0x2e')](util[_0x9827('0x1d')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x4134e7,_0x2cfef9),{'type':dbH['sequelize'][_0x9827('0x2f')][_0x9827('0x30')]}));}}}else{_0x3f0bfa['push'](dbH[_0x9827('0x2d')]['query'](QUERY,{'type':dbH['sequelize']['QueryTypes']['SELECT']}));}var _0x327855=path['dirname'](PATH);var _0x6cb1dc=path['basename'](PATH,_0x9827('0x31'));var _0x1081c4=_0x5da253['split']&&_0x3f0bfa[_0x9827('0x12')]>0x1;var _0x14a0eb=[];if(!fs['existsSync'](path['join'](_0x327855,_0x6cb1dc))&&_0x1081c4){fs['mkdirSync'](path[_0x9827('0x32')](_0x327855,_0x6cb1dc));}return BPromise['each'](_0x3f0bfa,function(_0x14280b){_0x14a0eb[_0x9827('0x19')](_0x14280b);})['then'](function(){var _0xddc24a=[];for(var _0x58aa52=0x0;_0x58aa52<_0x14a0eb[_0x9827('0x12')];_0x58aa52+=0x1){var _0x29a003=_0x14a0eb[_0x58aa52];var _0x508673=createTables(_[_0x9827('0x33')](_0x29a003));var _0x3be7c3;var _0x4a2f69=getPDFDocDefinition(_0x508673);var _0x227b8e=getPDFPrinter();var _0x544589=_0x227b8e[_0x9827('0x34')](_0x4a2f69);if(_0x1081c4){_0x3be7c3=path[_0x9827('0x32')](_0x327855,_0x6cb1dc,util[_0x9827('0x1d')](_0x9827('0x35'),_0x6cb1dc,_0x58aa52,_0x9827('0x36')));}else{_0x3be7c3=path[_0x9827('0x32')](_0x327855,util['format']('%s.%s',_0x6cb1dc,'pdf'));}_0xddc24a[_0x9827('0x19')](writePDFDocument(_0x544589,_0x3be7c3));}return Promise[_0x9827('0x37')](_0xddc24a);})[_0x9827('0x2b')](function(){if(_0x1081c4){return new Promise(function(_0x4b2053){zipdir(path[_0x9827('0x32')](_0x327855,_0x6cb1dc),{'saveTo':path[_0x9827('0x32')](_0x327855,util['format'](_0x9827('0x38'),_0x6cb1dc,'zip'))},function(){rimraf(path[_0x9827('0x32')](_0x327855,_0x6cb1dc),function(){});_0x4b2053(_0x9827('0x39'));});});}})['then'](function(){if(!_0x1081c4)return;rimraf(path[_0x9827('0x32')](_0x327855,_0x6cb1dc),function(){});})[_0x9827('0x2b')](function(){logger[_0x9827('0x3a')](util[_0x9827('0x1d')](_0x9827('0x3b'),EXTRACTED_REPORT_ID,_0x9827('0x3c')));return analyticExtractedReport('Completed',_0x1081c4?util[_0x9827('0x1d')]('%s.%s',_0x6cb1dc,_0x1081c4?_0x9827('0x3d'):_0x9827('0x36')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0x9827('0x3a')](util[_0x9827('0x1d')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x9827('0x3c')));return db[_0x9827('0x3e')]['findOne']({'where':{'id':EXTRACTED_REPORT_ID}})[_0x9827('0x2b')](function(_0x470210){EXTRACTED_REPORT=_0x470210;return dbH[_0x9827('0x2d')][_0x9827('0x2e')](util[_0x9827('0x1d')](_0x9827('0x3f'),QUERY),{'type':dbH[_0x9827('0x2d')]['QueryTypes'][_0x9827('0x30')]});})[_0x9827('0x2b')](extractReport)[_0x9827('0x40')](function(_0x585831){logger[_0x9827('0x3a')](util[_0x9827('0x1d')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x9827('0x3c')),util[_0x9827('0x41')](_0x585831,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})[_0x9827('0x42')](function(){process[_0x9827('0x43')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x38bab3=new PdfPrinter({'Arial':{'normal':__dirname+_0x9827('0x44'),'bold':__dirname+_0x9827('0x45'),'italics':__dirname+'/fonts/arial-italic.ttf','bolditalics':__dirname+_0x9827('0x46')}});return _0x38bab3;}function getPDFDocDefinitionFromHTML(_0x316c6a,_0x3c074d){var _0x270b11=util[_0x9827('0x1d')](_0x9827('0x47'),_0x3c074d[_0x9827('0x48')],_0x3c074d[_0x9827('0x49')]);var _0x35a960=moment()['format']('YYYY-MM-DD')['toString']();var _0x3f1a13=htmlToPdfmake(_0x316c6a,{'window':window,'tableAutoSize':!![]});return{'content':[_0x3f1a13],'defaultStyle':{'font':_0x9827('0x22')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0x9827('0x4a'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':'center','margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':'center'}},'header':function(){return[{'text':'Interaction\x20Transcript','style':_0x9827('0x1f')}];},'footer':function(_0x502931,_0x3d3d2c){return[{'text':util[_0x9827('0x1d')](_0x9827('0x4b'),_0x270b11,_0x502931,_0x3d3d2c,_0x35a960),'style':_0x9827('0x21')}];}};}function writePDFDocument(_0x14aacd,_0x268329){return new Promise(function(_0x4c8a25,_0x48e6ff){var _0x2010d0=_0x14aacd[_0x9827('0x4c')](fs['createWriteStream'](_0x268329));_0x2010d0['on'](_0x9827('0x4d'),function(){_0x4c8a25('finish');});_0x2010d0['on'](_0x9827('0x4e'),function(_0x39dab1){_0x48e6ff(_0x39dab1);});_0x14aacd[_0x9827('0x4f')]();});}exports[_0x9827('0x50')]=function(_0x418af1,_0x2ebc84){var _0x5e543d=getPDFPrinter();var _0x3cb699=getPDFDocDefinitionFromHTML(_0x418af1,_0x2ebc84);var _0x108502=_0x5e543d['createPdfKitDocument'](_0x3cb699);return writePDFDocument(_0x108502,_0x2ebc84[_0x9827('0x2')])[_0x9827('0x40')](function(_0x5337ca){throw _0x5337ca;});}; \ No newline at end of file +var _0x9ed4=['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','AnalyticExtractedReport','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','exit','/fonts/arial-italic.ttf','/fonts/arial-bold-italic.ttf','%s\x20#%d','channel','interactionId','center','Interaction\x20Transcript','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','pipe','createWriteStream','finish','createPdfFromHTML','createPdfKitDocument','lodash','path','moment','html-to-pdfmake','pdfmake/src/printer','zip-dir','jsdom','bluebird','../../mysqldb','dbH','../../config/logger','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','update','map','pick','toString','value','fill','body','chunk','keys','forEach','push','format','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','startDate','endDate','header','pageBreak','margin','landscape','\x20/\x20','footer','Arial','black','right','Empty','Setting','find','splitSizePdf','then','split','length','num','isInteger','sequelize','query','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT','dirname','basename','existsSync','each','flatten','%s%d.%s','pdf','all','join','%s.%s','zip','zip\x20finished'];(function(_0x2cea58,_0x153c15){var _0x192933=function(_0x4f1e9b){while(--_0x4f1e9b){_0x2cea58['push'](_0x2cea58['shift']());}};_0x192933(++_0x153c15);}(_0x9ed4,0x18b));var _0x49ed=function(_0x32f68b,_0x2733c6){_0x32f68b=_0x32f68b-0x0;var _0x9c007b=_0x9ed4[_0x32f68b];return _0x9c007b;};'use strict';var _=require(_0x49ed('0x0'));var fs=require('fs');var util=require('util');var path=require(_0x49ed('0x1'));var moment=require(_0x49ed('0x2'));var htmlToPdfmake=require(_0x49ed('0x3'));var PdfPrinter=require(_0x49ed('0x4'));var zipdir=require(_0x49ed('0x5'));var rimraf=require('rimraf');var JSDOM=require(_0x49ed('0x6'))['JSDOM'];var window=new JSDOM('')['window'];var BPromise=require(_0x49ed('0x7'));var db=require(_0x49ed('0x8'))['db'];var dbH=require(_0x49ed('0x8'))[_0x49ed('0x9')];var logger=require(_0x49ed('0xa'))(_0x49ed('0xb'));var EXTRACTED_REPORT_ID=Number(process[_0x49ed('0xc')][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0x49ed('0xc')][0x4];var NAME=process['argv'][0x5];var FORMAT=_0x49ed('0xd');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x2f9e59,_0x42024e){var _0x3f278c={'status':_0x2f9e59};var _0x22672d={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x42024e){_0x3f278c['savename']=_0x42024e;}return db['AnalyticExtractedReport'][_0x49ed('0xe')](_0x3f278c,_0x22672d);}function getHeaders(_0x52c7fc){return _[_0x49ed('0xf')](_0x52c7fc,function(_0x2b3cca){return{'text':_0x2b3cca,'style':'tableHeader'};});}function getRows(_0x4f634,_0x3f9f8d){return _[_0x49ed('0xf')](_0x3f9f8d,function(_0x4ec1f1){return _(_0x4ec1f1)[_0x49ed('0x10')](_0x4f634)['map'](function(_0x5e8d21){return _0x5e8d21?_[_0x49ed('0x11')](_0x5e8d21):'';})[_0x49ed('0x12')]();});}function createTable(_0x433c07,_0x4c455e){var _0xbbd8b9={'widths':_[_0x49ed('0x13')](Array(_0x433c07['length']),0x91),'heights':function(_0x23ca9c){return _0x23ca9c===0x0?'auto':0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x165950=getHeaders(_0x433c07);_0xbbd8b9[_0x49ed('0x14')]['push'](_0x165950);var _0x5a6050=getRows(_0x433c07,_0x4c455e);_0xbbd8b9[_0x49ed('0x14')]=_0xbbd8b9[_0x49ed('0x14')]['concat'](_0x5a6050);return _0xbbd8b9;}function createTables(_0x3917c1){var _0x583e56=[];var _0x155a14=_[_0x49ed('0x15')](Object[_0x49ed('0x16')](_0x3917c1[0x0]),0x5);_0x155a14[_0x49ed('0x17')](function(_0x1d90ae){_0x583e56[_0x49ed('0x18')](createTable(_0x1d90ae,_0x3917c1));});return _0x583e56;}function getPDFDocDefinition(_0x19c6a3){var _0x4f5d51=util[_0x49ed('0x19')](_0x49ed('0x1a'),NAME,EXTRACTED_REPORT[_0x49ed('0x1b')],moment(EXTRACTED_REPORT[_0x49ed('0x1c')])['format'](FORMAT),moment(EXTRACTED_REPORT[_0x49ed('0x1d')])['format'](FORMAT));var _0x261209=[];for(var _0x2ffdba=0x0;_0x2ffdba<_0x19c6a3['length'];_0x2ffdba++){var _0x1fb5c8=[];if(_0x2ffdba===0x0){_0x1fb5c8[_0x49ed('0x18')]({'text':_0x4f5d51,'style':_0x49ed('0x1e')});}var _0x499967={'table':_0x19c6a3[_0x2ffdba]};if(_0x2ffdba>0x0){_0x499967[_0x49ed('0x1f')]='before';_0x499967[_0x49ed('0x20')]=[0x0,0x46,0x0,0x0];}_0x1fb5c8['push'](_0x499967);_0x261209['push'](_0x1fb5c8);}return{'pageSize':'A4','pageOrientation':_0x49ed('0x21'),'content':_0x261209,'footer':function(_0x426828,_0x41ec76){return{'text':_0x426828[_0x49ed('0x11')]()+_0x49ed('0x22')+_0x41ec76,'style':_0x49ed('0x23')};},'defaultStyle':{'font':_0x49ed('0x24')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0x49ed('0x25')},'footer':{'alignment':_0x49ed('0x26'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x284042){var _0x683573=0x1388;var _0x2084c8;if(!_0x284042[0x0]['num']){return analyticExtractedReport(_0x49ed('0x27'));}return db[_0x49ed('0x28')][_0x49ed('0x29')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0x49ed('0x2a')]})['then'](function(_0x307c62){if(_0x307c62){_0x2084c8=_0x307c62;_0x683573=_0x2084c8[_0x49ed('0x2a')]||0x3e8;}})[_0x49ed('0x2b')](function(){var _0x250e23=[];var _0x5ab7a6=0x0;if(_0x2084c8[_0x49ed('0x2c')]){if(_0x284042&&_0x284042[_0x49ed('0x2d')]){var _0xefb0f0=_['range'](_0x284042[0x0][_0x49ed('0x2e')]/_0x683573);var _0x2e3ca3=Number[_0x49ed('0x2f')](_0x284042[0x0]['num']/_0x683573)?_0x284042[0x0][_0x49ed('0x2e')]%_0x683573:0x0;_0xefb0f0[_0x49ed('0x17')](function(_0x4d5192){if(_0x4d5192>0x0){_0x5ab7a6+=_0x683573;}_0x250e23[_0x49ed('0x18')](dbH[_0x49ed('0x30')][_0x49ed('0x31')](util[_0x49ed('0x19')](_0x49ed('0x32'),QUERY,_0x683573,_0x5ab7a6),{'type':dbH[_0x49ed('0x30')][_0x49ed('0x33')][_0x49ed('0x34')]}));});if(_0x2e3ca3>0x0){_0x5ab7a6+=_0x683573;_0x250e23['push'](dbH[_0x49ed('0x30')][_0x49ed('0x31')](util[_0x49ed('0x19')](_0x49ed('0x32'),QUERY,_0x2e3ca3,_0x5ab7a6),{'type':dbH[_0x49ed('0x30')][_0x49ed('0x33')][_0x49ed('0x34')]}));}}}else{_0x250e23['push'](dbH[_0x49ed('0x30')][_0x49ed('0x31')](QUERY,{'type':dbH[_0x49ed('0x30')][_0x49ed('0x33')]['SELECT']}));}var _0x2928c1=path[_0x49ed('0x35')](PATH);var _0x284e99=path[_0x49ed('0x36')](PATH,'.pdf');var _0x3421a3=_0x2084c8[_0x49ed('0x2c')]&&_0x250e23[_0x49ed('0x2d')]>0x1;var _0xfad716=[];if(!fs[_0x49ed('0x37')](path['join'](_0x2928c1,_0x284e99))&&_0x3421a3){fs['mkdirSync'](path['join'](_0x2928c1,_0x284e99));}return BPromise[_0x49ed('0x38')](_0x250e23,function(_0x367dd7){_0xfad716['push'](_0x367dd7);})[_0x49ed('0x2b')](function(){var _0xecf59c=[];for(var _0x44a950=0x0;_0x44a950<_0xfad716[_0x49ed('0x2d')];_0x44a950+=0x1){var _0x2de0f7=_0xfad716[_0x44a950];var _0x986523=createTables(_[_0x49ed('0x39')](_0x2de0f7));var _0x3b5f65;var _0x19a813=getPDFDocDefinition(_0x986523);var _0x17c280=getPDFPrinter();var _0x216fc8=_0x17c280['createPdfKitDocument'](_0x19a813);if(_0x3421a3){_0x3b5f65=path['join'](_0x2928c1,_0x284e99,util['format'](_0x49ed('0x3a'),_0x284e99,_0x44a950,_0x49ed('0x3b')));}else{_0x3b5f65=path['join'](_0x2928c1,util[_0x49ed('0x19')]('%s.%s',_0x284e99,'pdf'));}_0xecf59c['push'](writePDFDocument(_0x216fc8,_0x3b5f65));}return Promise[_0x49ed('0x3c')](_0xecf59c);})['then'](function(){if(_0x3421a3){return new Promise(function(_0x478b4b){zipdir(path[_0x49ed('0x3d')](_0x2928c1,_0x284e99),{'saveTo':path[_0x49ed('0x3d')](_0x2928c1,util['format'](_0x49ed('0x3e'),_0x284e99,_0x49ed('0x3f')))},function(){rimraf(path[_0x49ed('0x3d')](_0x2928c1,_0x284e99),function(){});_0x478b4b(_0x49ed('0x40'));});});}})[_0x49ed('0x2b')](function(){if(!_0x3421a3)return;rimraf(path[_0x49ed('0x3d')](_0x2928c1,_0x284e99),function(){});})[_0x49ed('0x2b')](function(){logger[_0x49ed('0x41')](util[_0x49ed('0x19')](_0x49ed('0x42'),EXTRACTED_REPORT_ID,_0x49ed('0x43')));return analyticExtractedReport(_0x49ed('0x44'),_0x3421a3?util[_0x49ed('0x19')](_0x49ed('0x3e'),_0x284e99,_0x3421a3?'zip':_0x49ed('0x3b')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0x49ed('0x41')](util[_0x49ed('0x19')](_0x49ed('0x45'),EXTRACTED_REPORT_ID,_0x49ed('0x43')));return db[_0x49ed('0x46')][_0x49ed('0x47')]({'where':{'id':EXTRACTED_REPORT_ID}})['then'](function(_0x3e6944){EXTRACTED_REPORT=_0x3e6944;return dbH[_0x49ed('0x30')][_0x49ed('0x31')](util['format'](_0x49ed('0x48'),QUERY),{'type':dbH[_0x49ed('0x30')][_0x49ed('0x33')][_0x49ed('0x34')]});})[_0x49ed('0x2b')](extractReport)[_0x49ed('0x49')](function(_0x74678){logger['info'](util[_0x49ed('0x19')](_0x49ed('0x4a'),EXTRACTED_REPORT_ID,'PDF'),util[_0x49ed('0x4b')](_0x74678,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x49ed('0x4c'));})[_0x49ed('0x4d')](function(){process[_0x49ed('0x4e')](EXIT_CODE);});}main();function getPDFPrinter(){var _0xca232a=new PdfPrinter({'Arial':{'normal':__dirname+'/fonts/arial-regular.ttf','bold':__dirname+'/fonts/arial-bold.ttf','italics':__dirname+_0x49ed('0x4f'),'bolditalics':__dirname+_0x49ed('0x50')}});return _0xca232a;}function getPDFDocDefinitionFromHTML(_0x2fb0c1,_0x9f26c6){var _0x198d27=util['format'](_0x49ed('0x51'),_0x9f26c6[_0x49ed('0x52')],_0x9f26c6[_0x49ed('0x53')]);var _0x1be401=moment()['format']('YYYY-MM-DD')[_0x49ed('0x11')]();var _0x359e70=htmlToPdfmake(_0x2fb0c1,{'window':window,'tableAutoSize':!![]});return{'content':[_0x359e70],'defaultStyle':{'font':'Arial'},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0x49ed('0x54'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0x49ed('0x54'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0x49ed('0x54')}},'header':function(){return[{'text':_0x49ed('0x55'),'style':_0x49ed('0x1e')}];},'footer':function(_0x501728,_0x50b786){return[{'text':util[_0x49ed('0x19')](_0x49ed('0x56'),_0x198d27,_0x501728,_0x50b786,_0x1be401),'style':'footer'}];}};}function writePDFDocument(_0xe65a00,_0x54d338){return new Promise(function(_0x9b4b49,_0x2d1085){var _0x18770d=_0xe65a00[_0x49ed('0x57')](fs[_0x49ed('0x58')](_0x54d338));_0x18770d['on'](_0x49ed('0x59'),function(){_0x9b4b49(_0x49ed('0x59'));});_0x18770d['on']('error',function(_0x49c5f3){_0x2d1085(_0x49c5f3);});_0xe65a00['end']();});}exports[_0x49ed('0x5a')]=function(_0x3339ad,_0x5be565){var _0xb6f736=getPDFPrinter();var _0x1b5859=getPDFDocDefinitionFromHTML(_0x3339ad,_0x5be565);var _0x27b256=_0xb6f736[_0x49ed('0x5b')](_0x1b5859);return writePDFDocument(_0x27b256,_0x5be565[_0x49ed('0x1')])['catch'](function(_0x1456dc){throw _0x1456dc;});}; \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index b4bb23c..d5bc0db 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 _0xb455=['util','path','lodash','json2xls','bluebird','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','Setting','find','split','then','splitSizeXlsx','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','num','Empty','length','range','isInteger','push','%s\x20limit\x20%d\x20OFFSET\x20%d','basename','.xlsx','existsSync','join','each','%s%d.%s','xlsx','%s.%s','writeFileSync','binary','Completed','zip','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','exit'];(function(_0x5c642b,_0x4a3540){var _0xe94dfa=function(_0x22f8c0){while(--_0x22f8c0){_0x5c642b['push'](_0x5c642b['shift']());}};_0xe94dfa(++_0x4a3540);}(_0xb455,0x104));var _0x5b45=function(_0x25de65,_0x4e1c19){_0x25de65=_0x25de65-0x0;var _0x275a22=_0xb455[_0x25de65];return _0x275a22;};'use strict';var util=require(_0x5b45('0x0'));var path=require(_0x5b45('0x1'));var _=require(_0x5b45('0x2'));var fs=require('fs');var json2xls=require(_0x5b45('0x3'));var BPromise=require(_0x5b45('0x4'));var zipdir=require('zip-dir');var rimraf=require('rimraf');var db=require('../../mysqldb')['db'];var dbH=require(_0x5b45('0x5'))[_0x5b45('0x6')];var logger=require(_0x5b45('0x7'))(_0x5b45('0x8'));var EXTRACTED_REPORT_ID=Number(process[_0x5b45('0x9')][0x2]);var QUERY=process[_0x5b45('0x9')][0x3];var PATH=process[_0x5b45('0x9')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x474120,_0x2e3618){var _0xd51a90={'status':_0x474120};var _0x352be2={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x2e3618){_0xd51a90[_0x5b45('0xa')]=_0x2e3618;}return db[_0x5b45('0xb')][_0x5b45('0xc')](_0xd51a90,_0x352be2);}function main(){var _0x6b2597=0x1388;var _0x4bd4f8;logger[_0x5b45('0xd')](util[_0x5b45('0xe')](_0x5b45('0xf'),EXTRACTED_REPORT_ID,_0x5b45('0x10')));return db[_0x5b45('0x11')][_0x5b45('0x12')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x5b45('0x13'),'splitSizeXlsx']})[_0x5b45('0x14')](function(_0x2fd3d9){if(_0x2fd3d9){_0x4bd4f8=_0x2fd3d9;_0x6b2597=_0x4bd4f8[_0x5b45('0x15')]||0x1388;}})[_0x5b45('0x14')](function(){return dbH[_0x5b45('0x16')][_0x5b45('0x17')](util[_0x5b45('0xe')](_0x5b45('0x18'),QUERY),{'type':dbH[_0x5b45('0x16')][_0x5b45('0x19')][_0x5b45('0x1a')]});})[_0x5b45('0x14')](function(_0x15f0a6){if(!_0x15f0a6[0x0][_0x5b45('0x1b')]){return analyticExtractedReport(_0x5b45('0x1c'));}var _0x2a30ef=[];var _0x24329a=0x0;if(_0x4bd4f8[_0x5b45('0x13')]){if(_0x15f0a6&&_0x15f0a6[_0x5b45('0x1d')]){var _0x4da897=_[_0x5b45('0x1e')](_0x15f0a6[0x0][_0x5b45('0x1b')]/_0x6b2597);var _0x3930eb=Number[_0x5b45('0x1f')](_0x15f0a6[0x0][_0x5b45('0x1b')]/_0x6b2597)?_0x15f0a6[0x0][_0x5b45('0x1b')]%_0x6b2597:0x0;_0x4da897['forEach'](function(_0x5e92a1){if(_0x5e92a1>0x0){_0x24329a+=_0x6b2597;}_0x2a30ef[_0x5b45('0x20')](dbH[_0x5b45('0x16')][_0x5b45('0x17')](util[_0x5b45('0xe')](_0x5b45('0x21'),QUERY,_0x6b2597,_0x24329a),{'type':dbH[_0x5b45('0x16')][_0x5b45('0x19')][_0x5b45('0x1a')]}));});if(_0x3930eb>0x0){_0x24329a+=_0x6b2597;_0x2a30ef[_0x5b45('0x20')](dbH[_0x5b45('0x16')]['query'](util[_0x5b45('0xe')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x3930eb,_0x24329a),{'type':dbH[_0x5b45('0x16')][_0x5b45('0x19')][_0x5b45('0x1a')]}));}}}else{_0x2a30ef[_0x5b45('0x20')](dbH[_0x5b45('0x16')][_0x5b45('0x17')](QUERY,{'type':dbH[_0x5b45('0x16')][_0x5b45('0x19')]['SELECT']}));}var _0x52f7b6=path['dirname'](PATH);var _0x53c9a7=path[_0x5b45('0x22')](PATH,_0x5b45('0x23'));var _0x29ce29=_0x4bd4f8[_0x5b45('0x13')]&&_0x2a30ef[_0x5b45('0x1d')]>0x1;var _0x2843fd=[];if(!fs[_0x5b45('0x24')](path[_0x5b45('0x25')](_0x52f7b6,_0x53c9a7))&&_0x29ce29){fs['mkdirSync'](path[_0x5b45('0x25')](_0x52f7b6,_0x53c9a7));}return BPromise[_0x5b45('0x26')](_0x2a30ef,function(_0x524e23){_0x2843fd[_0x5b45('0x20')](_0x524e23);})[_0x5b45('0x14')](function(){for(var _0x39834e=0x0;_0x39834e<_0x2843fd[_0x5b45('0x1d')];_0x39834e+=0x1){var _0x116cd1;var _0x3b29d6=_0x2843fd[_0x39834e];if(_0x29ce29){_0x116cd1=path['join'](_0x52f7b6,_0x53c9a7,util['format'](_0x5b45('0x27'),_0x53c9a7,_0x39834e,_0x5b45('0x28')));}else{_0x116cd1=path['join'](_0x52f7b6,util[_0x5b45('0xe')](_0x5b45('0x29'),_0x53c9a7,_0x5b45('0x28')));}fs[_0x5b45('0x2a')](_0x116cd1,json2xls(_0x3b29d6),_0x5b45('0x2b'));}})['then'](function(){if(_0x29ce29){return new Promise(function(_0x776381){zipdir(path[_0x5b45('0x25')](_0x52f7b6,_0x53c9a7),{'saveTo':path[_0x5b45('0x25')](_0x52f7b6,util['format']('%s.%s',_0x53c9a7,'zip'))},function(_0x207051,_0x458d89){rimraf(path[_0x5b45('0x25')](_0x52f7b6,_0x53c9a7),function(){});_0x776381('zip\x20finished');});});}})[_0x5b45('0x14')](function(){logger[_0x5b45('0xd')](util[_0x5b45('0xe')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0x5b45('0x10')));return analyticExtractedReport(_0x5b45('0x2c'),_0x29ce29?util[_0x5b45('0xe')](_0x5b45('0x29'),_0x53c9a7,_0x29ce29?_0x5b45('0x2d'):_0x5b45('0x28')):null);});})[_0x5b45('0x2e')](function(_0x488d3e){logger[_0x5b45('0xd')](util[_0x5b45('0xe')](_0x5b45('0x2f'),EXTRACTED_REPORT_ID,_0x5b45('0x10')),util[_0x5b45('0x30')](_0x488d3e,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x5b45('0x31'));})[_0x5b45('0x32')](function(){process[_0x5b45('0x33')](EXIT_CODE);});}main(); \ No newline at end of file +var _0xb01a=['../../mysqldb','dbH','../../config/logger','analytics','argv','savename','update','info','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','find','then','splitSizeXlsx','sequelize','query','format','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','Empty','split','num','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT','dirname','basename','.xlsx','length','existsSync','mkdirSync','join','each','%s%d.%s','xlsx','%s.%s','binary','zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','exit','util','path','lodash','json2xls','bluebird','zip-dir','rimraf'];(function(_0x1cd674,_0x8d3638){var _0x27928f=function(_0x5e3c70){while(--_0x5e3c70){_0x1cd674['push'](_0x1cd674['shift']());}};_0x27928f(++_0x8d3638);}(_0xb01a,0x1a1));var _0xab01=function(_0x42ac42,_0x6e6a4b){_0x42ac42=_0x42ac42-0x0;var _0x50dc84=_0xb01a[_0x42ac42];return _0x50dc84;};'use strict';var util=require(_0xab01('0x0'));var path=require(_0xab01('0x1'));var _=require(_0xab01('0x2'));var fs=require('fs');var json2xls=require(_0xab01('0x3'));var BPromise=require(_0xab01('0x4'));var zipdir=require(_0xab01('0x5'));var rimraf=require(_0xab01('0x6'));var db=require(_0xab01('0x7'))['db'];var dbH=require(_0xab01('0x7'))[_0xab01('0x8')];var logger=require(_0xab01('0x9'))(_0xab01('0xa'));var EXTRACTED_REPORT_ID=Number(process[_0xab01('0xb')][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0xab01('0xb')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x21be3d,_0x4b413e){var _0x52146e={'status':_0x21be3d};var _0x71864b={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x4b413e){_0x52146e[_0xab01('0xc')]=_0x4b413e;}return db['AnalyticExtractedReport'][_0xab01('0xd')](_0x52146e,_0x71864b);}function main(){var _0x48be78=0x1388;var _0x57b047;logger[_0xab01('0xe')](util['format'](_0xab01('0xf'),EXTRACTED_REPORT_ID,_0xab01('0x10')));return db['Setting'][_0xab01('0x11')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split','splitSizeXlsx']})[_0xab01('0x12')](function(_0x37088b){if(_0x37088b){_0x57b047=_0x37088b;_0x48be78=_0x57b047[_0xab01('0x13')]||0x1388;}})[_0xab01('0x12')](function(){return dbH[_0xab01('0x14')][_0xab01('0x15')](util[_0xab01('0x16')](_0xab01('0x17'),QUERY),{'type':dbH['sequelize']['QueryTypes']['SELECT']});})['then'](function(_0x32001d){if(!_0x32001d[0x0]['num']){return analyticExtractedReport(_0xab01('0x18'));}var _0x2d9c23=[];var _0x26af11=0x0;if(_0x57b047[_0xab01('0x19')]){if(_0x32001d&&_0x32001d['length']){var _0x3bea90=_['range'](_0x32001d[0x0][_0xab01('0x1a')]/_0x48be78);var _0xb59105=Number['isInteger'](_0x32001d[0x0]['num']/_0x48be78)?_0x32001d[0x0][_0xab01('0x1a')]%_0x48be78:0x0;_0x3bea90[_0xab01('0x1b')](function(_0xa9f649){if(_0xa9f649>0x0){_0x26af11+=_0x48be78;}_0x2d9c23[_0xab01('0x1c')](dbH[_0xab01('0x14')][_0xab01('0x15')](util[_0xab01('0x16')](_0xab01('0x1d'),QUERY,_0x48be78,_0x26af11),{'type':dbH[_0xab01('0x14')][_0xab01('0x1e')]['SELECT']}));});if(_0xb59105>0x0){_0x26af11+=_0x48be78;_0x2d9c23[_0xab01('0x1c')](dbH[_0xab01('0x14')][_0xab01('0x15')](util[_0xab01('0x16')](_0xab01('0x1d'),QUERY,_0xb59105,_0x26af11),{'type':dbH[_0xab01('0x14')][_0xab01('0x1e')][_0xab01('0x1f')]}));}}}else{_0x2d9c23['push'](dbH[_0xab01('0x14')][_0xab01('0x15')](QUERY,{'type':dbH[_0xab01('0x14')][_0xab01('0x1e')][_0xab01('0x1f')]}));}var _0x1ebc65=path[_0xab01('0x20')](PATH);var _0x55831d=path[_0xab01('0x21')](PATH,_0xab01('0x22'));var _0x2758d=_0x57b047[_0xab01('0x19')]&&_0x2d9c23[_0xab01('0x23')]>0x1;var _0x46088d=[];if(!fs[_0xab01('0x24')](path['join'](_0x1ebc65,_0x55831d))&&_0x2758d){fs[_0xab01('0x25')](path[_0xab01('0x26')](_0x1ebc65,_0x55831d));}return BPromise[_0xab01('0x27')](_0x2d9c23,function(_0x36c53f){_0x46088d[_0xab01('0x1c')](_0x36c53f);})[_0xab01('0x12')](function(){for(var _0x51a927=0x0;_0x51a927<_0x46088d[_0xab01('0x23')];_0x51a927+=0x1){var _0x209e10;var _0x4a22c0=_0x46088d[_0x51a927];if(_0x2758d){_0x209e10=path[_0xab01('0x26')](_0x1ebc65,_0x55831d,util[_0xab01('0x16')](_0xab01('0x28'),_0x55831d,_0x51a927,_0xab01('0x29')));}else{_0x209e10=path[_0xab01('0x26')](_0x1ebc65,util[_0xab01('0x16')](_0xab01('0x2a'),_0x55831d,_0xab01('0x29')));}fs['writeFileSync'](_0x209e10,json2xls(_0x4a22c0),_0xab01('0x2b'));}})[_0xab01('0x12')](function(){if(_0x2758d){return new Promise(function(_0x51a120){zipdir(path[_0xab01('0x26')](_0x1ebc65,_0x55831d),{'saveTo':path[_0xab01('0x26')](_0x1ebc65,util[_0xab01('0x16')](_0xab01('0x2a'),_0x55831d,_0xab01('0x2c')))},function(_0x3b9428,_0x4fce3b){rimraf(path[_0xab01('0x26')](_0x1ebc65,_0x55831d),function(){});_0x51a120(_0xab01('0x2d'));});});}})[_0xab01('0x12')](function(){logger[_0xab01('0xe')](util[_0xab01('0x16')](_0xab01('0x2e'),EXTRACTED_REPORT_ID,_0xab01('0x10')));return analyticExtractedReport('Completed',_0x2758d?util['format']('%s.%s',_0x55831d,_0x2758d?_0xab01('0x2c'):_0xab01('0x29')):null);});})[_0xab01('0x2f')](function(_0x1f75b1){logger[_0xab01('0xe')](util[_0xab01('0x16')](_0xab01('0x30'),EXTRACTED_REPORT_ID,_0xab01('0x10')),util[_0xab01('0x31')](_0x1f75b1,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xab01('0x32'));})[_0xab01('0x33')](function(){process[_0xab01('0x34')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/extensions/rewrite.js b/server/components/extensions/rewrite.js index a2d6e4b..d4f72fb 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 _0x2960=['custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','last','Hangup','concat','destroy','bulkCreate','sortBy','catch','error','rewrite','util','models','Interval','findAll','intervals','VoiceExtension','uniq','map','exten','then','filter','groupBy','queue','playback','hasOwnProperty','priority','extensions','find','push','Set','format','CDR(type)=%s','type','context','VoiceExtensionId','inbound','CDR(routeid)=','extension','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','ExecIf','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','wav','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','length','toLowerCase','createdAt','updatedAt','interval','*,*,*,*','IntervalId','tag','CDR(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'];(function(_0x5f6a8a,_0x45f474){var _0x2cce4d=function(_0x590b80){while(--_0x590b80){_0x5f6a8a['push'](_0x5f6a8a['shift']());}};_0x2cce4d(++_0x45f474);}(_0x2960,0x182));var _0x0296=function(_0x1a58a9,_0xe32406){_0x1a58a9=_0x1a58a9-0x0;var _0x45449b=_0x2960[_0x1a58a9];return _0x45449b;};'use strict';var _=require('lodash');var util=require(_0x0296('0x0'));function rewrite(_0x34bb9e,_0x2629ad){var _0x2f95d1=this;return _0x34bb9e[_0x0296('0x1')][_0x0296('0x2')][_0x0296('0x3')]({'raw':!![]})['then'](function(_0x262602){_0x2f95d1[_0x0296('0x4')]=_0x262602;return _0x34bb9e['models'][_0x0296('0x5')]['findAll']({'where':{'IntervalId':_0x2629ad['IntervalId']},'raw':!![]});})['then'](function(_0x655a7b){return _0x34bb9e[_0x0296('0x1')][_0x0296('0x5')]['findAll']({'where':{'exten':{'$in':_[_0x0296('0x6')](_[_0x0296('0x7')](_0x655a7b,_0x0296('0x8')))}},'order':[{'raw':'CAST(priority\x20AS\x20UNSIGNED)'}],'raw':!![]});})[_0x0296('0x9')](function(_0x66419d){var _0x158bab=_[_0x0296('0xa')](_0x66419d,{'priority':'1'});var _0x518c1b=_[_0x0296('0xa')](_0x66419d,{'isApp':0x1});var _0x42f93f=_[_0x0296('0xb')](_0x518c1b,_0x0296('0x8'));var _0x4eb479=[_0x0296('0xc'),_0x0296('0xd')];var _0x65b9fa=[];var _0x355e49=[];for(var _0xda933f in _0x42f93f){if(_0x42f93f[_0x0296('0xe')](_0xda933f)){_0x2f95d1[_0x0296('0xf')]=0x2;_0x2f95d1[_0x0296('0x10')]=[];_0x2f95d1['extension']=_[_0x0296('0x11')](_0x158bab,{'exten':_0x42f93f[_0xda933f][0x0][_0x0296('0x8')]});_0x2f95d1[_0x0296('0x10')][_0x0296('0x12')]({'type':_0x42f93f[_0xda933f][0x0]['type'],'app':_0x0296('0x13'),'appdata':util[_0x0296('0x14')](_0x0296('0x15'),_0x42f93f[_0xda933f][0x0][_0x0296('0x16')]),'context':_0x42f93f[_0xda933f][0x0][_0x0296('0x17')],'exten':_0x42f93f[_0xda933f][0x0]['exten'],'priority':_0x2f95d1[_0x0296('0xf')]++,'VoiceExtensionId':_0x42f93f[_0xda933f][0x0][_0x0296('0x18')]});if(_0x42f93f[_0xda933f][0x0][_0x0296('0x16')]===_0x0296('0x19')){_0x2f95d1['extensions']['push']({'type':_0x42f93f[_0xda933f][0x0]['type'],'app':'Set','appdata':_0x0296('0x1a')+_0x42f93f[_0xda933f][0x0][_0x0296('0x18')],'context':_0x42f93f[_0xda933f][0x0][_0x0296('0x17')],'exten':_0x42f93f[_0xda933f][0x0][_0x0296('0x8')],'priority':_0x2f95d1[_0x0296('0xf')]++,'VoiceExtensionId':_0x42f93f[_0xda933f][0x0][_0x0296('0x18')]});}else if(_0x42f93f[_0xda933f][0x0]['type']==='outbound'){if(_0x2f95d1[_0x0296('0x1b')]){_0x2f95d1[_0x0296('0x10')]['push']({'type':_0x42f93f[_0xda933f][0x0][_0x0296('0x16')],'app':_0x0296('0x13'),'appdata':_0x0296('0x1c')+(_0x2f95d1[_0x0296('0x1b')][_0x0296('0x1d')]?_0x0296('0x1e')+_0x2f95d1[_0x0296('0x1b')][_0x0296('0x1d')]+'}':_0x0296('0x1f')),'context':_0x42f93f[_0xda933f][0x0]['context'],'exten':_0x42f93f[_0xda933f][0x0][_0x0296('0x8')],'priority':_0x2f95d1[_0x0296('0xf')]++,'VoiceExtensionId':_0x42f93f[_0xda933f][0x0]['VoiceExtensionId']});}_0x2f95d1[_0x0296('0x10')][_0x0296('0x12')]({'type':_0x42f93f[_0xda933f][0x0][_0x0296('0x16')],'app':_0x0296('0x13'),'appdata':_0x0296('0x1a')+_0x42f93f[_0xda933f][0x0][_0x0296('0x18')],'context':_0x42f93f[_0xda933f][0x0][_0x0296('0x17')],'exten':_0x42f93f[_0xda933f][0x0][_0x0296('0x8')],'priority':_0x2f95d1['priority']++,'VoiceExtensionId':_0x42f93f[_0xda933f][0x0]['VoiceExtensionId']});var _0x574e28=_0x2f95d1['priority']++;_0x2f95d1[_0x0296('0x10')]['push']({'type':_0x42f93f[_0xda933f][0x0][_0x0296('0x16')],'app':_0x0296('0x20'),'appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0x574e28+0x2)+'):Goto('+(_0x574e28+0x1)+')','context':_0x42f93f[_0xda933f][0x0][_0x0296('0x17')],'exten':_0x42f93f[_0xda933f][0x0][_0x0296('0x8')],'priority':_0x574e28,'VoiceExtensionId':_0x42f93f[_0xda933f][0x0][_0x0296('0x18')]});if(_0x2f95d1[_0x0296('0x1b')]){_0x2f95d1[_0x0296('0x10')]['push']({'type':_0x42f93f[_0xda933f][0x0][_0x0296('0x16')],'app':_0x0296('0x13'),'appdata':_0x2f95d1['extension'][_0x0296('0x1d')]?_0x0296('0x21')+_0x2f95d1[_0x0296('0x1b')]['cutdigits']+'}':_0x0296('0x22'),'context':_0x42f93f[_0xda933f][0x0][_0x0296('0x17')],'exten':_0x42f93f[_0xda933f][0x0][_0x0296('0x8')],'priority':_0x2f95d1[_0x0296('0xf')]++,'VoiceExtensionId':_0x42f93f[_0xda933f][0x0][_0x0296('0x18')]});}_0x2f95d1[_0x0296('0x10')][_0x0296('0x12')]({'type':_0x42f93f[_0xda933f][0x0][_0x0296('0x16')],'app':'Set','appdata':'outboundrouteid='+_0x42f93f[_0xda933f][0x0][_0x0296('0x18')],'context':_0x42f93f[_0xda933f][0x0][_0x0296('0x17')],'exten':_0x42f93f[_0xda933f][0x0][_0x0296('0x8')],'priority':_0x2f95d1['priority']++,'VoiceExtensionId':_0x42f93f[_0xda933f][0x0][_0x0296('0x18')]});if(_0x2f95d1[_0x0296('0x1b')]&&_0x2f95d1['extension']['hasOwnProperty'](_0x0296('0x23'))&&_0x2f95d1['extension'][_0x0296('0x23')]!==_0x0296('0x24')){_0x2f95d1[_0x0296('0x10')][_0x0296('0x12')]({'type':_0x42f93f[_0xda933f][0x0][_0x0296('0x16')],'app':_0x0296('0x13'),'appdata':_0x0296('0x25'),'context':_0x42f93f[_0xda933f][0x0][_0x0296('0x17')],'exten':_0x42f93f[_0xda933f][0x0]['exten'],'priority':_0x2f95d1[_0x0296('0xf')]++,'VoiceExtensionId':_0x42f93f[_0xda933f][0x0]['VoiceExtensionId']});_0x2f95d1[_0x0296('0x10')][_0x0296('0x12')]({'type':_0x42f93f[_0xda933f][0x0]['type'],'app':_0x0296('0x13'),'appdata':'_XCALLY_MIXMONITOR_FORMAT='+_0x2f95d1['extension'][_0x0296('0x23')]||_0x0296('0x26'),'context':_0x42f93f[_0xda933f][0x0]['context'],'exten':_0x42f93f[_0xda933f][0x0][_0x0296('0x8')],'priority':_0x2f95d1[_0x0296('0xf')]++,'VoiceExtensionId':_0x42f93f[_0xda933f][0x0][_0x0296('0x18')]});}}_0x2f95d1['extensions'][_0x0296('0x12')]({'type':_0x42f93f[_0xda933f][0x0][_0x0296('0x16')],'app':'Set','appdata':_0x0296('0x27'),'context':_0x42f93f[_0xda933f][0x0][_0x0296('0x17')],'exten':_0x42f93f[_0xda933f][0x0]['exten'],'priority':_0x2f95d1[_0x0296('0xf')]++,'VoiceExtensionId':_0x42f93f[_0xda933f][0x0]['VoiceExtensionId']});_0x2f95d1[_0x0296('0x10')][_0x0296('0x12')]({'type':_0x42f93f[_0xda933f][0x0][_0x0296('0x16')],'app':'Set','appdata':_0x0296('0x28'),'context':_0x42f93f[_0xda933f][0x0]['context'],'exten':_0x42f93f[_0xda933f][0x0][_0x0296('0x8')],'priority':_0x2f95d1[_0x0296('0xf')]++,'VoiceExtensionId':_0x42f93f[_0xda933f][0x0]['VoiceExtensionId']});_0x2f95d1['extensions'][_0x0296('0x12')]({'type':_0x42f93f[_0xda933f][0x0]['type'],'app':_0x0296('0x13'),'appdata':_0x0296('0x29'),'context':_0x42f93f[_0xda933f][0x0][_0x0296('0x17')],'exten':_0x42f93f[_0xda933f][0x0][_0x0296('0x8')],'priority':_0x2f95d1[_0x0296('0xf')]++,'VoiceExtensionId':_0x42f93f[_0xda933f][0x0][_0x0296('0x18')]});for(var _0x62a42d=0x0,_0x5a9033=0x0;_0x62a42d<_0x42f93f[_0xda933f][_0x0296('0x2a')];_0x62a42d+=0x1,_0x5a9033=0x0){var _0x2893db=_0x42f93f[_0xda933f][_0x62a42d];if(_0x2893db[_0x0296('0x16')]){_0x2893db[_0x0296('0x16')]=_0x2893db[_0x0296('0x16')][_0x0296('0x2b')]();}var _0x71fff=[];var _0x377f44=[];delete _0x2893db['id'];delete _0x2893db[_0x0296('0x2c')];delete _0x2893db[_0x0296('0x2d')];var _0x5ac214=_0x2893db[_0x0296('0x2e')]!==_0x0296('0x2f')?[_0x2893db[_0x0296('0x2e')]]:_0x2893db['IntervalId']?_[_0x0296('0x7')](_[_0x0296('0xa')](_0x2f95d1[_0x0296('0x4')],{'IntervalId':_0x2893db[_0x0296('0x30')]}),_0x0296('0x2e')):[];if(_0x2893db[_0x0296('0xe')]('tag')){if(_0x2893db[_0x0296('0x31')]&&_0x2893db[_0x0296('0x31')]!=='--'){_0x71fff['push']({'type':_0x2893db[_0x0296('0x16')],'app':_0x0296('0x13'),'appdata':_0x0296('0x32')+_0x2893db[_0x0296('0x31')],'context':_0x2893db[_0x0296('0x17')],'exten':_0x2893db[_0x0296('0x8')],'priority':_0x5ac214[_0x0296('0x2a')]+_0x2f95d1[_0x0296('0xf')]+_0x5a9033++,'VoiceExtensionId':_0x2893db[_0x0296('0x18')]});}}if(_0x2893db[_0x0296('0x16')]==='outbound'&&_0x2893db[_0x0296('0xe')](_0x0296('0x33'))){if(_0x2893db[_0x0296('0x33')]){_0x71fff['push']({'type':_0x2893db[_0x0296('0x16')],'app':_0x0296('0x20'),'appdata':_0x0296('0x34')+_0x2893db[_0x0296('0x33')]+')','context':_0x2893db[_0x0296('0x17')],'exten':_0x2893db[_0x0296('0x8')],'priority':_0x5ac214[_0x0296('0x2a')]+_0x2f95d1['priority']+_0x5a9033++,'VoiceExtensionId':_0x2893db[_0x0296('0x18')]});}else{_0x71fff['push']({'type':_0x2893db[_0x0296('0x16')],'app':_0x0296('0x20'),'appdata':_0x0296('0x35'),'context':_0x2893db['context'],'exten':_0x2893db[_0x0296('0x8')],'priority':_0x5ac214[_0x0296('0x2a')]+_0x2f95d1[_0x0296('0xf')]+_0x5a9033++,'VoiceExtensionId':_0x2893db[_0x0296('0x18')]});}}if(_0x2893db[_0x0296('0xe')](_0x0296('0x36'))){if(_0x4eb479[_0x0296('0x37')](_0x2893db[_0x0296('0x38')]['toLowerCase']())>=0x0&&_0x2893db[_0x0296('0x39')]!==_0x0296('0x3a')){if(_0x2893db[_0x0296('0x36')]){_0x71fff[_0x0296('0x12')]({'type':_0x2893db[_0x0296('0x16')],'app':'ExecIf','appdata':_0x0296('0x3b'),'context':_0x2893db[_0x0296('0x17')],'exten':_0x2893db['exten'],'priority':_0x5ac214[_0x0296('0x2a')]+_0x2f95d1[_0x0296('0xf')]+_0x5a9033++,'VoiceExtensionId':_0x2893db['VoiceExtensionId']});_0x71fff[_0x0296('0x12')]({'type':_0x2893db[_0x0296('0x16')],'app':_0x0296('0x13'),'appdata':_0x0296('0x3c'),'context':_0x2893db[_0x0296('0x17')],'exten':_0x2893db[_0x0296('0x8')],'priority':_0x5ac214['length']+_0x2f95d1[_0x0296('0xf')]+_0x5a9033++,'VoiceExtensionId':_0x2893db[_0x0296('0x18')]});}else{_0x71fff['push']({'type':_0x2893db['type'],'app':_0x0296('0x20'),'appdata':'$[${XCALLY-MOTION-PROGRESS}=0]?Progress','context':_0x2893db[_0x0296('0x17')],'exten':_0x2893db['exten'],'priority':_0x5ac214[_0x0296('0x2a')]+_0x2f95d1[_0x0296('0xf')]+_0x5a9033++,'VoiceExtensionId':_0x2893db[_0x0296('0x18')]});_0x71fff[_0x0296('0x12')]({'type':_0x2893db[_0x0296('0x16')],'app':_0x0296('0x13'),'appdata':_0x0296('0x3d'),'context':_0x2893db['context'],'exten':_0x2893db['exten'],'priority':_0x5ac214[_0x0296('0x2a')]+_0x2f95d1[_0x0296('0xf')]+_0x5a9033++,'VoiceExtensionId':_0x2893db[_0x0296('0x18')]});}}}for(var _0x438845=0x0;_0x438845<_0x5ac214['length'];_0x438845+=0x1){var _0x33a9f3=_0x2f95d1[_0x0296('0xf')]+_0x5ac214['length'];var _0x1948f8=_0x438845===_0x5ac214[_0x0296('0x2a')]-0x1?_0x2f95d1['priority']+_0x71fff[_0x0296('0x2a')]+_0x377f44[_0x0296('0x2a')]+0x2:_0x2f95d1[_0x0296('0xf')]+_0x438845+0x1;_0x71fff[_0x0296('0x3e')](_0x438845,0x0,{'type':_0x2893db['type'],'app':_0x0296('0x3f'),'appdata':_0x5ac214[_0x438845]+'?'+_0x2893db[_0x0296('0x17')]+_0x0296('0x40')+_0x33a9f3+':'+_0x2893db['context']+',${EXTEN},'+_0x1948f8,'exten':_0x2893db[_0x0296('0x8')],'context':_0x2893db[_0x0296('0x17')],'priority':_0x2f95d1[_0x0296('0xf')]+_0x438845,'VoiceExtensionId':_0x42f93f[_0xda933f][0x0][_0x0296('0x18')]});}_0x2893db[_0x0296('0xf')]=_0x71fff['length']?_[_0x0296('0x41')](_0x71fff)[_0x0296('0xf')]+0x1:_0x2f95d1[_0x0296('0xf')];_0x2f95d1[_0x0296('0xf')]=(_0x377f44['length']?_[_0x0296('0x41')](_0x377f44)[_0x0296('0xf')]:_0x2893db[_0x0296('0xf')])+0x1;_0x2f95d1[_0x0296('0x10')]=_['concat'](_0x2f95d1[_0x0296('0x10')],_0x71fff,[_0x2893db],_0x377f44);}_0x2f95d1[_0x0296('0x10')][_0x0296('0x12')]({'type':_0x42f93f[_0xda933f][0x0]['type'],'app':_0x0296('0x42'),'exten':_0x42f93f[_0xda933f][0x0]['exten'],'context':_0x42f93f[_0xda933f][0x0]['context'],'priority':_0x2f95d1[_0x0296('0xf')],'VoiceExtensionId':_0x42f93f[_0xda933f][0x0][_0x0296('0x18')]});_0x65b9fa[_0x0296('0x12')](_0x42f93f[_0xda933f][0x0][_0x0296('0x18')]);_0x355e49=_[_0x0296('0x43')](_0x355e49,_0x2f95d1[_0x0296('0x10')]);}}return _0x34bb9e['transaction'](function(_0x57f982){return _0x34bb9e[_0x0296('0x1')][_0x0296('0x5')][_0x0296('0x44')]({'where':{'VoiceExtensionId':{'$in':_0x65b9fa}},'transaction':_0x57f982})[_0x0296('0x9')](function(_0x3dbeb8){return _0x34bb9e[_0x0296('0x1')][_0x0296('0x5')][_0x0296('0x45')](_[_0x0296('0x46')](_0x355e49,_0x0296('0xf')),{'transaction':_0x57f982});});});})[_0x0296('0x47')](function(_0xa237a2){console[_0x0296('0x48')](_0xa237a2);});}exports[_0x0296('0x49')]=rewrite; \ No newline at end of file +var _0xe67a=['error','rewrite','lodash','util','findAll','then','models','VoiceExtension','IntervalId','uniq','exten','CAST(priority\x20AS\x20UNSIGNED)','groupBy','queue','playback','hasOwnProperty','priority','extensions','extension','format','CDR(type)=%s','type','context','VoiceExtensionId','inbound','push','Set','CDR(routeid)=','outbound','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','recordingFormat','none','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','toLowerCase','createdAt','updatedAt','*,*,*,*','map','filter','intervals','CDR(tag)=','tag','length','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','indexOf','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime','last','Hangup','concat','transaction','bulkCreate','catch'];(function(_0x493b81,_0x1c8994){var _0x1a27ee=function(_0x269ea2){while(--_0x269ea2){_0x493b81['push'](_0x493b81['shift']());}};_0x1a27ee(++_0x1c8994);}(_0xe67a,0xd7));var _0xae67=function(_0xef0b43,_0x2b3f5a){_0xef0b43=_0xef0b43-0x0;var _0x559e5f=_0xe67a[_0xef0b43];return _0x559e5f;};'use strict';var _=require(_0xae67('0x0'));var util=require(_0xae67('0x1'));function rewrite(_0x2de9ba,_0x31ac0f){var _0x472dbd=this;return _0x2de9ba['models']['Interval'][_0xae67('0x2')]({'raw':!![]})[_0xae67('0x3')](function(_0x2fe9d2){_0x472dbd['intervals']=_0x2fe9d2;return _0x2de9ba[_0xae67('0x4')][_0xae67('0x5')]['findAll']({'where':{'IntervalId':_0x31ac0f[_0xae67('0x6')]},'raw':!![]});})['then'](function(_0x209273){return _0x2de9ba['models'][_0xae67('0x5')][_0xae67('0x2')]({'where':{'exten':{'$in':_[_0xae67('0x7')](_['map'](_0x209273,_0xae67('0x8')))}},'order':[{'raw':_0xae67('0x9')}],'raw':!![]});})[_0xae67('0x3')](function(_0x51c619){var _0x4de64b=_['filter'](_0x51c619,{'priority':'1'});var _0x1a884d=_['filter'](_0x51c619,{'isApp':0x1});var _0x1490be=_[_0xae67('0xa')](_0x1a884d,_0xae67('0x8'));var _0x519098=[_0xae67('0xb'),_0xae67('0xc')];var _0x3e00ff=[];var _0x128d55=[];for(var _0x23ccdf in _0x1490be){if(_0x1490be[_0xae67('0xd')](_0x23ccdf)){_0x472dbd[_0xae67('0xe')]=0x2;_0x472dbd[_0xae67('0xf')]=[];_0x472dbd[_0xae67('0x10')]=_['find'](_0x4de64b,{'exten':_0x1490be[_0x23ccdf][0x0]['exten']});_0x472dbd['extensions']['push']({'type':_0x1490be[_0x23ccdf][0x0]['type'],'app':'Set','appdata':util[_0xae67('0x11')](_0xae67('0x12'),_0x1490be[_0x23ccdf][0x0][_0xae67('0x13')]),'context':_0x1490be[_0x23ccdf][0x0][_0xae67('0x14')],'exten':_0x1490be[_0x23ccdf][0x0][_0xae67('0x8')],'priority':_0x472dbd['priority']++,'VoiceExtensionId':_0x1490be[_0x23ccdf][0x0][_0xae67('0x15')]});if(_0x1490be[_0x23ccdf][0x0][_0xae67('0x13')]===_0xae67('0x16')){_0x472dbd[_0xae67('0xf')][_0xae67('0x17')]({'type':_0x1490be[_0x23ccdf][0x0][_0xae67('0x13')],'app':_0xae67('0x18'),'appdata':_0xae67('0x19')+_0x1490be[_0x23ccdf][0x0]['VoiceExtensionId'],'context':_0x1490be[_0x23ccdf][0x0][_0xae67('0x14')],'exten':_0x1490be[_0x23ccdf][0x0]['exten'],'priority':_0x472dbd[_0xae67('0xe')]++,'VoiceExtensionId':_0x1490be[_0x23ccdf][0x0][_0xae67('0x15')]});}else if(_0x1490be[_0x23ccdf][0x0][_0xae67('0x13')]===_0xae67('0x1a')){if(_0x472dbd[_0xae67('0x10')]){_0x472dbd['extensions'][_0xae67('0x17')]({'type':_0x1490be[_0x23ccdf][0x0][_0xae67('0x13')],'app':_0xae67('0x18'),'appdata':_0xae67('0x1b')+(_0x472dbd[_0xae67('0x10')][_0xae67('0x1c')]?_0xae67('0x1d')+_0x472dbd[_0xae67('0x10')][_0xae67('0x1c')]+'}':_0xae67('0x1e')),'context':_0x1490be[_0x23ccdf][0x0][_0xae67('0x14')],'exten':_0x1490be[_0x23ccdf][0x0]['exten'],'priority':_0x472dbd[_0xae67('0xe')]++,'VoiceExtensionId':_0x1490be[_0x23ccdf][0x0][_0xae67('0x15')]});}_0x472dbd[_0xae67('0xf')][_0xae67('0x17')]({'type':_0x1490be[_0x23ccdf][0x0][_0xae67('0x13')],'app':_0xae67('0x18'),'appdata':_0xae67('0x19')+_0x1490be[_0x23ccdf][0x0][_0xae67('0x15')],'context':_0x1490be[_0x23ccdf][0x0][_0xae67('0x14')],'exten':_0x1490be[_0x23ccdf][0x0][_0xae67('0x8')],'priority':_0x472dbd[_0xae67('0xe')]++,'VoiceExtensionId':_0x1490be[_0x23ccdf][0x0]['VoiceExtensionId']});var _0x49c273=_0x472dbd['priority']++;_0x472dbd[_0xae67('0xf')]['push']({'type':_0x1490be[_0x23ccdf][0x0]['type'],'app':_0xae67('0x1f'),'appdata':_0xae67('0x20')+(_0x49c273+0x2)+'):Goto('+(_0x49c273+0x1)+')','context':_0x1490be[_0x23ccdf][0x0][_0xae67('0x14')],'exten':_0x1490be[_0x23ccdf][0x0][_0xae67('0x8')],'priority':_0x49c273,'VoiceExtensionId':_0x1490be[_0x23ccdf][0x0][_0xae67('0x15')]});if(_0x472dbd['extension']){_0x472dbd['extensions'][_0xae67('0x17')]({'type':_0x1490be[_0x23ccdf][0x0][_0xae67('0x13')],'app':_0xae67('0x18'),'appdata':_0x472dbd[_0xae67('0x10')][_0xae67('0x1c')]?_0xae67('0x21')+_0x472dbd['extension']['cutdigits']+'}':_0xae67('0x22'),'context':_0x1490be[_0x23ccdf][0x0][_0xae67('0x14')],'exten':_0x1490be[_0x23ccdf][0x0][_0xae67('0x8')],'priority':_0x472dbd[_0xae67('0xe')]++,'VoiceExtensionId':_0x1490be[_0x23ccdf][0x0][_0xae67('0x15')]});}_0x472dbd[_0xae67('0xf')]['push']({'type':_0x1490be[_0x23ccdf][0x0][_0xae67('0x13')],'app':'Set','appdata':'outboundrouteid='+_0x1490be[_0x23ccdf][0x0][_0xae67('0x15')],'context':_0x1490be[_0x23ccdf][0x0][_0xae67('0x14')],'exten':_0x1490be[_0x23ccdf][0x0]['exten'],'priority':_0x472dbd[_0xae67('0xe')]++,'VoiceExtensionId':_0x1490be[_0x23ccdf][0x0][_0xae67('0x15')]});if(_0x472dbd[_0xae67('0x10')]&&_0x472dbd[_0xae67('0x10')][_0xae67('0xd')](_0xae67('0x23'))&&_0x472dbd['extension'][_0xae67('0x23')]!==_0xae67('0x24')){_0x472dbd[_0xae67('0xf')][_0xae67('0x17')]({'type':_0x1490be[_0x23ccdf][0x0]['type'],'app':_0xae67('0x18'),'appdata':'_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','context':_0x1490be[_0x23ccdf][0x0][_0xae67('0x14')],'exten':_0x1490be[_0x23ccdf][0x0][_0xae67('0x8')],'priority':_0x472dbd[_0xae67('0xe')]++,'VoiceExtensionId':_0x1490be[_0x23ccdf][0x0][_0xae67('0x15')]});_0x472dbd['extensions']['push']({'type':_0x1490be[_0x23ccdf][0x0][_0xae67('0x13')],'app':_0xae67('0x18'),'appdata':_0xae67('0x25')+_0x472dbd[_0xae67('0x10')][_0xae67('0x23')]||_0xae67('0x26'),'context':_0x1490be[_0x23ccdf][0x0][_0xae67('0x14')],'exten':_0x1490be[_0x23ccdf][0x0][_0xae67('0x8')],'priority':_0x472dbd['priority']++,'VoiceExtensionId':_0x1490be[_0x23ccdf][0x0][_0xae67('0x15')]});}}_0x472dbd[_0xae67('0xf')][_0xae67('0x17')]({'type':_0x1490be[_0x23ccdf][0x0][_0xae67('0x13')],'app':_0xae67('0x18'),'appdata':_0xae67('0x27'),'context':_0x1490be[_0x23ccdf][0x0][_0xae67('0x14')],'exten':_0x1490be[_0x23ccdf][0x0][_0xae67('0x8')],'priority':_0x472dbd[_0xae67('0xe')]++,'VoiceExtensionId':_0x1490be[_0x23ccdf][0x0]['VoiceExtensionId']});_0x472dbd['extensions'][_0xae67('0x17')]({'type':_0x1490be[_0x23ccdf][0x0]['type'],'app':_0xae67('0x18'),'appdata':_0xae67('0x28'),'context':_0x1490be[_0x23ccdf][0x0][_0xae67('0x14')],'exten':_0x1490be[_0x23ccdf][0x0][_0xae67('0x8')],'priority':_0x472dbd[_0xae67('0xe')]++,'VoiceExtensionId':_0x1490be[_0x23ccdf][0x0][_0xae67('0x15')]});_0x472dbd[_0xae67('0xf')][_0xae67('0x17')]({'type':_0x1490be[_0x23ccdf][0x0]['type'],'app':_0xae67('0x18'),'appdata':'MONITOR_OPTIONS=ab','context':_0x1490be[_0x23ccdf][0x0][_0xae67('0x14')],'exten':_0x1490be[_0x23ccdf][0x0][_0xae67('0x8')],'priority':_0x472dbd[_0xae67('0xe')]++,'VoiceExtensionId':_0x1490be[_0x23ccdf][0x0]['VoiceExtensionId']});for(var _0x16d694=0x0,_0x468514=0x0;_0x16d694<_0x1490be[_0x23ccdf]['length'];_0x16d694+=0x1,_0x468514=0x0){var _0x292e68=_0x1490be[_0x23ccdf][_0x16d694];if(_0x292e68[_0xae67('0x13')]){_0x292e68[_0xae67('0x13')]=_0x292e68[_0xae67('0x13')][_0xae67('0x29')]();}var _0x40d114=[];var _0x266f2c=[];delete _0x292e68['id'];delete _0x292e68[_0xae67('0x2a')];delete _0x292e68[_0xae67('0x2b')];var _0x4cb3ba=_0x292e68['interval']!==_0xae67('0x2c')?[_0x292e68['interval']]:_0x292e68[_0xae67('0x6')]?_[_0xae67('0x2d')](_[_0xae67('0x2e')](_0x472dbd[_0xae67('0x2f')],{'IntervalId':_0x292e68['IntervalId']}),'interval'):[];if(_0x292e68[_0xae67('0xd')]('tag')){if(_0x292e68['tag']&&_0x292e68['tag']!=='--'){_0x40d114[_0xae67('0x17')]({'type':_0x292e68[_0xae67('0x13')],'app':_0xae67('0x18'),'appdata':_0xae67('0x30')+_0x292e68[_0xae67('0x31')],'context':_0x292e68[_0xae67('0x14')],'exten':_0x292e68[_0xae67('0x8')],'priority':_0x4cb3ba[_0xae67('0x32')]+_0x472dbd[_0xae67('0xe')]+_0x468514++,'VoiceExtensionId':_0x292e68[_0xae67('0x15')]});}}if(_0x292e68[_0xae67('0x13')]===_0xae67('0x1a')&&_0x292e68['hasOwnProperty'](_0xae67('0x33'))){if(_0x292e68['callerID']){_0x40d114[_0xae67('0x17')]({'type':_0x292e68[_0xae67('0x13')],'app':_0xae67('0x1f'),'appdata':_0xae67('0x34')+_0x292e68['callerID']+')','context':_0x292e68['context'],'exten':_0x292e68[_0xae67('0x8')],'priority':_0x4cb3ba[_0xae67('0x32')]+_0x472dbd[_0xae67('0xe')]+_0x468514++,'VoiceExtensionId':_0x292e68[_0xae67('0x15')]});}else{_0x40d114[_0xae67('0x17')]({'type':_0x292e68[_0xae67('0x13')],'app':_0xae67('0x1f'),'appdata':_0xae67('0x35'),'context':_0x292e68[_0xae67('0x14')],'exten':_0x292e68[_0xae67('0x8')],'priority':_0x4cb3ba['length']+_0x472dbd[_0xae67('0xe')]+_0x468514++,'VoiceExtensionId':_0x292e68[_0xae67('0x15')]});}}if(_0x292e68[_0xae67('0xd')]('answer')){if(_0x519098[_0xae67('0x36')](_0x292e68['app'][_0xae67('0x29')]())>=0x0&&_0x292e68[_0xae67('0x37')]!==_0xae67('0x38')){if(_0x292e68['answer']){_0x40d114[_0xae67('0x17')]({'type':_0x292e68['type'],'app':_0xae67('0x1f'),'appdata':_0xae67('0x39'),'context':_0x292e68[_0xae67('0x14')],'exten':_0x292e68['exten'],'priority':_0x4cb3ba[_0xae67('0x32')]+_0x472dbd[_0xae67('0xe')]+_0x468514++,'VoiceExtensionId':_0x292e68[_0xae67('0x15')]});_0x40d114[_0xae67('0x17')]({'type':_0x292e68['type'],'app':'Set','appdata':_0xae67('0x3a'),'context':_0x292e68[_0xae67('0x14')],'exten':_0x292e68['exten'],'priority':_0x4cb3ba[_0xae67('0x32')]+_0x472dbd[_0xae67('0xe')]+_0x468514++,'VoiceExtensionId':_0x292e68[_0xae67('0x15')]});}else{_0x40d114[_0xae67('0x17')]({'type':_0x292e68['type'],'app':_0xae67('0x1f'),'appdata':_0xae67('0x3b'),'context':_0x292e68[_0xae67('0x14')],'exten':_0x292e68['exten'],'priority':_0x4cb3ba[_0xae67('0x32')]+_0x472dbd[_0xae67('0xe')]+_0x468514++,'VoiceExtensionId':_0x292e68[_0xae67('0x15')]});_0x40d114[_0xae67('0x17')]({'type':_0x292e68['type'],'app':_0xae67('0x18'),'appdata':_0xae67('0x3c'),'context':_0x292e68['context'],'exten':_0x292e68[_0xae67('0x8')],'priority':_0x4cb3ba[_0xae67('0x32')]+_0x472dbd[_0xae67('0xe')]+_0x468514++,'VoiceExtensionId':_0x292e68[_0xae67('0x15')]});}}}for(var _0x18cb16=0x0;_0x18cb16<_0x4cb3ba[_0xae67('0x32')];_0x18cb16+=0x1){var _0x1c6ef4=_0x472dbd[_0xae67('0xe')]+_0x4cb3ba['length'];var _0x236920=_0x18cb16===_0x4cb3ba[_0xae67('0x32')]-0x1?_0x472dbd[_0xae67('0xe')]+_0x40d114[_0xae67('0x32')]+_0x266f2c[_0xae67('0x32')]+0x2:_0x472dbd[_0xae67('0xe')]+_0x18cb16+0x1;_0x40d114[_0xae67('0x3d')](_0x18cb16,0x0,{'type':_0x292e68['type'],'app':_0xae67('0x3e'),'appdata':_0x4cb3ba[_0x18cb16]+'?'+_0x292e68['context']+',${EXTEN},'+_0x1c6ef4+':'+_0x292e68[_0xae67('0x14')]+',${EXTEN},'+_0x236920,'exten':_0x292e68[_0xae67('0x8')],'context':_0x292e68['context'],'priority':_0x472dbd['priority']+_0x18cb16,'VoiceExtensionId':_0x1490be[_0x23ccdf][0x0][_0xae67('0x15')]});}_0x292e68[_0xae67('0xe')]=_0x40d114[_0xae67('0x32')]?_[_0xae67('0x3f')](_0x40d114)[_0xae67('0xe')]+0x1:_0x472dbd[_0xae67('0xe')];_0x472dbd[_0xae67('0xe')]=(_0x266f2c[_0xae67('0x32')]?_[_0xae67('0x3f')](_0x266f2c)[_0xae67('0xe')]:_0x292e68[_0xae67('0xe')])+0x1;_0x472dbd[_0xae67('0xf')]=_['concat'](_0x472dbd['extensions'],_0x40d114,[_0x292e68],_0x266f2c);}_0x472dbd[_0xae67('0xf')][_0xae67('0x17')]({'type':_0x1490be[_0x23ccdf][0x0][_0xae67('0x13')],'app':_0xae67('0x40'),'exten':_0x1490be[_0x23ccdf][0x0][_0xae67('0x8')],'context':_0x1490be[_0x23ccdf][0x0]['context'],'priority':_0x472dbd[_0xae67('0xe')],'VoiceExtensionId':_0x1490be[_0x23ccdf][0x0][_0xae67('0x15')]});_0x3e00ff['push'](_0x1490be[_0x23ccdf][0x0][_0xae67('0x15')]);_0x128d55=_[_0xae67('0x41')](_0x128d55,_0x472dbd[_0xae67('0xf')]);}}return _0x2de9ba[_0xae67('0x42')](function(_0x541eb5){return _0x2de9ba['models'][_0xae67('0x5')]['destroy']({'where':{'VoiceExtensionId':{'$in':_0x3e00ff}},'transaction':_0x541eb5})[_0xae67('0x3')](function(_0x22f12f){return _0x2de9ba['models'][_0xae67('0x5')][_0xae67('0x43')](_['sortBy'](_0x128d55,'priority'),{'transaction':_0x541eb5});});});})[_0xae67('0x44')](function(_0x45c5ae){console[_0xae67('0x45')](_0x45c5ae);});}exports[_0xae67('0x46')]=rewrite; \ No newline at end of file diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index 7efb5c3..2e1a391 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 _0xe983=['exit','SIGINT','createReadStream','parse','duplicate','pause','info','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','bluebird','util','squel','ioredis','../../../config/environment','../../../config/logger','api','defaults','redis','localhost','socket.io-emitter','../../../api/cmContact/cmContact.socket','register','argv','null','Missing\x20filepath\x20parameter!','undefined','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20ListId\x20parameter!','Missing\x20socket_timestamp\x20parameter!','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','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','email\x20format\x20is\x20not\x20valid!','length','find','Duplicate\x20Contact','CmContact','create','push','pick','catch','Error\x20while\x20creating\x20contact:\x20','stringify','cmContact','checkHopper','inspect','insert','into','cm_hopper','fromQuery','scheduledAt','ContactId','ListId','createdAt','updatedAt','field','NOW()','toString','from','where','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','select','\x20=\x20?','cm_contacts','id\x20IN\x20?','calleridnum','cm_hopper_final','str','cm_hopper_black','VoiceQueue','findAll','outbound','dialCheckDuplicateType','CmList','Lists','get','always','VoiceQueueId','onlyIfOpen','sequelize','query','then','all','BlackLists','Campaign','CampaignId','cmContact,\x20%s,\x20%s','Error\x20processing\x20rows\x20block:','finally','resolve','contact:csv_','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:'];(function(_0x1d840e,_0x127c07){var _0x24b4af=function(_0x4a5321){while(--_0x4a5321){_0x1d840e['push'](_0x1d840e['shift']());}};_0x24b4af(++_0x127c07);}(_0xe983,0x166));var _0x3e98=function(_0x2f6adb,_0x25b36c){_0x2f6adb=_0x2f6adb-0x0;var _0x362a0e=_0xe983[_0x2f6adb];return _0x362a0e;};'use strict';var BPromise=require(_0x3e98('0x0'));var util=require(_0x3e98('0x1'));var _=require('lodash');var fs=require('fs');var squel=require(_0x3e98('0x2'));var Papa=require('papaparse');var Redis=require(_0x3e98('0x3'));var db=require('../../../mysqldb')['db'];var config=require(_0x3e98('0x4'));var logger=require(_0x3e98('0x5'))(_0x3e98('0x6'));config['redis']=_[_0x3e98('0x7')](config[_0x3e98('0x8')],{'host':_0x3e98('0x9'),'port':0x18eb});var socket=require(_0x3e98('0xa'))(new Redis(config[_0x3e98('0x8')]));require(_0x3e98('0xb'))[_0x3e98('0xc')](socket);try{if(!process[_0x3e98('0xd')][0x2]||process['argv'][0x2]==='undefined'||process['argv'][0x2]===_0x3e98('0xe')){throw new Error(_0x3e98('0xf'));}var FILEPATH=process[_0x3e98('0xd')][0x2];if(!process[_0x3e98('0xd')][0x3]||process['argv'][0x3]===_0x3e98('0x10')||process[_0x3e98('0xd')][0x3]===_0x3e98('0xe')||!process[_0x3e98('0xd')][0x4]||process[_0x3e98('0xd')][0x4]===_0x3e98('0x10')||process[_0x3e98('0xd')][0x4]===_0x3e98('0xe')){throw new Error(_0x3e98('0x11'));}var FIELDS=_[_0x3e98('0x12')](process[_0x3e98('0xd')][0x3][_0x3e98('0x13')](','),process[_0x3e98('0xd')][0x4][_0x3e98('0x13')](','));if(!process[_0x3e98('0xd')][0x5]||process[_0x3e98('0xd')][0x5]===_0x3e98('0x10')||process[_0x3e98('0xd')][0x5]===_0x3e98('0xe')){throw new Error(_0x3e98('0x14'));}var LISTID=process[_0x3e98('0xd')][0x5];var COMPANYID=process['argv'][0x6]&&process[_0x3e98('0xd')][0x6]!=='undefined'&&process['argv'][0x6]!=='null'?process[_0x3e98('0xd')][0x6]:null;var DUPLICATES=process[_0x3e98('0xd')][0x7]&&process[_0x3e98('0xd')][0x7]!==_0x3e98('0x10')&&process['argv'][0x7]!==_0x3e98('0xe')?process[_0x3e98('0xd')][0x7]:null;if(!process['argv'][0x8]||process['argv'][0x8]===_0x3e98('0x10')||process[_0x3e98('0xd')][0x8]===_0x3e98('0xe')){throw new Error(_0x3e98('0x15'));}var SOCKET_TIMESTAMP=process['argv'][0x8];}catch(_0x39851e){logger['error'](_0x39851e);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(_0x53f982,_0xf257a4,_0x414612,_0x1d39a9){var _0x3e7aeb={'message':_0xf257a4};_0x3e7aeb[_0x53f982]=!![];if(_0x414612){_0x3e7aeb[_0x3e98('0x16')]=_0x414612;}if(_0x1d39a9){_0x3e7aeb[_0x3e98('0x17')]=_0x1d39a9;}return _0x3e7aeb;}function isEmail(_0x25811b){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))*$/[_0x3e98('0x18')](_0x25811b);}function checkRow(_0xe75495,_0x1aef67,_0x4eed3f){return new BPromise(function(_0x32ad87,_0x1fbba0){if(_[_0x3e98('0x19')](_0xe75495)){return _0x1fbba0(handleCheckRowError(_0x3e98('0x1a'),_0x3e98('0x1b'),null,_0x4eed3f));}if(_0xe75495[_0x3e98('0x1c')]&&_0xe75495[_0x3e98('0x1c')]['length']){var _0x3c4881=_[_0x3e98('0x1d')](_0xe75495[_0x3e98('0x1c')],_0x3e98('0x1e'))[_0x3e98('0x1f')](';');return _0x1fbba0(handleCheckRowError(_0x3e98('0x1a'),_0x3c4881,null,_0x4eed3f));}var _0x3ced2b={};for(var _0x509019 in FIELDS){if(FIELDS[_0x3e98('0x20')](_0x509019)&&FIELDS[_0x509019]){_0x3ced2b[_0x509019]=_0xe75495[_0x3e98('0x21')][0x0][FIELDS[_0x509019]]||_0xe75495[_0x3e98('0x21')][0x0]['\ufeff'+FIELDS[_0x509019]];}}if(!_0x3ced2b[_0x3e98('0x22')]){return _0x1fbba0(handleCheckRowError(_0x3e98('0x1a'),_0x3e98('0x23'),null,_0x4eed3f));}if(!_0x3ced2b[_0x3e98('0x24')]){return _0x1fbba0(handleCheckRowError(_0x3e98('0x1a'),_0x3e98('0x25'),null,_0x4eed3f));}if(_0x3ced2b[_0x3e98('0x26')]){var _0x3391b5=moment(_0x3ced2b[_0x3e98('0x26')],'YYYY-MM-DD');if(!_0x3391b5[_0x3e98('0x27')]()){return _0x1fbba0(handleCheckRowError('error',_0x3e98('0x28'),null,_0x4eed3f));}}if(_0x3ced2b['email']){if(!isEmail(_0x3ced2b[_0x3e98('0x29')])){return _0x1fbba0(handleCheckRowError(_0x3e98('0x1a'),_0x3e98('0x2a'),null,_0x4eed3f));}}_0x3ced2b['ListId']=LISTID;_0x3ced2b['CompanyId']=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x3e98('0x2b')]&&_0x1aef67){var _0x2097f4={};for(var _0x47ae22=0x0,_0x53abaf=DUPLICATES['length'];_0x47ae22<_0x53abaf;_0x47ae22+=0x1){_0x2097f4[DUPLICATES[_0x47ae22]]=_0x3ced2b[DUPLICATES[_0x47ae22]];}var _0xfd6c2d=_[_0x3e98('0x2c')](_0x1aef67,_0x2097f4);if(_0xfd6c2d){return _0x1fbba0(handleCheckRowError('duplicate',_0x3e98('0x2d'),_0xfd6c2d,_0x4eed3f));}}return db[_0x3e98('0x2e')][_0x3e98('0x2f')](_0x3ced2b,{'raw':!![],'hooks':![],'fields':_['keys'](_0x3ced2b)})['then'](function(_0x2208de){if(DUPLICATES&&DUPLICATES[_0x3e98('0x2b')]&&_0x1aef67){_0x1aef67[_0x3e98('0x30')](_[_0x3e98('0x31')](_0x3ced2b,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x2208de['id'];return _0x32ad87();})[_0x3e98('0x32')](function(_0x1e50c7){return _0x1fbba0(handleCheckRowError(_0x3e98('0x1a'),_0x3e98('0x33')+(_0x1e50c7['message']||JSON[_0x3e98('0x34')](_0x1e50c7)),null,_0x4eed3f));});});}function checkHopper(){function _0x289d2e(){return function(_0x404c23){logger[_0x3e98('0x1a')](_0x3e98('0x35'),_0x3e98('0x36'),util[_0x3e98('0x37')](_0x404c23,{'showHidden':![],'depth':null}));};}var _0x39cff5=function(_0x27c167,_0x1e7c74){var _0x2081ff=squel[_0x3e98('0x38')]()[_0x3e98('0x39')](_0x3e98('0x3a'))[_0x3e98('0x3b')](['phone',_0x3e98('0x3c'),_0x3e98('0x3d'),_0x3e98('0x3e'),_0x1e7c74,_0x3e98('0x3f'),_0x3e98('0x40')],squel['select']()[_0x3e98('0x41')](_0x3e98('0x24'),_0x3e98('0x24'))[_0x3e98('0x41')](_0x3e98('0x42'),'scheduledAt')[_0x3e98('0x41')]('id',_0x3e98('0x3d'))[_0x3e98('0x41')](LISTID[_0x3e98('0x43')](),_0x3e98('0x3e'))[_0x3e98('0x41')](_0x27c167['id'][_0x3e98('0x43')](),_0x1e7c74)[_0x3e98('0x41')](_0x3e98('0x42'),_0x3e98('0x3f'))[_0x3e98('0x41')](_0x3e98('0x42'),_0x3e98('0x40'))[_0x3e98('0x44')]('cm_contacts')[_0x3e98('0x45')](_0x3e98('0x46'))[_0x3e98('0x45')](_0x3e98('0x47'),LISTID[_0x3e98('0x43')]())['where'](_0x3e98('0x48'))['where'](_0x3e98('0x49'),squel[_0x3e98('0x4a')]()[_0x3e98('0x41')](_0x3e98('0x24'))[_0x3e98('0x44')](_0x3e98('0x3a'))['where'](_0x1e7c74+_0x3e98('0x4b'),_0x27c167['id'][_0x3e98('0x43')]())))['toString']();return _0x2081ff;};var _0x1d071d=function(_0x52689d,_0x2b802e){var _0x4936ae=squel['insert']()['into'](_0x3e98('0x3a'))[_0x3e98('0x3b')]([_0x3e98('0x24'),_0x3e98('0x3c'),_0x3e98('0x3d'),_0x3e98('0x3e'),_0x2b802e,'createdAt',_0x3e98('0x40')],squel[_0x3e98('0x4a')]()[_0x3e98('0x41')](_0x3e98('0x24'),'phone')[_0x3e98('0x41')]('NOW()',_0x3e98('0x3c'))[_0x3e98('0x41')]('id',_0x3e98('0x3d'))[_0x3e98('0x41')](LISTID[_0x3e98('0x43')](),_0x3e98('0x3e'))[_0x3e98('0x41')](_0x52689d['id']['toString'](),_0x2b802e)[_0x3e98('0x41')](_0x3e98('0x42'),'createdAt')[_0x3e98('0x41')](_0x3e98('0x42'),_0x3e98('0x40'))[_0x3e98('0x44')](_0x3e98('0x4c'))[_0x3e98('0x45')](_0x3e98('0x46'))[_0x3e98('0x45')]('ListId\x20=\x20?',LISTID[_0x3e98('0x43')]())[_0x3e98('0x45')](_0x3e98('0x4d'),squel['str'](hopperContacts))[_0x3e98('0x45')](_0x3e98('0x48'))[_0x3e98('0x45')]('phone\x20NOT\x20IN\x20(?)',squel[_0x3e98('0x4a')]()[_0x3e98('0x41')](_0x3e98('0x4e'))[_0x3e98('0x44')](_0x3e98('0x4f'))['where'](_0x2b802e+_0x3e98('0x4b'),_0x52689d['id'][_0x3e98('0x43')]()))['where'](_0x3e98('0x49'),squel[_0x3e98('0x4a')]()[_0x3e98('0x41')]('phone')[_0x3e98('0x44')](_0x3e98('0x3a'))[_0x3e98('0x45')](_0x2b802e+'\x20=\x20?',_0x52689d['id'][_0x3e98('0x43')]())))[_0x3e98('0x43')]();return _0x4936ae;};function _0x19792d(_0x45ea3f,_0x4b2799){var _0x1d34a6=squel[_0x3e98('0x38')]()['into']('cm_hopper')[_0x3e98('0x3b')]([_0x3e98('0x24'),_0x3e98('0x3c'),_0x3e98('0x3d'),'ListId',_0x4b2799,'createdAt',_0x3e98('0x40')],squel[_0x3e98('0x4a')]()[_0x3e98('0x41')](_0x3e98('0x24'),_0x3e98('0x24'))[_0x3e98('0x41')](_0x3e98('0x42'),'scheduledAt')[_0x3e98('0x41')]('id','ContactId')[_0x3e98('0x41')](LISTID['toString'](),_0x3e98('0x3e'))['field'](_0x45ea3f['id'][_0x3e98('0x43')](),_0x4b2799)['field'](_0x3e98('0x42'),_0x3e98('0x3f'))[_0x3e98('0x41')](_0x3e98('0x42'),'updatedAt')['from']('cm_contacts')[_0x3e98('0x45')](_0x3e98('0x46'))[_0x3e98('0x45')](_0x3e98('0x47'),LISTID[_0x3e98('0x43')]())['where'](_0x3e98('0x4d'),squel[_0x3e98('0x50')](hopperContacts))[_0x3e98('0x45')](_0x3e98('0x48')))['toString']();return _0x1d34a6;}function _0x448dfc(_0x39ab89,_0x2778be){var _0x11fa5b=squel[_0x3e98('0x38')]()['into'](_0x3e98('0x51'))['fromQuery']([_0x3e98('0x24'),'ContactId',_0x3e98('0x3e'),_0x2778be,_0x3e98('0x3f'),_0x3e98('0x40')],squel[_0x3e98('0x4a')]()[_0x3e98('0x41')](_0x3e98('0x24'),_0x3e98('0x24'))['field']('id','ContactId')[_0x3e98('0x41')](LISTID[_0x3e98('0x43')](),_0x3e98('0x3e'))['field'](_0x39ab89['id'][_0x3e98('0x43')](),_0x2778be)[_0x3e98('0x41')]('NOW()',_0x3e98('0x3f'))[_0x3e98('0x41')](_0x3e98('0x42'),_0x3e98('0x40'))['from'](_0x3e98('0x4c'))[_0x3e98('0x45')](_0x3e98('0x46'))[_0x3e98('0x45')](_0x3e98('0x47'),LISTID[_0x3e98('0x43')]())[_0x3e98('0x45')](_0x3e98('0x4d'),squel[_0x3e98('0x50')](hopperContacts))[_0x3e98('0x45')](_0x3e98('0x48')))[_0x3e98('0x43')]();return _0x11fa5b;}return db[_0x3e98('0x52')][_0x3e98('0x53')]({'where':{'type':_0x3e98('0x54')},'attributes':['id',_0x3e98('0x55')],'include':[{'model':db[_0x3e98('0x56')],'as':_0x3e98('0x57'),'where':{'id':LISTID}}]})['then'](function(_0xdebda0){var _0x196acc=[];if(_0xdebda0){var _0x2041e6;for(var _0x3cdd83=0x0,_0x8e0059;_0x3cdd83<_0xdebda0[_0x3e98('0x2b')];_0x3cdd83+=0x1){_0x8e0059=_0xdebda0[_0x3cdd83][_0x3e98('0x58')]({'plain':!![]});switch(_0x8e0059[_0x3e98('0x55')]){case _0x3e98('0x59'):_0x196acc[_0x3e98('0x30')](db['sequelize']['query'](_0x1d071d(_0x8e0059,_0x3e98('0x5a')))['then'](function(){})[_0x3e98('0x32')](_0x289d2e()));break;case _0x3e98('0x5b'):_0x196acc['push'](db[_0x3e98('0x5c')][_0x3e98('0x5d')](_0x39cff5(_0x8e0059,_0x3e98('0x5a')))[_0x3e98('0x5e')](function(){})[_0x3e98('0x32')](_0x289d2e()));break;default:_0x196acc[_0x3e98('0x30')](db[_0x3e98('0x5c')][_0x3e98('0x5d')](_0x19792d(_0x8e0059,_0x3e98('0x5a')))[_0x3e98('0x5e')](function(){})['catch'](_0x289d2e()));}}}return _0x196acc;})[_0x3e98('0x5f')]()[_0x3e98('0x5e')](function(){return db[_0x3e98('0x52')]['findAll']({'where':{'type':_0x3e98('0x54')},'attributes':['id'],'include':[{'model':db[_0x3e98('0x56')],'as':_0x3e98('0x60'),'where':{'id':LISTID}}]})[_0x3e98('0x5e')](function(_0x24d83e){var _0xffb009=[];if(_0x24d83e){var _0x1bfbc4;for(var _0x645f33=0x0,_0x3e2619;_0x645f33<_0x24d83e['length'];_0x645f33+=0x1){_0x3e2619=_0x24d83e[_0x645f33][_0x3e98('0x58')]({'plain':!![]});_0xffb009[_0x3e98('0x30')](db[_0x3e98('0x5c')][_0x3e98('0x5d')](_0x448dfc(_0x3e2619,_0x3e98('0x5a')))[_0x3e98('0x5e')](function(){})[_0x3e98('0x32')](_0x289d2e()));}}return _0xffb009;})[_0x3e98('0x5f')]();})[_0x3e98('0x5e')](function(){return db[_0x3e98('0x61')][_0x3e98('0x53')]({'attributes':['id',_0x3e98('0x55')],'include':[{'model':db[_0x3e98('0x56')],'as':_0x3e98('0x57'),'where':{'id':LISTID}}]})[_0x3e98('0x5e')](function(_0x947608){var _0x3e48b9=[];if(_0x947608){for(var _0x3ebe99=0x0,_0x445e2c;_0x3ebe99<_0x947608[_0x3e98('0x2b')];_0x3ebe99+=0x1){_0x445e2c=_0x947608[_0x3ebe99][_0x3e98('0x58')]({'plain':!![]});switch(_0x445e2c[_0x3e98('0x55')]){case'always':_0x3e48b9[_0x3e98('0x30')](db[_0x3e98('0x5c')][_0x3e98('0x5d')](_0x1d071d(_0x445e2c,_0x3e98('0x62')))['then'](function(){})['catch'](_0x289d2e()));break;case _0x3e98('0x5b'):_0x3e48b9[_0x3e98('0x30')](db['sequelize'][_0x3e98('0x5d')](_0x39cff5(_0x445e2c,_0x3e98('0x62')))[_0x3e98('0x5e')](function(){})[_0x3e98('0x32')](_0x289d2e()));break;default:_0x3e48b9['push'](db[_0x3e98('0x5c')][_0x3e98('0x5d')](_0x19792d(_0x445e2c,_0x3e98('0x62')))['then'](function(){})[_0x3e98('0x32')](_0x289d2e()));}}}return _0x3e48b9;})[_0x3e98('0x5f')]();})[_0x3e98('0x5e')](function(){return db[_0x3e98('0x61')][_0x3e98('0x53')]({'attributes':['id'],'include':[{'model':db[_0x3e98('0x56')],'as':_0x3e98('0x60'),'where':{'id':LISTID}}]})[_0x3e98('0x5e')](function(_0x3a4cfe){var _0x25e1e9=[];if(_0x3a4cfe){for(var _0x222933=0x0,_0x3eee01;_0x222933<_0x3a4cfe[_0x3e98('0x2b')];_0x222933+=0x1){_0x3eee01=_0x3a4cfe[_0x222933]['get']({'plain':!![]});_0x25e1e9['push'](db[_0x3e98('0x5c')]['query'](_0x448dfc(_0x3eee01,_0x3e98('0x62')))['then'](function(){})['catch'](_0x289d2e()));}}return _0x25e1e9;})[_0x3e98('0x5f')]();})[_0x3e98('0x32')](function(_0x24399e){logger['error'](_0x3e98('0x63'),'generalCheckHopper',_0x24399e[_0x3e98('0x1e')]);});}var processPromises=function(_0x10404d){return BPromise['all'](promises)[_0x3e98('0x5e')](function(_0x527fa7){})['catch'](function(_0x1648a9){logger[_0x3e98('0x1a')](_0x3e98('0x64'),JSON['stringify'](_0x1648a9));})[_0x3e98('0x65')](function(){socket['emit']('contact:csv_'+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x10404d){return _0x10404d['resume']();}});};var endCsv=function(){return BPromise[_0x3e98('0x66')]()['then'](function(){if(hopperContacts){return checkHopper();}})[_0x3e98('0x5e')](function(){socket['emit'](_0x3e98('0x67')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x3e98('0x68')](FILEPATH);}catch(_0xdcc71f){logger[_0x3e98('0x1a')](_0x3e98('0x69'),JSON['stringify'](_0xdcc71f));}finally{process[_0x3e98('0x6a')](0x0);}});};process['on'](_0x3e98('0x6b'),function(){logger['info']('CSV\x20import\x20process\x20stopped!');endCsv();});function main(){return BPromise[_0x3e98('0x66')]()['then'](function(){if(DUPLICATES){DUPLICATES=DUPLICATES['split'](',');return db['CmContact']['findAll']({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})['then'](function(_0x19c2a0){var _0xef3de6=fs[_0x3e98('0x6c')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x3e98('0x6d')](_0xef3de6,{'header':!![],'skipEmptyLines':!![],'step':function(_0x56a761,_0xe64a28){total+=0x1;var _0x70f4cb=total;promises[_0x3e98('0x30')](checkRow(_0x56a761,_0x19c2a0,_0x70f4cb)[_0x3e98('0x5e')](function(){success+=0x1;})[_0x3e98('0x32')](function(_0x555d3d){if(_0x555d3d[_0x3e98('0x1a')]){errors+=0x1;delete _0x555d3d[_0x3e98('0x1a')];}else if(_0x555d3d[_0x3e98('0x6e')]){duplicates+=0x1;delete _0x555d3d['duplicate'];}rows['push'](_0x555d3d);}));if(total%0xc8===0x0){_0xe64a28[_0x3e98('0x6f')]();return processPromises(_0xe64a28);}},'complete':function(){return processPromises()[_0x3e98('0x5e')](function(){logger[_0x3e98('0x70')](_0x3e98('0x71'));endCsv();});},'error':function(_0x14e8ac,_0xedb5a2){logger[_0x3e98('0x70')](_0x3e98('0x72'),JSON[_0x3e98('0x34')](_0x14e8ac));endCsv();}});})[_0x3e98('0x32')](function(_0xdf3e1f){logger[_0x3e98('0x1a')](_0x3e98('0x73'),JSON[_0x3e98('0x34')](_0xdf3e1f));});}main(); \ No newline at end of file +var _0x4b01=['cm_hopper_final','\x20=\x20?','cm_hopper_black','VoiceQueue','findAll','outbound','dialCheckDuplicateType','Lists','get','always','query','onlyIfOpen','sequelize','VoiceQueueId','all','CmList','BlackLists','Campaign','CampaignId','cmContact,\x20%s,\x20%s','generalCheckHopper','stringify','finally','contact:csv_','resolve','emit','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','exit','SIGINT','info','createReadStream','parse','pause','CSV\x20parsed\x20correctly!','bluebird','util','lodash','squel','papaparse','ioredis','../../../config/environment','../../../config/logger','api','redis','localhost','socket.io-emitter','../../../api/cmContact/cmContact.socket','argv','undefined','null','Missing\x20binding\x20parameters!','split','Missing\x20ListId\x20parameter!','error','index','test','isNil','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length','map','message','join','hasOwnProperty','data','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!','CompanyId','find','duplicate','Duplicate\x20Contact','CmContact','keys','then','push','pick','catch','Error\x20while\x20creating\x20contact:\x20','checkHopper','inspect','insert','into','cm_hopper','scheduledAt','ContactId','ListId','createdAt','updatedAt','select','field','NOW()','toString','cm_contacts','where','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','from','fromQuery','id\x20IN\x20?','str','phone\x20NOT\x20IN\x20(?)','calleridnum'];(function(_0x4a1c1b,_0x2a6026){var _0x48792f=function(_0x5bf17c){while(--_0x5bf17c){_0x4a1c1b['push'](_0x4a1c1b['shift']());}};_0x48792f(++_0x2a6026);}(_0x4b01,0xff));var _0x14b0=function(_0x9a5b30,_0x4fede2){_0x9a5b30=_0x9a5b30-0x0;var _0x9f7c7d=_0x4b01[_0x9a5b30];return _0x9f7c7d;};'use strict';var BPromise=require(_0x14b0('0x0'));var util=require(_0x14b0('0x1'));var _=require(_0x14b0('0x2'));var fs=require('fs');var squel=require(_0x14b0('0x3'));var Papa=require(_0x14b0('0x4'));var Redis=require(_0x14b0('0x5'));var db=require('../../../mysqldb')['db'];var config=require(_0x14b0('0x6'));var logger=require(_0x14b0('0x7'))(_0x14b0('0x8'));config[_0x14b0('0x9')]=_['defaults'](config[_0x14b0('0x9')],{'host':_0x14b0('0xa'),'port':0x18eb});var socket=require(_0x14b0('0xb'))(new Redis(config['redis']));require(_0x14b0('0xc'))['register'](socket);try{if(!process[_0x14b0('0xd')][0x2]||process[_0x14b0('0xd')][0x2]===_0x14b0('0xe')||process['argv'][0x2]===_0x14b0('0xf')){throw new Error('Missing\x20filepath\x20parameter!');}var FILEPATH=process[_0x14b0('0xd')][0x2];if(!process[_0x14b0('0xd')][0x3]||process[_0x14b0('0xd')][0x3]===_0x14b0('0xe')||process[_0x14b0('0xd')][0x3]==='null'||!process[_0x14b0('0xd')][0x4]||process['argv'][0x4]===_0x14b0('0xe')||process[_0x14b0('0xd')][0x4]===_0x14b0('0xf')){throw new Error(_0x14b0('0x10'));}var FIELDS=_['zipObject'](process[_0x14b0('0xd')][0x3][_0x14b0('0x11')](','),process['argv'][0x4][_0x14b0('0x11')](','));if(!process[_0x14b0('0xd')][0x5]||process[_0x14b0('0xd')][0x5]===_0x14b0('0xe')||process[_0x14b0('0xd')][0x5]===_0x14b0('0xf')){throw new Error(_0x14b0('0x12'));}var LISTID=process[_0x14b0('0xd')][0x5];var COMPANYID=process[_0x14b0('0xd')][0x6]&&process[_0x14b0('0xd')][0x6]!==_0x14b0('0xe')&&process['argv'][0x6]!==_0x14b0('0xf')?process[_0x14b0('0xd')][0x6]:null;var DUPLICATES=process[_0x14b0('0xd')][0x7]&&process[_0x14b0('0xd')][0x7]!=='undefined'&&process['argv'][0x7]!==_0x14b0('0xf')?process[_0x14b0('0xd')][0x7]:null;if(!process['argv'][0x8]||process[_0x14b0('0xd')][0x8]==='undefined'||process['argv'][0x8]===_0x14b0('0xf')){throw new Error('Missing\x20socket_timestamp\x20parameter!');}var SOCKET_TIMESTAMP=process[_0x14b0('0xd')][0x8];}catch(_0x39a821){logger[_0x14b0('0x13')](_0x39a821);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(_0x44407b,_0x26d925,_0x8a384,_0x732883){var _0x321a3e={'message':_0x26d925};_0x321a3e[_0x44407b]=!![];if(_0x8a384){_0x321a3e['contact']=_0x8a384;}if(_0x732883){_0x321a3e[_0x14b0('0x14')]=_0x732883;}return _0x321a3e;}function isEmail(_0x10b3f9){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))*$/[_0x14b0('0x15')](_0x10b3f9);}function checkRow(_0x546f07,_0x4aaaa3,_0x1c42fe){return new BPromise(function(_0x268cf4,_0x34f7bd){if(_[_0x14b0('0x16')](_0x546f07)){return _0x34f7bd(handleCheckRowError(_0x14b0('0x13'),_0x14b0('0x17'),null,_0x1c42fe));}if(_0x546f07[_0x14b0('0x18')]&&_0x546f07[_0x14b0('0x18')][_0x14b0('0x19')]){var _0x13468c=_[_0x14b0('0x1a')](_0x546f07[_0x14b0('0x18')],_0x14b0('0x1b'))[_0x14b0('0x1c')](';');return _0x34f7bd(handleCheckRowError(_0x14b0('0x13'),_0x13468c,null,_0x1c42fe));}var _0x33d8a3={};for(var _0x27f821 in FIELDS){if(FIELDS[_0x14b0('0x1d')](_0x27f821)&&FIELDS[_0x27f821]){_0x33d8a3[_0x27f821]=_0x546f07[_0x14b0('0x1e')][0x0][FIELDS[_0x27f821]]||_0x546f07[_0x14b0('0x1e')][0x0]['\ufeff'+FIELDS[_0x27f821]];}}if(!_0x33d8a3['firstName']){return _0x34f7bd(handleCheckRowError(_0x14b0('0x13'),'firstName\x20not\x20specified!',null,_0x1c42fe));}if(!_0x33d8a3[_0x14b0('0x1f')]){return _0x34f7bd(handleCheckRowError('error',_0x14b0('0x20'),null,_0x1c42fe));}if(_0x33d8a3[_0x14b0('0x21')]){var _0x45adfb=moment(_0x33d8a3[_0x14b0('0x21')],_0x14b0('0x22'));if(!_0x45adfb[_0x14b0('0x23')]()){return _0x34f7bd(handleCheckRowError('error',_0x14b0('0x24'),null,_0x1c42fe));}}if(_0x33d8a3['email']){if(!isEmail(_0x33d8a3[_0x14b0('0x25')])){return _0x34f7bd(handleCheckRowError(_0x14b0('0x13'),_0x14b0('0x26'),null,_0x1c42fe));}}_0x33d8a3['ListId']=LISTID;_0x33d8a3[_0x14b0('0x27')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES['length']&&_0x4aaaa3){var _0x270254={};for(var _0xa7407d=0x0,_0x430cbf=DUPLICATES[_0x14b0('0x19')];_0xa7407d<_0x430cbf;_0xa7407d+=0x1){_0x270254[DUPLICATES[_0xa7407d]]=_0x33d8a3[DUPLICATES[_0xa7407d]];}var _0x3779d8=_[_0x14b0('0x28')](_0x4aaaa3,_0x270254);if(_0x3779d8){return _0x34f7bd(handleCheckRowError(_0x14b0('0x29'),_0x14b0('0x2a'),_0x3779d8,_0x1c42fe));}}return db[_0x14b0('0x2b')]['create'](_0x33d8a3,{'raw':!![],'hooks':![],'fields':_[_0x14b0('0x2c')](_0x33d8a3)})[_0x14b0('0x2d')](function(_0xdef904){if(DUPLICATES&&DUPLICATES[_0x14b0('0x19')]&&_0x4aaaa3){_0x4aaaa3[_0x14b0('0x2e')](_[_0x14b0('0x2f')](_0x33d8a3,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0xdef904['id'];return _0x268cf4();})[_0x14b0('0x30')](function(_0x592a60){return _0x34f7bd(handleCheckRowError(_0x14b0('0x13'),_0x14b0('0x31')+(_0x592a60[_0x14b0('0x1b')]||JSON['stringify'](_0x592a60)),null,_0x1c42fe));});});}function checkHopper(){function _0x535395(){return function(_0x2295a7){logger['error']('cmContact',_0x14b0('0x32'),util[_0x14b0('0x33')](_0x2295a7,{'showHidden':![],'depth':null}));};}var _0x4e1066=function(_0x2cade0,_0x48b1dd){var _0x46fb06=squel[_0x14b0('0x34')]()[_0x14b0('0x35')](_0x14b0('0x36'))['fromQuery']([_0x14b0('0x1f'),_0x14b0('0x37'),_0x14b0('0x38'),_0x14b0('0x39'),_0x48b1dd,_0x14b0('0x3a'),_0x14b0('0x3b')],squel[_0x14b0('0x3c')]()[_0x14b0('0x3d')](_0x14b0('0x1f'),_0x14b0('0x1f'))[_0x14b0('0x3d')](_0x14b0('0x3e'),_0x14b0('0x37'))[_0x14b0('0x3d')]('id',_0x14b0('0x38'))[_0x14b0('0x3d')](LISTID[_0x14b0('0x3f')](),_0x14b0('0x39'))[_0x14b0('0x3d')](_0x2cade0['id'][_0x14b0('0x3f')](),_0x48b1dd)['field'](_0x14b0('0x3e'),'createdAt')[_0x14b0('0x3d')]('NOW()','updatedAt')['from'](_0x14b0('0x40'))[_0x14b0('0x41')](_0x14b0('0x42'))['where'](_0x14b0('0x43'),LISTID[_0x14b0('0x3f')]())[_0x14b0('0x41')](_0x14b0('0x44'))[_0x14b0('0x41')]('phone\x20NOT\x20IN\x20(?)',squel[_0x14b0('0x3c')]()[_0x14b0('0x3d')]('phone')[_0x14b0('0x45')]('cm_hopper')[_0x14b0('0x41')](_0x48b1dd+'\x20=\x20?',_0x2cade0['id'][_0x14b0('0x3f')]())))[_0x14b0('0x3f')]();return _0x46fb06;};var _0x156ead=function(_0x48cd50,_0x4dcac7){var _0x35f1c3=squel[_0x14b0('0x34')]()['into'](_0x14b0('0x36'))[_0x14b0('0x46')]([_0x14b0('0x1f'),_0x14b0('0x37'),_0x14b0('0x38'),_0x14b0('0x39'),_0x4dcac7,'createdAt',_0x14b0('0x3b')],squel['select']()[_0x14b0('0x3d')](_0x14b0('0x1f'),'phone')[_0x14b0('0x3d')]('NOW()',_0x14b0('0x37'))[_0x14b0('0x3d')]('id',_0x14b0('0x38'))['field'](LISTID[_0x14b0('0x3f')](),_0x14b0('0x39'))['field'](_0x48cd50['id']['toString'](),_0x4dcac7)[_0x14b0('0x3d')](_0x14b0('0x3e'),_0x14b0('0x3a'))[_0x14b0('0x3d')]('NOW()',_0x14b0('0x3b'))[_0x14b0('0x45')]('cm_contacts')['where']('deletedAt\x20IS\x20NULL')[_0x14b0('0x41')]('ListId\x20=\x20?',LISTID['toString']())['where'](_0x14b0('0x47'),squel[_0x14b0('0x48')](hopperContacts))['where'](_0x14b0('0x44'))['where'](_0x14b0('0x49'),squel[_0x14b0('0x3c')]()['field'](_0x14b0('0x4a'))[_0x14b0('0x45')](_0x14b0('0x4b'))[_0x14b0('0x41')](_0x4dcac7+'\x20=\x20?',_0x48cd50['id']['toString']()))[_0x14b0('0x41')]('phone\x20NOT\x20IN\x20(?)',squel[_0x14b0('0x3c')]()[_0x14b0('0x3d')](_0x14b0('0x1f'))[_0x14b0('0x45')](_0x14b0('0x36'))['where'](_0x4dcac7+_0x14b0('0x4c'),_0x48cd50['id'][_0x14b0('0x3f')]())))[_0x14b0('0x3f')]();return _0x35f1c3;};function _0x6c582b(_0x315d8a,_0x5e13a8){var _0x4f5d21=squel['insert']()[_0x14b0('0x35')]('cm_hopper')[_0x14b0('0x46')]([_0x14b0('0x1f'),_0x14b0('0x37'),'ContactId',_0x14b0('0x39'),_0x5e13a8,'createdAt',_0x14b0('0x3b')],squel[_0x14b0('0x3c')]()[_0x14b0('0x3d')](_0x14b0('0x1f'),'phone')[_0x14b0('0x3d')](_0x14b0('0x3e'),_0x14b0('0x37'))[_0x14b0('0x3d')]('id',_0x14b0('0x38'))[_0x14b0('0x3d')](LISTID[_0x14b0('0x3f')](),_0x14b0('0x39'))['field'](_0x315d8a['id'][_0x14b0('0x3f')](),_0x5e13a8)[_0x14b0('0x3d')](_0x14b0('0x3e'),_0x14b0('0x3a'))['field'](_0x14b0('0x3e'),_0x14b0('0x3b'))[_0x14b0('0x45')]('cm_contacts')[_0x14b0('0x41')](_0x14b0('0x42'))[_0x14b0('0x41')]('ListId\x20=\x20?',LISTID[_0x14b0('0x3f')]())['where'](_0x14b0('0x47'),squel['str'](hopperContacts))[_0x14b0('0x41')](_0x14b0('0x44')))[_0x14b0('0x3f')]();return _0x4f5d21;}function _0x146498(_0x3d75f9,_0x488798){var _0x5f87a3=squel[_0x14b0('0x34')]()[_0x14b0('0x35')](_0x14b0('0x4d'))[_0x14b0('0x46')]([_0x14b0('0x1f'),_0x14b0('0x38'),_0x14b0('0x39'),_0x488798,_0x14b0('0x3a'),_0x14b0('0x3b')],squel['select']()['field'](_0x14b0('0x1f'),_0x14b0('0x1f'))[_0x14b0('0x3d')]('id',_0x14b0('0x38'))[_0x14b0('0x3d')](LISTID[_0x14b0('0x3f')](),_0x14b0('0x39'))['field'](_0x3d75f9['id'][_0x14b0('0x3f')](),_0x488798)[_0x14b0('0x3d')]('NOW()',_0x14b0('0x3a'))[_0x14b0('0x3d')](_0x14b0('0x3e'),_0x14b0('0x3b'))[_0x14b0('0x45')](_0x14b0('0x40'))['where'](_0x14b0('0x42'))['where'](_0x14b0('0x43'),LISTID['toString']())[_0x14b0('0x41')](_0x14b0('0x47'),squel[_0x14b0('0x48')](hopperContacts))[_0x14b0('0x41')](_0x14b0('0x44')))[_0x14b0('0x3f')]();return _0x5f87a3;}return db[_0x14b0('0x4e')][_0x14b0('0x4f')]({'where':{'type':_0x14b0('0x50')},'attributes':['id',_0x14b0('0x51')],'include':[{'model':db['CmList'],'as':_0x14b0('0x52'),'where':{'id':LISTID}}]})[_0x14b0('0x2d')](function(_0x22301a){var _0x2e48b9=[];if(_0x22301a){var _0x50bde0;for(var _0x2b47ef=0x0,_0x3763fc;_0x2b47ef<_0x22301a['length'];_0x2b47ef+=0x1){_0x3763fc=_0x22301a[_0x2b47ef][_0x14b0('0x53')]({'plain':!![]});switch(_0x3763fc[_0x14b0('0x51')]){case _0x14b0('0x54'):_0x2e48b9['push'](db['sequelize'][_0x14b0('0x55')](_0x156ead(_0x3763fc,'VoiceQueueId'))[_0x14b0('0x2d')](function(){})['catch'](_0x535395()));break;case _0x14b0('0x56'):_0x2e48b9[_0x14b0('0x2e')](db[_0x14b0('0x57')][_0x14b0('0x55')](_0x4e1066(_0x3763fc,'VoiceQueueId'))['then'](function(){})[_0x14b0('0x30')](_0x535395()));break;default:_0x2e48b9[_0x14b0('0x2e')](db[_0x14b0('0x57')][_0x14b0('0x55')](_0x6c582b(_0x3763fc,_0x14b0('0x58')))['then'](function(){})[_0x14b0('0x30')](_0x535395()));}}}return _0x2e48b9;})[_0x14b0('0x59')]()[_0x14b0('0x2d')](function(){return db[_0x14b0('0x4e')]['findAll']({'where':{'type':_0x14b0('0x50')},'attributes':['id'],'include':[{'model':db[_0x14b0('0x5a')],'as':_0x14b0('0x5b'),'where':{'id':LISTID}}]})[_0x14b0('0x2d')](function(_0xc941b3){var _0x343b93=[];if(_0xc941b3){var _0x4ba11f;for(var _0x177130=0x0,_0x11349a;_0x177130<_0xc941b3[_0x14b0('0x19')];_0x177130+=0x1){_0x11349a=_0xc941b3[_0x177130][_0x14b0('0x53')]({'plain':!![]});_0x343b93[_0x14b0('0x2e')](db[_0x14b0('0x57')][_0x14b0('0x55')](_0x146498(_0x11349a,_0x14b0('0x58')))['then'](function(){})[_0x14b0('0x30')](_0x535395()));}}return _0x343b93;})[_0x14b0('0x59')]();})['then'](function(){return db[_0x14b0('0x5c')][_0x14b0('0x4f')]({'attributes':['id',_0x14b0('0x51')],'include':[{'model':db['CmList'],'as':_0x14b0('0x52'),'where':{'id':LISTID}}]})[_0x14b0('0x2d')](function(_0x48af6c){var _0x178853=[];if(_0x48af6c){for(var _0x44615d=0x0,_0x100b07;_0x44615d<_0x48af6c[_0x14b0('0x19')];_0x44615d+=0x1){_0x100b07=_0x48af6c[_0x44615d][_0x14b0('0x53')]({'plain':!![]});switch(_0x100b07[_0x14b0('0x51')]){case _0x14b0('0x54'):_0x178853[_0x14b0('0x2e')](db[_0x14b0('0x57')][_0x14b0('0x55')](_0x156ead(_0x100b07,_0x14b0('0x5d')))[_0x14b0('0x2d')](function(){})[_0x14b0('0x30')](_0x535395()));break;case _0x14b0('0x56'):_0x178853['push'](db[_0x14b0('0x57')]['query'](_0x4e1066(_0x100b07,_0x14b0('0x5d')))[_0x14b0('0x2d')](function(){})['catch'](_0x535395()));break;default:_0x178853[_0x14b0('0x2e')](db[_0x14b0('0x57')][_0x14b0('0x55')](_0x6c582b(_0x100b07,_0x14b0('0x5d')))[_0x14b0('0x2d')](function(){})['catch'](_0x535395()));}}}return _0x178853;})[_0x14b0('0x59')]();})[_0x14b0('0x2d')](function(){return db[_0x14b0('0x5c')]['findAll']({'attributes':['id'],'include':[{'model':db[_0x14b0('0x5a')],'as':_0x14b0('0x5b'),'where':{'id':LISTID}}]})[_0x14b0('0x2d')](function(_0x2bab9a){var _0x16ad30=[];if(_0x2bab9a){for(var _0x4dc3f2=0x0,_0x44d949;_0x4dc3f2<_0x2bab9a[_0x14b0('0x19')];_0x4dc3f2+=0x1){_0x44d949=_0x2bab9a[_0x4dc3f2][_0x14b0('0x53')]({'plain':!![]});_0x16ad30['push'](db['sequelize']['query'](_0x146498(_0x44d949,'CampaignId'))[_0x14b0('0x2d')](function(){})[_0x14b0('0x30')](_0x535395()));}}return _0x16ad30;})[_0x14b0('0x59')]();})[_0x14b0('0x30')](function(_0x15e7f3){logger['error'](_0x14b0('0x5e'),_0x14b0('0x5f'),_0x15e7f3[_0x14b0('0x1b')]);});}var processPromises=function(_0x5d6a4c){return BPromise[_0x14b0('0x59')](promises)[_0x14b0('0x2d')](function(_0x1f339d){})[_0x14b0('0x30')](function(_0x8dd5e3){logger['error']('Error\x20processing\x20rows\x20block:',JSON[_0x14b0('0x60')](_0x8dd5e3));})[_0x14b0('0x61')](function(){socket['emit'](_0x14b0('0x62')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x5d6a4c){return _0x5d6a4c['resume']();}});};var endCsv=function(){return BPromise[_0x14b0('0x63')]()[_0x14b0('0x2d')](function(){if(hopperContacts){return checkHopper();}})[_0x14b0('0x2d')](function(){socket[_0x14b0('0x64')](_0x14b0('0x62')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x14b0('0x65')](FILEPATH);}catch(_0x4559b4){logger['error'](_0x14b0('0x66'),JSON[_0x14b0('0x60')](_0x4559b4));}finally{process[_0x14b0('0x67')](0x0);}});};process['on'](_0x14b0('0x68'),function(){logger[_0x14b0('0x69')]('CSV\x20import\x20process\x20stopped!');endCsv();});function main(){return BPromise[_0x14b0('0x63')]()['then'](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x14b0('0x11')](',');return db[_0x14b0('0x2b')][_0x14b0('0x4f')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x14b0('0x2d')](function(_0x4961ce){var _0x1d1db8=fs[_0x14b0('0x6a')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x14b0('0x6b')](_0x1d1db8,{'header':!![],'skipEmptyLines':!![],'step':function(_0x4dc823,_0xe5504f){total+=0x1;var _0x2b1ba0=total;promises[_0x14b0('0x2e')](checkRow(_0x4dc823,_0x4961ce,_0x2b1ba0)[_0x14b0('0x2d')](function(){success+=0x1;})[_0x14b0('0x30')](function(_0x425835){if(_0x425835[_0x14b0('0x13')]){errors+=0x1;delete _0x425835[_0x14b0('0x13')];}else if(_0x425835['duplicate']){duplicates+=0x1;delete _0x425835[_0x14b0('0x29')];}rows[_0x14b0('0x2e')](_0x425835);}));if(total%0xc8===0x0){_0xe5504f[_0x14b0('0x6c')]();return processPromises(_0xe5504f);}},'complete':function(){return processPromises()[_0x14b0('0x2d')](function(){logger['info'](_0x14b0('0x6d'));endCsv();});},'error':function(_0x137329,_0x182d95){logger[_0x14b0('0x69')]('CSV\x20parse\x20error',JSON['stringify'](_0x137329));endCsv();}});})['catch'](function(_0x39c370){logger[_0x14b0('0x13')]('Error\x20executing\x20contact\x20csv\x20import:',JSON[_0x14b0('0x60')](_0x39c370));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index b1a92f6..5194e25 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 _0x89b9=['message','errors','sequelize','query','campaigns.id','campaigns.dialTimezone','campaigns','campaigns_has_cm_lists','campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId','campaigns_has_cm_lists.CmListId=','spread','voice_queues','voice_queues_has_cm_lists','voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId','voice_queues_has_cm_lists.CmListId=','catch','timezones','isNil','set','offset','dialTimezone','main','stringify','start','binding','socket_timestamp','root','server/files/tmp','.csv','keys','includes','header','findAll','name','_description','parse','data','rows','find','hasOwnProperty','replace','YYYY-MM-DD\x20HH:mm:ss','isValid','isNaN','isNumber','agent\x20not\x20exists','email','dateOfBirth','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','utcOffset','firstName','\x20not\x20specified','trim','itemTypeId','emit','contact:import:','Abort\x20parser','abort','SystemError','step','duplicates','cm_contacts_','\x20LIKE\x20cm_contacts;','campaigns_','voice_queues_','CREATE\x20TABLE\x20','(id\x20int,dialTimezone\x20varchar(255),offset\x20int);','each','dialTimezone,utcOffset','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27',',\x20scheduledAt\x20=\x20NOW()','DROP\x20TABLE\x20','contactId','contactTypeId','orderBy','VoiceQueueId','CampaignId','campaigns_has_cm_blacklists','voice_queues_has_cm_blacklists','finish','affectedRows','unlink','exit','complete','argv','arguments\x20\x20\x20','phone\x20is\x20mandatory','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','SIGINT','uncaughtException','path','moment','ioredis','../../../mysqldb','../../../config/environment','../../../config/environment/shared','../../../config/logger','import','redis','localhost','socket.io-emitter','format','test','select','field','phone','join','.id\x20=\x20','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','CmContact','then','length','push','all','AdditionalPhones','split','filter','CmContactHasItem','update','create','PHONE','inserted','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.priority','cm_contacts.UserId','into','cm_hopper','fromQuery','scheduledat','ContactId','ListId','createdAt','priority','UserId','recallme','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','\x22onlyIfOpen\x22','toString','cm_contacts.updatedAt','insert','cm_hopper_black','updatedAt','fields','from','ListId\x20=\x20?','date_add(cm_contacts.scheduledat,interval\x20','cm_contacts.createdAt','cm_hopper.id','cm_contact_has_items.item','cm_contact_has_items.OrderBy','cm_contact_has_items.updatedAt','cm_hopper_additional_phones','OrderBy','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','cm_hopper.ListId\x20=\x20?','CompanyId','deletedAt\x20IS\x20NULL','id\x20IN\x20?','MIN(id)','min_id','group','info','Received\x20SIGINT','error'];(function(_0x3a1c16,_0xd3d0){var _0x2977ce=function(_0x42e4b7){while(--_0x42e4b7){_0x3a1c16['push'](_0x3a1c16['shift']());}};_0x2977ce(++_0xd3d0);}(_0x89b9,0x112));var _0x989b=function(_0x4f9506,_0x499ab0){_0x4f9506=_0x4f9506-0x0;var _0x23037b=_0x89b9[_0x4f9506];return _0x23037b;};'use strict';var fs=require('fs');var path=require(_0x989b('0x0'));var _=require('lodash');var Papa=require('papaparse');var util=require('util');var BPromise=require('bluebird');var moment=require(_0x989b('0x1'));var squel=require('squel');var Redis=require(_0x989b('0x2'));var db=require(_0x989b('0x3'))['db'];var config=require(_0x989b('0x4'));var shared=require(_0x989b('0x5'));var logger=require(_0x989b('0x6'))(_0x989b('0x7'));config['redis']=_['defaults'](config[_0x989b('0x8')],{'host':_0x989b('0x9'),'port':0x18eb});var socket=require(_0x989b('0xa'))(new Redis(config[_0x989b('0x8')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()[_0x989b('0xb')]('YYYY-MM-DD\x20HH:mm:ss');var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()[_0x989b('0xb')]('YYYY-MM-DD\x20HH:mm:ss');function isEmail(_0x88debd){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))*$/[_0x989b('0xc')](_0x88debd);}function selectNotIn(_0x5edd22,_0xcce11d,_0xa7b6a8,_0xa66ae0,_0x5e2eb4){return squel[_0x989b('0xd')]()[_0x989b('0xe')](_0x989b('0xf'))['from'](_0xa66ae0)[_0x989b('0x10')](_0xcce11d,null,_0xcce11d+_0x989b('0x11')+_0xa66ae0+'.'+_0xa7b6a8)[_0x989b('0x12')](_0xa66ae0+'.'+_0xa7b6a8+_0x989b('0x13')+_0x5edd22+'.'+_0xa7b6a8)[_0x989b('0x12')](_0xcce11d+_0x989b('0x14')+_0x5e2eb4[_0x989b('0x10')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x5982a4,_0x1ca255){promisesAdditionalPhones=[];return db[_0x989b('0x15')]['findAll']({'raw':!![],'attributes':['id','AdditionalPhones'],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})[_0x989b('0x16')](function(_0x3ddfef){if(_0x3ddfef!==null){var _0x2a3a21=[];for(var _0x261e30=0x0;_0x261e30<_0x3ddfef[_0x989b('0x17')];_0x261e30++){var _0x368f3d=_0x3ddfef[_0x261e30];_0x2a3a21[_0x989b('0x18')](insertAdditionalPhones(_0x368f3d));}}Promise[_0x989b('0x19')](_0x2a3a21)['then'](function(){_0x5982a4({'val':0x1});});});});}function insertAdditionalPhones(_0x21994c){return new Promise(function(_0x1051ea,_0x4d0893){var _0x196e78=_0x21994c[_0x989b('0x1a')];var _0xaa452c=_0x196e78[_0x989b('0x1b')](';');var _0x3d9195=[];orderBy=0x0;for(var _0x19d6b8=0x0;_0x19d6b8<_0xaa452c[_0x989b('0x17')];_0x19d6b8++){_0x3d9195[_0x989b('0x18')](splitAdditionalPhone(_0x21994c['id'],_0xaa452c[_0x19d6b8]));}Promise['all'](_0x3d9195)[_0x989b('0x16')](function(){_0x1051ea({'val':_0xaa452c[_0x989b('0x17')]});});});}function splitAdditionalPhone(_0x2bc5b8,_0x400023){return new Promise(function(_0x5f13e8,_0x289aa3){var _0x2df7b6=_0x400023['split'](':');var _0x190c6c=_0x2df7b6[0x0];var _0x1003a5=_0x2df7b6[0x1];if(!_['isNil'](_0x1003a5)){var _0x1ff54b=_0x1003a5['split']('|');var _0x522727=[];for(var _0x4e7ab8=0x0;_0x4e7ab8<_0x1ff54b[_0x989b('0x17')];_0x4e7ab8++){if(_0x1ff54b[_0x4e7ab8]!==''){var _0x4238db=_[_0x989b('0x1c')](promisesAdditionalPhones,{'contactId':_0x2bc5b8,'phone':_0x1ff54b[_0x4e7ab8]});if(_0x4238db['length']==0x0){orderBy++;promisesAdditionalPhones[_0x989b('0x18')]({'contactId':_0x2bc5b8,'contactTypeId':_0x190c6c,'phone':_0x1ff54b[_0x4e7ab8],'orderBy':orderBy});}}}_0x5f13e8({'ok':0x1});}else _0x5f13e8({'res':0x0});});}function createAdditionalPhone(_0x5bdf0a,_0x31bad6,_0x2d7914,_0x4ea24b){var _0x2a3f16='';var _0x177e21='';var _0x3f28db=_0x2d7914[_0x989b('0x1b')]('§');_0x2a3f16=_0x3f28db[0x0];if(_0x3f28db[_0x989b('0x17')]==0x2)_0x177e21=_0x3f28db[0x1];return new Promise(function(_0xf8990c,_0x3b8591){return db[_0x989b('0x1d')]['findOne']({'where':{'CmContactId':_0x5bdf0a,'item':_0x2a3f16}})[_0x989b('0x16')](function(_0xdc864){if(_0xdc864){return db[_0x989b('0x1d')][_0x989b('0x1e')]({'ItemTypeId':_0x31bad6,'description':_0x177e21,'OrderBy':_0x4ea24b},{'where':{'CmContactId':_0x5bdf0a,'item':_0x2a3f16}})[_0x989b('0x16')](function(_0x2111b9){_0xf8990c({'res':'updated'});});}else{return db['CmContactHasItem'][_0x989b('0x1f')]({'CmContactId':_0x5bdf0a,'item':_0x2a3f16,'description':_0x177e21,'ItemTypeId':_0x31bad6,'OrderBy':_0x4ea24b,'ItemClass':_0x989b('0x20')})[_0x989b('0x16')](function(_0x53bff2){_0xf8990c({'res':_0x989b('0x21')});});}});});}function insertCmHopper(_0x5a465d,_0x5d9ce1,_0x376031,_0x320f7d,_0x351382){var _0x536343=[_0x989b('0x22'),_0x989b('0x23'),_0x989b('0x24'),_0x989b('0x25'),_0x5d9ce1+'.'+_0x320f7d,'cm_contacts.createdAt','cm_contacts.updatedAt',_0x989b('0x26'),_0x989b('0x27'),'\x22'+_0x351382+'\x22'];return squel['insert']()[_0x989b('0x28')](_0x989b('0x29'))[_0x989b('0x2a')]([_0x989b('0xf'),_0x989b('0x2b'),_0x989b('0x2c'),_0x989b('0x2d'),_0x320f7d,_0x989b('0x2e'),'updatedAt',_0x989b('0x2f'),_0x989b('0x30'),_0x989b('0x31')],squel[_0x989b('0xd')]()['fields'](_0x536343)['from'](_0x5d9ce1)[_0x989b('0x10')](_0x989b('0x32'),null,_0x989b('0x33')+_0x5d9ce1+_0x989b('0x34'))['join'](_0x376031,null,_0x376031+_0x989b('0x11')+_0x5d9ce1+'.'+_0x320f7d)[_0x989b('0x12')](_0x5d9ce1+_0x989b('0x35'),_0x5a465d)[_0x989b('0x12')](_0x989b('0x36'),NOW)[_0x989b('0x12')](_0x989b('0x37'),selectNotIn(_0x5d9ce1,_0x376031,_0x320f7d,'cm_hopper',[_0x989b('0x38'),_0x989b('0x39')]))[_0x989b('0x12')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x5d9ce1,_0x376031,_0x320f7d,_0x989b('0x29'),[_0x989b('0x38')])))[_0x989b('0x3a')]();}function insertCmHopperBlack(_0x4517a2,_0x11278e,_0x4dacc6,_0x22e0ce){var _0x2f7f48=[_0x989b('0x22'),_0x989b('0x24'),_0x989b('0x25'),_0x11278e+'.'+_0x22e0ce,'cm_contacts.createdAt',_0x989b('0x3b')];return squel[_0x989b('0x3c')]()['into'](_0x989b('0x3d'))[_0x989b('0x2a')]([_0x989b('0xf'),_0x989b('0x2c'),_0x989b('0x2d'),_0x22e0ce,'createdAt',_0x989b('0x3e')],squel[_0x989b('0xd')]()[_0x989b('0x3f')](_0x2f7f48)[_0x989b('0x40')](_0x11278e)[_0x989b('0x10')](_0x989b('0x32'),null,_0x989b('0x33')+_0x11278e+_0x989b('0x34'))[_0x989b('0x10')](_0x4dacc6,null,_0x4dacc6+_0x989b('0x11')+_0x11278e+'.'+_0x22e0ce)[_0x989b('0x12')](_0x11278e+_0x989b('0x35'),_0x4517a2)[_0x989b('0x12')](_0x989b('0x36'),NOW)[_0x989b('0x12')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel[_0x989b('0xd')]()[_0x989b('0xe')]('phone')[_0x989b('0x40')](_0x989b('0x3d'))[_0x989b('0x12')](_0x989b('0x41'),_0x4517a2)[_0x989b('0x12')](_0x22e0ce+'\x20=\x20'+_0x11278e+'.'+_0x22e0ce)))[_0x989b('0x3a')]();}function insertTzCmHopper(_0x55c84d,_0x3d2fcc,_0x4e1e51,_0x2f11f4,_0x90221c,_0x476ee9){var _0x399470=[_0x989b('0x22'),_0x989b('0x42')+_0x476ee9+'.offset-cm_contacts.utcOffset\x20minute)',_0x989b('0x24'),_0x989b('0x25'),_0x3d2fcc+'.'+_0x2f11f4,_0x989b('0x43'),_0x989b('0x3b'),_0x989b('0x26'),'cm_contacts.UserId','\x22'+_0x90221c+'\x22'];var _0x560eec=squel[_0x989b('0x3c')]()[_0x989b('0x28')](_0x989b('0x29'))[_0x989b('0x2a')](['phone',_0x989b('0x2b'),_0x989b('0x2c'),_0x989b('0x2d'),_0x2f11f4,_0x989b('0x2e'),'updatedAt',_0x989b('0x2f'),_0x989b('0x30'),'recallme'],squel['select']()[_0x989b('0x3f')](_0x399470)['from'](_0x3d2fcc)[_0x989b('0x10')](_0x989b('0x32'),null,'cm_contacts.ListId\x20=\x20'+_0x3d2fcc+_0x989b('0x34'))[_0x989b('0x10')](_0x4e1e51,null,_0x4e1e51+_0x989b('0x11')+_0x3d2fcc+'.'+_0x2f11f4)['join'](_0x476ee9,null,_0x476ee9+_0x989b('0x11')+_0x3d2fcc+'.'+_0x2f11f4)['where'](_0x3d2fcc+_0x989b('0x35'),_0x55c84d)['where'](_0x989b('0x36'),NOW)[_0x989b('0x12')](_0x989b('0x37'),selectNotIn(_0x3d2fcc,_0x4e1e51,_0x2f11f4,_0x989b('0x29'),[_0x989b('0x38'),'\x22onlyIfOpen\x22']))[_0x989b('0x12')](_0x989b('0x37'),selectNotIn(_0x3d2fcc,_0x4e1e51,_0x2f11f4,'cm_hopper',[_0x989b('0x38')])))[_0x989b('0x3a')]();return _0x560eec;}function insertTzCmHopperBlack(_0x3c7688,_0x483473,_0x449c17,_0x4ed766){var _0x180a43=[_0x989b('0x22'),_0x989b('0x24'),'cm_contacts.ListId',_0x483473+'.'+_0x4ed766,'cm_contacts.createdAt',_0x989b('0x3b')];return squel[_0x989b('0x3c')]()[_0x989b('0x28')](_0x989b('0x3d'))[_0x989b('0x2a')]([_0x989b('0xf'),'ContactId',_0x989b('0x2d'),_0x4ed766,'createdAt',_0x989b('0x3e')],squel[_0x989b('0xd')]()[_0x989b('0x3f')](_0x180a43)[_0x989b('0x40')](_0x483473)[_0x989b('0x10')](_0x989b('0x32'),null,_0x989b('0x33')+_0x483473+_0x989b('0x34'))[_0x989b('0x10')](_0x449c17,null,_0x449c17+_0x989b('0x11')+_0x483473+'.'+_0x4ed766)[_0x989b('0x12')](_0x483473+_0x989b('0x35'),_0x3c7688)[_0x989b('0x12')](_0x989b('0x36'),NOW)[_0x989b('0x12')](_0x989b('0x37'),squel[_0x989b('0xd')]()[_0x989b('0xe')]('phone')['from'](_0x989b('0x3d'))[_0x989b('0x12')](_0x989b('0x41'),_0x3c7688)['where'](_0x4ed766+_0x989b('0x13')+_0x483473+'.'+_0x4ed766)))[_0x989b('0x3a')]();}function insertCmHopperAdditionalPhones(_0x108f57){var _0x2a79a6=[_0x989b('0x44'),_0x989b('0x45'),_0x989b('0x46'),'cm_contact_has_items.createdAt',_0x989b('0x47')];return squel[_0x989b('0x3c')]()[_0x989b('0x28')](_0x989b('0x48'))[_0x989b('0x2a')](['CmHopperId',_0x989b('0xf'),_0x989b('0x49'),_0x989b('0x2e'),_0x989b('0x3e')],squel['select']()[_0x989b('0x3f')](_0x2a79a6)['from'](_0x989b('0x29'))[_0x989b('0x10')](_0x989b('0x32'),null,_0x989b('0x4a'))[_0x989b('0x10')]('cm_contact_has_items',null,_0x989b('0x4b'))['where'](_0x989b('0x4c'),_0x108f57)['where'](_0x989b('0x36'),NOW))['toString']();}function insertCmContact(_0x5c3ba6,_0x1ccfa4,_0x5a8d3c,_0x43f4f0){var _0x26c380=_['concat'](_['keys'](_0x43f4f0),[_0x989b('0x2d'),_0x989b('0x4d'),'createdAt',_0x989b('0x3e'),'scheduledAt']);return squel[_0x989b('0x3c')]()[_0x989b('0x28')](_0x989b('0x32'))[_0x989b('0x2a')](_0x26c380,squel[_0x989b('0xd')]()[_0x989b('0x3f')](_0x26c380)[_0x989b('0x40')](_0x1ccfa4)[_0x989b('0x12')]('('+_0x5a8d3c['join'](',')+')\x20NOT\x20IN\x20?',squel[_0x989b('0xd')]()[_0x989b('0x3f')](_0x5a8d3c)['from'](_0x989b('0x32'))['where'](_0x989b('0x41'),_0x5c3ba6)['where'](_0x989b('0x4e')))[_0x989b('0x12')](_0x989b('0x4f'),squel[_0x989b('0xd')]()[_0x989b('0xe')](_0x989b('0x50'),_0x989b('0x51'))[_0x989b('0x40')](_0x1ccfa4)[_0x989b('0x52')](_0x5a8d3c[_0x989b('0x10')](','))))['toString']();}function handleStop(){logger[_0x989b('0x53')](_0x989b('0x54'));stopped=!![];}function handleUncaughtException(_0x138aad){logger[_0x989b('0x55')](_0x138aad[_0x989b('0x56')]);process['exit'](0x1);}function handleError(_0x1bfdc0,_0x3d19c3){stats[_0x989b('0x57')][_0x989b('0x18')]({'name':_0x3d19c3['code'],'message':_0x3d19c3[_0x989b('0x56')],'row':_0x1bfdc0});}function handleQuery(_0x5723bf){logger[_0x989b('0x53')](_0x5723bf);return db[_0x989b('0x58')][_0x989b('0x59')](_0x5723bf)['spread'](function(_0x105882){results['push'](_0x105882);})['catch'](function(_0x2c6d89){logger[_0x989b('0x55')](_0x2c6d89['message']);});}function updateTzCampaigns(_0x27eafc){return new Promise(function(_0x2a6a90,_0x445886){var _0x50f2d5=squel['select']()[_0x989b('0x3f')]([_0x989b('0x5a'),_0x989b('0x5b')])[_0x989b('0x40')](_0x989b('0x5c'))[_0x989b('0x10')](_0x989b('0x5d'),null,_0x989b('0x5e'))[_0x989b('0x12')](_0x989b('0x5f')+_0x27eafc);db[_0x989b('0x58')][_0x989b('0x59')](_0x50f2d5[_0x989b('0x3a')]())[_0x989b('0x60')](function(_0x288d6b){var _0x1a1317=[];for(var _0x3c76cb=0x0;_0x3c76cb<_0x288d6b[_0x989b('0x17')];_0x3c76cb++){_0x1a1317[_0x989b('0x18')](getTimezoneData(_0x288d6b[_0x3c76cb],tmp_campaigns));}BPromise['all'](_0x1a1317)[_0x989b('0x16')](function(){_0x2a6a90({'val':0x1});});})['catch'](function(_0x519827){logger[_0x989b('0x55')](_0x519827['message']);_0x2a6a90({'val':0x0});});});}function updateTzVoiceQueues(_0x522df3){return new Promise(function(_0xcf286a,_0x29205d){var _0x1f3155=squel[_0x989b('0xd')]()[_0x989b('0x3f')](['voice_queues.id','voice_queues.dialTimezone'])['from'](_0x989b('0x61'))[_0x989b('0x10')](_0x989b('0x62'),null,_0x989b('0x63'))[_0x989b('0x12')](_0x989b('0x64')+_0x522df3);db[_0x989b('0x58')][_0x989b('0x59')](_0x1f3155[_0x989b('0x3a')]())[_0x989b('0x60')](function(_0x20aa21){var _0x2446e5=[];for(var _0x183aea=0x0;_0x183aea<_0x20aa21[_0x989b('0x17')];_0x183aea++){_0x2446e5[_0x989b('0x18')](getTimezoneData(_0x20aa21[_0x183aea],tmp_voice_queues));}BPromise[_0x989b('0x19')](_0x2446e5)[_0x989b('0x16')](function(){_0xcf286a({'val':0x1});});})[_0x989b('0x65')](function(_0x134d1b){logger[_0x989b('0x55')](_0x134d1b['message']);_0xcf286a({'val':0x0});});});}function getTimezoneData(_0x58586d,_0x2a16d3){return new Promise(function(_0x57e0c8,_0xd575f9){var _0x555f25=shared[_0x989b('0x66')];var _0x42c520=_0x555f25[_0x58586d['dialTimezone']];if(_[_0x989b('0x67')](_0x42c520)){_0x57e0c8({'ret':0x1});}else{var _0x40e0c6=_0x42c520['utcOffset'];var _0x372ec7=squel['insert']()[_0x989b('0x28')](_0x2a16d3)['set']('id',_0x58586d['id'])[_0x989b('0x68')](_0x989b('0x69'),_0x40e0c6)[_0x989b('0x68')]('dialTimezone',_0x58586d[_0x989b('0x6a')])[_0x989b('0x3a')]();return db[_0x989b('0x58')][_0x989b('0x59')](_0x372ec7)[_0x989b('0x60')](function(_0x46928f){_0x57e0c8({'ret':0x1});})[_0x989b('0x65')](function(_0x347172){logger[_0x989b('0x55')](_0x347172['message']);_0xd575f9({'ret':0x1});});}});}function handleTZQuery(_0x5e45b7){logger['info'](_0x5e45b7);return db[_0x989b('0x58')]['query'](_0x5e45b7)['spread'](function(_0x2cb90c){})[_0x989b('0x65')](function(_0x2d57ec){logger['error'](_0x2d57ec[_0x989b('0x56')]);});}function main(_0x470c99,_0x521c4d,_0x2c6799,_0x3aa4ca){logger[_0x989b('0x53')](_0x989b('0x6b'),_0x470c99,JSON[_0x989b('0x6c')](_0x521c4d));process['send'](_0x989b('0x6d'));var _0x5baad9=_0x521c4d[_0x989b('0x6e')];var _0x28e622=_['clone'](_0x5baad9);var _0x626512=_0x521c4d[_0x989b('0x6f')];var _0x5b57ff=path[_0x989b('0x10')](config[_0x989b('0x70')],_0x989b('0x71'),_0x626512+_0x989b('0x72'));hasTZ=_[_0x989b('0x73')](_0x5baad9)[_0x989b('0x74')]('dialTimezone');var _0x432734=_[_0x989b('0x73')](_0x5baad9)['join']();logger['info'](_0x989b('0x75'),_0x432734);db['ContactItemType'][_0x989b('0x76')]({'raw':!![],'attributes':['id',_0x989b('0x77')]})[_0x989b('0x16')](function(_0x21c835){for(var _0x281f78=0x0;_0x281f78<_0x21c835[_0x989b('0x17')];_0x281f78++){if(_0x21c835[_0x281f78]['name']in _0x5baad9){contactItemTypes[_0x989b('0x18')](_0x21c835[_0x281f78]);delete _0x28e622[_0x21c835[_0x281f78]['name']];hasAdditionalPhones=!![];}for(var _0x41aab1 in _0x5baad9){if(_0x21c835[_0x281f78][_0x989b('0x77')]+_0x989b('0x78')===_0x41aab1){phoneDescriptions[_0x989b('0x18')]({'itemTypeId':_0x21c835[_0x281f78]['id'],'description':_0x41aab1});delete _0x28e622[_0x41aab1];}}}if(hasAdditionalPhones)_0x28e622[_0x989b('0x1a')]='';var _0x1dc110=_[_0x989b('0x73')](_0x28e622)[_0x989b('0x10')]();logger[_0x989b('0x53')](_0x989b('0x75'),_0x1dc110);fs['writeFileSync'](_0x5b57ff,_0x1dc110+'\x0a');Papa[_0x989b('0x79')](fs['createReadStream'](_0x470c99),{'header':!![],'skipEmptyLines':!![],'step':function(_0xabe682,_0x19697f){try{for(var _0x5d9916=0x0,_0x2fee89=[];_0x5d9916<_0xabe682[_0x989b('0x7a')][_0x989b('0x17')];_0x5d9916++){stats[_0x989b('0x7b')]+=0x1;if(_0xabe682[_0x989b('0x57')][_0x5d9916]){handleError(_0xabe682[_0x989b('0x7a')][_0x5d9916],_0xabe682['errors'][_0x5d9916]);}else{var _0x3d9cb5=[];var _0x258d67=[];var _0xef8a98={};for(var _0x5351ae in _0x5baad9){let _0x21147e=contactItemTypes[_0x989b('0x7c')](_0xeac59d=>_0xeac59d[_0x989b('0x77')]===_0x5351ae);let _0x1ba03a=contactItemTypes['find'](_0x3b4876=>_0x3b4876[_0x989b('0x77')]+_0x989b('0x78')===_0x5351ae);if(_['isNil'](_0x21147e)&&_[_0x989b('0x67')](_0x1ba03a)){if(_0x5baad9[_0x989b('0x7d')](_0x5351ae)){if(_0xabe682[_0x989b('0x7a')][_0x5d9916][_0x5baad9[_0x5351ae]]){var _0x110dab=_['trim'](_0xabe682['data'][_0x5d9916][_0x5baad9[_0x5351ae]][_0x989b('0x7e')](/"/g,'\x27'));switch(_0x5351ae){case _0x989b('0x2b'):var _0x4d25f9=moment(_0x110dab,_0x989b('0x7f'),!![]);if(_0x4d25f9[_0x989b('0x80')]()){_0x2fee89[_0x989b('0x18')]('\x22'+_0x110dab+'\x22');}else{_0x3d9cb5[_0x989b('0x18')]('scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)');}break;case _0x989b('0x2f'):var _0x29433f=parseInt(_0x110dab);_0x110dab=_[_0x989b('0x81')](_0x29433f)||_0x29433f<0x0||_0x29433f>0x4?_0x3aa4ca?0x3:0x2:_0x29433f;_0x2fee89[_0x989b('0x18')]('\x22'+_0x110dab+'\x22');break;case'UserId':var _0x11fdc2=parseInt(_0x110dab);if(_[_0x989b('0x82')](_0x11fdc2)&&_[_0x989b('0x74')](_0x2c6799,_0x11fdc2)){_0x2fee89[_0x989b('0x18')]('\x22'+_0x11fdc2+'\x22');}else{_0x3d9cb5['push'](_0x989b('0x83'));}break;case _0x989b('0x84'):if(isEmail(_0x110dab)){_0x2fee89[_0x989b('0x18')]('\x22'+_0x110dab+'\x22');}else{_0x3d9cb5[_0x989b('0x18')]('email\x20wrong\x20format');}break;case _0x989b('0x85'):var _0x450757=moment(_0x110dab,_0x989b('0x86'),!![]);if(_0x450757[_0x989b('0x80')]()){_0x2fee89['push']('\x22'+_0x110dab+'\x22');}else{_0x3d9cb5['push'](_0x989b('0x87'));}break;case'dialTimezone':var _0x4bf4ad=shared[_0x989b('0x66')];var _0x35c922=_0x4bf4ad[_0x110dab];if(!_[_0x989b('0x67')](_0x35c922)){var _0x2d5530=_0x35c922[_0x989b('0x88')];_0x2fee89[_0x989b('0x18')]('\x22'+_0x110dab+'\x22');_0x2fee89['push']('\x22'+_0x2d5530+'\x22');}break;default:_0x2fee89[_0x989b('0x18')]('\x22'+_0x110dab+'\x22');}}else{switch(_0x5351ae){case _0x989b('0x89'):case _0x989b('0xf'):_0x3d9cb5[_0x989b('0x18')](_0x5351ae+_0x989b('0x8a'));break;default:_0x2fee89[_0x989b('0x18')]('\x22\x22');}}}}else{var _0x43c3bc='';if(!_[_0x989b('0x67')](_0x21147e)){if(!_0xef8a98[_0x989b('0x7d')](_0x21147e['id'])){if(!_[_0x989b('0x67')](_0xabe682[_0x989b('0x7a')][_0x5d9916][_0x5baad9[_0x5351ae]])){var _0x110dab=_[_0x989b('0x8b')](_0xabe682[_0x989b('0x7a')][_0x5d9916][_0x5baad9[_0x5351ae]][_0x989b('0x7e')](/"/g,'\x27'));var _0x2d64d1=phoneDescriptions['find'](_0x147517=>_0x147517[_0x989b('0x8c')]===_0x21147e['id']);if(!_[_0x989b('0x67')](_0x2d64d1)){var _0x2d5cc6=_['trim'](_0xabe682['data'][_0x5d9916][_0x5baad9[_0x2d64d1['description']]]['replace'](/"/g,'\x27'));if(!_[_0x989b('0x67')](_0x2d5cc6))_0x110dab=_0x110dab+'§'+_0x2d5cc6;}if(_0x43c3bc=='')_0x43c3bc=_0x110dab;else _0x43c3bc+='|'+_0x110dab;}_0x258d67[_0x989b('0x18')](_0x21147e['id']+':'+_0x43c3bc);_0xef8a98[_0x21147e['id']]=0x1;}}}}if(hasAdditionalPhones){_0x2fee89[_0x989b('0x18')]('\x22'+_0x258d67[_0x989b('0x10')](';')+'\x22');}if(_0x3d9cb5['length']){handleError(_0xabe682[_0x989b('0x7a')][_0x5d9916],{'code':'SystemRow','message':_0x3d9cb5[_0x989b('0x10')]()});}else{fs['appendFileSync'](_0x5b57ff,_0x2fee89[_0x989b('0x10')]()+'\x0a');}_0x2fee89=[];}if(!(stats[_0x989b('0x7b')]%0xc8)){socket[_0x989b('0x8d')](_0x989b('0x8e')+_0x626512,stats);stats[_0x989b('0x57')]=[];}}if(stopped){logger[_0x989b('0x53')](_0x989b('0x8f'));_0x19697f[_0x989b('0x90')]();}}catch(_0x3f3c48){handleError(_0xabe682[_0x989b('0x7a')][_0x5d9916],{'code':_0x989b('0x91'),'message':_0x3f3c48[_0x989b('0x56')]});logger[_0x989b('0x55')](_0x989b('0x92'),_0x3f3c48[_0x989b('0x56')]);}},'complete':function(){try{var _0x3b879d=[];var _0x5006bc=[];var _0x1f0b70=_0x989b('0x32');if(_0x521c4d[_0x989b('0x93')]&&_0x521c4d[_0x989b('0x93')]['length']){_0x1f0b70=_0x989b('0x94')+_0x626512;_0x3b879d[_0x989b('0x18')]('CREATE\x20TABLE\x20'+_0x1f0b70+_0x989b('0x95'));}tmp_campaigns=_0x989b('0x96')+_0x626512;tmp_voice_queues=_0x989b('0x97')+_0x626512;_0x5006bc[_0x989b('0x18')](_0x989b('0x98')+tmp_campaigns+_0x989b('0x99'));_0x5006bc['push']('CREATE\x20TABLE\x20'+tmp_voice_queues+_0x989b('0x99'));BPromise[_0x989b('0x9a')](_0x5006bc,handleTZQuery)['then'](function(_0x32a8c4){updateTzCampaigns(_0x521c4d[_0x989b('0x2d')])['then'](function(_0x68f6a9){updateTzVoiceQueues(_0x521c4d[_0x989b('0x2d')])['then'](function(_0x400985){if(hasTZ)_0x1dc110=_0x1dc110[_0x989b('0x7e')](_0x989b('0x6a'),_0x989b('0x9b'));var _0x44d7f2=util[_0x989b('0xb')](_0x989b('0x9c'),_0x5b57ff,_0x1f0b70,_0x1dc110,_0x521c4d[_0x989b('0x2d')],_0x521c4d['CompanyId']||null,NOW,NOW);if(_[_0x989b('0x67')](_0x5baad9[_0x989b('0x2b')])){_0x44d7f2+=_0x989b('0x9d');}_0x3b879d[_0x989b('0x18')](_0x44d7f2);if(_0x521c4d[_0x989b('0x93')]&&_0x521c4d['duplicates'][_0x989b('0x17')]){_0x3b879d['push'](insertCmContact(_0x521c4d[_0x989b('0x2d')],_0x1f0b70,_0x521c4d['duplicates'],_0x5baad9));_0x3b879d[_0x989b('0x18')](_0x989b('0x9e')+_0x1f0b70+';');}BPromise['each'](_0x3b879d,handleQuery)[_0x989b('0x16')](function(_0x9b95cf){BPromise['all']([handleAdditionalPhones()])[_0x989b('0x16')](function(){_0x3b879d=[];for(var _0x38b849=0x0;_0x38b849_0x25cf7d[_0xdf58('0x80')]===_0x24f8ac);let _0x455f41=contactItemTypes['find'](_0x44b566=>_0x44b566[_0xdf58('0x80')]+_0xdf58('0x81')===_0x24f8ac);if(_[_0xdf58('0x22')](_0x376940)&&_[_0xdf58('0x22')](_0x455f41)){if(_0x13ea56[_0xdf58('0x88')](_0x24f8ac)){if(_0xdf0ac0[_0xdf58('0x84')][_0x19f3cf][_0x13ea56[_0x24f8ac]]){var _0x16efec=_[_0xdf58('0x89')](_0xdf0ac0['data'][_0x19f3cf][_0x13ea56[_0x24f8ac]][_0xdf58('0x8a')](/"/g,'\x27'));switch(_0x24f8ac){case'scheduledat':var _0x167891=moment(_0x16efec,_0xdf58('0x11'),!![]);if(_0x167891[_0xdf58('0x8b')]()){_0x7ee676[_0xdf58('0x20')]('\x22'+_0x16efec+'\x22');}else{_0x39cb1c[_0xdf58('0x20')]('scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)');}break;case _0xdf58('0x35'):var _0x50bb97=parseInt(_0x16efec);_0x16efec=_[_0xdf58('0x8c')](_0x50bb97)||_0x50bb97<0x0||_0x50bb97>0x4?_0x10a8a6?0x3:0x2:_0x50bb97;_0x7ee676[_0xdf58('0x20')]('\x22'+_0x16efec+'\x22');break;case _0xdf58('0x4a'):var _0x137cdf=parseInt(_0x16efec);if(_[_0xdf58('0x8d')](_0x137cdf)&&_['includes'](_0x5acecb,_0x137cdf)){_0x7ee676[_0xdf58('0x20')]('\x22'+_0x137cdf+'\x22');}else{_0x39cb1c[_0xdf58('0x20')](_0xdf58('0x8e'));}break;case _0xdf58('0x8f'):if(isEmail(_0x16efec)){_0x7ee676[_0xdf58('0x20')]('\x22'+_0x16efec+'\x22');}else{_0x39cb1c[_0xdf58('0x20')](_0xdf58('0x90'));}break;case'dateOfBirth':var _0x32ecf5=moment(_0x16efec,_0xdf58('0x91'),!![]);if(_0x32ecf5[_0xdf58('0x8b')]()){_0x7ee676[_0xdf58('0x20')]('\x22'+_0x16efec+'\x22');}else{_0x39cb1c[_0xdf58('0x20')](_0xdf58('0x92'));}break;case'dialTimezone':var _0x513ea9=shared['timezones'];var _0x378f25=_0x513ea9[_0x16efec];if(!_[_0xdf58('0x22')](_0x378f25)){var _0x576910=_0x378f25['utcOffset'];_0x7ee676[_0xdf58('0x20')]('\x22'+_0x16efec+'\x22');_0x7ee676[_0xdf58('0x20')]('\x22'+_0x576910+'\x22');}break;default:_0x7ee676[_0xdf58('0x20')]('\x22'+_0x16efec+'\x22');}}else{switch(_0x24f8ac){case _0xdf58('0x93'):case _0xdf58('0x15'):_0x39cb1c['push'](_0x24f8ac+_0xdf58('0x94'));break;default:_0x7ee676[_0xdf58('0x20')]('\x22\x22');}}}}else{var _0x41b692='';if(!_[_0xdf58('0x22')](_0x376940)){if(!_0x1fcb79[_0xdf58('0x88')](_0x376940['id'])){if(!_[_0xdf58('0x22')](_0xdf0ac0[_0xdf58('0x84')][_0x19f3cf][_0x13ea56[_0x24f8ac]])){var _0x16efec=_[_0xdf58('0x89')](_0xdf0ac0[_0xdf58('0x84')][_0x19f3cf][_0x13ea56[_0x24f8ac]][_0xdf58('0x8a')](/"/g,'\x27'));var _0xc5d9a6=phoneDescriptions[_0xdf58('0x87')](_0x2294d9=>_0x2294d9['itemTypeId']===_0x376940['id']);if(!_['isNil'](_0xc5d9a6)){var _0x1a8871=_['trim'](_0xdf0ac0['data'][_0x19f3cf][_0x13ea56[_0xc5d9a6[_0xdf58('0x95')]]][_0xdf58('0x8a')](/"/g,'\x27'));if(!_[_0xdf58('0x22')](_0x1a8871))_0x16efec=_0x16efec+'§'+_0x1a8871;}if(_0x41b692=='')_0x41b692=_0x16efec;else _0x41b692+='|'+_0x16efec;}_0x1d057e['push'](_0x376940['id']+':'+_0x41b692);_0x1fcb79[_0x376940['id']]=0x1;}}}}if(hasAdditionalPhones){_0x7ee676[_0xdf58('0x20')]('\x22'+_0x1d057e[_0xdf58('0x1a')](';')+'\x22');}if(_0x39cb1c['length']){handleError(_0xdf0ac0[_0xdf58('0x84')][_0x19f3cf],{'code':_0xdf58('0x96'),'message':_0x39cb1c[_0xdf58('0x1a')]()});}else{fs['appendFileSync'](_0x16bd03,_0x7ee676[_0xdf58('0x1a')]()+'\x0a');}_0x7ee676=[];}if(!(stats[_0xdf58('0x85')]%0xc8)){socket[_0xdf58('0x97')](_0xdf58('0x98')+_0x20c251,stats);stats[_0xdf58('0x86')]=[];}}if(stopped){logger[_0xdf58('0x5f')](_0xdf58('0x99'));_0x180f3b[_0xdf58('0x9a')]();}}catch(_0x5e059c){handleError(_0xdf0ac0['data'][_0x19f3cf],{'code':_0xdf58('0x9b'),'message':_0x5e059c[_0xdf58('0x62')]});logger[_0xdf58('0x61')](_0xdf58('0x9c'),_0x5e059c[_0xdf58('0x62')]);}},'complete':function(){try{var _0x1c4306=[];var _0x342f17=[];var _0x330d76=_0xdf58('0x38');if(_0x1bd8dd[_0xdf58('0x9d')]&&_0x1bd8dd[_0xdf58('0x9d')]['length']){_0x330d76=_0xdf58('0x9e')+_0x20c251;_0x1c4306[_0xdf58('0x20')](_0xdf58('0x9f')+_0x330d76+_0xdf58('0xa0'));}tmp_campaigns=_0xdf58('0xa1')+_0x20c251;tmp_voice_queues=_0xdf58('0xa2')+_0x20c251;_0x342f17[_0xdf58('0x20')](_0xdf58('0x9f')+tmp_campaigns+_0xdf58('0xa3'));_0x342f17[_0xdf58('0x20')]('CREATE\x20TABLE\x20'+tmp_voice_queues+_0xdf58('0xa3'));BPromise[_0xdf58('0xa4')](_0x342f17,handleTZQuery)[_0xdf58('0x1e')](function(_0x28a23c){updateTzCampaigns(_0x1bd8dd['ListId'])[_0xdf58('0x1e')](function(_0x28b576){updateTzVoiceQueues(_0x1bd8dd['ListId'])[_0xdf58('0x1e')](function(_0x5324dd){if(hasTZ)_0x125ca8=_0x125ca8['replace'](_0xdf58('0x73'),_0xdf58('0xa5'));var _0x596390=util[_0xdf58('0x10')]('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',_0x16bd03,_0x330d76,_0x125ca8,_0x1bd8dd['ListId'],_0x1bd8dd['CompanyId']||null,NOW,NOW);if(_[_0xdf58('0x22')](_0x13ea56[_0xdf58('0x49')])){_0x596390+=_0xdf58('0xa6');}_0x1c4306['push'](_0x596390);if(_0x1bd8dd[_0xdf58('0x9d')]&&_0x1bd8dd[_0xdf58('0x9d')]['length']){_0x1c4306[_0xdf58('0x20')](insertCmContact(_0x1bd8dd[_0xdf58('0x44')],_0x330d76,_0x1bd8dd[_0xdf58('0x9d')],_0x13ea56));_0x1c4306[_0xdf58('0x20')](_0xdf58('0xa7')+_0x330d76+';');}BPromise[_0xdf58('0xa4')](_0x1c4306,handleQuery)[_0xdf58('0x1e')](function(_0x2ae9ed){BPromise[_0xdf58('0x71')]([handleAdditionalPhones()])[_0xdf58('0x1e')](function(){_0x1c4306=[];for(var _0x4d9ea1=0x0;_0x4d9ea1\x20\x20');}var _0xc554c=path[_0xdf58('0x1a')](config['root'],_0xdf58('0x7b'),process[_0xdf58('0xb4')][0x2]);if(!fs[_0xdf58('0xb5')](_0xc554c)){throw new Error('file\x20doesn\x27t\x20exists');}var _0x3405a1={};try{_0x3405a1=JSON[_0xdf58('0x82')](process[_0xdf58('0xb4')][0x3]);if(!_0x3405a1[_0xdf58('0x79')]){throw new Error(_0xdf58('0xb6'));}if(!_0x3405a1['binding'][_0xdf58('0x15')]){throw new Error(_0xdf58('0xb7'));}if(!_0x3405a1[_0xdf58('0x79')][_0xdf58('0x93')]){throw new Error('firstName\x20is\x20mandatory');}var _0x130f09=0x0;if(_0x3405a1[_0xdf58('0x79')][_0xdf58('0x4a')]){_0x130f09=0x1;}if(!_0x3405a1[_0xdf58('0x44')]){throw new Error(_0xdf58('0xb8'));}}catch(_0x92b257){throw new Error(_0xdf58('0xb9'));}var _0x590ab4=[];try{_0x590ab4=_[_0xdf58('0xba')](JSON[_0xdf58('0x82')](process['argv'][0x4]),'id');}catch(_0x5d30a6){logger[_0xdf58('0x5f')](_0xdf58('0xbb'));}main(_0xc554c,_0x3405a1,_0x590ab4,_0x130f09);}validate();process['on'](_0xdf58('0xbc'),handleStop);process['on'](_0xdf58('0xbd'),handleUncaughtException); \ No newline at end of file diff --git a/server/components/import/cm/csvUpdates.js b/server/components/import/cm/csvUpdates.js index db4b785..36d977a 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 _0xbaf7=['file\x20doesn\x27t\x20exists','ListId\x20is\x20mandatory','body\x20id\x20mandatory','No\x20agent\x20available','SIGINT','path','lodash','papaparse','util','bluebird','squel','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','import','redis','localhost','socket.io-emitter','format','select','field','phone','from','join','.id\x20=\x20','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','sequelize','select\x20*\x20from\x20','spread','length','isNil','AdditionalPhones','push','all','then','catch','error','split','filter','CmContactHasItem','findOne','update','updated','PHONE','inserted','CmContact','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','insert','cm_hopper','scheduledat','ContactId','ListId','updatedAt','priority','UserId','recallme','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','\x22onlyIfOpen\x22','toString','cm_hopper_black','fromQuery','createdAt','.CmListId\x20=\x20?','ListId\x20=\x20?','cm_hopper.id','cm_contact_has_items.item','cm_contact_has_items.OrderBy','cm_contact_has_items.createdAt','into','cm_hopper_additional_phones','CmHopperId','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','cm_hopper.ListId\x20=\x20?','concat','keys','CompanyId','fields','MIN(id)','min_id','group','info','message','code','main','stringify','start','binding','root','server/files/tmp','.csv','body','ContactItemType','findAll','name','_description','parse','createReadStream','data','rows','errors','find','trim','replace','YYYY-MM-DD\x20HH:mm:ss','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)','\x20not\x20specified','hasOwnProperty','description','SystemRow','appendFileSync','emit','abort','SystemError','step','CREATE\x20TABLE\x20','CIS\x20len',',\x20scheduledAt\x20=\x20NOW()','each','contact','contactId','contactTypeId','orderBy','contact:import:','unlink','exit','complete','argv','arguments\x20\x20\x20','existsSync'];(function(_0x3332c4,_0x475b4f){var _0x4c8d92=function(_0x428db6){while(--_0x428db6){_0x3332c4['push'](_0x3332c4['shift']());}};_0x4c8d92(++_0x475b4f);}(_0xbaf7,0x137));var _0x7baf=function(_0xf1fb44,_0x20e887){_0xf1fb44=_0xf1fb44-0x0;var _0x1d4d36=_0xbaf7[_0xf1fb44];return _0x1d4d36;};'use strict';var fs=require('fs');var path=require(_0x7baf('0x0'));var _=require(_0x7baf('0x1'));var Papa=require(_0x7baf('0x2'));var util=require(_0x7baf('0x3'));var BPromise=require(_0x7baf('0x4'));var moment=require('moment');var squel=require(_0x7baf('0x5'));var Redis=require(_0x7baf('0x6'));var db=require(_0x7baf('0x7'))['db'];var config=require(_0x7baf('0x8'));var logger=require(_0x7baf('0x9'))(_0x7baf('0xa'));config[_0x7baf('0xb')]=_['defaults'](config[_0x7baf('0xb')],{'host':_0x7baf('0xc'),'port':0x18eb});var socket=require(_0x7baf('0xd'))(new Redis(config[_0x7baf('0xb')]));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()[_0x7baf('0xe')]('YYYY-MM-DD\x20HH:mm:ss');var tempTableName='cm_contacts_temp_'+moment()[_0x7baf('0xe')]('YYYYMMDDHHmmss');var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];function isEmail(_0x1e472a){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'](_0x1e472a);}function selectNotIn(_0x59303b,_0x1dd133,_0x1dadf8,_0x1d09c3,_0x48cf41){return squel[_0x7baf('0xf')]()[_0x7baf('0x10')](_0x7baf('0x11'))[_0x7baf('0x12')](_0x1d09c3)[_0x7baf('0x13')](_0x1dd133,null,_0x1dd133+_0x7baf('0x14')+_0x1d09c3+'.'+_0x1dadf8)[_0x7baf('0x15')](_0x1d09c3+'.'+_0x1dadf8+_0x7baf('0x16')+_0x59303b+'.'+_0x1dadf8)['where'](_0x1dd133+_0x7baf('0x17')+_0x48cf41['join']()+')');}function handleAdditionalPhones(){return new Promise(function(_0x38df2e,_0x3be400){promisesAdditionalPhones=[];promisesContact=[];return db[_0x7baf('0x18')]['query'](_0x7baf('0x19')+tempTableName)[_0x7baf('0x1a')](function(_0x2bacad){if(_0x2bacad!==null){var _0x3b70fd=[];for(var _0x4748ca=0x0;_0x4748ca<_0x2bacad[_0x7baf('0x1b')];_0x4748ca++){var _0x184aa5=_0x2bacad[_0x4748ca];if(!_[_0x7baf('0x1c')](_0x184aa5[_0x7baf('0x11')])){if(!_[_0x7baf('0x1c')](_0x184aa5[_0x7baf('0x1d')]))_0x3b70fd[_0x7baf('0x1e')](insertAdditionalPhones(_0x184aa5));promisesContact[_0x7baf('0x1e')]({'contact':_0x184aa5});}}}Promise[_0x7baf('0x1f')](_0x3b70fd)[_0x7baf('0x20')](function(){_0x38df2e({'val':0x1});});})[_0x7baf('0x21')](function(_0x33c58e){logger[_0x7baf('0x22')](_0x33c58e['message']);});});}function insertAdditionalPhones(_0x9a8f82){return new Promise(function(_0x4cb942,_0x4800c4){var _0x3428a4=_0x9a8f82[_0x7baf('0x1d')];if(_[_0x7baf('0x1c')](_0x3428a4))_0x4800c4({'val':0x0});else{var _0xaca134=_0x3428a4[_0x7baf('0x23')](';');var _0xd324a=[];orderBy=0x0;for(var _0x341dbd=0x0;_0x341dbd<_0xaca134[_0x7baf('0x1b')];_0x341dbd++){_0xd324a[_0x7baf('0x1e')](splitAdditionalPhone(_0x9a8f82['id'],_0xaca134[_0x341dbd]));}Promise['all'](_0xd324a)['then'](function(){_0x4cb942({'val':_0xaca134[_0x7baf('0x1b')]});});}});}function splitAdditionalPhone(_0x485171,_0x15eb2a){return new Promise(function(_0x116224,_0xa4bfad){var _0x594094=_0x15eb2a[_0x7baf('0x23')](':');var _0x5cedc5=_0x594094[0x0];var _0x3a7691=_0x594094[0x1];if(_0x3a7691!==''){var _0x539ebf=_0x3a7691[_0x7baf('0x23')]('|');var _0x4f1d52=[];for(var _0x4d64e5=0x0;_0x4d64e5<_0x539ebf[_0x7baf('0x1b')];_0x4d64e5++){if(_0x539ebf[_0x4d64e5]!==''){var _0x5b9c9c=_[_0x7baf('0x24')](promisesAdditionalPhones,{'contactId':_0x485171,'phone':_0x539ebf[_0x4d64e5]});if(_0x5b9c9c[_0x7baf('0x1b')]==0x0){orderBy++;promisesAdditionalPhones[_0x7baf('0x1e')]({'contactId':_0x485171,'contactTypeId':_0x5cedc5,'phone':_0x539ebf[_0x4d64e5],'orderBy':orderBy});}}}_0x116224({'ok':0x1});}else _0x116224({'res':0x0});});}function createAdditionalPhone(_0x1cf5be,_0x1c9f3d,_0x415484,_0x144e9c){var _0x4b0b3b='';var _0x267809='';var _0x34bfd8=_0x415484[_0x7baf('0x23')]('§');_0x4b0b3b=_0x34bfd8[0x0];if(_0x34bfd8[_0x7baf('0x1b')]==0x2)_0x267809=_0x34bfd8[0x1];return new Promise(function(_0x16f8fb,_0x363080){return db[_0x7baf('0x25')][_0x7baf('0x26')]({'where':{'CmContactId':_0x1cf5be,'item':_0x4b0b3b}})[_0x7baf('0x20')](function(_0x54943e){if(_0x54943e){return db[_0x7baf('0x25')][_0x7baf('0x27')]({'ItemTypeId':_0x1c9f3d,'description':_0x267809,'OrderBy':_0x144e9c},{'where':{'CmContactId':_0x1cf5be,'item':_0x4b0b3b}})[_0x7baf('0x20')](function(_0xe3e562){_0x16f8fb({'res':_0x7baf('0x28')});});}else{return db[_0x7baf('0x25')]['create']({'CmContactId':_0x1cf5be,'item':_0x4b0b3b,'ItemTypeId':_0x1c9f3d,'description':_0x267809,'OrderBy':_0x144e9c,'ItemClass':_0x7baf('0x29')})[_0x7baf('0x20')](function(_0x4cf568){_0x16f8fb({'res':_0x7baf('0x2a')});});}});});}function updateContact(_0xddaebf){return new Promise(function(_0x335f97,_0x29da9d){var _0x5898a0=_0xddaebf['id'];delete _0xddaebf['id'];return db[_0x7baf('0x2b')][_0x7baf('0x27')](_0xddaebf,{'where':{'id':_0x5898a0}})[_0x7baf('0x20')](function(_0x39c124){updatedRows+=0x1;return db['CmHopper'][_0x7baf('0x27')]({'phone':_0xddaebf['phone']},{'where':{'ContactId':_0x5898a0}})[_0x7baf('0x20')](function(_0x42d1a3){_0x335f97({'ret':'OK'});});});});}function insertCmHopper(_0x2c9256,_0x480e6d,_0x40fcdd,_0x5893ac,_0x45b29c){var _0x4a07cc=[_0x7baf('0x2c'),_0x7baf('0x2d'),_0x7baf('0x2e'),_0x7baf('0x2f'),_0x480e6d+'.'+_0x5893ac,_0x7baf('0x30'),_0x7baf('0x31'),_0x7baf('0x32'),'cm_contacts.UserId','\x22'+_0x45b29c+'\x22'];return squel[_0x7baf('0x33')]()['into'](_0x7baf('0x34'))['fromQuery']([_0x7baf('0x11'),_0x7baf('0x35'),_0x7baf('0x36'),_0x7baf('0x37'),_0x5893ac,'createdAt',_0x7baf('0x38'),_0x7baf('0x39'),_0x7baf('0x3a'),_0x7baf('0x3b')],squel[_0x7baf('0xf')]()['fields'](_0x4a07cc)[_0x7baf('0x12')](_0x480e6d)[_0x7baf('0x13')](_0x7baf('0x3c'),null,_0x7baf('0x3d')+_0x480e6d+_0x7baf('0x3e'))[_0x7baf('0x13')](_0x40fcdd,null,_0x40fcdd+'.id\x20=\x20'+_0x480e6d+'.'+_0x5893ac)['where'](_0x480e6d+'.CmListId\x20=\x20?',_0x2c9256)[_0x7baf('0x15')](_0x7baf('0x3f'),NOW)[_0x7baf('0x15')](_0x7baf('0x40'),selectNotIn(_0x480e6d,_0x40fcdd,_0x5893ac,_0x7baf('0x34'),[_0x7baf('0x41'),_0x7baf('0x42')]))['where'](_0x7baf('0x40'),selectNotIn(_0x480e6d,_0x40fcdd,_0x5893ac,'cm_hopper',[_0x7baf('0x41')])))[_0x7baf('0x43')]();}function insertCmHopperBlack(_0xa98a9b,_0x4793c7,_0x5f0326,_0x2f225e){var _0x273b43=['cm_contacts.phone','cm_contacts.id','cm_contacts.ListId',_0x4793c7+'.'+_0x2f225e,'cm_contacts.createdAt',_0x7baf('0x31')];return squel[_0x7baf('0x33')]()['into'](_0x7baf('0x44'))[_0x7baf('0x45')](['phone','ContactId','ListId',_0x2f225e,_0x7baf('0x46'),_0x7baf('0x38')],squel[_0x7baf('0xf')]()['fields'](_0x273b43)[_0x7baf('0x12')](_0x4793c7)['join'](_0x7baf('0x3c'),null,'cm_contacts.ListId\x20=\x20'+_0x4793c7+_0x7baf('0x3e'))[_0x7baf('0x13')](_0x5f0326,null,_0x5f0326+'.id\x20=\x20'+_0x4793c7+'.'+_0x2f225e)[_0x7baf('0x15')](_0x4793c7+_0x7baf('0x47'),_0xa98a9b)[_0x7baf('0x15')](_0x7baf('0x3f'),NOW)[_0x7baf('0x15')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel['select']()[_0x7baf('0x10')]('phone')[_0x7baf('0x12')](_0x7baf('0x44'))[_0x7baf('0x15')](_0x7baf('0x48'),_0xa98a9b)[_0x7baf('0x15')](_0x2f225e+'\x20=\x20?',_0x4793c7+'.'+_0x2f225e)))[_0x7baf('0x43')]();}function insertCmHopperAdditionalPhones(_0x4ab023){var _0x20628d=[_0x7baf('0x49'),_0x7baf('0x4a'),_0x7baf('0x4b'),_0x7baf('0x4c'),'cm_contact_has_items.updatedAt'];return squel[_0x7baf('0x33')]()[_0x7baf('0x4d')](_0x7baf('0x4e'))['fromQuery']([_0x7baf('0x4f'),_0x7baf('0x11'),'OrderBy',_0x7baf('0x46'),_0x7baf('0x38')],squel['select']()['fields'](_0x20628d)[_0x7baf('0x12')](_0x7baf('0x34'))[_0x7baf('0x13')](_0x7baf('0x3c'),null,'cm_contacts.id\x20=\x20cm_hopper.ContactId')['join']('cm_contact_has_items',null,_0x7baf('0x50'))[_0x7baf('0x15')](_0x7baf('0x51'),_0x4ab023)[_0x7baf('0x15')](_0x7baf('0x3f'),NOW))[_0x7baf('0x43')]();}function insertCmContact(_0x41d022,_0x1fb86f,_0x42ca0d,_0x788c5d){var _0x142a55=_[_0x7baf('0x52')](_[_0x7baf('0x53')](_0x788c5d),[_0x7baf('0x37'),_0x7baf('0x54'),_0x7baf('0x46'),_0x7baf('0x38')]);return squel['insert']()['into'](_0x7baf('0x3c'))[_0x7baf('0x45')](_0x142a55,squel['select']()['fields'](_0x142a55)[_0x7baf('0x12')](_0x1fb86f)[_0x7baf('0x15')]('('+_0x42ca0d['join'](',')+')\x20NOT\x20IN\x20?',squel[_0x7baf('0xf')]()[_0x7baf('0x55')](_0x42ca0d)['from']('cm_contacts')['where']('ListId\x20=\x20?',_0x41d022))[_0x7baf('0x15')]('id\x20IN\x20?',squel[_0x7baf('0xf')]()[_0x7baf('0x10')](_0x7baf('0x56'),_0x7baf('0x57'))['from'](_0x1fb86f)[_0x7baf('0x58')](_0x42ca0d['join'](','))))[_0x7baf('0x43')]();}function handleStop(){logger[_0x7baf('0x59')]('Received\x20SIGINT');stopped=!![];}function handleUncaughtException(_0x393e78){logger['error'](_0x393e78[_0x7baf('0x5a')]);process['exit'](0x1);}function handleError(_0x7ae1d5,_0x3b82a5){stats['errors'][_0x7baf('0x1e')]({'name':_0x3b82a5[_0x7baf('0x5b')],'message':_0x3b82a5[_0x7baf('0x5a')],'row':_0x7ae1d5});}function handleQuery(_0x280c87){logger['info'](_0x280c87);return db['sequelize']['query'](_0x280c87)[_0x7baf('0x1a')](function(_0x6fd6c2){results['push'](_0x6fd6c2);})['catch'](function(_0x5dc42d){logger[_0x7baf('0x22')](_0x5dc42d[_0x7baf('0x5a')]);});}function main(_0x39bee7,_0x300248,_0x331781,_0x111321){logger['info'](_0x7baf('0x5c'),_0x39bee7,JSON[_0x7baf('0x5d')](_0x300248));process['send'](_0x7baf('0x5e'));var _0x415003=_0x300248[_0x7baf('0x5f')];var _0x2730f2=_['clone'](_0x415003);var _0xa0c0c4=_0x300248['socket_timestamp'];var _0x12a030=path[_0x7baf('0x13')](config[_0x7baf('0x60')],_0x7baf('0x61'),_0xa0c0c4+_0x7baf('0x62'));logger[_0x7baf('0x59')](_0x7baf('0x63'),_0x300248);db[_0x7baf('0x64')][_0x7baf('0x65')]({'raw':!![],'attributes':['id',_0x7baf('0x66')]})[_0x7baf('0x20')](function(_0x570a9b){for(var _0x2cca09=0x0;_0x2cca09<_0x570a9b[_0x7baf('0x1b')];_0x2cca09++){if(_0x570a9b[_0x2cca09][_0x7baf('0x66')]in _0x415003){contactItemTypes['push'](_0x570a9b[_0x2cca09]);delete _0x2730f2[_0x570a9b[_0x2cca09][_0x7baf('0x66')]];hasAdditionalPhones=!![];}for(var _0x26560a in _0x415003){if(_0x570a9b[_0x2cca09][_0x7baf('0x66')]+_0x7baf('0x67')===_0x26560a){phoneDescriptions[_0x7baf('0x1e')]({'itemTypeId':_0x570a9b[_0x2cca09]['id'],'description':_0x26560a});delete _0x2730f2[_0x26560a];}}}if(hasAdditionalPhones)_0x2730f2[_0x7baf('0x1d')]='';var _0x5da221=_[_0x7baf('0x53')](_0x2730f2)[_0x7baf('0x13')]();logger[_0x7baf('0x59')]('header',_0x5da221);fs['writeFileSync'](_0x12a030,_0x5da221+'\x0a');Papa[_0x7baf('0x68')](fs[_0x7baf('0x69')](_0x39bee7),{'header':!![],'skipEmptyLines':!![],'step':function(_0x44c330,_0x2f862d){try{for(var _0x499dda=0x0,_0x1bf0c3=[];_0x499dda<_0x44c330[_0x7baf('0x6a')]['length'];_0x499dda++){stats[_0x7baf('0x6b')]+=0x1;if(_0x44c330['errors'][_0x499dda]){handleError(_0x44c330[_0x7baf('0x6a')][_0x499dda],_0x44c330[_0x7baf('0x6c')][_0x499dda]);}else{var _0x208fd6=[];var _0x3c3ab4=[];var _0x1a8eb0={};for(var _0x1dbbe6 in _0x415003){let _0x172661=contactItemTypes[_0x7baf('0x6d')](_0x41682a=>_0x41682a[_0x7baf('0x66')]===_0x1dbbe6);let _0x53bb0b=contactItemTypes[_0x7baf('0x6d')](_0x4005e8=>_0x4005e8[_0x7baf('0x66')]+_0x7baf('0x67')===_0x1dbbe6);if(_[_0x7baf('0x1c')](_0x172661)&&_[_0x7baf('0x1c')](_0x53bb0b)){if(_0x415003['hasOwnProperty'](_0x1dbbe6)){if(_0x44c330[_0x7baf('0x6a')][_0x499dda][_0x415003[_0x1dbbe6]]){var _0x4fce7f=_[_0x7baf('0x6e')](_0x44c330[_0x7baf('0x6a')][_0x499dda][_0x415003[_0x1dbbe6]][_0x7baf('0x6f')](/"/g,'\x27'));switch(_0x1dbbe6){case'scheduledat':var _0x238c23=moment(_0x4fce7f,_0x7baf('0x70'),!![]);if(_0x238c23[_0x7baf('0x71')]()){_0x1bf0c3[_0x7baf('0x1e')]('\x22'+_0x4fce7f+'\x22');}else{_0x208fd6[_0x7baf('0x1e')](_0x7baf('0x72'));}break;case'priority':var _0x5c8210=parseInt(_0x4fce7f);_0x4fce7f=_[_0x7baf('0x73')](_0x5c8210)||_0x5c8210<0x0||_0x5c8210>0x4?_0x111321?0x3:0x2:_0x5c8210;_0x1bf0c3[_0x7baf('0x1e')]('\x22'+_0x4fce7f+'\x22');break;case'UserId':var _0x486b69=parseInt(_0x4fce7f);if(_[_0x7baf('0x74')](_0x486b69)&&_[_0x7baf('0x75')](_0x331781,_0x486b69)){_0x1bf0c3[_0x7baf('0x1e')]('\x22'+_0x486b69+'\x22');}else{_0x208fd6[_0x7baf('0x1e')](_0x7baf('0x76'));}break;case _0x7baf('0x77'):if(isEmail(_0x4fce7f)){_0x1bf0c3[_0x7baf('0x1e')]('\x22'+_0x4fce7f+'\x22');}else{_0x208fd6[_0x7baf('0x1e')](_0x7baf('0x78'));}break;case _0x7baf('0x79'):var _0x5af0b2=moment(_0x4fce7f,_0x7baf('0x7a'),!![]);if(_0x5af0b2[_0x7baf('0x71')]()){_0x1bf0c3[_0x7baf('0x1e')]('\x22'+_0x4fce7f+'\x22');}else{_0x208fd6['push'](_0x7baf('0x7b'));}break;default:_0x1bf0c3[_0x7baf('0x1e')]('\x22'+_0x4fce7f+'\x22');}}else{switch(_0x1dbbe6){case'firstName':case'phone':_0x208fd6['push'](_0x1dbbe6+_0x7baf('0x7c'));break;default:_0x1bf0c3[_0x7baf('0x1e')]('\x22\x22');}}}}else{var _0x18d5da='';if(!_[_0x7baf('0x1c')](_0x172661)){if(!_0x1a8eb0[_0x7baf('0x7d')](_0x172661['id'])){for(var _0x2b5c1e=0x0;_0x2b5c1e<_0x415003[_0x1dbbe6][_0x7baf('0x1b')];_0x2b5c1e++){var _0x4fce7f=_[_0x7baf('0x6e')](_0x44c330['data'][_0x499dda][_0x415003[_0x1dbbe6][_0x2b5c1e]][_0x7baf('0x6f')](/"/g,'\x27'));var _0x2b801c=phoneDescriptions[_0x7baf('0x6d')](_0x2d3cf0=>_0x2d3cf0['itemTypeId']===_0x172661['id']);if(!_[_0x7baf('0x1c')](_0x2b801c)){var _0x3a7702=_[_0x7baf('0x6e')](_0x44c330[_0x7baf('0x6a')][_0x499dda][_0x415003[_0x2b801c[_0x7baf('0x7e')]][0x0]][_0x7baf('0x6f')](/"/g,'\x27'));if(!_[_0x7baf('0x1c')](_0x3a7702))_0x4fce7f=_0x4fce7f+'§'+_0x3a7702;}if(_0x18d5da=='')_0x18d5da=_0x4fce7f;else _0x18d5da+='|'+_0x4fce7f;}_0x3c3ab4['push'](_0x172661['id']+':'+_0x18d5da);_0x1a8eb0[_0x172661['id']]=0x1;}}}}if(hasAdditionalPhones){_0x1bf0c3[_0x7baf('0x1e')]('\x22'+_0x3c3ab4[_0x7baf('0x13')](';')+'\x22');}if(_0x208fd6[_0x7baf('0x1b')]){handleError(_0x44c330['data'][_0x499dda],{'code':_0x7baf('0x7f'),'message':_0x208fd6['join']()});}else{fs[_0x7baf('0x80')](_0x12a030,_0x1bf0c3[_0x7baf('0x13')]()+'\x0a');}_0x1bf0c3=[];}if(!(stats[_0x7baf('0x6b')]%0xc8)){socket[_0x7baf('0x81')]('contact:import:'+_0xa0c0c4,stats);stats[_0x7baf('0x6c')]=[];}}if(stopped){logger[_0x7baf('0x59')]('Abort\x20parser');_0x2f862d[_0x7baf('0x82')]();}}catch(_0x53fe1c){handleError(_0x44c330[_0x7baf('0x6a')][_0x499dda],{'code':_0x7baf('0x83'),'message':_0x53fe1c[_0x7baf('0x5a')]});logger[_0x7baf('0x22')](_0x7baf('0x84'),_0x53fe1c['message']);}},'complete':function(){try{var _0x3b6cf0=[];var _0x599487=tempTableName;_0x3b6cf0[_0x7baf('0x1e')](_0x7baf('0x85')+_0x599487+'\x20LIKE\x20cm_contacts;');logger['info'](_0x7baf('0x86'),contactItemTypes[_0x7baf('0x1b')]);var _0x2bf60f=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\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27',_0x12a030,_0x599487,_0x5da221,_0x300248[_0x7baf('0x37')],_0x300248[_0x7baf('0x54')]||null,NOW,NOW);if(_[_0x7baf('0x1c')](_0x415003['scheduledat'])){_0x2bf60f+=_0x7baf('0x87');}_0x3b6cf0['push'](_0x2bf60f);BPromise[_0x7baf('0x88')](_0x3b6cf0,handleQuery)['then'](function(_0x30b9a9){BPromise[_0x7baf('0x1f')]([handleAdditionalPhones()])['then'](function(){_0x3b6cf0=[];for(var _0x23d115=0x0;_0x23d115_0xd28c15[_0x7147('0x69')]===_0x2177e1);let _0x520da9=contactItemTypes[_0x7147('0x70')](_0x198eac=>_0x198eac[_0x7147('0x69')]+_0x7147('0x6a')===_0x2177e1);if(_['isNil'](_0x1471f4)&&_['isNil'](_0x520da9)){if(_0x344709[_0x7147('0x71')](_0x2177e1)){if(_0x539c19['data'][_0x535c79][_0x344709[_0x2177e1]]){var _0xd300b5=_[_0x7147('0x72')](_0x539c19[_0x7147('0x6f')][_0x535c79][_0x344709[_0x2177e1]][_0x7147('0x73')](/"/g,'\x27'));switch(_0x2177e1){case _0x7147('0x35'):var _0x394cd6=moment(_0xd300b5,_0x7147('0xc'),!![]);if(_0x394cd6[_0x7147('0x74')]()){_0x5249a6['push']('\x22'+_0xd300b5+'\x22');}else{_0x4a6721[_0x7147('0x1b')]('scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)');}break;case _0x7147('0x75'):var _0x48bfe9=parseInt(_0xd300b5);_0xd300b5=_['isNaN'](_0x48bfe9)||_0x48bfe9<0x0||_0x48bfe9>0x4?_0x2afd97?0x3:0x2:_0x48bfe9;_0x5249a6[_0x7147('0x1b')]('\x22'+_0xd300b5+'\x22');break;case _0x7147('0x76'):var _0x2980bf=parseInt(_0xd300b5);if(_[_0x7147('0x77')](_0x2980bf)&&_[_0x7147('0x78')](_0x1add4a,_0x2980bf)){_0x5249a6[_0x7147('0x1b')]('\x22'+_0x2980bf+'\x22');}else{_0x4a6721[_0x7147('0x1b')](_0x7147('0x79'));}break;case _0x7147('0x7a'):if(isEmail(_0xd300b5)){_0x5249a6[_0x7147('0x1b')]('\x22'+_0xd300b5+'\x22');}else{_0x4a6721['push'](_0x7147('0x7b'));}break;case _0x7147('0x7c'):var _0x4cddc2=moment(_0xd300b5,_0x7147('0x7d'),!![]);if(_0x4cddc2['isValid']()){_0x5249a6[_0x7147('0x1b')]('\x22'+_0xd300b5+'\x22');}else{_0x4a6721[_0x7147('0x1b')](_0x7147('0x7e'));}break;default:_0x5249a6[_0x7147('0x1b')]('\x22'+_0xd300b5+'\x22');}}else{switch(_0x2177e1){case'firstName':case _0x7147('0x11'):_0x4a6721[_0x7147('0x1b')](_0x2177e1+'\x20not\x20specified');break;default:_0x5249a6[_0x7147('0x1b')]('\x22\x22');}}}}else{var _0x418be0='';if(!_[_0x7147('0x21')](_0x1471f4)){if(!_0x31747f['hasOwnProperty'](_0x1471f4['id'])){for(var _0x1f38df=0x0;_0x1f38df<_0x344709[_0x2177e1][_0x7147('0x1a')];_0x1f38df++){var _0xd300b5=_['trim'](_0x539c19[_0x7147('0x6f')][_0x535c79][_0x344709[_0x2177e1][_0x1f38df]][_0x7147('0x73')](/"/g,'\x27'));var _0x29838c=phoneDescriptions['find'](_0x277f1f=>_0x277f1f[_0x7147('0x7f')]===_0x1471f4['id']);if(!_[_0x7147('0x21')](_0x29838c)){var _0x247d73=_[_0x7147('0x72')](_0x539c19[_0x7147('0x6f')][_0x535c79][_0x344709[_0x29838c[_0x7147('0x80')]][0x0]][_0x7147('0x73')](/"/g,'\x27'));if(!_[_0x7147('0x21')](_0x247d73))_0xd300b5=_0xd300b5+'§'+_0x247d73;}if(_0x418be0=='')_0x418be0=_0xd300b5;else _0x418be0+='|'+_0xd300b5;}_0x3f1d2f[_0x7147('0x1b')](_0x1471f4['id']+':'+_0x418be0);_0x31747f[_0x1471f4['id']]=0x1;}}}}if(hasAdditionalPhones){_0x5249a6[_0x7147('0x1b')]('\x22'+_0x3f1d2f[_0x7147('0x3a')](';')+'\x22');}if(_0x4a6721[_0x7147('0x1a')]){handleError(_0x539c19[_0x7147('0x6f')][_0x535c79],{'code':_0x7147('0x81'),'message':_0x4a6721[_0x7147('0x3a')]()});}else{fs[_0x7147('0x82')](_0x228d05,_0x5249a6[_0x7147('0x3a')]()+'\x0a');}_0x5249a6=[];}if(!(stats[_0x7147('0x83')]%0xc8)){socket[_0x7147('0x84')]('contact:import:'+_0x2fcdfc,stats);stats[_0x7147('0x5b')]=[];}}if(stopped){logger['info'](_0x7147('0x85'));_0x2f6bb8[_0x7147('0x86')]();}}catch(_0x1079b9){handleError(_0x539c19[_0x7147('0x6f')][_0x535c79],{'code':_0x7147('0x87'),'message':_0x1079b9[_0x7147('0x5a')]});logger[_0x7147('0x1f')](_0x7147('0x88'),_0x1079b9[_0x7147('0x5a')]);}},'complete':function(){try{var _0x1784f9=[];var _0x3f7f41=tempTableName;_0x1784f9[_0x7147('0x1b')](_0x7147('0x89')+_0x3f7f41+_0x7147('0x8a'));logger[_0x7147('0x5d')](_0x7147('0x8b'),contactItemTypes[_0x7147('0x1a')]);var _0x36cb3c=util[_0x7147('0x8c')](_0x7147('0x8d'),_0x228d05,_0x3f7f41,_0x13f87a,_0x2b11ce[_0x7147('0x36')],_0x2b11ce[_0x7147('0x8e')]||null,NOW,NOW);if(_[_0x7147('0x21')](_0x344709['scheduledat'])){_0x36cb3c+=_0x7147('0x8f');}_0x1784f9[_0x7147('0x1b')](_0x36cb3c);BPromise['each'](_0x1784f9,handleQuery)[_0x7147('0x1d')](function(_0x18897f){BPromise[_0x7147('0x1c')]([handleAdditionalPhones()])[_0x7147('0x1d')](function(){_0x1784f9=[];for(var _0x25697f=0x0;_0x25697f\x20\x20');}var _0x1f291e=path[_0x7147('0x3a')](config[_0x7147('0x65')],'server/files/tmp',process[_0x7147('0x99')][0x2]);if(!fs['existsSync'](_0x1f291e)){throw new Error(_0x7147('0x9a'));}var _0x5a3cec={};try{_0x5a3cec=JSON[_0x7147('0x6d')](process[_0x7147('0x99')][0x3]);if(!_0x5a3cec['binding']){throw new Error(_0x7147('0x9b'));}var _0x201875=0x0;if(_0x5a3cec[_0x7147('0x62')][_0x7147('0x76')]){_0x201875=0x1;}if(!_0x5a3cec[_0x7147('0x36')]){throw new Error(_0x7147('0x9c'));}}catch(_0x33c133){throw new Error(_0x7147('0x9d'));}var _0x36f5bc=[];try{_0x36f5bc=_[_0x7147('0x9e')](JSON['parse'](process[_0x7147('0x99')][0x4]),'id');}catch(_0x4cbb0d){logger[_0x7147('0x5d')]('No\x20agent\x20available');}main(_0x1f291e,_0x5a3cec,_0x36f5bc,_0x201875);}validate();process['on'](_0x7147('0x9f'),handleStop);process['on'](_0x7147('0xa0'),handleUncaughtException); \ No newline at end of file diff --git a/server/components/integrations/configuration.js b/server/components/integrations/configuration.js index f04a9fd..7329ff0 100644 --- a/server/components/integrations/configuration.js +++ b/server/components/integrations/configuration.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcf34=['destcalleridnum','voice','inbound','***\x20Call\x20Info\x20***','keyValue','Caller\x20Number','Caller\x20Name','calleridname','Call\x20To','Queue','UniqueId','Date','***\x20Agent\x20Info\x20***','Agent\x20Name','destcalleridname','Agent\x20Number','***\x20Time\x20Info\x20***','Agent\x20Ring','Agent\x20Connect','agentconnectAt','agentcompleteAt','Hold\x20Time','holdtime','Talk\x20Time','talktime','Member\x20Name','membername','uniqueid','starttime','Answer\x20Time','answertime','Complete\x20Time','endtime','Duration','duration','billableseconds','string','[xCALLY\x20Ticket]','toLowerCase','push','variable','queue','calleridnum','outbound'];(function(_0x52b2b0,_0xab9f95){var _0x2ffed8=function(_0x2e0b3c){while(--_0x2e0b3c){_0x52b2b0['push'](_0x52b2b0['shift']());}};_0x2ffed8(++_0xab9f95);}(_0xcf34,0x158));var _0x4cf3=function(_0xf26c2e,_0x56c3ea){_0xf26c2e=_0xf26c2e-0x0;var _0x46ecb4=_0xcf34[_0xf26c2e];return _0x46ecb4;};'use strict';exports['getSubjects']=function(_0x2a1540,_0x3e6306){var _0x530ae2=[{'type':_0x4cf3('0x0'),'content':_0x4cf3('0x1'),'variableName':null}];switch(_0x2a1540[_0x4cf3('0x2')]()){case'voice':switch(_0x3e6306[_0x4cf3('0x2')]()){case'inbound':_0x530ae2[_0x4cf3('0x3')]({'type':_0x4cf3('0x4'),'content':'','variableName':_0x4cf3('0x5')});_0x530ae2[_0x4cf3('0x3')]({'type':'variable','content':'','variableName':_0x4cf3('0x6')});break;case _0x4cf3('0x7'):_0x530ae2[_0x4cf3('0x3')]({'type':_0x4cf3('0x0'),'content':'Outbound\x20Call','variableName':null});_0x530ae2[_0x4cf3('0x3')]({'type':'variable','content':'','variableName':_0x4cf3('0x8')});break;}}return _0x530ae2;};exports['getDescriptions']=function(_0x257efe,_0x1291fc){var _0x44d49a=[];switch(_0x257efe['toLowerCase']()){case _0x4cf3('0x9'):switch(_0x1291fc['toLowerCase']()){case _0x4cf3('0xa'):_0x44d49a=[{'type':_0x4cf3('0x0'),'content':_0x4cf3('0xb'),'key':null,'keyType':null,'variableName':null},{'type':_0x4cf3('0xc'),'content':'','key':_0x4cf3('0xd'),'keyType':_0x4cf3('0x4'),'variableName':'calleridnum'},{'type':'keyValue','content':'','key':_0x4cf3('0xe'),'keyType':_0x4cf3('0x4'),'variableName':_0x4cf3('0xf')},{'type':_0x4cf3('0xc'),'content':'','key':_0x4cf3('0x10'),'keyType':_0x4cf3('0x4'),'variableName':'destexten'},{'type':_0x4cf3('0xc'),'content':'','key':_0x4cf3('0x11'),'keyType':'variable','variableName':_0x4cf3('0x5')},{'type':_0x4cf3('0xc'),'content':'','key':_0x4cf3('0x12'),'keyType':_0x4cf3('0x4'),'variableName':'uniqueid'},{'type':'keyValue','content':'','key':_0x4cf3('0x13'),'keyType':_0x4cf3('0x4'),'variableName':'agentcalledAt'},{'type':_0x4cf3('0x0'),'content':_0x4cf3('0x14'),'key':null,'keyType':null,'variableName':null},{'type':'keyValue','content':'','key':_0x4cf3('0x15'),'keyType':_0x4cf3('0x4'),'variableName':_0x4cf3('0x16')},{'type':_0x4cf3('0xc'),'content':'','key':_0x4cf3('0x17'),'keyType':_0x4cf3('0x4'),'variableName':_0x4cf3('0x8')},{'type':_0x4cf3('0x0'),'content':_0x4cf3('0x18'),'key':null,'keyType':null,'variableName':null},{'type':_0x4cf3('0xc'),'content':'','key':_0x4cf3('0x19'),'keyType':'variable','variableName':'agentcalledAt'},{'type':'keyValue','content':'','key':_0x4cf3('0x1a'),'keyType':_0x4cf3('0x4'),'variableName':_0x4cf3('0x1b')},{'type':_0x4cf3('0xc'),'content':'','key':'Agent\x20Complete','keyType':_0x4cf3('0x4'),'variableName':_0x4cf3('0x1c')},{'type':_0x4cf3('0xc'),'content':'','key':_0x4cf3('0x1d'),'keyType':_0x4cf3('0x4'),'variableName':_0x4cf3('0x1e')},{'type':'keyValue','content':'','key':_0x4cf3('0x1f'),'keyType':_0x4cf3('0x4'),'variableName':_0x4cf3('0x20')}];break;case _0x4cf3('0x7'):_0x44d49a=[{'type':_0x4cf3('0x0'),'content':_0x4cf3('0xb'),'variableName':null},{'type':_0x4cf3('0xc'),'content':'','key':'Called\x20Number','keyType':_0x4cf3('0x4'),'keyContent':'','variableName':_0x4cf3('0x8')},{'type':_0x4cf3('0xc'),'content':'','key':_0x4cf3('0x21'),'keyType':_0x4cf3('0x4'),'keyContent':'','variableName':_0x4cf3('0x22')},{'type':_0x4cf3('0xc'),'content':'','key':_0x4cf3('0x12'),'keyType':_0x4cf3('0x4'),'keyContent':'','variableName':_0x4cf3('0x23')},{'type':_0x4cf3('0xc'),'content':'','key':_0x4cf3('0x13'),'keyType':_0x4cf3('0x4'),'keyContent':'','variableName':_0x4cf3('0x24')},{'type':'string','content':_0x4cf3('0x18')},{'type':_0x4cf3('0xc'),'content':'','key':_0x4cf3('0x25'),'keyType':_0x4cf3('0x4'),'keyContent':'','variableName':_0x4cf3('0x26')},{'type':'keyValue','content':'','key':_0x4cf3('0x27'),'keyType':_0x4cf3('0x4'),'keyContent':'','variableName':_0x4cf3('0x28')},{'type':_0x4cf3('0xc'),'content':'','key':_0x4cf3('0x29'),'keyType':_0x4cf3('0x4'),'keyContent':'','variableName':_0x4cf3('0x2a')},{'type':_0x4cf3('0xc'),'content':'','key':'Billable\x20Time','keyType':_0x4cf3('0x4'),'keyContent':'','variableName':_0x4cf3('0x2b')}];break;}}return _0x44d49a;}; \ No newline at end of file +var _0x12c9=['endtime','Duration','duration','getSubjects','string','toLowerCase','voice','inbound','variable','queue','push','outbound','destcalleridnum','getDescriptions','keyValue','Caller\x20Number','calleridnum','calleridname','Call\x20To','UniqueId','uniqueid','Date','agentcalledAt','destcalleridname','***\x20Time\x20Info\x20***','Agent\x20Connect','agentconnectAt','agentcompleteAt','Hold\x20Time','holdtime','Talk\x20Time','talktime','***\x20Call\x20Info\x20***','Called\x20Number','Member\x20Name','membername','starttime','Answer\x20Time','answertime','Complete\x20Time'];(function(_0x38af48,_0x400460){var _0x445384=function(_0x464435){while(--_0x464435){_0x38af48['push'](_0x38af48['shift']());}};_0x445384(++_0x400460);}(_0x12c9,0x7b));var _0x912c=function(_0x594d26,_0x2e56d1){_0x594d26=_0x594d26-0x0;var _0x4ca838=_0x12c9[_0x594d26];return _0x4ca838;};'use strict';exports[_0x912c('0x0')]=function(_0x4c4521,_0xb38bbe){var _0x1e4a91=[{'type':_0x912c('0x1'),'content':'[xCALLY\x20Ticket]','variableName':null}];switch(_0x4c4521[_0x912c('0x2')]()){case _0x912c('0x3'):switch(_0xb38bbe['toLowerCase']()){case _0x912c('0x4'):_0x1e4a91['push']({'type':_0x912c('0x5'),'content':'','variableName':_0x912c('0x6')});_0x1e4a91[_0x912c('0x7')]({'type':_0x912c('0x5'),'content':'','variableName':'calleridnum'});break;case _0x912c('0x8'):_0x1e4a91['push']({'type':_0x912c('0x1'),'content':'Outbound\x20Call','variableName':null});_0x1e4a91[_0x912c('0x7')]({'type':_0x912c('0x5'),'content':'','variableName':_0x912c('0x9')});break;}}return _0x1e4a91;};exports[_0x912c('0xa')]=function(_0x5368ff,_0x29f882){var _0x147bb5=[];switch(_0x5368ff[_0x912c('0x2')]()){case _0x912c('0x3'):switch(_0x29f882[_0x912c('0x2')]()){case'inbound':_0x147bb5=[{'type':_0x912c('0x1'),'content':'***\x20Call\x20Info\x20***','key':null,'keyType':null,'variableName':null},{'type':_0x912c('0xb'),'content':'','key':_0x912c('0xc'),'keyType':_0x912c('0x5'),'variableName':_0x912c('0xd')},{'type':_0x912c('0xb'),'content':'','key':'Caller\x20Name','keyType':_0x912c('0x5'),'variableName':_0x912c('0xe')},{'type':_0x912c('0xb'),'content':'','key':_0x912c('0xf'),'keyType':'variable','variableName':'destexten'},{'type':_0x912c('0xb'),'content':'','key':'Queue','keyType':_0x912c('0x5'),'variableName':_0x912c('0x6')},{'type':'keyValue','content':'','key':_0x912c('0x10'),'keyType':_0x912c('0x5'),'variableName':_0x912c('0x11')},{'type':_0x912c('0xb'),'content':'','key':_0x912c('0x12'),'keyType':_0x912c('0x5'),'variableName':_0x912c('0x13')},{'type':'string','content':'***\x20Agent\x20Info\x20***','key':null,'keyType':null,'variableName':null},{'type':_0x912c('0xb'),'content':'','key':'Agent\x20Name','keyType':_0x912c('0x5'),'variableName':_0x912c('0x14')},{'type':_0x912c('0xb'),'content':'','key':'Agent\x20Number','keyType':_0x912c('0x5'),'variableName':_0x912c('0x9')},{'type':_0x912c('0x1'),'content':_0x912c('0x15'),'key':null,'keyType':null,'variableName':null},{'type':_0x912c('0xb'),'content':'','key':'Agent\x20Ring','keyType':_0x912c('0x5'),'variableName':_0x912c('0x13')},{'type':_0x912c('0xb'),'content':'','key':_0x912c('0x16'),'keyType':_0x912c('0x5'),'variableName':_0x912c('0x17')},{'type':'keyValue','content':'','key':'Agent\x20Complete','keyType':_0x912c('0x5'),'variableName':_0x912c('0x18')},{'type':'keyValue','content':'','key':_0x912c('0x19'),'keyType':_0x912c('0x5'),'variableName':_0x912c('0x1a')},{'type':_0x912c('0xb'),'content':'','key':_0x912c('0x1b'),'keyType':'variable','variableName':_0x912c('0x1c')}];break;case _0x912c('0x8'):_0x147bb5=[{'type':_0x912c('0x1'),'content':_0x912c('0x1d'),'variableName':null},{'type':_0x912c('0xb'),'content':'','key':_0x912c('0x1e'),'keyType':_0x912c('0x5'),'keyContent':'','variableName':_0x912c('0x9')},{'type':'keyValue','content':'','key':_0x912c('0x1f'),'keyType':'variable','keyContent':'','variableName':_0x912c('0x20')},{'type':'keyValue','content':'','key':'UniqueId','keyType':_0x912c('0x5'),'keyContent':'','variableName':'uniqueid'},{'type':'keyValue','content':'','key':_0x912c('0x12'),'keyType':_0x912c('0x5'),'keyContent':'','variableName':_0x912c('0x21')},{'type':_0x912c('0x1'),'content':_0x912c('0x15')},{'type':_0x912c('0xb'),'content':'','key':_0x912c('0x22'),'keyType':_0x912c('0x5'),'keyContent':'','variableName':_0x912c('0x23')},{'type':_0x912c('0xb'),'content':'','key':_0x912c('0x24'),'keyType':'variable','keyContent':'','variableName':_0x912c('0x25')},{'type':_0x912c('0xb'),'content':'','key':_0x912c('0x26'),'keyType':_0x912c('0x5'),'keyContent':'','variableName':_0x912c('0x27')},{'type':_0x912c('0xb'),'content':'','key':'Billable\x20Time','keyType':_0x912c('0x5'),'keyContent':'','variableName':'billableseconds'}];break;}}return _0x147bb5;}; \ No newline at end of file diff --git a/server/components/interaction/service.js b/server/components/interaction/service.js index 92781e4..20268e8 100644 --- a/server/components/interaction/service.js +++ b/server/components/interaction/service.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xffba=['lodash','./utils','findAll','skipInteractionsQuery','resolve','getInteractionsQuery','then','search','parseAdvancedSearchFilter','parseQueryParameters','where','contact','default','fields','filter','user','having','tags','checkAccountsRestrictions','group','i.id','ids','tag','countFilteredInteractions','count','length','clause','order','forEach','contactName','DESC','closed','getFilteredInteractions','rows','catch','tracked','query','clone','body','omit','fax','updateUser'];(function(_0x2b694b,_0x9a434c){var _0x4ea7d8=function(_0x7e229){while(--_0x7e229){_0x2b694b['push'](_0x2b694b['shift']());}};_0x4ea7d8(++_0x9a434c);}(_0xffba,0x126));var _0xaffb=function(_0x464fde,_0x42609e){_0x464fde=_0x464fde-0x0;var _0x283fdc=_0xffba[_0x464fde];return _0x283fdc;};'use strict';var _=require(_0xaffb('0x0'));var sqlUtils=require('./sql-utils');var utils=require(_0xaffb('0x1'));exports[_0xaffb('0x2')]=function(_0x277bc8,_0x446882,_0x578b8a,_0xe1cb8a,_0x52f5e7){var _0x66e420={'count':0x0,'rows':[]};var _0x34772b=sqlUtils[_0xaffb('0x3')](_0x277bc8,_0x578b8a,_0x446882);if(_0x34772b){return Promise[_0xaffb('0x4')](_0x66e420);}var _0x19956b=sqlUtils[_0xaffb('0x5')](_0x277bc8);var _0x5bcb14={};return Promise['resolve']()[_0xaffb('0x6')](function(){if(_0x446882[_0xaffb('0x7')]){return sqlUtils[_0xaffb('0x8')](_0x446882[_0xaffb('0x7')],_0x52f5e7);}else{return sqlUtils[_0xaffb('0x9')](_0x277bc8,_0x446882,_0x52f5e7);}})[_0xaffb('0x6')](function(_0x5139d1){_0x19956b[_0xaffb('0xa')](_0x5139d1['body']);_0x19956b[_0xaffb('0xa')](_0x5139d1[_0xaffb('0xb')]);_0x19956b[_0xaffb('0xa')](_0x5139d1[_0xaffb('0xc')]);_0x19956b[_0xaffb('0xa')](_0x5139d1[_0xaffb('0xd')]);_0x19956b[_0xaffb('0xa')](_0x5139d1[_0xaffb('0xe')]);_0x19956b[_0xaffb('0xa')](_0x5139d1[_0xaffb('0xf')]);_0x19956b[_0xaffb('0x10')](_0x5139d1['read']);_0x5bcb14=_0x5139d1[_0xaffb('0x11')];return sqlUtils[_0xaffb('0x12')](_0x277bc8,_0x578b8a,_0x446882);})['then'](function(_0x54455d){_0x19956b['where'](_0x54455d);_0x19956b[_0xaffb('0x13')](_0xaffb('0x14'));var _0x80b48c=_0x446882[_0xaffb('0x7')]?_0x5bcb14[_0xaffb('0x15')]:_0x446882[_0xaffb('0x16')];return sqlUtils[_0xaffb('0x17')](_0x19956b,_0x80b48c);})[_0xaffb('0x6')](function(_0x51994f){_0x66e420[_0xaffb('0x18')]=_0x51994f[_0xaffb('0x19')];if(_0x66e420[_0xaffb('0x18')]===0x0){return[];}_0x19956b[_0xaffb('0x10')](_0x5bcb14[_0xaffb('0x1a')]);if(_0xe1cb8a[_0xaffb('0x1b')]){_0xe1cb8a['order'][_0xaffb('0x1c')](function(_0x56c940){var _0x16b39b=_0x56c940[0x0]===_0xaffb('0x1d')?_0x56c940[0x0]:'i.'+_0x56c940[0x0];_0x19956b[_0xaffb('0x1b')](_0x16b39b,_0x56c940[0x1]===_0xaffb('0x1e')?![]:!![]);if(_0x56c940[0x0]===_0xaffb('0x1f')){var _0x44a221=sqlUtils['getClosedOrderClause'](_0x277bc8,_0x446882);_0x19956b[_0xaffb('0x1b')](_0x44a221,_0x56c940[0x1]==='DESC'?![]:!![]);}});}return sqlUtils[_0xaffb('0x20')](_0x277bc8,_0x19956b,_0x446882,_0xe1cb8a);})['then'](function(_0x4da9cb){_0x66e420[_0xaffb('0x21')]=_0x4da9cb;return _0x66e420;})[_0xaffb('0x22')](function(_0x22bc7f){throw _0x22bc7f;});};exports[_0xaffb('0x23')]=function(_0x5ae15c,_0x27ecdc){return function(_0x3856e9,_0x43b6f2,_0x4abdbc){var _0x3441bd=_0x3856e9[_0xaffb('0xf')];var _0x30a16b={};var _0x5f5b9c=_0x3856e9[_0xaffb('0x24')];if(_0x30a16b){_0x30a16b=_[_0xaffb('0x25')](_0x3856e9[_0xaffb('0x26')]);_0x30a16b=_[_0xaffb('0x27')](_0x30a16b,[_0xaffb('0x26'),'html','phone',_0xaffb('0x28'),'mobile']);}utils[_0xaffb('0x29')](_0x3441bd,_0x30a16b,_0x5f5b9c,_0x5ae15c,_0x27ecdc);_0x4abdbc(null);};}; \ No newline at end of file +var _0xe2cb=['count','length','having','order','forEach','contactName','DESC','closed','getClosedOrderClause','tracked','clone','phone','fax','updateUser','lodash','./sql-utils','./utils','findAll','skipInteractionsQuery','resolve','getInteractionsQuery','then','search','parseAdvancedSearchFilter','where','body','contact','default','fields','filter','user','read','checkAccountsRestrictions','group','i.id','ids'];(function(_0x25f398,_0x5eba65){var _0x1404c6=function(_0x11c20d){while(--_0x11c20d){_0x25f398['push'](_0x25f398['shift']());}};_0x1404c6(++_0x5eba65);}(_0xe2cb,0x12e));var _0xbe2c=function(_0x1fa8d4,_0x1be8b8){_0x1fa8d4=_0x1fa8d4-0x0;var _0x3edf4a=_0xe2cb[_0x1fa8d4];return _0x3edf4a;};'use strict';var _=require(_0xbe2c('0x0'));var sqlUtils=require(_0xbe2c('0x1'));var utils=require(_0xbe2c('0x2'));exports[_0xbe2c('0x3')]=function(_0x5e999e,_0x48c548,_0x5273e2,_0x114117,_0x53dc06){var _0x306527={'count':0x0,'rows':[]};var _0x45d73f=sqlUtils[_0xbe2c('0x4')](_0x5e999e,_0x5273e2,_0x48c548);if(_0x45d73f){return Promise[_0xbe2c('0x5')](_0x306527);}var _0x3de289=sqlUtils[_0xbe2c('0x6')](_0x5e999e);var _0x4703e7={};return Promise['resolve']()[_0xbe2c('0x7')](function(){if(_0x48c548[_0xbe2c('0x8')]){return sqlUtils[_0xbe2c('0x9')](_0x48c548[_0xbe2c('0x8')],_0x53dc06);}else{return sqlUtils['parseQueryParameters'](_0x5e999e,_0x48c548,_0x53dc06);}})['then'](function(_0x29cb0b){_0x3de289[_0xbe2c('0xa')](_0x29cb0b[_0xbe2c('0xb')]);_0x3de289[_0xbe2c('0xa')](_0x29cb0b[_0xbe2c('0xc')]);_0x3de289[_0xbe2c('0xa')](_0x29cb0b[_0xbe2c('0xd')]);_0x3de289[_0xbe2c('0xa')](_0x29cb0b[_0xbe2c('0xe')]);_0x3de289[_0xbe2c('0xa')](_0x29cb0b[_0xbe2c('0xf')]);_0x3de289[_0xbe2c('0xa')](_0x29cb0b[_0xbe2c('0x10')]);_0x3de289['having'](_0x29cb0b[_0xbe2c('0x11')]);_0x4703e7=_0x29cb0b['tags'];return sqlUtils[_0xbe2c('0x12')](_0x5e999e,_0x5273e2,_0x48c548);})[_0xbe2c('0x7')](function(_0x22c555){_0x3de289[_0xbe2c('0xa')](_0x22c555);_0x3de289[_0xbe2c('0x13')](_0xbe2c('0x14'));var _0x4d43bd=_0x48c548[_0xbe2c('0x8')]?_0x4703e7[_0xbe2c('0x15')]:_0x48c548['tag'];return sqlUtils['countFilteredInteractions'](_0x3de289,_0x4d43bd);})[_0xbe2c('0x7')](function(_0x2abb4a){_0x306527[_0xbe2c('0x16')]=_0x2abb4a[_0xbe2c('0x17')];if(_0x306527[_0xbe2c('0x16')]===0x0){return[];}_0x3de289[_0xbe2c('0x18')](_0x4703e7['clause']);if(_0x114117[_0xbe2c('0x19')]){_0x114117[_0xbe2c('0x19')][_0xbe2c('0x1a')](function(_0x35468e){var _0xb1c620=_0x35468e[0x0]===_0xbe2c('0x1b')?_0x35468e[0x0]:'i.'+_0x35468e[0x0];_0x3de289['order'](_0xb1c620,_0x35468e[0x1]===_0xbe2c('0x1c')?![]:!![]);if(_0x35468e[0x0]===_0xbe2c('0x1d')){var _0x4dcca8=sqlUtils[_0xbe2c('0x1e')](_0x5e999e,_0x48c548);_0x3de289['order'](_0x4dcca8,_0x35468e[0x1]===_0xbe2c('0x1c')?![]:!![]);}});}return sqlUtils['getFilteredInteractions'](_0x5e999e,_0x3de289,_0x48c548,_0x114117);})[_0xbe2c('0x7')](function(_0x17765c){_0x306527['rows']=_0x17765c;return _0x306527;})['catch'](function(_0x2fb390){throw _0x2fb390;});};exports[_0xbe2c('0x1f')]=function(_0x2c7cd2,_0x146b3d){return function(_0xa37ef,_0x43151d,_0x45c088){var _0x5848ad=_0xa37ef[_0xbe2c('0x10')];var _0x9d7558={};var _0x2602eb=_0xa37ef['query'];if(_0x9d7558){_0x9d7558=_[_0xbe2c('0x20')](_0xa37ef['body']);_0x9d7558=_['omit'](_0x9d7558,[_0xbe2c('0xb'),'html',_0xbe2c('0x21'),_0xbe2c('0x22'),'mobile']);}utils[_0xbe2c('0x23')](_0x5848ad,_0x9d7558,_0x2602eb,_0x2c7cd2,_0x146b3d);_0x45c088(null);};}; \ No newline at end of file diff --git a/server/components/interaction/sql-utils.js b/server/components/interaction/sql-utils.js index bb4aa45..939d023 100644 --- a/server/components/interaction/sql-utils.js +++ b/server/components/interaction/sql-utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xba10=['UserId','end','keys','some','compact','\x20IN\x20?','concat','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','resolve','then','fields','tag','filter','get','capitalize','chat','Websites','Accounts','agent','\x20IS\x20NOT\x20NULL','i.secondDisposition','i.disposition','unshift','i.substatus','join','Sequelize','QueryTypes','SELECT','sequelize','query','toString','keyBy','merge','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','Account.key','a.mandatoryDisposition','a.email','CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20CONCAT(\x27%\x27,\x20a.email,\x20\x27%\x27)\x20THEN\x20TRIM(SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201))\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName','i.createdAt','i.updatedAt','i.closed','i.attach','i.lastMsgAt','i.lastMsgDirection','i.subject','i.thirdDisposition','i.to','CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','limit','offset','groupBy','Setting','enableEmailPreview','all','isEmpty','t.id\x20IN\x20?','squel','../parsers/advancedSearch','../parsers/qs','../../mysqldb','getAccountFK','role','search','select','field','name','getInteractionFK','user_has_','_interactions','u.fullname','ui.','from','u.id\x20=\x20ui.UserId','where','map','getInteractionsTables','left_join','cm_contacts','users','o.id\x20=\x20i.UserId','accounts','me.','\x20=\x20i.id','it.','t.id\x20=\x20it.TagId','expr','getSelectedTags','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','replace','{OPERATOR}','isNumeric','i.id\x20LIKE\x20?','sms','whatsapp','includes','fax','i.fax\x20LIKE\x20?','mail','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','parseSearch','sqlOperator','conditions','length','find','type','default','value','start','unreadMessages','read','and','Contact','operator','$substring','split','contact','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','Tag','tags','clause','ids','User','user','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?'];(function(_0x8dc04d,_0xaa7559){var _0x2f5f28=function(_0xdd2d1d){while(--_0xdd2d1d){_0x8dc04d['push'](_0x8dc04d['shift']());}};_0x2f5f28(++_0xaa7559);}(_0xba10,0xea));var _0x0ba1=function(_0x5cfa18,_0x23738e){_0x5cfa18=_0x5cfa18-0x0;var _0x26b274=_0xba10[_0x5cfa18];return _0x26b274;};'use strict';var _=require('lodash');var squel=require(_0x0ba1('0x0'));var as=require(_0x0ba1('0x1'));var qs=require(_0x0ba1('0x2'));var updateInteraction=require('./update-interaction')['updateInteraction'];var utils=require('./utils');var db=require(_0x0ba1('0x3'))['db'];function skipInteractionsQuery(_0x2aa788,_0x57d76a,_0x2a7750){var _0x4d25d1=![];var _0x3f7194=utils[_0x0ba1('0x4')](_0x2aa788);if(_0x57d76a[_0x0ba1('0x5')]==='agent'&&!_0x2a7750[_0x0ba1('0x6')]&&!_0x2a7750[_0x3f7194]){_0x4d25d1=!![];}return _0x4d25d1;}function getTagsQuery(){return squel[_0x0ba1('0x7')]()[_0x0ba1('0x8')]('id')[_0x0ba1('0x8')](_0x0ba1('0x9'))['field']('color')['from']('tools_tags');}function getUsersQuery(_0x3e6b52,_0x30120e){var _0x307d88=utils[_0x0ba1('0xa')](_0x3e6b52);var _0x1ed0c3=_0x0ba1('0xb')+_0x3e6b52+_0x0ba1('0xc');var _0x54177c=squel[_0x0ba1('0x7')]()[_0x0ba1('0x8')]('u.id')[_0x0ba1('0x8')](_0x0ba1('0xd'))[_0x0ba1('0x8')](_0x0ba1('0xe')+_0x307d88)[_0x0ba1('0xf')](_0x1ed0c3,'ui')['left_join']('users','u',_0x0ba1('0x10'));if(_0x30120e['length']>0x0){_0x54177c[_0x0ba1('0x11')]('ui.'+_0x307d88+'\x20IN\x20?',_[_0x0ba1('0x12')](_0x30120e,'id'));}return _0x54177c;}function getInteractionsQuery(_0x177287){var _0x282c4a=utils[_0x0ba1('0x13')](_0x177287);var _0xbde5b5=utils[_0x0ba1('0x4')](_0x177287);var _0x1ee3c5=utils[_0x0ba1('0xa')](_0x177287);return squel[_0x0ba1('0x7')]()[_0x0ba1('0xf')](_0x282c4a['interactions'],'i')[_0x0ba1('0x14')](_0x0ba1('0x15'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')['left_join'](_0x0ba1('0x16'),'o',_0x0ba1('0x17'))['left_join'](_0x282c4a[_0x0ba1('0x18')],'a','a.id\x20=\x20i.'+_0xbde5b5)[_0x0ba1('0x14')](_0x282c4a['messages'],'me',_0x0ba1('0x19')+_0x1ee3c5+_0x0ba1('0x1a'))[_0x0ba1('0x14')](_0x282c4a['interactionsTags'],'it',_0x0ba1('0x1b')+_0x1ee3c5+_0x0ba1('0x1a'))['left_join']('tools_tags','t',_0x0ba1('0x1c'));}function getSqlClauses(){var _0x563362={'body':squel['expr'](),'contact':squel[_0x0ba1('0x1d')](),'default':squel[_0x0ba1('0x1d')](),'fields':squel[_0x0ba1('0x1d')](),'filter':squel['expr'](),'read':squel['expr'](),'tags':{'clause':squel[_0x0ba1('0x1d')](),'ids':null},'user':squel[_0x0ba1('0x1d')]()};return _0x563362;}function parseTagParameter(_0x1a1b44){var _0x6b8685=squel[_0x0ba1('0x1d')]();if(_0x1a1b44){var _0x58b61b=utils[_0x0ba1('0x1e')](_0x1a1b44);_0x58b61b[_0x0ba1('0x1f')](function(_0x2c1b33){_0x6b8685['or'](_0x0ba1('0x20'),'%,'+_0x2c1b33+',%');});}return _0x6b8685;}function parseReadParameter(_0x46f794){var _0x1104cc='';if(_0x46f794){_0x1104cc='unreadMessages\x20{OPERATOR}\x200';if(_0x46f794==='1'){_0x1104cc=_0x1104cc[_0x0ba1('0x21')]('{OPERATOR}','=');}else{_0x1104cc=_0x1104cc['replace'](_0x0ba1('0x22'),'>');}}return _0x1104cc;}function parseSearchFilter(_0x5e2be,_0x33106c){var _0x15db60=squel[_0x0ba1('0x1d')]();if(_0x33106c){var _0x3bcfd1=_0x33106c[_0x0ba1('0x21')]('\x5c','\x5c\x5c')[_0x0ba1('0x21')](/'/g,'\x27\x27');if(qs[_0x0ba1('0x23')](_0x3bcfd1)){_0x15db60['or'](_0x0ba1('0x24'),_0x3bcfd1+'%');if([_0x0ba1('0x25'),_0x0ba1('0x26')][_0x0ba1('0x27')](_0x5e2be)){_0x15db60['or']('i.phone\x20LIKE\x20?',_0x3bcfd1+'%');}else if(_0x5e2be===_0x0ba1('0x28')){_0x15db60['or'](_0x0ba1('0x29'),_0x3bcfd1+'%');}else if(_0x5e2be==='openchannel'){_0x15db60['or']('i.from\x20LIKE\x20?',_0x3bcfd1+'%');}}else if(_0x5e2be===_0x0ba1('0x2a')&&qs['isEmail'](_0x3bcfd1)){_0x15db60['or']('c.email\x20LIKE\x20?',_0x3bcfd1+'%');}else{if(_0x5e2be===_0x0ba1('0x2a')){_0x15db60['or'](_0x0ba1('0x2b'),qs[_0x0ba1('0x2c')](_0x3bcfd1,!![]))['or'](_0x0ba1('0x2d'),qs[_0x0ba1('0x2c')](_0x3bcfd1));}else if(_0x5e2be!==_0x0ba1('0x28')){_0x15db60['or'](_0x0ba1('0x2e'),qs[_0x0ba1('0x2c')](_0x3bcfd1));}_0x15db60['or'](_0x0ba1('0x2f'),qs[_0x0ba1('0x2c')](_0x3bcfd1,!![]),null);}}return _0x15db60;}function parseAdvancedSearchFilter(_0x2d2690,_0x33a359){var _0x109b5c=getSqlClauses();var _0x46cb6c=as[_0x0ba1('0x30')](_0x2d2690);var _0x19d46a=_0x46cb6c[_0x0ba1('0x31')];for(var _0x5d8789=0x0;_0x5d8789<_0x46cb6c[_0x0ba1('0x32')][_0x0ba1('0x33')];_0x5d8789++){var _0x35045d=_0x46cb6c['conditions'][_0x5d8789];var _0x1d5142='i';var _0x4ab388=_[_0x0ba1('0x34')](_0x33a359,[_0x0ba1('0x9'),_0x35045d[_0x0ba1('0x8')]]);if(_0x4ab388){var _0x10ce56=as['buildExpression'](_0x1d5142,_0x4ab388[_0x0ba1('0x35')],_0x35045d);_0x109b5c[_0x0ba1('0x36')][_0x19d46a](_0x10ce56['text'],_0x10ce56[_0x0ba1('0x37')][_0x0ba1('0x38')],_0x10ce56[_0x0ba1('0x37')]['end']);}else{switch(_0x35045d[_0x0ba1('0x8')]){case _0x0ba1('0x39'):var _0x1690c4=parseReadParameter(_0x35045d[_0x0ba1('0x37')]);_0x109b5c[_0x0ba1('0x3a')][_0x0ba1('0x3b')](_0x1690c4);break;case _0x0ba1('0x3c'):if(_0x35045d[_0x0ba1('0x3d')]===_0x0ba1('0x3e')){if(_0x35045d[_0x0ba1('0x37')][_0x0ba1('0x3f')]('\x20')['length']>0x1){_0x109b5c[_0x0ba1('0x40')][_0x19d46a]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x0ba1('0x2c')](_0x35045d[_0x0ba1('0x37')],!![]),null);}else{var _0x36af74='%'+_0x35045d[_0x0ba1('0x37')]+'%';_0x109b5c[_0x0ba1('0x40')][_0x19d46a](_0x0ba1('0x41'),_0x36af74,_0x36af74,_0x36af74);}}else{_0x4ab388=_[_0x0ba1('0x34')](_0x33a359,[_0x0ba1('0x9'),_0x0ba1('0x42')]);_0x35045d[_0x0ba1('0x8')]=_0x0ba1('0x42');_0x10ce56=as[_0x0ba1('0x43')](_0x1d5142,_0x4ab388[_0x0ba1('0x35')],_0x35045d);_0x109b5c[_0x0ba1('0x40')][_0x19d46a](_0x10ce56[_0x0ba1('0x44')],_0x10ce56['value'][_0x0ba1('0x38')],_0x10ce56[_0x0ba1('0x37')]['end']);}break;case _0x0ba1('0x45'):var _0x35ad31=_0x35045d[_0x0ba1('0x37')][_0x0ba1('0x3f')](',')[_0x0ba1('0x12')](function(_0x3a7ea2){return Number(_0x3a7ea2);});var _0x4c5e8f=parseTagParameter(_0x35ad31);_0x109b5c[_0x0ba1('0x46')][_0x0ba1('0x47')][_0x0ba1('0x3b')](_0x4c5e8f);_0x109b5c[_0x0ba1('0x46')][_0x0ba1('0x48')]=_0x35ad31;break;case _0x0ba1('0x49'):if(_0x35045d[_0x0ba1('0x3d')]===_0x0ba1('0x3e')){_0x109b5c[_0x0ba1('0x4a')][_0x19d46a](_0x0ba1('0x4b'),'%'+_0x35045d['value']+'%',null);}else{_0x4ab388=_[_0x0ba1('0x34')](_0x33a359,[_0x0ba1('0x9'),_0x0ba1('0x4c')]);_0x35045d[_0x0ba1('0x8')]=_0x0ba1('0x4c');_0x10ce56=as[_0x0ba1('0x43')](_0x1d5142,_0x4ab388[_0x0ba1('0x35')],_0x35045d);_0x109b5c[_0x0ba1('0x4a')][_0x19d46a](_0x10ce56['text'],_0x10ce56[_0x0ba1('0x37')][_0x0ba1('0x38')],_0x10ce56['value'][_0x0ba1('0x4d')]);}break;case'body':case'plainBody':_0x10ce56=as[_0x0ba1('0x43')]('me',null,_0x35045d);_0x109b5c['body'][_0x19d46a](_0x10ce56['text'],_0x10ce56['value']['start'],_0x10ce56[_0x0ba1('0x37')]['end']);break;}}}return _0x109b5c;}function parseModelFields(_0x1285b3,_0xa393c9,_0x1bd4ae){var _0x442b21=utils[_0x0ba1('0x4')](_0x1285b3);var _0x1fd297=squel['expr']();var _0x153eb1=_(_0xa393c9)[_0x0ba1('0x4e')]()['map'](function(_0x34b845){return _[_0x0ba1('0x4f')](_0x1bd4ae,[_0x0ba1('0x9'),_0x34b845])?_0x34b845:undefined;})[_0x0ba1('0x50')]()[_0x0ba1('0x37')]();if(_0x153eb1[_0x0ba1('0x33')]>0x0){_0x153eb1['forEach'](function(_0x423ad2){if(_0x423ad2===_0x442b21){_0x1fd297[_0x0ba1('0x3b')]('i.'+_0x442b21+_0x0ba1('0x51'),[][_0x0ba1('0x52')](_0xa393c9[_0x423ad2]));}else if(_0x423ad2==='createdAt'){var _0x6b4df0=JSON[_0x0ba1('0x53')](_0xa393c9[_0x423ad2])['$gte'];var _0x48c9cc=JSON[_0x0ba1('0x53')](_0xa393c9[_0x423ad2])[_0x0ba1('0x54')];_0x1fd297[_0x0ba1('0x3b')](_0x0ba1('0x55'),_0x6b4df0,_0x48c9cc);}else{if(_0xa393c9[_0x423ad2]===_0x0ba1('0x56')){_0x1fd297['and']('i.'+_0x423ad2+_0x0ba1('0x57'));}else{_0x1fd297[_0x0ba1('0x3b')]('i.'+_0x423ad2+'\x20=\x20?',_0xa393c9[_0x423ad2]);}}});}return _0x1fd297;}function parseQueryParameters(_0x21ed8b,_0x3f545e,_0x394772){var _0x99605f=getSqlClauses();return Promise[_0x0ba1('0x58')]()[_0x0ba1('0x59')](function(){return parseModelFields(_0x21ed8b,_0x3f545e,_0x394772);})[_0x0ba1('0x59')](function(_0x2eb8bd){_0x99605f[_0x0ba1('0x5a')]['and'](_0x2eb8bd);return parseReadParameter(_0x3f545e[_0x0ba1('0x3a')]);})['then'](function(_0x5dda2e){_0x99605f['read'][_0x0ba1('0x3b')](_0x5dda2e);return parseTagParameter(_0x3f545e[_0x0ba1('0x5b')]);})['then'](function(_0x5a8bbf){_0x99605f['tags'][_0x0ba1('0x47')][_0x0ba1('0x3b')](_0x5a8bbf);return parseSearchFilter(_0x21ed8b,_0x3f545e[_0x0ba1('0x5c')]);})['then'](function(_0x332026){_0x99605f[_0x0ba1('0x5c')]=_0x332026;return _0x99605f;});}function checkAccountsRestrictions(_0x43a171,_0x37239c,_0x3f3f25){var _0x3c5885=utils['getAccountFK'](_0x43a171);var _0x540e12=_0x0ba1('0x5d')+_[_0x0ba1('0x5e')](_0x43a171)+(_0x43a171===_0x0ba1('0x5f')?_0x0ba1('0x60'):_0x0ba1('0x61'));var _0x4578d0=squel[_0x0ba1('0x1d')]();return Promise[_0x0ba1('0x58')]()['then'](function(){if(_0x3f3f25[_0x0ba1('0x6')]&&_0x37239c[_0x0ba1('0x5')]===_0x0ba1('0x62')){return _0x37239c[_0x540e12]({'attributes':['id'],'raw':!![]});}})[_0x0ba1('0x59')](function(_0x5cc2b0){if(_0x5cc2b0){if(_0x5cc2b0[_0x0ba1('0x33')]===0x0){_0x4578d0[_0x0ba1('0x3b')]('i.'+_0x3c5885+_0x0ba1('0x57'));}else{_0x4578d0[_0x0ba1('0x3b')]('i.'+_0x3c5885+_0x0ba1('0x51'),_[_0x0ba1('0x12')](_0x5cc2b0,'id'));}}else if(!_0x3f3f25[_0x3c5885]){_0x4578d0[_0x0ba1('0x3b')]('i.'+_0x3c5885+_0x0ba1('0x63'));}})[_0x0ba1('0x59')](function(){return _0x4578d0;});}function getClosedOrderClause(_0x8d26fa,_0xe9cd56){var _0x1aa92e='';var _0x168ee2=['i.thirdDisposition',_0x0ba1('0x64'),_0x0ba1('0x65')];if(_0x8d26fa===_0x0ba1('0x2a')){_0x168ee2[_0x0ba1('0x66')](_0x0ba1('0x67'));}if(_0xe9cd56['closed']==='0'&&_0x8d26fa===_0x0ba1('0x2a')){_0x1aa92e=_0x0ba1('0x67');}else{if(_0xe9cd56['closed']==='1'){_0x168ee2['shift']();}_0x1aa92e='CONCAT_WS(\x27\x27,\x20'+_0x168ee2[_0x0ba1('0x68')](',\x20')+')';}return _0x1aa92e;}function getFilteredInteractions(_0x24f6c4,_0x1d2fba,_0x82362b,_0x357895){var _0xdb6605=utils['getInteractionFK'](_0x24f6c4);var _0x14d019=_[_0x0ba1('0x5e')](_0x24f6c4)+'Interaction';var _0x52a335=[];var _0x1c215e=getTagsQuery();var _0x1e8315={'type':db[_0x0ba1('0x69')][_0x0ba1('0x6a')][_0x0ba1('0x6b')],'raw':!![]};var _0x4b9b14=[];var _0x5f4311=[];return db[_0x0ba1('0x6c')][_0x0ba1('0x6d')](_0x1c215e[_0x0ba1('0x6e')](),_0x1e8315)[_0x0ba1('0x59')](function(_0x547333){_0x52a335=_[_0x0ba1('0x6f')](_0x547333,'id');_0x1e8315=_[_0x0ba1('0x70')](_0x1e8315,{'model':db[_0x14d019],'mapToModel':!![],'nest':!![]});if(_0x82362b[_0x0ba1('0x5a')]){_0x357895['attributes']['forEach'](function(_0x3237a4){_0x1d2fba[_0x0ba1('0x8')]('i.'+_0x3237a4);});}else{_0x1d2fba[_0x0ba1('0x8')](_0x0ba1('0x71'),_0x0ba1('0x39'));_0x1d2fba[_0x0ba1('0x8')](_0x0ba1('0x72'),_0x0ba1('0x73'));_0x1d2fba[_0x0ba1('0x8')](_0x0ba1('0x74'),'Account.mandatoryDisposition');if(_0x24f6c4===_0x0ba1('0x2a')){_0x1d2fba[_0x0ba1('0x8')](_0x0ba1('0x75'),'Account.email');_0x1d2fba['field'](_0x0ba1('0x76'),_0x0ba1('0x77'));_0x1d2fba[_0x0ba1('0x8')]('i.id');_0x1d2fba[_0x0ba1('0x8')](_0x0ba1('0x78'));_0x1d2fba[_0x0ba1('0x8')](_0x0ba1('0x79'));_0x1d2fba[_0x0ba1('0x8')](_0x0ba1('0x7a'));_0x1d2fba[_0x0ba1('0x8')]('i.closedAt');_0x1d2fba[_0x0ba1('0x8')](_0x0ba1('0x7b'));_0x1d2fba[_0x0ba1('0x8')](_0x0ba1('0x7c'));_0x1d2fba[_0x0ba1('0x8')](_0x0ba1('0x7d'));_0x1d2fba[_0x0ba1('0x8')](_0x0ba1('0x7e'));_0x1d2fba[_0x0ba1('0x8')]('i.disposition');_0x1d2fba[_0x0ba1('0x8')](_0x0ba1('0x64'));_0x1d2fba['field'](_0x0ba1('0x7f'));_0x1d2fba['field'](_0x0ba1('0x67'));_0x1d2fba[_0x0ba1('0x8')](_0x0ba1('0x80'));_0x1d2fba[_0x0ba1('0x8')]('i.ContactId');_0x1d2fba[_0x0ba1('0x8')]('i.MailAccountId');_0x1d2fba[_0x0ba1('0x8')]('i.UserId');}else if(_0x24f6c4==='openchannel'){_0x1d2fba[_0x0ba1('0x8')](_0x0ba1('0x81'),'contactName');}else{_0x1d2fba['field'](_0x0ba1('0x82'),_0x0ba1('0x77'));}if(_0x24f6c4!==_0x0ba1('0x2a')){_0x1d2fba[_0x0ba1('0x8')](_0x0ba1('0x83'));}_0x1d2fba[_0x0ba1('0x8')]('c.firstName','Contact.firstName');_0x1d2fba[_0x0ba1('0x8')](_0x0ba1('0x84'),_0x0ba1('0x85'));_0x1d2fba[_0x0ba1('0x8')](_0x0ba1('0x86'),_0x0ba1('0x87'));_0x1d2fba[_0x0ba1('0x8')](_0x0ba1('0x88'),_0x0ba1('0x89'));_0x1d2fba[_0x0ba1('0x8')](_0x0ba1('0x8a'),_0x0ba1('0x8b'));_0x1d2fba[_0x0ba1('0x8')]('c.fax',_0x0ba1('0x8c'));_0x1d2fba[_0x0ba1('0x8')](_0x0ba1('0x8d'),_0x0ba1('0x8e'));_0x1d2fba['field'](_0x0ba1('0x8f'),_0x0ba1('0x90'));_0x1d2fba['field'](_0x0ba1('0x91'),_0x0ba1('0x92'));}if(_0x357895[_0x0ba1('0x93')]){_0x1d2fba[_0x0ba1('0x93')](_0x357895[_0x0ba1('0x93')]);}if(_0x357895['offset']){_0x1d2fba[_0x0ba1('0x94')](_0x357895[_0x0ba1('0x94')]);}return db[_0x0ba1('0x6c')][_0x0ba1('0x6d')](_0x1d2fba[_0x0ba1('0x6e')](),_0x1e8315);})['then'](function(_0x228cf7){_0x4b9b14=_0x228cf7;var _0x218dd8=getUsersQuery(_0x24f6c4,_0x4b9b14);return db[_0x0ba1('0x6c')]['query'](_0x218dd8[_0x0ba1('0x6e')](),_0x1e8315);})['then'](function(_0x232962){_0x5f4311=_[_0x0ba1('0x95')](_0x232962,_0xdb6605);if(_0x24f6c4==='mail'){return db[_0x0ba1('0x96')]['findOne']({'attributes':[_0x0ba1('0x97')],'raw':!![]});}})['then'](function(_0x1839ed){var _0x4c3373=_0x1839ed?_0x1839ed['enableEmailPreview']:undefined;var _0x2c1671=_0x4b9b14['map'](function(_0x53c4fe){return updateInteraction(_0x53c4fe,_0x52a335,_0x5f4311,_0x4c3373);});return Promise[_0x0ba1('0x98')](_0x2c1671);});}function countFilteredInteractions(_0x141567,_0x3f6807){var _0x431f37=_0x141567['clone']();_0x431f37[_0x0ba1('0x8')]('COUNT(*)');_0x431f37[_0x0ba1('0x8')](_0x0ba1('0x71'),'unreadMessages');var _0x38ea86=utils['getSelectedTags'](_0x3f6807);if(!_[_0x0ba1('0x99')](_0x38ea86)){_0x431f37[_0x0ba1('0x11')](_0x0ba1('0x9a'),_0x38ea86);}var _0x559498={'type':db[_0x0ba1('0x69')]['QueryTypes'][_0x0ba1('0x6b')],'raw':!![]};return db[_0x0ba1('0x6c')][_0x0ba1('0x6d')](_0x431f37[_0x0ba1('0x6e')](),_0x559498);}module['exports']={'checkAccountsRestrictions':checkAccountsRestrictions,'countFilteredInteractions':countFilteredInteractions,'getClosedOrderClause':getClosedOrderClause,'getFilteredInteractions':getFilteredInteractions,'getInteractionsQuery':getInteractionsQuery,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipInteractionsQuery':skipInteractionsQuery}; \ No newline at end of file +var _0x96d4=['isEmpty','lodash','squel','../parsers/advancedSearch','updateInteraction','./utils','../../mysqldb','role','agent','select','field','name','color','tools_tags','getInteractionFK','user_has_','_interactions','u.fullname','left_join','users','u.id\x20=\x20ui.UserId','where','ui.','map','getInteractionsTables','getAccountFK','from','interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','accounts','a.id\x20=\x20i.','messages','me.','interactionsTags','it.','expr','getSelectedTags','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','unreadMessages\x20{OPERATOR}\x200','replace','{OPERATOR}','isNumeric','i.id\x20LIKE\x20?','whatsapp','fax','i.fax\x20LIKE\x20?','openchannel','i.from\x20LIKE\x20?','mail','isEmail','c.email\x20LIKE\x20?','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','parseSearch','sqlOperator','length','find','buildExpression','default','text','value','start','end','unreadMessages','read','and','Contact','operator','$substring','split','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','type','contact','Tag','tags','ids','UserId','user','body','plainBody','keys','compact','\x20IN\x20?','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','then','fields','tag','clause','filter','capitalize','Accounts','resolve','search','i.secondDisposition','i.disposition','unshift','i.substatus','closed','shift','CONCAT_WS(\x27\x27,\x20','join','Sequelize','QueryTypes','query','toString','keyBy','merge','attributes','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','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','contactName','i.id','i.createdAt','i.updatedAt','i.closedAt','i.lastMsgAt','i.lastMsgDirection','i.thirdDisposition','i.to','i.ContactId','i.MailAccountId','i.UserId','CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','Contact.firstName','c.email','Contact.email','c.phone','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','offset','sequelize','Setting','enableEmailPreview'];(function(_0x5248e4,_0x22d9aa){var _0x565ccf=function(_0x7c589a){while(--_0x7c589a){_0x5248e4['push'](_0x5248e4['shift']());}};_0x565ccf(++_0x22d9aa);}(_0x96d4,0x9f));var _0x496d=function(_0x9e1984,_0xb2f245){_0x9e1984=_0x9e1984-0x0;var _0x1b0b0b=_0x96d4[_0x9e1984];return _0x1b0b0b;};'use strict';var _=require(_0x496d('0x0'));var squel=require(_0x496d('0x1'));var as=require(_0x496d('0x2'));var qs=require('../parsers/qs');var updateInteraction=require('./update-interaction')[_0x496d('0x3')];var utils=require(_0x496d('0x4'));var db=require(_0x496d('0x5'))['db'];function skipInteractionsQuery(_0x3707fb,_0x569169,_0x4007dd){var _0x5deefd=![];var _0x41d961=utils['getAccountFK'](_0x3707fb);if(_0x569169[_0x496d('0x6')]===_0x496d('0x7')&&!_0x4007dd['search']&&!_0x4007dd[_0x41d961]){_0x5deefd=!![];}return _0x5deefd;}function getTagsQuery(){return squel[_0x496d('0x8')]()[_0x496d('0x9')]('id')['field'](_0x496d('0xa'))[_0x496d('0x9')](_0x496d('0xb'))['from'](_0x496d('0xc'));}function getUsersQuery(_0x4bb40a,_0x167224){var _0x83a889=utils[_0x496d('0xd')](_0x4bb40a);var _0x1d8dd0=_0x496d('0xe')+_0x4bb40a+_0x496d('0xf');var _0x24fe78=squel['select']()[_0x496d('0x9')]('u.id')[_0x496d('0x9')](_0x496d('0x10'))[_0x496d('0x9')]('ui.'+_0x83a889)['from'](_0x1d8dd0,'ui')[_0x496d('0x11')](_0x496d('0x12'),'u',_0x496d('0x13'));if(_0x167224['length']>0x0){_0x24fe78[_0x496d('0x14')](_0x496d('0x15')+_0x83a889+'\x20IN\x20?',_[_0x496d('0x16')](_0x167224,'id'));}return _0x24fe78;}function getInteractionsQuery(_0x2039f8){var _0x42827f=utils[_0x496d('0x17')](_0x2039f8);var _0x340009=utils[_0x496d('0x18')](_0x2039f8);var _0x20edeb=utils[_0x496d('0xd')](_0x2039f8);return squel[_0x496d('0x8')]()[_0x496d('0x19')](_0x42827f[_0x496d('0x1a')],'i')[_0x496d('0x11')](_0x496d('0x1b'),'c',_0x496d('0x1c'))[_0x496d('0x11')](_0x496d('0x12'),'o',_0x496d('0x1d'))[_0x496d('0x11')](_0x42827f[_0x496d('0x1e')],'a',_0x496d('0x1f')+_0x340009)[_0x496d('0x11')](_0x42827f[_0x496d('0x20')],'me',_0x496d('0x21')+_0x20edeb+'\x20=\x20i.id')[_0x496d('0x11')](_0x42827f[_0x496d('0x22')],'it',_0x496d('0x23')+_0x20edeb+'\x20=\x20i.id')[_0x496d('0x11')](_0x496d('0xc'),'t','t.id\x20=\x20it.TagId');}function getSqlClauses(){var _0x38627f={'body':squel[_0x496d('0x24')](),'contact':squel[_0x496d('0x24')](),'default':squel[_0x496d('0x24')](),'fields':squel[_0x496d('0x24')](),'filter':squel[_0x496d('0x24')](),'read':squel[_0x496d('0x24')](),'tags':{'clause':squel[_0x496d('0x24')](),'ids':null},'user':squel[_0x496d('0x24')]()};return _0x38627f;}function parseTagParameter(_0x492075){var _0x4929c7=squel[_0x496d('0x24')]();if(_0x492075){var _0x2b7f8d=utils[_0x496d('0x25')](_0x492075);_0x2b7f8d[_0x496d('0x26')](function(_0x2da436){_0x4929c7['or'](_0x496d('0x27'),'%,'+_0x2da436+',%');});}return _0x4929c7;}function parseReadParameter(_0x3831a1){var _0x274ccd='';if(_0x3831a1){_0x274ccd=_0x496d('0x28');if(_0x3831a1==='1'){_0x274ccd=_0x274ccd[_0x496d('0x29')](_0x496d('0x2a'),'=');}else{_0x274ccd=_0x274ccd['replace'](_0x496d('0x2a'),'>');}}return _0x274ccd;}function parseSearchFilter(_0x318579,_0x439423){var _0xa45fc0=squel[_0x496d('0x24')]();if(_0x439423){var _0x4e2269=_0x439423['replace']('\x5c','\x5c\x5c')[_0x496d('0x29')](/'/g,'\x27\x27');if(qs[_0x496d('0x2b')](_0x4e2269)){_0xa45fc0['or'](_0x496d('0x2c'),_0x4e2269+'%');if(['sms',_0x496d('0x2d')]['includes'](_0x318579)){_0xa45fc0['or']('i.phone\x20LIKE\x20?',_0x4e2269+'%');}else if(_0x318579===_0x496d('0x2e')){_0xa45fc0['or'](_0x496d('0x2f'),_0x4e2269+'%');}else if(_0x318579===_0x496d('0x30')){_0xa45fc0['or'](_0x496d('0x31'),_0x4e2269+'%');}}else if(_0x318579===_0x496d('0x32')&&qs[_0x496d('0x33')](_0x4e2269)){_0xa45fc0['or'](_0x496d('0x34'),_0x4e2269+'%');}else{if(_0x318579===_0x496d('0x32')){_0xa45fc0['or'](_0x496d('0x35'),qs['getFullTextValue'](_0x4e2269,!![]))['or'](_0x496d('0x36'),qs['getFullTextValue'](_0x4e2269));}else if(_0x318579!==_0x496d('0x2e')){_0xa45fc0['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x496d('0x37')](_0x4e2269));}_0xa45fc0['or'](_0x496d('0x38'),qs[_0x496d('0x37')](_0x4e2269,!![]),null);}}return _0xa45fc0;}function parseAdvancedSearchFilter(_0x47edc5,_0x16c6c4){var _0x8fe62f=getSqlClauses();var _0x36855d=as[_0x496d('0x39')](_0x47edc5);var _0x5428af=_0x36855d[_0x496d('0x3a')];for(var _0x249f32=0x0;_0x249f32<_0x36855d['conditions'][_0x496d('0x3b')];_0x249f32++){var _0x3745c=_0x36855d['conditions'][_0x249f32];var _0x37bd22='i';var _0x17f320=_[_0x496d('0x3c')](_0x16c6c4,[_0x496d('0xa'),_0x3745c[_0x496d('0x9')]]);if(_0x17f320){var _0x7eef0f=as[_0x496d('0x3d')](_0x37bd22,_0x17f320['type'],_0x3745c);_0x8fe62f[_0x496d('0x3e')][_0x5428af](_0x7eef0f[_0x496d('0x3f')],_0x7eef0f[_0x496d('0x40')][_0x496d('0x41')],_0x7eef0f[_0x496d('0x40')][_0x496d('0x42')]);}else{switch(_0x3745c['field']){case _0x496d('0x43'):var _0x5bbbc5=parseReadParameter(_0x3745c[_0x496d('0x40')]);_0x8fe62f[_0x496d('0x44')][_0x496d('0x45')](_0x5bbbc5);break;case _0x496d('0x46'):if(_0x3745c[_0x496d('0x47')]===_0x496d('0x48')){if(_0x3745c[_0x496d('0x40')][_0x496d('0x49')]('\x20')[_0x496d('0x3b')]>0x1){_0x8fe62f['contact'][_0x5428af](_0x496d('0x38'),qs['getFullTextValue'](_0x3745c[_0x496d('0x40')],!![]),null);}else{var _0x1eaf75='%'+_0x3745c[_0x496d('0x40')]+'%';_0x8fe62f['contact'][_0x5428af](_0x496d('0x4a'),_0x1eaf75,_0x1eaf75,_0x1eaf75);}}else{_0x17f320=_[_0x496d('0x3c')](_0x16c6c4,[_0x496d('0xa'),_0x496d('0x4b')]);_0x3745c[_0x496d('0x9')]=_0x496d('0x4b');_0x7eef0f=as[_0x496d('0x3d')](_0x37bd22,_0x17f320[_0x496d('0x4c')],_0x3745c);_0x8fe62f[_0x496d('0x4d')][_0x5428af](_0x7eef0f[_0x496d('0x3f')],_0x7eef0f[_0x496d('0x40')][_0x496d('0x41')],_0x7eef0f[_0x496d('0x40')][_0x496d('0x42')]);}break;case _0x496d('0x4e'):var _0x22b394=_0x3745c[_0x496d('0x40')]['split'](',')[_0x496d('0x16')](function(_0x36da67){return Number(_0x36da67);});var _0x21e78f=parseTagParameter(_0x22b394);_0x8fe62f[_0x496d('0x4f')]['clause'][_0x496d('0x45')](_0x21e78f);_0x8fe62f[_0x496d('0x4f')][_0x496d('0x50')]=_0x22b394;break;case'User':if(_0x3745c[_0x496d('0x47')]===_0x496d('0x48')){_0x8fe62f['user'][_0x5428af]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x3745c['value']+'%',null);}else{_0x17f320=_[_0x496d('0x3c')](_0x16c6c4,[_0x496d('0xa'),_0x496d('0x51')]);_0x3745c[_0x496d('0x9')]=_0x496d('0x51');_0x7eef0f=as[_0x496d('0x3d')](_0x37bd22,_0x17f320[_0x496d('0x4c')],_0x3745c);_0x8fe62f[_0x496d('0x52')][_0x5428af](_0x7eef0f[_0x496d('0x3f')],_0x7eef0f[_0x496d('0x40')][_0x496d('0x41')],_0x7eef0f[_0x496d('0x40')][_0x496d('0x42')]);}break;case _0x496d('0x53'):case _0x496d('0x54'):_0x7eef0f=as['buildExpression']('me',null,_0x3745c);_0x8fe62f[_0x496d('0x53')][_0x5428af](_0x7eef0f['text'],_0x7eef0f[_0x496d('0x40')][_0x496d('0x41')],_0x7eef0f[_0x496d('0x40')]['end']);break;}}}return _0x8fe62f;}function parseModelFields(_0x4b1125,_0x4461e4,_0x17e9c0){var _0x1b132e=utils[_0x496d('0x18')](_0x4b1125);var _0x49e591=squel[_0x496d('0x24')]();var _0x1a4146=_(_0x4461e4)[_0x496d('0x55')]()[_0x496d('0x16')](function(_0x1ac98b){return _['some'](_0x17e9c0,[_0x496d('0xa'),_0x1ac98b])?_0x1ac98b:undefined;})[_0x496d('0x56')]()['value']();if(_0x1a4146[_0x496d('0x3b')]>0x0){_0x1a4146[_0x496d('0x26')](function(_0x292a14){if(_0x292a14===_0x1b132e){_0x49e591[_0x496d('0x45')]('i.'+_0x1b132e+_0x496d('0x57'),[][_0x496d('0x58')](_0x4461e4[_0x292a14]));}else if(_0x292a14===_0x496d('0x59')){var _0x106e65=JSON[_0x496d('0x5a')](_0x4461e4[_0x292a14])[_0x496d('0x5b')];var _0x12a56e=JSON[_0x496d('0x5a')](_0x4461e4[_0x292a14])[_0x496d('0x5c')];_0x49e591['and'](_0x496d('0x5d'),_0x106e65,_0x12a56e);}else{if(_0x4461e4[_0x292a14]===_0x496d('0x5e')){_0x49e591[_0x496d('0x45')]('i.'+_0x292a14+_0x496d('0x5f'));}else{_0x49e591[_0x496d('0x45')]('i.'+_0x292a14+_0x496d('0x60'),_0x4461e4[_0x292a14]);}}});}return _0x49e591;}function parseQueryParameters(_0x445362,_0x58a2df,_0x3a69ac){var _0x10143b=getSqlClauses();return Promise['resolve']()[_0x496d('0x61')](function(){return parseModelFields(_0x445362,_0x58a2df,_0x3a69ac);})[_0x496d('0x61')](function(_0x1cfe27){_0x10143b[_0x496d('0x62')][_0x496d('0x45')](_0x1cfe27);return parseReadParameter(_0x58a2df[_0x496d('0x44')]);})['then'](function(_0x573224){_0x10143b[_0x496d('0x44')]['and'](_0x573224);return parseTagParameter(_0x58a2df[_0x496d('0x63')]);})[_0x496d('0x61')](function(_0x4a9474){_0x10143b[_0x496d('0x4f')][_0x496d('0x64')][_0x496d('0x45')](_0x4a9474);return parseSearchFilter(_0x445362,_0x58a2df[_0x496d('0x65')]);})['then'](function(_0x57681b){_0x10143b[_0x496d('0x65')]=_0x57681b;return _0x10143b;});}function checkAccountsRestrictions(_0x28042f,_0xf3dbcc,_0x40da68){var _0x493e2d=utils[_0x496d('0x18')](_0x28042f);var _0x5f319b='get'+_[_0x496d('0x66')](_0x28042f)+(_0x28042f==='chat'?'Websites':_0x496d('0x67'));var _0x14750d=squel[_0x496d('0x24')]();return Promise[_0x496d('0x68')]()['then'](function(){if(_0x40da68[_0x496d('0x69')]&&_0xf3dbcc[_0x496d('0x6')]===_0x496d('0x7')){return _0xf3dbcc[_0x5f319b]({'attributes':['id'],'raw':!![]});}})['then'](function(_0x150101){if(_0x150101){if(_0x150101[_0x496d('0x3b')]===0x0){_0x14750d['and']('i.'+_0x493e2d+_0x496d('0x5f'));}else{_0x14750d[_0x496d('0x45')]('i.'+_0x493e2d+_0x496d('0x57'),_[_0x496d('0x16')](_0x150101,'id'));}}else if(!_0x40da68[_0x493e2d]){_0x14750d['and']('i.'+_0x493e2d+'\x20IS\x20NOT\x20NULL');}})[_0x496d('0x61')](function(){return _0x14750d;});}function getClosedOrderClause(_0x59e1cd,_0x4ee7cd){var _0x4df772='';var _0x4e36b0=['i.thirdDisposition',_0x496d('0x6a'),_0x496d('0x6b')];if(_0x59e1cd===_0x496d('0x32')){_0x4e36b0[_0x496d('0x6c')](_0x496d('0x6d'));}if(_0x4ee7cd[_0x496d('0x6e')]==='0'&&_0x59e1cd===_0x496d('0x32')){_0x4df772='i.substatus';}else{if(_0x4ee7cd[_0x496d('0x6e')]==='1'){_0x4e36b0[_0x496d('0x6f')]();}_0x4df772=_0x496d('0x70')+_0x4e36b0[_0x496d('0x71')](',\x20')+')';}return _0x4df772;}function getFilteredInteractions(_0x537736,_0x4359e3,_0x2bd581,_0x2f7bb0){var _0x1ae213=utils[_0x496d('0xd')](_0x537736);var _0x134a3d=_[_0x496d('0x66')](_0x537736)+'Interaction';var _0xef2626=[];var _0xef9929=getTagsQuery();var _0x14d97b={'type':db[_0x496d('0x72')][_0x496d('0x73')]['SELECT'],'raw':!![]};var _0x34b045=[];var _0x55b04f=[];return db['sequelize'][_0x496d('0x74')](_0xef9929[_0x496d('0x75')](),_0x14d97b)[_0x496d('0x61')](function(_0xca1a5d){_0xef2626=_[_0x496d('0x76')](_0xca1a5d,'id');_0x14d97b=_[_0x496d('0x77')](_0x14d97b,{'model':db[_0x134a3d],'mapToModel':!![],'nest':!![]});if(_0x2bd581[_0x496d('0x62')]){_0x2f7bb0[_0x496d('0x78')][_0x496d('0x26')](function(_0x1d4788){_0x4359e3[_0x496d('0x9')]('i.'+_0x1d4788);});}else{_0x4359e3['field'](_0x496d('0x79'),_0x496d('0x43'));_0x4359e3[_0x496d('0x9')]('a.key','Account.key');_0x4359e3[_0x496d('0x9')](_0x496d('0x7a'),_0x496d('0x7b'));if(_0x537736==='mail'){_0x4359e3[_0x496d('0x9')](_0x496d('0x7c'),_0x496d('0x7d'));_0x4359e3[_0x496d('0x9')](_0x496d('0x7e'),_0x496d('0x7f'));_0x4359e3[_0x496d('0x9')](_0x496d('0x80'));_0x4359e3[_0x496d('0x9')](_0x496d('0x81'));_0x4359e3[_0x496d('0x9')](_0x496d('0x82'));_0x4359e3[_0x496d('0x9')]('i.closed');_0x4359e3[_0x496d('0x9')](_0x496d('0x83'));_0x4359e3[_0x496d('0x9')]('i.attach');_0x4359e3[_0x496d('0x9')](_0x496d('0x84'));_0x4359e3[_0x496d('0x9')](_0x496d('0x85'));_0x4359e3['field']('i.subject');_0x4359e3[_0x496d('0x9')](_0x496d('0x6b'));_0x4359e3[_0x496d('0x9')](_0x496d('0x6a'));_0x4359e3[_0x496d('0x9')](_0x496d('0x86'));_0x4359e3[_0x496d('0x9')](_0x496d('0x6d'));_0x4359e3[_0x496d('0x9')](_0x496d('0x87'));_0x4359e3[_0x496d('0x9')](_0x496d('0x88'));_0x4359e3['field'](_0x496d('0x89'));_0x4359e3[_0x496d('0x9')](_0x496d('0x8a'));}else if(_0x537736===_0x496d('0x30')){_0x4359e3[_0x496d('0x9')](_0x496d('0x8b'),_0x496d('0x7f'));}else{_0x4359e3[_0x496d('0x9')](_0x496d('0x8c'),_0x496d('0x7f'));}if(_0x537736!==_0x496d('0x32')){_0x4359e3[_0x496d('0x9')](_0x496d('0x8d'));}_0x4359e3[_0x496d('0x9')]('c.firstName',_0x496d('0x8e'));_0x4359e3[_0x496d('0x9')]('c.lastName','Contact.lastName');_0x4359e3[_0x496d('0x9')](_0x496d('0x8f'),_0x496d('0x90'));_0x4359e3['field'](_0x496d('0x91'),'Contact.phone');_0x4359e3['field']('c.mobile',_0x496d('0x92'));_0x4359e3[_0x496d('0x9')](_0x496d('0x93'),_0x496d('0x94'));_0x4359e3[_0x496d('0x9')](_0x496d('0x95'),'Owner.fullname');_0x4359e3[_0x496d('0x9')]('o.internal',_0x496d('0x96'));_0x4359e3[_0x496d('0x9')](_0x496d('0x97'),_0x496d('0x98'));}if(_0x2f7bb0['limit']){_0x4359e3['limit'](_0x2f7bb0['limit']);}if(_0x2f7bb0[_0x496d('0x99')]){_0x4359e3['offset'](_0x2f7bb0[_0x496d('0x99')]);}return db[_0x496d('0x9a')][_0x496d('0x74')](_0x4359e3[_0x496d('0x75')](),_0x14d97b);})['then'](function(_0x5ec418){_0x34b045=_0x5ec418;var _0x5bcb98=getUsersQuery(_0x537736,_0x34b045);return db[_0x496d('0x9a')][_0x496d('0x74')](_0x5bcb98['toString'](),_0x14d97b);})[_0x496d('0x61')](function(_0x524268){_0x55b04f=_['groupBy'](_0x524268,_0x1ae213);if(_0x537736===_0x496d('0x32')){return db[_0x496d('0x9b')]['findOne']({'attributes':[_0x496d('0x9c')],'raw':!![]});}})[_0x496d('0x61')](function(_0x3ff5cc){var _0x3bd4a0=_0x3ff5cc?_0x3ff5cc['enableEmailPreview']:undefined;var _0x4ab7f5=_0x34b045[_0x496d('0x16')](function(_0x10c0bc){return updateInteraction(_0x10c0bc,_0xef2626,_0x55b04f,_0x3bd4a0);});return Promise['all'](_0x4ab7f5);});}function countFilteredInteractions(_0x32bfe0,_0x356571){var _0x51bbf7=_0x32bfe0['clone']();_0x51bbf7[_0x496d('0x9')]('COUNT(*)');_0x51bbf7[_0x496d('0x9')](_0x496d('0x79'),_0x496d('0x43'));var _0x1f692b=utils[_0x496d('0x25')](_0x356571);if(!_[_0x496d('0x9d')](_0x1f692b)){_0x51bbf7['where']('t.id\x20IN\x20?',_0x1f692b);}var _0x506578={'type':db[_0x496d('0x72')]['QueryTypes']['SELECT'],'raw':!![]};return db['sequelize'][_0x496d('0x74')](_0x51bbf7[_0x496d('0x75')](),_0x506578);}module['exports']={'checkAccountsRestrictions':checkAccountsRestrictions,'countFilteredInteractions':countFilteredInteractions,'getClosedOrderClause':getClosedOrderClause,'getFilteredInteractions':getFilteredInteractions,'getInteractionsQuery':getInteractionsQuery,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipInteractionsQuery':skipInteractionsQuery}; \ No newline at end of file diff --git a/server/components/interaction/update-interaction.js b/server/components/interaction/update-interaction.js index dc7700f..fd0eeb7 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 _0x6a88=['updateInteraction','Users','TagIds','then','Tags','lodash','map','fullname','split','forEach','talking','unmanaged','total','closed','disposition','abandoned','UserId','answered','waiting','MailMessage','out','plainBody','-id','lastMsgText','trimStart'];(function(_0x1b349a,_0x22222c){var _0x5d1f7c=function(_0x368d7c){while(--_0x368d7c){_0x1b349a['push'](_0x1b349a['shift']());}};_0x5d1f7c(++_0x22222c);}(_0x6a88,0x14a));var _0x86a8=function(_0x38f5f8,_0xefe164){_0x38f5f8=_0x38f5f8-0x0;var _0x34e820=_0x6a88[_0x38f5f8];return _0x34e820;};'use strict';var _=require(_0x86a8('0x0'));var db=require('../../mysqldb')['db'];function getInteractionUsers(_0x382660,_0x4133ba){return new Promise(function(_0x12d967,_0x1cedd9){try{var _0xc0ad17=[];if(_0x4133ba[_0x382660]){_0xc0ad17=_0x4133ba[_0x382660][_0x86a8('0x1')](function(_0x182214){return{'id':_0x182214['id'],'fullname':_0x182214[_0x86a8('0x2')]};});}return _0x12d967(_0xc0ad17);}catch(_0x364874){_0x1cedd9(_0x364874);}});}function getInteractionTags(_0x22ec03,_0x7d519){var _0x3a9a02=[];if(_0x22ec03){_0x22ec03[_0x86a8('0x3')](',')[_0x86a8('0x4')](function(_0x5a866b){_0x3a9a02['push'](_0x7d519[_0x5a866b]);});}return _0x3a9a02;}function updateWaitingCounter(_0x248257){if(_0x248257['waiting']){_0x248257['waiting']-=0x1;}}function updateInteractionCounters(_0x12ac05){_0x12ac05['waiting']=0x0;_0x12ac05[_0x86a8('0x5')]=0x0;_0x12ac05['answered']=0x0;_0x12ac05[_0x86a8('0x6')]=0x0;_0x12ac05['abandoned']=0x0;_0x12ac05[_0x86a8('0x7')]=0x0;if(_0x12ac05[_0x86a8('0x8')]){if(_0x12ac05[_0x86a8('0x9')]===_0x86a8('0xa')){_0x12ac05['abandoned']+=0x1;updateWaitingCounter(_0x12ac05);}if(_0x12ac05[_0x86a8('0xb')]){_0x12ac05[_0x86a8('0xc')]+=0x1;if(_0x12ac05['talking']){_0x12ac05[_0x86a8('0x5')]-=0x1;}}else{if(_0x12ac05[_0x86a8('0x9')]){_0x12ac05['unmanaged']+=0x1;updateWaitingCounter(_0x12ac05);}}}else{if(!_0x12ac05[_0x86a8('0xb')]){_0x12ac05[_0x86a8('0xd')]+=0x1;}if(_0x12ac05[_0x86a8('0xb')]){_0x12ac05[_0x86a8('0x5')]+=0x1;updateWaitingCounter(_0x12ac05);}}_0x12ac05[_0x86a8('0x7')]+=0x1;return _0x12ac05;}function getLastMessageText(_0x2ec5b9){return db[_0x86a8('0xe')]['findOne']({'where':{'$and':[{'MailInteractionId':_0x2ec5b9['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0x86a8('0xf')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0x86a8('0x10')],'order':_0x86a8('0x11'),'raw':!![]})['then'](function(_0x59b216){if(_0x59b216&&_0x59b216[_0x86a8('0x10')]){_0x2ec5b9[_0x86a8('0x12')]=_[_0x86a8('0x13')](_0x59b216['plainBody']);}return _0x2ec5b9;})['catch'](function(_0x180f3f){throw _0x180f3f;});}exports[_0x86a8('0x14')]=function(_0x3032ab,_0x7c893b,_0x53764c,_0x2faee4){return new Promise(function(_0x74750e,_0x4eaaab){return getInteractionUsers(_0x3032ab['id'],_0x53764c)['then'](function(_0xd93e10){_0x3032ab[_0x86a8('0x15')]=_0xd93e10;return getInteractionTags(_0x3032ab[_0x86a8('0x16')],_0x7c893b);})[_0x86a8('0x17')](function(_0xee59ab){_0x3032ab[_0x86a8('0x18')]=_0xee59ab;delete _0x3032ab['TagIds'];return updateInteractionCounters(_0x3032ab);})[_0x86a8('0x17')](function(_0x4406cd){if(_0x2faee4){return getLastMessageText(_0x4406cd);}else{return _0x4406cd;}})['then'](function(_0xb382f){_0x74750e(_0xb382f);})['catch'](function(_0x213c7f){_0x4eaaab(_0x213c7f);});});}; \ No newline at end of file +var _0x5727=['closed','disposition','abandoned','UserId','MailMessage','out','-id','then','plainBody','lastMsgText','trimStart','catch','updateInteraction','Users','TagIds','Tags','../../mysqldb','map','fullname','split','forEach','push','waiting','talking','answered','unmanaged','total'];(function(_0x556bb1,_0x34830d){var _0x45455f=function(_0x13c6ba){while(--_0x13c6ba){_0x556bb1['push'](_0x556bb1['shift']());}};_0x45455f(++_0x34830d);}(_0x5727,0x154));var _0x7572=function(_0x283b7c,_0x53bb1f){_0x283b7c=_0x283b7c-0x0;var _0x2a26ea=_0x5727[_0x283b7c];return _0x2a26ea;};'use strict';var _=require('lodash');var db=require(_0x7572('0x0'))['db'];function getInteractionUsers(_0xdff30f,_0xa8dedf){return new Promise(function(_0x533923,_0x4978ea){try{var _0x166b95=[];if(_0xa8dedf[_0xdff30f]){_0x166b95=_0xa8dedf[_0xdff30f][_0x7572('0x1')](function(_0x58ec5a){return{'id':_0x58ec5a['id'],'fullname':_0x58ec5a[_0x7572('0x2')]};});}return _0x533923(_0x166b95);}catch(_0x22144a){_0x4978ea(_0x22144a);}});}function getInteractionTags(_0x2a33cf,_0x323137){var _0x56dbff=[];if(_0x2a33cf){_0x2a33cf[_0x7572('0x3')](',')[_0x7572('0x4')](function(_0x49b54c){_0x56dbff[_0x7572('0x5')](_0x323137[_0x49b54c]);});}return _0x56dbff;}function updateWaitingCounter(_0xf934c2){if(_0xf934c2[_0x7572('0x6')]){_0xf934c2[_0x7572('0x6')]-=0x1;}}function updateInteractionCounters(_0x70f015){_0x70f015[_0x7572('0x6')]=0x0;_0x70f015[_0x7572('0x7')]=0x0;_0x70f015[_0x7572('0x8')]=0x0;_0x70f015[_0x7572('0x9')]=0x0;_0x70f015['abandoned']=0x0;_0x70f015[_0x7572('0xa')]=0x0;if(_0x70f015[_0x7572('0xb')]){if(_0x70f015[_0x7572('0xc')]===_0x7572('0xd')){_0x70f015[_0x7572('0xd')]+=0x1;updateWaitingCounter(_0x70f015);}if(_0x70f015[_0x7572('0xe')]){_0x70f015[_0x7572('0x8')]+=0x1;if(_0x70f015[_0x7572('0x7')]){_0x70f015[_0x7572('0x7')]-=0x1;}}else{if(_0x70f015[_0x7572('0xc')]){_0x70f015[_0x7572('0x9')]+=0x1;updateWaitingCounter(_0x70f015);}}}else{if(!_0x70f015[_0x7572('0xe')]){_0x70f015[_0x7572('0x6')]+=0x1;}if(_0x70f015[_0x7572('0xe')]){_0x70f015[_0x7572('0x7')]+=0x1;updateWaitingCounter(_0x70f015);}}_0x70f015[_0x7572('0xa')]+=0x1;return _0x70f015;}function getLastMessageText(_0x4d2f34){return db[_0x7572('0xf')]['findOne']({'where':{'$and':[{'MailInteractionId':_0x4d2f34['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0x7572('0x10')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':['plainBody'],'order':_0x7572('0x11'),'raw':!![]})[_0x7572('0x12')](function(_0x10012a){if(_0x10012a&&_0x10012a[_0x7572('0x13')]){_0x4d2f34[_0x7572('0x14')]=_[_0x7572('0x15')](_0x10012a[_0x7572('0x13')]);}return _0x4d2f34;})[_0x7572('0x16')](function(_0x1d4a45){throw _0x1d4a45;});}exports[_0x7572('0x17')]=function(_0x2b10b5,_0x104d98,_0x312896,_0x54143b){return new Promise(function(_0x4c8c82,_0x164e1c){return getInteractionUsers(_0x2b10b5['id'],_0x312896)['then'](function(_0x358cbd){_0x2b10b5[_0x7572('0x18')]=_0x358cbd;return getInteractionTags(_0x2b10b5[_0x7572('0x19')],_0x104d98);})[_0x7572('0x12')](function(_0x8fdae3){_0x2b10b5[_0x7572('0x1a')]=_0x8fdae3;delete _0x2b10b5[_0x7572('0x19')];return updateInteractionCounters(_0x2b10b5);})[_0x7572('0x12')](function(_0x235b90){if(_0x54143b){return getLastMessageText(_0x235b90);}else{return _0x235b90;}})['then'](function(_0x1c5e8b){_0x4c8c82(_0x1c5e8b);})[_0x7572('0x16')](function(_0x2078f7){_0x164e1c(_0x2078f7);});});}; \ No newline at end of file diff --git a/server/components/interaction/utils.js b/server/components/interaction/utils.js index bdedc7b..dc569a0 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 _0x98c2=['Interaction','findOne','update','info','catch','error','../../mysqldb','../../config/logger','openchannel-interactions','mail-interactions','fax-interactions','sms-interactions','whatsapp-interactions','capitalize','chat','InteractionId','upperFirst','websites','accounts','_interactions','_interaction_has_tags','_messages','user_has_','toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','role','stringify','null'];(function(_0x486338,_0x2ab3f9){var _0x4c8298=function(_0x21130d){while(--_0x21130d){_0x486338['push'](_0x486338['shift']());}};_0x4c8298(++_0x2ab3f9);}(_0x98c2,0x128));var _0x298c=function(_0x4b7b62,_0x4920a9){_0x4b7b62=_0x4b7b62-0x0;var _0x2280df=_0x98c2[_0x4b7b62];return _0x2280df;};'use strict';var _=require('lodash');var db=require(_0x298c('0x0'))['db'];var loggers={'openchannel':require(_0x298c('0x1'))(_0x298c('0x2')),'mail':require(_0x298c('0x1'))(_0x298c('0x3')),'fax':require(_0x298c('0x1'))(_0x298c('0x4')),'sms':require(_0x298c('0x1'))(_0x298c('0x5')),'chat':require(_0x298c('0x1'))('chat-interactions'),'whatsapp':require(_0x298c('0x1'))(_0x298c('0x6'))};function getAccountFK(_0x318b9b){return _[_0x298c('0x7')](_0x318b9b)+(_0x318b9b===_0x298c('0x8')?'Website':'Account')+'Id';}function getInteractionFK(_0x451b6a){return _[_0x298c('0x7')](_0x451b6a)+_0x298c('0x9');}function getInteractionId(_0x1a2313,_0x517637,_0x150eca){if(_0x1a2313&&_0x1a2313[_[_0x298c('0xa')](_0x150eca)+_0x298c('0x9')]){return _0x1a2313[_[_0x298c('0xa')](_0x150eca)+_0x298c('0x9')];}else if(_0x1a2313&&_0x1a2313['id']){return _0x1a2313['id'];}else if(_0x517637&&_0x517637['id']){return _0x517637['id'];}else{return'unknown';}}function getInteractionsTables(_0x44b539){return{'accounts':_0x44b539+'_'+(_0x44b539===_0x298c('0x8')?_0x298c('0xb'):_0x298c('0xc')),'interactions':_0x44b539+_0x298c('0xd'),'interactionsTags':_0x44b539+_0x298c('0xe'),'messages':_0x44b539+_0x298c('0xf'),'userInteractions':_0x298c('0x10')+_0x44b539+_0x298c('0xd')};}function getSelectedTags(_0x4a260a){var _0x288199=[];if(_0x4a260a){_0x288199=Array['isArray'](_0x4a260a)?_0x4a260a:[_0x4a260a];}return _0x288199;}function log(_0x2e4761,_0x66d41e,_0x432079,_0x15df96,_0x449b18,_0x588cfc){loggers[_0x449b18[_0x298c('0x11')]()][_0x2e4761](_0x298c('0x12'),_0x588cfc[_0x298c('0x13')](),_0x66d41e?_0x66d41e['id']:null,_0x66d41e?_0x66d41e['name']:null,_0x66d41e?_0x66d41e[_0x298c('0x14')]:null,getInteractionId(_0x432079,_0x15df96,_0x449b18),_0x432079?JSON[_0x298c('0x15')](_0x432079):_0x298c('0x16'));}function updateUser(_0x26c2af,_0x364891,_0x5c6bcc,_0x20ea9b,_0x313b31){db[_['upperFirst'](_0x20ea9b)+_0x298c('0x17')][_0x298c('0x18')]({'where':{'id':getInteractionId(_0x364891,_0x5c6bcc,_0x20ea9b)}})['then'](function(_0x28842c){if(_0x28842c){return _0x28842c[_0x298c('0x19')]({'UserId':_0x26c2af?_0x26c2af['id']:null});}})['then'](function(_0x2b1ad9){if(_0x2b1ad9){log(_0x298c('0x1a'),_0x26c2af,_0x364891,_0x5c6bcc,_0x20ea9b,_0x313b31);}})[_0x298c('0x1b')](function(){log(_0x298c('0x1c'),_0x26c2af,_0x364891,_0x5c6bcc,_0x20ea9b,_0x313b31);});}module['exports']={'getAccountFK':getAccountFK,'getInteractionFK':getInteractionFK,'getInteractionsTables':getInteractionsTables,'getSelectedTags':getSelectedTags,'updateUser':updateUser}; \ No newline at end of file +var _0x6e2a=['null','Interaction','findOne','then','info','catch','error','exports','lodash','../../config/logger','mail-interactions','fax-interactions','whatsapp-interactions','capitalize','chat','Account','InteractionId','upperFirst','websites','_interactions','_messages','user_has_','isArray','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','stringify'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6e2a,0x140));var _0xa6e2=function(_0x4c14e1,_0x164882){_0x4c14e1=_0x4c14e1-0x0;var _0x4accda=_0x6e2a[_0x4c14e1];return _0x4accda;};'use strict';var _=require(_0xa6e2('0x0'));var db=require('../../mysqldb')['db'];var loggers={'openchannel':require(_0xa6e2('0x1'))('openchannel-interactions'),'mail':require(_0xa6e2('0x1'))(_0xa6e2('0x2')),'fax':require(_0xa6e2('0x1'))(_0xa6e2('0x3')),'sms':require('../../config/logger')('sms-interactions'),'chat':require(_0xa6e2('0x1'))('chat-interactions'),'whatsapp':require('../../config/logger')(_0xa6e2('0x4'))};function getAccountFK(_0x1d4228){return _[_0xa6e2('0x5')](_0x1d4228)+(_0x1d4228===_0xa6e2('0x6')?'Website':_0xa6e2('0x7'))+'Id';}function getInteractionFK(_0x49cf79){return _[_0xa6e2('0x5')](_0x49cf79)+_0xa6e2('0x8');}function getInteractionId(_0x3e3c4b,_0x5dac7b,_0x1af6d3){if(_0x3e3c4b&&_0x3e3c4b[_[_0xa6e2('0x9')](_0x1af6d3)+_0xa6e2('0x8')]){return _0x3e3c4b[_['upperFirst'](_0x1af6d3)+'InteractionId'];}else if(_0x3e3c4b&&_0x3e3c4b['id']){return _0x3e3c4b['id'];}else if(_0x5dac7b&&_0x5dac7b['id']){return _0x5dac7b['id'];}else{return'unknown';}}function getInteractionsTables(_0x8c645){return{'accounts':_0x8c645+'_'+(_0x8c645===_0xa6e2('0x6')?_0xa6e2('0xa'):'accounts'),'interactions':_0x8c645+_0xa6e2('0xb'),'interactionsTags':_0x8c645+'_interaction_has_tags','messages':_0x8c645+_0xa6e2('0xc'),'userInteractions':_0xa6e2('0xd')+_0x8c645+_0xa6e2('0xb')};}function getSelectedTags(_0x4ec6b6){var _0x5781b8=[];if(_0x4ec6b6){_0x5781b8=Array[_0xa6e2('0xe')](_0x4ec6b6)?_0x4ec6b6:[_0x4ec6b6];}return _0x5781b8;}function log(_0x49ae6a,_0x1a677c,_0x513f7b,_0x349f64,_0x19c77f,_0x369936){loggers[_0x19c77f['toLowerCase']()][_0x49ae6a](_0xa6e2('0xf'),_0x369936['toUpperCase'](),_0x1a677c?_0x1a677c['id']:null,_0x1a677c?_0x1a677c['name']:null,_0x1a677c?_0x1a677c[_0xa6e2('0x10')]:null,getInteractionId(_0x513f7b,_0x349f64,_0x19c77f),_0x513f7b?JSON[_0xa6e2('0x11')](_0x513f7b):_0xa6e2('0x12'));}function updateUser(_0x466d6e,_0x4374c7,_0x4c06f3,_0x220ecf,_0x3ee857){db[_[_0xa6e2('0x9')](_0x220ecf)+_0xa6e2('0x13')][_0xa6e2('0x14')]({'where':{'id':getInteractionId(_0x4374c7,_0x4c06f3,_0x220ecf)}})[_0xa6e2('0x15')](function(_0x161ee0){if(_0x161ee0){return _0x161ee0['update']({'UserId':_0x466d6e?_0x466d6e['id']:null});}})['then'](function(_0x535c25){if(_0x535c25){log(_0xa6e2('0x16'),_0x466d6e,_0x4374c7,_0x4c06f3,_0x220ecf,_0x3ee857);}})[_0xa6e2('0x17')](function(){log(_0xa6e2('0x18'),_0x466d6e,_0x4374c7,_0x4c06f3,_0x220ecf,_0x3ee857);});}module[_0xa6e2('0x19')]={'getAccountFK':getAccountFK,'getInteractionFK':getInteractionFK,'getInteractionsTables':getInteractionsTables,'getSelectedTags':getSelectedTags,'updateUser':updateUser}; \ No newline at end of file diff --git a/server/components/license/service.js b/server/components/license/service.js index e6cb456..f938bfa 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 _0x2776=['findOne','then','count','json','Maximum\x20%s\x20limit\x20have\x20been\x20reached','users','User','admin','user','isUserLimit','crypto','util','composable-middleware','../../mysqldb','../../config/environment','data1','license','aes-256-ctr','format','%s:%s:%s','update','base64','utf8','final','parse','use','License'];(function(_0x277b55,_0x8ba28){var _0xff0d15=function(_0x1beefc){while(--_0x1beefc){_0x277b55['push'](_0x277b55['shift']());}};_0xff0d15(++_0x8ba28);}(_0x2776,0x118));var _0x6277=function(_0x4d1f98,_0x1486b5){_0x4d1f98=_0x4d1f98-0x0;var _0x1992bf=_0x2776[_0x4d1f98];return _0x1992bf;};'use strict';var crypto=require(_0x6277('0x0'));var util=require(_0x6277('0x1'));var compose=require(_0x6277('0x2'));var db=require(_0x6277('0x3'))['db'];var config=require(_0x6277('0x4'));function getValueFromLicense(_0x528b0b,_0x5a08c9){if(_0x528b0b&&_0x5a08c9){if(_0x5a08c9[_0x6277('0x5')]&&_0x5a08c9[_0x6277('0x6')]){var _0xd02b4c=_0x5a08c9[_0x6277('0x5')];var _0xa6a27=_0x5a08c9['license'];var _0x188b27=_0xd02b4c['split']('-')[0x4];var _0x2abcdf=_0xd02b4c['split']('-')[0x0];var _0x2273ef=crypto['createDecipher'](_0x6277('0x7'),util[_0x6277('0x8')](_0x6277('0x9'),_0x188b27,_0xd02b4c,_0x2abcdf));var _0xf6ead7=_0x2273ef[_0x6277('0xa')](_0xa6a27,_0x6277('0xb'),_0x6277('0xc'));_0xf6ead7+=_0x2273ef[_0x6277('0xd')]('utf8');var _0x590a64=JSON[_0x6277('0xe')](_0xf6ead7);return _0x590a64['hasOwnProperty'](_0x528b0b)?_0x590a64[_0x528b0b]:null;}}return null;}function isLimit(_0x46e76e,_0x7032b5,_0x5d248c,_0x195d13){var _0x215473=_0x7032b5;return compose()[_0x6277('0xf')](function(_0x595169,_0x2787bf,_0x4b65d0){return db[_0x6277('0x10')][_0x6277('0x11')]({'where':{'id':0x1},'raw':!![]})[_0x6277('0x12')](function(_0x3d8888){var _0x6dc55=getValueFromLicense(_0x46e76e,_0x3d8888);return _0x6dc55?_0x6dc55:_0x215473;})[_0x6277('0x12')](function(_0x53aeff){_0x215473=_0x53aeff;return _0x5d248c[_0x6277('0x13')](_0x195d13);})[_0x6277('0x12')](function(_0x178033){if(_0x178033>=_0x215473){return _0x2787bf['status'](0x193)[_0x6277('0x14')]({'message':util['format'](_0x6277('0x15'),_0x46e76e)});}_0x4b65d0();})['catch'](function(_0x2b76a1){_0x4b65d0(_0x2b76a1);});});}function isUserLimit(){return isLimit(_0x6277('0x16'),0x1,db[_0x6277('0x17')],{'where':{'$or':[{'role':_0x6277('0x18')},{'role':_0x6277('0x19')}]}});}exports[_0x6277('0x1a')]=isUserLimit; \ No newline at end of file +var _0x4dd7=['../../mysqldb','data1','license','split','createDecipher','aes-256-ctr','format','update','utf8','final','parse','hasOwnProperty','use','findOne','then','count','status','json','catch','users','User','admin','user','isUserLimit','crypto','composable-middleware'];(function(_0x45c981,_0x2ad2d4){var _0x4f62c8=function(_0x55209b){while(--_0x55209b){_0x45c981['push'](_0x45c981['shift']());}};_0x4f62c8(++_0x2ad2d4);}(_0x4dd7,0x1d2));var _0x74dd=function(_0x53ec25,_0x597be6){_0x53ec25=_0x53ec25-0x0;var _0x287975=_0x4dd7[_0x53ec25];return _0x287975;};'use strict';var crypto=require(_0x74dd('0x0'));var util=require('util');var compose=require(_0x74dd('0x1'));var db=require(_0x74dd('0x2'))['db'];var config=require('../../config/environment');function getValueFromLicense(_0x1b344b,_0xc3947a){if(_0x1b344b&&_0xc3947a){if(_0xc3947a[_0x74dd('0x3')]&&_0xc3947a[_0x74dd('0x4')]){var _0x479e63=_0xc3947a[_0x74dd('0x3')];var _0x1f54b2=_0xc3947a['license'];var _0x1cba0c=_0x479e63[_0x74dd('0x5')]('-')[0x4];var _0x781317=_0x479e63[_0x74dd('0x5')]('-')[0x0];var _0x4f91ff=crypto[_0x74dd('0x6')](_0x74dd('0x7'),util[_0x74dd('0x8')]('%s:%s:%s',_0x1cba0c,_0x479e63,_0x781317));var _0x372da1=_0x4f91ff[_0x74dd('0x9')](_0x1f54b2,'base64',_0x74dd('0xa'));_0x372da1+=_0x4f91ff[_0x74dd('0xb')](_0x74dd('0xa'));var _0x739464=JSON[_0x74dd('0xc')](_0x372da1);return _0x739464[_0x74dd('0xd')](_0x1b344b)?_0x739464[_0x1b344b]:null;}}return null;}function isLimit(_0x84ab35,_0x589fc0,_0x5bdc99,_0x4c41de){var _0x562c30=_0x589fc0;return compose()[_0x74dd('0xe')](function(_0x50495f,_0x56779e,_0x4f0749){return db['License'][_0x74dd('0xf')]({'where':{'id':0x1},'raw':!![]})[_0x74dd('0x10')](function(_0x2fe99e){var _0x4ffaba=getValueFromLicense(_0x84ab35,_0x2fe99e);return _0x4ffaba?_0x4ffaba:_0x562c30;})[_0x74dd('0x10')](function(_0x4155ac){_0x562c30=_0x4155ac;return _0x5bdc99[_0x74dd('0x11')](_0x4c41de);})[_0x74dd('0x10')](function(_0x51864f){if(_0x51864f>=_0x562c30){return _0x56779e[_0x74dd('0x12')](0x193)[_0x74dd('0x13')]({'message':util[_0x74dd('0x8')]('Maximum\x20%s\x20limit\x20have\x20been\x20reached',_0x84ab35)});}_0x4f0749();})[_0x74dd('0x14')](function(_0xcc6db5){_0x4f0749(_0xcc6db5);});});}function isUserLimit(){return isLimit(_0x74dd('0x15'),0x1,db[_0x74dd('0x16')],{'where':{'$or':[{'role':_0x74dd('0x17')},{'role':_0x74dd('0x18')}]}});}exports[_0x74dd('0x19')]=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index 65247e4..c047aed 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 _0xb323=['$gt','$lte','add','format','castTo','text','CAST(','field','includes','$ne','$notIn','\x20IS\x20NULL)','IN\x20?','=\x20?','<>\x20?','$substring','$startsWith','$endsWith','$lt','<\x20?','>\x20?','<=\x20?','>=\x20?','$in','start','utcOffset','minutes','seconds','moment','startsWith','[$or]','and','replace','[$and]','split','length','slice','forEach','shift','match','indexOf','map','conditions','push','buildExpression','DATE','operator','$eq','$between','value'];(function(_0x5dc191,_0x27363c){var _0x1716be=function(_0x4aaa8b){while(--_0x4aaa8b){_0x5dc191['push'](_0x5dc191['shift']());}};_0x1716be(++_0x27363c);}(_0xb323,0x1ac));var _0x3b32=function(_0x5e71a6,_0x5487ce){_0x5e71a6=_0x5e71a6-0x0;var _0x292b4d=_0xb323[_0x5e71a6];return _0x292b4d;};'use strict';var _=require('lodash');var moment=require(_0x3b32('0x0'));exports['parseSearch']=function(_0x3c761d){var _0x5c55a6={'conditions':[]};_0x5c55a6['sqlOperator']=_[_0x3b32('0x1')](_0x3c761d,_0x3b32('0x2'))?'or':_0x3b32('0x3');var _0x332952=_0x3c761d[_0x3b32('0x4')](_0x3b32('0x5'),'')['replace']('[$or]','')[_0x3b32('0x6')]('||');for(var _0x44d41d=0x0;_0x44d41d<_0x332952[_0x3b32('0x7')];_0x44d41d++){var _0x2d9333=_0x332952[_0x44d41d][_0x3b32('0x6')](':=');var _0x58fd48=_0x2d9333[0x0];var _0x504322=_0x2d9333[_0x3b32('0x8')](0x1);_0x504322[_0x3b32('0x9')](function(_0x333462){var _0x490be0=_0x333462[_0x3b32('0x6')]('[')[_0x3b32('0xa')]();var _0x462492=_0x333462[_0x3b32('0xb')](/\[(.*?)\]/g);_0x462492[_0x3b32('0x9')](function(_0x171911){var _0x4ac7b2=_0x171911[_0x3b32('0x6')]('[')['filter'](function(_0x249171){return _0x249171[_0x3b32('0xc')](']')>-0x1;})[_0x3b32('0xd')](function(_0x490858){return _0x490858[_0x3b32('0x6')](']')[0x0];})[0x0];_0x5c55a6[_0x3b32('0xe')][_0x3b32('0xf')]({'field':_0x58fd48,'operator':_0x490be0,'value':_0x4ac7b2});});});}return _0x5c55a6;};exports[_0x3b32('0x10')]=function(_0x2d289b,_0x5aed12,_0x4f82bc){var _0x4f439b={};if(_0x5aed12===_0x3b32('0x11')){if(_0x4f82bc[_0x3b32('0x12')]===_0x3b32('0x13')){_0x4f82bc[_0x3b32('0x12')]=_0x3b32('0x14');_0x4f82bc[_0x3b32('0x15')]+=','+_0x4f82bc[_0x3b32('0x15')];}else if(_['includes']([_0x3b32('0x16'),_0x3b32('0x17')],_0x4f82bc['operator'])){_0x4f82bc[_0x3b32('0x15')]=moment(_0x4f82bc[_0x3b32('0x15')])[_0x3b32('0x18')](0x1,'days')[_0x3b32('0x19')]('YYYY-MM-DD');}}if(_0x4f82bc[_0x3b32('0x1a')]){_0x5aed12=_0x4f82bc[_0x3b32('0x1a')];_0x4f439b[_0x3b32('0x1b')]=_0x3b32('0x1c')+_0x2d289b+'.'+_0x4f82bc[_0x3b32('0x1d')]+'\x20AS\x20'+_0x4f82bc[_0x3b32('0x1a')]+')\x20'+parseOperator(_0x4f82bc[_0x3b32('0x12')]);}else{_0x4f439b['text']=_0x2d289b+'.'+_0x4f82bc[_0x3b32('0x1d')]+'\x20'+parseOperator(_0x4f82bc['operator']);}if(_[_0x3b32('0x1e')]([_0x3b32('0x1f'),_0x3b32('0x20')],_0x4f82bc['operator']))_0x4f439b[_0x3b32('0x1b')]='('+_0x4f439b[_0x3b32('0x1b')]+'\x20OR\x20'+_0x2d289b+'.'+_0x4f82bc[_0x3b32('0x1d')]+_0x3b32('0x21');_0x4f439b[_0x3b32('0x15')]=parseValue(_0x5aed12,_0x4f82bc[_0x3b32('0x12')],_0x4f82bc[_0x3b32('0x15')]);return _0x4f439b;};function parseOperator(_0x5f3e38){var _0x4e4afa;switch(_0x5f3e38){case'$in':_0x4e4afa=_0x3b32('0x22');break;case'$notIn':_0x4e4afa='NOT\x20IN\x20?';break;case _0x3b32('0x13'):_0x4e4afa=_0x3b32('0x23');break;case'$ne':_0x4e4afa=_0x3b32('0x24');break;case _0x3b32('0x25'):case _0x3b32('0x26'):case _0x3b32('0x27'):_0x4e4afa='LIKE\x20?';break;case _0x3b32('0x28'):_0x4e4afa=_0x3b32('0x29');break;case'$gt':_0x4e4afa=_0x3b32('0x2a');break;case _0x3b32('0x17'):_0x4e4afa=_0x3b32('0x2b');break;case'$gte':_0x4e4afa=_0x3b32('0x2c');break;case _0x3b32('0x14'):_0x4e4afa='BETWEEN\x20?\x20AND\x20?';break;}return _0x4e4afa;}function parseValue(_0x53c2cc,_0x1ae4dd,_0x21a072){var _0x31de5b={'start':undefined,'end':undefined};switch(_0x1ae4dd){case _0x3b32('0x2d'):case'$notIn':_0x31de5b['start']=_0x21a072[_0x3b32('0x6')](',');break;case _0x3b32('0x25'):_0x31de5b[_0x3b32('0x2e')]='%'+_0x21a072+'%';break;case _0x3b32('0x26'):_0x31de5b[_0x3b32('0x2e')]=_0x21a072+'%';break;case _0x3b32('0x27'):_0x31de5b[_0x3b32('0x2e')]='%'+_0x21a072;break;case _0x3b32('0x14'):var _0x5e65a0=_0x21a072[_0x3b32('0x6')](',');var _0x21a072=_0x5e65a0[_0x3b32('0xa')]();var _0x19eaa8=_0x5e65a0['pop']();if(_0x53c2cc==='DATE'){_0x21a072=moment(_0x21a072)[_0x3b32('0x2f')](0x0,!![])[_0x3b32('0x19')]();_0x19eaa8=moment(_0x19eaa8)[_0x3b32('0x2f')](0x0,!![])[_0x3b32('0x18')](0x17,'hours')[_0x3b32('0x18')](0x3b,_0x3b32('0x30'))[_0x3b32('0x18')](0x3b,_0x3b32('0x31'))[_0x3b32('0x19')]();}_0x31de5b={'start':_0x21a072,'end':_0x19eaa8};break;default:_0x31de5b['start']=_0x21a072;break;}return _0x31de5b;} \ No newline at end of file +var _0x6d1f=['$notIn','\x20IS\x20NULL)','IN\x20?','=\x20?','$ne','<>\x20?','$startsWith','$endsWith','$lt','<\x20?','>\x20?','$gte','$in','$substring','start','pop','DATE','utcOffset','hours','minutes','seconds','lodash','moment','parseSearch','sqlOperator','startsWith','[$or]','replace','[$and]','length','slice','shift','match','forEach','split','indexOf','map','conditions','push','buildExpression','operator','$eq','$between','value','includes','$gt','$lte','add','days','format','YYYY-MM-DD','castTo','text','CAST(','field'];(function(_0x2a1493,_0x2823df){var _0x46b988=function(_0x15c467){while(--_0x15c467){_0x2a1493['push'](_0x2a1493['shift']());}};_0x46b988(++_0x2823df);}(_0x6d1f,0x83));var _0xf6d1=function(_0x45de41,_0x18455e){_0x45de41=_0x45de41-0x0;var _0x51c8c9=_0x6d1f[_0x45de41];return _0x51c8c9;};'use strict';var _=require(_0xf6d1('0x0'));var moment=require(_0xf6d1('0x1'));exports[_0xf6d1('0x2')]=function(_0x2b7023){var _0x590b13={'conditions':[]};_0x590b13[_0xf6d1('0x3')]=_[_0xf6d1('0x4')](_0x2b7023,_0xf6d1('0x5'))?'or':'and';var _0xbd99ac=_0x2b7023[_0xf6d1('0x6')](_0xf6d1('0x7'),'')[_0xf6d1('0x6')](_0xf6d1('0x5'),'')['split']('||');for(var _0x294e47=0x0;_0x294e47<_0xbd99ac[_0xf6d1('0x8')];_0x294e47++){var _0x2ed6f3=_0xbd99ac[_0x294e47]['split'](':=');var _0x181d1a=_0x2ed6f3[0x0];var _0x2eb12e=_0x2ed6f3[_0xf6d1('0x9')](0x1);_0x2eb12e['forEach'](function(_0x4d2e86){var _0x453580=_0x4d2e86['split']('[')[_0xf6d1('0xa')]();var _0x9aced8=_0x4d2e86[_0xf6d1('0xb')](/\[(.*?)\]/g);_0x9aced8[_0xf6d1('0xc')](function(_0x481a8c){var _0x54d83a=_0x481a8c[_0xf6d1('0xd')]('[')['filter'](function(_0x5e688c){return _0x5e688c[_0xf6d1('0xe')](']')>-0x1;})[_0xf6d1('0xf')](function(_0x3532a2){return _0x3532a2[_0xf6d1('0xd')](']')[0x0];})[0x0];_0x590b13[_0xf6d1('0x10')][_0xf6d1('0x11')]({'field':_0x181d1a,'operator':_0x453580,'value':_0x54d83a});});});}return _0x590b13;};exports[_0xf6d1('0x12')]=function(_0x41e36d,_0x2e75d9,_0x4edcc1){var _0x4cd4dc={};if(_0x2e75d9==='DATE'){if(_0x4edcc1[_0xf6d1('0x13')]===_0xf6d1('0x14')){_0x4edcc1[_0xf6d1('0x13')]=_0xf6d1('0x15');_0x4edcc1['value']+=','+_0x4edcc1[_0xf6d1('0x16')];}else if(_[_0xf6d1('0x17')]([_0xf6d1('0x18'),_0xf6d1('0x19')],_0x4edcc1[_0xf6d1('0x13')])){_0x4edcc1[_0xf6d1('0x16')]=moment(_0x4edcc1[_0xf6d1('0x16')])[_0xf6d1('0x1a')](0x1,_0xf6d1('0x1b'))[_0xf6d1('0x1c')](_0xf6d1('0x1d'));}}if(_0x4edcc1[_0xf6d1('0x1e')]){_0x2e75d9=_0x4edcc1['castTo'];_0x4cd4dc[_0xf6d1('0x1f')]=_0xf6d1('0x20')+_0x41e36d+'.'+_0x4edcc1['field']+'\x20AS\x20'+_0x4edcc1[_0xf6d1('0x1e')]+')\x20'+parseOperator(_0x4edcc1[_0xf6d1('0x13')]);}else{_0x4cd4dc[_0xf6d1('0x1f')]=_0x41e36d+'.'+_0x4edcc1[_0xf6d1('0x21')]+'\x20'+parseOperator(_0x4edcc1['operator']);}if(_[_0xf6d1('0x17')](['$ne',_0xf6d1('0x22')],_0x4edcc1[_0xf6d1('0x13')]))_0x4cd4dc[_0xf6d1('0x1f')]='('+_0x4cd4dc[_0xf6d1('0x1f')]+'\x20OR\x20'+_0x41e36d+'.'+_0x4edcc1[_0xf6d1('0x21')]+_0xf6d1('0x23');_0x4cd4dc['value']=parseValue(_0x2e75d9,_0x4edcc1[_0xf6d1('0x13')],_0x4edcc1[_0xf6d1('0x16')]);return _0x4cd4dc;};function parseOperator(_0x116ee3){var _0x2e116b;switch(_0x116ee3){case'$in':_0x2e116b=_0xf6d1('0x24');break;case _0xf6d1('0x22'):_0x2e116b='NOT\x20IN\x20?';break;case'$eq':_0x2e116b=_0xf6d1('0x25');break;case _0xf6d1('0x26'):_0x2e116b=_0xf6d1('0x27');break;case'$substring':case _0xf6d1('0x28'):case _0xf6d1('0x29'):_0x2e116b='LIKE\x20?';break;case _0xf6d1('0x2a'):_0x2e116b=_0xf6d1('0x2b');break;case _0xf6d1('0x18'):_0x2e116b=_0xf6d1('0x2c');break;case _0xf6d1('0x19'):_0x2e116b='<=\x20?';break;case _0xf6d1('0x2d'):_0x2e116b='>=\x20?';break;case _0xf6d1('0x15'):_0x2e116b='BETWEEN\x20?\x20AND\x20?';break;}return _0x2e116b;}function parseValue(_0x435b06,_0x4cbeeb,_0x2312a2){var _0x1b95f6={'start':undefined,'end':undefined};switch(_0x4cbeeb){case _0xf6d1('0x2e'):case _0xf6d1('0x22'):_0x1b95f6['start']=_0x2312a2['split'](',');break;case _0xf6d1('0x2f'):_0x1b95f6['start']='%'+_0x2312a2+'%';break;case _0xf6d1('0x28'):_0x1b95f6[_0xf6d1('0x30')]=_0x2312a2+'%';break;case _0xf6d1('0x29'):_0x1b95f6[_0xf6d1('0x30')]='%'+_0x2312a2;break;case _0xf6d1('0x15'):var _0x1c4183=_0x2312a2['split'](',');var _0x2312a2=_0x1c4183['shift']();var _0x2ba8e0=_0x1c4183[_0xf6d1('0x31')]();if(_0x435b06===_0xf6d1('0x32')){_0x2312a2=moment(_0x2312a2)[_0xf6d1('0x33')](0x0,!![])[_0xf6d1('0x1c')]();_0x2ba8e0=moment(_0x2ba8e0)['utcOffset'](0x0,!![])[_0xf6d1('0x1a')](0x17,_0xf6d1('0x34'))[_0xf6d1('0x1a')](0x3b,_0xf6d1('0x35'))['add'](0x3b,_0xf6d1('0x36'))['format']();}_0x1b95f6={'start':_0x2312a2,'end':_0x2ba8e0};break;default:_0x1b95f6[_0xf6d1('0x30')]=_0x2312a2;break;}return _0x1b95f6;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index cb43eda..2f947c3 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 _0x7604=['VIRTUAL','lower','options','include','includeAll','map','lodash','sequelize','moment','../../mysqldb','parse','includes','keys','model','fields','raw','split','filters','isEmpty','forOwn','find','type','DATE','isPlainObject','format','$lte','YYYY-MM-DD','utc','uniqueid','isArray','limit','offset','sort','priority','cast','substr','DESC','unsigned','ASC','omit','isObject','isString','length','hasOwnProperty','isNumeric','match','^[+]?[0-9]*$','getFullTextValue','\x22{EXPR}\x22','{EXPR}','forEach','replace','push','join','getOptions','query','$id','name','attributes','intersection','order','where','pick','filter','object','columns','value','merge'];(function(_0x3ab9ee,_0x4a74b8){var _0x82ee88=function(_0x6ccc7e){while(--_0x6ccc7e){_0x3ab9ee['push'](_0x3ab9ee['shift']());}};_0x82ee88(++_0x4a74b8);}(_0x7604,0xd2));var _0x4760=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x7604[_0x2c91e9];return _0x13f0ff;};'use strict';var _=require(_0x4760('0x0'));var sequelize=require(_0x4760('0x1'));var moment=require(_0x4760('0x2'));var db=require(_0x4760('0x3'))['db'];var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x4be602){var _0x49c9cd=['ne'];try{var _0xfa7b99=JSON[_0x4760('0x4')](_0x4be602);var _0x18d2bf=Object['keys'](_0xfa7b99)[0x0];return _0x49c9cd[_0x4760('0x5')](_0x18d2bf);}catch(_0x202417){return![];}}function getOperatorValue(_0x4b0681){var _0x3d707b=JSON[_0x4760('0x4')](_0x4b0681);var _0x5b139b=Object[_0x4760('0x6')](_0x3d707b)[0x0];var _0xc10f20=_0x3d707b[_0x5b139b];return{['$'+_0x5b139b]:_0xc10f20};}function parseIncludeModel(_0xe0edfa){var _0xeef9eb=JSON[_0x4760('0x4')](_0xe0edfa);return{'model':db[_0xeef9eb[_0x4760('0x7')]],'as':_0xeef9eb['alias'],'attributes':_0xeef9eb[_0x4760('0x8')],'raw':_0xeef9eb[_0x4760('0x9')]};}exports[_0x4760('0x8')]=function(_0x13a434){var _0x30437e=null;if(_0x13a434){_0x30437e=_0x13a434[_0x4760('0xa')](',');}return _0x30437e;};exports[_0x4760('0xb')]=function(_0x221b3f,_0x22e06b){var _0x2661bf={};if(!_[_0x4760('0xc')](_0x221b3f)){_[_0x4760('0xd')](_0x221b3f,function(_0x5b3871,_0x159624){try{if(_0x22e06b){var _0xe44c17=_[_0x4760('0xe')](_0x22e06b,{'name':_0x159624})||{};if(hasSequelizeOperator(_0x5b3871)){_0x2661bf[_0x159624]=getOperatorValue(_0x5b3871);}else if(_0xe44c17[_0x4760('0xf')]===_0x4760('0x10')&&_[_0x4760('0x11')](_0x5b3871)){var _0x7e399=JSON[_0x4760('0x4')](_0x5b3871);var _0x33b509={'$gte':moment(moment(_0x7e399['$gte'])[_0x4760('0x12')]('YYYY-MM-DD'))['utc']()[_0x4760('0x12')](),'$lte':moment(moment(_0x7e399[_0x4760('0x13')])[_0x4760('0x12')](_0x4760('0x14')))[_0x4760('0x15')]()['subtract'](0x1,'s')['format']()};_0x2661bf[_0x159624]=_0x33b509;}else if(_0xe44c17['name']===_0x4760('0x16')){_0x2661bf[_0x159624]=_0x5b3871;}else{_0x2661bf[_0x159624]=_[_0x4760('0x17')](_0x5b3871)?_0x5b3871:JSON[_0x4760('0x4')](_0x5b3871);}}else{_0x2661bf[_0x159624]=_[_0x4760('0x17')](_0x5b3871)?_0x5b3871:JSON['parse'](_0x5b3871);}}catch(_0x2b4656){_0x2661bf[_0x159624]=_0x5b3871[_0x4760('0xa')](',');}});}return _0x2661bf;};exports[_0x4760('0x18')]=function(_0x3f5739){_0x3f5739=parseInt(_0x3f5739,0xa);if(!_0x3f5739||_0x3f5739<0x0){_0x3f5739=LIMIT_VALUE;}return _0x3f5739;};exports[_0x4760('0x19')]=function(_0x31e76f){_0x31e76f=parseInt(_0x31e76f,0xa);if(!_0x31e76f||_0x31e76f<0x0){_0x31e76f=0x0;}return _0x31e76f;};exports[_0x4760('0x1a')]=function(_0x316666){var _0x723e12,_0x348c6d=null;if(_0x316666){_0x723e12=_0x316666[_0x4760('0xa')](',');_0x348c6d=_['map'](_0x723e12,function(_0x190cce){if(_0x190cce['indexOf']('-')===0x0){return[_0x190cce===_0x4760('0x1b')?sequelize[_0x4760('0x1c')](sequelize['col'](_0x4760('0x1b')),'unsigned'):_0x190cce[_0x4760('0x1d')](0x1),_0x4760('0x1e')];}else{return[_0x190cce===_0x4760('0x1b')?sequelize[_0x4760('0x1c')](sequelize['col'](_0x4760('0x1b')),_0x4760('0x1f')):_0x190cce,_0x4760('0x20')];}});}return _0x348c6d;};exports[_0x4760('0x21')]=function(_0x358594,_0x45afb7){if(_[_0x4760('0xc')](_0x358594)){return _0x358594;}if(_[_0x4760('0x17')](_0x358594)){for(var _0x5caae7=0x0;_0x5caae7<_0x358594['length'];_0x5caae7+=0x1){_0x358594[_0x5caae7]=this[_0x4760('0x21')](_0x358594[_0x5caae7],_0x45afb7);}return _0x358594;}if(!_[_0x4760('0x22')](_0x358594)){return _0x358594;}if(_[_0x4760('0x23')](_0x45afb7)){_0x45afb7=[_0x45afb7];}if(!_[_0x4760('0x17')](_0x45afb7)){return _0x358594;}for(var _0x6b9bf4=0x0;_0x6b9bf4<_0x45afb7[_0x4760('0x24')];_0x6b9bf4+=0x1){_['unset'](_0x358594,_0x45afb7[_0x6b9bf4]);}for(var _0x5e3d4d in _0x358594){if(_0x358594[_0x4760('0x25')](_0x5e3d4d)){_0x358594[_0x5e3d4d]=this['omit'](_0x358594[_0x5e3d4d],_0x45afb7);}}return _0x358594;};exports[_0x4760('0x26')]=function(_0x35b132){return _0x35b132[_0x4760('0x27')](RegExp(_0x4760('0x28')))?!![]:![];};exports['isEmail']=function(_0x42df78){return _0x42df78[_0x4760('0x27')](/^\S+@\S+$/)?!![]:![];};exports[_0x4760('0x29')]=function(_0x1b0e92,_0x5710d9){var _0x47096c=[];var _0x5a905e=/[ `!@#$%^&*()_\-?~]/;var _0x4f9123=_0x5710d9?_0x4760('0x2a'):_0x4760('0x2b');_0x1b0e92['split'](/[ ,]+/)[_0x4760('0x2c')](function(_0xcf9e04){_0xcf9e04=_0xcf9e04[_0x4760('0x2d')](/([^:]")"+/g,'$1');_0xcf9e04='+'+_0xcf9e04+'*';var _0x2758ad=_0xcf9e04[_0x4760('0x27')](_0x5a905e);if(_0x2758ad){_0xcf9e04='\x22'+_0xcf9e04+'\x22';}_0x47096c[_0x4760('0x2e')](_0xcf9e04);});_0x4f9123=_0x4f9123[_0x4760('0x2d')](_0x4760('0x2b'),_0x47096c[_0x4760('0x2f')]('\x20'));return _0x4f9123;};exports[_0x4760('0x30')]=function(_0x2a7024,_0xa48dfa,_0x57517f){var _0x2e637e={},_0x1651f0={};if(_0xa48dfa[_0x4760('0x31')][_0x4760('0x32')]){_0xa48dfa[_0x4760('0x31')]['id']=_0xa48dfa[_0x4760('0x31')][_0x4760('0x32')];delete _0xa48dfa[_0x4760('0x31')][_0x4760('0x32')];}_0x2e637e[_0x4760('0x7')]=_['map'](_0x2a7024,_0x4760('0x33'));_0x2e637e[_0x4760('0x31')]=_[_0x4760('0x6')](_0xa48dfa[_0x4760('0x31')]);_0x2e637e[_0x4760('0xb')]=_['intersection'](_0x2e637e[_0x4760('0x7')],_0x2e637e[_0x4760('0x31')]);_0x1651f0[_0x4760('0x34')]=_[_0x4760('0x35')](_0x2e637e[_0x4760('0x7')],this[_0x4760('0x8')](_0xa48dfa[_0x4760('0x31')][_0x4760('0x8')]));_0x1651f0[_0x4760('0x34')]=_0x1651f0[_0x4760('0x34')][_0x4760('0x24')]?_0x1651f0['attributes']:_0x2e637e[_0x4760('0x7')];if(!_0xa48dfa['query'][_0x4760('0x25')]('nolimit')){_0x1651f0[_0x4760('0x18')]=this[_0x4760('0x18')](_0xa48dfa[_0x4760('0x31')][_0x4760('0x18')]);_0x1651f0[_0x4760('0x19')]=this[_0x4760('0x19')](_0xa48dfa[_0x4760('0x31')]['offset']);}_0x1651f0[_0x4760('0x36')]=this[_0x4760('0x1a')](_0xa48dfa[_0x4760('0x31')][_0x4760('0x1a')]);_0x1651f0[_0x4760('0x37')]=this[_0x4760('0xb')](_[_0x4760('0x38')](_0xa48dfa['query'],_0x2e637e[_0x4760('0xb')]),_0x2a7024);if(_0xa48dfa[_0x4760('0x31')][_0x4760('0x39')]){var _0x30b39f=_0x2a7024;var _0xd8e960=_0xa48dfa['query'][_0x4760('0x39')];if(typeof _0xd8e960===_0x4760('0x3a')){_0x30b39f=_['filter'](_0x2a7024,function(_0x391024){return _['includes'](_0xd8e960[_0x4760('0x3b')],_0x391024[_0x4760('0x33')]);});_0xd8e960=_0xd8e960[_0x4760('0x3c')];}_0x1651f0[_0x4760('0x37')]=_[_0x4760('0x3d')](_0x1651f0[_0x4760('0x37')],{'$or':_['map'](_0x30b39f,function(_0x44153f){if(_0x44153f[_0x4760('0xf')]!==_0x4760('0x3e')){if(_0x57517f){return sequelize[_0x4760('0x37')](sequelize['fn'](_0x4760('0x3f'),sequelize['col'](_0x44153f[_0x4760('0x33')])),{'$like':sequelize['fn'](_0x4760('0x3f'),'%'+_0xa48dfa[_0x4760('0x31')][_0x4760('0x39')]+'%')});}else{var _0x415178={};_0x415178[_0x44153f['name']]={'$like':'%'+_0xa48dfa[_0x4760('0x31')]['filter']+'%'};return _0x415178;}}})});}_0x1651f0=_[_0x4760('0x3d')]({},_0x1651f0,_0xa48dfa[_0x4760('0x40')]);return _0x1651f0;};exports[_0x4760('0x41')]=function(_0x248ebf){var _0x3d06f3=[];if(_0x248ebf[_0x4760('0x42')]){_0x3d06f3[_0x4760('0x2e')]({'all':!![]});}else if(_0x248ebf['include']){if(Array[_0x4760('0x17')](_0x248ebf['include'])){_0x3d06f3=Object[_0x4760('0x6')](_0x248ebf[_0x4760('0x41')])[_0x4760('0x43')](function(_0xa17b22){return parseIncludeModel(_0x248ebf[_0x4760('0x41')][_0xa17b22]);});}else{var _0x52c2e9=parseIncludeModel(_0x248ebf[_0x4760('0x41')]);_0x3d06f3[_0x4760('0x2e')](_0x52c2e9);}}return _0x3d06f3;}; \ No newline at end of file +var _0xa6bb=['sequelize','moment','../../mysqldb','keys','includes','parse','model','alias','fields','filters','forOwn','find','type','DATE','$gte','format','name','uniqueid','isArray','split','offset','sort','indexOf','priority','cast','col','unsigned','ASC','isEmpty','length','isObject','isString','omit','^[+]?[0-9]*$','match','getFullTextValue','\x22{EXPR}\x22','{EXPR}','forEach','push','replace','getOptions','query','$id','intersection','attributes','hasOwnProperty','limit','where','filter','object','columns','value','merge','map','VIRTUAL','lower','options','includeAll','include'];(function(_0x2d7842,_0x5e1932){var _0x35485d=function(_0x56843a){while(--_0x56843a){_0x2d7842['push'](_0x2d7842['shift']());}};_0x35485d(++_0x5e1932);}(_0xa6bb,0x12c));var _0xba6b=function(_0x88c524,_0x40a7f8){_0x88c524=_0x88c524-0x0;var _0x2c754b=_0xa6bb[_0x88c524];return _0x2c754b;};'use strict';var _=require('lodash');var sequelize=require(_0xba6b('0x0'));var moment=require(_0xba6b('0x1'));var db=require(_0xba6b('0x2'))['db'];var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x418373){var _0x112efb=['ne'];try{var _0x5f29e1=JSON['parse'](_0x418373);var _0x5d1f87=Object[_0xba6b('0x3')](_0x5f29e1)[0x0];return _0x112efb[_0xba6b('0x4')](_0x5d1f87);}catch(_0x316bd0){return![];}}function getOperatorValue(_0x517d10){var _0x4cc381=JSON[_0xba6b('0x5')](_0x517d10);var _0x4f6c6c=Object[_0xba6b('0x3')](_0x4cc381)[0x0];var _0x5506d6=_0x4cc381[_0x4f6c6c];return{['$'+_0x4f6c6c]:_0x5506d6};}function parseIncludeModel(_0x55f5c3){var _0x135892=JSON[_0xba6b('0x5')](_0x55f5c3);return{'model':db[_0x135892[_0xba6b('0x6')]],'as':_0x135892[_0xba6b('0x7')],'attributes':_0x135892[_0xba6b('0x8')],'raw':_0x135892['raw']};}exports[_0xba6b('0x8')]=function(_0x297f02){var _0x25c14d=null;if(_0x297f02){_0x25c14d=_0x297f02['split'](',');}return _0x25c14d;};exports[_0xba6b('0x9')]=function(_0x35e23d,_0x3bf240){var _0x11bcb9={};if(!_['isEmpty'](_0x35e23d)){_[_0xba6b('0xa')](_0x35e23d,function(_0x5b1d28,_0x12ae0b){try{if(_0x3bf240){var _0x1adc27=_[_0xba6b('0xb')](_0x3bf240,{'name':_0x12ae0b})||{};if(hasSequelizeOperator(_0x5b1d28)){_0x11bcb9[_0x12ae0b]=getOperatorValue(_0x5b1d28);}else if(_0x1adc27[_0xba6b('0xc')]===_0xba6b('0xd')&&_['isPlainObject'](_0x5b1d28)){var _0x309d5f=JSON[_0xba6b('0x5')](_0x5b1d28);var _0x50b58a={'$gte':moment(moment(_0x309d5f[_0xba6b('0xe')])[_0xba6b('0xf')]('YYYY-MM-DD'))['utc']()[_0xba6b('0xf')](),'$lte':moment(moment(_0x309d5f['$lte'])['format']('YYYY-MM-DD'))['utc']()['subtract'](0x1,'s')[_0xba6b('0xf')]()};_0x11bcb9[_0x12ae0b]=_0x50b58a;}else if(_0x1adc27[_0xba6b('0x10')]===_0xba6b('0x11')){_0x11bcb9[_0x12ae0b]=_0x5b1d28;}else{_0x11bcb9[_0x12ae0b]=_[_0xba6b('0x12')](_0x5b1d28)?_0x5b1d28:JSON[_0xba6b('0x5')](_0x5b1d28);}}else{_0x11bcb9[_0x12ae0b]=_[_0xba6b('0x12')](_0x5b1d28)?_0x5b1d28:JSON[_0xba6b('0x5')](_0x5b1d28);}}catch(_0x5697f8){_0x11bcb9[_0x12ae0b]=_0x5b1d28[_0xba6b('0x13')](',');}});}return _0x11bcb9;};exports['limit']=function(_0x54a392){_0x54a392=parseInt(_0x54a392,0xa);if(!_0x54a392||_0x54a392<0x0){_0x54a392=LIMIT_VALUE;}return _0x54a392;};exports[_0xba6b('0x14')]=function(_0x120157){_0x120157=parseInt(_0x120157,0xa);if(!_0x120157||_0x120157<0x0){_0x120157=0x0;}return _0x120157;};exports[_0xba6b('0x15')]=function(_0x1751f3){var _0x47b615,_0xa632cb=null;if(_0x1751f3){_0x47b615=_0x1751f3[_0xba6b('0x13')](',');_0xa632cb=_['map'](_0x47b615,function(_0x38c46a){if(_0x38c46a[_0xba6b('0x16')]('-')===0x0){return[_0x38c46a===_0xba6b('0x17')?sequelize[_0xba6b('0x18')](sequelize[_0xba6b('0x19')]('priority'),'unsigned'):_0x38c46a['substr'](0x1),'DESC'];}else{return[_0x38c46a===_0xba6b('0x17')?sequelize[_0xba6b('0x18')](sequelize[_0xba6b('0x19')](_0xba6b('0x17')),_0xba6b('0x1a')):_0x38c46a,_0xba6b('0x1b')];}});}return _0xa632cb;};exports['omit']=function(_0x876e58,_0x2b13f3){if(_[_0xba6b('0x1c')](_0x876e58)){return _0x876e58;}if(_['isArray'](_0x876e58)){for(var _0x47574c=0x0;_0x47574c<_0x876e58[_0xba6b('0x1d')];_0x47574c+=0x1){_0x876e58[_0x47574c]=this['omit'](_0x876e58[_0x47574c],_0x2b13f3);}return _0x876e58;}if(!_[_0xba6b('0x1e')](_0x876e58)){return _0x876e58;}if(_[_0xba6b('0x1f')](_0x2b13f3)){_0x2b13f3=[_0x2b13f3];}if(!_[_0xba6b('0x12')](_0x2b13f3)){return _0x876e58;}for(var _0x41a0e0=0x0;_0x41a0e0<_0x2b13f3[_0xba6b('0x1d')];_0x41a0e0+=0x1){_['unset'](_0x876e58,_0x2b13f3[_0x41a0e0]);}for(var _0x18a4c1 in _0x876e58){if(_0x876e58['hasOwnProperty'](_0x18a4c1)){_0x876e58[_0x18a4c1]=this[_0xba6b('0x20')](_0x876e58[_0x18a4c1],_0x2b13f3);}}return _0x876e58;};exports['isNumeric']=function(_0x1a6b93){return _0x1a6b93['match'](RegExp(_0xba6b('0x21')))?!![]:![];};exports['isEmail']=function(_0x205af9){return _0x205af9[_0xba6b('0x22')](/^\S+@\S+$/)?!![]:![];};exports[_0xba6b('0x23')]=function(_0x474cc7,_0x5e87ed){var _0x2e9bda=[];var _0x563d5a=/[ `!@#$%^&*()_\-?~]/;var _0x58bf66=_0x5e87ed?_0xba6b('0x24'):_0xba6b('0x25');_0x474cc7['split'](/[ ,]+/)[_0xba6b('0x26')](function(_0x4f74a7){_0x4f74a7=_0x4f74a7['replace'](/([^:]")"+/g,'$1');_0x4f74a7='+'+_0x4f74a7+'*';var _0x2531b3=_0x4f74a7[_0xba6b('0x22')](_0x563d5a);if(_0x2531b3){_0x4f74a7='\x22'+_0x4f74a7+'\x22';}_0x2e9bda[_0xba6b('0x27')](_0x4f74a7);});_0x58bf66=_0x58bf66[_0xba6b('0x28')](_0xba6b('0x25'),_0x2e9bda['join']('\x20'));return _0x58bf66;};exports[_0xba6b('0x29')]=function(_0x471bcc,_0x356454,_0xd39097){var _0x27f665={},_0x1cd27a={};if(_0x356454[_0xba6b('0x2a')][_0xba6b('0x2b')]){_0x356454[_0xba6b('0x2a')]['id']=_0x356454['query'][_0xba6b('0x2b')];delete _0x356454[_0xba6b('0x2a')][_0xba6b('0x2b')];}_0x27f665[_0xba6b('0x6')]=_['map'](_0x471bcc,'name');_0x27f665[_0xba6b('0x2a')]=_[_0xba6b('0x3')](_0x356454[_0xba6b('0x2a')]);_0x27f665[_0xba6b('0x9')]=_['intersection'](_0x27f665[_0xba6b('0x6')],_0x27f665[_0xba6b('0x2a')]);_0x1cd27a['attributes']=_[_0xba6b('0x2c')](_0x27f665['model'],this[_0xba6b('0x8')](_0x356454[_0xba6b('0x2a')][_0xba6b('0x8')]));_0x1cd27a['attributes']=_0x1cd27a[_0xba6b('0x2d')][_0xba6b('0x1d')]?_0x1cd27a['attributes']:_0x27f665[_0xba6b('0x6')];if(!_0x356454['query'][_0xba6b('0x2e')]('nolimit')){_0x1cd27a[_0xba6b('0x2f')]=this['limit'](_0x356454[_0xba6b('0x2a')]['limit']);_0x1cd27a[_0xba6b('0x14')]=this[_0xba6b('0x14')](_0x356454[_0xba6b('0x2a')][_0xba6b('0x14')]);}_0x1cd27a['order']=this[_0xba6b('0x15')](_0x356454[_0xba6b('0x2a')][_0xba6b('0x15')]);_0x1cd27a[_0xba6b('0x30')]=this[_0xba6b('0x9')](_['pick'](_0x356454[_0xba6b('0x2a')],_0x27f665['filters']),_0x471bcc);if(_0x356454[_0xba6b('0x2a')][_0xba6b('0x31')]){var _0x5b710a=_0x471bcc;var _0x57e9b5=_0x356454[_0xba6b('0x2a')][_0xba6b('0x31')];if(typeof _0x57e9b5===_0xba6b('0x32')){_0x5b710a=_[_0xba6b('0x31')](_0x471bcc,function(_0x5afbf6){return _[_0xba6b('0x4')](_0x57e9b5[_0xba6b('0x33')],_0x5afbf6[_0xba6b('0x10')]);});_0x57e9b5=_0x57e9b5[_0xba6b('0x34')];}_0x1cd27a['where']=_[_0xba6b('0x35')](_0x1cd27a[_0xba6b('0x30')],{'$or':_[_0xba6b('0x36')](_0x5b710a,function(_0x2a570f){if(_0x2a570f[_0xba6b('0xc')]!==_0xba6b('0x37')){if(_0xd39097){return sequelize['where'](sequelize['fn'](_0xba6b('0x38'),sequelize[_0xba6b('0x19')](_0x2a570f[_0xba6b('0x10')])),{'$like':sequelize['fn']('lower','%'+_0x356454[_0xba6b('0x2a')][_0xba6b('0x31')]+'%')});}else{var _0x60fc1b={};_0x60fc1b[_0x2a570f[_0xba6b('0x10')]]={'$like':'%'+_0x356454[_0xba6b('0x2a')][_0xba6b('0x31')]+'%'};return _0x60fc1b;}}})});}_0x1cd27a=_[_0xba6b('0x35')]({},_0x1cd27a,_0x356454[_0xba6b('0x39')]);return _0x1cd27a;};exports['include']=function(_0x15e3c5){var _0x24c61b=[];if(_0x15e3c5[_0xba6b('0x3a')]){_0x24c61b['push']({'all':!![]});}else if(_0x15e3c5[_0xba6b('0x3b')]){if(Array[_0xba6b('0x12')](_0x15e3c5[_0xba6b('0x3b')])){_0x24c61b=Object[_0xba6b('0x3')](_0x15e3c5[_0xba6b('0x3b')])[_0xba6b('0x36')](function(_0x3ede2b){return parseIncludeModel(_0x15e3c5[_0xba6b('0x3b')][_0x3ede2b]);});}else{var _0x2dea62=parseIncludeModel(_0x15e3c5['include']);_0x24c61b[_0xba6b('0x27')](_0x2dea62);}}return _0x24c61b;}; \ No newline at end of file diff --git a/server/components/realtime/agents.js b/server/components/realtime/agents.js index 7ffa395..06e097d 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 _0x7217=['onhold','getRealtimeAgentsQueryFields','lodash','../../mysqldb','client','http','chatPause','faxPause','mailPause','openchannelPause','smsPause','voicePause','whatsappPause','every','filter','length','unknown','unavailable','ringing','isNil','voiceStatus','idle','pause','faxStatus','mailStatus','openchannelStatus','smsStatus','whatsappStatus','request','error','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','result','Agents','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','merge','catch','getRealtimeAgents','*pause','busy','getAgentStatus','isArray','startCase','Queue','map','then','getAgents','all','flatten','value','includes','getAgentIdsByStatus','resolve','findAll','name','fullname','pauseType','find','getSortedAgentsIdsByStatus','globalStatus','startsWith','ASC','getUpdatedSortOptions','fullname,internal','internal','substring','indexOf','validateSortParameter','DESC','toLowerCase','sortAgentsByStatus','userpic','lastLoginAt','lastPauseAt','address','openchannelCapacity','mailCapacity','smsCapacity','faxCapacity','openchannelCurrentCapacity','mailCurrentCapacity','smsCurrentCapacity','whatsappCurrentCapacity','faxCurrentCapacity','chatStatus','chatStatusTime','openchannelStatusTime','mailStatusTime','whatsappStatusTime','faxStatusTime','voiceStatusTime','queue','destconnectedlinenum','screenrecording','phoneBarEnableScreenRecordingByAgent','routealias','online','pick','filterAgentAttributes','role','smsStatusTime','whatsappCapacity','chatCurrentCapacity','phoneBarEnableAutomaticScreenRecording'];(function(_0x6e07ab,_0x523c27){var _0x652ed1=function(_0x49226f){while(--_0x49226f){_0x6e07ab['push'](_0x6e07ab['shift']());}};_0x652ed1(++_0x523c27);}(_0x7217,0x19e));var _0x7721=function(_0x55f8b4,_0x43f30d){_0x55f8b4=_0x55f8b4-0x0;var _0x2475f9=_0x7217[_0x55f8b4];return _0x2475f9;};'use strict';var _=require(_0x7721('0x0'));var jayson=require('jayson/promise');var db=require(_0x7721('0x1'))['db'];var amiClient=jayson[_0x7721('0x2')][_0x7721('0x3')]({'port':0x232a});var routingClient=jayson[_0x7721('0x2')][_0x7721('0x3')]({'port':0x232c});function isAgentPaused(_0x4d6446,_0x5bf160){var _0x472a96=[_0x4d6446[_0x7721('0x4')],_0x4d6446[_0x7721('0x5')],_0x4d6446[_0x7721('0x6')],_0x4d6446[_0x7721('0x7')],_0x4d6446[_0x7721('0x8')],_0x4d6446[_0x7721('0x9')],_0x4d6446[_0x7721('0xa')]];if(!_0x5bf160)return _[_0x7721('0xb')](_0x472a96);var _0x2f99ed=_[_0x7721('0xc')](_0x472a96);return _0x2f99ed[_0x7721('0xd')]>0x0&&_0x2f99ed[_0x7721('0xd')]<_0x472a96[_0x7721('0xd')]?!![]:![];}function isIdle(_0x2c3986){return _0x2c3986==='idle'||_0x2c3986===_0x7721('0xe')||_0x2c3986===_0x7721('0xf')||_0x2c3986===_0x7721('0x10')||_[_0x7721('0x11')](_0x2c3986);}function isAgentIdle(_0xa8977c){if(_0xa8977c[_0x7721('0x12')]!==_0x7721('0x13')&&_0xa8977c[_0x7721('0x9')]){_0xa8977c['voiceStatus']=_0x7721('0x14');return![];}return _[_0x7721('0xb')]([_0xa8977c['chatStatus'],_0xa8977c[_0x7721('0x15')],_0xa8977c[_0x7721('0x16')],_0xa8977c[_0x7721('0x17')],_0xa8977c[_0x7721('0x18')],_0xa8977c['voiceStatus'],_0xa8977c[_0x7721('0x19')]],isIdle);}function getRealtimeAgents(){return amiClient[_0x7721('0x1a')]('Agents',{})['then'](function(_0x4b183e){if(_0x4b183e[_0x7721('0x1b')]){throw new Error(_0x7721('0x1c'));}var _0x3cc909=_0x4b183e[_0x7721('0x1d')];return routingClient['request'](_0x7721('0x1e'),{})['then'](function(_0x3fc09e){if(_0x3fc09e['error']){throw new Error(_0x7721('0x1f'));}var _0x4e96fb=_0x3fc09e[_0x7721('0x1d')];return _[_0x7721('0x20')]({},_0x3cc909,_0x4e96fb);});})[_0x7721('0x21')](function(_0x40af90){throw _0x40af90;});}exports[_0x7721('0x22')]=getRealtimeAgents;function getAgentStatus(_0x413263){var _0x3b29ac=_0x7721('0xe');if(isAgentPaused(_0x413263))_0x3b29ac='pause';else if(isAgentPaused(_0x413263,!![]))_0x3b29ac=_0x7721('0x23');else if(isAgentIdle(_0x413263))_0x3b29ac=_0x7721('0x13');else _0x3b29ac=_0x7721('0x24');return _0x3b29ac;}exports[_0x7721('0x25')]=getAgentStatus;function getAgentIdsByQueues(_0x57140c,_0x28f5a6){var _0x512f31=_[_0x7721('0x26')](_0x57140c)?_0x57140c:[_0x57140c];var _0x288e3a=_[_0x7721('0x27')](_0x28f5a6)+_0x7721('0x28');var _0x121cc4=_[_0x7721('0x29')](_0x512f31,function(_0x2c6b7b){return db[_0x288e3a]['findOne']({'where':{'id':_0x2c6b7b}})[_0x7721('0x2a')](function(_0x1abedb){if(!_0x1abedb)return[];return _0x1abedb[_0x7721('0x2b')]({'attributes':['id'],'raw':!![]});});});return Promise[_0x7721('0x2c')](_0x121cc4)[_0x7721('0x2a')](function(_0x16355a){var _0x424e05=_(_0x16355a)[_0x7721('0x2d')]()[_0x7721('0x29')]('id')['uniq']()[_0x7721('0x2e')]();return _0x424e05;});}exports['getAgentIdsByQueues']=getAgentIdsByQueues;function getAgentIdsByStatus(_0x499b87,_0x315202,_0x343c19){try{if(_0x315202[_0x7721('0xd')]>0x0){_0x499b87=_0x499b87[_0x7721('0xc')](function(_0x1ea4d){return _0x315202[_0x7721('0x2f')](_0x1ea4d['id']);});}var _0xd7d703=_0x499b87[_0x7721('0xc')](function(_0x5c54f0){var _0x471651=_0x7721('0x24');if(isAgentIdle(_0x5c54f0)){_0x471651='idle';}return _0x471651===_0x343c19;});return _['map'](_0xd7d703,'id');}catch(_0xfde9ec){throw _0xfde9ec;}}exports[_0x7721('0x30')]=getAgentIdsByStatus;function getSortedAgentsIdsByStatus(_0x48f329,_0x46f772,_0x4651b5){return Promise[_0x7721('0x31')]()['then'](function(){if(_0x46f772[_0x7721('0xd')]>0x0){_0x48f329=_0x48f329[_0x7721('0xc')](function(_0x1492d4){return _0x46f772[_0x7721('0x2f')](_0x1492d4['id']);});}return _0x48f329;})[_0x7721('0x2a')](function(){return db['User'][_0x7721('0x32')]({'attributes':['id',_0x7721('0x33'),_0x7721('0x34'),'chatPause',_0x7721('0x5'),_0x7721('0x6'),'openchannelPause',_0x7721('0x8'),'voicePause',_0x7721('0xa'),_0x7721('0x35')],'where':{'id':{'$in':_[_0x7721('0x29')](_0x48f329,'id')}},'raw':!![]});})[_0x7721('0x2a')](function(_0x1c84c0){return _0x1c84c0[_0x7721('0x29')](function(_0x2f1fe0){var _0x15545a=_[_0x7721('0x36')](_0x48f329,['id',_0x2f1fe0['id']]);var _0x3a2eb7=filterAgentAttributes(_0x15545a);_[_0x7721('0x20')](_0x2f1fe0,_0x3a2eb7);_0x2f1fe0['globalStatus']=getAgentStatus(_0x2f1fe0);return _0x2f1fe0;});})[_0x7721('0x2a')](function(_0x5e6663){var _0x212384=sortAgentsByStatus(_0x5e6663,_0x4651b5);return _[_0x7721('0x29')](_0x212384,'id');})[_0x7721('0x21')](function(_0x1d03de){throw _0x1d03de;});}exports[_0x7721('0x37')]=getSortedAgentsIdsByStatus;function getUpdatedSortOptions(_0x378ba5){var _0x482b70={'fields':[],'order':null};var _0x557c34=_0x378ba5['split'](',');_0x482b70['fields']=_[_0x7721('0xc')](_0x557c34,function(_0x1b3f8d){if(!_0x1b3f8d[_0x7721('0x2f')](_0x7721('0x38'))){return!![];}_0x482b70['order']=_[_0x7721('0x39')](_0x1b3f8d,'-')?'DESC':_0x7721('0x3a');return![];});return _0x482b70;}exports[_0x7721('0x3b')]=getUpdatedSortOptions;function validateSortParameter(_0x5a278e){if(!_0x5a278e){_0x5a278e=_0x7721('0x3c');}if(_0x5a278e[_0x7721('0x2f')]('fullname')&&!_0x5a278e['includes'](_0x7721('0x3d'))){var _0xfc4dc4=_0x5a278e[_0x7721('0x3e')](0x0,_0x5a278e[_0x7721('0x3f')]('fullname'));_0x5a278e+=','+_0xfc4dc4+_0x7721('0x3d');}return _0x5a278e;}exports[_0x7721('0x40')]=validateSortParameter;function sortAgentsByStatus(_0x40ce8c,_0x337abf){var _0x196051=_0x40ce8c['sort'](function(_0x490d4,_0x4a2c28){if(_0x490d4[_0x7721('0x38')]===_0x4a2c28['globalStatus']){if(_0x490d4[_0x7721('0x38')]===_0x7721('0x14')){if(_0x337abf===_0x7721('0x41')){return(_0x490d4['pauseType']||'')<(_0x4a2c28[_0x7721('0x35')]||'')||_0x490d4[_0x7721('0x34')][_0x7721('0x42')]()>_0x4a2c28['fullname'][_0x7721('0x42')]()?0x1:-0x1;}else{return(_0x490d4[_0x7721('0x35')]||'')<(_0x4a2c28[_0x7721('0x35')]||'')||_0x490d4[_0x7721('0x34')][_0x7721('0x42')]()>_0x4a2c28[_0x7721('0x34')][_0x7721('0x42')]()?-0x1:0x1;}}else{if(_0x337abf==='DESC'){return _0x490d4['fullname'][_0x7721('0x42')]()<_0x4a2c28[_0x7721('0x34')][_0x7721('0x42')]()?0x1:-0x1;}else{return _0x490d4[_0x7721('0x34')][_0x7721('0x42')]()<_0x4a2c28[_0x7721('0x34')][_0x7721('0x42')]()?-0x1:0x1;}}}else{if(_0x337abf===_0x7721('0x41')){return _0x490d4[_0x7721('0x38')]<_0x4a2c28[_0x7721('0x38')]?0x1:-0x1;}else{return _0x490d4['globalStatus']<_0x4a2c28['globalStatus']?-0x1:0x1;}}});return _0x196051;}exports[_0x7721('0x43')]=sortAgentsByStatus;function filterAgentAttributes(_0x6a4664){var _0x151f69=[_0x7721('0x44'),'online',_0x7721('0x45'),_0x7721('0x46'),'pauseType',_0x7721('0x46'),'internal',_0x7721('0x47'),'chatPause',_0x7721('0x7'),_0x7721('0x6'),_0x7721('0x8'),'whatsappPause',_0x7721('0x5'),_0x7721('0x9'),'chatCapacity',_0x7721('0x48'),_0x7721('0x49'),_0x7721('0x4a'),'whatsappCapacity',_0x7721('0x4b'),'chatCurrentCapacity',_0x7721('0x4c'),_0x7721('0x4d'),_0x7721('0x4e'),_0x7721('0x4f'),_0x7721('0x50'),_0x7721('0x51'),_0x7721('0x17'),_0x7721('0x16'),_0x7721('0x18'),_0x7721('0x19'),_0x7721('0x15'),_0x7721('0x12'),_0x7721('0x52'),_0x7721('0x53'),_0x7721('0x54'),'smsStatusTime',_0x7721('0x55'),_0x7721('0x56'),_0x7721('0x57'),_0x7721('0x58'),_0x7721('0x59'),_0x7721('0x5a'),_0x7721('0x5b'),'phoneBarEnableAutomaticScreenRecording',_0x7721('0x5c')];var _0x17036e=[_0x7721('0x4'),_0x7721('0x7'),_0x7721('0x6'),_0x7721('0x8'),_0x7721('0xa'),_0x7721('0x5'),_0x7721('0x9'),_0x7721('0x5d')];var _0x8eca10=_(_0x6a4664)['omit'](_0x17036e)[_0x7721('0x5e')](_0x151f69)[_0x7721('0x2e')]();return _0x8eca10;}exports[_0x7721('0x5f')]=filterAgentAttributes;function getRealtimeAgentsQueryFields(){return['id',_0x7721('0x33'),_0x7721('0x34'),_0x7721('0x60'),_0x7721('0x3d'),_0x7721('0x5d'),_0x7721('0x38'),_0x7721('0x44'),_0x7721('0x45'),_0x7721('0x35'),_0x7721('0x46'),_0x7721('0x5'),_0x7721('0x4'),'mailPause','openchannelPause','smsPause',_0x7721('0x9'),'whatsappPause','chatStatus','faxStatus','mailStatus',_0x7721('0x17'),_0x7721('0x18'),_0x7721('0x12'),'whatsappStatus',_0x7721('0x52'),'faxStatusTime','mailStatusTime','openchannelStatusTime',_0x7721('0x61'),'voiceStatusTime','whatsappStatusTime','chatCapacity',_0x7721('0x4b'),_0x7721('0x49'),_0x7721('0x48'),'smsCapacity',_0x7721('0x62'),_0x7721('0x63'),_0x7721('0x50'),_0x7721('0x4d'),_0x7721('0x4c'),_0x7721('0x4e'),_0x7721('0x4f'),_0x7721('0x5b'),_0x7721('0x64'),_0x7721('0x59'),_0x7721('0x65'),_0x7721('0x58'),_0x7721('0x5c'),_0x7721('0x5a')];}exports[_0x7721('0x66')]=getRealtimeAgentsQueryFields; \ No newline at end of file +var _0x326f=['faxStatusTime','voiceStatusTime','queue','phoneBarEnableScreenRecordingByAgent','routealias','omit','pick','filterAgentAttributes','role','chatStatusTime','whatsappStatusTime','openchannelCurrentCapacity','phoneBarEnableAutomaticScreenRecording','destconnectedlinenum','onhold','screenrecording','getRealtimeAgentsQueryFields','lodash','client','http','chatPause','faxPause','mailPause','smsPause','voicePause','whatsappPause','every','length','idle','unknown','ringing','voiceStatus','pause','chatStatus','faxStatus','mailStatus','openchannelStatus','Agents','then','error','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','result','request','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','getRealtimeAgents','busy','getAgentStatus','isArray','startCase','Queue','map','findOne','all','flatten','value','getAgentIdsByQueues','includes','getAgentIdsByStatus','resolve','findAll','name','fullname','openchannelPause','pauseType','find','merge','getSortedAgentsIdsByStatus','split','filter','globalStatus','startsWith','DESC','ASC','getUpdatedSortOptions','validateSortParameter','toLowerCase','userpic','lastLoginAt','lastPauseAt','internal','address','chatCapacity','openchannelCapacity','smsCapacity','whatsappCapacity','faxCapacity','chatCurrentCapacity','mailCurrentCapacity','smsCurrentCapacity','whatsappCurrentCapacity','faxCurrentCapacity','smsStatus','whatsappStatus','openchannelStatusTime','mailStatusTime','smsStatusTime'];(function(_0x3f8857,_0x26a8bb){var _0x37fcf2=function(_0xf8607a){while(--_0xf8607a){_0x3f8857['push'](_0x3f8857['shift']());}};_0x37fcf2(++_0x26a8bb);}(_0x326f,0xd1));var _0xf326=function(_0x2d6540,_0x4cafa2){_0x2d6540=_0x2d6540-0x0;var _0x2eee97=_0x326f[_0x2d6540];return _0x2eee97;};'use strict';var _=require(_0xf326('0x0'));var jayson=require('jayson/promise');var db=require('../../mysqldb')['db'];var amiClient=jayson[_0xf326('0x1')][_0xf326('0x2')]({'port':0x232a});var routingClient=jayson[_0xf326('0x1')][_0xf326('0x2')]({'port':0x232c});function isAgentPaused(_0x27e8d7,_0x120a26){var _0x9445c6=[_0x27e8d7[_0xf326('0x3')],_0x27e8d7[_0xf326('0x4')],_0x27e8d7[_0xf326('0x5')],_0x27e8d7['openchannelPause'],_0x27e8d7[_0xf326('0x6')],_0x27e8d7[_0xf326('0x7')],_0x27e8d7[_0xf326('0x8')]];if(!_0x120a26)return _[_0xf326('0x9')](_0x9445c6);var _0x515bfa=_['filter'](_0x9445c6);return _0x515bfa['length']>0x0&&_0x515bfa[_0xf326('0xa')]<_0x9445c6[_0xf326('0xa')]?!![]:![];}function isIdle(_0x163416){return _0x163416===_0xf326('0xb')||_0x163416===_0xf326('0xc')||_0x163416==='unavailable'||_0x163416===_0xf326('0xd')||_['isNil'](_0x163416);}function isAgentIdle(_0x1cf441){if(_0x1cf441['voiceStatus']!==_0xf326('0xb')&&_0x1cf441['voicePause']){_0x1cf441[_0xf326('0xe')]=_0xf326('0xf');return![];}return _['every']([_0x1cf441[_0xf326('0x10')],_0x1cf441[_0xf326('0x11')],_0x1cf441[_0xf326('0x12')],_0x1cf441[_0xf326('0x13')],_0x1cf441['smsStatus'],_0x1cf441[_0xf326('0xe')],_0x1cf441['whatsappStatus']],isIdle);}function getRealtimeAgents(){return amiClient['request'](_0xf326('0x14'),{})[_0xf326('0x15')](function(_0x1f2e5a){if(_0x1f2e5a[_0xf326('0x16')]){throw new Error(_0xf326('0x17'));}var _0x287a2a=_0x1f2e5a[_0xf326('0x18')];return routingClient[_0xf326('0x19')]('Agents',{})[_0xf326('0x15')](function(_0x453100){if(_0x453100[_0xf326('0x16')]){throw new Error(_0xf326('0x1a'));}var _0xcef2b5=_0x453100[_0xf326('0x18')];return _['merge']({},_0x287a2a,_0xcef2b5);});})['catch'](function(_0x56ad41){throw _0x56ad41;});}exports[_0xf326('0x1b')]=getRealtimeAgents;function getAgentStatus(_0x289f4b){var _0x484cbe='unknown';if(isAgentPaused(_0x289f4b))_0x484cbe=_0xf326('0xf');else if(isAgentPaused(_0x289f4b,!![]))_0x484cbe='*pause';else if(isAgentIdle(_0x289f4b))_0x484cbe='idle';else _0x484cbe=_0xf326('0x1c');return _0x484cbe;}exports[_0xf326('0x1d')]=getAgentStatus;function getAgentIdsByQueues(_0x549b46,_0x5aa184){var _0x19b8ba=_[_0xf326('0x1e')](_0x549b46)?_0x549b46:[_0x549b46];var _0x5f21a2=_[_0xf326('0x1f')](_0x5aa184)+_0xf326('0x20');var _0x43c53e=_[_0xf326('0x21')](_0x19b8ba,function(_0x17c157){return db[_0x5f21a2][_0xf326('0x22')]({'where':{'id':_0x17c157}})['then'](function(_0x55b9f4){if(!_0x55b9f4)return[];return _0x55b9f4['getAgents']({'attributes':['id'],'raw':!![]});});});return Promise[_0xf326('0x23')](_0x43c53e)[_0xf326('0x15')](function(_0x2cd45a){var _0x1ff2b5=_(_0x2cd45a)[_0xf326('0x24')]()[_0xf326('0x21')]('id')['uniq']()[_0xf326('0x25')]();return _0x1ff2b5;});}exports[_0xf326('0x26')]=getAgentIdsByQueues;function getAgentIdsByStatus(_0x212d5d,_0x581531,_0x1617d2){try{if(_0x581531['length']>0x0){_0x212d5d=_0x212d5d['filter'](function(_0x6a8e89){return _0x581531[_0xf326('0x27')](_0x6a8e89['id']);});}var _0x2fa28e=_0x212d5d['filter'](function(_0xc115d9){var _0x292500='busy';if(isAgentIdle(_0xc115d9)){_0x292500=_0xf326('0xb');}return _0x292500===_0x1617d2;});return _[_0xf326('0x21')](_0x2fa28e,'id');}catch(_0xd77aba){throw _0xd77aba;}}exports[_0xf326('0x28')]=getAgentIdsByStatus;function getSortedAgentsIdsByStatus(_0xa80156,_0x269be9,_0x161143){return Promise[_0xf326('0x29')]()[_0xf326('0x15')](function(){if(_0x269be9[_0xf326('0xa')]>0x0){_0xa80156=_0xa80156['filter'](function(_0x1035ed){return _0x269be9[_0xf326('0x27')](_0x1035ed['id']);});}return _0xa80156;})[_0xf326('0x15')](function(){return db['User'][_0xf326('0x2a')]({'attributes':['id',_0xf326('0x2b'),_0xf326('0x2c'),'chatPause','faxPause',_0xf326('0x5'),_0xf326('0x2d'),_0xf326('0x6'),_0xf326('0x7'),_0xf326('0x8'),_0xf326('0x2e')],'where':{'id':{'$in':_[_0xf326('0x21')](_0xa80156,'id')}},'raw':!![]});})[_0xf326('0x15')](function(_0x580374){return _0x580374[_0xf326('0x21')](function(_0x1981bc){var _0x51207a=_[_0xf326('0x2f')](_0xa80156,['id',_0x1981bc['id']]);var _0x4e5d7c=filterAgentAttributes(_0x51207a);_[_0xf326('0x30')](_0x1981bc,_0x4e5d7c);_0x1981bc['globalStatus']=getAgentStatus(_0x1981bc);return _0x1981bc;});})['then'](function(_0xadb020){var _0x4d8eac=sortAgentsByStatus(_0xadb020,_0x161143);return _[_0xf326('0x21')](_0x4d8eac,'id');})['catch'](function(_0x310dbb){throw _0x310dbb;});}exports[_0xf326('0x31')]=getSortedAgentsIdsByStatus;function getUpdatedSortOptions(_0x2750ae){var _0x529cbb={'fields':[],'order':null};var _0x3dcc7e=_0x2750ae[_0xf326('0x32')](',');_0x529cbb['fields']=_[_0xf326('0x33')](_0x3dcc7e,function(_0xf64dd0){if(!_0xf64dd0[_0xf326('0x27')](_0xf326('0x34'))){return!![];}_0x529cbb['order']=_[_0xf326('0x35')](_0xf64dd0,'-')?_0xf326('0x36'):_0xf326('0x37');return![];});return _0x529cbb;}exports[_0xf326('0x38')]=getUpdatedSortOptions;function validateSortParameter(_0x1d88ed){if(!_0x1d88ed){_0x1d88ed='fullname,internal';}if(_0x1d88ed[_0xf326('0x27')](_0xf326('0x2c'))&&!_0x1d88ed['includes']('internal')){var _0x40564e=_0x1d88ed['substring'](0x0,_0x1d88ed['indexOf'](_0xf326('0x2c')));_0x1d88ed+=','+_0x40564e+'internal';}return _0x1d88ed;}exports[_0xf326('0x39')]=validateSortParameter;function sortAgentsByStatus(_0x37a95b,_0x2c1e7f){var _0x39611e=_0x37a95b['sort'](function(_0x9dda89,_0x45d344){if(_0x9dda89[_0xf326('0x34')]===_0x45d344[_0xf326('0x34')]){if(_0x9dda89[_0xf326('0x34')]===_0xf326('0xf')){if(_0x2c1e7f===_0xf326('0x36')){return(_0x9dda89[_0xf326('0x2e')]||'')<(_0x45d344[_0xf326('0x2e')]||'')||_0x9dda89[_0xf326('0x2c')][_0xf326('0x3a')]()>_0x45d344[_0xf326('0x2c')]['toLowerCase']()?0x1:-0x1;}else{return(_0x9dda89[_0xf326('0x2e')]||'')<(_0x45d344[_0xf326('0x2e')]||'')||_0x9dda89[_0xf326('0x2c')][_0xf326('0x3a')]()>_0x45d344[_0xf326('0x2c')][_0xf326('0x3a')]()?-0x1:0x1;}}else{if(_0x2c1e7f==='DESC'){return _0x9dda89[_0xf326('0x2c')][_0xf326('0x3a')]()<_0x45d344['fullname'][_0xf326('0x3a')]()?0x1:-0x1;}else{return _0x9dda89[_0xf326('0x2c')][_0xf326('0x3a')]()<_0x45d344[_0xf326('0x2c')][_0xf326('0x3a')]()?-0x1:0x1;}}}else{if(_0x2c1e7f==='DESC'){return _0x9dda89['globalStatus']<_0x45d344[_0xf326('0x34')]?0x1:-0x1;}else{return _0x9dda89[_0xf326('0x34')]<_0x45d344['globalStatus']?-0x1:0x1;}}});return _0x39611e;}exports['sortAgentsByStatus']=sortAgentsByStatus;function filterAgentAttributes(_0x8e318d){var _0x269e89=[_0xf326('0x3b'),'online',_0xf326('0x3c'),_0xf326('0x3d'),_0xf326('0x2e'),_0xf326('0x3d'),_0xf326('0x3e'),_0xf326('0x3f'),_0xf326('0x3'),_0xf326('0x2d'),_0xf326('0x5'),_0xf326('0x6'),_0xf326('0x8'),_0xf326('0x4'),_0xf326('0x7'),_0xf326('0x40'),_0xf326('0x41'),'mailCapacity',_0xf326('0x42'),_0xf326('0x43'),_0xf326('0x44'),_0xf326('0x45'),'openchannelCurrentCapacity',_0xf326('0x46'),_0xf326('0x47'),_0xf326('0x48'),_0xf326('0x49'),'chatStatus',_0xf326('0x13'),_0xf326('0x12'),_0xf326('0x4a'),_0xf326('0x4b'),_0xf326('0x11'),'voiceStatus','chatStatusTime',_0xf326('0x4c'),_0xf326('0x4d'),_0xf326('0x4e'),'whatsappStatusTime',_0xf326('0x4f'),_0xf326('0x50'),_0xf326('0x51'),'destconnectedlinenum','screenrecording',_0xf326('0x52'),'phoneBarEnableAutomaticScreenRecording',_0xf326('0x53')];var _0x554277=[_0xf326('0x3'),_0xf326('0x2d'),_0xf326('0x5'),_0xf326('0x6'),_0xf326('0x8'),_0xf326('0x4'),_0xf326('0x7'),'online'];var _0xcdaf3f=_(_0x8e318d)[_0xf326('0x54')](_0x554277)[_0xf326('0x55')](_0x269e89)['value']();return _0xcdaf3f;}exports[_0xf326('0x56')]=filterAgentAttributes;function getRealtimeAgentsQueryFields(){return['id',_0xf326('0x2b'),_0xf326('0x2c'),_0xf326('0x57'),_0xf326('0x3e'),'online',_0xf326('0x34'),_0xf326('0x3b'),_0xf326('0x3c'),_0xf326('0x2e'),'lastPauseAt',_0xf326('0x4'),_0xf326('0x3'),_0xf326('0x5'),_0xf326('0x2d'),'smsPause','voicePause',_0xf326('0x8'),_0xf326('0x10'),'faxStatus',_0xf326('0x12'),_0xf326('0x13'),_0xf326('0x4a'),_0xf326('0xe'),'whatsappStatus',_0xf326('0x58'),'faxStatusTime','mailStatusTime',_0xf326('0x4c'),'smsStatusTime',_0xf326('0x50'),_0xf326('0x59'),_0xf326('0x40'),'faxCapacity','mailCapacity',_0xf326('0x41'),_0xf326('0x42'),_0xf326('0x43'),'chatCurrentCapacity',_0xf326('0x49'),'mailCurrentCapacity',_0xf326('0x5a'),_0xf326('0x47'),_0xf326('0x48'),_0xf326('0x52'),_0xf326('0x5b'),_0xf326('0x5c'),_0xf326('0x5d'),_0xf326('0x51'),_0xf326('0x53'),_0xf326('0x5e')];}exports[_0xf326('0x5f')]=getRealtimeAgentsQueryFields; \ No newline at end of file diff --git a/server/components/realtime/queues.js b/server/components/realtime/queues.js index 7faaa9a..f467e1e 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 _0x0cf2=['inbound','concat','map','get','waiting','busy','find','merge','lodash','jayson/promise','util','client','http','available','loggedIn','paused','inUse','invalid','loggedInDb','notInUse','onHold','ringing','talking','unknown','pTalking','originated','message','statusMessage','dialActive','dialMethod','startPredictive','startProgressive','erlangCalls','erlangAbandonmentRate','erlangBusyFactor','dialPredictiveIntervalMaxThreshold','predictiveIntervalAvailable','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgTalktime','voice','request','startCase','Queues','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','result','catch'];(function(_0x107740,_0x39cffa){var _0xe6aee9=function(_0x1fa726){while(--_0x1fa726){_0x107740['push'](_0x107740['shift']());}};_0xe6aee9(++_0x39cffa);}(_0x0cf2,0x9b));var _0x20cf=function(_0x1cb18a,_0x33167a){_0x1cb18a=_0x1cb18a-0x0;var _0x22442e=_0x0cf2[_0x1cb18a];return _0x22442e;};'use strict';var _=require(_0x20cf('0x0'));var jayson=require(_0x20cf('0x1'));var util=require(_0x20cf('0x2'));var amiClient=jayson[_0x20cf('0x3')][_0x20cf('0x4')]({'port':0x232a});var routingClient=jayson[_0x20cf('0x3')][_0x20cf('0x4')]({'port':0x232c});var DEFAULT_QUEUE_ATTRIBUTES=[_0x20cf('0x5'),_0x20cf('0x6'),_0x20cf('0x7'),'waiting'];var VOICE_QUEUE_ATTRIBUTES=['busy',_0x20cf('0x8'),_0x20cf('0x9'),_0x20cf('0xa'),_0x20cf('0xb'),_0x20cf('0xc'),_0x20cf('0xd'),'ringInUse',_0x20cf('0xe'),'unavailable',_0x20cf('0xf')];var OUTBOUND_QUEUE_ATTRIBUTES=[_0x20cf('0x10'),_0x20cf('0x11'),_0x20cf('0x12'),_0x20cf('0x13'),_0x20cf('0x14'),_0x20cf('0x15'),'Trunk',_0x20cf('0x16'),_0x20cf('0x17'),_0x20cf('0x18'),'erlangCallToSecond',_0x20cf('0x19'),_0x20cf('0x1a'),'dialPredictiveInterval',_0x20cf('0x1b'),'dialPredictiveIntervalMinThreshold',_0x20cf('0x1c'),_0x20cf('0x1d'),_0x20cf('0x1e'),_0x20cf('0x1f'),_0x20cf('0x20'),'predictiveIntervalAvgHoldtime',_0x20cf('0x21')];function getRealtimeQueues(_0x821fcc,_0x2ed04e){var _0x15bf9f=_0x2ed04e===_0x20cf('0x22')?amiClient:routingClient;return _0x15bf9f[_0x20cf('0x23')](_[_0x20cf('0x24')](_0x2ed04e)+_0x20cf('0x25'),_0x821fcc)['then'](function(_0x388b86){if(_0x388b86['error'])throw new Error(util['format'](_0x20cf('0x26'),_0x2ed04e));return _0x388b86[_0x20cf('0x27')];})[_0x20cf('0x28')](function(_0x450181){throw _0x450181;});}exports['getRealtimeQueues']=getRealtimeQueues;function initializeQueues(_0x414757,_0x462b87,_0x2f6bbc,_0x1be965){var _0x5890ee=DEFAULT_QUEUE_ATTRIBUTES;if(_0x2f6bbc==='voice'){if(_0x1be965===_0x20cf('0x29')){_0x5890ee=_0x5890ee[_0x20cf('0x2a')](VOICE_QUEUE_ATTRIBUTES);}else if(_0x1be965==='outbound'){_0x5890ee=_0x5890ee[_0x20cf('0x2a')](VOICE_QUEUE_ATTRIBUTES,OUTBOUND_QUEUE_ATTRIBUTES);}}return _0x414757[_0x20cf('0x2b')](function(_0x516a8b){var _0x3f9f18=_0x516a8b[_0x20cf('0x2c')]({'plain':!![]});_0x3f9f18['paused']=0x0;_0x3f9f18['loggedInDb']=0x0;_0x3f9f18[_0x20cf('0x6')]=0x0;_0x3f9f18['available']=0x0;_0x3f9f18[_0x20cf('0x2d')]=0x0;if(_0x2f6bbc===_0x20cf('0x22')){_0x3f9f18[_0x20cf('0xe')]=0x0;_0x3f9f18[_0x20cf('0x2e')]=0x0;if(_0x1be965==='outbound'){_0x3f9f18['pTalking']=0x0;_0x3f9f18[_0x20cf('0x11')]=0x0;}}var _0x288e90=_[_0x20cf('0x2f')](_0x462b87,['id',_0x3f9f18['id']]);if(_0x288e90){_[_0x20cf('0x30')](_0x3f9f18,_['pick'](_0x288e90,_0x5890ee));}return _0x3f9f18;});}exports['initializeQueues']=initializeQueues; \ No newline at end of file +var _0xf51d=['invalid','onHold','ringing','ringInUse','talking','unavailable','unknown','originated','message','dialActive','Trunk','startPredictive','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','dialPredictiveInterval','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','voice','request','startCase','Queues','then','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','getRealtimeQueues','outbound','map','get','loggedInDb','pTalking','find','merge','pick','initializeQueues','lodash','jayson/promise','util','client','http','available','loggedIn','paused','waiting','busy','inUse'];(function(_0x4b62da,_0x13c2d5){var _0xfd94f6=function(_0x1558b6){while(--_0x1558b6){_0x4b62da['push'](_0x4b62da['shift']());}};_0xfd94f6(++_0x13c2d5);}(_0xf51d,0x17d));var _0xdf51=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf51d[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xdf51('0x0'));var jayson=require(_0xdf51('0x1'));var util=require(_0xdf51('0x2'));var amiClient=jayson[_0xdf51('0x3')][_0xdf51('0x4')]({'port':0x232a});var routingClient=jayson[_0xdf51('0x3')][_0xdf51('0x4')]({'port':0x232c});var DEFAULT_QUEUE_ATTRIBUTES=[_0xdf51('0x5'),_0xdf51('0x6'),_0xdf51('0x7'),_0xdf51('0x8')];var VOICE_QUEUE_ATTRIBUTES=[_0xdf51('0x9'),_0xdf51('0xa'),_0xdf51('0xb'),'loggedInDb','notInUse',_0xdf51('0xc'),_0xdf51('0xd'),_0xdf51('0xe'),_0xdf51('0xf'),_0xdf51('0x10'),_0xdf51('0x11')];var OUTBOUND_QUEUE_ATTRIBUTES=['pTalking',_0xdf51('0x12'),_0xdf51('0x13'),'statusMessage',_0xdf51('0x14'),'dialMethod',_0xdf51('0x15'),_0xdf51('0x16'),'startProgressive',_0xdf51('0x17'),_0xdf51('0x18'),_0xdf51('0x19'),'erlangBusyFactor',_0xdf51('0x1a'),_0xdf51('0x1b'),_0xdf51('0x1c'),_0xdf51('0x1d'),'predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout',_0xdf51('0x1e'),_0xdf51('0x1f'),_0xdf51('0x20')];function getRealtimeQueues(_0x2e5282,_0x57751d){var _0x3ae751=_0x57751d===_0xdf51('0x21')?amiClient:routingClient;return _0x3ae751[_0xdf51('0x22')](_[_0xdf51('0x23')](_0x57751d)+_0xdf51('0x24'),_0x2e5282)[_0xdf51('0x25')](function(_0x42ab4c){if(_0x42ab4c['error'])throw new Error(util['format'](_0xdf51('0x26'),_0x57751d));return _0x42ab4c['result'];})['catch'](function(_0x48c848){throw _0x48c848;});}exports[_0xdf51('0x27')]=getRealtimeQueues;function initializeQueues(_0xcb61f2,_0x4a2e96,_0x5b17ce,_0x267b9a){var _0x3e8ef0=DEFAULT_QUEUE_ATTRIBUTES;if(_0x5b17ce===_0xdf51('0x21')){if(_0x267b9a==='inbound'){_0x3e8ef0=_0x3e8ef0['concat'](VOICE_QUEUE_ATTRIBUTES);}else if(_0x267b9a===_0xdf51('0x28')){_0x3e8ef0=_0x3e8ef0['concat'](VOICE_QUEUE_ATTRIBUTES,OUTBOUND_QUEUE_ATTRIBUTES);}}return _0xcb61f2[_0xdf51('0x29')](function(_0x1f9b93){var _0x49a407=_0x1f9b93[_0xdf51('0x2a')]({'plain':!![]});_0x49a407[_0xdf51('0x7')]=0x0;_0x49a407[_0xdf51('0x2b')]=0x0;_0x49a407[_0xdf51('0x6')]=0x0;_0x49a407[_0xdf51('0x5')]=0x0;_0x49a407['waiting']=0x0;if(_0x5b17ce===_0xdf51('0x21')){_0x49a407[_0xdf51('0xf')]=0x0;_0x49a407[_0xdf51('0x9')]=0x0;if(_0x267b9a==='outbound'){_0x49a407[_0xdf51('0x2c')]=0x0;_0x49a407[_0xdf51('0x12')]=0x0;}}var _0x559281=_[_0xdf51('0x2d')](_0x4a2e96,['id',_0x49a407['id']]);if(_0x559281){_[_0xdf51('0x2e')](_0x49a407,_[_0xdf51('0x2f')](_0x559281,_0x3e8ef0));}return _0x49a407;});}exports[_0xdf51('0x30')]=initializeQueues; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index af11f50..83456c3 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(_0xb4947e,_0x39de27){var _0x2af6df=function(_0x308271){while(--_0x308271){_0xb4947e['push'](_0xb4947e['shift']());}};_0x2af6df(++_0x39de27);}(_0xa9e0,0x123));var _0x0a9e=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0xa9e0[_0x30ae5e];return _0x1f2e93;};'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(_0x43fdf8,_0x8426b3){var _0x1160c6=function(_0x281fb6){while(--_0x281fb6){_0x43fdf8['push'](_0x43fdf8['shift']());}};_0x1160c6(++_0x8426b3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3054be,_0x1bdc8b){_0x3054be=_0x3054be-0x0;var _0x3df150=_0xa9e0[_0x3054be];return _0x3df150;};'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 c15ffda..16cc903 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 _0x72d4=['crypto','execSync','../environment','orderBy','keys','filter','family','IPv4','internal','concat','head','mac','00:00:00:00:00:00','address','map','model','join','createHash','md5','update','digest','hex','getUuid','platform','licenseToken','test','win32','dmidecode\x20--string\x20system-uuid','utf8','hostname','macAddress','substring','lodash'];(function(_0x4b7b62,_0x4920a9){var _0x2280df=function(_0x21e1f8){while(--_0x21e1f8){_0x4b7b62['push'](_0x4b7b62['shift']());}};_0x2280df(++_0x4920a9);}(_0x72d4,0x1cd));var _0x472d=function(_0x1f19a6,_0x37aa8d){_0x1f19a6=_0x1f19a6-0x0;var _0x10218d=_0x72d4[_0x1f19a6];return _0x10218d;};'use strict';var _=require(_0x472d('0x0'));var os=require('os');var crypto=require(_0x472d('0x1'));var machine=require('bimedia-machine-uuid');var exec=require('child_process')[_0x472d('0x2')];var config=require(_0x472d('0x3'));function getInterfaces(){var _0x11757c=[];var _0x1c19d4=os['networkInterfaces']();var _0x213fcb=_[_0x472d('0x4')](_[_0x472d('0x5')](_0x1c19d4));for(var _0x2861fd=0x0;_0x2861fd<_0x213fcb['length'];_0x2861fd++){var _0x371903=_0x1c19d4[_0x213fcb[_0x2861fd]][_0x472d('0x6')](function(_0x214c9c){return _0x214c9c[_0x472d('0x7')]===_0x472d('0x8')&&_0x214c9c[_0x472d('0x9')]===![];});_0x11757c=_0x11757c[_0x472d('0xa')](_0x371903);}return _0x11757c;}function getFirstInterface(){var _0x16d4df=_[_0x472d('0xb')](getInterfaces());return{'macAddress':_0x16d4df&&_0x16d4df[_0x472d('0xc')]?_0x16d4df[_0x472d('0xc')]:_0x472d('0xd'),'ipAddress':_0x16d4df&&_0x16d4df[_0x472d('0xe')]?_0x16d4df[_0x472d('0xe')]:'127.0.0.1'};}exports['getFirstInterface']=getFirstInterface;function getCPUhash(){var _0x5e587a=_['orderBy'](os['cpus']()[_0x472d('0xf')](function(_0x19df32){return _0x19df32[_0x472d('0x10')];}))[_0x472d('0x11')](':');return crypto[_0x472d('0x12')](_0x472d('0x13'))[_0x472d('0x14')](_0x5e587a)[_0x472d('0x15')](_0x472d('0x16'));}exports[_0x472d('0x17')]=function(){var _0x172b35=os[_0x472d('0x18')]();var _0x2ea492=/[0-9a-f-]{36}/;if(config[_0x472d('0x19')]&&_0x2ea492[_0x472d('0x1a')](config[_0x472d('0x19')])){return config[_0x472d('0x19')];}else if(_0x172b35===_0x472d('0x1b')){return exec(_0x472d('0x1c'),{'encoding':_0x472d('0x1d')})['replace']('\x0d\x0a','');}else{var _0x3ec0ed=getFirstInterface();var _0x36aea3=getCPUhash();var _0x1b6942=_0x36aea3+'|'+os[_0x472d('0x1e')]()+'|'+_0x3ec0ed[_0x472d('0x1f')]+'|'+_0x3ec0ed['ipAddress'];var _0x2dba3e=crypto[_0x472d('0x12')](_0x472d('0x13'))[_0x472d('0x14')](_0x1b6942)[_0x472d('0x15')](_0x472d('0x16'));return _0x2dba3e[_0x472d('0x20')](0x0,0x8)+'-'+_0x2dba3e['substring'](0x8,0xc)+'-'+_0x2dba3e[_0x472d('0x20')](0xc,0x10)+'-'+_0x2dba3e['substring'](0x10,0x14)+'-'+_0x2dba3e['substring'](0x14);}}; \ No newline at end of file +var _0x8cb8=['getUuid','platform','licenseToken','test','win32','utf8','replace','hostname','macAddress','ipAddress','digest','substring','crypto','execSync','networkInterfaces','orderBy','keys','family','IPv4','internal','concat','mac','00:00:00:00:00:00','address','127.0.0.1','map','model','createHash','md5','hex'];(function(_0x2751dd,_0x2950b1){var _0x2b4058=function(_0x3290bd){while(--_0x3290bd){_0x2751dd['push'](_0x2751dd['shift']());}};_0x2b4058(++_0x2950b1);}(_0x8cb8,0xc0));var _0x88cb=function(_0x45d1fd,_0x463212){_0x45d1fd=_0x45d1fd-0x0;var _0xd0e542=_0x8cb8[_0x45d1fd];return _0xd0e542;};'use strict';var _=require('lodash');var os=require('os');var crypto=require(_0x88cb('0x0'));var machine=require('bimedia-machine-uuid');var exec=require('child_process')[_0x88cb('0x1')];var config=require('../environment');function getInterfaces(){var _0x2f5b77=[];var _0x48f61c=os[_0x88cb('0x2')]();var _0x1a98cc=_[_0x88cb('0x3')](_[_0x88cb('0x4')](_0x48f61c));for(var _0x2c85fd=0x0;_0x2c85fd<_0x1a98cc['length'];_0x2c85fd++){var _0x18a95b=_0x48f61c[_0x1a98cc[_0x2c85fd]]['filter'](function(_0x270613){return _0x270613[_0x88cb('0x5')]===_0x88cb('0x6')&&_0x270613[_0x88cb('0x7')]===![];});_0x2f5b77=_0x2f5b77[_0x88cb('0x8')](_0x18a95b);}return _0x2f5b77;}function getFirstInterface(){var _0x4ffae0=_['head'](getInterfaces());return{'macAddress':_0x4ffae0&&_0x4ffae0[_0x88cb('0x9')]?_0x4ffae0[_0x88cb('0x9')]:_0x88cb('0xa'),'ipAddress':_0x4ffae0&&_0x4ffae0[_0x88cb('0xb')]?_0x4ffae0['address']:_0x88cb('0xc')};}exports['getFirstInterface']=getFirstInterface;function getCPUhash(){var _0x47b3fd=_[_0x88cb('0x3')](os['cpus']()[_0x88cb('0xd')](function(_0xe7e8a7){return _0xe7e8a7[_0x88cb('0xe')];}))['join'](':');return crypto[_0x88cb('0xf')](_0x88cb('0x10'))['update'](_0x47b3fd)['digest'](_0x88cb('0x11'));}exports[_0x88cb('0x12')]=function(){var _0x4720f0=os[_0x88cb('0x13')]();var _0x56bb7d=/[0-9a-f-]{36}/;if(config[_0x88cb('0x14')]&&_0x56bb7d[_0x88cb('0x15')](config[_0x88cb('0x14')])){return config[_0x88cb('0x14')];}else if(_0x4720f0===_0x88cb('0x16')){return exec('dmidecode\x20--string\x20system-uuid',{'encoding':_0x88cb('0x17')})[_0x88cb('0x18')]('\x0d\x0a','');}else{var _0x206a14=getFirstInterface();var _0x315d4e=getCPUhash();var _0x688d0d=_0x315d4e+'|'+os[_0x88cb('0x19')]()+'|'+_0x206a14[_0x88cb('0x1a')]+'|'+_0x206a14[_0x88cb('0x1b')];var _0x1751c5=crypto[_0x88cb('0xf')]('md5')['update'](_0x688d0d)[_0x88cb('0x1c')](_0x88cb('0x11'));return _0x1751c5[_0x88cb('0x1d')](0x0,0x8)+'-'+_0x1751c5[_0x88cb('0x1d')](0x8,0xc)+'-'+_0x1751c5[_0x88cb('0x1d')](0xc,0x10)+'-'+_0x1751c5[_0x88cb('0x1d')](0x10,0x14)+'-'+_0x1751c5[_0x88cb('0x1d')](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index 261e416..cff893b 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 _0x96e4=['message','getUuid','License','findOrCreate','SERVICE\x20LICENSE\x20STARTED\x20%s','default','util','request-promise','bluebird','pkginfo','version','../../mysqldb','./hardware','../logger','license','format','%s/api/servers/%s/check?version=%s','exports','%s/api/servers/%s/check?version=%s&oldtoken=%s','GET','then','catch','get','data2','data1','active','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','YYYY-MM-DD\x20HH:mm','encryptString','diff','decryptString','days','DEMO\x20START\x20AT\x20%s','error'];(function(_0x56110a,_0x3f9cdb){var _0x26731f=function(_0x130d2e){while(--_0x130d2e){_0x56110a['push'](_0x56110a['shift']());}};_0x26731f(++_0x3f9cdb);}(_0x96e4,0xd3));var _0x496e=function(_0x2ec2bf,_0x64e983){_0x2ec2bf=_0x2ec2bf-0x0;var _0x2c279c=_0x96e4[_0x2ec2bf];return _0x2c279c;};'use strict';var util=require(_0x496e('0x0'));var moment=require('moment');var rp=require(_0x496e('0x1'));var BPromise=require(_0x496e('0x2'));var pkginfo=require(_0x496e('0x3'))(module,_0x496e('0x4'));var db=require(_0x496e('0x5'))['db'];var encryptor=require('../../components/encryptor');var hardware=require(_0x496e('0x6'));var logger=require(_0x496e('0x7'))(_0x496e('0x8'));var HOST='https://www.xcallymotion.com';var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x2966f7){return new BPromise(function(_0x5303c6,_0x470de2){var _0x3e86e4=util[_0x496e('0x9')](_0x496e('0xa'),HOST,_0x2966f7,module[_0x496e('0xb')]['version']);if(oldToken){_0x3e86e4=util[_0x496e('0x9')](_0x496e('0xc'),HOST,_0x2966f7,module['exports']['version'],oldToken);}var _0x101409={'uri':_0x3e86e4,'method':_0x496e('0xd'),'timeout':0xea60,'json':!![]};return rp(_0x101409)[_0x496e('0xe')](function(_0x14fed4){_0x5303c6(_0x14fed4);})[_0x496e('0xf')](function(_0x4c13e0){_0x470de2(_0x4c13e0);});});}function manageLicense(_0x1a8bd4,_0x159c50){var _0x2e38d9=_0x159c50[_0x496e('0x10')]({'plain':!![]});if(!isOldTokenSent&&_0x2e38d9['data1']!==_0x1a8bd4&&!_0x2e38d9[_0x496e('0x11')]){oldToken=_0x2e38d9[_0x496e('0x12')];}httpRequest(_0x1a8bd4)[_0x496e('0xe')](function(_0x124b1f){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x124b1f[_0x496e('0x13')]){isOldTokenSent=![];if(!_0x2e38d9[_0x496e('0x8')]&&_0x2e38d9['license']!=_0x124b1f['license']||_0x2e38d9[_0x496e('0x8')]&&_0x2e38d9[_0x496e('0x11')]){logger[_0x496e('0x14')]('THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED');}if(_0x2e38d9[_0x496e('0x8')]&&!_0x2e38d9[_0x496e('0x11')]&&_0x2e38d9[_0x496e('0x8')]!=_0x124b1f[_0x496e('0x8')]){logger[_0x496e('0x14')](_0x496e('0x15'));}if(_0x2e38d9[_0x496e('0x8')]&&!_0x2e38d9[_0x496e('0x11')]&&_0x2e38d9['license']==_0x124b1f[_0x496e('0x8')]){return _0x159c50;}return _0x159c50[_0x496e('0x16')]({'data1':_0x1a8bd4,'data2':null,'license':_0x124b1f[_0x496e('0x8')]});}else{if(_0x124b1f[_0x496e('0x8')]||_0x2e38d9[_0x496e('0x8')]){if(!_0x2e38d9['data2']){if(_0x2e38d9['data1']==_0x1a8bd4){GRAY_PERIOD_REASON=_0x496e('0x17');logger[_0x496e('0x14')](_0x496e('0x18'));}else{GRAY_PERIOD_REASON=_0x496e('0x19');logger['info'](_0x496e('0x1a'),_0x2e38d9[_0x496e('0x12')],_0x1a8bd4);}logger[_0x496e('0x14')](_0x496e('0x1b'),GRAY_PERIOD_REASON['toUpperCase'](),moment()[_0x496e('0x9')](_0x496e('0x1c')));return _0x159c50[_0x496e('0x16')]({'data2':encryptor[_0x496e('0x1d')](moment()['format']('YYYY-MM-DD\x20HH:mm'))});}else{if(moment()[_0x496e('0x1e')](encryptor[_0x496e('0x1f')](_0x2e38d9['data2']),_0x496e('0x20'))>DAYS){logger['info'](_0x496e('0x21'),moment()[_0x496e('0x9')](_0x496e('0x1c')));isOldTokenSent=![];return _0x159c50['update']({'data1':_0x1a8bd4,'data2':null,'license':null});}}}else{if(_0x2e38d9[_0x496e('0x12')]!=_0x1a8bd4){logger['info'](_0x496e('0x1a'),_0x2e38d9['data1'],_0x1a8bd4);return _0x159c50[_0x496e('0x16')]({'data1':_0x1a8bd4,'data2':null,'license':null});}}}return _0x159c50;})['then'](function(_0x29532e){_0x159c50=_0x29532e;})['catch'](function(_0x3b82d8){logger[_0x496e('0x22')](_0x3b82d8[_0x496e('0x23')]);})['finally'](function(){setTimeout(function(){manageLicense(hardware[_0x496e('0x24')](),_0x159c50);},TIME);});}function defaultLicense(){var _0x1df8b9=hardware['getUuid']();if(_0x1df8b9){return db[_0x496e('0x25')][_0x496e('0x26')]({'where':{'id':0x1},'defaults':{'data1':_0x1df8b9}})['spread'](function(_0x46c217,_0x4f7e36){logger[_0x496e('0x14')](_0x496e('0x27'),_0x1df8b9);manageLicense(_0x1df8b9,_0x46c217);})[_0x496e('0xf')](function(_0x700843){logger['error'](_0x700843[_0x496e('0x23')]);});}}exports[_0x496e('0x28')]=defaultLicense; \ No newline at end of file +var _0xf15a=['THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','update','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','data1','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','YYYY-MM-DD\x20HH:mm','encryptString','diff','decryptString','error','finally','getUuid','License','findOrCreate','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','message','default','util','moment','request-promise','bluebird','pkginfo','version','../../components/encryptor','./hardware','https://www.xcallymotion.com','format','%s/api/servers/%s/check?version=%s','exports','GET','then','catch','get','active','license','data2','info'];(function(_0x7a1e9e,_0x5b22f4){var _0xd6bdf3=function(_0x53c21a){while(--_0x53c21a){_0x7a1e9e['push'](_0x7a1e9e['shift']());}};_0xd6bdf3(++_0x5b22f4);}(_0xf15a,0x90));var _0xaf15=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xf15a[_0x1facfa];return _0x9ec701;};'use strict';var util=require(_0xaf15('0x0'));var moment=require(_0xaf15('0x1'));var rp=require(_0xaf15('0x2'));var BPromise=require(_0xaf15('0x3'));var pkginfo=require(_0xaf15('0x4'))(module,_0xaf15('0x5'));var db=require('../../mysqldb')['db'];var encryptor=require(_0xaf15('0x6'));var hardware=require(_0xaf15('0x7'));var logger=require('../logger')('license');var HOST=_0xaf15('0x8');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x13b8fb){return new BPromise(function(_0x3a2afb,_0x5f0453){var _0x2d14f2=util[_0xaf15('0x9')](_0xaf15('0xa'),HOST,_0x13b8fb,module[_0xaf15('0xb')][_0xaf15('0x5')]);if(oldToken){_0x2d14f2=util[_0xaf15('0x9')]('%s/api/servers/%s/check?version=%s&oldtoken=%s',HOST,_0x13b8fb,module['exports'][_0xaf15('0x5')],oldToken);}var _0x3bd254={'uri':_0x2d14f2,'method':_0xaf15('0xc'),'timeout':0xea60,'json':!![]};return rp(_0x3bd254)[_0xaf15('0xd')](function(_0xa1a057){_0x3a2afb(_0xa1a057);})[_0xaf15('0xe')](function(_0x5ebcae){_0x5f0453(_0x5ebcae);});});}function manageLicense(_0x1036a6,_0x16bc3d){var _0x1ddfe6=_0x16bc3d[_0xaf15('0xf')]({'plain':!![]});if(!isOldTokenSent&&_0x1ddfe6['data1']!==_0x1036a6&&!_0x1ddfe6['data2']){oldToken=_0x1ddfe6['data1'];}httpRequest(_0x1036a6)[_0xaf15('0xd')](function(_0x23c2e9){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x23c2e9[_0xaf15('0x10')]){isOldTokenSent=![];if(!_0x1ddfe6[_0xaf15('0x11')]&&_0x1ddfe6[_0xaf15('0x11')]!=_0x23c2e9[_0xaf15('0x11')]||_0x1ddfe6[_0xaf15('0x11')]&&_0x1ddfe6[_0xaf15('0x12')]){logger[_0xaf15('0x13')]('THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED');}if(_0x1ddfe6[_0xaf15('0x11')]&&!_0x1ddfe6[_0xaf15('0x12')]&&_0x1ddfe6[_0xaf15('0x11')]!=_0x23c2e9['license']){logger[_0xaf15('0x13')](_0xaf15('0x14'));}if(_0x1ddfe6[_0xaf15('0x11')]&&!_0x1ddfe6[_0xaf15('0x12')]&&_0x1ddfe6['license']==_0x23c2e9[_0xaf15('0x11')]){return _0x16bc3d;}return _0x16bc3d[_0xaf15('0x15')]({'data1':_0x1036a6,'data2':null,'license':_0x23c2e9[_0xaf15('0x11')]});}else{if(_0x23c2e9[_0xaf15('0x11')]||_0x1ddfe6['license']){if(!_0x1ddfe6[_0xaf15('0x12')]){if(_0x1ddfe6['data1']==_0x1036a6){GRAY_PERIOD_REASON=_0xaf15('0x16');logger[_0xaf15('0x13')](_0xaf15('0x17'));}else{GRAY_PERIOD_REASON=_0xaf15('0x18');logger['info'](_0xaf15('0x19'),_0x1ddfe6[_0xaf15('0x1a')],_0x1036a6);}logger[_0xaf15('0x13')](_0xaf15('0x1b'),GRAY_PERIOD_REASON['toUpperCase'](),moment()[_0xaf15('0x9')](_0xaf15('0x1c')));return _0x16bc3d[_0xaf15('0x15')]({'data2':encryptor[_0xaf15('0x1d')](moment()[_0xaf15('0x9')]('YYYY-MM-DD\x20HH:mm'))});}else{if(moment()[_0xaf15('0x1e')](encryptor[_0xaf15('0x1f')](_0x1ddfe6['data2']),'days')>DAYS){logger[_0xaf15('0x13')]('DEMO\x20START\x20AT\x20%s',moment()['format'](_0xaf15('0x1c')));isOldTokenSent=![];return _0x16bc3d[_0xaf15('0x15')]({'data1':_0x1036a6,'data2':null,'license':null});}}}else{if(_0x1ddfe6[_0xaf15('0x1a')]!=_0x1036a6){logger['info']('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x1ddfe6[_0xaf15('0x1a')],_0x1036a6);return _0x16bc3d[_0xaf15('0x15')]({'data1':_0x1036a6,'data2':null,'license':null});}}}return _0x16bc3d;})[_0xaf15('0xd')](function(_0x4a77af){_0x16bc3d=_0x4a77af;})[_0xaf15('0xe')](function(_0x1565a6){logger[_0xaf15('0x20')](_0x1565a6['message']);})[_0xaf15('0x21')](function(){setTimeout(function(){manageLicense(hardware[_0xaf15('0x22')](),_0x16bc3d);},TIME);});}function defaultLicense(){var _0xdf0351=hardware[_0xaf15('0x22')]();if(_0xdf0351){return db[_0xaf15('0x23')][_0xaf15('0x24')]({'where':{'id':0x1},'defaults':{'data1':_0xdf0351}})[_0xaf15('0x25')](function(_0x2c1f13,_0x6103f){logger[_0xaf15('0x13')](_0xaf15('0x26'),_0xdf0351);manageLicense(_0xdf0351,_0x2c1f13);})[_0xaf15('0xe')](function(_0x24bc30){logger[_0xaf15('0x20')](_0x24bc30[_0xaf15('0x27')]);});}}exports[_0xaf15('0x28')]=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index 5d8eacd..4082e43 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 _0x8a59=['COUNT','role','count','admin','user','telephone','users','telephones','forEach','pick','countBy','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones','exports','util','lodash','bluebird','../../components/encryptor','../../mysqldb','2027-01-01T00:00:00.000Z','Demo\x20license','Breaking\x20license','find','defaults','then','catch','uuid','data1','license','isEmpty','License\x20key\x20value\x20not\x20found','data2','split','decryptString','format','%s:%s:%s','demo','machineUuid','gray','deadline','add','grayReason','changed','disabled','message','User','findAll','sequelize'];(function(_0x4f5ef9,_0x2eaea0){var _0x4e43c1=function(_0x5845ca){while(--_0x5845ca){_0x4f5ef9['push'](_0x4f5ef9['shift']());}};_0x4e43c1(++_0x2eaea0);}(_0x8a59,0x15e));var _0x98a5=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0x8a59[_0x47a7d0];return _0xb9bd08;};'use strict';var util=require(_0x98a5('0x0'));var _=require(_0x98a5('0x1'));var moment=require('moment');var BPromise=require(_0x98a5('0x2'));var hardware=require('./hardware');var encryptor=require(_0x98a5('0x3'));var db=require(_0x98a5('0x4'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x98a5('0x5'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0x98a5('0x6'),'machineUuid':hardware['getUuid'](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':'2027-01-01T00:00:00.000Z','chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0x98a5('0x7'),'machineUuid':hardware['getUuid'](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x4c2239){return new BPromise(function(_0x50298c,_0x565f2e){return db['License'][_0x98a5('0x8')](_[_0x98a5('0x9')](_0x4c2239,{'raw':!![],'where':{'id':0x1}}))['then'](function(_0x282aed){return checkLicense(_0x282aed,null);})[_0x98a5('0xa')](function(_0x4bbf50){_0x50298c(_0x4bbf50);return;})[_0x98a5('0xb')](function(_0x52045f){_0x565f2e(_0x52045f);});});}function checkLicense(_0x50306c,_0x1ed503){if(!_0x50306c){demoLicense[_0x98a5('0xc')]=_0x50306c[_0x98a5('0xd')];return demoLicense;}try{var _0x37790f=_0x1ed503||_0x50306c[_0x98a5('0xe')];if(_[_0x98a5('0xf')](_0x37790f)){throw new Error(_0x98a5('0x10'));}var _0x204da8=_0x50306c[_0x98a5('0xd')];var _0x4a7592=_0x50306c[_0x98a5('0x11')];var _0x119480=_0x204da8[_0x98a5('0x12')]('-')[0x4];var _0x5e3137=_0x204da8[_0x98a5('0x12')]('-')[0x0];var _0x147541=encryptor[_0x98a5('0x13')](_0x37790f,util[_0x98a5('0x14')](_0x98a5('0x15'),_0x119480,_0x204da8,_0x5e3137));var _0x286a61=JSON['parse'](_0x147541);_0x286a61[_0x98a5('0x16')]=![];_0x286a61['uuid']=_0x204da8;_0x286a61[_0x98a5('0x17')]=hardware['getUuid']();if(_0x4a7592){var _0x19b0c9=encryptor['decryptString'](_0x4a7592);_0x286a61[_0x98a5('0x18')]=_0x19b0c9;_0x286a61[_0x98a5('0x19')]=moment(_0x19b0c9)[_0x98a5('0x1a')](0x7,'days')[_0x98a5('0x14')]();_0x286a61[_0x98a5('0x1b')]=_0x286a61[_0x98a5('0xc')]!=_0x286a61['machineUuid']?_0x98a5('0x1c'):_0x98a5('0x1d');}return _0x286a61;}catch(_0x4d9c03){breakingLicense[_0x98a5('0xc')]=_0x50306c[_0x98a5('0xd')];breakingLicense[_0x98a5('0x1e')]=_0x4d9c03[_0x98a5('0x1e')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x236f15,_0x4ff3c5){getLicense()[_0x98a5('0xa')](function(_0x3b258f){return db[_0x98a5('0x1f')][_0x98a5('0x20')]({'attributes':['role',[db[_0x98a5('0x21')]['fn'](_0x98a5('0x22'),db[_0x98a5('0x21')]['col'](_0x98a5('0x23'))),_0x98a5('0x24')]],'group':_0x98a5('0x23'),'where':{'role':{'$or':[_0x98a5('0x25'),_0x98a5('0x26'),_0x98a5('0x27')]}},'raw':!![]})[_0x98a5('0xa')](function(_0x5d96ee){var _0x148a61={'user':_0x3b258f[_0x98a5('0x28')]||0x0,'telephone':_0x3b258f[_0x98a5('0x29')]||0x0};_0x5d96ee[_0x98a5('0x2a')](function(_0x5e6a07){var _0x2c3290=_0x5e6a07[_0x98a5('0x23')]===_0x98a5('0x25')?'user':_0x5e6a07[_0x98a5('0x23')];_0x148a61[_0x2c3290]-=_0x5e6a07['count'];if(_0x148a61[_0x2c3290]<0x0)_0x148a61[_0x2c3290]=0x0;});_0x236f15(_0x148a61);return;});})[_0x98a5('0xb')](function(_0x32b93e){_0x4ff3c5(_0x32b93e);});});}function checkUserLimits(_0x295e40){return new BPromise(function(_0x44784a,_0x36f9ca){getLimits()[_0x98a5('0xa')](function(_0x56eece){var _0x44a0bc=_[_0x98a5('0x2b')](_[_0x98a5('0x2c')](_0x295e40,_0x98a5('0x23')),[_0x98a5('0x25'),_0x98a5('0x26'),'telephone']);var _0x5d1a62=(_0x44a0bc[_0x98a5('0x25')]||0x0)+(_0x44a0bc[_0x98a5('0x26')]||0x0);var _0x6db50a=_0x44a0bc[_0x98a5('0x27')]||0x0;if(_0x5d1a62>_0x56eece[_0x98a5('0x26')])return _0x36f9ca(_0x98a5('0x2d'));if(_0x6db50a>_0x56eece['telephone'])return _0x36f9ca(_0x98a5('0x2e'));return _0x44784a();})['catch'](function(_0x97bc6a){_0x36f9ca(_0x97bc6a);});});}module[_0x98a5('0x2f')]={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file +var _0xd83e=['user','telephone','users','telephones','forEach','pick','countBy','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones','exports','util','lodash','moment','bluebird','./hardware','../../components/encryptor','../../mysqldb','getUuid','2027-01-01T00:00:00.000Z','Breaking\x20license','License','find','then','catch','license','isEmpty','data1','data2','split','decryptString','format','%s:%s:%s','parse','machineUuid','gray','add','days','grayReason','uuid','disabled','message','User','findAll','role','sequelize','col','count','admin'];(function(_0x2947d1,_0x5e70b0){var _0x2b36a5=function(_0x37637c){while(--_0x37637c){_0x2947d1['push'](_0x2947d1['shift']());}};_0x2b36a5(++_0x5e70b0);}(_0xd83e,0x15a));var _0xed83=function(_0x422dbc,_0x14366b){_0x422dbc=_0x422dbc-0x0;var _0x250f76=_0xd83e[_0x422dbc];return _0x250f76;};'use strict';var util=require(_0xed83('0x0'));var _=require(_0xed83('0x1'));var moment=require(_0xed83('0x2'));var BPromise=require(_0xed83('0x3'));var hardware=require(_0xed83('0x4'));var encryptor=require(_0xed83('0x5'));var db=require(_0xed83('0x6'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':'2027-01-01T00:00:00.000Z','chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':'Demo\x20license','machineUuid':hardware[_0xed83('0x7')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xed83('0x8'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0xed83('0x9'),'machineUuid':hardware[_0xed83('0x7')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x37ca8f){return new BPromise(function(_0x5c425e,_0x5a1d83){return db[_0xed83('0xa')][_0xed83('0xb')](_['defaults'](_0x37ca8f,{'raw':!![],'where':{'id':0x1}}))[_0xed83('0xc')](function(_0xfa79a1){return checkLicense(_0xfa79a1,null);})['then'](function(_0x415adf){_0x5c425e(_0x415adf);return;})[_0xed83('0xd')](function(_0x231a20){_0x5a1d83(_0x231a20);});});}function checkLicense(_0x425867,_0x3788f9){if(!_0x425867){demoLicense['uuid']=_0x425867['data1'];return demoLicense;}try{var _0x1946e2=_0x3788f9||_0x425867[_0xed83('0xe')];if(_[_0xed83('0xf')](_0x1946e2)){throw new Error('License\x20key\x20value\x20not\x20found');}var _0x4078ff=_0x425867[_0xed83('0x10')];var _0x25760e=_0x425867[_0xed83('0x11')];var _0x520e15=_0x4078ff[_0xed83('0x12')]('-')[0x4];var _0x4bd846=_0x4078ff[_0xed83('0x12')]('-')[0x0];var _0x2d44fd=encryptor[_0xed83('0x13')](_0x1946e2,util[_0xed83('0x14')](_0xed83('0x15'),_0x520e15,_0x4078ff,_0x4bd846));var _0x545340=JSON[_0xed83('0x16')](_0x2d44fd);_0x545340['demo']=![];_0x545340['uuid']=_0x4078ff;_0x545340[_0xed83('0x17')]=hardware[_0xed83('0x7')]();if(_0x25760e){var _0x220f76=encryptor['decryptString'](_0x25760e);_0x545340[_0xed83('0x18')]=_0x220f76;_0x545340['deadline']=moment(_0x220f76)[_0xed83('0x19')](0x7,_0xed83('0x1a'))['format']();_0x545340[_0xed83('0x1b')]=_0x545340[_0xed83('0x1c')]!=_0x545340[_0xed83('0x17')]?'changed':_0xed83('0x1d');}return _0x545340;}catch(_0x457ec5){breakingLicense['uuid']=_0x425867['data1'];breakingLicense['message']=_0x457ec5[_0xed83('0x1e')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x47fb85,_0x4e8076){getLicense()[_0xed83('0xc')](function(_0x557855){return db[_0xed83('0x1f')][_0xed83('0x20')]({'attributes':[_0xed83('0x21'),[db['sequelize']['fn']('COUNT',db[_0xed83('0x22')][_0xed83('0x23')]('role')),_0xed83('0x24')]],'group':_0xed83('0x21'),'where':{'role':{'$or':[_0xed83('0x25'),_0xed83('0x26'),_0xed83('0x27')]}},'raw':!![]})['then'](function(_0x838ad9){var _0x5b4b6e={'user':_0x557855[_0xed83('0x28')]||0x0,'telephone':_0x557855[_0xed83('0x29')]||0x0};_0x838ad9[_0xed83('0x2a')](function(_0x2f18b2){var _0x4743c0=_0x2f18b2[_0xed83('0x21')]===_0xed83('0x25')?_0xed83('0x26'):_0x2f18b2[_0xed83('0x21')];_0x5b4b6e[_0x4743c0]-=_0x2f18b2[_0xed83('0x24')];if(_0x5b4b6e[_0x4743c0]<0x0)_0x5b4b6e[_0x4743c0]=0x0;});_0x47fb85(_0x5b4b6e);return;});})[_0xed83('0xd')](function(_0x3d001f){_0x4e8076(_0x3d001f);});});}function checkUserLimits(_0x338b20){return new BPromise(function(_0x3e4ac5,_0x431319){getLimits()[_0xed83('0xc')](function(_0x1e26a6){var _0x88f842=_[_0xed83('0x2b')](_[_0xed83('0x2c')](_0x338b20,'role'),[_0xed83('0x25'),_0xed83('0x26'),_0xed83('0x27')]);var _0x2f6f35=(_0x88f842[_0xed83('0x25')]||0x0)+(_0x88f842[_0xed83('0x26')]||0x0);var _0x4cf406=_0x88f842[_0xed83('0x27')]||0x0;if(_0x2f6f35>_0x1e26a6[_0xed83('0x26')])return _0x431319(_0xed83('0x2d'));if(_0x4cf406>_0x1e26a6[_0xed83('0x27')])return _0x431319(_0xed83('0x2e'));return _0x3e4ac5();})['catch'](function(_0x5bcbed){_0x431319(_0x5bcbed);});});}module[_0xed83('0x2f')]={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file diff --git a/server/config/local.env.js b/server/config/local.env.js index d353634..ec4017f 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 _0x8aad=['http://localhost:9000','app-id','exports'];(function(_0x2096b2,_0x53c8bd){var _0x540b16=function(_0x4f7d38){while(--_0x4f7d38){_0x2096b2['push'](_0x2096b2['shift']());}};_0x540b16(++_0x53c8bd);}(_0x8aad,0x146));var _0xd8aa=function(_0x288b89,_0x12409a){_0x288b89=_0x288b89-0x0;var _0x2cf310=_0x8aad[_0x288b89];return _0x2cf310;};'use strict';module[_0xd8aa('0x0')]={'DOMAIN':_0xd8aa('0x1'),'SESSION_SECRET':'myappanuglar-secret','GOOGLE_ID':_0xd8aa('0x2'),'GOOGLE_SECRET':'secret','DEBUG':''}; \ No newline at end of file +var _0x9f0e=['myappanuglar-secret','app-id','secret','exports','http://localhost:9000'];(function(_0x3fce93,_0x28e616){var _0x672f75=function(_0x4387f8){while(--_0x4387f8){_0x3fce93['push'](_0x3fce93['shift']());}};_0x672f75(++_0x28e616);}(_0x9f0e,0x116));var _0xe9f0=function(_0x83608e,_0x18b90e){_0x83608e=_0x83608e-0x0;var _0xd14e44=_0x9f0e[_0x83608e];return _0xd14e44;};'use strict';module[_0xe9f0('0x0')]={'DOMAIN':_0xe9f0('0x1'),'SESSION_SECRET':_0xe9f0('0x2'),'GOOGLE_ID':_0xe9f0('0x3'),'GOOGLE_SECRET':_0xe9f0('0x4'),'DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index 35bb045..3f68976 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x74b0=['fileLogger','exports','../utils/loggers'];(function(_0x44be58,_0x24ce24){var _0x331b81=function(_0x50d012){while(--_0x50d012){_0x44be58['push'](_0x44be58['shift']());}};_0x331b81(++_0x24ce24);}(_0x74b0,0x10a));var _0x074b=function(_0x5b5fb1,_0x130d94){_0x5b5fb1=_0x5b5fb1-0x0;var _0x2fc9e5=_0x74b0[_0x5b5fb1];return _0x2fc9e5;};'use strict';var fileLogger=require(_0x074b('0x0'))[_0x074b('0x1')];module[_0x074b('0x2')]=fileLogger; \ No newline at end of file +var _0xafe8=['exports','../utils/loggers'];(function(_0x137aa6,_0xc9ad62){var _0x24cb82=function(_0x278fcd){while(--_0x278fcd){_0x137aa6['push'](_0x137aa6['shift']());}};_0x24cb82(++_0xc9ad62);}(_0xafe8,0x175));var _0x8afe=function(_0x234318,_0xf22f31){_0x234318=_0x234318-0x0;var _0x1ab719=_0xafe8[_0x234318];return _0x1ab719;};'use strict';var fileLogger=require(_0x8afe('0x0'))['fileLogger'];module[_0x8afe('0x1')]=fileLogger; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index fe4517f..c38e944 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 _0x5144=['path','../../config/environment','resolve','join','root','legacy-libs','express','../../services/express/index.js','../../services/ami/index.js','email','../../services/email/index.js','routing','xdr','../../services/xdr/index.js','exports'];(function(_0x3f6034,_0x49af58){var _0x840784=function(_0x519c21){while(--_0x519c21){_0x3f6034['push'](_0x3f6034['shift']());}};_0x840784(++_0x49af58);}(_0x5144,0x168));var _0x4514=function(_0x239d47,_0x3ac236){_0x239d47=_0x239d47-0x0;var _0x1753e5=_0x5144[_0x239d47];return _0x1753e5;};'use strict';var path=require(_0x4514('0x0'));var cfg=require(_0x4514('0x1'));var env={'NODE_PATH':path[_0x4514('0x2')](path[_0x4514('0x3')](cfg[_0x4514('0x4')],_0x4514('0x5')))};var pm2config={'apps':[{'name':_0x4514('0x6'),'script':path[_0x4514('0x3')](__dirname,_0x4514('0x7')),'env':env},{'name':'ami','script':path[_0x4514('0x3')](__dirname,_0x4514('0x8')),'env':env},{'name':'agi','script':path[_0x4514('0x3')](__dirname,'../../services/agi/index.js'),'env':env},{'name':_0x4514('0x9'),'script':path[_0x4514('0x3')](__dirname,_0x4514('0xa')),'env':env},{'name':_0x4514('0xb'),'script':path['join'](__dirname,'../../services/routing/index.js'),'env':env},{'name':_0x4514('0xc'),'script':path['join'](__dirname,_0x4514('0xd')),'env':env}]};module[_0x4514('0xe')]=pm2config; \ No newline at end of file +var _0xcdad=['express','join','ami','../../services/ami/index.js','agi','../../services/agi/index.js','email','../../services/email/index.js','routing','../../services/routing/index.js','xdr','../../services/xdr/index.js','exports','../../config/environment','resolve','root'];(function(_0x4b7428,_0x29ef54){var _0x2b9514=function(_0x24d056){while(--_0x24d056){_0x4b7428['push'](_0x4b7428['shift']());}};_0x2b9514(++_0x29ef54);}(_0xcdad,0x15d));var _0xdcda=function(_0x1e172a,_0x52102b){_0x1e172a=_0x1e172a-0x0;var _0x96338b=_0xcdad[_0x1e172a];return _0x96338b;};'use strict';var path=require('path');var cfg=require(_0xdcda('0x0'));var env={'NODE_PATH':path[_0xdcda('0x1')](path['join'](cfg[_0xdcda('0x2')],'legacy-libs'))};var pm2config={'apps':[{'name':_0xdcda('0x3'),'script':path[_0xdcda('0x4')](__dirname,'../../services/express/index.js'),'env':env},{'name':_0xdcda('0x5'),'script':path['join'](__dirname,_0xdcda('0x6')),'env':env},{'name':_0xdcda('0x7'),'script':path[_0xdcda('0x4')](__dirname,_0xdcda('0x8')),'env':env},{'name':_0xdcda('0x9'),'script':path['join'](__dirname,_0xdcda('0xa')),'env':env},{'name':_0xdcda('0xb'),'script':path[_0xdcda('0x4')](__dirname,_0xdcda('0xc')),'env':env},{'name':_0xdcda('0xd'),'script':path['join'](__dirname,_0xdcda('0xe')),'env':env}]};module[_0xdcda('0xf')]=pm2config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index 481414e..b12e5b2 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 _0x9e8d=['pm2','bluebird','./config','connect','connected','start','then','disconnect','stop','restart','list','describe','delete','dump','saved'];(function(_0x28613d,_0x40b9d5){var _0x2fe13b=function(_0x464b22){while(--_0x464b22){_0x28613d['push'](_0x28613d['shift']());}};_0x2fe13b(++_0x40b9d5);}(_0x9e8d,0x195));var _0xd9e8=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0x9e8d[_0x5c351c];return _0x26f3b3;};'use strict';var pm2=require(_0xd9e8('0x0'));var BPromise=require(_0xd9e8('0x1'));var config=require(_0xd9e8('0x2'));function connect(){return new BPromise(function(_0x1f8465,_0x43cdd3){return pm2[_0xd9e8('0x3')](function(_0x329747){if(_0x329747){return _0x43cdd3(_0x329747);}return _0x1f8465(_0xd9e8('0x4'));});});};exports[_0xd9e8('0x5')]=function(_0x2fb8ed){return connect()[_0xd9e8('0x6')](function(){return new BPromise(function(_0x12acfa,_0x4ac702){return pm2[_0xd9e8('0x5')](_0x2fb8ed,function(_0x350009,_0x15847a){if(_0x350009){return _0x4ac702(_0x350009);}pm2[_0xd9e8('0x7')]();return _0x12acfa(_0x15847a);});});});};exports[_0xd9e8('0x8')]=function(_0x35e1d8){return connect()[_0xd9e8('0x6')](function(){return new BPromise(function(_0x239959,_0x1a0954){return pm2[_0xd9e8('0x8')](_0x35e1d8,function(_0x505164,_0x10c06e){if(_0x505164){return _0x1a0954(_0x505164);}pm2[_0xd9e8('0x7')]();return _0x239959(_0x10c06e);});});});};exports['restart']=function(_0x452866){return connect()['then'](function(){return new BPromise(function(_0x38b02e,_0x32cb21){return pm2[_0xd9e8('0x9')](_0x452866,function(_0x1651d1,_0x3c540c){if(_0x1651d1){return _0x32cb21(_0x1651d1);}pm2[_0xd9e8('0x7')]();return _0x38b02e(_0x3c540c);});});});};exports[_0xd9e8('0xa')]=function(){return connect()[_0xd9e8('0x6')](function(){return new BPromise(function(_0x1a1505,_0x1e8334){return pm2[_0xd9e8('0xa')](function(_0x588a70,_0x4ec7eb){if(_0x588a70){return _0x1e8334(_0x588a70);}pm2[_0xd9e8('0x7')]();return _0x1a1505(_0x4ec7eb);});});});};exports[_0xd9e8('0xb')]=function(_0x107959){return connect()[_0xd9e8('0x6')](function(){return new BPromise(function(_0x215826,_0x280ca3){return pm2[_0xd9e8('0xb')](_0x107959,function(_0x56328e,_0x322ddc){if(_0x56328e){return _0x280ca3(_0x56328e);}pm2[_0xd9e8('0x7')]();return _0x215826(_0x322ddc);});});});};exports[_0xd9e8('0xc')]=function(_0x42abae){return connect()[_0xd9e8('0x6')](function(){return new BPromise(function(_0x47c797,_0x266755){return pm2[_0xd9e8('0xc')](_0x42abae,function(_0x3297dc,_0x73286b){if(_0x3297dc){return _0x266755(_0x3297dc);}pm2[_0xd9e8('0x7')]();return _0x47c797(_0x73286b);});});});};exports[_0xd9e8('0xd')]=function(){return connect()[_0xd9e8('0x6')](function(){return new BPromise(function(_0x174b19,_0x3ce4a0){return pm2[_0xd9e8('0xd')](function(_0x43a59d){if(_0x43a59d){return _0x3ce4a0(_0x43a59d);}return _0x174b19(_0xd9e8('0xe'));});});});}; \ No newline at end of file +var _0x72e9=['saved','pm2','bluebird','./config','connect','start','then','stop','disconnect','restart','list','describe','delete','dump'];(function(_0x5e33e1,_0x512a38){var _0x274c02=function(_0x538a5b){while(--_0x538a5b){_0x5e33e1['push'](_0x5e33e1['shift']());}};_0x274c02(++_0x512a38);}(_0x72e9,0x7f));var _0x972e=function(_0x2b61c1,_0x2eb2d5){_0x2b61c1=_0x2b61c1-0x0;var _0x54cc6e=_0x72e9[_0x2b61c1];return _0x54cc6e;};'use strict';var pm2=require(_0x972e('0x0'));var BPromise=require(_0x972e('0x1'));var config=require(_0x972e('0x2'));function connect(){return new BPromise(function(_0x1f4654,_0x2e09ec){return pm2[_0x972e('0x3')](function(_0x18bf41){if(_0x18bf41){return _0x2e09ec(_0x18bf41);}return _0x1f4654('connected');});});};exports[_0x972e('0x4')]=function(_0x1cb667){return connect()[_0x972e('0x5')](function(){return new BPromise(function(_0x432a76,_0x109d1e){return pm2[_0x972e('0x4')](_0x1cb667,function(_0x349595,_0x2f251f){if(_0x349595){return _0x109d1e(_0x349595);}pm2['disconnect']();return _0x432a76(_0x2f251f);});});});};exports[_0x972e('0x6')]=function(_0x29124d){return connect()[_0x972e('0x5')](function(){return new BPromise(function(_0x3324f1,_0x81392a){return pm2[_0x972e('0x6')](_0x29124d,function(_0x4600c8,_0x3dd3c6){if(_0x4600c8){return _0x81392a(_0x4600c8);}pm2[_0x972e('0x7')]();return _0x3324f1(_0x3dd3c6);});});});};exports[_0x972e('0x8')]=function(_0x57018a){return connect()[_0x972e('0x5')](function(){return new BPromise(function(_0x564186,_0x4d67c1){return pm2['restart'](_0x57018a,function(_0x5e97f2,_0x36342b){if(_0x5e97f2){return _0x4d67c1(_0x5e97f2);}pm2[_0x972e('0x7')]();return _0x564186(_0x36342b);});});});};exports['list']=function(){return connect()['then'](function(){return new BPromise(function(_0x4838a7,_0x42eac5){return pm2[_0x972e('0x9')](function(_0x215bf5,_0x42b887){if(_0x215bf5){return _0x42eac5(_0x215bf5);}pm2[_0x972e('0x7')]();return _0x4838a7(_0x42b887);});});});};exports[_0x972e('0xa')]=function(_0x317f58){return connect()[_0x972e('0x5')](function(){return new BPromise(function(_0x75110f,_0x113932){return pm2[_0x972e('0xa')](_0x317f58,function(_0x3a9b52,_0x46508e){if(_0x3a9b52){return _0x113932(_0x3a9b52);}pm2['disconnect']();return _0x75110f(_0x46508e);});});});};exports[_0x972e('0xb')]=function(_0x15362c){return connect()[_0x972e('0x5')](function(){return new BPromise(function(_0xb074a1,_0x1029b6){return pm2[_0x972e('0xb')](_0x15362c,function(_0x3bb6c5,_0x1035a7){if(_0x3bb6c5){return _0x1029b6(_0x3bb6c5);}pm2['disconnect']();return _0xb074a1(_0x1035a7);});});});};exports[_0x972e('0xc')]=function(){return connect()[_0x972e('0x5')](function(){return new BPromise(function(_0x2131ed,_0x19327e){return pm2[_0x972e('0xc')](function(_0x37d307){if(_0x37d307){return _0x19327e(_0x37d307);}return _0x2131ed(_0x972e('0xd'));});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index 52aa749..d2728a2 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 _0x5996=['emit','catch','error','start','moment','ioredis','util','../../config/environment','../logger','redis','defaults','socket.io-emitter','find','chatTimeout','ChatInteraction','findAll','lastMsgAt','subtract','minutes','length','map','info','[CHAT]\x20Interactions\x20to\x20close:','join','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','then','[CHAT]\x20Sending\x20updates\x20for\x20interactions:'];(function(_0x2c86e0,_0x5a3dac){var _0x10aa30=function(_0x203482){while(--_0x203482){_0x2c86e0['push'](_0x2c86e0['shift']());}};_0x10aa30(++_0x5a3dac);}(_0x5996,0x1e4));var _0x6599=function(_0x6f17e2,_0x234774){_0x6f17e2=_0x6f17e2-0x0;var _0x1b1bb0=_0x5996[_0x6f17e2];return _0x1b1bb0;};'use strict';var _=require('lodash');var moment=require(_0x6599('0x0'));var Redis=require(_0x6599('0x1'));var util=require(_0x6599('0x2'));var config=require(_0x6599('0x3'));var db=require('../../mysqldb')['db'];var logger=require(_0x6599('0x4'))('schedule');config[_0x6599('0x5')]=_[_0x6599('0x6')](config[_0x6599('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0x6599('0x7'))(new Redis(config[_0x6599('0x5')]));function closeInteractions(){var _0x4c7be8=0x0;var _0x3573de=[];return db['Setting'][_0x6599('0x8')]({'raw':!![],'attributes':['id',_0x6599('0x9')],'where':{'id':0x1}})['then'](function(_0x3f6a9f){_0x4c7be8=_0x3f6a9f[_0x6599('0x9')];if(_0x4c7be8){return db[_0x6599('0xa')][_0x6599('0xb')]({'raw':!![],'attributes':['id',_0x6599('0xc')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x6599('0xd')](_0x3f6a9f[_0x6599('0x9')],_0x6599('0xe'))}}});}else{return[];}})['then'](function(_0x41af23){if(_0x41af23&&_0x41af23[_0x6599('0xf')]){_0x3573de=_[_0x6599('0x10')](_0x41af23||[],'id');logger[_0x6599('0x11')](_0x6599('0x12'),_0x3573de[_0x6599('0x13')]());return db[_0x6599('0xa')]['update']({'closeReason':_0x6599('0x14'),'disposition':_0x6599('0x15'),'closed':!![],'closedAt':moment()[_0x6599('0x16')](_0x6599('0x17'))},{'where':{'id':_0x3573de}});}})[_0x6599('0x18')](function(){if(_0x3573de&&_0x3573de[_0x6599('0xf')]){logger['info'](_0x6599('0x19'),_0x3573de['join']());for(var _0x12bc5c=0x0;_0x12bc5c<_0x3573de[_0x6599('0xf')];_0x12bc5c++){io[_0x6599('0x1a')]('chatInteraction:update',{'id':_0x3573de[_0x12bc5c],'closed':!![]});}}})[_0x6599('0x1b')](function(_0x572084){logger[_0x6599('0x1c')]('[CHAT]\x20Error\x20closing\x20interactions',_0x572084?util['inspect'](_0x572084,{'showHidden':![],'depth':null}):'');});}exports[_0x6599('0x1d')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0xb824=['Setting','find','chatTimeout','then','ChatInteraction','findAll','lastMsgAt','subtract','minutes','length','map','info','[CHAT]\x20Interactions\x20to\x20close:','join','update','format','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','emit','catch','error','[CHAT]\x20Error\x20closing\x20interactions','inspect','start','moment','ioredis','util','../../config/environment','../../mysqldb','../logger','schedule','redis','localhost','socket.io-emitter'];(function(_0x578509,_0x135233){var _0x1221d2=function(_0x580bdf){while(--_0x580bdf){_0x578509['push'](_0x578509['shift']());}};_0x1221d2(++_0x135233);}(_0xb824,0xfe));var _0x4b82=function(_0xb1df72,_0x28df22){_0xb1df72=_0xb1df72-0x0;var _0x4b74ea=_0xb824[_0xb1df72];return _0x4b74ea;};'use strict';var _=require('lodash');var moment=require(_0x4b82('0x0'));var Redis=require(_0x4b82('0x1'));var util=require(_0x4b82('0x2'));var config=require(_0x4b82('0x3'));var db=require(_0x4b82('0x4'))['db'];var logger=require(_0x4b82('0x5'))(_0x4b82('0x6'));config[_0x4b82('0x7')]=_['defaults'](config['redis'],{'host':_0x4b82('0x8'),'port':0x18eb});var io=require(_0x4b82('0x9'))(new Redis(config[_0x4b82('0x7')]));function closeInteractions(){var _0x340ac0=0x0;var _0x35fb36=[];return db[_0x4b82('0xa')][_0x4b82('0xb')]({'raw':!![],'attributes':['id',_0x4b82('0xc')],'where':{'id':0x1}})[_0x4b82('0xd')](function(_0x8ba162){_0x340ac0=_0x8ba162[_0x4b82('0xc')];if(_0x340ac0){return db[_0x4b82('0xe')][_0x4b82('0xf')]({'raw':!![],'attributes':['id',_0x4b82('0x10')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x4b82('0x11')](_0x8ba162['chatTimeout'],_0x4b82('0x12'))}}});}else{return[];}})[_0x4b82('0xd')](function(_0x285791){if(_0x285791&&_0x285791[_0x4b82('0x13')]){_0x35fb36=_[_0x4b82('0x14')](_0x285791||[],'id');logger[_0x4b82('0x15')](_0x4b82('0x16'),_0x35fb36[_0x4b82('0x17')]());return db[_0x4b82('0xe')][_0x4b82('0x18')]({'closeReason':'system','disposition':'timeout','closed':!![],'closedAt':moment()[_0x4b82('0x19')]('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_0x35fb36}});}})['then'](function(){if(_0x35fb36&&_0x35fb36[_0x4b82('0x13')]){logger[_0x4b82('0x15')](_0x4b82('0x1a'),_0x35fb36[_0x4b82('0x17')]());for(var _0x5b5a18=0x0;_0x5b5a18<_0x35fb36['length'];_0x5b5a18++){io[_0x4b82('0x1b')]('chatInteraction:update',{'id':_0x35fb36[_0x5b5a18],'closed':!![]});}}})[_0x4b82('0x1c')](function(_0xaf8c1b){logger[_0x4b82('0x1d')](_0x4b82('0x1e'),_0xaf8c1b?util[_0x4b82('0x1f')](_0xaf8c1b,{'showHidden':![],'depth':null}):'');});}exports[_0x4b82('0x20')]=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 9f1bc11..1dd07e4 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. * // * * // ************************************************************************* -'use strict';function start(){var _0x343c49=require('../../api/cloudProvider/cloudProvider.oauth.js');return _0x343c49['startAllRefreshIntervals']();}module['exports']={'intervals':{},'start':start}; \ No newline at end of file +var _0xddcc=['../../api/cloudProvider/cloudProvider.oauth.js','exports'];(function(_0x32f7d7,_0x54231b){var _0x133d09=function(_0x41a7ab){while(--_0x41a7ab){_0x32f7d7['push'](_0x32f7d7['shift']());}};_0x133d09(++_0x54231b);}(_0xddcc,0xe2));var _0xcddc=function(_0x4cd1ed,_0x9ab689){_0x4cd1ed=_0x4cd1ed-0x0;var _0xf17a22=_0xddcc[_0x4cd1ed];return _0xf17a22;};'use strict';function start(){var _0x57225b=require(_0xcddc('0x0'));return _0x57225b['startAllRefreshIntervals']();}module[_0xcddc('0x1')]={'intervals':{},'start':start}; \ No newline at end of file diff --git a/server/config/schedule/index.js b/server/config/schedule/index.js index 1a76109..9d32815 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 _0x47a6=['%s.%s','basename','existsSync','status','Sent','message','attachments','text','stringify','sendIfEmpty','info','empty\x20file,\x20email\x20not\x20sent','request','error','error\x20mail','email\x20sent','catch','data','subtractUnit\x20null\x20or\x20undefined','subtract','scheduled','output','DefaultReportId','exec\x20defaul\x20report\x20id:%s','runReport','isNil','exec\x20custom\x20report\x20id:%s','CustomReportId','then','no\x20report\x20id','Schedule','findAll','CloudProvider','keys','jobs','map','toString','difference','exists','stop','delete\x20cron','length','my\x20id','cron','active','isBetween','startAt','endAt','add','start','add\x20cron','deleteJob','stop\x20cron','update\x20cron','run','util','path','moment','jayson/promise','bluebird','schedule','../../mysqldb','client','Try\x20to\x20send\x20a\x20mail\x20to','email','MailAccount','format','\x22%s\x22\x20<%s>','Smtp','user','bcc','name','subtractNumber','subtractUnit','join','../../files/reports','savename'];(function(_0x5c18ef,_0xa2e81d){var _0x33789d=function(_0x5761a9){while(--_0x5761a9){_0x5c18ef['push'](_0x5c18ef['shift']());}};_0x33789d(++_0xa2e81d);}(_0x47a6,0x84));var _0x647a=function(_0x163c1c,_0x4737e6){_0x163c1c=_0x163c1c-0x0;var _0x354bb1=_0x47a6[_0x163c1c];return _0x354bb1;};'use strict';var fs=require('fs');var util=require(_0x647a('0x0'));var path=require(_0x647a('0x1'));var _=require('lodash');var moment=require(_0x647a('0x2'));var CronJobManager=require('cron-job-manager');var jayson=require(_0x647a('0x3'));var BPromise=require(_0x647a('0x4'));var logger=require('../logger')(_0x647a('0x5'));var db=require(_0x647a('0x6'))['db'];var analyticCustomReportController=require('../../api/analyticCustomReport/analyticCustomReport.controller');var analyticDefaultReportController=require('../../api/analyticDefaultReport/analyticDefaultReport.controller');var client=jayson[_0x647a('0x7')]['http']({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x418661,_0x25ecac){return function(){logger['info'](_0x647a('0x8'),_0x418661[_0x647a('0x9')]);var _0x26d3d1=!![];var _0x4a870b=_0x418661[_0x647a('0xa')]['getSmtpOptions']();var _0x5e1674={'account':_0x4a870b,'message':{'from':util[_0x647a('0xb')](_0x647a('0xc'),_0x418661[_0x647a('0xa')]['name'],_0x418661['MailAccount'][_0x647a('0x9')]||_0x418661[_0x647a('0xa')][_0x647a('0xd')][_0x647a('0xe')]),'to':_0x418661[_0x647a('0x9')],'cc':_0x418661['cc'],'bcc':_0x418661[_0x647a('0xf')],'subject':util['format']('Report\x20%s\x20last\x20%s\x20%s',_0x25ecac[_0x647a('0x10')],_0x418661[_0x647a('0x11')],_0x418661[_0x647a('0x12')])}};var _0x3f7e9a=path[_0x647a('0x13')](__dirname,_0x647a('0x14'));var _0x45fd71=_0x25ecac[_0x647a('0x15')];var _0x4b944a=util[_0x647a('0xb')](_0x647a('0x16'),path[_0x647a('0x17')](_0x25ecac[_0x647a('0x15')],path['extname'](_0x25ecac['savename'])),'zip');var _0x3d1902=path[_0x647a('0x13')](_0x3f7e9a,_0x45fd71);var _0x1b617f=path[_0x647a('0x13')](_0x3f7e9a,_0x4b944a);if(fs[_0x647a('0x18')](_0x3d1902)){_0x25ecac[_0x647a('0x19')]=_0x647a('0x1a');_0x5e1674[_0x647a('0x1b')][_0x647a('0x1c')]=[{'filename':_0x45fd71,'path':_0x3d1902}];_0x5e1674[_0x647a('0x1b')][_0x647a('0x1d')]=util[_0x647a('0xb')]('Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a',JSON[_0x647a('0x1e')](_0x25ecac,null,0x2));}else if(fs[_0x647a('0x18')](_0x1b617f)){_0x25ecac[_0x647a('0x19')]=_0x647a('0x1a');_0x5e1674['message']['attachments']=[{'filename':_0x4b944a,'path':_0x1b617f}];}else{_0x5e1674[_0x647a('0x1b')][_0x647a('0x1d')]='Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a';if(!_0x418661[_0x647a('0x1f')]){_0x26d3d1=![];logger[_0x647a('0x20')](_0x647a('0x21'));}}if(_0x26d3d1){return client[_0x647a('0x22')]('SendMail',_0x5e1674)['then'](function(_0xfb0662){if(_0xfb0662[_0x647a('0x23')]){return logger[_0x647a('0x23')](_0x647a('0x24'),JSON['stringify'](_0xfb0662));}return logger[_0x647a('0x20')](_0x647a('0x25'));})[_0x647a('0x26')](function(_0x1d063f){return logger['error']('error\x20mail',JSON[_0x647a('0x1e')](_0x1d063f));});}};}function handleError(){return function(_0x5f20b2){return logger[_0x647a('0x23')](JSON['stringify'](_0x5f20b2));};}function handleResult(_0x2ec975){return function(_0x16c1db){logger[_0x647a('0x20')](_0x647a('0x27'),JSON['stringify'](_0x16c1db));if(_0x2ec975[_0x647a('0xa')]&&_0x2ec975[_0x647a('0xa')][_0x647a('0xd')]&&!_['isNil'](_0x2ec975[_0x647a('0x9')])){setTimeout(handleSendEmail(_0x2ec975,_0x16c1db),0x3c*0x3e8);}};}function handleJob(_0x5f2a01){return function(){try{if(_['isNil'](_0x5f2a01[_0x647a('0x11')])){return logger[_0x647a('0x20')]('subtractNumber\x20null\x20or\x20undefined');}if(_['isNil'](_0x5f2a01['subtractUnit'])){return logger[_0x647a('0x20')](_0x647a('0x28'));}var _0xdc4cde={'startDate':moment()[_0x647a('0x29')](_0x5f2a01[_0x647a('0x11')],_0x5f2a01[_0x647a('0x12')])[_0x647a('0xb')]('YYYY-MM-DD\x20HH:mm:ss'),'endDate':moment()[_0x647a('0xb')]('YYYY-MM-DD\x20HH:mm:ss'),'type':_0x647a('0x2a'),'output':_0x5f2a01[_0x647a('0x2b')],'name':_0x5f2a01[_0x647a('0x10')]};if(!_['isNil'](_0x5f2a01[_0x647a('0x2c')])){logger[_0x647a('0x20')](_0x647a('0x2d'),_0x5f2a01[_0x647a('0x2c')]);return analyticDefaultReportController[_0x647a('0x2e')]({'id':_0x5f2a01['DefaultReportId']},_0xdc4cde)['then'](handleResult(_0x5f2a01))[_0x647a('0x26')](handleError());}if(!_[_0x647a('0x2f')](_0x5f2a01['CustomReportId'])){logger[_0x647a('0x20')](_0x647a('0x30'),_0x5f2a01['CustomReportId']);return analyticCustomReportController[_0x647a('0x2e')]({'id':_0x5f2a01[_0x647a('0x31')]},_0xdc4cde)[_0x647a('0x32')](handleResult(_0x5f2a01))['catch'](handleError());}}catch(_0x56857b){logger[_0x647a('0x23')](JSON['stringify'](_0x56857b));}return logger[_0x647a('0x20')](_0x647a('0x33'));};}function getJobs(_0x3e63b2){var _0x282cc1={};if(_0x3e63b2){_0x282cc1['id']=_0x3e63b2;}return db[_0x647a('0x34')][_0x647a('0x35')]({'where':_0x282cc1,'include':[{'model':db[_0x647a('0xa')],'attributes':['id',_0x647a('0x10'),_0x647a('0x9')],'include':[{'model':db['MailServerOut'],'as':_0x647a('0xd'),'include':[{'model':db[_0x647a('0x36')],'as':_0x647a('0x36')}]}]}]})[_0x647a('0x32')](function(_0x476ed7){var _0x5907e1=_[_0x647a('0x37')](manager[_0x647a('0x38')]);var _0x3d349b=_[_0x647a('0x39')](_0x476ed7,function(_0x37c68d){return _0x37c68d['id'][_0x647a('0x3a')]();});var _0x28f221=_['keyBy'](_0x476ed7,function(_0x4a9e4f){return _0x4a9e4f['id'][_0x647a('0x3a')]();});var _0x4e3b32=_0x3e63b2?_0x3d349b:_[_0x647a('0x3b')](_0x3d349b,_0x5907e1);var _0xb8e372=_['intersection'](_0x3d349b,_0x5907e1);var _0x59d0b1=_[_0x647a('0x3b')](_0x5907e1,_0x3d349b);var _0xaa148b;var _0x10f299;for(_0xaa148b=0x0;_0xaa148b<_0x59d0b1['length']&&!_0x3e63b2;_0xaa148b+=0x1){_0x10f299=_0x59d0b1[_0xaa148b][_0x647a('0x3a')]();if(manager[_0x647a('0x3c')](_0x10f299)){manager[_0x647a('0x3d')](_0x10f299);manager['deleteJob'](_0x10f299);logger['info'](_0x647a('0x3e'),_0x10f299);}}logger[_0x647a('0x20')]('toRun',JSON[_0x647a('0x1e')](_0x4e3b32));for(_0xaa148b=0x0;_0xaa148b<_0x4e3b32[_0x647a('0x3f')];_0xaa148b+=0x1){_0x10f299=_0x4e3b32[_0xaa148b]['toString']();logger[_0x647a('0x20')]('index',_0x10f299);if(_0x3e63b2){logger[_0x647a('0x20')](_0x647a('0x40'),_0x3e63b2);logger[_0x647a('0x20')](JSON[_0x647a('0x1e')](_0x28f221[_0x10f299]));BPromise['resolve']()[_0x647a('0x32')](handleJob(_0x28f221[_0x10f299]));logger[_0x647a('0x20')]('run\x20job',_0x28f221[_0x10f299]['name'],_0x28f221[_0x10f299][_0x647a('0x41')]);}else if(_0x28f221[_0x10f299]['cron']&&_0x28f221[_0x10f299][_0x647a('0x42')]&&moment()[_0x647a('0x43')](_0x28f221[_0x10f299][_0x647a('0x44')],_0x28f221[_0x10f299][_0x647a('0x45')])){manager[_0x647a('0x46')](_0x10f299,_0x28f221[_0x10f299]['cron'],handleJob(_0x28f221[_0x10f299]));manager[_0x647a('0x47')](_0x10f299);logger[_0x647a('0x20')](_0x647a('0x48'),_0x28f221[_0x10f299][_0x647a('0x10')],_0x28f221[_0x10f299][_0x647a('0x41')]);}else if(manager[_0x647a('0x3c')](_0x10f299)){manager['stop'](_0x10f299);manager[_0x647a('0x49')](_0x10f299);logger[_0x647a('0x20')](_0x647a('0x4a'),_0x28f221[_0x10f299][_0x647a('0x10')],_0x28f221[_0x10f299][_0x647a('0x41')]);}}for(_0xaa148b=0x0,_0x10f299;_0xaa148b<_0xb8e372['length']&&!_0x3e63b2;_0xaa148b+=0x1){_0x10f299=_0xb8e372[_0xaa148b][_0x647a('0x3a')]();if(manager['exists'](_0x10f299)){if(_0x28f221[_0x10f299][_0x647a('0x41')]&&_0x28f221[_0x10f299][_0x647a('0x42')]&&moment()[_0x647a('0x43')](_0x28f221[_0x10f299][_0x647a('0x44')],_0x28f221[_0x10f299][_0x647a('0x45')])){manager['update'](_0x10f299,_0x28f221[_0x10f299][_0x647a('0x41')],handleJob(_0x28f221[_0x10f299]));logger['info'](_0x647a('0x4b'),_0x28f221[_0x10f299][_0x647a('0x10')],_0x28f221[_0x10f299][_0x647a('0x41')]);}else{manager[_0x647a('0x3d')](_0x10f299);manager[_0x647a('0x49')](_0x10f299);logger['info'](_0x647a('0x4a'),_0x28f221[_0x10f299][_0x647a('0x10')],_0x28f221[_0x10f299][_0x647a('0x41')]);}}}})[_0x647a('0x26')](function(_0x479f51){logger['error'](JSON['stringify'](_0x479f51));});}exports[_0x647a('0x4c')]=function(_0xc2cd0e){return getJobs(_0xc2cd0e);};exports['start']=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0x24a3=['getSmtpOptions','\x22%s\x22\x20<%s>','name','email','user','bcc','format','subtractNumber','subtractUnit','join','../../files/reports','basename','savename','extname','zip','existsSync','status','Sent','message','attachments','text','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','stringify','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','empty\x20file,\x20email\x20not\x20sent','request','SendMail','then','error','error\x20mail','email\x20sent','catch','isNil','subtractNumber\x20null\x20or\x20undefined','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','DefaultReportId','CustomReportId','runReport','no\x20report\x20id','Schedule','findAll','MailServerOut','CloudProvider','jobs','map','toString','keyBy','difference','exists','stop','deleteJob','delete\x20cron','length','resolve','run\x20job','cron','isBetween','startAt','endAt','add','start','stop\x20cron','active','update','util','path','lodash','moment','cron-job-manager','jayson/promise','bluebird','../logger','schedule','../../mysqldb','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','http','info','Try\x20to\x20send\x20a\x20mail\x20to','MailAccount'];(function(_0x8854f2,_0x79542c){var _0x38505d=function(_0x5af02b){while(--_0x5af02b){_0x8854f2['push'](_0x8854f2['shift']());}};_0x38505d(++_0x79542c);}(_0x24a3,0x96));var _0x324a=function(_0x39e407,_0x5c81fe){_0x39e407=_0x39e407-0x0;var _0xb638a5=_0x24a3[_0x39e407];return _0xb638a5;};'use strict';var fs=require('fs');var util=require(_0x324a('0x0'));var path=require(_0x324a('0x1'));var _=require(_0x324a('0x2'));var moment=require(_0x324a('0x3'));var CronJobManager=require(_0x324a('0x4'));var jayson=require(_0x324a('0x5'));var BPromise=require(_0x324a('0x6'));var logger=require(_0x324a('0x7'))(_0x324a('0x8'));var db=require(_0x324a('0x9'))['db'];var analyticCustomReportController=require('../../api/analyticCustomReport/analyticCustomReport.controller');var analyticDefaultReportController=require(_0x324a('0xa'));var client=jayson[_0x324a('0xb')][_0x324a('0xc')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x28a88d,_0x52a047){return function(){logger[_0x324a('0xd')](_0x324a('0xe'),_0x28a88d['email']);var _0x44c14a=!![];var _0x4714d0=_0x28a88d[_0x324a('0xf')][_0x324a('0x10')]();var _0x47f3ec={'account':_0x4714d0,'message':{'from':util['format'](_0x324a('0x11'),_0x28a88d[_0x324a('0xf')][_0x324a('0x12')],_0x28a88d['MailAccount'][_0x324a('0x13')]||_0x28a88d[_0x324a('0xf')]['Smtp'][_0x324a('0x14')]),'to':_0x28a88d[_0x324a('0x13')],'cc':_0x28a88d['cc'],'bcc':_0x28a88d[_0x324a('0x15')],'subject':util[_0x324a('0x16')]('Report\x20%s\x20last\x20%s\x20%s',_0x52a047[_0x324a('0x12')],_0x28a88d[_0x324a('0x17')],_0x28a88d[_0x324a('0x18')])}};var _0x226763=path[_0x324a('0x19')](__dirname,_0x324a('0x1a'));var _0x3649c2=_0x52a047['savename'];var _0x4bd352=util[_0x324a('0x16')]('%s.%s',path[_0x324a('0x1b')](_0x52a047[_0x324a('0x1c')],path[_0x324a('0x1d')](_0x52a047[_0x324a('0x1c')])),_0x324a('0x1e'));var _0x3d62c1=path[_0x324a('0x19')](_0x226763,_0x3649c2);var _0x184a2f=path[_0x324a('0x19')](_0x226763,_0x4bd352);if(fs[_0x324a('0x1f')](_0x3d62c1)){_0x52a047[_0x324a('0x20')]=_0x324a('0x21');_0x47f3ec[_0x324a('0x22')][_0x324a('0x23')]=[{'filename':_0x3649c2,'path':_0x3d62c1}];_0x47f3ec[_0x324a('0x22')][_0x324a('0x24')]=util[_0x324a('0x16')](_0x324a('0x25'),JSON[_0x324a('0x26')](_0x52a047,null,0x2));}else if(fs['existsSync'](_0x184a2f)){_0x52a047[_0x324a('0x20')]='Sent';_0x47f3ec[_0x324a('0x22')][_0x324a('0x23')]=[{'filename':_0x4bd352,'path':_0x184a2f}];}else{_0x47f3ec[_0x324a('0x22')][_0x324a('0x24')]=_0x324a('0x27');if(!_0x28a88d['sendIfEmpty']){_0x44c14a=![];logger[_0x324a('0xd')](_0x324a('0x28'));}}if(_0x44c14a){return client[_0x324a('0x29')](_0x324a('0x2a'),_0x47f3ec)[_0x324a('0x2b')](function(_0x3150a7){if(_0x3150a7[_0x324a('0x2c')]){return logger[_0x324a('0x2c')](_0x324a('0x2d'),JSON[_0x324a('0x26')](_0x3150a7));}return logger[_0x324a('0xd')](_0x324a('0x2e'));})[_0x324a('0x2f')](function(_0x5a0d27){return logger[_0x324a('0x2c')](_0x324a('0x2d'),JSON[_0x324a('0x26')](_0x5a0d27));});}};}function handleError(){return function(_0x5e28e3){return logger[_0x324a('0x2c')](JSON[_0x324a('0x26')](_0x5e28e3));};}function handleResult(_0x780155){return function(_0x44f4c3){logger[_0x324a('0xd')]('data',JSON[_0x324a('0x26')](_0x44f4c3));if(_0x780155[_0x324a('0xf')]&&_0x780155[_0x324a('0xf')]['Smtp']&&!_[_0x324a('0x30')](_0x780155[_0x324a('0x13')])){setTimeout(handleSendEmail(_0x780155,_0x44f4c3),0x3c*0x3e8);}};}function handleJob(_0x46d9e2){return function(){try{if(_[_0x324a('0x30')](_0x46d9e2[_0x324a('0x17')])){return logger[_0x324a('0xd')](_0x324a('0x31'));}if(_['isNil'](_0x46d9e2[_0x324a('0x18')])){return logger[_0x324a('0xd')](_0x324a('0x32'));}var _0x2bf688={'startDate':moment()[_0x324a('0x33')](_0x46d9e2[_0x324a('0x17')],_0x46d9e2[_0x324a('0x18')])[_0x324a('0x16')](_0x324a('0x34')),'endDate':moment()[_0x324a('0x16')]('YYYY-MM-DD\x20HH:mm:ss'),'type':_0x324a('0x35'),'output':_0x46d9e2['output'],'name':_0x46d9e2[_0x324a('0x12')]};if(!_[_0x324a('0x30')](_0x46d9e2[_0x324a('0x36')])){logger[_0x324a('0xd')]('exec\x20defaul\x20report\x20id:%s',_0x46d9e2['DefaultReportId']);return analyticDefaultReportController['runReport']({'id':_0x46d9e2[_0x324a('0x36')]},_0x2bf688)[_0x324a('0x2b')](handleResult(_0x46d9e2))['catch'](handleError());}if(!_[_0x324a('0x30')](_0x46d9e2[_0x324a('0x37')])){logger[_0x324a('0xd')]('exec\x20custom\x20report\x20id:%s',_0x46d9e2[_0x324a('0x37')]);return analyticCustomReportController[_0x324a('0x38')]({'id':_0x46d9e2['CustomReportId']},_0x2bf688)[_0x324a('0x2b')](handleResult(_0x46d9e2))['catch'](handleError());}}catch(_0x374c29){logger[_0x324a('0x2c')](JSON['stringify'](_0x374c29));}return logger[_0x324a('0xd')](_0x324a('0x39'));};}function getJobs(_0x1402b2){var _0x1064a0={};if(_0x1402b2){_0x1064a0['id']=_0x1402b2;}return db[_0x324a('0x3a')][_0x324a('0x3b')]({'where':_0x1064a0,'include':[{'model':db[_0x324a('0xf')],'attributes':['id','name',_0x324a('0x13')],'include':[{'model':db[_0x324a('0x3c')],'as':'Smtp','include':[{'model':db['CloudProvider'],'as':_0x324a('0x3d')}]}]}]})[_0x324a('0x2b')](function(_0x1ca14c){var _0x5c4dd0=_['keys'](manager[_0x324a('0x3e')]);var _0x135c9d=_[_0x324a('0x3f')](_0x1ca14c,function(_0x31ba27){return _0x31ba27['id'][_0x324a('0x40')]();});var _0xc44388=_[_0x324a('0x41')](_0x1ca14c,function(_0x293ec6){return _0x293ec6['id'][_0x324a('0x40')]();});var _0xbbacb=_0x1402b2?_0x135c9d:_[_0x324a('0x42')](_0x135c9d,_0x5c4dd0);var _0x6baca7=_['intersection'](_0x135c9d,_0x5c4dd0);var _0x1c0605=_[_0x324a('0x42')](_0x5c4dd0,_0x135c9d);var _0x5819fa;var _0x10547f;for(_0x5819fa=0x0;_0x5819fa<_0x1c0605['length']&&!_0x1402b2;_0x5819fa+=0x1){_0x10547f=_0x1c0605[_0x5819fa][_0x324a('0x40')]();if(manager[_0x324a('0x43')](_0x10547f)){manager[_0x324a('0x44')](_0x10547f);manager[_0x324a('0x45')](_0x10547f);logger[_0x324a('0xd')](_0x324a('0x46'),_0x10547f);}}logger['info']('toRun',JSON['stringify'](_0xbbacb));for(_0x5819fa=0x0;_0x5819fa<_0xbbacb[_0x324a('0x47')];_0x5819fa+=0x1){_0x10547f=_0xbbacb[_0x5819fa][_0x324a('0x40')]();logger[_0x324a('0xd')]('index',_0x10547f);if(_0x1402b2){logger['info']('my\x20id',_0x1402b2);logger[_0x324a('0xd')](JSON[_0x324a('0x26')](_0xc44388[_0x10547f]));BPromise[_0x324a('0x48')]()[_0x324a('0x2b')](handleJob(_0xc44388[_0x10547f]));logger[_0x324a('0xd')](_0x324a('0x49'),_0xc44388[_0x10547f]['name'],_0xc44388[_0x10547f][_0x324a('0x4a')]);}else if(_0xc44388[_0x10547f][_0x324a('0x4a')]&&_0xc44388[_0x10547f]['active']&&moment()[_0x324a('0x4b')](_0xc44388[_0x10547f][_0x324a('0x4c')],_0xc44388[_0x10547f][_0x324a('0x4d')])){manager[_0x324a('0x4e')](_0x10547f,_0xc44388[_0x10547f][_0x324a('0x4a')],handleJob(_0xc44388[_0x10547f]));manager[_0x324a('0x4f')](_0x10547f);logger[_0x324a('0xd')]('add\x20cron',_0xc44388[_0x10547f][_0x324a('0x12')],_0xc44388[_0x10547f][_0x324a('0x4a')]);}else if(manager[_0x324a('0x43')](_0x10547f)){manager[_0x324a('0x44')](_0x10547f);manager[_0x324a('0x45')](_0x10547f);logger['info'](_0x324a('0x50'),_0xc44388[_0x10547f][_0x324a('0x12')],_0xc44388[_0x10547f]['cron']);}}for(_0x5819fa=0x0,_0x10547f;_0x5819fa<_0x6baca7[_0x324a('0x47')]&&!_0x1402b2;_0x5819fa+=0x1){_0x10547f=_0x6baca7[_0x5819fa][_0x324a('0x40')]();if(manager['exists'](_0x10547f)){if(_0xc44388[_0x10547f][_0x324a('0x4a')]&&_0xc44388[_0x10547f][_0x324a('0x51')]&&moment()[_0x324a('0x4b')](_0xc44388[_0x10547f][_0x324a('0x4c')],_0xc44388[_0x10547f]['endAt'])){manager[_0x324a('0x52')](_0x10547f,_0xc44388[_0x10547f][_0x324a('0x4a')],handleJob(_0xc44388[_0x10547f]));logger[_0x324a('0xd')]('update\x20cron',_0xc44388[_0x10547f][_0x324a('0x12')],_0xc44388[_0x10547f][_0x324a('0x4a')]);}else{manager['stop'](_0x10547f);manager['deleteJob'](_0x10547f);logger['info'](_0x324a('0x50'),_0xc44388[_0x10547f][_0x324a('0x12')],_0xc44388[_0x10547f][_0x324a('0x4a')]);}}}})[_0x324a('0x2f')](function(_0x2a9753){logger[_0x324a('0x2c')](JSON[_0x324a('0x26')](_0x2a9753));});}exports['run']=function(_0x58b1f6){return getJobs(_0x58b1f6);};exports[_0x324a('0x4f')]=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 9e44985..3d8b2f9 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 _0x3c2c=['push','all','lodash','aws-sdk','request-promise','util','../../config/logger','transcribe','TranscribeService','Comprehend','substring','format','transcribeName','data2','transcribeRegion','then','info','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','TranscriptionJobStatus','COMPLETED','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','fileText','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','Sequelize','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentAccountId','sentimentRegion','language','bucket','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','CloudProvider','Cloud\x20Provider\x20not\x20available','Cloud\x20Provider\x20not\x20configured','data1','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','update','Sentiment','SentimentScore','Negative','Mixed','Neutral','FAILED','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','tempSentiment','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','Positive','catch','name','SequelizeValidationError','error','inspect','VoiceRecording','findAll','IN_PROGRESS','Setting','Settings\x20not\x20available','transcribeAccountId','findOne','forEach'];(function(_0x1e16b5,_0x83e227){var _0x719844=function(_0x435b01){while(--_0x435b01){_0x1e16b5['push'](_0x1e16b5['shift']());}};_0x719844(++_0x83e227);}(_0x3c2c,0x160));var _0xc3c2=function(_0x1cea01,_0x271a69){_0x1cea01=_0x1cea01-0x0;var _0x51dd7d=_0x3c2c[_0x1cea01];return _0x51dd7d;};var _=require(_0xc3c2('0x0'));var AWS=require(_0xc3c2('0x1'));var rp=require(_0xc3c2('0x2'));var util=require(_0xc3c2('0x3'));var BPromise=require('bluebird');var db=require('../../mysqldb')['db'];var logger=require(_0xc3c2('0x4'))(_0xc3c2('0x5'));function getTranscriptionJob(_0x2f4e7e,_0x3bb44f,_0x50d730,_0x312ebf){return new Promise(function(_0x158a5f,_0x234da9){var _0x21fa50=new AWS[(_0xc3c2('0x6'))]({'accessKeyId':_0x3bb44f,'secretAccessKey':_0x2f4e7e,'region':_0x50d730});_0x21fa50['getTranscriptionJob']({'TranscriptionJobName':_0x312ebf},function(_0x5daa76,_0x55840b){if(_0x5daa76){return _0x234da9(_0x5daa76);}else{return _0x158a5f(_0x55840b);}});});}function sentiment(_0x1ecb0c,_0x3c249d,_0x5bf3d4,_0x2ef4d1,_0x5c60cc){return new Promise(function(_0x5b81e6,_0x1c5e1c){var _0x15477c=new AWS[(_0xc3c2('0x7'))]({'accessKeyId':_0x3c249d,'secretAccessKey':_0x1ecb0c,'region':_0x5bf3d4});_0x15477c['detectSentiment']({'Text':_0x2ef4d1,'LanguageCode':_0x5c60cc[_0xc3c2('0x8')](0x0,0x2)},function(_0x3ed3ab,_0x124560){if(_0x3ed3ab){return _0x1c5e1c(_0x3ed3ab);}else{return _0x5b81e6(_0x124560);}});});}function checkTranscribeJob(_0x28b548,_0x578ac4,_0x3920e7){var _0x1befad;return new BPromise(function(_0x515bbc,_0x17df20){logger['info'](util[_0xc3c2('0x9')]('[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)',_0x28b548['id'],_0x28b548[_0xc3c2('0xa')]));return getTranscriptionJob(_0x3920e7['data1'],_0x3920e7[_0xc3c2('0xb')],_0x578ac4[_0xc3c2('0xc')],_0x28b548['transcribeName'])[_0xc3c2('0xd')](function(_0x36f10f){logger[_0xc3c2('0xe')](util[_0xc3c2('0x9')](_0xc3c2('0xf'),_0x28b548['id'],_0x28b548[_0xc3c2('0xa')],_0x36f10f['TranscriptionJob']['TranscriptionJobStatus']));if(!_0x28b548['fileText']){switch(_0x36f10f[_0xc3c2('0x10')][_0xc3c2('0x11')]){case _0xc3c2('0x12'):var _0x164a52={'transcribeStatus':_0x36f10f[_0xc3c2('0x10')]['TranscriptionJobStatus'],'fileUri':_0x36f10f['TranscriptionJob'][_0xc3c2('0x13')][_0xc3c2('0x14')]};logger[_0xc3c2('0xe')](util['format'](_0xc3c2('0x15'),_0x28b548['id']));return rp({'uri':_0x36f10f['TranscriptionJob'][_0xc3c2('0x13')][_0xc3c2('0x14')],'json':!![]})[_0xc3c2('0xd')](function(_0x57458a){logger[_0xc3c2('0xe')](util[_0xc3c2('0x9')](_0xc3c2('0x16'),_0x28b548['id']));if(_0x57458a&&_0x57458a['results']&&_0x57458a[_0xc3c2('0x17')][_0xc3c2('0x18')]&&_0x57458a[_0xc3c2('0x17')]['transcripts'][_0xc3c2('0x19')]){_0x164a52['fileText']='';for(var _0x323daf=0x0;_0x323daf<_0x57458a[_0xc3c2('0x17')][_0xc3c2('0x18')][_0xc3c2('0x19')];_0x323daf++){_0x164a52[_0xc3c2('0x1a')]+=_0x57458a[_0xc3c2('0x17')][_0xc3c2('0x18')][_0x323daf]['transcript']+'';}}return _0x28b548['update'](_0x164a52);})['then'](function(){logger[_0xc3c2('0xe')](util[_0xc3c2('0x9')](_0xc3c2('0x1b'),_0x28b548['id']));if(!_0x28b548['tempSentiment']){throw new db[(_0xc3c2('0x1c'))][(_0xc3c2('0x1d'))](_0xc3c2('0x1e'));}if(!_0x578ac4[_0xc3c2('0x1f')]||!_0x578ac4[_0xc3c2('0x20')]||!_0x578ac4[_0xc3c2('0x21')]||!_0x578ac4[_0xc3c2('0x22')]||!_0x578ac4[_0xc3c2('0x23')]){throw new db['Sequelize'][(_0xc3c2('0x1d'))](_0xc3c2('0x24'));}if(!_0x164a52[_0xc3c2('0x1a')]){throw new Error(_0xc3c2('0x25'));}if(_0x578ac4[_0xc3c2('0x20')]===_0x3920e7['id']){return _0x3920e7;}else{return db[_0xc3c2('0x26')]['findOne']({'where':{'id':_settings['sentimentAccountId']}});}})[_0xc3c2('0xd')](function(_0x487619){if(!_0x487619){throw new db[(_0xc3c2('0x1c'))][(_0xc3c2('0x1d'))](_0xc3c2('0x27'));}if(!_0x487619['data1']||!_0x487619['data2']){throw new db['Sequelize']['ValidationError'](_0xc3c2('0x28'));}_0x1befad=_0x487619;logger['info'](util[_0xc3c2('0x9')]('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x28b548['id']));return sentiment(_0x1befad[_0xc3c2('0x29')],_0x1befad['data2'],_0x578ac4['sentimentRegion'],_0x164a52[_0xc3c2('0x1a')],_0x578ac4[_0xc3c2('0x22')]);})[_0xc3c2('0xd')](function(_0x41e683){logger[_0xc3c2('0xe')](util[_0xc3c2('0x9')](_0xc3c2('0x2a'),_0x28b548['id']));return _0x28b548[_0xc3c2('0x2b')]({'sentiment':_0x41e683[_0xc3c2('0x2c')],'sPositive':_0x41e683['SentimentScore']['Positive'],'sNegative':_0x41e683[_0xc3c2('0x2d')][_0xc3c2('0x2e')],'sMixed':_0x41e683[_0xc3c2('0x2d')][_0xc3c2('0x2f')],'sNeutral':_0x41e683[_0xc3c2('0x2d')][_0xc3c2('0x30')]});})['then'](function(){logger[_0xc3c2('0xe')](util['format'](_0xc3c2('0x1b'),_0x28b548['id']));_0x515bbc();});case _0xc3c2('0x31'):return _0x28b548['update']({'transcribeStatus':_0xc3c2('0x31'),'failureReason':_0x36f10f[_0xc3c2('0x10')]['FailureReason']})[_0xc3c2('0xd')](function(){logger[_0xc3c2('0xe')](util[_0xc3c2('0x9')](_0xc3c2('0x1b'),_0x28b548['id']));_0x515bbc();});default:logger[_0xc3c2('0xe')](util[_0xc3c2('0x9')](_0xc3c2('0x32'),_0x28b548['id']));break;}}else{return BPromise[_0xc3c2('0x33')]()['then'](function(){if(!_0x28b548[_0xc3c2('0x34')]){throw new db[(_0xc3c2('0x1c'))][(_0xc3c2('0x1d'))](_0xc3c2('0x1e'));}if(!_0x578ac4[_0xc3c2('0x1f')]||!_0x578ac4[_0xc3c2('0x20')]||!_0x578ac4[_0xc3c2('0x21')]||!_0x578ac4[_0xc3c2('0x22')]||!_0x578ac4[_0xc3c2('0x23')]){throw new db[(_0xc3c2('0x1c'))]['ValidationError'](_0xc3c2('0x24'));}if(!_0x28b548[_0xc3c2('0x1a')]){throw new Error('Transcript\x20not\x20available');}if(_0x578ac4[_0xc3c2('0x20')]===_0x3920e7['id']){return _0x3920e7;}else{return db[_0xc3c2('0x26')]['findOne']({'where':{'id':_settings[_0xc3c2('0x20')]}});}})['then'](function(_0x2a4369){if(!_0x2a4369){throw new db[(_0xc3c2('0x1c'))][(_0xc3c2('0x1d'))](_0xc3c2('0x27'));}if(!_0x2a4369[_0xc3c2('0x29')]||!_0x2a4369[_0xc3c2('0xb')]){throw new db[(_0xc3c2('0x1c'))][(_0xc3c2('0x1d'))]('Cloud\x20Provider\x20not\x20configured');}_0x1befad=_0x2a4369;logger[_0xc3c2('0xe')](util[_0xc3c2('0x9')](_0xc3c2('0x35'),_0x28b548['id']));return sentiment(_0x1befad[_0xc3c2('0x29')],_0x1befad['data2'],_0x578ac4['sentimentRegion'],_0x28b548['fileText'],_0x578ac4[_0xc3c2('0x22')]);})[_0xc3c2('0xd')](function(_0x4b4ae7){logger[_0xc3c2('0xe')](util['format'](_0xc3c2('0x2a'),_0x28b548['id']));return _0x28b548['update']({'sentiment':_0x4b4ae7[_0xc3c2('0x2c')],'sPositive':_0x4b4ae7[_0xc3c2('0x2d')][_0xc3c2('0x36')],'sNegative':_0x4b4ae7[_0xc3c2('0x2d')][_0xc3c2('0x2e')],'sMixed':_0x4b4ae7['SentimentScore']['Mixed'],'sNeutral':_0x4b4ae7[_0xc3c2('0x2d')][_0xc3c2('0x30')],'transcribeStatus':_0xc3c2('0x12')});})[_0xc3c2('0xd')](function(){logger[_0xc3c2('0xe')](util[_0xc3c2('0x9')](_0xc3c2('0x1b'),_0x28b548['id']));_0x515bbc();});}})[_0xc3c2('0x37')](function(_0x3e77d7){if(_0x3e77d7){if(!_0x3e77d7[_0xc3c2('0x38')]||_0x3e77d7[_0xc3c2('0x38')]!==_0xc3c2('0x39')){logger[_0xc3c2('0x3a')](util[_0xc3c2('0x9')]('[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis',_0x28b548['id']),util[_0xc3c2('0x3b')](_0x3e77d7,{'showHidden':![],'depth':null}));}}_0x515bbc();});});}function checkTranscribe(){var _0x348758;var _0x1d5bde;var _0x444d41;return db[_0xc3c2('0x3c')][_0xc3c2('0x3d')]({'where':{'transcribeStatus':_0xc3c2('0x3e')}})[_0xc3c2('0xd')](function(_0x188332){if(!_0x188332||!_0x188332[_0xc3c2('0x19')]){throw new db[(_0xc3c2('0x1c'))][(_0xc3c2('0x1d'))]('No\x20transcribe\x20job\x20to\x20check');}_0x348758=_0x188332;return db[_0xc3c2('0x3f')]['findOne']({'where':{'id':0x1}});})[_0xc3c2('0xd')](function(_0x34cae8){if(!_0x34cae8){throw new db[(_0xc3c2('0x1c'))][(_0xc3c2('0x1d'))](_0xc3c2('0x40'));}_0x1d5bde=_0x34cae8;if(!_0x1d5bde['transcribe']||!_0x1d5bde[_0xc3c2('0x41')]||!_0x1d5bde[_0xc3c2('0xc')]||!_0x1d5bde[_0xc3c2('0x22')]||!_0x1d5bde[_0xc3c2('0x23')]){throw new db['Sequelize'][(_0xc3c2('0x1d'))]('Transcribe\x20not\x20configured');}return db[_0xc3c2('0x26')][_0xc3c2('0x42')]({'where':{'id':_0x1d5bde[_0xc3c2('0x41')]}});})[_0xc3c2('0xd')](function(_0x27235b){if(!_0x27235b){throw new db[(_0xc3c2('0x1c'))]['ValidationError'](_0xc3c2('0x27'));}if(!_0x27235b[_0xc3c2('0x29')]||!_0x27235b[_0xc3c2('0xb')]){throw new db[(_0xc3c2('0x1c'))][(_0xc3c2('0x1d'))](_0xc3c2('0x28'));}_0x444d41=_0x27235b;var _0x3b4917=[];_0x348758[_0xc3c2('0x43')](function(_0x3eee01){_0x3b4917[_0xc3c2('0x44')](checkTranscribeJob(_0x3eee01,_0x1d5bde,_0x444d41));});return BPromise[_0xc3c2('0x45')](_0x3b4917);})[_0xc3c2('0x37')](function(_0x25f44a){if(_0x25f44a){if(!_0x25f44a[_0xc3c2('0x38')]||_0x25f44a['name']!==_0xc3c2('0x39')){logger['error'](util[_0xc3c2('0x3b')](_0x25f44a,{'showHidden':![],'depth':null}));}}});}exports['start']=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0x69af=['Cloud\x20Provider\x20not\x20available','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','Mixed','COMPLETED','name','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Setting','Settings\x20not\x20available','transcribeAccountId','push','all','SequelizeValidationError','start','aws-sdk','request-promise','util','bluebird','../../mysqldb','../../config/logger','TranscribeService','getTranscriptionJob','Comprehend','detectSentiment','substring','info','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data2','transcribeRegion','then','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','TranscriptionJobStatus','fileText','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','transcript','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','Sequelize','sentiment','language','ValidationError','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','sentimentAccountId','CloudProvider','findOne','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','data1','sentimentRegion','Positive','Negative','SentimentScore','Neutral','FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','Sentiment\x20Analysis\x20not\x20requested','bucket'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0x69af,0x17b));var _0xf69a=function(_0x2078d7,_0x55fee7){_0x2078d7=_0x2078d7-0x0;var _0x5a3815=_0x69af[_0x2078d7];return _0x5a3815;};var _=require('lodash');var AWS=require(_0xf69a('0x0'));var rp=require(_0xf69a('0x1'));var util=require(_0xf69a('0x2'));var BPromise=require(_0xf69a('0x3'));var db=require(_0xf69a('0x4'))['db'];var logger=require(_0xf69a('0x5'))('transcribe');function getTranscriptionJob(_0x1c543b,_0x10a24a,_0x297ae0,_0x2820d8){return new Promise(function(_0x723700,_0x5953c9){var _0x10c1b0=new AWS[(_0xf69a('0x6'))]({'accessKeyId':_0x10a24a,'secretAccessKey':_0x1c543b,'region':_0x297ae0});_0x10c1b0[_0xf69a('0x7')]({'TranscriptionJobName':_0x2820d8},function(_0x4ffe11,_0x4a3496){if(_0x4ffe11){return _0x5953c9(_0x4ffe11);}else{return _0x723700(_0x4a3496);}});});}function sentiment(_0x1f7f03,_0x185abe,_0x16a06e,_0x302b3a,_0x3c80f9){return new Promise(function(_0x4f9aeb,_0x518070){var _0x48bb54=new AWS[(_0xf69a('0x8'))]({'accessKeyId':_0x185abe,'secretAccessKey':_0x1f7f03,'region':_0x16a06e});_0x48bb54[_0xf69a('0x9')]({'Text':_0x302b3a,'LanguageCode':_0x3c80f9[_0xf69a('0xa')](0x0,0x2)},function(_0x2500ff,_0x4b2cda){if(_0x2500ff){return _0x518070(_0x2500ff);}else{return _0x4f9aeb(_0x4b2cda);}});});}function checkTranscribeJob(_0x44bc6d,_0x2f9dd7,_0x331bd4){var _0x1b053f;return new BPromise(function(_0x3930a2,_0x138d7f){logger[_0xf69a('0xb')](util[_0xf69a('0xc')](_0xf69a('0xd'),_0x44bc6d['id'],_0x44bc6d[_0xf69a('0xe')]));return getTranscriptionJob(_0x331bd4['data1'],_0x331bd4[_0xf69a('0xf')],_0x2f9dd7[_0xf69a('0x10')],_0x44bc6d[_0xf69a('0xe')])[_0xf69a('0x11')](function(_0x510555){logger[_0xf69a('0xb')](util[_0xf69a('0xc')](_0xf69a('0x12'),_0x44bc6d['id'],_0x44bc6d[_0xf69a('0xe')],_0x510555[_0xf69a('0x13')][_0xf69a('0x14')]));if(!_0x44bc6d[_0xf69a('0x15')]){switch(_0x510555['TranscriptionJob']['TranscriptionJobStatus']){case'COMPLETED':var _0x32f29c={'transcribeStatus':_0x510555['TranscriptionJob']['TranscriptionJobStatus'],'fileUri':_0x510555['TranscriptionJob'][_0xf69a('0x16')][_0xf69a('0x17')]};logger[_0xf69a('0xb')](util[_0xf69a('0xc')]('[RECORDING:%d]\x20Get\x20transcript',_0x44bc6d['id']));return rp({'uri':_0x510555['TranscriptionJob'][_0xf69a('0x16')][_0xf69a('0x17')],'json':!![]})[_0xf69a('0x11')](function(_0x752c26){logger[_0xf69a('0xb')](util[_0xf69a('0xc')](_0xf69a('0x18'),_0x44bc6d['id']));if(_0x752c26&&_0x752c26[_0xf69a('0x19')]&&_0x752c26['results'][_0xf69a('0x1a')]&&_0x752c26[_0xf69a('0x19')][_0xf69a('0x1a')][_0xf69a('0x1b')]){_0x32f29c[_0xf69a('0x15')]='';for(var _0x451c92=0x0;_0x451c92<_0x752c26[_0xf69a('0x19')][_0xf69a('0x1a')]['length'];_0x451c92++){_0x32f29c[_0xf69a('0x15')]+=_0x752c26['results'][_0xf69a('0x1a')][_0x451c92][_0xf69a('0x1c')]+'';}}return _0x44bc6d[_0xf69a('0x1d')](_0x32f29c);})[_0xf69a('0x11')](function(){logger[_0xf69a('0xb')](util[_0xf69a('0xc')](_0xf69a('0x1e'),_0x44bc6d['id']));if(!_0x44bc6d[_0xf69a('0x1f')]){throw new db[(_0xf69a('0x20'))]['ValidationError']('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x2f9dd7[_0xf69a('0x21')]||!_0x2f9dd7['sentimentAccountId']||!_0x2f9dd7['sentimentRegion']||!_0x2f9dd7[_0xf69a('0x22')]||!_0x2f9dd7['bucket']){throw new db['Sequelize'][(_0xf69a('0x23'))](_0xf69a('0x24'));}if(!_0x32f29c[_0xf69a('0x15')]){throw new Error(_0xf69a('0x25'));}if(_0x2f9dd7[_0xf69a('0x26')]===_0x331bd4['id']){return _0x331bd4;}else{return db[_0xf69a('0x27')][_0xf69a('0x28')]({'where':{'id':_settings['sentimentAccountId']}});}})[_0xf69a('0x11')](function(_0x46c804){if(!_0x46c804){throw new db['Sequelize'][(_0xf69a('0x23'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x46c804['data1']||!_0x46c804['data2']){throw new db[(_0xf69a('0x20'))]['ValidationError']('Cloud\x20Provider\x20not\x20configured');}_0x1b053f=_0x46c804;logger['info'](util['format'](_0xf69a('0x29'),_0x44bc6d['id']));return sentiment(_0x1b053f[_0xf69a('0x2a')],_0x1b053f['data2'],_0x2f9dd7[_0xf69a('0x2b')],_0x32f29c[_0xf69a('0x15')],_0x2f9dd7[_0xf69a('0x22')]);})[_0xf69a('0x11')](function(_0x4bd8bd){logger[_0xf69a('0xb')](util['format']('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0x44bc6d['id']));return _0x44bc6d[_0xf69a('0x1d')]({'sentiment':_0x4bd8bd['Sentiment'],'sPositive':_0x4bd8bd['SentimentScore'][_0xf69a('0x2c')],'sNegative':_0x4bd8bd['SentimentScore'][_0xf69a('0x2d')],'sMixed':_0x4bd8bd[_0xf69a('0x2e')]['Mixed'],'sNeutral':_0x4bd8bd['SentimentScore'][_0xf69a('0x2f')]});})[_0xf69a('0x11')](function(){logger[_0xf69a('0xb')](util['format'](_0xf69a('0x1e'),_0x44bc6d['id']));_0x3930a2();});case _0xf69a('0x30'):return _0x44bc6d[_0xf69a('0x1d')]({'transcribeStatus':_0xf69a('0x30'),'failureReason':_0x510555[_0xf69a('0x13')][_0xf69a('0x31')]})[_0xf69a('0x11')](function(){logger[_0xf69a('0xb')](util[_0xf69a('0xc')](_0xf69a('0x1e'),_0x44bc6d['id']));_0x3930a2();});default:logger[_0xf69a('0xb')](util['format'](_0xf69a('0x32'),_0x44bc6d['id']));break;}}else{return BPromise['resolve']()['then'](function(){if(!_0x44bc6d[_0xf69a('0x1f')]){throw new db[(_0xf69a('0x20'))][(_0xf69a('0x23'))](_0xf69a('0x33'));}if(!_0x2f9dd7[_0xf69a('0x21')]||!_0x2f9dd7['sentimentAccountId']||!_0x2f9dd7[_0xf69a('0x2b')]||!_0x2f9dd7[_0xf69a('0x22')]||!_0x2f9dd7[_0xf69a('0x34')]){throw new db['Sequelize'][(_0xf69a('0x23'))](_0xf69a('0x24'));}if(!_0x44bc6d['fileText']){throw new Error(_0xf69a('0x25'));}if(_0x2f9dd7['sentimentAccountId']===_0x331bd4['id']){return _0x331bd4;}else{return db[_0xf69a('0x27')][_0xf69a('0x28')]({'where':{'id':_settings[_0xf69a('0x26')]}});}})['then'](function(_0x470f04){if(!_0x470f04){throw new db[(_0xf69a('0x20'))]['ValidationError'](_0xf69a('0x35'));}if(!_0x470f04[_0xf69a('0x2a')]||!_0x470f04[_0xf69a('0xf')]){throw new db[(_0xf69a('0x20'))]['ValidationError'](_0xf69a('0x36'));}_0x1b053f=_0x470f04;logger[_0xf69a('0xb')](util['format']('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x44bc6d['id']));return sentiment(_0x1b053f[_0xf69a('0x2a')],_0x1b053f[_0xf69a('0xf')],_0x2f9dd7[_0xf69a('0x2b')],_0x44bc6d['fileText'],_0x2f9dd7[_0xf69a('0x22')]);})['then'](function(_0x1fa9d5){logger[_0xf69a('0xb')](util['format'](_0xf69a('0x37'),_0x44bc6d['id']));return _0x44bc6d[_0xf69a('0x1d')]({'sentiment':_0x1fa9d5[_0xf69a('0x38')],'sPositive':_0x1fa9d5[_0xf69a('0x2e')][_0xf69a('0x2c')],'sNegative':_0x1fa9d5['SentimentScore'][_0xf69a('0x2d')],'sMixed':_0x1fa9d5[_0xf69a('0x2e')][_0xf69a('0x39')],'sNeutral':_0x1fa9d5[_0xf69a('0x2e')][_0xf69a('0x2f')],'transcribeStatus':_0xf69a('0x3a')});})[_0xf69a('0x11')](function(){logger[_0xf69a('0xb')](util[_0xf69a('0xc')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x44bc6d['id']));_0x3930a2();});}})['catch'](function(_0x41b4b9){if(_0x41b4b9){if(!_0x41b4b9['name']||_0x41b4b9[_0xf69a('0x3b')]!=='SequelizeValidationError'){logger[_0xf69a('0x3c')](util[_0xf69a('0xc')](_0xf69a('0x3d'),_0x44bc6d['id']),util[_0xf69a('0x3e')](_0x41b4b9,{'showHidden':![],'depth':null}));}}_0x3930a2();});});}function checkTranscribe(){var _0x3c00af;var _0x1bf067;var _0x927d70;return db['VoiceRecording']['findAll']({'where':{'transcribeStatus':_0xf69a('0x3f')}})[_0xf69a('0x11')](function(_0x4a4795){if(!_0x4a4795||!_0x4a4795[_0xf69a('0x1b')]){throw new db['Sequelize'][(_0xf69a('0x23'))](_0xf69a('0x40'));}_0x3c00af=_0x4a4795;return db[_0xf69a('0x41')][_0xf69a('0x28')]({'where':{'id':0x1}});})[_0xf69a('0x11')](function(_0x14d64c){if(!_0x14d64c){throw new db[(_0xf69a('0x20'))][(_0xf69a('0x23'))](_0xf69a('0x42'));}_0x1bf067=_0x14d64c;if(!_0x1bf067['transcribe']||!_0x1bf067[_0xf69a('0x43')]||!_0x1bf067[_0xf69a('0x10')]||!_0x1bf067['language']||!_0x1bf067[_0xf69a('0x34')]){throw new db[(_0xf69a('0x20'))][(_0xf69a('0x23'))]('Transcribe\x20not\x20configured');}return db[_0xf69a('0x27')]['findOne']({'where':{'id':_0x1bf067[_0xf69a('0x43')]}});})[_0xf69a('0x11')](function(_0x5a5e7d){if(!_0x5a5e7d){throw new db[(_0xf69a('0x20'))][(_0xf69a('0x23'))](_0xf69a('0x35'));}if(!_0x5a5e7d[_0xf69a('0x2a')]||!_0x5a5e7d[_0xf69a('0xf')]){throw new db[(_0xf69a('0x20'))][(_0xf69a('0x23'))]('Cloud\x20Provider\x20not\x20configured');}_0x927d70=_0x5a5e7d;var _0x278aec=[];_0x3c00af['forEach'](function(_0x1a42f6){_0x278aec[_0xf69a('0x44')](checkTranscribeJob(_0x1a42f6,_0x1bf067,_0x927d70));});return BPromise[_0xf69a('0x45')](_0x278aec);})['catch'](function(_0x906e2a){if(_0x906e2a){if(!_0x906e2a[_0xf69a('0x3b')]||_0x906e2a[_0xf69a('0x3b')]!==_0xf69a('0x46')){logger[_0xf69a('0x3c')](util[_0xf69a('0x3e')](_0x906e2a,{'showHidden':![],'depth':null}));}}});}exports[_0xf69a('0x47')]=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 ecfe7ac..b8572c1 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 _0xe790=['localhost','WhatsappInteraction','findAll','lastMsgAt','subtract','hours','then','length','map','info','[WHATSAPP]\x20Interactions\x20to\x20close:','join','update','system','timeout','format','whatsappInteraction:update','error','[WHATSAPP]\x20Error\x20closing\x20interactions','inspect','start','lodash','moment','ioredis','util','../../config/environment','../../mysqldb','../logger','schedule','redis','defaults'];(function(_0x10751e,_0x1e937d){var _0x2d04fc=function(_0x3673a0){while(--_0x3673a0){_0x10751e['push'](_0x10751e['shift']());}};_0x2d04fc(++_0x1e937d);}(_0xe790,0x189));var _0x0e79=function(_0x5008c0,_0x5571c3){_0x5008c0=_0x5008c0-0x0;var _0x3092f6=_0xe790[_0x5008c0];return _0x3092f6;};'use strict';var _=require(_0x0e79('0x0'));var moment=require(_0x0e79('0x1'));var Redis=require(_0x0e79('0x2'));var util=require(_0x0e79('0x3'));var config=require(_0x0e79('0x4'));var db=require(_0x0e79('0x5'))['db'];var logger=require(_0x0e79('0x6'))(_0x0e79('0x7'));config[_0x0e79('0x8')]=_[_0x0e79('0x9')](config[_0x0e79('0x8')],{'host':_0x0e79('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function closeInteractions(){var _0x1b9d31=[];return db[_0x0e79('0xb')][_0x0e79('0xc')]({'raw':!![],'attributes':['id',_0x0e79('0xd')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0x0e79('0xe')](0x18,_0x0e79('0xf'))}}})[_0x0e79('0x10')](function(_0x12e7e7){if(_0x12e7e7&&_0x12e7e7[_0x0e79('0x11')]){_0x1b9d31=_[_0x0e79('0x12')](_0x12e7e7||[],'id');logger[_0x0e79('0x13')](_0x0e79('0x14'),_0x1b9d31[_0x0e79('0x15')]());return db[_0x0e79('0xb')][_0x0e79('0x16')]({'closeReason':_0x0e79('0x17'),'disposition':_0x0e79('0x18'),'closed':!![],'closedAt':moment()[_0x0e79('0x19')]('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_0x1b9d31}});}})[_0x0e79('0x10')](function(){if(_0x1b9d31&&_0x1b9d31[_0x0e79('0x11')]){logger[_0x0e79('0x13')]('[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:',_0x1b9d31['join']());for(var _0x2c4502=0x0;_0x2c4502<_0x1b9d31[_0x0e79('0x11')];_0x2c4502++){io['emit'](_0x0e79('0x1a'),{'id':_0x1b9d31[_0x2c4502],'closed':!![]});}}})['catch'](function(_0x5900d1){logger[_0x0e79('0x1b')](_0x0e79('0x1c'),_0x5900d1?util[_0x0e79('0x1d')](_0x5900d1,{'showHidden':![],'depth':null}):'');});}exports[_0x0e79('0x1e')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0xde1a=['localhost','socket.io-emitter','WhatsappInteraction','lastMsgAt','subtract','hours','then','length','map','info','join','system','timeout','format','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','emit','whatsappInteraction:update','catch','error','inspect','start','moment','ioredis','util','../../config/environment','../../mysqldb','../logger','schedule','redis'];(function(_0x64ba51,_0x288dcc){var _0x248a46=function(_0x34a11d){while(--_0x34a11d){_0x64ba51['push'](_0x64ba51['shift']());}};_0x248a46(++_0x288dcc);}(_0xde1a,0xfd));var _0xade1=function(_0x57447d,_0xac84a6){_0x57447d=_0x57447d-0x0;var _0x4f887e=_0xde1a[_0x57447d];return _0x4f887e;};'use strict';var _=require('lodash');var moment=require(_0xade1('0x0'));var Redis=require(_0xade1('0x1'));var util=require(_0xade1('0x2'));var config=require(_0xade1('0x3'));var db=require(_0xade1('0x4'))['db'];var logger=require(_0xade1('0x5'))(_0xade1('0x6'));config[_0xade1('0x7')]=_['defaults'](config[_0xade1('0x7')],{'host':_0xade1('0x8'),'port':0x18eb});var io=require(_0xade1('0x9'))(new Redis(config[_0xade1('0x7')]));function closeInteractions(){var _0x3be6d5=[];return db[_0xade1('0xa')]['findAll']({'raw':!![],'attributes':['id',_0xade1('0xb')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0xade1('0xc')](0x18,_0xade1('0xd'))}}})[_0xade1('0xe')](function(_0x120f47){if(_0x120f47&&_0x120f47[_0xade1('0xf')]){_0x3be6d5=_[_0xade1('0x10')](_0x120f47||[],'id');logger[_0xade1('0x11')]('[WHATSAPP]\x20Interactions\x20to\x20close:',_0x3be6d5[_0xade1('0x12')]());return db[_0xade1('0xa')]['update']({'closeReason':_0xade1('0x13'),'disposition':_0xade1('0x14'),'closed':!![],'closedAt':moment()[_0xade1('0x15')]('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_0x3be6d5}});}})[_0xade1('0xe')](function(){if(_0x3be6d5&&_0x3be6d5[_0xade1('0xf')]){logger[_0xade1('0x11')](_0xade1('0x16'),_0x3be6d5[_0xade1('0x12')]());for(var _0x1630da=0x0;_0x1630da<_0x3be6d5['length'];_0x1630da++){io[_0xade1('0x17')](_0xade1('0x18'),{'id':_0x3be6d5[_0x1630da],'closed':!![]});}}})[_0xade1('0x19')](function(_0x10773d){logger[_0xade1('0x1a')]('[WHATSAPP]\x20Error\x20closing\x20interactions',_0x10773d?util[_0xade1('0x1b')](_0x10773d,{'showHidden':![],'depth':null}):'');});}exports[_0xade1('0x1c')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file diff --git a/server/config/seedContact.js b/server/config/seedContact.js index f777888..5fdad2a 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0d6e=['then','bulkCreate','log','finished\x20populating','CmHopper','hopper1','contacts2','hopper2','util','push','Innocenzo','Biondo','innocenzo.biondo','@xcally.com','now','CmContact','destroy'];(function(_0x270429,_0x14e109){var _0x449d75=function(_0x1db260){while(--_0x1db260){_0x270429['push'](_0x270429['shift']());}};_0x449d75(++_0x14e109);}(_0x0d6e,0xd4));var _0xe0d6=function(_0x312cb7,_0x344e89){_0x312cb7=_0x312cb7-0x0;var _0x1dbd54=_0x0d6e[_0x312cb7];return _0x1dbd54;};'use strict';var util=require(_0xe0d6('0x0'));var db=require('../mysqldb')['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0xe0d6('0x1')]({'id':i,'firstName':_0xe0d6('0x2')+i,'lastName':_0xe0d6('0x3')+i,'phone':0xf879fb460+i,'email':_0xe0d6('0x4')+i+_0xe0d6('0x5')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0xe0d6('0x1')]({'id':i,'active':![],'scheduledat':Date[_0xe0d6('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date['now'](),'updatedAt':Date['now']()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0xe0d6('0x1')]({'id':i,'firstName':_0xe0d6('0x2')+i,'lastName':_0xe0d6('0x3')+i,'phone':0xf879fb460+i,'email':_0xe0d6('0x4')+i+_0xe0d6('0x5')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0xe0d6('0x1')]({'id':i,'active':![],'scheduledat':Date[_0xe0d6('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xe0d6('0x6')](),'updatedAt':Date[_0xe0d6('0x6')]()});}db[_0xe0d6('0x7')][_0xe0d6('0x8')]({'where':{}})[_0xe0d6('0x9')](function(){return db['CmContact'][_0xe0d6('0xa')](contacts);})[_0xe0d6('0x9')](function(){console[_0xe0d6('0xb')](_0xe0d6('0xc'),'contacts1');return db[_0xe0d6('0xd')]['destroy']({'where':{}});})[_0xe0d6('0x9')](function(){return db['CmHopper']['bulkCreate'](hopper);})[_0xe0d6('0x9')](function(){console[_0xe0d6('0xb')](_0xe0d6('0xc'),_0xe0d6('0xe'));return db[_0xe0d6('0x7')][_0xe0d6('0xa')](contacts2);})[_0xe0d6('0x9')](function(){console['log'](_0xe0d6('0xc'),_0xe0d6('0xf'));return db['CmHopper'][_0xe0d6('0xa')](hopper2);})[_0xe0d6('0x9')](function(){console[_0xe0d6('0xb')](_0xe0d6('0xc'),_0xe0d6('0x10'));})['catch'](function(_0x1530b1){console[_0xe0d6('0xb')](_0x1530b1);}); \ No newline at end of file +var _0xfbf0=['finished\x20populating','contacts1','CmHopper','destroy','bulkCreate','catch','util','../mysqldb','Innocenzo','Biondo','innocenzo.biondo','@xcally.com','push','now','CmContact','then','log'];(function(_0x39aa1e,_0x46a550){var _0x37a0c4=function(_0x454165){while(--_0x454165){_0x39aa1e['push'](_0x39aa1e['shift']());}};_0x37a0c4(++_0x46a550);}(_0xfbf0,0x1af));var _0x0fbf=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0xfbf0[_0x160c73];return _0xd9302;};'use strict';var util=require(_0x0fbf('0x0'));var db=require(_0x0fbf('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts['push']({'id':i,'firstName':_0x0fbf('0x2')+i,'lastName':_0x0fbf('0x3')+i,'phone':0xf879fb460+i,'email':_0x0fbf('0x4')+i+_0x0fbf('0x5')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x0fbf('0x6')]({'id':i,'active':![],'scheduledat':Date[_0x0fbf('0x7')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date['now'](),'updatedAt':Date[_0x0fbf('0x7')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0x0fbf('0x6')]({'id':i,'firstName':_0x0fbf('0x2')+i,'lastName':_0x0fbf('0x3')+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+_0x0fbf('0x5')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x0fbf('0x6')]({'id':i,'active':![],'scheduledat':Date[_0x0fbf('0x7')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x0fbf('0x7')](),'updatedAt':Date['now']()});}db[_0x0fbf('0x8')]['destroy']({'where':{}})[_0x0fbf('0x9')](function(){return db['CmContact']['bulkCreate'](contacts);})[_0x0fbf('0x9')](function(){console[_0x0fbf('0xa')](_0x0fbf('0xb'),_0x0fbf('0xc'));return db[_0x0fbf('0xd')][_0x0fbf('0xe')]({'where':{}});})[_0x0fbf('0x9')](function(){return db[_0x0fbf('0xd')][_0x0fbf('0xf')](hopper);})[_0x0fbf('0x9')](function(){console['log'](_0x0fbf('0xb'),'hopper1');return db[_0x0fbf('0x8')][_0x0fbf('0xf')](contacts2);})[_0x0fbf('0x9')](function(){console[_0x0fbf('0xa')](_0x0fbf('0xb'),'contacts2');return db['CmHopper'][_0x0fbf('0xf')](hopper2);})['then'](function(){console[_0x0fbf('0xa')](_0x0fbf('0xb'),'hopper2');})[_0x0fbf('0x10')](function(_0x1b197b){console[_0x0fbf('0xa')](_0x1b197b);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index 744d956..b4eb825 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2da6=['../mysqldb','push','format','agent','%s%s@xcally.com','password','friend','udp','wss','all','ulaw','%s%s','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','\x22%s\x22\x20<%s>','User','bulkCreate','then','log','catch','util'];(function(_0x1e17eb,_0x2e15c5){var _0x4de4c7=function(_0x52d003){while(--_0x52d003){_0x1e17eb['push'](_0x1e17eb['shift']());}};_0x4de4c7(++_0x2e15c5);}(_0x2da6,0xaf));var _0x62da=function(_0x4ebb0a,_0x1368fe){_0x4ebb0a=_0x4ebb0a-0x0;var _0x1ff8f8=_0x2da6[_0x4ebb0a];return _0x1ff8f8;};'use strict';var util=require(_0x62da('0x0'));var db=require(_0x62da('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x62da('0x2')]({'name':util[_0x62da('0x3')]('%s%s',_0x62da('0x4'),i),'fullname':util[_0x62da('0x3')]('%s%s',_0x62da('0x4'),i),'email':util['format'](_0x62da('0x5'),_0x62da('0x4'),i),'role':_0x62da('0x4'),'password':_0x62da('0x6'),'internal':0xfa0+i,'type':_0x62da('0x7'),'transport':[_0x62da('0x8'),'ws',_0x62da('0x9')],'disallow':[_0x62da('0xa')],'allow':[_0x62da('0xb')],'defaultuser':util[_0x62da('0x3')](_0x62da('0xc'),_0x62da('0x4'),i),'encryption':_0x62da('0xd'),'avpf':_0x62da('0xd'),'force_avp':'yes','icesupport':_0x62da('0xd'),'dtlsenable':_0x62da('0xd'),'dtlsverify':'no','dtlscertfile':_0x62da('0xe'),'dtlsprivatekey':_0x62da('0xf'),'dtlssetup':'actpass','callerid':util[_0x62da('0x3')](_0x62da('0x10'),util[_0x62da('0x3')](_0x62da('0xc'),_0x62da('0x4'),i),0xfa0+i)});}db[_0x62da('0x11')][_0x62da('0x12')](users)[_0x62da('0x13')](function(){console[_0x62da('0x14')]('add\x20user');})[_0x62da('0x15')](function(_0x25e0fc){console[_0x62da('0x14')](_0x25e0fc);}); \ No newline at end of file +var _0x9bc8=['udp','all','ulaw','yes','/etc/pki/tls/certs/motion.crt','actpass','\x22%s\x22\x20<%s>','User','then','log','add\x20user','catch','util','../mysqldb','push','format','agent','%s%s','%s%s@xcally.com','password'];(function(_0x4ef583,_0x47bb47){var _0x27f3a2=function(_0x132133){while(--_0x132133){_0x4ef583['push'](_0x4ef583['shift']());}};_0x27f3a2(++_0x47bb47);}(_0x9bc8,0x1b0));var _0x89bc=function(_0xbc8bbb,_0x45ee2f){_0xbc8bbb=_0xbc8bbb-0x0;var _0x2fbd5c=_0x9bc8[_0xbc8bbb];return _0x2fbd5c;};'use strict';var util=require(_0x89bc('0x0'));var db=require(_0x89bc('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x89bc('0x2')]({'name':util[_0x89bc('0x3')]('%s%s',_0x89bc('0x4'),i),'fullname':util['format'](_0x89bc('0x5'),_0x89bc('0x4'),i),'email':util[_0x89bc('0x3')](_0x89bc('0x6'),'agent',i),'role':_0x89bc('0x4'),'password':_0x89bc('0x7'),'internal':0xfa0+i,'type':'friend','transport':[_0x89bc('0x8'),'ws','wss'],'disallow':[_0x89bc('0x9')],'allow':[_0x89bc('0xa')],'defaultuser':util[_0x89bc('0x3')]('%s%s',_0x89bc('0x4'),i),'encryption':_0x89bc('0xb'),'avpf':_0x89bc('0xb'),'force_avp':_0x89bc('0xb'),'icesupport':_0x89bc('0xb'),'dtlsenable':_0x89bc('0xb'),'dtlsverify':'no','dtlscertfile':_0x89bc('0xc'),'dtlsprivatekey':'/etc/pki/tls/private/motion.key','dtlssetup':_0x89bc('0xd'),'callerid':util[_0x89bc('0x3')](_0x89bc('0xe'),util[_0x89bc('0x3')](_0x89bc('0x5'),_0x89bc('0x4'),i),0xfa0+i)});}db[_0x89bc('0xf')]['bulkCreate'](users)[_0x89bc('0x10')](function(){console[_0x89bc('0x11')](_0x89bc('0x12'));})[_0x89bc('0x13')](function(_0x3d0a7e){console['log'](_0x3d0a7e);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index 1a6b144..da11990 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x782b=['VoiceQueue','Telephones','Trunks','Trunk','getVoiceQueues','getChatQueues','getFaxQueues','getMailQueues','getOpenchannelQueues','all','voice','chat','fax','mail','whatsapp','trunk:%s','campaign:%s:%s','removeChatInteractions','emit','user_has_chat_interactions:remove','leave','removeMailInteractions','removeFaxInteractions','user_has_fax_interactions:remove','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','removeWhatsappInteractions','catch','log','default','address','request','connection','remoteAddress','connectedAt','SocketIO\x20','nsp','disconnect','DISCONNECTED','CONNECTED','bluebird','./environment','name','Agents','role','agent','telephone','type','ivr','UserProfileSection','findOne','then','autoAssociation','VoiceQueues','ChatQueues','FaxQueues','SmsQueues','MailQueues','OpenchannelQueues','WhatsappQueues','findAll','IvrCampaigns','UserProfileResource','resourceId','map','where','Campaign','format','%s:queue:%s','length','user:%s','handshake','query','User','find','userProfileId','ChatInteractions','MailInteraction','MailInteractions','FaxInteractions','SmsInteraction','SmsInteractions','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteraction','WhatsappInteractions','voice:inbound','voice:outbound','hasOwnProperty','include','push','ChatQueue','FaxQueue','SmsQueue','MailQueue','WhatsappQueue','user'];(function(_0x394c3b,_0x8a2e1f){var _0x2265fb=function(_0x205943){while(--_0x205943){_0x394c3b['push'](_0x394c3b['shift']());}};_0x2265fb(++_0x8a2e1f);}(_0x782b,0x89));var _0xb782=function(_0x14fb6d,_0x18bf23){_0x14fb6d=_0x14fb6d-0x0;var _0x357d9c=_0x782b[_0x14fb6d];return _0x357d9c;};'use strict';var _=require('lodash');var util=require('util');var BPromise=require(_0xb782('0x0'));var db=require('../mysqldb')['db'];var config=require(_0xb782('0x1'));var queryQueues={'attributes':['id',_0xb782('0x2')],'include':[{'as':_0xb782('0x3'),'model':db['User'],'attributes':['id',_0xb782('0x2'),_0xb782('0x4')],'raw':!![],'where':{'role':_0xb782('0x5')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0xb782('0x2')],'where':{'role':_0xb782('0x6')}};var queryTrunks={'raw':!![],'attributes':['id',_0xb782('0x2')]};var queryAgents={'raw':!![],'attributes':['id',_0xb782('0x2')],'where':{'role':'agent'}};var queryCampaigns={'raw':!![],'attributes':['id',_0xb782('0x2'),_0xb782('0x7')],'where':{'type':_0xb782('0x8')}};function getAssociatedResources(_0x169b41,_0x51eb88,_0x357905){return db[_0xb782('0x9')][_0xb782('0xa')]({'where':{'name':_0x169b41,'userProfileId':_0x51eb88},'raw':!![]})[_0xb782('0xb')](function(_0x5cee45){if(_0x5cee45){if(_0x5cee45[_0xb782('0xc')]){switch(_0x169b41){case _0xb782('0xd'):case _0xb782('0xe'):case _0xb782('0xf'):case _0xb782('0x10'):case _0xb782('0x11'):case _0xb782('0x12'):case _0xb782('0x13'):return db[_0x357905]['findAll'](queryQueues);case'Telephones':return db[_0x357905][_0xb782('0x14')](queryTelephones);case'Trunks':return db[_0x357905]['findAll'](queryTrunks);case _0xb782('0x15'):return db[_0x357905][_0xb782('0x14')](queryCampaigns);}}else{return db[_0xb782('0x16')][_0xb782('0x14')]({'attributes':[_0xb782('0x17')],'where':{'sectionId':_0x5cee45['id']},'raw':!![]})['then'](function(_0x172e22){if(_0x172e22){var _0x980c17={'where':{'id':_[_0xb782('0x18')](_0x172e22,_0xb782('0x17'))},'raw':!![]};switch(_0x357905){case'User':_0x980c17[_0xb782('0x19')][_0xb782('0x4')]='telephone';break;case _0xb782('0x1a'):_0x980c17['where'][_0xb782('0x7')]='ivr';break;}return db[_0x357905][_0xb782('0x14')](_0x980c17);}else{return[];}});}}else{return[];}})['then'](function(_0x1292ce){return _0x1292ce;});}function joinOrLeaveQueues(_0x3a299d,_0x3e8b46,_0x273385,_0x11aba8){_0x3a299d[_0x3e8b46](util[_0xb782('0x1b')](_0xb782('0x1c'),_0x273385,_0x11aba8[_0xb782('0x2')]));if(_0x11aba8[_0xb782('0x3')]){for(var _0x25be39=0x0;_0x25be39<_0x11aba8[_0xb782('0x3')][_0xb782('0x1d')];_0x25be39+=0x1){_0x3a299d[_0x3e8b46](util[_0xb782('0x1b')](_0xb782('0x1e'),_0x11aba8[_0xb782('0x3')][_0x25be39][_0xb782('0x2')]));}}}function joinOrLeave(_0x1ec1d4,_0x2816d3,_0x490749){var _0x411a0a;if(_0x1ec1d4[_0xb782('0x1f')][_0xb782('0x20')]['id']){db[_0xb782('0x21')][_0xb782('0x22')]({'attributes':['id',_0xb782('0x2'),'role',_0xb782('0x23')],'where':{'id':_0x1ec1d4['handshake'][_0xb782('0x20')]['id']},'include':[{'model':db['ChatInteraction'],'as':_0xb782('0x24'),'attributes':['id'],'raw':!![]},{'model':db[_0xb782('0x25')],'as':_0xb782('0x26'),'attributes':['id'],'raw':!![]},{'model':db['FaxInteraction'],'as':_0xb782('0x27'),'attributes':['id'],'raw':!![]},{'model':db[_0xb782('0x28')],'as':_0xb782('0x29'),'attributes':['id'],'raw':!![]},{'model':db[_0xb782('0x2a')],'as':_0xb782('0x2b'),'attributes':['id'],'raw':!![]},{'model':db[_0xb782('0x2c')],'as':_0xb782('0x2d'),'attributes':['id'],'raw':!![]}]})[_0xb782('0xb')](function(_0x48a0a3){if(_0x48a0a3){_0x411a0a=_0x48a0a3;_0x1ec1d4[_0x2816d3](util[_0xb782('0x1b')](_0xb782('0x1e'),_0x48a0a3[_0xb782('0x2')]));var _0x10f776=[];switch(_0x48a0a3[_0xb782('0x4')]){case'admin':_0x1ec1d4[_0x2816d3](_0xb782('0x2e'));_0x1ec1d4[_0x2816d3](_0xb782('0x2f'));if(queryQueues[_0xb782('0x30')](_0xb782('0x31'))){delete queryQueues[_0xb782('0x31')];}_0x10f776[_0xb782('0x32')](db['VoiceQueue'][_0xb782('0x14')](queryQueues));_0x10f776[_0xb782('0x32')](db[_0xb782('0x33')][_0xb782('0x14')](queryQueues));_0x10f776['push'](db[_0xb782('0x34')][_0xb782('0x14')](queryQueues));_0x10f776[_0xb782('0x32')](db[_0xb782('0x35')][_0xb782('0x14')](queryQueues));_0x10f776['push'](db[_0xb782('0x36')][_0xb782('0x14')](queryQueues));_0x10f776[_0xb782('0x32')](db['OpenchannelQueue'][_0xb782('0x14')](queryQueues));_0x10f776[_0xb782('0x32')](db[_0xb782('0x37')][_0xb782('0x14')](queryQueues));_0x10f776[_0xb782('0x32')](db[_0xb782('0x21')][_0xb782('0x14')](queryTelephones));_0x10f776['push'](db['Trunk'][_0xb782('0x14')](queryTrunks));_0x10f776['push'](db[_0xb782('0x1a')]['findAll'](queryCampaigns));_0x10f776[_0xb782('0x32')](db['User'][_0xb782('0x14')](queryAgents));break;case _0xb782('0x38'):_0x1ec1d4[_0x2816d3](_0xb782('0x2e'));_0x1ec1d4[_0x2816d3]('voice:outbound');_0x10f776[_0xb782('0x32')](getAssociatedResources(_0xb782('0xd'),_0x48a0a3[_0xb782('0x23')],_0xb782('0x39')));_0x10f776['push'](getAssociatedResources('ChatQueues',_0x48a0a3['userProfileId'],_0xb782('0x33')));_0x10f776[_0xb782('0x32')](getAssociatedResources(_0xb782('0xf'),_0x48a0a3[_0xb782('0x23')],_0xb782('0x34')));_0x10f776[_0xb782('0x32')](getAssociatedResources(_0xb782('0x10'),_0x48a0a3[_0xb782('0x23')],'SmsQueue'));_0x10f776[_0xb782('0x32')](getAssociatedResources(_0xb782('0x11'),_0x48a0a3[_0xb782('0x23')],_0xb782('0x36')));_0x10f776[_0xb782('0x32')](getAssociatedResources(_0xb782('0x12'),_0x48a0a3[_0xb782('0x23')],'OpenchannelQueue'));_0x10f776[_0xb782('0x32')](getAssociatedResources(_0xb782('0x13'),_0x48a0a3[_0xb782('0x23')],_0xb782('0x37')));_0x10f776[_0xb782('0x32')](getAssociatedResources(_0xb782('0x3a'),_0x48a0a3[_0xb782('0x23')],_0xb782('0x21')));_0x10f776[_0xb782('0x32')](getAssociatedResources(_0xb782('0x3b'),_0x48a0a3['userProfileId'],_0xb782('0x3c')));_0x10f776[_0xb782('0x32')](getAssociatedResources(_0xb782('0x15'),_0x48a0a3['userProfileId'],_0xb782('0x1a')));_0x10f776[_0xb782('0x32')](db[_0xb782('0x21')]['findAll'](queryAgents));break;case _0xb782('0x5'):_0x1ec1d4[_0x2816d3](_0xb782('0x2e'));_0x1ec1d4[_0x2816d3](_0xb782('0x2f'));_0x10f776[_0xb782('0x32')](_0x48a0a3[_0xb782('0x3d')]({'attributes':['id','name']}));_0x10f776['push'](_0x48a0a3[_0xb782('0x3e')]({'attributes':['id',_0xb782('0x2')]}));_0x10f776[_0xb782('0x32')](_0x48a0a3[_0xb782('0x3f')]({'attributes':['id',_0xb782('0x2')]}));_0x10f776[_0xb782('0x32')](_0x48a0a3['getSmsQueues']({'attributes':['id',_0xb782('0x2')]}));_0x10f776['push'](_0x48a0a3[_0xb782('0x40')]({'attributes':['id','name']}));_0x10f776[_0xb782('0x32')](_0x48a0a3[_0xb782('0x41')]({'attributes':['id',_0xb782('0x2')]}));_0x10f776[_0xb782('0x32')](_0x48a0a3['getWhatsappQueues']({'attributes':['id',_0xb782('0x2')]}));break;}return BPromise[_0xb782('0x42')](_0x10f776);}})[_0xb782('0xb')](function(_0x13d95a){if(_0x13d95a&&_0x13d95a['length']){for(var _0x1c2285=0x0;_0x1c2285<_0x13d95a['length'];_0x1c2285+=0x1){for(var _0x3077da=0x0;_0x3077da<_0x13d95a[_0x1c2285][_0xb782('0x1d')];_0x3077da+=0x1){switch(_0x1c2285){case 0x0:joinOrLeaveQueues(_0x1ec1d4,_0x2816d3,_0xb782('0x43'),_0x13d95a[_0x1c2285][_0x3077da]);break;case 0x1:joinOrLeaveQueues(_0x1ec1d4,_0x2816d3,_0xb782('0x44'),_0x13d95a[_0x1c2285][_0x3077da]);break;case 0x2:joinOrLeaveQueues(_0x1ec1d4,_0x2816d3,_0xb782('0x45'),_0x13d95a[_0x1c2285][_0x3077da]);break;case 0x3:joinOrLeaveQueues(_0x1ec1d4,_0x2816d3,'sms',_0x13d95a[_0x1c2285][_0x3077da]);break;case 0x4:joinOrLeaveQueues(_0x1ec1d4,_0x2816d3,_0xb782('0x46'),_0x13d95a[_0x1c2285][_0x3077da]);break;case 0x5:joinOrLeaveQueues(_0x1ec1d4,_0x2816d3,'openchannel',_0x13d95a[_0x1c2285][_0x3077da]);break;case 0x6:joinOrLeaveQueues(_0x1ec1d4,_0x2816d3,_0xb782('0x47'),_0x13d95a[_0x1c2285][_0x3077da]);break;case 0x7:if(_0x411a0a[_0xb782('0x4')]!==_0xb782('0x5'))_0x1ec1d4[_0x2816d3](util[_0xb782('0x1b')]('telephone:%s',_0x13d95a[_0x1c2285][_0x3077da]['name']));break;case 0x8:if(_0x411a0a[_0xb782('0x4')]!==_0xb782('0x5'))_0x1ec1d4[_0x2816d3](util[_0xb782('0x1b')](_0xb782('0x48'),_0x13d95a[_0x1c2285][_0x3077da]['name']));break;case 0x9:if(_0x411a0a['role']!==_0xb782('0x5'))_0x1ec1d4[_0x2816d3](util[_0xb782('0x1b')](_0xb782('0x49'),_0x13d95a[_0x1c2285][_0x3077da][_0xb782('0x7')],_0x13d95a[_0x1c2285][_0x3077da]['name']));break;case 0xa:_0x1ec1d4[_0x2816d3](util['format'](_0xb782('0x1e'),_0x13d95a[_0x1c2285][_0x3077da][_0xb782('0x2')]));break;}}}}})[_0xb782('0xb')](function(){if(_0x2816d3==='leave'){var _0x3361b8=_[_0xb782('0x18')](_0x411a0a[_0xb782('0x24')],'id');return _0x411a0a[_0xb782('0x4a')](_0x3361b8)[_0xb782('0xb')](function(){for(var _0x4c9943=0x0;_0x4c9943<_0x3361b8['length'];_0x4c9943+=0x1){_0x490749[_0xb782('0x4b')](_0xb782('0x4c'),{'ChatInteractionId':Number(_0x3361b8[_0x4c9943]),'UserId':Number(_0x411a0a['id'])});}});}})[_0xb782('0xb')](function(){if(_0x2816d3===_0xb782('0x4d')){var _0x46ca5d=_[_0xb782('0x18')](_0x411a0a[_0xb782('0x26')],'id');return _0x411a0a[_0xb782('0x4e')](_0x46ca5d)['then'](function(){for(var _0x495f17=0x0;_0x495f17<_0x46ca5d[_0xb782('0x1d')];_0x495f17+=0x1){_0x490749[_0xb782('0x4b')]('user_has_mail_interactions:remove',{'MailInteractionId':Number(_0x46ca5d[_0x495f17]),'UserId':Number(_0x411a0a['id'])});}});}})[_0xb782('0xb')](function(){if(_0x2816d3===_0xb782('0x4d')){var _0x447311=_['map'](_0x411a0a[_0xb782('0x27')],'id');return _0x411a0a[_0xb782('0x4f')](_0x447311)[_0xb782('0xb')](function(){for(var _0x59669d=0x0;_0x59669d<_0x447311['length'];_0x59669d+=0x1){_0x490749[_0xb782('0x4b')](_0xb782('0x50'),{'FaxInteractionId':Number(_0x447311[_0x59669d]),'UserId':Number(_0x411a0a['id'])});}});}})[_0xb782('0xb')](function(){if(_0x2816d3===_0xb782('0x4d')){var _0x47eb4b=_[_0xb782('0x18')](_0x411a0a[_0xb782('0x29')],'id');return _0x411a0a['removeSmsInteractions'](_0x47eb4b)[_0xb782('0xb')](function(){for(var _0x5a8546=0x0;_0x5a8546<_0x47eb4b['length'];_0x5a8546+=0x1){_0x490749['emit']('user_has_sms_interactions:remove',{'SmsInteractionId':Number(_0x47eb4b[_0x5a8546]),'UserId':Number(_0x411a0a['id'])});}});}})[_0xb782('0xb')](function(){if(_0x2816d3===_0xb782('0x4d')){var _0x46012d=_['map'](_0x411a0a['OpenchannelInteractions'],'id');return _0x411a0a[_0xb782('0x51')](_0x46012d)[_0xb782('0xb')](function(){for(var _0x3a08d=0x0;_0x3a08d<_0x46012d[_0xb782('0x1d')];_0x3a08d+=0x1){_0x490749[_0xb782('0x4b')](_0xb782('0x52'),{'OpenchannelInteractionId':Number(_0x46012d[_0x3a08d]),'UserId':Number(_0x411a0a['id'])});}});}})[_0xb782('0xb')](function(){if(_0x2816d3==='leave'){var _0x28c451=_[_0xb782('0x18')](_0x411a0a['WhatsappInteractions'],'id');return _0x411a0a[_0xb782('0x53')](_0x28c451)[_0xb782('0xb')](function(){for(var _0x4c55b3=0x0;_0x4c55b3<_0x28c451[_0xb782('0x1d')];_0x4c55b3+=0x1){_0x490749[_0xb782('0x4b')]('user_has_whatsapp_interactions:remove',{'WhatsappInteractionId':Number(_0x28c451[_0x4c55b3]),'UserId':Number(_0x411a0a['id'])});}});}})[_0xb782('0x54')](function(_0x156883){_0x1ec1d4[_0xb782('0x55')](_0x156883);});}}function onDisconnect(_0x5326b6,_0x3968d4){joinOrLeave(_0x5326b6,_0xb782('0x4d'),_0x3968d4);}function onConnect(_0x4c7327){joinOrLeave(_0x4c7327,'join');}exports[_0xb782('0x56')]=function(_0x208112){_0x208112['on']('connection',function(_0x366334){_0x366334['setMaxListeners'](0x0);_0x366334[_0xb782('0x57')]=_0x366334[_0xb782('0x58')][_0xb782('0x59')][_0xb782('0x5a')]+':'+_0x366334[_0xb782('0x58')]['connection']['remotePort'];_0x366334[_0xb782('0x5b')]=new Date();_0x366334['log']=function(_0x6ab32c){console[_0xb782('0x55')](_0xb782('0x5c')+_0x366334[_0xb782('0x5d')][_0xb782('0x2')]+'['+_0x366334['address']+']',_0x6ab32c);};_0x366334['on'](_0xb782('0x5e'),function(){onDisconnect(_0x366334,_0x208112);_0x366334[_0xb782('0x55')](_0xb782('0x5f'));});onConnect(_0x366334);_0x366334[_0xb782('0x55')](_0xb782('0x60'));});}; \ No newline at end of file +var _0x3e24=['MailInteraction','MailInteractions','FaxInteractions','SmsInteraction','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteraction','WhatsappInteractions','admin','hasOwnProperty','include','push','VoiceQueue','ChatQueue','FaxQueue','MailQueue','OpenchannelQueue','Trunk','user','voice:inbound','voice:outbound','VoiceQueues','FaxQueues','SmsQueue','WhatsappQueue','getChatQueues','getSmsQueues','getMailQueues','getOpenchannelQueues','getWhatsappQueues','length','voice','fax','sms','openchannel','whatsapp','telephone:%s','campaign:%s:%s','leave','map','removeChatInteractions','emit','removeMailInteractions','user_has_mail_interactions:remove','removeFaxInteractions','SmsInteractions','user_has_sms_interactions:remove','removeOpenchannelInteractions','log','join','default','connection','address','request','remoteAddress','remotePort','connectedAt','SocketIO\x20','nsp','disconnect','DISCONNECTED','CONNECTED','lodash','util','bluebird','../mysqldb','./environment','Agents','User','role','agent','name','telephone','type','ivr','findOne','then','autoAssociation','SmsQueues','MailQueues','OpenchannelQueues','WhatsappQueues','findAll','Telephones','Trunks','IvrCampaigns','UserProfileResource','resourceId','where','Campaign','%s:queue:%s','format','user:%s','query','find','userProfileId','handshake','ChatInteraction','ChatInteractions'];(function(_0x23d213,_0x4cfdf1){var _0x5962fd=function(_0x15a0f0){while(--_0x15a0f0){_0x23d213['push'](_0x23d213['shift']());}};_0x5962fd(++_0x4cfdf1);}(_0x3e24,0x167));var _0x43e2=function(_0x50a171,_0x46a5a7){_0x50a171=_0x50a171-0x0;var _0x51999c=_0x3e24[_0x50a171];return _0x51999c;};'use strict';var _=require(_0x43e2('0x0'));var util=require(_0x43e2('0x1'));var BPromise=require(_0x43e2('0x2'));var db=require(_0x43e2('0x3'))['db'];var config=require(_0x43e2('0x4'));var queryQueues={'attributes':['id','name'],'include':[{'as':_0x43e2('0x5'),'model':db[_0x43e2('0x6')],'attributes':['id','name',_0x43e2('0x7')],'raw':!![],'where':{'role':_0x43e2('0x8')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x43e2('0x9')],'where':{'role':_0x43e2('0xa')}};var queryTrunks={'raw':!![],'attributes':['id',_0x43e2('0x9')]};var queryAgents={'raw':!![],'attributes':['id',_0x43e2('0x9')],'where':{'role':_0x43e2('0x8')}};var queryCampaigns={'raw':!![],'attributes':['id','name',_0x43e2('0xb')],'where':{'type':_0x43e2('0xc')}};function getAssociatedResources(_0x4bd2ce,_0x1c96f9,_0x2fdf85){return db['UserProfileSection'][_0x43e2('0xd')]({'where':{'name':_0x4bd2ce,'userProfileId':_0x1c96f9},'raw':!![]})[_0x43e2('0xe')](function(_0x52146c){if(_0x52146c){if(_0x52146c[_0x43e2('0xf')]){switch(_0x4bd2ce){case'VoiceQueues':case'ChatQueues':case'FaxQueues':case _0x43e2('0x10'):case _0x43e2('0x11'):case _0x43e2('0x12'):case _0x43e2('0x13'):return db[_0x2fdf85][_0x43e2('0x14')](queryQueues);case _0x43e2('0x15'):return db[_0x2fdf85][_0x43e2('0x14')](queryTelephones);case _0x43e2('0x16'):return db[_0x2fdf85][_0x43e2('0x14')](queryTrunks);case _0x43e2('0x17'):return db[_0x2fdf85][_0x43e2('0x14')](queryCampaigns);}}else{return db[_0x43e2('0x18')]['findAll']({'attributes':[_0x43e2('0x19')],'where':{'sectionId':_0x52146c['id']},'raw':!![]})[_0x43e2('0xe')](function(_0xb929b5){if(_0xb929b5){var _0x2a0fb0={'where':{'id':_['map'](_0xb929b5,'resourceId')},'raw':!![]};switch(_0x2fdf85){case _0x43e2('0x6'):_0x2a0fb0[_0x43e2('0x1a')][_0x43e2('0x7')]=_0x43e2('0xa');break;case _0x43e2('0x1b'):_0x2a0fb0[_0x43e2('0x1a')][_0x43e2('0xb')]=_0x43e2('0xc');break;}return db[_0x2fdf85][_0x43e2('0x14')](_0x2a0fb0);}else{return[];}});}}else{return[];}})[_0x43e2('0xe')](function(_0x4879e9){return _0x4879e9;});}function joinOrLeaveQueues(_0x3ee34c,_0xb99e5d,_0x4de509,_0x115c0a){_0x3ee34c[_0xb99e5d](util['format'](_0x43e2('0x1c'),_0x4de509,_0x115c0a[_0x43e2('0x9')]));if(_0x115c0a[_0x43e2('0x5')]){for(var _0x23825c=0x0;_0x23825c<_0x115c0a[_0x43e2('0x5')]['length'];_0x23825c+=0x1){_0x3ee34c[_0xb99e5d](util[_0x43e2('0x1d')](_0x43e2('0x1e'),_0x115c0a[_0x43e2('0x5')][_0x23825c]['name']));}}}function joinOrLeave(_0x234a1d,_0x32f048,_0x43078f){var _0x11b285;if(_0x234a1d['handshake'][_0x43e2('0x1f')]['id']){db[_0x43e2('0x6')][_0x43e2('0x20')]({'attributes':['id',_0x43e2('0x9'),_0x43e2('0x7'),_0x43e2('0x21')],'where':{'id':_0x234a1d[_0x43e2('0x22')][_0x43e2('0x1f')]['id']},'include':[{'model':db[_0x43e2('0x23')],'as':_0x43e2('0x24'),'attributes':['id'],'raw':!![]},{'model':db[_0x43e2('0x25')],'as':_0x43e2('0x26'),'attributes':['id'],'raw':!![]},{'model':db['FaxInteraction'],'as':_0x43e2('0x27'),'attributes':['id'],'raw':!![]},{'model':db[_0x43e2('0x28')],'as':'SmsInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x43e2('0x29')],'as':_0x43e2('0x2a'),'attributes':['id'],'raw':!![]},{'model':db[_0x43e2('0x2b')],'as':_0x43e2('0x2c'),'attributes':['id'],'raw':!![]}]})[_0x43e2('0xe')](function(_0x5a896b){if(_0x5a896b){_0x11b285=_0x5a896b;_0x234a1d[_0x32f048](util[_0x43e2('0x1d')](_0x43e2('0x1e'),_0x5a896b[_0x43e2('0x9')]));var _0x3d8e16=[];switch(_0x5a896b[_0x43e2('0x7')]){case _0x43e2('0x2d'):_0x234a1d[_0x32f048]('voice:inbound');_0x234a1d[_0x32f048]('voice:outbound');if(queryQueues[_0x43e2('0x2e')](_0x43e2('0x2f'))){delete queryQueues[_0x43e2('0x2f')];}_0x3d8e16[_0x43e2('0x30')](db[_0x43e2('0x31')]['findAll'](queryQueues));_0x3d8e16[_0x43e2('0x30')](db[_0x43e2('0x32')][_0x43e2('0x14')](queryQueues));_0x3d8e16[_0x43e2('0x30')](db[_0x43e2('0x33')][_0x43e2('0x14')](queryQueues));_0x3d8e16[_0x43e2('0x30')](db['SmsQueue']['findAll'](queryQueues));_0x3d8e16[_0x43e2('0x30')](db[_0x43e2('0x34')]['findAll'](queryQueues));_0x3d8e16[_0x43e2('0x30')](db[_0x43e2('0x35')]['findAll'](queryQueues));_0x3d8e16[_0x43e2('0x30')](db['WhatsappQueue']['findAll'](queryQueues));_0x3d8e16['push'](db[_0x43e2('0x6')]['findAll'](queryTelephones));_0x3d8e16[_0x43e2('0x30')](db[_0x43e2('0x36')][_0x43e2('0x14')](queryTrunks));_0x3d8e16[_0x43e2('0x30')](db[_0x43e2('0x1b')][_0x43e2('0x14')](queryCampaigns));_0x3d8e16[_0x43e2('0x30')](db[_0x43e2('0x6')][_0x43e2('0x14')](queryAgents));break;case _0x43e2('0x37'):_0x234a1d[_0x32f048](_0x43e2('0x38'));_0x234a1d[_0x32f048](_0x43e2('0x39'));_0x3d8e16[_0x43e2('0x30')](getAssociatedResources(_0x43e2('0x3a'),_0x5a896b[_0x43e2('0x21')],_0x43e2('0x31')));_0x3d8e16[_0x43e2('0x30')](getAssociatedResources('ChatQueues',_0x5a896b['userProfileId'],'ChatQueue'));_0x3d8e16[_0x43e2('0x30')](getAssociatedResources(_0x43e2('0x3b'),_0x5a896b['userProfileId'],'FaxQueue'));_0x3d8e16[_0x43e2('0x30')](getAssociatedResources(_0x43e2('0x10'),_0x5a896b[_0x43e2('0x21')],_0x43e2('0x3c')));_0x3d8e16[_0x43e2('0x30')](getAssociatedResources(_0x43e2('0x11'),_0x5a896b[_0x43e2('0x21')],_0x43e2('0x34')));_0x3d8e16[_0x43e2('0x30')](getAssociatedResources(_0x43e2('0x12'),_0x5a896b[_0x43e2('0x21')],_0x43e2('0x35')));_0x3d8e16[_0x43e2('0x30')](getAssociatedResources(_0x43e2('0x13'),_0x5a896b['userProfileId'],_0x43e2('0x3d')));_0x3d8e16['push'](getAssociatedResources(_0x43e2('0x15'),_0x5a896b['userProfileId'],_0x43e2('0x6')));_0x3d8e16[_0x43e2('0x30')](getAssociatedResources(_0x43e2('0x16'),_0x5a896b['userProfileId'],_0x43e2('0x36')));_0x3d8e16['push'](getAssociatedResources(_0x43e2('0x17'),_0x5a896b[_0x43e2('0x21')],_0x43e2('0x1b')));_0x3d8e16[_0x43e2('0x30')](db['User']['findAll'](queryAgents));break;case _0x43e2('0x8'):_0x234a1d[_0x32f048](_0x43e2('0x38'));_0x234a1d[_0x32f048](_0x43e2('0x39'));_0x3d8e16[_0x43e2('0x30')](_0x5a896b['getVoiceQueues']({'attributes':['id',_0x43e2('0x9')]}));_0x3d8e16[_0x43e2('0x30')](_0x5a896b[_0x43e2('0x3e')]({'attributes':['id',_0x43e2('0x9')]}));_0x3d8e16[_0x43e2('0x30')](_0x5a896b['getFaxQueues']({'attributes':['id',_0x43e2('0x9')]}));_0x3d8e16['push'](_0x5a896b[_0x43e2('0x3f')]({'attributes':['id',_0x43e2('0x9')]}));_0x3d8e16['push'](_0x5a896b[_0x43e2('0x40')]({'attributes':['id','name']}));_0x3d8e16['push'](_0x5a896b[_0x43e2('0x41')]({'attributes':['id',_0x43e2('0x9')]}));_0x3d8e16[_0x43e2('0x30')](_0x5a896b[_0x43e2('0x42')]({'attributes':['id',_0x43e2('0x9')]}));break;}return BPromise['all'](_0x3d8e16);}})[_0x43e2('0xe')](function(_0x17aaa8){if(_0x17aaa8&&_0x17aaa8[_0x43e2('0x43')]){for(var _0xe5c04=0x0;_0xe5c04<_0x17aaa8[_0x43e2('0x43')];_0xe5c04+=0x1){for(var _0x4114ce=0x0;_0x4114ce<_0x17aaa8[_0xe5c04][_0x43e2('0x43')];_0x4114ce+=0x1){switch(_0xe5c04){case 0x0:joinOrLeaveQueues(_0x234a1d,_0x32f048,_0x43e2('0x44'),_0x17aaa8[_0xe5c04][_0x4114ce]);break;case 0x1:joinOrLeaveQueues(_0x234a1d,_0x32f048,'chat',_0x17aaa8[_0xe5c04][_0x4114ce]);break;case 0x2:joinOrLeaveQueues(_0x234a1d,_0x32f048,_0x43e2('0x45'),_0x17aaa8[_0xe5c04][_0x4114ce]);break;case 0x3:joinOrLeaveQueues(_0x234a1d,_0x32f048,_0x43e2('0x46'),_0x17aaa8[_0xe5c04][_0x4114ce]);break;case 0x4:joinOrLeaveQueues(_0x234a1d,_0x32f048,'mail',_0x17aaa8[_0xe5c04][_0x4114ce]);break;case 0x5:joinOrLeaveQueues(_0x234a1d,_0x32f048,_0x43e2('0x47'),_0x17aaa8[_0xe5c04][_0x4114ce]);break;case 0x6:joinOrLeaveQueues(_0x234a1d,_0x32f048,_0x43e2('0x48'),_0x17aaa8[_0xe5c04][_0x4114ce]);break;case 0x7:if(_0x11b285[_0x43e2('0x7')]!==_0x43e2('0x8'))_0x234a1d[_0x32f048](util['format'](_0x43e2('0x49'),_0x17aaa8[_0xe5c04][_0x4114ce][_0x43e2('0x9')]));break;case 0x8:if(_0x11b285[_0x43e2('0x7')]!==_0x43e2('0x8'))_0x234a1d[_0x32f048](util[_0x43e2('0x1d')]('trunk:%s',_0x17aaa8[_0xe5c04][_0x4114ce]['name']));break;case 0x9:if(_0x11b285[_0x43e2('0x7')]!==_0x43e2('0x8'))_0x234a1d[_0x32f048](util['format'](_0x43e2('0x4a'),_0x17aaa8[_0xe5c04][_0x4114ce][_0x43e2('0xb')],_0x17aaa8[_0xe5c04][_0x4114ce][_0x43e2('0x9')]));break;case 0xa:_0x234a1d[_0x32f048](util['format']('user:%s',_0x17aaa8[_0xe5c04][_0x4114ce][_0x43e2('0x9')]));break;}}}}})[_0x43e2('0xe')](function(){if(_0x32f048===_0x43e2('0x4b')){var _0x475e58=_[_0x43e2('0x4c')](_0x11b285[_0x43e2('0x24')],'id');return _0x11b285[_0x43e2('0x4d')](_0x475e58)[_0x43e2('0xe')](function(){for(var _0x2a0b40=0x0;_0x2a0b40<_0x475e58['length'];_0x2a0b40+=0x1){_0x43078f[_0x43e2('0x4e')]('user_has_chat_interactions:remove',{'ChatInteractionId':Number(_0x475e58[_0x2a0b40]),'UserId':Number(_0x11b285['id'])});}});}})[_0x43e2('0xe')](function(){if(_0x32f048===_0x43e2('0x4b')){var _0x2f8894=_['map'](_0x11b285[_0x43e2('0x26')],'id');return _0x11b285[_0x43e2('0x4f')](_0x2f8894)[_0x43e2('0xe')](function(){for(var _0x4621a6=0x0;_0x4621a6<_0x2f8894[_0x43e2('0x43')];_0x4621a6+=0x1){_0x43078f[_0x43e2('0x4e')](_0x43e2('0x50'),{'MailInteractionId':Number(_0x2f8894[_0x4621a6]),'UserId':Number(_0x11b285['id'])});}});}})[_0x43e2('0xe')](function(){if(_0x32f048===_0x43e2('0x4b')){var _0x408a97=_[_0x43e2('0x4c')](_0x11b285[_0x43e2('0x27')],'id');return _0x11b285[_0x43e2('0x51')](_0x408a97)['then'](function(){for(var _0x5c634e=0x0;_0x5c634e<_0x408a97['length'];_0x5c634e+=0x1){_0x43078f['emit']('user_has_fax_interactions:remove',{'FaxInteractionId':Number(_0x408a97[_0x5c634e]),'UserId':Number(_0x11b285['id'])});}});}})['then'](function(){if(_0x32f048===_0x43e2('0x4b')){var _0x54ab6e=_['map'](_0x11b285[_0x43e2('0x52')],'id');return _0x11b285['removeSmsInteractions'](_0x54ab6e)[_0x43e2('0xe')](function(){for(var _0x4940d3=0x0;_0x4940d3<_0x54ab6e[_0x43e2('0x43')];_0x4940d3+=0x1){_0x43078f[_0x43e2('0x4e')](_0x43e2('0x53'),{'SmsInteractionId':Number(_0x54ab6e[_0x4940d3]),'UserId':Number(_0x11b285['id'])});}});}})[_0x43e2('0xe')](function(){if(_0x32f048===_0x43e2('0x4b')){var _0x13685a=_[_0x43e2('0x4c')](_0x11b285[_0x43e2('0x2a')],'id');return _0x11b285[_0x43e2('0x54')](_0x13685a)[_0x43e2('0xe')](function(){for(var _0x5ab16e=0x0;_0x5ab16e<_0x13685a[_0x43e2('0x43')];_0x5ab16e+=0x1){_0x43078f[_0x43e2('0x4e')]('user_has_openchannel_interactions:remove',{'OpenchannelInteractionId':Number(_0x13685a[_0x5ab16e]),'UserId':Number(_0x11b285['id'])});}});}})[_0x43e2('0xe')](function(){if(_0x32f048==='leave'){var _0x5d6c3d=_['map'](_0x11b285['WhatsappInteractions'],'id');return _0x11b285['removeWhatsappInteractions'](_0x5d6c3d)[_0x43e2('0xe')](function(){for(var _0x1eb3b1=0x0;_0x1eb3b1<_0x5d6c3d[_0x43e2('0x43')];_0x1eb3b1+=0x1){_0x43078f[_0x43e2('0x4e')]('user_has_whatsapp_interactions:remove',{'WhatsappInteractionId':Number(_0x5d6c3d[_0x1eb3b1]),'UserId':Number(_0x11b285['id'])});}});}})['catch'](function(_0x4145fd){_0x234a1d[_0x43e2('0x55')](_0x4145fd);});}}function onDisconnect(_0x9a221f,_0x2eb6e7){joinOrLeave(_0x9a221f,_0x43e2('0x4b'),_0x2eb6e7);}function onConnect(_0x25037d){joinOrLeave(_0x25037d,_0x43e2('0x56'));}exports[_0x43e2('0x57')]=function(_0x2eb2aa){_0x2eb2aa['on'](_0x43e2('0x58'),function(_0x1dd8c8){_0x1dd8c8['setMaxListeners'](0x0);_0x1dd8c8[_0x43e2('0x59')]=_0x1dd8c8[_0x43e2('0x5a')][_0x43e2('0x58')][_0x43e2('0x5b')]+':'+_0x1dd8c8[_0x43e2('0x5a')]['connection'][_0x43e2('0x5c')];_0x1dd8c8[_0x43e2('0x5d')]=new Date();_0x1dd8c8['log']=function(_0x137d0c){console['log'](_0x43e2('0x5e')+_0x1dd8c8[_0x43e2('0x5f')][_0x43e2('0x9')]+'['+_0x1dd8c8[_0x43e2('0x59')]+']',_0x137d0c);};_0x1dd8c8['on'](_0x43e2('0x60'),function(){onDisconnect(_0x1dd8c8,_0x2eb2aa);_0x1dd8c8[_0x43e2('0x55')](_0x43e2('0x61'));});onConnect(_0x1dd8c8);_0x1dd8c8[_0x43e2('0x55')](_0x43e2('0x62'));});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index 7ad34ec..8c71a60 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 _0x2ec9=['QueryTypes','contact','UserId','interface','SIP/%s','name','agent','incomingmessage','outgoingmessage','AfterCreateMessage','get','opened','query','format','changed','substatus','closed','SELECT','AfterUpdate','User','find','fullname','email','length','model','hook','callback','condition','util','jayson/promise','http','Chat','afterCreate','newinteraction','ChatInteraction','afterUpdate','closedinteraction','newmessage','ChatOfflineMessage','SmsInteraction','Sms','Whatsapp','WhatsappInteraction','WhatsappMessage','FaxInteraction','Fax','Mail','MailInteraction','MailMessage','Openchannel','OpenchannelInteraction','OpenchannelMessage','request','info','Trigger,\x20%s','error','EventManager','catch','channel','motionChannel','event','direction','resolve','then','ContactId','undefined','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize'];(function(_0x23c262,_0x74765a){var _0x9b913f=function(_0x3ecb98){while(--_0x3ecb98){_0x23c262['push'](_0x23c262['shift']());}};_0x9b913f(++_0x74765a);}(_0x2ec9,0xa6));var _0x92ec=function(_0x16e50a,_0x5aec08){_0x16e50a=_0x16e50a-0x0;var _0x1bf2b6=_0x2ec9[_0x16e50a];return _0x1bf2b6;};'use strict';var util=require(_0x92ec('0x0'));var db=require('../../mysqldb')['db'];var jayson=require(_0x92ec('0x1'));var logger=require('../logger')('triggers');var client=jayson['client'][_0x92ec('0x2')]({'port':0x232a});var triggers=[{'channel':_0x92ec('0x3'),'model':'ChatInteraction','event':_0x92ec('0x4'),'condition':_0x92ec('0x5'),'callback':afterCreate},{'channel':_0x92ec('0x3'),'model':_0x92ec('0x6'),'event':_0x92ec('0x7'),'condition':_0x92ec('0x8'),'callback':afterUpdate},{'channel':_0x92ec('0x3'),'model':'ChatMessage','event':'afterCreate','condition':_0x92ec('0x9'),'callback':afterCreateMessage},{'channel':_0x92ec('0x3'),'model':_0x92ec('0xa'),'event':_0x92ec('0x4'),'condition':_0x92ec('0x9'),'callback':afterCreateOfflineMessage},{'channel':'Sms','model':_0x92ec('0xb'),'event':_0x92ec('0x4'),'condition':_0x92ec('0x5'),'callback':afterCreate},{'channel':_0x92ec('0xc'),'model':'SmsInteraction','event':_0x92ec('0x7'),'condition':_0x92ec('0x8'),'callback':afterUpdate},{'channel':_0x92ec('0xc'),'model':'SmsMessage','event':_0x92ec('0x4'),'condition':_0x92ec('0x9'),'callback':afterCreateMessage},{'channel':_0x92ec('0xd'),'model':_0x92ec('0xe'),'event':_0x92ec('0x4'),'condition':_0x92ec('0x5'),'callback':afterCreate},{'channel':'Whatsapp','model':_0x92ec('0xe'),'event':'afterUpdate','condition':_0x92ec('0x8'),'callback':afterUpdate},{'channel':_0x92ec('0xd'),'model':_0x92ec('0xf'),'event':_0x92ec('0x4'),'condition':'newmessage','callback':afterCreateMessage},{'channel':'Fax','model':_0x92ec('0x10'),'event':_0x92ec('0x4'),'condition':_0x92ec('0x5'),'callback':afterCreate},{'channel':_0x92ec('0x11'),'model':_0x92ec('0x10'),'event':_0x92ec('0x7'),'condition':_0x92ec('0x8'),'callback':afterUpdate},{'channel':_0x92ec('0x11'),'model':'FaxMessage','event':_0x92ec('0x4'),'condition':'newmessage','callback':afterCreateMessage},{'channel':_0x92ec('0x12'),'model':_0x92ec('0x13'),'event':_0x92ec('0x4'),'condition':_0x92ec('0x5'),'callback':afterCreate},{'channel':_0x92ec('0x12'),'model':_0x92ec('0x13'),'event':_0x92ec('0x7'),'condition':_0x92ec('0x8'),'callback':afterUpdate},{'channel':_0x92ec('0x12'),'model':_0x92ec('0x14'),'event':_0x92ec('0x4'),'condition':_0x92ec('0x9'),'callback':afterCreateMessage},{'channel':_0x92ec('0x15'),'model':_0x92ec('0x16'),'event':'afterCreate','condition':_0x92ec('0x5'),'callback':afterCreate},{'channel':_0x92ec('0x15'),'model':_0x92ec('0x16'),'event':_0x92ec('0x7'),'condition':_0x92ec('0x8'),'callback':afterUpdate},{'channel':_0x92ec('0x15'),'model':_0x92ec('0x17'),'event':_0x92ec('0x4'),'condition':_0x92ec('0x9'),'callback':afterCreateMessage}];function request(_0x13a121){return client[_0x92ec('0x18')]('EventManager',_0x13a121)['then'](function(_0x2f427c){logger[_0x92ec('0x19')](_0x92ec('0x1a'),'EventManager',_0x2f427c);if(_0x2f427c['error']){if(_0x2f427c[_0x92ec('0x1b')]['code']===0x1f4){logger[_0x92ec('0x1b')](_0x92ec('0x1a'),_0x92ec('0x1c'),_0x2f427c[_0x92ec('0x1b')]);}}})[_0x92ec('0x1d')](function(_0x18b0f2){logger['error']('Trigger,\x20%s','EventManager',_0x18b0f2);});}function afterCreateMessage(_0x2109f4){return function(_0x1d3da7){_0x1d3da7=_0x1d3da7['get']({'plain':!![]});_0x1d3da7[_0x92ec('0x1e')]=_0x2109f4;_0x1d3da7[_0x92ec('0x1f')]=_0x2109f4;_0x1d3da7[_0x92ec('0x20')]=_0x1d3da7[_0x92ec('0x21')];Promise[_0x92ec('0x22')]()[_0x92ec('0x23')](function(){if(typeof _0x1d3da7[_0x92ec('0x24')]===_0x92ec('0x25'))return null;var _0x148bdb=_0x92ec('0x26')+_0x1d3da7[_0x92ec('0x24')];return db[_0x92ec('0x27')]['query'](_0x148bdb,{'type':db[_0x92ec('0x28')][_0x92ec('0x29')]['SELECT'],'raw':!![]});})['then'](function(_0x4ed595){if(_0x4ed595){_0x1d3da7[_0x92ec('0x2a')]=_0x4ed595[0x0];}if(typeof _0x1d3da7[_0x92ec('0x2b')]===_0x92ec('0x25'))return;return getAgent(_0x1d3da7['UserId']);})[_0x92ec('0x23')](function(_0x3eafac){if(_0x3eafac){_0x1d3da7[_0x92ec('0x2c')]=util['format'](_0x92ec('0x2d'),_0x3eafac[_0x92ec('0x2e')]);_0x1d3da7[_0x92ec('0x2f')]=_0x3eafac;_0x1d3da7['channel']=_0x2109f4;return request({'event':_0x92ec('0x30'),'message':_0x1d3da7});}else{return request({'event':_0x92ec('0x31'),'message':_0x1d3da7});}})[_0x92ec('0x1d')](function(_0x16a211){logger['error'](_0x92ec('0x1a'),_0x92ec('0x32'),_0x16a211);});};}function afterCreateOfflineMessage(_0x462ab1){return function(_0x438403){_0x438403=_0x438403['get']({'plain':!![]});_0x438403['channel']=_0x462ab1;_0x438403['motionChannel']=_0x462ab1;_0x438403[_0x92ec('0x20')]='offlineMessage';return request({'event':_0x438403['event'],'message':_0x438403});};}function afterCreate(_0x1042cd,_0x5a2470){return function(_0xaaffa0){_0xaaffa0=_0xaaffa0[_0x92ec('0x33')]({'plain':!![]});_0xaaffa0['channel']=_0x1042cd;_0xaaffa0['motionChannel']=_0x1042cd;_0xaaffa0[_0x92ec('0x20')]=_0x92ec('0x34');Promise['resolve']()[_0x92ec('0x23')](function(){var _0x18607d=_0x92ec('0x26')+_0xaaffa0['ContactId'];return db[_0x92ec('0x27')][_0x92ec('0x35')](_0x18607d,{'type':db[_0x92ec('0x28')][_0x92ec('0x29')]['SELECT'],'raw':!![]});})[_0x92ec('0x23')](function(_0x1dcbd5){if(_0x1dcbd5){_0xaaffa0[_0x92ec('0x2a')]=_0x1dcbd5[0x0];}if(typeof _0xaaffa0[_0x92ec('0x2b')]===_0x92ec('0x25'))return;return getAgent(_0xaaffa0['UserId']);})['then'](function(_0xb63cde){if(_0xb63cde){_0xaaffa0[_0x92ec('0x2c')]=util[_0x92ec('0x36')](_0x92ec('0x2d'),_0xb63cde['name']);_0xaaffa0[_0x92ec('0x2f')]=_0xb63cde;}return request({'event':_0x5a2470,'message':_0xaaffa0});})[_0x92ec('0x1d')](function(_0x5b48ea){logger[_0x92ec('0x1b')](_0x92ec('0x1a'),'AfterCreate',_0x5b48ea);});};}function afterUpdate(_0x4ab55c){return function(_0x25c32b){var _0x4bf9d6=_0x25c32b['changed']('closed')&&_0x25c32b['closed'];var _0x5fbcec=_0x25c32b[_0x92ec('0x37')](_0x92ec('0x38'));if(_0x4bf9d6||_0x5fbcec){var _0x3f01ef=_0x4bf9d6?_0x92ec('0x8'):'substatus';var _0x1becf3=_0x25c32b[_0x92ec('0x33')]({'plain':!![]});_0x1becf3[_0x92ec('0x1e')]=_0x4ab55c;_0x1becf3[_0x92ec('0x1f')]=_0x4ab55c;_0x1becf3['event']=_0x4bf9d6?_0x92ec('0x39'):_0x92ec('0x38');var _0x5de736=_0x92ec('0x26')+_0x1becf3[_0x92ec('0x24')];return db[_0x92ec('0x27')][_0x92ec('0x35')](_0x5de736,{'type':db['Sequelize'][_0x92ec('0x29')][_0x92ec('0x3a')],'raw':!![]})['then'](function(_0x544558){if(_0x544558){_0x1becf3[_0x92ec('0x2a')]=_0x544558[0x0];}if(typeof _0x1becf3[_0x92ec('0x2b')]===_0x92ec('0x25'))return;return getAgent(_0x1becf3[_0x92ec('0x2b')]);})[_0x92ec('0x23')](function(_0x4ea315){if(_0x4ea315){_0x1becf3[_0x92ec('0x2c')]=util[_0x92ec('0x36')](_0x92ec('0x2d'),_0x4ea315[_0x92ec('0x2e')]);_0x1becf3[_0x92ec('0x2f')]=_0x4ea315;}return request({'event':_0x3f01ef,'message':_0x1becf3});})[_0x92ec('0x1d')](function(_0x590514){logger[_0x92ec('0x1b')]('Trigger,\x20%s',_0x92ec('0x3b'),_0x590514);});}};}function getAgent(_0x2196bc){return db[_0x92ec('0x3c')][_0x92ec('0x3d')]({'where':{'id':_0x2196bc},'attributes':['id',_0x92ec('0x2e'),_0x92ec('0x3e'),_0x92ec('0x3f'),'internal'],'raw':!![]})[_0x92ec('0x23')](function(_0x5167f3){return _0x5167f3;});}exports['default']=function(){for(var _0x9fa815=0x0;_0x9fa815=_0x54f116[_0x1632('0x10')]){throw Error('Maximum\x20login\x20has\x20been\x20reached');}_0x43c0f6(_0x4a7982);})[_0x1632('0x11')](function(_0x51d848){_0x39a50a(_0x51d848);});});}; \ No newline at end of file +var _0xf243=['openchannel','getChannels','isValidChannel','toLowerCase','includes','isUndefined','blockedAt','updateAttributes','getLicense','role','User','count','then','agents','mail','chat','fax','sms'];(function(_0x3c6f3b,_0x56cac4){var _0x299086=function(_0x4c8ded){while(--_0x4c8ded){_0x3c6f3b['push'](_0x3c6f3b['shift']());}};_0x299086(++_0x56cac4);}(_0xf243,0x188));var _0x3f24=function(_0x489618,_0x233987){_0x489618=_0x489618-0x0;var _0x3d34b8=_0xf243[_0x489618];return _0x3d34b8;};'use strict';var _=require('lodash');var BPromise=require('bluebird');var db=require('../mysqldb')['db'];var util=require('./license/util');var channels=['voice',_0x3f24('0x0'),_0x3f24('0x1'),_0x3f24('0x2'),_0x3f24('0x3'),'whatsapp',_0x3f24('0x4')];exports[_0x3f24('0x5')]=function(){return channels;};exports[_0x3f24('0x6')]=function(_0x1f1690){_0x1f1690=_0x1f1690[_0x3f24('0x7')]();return _[_0x3f24('0x8')](channels,_0x1f1690);};exports['clearBlockUser']=function(_0x22ebf5,_0x54dd14,_0x4f567f,_0x2f6ae6){var _0x320fbf={'loginAttempts':_0x54dd14,'blocked':_0x4f567f};if(!_[_0x3f24('0x9')](_0x2f6ae6)){_0x320fbf[_0x3f24('0xa')]=_0x2f6ae6;}return _0x22ebf5[_0x3f24('0xb')](_0x320fbf);};exports[_0x3f24('0xc')]=function(_0x4c9197){return new BPromise(function(_0x582516,_0x3532ed){var _0x1691e2=0x0;if(_0x4c9197[_0x3f24('0xd')]!=='agent'){_0x582516(_0x4c9197);}db[_0x3f24('0xe')][_0x3f24('0xf')]({'where':{'role':'agent','online':!![],'id':{'$ne':_0x4c9197['id']}}})[_0x3f24('0x10')](function(_0x113901){_0x1691e2=_0x113901;return util[_0x3f24('0xc')]();})[_0x3f24('0x10')](function(_0x23e08a){if(_0x23e08a&&_0x23e08a[_0x3f24('0x11')]&&_0x1691e2>=_0x23e08a[_0x3f24('0x11')]){throw Error('Maximum\x20login\x20has\x20been\x20reached');}_0x582516(_0x4c9197);})['catch'](function(_0x4904dd){_0x3532ed(_0x4904dd);});});}; \ No newline at end of file diff --git a/server/errors/api.js b/server/errors/api.js index 6555064..e45a74d 100644 --- a/server/errors/api.js +++ b/server/errors/api.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x814b=['statusMessage','status','send','exports','util','../config/logger','api','message','name','Error','inherits','Bad\x20Request','Entity\x20not\x20found','Not\x20Found','Message\x20sent\x20outside\x20a\x20valid\x20interval','Out\x20Of\x20Interval','error','stack'];(function(_0x47b493,_0x429ada){var _0xb7f5be=function(_0x20eb88){while(--_0x20eb88){_0x47b493['push'](_0x47b493['shift']());}};_0xb7f5be(++_0x429ada);}(_0x814b,0x1a2));var _0xb814=function(_0x21c068,_0x369d6a){_0x21c068=_0x21c068-0x0;var _0x5cf199=_0x814b[_0x21c068];return _0x5cf199;};'use strict';var util=require(_0xb814('0x0'));var logger=require(_0xb814('0x1'))(_0xb814('0x2'));var APIError=function(_0x2f4ece,_0xfbb64b){this[_0xb814('0x3')]=_0x2f4ece||'Internal\x20Server\x20Error';this[_0xb814('0x4')]=_0xfbb64b||_0xb814('0x5');util[_0xb814('0x6')](APIError,Error);};var APIBadRequestError=function(_0x4237bc){this[_0xb814('0x3')]=_0x4237bc||_0xb814('0x7');this['name']=_0xb814('0x7');util[_0xb814('0x6')](APIBadRequestError,APIError);};var APINotFoundError=function(_0x5c8539){this[_0xb814('0x3')]=_0x5c8539||_0xb814('0x8');this[_0xb814('0x4')]=_0xb814('0x9');util[_0xb814('0x6')](APINotFoundError,APIError);};var APIOutOfIntervalError=function(_0x21d4a5){this[_0xb814('0x3')]=_0x21d4a5||_0xb814('0xa');this[_0xb814('0x4')]=_0xb814('0xb');util[_0xb814('0x6')](APIOutOfIntervalError,APIError);};function getStatusCode(_0x4b5f14){switch(_0x4b5f14){case _0xb814('0x7'):return 0x190;case'Forbidden',_0xb814('0xb'):return 0x193;case _0xb814('0x9'):return 0x194;default:return 0x1f4;}}function getCustomStatusMessage(_0x35b10d){if(_0x35b10d===_0xb814('0xb'))return _0x35b10d;return null;}function handleError(_0x2ce718){return function(_0x3bde14){logger[_0xb814('0xc')](_0x3bde14[_0xb814('0xd')]);var _0xa0a2e5=getStatusCode(_0x3bde14[_0xb814('0x4')]);var _0x3f4881=getCustomStatusMessage(_0x3bde14[_0xb814('0x4')]);if(_0x3bde14[_0xb814('0x4')])delete _0x3bde14[_0xb814('0x4')];if(_0x3f4881)_0x2ce718[_0xb814('0xe')]=_0x3f4881;return _0x2ce718[_0xb814('0xf')](_0xa0a2e5)[_0xb814('0x10')](_0x3bde14);};}module[_0xb814('0x11')]={'APIError':APIError,'APIBadRequestError':APIBadRequestError,'APIOutOfIntervalError':APIOutOfIntervalError,'APINotFoundError':APINotFoundError,'handleError':handleError}; \ No newline at end of file +var _0x7a54=['Bad\x20Request','Forbidden','Out\x20Of\x20Interval','Not\x20Found','error','stack','statusMessage','status','send','exports','util','../config/logger','api','message','name','Error','inherits','Entity\x20not\x20found'];(function(_0x6ed2db,_0x3e73b5){var _0x1c64be=function(_0x393fb3){while(--_0x393fb3){_0x6ed2db['push'](_0x6ed2db['shift']());}};_0x1c64be(++_0x3e73b5);}(_0x7a54,0x106));var _0x47a5=function(_0x5b2bb4,_0x4e6dc5){_0x5b2bb4=_0x5b2bb4-0x0;var _0x4a1406=_0x7a54[_0x5b2bb4];return _0x4a1406;};'use strict';var util=require(_0x47a5('0x0'));var logger=require(_0x47a5('0x1'))(_0x47a5('0x2'));var APIError=function(_0x58157c,_0x1d33e){this[_0x47a5('0x3')]=_0x58157c||'Internal\x20Server\x20Error';this[_0x47a5('0x4')]=_0x1d33e||_0x47a5('0x5');util[_0x47a5('0x6')](APIError,Error);};var APIBadRequestError=function(_0x3717e1){this[_0x47a5('0x3')]=_0x3717e1||'Bad\x20Request';this[_0x47a5('0x4')]='Bad\x20Request';util[_0x47a5('0x6')](APIBadRequestError,APIError);};var APINotFoundError=function(_0x30e405){this['message']=_0x30e405||_0x47a5('0x7');this['name']='Not\x20Found';util['inherits'](APINotFoundError,APIError);};var APIOutOfIntervalError=function(_0x2a0e98){this[_0x47a5('0x3')]=_0x2a0e98||'Message\x20sent\x20outside\x20a\x20valid\x20interval';this[_0x47a5('0x4')]='Out\x20Of\x20Interval';util['inherits'](APIOutOfIntervalError,APIError);};function getStatusCode(_0x1f47f4){switch(_0x1f47f4){case _0x47a5('0x8'):return 0x190;case _0x47a5('0x9'),_0x47a5('0xa'):return 0x193;case _0x47a5('0xb'):return 0x194;default:return 0x1f4;}}function getCustomStatusMessage(_0xd308b8){if(_0xd308b8===_0x47a5('0xa'))return _0xd308b8;return null;}function handleError(_0x5beb89){return function(_0x44bd3e){logger[_0x47a5('0xc')](_0x44bd3e[_0x47a5('0xd')]);var _0x711793=getStatusCode(_0x44bd3e[_0x47a5('0x4')]);var _0x620ee9=getCustomStatusMessage(_0x44bd3e[_0x47a5('0x4')]);if(_0x44bd3e[_0x47a5('0x4')])delete _0x44bd3e['name'];if(_0x620ee9)_0x5beb89[_0x47a5('0xe')]=_0x620ee9;return _0x5beb89[_0x47a5('0xf')](_0x711793)[_0x47a5('0x10')](_0x44bd3e);};}module[_0x47a5('0x11')]={'APIError':APIError,'APIBadRequestError':APIBadRequestError,'APIOutOfIntervalError':APIOutOfIntervalError,'APINotFoundError':APINotFoundError,'handleError':handleError}; \ No newline at end of file diff --git a/server/errors/index.js b/server/errors/index.js index f40cd29..104323d 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6eb8=['exports','404','status','json','send'];(function(_0x542c91,_0x30cf38){var _0x2ddb1f=function(_0x3c2183){while(--_0x3c2183){_0x542c91['push'](_0x542c91['shift']());}};_0x2ddb1f(++_0x30cf38);}(_0x6eb8,0xeb));var _0x86eb=function(_0x3e9c0a,_0x401e67){_0x3e9c0a=_0x3e9c0a-0x0;var _0x53e838=_0x6eb8[_0x3e9c0a];return _0x53e838;};'use strict';module[_0x86eb('0x0')][0x194]=function pageNotFound(_0xeb5e9,_0x528214){var _0x3806b5=_0x86eb('0x1');var _0x572377=0x194;var _0x2c209b={'status':_0x572377};_0x528214[_0x86eb('0x2')](_0x2c209b[_0x86eb('0x2')]);_0x528214['render'](_0x3806b5,{},function(_0x1900a8,_0x280198){if(_0x1900a8){return _0x528214[_0x86eb('0x2')](_0x2c209b[_0x86eb('0x2')])[_0x86eb('0x3')](_0x2c209b);}_0x528214[_0x86eb('0x4')](_0x280198);});}; \ No newline at end of file +var _0x49f5=['json','exports','404','status','render'];(function(_0x5c3e2e,_0x3c59a4){var _0x3a3883=function(_0x2b6caf){while(--_0x2b6caf){_0x5c3e2e['push'](_0x5c3e2e['shift']());}};_0x3a3883(++_0x3c59a4);}(_0x49f5,0x18c));var _0x549f=function(_0x375233,_0x165da0){_0x375233=_0x375233-0x0;var _0xb1fac5=_0x49f5[_0x375233];return _0xb1fac5;};'use strict';module[_0x549f('0x0')][0x194]=function pageNotFound(_0x23b763,_0x55f9d8){var _0x369711=_0x549f('0x1');var _0x2a1857=0x194;var _0x752caa={'status':_0x2a1857};_0x55f9d8[_0x549f('0x2')](_0x752caa['status']);_0x55f9d8[_0x549f('0x3')](_0x369711,{},function(_0x14acd0,_0x106a87){if(_0x14acd0){return _0x55f9d8[_0x549f('0x2')](_0x752caa[_0x549f('0x2')])[_0x549f('0x4')](_0x752caa);}_0x55f9d8['send'](_0x106a87);});}; \ No newline at end of file diff --git a/server/migrations/2.6.20.js b/server/migrations/2.6.20.js deleted file mode 100644 index a59425a..0000000 --- a/server/migrations/2.6.20.js +++ /dev/null @@ -1,169 +0,0 @@ -'use strict'; - -var BPromise = require('bluebird'); -var util = require('util'); -var logger = require('../config/logger')('migration'); -var Sequence = function() {}; - -Sequence.prototype.enqueue = function(fn) { - this.tail = this.tail ? this.tail.finally(fn) : fn(); -}; - -var Migration = function(queryInterface) { - this.queryInterface = queryInterface; - this.sequence = new Sequence(); -}; - -Migration.prototype.changeColumn = function(table, column, type) { - var _this = this; - this.sequence.enqueue(function() { - return _this.queryInterface - .changeColumn(table, column, type) - .then(function() { - logger.info('Changed column %s in table %s', column, table); - }) - .catch(function(err) { - logger.info(JSON.stringify(err)); - }); - }); -}; - -Migration.prototype.addColumn = function(table, column, type) { - var _this = this; - this.sequence.enqueue(function() { - return _this.queryInterface - .addColumn(table, column, type) - .then(function() { - logger.info('Added column %s to %s', column, table); - }) - .catch(function(err) { - logger.info(JSON.stringify(err)); - }); - }); -}; - -Migration.prototype.dropTable = function(table) { - var _this = this; - this.sequence.enqueue(function() { - return _this.queryInterface - .dropTable(table, { - force: true, - }) - .then(function() { - logger.info('table dropped %s', table); - }) - .catch(function(err) { - logger.info(JSON.stringify(err)); - }); - }); -}; - -Migration.prototype.addIndex = function(table, column, indexName) { - var _this = this; - this.sequence.enqueue(function() { - return _this.queryInterface - .addIndex(table, column, { - indexName: indexName, - }) - .then(function() { - logger.info('addIndex %s %s %s', table, column.join(','), indexName); - }) - .catch(function(err) { - logger.info(JSON.stringify(err)); - }); - }); -}; - -Migration.prototype.removeIndex = function(table, indexName) { - var _this = this; - this.sequence.enqueue(function() { - return _this.queryInterface - .removeIndex(table, indexName) - .then(function() { - logger.info('removeIndex %s %s', table, indexName); - }) - .catch(function(err) { - logger.info(JSON.stringify(err)); - }); - }); -}; - -Migration.prototype.query = function(sql) { - var _this = this; - this.sequence.enqueue(function() { - return _this.queryInterface.sequelize - .query(sql) - .then(function() { - logger.info('query %s', sql); - }) - .catch(function(err) { - logger.info(JSON.stringify(err)); - }); - }); -}; - -Migration.prototype.removeColumn = function(table, column) { - var _this = this; - this.sequence.enqueue(function() { - return _this.queryInterface - .removeColumn(table, column) - .then(function() { - logger.info('Removed column %s from %s', column, table); - }) - .catch(function(err) { - logger.info( - util.inspect(err, { - showHidden: false, - depth: null, - }) - ); - }); - }); -}; - -Migration.prototype.renameColumn = function(table, oldColumn, newColumn) { - var _this = this; - this.sequence.enqueue(function() { - return _this.queryInterface - .renameColumn(table, oldColumn, newColumn) - .then(function() { - logger.info( - 'Renamed column from %s to %s on %s', - oldColumn, - newColumn, - table - ); - }) - .catch(function(err) { - logger.info( - util.inspect(err, { - showHidden: false, - depth: null, - }) - ); - }); - }); -}; - -Migration.prototype.final = function(resolve) { - this.sequence.enqueue(function() { - return resolve(); - }); -}; - -module.exports = { - up: function(queryInterface /*, Sequelize */) { - return new BPromise(function(resolve) { - var migration = new Migration(queryInterface); - // Add your migration code here - - // START FINAL - migration.final(resolve); - // END FINAL - }); - }, - - down: function( /* queryInterface, Sequelize */ ) { - // var migration = new Migration(queryInterface); - }, -}; \ No newline at end of file diff --git a/server/migrations/2.6.21.js b/server/migrations/2.6.21.js deleted file mode 100644 index a59425a..0000000 --- a/server/migrations/2.6.21.js +++ /dev/null @@ -1,169 +0,0 @@ -'use strict'; - -var BPromise = require('bluebird'); -var util = require('util'); -var logger = require('../config/logger')('migration'); -var Sequence = function() {}; - -Sequence.prototype.enqueue = function(fn) { - this.tail = this.tail ? this.tail.finally(fn) : fn(); -}; - -var Migration = function(queryInterface) { - this.queryInterface = queryInterface; - this.sequence = new Sequence(); -}; - -Migration.prototype.changeColumn = function(table, column, type) { - var _this = this; - this.sequence.enqueue(function() { - return _this.queryInterface - .changeColumn(table, column, type) - .then(function() { - logger.info('Changed column %s in table %s', column, table); - }) - .catch(function(err) { - logger.info(JSON.stringify(err)); - }); - }); -}; - -Migration.prototype.addColumn = function(table, column, type) { - var _this = this; - this.sequence.enqueue(function() { - return _this.queryInterface - .addColumn(table, column, type) - .then(function() { - logger.info('Added column %s to %s', column, table); - }) - .catch(function(err) { - logger.info(JSON.stringify(err)); - }); - }); -}; - -Migration.prototype.dropTable = function(table) { - var _this = this; - this.sequence.enqueue(function() { - return _this.queryInterface - .dropTable(table, { - force: true, - }) - .then(function() { - logger.info('table dropped %s', table); - }) - .catch(function(err) { - logger.info(JSON.stringify(err)); - }); - }); -}; - -Migration.prototype.addIndex = function(table, column, indexName) { - var _this = this; - this.sequence.enqueue(function() { - return _this.queryInterface - .addIndex(table, column, { - indexName: indexName, - }) - .then(function() { - logger.info('addIndex %s %s %s', table, column.join(','), indexName); - }) - .catch(function(err) { - logger.info(JSON.stringify(err)); - }); - }); -}; - -Migration.prototype.removeIndex = function(table, indexName) { - var _this = this; - this.sequence.enqueue(function() { - return _this.queryInterface - .removeIndex(table, indexName) - .then(function() { - logger.info('removeIndex %s %s', table, indexName); - }) - .catch(function(err) { - logger.info(JSON.stringify(err)); - }); - }); -}; - -Migration.prototype.query = function(sql) { - var _this = this; - this.sequence.enqueue(function() { - return _this.queryInterface.sequelize - .query(sql) - .then(function() { - logger.info('query %s', sql); - }) - .catch(function(err) { - logger.info(JSON.stringify(err)); - }); - }); -}; - -Migration.prototype.removeColumn = function(table, column) { - var _this = this; - this.sequence.enqueue(function() { - return _this.queryInterface - .removeColumn(table, column) - .then(function() { - logger.info('Removed column %s from %s', column, table); - }) - .catch(function(err) { - logger.info( - util.inspect(err, { - showHidden: false, - depth: null, - }) - ); - }); - }); -}; - -Migration.prototype.renameColumn = function(table, oldColumn, newColumn) { - var _this = this; - this.sequence.enqueue(function() { - return _this.queryInterface - .renameColumn(table, oldColumn, newColumn) - .then(function() { - logger.info( - 'Renamed column from %s to %s on %s', - oldColumn, - newColumn, - table - ); - }) - .catch(function(err) { - logger.info( - util.inspect(err, { - showHidden: false, - depth: null, - }) - ); - }); - }); -}; - -Migration.prototype.final = function(resolve) { - this.sequence.enqueue(function() { - return resolve(); - }); -}; - -module.exports = { - up: function(queryInterface /*, Sequelize */) { - return new BPromise(function(resolve) { - var migration = new Migration(queryInterface); - // Add your migration code here - - // START FINAL - migration.final(resolve); - // END FINAL - }); - }, - - down: function( /* queryInterface, Sequelize */ ) { - // var migration = new Migration(queryInterface); - }, -}; \ No newline at end of file diff --git a/server/migrations/2.6.22.js b/server/migrations/2.6.22.js deleted file mode 100644 index a59425a..0000000 --- a/server/migrations/2.6.22.js +++ /dev/null @@ -1,169 +0,0 @@ -'use strict'; - -var BPromise = require('bluebird'); -var util = require('util'); -var logger = require('../config/logger')('migration'); -var Sequence = function() {}; - -Sequence.prototype.enqueue = function(fn) { - this.tail = this.tail ? this.tail.finally(fn) : fn(); -}; - -var Migration = function(queryInterface) { - this.queryInterface = queryInterface; - this.sequence = new Sequence(); -}; - -Migration.prototype.changeColumn = function(table, column, type) { - var _this = this; - this.sequence.enqueue(function() { - return _this.queryInterface - .changeColumn(table, column, type) - .then(function() { - logger.info('Changed column %s in table %s', column, table); - }) - .catch(function(err) { - logger.info(JSON.stringify(err)); - }); - }); -}; - -Migration.prototype.addColumn = function(table, column, type) { - var _this = this; - this.sequence.enqueue(function() { - return _this.queryInterface - .addColumn(table, column, type) - .then(function() { - logger.info('Added column %s to %s', column, table); - }) - .catch(function(err) { - logger.info(JSON.stringify(err)); - }); - }); -}; - -Migration.prototype.dropTable = function(table) { - var _this = this; - this.sequence.enqueue(function() { - return _this.queryInterface - .dropTable(table, { - force: true, - }) - .then(function() { - logger.info('table dropped %s', table); - }) - .catch(function(err) { - logger.info(JSON.stringify(err)); - }); - }); -}; - -Migration.prototype.addIndex = function(table, column, indexName) { - var _this = this; - this.sequence.enqueue(function() { - return _this.queryInterface - .addIndex(table, column, { - indexName: indexName, - }) - .then(function() { - logger.info('addIndex %s %s %s', table, column.join(','), indexName); - }) - .catch(function(err) { - logger.info(JSON.stringify(err)); - }); - }); -}; - -Migration.prototype.removeIndex = function(table, indexName) { - var _this = this; - this.sequence.enqueue(function() { - return _this.queryInterface - .removeIndex(table, indexName) - .then(function() { - logger.info('removeIndex %s %s', table, indexName); - }) - .catch(function(err) { - logger.info(JSON.stringify(err)); - }); - }); -}; - -Migration.prototype.query = function(sql) { - var _this = this; - this.sequence.enqueue(function() { - return _this.queryInterface.sequelize - .query(sql) - .then(function() { - logger.info('query %s', sql); - }) - .catch(function(err) { - logger.info(JSON.stringify(err)); - }); - }); -}; - -Migration.prototype.removeColumn = function(table, column) { - var _this = this; - this.sequence.enqueue(function() { - return _this.queryInterface - .removeColumn(table, column) - .then(function() { - logger.info('Removed column %s from %s', column, table); - }) - .catch(function(err) { - logger.info( - util.inspect(err, { - showHidden: false, - depth: null, - }) - ); - }); - }); -}; - -Migration.prototype.renameColumn = function(table, oldColumn, newColumn) { - var _this = this; - this.sequence.enqueue(function() { - return _this.queryInterface - .renameColumn(table, oldColumn, newColumn) - .then(function() { - logger.info( - 'Renamed column from %s to %s on %s', - oldColumn, - newColumn, - table - ); - }) - .catch(function(err) { - logger.info( - util.inspect(err, { - showHidden: false, - depth: null, - }) - ); - }); - }); -}; - -Migration.prototype.final = function(resolve) { - this.sequence.enqueue(function() { - return resolve(); - }); -}; - -module.exports = { - up: function(queryInterface /*, Sequelize */) { - return new BPromise(function(resolve) { - var migration = new Migration(queryInterface); - // Add your migration code here - - // START FINAL - migration.final(resolve); - // END FINAL - }); - }, - - down: function( /* queryInterface, Sequelize */ ) { - // var migration = new Migration(queryInterface); - }, -}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index e91c95e..6595fb2 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['SquareRecording','../api/squareRecording/squareRecording.model','SquareMessage','../api/squareMessage/squareMessage.model','License','Migration','../api/migration/migration.model','Attachment','../api/attachment/attachment.model','Plugin','../api/plugin/plugin.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','../api/cmList/cmList.model','VoicePrefix','UserProfile','UserProfileSection','UserProfileResource','UserNotification','../api/userNotification/userNotification.model','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','CloudProvider','../api/cloudProvider/cloudProvider.model','TeamVoiceQueue','../api/teamVoiceQueue/teamVoiceQueue.model','TeamVoicePrefix','../api/teamVoicePrefix/teamVoicePrefix.model','UserVoicePrefix','../api/userVoicePrefix/userVoicePrefix.model','hasOne','VoiceMail','userSetting','cascade','UserId','hasMany','VoiceRecording','Recordings','VoiceQueuesRt','Extensions','HopperFinals','CmHopperHistory','HopperHistory','OpenchannelInteractions','ChatInteractions','SmsInteractions','FaxInteraction','MailInteraction','MailInteractions','WhatsappInteractions','UserNotifications','SenderId','belongsToMany','Groups','chat_group_has_users','CmContact','Contacts','cm_user_has_contacts','Lists','cm_user_has_lists','Team','user_has_teams','user_has_mail_interactions','FaxInteractions','user_has_fax_interactions','user_has_sms_interactions','user_has_openchannel_interactions','user_has_whatsapp_interactions','VoiceQueues','VoicePrefixes','ChatQueues','UserChatQueue','FaxQueues','SmsQueues','OpenchannelQueue','WhatsappQueues','CmList','ChatWebsites','user_has_chat_websites','user_has_fax_accounts','MailAccounts','user_has_mail_accounts','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccounts','user_has_sms_accounts','WhatsappAccounts','user_has_whatsapp_accounts','ChanSpyId','VoiceContext','Applications','Sounds','moh_has_sounds','Members','VoiceQueueId','Hoppers','HopperBlacks','JscriptySessions','TrunkId','belongsTo','TrunkBackup','TrunkBackupId','IntervalId','mandatoryDispositionPauseId','Teams','BlackLists','voice_queues_has_cm_blacklists','Messages','mailbox','mailboxuser','VoiceCallReport','QueueCalls','uniqueid','VoiceAgentReport','AgentReports','Contact','MailAccountId','CloudProviderId','MailServerOut','restrict','Imap','Smtp','Disposition','Dispositions','Answers','Interactions','MailApplication','List','ListId','TemplateId','mandatoryDispositionPause','Agents','team_has_mail_queues','ContactId','mail_interaction_has_tags','Tags','ThroughTags','Users','MailInteractionId','Attachments','Interaction','ChatWebsiteId','Interval','MailQueueReport','Dashboard','CannedAnswer','FaxAccountId','Exntensions','TagId','FaxInteractionId','Account','Owner','fax_interaction_has_tags','AttachmentId','team_has_fax_queues','SmsAccountId','SmsInteractionId','sms_interaction_has_tags','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelQueueId','OpenchannelInteractionId','team_has_openchannel_queues','ChatProactiveAction','ProactiveActions','Agent','Queue','ChatQueueId','Website','ChatInteractionId','chat_interaction_has_tags','user_has_chat_interactions','ChatOfflineMessageId','team_has_chat_queues','ChatGroupId','CmContactId','HopperHistories','CmCompany','Company','cm_contact_has_tags','CmHopperAdditionalPhone','AdditionalPhones','CmHopperId','Campaign','OwnerId','CampaignId','All','OneAll','OneAny','Actions','ParentId','Intervals','MailApplications','ChatApplications','FaxApplications','SmsApplications','DefaultReportId','CustomReportId','openchannel_interaction_has_tags','whatsapp_interaction_has_tags','CmContactHasItem','ItemType','ItemTypeId','Hopper','AllConditions','AllCondition','TriggerAllId','AnyConditions','AnyCondition','TriggerAnyId','AnalyticCustomReport','Fields','MetricId','Configurations','Subjects','DescriptionId','FieldId','AccountId','Subject','SubjectId','Description','Field','SugarcrmField','Descriptions','VariableId','DeskAccount','ZendeskConfiguration','int_zendesk_configuration_has_tags','FreshdeskAccount','FreshdeskConfiguration','int_freshdesk_configuration_has_tags','VtigerAccount','ServicenowField','ToId','JscriptyQuestionReport','JscriptyProject','ProjectId','MailQueues','OpenchannelQueues','team_has_whatsapp_queues','SquareProjectId','campaigns_has_cm_lists','campaigns_has_cm_blacklists','MailTransferReport','FromMailAccountId','FromAccount','FromAgent','ToUserId','ToAgent','ToMailAccountId','ToAccount','FromChatWebsiteId','FromUserId','ToChatQueueId','ToChatWebsiteId','FromFaxAccountId','ToFaxQueueId','ToQueue','FromSmsAccountId','CmCustomField','CustomFields','voice_queues_has_cm_lists','userProfileId','UserProfileSections','Resources','sectionId','WhatsappAccountId','WhatsappInteractionId','WhatsappTransferReport','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','UserSetting','user','../config/environment','sequelize','lodash','motion2','xcall','xC@LL1234','127.0.0.1','utf8mb4','name','utf8','defaultsDeep','mysql','username','password','options','database','sequelizeHistory','User','import','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','../api/voiceContext/voiceContext.model','VoiceExtension','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','ScreenRecording','../api/screenRecording/screenRecording.model','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','Trunk','../api/trunk/trunk.model','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','../api/mailServerOut/mailServerOut.model','MailAccount','MailQueue','MailSubstatus','MailMessage','../api/mailMessage/mailMessage.model','../api/mailApplication/mailApplication.model','../api/mailQueueReport/mailQueueReport.model','../api/dashboard/dashboard.model','DashboardItem','../api/dashboardItem/dashboardItem.model','FaxAccount','../api/faxAccount/faxAccount.model','FaxApplication','../api/faxApplication/faxApplication.model','../api/faxInteraction/faxInteraction.model','FaxMessage','../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','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','OpenchannelMessage','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','ChatApplication','ChatInteraction','ChatMessage','ChatOfflineMessage','ChatQueue','ChatGroup','../api/chatGroup/chatGroup.model','../api/chatProactiveAction/chatProactiveAction.model','../api/cmCompany/cmCompany.model','../api/cmContact/cmContact.model','CmHopper','../api/cmHopper/cmHopper.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','ReportAgentPreview','Action','../api/action/action.model','Automation','../api/automation/automation.model','../api/cannedAnswer/cannedAnswer.model','../api/disposition/disposition.model','Condition','../api/condition/condition.model','../api/interval/interval.model','Pause','../api/pause/pause.model','Cdr','../api/cdr/cdr.model','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','../api/schedule/schedule.model','Sound','../api/sound/sound.model','Tag','../api/tag/tag.model','ContactItemType','../api/contactItemType/contactItemType.model','../api/cmContactHasItem/cmContactHasItem.model','Template','../api/template/template.model','Trigger','Variable','../api/variable/variable.model','Integration','../api/integration/integration.model','../api/integrationReport/integrationReport.model','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','SugarcrmAccount','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','../api/intSugarcrmField/intSugarcrmField.model','../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','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','../api/intZendeskField/intZendeskField.model','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','VtigerField','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','Dynamics365Account','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','../api/network/network.model','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','SquareReport','../api/squareReport/squareReport.model','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','../api/jscriptyProject/jscriptyProject.model','Setting','../api/setting/setting.model','../api/squareOdbc/squareOdbc.model','SquareProject'];(function(_0x20e7e3,_0x1529be){var _0x14b9de=function(_0xa82925){while(--_0xa82925){_0x20e7e3['push'](_0x20e7e3['shift']());}};_0x14b9de(++_0x1529be);}(_0xa9e0,0x123));var _0x0a9e=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xa9e0[_0x19e35c];return _0x3e1fe8;};'use strict';var config=require(_0x0a9e('0x0'));var Sequelize=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var jstz=require('jstz');var timezone=jstz['determine']();config[_0x0a9e('0x1')]=_['defaultsDeep'](config[_0x0a9e('0x1')],{'database':_0x0a9e('0x3'),'username':_0x0a9e('0x4'),'password':_0x0a9e('0x5'),'options':{'host':_0x0a9e('0x6'),'port':0xcea,'dialect':'mysql','dialectOptions':{'charset':_0x0a9e('0x7')},'logging':![],'timezone':timezone[_0x0a9e('0x8')](),'define':{'charset':_0x0a9e('0x9'),'collate':'utf8_general_ci'}}});config['sequelizeHistory']=_[_0x0a9e('0xa')](config['sequelizeHistory'],{'database':'motion2','username':_0x0a9e('0x4'),'password':_0x0a9e('0x5'),'options':{'host':_0x0a9e('0x6'),'port':0xcea,'dialect':_0x0a9e('0xb'),'dialectOptions':{'charset':_0x0a9e('0x7')},'logging':![],'timezone':timezone[_0x0a9e('0x8')](),'define':{'charset':'utf8','collate':'utf8_general_ci'}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelize']['database'],config[_0x0a9e('0x1')][_0x0a9e('0xc')],config[_0x0a9e('0x1')][_0x0a9e('0xd')],config[_0x0a9e('0x1')][_0x0a9e('0xe')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelizeHistory'][_0x0a9e('0xf')],config[_0x0a9e('0x10')][_0x0a9e('0xc')],config[_0x0a9e('0x10')][_0x0a9e('0xd')],config[_0x0a9e('0x10')]['options'])};db[_0x0a9e('0x11')]=db['sequelize'][_0x0a9e('0x12')]('../api/user/user.model');db[_0x0a9e('0x13')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x14'));db['VoiceContext']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x15'));db[_0x0a9e('0x16')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x17'));db[_0x0a9e('0x18')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x19'));db[_0x0a9e('0x1a')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x1b'));db['VoiceRecording']=db[_0x0a9e('0x1')]['import']('../api/voiceRecording/voiceRecording.model');db[_0x0a9e('0x1c')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x1d'));db['VoiceMail']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x1e'));db[_0x0a9e('0x1f')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x20'));db['VoiceCallReport']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x21'));db[_0x0a9e('0x22')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x23'));db['VoiceAgentReport']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x24'));db[_0x0a9e('0x25')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x26'));db[_0x0a9e('0x27')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/memberReport/memberReport.model');db[_0x0a9e('0x28')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x29'));db['VoiceTransferReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x2a'));db[_0x0a9e('0x2b')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x2c'));db[_0x0a9e('0x2d')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x2e'));db['UserChatQueue']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x2f'));db[_0x0a9e('0x30')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x31'));db[_0x0a9e('0x32')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x33'));db[_0x0a9e('0x34')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/userSmsQueue/userSmsQueue.model');db[_0x0a9e('0x35')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x36'));db[_0x0a9e('0x37')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x38'));db[_0x0a9e('0x39')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailServerIn/mailServerIn.model');db['MailServerOut']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x3a'));db[_0x0a9e('0x3b')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailAccount/mailAccount.model');db[_0x0a9e('0x3c')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailQueue/mailQueue.model');db[_0x0a9e('0x3d')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailSubstatus/mailSubstatus.model');db['MailInteraction']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailInteraction/mailInteraction.model');db[_0x0a9e('0x3e')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x3f'));db['MailApplication']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x40'));db['MailQueueReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x41'));db['Dashboard']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x42'));db[_0x0a9e('0x43')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x44'));db[_0x0a9e('0x45')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x46'));db[_0x0a9e('0x47')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x48'));db['FaxInteraction']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x49'));db[_0x0a9e('0x4a')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x4b'));db[_0x0a9e('0x4c')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x4d'));db[_0x0a9e('0x4e')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x4f'));db[_0x0a9e('0x50')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x51'));db[_0x0a9e('0x52')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/smsApplication/smsApplication.model');db[_0x0a9e('0x53')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x54'));db[_0x0a9e('0x55')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x56'));db[_0x0a9e('0x57')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x58'));db[_0x0a9e('0x59')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x5a'));db[_0x0a9e('0x5b')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x5c'));db[_0x0a9e('0x5d')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/openchannelInteraction/openchannelInteraction.model');db[_0x0a9e('0x5e')]=db[_0x0a9e('0x1')]['import']('../api/openchannelMessage/openchannelMessage.model');db['OpenchannelQueue']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x5f'));db[_0x0a9e('0x60')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x61'));db[_0x0a9e('0x62')]=db['sequelize']['import']('../api/openchannelQueueReport/openchannelQueueReport.model');db[_0x0a9e('0x63')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/chatApplication/chatApplication.model');db[_0x0a9e('0x64')]=db[_0x0a9e('0x1')]['import']('../api/chatInteraction/chatInteraction.model');db[_0x0a9e('0x65')]=db['sequelize'][_0x0a9e('0x12')]('../api/chatMessage/chatMessage.model');db[_0x0a9e('0x66')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/chatOfflineMessage/chatOfflineMessage.model');db[_0x0a9e('0x67')]=db[_0x0a9e('0x1')]['import']('../api/chatQueue/chatQueue.model');db[_0x0a9e('0x68')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x69'));db['ChatProactiveAction']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x6a'));db['CmCompany']=db['sequelize']['import'](_0x0a9e('0x6b'));db['CmContact']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x6c'));db[_0x0a9e('0x6d')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x6e'));db[_0x0a9e('0x6f')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x70'));db[_0x0a9e('0x71')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x72'));db['CmHopperHistory']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/cmHopperHistory/cmHopperHistory.model');db[_0x0a9e('0x73')]=db['sequelize'][_0x0a9e('0x12')]('../api/reportAgentPreview/reportAgentPreview.model');db['CmCustomField']=db['sequelize'][_0x0a9e('0x12')]('../api/cmCustomField/cmCustomField.model');db[_0x0a9e('0x74')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x75'));db[_0x0a9e('0x76')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x77'));db['CannedAnswer']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x78'));db['Disposition']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x79'));db[_0x0a9e('0x7a')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x7b'));db['Interval']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x7c'));db[_0x0a9e('0x7d')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x7e'));db[_0x0a9e('0x7f')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x80'));db['VoiceQueuesLog']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x81'));db[_0x0a9e('0x82')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x83'));db[_0x0a9e('0x84')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x85'));db[_0x0a9e('0x86')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x87'));db[_0x0a9e('0x88')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x89'));db['CmContactHasItem']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x8a'));db['CmHopperAdditionalPhone']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model');db[_0x0a9e('0x8b')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x8c'));db[_0x0a9e('0x8d')]=db['sequelize']['import']('../api/trigger/trigger.model');db[_0x0a9e('0x8e')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x8f'));db[_0x0a9e('0x90')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x91'));db['IntegrationReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x92'));db['AnalyticCustomReport']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x93'));db[_0x0a9e('0x94')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x95'));db[_0x0a9e('0x96')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x97'));db[_0x0a9e('0x98')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/analyticMetric/analyticMetric.model');db[_0x0a9e('0x99')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x9a'));db['AnalyticTreeReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x9b'));db[_0x0a9e('0x9c')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x9d'));db[_0x0a9e('0x9e')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x9f'));db[_0x0a9e('0xa0')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intSalesforceField/intSalesforceField.model');db[_0x0a9e('0xa1')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intSugarcrmAccount/intSugarcrmAccount.model');db[_0x0a9e('0xa2')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xa3'));db['SugarcrmField']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xa4'));db['DeskAccount']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xa5'));db[_0x0a9e('0xa6')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xa7'));db[_0x0a9e('0xa8')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xa9'));db[_0x0a9e('0xaa')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xab'));db[_0x0a9e('0xac')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xad'));db[_0x0a9e('0xae')]=db['sequelize'][_0x0a9e('0x12')]('../api/intZohoField/intZohoField.model');db[_0x0a9e('0xaf')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xb0'));db['ZendeskConfiguration']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xb1'));db[_0x0a9e('0xb2')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xb3'));db['FreshdeskAccount']=db['sequelize'][_0x0a9e('0x12')]('../api/intFreshdeskAccount/intFreshdeskAccount.model');db['FreshdeskConfiguration']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xb4'));db[_0x0a9e('0xb5')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xb6'));db['VtigerAccount']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xb7'));db[_0x0a9e('0xb8')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intVtigerConfiguration/intVtigerConfiguration.model');db[_0x0a9e('0xb9')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intVtigerField/intVtigerField.model');db[_0x0a9e('0xba')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xbb'));db[_0x0a9e('0xbc')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xbd'));db['ServicenowField']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intServicenowField/intServicenowField.model');db[_0x0a9e('0xbe')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intDynamics365Account/intDynamics365Account.model');db[_0x0a9e('0xbf')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xc0'));db[_0x0a9e('0xc1')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xc2'));db[_0x0a9e('0xc3')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xc4'));db[_0x0a9e('0xc5')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xc6'));db[_0x0a9e('0xc7')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xc8'));db[_0x0a9e('0x90')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x91'));db['Network']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xc9'));db[_0x0a9e('0xca')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xcb'));db[_0x0a9e('0xcc')]=db['sequelize'][_0x0a9e('0x12')]('../api/chatInternalMessage/chatInternalMessage.model');db[_0x0a9e('0xcd')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xce'));db['JscriptyQuestionReport']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xcf'));db[_0x0a9e('0xd0')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xd1'));db[_0x0a9e('0xd2')]=db['sequelize']['import'](_0x0a9e('0xd3'));db[_0x0a9e('0xd4')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xd5'));db[_0x0a9e('0xd6')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xd7'));db['JscriptyProject']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xd8'));db[_0x0a9e('0xd9')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xda'));db['SquareOdbc']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xdb'));db[_0x0a9e('0xdc')]=db[_0x0a9e('0x1')]['import']('../api/squareProject/squareProject.model');db[_0x0a9e('0xdd')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xde'));db[_0x0a9e('0xdf')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xe0'));db['Team']=db['sequelize'][_0x0a9e('0x12')]('../api/team/team.model');db[_0x0a9e('0xe1')]=db['sequelize'][_0x0a9e('0x12')]('../api/license/license.model');db['Campaign']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/campaign/campaign.model');db[_0x0a9e('0xe2')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xe3'));db[_0x0a9e('0xe4')]=db['sequelize']['import'](_0x0a9e('0xe5'));db[_0x0a9e('0xe6')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xe7'));db['MailTransferReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailTransferReport/mailTransferReport.model');db[_0x0a9e('0xe8')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xe9'));db[_0x0a9e('0xea')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xeb'));db[_0x0a9e('0xec')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xed'));db[_0x0a9e('0xee')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xef'));db['CmList']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xf0'));db[_0x0a9e('0xf1')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/voicePrefix/voicePrefix.model');db[_0x0a9e('0xf2')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/userProfile/userProfile.model');db[_0x0a9e('0xf3')]=db['sequelize'][_0x0a9e('0x12')]('../api/userProfileSection/userProfileSection.model');db[_0x0a9e('0xf4')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/userProfileResource/userProfileResource.model');db[_0x0a9e('0xf5')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xf6'));db[_0x0a9e('0xf7')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xf8'));db[_0x0a9e('0xf9')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xfa'));db[_0x0a9e('0xfb')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xfc'));db[_0x0a9e('0xfd')]=db[_0x0a9e('0x1')]['import']('../api/whatsappMessage/whatsappMessage.model');db[_0x0a9e('0xfe')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xff'));db['WhatsappTransferReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x100'));db[_0x0a9e('0x101')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x102'));db[_0x0a9e('0x103')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x104'));db[_0x0a9e('0x105')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x106'));db[_0x0a9e('0x107')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x108'));db[_0x0a9e('0x109')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x10a'));db['UserSetting']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/user-setting/user-setting.model');db[_0x0a9e('0x11')][_0x0a9e('0x10b')](db[_0x0a9e('0x10c')],{'as':'VoiceMail','onDelete':'cascade','foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x10b')](db['UserSetting'],{'as':_0x0a9e('0x10d'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x10f')});db['User'][_0x0a9e('0x110')](db[_0x0a9e('0x111')],{'as':_0x0a9e('0x112'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x2b')],{'as':_0x0a9e('0x113'),'foreignKey':_0x0a9e('0x10f')});db['User'][_0x0a9e('0x110')](db['VoiceExtension'],{'as':_0x0a9e('0x114'),'onDelete':_0x0a9e('0x10e'),'hooks':!![]});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x71')],{'as':_0x0a9e('0x115'),'foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x116')],{'as':_0x0a9e('0x117'),'foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x73')],{'as':_0x0a9e('0x73'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x5d')],{'as':_0x0a9e('0x118'),'foreignKey':_0x0a9e('0x10f')});db['User'][_0x0a9e('0x110')](db[_0x0a9e('0x64')],{'as':_0x0a9e('0x119'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x53')],{'as':_0x0a9e('0x11a'),'foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x11b')],{'as':'FaxInteractions','foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x11c')],{'as':_0x0a9e('0x11d'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0xfb')],{'as':_0x0a9e('0x11e'),'foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0xf5')],{'as':_0x0a9e('0x11f'),'foreignKey':_0x0a9e('0x120')});db[_0x0a9e('0x11')]['belongsTo'](db[_0x0a9e('0xf2')],{'as':'UserProfile','foreignKey':'userProfileId'});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x68')],{'as':_0x0a9e('0x122'),'through':_0x0a9e('0x123')});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x125'),'through':_0x0a9e('0x126')});db[_0x0a9e('0x11')]['belongsToMany'](db['CmList'],{'as':_0x0a9e('0x127'),'through':_0x0a9e('0x128')});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x12a')});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x11c')],{'as':_0x0a9e('0x11d'),'through':_0x0a9e('0x12b')});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x64')],{'as':_0x0a9e('0x119'),'through':'user_has_chat_interactions'});db['User']['belongsToMany'](db[_0x0a9e('0x11b')],{'as':_0x0a9e('0x12c'),'through':_0x0a9e('0x12d')});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x53')],{'as':'SmsInteractions','through':_0x0a9e('0x12e')});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db['OpenchannelInteraction'],{'as':_0x0a9e('0x118'),'through':_0x0a9e('0x12f')});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0xfb')],{'as':'WhatsappInteractions','through':_0x0a9e('0x130')});db['User'][_0x0a9e('0x121')](db['VoiceQueue'],{'as':_0x0a9e('0x131'),'through':_0x0a9e('0x2d'),'required':![]});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0xf1')],{'as':_0x0a9e('0x132'),'through':_0x0a9e('0x109'),'required':![]});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x3c')],{'as':'MailQueues','through':_0x0a9e('0x30'),'required':![]});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x67')],{'as':_0x0a9e('0x133'),'through':_0x0a9e('0x134'),'required':![],'hooks':!![]});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x4c')],{'as':_0x0a9e('0x135'),'through':_0x0a9e('0x32'),'required':![]});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x57')],{'as':_0x0a9e('0x136'),'through':_0x0a9e('0x34'),'required':![]});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x137')],{'as':'OpenchannelQueues','through':_0x0a9e('0x35'),'required':![]});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x101')],{'as':_0x0a9e('0x138'),'through':_0x0a9e('0x37'),'required':![]});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'through':_0x0a9e('0x128')});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x13a'),'through':_0x0a9e('0x13b')});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x45')],{'as':'FaxAccounts','through':_0x0a9e('0x13c')});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x3b')],{'as':_0x0a9e('0x13d'),'through':_0x0a9e('0x13e')});db[_0x0a9e('0x11')]['belongsToMany'](db['OpenchannelAccount'],{'as':_0x0a9e('0x13f'),'through':_0x0a9e('0x140')});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x50')],{'as':_0x0a9e('0x141'),'through':_0x0a9e('0x142')});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0xf7')],{'as':_0x0a9e('0x143'),'through':_0x0a9e('0x144')});db[_0x0a9e('0x13')][_0x0a9e('0x110')](db[_0x0a9e('0x16')],{'as':'SpiedAgents','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x145')});db[_0x0a9e('0x146')]['hasMany'](db[_0x0a9e('0x16')],{'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x16')][_0x0a9e('0x110')](db['VoiceExtension'],{'as':_0x0a9e('0x147'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x18')][_0x0a9e('0x121')](db[_0x0a9e('0x84')],{'as':_0x0a9e('0x148'),'through':_0x0a9e('0x149')});db[_0x0a9e('0x1a')]['hasMany'](db[_0x0a9e('0x2b')],{'as':_0x0a9e('0x14a'),'foreignKey':_0x0a9e('0x14b')});db[_0x0a9e('0x1a')]['hasMany'](db['CmHopper'],{'as':_0x0a9e('0x14c'),'foreignKey':_0x0a9e('0x14b')});db[_0x0a9e('0x1a')]['hasMany'](db[_0x0a9e('0x71')],{'as':_0x0a9e('0x115'),'foreignKey':'VoiceQueueId'});db[_0x0a9e('0x1a')]['hasMany'](db[_0x0a9e('0x116')],{'as':'HopperHistories','foreignKey':'VoiceQueueId'});db['VoiceQueue'][_0x0a9e('0x110')](db[_0x0a9e('0x73')],{'as':_0x0a9e('0x73'),'foreignKey':_0x0a9e('0x14b')});db[_0x0a9e('0x1a')][_0x0a9e('0x110')](db['CmHopperBlack'],{'as':_0x0a9e('0x14d'),'foreignKey':_0x0a9e('0x14b')});db[_0x0a9e('0x1a')][_0x0a9e('0x110')](db[_0x0a9e('0xd0')],{'as':_0x0a9e('0x14e'),'foreignKey':_0x0a9e('0x14b')});db['VoiceQueue']['belongsTo'](db[_0x0a9e('0x28')],{'as':'Trunk','foreignKey':_0x0a9e('0x14f')});db[_0x0a9e('0x1a')][_0x0a9e('0x150')](db[_0x0a9e('0x28')],{'as':_0x0a9e('0x151'),'foreignKey':_0x0a9e('0x152')});db['VoiceQueue'][_0x0a9e('0x150')](db['Interval'],{'as':'Interval','foreignKey':_0x0a9e('0x153')});db['VoiceQueue'][_0x0a9e('0x150')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0x0a9e('0x154')});db['VoiceQueue'][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x127'),'through':'voice_queues_has_cm_lists'});db[_0x0a9e('0x1a')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Agents','through':'UserVoiceQueue'});db[_0x0a9e('0x1a')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'as':_0x0a9e('0x155'),'through':_0x0a9e('0x105')});db[_0x0a9e('0x1a')][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x156'),'through':_0x0a9e('0x157')});db['VoiceRecording']['belongsTo'](db['User'],{'as':_0x0a9e('0x11'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x1c')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x11'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x10c')]['hasMany'](db['VoiceMailMessage'],{'as':_0x0a9e('0x158'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'mailboxuser','sourceKey':_0x0a9e('0x159')});db[_0x0a9e('0x1f')][_0x0a9e('0x150')](db[_0x0a9e('0x10c')],{'foreignKey':_0x0a9e('0x15a'),'targetKey':_0x0a9e('0x159')});db[_0x0a9e('0x15b')][_0x0a9e('0x110')](db[_0x0a9e('0x25')],{'as':_0x0a9e('0x15c'),'foreignKey':_0x0a9e('0x15d'),'constraints':![]});db[_0x0a9e('0x15b')]['hasMany'](db[_0x0a9e('0x15e')],{'as':_0x0a9e('0x15f'),'foreignKey':_0x0a9e('0x15d'),'constraints':![]});db[_0x0a9e('0x15b')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x11'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x15b')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':'ContactId'});db['MailServerIn'][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'as':_0x0a9e('0x3b'),'foreignKey':_0x0a9e('0x161')});db[_0x0a9e('0x39')][_0x0a9e('0x150')](db[_0x0a9e('0x103')],{'as':'CloudProvider','foreignKey':_0x0a9e('0x162'),'onDelete':'restrict'});db[_0x0a9e('0x163')][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'as':_0x0a9e('0x3b'),'foreignKey':_0x0a9e('0x161')});db[_0x0a9e('0x163')][_0x0a9e('0x150')](db[_0x0a9e('0x103')],{'as':_0x0a9e('0x103'),'foreignKey':_0x0a9e('0x162'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x3b')][_0x0a9e('0x10b')](db[_0x0a9e('0x39')],{'as':_0x0a9e('0x165'),'onDelete':_0x0a9e('0x10e')});db['MailAccount']['hasOne'](db[_0x0a9e('0x163')],{'as':_0x0a9e('0x166'),'onDelete':'cascade'});db['MailAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':'MailAccountId','onDelete':_0x0a9e('0x10e')});db['MailAccount'][_0x0a9e('0x110')](db['CannedAnswer'],{'as':_0x0a9e('0x169'),'foreignKey':'MailAccountId'});db[_0x0a9e('0x3b')][_0x0a9e('0x110')](db[_0x0a9e('0x3e')],{'as':'Messages','foreignKey':_0x0a9e('0x161')});db['MailAccount']['hasMany'](db[_0x0a9e('0x11c')],{'as':_0x0a9e('0x16a')});db[_0x0a9e('0x3b')][_0x0a9e('0x110')](db[_0x0a9e('0x16b')],{'as':_0x0a9e('0x147'),'foreignKey':_0x0a9e('0x161'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x3b')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x3b')][_0x0a9e('0x150')](db[_0x0a9e('0x8b')],{'as':_0x0a9e('0x8b'),'foreignKey':_0x0a9e('0x16e')});db[_0x0a9e('0x3b')]['belongsTo'](db[_0x0a9e('0x7d')],{'as':_0x0a9e('0x16f'),'foreignKey':_0x0a9e('0x154')});db[_0x0a9e('0x3b')]['belongsToMany'](db['User'],{'as':'Agents','through':_0x0a9e('0x13e')});db['MailQueue'][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x30')});db[_0x0a9e('0x3c')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x171'),'as':_0x0a9e('0x155')});db[_0x0a9e('0x11c')]['hasMany'](db[_0x0a9e('0x3e')],{'as':'Messages','onDelete':_0x0a9e('0x10e'),'foreignKey':'MailInteractionId'});db[_0x0a9e('0x11c')][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'as':'Account','foreignKey':_0x0a9e('0x161')});db[_0x0a9e('0x11c')]['belongsTo'](db['CmContact'],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x11c')]['belongsTo'](db['User'],{'as':'Owner','foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11c')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x173'),'as':_0x0a9e('0x174')});db[_0x0a9e('0x11c')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x173'),'as':_0x0a9e('0x175')});db[_0x0a9e('0x11c')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'through':_0x0a9e('0x12b'),'foreignKey':_0x0a9e('0x177')});db[_0x0a9e('0x3e')]['hasMany'](db[_0x0a9e('0xe4')],{'as':_0x0a9e('0x178'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x3e')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':'User'});db[_0x0a9e('0x3e')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x160')});db[_0x0a9e('0x3e')][_0x0a9e('0x150')](db[_0x0a9e('0x11c')],{'as':_0x0a9e('0x179'),'foreignKey':'MailInteractionId'});db['MailMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'as':'Account','foreignKey':_0x0a9e('0x161')});db[_0x0a9e('0x3e')]['belongsTo'](db[_0x0a9e('0x60')],{'as':'ChatWebsite','foreignKey':_0x0a9e('0x17a')});db[_0x0a9e('0x3e')]['belongsTo'](db[_0x0a9e('0x66')],{'as':_0x0a9e('0x66'),'foreignKey':'ChatOfflineMessageId'});db[_0x0a9e('0x16b')][_0x0a9e('0x150')](db['User'],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x16b')][_0x0a9e('0x150')](db[_0x0a9e('0x3c')],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x16b')]['belongsTo'](db[_0x0a9e('0x3b')],{'onDelete':_0x0a9e('0x164')});db['MailApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x16b')][_0x0a9e('0x150')](db[_0x0a9e('0x86')],{'onDelete':'restrict','foreignKey':'TagId'});db['MailQueueReport']['belongsTo'](db['MailAccount'],{});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db['CmList'],{'as':'List','foreignKey':_0x0a9e('0x16d')});db['MailQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db['MailInteraction'],{});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db['MailMessage'],{});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db[_0x0a9e('0x3c')],{});db[_0x0a9e('0x17d')]['hasMany'](db[_0x0a9e('0x43')],{'as':'Items','onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x45')]['hasMany'](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':'FaxAccountId','onDelete':_0x0a9e('0x10e')});db['FaxAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x17e')],{'as':'Answers','foreignKey':_0x0a9e('0x17f')});db['FaxAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x11b')],{'as':_0x0a9e('0x16a')});db[_0x0a9e('0x45')][_0x0a9e('0x110')](db[_0x0a9e('0x47')],{'as':_0x0a9e('0x147'),'foreignKey':'FaxAccountId','onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x45')][_0x0a9e('0x110')](db[_0x0a9e('0x16')],{'as':_0x0a9e('0x180'),'onDelete':'cascade'});db[_0x0a9e('0x45')]['hasMany'](db['FaxMessage'],{'as':_0x0a9e('0x158')});db['FaxAccount'][_0x0a9e('0x150')](db[_0x0a9e('0x28')],{'as':'Trunk'});db[_0x0a9e('0x45')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x45')][_0x0a9e('0x150')](db[_0x0a9e('0x7d')],{'as':_0x0a9e('0x16f'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x0a9e('0x45')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':'user_has_fax_accounts'});db[_0x0a9e('0x47')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'onDelete':'restrict'});db[_0x0a9e('0x47')][_0x0a9e('0x150')](db[_0x0a9e('0x4c')],{'onDelete':'restrict'});db[_0x0a9e('0x47')]['belongsTo'](db[_0x0a9e('0x45')],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x47')][_0x0a9e('0x150')](db[_0x0a9e('0x86')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x181')});db['FaxInteraction'][_0x0a9e('0x110')](db[_0x0a9e('0x4a')],{'as':_0x0a9e('0x158'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x182')});db[_0x0a9e('0x11b')][_0x0a9e('0x150')](db[_0x0a9e('0x45')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x17f')});db[_0x0a9e('0x11b')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x11b')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11b')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':'fax_interaction_has_tags','as':_0x0a9e('0x174')});db[_0x0a9e('0x11b')][_0x0a9e('0x121')](db['Tag'],{'through':_0x0a9e('0x185'),'as':'ThroughTags'});db[_0x0a9e('0x11b')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'through':_0x0a9e('0x12d'),'foreignKey':_0x0a9e('0x182')});db[_0x0a9e('0x4a')][_0x0a9e('0x150')](db['User'],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x11')});db['FaxMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x11b')],{'as':_0x0a9e('0x179'),'foreignKey':'FaxInteractionId'});db[_0x0a9e('0x4a')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':_0x0a9e('0x10e'),'as':'Contact'});db[_0x0a9e('0x4a')][_0x0a9e('0x150')](db[_0x0a9e('0xe4')],{'as':_0x0a9e('0xe4'),'foreignKey':_0x0a9e('0x186')});db['FaxMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x45')],{'as':'Account','foreignKey':_0x0a9e('0x17f')});db[_0x0a9e('0x4c')][_0x0a9e('0x121')](db['User'],{'as':'Agents','through':_0x0a9e('0x32')});db[_0x0a9e('0x4c')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x187'),'as':_0x0a9e('0x155')});db[_0x0a9e('0x4e')][_0x0a9e('0x150')](db['FaxAccount'],{});db['FaxQueueReport'][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x4e')][_0x0a9e('0x150')](db['CmContact'],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db['FaxQueueReport'][_0x0a9e('0x150')](db['FaxInteraction'],{});db[_0x0a9e('0x4e')][_0x0a9e('0x150')](db[_0x0a9e('0x4a')],{});db[_0x0a9e('0x4e')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db['FaxQueueReport'][_0x0a9e('0x150')](db['FaxQueue'],{});db[_0x0a9e('0x50')][_0x0a9e('0x110')](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':_0x0a9e('0x188'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x50')]['hasMany'](db[_0x0a9e('0x17e')],{'as':_0x0a9e('0x169'),'foreignKey':_0x0a9e('0x188')});db[_0x0a9e('0x50')][_0x0a9e('0x110')](db['SmsMessage'],{'as':_0x0a9e('0x158'),'foreignKey':_0x0a9e('0x188')});db['SmsAccount']['hasMany'](db[_0x0a9e('0x53')],{'as':_0x0a9e('0x16a')});db[_0x0a9e('0x50')][_0x0a9e('0x110')](db[_0x0a9e('0x52')],{'as':_0x0a9e('0x147'),'foreignKey':'SmsAccountId','onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x50')][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x50')][_0x0a9e('0x150')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0x0a9e('0x154')});db[_0x0a9e('0x50')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x142')});db[_0x0a9e('0x52')][_0x0a9e('0x150')](db['User'],{'onDelete':_0x0a9e('0x164')});db['SmsApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x57')],{'onDelete':_0x0a9e('0x164')});db['SmsApplication']['belongsTo'](db[_0x0a9e('0x50')],{'onDelete':'restrict'});db[_0x0a9e('0x52')]['belongsTo'](db['Interval'],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x52')][_0x0a9e('0x150')](db[_0x0a9e('0x86')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x181')});db[_0x0a9e('0x53')][_0x0a9e('0x110')](db[_0x0a9e('0x55')],{'as':_0x0a9e('0x158'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x189')});db['SmsInteraction']['belongsTo'](db[_0x0a9e('0x50')],{'as':'Account','foreignKey':_0x0a9e('0x188')});db[_0x0a9e('0x53')][_0x0a9e('0x150')](db['CmContact'],{'as':'Contact','foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x53')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x53')]['belongsToMany'](db[_0x0a9e('0x86')],{'through':'sms_interaction_has_tags','as':_0x0a9e('0x174')});db[_0x0a9e('0x53')]['belongsToMany'](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x18a'),'as':_0x0a9e('0x175')});db[_0x0a9e('0x53')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Users','through':_0x0a9e('0x12e'),'foreignKey':_0x0a9e('0x189')});db[_0x0a9e('0x55')]['belongsTo'](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x11')});db[_0x0a9e('0x55')]['belongsTo'](db[_0x0a9e('0x124')],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x160')});db[_0x0a9e('0x55')][_0x0a9e('0x150')](db[_0x0a9e('0x53')],{'onDelete':'cascade','as':'Interaction','foreignKey':_0x0a9e('0x189')});db[_0x0a9e('0x55')]['belongsTo'](db[_0x0a9e('0x50')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x188')});db[_0x0a9e('0x57')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Agents','through':_0x0a9e('0x34'),'foreignKey':_0x0a9e('0x18b')});db[_0x0a9e('0x57')]['belongsToMany'](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x18c'),'as':_0x0a9e('0x155')});db[_0x0a9e('0x59')]['hasMany'](db['Disposition'],{'as':_0x0a9e('0x168'),'foreignKey':_0x0a9e('0x18d'),'onDelete':_0x0a9e('0x10e')});db['OpenchannelAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x17e')],{'as':_0x0a9e('0x169'),'foreignKey':_0x0a9e('0x18d')});db[_0x0a9e('0x59')][_0x0a9e('0x110')](db[_0x0a9e('0x5d')],{'as':_0x0a9e('0x16a'),'foreignKey':'OpenchannelAccountId'});db['OpenchannelAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x5e')],{'as':'Messages','foreignKey':_0x0a9e('0x18d')});db['OpenchannelAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x5b')],{'as':'Applications','foreignKey':_0x0a9e('0x18d'),'onDelete':_0x0a9e('0x10e')});db['OpenchannelAccount'][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x59')][_0x0a9e('0x150')](db[_0x0a9e('0x7d')],{'as':'mandatoryDispositionPause','foreignKey':_0x0a9e('0x154')});db[_0x0a9e('0x59')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x140')});db[_0x0a9e('0x5b')]['belongsTo'](db['User'],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x5b')][_0x0a9e('0x150')](db['OpenchannelQueue'],{'onDelete':'restrict','foreignKey':_0x0a9e('0x18e')});db['OpenchannelApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x59')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x18d')});db[_0x0a9e('0x5b')][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x153')});db['OpenchannelApplication']['belongsTo'](db[_0x0a9e('0x86')],{'onDelete':'restrict','foreignKey':_0x0a9e('0x181')});db[_0x0a9e('0x5d')][_0x0a9e('0x110')](db[_0x0a9e('0x5e')],{'as':'Messages','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x18f')});db[_0x0a9e('0x5d')]['belongsTo'](db[_0x0a9e('0x59')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x18d')});db['OpenchannelInteraction'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x5d')][_0x0a9e('0x150')](db['User'],{'as':'Owner','foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x5d')][_0x0a9e('0x121')](db['Tag'],{'through':'openchannel_interaction_has_tags','as':_0x0a9e('0x174')});db[_0x0a9e('0x5d')][_0x0a9e('0x121')](db['Tag'],{'through':'openchannel_interaction_has_tags','as':_0x0a9e('0x175')});db[_0x0a9e('0x5d')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'through':'user_has_openchannel_interactions','foreignKey':_0x0a9e('0x18f')});db['OpenchannelMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'onDelete':'cascade','as':_0x0a9e('0x11')});db['OpenchannelMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x160')});db[_0x0a9e('0x5e')]['belongsTo'](db[_0x0a9e('0x5d')],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x179'),'foreignKey':'OpenchannelInteractionId'});db[_0x0a9e('0x5e')]['belongsTo'](db[_0x0a9e('0xe4')],{'as':_0x0a9e('0xe4'),'foreignKey':_0x0a9e('0x186')});db['OpenchannelMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x59')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x18d')});db[_0x0a9e('0x137')][_0x0a9e('0x121')](db['User'],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x35'),'foreignKey':_0x0a9e('0x18e')});db[_0x0a9e('0x137')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x190'),'as':_0x0a9e('0x155')});db['ChatWebsite'][_0x0a9e('0x110')](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':_0x0a9e('0x17a'),'onDelete':'cascade'});db[_0x0a9e('0x60')]['hasMany'](db[_0x0a9e('0x17e')],{'as':_0x0a9e('0x169'),'foreignKey':_0x0a9e('0x17a')});db['ChatWebsite'][_0x0a9e('0x110')](db[_0x0a9e('0x191')],{'as':_0x0a9e('0x192')});db[_0x0a9e('0x60')]['hasMany'](db[_0x0a9e('0x64')],{'as':_0x0a9e('0x16a')});db[_0x0a9e('0x60')][_0x0a9e('0x110')](db[_0x0a9e('0x63')],{'as':_0x0a9e('0x147'),'foreignKey':_0x0a9e('0x17a'),'onDelete':'cascade'});db[_0x0a9e('0x60')][_0x0a9e('0x110')](db[_0x0a9e('0x65')],{'as':_0x0a9e('0x158')});db['ChatWebsite'][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x60')][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'as':_0x0a9e('0x17b'),'foreignKey':_0x0a9e('0x153')});db['ChatWebsite'][_0x0a9e('0x150')](db['MailAccount'],{'as':_0x0a9e('0x3b'),'foreignKey':_0x0a9e('0x161')});db['ChatWebsite'][_0x0a9e('0x150')](db[_0x0a9e('0x7d')],{'as':_0x0a9e('0x16f'),'foreignKey':_0x0a9e('0x154')});db['ChatWebsite'][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Agents','through':_0x0a9e('0x13b')});db['OpenchannelQueueReport']['belongsTo'](db['OpenchannelAccount'],{});db[_0x0a9e('0x62')][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db['OpenchannelQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x62')][_0x0a9e('0x150')](db[_0x0a9e('0x5d')],{});db['OpenchannelQueueReport'][_0x0a9e('0x150')](db['OpenchannelMessage'],{});db[_0x0a9e('0x62')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db[_0x0a9e('0x62')][_0x0a9e('0x150')](db[_0x0a9e('0x137')],{});db['ChatApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x193'),'foreignKey':'UserId','onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x63')][_0x0a9e('0x150')](db[_0x0a9e('0x67')],{'as':_0x0a9e('0x194'),'foreignKey':_0x0a9e('0x195'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x63')][_0x0a9e('0x150')](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x196'),'foreignKey':_0x0a9e('0x17a'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x63')][_0x0a9e('0x150')](db[_0x0a9e('0x86')],{'onDelete':'restrict','foreignKey':_0x0a9e('0x181')});db[_0x0a9e('0x64')][_0x0a9e('0x110')](db['ChatMessage'],{'as':_0x0a9e('0x158'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x197')});db[_0x0a9e('0x64')]['belongsTo'](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x17a')});db[_0x0a9e('0x64')]['belongsTo'](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x64')]['belongsTo'](db['User'],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x64')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x198'),'as':_0x0a9e('0x174')});db[_0x0a9e('0x64')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x198'),'as':_0x0a9e('0x175')});db[_0x0a9e('0x64')][_0x0a9e('0x121')](db['User'],{'as':_0x0a9e('0x176'),'through':_0x0a9e('0x199'),'foreignKey':_0x0a9e('0x197')});db['ChatMessage']['belongsTo'](db[_0x0a9e('0x11')],{'onDelete':'cascade','as':_0x0a9e('0x11')});db[_0x0a9e('0x65')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':'cascade','as':'Contact','foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x65')][_0x0a9e('0x150')](db[_0x0a9e('0x64')],{'onDelete':'cascade','as':_0x0a9e('0x179'),'foreignKey':_0x0a9e('0x197')});db[_0x0a9e('0x65')][_0x0a9e('0x150')](db[_0x0a9e('0xe4')],{'as':'Attachment','foreignKey':'AttachmentId'});db[_0x0a9e('0x65')][_0x0a9e('0x150')](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x17a')});db[_0x0a9e('0x66')][_0x0a9e('0x110')](db['Attachment'],{'as':_0x0a9e('0x178'),'foreignKey':_0x0a9e('0x19a'),'onDelete':_0x0a9e('0x10e'),'hooks':!![]});db['ChatOfflineMessage']['belongsTo'](db['CmContact'],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x160'),'foreignKey':'ContactId'});db[_0x0a9e('0x66')][_0x0a9e('0x150')](db[_0x0a9e('0x60')],{'as':'Account','foreignKey':'ChatWebsiteId'});db[_0x0a9e('0x67')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':'UserChatQueue','hooks':!![]});db[_0x0a9e('0x67')]['belongsToMany'](db['Team'],{'through':_0x0a9e('0x19b'),'as':'Teams'});db[_0x0a9e('0x68')][_0x0a9e('0x110')](db[_0x0a9e('0xcc')],{'as':'Messages','foreignKey':_0x0a9e('0x19c'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x68')]['belongsToMany'](db['User'],{'as':_0x0a9e('0x14a'),'through':_0x0a9e('0x123')});db[_0x0a9e('0x191')][_0x0a9e('0x150')](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x196'),'foreignKey':'ChatWebsiteId'});db['CmCompany'][_0x0a9e('0x110')](db[_0x0a9e('0x124')],{'as':'Contacts','foreignKey':'CompanyId'});db['CmContact']['hasMany'](db['CmContactHasItem'],{'as':'Phones','foreignKey':_0x0a9e('0x19d')});db['CmContact'][_0x0a9e('0x110')](db[_0x0a9e('0x6d')],{'as':_0x0a9e('0x14c'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db[_0x0a9e('0x71')],{'as':'HopperFinals','foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db[_0x0a9e('0x116')],{'as':_0x0a9e('0x19e'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db[_0x0a9e('0x73')],{'as':_0x0a9e('0x73'),'foreignKey':_0x0a9e('0x172')});db['CmContact'][_0x0a9e('0x110')](db[_0x0a9e('0xd0')],{'as':'JscriptySessions','foreignKey':_0x0a9e('0x172')});db['CmContact'][_0x0a9e('0x110')](db[_0x0a9e('0x5d')],{'as':'OpenchannelInteractions','foreignKey':'ContactId','onDelete':_0x0a9e('0x164')});db['CmContact'][_0x0a9e('0x110')](db[_0x0a9e('0x64')],{'as':_0x0a9e('0x119'),'foreignKey':_0x0a9e('0x172'),'onDelete':_0x0a9e('0x164')});db['CmContact'][_0x0a9e('0x110')](db['SmsInteraction'],{'as':'SmsInteractions','foreignKey':_0x0a9e('0x172'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db[_0x0a9e('0x11b')],{'as':'FaxInteractions','foreignKey':_0x0a9e('0x172'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db['MailInteraction'],{'as':_0x0a9e('0x11d'),'foreignKey':_0x0a9e('0x172'),'onDelete':'restrict'});db[_0x0a9e('0x124')][_0x0a9e('0x150')](db[_0x0a9e('0x19f')],{'as':_0x0a9e('0x1a0'),'foreignKey':'CompanyId'});db[_0x0a9e('0x124')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d'),'onDelete':'cascade'});db[_0x0a9e('0x124')][_0x0a9e('0x121')](db['User'],{'as':_0x0a9e('0x176'),'through':'cm_user_has_contacts'});db[_0x0a9e('0x124')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'as':_0x0a9e('0x174'),'through':_0x0a9e('0x1a1')});db[_0x0a9e('0x124')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x1a1'),'as':_0x0a9e('0x175')});db[_0x0a9e('0x6d')][_0x0a9e('0x110')](db[_0x0a9e('0x1a2')],{'as':_0x0a9e('0x1a3'),'foreignKey':_0x0a9e('0x1a4')});db['CmHopper'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x6d')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':'List','foreignKey':'ListId','onDelete':'cascade'});db['CmHopper'][_0x0a9e('0x150')](db['User'],{'as':'Agent','foreignKey':'UserId'});db[_0x0a9e('0x6d')][_0x0a9e('0x150')](db[_0x0a9e('0x1a')],{'as':_0x0a9e('0x194'),'foreignKey':'VoiceQueueId','onDelete':'cascade'});db[_0x0a9e('0x6d')][_0x0a9e('0x150')](db[_0x0a9e('0x1a5')],{'as':_0x0a9e('0x1a5'),'foreignKey':'CampaignId','onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x6d')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x1a6')});db['CmHopperBlack'][_0x0a9e('0x150')](db['CmContact'],{'as':'Contact','foreignKey':_0x0a9e('0x172'),'onDelete':'cascade'});db[_0x0a9e('0x6f')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x6f')][_0x0a9e('0x150')](db[_0x0a9e('0x1a')],{'as':'Queue','foreignKey':_0x0a9e('0x14b'),'onDelete':_0x0a9e('0x10e')});db['CmHopperBlack'][_0x0a9e('0x150')](db[_0x0a9e('0x1a5')],{'as':_0x0a9e('0x1a5'),'foreignKey':_0x0a9e('0x1a7'),'onDelete':'cascade'});db[_0x0a9e('0x76')][_0x0a9e('0x110')](db[_0x0a9e('0x7a')],{'as':{'plural':_0x0a9e('0x1a8'),'singular':_0x0a9e('0x1a9')},'foreignKey':'AutomationAllId','onDelete':'cascade','hooks':!![]});db[_0x0a9e('0x76')]['hasMany'](db[_0x0a9e('0x7a')],{'as':{'plural':'Any','singular':_0x0a9e('0x1aa')},'foreignKey':'AutomationAnyId','onDelete':_0x0a9e('0x10e'),'hooks':!![]});db['Automation'][_0x0a9e('0x110')](db[_0x0a9e('0x74')],{'as':_0x0a9e('0x1ab'),'foreignKey':'AutomationId','onDelete':'cascade','hooks':!![]});db[_0x0a9e('0x167')]['hasMany'](db[_0x0a9e('0x167')],{'as':'Dispositions','foreignKey':_0x0a9e('0x1ac'),'onDelete':'cascade'});db[_0x0a9e('0x17b')][_0x0a9e('0x110')](db['Interval'],{'as':_0x0a9e('0x1ad'),'foreignKey':_0x0a9e('0x153'),'onDelete':_0x0a9e('0x10e'),'hooks':!![],'required':![]});db[_0x0a9e('0x17b')][_0x0a9e('0x110')](db[_0x0a9e('0x16')],{'as':_0x0a9e('0x114'),'foreignKey':_0x0a9e('0x153'),'onDelete':_0x0a9e('0x164')});db['Interval'][_0x0a9e('0x110')](db[_0x0a9e('0x16b')],{'as':_0x0a9e('0x1ae'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x17b')]['hasMany'](db['ChatApplication'],{'as':_0x0a9e('0x1af'),'foreignKey':'IntervalId'});db[_0x0a9e('0x17b')]['hasMany'](db[_0x0a9e('0x47')],{'as':_0x0a9e('0x1b0'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x17b')][_0x0a9e('0x110')](db[_0x0a9e('0x52')],{'as':_0x0a9e('0x1b1'),'foreignKey':'IntervalId'});db['Schedule'][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{});db['Schedule'][_0x0a9e('0x150')](db[_0x0a9e('0x94')],{'foreignKey':_0x0a9e('0x1b2')});db['Schedule']['belongsTo'](db['AnalyticCustomReport'],{'foreignKey':_0x0a9e('0x1b3')});db[_0x0a9e('0x84')][_0x0a9e('0x121')](db[_0x0a9e('0x18')],{'as':'Mohs','through':_0x0a9e('0x149'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x86')]['belongsToMany'](db[_0x0a9e('0x124')],{'through':'cm_contact_has_tags'});db['Tag'][_0x0a9e('0x121')](db[_0x0a9e('0x64')],{'through':'chat_interaction_has_tags'});db['Tag'][_0x0a9e('0x121')](db['MailInteraction'],{'through':_0x0a9e('0x173')});db['Tag'][_0x0a9e('0x121')](db[_0x0a9e('0x53')],{'through':_0x0a9e('0x18a')});db['Tag']['belongsToMany'](db[_0x0a9e('0x11b')],{'through':_0x0a9e('0x185')});db[_0x0a9e('0x86')][_0x0a9e('0x121')](db['OpenchannelInteraction'],{'through':_0x0a9e('0x1b4')});db[_0x0a9e('0x86')]['belongsToMany'](db[_0x0a9e('0xfb')],{'through':_0x0a9e('0x1b5')});db[_0x0a9e('0x1b6')]['belongsTo'](db[_0x0a9e('0x88')],{'as':_0x0a9e('0x1b7'),'foreignKey':_0x0a9e('0x1b8')});db[_0x0a9e('0x1a2')][_0x0a9e('0x150')](db[_0x0a9e('0x6d')],{'as':_0x0a9e('0x1b9'),'foreignKey':_0x0a9e('0x1a4')});db[_0x0a9e('0x1b6')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x19d')});db[_0x0a9e('0x8d')][_0x0a9e('0x110')](db[_0x0a9e('0x7a')],{'as':{'plural':_0x0a9e('0x1ba'),'singular':_0x0a9e('0x1bb')},'foreignKey':_0x0a9e('0x1bc'),'onDelete':_0x0a9e('0x10e'),'hooks':!![]});db[_0x0a9e('0x8d')][_0x0a9e('0x110')](db['Condition'],{'as':{'plural':_0x0a9e('0x1bd'),'singular':_0x0a9e('0x1be')},'foreignKey':_0x0a9e('0x1bf'),'onDelete':'cascade','hooks':!![]});db[_0x0a9e('0x8d')][_0x0a9e('0x110')](db[_0x0a9e('0x74')],{'as':_0x0a9e('0x1ab'),'foreignKey':'TriggerId','onDelete':_0x0a9e('0x10e'),'hooks':!![]});db[_0x0a9e('0x1c0')]['hasMany'](db[_0x0a9e('0x99')],{'as':_0x0a9e('0x1c1'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'CustomReportId','hooks':!![]});db['AnalyticDefaultReport'][_0x0a9e('0x110')](db[_0x0a9e('0x99')],{'as':_0x0a9e('0x1c1'),'onDelete':'cascade','foreignKey':'DefaultReportId'});db[_0x0a9e('0x98')][_0x0a9e('0x110')](db[_0x0a9e('0x99')],{'as':_0x0a9e('0x1c1'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c2')});db['AnalyticFieldReport']['belongsTo'](db[_0x0a9e('0x98')],{'foreignKey':_0x0a9e('0x1c2')});db[_0x0a9e('0x9c')]['hasMany'](db[_0x0a9e('0x9e')],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'AccountId'});db['SalesforceConfiguration'][_0x0a9e('0x110')](db[_0x0a9e('0xa0')],{'as':_0x0a9e('0x1c4'),'onDelete':'cascade','foreignKey':'SubjectId'});db[_0x0a9e('0x9e')]['hasMany'](db['SalesforceField'],{'as':'Descriptions','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0x9e')]['hasMany'](db[_0x0a9e('0xa0')],{'as':_0x0a9e('0x1c1'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c6')});db['SalesforceConfiguration'][_0x0a9e('0x150')](db[_0x0a9e('0x9c')],{'as':'Account','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xa0')][_0x0a9e('0x110')](db['SalesforceField'],{'as':_0x0a9e('0x1c8'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xa0')]['hasMany'](db[_0x0a9e('0xa0')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db['SalesforceField'][_0x0a9e('0x110')](db[_0x0a9e('0xa0')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xa0')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':'VariableId'});db[_0x0a9e('0xa1')][_0x0a9e('0x110')](db[_0x0a9e('0xa2')],{'as':_0x0a9e('0x1c3'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xa2')]['hasMany'](db[_0x0a9e('0x1cc')],{'as':_0x0a9e('0x1c4'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xa2')][_0x0a9e('0x110')](db[_0x0a9e('0x1cc')],{'as':_0x0a9e('0x1cd'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c5')});db['SugarcrmConfiguration'][_0x0a9e('0x110')](db[_0x0a9e('0x1cc')],{'as':'Fields','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c6')});db['SugarcrmConfiguration'][_0x0a9e('0x150')](db[_0x0a9e('0xa1')],{'as':'Account','foreignKey':_0x0a9e('0x1c7')});db['SugarcrmField']['hasMany'](db['SugarcrmField'],{'as':_0x0a9e('0x1c8'),'foreignKey':_0x0a9e('0x1c9')});db['SugarcrmField'][_0x0a9e('0x110')](db[_0x0a9e('0x1cc')],{'as':'Description','foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0x1cc')]['hasMany'](db[_0x0a9e('0x1cc')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db['SugarcrmField'][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0x1cf')]['hasMany'](db[_0x0a9e('0xa6')],{'as':'Configurations','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xa6')][_0x0a9e('0x110')](db[_0x0a9e('0xa8')],{'as':_0x0a9e('0x1c4'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xa6')]['hasMany'](db[_0x0a9e('0xa8')],{'as':_0x0a9e('0x1cd'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'DescriptionId'});db['DeskConfiguration']['hasMany'](db['DeskField'],{'as':'Fields','onDelete':_0x0a9e('0x10e'),'foreignKey':'FieldId'});db[_0x0a9e('0xa6')][_0x0a9e('0x150')](db[_0x0a9e('0x1cf')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xa6')]['belongsToMany'](db[_0x0a9e('0x86')],{'through':'int_desk_configuration_has_tags'});db['DeskField'][_0x0a9e('0x110')](db['DeskField'],{'as':_0x0a9e('0x1c8'),'foreignKey':'SubjectId'});db[_0x0a9e('0xa8')][_0x0a9e('0x110')](db[_0x0a9e('0xa8')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db['DeskField'][_0x0a9e('0x110')](db[_0x0a9e('0xa8')],{'as':'Field','foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xa8')]['belongsTo'](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0xaa')][_0x0a9e('0x110')](db[_0x0a9e('0xac')],{'as':_0x0a9e('0x1c3'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xac')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':'Subjects','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xac')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':_0x0a9e('0x1cd'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c5')});db['ZohoConfiguration'][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':_0x0a9e('0x1c1'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xac')][_0x0a9e('0x150')](db[_0x0a9e('0xaa')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xae')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':_0x0a9e('0x1c8'),'foreignKey':'SubjectId'});db[_0x0a9e('0xae')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':'Description','foreignKey':'DescriptionId'});db[_0x0a9e('0xae')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xae')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':'VariableId'});db[_0x0a9e('0xaf')][_0x0a9e('0x110')](db['ZendeskConfiguration'],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'AccountId'});db['ZendeskConfiguration'][_0x0a9e('0x110')](db[_0x0a9e('0xb2')],{'as':_0x0a9e('0x1c4'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0x1d0')]['hasMany'](db[_0x0a9e('0xb2')],{'as':'Descriptions','foreignKey':'DescriptionId'});db['ZendeskConfiguration'][_0x0a9e('0x110')](db['ZendeskField'],{'as':'Fields','foreignKey':'FieldId'});db[_0x0a9e('0x1d0')][_0x0a9e('0x150')](db[_0x0a9e('0xaf')],{'as':_0x0a9e('0x183'),'foreignKey':'AccountId'});db[_0x0a9e('0x1d0')]['belongsToMany'](db['Tag'],{'through':_0x0a9e('0x1d1')});db[_0x0a9e('0xb2')][_0x0a9e('0x110')](db['ZendeskField'],{'as':'Subject','foreignKey':'SubjectId'});db[_0x0a9e('0xb2')][_0x0a9e('0x110')](db[_0x0a9e('0xb2')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db['ZendeskField'][_0x0a9e('0x110')](db[_0x0a9e('0xb2')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xb2')][_0x0a9e('0x150')](db['Variable'],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0x1d2')][_0x0a9e('0x110')](db[_0x0a9e('0x1d3')],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0x1d3')][_0x0a9e('0x110')](db[_0x0a9e('0xb5')],{'as':_0x0a9e('0x1c4'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0x1d3')][_0x0a9e('0x110')](db[_0x0a9e('0xb5')],{'as':_0x0a9e('0x1cd'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0x1d3')]['hasMany'](db['FreshdeskField'],{'as':'Fields','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c6')});db['FreshdeskConfiguration'][_0x0a9e('0x150')](db[_0x0a9e('0x1d2')],{'as':'Account','foreignKey':_0x0a9e('0x1c7')});db['FreshdeskConfiguration'][_0x0a9e('0x121')](db['Tag'],{'through':_0x0a9e('0x1d4')});db[_0x0a9e('0xb5')][_0x0a9e('0x110')](db[_0x0a9e('0xb5')],{'as':'Subject','foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xb5')][_0x0a9e('0x110')](db['FreshdeskField'],{'as':'Description','foreignKey':'DescriptionId'});db['FreshdeskField'][_0x0a9e('0x110')](db[_0x0a9e('0xb5')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xb5')]['belongsTo'](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0x1d5')]['hasMany'](db[_0x0a9e('0xb8')],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xb8')]['hasMany'](db[_0x0a9e('0xb9')],{'as':_0x0a9e('0x1c4'),'foreignKey':_0x0a9e('0x1c9')});db['VtigerConfiguration'][_0x0a9e('0x110')](db['VtigerField'],{'as':_0x0a9e('0x1cd'),'foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0xb8')][_0x0a9e('0x110')](db[_0x0a9e('0xb9')],{'as':'Fields','foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xb8')][_0x0a9e('0x150')](db[_0x0a9e('0x1d5')],{'as':_0x0a9e('0x183'),'foreignKey':'AccountId'});db[_0x0a9e('0xb9')][_0x0a9e('0x110')](db[_0x0a9e('0xb9')],{'as':'Subject','foreignKey':_0x0a9e('0x1c9')});db['VtigerField']['hasMany'](db[_0x0a9e('0xb9')],{'as':'Description','foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0xb9')][_0x0a9e('0x110')](db['VtigerField'],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xb9')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0xba')]['hasMany'](db[_0x0a9e('0xbc')],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xbc')]['hasMany'](db['ServicenowField'],{'as':_0x0a9e('0x1c4'),'foreignKey':'SubjectId'});db[_0x0a9e('0xbc')][_0x0a9e('0x110')](db['ServicenowField'],{'as':_0x0a9e('0x1cd'),'foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0xbc')]['hasMany'](db[_0x0a9e('0x1d6')],{'as':_0x0a9e('0x1c1'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xbc')][_0x0a9e('0x150')](db[_0x0a9e('0xba')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1c7')});db['ServicenowField'][_0x0a9e('0x110')](db[_0x0a9e('0x1d6')],{'as':_0x0a9e('0x1c8'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0x1d6')]['hasMany'](db[_0x0a9e('0x1d6')],{'as':'Description','foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0x1d6')][_0x0a9e('0x110')](db['ServicenowField'],{'as':_0x0a9e('0x1cb'),'foreignKey':'FieldId'});db[_0x0a9e('0x1d6')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':'VariableId'});db[_0x0a9e('0xbe')]['hasMany'](db[_0x0a9e('0xbf')],{'as':_0x0a9e('0x1c3'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xbe')][_0x0a9e('0x150')](db['CloudProvider'],{'as':_0x0a9e('0x103'),'foreignKey':'CloudProviderId'});db[_0x0a9e('0xbf')][_0x0a9e('0x110')](db['Dynamics365Field'],{'as':'Subjects','onDelete':'cascade','foreignKey':'SubjectId'});db[_0x0a9e('0xbf')][_0x0a9e('0x110')](db[_0x0a9e('0xc1')],{'as':_0x0a9e('0x1cd'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c5')});db['Dynamics365Configuration'][_0x0a9e('0x110')](db[_0x0a9e('0xc1')],{'as':'Fields','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xbf')][_0x0a9e('0x150')](db[_0x0a9e('0xbe')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1c7')});db['Dynamics365Field'][_0x0a9e('0x110')](db[_0x0a9e('0xc1')],{'as':_0x0a9e('0x1c8'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xc1')][_0x0a9e('0x110')](db[_0x0a9e('0xc1')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0xc1')][_0x0a9e('0x110')](db['Dynamics365Field'],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xc1')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db['FreshsalesAccount'][_0x0a9e('0x110')](db[_0x0a9e('0xc5')],{'as':_0x0a9e('0x1c3'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xc5')][_0x0a9e('0x110')](db['FreshsalesField'],{'as':'Subjects','foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xc5')][_0x0a9e('0x110')](db[_0x0a9e('0xc7')],{'as':_0x0a9e('0x1cd'),'foreignKey':'DescriptionId'});db[_0x0a9e('0xc5')]['hasMany'](db[_0x0a9e('0xc7')],{'as':_0x0a9e('0x1c1'),'foreignKey':'FieldId'});db[_0x0a9e('0xc5')]['belongsTo'](db[_0x0a9e('0xc3')],{'as':_0x0a9e('0x183'),'foreignKey':'AccountId'});db[_0x0a9e('0xc7')][_0x0a9e('0x110')](db[_0x0a9e('0xc7')],{'as':'Subject','foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xc7')][_0x0a9e('0x110')](db[_0x0a9e('0xc7')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db['FreshsalesField'][_0x0a9e('0x110')](db[_0x0a9e('0xc7')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db['FreshsalesField']['belongsTo'](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db['ChatQueueReport']['belongsTo'](db[_0x0a9e('0x60')],{});db['ChatQueueReport']['belongsTo'](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':'ListId'});db[_0x0a9e('0xca')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db['ChatQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x64')],{});db['ChatQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x65')],{});db[_0x0a9e('0xca')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db['ChatQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x67')],{});db['ChatInternalMessage']['belongsTo'](db[_0x0a9e('0x11')],{'onDelete':_0x0a9e('0x10e'),'foreignKey':'FromId'});db['ChatInternalMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1d7')});db[_0x0a9e('0xd0')]['hasMany'](db[_0x0a9e('0x1d8')],{'foreignKey':'SessionId','onDelete':'cascade'});db[_0x0a9e('0xd0')]['hasMany'](db[_0x0a9e('0xcd')],{'foreignKey':'SessionId','onDelete':_0x0a9e('0x10e')});db['SmsQueueReport']['belongsTo'](db[_0x0a9e('0x50')],{});db[_0x0a9e('0xd2')][_0x0a9e('0x150')](db['CmList'],{'as':'List','foreignKey':'ListId'});db[_0x0a9e('0xd2')][_0x0a9e('0x150')](db['CmContact'],{'as':_0x0a9e('0x160'),'foreignKey':'ContactId'});db[_0x0a9e('0xd2')]['belongsTo'](db[_0x0a9e('0x53')],{});db[_0x0a9e('0xd2')]['belongsTo'](db['SmsMessage'],{});db['SmsQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db[_0x0a9e('0xd2')][_0x0a9e('0x150')](db[_0x0a9e('0x57')],{});db[_0x0a9e('0x1d9')][_0x0a9e('0x110')](db[_0x0a9e('0xd0')],{'foreignKey':_0x0a9e('0x1da')});db[_0x0a9e('0x1d9')][_0x0a9e('0x110')](db[_0x0a9e('0x1d8')],{'foreignKey':_0x0a9e('0x1da')});db[_0x0a9e('0x1d9')][_0x0a9e('0x110')](db['JscriptyAnswerReport'],{'foreignKey':'ProjectId'});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':'user_has_teams'});db[_0x0a9e('0x129')]['belongsToMany'](db[_0x0a9e('0x1a')],{'through':'TeamVoiceQueue','as':_0x0a9e('0x131')});db['Team']['belongsToMany'](db[_0x0a9e('0x3c')],{'through':_0x0a9e('0x171'),'as':_0x0a9e('0x1db')});db[_0x0a9e('0x129')]['belongsToMany'](db['ChatQueue'],{'through':_0x0a9e('0x19b'),'as':'ChatQueues'});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db['FaxQueue'],{'through':_0x0a9e('0x187'),'as':'FaxQueues'});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db[_0x0a9e('0x57')],{'through':_0x0a9e('0x18c'),'as':_0x0a9e('0x136')});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db[_0x0a9e('0x137')],{'through':_0x0a9e('0x190'),'as':_0x0a9e('0x1dc')});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db[_0x0a9e('0x101')],{'through':_0x0a9e('0x1dd'),'as':_0x0a9e('0x138')});db[_0x0a9e('0x129')]['belongsToMany'](db[_0x0a9e('0xf1')],{'through':_0x0a9e('0x107'),'as':_0x0a9e('0x132')});db['Campaign'][_0x0a9e('0x110')](db[_0x0a9e('0x6d')],{'as':_0x0a9e('0x14c'),'foreignKey':_0x0a9e('0x1a7')});db[_0x0a9e('0x1a5')][_0x0a9e('0x110')](db[_0x0a9e('0x71')],{'as':_0x0a9e('0x115'),'foreignKey':_0x0a9e('0x1a7')});db[_0x0a9e('0x1a5')][_0x0a9e('0x110')](db['CmHopperHistory'],{'as':_0x0a9e('0x19e'),'foreignKey':_0x0a9e('0x1a7')});db[_0x0a9e('0x1a5')]['hasMany'](db[_0x0a9e('0x6f')],{'as':'HopperBlacks','foreignKey':'CampaignId'});db[_0x0a9e('0x1a5')]['belongsTo'](db[_0x0a9e('0x28')],{'as':'Trunk','foreignKey':_0x0a9e('0x14f')});db[_0x0a9e('0x1a5')][_0x0a9e('0x150')](db['Trunk'],{'as':_0x0a9e('0x151'),'foreignKey':'TrunkBackupId'});db['Campaign'][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'as':_0x0a9e('0x17b'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x1a5')][_0x0a9e('0x150')](db['SquareProject'],{'as':_0x0a9e('0xdc'),'foreignKey':_0x0a9e('0x1de')});db[_0x0a9e('0x1a5')][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'as':'Lists','through':_0x0a9e('0x1df')});db[_0x0a9e('0x1a5')][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x156'),'through':_0x0a9e('0x1e0')});db[_0x0a9e('0xe4')][_0x0a9e('0x150')](db[_0x0a9e('0x66')],{'as':_0x0a9e('0x66'),'foreignKey':_0x0a9e('0x19a')});db[_0x0a9e('0x1e1')][_0x0a9e('0x150')](db['MailMessage'],{});db['MailTransferReport'][_0x0a9e('0x150')](db[_0x0a9e('0x11c')],{});db['MailTransferReport'][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'foreignKey':_0x0a9e('0x1e2'),'as':_0x0a9e('0x1e3')});db[_0x0a9e('0x1e1')]['belongsTo'](db['User'],{'foreignKey':'FromUserId','as':_0x0a9e('0x1e4')});db[_0x0a9e('0x1e1')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':_0x0a9e('0x1e5'),'as':_0x0a9e('0x1e6')});db[_0x0a9e('0x1e1')][_0x0a9e('0x150')](db[_0x0a9e('0x3c')],{'foreignKey':'ToMailQueueId','as':'ToQueue'});db[_0x0a9e('0x1e1')][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'foreignKey':_0x0a9e('0x1e7'),'as':_0x0a9e('0x1e8')});db[_0x0a9e('0xe8')][_0x0a9e('0x150')](db[_0x0a9e('0x65')],{});db[_0x0a9e('0xe8')][_0x0a9e('0x150')](db['ChatInteraction'],{});db[_0x0a9e('0xe8')]['belongsTo'](db['ChatWebsite'],{'foreignKey':_0x0a9e('0x1e9'),'as':_0x0a9e('0x1e3')});db[_0x0a9e('0xe8')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':_0x0a9e('0x1ea'),'as':_0x0a9e('0x1e4')});db[_0x0a9e('0xe8')][_0x0a9e('0x150')](db['User'],{'foreignKey':_0x0a9e('0x1e5'),'as':_0x0a9e('0x1e6')});db[_0x0a9e('0xe8')]['belongsTo'](db[_0x0a9e('0x67')],{'foreignKey':_0x0a9e('0x1eb'),'as':'ToQueue'});db['ChatTransferReport']['belongsTo'](db['ChatWebsite'],{'foreignKey':_0x0a9e('0x1ec'),'as':_0x0a9e('0x1e8')});db['FaxTransferReport'][_0x0a9e('0x150')](db['FaxMessage'],{});db[_0x0a9e('0xea')][_0x0a9e('0x150')](db[_0x0a9e('0x11b')],{});db['FaxTransferReport']['belongsTo'](db[_0x0a9e('0x45')],{'foreignKey':_0x0a9e('0x1ed'),'as':_0x0a9e('0x1e3')});db[_0x0a9e('0xea')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':_0x0a9e('0x1ea'),'as':_0x0a9e('0x1e4')});db[_0x0a9e('0xea')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':'ToUserId','as':_0x0a9e('0x1e6')});db[_0x0a9e('0xea')]['belongsTo'](db['FaxQueue'],{'foreignKey':_0x0a9e('0x1ee'),'as':_0x0a9e('0x1ef')});db[_0x0a9e('0xea')][_0x0a9e('0x150')](db[_0x0a9e('0x45')],{'foreignKey':'ToFaxAccountId','as':_0x0a9e('0x1e8')});db[_0x0a9e('0xec')]['belongsTo'](db[_0x0a9e('0x5e')],{});db['OpenchannelTransferReport']['belongsTo'](db['OpenchannelInteraction'],{});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db['OpenchannelAccount'],{'foreignKey':'FromOpenchannelAccountId','as':_0x0a9e('0x1e3')});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':'FromUserId','as':_0x0a9e('0x1e4')});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db['User'],{'foreignKey':_0x0a9e('0x1e5'),'as':_0x0a9e('0x1e6')});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db[_0x0a9e('0x137')],{'foreignKey':'ToOpenchannelQueueId','as':'ToQueue'});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db[_0x0a9e('0x59')],{'foreignKey':'ToOpenchannelAccountId','as':'ToAccount'});db['SmsTransferReport']['belongsTo'](db[_0x0a9e('0x55')],{});db[_0x0a9e('0xee')][_0x0a9e('0x150')](db[_0x0a9e('0x53')],{});db[_0x0a9e('0xee')]['belongsTo'](db[_0x0a9e('0x50')],{'foreignKey':_0x0a9e('0x1f0'),'as':_0x0a9e('0x1e3')});db[_0x0a9e('0xee')][_0x0a9e('0x150')](db['User'],{'foreignKey':_0x0a9e('0x1ea'),'as':_0x0a9e('0x1e4')});db[_0x0a9e('0xee')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':'ToUserId','as':_0x0a9e('0x1e6')});db[_0x0a9e('0xee')]['belongsTo'](db['SmsQueue'],{'foreignKey':'ToSmsQueueId','as':_0x0a9e('0x1ef')});db[_0x0a9e('0xee')]['belongsTo'](db[_0x0a9e('0x50')],{'foreignKey':'ToSmsAccountId','as':'ToAccount'});db['CmList']['hasMany'](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':_0x0a9e('0x16d'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x139')][_0x0a9e('0x110')](db[_0x0a9e('0x1f1')],{'as':_0x0a9e('0x1f2'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x139')][_0x0a9e('0x110')](db['CmContact'],{'as':_0x0a9e('0x125'),'onDelete':'cascade','foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x139')][_0x0a9e('0x110')](db[_0x0a9e('0x71')],{'as':_0x0a9e('0x115'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x139')][_0x0a9e('0x110')](db[_0x0a9e('0x116')],{'as':'HopperHistory','foreignKey':'ListId'});db['CmList'][_0x0a9e('0x110')](db[_0x0a9e('0x73')],{'as':_0x0a9e('0x73'),'foreignKey':'ListId'});db[_0x0a9e('0x139')][_0x0a9e('0x121')](db[_0x0a9e('0x1a')],{'as':'Queues','through':_0x0a9e('0x1f3')});db[_0x0a9e('0x139')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Agents','through':_0x0a9e('0x128')});db[_0x0a9e('0xf1')][_0x0a9e('0x110')](db[_0x0a9e('0x16')],{'as':_0x0a9e('0x114'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0xf1')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':'UserVoicePrefix'});db[_0x0a9e('0xf1')]['belongsToMany'](db[_0x0a9e('0x129')],{'through':'TeamVoicePrefix','as':_0x0a9e('0x155')});db[_0x0a9e('0xf2')][_0x0a9e('0x110')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'foreignKey':_0x0a9e('0x1f4')});db['UserProfile'][_0x0a9e('0x110')](db['UserProfileSection'],{'as':_0x0a9e('0x1f5'),'foreignKey':_0x0a9e('0x1f4'),'onDelete':_0x0a9e('0x10e')});db['UserProfileSection']['hasMany'](db['UserProfileResource'],{'as':_0x0a9e('0x1f6'),'foreignKey':_0x0a9e('0x1f7'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0xf7')][_0x0a9e('0x110')](db[_0x0a9e('0x167')],{'as':'Dispositions','foreignKey':_0x0a9e('0x1f8'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0xf7')][_0x0a9e('0x110')](db['CannedAnswer'],{'as':_0x0a9e('0x169'),'foreignKey':_0x0a9e('0x1f8')});db['WhatsappAccount'][_0x0a9e('0x110')](db[_0x0a9e('0xfd')],{'as':_0x0a9e('0x158'),'foreignKey':'WhatsappAccountId'});db[_0x0a9e('0xf7')]['hasMany'](db[_0x0a9e('0xfb')],{'as':'Interactions'});db[_0x0a9e('0xf7')][_0x0a9e('0x110')](db['WhatsappApplication'],{'as':_0x0a9e('0x147'),'foreignKey':_0x0a9e('0x1f8'),'onDelete':_0x0a9e('0x10e')});db['WhatsappAccount'][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0xf7')][_0x0a9e('0x150')](db[_0x0a9e('0x7d')],{'as':'mandatoryDispositionPause','foreignKey':_0x0a9e('0x154')});db[_0x0a9e('0xf7')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x144')});db[_0x0a9e('0xf9')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0xf9')][_0x0a9e('0x150')](db[_0x0a9e('0x101')],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0xf9')][_0x0a9e('0x150')](db['WhatsappAccount'],{'onDelete':_0x0a9e('0x164')});db['WhatsappApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'onDelete':'restrict','foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0xf9')]['belongsTo'](db[_0x0a9e('0x86')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x181')});db['WhatsappInteraction'][_0x0a9e('0x110')](db['WhatsappMessage'],{'as':'Messages','onDelete':'cascade','foreignKey':_0x0a9e('0x1f9')});db[_0x0a9e('0xfb')][_0x0a9e('0x150')](db[_0x0a9e('0xf7')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1f8')});db[_0x0a9e('0xfb')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0xfb')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0xfb')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x1b5'),'as':_0x0a9e('0x174')});db['WhatsappInteraction'][_0x0a9e('0x121')](db['Tag'],{'through':_0x0a9e('0x1b5'),'as':_0x0a9e('0x175')});db[_0x0a9e('0xfb')]['belongsToMany'](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'through':_0x0a9e('0x130'),'foreignKey':'WhatsappInteractionId'});db[_0x0a9e('0xfd')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x11')});db[_0x0a9e('0xfd')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':'cascade','as':_0x0a9e('0x160')});db[_0x0a9e('0xfd')][_0x0a9e('0x150')](db['WhatsappInteraction'],{'onDelete':'cascade','as':_0x0a9e('0x179'),'foreignKey':_0x0a9e('0x1f9')});db[_0x0a9e('0xfd')]['belongsTo'](db[_0x0a9e('0xf7')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1f8')});db[_0x0a9e('0xfe')][_0x0a9e('0x150')](db[_0x0a9e('0xf7')],{});db['WhatsappQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0xfe')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0xfe')][_0x0a9e('0x150')](db['WhatsappInteraction'],{});db['WhatsappQueueReport']['belongsTo'](db[_0x0a9e('0x101')],{});db[_0x0a9e('0xfe')]['belongsTo'](db['WhatsappMessage'],{});db[_0x0a9e('0xfe')][_0x0a9e('0x150')](db['User'],{});db['WhatsappTransferReport'][_0x0a9e('0x150')](db[_0x0a9e('0xfd')],{});db['WhatsappTransferReport'][_0x0a9e('0x150')](db[_0x0a9e('0xfb')],{});db[_0x0a9e('0x1fa')]['belongsTo'](db['WhatsappAccount'],{'foreignKey':_0x0a9e('0x1fb'),'as':_0x0a9e('0x1e3')});db['WhatsappTransferReport']['belongsTo'](db[_0x0a9e('0xf7')],{'foreignKey':_0x0a9e('0x1fc'),'as':'ToAccount'});db[_0x0a9e('0x1fa')]['belongsTo'](db['WhatsappQueue'],{'foreignKey':_0x0a9e('0x1fd'),'as':_0x0a9e('0x1ef')});db['WhatsappTransferReport']['belongsTo'](db['User'],{'foreignKey':_0x0a9e('0x1ea'),'as':'FromAgent'});db[_0x0a9e('0x1fa')][_0x0a9e('0x150')](db['User'],{'foreignKey':'ToUserId','as':_0x0a9e('0x1e6')});db[_0x0a9e('0x101')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x37'),'foreignKey':'WhatsappQueueId'});db[_0x0a9e('0x101')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x1dd'),'as':'Teams'});db[_0x0a9e('0x1fe')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x1ff'),'foreignKey':_0x0a9e('0x10f'),'onDelete':_0x0a9e('0x10e'),'hooks':!![]});db[_0x0a9e('0x103')][_0x0a9e('0x10b')](db['Dynamics365Account'],{'as':_0x0a9e('0xbe'),'onDelete':_0x0a9e('0x164')});db['CloudProvider'][_0x0a9e('0x10b')](db['MailServerIn'],{'as':'Imap','onDelete':_0x0a9e('0x164')});db['CloudProvider']['hasOne'](db['MailServerOut'],{'as':'Smtp','onDelete':_0x0a9e('0x164')});module['exports']={'db':db,'dbH':dbH}; \ No newline at end of file +var _0xa9e0=['SquareRecording','../api/squareRecording/squareRecording.model','SquareMessage','../api/squareMessage/squareMessage.model','License','Migration','../api/migration/migration.model','Attachment','../api/attachment/attachment.model','Plugin','../api/plugin/plugin.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','../api/cmList/cmList.model','VoicePrefix','UserProfile','UserProfileSection','UserProfileResource','UserNotification','../api/userNotification/userNotification.model','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','CloudProvider','../api/cloudProvider/cloudProvider.model','TeamVoiceQueue','../api/teamVoiceQueue/teamVoiceQueue.model','TeamVoicePrefix','../api/teamVoicePrefix/teamVoicePrefix.model','UserVoicePrefix','../api/userVoicePrefix/userVoicePrefix.model','hasOne','VoiceMail','userSetting','cascade','UserId','hasMany','VoiceRecording','Recordings','VoiceQueuesRt','Extensions','HopperFinals','CmHopperHistory','HopperHistory','OpenchannelInteractions','ChatInteractions','SmsInteractions','FaxInteraction','MailInteraction','MailInteractions','WhatsappInteractions','UserNotifications','SenderId','belongsToMany','Groups','chat_group_has_users','CmContact','Contacts','cm_user_has_contacts','Lists','cm_user_has_lists','Team','user_has_teams','user_has_mail_interactions','FaxInteractions','user_has_fax_interactions','user_has_sms_interactions','user_has_openchannel_interactions','user_has_whatsapp_interactions','VoiceQueues','VoicePrefixes','ChatQueues','UserChatQueue','FaxQueues','SmsQueues','OpenchannelQueue','WhatsappQueues','CmList','ChatWebsites','user_has_chat_websites','user_has_fax_accounts','MailAccounts','user_has_mail_accounts','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccounts','user_has_sms_accounts','WhatsappAccounts','user_has_whatsapp_accounts','ChanSpyId','VoiceContext','Applications','Sounds','moh_has_sounds','Members','VoiceQueueId','Hoppers','HopperBlacks','JscriptySessions','TrunkId','belongsTo','TrunkBackup','TrunkBackupId','IntervalId','mandatoryDispositionPauseId','Teams','BlackLists','voice_queues_has_cm_blacklists','Messages','mailbox','mailboxuser','VoiceCallReport','QueueCalls','uniqueid','VoiceAgentReport','AgentReports','Contact','MailAccountId','CloudProviderId','MailServerOut','restrict','Imap','Smtp','Disposition','Dispositions','Answers','Interactions','MailApplication','List','ListId','TemplateId','mandatoryDispositionPause','Agents','team_has_mail_queues','ContactId','mail_interaction_has_tags','Tags','ThroughTags','Users','MailInteractionId','Attachments','Interaction','ChatWebsiteId','Interval','MailQueueReport','Dashboard','CannedAnswer','FaxAccountId','Exntensions','TagId','FaxInteractionId','Account','Owner','fax_interaction_has_tags','AttachmentId','team_has_fax_queues','SmsAccountId','SmsInteractionId','sms_interaction_has_tags','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelQueueId','OpenchannelInteractionId','team_has_openchannel_queues','ChatProactiveAction','ProactiveActions','Agent','Queue','ChatQueueId','Website','ChatInteractionId','chat_interaction_has_tags','user_has_chat_interactions','ChatOfflineMessageId','team_has_chat_queues','ChatGroupId','CmContactId','HopperHistories','CmCompany','Company','cm_contact_has_tags','CmHopperAdditionalPhone','AdditionalPhones','CmHopperId','Campaign','OwnerId','CampaignId','All','OneAll','OneAny','Actions','ParentId','Intervals','MailApplications','ChatApplications','FaxApplications','SmsApplications','DefaultReportId','CustomReportId','openchannel_interaction_has_tags','whatsapp_interaction_has_tags','CmContactHasItem','ItemType','ItemTypeId','Hopper','AllConditions','AllCondition','TriggerAllId','AnyConditions','AnyCondition','TriggerAnyId','AnalyticCustomReport','Fields','MetricId','Configurations','Subjects','DescriptionId','FieldId','AccountId','Subject','SubjectId','Description','Field','SugarcrmField','Descriptions','VariableId','DeskAccount','ZendeskConfiguration','int_zendesk_configuration_has_tags','FreshdeskAccount','FreshdeskConfiguration','int_freshdesk_configuration_has_tags','VtigerAccount','ServicenowField','ToId','JscriptyQuestionReport','JscriptyProject','ProjectId','MailQueues','OpenchannelQueues','team_has_whatsapp_queues','SquareProjectId','campaigns_has_cm_lists','campaigns_has_cm_blacklists','MailTransferReport','FromMailAccountId','FromAccount','FromAgent','ToUserId','ToAgent','ToMailAccountId','ToAccount','FromChatWebsiteId','FromUserId','ToChatQueueId','ToChatWebsiteId','FromFaxAccountId','ToFaxQueueId','ToQueue','FromSmsAccountId','CmCustomField','CustomFields','voice_queues_has_cm_lists','userProfileId','UserProfileSections','Resources','sectionId','WhatsappAccountId','WhatsappInteractionId','WhatsappTransferReport','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','UserSetting','user','../config/environment','sequelize','lodash','motion2','xcall','xC@LL1234','127.0.0.1','utf8mb4','name','utf8','defaultsDeep','mysql','username','password','options','database','sequelizeHistory','User','import','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','../api/voiceContext/voiceContext.model','VoiceExtension','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','ScreenRecording','../api/screenRecording/screenRecording.model','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','Trunk','../api/trunk/trunk.model','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','../api/mailServerOut/mailServerOut.model','MailAccount','MailQueue','MailSubstatus','MailMessage','../api/mailMessage/mailMessage.model','../api/mailApplication/mailApplication.model','../api/mailQueueReport/mailQueueReport.model','../api/dashboard/dashboard.model','DashboardItem','../api/dashboardItem/dashboardItem.model','FaxAccount','../api/faxAccount/faxAccount.model','FaxApplication','../api/faxApplication/faxApplication.model','../api/faxInteraction/faxInteraction.model','FaxMessage','../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','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','OpenchannelMessage','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','ChatApplication','ChatInteraction','ChatMessage','ChatOfflineMessage','ChatQueue','ChatGroup','../api/chatGroup/chatGroup.model','../api/chatProactiveAction/chatProactiveAction.model','../api/cmCompany/cmCompany.model','../api/cmContact/cmContact.model','CmHopper','../api/cmHopper/cmHopper.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','ReportAgentPreview','Action','../api/action/action.model','Automation','../api/automation/automation.model','../api/cannedAnswer/cannedAnswer.model','../api/disposition/disposition.model','Condition','../api/condition/condition.model','../api/interval/interval.model','Pause','../api/pause/pause.model','Cdr','../api/cdr/cdr.model','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','../api/schedule/schedule.model','Sound','../api/sound/sound.model','Tag','../api/tag/tag.model','ContactItemType','../api/contactItemType/contactItemType.model','../api/cmContactHasItem/cmContactHasItem.model','Template','../api/template/template.model','Trigger','Variable','../api/variable/variable.model','Integration','../api/integration/integration.model','../api/integrationReport/integrationReport.model','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','SugarcrmAccount','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','../api/intSugarcrmField/intSugarcrmField.model','../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','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','../api/intZendeskField/intZendeskField.model','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','VtigerField','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','Dynamics365Account','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','../api/network/network.model','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','SquareReport','../api/squareReport/squareReport.model','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','../api/jscriptyProject/jscriptyProject.model','Setting','../api/setting/setting.model','../api/squareOdbc/squareOdbc.model','SquareProject'];(function(_0x4bdf64,_0x3022b2){var _0x9a1a19=function(_0x4e551b){while(--_0x4e551b){_0x4bdf64['push'](_0x4bdf64['shift']());}};_0x9a1a19(++_0x3022b2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4bfac3,_0x58324d){_0x4bfac3=_0x4bfac3-0x0;var _0x15f0f2=_0xa9e0[_0x4bfac3];return _0x15f0f2;};'use strict';var config=require(_0x0a9e('0x0'));var Sequelize=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var jstz=require('jstz');var timezone=jstz['determine']();config[_0x0a9e('0x1')]=_['defaultsDeep'](config[_0x0a9e('0x1')],{'database':_0x0a9e('0x3'),'username':_0x0a9e('0x4'),'password':_0x0a9e('0x5'),'options':{'host':_0x0a9e('0x6'),'port':0xcea,'dialect':'mysql','dialectOptions':{'charset':_0x0a9e('0x7')},'logging':![],'timezone':timezone[_0x0a9e('0x8')](),'define':{'charset':_0x0a9e('0x9'),'collate':'utf8_general_ci'}}});config['sequelizeHistory']=_[_0x0a9e('0xa')](config['sequelizeHistory'],{'database':'motion2','username':_0x0a9e('0x4'),'password':_0x0a9e('0x5'),'options':{'host':_0x0a9e('0x6'),'port':0xcea,'dialect':_0x0a9e('0xb'),'dialectOptions':{'charset':_0x0a9e('0x7')},'logging':![],'timezone':timezone[_0x0a9e('0x8')](),'define':{'charset':'utf8','collate':'utf8_general_ci'}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelize']['database'],config[_0x0a9e('0x1')][_0x0a9e('0xc')],config[_0x0a9e('0x1')][_0x0a9e('0xd')],config[_0x0a9e('0x1')][_0x0a9e('0xe')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelizeHistory'][_0x0a9e('0xf')],config[_0x0a9e('0x10')][_0x0a9e('0xc')],config[_0x0a9e('0x10')][_0x0a9e('0xd')],config[_0x0a9e('0x10')]['options'])};db[_0x0a9e('0x11')]=db['sequelize'][_0x0a9e('0x12')]('../api/user/user.model');db[_0x0a9e('0x13')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x14'));db['VoiceContext']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x15'));db[_0x0a9e('0x16')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x17'));db[_0x0a9e('0x18')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x19'));db[_0x0a9e('0x1a')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x1b'));db['VoiceRecording']=db[_0x0a9e('0x1')]['import']('../api/voiceRecording/voiceRecording.model');db[_0x0a9e('0x1c')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x1d'));db['VoiceMail']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x1e'));db[_0x0a9e('0x1f')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x20'));db['VoiceCallReport']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x21'));db[_0x0a9e('0x22')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x23'));db['VoiceAgentReport']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x24'));db[_0x0a9e('0x25')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x26'));db[_0x0a9e('0x27')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/memberReport/memberReport.model');db[_0x0a9e('0x28')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x29'));db['VoiceTransferReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x2a'));db[_0x0a9e('0x2b')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x2c'));db[_0x0a9e('0x2d')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x2e'));db['UserChatQueue']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x2f'));db[_0x0a9e('0x30')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x31'));db[_0x0a9e('0x32')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x33'));db[_0x0a9e('0x34')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/userSmsQueue/userSmsQueue.model');db[_0x0a9e('0x35')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x36'));db[_0x0a9e('0x37')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x38'));db[_0x0a9e('0x39')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailServerIn/mailServerIn.model');db['MailServerOut']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x3a'));db[_0x0a9e('0x3b')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailAccount/mailAccount.model');db[_0x0a9e('0x3c')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailQueue/mailQueue.model');db[_0x0a9e('0x3d')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailSubstatus/mailSubstatus.model');db['MailInteraction']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailInteraction/mailInteraction.model');db[_0x0a9e('0x3e')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x3f'));db['MailApplication']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x40'));db['MailQueueReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x41'));db['Dashboard']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x42'));db[_0x0a9e('0x43')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x44'));db[_0x0a9e('0x45')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x46'));db[_0x0a9e('0x47')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x48'));db['FaxInteraction']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x49'));db[_0x0a9e('0x4a')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x4b'));db[_0x0a9e('0x4c')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x4d'));db[_0x0a9e('0x4e')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x4f'));db[_0x0a9e('0x50')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x51'));db[_0x0a9e('0x52')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/smsApplication/smsApplication.model');db[_0x0a9e('0x53')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x54'));db[_0x0a9e('0x55')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x56'));db[_0x0a9e('0x57')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x58'));db[_0x0a9e('0x59')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x5a'));db[_0x0a9e('0x5b')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x5c'));db[_0x0a9e('0x5d')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/openchannelInteraction/openchannelInteraction.model');db[_0x0a9e('0x5e')]=db[_0x0a9e('0x1')]['import']('../api/openchannelMessage/openchannelMessage.model');db['OpenchannelQueue']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x5f'));db[_0x0a9e('0x60')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x61'));db[_0x0a9e('0x62')]=db['sequelize']['import']('../api/openchannelQueueReport/openchannelQueueReport.model');db[_0x0a9e('0x63')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/chatApplication/chatApplication.model');db[_0x0a9e('0x64')]=db[_0x0a9e('0x1')]['import']('../api/chatInteraction/chatInteraction.model');db[_0x0a9e('0x65')]=db['sequelize'][_0x0a9e('0x12')]('../api/chatMessage/chatMessage.model');db[_0x0a9e('0x66')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/chatOfflineMessage/chatOfflineMessage.model');db[_0x0a9e('0x67')]=db[_0x0a9e('0x1')]['import']('../api/chatQueue/chatQueue.model');db[_0x0a9e('0x68')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x69'));db['ChatProactiveAction']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x6a'));db['CmCompany']=db['sequelize']['import'](_0x0a9e('0x6b'));db['CmContact']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x6c'));db[_0x0a9e('0x6d')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x6e'));db[_0x0a9e('0x6f')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x70'));db[_0x0a9e('0x71')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x72'));db['CmHopperHistory']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/cmHopperHistory/cmHopperHistory.model');db[_0x0a9e('0x73')]=db['sequelize'][_0x0a9e('0x12')]('../api/reportAgentPreview/reportAgentPreview.model');db['CmCustomField']=db['sequelize'][_0x0a9e('0x12')]('../api/cmCustomField/cmCustomField.model');db[_0x0a9e('0x74')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x75'));db[_0x0a9e('0x76')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x77'));db['CannedAnswer']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x78'));db['Disposition']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x79'));db[_0x0a9e('0x7a')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x7b'));db['Interval']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x7c'));db[_0x0a9e('0x7d')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x7e'));db[_0x0a9e('0x7f')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x80'));db['VoiceQueuesLog']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x81'));db[_0x0a9e('0x82')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x83'));db[_0x0a9e('0x84')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x85'));db[_0x0a9e('0x86')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x87'));db[_0x0a9e('0x88')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x89'));db['CmContactHasItem']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x8a'));db['CmHopperAdditionalPhone']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model');db[_0x0a9e('0x8b')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x8c'));db[_0x0a9e('0x8d')]=db['sequelize']['import']('../api/trigger/trigger.model');db[_0x0a9e('0x8e')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x8f'));db[_0x0a9e('0x90')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x91'));db['IntegrationReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x92'));db['AnalyticCustomReport']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x93'));db[_0x0a9e('0x94')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x95'));db[_0x0a9e('0x96')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x97'));db[_0x0a9e('0x98')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/analyticMetric/analyticMetric.model');db[_0x0a9e('0x99')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x9a'));db['AnalyticTreeReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x9b'));db[_0x0a9e('0x9c')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x9d'));db[_0x0a9e('0x9e')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x9f'));db[_0x0a9e('0xa0')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intSalesforceField/intSalesforceField.model');db[_0x0a9e('0xa1')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intSugarcrmAccount/intSugarcrmAccount.model');db[_0x0a9e('0xa2')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xa3'));db['SugarcrmField']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xa4'));db['DeskAccount']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xa5'));db[_0x0a9e('0xa6')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xa7'));db[_0x0a9e('0xa8')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xa9'));db[_0x0a9e('0xaa')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xab'));db[_0x0a9e('0xac')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xad'));db[_0x0a9e('0xae')]=db['sequelize'][_0x0a9e('0x12')]('../api/intZohoField/intZohoField.model');db[_0x0a9e('0xaf')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xb0'));db['ZendeskConfiguration']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xb1'));db[_0x0a9e('0xb2')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xb3'));db['FreshdeskAccount']=db['sequelize'][_0x0a9e('0x12')]('../api/intFreshdeskAccount/intFreshdeskAccount.model');db['FreshdeskConfiguration']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xb4'));db[_0x0a9e('0xb5')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xb6'));db['VtigerAccount']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xb7'));db[_0x0a9e('0xb8')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intVtigerConfiguration/intVtigerConfiguration.model');db[_0x0a9e('0xb9')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intVtigerField/intVtigerField.model');db[_0x0a9e('0xba')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xbb'));db[_0x0a9e('0xbc')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xbd'));db['ServicenowField']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intServicenowField/intServicenowField.model');db[_0x0a9e('0xbe')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intDynamics365Account/intDynamics365Account.model');db[_0x0a9e('0xbf')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xc0'));db[_0x0a9e('0xc1')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xc2'));db[_0x0a9e('0xc3')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xc4'));db[_0x0a9e('0xc5')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xc6'));db[_0x0a9e('0xc7')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xc8'));db[_0x0a9e('0x90')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x91'));db['Network']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xc9'));db[_0x0a9e('0xca')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xcb'));db[_0x0a9e('0xcc')]=db['sequelize'][_0x0a9e('0x12')]('../api/chatInternalMessage/chatInternalMessage.model');db[_0x0a9e('0xcd')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xce'));db['JscriptyQuestionReport']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xcf'));db[_0x0a9e('0xd0')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xd1'));db[_0x0a9e('0xd2')]=db['sequelize']['import'](_0x0a9e('0xd3'));db[_0x0a9e('0xd4')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xd5'));db[_0x0a9e('0xd6')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xd7'));db['JscriptyProject']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xd8'));db[_0x0a9e('0xd9')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xda'));db['SquareOdbc']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xdb'));db[_0x0a9e('0xdc')]=db[_0x0a9e('0x1')]['import']('../api/squareProject/squareProject.model');db[_0x0a9e('0xdd')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xde'));db[_0x0a9e('0xdf')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xe0'));db['Team']=db['sequelize'][_0x0a9e('0x12')]('../api/team/team.model');db[_0x0a9e('0xe1')]=db['sequelize'][_0x0a9e('0x12')]('../api/license/license.model');db['Campaign']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/campaign/campaign.model');db[_0x0a9e('0xe2')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xe3'));db[_0x0a9e('0xe4')]=db['sequelize']['import'](_0x0a9e('0xe5'));db[_0x0a9e('0xe6')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xe7'));db['MailTransferReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailTransferReport/mailTransferReport.model');db[_0x0a9e('0xe8')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xe9'));db[_0x0a9e('0xea')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xeb'));db[_0x0a9e('0xec')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xed'));db[_0x0a9e('0xee')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xef'));db['CmList']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xf0'));db[_0x0a9e('0xf1')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/voicePrefix/voicePrefix.model');db[_0x0a9e('0xf2')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/userProfile/userProfile.model');db[_0x0a9e('0xf3')]=db['sequelize'][_0x0a9e('0x12')]('../api/userProfileSection/userProfileSection.model');db[_0x0a9e('0xf4')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/userProfileResource/userProfileResource.model');db[_0x0a9e('0xf5')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xf6'));db[_0x0a9e('0xf7')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xf8'));db[_0x0a9e('0xf9')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xfa'));db[_0x0a9e('0xfb')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xfc'));db[_0x0a9e('0xfd')]=db[_0x0a9e('0x1')]['import']('../api/whatsappMessage/whatsappMessage.model');db[_0x0a9e('0xfe')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xff'));db['WhatsappTransferReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x100'));db[_0x0a9e('0x101')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x102'));db[_0x0a9e('0x103')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x104'));db[_0x0a9e('0x105')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x106'));db[_0x0a9e('0x107')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x108'));db[_0x0a9e('0x109')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x10a'));db['UserSetting']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/user-setting/user-setting.model');db[_0x0a9e('0x11')][_0x0a9e('0x10b')](db[_0x0a9e('0x10c')],{'as':'VoiceMail','onDelete':'cascade','foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x10b')](db['UserSetting'],{'as':_0x0a9e('0x10d'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x10f')});db['User'][_0x0a9e('0x110')](db[_0x0a9e('0x111')],{'as':_0x0a9e('0x112'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x2b')],{'as':_0x0a9e('0x113'),'foreignKey':_0x0a9e('0x10f')});db['User'][_0x0a9e('0x110')](db['VoiceExtension'],{'as':_0x0a9e('0x114'),'onDelete':_0x0a9e('0x10e'),'hooks':!![]});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x71')],{'as':_0x0a9e('0x115'),'foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x116')],{'as':_0x0a9e('0x117'),'foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x73')],{'as':_0x0a9e('0x73'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x5d')],{'as':_0x0a9e('0x118'),'foreignKey':_0x0a9e('0x10f')});db['User'][_0x0a9e('0x110')](db[_0x0a9e('0x64')],{'as':_0x0a9e('0x119'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x53')],{'as':_0x0a9e('0x11a'),'foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x11b')],{'as':'FaxInteractions','foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x11c')],{'as':_0x0a9e('0x11d'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0xfb')],{'as':_0x0a9e('0x11e'),'foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0xf5')],{'as':_0x0a9e('0x11f'),'foreignKey':_0x0a9e('0x120')});db[_0x0a9e('0x11')]['belongsTo'](db[_0x0a9e('0xf2')],{'as':'UserProfile','foreignKey':'userProfileId'});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x68')],{'as':_0x0a9e('0x122'),'through':_0x0a9e('0x123')});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x125'),'through':_0x0a9e('0x126')});db[_0x0a9e('0x11')]['belongsToMany'](db['CmList'],{'as':_0x0a9e('0x127'),'through':_0x0a9e('0x128')});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x12a')});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x11c')],{'as':_0x0a9e('0x11d'),'through':_0x0a9e('0x12b')});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x64')],{'as':_0x0a9e('0x119'),'through':'user_has_chat_interactions'});db['User']['belongsToMany'](db[_0x0a9e('0x11b')],{'as':_0x0a9e('0x12c'),'through':_0x0a9e('0x12d')});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x53')],{'as':'SmsInteractions','through':_0x0a9e('0x12e')});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db['OpenchannelInteraction'],{'as':_0x0a9e('0x118'),'through':_0x0a9e('0x12f')});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0xfb')],{'as':'WhatsappInteractions','through':_0x0a9e('0x130')});db['User'][_0x0a9e('0x121')](db['VoiceQueue'],{'as':_0x0a9e('0x131'),'through':_0x0a9e('0x2d'),'required':![]});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0xf1')],{'as':_0x0a9e('0x132'),'through':_0x0a9e('0x109'),'required':![]});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x3c')],{'as':'MailQueues','through':_0x0a9e('0x30'),'required':![]});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x67')],{'as':_0x0a9e('0x133'),'through':_0x0a9e('0x134'),'required':![],'hooks':!![]});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x4c')],{'as':_0x0a9e('0x135'),'through':_0x0a9e('0x32'),'required':![]});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x57')],{'as':_0x0a9e('0x136'),'through':_0x0a9e('0x34'),'required':![]});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x137')],{'as':'OpenchannelQueues','through':_0x0a9e('0x35'),'required':![]});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x101')],{'as':_0x0a9e('0x138'),'through':_0x0a9e('0x37'),'required':![]});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'through':_0x0a9e('0x128')});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x13a'),'through':_0x0a9e('0x13b')});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x45')],{'as':'FaxAccounts','through':_0x0a9e('0x13c')});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x3b')],{'as':_0x0a9e('0x13d'),'through':_0x0a9e('0x13e')});db[_0x0a9e('0x11')]['belongsToMany'](db['OpenchannelAccount'],{'as':_0x0a9e('0x13f'),'through':_0x0a9e('0x140')});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x50')],{'as':_0x0a9e('0x141'),'through':_0x0a9e('0x142')});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0xf7')],{'as':_0x0a9e('0x143'),'through':_0x0a9e('0x144')});db[_0x0a9e('0x13')][_0x0a9e('0x110')](db[_0x0a9e('0x16')],{'as':'SpiedAgents','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x145')});db[_0x0a9e('0x146')]['hasMany'](db[_0x0a9e('0x16')],{'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x16')][_0x0a9e('0x110')](db['VoiceExtension'],{'as':_0x0a9e('0x147'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x18')][_0x0a9e('0x121')](db[_0x0a9e('0x84')],{'as':_0x0a9e('0x148'),'through':_0x0a9e('0x149')});db[_0x0a9e('0x1a')]['hasMany'](db[_0x0a9e('0x2b')],{'as':_0x0a9e('0x14a'),'foreignKey':_0x0a9e('0x14b')});db[_0x0a9e('0x1a')]['hasMany'](db['CmHopper'],{'as':_0x0a9e('0x14c'),'foreignKey':_0x0a9e('0x14b')});db[_0x0a9e('0x1a')]['hasMany'](db[_0x0a9e('0x71')],{'as':_0x0a9e('0x115'),'foreignKey':'VoiceQueueId'});db[_0x0a9e('0x1a')]['hasMany'](db[_0x0a9e('0x116')],{'as':'HopperHistories','foreignKey':'VoiceQueueId'});db['VoiceQueue'][_0x0a9e('0x110')](db[_0x0a9e('0x73')],{'as':_0x0a9e('0x73'),'foreignKey':_0x0a9e('0x14b')});db[_0x0a9e('0x1a')][_0x0a9e('0x110')](db['CmHopperBlack'],{'as':_0x0a9e('0x14d'),'foreignKey':_0x0a9e('0x14b')});db[_0x0a9e('0x1a')][_0x0a9e('0x110')](db[_0x0a9e('0xd0')],{'as':_0x0a9e('0x14e'),'foreignKey':_0x0a9e('0x14b')});db['VoiceQueue']['belongsTo'](db[_0x0a9e('0x28')],{'as':'Trunk','foreignKey':_0x0a9e('0x14f')});db[_0x0a9e('0x1a')][_0x0a9e('0x150')](db[_0x0a9e('0x28')],{'as':_0x0a9e('0x151'),'foreignKey':_0x0a9e('0x152')});db['VoiceQueue'][_0x0a9e('0x150')](db['Interval'],{'as':'Interval','foreignKey':_0x0a9e('0x153')});db['VoiceQueue'][_0x0a9e('0x150')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0x0a9e('0x154')});db['VoiceQueue'][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x127'),'through':'voice_queues_has_cm_lists'});db[_0x0a9e('0x1a')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Agents','through':'UserVoiceQueue'});db[_0x0a9e('0x1a')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'as':_0x0a9e('0x155'),'through':_0x0a9e('0x105')});db[_0x0a9e('0x1a')][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x156'),'through':_0x0a9e('0x157')});db['VoiceRecording']['belongsTo'](db['User'],{'as':_0x0a9e('0x11'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x1c')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x11'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x10c')]['hasMany'](db['VoiceMailMessage'],{'as':_0x0a9e('0x158'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'mailboxuser','sourceKey':_0x0a9e('0x159')});db[_0x0a9e('0x1f')][_0x0a9e('0x150')](db[_0x0a9e('0x10c')],{'foreignKey':_0x0a9e('0x15a'),'targetKey':_0x0a9e('0x159')});db[_0x0a9e('0x15b')][_0x0a9e('0x110')](db[_0x0a9e('0x25')],{'as':_0x0a9e('0x15c'),'foreignKey':_0x0a9e('0x15d'),'constraints':![]});db[_0x0a9e('0x15b')]['hasMany'](db[_0x0a9e('0x15e')],{'as':_0x0a9e('0x15f'),'foreignKey':_0x0a9e('0x15d'),'constraints':![]});db[_0x0a9e('0x15b')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x11'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x15b')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':'ContactId'});db['MailServerIn'][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'as':_0x0a9e('0x3b'),'foreignKey':_0x0a9e('0x161')});db[_0x0a9e('0x39')][_0x0a9e('0x150')](db[_0x0a9e('0x103')],{'as':'CloudProvider','foreignKey':_0x0a9e('0x162'),'onDelete':'restrict'});db[_0x0a9e('0x163')][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'as':_0x0a9e('0x3b'),'foreignKey':_0x0a9e('0x161')});db[_0x0a9e('0x163')][_0x0a9e('0x150')](db[_0x0a9e('0x103')],{'as':_0x0a9e('0x103'),'foreignKey':_0x0a9e('0x162'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x3b')][_0x0a9e('0x10b')](db[_0x0a9e('0x39')],{'as':_0x0a9e('0x165'),'onDelete':_0x0a9e('0x10e')});db['MailAccount']['hasOne'](db[_0x0a9e('0x163')],{'as':_0x0a9e('0x166'),'onDelete':'cascade'});db['MailAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':'MailAccountId','onDelete':_0x0a9e('0x10e')});db['MailAccount'][_0x0a9e('0x110')](db['CannedAnswer'],{'as':_0x0a9e('0x169'),'foreignKey':'MailAccountId'});db[_0x0a9e('0x3b')][_0x0a9e('0x110')](db[_0x0a9e('0x3e')],{'as':'Messages','foreignKey':_0x0a9e('0x161')});db['MailAccount']['hasMany'](db[_0x0a9e('0x11c')],{'as':_0x0a9e('0x16a')});db[_0x0a9e('0x3b')][_0x0a9e('0x110')](db[_0x0a9e('0x16b')],{'as':_0x0a9e('0x147'),'foreignKey':_0x0a9e('0x161'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x3b')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x3b')][_0x0a9e('0x150')](db[_0x0a9e('0x8b')],{'as':_0x0a9e('0x8b'),'foreignKey':_0x0a9e('0x16e')});db[_0x0a9e('0x3b')]['belongsTo'](db[_0x0a9e('0x7d')],{'as':_0x0a9e('0x16f'),'foreignKey':_0x0a9e('0x154')});db[_0x0a9e('0x3b')]['belongsToMany'](db['User'],{'as':'Agents','through':_0x0a9e('0x13e')});db['MailQueue'][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x30')});db[_0x0a9e('0x3c')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x171'),'as':_0x0a9e('0x155')});db[_0x0a9e('0x11c')]['hasMany'](db[_0x0a9e('0x3e')],{'as':'Messages','onDelete':_0x0a9e('0x10e'),'foreignKey':'MailInteractionId'});db[_0x0a9e('0x11c')][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'as':'Account','foreignKey':_0x0a9e('0x161')});db[_0x0a9e('0x11c')]['belongsTo'](db['CmContact'],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x11c')]['belongsTo'](db['User'],{'as':'Owner','foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11c')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x173'),'as':_0x0a9e('0x174')});db[_0x0a9e('0x11c')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x173'),'as':_0x0a9e('0x175')});db[_0x0a9e('0x11c')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'through':_0x0a9e('0x12b'),'foreignKey':_0x0a9e('0x177')});db[_0x0a9e('0x3e')]['hasMany'](db[_0x0a9e('0xe4')],{'as':_0x0a9e('0x178'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x3e')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':'User'});db[_0x0a9e('0x3e')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x160')});db[_0x0a9e('0x3e')][_0x0a9e('0x150')](db[_0x0a9e('0x11c')],{'as':_0x0a9e('0x179'),'foreignKey':'MailInteractionId'});db['MailMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'as':'Account','foreignKey':_0x0a9e('0x161')});db[_0x0a9e('0x3e')]['belongsTo'](db[_0x0a9e('0x60')],{'as':'ChatWebsite','foreignKey':_0x0a9e('0x17a')});db[_0x0a9e('0x3e')]['belongsTo'](db[_0x0a9e('0x66')],{'as':_0x0a9e('0x66'),'foreignKey':'ChatOfflineMessageId'});db[_0x0a9e('0x16b')][_0x0a9e('0x150')](db['User'],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x16b')][_0x0a9e('0x150')](db[_0x0a9e('0x3c')],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x16b')]['belongsTo'](db[_0x0a9e('0x3b')],{'onDelete':_0x0a9e('0x164')});db['MailApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x16b')][_0x0a9e('0x150')](db[_0x0a9e('0x86')],{'onDelete':'restrict','foreignKey':'TagId'});db['MailQueueReport']['belongsTo'](db['MailAccount'],{});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db['CmList'],{'as':'List','foreignKey':_0x0a9e('0x16d')});db['MailQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db['MailInteraction'],{});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db['MailMessage'],{});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db[_0x0a9e('0x3c')],{});db[_0x0a9e('0x17d')]['hasMany'](db[_0x0a9e('0x43')],{'as':'Items','onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x45')]['hasMany'](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':'FaxAccountId','onDelete':_0x0a9e('0x10e')});db['FaxAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x17e')],{'as':'Answers','foreignKey':_0x0a9e('0x17f')});db['FaxAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x11b')],{'as':_0x0a9e('0x16a')});db[_0x0a9e('0x45')][_0x0a9e('0x110')](db[_0x0a9e('0x47')],{'as':_0x0a9e('0x147'),'foreignKey':'FaxAccountId','onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x45')][_0x0a9e('0x110')](db[_0x0a9e('0x16')],{'as':_0x0a9e('0x180'),'onDelete':'cascade'});db[_0x0a9e('0x45')]['hasMany'](db['FaxMessage'],{'as':_0x0a9e('0x158')});db['FaxAccount'][_0x0a9e('0x150')](db[_0x0a9e('0x28')],{'as':'Trunk'});db[_0x0a9e('0x45')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x45')][_0x0a9e('0x150')](db[_0x0a9e('0x7d')],{'as':_0x0a9e('0x16f'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x0a9e('0x45')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':'user_has_fax_accounts'});db[_0x0a9e('0x47')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'onDelete':'restrict'});db[_0x0a9e('0x47')][_0x0a9e('0x150')](db[_0x0a9e('0x4c')],{'onDelete':'restrict'});db[_0x0a9e('0x47')]['belongsTo'](db[_0x0a9e('0x45')],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x47')][_0x0a9e('0x150')](db[_0x0a9e('0x86')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x181')});db['FaxInteraction'][_0x0a9e('0x110')](db[_0x0a9e('0x4a')],{'as':_0x0a9e('0x158'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x182')});db[_0x0a9e('0x11b')][_0x0a9e('0x150')](db[_0x0a9e('0x45')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x17f')});db[_0x0a9e('0x11b')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x11b')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11b')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':'fax_interaction_has_tags','as':_0x0a9e('0x174')});db[_0x0a9e('0x11b')][_0x0a9e('0x121')](db['Tag'],{'through':_0x0a9e('0x185'),'as':'ThroughTags'});db[_0x0a9e('0x11b')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'through':_0x0a9e('0x12d'),'foreignKey':_0x0a9e('0x182')});db[_0x0a9e('0x4a')][_0x0a9e('0x150')](db['User'],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x11')});db['FaxMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x11b')],{'as':_0x0a9e('0x179'),'foreignKey':'FaxInteractionId'});db[_0x0a9e('0x4a')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':_0x0a9e('0x10e'),'as':'Contact'});db[_0x0a9e('0x4a')][_0x0a9e('0x150')](db[_0x0a9e('0xe4')],{'as':_0x0a9e('0xe4'),'foreignKey':_0x0a9e('0x186')});db['FaxMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x45')],{'as':'Account','foreignKey':_0x0a9e('0x17f')});db[_0x0a9e('0x4c')][_0x0a9e('0x121')](db['User'],{'as':'Agents','through':_0x0a9e('0x32')});db[_0x0a9e('0x4c')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x187'),'as':_0x0a9e('0x155')});db[_0x0a9e('0x4e')][_0x0a9e('0x150')](db['FaxAccount'],{});db['FaxQueueReport'][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x4e')][_0x0a9e('0x150')](db['CmContact'],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db['FaxQueueReport'][_0x0a9e('0x150')](db['FaxInteraction'],{});db[_0x0a9e('0x4e')][_0x0a9e('0x150')](db[_0x0a9e('0x4a')],{});db[_0x0a9e('0x4e')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db['FaxQueueReport'][_0x0a9e('0x150')](db['FaxQueue'],{});db[_0x0a9e('0x50')][_0x0a9e('0x110')](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':_0x0a9e('0x188'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x50')]['hasMany'](db[_0x0a9e('0x17e')],{'as':_0x0a9e('0x169'),'foreignKey':_0x0a9e('0x188')});db[_0x0a9e('0x50')][_0x0a9e('0x110')](db['SmsMessage'],{'as':_0x0a9e('0x158'),'foreignKey':_0x0a9e('0x188')});db['SmsAccount']['hasMany'](db[_0x0a9e('0x53')],{'as':_0x0a9e('0x16a')});db[_0x0a9e('0x50')][_0x0a9e('0x110')](db[_0x0a9e('0x52')],{'as':_0x0a9e('0x147'),'foreignKey':'SmsAccountId','onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x50')][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x50')][_0x0a9e('0x150')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0x0a9e('0x154')});db[_0x0a9e('0x50')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x142')});db[_0x0a9e('0x52')][_0x0a9e('0x150')](db['User'],{'onDelete':_0x0a9e('0x164')});db['SmsApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x57')],{'onDelete':_0x0a9e('0x164')});db['SmsApplication']['belongsTo'](db[_0x0a9e('0x50')],{'onDelete':'restrict'});db[_0x0a9e('0x52')]['belongsTo'](db['Interval'],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x52')][_0x0a9e('0x150')](db[_0x0a9e('0x86')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x181')});db[_0x0a9e('0x53')][_0x0a9e('0x110')](db[_0x0a9e('0x55')],{'as':_0x0a9e('0x158'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x189')});db['SmsInteraction']['belongsTo'](db[_0x0a9e('0x50')],{'as':'Account','foreignKey':_0x0a9e('0x188')});db[_0x0a9e('0x53')][_0x0a9e('0x150')](db['CmContact'],{'as':'Contact','foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x53')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x53')]['belongsToMany'](db[_0x0a9e('0x86')],{'through':'sms_interaction_has_tags','as':_0x0a9e('0x174')});db[_0x0a9e('0x53')]['belongsToMany'](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x18a'),'as':_0x0a9e('0x175')});db[_0x0a9e('0x53')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Users','through':_0x0a9e('0x12e'),'foreignKey':_0x0a9e('0x189')});db[_0x0a9e('0x55')]['belongsTo'](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x11')});db[_0x0a9e('0x55')]['belongsTo'](db[_0x0a9e('0x124')],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x160')});db[_0x0a9e('0x55')][_0x0a9e('0x150')](db[_0x0a9e('0x53')],{'onDelete':'cascade','as':'Interaction','foreignKey':_0x0a9e('0x189')});db[_0x0a9e('0x55')]['belongsTo'](db[_0x0a9e('0x50')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x188')});db[_0x0a9e('0x57')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Agents','through':_0x0a9e('0x34'),'foreignKey':_0x0a9e('0x18b')});db[_0x0a9e('0x57')]['belongsToMany'](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x18c'),'as':_0x0a9e('0x155')});db[_0x0a9e('0x59')]['hasMany'](db['Disposition'],{'as':_0x0a9e('0x168'),'foreignKey':_0x0a9e('0x18d'),'onDelete':_0x0a9e('0x10e')});db['OpenchannelAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x17e')],{'as':_0x0a9e('0x169'),'foreignKey':_0x0a9e('0x18d')});db[_0x0a9e('0x59')][_0x0a9e('0x110')](db[_0x0a9e('0x5d')],{'as':_0x0a9e('0x16a'),'foreignKey':'OpenchannelAccountId'});db['OpenchannelAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x5e')],{'as':'Messages','foreignKey':_0x0a9e('0x18d')});db['OpenchannelAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x5b')],{'as':'Applications','foreignKey':_0x0a9e('0x18d'),'onDelete':_0x0a9e('0x10e')});db['OpenchannelAccount'][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x59')][_0x0a9e('0x150')](db[_0x0a9e('0x7d')],{'as':'mandatoryDispositionPause','foreignKey':_0x0a9e('0x154')});db[_0x0a9e('0x59')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x140')});db[_0x0a9e('0x5b')]['belongsTo'](db['User'],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x5b')][_0x0a9e('0x150')](db['OpenchannelQueue'],{'onDelete':'restrict','foreignKey':_0x0a9e('0x18e')});db['OpenchannelApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x59')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x18d')});db[_0x0a9e('0x5b')][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x153')});db['OpenchannelApplication']['belongsTo'](db[_0x0a9e('0x86')],{'onDelete':'restrict','foreignKey':_0x0a9e('0x181')});db[_0x0a9e('0x5d')][_0x0a9e('0x110')](db[_0x0a9e('0x5e')],{'as':'Messages','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x18f')});db[_0x0a9e('0x5d')]['belongsTo'](db[_0x0a9e('0x59')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x18d')});db['OpenchannelInteraction'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x5d')][_0x0a9e('0x150')](db['User'],{'as':'Owner','foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x5d')][_0x0a9e('0x121')](db['Tag'],{'through':'openchannel_interaction_has_tags','as':_0x0a9e('0x174')});db[_0x0a9e('0x5d')][_0x0a9e('0x121')](db['Tag'],{'through':'openchannel_interaction_has_tags','as':_0x0a9e('0x175')});db[_0x0a9e('0x5d')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'through':'user_has_openchannel_interactions','foreignKey':_0x0a9e('0x18f')});db['OpenchannelMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'onDelete':'cascade','as':_0x0a9e('0x11')});db['OpenchannelMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x160')});db[_0x0a9e('0x5e')]['belongsTo'](db[_0x0a9e('0x5d')],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x179'),'foreignKey':'OpenchannelInteractionId'});db[_0x0a9e('0x5e')]['belongsTo'](db[_0x0a9e('0xe4')],{'as':_0x0a9e('0xe4'),'foreignKey':_0x0a9e('0x186')});db['OpenchannelMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x59')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x18d')});db[_0x0a9e('0x137')][_0x0a9e('0x121')](db['User'],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x35'),'foreignKey':_0x0a9e('0x18e')});db[_0x0a9e('0x137')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x190'),'as':_0x0a9e('0x155')});db['ChatWebsite'][_0x0a9e('0x110')](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':_0x0a9e('0x17a'),'onDelete':'cascade'});db[_0x0a9e('0x60')]['hasMany'](db[_0x0a9e('0x17e')],{'as':_0x0a9e('0x169'),'foreignKey':_0x0a9e('0x17a')});db['ChatWebsite'][_0x0a9e('0x110')](db[_0x0a9e('0x191')],{'as':_0x0a9e('0x192')});db[_0x0a9e('0x60')]['hasMany'](db[_0x0a9e('0x64')],{'as':_0x0a9e('0x16a')});db[_0x0a9e('0x60')][_0x0a9e('0x110')](db[_0x0a9e('0x63')],{'as':_0x0a9e('0x147'),'foreignKey':_0x0a9e('0x17a'),'onDelete':'cascade'});db[_0x0a9e('0x60')][_0x0a9e('0x110')](db[_0x0a9e('0x65')],{'as':_0x0a9e('0x158')});db['ChatWebsite'][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x60')][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'as':_0x0a9e('0x17b'),'foreignKey':_0x0a9e('0x153')});db['ChatWebsite'][_0x0a9e('0x150')](db['MailAccount'],{'as':_0x0a9e('0x3b'),'foreignKey':_0x0a9e('0x161')});db['ChatWebsite'][_0x0a9e('0x150')](db[_0x0a9e('0x7d')],{'as':_0x0a9e('0x16f'),'foreignKey':_0x0a9e('0x154')});db['ChatWebsite'][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Agents','through':_0x0a9e('0x13b')});db['OpenchannelQueueReport']['belongsTo'](db['OpenchannelAccount'],{});db[_0x0a9e('0x62')][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db['OpenchannelQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x62')][_0x0a9e('0x150')](db[_0x0a9e('0x5d')],{});db['OpenchannelQueueReport'][_0x0a9e('0x150')](db['OpenchannelMessage'],{});db[_0x0a9e('0x62')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db[_0x0a9e('0x62')][_0x0a9e('0x150')](db[_0x0a9e('0x137')],{});db['ChatApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x193'),'foreignKey':'UserId','onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x63')][_0x0a9e('0x150')](db[_0x0a9e('0x67')],{'as':_0x0a9e('0x194'),'foreignKey':_0x0a9e('0x195'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x63')][_0x0a9e('0x150')](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x196'),'foreignKey':_0x0a9e('0x17a'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x63')][_0x0a9e('0x150')](db[_0x0a9e('0x86')],{'onDelete':'restrict','foreignKey':_0x0a9e('0x181')});db[_0x0a9e('0x64')][_0x0a9e('0x110')](db['ChatMessage'],{'as':_0x0a9e('0x158'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x197')});db[_0x0a9e('0x64')]['belongsTo'](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x17a')});db[_0x0a9e('0x64')]['belongsTo'](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x64')]['belongsTo'](db['User'],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x64')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x198'),'as':_0x0a9e('0x174')});db[_0x0a9e('0x64')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x198'),'as':_0x0a9e('0x175')});db[_0x0a9e('0x64')][_0x0a9e('0x121')](db['User'],{'as':_0x0a9e('0x176'),'through':_0x0a9e('0x199'),'foreignKey':_0x0a9e('0x197')});db['ChatMessage']['belongsTo'](db[_0x0a9e('0x11')],{'onDelete':'cascade','as':_0x0a9e('0x11')});db[_0x0a9e('0x65')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':'cascade','as':'Contact','foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x65')][_0x0a9e('0x150')](db[_0x0a9e('0x64')],{'onDelete':'cascade','as':_0x0a9e('0x179'),'foreignKey':_0x0a9e('0x197')});db[_0x0a9e('0x65')][_0x0a9e('0x150')](db[_0x0a9e('0xe4')],{'as':'Attachment','foreignKey':'AttachmentId'});db[_0x0a9e('0x65')][_0x0a9e('0x150')](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x17a')});db[_0x0a9e('0x66')][_0x0a9e('0x110')](db['Attachment'],{'as':_0x0a9e('0x178'),'foreignKey':_0x0a9e('0x19a'),'onDelete':_0x0a9e('0x10e'),'hooks':!![]});db['ChatOfflineMessage']['belongsTo'](db['CmContact'],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x160'),'foreignKey':'ContactId'});db[_0x0a9e('0x66')][_0x0a9e('0x150')](db[_0x0a9e('0x60')],{'as':'Account','foreignKey':'ChatWebsiteId'});db[_0x0a9e('0x67')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':'UserChatQueue','hooks':!![]});db[_0x0a9e('0x67')]['belongsToMany'](db['Team'],{'through':_0x0a9e('0x19b'),'as':'Teams'});db[_0x0a9e('0x68')][_0x0a9e('0x110')](db[_0x0a9e('0xcc')],{'as':'Messages','foreignKey':_0x0a9e('0x19c'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x68')]['belongsToMany'](db['User'],{'as':_0x0a9e('0x14a'),'through':_0x0a9e('0x123')});db[_0x0a9e('0x191')][_0x0a9e('0x150')](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x196'),'foreignKey':'ChatWebsiteId'});db['CmCompany'][_0x0a9e('0x110')](db[_0x0a9e('0x124')],{'as':'Contacts','foreignKey':'CompanyId'});db['CmContact']['hasMany'](db['CmContactHasItem'],{'as':'Phones','foreignKey':_0x0a9e('0x19d')});db['CmContact'][_0x0a9e('0x110')](db[_0x0a9e('0x6d')],{'as':_0x0a9e('0x14c'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db[_0x0a9e('0x71')],{'as':'HopperFinals','foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db[_0x0a9e('0x116')],{'as':_0x0a9e('0x19e'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db[_0x0a9e('0x73')],{'as':_0x0a9e('0x73'),'foreignKey':_0x0a9e('0x172')});db['CmContact'][_0x0a9e('0x110')](db[_0x0a9e('0xd0')],{'as':'JscriptySessions','foreignKey':_0x0a9e('0x172')});db['CmContact'][_0x0a9e('0x110')](db[_0x0a9e('0x5d')],{'as':'OpenchannelInteractions','foreignKey':'ContactId','onDelete':_0x0a9e('0x164')});db['CmContact'][_0x0a9e('0x110')](db[_0x0a9e('0x64')],{'as':_0x0a9e('0x119'),'foreignKey':_0x0a9e('0x172'),'onDelete':_0x0a9e('0x164')});db['CmContact'][_0x0a9e('0x110')](db['SmsInteraction'],{'as':'SmsInteractions','foreignKey':_0x0a9e('0x172'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db[_0x0a9e('0x11b')],{'as':'FaxInteractions','foreignKey':_0x0a9e('0x172'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db['MailInteraction'],{'as':_0x0a9e('0x11d'),'foreignKey':_0x0a9e('0x172'),'onDelete':'restrict'});db[_0x0a9e('0x124')][_0x0a9e('0x150')](db[_0x0a9e('0x19f')],{'as':_0x0a9e('0x1a0'),'foreignKey':'CompanyId'});db[_0x0a9e('0x124')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d'),'onDelete':'cascade'});db[_0x0a9e('0x124')][_0x0a9e('0x121')](db['User'],{'as':_0x0a9e('0x176'),'through':'cm_user_has_contacts'});db[_0x0a9e('0x124')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'as':_0x0a9e('0x174'),'through':_0x0a9e('0x1a1')});db[_0x0a9e('0x124')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x1a1'),'as':_0x0a9e('0x175')});db[_0x0a9e('0x6d')][_0x0a9e('0x110')](db[_0x0a9e('0x1a2')],{'as':_0x0a9e('0x1a3'),'foreignKey':_0x0a9e('0x1a4')});db['CmHopper'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x6d')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':'List','foreignKey':'ListId','onDelete':'cascade'});db['CmHopper'][_0x0a9e('0x150')](db['User'],{'as':'Agent','foreignKey':'UserId'});db[_0x0a9e('0x6d')][_0x0a9e('0x150')](db[_0x0a9e('0x1a')],{'as':_0x0a9e('0x194'),'foreignKey':'VoiceQueueId','onDelete':'cascade'});db[_0x0a9e('0x6d')][_0x0a9e('0x150')](db[_0x0a9e('0x1a5')],{'as':_0x0a9e('0x1a5'),'foreignKey':'CampaignId','onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x6d')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x1a6')});db['CmHopperBlack'][_0x0a9e('0x150')](db['CmContact'],{'as':'Contact','foreignKey':_0x0a9e('0x172'),'onDelete':'cascade'});db[_0x0a9e('0x6f')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x6f')][_0x0a9e('0x150')](db[_0x0a9e('0x1a')],{'as':'Queue','foreignKey':_0x0a9e('0x14b'),'onDelete':_0x0a9e('0x10e')});db['CmHopperBlack'][_0x0a9e('0x150')](db[_0x0a9e('0x1a5')],{'as':_0x0a9e('0x1a5'),'foreignKey':_0x0a9e('0x1a7'),'onDelete':'cascade'});db[_0x0a9e('0x76')][_0x0a9e('0x110')](db[_0x0a9e('0x7a')],{'as':{'plural':_0x0a9e('0x1a8'),'singular':_0x0a9e('0x1a9')},'foreignKey':'AutomationAllId','onDelete':'cascade','hooks':!![]});db[_0x0a9e('0x76')]['hasMany'](db[_0x0a9e('0x7a')],{'as':{'plural':'Any','singular':_0x0a9e('0x1aa')},'foreignKey':'AutomationAnyId','onDelete':_0x0a9e('0x10e'),'hooks':!![]});db['Automation'][_0x0a9e('0x110')](db[_0x0a9e('0x74')],{'as':_0x0a9e('0x1ab'),'foreignKey':'AutomationId','onDelete':'cascade','hooks':!![]});db[_0x0a9e('0x167')]['hasMany'](db[_0x0a9e('0x167')],{'as':'Dispositions','foreignKey':_0x0a9e('0x1ac'),'onDelete':'cascade'});db[_0x0a9e('0x17b')][_0x0a9e('0x110')](db['Interval'],{'as':_0x0a9e('0x1ad'),'foreignKey':_0x0a9e('0x153'),'onDelete':_0x0a9e('0x10e'),'hooks':!![],'required':![]});db[_0x0a9e('0x17b')][_0x0a9e('0x110')](db[_0x0a9e('0x16')],{'as':_0x0a9e('0x114'),'foreignKey':_0x0a9e('0x153'),'onDelete':_0x0a9e('0x164')});db['Interval'][_0x0a9e('0x110')](db[_0x0a9e('0x16b')],{'as':_0x0a9e('0x1ae'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x17b')]['hasMany'](db['ChatApplication'],{'as':_0x0a9e('0x1af'),'foreignKey':'IntervalId'});db[_0x0a9e('0x17b')]['hasMany'](db[_0x0a9e('0x47')],{'as':_0x0a9e('0x1b0'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x17b')][_0x0a9e('0x110')](db[_0x0a9e('0x52')],{'as':_0x0a9e('0x1b1'),'foreignKey':'IntervalId'});db['Schedule'][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{});db['Schedule'][_0x0a9e('0x150')](db[_0x0a9e('0x94')],{'foreignKey':_0x0a9e('0x1b2')});db['Schedule']['belongsTo'](db['AnalyticCustomReport'],{'foreignKey':_0x0a9e('0x1b3')});db[_0x0a9e('0x84')][_0x0a9e('0x121')](db[_0x0a9e('0x18')],{'as':'Mohs','through':_0x0a9e('0x149'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x86')]['belongsToMany'](db[_0x0a9e('0x124')],{'through':'cm_contact_has_tags'});db['Tag'][_0x0a9e('0x121')](db[_0x0a9e('0x64')],{'through':'chat_interaction_has_tags'});db['Tag'][_0x0a9e('0x121')](db['MailInteraction'],{'through':_0x0a9e('0x173')});db['Tag'][_0x0a9e('0x121')](db[_0x0a9e('0x53')],{'through':_0x0a9e('0x18a')});db['Tag']['belongsToMany'](db[_0x0a9e('0x11b')],{'through':_0x0a9e('0x185')});db[_0x0a9e('0x86')][_0x0a9e('0x121')](db['OpenchannelInteraction'],{'through':_0x0a9e('0x1b4')});db[_0x0a9e('0x86')]['belongsToMany'](db[_0x0a9e('0xfb')],{'through':_0x0a9e('0x1b5')});db[_0x0a9e('0x1b6')]['belongsTo'](db[_0x0a9e('0x88')],{'as':_0x0a9e('0x1b7'),'foreignKey':_0x0a9e('0x1b8')});db[_0x0a9e('0x1a2')][_0x0a9e('0x150')](db[_0x0a9e('0x6d')],{'as':_0x0a9e('0x1b9'),'foreignKey':_0x0a9e('0x1a4')});db[_0x0a9e('0x1b6')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x19d')});db[_0x0a9e('0x8d')][_0x0a9e('0x110')](db[_0x0a9e('0x7a')],{'as':{'plural':_0x0a9e('0x1ba'),'singular':_0x0a9e('0x1bb')},'foreignKey':_0x0a9e('0x1bc'),'onDelete':_0x0a9e('0x10e'),'hooks':!![]});db[_0x0a9e('0x8d')][_0x0a9e('0x110')](db['Condition'],{'as':{'plural':_0x0a9e('0x1bd'),'singular':_0x0a9e('0x1be')},'foreignKey':_0x0a9e('0x1bf'),'onDelete':'cascade','hooks':!![]});db[_0x0a9e('0x8d')][_0x0a9e('0x110')](db[_0x0a9e('0x74')],{'as':_0x0a9e('0x1ab'),'foreignKey':'TriggerId','onDelete':_0x0a9e('0x10e'),'hooks':!![]});db[_0x0a9e('0x1c0')]['hasMany'](db[_0x0a9e('0x99')],{'as':_0x0a9e('0x1c1'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'CustomReportId','hooks':!![]});db['AnalyticDefaultReport'][_0x0a9e('0x110')](db[_0x0a9e('0x99')],{'as':_0x0a9e('0x1c1'),'onDelete':'cascade','foreignKey':'DefaultReportId'});db[_0x0a9e('0x98')][_0x0a9e('0x110')](db[_0x0a9e('0x99')],{'as':_0x0a9e('0x1c1'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c2')});db['AnalyticFieldReport']['belongsTo'](db[_0x0a9e('0x98')],{'foreignKey':_0x0a9e('0x1c2')});db[_0x0a9e('0x9c')]['hasMany'](db[_0x0a9e('0x9e')],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'AccountId'});db['SalesforceConfiguration'][_0x0a9e('0x110')](db[_0x0a9e('0xa0')],{'as':_0x0a9e('0x1c4'),'onDelete':'cascade','foreignKey':'SubjectId'});db[_0x0a9e('0x9e')]['hasMany'](db['SalesforceField'],{'as':'Descriptions','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0x9e')]['hasMany'](db[_0x0a9e('0xa0')],{'as':_0x0a9e('0x1c1'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c6')});db['SalesforceConfiguration'][_0x0a9e('0x150')](db[_0x0a9e('0x9c')],{'as':'Account','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xa0')][_0x0a9e('0x110')](db['SalesforceField'],{'as':_0x0a9e('0x1c8'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xa0')]['hasMany'](db[_0x0a9e('0xa0')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db['SalesforceField'][_0x0a9e('0x110')](db[_0x0a9e('0xa0')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xa0')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':'VariableId'});db[_0x0a9e('0xa1')][_0x0a9e('0x110')](db[_0x0a9e('0xa2')],{'as':_0x0a9e('0x1c3'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xa2')]['hasMany'](db[_0x0a9e('0x1cc')],{'as':_0x0a9e('0x1c4'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xa2')][_0x0a9e('0x110')](db[_0x0a9e('0x1cc')],{'as':_0x0a9e('0x1cd'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c5')});db['SugarcrmConfiguration'][_0x0a9e('0x110')](db[_0x0a9e('0x1cc')],{'as':'Fields','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c6')});db['SugarcrmConfiguration'][_0x0a9e('0x150')](db[_0x0a9e('0xa1')],{'as':'Account','foreignKey':_0x0a9e('0x1c7')});db['SugarcrmField']['hasMany'](db['SugarcrmField'],{'as':_0x0a9e('0x1c8'),'foreignKey':_0x0a9e('0x1c9')});db['SugarcrmField'][_0x0a9e('0x110')](db[_0x0a9e('0x1cc')],{'as':'Description','foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0x1cc')]['hasMany'](db[_0x0a9e('0x1cc')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db['SugarcrmField'][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0x1cf')]['hasMany'](db[_0x0a9e('0xa6')],{'as':'Configurations','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xa6')][_0x0a9e('0x110')](db[_0x0a9e('0xa8')],{'as':_0x0a9e('0x1c4'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xa6')]['hasMany'](db[_0x0a9e('0xa8')],{'as':_0x0a9e('0x1cd'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'DescriptionId'});db['DeskConfiguration']['hasMany'](db['DeskField'],{'as':'Fields','onDelete':_0x0a9e('0x10e'),'foreignKey':'FieldId'});db[_0x0a9e('0xa6')][_0x0a9e('0x150')](db[_0x0a9e('0x1cf')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xa6')]['belongsToMany'](db[_0x0a9e('0x86')],{'through':'int_desk_configuration_has_tags'});db['DeskField'][_0x0a9e('0x110')](db['DeskField'],{'as':_0x0a9e('0x1c8'),'foreignKey':'SubjectId'});db[_0x0a9e('0xa8')][_0x0a9e('0x110')](db[_0x0a9e('0xa8')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db['DeskField'][_0x0a9e('0x110')](db[_0x0a9e('0xa8')],{'as':'Field','foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xa8')]['belongsTo'](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0xaa')][_0x0a9e('0x110')](db[_0x0a9e('0xac')],{'as':_0x0a9e('0x1c3'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xac')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':'Subjects','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xac')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':_0x0a9e('0x1cd'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c5')});db['ZohoConfiguration'][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':_0x0a9e('0x1c1'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xac')][_0x0a9e('0x150')](db[_0x0a9e('0xaa')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xae')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':_0x0a9e('0x1c8'),'foreignKey':'SubjectId'});db[_0x0a9e('0xae')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':'Description','foreignKey':'DescriptionId'});db[_0x0a9e('0xae')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xae')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':'VariableId'});db[_0x0a9e('0xaf')][_0x0a9e('0x110')](db['ZendeskConfiguration'],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'AccountId'});db['ZendeskConfiguration'][_0x0a9e('0x110')](db[_0x0a9e('0xb2')],{'as':_0x0a9e('0x1c4'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0x1d0')]['hasMany'](db[_0x0a9e('0xb2')],{'as':'Descriptions','foreignKey':'DescriptionId'});db['ZendeskConfiguration'][_0x0a9e('0x110')](db['ZendeskField'],{'as':'Fields','foreignKey':'FieldId'});db[_0x0a9e('0x1d0')][_0x0a9e('0x150')](db[_0x0a9e('0xaf')],{'as':_0x0a9e('0x183'),'foreignKey':'AccountId'});db[_0x0a9e('0x1d0')]['belongsToMany'](db['Tag'],{'through':_0x0a9e('0x1d1')});db[_0x0a9e('0xb2')][_0x0a9e('0x110')](db['ZendeskField'],{'as':'Subject','foreignKey':'SubjectId'});db[_0x0a9e('0xb2')][_0x0a9e('0x110')](db[_0x0a9e('0xb2')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db['ZendeskField'][_0x0a9e('0x110')](db[_0x0a9e('0xb2')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xb2')][_0x0a9e('0x150')](db['Variable'],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0x1d2')][_0x0a9e('0x110')](db[_0x0a9e('0x1d3')],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0x1d3')][_0x0a9e('0x110')](db[_0x0a9e('0xb5')],{'as':_0x0a9e('0x1c4'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0x1d3')][_0x0a9e('0x110')](db[_0x0a9e('0xb5')],{'as':_0x0a9e('0x1cd'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0x1d3')]['hasMany'](db['FreshdeskField'],{'as':'Fields','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c6')});db['FreshdeskConfiguration'][_0x0a9e('0x150')](db[_0x0a9e('0x1d2')],{'as':'Account','foreignKey':_0x0a9e('0x1c7')});db['FreshdeskConfiguration'][_0x0a9e('0x121')](db['Tag'],{'through':_0x0a9e('0x1d4')});db[_0x0a9e('0xb5')][_0x0a9e('0x110')](db[_0x0a9e('0xb5')],{'as':'Subject','foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xb5')][_0x0a9e('0x110')](db['FreshdeskField'],{'as':'Description','foreignKey':'DescriptionId'});db['FreshdeskField'][_0x0a9e('0x110')](db[_0x0a9e('0xb5')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xb5')]['belongsTo'](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0x1d5')]['hasMany'](db[_0x0a9e('0xb8')],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xb8')]['hasMany'](db[_0x0a9e('0xb9')],{'as':_0x0a9e('0x1c4'),'foreignKey':_0x0a9e('0x1c9')});db['VtigerConfiguration'][_0x0a9e('0x110')](db['VtigerField'],{'as':_0x0a9e('0x1cd'),'foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0xb8')][_0x0a9e('0x110')](db[_0x0a9e('0xb9')],{'as':'Fields','foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xb8')][_0x0a9e('0x150')](db[_0x0a9e('0x1d5')],{'as':_0x0a9e('0x183'),'foreignKey':'AccountId'});db[_0x0a9e('0xb9')][_0x0a9e('0x110')](db[_0x0a9e('0xb9')],{'as':'Subject','foreignKey':_0x0a9e('0x1c9')});db['VtigerField']['hasMany'](db[_0x0a9e('0xb9')],{'as':'Description','foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0xb9')][_0x0a9e('0x110')](db['VtigerField'],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xb9')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0xba')]['hasMany'](db[_0x0a9e('0xbc')],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xbc')]['hasMany'](db['ServicenowField'],{'as':_0x0a9e('0x1c4'),'foreignKey':'SubjectId'});db[_0x0a9e('0xbc')][_0x0a9e('0x110')](db['ServicenowField'],{'as':_0x0a9e('0x1cd'),'foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0xbc')]['hasMany'](db[_0x0a9e('0x1d6')],{'as':_0x0a9e('0x1c1'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xbc')][_0x0a9e('0x150')](db[_0x0a9e('0xba')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1c7')});db['ServicenowField'][_0x0a9e('0x110')](db[_0x0a9e('0x1d6')],{'as':_0x0a9e('0x1c8'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0x1d6')]['hasMany'](db[_0x0a9e('0x1d6')],{'as':'Description','foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0x1d6')][_0x0a9e('0x110')](db['ServicenowField'],{'as':_0x0a9e('0x1cb'),'foreignKey':'FieldId'});db[_0x0a9e('0x1d6')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':'VariableId'});db[_0x0a9e('0xbe')]['hasMany'](db[_0x0a9e('0xbf')],{'as':_0x0a9e('0x1c3'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xbe')][_0x0a9e('0x150')](db['CloudProvider'],{'as':_0x0a9e('0x103'),'foreignKey':'CloudProviderId'});db[_0x0a9e('0xbf')][_0x0a9e('0x110')](db['Dynamics365Field'],{'as':'Subjects','onDelete':'cascade','foreignKey':'SubjectId'});db[_0x0a9e('0xbf')][_0x0a9e('0x110')](db[_0x0a9e('0xc1')],{'as':_0x0a9e('0x1cd'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c5')});db['Dynamics365Configuration'][_0x0a9e('0x110')](db[_0x0a9e('0xc1')],{'as':'Fields','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xbf')][_0x0a9e('0x150')](db[_0x0a9e('0xbe')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1c7')});db['Dynamics365Field'][_0x0a9e('0x110')](db[_0x0a9e('0xc1')],{'as':_0x0a9e('0x1c8'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xc1')][_0x0a9e('0x110')](db[_0x0a9e('0xc1')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0xc1')][_0x0a9e('0x110')](db['Dynamics365Field'],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xc1')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db['FreshsalesAccount'][_0x0a9e('0x110')](db[_0x0a9e('0xc5')],{'as':_0x0a9e('0x1c3'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xc5')][_0x0a9e('0x110')](db['FreshsalesField'],{'as':'Subjects','foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xc5')][_0x0a9e('0x110')](db[_0x0a9e('0xc7')],{'as':_0x0a9e('0x1cd'),'foreignKey':'DescriptionId'});db[_0x0a9e('0xc5')]['hasMany'](db[_0x0a9e('0xc7')],{'as':_0x0a9e('0x1c1'),'foreignKey':'FieldId'});db[_0x0a9e('0xc5')]['belongsTo'](db[_0x0a9e('0xc3')],{'as':_0x0a9e('0x183'),'foreignKey':'AccountId'});db[_0x0a9e('0xc7')][_0x0a9e('0x110')](db[_0x0a9e('0xc7')],{'as':'Subject','foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xc7')][_0x0a9e('0x110')](db[_0x0a9e('0xc7')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db['FreshsalesField'][_0x0a9e('0x110')](db[_0x0a9e('0xc7')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db['FreshsalesField']['belongsTo'](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db['ChatQueueReport']['belongsTo'](db[_0x0a9e('0x60')],{});db['ChatQueueReport']['belongsTo'](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':'ListId'});db[_0x0a9e('0xca')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db['ChatQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x64')],{});db['ChatQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x65')],{});db[_0x0a9e('0xca')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db['ChatQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x67')],{});db['ChatInternalMessage']['belongsTo'](db[_0x0a9e('0x11')],{'onDelete':_0x0a9e('0x10e'),'foreignKey':'FromId'});db['ChatInternalMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1d7')});db[_0x0a9e('0xd0')]['hasMany'](db[_0x0a9e('0x1d8')],{'foreignKey':'SessionId','onDelete':'cascade'});db[_0x0a9e('0xd0')]['hasMany'](db[_0x0a9e('0xcd')],{'foreignKey':'SessionId','onDelete':_0x0a9e('0x10e')});db['SmsQueueReport']['belongsTo'](db[_0x0a9e('0x50')],{});db[_0x0a9e('0xd2')][_0x0a9e('0x150')](db['CmList'],{'as':'List','foreignKey':'ListId'});db[_0x0a9e('0xd2')][_0x0a9e('0x150')](db['CmContact'],{'as':_0x0a9e('0x160'),'foreignKey':'ContactId'});db[_0x0a9e('0xd2')]['belongsTo'](db[_0x0a9e('0x53')],{});db[_0x0a9e('0xd2')]['belongsTo'](db['SmsMessage'],{});db['SmsQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db[_0x0a9e('0xd2')][_0x0a9e('0x150')](db[_0x0a9e('0x57')],{});db[_0x0a9e('0x1d9')][_0x0a9e('0x110')](db[_0x0a9e('0xd0')],{'foreignKey':_0x0a9e('0x1da')});db[_0x0a9e('0x1d9')][_0x0a9e('0x110')](db[_0x0a9e('0x1d8')],{'foreignKey':_0x0a9e('0x1da')});db[_0x0a9e('0x1d9')][_0x0a9e('0x110')](db['JscriptyAnswerReport'],{'foreignKey':'ProjectId'});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':'user_has_teams'});db[_0x0a9e('0x129')]['belongsToMany'](db[_0x0a9e('0x1a')],{'through':'TeamVoiceQueue','as':_0x0a9e('0x131')});db['Team']['belongsToMany'](db[_0x0a9e('0x3c')],{'through':_0x0a9e('0x171'),'as':_0x0a9e('0x1db')});db[_0x0a9e('0x129')]['belongsToMany'](db['ChatQueue'],{'through':_0x0a9e('0x19b'),'as':'ChatQueues'});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db['FaxQueue'],{'through':_0x0a9e('0x187'),'as':'FaxQueues'});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db[_0x0a9e('0x57')],{'through':_0x0a9e('0x18c'),'as':_0x0a9e('0x136')});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db[_0x0a9e('0x137')],{'through':_0x0a9e('0x190'),'as':_0x0a9e('0x1dc')});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db[_0x0a9e('0x101')],{'through':_0x0a9e('0x1dd'),'as':_0x0a9e('0x138')});db[_0x0a9e('0x129')]['belongsToMany'](db[_0x0a9e('0xf1')],{'through':_0x0a9e('0x107'),'as':_0x0a9e('0x132')});db['Campaign'][_0x0a9e('0x110')](db[_0x0a9e('0x6d')],{'as':_0x0a9e('0x14c'),'foreignKey':_0x0a9e('0x1a7')});db[_0x0a9e('0x1a5')][_0x0a9e('0x110')](db[_0x0a9e('0x71')],{'as':_0x0a9e('0x115'),'foreignKey':_0x0a9e('0x1a7')});db[_0x0a9e('0x1a5')][_0x0a9e('0x110')](db['CmHopperHistory'],{'as':_0x0a9e('0x19e'),'foreignKey':_0x0a9e('0x1a7')});db[_0x0a9e('0x1a5')]['hasMany'](db[_0x0a9e('0x6f')],{'as':'HopperBlacks','foreignKey':'CampaignId'});db[_0x0a9e('0x1a5')]['belongsTo'](db[_0x0a9e('0x28')],{'as':'Trunk','foreignKey':_0x0a9e('0x14f')});db[_0x0a9e('0x1a5')][_0x0a9e('0x150')](db['Trunk'],{'as':_0x0a9e('0x151'),'foreignKey':'TrunkBackupId'});db['Campaign'][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'as':_0x0a9e('0x17b'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x1a5')][_0x0a9e('0x150')](db['SquareProject'],{'as':_0x0a9e('0xdc'),'foreignKey':_0x0a9e('0x1de')});db[_0x0a9e('0x1a5')][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'as':'Lists','through':_0x0a9e('0x1df')});db[_0x0a9e('0x1a5')][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x156'),'through':_0x0a9e('0x1e0')});db[_0x0a9e('0xe4')][_0x0a9e('0x150')](db[_0x0a9e('0x66')],{'as':_0x0a9e('0x66'),'foreignKey':_0x0a9e('0x19a')});db[_0x0a9e('0x1e1')][_0x0a9e('0x150')](db['MailMessage'],{});db['MailTransferReport'][_0x0a9e('0x150')](db[_0x0a9e('0x11c')],{});db['MailTransferReport'][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'foreignKey':_0x0a9e('0x1e2'),'as':_0x0a9e('0x1e3')});db[_0x0a9e('0x1e1')]['belongsTo'](db['User'],{'foreignKey':'FromUserId','as':_0x0a9e('0x1e4')});db[_0x0a9e('0x1e1')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':_0x0a9e('0x1e5'),'as':_0x0a9e('0x1e6')});db[_0x0a9e('0x1e1')][_0x0a9e('0x150')](db[_0x0a9e('0x3c')],{'foreignKey':'ToMailQueueId','as':'ToQueue'});db[_0x0a9e('0x1e1')][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'foreignKey':_0x0a9e('0x1e7'),'as':_0x0a9e('0x1e8')});db[_0x0a9e('0xe8')][_0x0a9e('0x150')](db[_0x0a9e('0x65')],{});db[_0x0a9e('0xe8')][_0x0a9e('0x150')](db['ChatInteraction'],{});db[_0x0a9e('0xe8')]['belongsTo'](db['ChatWebsite'],{'foreignKey':_0x0a9e('0x1e9'),'as':_0x0a9e('0x1e3')});db[_0x0a9e('0xe8')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':_0x0a9e('0x1ea'),'as':_0x0a9e('0x1e4')});db[_0x0a9e('0xe8')][_0x0a9e('0x150')](db['User'],{'foreignKey':_0x0a9e('0x1e5'),'as':_0x0a9e('0x1e6')});db[_0x0a9e('0xe8')]['belongsTo'](db[_0x0a9e('0x67')],{'foreignKey':_0x0a9e('0x1eb'),'as':'ToQueue'});db['ChatTransferReport']['belongsTo'](db['ChatWebsite'],{'foreignKey':_0x0a9e('0x1ec'),'as':_0x0a9e('0x1e8')});db['FaxTransferReport'][_0x0a9e('0x150')](db['FaxMessage'],{});db[_0x0a9e('0xea')][_0x0a9e('0x150')](db[_0x0a9e('0x11b')],{});db['FaxTransferReport']['belongsTo'](db[_0x0a9e('0x45')],{'foreignKey':_0x0a9e('0x1ed'),'as':_0x0a9e('0x1e3')});db[_0x0a9e('0xea')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':_0x0a9e('0x1ea'),'as':_0x0a9e('0x1e4')});db[_0x0a9e('0xea')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':'ToUserId','as':_0x0a9e('0x1e6')});db[_0x0a9e('0xea')]['belongsTo'](db['FaxQueue'],{'foreignKey':_0x0a9e('0x1ee'),'as':_0x0a9e('0x1ef')});db[_0x0a9e('0xea')][_0x0a9e('0x150')](db[_0x0a9e('0x45')],{'foreignKey':'ToFaxAccountId','as':_0x0a9e('0x1e8')});db[_0x0a9e('0xec')]['belongsTo'](db[_0x0a9e('0x5e')],{});db['OpenchannelTransferReport']['belongsTo'](db['OpenchannelInteraction'],{});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db['OpenchannelAccount'],{'foreignKey':'FromOpenchannelAccountId','as':_0x0a9e('0x1e3')});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':'FromUserId','as':_0x0a9e('0x1e4')});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db['User'],{'foreignKey':_0x0a9e('0x1e5'),'as':_0x0a9e('0x1e6')});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db[_0x0a9e('0x137')],{'foreignKey':'ToOpenchannelQueueId','as':'ToQueue'});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db[_0x0a9e('0x59')],{'foreignKey':'ToOpenchannelAccountId','as':'ToAccount'});db['SmsTransferReport']['belongsTo'](db[_0x0a9e('0x55')],{});db[_0x0a9e('0xee')][_0x0a9e('0x150')](db[_0x0a9e('0x53')],{});db[_0x0a9e('0xee')]['belongsTo'](db[_0x0a9e('0x50')],{'foreignKey':_0x0a9e('0x1f0'),'as':_0x0a9e('0x1e3')});db[_0x0a9e('0xee')][_0x0a9e('0x150')](db['User'],{'foreignKey':_0x0a9e('0x1ea'),'as':_0x0a9e('0x1e4')});db[_0x0a9e('0xee')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':'ToUserId','as':_0x0a9e('0x1e6')});db[_0x0a9e('0xee')]['belongsTo'](db['SmsQueue'],{'foreignKey':'ToSmsQueueId','as':_0x0a9e('0x1ef')});db[_0x0a9e('0xee')]['belongsTo'](db[_0x0a9e('0x50')],{'foreignKey':'ToSmsAccountId','as':'ToAccount'});db['CmList']['hasMany'](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':_0x0a9e('0x16d'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x139')][_0x0a9e('0x110')](db[_0x0a9e('0x1f1')],{'as':_0x0a9e('0x1f2'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x139')][_0x0a9e('0x110')](db['CmContact'],{'as':_0x0a9e('0x125'),'onDelete':'cascade','foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x139')][_0x0a9e('0x110')](db[_0x0a9e('0x71')],{'as':_0x0a9e('0x115'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x139')][_0x0a9e('0x110')](db[_0x0a9e('0x116')],{'as':'HopperHistory','foreignKey':'ListId'});db['CmList'][_0x0a9e('0x110')](db[_0x0a9e('0x73')],{'as':_0x0a9e('0x73'),'foreignKey':'ListId'});db[_0x0a9e('0x139')][_0x0a9e('0x121')](db[_0x0a9e('0x1a')],{'as':'Queues','through':_0x0a9e('0x1f3')});db[_0x0a9e('0x139')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Agents','through':_0x0a9e('0x128')});db[_0x0a9e('0xf1')][_0x0a9e('0x110')](db[_0x0a9e('0x16')],{'as':_0x0a9e('0x114'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0xf1')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':'UserVoicePrefix'});db[_0x0a9e('0xf1')]['belongsToMany'](db[_0x0a9e('0x129')],{'through':'TeamVoicePrefix','as':_0x0a9e('0x155')});db[_0x0a9e('0xf2')][_0x0a9e('0x110')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'foreignKey':_0x0a9e('0x1f4')});db['UserProfile'][_0x0a9e('0x110')](db['UserProfileSection'],{'as':_0x0a9e('0x1f5'),'foreignKey':_0x0a9e('0x1f4'),'onDelete':_0x0a9e('0x10e')});db['UserProfileSection']['hasMany'](db['UserProfileResource'],{'as':_0x0a9e('0x1f6'),'foreignKey':_0x0a9e('0x1f7'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0xf7')][_0x0a9e('0x110')](db[_0x0a9e('0x167')],{'as':'Dispositions','foreignKey':_0x0a9e('0x1f8'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0xf7')][_0x0a9e('0x110')](db['CannedAnswer'],{'as':_0x0a9e('0x169'),'foreignKey':_0x0a9e('0x1f8')});db['WhatsappAccount'][_0x0a9e('0x110')](db[_0x0a9e('0xfd')],{'as':_0x0a9e('0x158'),'foreignKey':'WhatsappAccountId'});db[_0x0a9e('0xf7')]['hasMany'](db[_0x0a9e('0xfb')],{'as':'Interactions'});db[_0x0a9e('0xf7')][_0x0a9e('0x110')](db['WhatsappApplication'],{'as':_0x0a9e('0x147'),'foreignKey':_0x0a9e('0x1f8'),'onDelete':_0x0a9e('0x10e')});db['WhatsappAccount'][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0xf7')][_0x0a9e('0x150')](db[_0x0a9e('0x7d')],{'as':'mandatoryDispositionPause','foreignKey':_0x0a9e('0x154')});db[_0x0a9e('0xf7')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x144')});db[_0x0a9e('0xf9')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0xf9')][_0x0a9e('0x150')](db[_0x0a9e('0x101')],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0xf9')][_0x0a9e('0x150')](db['WhatsappAccount'],{'onDelete':_0x0a9e('0x164')});db['WhatsappApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'onDelete':'restrict','foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0xf9')]['belongsTo'](db[_0x0a9e('0x86')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x181')});db['WhatsappInteraction'][_0x0a9e('0x110')](db['WhatsappMessage'],{'as':'Messages','onDelete':'cascade','foreignKey':_0x0a9e('0x1f9')});db[_0x0a9e('0xfb')][_0x0a9e('0x150')](db[_0x0a9e('0xf7')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1f8')});db[_0x0a9e('0xfb')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0xfb')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0xfb')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x1b5'),'as':_0x0a9e('0x174')});db['WhatsappInteraction'][_0x0a9e('0x121')](db['Tag'],{'through':_0x0a9e('0x1b5'),'as':_0x0a9e('0x175')});db[_0x0a9e('0xfb')]['belongsToMany'](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'through':_0x0a9e('0x130'),'foreignKey':'WhatsappInteractionId'});db[_0x0a9e('0xfd')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x11')});db[_0x0a9e('0xfd')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':'cascade','as':_0x0a9e('0x160')});db[_0x0a9e('0xfd')][_0x0a9e('0x150')](db['WhatsappInteraction'],{'onDelete':'cascade','as':_0x0a9e('0x179'),'foreignKey':_0x0a9e('0x1f9')});db[_0x0a9e('0xfd')]['belongsTo'](db[_0x0a9e('0xf7')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1f8')});db[_0x0a9e('0xfe')][_0x0a9e('0x150')](db[_0x0a9e('0xf7')],{});db['WhatsappQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0xfe')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0xfe')][_0x0a9e('0x150')](db['WhatsappInteraction'],{});db['WhatsappQueueReport']['belongsTo'](db[_0x0a9e('0x101')],{});db[_0x0a9e('0xfe')]['belongsTo'](db['WhatsappMessage'],{});db[_0x0a9e('0xfe')][_0x0a9e('0x150')](db['User'],{});db['WhatsappTransferReport'][_0x0a9e('0x150')](db[_0x0a9e('0xfd')],{});db['WhatsappTransferReport'][_0x0a9e('0x150')](db[_0x0a9e('0xfb')],{});db[_0x0a9e('0x1fa')]['belongsTo'](db['WhatsappAccount'],{'foreignKey':_0x0a9e('0x1fb'),'as':_0x0a9e('0x1e3')});db['WhatsappTransferReport']['belongsTo'](db[_0x0a9e('0xf7')],{'foreignKey':_0x0a9e('0x1fc'),'as':'ToAccount'});db[_0x0a9e('0x1fa')]['belongsTo'](db['WhatsappQueue'],{'foreignKey':_0x0a9e('0x1fd'),'as':_0x0a9e('0x1ef')});db['WhatsappTransferReport']['belongsTo'](db['User'],{'foreignKey':_0x0a9e('0x1ea'),'as':'FromAgent'});db[_0x0a9e('0x1fa')][_0x0a9e('0x150')](db['User'],{'foreignKey':'ToUserId','as':_0x0a9e('0x1e6')});db[_0x0a9e('0x101')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x37'),'foreignKey':'WhatsappQueueId'});db[_0x0a9e('0x101')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x1dd'),'as':'Teams'});db[_0x0a9e('0x1fe')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x1ff'),'foreignKey':_0x0a9e('0x10f'),'onDelete':_0x0a9e('0x10e'),'hooks':!![]});db[_0x0a9e('0x103')][_0x0a9e('0x10b')](db['Dynamics365Account'],{'as':_0x0a9e('0xbe'),'onDelete':_0x0a9e('0x164')});db['CloudProvider'][_0x0a9e('0x10b')](db['MailServerIn'],{'as':'Imap','onDelete':_0x0a9e('0x164')});db['CloudProvider']['hasOne'](db['MailServerOut'],{'as':'Smtp','onDelete':_0x0a9e('0x164')});module['exports']={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index 09270d3..06f35e8 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x192f=['./api/smsInteraction','/api/sms/messages','/api/sms/queues','./api/smsQueue','/api/openchannel/accounts','./api/openchannelAccount','./api/openchannelApplication','/api/openchannel/interactions','/api/openchannel/messages','./api/openchannelMessage','/api/openchannel/queues','/api/chat/websites','./api/chatWebsite','/api/openchannel/reports/queue','./api/openchannelQueueReport','/api/chat/applications','./api/chatApplication','/api/chat/interactions','/api/chat/offline_messages','./api/chatOfflineMessage','/api/chat/queues','./api/chatQueue','/api/chat/groups','./api/chatGroup','/api/chat/proactive_actions','./api/chatProactiveAction','/api/cm/contacts','./api/cmContact','/api/cm/hopper','./api/cmHopper','/api/cm/hopper_black','./api/cmHopperBlack','./api/cmHopperFinal','/api/cm/hopper_history','./api/cmHopperHistory','/api/cm/custom_fields','./api/cmCustomField','/api/actions','./api/action','/api/canned_answers','./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/sound','/api/tags','./api/tag','/api/contact_item_types','/api/cm_contact_has_items','/api/cm_hopper_additional_phones','./api/cmHopperAdditionalPhone','/api/templates','./api/template','/api/triggers','./api/trigger','./api/variable','/api/integrations','./api/integration','/api/integrations/reports','./api/integrationReport','/api/analytics/custom_reports','./api/analyticCustomReport','/api/analytics/default_reports','./api/analyticDefaultReport','/api/analytics/extracted_reports','/api/analytics/metrics','./api/analyticMetric','/api/analytics/field_reports','./api/analyticFieldReport','/api/analytics/tree_reports','./api/analyticTreeReport','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','/api/integrations/desk/accounts','./api/intDeskConfiguration','/api/integrations/desk/fields','/api/integrations/zoho/accounts','./api/intZohoAccount','./api/intZohoConfiguration','/api/integrations/zoho/fields','./api/intZohoField','/api/integrations/zendesk/accounts','./api/intZendeskAccount','./api/intZendeskConfiguration','./api/intZendeskField','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','./api/intFreshdeskField','./api/intVtigerAccount','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','/api/integrations/servicenow/accounts','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','/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/intFreshsalesField','/api/networks','./api/network','./api/chatQueueReport','/api/chat/internal/messages','./api/chatInternalMessage','/api/jscripty/answers/reports','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','./api/jscriptySessionReport','/api/sms/reports/queue','./api/smsQueueReport','/api/square/reports','/api/square/details/reports','/api/jscripty/projects','./api/jscriptyProject','/api/square/odbc','/api/square/projects','/api/square/recordings','./api/squareRecording','/api/square/messages','/api/teams','./api/team','/api/license','./api/license','/api/campaigns','./api/campaign','/api/migrations','./api/migration','/api/plugins','./api/plugin','/api/mail/reports/transfer','./api/mailTransferReport','./api/chatTransferReport','/api/fax/reports/transfer','./api/faxTransferReport','/api/openchannel/reports/transfer','./api/openchannelTransferReport','/api/sms/reports/transfer','./api/smsTransferReport','/api/cm/lists','./api/cmList','/api/voice/prefixes','./api/voicePrefix','/api/userProfiles','/api/userProfile/sections','./api/userProfileSection','./api/userProfileResource','/api/userNotifications','./api/userNotification','/api/whatsapp/accounts','./api/whatsappAccount','/api/whatsapp/applications','./api/whatsappApplication','/api/whatsapp/interactions','/api/whatsapp/messages','./api/whatsappQueueReport','./api/whatsappTransferReport','./api/whatsappQueue','/api/cloudProviders','./api/cloudProvider','/api/user-settings','./api/user-setting','/api/auth/local','./api/authLocal','/api/auth/google','./api/authGoogle','/api/auth/activedirectory','./api/authActiveDirectory','/api/jira','./api/jira','/api/rpc','./api/rpc','./api/version','/api/system','./api/system','/api/webbar','./api/webbar','/apidoc','static','join','root','/www','/demo','/snippet','snippet','/plugins','/server/files/plugins','route','get','resolve','appPath','/index.html','path','./errors','./utils/client-side-logger','default','then','use','/api/users','./api/user','/api/voice/chanspy','./api/voiceChanSpy','/api/voice/contexts','./api/voiceContext','/api/voice/extensions','./api/voiceExtension','./api/voiceMusicOnHold','/api/voice/queues','./api/voiceQueue','/api/voice/recordings','./api/voiceRecording','./api/screenRecording','/api/voice/mails','./api/voiceMail','/api/voice/mails/messages','./api/voiceMailMessage','/api/voice/calls/reports','./api/voiceCallReport','/api/voice/dials/reports','/api/voice/agents/reports','/api/voice/queues/reports','./api/voiceQueueReport','/api/members/reports','./api/memberReport','/api/trunks','./api/trunk','/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/interactions','./api/mailMessage','/api/mail/applications','./api/mailApplication','/api/mail/reports/queue','./api/mailQueueReport','/api/dashboards','./api/dashboard','/api/dashboards/items','./api/dashboardItem','/api/fax/applications','./api/faxApplication','./api/faxInteraction','/api/fax/messages','/api/fax/queues','./api/faxQueue','./api/faxQueueReport','/api/sms/accounts','/api/sms/applications','./api/smsApplication'];(function(_0x185a56,_0x2e35f0){var _0x3815cf=function(_0x3c95a5){while(--_0x3c95a5){_0x185a56['push'](_0x185a56['shift']());}};_0x3815cf(++_0x2e35f0);}(_0x192f,0xd6));var _0xf192=function(_0x5eaae7,_0x577c09){_0x5eaae7=_0x5eaae7-0x0;var _0x591743=_0x192f[_0x5eaae7];return _0x591743;};'use strict';var path=require(_0xf192('0x0'));var express=require('express');var errors=require(_0xf192('0x1'));var config=require('./config/environment');var setupLoggers=require(_0xf192('0x2'))['setupLoggers'];var clientSideLogs=require('./api/client-side-logs');exports[_0xf192('0x3')]=function(_0x3b704f){return setupLoggers(_0x3b704f)[_0xf192('0x4')](function(){_0x3b704f[_0xf192('0x5')](_0xf192('0x6'),require(_0xf192('0x7')));_0x3b704f['use'](_0xf192('0x8'),require(_0xf192('0x9')));_0x3b704f['use'](_0xf192('0xa'),require(_0xf192('0xb')));_0x3b704f[_0xf192('0x5')](_0xf192('0xc'),require(_0xf192('0xd')));_0x3b704f['use']('/api/voice/mohs',require(_0xf192('0xe')));_0x3b704f[_0xf192('0x5')](_0xf192('0xf'),require(_0xf192('0x10')));_0x3b704f[_0xf192('0x5')](_0xf192('0x11'),require(_0xf192('0x12')));_0x3b704f[_0xf192('0x5')]('/api/screen/recordings',require(_0xf192('0x13')));_0x3b704f[_0xf192('0x5')](_0xf192('0x14'),require(_0xf192('0x15')));_0x3b704f[_0xf192('0x5')](_0xf192('0x16'),require(_0xf192('0x17')));_0x3b704f[_0xf192('0x5')](_0xf192('0x18'),require(_0xf192('0x19')));_0x3b704f[_0xf192('0x5')](_0xf192('0x1a'),require('./api/voiceDialReport'));_0x3b704f[_0xf192('0x5')](_0xf192('0x1b'),require('./api/voiceAgentReport'));_0x3b704f[_0xf192('0x5')](_0xf192('0x1c'),require(_0xf192('0x1d')));_0x3b704f[_0xf192('0x5')](_0xf192('0x1e'),require(_0xf192('0x1f')));_0x3b704f[_0xf192('0x5')](_0xf192('0x20'),require(_0xf192('0x21')));_0x3b704f[_0xf192('0x5')](_0xf192('0x22'),require(_0xf192('0x23')));_0x3b704f['use'](_0xf192('0x24'),require(_0xf192('0x25')));_0x3b704f[_0xf192('0x5')](_0xf192('0x26'),require(_0xf192('0x27')));_0x3b704f[_0xf192('0x5')](_0xf192('0x28'),require(_0xf192('0x29')));_0x3b704f['use'](_0xf192('0x2a'),require(_0xf192('0x2b')));_0x3b704f[_0xf192('0x5')](_0xf192('0x2c'),require('./api/mailInteraction'));_0x3b704f[_0xf192('0x5')]('/api/mail/messages',require(_0xf192('0x2d')));_0x3b704f['use'](_0xf192('0x2e'),require(_0xf192('0x2f')));_0x3b704f[_0xf192('0x5')](_0xf192('0x30'),require(_0xf192('0x31')));_0x3b704f[_0xf192('0x5')](_0xf192('0x32'),require(_0xf192('0x33')));_0x3b704f['use'](_0xf192('0x34'),require(_0xf192('0x35')));_0x3b704f[_0xf192('0x5')]('/api/fax/accounts',require('./api/faxAccount'));_0x3b704f[_0xf192('0x5')](_0xf192('0x36'),require(_0xf192('0x37')));_0x3b704f[_0xf192('0x5')]('/api/fax/interactions',require(_0xf192('0x38')));_0x3b704f['use'](_0xf192('0x39'),require('./api/faxMessage'));_0x3b704f['use'](_0xf192('0x3a'),require(_0xf192('0x3b')));_0x3b704f['use']('/api/fax/reports/queue',require(_0xf192('0x3c')));_0x3b704f[_0xf192('0x5')](_0xf192('0x3d'),require('./api/smsAccount'));_0x3b704f[_0xf192('0x5')](_0xf192('0x3e'),require(_0xf192('0x3f')));_0x3b704f[_0xf192('0x5')]('/api/sms/interactions',require(_0xf192('0x40')));_0x3b704f[_0xf192('0x5')](_0xf192('0x41'),require('./api/smsMessage'));_0x3b704f[_0xf192('0x5')](_0xf192('0x42'),require(_0xf192('0x43')));_0x3b704f[_0xf192('0x5')](_0xf192('0x44'),require(_0xf192('0x45')));_0x3b704f[_0xf192('0x5')]('/api/openchannel/applications',require(_0xf192('0x46')));_0x3b704f[_0xf192('0x5')](_0xf192('0x47'),require('./api/openchannelInteraction'));_0x3b704f[_0xf192('0x5')](_0xf192('0x48'),require(_0xf192('0x49')));_0x3b704f[_0xf192('0x5')](_0xf192('0x4a'),require('./api/openchannelQueue'));_0x3b704f[_0xf192('0x5')](_0xf192('0x4b'),require(_0xf192('0x4c')));_0x3b704f['use'](_0xf192('0x4d'),require(_0xf192('0x4e')));_0x3b704f[_0xf192('0x5')](_0xf192('0x4f'),require(_0xf192('0x50')));_0x3b704f[_0xf192('0x5')](_0xf192('0x51'),require('./api/chatInteraction'));_0x3b704f[_0xf192('0x5')]('/api/chat/messages',require('./api/chatMessage'));_0x3b704f[_0xf192('0x5')](_0xf192('0x52'),require(_0xf192('0x53')));_0x3b704f[_0xf192('0x5')](_0xf192('0x54'),require(_0xf192('0x55')));_0x3b704f[_0xf192('0x5')](_0xf192('0x56'),require(_0xf192('0x57')));_0x3b704f[_0xf192('0x5')](_0xf192('0x58'),require(_0xf192('0x59')));_0x3b704f['use']('/api/cm/companies',require('./api/cmCompany'));_0x3b704f['use'](_0xf192('0x5a'),require(_0xf192('0x5b')));_0x3b704f[_0xf192('0x5')](_0xf192('0x5c'),require(_0xf192('0x5d')));_0x3b704f[_0xf192('0x5')](_0xf192('0x5e'),require(_0xf192('0x5f')));_0x3b704f['use']('/api/cm/hopper_final',require(_0xf192('0x60')));_0x3b704f[_0xf192('0x5')](_0xf192('0x61'),require(_0xf192('0x62')));_0x3b704f['use'](_0xf192('0x63'),require(_0xf192('0x64')));_0x3b704f[_0xf192('0x5')](_0xf192('0x65'),require(_0xf192('0x66')));_0x3b704f[_0xf192('0x5')]('/api/automations',require('./api/automation'));_0x3b704f[_0xf192('0x5')](_0xf192('0x67'),require(_0xf192('0x68')));_0x3b704f['use'](_0xf192('0x69'),require(_0xf192('0x6a')));_0x3b704f[_0xf192('0x5')](_0xf192('0x6b'),require(_0xf192('0x6c')));_0x3b704f[_0xf192('0x5')](_0xf192('0x6d'),require(_0xf192('0x6e')));_0x3b704f['use'](_0xf192('0x6f'),require('./api/pause'));_0x3b704f[_0xf192('0x5')](_0xf192('0x70'),require(_0xf192('0x71')));_0x3b704f[_0xf192('0x5')](_0xf192('0x72'),require(_0xf192('0x73')));_0x3b704f[_0xf192('0x5')](_0xf192('0x74'),require(_0xf192('0x75')));_0x3b704f[_0xf192('0x5')]('/api/sounds',require(_0xf192('0x76')));_0x3b704f[_0xf192('0x5')](_0xf192('0x77'),require(_0xf192('0x78')));_0x3b704f['use'](_0xf192('0x79'),require('./api/contactItemType'));_0x3b704f[_0xf192('0x5')](_0xf192('0x7a'),require('./api/cmContactHasItem'));_0x3b704f[_0xf192('0x5')](_0xf192('0x7b'),require(_0xf192('0x7c')));_0x3b704f['use'](_0xf192('0x7d'),require(_0xf192('0x7e')));_0x3b704f['use'](_0xf192('0x7f'),require(_0xf192('0x80')));_0x3b704f[_0xf192('0x5')]('/api/variables',require(_0xf192('0x81')));_0x3b704f[_0xf192('0x5')](_0xf192('0x82'),require(_0xf192('0x83')));_0x3b704f['use'](_0xf192('0x84'),require(_0xf192('0x85')));_0x3b704f['use'](_0xf192('0x86'),require(_0xf192('0x87')));_0x3b704f[_0xf192('0x5')](_0xf192('0x88'),require(_0xf192('0x89')));_0x3b704f[_0xf192('0x5')](_0xf192('0x8a'),require('./api/analyticExtractedReport'));_0x3b704f[_0xf192('0x5')](_0xf192('0x8b'),require(_0xf192('0x8c')));_0x3b704f['use'](_0xf192('0x8d'),require(_0xf192('0x8e')));_0x3b704f[_0xf192('0x5')](_0xf192('0x8f'),require(_0xf192('0x90')));_0x3b704f[_0xf192('0x5')](_0xf192('0x91'),require(_0xf192('0x92')));_0x3b704f['use'](_0xf192('0x93'),require(_0xf192('0x94')));_0x3b704f[_0xf192('0x5')]('/api/integrations/salesforce/fields',require('./api/intSalesforceField'));_0x3b704f[_0xf192('0x5')](_0xf192('0x95'),require(_0xf192('0x96')));_0x3b704f[_0xf192('0x5')]('/api/integrations/sugarcrm/configurations',require(_0xf192('0x97')));_0x3b704f[_0xf192('0x5')](_0xf192('0x98'),require('./api/intSugarcrmField'));_0x3b704f[_0xf192('0x5')](_0xf192('0x99'),require('./api/intDeskAccount'));_0x3b704f['use']('/api/integrations/desk/configurations',require(_0xf192('0x9a')));_0x3b704f[_0xf192('0x5')](_0xf192('0x9b'),require('./api/intDeskField'));_0x3b704f[_0xf192('0x5')](_0xf192('0x9c'),require(_0xf192('0x9d')));_0x3b704f[_0xf192('0x5')]('/api/integrations/zoho/configurations',require(_0xf192('0x9e')));_0x3b704f[_0xf192('0x5')](_0xf192('0x9f'),require(_0xf192('0xa0')));_0x3b704f[_0xf192('0x5')](_0xf192('0xa1'),require(_0xf192('0xa2')));_0x3b704f[_0xf192('0x5')]('/api/integrations/zendesk/configurations',require(_0xf192('0xa3')));_0x3b704f[_0xf192('0x5')]('/api/integrations/zendesk/fields',require(_0xf192('0xa4')));_0x3b704f[_0xf192('0x5')]('/api/integrations/freshdesk/accounts',require(_0xf192('0xa5')));_0x3b704f[_0xf192('0x5')](_0xf192('0xa6'),require(_0xf192('0xa7')));_0x3b704f[_0xf192('0x5')](_0xf192('0xa8'),require(_0xf192('0xa9')));_0x3b704f[_0xf192('0x5')]('/api/integrations/vtiger/accounts',require(_0xf192('0xaa')));_0x3b704f[_0xf192('0x5')](_0xf192('0xab'),require(_0xf192('0xac')));_0x3b704f['use']('/api/integrations/vtiger/fields',require('./api/intVtigerField'));_0x3b704f[_0xf192('0x5')](_0xf192('0xad'),require('./api/intServicenowAccount'));_0x3b704f[_0xf192('0x5')](_0xf192('0xae'),require(_0xf192('0xaf')));_0x3b704f['use']('/api/integrations/servicenow/fields',require('./api/intServicenowField'));_0x3b704f[_0xf192('0x5')]('/api/integrations/dynamics365/accounts',require('./api/intDynamics365Account'));_0x3b704f[_0xf192('0x5')](_0xf192('0xb0'),require(_0xf192('0xb1')));_0x3b704f[_0xf192('0x5')](_0xf192('0xb2'),require(_0xf192('0xb3')));_0x3b704f[_0xf192('0x5')](_0xf192('0xb4'),require(_0xf192('0xb5')));_0x3b704f['use'](_0xf192('0xb6'),require(_0xf192('0xb7')));_0x3b704f['use']('/api/integrations/freshsales/fields',require(_0xf192('0xb8')));_0x3b704f[_0xf192('0x5')](_0xf192('0xb9'),require(_0xf192('0xba')));_0x3b704f[_0xf192('0x5')]('/api/chat/reports/queue',require(_0xf192('0xbb')));_0x3b704f[_0xf192('0x5')](_0xf192('0xbc'),require(_0xf192('0xbd')));_0x3b704f[_0xf192('0x5')](_0xf192('0xbe'),require('./api/jscriptyAnswerReport'));_0x3b704f[_0xf192('0x5')](_0xf192('0xbf'),require(_0xf192('0xc0')));_0x3b704f[_0xf192('0x5')](_0xf192('0xc1'),require(_0xf192('0xc2')));_0x3b704f[_0xf192('0x5')](_0xf192('0xc3'),require(_0xf192('0xc4')));_0x3b704f[_0xf192('0x5')](_0xf192('0xc5'),require('./api/squareReport'));_0x3b704f[_0xf192('0x5')](_0xf192('0xc6'),require('./api/squareReportDetail'));_0x3b704f[_0xf192('0x5')](_0xf192('0xc7'),require(_0xf192('0xc8')));_0x3b704f['use']('/api/settings',require('./api/setting'));_0x3b704f[_0xf192('0x5')](_0xf192('0xc9'),require('./api/squareOdbc'));_0x3b704f[_0xf192('0x5')](_0xf192('0xca'),require('./api/squareProject'));_0x3b704f[_0xf192('0x5')](_0xf192('0xcb'),require(_0xf192('0xcc')));_0x3b704f[_0xf192('0x5')](_0xf192('0xcd'),require('./api/squareMessage'));_0x3b704f[_0xf192('0x5')](_0xf192('0xce'),require(_0xf192('0xcf')));_0x3b704f[_0xf192('0x5')](_0xf192('0xd0'),require(_0xf192('0xd1')));_0x3b704f[_0xf192('0x5')](_0xf192('0xd2'),require(_0xf192('0xd3')));_0x3b704f[_0xf192('0x5')](_0xf192('0xd4'),require(_0xf192('0xd5')));_0x3b704f[_0xf192('0x5')]('/api/attachments',require('./api/attachment'));_0x3b704f[_0xf192('0x5')](_0xf192('0xd6'),require(_0xf192('0xd7')));_0x3b704f['use'](_0xf192('0xd8'),require(_0xf192('0xd9')));_0x3b704f[_0xf192('0x5')]('/api/chat/reports/transfer',require(_0xf192('0xda')));_0x3b704f[_0xf192('0x5')](_0xf192('0xdb'),require(_0xf192('0xdc')));_0x3b704f[_0xf192('0x5')](_0xf192('0xdd'),require(_0xf192('0xde')));_0x3b704f['use'](_0xf192('0xdf'),require(_0xf192('0xe0')));_0x3b704f[_0xf192('0x5')](_0xf192('0xe1'),require(_0xf192('0xe2')));_0x3b704f[_0xf192('0x5')](_0xf192('0xe3'),require(_0xf192('0xe4')));_0x3b704f[_0xf192('0x5')](_0xf192('0xe5'),require('./api/userProfile'));_0x3b704f[_0xf192('0x5')](_0xf192('0xe6'),require(_0xf192('0xe7')));_0x3b704f[_0xf192('0x5')]('/api/userProfile/resources',require(_0xf192('0xe8')));_0x3b704f['use'](_0xf192('0xe9'),require(_0xf192('0xea')));_0x3b704f[_0xf192('0x5')](_0xf192('0xeb'),require(_0xf192('0xec')));_0x3b704f[_0xf192('0x5')](_0xf192('0xed'),require(_0xf192('0xee')));_0x3b704f[_0xf192('0x5')](_0xf192('0xef'),require('./api/whatsappInteraction'));_0x3b704f[_0xf192('0x5')](_0xf192('0xf0'),require('./api/whatsappMessage'));_0x3b704f[_0xf192('0x5')]('/api/whatsapp/reports/queue',require(_0xf192('0xf1')));_0x3b704f[_0xf192('0x5')]('/api/whatsapp/reports/transfer',require(_0xf192('0xf2')));_0x3b704f[_0xf192('0x5')]('/api/whatsapp/queues',require(_0xf192('0xf3')));_0x3b704f['use'](_0xf192('0xf4'),require(_0xf192('0xf5')));_0x3b704f['use']('/api/realtime',require('./api/realtime'));_0x3b704f['use'](_0xf192('0xf6'),require(_0xf192('0xf7')));_0x3b704f[_0xf192('0x5')](_0xf192('0xf8'),require(_0xf192('0xf9')));_0x3b704f[_0xf192('0x5')](_0xf192('0xfa'),require(_0xf192('0xfb')));_0x3b704f['use'](_0xf192('0xfc'),require(_0xf192('0xfd')));_0x3b704f[_0xf192('0x5')](_0xf192('0xfe'),require(_0xf192('0xff')));_0x3b704f[_0xf192('0x5')](_0xf192('0x100'),require(_0xf192('0x101')));_0x3b704f[_0xf192('0x5')]('/api/version',require(_0xf192('0x102')));_0x3b704f[_0xf192('0x5')](_0xf192('0x103'),require(_0xf192('0x104')));_0x3b704f[_0xf192('0x5')]('/api/pm2',require('./api/pm2'));_0x3b704f[_0xf192('0x5')](_0xf192('0x105'),require(_0xf192('0x106')));_0x3b704f[_0xf192('0x5')]('/api/logs',clientSideLogs);_0x3b704f[_0xf192('0x5')](_0xf192('0x107'),express[_0xf192('0x108')](path[_0xf192('0x109')](config[_0xf192('0x10a')],_0xf192('0x107'))));_0x3b704f[_0xf192('0x5')](_0xf192('0x10b'),express[_0xf192('0x108')](path[_0xf192('0x109')](config[_0xf192('0x10a')],_0xf192('0x10b'))));_0x3b704f[_0xf192('0x5')](_0xf192('0x10c'),express[_0xf192('0x108')](path['join'](config['root'],'/demo')));_0x3b704f[_0xf192('0x5')](_0xf192('0x10d'),express['static'](path[_0xf192('0x109')](config[_0xf192('0x10a')],_0xf192('0x10e'),'3.5.0')));_0x3b704f[_0xf192('0x5')](_0xf192('0x10f'),express[_0xf192('0x108')](path[_0xf192('0x109')](config[_0xf192('0x10a')],_0xf192('0x110'))));_0x3b704f[_0xf192('0x111')]('/:url(api|auth|components|app|bower_components|assets)/*')[_0xf192('0x112')](errors[0x194]);_0x3b704f[_0xf192('0x111')]('/*')[_0xf192('0x112')](function(_0x56af80,_0x3479e2){_0x3479e2['sendFile'](path[_0xf192('0x113')](_0x3b704f['get'](_0xf192('0x114'))+_0xf192('0x115')));});return _0x3b704f;});}; \ No newline at end of file +var _0x177a=['./api/faxInteraction','./api/faxMessage','./api/faxQueue','/api/fax/reports/queue','./api/faxQueueReport','/api/sms/accounts','./api/smsAccount','./api/smsApplication','./api/smsInteraction','./api/smsMessage','./api/smsQueue','/api/openchannel/accounts','/api/openchannel/interactions','./api/openchannelInteraction','/api/openchannel/messages','./api/openchannelMessage','./api/openchannelQueue','/api/chat/websites','./api/chatWebsite','/api/openchannel/reports/queue','./api/openchannelQueueReport','./api/chatApplication','./api/chatInteraction','/api/chat/messages','./api/chatMessage','/api/chat/offline_messages','./api/chatOfflineMessage','/api/chat/queues','./api/chatQueue','/api/chat/groups','./api/chatGroup','/api/chat/proactive_actions','./api/chatProactiveAction','/api/cm/contacts','./api/cmContact','/api/cm/hopper','./api/cmHopper','/api/cm/hopper_black','/api/cm/hopper_final','./api/cmHopperFinal','/api/cm/hopper_history','./api/cmHopperHistory','/api/cm/custom_fields','./api/action','/api/automations','./api/automation','/api/canned_answers','/api/dispositions','./api/disposition','/api/conditions','./api/condition','/api/intervals','./api/interval','/api/pauses','./api/pause','./api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','/api/schedules','./api/schedule','/api/sounds','./api/sound','/api/tags','./api/tag','/api/contact_item_types','./api/contactItemType','/api/cm_contact_has_items','./api/cmContactHasItem','/api/cm_hopper_additional_phones','./api/cmHopperAdditionalPhone','/api/templates','./api/template','/api/triggers','./api/trigger','/api/variables','./api/variable','./api/integration','/api/integrations/reports','/api/analytics/custom_reports','./api/analyticCustomReport','/api/analytics/default_reports','./api/analyticDefaultReport','./api/analyticExtractedReport','./api/analyticMetric','/api/analytics/field_reports','/api/analytics/tree_reports','./api/analyticTreeReport','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','./api/intSalesforceField','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','./api/intSugarcrmField','/api/integrations/desk/accounts','/api/integrations/desk/configurations','./api/intDeskConfiguration','/api/integrations/desk/fields','./api/intDeskField','/api/integrations/zoho/accounts','./api/intZohoAccount','/api/integrations/zoho/configurations','./api/intZohoConfiguration','/api/integrations/zendesk/accounts','./api/intZendeskAccount','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','./api/intZendeskField','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','/api/integrations/freshdesk/fields','./api/intFreshdeskField','/api/integrations/vtiger/accounts','./api/intVtigerAccount','/api/integrations/vtiger/configurations','/api/integrations/vtiger/fields','./api/intVtigerField','/api/integrations/servicenow/accounts','./api/intServicenowAccount','./api/intServicenowConfiguration','/api/integrations/dynamics365/accounts','./api/intDynamics365Account','/api/integrations/dynamics365/configurations','./api/intDynamics365Configuration','/api/integrations/dynamics365/fields','/api/integrations/freshsales/accounts','/api/networks','./api/network','/api/chat/internal/messages','./api/chatInternalMessage','/api/jscripty/answers/reports','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','./api/jscriptySessionReport','/api/square/reports','./api/squareReport','/api/square/details/reports','./api/squareReportDetail','/api/jscripty/projects','./api/jscriptyProject','/api/settings','./api/setting','/api/square/odbc','./api/squareOdbc','/api/square/projects','./api/squareProject','./api/squareRecording','./api/squareMessage','./api/team','/api/license','./api/license','./api/campaign','/api/migrations','./api/migration','./api/attachment','/api/plugins','./api/plugin','/api/mail/reports/transfer','./api/mailTransferReport','./api/chatTransferReport','/api/fax/reports/transfer','./api/faxTransferReport','/api/sms/reports/transfer','./api/smsTransferReport','/api/cm/lists','./api/cmList','./api/voicePrefix','/api/userProfiles','./api/userProfile','./api/userProfileSection','/api/userProfile/resources','./api/userNotification','/api/whatsapp/accounts','./api/whatsappAccount','/api/whatsapp/applications','./api/whatsappApplication','/api/whatsapp/interactions','./api/whatsappInteraction','/api/whatsapp/messages','./api/whatsappMessage','/api/whatsapp/reports/queue','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','/api/whatsapp/queues','./api/whatsappQueue','/api/cloudProviders','./api/cloudProvider','/api/realtime','./api/realtime','./api/user-setting','/api/auth/local','./api/authLocal','/api/auth/google','./api/authActiveDirectory','/api/jira','./api/jira','./api/rpc','/api/version','./api/version','/api/system','/api/pm2','./api/pm2','./api/webbar','/apidoc','join','/www','static','root','/demo','/snippet','/plugins','/server/files/plugins','route','get','resolve','appPath','/index.html','path','./config/environment','./utils/client-side-logger','setupLoggers','./api/client-side-logs','default','use','/api/users','./api/user','/api/voice/chanspy','./api/voiceChanSpy','/api/voice/contexts','./api/voiceExtension','/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/voiceAgentReport','./api/voiceQueueReport','./api/memberReport','/api/trunks','./api/trunk','/api/mail/out_servers','./api/mailServerOut','./api/mailAccount','/api/mail/queues','/api/mail/substatuses','./api/mailSubstatus','./api/mailInteraction','/api/mail/messages','/api/mail/reports/queue','./api/mailQueueReport','/api/dashboards','/api/dashboards/items','/api/fax/accounts','./api/faxApplication','/api/fax/interactions'];(function(_0x2cffce,_0xa2c251){var _0x1a42bd=function(_0x4561f2){while(--_0x4561f2){_0x2cffce['push'](_0x2cffce['shift']());}};_0x1a42bd(++_0xa2c251);}(_0x177a,0xdd));var _0xa177=function(_0x3f57d3,_0x2339e0){_0x3f57d3=_0x3f57d3-0x0;var _0x42443e=_0x177a[_0x3f57d3];return _0x42443e;};'use strict';var path=require(_0xa177('0x0'));var express=require('express');var errors=require('./errors');var config=require(_0xa177('0x1'));var setupLoggers=require(_0xa177('0x2'))[_0xa177('0x3')];var clientSideLogs=require(_0xa177('0x4'));exports[_0xa177('0x5')]=function(_0x471a81){return setupLoggers(_0x471a81)['then'](function(){_0x471a81[_0xa177('0x6')](_0xa177('0x7'),require(_0xa177('0x8')));_0x471a81[_0xa177('0x6')](_0xa177('0x9'),require(_0xa177('0xa')));_0x471a81[_0xa177('0x6')](_0xa177('0xb'),require('./api/voiceContext'));_0x471a81[_0xa177('0x6')]('/api/voice/extensions',require(_0xa177('0xc')));_0x471a81[_0xa177('0x6')](_0xa177('0xd'),require(_0xa177('0xe')));_0x471a81[_0xa177('0x6')](_0xa177('0xf'),require(_0xa177('0x10')));_0x471a81['use'](_0xa177('0x11'),require(_0xa177('0x12')));_0x471a81[_0xa177('0x6')](_0xa177('0x13'),require(_0xa177('0x14')));_0x471a81[_0xa177('0x6')](_0xa177('0x15'),require('./api/voiceMail'));_0x471a81['use'](_0xa177('0x16'),require(_0xa177('0x17')));_0x471a81[_0xa177('0x6')](_0xa177('0x18'),require(_0xa177('0x19')));_0x471a81[_0xa177('0x6')](_0xa177('0x1a'),require(_0xa177('0x1b')));_0x471a81[_0xa177('0x6')](_0xa177('0x1c'),require(_0xa177('0x1d')));_0x471a81[_0xa177('0x6')]('/api/voice/queues/reports',require(_0xa177('0x1e')));_0x471a81[_0xa177('0x6')]('/api/members/reports',require(_0xa177('0x1f')));_0x471a81[_0xa177('0x6')](_0xa177('0x20'),require(_0xa177('0x21')));_0x471a81['use']('/api/voice/transfers/reports',require('./api/voiceTransferReport'));_0x471a81[_0xa177('0x6')](_0xa177('0x22'),require(_0xa177('0x23')));_0x471a81[_0xa177('0x6')]('/api/mail/accounts',require(_0xa177('0x24')));_0x471a81['use'](_0xa177('0x25'),require('./api/mailQueue'));_0x471a81[_0xa177('0x6')](_0xa177('0x26'),require(_0xa177('0x27')));_0x471a81[_0xa177('0x6')]('/api/mail/interactions',require(_0xa177('0x28')));_0x471a81[_0xa177('0x6')](_0xa177('0x29'),require('./api/mailMessage'));_0x471a81['use']('/api/mail/applications',require('./api/mailApplication'));_0x471a81[_0xa177('0x6')](_0xa177('0x2a'),require(_0xa177('0x2b')));_0x471a81[_0xa177('0x6')](_0xa177('0x2c'),require('./api/dashboard'));_0x471a81[_0xa177('0x6')](_0xa177('0x2d'),require('./api/dashboardItem'));_0x471a81['use'](_0xa177('0x2e'),require('./api/faxAccount'));_0x471a81['use']('/api/fax/applications',require(_0xa177('0x2f')));_0x471a81['use'](_0xa177('0x30'),require(_0xa177('0x31')));_0x471a81[_0xa177('0x6')]('/api/fax/messages',require(_0xa177('0x32')));_0x471a81[_0xa177('0x6')]('/api/fax/queues',require(_0xa177('0x33')));_0x471a81[_0xa177('0x6')](_0xa177('0x34'),require(_0xa177('0x35')));_0x471a81[_0xa177('0x6')](_0xa177('0x36'),require(_0xa177('0x37')));_0x471a81[_0xa177('0x6')]('/api/sms/applications',require(_0xa177('0x38')));_0x471a81[_0xa177('0x6')]('/api/sms/interactions',require(_0xa177('0x39')));_0x471a81[_0xa177('0x6')]('/api/sms/messages',require(_0xa177('0x3a')));_0x471a81[_0xa177('0x6')]('/api/sms/queues',require(_0xa177('0x3b')));_0x471a81[_0xa177('0x6')](_0xa177('0x3c'),require('./api/openchannelAccount'));_0x471a81['use']('/api/openchannel/applications',require('./api/openchannelApplication'));_0x471a81['use'](_0xa177('0x3d'),require(_0xa177('0x3e')));_0x471a81[_0xa177('0x6')](_0xa177('0x3f'),require(_0xa177('0x40')));_0x471a81[_0xa177('0x6')]('/api/openchannel/queues',require(_0xa177('0x41')));_0x471a81[_0xa177('0x6')](_0xa177('0x42'),require(_0xa177('0x43')));_0x471a81[_0xa177('0x6')](_0xa177('0x44'),require(_0xa177('0x45')));_0x471a81[_0xa177('0x6')]('/api/chat/applications',require(_0xa177('0x46')));_0x471a81[_0xa177('0x6')]('/api/chat/interactions',require(_0xa177('0x47')));_0x471a81['use'](_0xa177('0x48'),require(_0xa177('0x49')));_0x471a81['use'](_0xa177('0x4a'),require(_0xa177('0x4b')));_0x471a81[_0xa177('0x6')](_0xa177('0x4c'),require(_0xa177('0x4d')));_0x471a81[_0xa177('0x6')](_0xa177('0x4e'),require(_0xa177('0x4f')));_0x471a81[_0xa177('0x6')](_0xa177('0x50'),require(_0xa177('0x51')));_0x471a81[_0xa177('0x6')]('/api/cm/companies',require('./api/cmCompany'));_0x471a81[_0xa177('0x6')](_0xa177('0x52'),require(_0xa177('0x53')));_0x471a81[_0xa177('0x6')](_0xa177('0x54'),require(_0xa177('0x55')));_0x471a81[_0xa177('0x6')](_0xa177('0x56'),require('./api/cmHopperBlack'));_0x471a81['use'](_0xa177('0x57'),require(_0xa177('0x58')));_0x471a81[_0xa177('0x6')](_0xa177('0x59'),require(_0xa177('0x5a')));_0x471a81[_0xa177('0x6')](_0xa177('0x5b'),require('./api/cmCustomField'));_0x471a81[_0xa177('0x6')]('/api/actions',require(_0xa177('0x5c')));_0x471a81[_0xa177('0x6')](_0xa177('0x5d'),require(_0xa177('0x5e')));_0x471a81[_0xa177('0x6')](_0xa177('0x5f'),require('./api/cannedAnswer'));_0x471a81[_0xa177('0x6')](_0xa177('0x60'),require(_0xa177('0x61')));_0x471a81[_0xa177('0x6')](_0xa177('0x62'),require(_0xa177('0x63')));_0x471a81['use'](_0xa177('0x64'),require(_0xa177('0x65')));_0x471a81[_0xa177('0x6')](_0xa177('0x66'),require(_0xa177('0x67')));_0x471a81[_0xa177('0x6')]('/api/cdr',require(_0xa177('0x68')));_0x471a81[_0xa177('0x6')](_0xa177('0x69'),require(_0xa177('0x6a')));_0x471a81[_0xa177('0x6')](_0xa177('0x6b'),require(_0xa177('0x6c')));_0x471a81[_0xa177('0x6')](_0xa177('0x6d'),require(_0xa177('0x6e')));_0x471a81[_0xa177('0x6')](_0xa177('0x6f'),require(_0xa177('0x70')));_0x471a81[_0xa177('0x6')](_0xa177('0x71'),require(_0xa177('0x72')));_0x471a81['use'](_0xa177('0x73'),require(_0xa177('0x74')));_0x471a81[_0xa177('0x6')](_0xa177('0x75'),require(_0xa177('0x76')));_0x471a81['use'](_0xa177('0x77'),require(_0xa177('0x78')));_0x471a81['use'](_0xa177('0x79'),require(_0xa177('0x7a')));_0x471a81[_0xa177('0x6')](_0xa177('0x7b'),require(_0xa177('0x7c')));_0x471a81[_0xa177('0x6')]('/api/integrations',require(_0xa177('0x7d')));_0x471a81[_0xa177('0x6')](_0xa177('0x7e'),require('./api/integrationReport'));_0x471a81[_0xa177('0x6')](_0xa177('0x7f'),require(_0xa177('0x80')));_0x471a81[_0xa177('0x6')](_0xa177('0x81'),require(_0xa177('0x82')));_0x471a81[_0xa177('0x6')]('/api/analytics/extracted_reports',require(_0xa177('0x83')));_0x471a81[_0xa177('0x6')]('/api/analytics/metrics',require(_0xa177('0x84')));_0x471a81['use'](_0xa177('0x85'),require('./api/analyticFieldReport'));_0x471a81[_0xa177('0x6')](_0xa177('0x86'),require(_0xa177('0x87')));_0x471a81[_0xa177('0x6')](_0xa177('0x88'),require(_0xa177('0x89')));_0x471a81[_0xa177('0x6')](_0xa177('0x8a'),require(_0xa177('0x8b')));_0x471a81[_0xa177('0x6')](_0xa177('0x8c'),require(_0xa177('0x8d')));_0x471a81[_0xa177('0x6')]('/api/integrations/sugarcrm/accounts',require(_0xa177('0x8e')));_0x471a81[_0xa177('0x6')](_0xa177('0x8f'),require('./api/intSugarcrmConfiguration'));_0x471a81['use']('/api/integrations/sugarcrm/fields',require(_0xa177('0x90')));_0x471a81[_0xa177('0x6')](_0xa177('0x91'),require('./api/intDeskAccount'));_0x471a81[_0xa177('0x6')](_0xa177('0x92'),require(_0xa177('0x93')));_0x471a81[_0xa177('0x6')](_0xa177('0x94'),require(_0xa177('0x95')));_0x471a81[_0xa177('0x6')](_0xa177('0x96'),require(_0xa177('0x97')));_0x471a81[_0xa177('0x6')](_0xa177('0x98'),require(_0xa177('0x99')));_0x471a81[_0xa177('0x6')]('/api/integrations/zoho/fields',require('./api/intZohoField'));_0x471a81[_0xa177('0x6')](_0xa177('0x9a'),require(_0xa177('0x9b')));_0x471a81[_0xa177('0x6')](_0xa177('0x9c'),require(_0xa177('0x9d')));_0x471a81[_0xa177('0x6')]('/api/integrations/zendesk/fields',require(_0xa177('0x9e')));_0x471a81[_0xa177('0x6')]('/api/integrations/freshdesk/accounts',require(_0xa177('0x9f')));_0x471a81[_0xa177('0x6')](_0xa177('0xa0'),require('./api/intFreshdeskConfiguration'));_0x471a81['use'](_0xa177('0xa1'),require(_0xa177('0xa2')));_0x471a81[_0xa177('0x6')](_0xa177('0xa3'),require(_0xa177('0xa4')));_0x471a81[_0xa177('0x6')](_0xa177('0xa5'),require('./api/intVtigerConfiguration'));_0x471a81[_0xa177('0x6')](_0xa177('0xa6'),require(_0xa177('0xa7')));_0x471a81[_0xa177('0x6')](_0xa177('0xa8'),require(_0xa177('0xa9')));_0x471a81['use']('/api/integrations/servicenow/configurations',require(_0xa177('0xaa')));_0x471a81[_0xa177('0x6')]('/api/integrations/servicenow/fields',require('./api/intServicenowField'));_0x471a81[_0xa177('0x6')](_0xa177('0xab'),require(_0xa177('0xac')));_0x471a81[_0xa177('0x6')](_0xa177('0xad'),require(_0xa177('0xae')));_0x471a81[_0xa177('0x6')](_0xa177('0xaf'),require('./api/intDynamics365Field'));_0x471a81[_0xa177('0x6')](_0xa177('0xb0'),require('./api/intFreshsalesAccount'));_0x471a81[_0xa177('0x6')]('/api/integrations/freshsales/configurations',require('./api/intFreshsalesConfiguration'));_0x471a81[_0xa177('0x6')]('/api/integrations/freshsales/fields',require('./api/intFreshsalesField'));_0x471a81['use'](_0xa177('0xb1'),require(_0xa177('0xb2')));_0x471a81[_0xa177('0x6')]('/api/chat/reports/queue',require('./api/chatQueueReport'));_0x471a81['use'](_0xa177('0xb3'),require(_0xa177('0xb4')));_0x471a81[_0xa177('0x6')](_0xa177('0xb5'),require('./api/jscriptyAnswerReport'));_0x471a81['use'](_0xa177('0xb6'),require(_0xa177('0xb7')));_0x471a81['use'](_0xa177('0xb8'),require(_0xa177('0xb9')));_0x471a81[_0xa177('0x6')]('/api/sms/reports/queue',require('./api/smsQueueReport'));_0x471a81['use'](_0xa177('0xba'),require(_0xa177('0xbb')));_0x471a81[_0xa177('0x6')](_0xa177('0xbc'),require(_0xa177('0xbd')));_0x471a81[_0xa177('0x6')](_0xa177('0xbe'),require(_0xa177('0xbf')));_0x471a81[_0xa177('0x6')](_0xa177('0xc0'),require(_0xa177('0xc1')));_0x471a81[_0xa177('0x6')](_0xa177('0xc2'),require(_0xa177('0xc3')));_0x471a81[_0xa177('0x6')](_0xa177('0xc4'),require(_0xa177('0xc5')));_0x471a81[_0xa177('0x6')]('/api/square/recordings',require(_0xa177('0xc6')));_0x471a81[_0xa177('0x6')]('/api/square/messages',require(_0xa177('0xc7')));_0x471a81[_0xa177('0x6')]('/api/teams',require(_0xa177('0xc8')));_0x471a81[_0xa177('0x6')](_0xa177('0xc9'),require(_0xa177('0xca')));_0x471a81[_0xa177('0x6')]('/api/campaigns',require(_0xa177('0xcb')));_0x471a81['use'](_0xa177('0xcc'),require(_0xa177('0xcd')));_0x471a81[_0xa177('0x6')]('/api/attachments',require(_0xa177('0xce')));_0x471a81[_0xa177('0x6')](_0xa177('0xcf'),require(_0xa177('0xd0')));_0x471a81['use'](_0xa177('0xd1'),require(_0xa177('0xd2')));_0x471a81['use']('/api/chat/reports/transfer',require(_0xa177('0xd3')));_0x471a81[_0xa177('0x6')](_0xa177('0xd4'),require(_0xa177('0xd5')));_0x471a81[_0xa177('0x6')]('/api/openchannel/reports/transfer',require('./api/openchannelTransferReport'));_0x471a81[_0xa177('0x6')](_0xa177('0xd6'),require(_0xa177('0xd7')));_0x471a81['use'](_0xa177('0xd8'),require(_0xa177('0xd9')));_0x471a81['use']('/api/voice/prefixes',require(_0xa177('0xda')));_0x471a81['use'](_0xa177('0xdb'),require(_0xa177('0xdc')));_0x471a81[_0xa177('0x6')]('/api/userProfile/sections',require(_0xa177('0xdd')));_0x471a81['use'](_0xa177('0xde'),require('./api/userProfileResource'));_0x471a81[_0xa177('0x6')]('/api/userNotifications',require(_0xa177('0xdf')));_0x471a81[_0xa177('0x6')](_0xa177('0xe0'),require(_0xa177('0xe1')));_0x471a81['use'](_0xa177('0xe2'),require(_0xa177('0xe3')));_0x471a81[_0xa177('0x6')](_0xa177('0xe4'),require(_0xa177('0xe5')));_0x471a81[_0xa177('0x6')](_0xa177('0xe6'),require(_0xa177('0xe7')));_0x471a81[_0xa177('0x6')](_0xa177('0xe8'),require(_0xa177('0xe9')));_0x471a81[_0xa177('0x6')](_0xa177('0xea'),require(_0xa177('0xeb')));_0x471a81[_0xa177('0x6')](_0xa177('0xec'),require(_0xa177('0xed')));_0x471a81[_0xa177('0x6')](_0xa177('0xee'),require(_0xa177('0xef')));_0x471a81[_0xa177('0x6')](_0xa177('0xf0'),require(_0xa177('0xf1')));_0x471a81[_0xa177('0x6')]('/api/user-settings',require(_0xa177('0xf2')));_0x471a81[_0xa177('0x6')](_0xa177('0xf3'),require(_0xa177('0xf4')));_0x471a81[_0xa177('0x6')](_0xa177('0xf5'),require('./api/authGoogle'));_0x471a81[_0xa177('0x6')]('/api/auth/activedirectory',require(_0xa177('0xf6')));_0x471a81[_0xa177('0x6')](_0xa177('0xf7'),require(_0xa177('0xf8')));_0x471a81['use']('/api/rpc',require(_0xa177('0xf9')));_0x471a81[_0xa177('0x6')](_0xa177('0xfa'),require(_0xa177('0xfb')));_0x471a81[_0xa177('0x6')](_0xa177('0xfc'),require('./api/system'));_0x471a81[_0xa177('0x6')](_0xa177('0xfd'),require(_0xa177('0xfe')));_0x471a81['use']('/api/webbar',require(_0xa177('0xff')));_0x471a81['use']('/api/logs',clientSideLogs);_0x471a81[_0xa177('0x6')](_0xa177('0x100'),express['static'](path[_0xa177('0x101')](config['root'],_0xa177('0x100'))));_0x471a81['use'](_0xa177('0x102'),express[_0xa177('0x103')](path[_0xa177('0x101')](config[_0xa177('0x104')],_0xa177('0x102'))));_0x471a81[_0xa177('0x6')]('/demo',express['static'](path[_0xa177('0x101')](config[_0xa177('0x104')],_0xa177('0x105'))));_0x471a81['use'](_0xa177('0x106'),express[_0xa177('0x103')](path[_0xa177('0x101')](config[_0xa177('0x104')],'snippet','3.5.0')));_0x471a81[_0xa177('0x6')](_0xa177('0x107'),express[_0xa177('0x103')](path['join'](config[_0xa177('0x104')],_0xa177('0x108'))));_0x471a81[_0xa177('0x109')]('/:url(api|auth|components|app|bower_components|assets)/*')[_0xa177('0x10a')](errors[0x194]);_0x471a81[_0xa177('0x109')]('/*')[_0xa177('0x10a')](function(_0x1d381d,_0x11a7e4){_0x11a7e4['sendFile'](path[_0xa177('0x10b')](_0x471a81[_0xa177('0x10a')](_0xa177('0x10c'))+_0xa177('0x10d')));});return _0x471a81;});}; \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index 142eff0..d551b94 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb2b0=['../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/chatMessage/chatMessage.rpc','../api/chatQueue/chatQueue.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/interval/interval.rpc','../api/pause/pause.rpc','../api/sound/sound.rpc','../api/trigger/trigger.rpc','../api/variable/variable.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/squareReport/squareReport.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/attachment/attachment.rpc','../api/plugin/plugin.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc','server','http','port','rpc','localhost','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','jayson/promise','lodash','../config/environment','listen','merge','../api/user/user.rpc','../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/memberReport/memberReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailAccount/mailAccount.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxAccount/faxAccount.rpc','../api/faxApplication/faxApplication.rpc','../api/faxInteraction/faxInteraction.rpc','../api/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'];(function(_0x461886,_0x4fc171){var _0x295e0a=function(_0x451524){while(--_0x451524){_0x461886['push'](_0x461886['shift']());}};_0x295e0a(++_0x4fc171);}(_0xb2b0,0x72));var _0x0b2b=function(_0x46aa37,_0x166763){_0x46aa37=_0x46aa37-0x0;var _0x5567a6=_0xb2b0[_0x46aa37];return _0x5567a6;};'use strict';var jayson=require(_0x0b2b('0x0'));var _=require(_0x0b2b('0x1'));var config=require(_0x0b2b('0x2'));exports[_0x0b2b('0x3')]=function(){return new Promise(function(_0x4e4eaf,_0x4e4c4f){var _0x12f7d2={};_0x12f7d2=_[_0x0b2b('0x4')](_0x12f7d2,require(_0x0b2b('0x5')));_0x12f7d2=_['merge'](_0x12f7d2,require(_0x0b2b('0x6')));_0x12f7d2=_[_0x0b2b('0x4')](_0x12f7d2,require(_0x0b2b('0x7')));_0x12f7d2=_[_0x0b2b('0x4')](_0x12f7d2,require(_0x0b2b('0x8')));_0x12f7d2=_[_0x0b2b('0x4')](_0x12f7d2,require(_0x0b2b('0x9')));_0x12f7d2=_[_0x0b2b('0x4')](_0x12f7d2,require(_0x0b2b('0xa')));_0x12f7d2=_[_0x0b2b('0x4')](_0x12f7d2,require(_0x0b2b('0xb')));_0x12f7d2=_[_0x0b2b('0x4')](_0x12f7d2,require(_0x0b2b('0xc')));_0x12f7d2=_[_0x0b2b('0x4')](_0x12f7d2,require(_0x0b2b('0xd')));_0x12f7d2=_[_0x0b2b('0x4')](_0x12f7d2,require('../api/trunk/trunk.rpc'));_0x12f7d2=_['merge'](_0x12f7d2,require('../api/voiceTransferReport/voiceTransferReport.rpc'));_0x12f7d2=_[_0x0b2b('0x4')](_0x12f7d2,require(_0x0b2b('0xe')));_0x12f7d2=_[_0x0b2b('0x4')](_0x12f7d2,require('../api/mailServerIn/mailServerIn.rpc'));_0x12f7d2=_[_0x0b2b('0x4')](_0x12f7d2,require(_0x0b2b('0xf')));_0x12f7d2=_[_0x0b2b('0x4')](_0x12f7d2,require('../api/mailQueue/mailQueue.rpc'));_0x12f7d2=_[_0x0b2b('0x4')](_0x12f7d2,require(_0x0b2b('0x10')));_0x12f7d2=_['merge'](_0x12f7d2,require(_0x0b2b('0x11')));_0x12f7d2=_[_0x0b2b('0x4')](_0x12f7d2,require(_0x0b2b('0x12')));_0x12f7d2=_[_0x0b2b('0x4')](_0x12f7d2,require(_0x0b2b('0x13')));_0x12f7d2=_['merge'](_0x12f7d2,require(_0x0b2b('0x14')));_0x12f7d2=_[_0x0b2b('0x4')](_0x12f7d2,require(_0x0b2b('0x15')));_0x12f7d2=_['merge'](_0x12f7d2,require(_0x0b2b('0x16')));_0x12f7d2=_['merge'](_0x12f7d2,require(_0x0b2b('0x17')));_0x12f7d2=_[_0x0b2b('0x4')](_0x12f7d2,require(_0x0b2b('0x18')));_0x12f7d2=_[_0x0b2b('0x4')](_0x12f7d2,require(_0x0b2b('0x19')));_0x12f7d2=_[_0x0b2b('0x4')](_0x12f7d2,require(_0x0b2b('0x1a')));_0x12f7d2=_[_0x0b2b('0x4')](_0x12f7d2,require(_0x0b2b('0x1b')));_0x12f7d2=_[_0x0b2b('0x4')](_0x12f7d2,require(_0x0b2b('0x1c')));_0x12f7d2=_['merge'](_0x12f7d2,require(_0x0b2b('0x1d')));_0x12f7d2=_[_0x0b2b('0x4')](_0x12f7d2,require(_0x0b2b('0x1e')));_0x12f7d2=_[_0x0b2b('0x4')](_0x12f7d2,require(_0x0b2b('0x1f')));_0x12f7d2=_[_0x0b2b('0x4')](_0x12f7d2,require(_0x0b2b('0x20')));_0x12f7d2=_[_0x0b2b('0x4')](_0x12f7d2,require(_0x0b2b('0x21')));_0x12f7d2=_[_0x0b2b('0x4')](_0x12f7d2,require('../api/openchannelQueueReport/openchannelQueueReport.rpc'));_0x12f7d2=_[_0x0b2b('0x4')](_0x12f7d2,require('../api/chatInteraction/chatInteraction.rpc'));_0x12f7d2=_['merge'](_0x12f7d2,require(_0x0b2b('0x22')));_0x12f7d2=_[_0x0b2b('0x4')](_0x12f7d2,require(_0x0b2b('0x23')));_0x12f7d2=_[_0x0b2b('0x4')](_0x12f7d2,require('../api/cmContact/cmContact.rpc'));_0x12f7d2=_[_0x0b2b('0x4')](_0x12f7d2,require(_0x0b2b('0x24')));_0x12f7d2=_[_0x0b2b('0x4')](_0x12f7d2,require('../api/cmHopperBlack/cmHopperBlack.rpc'));_0x12f7d2=_[_0x0b2b('0x4')](_0x12f7d2,require(_0x0b2b('0x25')));_0x12f7d2=_[_0x0b2b('0x4')](_0x12f7d2,require(_0x0b2b('0x26')));_0x12f7d2=_['merge'](_0x12f7d2,require('../api/reportAgentPreview/reportAgentPreview.rpc'));_0x12f7d2=_[_0x0b2b('0x4')](_0x12f7d2,require(_0x0b2b('0x27')));_0x12f7d2=_[_0x0b2b('0x4')](_0x12f7d2,require(_0x0b2b('0x28')));_0x12f7d2=_['merge'](_0x12f7d2,require(_0x0b2b('0x29')));_0x12f7d2=_[_0x0b2b('0x4')](_0x12f7d2,require('../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc'));_0x12f7d2=_[_0x0b2b('0x4')](_0x12f7d2,require('../api/template/template.rpc'));_0x12f7d2=_['merge'](_0x12f7d2,require(_0x0b2b('0x2a')));_0x12f7d2=_[_0x0b2b('0x4')](_0x12f7d2,require(_0x0b2b('0x2b')));_0x12f7d2=_['merge'](_0x12f7d2,require(_0x0b2b('0x2c')));_0x12f7d2=_['merge'](_0x12f7d2,require('../api/intSugarcrmAccount/intSugarcrmAccount.rpc'));_0x12f7d2=_[_0x0b2b('0x4')](_0x12f7d2,require(_0x0b2b('0x2d')));_0x12f7d2=_['merge'](_0x12f7d2,require(_0x0b2b('0x2e')));_0x12f7d2=_[_0x0b2b('0x4')](_0x12f7d2,require('../api/intZendeskAccount/intZendeskAccount.rpc'));_0x12f7d2=_[_0x0b2b('0x4')](_0x12f7d2,require(_0x0b2b('0x2f')));_0x12f7d2=_[_0x0b2b('0x4')](_0x12f7d2,require(_0x0b2b('0x30')));_0x12f7d2=_['merge'](_0x12f7d2,require('../api/intServicenowAccount/intServicenowAccount.rpc'));_0x12f7d2=_[_0x0b2b('0x4')](_0x12f7d2,require(_0x0b2b('0x31')));_0x12f7d2=_[_0x0b2b('0x4')](_0x12f7d2,require(_0x0b2b('0x32')));_0x12f7d2=_[_0x0b2b('0x4')](_0x12f7d2,require('../api/chatQueueReport/chatQueueReport.rpc'));_0x12f7d2=_['merge'](_0x12f7d2,require('../api/smsQueueReport/smsQueueReport.rpc'));_0x12f7d2=_[_0x0b2b('0x4')](_0x12f7d2,require(_0x0b2b('0x33')));_0x12f7d2=_[_0x0b2b('0x4')](_0x12f7d2,require(_0x0b2b('0x34')));_0x12f7d2=_['merge'](_0x12f7d2,require(_0x0b2b('0x35')));_0x12f7d2=_['merge'](_0x12f7d2,require(_0x0b2b('0x36')));_0x12f7d2=_[_0x0b2b('0x4')](_0x12f7d2,require(_0x0b2b('0x37')));_0x12f7d2=_[_0x0b2b('0x4')](_0x12f7d2,require(_0x0b2b('0x38')));_0x12f7d2=_['merge'](_0x12f7d2,require(_0x0b2b('0x39')));_0x12f7d2=_[_0x0b2b('0x4')](_0x12f7d2,require(_0x0b2b('0x3a')));_0x12f7d2=_[_0x0b2b('0x4')](_0x12f7d2,require(_0x0b2b('0x3b')));_0x12f7d2=_[_0x0b2b('0x4')](_0x12f7d2,require(_0x0b2b('0x3c')));_0x12f7d2=_[_0x0b2b('0x4')](_0x12f7d2,require(_0x0b2b('0x3d')));_0x12f7d2=_[_0x0b2b('0x4')](_0x12f7d2,require(_0x0b2b('0x3e')));_0x12f7d2=_[_0x0b2b('0x4')](_0x12f7d2,require(_0x0b2b('0x3f')));_0x12f7d2=_[_0x0b2b('0x4')](_0x12f7d2,require('../api/whatsappQueueReport/whatsappQueueReport.rpc'));_0x12f7d2=_[_0x0b2b('0x4')](_0x12f7d2,require('../api/whatsappQueue/whatsappQueue.rpc'));var _0x1031b4=jayson[_0x0b2b('0x40')](_0x12f7d2)[_0x0b2b('0x41')]();var _0x504381=config['rpc'][_0x0b2b('0x42')]||config[_0x0b2b('0x42')]+0x1;var _0xba6ba8=config[_0x0b2b('0x43')]['ip']||_0x0b2b('0x44');_0x1031b4['on']('error',function(_0x1c2b77){return _0x4e4c4f(_0x1c2b77);});_0x1031b4['listen'](_0x504381,_0xba6ba8,function(){console[_0x0b2b('0x45')](_0x0b2b('0x46'),_0xba6ba8,_0x504381);require(_0x0b2b('0x47'))['default']();return _0x4e4eaf('RPC\x20listening\x20on\x20'+_0xba6ba8+':'+_0x504381);});});}; \ No newline at end of file +var _0x1823=['../api/faxAccount/faxAccount.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsAccount/smsAccount.rpc','../api/smsMessage/smsMessage.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatMessage/chatMessage.rpc','../api/chatQueue/chatQueue.rpc','../api/cmContact/cmContact.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/pause/pause.rpc','../api/sound/sound.rpc','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc','../api/template/template.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareRecording/squareRecording.rpc','../api/squareMessage/squareMessage.rpc','../api/attachment/attachment.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappQueue/whatsappQueue.rpc','server','http','rpc','port','error','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','default','jayson/promise','listen','merge','../api/user/user.rpc','../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/memberReport/memberReport.rpc','../api/trunk/trunk.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/mailQueueReport/mailQueueReport.rpc'];(function(_0x4bcac2,_0x18bc5f){var _0xf1f9a1=function(_0x26ad6a){while(--_0x26ad6a){_0x4bcac2['push'](_0x4bcac2['shift']());}};_0xf1f9a1(++_0x18bc5f);}(_0x1823,0xe6));var _0x3182=function(_0x51dbba,_0x817f0d){_0x51dbba=_0x51dbba-0x0;var _0x34906d=_0x1823[_0x51dbba];return _0x34906d;};'use strict';var jayson=require(_0x3182('0x0'));var _=require('lodash');var config=require('../config/environment');exports[_0x3182('0x1')]=function(){return new Promise(function(_0x4db0c4,_0x47cfdf){var _0x1d55f0={};_0x1d55f0=_[_0x3182('0x2')](_0x1d55f0,require(_0x3182('0x3')));_0x1d55f0=_[_0x3182('0x2')](_0x1d55f0,require(_0x3182('0x4')));_0x1d55f0=_['merge'](_0x1d55f0,require(_0x3182('0x5')));_0x1d55f0=_[_0x3182('0x2')](_0x1d55f0,require(_0x3182('0x6')));_0x1d55f0=_[_0x3182('0x2')](_0x1d55f0,require('../api/voiceCallReport/voiceCallReport.rpc'));_0x1d55f0=_[_0x3182('0x2')](_0x1d55f0,require(_0x3182('0x7')));_0x1d55f0=_[_0x3182('0x2')](_0x1d55f0,require(_0x3182('0x8')));_0x1d55f0=_[_0x3182('0x2')](_0x1d55f0,require(_0x3182('0x9')));_0x1d55f0=_['merge'](_0x1d55f0,require(_0x3182('0xa')));_0x1d55f0=_[_0x3182('0x2')](_0x1d55f0,require(_0x3182('0xb')));_0x1d55f0=_[_0x3182('0x2')](_0x1d55f0,require('../api/voiceTransferReport/voiceTransferReport.rpc'));_0x1d55f0=_['merge'](_0x1d55f0,require(_0x3182('0xc')));_0x1d55f0=_[_0x3182('0x2')](_0x1d55f0,require('../api/mailServerIn/mailServerIn.rpc'));_0x1d55f0=_['merge'](_0x1d55f0,require(_0x3182('0xd')));_0x1d55f0=_[_0x3182('0x2')](_0x1d55f0,require(_0x3182('0xe')));_0x1d55f0=_['merge'](_0x1d55f0,require(_0x3182('0xf')));_0x1d55f0=_[_0x3182('0x2')](_0x1d55f0,require(_0x3182('0x10')));_0x1d55f0=_[_0x3182('0x2')](_0x1d55f0,require('../api/mailApplication/mailApplication.rpc'));_0x1d55f0=_[_0x3182('0x2')](_0x1d55f0,require(_0x3182('0x11')));_0x1d55f0=_['merge'](_0x1d55f0,require(_0x3182('0x12')));_0x1d55f0=_[_0x3182('0x2')](_0x1d55f0,require('../api/faxApplication/faxApplication.rpc'));_0x1d55f0=_[_0x3182('0x2')](_0x1d55f0,require('../api/faxInteraction/faxInteraction.rpc'));_0x1d55f0=_['merge'](_0x1d55f0,require(_0x3182('0x13')));_0x1d55f0=_['merge'](_0x1d55f0,require(_0x3182('0x14')));_0x1d55f0=_['merge'](_0x1d55f0,require(_0x3182('0x15')));_0x1d55f0=_[_0x3182('0x2')](_0x1d55f0,require(_0x3182('0x16')));_0x1d55f0=_['merge'](_0x1d55f0,require('../api/smsInteraction/smsInteraction.rpc'));_0x1d55f0=_[_0x3182('0x2')](_0x1d55f0,require(_0x3182('0x17')));_0x1d55f0=_[_0x3182('0x2')](_0x1d55f0,require('../api/smsQueue/smsQueue.rpc'));_0x1d55f0=_[_0x3182('0x2')](_0x1d55f0,require(_0x3182('0x18')));_0x1d55f0=_[_0x3182('0x2')](_0x1d55f0,require('../api/openchannelInteraction/openchannelInteraction.rpc'));_0x1d55f0=_['merge'](_0x1d55f0,require(_0x3182('0x19')));_0x1d55f0=_[_0x3182('0x2')](_0x1d55f0,require(_0x3182('0x1a')));_0x1d55f0=_[_0x3182('0x2')](_0x1d55f0,require(_0x3182('0x1b')));_0x1d55f0=_[_0x3182('0x2')](_0x1d55f0,require(_0x3182('0x1c')));_0x1d55f0=_[_0x3182('0x2')](_0x1d55f0,require(_0x3182('0x1d')));_0x1d55f0=_[_0x3182('0x2')](_0x1d55f0,require(_0x3182('0x1e')));_0x1d55f0=_['merge'](_0x1d55f0,require(_0x3182('0x1f')));_0x1d55f0=_[_0x3182('0x2')](_0x1d55f0,require('../api/cmHopper/cmHopper.rpc'));_0x1d55f0=_['merge'](_0x1d55f0,require(_0x3182('0x20')));_0x1d55f0=_[_0x3182('0x2')](_0x1d55f0,require(_0x3182('0x21')));_0x1d55f0=_[_0x3182('0x2')](_0x1d55f0,require(_0x3182('0x22')));_0x1d55f0=_[_0x3182('0x2')](_0x1d55f0,require(_0x3182('0x23')));_0x1d55f0=_['merge'](_0x1d55f0,require('../api/interval/interval.rpc'));_0x1d55f0=_[_0x3182('0x2')](_0x1d55f0,require(_0x3182('0x24')));_0x1d55f0=_[_0x3182('0x2')](_0x1d55f0,require(_0x3182('0x25')));_0x1d55f0=_[_0x3182('0x2')](_0x1d55f0,require(_0x3182('0x26')));_0x1d55f0=_[_0x3182('0x2')](_0x1d55f0,require(_0x3182('0x27')));_0x1d55f0=_[_0x3182('0x2')](_0x1d55f0,require('../api/trigger/trigger.rpc'));_0x1d55f0=_['merge'](_0x1d55f0,require('../api/variable/variable.rpc'));_0x1d55f0=_['merge'](_0x1d55f0,require('../api/intSalesforceAccount/intSalesforceAccount.rpc'));_0x1d55f0=_[_0x3182('0x2')](_0x1d55f0,require(_0x3182('0x28')));_0x1d55f0=_[_0x3182('0x2')](_0x1d55f0,require(_0x3182('0x29')));_0x1d55f0=_['merge'](_0x1d55f0,require(_0x3182('0x2a')));_0x1d55f0=_[_0x3182('0x2')](_0x1d55f0,require(_0x3182('0x2b')));_0x1d55f0=_['merge'](_0x1d55f0,require('../api/intFreshdeskAccount/intFreshdeskAccount.rpc'));_0x1d55f0=_[_0x3182('0x2')](_0x1d55f0,require('../api/intVtigerAccount/intVtigerAccount.rpc'));_0x1d55f0=_[_0x3182('0x2')](_0x1d55f0,require('../api/intServicenowAccount/intServicenowAccount.rpc'));_0x1d55f0=_[_0x3182('0x2')](_0x1d55f0,require(_0x3182('0x2c')));_0x1d55f0=_[_0x3182('0x2')](_0x1d55f0,require('../api/intFreshsalesAccount/intFreshsalesAccount.rpc'));_0x1d55f0=_[_0x3182('0x2')](_0x1d55f0,require('../api/chatQueueReport/chatQueueReport.rpc'));_0x1d55f0=_['merge'](_0x1d55f0,require(_0x3182('0x2d')));_0x1d55f0=_[_0x3182('0x2')](_0x1d55f0,require(_0x3182('0x2e')));_0x1d55f0=_[_0x3182('0x2')](_0x1d55f0,require('../api/squareReportDetail/squareReportDetail.rpc'));_0x1d55f0=_[_0x3182('0x2')](_0x1d55f0,require('../api/setting/setting.rpc'));_0x1d55f0=_[_0x3182('0x2')](_0x1d55f0,require('../api/squareOdbc/squareOdbc.rpc'));_0x1d55f0=_[_0x3182('0x2')](_0x1d55f0,require('../api/squareProject/squareProject.rpc'));_0x1d55f0=_[_0x3182('0x2')](_0x1d55f0,require(_0x3182('0x2f')));_0x1d55f0=_['merge'](_0x1d55f0,require(_0x3182('0x30')));_0x1d55f0=_[_0x3182('0x2')](_0x1d55f0,require('../api/campaign/campaign.rpc'));_0x1d55f0=_['merge'](_0x1d55f0,require(_0x3182('0x31')));_0x1d55f0=_[_0x3182('0x2')](_0x1d55f0,require('../api/plugin/plugin.rpc'));_0x1d55f0=_[_0x3182('0x2')](_0x1d55f0,require(_0x3182('0x32')));_0x1d55f0=_[_0x3182('0x2')](_0x1d55f0,require(_0x3182('0x33')));_0x1d55f0=_[_0x3182('0x2')](_0x1d55f0,require('../api/whatsappMessage/whatsappMessage.rpc'));_0x1d55f0=_['merge'](_0x1d55f0,require('../api/whatsappQueueReport/whatsappQueueReport.rpc'));_0x1d55f0=_[_0x3182('0x2')](_0x1d55f0,require(_0x3182('0x34')));var _0x50db7b=jayson[_0x3182('0x35')](_0x1d55f0)[_0x3182('0x36')]();var _0x18d7b2=config[_0x3182('0x37')][_0x3182('0x38')]||config[_0x3182('0x38')]+0x1;var _0x3d5198=config[_0x3182('0x37')]['ip']||'localhost';_0x50db7b['on'](_0x3182('0x39'),function(_0xa6c970){return _0x47cfdf(_0xa6c970);});_0x50db7b[_0x3182('0x1')](_0x18d7b2,_0x3d5198,function(){console[_0x3182('0x3a')](_0x3182('0x3b'),_0x3d5198,_0x18d7b2);require(_0x3182('0x3c'))[_0x3182('0x3d')]();return _0x4db0c4('RPC\x20listening\x20on\x20'+_0x3d5198+':'+_0x18d7b2);});});}; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index 4bee605..f33b214 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 _0xaa37=['indexOf','substr','startsWith','split','length','match','error','E_AGI_SOCKET_ERROR','code','close','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','pipe','command','function','write','destroy','inherits','prototype','sendRequest','sync','answer','getData','beep','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','SET\x20EXTENSION\x20%s','setPriority','SET\x20PRIORITY\x20%s','HANGUP','setVariable','isBoolean','isNumber','toString','SET\x20VARIABLE\x20%s\x20\x22%s\x22','sayNumber','sayDigits','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','extension','setExtension','noop','getVariable','recordFile','wav','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','streamFile','agi','AGI','label','exports','util','lodash','events','EventEmitter','./error','call','utf8','setTimeout','headers','emit','ready','line','toLowerCase','hangup','substring','search','520\x20End\x20of\x20proper','replace','result='];(function(_0x4084fe,_0x19aad9){var _0x598649=function(_0xa81c8f){while(--_0xa81c8f){_0x4084fe['push'](_0x4084fe['shift']());}};_0x598649(++_0x19aad9);}(_0xaa37,0x1d3));var _0x7aa3=function(_0x3511d3,_0x4107ae){_0x3511d3=_0x3511d3-0x0;var _0x5d6321=_0xaa37[_0x3511d3];return _0x5d6321;};'use strict';var util=require(_0x7aa3('0x0'));var _=require(_0x7aa3('0x1'));var EventEmitter=require(_0x7aa3('0x2'))[_0x7aa3('0x3')];var AGIReply=require('./reply');var AGIError=require(_0x7aa3('0x4'));function AGIChannel(_0x27adcf){var _0x27333d=this,_0x11e64c=new AGIReply(),_0x334919=![],_0x2801a2={};EventEmitter[_0x7aa3('0x5')](_0x27333d);_0x27adcf['setEncoding'](_0x7aa3('0x6'));_0x27adcf[_0x7aa3('0x7')](0x8*0x3c*0x3c*0x3e8);_0x11e64c['setEncoding'](_0x7aa3('0x6'));_0x11e64c['on'](_0x7aa3('0x8'),function(_0x394097){for(var _0x4f43f1 in _0x394097){_0x27333d[_0x4f43f1]=_0x394097[_0x4f43f1];}_0x27333d[_0x7aa3('0x9')](_0x7aa3('0xa'));});_0x11e64c['on'](_0x7aa3('0xb'),function(_0x1725d1){if(_0x1725d1[_0x7aa3('0xc')]()==_0x7aa3('0xd')){_0x27333d['emit']('hangup');return;}if(_0x1725d1[_0x7aa3('0xe')](0x0,0xb)=='520-Invalid'){_0x334919=!![];}if(_0x334919){_0x2801a2['rx']+=_0x1725d1+'\x0a';if(_0x1725d1[_0x7aa3('0xf')](_0x7aa3('0x10'))!=-0x1){_0x334919=![];}}else{_0x2801a2['rx']=_0x1725d1;}if(_0x334919){return;}if(typeof _0x2801a2['cb']=='function'){var _0x3c68b8=_0x2801a2['rx']['substring'](0x0,0x3),_0xc11cd3=null,_0x552ec9=null;_0x3c68b8=parseInt(_0x3c68b8);if(isNaN(_0x3c68b8)){_0x2801a2['cb'](null,{'code':0x1f4,'result':-0x1,'extra':'no\x20code'});return;}if(_0x3c68b8!=0xc8){_0x2801a2['cb'](null,{'code':_0x3c68b8,'result':-0x1,'extra':'KO'});return;}_0xc11cd3=_0x2801a2['rx'][_0x7aa3('0xe')](0x4)[_0x7aa3('0x11')](_0x7aa3('0x12'),'');if(_0xc11cd3[_0x7aa3('0x13')]('\x20')!=-0x1){_0xc11cd3=_0xc11cd3[_0x7aa3('0x14')](0x0,_0xc11cd3['indexOf']('\x20'));}if(_[_0x7aa3('0x15')](_0xc11cd3,'-1')){_0xc11cd3=parseInt(_0xc11cd3);}_0x552ec9=_0x2801a2['rx'][_0x7aa3('0x16')]('\x20');if(_0x552ec9[_0x7aa3('0x17')]==0x3){_0x552ec9=_0x552ec9[0x2][_0x7aa3('0xe')](0x1,_0x552ec9[0x2]['length']-0x1);}else if(_0x552ec9['length']>0x3){var _0x3fab08=/\((.+)\)/;var _0x50ab9e=_0x2801a2['rx'][_0x7aa3('0x18')](_0x3fab08);if(_0x50ab9e){_0x552ec9=_0x50ab9e[0x1];}else{_0x552ec9=null;}}else{_0x552ec9=null;}_0x2801a2['cb'](null,{'code':_0x3c68b8,'result':_0xc11cd3,'extra':_0x552ec9});}});_0x27adcf['on'](_0x7aa3('0x19'),function(_0x4dcefa){_0x27333d[_0x7aa3('0x9')](_0x7aa3('0x19'),new AGIError(_0x7aa3('0x1a'),_0x4dcefa[_0x7aa3('0x1b')]));});_0x27adcf['on'](_0x7aa3('0x1c'),function(){_0x27333d['emit'](_0x7aa3('0x1c'),new AGIError(_0x7aa3('0x1d')));});_0x27adcf['on'](_0x7aa3('0x1e'),function(){_0x27333d[_0x7aa3('0x9')](_0x7aa3('0x1e'),new AGIError(_0x7aa3('0x1f')));_0x27adcf['destroy']();});_0x27adcf[_0x7aa3('0x20')](_0x11e64c);this[_0x7aa3('0x21')]=function(_0x35f0f8,_0x4177b9){var _0x35f0f8=_0x35f0f8||'',_0x4177b9=typeof _0x4177b9==_0x7aa3('0x22')?_0x4177b9:new Function();_0x2801a2={'tx':_0x35f0f8,'rx':'','cb':_0x4177b9};_0x27adcf[_0x7aa3('0x23')](_0x35f0f8+'\x0a');},this[_0x7aa3('0x1c')]=function(){_0x27adcf[_0x7aa3('0x24')]();};}util[_0x7aa3('0x25')](AGIChannel,EventEmitter);AGIChannel[_0x7aa3('0x26')][_0x7aa3('0x27')]=function(_0x40645e){return this[_0x7aa3('0x21')][_0x7aa3('0x28')](this,_0x40645e);};AGIChannel[_0x7aa3('0x26')][_0x7aa3('0x29')]=function(){return this[_0x7aa3('0x27')]('ANSWER');};AGIChannel[_0x7aa3('0x26')][_0x7aa3('0x2a')]=function(_0x3c1422,_0x32e551,_0x183ffc){_0x3c1422=_0x3c1422===undefined?_0x7aa3('0x2b'):_0x3c1422;_0x32e551=_0x32e551===undefined?'5':_0x32e551;_0x183ffc=_0x183ffc===undefined?'1':_0x183ffc;return this['sendRequest'](util[_0x7aa3('0x2c')](_0x7aa3('0x2d'),_0x3c1422,_0x32e551*0x3e8,_0x183ffc));};AGIChannel[_0x7aa3('0x26')]['noop']=function(_0x409194){_0x409194=_0x409194||_0x7aa3('0x2e');return this['sendRequest'](util[_0x7aa3('0x2c')](_0x7aa3('0x2f'),_0x409194));};AGIChannel[_0x7aa3('0x26')][_0x7aa3('0x30')]=function(_0x370e46,_0x24a38d){if(_[_0x7aa3('0x31')](_0x24a38d)){return this[_0x7aa3('0x27')](util[_0x7aa3('0x2c')](_0x7aa3('0x32'),_0x370e46,_0x24a38d[_0x7aa3('0x33')](',')));}return this[_0x7aa3('0x27')](util[_0x7aa3('0x2c')](_0x7aa3('0x32'),_0x370e46,_0x24a38d));};AGIChannel[_0x7aa3('0x26')][_0x7aa3('0x34')]=function(_0x2af928){return this[_0x7aa3('0x27')](util[_0x7aa3('0x2c')](_0x7aa3('0x35'),_0x2af928));};AGIChannel[_0x7aa3('0x26')]['setExtension']=function(_0x295b73){return this[_0x7aa3('0x27')](util[_0x7aa3('0x2c')](_0x7aa3('0x36'),_0x295b73));};AGIChannel[_0x7aa3('0x26')][_0x7aa3('0x37')]=function(_0x2e48d6){return this[_0x7aa3('0x27')](util[_0x7aa3('0x2c')](_0x7aa3('0x38'),_0x2e48d6));};AGIChannel[_0x7aa3('0x26')]['hangup']=function(){return this[_0x7aa3('0x27')](_0x7aa3('0x39'));};AGIChannel[_0x7aa3('0x26')][_0x7aa3('0x3a')]=function(_0x89d47,_0x1029eb){var _0x1c8d0e=_[_0x7aa3('0x3b')](_0x1029eb)||_[_0x7aa3('0x3c')](_0x1029eb)?_0x1029eb[_0x7aa3('0x3d')]():_0x1029eb;return this[_0x7aa3('0x27')](util[_0x7aa3('0x2c')](_0x7aa3('0x3e'),_0x89d47,_0x1c8d0e?_0x1c8d0e[_0x7aa3('0x3d')]()['replace'](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x7aa3('0x26')][_0x7aa3('0x3f')]=function(_0xbdc351,_0x46ddd7){return this['sendRequest'](util[_0x7aa3('0x2c')]('SAY\x20NUMBER\x20%s\x20%s',_0xbdc351,_0x46ddd7));};AGIChannel[_0x7aa3('0x26')][_0x7aa3('0x40')]=function(_0x63b4a9,_0x1177b4){return this[_0x7aa3('0x27')](util[_0x7aa3('0x2c')](_0x7aa3('0x41'),_0x63b4a9,_0x1177b4));};AGIChannel[_0x7aa3('0x26')][_0x7aa3('0x42')]=function(_0x32783c,_0x5ee53c){return this[_0x7aa3('0x27')](util[_0x7aa3('0x2c')](_0x7aa3('0x43'),_0x32783c,_0x5ee53c));};AGIChannel[_0x7aa3('0x26')][_0x7aa3('0x44')]=function(_0x143d77,_0x453735,_0x3f0fcf){_0x453735=_0x453735||this[_0x7aa3('0x45')];_0x3f0fcf=_0x3f0fcf||0x1;this[_0x7aa3('0x34')](_0x143d77);this[_0x7aa3('0x46')](_0x453735);this[_0x7aa3('0x37')](_0x3f0fcf);return this[_0x7aa3('0x47')](util[_0x7aa3('0x2c')]('GOTO\x20%s\x20%s\x20%s',_0x143d77,_0x453735,_0x3f0fcf));};AGIChannel[_0x7aa3('0x26')][_0x7aa3('0x48')]=function(_0x4999d5){return this[_0x7aa3('0x27')](util[_0x7aa3('0x2c')]('GET\x20VARIABLE\x20\x22%s\x22',_0x4999d5));};AGIChannel[_0x7aa3('0x26')][_0x7aa3('0x49')]=function(_0x24b42e,_0x20b2f6,_0x59830f,_0x4bd8ee,_0x2b19af,_0x50900c){_0x20b2f6=_0x20b2f6||_0x7aa3('0x4a');_0x59830f=_0x59830f||'';_0x4bd8ee=_0x4bd8ee===undefined?-0x1:_0x4bd8ee==='-1'?-0x1:_0x4bd8ee*0x3e8;_0x2b19af=_0x2b19af===undefined?'':'s='+_0x2b19af;_0x50900c=_0x50900c?'BEEP':'';return this['sendRequest'](util[_0x7aa3('0x2c')](_0x7aa3('0x4b'),_0x24b42e,_0x20b2f6,_0x59830f,_0x4bd8ee,_0x50900c,_0x2b19af));};AGIChannel[_0x7aa3('0x26')][_0x7aa3('0x4c')]=function(_0x384a75,_0x4e472d){_0x4e472d=_0x4e472d||'';return this[_0x7aa3('0x27')](util[_0x7aa3('0x2c')]('STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22',_0x384a75,_0x4e472d));};AGIChannel[_0x7aa3('0x26')][_0x7aa3('0x4d')]=function(_0x3cdcfe){return this['exec'](_0x7aa3('0x4e'),_0x3cdcfe);};AGIChannel[_0x7aa3('0x26')]['wait']=function(_0x2cc4aa){return this[_0x7aa3('0x30')]('WAIT',_0x2cc4aa);};AGIChannel['prototype'][_0x7aa3('0x19')]=function(_0x1a990,_0x41f9fe){this[_0x7aa3('0x47')](util['format']('ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s',_0x1a990['id'],_0x1a990[_0x7aa3('0x4f')],_0x41f9fe));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x7aa3('0x50')]=AGIChannel; \ No newline at end of file +var _0x0a01=['no\x20code','indexOf','substr','split','length','match','error','code','close','timeout','destroy','command','write','inherits','prototype','sendRequest','sync','answer','ANSWER','getData','beep','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','isArray','join','EXEC\x20%s\x20%s','setExtension','SET\x20EXTENSION\x20%s','setPriority','SET\x20PRIORITY\x20%s','HANGUP','setVariable','isNumber','SET\x20VARIABLE\x20%s\x20\x22%s\x22','toString','replace','SAY\x20NUMBER\x20%s\x20%s','SAY\x20DIGITS\x20%s\x20%s','continueAt','extension','setContext','GOTO\x20%s\x20%s\x20%s','getVariable','recordFile','wav','BEEP','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','agi','exec','AGI','wait','WAIT','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','exports','EventEmitter','call','setEncoding','utf8','headers','emit','line','toLowerCase','hangup','search','520\x20End\x20of\x20proper','function','substring'];(function(_0x3d407c,_0x8127b5){var _0x7d17dc=function(_0xe3f088){while(--_0xe3f088){_0x3d407c['push'](_0x3d407c['shift']());}};_0x7d17dc(++_0x8127b5);}(_0x0a01,0x10b));var _0x10a0=function(_0x434148,_0x3fd957){_0x434148=_0x434148-0x0;var _0x27fabb=_0x0a01[_0x434148];return _0x27fabb;};'use strict';var util=require('util');var _=require('lodash');var EventEmitter=require('events')[_0x10a0('0x0')];var AGIReply=require('./reply');var AGIError=require('./error');function AGIChannel(_0xbfcec3){var _0x4c9f4a=this,_0x32a034=new AGIReply(),_0x3fc5fa=![],_0x290eb9={};EventEmitter[_0x10a0('0x1')](_0x4c9f4a);_0xbfcec3[_0x10a0('0x2')](_0x10a0('0x3'));_0xbfcec3['setTimeout'](0x8*0x3c*0x3c*0x3e8);_0x32a034[_0x10a0('0x2')](_0x10a0('0x3'));_0x32a034['on'](_0x10a0('0x4'),function(_0xee5289){for(var _0x46fc47 in _0xee5289){_0x4c9f4a[_0x46fc47]=_0xee5289[_0x46fc47];}_0x4c9f4a[_0x10a0('0x5')]('ready');});_0x32a034['on'](_0x10a0('0x6'),function(_0x1b9311){if(_0x1b9311[_0x10a0('0x7')]()=='hangup'){_0x4c9f4a['emit'](_0x10a0('0x8'));return;}if(_0x1b9311['substring'](0x0,0xb)=='520-Invalid'){_0x3fc5fa=!![];}if(_0x3fc5fa){_0x290eb9['rx']+=_0x1b9311+'\x0a';if(_0x1b9311[_0x10a0('0x9')](_0x10a0('0xa'))!=-0x1){_0x3fc5fa=![];}}else{_0x290eb9['rx']=_0x1b9311;}if(_0x3fc5fa){return;}if(typeof _0x290eb9['cb']==_0x10a0('0xb')){var _0x357800=_0x290eb9['rx'][_0x10a0('0xc')](0x0,0x3),_0x59eb39=null,_0x4fba55=null;_0x357800=parseInt(_0x357800);if(isNaN(_0x357800)){_0x290eb9['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x10a0('0xd')});return;}if(_0x357800!=0xc8){_0x290eb9['cb'](null,{'code':_0x357800,'result':-0x1,'extra':'KO'});return;}_0x59eb39=_0x290eb9['rx'][_0x10a0('0xc')](0x4)['replace']('result=','');if(_0x59eb39[_0x10a0('0xe')]('\x20')!=-0x1){_0x59eb39=_0x59eb39[_0x10a0('0xf')](0x0,_0x59eb39[_0x10a0('0xe')]('\x20'));}if(_['startsWith'](_0x59eb39,'-1')){_0x59eb39=parseInt(_0x59eb39);}_0x4fba55=_0x290eb9['rx'][_0x10a0('0x10')]('\x20');if(_0x4fba55[_0x10a0('0x11')]==0x3){_0x4fba55=_0x4fba55[0x2]['substring'](0x1,_0x4fba55[0x2]['length']-0x1);}else if(_0x4fba55[_0x10a0('0x11')]>0x3){var _0x100d77=/\((.+)\)/;var _0x464cb3=_0x290eb9['rx'][_0x10a0('0x12')](_0x100d77);if(_0x464cb3){_0x4fba55=_0x464cb3[0x1];}else{_0x4fba55=null;}}else{_0x4fba55=null;}_0x290eb9['cb'](null,{'code':_0x357800,'result':_0x59eb39,'extra':_0x4fba55});}});_0xbfcec3['on'](_0x10a0('0x13'),function(_0xe57eae){_0x4c9f4a[_0x10a0('0x5')]('error',new AGIError('E_AGI_SOCKET_ERROR',_0xe57eae[_0x10a0('0x14')]));});_0xbfcec3['on'](_0x10a0('0x15'),function(){_0x4c9f4a[_0x10a0('0x5')](_0x10a0('0x15'),new AGIError('E_AGI_SOCKET_CLOSE'));});_0xbfcec3['on']('timeout',function(){_0x4c9f4a[_0x10a0('0x5')](_0x10a0('0x16'),new AGIError('E_AGI_SOCKET_TIMEOUT'));_0xbfcec3[_0x10a0('0x17')]();});_0xbfcec3['pipe'](_0x32a034);this[_0x10a0('0x18')]=function(_0x1a31ca,_0x108486){var _0x1a31ca=_0x1a31ca||'',_0x108486=typeof _0x108486==_0x10a0('0xb')?_0x108486:new Function();_0x290eb9={'tx':_0x1a31ca,'rx':'','cb':_0x108486};_0xbfcec3[_0x10a0('0x19')](_0x1a31ca+'\x0a');},this[_0x10a0('0x15')]=function(){_0xbfcec3[_0x10a0('0x17')]();};}util[_0x10a0('0x1a')](AGIChannel,EventEmitter);AGIChannel[_0x10a0('0x1b')][_0x10a0('0x1c')]=function(_0x36a7b9){return this[_0x10a0('0x18')][_0x10a0('0x1d')](this,_0x36a7b9);};AGIChannel[_0x10a0('0x1b')][_0x10a0('0x1e')]=function(){return this['sendRequest'](_0x10a0('0x1f'));};AGIChannel['prototype'][_0x10a0('0x20')]=function(_0x50f56f,_0x1eda45,_0x41ffde){_0x50f56f=_0x50f56f===undefined?_0x10a0('0x21'):_0x50f56f;_0x1eda45=_0x1eda45===undefined?'5':_0x1eda45;_0x41ffde=_0x41ffde===undefined?'1':_0x41ffde;return this[_0x10a0('0x1c')](util[_0x10a0('0x22')](_0x10a0('0x23'),_0x50f56f,_0x1eda45*0x3e8,_0x41ffde));};AGIChannel['prototype'][_0x10a0('0x24')]=function(_0x5c1ec7){_0x5c1ec7=_0x5c1ec7||'NO\x20MESSAGE';return this[_0x10a0('0x1c')](util[_0x10a0('0x22')]('VERBOSE\x20\x22%s\x22',_0x5c1ec7));};AGIChannel[_0x10a0('0x1b')]['exec']=function(_0x926a0e,_0x1bc73f){if(_[_0x10a0('0x25')](_0x1bc73f)){return this[_0x10a0('0x1c')](util[_0x10a0('0x22')]('EXEC\x20%s\x20%s',_0x926a0e,_0x1bc73f[_0x10a0('0x26')](',')));}return this[_0x10a0('0x1c')](util[_0x10a0('0x22')](_0x10a0('0x27'),_0x926a0e,_0x1bc73f));};AGIChannel['prototype']['setContext']=function(_0x8d6bc4){return this['sendRequest'](util[_0x10a0('0x22')]('SET\x20CONTEXT\x20%s',_0x8d6bc4));};AGIChannel[_0x10a0('0x1b')][_0x10a0('0x28')]=function(_0x88275a){return this['sendRequest'](util[_0x10a0('0x22')](_0x10a0('0x29'),_0x88275a));};AGIChannel[_0x10a0('0x1b')][_0x10a0('0x2a')]=function(_0x2cf451){return this['sendRequest'](util[_0x10a0('0x22')](_0x10a0('0x2b'),_0x2cf451));};AGIChannel[_0x10a0('0x1b')][_0x10a0('0x8')]=function(){return this[_0x10a0('0x1c')](_0x10a0('0x2c'));};AGIChannel['prototype'][_0x10a0('0x2d')]=function(_0x2445ab,_0x64e896){var _0x5a097d=_['isBoolean'](_0x64e896)||_[_0x10a0('0x2e')](_0x64e896)?_0x64e896['toString']():_0x64e896;return this[_0x10a0('0x1c')](util['format'](_0x10a0('0x2f'),_0x2445ab,_0x5a097d?_0x5a097d[_0x10a0('0x30')]()[_0x10a0('0x31')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel['prototype']['sayNumber']=function(_0x3e3fc4,_0x359cce){return this['sendRequest'](util['format'](_0x10a0('0x32'),_0x3e3fc4,_0x359cce));};AGIChannel['prototype']['sayDigits']=function(_0x3c01c7,_0x3f7abb){return this['sendRequest'](util[_0x10a0('0x22')](_0x10a0('0x33'),_0x3c01c7,_0x3f7abb));};AGIChannel[_0x10a0('0x1b')]['sayPhonetic']=function(_0x59fe00,_0x5643c0){return this[_0x10a0('0x1c')](util[_0x10a0('0x22')]('SAY\x20PHONETIC\x20\x22%s\x22\x20%s',_0x59fe00,_0x5643c0));};AGIChannel[_0x10a0('0x1b')][_0x10a0('0x34')]=function(_0x510415,_0x2ee76f,_0x1f10b4){_0x2ee76f=_0x2ee76f||this[_0x10a0('0x35')];_0x1f10b4=_0x1f10b4||0x1;this[_0x10a0('0x36')](_0x510415);this['setExtension'](_0x2ee76f);this[_0x10a0('0x2a')](_0x1f10b4);return this[_0x10a0('0x24')](util[_0x10a0('0x22')](_0x10a0('0x37'),_0x510415,_0x2ee76f,_0x1f10b4));};AGIChannel[_0x10a0('0x1b')][_0x10a0('0x38')]=function(_0x7d2d9f){return this['sendRequest'](util['format']('GET\x20VARIABLE\x20\x22%s\x22',_0x7d2d9f));};AGIChannel[_0x10a0('0x1b')][_0x10a0('0x39')]=function(_0x4ee653,_0x3c6bde,_0x3b0471,_0x3a5540,_0x4a6ea9,_0x3a94eb){_0x3c6bde=_0x3c6bde||_0x10a0('0x3a');_0x3b0471=_0x3b0471||'';_0x3a5540=_0x3a5540===undefined?-0x1:_0x3a5540==='-1'?-0x1:_0x3a5540*0x3e8;_0x4a6ea9=_0x4a6ea9===undefined?'':'s='+_0x4a6ea9;_0x3a94eb=_0x3a94eb?_0x10a0('0x3b'):'';return this[_0x10a0('0x1c')](util['format'](_0x10a0('0x3c'),_0x4ee653,_0x3c6bde,_0x3b0471,_0x3a5540,_0x3a94eb,_0x4a6ea9));};AGIChannel['prototype']['streamFile']=function(_0x518355,_0x909de3){_0x909de3=_0x909de3||'';return this['sendRequest'](util['format'](_0x10a0('0x3d'),_0x518355,_0x909de3));};AGIChannel['prototype'][_0x10a0('0x3e')]=function(_0x5a92a7){return this[_0x10a0('0x3f')](_0x10a0('0x40'),_0x5a92a7);};AGIChannel[_0x10a0('0x1b')][_0x10a0('0x41')]=function(_0x7a7eda){return this['exec'](_0x10a0('0x42'),_0x7a7eda);};AGIChannel[_0x10a0('0x1b')]['error']=function(_0x923863,_0x579fdd){this[_0x10a0('0x24')](util[_0x10a0('0x22')](_0x10a0('0x43'),_0x923863['id'],_0x923863[_0x10a0('0x44')],_0x579fdd));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x10a0('0x45')]=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index 0ddaaf0..9f94d14 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 _0x6145=['Server\x20closed.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20closed.','Socket\x20timeout.','Empty\x20command.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','push','format','name','util','Undefined\x20error.','Server\x20error.\x20Code:\x20%s.'];(function(_0x3897f6,_0x4ebde7){var _0x5b8072=function(_0x16bbaf){while(--_0x16bbaf){_0x3897f6['push'](_0x3897f6['shift']());}};_0x5b8072(++_0x4ebde7);}(_0x6145,0x131));var _0x5614=function(_0x28c7ac,_0x22173d){_0x28c7ac=_0x28c7ac-0x0;var _0x47fcfa=_0x6145[_0x28c7ac];return _0x47fcfa;};'use strict';var util=require(_0x5614('0x0'));var error={'E_AGI_UNDEFINED':_0x5614('0x1'),'E_AGI_ARGUMENT_PORT':'Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','E_AGI_SERVER_ERROR':_0x5614('0x2'),'E_AGI_SERVER_CLOSE':_0x5614('0x3'),'E_AGI_SERVER_MAXCONNECTION':_0x5614('0x4'),'E_AGI_SERVER_VOICE_DISABLED':_0x5614('0x5'),'E_AGI_SOCKET_ERROR':'Socket\x20error.\x20Code:\x20%s.','E_AGI_SOCKET_CLOSE':_0x5614('0x6'),'E_AGI_SOCKET_TIMEOUT':_0x5614('0x7'),'E_AGI_COMMAND_EMPTY':_0x5614('0x8'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':'Missing\x20\x27ivr.agi_network_script\x27.','E_AGI_IVR_ENTRY':_0x5614('0x9')};function AGIError(_0x2051ca){var _0x2051ca=_0x2051ca||null,_0x5ed0ab=_0x5ed0ab||[],_0x48e7c4=0x1,_0x5e0e06='';if(!error[_0x2051ca]){_0x2051ca=_0x5614('0xa');}_0x5ed0ab[_0x5614('0xb')](error[_0x2051ca]);while(arguments[_0x48e7c4]){_0x5ed0ab[_0x5614('0xb')](arguments[_0x48e7c4]);_0x48e7c4++;}_0x5e0e06=util[_0x5614('0xc')]['apply'](util,_0x5ed0ab);this['message']=_0x5e0e06;this[_0x5614('0xd')]=_0x2051ca;}module['exports']=AGIError; \ No newline at end of file +var _0xdb2d=['util','Undefined\x20error.','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.','Server\x20closed.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20closed.','Socket\x20timeout.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','push','apply','message','exports'];(function(_0x4931d4,_0x21cce4){var _0x2313c5=function(_0x1ba1f7){while(--_0x1ba1f7){_0x4931d4['push'](_0x4931d4['shift']());}};_0x2313c5(++_0x21cce4);}(_0xdb2d,0xb0));var _0xddb2=function(_0x3da616,_0xfb8402){_0x3da616=_0x3da616-0x0;var _0x1e290c=_0xdb2d[_0x3da616];return _0x1e290c;};'use strict';var util=require(_0xddb2('0x0'));var error={'E_AGI_UNDEFINED':_0xddb2('0x1'),'E_AGI_ARGUMENT_PORT':_0xddb2('0x2'),'E_AGI_SERVER_ERROR':_0xddb2('0x3'),'E_AGI_SERVER_CLOSE':_0xddb2('0x4'),'E_AGI_SERVER_MAXCONNECTION':_0xddb2('0x5'),'E_AGI_SERVER_VOICE_DISABLED':_0xddb2('0x6'),'E_AGI_SOCKET_ERROR':'Socket\x20error.\x20Code:\x20%s.','E_AGI_SOCKET_CLOSE':_0xddb2('0x7'),'E_AGI_SOCKET_TIMEOUT':_0xddb2('0x8'),'E_AGI_COMMAND_EMPTY':'Empty\x20command.','E_AGI_IVR_AGI_NETWORK_SCRIPT':_0xddb2('0x9'),'E_AGI_IVR_ENTRY':_0xddb2('0xa')};function AGIError(_0x5b35a7){var _0x5b35a7=_0x5b35a7||null,_0x418fff=_0x418fff||[],_0x26c36a=0x1,_0x1c5225='';if(!error[_0x5b35a7]){_0x5b35a7=_0xddb2('0xb');}_0x418fff[_0xddb2('0xc')](error[_0x5b35a7]);while(arguments[_0x26c36a]){_0x418fff[_0xddb2('0xc')](arguments[_0x26c36a]);_0x26c36a++;}_0x1c5225=util['format'][_0xddb2('0xd')](util,_0x418fff);this[_0xddb2('0xe')]=_0x1c5225;this['name']=_0x5b35a7;}module[_0xddb2('0xf')]=AGIError; \ No newline at end of file diff --git a/server/services/agi/events.js b/server/services/agi/events.js index 53fa293..f5dda71 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 _0x3e38=['../../config/environment','defaults','redis','localhost','subscribe','agi','E_AGI_SERVER_ERROR','message','emit','exports','EventEmitter'];(function(_0x5b1abf,_0x54a986){var _0x2a20da=function(_0x3b6c97){while(--_0x3b6c97){_0x5b1abf['push'](_0x5b1abf['shift']());}};_0x2a20da(++_0x54a986);}(_0x3e38,0x1c2));var _0x83e3=function(_0x545282,_0x32ac19){_0x545282=_0x545282-0x0;var _0xc46381=_0x3e38[_0x545282];return _0xc46381;};'use strict';var _=require('lodash');var EventEmitter=require('events')[_0x83e3('0x0')];var Redis=require('ioredis');var AGIError=require('./error');var config=require(_0x83e3('0x1'));config['redis']=_[_0x83e3('0x2')](config[_0x83e3('0x3')],{'host':_0x83e3('0x4'),'port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config[_0x83e3('0x3')]);sub[_0x83e3('0x5')](_0x83e3('0x6'),function(_0x50df7d){if(_0x50df7d)return eventEmitter['emit']('error',new AGIError(_0x83e3('0x7'),_0x50df7d));});sub['on'](_0x83e3('0x8'),function(_0x5a6448,_0x12c2e8){if(_0x5a6448!==_0x83e3('0x6'))return;try{var _0x5db2c0=JSON['parse'](_0x12c2e8);eventEmitter[_0x83e3('0x9')]('projectUpdate',_0x5db2c0);}catch(_0x412803){eventEmitter[_0x83e3('0x9')]('error',new AGIError('E_AGI_SERVER_ERROR',_0x412803));}});module[_0x83e3('0xa')]={'EventEmitter':eventEmitter}; \ No newline at end of file +var _0xc2a6=['subscribe','agi','emit','error','message','parse','projectUpdate','E_AGI_SERVER_ERROR','exports','events','EventEmitter','ioredis','./error','../../config/environment','redis','localhost'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc2a6,0xe9));var _0x6c2a=function(_0x33fcae,_0x44f874){_0x33fcae=_0x33fcae-0x0;var _0x491ad3=_0xc2a6[_0x33fcae];return _0x491ad3;};'use strict';var _=require('lodash');var EventEmitter=require(_0x6c2a('0x0'))[_0x6c2a('0x1')];var Redis=require(_0x6c2a('0x2'));var AGIError=require(_0x6c2a('0x3'));var config=require(_0x6c2a('0x4'));config[_0x6c2a('0x5')]=_['defaults'](config['redis'],{'host':_0x6c2a('0x6'),'port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config[_0x6c2a('0x5')]);sub[_0x6c2a('0x7')](_0x6c2a('0x8'),function(_0x29b269){if(_0x29b269)return eventEmitter[_0x6c2a('0x9')](_0x6c2a('0xa'),new AGIError('E_AGI_SERVER_ERROR',_0x29b269));});sub['on'](_0x6c2a('0xb'),function(_0x117833,_0x5ee7cc){if(_0x117833!=='agi')return;try{var _0x3b6644=JSON[_0x6c2a('0xc')](_0x5ee7cc);eventEmitter[_0x6c2a('0x9')](_0x6c2a('0xd'),_0x3b6644);}catch(_0x3c9ba9){eventEmitter[_0x6c2a('0x9')]('error',new AGIError(_0x6c2a('0xe'),_0x3c9ba9));}});module[_0x6c2a('0xf')]={'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 e1b5e73..217eda7 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 _0x1eec=['stop\x20traverse','length','condition','split','vswitch','target','default','agicommand','default\x20on\x20switch\x20not\x20found','includes','max\x20retry\x20reach','condition\x20not\x20found','exports','lodash','../../../config/logger','agi','menu','getdigits','vertices','prototype','addVertex','edges','addEdge','size','relations','numberOfEdges','getVertex','traverseBFS','info','no\x20vertex\x20found'];(function(_0x32f46a,_0x5f2029){var _0x5652ec=function(_0x533807){while(--_0x533807){_0x32f46a['push'](_0x32f46a['shift']());}};_0x5652ec(++_0x5f2029);}(_0x1eec,0x139));var _0xc1ee=function(_0x88cd7b,_0x4c884c){_0x88cd7b=_0x88cd7b-0x0;var _0x56fcc8=_0x1eec[_0x88cd7b];return _0x56fcc8;};'use strict';var _=require(_0xc1ee('0x0'));var logger=require(_0xc1ee('0x1'))(_0xc1ee('0x2'));var verticesWithRetry=[_0xc1ee('0x3'),_0xc1ee('0x4'),'getsecretdigits'];var Graph=function(){this[_0xc1ee('0x5')]={};this['edges']={};this['numberOfEdges']=0x0;};Graph[_0xc1ee('0x6')][_0xc1ee('0x7')]=function(_0x4ce1e8){this[_0xc1ee('0x5')][_0x4ce1e8['id']]=_0x4ce1e8;this[_0xc1ee('0x8')][_0x4ce1e8['id']]=[];};Graph[_0xc1ee('0x6')][_0xc1ee('0x9')]=function(_0x3dd4b1,_0x22ddbe,_0x120f38){this[_0xc1ee('0x8')][_0x3dd4b1]['push']({'target':_0x22ddbe,'condition':_0x120f38});this['numberOfEdges']+=0x1;};Graph['prototype'][_0xc1ee('0xa')]=function(){return _[_0xc1ee('0xa')](this[_0xc1ee('0x5')]);};Graph[_0xc1ee('0x6')][_0xc1ee('0xb')]=function(){return this[_0xc1ee('0xc')];};Graph[_0xc1ee('0x6')][_0xc1ee('0xd')]=function(_0x3a28c6){return this[_0xc1ee('0x5')][_0x3a28c6];};Graph['prototype'][_0xc1ee('0xe')]=function(_0x104899,_0x3c7e5a){if(!this['vertices'][_0x104899]){return logger[_0xc1ee('0xf')](_0xc1ee('0x10'));}var _0x2a72da=_0x3c7e5a(this[_0xc1ee('0x5')][_0x104899]);if(!_0x2a72da){return logger[_0xc1ee('0xf')](_0xc1ee('0x11'));}if(this[_0xc1ee('0x8')][_0x104899][_0xc1ee('0x12')]===0x0){return logger[_0xc1ee('0xf')]('no\x20edge/s\x20available');}for(var _0x37f084=0x0,_0x2733f3=[],_0x49ab06=![];_0x37f084\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','dnid','uniqueid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','calleridname','callerid','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','evtHangup','createSquareReport','then','catch','indexOf','agi_','stringify','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','timeout','hangup','find','handleNotFound','initialize','voice','callysquare','[LICENSE]\x20VOICE\x20IS\x20DISABLED','getAll','finally','./server','listening','connection','close','lodash','syncho','util','../../config/logger','agi','./rpc','EventEmitter','defaults','127.0.0.1','nextTick','error','stack','findIndex'];(function(_0xe9e158,_0x502c2e){var _0x2d0591=function(_0x4b0ed1){while(--_0x4b0ed1){_0xe9e158['push'](_0xe9e158['shift']());}};_0x2d0591(++_0x502c2e);}(_0xb132,0x1eb));var _0x2b13=function(_0xed5f9c,_0x5a25cd){_0xed5f9c=_0xed5f9c-0x0;var _0x3a1c43=_0xb132[_0xed5f9c];return _0x3a1c43;};'use strict';var _=require(_0x2b13('0x0'));var syncho=require(_0x2b13('0x1'));var util=require(_0x2b13('0x2'));var config=require('../../config/environment');var logger=require(_0x2b13('0x3'))(_0x2b13('0x4'));var utilLicense=require('../../config/license/util');var rpc=require(_0x2b13('0x5'));var Project=require('./project');var AGIEmitter=require('./events')[_0x2b13('0x6')];var projects=[];config['agi']=_[_0x2b13('0x7')](config[_0x2b13('0x4')],{'ip':_0x2b13('0x8'),'port':0x11dd});AGIEmitter['on']('projectUpdate',projectUpdateHandler);function connectionHandler(_0x47a79c){process[_0x2b13('0x9')](function(){syncho(function(){try{setChannelVariables(_0x47a79c);agiHandler(_0x47a79c);}catch(_0x5a12bc){logger[_0x2b13('0xa')](_0x5a12bc[_0x2b13('0xb')]);}});});}function projectUpdateHandler(_0x23010e){try{var _0x2abd23=_[_0x2b13('0xc')](projects,['id',_0x23010e['id']]);if(_0x2abd23>-0x1){if(_0x23010e[_0x2b13('0xd')]===!![]){projects[_0x2b13('0xe')](_0x2abd23,0x1);}else{projects[_0x2abd23]=_0x23010e;}}else{projects[_0x2b13('0xf')](_0x23010e);}}catch(_0x1f7c7e){logger[_0x2b13('0xa')](_0x1f7c7e['stack']);}}function listeningHandler(){console[_0x2b13('0x10')](_0x2b13('0x11'),config[_0x2b13('0x4')][_0x2b13('0x12')]);logger[_0x2b13('0x13')](util[_0x2b13('0x14')](_0x2b13('0x15'),config[_0x2b13('0x4')]['ip'],config['agi'][_0x2b13('0x12')]));}function errorHandler(_0x309a86){if(_0x309a86&&_0x309a86[_0x2b13('0x16')]&&_0x309a86[_0x2b13('0x17')]){logger[_0x2b13('0xa')](util[_0x2b13('0x14')](_0x2b13('0x18'),_0x309a86['name'],_0x309a86[_0x2b13('0x17')]));}else{logger[_0x2b13('0xa')](util[_0x2b13('0x14')](_0x2b13('0x19'),_0x309a86[_0x2b13('0xb')]));}}function closeHandler(){logger[_0x2b13('0x13')](util[_0x2b13('0x14')](_0x2b13('0x1a'),this[_0x2b13('0x1b')],this['calleridname'],this['callerid'],this[_0x2b13('0x1c')],this[_0x2b13('0x1d')]));try{createSquareReport(this);}catch(_0x209e29){logger[_0x2b13('0xa')](_0x209e29[_0x2b13('0xb')]);}}function timeoutHandler(){logger['info'](util[_0x2b13('0x14')](_0x2b13('0x1e'),this['arg_1'],this[_0x2b13('0x1f')],this[_0x2b13('0x20')],this['dnid'],this[_0x2b13('0x1d')]));}function hangupHandler(){logger[_0x2b13('0x13')](util[_0x2b13('0x14')](_0x2b13('0x21'),this[_0x2b13('0x1b')],this[_0x2b13('0x1f')],this[_0x2b13('0x20')],this[_0x2b13('0x1c')],this[_0x2b13('0x1d')]));this[_0x2b13('0x22')]=!![];}function createSquareReport(_0x9d3347,_0x5e2ec5){rpc[_0x2b13('0x23')](_0x9d3347)[_0x2b13('0x24')](function(_0x17a5f0){if(_0x5e2ec5){_0x5e2ec5(null,_0x17a5f0);}})[_0x2b13('0x25')](function(_0x226b52){if(_0x5e2ec5){_0x5e2ec5(null,_0x226b52);}});}function setChannelVariables(_0x298eb7){for(var _0x142552 in _0x298eb7){if(_0x298eb7['hasOwnProperty'](_0x142552)){if(_0x142552[_0x2b13('0x26')](_0x2b13('0x27'))===0x0){_0x298eb7[_0x142552['substring'](0x4)]=_0x298eb7[_0x142552];delete _0x298eb7[_0x142552];}}}}function agiHandler(_0x27f763){logger['debug']('variables',JSON[_0x2b13('0x28')](_0x27f763,null,0x2));logger['info'](util['format'](_0x2b13('0x29'),_0x27f763[_0x2b13('0x1b')],_0x27f763['calleridname'],_0x27f763[_0x2b13('0x20')],_0x27f763[_0x2b13('0x1c')],_0x27f763['uniqueid']));_0x27f763['on'](_0x2b13('0xa'),errorHandler);_0x27f763['on']('close',closeHandler);_0x27f763['on'](_0x2b13('0x2a'),timeoutHandler);_0x27f763[_0x2b13('0x22')]=![];_0x27f763['on'](_0x2b13('0x2b'),hangupHandler);var _0x3c0bd6=_[_0x2b13('0x2c')](projects,['name',_0x27f763['arg_1']]);if(!_0x3c0bd6)return Project[_0x2b13('0x2d')](_0x27f763);if(!_0x3c0bd6['production'])return Project['handleUnpublished'](_0x27f763);return Project[_0x2b13('0x2e')](_0x3c0bd6,_0x27f763);}function main(){var _0x4b4932;return utilLicense['getLicense']()[_0x2b13('0x24')](function(_0x3fd2ab){if(!_0x3fd2ab)return;if(_0x3fd2ab[_0x2b13('0x2f')]){if(_0x3fd2ab['callysquare']&&_0x3fd2ab[_0x2b13('0x30')]>0x0){logger[_0x2b13('0x13')](util[_0x2b13('0x14')]('[LICENSE]\x20CHANNELS:\x20%s',_0x3fd2ab[_0x2b13('0x30')]));_0x4b4932=_0x3fd2ab[_0x2b13('0x30')];}else{logger['info']('[LICENSE]\x20CHANNELS:\x20UNLIMITED');}}else{logger[_0x2b13('0x13')](_0x2b13('0x31'));_0x4b4932=-0x1;}})[_0x2b13('0x24')](function(){return Project[_0x2b13('0x32')]();})['then'](function(_0x37f1e0){projects=_0x37f1e0;return;})[_0x2b13('0x25')](function(_0x5ad37a){logger[_0x2b13('0xa')]('[LICENSE]',_0x5ad37a[_0x2b13('0xb')]);})[_0x2b13('0x33')](function(){var _0x38aea2=require(_0x2b13('0x34'))(config[_0x2b13('0x4')]['port'],config[_0x2b13('0x4')]['ip'],_0x4b4932);_0x38aea2['on'](_0x2b13('0xa'),errorHandler);_0x38aea2['on'](_0x2b13('0x35'),listeningHandler);_0x38aea2['on'](_0x2b13('0x36'),connectionHandler);_0x38aea2['on'](_0x2b13('0x37'),closeHandler);});}main(); \ No newline at end of file +var _0xc9b9=['callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','finally','./server','listening','connection','lodash','util','agi','../../config/license/util','./rpc','./project','./events','EventEmitter','defaults','127.0.0.1','projectUpdate','nextTick','stack','push','error','log','port','info','format','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','name','message','[%s]\x20%s','[ERROR]\x20%s','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','callerid','dnid','[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','uniqueid','evtHangup','then','catch','hasOwnProperty','agi_','substring','debug','stringify','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','calleridname','close','find','handleNotFound','production','handleUnpublished','getLicense'];(function(_0x17ec16,_0x2436e3){var _0x1f59f5=function(_0x165b75){while(--_0x165b75){_0x17ec16['push'](_0x17ec16['shift']());}};_0x1f59f5(++_0x2436e3);}(_0xc9b9,0x152));var _0x9c9b=function(_0x4d45c1,_0x2beda1){_0x4d45c1=_0x4d45c1-0x0;var _0x244478=_0xc9b9[_0x4d45c1];return _0x244478;};'use strict';var _=require(_0x9c9b('0x0'));var syncho=require('syncho');var util=require(_0x9c9b('0x1'));var config=require('../../config/environment');var logger=require('../../config/logger')(_0x9c9b('0x2'));var utilLicense=require(_0x9c9b('0x3'));var rpc=require(_0x9c9b('0x4'));var Project=require(_0x9c9b('0x5'));var AGIEmitter=require(_0x9c9b('0x6'))[_0x9c9b('0x7')];var projects=[];config[_0x9c9b('0x2')]=_[_0x9c9b('0x8')](config['agi'],{'ip':_0x9c9b('0x9'),'port':0x11dd});AGIEmitter['on'](_0x9c9b('0xa'),projectUpdateHandler);function connectionHandler(_0x220688){process[_0x9c9b('0xb')](function(){syncho(function(){try{setChannelVariables(_0x220688);agiHandler(_0x220688);}catch(_0x13bdd4){logger['error'](_0x13bdd4[_0x9c9b('0xc')]);}});});}function projectUpdateHandler(_0x77f260){try{var _0x1dbb80=_['findIndex'](projects,['id',_0x77f260['id']]);if(_0x1dbb80>-0x1){if(_0x77f260['deleted']===!![]){projects['splice'](_0x1dbb80,0x1);}else{projects[_0x1dbb80]=_0x77f260;}}else{projects[_0x9c9b('0xd')](_0x77f260);}}catch(_0x4b48a2){logger[_0x9c9b('0xe')](_0x4b48a2[_0x9c9b('0xc')]);}}function listeningHandler(){console[_0x9c9b('0xf')]('Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!',config[_0x9c9b('0x2')][_0x9c9b('0x10')]);logger[_0x9c9b('0x11')](util[_0x9c9b('0x12')](_0x9c9b('0x13'),config[_0x9c9b('0x2')]['ip'],config[_0x9c9b('0x2')][_0x9c9b('0x10')]));}function errorHandler(_0x41cedf){if(_0x41cedf&&_0x41cedf[_0x9c9b('0x14')]&&_0x41cedf[_0x9c9b('0x15')]){logger[_0x9c9b('0xe')](util[_0x9c9b('0x12')](_0x9c9b('0x16'),_0x41cedf[_0x9c9b('0x14')],_0x41cedf[_0x9c9b('0x15')]));}else{logger['error'](util['format'](_0x9c9b('0x17'),_0x41cedf[_0x9c9b('0xc')]));}}function closeHandler(){logger[_0x9c9b('0x11')](util[_0x9c9b('0x12')](_0x9c9b('0x18'),this[_0x9c9b('0x19')],this['calleridname'],this[_0x9c9b('0x1a')],this[_0x9c9b('0x1b')],this['uniqueid']));try{createSquareReport(this);}catch(_0x242464){logger['error'](_0x242464[_0x9c9b('0xc')]);}}function timeoutHandler(){logger[_0x9c9b('0x11')](util[_0x9c9b('0x12')](_0x9c9b('0x1c'),this[_0x9c9b('0x19')],this['calleridname'],this[_0x9c9b('0x1a')],this[_0x9c9b('0x1b')],this['uniqueid']));}function hangupHandler(){logger[_0x9c9b('0x11')](util[_0x9c9b('0x12')](_0x9c9b('0x1d'),this[_0x9c9b('0x19')],this['calleridname'],this[_0x9c9b('0x1a')],this[_0x9c9b('0x1b')],this[_0x9c9b('0x1e')]));this[_0x9c9b('0x1f')]=!![];}function createSquareReport(_0x4ae83d,_0x2c2963){rpc['createSquareReport'](_0x4ae83d)[_0x9c9b('0x20')](function(_0x1b1e8c){if(_0x2c2963){_0x2c2963(null,_0x1b1e8c);}})[_0x9c9b('0x21')](function(_0xcb2dba){if(_0x2c2963){_0x2c2963(null,_0xcb2dba);}});}function setChannelVariables(_0x5ad588){for(var _0x6ea8b2 in _0x5ad588){if(_0x5ad588[_0x9c9b('0x22')](_0x6ea8b2)){if(_0x6ea8b2['indexOf'](_0x9c9b('0x23'))===0x0){_0x5ad588[_0x6ea8b2[_0x9c9b('0x24')](0x4)]=_0x5ad588[_0x6ea8b2];delete _0x5ad588[_0x6ea8b2];}}}}function agiHandler(_0x5428cf){logger[_0x9c9b('0x25')]('variables',JSON[_0x9c9b('0x26')](_0x5428cf,null,0x2));logger[_0x9c9b('0x11')](util[_0x9c9b('0x12')](_0x9c9b('0x27'),_0x5428cf[_0x9c9b('0x19')],_0x5428cf[_0x9c9b('0x28')],_0x5428cf[_0x9c9b('0x1a')],_0x5428cf['dnid'],_0x5428cf[_0x9c9b('0x1e')]));_0x5428cf['on'](_0x9c9b('0xe'),errorHandler);_0x5428cf['on'](_0x9c9b('0x29'),closeHandler);_0x5428cf['on']('timeout',timeoutHandler);_0x5428cf[_0x9c9b('0x1f')]=![];_0x5428cf['on']('hangup',hangupHandler);var _0x3b4944=_[_0x9c9b('0x2a')](projects,[_0x9c9b('0x14'),_0x5428cf[_0x9c9b('0x19')]]);if(!_0x3b4944)return Project[_0x9c9b('0x2b')](_0x5428cf);if(!_0x3b4944[_0x9c9b('0x2c')])return Project[_0x9c9b('0x2d')](_0x5428cf);return Project['initialize'](_0x3b4944,_0x5428cf);}function main(){var _0x523e7b;return utilLicense[_0x9c9b('0x2e')]()[_0x9c9b('0x20')](function(_0x792e05){if(!_0x792e05)return;if(_0x792e05['voice']){if(_0x792e05[_0x9c9b('0x2f')]&&_0x792e05[_0x9c9b('0x2f')]>0x0){logger[_0x9c9b('0x11')](util[_0x9c9b('0x12')](_0x9c9b('0x30'),_0x792e05[_0x9c9b('0x2f')]));_0x523e7b=_0x792e05[_0x9c9b('0x2f')];}else{logger['info'](_0x9c9b('0x31'));}}else{logger[_0x9c9b('0x11')](_0x9c9b('0x32'));_0x523e7b=-0x1;}})['then'](function(){return Project['getAll']();})[_0x9c9b('0x20')](function(_0xb33edb){projects=_0xb33edb;return;})['catch'](function(_0x18fe45){logger[_0x9c9b('0xe')]('[LICENSE]',_0x18fe45['stack']);})[_0x9c9b('0x33')](function(){var _0x38a392=require(_0x9c9b('0x34'))(config[_0x9c9b('0x2')][_0x9c9b('0x10')],config[_0x9c9b('0x2')]['ip'],_0x523e7b);_0x38a392['on'](_0x9c9b('0xe'),errorHandler);_0x38a392['on'](_0x9c9b('0x35'),listeningHandler);_0x38a392['on'](_0x9c9b('0x36'),connectionHandler);_0x38a392['on'](_0x9c9b('0x29'),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 acf662f..73e3cf0 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 _0x3824=['then','error','message','catch','SendMail','bluebird','jayson/promise','client','http'];(function(_0x45367f,_0x2525a0){var _0x778927=function(_0x27e586){while(--_0x27e586){_0x45367f['push'](_0x45367f['shift']());}};_0x778927(++_0x2525a0);}(_0x3824,0xd4));var _0x4382=function(_0x3186aa,_0x34c21e){_0x3186aa=_0x3186aa-0x0;var _0x2d8c36=_0x3824[_0x3186aa];return _0x2d8c36;};'use strict';var BPromise=require(_0x4382('0x0'));var jayson=require(_0x4382('0x1'));var client=jayson[_0x4382('0x2')][_0x4382('0x3')]({'port':0x232b});function request(_0x25d86c,_0xee445e){return new BPromise(function(_0x300a6e,_0xd58a2d){return client['request'](_0x25d86c,_0xee445e)[_0x4382('0x4')](function(_0xbc22e6){if(_0xbc22e6[_0x4382('0x5')]){return _0xd58a2d(_0xbc22e6[_0x4382('0x5')][_0x4382('0x6')]);}else{return _0x300a6e(_0xbc22e6['result']);}})[_0x4382('0x7')](function(_0xb069a3){return _0xd58a2d(_0xb069a3);});});}exports['sendMailMessage']=function(_0x77cb7b,_0x3dd592){return request(_0x4382('0x8'),{'account':_0x77cb7b,'message':_0x3dd592});}; \ No newline at end of file +var _0xfe70=['message','catch','SendMail','jayson/promise','client','then'];(function(_0x66f7a9,_0x2ac4b5){var _0x5ba3d4=function(_0x1f7322){while(--_0x1f7322){_0x66f7a9['push'](_0x66f7a9['shift']());}};_0x5ba3d4(++_0x2ac4b5);}(_0xfe70,0x159));var _0x0fe7=function(_0x487ab4,_0x1e24e8){_0x487ab4=_0x487ab4-0x0;var _0x3bef77=_0xfe70[_0x487ab4];return _0x3bef77;};'use strict';var BPromise=require('bluebird');var jayson=require(_0x0fe7('0x0'));var client=jayson[_0x0fe7('0x1')]['http']({'port':0x232b});function request(_0x198e6f,_0x5423f9){return new BPromise(function(_0x35b18b,_0x1c5e05){return client['request'](_0x198e6f,_0x5423f9)[_0x0fe7('0x2')](function(_0x556535){if(_0x556535['error']){return _0x1c5e05(_0x556535['error'][_0x0fe7('0x3')]);}else{return _0x35b18b(_0x556535['result']);}})[_0x0fe7('0x4')](function(_0x2b60ec){return _0x1c5e05(_0x2b60ec);});});}exports['sendMailMessage']=function(_0x9d9bda,_0x41cc24){return request(_0x0fe7('0x5'),{'account':_0x9d9bda,'message':_0x41cc24});}; \ No newline at end of file diff --git a/server/services/agi/project.js b/server/services/agi/project.js index a5cd831..5b65ef6 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 _0x8a20=['Project\x20%s\x20not\x20found','continueAt','Project\x20%s\x20not\x20published','lodash','moment','xml2json','util','../../config/logger','agi','./mailRpc','./graph','./vertices','getSquareProjects','catch','error','Unable\x20to\x20download\x20CallySquare\x20projects','stack','agicommand','hasOwnProperty','retry','maxRetry','addVertex','omit','mxCell','isArray','length','source','target','addEdge','value','toJson','mxGraphModel','root','inspect','production','start','debug','stringify','format','YYYY-MM-DD\x20HH:mm:ss','info','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','calleridname','dnid','uniqueid','clear','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','response','code','result','toString','agicommand\x20not\x20found','finally','arg_1','callerid','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','close'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x8a20,0xba));var _0x08a2=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0x8a20[_0x1d1779];return _0x2377e9;};'use strict';var _=require(_0x08a2('0x0'));var moment=require(_0x08a2('0x1'));var parser=require(_0x08a2('0x2'));var util=require(_0x08a2('0x3'));var logger=require(_0x08a2('0x4'))(_0x08a2('0x5'));var rpc=require('./rpc');var mailRpc=require(_0x08a2('0x6'));var Graph=require(_0x08a2('0x7'));var Vertices=require(_0x08a2('0x8'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc[_0x08a2('0x9')]()[_0x08a2('0xa')](function(_0x561346){logger[_0x08a2('0xb')](_0x08a2('0xc'),_0x561346[_0x08a2('0xd')]);return[];});}function addVertex(_0x56eb9f,_0x3ed5a5,_0x503348){_0x3ed5a5[_0x08a2('0xe')]=_0x503348;if(_0x3ed5a5[_0x08a2('0xf')](_0x08a2('0x10'))){_0x3ed5a5[_0x08a2('0x11')]=parseInt(_0x3ed5a5[_0x08a2('0x10')],0xa);}_0x56eb9f[_0x08a2('0x12')](_[_0x08a2('0x13')](_0x3ed5a5,_0x08a2('0x14')));}function initGraph(_0x3c6d91,_0x10d8ef){var _0x584dc9=new Graph();for(var _0x283637 in _0x3c6d91){if(_0x3c6d91[_0x08a2('0xf')](_0x283637)){if(_[_0x08a2('0x15')](_0x3c6d91[_0x283637])){for(var _0x4db6a1=0x0;_0x4db6a1<_0x3c6d91[_0x283637][_0x08a2('0x16')];_0x4db6a1+=0x1){addVertex(_0x584dc9,_0x3c6d91[_0x283637][_0x4db6a1],_0x283637);}}else{addVertex(_0x584dc9,_0x3c6d91[_0x283637],_0x283637);}}}for(var _0x3c6fc2=0x0;_0x3c6fc2<_0x10d8ef[_0x08a2('0x16')];_0x3c6fc2+=0x1){if(_0x10d8ef[_0x3c6fc2][_0x08a2('0x17')]&&_0x10d8ef[_0x3c6fc2][_0x08a2('0x18')]){_0x584dc9[_0x08a2('0x19')](_0x10d8ef[_0x3c6fc2][_0x08a2('0x17')],_0x10d8ef[_0x3c6fc2]['target'],_0x10d8ef[_0x3c6fc2][_0x08a2('0x1a')]);}}return _0x584dc9;}function getRoot(_0x11073d){return parser[_0x08a2('0x1b')](_0x11073d,{'object':!![]})[_0x08a2('0x1c')][_0x08a2('0x1d')];}function inspect(_0x2b7a55){return util[_0x08a2('0x1e')](_0x2b7a55,{'showHidden':![],'depth':null});}function initialize(_0x237b7e,_0x183e65){var _0x518bed=getRoot(_0x237b7e[_0x08a2('0x1f')]);if(!_0x518bed||!_0x518bed[_0x08a2('0x20')])return;var _0x11f4d9,_0x519280,_0x5e8447;logger[_0x08a2('0x21')](_0x08a2('0x1d'),JSON[_0x08a2('0x22')](_0x518bed,null,0x2));_0x183e65['joinAt']=moment()[_0x08a2('0x23')](_0x08a2('0x24'));_0x11f4d9=initGraph(_[_0x08a2('0x13')](_0x518bed,'mxCell'),_0x518bed[_0x08a2('0x14')]);_0x519280=new Vertices(_0x183e65,rpc,mailRpc);logger[_0x08a2('0x25')](util[_0x08a2('0x23')](_0x08a2('0x26'),_0x183e65['arg_1'],_0x183e65[_0x08a2('0x27')],_0x183e65['callerid'],_0x183e65[_0x08a2('0x28')],_0x183e65[_0x08a2('0x29')]));_0x11f4d9['traverseBFS'](_0x518bed[_0x08a2('0x20')]['id'],function(_0x266d7a){try{_0x266d7a=_0x519280[_0x08a2('0x2a')](_0x266d7a);logger[_0x08a2('0x21')]('vertex',JSON[_0x08a2('0x22')](_0x266d7a,null,0x2));if(_0x266d7a[_0x08a2('0xe')]==='gotoc'){logger[_0x08a2('0x25')](_0x08a2('0x2b'));_0x183e65[_0x08a2('0x2c')]=_0x266d7a[_0x08a2('0x2c')]||_0x183e65['context'];_0x183e65[_0x08a2('0x2d')]=_0x266d7a[_0x08a2('0x2d')];_0x183e65[_0x08a2('0x2e')]=_0x266d7a[_0x08a2('0x2e')]?_0x266d7a['priority']-0x1:0x1;return null;}else if(_0x266d7a&&_0x519280[_0x266d7a[_0x08a2('0xe')]]){_0x5e8447=_0x519280[_0x266d7a['agicommand']](_0x266d7a);logger[_0x08a2('0x25')](_0x08a2('0x2f'),JSON[_0x08a2('0x22')](_0x5e8447,null,0x2));if(_0x5e8447&&_0x5e8447[_0x08a2('0x30')]===AGI_CODE_SUCCESS&&_0x5e8447[_0x08a2('0x31')]!==AGI_RESULT_ERROR&&!_0x183e65['evtHangup']){logger['debug']('response',inspect(_0x5e8447));return _['isUndefined'](_0x5e8447[_0x08a2('0x31')])?null:_0x5e8447['result'][_0x08a2('0x32')]();}else{logger[_0x08a2('0xb')](_0x08a2('0x2f'),inspect(_0x5e8447));return null;}}else{logger[_0x08a2('0xb')](_0x08a2('0x33'));return null;}}catch(_0x3678fc){logger[_0x08a2('0xb')](_0x3678fc[_0x08a2('0xd')]);return null;}});if(_0x518bed[_0x08a2('0x34')]){logger['info'](util[_0x08a2('0x23')]('[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x183e65[_0x08a2('0x35')],_0x183e65[_0x08a2('0x27')],_0x183e65[_0x08a2('0x36')],_0x183e65[_0x08a2('0x28')],_0x183e65['uniqueid']));_0x11f4d9['traverseBFS'](_0x518bed['finally']['id'],function(_0x12543c){try{_0x12543c=_0x519280[_0x08a2('0x2a')](_0x12543c);logger[_0x08a2('0x21')]('vertex',JSON[_0x08a2('0x22')](_0x12543c,null,0x2));if(_0x12543c&&_0x519280[_0x12543c[_0x08a2('0xe')]]){_0x5e8447=_0x519280[_0x12543c['agicommand']](_0x12543c);if(_0x5e8447){logger[_0x08a2('0x21')](_0x08a2('0x2f'),inspect(_0x5e8447));return _['isUndefined'](_0x5e8447[_0x08a2('0x31')])?null:_0x5e8447[_0x08a2('0x31')][_0x08a2('0x32')]();}else{logger['error'](_0x08a2('0x2f'),inspect(_0x5e8447));return null;}}else{logger[_0x08a2('0xb')]('agicommand\x20not\x20found');return null;}}catch(_0x4eb05f){logger[_0x08a2('0xb')](_0x4eb05f[_0x08a2('0xd')]);return null;}});}logger[_0x08a2('0x25')](util[_0x08a2('0x23')](_0x08a2('0x37'),_0x183e65['arg_1'],_0x183e65[_0x08a2('0x27')],_0x183e65[_0x08a2('0x36')],_0x183e65[_0x08a2('0x28')],_0x183e65['uniqueid']));logger['info'](util['format'](_0x08a2('0x38'),_0x183e65['context'],_0x183e65['extension'],parseInt(_0x183e65['priority'],0xa)+0x1));_0x183e65['continueAt'](_0x183e65[_0x08a2('0x2c')],_0x183e65['extension'],parseInt(_0x183e65['priority'],0xa)+0x1);_0x183e65[_0x08a2('0x39')]();}function handleNotFound(_0x3f7f50){logger[_0x08a2('0xb')](util['format'](_0x08a2('0x3a'),_0x3f7f50[_0x08a2('0x35')]));_0x3f7f50[_0x08a2('0x3b')](_0x3f7f50[_0x08a2('0x2c')],_0x3f7f50[_0x08a2('0x2d')],parseInt(_0x3f7f50['priority'],0xa)+0x1);_0x3f7f50[_0x08a2('0x39')]();}function handleUnpublished(_0xd7961){logger[_0x08a2('0xb')](util[_0x08a2('0x23')](_0x08a2('0x3c'),_0xd7961[_0x08a2('0x35')]));_0xd7961['continueAt'](_0xd7961[_0x08a2('0x2c')],_0xd7961['extension'],parseInt(_0xd7961['priority'],0xa)+0x1);_0xd7961['close']();}module['exports']={'getAll':getAll,'handleNotFound':handleNotFound,'handleUnpublished':handleUnpublished,'initialize':initialize}; \ No newline at end of file +var _0x0ded=['exports','lodash','moment','xml2json','util','../../config/logger','agi','./mailRpc','./graph','./vertices','getSquareProjects','Unable\x20to\x20download\x20CallySquare\x20projects','stack','agicommand','retry','maxRetry','addVertex','mxCell','isArray','length','source','target','addEdge','value','toJson','mxGraphModel','root','inspect','production','start','debug','joinAt','format','YYYY-MM-DD\x20HH:mm:ss','info','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid','dnid','uniqueid','traverseBFS','clear','vertex','stringify','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','response','code','result','isUndefined','toString','error','agicommand\x20not\x20found','finally','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','continueAt','close'];(function(_0x4fbfd9,_0x3ab91a){var _0x31dc94=function(_0x11e53b){while(--_0x11e53b){_0x4fbfd9['push'](_0x4fbfd9['shift']());}};_0x31dc94(++_0x3ab91a);}(_0x0ded,0x1ba));var _0xd0de=function(_0x454e6d,_0x1e1f38){_0x454e6d=_0x454e6d-0x0;var _0x4bc294=_0x0ded[_0x454e6d];return _0x4bc294;};'use strict';var _=require(_0xd0de('0x0'));var moment=require(_0xd0de('0x1'));var parser=require(_0xd0de('0x2'));var util=require(_0xd0de('0x3'));var logger=require(_0xd0de('0x4'))(_0xd0de('0x5'));var rpc=require('./rpc');var mailRpc=require(_0xd0de('0x6'));var Graph=require(_0xd0de('0x7'));var Vertices=require(_0xd0de('0x8'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc[_0xd0de('0x9')]()['catch'](function(_0x253651){logger['error'](_0xd0de('0xa'),_0x253651[_0xd0de('0xb')]);return[];});}function addVertex(_0x5e331f,_0x5a362f,_0x307fb2){_0x5a362f[_0xd0de('0xc')]=_0x307fb2;if(_0x5a362f['hasOwnProperty'](_0xd0de('0xd'))){_0x5a362f[_0xd0de('0xe')]=parseInt(_0x5a362f[_0xd0de('0xd')],0xa);}_0x5e331f[_0xd0de('0xf')](_['omit'](_0x5a362f,_0xd0de('0x10')));}function initGraph(_0x230164,_0xd17e7){var _0x31dc3c=new Graph();for(var _0x1f2d9e in _0x230164){if(_0x230164['hasOwnProperty'](_0x1f2d9e)){if(_[_0xd0de('0x11')](_0x230164[_0x1f2d9e])){for(var _0x22c96b=0x0;_0x22c96b<_0x230164[_0x1f2d9e][_0xd0de('0x12')];_0x22c96b+=0x1){addVertex(_0x31dc3c,_0x230164[_0x1f2d9e][_0x22c96b],_0x1f2d9e);}}else{addVertex(_0x31dc3c,_0x230164[_0x1f2d9e],_0x1f2d9e);}}}for(var _0xe6b106=0x0;_0xe6b106<_0xd17e7[_0xd0de('0x12')];_0xe6b106+=0x1){if(_0xd17e7[_0xe6b106][_0xd0de('0x13')]&&_0xd17e7[_0xe6b106][_0xd0de('0x14')]){_0x31dc3c[_0xd0de('0x15')](_0xd17e7[_0xe6b106][_0xd0de('0x13')],_0xd17e7[_0xe6b106][_0xd0de('0x14')],_0xd17e7[_0xe6b106][_0xd0de('0x16')]);}}return _0x31dc3c;}function getRoot(_0x14d3cc){return parser[_0xd0de('0x17')](_0x14d3cc,{'object':!![]})[_0xd0de('0x18')][_0xd0de('0x19')];}function inspect(_0x168f50){return util[_0xd0de('0x1a')](_0x168f50,{'showHidden':![],'depth':null});}function initialize(_0x50a2c5,_0x4980f7){var _0x776498=getRoot(_0x50a2c5[_0xd0de('0x1b')]);if(!_0x776498||!_0x776498[_0xd0de('0x1c')])return;var _0x33309b,_0x4693d1,_0x30bfdb;logger[_0xd0de('0x1d')](_0xd0de('0x19'),JSON['stringify'](_0x776498,null,0x2));_0x4980f7[_0xd0de('0x1e')]=moment()[_0xd0de('0x1f')](_0xd0de('0x20'));_0x33309b=initGraph(_['omit'](_0x776498,'mxCell'),_0x776498['mxCell']);_0x4693d1=new Vertices(_0x4980f7,rpc,mailRpc);logger[_0xd0de('0x21')](util[_0xd0de('0x1f')](_0xd0de('0x22'),_0x4980f7[_0xd0de('0x23')],_0x4980f7[_0xd0de('0x24')],_0x4980f7[_0xd0de('0x25')],_0x4980f7[_0xd0de('0x26')],_0x4980f7[_0xd0de('0x27')]));_0x33309b[_0xd0de('0x28')](_0x776498[_0xd0de('0x1c')]['id'],function(_0x3395d4){try{_0x3395d4=_0x4693d1[_0xd0de('0x29')](_0x3395d4);logger[_0xd0de('0x1d')](_0xd0de('0x2a'),JSON[_0xd0de('0x2b')](_0x3395d4,null,0x2));if(_0x3395d4[_0xd0de('0xc')]===_0xd0de('0x2c')){logger['info'](_0xd0de('0x2d'));_0x4980f7[_0xd0de('0x2e')]=_0x3395d4[_0xd0de('0x2e')]||_0x4980f7['context'];_0x4980f7[_0xd0de('0x2f')]=_0x3395d4[_0xd0de('0x2f')];_0x4980f7[_0xd0de('0x30')]=_0x3395d4['priority']?_0x3395d4[_0xd0de('0x30')]-0x1:0x1;return null;}else if(_0x3395d4&&_0x4693d1[_0x3395d4[_0xd0de('0xc')]]){_0x30bfdb=_0x4693d1[_0x3395d4[_0xd0de('0xc')]](_0x3395d4);logger['info'](_0xd0de('0x31'),JSON[_0xd0de('0x2b')](_0x30bfdb,null,0x2));if(_0x30bfdb&&_0x30bfdb[_0xd0de('0x32')]===AGI_CODE_SUCCESS&&_0x30bfdb[_0xd0de('0x33')]!==AGI_RESULT_ERROR&&!_0x4980f7['evtHangup']){logger[_0xd0de('0x1d')](_0xd0de('0x31'),inspect(_0x30bfdb));return _[_0xd0de('0x34')](_0x30bfdb[_0xd0de('0x33')])?null:_0x30bfdb[_0xd0de('0x33')][_0xd0de('0x35')]();}else{logger[_0xd0de('0x36')](_0xd0de('0x31'),inspect(_0x30bfdb));return null;}}else{logger[_0xd0de('0x36')](_0xd0de('0x37'));return null;}}catch(_0x241988){logger[_0xd0de('0x36')](_0x241988[_0xd0de('0xb')]);return null;}});if(_0x776498[_0xd0de('0x38')]){logger[_0xd0de('0x21')](util['format'](_0xd0de('0x39'),_0x4980f7[_0xd0de('0x23')],_0x4980f7[_0xd0de('0x24')],_0x4980f7[_0xd0de('0x25')],_0x4980f7['dnid'],_0x4980f7['uniqueid']));_0x33309b[_0xd0de('0x28')](_0x776498[_0xd0de('0x38')]['id'],function(_0x4470d9){try{_0x4470d9=_0x4693d1[_0xd0de('0x29')](_0x4470d9);logger[_0xd0de('0x1d')](_0xd0de('0x2a'),JSON['stringify'](_0x4470d9,null,0x2));if(_0x4470d9&&_0x4693d1[_0x4470d9['agicommand']]){_0x30bfdb=_0x4693d1[_0x4470d9['agicommand']](_0x4470d9);if(_0x30bfdb){logger['debug'](_0xd0de('0x31'),inspect(_0x30bfdb));return _[_0xd0de('0x34')](_0x30bfdb[_0xd0de('0x33')])?null:_0x30bfdb[_0xd0de('0x33')]['toString']();}else{logger[_0xd0de('0x36')]('response',inspect(_0x30bfdb));return null;}}else{logger[_0xd0de('0x36')](_0xd0de('0x37'));return null;}}catch(_0x993253){logger[_0xd0de('0x36')](_0x993253['stack']);return null;}});}logger[_0xd0de('0x21')](util[_0xd0de('0x1f')](_0xd0de('0x3a'),_0x4980f7[_0xd0de('0x23')],_0x4980f7[_0xd0de('0x24')],_0x4980f7['callerid'],_0x4980f7[_0xd0de('0x26')],_0x4980f7[_0xd0de('0x27')]));logger[_0xd0de('0x21')](util['format'](_0xd0de('0x3b'),_0x4980f7[_0xd0de('0x2e')],_0x4980f7[_0xd0de('0x2f')],parseInt(_0x4980f7['priority'],0xa)+0x1));_0x4980f7[_0xd0de('0x3c')](_0x4980f7[_0xd0de('0x2e')],_0x4980f7[_0xd0de('0x2f')],parseInt(_0x4980f7[_0xd0de('0x30')],0xa)+0x1);_0x4980f7[_0xd0de('0x3d')]();}function handleNotFound(_0x33db50){logger[_0xd0de('0x36')](util[_0xd0de('0x1f')]('Project\x20%s\x20not\x20found',_0x33db50[_0xd0de('0x23')]));_0x33db50[_0xd0de('0x3c')](_0x33db50['context'],_0x33db50[_0xd0de('0x2f')],parseInt(_0x33db50[_0xd0de('0x30')],0xa)+0x1);_0x33db50['close']();}function handleUnpublished(_0x3823b5){logger[_0xd0de('0x36')](util['format']('Project\x20%s\x20not\x20published',_0x3823b5['arg_1']));_0x3823b5['continueAt'](_0x3823b5[_0xd0de('0x2e')],_0x3823b5[_0xd0de('0x2f')],parseInt(_0x3823b5[_0xd0de('0x30')],0xa)+0x1);_0x3823b5[_0xd0de('0x3d')]();}module[_0xd0de('0x3e')]={'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 c6848a7..9289d21 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 _0x930e=['indexOf','trim','slice','length','emit','line','exports','util','stream','Transform','call','_localBuffer','_inBody','inherits','prototype','_transform','\x0d\x0a\x0d\x0a','substring','split'];(function(_0x1f75e8,_0x7fa97f){var _0x120699=function(_0x4d817b){while(--_0x4d817b){_0x1f75e8['push'](_0x1f75e8['shift']());}};_0x120699(++_0x7fa97f);}(_0x930e,0x66));var _0xe930=function(_0x38930b,_0x6e19f8){_0x38930b=_0x38930b-0x0;var _0x5ae224=_0x930e[_0x38930b];return _0x5ae224;};'use strict';var util=require(_0xe930('0x0'));var Transform=require(_0xe930('0x1'))[_0xe930('0x2')];function AGIReply(_0x543103){Transform[_0xe930('0x3')](this,_0x543103);this[_0xe930('0x4')]='';this[_0xe930('0x5')]=![];}util[_0xe930('0x6')](AGIReply,Transform);AGIReply[_0xe930('0x7')][_0xe930('0x8')]=function(_0x552b00,_0x39bdcc,_0x3ddc5d){var _0x2ea589='\x0a',_0x453cf7=['\x0a\x0a',_0xe930('0x9')],_0xf524f2=-0x1,_0x5b3f10=-0x1,_0x4043ee='',_0x1f19eb=0x0,_0x4985d4='',_0x2403a4='';this[_0xe930('0x4')]+=_0x552b00['toString']();_0x4985d4=this[_0xe930('0x4')];if(!this['_inBody']){_0x1f19eb=0x0;while(_0x453cf7[_0x1f19eb]){while((_0x5b3f10=_0x4985d4['indexOf'](_0x453cf7[_0x1f19eb]))!=-0x1){_0x4043ee=_0x453cf7[_0x1f19eb];_0x2403a4=_0x4985d4[_0xe930('0xa')](0x0,_0x5b3f10);_0x4985d4=_0x4985d4[_0xe930('0xa')](_0x5b3f10+_0x4043ee['length']);var _0x4b6726=_0x2403a4[_0xe930('0xb')](_0x2ea589),_0x2375b8=0x0,_0x529d20={},_0x5e56e8='',_0x5f58e6='',_0xf126a6=-0x1;while(_0x4b6726[_0x2375b8]){_0xf126a6=_0x4b6726[_0x2375b8][_0xe930('0xc')](':');if(_0xf126a6!=-0x1){_0x5e56e8=_0x4b6726[_0x2375b8]['slice'](0x0,_0xf126a6)[_0xe930('0xd')]();_0x5f58e6=_0x4b6726[_0x2375b8][_0xe930('0xe')](_0xf126a6+0x1)['trim']();if(_0x5e56e8[_0xe930('0xf')]>0x0){_0x529d20[_0x5e56e8]=_0x5f58e6;}}else{}_0x2375b8++;}this[_0xe930('0x10')]('headers',_0x529d20);this['_inBody']=!![];}_0x1f19eb++;}this[_0xe930('0x4')]=_0x4985d4;}else{while((_0xf524f2=_0x4985d4[_0xe930('0xc')](_0x2ea589))!=-0x1){_0x2403a4=_0x4985d4[_0xe930('0xa')](0x0,_0xf524f2);this[_0xe930('0x10')](_0xe930('0x11'),_0x2403a4);_0x4985d4=_0x4985d4[_0xe930('0xa')](_0xf524f2+_0x2ea589[_0xe930('0xf')]);}this['_localBuffer']=_0x4985d4;}_0x3ddc5d();};module[_0xe930('0x12')]=AGIReply; \ No newline at end of file +var _0xee17=['_inBody','inherits','prototype','_transform','\x0d\x0a\x0d\x0a','toString','indexOf','substring','length','slice','trim','emit','headers','util','stream','call','_localBuffer'];(function(_0x62bff4,_0x29f6e5){var _0x350842=function(_0x3140f9){while(--_0x3140f9){_0x62bff4['push'](_0x62bff4['shift']());}};_0x350842(++_0x29f6e5);}(_0xee17,0x1c7));var _0x7ee1=function(_0x395179,_0x26c6c1){_0x395179=_0x395179-0x0;var _0x56239c=_0xee17[_0x395179];return _0x56239c;};'use strict';var util=require(_0x7ee1('0x0'));var Transform=require(_0x7ee1('0x1'))['Transform'];function AGIReply(_0x590690){Transform[_0x7ee1('0x2')](this,_0x590690);this[_0x7ee1('0x3')]='';this[_0x7ee1('0x4')]=![];}util[_0x7ee1('0x5')](AGIReply,Transform);AGIReply[_0x7ee1('0x6')][_0x7ee1('0x7')]=function(_0x7fba31,_0x206e15,_0x14c927){var _0x1e7ee4='\x0a',_0x231323=['\x0a\x0a',_0x7ee1('0x8')],_0x3e8598=-0x1,_0x56f94b=-0x1,_0x4beb09='',_0x247b0f=0x0,_0x3ed3ec='',_0x407c96='';this[_0x7ee1('0x3')]+=_0x7fba31[_0x7ee1('0x9')]();_0x3ed3ec=this[_0x7ee1('0x3')];if(!this[_0x7ee1('0x4')]){_0x247b0f=0x0;while(_0x231323[_0x247b0f]){while((_0x56f94b=_0x3ed3ec[_0x7ee1('0xa')](_0x231323[_0x247b0f]))!=-0x1){_0x4beb09=_0x231323[_0x247b0f];_0x407c96=_0x3ed3ec['substring'](0x0,_0x56f94b);_0x3ed3ec=_0x3ed3ec[_0x7ee1('0xb')](_0x56f94b+_0x4beb09[_0x7ee1('0xc')]);var _0x284015=_0x407c96['split'](_0x1e7ee4),_0x4b478f=0x0,_0x5cae0d={},_0x23074e='',_0x3571d5='',_0x1e2a9a=-0x1;while(_0x284015[_0x4b478f]){_0x1e2a9a=_0x284015[_0x4b478f][_0x7ee1('0xa')](':');if(_0x1e2a9a!=-0x1){_0x23074e=_0x284015[_0x4b478f][_0x7ee1('0xd')](0x0,_0x1e2a9a)[_0x7ee1('0xe')]();_0x3571d5=_0x284015[_0x4b478f][_0x7ee1('0xd')](_0x1e2a9a+0x1)[_0x7ee1('0xe')]();if(_0x23074e['length']>0x0){_0x5cae0d[_0x23074e]=_0x3571d5;}}else{}_0x4b478f++;}this[_0x7ee1('0xf')](_0x7ee1('0x10'),_0x5cae0d);this[_0x7ee1('0x4')]=!![];}_0x247b0f++;}this[_0x7ee1('0x3')]=_0x3ed3ec;}else{while((_0x3e8598=_0x3ed3ec[_0x7ee1('0xa')](_0x1e7ee4))!=-0x1){_0x407c96=_0x3ed3ec['substring'](0x0,_0x3e8598);this[_0x7ee1('0xf')]('line',_0x407c96);_0x3ed3ec=_0x3ed3ec[_0x7ee1('0xb')](_0x3e8598+_0x1e7ee4['length']);}this['_localBuffer']=_0x3ed3ec;}_0x14c927();};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 69ce77f..70f9310 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 _0x8388=['dsn','getUserById','ShowUser','getContactByPhone','GetContactByPhone','getTrunkById','getSoundById','ShowSound','save_name','ShowInterval','Interval','Intervals','getSmsAccountById','ShowSmsAccount','createSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport','merge','arg_1','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','CreateSquareRecording','createSquareMessage','createCmContact','ShowCmHopper','phone','ShowPause','agentLogin','LoginUser','agentPause','PauseUser','agentUnpause','agentLogout','LogoutUser','lodash','moment','jayson/promise','client','request','error','message','result','catch','getSquareProjects','production','ShowSquareProject','getMailAccountById','MailServerOut','Smtp','CloudProvider','email','name','getVoiceQueueById','ShowVoiceQueue','getVariableById','getSquareOdbcById','ShowSquareOdbc'];(function(_0x4b6c5d,_0x3cbbdf){var _0x4e4d47=function(_0x311028){while(--_0x311028){_0x4b6c5d['push'](_0x4b6c5d['shift']());}};_0x4e4d47(++_0x3cbbdf);}(_0x8388,0x18d));var _0x8838=function(_0x46a3e8,_0x2e1b35){_0x46a3e8=_0x46a3e8-0x0;var _0xf1442e=_0x8388[_0x46a3e8];return _0xf1442e;};'use strict';var _=require(_0x8838('0x0'));var moment=require(_0x8838('0x1'));var jayson=require(_0x8838('0x2'));var client=jayson[_0x8838('0x3')]['http']({'port':0x2329});function request(_0x140ee6,_0x3dbcd4){return new Promise(function(_0x316297,_0x20a813){return client[_0x8838('0x4')](_0x140ee6,_0x3dbcd4)['then'](function(_0x303377){if(_0x303377[_0x8838('0x5')]){return _0x20a813(_0x303377['error'][_0x8838('0x6')]);}else{return _0x316297(_0x303377[_0x8838('0x7')]);}})[_0x8838('0x8')](function(_0x56596f){return _0x20a813(_0x56596f);});});}exports[_0x8838('0x9')]=function(){return request('GetSquareProjects',{'options':{'raw':![],'attributes':['id','name',_0x8838('0xa')]}});};exports['getSquareProject']=function(_0x4aedc9){return request(_0x8838('0xb'),{'options':{'raw':![],'where':{'name':_0x4aedc9},'attributes':[_0x8838('0xa')]}});};exports[_0x8838('0xc')]=function(_0x35096b){return request('ShowMailAccount',{'options':{'raw':![],'where':{'id':_0x35096b},'include':[{'model':_0x8838('0xd'),'as':_0x8838('0xe'),'include':[{'model':_0x8838('0xf'),'as':_0x8838('0xf')}]}],'attributes':['id','name',_0x8838('0x10')],'smtp':!![]}});};exports['getSquareProjectById']=function(_0x530bac){return request(_0x8838('0xb'),{'options':{'where':{'id':_0x530bac},'attributes':[_0x8838('0x11')]}});};exports[_0x8838('0x12')]=function(_0x43b446){return request(_0x8838('0x13'),{'options':{'where':{'id':_0x43b446},'attributes':[_0x8838('0x11')]}});};exports[_0x8838('0x14')]=function(_0x8daaab){return request('ShowVariable',{'options':{'where':{'id':_0x8daaab},'attributes':[_0x8838('0x11')]}});};exports[_0x8838('0x15')]=function(_0x5eecf2){return request(_0x8838('0x16'),{'options':{'where':{'id':_0x5eecf2},'attributes':[_0x8838('0x17')]}});};exports[_0x8838('0x18')]=function(_0x4d0c2e){return request(_0x8838('0x19'),{'options':{'where':{'id':_0x4d0c2e},'attributes':['name']}});};exports[_0x8838('0x1a')]=function(_0x204120){return request(_0x8838('0x1b'),{'options':{'where':{'phone':_0x204120['phone']},'attributes':['id']}});};exports[_0x8838('0x1c')]=function(_0x7b836e){return request('ShowTrunk',{'options':{'where':{'id':_0x7b836e},'attributes':[_0x8838('0x11')]}});};exports[_0x8838('0x1d')]=function(_0x4c5bed){return request(_0x8838('0x1e'),{'options':{'where':{'id':_0x4c5bed},'attributes':[_0x8838('0x1f')]}});};exports['getIntervalById']=function(_0x55ccbc){return request(_0x8838('0x20'),{'options':{'raw':![],'where':{'id':_0x55ccbc},'include':[{'model':_0x8838('0x21'),'as':_0x8838('0x22')}]}});};exports[_0x8838('0x23')]=function(_0x109341){return request(_0x8838('0x24'),{'options':{'where':{'id':_0x109341},'attributes':['id',_0x8838('0x11')]}});};exports[_0x8838('0x25')]=function(_0x46b603){return request('CreateSmsMessage',{'body':_0x46b603});};exports[_0x8838('0x26')]=function(_0x584779){return request(_0x8838('0x27'),{'body':_0x584779});};exports[_0x8838('0x28')]=function(_0x4c58a1){return request('CreateSquareReport',{'body':_[_0x8838('0x29')](_0x4c58a1,{'project_name':_0x4c58a1[_0x8838('0x2a')],'prev_project_name':_0x4c58a1[_0x8838('0x2b')]||'','is_subproject':_0x4c58a1[_0x8838('0x2b')]?!![]:![],'leaveAt':moment()[_0x8838('0x2c')](_0x8838('0x2d'))})});};exports[_0x8838('0x2e')]=function(_0x1fe141){return request(_0x8838('0x2f'),{'body':_0x1fe141});};exports[_0x8838('0x30')]=function(_0x5921eb){return request('CreateSquareMessage',{'body':_0x5921eb});};exports[_0x8838('0x31')]=function(_0x52907a){return request(_0x8838('0x32'),{'options':{'raw':![],'where':{'phone':_0x52907a[_0x8838('0x33')],'ListId':_0x52907a['ListId']}}})['then'](function(_0x2ac2b1){if(_0x2ac2b1){return _0x2ac2b1;}return request('CreateCmContact',{'body':_0x52907a});});};exports['getPauseById']=function(_0x1b605d){return request(_0x8838('0x34'),{'options':{'where':{'id':_0x1b605d},'attributes':['name']}});};exports[_0x8838('0x35')]=function(_0x296ba1,_0x4d8007){return request(_0x8838('0x36'),{'body':{'interface':_0x4d8007},'options':{'where':_0x296ba1}});};exports[_0x8838('0x37')]=function(_0x229aef,_0xdd28e2,_0x508ed4){return request(_0x8838('0x38'),{'body':{'type':_0xdd28e2,'uniqueid':_0x508ed4},'options':{'where':_0x229aef}});};exports[_0x8838('0x39')]=function(_0x4a263b){return request('UnpauseUser',{'body':{},'options':{'where':_0x4a263b}});};exports[_0x8838('0x3a')]=function(_0x5f5890){return request(_0x8838('0x3b'),{'body':{},'options':{'where':_0x5f5890}});}; \ No newline at end of file +var _0xcb18=['createSquareMessage','CreateSquareMessage','createCmContact','ShowCmHopper','phone','CreateCmContact','getPauseById','ShowPause','agentLogin','agentPause','PauseUser','agentUnpause','UnpauseUser','agentLogout','LogoutUser','jayson/promise','http','request','then','error','message','catch','getSquareProjects','GetSquareProjects','production','getSquareProject','ShowSquareProject','ShowMailAccount','MailServerOut','CloudProvider','name','email','getSquareProjectById','ShowVoiceQueue','getVariableById','ShowVariable','getSquareOdbcById','getUserById','ShowUser','getContactByPhone','getSoundById','ShowSound','getIntervalById','ShowInterval','Interval','Intervals','createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport','CreateSquareReport','merge','arg_2','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','CreateSquareRecording'];(function(_0x28bb2e,_0x4f080d){var _0x5b508e=function(_0x440878){while(--_0x440878){_0x28bb2e['push'](_0x28bb2e['shift']());}};_0x5b508e(++_0x4f080d);}(_0xcb18,0x159));var _0x8cb1=function(_0x14a2b1,_0x10d0b7){_0x14a2b1=_0x14a2b1-0x0;var _0x14a5a8=_0xcb18[_0x14a2b1];return _0x14a5a8;};'use strict';var _=require('lodash');var moment=require('moment');var jayson=require(_0x8cb1('0x0'));var client=jayson['client'][_0x8cb1('0x1')]({'port':0x2329});function request(_0x50513d,_0x5e800d){return new Promise(function(_0x39e801,_0x87b1d3){return client[_0x8cb1('0x2')](_0x50513d,_0x5e800d)[_0x8cb1('0x3')](function(_0x28be22){if(_0x28be22['error']){return _0x87b1d3(_0x28be22[_0x8cb1('0x4')][_0x8cb1('0x5')]);}else{return _0x39e801(_0x28be22['result']);}})[_0x8cb1('0x6')](function(_0x510e92){return _0x87b1d3(_0x510e92);});});}exports[_0x8cb1('0x7')]=function(){return request(_0x8cb1('0x8'),{'options':{'raw':![],'attributes':['id','name',_0x8cb1('0x9')]}});};exports[_0x8cb1('0xa')]=function(_0x1a89e7){return request(_0x8cb1('0xb'),{'options':{'raw':![],'where':{'name':_0x1a89e7},'attributes':[_0x8cb1('0x9')]}});};exports['getMailAccountById']=function(_0x5ef3d0){return request(_0x8cb1('0xc'),{'options':{'raw':![],'where':{'id':_0x5ef3d0},'include':[{'model':_0x8cb1('0xd'),'as':'Smtp','include':[{'model':_0x8cb1('0xe'),'as':_0x8cb1('0xe')}]}],'attributes':['id',_0x8cb1('0xf'),_0x8cb1('0x10')],'smtp':!![]}});};exports[_0x8cb1('0x11')]=function(_0xb63f73){return request('ShowSquareProject',{'options':{'where':{'id':_0xb63f73},'attributes':[_0x8cb1('0xf')]}});};exports['getVoiceQueueById']=function(_0xacc6db){return request(_0x8cb1('0x12'),{'options':{'where':{'id':_0xacc6db},'attributes':[_0x8cb1('0xf')]}});};exports[_0x8cb1('0x13')]=function(_0x2a3e22){return request(_0x8cb1('0x14'),{'options':{'where':{'id':_0x2a3e22},'attributes':['name']}});};exports[_0x8cb1('0x15')]=function(_0x4b6320){return request('ShowSquareOdbc',{'options':{'where':{'id':_0x4b6320},'attributes':['dsn']}});};exports[_0x8cb1('0x16')]=function(_0x450d05){return request(_0x8cb1('0x17'),{'options':{'where':{'id':_0x450d05},'attributes':['name']}});};exports[_0x8cb1('0x18')]=function(_0x14c1fa){return request('GetContactByPhone',{'options':{'where':{'phone':_0x14c1fa['phone']},'attributes':['id']}});};exports['getTrunkById']=function(_0x2ecfe5){return request('ShowTrunk',{'options':{'where':{'id':_0x2ecfe5},'attributes':[_0x8cb1('0xf')]}});};exports[_0x8cb1('0x19')]=function(_0x382d9c){return request(_0x8cb1('0x1a'),{'options':{'where':{'id':_0x382d9c},'attributes':['save_name']}});};exports[_0x8cb1('0x1b')]=function(_0x5df496){return request(_0x8cb1('0x1c'),{'options':{'raw':![],'where':{'id':_0x5df496},'include':[{'model':_0x8cb1('0x1d'),'as':_0x8cb1('0x1e')}]}});};exports['getSmsAccountById']=function(_0x3bc045){return request('ShowSmsAccount',{'options':{'where':{'id':_0x3bc045},'attributes':['id','name']}});};exports['createSmsMessage']=function(_0x33cb0e){return request('CreateSmsMessage',{'body':_0x33cb0e});};exports[_0x8cb1('0x1f')]=function(_0x22eb2d){return request(_0x8cb1('0x20'),{'body':_0x22eb2d});};exports[_0x8cb1('0x21')]=function(_0x516134){return request(_0x8cb1('0x22'),{'body':_[_0x8cb1('0x23')](_0x516134,{'project_name':_0x516134['arg_1'],'prev_project_name':_0x516134['arg_2']||'','is_subproject':_0x516134[_0x8cb1('0x24')]?!![]:![],'leaveAt':moment()['format'](_0x8cb1('0x25'))})});};exports[_0x8cb1('0x26')]=function(_0xe9ef53){return request(_0x8cb1('0x27'),{'body':_0xe9ef53});};exports[_0x8cb1('0x28')]=function(_0x1d79ef){return request(_0x8cb1('0x29'),{'body':_0x1d79ef});};exports[_0x8cb1('0x2a')]=function(_0x26f399){return request(_0x8cb1('0x2b'),{'options':{'raw':![],'where':{'phone':_0x26f399[_0x8cb1('0x2c')],'ListId':_0x26f399['ListId']}}})[_0x8cb1('0x3')](function(_0x3e07ad){if(_0x3e07ad){return _0x3e07ad;}return request(_0x8cb1('0x2d'),{'body':_0x26f399});});};exports[_0x8cb1('0x2e')]=function(_0x2325f2){return request(_0x8cb1('0x2f'),{'options':{'where':{'id':_0x2325f2},'attributes':['name']}});};exports[_0x8cb1('0x30')]=function(_0x389790,_0x203cb3){return request('LoginUser',{'body':{'interface':_0x203cb3},'options':{'where':_0x389790}});};exports[_0x8cb1('0x31')]=function(_0x312f28,_0x499992,_0x8980e1){return request(_0x8cb1('0x32'),{'body':{'type':_0x499992,'uniqueid':_0x8980e1},'options':{'where':_0x312f28}});};exports[_0x8cb1('0x33')]=function(_0x111d7f){return request(_0x8cb1('0x34'),{'body':{},'options':{'where':_0x111d7f}});};exports[_0x8cb1('0x35')]=function(_0x5a8642){return request(_0x8cb1('0x36'),{'body':{},'options':{'where':_0x5a8642}});}; \ 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 83cd1d5..90e92ea 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 _0x5fab=['./lex','./polly'];(function(_0x195e46,_0x37e025){var _0x17a5b0=function(_0x182d18){while(--_0x182d18){_0x195e46['push'](_0x195e46['shift']());}};_0x17a5b0(++_0x37e025);}(_0x5fab,0x177));var _0xb5fa=function(_0x388914,_0x3c63f9){_0x388914=_0x388914-0x0;var _0x1f9111=_0x5fab[_0x388914];return _0x1f9111;};var polly=require(_0xb5fa('0x0'));var lex=require(_0xb5fa('0x1'));module['exports']={'polly':polly,'lex':lex}; \ No newline at end of file +var _0x27a0=['exports','./lex'];(function(_0x526a74,_0x526a7c){var _0x372ed6=function(_0xe46b8){while(--_0xe46b8){_0x526a74['push'](_0x526a74['shift']());}};_0x372ed6(++_0x526a7c);}(_0x27a0,0xbf));var _0x027a=function(_0x40852d,_0x400ede){_0x40852d=_0x40852d-0x0;var _0x4f2f99=_0x27a0[_0x40852d];return _0x4f2f99;};var polly=require('./polly');var lex=require(_0x027a('0x0'));module[_0x027a('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 068c332..314223c 100644 --- a/server/services/agi/scripts/aws/lex/index.js +++ b/server/services/agi/scripts/aws/lex/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd64b=['./lib/api'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd64b,0xc1));var _0xbd64=function(_0x36f3df,_0x2b1621){_0x36f3df=_0x36f3df-0x0;var _0xcfb7b7=_0xd64b[_0x36f3df];return _0xcfb7b7;};'use strict';var lex=require(_0xbd64('0x0'));module['exports']=function(_0xf0de04,_0x4bfb7c,_0x30b9b3,_0xcbecd5,_0x64bd3b,_0x3f1f05){return lex(_0xf0de04,_0x4bfb7c,_0x30b9b3,_0xcbecd5,_0x64bd3b,_0x3f1f05);}; \ No newline at end of file +var _0xda3f=['exports'];(function(_0x5be795,_0x1cb1b8){var _0x4e8a3b=function(_0x5584ef){while(--_0x5584ef){_0x5be795['push'](_0x5be795['shift']());}};_0x4e8a3b(++_0x1cb1b8);}(_0xda3f,0xec));var _0xfda3=function(_0x37fc81,_0x10a97e){_0x37fc81=_0x37fc81-0x0;var _0x179f04=_0xda3f[_0x37fc81];return _0x179f04;};'use strict';var lex=require('./lib/api');module[_0xfda3('0x0')]=function(_0xf4e78,_0x534697,_0x5299b0,_0x5d7071,_0x3859fe,_0x581693){return lex(_0xf4e78,_0x534697,_0x5299b0,_0x5d7071,_0x3859fe,_0x581693);}; \ 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 33a756b..82ef238 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(_0x11772a,_0x30ae74){var _0xb540e7=function(_0x13be0f){while(--_0x13be0f){_0x11772a['push'](_0x11772a['shift']());}};_0xb540e7(++_0x30ae74);}(_0xa9e0,0x123));var _0x0a9e=function(_0x138f59,_0x1b53fb){_0x138f59=_0x138f59-0x0;var _0x3d114d=_0xa9e0[_0x138f59];return _0x3d114d;};'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(_0x596665,_0x54c6ac){var _0xfa7639=function(_0x56035c){while(--_0x56035c){_0x596665['push'](_0x596665['shift']());}};_0xfa7639(++_0x54c6ac);}(_0xa9e0,0x123));var _0x0a9e=function(_0x18a79d,_0x57bd2c){_0x18a79d=_0x18a79d-0x0;var _0x4f8848=_0xa9e0[_0x18a79d];return _0x4f8848;};'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 acc55ca..03892b2 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 _0x041b=['exports','./lib/api'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x041b,0x1e5));var _0xb041=function(_0x57d1bd,_0x5d43ad){_0x57d1bd=_0x57d1bd-0x0;var _0x2f943d=_0x041b[_0x57d1bd];return _0x2f943d;};'use strict';var polly=require(_0xb041('0x0'));module[_0xb041('0x1')]=function(_0x3e661f,_0x58f782,_0x578c57,_0x518814,_0x1a2b55,_0x7f19b8,_0x59ce37){return polly(_0x3e661f,_0x58f782,_0x578c57,_0x518814,_0x1a2b55,_0x7f19b8,_0x59ce37);}; \ No newline at end of file +var _0x9554=['exports','./lib/api'];(function(_0x57f059,_0x370c8f){var _0x1f838a=function(_0x90d726){while(--_0x90d726){_0x57f059['push'](_0x57f059['shift']());}};_0x1f838a(++_0x370c8f);}(_0x9554,0x15f));var _0x4955=function(_0x14abd3,_0x18e027){_0x14abd3=_0x14abd3-0x0;var _0x5a97da=_0x9554[_0x14abd3];return _0x5a97da;};'use strict';var polly=require(_0x4955('0x0'));module[_0x4955('0x1')]=function(_0x4881cd,_0xc19f51,_0x750602,_0x464b93,_0x33b4ae,_0x4a7c7b,_0x553269){return polly(_0x4881cd,_0xc19f51,_0x750602,_0x464b93,_0x33b4ae,_0x4a7c7b,_0x553269);}; \ 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 ff6a871..101b514 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 _0xeebc=['Polly','text','mp3','path','bluebird','randomstring','synthesizeSpeech','AudioStream','writeFile','No\x20data\x20response\x20from\x20aws\x20Polly!'];(function(_0x3e26cf,_0x39943d){var _0x258d3c=function(_0x4faf7e){while(--_0x4faf7e){_0x3e26cf['push'](_0x3e26cf['shift']());}};_0x258d3c(++_0x39943d);}(_0xeebc,0x189));var _0xceeb=function(_0x42938c,_0x254ff8){_0x42938c=_0x42938c-0x0;var _0x372571=_0xeebc[_0x42938c];return _0x372571;};'use strict';var fs=require('fs');var path=require(_0xceeb('0x0'));var BPromise=require(_0xceeb('0x1'));var rs=require(_0xceeb('0x2'));var AWS=require('aws-sdk');function pollyResult(_0x3e878b,_0x89dc88,_0x55c3da){return new BPromise(function(_0x5a11b0,_0xdff1b){_0x3e878b[_0xceeb('0x3')](_0x89dc88,function(_0x5b11df,_0x21e097){if(_0x5b11df){_0xdff1b(_0x5b11df);}else if(_0x21e097){if(_0x21e097[_0xceeb('0x4')]instanceof Buffer){fs[_0xceeb('0x5')](_0x55c3da,_0x21e097[_0xceeb('0x4')],function(_0x3a606e){if(_0x3a606e){_0xdff1b(_0x3a606e);}else{_0x5a11b0();}});}else{_0xdff1b(new Error('Invalid\x20data\x20response\x20from\x20aws\x20Polly!'));}}else{_0xdff1b(new Error(_0xceeb('0x6')));}});});}module['exports']=function(_0x200efe,_0x12e1ca,_0x169ef4,_0x580f9b,_0x3b8be7,_0x20e309,_0x53c1db){var _0x3aa7af=new AWS[(_0xceeb('0x7'))]({'accessKeyId':_0x200efe,'secretAccessKey':_0x12e1ca,'region':_0x169ef4});var _0x1ce8d5={'Text':_0x3b8be7,'TextType':_0x20e309||_0xceeb('0x8'),'OutputFormat':_0xceeb('0x9'),'VoiceId':_0x580f9b};return pollyResult(_0x3aa7af,_0x1ce8d5,_0x53c1db);}; \ No newline at end of file +var _0x2cca=['text','mp3','path','bluebird','randomstring','aws-sdk','synthesizeSpeech','AudioStream','writeFile','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2cca,0xe6));var _0xa2cc=function(_0x2c4b5b,_0x55f4bc){_0x2c4b5b=_0x2c4b5b-0x0;var _0x24a9b7=_0x2cca[_0x2c4b5b];return _0x24a9b7;};'use strict';var fs=require('fs');var path=require(_0xa2cc('0x0'));var BPromise=require(_0xa2cc('0x1'));var rs=require(_0xa2cc('0x2'));var AWS=require(_0xa2cc('0x3'));function pollyResult(_0x5e50a6,_0x37cf65,_0x4fe6a9){return new BPromise(function(_0x2c6419,_0xc4ace6){_0x5e50a6[_0xa2cc('0x4')](_0x37cf65,function(_0x5853b3,_0x509dae){if(_0x5853b3){_0xc4ace6(_0x5853b3);}else if(_0x509dae){if(_0x509dae[_0xa2cc('0x5')]instanceof Buffer){fs[_0xa2cc('0x6')](_0x4fe6a9,_0x509dae[_0xa2cc('0x5')],function(_0x3591d5){if(_0x3591d5){_0xc4ace6(_0x3591d5);}else{_0x2c6419();}});}else{_0xc4ace6(new Error(_0xa2cc('0x7')));}}else{_0xc4ace6(new Error(_0xa2cc('0x8')));}});});}module[_0xa2cc('0x9')]=function(_0x110793,_0x32d549,_0x575745,_0x3a0268,_0x4c3038,_0x2ebab4,_0x1ee207){var _0x3616e0=new AWS['Polly']({'accessKeyId':_0x110793,'secretAccessKey':_0x32d549,'region':_0x575745});var _0x36c224={'Text':_0x4c3038,'TextType':_0x2ebab4||_0xa2cc('0xa'),'OutputFormat':_0xa2cc('0xb'),'VoiceId':_0x3a0268};return pollyResult(_0x3616e0,_0x36c224,_0x1ee207);}; \ 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 53a27a3..4dcaf64 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 _0x15c7=['exports','./lib/api'];(function(_0x52ca7a,_0x3d33c3){var _0x575fd0=function(_0x5142dc){while(--_0x5142dc){_0x52ca7a['push'](_0x52ca7a['shift']());}};_0x575fd0(++_0x3d33c3);}(_0x15c7,0x87));var _0x715c=function(_0x258912,_0x278937){_0x258912=_0x258912-0x0;var _0x1b3840=_0x15c7[_0x258912];return _0x1b3840;};'use strict';var asr=require(_0x715c('0x0'));module[_0x715c('0x1')]=function(_0x4be1cb,_0x4f19b3,_0x5ed378,_0x750555){return asr(_0x4be1cb,_0x4f19b3,_0x5ed378);}; \ No newline at end of file +var _0x2839=['./lib/api'];(function(_0x450234,_0x5754f1){var _0x3d57a3=function(_0x535eb8){while(--_0x535eb8){_0x450234['push'](_0x450234['shift']());}};_0x3d57a3(++_0x5754f1);}(_0x2839,0x17a));var _0x9283=function(_0x56bc9e,_0x335976){_0x56bc9e=_0x56bc9e-0x0;var _0x10c7f9=_0x2839[_0x56bc9e];return _0x10c7f9;};'use strict';var asr=require(_0x9283('0x0'));module['exports']=function(_0x2723d2,_0x5bc376,_0x293e8c,_0x29f59e){return asr(_0x2723d2,_0x5bc376,_0x293e8c);}; \ 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 c27a9de..7c5db12 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 _0x0a9a=['POST','8000','bluebird','exports','length','filepath\x20should\x20be\x20a\x20string','string','undefined','lang\x20should\x20be\x20a\x20string','readFileSync','toString'];(function(_0x1203f,_0x554bbc){var _0x365f0a=function(_0x3531d0){while(--_0x3531d0){_0x1203f['push'](_0x1203f['shift']());}};_0x365f0a(++_0x554bbc);}(_0x0a9a,0x183));var _0xa0a9=function(_0xfba51c,_0x349204){_0xfba51c=_0xfba51c-0x0;var _0x105686=_0x0a9a[_0xfba51c];return _0x105686;};'use strict';var url=require('url');var BPromise=require(_0xa0a9('0x0'));var fs=require('fs');var host='https://speech.googleapis.com';module[_0xa0a9('0x1')]=function(_0x3cff22,_0x34801b,_0x49162f){return new BPromise(function(_0x4ba993,_0x317a94){var _0x360be5;if(typeof _0x3cff22!=='string'||_0x3cff22[_0xa0a9('0x2')]===0x0){return _0x317a94(_0xa0a9('0x3'));}if(typeof _0x34801b!==_0xa0a9('0x4')||_0x34801b[_0xa0a9('0x2')]===0x0){return _0x317a94('key\x20should\x20be\x20a\x20string');}if(typeof _0x49162f!==_0xa0a9('0x5')&&(typeof _0x49162f!=='string'||_0x49162f[_0xa0a9('0x2')]===0x0)){return _0x317a94(_0xa0a9('0x6'));}try{_0x360be5=fs[_0xa0a9('0x7')](_0x3cff22)[_0xa0a9('0x8')]('base64');}catch(_0x2ba0ac){return _0x317a94(_0x2ba0ac);}return _0x4ba993({'method':_0xa0a9('0x9'),'uri':host+'/v1/speech:recognize?key='+_0x34801b,'body':{'config':{'encoding':'LINEAR16','sampleRateHertz':_0xa0a9('0xa'),'languageCode':_0x49162f},'audio':{'content':_0x360be5}},'json':!![]});});}; \ No newline at end of file +var _0xb377=['string','length','lang\x20should\x20be\x20a\x20string','readFileSync','toString','base64','POST','LINEAR16','8000','url','bluebird','https://speech.googleapis.com','exports'];(function(_0x5d7726,_0x57adac){var _0x521e1c=function(_0x3799a1){while(--_0x3799a1){_0x5d7726['push'](_0x5d7726['shift']());}};_0x521e1c(++_0x57adac);}(_0xb377,0x1b6));var _0x7b37=function(_0x57a61d,_0x18435e){_0x57a61d=_0x57a61d-0x0;var _0x4489a8=_0xb377[_0x57a61d];return _0x4489a8;};'use strict';var url=require(_0x7b37('0x0'));var BPromise=require(_0x7b37('0x1'));var fs=require('fs');var host=_0x7b37('0x2');module[_0x7b37('0x3')]=function(_0xbcbce6,_0x36868b,_0x15bc68){return new BPromise(function(_0x3c4851,_0x2018bd){var _0x13f4c4;if(typeof _0xbcbce6!==_0x7b37('0x4')||_0xbcbce6[_0x7b37('0x5')]===0x0){return _0x2018bd('filepath\x20should\x20be\x20a\x20string');}if(typeof _0x36868b!=='string'||_0x36868b[_0x7b37('0x5')]===0x0){return _0x2018bd('key\x20should\x20be\x20a\x20string');}if(typeof _0x15bc68!=='undefined'&&(typeof _0x15bc68!==_0x7b37('0x4')||_0x15bc68[_0x7b37('0x5')]===0x0)){return _0x2018bd(_0x7b37('0x6'));}try{_0x13f4c4=fs[_0x7b37('0x7')](_0xbcbce6)[_0x7b37('0x8')](_0x7b37('0x9'));}catch(_0x4610cd){return _0x2018bd(_0x4610cd);}return _0x3c4851({'method':_0x7b37('0xa'),'uri':host+'/v1/speech:recognize?key='+_0x36868b,'body':{'config':{'encoding':_0x7b37('0xb'),'sampleRateHertz':_0x7b37('0xc'),'languageCode':_0x15bc68},'audio':{'content':_0x13f4c4}},'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 1c16a6d..0a3ca61 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 _0xf652=['./asr','exports'];(function(_0x2f37ea,_0x16d608){var _0x331762=function(_0x2bc195){while(--_0x2bc195){_0x2f37ea['push'](_0x2f37ea['shift']());}};_0x331762(++_0x16d608);}(_0xf652,0x90));var _0x2f65=function(_0x33b4ec,_0x3e1117){_0x33b4ec=_0x33b4ec-0x0;var _0x3c25d4=_0xf652[_0x33b4ec];return _0x3c25d4;};var asr=require(_0x2f65('0x0'));module[_0x2f65('0x1')]={'asr':asr}; \ No newline at end of file +var _0x409d=['exports','./asr'];(function(_0x571b9c,_0x31fa45){var _0x56a62c=function(_0x400db4){while(--_0x400db4){_0x571b9c['push'](_0x571b9c['shift']());}};_0x56a62c(++_0x31fa45);}(_0x409d,0x17f));var _0xd409=function(_0x1c30df,_0x2b46a5){_0x1c30df=_0x1c30df-0x0;var _0x4d30e6=_0x409d[_0x1c30df];return _0x4d30e6;};var asr=require(_0xd409('0x0'));module[_0xd409('0x1')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/scripts/index.js b/server/services/agi/scripts/index.js index 1f03ec1..3396822 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 _0x0a52=['randomstring','sox','google-tts-api','url','util','./aws','./google','./sestek','./tilde','agi','https://api.ispeech.org/api/rest','protocol','https:','host','path','WHAT_EVER','get','error','statusCode','statusMessage','\x20failed,\x20status\x20code\x20=\x20','finish','info','finish\x20download\x20file','close','unlink','download\x20error','pipe','end','request\x20to\x20','data','transcode','wav','finish\x20to\x20convert','start','resolve','generate','.wav','writeFileSync','base64','then','chmodSync','toString','googleCloudTTS','https://texttospeech.googleapis.com/v1/','?key=','ssml','input','voice','MP3','POST','tmp','.mp3','from','writeFile','777','split','googleTTS','utf8','f.req=','jQ1olc','stringify','parse\x20response\x20failed:\x0a','length','text\x20length\x20limit\x20reached','lang\x20\x22','goggleTTS\x20path','asr','uri','results','map','alternatives','transcript','join','confidence','googleASR\x20transcription','googleASR\x20confidence','catch','[%s]\x20%s:%s','name','message','textRequest','result','source','resolvedQuery','action','actionIncomplete','speech','score','status','metadata','endConversation','replace','SessionsClient','detectIntent','Dialogflow\x20V2\x20response:','queryResult','allRequiredParamsPresent','diagnosticInfo','fields','end_conversation','boolValue','fulfillmentText','intent','isFallback','languageCode','queryText','responseId','intentDetectionConfidence','tildeASR','Tilde\x20ASR\x20confidence','awsPolly','polly','awsLex','lex','ispeechTTS','format','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','freeform=3','parse','sestekNDA','nda','text','channelData','Data','audiofile','bluebird','dialogflow','http','https','querystring','request-promise'];(function(_0x31a37b,_0x826249){var _0x49ae16=function(_0x2e8d52){while(--_0x2e8d52){_0x31a37b['push'](_0x31a37b['shift']());}};_0x49ae16(++_0x826249);}(_0x0a52,0x7e));var _0x20a5=function(_0x293fd1,_0x3a764f){_0x293fd1=_0x293fd1-0x0;var _0x3e6604=_0x0a52[_0x293fd1];return _0x3e6604;};'use strict';var apiai=require('apiai-promise');var BPromise=require(_0x20a5('0x0'));var dialogflow=require(_0x20a5('0x1'));var fs=require('fs');var http=require(_0x20a5('0x2'));var https=require(_0x20a5('0x3'));var md5=require('md5');var path=require('path');var querystring=require(_0x20a5('0x4'));var rp=require(_0x20a5('0x5'));var rs=require(_0x20a5('0x6'));var sox=require(_0x20a5('0x7'));var tts=require(_0x20a5('0x8'));var urlParse=require(_0x20a5('0x9'))['parse'];var util=require(_0x20a5('0xa'));var aws=require(_0x20a5('0xb'));var google=require(_0x20a5('0xc'));var sestek=require(_0x20a5('0xd'));var tilde=require(_0x20a5('0xe'));var logger=require('../../../config/logger')(_0x20a5('0xf'));var ISPEECH_API=_0x20a5('0x10');function downloadFile(_0x15115f,_0x4709cd){return new BPromise(function(_0x2eed3c,_0x15ae59){var _0x81260f=urlParse(_0x15115f);var _0x9b828=_0x81260f[_0x20a5('0x11')]===_0x20a5('0x12')?https:http;var _0x5a4263={'host':_0x81260f[_0x20a5('0x13')],'path':_0x81260f[_0x20a5('0x14')],'headers':{'user-agent':_0x20a5('0x15')}};_0x9b828[_0x20a5('0x16')](_0x5a4263,function(_0x485d02){if(_0x485d02['statusCode']!==0xc8){logger[_0x20a5('0x17')]('request\x20to\x20'+_0x15115f+'\x20failed,\x20status\x20code\x20=\x20'+_0x485d02[_0x20a5('0x18')]+'\x20('+_0x485d02[_0x20a5('0x19')]+')');_0x15ae59(new Error('request\x20to\x20'+_0x15115f+_0x20a5('0x1a')+_0x485d02[_0x20a5('0x18')]+'\x20('+_0x485d02['statusMessage']+')'));return;}var _0x53dea9=fs['createWriteStream'](_0x4709cd);_0x53dea9['on'](_0x20a5('0x1b'),function(){logger[_0x20a5('0x1c')](_0x20a5('0x1d'));_0x53dea9[_0x20a5('0x1e')](_0x2eed3c);});_0x53dea9['on'](_0x20a5('0x17'),function(_0x3ecdc8){fs[_0x20a5('0x1f')](_0x4709cd);logger[_0x20a5('0x17')](_0x20a5('0x20'),_0x3ecdc8);_0x15ae59(_0x3ecdc8);});_0x485d02[_0x20a5('0x21')](_0x53dea9);})['on'](_0x20a5('0x17'),function(_0x2219ac){logger[_0x20a5('0x17')](_0x2219ac);_0x15ae59(_0x2219ac);})[_0x20a5('0x22')]();});}function uploadFile(_0x1fdca2){return new BPromise(function(_0x6b4b69,_0xa46669){var _0x24a0d5=urlParse(_0x1fdca2);var _0x14d0b5=_0x24a0d5['protocol']===_0x20a5('0x12')?https:http;var _0x5275af={'host':_0x24a0d5[_0x20a5('0x13')],'path':_0x24a0d5[_0x20a5('0x14')],'headers':{'user-agent':'WHAT_EVER'}};_0x14d0b5[_0x20a5('0x16')](_0x5275af,function(_0x249a1d){if(_0x249a1d['statusCode']!==0xc8){_0xa46669(new Error(_0x20a5('0x23')+_0x1fdca2+'\x20failed,\x20status\x20code\x20=\x20'+_0x249a1d[_0x20a5('0x18')]+'\x20('+_0x249a1d[_0x20a5('0x19')]+')'));return;}var _0x203be8='';_0x249a1d['on'](_0x20a5('0x24'),function(_0x2285e8){_0x203be8+=_0x2285e8;});_0x249a1d['on'](_0x20a5('0x22'),function(){_0x6b4b69(_0x203be8);});})['on']('error',function(_0x4fe821){_0xa46669(_0x4fe821);})[_0x20a5('0x22')]();});}function convertFile(_0x3fc615,_0x42618b){return new BPromise(function(_0x2d6ea5,_0x182176){var _0x31aabf=sox[_0x20a5('0x25')](_0x3fc615,_0x42618b,{'sampleRate':0x1f40,'format':_0x20a5('0x26'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x31aabf['on']('error',function(_0x39e4ef){logger['error']('error\x20convert',_0x39e4ef);_0x182176(_0x39e4ef);});_0x31aabf['on'](_0x20a5('0x22'),function(){logger[_0x20a5('0x1c')](_0x20a5('0x27'));_0x2d6ea5();});_0x31aabf[_0x20a5('0x28')]();});}function base64Decode(_0x494b18,_0x5eb146){var _0x3dc70c=path[_0x20a5('0x29')](__dirname,'tmp',rs[_0x20a5('0x2a')](0x4)+_0x20a5('0x2b'));fs[_0x20a5('0x2c')](_0x3dc70c,_0x494b18,_0x20a5('0x2d'));return convertFile(_0x3dc70c,_0x5eb146)[_0x20a5('0x2e')](function(){try{fs[_0x20a5('0x1f')](_0x3dc70c);fs[_0x20a5('0x2f')](_0x5eb146,'777');}catch(_0x28a79c){logger[_0x20a5('0x17')](_0x28a79c);}return _0x5eb146['split']('.')[0x0];});}function base64Encode(_0x3a25b1){var _0x22faaa=fs['readFileSync'](_0x3a25b1);return new Buffer(_0x22faaa)[_0x20a5('0x30')]('base64');}exports[_0x20a5('0x31')]=function(_0x1de453,_0x317632,_0x32786e,_0x48ce33,_0x5015f5,_0x2ef382){var _0x1d32eb,_0x1cb851;var _0x2a47fa=_0x20a5('0x32');var _0x599ec2=_0x20a5('0x33')+_0x1de453;var _0x4e75df={};if(_0x317632===_0x20a5('0x34')){_0x4e75df[_0x20a5('0x35')]={'ssml':_0x32786e};}else{_0x4e75df[_0x20a5('0x35')]={'text':_0x32786e};};_0x4e75df[_0x20a5('0x36')]={'languageCode':_0x48ce33,'ssmlGender':_0x5015f5};_0x4e75df['audioConfig']={'audioEncoding':_0x20a5('0x37'),'sampleRateHertz':0x1f40};var _0x361762={'url':_0x2a47fa+'text:synthesize'+_0x599ec2,'method':_0x20a5('0x38'),'json':!![],'body':_0x4e75df};return rp(_0x361762)['then'](function(_0x3d89a0){return new BPromise(function(_0x5fa11c,_0x403a01){_0x1d32eb=path[_0x20a5('0x29')](__dirname,_0x20a5('0x39'),rs[_0x20a5('0x2a')](0x4)+_0x20a5('0x3a'));var _0x101947=Buffer[_0x20a5('0x3b')](_0x3d89a0['audioContent'],'base64');return fs[_0x20a5('0x3c')](_0x1d32eb,_0x101947,function(_0x225cd2){_0x403a01(_0x225cd2);},function(_0x29fcb0){fs[_0x20a5('0x2f')](_0x1d32eb,_0x20a5('0x3d'));_0x5fa11c(_0x29fcb0);});});})[_0x20a5('0x2e')](function(_0x5b6f6c){_0x1cb851=path['resolve'](__dirname,_0x20a5('0x39'),rs[_0x20a5('0x2a')](0x4)+_0x20a5('0x2b'));return convertFile(_0x1d32eb,_0x1cb851);})[_0x20a5('0x2e')](function(){try{fs[_0x20a5('0x1f')](_0x1d32eb);fs[_0x20a5('0x2f')](_0x1cb851,_0x20a5('0x3d'));}catch(_0x211cb8){logger[_0x20a5('0x17')](_0x211cb8);}logger[_0x20a5('0x1c')]('googleCloudTTS\x20path',_0x1cb851['split']('.')[0x0]);return _0x1cb851[_0x20a5('0x3e')]('.')[0x0];});};exports[_0x20a5('0x3f')]=function(_0x12499c,_0x4fe661){var _0x3c3d9e='https://translate.google.com/_/TranslateWebserverUi/data/batchexecute';var _0x5d2232,_0x17147d;var _0x12bd18;var _0x3cd91b={'encoding':_0x20a5('0x40'),'method':_0x20a5('0x38'),'timeout':0x2710,'url':_0x3c3d9e,'headers':{'Content-Type':'application/x-www-form-urlencoded'},'body':_0x20a5('0x41')+encodeURIComponent(JSON['stringify']([[[_0x20a5('0x42'),JSON[_0x20a5('0x43')]([_0x12499c,_0x4fe661||'en',![],'null']),null,'generic']]]))};return rp(_0x3cd91b)['then'](function(_0x786190){try{_0x12bd18=eval(_0x786190['slice'](0x5))[0x0][0x2];}catch(_0x3540ae){throw new Error(_0x20a5('0x44')+_0x786190[_0x20a5('0x24')]);}if(!_0x12bd18){if(_0x12499c[_0x20a5('0x45')]>0xc8){throw new Error(_0x20a5('0x46'));}else{throw new Error(_0x20a5('0x47')+_0x4fe661+'\x22\x20might\x20not\x20exist');}}try{_0x12bd18=eval(_0x12bd18)[0x0];}catch(_0x3e43fb){throw new Error(_0x20a5('0x44')+res[_0x20a5('0x24')]);}const _0x263269=_0x12bd18;_0x5d2232=path['resolve'](__dirname,_0x20a5('0x39'),rs[_0x20a5('0x2a')](0x4)+'.mp3');fs['writeFileSync'](_0x5d2232,_0x12bd18,{'encoding':_0x20a5('0x2d')});_0x17147d=path['resolve'](__dirname,_0x20a5('0x39'),rs[_0x20a5('0x2a')](0x4)+_0x20a5('0x2b'));return convertFile(_0x5d2232,_0x17147d);})[_0x20a5('0x2e')](function(){try{fs[_0x20a5('0x1f')](_0x5d2232);fs[_0x20a5('0x2f')](_0x17147d,_0x20a5('0x3d'));}catch(_0x1f497d){logger[_0x20a5('0x17')](_0x1f497d);}logger['info'](_0x20a5('0x48'),_0x17147d[_0x20a5('0x3e')]('.')[0x0]);return _0x17147d['split']('.')[0x0];});};exports['googleASR']=function(_0x592a0c,_0xa7d198,_0x114840){return google[_0x20a5('0x49')](_0x592a0c,_0xa7d198,_0x114840)[_0x20a5('0x2e')](function(_0x5758d8){logger['info'](_0x5758d8[_0x20a5('0x4a')]);return rp(_0x5758d8);})[_0x20a5('0x2e')](function(_0xee5ac0){var _0x102fa9='';var _0xaab9d7=0x0;try{fs[_0x20a5('0x1f')](_0x592a0c);}catch(_0x5b62a0){logger[_0x20a5('0x17')](_0x5b62a0);}if(_0xee5ac0&&_0xee5ac0[_0x20a5('0x4b')]){_0x102fa9=_0xee5ac0[_0x20a5('0x4b')][_0x20a5('0x4c')](function(_0x2eb7f0){return _0x2eb7f0&&_0x2eb7f0[_0x20a5('0x4d')][0x0]&&_0x2eb7f0[_0x20a5('0x4d')][0x0][_0x20a5('0x4e')]?_0x2eb7f0[_0x20a5('0x4d')][0x0][_0x20a5('0x4e')]:'';})[_0x20a5('0x4f')]('\x0a');_0xaab9d7=_0xee5ac0[_0x20a5('0x4b')][_0x20a5('0x4c')](function(_0x43fa8f){return _0x43fa8f&&_0x43fa8f[_0x20a5('0x4d')][0x0]&&_0x43fa8f[_0x20a5('0x4d')][0x0][_0x20a5('0x50')]?_0x43fa8f['alternatives'][0x0][_0x20a5('0x50')]:0x0;})[_0x20a5('0x4f')]('\x0a');}logger[_0x20a5('0x1c')](_0x20a5('0x51'),_0x102fa9);logger[_0x20a5('0x1c')](_0x20a5('0x52'),_0xaab9d7);return{'transcript':_0x102fa9,'confidence':_0xaab9d7};})[_0x20a5('0x53')](function(_0x2dd843){logger['error'](_0x20a5('0x54'),_0x2dd843[_0x20a5('0x18')],_0x2dd843[_0x20a5('0x55')],_0x2dd843[_0x20a5('0x56')]);});};exports['googleDialogflow']=function(_0x133e2c,_0x1bc9d1,_0x802b0b,_0x4cb5b9){var _0x29e34a=apiai(_0x1bc9d1,{'language':_0x4cb5b9||'en'});return _0x29e34a[_0x20a5('0x57')](_0x802b0b,{'sessionId':md5(_0x133e2c)})['then'](function(_0x458eac){logger[_0x20a5('0x1c')](JSON['stringify'](_0x458eac));return{'source':_0x458eac[_0x20a5('0x58')][_0x20a5('0x59')],'resolvedQuery':_0x458eac[_0x20a5('0x58')][_0x20a5('0x5a')],'action':_0x458eac['result'][_0x20a5('0x5b')],'actionIncomplete':_0x458eac[_0x20a5('0x58')][_0x20a5('0x5c')],'speech':_0x458eac[_0x20a5('0x58')]['fulfillment'][_0x20a5('0x5d')],'score':_0x458eac['result'][_0x20a5('0x5e')],'statusCode':_0x458eac[_0x20a5('0x5f')]['code'],'endConversation':_0x458eac['result'][_0x20a5('0x60')][_0x20a5('0x61')]||![],'isFallbackIntent':_0x458eac[_0x20a5('0x58')][_0x20a5('0x60')]['isFallbackIntent']};});};exports['googleDialogflowV2']=function(_0x3855b4,_0x2669ec,_0x54698d,_0x4f18c5,_0x2f74ad,_0x1ab5aa){var _0x4b39b6=_0x4f18c5[_0x20a5('0x62')](/\\n/g,'\x0a');var _0x3d9e12={'credentials':{'private_key':_0x4b39b6,'client_email':_0x54698d}};var _0x528c30=new dialogflow[(_0x20a5('0x63'))](_0x3d9e12);var _0x34cd9b=_0x528c30['sessionPath'](_0x2669ec,md5(_0x3855b4));var _0x3e17bc={'session':_0x34cd9b,'queryInput':{'text':{'text':_0x2f74ad,'languageCode':_0x1ab5aa}}};return _0x528c30[_0x20a5('0x64')](_0x3e17bc)['then'](function(_0x2de1f3){if(_0x2de1f3&&_0x2de1f3[_0x20a5('0x45')]){logger[_0x20a5('0x1c')](_0x20a5('0x65'),JSON['stringify'](_0x2de1f3));var _0x234c88=_0x2de1f3[0x0];if(_0x234c88){var _0x5ca040={'action':_0x234c88[_0x20a5('0x66')][_0x20a5('0x5b')],'allRequiredParamsPresent':_0x234c88[_0x20a5('0x66')][_0x20a5('0x67')],'endConversation':_0x234c88[_0x20a5('0x66')][_0x20a5('0x68')]&&_0x234c88[_0x20a5('0x66')][_0x20a5('0x68')][_0x20a5('0x69')]?_0x234c88[_0x20a5('0x66')][_0x20a5('0x68')]['fields'][_0x20a5('0x6a')][_0x20a5('0x6b')]:![],'fulfillmentText':_0x234c88['queryResult'][_0x20a5('0x6c')],'intentName':_0x234c88['queryResult'][_0x20a5('0x6d')][_0x20a5('0x55')],'intentDisplayName':_0x234c88['queryResult']['intent']['displayName'],'isFallbackIntent':_0x234c88[_0x20a5('0x66')][_0x20a5('0x6d')][_0x20a5('0x6e')],'languageCode':_0x234c88[_0x20a5('0x66')][_0x20a5('0x6f')],'queryText':_0x234c88[_0x20a5('0x66')][_0x20a5('0x70')],'responseId':_0x234c88[_0x20a5('0x71')],'score':_0x234c88['queryResult'][_0x20a5('0x72')],'speech':_0x234c88[_0x20a5('0x66')][_0x20a5('0x6c')],'providerResponse':JSON[_0x20a5('0x43')](_0x2de1f3)};return _0x5ca040;}}});};exports[_0x20a5('0x73')]=function(_0x38eaeb,_0x387093,_0x171968,_0x12860e){return tilde[_0x20a5('0x49')](_0x38eaeb,_0x387093,_0x171968,_0x12860e)[_0x20a5('0x2e')](function(_0x1072b0){try{fs[_0x20a5('0x1f')](_0x38eaeb);}catch(_0x46d4ae){logger['error'](_0x46d4ae);}logger['info']('Tilde\x20ASR\x20transcription',_0x1072b0['transcript']);logger['info'](_0x20a5('0x74'),_0x1072b0[_0x20a5('0x50')]);return _0x1072b0;});};exports[_0x20a5('0x75')]=function(_0x261ced,_0x59baa0,_0x4373d3,_0x48da4f,_0x326b3b,_0x5f215c){var _0x521740=path['resolve'](__dirname,_0x20a5('0x39'),rs[_0x20a5('0x2a')](0x4)+_0x20a5('0x3a'));var _0x4a8296;return aws[_0x20a5('0x76')](_0x261ced,_0x59baa0,_0x4373d3,_0x48da4f,_0x326b3b,_0x5f215c,_0x521740)[_0x20a5('0x2e')](function(){_0x4a8296=path[_0x20a5('0x29')](__dirname,_0x20a5('0x39'),rs[_0x20a5('0x2a')](0x4)+_0x20a5('0x2b'));return convertFile(_0x521740,_0x4a8296);})[_0x20a5('0x2e')](function(){try{fs[_0x20a5('0x1f')](_0x521740);fs[_0x20a5('0x2f')](_0x4a8296,_0x20a5('0x3d'));}catch(_0x3fba0a){logger[_0x20a5('0x17')](_0x3fba0a);}return _0x4a8296['split']('.')[0x0];});};exports[_0x20a5('0x77')]=function(_0x1c7192,_0x20cb76,_0x49d760,_0x4a459e,_0x29b557,_0x4beac7){return aws[_0x20a5('0x78')](_0x1c7192,_0x20cb76,_0x49d760,_0x4a459e,_0x29b557,_0x4beac7)[_0x20a5('0x2e')](function(_0x378b9e){logger['info'](JSON['stringify'](_0x378b9e));return _0x378b9e;});};exports[_0x20a5('0x79')]=function(_0x40d10e,_0x1f2815,_0x95dbfc,_0x30cf18){var _0xb530b6=util[_0x20a5('0x7a')]('%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3',ISPEECH_API,_0x40d10e,encodeURIComponent(_0x1f2815),_0x95dbfc,_0x30cf18);var _0x37b0e9=path[_0x20a5('0x29')](__dirname,'tmp',rs['generate'](0x4)+_0x20a5('0x3a'));var _0x4489c9;return downloadFile(_0xb530b6,_0x37b0e9)[_0x20a5('0x2e')](function(){_0x4489c9=path[_0x20a5('0x29')](__dirname,_0x20a5('0x39'),rs[_0x20a5('0x2a')](0x4)+_0x20a5('0x2b'));return convertFile(_0x37b0e9,_0x4489c9);})[_0x20a5('0x2e')](function(){try{fs[_0x20a5('0x1f')](_0x37b0e9);fs['chmodSync'](_0x4489c9,_0x20a5('0x3d'));}catch(_0x2e1d8e){logger[_0x20a5('0x17')](_0x2e1d8e);}return _0x4489c9[_0x20a5('0x3e')]('.')[0x0];});};exports['ispeechASR']=function(_0x4d0043,_0x206a50,_0x5c09a3,_0x2b0358){var _0x1d8b10=util[_0x20a5('0x7a')](_0x20a5('0x7b'),ISPEECH_API,_0x206a50,_0x5c09a3,base64Encode(_0x4d0043),_0x2b0358?util[_0x20a5('0x7a')]('model=%s',encodeURIComponent(_0x2b0358)):_0x20a5('0x7c'));return uploadFile(_0x1d8b10)[_0x20a5('0x2e')](function(_0x47f85d){return querystring[_0x20a5('0x7d')](_0x47f85d);});};exports[_0x20a5('0x7e')]=function(_0x5a3bf2,_0x53d3b4){return sestek[_0x20a5('0x7f')](_0x5a3bf2,_0x53d3b4)[_0x20a5('0x2e')](function(_0x102f99){logger[_0x20a5('0x1c')](JSON['stringify'](_0x102f99));var _0x51e22e={'speech':_0x102f99[_0x20a5('0x80')],'action':_0x102f99[_0x20a5('0x81')]?_0x102f99[_0x20a5('0x81')]['CustomAction']:undefined,'actiondata':_0x102f99['channelData']?_0x102f99[_0x20a5('0x81')]['CustomActionData']:undefined};if(_0x102f99[_0x20a5('0x81')]&&_0x102f99[_0x20a5('0x81')]['AudioFromTts']){return base64Decode(_0x102f99[_0x20a5('0x81')]['AudioFromTts'][_0x20a5('0x82')],path[_0x20a5('0x29')](__dirname,_0x20a5('0x39'),rs[_0x20a5('0x2a')](0x4)+_0x20a5('0x2b')))[_0x20a5('0x2e')](function(_0x4ec298){_0x51e22e[_0x20a5('0x83')]=_0x4ec298;return _0x51e22e;});}return _0x51e22e;});};exports['dirName']=function(){return __dirname;}; \ No newline at end of file +var _0x5457=['source','action','actionIncomplete','fulfillment','score','status','metadata','endConversation','isFallbackIntent','replace','SessionsClient','detectIntent','Dialogflow\x20V2\x20response:','queryResult','diagnosticInfo','fields','fulfillmentText','intent','displayName','languageCode','queryText','responseId','intentDetectionConfidence','tildeASR','Tilde\x20ASR\x20transcription','polly','awsLex','lex','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','freeform=3','sestekNDA','nda','text','channelData','CustomAction','CustomActionData','AudioFromTts','Data','audiofile','dirName','apiai-promise','bluebird','http','https','md5','path','querystring','request-promise','sox','google-tts-api','url','parse','util','./google','./tilde','../../../config/logger','agi','https://api.ispeech.org/api/rest','protocol','host','WHAT_EVER','statusCode','error','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusMessage','createWriteStream','finish','info','finish\x20download\x20file','close','unlink','pipe','data','end','transcode','wav','error\x20convert','finish\x20to\x20convert','start','tmp','generate','.wav','writeFileSync','base64','then','chmodSync','777','split','readFileSync','googleCloudTTS','https://texttospeech.googleapis.com/v1/','?key=','ssml','input','voice','audioConfig','MP3','text:synthesize','resolve','.mp3','from','audioContent','writeFile','googleCloudTTS\x20path','googleTTS','utf8','POST','application/x-www-form-urlencoded','f.req=','stringify','jQ1olc','null','generic','parse\x20response\x20failed:\x0a','length','text\x20length\x20limit\x20reached','lang\x20\x22','\x22\x20might\x20not\x20exist','goggleTTS\x20path','googleASR','asr','results','map','alternatives','transcript','join','confidence','googleASR\x20transcription','catch','[%s]\x20%s:%s','name','googleDialogflow','result'];(function(_0x5c9820,_0x4386b7){var _0x3e9eb3=function(_0x3babd9){while(--_0x3babd9){_0x5c9820['push'](_0x5c9820['shift']());}};_0x3e9eb3(++_0x4386b7);}(_0x5457,0x13a));var _0x7545=function(_0x3f7701,_0xdf0a0a){_0x3f7701=_0x3f7701-0x0;var _0x380fb2=_0x5457[_0x3f7701];return _0x380fb2;};'use strict';var apiai=require(_0x7545('0x0'));var BPromise=require(_0x7545('0x1'));var dialogflow=require('dialogflow');var fs=require('fs');var http=require(_0x7545('0x2'));var https=require(_0x7545('0x3'));var md5=require(_0x7545('0x4'));var path=require(_0x7545('0x5'));var querystring=require(_0x7545('0x6'));var rp=require(_0x7545('0x7'));var rs=require('randomstring');var sox=require(_0x7545('0x8'));var tts=require(_0x7545('0x9'));var urlParse=require(_0x7545('0xa'))[_0x7545('0xb')];var util=require(_0x7545('0xc'));var aws=require('./aws');var google=require(_0x7545('0xd'));var sestek=require('./sestek');var tilde=require(_0x7545('0xe'));var logger=require(_0x7545('0xf'))(_0x7545('0x10'));var ISPEECH_API=_0x7545('0x11');function downloadFile(_0x17b45d,_0x2fa7c3){return new BPromise(function(_0x511889,_0x458c83){var _0x2a9e97=urlParse(_0x17b45d);var _0x3ee4cd=_0x2a9e97[_0x7545('0x12')]==='https:'?https:http;var _0x3509e4={'host':_0x2a9e97[_0x7545('0x13')],'path':_0x2a9e97['path'],'headers':{'user-agent':_0x7545('0x14')}};_0x3ee4cd['get'](_0x3509e4,function(_0x266c70){if(_0x266c70[_0x7545('0x15')]!==0xc8){logger[_0x7545('0x16')](_0x7545('0x17')+_0x17b45d+_0x7545('0x18')+_0x266c70[_0x7545('0x15')]+'\x20('+_0x266c70[_0x7545('0x19')]+')');_0x458c83(new Error(_0x7545('0x17')+_0x17b45d+'\x20failed,\x20status\x20code\x20=\x20'+_0x266c70['statusCode']+'\x20('+_0x266c70[_0x7545('0x19')]+')'));return;}var _0x399e6c=fs[_0x7545('0x1a')](_0x2fa7c3);_0x399e6c['on'](_0x7545('0x1b'),function(){logger[_0x7545('0x1c')](_0x7545('0x1d'));_0x399e6c[_0x7545('0x1e')](_0x511889);});_0x399e6c['on'](_0x7545('0x16'),function(_0x586252){fs[_0x7545('0x1f')](_0x2fa7c3);logger[_0x7545('0x16')]('download\x20error',_0x586252);_0x458c83(_0x586252);});_0x266c70[_0x7545('0x20')](_0x399e6c);})['on'](_0x7545('0x16'),function(_0xb8c04f){logger[_0x7545('0x16')](_0xb8c04f);_0x458c83(_0xb8c04f);})['end']();});}function uploadFile(_0x3eaffd){return new BPromise(function(_0x48d87d,_0x3303dd){var _0x37067a=urlParse(_0x3eaffd);var _0x2ff5f7=_0x37067a[_0x7545('0x12')]==='https:'?https:http;var _0xdcb6ff={'host':_0x37067a[_0x7545('0x13')],'path':_0x37067a['path'],'headers':{'user-agent':'WHAT_EVER'}};_0x2ff5f7['get'](_0xdcb6ff,function(_0x5c8a51){if(_0x5c8a51[_0x7545('0x15')]!==0xc8){_0x3303dd(new Error('request\x20to\x20'+_0x3eaffd+'\x20failed,\x20status\x20code\x20=\x20'+_0x5c8a51[_0x7545('0x15')]+'\x20('+_0x5c8a51[_0x7545('0x19')]+')'));return;}var _0x3e6f72='';_0x5c8a51['on'](_0x7545('0x21'),function(_0x4c6083){_0x3e6f72+=_0x4c6083;});_0x5c8a51['on'](_0x7545('0x22'),function(){_0x48d87d(_0x3e6f72);});})['on'](_0x7545('0x16'),function(_0x3f1760){_0x3303dd(_0x3f1760);})[_0x7545('0x22')]();});}function convertFile(_0x232ab1,_0x596a46){return new BPromise(function(_0x2e4b0d,_0x3a1054){var _0x530fdb=sox[_0x7545('0x23')](_0x232ab1,_0x596a46,{'sampleRate':0x1f40,'format':_0x7545('0x24'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x530fdb['on'](_0x7545('0x16'),function(_0x36a3d7){logger['error'](_0x7545('0x25'),_0x36a3d7);_0x3a1054(_0x36a3d7);});_0x530fdb['on'](_0x7545('0x22'),function(){logger['info'](_0x7545('0x26'));_0x2e4b0d();});_0x530fdb[_0x7545('0x27')]();});}function base64Decode(_0x4dd07d,_0x29c9a7){var _0x2fe901=path['resolve'](__dirname,_0x7545('0x28'),rs[_0x7545('0x29')](0x4)+_0x7545('0x2a'));fs[_0x7545('0x2b')](_0x2fe901,_0x4dd07d,_0x7545('0x2c'));return convertFile(_0x2fe901,_0x29c9a7)[_0x7545('0x2d')](function(){try{fs[_0x7545('0x1f')](_0x2fe901);fs[_0x7545('0x2e')](_0x29c9a7,_0x7545('0x2f'));}catch(_0x384383){logger['error'](_0x384383);}return _0x29c9a7[_0x7545('0x30')]('.')[0x0];});}function base64Encode(_0x5631ca){var _0x1d6208=fs[_0x7545('0x31')](_0x5631ca);return new Buffer(_0x1d6208)['toString'](_0x7545('0x2c'));}exports[_0x7545('0x32')]=function(_0x161f1a,_0x4623da,_0x5bf397,_0x5ef025,_0x1d1db8,_0x22ff52){var _0x2164ef,_0x1ae53b;var _0x3a8fe7=_0x7545('0x33');var _0x1c5fae=_0x7545('0x34')+_0x161f1a;var _0x10344d={};if(_0x4623da===_0x7545('0x35')){_0x10344d[_0x7545('0x36')]={'ssml':_0x5bf397};}else{_0x10344d['input']={'text':_0x5bf397};};_0x10344d[_0x7545('0x37')]={'languageCode':_0x5ef025,'ssmlGender':_0x1d1db8};_0x10344d[_0x7545('0x38')]={'audioEncoding':_0x7545('0x39'),'sampleRateHertz':0x1f40};var _0x586cf7={'url':_0x3a8fe7+_0x7545('0x3a')+_0x1c5fae,'method':'POST','json':!![],'body':_0x10344d};return rp(_0x586cf7)[_0x7545('0x2d')](function(_0x27c9bb){return new BPromise(function(_0x5689a5,_0x588cec){_0x2164ef=path[_0x7545('0x3b')](__dirname,_0x7545('0x28'),rs[_0x7545('0x29')](0x4)+_0x7545('0x3c'));var _0x4217e8=Buffer[_0x7545('0x3d')](_0x27c9bb[_0x7545('0x3e')],_0x7545('0x2c'));return fs[_0x7545('0x3f')](_0x2164ef,_0x4217e8,function(_0x3bfc56){_0x588cec(_0x3bfc56);},function(_0xa20d68){fs[_0x7545('0x2e')](_0x2164ef,'777');_0x5689a5(_0xa20d68);});});})[_0x7545('0x2d')](function(_0x91efc8){_0x1ae53b=path['resolve'](__dirname,_0x7545('0x28'),rs[_0x7545('0x29')](0x4)+'.wav');return convertFile(_0x2164ef,_0x1ae53b);})[_0x7545('0x2d')](function(){try{fs[_0x7545('0x1f')](_0x2164ef);fs[_0x7545('0x2e')](_0x1ae53b,_0x7545('0x2f'));}catch(_0x1d48be){logger[_0x7545('0x16')](_0x1d48be);}logger[_0x7545('0x1c')](_0x7545('0x40'),_0x1ae53b[_0x7545('0x30')]('.')[0x0]);return _0x1ae53b[_0x7545('0x30')]('.')[0x0];});};exports[_0x7545('0x41')]=function(_0x30e731,_0xbd7dc4){var _0x596a7c='https://translate.google.com/_/TranslateWebserverUi/data/batchexecute';var _0x45b902,_0x479c78;var _0x40eac1;var _0x29376c={'encoding':_0x7545('0x42'),'method':_0x7545('0x43'),'timeout':0x2710,'url':_0x596a7c,'headers':{'Content-Type':_0x7545('0x44')},'body':_0x7545('0x45')+encodeURIComponent(JSON[_0x7545('0x46')]([[[_0x7545('0x47'),JSON[_0x7545('0x46')]([_0x30e731,_0xbd7dc4||'en',![],_0x7545('0x48')]),null,_0x7545('0x49')]]]))};return rp(_0x29376c)['then'](function(_0x59830d){try{_0x40eac1=eval(_0x59830d['slice'](0x5))[0x0][0x2];}catch(_0x131024){throw new Error(_0x7545('0x4a')+_0x59830d[_0x7545('0x21')]);}if(!_0x40eac1){if(_0x30e731[_0x7545('0x4b')]>0xc8){throw new Error(_0x7545('0x4c'));}else{throw new Error(_0x7545('0x4d')+_0xbd7dc4+_0x7545('0x4e'));}}try{_0x40eac1=eval(_0x40eac1)[0x0];}catch(_0x5cc2a5){throw new Error(_0x7545('0x4a')+res[_0x7545('0x21')]);}const _0x57ee4a=_0x40eac1;_0x45b902=path['resolve'](__dirname,'tmp',rs[_0x7545('0x29')](0x4)+_0x7545('0x3c'));fs[_0x7545('0x2b')](_0x45b902,_0x40eac1,{'encoding':'base64'});_0x479c78=path[_0x7545('0x3b')](__dirname,_0x7545('0x28'),rs['generate'](0x4)+_0x7545('0x2a'));return convertFile(_0x45b902,_0x479c78);})[_0x7545('0x2d')](function(){try{fs['unlink'](_0x45b902);fs[_0x7545('0x2e')](_0x479c78,'777');}catch(_0x2b9133){logger['error'](_0x2b9133);}logger['info'](_0x7545('0x4f'),_0x479c78['split']('.')[0x0]);return _0x479c78['split']('.')[0x0];});};exports[_0x7545('0x50')]=function(_0x296244,_0x461df5,_0x5b5833){return google[_0x7545('0x51')](_0x296244,_0x461df5,_0x5b5833)['then'](function(_0x807c0f){logger[_0x7545('0x1c')](_0x807c0f['uri']);return rp(_0x807c0f);})[_0x7545('0x2d')](function(_0x2c18ed){var _0xe3cba1='';var _0x1e37f5=0x0;try{fs[_0x7545('0x1f')](_0x296244);}catch(_0x2a258b){logger[_0x7545('0x16')](_0x2a258b);}if(_0x2c18ed&&_0x2c18ed['results']){_0xe3cba1=_0x2c18ed[_0x7545('0x52')][_0x7545('0x53')](function(_0x200e49){return _0x200e49&&_0x200e49[_0x7545('0x54')][0x0]&&_0x200e49['alternatives'][0x0][_0x7545('0x55')]?_0x200e49[_0x7545('0x54')][0x0][_0x7545('0x55')]:'';})[_0x7545('0x56')]('\x0a');_0x1e37f5=_0x2c18ed[_0x7545('0x52')]['map'](function(_0x51f9b3){return _0x51f9b3&&_0x51f9b3[_0x7545('0x54')][0x0]&&_0x51f9b3['alternatives'][0x0][_0x7545('0x57')]?_0x51f9b3[_0x7545('0x54')][0x0]['confidence']:0x0;})[_0x7545('0x56')]('\x0a');}logger[_0x7545('0x1c')](_0x7545('0x58'),_0xe3cba1);logger[_0x7545('0x1c')]('googleASR\x20confidence',_0x1e37f5);return{'transcript':_0xe3cba1,'confidence':_0x1e37f5};})[_0x7545('0x59')](function(_0xd710ba){logger[_0x7545('0x16')](_0x7545('0x5a'),_0xd710ba[_0x7545('0x15')],_0xd710ba[_0x7545('0x5b')],_0xd710ba['message']);});};exports[_0x7545('0x5c')]=function(_0x2aa91a,_0x1dcec7,_0x2558ba,_0x59dae8){var _0x3b1f88=apiai(_0x1dcec7,{'language':_0x59dae8||'en'});return _0x3b1f88['textRequest'](_0x2558ba,{'sessionId':md5(_0x2aa91a)})[_0x7545('0x2d')](function(_0x4d6ad9){logger[_0x7545('0x1c')](JSON[_0x7545('0x46')](_0x4d6ad9));return{'source':_0x4d6ad9[_0x7545('0x5d')][_0x7545('0x5e')],'resolvedQuery':_0x4d6ad9[_0x7545('0x5d')]['resolvedQuery'],'action':_0x4d6ad9[_0x7545('0x5d')][_0x7545('0x5f')],'actionIncomplete':_0x4d6ad9['result'][_0x7545('0x60')],'speech':_0x4d6ad9['result'][_0x7545('0x61')]['speech'],'score':_0x4d6ad9['result'][_0x7545('0x62')],'statusCode':_0x4d6ad9[_0x7545('0x63')]['code'],'endConversation':_0x4d6ad9['result'][_0x7545('0x64')][_0x7545('0x65')]||![],'isFallbackIntent':_0x4d6ad9[_0x7545('0x5d')][_0x7545('0x64')][_0x7545('0x66')]};});};exports['googleDialogflowV2']=function(_0x13eda9,_0x3703c4,_0x554ca1,_0x450de5,_0x284393,_0x378ed5){var _0x2afed5=_0x450de5[_0x7545('0x67')](/\\n/g,'\x0a');var _0x25c9f7={'credentials':{'private_key':_0x2afed5,'client_email':_0x554ca1}};var _0x5021bf=new dialogflow[(_0x7545('0x68'))](_0x25c9f7);var _0x28d4a8=_0x5021bf['sessionPath'](_0x3703c4,md5(_0x13eda9));var _0x4f91f0={'session':_0x28d4a8,'queryInput':{'text':{'text':_0x284393,'languageCode':_0x378ed5}}};return _0x5021bf[_0x7545('0x69')](_0x4f91f0)[_0x7545('0x2d')](function(_0x4614d8){if(_0x4614d8&&_0x4614d8[_0x7545('0x4b')]){logger[_0x7545('0x1c')](_0x7545('0x6a'),JSON[_0x7545('0x46')](_0x4614d8));var _0x310f8c=_0x4614d8[0x0];if(_0x310f8c){var _0x4a5d77={'action':_0x310f8c[_0x7545('0x6b')][_0x7545('0x5f')],'allRequiredParamsPresent':_0x310f8c[_0x7545('0x6b')]['allRequiredParamsPresent'],'endConversation':_0x310f8c[_0x7545('0x6b')][_0x7545('0x6c')]&&_0x310f8c['queryResult']['diagnosticInfo'][_0x7545('0x6d')]?_0x310f8c[_0x7545('0x6b')][_0x7545('0x6c')][_0x7545('0x6d')]['end_conversation']['boolValue']:![],'fulfillmentText':_0x310f8c['queryResult'][_0x7545('0x6e')],'intentName':_0x310f8c['queryResult']['intent']['name'],'intentDisplayName':_0x310f8c[_0x7545('0x6b')][_0x7545('0x6f')][_0x7545('0x70')],'isFallbackIntent':_0x310f8c[_0x7545('0x6b')][_0x7545('0x6f')]['isFallback'],'languageCode':_0x310f8c[_0x7545('0x6b')][_0x7545('0x71')],'queryText':_0x310f8c[_0x7545('0x6b')][_0x7545('0x72')],'responseId':_0x310f8c[_0x7545('0x73')],'score':_0x310f8c[_0x7545('0x6b')][_0x7545('0x74')],'speech':_0x310f8c['queryResult'][_0x7545('0x6e')],'providerResponse':JSON[_0x7545('0x46')](_0x4614d8)};return _0x4a5d77;}}});};exports[_0x7545('0x75')]=function(_0x4aa8e4,_0x5e00e4,_0x21a13f,_0x973a95){return tilde[_0x7545('0x51')](_0x4aa8e4,_0x5e00e4,_0x21a13f,_0x973a95)['then'](function(_0x2ee5df){try{fs[_0x7545('0x1f')](_0x4aa8e4);}catch(_0x208f74){logger[_0x7545('0x16')](_0x208f74);}logger[_0x7545('0x1c')](_0x7545('0x76'),_0x2ee5df['transcript']);logger['info']('Tilde\x20ASR\x20confidence',_0x2ee5df[_0x7545('0x57')]);return _0x2ee5df;});};exports['awsPolly']=function(_0x166792,_0x2fb0a6,_0xe9235a,_0x8c199a,_0x4dc510,_0x12d1be){var _0x258d41=path[_0x7545('0x3b')](__dirname,_0x7545('0x28'),rs['generate'](0x4)+_0x7545('0x3c'));var _0x4db613;return aws[_0x7545('0x77')](_0x166792,_0x2fb0a6,_0xe9235a,_0x8c199a,_0x4dc510,_0x12d1be,_0x258d41)[_0x7545('0x2d')](function(){_0x4db613=path[_0x7545('0x3b')](__dirname,_0x7545('0x28'),rs[_0x7545('0x29')](0x4)+_0x7545('0x2a'));return convertFile(_0x258d41,_0x4db613);})[_0x7545('0x2d')](function(){try{fs[_0x7545('0x1f')](_0x258d41);fs[_0x7545('0x2e')](_0x4db613,'777');}catch(_0x406014){logger['error'](_0x406014);}return _0x4db613['split']('.')[0x0];});};exports[_0x7545('0x78')]=function(_0x47c200,_0x2796ea,_0x5cc93b,_0x257f1d,_0x5022a3,_0x557087){return aws[_0x7545('0x79')](_0x47c200,_0x2796ea,_0x5cc93b,_0x257f1d,_0x5022a3,_0x557087)['then'](function(_0x256142){logger[_0x7545('0x1c')](JSON[_0x7545('0x46')](_0x256142));return _0x256142;});};exports['ispeechTTS']=function(_0x456012,_0x2f86cf,_0x4495af,_0x300a09){var _0xffd025=util[_0x7545('0x7a')](_0x7545('0x7b'),ISPEECH_API,_0x456012,encodeURIComponent(_0x2f86cf),_0x4495af,_0x300a09);var _0x11166b=path['resolve'](__dirname,'tmp',rs[_0x7545('0x29')](0x4)+_0x7545('0x3c'));var _0x4a0ec6;return downloadFile(_0xffd025,_0x11166b)[_0x7545('0x2d')](function(){_0x4a0ec6=path[_0x7545('0x3b')](__dirname,_0x7545('0x28'),rs[_0x7545('0x29')](0x4)+'.wav');return convertFile(_0x11166b,_0x4a0ec6);})[_0x7545('0x2d')](function(){try{fs[_0x7545('0x1f')](_0x11166b);fs[_0x7545('0x2e')](_0x4a0ec6,'777');}catch(_0x3534f9){logger['error'](_0x3534f9);}return _0x4a0ec6[_0x7545('0x30')]('.')[0x0];});};exports[_0x7545('0x7c')]=function(_0x45e92a,_0x13af54,_0xe60970,_0x376920){var _0x2010a0=util['format']('%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s',ISPEECH_API,_0x13af54,_0xe60970,base64Encode(_0x45e92a),_0x376920?util[_0x7545('0x7a')]('model=%s',encodeURIComponent(_0x376920)):_0x7545('0x7d'));return uploadFile(_0x2010a0)[_0x7545('0x2d')](function(_0x44057b){return querystring['parse'](_0x44057b);});};exports[_0x7545('0x7e')]=function(_0x6ac0f0,_0x213f02){return sestek[_0x7545('0x7f')](_0x6ac0f0,_0x213f02)[_0x7545('0x2d')](function(_0x2813ed){logger['info'](JSON[_0x7545('0x46')](_0x2813ed));var _0xc65eb3={'speech':_0x2813ed[_0x7545('0x80')],'action':_0x2813ed['channelData']?_0x2813ed[_0x7545('0x81')][_0x7545('0x82')]:undefined,'actiondata':_0x2813ed[_0x7545('0x81')]?_0x2813ed[_0x7545('0x81')][_0x7545('0x83')]:undefined};if(_0x2813ed[_0x7545('0x81')]&&_0x2813ed[_0x7545('0x81')]['AudioFromTts']){return base64Decode(_0x2813ed[_0x7545('0x81')][_0x7545('0x84')][_0x7545('0x85')],path[_0x7545('0x3b')](__dirname,'tmp',rs[_0x7545('0x29')](0x4)+_0x7545('0x2a')))['then'](function(_0x572cc6){_0xc65eb3[_0x7545('0x86')]=_0x572cc6;return _0xc65eb3;});}return _0xc65eb3;});};exports[_0x7545('0x87')]=function(){return __dirname;}; \ No newline at end of file diff --git a/server/services/agi/scripts/sestek/index.js b/server/services/agi/scripts/sestek/index.js index 6c643e2..7315aba 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 _0x4e6a=['exports','./nda'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4e6a,0x12d));var _0xa4e6=function(_0x2941af,_0x3e6116){_0x2941af=_0x2941af-0x0;var _0x4e0bf0=_0x4e6a[_0x2941af];return _0x4e0bf0;};var nda=require(_0xa4e6('0x0'));module[_0xa4e6('0x1')]={'nda':nda}; \ No newline at end of file +var _0xb6a9=['./nda','exports'];(function(_0x5d860f,_0x467498){var _0x236490=function(_0x5e045c){while(--_0x5e045c){_0x5d860f['push'](_0x5d860f['shift']());}};_0x236490(++_0x467498);}(_0xb6a9,0x19c));var _0x9b6a=function(_0x3305de,_0x16582f){_0x3305de=_0x3305de-0x0;var _0x3b5a84=_0xb6a9[_0x3305de];return _0x3b5a84;};var nda=require(_0x9b6a('0x0'));module[_0x9b6a('0x1')]={'nda':nda}; \ No newline at end of file diff --git a/server/services/agi/scripts/sestek/nda/index.js b/server/services/agi/scripts/sestek/nda/index.js index 1eea0e1..0659d87 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 _0xc9c3=['then','POST','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','message','Nda','calleridname','dnid','extension','text','channelData','ProjectName','ndagenerate_audio','AudioOutputSettings','audio/wav','body','CustomAction','custom_action_data','stringify','url','../../../../../config/logger','agi','resolve','ndauth_url','/token','password','username'];(function(_0x24ddd5,_0x4933ec){var _0x35e166=function(_0x6868ca){while(--_0x6868ca){_0x24ddd5['push'](_0x24ddd5['shift']());}};_0x35e166(++_0x4933ec);}(_0xc9c3,0xd0));var _0x3c9c=function(_0x38a366,_0x1416d0){_0x38a366=_0x38a366-0x0;var _0x3e5711=_0xc9c3[_0x38a366];return _0x3e5711;};'use strict';var rp=require('request-promise');var url=require(_0x3c9c('0x0'));var logger=require(_0x3c9c('0x1'))(_0x3c9c('0x2'));module['exports']=function(_0x4a1db1,_0x2ca714){var _0x11d161={'method':'POST','uri':url[_0x3c9c('0x3')](_0x2ca714[_0x3c9c('0x4')],_0x3c9c('0x5')),'form':{'grant_type':_0x3c9c('0x6'),'username':_0x2ca714[_0x3c9c('0x7')],'password':_0x2ca714[_0x3c9c('0x6')]},'json':!![]};return rp(_0x11d161)[_0x3c9c('0x8')](function(_0x4eaaf4){var _0x5a15f7={'method':_0x3c9c('0x9'),'uri':url[_0x3c9c('0x3')](_0x2ca714['ndassistant_url'],_0x3c9c('0xa')),'body':{'type':_0x2ca714[_0x3c9c('0xb')]||_0x3c9c('0xc'),'channelId':_0x3c9c('0xd'),'conversation':{'id':_0x4a1db1['uniqueid']},'from':{'id':_0x4a1db1['callerid'],'name':_0x4a1db1[_0x3c9c('0xe')]},'recipient':{'id':_0x4a1db1[_0x3c9c('0xf')],'name':_0x4a1db1[_0x3c9c('0x10')]},'text':_0x2ca714[_0x3c9c('0x11')],'channelData':{}},'headers':{'Authorization':'Bearer\x20'+_0x4eaaf4['access_token']},'json':!![]};if(_0x2ca714['project']){_0x5a15f7['body'][_0x3c9c('0x12')][_0x3c9c('0x13')]=_0x2ca714['project'];}if(_0x2ca714[_0x3c9c('0x14')]=='1'){_0x5a15f7['body'][_0x3c9c('0x12')][_0x3c9c('0x15')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x3c9c('0x16')};}if(_0x2ca714['custom_action']){_0x5a15f7[_0x3c9c('0x17')]['channelData'][_0x3c9c('0x18')]=_0x2ca714['custom_action'];if(_0x2ca714[_0x3c9c('0x19')]){_0x5a15f7[_0x3c9c('0x17')][_0x3c9c('0x12')]['CustomActionData']=_0x2ca714[_0x3c9c('0x19')];}}logger['info'](JSON[_0x3c9c('0x1a')](_0x5a15f7));return rp(_0x5a15f7);});}; \ No newline at end of file +var _0xbf6e=['message','uniqueid','callerid','calleridname','dnid','extension','text','access_token','project','channelData','ProjectName','ndagenerate_audio','body','custom_action','CustomAction','custom_action_data','CustomActionData','info','stringify','../../../../../config/logger','agi','exports','POST','ndauth_url','/token','password','username','then','resolve','ndassistant_url','ndaactivity_type'];(function(_0x1a5e14,_0x5f9290){var _0x51eb18=function(_0x1716fe){while(--_0x1716fe){_0x1a5e14['push'](_0x1a5e14['shift']());}};_0x51eb18(++_0x5f9290);}(_0xbf6e,0x149));var _0xebf6=function(_0x44d9b9,_0x409a69){_0x44d9b9=_0x44d9b9-0x0;var _0x47493f=_0xbf6e[_0x44d9b9];return _0x47493f;};'use strict';var rp=require('request-promise');var url=require('url');var logger=require(_0xebf6('0x0'))(_0xebf6('0x1'));module[_0xebf6('0x2')]=function(_0x440a55,_0x473e65){var _0x1195ea={'method':_0xebf6('0x3'),'uri':url['resolve'](_0x473e65[_0xebf6('0x4')],_0xebf6('0x5')),'form':{'grant_type':_0xebf6('0x6'),'username':_0x473e65[_0xebf6('0x7')],'password':_0x473e65[_0xebf6('0x6')]},'json':!![]};return rp(_0x1195ea)[_0xebf6('0x8')](function(_0x137e39){var _0x548e9e={'method':_0xebf6('0x3'),'uri':url[_0xebf6('0x9')](_0x473e65[_0xebf6('0xa')],'/api/NaturalDialogAssistant/v1/Run'),'body':{'type':_0x473e65[_0xebf6('0xb')]||_0xebf6('0xc'),'channelId':'Nda','conversation':{'id':_0x440a55[_0xebf6('0xd')]},'from':{'id':_0x440a55[_0xebf6('0xe')],'name':_0x440a55[_0xebf6('0xf')]},'recipient':{'id':_0x440a55[_0xebf6('0x10')],'name':_0x440a55[_0xebf6('0x11')]},'text':_0x473e65[_0xebf6('0x12')],'channelData':{}},'headers':{'Authorization':'Bearer\x20'+_0x137e39[_0xebf6('0x13')]},'json':!![]};if(_0x473e65[_0xebf6('0x14')]){_0x548e9e['body'][_0xebf6('0x15')][_0xebf6('0x16')]=_0x473e65[_0xebf6('0x14')];}if(_0x473e65[_0xebf6('0x17')]=='1'){_0x548e9e[_0xebf6('0x18')]['channelData']['AudioOutputSettings']={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':'audio/wav'};}if(_0x473e65[_0xebf6('0x19')]){_0x548e9e[_0xebf6('0x18')]['channelData'][_0xebf6('0x1a')]=_0x473e65[_0xebf6('0x19')];if(_0x473e65[_0xebf6('0x1b')]){_0x548e9e[_0xebf6('0x18')][_0xebf6('0x15')][_0xebf6('0x1c')]=_0x473e65[_0xebf6('0x1b')];}}logger[_0xebf6('0x1d')](JSON[_0xebf6('0x1e')](_0x548e9e));return rp(_0x548e9e);});}; \ 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 e5364b1..0577120 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 _0x0c87=['exports'];(function(_0x4d9a42,_0x4baeaa){var _0x5833d3=function(_0x28f854){while(--_0x28f854){_0x4d9a42['push'](_0x4d9a42['shift']());}};_0x5833d3(++_0x4baeaa);}(_0x0c87,0x88));var _0x70c8=function(_0x4cd08f,_0x1c4741){_0x4cd08f=_0x4cd08f-0x0;var _0x19e94e=_0x0c87[_0x4cd08f];return _0x19e94e;};'use strict';var asr=require('./lib/api');module[_0x70c8('0x0')]=function(_0x442e3a,_0x570444,_0x5e994e,_0x19ba4d){return asr(_0x442e3a,_0x570444,_0x5e994e,_0x19ba4d);}; \ No newline at end of file +var _0xee8f=['exports'];(function(_0x1fbbdb,_0x4fa243){var _0x4685e1=function(_0x38922f){while(--_0x38922f){_0x1fbbdb['push'](_0x1fbbdb['shift']());}};_0x4685e1(++_0x4fa243);}(_0xee8f,0x1ed));var _0xfee8=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0xee8f[_0x13d07a];return _0x5ee0ee;};'use strict';var asr=require('./lib/api');module[_0xfee8('0x0')]=function(_0x59a968,_0x3ee2fa,_0x205898,_0x37ed54){return asr(_0x59a968,_0x3ee2fa,_0x205898,_0x37ed54);}; \ 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 cf37cc3..3be7263 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 _0x7ac6=['isObject','open','message','moment','crypto','../../../../../../config/logger','agi','info','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','sha1','update','digest','hex','Open\x20Tilde\x20ASR\x20socket','unix','send','stringify','createReadStream','close','EOS','error','terminate','parse','status','result','final','Tilde\x20ASR\x20hypoteses','hypotheses','likelihood','Success.','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error','Error\x20Tilde\x20ASR\x20socket','isNil'];(function(_0x3b5049,_0x495a94){var _0x12454e=function(_0x3988d3){while(--_0x3988d3){_0x3b5049['push'](_0x3b5049['shift']());}};_0x12454e(++_0x495a94);}(_0x7ac6,0x114));var _0x67ac=function(_0x70a300,_0x31e904){_0x70a300=_0x70a300-0x0;var _0xe2c6f6=_0x7ac6[_0x70a300];return _0xe2c6f6;};'use strict';var BPromise=require('bluebird');var _=require('lodash');var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x67ac('0x0'));var crypto=require(_0x67ac('0x1'));var logger=require(_0x67ac('0x2'))(_0x67ac('0x3'));module['exports']=function(_0x5274f7,_0x5b2ca2,_0xbdd132,_0x27adbf){return new BPromise(function(_0x23e30b,_0x1cd9e2){logger[_0x67ac('0x4')](_0x67ac('0x5'),_0x27adbf||_0x67ac('0x6'));var _0xd481b1=new WebSocket(_0x27adbf||_0x67ac('0x6'),{'perMessageDeflate':![]});var _0x8dc5f3='';var _0x5f1a27='0';var _0x4ec42d='1';var _0x3a081d=_0x67ac('0x7');function _0x56c827(_0x1c3a12){var _0x12f913=crypto['createHash'](_0x67ac('0x8'));_0x12f913[_0x67ac('0x9')](_0x1c3a12);return _0x12f913[_0x67ac('0xa')](_0x67ac('0xb'));}function _0x1f6ded(){try{logger[_0x67ac('0x4')](_0x67ac('0xc'));var _0x4394a7=moment()[_0x67ac('0xd')]();var _0x18f1c1=_0x56c827(_0x4394a7+_0x5b2ca2+_0xbdd132);_0xd481b1[_0x67ac('0xe')](JSON[_0x67ac('0xf')]({'appID':_0x5b2ca2,'timestamp':_0x4394a7,'appKey':_0x18f1c1}));var _0x28aae9=fs[_0x67ac('0x10')](_0x5274f7);_0x28aae9['on']('data',function(_0x31f59){_0xd481b1[_0x67ac('0xe')](_0x31f59);});_0x28aae9['on'](_0x67ac('0x11'),function(){_0xd481b1[_0x67ac('0xe')](_0x67ac('0x12'));});}catch(_0x400c96){logger[_0x67ac('0x13')]('Tilde\x20ASR\x20send\x20error',JSON[_0x67ac('0xf')](_0x400c96));_0xd481b1[_0x67ac('0x14')]();}}function _0x13eecc(_0x502cc4){try{if(_0x502cc4){var _0x4e701f=JSON[_0x67ac('0x15')](_0x502cc4);switch(_0x4e701f[_0x67ac('0x16')]){case 0x0:if(_0x4e701f[_0x67ac('0x17')]){if(_0x4e701f['result'][_0x67ac('0x18')]){logger[_0x67ac('0x4')](_0x67ac('0x19'),JSON['stringify'](_0x4e701f[_0x67ac('0x17')][_0x67ac('0x1a')]));_0x8dc5f3=_0x4e701f[_0x67ac('0x17')]['hypotheses'][0x0]['transcript'];_0x5f1a27=_0x4e701f['result'][_0x67ac('0x1a')][0x0][_0x67ac('0x1b')];_0x4ec42d='0';_0x3a081d=_0x67ac('0x1c');_0xd481b1[_0x67ac('0x14')]();}}break;case 0x1:logger[_0x67ac('0x4')](_0x67ac('0x7'));_0x4ec42d='1';_0x3a081d=_0x67ac('0x7');break;case 0x2:logger[_0x67ac('0x4')]('Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.');_0x4ec42d='2';_0x3a081d=_0x67ac('0x1d');break;case 0x9:logger[_0x67ac('0x4')]('Not\x20available.\x20Max\x20load\x20limit\x20reached.');_0x4ec42d='9';_0x3a081d=_0x67ac('0x1e');break;case 0xa:logger['info'](_0x67ac('0x1f'));_0x4ec42d='10';_0x3a081d=_0x67ac('0x1f');break;case 0xb:logger['info']('All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.');_0x4ec42d='11';_0x3a081d=_0x67ac('0x20');}}}catch(_0x18f63f){logger['error'](_0x67ac('0x21'),JSON[_0x67ac('0xf')](_0x18f63f));_0xd481b1[_0x67ac('0x14')]();}}function _0x3ed8e0(){logger[_0x67ac('0x4')]('Close\x20Tilde\x20ASR\x20socket');_0x23e30b({'transcript':_0x8dc5f3,'confidence':_0x5f1a27,'status':_0x4ec42d,'status_message':_0x3a081d});}function _0x53184e(_0x35e31e){logger[_0x67ac('0x13')](_0x67ac('0x22'));if(!_[_0x67ac('0x23')](_0x35e31e)){logger['error'](_[_0x67ac('0x24')](_0x35e31e)?JSON['stringify'](_0x35e31e):_0x35e31e);}}_0xd481b1['on'](_0x67ac('0x25'),_0x1f6ded);_0xd481b1['on'](_0x67ac('0x26'),_0x13eecc);_0xd481b1['on'](_0x67ac('0x11'),_0x3ed8e0);_0xd481b1['on'](_0x67ac('0x13'),_0x53184e);});}; \ No newline at end of file +var _0xd50f=['Error\x20Tilde\x20ASR\x20socket','isNil','isObject','open','message','moment','crypto','../../../../../../config/logger','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','update','hex','info','Open\x20Tilde\x20ASR\x20socket','unix','send','stringify','createReadStream','data','EOS','error','Tilde\x20ASR\x20send\x20error','terminate','parse','result','final','Tilde\x20ASR\x20hypoteses','hypotheses','Success.','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error','Close\x20Tilde\x20ASR\x20socket'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xd50f,0x1b5));var _0xfd50=function(_0x19aab6,_0x251a63){_0x19aab6=_0x19aab6-0x0;var _0x1281d1=_0xd50f[_0x19aab6];return _0x1281d1;};'use strict';var BPromise=require('bluebird');var _=require('lodash');var fs=require('fs');var WebSocket=require('ws');var moment=require(_0xfd50('0x0'));var crypto=require(_0xfd50('0x1'));var logger=require(_0xfd50('0x2'))('agi');module['exports']=function(_0x229e29,_0x595bdb,_0x441e1e,_0x5a37e3){return new BPromise(function(_0x290230,_0x1b97c0){logger['info'](_0xfd50('0x3'),_0x5a37e3||_0xfd50('0x4'));var _0x378831=new WebSocket(_0x5a37e3||_0xfd50('0x4'),{'perMessageDeflate':![]});var _0x2de0fb='';var _0x1517e6='0';var _0x4b8a1d='1';var _0x19a7d9='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';function _0x3bdfab(_0x3f4fb3){var _0x570099=crypto['createHash']('sha1');_0x570099[_0xfd50('0x5')](_0x3f4fb3);return _0x570099['digest'](_0xfd50('0x6'));}function _0xfc4275(){try{logger[_0xfd50('0x7')](_0xfd50('0x8'));var _0x2cf40e=moment()[_0xfd50('0x9')]();var _0x25493e=_0x3bdfab(_0x2cf40e+_0x595bdb+_0x441e1e);_0x378831[_0xfd50('0xa')](JSON[_0xfd50('0xb')]({'appID':_0x595bdb,'timestamp':_0x2cf40e,'appKey':_0x25493e}));var _0x42ab0b=fs[_0xfd50('0xc')](_0x229e29);_0x42ab0b['on'](_0xfd50('0xd'),function(_0x314a95){_0x378831[_0xfd50('0xa')](_0x314a95);});_0x42ab0b['on']('close',function(){_0x378831[_0xfd50('0xa')](_0xfd50('0xe'));});}catch(_0x59ae22){logger[_0xfd50('0xf')](_0xfd50('0x10'),JSON['stringify'](_0x59ae22));_0x378831[_0xfd50('0x11')]();}}function _0x2f1300(_0x1d5032){try{if(_0x1d5032){var _0x11d5c0=JSON[_0xfd50('0x12')](_0x1d5032);switch(_0x11d5c0['status']){case 0x0:if(_0x11d5c0[_0xfd50('0x13')]){if(_0x11d5c0[_0xfd50('0x13')][_0xfd50('0x14')]){logger[_0xfd50('0x7')](_0xfd50('0x15'),JSON['stringify'](_0x11d5c0[_0xfd50('0x13')][_0xfd50('0x16')]));_0x2de0fb=_0x11d5c0[_0xfd50('0x13')][_0xfd50('0x16')][0x0]['transcript'];_0x1517e6=_0x11d5c0[_0xfd50('0x13')][_0xfd50('0x16')][0x0]['likelihood'];_0x4b8a1d='0';_0x19a7d9=_0xfd50('0x17');_0x378831[_0xfd50('0x11')]();}}break;case 0x1:logger[_0xfd50('0x7')](_0xfd50('0x18'));_0x4b8a1d='1';_0x19a7d9=_0xfd50('0x18');break;case 0x2:logger[_0xfd50('0x7')](_0xfd50('0x19'));_0x4b8a1d='2';_0x19a7d9=_0xfd50('0x19');break;case 0x9:logger[_0xfd50('0x7')](_0xfd50('0x1a'));_0x4b8a1d='9';_0x19a7d9=_0xfd50('0x1a');break;case 0xa:logger[_0xfd50('0x7')](_0xfd50('0x1b'));_0x4b8a1d='10';_0x19a7d9=_0xfd50('0x1b');break;case 0xb:logger[_0xfd50('0x7')](_0xfd50('0x1c'));_0x4b8a1d='11';_0x19a7d9=_0xfd50('0x1c');}}}catch(_0x57d654){logger[_0xfd50('0xf')](_0xfd50('0x1d'),JSON[_0xfd50('0xb')](_0x57d654));_0x378831[_0xfd50('0x11')]();}}function _0xd91c09(){logger[_0xfd50('0x7')](_0xfd50('0x1e'));_0x290230({'transcript':_0x2de0fb,'confidence':_0x1517e6,'status':_0x4b8a1d,'status_message':_0x19a7d9});}function _0x17bfea(_0x2d0fe9){logger['error'](_0xfd50('0x1f'));if(!_[_0xfd50('0x20')](_0x2d0fe9)){logger[_0xfd50('0xf')](_[_0xfd50('0x21')](_0x2d0fe9)?JSON[_0xfd50('0xb')](_0x2d0fe9):_0x2d0fe9);}}_0x378831['on'](_0xfd50('0x22'),_0xfc4275);_0x378831['on'](_0xfd50('0x23'),_0x2f1300);_0x378831['on']('close',_0xd91c09);_0x378831['on'](_0xfd50('0xf'),_0x17bfea);});}; \ 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 9779f3d..8bfa63e 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 _0x9611=['exports','./asr'];(function(_0x238b1f,_0x31402c){var _0x57b6c6=function(_0x5da173){while(--_0x5da173){_0x238b1f['push'](_0x238b1f['shift']());}};_0x57b6c6(++_0x31402c);}(_0x9611,0xef));var _0x1961=function(_0x1a55d2,_0x2ac9b8){_0x1a55d2=_0x1a55d2-0x0;var _0x3c51b4=_0x9611[_0x1a55d2];return _0x3c51b4;};var asr=require(_0x1961('0x0'));module[_0x1961('0x1')]={'asr':asr}; \ No newline at end of file +var _0x7a5b=['./asr','exports'];(function(_0x4ff09b,_0x53f67d){var _0x3f5c2e=function(_0x124592){while(--_0x124592){_0x4ff09b['push'](_0x4ff09b['shift']());}};_0x3f5c2e(++_0x53f67d);}(_0x7a5b,0x1ac));var _0xb7a5=function(_0x5dac46,_0x28e9dc){_0x5dac46=_0x5dac46-0x0;var _0x51095c=_0x7a5b[_0x5dac46];return _0x51095c;};var asr=require(_0xb7a5('0x0'));module[_0xb7a5('0x1')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index b527be6..fddd41b 100644 --- a/server/services/agi/server.js +++ b/server/services/agi/server.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['./error','./channel','127.0.0.1','call','emit','error','createServer','listen','listening','getConnections','destroy','E_AGI_SERVER_MAXCONNECTION','ready','connection','E_AGI_SERVER_ERROR','code','close','E_AGI_SERVER_CLOSE','nextTick','events','EventEmitter'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9c44,0x178));var _0x49c4=function(_0x4d613c,_0x55f220){_0x4d613c=_0x4d613c-0x0;var _0x301fe3=_0x9c44[_0x4d613c];return _0x301fe3;};'use strict';var util=require('util');var net=require('net');var EventEmitter=require(_0x49c4('0x0'))[_0x49c4('0x1')];var AGIError=require(_0x49c4('0x2'));var AGIChannel=require(_0x49c4('0x3'));var AGIServer=function(_0x455700,_0x2ad237,_0x4e0313){var _0x4941f1=this;var _0x41a183=null;var _0x57effd=0x0;if(!_0x455700)_0x455700=0x11dd;if(!_0x2ad237)_0x2ad237=_0x49c4('0x4');EventEmitter[_0x49c4('0x5')](_0x4941f1);function _0x69bc41(){if(!_0x455700){_0x4941f1[_0x49c4('0x6')](_0x49c4('0x7'),new AGIError('E_AGI_ARGUMENT_PORT'));return![];}_0x41a183=net[_0x49c4('0x8')]();_0x41a183[_0x49c4('0x9')](_0x455700,_0x2ad237);_0x41a183['on'](_0x49c4('0xa'),function(){_0x4941f1[_0x49c4('0x6')]('listening');});_0x41a183['on']('connection',function(_0x451ea6){_0x41a183[_0x49c4('0xb')](function(_0x58cad7,_0xb611a1){if(_0x58cad7){_0x4941f1[_0x49c4('0x6')]('error',new AGIError('E_AGI_SERVER_ERROR',_0x58cad7));}else if(_0x4e0313&&_0x4e0313<0x0){_0x4941f1[_0x49c4('0x6')](_0x49c4('0x7'),new AGIError('E_AGI_SERVER_VOICE_DISABLED'));_0x451ea6[_0x49c4('0xc')]();}else if(_0x4e0313&&_0x4e0313>0x0&&_0x4e0313<_0xb611a1){_0x57effd+=0x1;_0x4941f1[_0x49c4('0x6')]('error',new AGIError(_0x49c4('0xd'),_0x57effd));_0x451ea6[_0x49c4('0xc')]();}else{var _0x21f15a=new AGIChannel(_0x451ea6);_0x21f15a['on'](_0x49c4('0xe'),function(){_0x4941f1[_0x49c4('0x6')](_0x49c4('0xf'),_0x21f15a);});}});});_0x41a183['on'](_0x49c4('0x7'),function(_0x3de397){_0x4941f1['emit'](_0x49c4('0x7'),new AGIError(_0x49c4('0x10'),_0x3de397[_0x49c4('0x11')]));});_0x41a183['on'](_0x49c4('0x12'),function(){_0x4941f1[_0x49c4('0x6')]('close',new AGIError(_0x49c4('0x13')));});}process[_0x49c4('0x14')](function(){_0x69bc41();});};util['inherits'](AGIServer,EventEmitter);module['exports']=function(_0x3c782d,_0x2f82d5,_0x3addb2){return new AGIServer(_0x3c782d,_0x2f82d5,_0x3addb2);}; \ No newline at end of file +var _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(_0x4b935a,_0x327ee3){var _0xa298f0=function(_0x3e07c2){while(--_0x3e07c2){_0x4b935a['push'](_0x4b935a['shift']());}};_0xa298f0(++_0x327ee3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0xa9e0[_0x5b561d];return _0x431060;};'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 ebca649..c1da3f8 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 _0x9957=['Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appsecret\x20configured','wav','%s/recordings/%s','beep','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','TildeASR\x20Result\x20%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','extension','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','no\x20condition\x20configured','true','false','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20interval\x20configured','no\x20intervals\x20found','IFTIME\x20%s\x20%s','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ispeech\x20%s\x20file\x20created','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','FIND\x20AGENT\x20%s\x20BY\x20%s','agentLogin','AGENT\x20%s\x20FOUND\x20BY','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','no\x20find\x20by\x20configured','success','math','Enter\x20in\x20MATH\x20(%s)\x20block','math\x20%s','operation','%s[%s]','variable\x20%s[key]\x20set','Enter\x20in\x20MENU\x20(%s)\x20block','no\x20file\x20audio\x20found','digit','output','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','no\x20queue\x20selected','queue_id','no\x20queue\x20found','indexOf','QUEUE','macro','gosub','position','Enter\x20in\x20RECORD\x20(%s)\x20block','%s_%s','%s/recordings/%s.%s','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','restapi','no\x20url\x20configured','Response:','inspect','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','200','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','digits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','no\x20mail\x20account\x20configured','getMailAccount','Smtp','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','email','bcc','subject','template_id','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','sendSMS','sms_account_id','no\x20sms\x20account\x20found','sms_text','debug','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','createSmsMessage','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','start','Enter\x20in\x20START\x20(%s)\x20block','XMCS-UNIQUEID','yes','Skipped\x20Answer','project_id','no\x20subproject\x20found\x20with\x20id\x20%d','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','host','127.0.0.1','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','command','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','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','googleTTS','Google\x20TTS\x20%s\x20file\x20created','unpause','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','replaceAll','join','exports','util','lodash','shelljs','odbc','moment','mustache','request-promise','../../config/logger','../../config/environment','./scripts','/var/opt/motion2/server/files','rawHeaders','rawBody','menu','getsecretdigits','channel','rpc','mailRpc','prototype','getVariable','getVariableById','name','catch','getVoiceQueue','getVoiceQueueById','then','getSquareProject','getSquareProjectById','getSquareOdbcById','dsn','getUser','getUserById','getTrunk','getTrunkById','getSound','getSoundById','getSoundPath','getMailAccountById','sendMailMessage','getIntervals','getIntervalById','IntervalId','map','Intervals','interval','format','%s/sounds/converted/%s','getQueryOdbc','open','error','Error\x20getting\x20ODBC\x20connection\x20%s','info','ODBC\x20connection\x20successfully','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','getSmsAccountById','createSquareDetailsReport','uniqueid','label','agicommand','callerid','createSquareRecording','context','priority','accountcode','arg_1','createSquareMessage','createCmContact','isEmpty','isNil','callback_','lastName','list_id','scheduledAt','callback','Callback\x20scheduled\x20at\x20','toString','callback_priority','getPause','getPauseById','agentPause','agentUnpause','agent','agentLogout','internal','%s/%s@from-sip/n','LOCAL','shellCommand','trim','replace','googleCloudTTS','apiKey','google_cloud_tts_text_type','text','languageCode','MALE','audioEncoding','MP3','url','method','timeout','number','includes','POST','PUT','toUpperCase','body','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','render','stringify','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','statusMessage','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','googleDialogflowV2','dialogflowV2_project_id','dialogflowV2_language','sestekNDA','ispeechTTS','ispeech_tts_language','speed','ispeechASR','ispeech_asr_language','en-US','model','aws_secret_access_key','aws_polly_voice','Amy','awsLex','aws_access_key_id','aws_lex_region','googleASR','google_asr_language','tildeASR','appid','appsecret','uri','clone','hasOwnProperty','replaceAllVariables','recursiveNodeIndex','isPlainObject','isArray','length','isString','saveRestApiResult','%s.%s','setVariable','split','extra','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','sync','retry','maxRetry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','isConfigured','noop','no\x20text\x20configured','exec','MRCPSynth','no\x20grammar\x20configured','MRCPRecog','getAndSetVariable','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','agi','Enter\x20in\x20AGI\x20(%s)\x20block','args','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','Wait\x20%s\x20seconds\x20before\x20answer','Enter\x20in\x20CALLBACK\x20(%s)\x20block','no\x20list\x20selected','delay','add','minutes','phone','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','Executed\x20command\x20%s\x20%s','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','Executed\x20command\x20MRCPSynth\x20%s','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','grammar','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','LUMENVOX_ASR_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_INSTANCE','Enter\x20in\x20DATABASE\x20(%s)\x20block','no\x20database\x20selected','odbc_id','no\x20odbc\x20database\x20found','query','query:\x20%s','no\x20variable\x20selected\x20for\x20the\x20result','variable_id','no\x20variable\x20found','forEach','%s[%s][%s]','%s_ROWS_COUNT','variable\x20%s\x20set','dial','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','SIP/%s','opts','Executed\x20command\x20%s','DIAL','dialogflow','no\x20key\x20configured','bot','Trying\x20Dialogflow:\x20%s','speech','Dialogflow\x20Result\x20%s','dialogflowV2','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','client_email','no\x20client_email\x20configured','no\x20private_key\x20configured','no\x20anguage\x20configured','DIALOGFLOW_%s','providerResponse','DialogflowV2\x20Result\x20%s','DialogflowV2\x20is\x20unreachable','sesteknda','ndauth_url','no\x20ndauth\x20url\x20configured','no\x20username\x20configured','password','no\x20password\x20configured','ndassistant_url','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','unlink','.wav','SestekNDA\x20is\x20unreachable','Enter\x20in\x20END\x20(%s)\x20block','end','ext_dial','trunk_id','no\x20trunk\x20found','trunk_name','no\x20trunk\x20selected','SIP/%s/%s','finally','getdigits','file_id','no\x20file\x20audio\x20selected','getData','response','maxdigit','test','mindigit','hiddendigitsnum','generate','substr','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','GOAL\x20%s','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','awsPolly','streamFile','aws\x20Polly\x20is\x20unreachable','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','message','Amazon\x20Lex\x20ready\x20for\x20fulfillment','out','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','NOBEEP','recordFile','intKey','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','tildeasr'];(function(_0x481503,_0x5cd37a){var _0x365670=function(_0x2425b2){while(--_0x2425b2){_0x481503['push'](_0x481503['shift']());}};_0x365670(++_0x5cd37a);}(_0x9957,0x93));var _0x7995=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9957[_0x5b644e];return _0x49c6bf;};'use strict';var fs=require('fs');var util=require(_0x7995('0x0'));var _=require(_0x7995('0x1'));var sh=require(_0x7995('0x2'));var odbc=require(_0x7995('0x3'))();var rs=require('randomstring');var moment=require(_0x7995('0x4'));var Mustache=require(_0x7995('0x5'));var rp=require(_0x7995('0x6'));var logger=require(_0x7995('0x7'))('agi');var config=require(_0x7995('0x8'));var scripts=require(_0x7995('0x9'));var FILES_PATH=_0x7995('0xa');var recursiveMapAttributes=[_0x7995('0xb'),_0x7995('0xc')];var verticesWithRetry=[_0x7995('0xd'),'getdigits',_0x7995('0xe')];var AGIVertices=function(_0x1cad37,_0x4a64f7,_0xa2e5f0){this[_0x7995('0xf')]=_0x1cad37;this[_0x7995('0x10')]=_0x4a64f7;this[_0x7995('0x11')]=_0xa2e5f0;};AGIVertices[_0x7995('0x12')][_0x7995('0x13')]=function(_0x341672,_0x524f7b){this[_0x7995('0x10')][_0x7995('0x14')](_0x341672)['then'](function(_0xb0c872){_0x524f7b(null,_0xb0c872?_0xb0c872[_0x7995('0x15')]:![]);})[_0x7995('0x16')](function(_0x385f00){_0x524f7b(_0x385f00);});};AGIVertices[_0x7995('0x12')][_0x7995('0x17')]=function(_0x2bbe7a,_0x4cc004){this['rpc'][_0x7995('0x18')](_0x2bbe7a)[_0x7995('0x19')](function(_0x24b5bb){_0x4cc004(null,_0x24b5bb?_0x24b5bb[_0x7995('0x15')]:![]);})[_0x7995('0x16')](function(_0x1a5310){_0x4cc004(_0x1a5310);});};AGIVertices[_0x7995('0x12')][_0x7995('0x1a')]=function(_0x5377e5,_0x2eeacc){this['rpc'][_0x7995('0x1b')](_0x5377e5)[_0x7995('0x19')](function(_0x43d4b8){_0x2eeacc(null,_0x43d4b8?_0x43d4b8[_0x7995('0x15')]:![]);})[_0x7995('0x16')](function(_0x37a7d4){_0x2eeacc(_0x37a7d4);});};AGIVertices['prototype']['getSquareOdbc']=function(_0x2536c8,_0x5e6f90){this['rpc'][_0x7995('0x1c')](_0x2536c8)[_0x7995('0x19')](function(_0x4cbe10){_0x5e6f90(null,_0x4cbe10?_0x4cbe10[_0x7995('0x1d')]:![]);})['catch'](function(_0x4b1a8e){_0x5e6f90(_0x4b1a8e);});};AGIVertices[_0x7995('0x12')][_0x7995('0x1e')]=function(_0x350fd9,_0x1a8568){this[_0x7995('0x10')][_0x7995('0x1f')](_0x350fd9)['then'](function(_0x32a09a){_0x1a8568(null,_0x32a09a?_0x32a09a[_0x7995('0x15')]:![]);})[_0x7995('0x16')](function(_0x285437){_0x1a8568(_0x285437);});};AGIVertices[_0x7995('0x12')][_0x7995('0x20')]=function(_0x475351,_0x472195){this['rpc'][_0x7995('0x21')](_0x475351)[_0x7995('0x19')](function(_0x401dc3){_0x472195(null,_0x401dc3?_0x401dc3[_0x7995('0x15')]:![]);})[_0x7995('0x16')](function(_0x2a307e){_0x472195(_0x2a307e);});};AGIVertices['prototype'][_0x7995('0x22')]=function(_0x5911c3,_0x229742){var _0x49bc7e=this;this[_0x7995('0x10')][_0x7995('0x23')](_0x5911c3)[_0x7995('0x19')](function(_0x4b6f99){_0x229742(null,_0x4b6f99?_0x49bc7e[_0x7995('0x24')](_0x4b6f99['save_name']):![]);})[_0x7995('0x16')](function(_0x3250e0){_0x229742(_0x3250e0);});};AGIVertices[_0x7995('0x12')]['getMailAccount']=function(_0x530611,_0x48e573){this[_0x7995('0x10')][_0x7995('0x25')](_0x530611)[_0x7995('0x19')](function(_0x2b874d){_0x48e573(null,_0x2b874d?_0x2b874d:![]);})[_0x7995('0x16')](function(_0x1ca460){_0x48e573(_0x1ca460);});};AGIVertices['prototype']['sendMailMessage']=function(_0xfa8f15,_0x5524af,_0x553671){this[_0x7995('0x11')][_0x7995('0x26')](_0xfa8f15,_0x5524af)[_0x7995('0x19')](function(){_0x553671(null);})[_0x7995('0x16')](function(_0x510841){_0x553671(_0x510841);});};AGIVertices[_0x7995('0x12')][_0x7995('0x27')]=function(_0x5dd802,_0x48db25){this['rpc'][_0x7995('0x28')](_0x5dd802)[_0x7995('0x19')](function(_0x4a176f){if(_0x4a176f){if(_0x4a176f[_0x7995('0x29')]){_0x48db25(null,[_0x4a176f['interval']]);}else{_0x48db25(null,_[_0x7995('0x2a')](_0x4a176f[_0x7995('0x2b')],_0x7995('0x2c')));}}else{_0x48db25(null,![]);}})['catch'](function(_0x52d76d){_0x48db25(_0x52d76d);});};AGIVertices[_0x7995('0x12')]['getSoundPath']=function(_0x5d2428){return util[_0x7995('0x2d')](_0x7995('0x2e'),FILES_PATH,_0x5d2428);};AGIVertices['prototype'][_0x7995('0x2f')]=function(_0x1922b4,_0x2b772f,_0x18667c){odbc[_0x7995('0x30')](_0x1922b4,function(_0x53002a){if(_0x53002a){logger[_0x7995('0x31')](_0x7995('0x32'),_0x53002a);_0x18667c(_0x53002a);}else{logger[_0x7995('0x33')](_0x7995('0x34'));odbc['query'](_0x2b772f,function(_0x2be2c0,_0x235df7){if(_0x2be2c0){logger[_0x7995('0x33')](_0x7995('0x35'),_0x2b772f);_0x18667c(_0x2be2c0);}else{logger[_0x7995('0x33')](_0x7995('0x36'),_0x2b772f);odbc['close'](function(_0x183a68){if(_0x183a68){logger[_0x7995('0x31')](_0x7995('0x37'),_0x183a68);}_0x18667c(null,_0x235df7);});}});}});};AGIVertices[_0x7995('0x12')][_0x7995('0x38')]=function(_0x298fc2,_0x14d638){this[_0x7995('0x10')][_0x7995('0x39')](_0x298fc2)[_0x7995('0x19')](function(_0x6fe77b){_0x14d638(null,_0x6fe77b?_0x6fe77b:![]);})[_0x7995('0x16')](function(_0x7b4e67){_0x14d638(_0x7b4e67);});};AGIVertices['prototype']['createSmsMessage']=function(_0x334dff,_0x7325e8){this['rpc']['createSmsMessage'](_0x334dff)[_0x7995('0x19')](function(_0x4a9fef){_0x7325e8(null,_0x4a9fef);})['catch'](function(_0x23da6b){_0x7325e8(_0x23da6b);});};AGIVertices[_0x7995('0x12')][_0x7995('0x3a')]=function(_0x576b96,_0x46ac4f,_0x5e85b9){this[_0x7995('0x10')]['createSquareDetailsReport']({'uniqueid':this['channel'][_0x7995('0x3b')],'node':_0x576b96[_0x7995('0x3c')],'application':_0x576b96[_0x7995('0x3d')],'data':_0x46ac4f||null,'project_name':this[_0x7995('0xf')]['arg_1'],'callerid':this[_0x7995('0xf')][_0x7995('0x3e')]})[_0x7995('0x19')](function(_0x6c7bec){if(_0x5e85b9){_0x5e85b9(null,_0x6c7bec);}})['catch'](function(_0x5f28e7){if(_0x5e85b9){_0x5e85b9(_0x5f28e7);}});};AGIVertices[_0x7995('0x12')]['createSquareRecording']=function(_0x23c41d,_0x59c153,_0x2f435e,_0x4c1127){this[_0x7995('0x10')][_0x7995('0x3f')]({'uniqueid':this['channel'][_0x7995('0x3b')],'callerid':this[_0x7995('0xf')][_0x7995('0x3e')],'calleridname':this[_0x7995('0xf')]['calleridname'],'context':this[_0x7995('0xf')][_0x7995('0x40')],'extension':this[_0x7995('0xf')]['extension'],'priority':this[_0x7995('0xf')][_0x7995('0x41')],'accountcode':this[_0x7995('0xf')][_0x7995('0x42')],'dnid':this[_0x7995('0xf')]['dnid'],'projectName':this[_0x7995('0xf')][_0x7995('0x43')],'saveName':_0x59c153,'filename':_0x23c41d['file']||_0x59c153,'savePath':_0x2f435e})[_0x7995('0x19')](function(_0x5843ba){_0x4c1127(null,_0x5843ba);})[_0x7995('0x16')](function(_0x187735){_0x4c1127(_0x187735);});};AGIVertices[_0x7995('0x12')][_0x7995('0x44')]=function(_0xddf537,_0x14b537,_0x1579b9,_0x4d46bc,_0x427dcf){this[_0x7995('0x10')][_0x7995('0x44')]({'uniqueid':this['channel'][_0x7995('0x3b')],'body':_0xddf537,'direction':_0x14b537,'providerName':_0x1579b9,'providerResponse':_0x4d46bc})[_0x7995('0x19')](function(_0x12d4b8){if(_0x427dcf){_0x427dcf(null,_0x12d4b8);}})['catch'](function(_0x4ec548){if(_0x427dcf){_0x427dcf(_0x4ec548);}});};AGIVertices['prototype'][_0x7995('0x45')]=function(_0x1fd1ca,_0x4cf5db){this[_0x7995('0x10')][_0x7995('0x45')]({'firstName':_[_0x7995('0x46')](_0x1fd1ca[_0x7995('0x15')])||_[_0x7995('0x47')](_0x1fd1ca['name'])?_0x7995('0x48')+Math['random']():_0x1fd1ca[_0x7995('0x15')],'lastName':_[_0x7995('0x46')](_0x1fd1ca[_0x7995('0x49')])||_['isNil'](_0x1fd1ca['lastName'])?null:_0x1fd1ca['lastName'],'phone':_0x1fd1ca['phone'],'ListId':_0x1fd1ca[_0x7995('0x4a')],'scheduledat':_0x1fd1ca[_0x7995('0x4b')],'callbackUniqueid':this[_0x7995('0xf')][_0x7995('0x3b')],'tags':_0x7995('0x4c'),'description':_0x7995('0x4d')+_0x1fd1ca[_0x7995('0x4b')][_0x7995('0x4e')](),'priority':_0x1fd1ca[_0x7995('0x4f')]})[_0x7995('0x19')](function(_0xa7af8c){_0x4cf5db(null,_0xa7af8c);})[_0x7995('0x16')](function(_0x3da72b){_0x4cf5db(_0x3da72b);});};AGIVertices[_0x7995('0x12')][_0x7995('0x50')]=function(_0x416133,_0x447a2b){this[_0x7995('0x10')][_0x7995('0x51')](_0x416133)['then'](function(_0x56a374){_0x447a2b(null,_0x56a374?_0x56a374[_0x7995('0x15')]:![]);})[_0x7995('0x16')](function(_0x32c0d3){_0x447a2b(_0x32c0d3);});};AGIVertices['prototype']['agentPause']=function(_0x402fa0,_0x197b52,_0x5b9467){var _0x332a85={'role':'agent'};_0x332a85[_0x402fa0]=this[_0x7995('0xf')][_0x7995('0x3e')];this[_0x7995('0x10')][_0x7995('0x52')](_0x332a85,_0x197b52,this['channel']['uniqueid'])[_0x7995('0x19')](function(_0x398fac){_0x5b9467(null,_[_0x7995('0x47')](_0x398fac)?![]:!![]);})[_0x7995('0x16')](function(_0x37072){logger[_0x7995('0x31')](_0x37072);_0x5b9467(null,![]);});};AGIVertices[_0x7995('0x12')][_0x7995('0x53')]=function(_0x984c23,_0x50caf5){var _0x18f230={'role':_0x7995('0x54')};_0x18f230[_0x984c23]=this[_0x7995('0xf')][_0x7995('0x3e')];this['rpc']['agentUnpause'](_0x18f230)[_0x7995('0x19')](function(_0xebb5c8){_0x50caf5(null,_['isNil'](_0xebb5c8)?![]:!![]);})[_0x7995('0x16')](function(_0x375fc9){logger[_0x7995('0x31')](_0x375fc9);_0x50caf5(null,![]);});};AGIVertices[_0x7995('0x12')][_0x7995('0x55')]=function(_0x4ed662,_0x457d09){var _0x564fca={'role':_0x7995('0x54')};_0x564fca[_0x4ed662]=this[_0x7995('0xf')][_0x7995('0x3e')];this[_0x7995('0x10')][_0x7995('0x55')](_0x564fca)[_0x7995('0x19')](function(_0x2b3c1d){_0x457d09(null,_[_0x7995('0x47')](_0x2b3c1d)?![]:!![]);})[_0x7995('0x16')](function(_0x3f2bde){logger[_0x7995('0x31')](_0x3f2bde);_0x457d09(null,![]);});};AGIVertices[_0x7995('0x12')]['agentLogin']=function(_0x45351d,_0x23bbc1){var _0x293480={'role':_0x7995('0x54')};_0x293480[_0x45351d]=this[_0x7995('0xf')]['callerid'];var _0x4b54f2=_0x45351d!=_0x7995('0x56')?util[_0x7995('0x2d')](_0x7995('0x57'),_0x7995('0x58'),this['channel'][_0x7995('0x3e')]):undefined;this['rpc']['agentLogin'](_0x293480,_0x4b54f2)[_0x7995('0x19')](function(_0x36d27d){_0x23bbc1(null,_[_0x7995('0x47')](_0x36d27d)?![]:!![]);})[_0x7995('0x16')](function(_0x290eae){logger[_0x7995('0x31')](_0x290eae);_0x23bbc1(null,![]);});};AGIVertices[_0x7995('0x12')][_0x7995('0x59')]=function(_0x3fde86,_0x2466df){sh['exec'](_[_0x7995('0x5a')](_0x3fde86),function(_0x8908cd,_0x3c5802){var _0x4cc247=_0x3c5802[_0x7995('0x5b')](/(\r\n|\n|\r)/gm,'');_0x2466df(null,_0x4cc247);});};AGIVertices[_0x7995('0x12')][_0x7995('0x5c')]=function(_0x3a7d9d,_0x3b0d30){scripts[_0x7995('0x5c')](_0x3a7d9d[_0x7995('0x5d')],_0x3a7d9d[_0x7995('0x5e')]||_0x7995('0x5f'),_0x3a7d9d[_0x7995('0x5f')],_0x3a7d9d[_0x7995('0x60')]||'en-US',_0x3a7d9d['ssmlGender']||_0x7995('0x61'),_0x3a7d9d[_0x7995('0x62')]||_0x7995('0x63'))[_0x7995('0x19')](function(_0x4dbab8){_0x3b0d30(null,_0x4dbab8);})[_0x7995('0x16')](function(_0x2c9eb6){_0x3b0d30(_0x2c9eb6);});};AGIVertices['prototype']['googleTTS']=function(_0x3253b5,_0x305b5a){scripts['googleTTS'](_0x3253b5[_0x7995('0x5f')],_0x3253b5['google_tts_language']||'en',0x1)[_0x7995('0x19')](function(_0xea9aba){_0x305b5a(null,_0xea9aba);})['catch'](function(_0x5d9d33){_0x305b5a(_0x5d9d33);});};AGIVertices[_0x7995('0x12')]['restAPI']=function(_0x31b9e6,_0xa41fff){var _0x3dd197={'uri':_0x31b9e6[_0x7995('0x64')],'method':_0x31b9e6[_0x7995('0x65')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x31b9e6[_0x7995('0x66')])===_0x7995('0x67')&&parseInt(_0x31b9e6[_0x7995('0x66')])>=0x1?parseInt(_0x31b9e6[_0x7995('0x66')])*0x3e8:0x5*0x3e8};if(_[_0x7995('0x68')]([_0x7995('0x69'),_0x7995('0x6a')],_0x3dd197[_0x7995('0x65')][_0x7995('0x6b')]())){try{_0x3dd197[_0x7995('0x6c')]=_0x31b9e6[_0x7995('0xc')]?JSON[_0x7995('0x6d')](_0x31b9e6[_0x7995('0xc')]):{};}catch(_0x2ff7ba){logger[_0x7995('0x31')](_0x7995('0x6e'),_0x2ff7ba);}}try{_0x3dd197[_0x7995('0x6f')]=_0x31b9e6[_0x7995('0xb')]?JSON[_0x7995('0x6d')](_0x31b9e6[_0x7995('0xb')]):{};}catch(_0x33479a){logger[_0x7995('0x31')](_0x7995('0x70'),_0x33479a);}if(_0x31b9e6['computedVariables']){try{var _0x3fdb4b=require(_0x31b9e6[_0x7995('0x71')])['sync'](this,_0x3dd197);_0x3dd197['uri']=Mustache[_0x7995('0x72')](_0x31b9e6[_0x7995('0x64')],_0x3fdb4b,{},['$$','$$']);if(_0x3dd197[_0x7995('0x6f')]){_0x3dd197[_0x7995('0x6f')]=JSON[_0x7995('0x6d')](Mustache[_0x7995('0x72')](JSON['stringify'](_0x3dd197[_0x7995('0x6f')]),_0x3fdb4b,{},['$$','$$']));}if(_0x3dd197[_0x7995('0x6c')]){_0x3dd197[_0x7995('0x6c')]=JSON[_0x7995('0x6d')](Mustache[_0x7995('0x72')](JSON[_0x7995('0x73')](_0x3dd197[_0x7995('0x6c')]),_0x3fdb4b,{},['$$','$$']));}}catch(_0xc93dcb){logger['error'](_0x7995('0x74'),_0xc93dcb);}}rp(_0x3dd197)[_0x7995('0x19')](function(_0x5c04c9){var _0x479271={'statusCode':_0x5c04c9[_0x7995('0x75')]||0xc8,'statusMessage':_0x5c04c9[_0x7995('0x76')]||'OK','headers':_0x5c04c9[_0x7995('0x6f')]||{},'body':_0x5c04c9[_0x7995('0x6c')]||{}};_0xa41fff(null,_0x479271);})[_0x7995('0x16')](function(_0x4a02ea){var _0x35f6cb={'statusCode':_0x4a02ea[_0x7995('0x75')]||0x1f4,'statusMessage':_0x4a02ea['message']||_0x7995('0x77'),'headers':_0x4a02ea[_0x7995('0x78')]['headers']||{},'body':_0x4a02ea[_0x7995('0x78')]['body']||{}};_0xa41fff(null,_0x35f6cb);});};AGIVertices[_0x7995('0x12')][_0x7995('0x79')]=function(_0x3ab421,_0x428a1b){scripts[_0x7995('0x79')](this['channel'][_0x7995('0x3b')],_0x3ab421[_0x7995('0x7a')],_0x3ab421[_0x7995('0x5f')],_0x3ab421['dialogflow_language']||'en')[_0x7995('0x19')](function(_0x3f3434){_0x428a1b(null,_0x3f3434);})[_0x7995('0x16')](function(_0x308a26){_0x428a1b(_0x308a26);});};AGIVertices['prototype'][_0x7995('0x7b')]=function(_0xf59a39,_0x3a5f5e){scripts['googleDialogflowV2'](this['channel'][_0x7995('0x3b')],_0xf59a39[_0x7995('0x7c')],_0xf59a39['client_email'],_0xf59a39['private_key'],_0xf59a39[_0x7995('0x5f')],_0xf59a39[_0x7995('0x7d')]||'en')[_0x7995('0x19')](function(_0x2384c1){_0x3a5f5e(null,_0x2384c1);})[_0x7995('0x16')](function(_0x551b5e){_0x3a5f5e(_0x551b5e);});};AGIVertices['prototype'][_0x7995('0x7e')]=function(_0x54fad4,_0x588df7){scripts[_0x7995('0x7e')](this[_0x7995('0xf')],_0x54fad4)[_0x7995('0x19')](function(_0x5eb360){_0x588df7(null,_0x5eb360);})[_0x7995('0x16')](function(_0x3cb1d2){_0x588df7(_0x3cb1d2);});};AGIVertices[_0x7995('0x12')][_0x7995('0x7f')]=function(_0x267a7f,_0x5799d1){scripts[_0x7995('0x7f')](_0x267a7f[_0x7995('0x7a')],_0x267a7f[_0x7995('0x5f')],_0x267a7f[_0x7995('0x80')]||'en-US',_0x267a7f[_0x7995('0x81')])[_0x7995('0x19')](function(_0x522110){_0x5799d1(null,_0x522110);})[_0x7995('0x16')](function(_0x20683e){_0x5799d1(_0x20683e);});};AGIVertices['prototype'][_0x7995('0x82')]=function(_0x50efab,_0x1b4b34,_0x51e7d7){scripts[_0x7995('0x82')](_0x1b4b34,_0x50efab['key'],_0x50efab[_0x7995('0x83')]||_0x7995('0x84'),this['isConfigured'](_0x50efab[_0x7995('0x85')])?_0x50efab['model']:undefined)['then'](function(_0x7b9e26){_0x51e7d7(null,_0x7b9e26);})[_0x7995('0x16')](function(_0x784492){_0x51e7d7(_0x784492);});};AGIVertices[_0x7995('0x12')]['awsPolly']=function(_0x1ea76d,_0x35044a){scripts['awsPolly'](_0x1ea76d['aws_access_key_id'],_0x1ea76d[_0x7995('0x86')],_0x1ea76d['aws_polly_region'],_0x1ea76d[_0x7995('0x87')]||_0x7995('0x88'),_0x1ea76d[_0x7995('0x5f')],_0x1ea76d['aws_text_type']||'text')[_0x7995('0x19')](function(_0x553c71){_0x35044a(null,_0x553c71);})[_0x7995('0x16')](function(_0x44891e){_0x35044a(_0x44891e);});};AGIVertices[_0x7995('0x12')][_0x7995('0x89')]=function(_0x4ff5e7,_0x52d102){scripts['awsLex'](this[_0x7995('0xf')][_0x7995('0x3b')],_0x4ff5e7[_0x7995('0x8a')],_0x4ff5e7[_0x7995('0x86')],_0x4ff5e7[_0x7995('0x8b')],_0x4ff5e7[_0x7995('0x5f')],_0x4ff5e7['aws_bot_name'])['then'](function(_0x1a2902){_0x52d102(null,_0x1a2902);})['catch'](function(_0x4cfd78){_0x52d102(_0x4cfd78);});};AGIVertices[_0x7995('0x12')]['googleASR']=function(_0x57a164,_0x35c3f3,_0x3541d7){scripts[_0x7995('0x8c')](_0x35c3f3,_0x57a164['key'],_0x57a164[_0x7995('0x8d')]||_0x7995('0x84'))[_0x7995('0x19')](function(_0x340f6d){_0x3541d7(null,_0x340f6d);})[_0x7995('0x16')](function(_0x178746){_0x3541d7(_0x178746);});};AGIVertices[_0x7995('0x12')][_0x7995('0x8e')]=function(_0x19d746,_0x570b71,_0x3eb3fa){scripts[_0x7995('0x8e')](_0x570b71,_0x19d746[_0x7995('0x8f')],_0x19d746[_0x7995('0x90')],_0x19d746[_0x7995('0x91')])['then'](function(_0x1ea316){_0x3eb3fa(null,_0x1ea316);})[_0x7995('0x16')](function(_0x21fe4f){_0x3eb3fa(_0x21fe4f);});};AGIVertices['prototype']['clear']=function(_0x5e04ed){var _0xb28dea=_[_0x7995('0x68')](verticesWithRetry,_0x5e04ed[_0x7995('0x3d')])?_0x5e04ed:_[_0x7995('0x92')](_0x5e04ed);for(var _0x16a94d in _0xb28dea){if(_0xb28dea[_0x7995('0x93')](_0x16a94d)){if(_0xb28dea[_0x16a94d]&&_['isString'](_0xb28dea[_0x16a94d])){if(_[_0x7995('0x68')](recursiveMapAttributes,_0x16a94d)){_0xb28dea[_0x16a94d]=this['replaceObjectAllVariables'](_0xb28dea[_0x16a94d]);}else{_0xb28dea[_0x16a94d]=this[_0x7995('0x94')](_0xb28dea[_0x16a94d]);}}}}return _0xb28dea;};AGIVertices[_0x7995('0x12')][_0x7995('0x95')]=function(_0x2cc9a4){for(var _0x162993 in _0x2cc9a4){if(_0x2cc9a4[_0x7995('0x93')](_0x162993)){if(_[_0x7995('0x96')](_0x2cc9a4[_0x162993])){this[_0x7995('0x95')](_0x2cc9a4[_0x162993]);}else if(_[_0x7995('0x97')](_0x2cc9a4[_0x162993])){for(var _0x1b34fe=0x0;_0x1b34fe<_0x2cc9a4[_0x162993][_0x7995('0x98')];_0x1b34fe++){this['recursiveNodeIndex'](_0x2cc9a4[_0x162993][_0x1b34fe]);}}else if(_[_0x7995('0x99')](_0x2cc9a4[_0x162993])){_0x2cc9a4[_0x162993]=this['replaceAllVariables'](_0x2cc9a4[_0x162993]);}}}};AGIVertices[_0x7995('0x12')][_0x7995('0x9a')]=function(_0x592ae3,_0x493e74){for(var _0x2a25eb in _0x592ae3){if(_0x592ae3[_0x7995('0x93')](_0x2a25eb)){if(_[_0x7995('0x96')](_0x592ae3[_0x2a25eb])){if(!_[_0x7995('0x46')](_0x592ae3[_0x2a25eb])){this[_0x7995('0x9a')](_0x592ae3[_0x2a25eb],util[_0x7995('0x2d')](_0x7995('0x9b'),_0x493e74,_0x2a25eb));}}else if(_[_0x7995('0x97')](_0x592ae3[_0x2a25eb])){for(var _0x2b586f=0x0;_0x2b586f<_0x592ae3[_0x2a25eb][_0x7995('0x98')];_0x2b586f++){this[_0x7995('0x9a')](_0x592ae3[_0x2a25eb][_0x2b586f],util[_0x7995('0x2d')]('%s.%s',_0x493e74,_0x2a25eb+'['+_0x2b586f+']'));}}else{if(!_['isNil'](_0x592ae3[_0x2a25eb])){this[_0x7995('0xf')][_0x7995('0x9c')](util[_0x7995('0x2d')](_0x7995('0x9b'),_0x493e74,_0x2a25eb),_0x592ae3[_0x2a25eb]);}}}}};AGIVertices[_0x7995('0x12')]['replaceObjectAllVariables']=function(_0xe8c08e){try{var _0x459777=JSON['parse'](_0xe8c08e);this[_0x7995('0x95')](_0x459777);return JSON['stringify'](_0x459777);}catch(_0x37416c){return this[_0x7995('0x94')](_0xe8c08e);}};AGIVertices[_0x7995('0x12')]['replaceAllVariables']=function(_0x3501ac){var _0x1cd9a0=_0x3501ac[_0x7995('0x9d')]('{');for(var _0x15ca94=0x1;_0x15ca94<_0x1cd9a0[_0x7995('0x98')];_0x15ca94+=0x1){var _0x8a5aa8=_0x1cd9a0[_0x15ca94][_0x7995('0x9d')]('}');if(_0x8a5aa8['length']>0x1){_0x3501ac=_0x3501ac['replaceAll']('{'+_0x8a5aa8[0x0]+'}',this['channel'][_0x7995('0x13')](_0x8a5aa8[0x0])[_0x7995('0x9e')]||_0x8a5aa8[0x0]);}}if(_0x1cd9a0['length']===0x1){return _0x3501ac['toString']();}return this[_0x7995('0x94')](_0x3501ac);};AGIVertices[_0x7995('0x12')]['getAndSetVariable']=function(_0x4b07de,_0x538bd3){var _0x5b591b=this[_0x7995('0xf')][_0x7995('0x13')](_0x4b07de);if(_0x5b591b[_0x7995('0x9f')]===-0x1){return _0x5b591b;}logger[_0x7995('0x33')](util['format'](_0x7995('0xa0'),_0x538bd3,_0x5b591b[_0x7995('0x9e')]));return this['channel'][_0x7995('0x9c')](_0x538bd3,_0x5b591b[_0x7995('0x9e')]);};AGIVertices[_0x7995('0x12')]['isConfigured']=function(_0x2fe20d){return _0x2fe20d&&_0x2fe20d!=='0'&&_0x2fe20d!=='-1'&&_0x2fe20d!=='';};AGIVertices[_0x7995('0x12')]['maxRetry']=function(_0x3615ac){this[_0x7995('0x3a')][_0x7995('0xa1')](this,_0x3615ac,'-');_0x3615ac[_0x7995('0xa2')]=_0x3615ac[_0x7995('0xa3')];return{'code':0xc8,'result':'-'};};AGIVertices[_0x7995('0x12')][_0x7995('0xa4')]=function(_0x114f3c){logger[_0x7995('0x33')](util[_0x7995('0x2d')](_0x7995('0xa5'),_0x114f3c[_0x7995('0x3c')]));if(!this[_0x7995('0xa6')](_0x114f3c['text'])){return this[_0x7995('0xf')][_0x7995('0xa7')](_0x7995('0xa8'));}var _0x3c551f='\x22'+_0x114f3c['text']+'\x22';if(this[_0x7995('0xa6')](_0x114f3c[_0x7995('0x78')])){_0x3c551f+=','+_0x114f3c[_0x7995('0x78')];}var _0x52af9b=this[_0x7995('0xf')][_0x7995('0xa9')](_0x7995('0xaa'),_0x3c551f);if(_0x52af9b[_0x7995('0x9f')]===-0x1){return _0x52af9b;}return this[_0x7995('0xf')][_0x7995('0xa7')](util[_0x7995('0x2d')]('Executed\x20command\x20MRCPSynth\x20%s',_0x3c551f));};AGIVertices[_0x7995('0x12')]['mrcprecog']=function(_0x101bc6){logger[_0x7995('0x33')](util[_0x7995('0x2d')]('Enter\x20in\x20MRCPRecog\x20(%s)\x20block',_0x101bc6[_0x7995('0x3c')]));if(!this['isConfigured'](_0x101bc6['grammar'])){return this['channel']['noop'](_0x7995('0xab'));}var _0x1fbb84=_0x101bc6['grammar'];if(this[_0x7995('0xa6')](_0x101bc6[_0x7995('0x78')])){_0x1fbb84+=','+_0x101bc6['options'];}var _0x151893=this[_0x7995('0xf')][_0x7995('0xa9')](_0x7995('0xac'),_0x1fbb84);if(_0x151893[_0x7995('0x9f')]===-0x1){return _0x151893;}var _0x56b5ff=this[_0x7995('0xad')](_0x7995('0xae'),_0x7995('0xaf'));if(_0x56b5ff[_0x7995('0x9f')]===-0x1){return _0x56b5ff;}var _0x55387b=this[_0x7995('0xad')](_0x7995('0xb0'),_0x7995('0xb1'));if(_0x55387b[_0x7995('0x9f')]===-0x1){return _0x55387b;}var _0x370bd9=this[_0x7995('0xad')](_0x7995('0xb2'),_0x7995('0xb3'));if(_0x370bd9[_0x7995('0x9f')]===-0x1){return _0x370bd9;}return this[_0x7995('0xf')]['noop'](util[_0x7995('0x2d')]('Executed\x20command\x20MRCPRecog\x20%s',_0x1fbb84));};AGIVertices[_0x7995('0x12')][_0x7995('0xb4')]=function(_0x2a9264){logger['info'](util['format'](_0x7995('0xb5'),_0x2a9264[_0x7995('0x3c')]));return this['channel'][_0x7995('0xb4')]([_0x2a9264['command'],_0x2a9264[_0x7995('0xb6')]]);};AGIVertices[_0x7995('0x12')][_0x7995('0xb7')]=function(_0x4e5667){logger['info'](util['format'](_0x7995('0xb8'),_0x4e5667[_0x7995('0x3c')]));if(this[_0x7995('0xa6')](_0x4e5667[_0x7995('0x66')])){logger['info'](util[_0x7995('0x2d')](_0x7995('0xb9'),_0x4e5667[_0x7995('0x66')]));var _0x241427=this[_0x7995('0xf')]['wait'](_0x4e5667['timeout']);if(_0x241427['result']===-0x1){return _0x241427;}}return this[_0x7995('0xf')][_0x7995('0xb7')]();};AGIVertices['prototype'][_0x7995('0x4c')]=function(_0x5635d6){logger[_0x7995('0x33')](util[_0x7995('0x2d')](_0x7995('0xba'),_0x5635d6[_0x7995('0x3c')]));if(!this['isConfigured'](_0x5635d6[_0x7995('0x4a')])){return this[_0x7995('0xf')][_0x7995('0x31')](_0x5635d6,_0x7995('0xbb'));}_0x5635d6[_0x7995('0x4b')]=moment();if(this[_0x7995('0xa6')](_0x5635d6[_0x7995('0xbc')])){_0x5635d6[_0x7995('0x4b')]=moment()[_0x7995('0xbd')](_0x5635d6[_0x7995('0xbc')],_0x7995('0xbe'));}if(!this[_0x7995('0xa6')](_0x5635d6[_0x7995('0x4f')])){_0x5635d6[_0x7995('0x4f')]=0x2;}this['createCmContact'][_0x7995('0xa1')](this,_0x5635d6);return this['channel'][_0x7995('0xa7')](util[_0x7995('0x2d')]('CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s',_0x5635d6[_0x7995('0xbf')],_0x5635d6['list_id'],_0x5635d6[_0x7995('0x4b')]));};AGIVertices[_0x7995('0x12')]['custom_app']=function(_0x4985f3){logger['info'](util[_0x7995('0x2d')](_0x7995('0xc0'),_0x4985f3[_0x7995('0x3c')]));var _0x2b7bc2=this['channel'][_0x7995('0xa9')](_0x4985f3[_0x7995('0xc1')],_0x4985f3[_0x7995('0x78')]);if(_0x2b7bc2[_0x7995('0x9f')]===-0x1){return _0x2b7bc2;}return this[_0x7995('0xf')][_0x7995('0xa7')](util[_0x7995('0x2d')](_0x7995('0xc2'),_0x4985f3['application'],_0x4985f3[_0x7995('0x78')]));};AGIVertices[_0x7995('0x12')][_0x7995('0xc3')]=function(_0x35f0f8){logger['info'](util[_0x7995('0x2d')](_0x7995('0xc4'),_0x35f0f8[_0x7995('0x3c')]));if(!this[_0x7995('0xa6')](_0x35f0f8[_0x7995('0x5f')])){return this[_0x7995('0xf')]['noop'](_0x7995('0xa8'));}var _0x2ee5d8='\x22'+_0x35f0f8[_0x7995('0x5f')]+'\x22';if(this[_0x7995('0xa6')](_0x35f0f8[_0x7995('0x78')])){_0x2ee5d8+=','+_0x35f0f8[_0x7995('0x78')];}var _0x2401b3=this[_0x7995('0xf')][_0x7995('0xa9')](_0x7995('0xaa'),_0x2ee5d8);if(_0x2401b3[_0x7995('0x9f')]===-0x1){return _0x2401b3;}return this[_0x7995('0xf')][_0x7995('0xa7')](util[_0x7995('0x2d')](_0x7995('0xc5'),_0x2ee5d8));};AGIVertices[_0x7995('0x12')][_0x7995('0xc6')]=function(_0x1f254d){logger[_0x7995('0x33')](util[_0x7995('0x2d')](_0x7995('0xc7'),_0x1f254d['label']));if(!this['isConfigured'](_0x1f254d[_0x7995('0x5f')])){return this[_0x7995('0xf')]['noop'](_0x7995('0xa8'));}var _0x4c251c='\x22'+_0x1f254d[_0x7995('0x5f')]+'\x22';if(this['isConfigured'](_0x1f254d[_0x7995('0x78')])){_0x4c251c+=','+_0x1f254d[_0x7995('0x78')];}var _0x32c379=this[_0x7995('0xf')][_0x7995('0xa9')](_0x7995('0xaa'),_0x4c251c);if(_0x32c379[_0x7995('0x9f')]===-0x1){return _0x32c379;}return this[_0x7995('0xf')][_0x7995('0xa7')](util[_0x7995('0x2d')]('Executed\x20command\x20MRCPSynth\x20%s',_0x4c251c));};AGIVertices[_0x7995('0x12')][_0x7995('0xc8')]=function(_0x1d0481){logger[_0x7995('0x33')](util['format'](_0x7995('0xc9'),_0x1d0481[_0x7995('0x3c')]));if(!this[_0x7995('0xa6')](_0x1d0481[_0x7995('0xca')])){return this['channel'][_0x7995('0xa7')](_0x7995('0xab'));}var _0x31d0e9=_0x1d0481[_0x7995('0xca')];if(this[_0x7995('0xa6')](_0x1d0481[_0x7995('0x78')])){_0x31d0e9+=','+_0x1d0481[_0x7995('0x78')];}var _0x36ad5e=this[_0x7995('0xf')]['exec'](_0x7995('0xac'),_0x31d0e9);if(_0x36ad5e['result']===-0x1){return _0x36ad5e;}var _0x363aad=this[_0x7995('0xad')](_0x7995('0xae'),_0x7995('0xcb'));if(_0x363aad['result']===-0x1){return _0x363aad;}var _0x40a98f=this[_0x7995('0xad')](_0x7995('0xb0'),_0x7995('0xcc'));if(_0x40a98f[_0x7995('0x9f')]===-0x1){return _0x40a98f;}var _0x1b808f=this[_0x7995('0xad')](_0x7995('0xb2'),_0x7995('0xcd'));if(_0x1b808f[_0x7995('0x9f')]===-0x1){return _0x1b808f;}return this[_0x7995('0xf')][_0x7995('0xa7')](util[_0x7995('0x2d')](_0x7995('0xce'),_0x31d0e9));};AGIVertices['prototype']['sestekasr']=function(_0xdfc11d){logger[_0x7995('0x33')](util[_0x7995('0x2d')]('Enter\x20in\x20SESTEKASR\x20(%s)\x20block',_0xdfc11d[_0x7995('0x3c')]));if(!this[_0x7995('0xa6')](_0xdfc11d[_0x7995('0xca')])){return this['channel'][_0x7995('0xa7')](_0x7995('0xab'));}var _0x34b03e=_0xdfc11d[_0x7995('0xca')];if(this[_0x7995('0xa6')](_0xdfc11d[_0x7995('0x78')])){_0x34b03e+=','+_0xdfc11d[_0x7995('0x78')];}var _0x503d2b=this[_0x7995('0xf')][_0x7995('0xa9')](_0x7995('0xac'),_0x34b03e);if(_0x503d2b['result']===-0x1){return _0x503d2b;}var _0x580571=this[_0x7995('0xad')]('RECOG_CONFIDENCE()',_0x7995('0xcf'));if(_0x580571[_0x7995('0x9f')]===-0x1){return _0x580571;}var _0x311859=this[_0x7995('0xad')](_0x7995('0xb0'),'SESTEK_ASR_TRANSCRIPT');if(_0x311859['result']===-0x1){return _0x311859;}var _0x3b1e29=this[_0x7995('0xad')](_0x7995('0xb2'),_0x7995('0xd0'));if(_0x3b1e29[_0x7995('0x9f')]===-0x1){return _0x3b1e29;}return this[_0x7995('0xf')][_0x7995('0xa7')](util[_0x7995('0x2d')](_0x7995('0xce'),_0x34b03e));};AGIVertices[_0x7995('0x12')]['database']=function(_0x2ebf7c){logger[_0x7995('0x33')](util[_0x7995('0x2d')](_0x7995('0xd1'),_0x2ebf7c['label']));if(!this['isConfigured'](_0x2ebf7c['odbc_id'])){return this['channel']['error'](_0x2ebf7c,_0x7995('0xd2'));}var _0x5d2883=this['getSquareOdbc'][_0x7995('0xa1')](this,_0x2ebf7c[_0x7995('0xd3')]);if(!_0x5d2883){return this[_0x7995('0xf')]['error'](_0x2ebf7c,_0x7995('0xd4'));}if(!this['isConfigured'](_0x2ebf7c[_0x7995('0xd5')])){return this[_0x7995('0xf')][_0x7995('0x31')](_0x2ebf7c,'no\x20query\x20configured');}var _0x453957=_0x2ebf7c[_0x7995('0xd5')][_0x7995('0x5b')](/(\r\n|\n|\r)/gm,'\x20');this['channel'][_0x7995('0xa7')](util[_0x7995('0x2d')](_0x7995('0xd6'),_0x453957));var _0x141fb5=this[_0x7995('0x2f')]['sync'](this,_0x5d2883,_0x453957);this[_0x7995('0x3a')][_0x7995('0xa1')](this,_0x2ebf7c,_0x453957);if(!this[_0x7995('0xa6')](_0x2ebf7c['variable_id'])){return this[_0x7995('0xf')][_0x7995('0xa7')](_0x7995('0xd7'));}var _0x3ba033=this[_0x7995('0x13')]['sync'](this,_0x2ebf7c[_0x7995('0xd8')]);if(!_0x3ba033){return this[_0x7995('0xf')][_0x7995('0x31')](_0x2ebf7c,_0x7995('0xd9'));}var _0x2bc786=this;_0x141fb5[_0x7995('0xda')](function(_0x43bf71,_0x5baca7){Object['keys'](_0x43bf71)[_0x7995('0xda')](function(_0x273dad){_0x2bc786['channel']['setVariable'](util[_0x7995('0x2d')](_0x7995('0xdb'),_0x3ba033,_0x5baca7,_0x273dad),_0x43bf71[_0x273dad]);});});this[_0x7995('0xf')][_0x7995('0x9c')](util[_0x7995('0x2d')](_0x7995('0xdc'),_0x3ba033),_0x141fb5[_0x7995('0x98')]);return this['channel'][_0x7995('0xa7')](util[_0x7995('0x2d')](_0x7995('0xdd'),_0x3ba033));};AGIVertices[_0x7995('0x12')][_0x7995('0xde')]=function(_0x3b017b){logger['debug'](util[_0x7995('0x2d')](_0x7995('0xdf'),_0x3b017b[_0x7995('0x3c')]));if(!this[_0x7995('0xa6')](_0x3b017b[_0x7995('0xe0')])){return this[_0x7995('0xf')][_0x7995('0x31')](_0x3b017b,'no\x20user\x20selected');}var _0x8c33c0=this[_0x7995('0x1e')][_0x7995('0xa1')](this,_0x3b017b[_0x7995('0xe0')]);if(!_0x8c33c0){return this['channel'][_0x7995('0x31')](_0x3b017b,'no\x20user\x20found');}var _0x21ba9b=this[_0x7995('0xf')]['exec']('DIAL',[util['format'](_0x7995('0xe1'),_0x8c33c0),_0x3b017b[_0x7995('0x66')],_0x3b017b[_0x7995('0xe2')],_0x3b017b[_0x7995('0x64')]]);if(_0x21ba9b[_0x7995('0x9f')]===-0x1){return _0x21ba9b;}return this[_0x7995('0xf')][_0x7995('0xa7')](util[_0x7995('0x2d')](_0x7995('0xe3'),_0x7995('0xe4')));};AGIVertices[_0x7995('0x12')][_0x7995('0xe5')]=function(_0x5dccc8){logger['info'](util[_0x7995('0x2d')]('Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block',_0x5dccc8['label']));if(!this[_0x7995('0xa6')](_0x5dccc8[_0x7995('0x7a')])){return this[_0x7995('0xf')][_0x7995('0xa7')](_0x7995('0xe6'));}if(!this[_0x7995('0xa6')](_0x5dccc8[_0x7995('0x5f')])){return this[_0x7995('0xf')][_0x7995('0xa7')](_0x7995('0xa8'));}this[_0x7995('0xf')][_0x7995('0xe7')]=!![];this['createSquareDetailsReport'](_0x5dccc8);this[_0x7995('0x44')](_0x5dccc8[_0x7995('0x5f')],'in','','');this[_0x7995('0xf')][_0x7995('0xa7')](util[_0x7995('0x2d')](_0x7995('0xe8'),_0x5dccc8[_0x7995('0x5f')]));var _0x551480=this[_0x7995('0x79')][_0x7995('0xa1')](this,_0x5dccc8);if(_0x551480){for(var _0x59a107 in _0x551480){if(_0x551480[_0x7995('0x93')](_0x59a107)){this[_0x7995('0xf')]['setVariable'](util[_0x7995('0x2d')]('DIALOGFLOW_%s',_0x59a107[_0x7995('0x6b')]()),_0x551480[_0x59a107]);}}this[_0x7995('0x44')](_0x551480[_0x7995('0xe9')],'out',_0x7995('0xe5'),'');return this[_0x7995('0xf')][_0x7995('0xa7')](util[_0x7995('0x2d')](_0x7995('0xea'),_0x551480[_0x7995('0xe9')]));}return this[_0x7995('0xf')]['error'](_0x5dccc8,'Dialogflow\x20is\x20unreachable');};AGIVertices[_0x7995('0x12')][_0x7995('0xeb')]=function(_0x31eaee){logger[_0x7995('0x33')](util[_0x7995('0x2d')](_0x7995('0xec'),_0x31eaee['label']));if(!this[_0x7995('0xa6')](_0x31eaee[_0x7995('0x7c')])){return this[_0x7995('0xf')][_0x7995('0xa7')]('no\x20project_id\x20configured');}if(!this['isConfigured'](_0x31eaee[_0x7995('0xed')])){return this[_0x7995('0xf')]['noop'](_0x7995('0xee'));}if(!this[_0x7995('0xa6')](_0x31eaee['private_key'])){return this[_0x7995('0xf')][_0x7995('0xa7')](_0x7995('0xef'));}if(!this[_0x7995('0xa6')](_0x31eaee[_0x7995('0x7d')])){return this['channel']['noop'](_0x7995('0xf0'));}if(!this[_0x7995('0xa6')](_0x31eaee[_0x7995('0x5f')])){return this[_0x7995('0xf')][_0x7995('0xa7')]('no\x20text\x20configured');}this[_0x7995('0xf')][_0x7995('0xe7')]=!![];this[_0x7995('0x3a')](_0x31eaee);this[_0x7995('0x44')](_0x31eaee[_0x7995('0x5f')],'in','','');this['channel']['noop'](util['format']('Trying\x20DialogflowV2:\x20%s',_0x31eaee[_0x7995('0x5f')]));var _0x318a40=this['googleDialogflowV2'][_0x7995('0xa1')](this,_0x31eaee);if(_0x318a40){for(var _0x2f8674 in _0x318a40){if(_0x318a40['hasOwnProperty'](_0x2f8674)){if(_0x2f8674!=='providerResponse'){this[_0x7995('0xf')][_0x7995('0x9c')](util[_0x7995('0x2d')](_0x7995('0xf1'),_0x2f8674[_0x7995('0x6b')]()),_0x318a40[_0x2f8674]);}}}this[_0x7995('0x44')](_0x318a40[_0x7995('0xe9')],'out','dialogflowV2',_0x318a40[_0x7995('0xf2')]);return this[_0x7995('0xf')][_0x7995('0xa7')](util['format'](_0x7995('0xf3'),_0x318a40[_0x7995('0xe9')]));}return this[_0x7995('0xf')][_0x7995('0x31')](_0x31eaee,_0x7995('0xf4'));};AGIVertices[_0x7995('0x12')][_0x7995('0xf5')]=function(_0x1b4cab){logger[_0x7995('0x33')](util['format']('Enter\x20in\x20SESTEKNDA\x20(%s)\x20block',_0x1b4cab[_0x7995('0x3c')]));if(!this['isConfigured'](_0x1b4cab[_0x7995('0xf6')])){return this['channel'][_0x7995('0xa7')](_0x7995('0xf7'));}if(!this[_0x7995('0xa6')](_0x1b4cab['username'])){return this['channel'][_0x7995('0xa7')](_0x7995('0xf8'));}if(!this[_0x7995('0xa6')](_0x1b4cab[_0x7995('0xf9')])){return this[_0x7995('0xf')][_0x7995('0xa7')](_0x7995('0xfa'));}if(!this[_0x7995('0xa6')](_0x1b4cab[_0x7995('0xfb')])){return this[_0x7995('0xf')][_0x7995('0xa7')]('no\x20text\x20configured');}this[_0x7995('0xf')][_0x7995('0xe7')]=!![];this[_0x7995('0x3a')](_0x1b4cab);this[_0x7995('0x44')](_0x1b4cab[_0x7995('0x5f')],'in','','');this['channel'][_0x7995('0xa7')](util[_0x7995('0x2d')](_0x7995('0xfc'),_0x1b4cab[_0x7995('0x5f')]));var _0x3f3128=this[_0x7995('0x7e')][_0x7995('0xa1')](this,_0x1b4cab);if(_0x3f3128){for(var _0x2b812f in _0x3f3128){if(_0x3f3128[_0x7995('0x93')](_0x2b812f)){this['channel']['setVariable'](util[_0x7995('0x2d')](_0x7995('0xfd'),_0x2b812f[_0x7995('0x6b')]()),_0x3f3128[_0x2b812f]);}}this[_0x7995('0x44')](_0x3f3128[_0x7995('0xe9')],'out',_0x7995('0xf5'),'');if(_0x3f3128[_0x7995('0xfe')]){this[_0x7995('0xf')][_0x7995('0xa7')](util[_0x7995('0x2d')](_0x7995('0xff'),_0x3f3128[_0x7995('0xfe')]));var _0x45d3c6=this[_0x7995('0xf')]['streamFile'](_0x3f3128['audiofile']);try{fs[_0x7995('0x100')](_0x3f3128[_0x7995('0xfe')]+_0x7995('0x101'));}catch(_0x296643){logger[_0x7995('0x31')](_0x296643);}return _0x45d3c6;}else{return this[_0x7995('0xf')][_0x7995('0xa7')](util[_0x7995('0x2d')]('SestekNDA\x20Result\x20%s',_0x3f3128['speech']));}}return this[_0x7995('0xf')][_0x7995('0x31')](_0x1b4cab,_0x7995('0x102'));};AGIVertices[_0x7995('0x12')]['end']=function(_0x580476){logger[_0x7995('0x33')](util[_0x7995('0x2d')](_0x7995('0x103'),_0x580476[_0x7995('0x3c')]));return this[_0x7995('0xf')][_0x7995('0xa7')](_0x7995('0x104'));};AGIVertices[_0x7995('0x12')][_0x7995('0x105')]=function(_0x2c3179){logger[_0x7995('0x33')](util[_0x7995('0x2d')]('Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block',_0x2c3179['label']));var _0x24111a='';if(_0x2c3179[_0x7995('0x106')]){if(!this[_0x7995('0xa6')](_0x2c3179[_0x7995('0x106')])){return this['channel'][_0x7995('0x31')](_0x2c3179,'no\x20trunk\x20selected');}else{var _0x2e460c=parseInt(_0x2c3179[_0x7995('0x106')],0xa);if(isNaN(_0x2e460c)){_0x24111a=_0x2c3179[_0x7995('0x106')];}else{_0x24111a=this[_0x7995('0x20')][_0x7995('0xa1')](this,_0x2c3179[_0x7995('0x106')]);if(!_0x24111a){return this['channel'][_0x7995('0x31')](_0x2c3179,_0x7995('0x107'));}}}}else if(_0x2c3179[_0x7995('0x108')]){_0x24111a=_0x2c3179[_0x7995('0x108')];}else{return this['channel']['error'](_0x2c3179,_0x7995('0x109'));}var _0xbc2f6=this[_0x7995('0xf')][_0x7995('0xa9')]('DIAL',[util[_0x7995('0x2d')](_0x7995('0x10a'),_0x24111a,_0x2c3179[_0x7995('0xbf')]),_0x2c3179['timeout'],_0x2c3179[_0x7995('0xe2')],_0x2c3179[_0x7995('0x64')]]);if(_0xbc2f6[_0x7995('0x9f')]===-0x1){return _0xbc2f6;}return this['channel'][_0x7995('0xa7')](util[_0x7995('0x2d')](_0x7995('0xe3'),_0x7995('0xe4')));};AGIVertices[_0x7995('0x12')][_0x7995('0x10b')]=function(_0x1f6c3e){logger[_0x7995('0x33')](util[_0x7995('0x2d')]('Enter\x20in\x20FINALLY\x20(%s)\x20block',_0x1f6c3e[_0x7995('0x3c')]));return this[_0x7995('0xf')][_0x7995('0xa7')](_0x7995('0x10b'));};AGIVertices['prototype'][_0x7995('0x10c')]=function(_0x25494f){logger[_0x7995('0x33')](util[_0x7995('0x2d')]('Enter\x20in\x20GETDIGITS\x20(%s)\x20block',_0x25494f[_0x7995('0x3c')]));if(_0x25494f[_0x7995('0xa2')]===0x0){return this[_0x7995('0xa3')](_0x25494f);}_0x25494f[_0x7995('0xa2')]-=0x1;if(!this[_0x7995('0xa6')](_0x25494f[_0x7995('0x10d')])){return this[_0x7995('0xf')]['error'](_0x25494f,_0x7995('0x10e'));}var _0x3b0327=this[_0x7995('0x22')][_0x7995('0xa1')](this,_0x25494f[_0x7995('0x10d')]);if(!_0x3b0327){return this['channel'][_0x7995('0x31')](_0x25494f,'no\x20file\x20audio\x20found');}if(!this[_0x7995('0xa6')](_0x25494f[_0x7995('0xd8')])){return this[_0x7995('0xf')]['error']('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x533742=this[_0x7995('0xf')][_0x7995('0x10f')](_0x3b0327,_0x25494f[_0x7995('0x110')],_0x25494f[_0x7995('0x111')]);var _0x17fab0=_0x533742[_0x7995('0x9f')]?_0x533742['result'][_0x7995('0x4e')]():'';logger[_0x7995('0x33')](_0x7995('0x112'),JSON[_0x7995('0x73')](_0x533742));if(_0x533742['result']===-0x1){this[_0x7995('0x3a')][_0x7995('0xa1')](this,_0x25494f,_0x17fab0);return _0x533742;}else if(_0x533742['extra']===_0x7995('0x66')){_0x533742['result']=_0x17fab0[_0x7995('0x98')]>=parseInt(_0x25494f[_0x7995('0x113')])?'x':'i';}else{_0x533742[_0x7995('0x9f')]=_0x17fab0['length']>=parseInt(_0x25494f['mindigit'])&&_0x17fab0[_0x7995('0x98')]<=parseInt(_0x25494f[_0x7995('0x111')])?'x':'i';}var _0x90ad8=this[_0x7995('0x13')][_0x7995('0xa1')](this,_0x25494f[_0x7995('0xd8')]);if(!_0x90ad8){return this[_0x7995('0xf')][_0x7995('0x31')](_0x25494f,_0x7995('0xd9'));}this[_0x7995('0xf')][_0x7995('0x9c')](_0x90ad8,_0x17fab0);if(this['isConfigured'](_0x25494f['hiddendigitsnum'])){var _0x6e3230=parseInt(_0x25494f[_0x7995('0x114')],0xa);var _0x164203=rs[_0x7995('0x115')]({'charset':'*','length':_0x6e3230});var _0x480d85=_0x17fab0['length'];if(_0x480d85>0x0){if(_0x480d85>_0x6e3230){this[_0x7995('0x3a')][_0x7995('0xa1')](this,_0x25494f,_0x25494f['hiddendigitspos']==='first'?_0x164203+_0x17fab0[_0x7995('0x116')](_0x6e3230):_0x17fab0[_0x7995('0x116')](0x0,_0x480d85-_0x6e3230)+_0x164203);}else{this[_0x7995('0x3a')][_0x7995('0xa1')](this,_0x25494f,rs[_0x7995('0x115')]({'charset':'*','length':_0x480d85}));}}else{this['createSquareDetailsReport'][_0x7995('0xa1')](this,_0x25494f,'');}}else{this[_0x7995('0x3a')]['sync'](this,_0x25494f,_0x17fab0);}return _0x533742;};AGIVertices[_0x7995('0x12')][_0x7995('0xe')]=function(_0x21649a){logger['info'](util[_0x7995('0x2d')](_0x7995('0x117'),_0x21649a[_0x7995('0x3c')]));return this[_0x7995('0x10c')](_0x21649a);};AGIVertices[_0x7995('0x12')]['goal']=function(_0x4bbb1a){logger[_0x7995('0x33')](util['format'](_0x7995('0x118'),_0x4bbb1a['label']));this[_0x7995('0x3a')][_0x7995('0xa1')](this,_0x4bbb1a,_0x4bbb1a[_0x7995('0x119')]);return this['channel']['noop'](util['format'](_0x7995('0x11a'),_0x4bbb1a[_0x7995('0x119')]));};AGIVertices[_0x7995('0x12')]['awspolly']=function(_0x2a9738){logger[_0x7995('0x33')](util['format'](_0x7995('0x11b'),_0x2a9738[_0x7995('0x3c')]));if(!this[_0x7995('0xa6')](_0x2a9738[_0x7995('0x8a')])||!this[_0x7995('0xa6')](_0x2a9738['aws_secret_access_key'])){return this['channel'][_0x7995('0xa7')](_0x7995('0x11c'));}if(!this[_0x7995('0xa6')](_0x2a9738[_0x7995('0x5f')])){return this[_0x7995('0xf')][_0x7995('0xa7')](_0x7995('0xa8'));}this[_0x7995('0xf')][_0x7995('0xa7')](util[_0x7995('0x2d')]('Trying\x20aws\x20Polly\x20%s',_0x2a9738[_0x7995('0x5f')]));var _0x1faf9b=this[_0x7995('0x11d')][_0x7995('0xa1')](this,_0x2a9738);if(_0x1faf9b){this[_0x7995('0xf')][_0x7995('0xa7')](util[_0x7995('0x2d')]('aws\x20Polly\x20%s\x20file\x20created',_0x1faf9b));var _0x5d0fe6=this[_0x7995('0xf')][_0x7995('0x11e')](_0x1faf9b);try{fs[_0x7995('0x100')](_0x1faf9b+_0x7995('0x101'));}catch(_0x55ce63){logger['error'](_0x55ce63);}return _0x5d0fe6;}return this['channel'][_0x7995('0x31')](_0x2a9738,_0x7995('0x11f'));};AGIVertices['prototype'][_0x7995('0x120')]=function(_0x2265cf){logger[_0x7995('0x33')](util[_0x7995('0x2d')](_0x7995('0x121'),_0x2265cf[_0x7995('0x3c')]));if(!this[_0x7995('0xa6')](_0x2265cf[_0x7995('0x8a')])||!this['isConfigured'](_0x2265cf[_0x7995('0x86')])){return this[_0x7995('0xf')][_0x7995('0xa7')]('no\x20valid\x20credentials\x20configured');}if(!this[_0x7995('0xa6')](_0x2265cf['aws_bot_name'])){return this['channel']['noop']('no\x20bot\x20name\x20configured');}if(!this[_0x7995('0xa6')](_0x2265cf['text'])){return this[_0x7995('0xf')][_0x7995('0xa7')]('no\x20text\x20configured');}this[_0x7995('0xf')][_0x7995('0xe7')]=!![];this[_0x7995('0x3a')](_0x2265cf);this[_0x7995('0x44')](_0x2265cf['text'],'in','','');this[_0x7995('0xf')]['noop'](util[_0x7995('0x2d')](_0x7995('0x122'),_0x2265cf[_0x7995('0x5f')]));var _0x12abbb=this[_0x7995('0x89')][_0x7995('0xa1')](this,_0x2265cf);if(_0x12abbb){for(var _0x30d2af in _0x12abbb){if(_0x12abbb[_0x7995('0x93')](_0x30d2af)&&_[_0x7995('0x99')](_0x12abbb[_0x30d2af])){this[_0x7995('0xf')]['setVariable'](util[_0x7995('0x2d')](_0x7995('0x123'),_0x30d2af['toUpperCase']()),_0x12abbb[_0x30d2af]);}}if(_[_0x7995('0x47')](_0x12abbb[_0x7995('0x124')])){return this[_0x7995('0xf')][_0x7995('0xa7')](_0x7995('0x125'));}else{this[_0x7995('0x44')](_0x12abbb['message'],_0x7995('0x126'),'amazonlex','');return this[_0x7995('0xf')][_0x7995('0xa7')](util[_0x7995('0x2d')](_0x7995('0x127'),_0x12abbb[_0x7995('0x124')]));}}return this[_0x7995('0xf')]['error'](_0x2265cf,_0x7995('0x128'));};AGIVertices[_0x7995('0x12')][_0x7995('0x129')]=function(_0x4c2faf){logger[_0x7995('0x33')](util[_0x7995('0x2d')](_0x7995('0x12a'),_0x4c2faf[_0x7995('0x3c')],_0x4c2faf[_0x7995('0x66')]));if(!this[_0x7995('0xa6')](_0x4c2faf[_0x7995('0x7a')])){return this[_0x7995('0xf')][_0x7995('0xa7')](_0x7995('0xe6'));}var _0xaafd4='wav';var _0x125233=util[_0x7995('0x2d')]('%s/recordings/%s',FILES_PATH,rs[_0x7995('0x115')](0x4));var _0x3a1e88=util[_0x7995('0x2d')](_0x7995('0x9b'),_0x125233,_0xaafd4);var _0x258f87=!![];if(_0x4c2faf['beep']===_0x7995('0x12b')){_0x258f87=![];}var _0x22d9ce=this[_0x7995('0xf')][_0x7995('0x12c')](_0x125233,_0xaafd4,_0x4c2faf[_0x7995('0x12d')],_0x4c2faf[_0x7995('0x66')],undefined,_0x258f87);if(_0x22d9ce[_0x7995('0x9f')]!==-0x1){this[_0x7995('0xf')][_0x7995('0xa7')](util[_0x7995('0x2d')](_0x7995('0x12e'),_0x3a1e88));var _0x3d2c0d=this[_0x7995('0x8c')]['sync'](this,_0x4c2faf,_0x3a1e88);if(_0x3d2c0d){for(var _0x247b71 in _0x3d2c0d){if(_0x3d2c0d[_0x7995('0x93')](_0x247b71)){this[_0x7995('0xf')][_0x7995('0x9c')](util['format'](_0x7995('0x12f'),_0x247b71[_0x7995('0x6b')]()),_0x3d2c0d[_0x247b71]);}}return this[_0x7995('0xf')][_0x7995('0xa7')](util[_0x7995('0x2d')](_0x7995('0x130'),JSON[_0x7995('0x73')](_0x3d2c0d)));}}return _0x22d9ce;};AGIVertices['prototype'][_0x7995('0x131')]=function(_0x5511f7){logger[_0x7995('0x33')](util[_0x7995('0x2d')](_0x7995('0x132'),_0x5511f7['label']));if(!this['isConfigured'](_0x5511f7[_0x7995('0x8f')])){return this[_0x7995('0xf')][_0x7995('0xa7')]('no\x20appid\x20configured');}if(!this[_0x7995('0xa6')](_0x5511f7['appsecret'])){return this[_0x7995('0xf')][_0x7995('0xa7')](_0x7995('0x133'));}var _0x35ee8c=_0x7995('0x134');var _0x1917dd=util['format'](_0x7995('0x135'),FILES_PATH,rs[_0x7995('0x115')](0x4));var _0x51b607=util[_0x7995('0x2d')](_0x7995('0x9b'),_0x1917dd,_0x35ee8c);var _0x46fbd5=!![];if(_0x5511f7[_0x7995('0x136')]===_0x7995('0x12b')){_0x46fbd5=![];}var _0x1e279e=this[_0x7995('0xf')][_0x7995('0x12c')](_0x1917dd,_0x35ee8c,_0x5511f7[_0x7995('0x12d')],_0x5511f7[_0x7995('0x66')],undefined,_0x46fbd5);if(_0x1e279e[_0x7995('0x9f')]!==-0x1){this[_0x7995('0xf')][_0x7995('0xa7')](util[_0x7995('0x2d')](_0x7995('0x137'),_0x51b607));var _0x3d7e89=this[_0x7995('0x8e')]['sync'](this,_0x5511f7,_0x51b607);if(_0x3d7e89){for(var _0x49a3e6 in _0x3d7e89){if(_0x3d7e89[_0x7995('0x93')](_0x49a3e6)){this[_0x7995('0xf')]['setVariable'](util[_0x7995('0x2d')](_0x7995('0x138'),_0x49a3e6['toUpperCase']()),_0x3d7e89[_0x49a3e6]);}}return this['channel'][_0x7995('0xa7')](util[_0x7995('0x2d')](_0x7995('0x139'),JSON[_0x7995('0x73')](_0x3d7e89)));}}return _0x1e279e;};AGIVertices[_0x7995('0x12')][_0x7995('0x13a')]=function(_0x1b3920){logger[_0x7995('0x33')](util[_0x7995('0x2d')](_0x7995('0x13b'),_0x1b3920['label']));return this[_0x7995('0xf')][_0x7995('0x13c')](_0x1b3920[_0x7995('0x40')],_0x1b3920[_0x7995('0x13d')],_0x1b3920[_0x7995('0x41')]);};AGIVertices[_0x7995('0x12')][_0x7995('0x13e')]=function(_0x537930){logger[_0x7995('0x33')](util[_0x7995('0x2d')](_0x7995('0x13f'),_0x537930['label']));if(!this[_0x7995('0xa6')](_0x537930[_0x7995('0x140')])){return this[_0x7995('0xf')][_0x7995('0x31')](_0x537930,_0x7995('0x141'));}try{var _0x29fb9e=eval(_0x537930['condition'])?_0x7995('0x142'):'false';this[_0x7995('0xf')][_0x7995('0xa7')](util[_0x7995('0x2d')]('EVAL\x20CONDITION\x20%s\x20%s',_0x537930['condition'],_0x29fb9e));return{'code':0xc8,'result':_0x29fb9e};}catch(_0x41c2a0){return{'code':0xc8,'result':_0x7995('0x143')};}};AGIVertices[_0x7995('0x12')]['gotoiftime']=function(_0x449231){logger[_0x7995('0x33')](util[_0x7995('0x2d')](_0x7995('0x144'),_0x449231[_0x7995('0x3c')]));if(!this['isConfigured'](_0x449231[_0x7995('0x145')])){return this[_0x7995('0xf')][_0x7995('0x31')](_0x449231,_0x7995('0x146'));}var _0x132c1a=this[_0x7995('0x27')][_0x7995('0xa1')](this,_0x449231[_0x7995('0x145')]);if(!_0x132c1a){return this['channel']['error'](_0x449231,_0x7995('0x147'));}for(var _0x5673e3=0x0;_0x5673e3<_0x132c1a[_0x7995('0x98')];_0x5673e3+=0x1){var _0xe4da2d=this[_0x7995('0xf')]['getVariable'](util['format']('IFTIME(%s?true:false)',_0x132c1a[_0x5673e3]));if(_0xe4da2d[_0x7995('0x9f')]===-0x1){return _0xe4da2d;}logger[_0x7995('0x33')](util[_0x7995('0x2d')](_0x7995('0x148'),_0x132c1a[_0x5673e3],_0xe4da2d[_0x7995('0x9e')]));if(_0xe4da2d[_0x7995('0x9e')]===_0x7995('0x142')){logger[_0x7995('0x33')](util['format']('IFTIME\x20%s\x20%s',_0x132c1a[_0x5673e3],'true'));this[_0x7995('0xf')]['noop'](util['format']('IFTIME\x20%s\x20%s',_0x132c1a[_0x5673e3],_0x7995('0x142')));return{'code':0xc8,'result':_0x7995('0x142')};}else{logger[_0x7995('0x33')](util[_0x7995('0x2d')](_0x7995('0x148'),_0x132c1a[_0x5673e3],'false'));this[_0x7995('0xf')]['noop'](util[_0x7995('0x2d')](_0x7995('0x148'),_0x132c1a[_0x5673e3],_0x7995('0x143')));}}return{'code':0xc8,'result':_0x7995('0x143')};};AGIVertices[_0x7995('0x12')][_0x7995('0x149')]=function(_0x2371ef){logger[_0x7995('0x33')](util['format'](_0x7995('0x14a'),_0x2371ef[_0x7995('0x3c')]));return this['channel'][_0x7995('0x149')]();};AGIVertices[_0x7995('0x12')][_0x7995('0x14b')]=function(_0x2529da){logger[_0x7995('0x33')](util[_0x7995('0x2d')](_0x7995('0x14c'),_0x2529da[_0x7995('0x3c')]));if(!this[_0x7995('0xa6')](_0x2529da['key'])){return this['channel']['noop'](_0x7995('0xe6'));}var _0x47032d='wav';var _0x4e910f=util['format'](_0x7995('0x135'),FILES_PATH,rs[_0x7995('0x115')](0x4));var _0x47ec0a=util[_0x7995('0x2d')](_0x7995('0x9b'),_0x4e910f,_0x47032d);var _0xfc0e72=!![];if(_0x2529da[_0x7995('0x136')]==='NOBEEP'){_0xfc0e72=![];}var _0x3ef225=this['channel'][_0x7995('0x12c')](_0x4e910f,_0x47032d,_0x2529da['intKey'],_0x2529da[_0x7995('0x66')],undefined,_0xfc0e72);if(_0x3ef225[_0x7995('0x9f')]!==-0x1){this['channel'][_0x7995('0xa7')](util['format'](_0x7995('0x14d'),_0x47ec0a));var _0x20da12=this[_0x7995('0x82')][_0x7995('0xa1')](this,_0x2529da,_0x47ec0a);if(_0x20da12){for(var _0x32d594 in _0x20da12){if(_0x20da12[_0x7995('0x93')](_0x32d594)){this['channel']['setVariable'](util['format']('ISPEECH_ASR_%s',_0x32d594[_0x7995('0x6b')]()),_0x20da12[_0x32d594]);}}return this['channel'][_0x7995('0xa7')](util[_0x7995('0x2d')]('IspeechASR\x20Result\x20%s',JSON[_0x7995('0x73')](_0x20da12)));}}return _0x3ef225;};AGIVertices['prototype'][_0x7995('0x14e')]=function(_0x5a0510){logger[_0x7995('0x33')](util[_0x7995('0x2d')](_0x7995('0x14f'),_0x5a0510[_0x7995('0x3c')]));if(!this[_0x7995('0xa6')](_0x5a0510[_0x7995('0x7a')])){return this[_0x7995('0xf')][_0x7995('0xa7')](_0x7995('0xe6'));}if(!this[_0x7995('0xa6')](_0x5a0510[_0x7995('0x5f')])){return this[_0x7995('0xf')][_0x7995('0xa7')](_0x7995('0xa8'));}this[_0x7995('0xf')][_0x7995('0xa7')](util[_0x7995('0x2d')]('Trying\x20ispeech\x20TTS\x20%s',_0x5a0510[_0x7995('0x5f')]));var _0x3603f5=this[_0x7995('0x7f')]['sync'](this,_0x5a0510);if(_0x3603f5){this[_0x7995('0xf')]['noop'](util[_0x7995('0x2d')](_0x7995('0x14d'),_0x3603f5));var _0xa6d830=this[_0x7995('0xf')]['streamFile'](_0x3603f5,_0x5a0510[_0x7995('0x12d')]);try{fs[_0x7995('0x100')](_0x3603f5+'.wav');}catch(_0x579faf){logger['error'](_0x579faf);}return _0xa6d830;}return this[_0x7995('0xf')][_0x7995('0x31')](_0x5a0510,'ispeech\x20TTS\x20is\x20unreachable');};AGIVertices[_0x7995('0x12')]['login']=function(_0x3c5a7e){logger['info'](util[_0x7995('0x2d')](_0x7995('0x150'),_0x3c5a7e['label']));if(!this['isConfigured'](_0x3c5a7e[_0x7995('0x151')])){return this[_0x7995('0xf')][_0x7995('0x31')](_0x3c5a7e,'no\x20find\x20by\x20configured');}logger[_0x7995('0x33')](util[_0x7995('0x2d')](_0x7995('0x152'),this[_0x7995('0xf')][_0x7995('0x3e')],_0x3c5a7e[_0x7995('0x151')]));var _0x30a99f=this[_0x7995('0x153')][_0x7995('0xa1')](this,_0x3c5a7e['findBy']);if(_0x30a99f){logger[_0x7995('0x33')](util[_0x7995('0x2d')](_0x7995('0x154'),this['channel'][_0x7995('0x3e')],_0x3c5a7e[_0x7995('0x151')]));this['channel']['noop'](util[_0x7995('0x2d')](_0x7995('0x154'),this['channel'][_0x7995('0x3e')],_0x3c5a7e[_0x7995('0x151')]));return{'code':0xc8,'result':'success'};}else{logger[_0x7995('0x33')](util[_0x7995('0x2d')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x7995('0xf')][_0x7995('0x3e')],_0x3c5a7e[_0x7995('0x151')]));this[_0x7995('0xf')][_0x7995('0xa7')](util[_0x7995('0x2d')](_0x7995('0x155'),this[_0x7995('0xf')][_0x7995('0x3e')],_0x3c5a7e[_0x7995('0x151')]));return{'code':0xc8,'result':_0x7995('0x156')};}};AGIVertices['prototype'][_0x7995('0x157')]=function(_0x318bf0){logger[_0x7995('0x33')](util[_0x7995('0x2d')](_0x7995('0x158'),_0x318bf0[_0x7995('0x3c')]));if(!this[_0x7995('0xa6')](_0x318bf0[_0x7995('0x151')])){return this[_0x7995('0xf')][_0x7995('0x31')](_0x318bf0,_0x7995('0x159'));}logger['info'](util[_0x7995('0x2d')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this['channel'][_0x7995('0x3e')],_0x318bf0[_0x7995('0x151')]));var _0x256c33=this['agentLogout'][_0x7995('0xa1')](this,_0x318bf0['findBy']);if(_0x256c33){logger[_0x7995('0x33')](util[_0x7995('0x2d')](_0x7995('0x154'),this['channel'][_0x7995('0x3e')],_0x318bf0[_0x7995('0x151')]));this['channel']['noop'](util[_0x7995('0x2d')](_0x7995('0x154'),this[_0x7995('0xf')][_0x7995('0x3e')],_0x318bf0[_0x7995('0x151')]));return{'code':0xc8,'result':_0x7995('0x15a')};}else{logger[_0x7995('0x33')](util[_0x7995('0x2d')](_0x7995('0x155'),this['channel']['callerid'],_0x318bf0['findBy']));this[_0x7995('0xf')][_0x7995('0xa7')](util['format'](_0x7995('0x155'),this[_0x7995('0xf')][_0x7995('0x3e')],_0x318bf0[_0x7995('0x151')]));return{'code':0xc8,'result':_0x7995('0x156')};}};AGIVertices[_0x7995('0x12')][_0x7995('0x15b')]=function(_0x3d52af){logger[_0x7995('0x33')](util[_0x7995('0x2d')](_0x7995('0x15c'),_0x3d52af[_0x7995('0x3c')]));if(!this[_0x7995('0xa6')](_0x3d52af['operation'])){return this['channel'][_0x7995('0x31')](_0x3d52af,'no\x20operation\x20configured');}this['channel']['noop'](util[_0x7995('0x2d')](_0x7995('0x15d'),_0x3d52af['operation']));var _0x440306=eval(_0x3d52af[_0x7995('0x15e')]);if(!this[_0x7995('0xa6')](_0x3d52af['variable_id'])){return this[_0x7995('0xf')][_0x7995('0xa7')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x592c0d=this[_0x7995('0x13')][_0x7995('0xa1')](this,_0x3d52af['variable_id']);if(!_0x592c0d){return this[_0x7995('0xf')][_0x7995('0x31')](_0x3d52af,_0x7995('0xd9'));}if(_[_0x7995('0x97')](_0x440306)){var _0x5e5c7d=this;_0x440306[_0x7995('0xda')](function(_0x224d43,_0x47f884){_0x5e5c7d[_0x7995('0xf')][_0x7995('0x9c')](util['format'](_0x7995('0x15f'),_0x592c0d,_0x47f884),_0x224d43);});return this[_0x7995('0xf')][_0x7995('0xa7')](util[_0x7995('0x2d')](_0x7995('0x160'),_0x592c0d));}else{return this[_0x7995('0xf')]['setVariable'](_0x592c0d,_0x440306);}};AGIVertices[_0x7995('0x12')]['menu']=function(_0x14c1c0){logger[_0x7995('0x33')](util[_0x7995('0x2d')](_0x7995('0x161'),_0x14c1c0[_0x7995('0x3c')]));if(_0x14c1c0[_0x7995('0xa2')]===0x0){return this['maxRetry'](_0x14c1c0);}_0x14c1c0[_0x7995('0xa2')]-=0x1;if(!this[_0x7995('0xa6')](_0x14c1c0[_0x7995('0x10d')])){return this[_0x7995('0xf')]['error'](_0x14c1c0,_0x7995('0x10e'));}var _0x470b9b=this[_0x7995('0x22')][_0x7995('0xa1')](this,_0x14c1c0[_0x7995('0x10d')]);if(!_0x470b9b){return this[_0x7995('0xf')][_0x7995('0x31')](_0x14c1c0,_0x7995('0x162'));}var _0x40a3a0=this[_0x7995('0xf')]['getData'](_0x470b9b,_0x14c1c0[_0x7995('0x110')],_0x14c1c0[_0x7995('0x163')]);var _0x50b260=_0x40a3a0[_0x7995('0x9f')];if(_0x40a3a0[_0x7995('0x9f')]===-0x1){this[_0x7995('0x3a')][_0x7995('0xa1')](this,_0x14c1c0,'-1');return _0x40a3a0;}else if(_0x40a3a0[_0x7995('0x9e')]===_0x7995('0x66')){_0x40a3a0[_0x7995('0x9f')]=_0x40a3a0['result']['length']>0x0?_0x40a3a0[_0x7995('0x9f')]:'t';}else if(_[_0x7995('0x46')](_0x40a3a0[_0x7995('0x9f')])){_0x40a3a0[_0x7995('0x9f')]='#';_0x50b260='#';}if(!this[_0x7995('0xa6')](_0x14c1c0[_0x7995('0xd8')])){this[_0x7995('0xf')]['noop'](_0x7995('0xd7'));}else{var _0x444c63=this[_0x7995('0x13')][_0x7995('0xa1')](this,_0x14c1c0['variable_id']);if(!_0x444c63){return this[_0x7995('0xf')][_0x7995('0x31')](_0x14c1c0,'no\x20variable\x20found');}this[_0x7995('0xf')]['setVariable'](_0x444c63,_0x50b260);}this['createSquareDetailsReport']['sync'](this,_0x14c1c0,_0x50b260);return _0x40a3a0;};AGIVertices[_0x7995('0x12')][_0x7995('0xa7')]=function(_0x4285ea){logger[_0x7995('0x33')](util[_0x7995('0x2d')]('Enter\x20in\x20NOOP\x20(%s)\x20block',_0x4285ea[_0x7995('0x3c')]));return this['channel'][_0x7995('0xa7')](_0x4285ea[_0x7995('0x164')]||_0x4285ea[_0x7995('0x3c')]);};AGIVertices[_0x7995('0x12')][_0x7995('0x165')]=function(_0x3834cb){logger['info'](util['format'](_0x7995('0x166'),_0x3834cb[_0x7995('0x3c')]));if(!this[_0x7995('0xa6')](_0x3834cb[_0x7995('0x151')])){return this[_0x7995('0xf')][_0x7995('0x31')](_0x3834cb,_0x7995('0x159'));}logger[_0x7995('0x33')](util[_0x7995('0x2d')](_0x7995('0x152'),this['channel'][_0x7995('0x3e')],_0x3834cb[_0x7995('0x151')]));var _0x809714=this[_0x7995('0x50')][_0x7995('0xa1')](this,_0x3834cb['pause_id']);var _0x59dcb7=this[_0x7995('0x52')][_0x7995('0xa1')](this,_0x3834cb[_0x7995('0x151')],_0x809714);if(_0x59dcb7){logger[_0x7995('0x33')](util[_0x7995('0x2d')](_0x7995('0x154'),this['channel']['callerid'],_0x3834cb[_0x7995('0x151')]));this['channel'][_0x7995('0xa7')](util[_0x7995('0x2d')](_0x7995('0x154'),this['channel'][_0x7995('0x3e')],_0x3834cb[_0x7995('0x151')]));return{'code':0xc8,'result':_0x7995('0x15a')};}else{logger[_0x7995('0x33')](util['format']('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x7995('0xf')][_0x7995('0x3e')],_0x3834cb[_0x7995('0x151')]));this[_0x7995('0xf')][_0x7995('0xa7')](util[_0x7995('0x2d')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x7995('0xf')][_0x7995('0x3e')],_0x3834cb[_0x7995('0x151')]));return{'code':0xc8,'result':_0x7995('0x156')};}};AGIVertices[_0x7995('0x12')][_0x7995('0x167')]=function(_0x46f98d){logger[_0x7995('0x33')](util[_0x7995('0x2d')](_0x7995('0x168'),_0x46f98d['label']));if(!this[_0x7995('0xa6')](_0x46f98d[_0x7995('0x10d')])){return this['channel']['error'](_0x46f98d,_0x7995('0x10e'));}var _0x581f8d=this[_0x7995('0x22')][_0x7995('0xa1')](this,_0x46f98d[_0x7995('0x10d')]);if(!_0x581f8d){return this[_0x7995('0xf')][_0x7995('0x31')](_0x46f98d,_0x7995('0x162'));}var _0x36e464=this[_0x7995('0xf')]['exec']('PLAYBACK',[_0x581f8d,_0x46f98d['opts']]);if(_0x36e464[_0x7995('0x9f')]===-0x1){return _0x36e464;}return this[_0x7995('0xf')][_0x7995('0xa7')](util[_0x7995('0x2d')](_0x7995('0xc2'),'PLAYBACK',_0x581f8d));};AGIVertices[_0x7995('0x12')]['queue']=function(_0x35e820){logger[_0x7995('0x33')](util[_0x7995('0x2d')]('Enter\x20in\x20QUEUE\x20(%s)\x20block',_0x35e820['label']));if(!this['isConfigured'](_0x35e820['queue_id'])){return this[_0x7995('0xf')][_0x7995('0x31')](_0x35e820,_0x7995('0x169'));}var _0x5dfc42='';var _0x4a1669=parseInt(_0x35e820[_0x7995('0x16a')],0xa);if(isNaN(_0x4a1669)){_0x5dfc42=_0x35e820[_0x7995('0x16a')];}else{_0x5dfc42=this['getVoiceQueue'][_0x7995('0xa1')](this,_0x35e820[_0x7995('0x16a')]);if(!_0x5dfc42){return this[_0x7995('0xf')][_0x7995('0x31')](_0x35e820,_0x7995('0x16b'));}}var _0x189645='';if(this[_0x7995('0xa6')](_0x35e820[_0x7995('0x10d')])){var _0x33ce52=this['getSound']['sync'](this,_0x35e820[_0x7995('0x10d')]);if(_0x33ce52){_0x189645=_0x33ce52;}}this[_0x7995('0x3a')][_0x7995('0xa1')](this,_0x35e820,_0x5dfc42);if(_0x35e820[_0x7995('0xe2')][_0x7995('0x16c')]('x')<0x0){_0x35e820[_0x7995('0xe2')]+='x';}if(_0x35e820[_0x7995('0xe2')][_0x7995('0x16c')]('X')<0x0){_0x35e820[_0x7995('0xe2')]+='X';}this[_0x7995('0xf')][_0x7995('0x9c')]('XMCS-QUEUE',_0x5dfc42?_0x5dfc42['toLowerCase']():'');var _0x5dee7a=this[_0x7995('0xf')][_0x7995('0xa9')](_0x7995('0x16d'),[_0x5dfc42,_0x35e820[_0x7995('0xe2')],_0x35e820[_0x7995('0x64')],_0x189645,_0x35e820['timeout'],_0x35e820[_0x7995('0xb4')],_0x35e820[_0x7995('0x16e')],_0x35e820[_0x7995('0x16f')],'',_0x35e820[_0x7995('0x170')]]);if(_0x5dee7a[_0x7995('0x9f')]===-0x1){return _0x5dee7a;}return this[_0x7995('0xf')][_0x7995('0xa7')](util[_0x7995('0x2d')](_0x7995('0xc2'),_0x7995('0x16d'),_0x5dfc42));};AGIVertices['prototype']['record']=function(_0x57dff9){logger[_0x7995('0x33')](util[_0x7995('0x2d')](_0x7995('0x171'),_0x57dff9['label']));var _0x15b5da=_0x57dff9['recordingFormat']||_0x7995('0x134');var _0x6ff635=util[_0x7995('0x2d')](_0x7995('0x172'),this[_0x7995('0xf')]['uniqueid'],rs[_0x7995('0x115')](0x5));var _0x5d1459=util[_0x7995('0x2d')](_0x7995('0x173'),FILES_PATH,_0x6ff635,_0x15b5da);var _0x29ceb8=util['format'](_0x7995('0x135'),FILES_PATH,_0x6ff635);this[_0x7995('0x3f')][_0x7995('0xa1')](this,_0x57dff9,_0x6ff635,_0x5d1459);this[_0x7995('0xf')][_0x7995('0x9c')](_0x7995('0x174'),_0x6ff635);logger[_0x7995('0x33')](_0x7995('0x175'),_0x29ceb8,_0x15b5da,_0x57dff9['escape_digits'],_0x57dff9['timeout']);return this[_0x7995('0xf')][_0x7995('0x12c')](_0x29ceb8,_0x15b5da,_0x57dff9[_0x7995('0x176')],_0x57dff9[_0x7995('0x66')],undefined,!![]);};AGIVertices[_0x7995('0x12')][_0x7995('0x177')]=function(_0xeae7ec){logger[_0x7995('0x33')](util['format']('Enter\x20in\x20RESTAPI\x20(%s)\x20block',_0xeae7ec[_0x7995('0x3c')]));if(!this[_0x7995('0xa6')](_0xeae7ec[_0x7995('0x64')])){return this[_0x7995('0xf')][_0x7995('0xa7')](_0x7995('0x178'));}var _0x481ce1=this['restAPI'][_0x7995('0xa1')](this,_0xeae7ec);logger[_0x7995('0x33')](util[_0x7995('0x2d')](_0x7995('0x179'),util[_0x7995('0x17a')](_0x481ce1,{'showHidden':![],'depth':null})));if(!this[_0x7995('0xa6')](_0xeae7ec[_0x7995('0xd8')])){return this[_0x7995('0xf')][_0x7995('0xa7')](_0x7995('0x17b'));}var _0x527023=this[_0x7995('0x13')][_0x7995('0xa1')](this,_0xeae7ec['variable_id']);if(!_0x527023){return this[_0x7995('0xf')]['error'](_0xeae7ec,'no\x20variable\x20found');}this[_0x7995('0xf')][_0x7995('0x9c')](util[_0x7995('0x2d')](_0x7995('0x17c'),_0x527023),_0x481ce1[_0x7995('0x75')]?_0x481ce1['statusCode']:_0x7995('0x17d'));this[_0x7995('0xf')]['setVariable'](util[_0x7995('0x2d')]('%s_STATUS_MESSAGE',_0x527023),_0x481ce1['statusMessage']?_0x481ce1[_0x7995('0x76')]:'OK');if(_0x481ce1[_0x7995('0x6c')]){try{this[_0x7995('0x9a')](_0x481ce1[_0x7995('0x6c')],_0x527023);}catch(_0x2b3dad){logger[_0x7995('0x31')](util[_0x7995('0x2d')](_0x7995('0x17e'),_0x527023));}}return this[_0x7995('0xf')][_0x7995('0xa7')](util[_0x7995('0x2d')](_0x7995('0xdd'),_0x527023));};AGIVertices[_0x7995('0x12')][_0x7995('0x17f')]=function(_0x1aee3d){logger[_0x7995('0x33')](util[_0x7995('0x2d')](_0x7995('0x180'),_0x1aee3d[_0x7995('0x3c')]));return this[_0x7995('0xf')][_0x7995('0x181')](_0x1aee3d[_0x7995('0x182')][_0x7995('0x5b')](/\s+/g,''),_0x1aee3d[_0x7995('0x176')]);};AGIVertices['prototype'][_0x7995('0x183')]=function(_0x440afa){logger['info'](util[_0x7995('0x2d')](_0x7995('0x184'),_0x440afa['label']));return this[_0x7995('0xf')]['sayNumber'](_0x440afa['number'][_0x7995('0x5b')](/\s+/g,''),_0x440afa[_0x7995('0x176')]);};AGIVertices[_0x7995('0x12')]['sayphonetic']=function(_0x9ee5b7){logger['info'](util['format'](_0x7995('0x185'),_0x9ee5b7[_0x7995('0x3c')]));return this[_0x7995('0xf')][_0x7995('0x186')](_0x9ee5b7[_0x7995('0x5f')],_0x9ee5b7[_0x7995('0x176')]);};AGIVertices['prototype'][_0x7995('0x187')]=function(_0x3de4fc){logger[_0x7995('0x33')](util[_0x7995('0x2d')](_0x7995('0x188'),_0x3de4fc['label']));if(!this[_0x7995('0xa6')](_0x3de4fc[_0x7995('0x189')])){return this[_0x7995('0xf')][_0x7995('0xa7')](_0x7995('0x18a'));}var _0x3769e4=this[_0x7995('0x18b')][_0x7995('0xa1')](this,_0x3de4fc[_0x7995('0x189')]);if(!_0x3769e4||!_0x3769e4[_0x7995('0x18c')]){return this[_0x7995('0xf')][_0x7995('0x31')](_0x3de4fc,_0x7995('0x18d'));}var _0x2a4a1d={'from':util[_0x7995('0x2d')](_0x7995('0x18e'),_0x3769e4['name'],_0x3769e4[_0x7995('0x18f')]||_0x3769e4[_0x7995('0x18c')]['user']),'to':_0x3de4fc['to']||'','cc':_0x3de4fc['cc']||'','bcc':_0x3de4fc[_0x7995('0x190')]||'','subject':_0x3de4fc[_0x7995('0x191')],'html':_0x3de4fc[_0x7995('0x5f')],'text':_0x3de4fc[_0x7995('0x5f')]};if(this['isConfigured'](_0x3de4fc[_0x7995('0x192')])){}logger['debug']('sendMail\x20message',JSON[_0x7995('0x73')](_0x2a4a1d));this[_0x7995('0x3a')][_0x7995('0xa1')](this,_0x3de4fc,_0x3de4fc[_0x7995('0x189')]);this[_0x7995('0xf')][_0x7995('0xa7')](util['format']('Trying\x20SendMail\x20with\x20account\x20%s',_0x3769e4[_0x7995('0x15')]));this['sendMailMessage'][_0x7995('0xa1')](this,_0x3769e4['smtpOptions'],_0x2a4a1d);return this[_0x7995('0xf')][_0x7995('0xa7')](_0x7995('0x193'));};AGIVertices[_0x7995('0x12')][_0x7995('0x194')]=function(_0x4127d4){logger[_0x7995('0x33')](util[_0x7995('0x2d')](_0x7995('0x195'),_0x4127d4[_0x7995('0x3c')]));return this[_0x7995('0xf')][_0x7995('0xa7')](_0x7995('0x196'));};AGIVertices[_0x7995('0x12')][_0x7995('0x197')]=function(_0x5b9bc8){logger[_0x7995('0x33')](util[_0x7995('0x2d')]('Enter\x20in\x20SENDSMS\x20(%s)\x20block',_0x5b9bc8['label']));if(!this[_0x7995('0xa6')](_0x5b9bc8['sms_account_id'])){return this[_0x7995('0xf')][_0x7995('0xa7')]('no\x20sms\x20account\x20configured');}var _0x281a99=this['getSmsAccount'][_0x7995('0xa1')](this,_0x5b9bc8[_0x7995('0x198')]);if(!_0x281a99){return this[_0x7995('0xf')][_0x7995('0x31')](_0x5b9bc8,_0x7995('0x199'));}var _0x59a164={'body':_0x5b9bc8[_0x7995('0x19a')],'phone':_0x5b9bc8['to']||'','SmsAccountId':_0x281a99['id']};logger[_0x7995('0x19b')](_0x7995('0x19c'),JSON[_0x7995('0x73')](_0x59a164));this['createSquareDetailsReport'][_0x7995('0xa1')](this,_0x5b9bc8,_0x5b9bc8['sms_account_id']);this['channel'][_0x7995('0xa7')](util[_0x7995('0x2d')](_0x7995('0x19d'),_0x281a99[_0x7995('0x15')]));this[_0x7995('0x19e')][_0x7995('0xa1')](this,_0x59a164);return this[_0x7995('0xf')][_0x7995('0xa7')](_0x7995('0x19f'));};AGIVertices[_0x7995('0x12')][_0x7995('0x1a0')]=function(_0x1bc621){logger[_0x7995('0x33')](util[_0x7995('0x2d')](_0x7995('0x1a1'),_0x1bc621['label']));if(!this['isConfigured'](_0x1bc621['variable_id'])){return this[_0x7995('0xf')][_0x7995('0x31')](_0x1bc621,_0x7995('0x1a2'));}var _0x53330d=this[_0x7995('0x13')][_0x7995('0xa1')](this,_0x1bc621['variable_id']);if(!_0x53330d){return this['channel'][_0x7995('0x31')](_0x1bc621,_0x7995('0xd9'));}return this[_0x7995('0xf')]['setVariable'](_0x53330d,_0x1bc621['variable_value']);};AGIVertices[_0x7995('0x12')][_0x7995('0x1a3')]=function(_0x4a1d16){logger[_0x7995('0x33')](util[_0x7995('0x2d')](_0x7995('0x1a4'),_0x4a1d16[_0x7995('0x3c')]));this[_0x7995('0xf')][_0x7995('0xa7')]('START\x20CALLY\x20SQUARE');var _0x998404=this[_0x7995('0xf')][_0x7995('0x13')](_0x7995('0x1a5'));if(!_[_0x7995('0x46')](_0x998404['extra'])){this[_0x7995('0xf')][_0x7995('0x3b')]=_0x998404[_0x7995('0x9e')];}if(_0x4a1d16[_0x7995('0xb7')]===_0x7995('0x1a6')){this[_0x7995('0xf')][_0x7995('0xa7')]('Answer');return this[_0x7995('0xf')][_0x7995('0xb7')]();}return this[_0x7995('0xf')][_0x7995('0xa7')](_0x7995('0x1a7'));};AGIVertices[_0x7995('0x12')]['subproject']=function(_0x2a9e52){logger[_0x7995('0x33')](util[_0x7995('0x2d')]('Enter\x20in\x20SUBPROJECT\x20(%s)\x20block',_0x2a9e52[_0x7995('0x3c')]));if(!this[_0x7995('0xa6')](_0x2a9e52[_0x7995('0x1a8')])){return this[_0x7995('0xf')][_0x7995('0x31')](_0x2a9e52,'no\x20subproject\x20selected');}var _0x47a637=this[_0x7995('0x1a')][_0x7995('0xa1')](this,_0x2a9e52['project_id']);if(!this[_0x7995('0xa6')](_0x47a637)){return this[_0x7995('0xf')][_0x7995('0x31')](_0x2a9e52,util[_0x7995('0x2d')](_0x7995('0x1a9'),_0x2a9e52['project_id']));}if(_0x47a637===this['channel'][_0x7995('0x43')]){return this[_0x7995('0xf')][_0x7995('0x31')](_0x2a9e52,_0x7995('0x1aa'));}this['createSquareDetailsReport'][_0x7995('0xa1')](this,_0x2a9e52,_0x47a637);var _0x35c160=this[_0x7995('0xf')]['exec'](_0x7995('0x1ab'),util[_0x7995('0x2d')]('agi://%s/square,\x22%s\x22,\x22%s\x22',config['agi'][_0x7995('0x1ac')]||_0x7995('0x1ad'),_0x47a637,this[_0x7995('0xf')][_0x7995('0x43')]));if(_0x35c160[_0x7995('0x9f')]===-0x1){return _0x35c160;}return this['channel'][_0x7995('0xa7')](util[_0x7995('0x2d')]('Executed\x20command\x20%s\x20%s',_0x7995('0x1ab'),_0x47a637));};AGIVertices[_0x7995('0x12')][_0x7995('0x1ae')]=function(_0x3c40f7){logger[_0x7995('0x33')](util['format'](_0x7995('0x1af'),_0x3c40f7[_0x7995('0x3c')]));var _0x1103bd=this[_0x7995('0x59')]['sync'](this,_0x3c40f7[_0x7995('0x1b0')]);this[_0x7995('0x3a')][_0x7995('0xa1')](this,_0x3c40f7,_0x3c40f7[_0x7995('0x1b0')]);if(this[_0x7995('0xa6')](_0x3c40f7[_0x7995('0xd8')])){var _0x357e43=this['getVariable'][_0x7995('0xa1')](this,_0x3c40f7['variable_id']);if(_0x357e43){this['channel'][_0x7995('0x9c')](_0x357e43,_0x1103bd);return this[_0x7995('0xf')][_0x7995('0xa7')](util[_0x7995('0x2d')](_0x7995('0x1b1'),_0x3c40f7[_0x7995('0x1b0')],_0x357e43));}}return this['channel']['noop'](util[_0x7995('0x2d')](_0x7995('0x1b2'),_0x3c40f7[_0x7995('0x1b0')]));};AGIVertices[_0x7995('0x12')][_0x7995('0x1b3')]=function(_0x42f70e){logger[_0x7995('0x33')](util[_0x7995('0x2d')](_0x7995('0x1b4'),_0x42f70e[_0x7995('0x3c')]));_0x42f70e[_0x7995('0x5f')]=_0x42f70e['text'][_0x7995('0x5b')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x7995('0xa6')](_0x42f70e[_0x7995('0x5d')])){return this['channel'][_0x7995('0xa7')]('no\x20apiKey\x20configured');}if(!this['isConfigured'](_0x42f70e[_0x7995('0x5f')])){return this[_0x7995('0xf')][_0x7995('0xa7')]('no\x20text\x20configured');}this['channel'][_0x7995('0xa7')](util[_0x7995('0x2d')]('Trying\x20Google\x20Cloud\x20TTS\x20%s',_0x42f70e['text']));var _0x1a3d21=this[_0x7995('0x5c')][_0x7995('0xa1')](this,_0x42f70e);if(_0x1a3d21){this[_0x7995('0xf')][_0x7995('0xa7')](util[_0x7995('0x2d')](_0x7995('0x1b5'),_0x1a3d21));var _0x277e1f=this[_0x7995('0xf')][_0x7995('0x11e')](_0x1a3d21);try{fs[_0x7995('0x100')](_0x1a3d21+_0x7995('0x101'));}catch(_0x43d909){logger[_0x7995('0x31')](_0x43d909);}return _0x277e1f;}return this[_0x7995('0xf')][_0x7995('0x31')](_0x42f70e,_0x7995('0x1b6'));};AGIVertices['prototype'][_0x7995('0x1b7')]=function(_0x117740){logger[_0x7995('0x33')](util[_0x7995('0x2d')](_0x7995('0x1b8'),_0x117740[_0x7995('0x3c')]));_0x117740[_0x7995('0x5f')]=_0x117740[_0x7995('0x5f')][_0x7995('0x5b')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x7995('0xa6')](_0x117740[_0x7995('0x5f')])){return this['channel']['noop'](_0x7995('0xa8'));}this['channel'][_0x7995('0xa7')](util['format']('Trying\x20Google\x20TTS\x20%s',_0x117740[_0x7995('0x5f')]));var _0x55c6ec=this[_0x7995('0x1b9')][_0x7995('0xa1')](this,_0x117740);if(_0x55c6ec){this[_0x7995('0xf')][_0x7995('0xa7')](util[_0x7995('0x2d')](_0x7995('0x1ba'),_0x55c6ec));var _0x4801db=this['channel']['streamFile'](_0x55c6ec);try{fs[_0x7995('0x100')](_0x55c6ec+_0x7995('0x101'));}catch(_0x24ad6d){logger['error'](_0x24ad6d);}return _0x4801db;}return this[_0x7995('0xf')][_0x7995('0x31')](_0x117740,'Google\x20TTS\x20is\x20unreachable');};AGIVertices[_0x7995('0x12')][_0x7995('0x1bb')]=function(_0x29c90f){logger[_0x7995('0x33')](util['format']('Enter\x20in\x20UNPAUSE\x20(%s)\x20block',_0x29c90f[_0x7995('0x3c')]));if(!this['isConfigured'](_0x29c90f['findBy'])){return this[_0x7995('0xf')][_0x7995('0x31')](_0x29c90f,_0x7995('0x159'));}logger[_0x7995('0x33')](util[_0x7995('0x2d')](_0x7995('0x152'),this[_0x7995('0xf')]['callerid'],_0x29c90f[_0x7995('0x151')]));var _0x239d26=this[_0x7995('0x53')][_0x7995('0xa1')](this,_0x29c90f['findBy']);if(_0x239d26){logger[_0x7995('0x33')](util[_0x7995('0x2d')](_0x7995('0x154'),this[_0x7995('0xf')][_0x7995('0x3e')],_0x29c90f['findBy']));this[_0x7995('0xf')][_0x7995('0xa7')](util['format'](_0x7995('0x154'),this[_0x7995('0xf')][_0x7995('0x3e')],_0x29c90f[_0x7995('0x151')]));return{'code':0xc8,'result':_0x7995('0x15a')};}else{logger[_0x7995('0x33')](util[_0x7995('0x2d')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x7995('0xf')][_0x7995('0x3e')],_0x29c90f[_0x7995('0x151')]));this[_0x7995('0xf')][_0x7995('0xa7')](util[_0x7995('0x2d')](_0x7995('0x155'),this[_0x7995('0xf')][_0x7995('0x3e')],_0x29c90f['findBy']));return{'code':0xc8,'result':_0x7995('0x156')};}};AGIVertices[_0x7995('0x12')][_0x7995('0x1bc')]=function(_0xd36d08){logger[_0x7995('0x33')](util['format'](_0x7995('0x1bd'),_0xd36d08[_0x7995('0x3c')]));var _0xf4f561=this['channel']['exec'](_0x7995('0x1be'),[_0xd36d08[_0x7995('0x1bf')],_0xd36d08[_0x7995('0x78')]]);if(_0xf4f561[_0x7995('0x9f')]===-0x1){return _0xf4f561;}return this[_0x7995('0xf')][_0x7995('0xa7')](util['format'](_0x7995('0xc2'),'VOICEMAIL',_0xd36d08[_0x7995('0x1bf')]));};AGIVertices[_0x7995('0x12')][_0x7995('0x1c0')]=function(_0x4cda76){logger[_0x7995('0x33')](util[_0x7995('0x2d')](_0x7995('0x1c1'),_0x4cda76[_0x7995('0x3c')]));if(!this['isConfigured'](_0x4cda76[_0x7995('0xd8')])){return this[_0x7995('0xf')][_0x7995('0x31')](_0x4cda76,_0x7995('0x1a2'));}var _0x2b143f=this['getVariable'][_0x7995('0xa1')](this,_0x4cda76[_0x7995('0xd8')]);if(!_0x2b143f){return this[_0x7995('0xf')][_0x7995('0x31')](_0x4cda76,'no\x20variable\x20found');}var _0x2f3ebf=this[_0x7995('0xf')][_0x7995('0x13')](_0x2b143f);return{'code':0xc8,'result':_0x2f3ebf[_0x7995('0x9e')]?_0x2f3ebf[_0x7995('0x9e')]:'-'};};String[_0x7995('0x12')][_0x7995('0x1c2')]=function(_0x1cea51,_0x949896){return this['split'](_0x1cea51)[_0x7995('0x1c3')](_0x949896);};module[_0x7995('0x1c4')]=AGIVertices; \ No newline at end of file +var _0x7bae=['replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','isPlainObject','isArray','saveRestApiResult','%s.%s','length','setVariable','split','extra','getAndSetVariable','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','maxRetry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','label','isConfigured','noop','no\x20text\x20configured','exec','MRCPSynth','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','MRCP_RECOG_INSTANCE','Enter\x20in\x20AGI\x20(%s)\x20block','command','args','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','callback','Enter\x20in\x20CALLBACK\x20(%s)\x20block','no\x20list\x20selected','scheduledAt','delay','minutes','createCmContact','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','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','lumenvoxasr','no\x20grammar\x20configured','MRCPRecog','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','RECOG_INSTANCE()','Executed\x20command\x20MRCPRecog\x20%s','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','no\x20database\x20selected','no\x20query\x20configured','query:\x20%s','getQueryOdbc','no\x20variable\x20selected\x20for\x20the\x20result','variable_id','keys','forEach','%s[%s][%s]','%s_ROWS_COUNT','debug','sip_id','no\x20user\x20selected','getUser','no\x20user\x20found','opts','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','bot','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','speech','out','Dialogflow\x20is\x20unreachable','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20project_id\x20configured','client_email','no\x20client_email\x20configured','dialogflowV2_language','Trying\x20DialogflowV2:\x20%s','googleDialogflowV2','providerResponse','dialogflowV2','DialogflowV2\x20Result\x20%s','DialogflowV2\x20is\x20unreachable','ndauth_url','no\x20ndauth\x20url\x20configured','username','no\x20password\x20configured','ndassistant_url','Trying\x20SestekNDA:\x20%s','sestekNDA','SESTEK_NDA_%s','audiofile','streamFile','unlink','.wav','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','end','Enter\x20in\x20END\x20(%s)\x20block','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20selected','trunk_name','DIAL','SIP/%s/%s','Executed\x20command\x20%s','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','retry','file_id','no\x20file\x20audio\x20selected','getData','test','mindigit','no\x20variable\x20found','hiddendigitsnum','generate','hiddendigitspos','first','substr','goal','goalname','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','Trying\x20aws\x20Polly\x20%s','awsPolly','aws\x20Polly\x20%s\x20file\x20created','aws\x20Polly\x20is\x20unreachable','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','amazonlex','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','no\x20key\x20configured','wav','%s/recordings/%s','beep','NOBEEP','recordFile','intKey','google\x20%s\x20file\x20created','GoogleASR\x20Result\x20%s','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','gotoc','continueAt','priority','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','no\x20condition\x20configured','false','EVAL\x20CONDITION\x20%s\x20%s','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20interval\x20configured','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','true','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ispeech\x20%s\x20file\x20created','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20TTS\x20is\x20unreachable','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','FIND\x20AGENT\x20%s\x20BY\x20%s','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','logout','no\x20find\x20by\x20configured','failure','math','Enter\x20in\x20MATH\x20(%s)\x20block','operation','%s[%s]','variable\x20%s[key]\x20set','Enter\x20in\x20MENU\x20(%s)\x20block','no\x20file\x20audio\x20found','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','output','Enter\x20in\x20PAUSE\x20(%s)\x20block','pause_id','playback','PLAYBACK','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20found','indexOf','XMCS-QUEUE','toLowerCase','QUEUE','macro','gosub','position','record','Enter\x20in\x20RECORD\x20(%s)\x20block','%s_%s','%s/recordings/%s.%s','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','inspect','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','200','%s_STATUS_MESSAGE','statusMessage','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','variable\x20%s\x20set','saydigits','sayDigits','digits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','number','sayphonetic','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','no\x20mail\x20account\x20configured','Smtp','\x22%s\x22\x20<%s>','user','bcc','subject','sendMail\x20message','account_id','sendMailMessage','smtpOptions','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','SENDFAX\x20block\x20not\x20implemented','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20configured','no\x20sms\x20account\x20found','sms_text','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','variable_value','start','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','XMCS-UNIQUEID','Answer','Skipped\x20Answer','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','getSquareProject','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','host','127.0.0.1','AGI','Enter\x20in\x20SYSTEM\x20(%s)\x20block','shellCommand','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','sh\x20command:\x20%s\x20result\x20no\x20stored','google_cloud_tts','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Google\x20Cloud\x20TTS\x20is\x20unreachable','Google\x20TTS\x20%s\x20file\x20created','Google\x20TTS\x20is\x20unreachable','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','VOICEMAIL','vswitch','replaceAll','exports','shelljs','odbc','moment','request-promise','../../config/logger','agi','../../config/environment','./scripts','/var/opt/motion2/server/files','rawHeaders','rawBody','menu','getdigits','getsecretdigits','rpc','mailRpc','prototype','getVariable','getVariableById','then','name','getVoiceQueue','catch','getSquareOdbc','getSquareOdbcById','dsn','getUserById','getTrunkById','getSound','getSoundPath','save_name','getMailAccount','getMailAccountById','getIntervals','getIntervalById','IntervalId','interval','map','%s/sounds/converted/%s','error','Error\x20getting\x20ODBC\x20connection\x20%s','info','ODBC\x20connection\x20successfully','query','Error\x20executing\x20query\x20%s','close','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','uniqueid','agicommand','channel','arg_1','callerid','createSquareRecording','calleridname','context','extension','accountcode','dnid','file','createSquareMessage','isEmpty','isNil','callback_','random','lastName','phone','list_id','Callback\x20scheduled\x20at\x20','toString','callback_priority','getPause','getPauseById','agentPause','agent','agentUnpause','agentLogout','internal','format','%s/%s@from-sip/n','agentLogin','trim','replace','googleCloudTTS','apiKey','google_cloud_tts_text_type','text','en-US','ssmlGender','MALE','audioEncoding','MP3','googleTTS','restAPI','url','method','timeout','includes','POST','PUT','toUpperCase','body','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','sync','uri','render','stringify','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','dialogflow_language','dialogflowV2_project_id','private_key','ispeechTTS','ispeech_tts_language','speed','ispeechASR','ispeech_asr_language','aws_access_key_id','aws_secret_access_key','aws_polly_region','aws_polly_voice','Amy','aws_text_type','awsLex','aws_lex_region','aws_bot_name','googleASR','tildeASR','appid','appsecret','clone','hasOwnProperty','isString'];(function(_0x320f5f,_0x495b37){var _0x82ef8f=function(_0x41aa4e){while(--_0x41aa4e){_0x320f5f['push'](_0x320f5f['shift']());}};_0x82ef8f(++_0x495b37);}(_0x7bae,0x13b));var _0xe7ba=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x7bae[_0x3b380d];return _0x54502b;};'use strict';var fs=require('fs');var util=require('util');var _=require('lodash');var sh=require(_0xe7ba('0x0'));var odbc=require(_0xe7ba('0x1'))();var rs=require('randomstring');var moment=require(_0xe7ba('0x2'));var Mustache=require('mustache');var rp=require(_0xe7ba('0x3'));var logger=require(_0xe7ba('0x4'))(_0xe7ba('0x5'));var config=require(_0xe7ba('0x6'));var scripts=require(_0xe7ba('0x7'));var FILES_PATH=_0xe7ba('0x8');var recursiveMapAttributes=[_0xe7ba('0x9'),_0xe7ba('0xa')];var verticesWithRetry=[_0xe7ba('0xb'),_0xe7ba('0xc'),_0xe7ba('0xd')];var AGIVertices=function(_0x27b1d5,_0x41c39d,_0x1b2693){this['channel']=_0x27b1d5;this[_0xe7ba('0xe')]=_0x41c39d;this[_0xe7ba('0xf')]=_0x1b2693;};AGIVertices[_0xe7ba('0x10')][_0xe7ba('0x11')]=function(_0x15083a,_0x1672f0){this[_0xe7ba('0xe')][_0xe7ba('0x12')](_0x15083a)[_0xe7ba('0x13')](function(_0x4b6597){_0x1672f0(null,_0x4b6597?_0x4b6597[_0xe7ba('0x14')]:![]);})['catch'](function(_0x602b1){_0x1672f0(_0x602b1);});};AGIVertices[_0xe7ba('0x10')][_0xe7ba('0x15')]=function(_0x17e4e6,_0x15d018){this[_0xe7ba('0xe')]['getVoiceQueueById'](_0x17e4e6)['then'](function(_0x2a5183){_0x15d018(null,_0x2a5183?_0x2a5183[_0xe7ba('0x14')]:![]);})[_0xe7ba('0x16')](function(_0x5d1d03){_0x15d018(_0x5d1d03);});};AGIVertices[_0xe7ba('0x10')]['getSquareProject']=function(_0x590bab,_0x5e9176){this[_0xe7ba('0xe')]['getSquareProjectById'](_0x590bab)[_0xe7ba('0x13')](function(_0x4888d9){_0x5e9176(null,_0x4888d9?_0x4888d9['name']:![]);})['catch'](function(_0x3f326a){_0x5e9176(_0x3f326a);});};AGIVertices[_0xe7ba('0x10')][_0xe7ba('0x17')]=function(_0x3c06c3,_0x1c8b5b){this['rpc'][_0xe7ba('0x18')](_0x3c06c3)[_0xe7ba('0x13')](function(_0x3b40fb){_0x1c8b5b(null,_0x3b40fb?_0x3b40fb[_0xe7ba('0x19')]:![]);})['catch'](function(_0x1076c5){_0x1c8b5b(_0x1076c5);});};AGIVertices[_0xe7ba('0x10')]['getUser']=function(_0x191863,_0x4514e8){this[_0xe7ba('0xe')][_0xe7ba('0x1a')](_0x191863)[_0xe7ba('0x13')](function(_0x2acfc2){_0x4514e8(null,_0x2acfc2?_0x2acfc2[_0xe7ba('0x14')]:![]);})[_0xe7ba('0x16')](function(_0x41cbd9){_0x4514e8(_0x41cbd9);});};AGIVertices[_0xe7ba('0x10')]['getTrunk']=function(_0x48b481,_0x4dcc7b){this['rpc'][_0xe7ba('0x1b')](_0x48b481)['then'](function(_0x4ecc0d){_0x4dcc7b(null,_0x4ecc0d?_0x4ecc0d['name']:![]);})[_0xe7ba('0x16')](function(_0x32cc00){_0x4dcc7b(_0x32cc00);});};AGIVertices[_0xe7ba('0x10')][_0xe7ba('0x1c')]=function(_0x3435c6,_0xc88099){var _0x4ed792=this;this[_0xe7ba('0xe')]['getSoundById'](_0x3435c6)[_0xe7ba('0x13')](function(_0x48c869){_0xc88099(null,_0x48c869?_0x4ed792[_0xe7ba('0x1d')](_0x48c869[_0xe7ba('0x1e')]):![]);})[_0xe7ba('0x16')](function(_0x4bf5f9){_0xc88099(_0x4bf5f9);});};AGIVertices['prototype'][_0xe7ba('0x1f')]=function(_0x276885,_0x8d5020){this[_0xe7ba('0xe')][_0xe7ba('0x20')](_0x276885)['then'](function(_0x37911d){_0x8d5020(null,_0x37911d?_0x37911d:![]);})[_0xe7ba('0x16')](function(_0x5b5ff3){_0x8d5020(_0x5b5ff3);});};AGIVertices[_0xe7ba('0x10')]['sendMailMessage']=function(_0x534218,_0x333845,_0x134f21){this[_0xe7ba('0xf')]['sendMailMessage'](_0x534218,_0x333845)[_0xe7ba('0x13')](function(){_0x134f21(null);})['catch'](function(_0x45ae82){_0x134f21(_0x45ae82);});};AGIVertices[_0xe7ba('0x10')][_0xe7ba('0x21')]=function(_0x27a8d4,_0xdfc3be){this['rpc'][_0xe7ba('0x22')](_0x27a8d4)[_0xe7ba('0x13')](function(_0x4baf97){if(_0x4baf97){if(_0x4baf97[_0xe7ba('0x23')]){_0xdfc3be(null,[_0x4baf97[_0xe7ba('0x24')]]);}else{_0xdfc3be(null,_[_0xe7ba('0x25')](_0x4baf97['Intervals'],_0xe7ba('0x24')));}}else{_0xdfc3be(null,![]);}})[_0xe7ba('0x16')](function(_0x5db8ab){_0xdfc3be(_0x5db8ab);});};AGIVertices[_0xe7ba('0x10')][_0xe7ba('0x1d')]=function(_0x41c7eb){return util['format'](_0xe7ba('0x26'),FILES_PATH,_0x41c7eb);};AGIVertices[_0xe7ba('0x10')]['getQueryOdbc']=function(_0x330e98,_0x3182d9,_0x8a5776){odbc['open'](_0x330e98,function(_0x4d7741){if(_0x4d7741){logger[_0xe7ba('0x27')](_0xe7ba('0x28'),_0x4d7741);_0x8a5776(_0x4d7741);}else{logger[_0xe7ba('0x29')](_0xe7ba('0x2a'));odbc[_0xe7ba('0x2b')](_0x3182d9,function(_0x5f3edd,_0x2c63d1){if(_0x5f3edd){logger[_0xe7ba('0x29')](_0xe7ba('0x2c'),_0x3182d9);_0x8a5776(_0x5f3edd);}else{logger[_0xe7ba('0x29')]('Query\x20executed\x20correctly\x20%s',_0x3182d9);odbc[_0xe7ba('0x2d')](function(_0x1b7f18){if(_0x1b7f18){logger[_0xe7ba('0x27')](_0xe7ba('0x2e'),_0x1b7f18);}_0x8a5776(null,_0x2c63d1);});}});}});};AGIVertices[_0xe7ba('0x10')][_0xe7ba('0x2f')]=function(_0x124cc4,_0x4e22f3){this[_0xe7ba('0xe')][_0xe7ba('0x30')](_0x124cc4)[_0xe7ba('0x13')](function(_0x401b0a){_0x4e22f3(null,_0x401b0a?_0x401b0a:![]);})[_0xe7ba('0x16')](function(_0x3b3abe){_0x4e22f3(_0x3b3abe);});};AGIVertices[_0xe7ba('0x10')][_0xe7ba('0x31')]=function(_0x39d903,_0x50792c){this[_0xe7ba('0xe')][_0xe7ba('0x31')](_0x39d903)['then'](function(_0x5dae52){_0x50792c(null,_0x5dae52);})[_0xe7ba('0x16')](function(_0xf4bf4a){_0x50792c(_0xf4bf4a);});};AGIVertices[_0xe7ba('0x10')]['createSquareDetailsReport']=function(_0x249e1d,_0x82246e,_0x3569b6){this[_0xe7ba('0xe')][_0xe7ba('0x32')]({'uniqueid':this['channel'][_0xe7ba('0x33')],'node':_0x249e1d['label'],'application':_0x249e1d[_0xe7ba('0x34')],'data':_0x82246e||null,'project_name':this[_0xe7ba('0x35')][_0xe7ba('0x36')],'callerid':this[_0xe7ba('0x35')][_0xe7ba('0x37')]})[_0xe7ba('0x13')](function(_0x312c70){if(_0x3569b6){_0x3569b6(null,_0x312c70);}})[_0xe7ba('0x16')](function(_0x51e6f1){if(_0x3569b6){_0x3569b6(_0x51e6f1);}});};AGIVertices[_0xe7ba('0x10')][_0xe7ba('0x38')]=function(_0x34394b,_0x37dcaa,_0x3620bc,_0x1d8cd8){this[_0xe7ba('0xe')][_0xe7ba('0x38')]({'uniqueid':this[_0xe7ba('0x35')][_0xe7ba('0x33')],'callerid':this['channel'][_0xe7ba('0x37')],'calleridname':this['channel'][_0xe7ba('0x39')],'context':this[_0xe7ba('0x35')][_0xe7ba('0x3a')],'extension':this[_0xe7ba('0x35')][_0xe7ba('0x3b')],'priority':this[_0xe7ba('0x35')]['priority'],'accountcode':this[_0xe7ba('0x35')][_0xe7ba('0x3c')],'dnid':this[_0xe7ba('0x35')][_0xe7ba('0x3d')],'projectName':this[_0xe7ba('0x35')][_0xe7ba('0x36')],'saveName':_0x37dcaa,'filename':_0x34394b[_0xe7ba('0x3e')]||_0x37dcaa,'savePath':_0x3620bc})[_0xe7ba('0x13')](function(_0x272cb9){_0x1d8cd8(null,_0x272cb9);})[_0xe7ba('0x16')](function(_0xbe2a32){_0x1d8cd8(_0xbe2a32);});};AGIVertices['prototype'][_0xe7ba('0x3f')]=function(_0x1270bd,_0x198d8d,_0x24c7d9,_0x3ae802,_0x1fd246){this['rpc'][_0xe7ba('0x3f')]({'uniqueid':this[_0xe7ba('0x35')]['uniqueid'],'body':_0x1270bd,'direction':_0x198d8d,'providerName':_0x24c7d9,'providerResponse':_0x3ae802})[_0xe7ba('0x13')](function(_0x704dae){if(_0x1fd246){_0x1fd246(null,_0x704dae);}})[_0xe7ba('0x16')](function(_0x1b9a05){if(_0x1fd246){_0x1fd246(_0x1b9a05);}});};AGIVertices['prototype']['createCmContact']=function(_0xa80cf,_0x2cfdc3){this[_0xe7ba('0xe')]['createCmContact']({'firstName':_[_0xe7ba('0x40')](_0xa80cf[_0xe7ba('0x14')])||_[_0xe7ba('0x41')](_0xa80cf[_0xe7ba('0x14')])?_0xe7ba('0x42')+Math[_0xe7ba('0x43')]():_0xa80cf[_0xe7ba('0x14')],'lastName':_['isEmpty'](_0xa80cf[_0xe7ba('0x44')])||_[_0xe7ba('0x41')](_0xa80cf[_0xe7ba('0x44')])?null:_0xa80cf['lastName'],'phone':_0xa80cf[_0xe7ba('0x45')],'ListId':_0xa80cf[_0xe7ba('0x46')],'scheduledat':_0xa80cf['scheduledAt'],'callbackUniqueid':this[_0xe7ba('0x35')][_0xe7ba('0x33')],'tags':'callback','description':_0xe7ba('0x47')+_0xa80cf['scheduledAt'][_0xe7ba('0x48')](),'priority':_0xa80cf[_0xe7ba('0x49')]})[_0xe7ba('0x13')](function(_0x573691){_0x2cfdc3(null,_0x573691);})[_0xe7ba('0x16')](function(_0x1128be){_0x2cfdc3(_0x1128be);});};AGIVertices[_0xe7ba('0x10')][_0xe7ba('0x4a')]=function(_0x4c3e05,_0x5df275){this[_0xe7ba('0xe')][_0xe7ba('0x4b')](_0x4c3e05)[_0xe7ba('0x13')](function(_0x19159c){_0x5df275(null,_0x19159c?_0x19159c[_0xe7ba('0x14')]:![]);})['catch'](function(_0x2cbdb1){_0x5df275(_0x2cbdb1);});};AGIVertices[_0xe7ba('0x10')][_0xe7ba('0x4c')]=function(_0x41dbf2,_0x57b23e,_0x3e31c1){var _0x28e3cf={'role':_0xe7ba('0x4d')};_0x28e3cf[_0x41dbf2]=this[_0xe7ba('0x35')][_0xe7ba('0x37')];this[_0xe7ba('0xe')]['agentPause'](_0x28e3cf,_0x57b23e,this[_0xe7ba('0x35')][_0xe7ba('0x33')])[_0xe7ba('0x13')](function(_0x5d65a8){_0x3e31c1(null,_[_0xe7ba('0x41')](_0x5d65a8)?![]:!![]);})[_0xe7ba('0x16')](function(_0x40b2b8){logger[_0xe7ba('0x27')](_0x40b2b8);_0x3e31c1(null,![]);});};AGIVertices[_0xe7ba('0x10')][_0xe7ba('0x4e')]=function(_0x3a7bfb,_0x3351d5){var _0x38a518={'role':_0xe7ba('0x4d')};_0x38a518[_0x3a7bfb]=this[_0xe7ba('0x35')][_0xe7ba('0x37')];this['rpc'][_0xe7ba('0x4e')](_0x38a518)[_0xe7ba('0x13')](function(_0x357af4){_0x3351d5(null,_['isNil'](_0x357af4)?![]:!![]);})[_0xe7ba('0x16')](function(_0x49e66a){logger[_0xe7ba('0x27')](_0x49e66a);_0x3351d5(null,![]);});};AGIVertices[_0xe7ba('0x10')][_0xe7ba('0x4f')]=function(_0x510d74,_0x5ca033){var _0x46d06e={'role':_0xe7ba('0x4d')};_0x46d06e[_0x510d74]=this[_0xe7ba('0x35')]['callerid'];this[_0xe7ba('0xe')][_0xe7ba('0x4f')](_0x46d06e)[_0xe7ba('0x13')](function(_0x27c7ab){_0x5ca033(null,_[_0xe7ba('0x41')](_0x27c7ab)?![]:!![]);})['catch'](function(_0x248837){logger[_0xe7ba('0x27')](_0x248837);_0x5ca033(null,![]);});};AGIVertices[_0xe7ba('0x10')]['agentLogin']=function(_0x13d2f9,_0x1a70ac){var _0x2d6ffc={'role':_0xe7ba('0x4d')};_0x2d6ffc[_0x13d2f9]=this[_0xe7ba('0x35')][_0xe7ba('0x37')];var _0x6c8738=_0x13d2f9!=_0xe7ba('0x50')?util[_0xe7ba('0x51')](_0xe7ba('0x52'),'LOCAL',this[_0xe7ba('0x35')][_0xe7ba('0x37')]):undefined;this[_0xe7ba('0xe')][_0xe7ba('0x53')](_0x2d6ffc,_0x6c8738)['then'](function(_0x4c0d12){_0x1a70ac(null,_[_0xe7ba('0x41')](_0x4c0d12)?![]:!![]);})[_0xe7ba('0x16')](function(_0x10bd7c){logger['error'](_0x10bd7c);_0x1a70ac(null,![]);});};AGIVertices['prototype']['shellCommand']=function(_0x15c4c9,_0x42925d){sh['exec'](_[_0xe7ba('0x54')](_0x15c4c9),function(_0x54a837,_0xa31c24){var _0x574542=_0xa31c24[_0xe7ba('0x55')](/(\r\n|\n|\r)/gm,'');_0x42925d(null,_0x574542);});};AGIVertices['prototype']['googleCloudTTS']=function(_0x2ba416,_0x2cabcf){scripts[_0xe7ba('0x56')](_0x2ba416[_0xe7ba('0x57')],_0x2ba416[_0xe7ba('0x58')]||_0xe7ba('0x59'),_0x2ba416['text'],_0x2ba416['languageCode']||_0xe7ba('0x5a'),_0x2ba416[_0xe7ba('0x5b')]||_0xe7ba('0x5c'),_0x2ba416[_0xe7ba('0x5d')]||_0xe7ba('0x5e'))[_0xe7ba('0x13')](function(_0x1f36c8){_0x2cabcf(null,_0x1f36c8);})[_0xe7ba('0x16')](function(_0x57beb1){_0x2cabcf(_0x57beb1);});};AGIVertices[_0xe7ba('0x10')][_0xe7ba('0x5f')]=function(_0x246f91,_0x2022e2){scripts[_0xe7ba('0x5f')](_0x246f91[_0xe7ba('0x59')],_0x246f91['google_tts_language']||'en',0x1)[_0xe7ba('0x13')](function(_0x3acb1a){_0x2022e2(null,_0x3acb1a);})[_0xe7ba('0x16')](function(_0xe047bc){_0x2022e2(_0xe047bc);});};AGIVertices[_0xe7ba('0x10')][_0xe7ba('0x60')]=function(_0x2471c8,_0x11ca03){var _0x2044db={'uri':_0x2471c8[_0xe7ba('0x61')],'method':_0x2471c8[_0xe7ba('0x62')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x2471c8[_0xe7ba('0x63')])==='number'&&parseInt(_0x2471c8[_0xe7ba('0x63')])>=0x1?parseInt(_0x2471c8['timeout'])*0x3e8:0x5*0x3e8};if(_[_0xe7ba('0x64')]([_0xe7ba('0x65'),_0xe7ba('0x66')],_0x2044db['method'][_0xe7ba('0x67')]())){try{_0x2044db[_0xe7ba('0x68')]=_0x2471c8[_0xe7ba('0xa')]?JSON[_0xe7ba('0x69')](_0x2471c8['rawBody']):{};}catch(_0x1f7800){logger[_0xe7ba('0x27')](_0xe7ba('0x6a'),_0x1f7800);}}try{_0x2044db[_0xe7ba('0x6b')]=_0x2471c8['rawHeaders']?JSON[_0xe7ba('0x69')](_0x2471c8[_0xe7ba('0x9')]):{};}catch(_0x1800f4){logger[_0xe7ba('0x27')](_0xe7ba('0x6c'),_0x1800f4);}if(_0x2471c8['computedVariables']){try{var _0x5162e6=require(_0x2471c8['computedVariables'])[_0xe7ba('0x6d')](this,_0x2044db);_0x2044db[_0xe7ba('0x6e')]=Mustache[_0xe7ba('0x6f')](_0x2471c8[_0xe7ba('0x61')],_0x5162e6,{},['$$','$$']);if(_0x2044db[_0xe7ba('0x6b')]){_0x2044db[_0xe7ba('0x6b')]=JSON['parse'](Mustache[_0xe7ba('0x6f')](JSON['stringify'](_0x2044db[_0xe7ba('0x6b')]),_0x5162e6,{},['$$','$$']));}if(_0x2044db[_0xe7ba('0x68')]){_0x2044db[_0xe7ba('0x68')]=JSON[_0xe7ba('0x69')](Mustache[_0xe7ba('0x6f')](JSON[_0xe7ba('0x70')](_0x2044db['body']),_0x5162e6,{},['$$','$$']));}}catch(_0x44563b){logger[_0xe7ba('0x27')](_0xe7ba('0x71'),_0x44563b);}}rp(_0x2044db)[_0xe7ba('0x13')](function(_0x1d3035){var _0x5e70d9={'statusCode':_0x1d3035[_0xe7ba('0x72')]||0xc8,'statusMessage':_0x1d3035['statusMessage']||'OK','headers':_0x1d3035[_0xe7ba('0x6b')]||{},'body':_0x1d3035[_0xe7ba('0x68')]||{}};_0x11ca03(null,_0x5e70d9);})[_0xe7ba('0x16')](function(_0x213411){var _0x43322f={'statusCode':_0x213411[_0xe7ba('0x72')]||0x1f4,'statusMessage':_0x213411[_0xe7ba('0x73')]||_0xe7ba('0x74'),'headers':_0x213411[_0xe7ba('0x75')][_0xe7ba('0x6b')]||{},'body':_0x213411[_0xe7ba('0x75')][_0xe7ba('0x68')]||{}};_0x11ca03(null,_0x43322f);});};AGIVertices[_0xe7ba('0x10')][_0xe7ba('0x76')]=function(_0x3129e5,_0x27eb0e){scripts[_0xe7ba('0x76')](this[_0xe7ba('0x35')][_0xe7ba('0x33')],_0x3129e5[_0xe7ba('0x77')],_0x3129e5[_0xe7ba('0x59')],_0x3129e5[_0xe7ba('0x78')]||'en')[_0xe7ba('0x13')](function(_0x36cf6d){_0x27eb0e(null,_0x36cf6d);})[_0xe7ba('0x16')](function(_0x4ae77d){_0x27eb0e(_0x4ae77d);});};AGIVertices['prototype']['googleDialogflowV2']=function(_0xaccf6e,_0x2ecfac){scripts['googleDialogflowV2'](this['channel'][_0xe7ba('0x33')],_0xaccf6e[_0xe7ba('0x79')],_0xaccf6e['client_email'],_0xaccf6e[_0xe7ba('0x7a')],_0xaccf6e['text'],_0xaccf6e['dialogflowV2_language']||'en')['then'](function(_0x2575be){_0x2ecfac(null,_0x2575be);})[_0xe7ba('0x16')](function(_0x51cd4f){_0x2ecfac(_0x51cd4f);});};AGIVertices[_0xe7ba('0x10')]['sestekNDA']=function(_0xbb6770,_0x44ad00){scripts['sestekNDA'](this['channel'],_0xbb6770)[_0xe7ba('0x13')](function(_0x5d5722){_0x44ad00(null,_0x5d5722);})[_0xe7ba('0x16')](function(_0xb0b9d5){_0x44ad00(_0xb0b9d5);});};AGIVertices[_0xe7ba('0x10')]['ispeechTTS']=function(_0xcf7f12,_0x17391f){scripts[_0xe7ba('0x7b')](_0xcf7f12[_0xe7ba('0x77')],_0xcf7f12[_0xe7ba('0x59')],_0xcf7f12[_0xe7ba('0x7c')]||_0xe7ba('0x5a'),_0xcf7f12[_0xe7ba('0x7d')])[_0xe7ba('0x13')](function(_0x223a22){_0x17391f(null,_0x223a22);})[_0xe7ba('0x16')](function(_0x2237d6){_0x17391f(_0x2237d6);});};AGIVertices[_0xe7ba('0x10')][_0xe7ba('0x7e')]=function(_0x3f763c,_0x16b3df,_0x109f40){scripts[_0xe7ba('0x7e')](_0x16b3df,_0x3f763c[_0xe7ba('0x77')],_0x3f763c[_0xe7ba('0x7f')]||_0xe7ba('0x5a'),this['isConfigured'](_0x3f763c['model'])?_0x3f763c['model']:undefined)[_0xe7ba('0x13')](function(_0x28d616){_0x109f40(null,_0x28d616);})[_0xe7ba('0x16')](function(_0x88deaf){_0x109f40(_0x88deaf);});};AGIVertices[_0xe7ba('0x10')]['awsPolly']=function(_0x5514ba,_0x2c86d2){scripts['awsPolly'](_0x5514ba[_0xe7ba('0x80')],_0x5514ba[_0xe7ba('0x81')],_0x5514ba[_0xe7ba('0x82')],_0x5514ba[_0xe7ba('0x83')]||_0xe7ba('0x84'),_0x5514ba[_0xe7ba('0x59')],_0x5514ba[_0xe7ba('0x85')]||_0xe7ba('0x59'))['then'](function(_0x1c5aaa){_0x2c86d2(null,_0x1c5aaa);})[_0xe7ba('0x16')](function(_0x31c04c){_0x2c86d2(_0x31c04c);});};AGIVertices['prototype']['awsLex']=function(_0x361ccb,_0x2ff70a){scripts[_0xe7ba('0x86')](this[_0xe7ba('0x35')]['uniqueid'],_0x361ccb[_0xe7ba('0x80')],_0x361ccb[_0xe7ba('0x81')],_0x361ccb[_0xe7ba('0x87')],_0x361ccb[_0xe7ba('0x59')],_0x361ccb[_0xe7ba('0x88')])[_0xe7ba('0x13')](function(_0x342149){_0x2ff70a(null,_0x342149);})[_0xe7ba('0x16')](function(_0xf9a0af){_0x2ff70a(_0xf9a0af);});};AGIVertices[_0xe7ba('0x10')][_0xe7ba('0x89')]=function(_0x195342,_0x159951,_0x3a89fd){scripts[_0xe7ba('0x89')](_0x159951,_0x195342[_0xe7ba('0x77')],_0x195342['google_asr_language']||'en-US')['then'](function(_0x13384f){_0x3a89fd(null,_0x13384f);})[_0xe7ba('0x16')](function(_0x3a9ba3){_0x3a89fd(_0x3a9ba3);});};AGIVertices['prototype']['tildeASR']=function(_0x403e50,_0x3174b5,_0x4c754){scripts[_0xe7ba('0x8a')](_0x3174b5,_0x403e50[_0xe7ba('0x8b')],_0x403e50[_0xe7ba('0x8c')],_0x403e50[_0xe7ba('0x6e')])['then'](function(_0xd51fdc){_0x4c754(null,_0xd51fdc);})[_0xe7ba('0x16')](function(_0x2cdc45){_0x4c754(_0x2cdc45);});};AGIVertices[_0xe7ba('0x10')]['clear']=function(_0x406298){var _0x4ddfea=_[_0xe7ba('0x64')](verticesWithRetry,_0x406298[_0xe7ba('0x34')])?_0x406298:_[_0xe7ba('0x8d')](_0x406298);for(var _0x26759b in _0x4ddfea){if(_0x4ddfea[_0xe7ba('0x8e')](_0x26759b)){if(_0x4ddfea[_0x26759b]&&_[_0xe7ba('0x8f')](_0x4ddfea[_0x26759b])){if(_[_0xe7ba('0x64')](recursiveMapAttributes,_0x26759b)){_0x4ddfea[_0x26759b]=this[_0xe7ba('0x90')](_0x4ddfea[_0x26759b]);}else{_0x4ddfea[_0x26759b]=this[_0xe7ba('0x91')](_0x4ddfea[_0x26759b]);}}}}return _0x4ddfea;};AGIVertices[_0xe7ba('0x10')][_0xe7ba('0x92')]=function(_0x1144df){for(var _0x371fa0 in _0x1144df){if(_0x1144df['hasOwnProperty'](_0x371fa0)){if(_[_0xe7ba('0x93')](_0x1144df[_0x371fa0])){this[_0xe7ba('0x92')](_0x1144df[_0x371fa0]);}else if(_[_0xe7ba('0x94')](_0x1144df[_0x371fa0])){for(var _0x13dbb6=0x0;_0x13dbb6<_0x1144df[_0x371fa0]['length'];_0x13dbb6++){this[_0xe7ba('0x92')](_0x1144df[_0x371fa0][_0x13dbb6]);}}else if(_['isString'](_0x1144df[_0x371fa0])){_0x1144df[_0x371fa0]=this['replaceAllVariables'](_0x1144df[_0x371fa0]);}}}};AGIVertices[_0xe7ba('0x10')][_0xe7ba('0x95')]=function(_0x1297f1,_0x163eed){for(var _0x18a506 in _0x1297f1){if(_0x1297f1[_0xe7ba('0x8e')](_0x18a506)){if(_[_0xe7ba('0x93')](_0x1297f1[_0x18a506])){if(!_[_0xe7ba('0x40')](_0x1297f1[_0x18a506])){this['saveRestApiResult'](_0x1297f1[_0x18a506],util[_0xe7ba('0x51')](_0xe7ba('0x96'),_0x163eed,_0x18a506));}}else if(_['isArray'](_0x1297f1[_0x18a506])){for(var _0x3b8e10=0x0;_0x3b8e10<_0x1297f1[_0x18a506][_0xe7ba('0x97')];_0x3b8e10++){this[_0xe7ba('0x95')](_0x1297f1[_0x18a506][_0x3b8e10],util[_0xe7ba('0x51')](_0xe7ba('0x96'),_0x163eed,_0x18a506+'['+_0x3b8e10+']'));}}else{if(!_[_0xe7ba('0x41')](_0x1297f1[_0x18a506])){this[_0xe7ba('0x35')][_0xe7ba('0x98')](util['format'](_0xe7ba('0x96'),_0x163eed,_0x18a506),_0x1297f1[_0x18a506]);}}}}};AGIVertices[_0xe7ba('0x10')][_0xe7ba('0x90')]=function(_0x26102c){try{var _0x5441c7=JSON[_0xe7ba('0x69')](_0x26102c);this[_0xe7ba('0x92')](_0x5441c7);return JSON[_0xe7ba('0x70')](_0x5441c7);}catch(_0x4576fd){return this[_0xe7ba('0x91')](_0x26102c);}};AGIVertices[_0xe7ba('0x10')][_0xe7ba('0x91')]=function(_0x1dd328){var _0x2502e1=_0x1dd328[_0xe7ba('0x99')]('{');for(var _0x10e8ef=0x1;_0x10e8ef<_0x2502e1[_0xe7ba('0x97')];_0x10e8ef+=0x1){var _0x219538=_0x2502e1[_0x10e8ef][_0xe7ba('0x99')]('}');if(_0x219538['length']>0x1){_0x1dd328=_0x1dd328['replaceAll']('{'+_0x219538[0x0]+'}',this[_0xe7ba('0x35')][_0xe7ba('0x11')](_0x219538[0x0])[_0xe7ba('0x9a')]||_0x219538[0x0]);}}if(_0x2502e1[_0xe7ba('0x97')]===0x1){return _0x1dd328[_0xe7ba('0x48')]();}return this[_0xe7ba('0x91')](_0x1dd328);};AGIVertices['prototype'][_0xe7ba('0x9b')]=function(_0x154e8c,_0x5d3d31){var _0x4c2936=this['channel'][_0xe7ba('0x11')](_0x154e8c);if(_0x4c2936[_0xe7ba('0x9c')]===-0x1){return _0x4c2936;}logger[_0xe7ba('0x29')](util['format'](_0xe7ba('0x9d'),_0x5d3d31,_0x4c2936[_0xe7ba('0x9a')]));return this[_0xe7ba('0x35')][_0xe7ba('0x98')](_0x5d3d31,_0x4c2936['extra']);};AGIVertices['prototype']['isConfigured']=function(_0x4a7071){return _0x4a7071&&_0x4a7071!=='0'&&_0x4a7071!=='-1'&&_0x4a7071!=='';};AGIVertices['prototype'][_0xe7ba('0x9e')]=function(_0x2d4926){this[_0xe7ba('0x32')]['sync'](this,_0x2d4926,'-');_0x2d4926['retry']=_0x2d4926['maxRetry'];return{'code':0xc8,'result':'-'};};AGIVertices[_0xe7ba('0x10')][_0xe7ba('0x9f')]=function(_0x515f1f){logger['info'](util[_0xe7ba('0x51')](_0xe7ba('0xa0'),_0x515f1f[_0xe7ba('0xa1')]));if(!this[_0xe7ba('0xa2')](_0x515f1f[_0xe7ba('0x59')])){return this[_0xe7ba('0x35')][_0xe7ba('0xa3')](_0xe7ba('0xa4'));}var _0x51030f='\x22'+_0x515f1f[_0xe7ba('0x59')]+'\x22';if(this[_0xe7ba('0xa2')](_0x515f1f['options'])){_0x51030f+=','+_0x515f1f[_0xe7ba('0x75')];}var _0x3336a6=this[_0xe7ba('0x35')][_0xe7ba('0xa5')](_0xe7ba('0xa6'),_0x51030f);if(_0x3336a6['result']===-0x1){return _0x3336a6;}return this['channel'][_0xe7ba('0xa3')](util['format'](_0xe7ba('0xa7'),_0x51030f));};AGIVertices['prototype'][_0xe7ba('0xa8')]=function(_0x24ce3b){logger['info'](util[_0xe7ba('0x51')](_0xe7ba('0xa9'),_0x24ce3b[_0xe7ba('0xa1')]));if(!this[_0xe7ba('0xa2')](_0x24ce3b[_0xe7ba('0xaa')])){return this[_0xe7ba('0x35')][_0xe7ba('0xa3')]('no\x20grammar\x20configured');}var _0x61c814=_0x24ce3b['grammar'];if(this[_0xe7ba('0xa2')](_0x24ce3b[_0xe7ba('0x75')])){_0x61c814+=','+_0x24ce3b[_0xe7ba('0x75')];}var _0x2b26c5=this[_0xe7ba('0x35')][_0xe7ba('0xa5')]('MRCPRecog',_0x61c814);if(_0x2b26c5[_0xe7ba('0x9c')]===-0x1){return _0x2b26c5;}var _0x31826f=this['getAndSetVariable'](_0xe7ba('0xab'),_0xe7ba('0xac'));if(_0x31826f['result']===-0x1){return _0x31826f;}var _0x3c18d4=this[_0xe7ba('0x9b')](_0xe7ba('0xad'),_0xe7ba('0xae'));if(_0x3c18d4[_0xe7ba('0x9c')]===-0x1){return _0x3c18d4;}var _0x728099=this[_0xe7ba('0x9b')]('RECOG_INSTANCE()',_0xe7ba('0xaf'));if(_0x728099[_0xe7ba('0x9c')]===-0x1){return _0x728099;}return this[_0xe7ba('0x35')][_0xe7ba('0xa3')](util[_0xe7ba('0x51')]('Executed\x20command\x20MRCPRecog\x20%s',_0x61c814));};AGIVertices['prototype'][_0xe7ba('0x5')]=function(_0x2bc0ac){logger['info'](util[_0xe7ba('0x51')](_0xe7ba('0xb0'),_0x2bc0ac[_0xe7ba('0xa1')]));return this['channel']['agi']([_0x2bc0ac[_0xe7ba('0xb1')],_0x2bc0ac[_0xe7ba('0xb2')]]);};AGIVertices[_0xe7ba('0x10')][_0xe7ba('0xb3')]=function(_0x12932a){logger[_0xe7ba('0x29')](util[_0xe7ba('0x51')](_0xe7ba('0xb4'),_0x12932a[_0xe7ba('0xa1')]));if(this[_0xe7ba('0xa2')](_0x12932a[_0xe7ba('0x63')])){logger[_0xe7ba('0x29')](util[_0xe7ba('0x51')]('Wait\x20%s\x20seconds\x20before\x20answer',_0x12932a[_0xe7ba('0x63')]));var _0x12de23=this[_0xe7ba('0x35')]['wait'](_0x12932a['timeout']);if(_0x12de23[_0xe7ba('0x9c')]===-0x1){return _0x12de23;}}return this[_0xe7ba('0x35')][_0xe7ba('0xb3')]();};AGIVertices['prototype'][_0xe7ba('0xb5')]=function(_0x2086b9){logger['info'](util[_0xe7ba('0x51')](_0xe7ba('0xb6'),_0x2086b9[_0xe7ba('0xa1')]));if(!this[_0xe7ba('0xa2')](_0x2086b9[_0xe7ba('0x46')])){return this[_0xe7ba('0x35')][_0xe7ba('0x27')](_0x2086b9,_0xe7ba('0xb7'));}_0x2086b9[_0xe7ba('0xb8')]=moment();if(this[_0xe7ba('0xa2')](_0x2086b9[_0xe7ba('0xb9')])){_0x2086b9[_0xe7ba('0xb8')]=moment()['add'](_0x2086b9['delay'],_0xe7ba('0xba'));}if(!this['isConfigured'](_0x2086b9['callback_priority'])){_0x2086b9[_0xe7ba('0x49')]=0x2;}this[_0xe7ba('0xbb')][_0xe7ba('0x6d')](this,_0x2086b9);return this['channel'][_0xe7ba('0xa3')](util[_0xe7ba('0x51')](_0xe7ba('0xbc'),_0x2086b9[_0xe7ba('0x45')],_0x2086b9[_0xe7ba('0x46')],_0x2086b9[_0xe7ba('0xb8')]));};AGIVertices['prototype'][_0xe7ba('0xbd')]=function(_0x382cd6){logger[_0xe7ba('0x29')](util[_0xe7ba('0x51')](_0xe7ba('0xbe'),_0x382cd6[_0xe7ba('0xa1')]));var _0x3c5bbd=this[_0xe7ba('0x35')][_0xe7ba('0xa5')](_0x382cd6[_0xe7ba('0xbf')],_0x382cd6[_0xe7ba('0x75')]);if(_0x3c5bbd[_0xe7ba('0x9c')]===-0x1){return _0x3c5bbd;}return this[_0xe7ba('0x35')][_0xe7ba('0xa3')](util['format'](_0xe7ba('0xc0'),_0x382cd6[_0xe7ba('0xbf')],_0x382cd6[_0xe7ba('0x75')]));};AGIVertices[_0xe7ba('0x10')][_0xe7ba('0xc1')]=function(_0x5e111a){logger[_0xe7ba('0x29')](util[_0xe7ba('0x51')](_0xe7ba('0xc2'),_0x5e111a[_0xe7ba('0xa1')]));if(!this[_0xe7ba('0xa2')](_0x5e111a[_0xe7ba('0x59')])){return this[_0xe7ba('0x35')]['noop'](_0xe7ba('0xa4'));}var _0x4e1c56='\x22'+_0x5e111a[_0xe7ba('0x59')]+'\x22';if(this[_0xe7ba('0xa2')](_0x5e111a[_0xe7ba('0x75')])){_0x4e1c56+=','+_0x5e111a['options'];}var _0x34a44c=this[_0xe7ba('0x35')][_0xe7ba('0xa5')](_0xe7ba('0xa6'),_0x4e1c56);if(_0x34a44c[_0xe7ba('0x9c')]===-0x1){return _0x34a44c;}return this[_0xe7ba('0x35')][_0xe7ba('0xa3')](util[_0xe7ba('0x51')]('Executed\x20command\x20MRCPSynth\x20%s',_0x4e1c56));};AGIVertices[_0xe7ba('0x10')][_0xe7ba('0xc3')]=function(_0x2d6d14){logger[_0xe7ba('0x29')](util[_0xe7ba('0x51')](_0xe7ba('0xc4'),_0x2d6d14['label']));if(!this[_0xe7ba('0xa2')](_0x2d6d14[_0xe7ba('0x59')])){return this[_0xe7ba('0x35')]['noop'](_0xe7ba('0xa4'));}var _0x1ccb79='\x22'+_0x2d6d14[_0xe7ba('0x59')]+'\x22';if(this[_0xe7ba('0xa2')](_0x2d6d14[_0xe7ba('0x75')])){_0x1ccb79+=','+_0x2d6d14[_0xe7ba('0x75')];}var _0x397b66=this['channel'][_0xe7ba('0xa5')](_0xe7ba('0xa6'),_0x1ccb79);if(_0x397b66[_0xe7ba('0x9c')]===-0x1){return _0x397b66;}return this[_0xe7ba('0x35')][_0xe7ba('0xa3')](util['format'](_0xe7ba('0xa7'),_0x1ccb79));};AGIVertices[_0xe7ba('0x10')][_0xe7ba('0xc5')]=function(_0x5b2f88){logger['info'](util[_0xe7ba('0x51')]('Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block',_0x5b2f88['label']));if(!this[_0xe7ba('0xa2')](_0x5b2f88[_0xe7ba('0xaa')])){return this[_0xe7ba('0x35')][_0xe7ba('0xa3')](_0xe7ba('0xc6'));}var _0x253a16=_0x5b2f88[_0xe7ba('0xaa')];if(this[_0xe7ba('0xa2')](_0x5b2f88[_0xe7ba('0x75')])){_0x253a16+=','+_0x5b2f88[_0xe7ba('0x75')];}var _0x3f7332=this[_0xe7ba('0x35')][_0xe7ba('0xa5')](_0xe7ba('0xc7'),_0x253a16);if(_0x3f7332[_0xe7ba('0x9c')]===-0x1){return _0x3f7332;}var _0x32f5ba=this['getAndSetVariable'](_0xe7ba('0xab'),_0xe7ba('0xc8'));if(_0x32f5ba[_0xe7ba('0x9c')]===-0x1){return _0x32f5ba;}var _0x4cae50=this[_0xe7ba('0x9b')](_0xe7ba('0xad'),_0xe7ba('0xc9'));if(_0x4cae50[_0xe7ba('0x9c')]===-0x1){return _0x4cae50;}var _0xf2f6df=this[_0xe7ba('0x9b')](_0xe7ba('0xca'),'LUMENVOX_ASR_INSTANCE');if(_0xf2f6df[_0xe7ba('0x9c')]===-0x1){return _0xf2f6df;}return this[_0xe7ba('0x35')]['noop'](util[_0xe7ba('0x51')](_0xe7ba('0xcb'),_0x253a16));};AGIVertices[_0xe7ba('0x10')][_0xe7ba('0xcc')]=function(_0x47f647){logger['info'](util[_0xe7ba('0x51')](_0xe7ba('0xcd'),_0x47f647[_0xe7ba('0xa1')]));if(!this['isConfigured'](_0x47f647[_0xe7ba('0xaa')])){return this[_0xe7ba('0x35')][_0xe7ba('0xa3')]('no\x20grammar\x20configured');}var _0x3a6222=_0x47f647[_0xe7ba('0xaa')];if(this[_0xe7ba('0xa2')](_0x47f647[_0xe7ba('0x75')])){_0x3a6222+=','+_0x47f647[_0xe7ba('0x75')];}var _0x8e1f7=this['channel'][_0xe7ba('0xa5')]('MRCPRecog',_0x3a6222);if(_0x8e1f7[_0xe7ba('0x9c')]===-0x1){return _0x8e1f7;}var _0x4fa53f=this['getAndSetVariable'](_0xe7ba('0xab'),_0xe7ba('0xce'));if(_0x4fa53f[_0xe7ba('0x9c')]===-0x1){return _0x4fa53f;}var _0x571c7e=this['getAndSetVariable'](_0xe7ba('0xad'),_0xe7ba('0xcf'));if(_0x571c7e[_0xe7ba('0x9c')]===-0x1){return _0x571c7e;}var _0x4326e7=this[_0xe7ba('0x9b')]('RECOG_INSTANCE()',_0xe7ba('0xd0'));if(_0x4326e7['result']===-0x1){return _0x4326e7;}return this[_0xe7ba('0x35')][_0xe7ba('0xa3')](util[_0xe7ba('0x51')](_0xe7ba('0xcb'),_0x3a6222));};AGIVertices[_0xe7ba('0x10')][_0xe7ba('0xd1')]=function(_0x3cbfb1){logger[_0xe7ba('0x29')](util[_0xe7ba('0x51')](_0xe7ba('0xd2'),_0x3cbfb1['label']));if(!this[_0xe7ba('0xa2')](_0x3cbfb1['odbc_id'])){return this[_0xe7ba('0x35')][_0xe7ba('0x27')](_0x3cbfb1,_0xe7ba('0xd3'));}var _0x3e0c94=this['getSquareOdbc'][_0xe7ba('0x6d')](this,_0x3cbfb1['odbc_id']);if(!_0x3e0c94){return this[_0xe7ba('0x35')][_0xe7ba('0x27')](_0x3cbfb1,'no\x20odbc\x20database\x20found');}if(!this[_0xe7ba('0xa2')](_0x3cbfb1[_0xe7ba('0x2b')])){return this['channel'][_0xe7ba('0x27')](_0x3cbfb1,_0xe7ba('0xd4'));}var _0x220f53=_0x3cbfb1[_0xe7ba('0x2b')][_0xe7ba('0x55')](/(\r\n|\n|\r)/gm,'\x20');this['channel'][_0xe7ba('0xa3')](util['format'](_0xe7ba('0xd5'),_0x220f53));var _0x28877c=this[_0xe7ba('0xd6')][_0xe7ba('0x6d')](this,_0x3e0c94,_0x220f53);this[_0xe7ba('0x32')]['sync'](this,_0x3cbfb1,_0x220f53);if(!this['isConfigured'](_0x3cbfb1['variable_id'])){return this['channel'][_0xe7ba('0xa3')](_0xe7ba('0xd7'));}var _0x1f6aa1=this[_0xe7ba('0x11')]['sync'](this,_0x3cbfb1[_0xe7ba('0xd8')]);if(!_0x1f6aa1){return this[_0xe7ba('0x35')][_0xe7ba('0x27')](_0x3cbfb1,'no\x20variable\x20found');}var _0x334adc=this;_0x28877c['forEach'](function(_0x5ce535,_0x10d41b){Object[_0xe7ba('0xd9')](_0x5ce535)[_0xe7ba('0xda')](function(_0x418432){_0x334adc[_0xe7ba('0x35')][_0xe7ba('0x98')](util[_0xe7ba('0x51')](_0xe7ba('0xdb'),_0x1f6aa1,_0x10d41b,_0x418432),_0x5ce535[_0x418432]);});});this['channel']['setVariable'](util[_0xe7ba('0x51')](_0xe7ba('0xdc'),_0x1f6aa1),_0x28877c[_0xe7ba('0x97')]);return this['channel'][_0xe7ba('0xa3')](util[_0xe7ba('0x51')]('variable\x20%s\x20set',_0x1f6aa1));};AGIVertices[_0xe7ba('0x10')]['dial']=function(_0x43d14d){logger[_0xe7ba('0xdd')](util[_0xe7ba('0x51')]('Enter\x20in\x20DIAL\x20(%s)\x20block',_0x43d14d[_0xe7ba('0xa1')]));if(!this[_0xe7ba('0xa2')](_0x43d14d[_0xe7ba('0xde')])){return this[_0xe7ba('0x35')][_0xe7ba('0x27')](_0x43d14d,_0xe7ba('0xdf'));}var _0x12b99c=this[_0xe7ba('0xe0')][_0xe7ba('0x6d')](this,_0x43d14d['sip_id']);if(!_0x12b99c){return this[_0xe7ba('0x35')][_0xe7ba('0x27')](_0x43d14d,_0xe7ba('0xe1'));}var _0x36cc2b=this[_0xe7ba('0x35')][_0xe7ba('0xa5')]('DIAL',[util[_0xe7ba('0x51')]('SIP/%s',_0x12b99c),_0x43d14d[_0xe7ba('0x63')],_0x43d14d[_0xe7ba('0xe2')],_0x43d14d[_0xe7ba('0x61')]]);if(_0x36cc2b[_0xe7ba('0x9c')]===-0x1){return _0x36cc2b;}return this['channel'][_0xe7ba('0xa3')](util['format']('Executed\x20command\x20%s','DIAL'));};AGIVertices['prototype'][_0xe7ba('0xe3')]=function(_0x5dd240){logger[_0xe7ba('0x29')](util['format'](_0xe7ba('0xe4'),_0x5dd240[_0xe7ba('0xa1')]));if(!this[_0xe7ba('0xa2')](_0x5dd240[_0xe7ba('0x77')])){return this[_0xe7ba('0x35')][_0xe7ba('0xa3')]('no\x20key\x20configured');}if(!this[_0xe7ba('0xa2')](_0x5dd240[_0xe7ba('0x59')])){return this[_0xe7ba('0x35')][_0xe7ba('0xa3')](_0xe7ba('0xa4'));}this[_0xe7ba('0x35')][_0xe7ba('0xe5')]=!![];this[_0xe7ba('0x32')](_0x5dd240);this[_0xe7ba('0x3f')](_0x5dd240[_0xe7ba('0x59')],'in','','');this['channel'][_0xe7ba('0xa3')](util['format'](_0xe7ba('0xe6'),_0x5dd240[_0xe7ba('0x59')]));var _0x5e82a5=this[_0xe7ba('0x76')][_0xe7ba('0x6d')](this,_0x5dd240);if(_0x5e82a5){for(var _0x9f917c in _0x5e82a5){if(_0x5e82a5[_0xe7ba('0x8e')](_0x9f917c)){this[_0xe7ba('0x35')]['setVariable'](util[_0xe7ba('0x51')](_0xe7ba('0xe7'),_0x9f917c[_0xe7ba('0x67')]()),_0x5e82a5[_0x9f917c]);}}this[_0xe7ba('0x3f')](_0x5e82a5[_0xe7ba('0xe8')],_0xe7ba('0xe9'),_0xe7ba('0xe3'),'');return this[_0xe7ba('0x35')][_0xe7ba('0xa3')](util[_0xe7ba('0x51')]('Dialogflow\x20Result\x20%s',_0x5e82a5['speech']));}return this['channel']['error'](_0x5dd240,_0xe7ba('0xea'));};AGIVertices['prototype']['dialogflowV2']=function(_0x313cf2){logger['info'](util['format'](_0xe7ba('0xeb'),_0x313cf2['label']));if(!this[_0xe7ba('0xa2')](_0x313cf2['dialogflowV2_project_id'])){return this[_0xe7ba('0x35')]['noop'](_0xe7ba('0xec'));}if(!this[_0xe7ba('0xa2')](_0x313cf2[_0xe7ba('0xed')])){return this['channel'][_0xe7ba('0xa3')](_0xe7ba('0xee'));}if(!this[_0xe7ba('0xa2')](_0x313cf2['private_key'])){return this[_0xe7ba('0x35')][_0xe7ba('0xa3')]('no\x20private_key\x20configured');}if(!this[_0xe7ba('0xa2')](_0x313cf2[_0xe7ba('0xef')])){return this[_0xe7ba('0x35')]['noop']('no\x20anguage\x20configured');}if(!this[_0xe7ba('0xa2')](_0x313cf2[_0xe7ba('0x59')])){return this[_0xe7ba('0x35')][_0xe7ba('0xa3')](_0xe7ba('0xa4'));}this[_0xe7ba('0x35')][_0xe7ba('0xe5')]=!![];this[_0xe7ba('0x32')](_0x313cf2);this[_0xe7ba('0x3f')](_0x313cf2[_0xe7ba('0x59')],'in','','');this[_0xe7ba('0x35')][_0xe7ba('0xa3')](util['format'](_0xe7ba('0xf0'),_0x313cf2[_0xe7ba('0x59')]));var _0x433b41=this[_0xe7ba('0xf1')][_0xe7ba('0x6d')](this,_0x313cf2);if(_0x433b41){for(var _0x391abe in _0x433b41){if(_0x433b41[_0xe7ba('0x8e')](_0x391abe)){if(_0x391abe!==_0xe7ba('0xf2')){this['channel'][_0xe7ba('0x98')](util[_0xe7ba('0x51')](_0xe7ba('0xe7'),_0x391abe[_0xe7ba('0x67')]()),_0x433b41[_0x391abe]);}}}this[_0xe7ba('0x3f')](_0x433b41[_0xe7ba('0xe8')],_0xe7ba('0xe9'),_0xe7ba('0xf3'),_0x433b41['providerResponse']);return this[_0xe7ba('0x35')][_0xe7ba('0xa3')](util[_0xe7ba('0x51')](_0xe7ba('0xf4'),_0x433b41['speech']));}return this[_0xe7ba('0x35')][_0xe7ba('0x27')](_0x313cf2,_0xe7ba('0xf5'));};AGIVertices[_0xe7ba('0x10')]['sesteknda']=function(_0x4bf371){logger[_0xe7ba('0x29')](util[_0xe7ba('0x51')]('Enter\x20in\x20SESTEKNDA\x20(%s)\x20block',_0x4bf371[_0xe7ba('0xa1')]));if(!this[_0xe7ba('0xa2')](_0x4bf371[_0xe7ba('0xf6')])){return this[_0xe7ba('0x35')][_0xe7ba('0xa3')](_0xe7ba('0xf7'));}if(!this['isConfigured'](_0x4bf371[_0xe7ba('0xf8')])){return this[_0xe7ba('0x35')][_0xe7ba('0xa3')]('no\x20username\x20configured');}if(!this[_0xe7ba('0xa2')](_0x4bf371['password'])){return this[_0xe7ba('0x35')][_0xe7ba('0xa3')](_0xe7ba('0xf9'));}if(!this[_0xe7ba('0xa2')](_0x4bf371[_0xe7ba('0xfa')])){return this[_0xe7ba('0x35')][_0xe7ba('0xa3')](_0xe7ba('0xa4'));}this['channel'][_0xe7ba('0xe5')]=!![];this[_0xe7ba('0x32')](_0x4bf371);this[_0xe7ba('0x3f')](_0x4bf371['text'],'in','','');this[_0xe7ba('0x35')][_0xe7ba('0xa3')](util[_0xe7ba('0x51')](_0xe7ba('0xfb'),_0x4bf371['text']));var _0x519e2d=this[_0xe7ba('0xfc')]['sync'](this,_0x4bf371);if(_0x519e2d){for(var _0x557421 in _0x519e2d){if(_0x519e2d[_0xe7ba('0x8e')](_0x557421)){this['channel'][_0xe7ba('0x98')](util['format'](_0xe7ba('0xfd'),_0x557421['toUpperCase']()),_0x519e2d[_0x557421]);}}this[_0xe7ba('0x3f')](_0x519e2d[_0xe7ba('0xe8')],'out','sesteknda','');if(_0x519e2d[_0xe7ba('0xfe')]){this[_0xe7ba('0x35')]['noop'](util[_0xe7ba('0x51')]('Sestek\x20NDA\x20%s\x20file\x20created',_0x519e2d['audiofile']));var _0x5896c4=this['channel'][_0xe7ba('0xff')](_0x519e2d[_0xe7ba('0xfe')]);try{fs[_0xe7ba('0x100')](_0x519e2d[_0xe7ba('0xfe')]+_0xe7ba('0x101'));}catch(_0x32d9ed){logger['error'](_0x32d9ed);}return _0x5896c4;}else{return this['channel']['noop'](util[_0xe7ba('0x51')](_0xe7ba('0x102'),_0x519e2d['speech']));}}return this[_0xe7ba('0x35')][_0xe7ba('0x27')](_0x4bf371,_0xe7ba('0x103'));};AGIVertices[_0xe7ba('0x10')][_0xe7ba('0x104')]=function(_0x348fc2){logger[_0xe7ba('0x29')](util[_0xe7ba('0x51')](_0xe7ba('0x105'),_0x348fc2[_0xe7ba('0xa1')]));return this[_0xe7ba('0x35')][_0xe7ba('0xa3')](_0xe7ba('0x104'));};AGIVertices['prototype'][_0xe7ba('0x106')]=function(_0x5b1cb3){logger['info'](util['format'](_0xe7ba('0x107'),_0x5b1cb3['label']));var _0x12321b='';if(_0x5b1cb3[_0xe7ba('0x108')]){if(!this[_0xe7ba('0xa2')](_0x5b1cb3['trunk_id'])){return this[_0xe7ba('0x35')]['error'](_0x5b1cb3,_0xe7ba('0x109'));}else{var _0x46af6f=parseInt(_0x5b1cb3[_0xe7ba('0x108')],0xa);if(isNaN(_0x46af6f)){_0x12321b=_0x5b1cb3[_0xe7ba('0x108')];}else{_0x12321b=this['getTrunk'][_0xe7ba('0x6d')](this,_0x5b1cb3[_0xe7ba('0x108')]);if(!_0x12321b){return this[_0xe7ba('0x35')][_0xe7ba('0x27')](_0x5b1cb3,'no\x20trunk\x20found');}}}}else if(_0x5b1cb3[_0xe7ba('0x10a')]){_0x12321b=_0x5b1cb3[_0xe7ba('0x10a')];}else{return this['channel'][_0xe7ba('0x27')](_0x5b1cb3,_0xe7ba('0x109'));}var _0x16a1c4=this[_0xe7ba('0x35')][_0xe7ba('0xa5')](_0xe7ba('0x10b'),[util[_0xe7ba('0x51')](_0xe7ba('0x10c'),_0x12321b,_0x5b1cb3['phone']),_0x5b1cb3[_0xe7ba('0x63')],_0x5b1cb3['opts'],_0x5b1cb3[_0xe7ba('0x61')]]);if(_0x16a1c4['result']===-0x1){return _0x16a1c4;}return this[_0xe7ba('0x35')][_0xe7ba('0xa3')](util[_0xe7ba('0x51')](_0xe7ba('0x10d'),_0xe7ba('0x10b')));};AGIVertices['prototype'][_0xe7ba('0x10e')]=function(_0x580e58){logger[_0xe7ba('0x29')](util[_0xe7ba('0x51')](_0xe7ba('0x10f'),_0x580e58['label']));return this['channel']['noop']('finally');};AGIVertices[_0xe7ba('0x10')]['getdigits']=function(_0x3d32a7){logger['info'](util[_0xe7ba('0x51')](_0xe7ba('0x110'),_0x3d32a7[_0xe7ba('0xa1')]));if(_0x3d32a7[_0xe7ba('0x111')]===0x0){return this['maxRetry'](_0x3d32a7);}_0x3d32a7[_0xe7ba('0x111')]-=0x1;if(!this[_0xe7ba('0xa2')](_0x3d32a7[_0xe7ba('0x112')])){return this['channel']['error'](_0x3d32a7,_0xe7ba('0x113'));}var _0x102b60=this[_0xe7ba('0x1c')][_0xe7ba('0x6d')](this,_0x3d32a7['file_id']);if(!_0x102b60){return this[_0xe7ba('0x35')][_0xe7ba('0x27')](_0x3d32a7,'no\x20file\x20audio\x20found');}if(!this[_0xe7ba('0xa2')](_0x3d32a7[_0xe7ba('0xd8')])){return this[_0xe7ba('0x35')][_0xe7ba('0x27')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x49bda0=this['channel'][_0xe7ba('0x114')](_0x102b60,_0x3d32a7['response'],_0x3d32a7['maxdigit']);var _0x4a038e=_0x49bda0[_0xe7ba('0x9c')]?_0x49bda0[_0xe7ba('0x9c')]['toString']():'';logger[_0xe7ba('0x29')](_0xe7ba('0x115'),JSON[_0xe7ba('0x70')](_0x49bda0));if(_0x49bda0[_0xe7ba('0x9c')]===-0x1){this[_0xe7ba('0x32')][_0xe7ba('0x6d')](this,_0x3d32a7,_0x4a038e);return _0x49bda0;}else if(_0x49bda0[_0xe7ba('0x9a')]==='timeout'){_0x49bda0[_0xe7ba('0x9c')]=_0x4a038e['length']>=parseInt(_0x3d32a7[_0xe7ba('0x116')])?'x':'i';}else{_0x49bda0[_0xe7ba('0x9c')]=_0x4a038e[_0xe7ba('0x97')]>=parseInt(_0x3d32a7[_0xe7ba('0x116')])&&_0x4a038e[_0xe7ba('0x97')]<=parseInt(_0x3d32a7['maxdigit'])?'x':'i';}var _0x3fbe87=this[_0xe7ba('0x11')][_0xe7ba('0x6d')](this,_0x3d32a7[_0xe7ba('0xd8')]);if(!_0x3fbe87){return this['channel'][_0xe7ba('0x27')](_0x3d32a7,_0xe7ba('0x117'));}this[_0xe7ba('0x35')][_0xe7ba('0x98')](_0x3fbe87,_0x4a038e);if(this['isConfigured'](_0x3d32a7[_0xe7ba('0x118')])){var _0xa06b36=parseInt(_0x3d32a7[_0xe7ba('0x118')],0xa);var _0x430369=rs[_0xe7ba('0x119')]({'charset':'*','length':_0xa06b36});var _0x57fa06=_0x4a038e[_0xe7ba('0x97')];if(_0x57fa06>0x0){if(_0x57fa06>_0xa06b36){this[_0xe7ba('0x32')][_0xe7ba('0x6d')](this,_0x3d32a7,_0x3d32a7[_0xe7ba('0x11a')]===_0xe7ba('0x11b')?_0x430369+_0x4a038e[_0xe7ba('0x11c')](_0xa06b36):_0x4a038e[_0xe7ba('0x11c')](0x0,_0x57fa06-_0xa06b36)+_0x430369);}else{this['createSquareDetailsReport'][_0xe7ba('0x6d')](this,_0x3d32a7,rs['generate']({'charset':'*','length':_0x57fa06}));}}else{this[_0xe7ba('0x32')]['sync'](this,_0x3d32a7,'');}}else{this['createSquareDetailsReport']['sync'](this,_0x3d32a7,_0x4a038e);}return _0x49bda0;};AGIVertices[_0xe7ba('0x10')][_0xe7ba('0xd')]=function(_0x43bb5a){logger[_0xe7ba('0x29')](util[_0xe7ba('0x51')]('Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block',_0x43bb5a[_0xe7ba('0xa1')]));return this[_0xe7ba('0xc')](_0x43bb5a);};AGIVertices['prototype'][_0xe7ba('0x11d')]=function(_0xaf2ae9){logger['info'](util[_0xe7ba('0x51')]('Enter\x20in\x20GOAL\x20(%s)\x20block',_0xaf2ae9['label']));this['createSquareDetailsReport'][_0xe7ba('0x6d')](this,_0xaf2ae9,_0xaf2ae9[_0xe7ba('0x11e')]);return this['channel'][_0xe7ba('0xa3')](util[_0xe7ba('0x51')]('GOAL\x20%s',_0xaf2ae9[_0xe7ba('0x11e')]));};AGIVertices[_0xe7ba('0x10')][_0xe7ba('0x11f')]=function(_0x371ed0){logger[_0xe7ba('0x29')](util['format'](_0xe7ba('0x120'),_0x371ed0[_0xe7ba('0xa1')]));if(!this[_0xe7ba('0xa2')](_0x371ed0['aws_access_key_id'])||!this['isConfigured'](_0x371ed0['aws_secret_access_key'])){return this['channel'][_0xe7ba('0xa3')]('no\x20valid\x20credentials\x20configured');}if(!this['isConfigured'](_0x371ed0[_0xe7ba('0x59')])){return this[_0xe7ba('0x35')][_0xe7ba('0xa3')]('no\x20text\x20configured');}this[_0xe7ba('0x35')][_0xe7ba('0xa3')](util['format'](_0xe7ba('0x121'),_0x371ed0['text']));var _0x5f2a2a=this[_0xe7ba('0x122')][_0xe7ba('0x6d')](this,_0x371ed0);if(_0x5f2a2a){this[_0xe7ba('0x35')][_0xe7ba('0xa3')](util['format'](_0xe7ba('0x123'),_0x5f2a2a));var _0x2d0848=this[_0xe7ba('0x35')][_0xe7ba('0xff')](_0x5f2a2a);try{fs[_0xe7ba('0x100')](_0x5f2a2a+_0xe7ba('0x101'));}catch(_0x2e3989){logger[_0xe7ba('0x27')](_0x2e3989);}return _0x2d0848;}return this[_0xe7ba('0x35')][_0xe7ba('0x27')](_0x371ed0,_0xe7ba('0x124'));};AGIVertices[_0xe7ba('0x10')]['awslex']=function(_0x4eafed){logger[_0xe7ba('0x29')](util[_0xe7ba('0x51')]('Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block',_0x4eafed['label']));if(!this[_0xe7ba('0xa2')](_0x4eafed[_0xe7ba('0x80')])||!this[_0xe7ba('0xa2')](_0x4eafed[_0xe7ba('0x81')])){return this[_0xe7ba('0x35')][_0xe7ba('0xa3')]('no\x20valid\x20credentials\x20configured');}if(!this[_0xe7ba('0xa2')](_0x4eafed[_0xe7ba('0x88')])){return this[_0xe7ba('0x35')][_0xe7ba('0xa3')](_0xe7ba('0x125'));}if(!this[_0xe7ba('0xa2')](_0x4eafed[_0xe7ba('0x59')])){return this[_0xe7ba('0x35')][_0xe7ba('0xa3')](_0xe7ba('0xa4'));}this[_0xe7ba('0x35')]['bot']=!![];this['createSquareDetailsReport'](_0x4eafed);this[_0xe7ba('0x3f')](_0x4eafed[_0xe7ba('0x59')],'in','','');this[_0xe7ba('0x35')][_0xe7ba('0xa3')](util[_0xe7ba('0x51')](_0xe7ba('0x126'),_0x4eafed[_0xe7ba('0x59')]));var _0x31e0c7=this[_0xe7ba('0x86')][_0xe7ba('0x6d')](this,_0x4eafed);if(_0x31e0c7){for(var _0x3ea4ee in _0x31e0c7){if(_0x31e0c7[_0xe7ba('0x8e')](_0x3ea4ee)&&_[_0xe7ba('0x8f')](_0x31e0c7[_0x3ea4ee])){this[_0xe7ba('0x35')]['setVariable'](util['format']('AWS_LEX_%s',_0x3ea4ee[_0xe7ba('0x67')]()),_0x31e0c7[_0x3ea4ee]);}}if(_[_0xe7ba('0x41')](_0x31e0c7[_0xe7ba('0x73')])){return this[_0xe7ba('0x35')][_0xe7ba('0xa3')](_0xe7ba('0x127'));}else{this[_0xe7ba('0x3f')](_0x31e0c7[_0xe7ba('0x73')],_0xe7ba('0xe9'),_0xe7ba('0x128'),'');return this['channel'][_0xe7ba('0xa3')](util['format'](_0xe7ba('0x129'),_0x31e0c7[_0xe7ba('0x73')]));}}return this[_0xe7ba('0x35')][_0xe7ba('0x27')](_0x4eafed,_0xe7ba('0x12a'));};AGIVertices[_0xe7ba('0x10')][_0xe7ba('0x12b')]=function(_0x3abd00){logger['info'](util['format'](_0xe7ba('0x12c'),_0x3abd00[_0xe7ba('0xa1')],_0x3abd00[_0xe7ba('0x63')]));if(!this[_0xe7ba('0xa2')](_0x3abd00[_0xe7ba('0x77')])){return this[_0xe7ba('0x35')]['noop'](_0xe7ba('0x12d'));}var _0x2a11b2=_0xe7ba('0x12e');var _0x58a074=util['format'](_0xe7ba('0x12f'),FILES_PATH,rs[_0xe7ba('0x119')](0x4));var _0x23cf9c=util[_0xe7ba('0x51')]('%s.%s',_0x58a074,_0x2a11b2);var _0x2436c0=!![];if(_0x3abd00[_0xe7ba('0x130')]===_0xe7ba('0x131')){_0x2436c0=![];}var _0x181979=this[_0xe7ba('0x35')][_0xe7ba('0x132')](_0x58a074,_0x2a11b2,_0x3abd00[_0xe7ba('0x133')],_0x3abd00[_0xe7ba('0x63')],undefined,_0x2436c0);if(_0x181979['result']!==-0x1){this[_0xe7ba('0x35')][_0xe7ba('0xa3')](util[_0xe7ba('0x51')](_0xe7ba('0x134'),_0x23cf9c));var _0x3de2a2=this[_0xe7ba('0x89')]['sync'](this,_0x3abd00,_0x23cf9c);if(_0x3de2a2){for(var _0x25dfa3 in _0x3de2a2){if(_0x3de2a2['hasOwnProperty'](_0x25dfa3)){this['channel'][_0xe7ba('0x98')](util['format']('GOOGLE_ASR_%s',_0x25dfa3[_0xe7ba('0x67')]()),_0x3de2a2[_0x25dfa3]);}}return this[_0xe7ba('0x35')][_0xe7ba('0xa3')](util[_0xe7ba('0x51')](_0xe7ba('0x135'),JSON[_0xe7ba('0x70')](_0x3de2a2)));}}return _0x181979;};AGIVertices[_0xe7ba('0x10')]['tildeasr']=function(_0x1c0507){logger[_0xe7ba('0x29')](util[_0xe7ba('0x51')](_0xe7ba('0x136'),_0x1c0507[_0xe7ba('0xa1')]));if(!this[_0xe7ba('0xa2')](_0x1c0507['appid'])){return this[_0xe7ba('0x35')]['noop'](_0xe7ba('0x137'));}if(!this['isConfigured'](_0x1c0507[_0xe7ba('0x8c')])){return this['channel']['noop']('no\x20appsecret\x20configured');}var _0x46497e=_0xe7ba('0x12e');var _0xd09aff=util[_0xe7ba('0x51')]('%s/recordings/%s',FILES_PATH,rs['generate'](0x4));var _0x4f0247=util[_0xe7ba('0x51')](_0xe7ba('0x96'),_0xd09aff,_0x46497e);var _0x5022f3=!![];if(_0x1c0507[_0xe7ba('0x130')]===_0xe7ba('0x131')){_0x5022f3=![];}var _0x32c816=this[_0xe7ba('0x35')][_0xe7ba('0x132')](_0xd09aff,_0x46497e,_0x1c0507[_0xe7ba('0x133')],_0x1c0507['timeout'],undefined,_0x5022f3);if(_0x32c816['result']!==-0x1){this[_0xe7ba('0x35')][_0xe7ba('0xa3')](util[_0xe7ba('0x51')](_0xe7ba('0x138'),_0x4f0247));var _0x4d2c86=this['tildeASR'][_0xe7ba('0x6d')](this,_0x1c0507,_0x4f0247);if(_0x4d2c86){for(var _0x227e88 in _0x4d2c86){if(_0x4d2c86[_0xe7ba('0x8e')](_0x227e88)){this[_0xe7ba('0x35')][_0xe7ba('0x98')](util[_0xe7ba('0x51')](_0xe7ba('0x139'),_0x227e88[_0xe7ba('0x67')]()),_0x4d2c86[_0x227e88]);}}return this[_0xe7ba('0x35')][_0xe7ba('0xa3')](util['format']('TildeASR\x20Result\x20%s',JSON[_0xe7ba('0x70')](_0x4d2c86)));}}return _0x32c816;};AGIVertices[_0xe7ba('0x10')][_0xe7ba('0x13a')]=function(_0x57f632){logger[_0xe7ba('0x29')](util[_0xe7ba('0x51')]('Enter\x20in\x20GOTO\x20(%s)\x20block',_0x57f632['label']));return this[_0xe7ba('0x35')][_0xe7ba('0x13b')](_0x57f632['context'],_0x57f632[_0xe7ba('0x3b')],_0x57f632[_0xe7ba('0x13c')]);};AGIVertices[_0xe7ba('0x10')][_0xe7ba('0x13d')]=function(_0x507d35){logger[_0xe7ba('0x29')](util['format'](_0xe7ba('0x13e'),_0x507d35[_0xe7ba('0xa1')]));if(!this['isConfigured'](_0x507d35[_0xe7ba('0x13f')])){return this[_0xe7ba('0x35')][_0xe7ba('0x27')](_0x507d35,_0xe7ba('0x140'));}try{var _0x724037=eval(_0x507d35['condition'])?'true':_0xe7ba('0x141');this[_0xe7ba('0x35')][_0xe7ba('0xa3')](util['format'](_0xe7ba('0x142'),_0x507d35[_0xe7ba('0x13f')],_0x724037));return{'code':0xc8,'result':_0x724037};}catch(_0x3a1e7c){return{'code':0xc8,'result':_0xe7ba('0x141')};}};AGIVertices[_0xe7ba('0x10')][_0xe7ba('0x143')]=function(_0x22af70){logger[_0xe7ba('0x29')](util[_0xe7ba('0x51')](_0xe7ba('0x144'),_0x22af70[_0xe7ba('0xa1')]));if(!this[_0xe7ba('0xa2')](_0x22af70[_0xe7ba('0x145')])){return this['channel'][_0xe7ba('0x27')](_0x22af70,_0xe7ba('0x146'));}var _0x18182b=this[_0xe7ba('0x21')][_0xe7ba('0x6d')](this,_0x22af70[_0xe7ba('0x145')]);if(!_0x18182b){return this[_0xe7ba('0x35')][_0xe7ba('0x27')](_0x22af70,'no\x20intervals\x20found');}for(var _0x5b3ac2=0x0;_0x5b3ac2<_0x18182b['length'];_0x5b3ac2+=0x1){var _0xe6c7ff=this[_0xe7ba('0x35')][_0xe7ba('0x11')](util[_0xe7ba('0x51')](_0xe7ba('0x147'),_0x18182b[_0x5b3ac2]));if(_0xe6c7ff['result']===-0x1){return _0xe6c7ff;}logger[_0xe7ba('0x29')](util[_0xe7ba('0x51')](_0xe7ba('0x148'),_0x18182b[_0x5b3ac2],_0xe6c7ff[_0xe7ba('0x9a')]));if(_0xe6c7ff[_0xe7ba('0x9a')]===_0xe7ba('0x149')){logger[_0xe7ba('0x29')](util[_0xe7ba('0x51')]('IFTIME\x20%s\x20%s',_0x18182b[_0x5b3ac2],_0xe7ba('0x149')));this['channel'][_0xe7ba('0xa3')](util['format'](_0xe7ba('0x148'),_0x18182b[_0x5b3ac2],'true'));return{'code':0xc8,'result':_0xe7ba('0x149')};}else{logger[_0xe7ba('0x29')](util['format']('IFTIME\x20%s\x20%s',_0x18182b[_0x5b3ac2],_0xe7ba('0x141')));this[_0xe7ba('0x35')][_0xe7ba('0xa3')](util[_0xe7ba('0x51')](_0xe7ba('0x148'),_0x18182b[_0x5b3ac2],_0xe7ba('0x141')));}}return{'code':0xc8,'result':_0xe7ba('0x141')};};AGIVertices[_0xe7ba('0x10')][_0xe7ba('0x14a')]=function(_0x15482c){logger[_0xe7ba('0x29')](util['format'](_0xe7ba('0x14b'),_0x15482c['label']));return this['channel'][_0xe7ba('0x14a')]();};AGIVertices['prototype']['ispeechasr']=function(_0xdb6da2){logger[_0xe7ba('0x29')](util[_0xe7ba('0x51')](_0xe7ba('0x14c'),_0xdb6da2[_0xe7ba('0xa1')]));if(!this['isConfigured'](_0xdb6da2[_0xe7ba('0x77')])){return this[_0xe7ba('0x35')][_0xe7ba('0xa3')](_0xe7ba('0x12d'));}var _0x1dafc4=_0xe7ba('0x12e');var _0x237fe2=util[_0xe7ba('0x51')]('%s/recordings/%s',FILES_PATH,rs['generate'](0x4));var _0xa6d413=util[_0xe7ba('0x51')](_0xe7ba('0x96'),_0x237fe2,_0x1dafc4);var _0x239db0=!![];if(_0xdb6da2['beep']===_0xe7ba('0x131')){_0x239db0=![];}var _0x1e4ccb=this[_0xe7ba('0x35')][_0xe7ba('0x132')](_0x237fe2,_0x1dafc4,_0xdb6da2[_0xe7ba('0x133')],_0xdb6da2[_0xe7ba('0x63')],undefined,_0x239db0);if(_0x1e4ccb[_0xe7ba('0x9c')]!==-0x1){this[_0xe7ba('0x35')]['noop'](util[_0xe7ba('0x51')](_0xe7ba('0x14d'),_0xa6d413));var _0x495834=this['ispeechASR'][_0xe7ba('0x6d')](this,_0xdb6da2,_0xa6d413);if(_0x495834){for(var _0x53d9a6 in _0x495834){if(_0x495834[_0xe7ba('0x8e')](_0x53d9a6)){this['channel'][_0xe7ba('0x98')](util[_0xe7ba('0x51')]('ISPEECH_ASR_%s',_0x53d9a6[_0xe7ba('0x67')]()),_0x495834[_0x53d9a6]);}}return this[_0xe7ba('0x35')][_0xe7ba('0xa3')](util[_0xe7ba('0x51')]('IspeechASR\x20Result\x20%s',JSON['stringify'](_0x495834)));}}return _0x1e4ccb;};AGIVertices['prototype'][_0xe7ba('0x14e')]=function(_0x1034d4){logger[_0xe7ba('0x29')](util[_0xe7ba('0x51')](_0xe7ba('0x14f'),_0x1034d4['label']));if(!this['isConfigured'](_0x1034d4[_0xe7ba('0x77')])){return this[_0xe7ba('0x35')][_0xe7ba('0xa3')]('no\x20key\x20configured');}if(!this[_0xe7ba('0xa2')](_0x1034d4[_0xe7ba('0x59')])){return this[_0xe7ba('0x35')][_0xe7ba('0xa3')](_0xe7ba('0xa4'));}this[_0xe7ba('0x35')][_0xe7ba('0xa3')](util['format'](_0xe7ba('0x150'),_0x1034d4[_0xe7ba('0x59')]));var _0x3a7a58=this[_0xe7ba('0x7b')][_0xe7ba('0x6d')](this,_0x1034d4);if(_0x3a7a58){this[_0xe7ba('0x35')][_0xe7ba('0xa3')](util['format'](_0xe7ba('0x14d'),_0x3a7a58));var _0x503805=this[_0xe7ba('0x35')][_0xe7ba('0xff')](_0x3a7a58,_0x1034d4[_0xe7ba('0x133')]);try{fs['unlink'](_0x3a7a58+_0xe7ba('0x101'));}catch(_0x496493){logger[_0xe7ba('0x27')](_0x496493);}return _0x503805;}return this[_0xe7ba('0x35')]['error'](_0x1034d4,_0xe7ba('0x151'));};AGIVertices[_0xe7ba('0x10')]['login']=function(_0x4260db){logger[_0xe7ba('0x29')](util[_0xe7ba('0x51')](_0xe7ba('0x152'),_0x4260db[_0xe7ba('0xa1')]));if(!this[_0xe7ba('0xa2')](_0x4260db[_0xe7ba('0x153')])){return this[_0xe7ba('0x35')][_0xe7ba('0x27')](_0x4260db,'no\x20find\x20by\x20configured');}logger[_0xe7ba('0x29')](util['format'](_0xe7ba('0x154'),this[_0xe7ba('0x35')][_0xe7ba('0x37')],_0x4260db[_0xe7ba('0x153')]));var _0x221e2f=this[_0xe7ba('0x53')][_0xe7ba('0x6d')](this,_0x4260db[_0xe7ba('0x153')]);if(_0x221e2f){logger[_0xe7ba('0x29')](util[_0xe7ba('0x51')](_0xe7ba('0x155'),this[_0xe7ba('0x35')]['callerid'],_0x4260db['findBy']));this[_0xe7ba('0x35')]['noop'](util[_0xe7ba('0x51')](_0xe7ba('0x155'),this['channel'][_0xe7ba('0x37')],_0x4260db[_0xe7ba('0x153')]));return{'code':0xc8,'result':_0xe7ba('0x156')};}else{logger['info'](util[_0xe7ba('0x51')](_0xe7ba('0x157'),this['channel'][_0xe7ba('0x37')],_0x4260db['findBy']));this[_0xe7ba('0x35')][_0xe7ba('0xa3')](util[_0xe7ba('0x51')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0xe7ba('0x35')][_0xe7ba('0x37')],_0x4260db[_0xe7ba('0x153')]));return{'code':0xc8,'result':'failure'};}};AGIVertices['prototype'][_0xe7ba('0x158')]=function(_0x47a405){logger[_0xe7ba('0x29')](util[_0xe7ba('0x51')]('Enter\x20in\x20LOGOUT\x20(%s)\x20block',_0x47a405[_0xe7ba('0xa1')]));if(!this[_0xe7ba('0xa2')](_0x47a405[_0xe7ba('0x153')])){return this[_0xe7ba('0x35')][_0xe7ba('0x27')](_0x47a405,_0xe7ba('0x159'));}logger[_0xe7ba('0x29')](util[_0xe7ba('0x51')](_0xe7ba('0x154'),this[_0xe7ba('0x35')]['callerid'],_0x47a405[_0xe7ba('0x153')]));var _0x339d01=this[_0xe7ba('0x4f')][_0xe7ba('0x6d')](this,_0x47a405[_0xe7ba('0x153')]);if(_0x339d01){logger[_0xe7ba('0x29')](util[_0xe7ba('0x51')](_0xe7ba('0x155'),this['channel'][_0xe7ba('0x37')],_0x47a405['findBy']));this[_0xe7ba('0x35')]['noop'](util[_0xe7ba('0x51')](_0xe7ba('0x155'),this[_0xe7ba('0x35')][_0xe7ba('0x37')],_0x47a405['findBy']));return{'code':0xc8,'result':_0xe7ba('0x156')};}else{logger[_0xe7ba('0x29')](util[_0xe7ba('0x51')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0xe7ba('0x35')]['callerid'],_0x47a405[_0xe7ba('0x153')]));this[_0xe7ba('0x35')][_0xe7ba('0xa3')](util[_0xe7ba('0x51')](_0xe7ba('0x157'),this['channel'][_0xe7ba('0x37')],_0x47a405['findBy']));return{'code':0xc8,'result':_0xe7ba('0x15a')};}};AGIVertices['prototype'][_0xe7ba('0x15b')]=function(_0x59e4ac){logger[_0xe7ba('0x29')](util[_0xe7ba('0x51')](_0xe7ba('0x15c'),_0x59e4ac['label']));if(!this[_0xe7ba('0xa2')](_0x59e4ac[_0xe7ba('0x15d')])){return this['channel'][_0xe7ba('0x27')](_0x59e4ac,'no\x20operation\x20configured');}this['channel']['noop'](util['format']('math\x20%s',_0x59e4ac[_0xe7ba('0x15d')]));var _0x2971a3=eval(_0x59e4ac[_0xe7ba('0x15d')]);if(!this[_0xe7ba('0xa2')](_0x59e4ac[_0xe7ba('0xd8')])){return this[_0xe7ba('0x35')][_0xe7ba('0xa3')](_0xe7ba('0xd7'));}var _0x226362=this[_0xe7ba('0x11')][_0xe7ba('0x6d')](this,_0x59e4ac[_0xe7ba('0xd8')]);if(!_0x226362){return this[_0xe7ba('0x35')]['error'](_0x59e4ac,'no\x20variable\x20found');}if(_[_0xe7ba('0x94')](_0x2971a3)){var _0x539c3b=this;_0x2971a3['forEach'](function(_0x4c09c5,_0x5128df){_0x539c3b[_0xe7ba('0x35')][_0xe7ba('0x98')](util[_0xe7ba('0x51')](_0xe7ba('0x15e'),_0x226362,_0x5128df),_0x4c09c5);});return this[_0xe7ba('0x35')][_0xe7ba('0xa3')](util[_0xe7ba('0x51')](_0xe7ba('0x15f'),_0x226362));}else{return this['channel']['setVariable'](_0x226362,_0x2971a3);}};AGIVertices[_0xe7ba('0x10')][_0xe7ba('0xb')]=function(_0x345192){logger[_0xe7ba('0x29')](util[_0xe7ba('0x51')](_0xe7ba('0x160'),_0x345192[_0xe7ba('0xa1')]));if(_0x345192['retry']===0x0){return this[_0xe7ba('0x9e')](_0x345192);}_0x345192['retry']-=0x1;if(!this['isConfigured'](_0x345192[_0xe7ba('0x112')])){return this['channel'][_0xe7ba('0x27')](_0x345192,_0xe7ba('0x113'));}var _0x56dfe6=this[_0xe7ba('0x1c')][_0xe7ba('0x6d')](this,_0x345192['file_id']);if(!_0x56dfe6){return this[_0xe7ba('0x35')][_0xe7ba('0x27')](_0x345192,_0xe7ba('0x161'));}var _0x53cebb=this['channel'][_0xe7ba('0x114')](_0x56dfe6,_0x345192['response'],_0x345192[_0xe7ba('0x162')]);var _0x3885a4=_0x53cebb[_0xe7ba('0x9c')];if(_0x53cebb['result']===-0x1){this[_0xe7ba('0x32')]['sync'](this,_0x345192,'-1');return _0x53cebb;}else if(_0x53cebb[_0xe7ba('0x9a')]===_0xe7ba('0x63')){_0x53cebb['result']=_0x53cebb[_0xe7ba('0x9c')][_0xe7ba('0x97')]>0x0?_0x53cebb[_0xe7ba('0x9c')]:'t';}else if(_[_0xe7ba('0x40')](_0x53cebb[_0xe7ba('0x9c')])){_0x53cebb[_0xe7ba('0x9c')]='#';_0x3885a4='#';}if(!this['isConfigured'](_0x345192[_0xe7ba('0xd8')])){this[_0xe7ba('0x35')][_0xe7ba('0xa3')](_0xe7ba('0xd7'));}else{var _0x16d028=this[_0xe7ba('0x11')][_0xe7ba('0x6d')](this,_0x345192[_0xe7ba('0xd8')]);if(!_0x16d028){return this[_0xe7ba('0x35')][_0xe7ba('0x27')](_0x345192,_0xe7ba('0x117'));}this[_0xe7ba('0x35')]['setVariable'](_0x16d028,_0x3885a4);}this[_0xe7ba('0x32')][_0xe7ba('0x6d')](this,_0x345192,_0x3885a4);return _0x53cebb;};AGIVertices[_0xe7ba('0x10')]['noop']=function(_0x2ddff1){logger['info'](util[_0xe7ba('0x51')](_0xe7ba('0x163'),_0x2ddff1[_0xe7ba('0xa1')]));return this['channel'][_0xe7ba('0xa3')](_0x2ddff1[_0xe7ba('0x164')]||_0x2ddff1[_0xe7ba('0xa1')]);};AGIVertices[_0xe7ba('0x10')]['pause']=function(_0x2ec68f){logger['info'](util[_0xe7ba('0x51')](_0xe7ba('0x165'),_0x2ec68f[_0xe7ba('0xa1')]));if(!this['isConfigured'](_0x2ec68f[_0xe7ba('0x153')])){return this[_0xe7ba('0x35')]['error'](_0x2ec68f,_0xe7ba('0x159'));}logger[_0xe7ba('0x29')](util[_0xe7ba('0x51')](_0xe7ba('0x154'),this[_0xe7ba('0x35')][_0xe7ba('0x37')],_0x2ec68f[_0xe7ba('0x153')]));var _0x3086b9=this[_0xe7ba('0x4a')][_0xe7ba('0x6d')](this,_0x2ec68f[_0xe7ba('0x166')]);var _0x737a9c=this[_0xe7ba('0x4c')]['sync'](this,_0x2ec68f[_0xe7ba('0x153')],_0x3086b9);if(_0x737a9c){logger['info'](util[_0xe7ba('0x51')](_0xe7ba('0x155'),this[_0xe7ba('0x35')]['callerid'],_0x2ec68f[_0xe7ba('0x153')]));this[_0xe7ba('0x35')][_0xe7ba('0xa3')](util[_0xe7ba('0x51')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xe7ba('0x35')][_0xe7ba('0x37')],_0x2ec68f[_0xe7ba('0x153')]));return{'code':0xc8,'result':_0xe7ba('0x156')};}else{logger['info'](util[_0xe7ba('0x51')](_0xe7ba('0x157'),this['channel'][_0xe7ba('0x37')],_0x2ec68f[_0xe7ba('0x153')]));this[_0xe7ba('0x35')][_0xe7ba('0xa3')](util[_0xe7ba('0x51')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xe7ba('0x35')]['callerid'],_0x2ec68f[_0xe7ba('0x153')]));return{'code':0xc8,'result':_0xe7ba('0x15a')};}};AGIVertices[_0xe7ba('0x10')][_0xe7ba('0x167')]=function(_0xcef966){logger[_0xe7ba('0x29')](util['format']('Enter\x20in\x20PLAYBACK\x20(%s)\x20block',_0xcef966[_0xe7ba('0xa1')]));if(!this[_0xe7ba('0xa2')](_0xcef966['file_id'])){return this[_0xe7ba('0x35')]['error'](_0xcef966,_0xe7ba('0x113'));}var _0x57b949=this['getSound'][_0xe7ba('0x6d')](this,_0xcef966[_0xe7ba('0x112')]);if(!_0x57b949){return this[_0xe7ba('0x35')][_0xe7ba('0x27')](_0xcef966,_0xe7ba('0x161'));}var _0x64851e=this[_0xe7ba('0x35')][_0xe7ba('0xa5')]('PLAYBACK',[_0x57b949,_0xcef966['opts']]);if(_0x64851e['result']===-0x1){return _0x64851e;}return this[_0xe7ba('0x35')][_0xe7ba('0xa3')](util[_0xe7ba('0x51')](_0xe7ba('0xc0'),_0xe7ba('0x168'),_0x57b949));};AGIVertices[_0xe7ba('0x10')][_0xe7ba('0x169')]=function(_0x5d43c0){logger['info'](util[_0xe7ba('0x51')](_0xe7ba('0x16a'),_0x5d43c0[_0xe7ba('0xa1')]));if(!this['isConfigured'](_0x5d43c0['queue_id'])){return this[_0xe7ba('0x35')][_0xe7ba('0x27')](_0x5d43c0,'no\x20queue\x20selected');}var _0x388e27='';var _0x340305=parseInt(_0x5d43c0[_0xe7ba('0x16b')],0xa);if(isNaN(_0x340305)){_0x388e27=_0x5d43c0[_0xe7ba('0x16b')];}else{_0x388e27=this[_0xe7ba('0x15')]['sync'](this,_0x5d43c0[_0xe7ba('0x16b')]);if(!_0x388e27){return this['channel'][_0xe7ba('0x27')](_0x5d43c0,_0xe7ba('0x16c'));}}var _0x4bb8b9='';if(this['isConfigured'](_0x5d43c0['file_id'])){var _0x5e62ba=this[_0xe7ba('0x1c')][_0xe7ba('0x6d')](this,_0x5d43c0[_0xe7ba('0x112')]);if(_0x5e62ba){_0x4bb8b9=_0x5e62ba;}}this['createSquareDetailsReport'][_0xe7ba('0x6d')](this,_0x5d43c0,_0x388e27);if(_0x5d43c0[_0xe7ba('0xe2')][_0xe7ba('0x16d')]('x')<0x0){_0x5d43c0[_0xe7ba('0xe2')]+='x';}if(_0x5d43c0[_0xe7ba('0xe2')]['indexOf']('X')<0x0){_0x5d43c0['opts']+='X';}this[_0xe7ba('0x35')][_0xe7ba('0x98')](_0xe7ba('0x16e'),_0x388e27?_0x388e27[_0xe7ba('0x16f')]():'');var _0x22d2fc=this[_0xe7ba('0x35')][_0xe7ba('0xa5')](_0xe7ba('0x170'),[_0x388e27,_0x5d43c0[_0xe7ba('0xe2')],_0x5d43c0[_0xe7ba('0x61')],_0x4bb8b9,_0x5d43c0[_0xe7ba('0x63')],_0x5d43c0['agi'],_0x5d43c0[_0xe7ba('0x171')],_0x5d43c0[_0xe7ba('0x172')],'',_0x5d43c0[_0xe7ba('0x173')]]);if(_0x22d2fc[_0xe7ba('0x9c')]===-0x1){return _0x22d2fc;}return this['channel'][_0xe7ba('0xa3')](util[_0xe7ba('0x51')](_0xe7ba('0xc0'),_0xe7ba('0x170'),_0x388e27));};AGIVertices[_0xe7ba('0x10')][_0xe7ba('0x174')]=function(_0xf3cd96){logger[_0xe7ba('0x29')](util[_0xe7ba('0x51')](_0xe7ba('0x175'),_0xf3cd96[_0xe7ba('0xa1')]));var _0x1d1b01=_0xf3cd96['recordingFormat']||_0xe7ba('0x12e');var _0x4e1989=util[_0xe7ba('0x51')](_0xe7ba('0x176'),this['channel'][_0xe7ba('0x33')],rs[_0xe7ba('0x119')](0x5));var _0x1ac67c=util[_0xe7ba('0x51')](_0xe7ba('0x177'),FILES_PATH,_0x4e1989,_0x1d1b01);var _0x428e6b=util[_0xe7ba('0x51')](_0xe7ba('0x12f'),FILES_PATH,_0x4e1989);this[_0xe7ba('0x38')][_0xe7ba('0x6d')](this,_0xf3cd96,_0x4e1989,_0x1ac67c);this['channel'][_0xe7ba('0x98')](_0xe7ba('0x178'),_0x4e1989);logger['info'](_0xe7ba('0x179'),_0x428e6b,_0x1d1b01,_0xf3cd96[_0xe7ba('0x17a')],_0xf3cd96[_0xe7ba('0x63')]);return this[_0xe7ba('0x35')]['recordFile'](_0x428e6b,_0x1d1b01,_0xf3cd96[_0xe7ba('0x17a')],_0xf3cd96[_0xe7ba('0x63')],undefined,!![]);};AGIVertices[_0xe7ba('0x10')][_0xe7ba('0x17b')]=function(_0x4d7725){logger[_0xe7ba('0x29')](util[_0xe7ba('0x51')](_0xe7ba('0x17c'),_0x4d7725[_0xe7ba('0xa1')]));if(!this['isConfigured'](_0x4d7725[_0xe7ba('0x61')])){return this[_0xe7ba('0x35')][_0xe7ba('0xa3')](_0xe7ba('0x17d'));}var _0x5b6f36=this[_0xe7ba('0x60')][_0xe7ba('0x6d')](this,_0x4d7725);logger[_0xe7ba('0x29')](util[_0xe7ba('0x51')]('Response:',util[_0xe7ba('0x17e')](_0x5b6f36,{'showHidden':![],'depth':null})));if(!this['isConfigured'](_0x4d7725['variable_id'])){return this[_0xe7ba('0x35')][_0xe7ba('0xa3')](_0xe7ba('0x17f'));}var _0x2b962f=this[_0xe7ba('0x11')][_0xe7ba('0x6d')](this,_0x4d7725['variable_id']);if(!_0x2b962f){return this[_0xe7ba('0x35')][_0xe7ba('0x27')](_0x4d7725,_0xe7ba('0x117'));}this[_0xe7ba('0x35')][_0xe7ba('0x98')](util[_0xe7ba('0x51')](_0xe7ba('0x180'),_0x2b962f),_0x5b6f36[_0xe7ba('0x72')]?_0x5b6f36['statusCode']:_0xe7ba('0x181'));this[_0xe7ba('0x35')]['setVariable'](util[_0xe7ba('0x51')](_0xe7ba('0x182'),_0x2b962f),_0x5b6f36[_0xe7ba('0x183')]?_0x5b6f36[_0xe7ba('0x183')]:'OK');if(_0x5b6f36[_0xe7ba('0x68')]){try{this[_0xe7ba('0x95')](_0x5b6f36['body'],_0x2b962f);}catch(_0x7874ee){logger[_0xe7ba('0x27')](util['format'](_0xe7ba('0x184'),_0x2b962f));}}return this[_0xe7ba('0x35')][_0xe7ba('0xa3')](util[_0xe7ba('0x51')](_0xe7ba('0x185'),_0x2b962f));};AGIVertices[_0xe7ba('0x10')][_0xe7ba('0x186')]=function(_0x2a1448){logger[_0xe7ba('0x29')](util[_0xe7ba('0x51')]('Enter\x20in\x20SAYDIGITS\x20(%s)\x20block',_0x2a1448[_0xe7ba('0xa1')]));return this[_0xe7ba('0x35')][_0xe7ba('0x187')](_0x2a1448[_0xe7ba('0x188')][_0xe7ba('0x55')](/\s+/g,''),_0x2a1448[_0xe7ba('0x17a')]);};AGIVertices['prototype'][_0xe7ba('0x189')]=function(_0x3e2b44){logger[_0xe7ba('0x29')](util[_0xe7ba('0x51')](_0xe7ba('0x18a'),_0x3e2b44[_0xe7ba('0xa1')]));return this['channel']['sayNumber'](_0x3e2b44[_0xe7ba('0x18b')][_0xe7ba('0x55')](/\s+/g,''),_0x3e2b44[_0xe7ba('0x17a')]);};AGIVertices['prototype'][_0xe7ba('0x18c')]=function(_0x26e912){logger[_0xe7ba('0x29')](util[_0xe7ba('0x51')]('Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block',_0x26e912[_0xe7ba('0xa1')]));return this[_0xe7ba('0x35')]['sayPhonetic'](_0x26e912[_0xe7ba('0x59')],_0x26e912[_0xe7ba('0x17a')]);};AGIVertices[_0xe7ba('0x10')][_0xe7ba('0x18d')]=function(_0x50357a){logger[_0xe7ba('0x29')](util[_0xe7ba('0x51')](_0xe7ba('0x18e'),_0x50357a[_0xe7ba('0xa1')]));if(!this[_0xe7ba('0xa2')](_0x50357a['account_id'])){return this[_0xe7ba('0x35')]['noop'](_0xe7ba('0x18f'));}var _0x539f01=this[_0xe7ba('0x1f')][_0xe7ba('0x6d')](this,_0x50357a['account_id']);if(!_0x539f01||!_0x539f01[_0xe7ba('0x190')]){return this[_0xe7ba('0x35')]['error'](_0x50357a,'no\x20mail\x20account\x20found');}var _0x360c34={'from':util[_0xe7ba('0x51')](_0xe7ba('0x191'),_0x539f01[_0xe7ba('0x14')],_0x539f01['email']||_0x539f01['Smtp'][_0xe7ba('0x192')]),'to':_0x50357a['to']||'','cc':_0x50357a['cc']||'','bcc':_0x50357a[_0xe7ba('0x193')]||'','subject':_0x50357a[_0xe7ba('0x194')],'html':_0x50357a['text'],'text':_0x50357a[_0xe7ba('0x59')]};if(this[_0xe7ba('0xa2')](_0x50357a['template_id'])){}logger['debug'](_0xe7ba('0x195'),JSON[_0xe7ba('0x70')](_0x360c34));this[_0xe7ba('0x32')][_0xe7ba('0x6d')](this,_0x50357a,_0x50357a[_0xe7ba('0x196')]);this['channel'][_0xe7ba('0xa3')](util[_0xe7ba('0x51')]('Trying\x20SendMail\x20with\x20account\x20%s',_0x539f01[_0xe7ba('0x14')]));this[_0xe7ba('0x197')]['sync'](this,_0x539f01[_0xe7ba('0x198')],_0x360c34);return this['channel'][_0xe7ba('0xa3')](_0xe7ba('0x199'));};AGIVertices[_0xe7ba('0x10')][_0xe7ba('0x19a')]=function(_0x2f823b){logger[_0xe7ba('0x29')](util[_0xe7ba('0x51')]('Enter\x20in\x20SENDFAX\x20(%s)\x20block',_0x2f823b['label']));return this['channel']['noop'](_0xe7ba('0x19b'));};AGIVertices['prototype'][_0xe7ba('0x19c')]=function(_0x361fc2){logger[_0xe7ba('0x29')](util[_0xe7ba('0x51')](_0xe7ba('0x19d'),_0x361fc2[_0xe7ba('0xa1')]));if(!this['isConfigured'](_0x361fc2[_0xe7ba('0x19e')])){return this['channel'][_0xe7ba('0xa3')](_0xe7ba('0x19f'));}var _0xe0d919=this[_0xe7ba('0x2f')][_0xe7ba('0x6d')](this,_0x361fc2[_0xe7ba('0x19e')]);if(!_0xe0d919){return this[_0xe7ba('0x35')][_0xe7ba('0x27')](_0x361fc2,_0xe7ba('0x1a0'));}var _0x59b774={'body':_0x361fc2[_0xe7ba('0x1a1')],'phone':_0x361fc2['to']||'','SmsAccountId':_0xe0d919['id']};logger[_0xe7ba('0xdd')]('sendSMS\x20message',JSON[_0xe7ba('0x70')](_0x59b774));this['createSquareDetailsReport'][_0xe7ba('0x6d')](this,_0x361fc2,_0x361fc2[_0xe7ba('0x19e')]);this[_0xe7ba('0x35')]['noop'](util[_0xe7ba('0x51')](_0xe7ba('0x1a2'),_0xe0d919['name']));this[_0xe7ba('0x31')]['sync'](this,_0x59b774);return this[_0xe7ba('0x35')][_0xe7ba('0xa3')](_0xe7ba('0x1a3'));};AGIVertices[_0xe7ba('0x10')][_0xe7ba('0x1a4')]=function(_0x5239aa){logger[_0xe7ba('0x29')](util['format'](_0xe7ba('0x1a5'),_0x5239aa[_0xe7ba('0xa1')]));if(!this[_0xe7ba('0xa2')](_0x5239aa[_0xe7ba('0xd8')])){return this[_0xe7ba('0x35')][_0xe7ba('0x27')](_0x5239aa,_0xe7ba('0x1a6'));}var _0x444968=this[_0xe7ba('0x11')][_0xe7ba('0x6d')](this,_0x5239aa[_0xe7ba('0xd8')]);if(!_0x444968){return this[_0xe7ba('0x35')][_0xe7ba('0x27')](_0x5239aa,_0xe7ba('0x117'));}return this[_0xe7ba('0x35')]['setVariable'](_0x444968,_0x5239aa[_0xe7ba('0x1a7')]);};AGIVertices[_0xe7ba('0x10')][_0xe7ba('0x1a8')]=function(_0x5b0fef){logger[_0xe7ba('0x29')](util[_0xe7ba('0x51')](_0xe7ba('0x1a9'),_0x5b0fef[_0xe7ba('0xa1')]));this[_0xe7ba('0x35')][_0xe7ba('0xa3')](_0xe7ba('0x1aa'));var _0x235b6e=this[_0xe7ba('0x35')][_0xe7ba('0x11')](_0xe7ba('0x1ab'));if(!_[_0xe7ba('0x40')](_0x235b6e[_0xe7ba('0x9a')])){this[_0xe7ba('0x35')]['uniqueid']=_0x235b6e[_0xe7ba('0x9a')];}if(_0x5b0fef['answer']==='yes'){this[_0xe7ba('0x35')]['noop'](_0xe7ba('0x1ac'));return this[_0xe7ba('0x35')][_0xe7ba('0xb3')]();}return this['channel'][_0xe7ba('0xa3')](_0xe7ba('0x1ad'));};AGIVertices[_0xe7ba('0x10')][_0xe7ba('0x1ae')]=function(_0x515dd4){logger['info'](util[_0xe7ba('0x51')](_0xe7ba('0x1af'),_0x515dd4[_0xe7ba('0xa1')]));if(!this[_0xe7ba('0xa2')](_0x515dd4[_0xe7ba('0x1b0')])){return this[_0xe7ba('0x35')][_0xe7ba('0x27')](_0x515dd4,'no\x20subproject\x20selected');}var _0x10cf4e=this[_0xe7ba('0x1b1')]['sync'](this,_0x515dd4[_0xe7ba('0x1b0')]);if(!this[_0xe7ba('0xa2')](_0x10cf4e)){return this['channel']['error'](_0x515dd4,util[_0xe7ba('0x51')](_0xe7ba('0x1b2'),_0x515dd4['project_id']));}if(_0x10cf4e===this[_0xe7ba('0x35')][_0xe7ba('0x36')]){return this['channel'][_0xe7ba('0x27')](_0x515dd4,_0xe7ba('0x1b3'));}this[_0xe7ba('0x32')][_0xe7ba('0x6d')](this,_0x515dd4,_0x10cf4e);var _0x251c51=this[_0xe7ba('0x35')]['exec']('AGI',util[_0xe7ba('0x51')](_0xe7ba('0x1b4'),config['agi'][_0xe7ba('0x1b5')]||_0xe7ba('0x1b6'),_0x10cf4e,this['channel'][_0xe7ba('0x36')]));if(_0x251c51[_0xe7ba('0x9c')]===-0x1){return _0x251c51;}return this[_0xe7ba('0x35')][_0xe7ba('0xa3')](util[_0xe7ba('0x51')](_0xe7ba('0xc0'),_0xe7ba('0x1b7'),_0x10cf4e));};AGIVertices['prototype']['system']=function(_0x4c55d7){logger[_0xe7ba('0x29')](util[_0xe7ba('0x51')](_0xe7ba('0x1b8'),_0x4c55d7[_0xe7ba('0xa1')]));var _0x9ccc83=this[_0xe7ba('0x1b9')][_0xe7ba('0x6d')](this,_0x4c55d7['command']);this[_0xe7ba('0x32')]['sync'](this,_0x4c55d7,_0x4c55d7['command']);if(this[_0xe7ba('0xa2')](_0x4c55d7[_0xe7ba('0xd8')])){var _0x5e071e=this[_0xe7ba('0x11')][_0xe7ba('0x6d')](this,_0x4c55d7[_0xe7ba('0xd8')]);if(_0x5e071e){this[_0xe7ba('0x35')][_0xe7ba('0x98')](_0x5e071e,_0x9ccc83);return this[_0xe7ba('0x35')]['noop'](util[_0xe7ba('0x51')](_0xe7ba('0x1ba'),_0x4c55d7[_0xe7ba('0xb1')],_0x5e071e));}}return this[_0xe7ba('0x35')]['noop'](util[_0xe7ba('0x51')](_0xe7ba('0x1bb'),_0x4c55d7['command']));};AGIVertices[_0xe7ba('0x10')][_0xe7ba('0x1bc')]=function(_0x4e988c){logger[_0xe7ba('0x29')](util[_0xe7ba('0x51')](_0xe7ba('0x1bd'),_0x4e988c['label']));_0x4e988c[_0xe7ba('0x59')]=_0x4e988c[_0xe7ba('0x59')][_0xe7ba('0x55')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xe7ba('0xa2')](_0x4e988c[_0xe7ba('0x57')])){return this['channel'][_0xe7ba('0xa3')](_0xe7ba('0x1be'));}if(!this[_0xe7ba('0xa2')](_0x4e988c[_0xe7ba('0x59')])){return this['channel'][_0xe7ba('0xa3')](_0xe7ba('0xa4'));}this[_0xe7ba('0x35')][_0xe7ba('0xa3')](util['format'](_0xe7ba('0x1bf'),_0x4e988c[_0xe7ba('0x59')]));var _0x30598a=this[_0xe7ba('0x56')][_0xe7ba('0x6d')](this,_0x4e988c);if(_0x30598a){this['channel'][_0xe7ba('0xa3')](util[_0xe7ba('0x51')](_0xe7ba('0x1c0'),_0x30598a));var _0x29551a=this['channel']['streamFile'](_0x30598a);try{fs[_0xe7ba('0x100')](_0x30598a+'.wav');}catch(_0x34f41d){logger[_0xe7ba('0x27')](_0x34f41d);}return _0x29551a;}return this[_0xe7ba('0x35')][_0xe7ba('0x27')](_0x4e988c,_0xe7ba('0x1c1'));};AGIVertices[_0xe7ba('0x10')]['tts']=function(_0x2861d0){logger['info'](util[_0xe7ba('0x51')]('Enter\x20in\x20GOOGLETTS\x20(%s)\x20block',_0x2861d0[_0xe7ba('0xa1')]));_0x2861d0['text']=_0x2861d0[_0xe7ba('0x59')]['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xe7ba('0xa2')](_0x2861d0[_0xe7ba('0x59')])){return this[_0xe7ba('0x35')][_0xe7ba('0xa3')](_0xe7ba('0xa4'));}this[_0xe7ba('0x35')]['noop'](util[_0xe7ba('0x51')]('Trying\x20Google\x20TTS\x20%s',_0x2861d0[_0xe7ba('0x59')]));var _0x24086d=this[_0xe7ba('0x5f')]['sync'](this,_0x2861d0);if(_0x24086d){this[_0xe7ba('0x35')][_0xe7ba('0xa3')](util[_0xe7ba('0x51')](_0xe7ba('0x1c2'),_0x24086d));var _0x5b829f=this['channel'][_0xe7ba('0xff')](_0x24086d);try{fs['unlink'](_0x24086d+_0xe7ba('0x101'));}catch(_0x98726b){logger[_0xe7ba('0x27')](_0x98726b);}return _0x5b829f;}return this[_0xe7ba('0x35')]['error'](_0x2861d0,_0xe7ba('0x1c3'));};AGIVertices[_0xe7ba('0x10')][_0xe7ba('0x1c4')]=function(_0x21cfa0){logger[_0xe7ba('0x29')](util[_0xe7ba('0x51')](_0xe7ba('0x1c5'),_0x21cfa0[_0xe7ba('0xa1')]));if(!this[_0xe7ba('0xa2')](_0x21cfa0['findBy'])){return this[_0xe7ba('0x35')][_0xe7ba('0x27')](_0x21cfa0,_0xe7ba('0x159'));}logger['info'](util['format']('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0xe7ba('0x35')][_0xe7ba('0x37')],_0x21cfa0[_0xe7ba('0x153')]));var _0x27fda2=this[_0xe7ba('0x4e')][_0xe7ba('0x6d')](this,_0x21cfa0[_0xe7ba('0x153')]);if(_0x27fda2){logger[_0xe7ba('0x29')](util[_0xe7ba('0x51')](_0xe7ba('0x155'),this[_0xe7ba('0x35')]['callerid'],_0x21cfa0[_0xe7ba('0x153')]));this[_0xe7ba('0x35')][_0xe7ba('0xa3')](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0xe7ba('0x35')][_0xe7ba('0x37')],_0x21cfa0[_0xe7ba('0x153')]));return{'code':0xc8,'result':_0xe7ba('0x156')};}else{logger[_0xe7ba('0x29')](util[_0xe7ba('0x51')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0xe7ba('0x35')][_0xe7ba('0x37')],_0x21cfa0[_0xe7ba('0x153')]));this[_0xe7ba('0x35')][_0xe7ba('0xa3')](util['format'](_0xe7ba('0x157'),this['channel'][_0xe7ba('0x37')],_0x21cfa0[_0xe7ba('0x153')]));return{'code':0xc8,'result':_0xe7ba('0x15a')};}};AGIVertices[_0xe7ba('0x10')][_0xe7ba('0x1c6')]=function(_0x389e7a){logger[_0xe7ba('0x29')](util[_0xe7ba('0x51')]('Enter\x20in\x20VOICEMAIL\x20(%s)\x20block',_0x389e7a[_0xe7ba('0xa1')]));var _0x47a3b0=this[_0xe7ba('0x35')]['exec'](_0xe7ba('0x1c7'),[_0x389e7a['mailbox'],_0x389e7a[_0xe7ba('0x75')]]);if(_0x47a3b0[_0xe7ba('0x9c')]===-0x1){return _0x47a3b0;}return this['channel']['noop'](util[_0xe7ba('0x51')](_0xe7ba('0xc0'),_0xe7ba('0x1c7'),_0x389e7a['mailbox']));};AGIVertices[_0xe7ba('0x10')][_0xe7ba('0x1c8')]=function(_0x1b9d74){logger['info'](util[_0xe7ba('0x51')]('Enter\x20in\x20SWITCH\x20(%s)\x20block',_0x1b9d74[_0xe7ba('0xa1')]));if(!this[_0xe7ba('0xa2')](_0x1b9d74[_0xe7ba('0xd8')])){return this['channel'][_0xe7ba('0x27')](_0x1b9d74,_0xe7ba('0x1a6'));}var _0x42e28d=this[_0xe7ba('0x11')][_0xe7ba('0x6d')](this,_0x1b9d74[_0xe7ba('0xd8')]);if(!_0x42e28d){return this['channel']['error'](_0x1b9d74,'no\x20variable\x20found');}var _0x95e3fb=this[_0xe7ba('0x35')][_0xe7ba('0x11')](_0x42e28d);return{'code':0xc8,'result':_0x95e3fb['extra']?_0x95e3fb[_0xe7ba('0x9a')]:'-'};};String[_0xe7ba('0x10')][_0xe7ba('0x1c9')]=function(_0xd8ee85,_0x4edbfc){return this[_0xe7ba('0x99')](_0xd8ee85)['join'](_0x4edbfc);};module[_0xe7ba('0x1ca')]=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index 244590b..ee83e73 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 _0xd101=['[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[ACW][syncHangup]\x20%s','syncAttendedTransfer','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','[%s][BLINDTRANSFER:UNIQUEID]','transfereruniqueid','transfererlinkedid','[ACW][syncBlindTransfer]\x20%s','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','lodash','../ami','../../../config/logger','acw','../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','agentconnect','syncAgentConnect','bind','hanguprequest','syncHangupRequest','hangup','syncHangup','agentringnoanswer','syncAgentRingNoAnswer','attendedtransfer','blindtransfer','syncBlindTransfer','custom:agentConnectPreview','milliseconds','seconds','prototype','updateAcw','lastPauseAt','timer','update','uniqueid','then','catch','finally','startAcw','interface','queue','ACW','mandatoryDisposition','mandatoryDispositionPause','name','resolve','getAgent','info','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','savePause','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','stopAcw','YYYY-MM-DD\x20HH:mm:ss','[ACW][START]\x20%s','[%s][TIMER][STOP][AGENT:%s]','saveUnpause','[%s][UPDATE][ACWTIME:%s]','[%s][UPDATE][ERRORS:%s]','error','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','stringify','[ACW][STOP]\x20%s','message','syncAgentConnectPreview','[ACW][syncAgentConnectPreview]\x20%s','isUndefined','linkedid'];(function(_0xe03984,_0x2fd729){var _0x365f67=function(_0x56d9e3){while(--_0x56d9e3){_0xe03984['push'](_0xe03984['shift']());}};_0x365f67(++_0x2fd729);}(_0xd101,0xc1));var _0x1d10=function(_0x407b20,_0x4ca4ff){_0x407b20=_0x407b20-0x0;var _0xa0b0f7=_0xd101[_0x407b20];return _0xa0b0f7;};'use strict';var _=require(_0x1d10('0x0'));var moment=require('moment');var ami=require(_0x1d10('0x1'));var logger=require(_0x1d10('0x2'))(_0x1d10('0x3'));var RpcUser=require(_0x1d10('0x4'));var RpcVoiceAgentReport=require(_0x1d10('0x5'));function Acw(_0x25b425){this[_0x1d10('0x6')]=_0x25b425[_0x1d10('0x6')];this['agents']=_0x25b425[_0x1d10('0x7')];this[_0x1d10('0x8')]=_0x25b425[_0x1d10('0x8')];this[_0x1d10('0x9')]={};ami['on'](_0x1d10('0xa'),this[_0x1d10('0xb')][_0x1d10('0xc')](this));ami['on'](_0x1d10('0xd'),this[_0x1d10('0xe')][_0x1d10('0xc')](this));ami['on'](_0x1d10('0xf'),this[_0x1d10('0x10')][_0x1d10('0xc')](this));ami['on'](_0x1d10('0x11'),this[_0x1d10('0x12')][_0x1d10('0xc')](this));ami['on'](_0x1d10('0x13'),this['syncAttendedTransfer'][_0x1d10('0xc')](this));ami['on'](_0x1d10('0x14'),this[_0x1d10('0x15')][_0x1d10('0xc')](this));ami['on'](_0x1d10('0x16'),this['syncAgentConnectPreview'][_0x1d10('0xc')](this));}function getDiff(_0x1f6f83){var _0x1a6586=moment()[_0x1d10('0x17')](0x0);var _0x2224ff=moment(_0x1f6f83)[_0x1d10('0x17')](0x0);return _0x1a6586['diff'](_0x2224ff,_0x1d10('0x18'));}Acw[_0x1d10('0x19')][_0x1d10('0x1a')]=function(_0x2ad3c0,_0x4f014a){var _0x3aedf7=this;var _0x3fe555=getDiff(_0x3aedf7[_0x1d10('0x8')][_0x2ad3c0][_0x1d10('0x1b')]);clearTimeout(_0x3aedf7[_0x1d10('0x8')][_0x2ad3c0][_0x1d10('0x1c')]);_0x3aedf7[_0x1d10('0x8')][_0x2ad3c0]['timer']=![];return RpcVoiceAgentReport[_0x1d10('0x1d')]({'acwtime':_0x3fe555},_0x3aedf7[_0x1d10('0x8')][_0x2ad3c0][_0x1d10('0x1e')],_0x2ad3c0)[_0x1d10('0x1f')](function(_0x42e1a8){logger['info']('[%s][UPDATE][ACWTIME:%s]',_0x4f014a,_0x3fe555,_0x42e1a8);})[_0x1d10('0x20')](function(_0x57ec1c){logger['error']('[%s][UPDATE][ERRORS:%s]',_0x4f014a,_0x57ec1c);})[_0x1d10('0x21')](function(){delete _0x3aedf7[_0x1d10('0x8')][_0x2ad3c0];});};Acw[_0x1d10('0x19')][_0x1d10('0x22')]=function(_0x4ce84a){try{var _0x5e5315=this;var _0x140147=this['channels'][_0x4ce84a][_0x1d10('0x23')];var _0x474321=this[_0x1d10('0x9')][_0x4ce84a][_0x1d10('0x24')];var _0x127b37=this[_0x1d10('0x6')][_0x474321];var _0x2305c8=![];var _0x3af06d=_0x1d10('0x25');if(_0x127b37[_0x1d10('0x26')]&&_0x127b37[_0x1d10('0x27')]['name']){_0x2305c8=!![];_0x3af06d=_0x127b37[_0x1d10('0x27')][_0x1d10('0x28')];}if(!_0x5e5315[_0x1d10('0x7')][_0x140147]){return Promise[_0x1d10('0x29')]();}return RpcUser[_0x1d10('0x2a')](_0x5e5315[_0x1d10('0x7')][_0x140147]['id'])[_0x1d10('0x1f')](function(_0xaa8ab6){if(!_0xaa8ab6||_0xaa8ab6['voicePause']){logger[_0x1d10('0x2b')](_0x1d10('0x2c'),_0x4ce84a,_0x140147,_0x474321);return;}logger['info'](_0x1d10('0x2d'),_0x4ce84a,_0x140147,_0x474321);var _0x52d514=_0x5e5315['channels'][_0x4ce84a][_0x1d10('0x2e')]&&_0x5e5315['channels'][_0x4ce84a][_0x1d10('0x2f')]?_0x5e5315[_0x1d10('0x9')][_0x4ce84a][_0x1d10('0x2f')]:_0x4ce84a;return RpcUser[_0x1d10('0x30')](_0x5e5315[_0x1d10('0x7')][_0x140147],_0x3af06d,_0x52d514);})[_0x1d10('0x1f')](function(_0x4b5400){if(_0x2305c8||!_0x4b5400){return;}_0x5e5315['timers'][_0x140147]={};logger[_0x1d10('0x2b')](_0x1d10('0x31'),_0x4ce84a,_0x5e5315[_0x1d10('0x6')][_0x474321][_0x1d10('0x32')],_0x140147,_0x474321);_0x5e5315[_0x1d10('0x8')][_0x140147][_0x1d10('0x1c')]=setTimeout(_0x5e5315[_0x1d10('0x33')][_0x1d10('0xc')](_0x5e5315,_0x140147),_0x5e5315[_0x1d10('0x6')][_0x474321][_0x1d10('0x32')]*0x3e8);_0x5e5315['timers'][_0x140147][_0x1d10('0x1b')]=moment()['format'](_0x1d10('0x34'));_0x5e5315[_0x1d10('0x8')][_0x140147]['uniqueid']=_0x4ce84a;_0x5e5315[_0x1d10('0x8')][_0x140147]['queue']=_0x474321;_0x5e5315[_0x1d10('0x8')][_0x140147][_0x1d10('0x1a')]=_0x5e5315[_0x1d10('0x1a')][_0x1d10('0xc')](_0x5e5315,_0x140147,_0x4ce84a);})[_0x1d10('0x20')](function(){logger['error']('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x4ce84a,_0x5e5315[_0x1d10('0x6')][_0x474321][_0x1d10('0x32')],_0x140147,_0x474321);})[_0x1d10('0x21')](function(){delete _0x5e5315['channels'][_0x4ce84a];});}catch(_0x4a9cde){logger['error'](_0x1d10('0x35'),_0x4a9cde['message']);}};Acw[_0x1d10('0x19')][_0x1d10('0x33')]=function(_0x3fad02){try{var _0x296dcf=this;if(_0x296dcf['timers'][_0x3fad02]){_0x296dcf['timers'][_0x3fad02][_0x1d10('0x1c')]=![];var _0x13049a=_0x296dcf[_0x1d10('0x8')][_0x3fad02][_0x1d10('0x1e')];var _0x549e83=_0x296dcf[_0x1d10('0x8')][_0x3fad02]['queue'];var _0x336088=_0x296dcf[_0x1d10('0x6')][_0x549e83][_0x1d10('0x32')];logger[_0x1d10('0x2b')](_0x1d10('0x36'),_0x13049a,_0x3fad02);RpcUser[_0x1d10('0x37')](this[_0x1d10('0x7')][_0x3fad02]);RpcVoiceAgentReport[_0x1d10('0x1d')]({'acwtime':_0x336088,'agentacw':!![]},_0x13049a,_0x3fad02)[_0x1d10('0x1f')](function(_0x2d9acc){logger[_0x1d10('0x2b')](_0x1d10('0x38'),_0x13049a,_0x336088,_0x2d9acc);})[_0x1d10('0x20')](function(_0x5db620){logger['error'](_0x1d10('0x39'),_0x13049a,_0x5db620);});}else{logger[_0x1d10('0x3a')](_0x1d10('0x3b'),_0x3fad02);if(_0x296dcf[_0x1d10('0x8')]){logger[_0x1d10('0x2b')](_0x1d10('0x3c'),JSON[_0x1d10('0x3d')](_0x296dcf['timers']));}}}catch(_0x1a67e9){logger[_0x1d10('0x3a')](_0x1d10('0x3e'),_0x1a67e9['message']);}};Acw[_0x1d10('0x19')][_0x1d10('0xb')]=function(_0x2ee987){try{if(this['voiceQueues'][_0x2ee987['queue']]&&(this[_0x1d10('0x6')][_0x2ee987[_0x1d10('0x24')]][_0x1d10('0x3')]||this[_0x1d10('0x6')][_0x2ee987[_0x1d10('0x24')]][_0x1d10('0x26')])){if(this[_0x1d10('0x7')][_0x2ee987['interface']]){this[_0x1d10('0x9')][_0x2ee987[_0x1d10('0x1e')]]={'queue':_0x2ee987['queue'],'interface':_0x2ee987[_0x1d10('0x23')],'destlinkedid':_0x2ee987['destlinkedid']};}}}catch(_0x3d1563){logger['error']('[ACW][syncAgentConnect]\x20%s',_0x3d1563[_0x1d10('0x3f')]);}};Acw[_0x1d10('0x19')][_0x1d10('0x40')]=function(_0x46d508){try{if(this[_0x1d10('0x6')][_0x46d508[_0x1d10('0x24')]]&&(this[_0x1d10('0x6')][_0x46d508[_0x1d10('0x24')]][_0x1d10('0x3')]||this['voiceQueues'][_0x46d508['queue']][_0x1d10('0x26')])){if(this[_0x1d10('0x7')][_0x46d508[_0x1d10('0x23')]]){this[_0x1d10('0x9')][_0x46d508[_0x1d10('0x1e')]]={'queue':_0x46d508[_0x1d10('0x24')],'interface':_0x46d508['interface']};}}}catch(_0x2db27f){logger[_0x1d10('0x3a')](_0x1d10('0x41'),_0x2db27f[_0x1d10('0x3f')]);}};Acw[_0x1d10('0x19')][_0x1d10('0xe')]=function(_0x8226b4){try{if(this[_0x1d10('0x9')][_0x8226b4[_0x1d10('0x1e')]]&&_[_0x1d10('0x42')](this[_0x1d10('0x9')][_0x8226b4[_0x1d10('0x1e')]][_0x1d10('0x2e')])){logger[_0x1d10('0x2b')]('[%s][HANGUP:UNIQUEID]',_0x8226b4['uniqueid']);this[_0x1d10('0x22')](_0x8226b4['uniqueid']);}else if(this['channels'][_0x8226b4[_0x1d10('0x43')]]&&_[_0x1d10('0x42')](this[_0x1d10('0x9')][_0x8226b4[_0x1d10('0x43')]][_0x1d10('0x2e')])){logger['info']('[%s][HANGUP:LINKEDID]',_0x8226b4['linkedid']);this['startAcw'](_0x8226b4[_0x1d10('0x43')]);}}catch(_0x438477){logger[_0x1d10('0x3a')](_0x1d10('0x44'),_0x438477['message']);}};Acw[_0x1d10('0x19')][_0x1d10('0x10')]=function(_0x3ee24d){try{if(this['channels'][_0x3ee24d[_0x1d10('0x1e')]]&&this['channels'][_0x3ee24d[_0x1d10('0x1e')]][_0x1d10('0x2e')]){logger[_0x1d10('0x2b')](_0x1d10('0x45'),_0x3ee24d['uniqueid']);this[_0x1d10('0x22')](_0x3ee24d[_0x1d10('0x1e')]);}else if(this[_0x1d10('0x9')][_0x3ee24d[_0x1d10('0x43')]]&&this[_0x1d10('0x9')][_0x3ee24d[_0x1d10('0x43')]]['attended']){logger[_0x1d10('0x2b')]('[%s][HANGUPATTENDEDTRANSFER:LINKEDID]',_0x3ee24d[_0x1d10('0x43')]);this['startAcw'](_0x3ee24d[_0x1d10('0x43')]);}}catch(_0x14e19){logger[_0x1d10('0x3a')](_0x1d10('0x46'),_0x14e19['message']);}};Acw[_0x1d10('0x19')][_0x1d10('0x47')]=function(_0x2c9fb0){try{if(!_[_0x1d10('0x48')](this[_0x1d10('0x9')][_0x2c9fb0[_0x1d10('0x49')]])){this[_0x1d10('0x22')](_0x2c9fb0[_0x1d10('0x49')]);if(this[_0x1d10('0x9')][_0x2c9fb0[_0x1d10('0x4a')]]){this[_0x1d10('0x9')][_0x2c9fb0['secondtransfereruniqueid']][_0x1d10('0x2e')]=!![];this['channels'][_0x2c9fb0[_0x1d10('0x4b')]]=this[_0x1d10('0x9')][_0x2c9fb0[_0x1d10('0x4a')]];delete this[_0x1d10('0x9')][_0x2c9fb0[_0x1d10('0x4a')]];}}else if(!_[_0x1d10('0x48')](this[_0x1d10('0x9')][_0x2c9fb0[_0x1d10('0x4b')]])){this[_0x1d10('0x22')](_0x2c9fb0[_0x1d10('0x4b')]);if(this[_0x1d10('0x9')][_0x2c9fb0[_0x1d10('0x4c')]]){this[_0x1d10('0x9')][_0x2c9fb0[_0x1d10('0x4c')]][_0x1d10('0x2e')]=!![];this['channels'][_0x2c9fb0[_0x1d10('0x49')]]=this[_0x1d10('0x9')][_0x2c9fb0[_0x1d10('0x4c')]];delete this['channels'][_0x2c9fb0[_0x1d10('0x4c')]];}}}catch(_0x403c2){logger[_0x1d10('0x3a')](_0x1d10('0x4d'),_0x403c2[_0x1d10('0x3f')]);}};Acw[_0x1d10('0x19')][_0x1d10('0x15')]=function(_0x72b74d){try{if(this[_0x1d10('0x9')][_0x72b74d['transfereruniqueid']]){logger[_0x1d10('0x2b')](_0x1d10('0x4e'),JSON[_0x1d10('0x3d')](_0x72b74d[_0x1d10('0x4f')]));this[_0x1d10('0x22')](_0x72b74d[_0x1d10('0x4f')]);}else if(this[_0x1d10('0x9')][_0x72b74d['transfererlinkedid']]){logger[_0x1d10('0x2b')]('[%s][BLINDTRANSFER:LINKEDID]',JSON[_0x1d10('0x3d')](_0x72b74d[_0x1d10('0x50')]));this[_0x1d10('0x22')](_0x72b74d[_0x1d10('0x50')]);}}catch(_0x3035c0){logger[_0x1d10('0x3a')](_0x1d10('0x51'),_0x3035c0['message']);}};Acw['prototype'][_0x1d10('0x12')]=function(_0x5dce9d){try{if(this[_0x1d10('0x6')][_0x5dce9d[_0x1d10('0x24')]]&&this[_0x1d10('0x6')][_0x5dce9d[_0x1d10('0x24')]]['autopause']===_0x1d10('0x52')){if(this['agents'][_0x5dce9d[_0x1d10('0x23')]]){logger[_0x1d10('0x2b')](_0x1d10('0x53'),_0x5dce9d[_0x1d10('0x1e')],_0x5dce9d['interface'],_0x5dce9d['queue']);return RpcUser['savePause'](this['agents'][_0x5dce9d[_0x1d10('0x23')]],_0x1d10('0x54'),_0x5dce9d['uniqueid']);}}}catch(_0x54b8e5){logger['error'](_0x1d10('0x55'),_0x54b8e5['message']);}};module[_0x1d10('0x56')]=Acw; \ No newline at end of file +var _0xdfcc=['diff','prototype','updateAcw','lastPauseAt','timer','update','uniqueid','then','info','[%s][UPDATE][ACWTIME:%s]','catch','error','[%s][UPDATE][ERRORS:%s]','startAcw','interface','channels','queue','ACW','mandatoryDisposition','mandatoryDispositionPause','agents','resolve','getAgent','voicePause','[%s][START][AGENT:%s][QUEUE:%s]','destlinkedid','savePause','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','YYYY-MM-DD\x20HH:mm:ss','acwTimeout','finally','[ACW][START]\x20%s','message','stopAcw','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','stringify','[ACW][STOP]\x20%s','[ACW][syncAgentConnect]\x20%s','syncHangupRequest','isUndefined','attended','linkedid','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','[ACW][syncHangup]\x20%s','syncAttendedTransfer','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','[ACW][syncBlindTransfer]\x20%s','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','lodash','moment','../ami','acw','../rpc/user','../rpc/voiceAgentReport','voiceQueues','timers','agentconnect','syncAgentConnect','bind','hanguprequest','syncHangup','agentringnoanswer','syncAgentRingNoAnswer','attendedtransfer','blindtransfer','syncBlindTransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds'];(function(_0x4d77d0,_0x2f91a0){var _0x2f4699=function(_0x4dcc6c){while(--_0x4dcc6c){_0x4d77d0['push'](_0x4d77d0['shift']());}};_0x2f4699(++_0x2f91a0);}(_0xdfcc,0x8d));var _0xcdfc=function(_0x21090b,_0x39dd3b){_0x21090b=_0x21090b-0x0;var _0x3c68d7=_0xdfcc[_0x21090b];return _0x3c68d7;};'use strict';var _=require(_0xcdfc('0x0'));var moment=require(_0xcdfc('0x1'));var ami=require(_0xcdfc('0x2'));var logger=require('../../../config/logger')(_0xcdfc('0x3'));var RpcUser=require(_0xcdfc('0x4'));var RpcVoiceAgentReport=require(_0xcdfc('0x5'));function Acw(_0x4aef49){this[_0xcdfc('0x6')]=_0x4aef49['voiceQueues'];this['agents']=_0x4aef49['agents'];this[_0xcdfc('0x7')]=_0x4aef49[_0xcdfc('0x7')];this['channels']={};ami['on'](_0xcdfc('0x8'),this[_0xcdfc('0x9')][_0xcdfc('0xa')](this));ami['on'](_0xcdfc('0xb'),this['syncHangupRequest'][_0xcdfc('0xa')](this));ami['on']('hangup',this[_0xcdfc('0xc')][_0xcdfc('0xa')](this));ami['on'](_0xcdfc('0xd'),this[_0xcdfc('0xe')][_0xcdfc('0xa')](this));ami['on'](_0xcdfc('0xf'),this['syncAttendedTransfer']['bind'](this));ami['on'](_0xcdfc('0x10'),this[_0xcdfc('0x11')]['bind'](this));ami['on'](_0xcdfc('0x12'),this[_0xcdfc('0x13')]['bind'](this));}function getDiff(_0x23ed41){var _0x29e684=moment()[_0xcdfc('0x14')](0x0);var _0x4c6e77=moment(_0x23ed41)[_0xcdfc('0x14')](0x0);return _0x29e684[_0xcdfc('0x15')](_0x4c6e77,'seconds');}Acw[_0xcdfc('0x16')][_0xcdfc('0x17')]=function(_0x1e2282,_0x5189bd){var _0x3834aa=this;var _0x1a8095=getDiff(_0x3834aa['timers'][_0x1e2282][_0xcdfc('0x18')]);clearTimeout(_0x3834aa[_0xcdfc('0x7')][_0x1e2282]['timer']);_0x3834aa[_0xcdfc('0x7')][_0x1e2282][_0xcdfc('0x19')]=![];return RpcVoiceAgentReport[_0xcdfc('0x1a')]({'acwtime':_0x1a8095},_0x3834aa['timers'][_0x1e2282][_0xcdfc('0x1b')],_0x1e2282)[_0xcdfc('0x1c')](function(_0x5ad601){logger[_0xcdfc('0x1d')](_0xcdfc('0x1e'),_0x5189bd,_0x1a8095,_0x5ad601);})[_0xcdfc('0x1f')](function(_0x179566){logger[_0xcdfc('0x20')](_0xcdfc('0x21'),_0x5189bd,_0x179566);})['finally'](function(){delete _0x3834aa[_0xcdfc('0x7')][_0x1e2282];});};Acw['prototype'][_0xcdfc('0x22')]=function(_0x23d000){try{var _0x2b7868=this;var _0x578f36=this['channels'][_0x23d000][_0xcdfc('0x23')];var _0x1949df=this[_0xcdfc('0x24')][_0x23d000][_0xcdfc('0x25')];var _0x2b9084=this[_0xcdfc('0x6')][_0x1949df];var _0x101ba0=![];var _0x3bdd7f=_0xcdfc('0x26');if(_0x2b9084[_0xcdfc('0x27')]&&_0x2b9084[_0xcdfc('0x28')]['name']){_0x101ba0=!![];_0x3bdd7f=_0x2b9084[_0xcdfc('0x28')]['name'];}if(!_0x2b7868[_0xcdfc('0x29')][_0x578f36]){return Promise[_0xcdfc('0x2a')]();}return RpcUser[_0xcdfc('0x2b')](_0x2b7868[_0xcdfc('0x29')][_0x578f36]['id'])[_0xcdfc('0x1c')](function(_0x180198){if(!_0x180198||_0x180198[_0xcdfc('0x2c')]){logger['info']('[%s][INPAUSE][AGENT:%s][QUEUE:%s]',_0x23d000,_0x578f36,_0x1949df);return;}logger[_0xcdfc('0x1d')](_0xcdfc('0x2d'),_0x23d000,_0x578f36,_0x1949df);var _0x1df906=_0x2b7868[_0xcdfc('0x24')][_0x23d000]['attended']&&_0x2b7868[_0xcdfc('0x24')][_0x23d000][_0xcdfc('0x2e')]?_0x2b7868['channels'][_0x23d000]['destlinkedid']:_0x23d000;return RpcUser[_0xcdfc('0x2f')](_0x2b7868[_0xcdfc('0x29')][_0x578f36],_0x3bdd7f,_0x1df906);})[_0xcdfc('0x1c')](function(_0x4b56c4){if(_0x101ba0||!_0x4b56c4){return;}_0x2b7868[_0xcdfc('0x7')][_0x578f36]={};logger[_0xcdfc('0x1d')](_0xcdfc('0x30'),_0x23d000,_0x2b7868[_0xcdfc('0x6')][_0x1949df]['acwTimeout'],_0x578f36,_0x1949df);_0x2b7868[_0xcdfc('0x7')][_0x578f36]['timer']=setTimeout(_0x2b7868['stopAcw'][_0xcdfc('0xa')](_0x2b7868,_0x578f36),_0x2b7868[_0xcdfc('0x6')][_0x1949df]['acwTimeout']*0x3e8);_0x2b7868['timers'][_0x578f36][_0xcdfc('0x18')]=moment()['format'](_0xcdfc('0x31'));_0x2b7868[_0xcdfc('0x7')][_0x578f36][_0xcdfc('0x1b')]=_0x23d000;_0x2b7868['timers'][_0x578f36][_0xcdfc('0x25')]=_0x1949df;_0x2b7868[_0xcdfc('0x7')][_0x578f36][_0xcdfc('0x17')]=_0x2b7868[_0xcdfc('0x17')][_0xcdfc('0xa')](_0x2b7868,_0x578f36,_0x23d000);})['catch'](function(){logger[_0xcdfc('0x20')](_0xcdfc('0x30'),_0x23d000,_0x2b7868[_0xcdfc('0x6')][_0x1949df][_0xcdfc('0x32')],_0x578f36,_0x1949df);})[_0xcdfc('0x33')](function(){delete _0x2b7868[_0xcdfc('0x24')][_0x23d000];});}catch(_0x22237e){logger[_0xcdfc('0x20')](_0xcdfc('0x34'),_0x22237e[_0xcdfc('0x35')]);}};Acw[_0xcdfc('0x16')][_0xcdfc('0x36')]=function(_0x55a2a7){try{var _0x2f1b8a=this;if(_0x2f1b8a[_0xcdfc('0x7')][_0x55a2a7]){_0x2f1b8a[_0xcdfc('0x7')][_0x55a2a7][_0xcdfc('0x19')]=![];var _0x2ad049=_0x2f1b8a['timers'][_0x55a2a7][_0xcdfc('0x1b')];var _0x233a7a=_0x2f1b8a[_0xcdfc('0x7')][_0x55a2a7][_0xcdfc('0x25')];var _0x1d6d53=_0x2f1b8a['voiceQueues'][_0x233a7a][_0xcdfc('0x32')];logger[_0xcdfc('0x1d')]('[%s][TIMER][STOP][AGENT:%s]',_0x2ad049,_0x55a2a7);RpcUser[_0xcdfc('0x2b')](this[_0xcdfc('0x29')][_0x55a2a7]['id'])[_0xcdfc('0x1c')](function(_0x3cb50d){if(_0x3cb50d['pauseType']==='ACW'){return RpcUser['saveUnpause'](_0x2f1b8a[_0xcdfc('0x29')][_0x55a2a7]);}});RpcVoiceAgentReport[_0xcdfc('0x1a')]({'acwtime':_0x1d6d53,'agentacw':!![]},_0x2ad049,_0x55a2a7)['then'](function(_0x41982f){logger[_0xcdfc('0x1d')](_0xcdfc('0x1e'),_0x2ad049,_0x1d6d53,_0x41982f);})[_0xcdfc('0x1f')](function(_0x4f772d){logger[_0xcdfc('0x20')]('[%s][UPDATE][ERRORS:%s]',_0x2ad049,_0x4f772d);});}else{logger[_0xcdfc('0x20')](_0xcdfc('0x37'),_0x55a2a7);if(_0x2f1b8a[_0xcdfc('0x7')]){logger[_0xcdfc('0x1d')]('[ACW][TIMERS]',JSON[_0xcdfc('0x38')](_0x2f1b8a[_0xcdfc('0x7')]));}}}catch(_0x4b5c2b){logger['error'](_0xcdfc('0x39'),_0x4b5c2b[_0xcdfc('0x35')]);}};Acw[_0xcdfc('0x16')]['syncAgentConnect']=function(_0x602fc6){try{if(this[_0xcdfc('0x6')][_0x602fc6[_0xcdfc('0x25')]]&&(this[_0xcdfc('0x6')][_0x602fc6[_0xcdfc('0x25')]][_0xcdfc('0x3')]||this['voiceQueues'][_0x602fc6[_0xcdfc('0x25')]]['mandatoryDisposition'])){if(this[_0xcdfc('0x29')][_0x602fc6[_0xcdfc('0x23')]]){this['channels'][_0x602fc6['uniqueid']]={'queue':_0x602fc6[_0xcdfc('0x25')],'interface':_0x602fc6[_0xcdfc('0x23')],'destlinkedid':_0x602fc6[_0xcdfc('0x2e')]};}}}catch(_0x23095e){logger[_0xcdfc('0x20')](_0xcdfc('0x3a'),_0x23095e['message']);}};Acw[_0xcdfc('0x16')][_0xcdfc('0x13')]=function(_0x1bccc9){try{if(this[_0xcdfc('0x6')][_0x1bccc9[_0xcdfc('0x25')]]&&(this[_0xcdfc('0x6')][_0x1bccc9[_0xcdfc('0x25')]][_0xcdfc('0x3')]||this[_0xcdfc('0x6')][_0x1bccc9['queue']][_0xcdfc('0x27')])){if(this[_0xcdfc('0x29')][_0x1bccc9[_0xcdfc('0x23')]]){this['channels'][_0x1bccc9['uniqueid']]={'queue':_0x1bccc9[_0xcdfc('0x25')],'interface':_0x1bccc9['interface']};}}}catch(_0x70a97c){logger[_0xcdfc('0x20')]('[ACW][syncAgentConnectPreview]\x20%s',_0x70a97c['message']);}};Acw[_0xcdfc('0x16')][_0xcdfc('0x3b')]=function(_0x3f915f){try{if(this[_0xcdfc('0x24')][_0x3f915f[_0xcdfc('0x1b')]]&&_[_0xcdfc('0x3c')](this[_0xcdfc('0x24')][_0x3f915f['uniqueid']][_0xcdfc('0x3d')])){logger[_0xcdfc('0x1d')]('[%s][HANGUP:UNIQUEID]',_0x3f915f[_0xcdfc('0x1b')]);this[_0xcdfc('0x22')](_0x3f915f[_0xcdfc('0x1b')]);}else if(this[_0xcdfc('0x24')][_0x3f915f[_0xcdfc('0x3e')]]&&_[_0xcdfc('0x3c')](this['channels'][_0x3f915f['linkedid']]['attended'])){logger[_0xcdfc('0x1d')]('[%s][HANGUP:LINKEDID]',_0x3f915f['linkedid']);this['startAcw'](_0x3f915f[_0xcdfc('0x3e')]);}}catch(_0x4c111b){logger[_0xcdfc('0x20')]('[ACW][syncHangupRequest]\x20%s',_0x4c111b[_0xcdfc('0x35')]);}};Acw[_0xcdfc('0x16')][_0xcdfc('0xc')]=function(_0x418efa){try{if(this[_0xcdfc('0x24')][_0x418efa[_0xcdfc('0x1b')]]&&this['channels'][_0x418efa[_0xcdfc('0x1b')]]['attended']){logger[_0xcdfc('0x1d')](_0xcdfc('0x3f'),_0x418efa['uniqueid']);this[_0xcdfc('0x22')](_0x418efa[_0xcdfc('0x1b')]);}else if(this[_0xcdfc('0x24')][_0x418efa['linkedid']]&&this[_0xcdfc('0x24')][_0x418efa[_0xcdfc('0x3e')]][_0xcdfc('0x3d')]){logger['info'](_0xcdfc('0x40'),_0x418efa[_0xcdfc('0x3e')]);this['startAcw'](_0x418efa[_0xcdfc('0x3e')]);}}catch(_0x488cea){logger[_0xcdfc('0x20')](_0xcdfc('0x41'),_0x488cea['message']);}};Acw[_0xcdfc('0x16')][_0xcdfc('0x42')]=function(_0x32be7f){try{if(!_[_0xcdfc('0x43')](this[_0xcdfc('0x24')][_0x32be7f['transfereeuniqueid']])){this['startAcw'](_0x32be7f[_0xcdfc('0x44')]);if(this[_0xcdfc('0x24')][_0x32be7f[_0xcdfc('0x45')]]){this[_0xcdfc('0x24')][_0x32be7f['secondtransfereruniqueid']][_0xcdfc('0x3d')]=!![];this[_0xcdfc('0x24')][_0x32be7f[_0xcdfc('0x46')]]=this['channels'][_0x32be7f[_0xcdfc('0x45')]];delete this[_0xcdfc('0x24')][_0x32be7f['secondtransfereruniqueid']];}}else if(!_[_0xcdfc('0x43')](this[_0xcdfc('0x24')][_0x32be7f['transfertargetuniqueid']])){this['startAcw'](_0x32be7f[_0xcdfc('0x46')]);if(this['channels'][_0x32be7f[_0xcdfc('0x47')]]){this['channels'][_0x32be7f['origtransfereruniqueid']][_0xcdfc('0x3d')]=!![];this[_0xcdfc('0x24')][_0x32be7f[_0xcdfc('0x44')]]=this[_0xcdfc('0x24')][_0x32be7f[_0xcdfc('0x47')]];delete this[_0xcdfc('0x24')][_0x32be7f['origtransfereruniqueid']];}}}catch(_0xa06333){logger[_0xcdfc('0x20')]('[ACW][syncAttendedTransfer]\x20%s',_0xa06333[_0xcdfc('0x35')]);}};Acw[_0xcdfc('0x16')]['syncBlindTransfer']=function(_0x1a9928){try{if(this[_0xcdfc('0x24')][_0x1a9928[_0xcdfc('0x48')]]){logger[_0xcdfc('0x1d')](_0xcdfc('0x49'),JSON['stringify'](_0x1a9928['transfereruniqueid']));this[_0xcdfc('0x22')](_0x1a9928[_0xcdfc('0x48')]);}else if(this[_0xcdfc('0x24')][_0x1a9928[_0xcdfc('0x4a')]]){logger[_0xcdfc('0x1d')](_0xcdfc('0x4b'),JSON[_0xcdfc('0x38')](_0x1a9928['transfererlinkedid']));this[_0xcdfc('0x22')](_0x1a9928['transfererlinkedid']);}}catch(_0x368f44){logger[_0xcdfc('0x20')](_0xcdfc('0x4c'),_0x368f44['message']);}};Acw[_0xcdfc('0x16')][_0xcdfc('0xe')]=function(_0x19bfd9){try{if(this[_0xcdfc('0x6')][_0x19bfd9[_0xcdfc('0x25')]]&&this['voiceQueues'][_0x19bfd9['queue']]['autopause']==='all'){if(this[_0xcdfc('0x29')][_0x19bfd9[_0xcdfc('0x23')]]){logger[_0xcdfc('0x1d')](_0xcdfc('0x4d'),_0x19bfd9[_0xcdfc('0x1b')],_0x19bfd9[_0xcdfc('0x23')],_0x19bfd9[_0xcdfc('0x25')]);return RpcUser[_0xcdfc('0x2f')](this[_0xcdfc('0x29')][_0x19bfd9[_0xcdfc('0x23')]],_0xcdfc('0x4e'),_0x19bfd9[_0xcdfc('0x1b')]);}}}catch(_0x1850f6){logger[_0xcdfc('0x20')](_0xcdfc('0x4f'),_0x1850f6[_0xcdfc('0x35')]);}};module[_0xcdfc('0x50')]=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index 640e4d1..9700f59 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 _0xb099=['Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','catch','[ami.js][fullybooted]','exports','asterisk-manager','bluebird','util','../../config/logger','ami','../../config/environment','asterisk','port','username','password','keepConnected','Action','promisify','action','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','inspect','error','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','actionSipShowRegistry','sipshowregistry','actionDeviceStateList','actionSipPeerStatus','sippeerstatus','actionQueueSummary','queuesummary','actionCoreShowChannels','coreshowchannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','close','connect','shutdown'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xb099,0xda));var _0x9b09=function(_0x37018d,_0x95e1f8){_0x37018d=_0x37018d-0x0;var _0x1c72b8=_0xb099[_0x37018d];return _0x1c72b8;};'use strict';var Manager=require(_0x9b09('0x0'));var BPromise=require(_0x9b09('0x1'));var util=require(_0x9b09('0x2'));var logger=require(_0x9b09('0x3'))(_0x9b09('0x4'));var config=require(_0x9b09('0x5'));var ami=new Manager(config[_0x9b09('0x6')][_0x9b09('0x7')],config['asterisk']['ip'],config[_0x9b09('0x6')][_0x9b09('0x8')],config[_0x9b09('0x6')][_0x9b09('0x9')],!![]);ami[_0x9b09('0xa')]();ami[_0x9b09('0xb')]=BPromise[_0x9b09('0xc')](ami[_0x9b09('0xd')]);function error(_0x5c9e2e){logger['error'](util[_0x9b09('0xe')](_0x9b09('0xf'),config['asterisk'][_0x9b09('0x8')],config[_0x9b09('0x6')]['ip'],config['asterisk'][_0x9b09('0x7')],util[_0x9b09('0x10')](_0x5c9e2e,![],null)));}function close(){logger[_0x9b09('0x11')](util[_0x9b09('0xe')](_0x9b09('0x12'),config[_0x9b09('0x6')][_0x9b09('0x8')],config[_0x9b09('0x6')]['ip'],config[_0x9b09('0x6')][_0x9b09('0x7')]));}ami[_0x9b09('0x13')]=function(){return function(){return ami[_0x9b09('0xb')]({'action':_0x9b09('0x14')});};};ami[_0x9b09('0x15')]=function(){return function(){return ami[_0x9b09('0xb')]({'action':'devicestatelist'});};};ami[_0x9b09('0x16')]=function(){return function(){return ami[_0x9b09('0xb')]({'action':_0x9b09('0x17')});};};ami[_0x9b09('0x18')]=function(){return function(){return ami[_0x9b09('0xb')]({'action':_0x9b09('0x19')});};};ami[_0x9b09('0x1a')]=function(){return function(){return ami[_0x9b09('0xb')]({'action':_0x9b09('0x1b')});};};function connect(){logger[_0x9b09('0x1c')](util[_0x9b09('0xe')](_0x9b09('0x1d'),config[_0x9b09('0x6')][_0x9b09('0x8')],config[_0x9b09('0x6')]['ip'],config[_0x9b09('0x6')]['port']));ami[_0x9b09('0x1e')]('error',error);ami['once'](_0x9b09('0x1f'),close);}ami['on'](_0x9b09('0x20'),connect);ami['on'](_0x9b09('0x21'),function(_0x2b1065){logger[_0x9b09('0x1c')](util[_0x9b09('0xe')](_0x9b09('0x22'),config[_0x9b09('0x6')][_0x9b09('0x8')],config[_0x9b09('0x6')]['ip'],config[_0x9b09('0x6')][_0x9b09('0x7')],util['inspect'](_0x2b1065,![],null)));});ami['on'](_0x9b09('0x23'),function(){logger['info'](util[_0x9b09('0xe')](_0x9b09('0x24'),config['asterisk'][_0x9b09('0x8')],config[_0x9b09('0x6')]['ip'],config[_0x9b09('0x6')][_0x9b09('0x7')]));return Promise[_0x9b09('0x25')]()['then'](ami[_0x9b09('0x13')]())[_0x9b09('0x26')](ami[_0x9b09('0x15')]())[_0x9b09('0x26')](ami[_0x9b09('0x16')]())[_0x9b09('0x26')](ami[_0x9b09('0x18')]())[_0x9b09('0x26')](ami[_0x9b09('0x1a')]())[_0x9b09('0x27')](function(_0x2f3858){logger[_0x9b09('0x11')](_0x9b09('0x28'),util[_0x9b09('0x10')](_0x2f3858,{'showHidden':![],'depth':null}));});});ami[_0x9b09('0x1e')]('error',error);ami[_0x9b09('0x1e')](_0x9b09('0x1f'),close);module[_0x9b09('0x29')]=ami; \ No newline at end of file +var _0xbf1f=['bluebird','util','../../config/logger','ami','asterisk','username','password','keepConnected','Action','promisify','action','error','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','port','inspect','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','actionSipShowRegistry','actionDeviceStateList','devicestatelist','actionSipPeerStatus','sippeerstatus','actionQueueSummary','queuesummary','actionCoreShowChannels','coreshowchannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','shutdown','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','fullybooted','resolve','then','catch','[ami.js][fullybooted]','close','asterisk-manager'];(function(_0x327950,_0x1d741f){var _0x225835=function(_0x2b0cff){while(--_0x2b0cff){_0x327950['push'](_0x327950['shift']());}};_0x225835(++_0x1d741f);}(_0xbf1f,0x1ed));var _0xfbf1=function(_0x3f993e,_0x2d5757){_0x3f993e=_0x3f993e-0x0;var _0x39c135=_0xbf1f[_0x3f993e];return _0x39c135;};'use strict';var Manager=require(_0xfbf1('0x0'));var BPromise=require(_0xfbf1('0x1'));var util=require(_0xfbf1('0x2'));var logger=require(_0xfbf1('0x3'))(_0xfbf1('0x4'));var config=require('../../config/environment');var ami=new Manager(config[_0xfbf1('0x5')]['port'],config[_0xfbf1('0x5')]['ip'],config['asterisk'][_0xfbf1('0x6')],config[_0xfbf1('0x5')][_0xfbf1('0x7')],!![]);ami[_0xfbf1('0x8')]();ami[_0xfbf1('0x9')]=BPromise[_0xfbf1('0xa')](ami[_0xfbf1('0xb')]);function error(_0x4a41bc){logger[_0xfbf1('0xc')](util[_0xfbf1('0xd')](_0xfbf1('0xe'),config[_0xfbf1('0x5')][_0xfbf1('0x6')],config[_0xfbf1('0x5')]['ip'],config[_0xfbf1('0x5')][_0xfbf1('0xf')],util[_0xfbf1('0x10')](_0x4a41bc,![],null)));}function close(){logger['error'](util[_0xfbf1('0xd')](_0xfbf1('0x11'),config[_0xfbf1('0x5')][_0xfbf1('0x6')],config[_0xfbf1('0x5')]['ip'],config['asterisk'][_0xfbf1('0xf')]));}ami[_0xfbf1('0x12')]=function(){return function(){return ami['Action']({'action':'sipshowregistry'});};};ami[_0xfbf1('0x13')]=function(){return function(){return ami[_0xfbf1('0x9')]({'action':_0xfbf1('0x14')});};};ami[_0xfbf1('0x15')]=function(){return function(){return ami['Action']({'action':_0xfbf1('0x16')});};};ami[_0xfbf1('0x17')]=function(){return function(){return ami[_0xfbf1('0x9')]({'action':_0xfbf1('0x18')});};};ami[_0xfbf1('0x19')]=function(){return function(){return ami[_0xfbf1('0x9')]({'action':_0xfbf1('0x1a')});};};function connect(){logger[_0xfbf1('0x1b')](util[_0xfbf1('0xd')](_0xfbf1('0x1c'),config[_0xfbf1('0x5')][_0xfbf1('0x6')],config[_0xfbf1('0x5')]['ip'],config[_0xfbf1('0x5')][_0xfbf1('0xf')]));ami[_0xfbf1('0x1d')]('error',error);ami[_0xfbf1('0x1d')]('close',close);}ami['on']('connect',connect);ami['on'](_0xfbf1('0x1e'),function(_0x136c62){logger[_0xfbf1('0x1b')](util[_0xfbf1('0xd')](_0xfbf1('0x1f'),config[_0xfbf1('0x5')][_0xfbf1('0x6')],config[_0xfbf1('0x5')]['ip'],config[_0xfbf1('0x5')][_0xfbf1('0xf')],util[_0xfbf1('0x10')](_0x136c62,![],null)));});ami['on'](_0xfbf1('0x20'),function(){logger[_0xfbf1('0x1b')](util['format']('Fullybooted\x20\x22%s\x22\x20to\x20%s:%s',config[_0xfbf1('0x5')]['username'],config[_0xfbf1('0x5')]['ip'],config[_0xfbf1('0x5')][_0xfbf1('0xf')]));return Promise[_0xfbf1('0x21')]()[_0xfbf1('0x22')](ami[_0xfbf1('0x12')]())[_0xfbf1('0x22')](ami[_0xfbf1('0x13')]())[_0xfbf1('0x22')](ami[_0xfbf1('0x15')]())[_0xfbf1('0x22')](ami['actionQueueSummary']())[_0xfbf1('0x22')](ami[_0xfbf1('0x19')]())[_0xfbf1('0x23')](function(_0x3c16e5){logger[_0xfbf1('0xc')](_0xfbf1('0x24'),util['inspect'](_0x3c16e5,{'showHidden':![],'depth':null}));});});ami[_0xfbf1('0x1d')](_0xfbf1('0xc'),error);ami[_0xfbf1('0x1d')](_0xfbf1('0x25'),close);module['exports']=ami; \ No newline at end of file diff --git a/server/services/ami/client.js b/server/services/ami/client.js index c592806..6c5e827 100644 --- a/server/services/ami/client.js +++ b/server/services/ami/client.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb7e7=['exports','jayson/promise','../../config/logger','client','Request','debug','rpc','error','memberReport','message','result','catch'];(function(_0x715d76,_0x402d60){var _0x48fe88=function(_0x4dd0ea){while(--_0x4dd0ea){_0x715d76['push'](_0x715d76['shift']());}};_0x48fe88(++_0x402d60);}(_0xb7e7,0x121));var _0x7b7e=function(_0x243b2f,_0x30aa15){_0x243b2f=_0x243b2f-0x0;var _0xcb3c2d=_0xb7e7[_0x243b2f];return _0xcb3c2d;};'use strict';var jayson=require(_0x7b7e('0x0'));var BPromise=require('bluebird');var logger=require(_0x7b7e('0x1'))('ami');var client=jayson[_0x7b7e('0x2')]['http']({'port':0x2329});client[_0x7b7e('0x3')]=function(_0x556d68,_0x31d0ed){return new BPromise(function(_0x118577,_0x1d9384){return client['request'](_0x556d68,_0x31d0ed)['then'](function(_0x333fa4){logger[_0x7b7e('0x4')](_0x7b7e('0x5'),'memberReport',_0x556d68,_0x31d0ed,_0x333fa4);if(_0x333fa4[_0x7b7e('0x6')]){logger[_0x7b7e('0x6')](_0x7b7e('0x5'),_0x7b7e('0x7'),_0x556d68,_0x333fa4[_0x7b7e('0x6')][_0x7b7e('0x8')],_0x31d0ed);return _0x1d9384(_0x333fa4[_0x7b7e('0x6')]['message']);}else{return _0x118577(_0x333fa4[_0x7b7e('0x9')]);}})[_0x7b7e('0xa')](function(_0x10a666){logger[_0x7b7e('0x6')](_0x7b7e('0x5'),_0x7b7e('0x7'),_0x556d68,_0x10a666,_0x31d0ed);return _0x1d9384(_0x10a666);});});};module[_0x7b7e('0xb')]=client; \ No newline at end of file +var _0xe706=['result','catch','exports','jayson/promise','bluebird','../../config/logger','client','http','Request','request','then','debug','rpc','memberReport','error','message'];(function(_0x49c68e,_0x1c1673){var _0x33032b=function(_0x42ac31){while(--_0x42ac31){_0x49c68e['push'](_0x49c68e['shift']());}};_0x33032b(++_0x1c1673);}(_0xe706,0xa3));var _0x6e70=function(_0x3ae24a,_0x7d32f9){_0x3ae24a=_0x3ae24a-0x0;var _0x18690f=_0xe706[_0x3ae24a];return _0x18690f;};'use strict';var jayson=require(_0x6e70('0x0'));var BPromise=require(_0x6e70('0x1'));var logger=require(_0x6e70('0x2'))('ami');var client=jayson[_0x6e70('0x3')][_0x6e70('0x4')]({'port':0x2329});client[_0x6e70('0x5')]=function(_0x7dfbc3,_0x142c27){return new BPromise(function(_0x2164a4,_0x376a8d){return client[_0x6e70('0x6')](_0x7dfbc3,_0x142c27)[_0x6e70('0x7')](function(_0x4381d1){logger[_0x6e70('0x8')](_0x6e70('0x9'),_0x6e70('0xa'),_0x7dfbc3,_0x142c27,_0x4381d1);if(_0x4381d1[_0x6e70('0xb')]){logger[_0x6e70('0xb')](_0x6e70('0x9'),_0x6e70('0xa'),_0x7dfbc3,_0x4381d1[_0x6e70('0xb')][_0x6e70('0xc')],_0x142c27);return _0x376a8d(_0x4381d1[_0x6e70('0xb')][_0x6e70('0xc')]);}else{return _0x2164a4(_0x4381d1[_0x6e70('0xd')]);}})[_0x6e70('0xe')](function(_0x4600f9){logger['error']('rpc',_0x6e70('0xa'),_0x7dfbc3,_0x4600f9,_0x142c27);return _0x376a8d(_0x4600f9);});});};module[_0x6e70('0xf')]=client; \ No newline at end of file diff --git a/server/services/ami/dialer/index.js b/server/services/ami/dialer/index.js index b39f391..809d15e 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 _0x9a1a=['voice_queue:save','isEmpty','info','-----\x20Stats\x20Predictive\x20---','predictiveIntervalTotalCalls','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAnsweredCalls','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsTimeout','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','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','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','---------\x20ErlangB\x20---------','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangAbandonmentRate','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangBusyFactor','merge','getSeconds','startProgressive\x20value\x20cleared','startPredictive','startPredictive\x20value\x20cleared','handlePredictive','handlePredictive\x20interval\x20cleared','error','stack','checkContactLowerLimitOriginate','temp','contactsRescheduled','message','CAMPAIGN_STATUS','CONTACTS_RESCHEDULED','[getContactDialer2][ReScheduled]','contacts','[getContactDialer2][Empty]','state','endtime','starttime','queueStatusComplete','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','stringify','Interval','\x20INTERVAL_IS_NULL','NULL_INTERVAL','isIVRCampaignActive','\x20NOT\x20Active','isIVRCampaign','campaign:ivr:%s','sendMessageOneNotActive','originated','INACTIVE','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','is\x20not\x20active','DISACTIVED','is\x20disactive','Error','isTrunkReachable','active','reachable','status','unmonitored','checkIsTrunkReachable','TrunkBackup','\x20trunk\x20is\x20not\x20reachable','ifTimeIvr','checkIfTimeIntervals','Intervals','ifTime','\x20Intervals\x20is\x20null\x20','\x20Intervals\x20is\x20empty\x20','timezones','UNKNOWN_TIMEZONE','Failure','\x20Timezone\x20unknow\x20','Action','command','content','indexOf','true','push','iftime\x20%s,%s','catch','all','some','OVERTIME_INTERVAL','Global:\x20','Timezone:\x20','resetActiveCalls','undefined','resolve','checkIfTime','dialTimezone','launchHandleIvr','[syncCampaigns]','dialMethod','progressive','handlePower','power','dialPowerLevel','booked','Queue','method\x20not\x20recognized','dialGlobalInterval','Dialer::ifTime()','Voice\x20Queue\x20%s\x20$s','intervalIftime','[ifTime][promiseAll]','silly','Dialer::ifTime()\x20errResponse\x20NOT\x20NULL:','isGlobal','AMI\x20IfTime','[ifTime][Action]','uniqueid','ivr','updateOriginated','queue','answertime','YYYY-MM-DD\x20HH:mm:ss','outboundAnswerCallsDay','reason','agent','agiafterat','dialQueueProject2','dialAgiAfterHangupAgent','createHistory','moveContactManagedDialer','[syncAgentComplete]','droptime','responsetime','dialQueueTimeout','outboundDropCallsDayTimeout','statedesc','Drop','dropreason','countdropretry','countglobal','verifyAdditionalPhones','voiceQueue','additional','dialDropMaxRetry','queueCallerAbandonCreateState','rescheduleContact','add','dialDropRetryFrequency','minutes','ContactId','ListId','VoiceQueueId','CampaignId','[rescheduleContact][Drop]','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','swapAdditionalPhones','outboundDropCallsDayCallersExit','Abandoned','CALLEREXIT','countabandonedretry','dialAbandonedRetryFrequency','callAdditionalPhoneAfterMin','dialAbandonedMaxRetry','[rescheduleContact][Abandoned]','[syncAgentComplete][createHistory][11]','channel','actionid','rrmemory','isNil','locked','stateinterface','idHopper','paused','strategy','roundrobin','preview','run','[Catch][Preview][syncQueueStatusComplete]','[unlock][syncQueueStatusComplete]','_rr','length','unlockRR','[booked][RR]','pick','[booked][RR][finaly]','Agent:\x20','contactAgent-idHopper:\x20','[booked][unlock]','[booked][unlock2]','[booked][unlock3]','getQueue','response','Success','callProgressDetecting','syncVarSet','variable','amdstatus','exten','xcally-motion-dialer','dialAMDActive','HANGUP','outboundAnswerAgiCallsDay','HangupInAMD','membername','AMD','buildObj','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','Machine','countmachineretry','amd','custom:amd','[syncAgentComplete][createHistory][0]','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countagentrejectretry','dialGlobalMaxRetry','stateGlobal','reason19\x20machine....','dialMachineMaxRetry','reason\x2019\x20machine....','dialMachineRetryFrequency','value','saveInDb','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','MACHINE','[rescheduleContact][Machine]','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','[syncHangupIvr]','dialQueueProject','AGI','outboundUnknownCallsDay','running','isPreviewCampaign','statusMessage','getQueueCampaignStatusMessage','available','inUse','pTalking','ACTIVE','compareToOutboundQueue','queueSummaryCountersUpdated','throttle','filter','dialPreviewRecallmeReminder','online','handlePreviewRecallNotifications','map','Agent','user:dialPreviewRecallReminder','checkPreviewRecallReminder','clearZombieChannels','[uniqueid]','[actions]','No\x20such\x20channel','[Dialer][checkChannel]','[Dialer][checkChannel][ivr]','getVoiceQueueRtPauses','emptyContact','notFound','UserId','[emptyContact][createHistory]','[emptyContact]','[syncAgentComplete][createHistory]','user:%s','handleIvr','actionOriginate','object','originate','voiceQueue\x20is\x20undefine','phone','contact\x20is\x20undefine','getCaller','\x22agi://%s/square,%s\x22','NONE','dialQueueOptions','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','isOutboundQueue','XMD-CAMPAIGNID','setXMDContactVariables','assign','Trunk','getCallerId','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','callerid','dialOriginateCallerIdName','XMD-ORIGINATECALLERIDNAME','originatecalleridname','extractCalleridName','variables','SIP/%s/%s%s','dialPrefix','trim','dialCutDigit','substring','from-sip','outboundOriginateFailureCallsDay','[originateError]:\x20%s','OriginateError','[originate][error]','originate\x20action\x20Error','checkRetriveMax','countbusyretry','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','[rescheduleContact][NoSuchNumber]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','entity\x20is\x20undefine','[callProgressDetecting]','outboundNoSuchCallsDay','NoSuchNumber','custom:agentnosuchnumber','nosuchnumber','dialNoSuchNumberRetryFrequency','createStateFinal','outboundNoAnswerCallsDay','NoAnswer','buildNoAnswerEventPayload','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','outboundBusyCallsDay','Busy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','outboundCongestionCallsDay','Congestion','dialCongestionRetryFrequency','custom:agentcongestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','outboundAbandonedCallsDay','outboundRejectCallsDay','AgentReject','custom:agentreject','agentreject','reason\x2020\x20agentreject','Global','[moveContactManagedDialer][0]','dialPredictiveOptimizationPercentage','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','round','predictiveIntervalMinThreshold','floor','erlangCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','check\x20predictive\x20is\x20not\x20undefine','[startMethodPredictive][StartProgressive]','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','dropRate','predictiveIntervalErlangCallsDroppedCalls','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','started\x20in\x20predictive\x20at','avgHandleTime','startMethodPredictive','dialPredictiveInterval','recalculate\x20predictive\x20at','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20more\x20than\x20threshold\x20(','getDataPredictive','talking','abandonmentRate','agentBusyFactor','busyFactor','[getDataPredictive]','check\x20failure','getDataPredictiveOld','loggedIn','outboundQueuePauses','predictiveIntervalPauses','[CatchErlangB]','erlangCallToSecond','one\x20call\x20every:','fail\x20to\x20scheduled\x20calls','checkContactBlack','recallme','[booked][checkContactBlack]','queueStatusComplete:\x20','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','Queue:\x20','scheduledat','dialRecallMeTimeout','unlockContact','outboundReCallsDay','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','QUEUE_RECALL','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALL_TIMEOUT','[Originate][HistoryRecallClose][historyCatch]','outboundBlacklistCallsDay','BLACKLIST','[Originate][historyBlacklist]','inBlackList','limitCalls','maxNumberOriginate','getContactDialerIvr','checkContactEmpty','NO_AVAILABLE_CONTACTS','[getContactCampaign2][Empty]','RUNNING','ivrTotalCallsDays','Contact','[actionOriginate]\x20','checkIsBlackListIvr','loggerHandler','dialLimitQueue','not_inuse','getContactDialer','countReScheduled','checkIsBlackList','[getContactDialer2]','tryOriginatePredictive','[handlePredictive][limitChannel]','[countReScheduled]\x20','[getContactDialerPredictive]','--------\x20Drop\x20Rate\x20--------','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','Ts\x20=\x20','p\x20=\x20','Amax\x20=\x20','erlangb','----\x20Agent\x20Busy\x20Factor\x20----','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','Umin\x20=\x20','exports','util','lodash','uuid','moment','ioredis','./utils/hopper','../preview/util/util','../../../config/environment/','../../../config/logger','dialer','predictive','predictiveCalls','syncQueueSummary','../ami','redis','defaults','socket.io-emitter','../rpc/voiceQueueRt','../rpc/setting','../rpc/interval','./models/history','./models/final','./models/queueCallerAbandon','env','XCALLY_IP_AGI','127.0.0.1','prototype','enqueue','tail','finally','sequence','voiceQueues','campaigns','agents','trunks','channels','actions','contactsId','uniqueId','startProgressive','ivrOriginated','queueBooked','queueBookedRR','queuesSummary','agentconnect','syncAgentConnect','bind','queuecallerabandon','syncQueueCallerAbandon','syncOriginateResponse','agentcomplete','syncAgentComplete','custom:queuesummary','custom:queuesummarycomplete','syncQueueSummaryComplete','hangup','syncHangup','syncNewExten','varset','queuemember','syncQueueMember','queuestatuscomplete','syncQueueStatusComplete','loopCampaigns','loopClearZombieChannels','getSettings','then','previewRecallmeReminderInterval','emit','type','outbound','debug','inspect','format','voice:queue:%s','name'];(function(_0x3f6fd7,_0xcedd75){var _0xe580e7=function(_0x2b4102){while(--_0x2b4102){_0x3f6fd7['push'](_0x3f6fd7['shift']());}};_0xe580e7(++_0xcedd75);}(_0x9a1a,0x1d9));var _0xa9a1=function(_0x2df370,_0x47464a){_0x2df370=_0x2df370-0x0;var _0x48961a=_0x9a1a[_0x2df370];return _0x48961a;};'use strict';var util=require(_0xa9a1('0x0'));var _=require(_0xa9a1('0x1'));var uuid=require(_0xa9a1('0x2'));var moment=require(_0xa9a1('0x3'));var rr=require('rr');var Redis=require(_0xa9a1('0x4'));var utils=require('./utils');var hopperUtils=require(_0xa9a1('0x5'));var ut=require(_0xa9a1('0x6'));var config=require(_0xa9a1('0x7'));var logger=require(_0xa9a1('0x8'))(_0xa9a1('0x9'));var loggerBooked=require(_0xa9a1('0x8'))('booked');var loggerPredictive=require(_0xa9a1('0x8'))(_0xa9a1('0xa'));var loggerPredictiveCalls=require('../../../config/logger')(_0xa9a1('0xb'));var loggerSyncQueueSummary=require(_0xa9a1('0x8'))(_0xa9a1('0xc'));var ami=require(_0xa9a1('0xd'));config[_0xa9a1('0xe')]=_[_0xa9a1('0xf')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xa9a1('0x10'))(new Redis(config[_0xa9a1('0xe')]));var cmHopper=require('../rpc/cmHopper');var voiceQueueRt=require(_0xa9a1('0x11'));var RpcSetting=require(_0xa9a1('0x12'));var Interval=require(_0xa9a1('0x13'));var Action=require('./models/action');var History=require(_0xa9a1('0x14'));var Final=require(_0xa9a1('0x15'));var AgentComplete=require('./models/agentComplete');var QueueCallerAbandon=require(_0xa9a1('0x16'));var Hangup=require('./models/hangup');var ipAgi=process[_0xa9a1('0x17')][_0xa9a1('0x18')]||_0xa9a1('0x19');var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence[_0xa9a1('0x1a')][_0xa9a1('0x1b')]=function(_0x13bbfb){this['tail']=this['tail']?this[_0xa9a1('0x1c')][_0xa9a1('0x1d')](_0x13bbfb):_0x13bbfb();};function Dialer(_0x1c41e4,_0x5db591){this[_0xa9a1('0x1e')]=new Sequence();this['preview']=_0x5db591;this[_0xa9a1('0x1f')]=_0x1c41e4['voiceQueues'];this[_0xa9a1('0x20')]=_0x1c41e4['campaigns'];this[_0xa9a1('0x21')]=_0x1c41e4['agents'];this[_0xa9a1('0x22')]=_0x1c41e4[_0xa9a1('0x22')];this['maxNumberOriginate']=config['maxNumberOriginate']||0x2;this[_0xa9a1('0x23')]={};this[_0xa9a1('0x24')]={};this[_0xa9a1('0x25')]={};this[_0xa9a1('0x26')]={};this['optionPredictive']={};this['startPredictive']={};this[_0xa9a1('0x27')]={};this[_0xa9a1('0x28')]={};this[_0xa9a1('0x29')]={};this[_0xa9a1('0x2a')]={};this[_0xa9a1('0x2b')]={};ami['on'](_0xa9a1('0x2c'),this[_0xa9a1('0x2d')][_0xa9a1('0x2e')](this));ami['on'](_0xa9a1('0x2f'),this[_0xa9a1('0x30')][_0xa9a1('0x2e')](this));ami['on']('originateresponse',this[_0xa9a1('0x31')][_0xa9a1('0x2e')](this));ami['on'](_0xa9a1('0x32'),this[_0xa9a1('0x33')]['bind'](this));ami['on'](_0xa9a1('0x34'),this['syncQueueSummary'][_0xa9a1('0x2e')](this));ami['on'](_0xa9a1('0x35'),this[_0xa9a1('0x36')][_0xa9a1('0x2e')](this));ami['on'](_0xa9a1('0x37'),this[_0xa9a1('0x38')]['bind'](this));ami['on']('newexten',this[_0xa9a1('0x39')][_0xa9a1('0x2e')](this));ami['on'](_0xa9a1('0x3a'),this['syncVarSet'][_0xa9a1('0x2e')](this));ami['on'](_0xa9a1('0x3b'),this[_0xa9a1('0x3c')][_0xa9a1('0x2e')](this));ami['on'](_0xa9a1('0x3d'),this[_0xa9a1('0x3e')][_0xa9a1('0x2e')](this));this[_0xa9a1('0x3f')]();this[_0xa9a1('0x40')]();RpcSetting[_0xa9a1('0x41')]()[_0xa9a1('0x42')](function(_0x4a609a){previewRecallmeReminderInterval=_0x4a609a[_0xa9a1('0x43')];});}function isNotNull(_0x2279d1){return _0x2279d1!==null&&!_['isUndefined'](_0x2279d1);}function msgResponse(_0x266009,_0x5c2a7f,_0x42403a){return{'action':_0x266009,'response':_0x5c2a7f,'message':_0x42403a,'stack':_0x42403a};}function emit(_0x4e775c,_0x598095,_0x133206){io['to'](_0x4e775c)[_0xa9a1('0x44')](_0x598095,_0x133206);}function emitOutboundVoiceQueueSummary(_0x4d656b){if(_0x4d656b[_0xa9a1('0x45')]===_0xa9a1('0x46')){logger[_0xa9a1('0x47')]('[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:',util[_0xa9a1('0x48')](_0x4d656b,{'showHidden':![],'depth':null}));emit(util[_0xa9a1('0x49')](_0xa9a1('0x4a'),_0x4d656b[_0xa9a1('0x4b')]),_0xa9a1('0x4c'),_0x4d656b);}}function checkGetDataPredictive(_0x19cc87){if(isNotNull(_0x19cc87)&&!_[_0xa9a1('0x4d')](_0x19cc87)){loggerPredictive[_0xa9a1('0x4e')](_0xa9a1('0x4f'));loggerPredictive[_0xa9a1('0x4e')]('Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x19cc87[_0xa9a1('0x50')]);loggerPredictive[_0xa9a1('0x4e')](_0xa9a1('0x51'),_0x19cc87[_0xa9a1('0x52')]);loggerPredictive[_0xa9a1('0x4e')](_0xa9a1('0x53'),_0x19cc87[_0xa9a1('0x54')]);loggerPredictive[_0xa9a1('0x4e')](_0xa9a1('0x55'),_0x19cc87[_0xa9a1('0x56')]);loggerPredictive[_0xa9a1('0x4e')]('AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x19cc87[_0xa9a1('0x57')]);loggerPredictive['info'](_0xa9a1('0x58'),_0x19cc87[_0xa9a1('0x59')]);loggerPredictive[_0xa9a1('0x4e')](_0xa9a1('0x5a'));if(_0x19cc87[_0xa9a1('0x50')]>0x0){if(!_[_0xa9a1('0x5b')](_0x19cc87[_0xa9a1('0x59')])&&_0x19cc87[_0xa9a1('0x59')]>0x0){return!![];}loggerPredictive[_0xa9a1('0x4e')](_0xa9a1('0x5c'));if(!_[_0xa9a1('0x5b')](_0x19cc87['predictiveIntervalAvgHoldtime'])&&_0x19cc87[_0xa9a1('0x57')]>0x0){return!![];}loggerPredictive[_0xa9a1('0x4e')](_0xa9a1('0x5d'));}else{loggerPredictive['info'](_0xa9a1('0x5e'));}}else{loggerPredictive[_0xa9a1('0x4e')](_0xa9a1('0x5f'));}return![];}function mergeDataErlangB(_0x2f6121){return function(_0x2fad61){loggerPredictive[_0xa9a1('0x4e')](_0xa9a1('0x60'));loggerPredictive[_0xa9a1('0x4e')](_0xa9a1('0x61'),_0x2fad61['erlangCalls']);loggerPredictive[_0xa9a1('0x4e')]('One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x2fad61['erlangCallToSecond']);loggerPredictive[_0xa9a1('0x4e')](_0xa9a1('0x62'),_0x2fad61[_0xa9a1('0x63')]);loggerPredictive[_0xa9a1('0x4e')](_0xa9a1('0x64'),_0x2fad61[_0xa9a1('0x65')]);loggerPredictive['info'](_0xa9a1('0x62'),_0x2fad61[_0xa9a1('0x63')]);loggerPredictive[_0xa9a1('0x4e')](_0xa9a1('0x5a'));_[_0xa9a1('0x66')](_0x2f6121,_0x2fad61);};}function ifInterval(_0x3b21d7,_0x417885){if(_[_0xa9a1('0x5b')](_0x417885)){return![];}return utils[_0xa9a1('0x67')](undefined,_0x417885)<_0x3b21d7*0x3c;}function clearPredictiveAttributes(_0x4eff51){if(_0x4eff51[_0xa9a1('0x27')]){_0x4eff51[_0xa9a1('0x27')]=undefined;loggerPredictive[_0xa9a1('0x47')](_0x4eff51[_0xa9a1('0x4b')],_0xa9a1('0x68'));}if(_0x4eff51[_0xa9a1('0x69')]){_0x4eff51[_0xa9a1('0x69')]=undefined;loggerPredictive[_0xa9a1('0x47')](_0x4eff51[_0xa9a1('0x4b')],_0xa9a1('0x6a'));}if(_0x4eff51[_0xa9a1('0x6b')]){clearInterval(_0x4eff51[_0xa9a1('0x6b')]);_0x4eff51[_0xa9a1('0x6b')]=undefined;loggerPredictive['debug'](_0x4eff51[_0xa9a1('0x4b')],_0xa9a1('0x6c'));}}function loggerCatchPredictive(_0x54dfd3,_0x2227cf){return function(_0x15f868){loggerPredictive[_0xa9a1('0x6d')](_0x2227cf['name'],_0x54dfd3);loggerPredictive[_0xa9a1('0x6d')](_0x15f868[_0xa9a1('0x6e')]);clearPredictiveAttributes(_0x2227cf);};}function loggerCatch(_0x3d7c19){return function(_0x355451){logger[_0xa9a1('0x6d')](_0x3d7c19,util[_0xa9a1('0x48')](_0x355451,{'showHidden':![],'depth':null}));};}function loggerGetContactDialer(_0x19a296,_0x348ac9,_0x2d0af4){return function(_0x354cf9){utils[_0xa9a1('0x6f')](_0x348ac9,_0x2d0af4,0x0);_0x348ac9[_0xa9a1('0x70')]=0x0;logger[_0xa9a1('0x6d')](_0x19a296,util[_0xa9a1('0x48')](_0x354cf9,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x3e0e2d){return function(_0x39a0e4){if(isNotNull(_0x39a0e4)&&isNotNull(_0x39a0e4[0x0])){if(_0x39a0e4[0x0][_0xa9a1('0x71')]>0x0){_0x3e0e2d[_0xa9a1('0x72')]=utils[_0xa9a1('0x73')][_0xa9a1('0x74')];logger[_0xa9a1('0x4e')](_0xa9a1('0x75')+_0x3e0e2d[_0xa9a1('0x4b')],_0x39a0e4[0x0][_0xa9a1('0x71')],_0xa9a1('0x76'));}else{_0x3e0e2d['message']=utils[_0xa9a1('0x73')]['NO_AVAILABLE_CONTACTS'];logger[_0xa9a1('0x4e')](_0xa9a1('0x77')+_0x3e0e2d[_0xa9a1('0x4b')]);}}};}function createObjHistory(_0x365112,_0x28ccf9,_0x1c0240,_0x5262cc,_0x2a2ea3){_0x365112[_0xa9a1('0x72')]=_0x1c0240;var _0x5f2f13=new Action(_0x365112,_0x28ccf9);var _0xd47f5=new History(_0x5f2f13);_0xd47f5[_0xa9a1('0x78')]=_0x5262cc;_0xd47f5['statedesc']=_0x2a2ea3;_0xd47f5[_0xa9a1('0x79')]=_0x5f2f13[_0xa9a1('0x7a')];return _0xd47f5;}function unlockQueueStatus(_0xd7ec52,_0x498332){setTimeout(function(){if(_['isUndefined'](_0xd7ec52[_0xa9a1('0x7b')])){loggerBooked[_0xa9a1('0x6d')](_0xa9a1('0x7c'),_0x498332);}_0xd7ec52['queueStatusComplete']=!![];loggerBooked[_0xa9a1('0x4e')](_0xa9a1('0x7d'),_0x498332,JSON[_0xa9a1('0x7e')](_['pick'](_0xd7ec52,[_0xa9a1('0x4b'),_0xa9a1('0x7b')])));},0x1f3);}function checkInterval(_0x382c36){return function(){if(!isNotNull(_0x382c36[_0xa9a1('0x7f')])){_0x382c36[_0xa9a1('0x72')]=utils[_0xa9a1('0x73')]['NULL_INTERVAL'];throw _0x382c36['name']+_0xa9a1('0x80');}if(!isNotNull(_0x382c36['Interval']['Intervals'])){_0x382c36[_0xa9a1('0x72')]=utils[_0xa9a1('0x73')]['NULL_INTERVAL'];throw _0x382c36[_0xa9a1('0x4b')]+_0xa9a1('0x80');}if(!isNotNull(_[_0xa9a1('0x4d')](_0x382c36[_0xa9a1('0x7f')]['Intervals']))){_0x382c36[_0xa9a1('0x72')]=utils[_0xa9a1('0x73')][_0xa9a1('0x81')];throw _0x382c36['name']+_0xa9a1('0x80');}};}function checkIsIVRCampaignActive(_0x688d07){return function(){if(!utils[_0xa9a1('0x82')](_0x688d07)){_0x688d07[_0xa9a1('0x72')]=utils[_0xa9a1('0x73')]['INACTIVE'];throw _0x688d07[_0xa9a1('0x4b')]+_0xa9a1('0x83');}};}function emitCampaignSummary(_0x596cb5){if(utils[_0xa9a1('0x84')](_0x596cb5)){emit(util[_0xa9a1('0x49')](_0xa9a1('0x85'),_0x596cb5['name']),'campaign:save',_0x596cb5);}}function loggerCatchQueueSummary(_0x28f2ab,_0x410ff5){return function(_0x23e32d){clearPredictiveAttributes(_0x410ff5);emitCampaignSummary(_0x410ff5);loggerSyncQueueSummary[_0xa9a1('0x47')](_0x28f2ab,util['inspect'](_0x23e32d,{'showHidden':![],'depth':null}));};}function notSendMessagesCampaign(_0x559439){if(_0x559439[_0xa9a1('0x86')]){if(_0x559439[_0xa9a1('0x87')]===0x0){_0x559439[_0xa9a1('0x86')]=![];_0x559439[_0xa9a1('0x72')]=utils[_0xa9a1('0x73')][_0xa9a1('0x88')];loggerSyncQueueSummary[_0xa9a1('0x47')](_0xa9a1('0x89'),_0x559439[_0xa9a1('0x4b')],_0xa9a1('0x8a'));}else{_0x559439[_0xa9a1('0x72')]=utils[_0xa9a1('0x73')][_0xa9a1('0x8b')];loggerSyncQueueSummary[_0xa9a1('0x47')](_0xa9a1('0x89'),_0x559439['name'],_0xa9a1('0x8c'));}emitCampaignSummary(_0x559439);}}function myreject(_0x872318){return function(_0x4add52){return _0x872318(msgResponse('[ifTime][Action]',_0xa9a1('0x8d'),JSON[_0xa9a1('0x7e')](_0x4add52)));};}Dialer[_0xa9a1('0x1a')][_0xa9a1('0x8e')]=function(_0x1b7e8f){return!_['isUndefined'](_0x1b7e8f)&&_0x1b7e8f&&!_['isUndefined'](_0x1b7e8f[_0xa9a1('0x4b')])&&!_[_0xa9a1('0x5b')](_0x1b7e8f[_0xa9a1('0x8f')])&&_0x1b7e8f[_0xa9a1('0x8f')]&&(this[_0xa9a1('0x22')][util['format']('SIP/%s',_0x1b7e8f[_0xa9a1('0x4b')])]['status']===_0xa9a1('0x90')||this['trunks'][util[_0xa9a1('0x49')]('SIP/%s',_0x1b7e8f['name'])][_0xa9a1('0x91')]===_0xa9a1('0x92'));};Dialer[_0xa9a1('0x1a')][_0xa9a1('0x93')]=function(_0x3bd074){var _0x2010cd=this;return function(){if(!_0x2010cd[_0xa9a1('0x8e')](_0x3bd074['Trunk'])){if(!_0x2010cd[_0xa9a1('0x8e')](_0x3bd074[_0xa9a1('0x94')])){_0x3bd074[_0xa9a1('0x72')]=utils[_0xa9a1('0x73')]['TRUNK_NOT_REACHABLE'];throw _0x3bd074[_0xa9a1('0x4b')]+_0xa9a1('0x95');}}};};Dialer[_0xa9a1('0x1a')]['checkIfTime']=function(_0x259d5c,_0x349591,_0x55aaca,_0x39314d){var _0x3a38cb=this;return function(){var _0x54bd58=!![];return _0x3a38cb[_0xa9a1('0x96')](_0x259d5c,_0x349591,_0x55aaca,_0x39314d,_0x54bd58);};};Dialer[_0xa9a1('0x1a')][_0xa9a1('0x97')]=function(_0xf81ec5,_0x5d50f0,_0x26586e,_0x5ce307){var _0x3715ce=this;return function(){var _0x561f19=![];return _0x3715ce[_0xa9a1('0x96')](_0xf81ec5[_0xa9a1('0x98')],_0x5d50f0,_0x26586e,_0x5ce307,_0x561f19);};};Dialer[_0xa9a1('0x1a')][_0xa9a1('0x96')]=function(_0xef13b9,_0x3187c8,_0x345d8f,_0x45a444,_0x3502d0){var _0x428c95=[];return new Promise(function(_0xb7f47f,_0x36dda3){if(!isNotNull(_0xef13b9)){_0x45a444[_0xa9a1('0x72')]=utils[_0xa9a1('0x73')][_0xa9a1('0x81')];return _0x36dda3(msgResponse(_0xa9a1('0x99'),'Failure',_0x345d8f+_0xa9a1('0x9a')));}if(_[_0xa9a1('0x4d')](_0xef13b9)){_0x45a444[_0xa9a1('0x72')]=utils[_0xa9a1('0x73')]['EMPTY_INTERVAL'];return _0x36dda3(msgResponse(_0xa9a1('0x99'),'Failure',_0x345d8f+_0xa9a1('0x9b')));}if(_0x3187c8&&_[_0xa9a1('0x5b')](config[_0xa9a1('0x9c')][_0x3187c8])){_0x45a444[_0xa9a1('0x72')]=utils[_0xa9a1('0x73')][_0xa9a1('0x9d')];return _0x36dda3(msgResponse('ifTime',_0xa9a1('0x9e'),_0x345d8f+_0xa9a1('0x9f')+_0x3187c8));}if(_['isArray'](_0xef13b9)){for(var _0x3d1a0b=0x0;_0x3d1a0b<_0xef13b9['length'];_0x3d1a0b+=0x1){_0x428c95['push'](ami[_0xa9a1('0xa0')]({'action':_0xa9a1('0xa1'),'command':util[_0xa9a1('0x49')]('iftime\x20%s,%s',_0xef13b9[_0x3d1a0b]['interval'],!_[_0xa9a1('0x5b')](config['timezones'][_0x3187c8])?_0x3187c8:'')})['then'](function(_0x43d185){return _0x43d185[_0xa9a1('0xa2')][_0xa9a1('0xa3')](_0xa9a1('0xa4'))>=0x0;})['catch'](myreject(_0x36dda3)));}}else{_0x428c95[_0xa9a1('0xa5')](ami['Action']({'action':_0xa9a1('0xa1'),'command':util[_0xa9a1('0x49')](_0xa9a1('0xa6'),_0xef13b9,!_[_0xa9a1('0x5b')](config[_0xa9a1('0x9c')][_0x3187c8])?_0x3187c8:'')})[_0xa9a1('0x42')](function(_0x422ad1){return _0x422ad1[_0xa9a1('0xa2')]['indexOf'](_0xa9a1('0xa4'))>=0x0;})[_0xa9a1('0xa7')](myreject(_0x36dda3)));}Promise[_0xa9a1('0xa8')](_0x428c95)[_0xa9a1('0x42')](function(_0x4845aa){var _0x5dc419=_[_0xa9a1('0xa9')](_0x4845aa);if(_0x5dc419){return _0xb7f47f(_0x5dc419);}else{_0x45a444[_0xa9a1('0x72')]=_0x3502d0?utils[_0xa9a1('0x73')]['OVERTIME_GLOBAL_INTERVAL']:utils[_0xa9a1('0x73')][_0xa9a1('0xaa')];return _0x36dda3(msgResponse('[ifTime][promiseAll]','Failure',_0xa9a1('0xab')+_0x3502d0+'\x20'+_0x345d8f+'\x20Interval\x20is\x20overtime:\x20'+util[_0xa9a1('0x48')](_0xef13b9,{'showHidden':![],'depth':null})+_0xa9a1('0xac')+_0x3187c8));}})['catch'](function(_0x523274){return _0x36dda3(msgResponse(_0xa9a1('0x99'),_0xa9a1('0x9e'),JSON['stringify'](_0x523274)));});});};Dialer['prototype'][_0xa9a1('0x3f')]=function(){var _0x891fcf=this;return cmHopper[_0xa9a1('0xad')]({'active':![]},{'where':{'active':!![]}})[_0xa9a1('0x42')](function(){setInterval(function(){_0x891fcf['syncCampaigns']();},0x3e8);});};Dialer[_0xa9a1('0x1a')]['syncCampaigns']=function(){var _0x88649f=this;var _0x2e394e;for(var _0x585a57 in this['campaigns']){if(typeof this[_0xa9a1('0x20')][_0x585a57]!==_0xa9a1('0xae')){_0x2e394e=this[_0xa9a1('0x20')][_0x585a57];if(utils['isIVRCampaign'](_0x2e394e)&&utils[_0xa9a1('0x82')](_0x2e394e)){_0x2e394e[_0xa9a1('0x86')]=!![];Promise[_0xa9a1('0xaf')]()['then'](checkIsIVRCampaignActive(_0x2e394e))[_0xa9a1('0x42')](checkInterval(_0x2e394e))[_0xa9a1('0x42')](_0x88649f[_0xa9a1('0x93')](_0x2e394e))['then'](_0x88649f[_0xa9a1('0xb0')](_0x2e394e['dialGlobalInterval'],_0x2e394e[_0xa9a1('0xb1')],_0x2e394e[_0xa9a1('0x4b')],_0x2e394e))[_0xa9a1('0x42')](_0x88649f[_0xa9a1('0x97')](_0x2e394e['Interval'],_0x2e394e[_0xa9a1('0xb1')],_0x2e394e['name'],_0x2e394e))[_0xa9a1('0x42')](_0x88649f[_0xa9a1('0xb2')](_0x2e394e))[_0xa9a1('0xa7')](loggerCatchQueueSummary(_0xa9a1('0xb3'),_0x2e394e));}else{notSendMessagesCampaign(_0x2e394e);}}}};Dialer[_0xa9a1('0x1a')]['checkDialMethod']=function(_0x460fb5){if(_0x460fb5[_0xa9a1('0xb4')]!=='predictive'){clearPredictiveAttributes(_0x460fb5);}switch(_0x460fb5['dialMethod']){case _0xa9a1('0xb5'):this[_0xa9a1('0xb6')](_0x460fb5,0x1);break;case _0xa9a1('0xb7'):this[_0xa9a1('0xb6')](_0x460fb5,_0x460fb5[_0xa9a1('0xb8')]);break;case _0xa9a1('0xa'):this['predictive'](_0x460fb5);break;case _0xa9a1('0xb9'):this[_0xa9a1('0xb6')](_0x460fb5,0x1);break;default:logger[_0xa9a1('0x6d')](_0xa9a1('0xba'),_0x460fb5[_0xa9a1('0x4b')],_0xa9a1('0xbb'));}};Dialer[_0xa9a1('0x1a')]['ifTime']=function(_0x358dc2,_0x566fb6){var _0x5e56f3=_0x358dc2[_0xa9a1('0xb1')];var _0x1e4208=_0x566fb6?_0x358dc2[_0xa9a1('0xbc')]:_0x358dc2['Interval'][_0xa9a1('0x98')];logger['silly'](_0xa9a1('0xbd'),_0x1e4208,_0x5e56f3,_0x358dc2['name'],util[_0xa9a1('0x49')](_0xa9a1('0xbe'),_0x358dc2['name'],_0x358dc2['id']));var _0x34d966=null;return Interval[_0xa9a1('0xbf')](_0x1e4208,_0x5e56f3)[_0xa9a1('0x42')](function(_0x4cfce8){if(_0x4cfce8===!![]){return _0x4cfce8;}else{_0x358dc2[_0xa9a1('0x72')]=_0x566fb6?utils[_0xa9a1('0x73')]['OVERTIME_GLOBAL_INTERVAL']:utils['CAMPAIGN_STATUS'][_0xa9a1('0xaa')];_0x34d966=msgResponse(_0xa9a1('0xc0'),_0xa9a1('0x9e'),_0xa9a1('0xab')+_0x566fb6+'\x20'+_0x358dc2[_0xa9a1('0x4b')]+'\x20Interval\x20is\x20overtime:\x20'+util[_0xa9a1('0x48')](_0x1e4208,{'showHidden':![],'depth':null})+_0xa9a1('0xac')+_0x5e56f3);}if(_0x34d966!==null){logger[_0xa9a1('0xc1')](_0xa9a1('0xc2'),_0x34d966);_0x34d966[_0xa9a1('0xc3')]=_0x566fb6;throw _0x34d966;}})[_0xa9a1('0xa7')](function(_0x5e889e){logger[_0xa9a1('0x6d')](_0xa9a1('0xc4'),_0x5e889e);throw msgResponse(_0xa9a1('0xc5'),_0xa9a1('0x8d'),util[_0xa9a1('0x48')](_0x5e889e,{'showHidden':![],'depth':null}));});};Dialer[_0xa9a1('0x1a')][_0xa9a1('0x2d')]=function(_0x256cb7){if(this[_0xa9a1('0x1f')][_0x256cb7['queue']]){if(this[_0xa9a1('0x26')][_0x256cb7[_0xa9a1('0xc6')]]&&this[_0xa9a1('0x26')][_0x256cb7['uniqueid']][_0xa9a1('0x45')]!==_0xa9a1('0xc7')){this[_0xa9a1('0xc8')](this[_0xa9a1('0x1f')][_0x256cb7[_0xa9a1('0xc9')]]);this[_0xa9a1('0x26')][_0x256cb7[_0xa9a1('0xc6')]][_0xa9a1('0xca')]=moment()[_0xa9a1('0x49')](_0xa9a1('0xcb'));}}};Dialer[_0xa9a1('0x1a')]['syncAgentComplete']=function(_0x26be2f){var _0x5a7b9c=this['uniqueId'][_0x26be2f['uniqueid']];if(this[_0xa9a1('0x1f')][_0x26be2f['queue']]){if(_0x5a7b9c&&_0x5a7b9c[_0xa9a1('0x45')]!==_0xa9a1('0xc7')){delete this['uniqueId'][_0x26be2f['uniqueid']];this[_0xa9a1('0x1f')][_0x26be2f['queue']][_0xa9a1('0xcc')]+=0x1;var _0x38635c=new AgentComplete(_0x5a7b9c,_0x26be2f);if(_0x26be2f[_0xa9a1('0xcd')]===_0xa9a1('0xce')){_0x38635c[_0xa9a1('0xcf')]=this[_0xa9a1('0x1f')][_0x26be2f['queue']][_0xa9a1('0xd0')]&&this['voiceQueues'][_0x26be2f[_0xa9a1('0xc9')]][_0xa9a1('0xd1')]?moment()['format'](_0xa9a1('0xcb')):undefined;}hopperUtils[_0xa9a1('0xd2')](_0x38635c)['catch'](loggerCatch('[syncAgentComplete][createHistory]'));hopperUtils[_0xa9a1('0xd3')](_0x38635c)['catch'](loggerCatch(_0xa9a1('0xd4')));}}};Dialer[_0xa9a1('0x1a')][_0xa9a1('0x30')]=function(_0x30134b){var _0x2615e7=this['uniqueId'][_0x30134b[_0xa9a1('0xc6')]];var _0x1cdab1=this;var _0x13231b=![];var _0x5ccda2;var _0x10c39a;if(this[_0xa9a1('0x1f')][_0x30134b[_0xa9a1('0xc9')]]){if(_0x2615e7&&_0x2615e7[_0xa9a1('0x45')]!=='ivr'){delete this[_0xa9a1('0x26')][_0x30134b[_0xa9a1('0xc6')]];this['updateOriginated'](this[_0xa9a1('0x1f')][_0x30134b[_0xa9a1('0xc9')]]);_0x2615e7[_0xa9a1('0xd5')]=moment()[_0xa9a1('0x49')](_0xa9a1('0xcb'));var _0x498741=new QueueCallerAbandon(_0x2615e7,_0x30134b);if(utils[_0xa9a1('0x67')](_0x2615e7[_0xa9a1('0xd5')],_0x2615e7[_0xa9a1('0xd6')])>=_0x2615e7[_0xa9a1('0xd7')]){this[_0xa9a1('0x1f')][_0x30134b['queue']][_0xa9a1('0x54')]+=0x1;this[_0xa9a1('0x1f')][_0x30134b['queue']][_0xa9a1('0xd8')]+=0x1;this[_0xa9a1('0x1f')][_0x30134b['queue']]['predictiveIntervalErlangCallsDroppedCalls']+=0x1;_0x498741[_0xa9a1('0x78')]=0xa;_0x498741[_0xa9a1('0xd9')]=_0xa9a1('0xda');_0x498741[_0xa9a1('0xdb')]='TIMEOUT';_0x498741[_0xa9a1('0xcf')]=this[_0xa9a1('0x1f')][_0x30134b[_0xa9a1('0xc9')]]['dialQueueProject2']?moment()[_0xa9a1('0x49')](_0xa9a1('0xcb')):undefined;_0x498741[_0xa9a1('0xdc')]+=0x1;_0x498741[_0xa9a1('0xdd')]+=0x1;_0x5ccda2=this['voiceQueues'][_0x30134b['queue']]['dialDropRetryFrequency'];_0x10c39a=this[_0xa9a1('0x1f')][_0x30134b[_0xa9a1('0xc9')]]['callAdditionalPhoneAfterMin'];hopperUtils[_0xa9a1('0xde')](_0x498741,_0x498741['state'],_0x2615e7[_0xa9a1('0xdf')])[_0xa9a1('0x42')](function(_0x13999e){_0x13231b=_0x13999e[_0xa9a1('0xe0')]==0x1;if(_0x498741[_0xa9a1('0xdc')]>=_0x1cdab1[_0xa9a1('0x1f')][_0x30134b[_0xa9a1('0xc9')]][_0xa9a1('0xe1')]){_0x1cdab1[_0xa9a1('0xe2')](_0x498741,_0x13999e['additional']);}else{hopperUtils[_0xa9a1('0xe3')]({'active':![],'countdropretry':_0x498741[_0xa9a1('0xdc')],'scheduledat':moment()[_0xa9a1('0xe4')](_0x1cdab1[_0xa9a1('0x1f')][_0x30134b[_0xa9a1('0xc9')]][_0xa9a1('0xe5')],_0xa9a1('0xe6'))[_0xa9a1('0x49')](_0xa9a1('0xcb')),'ContactId':_0x2615e7[_0xa9a1('0xe7')],'ListId':_0x2615e7[_0xa9a1('0xe8')],'VoiceQueueId':_0x2615e7[_0xa9a1('0xe9')]||undefined,'CampaignId':_0x2615e7[_0xa9a1('0xea')]||undefined})[_0xa9a1('0xa7')](loggerCatch(_0xa9a1('0xeb')));var _0x3a8b7b=new History(_0x498741);_0x3a8b7b[_0xa9a1('0x78')]=0xa;_0x3a8b7b[_0xa9a1('0xd9')]='Drop';_0x3a8b7b[_0xa9a1('0x7a')]=moment()[_0xa9a1('0x49')](_0xa9a1('0xcb'));_0x3a8b7b['endtime']=_0x3a8b7b[_0xa9a1('0x7a')];_0x3a8b7b['calleridname']=_0x498741[_0xa9a1('0xec')];_0x3a8b7b['calleridnum']=_0x498741[_0xa9a1('0xed')];hopperUtils['createHistory'](_0x3a8b7b)[_0xa9a1('0xa7')](loggerCatch(_0xa9a1('0xee')));}})['then'](function(){if(_0x13231b)hopperUtils[_0xa9a1('0xef')](_0x498741,_0x5ccda2,_0x10c39a)[_0xa9a1('0x42')](function(){return 0x1;});});}else{this['voiceQueues'][_0x30134b[_0xa9a1('0xc9')]][_0xa9a1('0x56')]+=0x1;this['voiceQueues'][_0x30134b[_0xa9a1('0xc9')]][_0xa9a1('0xf0')]+=0x1;_0x498741['state']=0xb;_0x498741['statedesc']=_0xa9a1('0xf1');_0x498741['dropreason']=_0xa9a1('0xf2');_0x498741[_0xa9a1('0xf3')]+=0x1;_0x498741[_0xa9a1('0xdd')]+=0x1;_0x5ccda2=this[_0xa9a1('0x1f')][_0x30134b[_0xa9a1('0xc9')]][_0xa9a1('0xf4')];_0x10c39a=this[_0xa9a1('0x1f')][_0x30134b[_0xa9a1('0xc9')]][_0xa9a1('0xf5')];hopperUtils[_0xa9a1('0xde')](_0x498741,_0x498741[_0xa9a1('0x78')],_0x2615e7[_0xa9a1('0xdf')])['then'](function(_0x467f19){if(_0x498741[_0xa9a1('0xf3')]>=_0x1cdab1[_0xa9a1('0x1f')][_0x30134b[_0xa9a1('0xc9')]][_0xa9a1('0xf6')]){_0x1cdab1[_0xa9a1('0xe2')](_0x498741,_0x467f19[_0xa9a1('0xe0')]);}else{hopperUtils[_0xa9a1('0xe3')]({'active':![],'countabandonedretry':_0x498741[_0xa9a1('0xf3')],'scheduledat':moment()[_0xa9a1('0xe4')](_0x1cdab1['voiceQueues'][_0x30134b[_0xa9a1('0xc9')]][_0xa9a1('0xf4')],_0xa9a1('0xe6'))[_0xa9a1('0x49')](_0xa9a1('0xcb')),'ContactId':_0x2615e7['ContactId'],'ListId':_0x2615e7['ListId'],'VoiceQueueId':_0x2615e7['VoiceQueueId']||undefined,'CampaignId':_0x2615e7[_0xa9a1('0xea')]||undefined})[_0xa9a1('0xa7')](loggerCatch(_0xa9a1('0xf7')));var _0xcfd5c9=new History(_0x498741);_0xcfd5c9[_0xa9a1('0x78')]=0xb;_0xcfd5c9['statedesc']='Abandoned';_0xcfd5c9[_0xa9a1('0x7a')]=moment()[_0xa9a1('0x49')]('YYYY-MM-DD\x20HH:mm:ss');_0xcfd5c9['endtime']=_0xcfd5c9['starttime'];_0xcfd5c9[_0xa9a1('0xec')]=_0x498741[_0xa9a1('0xec')];_0xcfd5c9[_0xa9a1('0xed')]=_0x498741[_0xa9a1('0xed')];hopperUtils[_0xa9a1('0xd2')](_0xcfd5c9)['catch'](loggerCatch(_0xa9a1('0xf8')));}})[_0xa9a1('0x42')](function(){if(_0x13231b)hopperUtils['swapAdditionalPhones'](_0x498741,_0x5ccda2,_0x10c39a)[_0xa9a1('0x42')](function(){return 0x1;});});}}}};Dialer[_0xa9a1('0x1a')][_0xa9a1('0x39')]=function(_0x47e91c){if(this[_0xa9a1('0x24')][_0x47e91c['uniqueid']]){this['actions'][_0x47e91c['uniqueid']][_0xa9a1('0xf9')]=_0x47e91c['channel'];}if(this[_0xa9a1('0x26')][_0x47e91c[_0xa9a1('0xc6')]]){this[_0xa9a1('0x26')][_0x47e91c[_0xa9a1('0xc6')]][_0xa9a1('0xf9')]=_0x47e91c[_0xa9a1('0xf9')];}};Dialer[_0xa9a1('0x1a')][_0xa9a1('0x3c')]=function(_0x392a98){if(!this[_0xa9a1('0x24')][_0x392a98[_0xa9a1('0xfa')]]){return;}var _0x434cd0=this[_0xa9a1('0x1f')][this[_0xa9a1('0x24')][_0x392a98[_0xa9a1('0xfa')]]['queue']]['strategy']||_0xa9a1('0xfb');if(_0x434cd0==='roundrobin'){if(this[_0xa9a1('0x24')][_0x392a98[_0xa9a1('0xfa')]]&&_[_0xa9a1('0xfc')](this[_0xa9a1('0x24')][_0x392a98[_0xa9a1('0xfa')]][_0xa9a1('0xfd')])&&_0x392a98[_0xa9a1('0x91')]==='1'&&_0x392a98['paused']==='0'){if(this[_0xa9a1('0x21')][_0x392a98[_0xa9a1('0xfe')]]){if(!this[_0xa9a1('0x21')][_0x392a98[_0xa9a1('0xfe')]][_0xa9a1('0xfd')]){this[_0xa9a1('0x21')][_0x392a98[_0xa9a1('0xfe')]][_0xa9a1('0xfd')]=!![];this[_0xa9a1('0x24')][_0x392a98[_0xa9a1('0xfa')]][_0xa9a1('0xfd')]=!![];this['actions'][_0x392a98[_0xa9a1('0xfa')]][_0xa9a1('0xfe')]=_0x392a98[_0xa9a1('0xfe')];}}}}else if(_0x434cd0===_0xa9a1('0xfb')){if(this[_0xa9a1('0x24')][_0x392a98[_0xa9a1('0xfa')]]){if(this[_0xa9a1('0x21')][_0x392a98['stateinterface']]){this[_0xa9a1('0x24')][_0x392a98['actionid']][_0xa9a1('0xfe')]=_0x392a98[_0xa9a1('0xfe')];if(_['isNil'](this['queueBooked'][this[_0xa9a1('0x24')][_0x392a98[_0xa9a1('0xfa')]][_0xa9a1('0xc9')]])){this[_0xa9a1('0x29')][this[_0xa9a1('0x24')][_0x392a98['actionid']][_0xa9a1('0xc9')]]=[];}this[_0xa9a1('0x29')][this[_0xa9a1('0x24')][_0x392a98[_0xa9a1('0xfa')]][_0xa9a1('0xc9')]]['push'](_[_0xa9a1('0x66')](_['pick'](this[_0xa9a1('0x24')][_0x392a98[_0xa9a1('0xfa')]],[_0xa9a1('0xff'),_0xa9a1('0xfe')]),{'status':_0x392a98[_0xa9a1('0x91')],'paused':_0x392a98[_0xa9a1('0x100')]}));}}}};Dialer[_0xa9a1('0x1a')][_0xa9a1('0x3e')]=function(_0x95e789){if(!this['actions'][_0x95e789[_0xa9a1('0xfa')]]){return;}var _0x4d4b95=this;var _0x30a438=this[_0xa9a1('0x1f')][this['actions'][_0x95e789[_0xa9a1('0xfa')]][_0xa9a1('0xc9')]];var _0x34e194=_0x30a438[_0xa9a1('0x101')]||_0xa9a1('0xfb');if(_0x34e194===_0xa9a1('0x102')){if(this[_0xa9a1('0x24')][_0x95e789[_0xa9a1('0xfa')]]&&this[_0xa9a1('0x24')][_0x95e789[_0xa9a1('0xfa')]][_0xa9a1('0xfe')]){this[_0xa9a1('0x103')][_0xa9a1('0x104')](this['actions'][_0x95e789[_0xa9a1('0xfa')]][_0xa9a1('0xff')],this[_0xa9a1('0x24')][_0x95e789[_0xa9a1('0xfa')]][_0xa9a1('0xfe')])[_0xa9a1('0xa7')](function(_0x2f2106){logger[_0xa9a1('0x6d')](_0xa9a1('0x105'),util['inspect'](_0x2f2106,{'showHidden':![],'depth':null}));})[_0xa9a1('0x1d')](function(){_0x4d4b95[_0xa9a1('0xc8')](_0x4d4b95[_0xa9a1('0x1f')][_0x4d4b95[_0xa9a1('0x24')][_0x95e789[_0xa9a1('0xfa')]][_0xa9a1('0xc9')]]);_0x4d4b95[_0xa9a1('0x21')][_0x4d4b95[_0xa9a1('0x24')][_0x95e789[_0xa9a1('0xfa')]][_0xa9a1('0xfe')]]['locked']=![];delete _0x4d4b95[_0xa9a1('0x24')][_0x95e789[_0xa9a1('0xfa')]];unlockQueueStatus(_0x30a438);});}else{this[_0xa9a1('0xc8')](this[_0xa9a1('0x1f')][this['actions'][_0x95e789[_0xa9a1('0xfa')]][_0xa9a1('0xc9')]]);hopperUtils['rescheduleContact']({'active':![],'ContactId':this['actions'][_0x95e789[_0xa9a1('0xfa')]][_0xa9a1('0xe7')],'ListId':this['actions'][_0x95e789['actionid']][_0xa9a1('0xe8')],'VoiceQueueId':this[_0xa9a1('0x24')][_0x95e789['actionid']][_0xa9a1('0xe9')]||undefined,'CampaignId':this['actions'][_0x95e789['actionid']][_0xa9a1('0xea')]||undefined})[_0xa9a1('0xa7')](loggerCatch(_0xa9a1('0x106')));delete this[_0xa9a1('0x24')][_0x95e789['actionid']];unlockQueueStatus(_0x30a438);}}else if(_0x34e194===_0xa9a1('0xfb')){var _0x2502de;if(this[_0xa9a1('0x24')][_0x95e789['actionid']]&&!_[_0xa9a1('0x4d')](this[_0xa9a1('0x29')][this[_0xa9a1('0x24')][_0x95e789[_0xa9a1('0xfa')]][_0xa9a1('0xc9')]])){if(this['queueBookedRR'][_0x4d4b95[_0xa9a1('0x24')][_0x95e789['actionid']][_0xa9a1('0xc9')]]){this[_0xa9a1('0x2a')][_0x4d4b95[_0xa9a1('0x24')][_0x95e789['actionid']]['queue']]=this[_0xa9a1('0x2a')][this[_0xa9a1('0x24')][_0x95e789[_0xa9a1('0xfa')]][_0xa9a1('0xc9')]]?this[_0xa9a1('0x2a')][this[_0xa9a1('0x24')][_0x95e789[_0xa9a1('0xfa')]][_0xa9a1('0xc9')]]:this['queueBooked'][this['actions'][_0x95e789[_0xa9a1('0xfa')]][_0xa9a1('0xc9')]]?this[_0xa9a1('0x29')][this[_0xa9a1('0x24')][_0x95e789[_0xa9a1('0xfa')]][_0xa9a1('0xc9')]][_0xa9a1('0x107')]||0x0:0x0;}this['queueBooked'][this[_0xa9a1('0x24')][_0x95e789[_0xa9a1('0xfa')]][_0xa9a1('0xc9')]][_0xa9a1('0x107')]=this[_0xa9a1('0x2a')][this[_0xa9a1('0x24')][_0x95e789[_0xa9a1('0xfa')]][_0xa9a1('0xc9')]];for(var _0x25d9b8=0x0;_0x25d9b8=_0x1f5b39[_0xa9a1('0x12d')]){_0x4ee8c2[_0xa9a1('0x12e')](_0x397343,_0x4e4895,_0x4f4871,_0xa9a1('0x12f'));}else{if(_0x397343[_0xa9a1('0x125')]>=_0x1f5b39[_0xa9a1('0x130')]){_0x4ee8c2['createStateFinal'](_0x397343,_0x4e4895,_0x4f4871,_0xa9a1('0x131'));}else{hopperUtils[_0xa9a1('0xe3')]({'active':![],'countmachineretry':_0x397343['countmachineretry'],'scheduledat':moment()['add'](_0x1f5b39[_0xa9a1('0x132')],_0xa9a1('0xe6'))[_0xa9a1('0x49')](_0xa9a1('0xcb')),'ContactId':_0x397343[_0xa9a1('0xe7')],'ListId':_0x397343['ListId'],'VoiceQueueId':_0x397343[_0xa9a1('0xe9')]||undefined,'CampaignId':_0x397343[_0xa9a1('0xea')]||undefined})['catch'](loggerCatch('[rescheduleContact][Machine]'));_0x4e4895({'reschedule':0x1});}}});}if(_0x55019f['type']===_0xa9a1('0xc7')&&this[_0xa9a1('0x20')][_0x55019f['queue']][_0xa9a1('0x11b')]&&_0x12b645[_0xa9a1('0x133')]===_0xa9a1('0x11c')){delete this[_0xa9a1('0x26')][_0x12b645[_0xa9a1('0xc6')]];this[_0xa9a1('0xc8')](this['campaigns'][_0x55019f['queue']]);_0x1a0c5b=new Hangup(_0x55019f,_0x12b645);_0x1a0c5b[_0xa9a1('0x78')]=0x12;_0x1a0c5b['statedesc']=_0xa9a1('0x11e');_0x1a0c5b[_0xa9a1('0x11f')]=_0xa9a1('0x120');ami['emit'](_0xa9a1('0x127'),ut[_0xa9a1('0x121')](_0x1a0c5b,_0xa9a1('0x126')));this[_0xa9a1('0x134')](_0x1a0c5b,_0xa9a1('0x135'),_0xa9a1('0x136'));}if(_0x55019f[_0xa9a1('0x45')]===_0xa9a1('0xc7')&&this[_0xa9a1('0x20')][_0x55019f[_0xa9a1('0xc9')]][_0xa9a1('0x11b')]&&_0x12b645[_0xa9a1('0x133')]===_0xa9a1('0x137')){return new Promise(function(_0x73f63d,_0x332fa2){delete _0x4ee8c2[_0xa9a1('0x26')][_0x12b645['uniqueid']];_0x4ee8c2['updateOriginated'](_0x4ee8c2[_0xa9a1('0x20')][_0x55019f[_0xa9a1('0xc9')]]);_0x4ee8c2[_0xa9a1('0x20')][_0x55019f['queue']][_0xa9a1('0xcc')]+=0x1;_0x4ee8c2['campaigns'][_0x55019f['queue']][_0xa9a1('0x11d')]+=0x1;var _0x308b3a=_0x4ee8c2[_0xa9a1('0x20')][_0x55019f[_0xa9a1('0xc9')]];var _0x3307fa=new Hangup(_0x55019f,_0x12b645);_0x3307fa[_0xa9a1('0x78')]=0x13;_0x3307fa[_0xa9a1('0xd9')]=_0xa9a1('0x124');_0x3307fa[_0xa9a1('0x11f')]=_0xa9a1('0x120');_0x3307fa[_0xa9a1('0x125')]+=0x1;_0x3307fa[_0xa9a1('0xdd')]+=0x1;_0x3307fa['amd']=!![];ami[_0xa9a1('0x44')](_0xa9a1('0x127'),ut['buildObj'](_0x3307fa,_0xa9a1('0x126')));hopperUtils['createHistory'](_0x3307fa)[_0xa9a1('0xa7')](loggerCatch(_0xa9a1('0x128')));if(_0x3307fa['countbusyretry']+_0x3307fa['countcongestionretry']+_0x3307fa[_0xa9a1('0x12a')]+_0x3307fa[_0xa9a1('0x12b')]+_0x3307fa[_0xa9a1('0xdc')]+_0x3307fa['countabandonedretry']+_0x3307fa['countmachineretry']+_0x3307fa['countagentrejectretry']>=_0x308b3a['dialGlobalMaxRetry']){_0x4ee8c2['stateGlobal'](_0x3307fa,_0x73f63d,_0x332fa2,_0xa9a1('0x12f'));}else{if(_0x3307fa[_0xa9a1('0x125')]>=_0x308b3a['dialMachineMaxRetry']){_0x4ee8c2['createStateFinal'](_0x3307fa,_0x73f63d,_0x332fa2,_0xa9a1('0x131'));}else{hopperUtils['rescheduleContact']({'active':![],'countmachineretry':_0x3307fa[_0xa9a1('0x125')],'scheduledat':moment()[_0xa9a1('0xe4')](_0x308b3a['dialMachineRetryFrequency'],_0xa9a1('0xe6'))[_0xa9a1('0x49')](_0xa9a1('0xcb')),'ContactId':_0x3307fa[_0xa9a1('0xe7')],'ListId':_0x3307fa[_0xa9a1('0xe8')],'VoiceQueueId':_0x3307fa[_0xa9a1('0xe9')]||undefined,'CampaignId':_0x3307fa['CampaignId']||undefined})[_0xa9a1('0xa7')](loggerCatch(_0xa9a1('0x138')));_0x73f63d({'reschedule':0x1});}}});}}};Dialer[_0xa9a1('0x1a')][_0xa9a1('0x38')]=function(_0x5a7851){var _0x2f215a=this[_0xa9a1('0x26')][_0x5a7851[_0xa9a1('0xc6')]];var _0x58ea24;if(_0x2f215a&&_0x2f215a[_0xa9a1('0x45')]===_0xa9a1('0xc7')){delete this[_0xa9a1('0x26')][_0x5a7851[_0xa9a1('0xc6')]];this[_0xa9a1('0xc8')](this['campaigns'][_0x2f215a[_0xa9a1('0xc9')]]);this['campaigns'][_0x2f215a[_0xa9a1('0xc9')]][_0xa9a1('0x139')]+=0x1;_0x58ea24=new Hangup(_0x2f215a,_0x5a7851);hopperUtils[_0xa9a1('0xd2')](_0x58ea24)[_0xa9a1('0xa7')](loggerCatch(_0xa9a1('0x13a')));hopperUtils[_0xa9a1('0xd3')](_0x58ea24)[_0xa9a1('0xa7')](loggerCatch(_0xa9a1('0x13b')));}if(_0x2f215a&&_0x2f215a[_0xa9a1('0x45')]!==_0xa9a1('0xc7')&&isNotNull(this['voiceQueues'][_0x2f215a[_0xa9a1('0xc9')]][_0xa9a1('0x13c')])){delete this['uniqueId'][_0x5a7851[_0xa9a1('0xc6')]];this['updateOriginated'](this[_0xa9a1('0x1f')][_0x2f215a[_0xa9a1('0xc9')]]);this['voiceQueues'][_0x2f215a[_0xa9a1('0xc9')]]['outboundAnswerCallsDay']+=0x1;this['voiceQueues'][_0x2f215a[_0xa9a1('0xc9')]][_0xa9a1('0x11d')]+=0x1;_0x58ea24=new Hangup(_0x2f215a,_0x5a7851);_0x58ea24[_0xa9a1('0x78')]=0x10;_0x58ea24[_0xa9a1('0xd9')]='AnswerAGI';_0x58ea24['membername']=_0xa9a1('0x13d');hopperUtils[_0xa9a1('0xd2')](_0x58ea24)[_0xa9a1('0xa7')](loggerCatch(_0xa9a1('0x13a')));hopperUtils[_0xa9a1('0xd3')](_0x58ea24)[_0xa9a1('0xa7')](loggerCatch('[syncHangupIvr]'));}if(_0x2f215a&&_0x2f215a[_0xa9a1('0x45')]!==_0xa9a1('0xc7')&&!isNotNull(this['voiceQueues'][_0x2f215a[_0xa9a1('0xc9')]][_0xa9a1('0x13c')])){delete this['uniqueId'][_0x5a7851['uniqueid']];this[_0xa9a1('0xc8')](this['voiceQueues'][_0x2f215a[_0xa9a1('0xc9')]]);this[_0xa9a1('0x1f')][_0x2f215a[_0xa9a1('0xc9')]][_0xa9a1('0x13e')]+=0x1;_0x58ea24=new Hangup(_0x2f215a,_0x5a7851);_0x58ea24[_0xa9a1('0x78')]=0xc;_0x58ea24[_0xa9a1('0xd9')]=_0x5a7851['cause-txt'];_0x58ea24['membername']='Unknow';hopperUtils[_0xa9a1('0xd2')](_0x58ea24)[_0xa9a1('0xa7')](loggerCatch(_0xa9a1('0x13a')));hopperUtils[_0xa9a1('0xd3')](_0x58ea24)[_0xa9a1('0xa7')](loggerCatch('[syncHangupIvr]'));}};Dialer[_0xa9a1('0x1a')]['syncQueueSummary']=function(_0x393df6){var _0x54dd9d=this;if(!_0x54dd9d[_0xa9a1('0x2b')][_0x393df6[_0xa9a1('0x4b')]]){_0x54dd9d[_0xa9a1('0x2b')][_0x393df6[_0xa9a1('0x4b')]]={'running':![]};}else if(_0x54dd9d['queuesSummary'][_0x393df6['name']][_0xa9a1('0x13f')]===!![]){return;}else if(_0x54dd9d[_0xa9a1('0x2b')][_0x393df6['name']][_0xa9a1('0x13f')]===![]){_0x54dd9d[_0xa9a1('0x2b')][_0x393df6[_0xa9a1('0x4b')]][_0xa9a1('0x13f')]=!![];}var _0x3fe200=_0x54dd9d[_0xa9a1('0x1f')][_0x393df6[_0xa9a1('0x4b')]];var _0x370a95=_0x3fe200['message']!==utils['CAMPAIGN_STATUS'][_0xa9a1('0x88')];var _0x3095a6=utils[_0xa9a1('0x140')](_0x3fe200);_0x3fe200[_0xa9a1('0x141')]=utils[_0xa9a1('0x142')](_0x3fe200,_0x54dd9d['trunks']);Promise[_0xa9a1('0xaf')]()[_0xa9a1('0x42')](function(){if(_0x3fe200[_0xa9a1('0x141')]===utils[_0xa9a1('0x73')]['INACTIVE']){if(_0x370a95){clearPredictiveAttributes(_0x3fe200);_0x393df6[_0xa9a1('0x69')]=undefined;_0x393df6['startProgressive']=undefined;}if(_0x3fe200[_0xa9a1('0x141')]===utils[_0xa9a1('0x73')]['INACTIVE']){_0x393df6[_0xa9a1('0x143')]=0x0;_0x393df6[_0xa9a1('0x100')]=0x0;_0x393df6[_0xa9a1('0x144')]=0x0;_0x393df6['talking']=0x0;_0x393df6[_0xa9a1('0x145')]=0x0;}}else if(_0x3fe200[_0xa9a1('0x141')]===utils[_0xa9a1('0x73')][_0xa9a1('0x146')]&&!_0x3095a6){return _0x54dd9d[_0xa9a1('0x99')](_0x3fe200,!![])[_0xa9a1('0x42')](function(){return _0x54dd9d[_0xa9a1('0x99')](_0x3fe200,![]);})[_0xa9a1('0x42')](function(){return _0x54dd9d['checkDialMethod'](_0x3fe200);})['catch'](function(_0x243590){loggerSyncQueueSummary['debug']('[syncQueueSummary]',util[_0xa9a1('0x48')](_0x243590,{'showHidden':![],'depth':null}));clearPredictiveAttributes(_0x3fe200);});}else{clearPredictiveAttributes(_0x3fe200);}})[_0xa9a1('0x42')](function(){var _0x1affd5=_0x393df6[_0xa9a1('0x147')](_0x3fe200);if(_0x1affd5||_0x3fe200['queueSummaryCountersUpdated']){_0x3fe200[_0xa9a1('0x148')]=![];_0x393df6['updateReportFromOutboundQueue'](_0x3fe200);Object['assign'](_0x3fe200,_0x393df6);emitOutboundVoiceQueueSummary(_0x393df6);}_0x54dd9d[_0xa9a1('0x2b')][_0x3fe200[_0xa9a1('0x4b')]][_0xa9a1('0x13f')]=![];})[_0xa9a1('0xa7')](function(_0x1901b9){logger[_0xa9a1('0x6d')]('[syncQueueSummary]',util['inspect'](_0x1901b9,{'showHidden':![],'depth':null}));_0x54dd9d[_0xa9a1('0x2b')][_0x3fe200[_0xa9a1('0x4b')]][_0xa9a1('0x13f')]=![];});};Dialer[_0xa9a1('0x1a')][_0xa9a1('0x36')]=_[_0xa9a1('0x149')](function(){var _0x5a45af=_[_0xa9a1('0x14a')](this[_0xa9a1('0x1f')],function(_0x1597e8){return _0x1597e8[_0xa9a1('0x14b')];});var _0x529dc4=_[_0xa9a1('0x14a')](this[_0xa9a1('0x21')],function(_0x5bbfc0){return _0x5bbfc0[_0xa9a1('0x14c')]&&_0x5bbfc0[_0xa9a1('0x91')]===_0xa9a1('0x90');});if(_0x5a45af[_0xa9a1('0x108')]>0x0&&_0x529dc4[_0xa9a1('0x108')]>0x0){return Promise['resolve']()['then'](cmHopper[_0xa9a1('0x14d')](_[_0xa9a1('0x14e')](_0x5a45af,'id'),previewRecallmeReminderInterval,_[_0xa9a1('0x14e')](_0x529dc4,'id')))[_0xa9a1('0x42')](function(_0x5d42bd){for(var _0xd255ae=0x0;_0xd255ae<_0x5d42bd[_0xa9a1('0x108')];_0xd255ae++){var _0x3ed74e=_0x5d42bd[_0xd255ae][_0xa9a1('0x14f')][_0xa9a1('0x4b')];if(_0x3ed74e)io['to'](util[_0xa9a1('0x49')]('user:%s',_0x3ed74e))[_0xa9a1('0x44')](_0xa9a1('0x150'),{'hopper':_0x5d42bd[_0xd255ae]});}})[_0xa9a1('0xa7')](function(_0xa8902f){logger[_0xa9a1('0x6d')](_0xa9a1('0x151'),_0xa8902f);});}},0x3c*0x3e8,{'leading':!![]});Dialer['prototype']['loopClearZombieChannels']=function(){var _0x5c41d4=this;setInterval(function(){_0x5c41d4[_0xa9a1('0x152')](_0x5c41d4[_0xa9a1('0x26')],_0xa9a1('0x153'));_0x5c41d4['clearZombieChannels'](_0x5c41d4[_0xa9a1('0x24')],_0xa9a1('0x154'));},0x32c8);};Dialer[_0xa9a1('0x1a')][_0xa9a1('0x152')]=function(_0x1bcfc3,_0x54d2ef){var _0x53642d=this;for(var _0xa57324 in _0x1bcfc3){if(typeof _0x1bcfc3[_0xa57324]!==_0xa9a1('0xae')){this['sequence'][_0xa9a1('0x1b')](function(){if(!_[_0xa9a1('0xfc')](_0x1bcfc3[_0xa57324])){return ami[_0xa9a1('0xa0')]({'action':_0xa9a1('0x91'),'channel':_0x1bcfc3[_0xa57324]['channel']})[_0xa9a1('0xa7')](function(_0x23e65c){if(_0x23e65c[_0xa9a1('0x72')]===_0xa9a1('0x155')){setTimeout(function(){if(_0x1bcfc3[_0xa57324]&&_0x1bcfc3[_0xa57324]['type']!==_0xa9a1('0xc7')){_0x53642d[_0xa9a1('0xc8')](_0x53642d['voiceQueues'][_0x1bcfc3[_0xa57324][_0xa9a1('0xc9')]]);logger[_0xa9a1('0x6d')](_0xa9a1('0x156'),_0x54d2ef,_0xa57324,_0x1bcfc3[_0xa57324]['queue']);delete _0x1bcfc3[_0xa57324];}if(_0x1bcfc3[_0xa57324]&&_0x1bcfc3[_0xa57324][_0xa9a1('0x45')]===_0xa9a1('0xc7')){_0x53642d[_0xa9a1('0xc8')](_0x53642d[_0xa9a1('0x20')][_0x1bcfc3[_0xa57324][_0xa9a1('0xc9')]]);logger[_0xa9a1('0x6d')](_0xa9a1('0x157'),_0x54d2ef,_0xa57324,_0x1bcfc3[_0xa57324][_0xa9a1('0xc9')]);delete _0x1bcfc3[_0xa57324];}},0x2328);}});}});}}};Dialer[_0xa9a1('0x1a')][_0xa9a1('0x158')]=function(_0x3a0e88){return Promise[_0xa9a1('0xaf')]()[_0xa9a1('0x42')](voiceQueueRt[_0xa9a1('0x158')](_0x3a0e88))[_0xa9a1('0xa7')](loggerCatch('[getVoiceQueueRtPauses]\x20'));};Dialer[_0xa9a1('0x1a')][_0xa9a1('0xc8')]=function(_0x5fe129){if(!_[_0xa9a1('0x5b')](_0x5fe129)&&_0x5fe129!==null){if(typeof _0x5fe129[_0xa9a1('0x87')]!==_0xa9a1('0xae')){if(_0x5fe129[_0xa9a1('0x87')]>0x0){_0x5fe129[_0xa9a1('0x87')]-=0x1;}else{logger[_0xa9a1('0x6d')]('[updateOriginated]\x20object\x20originated\x20is\x20negative');}}}else{logger[_0xa9a1('0x6d')]('[updateOriginated]\x20is\x20null\x20or\x20undefined');}};Dialer[_0xa9a1('0x1a')]['loggerHandler']=function(_0xf4f097,_0x5d7960){var _0x1db4c7=this;return function(_0x384c30){_0x1db4c7[_0xa9a1('0xc8')](_0x5d7960);logger[_0xa9a1('0x6d')](_0xf4f097,util[_0xa9a1('0x48')](_0x384c30,{'showHidden':![],'depth':null}));};};Dialer[_0xa9a1('0x1a')][_0xa9a1('0x159')]=function(_0xafd1df,_0xb95713,_0x1103cf){var _0x41538f={'state':0x19,'statedesc':_0xa9a1('0x15a')};this[_0xa9a1('0xc8')](_0xb95713);this[_0xa9a1('0x134')](_[_0xa9a1('0x66')](_0x41538f,_['pick'](_0x1103cf,[_0xa9a1('0xe7'),_0xa9a1('0xe8'),_0xa9a1('0x15b'),'VoiceQueueId',_0xa9a1('0xea')])),_0xa9a1('0x15c'),_0xa9a1('0x15d'));logger[_0xa9a1('0x6d')](_0xafd1df);};Dialer[_0xa9a1('0x1a')]['saveInDb']=function(_0x8d4efc,_0x69a546,_0x22ec85){hopperUtils[_0xa9a1('0xd2')](_0x8d4efc)['catch'](loggerCatch(_0x69a546));hopperUtils[_0xa9a1('0xd3')](_0x8d4efc)[_0xa9a1('0xa7')](loggerCatch(_0x22ec85));};Dialer[_0xa9a1('0x1a')][_0xa9a1('0xe2')]=function(_0x292562,_0x3f7b71){hopperUtils[_0xa9a1('0xd2')](_0x292562)[_0xa9a1('0xa7')](loggerCatch(_0xa9a1('0x15e')));if(_0x3f7b71==0x0){hopperUtils[_0xa9a1('0xd3')](_0x292562)[_0xa9a1('0xa7')](loggerCatch('[syncQueueCallerAbandon]\x20[Drop]'));}};Dialer[_0xa9a1('0x1a')]['checkPreviewRecallReminder']=function(_0x3a89c4){return Promise[_0xa9a1('0xaf')]()[_0xa9a1('0x42')](cmHopper[_0xa9a1('0x14d')](_0x3a89c4['id'],previewRecallmeReminderInterval))[_0xa9a1('0x42')](function(_0x3e3f9e){for(var _0x4ae57b=0x0;_0x4ae57b<_0x3e3f9e[_0xa9a1('0x108')];_0x4ae57b++){var _0xec2055=_0x3e3f9e[_0x4ae57b][_0xa9a1('0x14f')][_0xa9a1('0x4b')];if(_0xec2055)io['to'](util['format'](_0xa9a1('0x15f'),_0xec2055))[_0xa9a1('0x44')](_0xa9a1('0x150'),{'hopper':_0x3e3f9e[_0x4ae57b]});}})['catch'](function(){});};Dialer[_0xa9a1('0x1a')]['launchHandleIvr']=function(_0x57d371){var _0x286e70=this;return function(){_0x286e70[_0xa9a1('0x160')](_0x57d371);};};Dialer[_0xa9a1('0x1a')][_0xa9a1('0x161')]=function(_0x2510ce,_0xdd7919){var _0x2f4e4a=this;var _0xd030e9=uuid['v4']();this[_0xa9a1('0x24')][_0xd030e9]=new Action(_0x2510ce,_0xdd7919,_0xd030e9);return new Promise(function(_0x57702a,_0x38f6ba){if(_[_0xa9a1('0x5b')](_0x2510ce)&&typeof _0x2510ce!==_0xa9a1('0x162')){return _0x38f6ba(msgResponse(_0xa9a1('0x163'),_0xa9a1('0x9e'),_0xa9a1('0x164')));}if(_['isUndefined'](_0xdd7919[_0xa9a1('0x165')])||_0xdd7919[_0xa9a1('0x165')]===null){return _0x38f6ba(msgResponse('originate',_0xa9a1('0x9e'),_0xa9a1('0x166')));}var _0x4db7e9={'XMD-CALLERID':_0x2f4e4a[_0xa9a1('0x24')][_0xd030e9][_0xa9a1('0x167')](),'XMD-AGI':_0x2510ce[_0xa9a1('0x13c')]?util[_0xa9a1('0x49')](_0xa9a1('0x168'),ipAgi,_0x2510ce[_0xa9a1('0x13c')]):_0xa9a1('0x169'),'XMD-AGIAFTER':_0x2510ce[_0xa9a1('0xd0')]?util[_0xa9a1('0x49')]('\x22agi://%s/square,%s\x22',ipAgi,_0x2510ce[_0xa9a1('0xd0')]):_0xa9a1('0x169'),'XMD-QUEUE':utils['isOutboundQueue'](_0x2510ce)?util['format']('\x22%s,%s%s,,,%s\x22',_0x2510ce['name'],_0x2510ce[_0xa9a1('0x16a')]||'',_0x2510ce[_0xa9a1('0xd1')]?'c':'',_0x2510ce[_0xa9a1('0xd7')]||0x3):_0xa9a1('0x169'),'XMD-CONTACTID':_0xdd7919['ContactId'],'XMD-CDRTYPE':_0xa9a1('0x9'),'CALLERID(all)':_0x2f4e4a[_0xa9a1('0x24')][_0xd030e9][_0xa9a1('0x167')](),'XMD-AMD':_0x2510ce['dialAMDActive']?_0xa9a1('0x146'):_0xa9a1('0x169'),'XMD-DESTINATION':'xcally-motion-dialer'};if(_0x2510ce[_0xa9a1('0x11b')]){_0x4db7e9[_0xa9a1('0x16b')]=_0x2510ce[_0xa9a1('0x16c')]||0x9c4;_0x4db7e9['XMD-AMDGREETING']=_0x2510ce[_0xa9a1('0x16d')]||0x5dc;_0x4db7e9[_0xa9a1('0x16e')]=_0x2510ce['dialAMDAfterGreetingSilence']||0x320;_0x4db7e9[_0xa9a1('0x16f')]=_0x2510ce[_0xa9a1('0x170')]||0x1388;_0x4db7e9['XMD-AMDMINWORDLENGTH']=_0x2510ce[_0xa9a1('0x171')]||0x64;_0x4db7e9[_0xa9a1('0x172')]=_0x2510ce['dialAMDBetweenWordsSilence']||0x32;_0x4db7e9[_0xa9a1('0x173')]=_0x2510ce[_0xa9a1('0x174')]||0x3;_0x4db7e9[_0xa9a1('0x175')]=_0x2510ce[_0xa9a1('0x176')]||0x100;_0x4db7e9[_0xa9a1('0x177')]=_0x2510ce['dialAMDMaximumWordLength']||0x1388;}if(utils[_0xa9a1('0x178')](_0x2510ce)){_0x4db7e9['XMD-VOICEQUEUEID']=_0xdd7919[_0xa9a1('0xe9')];}else{_0x4db7e9[_0xa9a1('0x179')]=_0xdd7919['CampaignId'];}var _0x16305d=utils[_0xa9a1('0x17a')](_0xdd7919['Contact']);Object[_0xa9a1('0x17b')](_0x4db7e9,_0x16305d);var _0x59d7f6=_0x2f4e4a[_0xa9a1('0x8e')](_0x2510ce[_0xa9a1('0x17c')])?utils[_0xa9a1('0x17d')](_0x2510ce[_0xa9a1('0x17c')]['callerid'],_0x2510ce['dialOriginateCallerIdName'],_0x2510ce[_0xa9a1('0x17e')]>0x0?utils[_0xa9a1('0x17f')](_0x2510ce[_0xa9a1('0x180')],_0x2510ce[_0xa9a1('0x17e')]):_0x2510ce[_0xa9a1('0x180')]):utils['getCallerId'](_[_0xa9a1('0xfc')](_0x2510ce[_0xa9a1('0x94')])?_0x2510ce[_0xa9a1('0x17c')][_0xa9a1('0x181')]:_0x2510ce[_0xa9a1('0x94')]['callerid'],_0x2510ce[_0xa9a1('0x182')],_0x2510ce['dialRandomLastDigitCallerIdNumber']>0x0?utils['getCallerIdRandom'](_0x2510ce[_0xa9a1('0x180')],_0x2510ce[_0xa9a1('0x17e')]):_0x2510ce[_0xa9a1('0x180')]);if(_0x59d7f6){_0x4db7e9[_0xa9a1('0x183')]=_0x2f4e4a[_0xa9a1('0x24')][_0xd030e9][_0xa9a1('0x184')]=utils[_0xa9a1('0x185')](_0x59d7f6);_0x4db7e9['XMD-ORIGINATECALLERIDNUM']=_0xdd7919[_0xa9a1('0x165')];}_0x2510ce[_0xa9a1('0x186')]=_0x4db7e9;return ami[_0xa9a1('0xa0')]({'actionid':_0xd030e9,'action':_0xa9a1('0x163'),'channel':_0x2f4e4a['isTrunkReachable'](_0x2510ce['Trunk'])?util[_0xa9a1('0x49')](_0xa9a1('0x187'),_0x2510ce['Trunk']['name'],isNotNull(_0x2510ce[_0xa9a1('0x188')])?_0x2510ce[_0xa9a1('0x188')][_0xa9a1('0x189')]()||'':'',_0x2510ce[_0xa9a1('0x18a')]>0x0?_0xdd7919['phone'][_0xa9a1('0x18b')](_0x2510ce[_0xa9a1('0x18a')]):_0xdd7919[_0xa9a1('0x165')]):util['format'](_0xa9a1('0x187'),_['isNil'](_0x2510ce['TrunkBackup'])?_0x2510ce[_0xa9a1('0x17c')]['name']:_0x2510ce[_0xa9a1('0x94')][_0xa9a1('0x4b')],isNotNull(_0x2510ce[_0xa9a1('0x188')])?_0x2510ce[_0xa9a1('0x188')][_0xa9a1('0x189')]()||'':'',_0x2510ce['dialCutDigit']>0x0?_0xdd7919[_0xa9a1('0x165')][_0xa9a1('0x18b')](_0x2510ce[_0xa9a1('0x18a')]):_0xdd7919[_0xa9a1('0x165')]),'callerid':_0x59d7f6,'Exten':_0xa9a1('0x11a'),'Context':_0xa9a1('0x18c'),'Priority':'1','variable':_0x4db7e9,'timeout':(_0x2510ce['dialOriginateTimeout']||0x1e)*0x3e8,'async':!![],'channelid':_0xd030e9})[_0xa9a1('0x42')](function(_0x13b6a5){return _0x57702a(_0x13b6a5);})[_0xa9a1('0xa7')](function(_0x3005d7){_0x2510ce[_0xa9a1('0x18d')]+=0x1;var _0x350cd0=new History(_0x2f4e4a[_0xa9a1('0x24')][_0xd030e9]);logger[_0xa9a1('0x6d')](util[_0xa9a1('0x49')](_0xa9a1('0x18e'),JSON[_0xa9a1('0x7e')](_0x3005d7)));_0x350cd0[_0xa9a1('0x78')]=0xe;_0x350cd0['statedesc']=_0xa9a1('0x18f');_0x350cd0['starttime']=moment()['format'](_0xa9a1('0xcb'));_0x350cd0[_0xa9a1('0x79')]=_0x350cd0[_0xa9a1('0x7a')];hopperUtils[_0xa9a1('0xd2')](_0x350cd0)[_0xa9a1('0xa7')](loggerCatch(_0xa9a1('0x190')));_0x2f4e4a[_0xa9a1('0xd3')](_0x350cd0)[_0xa9a1('0xa7')](loggerCatch(_0xa9a1('0x190')))[_0xa9a1('0x1d')](function(){delete _0x2f4e4a[_0xa9a1('0x24')][_0xd030e9];return _0x38f6ba(msgResponse(_0xa9a1('0x163'),'Error',_0xa9a1('0x191')));});});});};Dialer['prototype'][_0xa9a1('0x192')]=function(_0x53954a,_0x2c93bc,_0x283a9c){var _0xafc85f=new History(_0x2c93bc);if(_0xafc85f[_0xa9a1('0x193')]+_0xafc85f['countcongestionretry']+_0xafc85f['countnoanswerretry']+_0xafc85f[_0xa9a1('0x12b')]+_0xafc85f[_0xa9a1('0xdc')]+_0xafc85f['countabandonedretry']+_0xafc85f[_0xa9a1('0x125')]+_0xafc85f[_0xa9a1('0x12c')]>=_0x283a9c[_0xa9a1('0x12d')]-0x1){return!![];}switch(_0x53954a){case 0x3:if(_0xafc85f[_0xa9a1('0x12a')]>=_0x283a9c[_0xa9a1('0x194')]-0x1){return!![];}hopperUtils[_0xa9a1('0xe3')]({'active':![],'countnoanswerretry':_0xafc85f['countnoanswerretry']+=0x1,'scheduledat':moment()[_0xa9a1('0xe4')](_0x283a9c[_0xa9a1('0x195')],_0xa9a1('0xe6'))['format'](_0xa9a1('0xcb')),'ContactId':_0xafc85f[_0xa9a1('0xe7')],'ListId':_0xafc85f[_0xa9a1('0xe8')],'VoiceQueueId':_0xafc85f[_0xa9a1('0xe9')]||undefined,'CampaignId':_0xafc85f[_0xa9a1('0xea')]||undefined})['catch'](loggerCatch('[rescheduleContact][NoAnswer]'));break;case 0x5:if(_0xafc85f[_0xa9a1('0x193')]>=_0x283a9c[_0xa9a1('0x196')]-0x1){return!![];}hopperUtils[_0xa9a1('0xe3')]({'active':![],'countbusyretry':_0xafc85f['countbusyretry']+=0x1,'scheduledat':moment()[_0xa9a1('0xe4')](_0x283a9c[_0xa9a1('0x197')],_0xa9a1('0xe6'))[_0xa9a1('0x49')](_0xa9a1('0xcb')),'ContactId':_0xafc85f[_0xa9a1('0xe7')],'ListId':_0xafc85f[_0xa9a1('0xe8')],'VoiceQueueId':_0xafc85f[_0xa9a1('0xe9')]||undefined,'CampaignId':_0xafc85f[_0xa9a1('0xea')]||undefined})[_0xa9a1('0xa7')](loggerCatch(_0xa9a1('0x198')));break;case 0x8:if(_0xafc85f[_0xa9a1('0x129')]>=_0x283a9c[_0xa9a1('0x199')]-0x1){return!![];}hopperUtils[_0xa9a1('0xe3')]({'active':![],'countcongestionretry':_0xafc85f[_0xa9a1('0x129')]+=0x1,'scheduledat':moment()[_0xa9a1('0xe4')](_0x283a9c['dialCongestionRetryFrequency'],_0xa9a1('0xe6'))[_0xa9a1('0x49')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0xafc85f[_0xa9a1('0xe7')],'ListId':_0xafc85f[_0xa9a1('0xe8')],'VoiceQueueId':_0xafc85f[_0xa9a1('0xe9')]||undefined,'CampaignId':_0xafc85f[_0xa9a1('0xea')]||undefined})[_0xa9a1('0xa7')](loggerCatch(_0xa9a1('0x19a')));break;case 0x0:if(_0xafc85f[_0xa9a1('0x12b')]>=_0x283a9c[_0xa9a1('0x19b')]-0x1){return!![];}else{hopperUtils[_0xa9a1('0xe3')]({'active':![],'countnosuchnumberretry':_0xafc85f[_0xa9a1('0x12b')]+=0x1,'scheduledat':moment()['add'](_0x283a9c['dialNoSuchNumberRetryFrequency'],_0xa9a1('0xe6'))[_0xa9a1('0x49')](_0xa9a1('0xcb')),'ContactId':_0xafc85f[_0xa9a1('0xe7')],'ListId':_0xafc85f[_0xa9a1('0xe8')],'VoiceQueueId':_0xafc85f[_0xa9a1('0xe9')]||undefined,'CampaignId':_0xafc85f[_0xa9a1('0xea')]||undefined})[_0xa9a1('0xa7')](loggerCatch(_0xa9a1('0x19c')));}break;case 0xa:if(_0xafc85f[_0xa9a1('0xdc')]>=_0x283a9c[_0xa9a1('0xe1')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countdropretry':_0xafc85f[_0xa9a1('0xdc')]+=0x1,'scheduledat':moment()[_0xa9a1('0xe4')](_0x283a9c[_0xa9a1('0xe5')],_0xa9a1('0xe6'))[_0xa9a1('0x49')](_0xa9a1('0xcb')),'ContactId':_0xafc85f[_0xa9a1('0xe7')],'ListId':_0xafc85f[_0xa9a1('0xe8')],'VoiceQueueId':_0xafc85f['VoiceQueueId']||undefined,'CampaignId':_0xafc85f['CampaignId']||undefined})[_0xa9a1('0xa7')](loggerCatch('[rescheduleContact][Drop]'));break;case 0xb:if(_0xafc85f['countabandonedretry']>=_0x283a9c[_0xa9a1('0xf6')]-0x1){return!![];}hopperUtils[_0xa9a1('0xe3')]({'active':![],'countabandonedretry':_0xafc85f[_0xa9a1('0xf3')]+=0x1,'scheduledat':moment()[_0xa9a1('0xe4')](_0x283a9c['dialAbandonedRetryFrequency'],_0xa9a1('0xe6'))['format'](_0xa9a1('0xcb')),'ContactId':_0xafc85f[_0xa9a1('0xe7')],'ListId':_0xafc85f[_0xa9a1('0xe8')],'VoiceQueueId':_0xafc85f['VoiceQueueId']||undefined,'CampaignId':_0xafc85f[_0xa9a1('0xea')]||undefined})['catch'](loggerCatch(_0xa9a1('0xf7')));break;case 0x13:if(_0xafc85f[_0xa9a1('0x125')]>=_0x283a9c['dialMachineMaxRetry']-0x1){return!![];}hopperUtils[_0xa9a1('0xe3')]({'active':![],'countmachineretry':_0xafc85f[_0xa9a1('0x125')]+=0x1,'scheduledat':moment()[_0xa9a1('0xe4')](_0x283a9c[_0xa9a1('0x132')],_0xa9a1('0xe6'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0xafc85f[_0xa9a1('0xe7')],'ListId':_0xafc85f['ListId'],'VoiceQueueId':_0xafc85f[_0xa9a1('0xe9')]||undefined,'CampaignId':_0xafc85f[_0xa9a1('0xea')]||undefined})[_0xa9a1('0xa7')](loggerCatch(_0xa9a1('0x138')));break;case 0x14:if(_0xafc85f['countagentrejectretry']>=_0x283a9c[_0xa9a1('0x19d')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countagentrejectretry':_0xafc85f[_0xa9a1('0x12c')]+=0x1,'scheduledat':moment()[_0xa9a1('0xe4')](_0x283a9c[_0xa9a1('0x19e')],_0xa9a1('0xe6'))[_0xa9a1('0x49')](_0xa9a1('0xcb')),'ContactId':_0xafc85f[_0xa9a1('0xe7')],'ListId':_0xafc85f['ListId'],'VoiceQueueId':_0xafc85f['VoiceQueueId']||undefined,'CampaignId':_0xafc85f['CampaignId']||undefined})[_0xa9a1('0xa7')](loggerCatch('[rescheduleContact][AgentReject]'));break;default:return!![];}};Dialer[_0xa9a1('0x1a')][_0xa9a1('0x115')]=function(_0x4eb5df,_0x3aaadf,_0x580c28){var _0x471e6e=this;var _0x3db44a=new History(_0x4eb5df);var _0xedb442=![];var _0x10f82c;var _0x392cf4;return new Promise(function(_0x2fad99,_0x62407e){if(_[_0xa9a1('0x5b')](_0x3aaadf)&&typeof _0x3aaadf!==_0xa9a1('0x162')){return _0x62407e(msgResponse('[callProgressDetecting]',_0xa9a1('0x9e'),_0xa9a1('0x19f')));}if(_[_0xa9a1('0x5b')](_0x580c28)&&typeof _0x580c28!==_0xa9a1('0x162')){return _0x62407e(msgResponse(_0xa9a1('0x1a0'),'Failure','evt\x20is\x20undefine'));}hopperUtils['verifyAdditionalPhones'](_0x3db44a,_0x580c28[_0xa9a1('0xcd')],_0x3aaadf)['then'](function(_0x58493d){if(_0x58493d[_0xa9a1('0xe0')]==0x1)_0xedb442=!![];switch(_0x580c28['reason']){case'0':_0x3aaadf[_0xa9a1('0x1a1')]+=0x1;_0x3db44a['state']=0x0;_0x3db44a[_0xa9a1('0xd9')]=_0xa9a1('0x1a2');_0x3db44a[_0xa9a1('0x12b')]+=0x1;_0x3db44a['countglobal']+=0x1;ami[_0xa9a1('0x44')](_0xa9a1('0x1a3'),ut[_0xa9a1('0x121')](_0x4eb5df,_0xa9a1('0x1a4')));_0x10f82c=_0x3aaadf[_0xa9a1('0x1a5')];_0x392cf4=_0x3aaadf[_0xa9a1('0xf5')];hopperUtils[_0xa9a1('0xd2')](_0x3db44a)[_0xa9a1('0xa7')](loggerCatch(_0xa9a1('0x128')));if(_0x471e6e[_0xa9a1('0x192')](0x0,_0x4eb5df,_0x3aaadf)&&!_0xedb442){if(_0x3db44a['countnosuchnumberretry']>=_0x3aaadf['dialNoSuchNumberMaxRetry']){_0x471e6e[_0xa9a1('0x1a6')](_0x3db44a,_0x2fad99,_0x62407e,'reason\x200\x20no\x20such\x20number....');}else{_0x471e6e[_0xa9a1('0x12e')](_0x3db44a,_0x2fad99,_0x62407e,'reason\x200\x20no\x20such\x20number....');}}break;case'3':_0x3aaadf[_0xa9a1('0x1a7')]+=0x1;_0x3db44a['state']=0x3;_0x3db44a[_0xa9a1('0xd9')]=_0xa9a1('0x1a8');_0x3db44a[_0xa9a1('0x12a')]+=0x1;_0x3db44a[_0xa9a1('0xdd')]+=0x1;var _0x1d2ba0=ut[_0xa9a1('0x1a9')](_0x4eb5df,_0x3aaadf);ami['emit']('custom:agentnoanswer',_0x1d2ba0);_0x10f82c=_0x3aaadf[_0xa9a1('0x195')];_0x392cf4=_0x3aaadf[_0xa9a1('0xf5')];hopperUtils[_0xa9a1('0xd2')](_0x3db44a)[_0xa9a1('0xa7')](loggerCatch(_0xa9a1('0x1aa')));if(_0x471e6e[_0xa9a1('0x192')](0x3,_0x4eb5df,_0x3aaadf)&&!_0xedb442){if(_0x3db44a[_0xa9a1('0x12a')]>=_0x3aaadf['dialNoAnswerMaxRetry']){_0x471e6e[_0xa9a1('0x1a6')](_0x3db44a,_0x2fad99,_0x62407e,_0xa9a1('0x1ab'));}else{_0x471e6e['stateGlobal'](_0x3db44a,_0x2fad99,_0x62407e,'reason\x203\x20ringing\x20no\x20answer');}}break;case'5':_0x3aaadf[_0xa9a1('0x1ac')]+=0x1;_0x3db44a['state']=0x5;_0x3db44a[_0xa9a1('0xd9')]=_0xa9a1('0x1ad');_0x3db44a['countbusyretry']+=0x1;_0x3db44a[_0xa9a1('0xdd')]+=0x1;ami[_0xa9a1('0x44')]('custom:agentbusy',ut[_0xa9a1('0x121')](_0x4eb5df,'busy'));_0x10f82c=_0x3aaadf[_0xa9a1('0x197')];_0x392cf4=_0x3aaadf[_0xa9a1('0xf5')];hopperUtils['createHistory'](_0x3db44a)[_0xa9a1('0xa7')](loggerCatch(_0xa9a1('0x1ae')));if(_0x471e6e[_0xa9a1('0x192')](0x5,_0x4eb5df,_0x3aaadf)&&!_0xedb442){if(_0x3db44a[_0xa9a1('0x193')]>=_0x3aaadf['dialBusyMaxRetry']){_0x471e6e[_0xa9a1('0x1a6')](_0x3db44a,_0x2fad99,_0x62407e,_0xa9a1('0x1af'));}else{_0x471e6e[_0xa9a1('0x12e')](_0x3db44a,_0x2fad99,_0x62407e,_0xa9a1('0x1af'));}}break;case'8':_0x3aaadf[_0xa9a1('0x1b0')]+=0x1;_0x3db44a[_0xa9a1('0x78')]=0x8;_0x3db44a[_0xa9a1('0xd9')]=_0xa9a1('0x1b1');_0x3db44a['countcongestionretry']+=0x1;_0x3db44a['countglobal']+=0x1;_0x10f82c=_0x3aaadf[_0xa9a1('0x1b2')];_0x392cf4=_0x3aaadf[_0xa9a1('0xf5')];ami[_0xa9a1('0x44')](_0xa9a1('0x1b3'),ut[_0xa9a1('0x121')](_0x4eb5df,'congestion'));hopperUtils[_0xa9a1('0xd2')](_0x3db44a)[_0xa9a1('0xa7')](loggerCatch(_0xa9a1('0x1b4')));if(_0x471e6e[_0xa9a1('0x192')](0x8,_0x4eb5df,_0x3aaadf)&&!_0xedb442){if(_0x3db44a[_0xa9a1('0x129')]>=_0x3aaadf[_0xa9a1('0x199')]){_0x471e6e[_0xa9a1('0x1a6')](_0x3db44a,_0x2fad99,_0x62407e,_0xa9a1('0x1b5'));}else{_0x471e6e[_0xa9a1('0x12e')](_0x3db44a,_0x2fad99,_0x62407e,_0xa9a1('0x1b5'));}}break;case'11':_0x3aaadf[_0xa9a1('0x1b6')]+=0x1;_0x3db44a[_0xa9a1('0x78')]=0xb;_0x3db44a[_0xa9a1('0xd9')]=_0xa9a1('0xf1');_0x3db44a['countabandonedretry']+=0x1;_0x3db44a[_0xa9a1('0xdd')]+=0x1;_0x10f82c=_0x3aaadf[_0xa9a1('0xf4')];_0x392cf4=_0x3aaadf[_0xa9a1('0xf5')];hopperUtils['createHistory'](_0x3db44a)[_0xa9a1('0xa7')](loggerCatch(_0xa9a1('0xf8')));if(_0x471e6e[_0xa9a1('0x192')](0xb,_0x4eb5df,_0x3aaadf)&&!_0xedb442){if(_0x3db44a[_0xa9a1('0xf3')]>=_0x3aaadf[_0xa9a1('0xf6')]){_0x471e6e[_0xa9a1('0x1a6')](_0x3db44a,_0x2fad99,_0x62407e,'reason\x2011\x20abandoned');}else{_0x471e6e[_0xa9a1('0x12e')](_0x3db44a,_0x2fad99,_0x62407e,'reason\x2011\x20abandoned');}}break;case'20':_0x3aaadf[_0xa9a1('0x1b7')]+=0x1;_0x3db44a[_0xa9a1('0x78')]=0x14;_0x3db44a[_0xa9a1('0xd9')]=_0xa9a1('0x1b8');_0x3db44a[_0xa9a1('0x12c')]+=0x1;_0x3db44a[_0xa9a1('0xdd')]+=0x1;_0x10f82c=_0x3aaadf[_0xa9a1('0x19e')];_0x392cf4=_0x3aaadf['callAdditionalPhoneAfterMin'];ami[_0xa9a1('0x44')](_0xa9a1('0x1b9'),ut[_0xa9a1('0x121')](_0x4eb5df,_0xa9a1('0x1ba')));hopperUtils[_0xa9a1('0xd2')](_0x3db44a)[_0xa9a1('0xa7')](loggerCatch('[syncAgentComplete][createHistory][20]'));if(_0x471e6e[_0xa9a1('0x192')](0x14,_0x4eb5df,_0x3aaadf)&&!_0xedb442){if(_0x3db44a[_0xa9a1('0x12c')]>=_0x3aaadf[_0xa9a1('0x19d')]){_0x471e6e['createStateFinal'](_0x3db44a,_0x2fad99,_0x62407e,_0xa9a1('0x1bb'));}else{_0x471e6e[_0xa9a1('0x12e')](_0x3db44a,_0x2fad99,_0x62407e,_0xa9a1('0x1bb'));}}break;default:_0x3aaadf[_0xa9a1('0x13e')]+=0x1;_0x3db44a[_0xa9a1('0x78')]=0xc;_0x3db44a[_0xa9a1('0xd9')]=_0x580c28[_0xa9a1('0xcd')];_0x10f82c=_0x3aaadf[_0xa9a1('0x19e')];_0x392cf4=_0x3aaadf[_0xa9a1('0xf5')];hopperUtils[_0xa9a1('0xd2')](_0x3db44a)[_0xa9a1('0xa7')](loggerCatch('[syncAgentComplete][createHistory][?]'));if(_0x471e6e[_0xa9a1('0x192')](_0x580c28[_0xa9a1('0xcd')],_0x4eb5df,_0x3aaadf)&&!_0xedb442){if(_0x3db44a['countbusyretry']+_0x3db44a[_0xa9a1('0x129')]+_0x3db44a['countnoanswerretry']+_0x3db44a[_0xa9a1('0x12b')]+_0x3db44a[_0xa9a1('0xdc')]+_0x3db44a['countabandonedretry']+_0x3db44a[_0xa9a1('0x125')]+_0x3db44a[_0xa9a1('0x12c')]>=_0x3aaadf[_0xa9a1('0x12d')]){_0x471e6e['stateGlobal'](_0x3db44a,_0x2fad99,_0x62407e,_0x580c28['reason']);}else{_0x471e6e[_0xa9a1('0x1a6')](_0x3db44a,_0x2fad99,_0x62407e,_0x580c28[_0xa9a1('0xcd')]);}}}})['then'](function(){if(_0xedb442){hopperUtils[_0xa9a1('0xef')](_0x3db44a,_0x10f82c,_0x392cf4)[_0xa9a1('0x42')](function(){return _0x2fad99(0x1);});}});});};Dialer['prototype'][_0xa9a1('0x12e')]=function(_0x6aacd2,_0x4e1d0c,_0x2f05af,_0x255fa0){var _0x4ec4fd=new Final(_0x6aacd2);_0x4ec4fd[_0xa9a1('0x78')]=0xf;_0x4ec4fd[_0xa9a1('0xd9')]=_0xa9a1('0x1bc');this[_0xa9a1('0x1a6')](_0x4ec4fd,_0x4e1d0c,_0x2f05af,_0x255fa0);};Dialer[_0xa9a1('0x1a')][_0xa9a1('0x1a6')]=function(_0x28ebcb,_0x12bb4c,_0x4a87fb,_0x557052){hopperUtils[_0xa9a1('0xd3')](_0x28ebcb)['then'](function(){return _0x12bb4c(msgResponse('[callProgressDetecting]','Success',_0x557052));})[_0xa9a1('0xa7')](function(){return _0x4a87fb(msgResponse(_0xa9a1('0x1bd'),_0xa9a1('0x9e'),'contact\x20not\x20moved'));});};Dialer[_0xa9a1('0x1a')]['predictive']=function(_0x345b98){var _0x441bdc=_0x345b98[_0xa9a1('0x1be')]/0x64;var _0x18d9f9=_0x345b98[_0xa9a1('0xd8')]/(_0x345b98['outboundDropCallsDayTimeout']+_0x345b98[_0xa9a1('0xcc')]);var _0x5bbaea=Math['round'](_0x345b98[_0xa9a1('0x1bf')]*(_0x345b98[_0xa9a1('0x1c0')]/0x64));var _0x3db33b=Math[_0xa9a1('0x1c1')](_0x345b98[_0xa9a1('0x1bf')]*(_0x345b98[_0xa9a1('0x1c2')]/0x64));var _0x3ab922=_0x345b98['available']+_0x345b98['talking'];var _0x12a699=Math[_0xa9a1('0x1c3')](_0x345b98[_0xa9a1('0x1c4')]*_0x345b98[_0xa9a1('0x63')]*_0x345b98[_0xa9a1('0x1c5')]*_0x345b98[_0xa9a1('0x1c6')]);if(_[_0xa9a1('0x5b')](_0x345b98['startProgressive'])){if(!_[_0xa9a1('0x5b')](_0x345b98[_0xa9a1('0x69')])){_0x345b98[_0xa9a1('0x69')]=undefined;loggerPredictive['error']('[startMethodPredictive][StartProgressive]',_0xa9a1('0x1c7'));}if(!_[_0xa9a1('0x5b')](_0x345b98[_0xa9a1('0x6b')])){loggerPredictive[_0xa9a1('0x6d')](_0xa9a1('0x1c8'),_0xa9a1('0x1c9'));clearInterval(_0x345b98[_0xa9a1('0x6b')]);_0x345b98[_0xa9a1('0x6b')]=undefined;}_0x345b98['startProgressive']=moment()[_0xa9a1('0x49')](_0xa9a1('0xcb'));loggerPredictive[_0xa9a1('0x4e')](_0x345b98[_0xa9a1('0x4b')],_0xa9a1('0x1ca'),_0x345b98['startProgressive']);this[_0xa9a1('0xb6')](_0x345b98,0x1);}else if(ifInterval(_0x345b98['dialPredictiveInterval'],_0x345b98['startProgressive'])){this[_0xa9a1('0xb6')](_0x345b98,0x1);loggerPredictiveCalls[_0xa9a1('0x4e')](_0xa9a1('0x1cb'),_0x345b98['startProgressive'],_0x345b98[_0xa9a1('0x4b')]);_0x345b98[_0xa9a1('0x1c4')]=0x0;_0x345b98['predictiveIntervalErlangCallsDroppedCalls']=0x0;}else if(_0x441bdc<_0x18d9f9&&_0x345b98[_0xa9a1('0x1cc')]===_0xa9a1('0x1cd')){clearPredictiveAttributes(_0x345b98);loggerPredictive[_0xa9a1('0x4e')]('[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day',_0x18d9f9,'startProgressive',_0x345b98[_0xa9a1('0x4b')]);}else if(_0x12a699<_0x345b98[_0xa9a1('0x1ce')]&&_0x345b98[_0xa9a1('0x1cc')]===_0xa9a1('0x1cd')){clearPredictiveAttributes(_0x345b98);loggerPredictive[_0xa9a1('0x4e')](_0xa9a1('0x1cf'),_0xa9a1('0x1d0'),_0x12a699,_0xa9a1('0x1d1'),_0x345b98[_0xa9a1('0x1ce')],'startProgressive',_0x345b98['name']);}else if(!ifInterval(_0x345b98['dialPredictiveInterval'],_0x345b98[_0xa9a1('0x27')])&&_[_0xa9a1('0x5b')](_0x345b98['startPredictive'])&&!_['isUndefined'](_0x345b98[_0xa9a1('0x27')])){_0x345b98[_0xa9a1('0x69')]=moment()[_0xa9a1('0x49')](_0xa9a1('0xcb'));loggerPredictive[_0xa9a1('0x4e')](_0x345b98[_0xa9a1('0x4b')],_0xa9a1('0x1d2'),_0x345b98['startPredictive']);hopperUtils[_0xa9a1('0x1d3')](_0x345b98['dialPredictiveInterval'])[_0xa9a1('0x42')](this['getDataPredictive'](_0x345b98))[_0xa9a1('0x42')](mergeDataErlangB(_0x345b98))['then'](this[_0xa9a1('0x1d4')](_0x345b98))[_0xa9a1('0xa7')](loggerCatchPredictive('Predictive\x20after\x20first\x20interval',_0x345b98));}else if(!ifInterval(_0x345b98[_0xa9a1('0x1d5')],_0x345b98[_0xa9a1('0x69')])){_0x345b98['predictiveIntervalErlangCallsDroppedCalls']=0x0;_0x345b98[_0xa9a1('0x69')]=moment()['format'](_0xa9a1('0xcb'));loggerPredictive[_0xa9a1('0x4e')](_0x345b98[_0xa9a1('0x4b')],_0xa9a1('0x1d6'),_0x345b98[_0xa9a1('0x69')]);clearInterval(_0x345b98[_0xa9a1('0x6b')]);_0x345b98['handlePredictive']=undefined;hopperUtils[_0xa9a1('0x1d3')](_0x345b98[_0xa9a1('0x1d5')])[_0xa9a1('0x42')](this['getDataPredictive'](_0x345b98))['then'](mergeDataErlangB(_0x345b98))['then'](this['startMethodPredictive'](_0x345b98))[_0xa9a1('0xa7')](loggerCatchPredictive(_0xa9a1('0x1d7'),_0x345b98));}else if(_0x345b98[_0xa9a1('0x1bf')]&&_0x3ab922<_0x345b98['predictiveIntervalAvailable']-_0x3db33b){clearPredictiveAttributes(_0x345b98);loggerPredictive['info'](_0x345b98[_0xa9a1('0x4b')],'switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',_0x3ab922,')\x20are\x20less\x20than\x20threshold\x20(',_0x345b98[_0xa9a1('0x1bf')],'-',_0x3db33b,'=',_0x345b98[_0xa9a1('0x1bf')]-_0x3db33b,')');}else if(_0x345b98[_0xa9a1('0x1bf')]&&_0x3ab922>_0x345b98['predictiveIntervalAvailable']+_0x5bbaea){clearPredictiveAttributes(_0x345b98);loggerPredictive['info'](_0x345b98['name'],_0xa9a1('0x1d8'),_0x3ab922,_0xa9a1('0x1d9'),_0x345b98[_0xa9a1('0x1bf')],'+',_0x5bbaea,'=',_0x345b98['predictiveIntervalAvailable']+_0x5bbaea,')');}};Dialer[_0xa9a1('0x1a')][_0xa9a1('0x1da')]=function(_0x4a9569){var _0x44c310=this;return function(_0x526da2){return new Promise(function(_0x3ac34f,_0x44c6b7){_['merge'](_0x4a9569,_0x526da2[0x0]);if(checkGetDataPredictive(_0x526da2[0x0])){var _0x2a3859=_0x4a9569['predictiveIntervalAvailable']=_0x4a9569[_0xa9a1('0x1db')]+_0x4a9569[_0xa9a1('0x143')];var _0x3865d9=_0x4a9569[_0xa9a1('0x1d5')]*0x3c;var _0x2d3440=_0x526da2[0x0][_0xa9a1('0x59')]+_0x526da2[0x0][_0xa9a1('0x57')];var _0x48bb44=(_0x526da2[0x0][_0xa9a1('0x52')]+_0x526da2[0x0][_0xa9a1('0x54')]+_0x526da2[0x0][_0xa9a1('0x56')])/_0x526da2[0x0][_0xa9a1('0x50')];_0x4a9569[_0xa9a1('0x1c5')]=_0x48bb44>0x0?_0x48bb44:0x1;switch(_0x4a9569[_0xa9a1('0x1cc')]){case _0xa9a1('0x1cd'):var _0x516ac8=_0x4a9569[_0xa9a1('0x1be')]/0x64;return _0x44c310[_0xa9a1('0x1dc')](_0x2a3859,_0x3865d9,_0x2d3440,_0x48bb44,_0x516ac8)['then'](function(_0x1e63ed){return _0x3ac34f(_0x1e63ed);});case _0xa9a1('0x1dd'):var _0xbe4fb5=_0x4a9569['dialPredictiveOptimizationPercentage']/0x64;return _0x44c310[_0xa9a1('0x1de')](_0x2a3859,_0x3865d9,_0x2d3440,_0x48bb44,_0xbe4fb5)[_0xa9a1('0x42')](function(_0x296b2b){return _0x3ac34f(_0x296b2b);});default:return _0x44c6b7(msgResponse(_0xa9a1('0x1df'),_0xa9a1('0x9e'),'Unknown\x20Predictive'));}}else{return _0x44c6b7(msgResponse(_0xa9a1('0x1df'),'Failure',_0xa9a1('0x1e0')));}});};};Dialer[_0xa9a1('0x1a')][_0xa9a1('0x1e1')]=function(_0x5e9f16){var _0x368cf2=this;return function(_0x19781f){return new Promise(function(_0x32cd88,_0x28fd2e){_[_0xa9a1('0x66')](_0x5e9f16,_0x19781f[0x0]);if(checkGetDataPredictive(_0x19781f[0x0])){loggerPredictive['info'](JSON[_0xa9a1('0x7e')](_0x19781f[0x0]));if(_0x5e9f16[_0xa9a1('0x1cc')]===_0xa9a1('0x1cd')){return _0x368cf2[_0xa9a1('0x158')](_0x5e9f16['id'])[_0xa9a1('0x42')](function(_0x5416ca){var _0x190d7a=_0x5e9f16[_0xa9a1('0x1e2')]-_0x5416ca[0x0][_0xa9a1('0x1e3')];var _0x4dd20f=_0x5e9f16['dialPredictiveInterval']*0x3c;var _0x1c92bd=_0x19781f[0x0][_0xa9a1('0x59')]+_0x19781f[0x0][_0xa9a1('0x57')];var _0x4d3ade=(_0x19781f[0x0][_0xa9a1('0x52')]+_0x19781f[0x0][_0xa9a1('0x54')]+_0x19781f[0x0][_0xa9a1('0x56')])/_0x19781f[0x0]['predictiveIntervalTotalCalls'];var _0x44fa39=_0x5e9f16['dialPredictiveOptimizationPercentage']/0x64;_0x5e9f16[_0xa9a1('0x1e4')]=_0x5416ca[0x0][_0xa9a1('0x1e3')]||0x0;_0x5e9f16[_0xa9a1('0x1c5')]=_0x4d3ade>0x0?_0x4d3ade:0x1;return _0x368cf2[_0xa9a1('0x1dc')](_0x190d7a,_0x4dd20f,_0x1c92bd,_0x4d3ade,_0x44fa39);})[_0xa9a1('0x42')](function(_0x197e2c){return _0x32cd88(_0x197e2c);})[_0xa9a1('0xa7')](function(_0x55aed8){return _0x28fd2e(msgResponse(_0xa9a1('0x1e5'),'Failure',JSON[_0xa9a1('0x7e')](_0x55aed8)));});}if(_0x5e9f16[_0xa9a1('0x1cc')]===_0xa9a1('0x1dd')){return _0x368cf2[_0xa9a1('0x158')](_0x5e9f16['id'])[_0xa9a1('0x42')](function(_0xc519b6){var _0x2c3238=_0x5e9f16[_0xa9a1('0x1e2')]-_0xc519b6[0x0]['outboundQueuePauses'];var _0x3ba225=_0x5e9f16[_0xa9a1('0x1d5')]*0x3c;var _0xaa4400=_0x19781f[0x0][_0xa9a1('0x59')]+_0x19781f[0x0][_0xa9a1('0x57')];var _0x5978dd=(_0x19781f[0x0]['predictiveIntervalAnsweredCalls']+_0x19781f[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x19781f[0x0][_0xa9a1('0x56')])/_0x19781f[0x0]['predictiveIntervalTotalCalls'];var _0xf8879c=_0x5e9f16[_0xa9a1('0x1be')]/0x64;_0x5e9f16[_0xa9a1('0x1e4')]=_0xc519b6[0x0][_0xa9a1('0x1e3')]||0x0;_0x5e9f16['predictiveIntervalHitRate']=_0x5978dd>0x0?_0x5978dd:0x1;return _0x368cf2[_0xa9a1('0x1de')](_0x2c3238,_0x3ba225,_0xaa4400,_0x5978dd,_0xf8879c);})[_0xa9a1('0x42')](function(_0x8feb16){return _0x32cd88(_0x8feb16);})[_0xa9a1('0xa7')](function(_0x51c10f){return _0x28fd2e(msgResponse('[CatchErlangB]',_0xa9a1('0x9e'),JSON[_0xa9a1('0x7e')](_0x51c10f)));});}}else{return _0x28fd2e(msgResponse('[getDataPredictive]','Failure','check\x20failure'));}});};};Dialer[_0xa9a1('0x1a')][_0xa9a1('0x1d4')]=function(_0x3c9860){var _0x3c7924=this;return function(){var _0x409e7=0x0;var _0x117995=Math[_0xa9a1('0x1c3')](_0x3c9860[_0xa9a1('0x1e6')]*0x3e8);if(_0x117995>0x0){_0x117995=_0x117995<0x64?0x64:_0x117995;loggerPredictive[_0xa9a1('0x4e')](_0x3c9860[_0xa9a1('0x4b')],_0xa9a1('0x1e7'),_0x117995,'milliseconds');_0x3c9860[_0xa9a1('0x6b')]=setInterval(function(){_0x3c7924['handlePredictive'](_0x3c9860);loggerPredictiveCalls[_0xa9a1('0x4e')]('[handlePredictive]',_0x409e7+=0x1);},_0x117995);}else{loggerPredictive[_0xa9a1('0x4e')](_0x3c9860[_0xa9a1('0x4b')],_0xa9a1('0x1e8'));}};};Dialer['prototype'][_0xa9a1('0x1e9')]=function(_0x205f63,_0x4db374){var _0x2536d3=this;return function(_0x413483){if(_['isEmpty'](_0x413483)){if(_[_0xa9a1('0xfc')](_0x4db374[_0xa9a1('0x15b')])||!_0x4db374[_0xa9a1('0x1ea')]){if(_0x205f63[_0xa9a1('0xb4')]===_0xa9a1('0xb9')){_0x205f63[_0xa9a1('0x7b')]=_[_0xa9a1('0x5b')](_0x205f63[_0xa9a1('0x7b')])?!![]:_0x205f63['queueStatusComplete'];var _0x4990bd=uuid['v4']();_0x2536d3[_0xa9a1('0x24')][_0x4990bd]=new Action(_0x205f63,_0x4db374,_0x4990bd);loggerBooked[_0xa9a1('0x4e')](_0xa9a1('0x1eb'),_0x4990bd,_0xa9a1('0x1ec'),JSON['stringify'](_0x205f63[_0xa9a1('0x7b')]),'Queue:\x20',_0x205f63['name']);if(_0x205f63[_0xa9a1('0x7b')]){_0x205f63[_0xa9a1('0x7b')]=![];_0x2536d3[_0xa9a1('0x29')][_0x2536d3['actions'][_0x4990bd]['queue']]=[];ami['Action']({'actionid':_0x4990bd,'action':'queuestatus','queue':_0x205f63['name']})[_0xa9a1('0xa7')](function(){_0x2536d3[_0xa9a1('0xc8')](_0x205f63);hopperUtils['rescheduleContact']({'active':![],'ContactId':_0x2536d3[_0xa9a1('0x24')][_0x4990bd][_0xa9a1('0xe7')],'ListId':_0x2536d3[_0xa9a1('0x24')][_0x4990bd][_0xa9a1('0xe8')],'VoiceQueueId':_0x2536d3[_0xa9a1('0x24')][_0x4990bd][_0xa9a1('0xe9')]||undefined,'CampaignId':_0x2536d3['actions'][_0x4990bd][_0xa9a1('0xea')]||undefined})[_0xa9a1('0xa7')](loggerCatch(_0xa9a1('0x1ed')));delete _0x2536d3['actions'][_0x4990bd];});}else{loggerBooked['info'](_0xa9a1('0x1ee'),JSON[_0xa9a1('0x7e')](_0x205f63['queueStatusComplete']),_0xa9a1('0x1ef'),_0x205f63[_0xa9a1('0x4b')]);_0x2536d3[_0xa9a1('0xc8')](_0x205f63);hopperUtils['rescheduleContact']({'active':![],'ContactId':_0x2536d3[_0xa9a1('0x24')][_0x4990bd][_0xa9a1('0xe7')],'ListId':_0x2536d3[_0xa9a1('0x24')][_0x4990bd]['ListId'],'VoiceQueueId':_0x2536d3[_0xa9a1('0x24')][_0x4990bd][_0xa9a1('0xe9')]||undefined,'CampaignId':_0x2536d3['actions'][_0x4990bd][_0xa9a1('0xea')]||undefined})[_0xa9a1('0xa7')](loggerCatch(_0xa9a1('0x1ed')));delete _0x2536d3['actions'][_0x4990bd];}}else{return _0x2536d3[_0xa9a1('0x161')](_0x205f63,_0x4db374);}}else{if(utils[_0xa9a1('0x67')](undefined,_0x4db374[_0xa9a1('0x1f0')])<_0x205f63[_0xa9a1('0x1f1')]*0x3c){if(_0x4db374[_0xa9a1('0x14f')]&&!_0x4db374[_0xa9a1('0x14f')]['voicePause']){_0x2536d3[_0xa9a1('0x103')]['run'](_0x4db374['id'])[_0xa9a1('0x1d')](function(){_0x2536d3[_0xa9a1('0xc8')](_0x205f63);});}else{hopperUtils[_0xa9a1('0x1f2')]({'active':![]},_0x4db374['id'],0x1)['finally'](function(){_0x2536d3[_0xa9a1('0xc8')](_0x205f63);});}}else{_0x205f63[_0xa9a1('0x1f3')]+=0x1;_0x2536d3[_0xa9a1('0xc8')](_0x205f63);if(_0x205f63[_0xa9a1('0x1f4')]){hopperUtils[_0xa9a1('0xe3')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x4db374['ContactId'],'ListId':_0x4db374[_0xa9a1('0xe8')],'VoiceQueueId':_0x4db374[_0xa9a1('0xe9')]||undefined,'CampaignId':_0x4db374[_0xa9a1('0xea')]||undefined})[_0xa9a1('0xa7')](loggerCatch(_0xa9a1('0x1f5')));hopperUtils['createHistory'](createObjHistory(_0x205f63,_0x4db374,utils[_0xa9a1('0x73')][_0xa9a1('0x1f6')],0x17,_0xa9a1('0x1f7')))[_0xa9a1('0xa7')](loggerCatch(_0xa9a1('0x1f8')));}else{_0x2536d3[_0xa9a1('0x134')](createObjHistory(_0x205f63,_0x4db374,utils[_0xa9a1('0x73')][_0xa9a1('0x1f9')],0x16,'RecallFailedTimeout'),_0xa9a1('0x1fa'),'[Originate][HistoryRecallClose]');}}}}else{_0x205f63[_0xa9a1('0x1fb')]+=0x1;_0x2536d3[_0xa9a1('0x134')](createObjHistory(_0x205f63,_0x4db374,utils[_0xa9a1('0x73')][_0xa9a1('0x1fc')],0xd,'Blacklist'),_0xa9a1('0x1fd'),'[Originate][MoveBlacklist]');throw _0xa9a1('0x1fe');}};};Dialer['prototype'][_0xa9a1('0x160')]=function(_0x59bd70){var _0x44efb6=this;var _0x2b9af9=_0x59bd70[_0xa9a1('0x1ff')]-_0x59bd70[_0xa9a1('0x87')];emitCampaignSummary(_0x59bd70);if(_0x2b9af9>0x0&&_0x59bd70[_0xa9a1('0x70')]==0x0){if(_0x2b9af9>this[_0xa9a1('0x200')]){_0x2b9af9=this[_0xa9a1('0x200')];}_0x59bd70[_0xa9a1('0x70')]=0x1;hopperUtils[_0xa9a1('0x201')](_0x59bd70,_0x2b9af9)[_0xa9a1('0x42')](function(_0x40c24a){_0x59bd70[_0xa9a1('0x70')]=0x0;if(_0x40c24a){if(!utils[_0xa9a1('0x202')](_0x40c24a)){_0x59bd70[_0xa9a1('0x72')]=utils['CAMPAIGN_STATUS'][_0xa9a1('0x203')];logger[_0xa9a1('0x4e')](_0xa9a1('0x204')+_0x59bd70[_0xa9a1('0x4b')]);}else{_0x59bd70['originated']+=_0x40c24a[_0xa9a1('0x108')];_0x59bd70[_0xa9a1('0x72')]=utils[_0xa9a1('0x73')][_0xa9a1('0x205')];for(var _0x3b8eff=0x0;_0x3b8eff<_0x40c24a[_0xa9a1('0x108')];_0x3b8eff+=0x1){_0x59bd70[_0xa9a1('0x206')]+=0x1;if(_[_0xa9a1('0xfc')](_0x40c24a[_0x3b8eff])||_[_0xa9a1('0xfc')](_0x40c24a[_0x3b8eff][_0xa9a1('0x207')])||_[_0xa9a1('0xfc')](_0x40c24a[_0x3b8eff][_0xa9a1('0x165')])){_0x44efb6[_0xa9a1('0x159')](_0xa9a1('0x208'),_0x59bd70,_0x40c24a[_0x3b8eff]);}else{hopperUtils[_0xa9a1('0x209')](_[_0xa9a1('0x10b')](_0x40c24a[_0x3b8eff],[_0xa9a1('0xea'),_0xa9a1('0x165')]))[_0xa9a1('0x42')](_0x44efb6[_0xa9a1('0x1e9')](_0x59bd70,_0x40c24a[_0x3b8eff]))['catch'](_0x44efb6[_0xa9a1('0x20a')]('[actionOriginateIvr]\x20',_0x59bd70));}}}}})[_0xa9a1('0xa7')](loggerGetContactDialer('[getContactCampaign2]',_0x59bd70,_0x2b9af9));}};Dialer[_0xa9a1('0x1a')]['handlePower']=function(_0x45fc89,_0x267d5d){var _0x3687c2=this;var _0x2ede89=[];if(_0x267d5d<0x1||_0x45fc89['dialMethod']===_0xa9a1('0xb9')){_0x267d5d=0x1;}var _0x36e66a=Math['floor'](_0x45fc89[_0xa9a1('0x143')]*_0x267d5d)-_0x45fc89[_0xa9a1('0x87')];if(_0x45fc89['dialLimitQueue']>0x0){var _0x1210df=_0x45fc89[_0xa9a1('0x20b')]-_0x45fc89['originated']-_0x45fc89[_0xa9a1('0x1db')]-_0x45fc89[_0xa9a1('0x145')];if(_0x36e66a>_0x1210df){_0x36e66a=_0x1210df;}}if(_0x36e66a>0x0&&_0x45fc89[_0xa9a1('0x70')]==0x0){if(_0x45fc89[_0xa9a1('0xb4')]===_0xa9a1('0xb9')){_0x36e66a=0x1;}if(_0x36e66a>this[_0xa9a1('0x200')]){_0x36e66a=this[_0xa9a1('0x200')];}for(var _0x25fa35 in this['agents']){if(typeof this[_0xa9a1('0x21')][_0x25fa35]!==_0xa9a1('0xae')){if(this[_0xa9a1('0x21')][_0x25fa35][_0xa9a1('0x78')]===_0xa9a1('0x20c')&&this[_0xa9a1('0x21')][_0x25fa35]['status']===_0xa9a1('0x90')){_0x2ede89[_0xa9a1('0xa5')](this[_0xa9a1('0x21')][_0x25fa35]['id']);}}}_0x45fc89['temp']=0x1;hopperUtils[_0xa9a1('0x20d')](_0x45fc89,_0x2ede89,_0x36e66a)[_0xa9a1('0x42')](function(_0x4a4471){_0x45fc89[_0xa9a1('0x70')]=0x0;if(_0x4a4471){if(!utils[_0xa9a1('0x202')](_0x4a4471)){hopperUtils[_0xa9a1('0x20e')](_0x45fc89)[_0xa9a1('0x42')](sendMessageReschedule(_0x45fc89))['catch'](loggerCatch('[countReScheduled]\x20'));}else{_0x45fc89[_0xa9a1('0x87')]+=_0x4a4471[_0xa9a1('0x108')];_0x45fc89[_0xa9a1('0x72')]=_0x45fc89[_0xa9a1('0xb4')]==='booked'?utils[_0xa9a1('0x73')][_0xa9a1('0x146')]:utils[_0xa9a1('0x73')][_0xa9a1('0x205')];for(var _0x5ac67f=0x0;_0x5ac67f<_0x4a4471[_0xa9a1('0x108')];_0x5ac67f+=0x1){if(_[_0xa9a1('0xfc')](_0x4a4471[_0x5ac67f])||_['isNil'](_0x4a4471[_0x5ac67f][_0xa9a1('0x207')])||_['isNil'](_0x4a4471[_0x5ac67f][_0xa9a1('0x165')])){_0x3687c2[_0xa9a1('0x159')](_0xa9a1('0x208'),_0x45fc89,_0x4a4471[_0x5ac67f]);}else{hopperUtils[_0xa9a1('0x20f')](_[_0xa9a1('0x10b')](_0x4a4471[_0x5ac67f],[_0xa9a1('0xe9'),_0xa9a1('0x165')]))['then'](_0x3687c2[_0xa9a1('0x1e9')](_0x45fc89,_0x4a4471[_0x5ac67f]))['catch'](_0x3687c2[_0xa9a1('0x20a')](_0xa9a1('0x208'),_0x45fc89));}}}}})['catch'](loggerGetContactDialer(_0xa9a1('0x210'),_0x45fc89,_0x36e66a));}};Dialer[_0xa9a1('0x1a')][_0xa9a1('0x6b')]=function(_0x410be1){if(_0x410be1[_0xa9a1('0x20b')]>0x0){var _0x2dac52=_0x410be1[_0xa9a1('0x20b')]-_0x410be1[_0xa9a1('0x87')]-_0x410be1[_0xa9a1('0x1db')];if(_0x2dac52>0x0&&_0x410be1[_0xa9a1('0x70')]==0x0){this[_0xa9a1('0x211')](_0x410be1);}else{loggerPredictiveCalls['info'](_0xa9a1('0x212'));}}else{this[_0xa9a1('0x211')](_0x410be1);}};Dialer[_0xa9a1('0x1a')]['tryOriginatePredictive']=function(_0x4f75c7){var _0x4967d4=this;var _0x365a5a=[];_0x4f75c7[_0xa9a1('0x87')]+=0x1;for(var _0x5f1660 in this[_0xa9a1('0x21')]){if(typeof this['agents'][_0x5f1660]!=='undefined'){if(this['agents'][_0x5f1660]['state']===_0xa9a1('0x20c')&&this[_0xa9a1('0x21')][_0x5f1660][_0xa9a1('0x91')]==='reachable'){_0x365a5a[_0xa9a1('0xa5')](this[_0xa9a1('0x21')][_0x5f1660]['id']);}}}_0x4f75c7[_0xa9a1('0x70')]=0x1;return this[_0xa9a1('0x20d')](_0x4f75c7['id'],_0x365a5a,0x1,_0x4f75c7['dialOrderByScheduledAt'],_0x4f75c7)['then'](function(_0x293eb1){_0x4f75c7['temp']=0x1;if(_0x293eb1){if(!utils[_0xa9a1('0x202')](_0x293eb1)){utils['checkContactLowerLimitOriginate'](_0x4f75c7,0x1,0x0);return hopperUtils[_0xa9a1('0x20e')](_0x4f75c7)[_0xa9a1('0x42')](sendMessageReschedule(_0x4f75c7))[_0xa9a1('0xa7')](loggerCatch(_0xa9a1('0x213')));}else{_0x4f75c7['message']=utils['CAMPAIGN_STATUS'][_0xa9a1('0x205')];if(_['isNil'](_0x293eb1[0x0])||_[_0xa9a1('0xfc')](_0x293eb1[0x0]['Contact'])||_['isNil'](_0x293eb1[0x0][_0xa9a1('0x165')])){_0x4967d4[_0xa9a1('0x159')](_0xa9a1('0x208'),_0x4f75c7,_0x293eb1[0x0]);}else{return hopperUtils[_0xa9a1('0x20f')](_[_0xa9a1('0x10b')](_0x293eb1[0x0],['VoiceQueueId',_0xa9a1('0x165')]))[_0xa9a1('0x42')](_0x4967d4[_0xa9a1('0x1e9')](_0x4f75c7,_0x293eb1[0x0]))[_0xa9a1('0xa7')](_0x4967d4['loggerHandler']('[actionOriginatePredictive]\x20',_0x4f75c7));}}}})[_0xa9a1('0xa7')](loggerGetContactDialer(_0xa9a1('0x214'),_0x4f75c7,0x1));};Dialer[_0xa9a1('0x1a')][_0xa9a1('0x1dc')]=function(_0x535eab,_0x59f953,_0x72edc8,_0x3f33f2,_0x43bd47,_0x3a0345){loggerPredictive[_0xa9a1('0x4e')](_0xa9a1('0x215'));loggerPredictive[_0xa9a1('0x4e')](_0xa9a1('0x216'),_0x535eab);loggerPredictive['info']('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x59f953);loggerPredictive[_0xa9a1('0x4e')]('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',_0x72edc8);loggerPredictive['info'](_0xa9a1('0x217'),_0x3f33f2);loggerPredictive[_0xa9a1('0x4e')](_0xa9a1('0x218'),_0x43bd47);loggerPredictive[_0xa9a1('0x4e')](_0xa9a1('0x5a'));return new Promise(function(_0xc28b49,_0x164a4e){if(_0x535eab<=0x0||isNaN(_0x535eab)){return _0x164a4e(msgResponse(_0xa9a1('0x219'),_0xa9a1('0x8d'),'m\x20=\x20'+_0x535eab));}if(_0x72edc8<=0x0||isNaN(_0x72edc8)){return _0x164a4e(msgResponse(_0xa9a1('0x219'),_0xa9a1('0x8d'),_0xa9a1('0x21a')+_0x72edc8));}if(_0x3f33f2<=0x0||isNaN(_0x3f33f2)){return _0x164a4e(msgResponse(_0xa9a1('0x219'),_0xa9a1('0x8d'),_0xa9a1('0x21b')+_0x3f33f2));}if(_0x59f953<=0x0||isNaN(_0x59f953)){return _0x164a4e(msgResponse(_0xa9a1('0x219'),'Error','interval\x20=\x20'+_0x59f953));}if(_0x43bd47<=0x0||isNaN(_0x43bd47)){return _0x164a4e(msgResponse('[abandonmentRate]',_0xa9a1('0x8d'),_0xa9a1('0x21c')+_0x43bd47));}_0x3a0345=_0x3a0345||0x0;var _0x18fcc4=0x1/_0x72edc8;var _0x5ce02b=0x0;var _0x4492a7=0x0;var _0x472b25=0x0;var _0x55e362=0x0;for(var _0x381272=0x0;_0x472b25<_0x43bd47;_0x381272+=0x1){_0x4492a7=_0x381272/_0x59f953;_0x5ce02b=(_0x3f33f2*_0x4492a7+_0x3a0345)/_0x18fcc4;_0x472b25=utils[_0xa9a1('0x21d')](_0x5ce02b,_0x535eab);_0x55e362=_0x5ce02b/_0x535eab*(0x1-utils['erlangb'](_0x5ce02b,_0x535eab));}return _0xc28b49({'erlangCalls':_0x381272,'erlangCallToSecond':_0x59f953/_0x381272,'erlangAbandonmentRate':_0x472b25,'erlangBusyFactor':_0x55e362});});};Dialer['prototype'][_0xa9a1('0x1de')]=function(_0x7972bc,_0x6721e0,_0x13528b,_0x46bcc2,_0x30965a,_0x49e637){loggerPredictive[_0xa9a1('0x4e')](_0xa9a1('0x21e'));loggerPredictive['info'](_0xa9a1('0x216'),_0x7972bc);loggerPredictive['info'](_0xa9a1('0x21f'),_0x6721e0);loggerPredictive[_0xa9a1('0x4e')](_0xa9a1('0x220'),_0x13528b);loggerPredictive[_0xa9a1('0x4e')](_0xa9a1('0x217'),_0x46bcc2);loggerPredictive[_0xa9a1('0x4e')](_0xa9a1('0x221'),_0x30965a);loggerPredictive[_0xa9a1('0x4e')]('---------------------------');return new Promise(function(_0x3ab54c,_0x56250d){if(_0x7972bc<=0x0||isNaN(_0x7972bc)){return _0x56250d(msgResponse(_0xa9a1('0x222'),_0xa9a1('0x8d'),'m\x20=\x20'+_0x7972bc));}if(_0x13528b<=0x0||isNaN(_0x13528b)){return _0x56250d(msgResponse(_0xa9a1('0x222'),_0xa9a1('0x8d'),_0xa9a1('0x21a')+_0x13528b));}if(_0x46bcc2<=0x0||isNaN(_0x46bcc2)){return _0x56250d(msgResponse(_0xa9a1('0x222'),_0xa9a1('0x8d'),'p\x20=\x20'+_0x46bcc2));}if(_0x6721e0<=0x0||isNaN(_0x6721e0)){return _0x56250d(msgResponse(_0xa9a1('0x222'),'Error','interval\x20=\x20'+_0x6721e0));}if(_0x30965a<=0x0||isNaN(_0x30965a)){return _0x56250d(msgResponse('[busyFactor]','Error',_0xa9a1('0x223')+_0x30965a));}_0x49e637=_0x49e637||0x0;var _0x5e3de2=0x1/_0x13528b;var _0x311420=0x0;var _0x573795=0x0;var _0x30dbc5=0x0;var _0x2a7008=0x0;for(var _0x4e81d6=0x0;_0x2a7008<_0x30965a;_0x4e81d6+=0x1){_0x573795=_0x4e81d6/_0x6721e0;_0x311420=(_0x46bcc2*_0x573795+_0x49e637)/_0x5e3de2;_0x30dbc5=utils[_0xa9a1('0x21d')](_0x311420,_0x7972bc);_0x2a7008=_0x311420/_0x7972bc*(0x1-utils[_0xa9a1('0x21d')](_0x311420,_0x7972bc));}return _0x3ab54c({'erlangCalls':_0x4e81d6,'erlangCallToSecond':_0x6721e0/_0x4e81d6,'erlangAbandonmentRate':_0x30dbc5,'erlangBusyFactor':_0x2a7008});});};module[_0xa9a1('0x224')]=Dialer; \ No newline at end of file +var _0xe0e1=['isOutboundQueue','\x22%s,%s%s,,,%s\x22','XMD-AMDINITIALSILENCE','XMD-AMDGREETING','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','setXMDContactVariables','Contact','getCallerId','callerid','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','dialOriginateCallerIdNumber','getCallerIdRandom','XMD-ORIGINATECALLERIDNAME','originatecalleridname','variables','SIP/%s/%s%s','dialPrefix','trim','dialCutDigit','substring','from-sip','dialOriginateTimeout','outboundOriginateFailureCallsDay','[originateError]:\x20%s','OriginateError','[originate][error]','originate\x20action\x20Error','countbusyretry','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberRetryFrequency','[rescheduleContact][Abandoned]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','entity\x20is\x20undefine','[callProgressDetecting]','evt\x20is\x20undefine','outboundNoSuchCallsDay','NoSuchNumber','custom:agentnosuchnumber','checkRetriveMax','dialNoSuchNumberMaxRetry','reason\x200\x20no\x20such\x20number....','outboundNoAnswerCallsDay','NoAnswer','custom:agentnoanswer','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','outboundBusyCallsDay','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','Congestion','dialCongestionRetryFrequency','custom:agentcongestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','outboundAbandonedCallsDay','reason\x2011\x20abandoned','AgentReject','custom:agentreject','agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','Success','[moveContactManagedDialer][0]','dialPredictiveOptimizationPercentage','outboundDropCallsDayTimeout','round','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','floor','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','dialPredictiveOptimization','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','avgHandleTime','startMethodPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','getDataPredictive','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(',')\x20are\x20more\x20than\x20threshold\x20(','predictiveIntervalTotalCalls','abandonmentRate','agentBusyFactor','busyFactor','[getDataPredictive]','Unknown\x20Predictive','getDataPredictiveOld','dropRate','loggedIn','outboundQueuePauses','predictiveIntervalPauses','[CatchErlangB]','check\x20failure','erlangCallToSecond','milliseconds','[handlePredictive]','fail\x20to\x20scheduled\x20calls','checkContactBlack','UserId','recallme','[booked][checkContactBlack]','queueStatusComplete:\x20','Queue:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','scheduledat','dialRecallMeTimeout','unlockContact','outboundReCallsDay','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALL_TIMEOUT','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','outboundBlacklistCallsDay','BLACKLIST','Blacklist','[Originate][MoveBlacklist]','inBlackList','handleIvr','limitCalls','checkContactEmpty','[getContactCampaign2][Empty]','RUNNING','ivrTotalCallsDays','emptyContact','[actionOriginate]\x20','[actionOriginateIvr]\x20','dialLimitQueue','not_inuse','countReScheduled','[countReScheduled]\x20','checkIsBlackList','[getContactDialer2]','[handlePredictive][limitChannel]','tryOriginatePredictive','getContactDialer','--------\x20Drop\x20Rate\x20--------','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','Ts\x20=\x20','p\x20=\x20','interval\x20=\x20','Amax\x20=\x20','erlangb','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','m\x20=\x20','Umin\x20=\x20','exports','lodash','uuid','./utils','./utils/hopper','../preview/util/util','../../../config/logger','dialer','booked','predictive','syncQueueSummary','../ami','defaults','redis','localhost','socket.io-emitter','../rpc/cmHopper','../rpc/voiceQueueRt','../rpc/setting','./models/final','./models/queueCallerAbandon','./models/hangup','XCALLY_IP_AGI','127.0.0.1','prototype','enqueue','tail','finally','sequence','voiceQueues','campaigns','trunks','maxNumberOriginate','channels','actions','contactsId','optionPredictive','startPredictive','startProgressive','ivrOriginated','queueBooked','queuesSummary','syncAgentConnect','bind','queuecallerabandon','syncQueueCallerAbandon','originateresponse','syncOriginateResponse','syncAgentComplete','custom:queuesummary','custom:queuesummarycomplete','syncQueueSummaryComplete','syncHangup','newexten','syncNewExten','varset','syncVarSet','syncQueueMember','queuestatuscomplete','syncQueueStatusComplete','loopCampaigns','loopClearZombieChannels','getSettings','then','previewRecallmeReminderInterval','emit','type','outbound','format','voice:queue:%s','name','voice_queue:save','info','-----\x20Stats\x20Predictive\x20---','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAnsweredCalls','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','predictiveIntervalAvgTalktime','---------------------------','isUndefined','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','---------\x20ErlangB\x20---------','erlangCalls','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangAbandonmentRate','erlangBusyFactor','merge','debug','startProgressive\x20value\x20cleared','startPredictive\x20value\x20cleared','handlePredictive','handlePredictive\x20interval\x20cleared','error','stack','inspect','checkContactLowerLimitOriginate','temp','contactsRescheduled','CAMPAIGN_STATUS','CONTACTS_RESCHEDULED','[getContactDialer2][ReScheduled]','contacts','message','NO_AVAILABLE_CONTACTS','[getContactDialer2][Empty]','state','endtime','starttime','queueStatusComplete','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','stringify','Interval','NULL_INTERVAL','\x20INTERVAL_IS_NULL','isEmpty','Intervals','INACTIVE','\x20NOT\x20Active','isIVRCampaign','campaign:ivr:%s','campaign:save','originated','sendMessageOneNotActive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','is\x20not\x20active','DISACTIVED','is\x20disactive','[ifTime][Action]','Error','isTrunkReachable','active','SIP/%s','reachable','status','unmonitored','checkIsTrunkReachable','Trunk','TrunkBackup','TRUNK_NOT_REACHABLE','checkIfTime','ifTimeIvr','checkIfTimeIntervals','ifTime','Failure','UNKNOWN_TIMEZONE','\x20Timezone\x20unknow\x20','length','iftime\x20%s,%s','timezones','content','indexOf','push','Action','true','some','OVERTIME_INTERVAL','[ifTime][promiseAll]','Global:\x20','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','catch','resetActiveCalls','syncCampaigns','undefined','isIVRCampaignActive','resolve','dialTimezone','launchHandleIvr','dialMethod','progressive','handlePower','power','Queue','method\x20not\x20recognized','dialGlobalInterval','silly','Dialer::ifTime()','Dialer::ifTime()\x20errResponse\x20NOT\x20NULL:','isGlobal','AMI\x20IfTime','queue','uniqueId','uniqueid','ivr','updateOriginated','YYYY-MM-DD\x20HH:mm:ss','outboundAnswerCallsDay','reason','agent','agiafterat','dialQueueProject2','dialAgiAfterHangupAgent','[syncAgentComplete][createHistory]','moveContactManagedDialer','[syncAgentComplete]','getSeconds','dialQueueTimeout','predictiveIntervalErlangCallsDroppedCalls','statedesc','dropreason','countglobal','dialDropRetryFrequency','voiceQueue','additional','countdropretry','dialDropMaxRetry','queueCallerAbandonCreateState','rescheduleContact','add','minutes','CampaignId','[rescheduleContact][Drop]','calleridname','calleridnum','Abandoned','CALLEREXIT','countabandonedretry','dialAbandonedRetryFrequency','callAdditionalPhoneAfterMin','verifyAdditionalPhones','dialAbandonedMaxRetry','ContactId','ListId','VoiceQueueId','createHistory','[syncAgentComplete][createHistory][11]','swapAdditionalPhones','channel','rrmemory','roundrobin','actionid','isNil','agents','stateinterface','locked','idHopper','paused','preview','[Catch][Preview][syncQueueStatusComplete]','[unlock][syncQueueStatusComplete]','queueBookedRR','_rr','unlockRR','pick','contactAgent-idHopper:\x20','run','Agent:\x20','[booked][unlock]','[unlock2][syncQueueStatusComplete]','[unlock3][syncQueueStatusComplete]','responsetime','callProgressDetecting','variable','amdstatus','exten','xcally-motion-dialer','dialAMDActive','value','HANGUP','outboundAnswerAgiCallsDay','membername','custom:amd','buildObj','amd','[syncHangupInAMD][createHistory]','MACHINE','Machine','AMD','countmachineretry','[syncAgentComplete][createHistory][0]','countcongestionretry','countnoanswerretry','countnosuchnumberretry','dialGlobalMaxRetry','stateGlobal','dialMachineMaxRetry','createStateFinal','dialMachineRetryFrequency','[rescheduleContact][Machine]','HangupInAMD','saveInDb','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','countagentrejectretry','reason19\x20machine....','reason\x2019\x20machine....','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','dialQueueProject','AnswerAGI','AGI','outboundUnknownCallsDay','Unknow','[syncHangupIvr]','running','isPreviewCampaign','statusMessage','available','talking','pTalking','ACTIVE','checkDialMethod','compareToOutboundQueue','queueSummaryCountersUpdated','updateReportFromOutboundQueue','assign','throttle','dialPreviewRecallmeReminder','filter','online','handlePreviewRecallNotifications','map','Agent','user:%s','user:dialPreviewRecallReminder','checkPreviewRecallReminder','clearZombieChannels','[uniqueid]','[actions]','No\x20such\x20channel','getVoiceQueueRtPauses','loggerHandler','notFound','[emptyContact][createHistory]','[emptyContact]','[syncQueueCallerAbandon]\x20[Drop]','actionOriginate','object','originate','voiceQueue\x20is\x20undefine','phone','getCaller','\x22agi://%s/square,%s\x22','NONE'];(function(_0x57ea02,_0x5cedee){var _0x3172cd=function(_0x37ac1d){while(--_0x37ac1d){_0x57ea02['push'](_0x57ea02['shift']());}};_0x3172cd(++_0x5cedee);}(_0xe0e1,0xbf));var _0x1e0e=function(_0x132ca8,_0x574511){_0x132ca8=_0x132ca8-0x0;var _0x2e7e6a=_0xe0e1[_0x132ca8];return _0x2e7e6a;};'use strict';var util=require('util');var _=require(_0x1e0e('0x0'));var uuid=require(_0x1e0e('0x1'));var moment=require('moment');var rr=require('rr');var Redis=require('ioredis');var utils=require(_0x1e0e('0x2'));var hopperUtils=require(_0x1e0e('0x3'));var ut=require(_0x1e0e('0x4'));var config=require('../../../config/environment/');var logger=require(_0x1e0e('0x5'))(_0x1e0e('0x6'));var loggerBooked=require(_0x1e0e('0x5'))(_0x1e0e('0x7'));var loggerPredictive=require(_0x1e0e('0x5'))(_0x1e0e('0x8'));var loggerPredictiveCalls=require(_0x1e0e('0x5'))('predictiveCalls');var loggerSyncQueueSummary=require(_0x1e0e('0x5'))(_0x1e0e('0x9'));var ami=require(_0x1e0e('0xa'));config['redis']=_[_0x1e0e('0xb')](config[_0x1e0e('0xc')],{'host':_0x1e0e('0xd'),'port':0x18eb});var io=require(_0x1e0e('0xe'))(new Redis(config[_0x1e0e('0xc')]));var cmHopper=require(_0x1e0e('0xf'));var voiceQueueRt=require(_0x1e0e('0x10'));var RpcSetting=require(_0x1e0e('0x11'));var Interval=require('../rpc/interval');var Action=require('./models/action');var History=require('./models/history');var Final=require(_0x1e0e('0x12'));var AgentComplete=require('./models/agentComplete');var QueueCallerAbandon=require(_0x1e0e('0x13'));var Hangup=require(_0x1e0e('0x14'));var ipAgi=process['env'][_0x1e0e('0x15')]||_0x1e0e('0x16');var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence[_0x1e0e('0x17')][_0x1e0e('0x18')]=function(_0x4769a6){this[_0x1e0e('0x19')]=this[_0x1e0e('0x19')]?this[_0x1e0e('0x19')][_0x1e0e('0x1a')](_0x4769a6):_0x4769a6();};function Dialer(_0x1a9ea,_0x6dbafc){this[_0x1e0e('0x1b')]=new Sequence();this['preview']=_0x6dbafc;this[_0x1e0e('0x1c')]=_0x1a9ea['voiceQueues'];this['campaigns']=_0x1a9ea[_0x1e0e('0x1d')];this['agents']=_0x1a9ea['agents'];this[_0x1e0e('0x1e')]=_0x1a9ea[_0x1e0e('0x1e')];this['maxNumberOriginate']=config[_0x1e0e('0x1f')]||0x2;this[_0x1e0e('0x20')]={};this[_0x1e0e('0x21')]={};this[_0x1e0e('0x22')]={};this['uniqueId']={};this[_0x1e0e('0x23')]={};this[_0x1e0e('0x24')]={};this[_0x1e0e('0x25')]={};this[_0x1e0e('0x26')]={};this[_0x1e0e('0x27')]={};this['queueBookedRR']={};this[_0x1e0e('0x28')]={};ami['on']('agentconnect',this[_0x1e0e('0x29')][_0x1e0e('0x2a')](this));ami['on'](_0x1e0e('0x2b'),this[_0x1e0e('0x2c')]['bind'](this));ami['on'](_0x1e0e('0x2d'),this[_0x1e0e('0x2e')]['bind'](this));ami['on']('agentcomplete',this[_0x1e0e('0x2f')][_0x1e0e('0x2a')](this));ami['on'](_0x1e0e('0x30'),this[_0x1e0e('0x9')]['bind'](this));ami['on'](_0x1e0e('0x31'),this[_0x1e0e('0x32')][_0x1e0e('0x2a')](this));ami['on']('hangup',this[_0x1e0e('0x33')]['bind'](this));ami['on'](_0x1e0e('0x34'),this[_0x1e0e('0x35')][_0x1e0e('0x2a')](this));ami['on'](_0x1e0e('0x36'),this[_0x1e0e('0x37')][_0x1e0e('0x2a')](this));ami['on']('queuemember',this[_0x1e0e('0x38')][_0x1e0e('0x2a')](this));ami['on'](_0x1e0e('0x39'),this[_0x1e0e('0x3a')][_0x1e0e('0x2a')](this));this[_0x1e0e('0x3b')]();this[_0x1e0e('0x3c')]();RpcSetting[_0x1e0e('0x3d')]()[_0x1e0e('0x3e')](function(_0x314bc6){previewRecallmeReminderInterval=_0x314bc6[_0x1e0e('0x3f')];});}function isNotNull(_0x1e95fb){return _0x1e95fb!==null&&!_['isUndefined'](_0x1e95fb);}function msgResponse(_0x157402,_0x235dd4,_0x451674){return{'action':_0x157402,'response':_0x235dd4,'message':_0x451674,'stack':_0x451674};}function emit(_0x41a406,_0x2490ea,_0x24810b){io['to'](_0x41a406)[_0x1e0e('0x40')](_0x2490ea,_0x24810b);}function emitOutboundVoiceQueueSummary(_0xeb263d){if(_0xeb263d[_0x1e0e('0x41')]===_0x1e0e('0x42')){logger['debug']('[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:',util['inspect'](_0xeb263d,{'showHidden':![],'depth':null}));emit(util[_0x1e0e('0x43')](_0x1e0e('0x44'),_0xeb263d[_0x1e0e('0x45')]),_0x1e0e('0x46'),_0xeb263d);}}function checkGetDataPredictive(_0x1b19f1){if(isNotNull(_0x1b19f1)&&!_['isEmpty'](_0x1b19f1)){loggerPredictive[_0x1e0e('0x47')](_0x1e0e('0x48'));loggerPredictive[_0x1e0e('0x47')](_0x1e0e('0x49'),_0x1b19f1['predictiveIntervalTotalCalls']);loggerPredictive[_0x1e0e('0x47')](_0x1e0e('0x4a'),_0x1b19f1[_0x1e0e('0x4b')]);loggerPredictive[_0x1e0e('0x47')]('Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x1b19f1[_0x1e0e('0x4c')]);loggerPredictive[_0x1e0e('0x47')](_0x1e0e('0x4d'),_0x1b19f1[_0x1e0e('0x4e')]);loggerPredictive['info'](_0x1e0e('0x4f'),_0x1b19f1[_0x1e0e('0x50')]);loggerPredictive['info']('AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x1b19f1[_0x1e0e('0x51')]);loggerPredictive[_0x1e0e('0x47')](_0x1e0e('0x52'));if(_0x1b19f1['predictiveIntervalTotalCalls']>0x0){if(!_[_0x1e0e('0x53')](_0x1b19f1['predictiveIntervalAvgTalktime'])&&_0x1b19f1[_0x1e0e('0x51')]>0x0){return!![];}loggerPredictive[_0x1e0e('0x47')](_0x1e0e('0x54'));if(!_['isUndefined'](_0x1b19f1[_0x1e0e('0x50')])&&_0x1b19f1[_0x1e0e('0x50')]>0x0){return!![];}loggerPredictive['info'](_0x1e0e('0x55'));}else{loggerPredictive[_0x1e0e('0x47')](_0x1e0e('0x56'));}}else{loggerPredictive['info']('History\x20information\x20are\x20empty');}return![];}function mergeDataErlangB(_0x5c3083){return function(_0x28cdad){loggerPredictive[_0x1e0e('0x47')](_0x1e0e('0x57'));loggerPredictive[_0x1e0e('0x47')]('Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x28cdad[_0x1e0e('0x58')]);loggerPredictive['info']('One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x28cdad['erlangCallToSecond']);loggerPredictive['info'](_0x1e0e('0x59'),_0x28cdad[_0x1e0e('0x5a')]);loggerPredictive[_0x1e0e('0x47')]('Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x28cdad[_0x1e0e('0x5b')]);loggerPredictive[_0x1e0e('0x47')]('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x28cdad[_0x1e0e('0x5a')]);loggerPredictive[_0x1e0e('0x47')](_0x1e0e('0x52'));_[_0x1e0e('0x5c')](_0x5c3083,_0x28cdad);};}function ifInterval(_0x47e587,_0x228d59){if(_[_0x1e0e('0x53')](_0x228d59)){return![];}return utils['getSeconds'](undefined,_0x228d59)<_0x47e587*0x3c;}function clearPredictiveAttributes(_0x23be91){if(_0x23be91['startProgressive']){_0x23be91[_0x1e0e('0x25')]=undefined;loggerPredictive[_0x1e0e('0x5d')](_0x23be91[_0x1e0e('0x45')],_0x1e0e('0x5e'));}if(_0x23be91[_0x1e0e('0x24')]){_0x23be91[_0x1e0e('0x24')]=undefined;loggerPredictive[_0x1e0e('0x5d')](_0x23be91[_0x1e0e('0x45')],_0x1e0e('0x5f'));}if(_0x23be91['handlePredictive']){clearInterval(_0x23be91[_0x1e0e('0x60')]);_0x23be91['handlePredictive']=undefined;loggerPredictive[_0x1e0e('0x5d')](_0x23be91[_0x1e0e('0x45')],_0x1e0e('0x61'));}}function loggerCatchPredictive(_0x4441de,_0x509a9b){return function(_0x2f197d){loggerPredictive[_0x1e0e('0x62')](_0x509a9b[_0x1e0e('0x45')],_0x4441de);loggerPredictive['error'](_0x2f197d[_0x1e0e('0x63')]);clearPredictiveAttributes(_0x509a9b);};}function loggerCatch(_0x2bb1ef){return function(_0x4dfcde){logger[_0x1e0e('0x62')](_0x2bb1ef,util[_0x1e0e('0x64')](_0x4dfcde,{'showHidden':![],'depth':null}));};}function loggerGetContactDialer(_0x4b5e61,_0x2fb4ad,_0x5ae4d0){return function(_0x35e5fe){utils[_0x1e0e('0x65')](_0x2fb4ad,_0x5ae4d0,0x0);_0x2fb4ad[_0x1e0e('0x66')]=0x0;logger[_0x1e0e('0x62')](_0x4b5e61,util[_0x1e0e('0x64')](_0x35e5fe,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x162ab9){return function(_0x1b249d){if(isNotNull(_0x1b249d)&&isNotNull(_0x1b249d[0x0])){if(_0x1b249d[0x0][_0x1e0e('0x67')]>0x0){_0x162ab9['message']=utils[_0x1e0e('0x68')][_0x1e0e('0x69')];logger[_0x1e0e('0x47')](_0x1e0e('0x6a')+_0x162ab9[_0x1e0e('0x45')],_0x1b249d[0x0][_0x1e0e('0x67')],_0x1e0e('0x6b'));}else{_0x162ab9[_0x1e0e('0x6c')]=utils['CAMPAIGN_STATUS'][_0x1e0e('0x6d')];logger[_0x1e0e('0x47')](_0x1e0e('0x6e')+_0x162ab9[_0x1e0e('0x45')]);}}};}function createObjHistory(_0xee56fc,_0x572c4f,_0x439da3,_0x5d11ba,_0x4ddc5c){_0xee56fc[_0x1e0e('0x6c')]=_0x439da3;var _0xa31547=new Action(_0xee56fc,_0x572c4f);var _0x2c65f7=new History(_0xa31547);_0x2c65f7[_0x1e0e('0x6f')]=_0x5d11ba;_0x2c65f7['statedesc']=_0x4ddc5c;_0x2c65f7[_0x1e0e('0x70')]=_0xa31547[_0x1e0e('0x71')];return _0x2c65f7;}function unlockQueueStatus(_0x4a7d5d,_0x5c7472){setTimeout(function(){if(_['isUndefined'](_0x4a7d5d[_0x1e0e('0x72')])){loggerBooked[_0x1e0e('0x62')](_0x1e0e('0x73'),_0x5c7472);}_0x4a7d5d['queueStatusComplete']=!![];loggerBooked[_0x1e0e('0x47')](_0x1e0e('0x74'),_0x5c7472,JSON[_0x1e0e('0x75')](_['pick'](_0x4a7d5d,[_0x1e0e('0x45'),'queueStatusComplete'])));},0x1f3);}function checkInterval(_0x4bc3c2){return function(){if(!isNotNull(_0x4bc3c2[_0x1e0e('0x76')])){_0x4bc3c2[_0x1e0e('0x6c')]=utils[_0x1e0e('0x68')][_0x1e0e('0x77')];throw _0x4bc3c2['name']+_0x1e0e('0x78');}if(!isNotNull(_0x4bc3c2[_0x1e0e('0x76')]['Intervals'])){_0x4bc3c2[_0x1e0e('0x6c')]=utils[_0x1e0e('0x68')][_0x1e0e('0x77')];throw _0x4bc3c2[_0x1e0e('0x45')]+_0x1e0e('0x78');}if(!isNotNull(_[_0x1e0e('0x79')](_0x4bc3c2[_0x1e0e('0x76')][_0x1e0e('0x7a')]))){_0x4bc3c2[_0x1e0e('0x6c')]=utils['CAMPAIGN_STATUS']['NULL_INTERVAL'];throw _0x4bc3c2[_0x1e0e('0x45')]+_0x1e0e('0x78');}};}function checkIsIVRCampaignActive(_0x517e49){return function(){if(!utils['isIVRCampaignActive'](_0x517e49)){_0x517e49[_0x1e0e('0x6c')]=utils['CAMPAIGN_STATUS'][_0x1e0e('0x7b')];throw _0x517e49[_0x1e0e('0x45')]+_0x1e0e('0x7c');}};}function emitCampaignSummary(_0x11cc9b){if(utils[_0x1e0e('0x7d')](_0x11cc9b)){emit(util[_0x1e0e('0x43')](_0x1e0e('0x7e'),_0x11cc9b[_0x1e0e('0x45')]),_0x1e0e('0x7f'),_0x11cc9b);}}function loggerCatchQueueSummary(_0x3a7500,_0x10c18d){return function(_0x397848){clearPredictiveAttributes(_0x10c18d);emitCampaignSummary(_0x10c18d);loggerSyncQueueSummary[_0x1e0e('0x5d')](_0x3a7500,util[_0x1e0e('0x64')](_0x397848,{'showHidden':![],'depth':null}));};}function notSendMessagesCampaign(_0x5d8b52){if(_0x5d8b52['sendMessageOneNotActive']){if(_0x5d8b52[_0x1e0e('0x80')]===0x0){_0x5d8b52[_0x1e0e('0x81')]=![];_0x5d8b52[_0x1e0e('0x6c')]=utils['CAMPAIGN_STATUS'][_0x1e0e('0x7b')];loggerSyncQueueSummary[_0x1e0e('0x5d')](_0x1e0e('0x82'),_0x5d8b52['name'],_0x1e0e('0x83'));}else{_0x5d8b52[_0x1e0e('0x6c')]=utils['CAMPAIGN_STATUS'][_0x1e0e('0x84')];loggerSyncQueueSummary[_0x1e0e('0x5d')](_0x1e0e('0x82'),_0x5d8b52[_0x1e0e('0x45')],_0x1e0e('0x85'));}emitCampaignSummary(_0x5d8b52);}}function myreject(_0x183e88){return function(_0x261277){return _0x183e88(msgResponse(_0x1e0e('0x86'),_0x1e0e('0x87'),JSON[_0x1e0e('0x75')](_0x261277)));};}Dialer[_0x1e0e('0x17')][_0x1e0e('0x88')]=function(_0x19daa8){return!_['isUndefined'](_0x19daa8)&&_0x19daa8&&!_[_0x1e0e('0x53')](_0x19daa8[_0x1e0e('0x45')])&&!_[_0x1e0e('0x53')](_0x19daa8[_0x1e0e('0x89')])&&_0x19daa8['active']&&(this['trunks'][util[_0x1e0e('0x43')](_0x1e0e('0x8a'),_0x19daa8['name'])]['status']===_0x1e0e('0x8b')||this['trunks'][util[_0x1e0e('0x43')]('SIP/%s',_0x19daa8[_0x1e0e('0x45')])][_0x1e0e('0x8c')]===_0x1e0e('0x8d'));};Dialer[_0x1e0e('0x17')][_0x1e0e('0x8e')]=function(_0x53f1b7){var _0x3af246=this;return function(){if(!_0x3af246[_0x1e0e('0x88')](_0x53f1b7[_0x1e0e('0x8f')])){if(!_0x3af246[_0x1e0e('0x88')](_0x53f1b7[_0x1e0e('0x90')])){_0x53f1b7[_0x1e0e('0x6c')]=utils[_0x1e0e('0x68')][_0x1e0e('0x91')];throw _0x53f1b7[_0x1e0e('0x45')]+'\x20trunk\x20is\x20not\x20reachable';}}};};Dialer[_0x1e0e('0x17')][_0x1e0e('0x92')]=function(_0x923be9,_0x2c0d61,_0x1fa499,_0xeb54f7){var _0x253443=this;return function(){var _0x1e7ba9=!![];return _0x253443[_0x1e0e('0x93')](_0x923be9,_0x2c0d61,_0x1fa499,_0xeb54f7,_0x1e7ba9);};};Dialer[_0x1e0e('0x17')][_0x1e0e('0x94')]=function(_0x10464b,_0x584764,_0xdcc65d,_0xd25152){var _0xaf9f6a=this;return function(){var _0x4d91bf=![];return _0xaf9f6a[_0x1e0e('0x93')](_0x10464b[_0x1e0e('0x7a')],_0x584764,_0xdcc65d,_0xd25152,_0x4d91bf);};};Dialer[_0x1e0e('0x17')][_0x1e0e('0x93')]=function(_0x41ee17,_0x128bc7,_0xf07239,_0x50c9c4,_0x2cb313){var _0x5741ad=[];return new Promise(function(_0x13be70,_0x3933a2){if(!isNotNull(_0x41ee17)){_0x50c9c4['message']=utils['CAMPAIGN_STATUS'][_0x1e0e('0x77')];return _0x3933a2(msgResponse(_0x1e0e('0x95'),_0x1e0e('0x96'),_0xf07239+'\x20Intervals\x20is\x20null\x20'));}if(_[_0x1e0e('0x79')](_0x41ee17)){_0x50c9c4[_0x1e0e('0x6c')]=utils[_0x1e0e('0x68')]['EMPTY_INTERVAL'];return _0x3933a2(msgResponse(_0x1e0e('0x95'),_0x1e0e('0x96'),_0xf07239+'\x20Intervals\x20is\x20empty\x20'));}if(_0x128bc7&&_[_0x1e0e('0x53')](config['timezones'][_0x128bc7])){_0x50c9c4[_0x1e0e('0x6c')]=utils[_0x1e0e('0x68')][_0x1e0e('0x97')];return _0x3933a2(msgResponse(_0x1e0e('0x95'),_0x1e0e('0x96'),_0xf07239+_0x1e0e('0x98')+_0x128bc7));}if(_['isArray'](_0x41ee17)){for(var _0x96d843=0x0;_0x96d843<_0x41ee17[_0x1e0e('0x99')];_0x96d843+=0x1){_0x5741ad['push'](ami['Action']({'action':'command','command':util[_0x1e0e('0x43')](_0x1e0e('0x9a'),_0x41ee17[_0x96d843]['interval'],!_[_0x1e0e('0x53')](config[_0x1e0e('0x9b')][_0x128bc7])?_0x128bc7:'')})[_0x1e0e('0x3e')](function(_0x52fef5){return _0x52fef5[_0x1e0e('0x9c')][_0x1e0e('0x9d')]('true')>=0x0;})['catch'](myreject(_0x3933a2)));}}else{_0x5741ad[_0x1e0e('0x9e')](ami[_0x1e0e('0x9f')]({'action':'command','command':util[_0x1e0e('0x43')]('iftime\x20%s,%s',_0x41ee17,!_[_0x1e0e('0x53')](config[_0x1e0e('0x9b')][_0x128bc7])?_0x128bc7:'')})[_0x1e0e('0x3e')](function(_0x3fb7a8){return _0x3fb7a8[_0x1e0e('0x9c')]['indexOf'](_0x1e0e('0xa0'))>=0x0;})['catch'](myreject(_0x3933a2)));}Promise['all'](_0x5741ad)[_0x1e0e('0x3e')](function(_0x16317f){var _0x1e6a17=_[_0x1e0e('0xa1')](_0x16317f);if(_0x1e6a17){return _0x13be70(_0x1e6a17);}else{_0x50c9c4[_0x1e0e('0x6c')]=_0x2cb313?utils[_0x1e0e('0x68')]['OVERTIME_GLOBAL_INTERVAL']:utils[_0x1e0e('0x68')][_0x1e0e('0xa2')];return _0x3933a2(msgResponse(_0x1e0e('0xa3'),_0x1e0e('0x96'),_0x1e0e('0xa4')+_0x2cb313+'\x20'+_0xf07239+_0x1e0e('0xa5')+util[_0x1e0e('0x64')](_0x41ee17,{'showHidden':![],'depth':null})+_0x1e0e('0xa6')+_0x128bc7));}})[_0x1e0e('0xa7')](function(_0x12f3d1){return _0x3933a2(msgResponse(_0x1e0e('0x95'),_0x1e0e('0x96'),JSON[_0x1e0e('0x75')](_0x12f3d1)));});});};Dialer[_0x1e0e('0x17')][_0x1e0e('0x3b')]=function(){var _0x59b111=this;return cmHopper[_0x1e0e('0xa8')]({'active':![]},{'where':{'active':!![]}})[_0x1e0e('0x3e')](function(){setInterval(function(){_0x59b111[_0x1e0e('0xa9')]();},0x3e8);});};Dialer['prototype'][_0x1e0e('0xa9')]=function(){var _0x33be93=this;var _0x17a23a;for(var _0x2ffd0f in this[_0x1e0e('0x1d')]){if(typeof this[_0x1e0e('0x1d')][_0x2ffd0f]!==_0x1e0e('0xaa')){_0x17a23a=this['campaigns'][_0x2ffd0f];if(utils[_0x1e0e('0x7d')](_0x17a23a)&&utils[_0x1e0e('0xab')](_0x17a23a)){_0x17a23a['sendMessageOneNotActive']=!![];Promise[_0x1e0e('0xac')]()['then'](checkIsIVRCampaignActive(_0x17a23a))[_0x1e0e('0x3e')](checkInterval(_0x17a23a))[_0x1e0e('0x3e')](_0x33be93[_0x1e0e('0x8e')](_0x17a23a))[_0x1e0e('0x3e')](_0x33be93[_0x1e0e('0x92')](_0x17a23a['dialGlobalInterval'],_0x17a23a[_0x1e0e('0xad')],_0x17a23a[_0x1e0e('0x45')],_0x17a23a))[_0x1e0e('0x3e')](_0x33be93[_0x1e0e('0x94')](_0x17a23a['Interval'],_0x17a23a[_0x1e0e('0xad')],_0x17a23a[_0x1e0e('0x45')],_0x17a23a))[_0x1e0e('0x3e')](_0x33be93[_0x1e0e('0xae')](_0x17a23a))['catch'](loggerCatchQueueSummary('[syncCampaigns]',_0x17a23a));}else{notSendMessagesCampaign(_0x17a23a);}}}};Dialer[_0x1e0e('0x17')]['checkDialMethod']=function(_0x493cc6){if(_0x493cc6[_0x1e0e('0xaf')]!=='predictive'){clearPredictiveAttributes(_0x493cc6);}switch(_0x493cc6[_0x1e0e('0xaf')]){case _0x1e0e('0xb0'):this[_0x1e0e('0xb1')](_0x493cc6,0x1);break;case _0x1e0e('0xb2'):this[_0x1e0e('0xb1')](_0x493cc6,_0x493cc6['dialPowerLevel']);break;case _0x1e0e('0x8'):this[_0x1e0e('0x8')](_0x493cc6);break;case'booked':this['handlePower'](_0x493cc6,0x1);break;default:logger[_0x1e0e('0x62')](_0x1e0e('0xb3'),_0x493cc6[_0x1e0e('0x45')],_0x1e0e('0xb4'));}};Dialer[_0x1e0e('0x17')][_0x1e0e('0x95')]=function(_0x46bf81,_0x4f04fe){var _0x338715=_0x46bf81['dialTimezone'];var _0x1e2a13=_0x4f04fe?_0x46bf81[_0x1e0e('0xb5')]:_0x46bf81[_0x1e0e('0x76')][_0x1e0e('0x7a')];logger[_0x1e0e('0xb6')](_0x1e0e('0xb7'),_0x1e2a13,_0x338715,_0x46bf81[_0x1e0e('0x45')],util[_0x1e0e('0x43')]('Voice\x20Queue\x20%s\x20$s',_0x46bf81[_0x1e0e('0x45')],_0x46bf81['id']));var _0x27d326=null;return Interval['intervalIftime'](_0x1e2a13,_0x338715)[_0x1e0e('0x3e')](function(_0x51fd9a){if(_0x51fd9a===!![]){return _0x51fd9a;}else{_0x46bf81[_0x1e0e('0x6c')]=_0x4f04fe?utils['CAMPAIGN_STATUS']['OVERTIME_GLOBAL_INTERVAL']:utils[_0x1e0e('0x68')][_0x1e0e('0xa2')];_0x27d326=msgResponse(_0x1e0e('0xa3'),'Failure','Global:\x20'+_0x4f04fe+'\x20'+_0x46bf81[_0x1e0e('0x45')]+_0x1e0e('0xa5')+util[_0x1e0e('0x64')](_0x1e2a13,{'showHidden':![],'depth':null})+_0x1e0e('0xa6')+_0x338715);}if(_0x27d326!==null){logger[_0x1e0e('0xb6')](_0x1e0e('0xb8'),_0x27d326);_0x27d326[_0x1e0e('0xb9')]=_0x4f04fe;throw _0x27d326;}})[_0x1e0e('0xa7')](function(_0xdf069e){logger['error'](_0x1e0e('0xba'),_0xdf069e);throw msgResponse('[ifTime][Action]','Error',util[_0x1e0e('0x64')](_0xdf069e,{'showHidden':![],'depth':null}));});};Dialer[_0x1e0e('0x17')][_0x1e0e('0x29')]=function(_0x420186){if(this['voiceQueues'][_0x420186[_0x1e0e('0xbb')]]){if(this[_0x1e0e('0xbc')][_0x420186[_0x1e0e('0xbd')]]&&this['uniqueId'][_0x420186[_0x1e0e('0xbd')]][_0x1e0e('0x41')]!==_0x1e0e('0xbe')){this[_0x1e0e('0xbf')](this[_0x1e0e('0x1c')][_0x420186[_0x1e0e('0xbb')]]);this['uniqueId'][_0x420186[_0x1e0e('0xbd')]]['answertime']=moment()[_0x1e0e('0x43')](_0x1e0e('0xc0'));}}};Dialer['prototype'][_0x1e0e('0x2f')]=function(_0x4f5c4b){var _0x3e6a38=this['uniqueId'][_0x4f5c4b[_0x1e0e('0xbd')]];if(this[_0x1e0e('0x1c')][_0x4f5c4b[_0x1e0e('0xbb')]]){if(_0x3e6a38&&_0x3e6a38['type']!==_0x1e0e('0xbe')){delete this[_0x1e0e('0xbc')][_0x4f5c4b[_0x1e0e('0xbd')]];this[_0x1e0e('0x1c')][_0x4f5c4b[_0x1e0e('0xbb')]][_0x1e0e('0xc1')]+=0x1;var _0x2c9293=new AgentComplete(_0x3e6a38,_0x4f5c4b);if(_0x4f5c4b[_0x1e0e('0xc2')]===_0x1e0e('0xc3')){_0x2c9293[_0x1e0e('0xc4')]=this[_0x1e0e('0x1c')][_0x4f5c4b[_0x1e0e('0xbb')]][_0x1e0e('0xc5')]&&this[_0x1e0e('0x1c')][_0x4f5c4b[_0x1e0e('0xbb')]][_0x1e0e('0xc6')]?moment()[_0x1e0e('0x43')](_0x1e0e('0xc0')):undefined;}hopperUtils['createHistory'](_0x2c9293)[_0x1e0e('0xa7')](loggerCatch(_0x1e0e('0xc7')));hopperUtils[_0x1e0e('0xc8')](_0x2c9293)[_0x1e0e('0xa7')](loggerCatch(_0x1e0e('0xc9')));}}};Dialer[_0x1e0e('0x17')][_0x1e0e('0x2c')]=function(_0x3de452){var _0x47973e=this[_0x1e0e('0xbc')][_0x3de452[_0x1e0e('0xbd')]];var _0x12dd33=this;var _0x24c120=![];var _0x12d449;var _0x38770c;if(this[_0x1e0e('0x1c')][_0x3de452[_0x1e0e('0xbb')]]){if(_0x47973e&&_0x47973e[_0x1e0e('0x41')]!=='ivr'){delete this[_0x1e0e('0xbc')][_0x3de452['uniqueid']];this['updateOriginated'](this[_0x1e0e('0x1c')][_0x3de452['queue']]);_0x47973e['droptime']=moment()[_0x1e0e('0x43')](_0x1e0e('0xc0'));var _0x231444=new QueueCallerAbandon(_0x47973e,_0x3de452);if(utils[_0x1e0e('0xca')](_0x47973e['droptime'],_0x47973e['responsetime'])>=_0x47973e[_0x1e0e('0xcb')]){this[_0x1e0e('0x1c')][_0x3de452[_0x1e0e('0xbb')]]['predictiveIntervalDroppedCallsTimeout']+=0x1;this[_0x1e0e('0x1c')][_0x3de452[_0x1e0e('0xbb')]]['outboundDropCallsDayTimeout']+=0x1;this[_0x1e0e('0x1c')][_0x3de452[_0x1e0e('0xbb')]][_0x1e0e('0xcc')]+=0x1;_0x231444[_0x1e0e('0x6f')]=0xa;_0x231444[_0x1e0e('0xcd')]='Drop';_0x231444[_0x1e0e('0xce')]='TIMEOUT';_0x231444[_0x1e0e('0xc4')]=this[_0x1e0e('0x1c')][_0x3de452[_0x1e0e('0xbb')]][_0x1e0e('0xc5')]?moment()[_0x1e0e('0x43')](_0x1e0e('0xc0')):undefined;_0x231444['countdropretry']+=0x1;_0x231444[_0x1e0e('0xcf')]+=0x1;_0x12d449=this[_0x1e0e('0x1c')][_0x3de452[_0x1e0e('0xbb')]][_0x1e0e('0xd0')];_0x38770c=this['voiceQueues'][_0x3de452[_0x1e0e('0xbb')]]['callAdditionalPhoneAfterMin'];hopperUtils['verifyAdditionalPhones'](_0x231444,_0x231444[_0x1e0e('0x6f')],_0x47973e[_0x1e0e('0xd1')])['then'](function(_0x38f63d){_0x24c120=_0x38f63d[_0x1e0e('0xd2')]==0x1;if(_0x231444[_0x1e0e('0xd3')]>=_0x12dd33[_0x1e0e('0x1c')][_0x3de452[_0x1e0e('0xbb')]][_0x1e0e('0xd4')]){_0x12dd33[_0x1e0e('0xd5')](_0x231444,_0x38f63d[_0x1e0e('0xd2')]);}else{hopperUtils[_0x1e0e('0xd6')]({'active':![],'countdropretry':_0x231444['countdropretry'],'scheduledat':moment()[_0x1e0e('0xd7')](_0x12dd33[_0x1e0e('0x1c')][_0x3de452[_0x1e0e('0xbb')]][_0x1e0e('0xd0')],_0x1e0e('0xd8'))['format'](_0x1e0e('0xc0')),'ContactId':_0x47973e['ContactId'],'ListId':_0x47973e['ListId'],'VoiceQueueId':_0x47973e['VoiceQueueId']||undefined,'CampaignId':_0x47973e[_0x1e0e('0xd9')]||undefined})[_0x1e0e('0xa7')](loggerCatch(_0x1e0e('0xda')));var _0xb805f8=new History(_0x231444);_0xb805f8[_0x1e0e('0x6f')]=0xa;_0xb805f8['statedesc']='Drop';_0xb805f8[_0x1e0e('0x71')]=moment()[_0x1e0e('0x43')](_0x1e0e('0xc0'));_0xb805f8[_0x1e0e('0x70')]=_0xb805f8[_0x1e0e('0x71')];_0xb805f8[_0x1e0e('0xdb')]=_0x231444[_0x1e0e('0xdb')];_0xb805f8[_0x1e0e('0xdc')]=_0x231444[_0x1e0e('0xdc')];hopperUtils['createHistory'](_0xb805f8)['catch'](loggerCatch('[syncAgentComplete][createHistory][10]'));}})[_0x1e0e('0x3e')](function(){if(_0x24c120)hopperUtils['swapAdditionalPhones'](_0x231444,_0x12d449,_0x38770c)[_0x1e0e('0x3e')](function(){return 0x1;});});}else{this[_0x1e0e('0x1c')][_0x3de452[_0x1e0e('0xbb')]]['predictiveIntervalDroppedCallsCallersExit']+=0x1;this[_0x1e0e('0x1c')][_0x3de452[_0x1e0e('0xbb')]]['outboundDropCallsDayCallersExit']+=0x1;_0x231444[_0x1e0e('0x6f')]=0xb;_0x231444[_0x1e0e('0xcd')]=_0x1e0e('0xdd');_0x231444[_0x1e0e('0xce')]=_0x1e0e('0xde');_0x231444[_0x1e0e('0xdf')]+=0x1;_0x231444[_0x1e0e('0xcf')]+=0x1;_0x12d449=this['voiceQueues'][_0x3de452[_0x1e0e('0xbb')]][_0x1e0e('0xe0')];_0x38770c=this[_0x1e0e('0x1c')][_0x3de452[_0x1e0e('0xbb')]][_0x1e0e('0xe1')];hopperUtils[_0x1e0e('0xe2')](_0x231444,_0x231444[_0x1e0e('0x6f')],_0x47973e[_0x1e0e('0xd1')])['then'](function(_0x555276){if(_0x231444[_0x1e0e('0xdf')]>=_0x12dd33[_0x1e0e('0x1c')][_0x3de452[_0x1e0e('0xbb')]][_0x1e0e('0xe3')]){_0x12dd33['queueCallerAbandonCreateState'](_0x231444,_0x555276[_0x1e0e('0xd2')]);}else{hopperUtils[_0x1e0e('0xd6')]({'active':![],'countabandonedretry':_0x231444[_0x1e0e('0xdf')],'scheduledat':moment()[_0x1e0e('0xd7')](_0x12dd33[_0x1e0e('0x1c')][_0x3de452['queue']][_0x1e0e('0xe0')],_0x1e0e('0xd8'))[_0x1e0e('0x43')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x47973e[_0x1e0e('0xe4')],'ListId':_0x47973e[_0x1e0e('0xe5')],'VoiceQueueId':_0x47973e[_0x1e0e('0xe6')]||undefined,'CampaignId':_0x47973e['CampaignId']||undefined})[_0x1e0e('0xa7')](loggerCatch('[rescheduleContact][Abandoned]'));var _0x266488=new History(_0x231444);_0x266488['state']=0xb;_0x266488[_0x1e0e('0xcd')]='Abandoned';_0x266488[_0x1e0e('0x71')]=moment()[_0x1e0e('0x43')]('YYYY-MM-DD\x20HH:mm:ss');_0x266488[_0x1e0e('0x70')]=_0x266488['starttime'];_0x266488[_0x1e0e('0xdb')]=_0x231444[_0x1e0e('0xdb')];_0x266488[_0x1e0e('0xdc')]=_0x231444['calleridnum'];hopperUtils[_0x1e0e('0xe7')](_0x266488)[_0x1e0e('0xa7')](loggerCatch(_0x1e0e('0xe8')));}})[_0x1e0e('0x3e')](function(){if(_0x24c120)hopperUtils[_0x1e0e('0xe9')](_0x231444,_0x12d449,_0x38770c)[_0x1e0e('0x3e')](function(){return 0x1;});});}}}};Dialer[_0x1e0e('0x17')][_0x1e0e('0x35')]=function(_0x248074){if(this[_0x1e0e('0x21')][_0x248074[_0x1e0e('0xbd')]]){this[_0x1e0e('0x21')][_0x248074['uniqueid']][_0x1e0e('0xea')]=_0x248074[_0x1e0e('0xea')];}if(this[_0x1e0e('0xbc')][_0x248074[_0x1e0e('0xbd')]]){this[_0x1e0e('0xbc')][_0x248074[_0x1e0e('0xbd')]][_0x1e0e('0xea')]=_0x248074[_0x1e0e('0xea')];}};Dialer[_0x1e0e('0x17')][_0x1e0e('0x38')]=function(_0x23d04a){if(!this[_0x1e0e('0x21')][_0x23d04a['actionid']]){return;}var _0x1005a3=this[_0x1e0e('0x1c')][this[_0x1e0e('0x21')][_0x23d04a['actionid']][_0x1e0e('0xbb')]]['strategy']||_0x1e0e('0xeb');if(_0x1005a3===_0x1e0e('0xec')){if(this[_0x1e0e('0x21')][_0x23d04a[_0x1e0e('0xed')]]&&_[_0x1e0e('0xee')](this[_0x1e0e('0x21')][_0x23d04a[_0x1e0e('0xed')]]['locked'])&&_0x23d04a[_0x1e0e('0x8c')]==='1'&&_0x23d04a['paused']==='0'){if(this[_0x1e0e('0xef')][_0x23d04a[_0x1e0e('0xf0')]]){if(!this[_0x1e0e('0xef')][_0x23d04a[_0x1e0e('0xf0')]]['locked']){this[_0x1e0e('0xef')][_0x23d04a[_0x1e0e('0xf0')]][_0x1e0e('0xf1')]=!![];this[_0x1e0e('0x21')][_0x23d04a[_0x1e0e('0xed')]]['locked']=!![];this[_0x1e0e('0x21')][_0x23d04a[_0x1e0e('0xed')]][_0x1e0e('0xf0')]=_0x23d04a[_0x1e0e('0xf0')];}}}}else if(_0x1005a3===_0x1e0e('0xeb')){if(this[_0x1e0e('0x21')][_0x23d04a[_0x1e0e('0xed')]]){if(this[_0x1e0e('0xef')][_0x23d04a[_0x1e0e('0xf0')]]){this[_0x1e0e('0x21')][_0x23d04a['actionid']][_0x1e0e('0xf0')]=_0x23d04a[_0x1e0e('0xf0')];if(_[_0x1e0e('0xee')](this[_0x1e0e('0x27')][this['actions'][_0x23d04a['actionid']][_0x1e0e('0xbb')]])){this[_0x1e0e('0x27')][this[_0x1e0e('0x21')][_0x23d04a[_0x1e0e('0xed')]][_0x1e0e('0xbb')]]=[];}this['queueBooked'][this[_0x1e0e('0x21')][_0x23d04a['actionid']]['queue']]['push'](_[_0x1e0e('0x5c')](_['pick'](this['actions'][_0x23d04a['actionid']],[_0x1e0e('0xf2'),'stateinterface']),{'status':_0x23d04a['status'],'paused':_0x23d04a[_0x1e0e('0xf3')]}));}}}};Dialer[_0x1e0e('0x17')]['syncQueueStatusComplete']=function(_0x56a7f4){if(!this[_0x1e0e('0x21')][_0x56a7f4[_0x1e0e('0xed')]]){return;}var _0x40e20e=this;var _0x21b036=this['voiceQueues'][this[_0x1e0e('0x21')][_0x56a7f4[_0x1e0e('0xed')]]['queue']];var _0x15b491=_0x21b036['strategy']||'rrmemory';if(_0x15b491===_0x1e0e('0xec')){if(this[_0x1e0e('0x21')][_0x56a7f4['actionid']]&&this[_0x1e0e('0x21')][_0x56a7f4['actionid']][_0x1e0e('0xf0')]){this[_0x1e0e('0xf4')]['run'](this['actions'][_0x56a7f4['actionid']][_0x1e0e('0xf2')],this['actions'][_0x56a7f4['actionid']][_0x1e0e('0xf0')])[_0x1e0e('0xa7')](function(_0x1d2709){logger[_0x1e0e('0x62')](_0x1e0e('0xf5'),util['inspect'](_0x1d2709,{'showHidden':![],'depth':null}));})[_0x1e0e('0x1a')](function(){_0x40e20e[_0x1e0e('0xbf')](_0x40e20e[_0x1e0e('0x1c')][_0x40e20e[_0x1e0e('0x21')][_0x56a7f4[_0x1e0e('0xed')]][_0x1e0e('0xbb')]]);_0x40e20e[_0x1e0e('0xef')][_0x40e20e[_0x1e0e('0x21')][_0x56a7f4[_0x1e0e('0xed')]][_0x1e0e('0xf0')]]['locked']=![];delete _0x40e20e[_0x1e0e('0x21')][_0x56a7f4[_0x1e0e('0xed')]];unlockQueueStatus(_0x21b036);});}else{this[_0x1e0e('0xbf')](this['voiceQueues'][this[_0x1e0e('0x21')][_0x56a7f4['actionid']][_0x1e0e('0xbb')]]);hopperUtils[_0x1e0e('0xd6')]({'active':![],'ContactId':this[_0x1e0e('0x21')][_0x56a7f4['actionid']][_0x1e0e('0xe4')],'ListId':this[_0x1e0e('0x21')][_0x56a7f4[_0x1e0e('0xed')]][_0x1e0e('0xe5')],'VoiceQueueId':this[_0x1e0e('0x21')][_0x56a7f4[_0x1e0e('0xed')]][_0x1e0e('0xe6')]||undefined,'CampaignId':this[_0x1e0e('0x21')][_0x56a7f4['actionid']][_0x1e0e('0xd9')]||undefined})[_0x1e0e('0xa7')](loggerCatch(_0x1e0e('0xf6')));delete this[_0x1e0e('0x21')][_0x56a7f4[_0x1e0e('0xed')]];unlockQueueStatus(_0x21b036);}}else if(_0x15b491===_0x1e0e('0xeb')){var _0x54267d;if(this[_0x1e0e('0x21')][_0x56a7f4[_0x1e0e('0xed')]]&&!_['isEmpty'](this[_0x1e0e('0x27')][this[_0x1e0e('0x21')][_0x56a7f4[_0x1e0e('0xed')]][_0x1e0e('0xbb')]])){if(this[_0x1e0e('0xf7')][_0x40e20e[_0x1e0e('0x21')][_0x56a7f4[_0x1e0e('0xed')]]['queue']]){this['queueBookedRR'][_0x40e20e[_0x1e0e('0x21')][_0x56a7f4[_0x1e0e('0xed')]][_0x1e0e('0xbb')]]=this['queueBookedRR'][this[_0x1e0e('0x21')][_0x56a7f4['actionid']]['queue']]?this['queueBookedRR'][this['actions'][_0x56a7f4[_0x1e0e('0xed')]][_0x1e0e('0xbb')]]:this[_0x1e0e('0x27')][this['actions'][_0x56a7f4['actionid']][_0x1e0e('0xbb')]]?this[_0x1e0e('0x27')][this[_0x1e0e('0x21')][_0x56a7f4[_0x1e0e('0xed')]][_0x1e0e('0xbb')]][_0x1e0e('0xf8')]||0x0:0x0;}this[_0x1e0e('0x27')][this[_0x1e0e('0x21')][_0x56a7f4['actionid']][_0x1e0e('0xbb')]][_0x1e0e('0xf8')]=this[_0x1e0e('0xf7')][this[_0x1e0e('0x21')][_0x56a7f4[_0x1e0e('0xed')]]['queue']];for(var _0x4da047=0x0;_0x4da047=_0x48a8fb[_0x1e0e('0x118')]){_0x36aa73[_0x1e0e('0x119')](_0x46900c,_0x41b94c,_0x3becd0,'reason19\x20machine....');}else{if(_0x46900c[_0x1e0e('0x113')]>=_0x48a8fb[_0x1e0e('0x11a')]){_0x36aa73[_0x1e0e('0x11b')](_0x46900c,_0x41b94c,_0x3becd0,'reason\x2019\x20machine....');}else{hopperUtils[_0x1e0e('0xd6')]({'active':![],'countmachineretry':_0x46900c['countmachineretry'],'scheduledat':moment()[_0x1e0e('0xd7')](_0x48a8fb[_0x1e0e('0x11c')],_0x1e0e('0xd8'))['format'](_0x1e0e('0xc0')),'ContactId':_0x46900c[_0x1e0e('0xe4')],'ListId':_0x46900c['ListId'],'VoiceQueueId':_0x46900c[_0x1e0e('0xe6')]||undefined,'CampaignId':_0x46900c[_0x1e0e('0xd9')]||undefined})[_0x1e0e('0xa7')](loggerCatch(_0x1e0e('0x11d')));_0x41b94c({'reschedule':0x1});}}});}if(_0x4e745f[_0x1e0e('0x41')]===_0x1e0e('0xbe')&&this[_0x1e0e('0x1d')][_0x4e745f['queue']][_0x1e0e('0x107')]&&_0x35f4f6[_0x1e0e('0x108')]===_0x1e0e('0x109')){delete this[_0x1e0e('0xbc')][_0x35f4f6['uniqueid']];this[_0x1e0e('0xbf')](this[_0x1e0e('0x1d')][_0x4e745f[_0x1e0e('0xbb')]]);_0x4a1f84=new Hangup(_0x4e745f,_0x35f4f6);_0x4a1f84['state']=0x12;_0x4a1f84[_0x1e0e('0xcd')]=_0x1e0e('0x11e');_0x4a1f84[_0x1e0e('0x10b')]=_0x1e0e('0x112');ami[_0x1e0e('0x40')](_0x1e0e('0x10c'),ut[_0x1e0e('0x10d')](_0x4a1f84,_0x1e0e('0x10e')));this[_0x1e0e('0x11f')](_0x4a1f84,_0x1e0e('0x120'),_0x1e0e('0x121'));}if(_0x4e745f[_0x1e0e('0x41')]===_0x1e0e('0xbe')&&this[_0x1e0e('0x1d')][_0x4e745f['queue']][_0x1e0e('0x107')]&&_0x35f4f6[_0x1e0e('0x108')]===_0x1e0e('0x110')){return new Promise(function(_0x2d6a69,_0x5a960b){delete _0x36aa73['uniqueId'][_0x35f4f6['uniqueid']];_0x36aa73['updateOriginated'](_0x36aa73[_0x1e0e('0x1d')][_0x4e745f['queue']]);_0x36aa73[_0x1e0e('0x1d')][_0x4e745f['queue']][_0x1e0e('0xc1')]+=0x1;_0x36aa73[_0x1e0e('0x1d')][_0x4e745f[_0x1e0e('0xbb')]][_0x1e0e('0x10a')]+=0x1;var _0x21b6c1=_0x36aa73[_0x1e0e('0x1d')][_0x4e745f[_0x1e0e('0xbb')]];var _0xecba18=new Hangup(_0x4e745f,_0x35f4f6);_0xecba18[_0x1e0e('0x6f')]=0x13;_0xecba18[_0x1e0e('0xcd')]=_0x1e0e('0x111');_0xecba18[_0x1e0e('0x10b')]='AMD';_0xecba18[_0x1e0e('0x113')]+=0x1;_0xecba18[_0x1e0e('0xcf')]+=0x1;_0xecba18[_0x1e0e('0x10e')]=!![];ami[_0x1e0e('0x40')](_0x1e0e('0x10c'),ut[_0x1e0e('0x10d')](_0xecba18,_0x1e0e('0x10e')));hopperUtils[_0x1e0e('0xe7')](_0xecba18)[_0x1e0e('0xa7')](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0xecba18['countbusyretry']+_0xecba18[_0x1e0e('0x115')]+_0xecba18[_0x1e0e('0x116')]+_0xecba18[_0x1e0e('0x117')]+_0xecba18[_0x1e0e('0xd3')]+_0xecba18['countabandonedretry']+_0xecba18[_0x1e0e('0x113')]+_0xecba18[_0x1e0e('0x122')]>=_0x21b6c1['dialGlobalMaxRetry']){_0x36aa73[_0x1e0e('0x119')](_0xecba18,_0x2d6a69,_0x5a960b,_0x1e0e('0x123'));}else{if(_0xecba18['countmachineretry']>=_0x21b6c1['dialMachineMaxRetry']){_0x36aa73['createStateFinal'](_0xecba18,_0x2d6a69,_0x5a960b,_0x1e0e('0x124'));}else{hopperUtils[_0x1e0e('0xd6')]({'active':![],'countmachineretry':_0xecba18[_0x1e0e('0x113')],'scheduledat':moment()[_0x1e0e('0xd7')](_0x21b6c1['dialMachineRetryFrequency'],_0x1e0e('0xd8'))[_0x1e0e('0x43')](_0x1e0e('0xc0')),'ContactId':_0xecba18['ContactId'],'ListId':_0xecba18[_0x1e0e('0xe5')],'VoiceQueueId':_0xecba18[_0x1e0e('0xe6')]||undefined,'CampaignId':_0xecba18[_0x1e0e('0xd9')]||undefined})[_0x1e0e('0xa7')](loggerCatch('[rescheduleContact][Machine]'));_0x2d6a69({'reschedule':0x1});}}});}}};Dialer[_0x1e0e('0x17')][_0x1e0e('0x33')]=function(_0x4edb34){var _0xf9bfe5=this['uniqueId'][_0x4edb34[_0x1e0e('0xbd')]];var _0x352078;if(_0xf9bfe5&&_0xf9bfe5[_0x1e0e('0x41')]===_0x1e0e('0xbe')){delete this['uniqueId'][_0x4edb34[_0x1e0e('0xbd')]];this[_0x1e0e('0xbf')](this[_0x1e0e('0x1d')][_0xf9bfe5[_0x1e0e('0xbb')]]);this['campaigns'][_0xf9bfe5[_0x1e0e('0xbb')]][_0x1e0e('0x125')]+=0x1;_0x352078=new Hangup(_0xf9bfe5,_0x4edb34);hopperUtils[_0x1e0e('0xe7')](_0x352078)[_0x1e0e('0xa7')](loggerCatch(_0x1e0e('0x126')));hopperUtils['moveContactManagedDialer'](_0x352078)['catch'](loggerCatch('[syncHangupIvr]'));}if(_0xf9bfe5&&_0xf9bfe5[_0x1e0e('0x41')]!==_0x1e0e('0xbe')&&isNotNull(this['voiceQueues'][_0xf9bfe5[_0x1e0e('0xbb')]][_0x1e0e('0x127')])){delete this[_0x1e0e('0xbc')][_0x4edb34[_0x1e0e('0xbd')]];this['updateOriginated'](this[_0x1e0e('0x1c')][_0xf9bfe5['queue']]);this[_0x1e0e('0x1c')][_0xf9bfe5[_0x1e0e('0xbb')]]['outboundAnswerCallsDay']+=0x1;this[_0x1e0e('0x1c')][_0xf9bfe5[_0x1e0e('0xbb')]][_0x1e0e('0x10a')]+=0x1;_0x352078=new Hangup(_0xf9bfe5,_0x4edb34);_0x352078[_0x1e0e('0x6f')]=0x10;_0x352078['statedesc']=_0x1e0e('0x128');_0x352078[_0x1e0e('0x10b')]=_0x1e0e('0x129');hopperUtils['createHistory'](_0x352078)['catch'](loggerCatch(_0x1e0e('0x126')));hopperUtils['moveContactManagedDialer'](_0x352078)[_0x1e0e('0xa7')](loggerCatch('[syncHangupIvr]'));}if(_0xf9bfe5&&_0xf9bfe5['type']!==_0x1e0e('0xbe')&&!isNotNull(this[_0x1e0e('0x1c')][_0xf9bfe5[_0x1e0e('0xbb')]]['dialQueueProject'])){delete this[_0x1e0e('0xbc')][_0x4edb34[_0x1e0e('0xbd')]];this['updateOriginated'](this[_0x1e0e('0x1c')][_0xf9bfe5[_0x1e0e('0xbb')]]);this[_0x1e0e('0x1c')][_0xf9bfe5[_0x1e0e('0xbb')]][_0x1e0e('0x12a')]+=0x1;_0x352078=new Hangup(_0xf9bfe5,_0x4edb34);_0x352078['state']=0xc;_0x352078[_0x1e0e('0xcd')]=_0x4edb34['cause-txt'];_0x352078[_0x1e0e('0x10b')]=_0x1e0e('0x12b');hopperUtils['createHistory'](_0x352078)[_0x1e0e('0xa7')](loggerCatch(_0x1e0e('0x126')));hopperUtils[_0x1e0e('0xc8')](_0x352078)[_0x1e0e('0xa7')](loggerCatch(_0x1e0e('0x12c')));}};Dialer[_0x1e0e('0x17')]['syncQueueSummary']=function(_0x52a6a2){var _0x56f0b6=this;if(!_0x56f0b6['queuesSummary'][_0x52a6a2['name']]){_0x56f0b6['queuesSummary'][_0x52a6a2[_0x1e0e('0x45')]]={'running':![]};}else if(_0x56f0b6[_0x1e0e('0x28')][_0x52a6a2[_0x1e0e('0x45')]]['running']===!![]){return;}else if(_0x56f0b6[_0x1e0e('0x28')][_0x52a6a2[_0x1e0e('0x45')]][_0x1e0e('0x12d')]===![]){_0x56f0b6[_0x1e0e('0x28')][_0x52a6a2['name']]['running']=!![];}var _0x1861ac=_0x56f0b6[_0x1e0e('0x1c')][_0x52a6a2[_0x1e0e('0x45')]];var _0x5ddddf=_0x1861ac[_0x1e0e('0x6c')]!==utils[_0x1e0e('0x68')][_0x1e0e('0x7b')];var _0x77cb28=utils[_0x1e0e('0x12e')](_0x1861ac);_0x1861ac['statusMessage']=utils['getQueueCampaignStatusMessage'](_0x1861ac,_0x56f0b6[_0x1e0e('0x1e')]);Promise[_0x1e0e('0xac')]()['then'](function(){if(_0x1861ac[_0x1e0e('0x12f')]===utils['CAMPAIGN_STATUS']['INACTIVE']){if(_0x5ddddf){clearPredictiveAttributes(_0x1861ac);_0x52a6a2[_0x1e0e('0x24')]=undefined;_0x52a6a2['startProgressive']=undefined;}if(_0x1861ac['statusMessage']===utils[_0x1e0e('0x68')]['INACTIVE']){_0x52a6a2[_0x1e0e('0x130')]=0x0;_0x52a6a2[_0x1e0e('0xf3')]=0x0;_0x52a6a2['inUse']=0x0;_0x52a6a2[_0x1e0e('0x131')]=0x0;_0x52a6a2[_0x1e0e('0x132')]=0x0;}}else if(_0x1861ac['statusMessage']===utils[_0x1e0e('0x68')][_0x1e0e('0x133')]&&!_0x77cb28){return _0x56f0b6[_0x1e0e('0x95')](_0x1861ac,!![])[_0x1e0e('0x3e')](function(){return _0x56f0b6['ifTime'](_0x1861ac,![]);})[_0x1e0e('0x3e')](function(){return _0x56f0b6[_0x1e0e('0x134')](_0x1861ac);})[_0x1e0e('0xa7')](function(_0xc1256c){loggerSyncQueueSummary['debug']('[syncQueueSummary]',util[_0x1e0e('0x64')](_0xc1256c,{'showHidden':![],'depth':null}));clearPredictiveAttributes(_0x1861ac);});}else{clearPredictiveAttributes(_0x1861ac);}})[_0x1e0e('0x3e')](function(){var _0x3ba52d=_0x52a6a2[_0x1e0e('0x135')](_0x1861ac);if(_0x3ba52d||_0x1861ac[_0x1e0e('0x136')]){_0x1861ac[_0x1e0e('0x136')]=![];_0x52a6a2[_0x1e0e('0x137')](_0x1861ac);Object[_0x1e0e('0x138')](_0x1861ac,_0x52a6a2);emitOutboundVoiceQueueSummary(_0x52a6a2);}_0x56f0b6['queuesSummary'][_0x1861ac['name']][_0x1e0e('0x12d')]=![];})[_0x1e0e('0xa7')](function(_0x499f8c){logger[_0x1e0e('0x62')]('[syncQueueSummary]',util['inspect'](_0x499f8c,{'showHidden':![],'depth':null}));_0x56f0b6['queuesSummary'][_0x1861ac[_0x1e0e('0x45')]][_0x1e0e('0x12d')]=![];});};Dialer[_0x1e0e('0x17')][_0x1e0e('0x32')]=_[_0x1e0e('0x139')](function(){var _0x2c0c4c=_['filter'](this[_0x1e0e('0x1c')],function(_0x55b0c1){return _0x55b0c1[_0x1e0e('0x13a')];});var _0x195466=_[_0x1e0e('0x13b')](this[_0x1e0e('0xef')],function(_0xa2ccf0){return _0xa2ccf0[_0x1e0e('0x13c')]&&_0xa2ccf0[_0x1e0e('0x8c')]==='reachable';});if(_0x2c0c4c[_0x1e0e('0x99')]>0x0&&_0x195466[_0x1e0e('0x99')]>0x0){return Promise[_0x1e0e('0xac')]()[_0x1e0e('0x3e')](cmHopper[_0x1e0e('0x13d')](_[_0x1e0e('0x13e')](_0x2c0c4c,'id'),previewRecallmeReminderInterval,_[_0x1e0e('0x13e')](_0x195466,'id')))[_0x1e0e('0x3e')](function(_0x203967){for(var _0x363484=0x0;_0x363484<_0x203967[_0x1e0e('0x99')];_0x363484++){var _0xa7b169=_0x203967[_0x363484][_0x1e0e('0x13f')][_0x1e0e('0x45')];if(_0xa7b169)io['to'](util[_0x1e0e('0x43')](_0x1e0e('0x140'),_0xa7b169))[_0x1e0e('0x40')](_0x1e0e('0x141'),{'hopper':_0x203967[_0x363484]});}})[_0x1e0e('0xa7')](function(_0x22c9cb){logger[_0x1e0e('0x62')](_0x1e0e('0x142'),_0x22c9cb);});}},0x3c*0x3e8,{'leading':!![]});Dialer[_0x1e0e('0x17')][_0x1e0e('0x3c')]=function(){var _0x1b26f8=this;setInterval(function(){_0x1b26f8[_0x1e0e('0x143')](_0x1b26f8['uniqueId'],_0x1e0e('0x144'));_0x1b26f8[_0x1e0e('0x143')](_0x1b26f8['actions'],_0x1e0e('0x145'));},0x32c8);};Dialer[_0x1e0e('0x17')][_0x1e0e('0x143')]=function(_0x21230d,_0x3780fa){var _0x222634=this;for(var _0x53cb61 in _0x21230d){if(typeof _0x21230d[_0x53cb61]!==_0x1e0e('0xaa')){this[_0x1e0e('0x1b')][_0x1e0e('0x18')](function(){if(!_[_0x1e0e('0xee')](_0x21230d[_0x53cb61])){return ami[_0x1e0e('0x9f')]({'action':_0x1e0e('0x8c'),'channel':_0x21230d[_0x53cb61][_0x1e0e('0xea')]})[_0x1e0e('0xa7')](function(_0x1c39a0){if(_0x1c39a0[_0x1e0e('0x6c')]===_0x1e0e('0x146')){setTimeout(function(){if(_0x21230d[_0x53cb61]&&_0x21230d[_0x53cb61][_0x1e0e('0x41')]!==_0x1e0e('0xbe')){_0x222634[_0x1e0e('0xbf')](_0x222634[_0x1e0e('0x1c')][_0x21230d[_0x53cb61][_0x1e0e('0xbb')]]);logger[_0x1e0e('0x62')]('[Dialer][checkChannel]',_0x3780fa,_0x53cb61,_0x21230d[_0x53cb61][_0x1e0e('0xbb')]);delete _0x21230d[_0x53cb61];}if(_0x21230d[_0x53cb61]&&_0x21230d[_0x53cb61][_0x1e0e('0x41')]===_0x1e0e('0xbe')){_0x222634[_0x1e0e('0xbf')](_0x222634[_0x1e0e('0x1d')][_0x21230d[_0x53cb61][_0x1e0e('0xbb')]]);logger['error']('[Dialer][checkChannel][ivr]',_0x3780fa,_0x53cb61,_0x21230d[_0x53cb61][_0x1e0e('0xbb')]);delete _0x21230d[_0x53cb61];}},0x2328);}});}});}}};Dialer[_0x1e0e('0x17')][_0x1e0e('0x147')]=function(_0x1275e8){return Promise['resolve']()[_0x1e0e('0x3e')](voiceQueueRt[_0x1e0e('0x147')](_0x1275e8))[_0x1e0e('0xa7')](loggerCatch('[getVoiceQueueRtPauses]\x20'));};Dialer[_0x1e0e('0x17')][_0x1e0e('0xbf')]=function(_0x573954){if(!_[_0x1e0e('0x53')](_0x573954)&&_0x573954!==null){if(typeof _0x573954[_0x1e0e('0x80')]!=='undefined'){if(_0x573954[_0x1e0e('0x80')]>0x0){_0x573954[_0x1e0e('0x80')]-=0x1;}else{logger[_0x1e0e('0x62')]('[updateOriginated]\x20object\x20originated\x20is\x20negative');}}}else{logger[_0x1e0e('0x62')]('[updateOriginated]\x20is\x20null\x20or\x20undefined');}};Dialer[_0x1e0e('0x17')][_0x1e0e('0x148')]=function(_0x2c75ad,_0x2d9b61){var _0x2258ed=this;return function(_0x141e78){_0x2258ed[_0x1e0e('0xbf')](_0x2d9b61);logger[_0x1e0e('0x62')](_0x2c75ad,util[_0x1e0e('0x64')](_0x141e78,{'showHidden':![],'depth':null}));};};Dialer['prototype']['emptyContact']=function(_0x289f67,_0x453a1d,_0x5cb0b1){var _0x27342b={'state':0x19,'statedesc':_0x1e0e('0x149')};this['updateOriginated'](_0x453a1d);this[_0x1e0e('0x11f')](_['merge'](_0x27342b,_['pick'](_0x5cb0b1,[_0x1e0e('0xe4'),_0x1e0e('0xe5'),'UserId',_0x1e0e('0xe6'),_0x1e0e('0xd9')])),_0x1e0e('0x14a'),_0x1e0e('0x14b'));logger[_0x1e0e('0x62')](_0x289f67);};Dialer[_0x1e0e('0x17')][_0x1e0e('0x11f')]=function(_0x5ddeaa,_0x37afd6,_0x38ca8d){hopperUtils[_0x1e0e('0xe7')](_0x5ddeaa)[_0x1e0e('0xa7')](loggerCatch(_0x37afd6));hopperUtils[_0x1e0e('0xc8')](_0x5ddeaa)['catch'](loggerCatch(_0x38ca8d));};Dialer[_0x1e0e('0x17')]['queueCallerAbandonCreateState']=function(_0x427967,_0x1cfe2c){hopperUtils[_0x1e0e('0xe7')](_0x427967)['catch'](loggerCatch('[syncAgentComplete][createHistory]'));if(_0x1cfe2c==0x0){hopperUtils[_0x1e0e('0xc8')](_0x427967)[_0x1e0e('0xa7')](loggerCatch(_0x1e0e('0x14c')));}};Dialer[_0x1e0e('0x17')][_0x1e0e('0x142')]=function(_0x2fcd5c){return Promise[_0x1e0e('0xac')]()[_0x1e0e('0x3e')](cmHopper[_0x1e0e('0x13d')](_0x2fcd5c['id'],previewRecallmeReminderInterval))[_0x1e0e('0x3e')](function(_0x3059e6){for(var _0x51b548=0x0;_0x51b548<_0x3059e6[_0x1e0e('0x99')];_0x51b548++){var _0xcc72ed=_0x3059e6[_0x51b548]['Agent'][_0x1e0e('0x45')];if(_0xcc72ed)io['to'](util['format'](_0x1e0e('0x140'),_0xcc72ed))[_0x1e0e('0x40')](_0x1e0e('0x141'),{'hopper':_0x3059e6[_0x51b548]});}})[_0x1e0e('0xa7')](function(){});};Dialer[_0x1e0e('0x17')][_0x1e0e('0xae')]=function(_0x3f778f){var _0x57d700=this;return function(){_0x57d700['handleIvr'](_0x3f778f);};};Dialer[_0x1e0e('0x17')][_0x1e0e('0x14d')]=function(_0x4fb3e3,_0x2b8c03){var _0x3dafe2=this;var _0x47a21a=uuid['v4']();this[_0x1e0e('0x21')][_0x47a21a]=new Action(_0x4fb3e3,_0x2b8c03,_0x47a21a);return new Promise(function(_0x5172c5,_0x4ff479){if(_['isUndefined'](_0x4fb3e3)&&typeof _0x4fb3e3!==_0x1e0e('0x14e')){return _0x4ff479(msgResponse(_0x1e0e('0x14f'),_0x1e0e('0x96'),_0x1e0e('0x150')));}if(_[_0x1e0e('0x53')](_0x2b8c03[_0x1e0e('0x151')])||_0x2b8c03[_0x1e0e('0x151')]===null){return _0x4ff479(msgResponse(_0x1e0e('0x14f'),_0x1e0e('0x96'),'contact\x20is\x20undefine'));}var _0x1b2e1b={'XMD-CALLERID':_0x3dafe2[_0x1e0e('0x21')][_0x47a21a][_0x1e0e('0x152')](),'XMD-AGI':_0x4fb3e3[_0x1e0e('0x127')]?util[_0x1e0e('0x43')](_0x1e0e('0x153'),ipAgi,_0x4fb3e3[_0x1e0e('0x127')]):_0x1e0e('0x154'),'XMD-AGIAFTER':_0x4fb3e3[_0x1e0e('0xc5')]?util[_0x1e0e('0x43')](_0x1e0e('0x153'),ipAgi,_0x4fb3e3[_0x1e0e('0xc5')]):_0x1e0e('0x154'),'XMD-QUEUE':utils[_0x1e0e('0x155')](_0x4fb3e3)?util[_0x1e0e('0x43')](_0x1e0e('0x156'),_0x4fb3e3['name'],_0x4fb3e3['dialQueueOptions']||'',_0x4fb3e3['dialAgiAfterHangupAgent']?'c':'',_0x4fb3e3['dialQueueTimeout']||0x3):_0x1e0e('0x154'),'XMD-CONTACTID':_0x2b8c03[_0x1e0e('0xe4')],'XMD-CDRTYPE':_0x1e0e('0x6'),'CALLERID(all)':_0x3dafe2['actions'][_0x47a21a][_0x1e0e('0x152')](),'XMD-AMD':_0x4fb3e3[_0x1e0e('0x107')]?_0x1e0e('0x133'):_0x1e0e('0x154'),'XMD-DESTINATION':_0x1e0e('0x106')};if(_0x4fb3e3[_0x1e0e('0x107')]){_0x1b2e1b[_0x1e0e('0x157')]=_0x4fb3e3['dialAMDInitialSilence']||0x9c4;_0x1b2e1b[_0x1e0e('0x158')]=_0x4fb3e3['dialAMDGreeting']||0x5dc;_0x1b2e1b[_0x1e0e('0x159')]=_0x4fb3e3[_0x1e0e('0x15a')]||0x320;_0x1b2e1b[_0x1e0e('0x15b')]=_0x4fb3e3[_0x1e0e('0x15c')]||0x1388;_0x1b2e1b['XMD-AMDMINWORDLENGTH']=_0x4fb3e3[_0x1e0e('0x15d')]||0x64;_0x1b2e1b[_0x1e0e('0x15e')]=_0x4fb3e3[_0x1e0e('0x15f')]||0x32;_0x1b2e1b[_0x1e0e('0x160')]=_0x4fb3e3[_0x1e0e('0x161')]||0x3;_0x1b2e1b[_0x1e0e('0x162')]=_0x4fb3e3[_0x1e0e('0x163')]||0x100;_0x1b2e1b[_0x1e0e('0x164')]=_0x4fb3e3[_0x1e0e('0x165')]||0x1388;}if(utils[_0x1e0e('0x155')](_0x4fb3e3)){_0x1b2e1b[_0x1e0e('0x166')]=_0x2b8c03[_0x1e0e('0xe6')];}else{_0x1b2e1b['XMD-CAMPAIGNID']=_0x2b8c03[_0x1e0e('0xd9')];}var _0x4359d3=utils[_0x1e0e('0x167')](_0x2b8c03[_0x1e0e('0x168')]);Object['assign'](_0x1b2e1b,_0x4359d3);var _0xe3c6e4=_0x3dafe2['isTrunkReachable'](_0x4fb3e3[_0x1e0e('0x8f')])?utils[_0x1e0e('0x169')](_0x4fb3e3['Trunk'][_0x1e0e('0x16a')],_0x4fb3e3[_0x1e0e('0x16b')],_0x4fb3e3[_0x1e0e('0x16c')]>0x0?utils['getCallerIdRandom'](_0x4fb3e3[_0x1e0e('0x16d')],_0x4fb3e3[_0x1e0e('0x16c')]):_0x4fb3e3[_0x1e0e('0x16d')]):utils[_0x1e0e('0x169')](_[_0x1e0e('0xee')](_0x4fb3e3[_0x1e0e('0x90')])?_0x4fb3e3[_0x1e0e('0x8f')][_0x1e0e('0x16a')]:_0x4fb3e3[_0x1e0e('0x90')]['callerid'],_0x4fb3e3[_0x1e0e('0x16b')],_0x4fb3e3[_0x1e0e('0x16c')]>0x0?utils[_0x1e0e('0x16e')](_0x4fb3e3[_0x1e0e('0x16d')],_0x4fb3e3[_0x1e0e('0x16c')]):_0x4fb3e3[_0x1e0e('0x16d')]);if(_0xe3c6e4){_0x1b2e1b[_0x1e0e('0x16f')]=_0x3dafe2[_0x1e0e('0x21')][_0x47a21a][_0x1e0e('0x170')]=utils['extractCalleridName'](_0xe3c6e4);_0x1b2e1b['XMD-ORIGINATECALLERIDNUM']=_0x2b8c03[_0x1e0e('0x151')];}_0x4fb3e3[_0x1e0e('0x171')]=_0x1b2e1b;return ami['Action']({'actionid':_0x47a21a,'action':'originate','channel':_0x3dafe2[_0x1e0e('0x88')](_0x4fb3e3[_0x1e0e('0x8f')])?util['format'](_0x1e0e('0x172'),_0x4fb3e3[_0x1e0e('0x8f')][_0x1e0e('0x45')],isNotNull(_0x4fb3e3[_0x1e0e('0x173')])?_0x4fb3e3[_0x1e0e('0x173')][_0x1e0e('0x174')]()||'':'',_0x4fb3e3[_0x1e0e('0x175')]>0x0?_0x2b8c03[_0x1e0e('0x151')][_0x1e0e('0x176')](_0x4fb3e3[_0x1e0e('0x175')]):_0x2b8c03[_0x1e0e('0x151')]):util[_0x1e0e('0x43')](_0x1e0e('0x172'),_[_0x1e0e('0xee')](_0x4fb3e3[_0x1e0e('0x90')])?_0x4fb3e3[_0x1e0e('0x8f')][_0x1e0e('0x45')]:_0x4fb3e3[_0x1e0e('0x90')][_0x1e0e('0x45')],isNotNull(_0x4fb3e3['dialPrefix'])?_0x4fb3e3[_0x1e0e('0x173')][_0x1e0e('0x174')]()||'':'',_0x4fb3e3[_0x1e0e('0x175')]>0x0?_0x2b8c03['phone'][_0x1e0e('0x176')](_0x4fb3e3['dialCutDigit']):_0x2b8c03['phone']),'callerid':_0xe3c6e4,'Exten':_0x1e0e('0x106'),'Context':_0x1e0e('0x177'),'Priority':'1','variable':_0x1b2e1b,'timeout':(_0x4fb3e3[_0x1e0e('0x178')]||0x1e)*0x3e8,'async':!![],'channelid':_0x47a21a})[_0x1e0e('0x3e')](function(_0x1bcfdd){return _0x5172c5(_0x1bcfdd);})[_0x1e0e('0xa7')](function(_0x591444){_0x4fb3e3[_0x1e0e('0x179')]+=0x1;var _0x26f81d=new History(_0x3dafe2['actions'][_0x47a21a]);logger[_0x1e0e('0x62')](util['format'](_0x1e0e('0x17a'),JSON[_0x1e0e('0x75')](_0x591444)));_0x26f81d[_0x1e0e('0x6f')]=0xe;_0x26f81d[_0x1e0e('0xcd')]=_0x1e0e('0x17b');_0x26f81d[_0x1e0e('0x71')]=moment()[_0x1e0e('0x43')](_0x1e0e('0xc0'));_0x26f81d[_0x1e0e('0x70')]=_0x26f81d[_0x1e0e('0x71')];hopperUtils['createHistory'](_0x26f81d)[_0x1e0e('0xa7')](loggerCatch('[originate][error]'));_0x3dafe2[_0x1e0e('0xc8')](_0x26f81d)[_0x1e0e('0xa7')](loggerCatch(_0x1e0e('0x17c')))[_0x1e0e('0x1a')](function(){delete _0x3dafe2[_0x1e0e('0x21')][_0x47a21a];return _0x4ff479(msgResponse(_0x1e0e('0x14f'),_0x1e0e('0x87'),_0x1e0e('0x17d')));});});});};Dialer['prototype']['checkRetriveMax']=function(_0x336a86,_0xf0e72c,_0x476240){var _0x15cd49=new History(_0xf0e72c);if(_0x15cd49[_0x1e0e('0x17e')]+_0x15cd49[_0x1e0e('0x115')]+_0x15cd49['countnoanswerretry']+_0x15cd49['countnosuchnumberretry']+_0x15cd49[_0x1e0e('0xd3')]+_0x15cd49['countabandonedretry']+_0x15cd49[_0x1e0e('0x113')]+_0x15cd49[_0x1e0e('0x122')]>=_0x476240['dialGlobalMaxRetry']-0x1){return!![];}switch(_0x336a86){case 0x3:if(_0x15cd49[_0x1e0e('0x116')]>=_0x476240[_0x1e0e('0x17f')]-0x1){return!![];}hopperUtils[_0x1e0e('0xd6')]({'active':![],'countnoanswerretry':_0x15cd49[_0x1e0e('0x116')]+=0x1,'scheduledat':moment()['add'](_0x476240[_0x1e0e('0x180')],_0x1e0e('0xd8'))[_0x1e0e('0x43')](_0x1e0e('0xc0')),'ContactId':_0x15cd49[_0x1e0e('0xe4')],'ListId':_0x15cd49[_0x1e0e('0xe5')],'VoiceQueueId':_0x15cd49[_0x1e0e('0xe6')]||undefined,'CampaignId':_0x15cd49[_0x1e0e('0xd9')]||undefined})[_0x1e0e('0xa7')](loggerCatch(_0x1e0e('0x181')));break;case 0x5:if(_0x15cd49[_0x1e0e('0x17e')]>=_0x476240[_0x1e0e('0x182')]-0x1){return!![];}hopperUtils[_0x1e0e('0xd6')]({'active':![],'countbusyretry':_0x15cd49[_0x1e0e('0x17e')]+=0x1,'scheduledat':moment()['add'](_0x476240[_0x1e0e('0x183')],_0x1e0e('0xd8'))['format'](_0x1e0e('0xc0')),'ContactId':_0x15cd49[_0x1e0e('0xe4')],'ListId':_0x15cd49['ListId'],'VoiceQueueId':_0x15cd49[_0x1e0e('0xe6')]||undefined,'CampaignId':_0x15cd49[_0x1e0e('0xd9')]||undefined})[_0x1e0e('0xa7')](loggerCatch(_0x1e0e('0x184')));break;case 0x8:if(_0x15cd49['countcongestionretry']>=_0x476240[_0x1e0e('0x185')]-0x1){return!![];}hopperUtils[_0x1e0e('0xd6')]({'active':![],'countcongestionretry':_0x15cd49[_0x1e0e('0x115')]+=0x1,'scheduledat':moment()[_0x1e0e('0xd7')](_0x476240['dialCongestionRetryFrequency'],'minutes')[_0x1e0e('0x43')](_0x1e0e('0xc0')),'ContactId':_0x15cd49[_0x1e0e('0xe4')],'ListId':_0x15cd49[_0x1e0e('0xe5')],'VoiceQueueId':_0x15cd49[_0x1e0e('0xe6')]||undefined,'CampaignId':_0x15cd49[_0x1e0e('0xd9')]||undefined})['catch'](loggerCatch(_0x1e0e('0x186')));break;case 0x0:if(_0x15cd49['countnosuchnumberretry']>=_0x476240['dialNoSuchNumberMaxRetry']-0x1){return!![];}else{hopperUtils[_0x1e0e('0xd6')]({'active':![],'countnosuchnumberretry':_0x15cd49[_0x1e0e('0x117')]+=0x1,'scheduledat':moment()[_0x1e0e('0xd7')](_0x476240[_0x1e0e('0x187')],_0x1e0e('0xd8'))[_0x1e0e('0x43')](_0x1e0e('0xc0')),'ContactId':_0x15cd49['ContactId'],'ListId':_0x15cd49[_0x1e0e('0xe5')],'VoiceQueueId':_0x15cd49[_0x1e0e('0xe6')]||undefined,'CampaignId':_0x15cd49[_0x1e0e('0xd9')]||undefined})['catch'](loggerCatch('[rescheduleContact][NoSuchNumber]'));}break;case 0xa:if(_0x15cd49[_0x1e0e('0xd3')]>=_0x476240[_0x1e0e('0xd4')]-0x1){return!![];}hopperUtils[_0x1e0e('0xd6')]({'active':![],'countdropretry':_0x15cd49[_0x1e0e('0xd3')]+=0x1,'scheduledat':moment()['add'](_0x476240['dialDropRetryFrequency'],_0x1e0e('0xd8'))[_0x1e0e('0x43')](_0x1e0e('0xc0')),'ContactId':_0x15cd49[_0x1e0e('0xe4')],'ListId':_0x15cd49[_0x1e0e('0xe5')],'VoiceQueueId':_0x15cd49[_0x1e0e('0xe6')]||undefined,'CampaignId':_0x15cd49[_0x1e0e('0xd9')]||undefined})[_0x1e0e('0xa7')](loggerCatch(_0x1e0e('0xda')));break;case 0xb:if(_0x15cd49[_0x1e0e('0xdf')]>=_0x476240[_0x1e0e('0xe3')]-0x1){return!![];}hopperUtils[_0x1e0e('0xd6')]({'active':![],'countabandonedretry':_0x15cd49[_0x1e0e('0xdf')]+=0x1,'scheduledat':moment()[_0x1e0e('0xd7')](_0x476240[_0x1e0e('0xe0')],_0x1e0e('0xd8'))[_0x1e0e('0x43')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x15cd49['ContactId'],'ListId':_0x15cd49['ListId'],'VoiceQueueId':_0x15cd49[_0x1e0e('0xe6')]||undefined,'CampaignId':_0x15cd49[_0x1e0e('0xd9')]||undefined})[_0x1e0e('0xa7')](loggerCatch(_0x1e0e('0x188')));break;case 0x13:if(_0x15cd49[_0x1e0e('0x113')]>=_0x476240[_0x1e0e('0x11a')]-0x1){return!![];}hopperUtils[_0x1e0e('0xd6')]({'active':![],'countmachineretry':_0x15cd49[_0x1e0e('0x113')]+=0x1,'scheduledat':moment()[_0x1e0e('0xd7')](_0x476240[_0x1e0e('0x11c')],_0x1e0e('0xd8'))[_0x1e0e('0x43')](_0x1e0e('0xc0')),'ContactId':_0x15cd49['ContactId'],'ListId':_0x15cd49[_0x1e0e('0xe5')],'VoiceQueueId':_0x15cd49[_0x1e0e('0xe6')]||undefined,'CampaignId':_0x15cd49['CampaignId']||undefined})[_0x1e0e('0xa7')](loggerCatch(_0x1e0e('0x11d')));break;case 0x14:if(_0x15cd49[_0x1e0e('0x122')]>=_0x476240[_0x1e0e('0x189')]-0x1){return!![];}hopperUtils[_0x1e0e('0xd6')]({'active':![],'countagentrejectretry':_0x15cd49[_0x1e0e('0x122')]+=0x1,'scheduledat':moment()[_0x1e0e('0xd7')](_0x476240[_0x1e0e('0x18a')],_0x1e0e('0xd8'))[_0x1e0e('0x43')](_0x1e0e('0xc0')),'ContactId':_0x15cd49[_0x1e0e('0xe4')],'ListId':_0x15cd49[_0x1e0e('0xe5')],'VoiceQueueId':_0x15cd49[_0x1e0e('0xe6')]||undefined,'CampaignId':_0x15cd49['CampaignId']||undefined})['catch'](loggerCatch(_0x1e0e('0x18b')));break;default:return!![];}};Dialer[_0x1e0e('0x17')][_0x1e0e('0x102')]=function(_0x3d7a55,_0x47d681,_0x345d3c){var _0x43e54a=this;var _0x1194c9=new History(_0x3d7a55);var _0x4caa0f=![];var _0x1aa5f8;var _0x33fd47;return new Promise(function(_0x3de314,_0x1b63b5){if(_[_0x1e0e('0x53')](_0x47d681)&&typeof _0x47d681!==_0x1e0e('0x14e')){return _0x1b63b5(msgResponse('[callProgressDetecting]',_0x1e0e('0x96'),_0x1e0e('0x18c')));}if(_[_0x1e0e('0x53')](_0x345d3c)&&typeof _0x345d3c!=='object'){return _0x1b63b5(msgResponse(_0x1e0e('0x18d'),_0x1e0e('0x96'),_0x1e0e('0x18e')));}hopperUtils[_0x1e0e('0xe2')](_0x1194c9,_0x345d3c[_0x1e0e('0xc2')],_0x47d681)[_0x1e0e('0x3e')](function(_0x4114e2){if(_0x4114e2[_0x1e0e('0xd2')]==0x1)_0x4caa0f=!![];switch(_0x345d3c[_0x1e0e('0xc2')]){case'0':_0x47d681[_0x1e0e('0x18f')]+=0x1;_0x1194c9[_0x1e0e('0x6f')]=0x0;_0x1194c9['statedesc']=_0x1e0e('0x190');_0x1194c9[_0x1e0e('0x117')]+=0x1;_0x1194c9[_0x1e0e('0xcf')]+=0x1;ami[_0x1e0e('0x40')](_0x1e0e('0x191'),ut['buildObj'](_0x3d7a55,'nosuchnumber'));_0x1aa5f8=_0x47d681[_0x1e0e('0x187')];_0x33fd47=_0x47d681['callAdditionalPhoneAfterMin'];hopperUtils[_0x1e0e('0xe7')](_0x1194c9)[_0x1e0e('0xa7')](loggerCatch(_0x1e0e('0x114')));if(_0x43e54a[_0x1e0e('0x192')](0x0,_0x3d7a55,_0x47d681)&&!_0x4caa0f){if(_0x1194c9[_0x1e0e('0x117')]>=_0x47d681[_0x1e0e('0x193')]){_0x43e54a[_0x1e0e('0x11b')](_0x1194c9,_0x3de314,_0x1b63b5,'reason\x200\x20no\x20such\x20number....');}else{_0x43e54a[_0x1e0e('0x119')](_0x1194c9,_0x3de314,_0x1b63b5,_0x1e0e('0x194'));}}break;case'3':_0x47d681[_0x1e0e('0x195')]+=0x1;_0x1194c9['state']=0x3;_0x1194c9['statedesc']=_0x1e0e('0x196');_0x1194c9[_0x1e0e('0x116')]+=0x1;_0x1194c9[_0x1e0e('0xcf')]+=0x1;var _0x437491=ut['buildNoAnswerEventPayload'](_0x3d7a55,_0x47d681);ami[_0x1e0e('0x40')](_0x1e0e('0x197'),_0x437491);_0x1aa5f8=_0x47d681[_0x1e0e('0x180')];_0x33fd47=_0x47d681['callAdditionalPhoneAfterMin'];hopperUtils[_0x1e0e('0xe7')](_0x1194c9)[_0x1e0e('0xa7')](loggerCatch(_0x1e0e('0x198')));if(_0x43e54a[_0x1e0e('0x192')](0x3,_0x3d7a55,_0x47d681)&&!_0x4caa0f){if(_0x1194c9[_0x1e0e('0x116')]>=_0x47d681[_0x1e0e('0x17f')]){_0x43e54a[_0x1e0e('0x11b')](_0x1194c9,_0x3de314,_0x1b63b5,_0x1e0e('0x199'));}else{_0x43e54a[_0x1e0e('0x119')](_0x1194c9,_0x3de314,_0x1b63b5,_0x1e0e('0x199'));}}break;case'5':_0x47d681[_0x1e0e('0x19a')]+=0x1;_0x1194c9['state']=0x5;_0x1194c9[_0x1e0e('0xcd')]='Busy';_0x1194c9[_0x1e0e('0x17e')]+=0x1;_0x1194c9[_0x1e0e('0xcf')]+=0x1;ami['emit']('custom:agentbusy',ut[_0x1e0e('0x10d')](_0x3d7a55,'busy'));_0x1aa5f8=_0x47d681['dialBusyRetryFrequency'];_0x33fd47=_0x47d681['callAdditionalPhoneAfterMin'];hopperUtils[_0x1e0e('0xe7')](_0x1194c9)[_0x1e0e('0xa7')](loggerCatch(_0x1e0e('0x19b')));if(_0x43e54a[_0x1e0e('0x192')](0x5,_0x3d7a55,_0x47d681)&&!_0x4caa0f){if(_0x1194c9[_0x1e0e('0x17e')]>=_0x47d681['dialBusyMaxRetry']){_0x43e54a['createStateFinal'](_0x1194c9,_0x3de314,_0x1b63b5,_0x1e0e('0x19c'));}else{_0x43e54a[_0x1e0e('0x119')](_0x1194c9,_0x3de314,_0x1b63b5,_0x1e0e('0x19c'));}}break;case'8':_0x47d681['outboundCongestionCallsDay']+=0x1;_0x1194c9[_0x1e0e('0x6f')]=0x8;_0x1194c9['statedesc']=_0x1e0e('0x19d');_0x1194c9[_0x1e0e('0x115')]+=0x1;_0x1194c9['countglobal']+=0x1;_0x1aa5f8=_0x47d681[_0x1e0e('0x19e')];_0x33fd47=_0x47d681[_0x1e0e('0xe1')];ami[_0x1e0e('0x40')](_0x1e0e('0x19f'),ut[_0x1e0e('0x10d')](_0x3d7a55,'congestion'));hopperUtils[_0x1e0e('0xe7')](_0x1194c9)[_0x1e0e('0xa7')](loggerCatch(_0x1e0e('0x1a0')));if(_0x43e54a[_0x1e0e('0x192')](0x8,_0x3d7a55,_0x47d681)&&!_0x4caa0f){if(_0x1194c9[_0x1e0e('0x115')]>=_0x47d681[_0x1e0e('0x185')]){_0x43e54a[_0x1e0e('0x11b')](_0x1194c9,_0x3de314,_0x1b63b5,_0x1e0e('0x1a1'));}else{_0x43e54a[_0x1e0e('0x119')](_0x1194c9,_0x3de314,_0x1b63b5,'reason\x208\x20congestion');}}break;case'11':_0x47d681[_0x1e0e('0x1a2')]+=0x1;_0x1194c9[_0x1e0e('0x6f')]=0xb;_0x1194c9[_0x1e0e('0xcd')]='Abandoned';_0x1194c9[_0x1e0e('0xdf')]+=0x1;_0x1194c9[_0x1e0e('0xcf')]+=0x1;_0x1aa5f8=_0x47d681['dialAbandonedRetryFrequency'];_0x33fd47=_0x47d681['callAdditionalPhoneAfterMin'];hopperUtils[_0x1e0e('0xe7')](_0x1194c9)[_0x1e0e('0xa7')](loggerCatch('[syncAgentComplete][createHistory][11]'));if(_0x43e54a[_0x1e0e('0x192')](0xb,_0x3d7a55,_0x47d681)&&!_0x4caa0f){if(_0x1194c9[_0x1e0e('0xdf')]>=_0x47d681[_0x1e0e('0xe3')]){_0x43e54a[_0x1e0e('0x11b')](_0x1194c9,_0x3de314,_0x1b63b5,_0x1e0e('0x1a3'));}else{_0x43e54a[_0x1e0e('0x119')](_0x1194c9,_0x3de314,_0x1b63b5,_0x1e0e('0x1a3'));}}break;case'20':_0x47d681['outboundRejectCallsDay']+=0x1;_0x1194c9[_0x1e0e('0x6f')]=0x14;_0x1194c9[_0x1e0e('0xcd')]=_0x1e0e('0x1a4');_0x1194c9[_0x1e0e('0x122')]+=0x1;_0x1194c9[_0x1e0e('0xcf')]+=0x1;_0x1aa5f8=_0x47d681[_0x1e0e('0x18a')];_0x33fd47=_0x47d681[_0x1e0e('0xe1')];ami['emit'](_0x1e0e('0x1a5'),ut[_0x1e0e('0x10d')](_0x3d7a55,_0x1e0e('0x1a6')));hopperUtils[_0x1e0e('0xe7')](_0x1194c9)[_0x1e0e('0xa7')](loggerCatch(_0x1e0e('0x1a7')));if(_0x43e54a[_0x1e0e('0x192')](0x14,_0x3d7a55,_0x47d681)&&!_0x4caa0f){if(_0x1194c9[_0x1e0e('0x122')]>=_0x47d681[_0x1e0e('0x189')]){_0x43e54a['createStateFinal'](_0x1194c9,_0x3de314,_0x1b63b5,_0x1e0e('0x1a8'));}else{_0x43e54a['stateGlobal'](_0x1194c9,_0x3de314,_0x1b63b5,_0x1e0e('0x1a8'));}}break;default:_0x47d681[_0x1e0e('0x12a')]+=0x1;_0x1194c9[_0x1e0e('0x6f')]=0xc;_0x1194c9['statedesc']=_0x345d3c[_0x1e0e('0xc2')];_0x1aa5f8=_0x47d681[_0x1e0e('0x18a')];_0x33fd47=_0x47d681[_0x1e0e('0xe1')];hopperUtils[_0x1e0e('0xe7')](_0x1194c9)[_0x1e0e('0xa7')](loggerCatch(_0x1e0e('0x1a9')));if(_0x43e54a[_0x1e0e('0x192')](_0x345d3c[_0x1e0e('0xc2')],_0x3d7a55,_0x47d681)&&!_0x4caa0f){if(_0x1194c9['countbusyretry']+_0x1194c9[_0x1e0e('0x115')]+_0x1194c9[_0x1e0e('0x116')]+_0x1194c9[_0x1e0e('0x117')]+_0x1194c9[_0x1e0e('0xd3')]+_0x1194c9[_0x1e0e('0xdf')]+_0x1194c9[_0x1e0e('0x113')]+_0x1194c9[_0x1e0e('0x122')]>=_0x47d681[_0x1e0e('0x118')]){_0x43e54a['stateGlobal'](_0x1194c9,_0x3de314,_0x1b63b5,_0x345d3c[_0x1e0e('0xc2')]);}else{_0x43e54a[_0x1e0e('0x11b')](_0x1194c9,_0x3de314,_0x1b63b5,_0x345d3c[_0x1e0e('0xc2')]);}}}})[_0x1e0e('0x3e')](function(){if(_0x4caa0f){hopperUtils[_0x1e0e('0xe9')](_0x1194c9,_0x1aa5f8,_0x33fd47)['then'](function(){return _0x3de314(0x1);});}});});};Dialer[_0x1e0e('0x17')][_0x1e0e('0x119')]=function(_0x48c11e,_0x11b54c,_0x323d49,_0x3cfb4d){var _0x3c782a=new Final(_0x48c11e);_0x3c782a[_0x1e0e('0x6f')]=0xf;_0x3c782a[_0x1e0e('0xcd')]='Global';this[_0x1e0e('0x11b')](_0x3c782a,_0x11b54c,_0x323d49,_0x3cfb4d);};Dialer['prototype'][_0x1e0e('0x11b')]=function(_0x3d01fb,_0xfef5c8,_0x5b3071,_0x542b99){hopperUtils[_0x1e0e('0xc8')](_0x3d01fb)[_0x1e0e('0x3e')](function(){return _0xfef5c8(msgResponse(_0x1e0e('0x18d'),_0x1e0e('0x1aa'),_0x542b99));})[_0x1e0e('0xa7')](function(){return _0x5b3071(msgResponse(_0x1e0e('0x1ab'),_0x1e0e('0x96'),'contact\x20not\x20moved'));});};Dialer[_0x1e0e('0x17')][_0x1e0e('0x8')]=function(_0x352ee5){var _0x2e27b8=_0x352ee5[_0x1e0e('0x1ac')]/0x64;var _0x56e06a=_0x352ee5[_0x1e0e('0x1ad')]/(_0x352ee5[_0x1e0e('0x1ad')]+_0x352ee5[_0x1e0e('0xc1')]);var _0x240e47=Math[_0x1e0e('0x1ae')](_0x352ee5[_0x1e0e('0x1af')]*(_0x352ee5[_0x1e0e('0x1b0')]/0x64));var _0x23acdf=Math[_0x1e0e('0x1ae')](_0x352ee5['predictiveIntervalAvailable']*(_0x352ee5[_0x1e0e('0x1b1')]/0x64));var _0x4247af=_0x352ee5[_0x1e0e('0x130')]+_0x352ee5[_0x1e0e('0x131')];var _0x58a0fa=Math[_0x1e0e('0x1b2')](_0x352ee5['erlangCalls']*_0x352ee5['erlangAbandonmentRate']*_0x352ee5[_0x1e0e('0x1b3')]*_0x352ee5[_0x1e0e('0x1b4')]);if(_[_0x1e0e('0x53')](_0x352ee5[_0x1e0e('0x25')])){if(!_[_0x1e0e('0x53')](_0x352ee5[_0x1e0e('0x24')])){_0x352ee5[_0x1e0e('0x24')]=undefined;loggerPredictive[_0x1e0e('0x62')](_0x1e0e('0x1b5'),_0x1e0e('0x1b6'));}if(!_[_0x1e0e('0x53')](_0x352ee5[_0x1e0e('0x60')])){loggerPredictive['error'](_0x1e0e('0x1b5'),_0x1e0e('0x1b7'));clearInterval(_0x352ee5[_0x1e0e('0x60')]);_0x352ee5[_0x1e0e('0x60')]=undefined;}_0x352ee5[_0x1e0e('0x25')]=moment()['format'](_0x1e0e('0xc0'));loggerPredictive[_0x1e0e('0x47')](_0x352ee5[_0x1e0e('0x45')],_0x1e0e('0x1b8'),_0x352ee5[_0x1e0e('0x25')]);this[_0x1e0e('0xb1')](_0x352ee5,0x1);}else if(ifInterval(_0x352ee5[_0x1e0e('0x1b9')],_0x352ee5['startProgressive'])){this[_0x1e0e('0xb1')](_0x352ee5,0x1);loggerPredictiveCalls[_0x1e0e('0x47')](_0x1e0e('0x1ba'),_0x352ee5[_0x1e0e('0x25')],_0x352ee5[_0x1e0e('0x45')]);_0x352ee5[_0x1e0e('0x58')]=0x0;_0x352ee5[_0x1e0e('0xcc')]=0x0;}else if(_0x2e27b8<_0x56e06a&&_0x352ee5['dialPredictiveOptimization']==='dropRate'){clearPredictiveAttributes(_0x352ee5);loggerPredictive[_0x1e0e('0x47')](_0x1e0e('0x1bb'),_0x1e0e('0x1bc'),_0x56e06a,_0x1e0e('0x25'),_0x352ee5[_0x1e0e('0x45')]);}else if(_0x58a0fa<_0x352ee5['predictiveIntervalErlangCallsDroppedCalls']&&_0x352ee5[_0x1e0e('0x1bd')]==='dropRate'){clearPredictiveAttributes(_0x352ee5);loggerPredictive[_0x1e0e('0x47')](_0x1e0e('0x1be'),_0x1e0e('0x1bf'),_0x58a0fa,'Drop\x20in\x20this\x20interval',_0x352ee5[_0x1e0e('0xcc')],_0x1e0e('0x25'),_0x352ee5['name']);}else if(!ifInterval(_0x352ee5[_0x1e0e('0x1b9')],_0x352ee5[_0x1e0e('0x25')])&&_['isUndefined'](_0x352ee5[_0x1e0e('0x24')])&&!_[_0x1e0e('0x53')](_0x352ee5[_0x1e0e('0x25')])){_0x352ee5['startPredictive']=moment()[_0x1e0e('0x43')](_0x1e0e('0xc0'));loggerPredictive['info'](_0x352ee5[_0x1e0e('0x45')],'started\x20in\x20predictive\x20at',_0x352ee5[_0x1e0e('0x24')]);hopperUtils[_0x1e0e('0x1c0')](_0x352ee5[_0x1e0e('0x1b9')])['then'](this['getDataPredictive'](_0x352ee5))[_0x1e0e('0x3e')](mergeDataErlangB(_0x352ee5))[_0x1e0e('0x3e')](this[_0x1e0e('0x1c1')](_0x352ee5))[_0x1e0e('0xa7')](loggerCatchPredictive(_0x1e0e('0x1c2'),_0x352ee5));}else if(!ifInterval(_0x352ee5['dialPredictiveInterval'],_0x352ee5['startPredictive'])){_0x352ee5['predictiveIntervalErlangCallsDroppedCalls']=0x0;_0x352ee5[_0x1e0e('0x24')]=moment()[_0x1e0e('0x43')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive['info'](_0x352ee5['name'],_0x1e0e('0x1c3'),_0x352ee5['startPredictive']);clearInterval(_0x352ee5['handlePredictive']);_0x352ee5['handlePredictive']=undefined;hopperUtils['avgHandleTime'](_0x352ee5[_0x1e0e('0x1b9')])['then'](this[_0x1e0e('0x1c4')](_0x352ee5))['then'](mergeDataErlangB(_0x352ee5))[_0x1e0e('0x3e')](this[_0x1e0e('0x1c1')](_0x352ee5))[_0x1e0e('0xa7')](loggerCatchPredictive('Predictive\x20for\x20every\x20interval',_0x352ee5));}else if(_0x352ee5[_0x1e0e('0x1af')]&&_0x4247af<_0x352ee5[_0x1e0e('0x1af')]-_0x23acdf){clearPredictiveAttributes(_0x352ee5);loggerPredictive[_0x1e0e('0x47')](_0x352ee5['name'],_0x1e0e('0x1c5'),_0x4247af,_0x1e0e('0x1c6'),_0x352ee5[_0x1e0e('0x1af')],'-',_0x23acdf,'=',_0x352ee5[_0x1e0e('0x1af')]-_0x23acdf,')');}else if(_0x352ee5[_0x1e0e('0x1af')]&&_0x4247af>_0x352ee5[_0x1e0e('0x1af')]+_0x240e47){clearPredictiveAttributes(_0x352ee5);loggerPredictive[_0x1e0e('0x47')](_0x352ee5['name'],_0x1e0e('0x1c5'),_0x4247af,_0x1e0e('0x1c7'),_0x352ee5[_0x1e0e('0x1af')],'+',_0x240e47,'=',_0x352ee5[_0x1e0e('0x1af')]+_0x240e47,')');}};Dialer[_0x1e0e('0x17')]['getDataPredictive']=function(_0x26e8c7){var _0x1a2e30=this;return function(_0x1e3313){return new Promise(function(_0x4e4e0f,_0x24ee83){_[_0x1e0e('0x5c')](_0x26e8c7,_0x1e3313[0x0]);if(checkGetDataPredictive(_0x1e3313[0x0])){var _0x43961e=_0x26e8c7['predictiveIntervalAvailable']=_0x26e8c7['talking']+_0x26e8c7[_0x1e0e('0x130')];var _0x1c0ff2=_0x26e8c7[_0x1e0e('0x1b9')]*0x3c;var _0x365a2b=_0x1e3313[0x0][_0x1e0e('0x51')]+_0x1e3313[0x0][_0x1e0e('0x50')];var _0x4fdfd8=(_0x1e3313[0x0][_0x1e0e('0x4b')]+_0x1e3313[0x0][_0x1e0e('0x4c')]+_0x1e3313[0x0][_0x1e0e('0x4e')])/_0x1e3313[0x0][_0x1e0e('0x1c8')];_0x26e8c7['predictiveIntervalHitRate']=_0x4fdfd8>0x0?_0x4fdfd8:0x1;switch(_0x26e8c7[_0x1e0e('0x1bd')]){case'dropRate':var _0x148f64=_0x26e8c7[_0x1e0e('0x1ac')]/0x64;return _0x1a2e30[_0x1e0e('0x1c9')](_0x43961e,_0x1c0ff2,_0x365a2b,_0x4fdfd8,_0x148f64)[_0x1e0e('0x3e')](function(_0x37a3c8){return _0x4e4e0f(_0x37a3c8);});case _0x1e0e('0x1ca'):var _0x2ce380=_0x26e8c7[_0x1e0e('0x1ac')]/0x64;return _0x1a2e30[_0x1e0e('0x1cb')](_0x43961e,_0x1c0ff2,_0x365a2b,_0x4fdfd8,_0x2ce380)[_0x1e0e('0x3e')](function(_0x2576ad){return _0x4e4e0f(_0x2576ad);});default:return _0x24ee83(msgResponse(_0x1e0e('0x1cc'),_0x1e0e('0x96'),_0x1e0e('0x1cd')));}}else{return _0x24ee83(msgResponse('[getDataPredictive]',_0x1e0e('0x96'),'check\x20failure'));}});};};Dialer['prototype'][_0x1e0e('0x1ce')]=function(_0x11108d){var _0x42b96d=this;return function(_0x4d8bd2){return new Promise(function(_0x585d16,_0x3a0f54){_[_0x1e0e('0x5c')](_0x11108d,_0x4d8bd2[0x0]);if(checkGetDataPredictive(_0x4d8bd2[0x0])){loggerPredictive[_0x1e0e('0x47')](JSON[_0x1e0e('0x75')](_0x4d8bd2[0x0]));if(_0x11108d[_0x1e0e('0x1bd')]===_0x1e0e('0x1cf')){return _0x42b96d[_0x1e0e('0x147')](_0x11108d['id'])[_0x1e0e('0x3e')](function(_0x5d1673){var _0x220e98=_0x11108d[_0x1e0e('0x1d0')]-_0x5d1673[0x0][_0x1e0e('0x1d1')];var _0x58ae29=_0x11108d[_0x1e0e('0x1b9')]*0x3c;var _0x36dd6a=_0x4d8bd2[0x0][_0x1e0e('0x51')]+_0x4d8bd2[0x0][_0x1e0e('0x50')];var _0x5c13c3=(_0x4d8bd2[0x0][_0x1e0e('0x4b')]+_0x4d8bd2[0x0][_0x1e0e('0x4c')]+_0x4d8bd2[0x0][_0x1e0e('0x4e')])/_0x4d8bd2[0x0][_0x1e0e('0x1c8')];var _0x236347=_0x11108d[_0x1e0e('0x1ac')]/0x64;_0x11108d[_0x1e0e('0x1d2')]=_0x5d1673[0x0]['outboundQueuePauses']||0x0;_0x11108d['predictiveIntervalHitRate']=_0x5c13c3>0x0?_0x5c13c3:0x1;return _0x42b96d[_0x1e0e('0x1c9')](_0x220e98,_0x58ae29,_0x36dd6a,_0x5c13c3,_0x236347);})[_0x1e0e('0x3e')](function(_0x30ec34){return _0x585d16(_0x30ec34);})[_0x1e0e('0xa7')](function(_0x246942){return _0x3a0f54(msgResponse(_0x1e0e('0x1d3'),_0x1e0e('0x96'),JSON[_0x1e0e('0x75')](_0x246942)));});}if(_0x11108d[_0x1e0e('0x1bd')]===_0x1e0e('0x1ca')){return _0x42b96d[_0x1e0e('0x147')](_0x11108d['id'])['then'](function(_0x287424){var _0x2caef0=_0x11108d[_0x1e0e('0x1d0')]-_0x287424[0x0][_0x1e0e('0x1d1')];var _0xcf443e=_0x11108d[_0x1e0e('0x1b9')]*0x3c;var _0x442045=_0x4d8bd2[0x0][_0x1e0e('0x51')]+_0x4d8bd2[0x0][_0x1e0e('0x50')];var _0x151ab9=(_0x4d8bd2[0x0][_0x1e0e('0x4b')]+_0x4d8bd2[0x0][_0x1e0e('0x4c')]+_0x4d8bd2[0x0][_0x1e0e('0x4e')])/_0x4d8bd2[0x0][_0x1e0e('0x1c8')];var _0x95d09d=_0x11108d[_0x1e0e('0x1ac')]/0x64;_0x11108d['predictiveIntervalPauses']=_0x287424[0x0][_0x1e0e('0x1d1')]||0x0;_0x11108d['predictiveIntervalHitRate']=_0x151ab9>0x0?_0x151ab9:0x1;return _0x42b96d[_0x1e0e('0x1cb')](_0x2caef0,_0xcf443e,_0x442045,_0x151ab9,_0x95d09d);})[_0x1e0e('0x3e')](function(_0x30c0f4){return _0x585d16(_0x30c0f4);})[_0x1e0e('0xa7')](function(_0x5cae4c){return _0x3a0f54(msgResponse(_0x1e0e('0x1d3'),_0x1e0e('0x96'),JSON['stringify'](_0x5cae4c)));});}}else{return _0x3a0f54(msgResponse(_0x1e0e('0x1cc'),_0x1e0e('0x96'),_0x1e0e('0x1d4')));}});};};Dialer[_0x1e0e('0x17')][_0x1e0e('0x1c1')]=function(_0x35eeff){var _0x12dd85=this;return function(){var _0x2913de=0x0;var _0x229531=Math[_0x1e0e('0x1b2')](_0x35eeff[_0x1e0e('0x1d5')]*0x3e8);if(_0x229531>0x0){_0x229531=_0x229531<0x64?0x64:_0x229531;loggerPredictive[_0x1e0e('0x47')](_0x35eeff[_0x1e0e('0x45')],'one\x20call\x20every:',_0x229531,_0x1e0e('0x1d6'));_0x35eeff[_0x1e0e('0x60')]=setInterval(function(){_0x12dd85[_0x1e0e('0x60')](_0x35eeff);loggerPredictiveCalls[_0x1e0e('0x47')](_0x1e0e('0x1d7'),_0x2913de+=0x1);},_0x229531);}else{loggerPredictive[_0x1e0e('0x47')](_0x35eeff[_0x1e0e('0x45')],_0x1e0e('0x1d8'));}};};Dialer[_0x1e0e('0x17')][_0x1e0e('0x1d9')]=function(_0x2d5122,_0x3e7352){var _0x4fd0fc=this;return function(_0x2ad3f3){if(_[_0x1e0e('0x79')](_0x2ad3f3)){if(_[_0x1e0e('0xee')](_0x3e7352[_0x1e0e('0x1da')])||!_0x3e7352[_0x1e0e('0x1db')]){if(_0x2d5122[_0x1e0e('0xaf')]==='booked'){_0x2d5122[_0x1e0e('0x72')]=_[_0x1e0e('0x53')](_0x2d5122[_0x1e0e('0x72')])?!![]:_0x2d5122[_0x1e0e('0x72')];var _0x31bd7d=uuid['v4']();_0x4fd0fc[_0x1e0e('0x21')][_0x31bd7d]=new Action(_0x2d5122,_0x3e7352,_0x31bd7d);loggerBooked[_0x1e0e('0x47')](_0x1e0e('0x1dc'),_0x31bd7d,_0x1e0e('0x1dd'),JSON[_0x1e0e('0x75')](_0x2d5122[_0x1e0e('0x72')]),_0x1e0e('0x1de'),_0x2d5122[_0x1e0e('0x45')]);if(_0x2d5122['queueStatusComplete']){_0x2d5122[_0x1e0e('0x72')]=![];_0x4fd0fc['queueBooked'][_0x4fd0fc[_0x1e0e('0x21')][_0x31bd7d][_0x1e0e('0xbb')]]=[];ami['Action']({'actionid':_0x31bd7d,'action':_0x1e0e('0x1df'),'queue':_0x2d5122['name']})[_0x1e0e('0xa7')](function(){_0x4fd0fc[_0x1e0e('0xbf')](_0x2d5122);hopperUtils[_0x1e0e('0xd6')]({'active':![],'ContactId':_0x4fd0fc[_0x1e0e('0x21')][_0x31bd7d][_0x1e0e('0xe4')],'ListId':_0x4fd0fc[_0x1e0e('0x21')][_0x31bd7d][_0x1e0e('0xe5')],'VoiceQueueId':_0x4fd0fc[_0x1e0e('0x21')][_0x31bd7d][_0x1e0e('0xe6')]||undefined,'CampaignId':_0x4fd0fc[_0x1e0e('0x21')][_0x31bd7d]['CampaignId']||undefined})[_0x1e0e('0xa7')](loggerCatch(_0x1e0e('0x1e0')));delete _0x4fd0fc['actions'][_0x31bd7d];});}else{loggerBooked[_0x1e0e('0x47')](_0x1e0e('0x1e1'),JSON[_0x1e0e('0x75')](_0x2d5122[_0x1e0e('0x72')]),_0x1e0e('0x1de'),_0x2d5122['name']);_0x4fd0fc['updateOriginated'](_0x2d5122);hopperUtils['rescheduleContact']({'active':![],'ContactId':_0x4fd0fc[_0x1e0e('0x21')][_0x31bd7d][_0x1e0e('0xe4')],'ListId':_0x4fd0fc['actions'][_0x31bd7d][_0x1e0e('0xe5')],'VoiceQueueId':_0x4fd0fc[_0x1e0e('0x21')][_0x31bd7d][_0x1e0e('0xe6')]||undefined,'CampaignId':_0x4fd0fc[_0x1e0e('0x21')][_0x31bd7d]['CampaignId']||undefined})[_0x1e0e('0xa7')](loggerCatch(_0x1e0e('0x1e0')));delete _0x4fd0fc[_0x1e0e('0x21')][_0x31bd7d];}}else{return _0x4fd0fc[_0x1e0e('0x14d')](_0x2d5122,_0x3e7352);}}else{if(utils['getSeconds'](undefined,_0x3e7352[_0x1e0e('0x1e2')])<_0x2d5122[_0x1e0e('0x1e3')]*0x3c){if(_0x3e7352['Agent']&&!_0x3e7352[_0x1e0e('0x13f')]['voicePause']){_0x4fd0fc['preview']['run'](_0x3e7352['id'])[_0x1e0e('0x1a')](function(){_0x4fd0fc[_0x1e0e('0xbf')](_0x2d5122);});}else{hopperUtils[_0x1e0e('0x1e4')]({'active':![]},_0x3e7352['id'],0x1)[_0x1e0e('0x1a')](function(){_0x4fd0fc[_0x1e0e('0xbf')](_0x2d5122);});}}else{_0x2d5122[_0x1e0e('0x1e5')]+=0x1;_0x4fd0fc[_0x1e0e('0xbf')](_0x2d5122);if(_0x2d5122[_0x1e0e('0x1e6')]){hopperUtils['rescheduleContact']({'active':![],'recallme':![],'UserId':null,'ContactId':_0x3e7352[_0x1e0e('0xe4')],'ListId':_0x3e7352['ListId'],'VoiceQueueId':_0x3e7352['VoiceQueueId']||undefined,'CampaignId':_0x3e7352[_0x1e0e('0xd9')]||undefined})[_0x1e0e('0xa7')](loggerCatch(_0x1e0e('0x1e7')));hopperUtils[_0x1e0e('0xe7')](createObjHistory(_0x2d5122,_0x3e7352,utils[_0x1e0e('0x68')]['QUEUE_RECALL'],0x17,_0x1e0e('0x1e8')))[_0x1e0e('0xa7')](loggerCatch(_0x1e0e('0x1e9')));}else{_0x4fd0fc['saveInDb'](createObjHistory(_0x2d5122,_0x3e7352,utils[_0x1e0e('0x68')][_0x1e0e('0x1ea')],0x16,'RecallFailedTimeout'),_0x1e0e('0x1eb'),_0x1e0e('0x1ec'));}}}}else{_0x2d5122[_0x1e0e('0x1ed')]+=0x1;_0x4fd0fc['saveInDb'](createObjHistory(_0x2d5122,_0x3e7352,utils[_0x1e0e('0x68')][_0x1e0e('0x1ee')],0xd,_0x1e0e('0x1ef')),'[Originate][historyBlacklist]',_0x1e0e('0x1f0'));throw _0x1e0e('0x1f1');}};};Dialer[_0x1e0e('0x17')][_0x1e0e('0x1f2')]=function(_0x5aa065){var _0x195a99=this;var _0x11ea29=_0x5aa065[_0x1e0e('0x1f3')]-_0x5aa065['originated'];emitCampaignSummary(_0x5aa065);if(_0x11ea29>0x0&&_0x5aa065[_0x1e0e('0x66')]==0x0){if(_0x11ea29>this[_0x1e0e('0x1f')]){_0x11ea29=this['maxNumberOriginate'];}_0x5aa065[_0x1e0e('0x66')]=0x1;hopperUtils['getContactDialerIvr'](_0x5aa065,_0x11ea29)['then'](function(_0x11d074){_0x5aa065[_0x1e0e('0x66')]=0x0;if(_0x11d074){if(!utils[_0x1e0e('0x1f4')](_0x11d074)){_0x5aa065[_0x1e0e('0x6c')]=utils[_0x1e0e('0x68')][_0x1e0e('0x6d')];logger[_0x1e0e('0x47')](_0x1e0e('0x1f5')+_0x5aa065[_0x1e0e('0x45')]);}else{_0x5aa065[_0x1e0e('0x80')]+=_0x11d074[_0x1e0e('0x99')];_0x5aa065['message']=utils[_0x1e0e('0x68')][_0x1e0e('0x1f6')];for(var _0x59b9ca=0x0;_0x59b9ca<_0x11d074['length'];_0x59b9ca+=0x1){_0x5aa065[_0x1e0e('0x1f7')]+=0x1;if(_[_0x1e0e('0xee')](_0x11d074[_0x59b9ca])||_[_0x1e0e('0xee')](_0x11d074[_0x59b9ca][_0x1e0e('0x168')])||_[_0x1e0e('0xee')](_0x11d074[_0x59b9ca]['phone'])){_0x195a99[_0x1e0e('0x1f8')](_0x1e0e('0x1f9'),_0x5aa065,_0x11d074[_0x59b9ca]);}else{hopperUtils['checkIsBlackListIvr'](_['pick'](_0x11d074[_0x59b9ca],[_0x1e0e('0xd9'),_0x1e0e('0x151')]))[_0x1e0e('0x3e')](_0x195a99[_0x1e0e('0x1d9')](_0x5aa065,_0x11d074[_0x59b9ca]))[_0x1e0e('0xa7')](_0x195a99['loggerHandler'](_0x1e0e('0x1fa'),_0x5aa065));}}}}})[_0x1e0e('0xa7')](loggerGetContactDialer('[getContactCampaign2]',_0x5aa065,_0x11ea29));}};Dialer[_0x1e0e('0x17')][_0x1e0e('0xb1')]=function(_0x1940c1,_0x3d9d5b){var _0x2f7559=this;var _0x4db282=[];if(_0x3d9d5b<0x1||_0x1940c1[_0x1e0e('0xaf')]===_0x1e0e('0x7')){_0x3d9d5b=0x1;}var _0x96d4cd=Math['floor'](_0x1940c1[_0x1e0e('0x130')]*_0x3d9d5b)-_0x1940c1['originated'];if(_0x1940c1[_0x1e0e('0x1fb')]>0x0){var _0x338e83=_0x1940c1[_0x1e0e('0x1fb')]-_0x1940c1[_0x1e0e('0x80')]-_0x1940c1[_0x1e0e('0x131')]-_0x1940c1['pTalking'];if(_0x96d4cd>_0x338e83){_0x96d4cd=_0x338e83;}}if(_0x96d4cd>0x0&&_0x1940c1[_0x1e0e('0x66')]==0x0){if(_0x1940c1[_0x1e0e('0xaf')]==='booked'){_0x96d4cd=0x1;}if(_0x96d4cd>this[_0x1e0e('0x1f')]){_0x96d4cd=this[_0x1e0e('0x1f')];}for(var _0x150c2d in this[_0x1e0e('0xef')]){if(typeof this['agents'][_0x150c2d]!=='undefined'){if(this[_0x1e0e('0xef')][_0x150c2d][_0x1e0e('0x6f')]===_0x1e0e('0x1fc')&&this[_0x1e0e('0xef')][_0x150c2d]['status']===_0x1e0e('0x8b')){_0x4db282[_0x1e0e('0x9e')](this['agents'][_0x150c2d]['id']);}}}_0x1940c1['temp']=0x1;hopperUtils['getContactDialer'](_0x1940c1,_0x4db282,_0x96d4cd)[_0x1e0e('0x3e')](function(_0x1b55f6){_0x1940c1[_0x1e0e('0x66')]=0x0;if(_0x1b55f6){if(!utils[_0x1e0e('0x1f4')](_0x1b55f6)){hopperUtils[_0x1e0e('0x1fd')](_0x1940c1)[_0x1e0e('0x3e')](sendMessageReschedule(_0x1940c1))[_0x1e0e('0xa7')](loggerCatch(_0x1e0e('0x1fe')));}else{_0x1940c1['originated']+=_0x1b55f6[_0x1e0e('0x99')];_0x1940c1[_0x1e0e('0x6c')]=_0x1940c1[_0x1e0e('0xaf')]===_0x1e0e('0x7')?utils[_0x1e0e('0x68')][_0x1e0e('0x133')]:utils[_0x1e0e('0x68')][_0x1e0e('0x1f6')];for(var _0x281ac1=0x0;_0x281ac1<_0x1b55f6[_0x1e0e('0x99')];_0x281ac1+=0x1){if(_[_0x1e0e('0xee')](_0x1b55f6[_0x281ac1])||_[_0x1e0e('0xee')](_0x1b55f6[_0x281ac1]['Contact'])||_[_0x1e0e('0xee')](_0x1b55f6[_0x281ac1][_0x1e0e('0x151')])){_0x2f7559[_0x1e0e('0x1f8')]('[actionOriginate]\x20',_0x1940c1,_0x1b55f6[_0x281ac1]);}else{hopperUtils[_0x1e0e('0x1ff')](_['pick'](_0x1b55f6[_0x281ac1],[_0x1e0e('0xe6'),_0x1e0e('0x151')]))[_0x1e0e('0x3e')](_0x2f7559['checkContactBlack'](_0x1940c1,_0x1b55f6[_0x281ac1]))[_0x1e0e('0xa7')](_0x2f7559['loggerHandler'](_0x1e0e('0x1f9'),_0x1940c1));}}}}})[_0x1e0e('0xa7')](loggerGetContactDialer(_0x1e0e('0x200'),_0x1940c1,_0x96d4cd));}};Dialer[_0x1e0e('0x17')][_0x1e0e('0x60')]=function(_0x8a70be){if(_0x8a70be['dialLimitQueue']>0x0){var _0x2701a6=_0x8a70be[_0x1e0e('0x1fb')]-_0x8a70be['originated']-_0x8a70be['talking'];if(_0x2701a6>0x0&&_0x8a70be[_0x1e0e('0x66')]==0x0){this['tryOriginatePredictive'](_0x8a70be);}else{loggerPredictiveCalls[_0x1e0e('0x47')](_0x1e0e('0x201'));}}else{this['tryOriginatePredictive'](_0x8a70be);}};Dialer[_0x1e0e('0x17')][_0x1e0e('0x202')]=function(_0x81c83a){var _0x36f6b9=this;var _0x32d4a6=[];_0x81c83a['originated']+=0x1;for(var _0x4c9800 in this[_0x1e0e('0xef')]){if(typeof this[_0x1e0e('0xef')][_0x4c9800]!==_0x1e0e('0xaa')){if(this['agents'][_0x4c9800][_0x1e0e('0x6f')]===_0x1e0e('0x1fc')&&this[_0x1e0e('0xef')][_0x4c9800][_0x1e0e('0x8c')]===_0x1e0e('0x8b')){_0x32d4a6['push'](this[_0x1e0e('0xef')][_0x4c9800]['id']);}}}_0x81c83a[_0x1e0e('0x66')]=0x1;return this[_0x1e0e('0x203')](_0x81c83a['id'],_0x32d4a6,0x1,_0x81c83a['dialOrderByScheduledAt'],_0x81c83a)['then'](function(_0x40c004){_0x81c83a[_0x1e0e('0x66')]=0x1;if(_0x40c004){if(!utils[_0x1e0e('0x1f4')](_0x40c004)){utils[_0x1e0e('0x65')](_0x81c83a,0x1,0x0);return hopperUtils['countReScheduled'](_0x81c83a)[_0x1e0e('0x3e')](sendMessageReschedule(_0x81c83a))[_0x1e0e('0xa7')](loggerCatch(_0x1e0e('0x1fe')));}else{_0x81c83a[_0x1e0e('0x6c')]=utils[_0x1e0e('0x68')][_0x1e0e('0x1f6')];if(_[_0x1e0e('0xee')](_0x40c004[0x0])||_[_0x1e0e('0xee')](_0x40c004[0x0][_0x1e0e('0x168')])||_[_0x1e0e('0xee')](_0x40c004[0x0][_0x1e0e('0x151')])){_0x36f6b9[_0x1e0e('0x1f8')](_0x1e0e('0x1f9'),_0x81c83a,_0x40c004[0x0]);}else{return hopperUtils[_0x1e0e('0x1ff')](_['pick'](_0x40c004[0x0],['VoiceQueueId',_0x1e0e('0x151')]))[_0x1e0e('0x3e')](_0x36f6b9[_0x1e0e('0x1d9')](_0x81c83a,_0x40c004[0x0]))['catch'](_0x36f6b9[_0x1e0e('0x148')]('[actionOriginatePredictive]\x20',_0x81c83a));}}}})[_0x1e0e('0xa7')](loggerGetContactDialer('[getContactDialerPredictive]',_0x81c83a,0x1));};Dialer[_0x1e0e('0x17')][_0x1e0e('0x1c9')]=function(_0x1f8e3b,_0x2f7dfb,_0x4f250c,_0x3cc724,_0x45ed0b,_0x45e97c){loggerPredictive[_0x1e0e('0x47')](_0x1e0e('0x204'));loggerPredictive[_0x1e0e('0x47')](_0x1e0e('0x205'),_0x1f8e3b);loggerPredictive[_0x1e0e('0x47')]('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x2f7dfb);loggerPredictive['info'](_0x1e0e('0x206'),_0x4f250c);loggerPredictive['info'](_0x1e0e('0x207'),_0x3cc724);loggerPredictive[_0x1e0e('0x47')]('Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x45ed0b);loggerPredictive[_0x1e0e('0x47')](_0x1e0e('0x52'));return new Promise(function(_0x4bb09b,_0x4303d3){if(_0x1f8e3b<=0x0||isNaN(_0x1f8e3b)){return _0x4303d3(msgResponse(_0x1e0e('0x208'),_0x1e0e('0x87'),'m\x20=\x20'+_0x1f8e3b));}if(_0x4f250c<=0x0||isNaN(_0x4f250c)){return _0x4303d3(msgResponse('[abandonmentRate]',_0x1e0e('0x87'),_0x1e0e('0x209')+_0x4f250c));}if(_0x3cc724<=0x0||isNaN(_0x3cc724)){return _0x4303d3(msgResponse(_0x1e0e('0x208'),'Error',_0x1e0e('0x20a')+_0x3cc724));}if(_0x2f7dfb<=0x0||isNaN(_0x2f7dfb)){return _0x4303d3(msgResponse(_0x1e0e('0x208'),_0x1e0e('0x87'),_0x1e0e('0x20b')+_0x2f7dfb));}if(_0x45ed0b<=0x0||isNaN(_0x45ed0b)){return _0x4303d3(msgResponse(_0x1e0e('0x208'),'Error',_0x1e0e('0x20c')+_0x45ed0b));}_0x45e97c=_0x45e97c||0x0;var _0x287229=0x1/_0x4f250c;var _0x4cabea=0x0;var _0x13e664=0x0;var _0x5deafc=0x0;var _0x4e3394=0x0;for(var _0x29a5f7=0x0;_0x5deafc<_0x45ed0b;_0x29a5f7+=0x1){_0x13e664=_0x29a5f7/_0x2f7dfb;_0x4cabea=(_0x3cc724*_0x13e664+_0x45e97c)/_0x287229;_0x5deafc=utils[_0x1e0e('0x20d')](_0x4cabea,_0x1f8e3b);_0x4e3394=_0x4cabea/_0x1f8e3b*(0x1-utils[_0x1e0e('0x20d')](_0x4cabea,_0x1f8e3b));}return _0x4bb09b({'erlangCalls':_0x29a5f7,'erlangCallToSecond':_0x2f7dfb/_0x29a5f7,'erlangAbandonmentRate':_0x5deafc,'erlangBusyFactor':_0x4e3394});});};Dialer[_0x1e0e('0x17')][_0x1e0e('0x1cb')]=function(_0x463d69,_0x573e93,_0x3097dc,_0x4a284d,_0x178d60,_0x597e9e){loggerPredictive['info']('----\x20Agent\x20Busy\x20Factor\x20----');loggerPredictive[_0x1e0e('0x47')](_0x1e0e('0x205'),_0x463d69);loggerPredictive['info'](_0x1e0e('0x20e'),_0x573e93);loggerPredictive['info'](_0x1e0e('0x206'),_0x3097dc);loggerPredictive['info'](_0x1e0e('0x207'),_0x4a284d);loggerPredictive[_0x1e0e('0x47')](_0x1e0e('0x20f'),_0x178d60);loggerPredictive[_0x1e0e('0x47')](_0x1e0e('0x52'));return new Promise(function(_0x8cf134,_0x3503b5){if(_0x463d69<=0x0||isNaN(_0x463d69)){return _0x3503b5(msgResponse(_0x1e0e('0x210'),_0x1e0e('0x87'),_0x1e0e('0x211')+_0x463d69));}if(_0x3097dc<=0x0||isNaN(_0x3097dc)){return _0x3503b5(msgResponse(_0x1e0e('0x210'),'Error','Ts\x20=\x20'+_0x3097dc));}if(_0x4a284d<=0x0||isNaN(_0x4a284d)){return _0x3503b5(msgResponse(_0x1e0e('0x210'),_0x1e0e('0x87'),'p\x20=\x20'+_0x4a284d));}if(_0x573e93<=0x0||isNaN(_0x573e93)){return _0x3503b5(msgResponse(_0x1e0e('0x210'),'Error','interval\x20=\x20'+_0x573e93));}if(_0x178d60<=0x0||isNaN(_0x178d60)){return _0x3503b5(msgResponse(_0x1e0e('0x210'),_0x1e0e('0x87'),_0x1e0e('0x212')+_0x178d60));}_0x597e9e=_0x597e9e||0x0;var _0x4c35f2=0x1/_0x3097dc;var _0x1e7cbb=0x0;var _0x1f7b64=0x0;var _0x41cbb5=0x0;var _0xddea6d=0x0;for(var _0x4a5cfe=0x0;_0xddea6d<_0x178d60;_0x4a5cfe+=0x1){_0x1f7b64=_0x4a5cfe/_0x573e93;_0x1e7cbb=(_0x4a284d*_0x1f7b64+_0x597e9e)/_0x4c35f2;_0x41cbb5=utils[_0x1e0e('0x20d')](_0x1e7cbb,_0x463d69);_0xddea6d=_0x1e7cbb/_0x463d69*(0x1-utils[_0x1e0e('0x20d')](_0x1e7cbb,_0x463d69));}return _0x8cf134({'erlangCalls':_0x4a5cfe,'erlangCallToSecond':_0x573e93/_0x4a5cfe,'erlangAbandonmentRate':_0x41cbb5,'erlangBusyFactor':_0xddea6d});});};module[_0x1e0e('0x213')]=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 0e88027..1db510b 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 _0x30b9=['countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper','ContactFirstName','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','dialCutDigit','getQueue','queue','exports','util','moment','isNil','string','voiceQueue','phone','Contact','firstName','number','name','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry'];(function(_0x384cc5,_0x455808){var _0x168506=function(_0x120216){while(--_0x120216){_0x384cc5['push'](_0x384cc5['shift']());}};_0x168506(++_0x455808);}(_0x30b9,0xc8));var _0x930b=function(_0x2df7de,_0x39c21c){_0x2df7de=_0x2df7de-0x0;var _0xc03169=_0x30b9[_0x2df7de];return _0xc03169;};'use strict';var util=require(_0x930b('0x0'));var _=require('lodash');var moment=require(_0x930b('0x1'));function checkNameSurname(_0x3f0941,_0x5378a6,_0x317edf){var _0x54672c='';if(!_[_0x930b('0x2')](_0x5378a6)&&_0x930b('0x3')===typeof _0x5378a6){_0x54672c+=_0x5378a6;}if(!_[_0x930b('0x2')](_0x317edf)&&_0x930b('0x3')===typeof _0x317edf){_0x54672c+='\x20'+_0x317edf;}if(_0x54672c!==''){return _0x54672c;}return _0x3f0941;}function Action(_0xff4fca,_0x1a3ea2,_0x2734d5){this[_0x930b('0x4')]=_0xff4fca;this['uniqueid']=_0x2734d5||undefined;this['name']=checkNameSurname(_0x1a3ea2['Contact'][_0x930b('0x5')],_0x1a3ea2[_0x930b('0x6')][_0x930b('0x7')],_0x1a3ea2['Contact']['lastName']);this[_0x930b('0x8')]=_0x1a3ea2['phone'];this['queue']=_0xff4fca[_0x930b('0x9')];this[_0x930b('0xa')]=_0x1a3ea2[_0x930b('0xa')]||![];this['type']=_0xff4fca[_0x930b('0xb')];this[_0x930b('0xc')]=_0xff4fca[_0x930b('0xc')]||0x3;this[_0x930b('0xd')]=_0x1a3ea2['scheduledat'];this['countbusyretry']=_0x1a3ea2[_0x930b('0xe')];this[_0x930b('0xf')]=_0x1a3ea2[_0x930b('0xf')];this[_0x930b('0x10')]=_0x1a3ea2[_0x930b('0x10')];this[_0x930b('0x11')]=_0x1a3ea2['countnosuchnumberretry'];this[_0x930b('0x12')]=_0x1a3ea2[_0x930b('0x12')];this[_0x930b('0x13')]=_0x1a3ea2[_0x930b('0x13')];this[_0x930b('0x14')]=_0x1a3ea2[_0x930b('0x14')];this[_0x930b('0x15')]=_0x1a3ea2['countagentrejectretry'];this[_0x930b('0x16')]=_0x1a3ea2[_0x930b('0x16')];this[_0x930b('0x17')]=_0x1a3ea2[_0x930b('0x17')];this[_0x930b('0x18')]=_0x1a3ea2[_0x930b('0x18')];this[_0x930b('0x19')]=_0x1a3ea2[_0x930b('0x19')];this[_0x930b('0x1a')]=_0x1a3ea2[_0x930b('0x1a')];this[_0x930b('0x1b')]=_0x1a3ea2['id'];this[_0x930b('0x1c')]=_0x1a3ea2[_0x930b('0x6')][_0x930b('0x7')]||'';this['starttime']=moment()[_0x930b('0x1d')](_0x930b('0x1e'));this['callback']=_0x1a3ea2[_0x930b('0x1f')];this[_0x930b('0x20')]=_0x1a3ea2[_0x930b('0x20')];this[_0x930b('0x21')]=_0x1a3ea2[_0x930b('0x21')];this[_0x930b('0x22')]=_0x1a3ea2[_0x930b('0x22')];this[_0x930b('0x23')]='';this[_0x930b('0x24')]='';}Action[_0x930b('0x25')][_0x930b('0x26')]=function(){return util[_0x930b('0x1d')](_0x930b('0x27'),this[_0x930b('0x9')],this[_0x930b('0x4')][_0x930b('0x28')]>0x0?this[_0x930b('0x8')]['substring'](this[_0x930b('0x4')][_0x930b('0x28')]):this[_0x930b('0x8')]);};Action[_0x930b('0x25')][_0x930b('0x29')]=function(){return this[_0x930b('0x2a')];};module[_0x930b('0x2b')]=Action; \ No newline at end of file +var _0x2cd2=['dialQueueTimeout','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper','ContactFirstName','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackat','recallme','prototype','\x22%s\x22\x20<%s>','dialCutDigit','substring','exports','lodash','isNil','string','voiceQueue','Contact','phone','firstName','lastName','number','queue','name','active','type'];(function(_0x1b3f76,_0x3c8e1b){var _0x563721=function(_0x59f22e){while(--_0x59f22e){_0x1b3f76['push'](_0x1b3f76['shift']());}};_0x563721(++_0x3c8e1b);}(_0x2cd2,0x1ee));var _0x22cd=function(_0x162e09,_0x139b77){_0x162e09=_0x162e09-0x0;var _0x2b2d3a=_0x2cd2[_0x162e09];return _0x2b2d3a;};'use strict';var util=require('util');var _=require(_0x22cd('0x0'));var moment=require('moment');function checkNameSurname(_0x147b47,_0xb23371,_0x3839dd){var _0x1ad411='';if(!_[_0x22cd('0x1')](_0xb23371)&&_0x22cd('0x2')===typeof _0xb23371){_0x1ad411+=_0xb23371;}if(!_[_0x22cd('0x1')](_0x3839dd)&&_0x22cd('0x2')===typeof _0x3839dd){_0x1ad411+='\x20'+_0x3839dd;}if(_0x1ad411!==''){return _0x1ad411;}return _0x147b47;}function Action(_0x51d06a,_0x4bf947,_0x1ba3eb){this[_0x22cd('0x3')]=_0x51d06a;this['uniqueid']=_0x1ba3eb||undefined;this['name']=checkNameSurname(_0x4bf947[_0x22cd('0x4')][_0x22cd('0x5')],_0x4bf947[_0x22cd('0x4')][_0x22cd('0x6')],_0x4bf947[_0x22cd('0x4')][_0x22cd('0x7')]);this[_0x22cd('0x8')]=_0x4bf947[_0x22cd('0x5')];this[_0x22cd('0x9')]=_0x51d06a[_0x22cd('0xa')];this[_0x22cd('0xb')]=_0x4bf947['active']||![];this[_0x22cd('0xc')]=_0x51d06a[_0x22cd('0xc')];this[_0x22cd('0xd')]=_0x51d06a['dialQueueTimeout']||0x3;this['scheduledat']=_0x4bf947['scheduledat'];this[_0x22cd('0xe')]=_0x4bf947['countbusyretry'];this[_0x22cd('0xf')]=_0x4bf947['countcongestionretry'];this[_0x22cd('0x10')]=_0x4bf947['countnoanswerretry'];this[_0x22cd('0x11')]=_0x4bf947[_0x22cd('0x11')];this[_0x22cd('0x12')]=_0x4bf947['countdropretry'];this['countabandonedretry']=_0x4bf947[_0x22cd('0x13')];this['countmachineretry']=_0x4bf947[_0x22cd('0x14')];this[_0x22cd('0x15')]=_0x4bf947[_0x22cd('0x15')];this[_0x22cd('0x16')]=_0x4bf947[_0x22cd('0x16')];this[_0x22cd('0x17')]=_0x4bf947['ListId'];this[_0x22cd('0x18')]=_0x4bf947[_0x22cd('0x18')];this[_0x22cd('0x19')]=_0x4bf947[_0x22cd('0x19')];this[_0x22cd('0x1a')]=_0x4bf947[_0x22cd('0x1a')];this[_0x22cd('0x1b')]=_0x4bf947['id'];this[_0x22cd('0x1c')]=_0x4bf947[_0x22cd('0x4')]['firstName']||'';this['starttime']=moment()[_0x22cd('0x1d')](_0x22cd('0x1e'));this[_0x22cd('0x1f')]=_0x4bf947[_0x22cd('0x1f')];this['callbackuniqueid']=_0x4bf947['callbackuniqueid'];this[_0x22cd('0x20')]=_0x4bf947[_0x22cd('0x20')];this[_0x22cd('0x21')]=_0x4bf947['recallme'];this['originatecalleridnum']='';this['originatecalleridname']='';}Action[_0x22cd('0x22')]['getCaller']=function(){return util[_0x22cd('0x1d')](_0x22cd('0x23'),this[_0x22cd('0xa')],this[_0x22cd('0x3')][_0x22cd('0x24')]>0x0?this[_0x22cd('0x8')][_0x22cd('0x25')](this['voiceQueue'][_0x22cd('0x24')]):this[_0x22cd('0x8')]);};Action[_0x22cd('0x22')]['getQueue']=function(){return this[_0x22cd('0x9')];};module[_0x22cd('0x26')]=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 1b3f7c9..5beab01 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 _0x7dd6=['holdtime','getSeconds','membername','reason','callback','callbackuniqueid','callbackat','recallme','UserId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','exports','../utils','state','statedesc','Answer','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','answertime','endtime','YYYY-MM-DD\x20HH:mm:ss','ringtime'];(function(_0xeeae19,_0x352c6b){var _0x30e449=function(_0x273325){while(--_0x273325){_0xeeae19['push'](_0xeeae19['shift']());}};_0x30e449(++_0x352c6b);}(_0x7dd6,0x13b));var _0x67dd=function(_0x1e3c16,_0x372caa){_0x1e3c16=_0x1e3c16-0x0;var _0x47a0c9=_0x7dd6[_0x1e3c16];return _0x47a0c9;};'use strict';var moment=require('moment');var utils=require(_0x67dd('0x0'));function AgentComplete(_0x3046d6,_0x3f3e2f){this[_0x67dd('0x1')]=0x4;this[_0x67dd('0x2')]=_0x67dd('0x3');this[_0x67dd('0x4')]=_0x3046d6[_0x67dd('0x4')];this[_0x67dd('0x5')]=_0x3046d6[_0x67dd('0x5')];this[_0x67dd('0x6')]=_0x3046d6[_0x67dd('0x5')]===_0x67dd('0x7')?_0x67dd('0x8'):_0x3046d6[_0x67dd('0x5')];this['countbusyretry']=_0x3046d6[_0x67dd('0x9')];this[_0x67dd('0xa')]=_0x3046d6[_0x67dd('0xa')];this[_0x67dd('0xb')]=_0x3046d6[_0x67dd('0xb')];this[_0x67dd('0xc')]=_0x3046d6['countbusyretry']+_0x3046d6[_0x67dd('0xa')]+_0x3046d6[_0x67dd('0xb')]+_0x3046d6[_0x67dd('0xd')]+_0x3046d6[_0x67dd('0xe')]+_0x3046d6[_0x67dd('0xf')]+_0x3046d6[_0x67dd('0x10')]+_0x3046d6['countagentrejectretry'];this[_0x67dd('0xd')]=_0x3046d6['countnosuchnumberretry'];this['countdropretry']=_0x3046d6[_0x67dd('0xe')];this[_0x67dd('0xf')]=_0x3046d6[_0x67dd('0xf')];this[_0x67dd('0x10')]=_0x3046d6[_0x67dd('0x10')];this[_0x67dd('0x11')]=_0x3046d6[_0x67dd('0x11')];this['uniqueid']=_0x3f3e2f[_0x67dd('0x12')];this[_0x67dd('0x13')]=_0x3046d6[_0x67dd('0x14')];this[_0x67dd('0x15')]=_0x3046d6[_0x67dd('0x16')];this[_0x67dd('0x17')]=_0x3046d6[_0x67dd('0x17')];this[_0x67dd('0x18')]=_0x3046d6[_0x67dd('0x18')];this['answertime']=_0x3046d6[_0x67dd('0x19')];this[_0x67dd('0x1a')]=moment()['format'](_0x67dd('0x1b'));this[_0x67dd('0x1c')]=utils['getSeconds'](_0x3046d6[_0x67dd('0x18')],_0x3046d6['starttime']);this[_0x67dd('0x1d')]=utils[_0x67dd('0x1e')](_0x3046d6[_0x67dd('0x19')],_0x3046d6[_0x67dd('0x18')]);this['talktime']=utils[_0x67dd('0x1e')](this[_0x67dd('0x1a')],_0x3046d6[_0x67dd('0x19')]);this[_0x67dd('0x8')]=_0x3f3e2f[_0x67dd('0x8')];this[_0x67dd('0x1f')]=_0x3f3e2f['membername'];this[_0x67dd('0x20')]=_0x3f3e2f[_0x67dd('0x20')];this[_0x67dd('0x21')]=_0x3046d6[_0x67dd('0x21')];this[_0x67dd('0x22')]=_0x3046d6['callbackuniqueid'];this['callbackat']=_0x3046d6[_0x67dd('0x23')];this[_0x67dd('0x24')]=_0x3046d6['recallme'];this['ContactId']=_0x3046d6['ContactId'];this['ListId']=_0x3046d6['ListId'];this[_0x67dd('0x25')]=_0x3046d6['UserId'];this['VoiceQueueId']=_0x3046d6['VoiceQueueId'];this[_0x67dd('0x26')]=_0x3046d6['CampaignId'];this[_0x67dd('0x27')]=_0x3046d6[_0x67dd('0x27')]||'';this[_0x67dd('0x28')]=_0x3046d6['originatecalleridname']||'';this['agiafterat']=_0x3046d6[_0x67dd('0x29')];}module[_0x67dd('0x2a')]=AgentComplete; \ No newline at end of file +var _0x10ba=['campaigntype','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','countmachineretry','uniqueid','name','calleridnum','starttime','responsetime','answertime','format','YYYY-MM-DD\x20HH:mm:ss','getSeconds','talktime','endtime','queue','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','exports','moment','../utils','state','statedesc','Answer','scheduledat','type'];(function(_0x5e0224,_0x33da9d){var _0x1ce215=function(_0x3a9f57){while(--_0x3a9f57){_0x5e0224['push'](_0x5e0224['shift']());}};_0x1ce215(++_0x33da9d);}(_0x10ba,0x18e));var _0xa10b=function(_0x529abc,_0x17b97e){_0x529abc=_0x529abc-0x0;var _0x453afa=_0x10ba[_0x529abc];return _0x453afa;};'use strict';var moment=require(_0xa10b('0x0'));var utils=require(_0xa10b('0x1'));function AgentComplete(_0x3704f4,_0x3847bc){this[_0xa10b('0x2')]=0x4;this[_0xa10b('0x3')]=_0xa10b('0x4');this[_0xa10b('0x5')]=_0x3704f4[_0xa10b('0x5')];this[_0xa10b('0x6')]=_0x3704f4[_0xa10b('0x6')];this[_0xa10b('0x7')]=_0x3704f4['type']===_0xa10b('0x8')?'queue':_0x3704f4[_0xa10b('0x6')];this[_0xa10b('0x9')]=_0x3704f4['countbusyretry'];this['countcongestionretry']=_0x3704f4[_0xa10b('0xa')];this[_0xa10b('0xb')]=_0x3704f4[_0xa10b('0xb')];this[_0xa10b('0xc')]=_0x3704f4[_0xa10b('0x9')]+_0x3704f4[_0xa10b('0xa')]+_0x3704f4[_0xa10b('0xb')]+_0x3704f4[_0xa10b('0xd')]+_0x3704f4[_0xa10b('0xe')]+_0x3704f4[_0xa10b('0xf')]+_0x3704f4['countmachineretry']+_0x3704f4[_0xa10b('0x10')];this['countnosuchnumberretry']=_0x3704f4[_0xa10b('0xd')];this[_0xa10b('0xe')]=_0x3704f4[_0xa10b('0xe')];this[_0xa10b('0xf')]=_0x3704f4[_0xa10b('0xf')];this['countmachineretry']=_0x3704f4[_0xa10b('0x11')];this[_0xa10b('0x10')]=_0x3704f4[_0xa10b('0x10')];this[_0xa10b('0x12')]=_0x3847bc['uniqueid'];this['calleridname']=_0x3704f4[_0xa10b('0x13')];this[_0xa10b('0x14')]=_0x3704f4['number'];this[_0xa10b('0x15')]=_0x3704f4[_0xa10b('0x15')];this[_0xa10b('0x16')]=_0x3704f4['responsetime'];this[_0xa10b('0x17')]=_0x3704f4[_0xa10b('0x17')];this['endtime']=moment()[_0xa10b('0x18')](_0xa10b('0x19'));this['ringtime']=utils[_0xa10b('0x1a')](_0x3704f4['responsetime'],_0x3704f4[_0xa10b('0x15')]);this['holdtime']=utils[_0xa10b('0x1a')](_0x3704f4[_0xa10b('0x17')],_0x3704f4[_0xa10b('0x16')]);this[_0xa10b('0x1b')]=utils[_0xa10b('0x1a')](this[_0xa10b('0x1c')],_0x3704f4['answertime']);this[_0xa10b('0x1d')]=_0x3847bc[_0xa10b('0x1d')];this[_0xa10b('0x1e')]=_0x3847bc[_0xa10b('0x1e')];this[_0xa10b('0x1f')]=_0x3847bc[_0xa10b('0x1f')];this[_0xa10b('0x20')]=_0x3704f4[_0xa10b('0x20')];this[_0xa10b('0x21')]=_0x3704f4[_0xa10b('0x21')];this['callbackat']=_0x3704f4[_0xa10b('0x22')];this[_0xa10b('0x23')]=_0x3704f4[_0xa10b('0x23')];this[_0xa10b('0x24')]=_0x3704f4[_0xa10b('0x24')];this['ListId']=_0x3704f4[_0xa10b('0x25')];this[_0xa10b('0x26')]=_0x3704f4[_0xa10b('0x26')];this[_0xa10b('0x27')]=_0x3704f4[_0xa10b('0x27')];this['CampaignId']=_0x3704f4[_0xa10b('0x28')];this[_0xa10b('0x29')]=_0x3704f4[_0xa10b('0x29')]||'';this[_0xa10b('0x2a')]=_0x3704f4[_0xa10b('0x2a')]||'';this[_0xa10b('0x2b')]=_0x3704f4[_0xa10b('0x2b')];}module[_0xa10b('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 5a936ea..726ec0c 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 _0x0900=['state','statedesc','exports','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countagentrejectretry','countnosuchnumberretry','countabandonedretry','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname'];(function(_0x1928c9,_0x13a6d1){var _0x51b5fb=function(_0x24cf70){while(--_0x24cf70){_0x1928c9['push'](_0x1928c9['shift']());}};_0x51b5fb(++_0x13a6d1);}(_0x0900,0x93));var _0x0090=function(_0x28f689,_0xc1004c){_0x28f689=_0x28f689-0x0;var _0x1a4500=_0x0900[_0x28f689];return _0x1a4500;};'use strict';function Final(_0x339b8e){this[_0x0090('0x0')]=_0x339b8e[_0x0090('0x0')];this[_0x0090('0x1')]=_0x339b8e['scheduledat'];this[_0x0090('0x2')]=_0x339b8e[_0x0090('0x2')];this[_0x0090('0x3')]=_0x339b8e[_0x0090('0x2')]===_0x0090('0x4')?_0x0090('0x5'):_0x339b8e[_0x0090('0x2')];this['countbusyretry']=_0x339b8e[_0x0090('0x6')];this[_0x0090('0x7')]=_0x339b8e[_0x0090('0x7')];this[_0x0090('0x8')]=_0x339b8e[_0x0090('0x8')];this[_0x0090('0x9')]=_0x339b8e['countbusyretry']+_0x339b8e[_0x0090('0x7')]+_0x339b8e['countnoanswerretry']+_0x339b8e['countnosuchnumberretry']+_0x339b8e[_0x0090('0xa')]+_0x339b8e['countabandonedretry']+_0x339b8e['countmachineretry']+_0x339b8e[_0x0090('0xb')];this['countnosuchnumberretry']=_0x339b8e[_0x0090('0xc')];this[_0x0090('0xa')]=_0x339b8e[_0x0090('0xa')];this[_0x0090('0xd')]=_0x339b8e[_0x0090('0xd')];this['countmachineretry']=_0x339b8e['countmachineretry'];this[_0x0090('0xb')]=_0x339b8e['countagentrejectretry'];this[_0x0090('0x5')]=_0x339b8e['queue'];this[_0x0090('0xe')]=_0x339b8e[_0x0090('0xe')];this[_0x0090('0xf')]=_0x339b8e[_0x0090('0xf')];this[_0x0090('0x10')]=_0x339b8e[_0x0090('0x10')];this['responsetime']=_0x339b8e[_0x0090('0x11')];this[_0x0090('0x12')]=_0x339b8e[_0x0090('0x11')];this[_0x0090('0x13')]=_0x339b8e['ringtime']||0x0;this['holdtime']=_0x339b8e[_0x0090('0x14')]||0x0;this['talktime']=_0x339b8e[_0x0090('0x15')]||0x0;this[_0x0090('0x16')]=_0x339b8e[_0x0090('0x16')];this[_0x0090('0x17')]=_0x339b8e[_0x0090('0x17')];this[_0x0090('0x18')]=_0x339b8e[_0x0090('0x18')];this[_0x0090('0x19')]=_0x339b8e[_0x0090('0x19')];this[_0x0090('0x1a')]=_0x339b8e[_0x0090('0x1a')];this[_0x0090('0x1b')]=_0x339b8e[_0x0090('0x1b')];this[_0x0090('0x1c')]=_0x339b8e['UserId'];this[_0x0090('0x1d')]=_0x339b8e[_0x0090('0x1d')];this[_0x0090('0x1e')]=_0x339b8e[_0x0090('0x1e')];this[_0x0090('0x1f')]=_0x339b8e[_0x0090('0x1f')]||'';this[_0x0090('0x20')]=_0x339b8e[_0x0090('0x20')]||'';this[_0x0090('0x21')]=_0x339b8e[_0x0090('0x21')];this[_0x0090('0x22')]=_0x339b8e['statedesc'];}module[_0x0090('0x23')]=Final; \ No newline at end of file +var _0xd22e=['talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','exports','uniqueid','scheduledat','type','campaigntype','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','calleridnum','starttime','responsetime','ringtime','holdtime'];(function(_0x25e7cb,_0x3579b7){var _0x375d92=function(_0xe8cf3b){while(--_0xe8cf3b){_0x25e7cb['push'](_0x25e7cb['shift']());}};_0x375d92(++_0x3579b7);}(_0xd22e,0x141));var _0xed22=function(_0x17971a,_0x8014bf){_0x17971a=_0x17971a-0x0;var _0x11f2cc=_0xd22e[_0x17971a];return _0x11f2cc;};'use strict';function Final(_0x339afa){this[_0xed22('0x0')]=_0x339afa[_0xed22('0x0')];this[_0xed22('0x1')]=_0x339afa[_0xed22('0x1')];this[_0xed22('0x2')]=_0x339afa['type'];this[_0xed22('0x3')]=_0x339afa[_0xed22('0x2')]==='outbound'?_0xed22('0x4'):_0x339afa[_0xed22('0x2')];this[_0xed22('0x5')]=_0x339afa['countbusyretry'];this[_0xed22('0x6')]=_0x339afa[_0xed22('0x6')];this[_0xed22('0x7')]=_0x339afa[_0xed22('0x7')];this['countglobal']=_0x339afa[_0xed22('0x5')]+_0x339afa[_0xed22('0x6')]+_0x339afa['countnoanswerretry']+_0x339afa[_0xed22('0x8')]+_0x339afa[_0xed22('0x9')]+_0x339afa[_0xed22('0xa')]+_0x339afa[_0xed22('0xb')]+_0x339afa[_0xed22('0xc')];this[_0xed22('0x8')]=_0x339afa['countnosuchnumberretry'];this[_0xed22('0x9')]=_0x339afa[_0xed22('0x9')];this[_0xed22('0xa')]=_0x339afa[_0xed22('0xa')];this['countmachineretry']=_0x339afa[_0xed22('0xb')];this['countagentrejectretry']=_0x339afa[_0xed22('0xc')];this['queue']=_0x339afa['queue'];this['calleridname']=_0x339afa[_0xed22('0xd')];this[_0xed22('0xe')]=_0x339afa[_0xed22('0xe')];this['starttime']=_0x339afa[_0xed22('0xf')];this[_0xed22('0x10')]=_0x339afa['responsetime'];this['endtime']=_0x339afa[_0xed22('0x10')];this['ringtime']=_0x339afa[_0xed22('0x11')]||0x0;this[_0xed22('0x12')]=_0x339afa['holdtime']||0x0;this[_0xed22('0x13')]=_0x339afa[_0xed22('0x13')]||0x0;this['callback']=_0x339afa[_0xed22('0x14')];this['callbackuniqueid']=_0x339afa[_0xed22('0x15')];this[_0xed22('0x16')]=_0x339afa[_0xed22('0x16')];this['recallme']=_0x339afa[_0xed22('0x17')];this[_0xed22('0x18')]=_0x339afa['ContactId'];this['ListId']=_0x339afa[_0xed22('0x19')];this[_0xed22('0x1a')]=_0x339afa[_0xed22('0x1a')];this['VoiceQueueId']=_0x339afa[_0xed22('0x1b')];this[_0xed22('0x1c')]=_0x339afa['CampaignId'];this[_0xed22('0x1d')]=_0x339afa[_0xed22('0x1d')]||'';this['originatecalleridname']=_0x339afa[_0xed22('0x1e')]||'';this[_0xed22('0x1f')]=_0x339afa[_0xed22('0x1f')];this[_0xed22('0x20')]=_0x339afa[_0xed22('0x20')];}module[_0xed22('0x21')]=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 5968852..f9965df 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 _0xe18a=['amd','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','countdropretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','endtime','YYYY-MM-DD\x20HH:mm:ss','getSeconds','holdtime','queue','membername','IVR','cause-txt','callback','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports','moment','state','statedesc','scheduledat','type','outbound'];(function(_0x15f5be,_0x449e1d){var _0x3e2687=function(_0xc732a8){while(--_0xc732a8){_0x15f5be['push'](_0x15f5be['shift']());}};_0x3e2687(++_0x449e1d);}(_0xe18a,0xc2));var _0xae18=function(_0x587ec7,_0x4102e5){_0x587ec7=_0x587ec7-0x0;var _0x52a7c4=_0xe18a[_0x587ec7];return _0x52a7c4;};'use strict';var moment=require(_0xae18('0x0'));var utils=require('../utils');function Hangup(_0x26cf66,_0x4bd316){this[_0xae18('0x1')]=0x4;this[_0xae18('0x2')]='Answer';this[_0xae18('0x3')]=_0x26cf66[_0xae18('0x3')];this[_0xae18('0x4')]=_0x26cf66[_0xae18('0x4')];this['campaigntype']=_0x26cf66[_0xae18('0x4')]===_0xae18('0x5')?'queue':_0x26cf66[_0xae18('0x4')];this['amd']=_0x26cf66[_0xae18('0x6')]||![];this[_0xae18('0x7')]=_0x26cf66['countbusyretry'];this[_0xae18('0x8')]=_0x26cf66[_0xae18('0x8')];this[_0xae18('0x9')]=_0x26cf66[_0xae18('0x9')];this[_0xae18('0xa')]=_0x26cf66[_0xae18('0x7')]+_0x26cf66[_0xae18('0x8')]+_0x26cf66['countnoanswerretry']+_0x26cf66['countnosuchnumberretry']+_0x26cf66['countdropretry']+_0x26cf66[_0xae18('0xb')]+_0x26cf66[_0xae18('0xc')]+_0x26cf66[_0xae18('0xd')];this[_0xae18('0xe')]=_0x26cf66[_0xae18('0xe')];this[_0xae18('0xf')]=_0x26cf66['countdropretry'];this[_0xae18('0xb')]=_0x26cf66['countabandonedretry'];this[_0xae18('0xc')]=_0x26cf66['countmachineretry'];this['countagentrejectretry']=_0x26cf66[_0xae18('0xd')];this[_0xae18('0x10')]=_0x4bd316['uniqueid'];this[_0xae18('0x11')]=_0x26cf66[_0xae18('0x12')];this[_0xae18('0x13')]=_0x26cf66[_0xae18('0x14')];this[_0xae18('0x15')]=_0x26cf66[_0xae18('0x15')];this[_0xae18('0x16')]=_0x26cf66[_0xae18('0x16')];this[_0xae18('0x17')]=moment()['format'](_0xae18('0x18'));this['ringtime']=utils[_0xae18('0x19')](_0x26cf66['responsetime'],_0x26cf66[_0xae18('0x15')]);this[_0xae18('0x1a')]=0x0;this['talktime']=utils[_0xae18('0x19')](this['endtime'],_0x26cf66[_0xae18('0x16')]);this[_0xae18('0x1b')]=_0x26cf66[_0xae18('0x1b')];this[_0xae18('0x1c')]=_0xae18('0x1d');this['reason']=_0x4bd316[_0xae18('0x1e')];this['callback']=_0x26cf66[_0xae18('0x1f')];this['callbackuniqueid']=_0x26cf66['callbackuniqueid'];this['callbackat']=_0x26cf66[_0xae18('0x20')];this['recallme']=_0x26cf66[_0xae18('0x21')];this[_0xae18('0x22')]=_0x26cf66[_0xae18('0x22')];this[_0xae18('0x23')]=_0x26cf66[_0xae18('0x23')];this[_0xae18('0x24')]=_0x26cf66[_0xae18('0x24')];this['VoiceQueueId']=_0x26cf66[_0xae18('0x25')];this[_0xae18('0x26')]=_0x26cf66[_0xae18('0x26')];}module[_0xae18('0x27')]=Hangup; \ No newline at end of file +var _0x2d71=['countmachineretry','countagentrejectretry','countnosuchnumberretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','getSeconds','talktime','membername','IVR','reason','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports','moment','../utils','state','statedesc','Answer','scheduledat','type','campaigntype','outbound','queue','amd','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x2d71,0x131));var _0x12d7=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x2d71[_0x2641f9];return _0x585741;};'use strict';var moment=require(_0x12d7('0x0'));var utils=require(_0x12d7('0x1'));function Hangup(_0x19334e,_0x2d4b24){this[_0x12d7('0x2')]=0x4;this[_0x12d7('0x3')]=_0x12d7('0x4');this[_0x12d7('0x5')]=_0x19334e[_0x12d7('0x5')];this[_0x12d7('0x6')]=_0x19334e[_0x12d7('0x6')];this[_0x12d7('0x7')]=_0x19334e[_0x12d7('0x6')]===_0x12d7('0x8')?_0x12d7('0x9'):_0x19334e[_0x12d7('0x6')];this[_0x12d7('0xa')]=_0x19334e['amd']||![];this[_0x12d7('0xb')]=_0x19334e[_0x12d7('0xb')];this[_0x12d7('0xc')]=_0x19334e[_0x12d7('0xc')];this['countnoanswerretry']=_0x19334e[_0x12d7('0xd')];this[_0x12d7('0xe')]=_0x19334e[_0x12d7('0xb')]+_0x19334e[_0x12d7('0xc')]+_0x19334e['countnoanswerretry']+_0x19334e['countnosuchnumberretry']+_0x19334e[_0x12d7('0xf')]+_0x19334e[_0x12d7('0x10')]+_0x19334e[_0x12d7('0x11')]+_0x19334e[_0x12d7('0x12')];this[_0x12d7('0x13')]=_0x19334e[_0x12d7('0x13')];this[_0x12d7('0xf')]=_0x19334e[_0x12d7('0xf')];this[_0x12d7('0x10')]=_0x19334e[_0x12d7('0x10')];this['countmachineretry']=_0x19334e['countmachineretry'];this[_0x12d7('0x12')]=_0x19334e[_0x12d7('0x12')];this[_0x12d7('0x14')]=_0x2d4b24['uniqueid'];this[_0x12d7('0x15')]=_0x19334e[_0x12d7('0x16')];this[_0x12d7('0x17')]=_0x19334e[_0x12d7('0x18')];this[_0x12d7('0x19')]=_0x19334e[_0x12d7('0x19')];this[_0x12d7('0x1a')]=_0x19334e[_0x12d7('0x1a')];this[_0x12d7('0x1b')]=moment()[_0x12d7('0x1c')](_0x12d7('0x1d'));this['ringtime']=utils[_0x12d7('0x1e')](_0x19334e[_0x12d7('0x1a')],_0x19334e['starttime']);this['holdtime']=0x0;this[_0x12d7('0x1f')]=utils[_0x12d7('0x1e')](this[_0x12d7('0x1b')],_0x19334e['responsetime']);this[_0x12d7('0x9')]=_0x19334e['queue'];this[_0x12d7('0x20')]=_0x12d7('0x21');this[_0x12d7('0x22')]=_0x2d4b24[_0x12d7('0x23')];this[_0x12d7('0x24')]=_0x19334e[_0x12d7('0x24')];this[_0x12d7('0x25')]=_0x19334e['callbackuniqueid'];this[_0x12d7('0x26')]=_0x19334e[_0x12d7('0x26')];this[_0x12d7('0x27')]=_0x19334e['recallme'];this[_0x12d7('0x28')]=_0x19334e[_0x12d7('0x28')];this['ListId']=_0x19334e[_0x12d7('0x29')];this['UserId']=_0x19334e[_0x12d7('0x2a')];this[_0x12d7('0x2b')]=_0x19334e[_0x12d7('0x2b')];this[_0x12d7('0x2c')]=_0x19334e[_0x12d7('0x2c')];}module[_0x12d7('0x2d')]=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 67c2481..fd29b70 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 _0xeeec=['getSeconds','holdtime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countnosuchnumberretry','countmachineretry','countagentrejectretry','calleridname','name','calleridnum','number','starttime','responsetime','endtime'];(function(_0x5c12b1,_0x41da52){var _0xc604c9=function(_0x5cd8bc){while(--_0x5cd8bc){_0x5c12b1['push'](_0x5c12b1['shift']());}};_0xc604c9(++_0x41da52);}(_0xeeec,0xc8));var _0xceee=function(_0x176329,_0x568c84){_0x176329=_0x176329-0x0;var _0x31997c=_0xeeec[_0x176329];return _0x31997c;};'use strict';var utils=require('../utils');function History(_0x803041){this[_0xceee('0x0')]=_0x803041[_0xceee('0x0')];this[_0xceee('0x1')]=_0x803041['scheduledat']||undefined;this[_0xceee('0x2')]=_0x803041[_0xceee('0x2')];this[_0xceee('0x3')]=_0x803041['type']===_0xceee('0x4')?_0xceee('0x5'):_0x803041['type'];this[_0xceee('0x6')]=_0x803041['countbusyretry'];this['countcongestionretry']=_0x803041[_0xceee('0x7')];this[_0xceee('0x8')]=_0x803041[_0xceee('0x8')];this[_0xceee('0x9')]=_0x803041['countbusyretry']+_0x803041[_0xceee('0x7')]+_0x803041[_0xceee('0x8')]+_0x803041['countnosuchnumberretry']+_0x803041[_0xceee('0xa')]+_0x803041[_0xceee('0xb')]+_0x803041['countmachineretry']+_0x803041['countagentrejectretry'];this[_0xceee('0xc')]=_0x803041['countnosuchnumberretry'];this[_0xceee('0xa')]=_0x803041[_0xceee('0xa')];this[_0xceee('0xb')]=_0x803041['countabandonedretry'];this[_0xceee('0xd')]=_0x803041[_0xceee('0xd')];this[_0xceee('0xe')]=_0x803041[_0xceee('0xe')];this['queue']=_0x803041[_0xceee('0x5')];this[_0xceee('0xf')]=_0x803041[_0xceee('0x10')];this[_0xceee('0x11')]=_0x803041[_0xceee('0x12')];this[_0xceee('0x13')]=_0x803041[_0xceee('0x13')];this[_0xceee('0x14')]=_0x803041[_0xceee('0x14')];this[_0xceee('0x15')]=_0x803041[_0xceee('0x14')];this['ringtime']=utils[_0xceee('0x16')](_0x803041['responsetime'],_0x803041[_0xceee('0x13')]);this[_0xceee('0x17')]=0x0;this['talktime']=0x0;this['callback']=_0x803041[_0xceee('0x18')];this[_0xceee('0x19')]=_0x803041[_0xceee('0x19')];this[_0xceee('0x1a')]=_0x803041[_0xceee('0x1a')];this[_0xceee('0x1b')]=_0x803041[_0xceee('0x1b')];this[_0xceee('0x1c')]=_0x803041['ContactId'];this[_0xceee('0x1d')]=_0x803041['ListId'];this['UserId']=_0x803041[_0xceee('0x1e')];this[_0xceee('0x1f')]=_0x803041[_0xceee('0x1f')];this[_0xceee('0x20')]=_0x803041[_0xceee('0x20')];this[_0xceee('0x21')]=_0x803041[_0xceee('0x21')]||'';this[_0xceee('0x22')]=_0x803041['originatecalleridname']||'';this[_0xceee('0x23')]=_0x803041['state'];this[_0xceee('0x24')]=_0x803041['statedesc'];}module['exports']=History; \ No newline at end of file +var _0x0dce=['countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countagentrejectretry','countabandonedretry','countmachineretry','calleridname','name','calleridnum','starttime','responsetime','ringtime','getSeconds','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','state','statedesc','exports','../utils','uniqueid','scheduledat','type','campaigntype','outbound','queue'];(function(_0x3037b8,_0x5a886b){var _0x1ed148=function(_0x11a83e){while(--_0x11a83e){_0x3037b8['push'](_0x3037b8['shift']());}};_0x1ed148(++_0x5a886b);}(_0x0dce,0x16b));var _0xe0dc=function(_0x36eaaa,_0x326732){_0x36eaaa=_0x36eaaa-0x0;var _0x461349=_0x0dce[_0x36eaaa];return _0x461349;};'use strict';var utils=require(_0xe0dc('0x0'));function History(_0x16a44c){this[_0xe0dc('0x1')]=_0x16a44c[_0xe0dc('0x1')];this[_0xe0dc('0x2')]=_0x16a44c['scheduledat']||undefined;this[_0xe0dc('0x3')]=_0x16a44c['type'];this[_0xe0dc('0x4')]=_0x16a44c['type']===_0xe0dc('0x5')?_0xe0dc('0x6'):_0x16a44c[_0xe0dc('0x3')];this[_0xe0dc('0x7')]=_0x16a44c[_0xe0dc('0x7')];this['countcongestionretry']=_0x16a44c[_0xe0dc('0x8')];this[_0xe0dc('0x9')]=_0x16a44c[_0xe0dc('0x9')];this['countglobal']=_0x16a44c[_0xe0dc('0x7')]+_0x16a44c[_0xe0dc('0x8')]+_0x16a44c[_0xe0dc('0x9')]+_0x16a44c[_0xe0dc('0xa')]+_0x16a44c[_0xe0dc('0xb')]+_0x16a44c['countabandonedretry']+_0x16a44c['countmachineretry']+_0x16a44c[_0xe0dc('0xc')];this[_0xe0dc('0xa')]=_0x16a44c[_0xe0dc('0xa')];this['countdropretry']=_0x16a44c[_0xe0dc('0xb')];this['countabandonedretry']=_0x16a44c[_0xe0dc('0xd')];this[_0xe0dc('0xe')]=_0x16a44c[_0xe0dc('0xe')];this[_0xe0dc('0xc')]=_0x16a44c[_0xe0dc('0xc')];this[_0xe0dc('0x6')]=_0x16a44c[_0xe0dc('0x6')];this[_0xe0dc('0xf')]=_0x16a44c[_0xe0dc('0x10')];this[_0xe0dc('0x11')]=_0x16a44c['number'];this['starttime']=_0x16a44c[_0xe0dc('0x12')];this[_0xe0dc('0x13')]=_0x16a44c[_0xe0dc('0x13')];this['endtime']=_0x16a44c[_0xe0dc('0x13')];this[_0xe0dc('0x14')]=utils[_0xe0dc('0x15')](_0x16a44c['responsetime'],_0x16a44c['starttime']);this[_0xe0dc('0x16')]=0x0;this[_0xe0dc('0x17')]=0x0;this[_0xe0dc('0x18')]=_0x16a44c[_0xe0dc('0x18')];this[_0xe0dc('0x19')]=_0x16a44c[_0xe0dc('0x19')];this[_0xe0dc('0x1a')]=_0x16a44c[_0xe0dc('0x1a')];this[_0xe0dc('0x1b')]=_0x16a44c[_0xe0dc('0x1b')];this[_0xe0dc('0x1c')]=_0x16a44c['ContactId'];this[_0xe0dc('0x1d')]=_0x16a44c[_0xe0dc('0x1d')];this[_0xe0dc('0x1e')]=_0x16a44c['UserId'];this[_0xe0dc('0x1f')]=_0x16a44c[_0xe0dc('0x1f')];this[_0xe0dc('0x20')]=_0x16a44c['CampaignId'];this[_0xe0dc('0x21')]=_0x16a44c[_0xe0dc('0x21')]||'';this['originatecalleridname']=_0x16a44c['originatecalleridname']||'';this[_0xe0dc('0x22')]=_0x16a44c[_0xe0dc('0x22')];this[_0xe0dc('0x23')]=_0x16a44c[_0xe0dc('0x23')];}module[_0xe0dc('0x24')]=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 e481c2d..d14494e 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 _0x3c2f=['calleridnum','starttime','responsetime','droptime','dropreason','endtime','ringtime','getSeconds','holdtime','talktime','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','agiafterat','state','statedesc','exports','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','countdropretry','uniqueid','calleridname','name'];(function(_0x478155,_0xc0e7e3){var _0x3eb18c=function(_0x5bc8b3){while(--_0x5bc8b3){_0x478155['push'](_0x478155['shift']());}};_0x3eb18c(++_0xc0e7e3);}(_0x3c2f,0x115));var _0xf3c2=function(_0x3dd92b,_0x4d1139){_0x3dd92b=_0x3dd92b-0x0;var _0x5e1d23=_0x3c2f[_0x3dd92b];return _0x5e1d23;};'use strict';var utils=require('../utils');function QueueCallerAbandon(_0x858091,_0x48ebb2){this['scheduledat']=_0x858091[_0xf3c2('0x0')];this[_0xf3c2('0x1')]=_0x858091[_0xf3c2('0x1')];this[_0xf3c2('0x2')]=_0x858091[_0xf3c2('0x1')]===_0xf3c2('0x3')?_0xf3c2('0x4'):_0x858091[_0xf3c2('0x1')];this[_0xf3c2('0x5')]=_0x858091[_0xf3c2('0x5')];this[_0xf3c2('0x6')]=_0x858091[_0xf3c2('0x6')];this[_0xf3c2('0x7')]=_0x858091[_0xf3c2('0x7')];this[_0xf3c2('0x8')]=_0x858091[_0xf3c2('0x5')]+_0x858091[_0xf3c2('0x6')]+_0x858091[_0xf3c2('0x7')]+_0x858091[_0xf3c2('0x9')]+_0x858091['countdropretry']+_0x858091[_0xf3c2('0xa')]+_0x858091[_0xf3c2('0xb')]+_0x858091[_0xf3c2('0xc')];this[_0xf3c2('0x9')]=_0x858091[_0xf3c2('0x9')];this['countdropretry']=_0x858091[_0xf3c2('0xd')];this[_0xf3c2('0xa')]=_0x858091['countabandonedretry'];this[_0xf3c2('0xb')]=_0x858091[_0xf3c2('0xb')];this[_0xf3c2('0xc')]=_0x858091['countagentrejectretry'];this['uniqueid']=_0x48ebb2[_0xf3c2('0xe')];this[_0xf3c2('0xf')]=_0x858091[_0xf3c2('0x10')];this[_0xf3c2('0x11')]=_0x858091['number'];this[_0xf3c2('0x12')]=_0x858091['starttime'];this[_0xf3c2('0x13')]=_0x858091[_0xf3c2('0x13')];this[_0xf3c2('0x14')]=_0x858091['droptime'];this['dropreason']=_0x858091[_0xf3c2('0x15')];this[_0xf3c2('0x16')]=this[_0xf3c2('0x14')];this[_0xf3c2('0x17')]=utils[_0xf3c2('0x18')](_0x858091[_0xf3c2('0x13')],_0x858091[_0xf3c2('0x12')]);this[_0xf3c2('0x19')]=utils[_0xf3c2('0x18')](this[_0xf3c2('0x14')],_0x858091['responsetime']);this[_0xf3c2('0x1a')]=0x0;this['queue']=_0x48ebb2[_0xf3c2('0x4')];this['membername']=_0x48ebb2[_0xf3c2('0x1b')];this[_0xf3c2('0x1c')]=_0x48ebb2['reason'];this['callback']=_0x858091[_0xf3c2('0x1d')];this[_0xf3c2('0x1e')]=_0x858091[_0xf3c2('0x1e')];this[_0xf3c2('0x1f')]=_0x858091[_0xf3c2('0x1f')];this['recallme']=_0x858091[_0xf3c2('0x20')];this['ContactId']=_0x858091['ContactId'];this[_0xf3c2('0x21')]=_0x858091[_0xf3c2('0x21')];this[_0xf3c2('0x22')]=_0x858091['UserId'];this[_0xf3c2('0x23')]=_0x858091[_0xf3c2('0x23')];this[_0xf3c2('0x24')]=_0x858091[_0xf3c2('0x24')];this[_0xf3c2('0x25')]=_0x858091['originatecalleridnum']||'';this['originatecalleridname']=_0x858091['originatecalleridname']||'';this[_0xf3c2('0x26')]=_0x858091[_0xf3c2('0x26')];this[_0xf3c2('0x27')]=_0x858091['state'];this[_0xf3c2('0x28')]=_0x858091[_0xf3c2('0x28')];}module[_0xf3c2('0x29')]=QueueCallerAbandon; \ No newline at end of file +var _0x2116=['starttime','responsetime','droptime','dropreason','endtime','ringtime','getSeconds','holdtime','talktime','queue','membername','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','state','statedesc','exports','../utils','scheduledat','type','campaigntype','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','number'];(function(_0x6fa1c9,_0x1834f2){var _0x3ebf6f=function(_0x132805){while(--_0x132805){_0x6fa1c9['push'](_0x6fa1c9['shift']());}};_0x3ebf6f(++_0x1834f2);}(_0x2116,0x1f2));var _0x6211=function(_0xf29fa8,_0x4e2f6b){_0xf29fa8=_0xf29fa8-0x0;var _0x5a7b84=_0x2116[_0xf29fa8];return _0x5a7b84;};'use strict';var utils=require(_0x6211('0x0'));function QueueCallerAbandon(_0x5a3613,_0x57c015){this[_0x6211('0x1')]=_0x5a3613[_0x6211('0x1')];this[_0x6211('0x2')]=_0x5a3613[_0x6211('0x2')];this[_0x6211('0x3')]=_0x5a3613['type']===_0x6211('0x4')?'queue':_0x5a3613[_0x6211('0x2')];this[_0x6211('0x5')]=_0x5a3613[_0x6211('0x5')];this[_0x6211('0x6')]=_0x5a3613[_0x6211('0x6')];this[_0x6211('0x7')]=_0x5a3613[_0x6211('0x7')];this[_0x6211('0x8')]=_0x5a3613[_0x6211('0x5')]+_0x5a3613[_0x6211('0x6')]+_0x5a3613[_0x6211('0x7')]+_0x5a3613[_0x6211('0x9')]+_0x5a3613[_0x6211('0xa')]+_0x5a3613[_0x6211('0xb')]+_0x5a3613[_0x6211('0xc')]+_0x5a3613[_0x6211('0xd')];this['countnosuchnumberretry']=_0x5a3613['countnosuchnumberretry'];this[_0x6211('0xa')]=_0x5a3613[_0x6211('0xa')];this[_0x6211('0xb')]=_0x5a3613[_0x6211('0xb')];this[_0x6211('0xc')]=_0x5a3613[_0x6211('0xc')];this['countagentrejectretry']=_0x5a3613[_0x6211('0xd')];this[_0x6211('0xe')]=_0x57c015['uniqueid'];this[_0x6211('0xf')]=_0x5a3613[_0x6211('0x10')];this[_0x6211('0x11')]=_0x5a3613[_0x6211('0x12')];this[_0x6211('0x13')]=_0x5a3613['starttime'];this[_0x6211('0x14')]=_0x5a3613[_0x6211('0x14')];this[_0x6211('0x15')]=_0x5a3613['droptime'];this['dropreason']=_0x5a3613[_0x6211('0x16')];this[_0x6211('0x17')]=this[_0x6211('0x15')];this[_0x6211('0x18')]=utils[_0x6211('0x19')](_0x5a3613[_0x6211('0x14')],_0x5a3613[_0x6211('0x13')]);this[_0x6211('0x1a')]=utils[_0x6211('0x19')](this[_0x6211('0x15')],_0x5a3613['responsetime']);this[_0x6211('0x1b')]=0x0;this[_0x6211('0x1c')]=_0x57c015[_0x6211('0x1c')];this[_0x6211('0x1d')]=_0x57c015[_0x6211('0x1e')];this[_0x6211('0x1f')]=_0x57c015['reason'];this[_0x6211('0x20')]=_0x5a3613[_0x6211('0x20')];this['callbackuniqueid']=_0x5a3613[_0x6211('0x21')];this[_0x6211('0x22')]=_0x5a3613[_0x6211('0x22')];this[_0x6211('0x23')]=_0x5a3613[_0x6211('0x23')];this[_0x6211('0x24')]=_0x5a3613['ContactId'];this[_0x6211('0x25')]=_0x5a3613[_0x6211('0x25')];this[_0x6211('0x26')]=_0x5a3613[_0x6211('0x26')];this[_0x6211('0x27')]=_0x5a3613[_0x6211('0x27')];this[_0x6211('0x28')]=_0x5a3613[_0x6211('0x28')];this[_0x6211('0x29')]=_0x5a3613['originatecalleridnum']||'';this[_0x6211('0x2a')]=_0x5a3613['originatecalleridname']||'';this['agiafterat']=_0x5a3613[_0x6211('0x2b')];this[_0x6211('0x2c')]=_0x5a3613['state'];this[_0x6211('0x2d')]=_0x5a3613['statedesc'];}module[_0x6211('0x2e')]=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 17c0702..d450753 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 _0x32f4=['catch','[getContactDialerIvr]','countReScheduled','error','[rescheduleContact]','rescheduleContact','unlockContact','[unlockContact]','moveContactManagedDialer','[moveContactManagedDialer]','checkIsBlackList','[checkIsBlackList]','checkIsBlackListIvr','[verifyAdditionalPhone]','verifyAdditionalPhones','swapAdditionalPhones','[swapAdditionalPhone]','avgHandleTime','createHistory','[createHistory]','util','../../../../config/logger','dialer','../../rpc/cmHopper','../../rpc/cmHopperBlack','../../rpc/cmHopperHistory','inspect','getContactDialer','temp','[getContactDialer]','getContactDialerIvr','dialOrderByScheduledAt'];(function(_0x19f74b,_0x2d3ec5){var _0xc2a72b=function(_0x32db0c){while(--_0x32db0c){_0x19f74b['push'](_0x19f74b['shift']());}};_0xc2a72b(++_0x2d3ec5);}(_0x32f4,0x154));var _0x432f=function(_0x1a6e3e,_0x31157d){_0x1a6e3e=_0x1a6e3e-0x0;var _0xf08b4b=_0x32f4[_0x1a6e3e];return _0xf08b4b;};'use strict';var util=require(_0x432f('0x0'));var logger=require(_0x432f('0x1'))(_0x432f('0x2'));var cmHopper=require(_0x432f('0x3'));var cmHopperAdditionalPhone=require('../../rpc/cmHopperAdditionalPhone');var cmHopperBlack=require(_0x432f('0x4'));var cmHopperHistory=require(_0x432f('0x5'));function inspectError(_0x51a71a){return util[_0x432f('0x6')](_0x51a71a,{'showHidden':![],'depth':null});}function getContactDialer(_0x1eabac,_0x344a29,_0x355b02){return cmHopper[_0x432f('0x7')](_0x1eabac['id'],_0x344a29,_0x355b02,_0x1eabac['dialOrderByScheduledAt'])['catch'](function(_0x2f66fd){_0x1eabac[_0x432f('0x8')]=0x0;logger['error'](_0x432f('0x9'),inspectError(_0x2f66fd));});}exports['getContactDialer']=getContactDialer;function getContactDialerIvr(_0x1cdcfd,_0x340fe9){return cmHopper[_0x432f('0xa')](_0x1cdcfd['id'],_0x340fe9,_0x1cdcfd[_0x432f('0xb')])[_0x432f('0xc')](function(_0x5d0155){_0x1cdcfd[_0x432f('0x8')]=0x0;logger['error'](_0x432f('0xd'),inspectError(_0x5d0155));});}exports['getContactDialerIvr']=getContactDialerIvr;function countReScheduled(_0x138967){return cmHopper[_0x432f('0xe')](_0x138967)['catch'](function(_0x457389){logger[_0x432f('0xf')]('[countReScheduled]',inspectError(_0x457389));});}exports[_0x432f('0xe')]=countReScheduled;function rescheduleContact(_0x26aa9a){return cmHopper['rescheduleContact'](_0x26aa9a)['catch'](function(_0x28d9e9){logger[_0x432f('0xf')](_0x432f('0x10'),inspectError(_0x28d9e9));});}exports[_0x432f('0x11')]=rescheduleContact;function unlockContact(_0x419bfe,_0x4f91c5,_0x175ba7){return cmHopper[_0x432f('0x12')](_0x419bfe,_0x4f91c5,_0x175ba7)[_0x432f('0xc')](function(_0x1504db){logger['error'](_0x432f('0x13'),inspectError(_0x1504db));});}exports[_0x432f('0x12')]=unlockContact;function moveContactManagedDialer(_0x42c2d2){return cmHopper[_0x432f('0x14')](_0x42c2d2)[_0x432f('0xc')](function(_0x129582){logger['error'](_0x432f('0x15'),inspectError(_0x129582));});}exports['moveContactManagedDialer']=moveContactManagedDialer;function checkIsBlackList(_0x3d545d){return cmHopperBlack[_0x432f('0x16')](_0x3d545d)[_0x432f('0xc')](function(_0x391fd8){logger[_0x432f('0xf')](_0x432f('0x17'),inspectError(_0x391fd8));});}exports[_0x432f('0x16')]=checkIsBlackList;function checkIsBlackListIvr(_0x1899e6){return cmHopperBlack[_0x432f('0x18')](_0x1899e6)[_0x432f('0xc')](function(_0x40176d){logger[_0x432f('0xf')]('[checkIsBlackListIvr]',inspectError(_0x40176d));});}exports['checkIsBlackListIvr']=checkIsBlackListIvr;function verifyAdditionalPhones(_0x343d13,_0x5c4deb,_0x28968e){return cmHopperAdditionalPhone['verifyAdditionalPhones'](_0x343d13,_0x5c4deb,_0x28968e)[_0x432f('0xc')](function(_0x175d1b){logger[_0x432f('0xf')](_0x432f('0x19'),inspectError(_0x175d1b));});}exports[_0x432f('0x1a')]=verifyAdditionalPhones;function swapAdditionalPhones(_0x1e347a,_0x59f352,_0x252b3b){return cmHopperAdditionalPhone[_0x432f('0x1b')](_0x1e347a,_0x59f352,_0x252b3b)['catch'](function(_0x2cbde9){logger[_0x432f('0xf')](_0x432f('0x1c'),inspectError(_0x2cbde9));});}exports[_0x432f('0x1b')]=swapAdditionalPhones;function avgHandleTime(_0x44839){return cmHopperHistory[_0x432f('0x1d')](_0x44839)[_0x432f('0xc')](function(_0x5a3d18){logger[_0x432f('0xf')]('[avgHandleTime]',inspectError(_0x5a3d18));});}exports[_0x432f('0x1d')]=avgHandleTime;function createHistory(_0x573cc5){return cmHopperHistory[_0x432f('0x1e')](_0x573cc5)['catch'](function(_0x3f768b){logger['error'](_0x432f('0x1f'),inspectError(_0x3f768b));});}exports[_0x432f('0x1e')]=createHistory; \ No newline at end of file +var _0xf072=['dialer','../../rpc/cmHopperAdditionalPhone','../../rpc/cmHopperHistory','inspect','getContactDialer','dialOrderByScheduledAt','catch','temp','error','[getContactDialer]','getContactDialerIvr','[getContactDialerIvr]','[countReScheduled]','countReScheduled','[rescheduleContact]','rescheduleContact','[unlockContact]','unlockContact','moveContactManagedDialer','checkIsBlackList','[checkIsBlackList]','checkIsBlackListIvr','verifyAdditionalPhones','swapAdditionalPhones','[swapAdditionalPhone]','avgHandleTime','[avgHandleTime]','createHistory','[createHistory]','util','../../../../config/logger'];(function(_0x13c625,_0xc65b8e){var _0x1f2506=function(_0x318ccc){while(--_0x318ccc){_0x13c625['push'](_0x13c625['shift']());}};_0x1f2506(++_0xc65b8e);}(_0xf072,0x1cf));var _0x2f07=function(_0x575b97,_0xb2deb0){_0x575b97=_0x575b97-0x0;var _0x16e419=_0xf072[_0x575b97];return _0x16e419;};'use strict';var util=require(_0x2f07('0x0'));var logger=require(_0x2f07('0x1'))(_0x2f07('0x2'));var cmHopper=require('../../rpc/cmHopper');var cmHopperAdditionalPhone=require(_0x2f07('0x3'));var cmHopperBlack=require('../../rpc/cmHopperBlack');var cmHopperHistory=require(_0x2f07('0x4'));function inspectError(_0x432696){return util[_0x2f07('0x5')](_0x432696,{'showHidden':![],'depth':null});}function getContactDialer(_0x48d7b6,_0x1d5a33,_0x14d6e6){return cmHopper[_0x2f07('0x6')](_0x48d7b6['id'],_0x1d5a33,_0x14d6e6,_0x48d7b6[_0x2f07('0x7')])[_0x2f07('0x8')](function(_0xf73d1a){_0x48d7b6[_0x2f07('0x9')]=0x0;logger[_0x2f07('0xa')](_0x2f07('0xb'),inspectError(_0xf73d1a));});}exports[_0x2f07('0x6')]=getContactDialer;function getContactDialerIvr(_0x30c638,_0x2e372c){return cmHopper[_0x2f07('0xc')](_0x30c638['id'],_0x2e372c,_0x30c638[_0x2f07('0x7')])[_0x2f07('0x8')](function(_0x564260){_0x30c638[_0x2f07('0x9')]=0x0;logger[_0x2f07('0xa')](_0x2f07('0xd'),inspectError(_0x564260));});}exports[_0x2f07('0xc')]=getContactDialerIvr;function countReScheduled(_0x496d87){return cmHopper['countReScheduled'](_0x496d87)[_0x2f07('0x8')](function(_0x1e291d){logger['error'](_0x2f07('0xe'),inspectError(_0x1e291d));});}exports[_0x2f07('0xf')]=countReScheduled;function rescheduleContact(_0x26edfa){return cmHopper['rescheduleContact'](_0x26edfa)[_0x2f07('0x8')](function(_0x443fdc){logger[_0x2f07('0xa')](_0x2f07('0x10'),inspectError(_0x443fdc));});}exports[_0x2f07('0x11')]=rescheduleContact;function unlockContact(_0x309908,_0x5d32d6,_0x8475cf){return cmHopper['unlockContact'](_0x309908,_0x5d32d6,_0x8475cf)[_0x2f07('0x8')](function(_0xe8cf4d){logger[_0x2f07('0xa')](_0x2f07('0x12'),inspectError(_0xe8cf4d));});}exports[_0x2f07('0x13')]=unlockContact;function moveContactManagedDialer(_0x46c9b4){return cmHopper[_0x2f07('0x14')](_0x46c9b4)[_0x2f07('0x8')](function(_0x55bd60){logger[_0x2f07('0xa')]('[moveContactManagedDialer]',inspectError(_0x55bd60));});}exports[_0x2f07('0x14')]=moveContactManagedDialer;function checkIsBlackList(_0x2df6ed){return cmHopperBlack[_0x2f07('0x15')](_0x2df6ed)[_0x2f07('0x8')](function(_0x2ef47d){logger['error'](_0x2f07('0x16'),inspectError(_0x2ef47d));});}exports['checkIsBlackList']=checkIsBlackList;function checkIsBlackListIvr(_0x5db56b){return cmHopperBlack['checkIsBlackListIvr'](_0x5db56b)[_0x2f07('0x8')](function(_0x51c285){logger[_0x2f07('0xa')]('[checkIsBlackListIvr]',inspectError(_0x51c285));});}exports[_0x2f07('0x17')]=checkIsBlackListIvr;function verifyAdditionalPhones(_0x2c495f,_0x12a2a5,_0x307888){return cmHopperAdditionalPhone['verifyAdditionalPhones'](_0x2c495f,_0x12a2a5,_0x307888)[_0x2f07('0x8')](function(_0x428d8c){logger[_0x2f07('0xa')]('[verifyAdditionalPhone]',inspectError(_0x428d8c));});}exports[_0x2f07('0x18')]=verifyAdditionalPhones;function swapAdditionalPhones(_0x113916,_0x522006,_0x1dcedc){return cmHopperAdditionalPhone[_0x2f07('0x19')](_0x113916,_0x522006,_0x1dcedc)['catch'](function(_0x427e13){logger['error'](_0x2f07('0x1a'),inspectError(_0x427e13));});}exports[_0x2f07('0x19')]=swapAdditionalPhones;function avgHandleTime(_0x27bd72){return cmHopperHistory[_0x2f07('0x1b')](_0x27bd72)[_0x2f07('0x8')](function(_0x139ea8){logger[_0x2f07('0xa')](_0x2f07('0x1c'),inspectError(_0x139ea8));});}exports[_0x2f07('0x1b')]=avgHandleTime;function createHistory(_0x468cd8){return cmHopperHistory[_0x2f07('0x1d')](_0x468cd8)[_0x2f07('0x8')](function(_0x4c607a){logger[_0x2f07('0xa')](_0x2f07('0x1e'),inspectError(_0x4c607a));});}exports[_0x2f07('0x1d')]=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 eef5274..59fb2ba 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 _0x9612=['getQueueCampaignActiveStatusMessage','match','extractCalleridName','string','isEmpty','isUndefined','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','getCallerId','\x5cw{0,','pow','replace','random','toString','getCallerIdRandom','error','[decrementOriginate]\x20queue\x20originate\x20value\x20is\x20negative','decrementOriginate','length','checkContactEmpty','erlangb','checkContactLowerLimitOriginate','createdAt','description','tags','undefined','%s%s','XMD-','toUpperCase','lodash','util','../../../../config/logger','dialer','../../../../config/environment/shared','ACTIVE','RESCHEDULED_CONTACTS','DEACTIVATED','IS_DISACTIVED','NOT_ACTIVE','AGENTS_NOT_LOGGED','AVAILABLE_CONTACTS_FINISHED','INTERVAL_IS_NULL','GLOBAL_INTERVAL_IS_OVERTIME','RECALLINQUEUE','RECALLFAILEDTIMEOUT','RUNNING','TRUNK_IS_NOT_REACHABLE','CAMPAIGN_STATUS','preview','isIVRCampaign','type','isOutboundQueue','dialActive','isQueueCampaignActive','active','isIVRCampaignActive','milliseconds','diff','seconds','getSeconds','dialMethod','message','available','loggedIn','loggedInDb','paused','talking','pTalking','waiting','inUse','originated','Trunk','name','hasQueueCampaignDataChanged','dialTimezone','dialGlobalInterval','isNil','NULL_INTERVAL','Interval','EMPTY_INTERVAL','SIP/','unmonitored','includes','TrunkBackup','INACTIVE','DISACTIVED','UNREACHABLE_TRUNK'];(function(_0x51273f,_0x36368d){var _0x2b4cb8=function(_0xbdc9e1){while(--_0xbdc9e1){_0x51273f['push'](_0x51273f['shift']());}};_0x2b4cb8(++_0x36368d);}(_0x9612,0x76));var _0x2961=function(_0x854bd6,_0x14a5c3){_0x854bd6=_0x854bd6-0x0;var _0x2d6856=_0x9612[_0x854bd6];return _0x2d6856;};'use strict';var _=require(_0x2961('0x0'));var moment=require('moment');var util=require(_0x2961('0x1'));var logger=require(_0x2961('0x2'))(_0x2961('0x3'));var timezones=require(_0x2961('0x4'))['timezones'];var CAMPAIGN_STATUS={'ACTIVE':_0x2961('0x5'),'BLACKLIST':'BLACKLIST','CONTACTS_RESCHEDULED':_0x2961('0x6'),'DEACTIVATED':_0x2961('0x7'),'DISACTIVED':_0x2961('0x8'),'EMPTY_INTERVAL':'INTERVAL_IS_EMPTY','INACTIVE':_0x2961('0x9'),'NO_AGENTS_LOGGED':_0x2961('0xa'),'NO_AVAILABLE_CONTACTS':_0x2961('0xb'),'NULL_INTERVAL':_0x2961('0xc'),'OVERTIME_INTERVAL':'INTERVAL_IS_OVERTIME','OVERTIME_GLOBAL_INTERVAL':_0x2961('0xd'),'QUEUE_RECALL':_0x2961('0xe'),'RECALL_TIMEOUT':_0x2961('0xf'),'RUNNING':_0x2961('0x10'),'UNKNOWN_TIMEZONE':'TIMEZONE_UNKNOW','UNREACHABLE_TRUNK':_0x2961('0x11')};exports[_0x2961('0x12')]=CAMPAIGN_STATUS;function isPreviewCampaign(_0x196fdf){return _0x196fdf['dialMethod']===_0x2961('0x13');}exports['isPreviewCampaign']=isPreviewCampaign;function isIVRCampaign(_0x358dfb){return _0x358dfb['type']==='ivr';}exports[_0x2961('0x14')]=isIVRCampaign;function isOutboundQueue(_0x38dc33){return _0x38dc33[_0x2961('0x15')]==='outbound';}exports[_0x2961('0x16')]=isOutboundQueue;function isQueueCampaignActive(_0x38433b){return _0x38433b[_0x2961('0x17')];}exports[_0x2961('0x18')]=isQueueCampaignActive;function isIVRCampaignActive(_0x1949de){return _0x1949de[_0x2961('0x19')];}exports[_0x2961('0x1a')]=isIVRCampaignActive;function getSeconds(_0x1ca899,_0x2621d5){var _0x5373a7=moment(_0x1ca899)[_0x2961('0x1b')](0x0);var _0xd0e12a=moment(_0x2621d5)[_0x2961('0x1b')](0x0);return _0x5373a7[_0x2961('0x1c')](_0xd0e12a,_0x2961('0x1d'));}exports[_0x2961('0x1e')]=getSeconds;function hasQueueCampaignDataChanged(_0x15a553,_0x2612fd){var _0x1d6acd=![];var _0xba3172=_0x15a553[_0x2961('0x1f')]!==_0x2612fd[_0x2961('0x1f')]||_0x15a553[_0x2961('0x17')]!==_0x2612fd[_0x2961('0x17')]||_0x15a553[_0x2961('0x20')]!==_0x2612fd[_0x2961('0x20')];var _0x2d1b21=_0x15a553['available']!==_0x2612fd[_0x2961('0x21')]||_0x15a553[_0x2961('0x22')]!==_0x2612fd[_0x2961('0x22')]||_0x15a553['loggedInDb']!==_0x2612fd[_0x2961('0x23')]||_0x15a553['paused']!==_0x2612fd[_0x2961('0x24')]||_0x15a553[_0x2961('0x25')]!==_0x2612fd[_0x2961('0x25')]||_0x15a553[_0x2961('0x26')]!==_0x2612fd[_0x2961('0x26')]||_0x15a553[_0x2961('0x27')]!==_0x2612fd['waiting']||_0x15a553[_0x2961('0x28')]!==_0x2612fd[_0x2961('0x28')]||_0x15a553[_0x2961('0x29')]!==_0x2612fd['originated'];if(_0x15a553['Trunk']&&_0x2612fd[_0x2961('0x2a')]){_0x1d6acd=_0x15a553[_0x2961('0x2a')][_0x2961('0x2b')]!==_0x2612fd['Trunk'][_0x2961('0x2b')]||_0x15a553[_0x2961('0x2a')][_0x2961('0x19')]!==_0x2612fd[_0x2961('0x2a')][_0x2961('0x19')];}return _0xba3172||_0x2d1b21||_0x1d6acd;}exports[_0x2961('0x2c')]=hasQueueCampaignDataChanged;function checkAnyValidQueueCampaignInterval(_0x35cbab){var _0x182db3=null;var _0xf21df7=_0x35cbab[_0x2961('0x2d')];if(_['isNil'](_0x35cbab[_0x2961('0x2e')])||_[_0x2961('0x2f')](_0x35cbab['Interval'])||_[_0x2961('0x2f')](_0x35cbab['Interval']['Intervals'])){_0x182db3=CAMPAIGN_STATUS[_0x2961('0x30')];}else if(_['isEmpty'](_0x35cbab[_0x2961('0x2e')])||_['isEmpty'](_0x35cbab[_0x2961('0x31')]['Intervals'])){_0x182db3=CAMPAIGN_STATUS[_0x2961('0x32')];}else if(_0xf21df7&&!timezones[_0xf21df7]){_0x182db3=CAMPAIGN_STATUS['UNKNOWN_TIMEZONE'];}return _0x182db3;}function checkAnyValidTrunk(_0x2918b7,_0x30e75c){var _0x401688=null;var _0x49dbfa=_0x2961('0x33');var _0x38958b=['reachable',_0x2961('0x34')];var _0x3895ab=!![];if(_0x2918b7[_0x2961('0x2a')]&&_0x2918b7[_0x2961('0x2a')][_0x2961('0x19')]){_0x49dbfa+=_0x2918b7[_0x2961('0x2a')]['name'];_0x401688=_0x30e75c[_0x49dbfa];_0x3895ab=_0x38958b[_0x2961('0x35')](_0x401688['status']);}else if(_0x2918b7[_0x2961('0x36')]&&_0x2918b7[_0x2961('0x36')][_0x2961('0x19')]){_0x49dbfa+=_0x2918b7[_0x2961('0x36')][_0x2961('0x2b')];_0x401688=_0x30e75c[_0x49dbfa];_0x3895ab=_0x38958b[_0x2961('0x35')](_0x401688['status']);}return _0x3895ab;}function getQueueCampaignStatusMessage(_0x3cf9af,_0x2b7314){var _0x2f3e19=CAMPAIGN_STATUS[_0x2961('0x5')];var _0x4425d3=isPreviewCampaign(_0x3cf9af);if(!isQueueCampaignActive(_0x3cf9af)){if(_0x4425d3){_0x2f3e19=CAMPAIGN_STATUS[_0x2961('0x37')];}else{if(_0x3cf9af[_0x2961('0x29')]===0x0&&_0x3cf9af[_0x2961('0x25')]===0x0&&_0x3cf9af[_0x2961('0x27')]===0x0&&(_0x3cf9af[_0x2961('0x26')]||0x0)===0x0){_0x2f3e19=CAMPAIGN_STATUS[_0x2961('0x37')];}else{_0x2f3e19=CAMPAIGN_STATUS[_0x2961('0x38')];}}}else if(_0x3cf9af['loggedIn']===0x0){_0x2f3e19=CAMPAIGN_STATUS['NO_AGENTS_LOGGED'];}else if(!checkAnyValidTrunk(_0x3cf9af,_0x2b7314)){_0x2f3e19=CAMPAIGN_STATUS[_0x2961('0x39')];}else if(!isPreviewCampaign(_0x3cf9af)){var _0x5b824=checkAnyValidQueueCampaignInterval(_0x3cf9af);if(_0x5b824){_0x2f3e19=_0x5b824;}}return _0x2f3e19;}exports['getQueueCampaignStatusMessage']=getQueueCampaignStatusMessage;function getQueueCampaignActiveStatusMessage(_0x5d204a){var _0x15d557=CAMPAIGN_STATUS['DISACTIVED'];if(_0x5d204a[_0x2961('0x29')]===0x0&&_0x5d204a[_0x2961('0x25')]===0x0&&_0x5d204a[_0x2961('0x27')]===0x0&&(_0x5d204a[_0x2961('0x26')]||0x0)===0x0){_0x15d557=CAMPAIGN_STATUS['INACTIVE'];}return _0x15d557;}exports[_0x2961('0x3a')]=getQueueCampaignActiveStatusMessage;function extractCalleridName(_0x45cbb8){var _0x40d328=_0x45cbb8[_0x2961('0x3b')](/"(.*?)"/);return _0x40d328?_0x40d328[0x1]:_0x45cbb8;}exports[_0x2961('0x3c')]=extractCalleridName;function getCallerId(_0x8e78ed,_0x1c8921,_0x5124d9){if(!_['isUndefined'](_0x5124d9)&&typeof _0x5124d9===_0x2961('0x3d')&&!_[_0x2961('0x3e')](_0x5124d9)){if(!_[_0x2961('0x3f')](_0x1c8921)&&typeof _0x1c8921===_0x2961('0x3d')&&!_[_0x2961('0x3e')](_0x1c8921)){return util['format']('\x22%s\x22\x20<%s>',_0x1c8921,_0x5124d9);}return util[_0x2961('0x40')](_0x2961('0x41'),_0x5124d9,_0x5124d9);}if(!_['isUndefined'](_0x8e78ed)&&typeof _0x8e78ed===_0x2961('0x3d')&&!_[_0x2961('0x3e')](_0x8e78ed)){return _0x8e78ed;}return _0x2961('0x42');}exports[_0x2961('0x43')]=getCallerId;function getCallerIdRandom(_0x27266f,_0x38d7ce){var _0x5f3982;var _0x21919d;var _0x46148c;if(_0x38d7ce<=0x0){_0x38d7ce=0x1;}_0x5f3982=new RegExp(_0x2961('0x44')+_0x38d7ce+'}$');_0x21919d=Math[_0x2961('0x45')](0xa,_0x38d7ce-0x1);_0x46148c=Math[_0x2961('0x45')](0xa,_0x38d7ce)-0x1;return util['format']('%s',_[_0x2961('0x46')](_0x27266f,_0x5f3982,_[_0x2961('0x47')](_0x21919d,_0x46148c)[_0x2961('0x48')]()));}exports[_0x2961('0x49')]=getCallerIdRandom;function decrementOriginate(_0x43f207){if(_0x43f207[_0x2961('0x29')]&&_0x43f207[_0x2961('0x29')]>0x0){_0x43f207[_0x2961('0x29')]-=0x1;}else{logger[_0x2961('0x4a')](_0x2961('0x4b'));}}exports[_0x2961('0x4c')]=decrementOriginate;function checkContactEmpty(_0xbde4cb){return _0xbde4cb&&_0xbde4cb[_0x2961('0x4d')]>0x0;}exports[_0x2961('0x4e')]=checkContactEmpty;function erlangb(_0x47911b,_0x8e7d5c){if(_0x8e7d5c===0x0){return 0x0;}var _0x446556=0x1;for(var _0x3a66b2=0x1;_0x3a66b2<=_0x8e7d5c;_0x3a66b2+=0x1){_0x446556=0x1+_0x446556*_0x3a66b2/_0x47911b;}return 0x1/_0x446556;}exports[_0x2961('0x4f')]=erlangb;function checkContactLowerLimitOriginate(_0x170792,_0x35be3d,_0x1b5d57){if(_0x35be3d>_0x1b5d57){for(var _0xc002ac=0x0;_0xc002ac<_0x35be3d-_0x1b5d57;_0xc002ac+=0x1){decrementOriginate(_0x170792);}}}exports[_0x2961('0x50')]=checkContactLowerLimitOriginate;function setXMDContactVariables(_0x38afb9){var _0xa9b38c={};var _0x12c625=['id',_0x2961('0x51'),_0x2961('0x52'),_0x2961('0x53'),'updatedAt'];if(_0x38afb9){for(var _0x2dfa7e in _0x38afb9){if(typeof _0x38afb9[_0x2dfa7e]!==_0x2961('0x54')){if(!_['isNil'](_0x38afb9[_0x2dfa7e])&&!_0x12c625[_0x2961('0x35')](_0x2dfa7e)){_0xa9b38c[util['format'](_0x2961('0x55'),_0x2961('0x56'),_0x2dfa7e[_0x2961('0x57')]())]=_0x38afb9[_0x2dfa7e];}}}}return _0xa9b38c;}exports['setXMDContactVariables']=setXMDContactVariables; \ No newline at end of file +var _0x4913=['AGENTS_NOT_LOGGED','INTERVAL_IS_OVERTIME','GLOBAL_INTERVAL_IS_OVERTIME','RECALLINQUEUE','RECALLFAILEDTIMEOUT','RUNNING','TIMEZONE_UNKNOW','TRUNK_IS_NOT_REACHABLE','CAMPAIGN_STATUS','dialMethod','preview','isPreviewCampaign','ivr','outbound','isOutboundQueue','dialActive','active','isIVRCampaignActive','milliseconds','seconds','getSeconds','message','available','loggedInDb','paused','talking','pTalking','waiting','originated','Trunk','name','hasQueueCampaignDataChanged','dialTimezone','isNil','Interval','NULL_INTERVAL','isEmpty','dialGlobalInterval','Intervals','EMPTY_INTERVAL','SIP/','reachable','includes','TrunkBackup','status','INACTIVE','loggedIn','NO_AGENTS_LOGGED','UNREACHABLE_TRUNK','getQueueCampaignStatusMessage','DISACTIVED','getQueueCampaignActiveStatusMessage','match','extractCalleridName','isUndefined','string','format','\x22\x22\x20<>','\x5cw{0,','pow','replace','random','error','decrementOriginate','checkContactEmpty','erlangb','checkContactLowerLimitOriginate','createdAt','tags','updatedAt','undefined','%s%s','toUpperCase','setXMDContactVariables','moment','util','../../../../config/logger','../../../../config/environment/shared','timezones','ACTIVE','BLACKLIST','RESCHEDULED_CONTACTS','IS_DISACTIVED','INTERVAL_IS_EMPTY','NOT_ACTIVE'];(function(_0x194a8c,_0x25aeb1){var _0x33da37=function(_0x22d879){while(--_0x22d879){_0x194a8c['push'](_0x194a8c['shift']());}};_0x33da37(++_0x25aeb1);}(_0x4913,0x149));var _0x3491=function(_0x583f6d,_0x5d5eee){_0x583f6d=_0x583f6d-0x0;var _0x3ecc90=_0x4913[_0x583f6d];return _0x3ecc90;};'use strict';var _=require('lodash');var moment=require(_0x3491('0x0'));var util=require(_0x3491('0x1'));var logger=require(_0x3491('0x2'))('dialer');var timezones=require(_0x3491('0x3'))[_0x3491('0x4')];var CAMPAIGN_STATUS={'ACTIVE':_0x3491('0x5'),'BLACKLIST':_0x3491('0x6'),'CONTACTS_RESCHEDULED':_0x3491('0x7'),'DEACTIVATED':'DEACTIVATED','DISACTIVED':_0x3491('0x8'),'EMPTY_INTERVAL':_0x3491('0x9'),'INACTIVE':_0x3491('0xa'),'NO_AGENTS_LOGGED':_0x3491('0xb'),'NO_AVAILABLE_CONTACTS':'AVAILABLE_CONTACTS_FINISHED','NULL_INTERVAL':'INTERVAL_IS_NULL','OVERTIME_INTERVAL':_0x3491('0xc'),'OVERTIME_GLOBAL_INTERVAL':_0x3491('0xd'),'QUEUE_RECALL':_0x3491('0xe'),'RECALL_TIMEOUT':_0x3491('0xf'),'RUNNING':_0x3491('0x10'),'UNKNOWN_TIMEZONE':_0x3491('0x11'),'UNREACHABLE_TRUNK':_0x3491('0x12')};exports[_0x3491('0x13')]=CAMPAIGN_STATUS;function isPreviewCampaign(_0x145171){return _0x145171[_0x3491('0x14')]===_0x3491('0x15');}exports[_0x3491('0x16')]=isPreviewCampaign;function isIVRCampaign(_0x5d8b3b){return _0x5d8b3b['type']===_0x3491('0x17');}exports['isIVRCampaign']=isIVRCampaign;function isOutboundQueue(_0x15fc27){return _0x15fc27['type']===_0x3491('0x18');}exports[_0x3491('0x19')]=isOutboundQueue;function isQueueCampaignActive(_0x589904){return _0x589904[_0x3491('0x1a')];}exports['isQueueCampaignActive']=isQueueCampaignActive;function isIVRCampaignActive(_0x416f69){return _0x416f69[_0x3491('0x1b')];}exports[_0x3491('0x1c')]=isIVRCampaignActive;function getSeconds(_0x28bdc3,_0x14bbb1){var _0x3d516c=moment(_0x28bdc3)[_0x3491('0x1d')](0x0);var _0x15048e=moment(_0x14bbb1)['milliseconds'](0x0);return _0x3d516c['diff'](_0x15048e,_0x3491('0x1e'));}exports[_0x3491('0x1f')]=getSeconds;function hasQueueCampaignDataChanged(_0xa1a3ff,_0x3cd1b8){var _0x29b24b=![];var _0x38aa30=_0xa1a3ff['dialMethod']!==_0x3cd1b8[_0x3491('0x14')]||_0xa1a3ff[_0x3491('0x1a')]!==_0x3cd1b8[_0x3491('0x1a')]||_0xa1a3ff[_0x3491('0x20')]!==_0x3cd1b8[_0x3491('0x20')];var _0x2b4a8c=_0xa1a3ff['available']!==_0x3cd1b8[_0x3491('0x21')]||_0xa1a3ff['loggedIn']!==_0x3cd1b8['loggedIn']||_0xa1a3ff[_0x3491('0x22')]!==_0x3cd1b8[_0x3491('0x22')]||_0xa1a3ff[_0x3491('0x23')]!==_0x3cd1b8[_0x3491('0x23')]||_0xa1a3ff['talking']!==_0x3cd1b8[_0x3491('0x24')]||_0xa1a3ff[_0x3491('0x25')]!==_0x3cd1b8[_0x3491('0x25')]||_0xa1a3ff[_0x3491('0x26')]!==_0x3cd1b8['waiting']||_0xa1a3ff['inUse']!==_0x3cd1b8['inUse']||_0xa1a3ff[_0x3491('0x27')]!==_0x3cd1b8[_0x3491('0x27')];if(_0xa1a3ff['Trunk']&&_0x3cd1b8[_0x3491('0x28')]){_0x29b24b=_0xa1a3ff['Trunk'][_0x3491('0x29')]!==_0x3cd1b8['Trunk'][_0x3491('0x29')]||_0xa1a3ff[_0x3491('0x28')][_0x3491('0x1b')]!==_0x3cd1b8[_0x3491('0x28')][_0x3491('0x1b')];}return _0x38aa30||_0x2b4a8c||_0x29b24b;}exports[_0x3491('0x2a')]=hasQueueCampaignDataChanged;function checkAnyValidQueueCampaignInterval(_0x3b1d26){var _0x95bd40=null;var _0x4cc8b9=_0x3b1d26[_0x3491('0x2b')];if(_[_0x3491('0x2c')](_0x3b1d26['dialGlobalInterval'])||_[_0x3491('0x2c')](_0x3b1d26[_0x3491('0x2d')])||_['isNil'](_0x3b1d26[_0x3491('0x2d')]['Intervals'])){_0x95bd40=CAMPAIGN_STATUS[_0x3491('0x2e')];}else if(_[_0x3491('0x2f')](_0x3b1d26[_0x3491('0x30')])||_[_0x3491('0x2f')](_0x3b1d26['Interval'][_0x3491('0x31')])){_0x95bd40=CAMPAIGN_STATUS[_0x3491('0x32')];}else if(_0x4cc8b9&&!timezones[_0x4cc8b9]){_0x95bd40=CAMPAIGN_STATUS['UNKNOWN_TIMEZONE'];}return _0x95bd40;}function checkAnyValidTrunk(_0x61059c,_0x441dc1){var _0xb93902=null;var _0x3f1f5b=_0x3491('0x33');var _0x30e8d3=[_0x3491('0x34'),'unmonitored'];var _0x5d5d0d=!![];if(_0x61059c[_0x3491('0x28')]&&_0x61059c[_0x3491('0x28')]['active']){_0x3f1f5b+=_0x61059c[_0x3491('0x28')]['name'];_0xb93902=_0x441dc1[_0x3f1f5b];_0x5d5d0d=_0x30e8d3[_0x3491('0x35')](_0xb93902['status']);}else if(_0x61059c[_0x3491('0x36')]&&_0x61059c[_0x3491('0x36')][_0x3491('0x1b')]){_0x3f1f5b+=_0x61059c[_0x3491('0x36')][_0x3491('0x29')];_0xb93902=_0x441dc1[_0x3f1f5b];_0x5d5d0d=_0x30e8d3[_0x3491('0x35')](_0xb93902[_0x3491('0x37')]);}return _0x5d5d0d;}function getQueueCampaignStatusMessage(_0x493374,_0x3153ab){var _0x20dc95=CAMPAIGN_STATUS[_0x3491('0x5')];var _0x4e4359=isPreviewCampaign(_0x493374);if(!isQueueCampaignActive(_0x493374)){if(_0x4e4359){_0x20dc95=CAMPAIGN_STATUS[_0x3491('0x38')];}else{if(_0x493374['originated']===0x0&&_0x493374[_0x3491('0x24')]===0x0&&_0x493374['waiting']===0x0&&(_0x493374[_0x3491('0x25')]||0x0)===0x0){_0x20dc95=CAMPAIGN_STATUS[_0x3491('0x38')];}else{_0x20dc95=CAMPAIGN_STATUS['DISACTIVED'];}}}else if(_0x493374[_0x3491('0x39')]===0x0){_0x20dc95=CAMPAIGN_STATUS[_0x3491('0x3a')];}else if(!checkAnyValidTrunk(_0x493374,_0x3153ab)){_0x20dc95=CAMPAIGN_STATUS[_0x3491('0x3b')];}else if(!isPreviewCampaign(_0x493374)){var _0x537254=checkAnyValidQueueCampaignInterval(_0x493374);if(_0x537254){_0x20dc95=_0x537254;}}return _0x20dc95;}exports[_0x3491('0x3c')]=getQueueCampaignStatusMessage;function getQueueCampaignActiveStatusMessage(_0x1e39ed){var _0x5aa839=CAMPAIGN_STATUS[_0x3491('0x3d')];if(_0x1e39ed[_0x3491('0x27')]===0x0&&_0x1e39ed['talking']===0x0&&_0x1e39ed['waiting']===0x0&&(_0x1e39ed[_0x3491('0x25')]||0x0)===0x0){_0x5aa839=CAMPAIGN_STATUS[_0x3491('0x38')];}return _0x5aa839;}exports[_0x3491('0x3e')]=getQueueCampaignActiveStatusMessage;function extractCalleridName(_0x1b9bd9){var _0x31c025=_0x1b9bd9[_0x3491('0x3f')](/"(.*?)"/);return _0x31c025?_0x31c025[0x1]:_0x1b9bd9;}exports[_0x3491('0x40')]=extractCalleridName;function getCallerId(_0x52226e,_0x1cd4a3,_0x1e4776){if(!_[_0x3491('0x41')](_0x1e4776)&&typeof _0x1e4776==='string'&&!_[_0x3491('0x2f')](_0x1e4776)){if(!_[_0x3491('0x41')](_0x1cd4a3)&&typeof _0x1cd4a3===_0x3491('0x42')&&!_[_0x3491('0x2f')](_0x1cd4a3)){return util[_0x3491('0x43')]('\x22%s\x22\x20<%s>',_0x1cd4a3,_0x1e4776);}return util[_0x3491('0x43')]('\x22%s\x22\x20<%s>',_0x1e4776,_0x1e4776);}if(!_[_0x3491('0x41')](_0x52226e)&&typeof _0x52226e===_0x3491('0x42')&&!_[_0x3491('0x2f')](_0x52226e)){return _0x52226e;}return _0x3491('0x44');}exports['getCallerId']=getCallerId;function getCallerIdRandom(_0x370141,_0x4db08f){var _0x16070a;var _0x427627;var _0x579cf2;if(_0x4db08f<=0x0){_0x4db08f=0x1;}_0x16070a=new RegExp(_0x3491('0x45')+_0x4db08f+'}$');_0x427627=Math[_0x3491('0x46')](0xa,_0x4db08f-0x1);_0x579cf2=Math[_0x3491('0x46')](0xa,_0x4db08f)-0x1;return util[_0x3491('0x43')]('%s',_[_0x3491('0x47')](_0x370141,_0x16070a,_[_0x3491('0x48')](_0x427627,_0x579cf2)['toString']()));}exports['getCallerIdRandom']=getCallerIdRandom;function decrementOriginate(_0x56399e){if(_0x56399e['originated']&&_0x56399e['originated']>0x0){_0x56399e[_0x3491('0x27')]-=0x1;}else{logger[_0x3491('0x49')]('[decrementOriginate]\x20queue\x20originate\x20value\x20is\x20negative');}}exports[_0x3491('0x4a')]=decrementOriginate;function checkContactEmpty(_0x2a7500){return _0x2a7500&&_0x2a7500['length']>0x0;}exports[_0x3491('0x4b')]=checkContactEmpty;function erlangb(_0x476947,_0x5a5d3d){if(_0x5a5d3d===0x0){return 0x0;}var _0x3417ab=0x1;for(var _0x1e7067=0x1;_0x1e7067<=_0x5a5d3d;_0x1e7067+=0x1){_0x3417ab=0x1+_0x3417ab*_0x1e7067/_0x476947;}return 0x1/_0x3417ab;}exports[_0x3491('0x4c')]=erlangb;function checkContactLowerLimitOriginate(_0xbaf0a8,_0x1c252e,_0x2dc173){if(_0x1c252e>_0x2dc173){for(var _0x5b1585=0x0;_0x5b1585<_0x1c252e-_0x2dc173;_0x5b1585+=0x1){decrementOriginate(_0xbaf0a8);}}}exports[_0x3491('0x4d')]=checkContactLowerLimitOriginate;function setXMDContactVariables(_0x286521){var _0x2801cb={};var _0x9058b2=['id',_0x3491('0x4e'),'description',_0x3491('0x4f'),_0x3491('0x50')];if(_0x286521){for(var _0x27bcb0 in _0x286521){if(typeof _0x286521[_0x27bcb0]!==_0x3491('0x51')){if(!_[_0x3491('0x2c')](_0x286521[_0x27bcb0])&&!_0x9058b2[_0x3491('0x35')](_0x27bcb0)){_0x2801cb[util[_0x3491('0x43')](_0x3491('0x52'),'XMD-',_0x27bcb0[_0x3491('0x53')]())]=_0x286521[_0x27bcb0];}}}}return _0x2801cb;}exports[_0x3491('0x54')]=setXMDContactVariables; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index 4be41e1..9336ff7 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(_0x3ecde2,_0x54a16a){var _0x971e42=function(_0x5ed3f3){while(--_0x5ed3f3){_0x3ecde2['push'](_0x3ecde2['shift']());}};_0x971e42(++_0x54a16a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1b828b,_0x344400){_0x1b828b=_0x1b828b-0x0;var _0x98da1a=_0xa9e0[_0x1b828b];return _0x98da1a;};'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(_0x347d79,_0x2f36c0){var _0x1028d9=function(_0xf4eddd){while(--_0xf4eddd){_0x347d79['push'](_0x347d79['shift']());}};_0x1028d9(++_0x2f36c0);}(_0xa9e0,0x123));var _0x0a9e=function(_0x139a3c,_0x4fc883){_0x139a3c=_0x139a3c-0x0;var _0x2b375b=_0xa9e0[_0x139a3c];return _0x2b375b;};'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 3904190..ce9a60d 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 _0x7a35=['status','filename','\x20syncFaxStatus\x20','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','message','parse','application/pdf','then','notify','.pdf','catch','error','\x20notify\x20','stringify','\x20receiveFax\x20','actions','merge','pick','update','AttachmentId','SENDING\x20FAILED\x20','logger','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','updateStatus','[Fax][Message][Updated]','finally','[Fax][Message][NoUpdate2]','syncHangup','\x20hangup\x20faxRiceive\x20','SUCCESS','SENDING\x20FAILED:\x20','faxstatusstring','send','execOriginate','[Fax][execOriginate][success]','Fax\x20failed','checkAfterSend','checkTrunk','FaxAccountId','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','Action','variablesAction','addVariables','ext','isTrunkReachable','isNil','active','SIP/%s','reachable','unmonitored','\x20Trunk\x20is\x20not\x20active','[Fax][checkTrunk][Empty\x20Fax]','[Fax][checkTrunk][Empty\x20path]','Is\x20Valid','exports','util','uuid','moment','path','./util/gs','fax','../ami','./channel','./util/util','./action','../rpc/faxMessage','faxAccounts','trunks','newchannel','syncNewchannel','bind','syncVarSet','faxstatus','receivefax','hangup','originateresponse','syncOriginateResponse','prototype','context','from-voip-provider','hasOwnProperty','exten','localstationid','channels','uniqueid','channel','name','info','\x20syncNewchannel\x20','variable','value','channelstate','channelstatedesc','operation'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0x7a35,0x1d7));var _0x57a3=function(_0x435ce7,_0x5bf1ef){_0x435ce7=_0x435ce7-0x0;var _0x47edc0=_0x7a35[_0x435ce7];return _0x47edc0;};'use strict';var util=require(_0x57a3('0x0'));var _=require('lodash');var BPromise=require('bluebird');var uuid=require(_0x57a3('0x1'));var moment=require(_0x57a3('0x2'));var path=require(_0x57a3('0x3'));var tiff2pdf=require('tiff2pdf');var gs=require(_0x57a3('0x4'));var logger=require('../../../config/logger')(_0x57a3('0x5'));var ami=require(_0x57a3('0x6'));var rpcDb=require('./rpcDb');var Channel=require(_0x57a3('0x7'));var ut=require(_0x57a3('0x8'));var Action=require(_0x57a3('0x9'));var faxAccount=require('../rpc/faxAccount');var attachment=require('../rpc/attachment');var faxMessage=require(_0x57a3('0xa'));function Fax(_0x64059){this['channels']={};this[_0x57a3('0xb')]=_0x64059['faxAccounts'];this[_0x57a3('0xc')]=_0x64059[_0x57a3('0xc')];this['actions']={};ami['on'](_0x57a3('0xd'),this[_0x57a3('0xe')][_0x57a3('0xf')](this));ami['on']('varset',this[_0x57a3('0x10')][_0x57a3('0xf')](this));ami['on']('newstate',this['syncNewState']['bind'](this));ami['on']('newexten',this['syncNewExten'][_0x57a3('0xf')](this));ami['on'](_0x57a3('0x11'),this['syncFaxStatus'][_0x57a3('0xf')](this));ami['on'](_0x57a3('0x12'),this['syncReceiveFax'][_0x57a3('0xf')](this));ami['on'](_0x57a3('0x13'),this['syncHangup'][_0x57a3('0xf')](this));ami['on'](_0x57a3('0x14'),this[_0x57a3('0x15')][_0x57a3('0xf')](this));}Fax[_0x57a3('0x16')][_0x57a3('0xe')]=function(_0x3117c3){if(_0x3117c3[_0x57a3('0x17')]===_0x57a3('0x18')){for(var _0x3dc61d in this[_0x57a3('0xb')]){if(this[_0x57a3('0xb')][_0x57a3('0x19')](_0x3dc61d)){if(_0x3117c3[_0x57a3('0x1a')]===this[_0x57a3('0xb')][_0x3dc61d][_0x57a3('0x1b')]){this[_0x57a3('0x1c')][_0x3117c3[_0x57a3('0x1d')]]={};this[_0x57a3('0x1c')][_0x3117c3[_0x57a3('0x1d')]]['channel']=_0x3117c3[_0x57a3('0x1e')];this[_0x57a3('0x1c')][_0x3117c3['uniqueid']]['id']=this[_0x57a3('0xb')][_0x3dc61d]['id'];this[_0x57a3('0x1c')][_0x3117c3[_0x57a3('0x1d')]][_0x57a3('0x1f')]=this[_0x57a3('0xb')][_0x3dc61d][_0x57a3('0x1f')];logger[_0x57a3('0x20')](_0x3117c3[_0x57a3('0x1d')],_0x57a3('0x21'));}}}}if(this['actions'][_0x3117c3['uniqueid']]){this[_0x57a3('0x1c')][_0x3117c3[_0x57a3('0x1d')]]={};this[_0x57a3('0x1c')][_0x3117c3[_0x57a3('0x1d')]]['channel']=_0x3117c3[_0x57a3('0x1e')];logger[_0x57a3('0x20')](_0x3117c3[_0x57a3('0x1d')],'\x20syncNewchannel\x20');}};Fax[_0x57a3('0x16')]['syncVarSet']=function(_0x14f427){if(this['channels'][_0x14f427[_0x57a3('0x1d')]]){for(var _0x2a56a2 in _0x14f427[_0x57a3('0x22')]){if(_0x14f427['variable']['hasOwnProperty'](_0x2a56a2)){this[_0x57a3('0x1c')][_0x14f427[_0x57a3('0x1d')]][_0x2a56a2]=_0x14f427[_0x57a3('0x23')];}}}};Fax[_0x57a3('0x16')]['syncNewState']=function(_0x5cdace){if(this[_0x57a3('0x1c')][_0x5cdace[_0x57a3('0x1d')]]){this[_0x57a3('0x1c')][_0x5cdace['uniqueid']][_0x57a3('0x24')]=_0x5cdace[_0x57a3('0x24')];this[_0x57a3('0x1c')][_0x5cdace['uniqueid']][_0x57a3('0x25')]=_0x5cdace[_0x57a3('0x25')];}};Fax['prototype']['syncNewExten']=function(_0x3f70b8){if(this[_0x57a3('0x1c')][_0x3f70b8[_0x57a3('0x1d')]]){for(var _0x479cc0 in _0x3f70b8['variable']){if(_0x3f70b8['variable']['hasOwnProperty'](_0x479cc0)){this[_0x57a3('0x1c')][_0x3f70b8[_0x57a3('0x1d')]][_0x479cc0]=_0x3f70b8[_0x57a3('0x23')];}}}};Fax[_0x57a3('0x16')]['syncFaxStatus']=function(_0x55759d){if(this[_0x57a3('0x1c')][_0x55759d[_0x57a3('0x1d')]]){this[_0x57a3('0x1c')][_0x55759d[_0x57a3('0x1d')]][_0x57a3('0x26')]=_0x55759d['operation'];this[_0x57a3('0x1c')][_0x55759d['uniqueid']][_0x57a3('0x27')]=_0x55759d[_0x57a3('0x27')];this[_0x57a3('0x1c')][_0x55759d[_0x57a3('0x1d')]][_0x57a3('0x1b')]=_0x55759d[_0x57a3('0x1b')];this[_0x57a3('0x1c')][_0x55759d['uniqueid']][_0x57a3('0x28')]=_0x55759d[_0x57a3('0x28')];logger[_0x57a3('0x20')](_0x55759d['uniqueid'],_0x57a3('0x29'));}};Fax['prototype']['syncReceiveFax']=function(_0x295d4e){var _0x227fd9=this;if(this[_0x57a3('0x1c')][_0x295d4e[_0x57a3('0x1d')]]){var _0xc73a32=this[_0x57a3('0x1c')][_0x295d4e[_0x57a3('0x1d')]]['id'];this['channels'][_0x295d4e[_0x57a3('0x1d')]]['remotestationid']=_0x295d4e['remotestationid'];this[_0x57a3('0x1c')][_0x295d4e[_0x57a3('0x1d')]][_0x57a3('0x2a')]=_0x295d4e[_0x57a3('0x2a')];this[_0x57a3('0x1c')][_0x295d4e[_0x57a3('0x1d')]][_0x57a3('0x1b')]=_0x295d4e[_0x57a3('0x1b')];this[_0x57a3('0x1c')][_0x295d4e['uniqueid']]['resolution']=_0x295d4e[_0x57a3('0x2b')];this['channels'][_0x295d4e[_0x57a3('0x1d')]][_0x57a3('0x2c')]=_0x295d4e[_0x57a3('0x2c')];this['channels'][_0x295d4e[_0x57a3('0x1d')]][_0x57a3('0x28')]=_0x295d4e[_0x57a3('0x28')];this[_0x57a3('0x1c')][_0x295d4e['uniqueid']][_0x57a3('0x2d')]=_0x295d4e[_0x57a3('0x2d')];if(this[_0x57a3('0x1c')][_0x295d4e[_0x57a3('0x1d')]][_0x57a3('0x2a')]>0x0){tiff2pdf(_0x295d4e['filename'],_0x57a3('0x2e'),function(_0x2db266){logger[_0x57a3('0x20')](_0x295d4e[_0x57a3('0x1d')],_0x57a3('0x2f'),_0x2db266[_0x57a3('0x30')]);attachment['create']({'name':path['parse'](_0x295d4e[_0x57a3('0x28')])[_0x57a3('0x1f')],'basename':path[_0x57a3('0x31')](_0x295d4e[_0x57a3('0x28')])[_0x57a3('0x1f')]+'.pdf','type':_0x57a3('0x32')})[_0x57a3('0x33')](function(_0x4cf676){faxAccount[_0x57a3('0x34')](_0xc73a32,{'from':_0x295d4e[_0x57a3('0x2d')],'mapKey':_0x57a3('0x5'),'body':path[_0x57a3('0x31')](_0x295d4e[_0x57a3('0x28')])[_0x57a3('0x1f')]+_0x57a3('0x35'),'AttachmentId':_0x4cf676['id']})[_0x57a3('0x36')](function(_0x2432e4){logger[_0x57a3('0x37')](_0x295d4e['uniqueid'],_0x57a3('0x38'),JSON[_0x57a3('0x39')](_0x2432e4));});})['catch'](function(_0x4f1b93){logger[_0x57a3('0x37')](_0x295d4e[_0x57a3('0x1d')],'\x20receiveFax\x20',JSON[_0x57a3('0x39')](_0x4f1b93));});});}logger[_0x57a3('0x20')](_0x295d4e[_0x57a3('0x1d')],_0x57a3('0x3a'));}};Fax[_0x57a3('0x16')][_0x57a3('0x15')]=function(_0x164d51){if(this[_0x57a3('0x3b')][_0x164d51[_0x57a3('0x1d')]]){_[_0x57a3('0x3c')](this[_0x57a3('0x1c')][_0x164d51['uniqueid']],_[_0x57a3('0x3d')](_0x164d51,['response','reason']));}};function updateStatus(_0x1818fb){if(_0x1818fb['AttachmentId']){faxMessage[_0x57a3('0x3e')](_0x1818fb[_0x57a3('0x3f')],{'failMessage':_0x57a3('0x40')})['then'](function(_0x341427){ut[_0x57a3('0x41')]('[Fax][Message][Error][Updated]',_0x341427);})[_0x57a3('0x36')](function(_0x2ca175){ut['logger'](_0x57a3('0x42'),_0x2ca175);});}else{ut[_0x57a3('0x41')](_0x57a3('0x43'));}}Fax[_0x57a3('0x16')][_0x57a3('0x44')]=function(_0xbe4b43,_0x2ee2a5,_0x3a482b){var _0x35e2fd=this;var _0x29ddff={};if(_0x2ee2a5){_0x29ddff={'read':_0x2ee2a5};}else{_0x29ddff={'failMessage':_0x3a482b};}if(this[_0x57a3('0x3b')][_0xbe4b43][_0x57a3('0x3f')]){faxMessage[_0x57a3('0x3e')](this[_0x57a3('0x3b')][_0xbe4b43][_0x57a3('0x3f')],_0x29ddff)['then'](function(_0x120e42){ut[_0x57a3('0x41')](_0x57a3('0x45'),_0x120e42);})[_0x57a3('0x36')](function(_0x122008){ut[_0x57a3('0x41')]('[Fax][Message][NoUpdate1]',_0x122008);})[_0x57a3('0x46')](function(){delete _0x35e2fd[_0x57a3('0x1c')][_0xbe4b43];delete _0x35e2fd['actions'][_0xbe4b43];});}else{ut[_0x57a3('0x41')](_0x57a3('0x47'));delete this[_0x57a3('0x1c')][_0xbe4b43];delete this[_0x57a3('0x3b')][_0xbe4b43];}};Fax['prototype'][_0x57a3('0x48')]=function(_0x6fc4fb){var _0x3764c1=this;if(this[_0x57a3('0x1c')][_0x6fc4fb['uniqueid']]){if(this[_0x57a3('0x3b')][_0x6fc4fb[_0x57a3('0x1d')]]){this[_0x57a3('0x1c')][_0x6fc4fb['uniqueid']]['id']=this[_0x57a3('0x3b')][_0x6fc4fb['uniqueid']]['id'];this[_0x57a3('0x1c')][_0x6fc4fb[_0x57a3('0x1d')]][_0x57a3('0x1f')]=this['actions'][_0x6fc4fb['uniqueid']][_0x57a3('0x1f')];}logger['info'](_0x6fc4fb[_0x57a3('0x1d')],this[_0x57a3('0x3b')][_0x6fc4fb[_0x57a3('0x1d')]]?'\x20hangup\x20sendFile\x20':_0x57a3('0x49'),JSON[_0x57a3('0x39')](this[_0x57a3('0x1c')][_0x6fc4fb[_0x57a3('0x1d')]]));if(this['actions'][_0x6fc4fb[_0x57a3('0x1d')]]){if(this[_0x57a3('0x1c')][_0x6fc4fb[_0x57a3('0x1d')]]['faxpages']>0x0&&this['channels'][_0x6fc4fb[_0x57a3('0x1d')]][_0x57a3('0x11')]===_0x57a3('0x4a')){this[_0x57a3('0x44')](_0x6fc4fb[_0x57a3('0x1d')],!![]);}else{this['updateStatus'](_0x6fc4fb[_0x57a3('0x1d')],![],this[_0x57a3('0x1c')][_0x6fc4fb[_0x57a3('0x1d')]]['faxstatusstring']?_0x57a3('0x4b')+this[_0x57a3('0x1c')][_0x6fc4fb[_0x57a3('0x1d')]][_0x57a3('0x4c')]:'SENDING\x20FAILED');}}}};Fax[_0x57a3('0x16')][_0x57a3('0x4d')]=function(_0x481105){var _0x3bcc72=this;return new BPromise(function(_0x40bd7d,_0x168bd3){_0x3bcc72[_0x57a3('0x4e')](_0x481105,_0x3bcc72['faxAccounts'][_0x481105['FaxAccountId']])[_0x57a3('0x33')](function(_0x7ec7bf){ut[_0x57a3('0x41')](_0x57a3('0x4f'),_0x7ec7bf);_0x40bd7d(ut['message']('Fax\x20received'));})[_0x57a3('0x36')](function(_0x1f1af9){ut['logger']('[Fax][execOriginate][failure]',_0x1f1af9);updateStatus(_0x481105);_0x168bd3(ut[_0x57a3('0x30')](_0x57a3('0x50')));});});};Fax['prototype'][_0x57a3('0x51')]=function(_0x20da92){var _0x57cbe3=this;return new BPromise(function(_0x55aed5,_0x251ad1){var _0x381f92=_0x57cbe3[_0x57a3('0x52')](_0x57cbe3['faxAccounts'][_0x20da92[_0x57a3('0x53')]]['Trunk'],_0x20da92);if(_0x381f92['isValid']){_0x55aed5(ut['message']('Trunk\x20Reachable'));}else{_0x251ad1(ut[_0x57a3('0x30')](_0x381f92[_0x57a3('0x30')]));}});};function originate(_0x47336e,_0x181444,_0x2ee3d1){return new BPromise(function(_0x1c0a6f,_0xe6565a){if(_0x2ee3d1){var _0x59d945=util[_0x57a3('0x54')](_0x57a3('0x55'),path['parse'](_0x47336e[_0x57a3('0x3')])[_0x57a3('0x1f')],_0x47336e[_0x57a3('0x3')]);gs['execute'](_0x59d945)['then'](function(){_0x47336e[_0x57a3('0x3')]=util[_0x57a3('0x54')](_0x57a3('0x56'),path[_0x57a3('0x31')](_0x47336e[_0x57a3('0x3')])['dir'],path[_0x57a3('0x31')](_0x47336e[_0x57a3('0x3')])[_0x57a3('0x1f')]);_0x181444['XMF-PATH']=_0x47336e[_0x57a3('0x3')];ut[_0x57a3('0x41')]('Convert\x20pdf\x20to\x20tif','');ami[_0x57a3('0x57')](ut[_0x57a3('0x58')](_0x47336e,_0x181444))[_0x57a3('0x33')](function(_0x50446c){_0x1c0a6f(_0x50446c);})[_0x57a3('0x36')](function(_0x4e022e){_0xe6565a(_0x4e022e);});})[_0x57a3('0x36')](function(_0x22adf3){_0xe6565a(_0x22adf3);});}else{ami[_0x57a3('0x57')](ut[_0x57a3('0x58')](_0x47336e,_0x181444))[_0x57a3('0x33')](function(_0x5ee33e){_0x1c0a6f(_0x5ee33e);})[_0x57a3('0x36')](function(_0x5b9792){_0xe6565a(_0x5b9792);});}});}Fax[_0x57a3('0x16')][_0x57a3('0x4e')]=function(_0xfd5d5,_0x483e6f){var _0x1d671f=this;return new BPromise(function(_0x440aca,_0x455e88){var _0xfe4381=uuid['v4']();var _0x20abb6=ut[_0x57a3('0x59')](_0xfd5d5,_0x483e6f);_0x1d671f['actions'][_0xfe4381]=new Action(_0xfe4381,_0x483e6f,_0xfd5d5);var _0x22aa7d=_0x1d671f[_0x57a3('0x3b')][_0xfe4381];if(path[_0x57a3('0x31')](_0xfd5d5['path'])[_0x57a3('0x5a')]===_0x57a3('0x35')){originate(_0x22aa7d,_0x20abb6,!![])[_0x57a3('0x33')](function(_0x10ffa8){_0x440aca(_0x10ffa8);})[_0x57a3('0x36')](function(_0x15393b){_0x455e88(_0x15393b);});}else{originate(_0x22aa7d,_0x20abb6,![])['then'](function(_0x1da862){_0x440aca(_0x1da862);})[_0x57a3('0x36')](function(_0x905ed1){_0x455e88(_0x905ed1);});}});};Fax[_0x57a3('0x16')][_0x57a3('0x5b')]=function(_0x29488d){return!_[_0x57a3('0x5c')](_0x29488d)&&!_[_0x57a3('0x5c')](_0x29488d[_0x57a3('0x1f')])&&!_[_0x57a3('0x5c')](_0x29488d[_0x57a3('0x5d')])&&_0x29488d['active']&&!_[_0x57a3('0x5c')](this[_0x57a3('0xc')][util[_0x57a3('0x54')](_0x57a3('0x5e'),_0x29488d[_0x57a3('0x1f')])])&&!_[_0x57a3('0x5c')](this[_0x57a3('0xc')][util['format'](_0x57a3('0x5e'),_0x29488d[_0x57a3('0x1f')])][_0x57a3('0x27')])&&(this['trunks'][util[_0x57a3('0x54')]('SIP/%s',_0x29488d[_0x57a3('0x1f')])][_0x57a3('0x27')]===_0x57a3('0x5f')||this[_0x57a3('0xc')][util[_0x57a3('0x54')]('SIP/%s',_0x29488d[_0x57a3('0x1f')])][_0x57a3('0x27')]===_0x57a3('0x60'));};Fax['prototype'][_0x57a3('0x52')]=function(_0x3e9b84,_0x11597e){if(!this[_0x57a3('0x5b')](_0x3e9b84)){ut[_0x57a3('0x41')]('[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]',_[_0x57a3('0x5c')](_0x3e9b84)?'':_0x3e9b84[_0x57a3('0x1f')]+_0x57a3('0x61'));return{'isValid':![],'message':'Trunk\x20not\x20working\x20correctly'};}if(_[_0x57a3('0x5c')](_0x11597e['fax'])){ut[_0x57a3('0x41')](_0x57a3('0x62'),JSON[_0x57a3('0x39')](_0x11597e));return{'isValid':![],'message':'Empty\x20Fax'};}if(_[_0x57a3('0x5c')](_0x11597e[_0x57a3('0x3')])){ut[_0x57a3('0x41')](_0x57a3('0x63'),JSON[_0x57a3('0x39')](_0x11597e));return{'isValid':![],'message':'Empty\x20path'};}return{'isValid':!![],'message':_0x57a3('0x64')};};module[_0x57a3('0x65')]=Fax; \ No newline at end of file +var _0x8529=['[Fax][checkTrunk][Empty\x20path]','Is\x20Valid','exports','bluebird','uuid','moment','./util/gs','../../../config/logger','fax','../ami','./rpcDb','./channel','../rpc/faxAccount','../rpc/attachment','channels','faxAccounts','trunks','newchannel','bind','varset','syncVarSet','syncNewState','syncNewExten','faxstatus','syncFaxStatus','receivefax','hangup','syncHangup','originateresponse','syncOriginateResponse','prototype','syncNewchannel','context','hasOwnProperty','exten','uniqueid','channel','name','info','\x20syncNewchannel\x20','actions','variable','channelstate','channelstatedesc','value','operation','status','localstationid','filename','\x20syncFaxStatus\x20','syncReceiveFax','remotestationid','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','message','parse','application/pdf','then','notify','error','\x20notify\x20','stringify','catch','\x20receiveFax\x20','merge','response','reason','AttachmentId','logger','[Fax][Message][Error][Updated]','updateStatus','update','[Fax][Message][Updated]','\x20hangup\x20sendFile\x20','SUCCESS','faxstatusstring','SENDING\x20FAILED','send','execOriginate','FaxAccountId','[Fax][execOriginate][success]','Fax\x20received','checkAfterSend','checkTrunk','Trunk','isValid','Trunk\x20Reachable','format','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','path','execute','%s/%s.tif','dir','XMF-PATH','Action','variablesAction','ext','.pdf','isTrunkReachable','isNil','active','SIP/%s','reachable','unmonitored','[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','Empty\x20Fax'];(function(_0x53c681,_0x1ebf78){var _0x462181=function(_0x4e9a9a){while(--_0x4e9a9a){_0x53c681['push'](_0x53c681['shift']());}};_0x462181(++_0x1ebf78);}(_0x8529,0x73));var _0x9852=function(_0x198390,_0x407c9c){_0x198390=_0x198390-0x0;var _0x8079a9=_0x8529[_0x198390];return _0x8079a9;};'use strict';var util=require('util');var _=require('lodash');var BPromise=require(_0x9852('0x0'));var uuid=require(_0x9852('0x1'));var moment=require(_0x9852('0x2'));var path=require('path');var tiff2pdf=require('tiff2pdf');var gs=require(_0x9852('0x3'));var logger=require(_0x9852('0x4'))(_0x9852('0x5'));var ami=require(_0x9852('0x6'));var rpcDb=require(_0x9852('0x7'));var Channel=require(_0x9852('0x8'));var ut=require('./util/util');var Action=require('./action');var faxAccount=require(_0x9852('0x9'));var attachment=require(_0x9852('0xa'));var faxMessage=require('../rpc/faxMessage');function Fax(_0x5d0fce){this[_0x9852('0xb')]={};this[_0x9852('0xc')]=_0x5d0fce['faxAccounts'];this[_0x9852('0xd')]=_0x5d0fce[_0x9852('0xd')];this['actions']={};ami['on'](_0x9852('0xe'),this['syncNewchannel'][_0x9852('0xf')](this));ami['on'](_0x9852('0x10'),this[_0x9852('0x11')][_0x9852('0xf')](this));ami['on']('newstate',this[_0x9852('0x12')][_0x9852('0xf')](this));ami['on']('newexten',this[_0x9852('0x13')][_0x9852('0xf')](this));ami['on'](_0x9852('0x14'),this[_0x9852('0x15')][_0x9852('0xf')](this));ami['on'](_0x9852('0x16'),this['syncReceiveFax'][_0x9852('0xf')](this));ami['on'](_0x9852('0x17'),this[_0x9852('0x18')]['bind'](this));ami['on'](_0x9852('0x19'),this[_0x9852('0x1a')][_0x9852('0xf')](this));}Fax[_0x9852('0x1b')][_0x9852('0x1c')]=function(_0x1ab705){if(_0x1ab705[_0x9852('0x1d')]==='from-voip-provider'){for(var _0x31d989 in this['faxAccounts']){if(this[_0x9852('0xc')][_0x9852('0x1e')](_0x31d989)){if(_0x1ab705[_0x9852('0x1f')]===this[_0x9852('0xc')][_0x31d989]['localstationid']){this[_0x9852('0xb')][_0x1ab705[_0x9852('0x20')]]={};this[_0x9852('0xb')][_0x1ab705[_0x9852('0x20')]][_0x9852('0x21')]=_0x1ab705[_0x9852('0x21')];this['channels'][_0x1ab705[_0x9852('0x20')]]['id']=this[_0x9852('0xc')][_0x31d989]['id'];this['channels'][_0x1ab705[_0x9852('0x20')]]['name']=this['faxAccounts'][_0x31d989][_0x9852('0x22')];logger[_0x9852('0x23')](_0x1ab705[_0x9852('0x20')],_0x9852('0x24'));}}}}if(this[_0x9852('0x25')][_0x1ab705[_0x9852('0x20')]]){this[_0x9852('0xb')][_0x1ab705[_0x9852('0x20')]]={};this[_0x9852('0xb')][_0x1ab705[_0x9852('0x20')]][_0x9852('0x21')]=_0x1ab705['channel'];logger['info'](_0x1ab705[_0x9852('0x20')],_0x9852('0x24'));}};Fax['prototype'][_0x9852('0x11')]=function(_0x59f2d3){if(this[_0x9852('0xb')][_0x59f2d3[_0x9852('0x20')]]){for(var _0x33775e in _0x59f2d3[_0x9852('0x26')]){if(_0x59f2d3[_0x9852('0x26')][_0x9852('0x1e')](_0x33775e)){this[_0x9852('0xb')][_0x59f2d3[_0x9852('0x20')]][_0x33775e]=_0x59f2d3['value'];}}}};Fax[_0x9852('0x1b')]['syncNewState']=function(_0x460205){if(this[_0x9852('0xb')][_0x460205[_0x9852('0x20')]]){this['channels'][_0x460205[_0x9852('0x20')]][_0x9852('0x27')]=_0x460205['channelstate'];this[_0x9852('0xb')][_0x460205[_0x9852('0x20')]][_0x9852('0x28')]=_0x460205['channelstatedesc'];}};Fax[_0x9852('0x1b')][_0x9852('0x13')]=function(_0x12b72d){if(this['channels'][_0x12b72d[_0x9852('0x20')]]){for(var _0x4edbd0 in _0x12b72d['variable']){if(_0x12b72d[_0x9852('0x26')]['hasOwnProperty'](_0x4edbd0)){this[_0x9852('0xb')][_0x12b72d[_0x9852('0x20')]][_0x4edbd0]=_0x12b72d[_0x9852('0x29')];}}}};Fax[_0x9852('0x1b')][_0x9852('0x15')]=function(_0x17c413){if(this[_0x9852('0xb')][_0x17c413[_0x9852('0x20')]]){this[_0x9852('0xb')][_0x17c413[_0x9852('0x20')]][_0x9852('0x2a')]=_0x17c413[_0x9852('0x2a')];this[_0x9852('0xb')][_0x17c413['uniqueid']][_0x9852('0x2b')]=_0x17c413[_0x9852('0x2b')];this[_0x9852('0xb')][_0x17c413[_0x9852('0x20')]][_0x9852('0x2c')]=_0x17c413['localstationid'];this[_0x9852('0xb')][_0x17c413['uniqueid']][_0x9852('0x2d')]=_0x17c413[_0x9852('0x2d')];logger[_0x9852('0x23')](_0x17c413['uniqueid'],_0x9852('0x2e'));}};Fax['prototype'][_0x9852('0x2f')]=function(_0x1218d1){var _0x267a10=this;if(this['channels'][_0x1218d1[_0x9852('0x20')]]){var _0x8c0516=this[_0x9852('0xb')][_0x1218d1['uniqueid']]['id'];this[_0x9852('0xb')][_0x1218d1[_0x9852('0x20')]][_0x9852('0x30')]=_0x1218d1[_0x9852('0x30')];this['channels'][_0x1218d1[_0x9852('0x20')]]['pagestransferred']=_0x1218d1[_0x9852('0x31')];this[_0x9852('0xb')][_0x1218d1[_0x9852('0x20')]][_0x9852('0x2c')]=_0x1218d1[_0x9852('0x2c')];this[_0x9852('0xb')][_0x1218d1[_0x9852('0x20')]][_0x9852('0x32')]=_0x1218d1[_0x9852('0x32')];this[_0x9852('0xb')][_0x1218d1[_0x9852('0x20')]][_0x9852('0x33')]=_0x1218d1[_0x9852('0x33')];this['channels'][_0x1218d1[_0x9852('0x20')]][_0x9852('0x2d')]=_0x1218d1['filename'];this[_0x9852('0xb')][_0x1218d1[_0x9852('0x20')]][_0x9852('0x34')]=_0x1218d1['calleridnum'];if(this[_0x9852('0xb')][_0x1218d1['uniqueid']][_0x9852('0x31')]>0x0){tiff2pdf(_0x1218d1[_0x9852('0x2d')],_0x9852('0x35'),function(_0x51b019){logger[_0x9852('0x23')](_0x1218d1['uniqueid'],_0x9852('0x36'),_0x51b019[_0x9852('0x37')]);attachment['create']({'name':path[_0x9852('0x38')](_0x1218d1[_0x9852('0x2d')])[_0x9852('0x22')],'basename':path['parse'](_0x1218d1[_0x9852('0x2d')])[_0x9852('0x22')]+'.pdf','type':_0x9852('0x39')})[_0x9852('0x3a')](function(_0x1c5add){faxAccount[_0x9852('0x3b')](_0x8c0516,{'from':_0x1218d1[_0x9852('0x34')],'mapKey':_0x9852('0x5'),'body':path['parse'](_0x1218d1['filename'])[_0x9852('0x22')]+'.pdf','AttachmentId':_0x1c5add['id']})['catch'](function(_0x2d9df5){logger[_0x9852('0x3c')](_0x1218d1[_0x9852('0x20')],_0x9852('0x3d'),JSON[_0x9852('0x3e')](_0x2d9df5));});})[_0x9852('0x3f')](function(_0x57fb15){logger['error'](_0x1218d1[_0x9852('0x20')],_0x9852('0x40'),JSON[_0x9852('0x3e')](_0x57fb15));});});}logger[_0x9852('0x23')](_0x1218d1['uniqueid'],_0x9852('0x40'));}};Fax[_0x9852('0x1b')][_0x9852('0x1a')]=function(_0x599529){if(this['actions'][_0x599529['uniqueid']]){_[_0x9852('0x41')](this['channels'][_0x599529[_0x9852('0x20')]],_['pick'](_0x599529,[_0x9852('0x42'),_0x9852('0x43')]));}};function updateStatus(_0x3500c6){if(_0x3500c6[_0x9852('0x44')]){faxMessage['update'](_0x3500c6['AttachmentId'],{'failMessage':'SENDING\x20FAILED\x20'})[_0x9852('0x3a')](function(_0x266788){ut[_0x9852('0x45')](_0x9852('0x46'),_0x266788);})[_0x9852('0x3f')](function(_0x213885){ut['logger']('[Fax][Message][Error][NoUpdate1]',_0x213885);});}else{ut[_0x9852('0x45')]('[Fax][Message][Error][NoUpdate2]');}}Fax[_0x9852('0x1b')][_0x9852('0x47')]=function(_0x155b64,_0x4706a5,_0x18f431){var _0x1a74b0=this;var _0xd150f2={};if(_0x4706a5){_0xd150f2={'read':_0x4706a5};}else{_0xd150f2={'failMessage':_0x18f431};}if(this['actions'][_0x155b64][_0x9852('0x44')]){faxMessage[_0x9852('0x48')](this[_0x9852('0x25')][_0x155b64]['AttachmentId'],_0xd150f2)[_0x9852('0x3a')](function(_0x23af25){ut[_0x9852('0x45')](_0x9852('0x49'),_0x23af25);})['catch'](function(_0x5bae8c){ut['logger']('[Fax][Message][NoUpdate1]',_0x5bae8c);})['finally'](function(){delete _0x1a74b0['channels'][_0x155b64];delete _0x1a74b0[_0x9852('0x25')][_0x155b64];});}else{ut['logger']('[Fax][Message][NoUpdate2]');delete this[_0x9852('0xb')][_0x155b64];delete this[_0x9852('0x25')][_0x155b64];}};Fax[_0x9852('0x1b')]['syncHangup']=function(_0x3cab36){var _0x272d34=this;if(this[_0x9852('0xb')][_0x3cab36[_0x9852('0x20')]]){if(this['actions'][_0x3cab36[_0x9852('0x20')]]){this[_0x9852('0xb')][_0x3cab36[_0x9852('0x20')]]['id']=this[_0x9852('0x25')][_0x3cab36[_0x9852('0x20')]]['id'];this[_0x9852('0xb')][_0x3cab36[_0x9852('0x20')]][_0x9852('0x22')]=this[_0x9852('0x25')][_0x3cab36[_0x9852('0x20')]]['name'];}logger[_0x9852('0x23')](_0x3cab36['uniqueid'],this[_0x9852('0x25')][_0x3cab36[_0x9852('0x20')]]?_0x9852('0x4a'):'\x20hangup\x20faxRiceive\x20',JSON[_0x9852('0x3e')](this['channels'][_0x3cab36[_0x9852('0x20')]]));if(this[_0x9852('0x25')][_0x3cab36[_0x9852('0x20')]]){if(this[_0x9852('0xb')][_0x3cab36[_0x9852('0x20')]]['faxpages']>0x0&&this['channels'][_0x3cab36[_0x9852('0x20')]][_0x9852('0x14')]===_0x9852('0x4b')){this['updateStatus'](_0x3cab36[_0x9852('0x20')],!![]);}else{this[_0x9852('0x47')](_0x3cab36[_0x9852('0x20')],![],this[_0x9852('0xb')][_0x3cab36[_0x9852('0x20')]]['faxstatusstring']?'SENDING\x20FAILED:\x20'+this['channels'][_0x3cab36[_0x9852('0x20')]][_0x9852('0x4c')]:_0x9852('0x4d'));}}}};Fax[_0x9852('0x1b')][_0x9852('0x4e')]=function(_0x16e3f1){var _0x4b71a2=this;return new BPromise(function(_0x441eb6,_0x34e225){_0x4b71a2[_0x9852('0x4f')](_0x16e3f1,_0x4b71a2['faxAccounts'][_0x16e3f1[_0x9852('0x50')]])[_0x9852('0x3a')](function(_0xae3353){ut[_0x9852('0x45')](_0x9852('0x51'),_0xae3353);_0x441eb6(ut[_0x9852('0x37')](_0x9852('0x52')));})[_0x9852('0x3f')](function(_0x5c7f3d){ut[_0x9852('0x45')]('[Fax][execOriginate][failure]',_0x5c7f3d);updateStatus(_0x16e3f1);_0x34e225(ut[_0x9852('0x37')]('Fax\x20failed'));});});};Fax['prototype'][_0x9852('0x53')]=function(_0xb46d3e){var _0x205074=this;return new BPromise(function(_0x39201c,_0x47f68a){var _0x5016af=_0x205074[_0x9852('0x54')](_0x205074[_0x9852('0xc')][_0xb46d3e[_0x9852('0x50')]][_0x9852('0x55')],_0xb46d3e);if(_0x5016af[_0x9852('0x56')]){_0x39201c(ut[_0x9852('0x37')](_0x9852('0x57')));}else{_0x47f68a(ut[_0x9852('0x37')](_0x5016af['message']));}});};function originate(_0x267be5,_0x21a33b,_0x5498bf){return new BPromise(function(_0x5cfd52,_0x37292f){if(_0x5498bf){var _0x22e356=util[_0x9852('0x58')](_0x9852('0x59'),path[_0x9852('0x38')](_0x267be5[_0x9852('0x5a')])['name'],_0x267be5[_0x9852('0x5a')]);gs[_0x9852('0x5b')](_0x22e356)['then'](function(){_0x267be5[_0x9852('0x5a')]=util[_0x9852('0x58')](_0x9852('0x5c'),path[_0x9852('0x38')](_0x267be5['path'])[_0x9852('0x5d')],path['parse'](_0x267be5[_0x9852('0x5a')])[_0x9852('0x22')]);_0x21a33b[_0x9852('0x5e')]=_0x267be5[_0x9852('0x5a')];ut[_0x9852('0x45')]('Convert\x20pdf\x20to\x20tif','');ami[_0x9852('0x5f')](ut[_0x9852('0x60')](_0x267be5,_0x21a33b))['then'](function(_0x1066e2){_0x5cfd52(_0x1066e2);})[_0x9852('0x3f')](function(_0x3323e9){_0x37292f(_0x3323e9);});})[_0x9852('0x3f')](function(_0xea978){_0x37292f(_0xea978);});}else{ami[_0x9852('0x5f')](ut[_0x9852('0x60')](_0x267be5,_0x21a33b))[_0x9852('0x3a')](function(_0x5d862a){_0x5cfd52(_0x5d862a);})[_0x9852('0x3f')](function(_0x3d7eaf){_0x37292f(_0x3d7eaf);});}});}Fax[_0x9852('0x1b')][_0x9852('0x4f')]=function(_0x21d870,_0x5450b7){var _0x2344c2=this;return new BPromise(function(_0x458be2,_0x51bc77){var _0x13e103=uuid['v4']();var _0xd88523=ut['addVariables'](_0x21d870,_0x5450b7);_0x2344c2['actions'][_0x13e103]=new Action(_0x13e103,_0x5450b7,_0x21d870);var _0x50a4a2=_0x2344c2[_0x9852('0x25')][_0x13e103];if(path['parse'](_0x21d870['path'])[_0x9852('0x61')]===_0x9852('0x62')){originate(_0x50a4a2,_0xd88523,!![])[_0x9852('0x3a')](function(_0x2284ff){_0x458be2(_0x2284ff);})[_0x9852('0x3f')](function(_0x3e0456){_0x51bc77(_0x3e0456);});}else{originate(_0x50a4a2,_0xd88523,![])[_0x9852('0x3a')](function(_0x30283d){_0x458be2(_0x30283d);})['catch'](function(_0x56732a){_0x51bc77(_0x56732a);});}});};Fax['prototype'][_0x9852('0x63')]=function(_0x572999){return!_['isNil'](_0x572999)&&!_['isNil'](_0x572999[_0x9852('0x22')])&&!_[_0x9852('0x64')](_0x572999[_0x9852('0x65')])&&_0x572999[_0x9852('0x65')]&&!_['isNil'](this[_0x9852('0xd')][util[_0x9852('0x58')](_0x9852('0x66'),_0x572999[_0x9852('0x22')])])&&!_[_0x9852('0x64')](this[_0x9852('0xd')][util['format'](_0x9852('0x66'),_0x572999['name'])][_0x9852('0x2b')])&&(this['trunks'][util[_0x9852('0x58')]('SIP/%s',_0x572999[_0x9852('0x22')])][_0x9852('0x2b')]===_0x9852('0x67')||this[_0x9852('0xd')][util[_0x9852('0x58')](_0x9852('0x66'),_0x572999[_0x9852('0x22')])][_0x9852('0x2b')]===_0x9852('0x68'));};Fax[_0x9852('0x1b')][_0x9852('0x54')]=function(_0x49068c,_0x95f763){if(!this[_0x9852('0x63')](_0x49068c)){ut[_0x9852('0x45')](_0x9852('0x69'),_[_0x9852('0x64')](_0x49068c)?'':_0x49068c[_0x9852('0x22')]+_0x9852('0x6a'));return{'isValid':![],'message':_0x9852('0x6b')};}if(_[_0x9852('0x64')](_0x95f763[_0x9852('0x5')])){ut['logger']('[Fax][checkTrunk][Empty\x20Fax]',JSON[_0x9852('0x3e')](_0x95f763));return{'isValid':![],'message':_0x9852('0x6c')};}if(_[_0x9852('0x64')](_0x95f763[_0x9852('0x5a')])){ut[_0x9852('0x45')](_0x9852('0x6d'),JSON[_0x9852('0x3e')](_0x95f763));return{'isValid':![],'message':'Empty\x20path'};}return{'isValid':!![],'message':_0x9852('0x6e')};};module[_0x9852('0x6f')]=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index dbba089..57a6a12 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 _0x25c5=['inspect','notify','then','catch','[Notify]\x20','util','../../../config/logger','preview','lodash','error'];(function(_0x3b3077,_0x306f5d){var _0x35df63=function(_0x30a5e0){while(--_0x30a5e0){_0x3b3077['push'](_0x3b3077['shift']());}};_0x35df63(++_0x306f5d);}(_0x25c5,0x127));var _0x525c=function(_0x5c4e16,_0x113035){_0x5c4e16=_0x5c4e16-0x0;var _0x36044a=_0x25c5[_0x5c4e16];return _0x36044a;};'use strict';var util=require(_0x525c('0x0'));var BPromise=require('bluebird');var logger=require(_0x525c('0x1'))(_0x525c('0x2'));var _=require(_0x525c('0x3'));var faxAccount=require('../rpc/faxAccount');function loggerCatch(_0x9529da){return function(_0x35d36b){logger[_0x525c('0x4')](_0x9529da,util[_0x525c('0x5')](_0x35d36b,{'showHidden':![],'depth':null}));};}exports[_0x525c('0x6')]=function(_0x1ef7b0,_0xf0cf42){return BPromise['resolve']()[_0x525c('0x7')](faxAccount[_0x525c('0x6')](_0x1ef7b0,_0xf0cf42))[_0x525c('0x8')](loggerCatch(_0x525c('0x9')));}; \ No newline at end of file +var _0x2c6d=['../../../config/logger','preview','../rpc/faxAccount','error','notify','resolve','catch','[Notify]\x20','util','bluebird'];(function(_0x1103d1,_0x2dbdba){var _0xbc0ce9=function(_0xa02d85){while(--_0xa02d85){_0x1103d1['push'](_0x1103d1['shift']());}};_0xbc0ce9(++_0x2dbdba);}(_0x2c6d,0x1b6));var _0xd2c6=function(_0x189564,_0x419229){_0x189564=_0x189564-0x0;var _0x531d23=_0x2c6d[_0x189564];return _0x531d23;};'use strict';var util=require(_0xd2c6('0x0'));var BPromise=require(_0xd2c6('0x1'));var logger=require(_0xd2c6('0x2'))(_0xd2c6('0x3'));var _=require('lodash');var faxAccount=require(_0xd2c6('0x4'));function loggerCatch(_0x5656b0){return function(_0x5df16b){logger[_0xd2c6('0x5')](_0x5656b0,util['inspect'](_0x5df16b,{'showHidden':![],'depth':null}));};}exports[_0xd2c6('0x6')]=function(_0x3458e4,_0x1b25b3){return BPromise[_0xd2c6('0x7')]()['then'](faxAccount[_0xd2c6('0x6')](_0x3458e4,_0x1b25b3))[_0xd2c6('0x8')](loggerCatch(_0xd2c6('0x9')));}; \ No newline at end of file diff --git a/server/services/ami/fax/util/gs.js b/server/services/ami/fax/util/gs.js index d5b969c..0799f40 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 _0xc507=['fax','execute','info','Exec\x20gs','\x20Error\x20:','util'];(function(_0x388a9e,_0x318bec){var _0x14c623=function(_0xd3ecf0){while(--_0xd3ecf0){_0x388a9e['push'](_0x388a9e['shift']());}};_0x14c623(++_0x318bec);}(_0xc507,0x17f));var _0x7c50=function(_0x31dde9,_0x12e816){_0x31dde9=_0x31dde9-0x0;var _0x1fbf2d=_0xc507[_0x31dde9];return _0x1fbf2d;};'use strict';var util=require(_0x7c50('0x0'));var logger=require('../../../../config/logger')(_0x7c50('0x1'));var BPromise=require('bluebird');var exec=require('child_process')['exec'];exports[_0x7c50('0x2')]=function(_0x34240e){return new BPromise(function(_0x2fadfa,_0x1e0f76){exec(_0x34240e,function(_0x2f0dcf,_0xbe618a,_0x17a920){logger[_0x7c50('0x3')](_0x7c50('0x4'),_0xbe618a);if(_0x2f0dcf){logger[_0x7c50('0x3')](_0x7c50('0x4'),_0x7c50('0x5'),util['inspect'](_0x2f0dcf,{'showHidden':![],'depth':null}),_0xbe618a,_0x17a920);_0x1e0f76(_0x2f0dcf);}_0x2fadfa(_0xbe618a);});});}; \ No newline at end of file +var _0x38d5=['info','Exec\x20gs','\x20Error\x20:','inspect','util','../../../../config/logger','fax','bluebird','child_process','execute'];(function(_0x4d6ac0,_0x201628){var _0x5296c4=function(_0x3d0b3d){while(--_0x3d0b3d){_0x4d6ac0['push'](_0x4d6ac0['shift']());}};_0x5296c4(++_0x201628);}(_0x38d5,0x1b2));var _0x538d=function(_0x36c67b,_0x53e7ac){_0x36c67b=_0x36c67b-0x0;var _0x81eef2=_0x38d5[_0x36c67b];return _0x81eef2;};'use strict';var util=require(_0x538d('0x0'));var logger=require(_0x538d('0x1'))(_0x538d('0x2'));var BPromise=require(_0x538d('0x3'));var exec=require(_0x538d('0x4'))['exec'];exports[_0x538d('0x5')]=function(_0x3b9e46){return new BPromise(function(_0x4370b4,_0x2ebf44){exec(_0x3b9e46,function(_0x42f347,_0x4a3e6e,_0x3aaf20){logger[_0x538d('0x6')]('Exec\x20gs',_0x4a3e6e);if(_0x42f347){logger[_0x538d('0x6')](_0x538d('0x7'),_0x538d('0x8'),util[_0x538d('0x9')](_0x42f347,{'showHidden':![],'depth':null}),_0x4a3e6e,_0x3aaf20);_0x2ebf44(_0x42f347);}_0x4370b4(_0x4a3e6e);});});}; \ 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 9e43ad4..f91f3e8 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 _0x37bb=['gateway','faxdetect','t38timeout','localstationid','path','variablesAction','uniqueid','originate','channel','xcally-motion-fax','\x22%s\x22\x20<%s>','util','lodash','logger','info','inspect','addVariables','ecm','headerinfo','format','\x22%s\x22','modem'];(function(_0x46b442,_0x3f31bf){var _0x250194=function(_0x5d5a2b){while(--_0x5d5a2b){_0x46b442['push'](_0x46b442['shift']());}};_0x250194(++_0x3f31bf);}(_0x37bb,0x1c3));var _0xb37b=function(_0x22e825,_0x41b89e){_0x22e825=_0x22e825-0x0;var _0x23cb70=_0x37bb[_0x22e825];return _0x23cb70;};'use strict';var util=require(_0xb37b('0x0'));var _=require(_0xb37b('0x1'));var moment=require('moment');var logger=require('../../../../config/logger')('fax');exports['message']=function(_0x4be54b){return{'message':_0x4be54b};};exports[_0xb37b('0x2')]=function(_0x363e23,_0x15ce7d){logger[_0xb37b('0x3')](_0x363e23,util[_0xb37b('0x4')](_0x15ce7d,{'showHidden':![],'depth':null}));};exports[_0xb37b('0x5')]=function(_0x651172,_0x5dff44){var _0x2ad607={'XMF-ECM':_0x5dff44[_0xb37b('0x6')],'XMF-HEADERINFO':_0x5dff44[_0xb37b('0x7')],'XMF-MINRATE':_0x5dff44['minrate'],'XMF-MAXRATE':_0x5dff44['maxrate'],'XMF-MODEM':util[_0xb37b('0x8')](_0xb37b('0x9'),_0x5dff44[_0xb37b('0xa')]),'XMF-GATEWAY':_0x5dff44[_0xb37b('0xb')],'XMF-FAXDETECT':_0x5dff44[_0xb37b('0xc')],'XMF-T38TIMEOUT':_0x5dff44[_0xb37b('0xd')],'XMF-LOCALSTATIONID':_0x5dff44[_0xb37b('0xe')],'XMF-PATH':_0x651172[_0xb37b('0xf')]};return _0x2ad607;};exports[_0xb37b('0x10')]=function(_0x1a9053,_0xf1c3f4){return{'actionid':_0x1a9053[_0xb37b('0x11')],'action':_0xb37b('0x12'),'channel':_0x1a9053[_0xb37b('0x13')],'Exten':_0xb37b('0x14'),'Context':'from-sip','Priority':'1','callerid':util[_0xb37b('0x8')](_0xb37b('0x15'),_0x1a9053[_0xb37b('0x7')]?_0x1a9053[_0xb37b('0x7')]:'',_0x1a9053[_0xb37b('0xe')]),'variable':_0xf1c3f4,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x1a9053['uniqueid']};}; \ No newline at end of file +var _0xd557=['moment','../../../../config/logger','fax','message','logger','info','inspect','minrate','maxrate','\x22%s\x22','modem','gateway','faxdetect','localstationid','path','variablesAction','uniqueid','originate','channel','xcally-motion-fax','from-sip','\x22%s\x22\x20<%s>','headerinfo','util','lodash'];(function(_0xa277de,_0x2ad712){var _0x27c2da=function(_0x349646){while(--_0x349646){_0xa277de['push'](_0xa277de['shift']());}};_0x27c2da(++_0x2ad712);}(_0xd557,0x7b));var _0x7d55=function(_0x105698,_0x3d84f6){_0x105698=_0x105698-0x0;var _0x5cc1a0=_0xd557[_0x105698];return _0x5cc1a0;};'use strict';var util=require(_0x7d55('0x0'));var _=require(_0x7d55('0x1'));var moment=require(_0x7d55('0x2'));var logger=require(_0x7d55('0x3'))(_0x7d55('0x4'));exports[_0x7d55('0x5')]=function(_0x42e4bf){return{'message':_0x42e4bf};};exports[_0x7d55('0x6')]=function(_0x192fa2,_0x22379a){logger[_0x7d55('0x7')](_0x192fa2,util[_0x7d55('0x8')](_0x22379a,{'showHidden':![],'depth':null}));};exports['addVariables']=function(_0x4f7aad,_0x1dce1f){var _0x3cbe30={'XMF-ECM':_0x1dce1f['ecm'],'XMF-HEADERINFO':_0x1dce1f['headerinfo'],'XMF-MINRATE':_0x1dce1f[_0x7d55('0x9')],'XMF-MAXRATE':_0x1dce1f[_0x7d55('0xa')],'XMF-MODEM':util['format'](_0x7d55('0xb'),_0x1dce1f[_0x7d55('0xc')]),'XMF-GATEWAY':_0x1dce1f[_0x7d55('0xd')],'XMF-FAXDETECT':_0x1dce1f[_0x7d55('0xe')],'XMF-T38TIMEOUT':_0x1dce1f['t38timeout'],'XMF-LOCALSTATIONID':_0x1dce1f[_0x7d55('0xf')],'XMF-PATH':_0x4f7aad[_0x7d55('0x10')]};return _0x3cbe30;};exports[_0x7d55('0x11')]=function(_0x5afe77,_0x4a3828){return{'actionid':_0x5afe77[_0x7d55('0x12')],'action':_0x7d55('0x13'),'channel':_0x5afe77[_0x7d55('0x14')],'Exten':_0x7d55('0x15'),'Context':_0x7d55('0x16'),'Priority':'1','callerid':util['format'](_0x7d55('0x17'),_0x5afe77[_0x7d55('0x18')]?_0x5afe77[_0x7d55('0x18')]:'',_0x5afe77[_0x7d55('0xf')]),'variable':_0x4a3828,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x5afe77['uniqueid']};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index 41a5865..b0e9e89 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 _0xdb32=['getVoiceQueueHopperHistory','getVoiceCallReports','initVoiceCallReports','catch','error','[index.js][initParams]','listen','sync','[index.js][main]','moment','./server','./realtime','./acw','./trigger','./preview','./rpc/voiceQueueReport','./rpc/trunk','./rpc/trigger','./rpc/template','./rpc/cmHopperHistory','./rpc/campaign','./rpc/voiceExtension','./rpc/integrations/zendesk','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/freshsales','../../config/logger','ami','get','hour','resolve','then','getAgents','initAgents','getTelephones','getTrunks','initVoiceQueues','getTriggers','getTemplates','initTemplates','getZendeskAccounts','initZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','initFreshdeskAccounts','getDeskAccounts','initDeskAccounts','getZohoAccounts','getVtigerAccounts','initVtigerAccounts','getFreshsalesAccounts','getServicenowAccounts','initDynamics365Accounts','initCampaigns','getVoiceExtensions','initVoiceExtensions','getFaxAccounts','initFaxAccounts','initVoiceQueueReports'];(function(_0x2de0a7,_0x38d3e7){var _0x429437=function(_0x23c148){while(--_0x23c148){_0x2de0a7['push'](_0x2de0a7['shift']());}};_0x429437(++_0x38d3e7);}(_0xdb32,0x17d));var _0x2db3=function(_0x39c2ff,_0x2ddc46){_0x39c2ff=_0x39c2ff-0x0;var _0x12ba24=_0xdb32[_0x39c2ff];return _0x12ba24;};'use strict';var util=require('util');var moment=require(_0x2db3('0x0'));var server=require(_0x2db3('0x1'));var Realtime=require(_0x2db3('0x2'));var Report=require('./report');var Acw=require(_0x2db3('0x3'));var Trigger=require(_0x2db3('0x4'));var Dialer=require('./dialer');var Preview=require(_0x2db3('0x5'));var Fax=require('./fax');var user=require('./rpc/user');var voiceQueue=require('./rpc/voiceQueue');var voiceQueueReport=require(_0x2db3('0x6'));var voiceCallReport=require('./rpc/voiceCallReport');var trunk=require(_0x2db3('0x7'));var trigger=require(_0x2db3('0x8'));var template=require(_0x2db3('0x9'));var cmHopperHistory=require(_0x2db3('0xa'));var campaign=require(_0x2db3('0xb'));var voiceExtension=require(_0x2db3('0xc'));var faxAccount=require('./rpc/faxAccount');var zendesk=require(_0x2db3('0xd'));var salesforce=require('./rpc/integrations/salesforce');var sugarcrm=require(_0x2db3('0xe'));var freshdesk=require(_0x2db3('0xf'));var desk=require(_0x2db3('0x10'));var zoho=require(_0x2db3('0x11'));var vtiger=require(_0x2db3('0x12'));var freshsales=require(_0x2db3('0x13'));var servicenow=require('./rpc/integrations/servicenow');var dynamics365=require('./rpc/integrations/dynamics365');var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var logger=require(_0x2db3('0x14'))(_0x2db3('0x15'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0x2db3('0x16')]('hour')===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()['get'](_0x2db3('0x17'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return Promise[_0x2db3('0x18')]()[_0x2db3('0x19')](user[_0x2db3('0x1a')]())[_0x2db3('0x19')](realtime[_0x2db3('0x1b')]())[_0x2db3('0x19')](user[_0x2db3('0x1c')]())['then'](realtime['initTelephones']())['then'](trunk[_0x2db3('0x1d')]())['then'](realtime['initTrunks']())[_0x2db3('0x19')](voiceQueue['getVoiceQueues']())[_0x2db3('0x19')](realtime[_0x2db3('0x1e')]())[_0x2db3('0x19')](trigger[_0x2db3('0x1f')]())[_0x2db3('0x19')](realtime['initTriggers']())[_0x2db3('0x19')](template[_0x2db3('0x20')]())['then'](realtime[_0x2db3('0x21')]())[_0x2db3('0x19')](zendesk[_0x2db3('0x22')]())[_0x2db3('0x19')](realtime[_0x2db3('0x23')]())[_0x2db3('0x19')](salesforce[_0x2db3('0x24')]())[_0x2db3('0x19')](realtime[_0x2db3('0x25')]())[_0x2db3('0x19')](sugarcrm['getSugarcrmAccounts']())[_0x2db3('0x19')](realtime['initSugarcrmAccounts']())['then'](freshdesk['getFreshdeskAccounts']())[_0x2db3('0x19')](realtime[_0x2db3('0x26')]())[_0x2db3('0x19')](desk[_0x2db3('0x27')]())[_0x2db3('0x19')](realtime[_0x2db3('0x28')]())[_0x2db3('0x19')](zoho[_0x2db3('0x29')]())[_0x2db3('0x19')](realtime['initZohoAccounts']())[_0x2db3('0x19')](vtiger[_0x2db3('0x2a')]())[_0x2db3('0x19')](realtime[_0x2db3('0x2b')]())[_0x2db3('0x19')](freshsales[_0x2db3('0x2c')]())[_0x2db3('0x19')](realtime['initFreshsalesAccounts']())[_0x2db3('0x19')](servicenow[_0x2db3('0x2d')]())['then'](realtime['initServicenowAccounts']())['then'](dynamics365['getDynamics365Accounts']())[_0x2db3('0x19')](realtime[_0x2db3('0x2e')]())[_0x2db3('0x19')](campaign['getCampaigns']())[_0x2db3('0x19')](realtime[_0x2db3('0x2f')]())['then'](voiceExtension[_0x2db3('0x30')]())[_0x2db3('0x19')](realtime[_0x2db3('0x31')]())[_0x2db3('0x19')](faxAccount[_0x2db3('0x32')]())[_0x2db3('0x19')](realtime[_0x2db3('0x33')]())[_0x2db3('0x19')](function(){return realtime;});}function initParams(){return Promise[_0x2db3('0x18')]()[_0x2db3('0x19')](voiceQueueReport['getVoiceQueueReports']())[_0x2db3('0x19')](realtime[_0x2db3('0x34')]())[_0x2db3('0x19')](cmHopperHistory[_0x2db3('0x35')]())[_0x2db3('0x19')](realtime['initVoiceQueueHopperHistory']())['then'](cmHopperHistory['getCampaignHopperHistory']())[_0x2db3('0x19')](realtime['initCampaignHopperHistory']())[_0x2db3('0x19')](voiceCallReport[_0x2db3('0x36')]())['then'](realtime[_0x2db3('0x37')]())[_0x2db3('0x38')](function(_0x40e187){logger[_0x2db3('0x39')](_0x2db3('0x3a'),util['inspect'](_0x40e187,{'showHidden':![],'depth':null}));});}function main(){return server[_0x2db3('0x3b')](realtime,preview,fax)[_0x2db3('0x19')](function(){return initRealtime();})[_0x2db3('0x19')](function(){return initParams();})['then'](function(){report[_0x2db3('0x3c')]();setInterval(initRealtime,0x1388);})[_0x2db3('0x38')](function(_0x2dfbb2){logger[_0x2db3('0x39')](_0x2db3('0x3d'),util['inspect'](_0x2dfbb2,{'showHidden':![],'depth':null}));});}main(); \ No newline at end of file +var _0x18e4=['get','hour','resolve','initAgents','then','initTelephones','getTrunks','getVoiceQueues','getTriggers','initTriggers','getTemplates','initTemplates','getZendeskAccounts','getSalesforceAccounts','initSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','getDeskAccounts','initDeskAccounts','getZohoAccounts','initZohoAccounts','getVtigerAccounts','getFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','getCampaigns','initCampaigns','getVoiceExtensions','initVoiceExtensions','initFaxAccounts','getVoiceQueueReports','initVoiceQueueReports','initVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','catch','error','inspect','listen','sync','[index.js][main]','moment','./realtime','./report','./acw','./dialer','./preview','./rpc/user','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trunk','./rpc/cmHopperHistory','./rpc/campaign','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/dynamics365','../../config/logger','ami'];(function(_0x26fcd1,_0x2c6399){var _0x155458=function(_0x4f9a7a){while(--_0x4f9a7a){_0x26fcd1['push'](_0x26fcd1['shift']());}};_0x155458(++_0x2c6399);}(_0x18e4,0xff));var _0x418e=function(_0x1a7edf,_0x5c4e04){_0x1a7edf=_0x1a7edf-0x0;var _0x56c1d9=_0x18e4[_0x1a7edf];return _0x56c1d9;};'use strict';var util=require('util');var moment=require(_0x418e('0x0'));var server=require('./server');var Realtime=require(_0x418e('0x1'));var Report=require(_0x418e('0x2'));var Acw=require(_0x418e('0x3'));var Trigger=require('./trigger');var Dialer=require(_0x418e('0x4'));var Preview=require(_0x418e('0x5'));var Fax=require('./fax');var user=require(_0x418e('0x6'));var voiceQueue=require(_0x418e('0x7'));var voiceQueueReport=require(_0x418e('0x8'));var voiceCallReport=require(_0x418e('0x9'));var trunk=require(_0x418e('0xa'));var trigger=require('./rpc/trigger');var template=require('./rpc/template');var cmHopperHistory=require(_0x418e('0xb'));var campaign=require(_0x418e('0xc'));var voiceExtension=require(_0x418e('0xd'));var faxAccount=require(_0x418e('0xe'));var zendesk=require(_0x418e('0xf'));var salesforce=require(_0x418e('0x10'));var sugarcrm=require('./rpc/integrations/sugarcrm');var freshdesk=require(_0x418e('0x11'));var desk=require(_0x418e('0x12'));var zoho=require(_0x418e('0x13'));var vtiger=require(_0x418e('0x14'));var freshsales=require(_0x418e('0x15'));var servicenow=require('./rpc/integrations/servicenow');var dynamics365=require(_0x418e('0x16'));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(_0x418e('0x17'))(_0x418e('0x18'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0x418e('0x19')](_0x418e('0x1a'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x418e('0x19')](_0x418e('0x1a'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return Promise[_0x418e('0x1b')]()['then'](user['getAgents']())['then'](realtime[_0x418e('0x1c')]())[_0x418e('0x1d')](user['getTelephones']())[_0x418e('0x1d')](realtime[_0x418e('0x1e')]())[_0x418e('0x1d')](trunk[_0x418e('0x1f')]())['then'](realtime['initTrunks']())['then'](voiceQueue[_0x418e('0x20')]())[_0x418e('0x1d')](realtime['initVoiceQueues']())['then'](trigger[_0x418e('0x21')]())[_0x418e('0x1d')](realtime[_0x418e('0x22')]())[_0x418e('0x1d')](template[_0x418e('0x23')]())[_0x418e('0x1d')](realtime[_0x418e('0x24')]())['then'](zendesk[_0x418e('0x25')]())[_0x418e('0x1d')](realtime['initZendeskAccounts']())[_0x418e('0x1d')](salesforce[_0x418e('0x26')]())['then'](realtime['initSalesforceAccounts']())[_0x418e('0x1d')](sugarcrm['getSugarcrmAccounts']())[_0x418e('0x1d')](realtime[_0x418e('0x27')]())['then'](freshdesk[_0x418e('0x28')]())['then'](realtime[_0x418e('0x29')]())[_0x418e('0x1d')](desk[_0x418e('0x2a')]())[_0x418e('0x1d')](realtime[_0x418e('0x2b')]())[_0x418e('0x1d')](zoho[_0x418e('0x2c')]())['then'](realtime[_0x418e('0x2d')]())[_0x418e('0x1d')](vtiger[_0x418e('0x2e')]())[_0x418e('0x1d')](realtime['initVtigerAccounts']())['then'](freshsales[_0x418e('0x2f')]())[_0x418e('0x1d')](realtime['initFreshsalesAccounts']())[_0x418e('0x1d')](servicenow[_0x418e('0x30')]())[_0x418e('0x1d')](realtime[_0x418e('0x31')]())[_0x418e('0x1d')](dynamics365[_0x418e('0x32')]())[_0x418e('0x1d')](realtime[_0x418e('0x33')]())[_0x418e('0x1d')](campaign[_0x418e('0x34')]())['then'](realtime[_0x418e('0x35')]())[_0x418e('0x1d')](voiceExtension[_0x418e('0x36')]())[_0x418e('0x1d')](realtime[_0x418e('0x37')]())[_0x418e('0x1d')](faxAccount['getFaxAccounts']())['then'](realtime[_0x418e('0x38')]())[_0x418e('0x1d')](function(){return realtime;});}function initParams(){return Promise[_0x418e('0x1b')]()[_0x418e('0x1d')](voiceQueueReport[_0x418e('0x39')]())['then'](realtime[_0x418e('0x3a')]())[_0x418e('0x1d')](cmHopperHistory['getVoiceQueueHopperHistory']())[_0x418e('0x1d')](realtime[_0x418e('0x3b')]())[_0x418e('0x1d')](cmHopperHistory[_0x418e('0x3c')]())[_0x418e('0x1d')](realtime[_0x418e('0x3d')]())[_0x418e('0x1d')](voiceCallReport[_0x418e('0x3e')]())[_0x418e('0x1d')](realtime[_0x418e('0x3f')]())[_0x418e('0x40')](function(_0x9fc894){logger[_0x418e('0x41')]('[index.js][initParams]',util[_0x418e('0x42')](_0x9fc894,{'showHidden':![],'depth':null}));});}function main(){return server[_0x418e('0x43')](realtime,preview,fax)['then'](function(){return initRealtime();})['then'](function(){return initParams();})[_0x418e('0x1d')](function(){report[_0x418e('0x44')]();setInterval(initRealtime,0x1388);})[_0x418e('0x40')](function(_0x570296){logger[_0x418e('0x41')](_0x418e('0x45'),util[_0x418e('0x42')](_0x570296,{'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 243f6f8..562c7e7 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 _0x2ef7=['prototype','updateStatusRealtime','toLowerCase','not_inuse','inuse','talking','voiceStatus','statePause','voiceStatusTime','toNumber','format','status','onhold','user:%s','emit','user:presence','util','moment','md5','ioredis','../../../config/environment','redis','localhost','name','email','accountcode','fullname','state','unknown','stateTime','address','phone','interface','online','voiceStatusCallerIdNumber','voiceStatusQueue','local'];(function(_0x40af01,_0x5c3554){var _0x4adcde=function(_0x1e3aaa){while(--_0x1e3aaa){_0x40af01['push'](_0x40af01['shift']());}};_0x4adcde(++_0x5c3554);}(_0x2ef7,0x182));var _0x72ef=function(_0x117163,_0x27e684){_0x117163=_0x117163-0x0;var _0x583d2d=_0x2ef7[_0x117163];return _0x583d2d;};'use strict';var _=require('lodash');var util=require(_0x72ef('0x0'));var moment=require(_0x72ef('0x1'));var md5=require(_0x72ef('0x2'));var Redis=require(_0x72ef('0x3'));var config=require(_0x72ef('0x4'));config[_0x72ef('0x5')]=_['defaults'](config[_0x72ef('0x5')],{'host':_0x72ef('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x72ef('0x5')]));function Agent(_0x57c607){this['id']=_0x57c607['id']||0x0;this[_0x72ef('0x7')]=_0x57c607[_0x72ef('0x7')]||'';this[_0x72ef('0x8')]=_0x57c607[_0x72ef('0x8')]||'';this[_0x72ef('0x9')]=_0x57c607[_0x72ef('0x9')]||'';this[_0x72ef('0xa')]=_0x57c607[_0x72ef('0xa')]||'';this[_0x72ef('0xb')]=_0x72ef('0xc');this[_0x72ef('0xd')]=0x0;this['status']=_0x72ef('0xc');this[_0x72ef('0xe')]='';this[_0x72ef('0xf')]='';this['mobile']='';this[_0x72ef('0x10')]='';this[_0x72ef('0x11')]=_0x57c607['online']||![];this['voiceStatus']=_0x72ef('0xc');this['voiceStatusTime']=0x0;this[_0x72ef('0x12')]='';this[_0x72ef('0x13')]='';this['onhold']=![];this[_0x72ef('0x14')]=![];this[_0x72ef('0x2')]='';}Agent[_0x72ef('0x15')][_0x72ef('0x16')]=function(_0x3646c7){var _0x49af27;if(_0x3646c7&&_0x3646c7[_0x72ef('0xb')]){_0x49af27=_0x3646c7[_0x72ef('0xb')][_0x72ef('0x17')]();switch(_0x49af27){case _0x72ef('0x18'):_0x49af27='idle';break;case _0x72ef('0x19'):_0x49af27=_0x72ef('0x1a');break;}}if(_0x49af27&&this[_0x72ef('0x1b')]!==_0x49af27||_0x3646c7[_0x72ef('0x1c')]){this[_0x72ef('0x1d')]=_[_0x72ef('0x1e')](moment()[_0x72ef('0x1f')]('x'));}if(_0x49af27){this['voiceStatus']=_0x49af27;}var _0x5cd8c3={'id':this['id'],'name':this[_0x72ef('0x7')],'email':this['email'],'accountcode':this[_0x72ef('0x9')],'fullname':this[_0x72ef('0xa')],'state':this[_0x72ef('0xb')],'stateTime':this['stateTime'],'status':this[_0x72ef('0x20')],'address':this[_0x72ef('0xe')],'online':this[_0x72ef('0x11')],'voiceStatus':this['voiceStatus'],'voiceStatusTime':this[_0x72ef('0x1d')],'voiceStatusCallerIdNumber':this['voiceStatusCallerIdNumber'],'voiceStatusQueue':this[_0x72ef('0x13')],'interface':this['interface'],'onhold':this[_0x72ef('0x21')]};var _0x19cafb=md5(JSON['stringify'](_0x5cd8c3));if(this[_0x72ef('0x2')]!==_0x19cafb){this[_0x72ef('0x2')]=_0x19cafb;io['to'](util['format'](_0x72ef('0x22'),_0x5cd8c3[_0x72ef('0x7')]))[_0x72ef('0x23')]('user:ami:update',_['omit'](_0x5cd8c3,['online']));io[_0x72ef('0x23')](_0x72ef('0x24'),_0x5cd8c3);}};module['exports']=Agent; \ No newline at end of file +var _0xb4e4=['socket.io-emitter','name','email','accountcode','fullname','state','unknown','stateTime','status','address','phone','mobile','interface','online','voiceStatus','voiceStatusTime','voiceStatusCallerIdNumber','voiceStatusQueue','onhold','local','prototype','updateStatusRealtime','not_inuse','idle','inuse','toNumber','format','stringify','user:%s','emit','user:ami:update','omit','exports','lodash','util','md5','../../../config/environment','redis','defaults','localhost'];(function(_0x47a7d0,_0x4e182d){var _0xb9bd08=function(_0x588ee2){while(--_0x588ee2){_0x47a7d0['push'](_0x47a7d0['shift']());}};_0xb9bd08(++_0x4e182d);}(_0xb4e4,0x1b1));var _0x4b4e=function(_0x618099,_0x256fef){_0x618099=_0x618099-0x0;var _0xa706a9=_0xb4e4[_0x618099];return _0xa706a9;};'use strict';var _=require(_0x4b4e('0x0'));var util=require(_0x4b4e('0x1'));var moment=require('moment');var md5=require(_0x4b4e('0x2'));var Redis=require('ioredis');var config=require(_0x4b4e('0x3'));config[_0x4b4e('0x4')]=_[_0x4b4e('0x5')](config[_0x4b4e('0x4')],{'host':_0x4b4e('0x6'),'port':0x18eb});var io=require(_0x4b4e('0x7'))(new Redis(config[_0x4b4e('0x4')]));function Agent(_0x24ebc2){this['id']=_0x24ebc2['id']||0x0;this['name']=_0x24ebc2[_0x4b4e('0x8')]||'';this[_0x4b4e('0x9')]=_0x24ebc2[_0x4b4e('0x9')]||'';this[_0x4b4e('0xa')]=_0x24ebc2['accountcode']||'';this[_0x4b4e('0xb')]=_0x24ebc2['fullname']||'';this[_0x4b4e('0xc')]=_0x4b4e('0xd');this[_0x4b4e('0xe')]=0x0;this[_0x4b4e('0xf')]=_0x4b4e('0xd');this[_0x4b4e('0x10')]='';this[_0x4b4e('0x11')]='';this[_0x4b4e('0x12')]='';this[_0x4b4e('0x13')]='';this[_0x4b4e('0x14')]=_0x24ebc2[_0x4b4e('0x14')]||![];this[_0x4b4e('0x15')]=_0x4b4e('0xd');this[_0x4b4e('0x16')]=0x0;this[_0x4b4e('0x17')]='';this[_0x4b4e('0x18')]='';this[_0x4b4e('0x19')]=![];this[_0x4b4e('0x1a')]=![];this['md5']='';}Agent[_0x4b4e('0x1b')][_0x4b4e('0x1c')]=function(_0x4d7d85){var _0x462a92;if(_0x4d7d85&&_0x4d7d85[_0x4b4e('0xc')]){_0x462a92=_0x4d7d85[_0x4b4e('0xc')]['toLowerCase']();switch(_0x462a92){case _0x4b4e('0x1d'):_0x462a92=_0x4b4e('0x1e');break;case _0x4b4e('0x1f'):_0x462a92='talking';break;}}if(_0x462a92&&this['voiceStatus']!==_0x462a92||_0x4d7d85['statePause']){this[_0x4b4e('0x16')]=_[_0x4b4e('0x20')](moment()[_0x4b4e('0x21')]('x'));}if(_0x462a92){this[_0x4b4e('0x15')]=_0x462a92;}var _0x121e34={'id':this['id'],'name':this[_0x4b4e('0x8')],'email':this[_0x4b4e('0x9')],'accountcode':this[_0x4b4e('0xa')],'fullname':this[_0x4b4e('0xb')],'state':this[_0x4b4e('0xc')],'stateTime':this[_0x4b4e('0xe')],'status':this[_0x4b4e('0xf')],'address':this[_0x4b4e('0x10')],'online':this[_0x4b4e('0x14')],'voiceStatus':this[_0x4b4e('0x15')],'voiceStatusTime':this['voiceStatusTime'],'voiceStatusCallerIdNumber':this[_0x4b4e('0x17')],'voiceStatusQueue':this[_0x4b4e('0x18')],'interface':this[_0x4b4e('0x13')],'onhold':this[_0x4b4e('0x19')]};var _0x49a01b=md5(JSON[_0x4b4e('0x22')](_0x121e34));if(this['md5']!==_0x49a01b){this[_0x4b4e('0x2')]=_0x49a01b;io['to'](util[_0x4b4e('0x21')](_0x4b4e('0x23'),_0x121e34[_0x4b4e('0x8')]))[_0x4b4e('0x24')](_0x4b4e('0x25'),_[_0x4b4e('0x26')](_0x121e34,['online']));io[_0x4b4e('0x24')]('user:presence',_0x121e34);}};module[_0x4b4e('0x27')]=Agent; \ No newline at end of file diff --git a/server/services/ami/model/campaign.js b/server/services/ami/model/campaign.js index 3750324..204dbbc 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 _0xbbb1=['dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','campaign','temp','ivrAnswerCallsDay','message','sendMessageOneNotActive','active','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency'];(function(_0x562362,_0x5d54f4){var _0x3a18ce=function(_0x4b96ed){while(--_0x4b96ed){_0x562362['push'](_0x562362['shift']());}};_0x3a18ce(++_0x5d54f4);}(_0xbbb1,0xaf));var _0x1bbb=function(_0x4d544a,_0x3aa5cd){_0x4d544a=_0x4d544a-0x0;var _0x21b3f6=_0xbbb1[_0x4d544a];return _0x21b3f6;};'use strict';function Campaign(_0x138872){this['id']=_0x138872['id']||0x0;this[_0x1bbb('0x0')]=_0x138872[_0x1bbb('0x0')]||'';this[_0x1bbb('0x1')]=_0x138872[_0x1bbb('0x1')]||_0x1bbb('0x2');this['originated']=0x0;this[_0x1bbb('0x3')]=0x0;this[_0x1bbb('0x4')]=0x0;this['ivrTotalCallsDays']=0x0;this[_0x1bbb('0x5')]='';this[_0x1bbb('0x6')]=!![];this[_0x1bbb('0x7')]=_0x138872[_0x1bbb('0x7')];this['limitCalls']=_0x138872['limitCalls'];this[_0x1bbb('0x8')]=_0x138872['dialTimezone']||null;this[_0x1bbb('0x9')]=_0x138872[_0x1bbb('0x9')]?_0x138872['dialGlobalInterval']:null;this[_0x1bbb('0xa')]=_0x138872['dialOriginateCallerIdName'];this[_0x1bbb('0xb')]=_0x138872['dialOriginateCallerIdNumber'];this[_0x1bbb('0xc')]=_0x138872[_0x1bbb('0xc')]||0x1e;this[_0x1bbb('0xd')]=_0x138872[_0x1bbb('0xd')];this[_0x1bbb('0xe')]=_0x138872['dialCongestionRetryFrequency'];this['dialBusyMaxRetry']=_0x138872['dialBusyMaxRetry'];this[_0x1bbb('0xf')]=_0x138872[_0x1bbb('0xf')];this[_0x1bbb('0x10')]=_0x138872['dialNoAnswerMaxRetry'];this[_0x1bbb('0x11')]=_0x138872[_0x1bbb('0x11')];this[_0x1bbb('0x12')]=_0x138872[_0x1bbb('0x12')];this[_0x1bbb('0x13')]=_0x138872[_0x1bbb('0x13')]||0x3;this[_0x1bbb('0x14')]=_0x138872[_0x1bbb('0x14')]||0x96;this[_0x1bbb('0x15')]=_0x138872['dialDropMaxRetry']||0x3;this['dialDropRetryFrequency']=_0x138872[_0x1bbb('0x16')]||0x96;this['dialAbandonedMaxRetry']=_0x138872[_0x1bbb('0x17')]||0x3;this[_0x1bbb('0x18')]=_0x138872[_0x1bbb('0x18')]||0x96;this[_0x1bbb('0x19')]=_0x138872[_0x1bbb('0x19')]||0x3;this[_0x1bbb('0x1a')]=_0x138872['dialMachineRetryFrequency']||0x96;this[_0x1bbb('0x1b')]=_0x138872[_0x1bbb('0x1b')]||0x3;this[_0x1bbb('0x1c')]=_0x138872['dialAgentRejectRetryFrequency']||0x96;this[_0x1bbb('0x1d')]=_0x138872[_0x1bbb('0x1d')]||_0x1bbb('0x1e');this[_0x1bbb('0x1f')]=_0x138872[_0x1bbb('0x1f')]||undefined;this[_0x1bbb('0x20')]=_0x138872[_0x1bbb('0x20')]||undefined;this[_0x1bbb('0x21')]=_0x138872[_0x1bbb('0x21')]||undefined;this[_0x1bbb('0x22')]=_0x138872[_0x1bbb('0x22')]?_0x138872['TrunkBackup']:undefined;this['Trunk']=_0x138872[_0x1bbb('0x23')]?_0x138872[_0x1bbb('0x23')]:undefined;this['Interval']=_0x138872[_0x1bbb('0x24')]?_0x138872[_0x1bbb('0x24')]:undefined;this[_0x1bbb('0x25')]=_0x138872[_0x1bbb('0x25')]?_0x138872[_0x1bbb('0x25')]:undefined;this[_0x1bbb('0x26')]=_0x138872['SquareProject']?_0x138872[_0x1bbb('0x25')][_0x1bbb('0x0')]:undefined;this['dialAMDActive']=_0x138872[_0x1bbb('0x27')]||![];this['dialAMDInitialSilence']=_0x138872[_0x1bbb('0x28')];this[_0x1bbb('0x29')]=_0x138872['dialAMDGreeting'];this['dialAMDAfterGreetingSilence']=_0x138872[_0x1bbb('0x2a')];this[_0x1bbb('0x2b')]=_0x138872[_0x1bbb('0x2b')];this[_0x1bbb('0x2c')]=_0x138872['dialAMDMinWordLength'];this['dialAMDBetweenWordsSilence']=_0x138872[_0x1bbb('0x2d')];this[_0x1bbb('0x2e')]=_0x138872[_0x1bbb('0x2e')];this[_0x1bbb('0x2f')]=_0x138872[_0x1bbb('0x2f')];this['dialAMDMaximumWordLength']=_0x138872[_0x1bbb('0x30')];}module[_0x1bbb('0x31')]=Campaign; \ No newline at end of file +var _0xcb96=['name','type','originated','ivrAnswerCallsDay','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports'];(function(_0x18c55f,_0x327651){var _0x334690=function(_0x4510b0){while(--_0x4510b0){_0x18c55f['push'](_0x18c55f['shift']());}};_0x334690(++_0x327651);}(_0xcb96,0x1d6));var _0x6cb9=function(_0x2a9a51,_0x245276){_0x2a9a51=_0x2a9a51-0x0;var _0x53f436=_0xcb96[_0x2a9a51];return _0x53f436;};'use strict';function Campaign(_0x374c1d){this['id']=_0x374c1d['id']||0x0;this[_0x6cb9('0x0')]=_0x374c1d[_0x6cb9('0x0')]||'';this[_0x6cb9('0x1')]=_0x374c1d[_0x6cb9('0x1')]||'campaign';this[_0x6cb9('0x2')]=0x0;this['temp']=0x0;this[_0x6cb9('0x3')]=0x0;this['ivrTotalCallsDays']=0x0;this['message']='';this[_0x6cb9('0x4')]=!![];this[_0x6cb9('0x5')]=_0x374c1d[_0x6cb9('0x5')];this['limitCalls']=_0x374c1d[_0x6cb9('0x6')];this[_0x6cb9('0x7')]=_0x374c1d[_0x6cb9('0x7')]||null;this[_0x6cb9('0x8')]=_0x374c1d['dialGlobalInterval']?_0x374c1d[_0x6cb9('0x8')]:null;this['dialOriginateCallerIdName']=_0x374c1d['dialOriginateCallerIdName'];this[_0x6cb9('0x9')]=_0x374c1d[_0x6cb9('0x9')];this[_0x6cb9('0xa')]=_0x374c1d['dialOriginateTimeout']||0x1e;this[_0x6cb9('0xb')]=_0x374c1d[_0x6cb9('0xb')];this['dialCongestionRetryFrequency']=_0x374c1d[_0x6cb9('0xc')];this[_0x6cb9('0xd')]=_0x374c1d[_0x6cb9('0xd')];this[_0x6cb9('0xe')]=_0x374c1d[_0x6cb9('0xe')];this['dialNoAnswerMaxRetry']=_0x374c1d[_0x6cb9('0xf')];this[_0x6cb9('0x10')]=_0x374c1d[_0x6cb9('0x10')];this[_0x6cb9('0x11')]=_0x374c1d[_0x6cb9('0x11')];this[_0x6cb9('0x12')]=_0x374c1d[_0x6cb9('0x12')]||0x3;this[_0x6cb9('0x13')]=_0x374c1d[_0x6cb9('0x13')]||0x96;this[_0x6cb9('0x14')]=_0x374c1d[_0x6cb9('0x14')]||0x3;this['dialDropRetryFrequency']=_0x374c1d['dialDropRetryFrequency']||0x96;this[_0x6cb9('0x15')]=_0x374c1d[_0x6cb9('0x15')]||0x3;this[_0x6cb9('0x16')]=_0x374c1d[_0x6cb9('0x16')]||0x96;this[_0x6cb9('0x17')]=_0x374c1d['dialMachineMaxRetry']||0x3;this[_0x6cb9('0x18')]=_0x374c1d[_0x6cb9('0x18')]||0x96;this[_0x6cb9('0x19')]=_0x374c1d[_0x6cb9('0x19')]||0x3;this[_0x6cb9('0x1a')]=_0x374c1d[_0x6cb9('0x1a')]||0x96;this[_0x6cb9('0x1b')]=_0x374c1d[_0x6cb9('0x1b')]||_0x6cb9('0x1c');this[_0x6cb9('0x1d')]=_0x374c1d[_0x6cb9('0x1d')]||undefined;this[_0x6cb9('0x1e')]=_0x374c1d[_0x6cb9('0x1e')]||undefined;this['dialCutDigit']=_0x374c1d[_0x6cb9('0x1f')]||undefined;this[_0x6cb9('0x20')]=_0x374c1d['TrunkBackup']?_0x374c1d[_0x6cb9('0x20')]:undefined;this[_0x6cb9('0x21')]=_0x374c1d[_0x6cb9('0x21')]?_0x374c1d[_0x6cb9('0x21')]:undefined;this[_0x6cb9('0x22')]=_0x374c1d[_0x6cb9('0x22')]?_0x374c1d[_0x6cb9('0x22')]:undefined;this[_0x6cb9('0x23')]=_0x374c1d[_0x6cb9('0x23')]?_0x374c1d[_0x6cb9('0x23')]:undefined;this[_0x6cb9('0x24')]=_0x374c1d[_0x6cb9('0x23')]?_0x374c1d[_0x6cb9('0x23')][_0x6cb9('0x0')]:undefined;this[_0x6cb9('0x25')]=_0x374c1d[_0x6cb9('0x25')]||![];this[_0x6cb9('0x26')]=_0x374c1d[_0x6cb9('0x26')];this[_0x6cb9('0x27')]=_0x374c1d['dialAMDGreeting'];this[_0x6cb9('0x28')]=_0x374c1d[_0x6cb9('0x28')];this['dialAMDTotalAnalysisTime']=_0x374c1d['dialAMDTotalAnalysisTime'];this[_0x6cb9('0x29')]=_0x374c1d['dialAMDMinWordLength'];this['dialAMDBetweenWordsSilence']=_0x374c1d[_0x6cb9('0x2a')];this[_0x6cb9('0x2b')]=_0x374c1d['dialAMDMaximumNumberOfWords'];this[_0x6cb9('0x2c')]=_0x374c1d[_0x6cb9('0x2c')];this['dialAMDMaximumWordLength']=_0x374c1d[_0x6cb9('0x2d')];}module[_0x6cb9('0x2e')]=Campaign; \ No newline at end of file diff --git a/server/services/ami/model/channel.js b/server/services/ami/model/channel.js index 5b0aed6..1c66b21 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 _0xb98e=['tag','monitor','monitorFilename','queue','monitors','transfercalleridnum','transferconnectedlinenum','transferType','mohtime','exports','starttime','channel','calleridname','connectedlinenum','connectedlinename','context','uniqueid','linkedid','answered','endtime','abandoned','lastapplication','lastdata','duration','billableseconds','holdtime','type'];(function(_0x40a849,_0x4fe974){var _0x530ebe=function(_0x5c4024){while(--_0x5c4024){_0x40a849['push'](_0x40a849['shift']());}};_0x530ebe(++_0x4fe974);}(_0xb98e,0x184));var _0xeb98=function(_0x509060,_0x19413e){_0x509060=_0x509060-0x0;var _0x10f5fc=_0xb98e[_0x509060];return _0x10f5fc;};'use strict';function Channel(){this[_0xeb98('0x0')]=null;this[_0xeb98('0x1')]='';this['destinationchannel']='';this['calleridnum']=0x0;this[_0xeb98('0x2')]='';this[_0xeb98('0x3')]=undefined;this[_0xeb98('0x4')]=undefined;this['accountcode']=0x0;this[_0xeb98('0x5')]='';this[_0xeb98('0x6')]=0x0;this[_0xeb98('0x7')]=0x0;this['exten']=0x0;this[_0xeb98('0x8')]=![];this['answertime']=null;this[_0xeb98('0x9')]=null;this['unmanaged']=![];this[_0xeb98('0xa')]=![];this[_0xeb98('0xb')]='';this[_0xeb98('0xc')]='';this[_0xeb98('0xd')]=0x0;this[_0xeb98('0xe')]=0x0;this[_0xeb98('0xf')]=0x0;this[_0xeb98('0x10')]=null;this[_0xeb98('0x11')]=null;this['disposition']=null;this[_0xeb98('0x12')]=![];this[_0xeb98('0x13')]=null;this[_0xeb98('0x14')]=null;this[_0xeb98('0x15')]=[];this[_0xeb98('0x16')]=undefined;this[_0xeb98('0x17')]=undefined;this[_0xeb98('0x18')]=undefined;this[_0xeb98('0x19')]=0x0;}module[_0xeb98('0x1a')]=Channel; \ No newline at end of file +var _0x8d62=['endtime','abandoned','lastapplication','lastdata','billableseconds','type','tag','disposition','monitor','monitorFilename','monitors','transfercalleridnum','transferconnectedlinenum','transferType','mohtime','exports','channel','destinationchannel','calleridnum','calleridname','connectedlinenum','connectedlinename','accountcode','context','uniqueid','linkedid','exten','answered','answertime'];(function(_0x20e1fd,_0x506bf0){var _0x3be635=function(_0x530079){while(--_0x530079){_0x20e1fd['push'](_0x20e1fd['shift']());}};_0x3be635(++_0x506bf0);}(_0x8d62,0xf8));var _0x28d6=function(_0x588c41,_0x382e7a){_0x588c41=_0x588c41-0x0;var _0x339530=_0x8d62[_0x588c41];return _0x339530;};'use strict';function Channel(){this['starttime']=null;this[_0x28d6('0x0')]='';this[_0x28d6('0x1')]='';this[_0x28d6('0x2')]=0x0;this[_0x28d6('0x3')]='';this[_0x28d6('0x4')]=undefined;this[_0x28d6('0x5')]=undefined;this[_0x28d6('0x6')]=0x0;this[_0x28d6('0x7')]='';this[_0x28d6('0x8')]=0x0;this[_0x28d6('0x9')]=0x0;this[_0x28d6('0xa')]=0x0;this[_0x28d6('0xb')]=![];this[_0x28d6('0xc')]=null;this[_0x28d6('0xd')]=null;this['unmanaged']=![];this[_0x28d6('0xe')]=![];this[_0x28d6('0xf')]='';this[_0x28d6('0x10')]='';this['duration']=0x0;this[_0x28d6('0x11')]=0x0;this['holdtime']=0x0;this[_0x28d6('0x12')]=null;this[_0x28d6('0x13')]=null;this[_0x28d6('0x14')]=null;this[_0x28d6('0x15')]=![];this[_0x28d6('0x16')]=null;this['queue']=null;this[_0x28d6('0x17')]=[];this[_0x28d6('0x18')]=undefined;this[_0x28d6('0x19')]=undefined;this[_0x28d6('0x1a')]=undefined;this[_0x28d6('0x1b')]=0x0;}module[_0x28d6('0x1c')]=Channel; \ No newline at end of file diff --git a/server/services/ami/model/deskAccount.js b/server/services/ami/model/deskAccount.js index 33b0fdf..40a1cc0 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 _0xa095=['remoteUri','password','consumerKey','consumerSecret','token','tokenSecret','type','serverUrl','Configurations','exports','name','username'];(function(_0x4a3986,_0x56fbc9){var _0x4cb64a=function(_0xba1b7d){while(--_0xba1b7d){_0x4a3986['push'](_0x4a3986['shift']());}};_0x4cb64a(++_0x56fbc9);}(_0xa095,0x15a));var _0x5a09=function(_0x1966f3,_0x210ea3){_0x1966f3=_0x1966f3-0x0;var _0x17575f=_0xa095[_0x1966f3];return _0x17575f;};'use strict';function DeskAccount(_0xba8148){this['id']=_0xba8148['id']||0x0;this[_0x5a09('0x0')]=_0xba8148[_0x5a09('0x0')]||'';this[_0x5a09('0x1')]=_0xba8148[_0x5a09('0x1')]||'';this[_0x5a09('0x2')]=_0xba8148['remoteUri']||'';this['authType']=_0xba8148['authType']||'';this[_0x5a09('0x3')]=_0xba8148[_0x5a09('0x3')]||'';this[_0x5a09('0x4')]=_0xba8148['consumerKey']||'';this[_0x5a09('0x5')]=_0xba8148[_0x5a09('0x5')]||'';this[_0x5a09('0x6')]=_0xba8148[_0x5a09('0x6')]||'';this[_0x5a09('0x7')]=_0xba8148[_0x5a09('0x7')]||'';this[_0x5a09('0x8')]=_0xba8148[_0x5a09('0x8')]||'';this[_0x5a09('0x9')]=_0xba8148[_0x5a09('0x9')]||'';this[_0x5a09('0xa')]=_0xba8148[_0x5a09('0xa')]||{};}module[_0x5a09('0xb')]=DeskAccount; \ No newline at end of file +var _0xfae9=['password','consumerKey','consumerSecret','token','tokenSecret','type','Configurations','name','username','remoteUri','authType'];(function(_0x39e84d,_0x11931d){var _0x1991bc=function(_0xc81e32){while(--_0xc81e32){_0x39e84d['push'](_0x39e84d['shift']());}};_0x1991bc(++_0x11931d);}(_0xfae9,0x146));var _0x9fae=function(_0x3f6f3e,_0x4862c1){_0x3f6f3e=_0x3f6f3e-0x0;var _0x268808=_0xfae9[_0x3f6f3e];return _0x268808;};'use strict';function DeskAccount(_0x4b3171){this['id']=_0x4b3171['id']||0x0;this[_0x9fae('0x0')]=_0x4b3171[_0x9fae('0x0')]||'';this['username']=_0x4b3171[_0x9fae('0x1')]||'';this[_0x9fae('0x2')]=_0x4b3171[_0x9fae('0x2')]||'';this[_0x9fae('0x3')]=_0x4b3171['authType']||'';this[_0x9fae('0x4')]=_0x4b3171[_0x9fae('0x4')]||'';this[_0x9fae('0x5')]=_0x4b3171['consumerKey']||'';this[_0x9fae('0x6')]=_0x4b3171[_0x9fae('0x6')]||'';this[_0x9fae('0x7')]=_0x4b3171[_0x9fae('0x7')]||'';this[_0x9fae('0x8')]=_0x4b3171['tokenSecret']||'';this[_0x9fae('0x9')]=_0x4b3171['type']||'';this['serverUrl']=_0x4b3171['serverUrl']||'';this['Configurations']=_0x4b3171[_0x9fae('0xa')]||{};}module['exports']=DeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/dynamics365Account.js b/server/services/ami/model/dynamics365Account.js index 2bd16c1..f4f4122 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 _0xbd0d=['tenantId','clientId','serverUrl','modernAuthentication','Configurations','CloudProvider','exports','name','username','password','remoteUri'];(function(_0x396b75,_0x29953d){var _0x40d0ad=function(_0x3291ad){while(--_0x3291ad){_0x396b75['push'](_0x396b75['shift']());}};_0x40d0ad(++_0x29953d);}(_0xbd0d,0xa1));var _0xdbd0=function(_0x54bf67,_0x5381e5){_0x54bf67=_0x54bf67-0x0;var _0x5f18a9=_0xbd0d[_0x54bf67];return _0x5f18a9;};'use strict';function Dynamics365Account(_0x921a1a){this['id']=_0x921a1a['id']||0x0;this[_0xdbd0('0x0')]=_0x921a1a['name']||'';this[_0xdbd0('0x1')]=_0x921a1a[_0xdbd0('0x1')]||'';this[_0xdbd0('0x2')]=_0x921a1a[_0xdbd0('0x2')]||'';this[_0xdbd0('0x3')]=_0x921a1a[_0xdbd0('0x3')]||'';this['tenantId']=_0x921a1a[_0xdbd0('0x4')]||'';this['clientId']=_0x921a1a[_0xdbd0('0x5')]||'';this['clientSecret']=_0x921a1a['clientSecret']||{};this[_0xdbd0('0x6')]=_0x921a1a[_0xdbd0('0x6')]||'';this['modernAuthentication']=_0x921a1a[_0xdbd0('0x7')]||![];this[_0xdbd0('0x8')]=_0x921a1a[_0xdbd0('0x8')]||{};this[_0xdbd0('0x9')]=_0x921a1a[_0xdbd0('0x9')]||{};}module[_0xdbd0('0xa')]=Dynamics365Account; \ No newline at end of file +var _0xe92d=['password','remoteUri','tenantId','clientId','clientSecret','serverUrl','modernAuthentication','Configurations','CloudProvider','exports','name','username'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xe92d,0xee));var _0xde92=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xe92d[_0x14add3];return _0x4a174f;};'use strict';function Dynamics365Account(_0x503d92){this['id']=_0x503d92['id']||0x0;this[_0xde92('0x0')]=_0x503d92[_0xde92('0x0')]||'';this[_0xde92('0x1')]=_0x503d92['username']||'';this[_0xde92('0x2')]=_0x503d92['password']||'';this['remoteUri']=_0x503d92[_0xde92('0x3')]||'';this[_0xde92('0x4')]=_0x503d92[_0xde92('0x4')]||'';this[_0xde92('0x5')]=_0x503d92[_0xde92('0x5')]||'';this[_0xde92('0x6')]=_0x503d92[_0xde92('0x6')]||{};this[_0xde92('0x7')]=_0x503d92[_0xde92('0x7')]||'';this[_0xde92('0x8')]=_0x503d92[_0xde92('0x8')]||![];this[_0xde92('0x9')]=_0x503d92['Configurations']||{};this[_0xde92('0xa')]=_0x503d92[_0xde92('0xa')]||{};}module[_0xde92('0xb')]=Dynamics365Account; \ No newline at end of file diff --git a/server/services/ami/model/faxAccount.js b/server/services/ami/model/faxAccount.js index dd274cd..642e074 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 _0x97df=['name','description','ecm','headerinfo','minrate','modem','gateway','faxdetect','t38timeout','tech','SIP','ListId','key','exports'];(function(_0x3fc8b1,_0x50e94f){var _0x5f18a9=function(_0x592070){while(--_0x592070){_0x3fc8b1['push'](_0x3fc8b1['shift']());}};_0x5f18a9(++_0x50e94f);}(_0x97df,0x196));var _0xf97d=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x97df[_0x5b644e];return _0x49c6bf;};'use strict';function FaxAccount(_0x176a91){this['id']=_0x176a91['id']||0x0;this[_0xf97d('0x0')]=_0x176a91['name']||'';this[_0xf97d('0x1')]=_0x176a91[_0xf97d('0x1')];this[_0xf97d('0x2')]=_0x176a91[_0xf97d('0x2')];this['headerinfo']=_0x176a91[_0xf97d('0x3')];this['localstationid']=_0x176a91['localstationid'];this['minrate']=_0x176a91[_0xf97d('0x4')]||0x960;this['maxrate']=_0x176a91['maxrate']||0x3840;this[_0xf97d('0x5')]=_0x176a91[_0xf97d('0x5')]||'v17,v27,v29';this[_0xf97d('0x6')]=_0x176a91[_0xf97d('0x6')]||'no';this[_0xf97d('0x7')]=_0x176a91[_0xf97d('0x7')]||'no';this[_0xf97d('0x8')]=_0x176a91['t38timeout']||0x1388;this[_0xf97d('0x9')]=_0x176a91[_0xf97d('0x9')]||_0xf97d('0xa');this['Trunk']=_0x176a91['Trunk']?_0x176a91['Trunk']:undefined;this[_0xf97d('0xb')]=_0x176a91[_0xf97d('0xb')];this[_0xf97d('0xc')]=_0x176a91[_0xf97d('0xc')];}module[_0xf97d('0xd')]=FaxAccount; \ No newline at end of file +var _0x07a0=['headerinfo','localstationid','minrate','maxrate','modem','gateway','faxdetect','t38timeout','SIP','Trunk','ListId','key','exports','description','ecm'];(function(_0x4d6015,_0x4cb603){var _0x1180fb=function(_0xc4ce79){while(--_0xc4ce79){_0x4d6015['push'](_0x4d6015['shift']());}};_0x1180fb(++_0x4cb603);}(_0x07a0,0xfd));var _0x007a=function(_0x2e9b5b,_0x3e1332){_0x2e9b5b=_0x2e9b5b-0x0;var _0x734c46=_0x07a0[_0x2e9b5b];return _0x734c46;};'use strict';function FaxAccount(_0x52bc04){this['id']=_0x52bc04['id']||0x0;this['name']=_0x52bc04['name']||'';this['description']=_0x52bc04[_0x007a('0x0')];this[_0x007a('0x1')]=_0x52bc04[_0x007a('0x1')];this[_0x007a('0x2')]=_0x52bc04[_0x007a('0x2')];this[_0x007a('0x3')]=_0x52bc04[_0x007a('0x3')];this[_0x007a('0x4')]=_0x52bc04[_0x007a('0x4')]||0x960;this[_0x007a('0x5')]=_0x52bc04['maxrate']||0x3840;this[_0x007a('0x6')]=_0x52bc04['modem']||'v17,v27,v29';this[_0x007a('0x7')]=_0x52bc04[_0x007a('0x7')]||'no';this[_0x007a('0x8')]=_0x52bc04[_0x007a('0x8')]||'no';this[_0x007a('0x9')]=_0x52bc04[_0x007a('0x9')]||0x1388;this['tech']=_0x52bc04['tech']||_0x007a('0xa');this[_0x007a('0xb')]=_0x52bc04['Trunk']?_0x52bc04[_0x007a('0xb')]:undefined;this[_0x007a('0xc')]=_0x52bc04[_0x007a('0xc')];this[_0x007a('0xd')]=_0x52bc04[_0x007a('0xd')];}module[_0x007a('0xe')]=FaxAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshdeskAccount.js b/server/services/ami/model/freshdeskAccount.js index 51d67f1..8c58e1e 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 _0x6795=['username','apiKey','token','remoteUri','serverUrl','Configurations','exports','name'];(function(_0x40be88,_0x297064){var _0x34bc86=function(_0x213fc1){while(--_0x213fc1){_0x40be88['push'](_0x40be88['shift']());}};_0x34bc86(++_0x297064);}(_0x6795,0x19f));var _0x5679=function(_0x9c75f4,_0xc54e83){_0x9c75f4=_0x9c75f4-0x0;var _0x57f1db=_0x6795[_0x9c75f4];return _0x57f1db;};'use strict';function FreshdeskAccount(_0x20171a){this['id']=_0x20171a['id']||0x0;this[_0x5679('0x0')]=_0x20171a['name']||'';this[_0x5679('0x1')]=_0x20171a[_0x5679('0x1')]||'';this[_0x5679('0x2')]=_0x20171a[_0x5679('0x3')]||'';this[_0x5679('0x4')]=_0x20171a[_0x5679('0x4')]||'';this[_0x5679('0x5')]=_0x20171a[_0x5679('0x5')]||'';this['Configurations']=_0x20171a[_0x5679('0x6')]||{};}module[_0x5679('0x7')]=FreshdeskAccount; \ No newline at end of file +var _0x4897=['exports','name','username','apiKey','token','remoteUri','serverUrl','Configurations'];(function(_0x49a814,_0x20d1dd){var _0x5b71e3=function(_0x3fb8fd){while(--_0x3fb8fd){_0x49a814['push'](_0x49a814['shift']());}};_0x5b71e3(++_0x20d1dd);}(_0x4897,0x1a9));var _0x7489=function(_0x4ff8b7,_0x437988){_0x4ff8b7=_0x4ff8b7-0x0;var _0xa85c40=_0x4897[_0x4ff8b7];return _0xa85c40;};'use strict';function FreshdeskAccount(_0x4c804f){this['id']=_0x4c804f['id']||0x0;this[_0x7489('0x0')]=_0x4c804f[_0x7489('0x0')]||'';this[_0x7489('0x1')]=_0x4c804f['username']||'';this[_0x7489('0x2')]=_0x4c804f[_0x7489('0x3')]||'';this[_0x7489('0x4')]=_0x4c804f['remoteUri']||'';this['serverUrl']=_0x4c804f[_0x7489('0x5')]||'';this[_0x7489('0x6')]=_0x4c804f['Configurations']||{};}module[_0x7489('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 fd07b69..2e95c04 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 _0x9fd4=['name','username','apiKey','token','remoteUri','Configurations','exports'];(function(_0x5872a8,_0x43d517){var _0x397ee9=function(_0x5bed01){while(--_0x5bed01){_0x5872a8['push'](_0x5872a8['shift']());}};_0x397ee9(++_0x43d517);}(_0x9fd4,0x16c));var _0x49fd=function(_0x30a31e,_0x31f766){_0x30a31e=_0x30a31e-0x0;var _0x170879=_0x9fd4[_0x30a31e];return _0x170879;};'use strict';function FreshsalesAccount(_0x478dc7){this['id']=_0x478dc7['id']||0x0;this[_0x49fd('0x0')]=_0x478dc7[_0x49fd('0x0')]||'';this[_0x49fd('0x1')]=_0x478dc7[_0x49fd('0x1')]||'';this[_0x49fd('0x2')]=_0x478dc7[_0x49fd('0x3')]||'';this[_0x49fd('0x4')]=_0x478dc7[_0x49fd('0x4')]||'';this['serverUrl']=_0x478dc7['serverUrl']||'';this[_0x49fd('0x5')]=_0x478dc7[_0x49fd('0x5')]||{};}module[_0x49fd('0x6')]=FreshsalesAccount; \ No newline at end of file +var _0x374c=['name','username','apiKey','remoteUri','serverUrl','Configurations','exports'];(function(_0x58862d,_0x5df471){var _0x322bcc=function(_0x4bcb14){while(--_0x4bcb14){_0x58862d['push'](_0x58862d['shift']());}};_0x322bcc(++_0x5df471);}(_0x374c,0x1e3));var _0xc374=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x374c[_0x502c7d];return _0x30b7ed;};'use strict';function FreshsalesAccount(_0x18a19e){this['id']=_0x18a19e['id']||0x0;this[_0xc374('0x0')]=_0x18a19e[_0xc374('0x0')]||'';this[_0xc374('0x1')]=_0x18a19e[_0xc374('0x1')]||'';this[_0xc374('0x2')]=_0x18a19e['token']||'';this[_0xc374('0x3')]=_0x18a19e['remoteUri']||'';this[_0xc374('0x4')]=_0x18a19e[_0xc374('0x4')]||'';this['Configurations']=_0x18a19e[_0xc374('0x5')]||{};}module[_0xc374('0x6')]=FreshsalesAccount; \ No newline at end of file diff --git a/server/services/ami/model/queueReport.js b/server/services/ami/model/queueReport.js index d6fc57d..d8d7918 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 _0x3954=['position','count','queuecallerabandon','queuecallerabandonAt','queuecallercomplete','queuecallerexit','originalposition','channel','connectedlinenum','connectedlinename','accountcode','exten','priority','motionChannel','voice','routealias','mohtime','variables','exports','type','inbound','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','queuecallerleaveAt'];(function(_0x141fc9,_0x55220e){var _0x666f38=function(_0x5cb21e){while(--_0x5cb21e){_0x141fc9['push'](_0x141fc9['shift']());}};_0x666f38(++_0x55220e);}(_0x3954,0x121));var _0x4395=function(_0x483cb8,_0x26d6df){_0x483cb8=_0x483cb8-0x0;var _0xdd3ca8=_0x3954[_0x483cb8];return _0xdd3ca8;};'use strict';function QueueReport(){this[_0x4395('0x0')]=_0x4395('0x1');this[_0x4395('0x2')]='';this[_0x4395('0x3')]='';this[_0x4395('0x4')]='';this[_0x4395('0x5')]='';this[_0x4395('0x6')]=null;this[_0x4395('0x7')]=null;this[_0x4395('0x8')]=0x1;this[_0x4395('0x9')]=0x1;this[_0x4395('0xa')]=![];this[_0x4395('0xb')]=null;this[_0x4395('0xc')]=![];this['queuecallercompleteAt']=null;this[_0x4395('0xd')]=![];this['queuecallerexitAt']=null;this[_0x4395('0xe')]=0x1;this[_0x4395('0xf')]='';this[_0x4395('0x10')]='';this[_0x4395('0x11')]='';this[_0x4395('0x12')]='';this['context']='';this[_0x4395('0x13')]='';this[_0x4395('0x14')]='';this['holdtime']=0x0;this['assigned']=![];this['lastAssignedTo']='';this[_0x4395('0x15')]=_0x4395('0x16');this[_0x4395('0x17')]=null;this[_0x4395('0x18')]=0x0;this[_0x4395('0x19')]={};}module[_0x4395('0x1a')]=QueueReport; \ No newline at end of file +var _0x02dc=['queuecallerabandonAt','queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','originalposition','connectedlinenum','connectedlinename','accountcode','context','exten','priority','holdtime','assigned','lastAssignedTo','motionChannel','mohtime','variables','inbound','uniqueid','calleridnum','calleridname','queue','queuecallerleaveAt','position','count','queuecallerabandon'];(function(_0x1a36d1,_0x306adc){var _0x143752=function(_0x10258f){while(--_0x10258f){_0x1a36d1['push'](_0x1a36d1['shift']());}};_0x143752(++_0x306adc);}(_0x02dc,0x1dd));var _0xc02d=function(_0x396048,_0x5f428c){_0x396048=_0x396048-0x0;var _0x9240e8=_0x02dc[_0x396048];return _0x9240e8;};'use strict';function QueueReport(){this['type']=_0xc02d('0x0');this[_0xc02d('0x1')]='';this[_0xc02d('0x2')]='';this[_0xc02d('0x3')]='';this[_0xc02d('0x4')]='';this['queuecallerjoinAt']=null;this[_0xc02d('0x5')]=null;this[_0xc02d('0x6')]=0x1;this[_0xc02d('0x7')]=0x1;this[_0xc02d('0x8')]=![];this[_0xc02d('0x9')]=null;this[_0xc02d('0xa')]=![];this[_0xc02d('0xb')]=null;this[_0xc02d('0xc')]=![];this[_0xc02d('0xd')]=null;this[_0xc02d('0xe')]=0x1;this['channel']='';this[_0xc02d('0xf')]='';this[_0xc02d('0x10')]='';this[_0xc02d('0x11')]='';this[_0xc02d('0x12')]='';this[_0xc02d('0x13')]='';this[_0xc02d('0x14')]='';this[_0xc02d('0x15')]=0x0;this[_0xc02d('0x16')]=![];this[_0xc02d('0x17')]='';this[_0xc02d('0x18')]='voice';this['routealias']=null;this[_0xc02d('0x19')]=0x0;this[_0xc02d('0x1a')]={};}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 b4bafd7..49db93f 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 _0x471a=['exports','name','username','remoteUri','password','clientSecret','type','integrationTab','serverUrl'];(function(_0x2283fc,_0xa206f9){var _0x4e6f2c=function(_0x1a44d3){while(--_0x1a44d3){_0x2283fc['push'](_0x2283fc['shift']());}};_0x4e6f2c(++_0xa206f9);}(_0x471a,0x18d));var _0xa471=function(_0x9eb62c,_0x10fd6a){_0x9eb62c=_0x9eb62c-0x0;var _0x32ee4f=_0x471a[_0x9eb62c];return _0x32ee4f;};'use strict';function SalesforceAccount(_0x111399){this['id']=_0x111399['id']||0x0;this[_0xa471('0x0')]=_0x111399[_0xa471('0x0')]||'';this['username']=_0x111399[_0xa471('0x1')]||'';this[_0xa471('0x2')]=_0x111399[_0xa471('0x2')]||'';this[_0xa471('0x3')]=_0x111399['password']||'';this['clientId']=_0x111399['clientId']||'';this[_0xa471('0x4')]=_0x111399['clientSecret']||'';this['securityToken']=_0x111399['securityToken']||'';this[_0xa471('0x5')]=_0x111399[_0xa471('0x5')]||_0xa471('0x6');this['serverUrl']=_0x111399[_0xa471('0x7')]||'';this['Configurations']=_0x111399['Configurations']||{};}module[_0xa471('0x8')]=SalesforceAccount; \ No newline at end of file +var _0x896e=['securityToken','type','integrationTab','serverUrl','Configurations','name','username','remoteUri','password','clientId','clientSecret'];(function(_0x133078,_0x337ba5){var _0x3aafd1=function(_0x320aa4){while(--_0x320aa4){_0x133078['push'](_0x133078['shift']());}};_0x3aafd1(++_0x337ba5);}(_0x896e,0x1e9));var _0xe896=function(_0x2a4392,_0x55be14){_0x2a4392=_0x2a4392-0x0;var _0x561995=_0x896e[_0x2a4392];return _0x561995;};'use strict';function SalesforceAccount(_0xc62635){this['id']=_0xc62635['id']||0x0;this[_0xe896('0x0')]=_0xc62635[_0xe896('0x0')]||'';this[_0xe896('0x1')]=_0xc62635[_0xe896('0x1')]||'';this[_0xe896('0x2')]=_0xc62635[_0xe896('0x2')]||'';this[_0xe896('0x3')]=_0xc62635[_0xe896('0x3')]||'';this[_0xe896('0x4')]=_0xc62635[_0xe896('0x4')]||'';this[_0xe896('0x5')]=_0xc62635['clientSecret']||'';this[_0xe896('0x6')]=_0xc62635[_0xe896('0x6')]||'';this[_0xe896('0x7')]=_0xc62635[_0xe896('0x7')]||_0xe896('0x8');this['serverUrl']=_0xc62635[_0xe896('0x9')]||'';this[_0xe896('0xa')]=_0xc62635[_0xe896('0xa')]||{};}module['exports']=SalesforceAccount; \ No newline at end of file diff --git a/server/services/ami/model/servicenowAccount.js b/server/services/ami/model/servicenowAccount.js index 4a3a092..fa6f631 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 _0x35ff=['username','password','remoteUri','serverUrl','exports','name'];(function(_0x41f073,_0x507baf){var _0x4eafa3=function(_0x1e97f3){while(--_0x1e97f3){_0x41f073['push'](_0x41f073['shift']());}};_0x4eafa3(++_0x507baf);}(_0x35ff,0x1cd));var _0xf35f=function(_0x1f25a3,_0x2a9c8d){_0x1f25a3=_0x1f25a3-0x0;var _0xc97ed6=_0x35ff[_0x1f25a3];return _0xc97ed6;};'use strict';function ServicenowAccount(_0x19c67b){this['id']=_0x19c67b['id']||0x0;this[_0xf35f('0x0')]=_0x19c67b['name']||'';this[_0xf35f('0x1')]=_0x19c67b[_0xf35f('0x1')]||'';this['password']=_0x19c67b[_0xf35f('0x2')]||'';this['remoteUri']=_0x19c67b[_0xf35f('0x3')]||'';this['serverUrl']=_0x19c67b[_0xf35f('0x4')]||'';this['Configurations']=_0x19c67b['Configurations']||{};}module[_0xf35f('0x5')]=ServicenowAccount; \ No newline at end of file +var _0xe367=['name','password','remoteUri','serverUrl','Configurations'];(function(_0x287234,_0x4b9e28){var _0x4bfc27=function(_0x2089b5){while(--_0x2089b5){_0x287234['push'](_0x287234['shift']());}};_0x4bfc27(++_0x4b9e28);}(_0xe367,0x1e5));var _0x7e36=function(_0x29d94e,_0xf386d6){_0x29d94e=_0x29d94e-0x0;var _0x106237=_0xe367[_0x29d94e];return _0x106237;};'use strict';function ServicenowAccount(_0x3e1c07){this['id']=_0x3e1c07['id']||0x0;this['name']=_0x3e1c07[_0x7e36('0x0')]||'';this['username']=_0x3e1c07['username']||'';this[_0x7e36('0x1')]=_0x3e1c07[_0x7e36('0x1')]||'';this[_0x7e36('0x2')]=_0x3e1c07[_0x7e36('0x2')]||'';this[_0x7e36('0x3')]=_0x3e1c07[_0x7e36('0x3')]||'';this[_0x7e36('0x4')]=_0x3e1c07[_0x7e36('0x4')]||{};}module['exports']=ServicenowAccount; \ No newline at end of file diff --git a/server/services/ami/model/sugarcrmAccount.js b/server/services/ami/model/sugarcrmAccount.js index cc691e3..90fac85 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 _0x3916=['password','remoteUri','serverUrl','Configurations','exports','name','username'];(function(_0x40dc83,_0x2afdda){var _0x3694b5=function(_0x12d464){while(--_0x12d464){_0x40dc83['push'](_0x40dc83['shift']());}};_0x3694b5(++_0x2afdda);}(_0x3916,0x18d));var _0x6391=function(_0x265aa2,_0x220072){_0x265aa2=_0x265aa2-0x0;var _0x447a3a=_0x3916[_0x265aa2];return _0x447a3a;};'use strict';function SugarcrmAccount(_0x5b654a){this['id']=_0x5b654a['id']||0x0;this['name']=_0x5b654a[_0x6391('0x0')]||'';this[_0x6391('0x1')]=_0x5b654a['username']||'';this[_0x6391('0x2')]=_0x5b654a[_0x6391('0x2')]||'';this[_0x6391('0x3')]=_0x5b654a['remoteUri']||'';this[_0x6391('0x4')]=_0x5b654a[_0x6391('0x4')]||'';this['Configurations']=_0x5b654a[_0x6391('0x5')]||{};}module[_0x6391('0x6')]=SugarcrmAccount; \ No newline at end of file +var _0x6a96=['name','username','password','remoteUri','serverUrl','Configurations','exports'];(function(_0x120c03,_0x1a8eab){var _0x2f04a8=function(_0x4685c9){while(--_0x4685c9){_0x120c03['push'](_0x120c03['shift']());}};_0x2f04a8(++_0x1a8eab);}(_0x6a96,0x77));var _0x66a9=function(_0xed9fea,_0x5ed774){_0xed9fea=_0xed9fea-0x0;var _0x198f12=_0x6a96[_0xed9fea];return _0x198f12;};'use strict';function SugarcrmAccount(_0x2ba336){this['id']=_0x2ba336['id']||0x0;this[_0x66a9('0x0')]=_0x2ba336[_0x66a9('0x0')]||'';this[_0x66a9('0x1')]=_0x2ba336[_0x66a9('0x1')]||'';this[_0x66a9('0x2')]=_0x2ba336[_0x66a9('0x2')]||'';this[_0x66a9('0x3')]=_0x2ba336[_0x66a9('0x3')]||'';this[_0x66a9('0x4')]=_0x2ba336['serverUrl']||'';this[_0x66a9('0x5')]=_0x2ba336['Configurations']||{};}module[_0x66a9('0x6')]=SugarcrmAccount; \ No newline at end of file diff --git a/server/services/ami/model/telephone.js b/server/services/ami/model/telephone.js index 486bd89..843805b 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 _0xfc45=['accountcode','state','stateTime','status','unknown','address','exports'];(function(_0x11de87,_0x34f940){var _0x567fbd=function(_0x262932){while(--_0x262932){_0x11de87['push'](_0x11de87['shift']());}};_0x567fbd(++_0x34f940);}(_0xfc45,0x7e));var _0x5fc4=function(_0x7f90e5,_0x37af4f){_0x7f90e5=_0x7f90e5-0x0;var _0x4ed55f=_0xfc45[_0x7f90e5];return _0x4ed55f;};'use strict';function Telephone(_0x40bb88){this['id']=_0x40bb88['id']||0x0;this['name']=_0x40bb88['name']||'';this['accountcode']=_0x40bb88[_0x5fc4('0x0')]||'';this[_0x5fc4('0x1')]='unknown';this[_0x5fc4('0x2')]=0x0;this[_0x5fc4('0x3')]=_0x5fc4('0x4');this[_0x5fc4('0x5')]='';}module[_0x5fc4('0x6')]=Telephone; \ No newline at end of file +var _0x28a3=['status','address','name','accountcode','state','unknown','stateTime'];(function(_0x50bff8,_0x2a417f){var _0x56626a=function(_0x256e4c){while(--_0x256e4c){_0x50bff8['push'](_0x50bff8['shift']());}};_0x56626a(++_0x2a417f);}(_0x28a3,0x79));var _0x328a=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x28a3[_0x42cae2];return _0x5f256f;};'use strict';function Telephone(_0x5bf432){this['id']=_0x5bf432['id']||0x0;this[_0x328a('0x0')]=_0x5bf432[_0x328a('0x0')]||'';this[_0x328a('0x1')]=_0x5bf432[_0x328a('0x1')]||'';this[_0x328a('0x2')]=_0x328a('0x3');this[_0x328a('0x4')]=0x0;this[_0x328a('0x5')]=_0x328a('0x3');this[_0x328a('0x6')]='';}module['exports']=Telephone; \ No newline at end of file diff --git a/server/services/ami/model/template.js b/server/services/ami/model/template.js index f9b8377..69e5712 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(_0x1753ee,_0x1dab7e){var _0x596d65=function(_0xbcb988){while(--_0xbcb988){_0x1753ee['push'](_0x1753ee['shift']());}};_0x596d65(++_0x1dab7e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2576d7,_0x167624){_0x2576d7=_0x2576d7-0x0;var _0x16a08c=_0xa9e0[_0x2576d7];return _0x16a08c;};'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 _0xa9e0=['exports','name'];(function(_0x352d84,_0x1543e0){var _0xcf3e=function(_0x13845e){while(--_0x13845e){_0x352d84['push'](_0x352d84['shift']());}};_0xcf3e(++_0x1543e0);}(_0xa9e0,0x123));var _0x0a9e=function(_0x37c22c,_0x28a70d){_0x37c22c=_0x37c22c-0x0;var _0x119d79=_0xa9e0[_0x37c22c];return _0x119d79;};'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 diff --git a/server/services/ami/model/trigger.js b/server/services/ami/model/trigger.js index b477635..5cdb7fd 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 _0x9ffd=['Actions','exports','name','channel','voice','status','AllConditions','AnyConditions'];(function(_0xc87fc2,_0x6f3574){var _0x2892db=function(_0x3f7d32){while(--_0x3f7d32){_0xc87fc2['push'](_0xc87fc2['shift']());}};_0x2892db(++_0x6f3574);}(_0x9ffd,0xaa));var _0xd9ff=function(_0x372b7c,_0x27c13b){_0x372b7c=_0x372b7c-0x0;var _0x184a96=_0x9ffd[_0x372b7c];return _0x184a96;};'use strict';function Trigger(_0x4c26a1){this['id']=_0x4c26a1['id']||0x0;this[_0xd9ff('0x0')]=_0x4c26a1[_0xd9ff('0x0')]||'';this['channel']=_0x4c26a1[_0xd9ff('0x1')]||_0xd9ff('0x2');this[_0xd9ff('0x3')]=_0x4c26a1[_0xd9ff('0x3')]||![];this['AllConditions']=_0x4c26a1[_0xd9ff('0x4')]||[];this[_0xd9ff('0x5')]=_0x4c26a1['AnyConditions']||[];this[_0xd9ff('0x6')]=_0x4c26a1[_0xd9ff('0x6')]||[];}module[_0xd9ff('0x7')]=Trigger; \ No newline at end of file +var _0xda2d=['channel','voice','AllConditions','AnyConditions','Actions','exports','name'];(function(_0x566133,_0x123ab4){var _0x540c58=function(_0x27d9dc){while(--_0x27d9dc){_0x566133['push'](_0x566133['shift']());}};_0x540c58(++_0x123ab4);}(_0xda2d,0x102));var _0xdda2=function(_0x571c14,_0x5dea02){_0x571c14=_0x571c14-0x0;var _0x3f6887=_0xda2d[_0x571c14];return _0x3f6887;};'use strict';function Trigger(_0x2625ed){this['id']=_0x2625ed['id']||0x0;this[_0xdda2('0x0')]=_0x2625ed[_0xdda2('0x0')]||'';this[_0xdda2('0x1')]=_0x2625ed[_0xdda2('0x1')]||_0xdda2('0x2');this['status']=_0x2625ed['status']||![];this['AllConditions']=_0x2625ed[_0xdda2('0x3')]||[];this[_0xdda2('0x4')]=_0x2625ed[_0xdda2('0x4')]||[];this[_0xdda2('0x5')]=_0x2625ed[_0xdda2('0x5')]||[];}module[_0xdda2('0x6')]=Trigger; \ No newline at end of file diff --git a/server/services/ami/model/trunk.js b/server/services/ami/model/trunk.js index bc3c6e0..070020b 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 _0x6fda=['indexOf','split','host','port','domain','refresh','stateRegistry','registrationtime','address','defaultuser','exports','active','name','state','unknown','registry'];(function(_0x3373e3,_0x56e530){var _0x5aa21b=function(_0x3d6938){while(--_0x3d6938){_0x3373e3['push'](_0x3373e3['shift']());}};_0x5aa21b(++_0x56e530);}(_0x6fda,0x13b));var _0xa6fd=function(_0x3f28c2,_0x403615){_0x3f28c2=_0x3f28c2-0x0;var _0x5506be=_0x6fda[_0x3f28c2];return _0x5506be;};'use strict';function Trunk(_0x52304d){this['id']=_0x52304d['id']||0x0;this[_0xa6fd('0x0')]=_0x52304d[_0xa6fd('0x0')]||![];this[_0xa6fd('0x1')]=_0x52304d[_0xa6fd('0x1')]||'';this[_0xa6fd('0x2')]=_0xa6fd('0x3');this['stateTime']=0x0;this['status']=_0xa6fd('0x3');this['registry']=_0x52304d[_0xa6fd('0x4')]&&_0x52304d[_0xa6fd('0x4')][_0xa6fd('0x5')](':')?_0x52304d[_0xa6fd('0x4')][_0xa6fd('0x6')](':')[0x0]:'';this[_0xa6fd('0x7')]='';this[_0xa6fd('0x8')]='';this[_0xa6fd('0x9')]='';this['domainport']='';this[_0xa6fd('0xa')]='';this[_0xa6fd('0xb')]=_0xa6fd('0x3');this[_0xa6fd('0xc')]='';this[_0xa6fd('0xd')]='';this[_0xa6fd('0xe')]=_0x52304d[_0xa6fd('0xe')]||'';}module[_0xa6fd('0xf')]=Trunk; \ No newline at end of file +var _0x7ece=['indexOf','host','domain','refresh','stateRegistry','registrationtime','address','defaultuser','exports','active','name','state','unknown','stateTime','status','registry'];(function(_0x381372,_0xf0a5a){var _0x4e959a=function(_0x25a897){while(--_0x25a897){_0x381372['push'](_0x381372['shift']());}};_0x4e959a(++_0xf0a5a);}(_0x7ece,0x109));var _0xe7ec=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0x7ece[_0x465a0c];return _0x1e202e;};'use strict';function Trunk(_0x451d94){this['id']=_0x451d94['id']||0x0;this[_0xe7ec('0x0')]=_0x451d94[_0xe7ec('0x0')]||![];this[_0xe7ec('0x1')]=_0x451d94[_0xe7ec('0x1')]||'';this[_0xe7ec('0x2')]=_0xe7ec('0x3');this[_0xe7ec('0x4')]=0x0;this[_0xe7ec('0x5')]='unknown';this[_0xe7ec('0x6')]=_0x451d94[_0xe7ec('0x6')]&&_0x451d94[_0xe7ec('0x6')][_0xe7ec('0x7')](':')?_0x451d94[_0xe7ec('0x6')]['split'](':')[0x0]:'';this[_0xe7ec('0x8')]='';this['port']='';this[_0xe7ec('0x9')]='';this['domainport']='';this[_0xe7ec('0xa')]='';this[_0xe7ec('0xb')]='unknown';this[_0xe7ec('0xc')]='';this[_0xe7ec('0xd')]='';this[_0xe7ec('0xe')]=_0x451d94['defaultuser']||'';}module[_0xe7ec('0xf')]=Trunk; \ No newline at end of file diff --git a/server/services/ami/model/voiceExtension.js b/server/services/ami/model/voiceExtension.js index 3c12f37..30d154b 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 _0xd24b=['exten','recordingFormat','none','exports'];(function(_0x51d9f5,_0x2e1d73){var _0x5bf36b=function(_0x3f3c60){while(--_0x3f3c60){_0x51d9f5['push'](_0x51d9f5['shift']());}};_0x5bf36b(++_0x2e1d73);}(_0xd24b,0x118));var _0xbd24=function(_0x3a9193,_0x5d388b){_0x3a9193=_0x3a9193-0x0;var _0x5198e6=_0xd24b[_0x3a9193];return _0x5198e6;};'use strict';function voiceExtension(_0x1f51a1){this['id']=_0x1f51a1['id']||0x0;this[_0xbd24('0x0')]=_0x1f51a1['exten']||'';this[_0xbd24('0x1')]=_0x1f51a1[_0xbd24('0x1')]||_0xbd24('0x2');this['mandatoryDisposition']=_0x1f51a1['mandatoryDisposition']||![];}module[_0xbd24('0x3')]=voiceExtension; \ No newline at end of file +var _0x09ff=['none','mandatoryDisposition','exports','exten','recordingFormat'];(function(_0x6e0fca,_0x23cb98){var _0x3f3c35=function(_0x2e6b52){while(--_0x2e6b52){_0x6e0fca['push'](_0x6e0fca['shift']());}};_0x3f3c35(++_0x23cb98);}(_0x09ff,0x107));var _0xf09f=function(_0x1983d5,_0x46da60){_0x1983d5=_0x1983d5-0x0;var _0x593f8b=_0x09ff[_0x1983d5];return _0x593f8b;};'use strict';function voiceExtension(_0x1dced8){this['id']=_0x1dced8['id']||0x0;this['exten']=_0x1dced8[_0xf09f('0x0')]||'';this[_0xf09f('0x1')]=_0x1dced8[_0xf09f('0x1')]||_0xf09f('0x2');this[_0xf09f('0x3')]=_0x1dced8[_0xf09f('0x3')]||![];}module[_0xf09f('0x4')]=voiceExtension; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueue.js b/server/services/ami/model/voiceQueue.js index 96d3305..1b9ad66 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 _0x27af=['outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundReCallsDay','outboundAbandonedDay','startPredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalErlangCalls','predictiveIntervalHitRate','erlangCallToSecond','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','queueSummaryCountersUpdated','exports','wav','wav49','gsm','leastrecent','linear','roundrobin','rrmemory','rrordered','wrandom','name','monitor_format','type','inbound','waiting','total','sumHoldTime','sumBillable','unmanaged','abandoned','available','busy','inUse','invalid','loggedIn','notInUse','onHold','paused','ringInUse','unavailable','unknown','acw','acwTimeout','autopause','message','temp','dialTimezone','dialGlobalInterval','dialActive','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','pTalking','timeout','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundCongestionCallsDay'];(function(_0x45346d,_0xffd56b){var _0x5ce7ca=function(_0x27ce87){while(--_0x27ce87){_0x45346d['push'](_0x45346d['shift']());}};_0x5ce7ca(++_0xffd56b);}(_0x27af,0x199));var _0xf27a=function(_0x412833,_0x2b4012){_0x412833=_0x412833-0x0;var _0xb37474=_0x27af[_0x412833];return _0xb37474;};'use strict';var monitorFormat={'wav':_0xf27a('0x0'),'wav49':_0xf27a('0x1'),'gsm':_0xf27a('0x2')};var strategy={'fewestcalls':'fewestcalls','leastrecent':_0xf27a('0x3'),'linear':_0xf27a('0x4'),'random':'random','ringall':'ringall','rr':_0xf27a('0x5'),'rrmemory':_0xf27a('0x6'),'rrordered':_0xf27a('0x7'),'wrandom':_0xf27a('0x8')};function VoiceQueue(_0x2a8645){this['id']=_0x2a8645['id']||0x0;this[_0xf27a('0x9')]=_0x2a8645[_0xf27a('0x9')]||'';this[_0xf27a('0xa')]=_0x2a8645['monitor_format']||'';this['type']=_0x2a8645[_0xf27a('0xb')]||_0xf27a('0xc');this[_0xf27a('0xd')]=0x0;this[_0xf27a('0xe')]=0x0;this['answered']=0x0;this['sumDuration']=0x0;this[_0xf27a('0xf')]=0x0;this[_0xf27a('0x10')]=0x0;this[_0xf27a('0x11')]=0x0;this[_0xf27a('0x12')]=0x0;this[_0xf27a('0x13')]=0x0;this[_0xf27a('0x14')]=0x0;this[_0xf27a('0x15')]=0x0;this[_0xf27a('0x16')]=0x0;this[_0xf27a('0x17')]=0x0;this[_0xf27a('0x18')]=0x0;this[_0xf27a('0x19')]=0x0;this[_0xf27a('0x1a')]=0x0;this['ringing']=0x0;this[_0xf27a('0x1b')]=0x0;this['talking']=0x0;this[_0xf27a('0x1c')]=0x0;this[_0xf27a('0x1d')]=0x0;this['acw']=_0x2a8645[_0xf27a('0x1e')]||![];this[_0xf27a('0x1f')]=_0x2a8645['acwTimeout']||0xa;this['autopause']=_0x2a8645[_0xf27a('0x20')]||'no';this['sendMessageOneNotActive']=!![];this[_0xf27a('0x21')]='';this['statusMessage']='';this['originated']=0x0;this[_0xf27a('0x22')]=0x0;this['dialTimezone']=_0x2a8645[_0xf27a('0x23')]||null;this[_0xf27a('0x24')]=_0x2a8645['dialGlobalInterval']?_0x2a8645[_0xf27a('0x24')]:null;this[_0xf27a('0x25')]=_0x2a8645[_0xf27a('0x25')];this['dialMethod']=_0x2a8645['dialMethod']||_0xf27a('0x26');this[_0xf27a('0x27')]=_0x2a8645['dialLimitChannel']||0x0;this['dialLimitQueue']=_0x2a8645[_0xf27a('0x28')]||0x0;this[_0xf27a('0x29')]=_0x2a8645[_0xf27a('0x29')]||0x1;this['dialPredictiveOptimization']=_0x2a8645['dialPredictiveOptimization']||_0xf27a('0x2a');this['dialPredictiveOptimizationPercentage']=_0x2a8645[_0xf27a('0x2b')]||0.03;this[_0xf27a('0x2c')]=_0x2a8645['dialPredictiveInterval']||0x258;this[_0xf27a('0x2d')]=_0x2a8645[_0xf27a('0x2d')]||_0xf27a('0x2e');this[_0xf27a('0x2f')]=_0x2a8645[_0xf27a('0x2f')]||_0xf27a('0x2e');this[_0xf27a('0x30')]=_0x2a8645['dialOriginateTimeout']||0x1e;this[_0xf27a('0x31')]=_0x2a8645[_0xf27a('0x31')]||_0xf27a('0x32');this[_0xf27a('0x33')]=_0x2a8645[_0xf27a('0x33')]||0x3;this['dialQueueProject']=_0x2a8645[_0xf27a('0x34')]||undefined;this['dialCongestionMaxRetry']=_0x2a8645['dialCongestionMaxRetry']||0x3;this['dialCongestionRetryFrequency']=_0x2a8645['dialCongestionRetryFrequency']||0x96;this[_0xf27a('0x35')]=_0x2a8645[_0xf27a('0x35')]||0x3;this[_0xf27a('0x36')]=_0x2a8645[_0xf27a('0x36')]||0x96;this[_0xf27a('0x37')]=_0x2a8645['dialNoAnswerMaxRetry']||0x3;this['dialNoAnswerRetryFrequency']=_0x2a8645[_0xf27a('0x38')]||0x96;this[_0xf27a('0x39')]=_0x2a8645['dialNoSuchNumberMaxRetry']||0x3;this[_0xf27a('0x3a')]=_0x2a8645[_0xf27a('0x3a')]||0x96;this[_0xf27a('0x3b')]=_0x2a8645[_0xf27a('0x3b')]||0x3;this[_0xf27a('0x3c')]=_0x2a8645[_0xf27a('0x3c')]||0x96;this['dialAbandonedMaxRetry']=_0x2a8645['dialAbandonedMaxRetry']||0x3;this[_0xf27a('0x3d')]=_0x2a8645[_0xf27a('0x3d')]||0x96;this[_0xf27a('0x3e')]=_0x2a8645[_0xf27a('0x3e')]||0x3;this[_0xf27a('0x3f')]=_0x2a8645['dialMachineRetryFrequency']||0x96;this[_0xf27a('0x40')]=_0x2a8645[_0xf27a('0x40')]||0x3;this['dialAgentRejectRetryFrequency']=_0x2a8645['dialAgentRejectRetryFrequency']||0x96;this[_0xf27a('0x41')]=_0x2a8645[_0xf27a('0x41')]||0x3;this['dialGlobalMaxRetry']=_0x2a8645[_0xf27a('0x42')]||0x4;this[_0xf27a('0x43')]=_0x2a8645['Trunk']?_0x2a8645['Trunk']:undefined;this[_0xf27a('0x44')]=_0x2a8645[_0xf27a('0x44')]?_0x2a8645[_0xf27a('0x44')]:undefined;this[_0xf27a('0x45')]=_0x2a8645['dialPrefix']||undefined;this['Interval']=_0x2a8645[_0xf27a('0x46')]?_0x2a8645['Interval']:undefined;this[_0xf27a('0x47')]=_0x2a8645['dialOrderByScheduledAt']||_0xf27a('0x48');this[_0xf27a('0x49')]=_0x2a8645[_0xf27a('0x49')]||undefined;this[_0xf27a('0x4a')]=_0x2a8645[_0xf27a('0x4a')]||undefined;this[_0xf27a('0x4b')]=strategy[_0x2a8645[_0xf27a('0x4b')]];this[_0xf27a('0x4c')]=!![];this[_0xf27a('0x4d')]=_0x2a8645['dialAMDActive']||![];this['dialAMDInitialSilence']=_0x2a8645['dialAMDInitialSilence'];this[_0xf27a('0x4e')]=_0x2a8645[_0xf27a('0x4e')];this[_0xf27a('0x4f')]=_0x2a8645[_0xf27a('0x4f')];this[_0xf27a('0x50')]=_0x2a8645[_0xf27a('0x50')];this[_0xf27a('0x51')]=_0x2a8645[_0xf27a('0x51')];this[_0xf27a('0x52')]=_0x2a8645[_0xf27a('0x52')];this[_0xf27a('0x53')]=_0x2a8645[_0xf27a('0x53')];this[_0xf27a('0x54')]=_0x2a8645['dialAMDSilenceThreshold'];this[_0xf27a('0x55')]=_0x2a8645['dialAMDMaximumWordLength'];this['outboundRejectCallsDay']=0x0;this[_0xf27a('0x56')]=0x0;this[_0xf27a('0x57')]=_0x2a8645['timeout'];this['outboundAnswerCallsDay']=0x0;this[_0xf27a('0x58')]=0x0;this[_0xf27a('0x59')]=0x0;this['outboundBusyCallsDay']=0x0;this[_0xf27a('0x5a')]=0x0;this[_0xf27a('0x5b')]=0x0;this[_0xf27a('0x5c')]=0x0;this['outboundBlacklistCallsDay']=0x0;this[_0xf27a('0x5d')]=0x0;this['outboundDropCallsDayCallersExit']=0x0;this[_0xf27a('0x5e')]=0x0;this[_0xf27a('0x5f')]=0x0;this[_0xf27a('0x60')]=0x0;this[_0xf27a('0x61')]=0x0;this['startProgressive']=undefined;this[_0xf27a('0x62')]=undefined;this['handlePredictive']=undefined;this[_0xf27a('0x63')]=1.05;this[_0xf27a('0x64')]=0x0;this[_0xf27a('0x65')]=0x0;this[_0xf27a('0x66')]=0x0;this[_0xf27a('0x67')]=0x0;this['predictiveIntervalAvgHoldtime']=0x0;this[_0xf27a('0x68')]=0x0;this[_0xf27a('0x69')]=0x0;this[_0xf27a('0x6a')]=0x0;this[_0xf27a('0x6b')]=_0x2a8645['dialPredictiveIntervalMaxThreshold']||0x14;this[_0xf27a('0x6c')]=_0x2a8645[_0xf27a('0x6d')]||0xa;this[_0xf27a('0x6e')]=0x0;this['predictiveIntervalErlangCallsDroppedCalls']=0x0;this[_0xf27a('0x6f')]=0x1;this['erlangCalls']=0x0;this[_0xf27a('0x70')]=0x0;this['erlangAbandonmentRate']=0x0;this[_0xf27a('0x71')]=0x0;this[_0xf27a('0x72')]=_0x2a8645[_0xf27a('0x72')]||0x1e;this[_0xf27a('0x73')]=_0x2a8645['dialRecallInQueue']||![];this[_0xf27a('0x74')]=!!_0x2a8645[_0xf27a('0x74')]||![];this['dialPreviewRecallmeReminder']=!!_0x2a8645[_0xf27a('0x75')]||![];this[_0xf27a('0x76')]=_0x2a8645['dialQueueProject2']||undefined;this['dialAgiAfterHangupClient']=_0x2a8645[_0xf27a('0x77')]||![];this[_0xf27a('0x78')]=_0x2a8645[_0xf27a('0x78')]||![];this[_0xf27a('0xa')]=monitorFormat[_0x2a8645[_0xf27a('0xa')]]?monitorFormat[_0x2a8645[_0xf27a('0xa')]]:undefined;this[_0xf27a('0x79')]=_0x2a8645[_0xf27a('0x79')]||![];this[_0xf27a('0x7a')]=_0x2a8645[_0xf27a('0x7a')]?_0x2a8645['mandatoryDispositionPause']:undefined;this[_0xf27a('0x7b')]=![];}module[_0xf27a('0x7c')]=VoiceQueue; \ No newline at end of file +var _0x174d=['DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','startProgressive','startPredictive','handlePredictive','predictiveIntervalTotalCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','queueSummaryCountersUpdated','exports','gsm','fewestcalls','leastrecent','random','roundrobin','rrordered','wrandom','name','monitor_format','type','inbound','total','answered','sumDuration','sumHoldTime','sumBillable','unmanaged','abandoned','available','busy','inUse','invalid','loggedIn','notInUse','onHold','paused','ringing','ringInUse','talking','unavailable','acw','acwTimeout','sendMessageOneNotActive','message','statusMessage','originated','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','anonymous','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt'];(function(_0x332d11,_0x1a2cc3){var _0x25418c=function(_0x52b970){while(--_0x52b970){_0x332d11['push'](_0x332d11['shift']());}};_0x25418c(++_0x1a2cc3);}(_0x174d,0x1ca));var _0xd174=function(_0x4723d1,_0x515d2e){_0x4723d1=_0x4723d1-0x0;var _0x335b7f=_0x174d[_0x4723d1];return _0x335b7f;};'use strict';var monitorFormat={'wav':'wav','wav49':'wav49','gsm':_0xd174('0x0')};var strategy={'fewestcalls':_0xd174('0x1'),'leastrecent':_0xd174('0x2'),'linear':'linear','random':_0xd174('0x3'),'ringall':'ringall','rr':_0xd174('0x4'),'rrmemory':'rrmemory','rrordered':_0xd174('0x5'),'wrandom':_0xd174('0x6')};function VoiceQueue(_0x35ae3f){this['id']=_0x35ae3f['id']||0x0;this['name']=_0x35ae3f[_0xd174('0x7')]||'';this[_0xd174('0x8')]=_0x35ae3f[_0xd174('0x8')]||'';this['type']=_0x35ae3f[_0xd174('0x9')]||_0xd174('0xa');this['waiting']=0x0;this[_0xd174('0xb')]=0x0;this[_0xd174('0xc')]=0x0;this[_0xd174('0xd')]=0x0;this[_0xd174('0xe')]=0x0;this[_0xd174('0xf')]=0x0;this[_0xd174('0x10')]=0x0;this[_0xd174('0x11')]=0x0;this[_0xd174('0x12')]=0x0;this[_0xd174('0x13')]=0x0;this[_0xd174('0x14')]=0x0;this[_0xd174('0x15')]=0x0;this[_0xd174('0x16')]=0x0;this[_0xd174('0x17')]=0x0;this[_0xd174('0x18')]=0x0;this[_0xd174('0x19')]=0x0;this[_0xd174('0x1a')]=0x0;this[_0xd174('0x1b')]=0x0;this[_0xd174('0x1c')]=0x0;this[_0xd174('0x1d')]=0x0;this['unknown']=0x0;this[_0xd174('0x1e')]=_0x35ae3f['acw']||![];this[_0xd174('0x1f')]=_0x35ae3f[_0xd174('0x1f')]||0xa;this['autopause']=_0x35ae3f['autopause']||'no';this[_0xd174('0x20')]=!![];this[_0xd174('0x21')]='';this[_0xd174('0x22')]='';this[_0xd174('0x23')]=0x0;this[_0xd174('0x24')]=0x0;this[_0xd174('0x25')]=_0x35ae3f['dialTimezone']||null;this[_0xd174('0x26')]=_0x35ae3f[_0xd174('0x26')]?_0x35ae3f['dialGlobalInterval']:null;this[_0xd174('0x27')]=_0x35ae3f[_0xd174('0x27')];this[_0xd174('0x28')]=_0x35ae3f[_0xd174('0x28')]||_0xd174('0x29');this[_0xd174('0x2a')]=_0x35ae3f['dialLimitChannel']||0x0;this['dialLimitQueue']=_0x35ae3f[_0xd174('0x2b')]||0x0;this[_0xd174('0x2c')]=_0x35ae3f['dialPowerLevel']||0x1;this[_0xd174('0x2d')]=_0x35ae3f[_0xd174('0x2d')]||_0xd174('0x2e');this[_0xd174('0x2f')]=_0x35ae3f[_0xd174('0x2f')]||0.03;this[_0xd174('0x30')]=_0x35ae3f[_0xd174('0x30')]||0x258;this['dialOriginateCallerIdName']=_0x35ae3f[_0xd174('0x31')]||'anonymous';this['dialOriginateCallerIdNumber']=_0x35ae3f[_0xd174('0x32')]||_0xd174('0x33');this[_0xd174('0x34')]=_0x35ae3f[_0xd174('0x34')]||0x1e;this['dialQueueOptions']=_0x35ae3f[_0xd174('0x35')]||_0xd174('0x36');this[_0xd174('0x37')]=_0x35ae3f[_0xd174('0x37')]||0x3;this['dialQueueProject']=_0x35ae3f['dialQueueProject']||undefined;this['dialCongestionMaxRetry']=_0x35ae3f['dialCongestionMaxRetry']||0x3;this[_0xd174('0x38')]=_0x35ae3f[_0xd174('0x38')]||0x96;this[_0xd174('0x39')]=_0x35ae3f[_0xd174('0x39')]||0x3;this[_0xd174('0x3a')]=_0x35ae3f['dialBusyRetryFrequency']||0x96;this[_0xd174('0x3b')]=_0x35ae3f[_0xd174('0x3b')]||0x3;this['dialNoAnswerRetryFrequency']=_0x35ae3f[_0xd174('0x3c')]||0x96;this['dialNoSuchNumberMaxRetry']=_0x35ae3f[_0xd174('0x3d')]||0x3;this[_0xd174('0x3e')]=_0x35ae3f[_0xd174('0x3e')]||0x96;this[_0xd174('0x3f')]=_0x35ae3f[_0xd174('0x3f')]||0x3;this[_0xd174('0x40')]=_0x35ae3f[_0xd174('0x40')]||0x96;this[_0xd174('0x41')]=_0x35ae3f['dialAbandonedMaxRetry']||0x3;this[_0xd174('0x42')]=_0x35ae3f['dialAbandonedRetryFrequency']||0x96;this[_0xd174('0x43')]=_0x35ae3f[_0xd174('0x43')]||0x3;this['dialMachineRetryFrequency']=_0x35ae3f[_0xd174('0x44')]||0x96;this[_0xd174('0x45')]=_0x35ae3f[_0xd174('0x45')]||0x3;this[_0xd174('0x46')]=_0x35ae3f[_0xd174('0x46')]||0x96;this[_0xd174('0x47')]=_0x35ae3f['callAdditionalPhoneAfterMin']||0x3;this[_0xd174('0x48')]=_0x35ae3f['dialGlobalMaxRetry']||0x4;this[_0xd174('0x49')]=_0x35ae3f[_0xd174('0x49')]?_0x35ae3f[_0xd174('0x49')]:undefined;this[_0xd174('0x4a')]=_0x35ae3f[_0xd174('0x4a')]?_0x35ae3f['TrunkBackup']:undefined;this['dialPrefix']=_0x35ae3f[_0xd174('0x4b')]||undefined;this['Interval']=_0x35ae3f[_0xd174('0x4c')]?_0x35ae3f[_0xd174('0x4c')]:undefined;this[_0xd174('0x4d')]=_0x35ae3f['dialOrderByScheduledAt']||_0xd174('0x4e');this[_0xd174('0x4f')]=_0x35ae3f[_0xd174('0x4f')]||undefined;this[_0xd174('0x50')]=_0x35ae3f['dialCutDigit']||undefined;this[_0xd174('0x51')]=strategy[_0x35ae3f['strategy']];this[_0xd174('0x52')]=!![];this[_0xd174('0x53')]=_0x35ae3f[_0xd174('0x53')]||![];this['dialAMDInitialSilence']=_0x35ae3f[_0xd174('0x54')];this[_0xd174('0x55')]=_0x35ae3f[_0xd174('0x55')];this[_0xd174('0x56')]=_0x35ae3f[_0xd174('0x56')];this[_0xd174('0x57')]=_0x35ae3f['dialAMDTotalAnalysisTime'];this[_0xd174('0x58')]=_0x35ae3f[_0xd174('0x58')];this[_0xd174('0x59')]=_0x35ae3f[_0xd174('0x59')];this[_0xd174('0x5a')]=_0x35ae3f['dialAMDMaximumNumberOfWords'];this[_0xd174('0x5b')]=_0x35ae3f[_0xd174('0x5b')];this[_0xd174('0x5c')]=_0x35ae3f[_0xd174('0x5c')];this[_0xd174('0x5d')]=0x0;this[_0xd174('0x5e')]=0x0;this[_0xd174('0x5f')]=_0x35ae3f[_0xd174('0x5f')];this[_0xd174('0x60')]=0x0;this[_0xd174('0x61')]=0x0;this[_0xd174('0x62')]=0x0;this['outboundBusyCallsDay']=0x0;this[_0xd174('0x63')]=0x0;this[_0xd174('0x64')]=0x0;this[_0xd174('0x65')]=0x0;this[_0xd174('0x66')]=0x0;this[_0xd174('0x67')]=0x0;this[_0xd174('0x68')]=0x0;this[_0xd174('0x69')]=0x0;this['outboundDropCallsDayACS']=0x0;this['outboundReCallsDay']=0x0;this['outboundAbandonedDay']=0x0;this[_0xd174('0x6a')]=undefined;this[_0xd174('0x6b')]=undefined;this[_0xd174('0x6c')]=undefined;this['predictiveIntervalMultiplicativeFactor']=1.05;this[_0xd174('0x6d')]=0x0;this['predictiveIntervalAnsweredCalls']=0x0;this['predictiveIntervalDroppedCallsCallersExit']=0x0;this[_0xd174('0x6e')]=0x0;this['predictiveIntervalAvgHoldtime']=0x0;this[_0xd174('0x6f')]=0x0;this[_0xd174('0x70')]=0x0;this[_0xd174('0x71')]=0x0;this[_0xd174('0x72')]=_0x35ae3f[_0xd174('0x73')]||0x14;this[_0xd174('0x74')]=_0x35ae3f[_0xd174('0x73')]||0xa;this[_0xd174('0x75')]=0x0;this[_0xd174('0x76')]=0x0;this['predictiveIntervalHitRate']=0x1;this[_0xd174('0x77')]=0x0;this[_0xd174('0x78')]=0x0;this[_0xd174('0x79')]=0x0;this[_0xd174('0x7a')]=0x0;this['dialRecallMeTimeout']=_0x35ae3f[_0xd174('0x7b')]||0x1e;this[_0xd174('0x7c')]=_0x35ae3f['dialRecallInQueue']||![];this[_0xd174('0x7d')]=!!_0x35ae3f[_0xd174('0x7d')]||![];this[_0xd174('0x7e')]=!!_0x35ae3f[_0xd174('0x7e')]||![];this[_0xd174('0x7f')]=_0x35ae3f[_0xd174('0x7f')]||undefined;this[_0xd174('0x80')]=_0x35ae3f[_0xd174('0x80')]||![];this['dialAgiAfterHangupAgent']=_0x35ae3f[_0xd174('0x81')]||![];this['monitor_format']=monitorFormat[_0x35ae3f[_0xd174('0x8')]]?monitorFormat[_0x35ae3f[_0xd174('0x8')]]:undefined;this[_0xd174('0x82')]=_0x35ae3f['mandatoryDisposition']||![];this[_0xd174('0x83')]=_0x35ae3f['mandatoryDispositionPause']?_0x35ae3f[_0xd174('0x83')]:undefined;this[_0xd174('0x84')]=![];}module[_0xd174('0x85')]=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueueSummary.js b/server/services/ami/model/voiceQueueSummary.js index b0190fd..0180246 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 _0xfb8f=['dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','message','statusMessage','Trunk','active','callerid','prototype','createReport','onHold','loggedin','callers','online','incall','status','booked','length','queue','exten','xcally-motion-preview','compareToInboundQueue','some','compareToOutboundQueue','exports','loggedIn','ringing','talking','waiting','available','answered','loggedInDb','originated','outboundAbandonedCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundReCallsDay','paused','pTalking','sumBillable','sumDuration','name','strategy','abandoned','busy','inUse','invalid','notInUse','ringInUse','sumHoldTime','total','type','unavailable','unknown','unmanaged','outbound','dialActive'];(function(_0x40a7c9,_0x3d6333){var _0xa376f8=function(_0x3e3036){while(--_0x3e3036){_0x40a7c9['push'](_0x40a7c9['shift']());}};_0xa376f8(++_0x3d6333);}(_0xfb8f,0x18c));var _0xffb8=function(_0x286d33,_0x1cbd64){_0x286d33=_0x286d33-0x0;var _0x45a787=_0xfb8f[_0x286d33];return _0x45a787;};'use strict';var INBOUND_COUNTERS=['available',_0xffb8('0x0'),'loggedInDb','paused',_0xffb8('0x1'),_0xffb8('0x2'),_0xffb8('0x3')];var OUTBOUND_COUNTERS=[_0xffb8('0x4'),_0xffb8('0x5'),'inUse',_0xffb8('0x0'),_0xffb8('0x6'),_0xffb8('0x7'),_0xffb8('0x8'),'outboundAnswerCallsDay','outboundBlacklistCallsDay',_0xffb8('0x9'),_0xffb8('0xa'),_0xffb8('0xb'),_0xffb8('0xc'),_0xffb8('0xd'),'outboundRejectCallsDay','outboundUnknownCallsDay',_0xffb8('0xe'),_0xffb8('0xf'),_0xffb8('0x2'),_0xffb8('0x10'),_0xffb8('0x11'),'total',_0xffb8('0x3')];function VoiceQueueSummary(_0xb605b3){this['id']=_0xb605b3['id'];this[_0xffb8('0x12')]=_0xb605b3[_0xffb8('0x12')];this[_0xffb8('0x13')]=_0xb605b3['strategy'];this[_0xffb8('0x14')]=_0xb605b3[_0xffb8('0x14')]||0x0;this[_0xffb8('0x5')]=_0xb605b3['answered']||0x0;this[_0xffb8('0x4')]=_0xb605b3['available']||0x0;this['busy']=_0xb605b3[_0xffb8('0x15')]||0x0;this[_0xffb8('0x16')]=_0xb605b3[_0xffb8('0x16')]||0x0;this[_0xffb8('0x17')]=_0xb605b3[_0xffb8('0x17')]||0x0;this[_0xffb8('0x0')]=_0xb605b3[_0xffb8('0x0')]||0x0;this[_0xffb8('0x6')]=_0xb605b3[_0xffb8('0x6')]||0x0;this['onHold']=_0xb605b3['onHold']||0x0;this[_0xffb8('0x18')]=_0xb605b3['notInUse']||0x0;this['paused']=_0xb605b3['paused']||0x0;this['ringing']=_0xb605b3[_0xffb8('0x1')]||0x0;this[_0xffb8('0x19')]=_0xb605b3[_0xffb8('0x19')];this[_0xffb8('0x10')]=_0xb605b3['sumBillable'];this[_0xffb8('0x11')]=_0xb605b3[_0xffb8('0x11')];this[_0xffb8('0x1a')]=_0xb605b3['sumHoldTime']||0x0;this[_0xffb8('0x2')]=_0xb605b3['talking']||0x0;this[_0xffb8('0x1b')]=_0xb605b3[_0xffb8('0x1b')]||0x0;this['type']=_0xb605b3[_0xffb8('0x1c')];this[_0xffb8('0x1d')]=_0xb605b3[_0xffb8('0x1d')]||0x0;this[_0xffb8('0x1e')]=_0xb605b3[_0xffb8('0x1e')]||0x0;this[_0xffb8('0x1f')]=_0xb605b3[_0xffb8('0x1f')]||0x0;this['waiting']=_0xb605b3[_0xffb8('0x3')]||0x0;if(_0xb605b3['type']===_0xffb8('0x20')){this[_0xffb8('0xf')]=_0xb605b3['pTalking']||0x0;this['dialActive']=_0xb605b3[_0xffb8('0x21')];this[_0xffb8('0x22')]=_0xb605b3['dialMethod'];this[_0xffb8('0x23')]=_0xb605b3[_0xffb8('0x23')];this['dialOriginateCallerIdNumber']=_0xb605b3[_0xffb8('0x24')];this['dialOriginateTimeout']=_0xb605b3['dialOriginateTimeout'];this[_0xffb8('0x25')]=_0xb605b3[_0xffb8('0x25')];this[_0xffb8('0x26')]=_0xb605b3['temp'];this['outboundAnswerAgiCallsDay']=_0xb605b3[_0xffb8('0x27')];this[_0xffb8('0x28')]=_0xb605b3[_0xffb8('0x28')];this[_0xffb8('0x29')]=_0xb605b3[_0xffb8('0x29')];this[_0xffb8('0x9')]=_0xb605b3['outboundBusyCallsDay'];this[_0xffb8('0xa')]=_0xb605b3['outboundCongestionCallsDay'];this[_0xffb8('0x2a')]=_0xb605b3[_0xffb8('0x2a')];this['outboundDropCallsDayCallersExit']=_0xb605b3[_0xffb8('0x2b')];this[_0xffb8('0x2c')]=_0xb605b3[_0xffb8('0x2c')];this[_0xffb8('0xb')]=_0xb605b3[_0xffb8('0xb')];this[_0xffb8('0xc')]=_0xb605b3['outboundNoSuchCallsDay'];this[_0xffb8('0x2d')]=_0xb605b3[_0xffb8('0x2d')];this[_0xffb8('0xd')]=_0xb605b3[_0xffb8('0xd')];this[_0xffb8('0x2e')]=_0xb605b3[_0xffb8('0x2e')];this[_0xffb8('0x2f')]=_0xb605b3[_0xffb8('0x2f')];this['predictiveIntervalAnsweredCalls']=_0xb605b3['predictiveIntervalAnsweredCalls'];this['predictiveIntervalAvgHoldtime']=_0xb605b3[_0xffb8('0x30')];this[_0xffb8('0x31')]=_0xb605b3[_0xffb8('0x31')];this['predictiveIntervalDroppedCallsCallersExit']=_0xb605b3[_0xffb8('0x32')];this[_0xffb8('0x33')]=_0xb605b3['predictiveIntervalDroppedCallsTimeout'];this[_0xffb8('0x34')]=_0xb605b3[_0xffb8('0x34')];this['predictiveIntervalErlangCallsDroppedCalls']=_0xb605b3['predictiveIntervalErlangCallsDroppedCalls'];this[_0xffb8('0x35')]=_0xb605b3[_0xffb8('0x35')];this['predictiveIntervalMultiplicativeFactor']=_0xb605b3[_0xffb8('0x36')];this[_0xffb8('0x37')]=_0xb605b3['predictiveIntervalPauses'];this[_0xffb8('0x38')]=_0xb605b3[_0xffb8('0x38')];this[_0xffb8('0x39')]=_0xb605b3[_0xffb8('0x39')];this[_0xffb8('0x7')]=_0xb605b3[_0xffb8('0x7')];this[_0xffb8('0x3a')]=_0xb605b3['erlangCalls'];this['erlangCallToSecond']=_0xb605b3[_0xffb8('0x3b')];this[_0xffb8('0x3c')]=_0xb605b3['erlangAbandonmentRate'];this['erlangBusyFactor']=_0xb605b3[_0xffb8('0x3d')];this[_0xffb8('0x3e')]=_0xb605b3['startPredictive'];this[_0xffb8('0x3f')]=_0xb605b3[_0xffb8('0x3f')];this[_0xffb8('0x40')]=_0xb605b3['message'];this[_0xffb8('0x41')]=_0xb605b3[_0xffb8('0x41')];}if(_0xb605b3[_0xffb8('0x42')]){this[_0xffb8('0x42')]={'id':_0xb605b3[_0xffb8('0x42')]['id'],'name':_0xb605b3['Trunk'][_0xffb8('0x12')],'active':_0xb605b3[_0xffb8('0x42')][_0xffb8('0x43')],'callerid':_0xb605b3[_0xffb8('0x42')][_0xffb8('0x44')]};}}VoiceQueueSummary[_0xffb8('0x45')][_0xffb8('0x46')]=function(_0x179770,_0x2b441d,_0x3ad842,_0x3f57f1){this[_0xffb8('0x6')]=0x0;this[_0xffb8('0x2')]=0x0;this[_0xffb8('0xe')]=0x0;this[_0xffb8('0x1e')]=0x0;this[_0xffb8('0x18')]=0x0;this[_0xffb8('0x16')]=0x0;this[_0xffb8('0x15')]=0x0;this[_0xffb8('0x17')]=0x0;this[_0xffb8('0x1d')]=0x0;this['ringing']=0x0;this[_0xffb8('0x19')]=0x0;this[_0xffb8('0x47')]=0x0;if(_0x3ad842){if(_0x3ad842[_0xffb8('0x4')]){this[_0xffb8('0x4')]=Number(_0x3ad842['available']);}if(_0x3ad842['loggedin']){this[_0xffb8('0x0')]=Number(_0x3ad842[_0xffb8('0x48')]);}if(_0x3ad842[_0xffb8('0x49')]){this[_0xffb8('0x3')]=Number(_0x3ad842['callers']);}}for(var _0x31cd7d=0x0;_0x31cd7d<_0x179770['length'];_0x31cd7d++){var _0x27ec7a=_0x2b441d['SIP/'+_0x179770[_0x31cd7d][_0xffb8('0x12')]];if(_0x27ec7a&&_0x27ec7a[_0xffb8('0x4a')]){this[_0xffb8('0x6')]+=0x1;}if(_0x179770[_0x31cd7d][_0xffb8('0x4b')]==='1'){this['talking']+=0x1;}if(_0x179770[_0x31cd7d]['paused']==='1'&&!['2','7','8']['includes'](_0x179770[_0x31cd7d][_0xffb8('0x4c')])){this['paused']+=0x1;}switch(_0x179770[_0x31cd7d][_0xffb8('0x4c')]){case'0':this[_0xffb8('0x1e')]+=0x1;break;case'1':this[_0xffb8('0x18')]+=0x1;break;case'2':this['inUse']+=0x1;break;case'3':this[_0xffb8('0x15')]+=0x1;break;case'4':this[_0xffb8('0x17')]+=0x1;break;case'5':this[_0xffb8('0x1d')]+=0x1;break;case'6':this[_0xffb8('0x1')]+=0x1;break;case'7':this['ringInUse']+=0x1;break;case'8':this['onHold']+=0x1;break;}}if(this['dialMethod']===_0xffb8('0x4d')){var _0x22b1e0=Object['keys'](_0x3f57f1);for(var _0x298b3d=0x0;_0x298b3d<_0x22b1e0[_0xffb8('0x4e')];_0x298b3d++){var _0x2a8717=_0x22b1e0[_0x298b3d];var _0x35b40b=_0x3f57f1[_0x2a8717];if(_0x35b40b[_0xffb8('0x4f')]===this[_0xffb8('0x12')]&&_0x35b40b[_0xffb8('0x1c')]==='dialer'&&_0x35b40b[_0xffb8('0x50')]===_0xffb8('0x51')){this['talking']+=0x1;}}if(this[_0xffb8('0x2')]>this[_0xffb8('0x16')]){this[_0xffb8('0x2')]=this[_0xffb8('0x16')];}this['pTalking']=0x0;}return this;};VoiceQueueSummary[_0xffb8('0x45')][_0xffb8('0x52')]=function(_0x46d7cd){var _0x2c3b05=![];if(_0x46d7cd){_0x2c3b05=INBOUND_COUNTERS[_0xffb8('0x53')](function(_0x40fe7b){return this[_0x40fe7b]!==_0x46d7cd[_0x40fe7b];},this);}return _0x2c3b05;};VoiceQueueSummary[_0xffb8('0x45')][_0xffb8('0x54')]=function(_0x1cb3ee){var _0x4bb597=![];var _0x53b156=![];var _0x38a755=![];if(_0x1cb3ee){_0x4bb597=this[_0xffb8('0x22')]!==_0x1cb3ee[_0xffb8('0x22')]||this[_0xffb8('0x21')]!==_0x1cb3ee[_0xffb8('0x21')]||this['message']!==_0x1cb3ee[_0xffb8('0x40')]||this[_0xffb8('0x41')]!==_0x1cb3ee[_0xffb8('0x41')];_0x53b156=OUTBOUND_COUNTERS[_0xffb8('0x53')](function(_0xc674f6){return this[_0xc674f6]!==_0x1cb3ee[_0xc674f6];},this);if(this['Trunk']&&_0x1cb3ee[_0xffb8('0x42')]){_0x38a755=this[_0xffb8('0x42')][_0xffb8('0x12')]!==_0x1cb3ee[_0xffb8('0x42')][_0xffb8('0x12')]||this[_0xffb8('0x42')]['active']!==_0x1cb3ee[_0xffb8('0x42')][_0xffb8('0x43')];}}return _0x4bb597||_0x53b156||_0x38a755;};VoiceQueueSummary['prototype']['updateReportFromOutboundQueue']=function(_0xe9d828){this['answered']=_0xe9d828[_0xffb8('0x5')];this[_0xffb8('0x40')]=_0xe9d828[_0xffb8('0x40')];this['statusMessage']=_0xe9d828['statusMessage'];this[_0xffb8('0x7')]=_0xe9d828['originated'];this[_0xffb8('0x8')]=_0xe9d828[_0xffb8('0x8')];this[_0xffb8('0x28')]=_0xe9d828[_0xffb8('0x28')];this[_0xffb8('0x29')]=_0xe9d828[_0xffb8('0x29')];this[_0xffb8('0x9')]=_0xe9d828[_0xffb8('0x9')];this[_0xffb8('0xa')]=_0xe9d828[_0xffb8('0xa')];this[_0xffb8('0xb')]=_0xe9d828['outboundNoAnswerCallsDay'];this[_0xffb8('0xc')]=_0xe9d828[_0xffb8('0xc')];this[_0xffb8('0xd')]=_0xe9d828['outboundReCallsDay'];this['outboundRejectCallsDay']=_0xe9d828[_0xffb8('0x2e')];this[_0xffb8('0x2f')]=_0xe9d828[_0xffb8('0x2f')];this[_0xffb8('0x10')]=_0xe9d828[_0xffb8('0x10')];this[_0xffb8('0x11')]=_0xe9d828['sumDuration'];this['total']=_0xe9d828[_0xffb8('0x1b')];if(this['dialMethod']==='preview'){this[_0xffb8('0xf')]=_0xe9d828[_0xffb8('0xf')];}};module[_0xffb8('0x55')]=VoiceQueueSummary; \ No newline at end of file +var _0x4af9=['predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','message','statusMessage','Trunk','active','callerid','prototype','createReport','loggedin','callers','length','online','incall','status','booked','queue','dialer','exten','xcally-motion-preview','compareToInboundQueue','some','updateReportFromOutboundQueue','preview','available','loggedIn','ringing','talking','waiting','answered','inUse','originated','outboundAbandonedCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundCongestionCallsDay','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','paused','pTalking','sumBillable','sumDuration','name','strategy','abandoned','busy','invalid','loggedInDb','onHold','notInUse','ringInUse','sumHoldTime','total','type','unavailable','unknown','unmanaged','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundBusyCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls'];(function(_0x1e5505,_0x3d9797){var _0x53c123=function(_0x5b2f3a){while(--_0x5b2f3a){_0x1e5505['push'](_0x1e5505['shift']());}};_0x53c123(++_0x3d9797);}(_0x4af9,0x12c));var _0x94af=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x4af9[_0x3b380d];return _0x54502b;};'use strict';var INBOUND_COUNTERS=[_0x94af('0x0'),_0x94af('0x1'),'loggedInDb','paused',_0x94af('0x2'),_0x94af('0x3'),_0x94af('0x4')];var OUTBOUND_COUNTERS=[_0x94af('0x0'),_0x94af('0x5'),_0x94af('0x6'),_0x94af('0x1'),'loggedInDb',_0x94af('0x7'),_0x94af('0x8'),_0x94af('0x9'),_0x94af('0xa'),'outboundBusyCallsDay',_0x94af('0xb'),_0x94af('0xc'),_0x94af('0xd'),'outboundReCallsDay','outboundRejectCallsDay',_0x94af('0xe'),_0x94af('0xf'),_0x94af('0x10'),_0x94af('0x3'),_0x94af('0x11'),_0x94af('0x12'),'total',_0x94af('0x4')];function VoiceQueueSummary(_0x3a1610){this['id']=_0x3a1610['id'];this['name']=_0x3a1610[_0x94af('0x13')];this[_0x94af('0x14')]=_0x3a1610[_0x94af('0x14')];this[_0x94af('0x15')]=_0x3a1610[_0x94af('0x15')]||0x0;this['answered']=_0x3a1610[_0x94af('0x5')]||0x0;this['available']=_0x3a1610['available']||0x0;this['busy']=_0x3a1610[_0x94af('0x16')]||0x0;this[_0x94af('0x6')]=_0x3a1610[_0x94af('0x6')]||0x0;this[_0x94af('0x17')]=_0x3a1610['invalid']||0x0;this[_0x94af('0x1')]=_0x3a1610[_0x94af('0x1')]||0x0;this['loggedInDb']=_0x3a1610[_0x94af('0x18')]||0x0;this[_0x94af('0x19')]=_0x3a1610[_0x94af('0x19')]||0x0;this[_0x94af('0x1a')]=_0x3a1610[_0x94af('0x1a')]||0x0;this[_0x94af('0xf')]=_0x3a1610[_0x94af('0xf')]||0x0;this[_0x94af('0x2')]=_0x3a1610[_0x94af('0x2')]||0x0;this[_0x94af('0x1b')]=_0x3a1610['ringInUse'];this['sumBillable']=_0x3a1610[_0x94af('0x11')];this[_0x94af('0x12')]=_0x3a1610[_0x94af('0x12')];this[_0x94af('0x1c')]=_0x3a1610[_0x94af('0x1c')]||0x0;this[_0x94af('0x3')]=_0x3a1610['talking']||0x0;this[_0x94af('0x1d')]=_0x3a1610['total']||0x0;this[_0x94af('0x1e')]=_0x3a1610['type'];this[_0x94af('0x1f')]=_0x3a1610[_0x94af('0x1f')]||0x0;this[_0x94af('0x20')]=_0x3a1610['unknown']||0x0;this[_0x94af('0x21')]=_0x3a1610[_0x94af('0x21')]||0x0;this[_0x94af('0x4')]=_0x3a1610[_0x94af('0x4')]||0x0;if(_0x3a1610['type']===_0x94af('0x22')){this[_0x94af('0x10')]=_0x3a1610[_0x94af('0x10')]||0x0;this[_0x94af('0x23')]=_0x3a1610[_0x94af('0x23')];this[_0x94af('0x24')]=_0x3a1610[_0x94af('0x24')];this[_0x94af('0x25')]=_0x3a1610[_0x94af('0x25')];this['dialOriginateCallerIdNumber']=_0x3a1610[_0x94af('0x26')];this['dialOriginateTimeout']=_0x3a1610[_0x94af('0x27')];this[_0x94af('0x28')]=_0x3a1610[_0x94af('0x28')];this['temp']=_0x3a1610[_0x94af('0x29')];this[_0x94af('0x2a')]=_0x3a1610['outboundAnswerAgiCallsDay'];this[_0x94af('0x9')]=_0x3a1610[_0x94af('0x9')];this[_0x94af('0xa')]=_0x3a1610[_0x94af('0xa')];this[_0x94af('0x2b')]=_0x3a1610[_0x94af('0x2b')];this['outboundCongestionCallsDay']=_0x3a1610[_0x94af('0xb')];this['outboundDropCallsDayACS']=_0x3a1610['outboundDropCallsDayACS'];this[_0x94af('0x2c')]=_0x3a1610[_0x94af('0x2c')];this[_0x94af('0x2d')]=_0x3a1610[_0x94af('0x2d')];this[_0x94af('0xc')]=_0x3a1610['outboundNoAnswerCallsDay'];this[_0x94af('0xd')]=_0x3a1610[_0x94af('0xd')];this['outboundOriginateFailureCallsDay']=_0x3a1610[_0x94af('0x2e')];this[_0x94af('0x2f')]=_0x3a1610[_0x94af('0x2f')];this[_0x94af('0x30')]=_0x3a1610[_0x94af('0x30')];this[_0x94af('0xe')]=_0x3a1610[_0x94af('0xe')];this['predictiveIntervalAnsweredCalls']=_0x3a1610[_0x94af('0x31')];this[_0x94af('0x32')]=_0x3a1610[_0x94af('0x32')];this[_0x94af('0x33')]=_0x3a1610[_0x94af('0x33')];this[_0x94af('0x34')]=_0x3a1610[_0x94af('0x34')];this[_0x94af('0x35')]=_0x3a1610[_0x94af('0x35')];this['predictiveIntervalErlangCalls']=_0x3a1610[_0x94af('0x36')];this[_0x94af('0x37')]=_0x3a1610[_0x94af('0x37')];this[_0x94af('0x38')]=_0x3a1610[_0x94af('0x38')];this['predictiveIntervalMultiplicativeFactor']=_0x3a1610[_0x94af('0x39')];this[_0x94af('0x3a')]=_0x3a1610[_0x94af('0x3a')];this[_0x94af('0x3b')]=_0x3a1610['predictiveIntervalAvailable'];this[_0x94af('0x3c')]=_0x3a1610['predictiveIntervalTotalCalls'];this['originated']=_0x3a1610['originated'];this[_0x94af('0x3d')]=_0x3a1610[_0x94af('0x3d')];this['erlangCallToSecond']=_0x3a1610[_0x94af('0x3e')];this['erlangAbandonmentRate']=_0x3a1610[_0x94af('0x3f')];this['erlangBusyFactor']=_0x3a1610[_0x94af('0x40')];this[_0x94af('0x41')]=_0x3a1610[_0x94af('0x41')];this[_0x94af('0x42')]=_0x3a1610[_0x94af('0x42')];this[_0x94af('0x43')]=_0x3a1610[_0x94af('0x43')];this[_0x94af('0x44')]=_0x3a1610[_0x94af('0x44')];}if(_0x3a1610[_0x94af('0x45')]){this[_0x94af('0x45')]={'id':_0x3a1610['Trunk']['id'],'name':_0x3a1610[_0x94af('0x45')][_0x94af('0x13')],'active':_0x3a1610['Trunk'][_0x94af('0x46')],'callerid':_0x3a1610['Trunk'][_0x94af('0x47')]};}}VoiceQueueSummary[_0x94af('0x48')][_0x94af('0x49')]=function(_0x4cf8b9,_0x36646a,_0x554938,_0x326dce){this[_0x94af('0x18')]=0x0;this['talking']=0x0;this[_0x94af('0xf')]=0x0;this[_0x94af('0x20')]=0x0;this[_0x94af('0x1a')]=0x0;this[_0x94af('0x6')]=0x0;this[_0x94af('0x16')]=0x0;this[_0x94af('0x17')]=0x0;this[_0x94af('0x1f')]=0x0;this[_0x94af('0x2')]=0x0;this['ringInUse']=0x0;this[_0x94af('0x19')]=0x0;if(_0x554938){if(_0x554938['available']){this[_0x94af('0x0')]=Number(_0x554938[_0x94af('0x0')]);}if(_0x554938[_0x94af('0x4a')]){this[_0x94af('0x1')]=Number(_0x554938[_0x94af('0x4a')]);}if(_0x554938[_0x94af('0x4b')]){this['waiting']=Number(_0x554938[_0x94af('0x4b')]);}}for(var _0x10ebe4=0x0;_0x10ebe4<_0x4cf8b9[_0x94af('0x4c')];_0x10ebe4++){var _0x4475bd=_0x36646a['SIP/'+_0x4cf8b9[_0x10ebe4][_0x94af('0x13')]];if(_0x4475bd&&_0x4475bd[_0x94af('0x4d')]){this[_0x94af('0x18')]+=0x1;}if(_0x4cf8b9[_0x10ebe4][_0x94af('0x4e')]==='1'){this[_0x94af('0x3')]+=0x1;}if(_0x4cf8b9[_0x10ebe4][_0x94af('0xf')]==='1'&&!['2','7','8']['includes'](_0x4cf8b9[_0x10ebe4]['status'])){this[_0x94af('0xf')]+=0x1;}switch(_0x4cf8b9[_0x10ebe4][_0x94af('0x4f')]){case'0':this[_0x94af('0x20')]+=0x1;break;case'1':this[_0x94af('0x1a')]+=0x1;break;case'2':this[_0x94af('0x6')]+=0x1;break;case'3':this[_0x94af('0x16')]+=0x1;break;case'4':this['invalid']+=0x1;break;case'5':this[_0x94af('0x1f')]+=0x1;break;case'6':this[_0x94af('0x2')]+=0x1;break;case'7':this[_0x94af('0x1b')]+=0x1;break;case'8':this[_0x94af('0x19')]+=0x1;break;}}if(this[_0x94af('0x24')]===_0x94af('0x50')){var _0x111d30=Object['keys'](_0x326dce);for(var _0x321cf6=0x0;_0x321cf6<_0x111d30['length'];_0x321cf6++){var _0x260f66=_0x111d30[_0x321cf6];var _0x390467=_0x326dce[_0x260f66];if(_0x390467[_0x94af('0x51')]===this[_0x94af('0x13')]&&_0x390467[_0x94af('0x1e')]===_0x94af('0x52')&&_0x390467[_0x94af('0x53')]===_0x94af('0x54')){this[_0x94af('0x3')]+=0x1;}}if(this[_0x94af('0x3')]>this[_0x94af('0x6')]){this[_0x94af('0x3')]=this[_0x94af('0x6')];}this['pTalking']=0x0;}return this;};VoiceQueueSummary[_0x94af('0x48')][_0x94af('0x55')]=function(_0x2deeb7){var _0x38069e=![];if(_0x2deeb7){_0x38069e=INBOUND_COUNTERS[_0x94af('0x56')](function(_0x21e35f){return this[_0x21e35f]!==_0x2deeb7[_0x21e35f];},this);}return _0x38069e;};VoiceQueueSummary[_0x94af('0x48')]['compareToOutboundQueue']=function(_0x36cb23){var _0x81a391=![];var _0x2483ee=![];var _0x440ff1=![];if(_0x36cb23){_0x81a391=this['dialMethod']!==_0x36cb23[_0x94af('0x24')]||this['dialActive']!==_0x36cb23[_0x94af('0x23')]||this[_0x94af('0x43')]!==_0x36cb23['message']||this[_0x94af('0x44')]!==_0x36cb23['statusMessage'];_0x2483ee=OUTBOUND_COUNTERS['some'](function(_0x5ed398){return this[_0x5ed398]!==_0x36cb23[_0x5ed398];},this);if(this[_0x94af('0x45')]&&_0x36cb23[_0x94af('0x45')]){_0x440ff1=this[_0x94af('0x45')][_0x94af('0x13')]!==_0x36cb23['Trunk'][_0x94af('0x13')]||this[_0x94af('0x45')][_0x94af('0x46')]!==_0x36cb23[_0x94af('0x45')][_0x94af('0x46')];}}return _0x81a391||_0x2483ee||_0x440ff1;};VoiceQueueSummary[_0x94af('0x48')][_0x94af('0x57')]=function(_0x44e646){this[_0x94af('0x5')]=_0x44e646[_0x94af('0x5')];this[_0x94af('0x43')]=_0x44e646[_0x94af('0x43')];this['statusMessage']=_0x44e646[_0x94af('0x44')];this[_0x94af('0x7')]=_0x44e646[_0x94af('0x7')];this[_0x94af('0x8')]=_0x44e646['outboundAbandonedCallsDay'];this[_0x94af('0x9')]=_0x44e646[_0x94af('0x9')];this[_0x94af('0xa')]=_0x44e646[_0x94af('0xa')];this[_0x94af('0x2b')]=_0x44e646['outboundBusyCallsDay'];this[_0x94af('0xb')]=_0x44e646[_0x94af('0xb')];this['outboundNoAnswerCallsDay']=_0x44e646[_0x94af('0xc')];this[_0x94af('0xd')]=_0x44e646[_0x94af('0xd')];this[_0x94af('0x2f')]=_0x44e646[_0x94af('0x2f')];this[_0x94af('0x30')]=_0x44e646[_0x94af('0x30')];this[_0x94af('0xe')]=_0x44e646[_0x94af('0xe')];this['sumBillable']=_0x44e646[_0x94af('0x11')];this['sumDuration']=_0x44e646[_0x94af('0x12')];this['total']=_0x44e646[_0x94af('0x1d')];if(this[_0x94af('0x24')]===_0x94af('0x58')){this[_0x94af('0x10')]=_0x44e646[_0x94af('0x10')];}};module['exports']=VoiceQueueSummary; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index d3bf96e..c161b91 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 _0x6943=['exports','name','username','accessKey','remoteUri','serverUrl'];(function(_0x129a7c,_0x5c7eae){var _0x33d5cc=function(_0x24988b){while(--_0x24988b){_0x129a7c['push'](_0x129a7c['shift']());}};_0x33d5cc(++_0x5c7eae);}(_0x6943,0xa3));var _0x3694=function(_0x23c3f4,_0x24f0b3){_0x23c3f4=_0x23c3f4-0x0;var _0x82f0f1=_0x6943[_0x23c3f4];return _0x82f0f1;};'use strict';function VtigerAccount(_0x5b30be){this['id']=_0x5b30be['id']||0x0;this[_0x3694('0x0')]=_0x5b30be[_0x3694('0x0')]||'';this['username']=_0x5b30be[_0x3694('0x1')]||'';this[_0x3694('0x2')]=_0x5b30be['accessKey']||'';this[_0x3694('0x3')]=_0x5b30be[_0x3694('0x3')]||'';this[_0x3694('0x4')]=_0x5b30be['serverUrl']||'';this['Configurations']=_0x5b30be['Configurations']||{};}module[_0x3694('0x5')]=VtigerAccount; \ No newline at end of file +var _0x69f4=['serverUrl','Configurations','exports','name','username','accessKey','remoteUri'];(function(_0x456200,_0x3d4c03){var _0x551f2e=function(_0x807f2d){while(--_0x807f2d){_0x456200['push'](_0x456200['shift']());}};_0x551f2e(++_0x3d4c03);}(_0x69f4,0x1b5));var _0x469f=function(_0x4981e9,_0x2d8b39){_0x4981e9=_0x4981e9-0x0;var _0x3ea69b=_0x69f4[_0x4981e9];return _0x3ea69b;};'use strict';function VtigerAccount(_0xee595c){this['id']=_0xee595c['id']||0x0;this[_0x469f('0x0')]=_0xee595c[_0x469f('0x0')]||'';this[_0x469f('0x1')]=_0xee595c[_0x469f('0x1')]||'';this[_0x469f('0x2')]=_0xee595c[_0x469f('0x2')]||'';this[_0x469f('0x3')]=_0xee595c[_0x469f('0x3')]||'';this[_0x469f('0x4')]=_0xee595c[_0x469f('0x4')]||'';this[_0x469f('0x5')]=_0xee595c['Configurations']||{};}module[_0x469f('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 0b4e6b4..27c9a78 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 _0x6cd1=['Configurations','name','username','password','token','remoteUri','authType','type','integrationTab','serverUrl'];(function(_0x3d70bd,_0x1751f2){var _0x38afd5=function(_0x440587){while(--_0x440587){_0x3d70bd['push'](_0x3d70bd['shift']());}};_0x38afd5(++_0x1751f2);}(_0x6cd1,0xa1));var _0x16cd=function(_0x12c4cd,_0xdebe29){_0x12c4cd=_0x12c4cd-0x0;var _0x18a029=_0x6cd1[_0x12c4cd];return _0x18a029;};'use strict';function ZendeskAccount(_0x150b90){this['id']=_0x150b90['id']||0x0;this[_0x16cd('0x0')]=_0x150b90[_0x16cd('0x0')]||'';this[_0x16cd('0x1')]=_0x150b90['username']||'';this[_0x16cd('0x2')]=_0x150b90[_0x16cd('0x2')]||'';this[_0x16cd('0x3')]=_0x150b90[_0x16cd('0x3')]||'';this[_0x16cd('0x4')]=_0x150b90['remoteUri']||'';this[_0x16cd('0x5')]=_0x150b90['authType']||'';this[_0x16cd('0x6')]=_0x150b90[_0x16cd('0x6')]||_0x16cd('0x7');this[_0x16cd('0x8')]=_0x150b90[_0x16cd('0x8')]||'';this[_0x16cd('0x9')]=_0x150b90['Configurations']||{};}module['exports']=ZendeskAccount; \ No newline at end of file +var _0xd9ff=['name','username','password','token','remoteUri','authType','type','integrationTab','serverUrl','exports'];(function(_0x1e1a7a,_0x2d4cc0){var _0x4dc71b=function(_0x2e1094){while(--_0x2e1094){_0x1e1a7a['push'](_0x1e1a7a['shift']());}};_0x4dc71b(++_0x2d4cc0);}(_0xd9ff,0x1f4));var _0xfd9f=function(_0x197297,_0x42596f){_0x197297=_0x197297-0x0;var _0x5eb41a=_0xd9ff[_0x197297];return _0x5eb41a;};'use strict';function ZendeskAccount(_0x482d90){this['id']=_0x482d90['id']||0x0;this[_0xfd9f('0x0')]=_0x482d90[_0xfd9f('0x0')]||'';this[_0xfd9f('0x1')]=_0x482d90[_0xfd9f('0x1')]||'';this[_0xfd9f('0x2')]=_0x482d90[_0xfd9f('0x2')]||'';this[_0xfd9f('0x3')]=_0x482d90[_0xfd9f('0x3')]||'';this['remoteUri']=_0x482d90[_0xfd9f('0x4')]||'';this[_0xfd9f('0x5')]=_0x482d90['authType']||'';this[_0xfd9f('0x6')]=_0x482d90[_0xfd9f('0x6')]||_0xfd9f('0x7');this[_0xfd9f('0x8')]=_0x482d90[_0xfd9f('0x8')]||'';this['Configurations']=_0x482d90['Configurations']||{};}module[_0xfd9f('0x9')]=ZendeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/zohoAccount.js b/server/services/ami/model/zohoAccount.js index 7bb8a45..085b29e 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 _0x535a=['clientId','clientSecret','serverUrl','code','refreshToken','Configurations','exports','name','description','host','zone'];(function(_0x1abb09,_0x18ee91){var _0xea1c07=function(_0x38f42c){while(--_0x38f42c){_0x1abb09['push'](_0x1abb09['shift']());}};_0xea1c07(++_0x18ee91);}(_0x535a,0x125));var _0xa535=function(_0x421544,_0x5e319d){_0x421544=_0x421544-0x0;var _0x37ab89=_0x535a[_0x421544];return _0x37ab89;};'use strict';function ZohoAccount(_0x2870c9){this['id']=_0x2870c9['id']||0x0;this['name']=_0x2870c9[_0xa535('0x0')]||'';this[_0xa535('0x1')]=_0x2870c9['description']||'';this[_0xa535('0x2')]=_0x2870c9[_0xa535('0x2')]||'';this['zone']=_0x2870c9[_0xa535('0x3')]||'';this[_0xa535('0x4')]=_0x2870c9[_0xa535('0x4')]||'';this[_0xa535('0x5')]=_0x2870c9[_0xa535('0x5')]||'';this[_0xa535('0x6')]=_0x2870c9[_0xa535('0x6')]||'';this[_0xa535('0x7')]=_0x2870c9['code']||'';this[_0xa535('0x8')]=_0x2870c9['refreshToken']||'';this[_0xa535('0x9')]=_0x2870c9[_0xa535('0x9')]||{};}module[_0xa535('0xa')]=ZohoAccount; \ No newline at end of file +var _0x03dc=['Configurations','exports','description','host','zone','clientId','clientSecret','serverUrl','code','refreshToken'];(function(_0x3511d3,_0x4107ae){var _0x5d6321=function(_0x1a23da){while(--_0x1a23da){_0x3511d3['push'](_0x3511d3['shift']());}};_0x5d6321(++_0x4107ae);}(_0x03dc,0x1ce));var _0xc03d=function(_0x3cc6bf,_0x2f59dd){_0x3cc6bf=_0x3cc6bf-0x0;var _0x1b8ec1=_0x03dc[_0x3cc6bf];return _0x1b8ec1;};'use strict';function ZohoAccount(_0x5d2442){this['id']=_0x5d2442['id']||0x0;this['name']=_0x5d2442['name']||'';this[_0xc03d('0x0')]=_0x5d2442[_0xc03d('0x0')]||'';this[_0xc03d('0x1')]=_0x5d2442[_0xc03d('0x1')]||'';this['zone']=_0x5d2442[_0xc03d('0x2')]||'';this[_0xc03d('0x3')]=_0x5d2442['clientId']||'';this['clientSecret']=_0x5d2442[_0xc03d('0x4')]||'';this['serverUrl']=_0x5d2442[_0xc03d('0x5')]||'';this[_0xc03d('0x6')]=_0x5d2442['code']||'';this['refreshToken']=_0x5d2442[_0xc03d('0x7')]||'';this[_0xc03d('0x8')]=_0x5d2442[_0xc03d('0x8')]||{};}module[_0xc03d('0x9')]=ZohoAccount; \ No newline at end of file diff --git a/server/services/ami/preview/action.js b/server/services/ami/preview/action.js index 0f4d945..1e41b57 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 _0x2032=['originatecalleridnum','prototype','getCaller','\x22%s\x22\x20<%s>','calleridname','number','exports','lodash','moment','string','isNil','uniqueid','idContact','queue','type','dialAnswer','membername','Agent','name','format','Contact','lastName','active','calleridnum','phone','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','countdropretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId'];(function(_0x5ae268,_0x4b3d90){var _0x3fea8b=function(_0x4a0c9c){while(--_0x4a0c9c){_0x5ae268['push'](_0x5ae268['shift']());}};_0x3fea8b(++_0x4b3d90);}(_0x2032,0xd9));var _0x2203=function(_0x13df6c,_0x2452db){_0x13df6c=_0x13df6c-0x0;var _0x25047c=_0x2032[_0x13df6c];return _0x25047c;};'use strict';var util=require('util');var _=require(_0x2203('0x0'));var moment=require(_0x2203('0x1'));function checkNameSurname(_0xcd892f,_0x4c28da,_0x486390){var _0x228a29='';if(!_['isNil'](_0x4c28da)&&_0x2203('0x2')===typeof _0x4c28da){_0x228a29+=_0x4c28da;}if(!_[_0x2203('0x3')](_0x486390)&&_0x2203('0x2')===typeof _0x486390){_0x228a29+='\x20'+_0x486390;}if(_0x228a29!==''){return _0x228a29;}return _0xcd892f;}function Action(_0x201796,_0x3f7ba1,_0x13367a,_0x2e0f63,_0x2676aa){this[_0x2203('0x4')]=_0x13367a||undefined;this[_0x2203('0x5')]=_0x201796['id'];this[_0x2203('0x6')]=_0x3f7ba1['name'];this['type']=_0x3f7ba1[_0x2203('0x7')];this['campaigntype']=_0x2203('0x6');this[_0x2203('0x8')]=![];this[_0x2203('0x9')]=_['isNil'](_0x201796[_0x2203('0xa')])?undefined:_0x201796['Agent'][_0x2203('0xb')];this['channelAgent']=this[_0x2203('0x9')]?util[_0x2203('0xc')]('SIP/%s',this['membername']):_0x2e0f63||undefined;this['calleridname']=checkNameSurname(_0x201796['Contact']['phone'],_0x201796[_0x2203('0xd')]['firstName'],_0x201796['Contact'][_0x2203('0xe')]);this[_0x2203('0xf')]=_0x201796[_0x2203('0xf')]||![];this[_0x2203('0x10')]=_0x201796[_0x2203('0x11')];this[_0x2203('0x12')]=_0x201796[_0x2203('0x12')];this[_0x2203('0x13')]=_0x201796[_0x2203('0x13')]||0x0;this[_0x2203('0x14')]=_0x201796['countcongestionretry']||0x0;this[_0x2203('0x15')]=_0x201796[_0x2203('0x15')]||0x0;this['countglobal']=(_0x201796[_0x2203('0x13')]||0x0)+(_0x201796[_0x2203('0x14')]||0x0)+(_0x201796['countnoanswerretry']||0x0)+(_0x201796[_0x2203('0x16')]||0x0)+(_0x201796['countdropretry']||0x0)+(_0x201796[_0x2203('0x17')]||0x0)+(_0x201796[_0x2203('0x18')]||0x0)+(_0x201796[_0x2203('0x19')]||0x0);this[_0x2203('0x16')]=_0x201796[_0x2203('0x16')]||0x0;this[_0x2203('0x1a')]=_0x201796['countdropretry']||0x0;this[_0x2203('0x17')]=_0x201796['countabandonedretry']||0x0;this['countmachineretry']=_0x201796[_0x2203('0x18')]||0x0;this['countagentrejectretry']=_0x201796[_0x2203('0x19')]||0x0;this[_0x2203('0x1b')]=_0x201796['callback'];this[_0x2203('0x1c')]=_0x201796['callbackuniqueid'];this['callbackat']=_0x201796[_0x2203('0x1d')];this[_0x2203('0x1e')]=_0x201796[_0x2203('0x1e')];this[_0x2203('0x1f')]=_0x201796[_0x2203('0x1f')];this[_0x2203('0x20')]=_0x201796[_0x2203('0x20')];this[_0x2203('0x21')]=_['isNil'](_0x201796[_0x2203('0xa')])?_0x201796[_0x2203('0x21')]:_0x201796[_0x2203('0xa')]['id'];this['VoiceQueueId']=_0x201796[_0x2203('0x22')];this[_0x2203('0x23')]='';this['originatecalleridname']='';}Action[_0x2203('0x24')][_0x2203('0x25')]=function(){return util[_0x2203('0xc')](_0x2203('0x26'),this[_0x2203('0x27')],this[_0x2203('0x28')]);};module[_0x2203('0x29')]=Action; \ No newline at end of file +var _0x1c9a=['countdropretry','countabandonedretry','countagentrejectretry','countmachineretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','prototype','\x22%s\x22\x20<%s>','number','util','moment','string','isNil','uniqueid','idContact','name','type','campaigntype','dialAnswer','membername','Agent','channelAgent','format','SIP/%s','calleridname','Contact','phone','firstName','lastName','active','calleridnum','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry'];(function(_0x493528,_0x1d4651){var _0x7136cb=function(_0x466b5e){while(--_0x466b5e){_0x493528['push'](_0x493528['shift']());}};_0x7136cb(++_0x1d4651);}(_0x1c9a,0x98));var _0xa1c9=function(_0x2af579,_0x2fc4ea){_0x2af579=_0x2af579-0x0;var _0x5405b3=_0x1c9a[_0x2af579];return _0x5405b3;};'use strict';var util=require(_0xa1c9('0x0'));var _=require('lodash');var moment=require(_0xa1c9('0x1'));function checkNameSurname(_0x5c45c5,_0x1a771d,_0x1d631b){var _0x1a05a3='';if(!_['isNil'](_0x1a771d)&&_0xa1c9('0x2')===typeof _0x1a771d){_0x1a05a3+=_0x1a771d;}if(!_[_0xa1c9('0x3')](_0x1d631b)&&_0xa1c9('0x2')===typeof _0x1d631b){_0x1a05a3+='\x20'+_0x1d631b;}if(_0x1a05a3!==''){return _0x1a05a3;}return _0x5c45c5;}function Action(_0x3a4387,_0x572229,_0x144e91,_0x5448f2,_0x222624){this[_0xa1c9('0x4')]=_0x144e91||undefined;this[_0xa1c9('0x5')]=_0x3a4387['id'];this['queue']=_0x572229[_0xa1c9('0x6')];this[_0xa1c9('0x7')]=_0x572229[_0xa1c9('0x7')];this[_0xa1c9('0x8')]='queue';this[_0xa1c9('0x9')]=![];this[_0xa1c9('0xa')]=_[_0xa1c9('0x3')](_0x3a4387[_0xa1c9('0xb')])?undefined:_0x3a4387[_0xa1c9('0xb')][_0xa1c9('0x6')];this[_0xa1c9('0xc')]=this[_0xa1c9('0xa')]?util[_0xa1c9('0xd')](_0xa1c9('0xe'),this['membername']):_0x5448f2||undefined;this[_0xa1c9('0xf')]=checkNameSurname(_0x3a4387[_0xa1c9('0x10')][_0xa1c9('0x11')],_0x3a4387[_0xa1c9('0x10')][_0xa1c9('0x12')],_0x3a4387['Contact'][_0xa1c9('0x13')]);this[_0xa1c9('0x14')]=_0x3a4387[_0xa1c9('0x14')]||![];this[_0xa1c9('0x15')]=_0x3a4387[_0xa1c9('0x11')];this[_0xa1c9('0x16')]=_0x3a4387[_0xa1c9('0x16')];this[_0xa1c9('0x17')]=_0x3a4387[_0xa1c9('0x17')]||0x0;this[_0xa1c9('0x18')]=_0x3a4387['countcongestionretry']||0x0;this[_0xa1c9('0x19')]=_0x3a4387[_0xa1c9('0x19')]||0x0;this[_0xa1c9('0x1a')]=(_0x3a4387['countbusyretry']||0x0)+(_0x3a4387[_0xa1c9('0x18')]||0x0)+(_0x3a4387['countnoanswerretry']||0x0)+(_0x3a4387[_0xa1c9('0x1b')]||0x0)+(_0x3a4387[_0xa1c9('0x1c')]||0x0)+(_0x3a4387[_0xa1c9('0x1d')]||0x0)+(_0x3a4387['countmachineretry']||0x0)+(_0x3a4387[_0xa1c9('0x1e')]||0x0);this[_0xa1c9('0x1b')]=_0x3a4387[_0xa1c9('0x1b')]||0x0;this['countdropretry']=_0x3a4387[_0xa1c9('0x1c')]||0x0;this[_0xa1c9('0x1d')]=_0x3a4387['countabandonedretry']||0x0;this[_0xa1c9('0x1f')]=_0x3a4387[_0xa1c9('0x1f')]||0x0;this[_0xa1c9('0x1e')]=_0x3a4387['countagentrejectretry']||0x0;this[_0xa1c9('0x20')]=_0x3a4387[_0xa1c9('0x20')];this[_0xa1c9('0x21')]=_0x3a4387[_0xa1c9('0x21')];this[_0xa1c9('0x22')]=_0x3a4387['callbackat'];this['recallme']=_0x3a4387[_0xa1c9('0x23')];this['ContactId']=_0x3a4387[_0xa1c9('0x24')];this[_0xa1c9('0x25')]=_0x3a4387[_0xa1c9('0x25')];this[_0xa1c9('0x26')]=_[_0xa1c9('0x3')](_0x3a4387['Agent'])?_0x3a4387[_0xa1c9('0x26')]:_0x3a4387[_0xa1c9('0xb')]['id'];this[_0xa1c9('0x27')]=_0x3a4387['VoiceQueueId'];this[_0xa1c9('0x28')]='';this[_0xa1c9('0x29')]='';}Action[_0xa1c9('0x2a')]['getCaller']=function(){return util[_0xa1c9('0xd')](_0xa1c9('0x2b'),this['calleridname'],this[_0xa1c9('0x2c')]);};module['exports']=Action; \ No newline at end of file diff --git a/server/services/ami/preview/index.js b/server/services/ami/preview/index.js index 41831ce..7101ccc 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 _0xbee9=['countbusyretry','custom:agentbusy','busy','[callProgressDetectingCustomer][logBusy]','verifyAdditionalPhones','dialBusyMaxRetry','rescheduleContact','dialBusyRetryFrequency','NOANSWER','outboundNoAnswerCallsDay','dialNoAnswerRetryFrequency','buildNoAnswerEventPayload','custom:agentnoanswer','[callProgressDetectingCustomer][logNoAnswer]','[callProgressDetectingCustomer][logNoAnswerGlobal]','countnoanswerretry','dialNoAnswerMaxRetry','outboundCongestionCallsDay','Congestion','dialCongestionRetryFrequency','custom:agentcongestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','countcongestionretry','dialCongestionMaxRetry','CANCEL','countagentrejectretry','dialAgentRejectRetryFrequency','[syncHangupRequest][logAgentReject]','AgentReject','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectMaxRetry','ABANDONED','outboundAbandonedCallsDay','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedMaxRety','dialAbandonedRetryFrequency','outboundUnknownCallsDay','cause-txt','dialstatus','custom:amd','[callProgressDetectingCustomer][hangupInAMD]','amd','[callProgressDetectingCustomer][machine]','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[originated][decrement][callProgressDetectingCustomer]','originated:\x20','destlinkedid','callProgressDetectingAgent','isUndefined','object','reason','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','logAgent','Busy','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','[originated][decrement][callProgressDetectingAgent]','[swapAdditionalPhone]\x20','resolve','[incrementPreviewCounters]\x20','phone','VoiceQueueId','lookAgent','isEmpty','execCall','[Preview][execCall][success]','\x20IdHopper:\x20','custom:agentcalled','Calling','Call\x20failed','logBlacklist','createHistory','[Blacklist][error]','Contact\x20in\x20black\x20List','SIP/%s','unmonitored','execRun','unlockContact','active','disableContact','recallme','validateContact','isValid','checkIsBlackList','checkInBlack','[Preview][checkIsBlackList]','Call\x20unsuccessful','[Preview][getContactPreview]','[Preview][validateContact][Empty\x20Contact]','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','Trunk','[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','\x20Trunk\x20is\x20not\x20active','TrunkBackup','\x20Trunk\x20Backup\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','\x20Not\x20Active','Is\x20Valid','SIP/%s/%s%s','dialPrefix','substring','trim','dialCutDigit','getCallerId','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','callerid','originatecalleridname','extractCalleridName','originatecalleridnum','extractCalleridNumber','addVariables','setXMDContactVariables','assign','merge','toLowerVariables','variables','variablesAction','[originated][increment]','OriginateError','[originateFailure][logOriginateFailure]','logLookAgent','isFailure','response','rejected','[syncHangup][talking]','cause','[syncHangup][talking][cause]','callProgressDetectingCustomer','statedesc','channelstate','transfer','destuniqueid','addVariable','syncVarSet','filterKey','variable','keys','value','error','[syncVarSet][Preview]','inspect','transfertargetlinkedid','util','lodash','uuid','moment','../../../config/environment','../../../config/logger','actionPreview','./rpcDb','../dialer/utils','redis','localhost','socket.io-emitter','prototype','enqueue','tail','finally','sequence','campaignsPreview','voiceQueues','trunks','agents','clockClearZombieChannels','originateresponse','syncOriginateResponse','bind','hangup','syncHangup','hanguprequest','syncHangupRequest','dialend','syncDialEnd','newexten','syncNewExten','varset','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','emit','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','format','voice:queue:%s','name','voice_queue_channel:remove','voice_queue_presence:remove','sendMessageOneNotActive','originated','available','paused','CAMPAIGN_STATUS','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','message','DEACTIVATED','loopCampaigns','syncCampaigns','hasOwnProperty','dialMethod','preview','booked','type','outbound','clearZombieChannels','dialActive','setMessage','dialPreviewAutoRecallMe','recallMe','clearZombieChannel','[clearZombieChannels][talking]','Queue','actions','queue','stringify','pTalking:\x20','pTalking','dialAnswer','pick','UserId','ListId','Action','status','channel','catch','updateOriginated','[clearZombieChannel]','loggerError','[Dialer][checkChannel][Preview]','[action]','getContactRecallMe','agentReadyId','then','isNil','length','getDiff','scheduledat','Agent','logger2','[RecallMe]','starttime','outboundReCallsDay','logCustomer','dialRecallInQueue','rescheduleContactInQueue','createBody','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','createCustomerHistory','[HistoryRecallClose]','createCustomerFinal','[getContactRecallMe]','IsNotLoggedIn','loggedIn','isActive','INACTIVE','isTrunkReachable','UNREACHABLE_TRUNK','ACTIVE','outboundNoSuchCallsDay','countnosuchnumberretry','totalGlobal','NoSuchNumber','custom:agentnosuchnumber','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','additional','dialNoSuchNumberRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','cloneAction','Global','[callProgressDetectingCustomer][logNoSuchGlobal]','dialNoSuchNumberMaxRetry','scheduledAt','unlockAgent','activeContact','linkedid','actioncountonusuch','idContact','incrementPreviewCounters','swapAdditionalPhones','ANSWER','YYYY-MM-DD\x20HH:mm:ss','responsetime','[syncHangup][talking][increment]','uniqueid','\x20Queue','custom:agentconnect','buildObj','connect','acw','custom:agentConnectPreview','buildAcw','complete','outboundAnswerCallsDay','total','answered','[16]','countglobal','Answer','[callProgressDetectingCustomer][logAnswer]','sumDuration','talktime','sumBillable','[syncHangup][talking][decrement]','BUSY','outboundBusyCallsDay'];(function(_0x1beef3,_0x57c4b8){var _0x5af964=function(_0x36f463){while(--_0x36f463){_0x1beef3['push'](_0x1beef3['shift']());}};_0x5af964(++_0x57c4b8);}(_0xbee9,0x1dc));var _0x9bee=function(_0x31b469,_0x104e6d){_0x31b469=_0x31b469-0x0;var _0x456faa=_0xbee9[_0x31b469];return _0x456faa;};'use strict';var util=require(_0x9bee('0x0'));var _=require(_0x9bee('0x1'));var uuid=require(_0x9bee('0x2'));var moment=require(_0x9bee('0x3'));var Redis=require('ioredis');var config=require(_0x9bee('0x4'));var logger=require('../../../config/logger')('preview');var loggerAction=require(_0x9bee('0x5'))(_0x9bee('0x6'));var ami=require('../ami');var rpcDb=require(_0x9bee('0x7'));var cmHopperAdditionalPhone=require('../rpc/cmHopperAdditionalPhone');var Action=require('./action');var ut=require('./util/util');var utils=require(_0x9bee('0x8'));config[_0x9bee('0x9')]=_['defaults'](config[_0x9bee('0x9')],{'host':_0x9bee('0xa'),'port':0x18eb});var io=require(_0x9bee('0xb'))(new Redis(config[_0x9bee('0x9')]));var Sequence=function(){};Sequence[_0x9bee('0xc')][_0x9bee('0xd')]=function(_0x138b17){this[_0x9bee('0xe')]=this[_0x9bee('0xe')]?this[_0x9bee('0xe')][_0x9bee('0xf')](_0x138b17):_0x138b17();};function Preview(_0x2c677c){this[_0x9bee('0x10')]=new Sequence();this[_0x9bee('0x11')]=_0x2c677c[_0x9bee('0x12')];this[_0x9bee('0x13')]=_0x2c677c[_0x9bee('0x13')];this['actions']={};this[_0x9bee('0x14')]=_0x2c677c['agents'];this[_0x9bee('0x15')]=0x0;ami['on'](_0x9bee('0x16'),this[_0x9bee('0x17')][_0x9bee('0x18')](this));ami['on'](_0x9bee('0x19'),this[_0x9bee('0x1a')][_0x9bee('0x18')](this));ami['on'](_0x9bee('0x1b'),this[_0x9bee('0x1c')][_0x9bee('0x18')](this));ami['on'](_0x9bee('0x1d'),this[_0x9bee('0x1e')][_0x9bee('0x18')](this));ami['on'](_0x9bee('0x1f'),this[_0x9bee('0x20')][_0x9bee('0x18')](this));ami['on'](_0x9bee('0x21'),this['syncVarSet'][_0x9bee('0x18')](this));ami['on'](_0x9bee('0x22'),this[_0x9bee('0x23')][_0x9bee('0x18')](this));ami['on'](_0x9bee('0x24'),this[_0x9bee('0x25')]['bind'](this));this['loopCampaigns'](this[_0x9bee('0x11')]);}function emit(_0x3cbae9,_0x4792f5,_0x3b1269){io['to'](_0x3cbae9)[_0x9bee('0x26')](_0x4792f5,_0x3b1269);}function emitVoiceQueueChannelRemove(_0x47f82b){logger[_0x9bee('0x27')](_0x9bee('0x28'),JSON['stringify'](_0x47f82b));emit(util[_0x9bee('0x29')](_0x9bee('0x2a'),_0x47f82b[_0x9bee('0x2b')]),_0x9bee('0x2c'),_0x47f82b);io['emit'](_0x9bee('0x2d'),_0x47f82b);}function notSendMessagesQueue(_0x21db28){if(_0x21db28[_0x9bee('0x2e')]){if(_0x21db28[_0x9bee('0x2f')]===0x0&&_0x21db28['pTalking']===0x0){_0x21db28[_0x9bee('0x2e')]=![];_0x21db28[_0x9bee('0x30')]=0x0;_0x21db28[_0x9bee('0x31')]=0x0;_0x21db28['message']=utils[_0x9bee('0x32')]['INACTIVE'];ut[_0x9bee('0x33')](_0x9bee('0x34'),_0x21db28[_0x9bee('0x2b')]+_0x9bee('0x35'));}else{_0x21db28[_0x9bee('0x36')]=utils[_0x9bee('0x32')][_0x9bee('0x37')];ut[_0x9bee('0x33')](_0x9bee('0x34'),_0x21db28['name']+'\x20is\x20deactivated');}}}Preview[_0x9bee('0xc')][_0x9bee('0x38')]=function(){var _0x3235bf=this;setInterval(function(){_0x3235bf[_0x9bee('0x39')]();},0x7cf);};Preview[_0x9bee('0xc')][_0x9bee('0x39')]=function(){var _0x31f7d7=this[_0x9bee('0x11')];this[_0x9bee('0x15')]+=0x1;for(var _0x553ba7 in _0x31f7d7){if(_0x31f7d7[_0x9bee('0x3a')](_0x553ba7)&&(_0x31f7d7[_0x553ba7][_0x9bee('0x3b')]===_0x9bee('0x3c')||_0x31f7d7[_0x553ba7][_0x9bee('0x3b')]===_0x9bee('0x3d'))&&_0x31f7d7[_0x553ba7][_0x9bee('0x3e')]===_0x9bee('0x3f')){if(this['clockClearZombieChannels']>0x7){this['clockClearZombieChannels']=0x0;this[_0x9bee('0x40')]();}}if(_0x31f7d7[_0x9bee('0x3a')](_0x553ba7)&&_0x31f7d7[_0x553ba7]['dialMethod']===_0x9bee('0x3c')&&_0x31f7d7[_0x553ba7]['type']===_0x9bee('0x3f')){if(_0x31f7d7[_0x553ba7][_0x9bee('0x41')]){this[_0x9bee('0x42')](_0x31f7d7[_0x553ba7]);if(_0x31f7d7[_0x553ba7][_0x9bee('0x43')])this[_0x9bee('0x44')](_0x31f7d7[_0x553ba7]);}else{notSendMessagesQueue(_0x31f7d7[_0x553ba7]);}}}};Preview[_0x9bee('0xc')][_0x9bee('0x45')]=function(_0x2b6045){var _0x1faffb=this;this[_0x9bee('0x10')][_0x9bee('0xd')](function(){if(!_['isNil'](_0x1faffb['actions'][_0x2b6045])){loggerAction[_0x9bee('0x27')](_0x9bee('0x46'),_0x2b6045,_0x9bee('0x47'),_0x1faffb[_0x9bee('0x48')][_0x2b6045][_0x9bee('0x49')],'originated:\x20',JSON[_0x9bee('0x4a')](_0x1faffb[_0x9bee('0x11')][_0x1faffb[_0x9bee('0x48')][_0x2b6045][_0x9bee('0x49')]][_0x9bee('0x2f')]),_0x9bee('0x4b'),JSON[_0x9bee('0x4a')](_0x1faffb[_0x9bee('0x11')][_0x1faffb['actions'][_0x2b6045][_0x9bee('0x49')]][_0x9bee('0x4c')]),JSON['stringify'](_0x1faffb['actions'][_0x2b6045][_0x9bee('0x4d')]),JSON['stringify'](_[_0x9bee('0x4e')](_0x1faffb['actions'][_0x2b6045],['contactId',_0x9bee('0x4f'),'VoiceQueueId',_0x9bee('0x50')])));return ami[_0x9bee('0x51')]({'action':_0x9bee('0x52'),'channel':_0x1faffb[_0x9bee('0x48')][_0x2b6045][_0x9bee('0x53')]})[_0x9bee('0x54')](function(_0x22061c){if(_0x22061c[_0x9bee('0x36')]==='No\x20such\x20channel'){setTimeout(function(){if(_0x1faffb[_0x9bee('0x48')][_0x2b6045]){ut[_0x9bee('0x55')](_0x1faffb[_0x9bee('0x11')][_0x1faffb['actions'][_0x2b6045][_0x9bee('0x49')]],_0x9bee('0x56'));if(_0x1faffb['actions'][_0x2b6045]['dialAnswer']===!![]){ut['decrementTalkink'](_0x1faffb[_0x9bee('0x11')][_0x1faffb['actions'][_0x2b6045]['queue']],'[clearZombieChannel]');ut['loggerError']('[Dialer][checkChannel][pTalking][Preview]'+_0x2b6045,_0x1faffb['actions'][_0x2b6045][_0x9bee('0x49')]);}ut[_0x9bee('0x57')](_0x9bee('0x58')+_0x2b6045,_0x1faffb['actions'][_0x2b6045][_0x9bee('0x49')]);delete _0x1faffb[_0x9bee('0x48')][_0x2b6045];}},0x2328);}});}});};Preview[_0x9bee('0xc')][_0x9bee('0x40')]=function(){var _0x45ff98=this;loggerAction[_0x9bee('0x27')](_0x9bee('0x59'),_['size'](this[_0x9bee('0x48')]));for(var _0x16b56e in this['actions']){if(_0x45ff98['actions'][_0x9bee('0x3a')](_0x16b56e)){_0x45ff98[_0x9bee('0x45')](_0x16b56e);}}};Preview['prototype'][_0x9bee('0x44')]=function(_0x3d0fc6){var _0x51a8cb=this;rpcDb[_0x9bee('0x5a')](_0x3d0fc6['id'],ut[_0x9bee('0x5b')](this['agents']))[_0x9bee('0x5c')](function(_0x441531){if(!_[_0x9bee('0x5d')](_0x441531)){for(var _0x578566=0x0;_0x578566<_0x441531[_0x9bee('0x5e')];_0x578566+=0x1){if(ut[_0x9bee('0x5f')](_0x441531[_0x578566][_0x9bee('0x60')])<_0x3d0fc6['dialRecallMeTimeout']*0x3c){if(_0x441531[_0x578566][_0x9bee('0x61')]&&!_0x441531[_0x578566][_0x9bee('0x61')]['voicePause']){_0x51a8cb['run'](_0x441531[_0x578566]['id'])['then'](ut[_0x9bee('0x62')](_0x9bee('0x63')))['catch'](ut[_0x9bee('0x62')](_0x9bee('0x63')));}else{rpcDb['disableContact'](_0x441531[_0x578566]['id']);}}else{var _0x24e7ad=new Action(_0x441531[_0x578566],_0x3d0fc6);_0x24e7ad[_0x9bee('0x64')]=moment()[_0x9bee('0x29')]('YYYY-MM-DD\x20HH:mm:ss');_0x3d0fc6[_0x9bee('0x65')]+=0x1;ut[_0x9bee('0x66')](_0x24e7ad,0x17,'RecallInQueue');if(_0x3d0fc6[_0x9bee('0x67')]){rpcDb[_0x9bee('0x68')](ut[_0x9bee('0x69')](_0x441531[_0x578566]));rpcDb['createCustomerHistory'](_0x24e7ad,_0x9bee('0x6a'));}else{ut[_0x9bee('0x66')](_0x24e7ad,0x16,_0x9bee('0x6b'));rpcDb[_0x9bee('0x6c')](_0x24e7ad,_0x9bee('0x6d'));rpcDb[_0x9bee('0x6e')](_0x24e7ad,_0x9bee('0x6d'));}}}}})[_0x9bee('0x54')](ut[_0x9bee('0x62')](_0x9bee('0x6f')));};Preview[_0x9bee('0xc')][_0x9bee('0x42')]=function(_0x4134ac){_0x4134ac['sendMessageOneNotActive']=!![];if(ut[_0x9bee('0x70')](_0x4134ac[_0x9bee('0x71')])){_0x4134ac[_0x9bee('0x36')]=utils[_0x9bee('0x32')]['NO_AGENTS_LOGGED'];}else if(!ut[_0x9bee('0x72')](_0x4134ac[_0x9bee('0x41')])){_0x4134ac[_0x9bee('0x36')]=utils['CAMPAIGN_STATUS'][_0x9bee('0x73')];}else if(!this[_0x9bee('0x74')](_0x4134ac['Trunk'])){if(!this['isTrunkReachable'](_0x4134ac['TrunkBackup'])){_0x4134ac[_0x9bee('0x36')]=utils[_0x9bee('0x32')][_0x9bee('0x75')];}else{_0x4134ac[_0x9bee('0x36')]=utils['CAMPAIGN_STATUS']['ACTIVE'];}}else{_0x4134ac[_0x9bee('0x36')]=utils[_0x9bee('0x32')][_0x9bee('0x76')];}};Preview[_0x9bee('0xc')]['callProgressDetectingCustomer']=function(_0x47b2e8,_0x193907,_0x1636e1){var _0x3e1fbd=this;var _0x39a2c1=this[_0x9bee('0x48')][_0x193907];var _0x2d735e=this[_0x9bee('0x11')][_0x39a2c1['queue']];var _0x158d7d;var _0x221e32=![];var _0x446475=0x2;var _0x181df1=0x3;if(_0x2d735e){switch(_0x1636e1){case'1':_0x2d735e[_0x9bee('0x77')]+=0x1;_0x39a2c1[_0x9bee('0x78')]+=0x1;_0x39a2c1['countglobal']=ut[_0x9bee('0x79')](_0x39a2c1);ut[_0x9bee('0x66')](_0x39a2c1,0x0,_0x9bee('0x7a'));ami[_0x9bee('0x26')](_0x9bee('0x7b'),ut['buildObj'](_0x39a2c1,_0x9bee('0x7c')));rpcDb[_0x9bee('0x6c')](_0x39a2c1,_0x9bee('0x7d'));_0x3e1fbd['verifyAdditionalPhones'](_0x39a2c1,'0',_0x2d735e)[_0x9bee('0x5c')](function(_0x223087){_0x221e32=_0x223087[_0x9bee('0x7e')]==0x1;_0x446475=_0x2d735e[_0x9bee('0x7f')];_0x181df1=_0x2d735e[_0x9bee('0x80')];if(!_0x221e32){if(ut[_0x9bee('0x79')](_0x39a2c1)>=_0x2d735e[_0x9bee('0x81')]){_0x158d7d=ut[_0x9bee('0x82')](_0x39a2c1,0xf,_0x9bee('0x83'));rpcDb[_0x9bee('0x6e')](_0x158d7d,_0x9bee('0x84'));}else{if(_0x39a2c1['countnosuchnumberretry']>=_0x2d735e[_0x9bee('0x85')]){rpcDb[_0x9bee('0x6e')](_0x39a2c1,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{rpcDb['rescheduleContact'](ut[_0x9bee('0x86')](_0x39a2c1,'countnosuchnumberretry',_0x2d735e[_0x9bee('0x7f')]),_0x39a2c1[_0x9bee('0x87')],_0x39a2c1[_0x9bee('0x88')]);}}delete this[_0x9bee('0x48')][_0x47b2e8[_0x9bee('0x89')]];}else{_0x39a2c1['countnosuchnumberretry']++;logger[_0x9bee('0x27')](_0x9bee('0x8a'),_0x39a2c1[_0x9bee('0x78')]);logger[_0x9bee('0x27')]('id',_0x39a2c1[_0x9bee('0x8b')]);_0x3e1fbd[_0x9bee('0x8c')]({'id':_0x39a2c1['idContact'],'field':{'countnosuchnumberretry':_0x39a2c1[_0x9bee('0x78')]}})[_0x9bee('0x5c')](function(){_0x3e1fbd[_0x9bee('0x8d')](_0x39a2c1,_0x446475,_0x181df1)[_0x9bee('0x5c')](function(){});});}});break;case _0x9bee('0x8e'):var _0x109fb2=moment()[_0x9bee('0x29')](_0x9bee('0x8f'));_0x39a2c1[_0x9bee('0x90')]=_0x109fb2;_0x39a2c1['answertime']=_0x109fb2;_0x39a2c1[_0x9bee('0x4d')]=!![];_0x2d735e[_0x9bee('0x4c')]+=0x1;logger[_0x9bee('0x27')](_0x9bee('0x91'),_0x39a2c1[_0x9bee('0x92')],_0x9bee('0x93'),_0x2d735e['name'],_0x9bee('0x4b'),_0x2d735e[_0x9bee('0x4c')]);ami['emit'](_0x9bee('0x94'),ut[_0x9bee('0x95')](_0x39a2c1,_0x9bee('0x96'),this[_0x9bee('0x11')][_0x39a2c1[_0x9bee('0x49')]]));if(_0x2d735e[_0x9bee('0x97')]){ami['emit'](_0x9bee('0x98'),ut[_0x9bee('0x99')](_0x39a2c1));}break;case'16':ami[_0x9bee('0x26')]('custom:agentcomplete',ut[_0x9bee('0x95')](_0x39a2c1,_0x9bee('0x9a'),this['campaignsPreview'][_0x39a2c1['queue']]));emitVoiceQueueChannelRemove(ut['buildObj'](_0x39a2c1,_0x9bee('0x9a')));_0x2d735e[_0x9bee('0x9b')]+=0x1;_0x2d735e[_0x9bee('0x9c')]+=0x1;_0x2d735e[_0x9bee('0x9d')]+=0x1;ut['decrementTalkink'](_0x2d735e,_0x9bee('0x9e'));_0x39a2c1[_0x9bee('0x9f')]=ut[_0x9bee('0x79')](_0x39a2c1);ut[_0x9bee('0x66')](_0x39a2c1,0x4,_0x9bee('0xa0'));rpcDb['createCustomerHistory'](_0x39a2c1,_0x9bee('0xa1'));rpcDb[_0x9bee('0x6e')](_0x39a2c1,'[callProgressDetectingCustomer][logAnswerGlobal]');rpcDb['crateCustomerReportQueue'](_0x39a2c1);_0x2d735e[_0x9bee('0xa2')]+=_0x39a2c1[_0x9bee('0xa3')];_0x2d735e[_0x9bee('0xa4')]+=_0x39a2c1[_0x9bee('0xa3')];logger[_0x9bee('0x27')](_0x9bee('0xa5'),_0x39a2c1[_0x9bee('0x92')],_0x9bee('0x93'),_0x2d735e[_0x9bee('0x2b')],'pTalking:\x20',_0x2d735e['pTalking']);delete this[_0x9bee('0x48')][_0x47b2e8[_0x9bee('0x89')]];break;case _0x9bee('0xa6'):_0x2d735e[_0x9bee('0xa7')]+=0x1;_0x39a2c1[_0x9bee('0xa8')]+=0x1;_0x39a2c1[_0x9bee('0x9f')]=ut[_0x9bee('0x79')](_0x39a2c1);ut['logCustomer'](_0x39a2c1,0x5,'Busy');_0x446475=_0x2d735e['dialBusyRetryFrequency'];_0x181df1=_0x2d735e['callAdditionalPhoneAfterMin'];ami[_0x9bee('0x26')](_0x9bee('0xa9'),ut[_0x9bee('0x95')](_0x39a2c1,_0x9bee('0xaa')));rpcDb[_0x9bee('0x6c')](_0x39a2c1,_0x9bee('0xab'));_0x3e1fbd[_0x9bee('0xac')](_0x39a2c1,'5',_0x2d735e)[_0x9bee('0x5c')](function(_0x18792a){_0x221e32=_0x18792a[_0x9bee('0x7e')]==0x1;if(!_0x221e32){if(ut[_0x9bee('0x79')](_0x39a2c1)>=_0x2d735e[_0x9bee('0x81')]){_0x158d7d=ut[_0x9bee('0x82')](_0x39a2c1,0xf,_0x9bee('0x83'));rpcDb[_0x9bee('0x6e')](_0x158d7d,'[callProgressDetectingCustomer][logBusyGlobal]');}else{if(_0x39a2c1[_0x9bee('0xa8')]>=_0x2d735e[_0x9bee('0xad')]){rpcDb[_0x9bee('0x6e')](_0x39a2c1,'[callProgressDetectingCustomer][logBusy]');}else{rpcDb[_0x9bee('0xae')](ut[_0x9bee('0x86')](_0x39a2c1,'countbusyretry',_0x2d735e[_0x9bee('0xaf')]),_0x39a2c1['unlockAgent'],_0x39a2c1['activeContact']);}}}else{_0x39a2c1[_0x9bee('0xa8')]++;_0x3e1fbd[_0x9bee('0x8c')]({'id':_0x39a2c1[_0x9bee('0x8b')],'field':{'countbusyretry':_0x39a2c1[_0x9bee('0xa8')]}})[_0x9bee('0x5c')](function(){_0x3e1fbd[_0x9bee('0x8d')](_0x39a2c1,_0x446475,_0x181df1)['then'](function(){});});}});break;case _0x9bee('0xb0'):_0x2d735e[_0x9bee('0xb1')]+=0x1;_0x39a2c1['countnoanswerretry']+=0x1;_0x39a2c1['countglobal']=ut[_0x9bee('0x79')](_0x39a2c1);ut[_0x9bee('0x66')](_0x39a2c1,0x3,'NoAnswer');_0x446475=_0x2d735e[_0x9bee('0xb2')];_0x181df1=_0x2d735e[_0x9bee('0x80')];var _0x3617b4=ut[_0x9bee('0xb3')](_0x39a2c1,_0x2d735e);ami['emit'](_0x9bee('0xb4'),_0x3617b4);rpcDb[_0x9bee('0x6c')](_0x39a2c1,_0x9bee('0xb5'));_0x3e1fbd['verifyAdditionalPhones'](_0x39a2c1,'3',_0x2d735e)['then'](function(_0x301d22){_0x221e32=_0x301d22[_0x9bee('0x7e')]==0x1;if(!_0x221e32){if(ut[_0x9bee('0x79')](_0x39a2c1)>=_0x2d735e['dialGlobalMaxRetry']){_0x158d7d=ut[_0x9bee('0x82')](_0x39a2c1,0xf,_0x9bee('0x83'));rpcDb[_0x9bee('0x6e')](_0x158d7d,_0x9bee('0xb6'));}else{if(_0x39a2c1[_0x9bee('0xb7')]>=_0x2d735e[_0x9bee('0xb8')]){rpcDb[_0x9bee('0x6e')](_0x39a2c1,_0x9bee('0xb5'));}else{rpcDb[_0x9bee('0xae')](ut[_0x9bee('0x86')](_0x39a2c1,_0x9bee('0xb7'),_0x2d735e['dialNoAnswerRetryFrequency']),_0x39a2c1[_0x9bee('0x87')],_0x39a2c1['activeContact']);}}}else{_0x39a2c1['countnoanswerretry']++;_0x3e1fbd['incrementPreviewCounters']({'id':_0x39a2c1[_0x9bee('0x8b')],'field':{'countnoanswerretry':_0x39a2c1['countnoanswerretry']}})['then'](function(){_0x3e1fbd['swapAdditionalPhones'](_0x39a2c1,_0x446475,_0x181df1)['then'](function(){});});}});break;case'CONGESTION':_0x2d735e[_0x9bee('0xb9')]+=0x1;_0x39a2c1['countcongestionretry']+=0x1;_0x39a2c1[_0x9bee('0x9f')]=ut[_0x9bee('0x79')](_0x39a2c1);ut[_0x9bee('0x66')](_0x39a2c1,0x8,_0x9bee('0xba'));_0x446475=_0x2d735e[_0x9bee('0xbb')];_0x181df1=_0x2d735e[_0x9bee('0x80')];ami[_0x9bee('0x26')](_0x9bee('0xbc'),ut[_0x9bee('0x95')](_0x39a2c1,'congestion'));rpcDb[_0x9bee('0x6c')](_0x39a2c1,_0x9bee('0xbd'));_0x3e1fbd['verifyAdditionalPhones'](_0x39a2c1,'8',_0x2d735e)[_0x9bee('0x5c')](function(_0x36c06e){_0x221e32=_0x36c06e[_0x9bee('0x7e')]==0x1;if(!_0x221e32){if(ut[_0x9bee('0x79')](_0x39a2c1)>=_0x2d735e['dialGlobalMaxRetry']){_0x158d7d=ut[_0x9bee('0x82')](_0x39a2c1,0xf,_0x9bee('0x83'));rpcDb[_0x9bee('0x6e')](_0x158d7d,_0x9bee('0xbe'));}else{if(_0x39a2c1[_0x9bee('0xbf')]>=_0x2d735e[_0x9bee('0xc0')]){rpcDb[_0x9bee('0x6e')](_0x39a2c1,'[callProgressDetectingCustomer][logCongestion]');}else{rpcDb['rescheduleContact'](ut['scheduledAt'](_0x39a2c1,'countcongestionretry',_0x2d735e[_0x9bee('0xaf')]),_0x39a2c1[_0x9bee('0x87')],_0x39a2c1[_0x9bee('0x88')]);}}}else{_0x39a2c1['countcongestionretry']++;_0x3e1fbd[_0x9bee('0x8c')]({'id':_0x39a2c1[_0x9bee('0x8b')],'field':{'countcongestionretry':_0x39a2c1[_0x9bee('0xbf')]}})['then'](function(){_0x3e1fbd['swapAdditionalPhones'](_0x39a2c1,_0x446475,_0x181df1)[_0x9bee('0x5c')](function(){});});}});break;case _0x9bee('0xc1'):_0x2d735e['outboundRejectCallsDay']+=0x1;_0x39a2c1[_0x9bee('0xc2')]+=0x1;_0x39a2c1[_0x9bee('0x9f')]=ut[_0x9bee('0x79')](_0x39a2c1);ut['logCustomer'](_0x39a2c1,0x14,'AgentReject');_0x446475=_0x2d735e[_0x9bee('0xc3')];_0x181df1=_0x2d735e[_0x9bee('0x80')];ami[_0x9bee('0x26')]('custom:agentreject',ut[_0x9bee('0x95')](_0x39a2c1,'agentreject'));rpcDb[_0x9bee('0x6c')](_0x39a2c1,_0x9bee('0xc4'));_0x3e1fbd[_0x9bee('0xac')](_0x39a2c1,'20',_0x2d735e)[_0x9bee('0x5c')](function(_0x275870){_0x221e32=_0x275870['additional']==0x1;if(!_0x221e32){if(ut[_0x9bee('0x79')](_0x39a2c1)>=_0x2d735e[_0x9bee('0x81')]){_0x158d7d=ut[_0x9bee('0x82')](_0x39a2c1,0x14,_0x9bee('0xc5'));rpcDb[_0x9bee('0x6e')](_0x158d7d,_0x9bee('0xc6'));}else{if(_0x39a2c1['countagentrejectretry']>=_0x2d735e[_0x9bee('0xc7')]){rpcDb[_0x9bee('0x6e')](_0x39a2c1,_0x9bee('0xc6'));}else{rpcDb[_0x9bee('0xae')](ut[_0x9bee('0x86')](_0x39a2c1,'countagentrejectretry',_0x2d735e[_0x9bee('0xc3')]),_0x39a2c1[_0x9bee('0x87')],_0x39a2c1['activeContact']);}}}else{_0x39a2c1['countnoanswerretry']++;_0x3e1fbd['incrementPreviewCounters']({'id':_0x39a2c1['idContact'],'field':{'countnoanswerretry':_0x39a2c1[_0x9bee('0xb7')]}})['then'](function(){_0x3e1fbd[_0x9bee('0x8d')](_0x39a2c1,_0x446475,_0x181df1)[_0x9bee('0x5c')](function(){});});}});break;case _0x9bee('0xc8'):_0x2d735e[_0x9bee('0xc9')]+=0x1;_0x39a2c1[_0x9bee('0xca')]+=0x1;_0x39a2c1['countglobal']=ut[_0x9bee('0x79')](_0x39a2c1);ut[_0x9bee('0x66')](_0x39a2c1,0xb,_0x9bee('0xcb'));rpcDb[_0x9bee('0x6c')](_0x39a2c1,_0x9bee('0xcc'));_0x3e1fbd[_0x9bee('0xac')](_0x39a2c1,'11',_0x2d735e)[_0x9bee('0x5c')](function(_0x191711){_0x221e32=_0x191711[_0x9bee('0x7e')]==0x1;if(!_0x221e32){if(ut[_0x9bee('0x79')](_0x39a2c1)>=_0x2d735e['dialGlobalMaxRetry']){_0x158d7d=ut[_0x9bee('0x82')](_0x39a2c1,0xf,_0x9bee('0x83'));rpcDb[_0x9bee('0x6e')](_0x158d7d,_0x9bee('0xcc'));}else{if(_0x39a2c1[_0x9bee('0xcd')]>=_0x2d735e[_0x9bee('0xce')]){rpcDb[_0x9bee('0x6e')](_0x39a2c1,_0x9bee('0xcc'));}else{rpcDb['rescheduleContact'](ut[_0x9bee('0x86')](_0x39a2c1,_0x9bee('0xca'),_0x2d735e[_0x9bee('0xcf')]),_0x39a2c1[_0x9bee('0x87')],_0x39a2c1[_0x9bee('0x88')]);}}}else{_0x39a2c1[_0x9bee('0xb7')]++;_0x3e1fbd['incrementPreviewCounters']({'id':_0x39a2c1['idContact'],'field':{'countnoanswerretry':_0x39a2c1[_0x9bee('0xb7')]}})['then'](function(){_0x3e1fbd['swapAdditionalPhones'](_0x39a2c1,_0x446475,_0x181df1)[_0x9bee('0x5c')](function(){});});}});break;case'18':_0x2d735e[_0x9bee('0xd0')]+=0x1;_0x39a2c1['countmachineretry']+=0x1;_0x39a2c1[_0x9bee('0x9f')]=ut[_0x9bee('0x79')](_0x39a2c1);ut['logCustomer'](_0x39a2c1,0x12,_0x47b2e8[_0x9bee('0xd1')]||_0x47b2e8[_0x9bee('0xd2')]);ami[_0x9bee('0x26')](_0x9bee('0xd3'),ut[_0x9bee('0x95')](_0x39a2c1,'amd'));rpcDb[_0x9bee('0x6c')](_0x39a2c1,'[callProgressDetectingCustomer][hangupInAMD]');_0x3e1fbd[_0x9bee('0xac')](_0x39a2c1,'18',_0x2d735e)[_0x9bee('0x5c')](function(_0x1ac89b){_0x221e32=_0x1ac89b[_0x9bee('0x7e')]==0x1;if(!_0x221e32){if(ut[_0x9bee('0x79')](_0x39a2c1)>=_0x2d735e['dialGlobalMaxRetry']){_0x158d7d=ut['cloneAction'](_0x39a2c1,0x12,_0x9bee('0x83'));rpcDb['createCustomerFinal'](_0x158d7d,_0x9bee('0xd4'));}else{rpcDb[_0x9bee('0x6e')](_0x39a2c1,_0x9bee('0xd4'));}}else{_0x39a2c1['countnoanswerretry']++;_0x3e1fbd[_0x9bee('0x8c')]({'id':_0x39a2c1['idContact'],'field':{'countnoanswerretry':_0x39a2c1[_0x9bee('0xb7')]}})[_0x9bee('0x5c')](function(){_0x3e1fbd[_0x9bee('0x8d')](_0x39a2c1,_0x446475,_0x181df1)[_0x9bee('0x5c')](function(){});});}});delete this[_0x9bee('0x48')][_0x47b2e8[_0x9bee('0x89')]];break;case'19':_0x2d735e[_0x9bee('0xd0')]+=0x1;_0x39a2c1[_0x9bee('0x9f')]=ut[_0x9bee('0x79')](_0x39a2c1);ut[_0x9bee('0x66')](_0x39a2c1,0x13,_0x47b2e8[_0x9bee('0xd1')]||_0x47b2e8[_0x9bee('0xd2')]);ami[_0x9bee('0x26')](_0x9bee('0xd3'),ut[_0x9bee('0x95')](_0x39a2c1,_0x9bee('0xd5')));rpcDb[_0x9bee('0x6c')](_0x39a2c1,'[callProgressDetectingCustomer][machine]');_0x3e1fbd['verifyAdditionalPhones'](_0x39a2c1,'18',_0x2d735e)['then'](function(_0x1413be){_0x221e32=_0x1413be['additional']==0x1;if(!_0x221e32){if(ut[_0x9bee('0x79')](_0x39a2c1)>=_0x2d735e[_0x9bee('0x81')]){_0x158d7d=ut[_0x9bee('0x82')](_0x39a2c1,0xf,'Global');rpcDb[_0x9bee('0x6e')](_0x158d7d,_0x9bee('0xd6'));}else{rpcDb[_0x9bee('0x6e')](_0x39a2c1,_0x9bee('0xd6'));}}else{_0x39a2c1[_0x9bee('0xb7')]++;_0x3e1fbd[_0x9bee('0x8c')]({'id':_0x39a2c1[_0x9bee('0x8b')],'field':{'countnoanswerretry':_0x39a2c1['countnoanswerretry']}})[_0x9bee('0x5c')](function(){_0x3e1fbd[_0x9bee('0x8d')](_0x39a2c1,_0x446475,_0x181df1)[_0x9bee('0x5c')](function(){});});}});delete this['actions'][_0x47b2e8[_0x9bee('0x89')]];break;default:if(_0x39a2c1[_0x9bee('0x4d')]){ut['decrementTalkink'](_0x2d735e,_0x9bee('0xd7'));ut[_0x9bee('0x57')](_0x9bee('0xd8')+_0x2d735e[_0x9bee('0x2b')],_0x47b2e8);}_0x2d735e[_0x9bee('0xd0')]+=0x1;_0x39a2c1[_0x9bee('0x9f')]=ut[_0x9bee('0x79')](_0x39a2c1);ut[_0x9bee('0x66')](_0x39a2c1,0xc,_0x47b2e8['cause-txt']||_0x47b2e8[_0x9bee('0xd2')]);_0x446475=_0x2d735e[_0x9bee('0xc3')];_0x181df1=_0x2d735e[_0x9bee('0x80')];rpcDb[_0x9bee('0x6c')](_0x39a2c1,_0x9bee('0xd9'));_0x3e1fbd[_0x9bee('0xac')](_0x39a2c1,'20',_0x2d735e)[_0x9bee('0x5c')](function(_0x185dcd){_0x221e32=_0x185dcd[_0x9bee('0x7e')]==0x1;if(!_0x221e32){if(ut[_0x9bee('0x79')](_0x39a2c1)>=_0x2d735e[_0x9bee('0x81')]){_0x158d7d=ut['cloneAction'](_0x39a2c1,0xf,_0x9bee('0x83'));rpcDb[_0x9bee('0x6e')](_0x158d7d,'[callProgressDetectingCustomer][logUnknownGlobal]');}else{rpcDb[_0x9bee('0x6e')](_0x39a2c1,_0x9bee('0xda'));}delete this[_0x9bee('0x48')][_0x47b2e8[_0x9bee('0x89')]];}else{_0x3e1fbd[_0x9bee('0x8d')](_0x39a2c1,_0x446475,_0x181df1)[_0x9bee('0x5c')](function(){});}});}if(!(_0x39a2c1['dialAnswer']&&_0x1636e1==='16')){ut[_0x9bee('0x55')](_0x2d735e,'[callProgressDetectingCustomer]');logger[_0x9bee('0x27')](_0x9bee('0xdb'),_0x39a2c1[_0x9bee('0x92')],_0x9bee('0x93'),_0x2d735e[_0x9bee('0x2b')],_0x9bee('0xdc'),_0x2d735e['originated']);}if(_0x1636e1!=='ANSWER'){delete this[_0x9bee('0x48')][_0x47b2e8[_0x9bee('0x89')]];delete this[_0x9bee('0x48')][_0x47b2e8[_0x9bee('0xdd')]];}_0x2d735e['queueSummaryCountersUpdated']=!![];}};Preview[_0x9bee('0xc')][_0x9bee('0xde')]=function(_0x1eccd9,_0x185497,_0x26d080){if(_[_0x9bee('0xdf')](_0x185497)&&_0x9bee('0xe0')!==typeof _0x185497){return;}if(_[_0x9bee('0xdf')](_0x26d080)&&_0x9bee('0xe0')!==typeof _0x26d080){return;}switch(_0x26d080[_0x9bee('0xe1')]){case'0':ut['logAgent'](_0x1eccd9,0x0,_0x9bee('0x7a'));rpcDb[_0x9bee('0xe2')](_0x1eccd9,_0x9bee('0xe3'));break;case'3':ut[_0x9bee('0xe4')](_0x1eccd9,0x3,'NoAnswer');rpcDb['createAgentHistory'](_0x1eccd9,'[callProgressDetectingAgent][logNoAnswer]');break;case'5':ut[_0x9bee('0xe4')](_0x1eccd9,0x5,_0x9bee('0xe5'));rpcDb[_0x9bee('0xe2')](_0x1eccd9,_0x9bee('0xe6'));break;case'8':ut[_0x9bee('0xe4')](_0x1eccd9,0x8,_0x9bee('0xba'));rpcDb['createAgentHistory'](_0x1eccd9,_0x9bee('0xe7'));break;case'22':ut[_0x9bee('0xe4')](_0x1eccd9,0x16,'AnswerAGI');rpcDb[_0x9bee('0xe2')](_0x1eccd9,'[callProgressDetectingAgent][logAnswerAGI]');break;default:ut[_0x9bee('0xe4')](_0x1eccd9,0xc,_0x26d080[_0x9bee('0xe1')]);rpcDb['createAgentHistory'](_0x1eccd9,_0x9bee('0xe7'));}ut['updateOriginated'](_0x185497,'[callProgressDetectingAgent]');logger[_0x9bee('0x27')](_0x9bee('0xe8'),_0x1eccd9[_0x9bee('0x92')],_0x9bee('0x93'),_0x185497[_0x9bee('0x2b')],'originated:\x20',_0x185497['originated']);delete this[_0x9bee('0x48')][_0x1eccd9[_0x9bee('0x92')]];};Preview[_0x9bee('0xc')]['verifyAdditionalPhones']=function(_0x2b6cf3,_0x87e675,_0x51f00b){return cmHopperAdditionalPhone[_0x9bee('0xac')](_0x2b6cf3,_0x87e675,_0x51f00b)[_0x9bee('0x54')](logger['info']('[verifyAdditionalPhone]\x20'));};Preview[_0x9bee('0xc')][_0x9bee('0x8d')]=function(_0x568c26,_0x32f4ed,_0x47b071){return cmHopperAdditionalPhone['swapAdditionalPhones'](_0x568c26,_0x32f4ed,_0x47b071)['catch'](logger['info'](_0x9bee('0xe9')));};Preview[_0x9bee('0xc')][_0x9bee('0x8c')]=function(_0x1d8102){return Promise[_0x9bee('0xea')]()['then'](cmHopperAdditionalPhone['incrementPreviewCounters'](_0x1d8102))['catch'](logger[_0x9bee('0x27')](_0x9bee('0xeb')));};Preview[_0x9bee('0xc')]['checkInBlack']=function(_0x23c821,_0x3b5523,_0x1415fe,_0x2d4357,_0x55ff31){var _0x30852e=this;return new Promise(function(_0x429c52,_0x3e32cd){if(_['isNil'](_0x3b5523)||_['isNil'](_0x3b5523['Contact'])||_['isNil'](_0x3b5523[_0x9bee('0xec')])||_[_0x9bee('0x5d')](_0x3b5523[_0x9bee('0xed')])){_0x3e32cd(ut[_0x9bee('0x36')]('Contact\x20is\x20undefined',_0x2d4357,_0x55ff31));return;}var _0x1af863=uuid['v4']();var _0x2c80dd=_0x30852e[_0x9bee('0x11')][_0x3b5523[_0x9bee('0x47')][_0x9bee('0x2b')]];var _0x651637=_0x1415fe?_0x30852e[_0x9bee('0x14')][_0x1415fe]['id']:undefined;_0x30852e['actions'][_0x1af863]=new Action(_0x3b5523,_0x2c80dd,_0x1af863,_0x1415fe,_0x651637);var _0x4693ac=_0x30852e[_0x9bee('0x48')][_0x1af863];_0x4693ac[_0x9bee('0x87')]=_0x2d4357;_0x4693ac['activeContact']=_0x55ff31;_0x4693ac[_0x9bee('0xee')]=_0x1415fe;if(_[_0x9bee('0xef')](_0x23c821)){_0x30852e[_0x9bee('0xf0')](_0x4693ac,_0x2c80dd,_0x3b5523,_0x1415fe)[_0x9bee('0x5c')](function(_0x5ee58b){logger[_0x9bee('0x27')](_0x9bee('0xf1'),'Queue:\x20'+_0x4693ac[_0x9bee('0x49')]+_0x9bee('0xf2')+_0x4693ac[_0x9bee('0x8b')],JSON[_0x9bee('0x4a')](_0x5ee58b));ami[_0x9bee('0x26')](_0x9bee('0xf3'),ut[_0x9bee('0x95')](_0x4693ac,'called',_0x30852e[_0x9bee('0x11')][_0x4693ac['queue']]));_0x429c52(ut[_0x9bee('0x36')](_0x9bee('0xf4')));})[_0x9bee('0x54')](function(_0x31168f){ut[_0x9bee('0x33')]('[Preview][execCall][failure]',_0x31168f);_0x3e32cd(ut['message'](_0x9bee('0xf5'),_0x2d4357,_0x55ff31));});}else{_0x2c80dd['outboundBlacklistCallsDay']+=0x1;ut[_0x9bee('0xf6')](_0x4693ac);rpcDb[_0x9bee('0xf7')](_0x4693ac,_0x9bee('0xf8'));delete _0x30852e[_0x9bee('0x48')][_0x1af863];_0x3e32cd(ut[_0x9bee('0x36')](_0x9bee('0xf9'),_0x2d4357,_0x55ff31));}});};Preview[_0x9bee('0xc')][_0x9bee('0x74')]=function(_0x2e9663){return!_[_0x9bee('0x5d')](_0x2e9663)&&!_[_0x9bee('0x5d')](_0x2e9663[_0x9bee('0x2b')])&&!_[_0x9bee('0x5d')](_0x2e9663['active'])&&_0x2e9663['active']&&!_[_0x9bee('0x5d')](this[_0x9bee('0x13')][util[_0x9bee('0x29')](_0x9bee('0xfa'),_0x2e9663[_0x9bee('0x2b')])])&&!_[_0x9bee('0x5d')](this[_0x9bee('0x13')][util['format'](_0x9bee('0xfa'),_0x2e9663[_0x9bee('0x2b')])]['status'])&&(this['trunks'][util[_0x9bee('0x29')](_0x9bee('0xfa'),_0x2e9663[_0x9bee('0x2b')])][_0x9bee('0x52')]==='reachable'||this['trunks'][util[_0x9bee('0x29')](_0x9bee('0xfa'),_0x2e9663[_0x9bee('0x2b')])][_0x9bee('0x52')]===_0x9bee('0xfb'));};Preview['prototype']['run']=function(_0x187eb6,_0x153f71){return this[_0x9bee('0xfc')](_0x187eb6,_0x153f71)['then'](function(_0x2e1bd0){return _[_0x9bee('0x4e')](_0x2e1bd0,[_0x9bee('0x36')]);})['catch'](function(_0x122974){if(_0x122974['unlock']){rpcDb[_0x9bee('0xfd')](_0x187eb6);}if(_0x122974[_0x9bee('0xfe')]){rpcDb[_0x9bee('0xff')](_0x187eb6);}throw _[_0x9bee('0x4e')](_0x122974,[_0x9bee('0x36')]);});};Preview[_0x9bee('0xc')][_0x9bee('0xfc')]=function(_0xef560a,_0x2b536e){var _0x229225=this;var _0x49557b,_0x2b61b5;return rpcDb['getContactPreview'](_0xef560a)[_0x9bee('0x5c')](function(_0x165b12){if(!_['isNil'](_0x165b12[0x0])){_0x2b61b5=_0x165b12[0x0][_0x9bee('0x100')]?![]:!![];_0x49557b=_0x165b12[0x0][_0x9bee('0x100')]?!![]:![];_0x49557b=_0x2b536e?!![]:_0x49557b;}var _0x6e5a34=_0x229225[_0x9bee('0x101')](_0x165b12);if(_0x6e5a34[_0x9bee('0x102')]){rpcDb[_0x9bee('0x103')](_[_0x9bee('0x4e')](_0x165b12[0x0],['VoiceQueueId',_0x9bee('0xec')]))[_0x9bee('0x5c')](function(_0x5ee4e9){_0x229225[_0x9bee('0x104')](_0x5ee4e9,_0x165b12[0x0],_0x2b536e,_0x2b61b5,_0x49557b)[_0x9bee('0x5c')](function(_0x2ba7bf){return _0x2ba7bf;})['catch'](function(_0x2d7e2f){throw _0x2d7e2f;});})['catch'](function(_0x1c84cf){ut[_0x9bee('0x33')](_0x9bee('0x105'),_0x1c84cf);throw ut['message'](_0x9bee('0x106'),_0x2b61b5,_0x49557b);});}else{throw ut[_0x9bee('0x36')](_0x6e5a34[_0x9bee('0x36')],_0x2b61b5,_0x49557b);}})[_0x9bee('0x54')](function(_0x4fcd84){ut['logger'](_0x9bee('0x107'),_0x4fcd84);throw ut['message'](_0x9bee('0x106'),![],!![]);});};Preview[_0x9bee('0xc')]['validateContact']=function(_0x1dac2f){if(_[_0x9bee('0x5d')](_0x1dac2f)||_[_0x9bee('0xef')](_0x1dac2f)||!_[_0x9bee('0x5d')](_0x1dac2f[0x0]['Agent'])&&_[_0x9bee('0x5d')](_0x1dac2f[0x0]['Agent']['name'])){ut[_0x9bee('0x33')](_0x9bee('0x108'),_0x1dac2f);return{'isValid':![],'message':'Empty\x20Contact'};}var _0x3f7289=this[_0x9bee('0x11')][_0x1dac2f[0x0][_0x9bee('0x47')][_0x9bee('0x2b')]];_0x3f7289[_0x9bee('0x36')]=utils[_0x9bee('0x32')][_0x9bee('0x76')];if(_[_0x9bee('0x5d')](_0x3f7289)){ut['logger'](_0x9bee('0x109'),_0x3f7289);return{'isValid':![],'message':_0x9bee('0x10a')};}if(!this[_0x9bee('0x74')](_0x3f7289[_0x9bee('0x10b')])){ut[_0x9bee('0x33')](_0x9bee('0x10c'),'campaign\x20Name:\x20'+_0x3f7289['name']+_0x9bee('0x10d'));if(!this[_0x9bee('0x74')](_0x3f7289[_0x9bee('0x10e')])){ut['logger'](_0x9bee('0x10c'),_0x3f7289[_0x9bee('0x2b')]+_0x9bee('0x10f'));return{'isValid':![],'message':_0x9bee('0x110')};}}if(!ut[_0x9bee('0x72')](_0x3f7289[_0x9bee('0x41')])){ut[_0x9bee('0x33')]('[Preview][validateContact][Campaign\x20Active]',_0x3f7289['name']+_0x9bee('0x111'));return{'isValid':![],'message':'campaign\x20Name:\x20'+_0x3f7289['name']+_0x9bee('0x111')};}return{'isValid':!![],'message':_0x9bee('0x112')};};Preview['prototype'][_0x9bee('0xf0')]=function(_0x5057fb,_0x10fb80,_0xcd393a,_0x1335b6){var _0xef4c6=this;return new Promise(function(_0x44057c,_0x228d59){var _0x47175a=_0x5057fb['uniqueid'];var _0x582bfe=_0xef4c6['isTrunkReachable'](_0x10fb80['Trunk'])?util[_0x9bee('0x29')](_0x9bee('0x113'),_0x10fb80[_0x9bee('0x10b')][_0x9bee('0x2b')],_[_0x9bee('0x5d')](_0x10fb80[_0x9bee('0x114')])?'':_0x10fb80[_0x9bee('0x114')]['trim']()||'',_0x10fb80['dialCutDigit']>0x0?_0xcd393a[_0x9bee('0xec')][_0x9bee('0x115')](_0x10fb80['dialCutDigit']):_0xcd393a[_0x9bee('0xec')]):util[_0x9bee('0x29')](_0x9bee('0x113'),_['isNil'](_0x10fb80[_0x9bee('0x10e')])?_0x10fb80[_0x9bee('0x10b')][_0x9bee('0x2b')]:_0x10fb80[_0x9bee('0x10e')][_0x9bee('0x2b')],_[_0x9bee('0x5d')](_0x10fb80[_0x9bee('0x114')])?'':_0x10fb80[_0x9bee('0x114')][_0x9bee('0x116')]()||'',_0x10fb80['dialCutDigit']>0x0?_0xcd393a[_0x9bee('0xec')][_0x9bee('0x115')](_0x10fb80[_0x9bee('0x117')]):_0xcd393a[_0x9bee('0xec')]);var _0x3eb6f9=_0xef4c6[_0x9bee('0x74')](_0x10fb80[_0x9bee('0x10b')])?ut[_0x9bee('0x118')](_0x10fb80[_0x9bee('0x10b')]['callerid'],_0x10fb80[_0x9bee('0x119')],_0x10fb80[_0x9bee('0x11a')]>0x0?ut[_0x9bee('0x11b')](_0x10fb80[_0x9bee('0x11c')],_0x10fb80['dialRandomLastDigitCallerIdNumber']):_0x10fb80[_0x9bee('0x11c')]):ut['getCallerId'](_['isNil'](_0x10fb80[_0x9bee('0x10e')])?_0x10fb80[_0x9bee('0x10b')][_0x9bee('0x11d')]:_0x10fb80[_0x9bee('0x10e')]['callerid'],_0x10fb80[_0x9bee('0x119')],_0x10fb80[_0x9bee('0x11a')]>0x0?ut[_0x9bee('0x11b')](_0x10fb80[_0x9bee('0x11c')],_0x10fb80[_0x9bee('0x11a')]):_0x10fb80['dialOriginateCallerIdNumber']);if(_0x3eb6f9){_0x5057fb[_0x9bee('0x11e')]=ut[_0x9bee('0x11f')](_0x3eb6f9);_0x5057fb[_0x9bee('0x120')]=ut[_0x9bee('0x121')](_0x3eb6f9);}var _0x29dab7=ut[_0x9bee('0x122')](_0x10fb80,_0xcd393a,_0x582bfe,_0x3eb6f9,_0x47175a,_0x5057fb);var _0x52f951=utils[_0x9bee('0x123')](_0xcd393a['Contact']);Object[_0x9bee('0x124')](_0x29dab7,_0x52f951);_[_0x9bee('0x125')](_0x5057fb,ut[_0x9bee('0x126')](_0x29dab7));_0x5057fb[_0x9bee('0x64')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x10fb80[_0x9bee('0x127')]=_0x29dab7;var _0x1f6e54=ut[_0x9bee('0x128')](_0x5057fb,_0x10fb80,_0x29dab7,_0x5057fb[_0x9bee('0x88')],_0x1335b6);return ami[_0x9bee('0x51')](_0x1f6e54)[_0x9bee('0x5c')](function(_0x1a89e3){_0x10fb80[_0x9bee('0x2f')]+=0x1;logger[_0x9bee('0x27')](_0x9bee('0x129'),_0x47175a,_0x9bee('0x93'),_0x10fb80[_0x9bee('0x2b')],_0x9bee('0xdc'),_0x10fb80['originated']);_0x44057c(_0x1a89e3);})[_0x9bee('0x54')](function(_0x9b645a){ut[_0x9bee('0xe4')](_0x5057fb,0xe,_0x9bee('0x12a'));rpcDb[_0x9bee('0xe2')](_0x5057fb,_0x9bee('0x12b'));_0x228d59(_0x9b645a);});});};Preview[_0x9bee('0xc')][_0x9bee('0x20')]=function(_0x99fb13){if(this[_0x9bee('0x48')][_0x99fb13[_0x9bee('0x89')]]){this['actions'][_0x99fb13[_0x9bee('0x89')]][_0x9bee('0x53')]=_0x99fb13[_0x9bee('0x53')];}};Preview[_0x9bee('0xc')][_0x9bee('0x17')]=function(_0x34c249){var _0x579844=this;var _0x5adeac=this[_0x9bee('0x48')][_0x34c249['actionid']];if(_0x5adeac){if(_0x5adeac[_0x9bee('0xee')]&&this[_0x9bee('0x14')][_0x5adeac[_0x9bee('0xee')]]){ut[_0x9bee('0x12c')](_0x5adeac,this[_0x9bee('0x14')][_0x5adeac[_0x9bee('0xee')]]['name'],this['agents'][_0x5adeac[_0x9bee('0xee')]]['id']);}var _0x4756f0=_['clone'](_0x5adeac);_0x4756f0[_0x9bee('0x90')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');var _0xbc8223=_0x579844['campaignsPreview'][_0x5adeac[_0x9bee('0x49')]];if(ut[_0x9bee('0x12d')](_0x34c249[_0x9bee('0x12e')])){if(_0x5adeac['unlockAgent']){rpcDb[_0x9bee('0xfd')](_0x5adeac[_0x9bee('0x8b')]);}if(_0x5adeac[_0x9bee('0x88')]){rpcDb[_0x9bee('0xff')](_0x5adeac[_0x9bee('0x8b')]);}ami[_0x9bee('0x26')]('custom:agentringnoanswer',ut[_0x9bee('0x95')](_0x5adeac,_0x9bee('0x12f'),this[_0x9bee('0x11')][_0x5adeac[_0x9bee('0x49')]]));this['callProgressDetectingAgent'](_0x4756f0,_0xbc8223,_0x34c249);}else{_0x5adeac[_0x9bee('0x64')]=moment()['format'](_0x9bee('0x8f'));ut[_0x9bee('0xe4')](_0x4756f0,0x4,'Answer');rpcDb[_0x9bee('0xe2')](_0x4756f0,'[callProgressDetectingAgent][logAnswer]');}}};Preview[_0x9bee('0xc')][_0x9bee('0x1a')]=function(_0x23b2b7){var _0x2e790a=this[_0x9bee('0x48')][_0x23b2b7['linkedid']];var _0x57f3e2;if(_0x2e790a){_0x57f3e2=this[_0x9bee('0x11')][_0x2e790a[_0x9bee('0x49')]];logger['info'](_0x9bee('0x130'),_0x23b2b7[_0x9bee('0x89')],_0x9bee('0x93'),_0x57f3e2[_0x9bee('0x2b')],_0x9bee('0x4b'),_0x57f3e2[_0x9bee('0x4c')]);}if(this['actions'][_0x23b2b7[_0x9bee('0x89')]]&&_0x23b2b7[_0x9bee('0x89')]!==_0x23b2b7['uniqueid']){if(_0x23b2b7[_0x9bee('0x131')]==='16'&&this[_0x9bee('0x48')][_0x23b2b7[_0x9bee('0x89')]][_0x9bee('0x4d')]){this['callProgressDetectingCustomer'](_0x23b2b7,_0x23b2b7[_0x9bee('0x89')],_0x23b2b7[_0x9bee('0x131')]);}else if(this[_0x9bee('0x48')][_0x23b2b7['linkedid']]['dialAnswer']){logger[_0x9bee('0x27')](_0x9bee('0x132'),_0x23b2b7['linkedid'],_0x23b2b7[_0x9bee('0x131')],_0x9bee('0x93'),_0x57f3e2['name'],_0x9bee('0x4b'),_0x57f3e2['pTalking']);this[_0x9bee('0x133')](_0x23b2b7,_0x23b2b7[_0x9bee('0x89')],_0x23b2b7[_0x9bee('0x131')]);}}else if(_0x2e790a&&_[_0x9bee('0x5d')](_0x2e790a[_0x9bee('0x134')])&&_0x57f3e2['dialQueueProject']&&_0x23b2b7[_0x9bee('0x89')]===_0x23b2b7[_0x9bee('0x92')]&&_[_0x9bee('0x5d')](_0x23b2b7[_0x9bee('0xe1')])&&_0x23b2b7[_0x9bee('0x131')]==='16'&&_0x23b2b7[_0x9bee('0x135')]==='6'&&_[_0x9bee('0xdf')](_0x2e790a[_0x9bee('0x136')])){if(_0x2e790a['unlockAgent']){rpcDb[_0x9bee('0xfd')](_0x2e790a['idContact']);}if(_0x2e790a[_0x9bee('0x88')]){rpcDb['disableContact'](_0x2e790a[_0x9bee('0x8b')]);}_0x23b2b7[_0x9bee('0xe1')]='22';this['callProgressDetectingAgent'](_0x2e790a,_0x57f3e2,_0x23b2b7);}else if(_0x2e790a&&_0x2e790a[_0x9bee('0x136')]){if(_0x23b2b7[_0x9bee('0x131')]==='16'&&this[_0x9bee('0x48')][_0x23b2b7[_0x9bee('0x89')]][_0x9bee('0x4d')]){logger['info']('[syncHangup][talking][transfer]',_0x23b2b7['linkedid'],_0x23b2b7[_0x9bee('0x131')],_0x9bee('0x93'),_0x57f3e2[_0x9bee('0x2b')],_0x9bee('0x4b'),_0x57f3e2['pTalking']);this[_0x9bee('0x133')](_0x23b2b7,_0x23b2b7[_0x9bee('0x89')],_0x23b2b7[_0x9bee('0x131')]);}else if(this['actions'][_0x23b2b7[_0x9bee('0x89')]]['dialAnswer']){logger[_0x9bee('0x27')](_0x9bee('0x132'),_0x23b2b7[_0x9bee('0x89')],_0x23b2b7[_0x9bee('0x131')],_0x9bee('0x93'),_0x57f3e2[_0x9bee('0x2b')],'pTalking:\x20',_0x57f3e2[_0x9bee('0x4c')]);this['callProgressDetectingCustomer'](_0x23b2b7,_0x23b2b7[_0x9bee('0x89')],_0x23b2b7[_0x9bee('0x131')]);}}};Preview[_0x9bee('0xc')][_0x9bee('0x1e')]=function(_0xdee9e){if(this[_0x9bee('0x48')][_0xdee9e[_0x9bee('0xdd')]]&&_0xdee9e[_0x9bee('0xdd')]!==_0xdee9e[_0x9bee('0x137')]){this[_0x9bee('0x133')](_0xdee9e,_0xdee9e[_0x9bee('0xdd')],_0xdee9e[_0x9bee('0xd2')]);}};Preview[_0x9bee('0xc')][_0x9bee('0x1c')]=function(_0x2389ca){if(this[_0x9bee('0x48')][_0x2389ca[_0x9bee('0x89')]]&&_0x2389ca[_0x9bee('0x89')]!==_0x2389ca[_0x9bee('0x92')]&&!this[_0x9bee('0x48')][_0x2389ca['linkedid']][_0x9bee('0x4d')]){if(_0x2389ca[_0x9bee('0x131')]==='1'){this[_0x9bee('0x133')](_0x2389ca,_0x2389ca[_0x9bee('0x89')],_0x2389ca[_0x9bee('0x131')]);}}};Preview['prototype'][_0x9bee('0x138')]=function(_0x2f09fe,_0x1eebce,_0x3a6d01){if(this[_0x9bee('0x48')][_0x2f09fe]){if(_[_0x9bee('0x5d')](this['actions'][_0x2f09fe]['variables'])){this[_0x9bee('0x48')][_0x2f09fe][_0x9bee('0x127')]={};}this['actions'][_0x2f09fe][_0x9bee('0x127')][_0x1eebce]=_0x3a6d01;}};Preview[_0x9bee('0xc')][_0x9bee('0x139')]=function(_0x14ba83){try{if(!_[_0x9bee('0x5d')](_0x14ba83)){if(ut[_0x9bee('0x13a')](_['keys'](_0x14ba83[_0x9bee('0x13b')])[0x0])){this[_0x9bee('0x138')](_0x14ba83[_0x9bee('0x92')],_[_0x9bee('0x13c')](_0x14ba83['variable'])[0x0],_0x14ba83[_0x9bee('0x13d')]);}}}catch(_0x5ecc20){logger[_0x9bee('0x13e')](_0x9bee('0x13f'),util[_0x9bee('0x140')](_0x5ecc20,{'showHidden':![],'depth':null}));}};Preview['prototype']['syncAttendedTransfer']=function(_0x9c77d){if(_0x9c77d){if(this[_0x9bee('0x48')][_0x9c77d[_0x9bee('0x141')]]){this['actions'][_0x9c77d[_0x9bee('0x141')]]['transfer']=!![];}}};Preview['prototype']['syncBlindTransfer']=function(_0x50fc52){if(_0x50fc52){if(this[_0x9bee('0x48')][_0x50fc52['transfererlinkedid']]){this[_0x9bee('0x48')][_0x50fc52['transfererlinkedid']][_0x9bee('0x136')]=!![];}}};module['exports']=Preview; \ No newline at end of file +var _0x9c49=['outboundCongestionCallsDay','countcongestionretry','Congestion','dialCongestionRetryFrequency','custom:agentcongestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','CANCEL','outboundRejectCallsDay','countagentrejectretry','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','AgentReject','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectMaxRetry','outboundAbandonedCallsDay','Abandoned','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedMaxRety','countabandonedretry','countmachineretry','cause-txt','dialstatus','amd','[callProgressDetectingCustomer][hangupInAMD]','outboundUnknownCallsDay','custom:amd','[callProgressDetectingCustomer][machine]','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','dialAgentRejectRetryFrequency','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','queueSummaryCountersUpdated','callProgressDetectingAgent','object','isUndefined','reason','logAgent','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','[verifyAdditionalPhone]\x20','resolve','[incrementPreviewCounters]\x20','checkInBlack','phone','VoiceQueueId','Contact\x20is\x20undefined','Queue','isEmpty','execCall','[Preview][execCall][success]','\x20IdHopper:\x20','custom:agentcalled','called','Calling','Call\x20failed','createHistory','[Blacklist][error]','isTrunkReachable','active','SIP/%s','unmonitored','run','execRun','pick','getContactPreview','validateContact','checkIsBlackList','[Preview][checkIsBlackList]','Call\x20unsuccessful','[Preview][validateContact][Empty\x20Contact]','[Preview][validateContact][Empty\x20Campaign]','[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','\x20Trunk\x20Backup\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','\x20Not\x20Active','SIP/%s/%s%s','dialPrefix','trim','substring','dialCutDigit','getCallerId','callerid','getCallerIdRandom','dialOriginateCallerIdNumber','dialRandomLastDigitCallerIdNumber','originatecalleridname','extractCalleridName','originatecalleridnum','extractCalleridNumber','addVariables','setXMDContactVariables','Contact','assign','merge','toLowerVariables','variables','variablesAction','[originated][increment]','actionid','lookAgent','logLookAgent','isFailure','response','unlockContact','custom:agentringnoanswer','rejected','cause','statedesc','channelstate','transfer','[syncHangup][talking][transfer]','syncDialEnd','destlinkedid','keys','variable','addVariable','value','error','[syncVarSet][Preview]','inspect','transfertargetlinkedid','transfererlinkedid','exports','util','lodash','moment','../../../config/environment','preview','actionPreview','../rpc/cmHopperAdditionalPhone','./action','../dialer/utils','redis','enqueue','tail','finally','sequence','campaignsPreview','voiceQueues','trunks','actions','agents','clockClearZombieChannels','originateresponse','syncOriginateResponse','bind','syncHangup','hanguprequest','syncHangupRequest','dialend','newexten','syncNewExten','varset','syncVarSet','attendedtransfer','blindtransfer','syncBlindTransfer','emit','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','stringify','format','name','voice_queue_channel:remove','voice_queue_presence:remove','originated','pTalking','sendMessageOneNotActive','paused','message','CAMPAIGN_STATUS','logger','\x20is\x20not\x20active','DEACTIVATED','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20deactivated','prototype','loopCampaigns','syncCampaigns','hasOwnProperty','dialMethod','booked','type','outbound','clearZombieChannels','dialActive','setMessage','dialPreviewAutoRecallMe','recallMe','clearZombieChannel','isNil','[clearZombieChannels][talking]','queue','originated:\x20','dialAnswer','ListId','Action','status','channel','catch','updateOriginated','[clearZombieChannel]','decrementTalkink','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','[action]','size','agentReadyId','then','getDiff','scheduledat','dialRecallMeTimeout','Agent','voicePause','logger2','[RecallMe]','disableContact','starttime','YYYY-MM-DD\x20HH:mm:ss','outboundReCallsDay','logCustomer','RecallInQueue','dialRecallInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','createCustomerFinal','[getContactRecallMe]','loggedIn','NO_AGENTS_LOGGED','isActive','INACTIVE','Trunk','TrunkBackup','UNREACHABLE_TRUNK','ACTIVE','callProgressDetectingCustomer','outboundNoSuchCallsDay','countnosuchnumberretry','countglobal','totalGlobal','NoSuchNumber','custom:agentnosuchnumber','buildObj','nosuchnumber','verifyAdditionalPhones','additional','dialNoSuchNumberRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','[callProgressDetectingCustomer][logNoSuchGlobal]','dialNoSuchNumberMaxRetry','rescheduleContact','scheduledAt','activeContact','swapAdditionalPhones','ANSWER','responsetime','answertime','[syncHangup][talking][increment]','uniqueid','\x20Queue','custom:agentconnect','acw','custom:agentConnectPreview','buildAcw','custom:agentcomplete','complete','total','answered','[16]','Answer','[callProgressDetectingCustomer][logAnswer]','sumDuration','talktime','[syncHangup][talking][decrement]','pTalking:\x20','linkedid','BUSY','outboundBusyCallsDay','countbusyretry','Busy','dialBusyRetryFrequency','custom:agentbusy','busy','[callProgressDetectingCustomer][logBusy]','Global','[callProgressDetectingCustomer][logBusyGlobal]','unlockAgent','incrementPreviewCounters','idContact','NOANSWER','outboundNoAnswerCallsDay','countnoanswerretry','NoAnswer','dialNoAnswerRetryFrequency','buildNoAnswerEventPayload','cloneAction','[callProgressDetectingCustomer][logNoAnswerGlobal]','[callProgressDetectingCustomer][logNoAnswer]','CONGESTION'];(function(_0x495b3d,_0x4d3da4){var _0x4cb329=function(_0xdef9f0){while(--_0xdef9f0){_0x495b3d['push'](_0x495b3d['shift']());}};_0x4cb329(++_0x4d3da4);}(_0x9c49,0x1c8));var _0x99c4=function(_0x3a1721,_0x5409d8){_0x3a1721=_0x3a1721-0x0;var _0x2c6285=_0x9c49[_0x3a1721];return _0x2c6285;};'use strict';var util=require(_0x99c4('0x0'));var _=require(_0x99c4('0x1'));var uuid=require('uuid');var moment=require(_0x99c4('0x2'));var Redis=require('ioredis');var config=require(_0x99c4('0x3'));var logger=require('../../../config/logger')(_0x99c4('0x4'));var loggerAction=require('../../../config/logger')(_0x99c4('0x5'));var ami=require('../ami');var rpcDb=require('./rpcDb');var cmHopperAdditionalPhone=require(_0x99c4('0x6'));var Action=require(_0x99c4('0x7'));var ut=require('./util/util');var utils=require(_0x99c4('0x8'));config[_0x99c4('0x9')]=_['defaults'](config[_0x99c4('0x9')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x99c4('0x9')]));var Sequence=function(){};Sequence['prototype'][_0x99c4('0xa')]=function(_0x6c32e1){this['tail']=this[_0x99c4('0xb')]?this[_0x99c4('0xb')][_0x99c4('0xc')](_0x6c32e1):_0x6c32e1();};function Preview(_0x482e1c){this[_0x99c4('0xd')]=new Sequence();this[_0x99c4('0xe')]=_0x482e1c[_0x99c4('0xf')];this[_0x99c4('0x10')]=_0x482e1c[_0x99c4('0x10')];this[_0x99c4('0x11')]={};this[_0x99c4('0x12')]=_0x482e1c['agents'];this[_0x99c4('0x13')]=0x0;ami['on'](_0x99c4('0x14'),this[_0x99c4('0x15')][_0x99c4('0x16')](this));ami['on']('hangup',this[_0x99c4('0x17')]['bind'](this));ami['on'](_0x99c4('0x18'),this[_0x99c4('0x19')]['bind'](this));ami['on'](_0x99c4('0x1a'),this['syncDialEnd']['bind'](this));ami['on'](_0x99c4('0x1b'),this[_0x99c4('0x1c')][_0x99c4('0x16')](this));ami['on'](_0x99c4('0x1d'),this[_0x99c4('0x1e')][_0x99c4('0x16')](this));ami['on'](_0x99c4('0x1f'),this['syncAttendedTransfer']['bind'](this));ami['on'](_0x99c4('0x20'),this[_0x99c4('0x21')][_0x99c4('0x16')](this));this['loopCampaigns'](this['campaignsPreview']);}function emit(_0x16cf06,_0x25d76f,_0x4f3fbf){io['to'](_0x16cf06)[_0x99c4('0x22')](_0x25d76f,_0x4f3fbf);}function emitVoiceQueueChannelRemove(_0x282959){logger[_0x99c4('0x23')](_0x99c4('0x24'),JSON[_0x99c4('0x25')](_0x282959));emit(util[_0x99c4('0x26')]('voice:queue:%s',_0x282959[_0x99c4('0x27')]),_0x99c4('0x28'),_0x282959);io[_0x99c4('0x22')](_0x99c4('0x29'),_0x282959);}function notSendMessagesQueue(_0x8add87){if(_0x8add87['sendMessageOneNotActive']){if(_0x8add87[_0x99c4('0x2a')]===0x0&&_0x8add87[_0x99c4('0x2b')]===0x0){_0x8add87[_0x99c4('0x2c')]=![];_0x8add87['available']=0x0;_0x8add87[_0x99c4('0x2d')]=0x0;_0x8add87[_0x99c4('0x2e')]=utils[_0x99c4('0x2f')]['INACTIVE'];ut[_0x99c4('0x30')]('[CampaignPreview]\x20Campaign\x20Queue:\x20',_0x8add87[_0x99c4('0x27')]+_0x99c4('0x31'));}else{_0x8add87[_0x99c4('0x2e')]=utils['CAMPAIGN_STATUS'][_0x99c4('0x32')];ut[_0x99c4('0x30')](_0x99c4('0x33'),_0x8add87['name']+_0x99c4('0x34'));}}}Preview[_0x99c4('0x35')][_0x99c4('0x36')]=function(){var _0x1ff165=this;setInterval(function(){_0x1ff165[_0x99c4('0x37')]();},0x7cf);};Preview['prototype'][_0x99c4('0x37')]=function(){var _0x1658e4=this[_0x99c4('0xe')];this[_0x99c4('0x13')]+=0x1;for(var _0x4c1100 in _0x1658e4){if(_0x1658e4[_0x99c4('0x38')](_0x4c1100)&&(_0x1658e4[_0x4c1100][_0x99c4('0x39')]===_0x99c4('0x4')||_0x1658e4[_0x4c1100][_0x99c4('0x39')]===_0x99c4('0x3a'))&&_0x1658e4[_0x4c1100][_0x99c4('0x3b')]===_0x99c4('0x3c')){if(this[_0x99c4('0x13')]>0x7){this[_0x99c4('0x13')]=0x0;this[_0x99c4('0x3d')]();}}if(_0x1658e4[_0x99c4('0x38')](_0x4c1100)&&_0x1658e4[_0x4c1100][_0x99c4('0x39')]===_0x99c4('0x4')&&_0x1658e4[_0x4c1100][_0x99c4('0x3b')]===_0x99c4('0x3c')){if(_0x1658e4[_0x4c1100][_0x99c4('0x3e')]){this[_0x99c4('0x3f')](_0x1658e4[_0x4c1100]);if(_0x1658e4[_0x4c1100][_0x99c4('0x40')])this[_0x99c4('0x41')](_0x1658e4[_0x4c1100]);}else{notSendMessagesQueue(_0x1658e4[_0x4c1100]);}}}};Preview['prototype'][_0x99c4('0x42')]=function(_0xf1a25e){var _0x13f495=this;this[_0x99c4('0xd')][_0x99c4('0xa')](function(){if(!_[_0x99c4('0x43')](_0x13f495[_0x99c4('0x11')][_0xf1a25e])){loggerAction[_0x99c4('0x23')](_0x99c4('0x44'),_0xf1a25e,'Queue',_0x13f495[_0x99c4('0x11')][_0xf1a25e][_0x99c4('0x45')],_0x99c4('0x46'),JSON[_0x99c4('0x25')](_0x13f495['campaignsPreview'][_0x13f495['actions'][_0xf1a25e][_0x99c4('0x45')]]['originated']),'pTalking:\x20',JSON[_0x99c4('0x25')](_0x13f495[_0x99c4('0xe')][_0x13f495[_0x99c4('0x11')][_0xf1a25e][_0x99c4('0x45')]][_0x99c4('0x2b')]),JSON['stringify'](_0x13f495[_0x99c4('0x11')][_0xf1a25e][_0x99c4('0x47')]),JSON[_0x99c4('0x25')](_['pick'](_0x13f495[_0x99c4('0x11')][_0xf1a25e],['contactId','UserId','VoiceQueueId',_0x99c4('0x48')])));return ami[_0x99c4('0x49')]({'action':_0x99c4('0x4a'),'channel':_0x13f495[_0x99c4('0x11')][_0xf1a25e][_0x99c4('0x4b')]})[_0x99c4('0x4c')](function(_0xa8039c){if(_0xa8039c[_0x99c4('0x2e')]==='No\x20such\x20channel'){setTimeout(function(){if(_0x13f495[_0x99c4('0x11')][_0xf1a25e]){ut[_0x99c4('0x4d')](_0x13f495['campaignsPreview'][_0x13f495[_0x99c4('0x11')][_0xf1a25e]['queue']],_0x99c4('0x4e'));if(_0x13f495['actions'][_0xf1a25e][_0x99c4('0x47')]===!![]){ut[_0x99c4('0x4f')](_0x13f495['campaignsPreview'][_0x13f495[_0x99c4('0x11')][_0xf1a25e][_0x99c4('0x45')]],'[clearZombieChannel]');ut[_0x99c4('0x50')](_0x99c4('0x51')+_0xf1a25e,_0x13f495[_0x99c4('0x11')][_0xf1a25e][_0x99c4('0x45')]);}ut[_0x99c4('0x50')](_0x99c4('0x52')+_0xf1a25e,_0x13f495['actions'][_0xf1a25e][_0x99c4('0x45')]);delete _0x13f495['actions'][_0xf1a25e];}},0x2328);}});}});};Preview[_0x99c4('0x35')][_0x99c4('0x3d')]=function(){var _0x4b466a=this;loggerAction['info'](_0x99c4('0x53'),_[_0x99c4('0x54')](this[_0x99c4('0x11')]));for(var _0x1f992a in this[_0x99c4('0x11')]){if(_0x4b466a[_0x99c4('0x11')][_0x99c4('0x38')](_0x1f992a)){_0x4b466a['clearZombieChannel'](_0x1f992a);}}};Preview[_0x99c4('0x35')]['recallMe']=function(_0x566cb7){var _0x585839=this;rpcDb['getContactRecallMe'](_0x566cb7['id'],ut[_0x99c4('0x55')](this[_0x99c4('0x12')]))[_0x99c4('0x56')](function(_0x2e4feb){if(!_['isNil'](_0x2e4feb)){for(var _0xbecee2=0x0;_0xbecee2<_0x2e4feb['length'];_0xbecee2+=0x1){if(ut[_0x99c4('0x57')](_0x2e4feb[_0xbecee2][_0x99c4('0x58')])<_0x566cb7[_0x99c4('0x59')]*0x3c){if(_0x2e4feb[_0xbecee2]['Agent']&&!_0x2e4feb[_0xbecee2][_0x99c4('0x5a')][_0x99c4('0x5b')]){_0x585839['run'](_0x2e4feb[_0xbecee2]['id'])['then'](ut[_0x99c4('0x5c')](_0x99c4('0x5d')))[_0x99c4('0x4c')](ut[_0x99c4('0x5c')]('[RecallMe]'));}else{rpcDb[_0x99c4('0x5e')](_0x2e4feb[_0xbecee2]['id']);}}else{var _0x4e1202=new Action(_0x2e4feb[_0xbecee2],_0x566cb7);_0x4e1202[_0x99c4('0x5f')]=moment()[_0x99c4('0x26')](_0x99c4('0x60'));_0x566cb7[_0x99c4('0x61')]+=0x1;ut[_0x99c4('0x62')](_0x4e1202,0x17,_0x99c4('0x63'));if(_0x566cb7[_0x99c4('0x64')]){rpcDb['rescheduleContactInQueue'](ut[_0x99c4('0x65')](_0x2e4feb[_0xbecee2]));rpcDb[_0x99c4('0x66')](_0x4e1202,_0x99c4('0x67'));}else{ut[_0x99c4('0x62')](_0x4e1202,0x16,_0x99c4('0x68'));rpcDb['createCustomerHistory'](_0x4e1202,'[HistoryRecallClose]');rpcDb[_0x99c4('0x69')](_0x4e1202,'[HistoryRecallClose]');}}}}})[_0x99c4('0x4c')](ut['logger2'](_0x99c4('0x6a')));};Preview[_0x99c4('0x35')][_0x99c4('0x3f')]=function(_0x2652fe){_0x2652fe[_0x99c4('0x2c')]=!![];if(ut['IsNotLoggedIn'](_0x2652fe[_0x99c4('0x6b')])){_0x2652fe[_0x99c4('0x2e')]=utils[_0x99c4('0x2f')][_0x99c4('0x6c')];}else if(!ut[_0x99c4('0x6d')](_0x2652fe[_0x99c4('0x3e')])){_0x2652fe[_0x99c4('0x2e')]=utils['CAMPAIGN_STATUS'][_0x99c4('0x6e')];}else if(!this['isTrunkReachable'](_0x2652fe[_0x99c4('0x6f')])){if(!this['isTrunkReachable'](_0x2652fe[_0x99c4('0x70')])){_0x2652fe[_0x99c4('0x2e')]=utils['CAMPAIGN_STATUS'][_0x99c4('0x71')];}else{_0x2652fe[_0x99c4('0x2e')]=utils[_0x99c4('0x2f')][_0x99c4('0x72')];}}else{_0x2652fe[_0x99c4('0x2e')]=utils[_0x99c4('0x2f')][_0x99c4('0x72')];}};Preview[_0x99c4('0x35')][_0x99c4('0x73')]=function(_0x52d620,_0x50b94f,_0x164da0){var _0x8ffc02=this;var _0x5ccbba=this[_0x99c4('0x11')][_0x50b94f];var _0x29d33f=this['campaignsPreview'][_0x5ccbba['queue']];var _0x4e72e1;var _0xdb2757=![];var _0x1b21c9=0x2;var _0x3fa372=0x3;if(_0x29d33f){switch(_0x164da0){case'1':_0x29d33f[_0x99c4('0x74')]+=0x1;_0x5ccbba[_0x99c4('0x75')]+=0x1;_0x5ccbba[_0x99c4('0x76')]=ut[_0x99c4('0x77')](_0x5ccbba);ut[_0x99c4('0x62')](_0x5ccbba,0x0,_0x99c4('0x78'));ami['emit'](_0x99c4('0x79'),ut[_0x99c4('0x7a')](_0x5ccbba,_0x99c4('0x7b')));rpcDb[_0x99c4('0x66')](_0x5ccbba,'[callProgressDetectingCustomer][logNoSuch]');_0x8ffc02[_0x99c4('0x7c')](_0x5ccbba,'0',_0x29d33f)[_0x99c4('0x56')](function(_0x3e9105){_0xdb2757=_0x3e9105[_0x99c4('0x7d')]==0x1;_0x1b21c9=_0x29d33f[_0x99c4('0x7e')];_0x3fa372=_0x29d33f[_0x99c4('0x7f')];if(!_0xdb2757){if(ut['totalGlobal'](_0x5ccbba)>=_0x29d33f[_0x99c4('0x80')]){_0x4e72e1=ut['cloneAction'](_0x5ccbba,0xf,'Global');rpcDb[_0x99c4('0x69')](_0x4e72e1,_0x99c4('0x81'));}else{if(_0x5ccbba[_0x99c4('0x75')]>=_0x29d33f[_0x99c4('0x82')]){rpcDb[_0x99c4('0x69')](_0x5ccbba,_0x99c4('0x81'));}else{rpcDb[_0x99c4('0x83')](ut[_0x99c4('0x84')](_0x5ccbba,_0x99c4('0x75'),_0x29d33f[_0x99c4('0x7e')]),_0x5ccbba['unlockAgent'],_0x5ccbba[_0x99c4('0x85')]);}}delete this[_0x99c4('0x11')][_0x52d620['linkedid']];}else{_0x5ccbba[_0x99c4('0x75')]++;logger['info']('actioncountonusuch',_0x5ccbba[_0x99c4('0x75')]);logger[_0x99c4('0x23')]('id',_0x5ccbba['idContact']);_0x8ffc02['incrementPreviewCounters']({'id':_0x5ccbba['idContact'],'field':{'countnosuchnumberretry':_0x5ccbba[_0x99c4('0x75')]}})[_0x99c4('0x56')](function(){_0x8ffc02[_0x99c4('0x86')](_0x5ccbba,_0x1b21c9,_0x3fa372)[_0x99c4('0x56')](function(){});});}});break;case _0x99c4('0x87'):var _0x1ab087=moment()['format'](_0x99c4('0x60'));_0x5ccbba[_0x99c4('0x88')]=_0x1ab087;_0x5ccbba[_0x99c4('0x89')]=_0x1ab087;_0x5ccbba['dialAnswer']=!![];_0x29d33f[_0x99c4('0x2b')]+=0x1;logger[_0x99c4('0x23')](_0x99c4('0x8a'),_0x5ccbba[_0x99c4('0x8b')],_0x99c4('0x8c'),_0x29d33f['name'],'pTalking:\x20',_0x29d33f[_0x99c4('0x2b')]);ami[_0x99c4('0x22')](_0x99c4('0x8d'),ut[_0x99c4('0x7a')](_0x5ccbba,'connect',this[_0x99c4('0xe')][_0x5ccbba[_0x99c4('0x45')]]));if(_0x29d33f[_0x99c4('0x8e')]){ami[_0x99c4('0x22')](_0x99c4('0x8f'),ut[_0x99c4('0x90')](_0x5ccbba));}break;case'16':ami['emit'](_0x99c4('0x91'),ut[_0x99c4('0x7a')](_0x5ccbba,_0x99c4('0x92'),this[_0x99c4('0xe')][_0x5ccbba[_0x99c4('0x45')]]));emitVoiceQueueChannelRemove(ut[_0x99c4('0x7a')](_0x5ccbba,'complete'));_0x29d33f['outboundAnswerCallsDay']+=0x1;_0x29d33f[_0x99c4('0x93')]+=0x1;_0x29d33f[_0x99c4('0x94')]+=0x1;ut['decrementTalkink'](_0x29d33f,_0x99c4('0x95'));_0x5ccbba['countglobal']=ut[_0x99c4('0x77')](_0x5ccbba);ut[_0x99c4('0x62')](_0x5ccbba,0x4,_0x99c4('0x96'));rpcDb[_0x99c4('0x66')](_0x5ccbba,_0x99c4('0x97'));rpcDb[_0x99c4('0x69')](_0x5ccbba,'[callProgressDetectingCustomer][logAnswerGlobal]');rpcDb['crateCustomerReportQueue'](_0x5ccbba);_0x29d33f[_0x99c4('0x98')]+=_0x5ccbba[_0x99c4('0x99')];_0x29d33f['sumBillable']+=_0x5ccbba['talktime'];logger[_0x99c4('0x23')](_0x99c4('0x9a'),_0x5ccbba['uniqueid'],_0x99c4('0x8c'),_0x29d33f[_0x99c4('0x27')],_0x99c4('0x9b'),_0x29d33f['pTalking']);delete this[_0x99c4('0x11')][_0x52d620[_0x99c4('0x9c')]];break;case _0x99c4('0x9d'):_0x29d33f[_0x99c4('0x9e')]+=0x1;_0x5ccbba[_0x99c4('0x9f')]+=0x1;_0x5ccbba[_0x99c4('0x76')]=ut['totalGlobal'](_0x5ccbba);ut[_0x99c4('0x62')](_0x5ccbba,0x5,_0x99c4('0xa0'));_0x1b21c9=_0x29d33f[_0x99c4('0xa1')];_0x3fa372=_0x29d33f[_0x99c4('0x7f')];ami[_0x99c4('0x22')](_0x99c4('0xa2'),ut['buildObj'](_0x5ccbba,_0x99c4('0xa3')));rpcDb[_0x99c4('0x66')](_0x5ccbba,_0x99c4('0xa4'));_0x8ffc02[_0x99c4('0x7c')](_0x5ccbba,'5',_0x29d33f)[_0x99c4('0x56')](function(_0x22f70d){_0xdb2757=_0x22f70d[_0x99c4('0x7d')]==0x1;if(!_0xdb2757){if(ut[_0x99c4('0x77')](_0x5ccbba)>=_0x29d33f[_0x99c4('0x80')]){_0x4e72e1=ut['cloneAction'](_0x5ccbba,0xf,_0x99c4('0xa5'));rpcDb[_0x99c4('0x69')](_0x4e72e1,_0x99c4('0xa6'));}else{if(_0x5ccbba[_0x99c4('0x9f')]>=_0x29d33f['dialBusyMaxRetry']){rpcDb[_0x99c4('0x69')](_0x5ccbba,_0x99c4('0xa4'));}else{rpcDb[_0x99c4('0x83')](ut['scheduledAt'](_0x5ccbba,_0x99c4('0x9f'),_0x29d33f['dialBusyRetryFrequency']),_0x5ccbba[_0x99c4('0xa7')],_0x5ccbba[_0x99c4('0x85')]);}}}else{_0x5ccbba[_0x99c4('0x9f')]++;_0x8ffc02[_0x99c4('0xa8')]({'id':_0x5ccbba[_0x99c4('0xa9')],'field':{'countbusyretry':_0x5ccbba['countbusyretry']}})[_0x99c4('0x56')](function(){_0x8ffc02[_0x99c4('0x86')](_0x5ccbba,_0x1b21c9,_0x3fa372)[_0x99c4('0x56')](function(){});});}});break;case _0x99c4('0xaa'):_0x29d33f[_0x99c4('0xab')]+=0x1;_0x5ccbba[_0x99c4('0xac')]+=0x1;_0x5ccbba['countglobal']=ut[_0x99c4('0x77')](_0x5ccbba);ut[_0x99c4('0x62')](_0x5ccbba,0x3,_0x99c4('0xad'));_0x1b21c9=_0x29d33f[_0x99c4('0xae')];_0x3fa372=_0x29d33f['callAdditionalPhoneAfterMin'];var _0x5c2423=ut[_0x99c4('0xaf')](_0x5ccbba,_0x29d33f);ami[_0x99c4('0x22')]('custom:agentnoanswer',_0x5c2423);rpcDb[_0x99c4('0x66')](_0x5ccbba,'[callProgressDetectingCustomer][logNoAnswer]');_0x8ffc02['verifyAdditionalPhones'](_0x5ccbba,'3',_0x29d33f)[_0x99c4('0x56')](function(_0x480ea8){_0xdb2757=_0x480ea8['additional']==0x1;if(!_0xdb2757){if(ut['totalGlobal'](_0x5ccbba)>=_0x29d33f[_0x99c4('0x80')]){_0x4e72e1=ut[_0x99c4('0xb0')](_0x5ccbba,0xf,_0x99c4('0xa5'));rpcDb['createCustomerFinal'](_0x4e72e1,_0x99c4('0xb1'));}else{if(_0x5ccbba['countnoanswerretry']>=_0x29d33f['dialNoAnswerMaxRetry']){rpcDb[_0x99c4('0x69')](_0x5ccbba,_0x99c4('0xb2'));}else{rpcDb[_0x99c4('0x83')](ut[_0x99c4('0x84')](_0x5ccbba,_0x99c4('0xac'),_0x29d33f[_0x99c4('0xae')]),_0x5ccbba['unlockAgent'],_0x5ccbba[_0x99c4('0x85')]);}}}else{_0x5ccbba[_0x99c4('0xac')]++;_0x8ffc02[_0x99c4('0xa8')]({'id':_0x5ccbba[_0x99c4('0xa9')],'field':{'countnoanswerretry':_0x5ccbba['countnoanswerretry']}})[_0x99c4('0x56')](function(){_0x8ffc02['swapAdditionalPhones'](_0x5ccbba,_0x1b21c9,_0x3fa372)['then'](function(){});});}});break;case _0x99c4('0xb3'):_0x29d33f[_0x99c4('0xb4')]+=0x1;_0x5ccbba[_0x99c4('0xb5')]+=0x1;_0x5ccbba[_0x99c4('0x76')]=ut[_0x99c4('0x77')](_0x5ccbba);ut[_0x99c4('0x62')](_0x5ccbba,0x8,_0x99c4('0xb6'));_0x1b21c9=_0x29d33f[_0x99c4('0xb7')];_0x3fa372=_0x29d33f['callAdditionalPhoneAfterMin'];ami[_0x99c4('0x22')](_0x99c4('0xb8'),ut['buildObj'](_0x5ccbba,'congestion'));rpcDb[_0x99c4('0x66')](_0x5ccbba,_0x99c4('0xb9'));_0x8ffc02['verifyAdditionalPhones'](_0x5ccbba,'8',_0x29d33f)[_0x99c4('0x56')](function(_0x473118){_0xdb2757=_0x473118[_0x99c4('0x7d')]==0x1;if(!_0xdb2757){if(ut['totalGlobal'](_0x5ccbba)>=_0x29d33f[_0x99c4('0x80')]){_0x4e72e1=ut[_0x99c4('0xb0')](_0x5ccbba,0xf,_0x99c4('0xa5'));rpcDb[_0x99c4('0x69')](_0x4e72e1,_0x99c4('0xba'));}else{if(_0x5ccbba[_0x99c4('0xb5')]>=_0x29d33f['dialCongestionMaxRetry']){rpcDb['createCustomerFinal'](_0x5ccbba,_0x99c4('0xb9'));}else{rpcDb[_0x99c4('0x83')](ut[_0x99c4('0x84')](_0x5ccbba,'countcongestionretry',_0x29d33f[_0x99c4('0xa1')]),_0x5ccbba[_0x99c4('0xa7')],_0x5ccbba['activeContact']);}}}else{_0x5ccbba[_0x99c4('0xb5')]++;_0x8ffc02[_0x99c4('0xa8')]({'id':_0x5ccbba['idContact'],'field':{'countcongestionretry':_0x5ccbba[_0x99c4('0xb5')]}})[_0x99c4('0x56')](function(){_0x8ffc02[_0x99c4('0x86')](_0x5ccbba,_0x1b21c9,_0x3fa372)[_0x99c4('0x56')](function(){});});}});break;case _0x99c4('0xbb'):_0x29d33f[_0x99c4('0xbc')]+=0x1;_0x5ccbba[_0x99c4('0xbd')]+=0x1;_0x5ccbba[_0x99c4('0x76')]=ut[_0x99c4('0x77')](_0x5ccbba);ut[_0x99c4('0x62')](_0x5ccbba,0x14,'AgentReject');_0x1b21c9=_0x29d33f['dialAgentRejectRetryFrequency'];_0x3fa372=_0x29d33f[_0x99c4('0x7f')];ami[_0x99c4('0x22')](_0x99c4('0xbe'),ut[_0x99c4('0x7a')](_0x5ccbba,_0x99c4('0xbf')));rpcDb[_0x99c4('0x66')](_0x5ccbba,_0x99c4('0xc0'));_0x8ffc02[_0x99c4('0x7c')](_0x5ccbba,'20',_0x29d33f)[_0x99c4('0x56')](function(_0x38240d){_0xdb2757=_0x38240d['additional']==0x1;if(!_0xdb2757){if(ut[_0x99c4('0x77')](_0x5ccbba)>=_0x29d33f[_0x99c4('0x80')]){_0x4e72e1=ut[_0x99c4('0xb0')](_0x5ccbba,0x14,_0x99c4('0xc1'));rpcDb['createCustomerFinal'](_0x4e72e1,_0x99c4('0xc2'));}else{if(_0x5ccbba['countagentrejectretry']>=_0x29d33f[_0x99c4('0xc3')]){rpcDb[_0x99c4('0x69')](_0x5ccbba,_0x99c4('0xc2'));}else{rpcDb[_0x99c4('0x83')](ut[_0x99c4('0x84')](_0x5ccbba,_0x99c4('0xbd'),_0x29d33f['dialAgentRejectRetryFrequency']),_0x5ccbba[_0x99c4('0xa7')],_0x5ccbba[_0x99c4('0x85')]);}}}else{_0x5ccbba[_0x99c4('0xac')]++;_0x8ffc02['incrementPreviewCounters']({'id':_0x5ccbba[_0x99c4('0xa9')],'field':{'countnoanswerretry':_0x5ccbba[_0x99c4('0xac')]}})[_0x99c4('0x56')](function(){_0x8ffc02['swapAdditionalPhones'](_0x5ccbba,_0x1b21c9,_0x3fa372)['then'](function(){});});}});break;case'ABANDONED':_0x29d33f[_0x99c4('0xc4')]+=0x1;_0x5ccbba['countabandonedretry']+=0x1;_0x5ccbba[_0x99c4('0x76')]=ut['totalGlobal'](_0x5ccbba);ut[_0x99c4('0x62')](_0x5ccbba,0xb,_0x99c4('0xc5'));rpcDb[_0x99c4('0x66')](_0x5ccbba,_0x99c4('0xc6'));_0x8ffc02[_0x99c4('0x7c')](_0x5ccbba,'11',_0x29d33f)[_0x99c4('0x56')](function(_0x22270b){_0xdb2757=_0x22270b[_0x99c4('0x7d')]==0x1;if(!_0xdb2757){if(ut[_0x99c4('0x77')](_0x5ccbba)>=_0x29d33f[_0x99c4('0x80')]){_0x4e72e1=ut[_0x99c4('0xb0')](_0x5ccbba,0xf,_0x99c4('0xa5'));rpcDb[_0x99c4('0x69')](_0x4e72e1,_0x99c4('0xc6'));}else{if(_0x5ccbba[_0x99c4('0xc7')]>=_0x29d33f[_0x99c4('0xc8')]){rpcDb['createCustomerFinal'](_0x5ccbba,_0x99c4('0xc6'));}else{rpcDb[_0x99c4('0x83')](ut[_0x99c4('0x84')](_0x5ccbba,_0x99c4('0xc9'),_0x29d33f['dialAbandonedRetryFrequency']),_0x5ccbba[_0x99c4('0xa7')],_0x5ccbba[_0x99c4('0x85')]);}}}else{_0x5ccbba['countnoanswerretry']++;_0x8ffc02[_0x99c4('0xa8')]({'id':_0x5ccbba['idContact'],'field':{'countnoanswerretry':_0x5ccbba[_0x99c4('0xac')]}})[_0x99c4('0x56')](function(){_0x8ffc02[_0x99c4('0x86')](_0x5ccbba,_0x1b21c9,_0x3fa372)[_0x99c4('0x56')](function(){});});}});break;case'18':_0x29d33f['outboundUnknownCallsDay']+=0x1;_0x5ccbba[_0x99c4('0xca')]+=0x1;_0x5ccbba[_0x99c4('0x76')]=ut[_0x99c4('0x77')](_0x5ccbba);ut[_0x99c4('0x62')](_0x5ccbba,0x12,_0x52d620[_0x99c4('0xcb')]||_0x52d620[_0x99c4('0xcc')]);ami[_0x99c4('0x22')]('custom:amd',ut[_0x99c4('0x7a')](_0x5ccbba,_0x99c4('0xcd')));rpcDb[_0x99c4('0x66')](_0x5ccbba,_0x99c4('0xce'));_0x8ffc02[_0x99c4('0x7c')](_0x5ccbba,'18',_0x29d33f)[_0x99c4('0x56')](function(_0x3877b2){_0xdb2757=_0x3877b2['additional']==0x1;if(!_0xdb2757){if(ut[_0x99c4('0x77')](_0x5ccbba)>=_0x29d33f['dialGlobalMaxRetry']){_0x4e72e1=ut[_0x99c4('0xb0')](_0x5ccbba,0x12,'Global');rpcDb[_0x99c4('0x69')](_0x4e72e1,'[callProgressDetectingCustomer][hangupInAMD]');}else{rpcDb['createCustomerFinal'](_0x5ccbba,_0x99c4('0xce'));}}else{_0x5ccbba['countnoanswerretry']++;_0x8ffc02[_0x99c4('0xa8')]({'id':_0x5ccbba['idContact'],'field':{'countnoanswerretry':_0x5ccbba[_0x99c4('0xac')]}})[_0x99c4('0x56')](function(){_0x8ffc02[_0x99c4('0x86')](_0x5ccbba,_0x1b21c9,_0x3fa372)['then'](function(){});});}});delete this[_0x99c4('0x11')][_0x52d620[_0x99c4('0x9c')]];break;case'19':_0x29d33f[_0x99c4('0xcf')]+=0x1;_0x5ccbba[_0x99c4('0x76')]=ut[_0x99c4('0x77')](_0x5ccbba);ut[_0x99c4('0x62')](_0x5ccbba,0x13,_0x52d620[_0x99c4('0xcb')]||_0x52d620[_0x99c4('0xcc')]);ami[_0x99c4('0x22')](_0x99c4('0xd0'),ut[_0x99c4('0x7a')](_0x5ccbba,'amd'));rpcDb[_0x99c4('0x66')](_0x5ccbba,_0x99c4('0xd1'));_0x8ffc02[_0x99c4('0x7c')](_0x5ccbba,'18',_0x29d33f)[_0x99c4('0x56')](function(_0x1bd01f){_0xdb2757=_0x1bd01f[_0x99c4('0x7d')]==0x1;if(!_0xdb2757){if(ut['totalGlobal'](_0x5ccbba)>=_0x29d33f[_0x99c4('0x80')]){_0x4e72e1=ut[_0x99c4('0xb0')](_0x5ccbba,0xf,_0x99c4('0xa5'));rpcDb[_0x99c4('0x69')](_0x4e72e1,_0x99c4('0xd1'));}else{rpcDb[_0x99c4('0x69')](_0x5ccbba,_0x99c4('0xd1'));}}else{_0x5ccbba[_0x99c4('0xac')]++;_0x8ffc02['incrementPreviewCounters']({'id':_0x5ccbba[_0x99c4('0xa9')],'field':{'countnoanswerretry':_0x5ccbba[_0x99c4('0xac')]}})[_0x99c4('0x56')](function(){_0x8ffc02[_0x99c4('0x86')](_0x5ccbba,_0x1b21c9,_0x3fa372)[_0x99c4('0x56')](function(){});});}});delete this[_0x99c4('0x11')][_0x52d620[_0x99c4('0x9c')]];break;default:if(_0x5ccbba[_0x99c4('0x47')]){ut[_0x99c4('0x4f')](_0x29d33f,_0x99c4('0xd2'));ut['loggerError'](_0x99c4('0xd3')+_0x29d33f[_0x99c4('0x27')],_0x52d620);}_0x29d33f['outboundUnknownCallsDay']+=0x1;_0x5ccbba[_0x99c4('0x76')]=ut[_0x99c4('0x77')](_0x5ccbba);ut[_0x99c4('0x62')](_0x5ccbba,0xc,_0x52d620[_0x99c4('0xcb')]||_0x52d620['dialstatus']);_0x1b21c9=_0x29d33f[_0x99c4('0xd4')];_0x3fa372=_0x29d33f['callAdditionalPhoneAfterMin'];rpcDb[_0x99c4('0x66')](_0x5ccbba,_0x99c4('0xd5'));_0x8ffc02[_0x99c4('0x7c')](_0x5ccbba,'20',_0x29d33f)['then'](function(_0x581fc4){_0xdb2757=_0x581fc4['additional']==0x1;if(!_0xdb2757){if(ut[_0x99c4('0x77')](_0x5ccbba)>=_0x29d33f[_0x99c4('0x80')]){_0x4e72e1=ut[_0x99c4('0xb0')](_0x5ccbba,0xf,_0x99c4('0xa5'));rpcDb[_0x99c4('0x69')](_0x4e72e1,'[callProgressDetectingCustomer][logUnknownGlobal]');}else{rpcDb['createCustomerFinal'](_0x5ccbba,_0x99c4('0xd6'));}delete this['actions'][_0x52d620[_0x99c4('0x9c')]];}else{_0x8ffc02['swapAdditionalPhones'](_0x5ccbba,_0x1b21c9,_0x3fa372)['then'](function(){});}});}if(!(_0x5ccbba[_0x99c4('0x47')]&&_0x164da0==='16')){ut[_0x99c4('0x4d')](_0x29d33f,_0x99c4('0xd7'));logger['info'](_0x99c4('0xd8'),_0x5ccbba[_0x99c4('0x8b')],_0x99c4('0x8c'),_0x29d33f[_0x99c4('0x27')],_0x99c4('0x46'),_0x29d33f['originated']);}if(_0x164da0!=='ANSWER'){delete this[_0x99c4('0x11')][_0x52d620[_0x99c4('0x9c')]];delete this[_0x99c4('0x11')][_0x52d620['destlinkedid']];}_0x29d33f[_0x99c4('0xd9')]=!![];}};Preview[_0x99c4('0x35')][_0x99c4('0xda')]=function(_0x304ceb,_0x1bd526,_0x43562f){if(_['isUndefined'](_0x1bd526)&&_0x99c4('0xdb')!==typeof _0x1bd526){return;}if(_[_0x99c4('0xdc')](_0x43562f)&&_0x99c4('0xdb')!==typeof _0x43562f){return;}switch(_0x43562f[_0x99c4('0xdd')]){case'0':ut[_0x99c4('0xde')](_0x304ceb,0x0,_0x99c4('0x78'));rpcDb[_0x99c4('0xdf')](_0x304ceb,_0x99c4('0xe0'));break;case'3':ut[_0x99c4('0xde')](_0x304ceb,0x3,_0x99c4('0xad'));rpcDb[_0x99c4('0xdf')](_0x304ceb,_0x99c4('0xe1'));break;case'5':ut[_0x99c4('0xde')](_0x304ceb,0x5,'Busy');rpcDb[_0x99c4('0xdf')](_0x304ceb,_0x99c4('0xe2'));break;case'8':ut[_0x99c4('0xde')](_0x304ceb,0x8,_0x99c4('0xb6'));rpcDb[_0x99c4('0xdf')](_0x304ceb,_0x99c4('0xe3'));break;case'22':ut[_0x99c4('0xde')](_0x304ceb,0x16,_0x99c4('0xe4'));rpcDb[_0x99c4('0xdf')](_0x304ceb,_0x99c4('0xe5'));break;default:ut[_0x99c4('0xde')](_0x304ceb,0xc,_0x43562f[_0x99c4('0xdd')]);rpcDb[_0x99c4('0xdf')](_0x304ceb,_0x99c4('0xe3'));}ut[_0x99c4('0x4d')](_0x1bd526,_0x99c4('0xe6'));logger[_0x99c4('0x23')](_0x99c4('0xe7'),_0x304ceb[_0x99c4('0x8b')],_0x99c4('0x8c'),_0x1bd526[_0x99c4('0x27')],_0x99c4('0x46'),_0x1bd526['originated']);delete this[_0x99c4('0x11')][_0x304ceb[_0x99c4('0x8b')]];};Preview['prototype'][_0x99c4('0x7c')]=function(_0x52f991,_0x2c6664,_0x21f0fe){return cmHopperAdditionalPhone[_0x99c4('0x7c')](_0x52f991,_0x2c6664,_0x21f0fe)[_0x99c4('0x4c')](logger[_0x99c4('0x23')](_0x99c4('0xe8')));};Preview[_0x99c4('0x35')][_0x99c4('0x86')]=function(_0x1344b4,_0x464918,_0x312af0){return cmHopperAdditionalPhone[_0x99c4('0x86')](_0x1344b4,_0x464918,_0x312af0)[_0x99c4('0x4c')](logger['info']('[swapAdditionalPhone]\x20'));};Preview[_0x99c4('0x35')][_0x99c4('0xa8')]=function(_0xa8b313){return Promise[_0x99c4('0xe9')]()[_0x99c4('0x56')](cmHopperAdditionalPhone[_0x99c4('0xa8')](_0xa8b313))[_0x99c4('0x4c')](logger[_0x99c4('0x23')](_0x99c4('0xea')));};Preview['prototype'][_0x99c4('0xeb')]=function(_0x586087,_0x4956fe,_0x4b1109,_0x10f0fd,_0x2b4bbe){var _0x52f500=this;return new Promise(function(_0x3e7247,_0x58ddff){if(_[_0x99c4('0x43')](_0x4956fe)||_[_0x99c4('0x43')](_0x4956fe['Contact'])||_[_0x99c4('0x43')](_0x4956fe[_0x99c4('0xec')])||_['isNil'](_0x4956fe[_0x99c4('0xed')])){_0x58ddff(ut['message'](_0x99c4('0xee'),_0x10f0fd,_0x2b4bbe));return;}var _0x5b363a=uuid['v4']();var _0x37b5c4=_0x52f500[_0x99c4('0xe')][_0x4956fe[_0x99c4('0xef')][_0x99c4('0x27')]];var _0x254e9d=_0x4b1109?_0x52f500[_0x99c4('0x12')][_0x4b1109]['id']:undefined;_0x52f500[_0x99c4('0x11')][_0x5b363a]=new Action(_0x4956fe,_0x37b5c4,_0x5b363a,_0x4b1109,_0x254e9d);var _0x8c7947=_0x52f500[_0x99c4('0x11')][_0x5b363a];_0x8c7947[_0x99c4('0xa7')]=_0x10f0fd;_0x8c7947[_0x99c4('0x85')]=_0x2b4bbe;_0x8c7947['lookAgent']=_0x4b1109;if(_[_0x99c4('0xf0')](_0x586087)){_0x52f500[_0x99c4('0xf1')](_0x8c7947,_0x37b5c4,_0x4956fe,_0x4b1109)[_0x99c4('0x56')](function(_0x5b7bd5){logger['info'](_0x99c4('0xf2'),'Queue:\x20'+_0x8c7947[_0x99c4('0x45')]+_0x99c4('0xf3')+_0x8c7947[_0x99c4('0xa9')],JSON['stringify'](_0x5b7bd5));ami[_0x99c4('0x22')](_0x99c4('0xf4'),ut['buildObj'](_0x8c7947,_0x99c4('0xf5'),_0x52f500[_0x99c4('0xe')][_0x8c7947[_0x99c4('0x45')]]));_0x3e7247(ut[_0x99c4('0x2e')](_0x99c4('0xf6')));})['catch'](function(_0x414e6a){ut[_0x99c4('0x30')]('[Preview][execCall][failure]',_0x414e6a);_0x58ddff(ut[_0x99c4('0x2e')](_0x99c4('0xf7'),_0x10f0fd,_0x2b4bbe));});}else{_0x37b5c4['outboundBlacklistCallsDay']+=0x1;ut['logBlacklist'](_0x8c7947);rpcDb[_0x99c4('0xf8')](_0x8c7947,_0x99c4('0xf9'));delete _0x52f500['actions'][_0x5b363a];_0x58ddff(ut['message']('Contact\x20in\x20black\x20List',_0x10f0fd,_0x2b4bbe));}});};Preview[_0x99c4('0x35')][_0x99c4('0xfa')]=function(_0x2d3644){return!_['isNil'](_0x2d3644)&&!_[_0x99c4('0x43')](_0x2d3644[_0x99c4('0x27')])&&!_['isNil'](_0x2d3644['active'])&&_0x2d3644[_0x99c4('0xfb')]&&!_[_0x99c4('0x43')](this[_0x99c4('0x10')][util[_0x99c4('0x26')](_0x99c4('0xfc'),_0x2d3644[_0x99c4('0x27')])])&&!_[_0x99c4('0x43')](this[_0x99c4('0x10')][util[_0x99c4('0x26')](_0x99c4('0xfc'),_0x2d3644[_0x99c4('0x27')])][_0x99c4('0x4a')])&&(this[_0x99c4('0x10')][util['format'](_0x99c4('0xfc'),_0x2d3644['name'])][_0x99c4('0x4a')]==='reachable'||this[_0x99c4('0x10')][util[_0x99c4('0x26')](_0x99c4('0xfc'),_0x2d3644[_0x99c4('0x27')])][_0x99c4('0x4a')]===_0x99c4('0xfd'));};Preview['prototype'][_0x99c4('0xfe')]=function(_0x3dc2b4,_0x9a8a52){return this[_0x99c4('0xff')](_0x3dc2b4,_0x9a8a52)[_0x99c4('0x56')](function(_0x1f9ec0){return _[_0x99c4('0x100')](_0x1f9ec0,['message']);})['catch'](function(_0x47cbbe){if(_0x47cbbe['unlock']){rpcDb['unlockContact'](_0x3dc2b4);}if(_0x47cbbe['active']){rpcDb['disableContact'](_0x3dc2b4);}throw _[_0x99c4('0x100')](_0x47cbbe,[_0x99c4('0x2e')]);});};Preview[_0x99c4('0x35')][_0x99c4('0xff')]=function(_0x50d3c0,_0x7430f8){var _0x3f3d82=this;var _0x139d02,_0x1d1412;return rpcDb[_0x99c4('0x101')](_0x50d3c0)['then'](function(_0x54bba0){if(!_[_0x99c4('0x43')](_0x54bba0[0x0])){_0x1d1412=_0x54bba0[0x0]['recallme']?![]:!![];_0x139d02=_0x54bba0[0x0]['recallme']?!![]:![];_0x139d02=_0x7430f8?!![]:_0x139d02;}var _0x579e6d=_0x3f3d82[_0x99c4('0x102')](_0x54bba0);if(_0x579e6d['isValid']){rpcDb[_0x99c4('0x103')](_[_0x99c4('0x100')](_0x54bba0[0x0],[_0x99c4('0xed'),'phone']))[_0x99c4('0x56')](function(_0x1fe180){_0x3f3d82[_0x99c4('0xeb')](_0x1fe180,_0x54bba0[0x0],_0x7430f8,_0x1d1412,_0x139d02)[_0x99c4('0x56')](function(_0x399daa){return _0x399daa;})[_0x99c4('0x4c')](function(_0x359165){throw _0x359165;});})[_0x99c4('0x4c')](function(_0x179ad6){ut[_0x99c4('0x30')](_0x99c4('0x104'),_0x179ad6);throw ut['message'](_0x99c4('0x105'),_0x1d1412,_0x139d02);});}else{throw ut[_0x99c4('0x2e')](_0x579e6d[_0x99c4('0x2e')],_0x1d1412,_0x139d02);}})[_0x99c4('0x4c')](function(_0x319c86){ut[_0x99c4('0x30')]('[Preview][getContactPreview]',_0x319c86);throw ut[_0x99c4('0x2e')](_0x99c4('0x105'),![],!![]);});};Preview[_0x99c4('0x35')][_0x99c4('0x102')]=function(_0x31323c){if(_['isNil'](_0x31323c)||_[_0x99c4('0xf0')](_0x31323c)||!_[_0x99c4('0x43')](_0x31323c[0x0]['Agent'])&&_[_0x99c4('0x43')](_0x31323c[0x0][_0x99c4('0x5a')][_0x99c4('0x27')])){ut['logger'](_0x99c4('0x106'),_0x31323c);return{'isValid':![],'message':'Empty\x20Contact'};}var _0x2bdbe5=this[_0x99c4('0xe')][_0x31323c[0x0][_0x99c4('0xef')][_0x99c4('0x27')]];_0x2bdbe5[_0x99c4('0x2e')]=utils[_0x99c4('0x2f')][_0x99c4('0x72')];if(_[_0x99c4('0x43')](_0x2bdbe5)){ut['logger'](_0x99c4('0x107'),_0x2bdbe5);return{'isValid':![],'message':'Empty\x20Campaign'};}if(!this['isTrunkReachable'](_0x2bdbe5['Trunk'])){ut[_0x99c4('0x30')](_0x99c4('0x108'),_0x99c4('0x109')+_0x2bdbe5[_0x99c4('0x27')]+_0x99c4('0x10a'));if(!this['isTrunkReachable'](_0x2bdbe5[_0x99c4('0x70')])){ut[_0x99c4('0x30')](_0x99c4('0x108'),_0x2bdbe5[_0x99c4('0x27')]+_0x99c4('0x10b'));return{'isValid':![],'message':_0x99c4('0x10c')};}}if(!ut[_0x99c4('0x6d')](_0x2bdbe5[_0x99c4('0x3e')])){ut[_0x99c4('0x30')]('[Preview][validateContact][Campaign\x20Active]',_0x2bdbe5[_0x99c4('0x27')]+_0x99c4('0x10d'));return{'isValid':![],'message':'campaign\x20Name:\x20'+_0x2bdbe5['name']+'\x20Not\x20Active'};}return{'isValid':!![],'message':'Is\x20Valid'};};Preview[_0x99c4('0x35')][_0x99c4('0xf1')]=function(_0x309640,_0xd62142,_0x2fc39e,_0x5787d2){var _0x4ffb54=this;return new Promise(function(_0x4879c5,_0x92e305){var _0x4f0291=_0x309640[_0x99c4('0x8b')];var _0x3e4407=_0x4ffb54[_0x99c4('0xfa')](_0xd62142[_0x99c4('0x6f')])?util[_0x99c4('0x26')](_0x99c4('0x10e'),_0xd62142[_0x99c4('0x6f')][_0x99c4('0x27')],_[_0x99c4('0x43')](_0xd62142[_0x99c4('0x10f')])?'':_0xd62142[_0x99c4('0x10f')][_0x99c4('0x110')]()||'',_0xd62142['dialCutDigit']>0x0?_0x2fc39e[_0x99c4('0xec')][_0x99c4('0x111')](_0xd62142['dialCutDigit']):_0x2fc39e[_0x99c4('0xec')]):util[_0x99c4('0x26')](_0x99c4('0x10e'),_[_0x99c4('0x43')](_0xd62142['TrunkBackup'])?_0xd62142[_0x99c4('0x6f')][_0x99c4('0x27')]:_0xd62142[_0x99c4('0x70')]['name'],_['isNil'](_0xd62142[_0x99c4('0x10f')])?'':_0xd62142[_0x99c4('0x10f')][_0x99c4('0x110')]()||'',_0xd62142['dialCutDigit']>0x0?_0x2fc39e[_0x99c4('0xec')]['substring'](_0xd62142[_0x99c4('0x112')]):_0x2fc39e['phone']);var _0x1a25a8=_0x4ffb54['isTrunkReachable'](_0xd62142[_0x99c4('0x6f')])?ut[_0x99c4('0x113')](_0xd62142[_0x99c4('0x6f')][_0x99c4('0x114')],_0xd62142['dialOriginateCallerIdName'],_0xd62142['dialRandomLastDigitCallerIdNumber']>0x0?ut[_0x99c4('0x115')](_0xd62142[_0x99c4('0x116')],_0xd62142[_0x99c4('0x117')]):_0xd62142[_0x99c4('0x116')]):ut[_0x99c4('0x113')](_[_0x99c4('0x43')](_0xd62142[_0x99c4('0x70')])?_0xd62142[_0x99c4('0x6f')][_0x99c4('0x114')]:_0xd62142[_0x99c4('0x70')][_0x99c4('0x114')],_0xd62142['dialOriginateCallerIdName'],_0xd62142['dialRandomLastDigitCallerIdNumber']>0x0?ut[_0x99c4('0x115')](_0xd62142['dialOriginateCallerIdNumber'],_0xd62142[_0x99c4('0x117')]):_0xd62142[_0x99c4('0x116')]);if(_0x1a25a8){_0x309640[_0x99c4('0x118')]=ut[_0x99c4('0x119')](_0x1a25a8);_0x309640[_0x99c4('0x11a')]=ut[_0x99c4('0x11b')](_0x1a25a8);}var _0xa90a91=ut[_0x99c4('0x11c')](_0xd62142,_0x2fc39e,_0x3e4407,_0x1a25a8,_0x4f0291,_0x309640);var _0x497192=utils[_0x99c4('0x11d')](_0x2fc39e[_0x99c4('0x11e')]);Object[_0x99c4('0x11f')](_0xa90a91,_0x497192);_[_0x99c4('0x120')](_0x309640,ut[_0x99c4('0x121')](_0xa90a91));_0x309640['starttime']=moment()[_0x99c4('0x26')]('YYYY-MM-DD\x20HH:mm:ss');_0xd62142[_0x99c4('0x122')]=_0xa90a91;var _0x4a212e=ut[_0x99c4('0x123')](_0x309640,_0xd62142,_0xa90a91,_0x309640[_0x99c4('0x85')],_0x5787d2);return ami[_0x99c4('0x49')](_0x4a212e)['then'](function(_0x3b793d){_0xd62142[_0x99c4('0x2a')]+=0x1;logger[_0x99c4('0x23')](_0x99c4('0x124'),_0x4f0291,_0x99c4('0x8c'),_0xd62142['name'],_0x99c4('0x46'),_0xd62142['originated']);_0x4879c5(_0x3b793d);})[_0x99c4('0x4c')](function(_0x548a05){ut[_0x99c4('0xde')](_0x309640,0xe,'OriginateError');rpcDb[_0x99c4('0xdf')](_0x309640,'[originateFailure][logOriginateFailure]');_0x92e305(_0x548a05);});});};Preview['prototype'][_0x99c4('0x1c')]=function(_0x1df6f5){if(this[_0x99c4('0x11')][_0x1df6f5['linkedid']]){this[_0x99c4('0x11')][_0x1df6f5[_0x99c4('0x9c')]][_0x99c4('0x4b')]=_0x1df6f5[_0x99c4('0x4b')];}};Preview[_0x99c4('0x35')][_0x99c4('0x15')]=function(_0x383875){var _0x1cb947=this;var _0x234d3b=this[_0x99c4('0x11')][_0x383875[_0x99c4('0x125')]];if(_0x234d3b){if(_0x234d3b[_0x99c4('0x126')]&&this[_0x99c4('0x12')][_0x234d3b[_0x99c4('0x126')]]){ut[_0x99c4('0x127')](_0x234d3b,this[_0x99c4('0x12')][_0x234d3b[_0x99c4('0x126')]]['name'],this[_0x99c4('0x12')][_0x234d3b['lookAgent']]['id']);}var _0x4a91a4=_['clone'](_0x234d3b);_0x4a91a4['responsetime']=moment()[_0x99c4('0x26')](_0x99c4('0x60'));var _0xdaca6c=_0x1cb947[_0x99c4('0xe')][_0x234d3b[_0x99c4('0x45')]];if(ut[_0x99c4('0x128')](_0x383875[_0x99c4('0x129')])){if(_0x234d3b[_0x99c4('0xa7')]){rpcDb[_0x99c4('0x12a')](_0x234d3b[_0x99c4('0xa9')]);}if(_0x234d3b[_0x99c4('0x85')]){rpcDb[_0x99c4('0x5e')](_0x234d3b['idContact']);}ami['emit'](_0x99c4('0x12b'),ut[_0x99c4('0x7a')](_0x234d3b,_0x99c4('0x12c'),this[_0x99c4('0xe')][_0x234d3b[_0x99c4('0x45')]]));this[_0x99c4('0xda')](_0x4a91a4,_0xdaca6c,_0x383875);}else{_0x234d3b['starttime']=moment()[_0x99c4('0x26')](_0x99c4('0x60'));ut[_0x99c4('0xde')](_0x4a91a4,0x4,_0x99c4('0x96'));rpcDb[_0x99c4('0xdf')](_0x4a91a4,'[callProgressDetectingAgent][logAnswer]');}}};Preview[_0x99c4('0x35')][_0x99c4('0x17')]=function(_0x1fdab7){var _0x39ba89=this[_0x99c4('0x11')][_0x1fdab7[_0x99c4('0x9c')]];var _0x233949;if(_0x39ba89){_0x233949=this[_0x99c4('0xe')][_0x39ba89[_0x99c4('0x45')]];logger['info']('[syncHangup][talking]',_0x1fdab7[_0x99c4('0x9c')],'\x20Queue',_0x233949[_0x99c4('0x27')],_0x99c4('0x9b'),_0x233949['pTalking']);}if(this['actions'][_0x1fdab7[_0x99c4('0x9c')]]&&_0x1fdab7[_0x99c4('0x9c')]!==_0x1fdab7[_0x99c4('0x8b')]){if(_0x1fdab7[_0x99c4('0x12d')]==='16'&&this[_0x99c4('0x11')][_0x1fdab7[_0x99c4('0x9c')]][_0x99c4('0x47')]){this[_0x99c4('0x73')](_0x1fdab7,_0x1fdab7[_0x99c4('0x9c')],_0x1fdab7[_0x99c4('0x12d')]);}else if(this['actions'][_0x1fdab7[_0x99c4('0x9c')]][_0x99c4('0x47')]){logger[_0x99c4('0x23')]('[syncHangup][talking][cause]',_0x1fdab7[_0x99c4('0x9c')],_0x1fdab7[_0x99c4('0x12d')],_0x99c4('0x8c'),_0x233949[_0x99c4('0x27')],_0x99c4('0x9b'),_0x233949['pTalking']);this[_0x99c4('0x73')](_0x1fdab7,_0x1fdab7[_0x99c4('0x9c')],_0x1fdab7[_0x99c4('0x12d')]);}}else if(_0x39ba89&&_[_0x99c4('0x43')](_0x39ba89[_0x99c4('0x12e')])&&_0x233949['dialQueueProject']&&_0x1fdab7[_0x99c4('0x9c')]===_0x1fdab7['uniqueid']&&_[_0x99c4('0x43')](_0x1fdab7[_0x99c4('0xdd')])&&_0x1fdab7[_0x99c4('0x12d')]==='16'&&_0x1fdab7[_0x99c4('0x12f')]==='6'&&_['isUndefined'](_0x39ba89['transfer'])){if(_0x39ba89[_0x99c4('0xa7')]){rpcDb[_0x99c4('0x12a')](_0x39ba89[_0x99c4('0xa9')]);}if(_0x39ba89[_0x99c4('0x85')]){rpcDb[_0x99c4('0x5e')](_0x39ba89[_0x99c4('0xa9')]);}_0x1fdab7[_0x99c4('0xdd')]='22';this['callProgressDetectingAgent'](_0x39ba89,_0x233949,_0x1fdab7);}else if(_0x39ba89&&_0x39ba89[_0x99c4('0x130')]){if(_0x1fdab7[_0x99c4('0x12d')]==='16'&&this[_0x99c4('0x11')][_0x1fdab7[_0x99c4('0x9c')]][_0x99c4('0x47')]){logger[_0x99c4('0x23')](_0x99c4('0x131'),_0x1fdab7[_0x99c4('0x9c')],_0x1fdab7['cause'],_0x99c4('0x8c'),_0x233949[_0x99c4('0x27')],_0x99c4('0x9b'),_0x233949[_0x99c4('0x2b')]);this[_0x99c4('0x73')](_0x1fdab7,_0x1fdab7[_0x99c4('0x9c')],_0x1fdab7['cause']);}else if(this[_0x99c4('0x11')][_0x1fdab7['linkedid']]['dialAnswer']){logger[_0x99c4('0x23')]('[syncHangup][talking][cause]',_0x1fdab7['linkedid'],_0x1fdab7[_0x99c4('0x12d')],_0x99c4('0x8c'),_0x233949['name'],_0x99c4('0x9b'),_0x233949[_0x99c4('0x2b')]);this['callProgressDetectingCustomer'](_0x1fdab7,_0x1fdab7['linkedid'],_0x1fdab7['cause']);}}};Preview[_0x99c4('0x35')][_0x99c4('0x132')]=function(_0x577fcb){if(this[_0x99c4('0x11')][_0x577fcb[_0x99c4('0x133')]]&&_0x577fcb[_0x99c4('0x133')]!==_0x577fcb['destuniqueid']){this[_0x99c4('0x73')](_0x577fcb,_0x577fcb[_0x99c4('0x133')],_0x577fcb['dialstatus']);}};Preview[_0x99c4('0x35')][_0x99c4('0x19')]=function(_0x30f125){if(this[_0x99c4('0x11')][_0x30f125[_0x99c4('0x9c')]]&&_0x30f125[_0x99c4('0x9c')]!==_0x30f125[_0x99c4('0x8b')]&&!this[_0x99c4('0x11')][_0x30f125[_0x99c4('0x9c')]][_0x99c4('0x47')]){if(_0x30f125[_0x99c4('0x12d')]==='1'){this[_0x99c4('0x73')](_0x30f125,_0x30f125[_0x99c4('0x9c')],_0x30f125['cause']);}}};Preview[_0x99c4('0x35')]['addVariable']=function(_0xcbde57,_0x18fef7,_0x164b8c){if(this[_0x99c4('0x11')][_0xcbde57]){if(_['isNil'](this[_0x99c4('0x11')][_0xcbde57][_0x99c4('0x122')])){this[_0x99c4('0x11')][_0xcbde57][_0x99c4('0x122')]={};}this[_0x99c4('0x11')][_0xcbde57][_0x99c4('0x122')][_0x18fef7]=_0x164b8c;}};Preview[_0x99c4('0x35')]['syncVarSet']=function(_0x4f8522){try{if(!_[_0x99c4('0x43')](_0x4f8522)){if(ut['filterKey'](_[_0x99c4('0x134')](_0x4f8522[_0x99c4('0x135')])[0x0])){this[_0x99c4('0x136')](_0x4f8522[_0x99c4('0x8b')],_[_0x99c4('0x134')](_0x4f8522[_0x99c4('0x135')])[0x0],_0x4f8522[_0x99c4('0x137')]);}}}catch(_0x3cc10e){logger[_0x99c4('0x138')](_0x99c4('0x139'),util[_0x99c4('0x13a')](_0x3cc10e,{'showHidden':![],'depth':null}));}};Preview[_0x99c4('0x35')]['syncAttendedTransfer']=function(_0x26b78d){if(_0x26b78d){if(this['actions'][_0x26b78d[_0x99c4('0x13b')]]){this[_0x99c4('0x11')][_0x26b78d[_0x99c4('0x13b')]]['transfer']=!![];}}};Preview['prototype']['syncBlindTransfer']=function(_0x5b76d9){if(_0x5b76d9){if(this[_0x99c4('0x11')][_0x5b76d9[_0x99c4('0x13c')]]){this[_0x99c4('0x11')][_0x5b76d9[_0x99c4('0x13c')]]['transfer']=!![];}}};module[_0x99c4('0x13d')]=Preview; \ No newline at end of file diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index 468ace7..67a6a0e 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 _0x1b07=['../rpc/voiceQueueReport','error','inspect','createHistory','catch','[createHistory]\x20','then','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','resolve','[getContactPreview]\x20','createAgentHistory','createCustomerHistory','createCustomerFinal','rescheduleContact','UserId','active','[rescheduleContact]\x20','countReScheduled','unlockContact','[unlockContact]\x20','disableContact','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallercomplete','queuecallercompleteAt','endtime','membername','context','from-sip','xcally-motion-preview','assigned','lastAssignedTo','queuecallerexitreason','COMPLETED','create','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','[rescheduleContactInQueue]\x20','util'];(function(_0x503ffd,_0x8ecde){var _0x160437=function(_0x2d45dd){while(--_0x2d45dd){_0x503ffd['push'](_0x503ffd['shift']());}};_0x160437(++_0x8ecde);}(_0x1b07,0x1c1));var _0x71b0=function(_0x303c30,_0x16edcb){_0x303c30=_0x303c30-0x0;var _0x43161b=_0x1b07[_0x303c30];return _0x43161b;};'use strict';var util=require(_0x71b0('0x0'));var BPromise=require('bluebird');var logger=require('../../../config/logger')('preview');var cmHopper=require('../rpc/cmHopper');var cmHopperHistory=require('../rpc/cmHopperHistory');var cmHopperBlack=require('../rpc/cmHopperBlack');var agentReportPreview=require('../rpc/agentReportPreview');var voiceQueueReport=require(_0x71b0('0x1'));function loggerCatch(_0x52155b){return function(_0x232a61){logger[_0x71b0('0x2')](_0x52155b,util[_0x71b0('0x3')](_0x232a61,{'showHidden':![],'depth':null}));};}function create(_0x107e90){return cmHopperHistory[_0x71b0('0x4')](_0x107e90)[_0x71b0('0x5')](loggerCatch(_0x71b0('0x6')));}function createAgent(_0x35ac18){return BPromise['resolve']()[_0x71b0('0x7')](agentReportPreview['createHistory'](_0x35ac18))[_0x71b0('0x5')](loggerCatch('[createHistory]\x20'));}function moveContact(_0x2da91a){return cmHopper[_0x71b0('0x8')](_0x2da91a,!![])[_0x71b0('0x5')](loggerCatch(_0x71b0('0x9')));}exports[_0x71b0('0xa')]=function(_0x1eff07){return cmHopperBlack[_0x71b0('0xa')](_0x1eff07)[_0x71b0('0x5')](loggerCatch(_0x71b0('0xb')));};exports[_0x71b0('0xc')]=function(_0x45732a){return BPromise[_0x71b0('0xd')]()[_0x71b0('0x7')](cmHopper['getContactPreview'](_0x45732a))[_0x71b0('0x5')](loggerCatch(_0x71b0('0xe')));};exports['createHistory']=function(_0x1231d0,_0x5a30f9){create(_0x1231d0)[_0x71b0('0x5')](loggerCatch(_0x5a30f9));moveContact(_0x1231d0)[_0x71b0('0x5')](loggerCatch(_0x5a30f9));};exports[_0x71b0('0xf')]=function(_0x1a7249,_0x380601){createAgent(_0x1a7249)['catch'](loggerCatch(_0x380601));};exports[_0x71b0('0x10')]=function(_0x1c7ce3,_0x32991a){create(_0x1c7ce3)[_0x71b0('0x5')](loggerCatch(_0x32991a));};exports[_0x71b0('0x11')]=function(_0x468219,_0x5bcfa9){moveContact(_0x468219)[_0x71b0('0x5')](loggerCatch(_0x5bcfa9));};exports[_0x71b0('0x12')]=function(_0x59c320,_0x1bc402,_0x3e42f8){if(_0x1bc402){_0x59c320[_0x71b0('0x13')]=null;}if(_0x3e42f8){_0x59c320[_0x71b0('0x14')]=![];}return cmHopper['rescheduleContact'](_0x59c320)[_0x71b0('0x5')](loggerCatch(_0x71b0('0x15')));};exports[_0x71b0('0x16')]=function(_0x581fdd){return cmHopper[_0x71b0('0x16')](_0x581fdd)[_0x71b0('0x5')](loggerCatch('[countReScheduled]\x20'));};exports[_0x71b0('0x17')]=function(_0x397449){return cmHopper['unlockContact']({'UserId':null},_0x397449,0x1)[_0x71b0('0x5')](loggerCatch(_0x71b0('0x18')));};exports[_0x71b0('0x19')]=function(_0x3b4d3d){return cmHopper['unlockContact']({'active':![]},_0x3b4d3d,0x1)[_0x71b0('0x5')](loggerCatch('[activeContact]\x20'));};exports[_0x71b0('0x1a')]=function(_0x52be92){var _0x2b1408={};_0x2b1408[_0x71b0('0x1b')]=_0x52be92[_0x71b0('0x1b')];_0x2b1408[_0x71b0('0x1c')]=_0x52be92[_0x71b0('0x1c')];_0x2b1408[_0x71b0('0x1d')]=_0x52be92['calleridnum'];_0x2b1408[_0x71b0('0x1e')]=_0x52be92[_0x71b0('0x1e')];_0x2b1408[_0x71b0('0x1f')]=_0x52be92[_0x71b0('0x1f')];_0x2b1408[_0x71b0('0x20')]=_0x52be92['answertime'];_0x2b1408['queuecallerleaveAt']=_0x52be92[_0x71b0('0x21')];_0x2b1408[_0x71b0('0x22')]=0x1;_0x2b1408[_0x71b0('0x23')]=_0x52be92[_0x71b0('0x24')];_0x2b1408['connectedlinename']=_0x52be92[_0x71b0('0x25')];_0x2b1408[_0x71b0('0x26')]=_0x71b0('0x27');_0x2b1408['exten']=_0x71b0('0x28');_0x2b1408['holdtime']=0x0;_0x2b1408[_0x71b0('0x29')]=0x1;_0x2b1408[_0x71b0('0x2a')]=_0x52be92[_0x71b0('0x25')];_0x2b1408[_0x71b0('0x2b')]=_0x71b0('0x2c');return BPromise[_0x71b0('0xd')]()[_0x71b0('0x7')](voiceQueueReport[_0x71b0('0x2d')](_0x2b1408))['catch'](loggerCatch(_0x71b0('0x2e')));};exports[_0x71b0('0x2f')]=function(_0x17464a,_0x5de739){return BPromise[_0x71b0('0xd')]()[_0x71b0('0x7')](cmHopper[_0x71b0('0x2f')](_0x17464a,_0x5de739))[_0x71b0('0x5')](loggerCatch(_0x71b0('0x30')));};exports['rescheduleContactInQueue']=function(_0x37f227){return cmHopper[_0x71b0('0x12')](_0x37f227,!![],!![])[_0x71b0('0x5')](loggerCatch(_0x71b0('0x31')));}; \ No newline at end of file +var _0x3f32=['inspect','createHistory','catch','[createHistory]\x20','resolve','then','moveContactManagedDialer','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','rescheduleContact','active','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','disableContact','[activeContact]\x20','crateCustomerReportQueue','uniqueid','calleridnum','calleridname','queue','answertime','queuecallerleaveAt','queuecallercompleteAt','endtime','connectedlinename','membername','context','from-sip','xcally-motion-preview','holdtime','assigned','lastAssignedTo','queuecallerexitreason','COMPLETED','[voiceQueueReport]\x20','getContactRecallMe','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','util','../../../config/logger','preview','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/voiceQueueReport'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x3f32,0x8d));var _0x23f3=function(_0xb83ec2,_0x18e73b){_0xb83ec2=_0xb83ec2-0x0;var _0x4d2fbf=_0x3f32[_0xb83ec2];return _0x4d2fbf;};'use strict';var util=require(_0x23f3('0x0'));var BPromise=require('bluebird');var logger=require(_0x23f3('0x1'))(_0x23f3('0x2'));var cmHopper=require(_0x23f3('0x3'));var cmHopperHistory=require(_0x23f3('0x4'));var cmHopperBlack=require('../rpc/cmHopperBlack');var agentReportPreview=require('../rpc/agentReportPreview');var voiceQueueReport=require(_0x23f3('0x5'));function loggerCatch(_0x5a211d){return function(_0x28041a){logger['error'](_0x5a211d,util[_0x23f3('0x6')](_0x28041a,{'showHidden':![],'depth':null}));};}function create(_0x3a9cd0){return cmHopperHistory[_0x23f3('0x7')](_0x3a9cd0)[_0x23f3('0x8')](loggerCatch(_0x23f3('0x9')));}function createAgent(_0x5360c7){return BPromise[_0x23f3('0xa')]()[_0x23f3('0xb')](agentReportPreview[_0x23f3('0x7')](_0x5360c7))['catch'](loggerCatch(_0x23f3('0x9')));}function moveContact(_0x3422f6){return cmHopper[_0x23f3('0xc')](_0x3422f6,!![])[_0x23f3('0x8')](loggerCatch('[moveContactManagedDialer]\x20'));}exports[_0x23f3('0xd')]=function(_0x25ffaa){return cmHopperBlack[_0x23f3('0xd')](_0x25ffaa)[_0x23f3('0x8')](loggerCatch(_0x23f3('0xe')));};exports[_0x23f3('0xf')]=function(_0x1a1f64){return BPromise[_0x23f3('0xa')]()[_0x23f3('0xb')](cmHopper[_0x23f3('0xf')](_0x1a1f64))['catch'](loggerCatch(_0x23f3('0x10')));};exports['createHistory']=function(_0x51da5c,_0x25f1a7){create(_0x51da5c)[_0x23f3('0x8')](loggerCatch(_0x25f1a7));moveContact(_0x51da5c)[_0x23f3('0x8')](loggerCatch(_0x25f1a7));};exports['createAgentHistory']=function(_0x47169d,_0x719fa4){createAgent(_0x47169d)[_0x23f3('0x8')](loggerCatch(_0x719fa4));};exports['createCustomerHistory']=function(_0x4f27a2,_0x1e3ca8){create(_0x4f27a2)[_0x23f3('0x8')](loggerCatch(_0x1e3ca8));};exports['createCustomerFinal']=function(_0x2fd311,_0x1921e4){moveContact(_0x2fd311)[_0x23f3('0x8')](loggerCatch(_0x1921e4));};exports[_0x23f3('0x11')]=function(_0x16af01,_0x271a13,_0x215493){if(_0x271a13){_0x16af01['UserId']=null;}if(_0x215493){_0x16af01[_0x23f3('0x12')]=![];}return cmHopper[_0x23f3('0x11')](_0x16af01)['catch'](loggerCatch(_0x23f3('0x13')));};exports[_0x23f3('0x14')]=function(_0x3b44e5){return cmHopper[_0x23f3('0x14')](_0x3b44e5)[_0x23f3('0x8')](loggerCatch(_0x23f3('0x15')));};exports['unlockContact']=function(_0x601354){return cmHopper[_0x23f3('0x16')]({'UserId':null},_0x601354,0x1)[_0x23f3('0x8')](loggerCatch(_0x23f3('0x17')));};exports[_0x23f3('0x18')]=function(_0x1bfc96){return cmHopper[_0x23f3('0x16')]({'active':![]},_0x1bfc96,0x1)[_0x23f3('0x8')](loggerCatch(_0x23f3('0x19')));};exports[_0x23f3('0x1a')]=function(_0x31e256){var _0x21f125={};_0x21f125['type']=_0x31e256['type'];_0x21f125[_0x23f3('0x1b')]=_0x31e256['uniqueid'];_0x21f125[_0x23f3('0x1c')]=_0x31e256['calleridnum'];_0x21f125[_0x23f3('0x1d')]=_0x31e256[_0x23f3('0x1d')];_0x21f125[_0x23f3('0x1e')]=_0x31e256[_0x23f3('0x1e')];_0x21f125['queuecallerjoinAt']=_0x31e256[_0x23f3('0x1f')];_0x21f125[_0x23f3('0x20')]=_0x31e256[_0x23f3('0x1f')];_0x21f125['queuecallercomplete']=0x1;_0x21f125[_0x23f3('0x21')]=_0x31e256[_0x23f3('0x22')];_0x21f125[_0x23f3('0x23')]=_0x31e256[_0x23f3('0x24')];_0x21f125[_0x23f3('0x25')]=_0x23f3('0x26');_0x21f125['exten']=_0x23f3('0x27');_0x21f125[_0x23f3('0x28')]=0x0;_0x21f125[_0x23f3('0x29')]=0x1;_0x21f125[_0x23f3('0x2a')]=_0x31e256['membername'];_0x21f125[_0x23f3('0x2b')]=_0x23f3('0x2c');return BPromise[_0x23f3('0xa')]()[_0x23f3('0xb')](voiceQueueReport['create'](_0x21f125))[_0x23f3('0x8')](loggerCatch(_0x23f3('0x2d')));};exports[_0x23f3('0x2e')]=function(_0x1685d4,_0xf8674e){return BPromise[_0x23f3('0xa')]()[_0x23f3('0xb')](cmHopper[_0x23f3('0x2e')](_0x1685d4,_0xf8674e))['catch'](loggerCatch('[GetContactRecallMe]\x20'));};exports[_0x23f3('0x2f')]=function(_0x27307a){return cmHopper[_0x23f3('0x11')](_0x27307a,!![],!![])[_0x23f3('0x8')](loggerCatch(_0x23f3('0x30')));}; \ 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 9100e08..11b3ea5 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 _0xce11=['xcally-motion-preview','_XCALLY_MIXMONITOR_FORMAT','monitor_format','_XCALLY_MIXMONITOR_UNIQUEID','toLowerVariables','hasOwnProperty','toLower','updateOriginated','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','statedesc','starttime','responsetime','endtime','logAgent','YYYY-MM-DD\x20HH:mm:ss','state','ringtime','logLookAgent','membername','UserId','logCustomer','getSeconds','answertime','isFailure','Failure','RECALL','BOOKED','uniqueid','from-sip','timeout','countbusyretry','countcongestionretry','countnoanswerretry','countagentrejectretry','countnosuchnumberretry','cloneAction','clone','Global','scheduledAt','scheduledat','add','minutes','ListId','decrementTalkink','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','name','channelAgent','motionChannel','mandatoryDisposition','buildObj','buildAcw','queue','agentReadyId','not_inuse','status','reachable','push','getDiff','diff','seconds','filterKey','type','campaigntype','dialAnswer','countglobal','callbackuniqueid','recallme','sipcallid','xmd-voicequeueid','xmd-phone','xmd-listid','xmd-dialurl','xmd-dialtimeout','xmd-dialoptions','xmd-dialid','xmd-dialchannel','xmd-cdrtype','xmd-callerid','xmd-agiafter','xmd-agi','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosjitterbridged','rtpaudioqosrttbridged','bridgepeer','\x5cw{0,','pow','replace','random','extractCalleridName','match','extractCalleridNumber','noanswer','variables','forEach','toLowerCase','buildNoAnswerEventPayload','moment','preview','env','../../dialer/utils','loggerCatch','error','inspect','info','message','isEmpty','isUndefined','string','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isActive','isNil','Queue','format','calleridname','calleridnum','ContactId','VoiceQueueId','dialOriginateTimeout','\x22rtTxX%s%s\x22','U(xcally-mixmonitor-context)','dialPreviewUrl','dialQueueProject','NONE','dialQueueProject2','\x22agi://%s/square,%s\x22','originatecalleridnum'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xce11,0x69));var _0x1ce1=function(_0xaead1,_0x200faa){_0xaead1=_0xaead1-0x0;var _0x1e47c7=_0xce11[_0xaead1];return _0x1e47c7;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0x1ce1('0x0'));var logger=require('../../../../config/logger')(_0x1ce1('0x1'));var ipAgi=process[_0x1ce1('0x2')]['XCALLY_IP_AGI']||'127.0.0.1';var utils=require(_0x1ce1('0x3'));exports[_0x1ce1('0x4')]=function(_0x294e24){return function(_0x2e026e){logger[_0x1ce1('0x5')](_0x294e24,util[_0x1ce1('0x6')](_0x2e026e,{'showHidden':![],'depth':null}));};};exports['logger']=function(_0x4c5e3e,_0xd6d8c1){logger[_0x1ce1('0x7')](_0x4c5e3e,util[_0x1ce1('0x6')](_0xd6d8c1,{'showHidden':![],'depth':null}));};exports['loggerError']=function(_0x55937e,_0x5bb8c2){logger[_0x1ce1('0x5')](_0x55937e,util[_0x1ce1('0x6')](_0x5bb8c2,{'showHidden':![],'depth':null}));};exports['logger2']=function(_0x2aef5c){return function(_0x352fe2){logger[_0x1ce1('0x7')](_0x2aef5c,util[_0x1ce1('0x6')](_0x352fe2,{'showHidden':![],'depth':null}));};};exports[_0x1ce1('0x8')]=function(_0x5d707d,_0x290c5b,_0x1a286f){return{'message':_0x5d707d,'unlock':_0x290c5b,'active':_0x1a286f};};exports['getCallerId']=function(_0x660058,_0x3709bc,_0x1dd7bf){if(!_['isUndefined'](_0x1dd7bf)&&'string'===typeof _0x1dd7bf&&!_[_0x1ce1('0x9')](_0x1dd7bf)){if(!_[_0x1ce1('0xa')](_0x3709bc)&&_0x1ce1('0xb')===typeof _0x3709bc&&!_['isEmpty'](_0x3709bc)){return util['format'](_0x1ce1('0xc'),_0x3709bc,_0x1dd7bf);}return util['format']('\x22%s\x22\x20<%s>',_0x1dd7bf,_0x1dd7bf);}if(!_[_0x1ce1('0xa')](_0x660058)&&_0x1ce1('0xb')===typeof _0x660058&&!_[_0x1ce1('0x9')](_0x660058)){return _0x660058;}return _0x1ce1('0xd');};exports[_0x1ce1('0xe')]=function(_0x3d4eac){if(_[_0x1ce1('0xf')](_0x3d4eac)){return![];}return _0x3d4eac;};exports['addVariables']=function(_0x298688,_0x1b34e5,_0x336f55,_0x594773,_0x220e10,_0x29827e){var _0x3d9024={'XMD-QUEUE':_0x1b34e5['Queue']?_0x1b34e5[_0x1ce1('0x10')]['name']:'','XMD-CALLERID':_0x594773,'XMD-CALLERID-PREVIEW':_0x29827e?util[_0x1ce1('0x11')]('\x22%s\x22\x20<%s>',_0x29827e[_0x1ce1('0x12')],_0x29827e[_0x1ce1('0x13')]):_0x594773,'XMD-DIALID':_0x220e10,'XMD-CONTACTID':_0x1b34e5[_0x1ce1('0x14')],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0x594773,'XMD-VOICEQUEUEID':_0x1b34e5[_0x1ce1('0x15')],'XMD-DIALCHANNEL':_0x336f55,'XMD-DIALTIMEOUT':_0x298688[_0x1ce1('0x16')]||0x1e,'XMD-DIALOPTIONS':util[_0x1ce1('0x11')](_0x1ce1('0x17'),_0x298688['dialQueueProject2']?'g':'',_['isEmpty'](_0x298688['monitor_format'])?'':_0x1ce1('0x18')),'XMD-DIALURL':_0x298688[_0x1ce1('0x19')]||'','XMD-AGI':_0x298688['dialQueueProject']?util['format']('\x22agi://%s/square,%s\x22',ipAgi,_0x298688[_0x1ce1('0x1a')]):_0x1ce1('0x1b'),'XMD-AGIAFTER':_0x298688[_0x1ce1('0x1c')]?util[_0x1ce1('0x11')](_0x1ce1('0x1d'),ipAgi,_0x298688[_0x1ce1('0x1c')]):'NONE','XMD-ORIGINATECALLERIDNUM':_0x29827e?_0x29827e[_0x1ce1('0x1e')]:'','XMD-ORIGINATECALLERIDNAME':_0x29827e?_0x29827e['originatecalleridname']:'','XMD-DESTINATION':_0x1ce1('0x1f'),'SIPADDHEADER':'Call-Type:\x20PREVIEW'};if(!_['isEmpty'](_0x298688['monitor_format'])){_0x3d9024[util[_0x1ce1('0x11')]('%s',_0x1ce1('0x20'))]=_0x298688[_0x1ce1('0x21')];_0x3d9024[util[_0x1ce1('0x11')]('%s',_0x1ce1('0x22'))]=_0x220e10;}return _0x3d9024;};exports[_0x1ce1('0x23')]=function(_0x1f9fd9){var _0x370f1f={};for(var _0xb323df in _0x1f9fd9){if(_0x1f9fd9[_0x1ce1('0x24')](_0xb323df)){_0x370f1f[util[_0x1ce1('0x11')]('%s',_[_0x1ce1('0x25')](_0xb323df))]=_0x1f9fd9[_0xb323df];}}return{'variables':_0x370f1f};};exports[_0x1ce1('0x26')]=function(_0x43a64f,_0x38c4d4){if(!_[_0x1ce1('0xf')](_0x43a64f)){if(_0x43a64f[_0x1ce1('0x24')]('originated')){if(_0x43a64f[_0x1ce1('0x27')]>0x0){_0x43a64f[_0x1ce1('0x27')]-=0x1;}else{logger[_0x1ce1('0x5')](_0x1ce1('0x28'),_0x38c4d4);}}}else{logger[_0x1ce1('0x5')](_0x1ce1('0x29'),_0x38c4d4);}};exports['logBlacklist']=function(_0x15e474){var _0x525f9e=moment()[_0x1ce1('0x11')]('YYYY-MM-DD\x20HH:mm:ss');_0x15e474['state']=0xd;_0x15e474[_0x1ce1('0x2a')]='Blacklist';_0x15e474[_0x1ce1('0x2b')]=_0x525f9e;_0x15e474[_0x1ce1('0x2c')]=_0x525f9e;_0x15e474[_0x1ce1('0x2d')]=_0x525f9e;};exports[_0x1ce1('0x2e')]=function(_0x27456d,_0x1a99e7,_0x47c3c2){var _0x5f312b=moment()['format'](_0x1ce1('0x2f'));_0x27456d[_0x1ce1('0x30')]=_0x1a99e7;_0x27456d[_0x1ce1('0x2a')]=_0x47c3c2;_0x27456d[_0x1ce1('0x2c')]=_0x5f312b;_0x27456d[_0x1ce1('0x31')]=utils['getSeconds'](_0x27456d[_0x1ce1('0x2c')],_0x27456d[_0x1ce1('0x2b')]);};exports[_0x1ce1('0x32')]=function(_0x3c7534,_0x345d74,_0x4dadcf){_0x3c7534[_0x1ce1('0x33')]=_0x345d74;_0x3c7534[_0x1ce1('0x34')]=_0x4dadcf;};exports[_0x1ce1('0x35')]=function(_0x28d6a0,_0x5532f1,_0x145981){var _0x1e4f09=moment()[_0x1ce1('0x11')](_0x1ce1('0x2f'));_0x28d6a0[_0x1ce1('0x30')]=_0x5532f1;_0x28d6a0['statedesc']=_0x145981;_0x28d6a0['responsetime']=_0x28d6a0[_0x1ce1('0x2c')]?_0x28d6a0['responsetime']:_0x1e4f09;_0x28d6a0[_0x1ce1('0x2d')]=_0x28d6a0[_0x1ce1('0x2d')]?_0x28d6a0[_0x1ce1('0x2d')]:_0x1e4f09;_0x28d6a0[_0x1ce1('0x31')]=utils['getSeconds'](_0x28d6a0[_0x1ce1('0x2c')]||0x0,_0x28d6a0[_0x1ce1('0x2b')]||0x0);_0x28d6a0['talktime']=_0x28d6a0['answertime']?utils[_0x1ce1('0x36')](_0x28d6a0[_0x1ce1('0x2d')],_0x28d6a0[_0x1ce1('0x37')]):0x0;};exports[_0x1ce1('0x38')]=function(_0x947166){return _0x947166===_0x1ce1('0x39');};exports['variablesAction']=function(_0x116aba,_0x21af8c,_0x4ac958,_0x536bfc,_0x5d63ad){var _0x5c81cd=_0x536bfc?_0x1ce1('0x3a'):_0x116aba['calleridname'];_0x5c81cd=_0x5d63ad?_0x1ce1('0x3b'):_0x5c81cd;return{'actionid':_0x116aba[_0x1ce1('0x3c')],'action':'originate','channel':_0x116aba['channelAgent'],'callerid':util['format'](_0x1ce1('0xc'),_0x5c81cd,_0x116aba[_0x1ce1('0x13')]),'Exten':'xcally-motion-preview','Context':_0x1ce1('0x3d'),'Priority':'1','variable':_0x4ac958,'timeout':(_0x21af8c[_0x1ce1('0x3e')]||0x1e)*0x3e8,'async':!![],'channelid':_0x116aba[_0x1ce1('0x3c')]};};exports['totalGlobal']=function(_0x4960b1){return _0x4960b1[_0x1ce1('0x3f')]+_0x4960b1[_0x1ce1('0x40')]+_0x4960b1[_0x1ce1('0x41')]+_0x4960b1[_0x1ce1('0x42')]+_0x4960b1[_0x1ce1('0x43')];};exports[_0x1ce1('0x44')]=function(_0x37756b){var _0xa00cff=_[_0x1ce1('0x45')](_0x37756b);_0xa00cff[_0x1ce1('0x30')]=0xf;_0xa00cff['statedesc']=_0x1ce1('0x46');return _0xa00cff;};exports[_0x1ce1('0x47')]=function(_0xec07ac,_0x10ad23,_0x439df0){var _0x324ce9={};_0x324ce9[_0x10ad23]=_0xec07ac[_0x10ad23];_0x324ce9['active']=![];_0x324ce9[_0x1ce1('0x48')]=moment()[_0x1ce1('0x49')](_0x439df0,_0x1ce1('0x4a'))[_0x1ce1('0x11')]('YYYY-MM-DD\x20HH:mm:ss');_0x324ce9[_0x1ce1('0x14')]=_0xec07ac[_0x1ce1('0x14')];_0x324ce9[_0x1ce1('0x4b')]=_0xec07ac[_0x1ce1('0x4b')];_0x324ce9[_0x1ce1('0x15')]=_0xec07ac['VoiceQueueId']||undefined;return _0x324ce9;};exports[_0x1ce1('0x4c')]=function(_0x552c0a,_0x1e1957){if(!_[_0x1ce1('0xf')](_0x552c0a)){if(_0x552c0a[_0x1ce1('0x4d')]>0x0){_0x552c0a[_0x1ce1('0x4d')]-=0x1;}else{logger[_0x1ce1('0x5')](_0x1e1957,_0x1ce1('0x4e'));}}else{logger[_0x1ce1('0x5')](_0x1e1957,_0x1ce1('0x4f'));}};exports[_0x1ce1('0x50')]=function(_0xfaf4a9){if(_0xfaf4a9<=0x0){return!![];}return![];};function buildObj(_0x52ffb4,_0x2b4074,_0x39c020){_0x52ffb4['lastevent']=_0x2b4074;_0x52ffb4[_0x1ce1('0x51')]=_0x52ffb4['queue'];_0x52ffb4['interface']=_0x52ffb4[_0x1ce1('0x52')];_0x52ffb4[_0x1ce1('0x53')]='voice';if(_0x39c020){_0x52ffb4['mandatoryDisposition']=_0x39c020[_0x1ce1('0x54')];}return _0x52ffb4;}exports[_0x1ce1('0x55')]=buildObj;exports[_0x1ce1('0x56')]=function(_0x827fc8){var _0x57c8ff={};_0x57c8ff['queue']=_0x827fc8[_0x1ce1('0x57')];_0x57c8ff['interface']=_0x827fc8[_0x1ce1('0x52')];_0x57c8ff[_0x1ce1('0x3c')]=_0x827fc8['uniqueid'];return _0x57c8ff;};exports[_0x1ce1('0x58')]=function(_0x486a35){var _0x2dc179=[];for(var _0x57926b in _0x486a35){if(_0x486a35[_0x1ce1('0x24')](_0x57926b)){if(!_[_0x1ce1('0xf')](_0x486a35[_0x57926b])&&_0x486a35[_0x57926b][_0x1ce1('0x30')]===_0x1ce1('0x59')&&_0x486a35[_0x57926b][_0x1ce1('0x5a')]===_0x1ce1('0x5b')){_0x2dc179[_0x1ce1('0x5c')](_0x486a35[_0x57926b]['id']);}}}return _0x2dc179;};exports[_0x1ce1('0x5d')]=function(_0x52f9ef){var _0x53889c=moment()['milliseconds'](0x0);var _0x5681fc=moment(_0x52f9ef)['milliseconds'](0x0);return _0x53889c[_0x1ce1('0x5e')](_0x5681fc,_0x1ce1('0x5f'));};exports['createBody']=function(_0x206408){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x206408[_0x1ce1('0x14')],'ListId':_0x206408[_0x1ce1('0x4b')],'VoiceQueueId':_0x206408['VoiceQueueId']||undefined,'CampaignId':_0x206408['CampaignId']||undefined};};exports[_0x1ce1('0x60')]=function(_0x423a89){if(_0x423a89==='uniqueid'||_0x423a89==='idContact'||_0x423a89===_0x1ce1('0x57')||_0x423a89===_0x1ce1('0x61')||_0x423a89===_0x1ce1('0x62')||_0x423a89===_0x1ce1('0x63')||_0x423a89===_0x1ce1('0x33')||_0x423a89===_0x1ce1('0x52')||_0x423a89===_0x1ce1('0x12')||_0x423a89==='active'||_0x423a89===_0x1ce1('0x13')||_0x423a89===_0x1ce1('0x48')||_0x423a89==='countbusyretry'||_0x423a89===_0x1ce1('0x40')||_0x423a89===_0x1ce1('0x41')||_0x423a89===_0x1ce1('0x64')||_0x423a89==='callback'||_0x423a89===_0x1ce1('0x65')||_0x423a89==='callbackat'||_0x423a89===_0x1ce1('0x66')||_0x423a89==='ContactId'||_0x423a89===_0x1ce1('0x4b')||_0x423a89==='UserId'||_0x423a89===_0x1ce1('0x15')||_0x423a89===_0x1ce1('0x67')||_0x423a89===_0x1ce1('0x68')||_0x423a89==='xmd-queue'||_0x423a89===_0x1ce1('0x69')||_0x423a89===_0x1ce1('0x6a')||_0x423a89===_0x1ce1('0x6b')||_0x423a89===_0x1ce1('0x6c')||_0x423a89===_0x1ce1('0x6d')||_0x423a89===_0x1ce1('0x6e')||_0x423a89===_0x1ce1('0x6f')||_0x423a89==='xmd-contactid'||_0x423a89===_0x1ce1('0x70')||_0x423a89===_0x1ce1('0x71')||_0x423a89===_0x1ce1('0x72')||_0x423a89===_0x1ce1('0x73')||_0x423a89===_0x1ce1('0x74')||_0x423a89===_0x1ce1('0x75')||_0x423a89===_0x1ce1('0x76')||_0x423a89==='rtpaudioqosjitterbridged'||_0x423a89==='rtpaudioqosloss'||_0x423a89===_0x1ce1('0x77')||_0x423a89===_0x1ce1('0x78')||_0x423a89==='rtpaudioqosrttbridged'||_0x423a89==='rtpaudioqos'||_0x423a89==='rtpaudioqosbridged'||_0x423a89===_0x1ce1('0x76')||_0x423a89===_0x1ce1('0x79')||_0x423a89==='rtpaudioqosloss'||_0x423a89===_0x1ce1('0x77')||_0x423a89===_0x1ce1('0x78')||_0x423a89===_0x1ce1('0x7a')||_0x423a89===_0x1ce1('0x7b')||_0x423a89==='bridgepvtcallid'||_0x423a89==='state'||_0x423a89===_0x1ce1('0x2a')){return![];}return!![];};exports['getCallerIdRandom']=function(_0x231755,_0x5e5bdf){var _0x4f56be,_0x592be3,_0x2100b2;if(_0x5e5bdf<=0x0){_0x5e5bdf=0x1;}_0x4f56be=new RegExp(_0x1ce1('0x7c')+_0x5e5bdf+'}$');_0x592be3=Math['pow'](0xa,_0x5e5bdf-0x1);_0x2100b2=Math[_0x1ce1('0x7d')](0xa,_0x5e5bdf)-0x1;return util[_0x1ce1('0x11')]('%s',_[_0x1ce1('0x7e')](_0x231755,_0x4f56be,_[_0x1ce1('0x7f')](_0x592be3,_0x2100b2)));};exports[_0x1ce1('0x80')]=function(_0x28503c){var _0x300e38=_0x28503c[_0x1ce1('0x81')](/"(.*?)"/);return _0x300e38?_0x300e38[0x1]:_0x28503c;};exports[_0x1ce1('0x82')]=function(_0x3fd927){var _0x428c13=_0x3fd927[_0x1ce1('0x81')](/<(.*?)>/);return _0x428c13?_0x428c13[0x1]:_0x3fd927;};function buildNoAnswerEventPayload(_0xe8d9c1,_0x1b6501){var _0x1d3f88=buildObj(_0xe8d9c1,_0x1ce1('0x83'));if(!_['isEmpty'](_0x1b6501[_0x1ce1('0x84')])){Object['keys'](_0x1b6501[_0x1ce1('0x84')])[_0x1ce1('0x85')](function(_0x185c9e){_0x1d3f88[_0x185c9e[_0x1ce1('0x86')]()]=_0x1b6501[_0x1ce1('0x84')][_0x185c9e];});}return _0x1d3f88;}exports[_0x1ce1('0x87')]=buildNoAnswerEventPayload; \ No newline at end of file +var _0xbeb5=['[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','lastevent','name','queue','motionChannel','voice','mandatoryDisposition','buildObj','buildAcw','interface','agentReadyId','not_inuse','status','reachable','push','getDiff','milliseconds','diff','seconds','CampaignId','idContact','campaigntype','dialAnswer','countglobal','callback','callbackuniqueid','callbackat','xmd-voicequeueid','xmd-listid','xmd-dialurl','xmd-dialtimeout','xmd-dialoptions','xmd-dialid','xmd-dialchannel','xmd-contactid','xmd-callerid','xmd-agi','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','rtpaudioqosjitter','bridgepeer','bridgepvtcallid','\x5cw{0,','pow','replace','random','extractCalleridName','match','extractCalleridNumber','noanswer','variables','keys','forEach','toLowerCase','lodash','moment','../../../../config/logger','preview','env','../../dialer/utils','loggerCatch','error','inspect','info','loggerError','message','getCallerId','isUndefined','string','isEmpty','\x22%s\x22\x20<%s>','format','\x22\x22\x20<>','isNil','addVariables','Queue','calleridname','ContactId','dialer','dialOriginateTimeout','dialQueueProject2','monitor_format','U(xcally-mixmonitor-context)','dialQueueProject','NONE','\x22agi://%s/square,%s\x22','originatecalleridname','xcally-motion-preview','Call-Type:\x20PREVIEW','_XCALLY_MIXMONITOR_FORMAT','toLowerVariables','hasOwnProperty','toLower','updateOriginated','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','state','Blacklist','responsetime','endtime','getSeconds','starttime','logLookAgent','membername','UserId','statedesc','answertime','isFailure','Failure','RECALL','BOOKED','uniqueid','originate','channelAgent','from-sip','countbusyretry','countcongestionretry','countnoanswerretry','countagentrejectretry','clone','Global','scheduledAt','active','scheduledat','ListId','VoiceQueueId','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative'];(function(_0x53f2b9,_0x572f3e){var _0x2eab82=function(_0x2b2ed1){while(--_0x2b2ed1){_0x53f2b9['push'](_0x53f2b9['shift']());}};_0x2eab82(++_0x572f3e);}(_0xbeb5,0x14c));var _0x5beb=function(_0x5deed2,_0x498a8b){_0x5deed2=_0x5deed2-0x0;var _0x25172f=_0xbeb5[_0x5deed2];return _0x25172f;};'use strict';var util=require('util');var _=require(_0x5beb('0x0'));var moment=require(_0x5beb('0x1'));var logger=require(_0x5beb('0x2'))(_0x5beb('0x3'));var ipAgi=process[_0x5beb('0x4')]['XCALLY_IP_AGI']||'127.0.0.1';var utils=require(_0x5beb('0x5'));exports[_0x5beb('0x6')]=function(_0x2c54a2){return function(_0x2d89ac){logger[_0x5beb('0x7')](_0x2c54a2,util[_0x5beb('0x8')](_0x2d89ac,{'showHidden':![],'depth':null}));};};exports['logger']=function(_0x181c2e,_0xcd1d97){logger[_0x5beb('0x9')](_0x181c2e,util[_0x5beb('0x8')](_0xcd1d97,{'showHidden':![],'depth':null}));};exports[_0x5beb('0xa')]=function(_0x28e5f6,_0x313d73){logger[_0x5beb('0x7')](_0x28e5f6,util['inspect'](_0x313d73,{'showHidden':![],'depth':null}));};exports['logger2']=function(_0x489605){return function(_0x4923e4){logger['info'](_0x489605,util[_0x5beb('0x8')](_0x4923e4,{'showHidden':![],'depth':null}));};};exports[_0x5beb('0xb')]=function(_0x17d062,_0x4352aa,_0x691b93){return{'message':_0x17d062,'unlock':_0x4352aa,'active':_0x691b93};};exports[_0x5beb('0xc')]=function(_0x59d373,_0x22db24,_0x2dcb97){if(!_[_0x5beb('0xd')](_0x2dcb97)&&_0x5beb('0xe')===typeof _0x2dcb97&&!_[_0x5beb('0xf')](_0x2dcb97)){if(!_[_0x5beb('0xd')](_0x22db24)&&'string'===typeof _0x22db24&&!_[_0x5beb('0xf')](_0x22db24)){return util['format'](_0x5beb('0x10'),_0x22db24,_0x2dcb97);}return util[_0x5beb('0x11')]('\x22%s\x22\x20<%s>',_0x2dcb97,_0x2dcb97);}if(!_[_0x5beb('0xd')](_0x59d373)&&_0x5beb('0xe')===typeof _0x59d373&&!_['isEmpty'](_0x59d373)){return _0x59d373;}return _0x5beb('0x12');};exports['isActive']=function(_0x4c99d6){if(_[_0x5beb('0x13')](_0x4c99d6)){return![];}return _0x4c99d6;};exports[_0x5beb('0x14')]=function(_0x16e4cc,_0x174145,_0x1a58c7,_0x26f196,_0x5a7964,_0x1ee2a9){var _0x4b1c7f={'XMD-QUEUE':_0x174145[_0x5beb('0x15')]?_0x174145[_0x5beb('0x15')]['name']:'','XMD-CALLERID':_0x26f196,'XMD-CALLERID-PREVIEW':_0x1ee2a9?util[_0x5beb('0x11')](_0x5beb('0x10'),_0x1ee2a9[_0x5beb('0x16')],_0x1ee2a9['calleridnum']):_0x26f196,'XMD-DIALID':_0x5a7964,'XMD-CONTACTID':_0x174145[_0x5beb('0x17')],'XMD-CDRTYPE':_0x5beb('0x18'),'CALLERID(all)':_0x26f196,'XMD-VOICEQUEUEID':_0x174145['VoiceQueueId'],'XMD-DIALCHANNEL':_0x1a58c7,'XMD-DIALTIMEOUT':_0x16e4cc[_0x5beb('0x19')]||0x1e,'XMD-DIALOPTIONS':util['format']('\x22rtTxX%s%s\x22',_0x16e4cc[_0x5beb('0x1a')]?'g':'',_[_0x5beb('0xf')](_0x16e4cc[_0x5beb('0x1b')])?'':_0x5beb('0x1c')),'XMD-DIALURL':_0x16e4cc['dialPreviewUrl']||'','XMD-AGI':_0x16e4cc[_0x5beb('0x1d')]?util['format']('\x22agi://%s/square,%s\x22',ipAgi,_0x16e4cc['dialQueueProject']):_0x5beb('0x1e'),'XMD-AGIAFTER':_0x16e4cc['dialQueueProject2']?util['format'](_0x5beb('0x1f'),ipAgi,_0x16e4cc[_0x5beb('0x1a')]):_0x5beb('0x1e'),'XMD-ORIGINATECALLERIDNUM':_0x1ee2a9?_0x1ee2a9['originatecalleridnum']:'','XMD-ORIGINATECALLERIDNAME':_0x1ee2a9?_0x1ee2a9[_0x5beb('0x20')]:'','XMD-DESTINATION':_0x5beb('0x21'),'SIPADDHEADER':_0x5beb('0x22')};if(!_[_0x5beb('0xf')](_0x16e4cc[_0x5beb('0x1b')])){_0x4b1c7f[util[_0x5beb('0x11')]('%s',_0x5beb('0x23'))]=_0x16e4cc[_0x5beb('0x1b')];_0x4b1c7f[util[_0x5beb('0x11')]('%s','_XCALLY_MIXMONITOR_UNIQUEID')]=_0x5a7964;}return _0x4b1c7f;};exports[_0x5beb('0x24')]=function(_0x572847){var _0x18cb1a={};for(var _0x4edf06 in _0x572847){if(_0x572847[_0x5beb('0x25')](_0x4edf06)){_0x18cb1a[util['format']('%s',_[_0x5beb('0x26')](_0x4edf06))]=_0x572847[_0x4edf06];}}return{'variables':_0x18cb1a};};exports[_0x5beb('0x27')]=function(_0x1d0217,_0x2f7716){if(!_[_0x5beb('0x13')](_0x1d0217)){if(_0x1d0217[_0x5beb('0x25')](_0x5beb('0x28'))){if(_0x1d0217['originated']>0x0){_0x1d0217['originated']-=0x1;}else{logger[_0x5beb('0x7')](_0x5beb('0x29'),_0x2f7716);}}}else{logger[_0x5beb('0x7')]('[updateOriginated]\x20is\x20null\x20or\x20undefined',_0x2f7716);}};exports[_0x5beb('0x2a')]=function(_0x1b5eba){var _0x4ba02f=moment()[_0x5beb('0x11')](_0x5beb('0x2b'));_0x1b5eba[_0x5beb('0x2c')]=0xd;_0x1b5eba['statedesc']=_0x5beb('0x2d');_0x1b5eba['starttime']=_0x4ba02f;_0x1b5eba[_0x5beb('0x2e')]=_0x4ba02f;_0x1b5eba[_0x5beb('0x2f')]=_0x4ba02f;};exports['logAgent']=function(_0x2b2840,_0x3f4a1c,_0xb026be){var _0x1a152b=moment()['format'](_0x5beb('0x2b'));_0x2b2840['state']=_0x3f4a1c;_0x2b2840['statedesc']=_0xb026be;_0x2b2840[_0x5beb('0x2e')]=_0x1a152b;_0x2b2840['ringtime']=utils[_0x5beb('0x30')](_0x2b2840['responsetime'],_0x2b2840[_0x5beb('0x31')]);};exports[_0x5beb('0x32')]=function(_0x2d3db0,_0x24be48,_0x1054de){_0x2d3db0[_0x5beb('0x33')]=_0x24be48;_0x2d3db0[_0x5beb('0x34')]=_0x1054de;};exports['logCustomer']=function(_0x1239ae,_0x3012f5,_0x168890){var _0xb7479d=moment()['format'](_0x5beb('0x2b'));_0x1239ae['state']=_0x3012f5;_0x1239ae[_0x5beb('0x35')]=_0x168890;_0x1239ae[_0x5beb('0x2e')]=_0x1239ae[_0x5beb('0x2e')]?_0x1239ae['responsetime']:_0xb7479d;_0x1239ae[_0x5beb('0x2f')]=_0x1239ae[_0x5beb('0x2f')]?_0x1239ae[_0x5beb('0x2f')]:_0xb7479d;_0x1239ae['ringtime']=utils[_0x5beb('0x30')](_0x1239ae['responsetime']||0x0,_0x1239ae[_0x5beb('0x31')]||0x0);_0x1239ae['talktime']=_0x1239ae['answertime']?utils['getSeconds'](_0x1239ae[_0x5beb('0x2f')],_0x1239ae[_0x5beb('0x36')]):0x0;};exports[_0x5beb('0x37')]=function(_0x505351){return _0x505351===_0x5beb('0x38');};exports['variablesAction']=function(_0x4f95d7,_0x2f11c8,_0x1d1db2,_0x284584,_0x40b7eb){var _0x1c34ad=_0x284584?_0x5beb('0x39'):_0x4f95d7[_0x5beb('0x16')];_0x1c34ad=_0x40b7eb?_0x5beb('0x3a'):_0x1c34ad;return{'actionid':_0x4f95d7[_0x5beb('0x3b')],'action':_0x5beb('0x3c'),'channel':_0x4f95d7[_0x5beb('0x3d')],'callerid':util[_0x5beb('0x11')](_0x5beb('0x10'),_0x1c34ad,_0x4f95d7['calleridnum']),'Exten':'xcally-motion-preview','Context':_0x5beb('0x3e'),'Priority':'1','variable':_0x1d1db2,'timeout':(_0x2f11c8['timeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x4f95d7['uniqueid']};};exports['totalGlobal']=function(_0x49b8ca){return _0x49b8ca[_0x5beb('0x3f')]+_0x49b8ca[_0x5beb('0x40')]+_0x49b8ca[_0x5beb('0x41')]+_0x49b8ca[_0x5beb('0x42')]+_0x49b8ca['countnosuchnumberretry'];};exports['cloneAction']=function(_0x23dfe9){var _0x90c400=_[_0x5beb('0x43')](_0x23dfe9);_0x90c400['state']=0xf;_0x90c400[_0x5beb('0x35')]=_0x5beb('0x44');return _0x90c400;};exports[_0x5beb('0x45')]=function(_0x18ece8,_0x548195,_0x40520f){var _0x16a254={};_0x16a254[_0x548195]=_0x18ece8[_0x548195];_0x16a254[_0x5beb('0x46')]=![];_0x16a254[_0x5beb('0x47')]=moment()['add'](_0x40520f,'minutes')[_0x5beb('0x11')](_0x5beb('0x2b'));_0x16a254['ContactId']=_0x18ece8[_0x5beb('0x17')];_0x16a254[_0x5beb('0x48')]=_0x18ece8[_0x5beb('0x48')];_0x16a254[_0x5beb('0x49')]=_0x18ece8[_0x5beb('0x49')]||undefined;return _0x16a254;};exports['decrementTalkink']=function(_0x3ad0eb,_0x211b23){if(!_[_0x5beb('0x13')](_0x3ad0eb)){if(_0x3ad0eb[_0x5beb('0x4a')]>0x0){_0x3ad0eb['pTalking']-=0x1;}else{logger[_0x5beb('0x7')](_0x211b23,_0x5beb('0x4b'));}}else{logger[_0x5beb('0x7')](_0x211b23,_0x5beb('0x4c'));}};exports[_0x5beb('0x4d')]=function(_0x200a7a){if(_0x200a7a<=0x0){return!![];}return![];};function buildObj(_0x4c343f,_0xf68ab3,_0x4aab63){_0x4c343f[_0x5beb('0x4e')]=_0xf68ab3;_0x4c343f[_0x5beb('0x4f')]=_0x4c343f[_0x5beb('0x50')];_0x4c343f['interface']=_0x4c343f['channelAgent'];_0x4c343f[_0x5beb('0x51')]=_0x5beb('0x52');if(_0x4aab63){_0x4c343f[_0x5beb('0x53')]=_0x4aab63[_0x5beb('0x53')];}return _0x4c343f;}exports[_0x5beb('0x54')]=buildObj;exports[_0x5beb('0x55')]=function(_0x179130){var _0x35ecf6={};_0x35ecf6[_0x5beb('0x50')]=_0x179130[_0x5beb('0x50')];_0x35ecf6[_0x5beb('0x56')]=_0x179130[_0x5beb('0x3d')];_0x35ecf6[_0x5beb('0x3b')]=_0x179130[_0x5beb('0x3b')];return _0x35ecf6;};exports[_0x5beb('0x57')]=function(_0x4b4901){var _0x2bb268=[];for(var _0x549677 in _0x4b4901){if(_0x4b4901[_0x5beb('0x25')](_0x549677)){if(!_['isNil'](_0x4b4901[_0x549677])&&_0x4b4901[_0x549677]['state']===_0x5beb('0x58')&&_0x4b4901[_0x549677][_0x5beb('0x59')]===_0x5beb('0x5a')){_0x2bb268[_0x5beb('0x5b')](_0x4b4901[_0x549677]['id']);}}}return _0x2bb268;};exports[_0x5beb('0x5c')]=function(_0x54dc14){var _0x13d668=moment()[_0x5beb('0x5d')](0x0);var _0x20dd4a=moment(_0x54dc14)['milliseconds'](0x0);return _0x13d668[_0x5beb('0x5e')](_0x20dd4a,_0x5beb('0x5f'));};exports['createBody']=function(_0x2b7bf8){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x2b7bf8['ContactId'],'ListId':_0x2b7bf8[_0x5beb('0x48')],'VoiceQueueId':_0x2b7bf8[_0x5beb('0x49')]||undefined,'CampaignId':_0x2b7bf8[_0x5beb('0x60')]||undefined};};exports['filterKey']=function(_0xb22d80){if(_0xb22d80===_0x5beb('0x3b')||_0xb22d80===_0x5beb('0x61')||_0xb22d80==='queue'||_0xb22d80==='type'||_0xb22d80===_0x5beb('0x62')||_0xb22d80===_0x5beb('0x63')||_0xb22d80===_0x5beb('0x33')||_0xb22d80===_0x5beb('0x3d')||_0xb22d80===_0x5beb('0x16')||_0xb22d80==='active'||_0xb22d80==='calleridnum'||_0xb22d80===_0x5beb('0x47')||_0xb22d80===_0x5beb('0x3f')||_0xb22d80===_0x5beb('0x40')||_0xb22d80==='countnoanswerretry'||_0xb22d80===_0x5beb('0x64')||_0xb22d80===_0x5beb('0x65')||_0xb22d80===_0x5beb('0x66')||_0xb22d80===_0x5beb('0x67')||_0xb22d80==='recallme'||_0xb22d80===_0x5beb('0x17')||_0xb22d80==='ListId'||_0xb22d80===_0x5beb('0x34')||_0xb22d80===_0x5beb('0x49')||_0xb22d80==='sipcallid'||_0xb22d80===_0x5beb('0x68')||_0xb22d80==='xmd-queue'||_0xb22d80==='xmd-phone'||_0xb22d80===_0x5beb('0x69')||_0xb22d80===_0x5beb('0x6a')||_0xb22d80===_0x5beb('0x6b')||_0xb22d80===_0x5beb('0x6c')||_0xb22d80===_0x5beb('0x6d')||_0xb22d80===_0x5beb('0x6e')||_0xb22d80===_0x5beb('0x6f')||_0xb22d80==='xmd-cdrtype'||_0xb22d80===_0x5beb('0x70')||_0xb22d80==='xmd-agiafter'||_0xb22d80===_0x5beb('0x71')||_0xb22d80===_0x5beb('0x72')||_0xb22d80===_0x5beb('0x73')||_0xb22d80==='rtpaudioqosjitter'||_0xb22d80===_0x5beb('0x74')||_0xb22d80===_0x5beb('0x75')||_0xb22d80===_0x5beb('0x76')||_0xb22d80===_0x5beb('0x77')||_0xb22d80===_0x5beb('0x78')||_0xb22d80===_0x5beb('0x72')||_0xb22d80===_0x5beb('0x73')||_0xb22d80===_0x5beb('0x79')||_0xb22d80===_0x5beb('0x74')||_0xb22d80===_0x5beb('0x75')||_0xb22d80===_0x5beb('0x76')||_0xb22d80===_0x5beb('0x77')||_0xb22d80===_0x5beb('0x78')||_0xb22d80===_0x5beb('0x7a')||_0xb22d80===_0x5beb('0x7b')||_0xb22d80===_0x5beb('0x2c')||_0xb22d80===_0x5beb('0x35')){return![];}return!![];};exports['getCallerIdRandom']=function(_0x4ff12c,_0x1dd893){var _0x3deeaf,_0x599c48,_0x33b197;if(_0x1dd893<=0x0){_0x1dd893=0x1;}_0x3deeaf=new RegExp(_0x5beb('0x7c')+_0x1dd893+'}$');_0x599c48=Math['pow'](0xa,_0x1dd893-0x1);_0x33b197=Math[_0x5beb('0x7d')](0xa,_0x1dd893)-0x1;return util['format']('%s',_[_0x5beb('0x7e')](_0x4ff12c,_0x3deeaf,_[_0x5beb('0x7f')](_0x599c48,_0x33b197)));};exports[_0x5beb('0x80')]=function(_0x474126){var _0x4b792f=_0x474126[_0x5beb('0x81')](/"(.*?)"/);return _0x4b792f?_0x4b792f[0x1]:_0x474126;};exports[_0x5beb('0x82')]=function(_0x302d60){var _0x228a44=_0x302d60[_0x5beb('0x81')](/<(.*?)>/);return _0x228a44?_0x228a44[0x1]:_0x302d60;};function buildNoAnswerEventPayload(_0x486062,_0x234335){var _0xeebff2=buildObj(_0x486062,_0x5beb('0x83'));if(!_[_0x5beb('0xf')](_0x234335[_0x5beb('0x84')])){Object[_0x5beb('0x85')](_0x234335[_0x5beb('0x84')])[_0x5beb('0x86')](function(_0x7b1be3){_0xeebff2[_0x7b1be3[_0x5beb('0x87')]()]=_0x234335[_0x5beb('0x84')][_0x7b1be3];});}return _0xeebff2;}exports['buildNoAnswerEventPayload']=buildNoAnswerEventPayload; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index 4f9ccac..ff57429 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 _0xb1a8=['voicequeuechannelredirect','queueadd','string','boolean','queueremove','queuepause','reload','voicequeuechannel','voicechannel','voicequeuechannelhangup'];(function(_0x4b4b1a,_0x276dd5){var _0x5056ec=function(_0x362ac7){while(--_0x362ac7){_0x4b4b1a['push'](_0x4b4b1a['shift']());}};_0x5056ec(++_0x276dd5);}(_0xb1a8,0x19b));var _0x8b1a=function(_0x529f16,_0xe289ae){_0x529f16=_0x529f16-0x0;var _0x953437=_0xb1a8[_0x529f16];return _0x953437;};'use strict';exports[_0x8b1a('0x0')]={'queue':{'type':'string','required':!![]},'interface':{'type':_0x8b1a('0x1'),'required':!![]},'membername':{'type':_0x8b1a('0x1'),'required':!![]},'penalty':{'type':'number','required':![]},'paused':{'type':_0x8b1a('0x2'),'required':![]}};exports[_0x8b1a('0x3')]={'queue':{'type':'string','required':!![]},'interface':{'type':_0x8b1a('0x1'),'required':!![]}};exports[_0x8b1a('0x4')]={'interface':{'type':_0x8b1a('0x1'),'required':!![]},'paused':{'type':_0x8b1a('0x2')},'reason':{'type':_0x8b1a('0x1'),'required':![]}};exports[_0x8b1a('0x5')]={'module':{'type':_0x8b1a('0x1'),'required':![]}};exports[_0x8b1a('0x6')]={'uniqueid':{'type':_0x8b1a('0x1'),'required':!![]}};exports[_0x8b1a('0x7')]={'uniqueid':{'type':'string','required':!![]},'filename':{'type':_0x8b1a('0x1')},'format':{'type':_0x8b1a('0x1')},'mixmonitorid':{'type':_0x8b1a('0x1')}};exports[_0x8b1a('0x8')]={'uniqueid':{'type':_0x8b1a('0x1'),'required':!![]}};exports[_0x8b1a('0x9')]={'uniqueid':{'type':'string','required':!![]},'exten':{'type':_0x8b1a('0x1'),'required':!![]},'context':{'type':_0x8b1a('0x1')}}; \ No newline at end of file +var _0x59b4=['queueremove','queuepause','voicequeuechannel','voicequeuechannelhangup','voicequeuechannelredirect','queueadd','string','number','boolean'];(function(_0x255caf,_0x2f893b){var _0x25e862=function(_0xffbed9){while(--_0xffbed9){_0x255caf['push'](_0x255caf['shift']());}};_0x25e862(++_0x2f893b);}(_0x59b4,0x149));var _0x459b=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x59b4[_0x3ab51d];return _0x29a04e;};'use strict';exports[_0x459b('0x0')]={'queue':{'type':_0x459b('0x1'),'required':!![]},'interface':{'type':_0x459b('0x1'),'required':!![]},'membername':{'type':_0x459b('0x1'),'required':!![]},'penalty':{'type':_0x459b('0x2'),'required':![]},'paused':{'type':_0x459b('0x3'),'required':![]}};exports[_0x459b('0x4')]={'queue':{'type':_0x459b('0x1'),'required':!![]},'interface':{'type':_0x459b('0x1'),'required':!![]}};exports[_0x459b('0x5')]={'interface':{'type':_0x459b('0x1'),'required':!![]},'paused':{'type':_0x459b('0x3')},'reason':{'type':_0x459b('0x1'),'required':![]}};exports['reload']={'module':{'type':_0x459b('0x1'),'required':![]}};exports[_0x459b('0x6')]={'uniqueid':{'type':_0x459b('0x1'),'required':!![]}};exports['voicechannel']={'uniqueid':{'type':_0x459b('0x1'),'required':!![]},'filename':{'type':'string'},'format':{'type':'string'},'mixmonitorid':{'type':_0x459b('0x1')}};exports[_0x459b('0x7')]={'uniqueid':{'type':_0x459b('0x1'),'required':!![]}};exports[_0x459b('0x8')]={'uniqueid':{'type':_0x459b('0x1'),'required':!![]},'exten':{'type':_0x459b('0x1'),'required':!![]},'context':{'type':_0x459b('0x1')}}; \ No newline at end of file diff --git a/server/services/ami/realtime/index.js b/server/services/ami/realtime/index.js index 376865f..b9814d9 100644 --- a/server/services/ami/realtime/index.js +++ b/server/services/ami/realtime/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2032=['voiceExtensions','initCampaignHopperHistory','merge','initFaxAccounts','exports','moment','util','../model/agent','../model/trunk','../model/voiceQueue','../model/template','../model/campaign','../model/voiceExtension','../model/zendeskAccount','../model/salesforceAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/faxAccount','telephones','trunks','voiceQueues','campaigns','outbound','channels','queueChannels','sugarcrmAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','faxAccounts','mapKeys','format','SIP/%s','name','hasOwnProperty','interface','total','answered','sumHoldTime','sumDuration','sumBillable','ivrTotalCallsDays','isEmpty','unmanaged','abandoned','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundRejectCallsDay','outboundReCallsDay','queueStatusComplete','prototype','length','isNil','isUndefined','agents','initTelephones','initTrunks','mergeFromDatabase','initTriggers','triggers','initTemplates','templates','initZendeskAccounts','zendeskAccounts','initSalesforceAccounts','salesforceAccounts','initFreshdeskAccounts','freshdeskAccounts','initZohoAccounts','zohoAccounts','initDeskAccounts','initVtigerAccounts','initServicenowAccounts','initDynamics365Accounts','initFreshsalesAccounts','initVoiceQueueHopperHistory','initVoiceQueueReports','queue','queuecallerexit','queuecallerabandon','queuecallerleaveAt','diff','queuecallerjoinAt','seconds','queuecallercompleteAt','queuecallerexitAt','queuecallercomplete','initVoiceCallReports','duration','ANSWERED','billableseconds','initCampaigns','dialQueueProject','SquareProject'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x2032,0xd9));var _0x2203=function(_0x5bd9b8,_0x26a8a4){_0x5bd9b8=_0x5bd9b8-0x0;var _0x472100=_0x2032[_0x5bd9b8];return _0x472100;};'use strict';var _=require('lodash');var moment=require(_0x2203('0x0'));var util=require(_0x2203('0x1'));var Agent=require(_0x2203('0x2'));var Telephone=require('../model/telephone');var Trunk=require(_0x2203('0x3'));var VoiceQueue=require(_0x2203('0x4'));var Trigger=require('../model/trigger');var Template=require(_0x2203('0x5'));var Campaign=require(_0x2203('0x6'));var VoiceExtension=require(_0x2203('0x7'));var ZendeskAccount=require(_0x2203('0x8'));var SalesforceAccount=require(_0x2203('0x9'));var FreshdeskAccount=require(_0x2203('0xa'));var SugarcrmAccount=require(_0x2203('0xb'));var ZohoAccount=require(_0x2203('0xc'));var DeskAccount=require(_0x2203('0xd'));var VtigerAccount=require(_0x2203('0xe'));var ServicenowAccount=require(_0x2203('0xf'));var Dynamics365Account=require('../model/dynamics365Account');var FreshsalesAccount=require('../model/freshsalesAccount');var FaxAccount=require(_0x2203('0x10'));function Realtime(){this['agents']={};this[_0x2203('0x11')]={};this[_0x2203('0x12')]={};this[_0x2203('0x13')]={};this['triggers']={};this[_0x2203('0x14')]={};this['templates']={};this[_0x2203('0x15')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this['voiceExtensions']={};this[_0x2203('0x16')]={};this[_0x2203('0x17')]={};this['outboundChannels']={};this['timers']={};this['settings']={};this['zendeskAccounts']={};this['salesforceAccounts']={};this[_0x2203('0x18')]={};this['freshdeskAccounts']={};this['zohoAccounts']={};this[_0x2203('0x19')]={};this[_0x2203('0x1a')]={};this[_0x2203('0x1b')]={};this[_0x2203('0x1c')]={};this[_0x2203('0x1d')]={};this[_0x2203('0x1e')]={};}function freeIsNotKey(_0x2c36e6,_0x2c085c,_0xdf9d0b){var _0x3053f3=_['mapKeys'](_0x2c36e6,function(_0x280eda){return _0x280eda[_0xdf9d0b];});for(var _0x2ee127 in _0x2c085c){if(_0x2c085c['hasOwnProperty'](_0x2ee127)){if(!_0x3053f3[_0x2ee127]){delete _0x2c085c[_0x2ee127];}}}}function freeIsNotKeySip(_0x3f9ef6,_0x8906e1){var _0x4aeb9f=_[_0x2203('0x1f')](_0x3f9ef6,function(_0x5ee83c){return util[_0x2203('0x20')](_0x2203('0x21'),_0x5ee83c[_0x2203('0x22')]);});for(var _0x3b4034 in _0x8906e1){if(_0x8906e1[_0x2203('0x23')](_0x3b4034)){if(!_0x4aeb9f[_0x3b4034]){delete _0x8906e1[_0x3b4034];}}}}function freeIsNotKeyAgent(_0x449039,_0x538c23){var _0x13d3f7=_['mapKeys'](_0x449039,function(_0x5ac866){var _0x15f543=_['isNil'](_0x5ac866[_0x2203('0x24')])?util[_0x2203('0x20')]('SIP/%s',_0x5ac866[_0x2203('0x22')]):_0x5ac866['interface'];return _0x15f543;});for(var _0x5c8da9 in _0x538c23){if(_0x538c23[_0x2203('0x23')](_0x5c8da9)){if(!_0x13d3f7[_0x5c8da9]){delete _0x538c23[_0x5c8da9];}}}}function clearVoiceCallReports(_0x2718f5){_0x2718f5[_0x2203('0x25')]=0x0;_0x2718f5[_0x2203('0x26')]=0x0;_0x2718f5[_0x2203('0x27')]=0x0;_0x2718f5[_0x2203('0x28')]=0x0;_0x2718f5[_0x2203('0x29')]=0x0;}function clearCampaigns(_0x250349){if(!_['isEmpty'](_0x250349)){for(var _0x143f41 in _0x250349){if(_0x250349[_0x2203('0x23')](_0x143f41)){_0x250349[_0x143f41][_0x2203('0x2a')]=0x0;_0x250349[_0x143f41]['ivrAnswerCallsDay']=0x0;}}}}function clearVoiceQueues(_0xb2071b){if(!_[_0x2203('0x2b')](_0xb2071b)){for(var _0x5c5fd3 in _0xb2071b){if(_0xb2071b[_0x2203('0x23')](_0x5c5fd3)){_0xb2071b[_0x5c5fd3][_0x2203('0x25')]=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x26')]=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x2c')]=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x2d')]=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x27')]=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x28')]=0x0;_0xb2071b[_0x5c5fd3]['sumBillable']=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x2e')]=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x2f')]=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x30')]=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x31')]=0x0;_0xb2071b[_0x5c5fd3]['outboundNoSuchCallsDay']=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x32')]=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x33')]=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x34')]=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x35')]=0x0;_0xb2071b[_0x5c5fd3]['outboundOriginateFailureCallsDay']=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x36')]=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x37')]=0x0;_0xb2071b[_0x5c5fd3]['outboundAnswerAgiCallsDay']=0x0;_0xb2071b[_0x5c5fd3]['outboundAnswerCallsDay']=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x38')]=!![];}}}}Realtime['prototype']['mergeFromDatabase']=function(_0x125dfc,_0x464c88){for(var _0x191894 in _0x464c88){if(_0x125dfc[_0x2203('0x23')](_0x191894)){_0x125dfc[_0x191894]=_0x464c88[_0x191894];}}};Realtime[_0x2203('0x39')]['initAgents']=function(){var _0xb22e28=this;return function(_0x2324c0){if(_0x2324c0){freeIsNotKeyAgent(_0x2324c0,_0xb22e28['agents']);for(var _0x2a2ee7=0x0,_0x20fbe1={};_0x2a2ee7<_0x2324c0[_0x2203('0x3a')];_0x2a2ee7+=0x1){_0x20fbe1=_0x2324c0[_0x2a2ee7];var _0x4187b4=_[_0x2203('0x3b')](_0x20fbe1[_0x2203('0x24')])?util[_0x2203('0x20')](_0x2203('0x21'),_0x20fbe1[_0x2203('0x22')]):_0x20fbe1['interface'];if(_[_0x2203('0x3c')](_0xb22e28[_0x2203('0x3d')][_0x4187b4])){_0xb22e28['agents'][_0x4187b4]=new Agent(_0x20fbe1);}else{_0xb22e28['mergeFromDatabase'](_0xb22e28[_0x2203('0x3d')][_0x4187b4],_0x20fbe1);}}}return _0xb22e28['agents'];};};Realtime[_0x2203('0x39')][_0x2203('0x3e')]=function(){var _0x127ee3=this;return function(_0x5221f0){if(_0x5221f0){freeIsNotKeySip(_0x5221f0,_0x127ee3['telephones']);for(var _0x34cdeb=0x0,_0x47c93a={};_0x34cdeb<_0x5221f0[_0x2203('0x3a')];_0x34cdeb+=0x1){_0x47c93a=_0x5221f0[_0x34cdeb];if(_['isUndefined'](_0x127ee3[_0x2203('0x11')][util['format'](_0x2203('0x21'),_0x47c93a[_0x2203('0x22')])])){_0x127ee3[_0x2203('0x11')][util[_0x2203('0x20')](_0x2203('0x21'),_0x47c93a['name'])]=new Telephone(_0x47c93a);}else{_0x127ee3['mergeFromDatabase'](_0x127ee3['telephones'][util[_0x2203('0x20')](_0x2203('0x21'),_0x47c93a[_0x2203('0x22')])],_0x47c93a);}}}return _0x127ee3[_0x2203('0x11')];};};Realtime[_0x2203('0x39')][_0x2203('0x3f')]=function(){var _0x1c7e3d=this;return function(_0x590b4e){if(_0x590b4e){freeIsNotKeySip(_0x590b4e,_0x1c7e3d[_0x2203('0x12')]);for(var _0x1b12c3=0x0,_0x108fde={};_0x1b12c3<_0x590b4e[_0x2203('0x3a')];_0x1b12c3+=0x1){_0x108fde=_0x590b4e[_0x1b12c3];if(_['isUndefined'](_0x1c7e3d['trunks'][util[_0x2203('0x20')]('SIP/%s',_0x108fde[_0x2203('0x22')])])){_0x1c7e3d[_0x2203('0x12')][util[_0x2203('0x20')]('SIP/%s',_0x108fde['name'])]=new Trunk(_0x108fde);}else{_0x1c7e3d[_0x2203('0x40')](_0x1c7e3d[_0x2203('0x12')][util[_0x2203('0x20')](_0x2203('0x21'),_0x108fde[_0x2203('0x22')])],_0x108fde);}}}return _0x1c7e3d[_0x2203('0x12')];};};Realtime['prototype'][_0x2203('0x41')]=function(){var _0x165a3f=this;return function(_0x3a866c){if(_0x3a866c){freeIsNotKey(_0x3a866c,_0x165a3f[_0x2203('0x42')],'id');for(var _0x16b452=0x0,_0x36b99f={};_0x16b452<_0x3a866c[_0x2203('0x3a')];_0x16b452+=0x1){_0x36b99f=_0x3a866c[_0x16b452];if(_[_0x2203('0x3c')](_0x165a3f[_0x2203('0x42')][_0x36b99f['id']])){_0x165a3f[_0x2203('0x42')][_0x36b99f['id']]=new Trigger(_0x36b99f);}else{_0x165a3f['mergeFromDatabase'](_0x165a3f[_0x2203('0x42')][_0x36b99f['id']],_0x36b99f);}}}return _0x165a3f[_0x2203('0x42')];};};Realtime[_0x2203('0x39')][_0x2203('0x43')]=function(){var _0x4c3259=this;return function(_0x58bd5c){if(_0x58bd5c){freeIsNotKey(_0x58bd5c,_0x4c3259[_0x2203('0x44')],'id');for(var _0x48129c=0x0,_0x273e5f={};_0x48129c<_0x58bd5c[_0x2203('0x3a')];_0x48129c+=0x1){_0x273e5f=_0x58bd5c[_0x48129c];if(_[_0x2203('0x3c')](_0x4c3259[_0x2203('0x44')][_0x273e5f['id']])){_0x4c3259['templates'][_0x273e5f['id']]=new Template(_0x273e5f);}else{_0x4c3259[_0x2203('0x40')](_0x4c3259[_0x2203('0x44')][_0x273e5f['id']],_0x273e5f);}}}return _0x4c3259['templates'];};};Realtime[_0x2203('0x39')][_0x2203('0x45')]=function(){var _0x35b2e9=this;return function(_0x2600a9){if(_0x2600a9){freeIsNotKey(_0x2600a9,_0x35b2e9['zendeskAccounts'],'id');for(var _0x4c1a29=0x0,_0x21b8ab={};_0x4c1a29<_0x2600a9['length'];_0x4c1a29+=0x1){_0x21b8ab=_0x2600a9[_0x4c1a29];if(_['isUndefined'](_0x35b2e9[_0x2203('0x46')][_0x21b8ab['id']])){_0x35b2e9[_0x2203('0x46')][_0x21b8ab['id']]=new ZendeskAccount(_0x21b8ab);}else{_0x35b2e9[_0x2203('0x40')](_0x35b2e9['zendeskAccounts'][_0x21b8ab['id']],_0x21b8ab);}}}return _0x35b2e9['zendeskAccounts'];};};Realtime[_0x2203('0x39')][_0x2203('0x47')]=function(){var _0x12d7fa=this;return function(_0x21d2d7){if(_0x21d2d7){freeIsNotKey(_0x21d2d7,_0x12d7fa[_0x2203('0x48')],'id');for(var _0x21fd78=0x0,_0x4a7f4e={};_0x21fd78<_0x21d2d7[_0x2203('0x3a')];_0x21fd78+=0x1){_0x4a7f4e=_0x21d2d7[_0x21fd78];if(_['isUndefined'](_0x12d7fa[_0x2203('0x48')][_0x4a7f4e['id']])){_0x12d7fa[_0x2203('0x48')][_0x4a7f4e['id']]=new SalesforceAccount(_0x4a7f4e);}else{_0x12d7fa[_0x2203('0x40')](_0x12d7fa[_0x2203('0x48')][_0x4a7f4e['id']],_0x4a7f4e);}}}return _0x12d7fa['salesforceAccounts'];};};Realtime['prototype'][_0x2203('0x49')]=function(){var _0x1f772d=this;return function(_0x126aad){if(_0x126aad){freeIsNotKey(_0x126aad,_0x1f772d[_0x2203('0x4a')],'id');for(var _0x559370=0x0,_0x4de47a={};_0x559370<_0x126aad['length'];_0x559370+=0x1){_0x4de47a=_0x126aad[_0x559370];if(_[_0x2203('0x3c')](_0x1f772d[_0x2203('0x4a')][_0x4de47a['id']])){_0x1f772d['freshdeskAccounts'][_0x4de47a['id']]=new FreshdeskAccount(_0x4de47a);}else{_0x1f772d[_0x2203('0x40')](_0x1f772d[_0x2203('0x4a')][_0x4de47a['id']],_0x4de47a);}}}return _0x1f772d['freshdeskAccounts'];};};Realtime[_0x2203('0x39')][_0x2203('0x4b')]=function(){var _0x172c6a=this;return function(_0x6a1877){if(_0x6a1877){freeIsNotKey(_0x6a1877,_0x172c6a['zohoAccounts'],'id');for(var _0x120db1=0x0,_0x5268d6={};_0x120db1<_0x6a1877[_0x2203('0x3a')];_0x120db1+=0x1){_0x5268d6=_0x6a1877[_0x120db1];if(_[_0x2203('0x3c')](_0x172c6a['zohoAccounts'][_0x5268d6['id']])){_0x172c6a[_0x2203('0x4c')][_0x5268d6['id']]=new ZohoAccount(_0x5268d6);}else{_0x172c6a[_0x2203('0x40')](_0x172c6a[_0x2203('0x4c')][_0x5268d6['id']],_0x5268d6);}}}return _0x172c6a[_0x2203('0x4c')];};};Realtime[_0x2203('0x39')][_0x2203('0x4d')]=function(){var _0x569d4a=this;return function(_0x562a3d){if(_0x562a3d){freeIsNotKey(_0x562a3d,_0x569d4a[_0x2203('0x19')],'id');for(var _0x524356=0x0,_0x56e881={};_0x524356<_0x562a3d[_0x2203('0x3a')];_0x524356+=0x1){_0x56e881=_0x562a3d[_0x524356];if(_[_0x2203('0x3c')](_0x569d4a[_0x2203('0x19')][_0x56e881['id']])){_0x569d4a['deskAccounts'][_0x56e881['id']]=new DeskAccount(_0x56e881);}else{_0x569d4a[_0x2203('0x40')](_0x569d4a['deskAccounts'][_0x56e881['id']],_0x56e881);}}}return _0x569d4a['deskAccounts'];};};Realtime[_0x2203('0x39')]['initSugarcrmAccounts']=function(){var _0x54ec71=this;return function(_0x5efc59){if(_0x5efc59){freeIsNotKey(_0x5efc59,_0x54ec71[_0x2203('0x18')],'id');for(var _0x31256b=0x0,_0x367122={};_0x31256b<_0x5efc59[_0x2203('0x3a')];_0x31256b+=0x1){_0x367122=_0x5efc59[_0x31256b];if(_[_0x2203('0x3c')](_0x54ec71[_0x2203('0x18')][_0x367122['id']])){_0x54ec71[_0x2203('0x18')][_0x367122['id']]=new SugarcrmAccount(_0x367122);}else{_0x54ec71[_0x2203('0x40')](_0x54ec71[_0x2203('0x18')][_0x367122['id']],_0x367122);}}}return _0x54ec71[_0x2203('0x18')];};};Realtime[_0x2203('0x39')][_0x2203('0x4e')]=function(){var _0x58ff57=this;return function(_0x585bde){if(_0x585bde){freeIsNotKey(_0x585bde,_0x58ff57[_0x2203('0x1a')],'id');for(var _0x43d8c0=0x0,_0x2511bd={};_0x43d8c0<_0x585bde[_0x2203('0x3a')];_0x43d8c0+=0x1){_0x2511bd=_0x585bde[_0x43d8c0];if(_[_0x2203('0x3c')](_0x58ff57[_0x2203('0x1a')][_0x2511bd['id']])){_0x58ff57['vtigerAccounts'][_0x2511bd['id']]=new VtigerAccount(_0x2511bd);}else{_0x58ff57['mergeFromDatabase'](_0x58ff57[_0x2203('0x1a')][_0x2511bd['id']],_0x2511bd);}}}return _0x58ff57[_0x2203('0x1a')];};};Realtime[_0x2203('0x39')][_0x2203('0x4f')]=function(){var _0xcab922=this;return function(_0x7b0b9c){if(_0x7b0b9c){freeIsNotKey(_0x7b0b9c,_0xcab922[_0x2203('0x1b')],'id');for(var _0x191b67=0x0,_0x2c6bcc={};_0x191b67<_0x7b0b9c[_0x2203('0x3a')];_0x191b67+=0x1){_0x2c6bcc=_0x7b0b9c[_0x191b67];if(_[_0x2203('0x3c')](_0xcab922['servicenowAccounts'][_0x2c6bcc['id']])){_0xcab922[_0x2203('0x1b')][_0x2c6bcc['id']]=new ServicenowAccount(_0x2c6bcc);}else{_0xcab922[_0x2203('0x40')](_0xcab922[_0x2203('0x1b')][_0x2c6bcc['id']],_0x2c6bcc);}}}return _0xcab922[_0x2203('0x1b')];};};Realtime[_0x2203('0x39')][_0x2203('0x50')]=function(){var _0x52c159=this;return function(_0x544756){if(_0x544756){freeIsNotKey(_0x544756,_0x52c159[_0x2203('0x1c')],'id');for(var _0x35b7b9=0x0,_0x49e795={};_0x35b7b9<_0x544756[_0x2203('0x3a')];_0x35b7b9+=0x1){_0x49e795=_0x544756[_0x35b7b9];if(_[_0x2203('0x3c')](_0x52c159[_0x2203('0x1c')][_0x49e795['id']])){_0x52c159[_0x2203('0x1c')][_0x49e795['id']]=new Dynamics365Account(_0x49e795);}else{_0x52c159[_0x2203('0x40')](_0x52c159[_0x2203('0x1c')][_0x49e795['id']],_0x49e795);}}}return _0x52c159[_0x2203('0x1c')];};};Realtime[_0x2203('0x39')][_0x2203('0x51')]=function(){var _0x519120=this;return function(_0x468619){if(_0x468619){freeIsNotKey(_0x468619,_0x519120[_0x2203('0x1d')],'id');for(var _0x465898=0x0,_0x4e461e={};_0x465898<_0x468619[_0x2203('0x3a')];_0x465898+=0x1){_0x4e461e=_0x468619[_0x465898];if(_[_0x2203('0x3c')](_0x519120[_0x2203('0x1d')][_0x4e461e['id']])){_0x519120[_0x2203('0x1d')][_0x4e461e['id']]=new FreshsalesAccount(_0x4e461e);}else{_0x519120[_0x2203('0x40')](_0x519120['freshsalesAccounts'][_0x4e461e['id']],_0x4e461e);}}}return _0x519120[_0x2203('0x1d')];};};Realtime[_0x2203('0x39')][_0x2203('0x52')]=function(){var _0x4dde80=this;return function(_0x5507b6){for(var _0x5d9ae2=0x0;_0x5d9ae2<_0x5507b6['length'];_0x5d9ae2+=0x1){_['merge'](_0x4dde80[_0x2203('0x13')][_0x5507b6[_0x5d9ae2][_0x2203('0x22')]],_0x5507b6[_0x5d9ae2]);}return _0x4dde80[_0x2203('0x13')];};};Realtime[_0x2203('0x39')][_0x2203('0x53')]=function(){var _0x169845=this;return function(_0x3f7926){clearVoiceQueues(_0x169845[_0x2203('0x13')]);if(_0x3f7926){_0x3f7926=_['groupBy'](_0x3f7926,'uniqueid');for(var _0xb54e51 in _0x3f7926){if(_0x3f7926[_0x2203('0x23')](_0xb54e51)){for(var _0xafcc82=0x0;_0xafcc82<_0x3f7926[_0xb54e51][_0x2203('0x3a')];_0xafcc82+=0x1){var _0x1bbd2d=_0x3f7926[_0xb54e51][_0xafcc82][_0x2203('0x54')];if(_0x169845[_0x2203('0x13')][_0x1bbd2d]){if(_0x3f7926[_0xb54e51][_0xafcc82][_0x2203('0x55')]){_0x169845[_0x2203('0x13')][_0x1bbd2d][_0x2203('0x2c')]+=0x1;}if(_0x3f7926[_0xb54e51][_0xafcc82][_0x2203('0x56')]){_0x169845[_0x2203('0x13')][_0x1bbd2d][_0x2203('0x2d')]+=0x1;}_0x169845[_0x2203('0x13')][_0x1bbd2d][_0x2203('0x27')]+=moment(_0x3f7926[_0xb54e51][_0xafcc82][_0x2203('0x57')])[_0x2203('0x58')](moment(_0x3f7926[_0xb54e51][_0xafcc82][_0x2203('0x59')]),_0x2203('0x5a'))||0x0;if(_0xafcc82===_0x3f7926[_0xb54e51]['length']-0x1){_0x169845[_0x2203('0x13')][_0x1bbd2d]['sumDuration']+=moment(_0x3f7926[_0xb54e51][_0xafcc82][_0x2203('0x5b')]||_0x3f7926[_0xb54e51][_0xafcc82]['queuecallerabandonAt']||_0x3f7926[_0xb54e51][_0xafcc82][_0x2203('0x5c')])[_0x2203('0x58')](moment(_0x3f7926[_0xb54e51][_0xafcc82][_0x2203('0x59')]),_0x2203('0x5a'))||0x0;_0x169845[_0x2203('0x13')][_0x1bbd2d][_0x2203('0x25')]+=0x1;if(_0x3f7926[_0xb54e51][_0xafcc82][_0x2203('0x5d')]){_0x169845[_0x2203('0x13')][_0x1bbd2d]['answered']+=0x1;_0x169845['voiceQueues'][_0x1bbd2d][_0x2203('0x29')]+=moment(_0x3f7926[_0xb54e51][_0xafcc82][_0x2203('0x5b')])[_0x2203('0x58')](moment(_0x3f7926[_0xb54e51][_0xafcc82]['queuecallerleaveAt']),'seconds')||0x0;}}else{_0x169845['voiceQueues'][_0x1bbd2d][_0x2203('0x28')]+=_0x169845[_0x2203('0x13')][_0x1bbd2d][_0x2203('0x27')]||0x0;}}}}}}return _0x169845[_0x2203('0x13')];};};Realtime['prototype'][_0x2203('0x5e')]=function(){var _0x47a2c7=this;return function(_0x48bd5){clearVoiceCallReports(_0x47a2c7[_0x2203('0x15')]);if(_0x48bd5){for(var _0xe3bee5=0x0;_0xe3bee5<_0x48bd5[_0x2203('0x3a')];_0xe3bee5+=0x1){_0x47a2c7[_0x2203('0x15')]['total']+=0x1;_0x47a2c7[_0x2203('0x15')][_0x2203('0x28')]+=_0x48bd5[_0xe3bee5][_0x2203('0x5f')];if(_0x48bd5[_0xe3bee5]['disposition']===_0x2203('0x60')){_0x47a2c7[_0x2203('0x15')][_0x2203('0x26')]+=0x1;_0x47a2c7[_0x2203('0x15')][_0x2203('0x27')]+=_0x48bd5[_0xe3bee5][_0x2203('0x5f')]-_0x48bd5[_0xe3bee5][_0x2203('0x61')]||0x0;_0x47a2c7[_0x2203('0x15')][_0x2203('0x29')]+=_0x48bd5[_0xe3bee5][_0x2203('0x61')];}}}return _0x47a2c7[_0x2203('0x15')];};};Realtime['prototype'][_0x2203('0x62')]=function(){var _0x7f71b8=this;return function(_0x21b755){if(_0x21b755){freeIsNotKey(_0x21b755,_0x7f71b8[_0x2203('0x14')],_0x2203('0x22'));for(var _0x52c35e=0x0,_0x23f7b1={};_0x52c35e<_0x21b755[_0x2203('0x3a')];_0x52c35e+=0x1){_0x23f7b1=_0x21b755[_0x52c35e];if(_[_0x2203('0x3c')](_0x7f71b8[_0x2203('0x14')][_0x23f7b1[_0x2203('0x22')]])){_0x7f71b8[_0x2203('0x14')][_0x23f7b1['name']]=new Campaign(_0x23f7b1);}else{_0x7f71b8['mergeFromDatabase'](_0x7f71b8[_0x2203('0x14')][_0x23f7b1[_0x2203('0x22')]],_0x23f7b1);_0x7f71b8[_0x2203('0x14')][_0x23f7b1[_0x2203('0x22')]][_0x2203('0x63')]=_0x23f7b1['SquareProject']?_0x23f7b1[_0x2203('0x64')][_0x2203('0x22')]:undefined;}}}return _0x7f71b8['campaigns'];};};Realtime['prototype']['initVoiceExtensions']=function(){var _0x4fc51a=this;return function(_0x5e07d7){if(_0x5e07d7){freeIsNotKey(_0x5e07d7,_0x4fc51a[_0x2203('0x65')],'id');for(var _0x6319a3=0x0,_0x437095={};_0x6319a3<_0x5e07d7['length'];_0x6319a3+=0x1){_0x437095=_0x5e07d7[_0x6319a3];if(_['isUndefined'](_0x4fc51a['voiceExtensions'][_0x437095['id']])){_0x4fc51a[_0x2203('0x65')][_0x437095['id']]=new VoiceExtension(_0x437095);}else{_0x4fc51a[_0x2203('0x40')](_0x4fc51a[_0x2203('0x65')][_0x437095['id']],_0x437095);}}}return _0x4fc51a[_0x2203('0x65')];};};Realtime[_0x2203('0x39')][_0x2203('0x66')]=function(){var _0x3d1797=this;return function(_0x52f25e){clearCampaigns(_0x3d1797[_0x2203('0x14')]);for(var _0x74843=0x0;_0x74843<_0x52f25e[_0x2203('0x3a')];_0x74843+=0x1){_[_0x2203('0x67')](_0x3d1797[_0x2203('0x14')][_0x52f25e[_0x74843][_0x2203('0x22')]],_0x52f25e[_0x74843]);}return _0x3d1797[_0x2203('0x14')];};};Realtime['prototype'][_0x2203('0x68')]=function(){var _0x51a2fe=this;return function(_0x5d0176){if(_0x5d0176){freeIsNotKey(_0x5d0176,_0x51a2fe[_0x2203('0x1e')],'id');for(var _0x5cd030=0x0,_0xb9588e={};_0x5cd030<_0x5d0176[_0x2203('0x3a')];_0x5cd030+=0x1){_0xb9588e=_0x5d0176[_0x5cd030];if(_['isUndefined'](_0x51a2fe[_0x2203('0x1e')][_0xb9588e['id']])){_0x51a2fe[_0x2203('0x1e')][_0xb9588e['id']]=new FaxAccount(_0xb9588e);}else{_0x51a2fe[_0x2203('0x40')](_0x51a2fe[_0x2203('0x1e')][_0xb9588e['id']],_0xb9588e);}}}return _0x51a2fe[_0x2203('0x1e')];};};Realtime[_0x2203('0x39')]['initVoiceQueues']=function(){var _0x215638=this;return function(_0x3541b3){if(_0x3541b3){freeIsNotKey(_0x3541b3,_0x215638['voiceQueues'],'name');for(var _0x377176=0x0,_0x3fe71b={};_0x377176<_0x3541b3[_0x2203('0x3a')];_0x377176+=0x1){_0x3fe71b=_0x3541b3[_0x377176];if(_[_0x2203('0x3c')](_0x215638[_0x2203('0x13')][_0x3fe71b[_0x2203('0x22')]])){_0x215638[_0x2203('0x13')][_0x3fe71b[_0x2203('0x22')]]=new VoiceQueue(_0x3fe71b);}else{_0x215638[_0x2203('0x40')](_0x215638[_0x2203('0x13')][_0x3fe71b[_0x2203('0x22')]],_0x3fe71b);}}}return _0x215638[_0x2203('0x13')];};};module[_0x2203('0x69')]=Realtime; \ No newline at end of file +var _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(_0x178eea,_0x18ab57){var _0x540165=function(_0x1d8f9f){while(--_0x1d8f9f){_0x178eea['push'](_0x178eea['shift']());}};_0x540165(++_0x18ab57);}(_0xadb5,0xad));var _0x5adb=function(_0x5276a8,_0x47527e){_0x5276a8=_0x5276a8-0x0;var _0x4229e0=_0xadb5[_0x5276a8];return _0x4229e0;};'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 ff91f86..9435796 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 _0x23fd=['mergeDBDataToRealtime'];(function(_0x2d058a,_0x18f217){var _0x220d8f=function(_0x3523d9){while(--_0x3523d9){_0x2d058a['push'](_0x2d058a['shift']());}};_0x220d8f(++_0x18f217);}(_0x23fd,0x7a));var _0xd23f=function(_0x4da3a6,_0x3c67c3){_0x4da3a6=_0x4da3a6-0x0;var _0x4fa4b2=_0x23fd[_0x4da3a6];return _0x4fa4b2;};'use strict';function mergeDBDataToRealtime(_0xd8b28c,_0x54ac82){var _0x9572c3=Object['assign']({},_0xd8b28c);for(var _0x3dc17f in _0x54ac82){if(_0x9572c3['hasOwnProperty'](_0x3dc17f)){_0x9572c3[_0x3dc17f]=_0x54ac82[_0x3dc17f];}}return _0x9572c3;}exports[_0xd23f('0x0')]=mergeDBDataToRealtime; \ No newline at end of file +var _0x757b=['hasOwnProperty','assign'];(function(_0x714d36,_0x187e6c){var _0x2c405f=function(_0x3b2d6a){while(--_0x3b2d6a){_0x714d36['push'](_0x714d36['shift']());}};_0x2c405f(++_0x187e6c);}(_0x757b,0x10b));var _0xb757=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x757b[_0x3dd15e];return _0x231fd0;};'use strict';function mergeDBDataToRealtime(_0xc0155,_0xc643be){var _0x1cc803=Object[_0xb757('0x0')]({},_0xc0155);for(var _0x4c7615 in _0xc643be){if(_0x1cc803[_0xb757('0x1')](_0x4c7615)){_0x1cc803[_0x4c7615]=_0xc643be[_0x4c7615];}}return _0x1cc803;}exports['mergeDBDataToRealtime']=mergeDBDataToRealtime; \ No newline at end of file diff --git a/server/services/ami/report/index.js b/server/services/ami/report/index.js index 030c302..d823fec 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 _0x83f8=['forEach','Local','substring','indexOf','mobile','phone','lastIndexOf','findAgent','transfererlinkedid','lodash','../../../config/environment','../ami','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceCallReport','./voiceAgentReport','./voiceDialReport','./userReport','realtime','agents','sync','xdr','disabled','custom:voiceQueueReport','custom:voiceCallReport','voiceCallReport','bind','custom:voiceAgentReport','voiceAgentReport','custom:voiceDialReport','voiceDialReport','blindtransfer','blindTransfer','attendedtransfer','attendedTransfer','prototype','find','accountcode','telephones','interface','format','SIP/%s','voiceQueueReport','connectedlinenum','name','queuecallercomplete','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','queuecallerexitAt','create','getAgentByInternal','keys','length','getCallType','channel','split','calleridnum','destination','dialer','lastapplication','queue','lastdata','context','from-voip-provider','callerid','from-sip','xcally-motion-preview','calleridpreview','originatecalleridnum','destinationchannel','disposition','ANSWERED','\x22%s\x22\x20<%s>','calleridname','transfers','linkedid','transfereelinkedid','uniqueid','isNil','type','UserId','membername','monitor','monitors','filename','createdAt','connectedlinename','exten','isArray'];(function(_0x497a85,_0x2bd7cf){var _0x33207e=function(_0x56e9ec){while(--_0x56e9ec){_0x497a85['push'](_0x497a85['shift']());}};_0x33207e(++_0x2bd7cf);}(_0x83f8,0x1df));var _0x883f=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x83f8[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x883f('0x0'));var moment=require('moment');var util=require('util');var config=require(_0x883f('0x1'));var ami=require(_0x883f('0x2'));var RpcVoiceAgentReport=require(_0x883f('0x3'));var RpcVoiceCallReport=require(_0x883f('0x4'));var RpcVoiceDialReport=require(_0x883f('0x5'));var RpcMemberReport=require(_0x883f('0x6'));var RpcVoiceQueueReport=require(_0x883f('0x7'));var RpcVoiceRecording=require(_0x883f('0x8'));var RpcVoiceTransferReport=require(_0x883f('0x9'));var VoiceQueueReport=require('./voiceQueueReport');var VoiceCallReport=require(_0x883f('0xa'));var VoiceAgentReport=require(_0x883f('0xb'));var VoiceDialReport=require(_0x883f('0xc'));var UserReport=require(_0x883f('0xd'));function Report(_0x40b47a){this[_0x883f('0xe')]=_0x40b47a;this[_0x883f('0xf')]=_0x40b47a[_0x883f('0xf')];this['telephones']=_0x40b47a['telephones'];}Report['prototype'][_0x883f('0x10')]=function(_0x5d299d){var _0x201ded=new VoiceQueueReport(this[_0x883f('0xe')]);var _0x5d109e=new VoiceAgentReport(this[_0x883f('0xe')]);var _0x11f08c=new VoiceDialReport(this[_0x883f('0xe')]);var _0x693d8=new VoiceCallReport(this[_0x883f('0xe')]);var _0x484c7a=new UserReport(this['realtime']);if(config[_0x883f('0x11')]&&config['xdr'][_0x883f('0x12')]){ami['on'](_0x883f('0x13'),this['voiceQueueReport']['bind'](this));ami['on'](_0x883f('0x14'),this[_0x883f('0x15')][_0x883f('0x16')](this));ami['on'](_0x883f('0x17'),this[_0x883f('0x18')][_0x883f('0x16')](this));ami['on'](_0x883f('0x19'),this[_0x883f('0x1a')][_0x883f('0x16')](this));ami['on'](_0x883f('0x1b'),this[_0x883f('0x1c')]['bind'](this));ami['on'](_0x883f('0x1d'),this[_0x883f('0x1e')]['bind'](this));}};Report[_0x883f('0x1f')]['findAgent']=function(_0x2198ae){var _0x9578e8;_0x9578e8=_[_0x883f('0x20')](this[_0x883f('0xf')],function(_0x184dc4){return _0x184dc4[_0x883f('0x21')]==_0x2198ae||_0x184dc4['name']==_0x2198ae;});if(_['isNil'](_0x9578e8)){var _0x180355=_[_0x883f('0x20')](this[_0x883f('0x22')],function(_0x52b24b){return _0x52b24b['accountcode']==_0x2198ae||_0x52b24b['name']==_0x2198ae;});if(_0x180355){_0x9578e8=_[_0x883f('0x20')](this[_0x883f('0xf')],function(_0x204ee2){return _0x204ee2[_0x883f('0x23')]==util[_0x883f('0x24')](_0x883f('0x25'),_0x180355['name']);});}}return _0x9578e8;};Report['prototype'][_0x883f('0x26')]=function(_0x26e615){for(var _0x32dc43=0x0;_0x32dc43<_0x26e615['length'];_0x32dc43+=0x1){var _0x1a06ac=this['findAgent'](_0x26e615[_0x32dc43][_0x883f('0x27')]);if(_0x1a06ac){_0x26e615[_0x32dc43][_0x883f('0x21')]=_0x1a06ac[_0x883f('0x21')];_0x26e615[_0x32dc43]['assigned']=!![];_0x26e615[_0x32dc43]['lastAssignedTo']=_0x1a06ac[_0x883f('0x28')];_0x26e615[_0x32dc43]['interface']=_['isNil'](_0x1a06ac[_0x883f('0x23')])?util[_0x883f('0x24')](_0x883f('0x25'),_0x1a06ac[_0x883f('0x28')]):_0x1a06ac[_0x883f('0x23')];if(_0x26e615[_0x32dc43][_0x883f('0x29')]){_0x26e615[_0x32dc43]['queuecallercompleteAt']=moment()[_0x883f('0x24')](_0x883f('0x2a'));}if(_0x26e615[_0x32dc43][_0x883f('0x2b')]){_0x26e615[_0x32dc43][_0x883f('0x2c')]=moment()[_0x883f('0x24')](_0x883f('0x2a'));}RpcMemberReport[_0x883f('0x26')](_0x26e615[_0x32dc43]);}RpcVoiceQueueReport[_0x883f('0x2d')](_0x26e615[_0x32dc43]);}};function extractCalleridNumber(_0x4f8492){var _0x179d8c=_0x4f8492['match'](/<(.*?)>/);return _0x179d8c?_0x179d8c[0x1]:_0x4f8492;}Report[_0x883f('0x1f')][_0x883f('0x2e')]=function(_0x24ba5b){for(var _0x5cb9aa=0x0;_0x5cb9aa','transfers','linkedid','transfereelinkedid','UserId','membername','monitor','monitors','monitorFilename','filename','createdAt','calleridname','connectedlinename','xcally-motion-dialer','isArray','create','startsWith','Local','indexOf','mobile','phone','substring','lastIndexOf','lodash','moment','util','../../../config/environment','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceRecording','../rpc/voiceTransferReport'];(function(_0x3f430a,_0x2ff03b){var _0x102ddc=function(_0x492d72){while(--_0x492d72){_0x3f430a['push'](_0x3f430a['shift']());}};_0x102ddc(++_0x2ff03b);}(_0x291e,0x10c));var _0xe291=function(_0x21d12c,_0xf9e371){_0x21d12c=_0x21d12c-0x0;var _0x5a2ba5=_0x291e[_0x21d12c];return _0x5a2ba5;};'use strict';var _=require(_0xe291('0x0'));var moment=require(_0xe291('0x1'));var util=require(_0xe291('0x2'));var config=require(_0xe291('0x3'));var ami=require('../ami');var RpcVoiceAgentReport=require(_0xe291('0x4'));var RpcVoiceCallReport=require(_0xe291('0x5'));var RpcVoiceDialReport=require(_0xe291('0x6'));var RpcMemberReport=require(_0xe291('0x7'));var RpcVoiceQueueReport=require(_0xe291('0x8'));var RpcVoiceRecording=require(_0xe291('0x9'));var RpcVoiceTransferReport=require(_0xe291('0xa'));var VoiceQueueReport=require(_0xe291('0xb'));var VoiceCallReport=require('./voiceCallReport');var VoiceAgentReport=require(_0xe291('0xc'));var VoiceDialReport=require(_0xe291('0xd'));var UserReport=require('./userReport');function Report(_0x407d37){this[_0xe291('0xe')]=_0x407d37;this[_0xe291('0xf')]=_0x407d37[_0xe291('0xf')];this[_0xe291('0x10')]=_0x407d37['telephones'];}Report[_0xe291('0x11')][_0xe291('0x12')]=function(_0x1edc9d){var _0x442f49=new VoiceQueueReport(this['realtime']);var _0x2d8a63=new VoiceAgentReport(this[_0xe291('0xe')]);var _0x5880dd=new VoiceDialReport(this['realtime']);var _0x1f1c1f=new VoiceCallReport(this['realtime']);var _0x1866df=new UserReport(this[_0xe291('0xe')]);if(config[_0xe291('0x13')]&&config[_0xe291('0x13')][_0xe291('0x14')]){ami['on'](_0xe291('0x15'),this[_0xe291('0x16')][_0xe291('0x17')](this));ami['on'](_0xe291('0x18'),this['voiceCallReport']['bind'](this));ami['on']('custom:voiceAgentReport',this[_0xe291('0x19')]['bind'](this));ami['on'](_0xe291('0x1a'),this[_0xe291('0x1b')]['bind'](this));ami['on'](_0xe291('0x1c'),this[_0xe291('0x1d')][_0xe291('0x17')](this));ami['on'](_0xe291('0x1e'),this[_0xe291('0x1f')][_0xe291('0x17')](this));}};Report[_0xe291('0x11')]['findAgent']=function(_0x4ecbd2){var _0x4ede8c;_0x4ede8c=_['find'](this[_0xe291('0xf')],function(_0x46b442){return _0x46b442[_0xe291('0x20')]==_0x4ecbd2||_0x46b442[_0xe291('0x21')]==_0x4ecbd2;});if(_[_0xe291('0x22')](_0x4ede8c)){var _0x84b8f2=_['find'](this[_0xe291('0x10')],function(_0x318e13){return _0x318e13[_0xe291('0x20')]==_0x4ecbd2||_0x318e13[_0xe291('0x21')]==_0x4ecbd2;});if(_0x84b8f2){_0x4ede8c=_[_0xe291('0x23')](this[_0xe291('0xf')],function(_0x491815){return _0x491815[_0xe291('0x24')]==util[_0xe291('0x25')]('SIP/%s',_0x84b8f2[_0xe291('0x21')]);});}}return _0x4ede8c;};Report[_0xe291('0x11')]['voiceQueueReport']=function(_0x37d57e){for(var _0x5356f9=0x0;_0x5356f9<_0x37d57e[_0xe291('0x26')];_0x5356f9+=0x1){var _0x461d87=this[_0xe291('0x27')](_0x37d57e[_0x5356f9][_0xe291('0x28')]);if(_0x461d87){_0x37d57e[_0x5356f9][_0xe291('0x20')]=_0x461d87['accountcode'];_0x37d57e[_0x5356f9][_0xe291('0x29')]=!![];_0x37d57e[_0x5356f9][_0xe291('0x2a')]=_0x461d87[_0xe291('0x21')];_0x37d57e[_0x5356f9]['interface']=_[_0xe291('0x22')](_0x461d87['interface'])?util[_0xe291('0x25')](_0xe291('0x2b'),_0x461d87['name']):_0x461d87[_0xe291('0x24')];if(_0x37d57e[_0x5356f9][_0xe291('0x2c')]){_0x37d57e[_0x5356f9][_0xe291('0x2d')]=moment()[_0xe291('0x25')](_0xe291('0x2e'));}if(_0x37d57e[_0x5356f9][_0xe291('0x2f')]){_0x37d57e[_0x5356f9][_0xe291('0x30')]=moment()[_0xe291('0x25')](_0xe291('0x2e'));}RpcMemberReport[_0xe291('0x16')](_0x37d57e[_0x5356f9]);}RpcVoiceQueueReport['create'](_0x37d57e[_0x5356f9]);}};function extractCalleridNumber(_0x2083ee){var _0x15c64f=_0x2083ee[_0xe291('0x31')](/<(.*?)>/);return _0x15c64f?_0x15c64f[0x1]:_0x2083ee;}Report['prototype'][_0xe291('0x32')]=function(_0xccf4e9){for(var _0x298590=0x0;_0x2985900x0?!![]:![];if(!_0x43c0a9){return this[_0x1ebb('0x1c')](this[_0x1ebb('0x17')][_0x1ebb('0x6d')]);}};VoiceQueueReport['prototype']['syncQueueMember']=function(_0x2df6c0){var _0x200f75=this[_0x1ebb('0x17')]['id'];if(this[_0x1ebb('0x17')][_0x1ebb('0x6a')][_0x200f75]&&this[_0x1ebb('0x17')][_0x1ebb('0x6a')][_0x200f75][_0x2df6c0[_0x1ebb('0x61')]]){this[_0x1ebb('0x17')][_0x1ebb('0x6a')][_0x200f75][_0x2df6c0[_0x1ebb('0x61')]][_0x1ebb('0x12')][_0x1ebb('0x6e')](_0x2df6c0);}};VoiceQueueReport['prototype'][_0x1ebb('0x6f')]=function(_0x256824){var _0x2d8d3d=this;try{if(this['isNotNull'](_0x256824)&&this[_0x1ebb('0x70')](_0x256824[_0x1ebb('0x4f')])){logger[_0x1ebb('0x51')]('[voiceQueueReport][queuesummary]\x20event:',util[_0x1ebb('0x45')](_0x256824,{'showHidden':![],'depth':null}));var _0x2afae7=this[_0x1ebb('0x15')][_0x256824[_0x1ebb('0x4f')]];if(_0x2afae7){logger[_0x1ebb('0x51')](_0x1ebb('0x71'),_0x2afae7[_0x1ebb('0x5c')]);this[_0x1ebb('0x17')][_0x1ebb('0x5f')][_0x2afae7[_0x1ebb('0x5c')]]={'summaryEvent':_0x256824};this['summary'][_0x1ebb('0x6c')]+=0x1;return ami[_0x1ebb('0x40')]({'action':'queuestatus','queue':_0x2afae7[_0x1ebb('0x5c')]})[_0x1ebb('0x72')](function(_0x123d18){if(!_0x2d8d3d[_0x1ebb('0x17')][_0x1ebb('0x6a')][_0x256824[_0x1ebb('0x61')]]){_0x2d8d3d[_0x1ebb('0x17')][_0x1ebb('0x6a')][_0x256824['actionid']]={};}_0x2d8d3d['summary'][_0x1ebb('0x6a')][_0x256824[_0x1ebb('0x61')]][_0x123d18['actionid']]={'queue':_0x2afae7['name'],'agents':[]};})[_0x1ebb('0x41')](function(_0x3a50e2){throw _0x3a50e2;});}}}catch(_0x2204bb){logger[_0x1ebb('0x44')](_0x1ebb('0x62'),util[_0x1ebb('0x45')](_0x2204bb,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x1ebb('0xc')]['syncQueueSummaryComplete']=function(_0x1f2d2a){if(this['summary'][_0x1ebb('0x6c')]>0x0){this[_0x1ebb('0x17')][_0x1ebb('0x6d')]=_0x1f2d2a;return;}logger['debug'](_0x1ebb('0x73'),util[_0x1ebb('0x45')](_0x1f2d2a,{'showHidden':![],'depth':null}));this['summary']=initializeSummary();ami[_0x1ebb('0x4b')](_0x1ebb('0x74'),{});};VoiceQueueReport[_0x1ebb('0xc')][_0x1ebb('0x20')]=function(_0xf3abc4){try{if(this[_0x1ebb('0x70')](_0xf3abc4)){logger[_0x1ebb('0x51')](_0x1ebb('0x75'),_0xf3abc4[_0x1ebb('0x4d')],util['inspect'](_0xf3abc4,{'showHidden':![],'depth':null}));if(_[_0x1ebb('0x5e')](this[_0x1ebb('0x11')][_0xf3abc4['uniqueid']])){this[_0x1ebb('0x11')][_0xf3abc4[_0x1ebb('0x4d')]]=[];}if(_[_0x1ebb('0x5e')](this[_0x1ebb('0x13')][_0xf3abc4[_0x1ebb('0x4d')]])){this['channels'][_0xf3abc4[_0x1ebb('0x4d')]]={};}var _0x76ed0c=new QueueReport();_0x76ed0c[_0x1ebb('0x4f')]=_0xf3abc4[_0x1ebb('0x4f')];_0x76ed0c[_0x1ebb('0x59')]=this[_0x1ebb('0x15')][_0x76ed0c['queue']]&&this[_0x1ebb('0x15')][_0x76ed0c[_0x1ebb('0x4f')]]['type']?this['voiceQueues'][_0x76ed0c[_0x1ebb('0x4f')]][_0x1ebb('0x59')]||_0x1ebb('0x5a'):_0x1ebb('0x5a');_0x76ed0c[_0x1ebb('0x76')]=moment()[_0x1ebb('0x4e')](_0x1ebb('0x77'));_0x76ed0c[_0x1ebb('0x78')]=_0xf3abc4[_0x1ebb('0x78')];_0x76ed0c[_0x1ebb('0x79')]=_0xf3abc4[_0x1ebb('0x79')];_0x76ed0c[_0x1ebb('0x4d')]=_0xf3abc4[_0x1ebb('0x4d')];_0x76ed0c[_0x1ebb('0x7a')]=this[_0x1ebb('0x13')][_0xf3abc4[_0x1ebb('0x4d')]][_0x1ebb('0x7a')];logger[_0x1ebb('0x7b')](_0x1ebb('0x7c'),_0x76ed0c[_0x1ebb('0x4f')],_0x76ed0c[_0x1ebb('0x59')]);Object[_0x1ebb('0x68')](_0x76ed0c,_[_0x1ebb('0x7d')](_0xf3abc4,_[_0x1ebb('0x7e')](_0x76ed0c)));this['queueReports'][_0xf3abc4[_0x1ebb('0x4d')]]['push'](_0x76ed0c);this['channels'][_0xf3abc4[_0x1ebb('0x4d')]]=_0x76ed0c;this['emitVoiceQueueChannelSave'](_0x76ed0c,_0x1ebb('0x1f'));}}catch(_0x3ceea7){logger[_0x1ebb('0x44')](_0x1ebb('0x75'),_0xf3abc4[_0x1ebb('0x4d')],util[_0x1ebb('0x45')](_0x3ceea7,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x1ebb('0xc')][_0x1ebb('0x22')]=function(_0x41e11b){try{if(this[_0x1ebb('0x70')](_0x41e11b)){logger['debug'](_0x1ebb('0x7f'),_0x41e11b[_0x1ebb('0x4d')],util['inspect'](_0x41e11b,{'showHidden':![],'depth':null}));if(this[_0x1ebb('0x11')][_0x41e11b[_0x1ebb('0x4d')]]){var _0xd71258=_[_0x1ebb('0x80')](this[_0x1ebb('0x11')][_0x41e11b[_0x1ebb('0x4d')]]);_0xd71258[_0x1ebb('0x81')]=![];_0xd71258[_0x1ebb('0x82')]=null;_0xd71258[_0x1ebb('0x83')]=_0x41e11b[_0x1ebb('0x83')];_0xd71258[_0x1ebb('0x84')]=_0x41e11b[_0x1ebb('0x84')];_0xd71258[_0x1ebb('0x21')]=!![];_0xd71258[_0x1ebb('0x85')]=moment()[_0x1ebb('0x4e')](_0x1ebb('0x77'));_0xd71258[_0x1ebb('0x53')]='ABANDONED';_0xd71258['lastAssignedTo']=null;logger[_0x1ebb('0x7b')](_0x1ebb('0x86'),_0xd71258[_0x1ebb('0x4f')],_0xd71258[_0x1ebb('0x59')]);this[_0x1ebb('0x13')][_0x41e11b[_0x1ebb('0x4d')]]=_0xd71258;this[_0x1ebb('0x4a')](_0xd71258,'queuecallerabandon');}}}catch(_0x351db4){logger[_0x1ebb('0x44')](_0x1ebb('0x7f'),_0x41e11b['uniqueid'],util[_0x1ebb('0x45')](_0x351db4,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x1ebb('0xc')][_0x1ebb('0x87')]=function(_0xaf12e5){try{if(this[_0x1ebb('0x70')](_0xaf12e5)){logger[_0x1ebb('0x51')](_0x1ebb('0x88'),_0xaf12e5[_0x1ebb('0x4d')],util[_0x1ebb('0x45')](_0xaf12e5,{'showHidden':![],'depth':null}));if(this[_0x1ebb('0x11')][_0xaf12e5[_0x1ebb('0x4d')]]){var _0x2a262a=_[_0x1ebb('0x80')](this[_0x1ebb('0x11')][_0xaf12e5[_0x1ebb('0x4d')]]);_0x2a262a[_0x1ebb('0x89')]=moment()[_0x1ebb('0x4e')](_0x1ebb('0x77'));_0x2a262a[_0x1ebb('0x8a')]=_0xaf12e5[_0x1ebb('0x8a')];_0x2a262a[_0x1ebb('0x8b')]=_0xaf12e5['connectedlinename'];logger[_0x1ebb('0x7b')](_0x1ebb('0x8c'),_0x2a262a[_0x1ebb('0x4f')],_0x2a262a[_0x1ebb('0x59')],_0xaf12e5['connectedlinenum'],_0xaf12e5['connectedlinename']);this['channels'][_0xaf12e5[_0x1ebb('0x4d')]]=_0x2a262a;this[_0x1ebb('0x8d')](_0x2a262a,'queuecallerleave');}}}catch(_0x19c8b2){logger[_0x1ebb('0x44')](_0x1ebb('0x88'),_0xaf12e5['uniqueid'],util[_0x1ebb('0x45')](_0x19c8b2,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x1ebb('0xc')][_0x1ebb('0x8e')]=function(_0x5280d5){try{if(this[_0x1ebb('0x70')](_0x5280d5)){logger[_0x1ebb('0x51')]('[%s][voiceQueueReport][agentconnect]',_0x5280d5['uniqueid'],util[_0x1ebb('0x45')](_0x5280d5,{'showHidden':![],'depth':null}));if(this[_0x1ebb('0x11')][_0x5280d5[_0x1ebb('0x4d')]]){var _0x5c2053=_[_0x1ebb('0x80')](this[_0x1ebb('0x11')][_0x5280d5[_0x1ebb('0x4d')]]);_0x5c2053[_0x1ebb('0x81')]=!![];_0x5c2053[_0x1ebb('0x53')]=_0x1ebb('0x8f');logger['info'](_0x1ebb('0x90'),_0x5c2053[_0x1ebb('0x4f')],_0x5c2053[_0x1ebb('0x59')]);}}}catch(_0x2ea378){logger[_0x1ebb('0x44')]('[%s][voiceQueueReport][agentconnect]',_0x5280d5[_0x1ebb('0x4d')],util['inspect'](_0x2ea378,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x1ebb('0xc')]['syncAgentComplete']=function(_0x2dee9e){try{if(this[_0x1ebb('0x70')](_0x2dee9e)){logger[_0x1ebb('0x51')](_0x1ebb('0x91'),_0x2dee9e[_0x1ebb('0x4d')],util['inspect'](_0x2dee9e,{'showHidden':![],'depth':null}));if(this[_0x1ebb('0x11')][_0x2dee9e['uniqueid']]){var _0x35d0b4=_[_0x1ebb('0x80')](this[_0x1ebb('0x11')][_0x2dee9e[_0x1ebb('0x4d')]]);_0x35d0b4[_0x1ebb('0x21')]=![];_0x35d0b4[_0x1ebb('0x85')]=null;_0x35d0b4['assigned']=!![];_0x35d0b4['lastAssignedTo']=_0x2dee9e['membername'];_0x35d0b4[_0x1ebb('0x83')]=_0x2dee9e[_0x1ebb('0x83')];_0x35d0b4[_0x1ebb('0x81')]=!![];_0x35d0b4[_0x1ebb('0x3c')]=![];_0x35d0b4[_0x1ebb('0x92')]=null;if(!_0x35d0b4['transfer']){if(_0x2dee9e[_0x1ebb('0x93')]==_0x1ebb('0x94')){_0x35d0b4[_0x1ebb('0x53')]=_0x1ebb('0x95');logger[_0x1ebb('0x7b')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETED',_0x35d0b4['queue'],_0x35d0b4['type']);}else{if(_['startsWith'](_0x2dee9e[_0x1ebb('0x96')][_0x1ebb('0x97')](),_0x1ebb('0x98'))){if(this['queueReports'][_0x2dee9e[_0x1ebb('0x99')]]){var _0x269cf3=_[_0x1ebb('0x80')](this[_0x1ebb('0x11')][_0x2dee9e[_0x1ebb('0x99')]]);_0x269cf3[_0x1ebb('0x81')]=![];_0x269cf3['queuecallerexit']=!![];_0x269cf3[_0x1ebb('0x92')]=moment(_0x35d0b4[_0x1ebb('0x76')])[_0x1ebb('0x9a')](_0x2dee9e[_0x1ebb('0x83')],_0x1ebb('0x9b'))[_0x1ebb('0x4e')]('YYYY-MM-DD\x20HH:mm:ss');_0x269cf3[_0x1ebb('0x53')]=_0x1ebb('0x9c');_0x269cf3[_0x1ebb('0x94')]=!![];_0x269cf3[_0x1ebb('0x9d')]=_0x1ebb('0x9e');_0x269cf3[_0x1ebb('0x9f')]=_0x2dee9e['destexten'];_0x269cf3['transferuniqueid']=_0x2dee9e[_0x1ebb('0x4d')];logger[_0x1ebb('0x7b')](_0x1ebb('0xa0'),_0x269cf3[_0x1ebb('0x4f')],_0x269cf3[_0x1ebb('0x59')]);var _0x216a8b=this[_0x1ebb('0x11')][_0x2dee9e[_0x1ebb('0x99')]];this['queueReports'][_0x2dee9e[_0x1ebb('0x99')]]=this[_0x1ebb('0x11')][_0x2dee9e[_0x1ebb('0x4d')]];this[_0x1ebb('0x11')][_0x2dee9e[_0x1ebb('0x4d')]]=_0x216a8b;}}else{_0x35d0b4[_0x1ebb('0x53')]=_0x1ebb('0xa1')+_0x2dee9e[_0x1ebb('0x93')][_0x1ebb('0xa2')]();logger['info'](_0x1ebb('0xa3'),_0x35d0b4[_0x1ebb('0x4f')],_0x35d0b4['type'],_0x35d0b4[_0x1ebb('0x53')]);}}}this[_0x1ebb('0x13')][_0x2dee9e[_0x1ebb('0x4d')]]=_0x35d0b4;}}}catch(_0x3b52e9){logger[_0x1ebb('0x44')](_0x1ebb('0x91'),_0x2dee9e[_0x1ebb('0x4d')],util[_0x1ebb('0x45')](_0x3b52e9,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x1ebb('0xc')][_0x1ebb('0x26')]=function(_0x18576a){try{if(this['isNotNull'](_0x18576a)){logger['debug'](_0x1ebb('0xa4'),_0x18576a['uniqueid'],util[_0x1ebb('0x45')](_0x18576a,{'showHidden':![],'depth':null}));this[_0x1ebb('0xa5')](_0x18576a[_0x1ebb('0x4d')],_[_0x1ebb('0x7e')](_0x18576a['variable'])[0x0],_0x18576a['value']);if(this['queueReports'][_0x18576a[_0x1ebb('0x4d')]]){var _0x3d4f70=_[_0x1ebb('0x80')](this[_0x1ebb('0x11')][_0x18576a['uniqueid']]);if(_0x3d4f70){if(this[_0x1ebb('0x70')](_0x18576a[_0x1ebb('0xa6')])&&this[_0x1ebb('0x70')](_0x18576a[_0x1ebb('0xa6')]['queuestatus'])){switch(_0x18576a[_0x1ebb('0xa7')]){case _0x1ebb('0xa8'):_0x3d4f70[_0x1ebb('0x3c')]=![];_0x3d4f70[_0x1ebb('0x92')]=null;break;case _0x1ebb('0xa9'):_0x3d4f70[_0x1ebb('0xaa')]=_0x1ebb('0xab');_0x3d4f70[_0x1ebb('0x3c')]=!![];_0x3d4f70['queuecallerexitAt']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x3d4f70[_0x1ebb('0x89')]=moment()[_0x1ebb('0x4e')]('YYYY-MM-DD\x20HH:mm:ss');logger[_0x1ebb('0x51')](_0x1ebb('0xac'),_0x18576a['uniqueid'],util[_0x1ebb('0x45')](_0x3d4f70,{'showHidden':![],'depth':null}));ami[_0x1ebb('0x4b')](_0x1ebb('0xad'),_0x3d4f70);break;default:_0x3d4f70['queuecallerexit']=!![];_0x3d4f70[_0x1ebb('0x92')]=moment()[_0x1ebb('0x4e')](_0x1ebb('0x77'));_0x3d4f70[_0x1ebb('0x89')]=moment()[_0x1ebb('0x4e')](_0x1ebb('0x77'));}_0x3d4f70[_0x1ebb('0x21')]=![];_0x3d4f70[_0x1ebb('0x85')]=null;_0x3d4f70[_0x1ebb('0x53')]=_0x18576a[_0x1ebb('0xa7')];this[_0x1ebb('0x13')][_0x18576a[_0x1ebb('0x4d')]]=_0x3d4f70;this[_0x1ebb('0x4a')](_0x3d4f70,_0x1ebb('0x25'));}else if(this[_0x1ebb('0x70')](_0x18576a['variable'])&&this[_0x1ebb('0x70')](_0x18576a[_0x1ebb('0xa6')][_0x1ebb('0xae')])){if(!_0x3d4f70[_0x1ebb('0x21')]){_0x3d4f70[_0x1ebb('0x3c')]=!![];_0x3d4f70[_0x1ebb('0x92')]=moment()[_0x1ebb('0x4e')](_0x1ebb('0x77'));_0x3d4f70[_0x1ebb('0x53')]=_0x1ebb('0xaf');_0x3d4f70[_0x1ebb('0x89')]=moment()[_0x1ebb('0x4e')](_0x1ebb('0x77'));this[_0x1ebb('0x13')][_0x18576a[_0x1ebb('0x4d')]]=_0x3d4f70;}}logger[_0x1ebb('0x7b')](_0x1ebb('0xb0'),_0x18576a[_0x1ebb('0x4d')],_0x3d4f70['queue'],_0x3d4f70['type'],_[_0x1ebb('0x7e')](_0x18576a[_0x1ebb('0xa6')])[0x0],_0x18576a[_0x1ebb('0xa7')]);_0x3d4f70[_0x1ebb('0x18')]=this[_0x1ebb('0x18')][_0x18576a[_0x1ebb('0x4d')]];}}}}catch(_0x1e3a31){logger[_0x1ebb('0x44')](_0x1ebb('0xa4'),_0x18576a[_0x1ebb('0x4d')],util['inspect'](_0x1e3a31,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x1ebb('0xc')]['addVariable']=function(_0x7c8290,_0x48d2da,_0x38b253){var _0x2fafb9=[_0x1ebb('0xb1'),_0x1ebb('0xb2'),_0x1ebb('0xb3'),_0x1ebb('0xb4'),'rtpaudioqosloss',_0x1ebb('0xb5'),_0x1ebb('0xb6'),_0x1ebb('0xb7'),_0x1ebb('0xb8'),_0x1ebb('0xb9'),_0x1ebb('0xba'),_0x1ebb('0xbb'),'membercalls',_0x1ebb('0xbc'),_0x1ebb('0xbd'),_0x1ebb('0xbe'),_0x1ebb('0xbf'),_0x1ebb('0xc0'),'memberrealtime'];if(!_[_0x1ebb('0x3f')](_0x48d2da)&&!_[_0x1ebb('0xc1')](_0x2fafb9,_0x48d2da)){if(_['isUndefined'](this[_0x1ebb('0x18')][_0x7c8290])){this[_0x1ebb('0x18')][_0x7c8290]={};}this[_0x1ebb('0x18')][_0x7c8290][_0x48d2da]=_0x38b253;}};VoiceQueueReport['prototype'][_0x1ebb('0xc2')]=function(_0x4d7892,_0x3e4dcd,_0x37097e){try{var _0x286ca3={};if(this[_0x1ebb('0x11')][_0x4d7892]){for(var _0x46781c=0x0;_0x46781c0x0?!![]:![];if(!_0xb7c658){return this[_0x7b2a('0x19')](this['summary'][_0x7b2a('0x65')]);}};VoiceQueueReport['prototype'][_0x7b2a('0x1b')]=function(_0x3f9f85){var _0x46cd85=this[_0x7b2a('0x14')]['id'];if(this[_0x7b2a('0x14')]['queuestatus'][_0x46cd85]&&this[_0x7b2a('0x14')][_0x7b2a('0x5c')][_0x46cd85][_0x3f9f85[_0x7b2a('0x5a')]]){this[_0x7b2a('0x14')][_0x7b2a('0x5c')][_0x46cd85][_0x3f9f85[_0x7b2a('0x5a')]][_0x7b2a('0xf')]['push'](_0x3f9f85);}};VoiceQueueReport[_0x7b2a('0x41')][_0x7b2a('0x16')]=function(_0x4075e8){var _0x315518=this;try{if(this['isNotNull'](_0x4075e8)&&this[_0x7b2a('0x66')](_0x4075e8[_0x7b2a('0x4d')])){logger['debug'](_0x7b2a('0x67'),util[_0x7b2a('0x3c')](_0x4075e8,{'showHidden':![],'depth':null}));var _0x62cdcf=this[_0x7b2a('0x12')][_0x4075e8[_0x7b2a('0x4d')]];if(_0x62cdcf){logger[_0x7b2a('0x48')](_0x7b2a('0x68'),_0x62cdcf[_0x7b2a('0x57')]);this[_0x7b2a('0x14')]['queues'][_0x62cdcf[_0x7b2a('0x57')]]={'summaryEvent':_0x4075e8};this[_0x7b2a('0x14')]['statusRequests']+=0x1;return ami[_0x7b2a('0x37')]({'action':_0x7b2a('0x5c'),'queue':_0x62cdcf[_0x7b2a('0x57')]})[_0x7b2a('0x69')](function(_0x38cf88){if(!_0x315518['summary'][_0x7b2a('0x5c')][_0x4075e8[_0x7b2a('0x5a')]]){_0x315518[_0x7b2a('0x14')][_0x7b2a('0x5c')][_0x4075e8[_0x7b2a('0x5a')]]={};}_0x315518[_0x7b2a('0x14')][_0x7b2a('0x5c')][_0x4075e8['actionid']][_0x38cf88[_0x7b2a('0x5a')]]={'queue':_0x62cdcf['name'],'agents':[]};})['catch'](function(_0x2895e3){throw _0x2895e3;});}}}catch(_0x2eda9e){logger[_0x7b2a('0x3d')]('[voiceQueueReport][queuesummary]',util['inspect'](_0x2eda9e,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x7b2a('0x19')]=function(_0x5708ef){if(this[_0x7b2a('0x14')][_0x7b2a('0x64')]>0x0){this[_0x7b2a('0x14')][_0x7b2a('0x65')]=_0x5708ef;return;}logger[_0x7b2a('0x48')](_0x7b2a('0x6a'),util[_0x7b2a('0x3c')](_0x5708ef,{'showHidden':![],'depth':null}));this[_0x7b2a('0x14')]=initializeSummary();ami[_0x7b2a('0x47')](_0x7b2a('0x6b'),{});};VoiceQueueReport[_0x7b2a('0x41')]['syncQueueCallerJoin']=function(_0x4b9eaf){try{if(this['isNotNull'](_0x4b9eaf)){logger['debug']('[%s][voiceQueueReport][queuecallerjoin]',_0x4b9eaf[_0x7b2a('0x50')],util[_0x7b2a('0x3c')](_0x4b9eaf,{'showHidden':![],'depth':null}));if(_[_0x7b2a('0x6c')](this['queueReports'][_0x4b9eaf[_0x7b2a('0x50')]])){this['queueReports'][_0x4b9eaf[_0x7b2a('0x50')]]=[];}if(_[_0x7b2a('0x6c')](this[_0x7b2a('0x10')][_0x4b9eaf[_0x7b2a('0x50')]])){this[_0x7b2a('0x10')][_0x4b9eaf[_0x7b2a('0x50')]]={};}var _0x12ad3b=new QueueReport();_0x12ad3b['queue']=_0x4b9eaf[_0x7b2a('0x4d')];_0x12ad3b['type']=this['voiceQueues'][_0x12ad3b['queue']]&&this[_0x7b2a('0x12')][_0x12ad3b[_0x7b2a('0x4d')]][_0x7b2a('0x54')]?this['voiceQueues'][_0x12ad3b[_0x7b2a('0x4d')]]['type']||_0x7b2a('0x55'):_0x7b2a('0x55');_0x12ad3b[_0x7b2a('0x6d')]=moment()[_0x7b2a('0x4b')](_0x7b2a('0x6e'));_0x12ad3b[_0x7b2a('0x6f')]=_0x4b9eaf[_0x7b2a('0x6f')];_0x12ad3b[_0x7b2a('0x70')]=_0x4b9eaf[_0x7b2a('0x70')];_0x12ad3b[_0x7b2a('0x50')]=_0x4b9eaf[_0x7b2a('0x50')];_0x12ad3b['routealias']=this[_0x7b2a('0x10')][_0x4b9eaf[_0x7b2a('0x50')]][_0x7b2a('0x71')];logger[_0x7b2a('0x72')](_0x7b2a('0x73'),_0x12ad3b[_0x7b2a('0x4d')],_0x12ad3b[_0x7b2a('0x54')]);Object[_0x7b2a('0x60')](_0x12ad3b,_[_0x7b2a('0x74')](_0x4b9eaf,_['keys'](_0x12ad3b)));this[_0x7b2a('0xd')][_0x4b9eaf['uniqueid']][_0x7b2a('0x75')](_0x12ad3b);this[_0x7b2a('0x10')][_0x4b9eaf[_0x7b2a('0x50')]]=_0x12ad3b;this['emitVoiceQueueChannelSave'](_0x12ad3b,_0x7b2a('0x1e'));}}catch(_0x26dc26){logger['error'](_0x7b2a('0x76'),_0x4b9eaf[_0x7b2a('0x50')],util[_0x7b2a('0x3c')](_0x26dc26,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x7b2a('0x41')]['syncQueueCallerAbandon']=function(_0x7364f7){try{if(this['isNotNull'](_0x7364f7)){logger[_0x7b2a('0x48')](_0x7b2a('0x77'),_0x7364f7[_0x7b2a('0x50')],util['inspect'](_0x7364f7,{'showHidden':![],'depth':null}));if(this[_0x7b2a('0xd')][_0x7364f7['uniqueid']]){var _0x256395=_[_0x7b2a('0x78')](this['queueReports'][_0x7364f7['uniqueid']]);_0x256395['queuecallercomplete']=![];_0x256395[_0x7b2a('0x79')]=null;_0x256395[_0x7b2a('0x7a')]=_0x7364f7['holdtime'];_0x256395[_0x7b2a('0x7b')]=_0x7364f7[_0x7b2a('0x7b')];_0x256395[_0x7b2a('0x35')]=!![];_0x256395[_0x7b2a('0x7c')]=moment()[_0x7b2a('0x4b')](_0x7b2a('0x6e'));_0x256395['queuecallerexitreason']=_0x7b2a('0x7d');_0x256395['lastAssignedTo']=null;logger[_0x7b2a('0x72')](_0x7b2a('0x7e'),_0x256395[_0x7b2a('0x4d')],_0x256395['type']);this[_0x7b2a('0x10')][_0x7364f7[_0x7b2a('0x50')]]=_0x256395;this[_0x7b2a('0x45')](_0x256395,_0x7b2a('0x35'));}}}catch(_0x1c8592){logger[_0x7b2a('0x3d')]('[%s][voiceQueueReport][queuecallerabandon]',_0x7364f7[_0x7b2a('0x50')],util['inspect'](_0x1c8592,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x7b2a('0x41')][_0x7b2a('0x20')]=function(_0x4a6a7c){try{if(this['isNotNull'](_0x4a6a7c)){logger[_0x7b2a('0x48')](_0x7b2a('0x7f'),_0x4a6a7c['uniqueid'],util['inspect'](_0x4a6a7c,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x4a6a7c[_0x7b2a('0x50')]]){var _0x1c5af6=_[_0x7b2a('0x78')](this[_0x7b2a('0xd')][_0x4a6a7c[_0x7b2a('0x50')]]);_0x1c5af6[_0x7b2a('0x80')]=moment()[_0x7b2a('0x4b')](_0x7b2a('0x6e'));_0x1c5af6[_0x7b2a('0x81')]=_0x4a6a7c[_0x7b2a('0x81')];_0x1c5af6[_0x7b2a('0x82')]=_0x4a6a7c['connectedlinename'];logger[_0x7b2a('0x72')](_0x7b2a('0x83'),_0x1c5af6[_0x7b2a('0x4d')],_0x1c5af6[_0x7b2a('0x54')],_0x4a6a7c['connectedlinenum'],_0x4a6a7c[_0x7b2a('0x82')]);this['channels'][_0x4a6a7c[_0x7b2a('0x50')]]=_0x1c5af6;this[_0x7b2a('0x84')](_0x1c5af6,'queuecallerleave');}}}catch(_0x20d84b){logger[_0x7b2a('0x3d')](_0x7b2a('0x7f'),_0x4a6a7c[_0x7b2a('0x50')],util['inspect'](_0x20d84b,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x7b2a('0x41')][_0x7b2a('0x23')]=function(_0x11ac9a){try{if(this['isNotNull'](_0x11ac9a)){logger[_0x7b2a('0x48')](_0x7b2a('0x85'),_0x11ac9a[_0x7b2a('0x50')],util[_0x7b2a('0x3c')](_0x11ac9a,{'showHidden':![],'depth':null}));if(this[_0x7b2a('0xd')][_0x11ac9a[_0x7b2a('0x50')]]){var _0x7aa282=_[_0x7b2a('0x78')](this[_0x7b2a('0xd')][_0x11ac9a[_0x7b2a('0x50')]]);_0x7aa282[_0x7b2a('0x86')]=!![];_0x7aa282[_0x7b2a('0x87')]=_0x7b2a('0x88');logger[_0x7b2a('0x72')]('[voiceQueueReport][agentconnect]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETEDBYAGENT',_0x7aa282[_0x7b2a('0x4d')],_0x7aa282[_0x7b2a('0x54')]);}}}catch(_0x33b925){logger[_0x7b2a('0x3d')](_0x7b2a('0x85'),_0x11ac9a[_0x7b2a('0x50')],util[_0x7b2a('0x3c')](_0x33b925,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x7b2a('0x89')]=function(_0x395a9a){try{if(this['isNotNull'](_0x395a9a)){logger['debug'](_0x7b2a('0x8a'),_0x395a9a[_0x7b2a('0x50')],util[_0x7b2a('0x3c')](_0x395a9a,{'showHidden':![],'depth':null}));if(this[_0x7b2a('0xd')][_0x395a9a['uniqueid']]){var _0x19310d=_[_0x7b2a('0x78')](this[_0x7b2a('0xd')][_0x395a9a['uniqueid']]);_0x19310d['queuecallerabandon']=![];_0x19310d[_0x7b2a('0x7c')]=null;_0x19310d[_0x7b2a('0x8b')]=!![];_0x19310d[_0x7b2a('0x8c')]=_0x395a9a[_0x7b2a('0x8d')];_0x19310d[_0x7b2a('0x7a')]=_0x395a9a[_0x7b2a('0x7a')];_0x19310d[_0x7b2a('0x86')]=!![];_0x19310d['queuecallerexit']=![];_0x19310d[_0x7b2a('0x8e')]=null;if(!_0x19310d['transfer']){if(_0x395a9a[_0x7b2a('0x8f')]=='transfer'){_0x19310d['queuecallerexitreason']=_0x7b2a('0x90');logger['info'](_0x7b2a('0x91'),_0x19310d[_0x7b2a('0x4d')],_0x19310d[_0x7b2a('0x54')]);}else{if(_[_0x7b2a('0x92')](_0x395a9a[_0x7b2a('0x38')]['toLowerCase'](),_0x7b2a('0x93'))){if(this[_0x7b2a('0xd')][_0x395a9a[_0x7b2a('0x94')]]){var _0x23c961=_[_0x7b2a('0x78')](this[_0x7b2a('0xd')][_0x395a9a['linkedid']]);_0x23c961[_0x7b2a('0x86')]=![];_0x23c961['queuecallerexit']=!![];_0x23c961[_0x7b2a('0x8e')]=moment(_0x19310d[_0x7b2a('0x6d')])[_0x7b2a('0x95')](_0x395a9a[_0x7b2a('0x7a')],_0x7b2a('0x96'))[_0x7b2a('0x4b')](_0x7b2a('0x6e'));_0x23c961[_0x7b2a('0x87')]=_0x7b2a('0x97');_0x23c961[_0x7b2a('0x98')]=!![];_0x23c961[_0x7b2a('0x99')]=_0x7b2a('0x9a');_0x23c961[_0x7b2a('0x9b')]=_0x395a9a[_0x7b2a('0x9c')];_0x23c961['transferuniqueid']=_0x395a9a[_0x7b2a('0x50')];logger[_0x7b2a('0x72')](_0x7b2a('0x9d'),_0x23c961[_0x7b2a('0x4d')],_0x23c961[_0x7b2a('0x54')]);var _0x28335b=this[_0x7b2a('0xd')][_0x395a9a[_0x7b2a('0x94')]];this['queueReports'][_0x395a9a[_0x7b2a('0x94')]]=this['queueReports'][_0x395a9a['uniqueid']];this['queueReports'][_0x395a9a[_0x7b2a('0x50')]]=_0x28335b;}}else{_0x19310d[_0x7b2a('0x87')]=_0x7b2a('0x9e')+_0x395a9a[_0x7b2a('0x8f')]['toUpperCase']();logger[_0x7b2a('0x72')](_0x7b2a('0x9f'),_0x19310d[_0x7b2a('0x4d')],_0x19310d[_0x7b2a('0x54')],_0x19310d[_0x7b2a('0x87')]);}}}this['channels'][_0x395a9a[_0x7b2a('0x50')]]=_0x19310d;}}}catch(_0x12284f){logger[_0x7b2a('0x3d')]('[%s][voiceQueueReport][agentcomplete]',_0x395a9a['uniqueid'],util[_0x7b2a('0x3c')](_0x12284f,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x7b2a('0x41')][_0x7b2a('0xa0')]=function(_0x2e738b){try{if(this['isNotNull'](_0x2e738b)){logger[_0x7b2a('0x48')](_0x7b2a('0xa1'),_0x2e738b[_0x7b2a('0x50')],util[_0x7b2a('0x3c')](_0x2e738b,{'showHidden':![],'depth':null}));this['addVariable'](_0x2e738b[_0x7b2a('0x50')],_[_0x7b2a('0xa2')](_0x2e738b[_0x7b2a('0xa3')])[0x0],_0x2e738b[_0x7b2a('0xa4')]);if(this['queueReports'][_0x2e738b['uniqueid']]){var _0x1f779a=_[_0x7b2a('0x78')](this[_0x7b2a('0xd')][_0x2e738b[_0x7b2a('0x50')]]);if(_0x1f779a){if(this[_0x7b2a('0x66')](_0x2e738b['variable'])&&this[_0x7b2a('0x66')](_0x2e738b[_0x7b2a('0xa3')]['queuestatus'])){switch(_0x2e738b[_0x7b2a('0xa4')]){case _0x7b2a('0xa5'):_0x1f779a[_0x7b2a('0x34')]=![];_0x1f779a[_0x7b2a('0x8e')]=null;break;case _0x7b2a('0xa6'):_0x1f779a[_0x7b2a('0xa7')]='timeout';_0x1f779a[_0x7b2a('0x34')]=!![];_0x1f779a['queuecallerexitAt']=moment()[_0x7b2a('0x4b')](_0x7b2a('0x6e'));_0x1f779a[_0x7b2a('0x80')]=moment()['format'](_0x7b2a('0x6e'));logger[_0x7b2a('0x48')](_0x7b2a('0xa8'),_0x2e738b['uniqueid'],util[_0x7b2a('0x3c')](_0x1f779a,{'showHidden':![],'depth':null}));ami[_0x7b2a('0x47')](_0x7b2a('0xa9'),_0x1f779a);break;default:_0x1f779a['queuecallerexit']=!![];_0x1f779a['queuecallerexitAt']=moment()[_0x7b2a('0x4b')](_0x7b2a('0x6e'));_0x1f779a[_0x7b2a('0x80')]=moment()[_0x7b2a('0x4b')]('YYYY-MM-DD\x20HH:mm:ss');}_0x1f779a[_0x7b2a('0x35')]=![];_0x1f779a[_0x7b2a('0x7c')]=null;_0x1f779a[_0x7b2a('0x87')]=_0x2e738b[_0x7b2a('0xa4')];this[_0x7b2a('0x10')][_0x2e738b[_0x7b2a('0x50')]]=_0x1f779a;this[_0x7b2a('0x45')](_0x1f779a,_0x7b2a('0xaa'));}else if(this[_0x7b2a('0x66')](_0x2e738b[_0x7b2a('0xa3')])&&this[_0x7b2a('0x66')](_0x2e738b[_0x7b2a('0xa3')][_0x7b2a('0xab')])){if(!_0x1f779a[_0x7b2a('0x35')]){_0x1f779a[_0x7b2a('0x34')]=!![];_0x1f779a['queuecallerexitAt']=moment()['format'](_0x7b2a('0x6e'));_0x1f779a[_0x7b2a('0x87')]=_0x7b2a('0xac');_0x1f779a[_0x7b2a('0x80')]=moment()[_0x7b2a('0x4b')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x7b2a('0x10')][_0x2e738b[_0x7b2a('0x50')]]=_0x1f779a;}}logger['info'](_0x7b2a('0xad'),_0x2e738b[_0x7b2a('0x50')],_0x1f779a['queue'],_0x1f779a['type'],_[_0x7b2a('0xa2')](_0x2e738b['variable'])[0x0],_0x2e738b['value']);_0x1f779a[_0x7b2a('0x3f')]=this[_0x7b2a('0x3f')][_0x2e738b[_0x7b2a('0x50')]];}}}}catch(_0x41154a){logger[_0x7b2a('0x3d')]('[%s][voiceQueueReport][varset]',_0x2e738b[_0x7b2a('0x50')],util[_0x7b2a('0x3c')](_0x41154a,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x7b2a('0x41')][_0x7b2a('0xae')]=function(_0x1ff24f,_0x297164,_0x25355a){var _0x3e6408=[_0x7b2a('0xaf'),'rtpaudioqosbridged',_0x7b2a('0xb0'),_0x7b2a('0xb1'),_0x7b2a('0xb2'),'rtpaudioqoslossbridged',_0x7b2a('0xb3'),_0x7b2a('0xb4'),_0x7b2a('0xb5'),_0x7b2a('0xb6'),_0x7b2a('0xb7'),'bridgepvtcallid',_0x7b2a('0xb8'),_0x7b2a('0xb9'),_0x7b2a('0xba'),_0x7b2a('0xbb'),'membername','memberpenalty',_0x7b2a('0xbc')];if(!_[_0x7b2a('0xbd')](_0x297164)&&!_['includes'](_0x3e6408,_0x297164)){if(_[_0x7b2a('0x6c')](this['variables'][_0x1ff24f])){this[_0x7b2a('0x3f')][_0x1ff24f]={};}this[_0x7b2a('0x3f')][_0x1ff24f][_0x297164]=_0x25355a;}};VoiceQueueReport[_0x7b2a('0x41')][_0x7b2a('0xbe')]=function(_0x28dc63,_0x5cbfb2,_0x2ec81b){try{var _0x302e1c={};if(this[_0x7b2a('0xd')][_0x28dc63]){for(var _0x119a55=0x0;_0x119a55=0x0?moment(_0x2ebe88['endtime'])['diff'](_0x2ebe88[_0x6229('0x15')],_0x6229('0xe')):null,'data1':_0x6229('0x17'),'data2':_0x2ebe88[_0x6229('0x11')],'data3':_0x2ebe88[_0x6229('0x18')],'data4':_0x2ebe88['dialstring']||null,'role':'agent','internal':_0x2ebe88[_0x6229('0x11')]?_[_0x6229('0x12')](_0x2ebe88[_0x6229('0x11')]):undefined,'uniqueid':_0x2ebe88[_0x6229('0x19')]},'log':_0x6229('0x13')});}; \ No newline at end of file +var _0x9849=['inbound','calleridnum','exten','queue','agent','toNumber','voiceDialReport','endtime','starttime','outbound','accountcode','dialstring','moment','util','../client','voiceQueueReport','queuecallerexitAt','Request','CreateMemberReport','voice','isNil','interface','format','SIP/%s','lastAssignedTo','TALKING','queuecallerleaveAt','diff','seconds'];(function(_0x3ff085,_0x27c92e){var _0x2b68c3=function(_0x37811e){while(--_0x37811e){_0x3ff085['push'](_0x3ff085['shift']());}};_0x2b68c3(++_0x27c92e);}(_0x9849,0x1a2));var _0x9984=function(_0x5037ab,_0x43209e){_0x5037ab=_0x5037ab-0x0;var _0x512adb=_0x9849[_0x5037ab];return _0x512adb;};'use strict';var moment=require(_0x9984('0x0'));var _=require('lodash');var util=require(_0x9984('0x1'));var client=require(_0x9984('0x2'));exports[_0x9984('0x3')]=function(_0x3451f4){var _0x507364=_0x3451f4['queuecallercompleteAt']||_0x3451f4[_0x9984('0x4')];return client[_0x9984('0x5')](_0x9984('0x6'),{'body':{'channel':_0x9984('0x7'),'membername':_0x3451f4['lastAssignedTo'],'interface':_[_0x9984('0x8')](_0x3451f4[_0x9984('0x9')])?util[_0x9984('0xa')](_0x9984('0xb'),_0x3451f4[_0x9984('0xc')]):_0x3451f4[_0x9984('0x9')],'type':_0x9984('0xd'),'enterAt':_0x3451f4[_0x9984('0xe')],'exitAt':_0x507364,'duration':moment(_0x507364)[_0x9984('0xf')](_0x3451f4[_0x9984('0xe')],_0x9984('0x10')),'data1':_0x9984('0x11'),'data2':_0x3451f4[_0x9984('0x12')],'data3':_0x3451f4[_0x9984('0x13')],'data4':null,'data5':_0x3451f4[_0x9984('0x14')],'role':_0x9984('0x15'),'internal':_0x3451f4['accountcode']?_[_0x9984('0x16')](_0x3451f4['accountcode']):undefined,'uniqueid':_0x3451f4['uniqueid']},'log':_0x9984('0x6')});};exports[_0x9984('0x17')]=function(_0x14adec){return client[_0x9984('0x5')](_0x9984('0x6'),{'body':{'channel':'voice','membername':_0x14adec['membername'],'interface':_0x14adec[_0x9984('0x9')],'type':_0x9984('0xd'),'enterAt':_0x14adec['starttime'],'exitAt':_0x14adec[_0x9984('0x18')],'duration':moment(_0x14adec['endtime'])[_0x9984('0xf')](_0x14adec[_0x9984('0x19')],_0x9984('0x10'))>=0x0?moment(_0x14adec[_0x9984('0x18')])[_0x9984('0xf')](_0x14adec['starttime'],_0x9984('0x10')):null,'data1':_0x9984('0x1a'),'data2':_0x14adec[_0x9984('0x1b')],'data3':_0x14adec[_0x9984('0x13')],'data4':_0x14adec[_0x9984('0x1c')]||null,'role':_0x9984('0x15'),'internal':_0x14adec[_0x9984('0x1b')]?_['toNumber'](_0x14adec[_0x9984('0x1b')]):undefined,'uniqueid':_0x14adec['uniqueid']},'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 0e93a82..ba3408d 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 _0xd983=['getSettings','Request','ShowSetting','stopRecordingOnTransfer','../client'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd983,0x1df));var _0x3d98=function(_0x287512,_0x5a76ab){_0x287512=_0x287512-0x0;var _0x4f22a2=_0xd983[_0x287512];return _0x4f22a2;};'use strict';var client=require(_0x3d98('0x0'));exports[_0x3d98('0x1')]=function(){return client[_0x3d98('0x2')](_0x3d98('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x3d98('0x4'),'previewRecallmeReminderInterval']},'log':'GetSettings'});}; \ No newline at end of file +var _0x3a27=['getSettings','Request','ShowSetting','stopRecordingOnTransfer','previewRecallmeReminderInterval','GetSettings','../client'];(function(_0x16bfbb,_0x3c3e70){var _0x5c1d6c=function(_0xd4abe1){while(--_0xd4abe1){_0x16bfbb['push'](_0x16bfbb['shift']());}};_0x5c1d6c(++_0x3c3e70);}(_0x3a27,0x19c));var _0x73a2=function(_0x237cbb,_0x27ed4b){_0x237cbb=_0x237cbb-0x0;var _0x33ba22=_0x3a27[_0x237cbb];return _0x33ba22;};'use strict';var client=require(_0x73a2('0x0'));exports[_0x73a2('0x1')]=function(){return client[_0x73a2('0x2')](_0x73a2('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x73a2('0x4'),_0x73a2('0x5')]},'log':_0x73a2('0x6')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index 1b4fbb3..c3e727b 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 _0xc04a=['GetTemplate','name','../client','Request'];(function(_0x48afad,_0x5efb38){var _0x297d00=function(_0x1bcf83){while(--_0x1bcf83){_0x48afad['push'](_0x48afad['shift']());}};_0x297d00(++_0x5efb38);}(_0xc04a,0x12e));var _0xac04=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc04a[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0xac04('0x0'));exports['getTemplates']=function(_0x3967a7){return function(_0x480c09){return client[_0xac04('0x1')](_0xac04('0x2'),{'options':{'raw':!![],'attributes':['id',_0xac04('0x3'),'html']},'log':_0xac04('0x2')});};}; \ No newline at end of file +var _0x74cc=['Request','name','html','GetTemplate','../client','getTemplates'];(function(_0x363ef8,_0x4ecb1a){var _0x148822=function(_0x232634){while(--_0x232634){_0x363ef8['push'](_0x363ef8['shift']());}};_0x148822(++_0x4ecb1a);}(_0x74cc,0x184));var _0xc74c=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0x74cc[_0x31e29a];return _0x32d892;};'use strict';var client=require(_0xc74c('0x0'));exports[_0xc74c('0x1')]=function(_0xd8916f){return function(_0x41fb1a){return client[_0xc74c('0x2')]('GetTemplate',{'options':{'raw':!![],'attributes':['id',_0xc74c('0x3'),_0xc74c('0x4')]},'log':_0xc74c('0x5')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index 04a74e9..2bf39c9 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 _0x9f32=['Action','Actions','data1','data2','data3','data4','data6','../client','Request','GetTrigger','status','AllConditions','field','operator','value','Condition','AnyConditions'];(function(_0x4abd2e,_0xdb57ae){var _0x39ecc1=function(_0x2a0b59){while(--_0x2a0b59){_0x4abd2e['push'](_0x4abd2e['shift']());}};_0x39ecc1(++_0xdb57ae);}(_0x9f32,0x117));var _0x29f3=function(_0x41f8cf,_0x4ab076){_0x41f8cf=_0x41f8cf-0x0;var _0x46047e=_0x9f32[_0x41f8cf];return _0x46047e;};'use strict';var client=require(_0x29f3('0x0'));exports['getTriggers']=function(_0x55c1fc){return function(_0x37aa60){return client[_0x29f3('0x1')](_0x29f3('0x2'),{'options':{'raw':![],'attributes':['id','name','channel',_0x29f3('0x3')],'include':[{'model':'Condition','as':_0x29f3('0x4'),'attributes':['id',_0x29f3('0x5'),_0x29f3('0x6'),_0x29f3('0x7')]},{'model':_0x29f3('0x8'),'as':_0x29f3('0x9'),'attributes':['id',_0x29f3('0x5'),_0x29f3('0x6'),_0x29f3('0x7')]},{'model':_0x29f3('0xa'),'as':_0x29f3('0xb'),'attributes':['id','action',_0x29f3('0xc'),_0x29f3('0xd'),_0x29f3('0xe'),_0x29f3('0xf'),'data5',_0x29f3('0x10'),'data7']}]},'log':_0x29f3('0x2')});};}; \ No newline at end of file +var _0x6ab6=['status','Condition','field','operator','value','Action','data2','data3','data4','data6','data7','../client','getTriggers','GetTrigger','name','channel'];(function(_0x26b130,_0x50a2d1){var _0x2d980c=function(_0x2cdf59){while(--_0x2cdf59){_0x26b130['push'](_0x26b130['shift']());}};_0x2d980c(++_0x50a2d1);}(_0x6ab6,0x11b));var _0x66ab=function(_0x45ac03,_0x2390df){_0x45ac03=_0x45ac03-0x0;var _0x433e26=_0x6ab6[_0x45ac03];return _0x433e26;};'use strict';var client=require(_0x66ab('0x0'));exports[_0x66ab('0x1')]=function(_0x564f6b){return function(_0xfd6cc3){return client['Request'](_0x66ab('0x2'),{'options':{'raw':![],'attributes':['id',_0x66ab('0x3'),_0x66ab('0x4'),_0x66ab('0x5')],'include':[{'model':_0x66ab('0x6'),'as':'AllConditions','attributes':['id',_0x66ab('0x7'),_0x66ab('0x8'),_0x66ab('0x9')]},{'model':'Condition','as':'AnyConditions','attributes':['id',_0x66ab('0x7'),_0x66ab('0x8'),_0x66ab('0x9')]},{'model':_0x66ab('0xa'),'as':'Actions','attributes':['id','action','data1',_0x66ab('0xb'),_0x66ab('0xc'),_0x66ab('0xd'),'data5',_0x66ab('0xe'),_0x66ab('0xf')]}]},'log':_0x66ab('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index ac35915..a9748f0 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 _0xece0=['name','registry','defaultuser','../client','getTrunks','Request'];(function(_0x26367f,_0x3dd1f9){var _0x5121cd=function(_0x1bde49){while(--_0x1bde49){_0x26367f['push'](_0x26367f['shift']());}};_0x5121cd(++_0x3dd1f9);}(_0xece0,0xa5));var _0x0ece=function(_0x24bbd5,_0x34a7c4){_0x24bbd5=_0x24bbd5-0x0;var _0x8fb737=_0xece0[_0x24bbd5];return _0x8fb737;};'use strict';var client=require(_0x0ece('0x0'));exports[_0x0ece('0x1')]=function(_0x50b067){return function(_0x3feab2){return client[_0x0ece('0x2')]('GetTrunk',{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0x0ece('0x3'),_0x0ece('0x4'),_0x0ece('0x5')]},'log':'GetTrunk'});};}; \ No newline at end of file +var _0x0506=['GetTrunk','../client','getTrunks','registry'];(function(_0x3f625c,_0xbdf76){var _0x5c80ba=function(_0x180b1d){while(--_0x180b1d){_0x3f625c['push'](_0x3f625c['shift']());}};_0x5c80ba(++_0xbdf76);}(_0x0506,0x1d1));var _0x6050=function(_0x5e0a17,_0x22165c){_0x5e0a17=_0x5e0a17-0x0;var _0x518109=_0x0506[_0x5e0a17];return _0x518109;};'use strict';var client=require(_0x6050('0x0'));exports[_0x6050('0x1')]=function(_0x1ba949){return function(_0x5592e4){return client['Request']('GetTrunk',{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id','name',_0x6050('0x2'),'defaultuser']},'log':_0x6050('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/user.js b/server/services/ami/rpc/user.js index 94fe8b6..359455c 100644 --- a/server/services/ami/rpc/user.js +++ b/server/services/ami/rpc/user.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['internal','savePause','PauseUser','saveUnpause','UnpauseUser','ShowUser','getAgent','../client','getAgents','Request','agent','name','email','accountcode','fullname','online','lastLoginAt','pauseType','lastPauseAt','voicePause','phone','mobile','interface','getTelephones','GetUser','telephone'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0xe706,0xa3));var _0x6e70=function(_0xd1f854,_0x532346){_0xd1f854=_0xd1f854-0x0;var _0x548294=_0xe706[_0xd1f854];return _0x548294;};'use strict';var client=require(_0x6e70('0x0'));exports[_0x6e70('0x1')]=function(){return function(){return client[_0x6e70('0x2')]('GetUser',{'options':{'raw':![],'where':{'role':_0x6e70('0x3')},'attributes':['id',_0x6e70('0x4'),_0x6e70('0x5'),_0x6e70('0x6'),_0x6e70('0x7'),_0x6e70('0x8'),_0x6e70('0x9'),_0x6e70('0xa'),_0x6e70('0xb'),_0x6e70('0xc'),_0x6e70('0xd'),_0x6e70('0xe'),_0x6e70('0xf')]},'log':_0x6e70('0x1')});};};exports[_0x6e70('0x10')]=function(){return function(){return client[_0x6e70('0x2')](_0x6e70('0x11'),{'options':{'raw':!![],'where':{'role':_0x6e70('0x12')},'attributes':['id',_0x6e70('0x4'),_0x6e70('0x6'),_0x6e70('0x13')]},'log':_0x6e70('0x10')});};};exports[_0x6e70('0x14')]=function(_0x4600f9,_0x5b3d07,_0x47f6b2){return client[_0x6e70('0x2')](_0x6e70('0x15'),{'body':{'type':_0x5b3d07,'uniqueid':_0x47f6b2},'options':{'where':{'id':_0x4600f9['id']}},'log':_0x6e70('0x14')});};exports[_0x6e70('0x16')]=function(_0x3b38f3){return client[_0x6e70('0x2')](_0x6e70('0x17'),{'body':{},'options':{'where':{'id':_0x3b38f3['id']}},'log':_0x6e70('0x14')});};exports['getAgent']=function(_0x52737e){return client['Request'](_0x6e70('0x18'),{'options':{'raw':![],'where':{'role':'agent','id':_0x52737e},'attributes':['id','name',_0x6e70('0x5'),_0x6e70('0x6'),'fullname',_0x6e70('0x8'),'lastLoginAt',_0x6e70('0xa'),_0x6e70('0xb'),'voicePause','interface']},'log':_0x6e70('0x19')});}; \ No newline at end of file +var _0xedd9=['mobile','getTelephones','internal','PauseUser','savePause','saveUnpause','UnpauseUser','ShowUser','interface','getAgent','getAgents','Request','GetUser','agent','name','email','accountcode','fullname','lastLoginAt','pauseType','lastPauseAt','voicePause'];(function(_0x5c1cc9,_0xe04ed9){var _0x546668=function(_0x4bca96){while(--_0x4bca96){_0x5c1cc9['push'](_0x5c1cc9['shift']());}};_0x546668(++_0xe04ed9);}(_0xedd9,0xfc));var _0x9edd=function(_0x128d1e,_0x556496){_0x128d1e=_0x128d1e-0x0;var _0x2bb46b=_0xedd9[_0x128d1e];return _0x2bb46b;};'use strict';var client=require('../client');exports[_0x9edd('0x0')]=function(){return function(){return client[_0x9edd('0x1')](_0x9edd('0x2'),{'options':{'raw':![],'where':{'role':_0x9edd('0x3')},'attributes':['id',_0x9edd('0x4'),_0x9edd('0x5'),_0x9edd('0x6'),_0x9edd('0x7'),'online',_0x9edd('0x8'),_0x9edd('0x9'),_0x9edd('0xa'),_0x9edd('0xb'),'phone',_0x9edd('0xc'),'interface']},'log':_0x9edd('0x0')});};};exports[_0x9edd('0xd')]=function(){return function(){return client[_0x9edd('0x1')](_0x9edd('0x2'),{'options':{'raw':!![],'where':{'role':'telephone'},'attributes':['id',_0x9edd('0x4'),'accountcode',_0x9edd('0xe')]},'log':_0x9edd('0xd')});};};exports['savePause']=function(_0xbf9da6,_0x13dc4f,_0x5b6c00){return client[_0x9edd('0x1')](_0x9edd('0xf'),{'body':{'type':_0x13dc4f,'uniqueid':_0x5b6c00},'options':{'where':{'id':_0xbf9da6['id']}},'log':_0x9edd('0x10')});};exports[_0x9edd('0x11')]=function(_0x287ddd){return client[_0x9edd('0x1')](_0x9edd('0x12'),{'body':{},'options':{'where':{'id':_0x287ddd['id']}},'log':_0x9edd('0x10')});};exports['getAgent']=function(_0x176bfa){return client[_0x9edd('0x1')](_0x9edd('0x13'),{'options':{'raw':![],'where':{'role':_0x9edd('0x3'),'id':_0x176bfa},'attributes':['id',_0x9edd('0x4'),_0x9edd('0x5'),_0x9edd('0x6'),_0x9edd('0x7'),'online',_0x9edd('0x8'),_0x9edd('0x9'),_0x9edd('0xa'),'voicePause',_0x9edd('0x14')]},'log':_0x9edd('0x15')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceAgentReport.js b/server/services/ami/rpc/voiceAgentReport.js index 54b74ae..7b1e69a 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 _0x5601=['../client','create','Request','CreateVoiceAgentReport','UpdateVoiceAgentReport'];(function(_0x5da875,_0x475a8b){var _0x25d687=function(_0xb8a423){while(--_0xb8a423){_0x5da875['push'](_0x5da875['shift']());}};_0x25d687(++_0x475a8b);}(_0x5601,0x13b));var _0x1560=function(_0x23110a,_0x328dd5){_0x23110a=_0x23110a-0x0;var _0x2c67f9=_0x5601[_0x23110a];return _0x2c67f9;};'use strict';var client=require(_0x1560('0x0'));exports[_0x1560('0x1')]=function(_0x50a9c4){return client[_0x1560('0x2')](_0x1560('0x3'),{'body':_0x50a9c4,'log':_0x1560('0x3')});};exports['update']=function(_0xdaa566,_0x5115e7,_0x2555de){return client[_0x1560('0x2')](_0x1560('0x4'),{'body':_0xdaa566,'options':{'where':{'uniqueid':_0x5115e7,'interface':_0x2555de,'agentcomplete':!![]}},'log':'UpdateVoiceAgentReport'});}; \ No newline at end of file +var _0x69b4=['UpdateVoiceAgentReport','../client','CreateVoiceAgentReport','update','Request'];(function(_0x5535d2,_0x58f54e){var _0x3ea8bb=function(_0x197a04){while(--_0x197a04){_0x5535d2['push'](_0x5535d2['shift']());}};_0x3ea8bb(++_0x58f54e);}(_0x69b4,0x15f));var _0x469b=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x69b4[_0x2f5ac5];return _0x37c9a8;};'use strict';var client=require(_0x469b('0x0'));exports['create']=function(_0x38f777){return client['Request'](_0x469b('0x1'),{'body':_0x38f777,'log':_0x469b('0x1')});};exports[_0x469b('0x2')]=function(_0x200b31,_0x96e962,_0x1d9cc9){return client[_0x469b('0x3')](_0x469b('0x4'),{'body':_0x200b31,'options':{'where':{'uniqueid':_0x96e962,'interface':_0x1d9cc9,'agentcomplete':!![]}},'log':_0x469b('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index b0fc560..a2ff611 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 _0xc1f9=['DOCUMENTATION','getVoiceCallReports','GetVoiceCallReport','outbound','day','format','YYYY-MM-DD\x20HH:mm:ss','type','GetVoiceCallReports','moment','util','../client','create','Request','CreateVoiceCallReport','calleridnum','context'];(function(_0x5c1449,_0x2af4b4){var _0x270473=function(_0x1461b6){while(--_0x1461b6){_0x5c1449['push'](_0x5c1449['shift']());}};_0x270473(++_0x2af4b4);}(_0xc1f9,0x13b));var _0x9c1f=function(_0x362f9e,_0x341e0){_0x362f9e=_0x362f9e-0x0;var _0x328b21=_0xc1f9[_0x362f9e];return _0x328b21;};'use strict';var moment=require(_0x9c1f('0x0'));var util=require(_0x9c1f('0x1'));var _=require('lodash');var client=require(_0x9c1f('0x2'));exports[_0x9c1f('0x3')]=function(_0x22a8ef){return client[_0x9c1f('0x4')](_0x9c1f('0x5'),{'body':_['merge'](_0x22a8ef,{'source':_0x22a8ef[_0x9c1f('0x6')],'destinationcontext':_0x22a8ef[_0x9c1f('0x7')],'callerid':_0x22a8ef['callerid'],'amaflags':_0x9c1f('0x8')}),'log':_0x9c1f('0x5')});};exports[_0x9c1f('0x9')]=function(){return function(){return client['Request'](_0x9c1f('0xa'),{'options':{'where':{'type':[_0x9c1f('0xb')],'createdAt':{'$between':[moment()['startOf'](_0x9c1f('0xc'))[_0x9c1f('0xd')](_0x9c1f('0xe')),moment()['endOf'](_0x9c1f('0xc'))[_0x9c1f('0xd')]('YYYY-MM-DD\x20HH:mm:ss')]}},'attributes':[_0x9c1f('0xf'),'disposition','duration','billableseconds']},'log':_0x9c1f('0x10')});};}; \ No newline at end of file +var _0xa4df=['calleridnum','context','callerid','startOf','day','format','YYYY-MM-DD\x20HH:mm:ss','endOf','type','disposition','duration','billableseconds','GetVoiceCallReports','util','lodash','../client','create','Request','CreateVoiceCallReport','merge'];(function(_0xc84590,_0x267aca){var _0x28441f=function(_0x59ddb8){while(--_0x59ddb8){_0xc84590['push'](_0xc84590['shift']());}};_0x28441f(++_0x267aca);}(_0xa4df,0x189));var _0xfa4d=function(_0x470226,_0x317b93){_0x470226=_0x470226-0x0;var _0x5267f2=_0xa4df[_0x470226];return _0x5267f2;};'use strict';var moment=require('moment');var util=require(_0xfa4d('0x0'));var _=require(_0xfa4d('0x1'));var client=require(_0xfa4d('0x2'));exports[_0xfa4d('0x3')]=function(_0x262ad9){return client[_0xfa4d('0x4')](_0xfa4d('0x5'),{'body':_[_0xfa4d('0x6')](_0x262ad9,{'source':_0x262ad9[_0xfa4d('0x7')],'destinationcontext':_0x262ad9[_0xfa4d('0x8')],'callerid':_0x262ad9[_0xfa4d('0x9')],'amaflags':'DOCUMENTATION'}),'log':_0xfa4d('0x5')});};exports['getVoiceCallReports']=function(){return function(){return client['Request']('GetVoiceCallReport',{'options':{'where':{'type':['outbound'],'createdAt':{'$between':[moment()[_0xfa4d('0xa')](_0xfa4d('0xb'))[_0xfa4d('0xc')](_0xfa4d('0xd')),moment()[_0xfa4d('0xe')](_0xfa4d('0xb'))[_0xfa4d('0xc')](_0xfa4d('0xd'))]}},'attributes':[_0xfa4d('0xf'),_0xfa4d('0x10'),_0xfa4d('0x11'),_0xfa4d('0x12')]},'log':_0xfa4d('0x13')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index 6e5a893..fd6339d 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 _0x1cbb=['CreateVoiceDialReport','../client','Request'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1cbb,0x133));var _0xb1cb=function(_0x78afb4,_0x1cbe4f){_0x78afb4=_0x78afb4-0x0;var _0x280e9a=_0x1cbb[_0x78afb4];return _0x280e9a;};'use strict';var client=require(_0xb1cb('0x0'));exports['create']=function(_0xac5f31){return client[_0xb1cb('0x1')]('CreateVoiceDialReport',{'body':_0xac5f31,'log':_0xb1cb('0x2')});}; \ No newline at end of file +var _0xc055=['create','Request','CreateVoiceDialReport','../client'];(function(_0x837dad,_0x1d9098){var _0x1d62d3=function(_0x40b7c1){while(--_0x40b7c1){_0x837dad['push'](_0x837dad['shift']());}};_0x1d62d3(++_0x1d9098);}(_0xc055,0x73));var _0x5c05=function(_0x2c3b20,_0x23bada){_0x2c3b20=_0x2c3b20-0x0;var _0x26f206=_0xc055[_0x2c3b20];return _0x26f206;};'use strict';var client=require(_0x5c05('0x0'));exports[_0x5c05('0x1')]=function(_0x35ed91){return client[_0x5c05('0x2')](_0x5c05('0x3'),{'body':_0x35ed91,'log':_0x5c05('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index 2001b99..5800a74 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 _0xf6e8=['GetVoiceExtension','exten','recordingFormat','getVoiceExtensions','Request'];(function(_0x3f9a09,_0x59befb){var _0xe1b0c1=function(_0x498382){while(--_0x498382){_0x3f9a09['push'](_0x3f9a09['shift']());}};_0xe1b0c1(++_0x59befb);}(_0xf6e8,0xc1));var _0x8f6e=function(_0x1cb8f5,_0x41c5ef){_0x1cb8f5=_0x1cb8f5-0x0;var _0x32e8b4=_0xf6e8[_0x1cb8f5];return _0x32e8b4;};'use strict';var client=require('../client');exports[_0x8f6e('0x0')]=function(){return function(){return client[_0x8f6e('0x1')](_0x8f6e('0x2'),{'options':{'raw':!![],'attributes':['id',_0x8f6e('0x3'),_0x8f6e('0x4')],'where':{'VoiceExtensionId':null}},'log':_0x8f6e('0x0')});};}; \ No newline at end of file +var _0x1123=['Request','exten','recordingFormat','getVoiceExtensions'];(function(_0x74ffb5,_0x57e314){var _0x424663=function(_0x3c566b){while(--_0x3c566b){_0x74ffb5['push'](_0x74ffb5['shift']());}};_0x424663(++_0x57e314);}(_0x1123,0x118));var _0x3112=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x1123[_0x21a9d9];return _0x46adce;};'use strict';var client=require('../client');exports['getVoiceExtensions']=function(){return function(){return client[_0x3112('0x0')]('GetVoiceExtension',{'options':{'raw':!![],'attributes':['id',_0x3112('0x1'),_0x3112('0x2')],'where':{'VoiceExtensionId':null}},'log':_0x3112('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index cd4e2e5..8a5383a 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 _0xbda2=['Pause','TrunkBackup','Interval','Intervals','interval','getVoiceQueues','../client','Request','name','acw','acwTimeout','monitor_format','type','dialActive','dialMethod','dialLimitChannel','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialTimezone','dialAMDInitialSilence','dialAMDTotalAnalysisTime','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialPredictiveIntervalMinThreshold','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','Trunk','callerid','active'];(function(_0x5a4b64,_0x400ed4){var _0x3c2053=function(_0x45cb84){while(--_0x45cb84){_0x5a4b64['push'](_0x5a4b64['shift']());}};_0x3c2053(++_0x400ed4);}(_0xbda2,0x123));var _0x2bda=function(_0x5b20a7,_0x23e400){_0x5b20a7=_0x5b20a7-0x0;var _0x389187=_0xbda2[_0x5b20a7];return _0x389187;};'use strict';var client=require(_0x2bda('0x0'));exports['getVoiceQueues']=function(){return function(){return client[_0x2bda('0x1')]('GetVoiceQueue',{'options':{'raw':![],'attributes':['id',_0x2bda('0x2'),_0x2bda('0x3'),_0x2bda('0x4'),'autopause',_0x2bda('0x5'),_0x2bda('0x6'),_0x2bda('0x7'),_0x2bda('0x8'),_0x2bda('0x9'),'dialLimitQueue',_0x2bda('0xa'),_0x2bda('0xb'),_0x2bda('0xc'),_0x2bda('0xd'),_0x2bda('0xe'),_0x2bda('0xf'),_0x2bda('0x10'),_0x2bda('0x11'),_0x2bda('0x12'),'dialQueueProject',_0x2bda('0x13'),_0x2bda('0x14'),_0x2bda('0x15'),_0x2bda('0x16'),_0x2bda('0x17'),_0x2bda('0x18'),_0x2bda('0x19'),_0x2bda('0x1a'),'dialGlobalInterval','dialPrefix','dialCheckDuplicateType','dialAMDActive',_0x2bda('0x1b'),'dialAMDGreeting','dialAMDAfterGreetingSilence',_0x2bda('0x1c'),'dialAMDMinWordLength',_0x2bda('0x1d'),_0x2bda('0x1e'),_0x2bda('0x1f'),_0x2bda('0x20'),_0x2bda('0x21'),'dialRecallMeTimeout','dialRecallInQueue',_0x2bda('0x22'),_0x2bda('0x23'),'dialAgiAfterHangupClient','dialQueueProject2',_0x2bda('0x5'),'strategy',_0x2bda('0x24'),_0x2bda('0x25'),'dialNoSuchNumberMaxRetry',_0x2bda('0x26'),_0x2bda('0x27'),_0x2bda('0x28'),'dialAbandonedMaxRetry',_0x2bda('0x29'),_0x2bda('0x2a'),'dialMachineRetryFrequency',_0x2bda('0x2b'),_0x2bda('0x2c'),'mandatoryDisposition','dialPredictiveIntervalMaxThreshold',_0x2bda('0x2d'),_0x2bda('0x2e'),_0x2bda('0x2f')],'include':[{'model':'Trunk','as':_0x2bda('0x30'),'attributes':['id','name',_0x2bda('0x31'),_0x2bda('0x32')]},{'model':_0x2bda('0x33'),'as':'mandatoryDispositionPause','attributes':['id',_0x2bda('0x2')]},{'model':_0x2bda('0x30'),'as':_0x2bda('0x34'),'attributes':['id',_0x2bda('0x2'),_0x2bda('0x31'),_0x2bda('0x32')]},{'model':_0x2bda('0x35'),'as':_0x2bda('0x35'),'attributes':['id',_0x2bda('0x2')],'include':[{'model':_0x2bda('0x35'),'as':_0x2bda('0x36'),'attributes':['id','name',_0x2bda('0x37')]}]}]},'log':_0x2bda('0x38')});};}; \ No newline at end of file +var _0x4cd4=['dialQueueTimeout','dialCongestionRetryFrequency','dialBusyMaxRetry','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialTimezone','dialGlobalInterval','dialPrefix','dialCheckDuplicateType','dialAMDActive','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialRecallMeTimeout','dialRecallInQueue','dialQueueProject2','strategy','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','Trunk','name','mandatoryDispositionPause','TrunkBackup','callerid','Interval','Intervals','../client','getVoiceQueues','Request','GetVoiceQueue','acw','autopause','monitor_format','type','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout'];(function(_0x21aec3,_0x5c97e9){var _0x288bbc=function(_0x2283fe){while(--_0x2283fe){_0x21aec3['push'](_0x21aec3['shift']());}};_0x288bbc(++_0x5c97e9);}(_0x4cd4,0x112));var _0x44cd=function(_0x15fe46,_0x40dc50){_0x15fe46=_0x15fe46-0x0;var _0x4b7827=_0x4cd4[_0x15fe46];return _0x4b7827;};'use strict';var client=require(_0x44cd('0x0'));exports[_0x44cd('0x1')]=function(){return function(){return client[_0x44cd('0x2')](_0x44cd('0x3'),{'options':{'raw':![],'attributes':['id','name',_0x44cd('0x4'),'acwTimeout',_0x44cd('0x5'),_0x44cd('0x6'),_0x44cd('0x7'),'dialActive','dialMethod',_0x44cd('0x8'),_0x44cd('0x9'),_0x44cd('0xa'),_0x44cd('0xb'),_0x44cd('0xc'),'dialPredictiveInterval',_0x44cd('0xd'),_0x44cd('0xe'),_0x44cd('0xf'),'dialQueueOptions',_0x44cd('0x10'),'dialQueueProject','dialCongestionMaxRetry',_0x44cd('0x11'),_0x44cd('0x12'),'dialBusyRetryFrequency',_0x44cd('0x13'),_0x44cd('0x14'),_0x44cd('0x15'),_0x44cd('0x16'),_0x44cd('0x17'),_0x44cd('0x18'),_0x44cd('0x19'),_0x44cd('0x1a'),'dialAMDInitialSilence',_0x44cd('0x1b'),_0x44cd('0x1c'),'dialAMDTotalAnalysisTime',_0x44cd('0x1d'),_0x44cd('0x1e'),_0x44cd('0x1f'),'dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout',_0x44cd('0x20'),_0x44cd('0x21'),'dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialAgiAfterHangupClient',_0x44cd('0x22'),_0x44cd('0x6'),_0x44cd('0x23'),_0x44cd('0x24'),_0x44cd('0x25'),_0x44cd('0x26'),_0x44cd('0x27'),_0x44cd('0x28'),_0x44cd('0x29'),_0x44cd('0x2a'),_0x44cd('0x2b'),'dialMachineMaxRetry','dialMachineRetryFrequency',_0x44cd('0x2c'),_0x44cd('0x2d'),_0x44cd('0x2e'),_0x44cd('0x2f'),_0x44cd('0x30'),_0x44cd('0x31'),_0x44cd('0x32')],'include':[{'model':_0x44cd('0x33'),'as':'Trunk','attributes':['id',_0x44cd('0x34'),'callerid','active']},{'model':'Pause','as':_0x44cd('0x35'),'attributes':['id',_0x44cd('0x34')]},{'model':_0x44cd('0x33'),'as':_0x44cd('0x36'),'attributes':['id',_0x44cd('0x34'),_0x44cd('0x37'),'active']},{'model':_0x44cd('0x38'),'as':_0x44cd('0x38'),'attributes':['id',_0x44cd('0x34')],'include':[{'model':_0x44cd('0x38'),'as':_0x44cd('0x39'),'attributes':['id',_0x44cd('0x34'),'interval']}]}]},'log':_0x44cd('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index 21ac233..76e2349 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(_0x1f73f,_0x470922){var _0x27ef94=function(_0x171d44){while(--_0x171d44){_0x1f73f['push'](_0x1f73f['shift']());}};_0x27ef94(++_0x470922);}(_0xa9e0,0x123));var _0x0a9e=function(_0x934425,_0x5af72f){_0x934425=_0x934425-0x0;var _0x31d596=_0xa9e0[_0x934425];return _0x31d596;};'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(_0x24ea8c,_0x2d71d0){var _0x4327d3=function(_0x242b2a){while(--_0x242b2a){_0x24ea8c['push'](_0x24ea8c['shift']());}};_0x4327d3(++_0x2d71d0);}(_0xa9e0,0x123));var _0x0a9e=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xa9e0[_0x501510];return _0x1e6ee5;};'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 39741d7..5e64da0 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 _0x3f95=['GetVoiceQueueRtPauses','getVoiceQueueRtPauses','Request'];(function(_0x476b15,_0x4a093a){var _0x54e8c6=function(_0x146c5a){while(--_0x146c5a){_0x476b15['push'](_0x476b15['shift']());}};_0x54e8c6(++_0x4a093a);}(_0x3f95,0xd0));var _0x53f9=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x3f95[_0x57b54c];return _0x59cc19;};'use strict';var client=require('../client');exports[_0x53f9('0x0')]=function(_0xcd9cab){return function(){return client[_0x53f9('0x1')](_0x53f9('0x2'),{'options':{'where':{'VoiceQueueId':_0xcd9cab,'paused':!![]},'raw':!![]},'log':_0x53f9('0x0')});};}; \ No newline at end of file +var _0x7ba4=['GetVoiceQueueRtPauses','getVoiceQueueRtPauses','Request'];(function(_0x29e684,_0x1d6a24){var _0x12e7be=function(_0x415d4c){while(--_0x415d4c){_0x29e684['push'](_0x29e684['shift']());}};_0x12e7be(++_0x1d6a24);}(_0x7ba4,0x16c));var _0x47ba=function(_0x215ad1,_0x57a34b){_0x215ad1=_0x215ad1-0x0;var _0x36487e=_0x7ba4[_0x215ad1];return _0x36487e;};'use strict';var client=require('../client');exports[_0x47ba('0x0')]=function(_0x5116ae){return function(){return client[_0x47ba('0x1')](_0x47ba('0x2'),{'options':{'where':{'VoiceQueueId':_0x5116ae,'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 e27347f..205aa50 100644 --- a/server/services/ami/rpc/voiceRecording.js +++ b/server/services/ami/rpc/voiceRecording.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['CreateVoiceRecording','merge','monitorFilename','lodash','../client','create'];(function(_0x50cb5f,_0x105798){var _0x251aa4=function(_0x21ec23){while(--_0x21ec23){_0x50cb5f['push'](_0x50cb5f['shift']());}};_0x251aa4(++_0x105798);}(_0x9957,0x93));var _0x7995=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9957[_0x6131cd];return _0x47e916;};'use strict';var _=require(_0x7995('0x0'));var client=require(_0x7995('0x1'));exports[_0x7995('0x2')]=function(_0x10a05d){return client['Request'](_0x7995('0x3'),{'body':_[_0x7995('0x4')](_0x10a05d,{'value':_0x10a05d[_0x7995('0x5')]}),'log':_0x7995('0x3')});}; \ No newline at end of file +var _0x9957=['CreateVoiceRecording','merge','monitorFilename','lodash','../client','create'];(function(_0x17f113,_0x7279dd){var _0x325ccd=function(_0x3849a8){while(--_0x3849a8){_0x17f113['push'](_0x17f113['shift']());}};_0x325ccd(++_0x7279dd);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'use strict';var _=require(_0x7995('0x0'));var client=require(_0x7995('0x1'));exports[_0x7995('0x2')]=function(_0x10a05d){return client['Request'](_0x7995('0x3'),{'body':_[_0x7995('0x4')](_0x10a05d,{'value':_0x10a05d[_0x7995('0x5')]}),'log':_0x7995('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceTransferReport.js b/server/services/ami/rpc/voiceTransferReport.js index 3d3d750..dda6fdd 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 _0x5c5f=['transfereeconnectedlinenum','transfereeaccountcode','transfereecontext','transfereeexten','isexternal','context','extension','blind','CreateVoiceTransferReport','origtransfererchannel','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','origtransferercontext','origtransfererexten','attended','../client','transfers','blindTransfer','Request','result','transfererchannel','transferercalleridnum','transferercalleridname','transfererconnectedlinenum','transfererconnectedlinename','transferercontext','transfererexten','transfererlinkedid','transfereechannel','transfereecalleridnum'];(function(_0x1d62b6,_0xa0bba9){var _0x4339cf=function(_0x57c232){while(--_0x57c232){_0x1d62b6['push'](_0x1d62b6['shift']());}};_0x4339cf(++_0xa0bba9);}(_0x5c5f,0x6f));var _0xf5c5=function(_0x4285a7,_0x48e566){_0x4285a7=_0x4285a7-0x0;var _0x21d936=_0x5c5f[_0x4285a7];return _0x21d936;};'use strict';var client=require(_0xf5c5('0x0'));exports[_0xf5c5('0x1')]={};exports[_0xf5c5('0x2')]=function(_0x308a77){return client[_0xf5c5('0x3')]('CreateVoiceTransferReport',{'body':{'result':_0x308a77[_0xf5c5('0x4')],'transfererchannel':_0x308a77[_0xf5c5('0x5')],'transferercalleridnum':_0x308a77[_0xf5c5('0x6')],'transferercalleridname':_0x308a77[_0xf5c5('0x7')],'transfererconnectedlinenum':_0x308a77[_0xf5c5('0x8')],'transfererconnectedlinename':_0x308a77[_0xf5c5('0x9')],'transfereraccountcode':_0x308a77['transfereraccountcode'],'transferercontext':_0x308a77[_0xf5c5('0xa')],'transfererexten':_0x308a77[_0xf5c5('0xb')],'transfererlinkedid':_0x308a77[_0xf5c5('0xc')],'transfereechannel':_0x308a77[_0xf5c5('0xd')],'transfereecalleridnum':_0x308a77[_0xf5c5('0xe')],'transfereecalleridname':_0x308a77['transfereecalleridname'],'transfereeconnectedlinenum':_0x308a77[_0xf5c5('0xf')],'transfereeconnectedlinename':_0x308a77['transfereeconnectedlinename'],'transfereeaccountcode':_0x308a77[_0xf5c5('0x10')],'transfereecontext':_0x308a77[_0xf5c5('0x11')],'transfereeexten':_0x308a77[_0xf5c5('0x12')],'transfereelinkedid':_0x308a77['transfereelinkedid'],'isexternal':_0x308a77[_0xf5c5('0x13')],'context':_0x308a77[_0xf5c5('0x14')],'extension':_0x308a77[_0xf5c5('0x15')],'type':_0xf5c5('0x16')},'log':_0xf5c5('0x17')});};exports['attendedTransfer']=function(_0x35b770){return client['Request'](_0xf5c5('0x17'),{'body':{'result':_0x35b770[_0xf5c5('0x4')],'transfererchannel':_0x35b770[_0xf5c5('0x18')],'transferercalleridnum':_0x35b770['origtransferercalleridnum'],'transferercalleridname':_0x35b770[_0xf5c5('0x19')],'transfererconnectedlinenum':_0x35b770[_0xf5c5('0x1a')],'transfererconnectedlinename':_0x35b770[_0xf5c5('0x1b')],'transfereraccountcode':_0x35b770[_0xf5c5('0x1c')],'transferercontext':_0x35b770[_0xf5c5('0x1d')],'transfererexten':_0x35b770[_0xf5c5('0x1e')],'transfererlinkedid':_0x35b770[_0xf5c5('0x1f')],'transfereechannel':_0x35b770[_0xf5c5('0x20')],'transfereecalleridnum':_0x35b770[_0xf5c5('0x21')],'transfereecalleridname':_0x35b770[_0xf5c5('0x22')],'transfereeconnectedlinenum':_0x35b770['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x35b770['transfertargetconnectedlinename'],'transfereeaccountcode':_0x35b770[_0xf5c5('0x23')],'transfereecontext':_0x35b770[_0xf5c5('0x24')],'transfereeexten':_0x35b770[_0xf5c5('0x25')],'transfereelinkedid':_0x35b770[_0xf5c5('0x26')],'isexternal':_0x35b770[_0xf5c5('0x13')],'context':_0x35b770[_0xf5c5('0x27')],'extension':_0x35b770[_0xf5c5('0x28')],'type':_0xf5c5('0x29')},'log':'CreateVoiceTransferReport'});}; \ No newline at end of file +var _0xe014=['transfererconnectedlinenum','transfererconnectedlinename','transfereraccountcode','transferercontext','transfererlinkedid','transfereechannel','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinenum','transfereeconnectedlinename','transfereeaccountcode','transfereecontext','transfereeexten','transfereelinkedid','isexternal','context','extension','blind','attendedTransfer','origtransfererchannel','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinenum','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridnum','transfertargetconnectedlinenum','transfertargetaccountcode','transfertargetcontext','origtransferercontext','origtransfererexten','transfers','blindTransfer','Request','CreateVoiceTransferReport','result','transfererchannel','transferercalleridnum','transferercalleridname'];(function(_0x40220a,_0x22feb1){var _0x3903cc=function(_0x33a296){while(--_0x33a296){_0x40220a['push'](_0x40220a['shift']());}};_0x3903cc(++_0x22feb1);}(_0xe014,0x148));var _0x4e01=function(_0x109a9e,_0x404cbd){_0x109a9e=_0x109a9e-0x0;var _0x1f4c19=_0xe014[_0x109a9e];return _0x1f4c19;};'use strict';var client=require('../client');exports[_0x4e01('0x0')]={};exports[_0x4e01('0x1')]=function(_0x535044){return client[_0x4e01('0x2')](_0x4e01('0x3'),{'body':{'result':_0x535044[_0x4e01('0x4')],'transfererchannel':_0x535044[_0x4e01('0x5')],'transferercalleridnum':_0x535044[_0x4e01('0x6')],'transferercalleridname':_0x535044[_0x4e01('0x7')],'transfererconnectedlinenum':_0x535044[_0x4e01('0x8')],'transfererconnectedlinename':_0x535044[_0x4e01('0x9')],'transfereraccountcode':_0x535044[_0x4e01('0xa')],'transferercontext':_0x535044[_0x4e01('0xb')],'transfererexten':_0x535044['transfererexten'],'transfererlinkedid':_0x535044[_0x4e01('0xc')],'transfereechannel':_0x535044[_0x4e01('0xd')],'transfereecalleridnum':_0x535044[_0x4e01('0xe')],'transfereecalleridname':_0x535044[_0x4e01('0xf')],'transfereeconnectedlinenum':_0x535044[_0x4e01('0x10')],'transfereeconnectedlinename':_0x535044[_0x4e01('0x11')],'transfereeaccountcode':_0x535044[_0x4e01('0x12')],'transfereecontext':_0x535044[_0x4e01('0x13')],'transfereeexten':_0x535044[_0x4e01('0x14')],'transfereelinkedid':_0x535044[_0x4e01('0x15')],'isexternal':_0x535044[_0x4e01('0x16')],'context':_0x535044[_0x4e01('0x17')],'extension':_0x535044[_0x4e01('0x18')],'type':_0x4e01('0x19')},'log':_0x4e01('0x3')});};exports[_0x4e01('0x1a')]=function(_0x559dec){return client['Request'](_0x4e01('0x3'),{'body':{'result':_0x559dec[_0x4e01('0x4')],'transfererchannel':_0x559dec[_0x4e01('0x1b')],'transferercalleridnum':_0x559dec[_0x4e01('0x1c')],'transferercalleridname':_0x559dec[_0x4e01('0x1d')],'transfererconnectedlinenum':_0x559dec[_0x4e01('0x1e')],'transfererconnectedlinename':_0x559dec['secondtransfererconnectedlinename'],'transfereraccountcode':_0x559dec[_0x4e01('0x1f')],'transferercontext':_0x559dec[_0x4e01('0x20')],'transfererexten':_0x559dec[_0x4e01('0x21')],'transfererlinkedid':_0x559dec[_0x4e01('0x22')],'transfereechannel':_0x559dec[_0x4e01('0x23')],'transfereecalleridnum':_0x559dec[_0x4e01('0x24')],'transfereecalleridname':_0x559dec['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x559dec[_0x4e01('0x25')],'transfereeconnectedlinename':_0x559dec['transfertargetconnectedlinename'],'transfereeaccountcode':_0x559dec[_0x4e01('0x26')],'transfereecontext':_0x559dec[_0x4e01('0x27')],'transfereeexten':_0x559dec['transfertargetexten'],'transfereelinkedid':_0x559dec['transfertargetlinkedid'],'isexternal':_0x559dec[_0x4e01('0x16')],'context':_0x559dec[_0x4e01('0x28')],'extension':_0x559dec[_0x4e01('0x29')],'type':'attended'},'log':_0x4e01('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index ed3f15a..7a9cba7 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(_0x5e0075,_0x92537b){var _0x5b5206=function(_0x2d4cd1){while(--_0x2d4cd1){_0x5e0075['push'](_0x5e0075['shift']());}};_0x5b5206(++_0x92537b);}(_0xb10b,0x12a));var _0xbb10=function(_0x1b046f,_0x8e5fa6){_0x1b046f=_0x1b046f-0x0;var _0x1f6c8f=_0xb10b[_0x1b046f];return _0x1f6c8f;};'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(_0x53a301,_0x213873){var _0x3ffcca=function(_0x27f530){while(--_0x27f530){_0x53a301['push'](_0x53a301['shift']());}};_0x3ffcca(++_0x213873);}(_0x7a54,0x106));var _0x47a5=function(_0x57fbac,_0x353e70){_0x57fbac=_0x57fbac-0x0;var _0xbeb7e8=_0x7a54[_0x57fbac];return _0xbeb7e8;};'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 1f6c38e..25733d4 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 _0x8135=['split','phone','destcalleridnum','calleridnum','routeId','firstName','lastName','mobile','fax','ListId','createdAt','scheduledAt','updatedAt','union','then','getContacts','[CM][%s][%s]\x20Contact\x20found:%s','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','uniqueid','map','join','[CM][%s][%s]\x20Contact\x20not\x20found','data4','calleridname','','Unknown','destcalleridname','createContact','[CM][%s][%s]\x20Autocreate\x20disabled','push','format','user:%s','name','trigger:%s','toLowerCase','merge','length','lodash','bluebird','ioredis','util','trigger','defaults','redis','localhost','socket.io-emitter','info','[CM][%s][%s]','stringify','emit','exec','data1','data2','isNil','data5','xmd-contactid','data3'];(function(_0x304dad,_0x246701){var _0x8ece72=function(_0x1f4f98){while(--_0x1f4f98){_0x304dad['push'](_0x304dad['shift']());}};_0x8ece72(++_0x246701);}(_0x8135,0x17b));var _0x5813=function(_0x191c4b,_0x24bde7){_0x191c4b=_0x191c4b-0x0;var _0x551fd3=_0x8135[_0x191c4b];return _0x551fd3;};'use strict';var _=require(_0x5813('0x0'));var BPromise=require(_0x5813('0x1'));var Redis=require(_0x5813('0x2'));var util=require(_0x5813('0x3'));var config=require('../../../../config/environment');var logger=require('../../../../config/logger')(_0x5813('0x4'));var cmContactRpc=require('../../rpc/cmContact');config['redis']=_[_0x5813('0x5')](config[_0x5813('0x6')],{'host':_0x5813('0x7'),'port':0x18eb});var io=require(_0x5813('0x8'))(new Redis(config['redis']));function emit(_0x17e6cb,_0x4b77b3,_0x4ec8dd,_0x34f21d,_0x20ff48){logger[_0x5813('0x9')](_0x5813('0xa'),_0x17e6cb,_0x4b77b3['id'],_0x4ec8dd,_0x34f21d,JSON[_0x5813('0xb')](_0x20ff48));io['to'](_0x4ec8dd)[_0x5813('0xc')](_0x34f21d,_0x20ff48);}exports[_0x5813('0xd')]=function(_0x17b3aa,_0xe1d5c4,_0x3f7b01,_0x501acb){var _0x5c0d55,_0x495cf4;var _0x506516={};var _0x409d5d;var _0xed74f5=Number(_0x3f7b01[_0x5813('0xe')]);var _0x5be7b6=_0x3f7b01[_0x5813('0xf')]?Boolean(Number(_0x3f7b01[_0x5813('0xf')])):![];var _0x1c68d3;var _0x553b66=![];if(!_[_0x5813('0x10')](_0x3f7b01[_0x5813('0x11')])){if(_0x3f7b01[_0x5813('0x11')]=='1')_0x553b66=!![];}if(!_0x553b66){if(_0x501acb[_0x5813('0x12')]){_0x506516['id']=_0x501acb[_0x5813('0x12')];}}if(!_0x506516['id']){_0x506516['ListId']=_0xed74f5;_0x1c68d3=_0x3f7b01['data3']&&_0x3f7b01[_0x5813('0x13')]!=='0'?_0x3f7b01['data3'][_0x5813('0x14')](','):[_0x5813('0x15')];_0x506516['$or']=_['map'](_0x1c68d3,function(_0x349059){var _0x9f2dd8={};_0x9f2dd8[_0x349059]=_0x501acb['routeId']?_0x501acb[_0x5813('0x16')]:_0x501acb[_0x5813('0x17')];return _0x9f2dd8;});_0x409d5d=_0x501acb[_0x5813('0x18')]?_0x501acb[_0x5813('0x16')]:_0x501acb[_0x5813('0x17')];}var _0x20c4a3=['id',_0x5813('0x19'),_0x5813('0x1a'),_0x5813('0x15'),_0x5813('0x1b'),_0x5813('0x1c'),_0x5813('0x1d'),_0x5813('0x1e'),_0x5813('0x1f'),_0x5813('0x20')];var _0x4a92ed=_[_0x5813('0x21')](_0x20c4a3,_0x1c68d3);BPromise['resolve']()[_0x5813('0x22')](cmContactRpc[_0x5813('0x23')]({'attributes':_0x4a92ed,'where':_0x506516,'phone':_0x409d5d}))[_0x5813('0x22')](function(_0x2a5f35){_0x495cf4=_0x2a5f35;if(!_['isEmpty'](_0x495cf4)){if(_0x495cf4['length']===0x1){_0x5c0d55=_0x495cf4[0x0];logger[_0x5813('0x9')](_0x5813('0x24'),_0x501acb['uniqueid'],_0xe1d5c4['id'],_0x5c0d55['id']);}else{logger['info'](_0x5813('0x25'),_0x501acb[_0x5813('0x26')],_0xe1d5c4['id'],_[_0x5813('0x27')](_0x495cf4,'id')[_0x5813('0x28')](','));}return;}else{logger[_0x5813('0x9')](_0x5813('0x29'),_0x501acb['uniqueid'],_0xe1d5c4['id']);var _0x4cbb8e={'ListId':_0xed74f5};var _0x17e8e3=_0x3f7b01[_0x5813('0x2a')]&&_0x3f7b01[_0x5813('0x2a')]!=='0'?_0x3f7b01[_0x5813('0x2a')]:_0x5813('0x15');if(_0x5be7b6){logger[_0x5813('0x9')]('[CM][%s][%s]\x20Autocreate\x20enabled',_0x501acb['uniqueid'],_0xe1d5c4['id']);_0x4cbb8e[_0x17e8e3]=_[_0x5813('0x10')](_0x501acb['routeId'])?_0x501acb[_0x5813('0x17')]:_0x501acb['destcalleridnum'];if(_['isNil'](_0x501acb[_0x5813('0x18')])){_0x4cbb8e['firstName']=_0x501acb[_0x5813('0x2b')]&&_0x501acb[_0x5813('0x2b')]!==_0x5813('0x2c')?_0x501acb['calleridname']:_0x5813('0x2d');}else{_0x4cbb8e[_0x5813('0x19')]=_0x501acb[_0x5813('0x2e')]&&_0x501acb['destcalleridname']!==_0x5813('0x2c')?_0x501acb['destcalleridname']:_0x5813('0x2d');}return BPromise['resolve']()[_0x5813('0x22')](cmContactRpc[_0x5813('0x2f')](_0x4cbb8e))['then'](function(_0x52f849){_0x5c0d55=_0x52f849;_0x495cf4['push'](_0x52f849);if(_0x5c0d55){logger[_0x5813('0x9')]('[CM][%s][%s]\x20Contact\x20created:%s',_0x501acb['uniqueid'],_0xe1d5c4['id'],_0x5c0d55['id']);}return;});}else{logger[_0x5813('0x9')](_0x5813('0x30'),_0x501acb[_0x5813('0x26')],_0xe1d5c4['id']);_0x4cbb8e[_0x17e8e3]=_[_0x5813('0x10')](_0x501acb['routeId'])?_0x501acb[_0x5813('0x17')]:_0x501acb['destcalleridnum'];if(_[_0x5813('0x10')](_0x501acb['routeId'])){_0x4cbb8e[_0x5813('0x19')]=_0x501acb[_0x5813('0x2b')]&&_0x501acb[_0x5813('0x2b')]!==''?_0x501acb['calleridname']:_0x5813('0x2d');}else{_0x4cbb8e['firstName']=_0x501acb['destcalleridname']&&_0x501acb['destcalleridname']!==''?_0x501acb['destcalleridname']:_0x5813('0x2d');}_0x5c0d55=_0x4cbb8e;_0x495cf4[_0x5813('0x31')](_0x4cbb8e);return;}}})['then'](function(){if(_0x17b3aa){emit(_0x501acb[_0x5813('0x26')],_0xe1d5c4,util[_0x5813('0x32')](_0x5813('0x33'),_0x17b3aa[_0x5813('0x34')]),util[_0x5813('0x32')](_0x5813('0x35'),_0x3f7b01['action'][_0x5813('0x36')]()),{'evt':_[_0x5813('0x37')](_0x501acb,{'autoCreate':_0x5be7b6}),'contact':_0x5c0d55===undefined?{}:_0x5c0d55,'contacts':_0x495cf4[_0x5813('0x38')]===0x0?undefined:_0x495cf4});}});}; \ No newline at end of file +var _0x9bc8=['[CM][%s][%s]\x20Contact\x20not\x20found','data4','firstName','calleridname','','destcalleridname','createContact','[CM][%s][%s]\x20Autocreate\x20disabled','Unknown','push','format','action','toLowerCase','lodash','bluebird','ioredis','util','../../../../config/environment','../../../../config/logger','trigger','../../rpc/cmContact','localhost','socket.io-emitter','info','stringify','emit','exec','data2','isNil','data5','xmd-contactid','ListId','data3','split','phone','$or','map','routeId','destcalleridnum','calleridnum','lastName','fax','scheduledAt','union','resolve','then','isEmpty','length','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','join'];(function(_0x82129b,_0x484ae9){var _0x2ae5dc=function(_0x299e34){while(--_0x299e34){_0x82129b['push'](_0x82129b['shift']());}};_0x2ae5dc(++_0x484ae9);}(_0x9bc8,0xa6));var _0x89bc=function(_0xe4db4b,_0x54f6af){_0xe4db4b=_0xe4db4b-0x0;var _0x5d7ac0=_0x9bc8[_0xe4db4b];return _0x5d7ac0;};'use strict';var _=require(_0x89bc('0x0'));var BPromise=require(_0x89bc('0x1'));var Redis=require(_0x89bc('0x2'));var util=require(_0x89bc('0x3'));var config=require(_0x89bc('0x4'));var logger=require(_0x89bc('0x5'))(_0x89bc('0x6'));var cmContactRpc=require(_0x89bc('0x7'));config['redis']=_['defaults'](config['redis'],{'host':_0x89bc('0x8'),'port':0x18eb});var io=require(_0x89bc('0x9'))(new Redis(config['redis']));function emit(_0x24ab05,_0xfe1182,_0xfc7b72,_0x1ef70a,_0x3ce421){logger[_0x89bc('0xa')]('[CM][%s][%s]',_0x24ab05,_0xfe1182['id'],_0xfc7b72,_0x1ef70a,JSON[_0x89bc('0xb')](_0x3ce421));io['to'](_0xfc7b72)[_0x89bc('0xc')](_0x1ef70a,_0x3ce421);}exports[_0x89bc('0xd')]=function(_0x162316,_0x480e16,_0x22d594,_0x453f00){var _0x42bd9e,_0x41ba91;var _0x5cb51f={};var _0x113949;var _0x3e149b=Number(_0x22d594['data1']);var _0x10642d=_0x22d594[_0x89bc('0xe')]?Boolean(Number(_0x22d594['data2'])):![];var _0xe22438;var _0x1a0900=![];if(!_[_0x89bc('0xf')](_0x22d594['data5'])){if(_0x22d594[_0x89bc('0x10')]=='1')_0x1a0900=!![];}if(!_0x1a0900){if(_0x453f00[_0x89bc('0x11')]){_0x5cb51f['id']=_0x453f00['xmd-contactid'];}}if(!_0x5cb51f['id']){_0x5cb51f[_0x89bc('0x12')]=_0x3e149b;_0xe22438=_0x22d594[_0x89bc('0x13')]&&_0x22d594[_0x89bc('0x13')]!=='0'?_0x22d594[_0x89bc('0x13')][_0x89bc('0x14')](','):[_0x89bc('0x15')];_0x5cb51f[_0x89bc('0x16')]=_[_0x89bc('0x17')](_0xe22438,function(_0x57efbf){var _0xfee75={};_0xfee75[_0x57efbf]=_0x453f00[_0x89bc('0x18')]?_0x453f00[_0x89bc('0x19')]:_0x453f00[_0x89bc('0x1a')];return _0xfee75;});_0x113949=_0x453f00[_0x89bc('0x18')]?_0x453f00[_0x89bc('0x19')]:_0x453f00[_0x89bc('0x1a')];}var _0x5e85a5=['id','firstName',_0x89bc('0x1b'),'phone','mobile',_0x89bc('0x1c'),'ListId','createdAt',_0x89bc('0x1d'),'updatedAt'];var _0x5b3dc2=_[_0x89bc('0x1e')](_0x5e85a5,_0xe22438);BPromise[_0x89bc('0x1f')]()['then'](cmContactRpc['getContacts']({'attributes':_0x5b3dc2,'where':_0x5cb51f,'phone':_0x113949}))[_0x89bc('0x20')](function(_0x1a2f21){_0x41ba91=_0x1a2f21;if(!_[_0x89bc('0x21')](_0x41ba91)){if(_0x41ba91[_0x89bc('0x22')]===0x1){_0x42bd9e=_0x41ba91[0x0];logger[_0x89bc('0xa')](_0x89bc('0x23'),_0x453f00['uniqueid'],_0x480e16['id'],_0x42bd9e['id']);}else{logger[_0x89bc('0xa')]('[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]',_0x453f00[_0x89bc('0x24')],_0x480e16['id'],_[_0x89bc('0x17')](_0x41ba91,'id')[_0x89bc('0x25')](','));}return;}else{logger[_0x89bc('0xa')](_0x89bc('0x26'),_0x453f00[_0x89bc('0x24')],_0x480e16['id']);var _0xd23455={'ListId':_0x3e149b};var _0x3d7c1e=_0x22d594[_0x89bc('0x27')]&&_0x22d594[_0x89bc('0x27')]!=='0'?_0x22d594[_0x89bc('0x27')]:_0x89bc('0x15');if(_0x10642d){logger[_0x89bc('0xa')]('[CM][%s][%s]\x20Autocreate\x20enabled',_0x453f00['uniqueid'],_0x480e16['id']);_0xd23455[_0x3d7c1e]=_[_0x89bc('0xf')](_0x453f00[_0x89bc('0x18')])?_0x453f00['calleridnum']:_0x453f00['destcalleridnum'];if(_[_0x89bc('0xf')](_0x453f00[_0x89bc('0x18')])){_0xd23455[_0x89bc('0x28')]=_0x453f00[_0x89bc('0x29')]&&_0x453f00[_0x89bc('0x29')]!==_0x89bc('0x2a')?_0x453f00[_0x89bc('0x29')]:'Unknown';}else{_0xd23455['firstName']=_0x453f00[_0x89bc('0x2b')]&&_0x453f00[_0x89bc('0x2b')]!==_0x89bc('0x2a')?_0x453f00['destcalleridname']:'Unknown';}return BPromise[_0x89bc('0x1f')]()['then'](cmContactRpc[_0x89bc('0x2c')](_0xd23455))[_0x89bc('0x20')](function(_0x195075){_0x42bd9e=_0x195075;_0x41ba91['push'](_0x195075);if(_0x42bd9e){logger[_0x89bc('0xa')]('[CM][%s][%s]\x20Contact\x20created:%s',_0x453f00['uniqueid'],_0x480e16['id'],_0x42bd9e['id']);}return;});}else{logger[_0x89bc('0xa')](_0x89bc('0x2d'),_0x453f00['uniqueid'],_0x480e16['id']);_0xd23455[_0x3d7c1e]=_['isNil'](_0x453f00['routeId'])?_0x453f00['calleridnum']:_0x453f00[_0x89bc('0x19')];if(_[_0x89bc('0xf')](_0x453f00[_0x89bc('0x18')])){_0xd23455[_0x89bc('0x28')]=_0x453f00[_0x89bc('0x29')]&&_0x453f00[_0x89bc('0x29')]!==_0x89bc('0x2a')?_0x453f00['calleridname']:_0x89bc('0x2e');}else{_0xd23455[_0x89bc('0x28')]=_0x453f00['destcalleridname']&&_0x453f00[_0x89bc('0x2b')]!==_0x89bc('0x2a')?_0x453f00[_0x89bc('0x2b')]:_0x89bc('0x2e');}_0x42bd9e=_0xd23455;_0x41ba91[_0x89bc('0x2f')](_0xd23455);return;}}})['then'](function(){if(_0x162316){emit(_0x453f00[_0x89bc('0x24')],_0x480e16,util['format']('user:%s',_0x162316['name']),util[_0x89bc('0x30')]('trigger:%s',_0x22d594[_0x89bc('0x31')][_0x89bc('0x32')]()),{'evt':_['merge'](_0x453f00,{'autoCreate':_0x10642d}),'contact':_0x42bd9e===undefined?{}:_0x42bd9e,'contacts':_0x41ba91[_0x89bc('0x22')]===0x0?undefined:_0x41ba91});}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index f3427ba..6535036 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 _0x9c01=['every','AllConditions','checkConditions','AnyConditions','some','checkTrigger:\x20trigger','field','account','channel','ChatWebsiteId','operator','value','upperFirst','AccountId','interaction','message','agent','membername','lastevent','mailSubstatus','substatus','offlineMessage','created','equals','util','lodash','url','./urlforward','./integration','./script','../../../config/environment','../../../config/logger','../ami','redis','localhost','socket.io-emitter','popup','winapp','triggers','agents','voiceQueues','templates','voiceExtensions','zendeskAccounts','freshdeskAccounts','salesforceAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','accounts','custom:agentcalled','syncCustomEvent','bind','custom:agentconnect','custom:agentringnoanswer','custom:agentcomplete','custom:agentnosuchnumber','custom:agentnoanswer','custom:agentcongestion','custom:agentreject','custom:amd','custom:queuecallerabandon','custom:timeout','custom:dialbegin','syncAgentDial','custom:dialconnect','custom:dialend','custom:newinteraction','custom:closedinteraction','custom:substatus','custom:incomingmessage','custom:outgoingmessage','custom:acceptmessage','custom:offlineMessage','emit','stringify','prototype','clone','motionChannel','undefined','voice','debug','inspect','checkTriggers','interface','hasOwnProperty','status','checkTrigger','merge','variables','Actions','action','toLowerCase','contactmanager','browser','data1','data2','html','render','template\x20not\x20found','uri','isNil','data3','data4','location','uriLocation','data5','800','windowHeight','data6','winApplication','user:%s','format','trigger:%s:%s','trigger:%s','name','exec','integration','queue','routeId','urlforward','script','parse','query','search','replace','length'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0x9c01,0x1a1));var _0x19c0=function(_0x40d043,_0x5e8a38){_0x40d043=_0x40d043-0x0;var _0x22a8e1=_0x9c01[_0x40d043];return _0x22a8e1;};'use strict';var util=require(_0x19c0('0x0'));var _=require(_0x19c0('0x1'));var url=require(_0x19c0('0x2'));var Mustache=require('mustache');var Redis=require('ioredis');var urlforward=require(_0x19c0('0x3'));var integration=require(_0x19c0('0x4'));var cmContact=require('./cmContact');var script=require(_0x19c0('0x5'));var config=require(_0x19c0('0x6'));var logger=require(_0x19c0('0x7'))('trigger');var ami=require(_0x19c0('0x8'));config[_0x19c0('0x9')]=_['defaults'](config[_0x19c0('0x9')],{'host':_0x19c0('0xa'),'port':0x18eb});var io=require(_0x19c0('0xb'))(new Redis(config['redis']));var operators={'equals':function(_0x2c9b21,_0x5a0d76){return _0x2c9b21==_0x5a0d76;},'not_equals':function(_0x560649,_0x302e86){return _0x560649!=_0x302e86;}};var barAndWebActions=[_0x19c0('0xc'),'url',_0x19c0('0xd')];function Trigger(_0x22e418){this[_0x19c0('0xe')]=_0x22e418[_0x19c0('0xe')];this[_0x19c0('0xf')]=_0x22e418[_0x19c0('0xf')];this['voiceQueues']=_0x22e418[_0x19c0('0x10')];this[_0x19c0('0x11')]=_0x22e418[_0x19c0('0x11')];this[_0x19c0('0x12')]=_0x22e418['voiceExtensions'];this[_0x19c0('0x13')]=_0x22e418[_0x19c0('0x13')];this[_0x19c0('0x14')]=_0x22e418[_0x19c0('0x14')];this[_0x19c0('0x15')]=_0x22e418['salesforceAccounts'];this[_0x19c0('0x16')]=_0x22e418[_0x19c0('0x16')];this[_0x19c0('0x17')]=_0x22e418[_0x19c0('0x17')];this[_0x19c0('0x18')]=_0x22e418[_0x19c0('0x18')];this[_0x19c0('0x19')]=_0x22e418[_0x19c0('0x19')];this[_0x19c0('0x1a')]=_0x22e418[_0x19c0('0x1a')];this['dynamics365Accounts']=_0x22e418[_0x19c0('0x1b')];this['freshsalesAccounts']=_0x22e418[_0x19c0('0x1c')];this[_0x19c0('0x1d')]={'zendesk':this[_0x19c0('0x13')],'salesforce':this[_0x19c0('0x15')],'freshdesk':this[_0x19c0('0x14')],'sugarcrm':this[_0x19c0('0x16')],'zoho':this[_0x19c0('0x17')],'desk':this['deskAccounts'],'vtiger':this[_0x19c0('0x19')],'dynamics365':this['dynamics365Accounts'],'freshsales':this['freshsalesAccounts'],'servicenow':this[_0x19c0('0x1a')]};ami['on'](_0x19c0('0x1e'),this[_0x19c0('0x1f')][_0x19c0('0x20')](this));ami['on'](_0x19c0('0x21'),this[_0x19c0('0x1f')]['bind'](this));ami['on'](_0x19c0('0x22'),this[_0x19c0('0x1f')][_0x19c0('0x20')](this));ami['on'](_0x19c0('0x23'),this['syncCustomEvent'][_0x19c0('0x20')](this));ami['on'](_0x19c0('0x24'),this['syncCustomEvent']['bind'](this));ami['on'](_0x19c0('0x25'),this['syncCustomEvent'][_0x19c0('0x20')](this));ami['on']('custom:agentbusy',this[_0x19c0('0x1f')]['bind'](this));ami['on'](_0x19c0('0x26'),this[_0x19c0('0x1f')][_0x19c0('0x20')](this));ami['on'](_0x19c0('0x27'),this['syncCustomEvent']['bind'](this));ami['on'](_0x19c0('0x28'),this[_0x19c0('0x1f')][_0x19c0('0x20')](this));ami['on'](_0x19c0('0x29'),this['syncCustomEvent'][_0x19c0('0x20')](this));ami['on'](_0x19c0('0x2a'),this[_0x19c0('0x1f')][_0x19c0('0x20')](this));ami['on'](_0x19c0('0x2b'),this[_0x19c0('0x2c')]['bind'](this));ami['on'](_0x19c0('0x2d'),this[_0x19c0('0x2c')][_0x19c0('0x20')](this));ami['on'](_0x19c0('0x2e'),this[_0x19c0('0x2c')]['bind'](this));ami['on'](_0x19c0('0x2f'),this[_0x19c0('0x1f')][_0x19c0('0x20')](this));ami['on'](_0x19c0('0x30'),this[_0x19c0('0x1f')]['bind'](this));ami['on'](_0x19c0('0x31'),this['syncCustomEvent'][_0x19c0('0x20')](this));ami['on'](_0x19c0('0x32'),this['syncCustomEvent']['bind'](this));ami['on'](_0x19c0('0x33'),this[_0x19c0('0x1f')][_0x19c0('0x20')](this));ami['on'](_0x19c0('0x34'),this[_0x19c0('0x1f')][_0x19c0('0x20')](this));ami['on']('custom:rejectmessage',this[_0x19c0('0x1f')][_0x19c0('0x20')](this));ami['on'](_0x19c0('0x35'),this[_0x19c0('0x1f')][_0x19c0('0x20')](this));}Trigger['prototype'][_0x19c0('0x36')]=function(_0xae22ef,_0x235417,_0x56af96){logger['info'](_0xae22ef,_0x235417,JSON[_0x19c0('0x37')](_0x56af96));io['to'](_0xae22ef)[_0x19c0('0x36')](_0x235417,_0x56af96);};Trigger[_0x19c0('0x38')][_0x19c0('0x1f')]=function(_0x38db27){var _0x1de344=_[_0x19c0('0x39')](_0x38db27);if(typeof _0x1de344[_0x19c0('0x3a')]===_0x19c0('0x3b')){_0x1de344['motionChannel']=_0x19c0('0x3c');}logger[_0x19c0('0x3d')](_0x19c0('0x1f'),util[_0x19c0('0x3e')](_0x1de344,{'showHidden':!![],'depth':null}));this[_0x19c0('0x3f')](_0x1de344);};Trigger[_0x19c0('0x38')][_0x19c0('0x2c')]=function(_0x4f64e0){if(this['agents'][_0x4f64e0[_0x19c0('0x40')]]){this[_0x19c0('0x1f')](_0x4f64e0);}};Trigger[_0x19c0('0x38')][_0x19c0('0x3f')]=function(_0x7673a5){var _0x198c1b;for(var _0x448807 in this[_0x19c0('0xe')]){if(this[_0x19c0('0xe')][_0x19c0('0x41')](_0x448807)){if(this[_0x19c0('0xe')][_0x448807][_0x19c0('0x42')]){_0x198c1b=this[_0x19c0('0x43')](this[_0x19c0('0xe')][_0x448807],_0x7673a5);if(_0x198c1b){_[_0x19c0('0x44')](_0x7673a5,_0x7673a5[_0x19c0('0x45')]);for(var _0x3038f8=0x0,_0x369ce0,_0x3aefee,_0x5e57af;_0x3038f80x0){_0x3565cf=_['map'](_0x2dd5f,_0x40dc8f);}return _0x3565cf;}function getCustomFields(_0x33a1a5,_0x4690a6){var _0x45b675=[];var _0x50f9f5={'custom_fields':{}};if(_0x33a1a5[_0x43e7('0x28')]>0x0){_[_0x43e7('0x29')](_0x33a1a5,function(_0x2b85a5){if(_[_0x43e7('0x2a')]([_0x43e7('0x2b'),_0x43e7('0x2c')],_0x2b85a5[_0x43e7('0x2d')])&&_0x2b85a5[_0x43e7('0x2e')]&&!_0x2b85a5[_0x43e7('0x2f')]){_0x50f9f5[_0x2b85a5[_0x43e7('0x2e')]['toLowerCase']()]=_0x2b85a5[_0x43e7('0x30')][_0x43e7('0x21')]();}else if(_[_0x43e7('0x2a')]([_0x43e7('0x2b'),_0x43e7('0x2c')],_0x2b85a5['type'])&&_0x2b85a5[_0x43e7('0x31')]&&_0x2b85a5[_0x43e7('0x2f')]){_0x50f9f5[_0x43e7('0x32')][_0x2b85a5[_0x43e7('0x31')]]=_0x2b85a5['content']['toString']();}else if(_0x2b85a5['type']===_0x43e7('0x33')&&_0x2b85a5[_0x43e7('0x34')]&&_0x2b85a5[_0x43e7('0x31')]&&_0x2b85a5[_0x43e7('0x2f')]){_0x4690a6[_0x2b85a5[_0x43e7('0x34')]]&&(_0x50f9f5[_0x43e7('0x32')][_0x2b85a5['idField']]=_0x4690a6[_0x2b85a5['variableName']]['toString']());}else if(_0x2b85a5['type']==='customVariable'&&_0x2b85a5['Variable']&&_0x2b85a5['Variable'][_0x43e7('0x35')]&&_0x2b85a5['idField']&&_0x2b85a5[_0x43e7('0x2f')]){_0x4690a6[_0x2b85a5[_0x43e7('0x36')][_0x43e7('0x35')][_0x43e7('0x37')]()]&&(_0x50f9f5[_0x43e7('0x32')][_0x2b85a5[_0x43e7('0x31')]]=_0x4690a6[_0x2b85a5[_0x43e7('0x36')]['name']['toLowerCase']()]['toString']());}});}if(_0x50f9f5[_0x43e7('0x38')]){_0x50f9f5[_0x43e7('0x38')]=Number(_0x50f9f5[_0x43e7('0x38')]);}return _0x50f9f5;}function getTicket(_0x16cdba,_0x1b1440,_0x1ed538,_0x1d4589,_0x2ffd43){logger['info'](_0x43e7('0x39'));var _0x2b0ffe=_['merge']({'subject':intUtil[_0x43e7('0x3a')](_0x1d4589['Subjects'],_0x2ffd43,'\x20'),'type':_0x43e7('0x3b'),'status':_0x43e7('0x3c'),'labels':[_0x43e7('0x3d'),_0x43e7('0x3e'),_0x43e7('0x3f')][_0x43e7('0x40')](getTags(_0x1d4589['Tags'],'name')),'description':intUtil[_0x43e7('0x3a')](_0x1d4589[_0x43e7('0x41')],_0x2ffd43,'\x0a'),'_links':{'assigned_user':{'href':util[_0x43e7('0x16')](_0x43e7('0x42'),_0x1b1440['id']),'class':_0x43e7('0x43')}},'message':{'direction':'in','body':intUtil['getString'](_0x1d4589[_0x43e7('0x41')],_0x2ffd43,'\x0a')}},getCustomFields(_0x1d4589[_0x43e7('0x44')],_0x2ffd43));return request({'uri':util['format'](_0x43e7('0x45'),_0x16cdba['remoteUri'],_0x1ed538['id']),'method':_0x43e7('0x27'),'body':_0x2b0ffe});}exports['queue']=function(_0x3d81ae,_0x3b4235,_0x3a5807,_0x1c2c6b,_0x49b866,_0x47d6a1){var _0x103393,_0x40c509;_0x47d6a1[_0x43e7('0x14')]=intUtil[_0x43e7('0x46')](_0x47d6a1['remoteUri']);_0x47d6a1['serverUrl']=intUtil['stripTrailingSlash'](_0x47d6a1[_0x43e7('0x47')]);if(_0x49b866&&_0x49b866['monitor_format']){logger[_0x43e7('0xb')]('[QUEUE]','Recording\x20is\x20enabled!');_0x3b4235[_0x43e7('0x48')]=util['format'](_0x43e7('0x49'),_0x47d6a1[_0x43e7('0x47')],_0x3b4235[_0x43e7('0x4a')],md5(_0x3b4235[_0x43e7('0x4a')]));}else{_0x3b4235['recordingURL']='';}headers[_0x43e7('0x4b')]=getAuth(_0x47d6a1);return getUser(_0x47d6a1,_0x1c2c6b[_0x43e7('0x4c')])[_0x43e7('0xe')](function(_0x1fd277){_0x103393=_0x1fd277;logger[_0x43e7('0xb')](_0x43e7('0x4d'),_0x103393['id']);return getEndUser(_0x47d6a1,_0x3b4235['calleridname'],_0x3b4235['calleridnum']);})[_0x43e7('0xe')](function(_0x36a09e){_0x40c509=_0x36a09e;logger[_0x43e7('0xb')]('The\x20Enduser\x20ID\x20is:',_0x40c509['id']);return getTicket(_0x47d6a1,_0x103393,_0x40c509,_0x3a5807,_0x3b4235);})['then'](function(_0x56489b){if(_0x56489b){logger[_0x43e7('0xb')](_0x43e7('0x4e'));logger['info'](_0x43e7('0x4f'),_0x56489b['id']);switch(_0x47d6a1[_0x43e7('0x2d')]){case _0x43e7('0x50'):logger['info']('[QUEUE]','Displaying\x20ticket\x20to\x20agent...');emit(util['format'](_0x43e7('0x51'),_0x1c2c6b[_0x43e7('0x35')]),'trigger:desk:display',{'recordId':_0x56489b['id']});break;case _0x43e7('0x52'):logger[_0x43e7('0xb')](_0x43e7('0x53'),_0x43e7('0x54'));emit(util['format'](_0x43e7('0x51'),_0x1c2c6b['name']),'trigger:browser:url',{'uri':util[_0x43e7('0x16')](_0x43e7('0x55'),_0x56489b['id'])});break;default:logger[_0x43e7('0x56')](_0x43e7('0x53'),_0x43e7('0x57'));}}})[_0x43e7('0x58')](function(_0x1cd87c){console[_0x43e7('0x56')](_0x1cd87c);logger[_0x43e7('0x56')](_0x43e7('0x53'),JSON['stringify'](_0x1cd87c));});};exports[_0x43e7('0x59')]=function(_0x46c910,_0x499c03,_0x39e3ca,_0x4e6f6d,_0x35b799,_0x520857,_0x34e2ec){var _0x1f561f,_0xfe13fa;_0x520857['remoteUri']=intUtil['stripTrailingSlash'](_0x520857[_0x43e7('0x14')]);_0x520857[_0x43e7('0x47')]=intUtil[_0x43e7('0x46')](_0x520857[_0x43e7('0x47')]);if(_0x34e2ec&&_0x34e2ec[_0x43e7('0x5a')]&&_0x34e2ec[_0x43e7('0x5a')]!==_0x43e7('0x5b')){logger[_0x43e7('0xb')](_0x43e7('0x5c'),_0x43e7('0x5d'));_0x499c03[_0x43e7('0x48')]=util['format'](_0x43e7('0x49'),_0x520857[_0x43e7('0x47')],_0x499c03['uniqueid'],md5(_0x499c03[_0x43e7('0x4a')]));}headers[_0x43e7('0x4b')]=getAuth(_0x520857);return getUser(_0x520857,_0x4e6f6d[_0x43e7('0x4c')])['then'](function(_0x5d63c6){_0x1f561f=_0x5d63c6;logger[_0x43e7('0xb')](_0x43e7('0x4d'),_0x1f561f['id']);return getEndUser(_0x520857,_0x499c03['destcalleridname'],_0x499c03[_0x43e7('0x5e')]);})['then'](function(_0x49a6ce){_0xfe13fa=_0x49a6ce;logger[_0x43e7('0xb')](_0x43e7('0x5f'),_0xfe13fa['id']);return getTicket(_0x520857,_0x1f561f,_0xfe13fa,_0x39e3ca,_0x499c03);})[_0x43e7('0xe')](function(_0x40155c){if(_0x40155c){logger[_0x43e7('0xb')]('Ticket\x20created!');logger[_0x43e7('0xb')](_0x43e7('0x4f'),_0x40155c['id']);switch(_0x520857['type']){case _0x43e7('0x50'):logger[_0x43e7('0xb')](_0x43e7('0x53'),'Displaying\x20ticket\x20to\x20agent...');emit(util['format']('user:%s',_0x4e6f6d[_0x43e7('0x35')]),_0x43e7('0x60'),{'recordId':_0x40155c['id']});break;case _0x43e7('0x52'):logger[_0x43e7('0xb')]('[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x43e7('0x16')](_0x43e7('0x51'),_0x4e6f6d[_0x43e7('0x35')]),_0x43e7('0x61'),{'uri':util['format'](_0x43e7('0x62'),_0x520857[_0x43e7('0x14')],_0x40155c['id'])});break;default:logger[_0x43e7('0x56')](_0x43e7('0x5c'),_0x43e7('0x57'));}}})[_0x43e7('0x58')](function(_0x4665db){logger[_0x43e7('0x56')](_0x43e7('0x5c'),JSON[_0x43e7('0x63')](_0x4665db));});};exports[_0x43e7('0x64')]=function(_0x57fdfe,_0x5f3824,_0x2b0711,_0x58a3a8,_0x501616,_0x50edb2){var _0xb3e981,_0xe666b0;_0x50edb2['remoteUri']=intUtil[_0x43e7('0x46')](_0x50edb2[_0x43e7('0x14')]);_0x50edb2[_0x43e7('0x47')]=intUtil['stripTrailingSlash'](_0x50edb2[_0x43e7('0x47')]);if(_0x501616&&_0x501616[_0x43e7('0x65')]){logger[_0x43e7('0xb')]('['+_0x5f3824[_0x43e7('0x66')][_0x43e7('0x67')]()+']',_0x43e7('0x5d'));_0x5f3824[_0x43e7('0x48')]=util['format'](_0x43e7('0x49'),_0x50edb2[_0x43e7('0x47')],_0x5f3824[_0x43e7('0x4a')],md5(_0x5f3824['uniqueid']));}else{_0x5f3824['recordingURL']='';}headers[_0x43e7('0x4b')]=getAuth(_0x50edb2);return getUser(_0x50edb2)['then'](function(_0x5cb26e){_0xb3e981=_0x5cb26e;logger[_0x43e7('0xb')](_0x43e7('0x4d'),_0xb3e981['id']);return getEndUser(_0x50edb2,_0x5f3824['calleridname'],_0x5f3824[_0x43e7('0x68')]);})[_0x43e7('0xe')](function(_0x1e2fed){_0xe666b0=_0x1e2fed;logger[_0x43e7('0xb')](_0x43e7('0x5f'),_0xe666b0['id']);return getTicket(_0x50edb2,_0xb3e981,_0xe666b0,_0x2b0711,_0x5f3824);})[_0x43e7('0xe')](function(_0x398a78){if(_0x398a78){logger['info'](_0x43e7('0x4e'));logger[_0x43e7('0xb')]('The\x20Ticket\x20ID\x20is:',_0x398a78['id']);}})[_0x43e7('0x58')](function(_0x5c2c5f){logger[_0x43e7('0x56')]('['+_0x5f3824[_0x43e7('0x66')][_0x43e7('0x67')]()+']',JSON[_0x43e7('0x63')](_0x5c2c5f));});}; \ No newline at end of file +var _0x9957=['Motion','CTI','concat','Tags','/api/v2/users/%d','Descriptions','%s/customers/%d/cases','serverUrl','stripTrailingSlash','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Ticket\x20created!','Displaying\x20ticket\x20to\x20agent...','user:%s','trigger:desk:display','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','Desk\x20account\x20type\x20not\x20recognized','error','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','integrationTab','newTab','%s/agent/tickets/%s','catch','unmanaged','monitor_format','lastevent','The\x20Ticket\x20ID\x20is:','toUpperCase','lodash','request-promise','md5','util','./util','../../../../config/environment','../../../../config/logger','desk','defaults','redis','localhost','socket.io-emitter','emit','application/json','validateEmail','info','Getting\x20agent\x20with\x20email','format','remoteUri','then','total_entries','find','_embedded','entries','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','[HTTP]','stringify','GET','password','authType','token','Basic\x20%s','toString','base64','Searching\x20enduser\x20with\x20phone','%s/customers/search','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/customers','POST','work','map','includes','string','picklist','type','nameField','customField','content','idField','custom_fields','variable','variableName','customVariable','name','Variable','toLowerCase','priority','Creating\x20new\x20ticket...','merge','getString','Subjects','phone','new','xCALLY'];(function(_0x146696,_0x487a50){var _0x34ae43=function(_0x469aee){while(--_0x469aee){_0x146696['push'](_0x146696['shift']());}};_0x34ae43(++_0x487a50);}(_0x9957,0x93));var _0x7995=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x9957[_0x3b380d];return _0x54502b;};'use strict';var _=require(_0x7995('0x0'));var rp=require(_0x7995('0x1'));var md5=require(_0x7995('0x2'));var util=require(_0x7995('0x3'));var Redis=require('ioredis');var intUtil=require(_0x7995('0x4'));var config=require(_0x7995('0x5'));var logger=require(_0x7995('0x6'))(_0x7995('0x7'));config['redis']=_[_0x7995('0x8')](config[_0x7995('0x9')],{'host':_0x7995('0xa'),'port':0x18eb});var io=require(_0x7995('0xb'))(new Redis(config[_0x7995('0x9')]));function emit(_0x326741,_0x4996ca,_0x465276){io['to'](_0x326741)[_0x7995('0xc')](_0x4996ca,_0x465276);}var headers={'Content-Type':'application/json','Accept':_0x7995('0xd')};function getUser(_0x3116fb,_0x18c8a3){if(intUtil[_0x7995('0xe')](_0x18c8a3)===!![]){logger[_0x7995('0xf')](_0x7995('0x10'),_0x18c8a3);return request({'uri':util[_0x7995('0x11')]('%s/users',_0x3116fb[_0x7995('0x12')])})[_0x7995('0x13')](function(_0x581f22){if(_0x581f22[_0x7995('0x14')]){return _[_0x7995('0x15')](_0x581f22[_0x7995('0x16')][_0x7995('0x17')],{'email':_0x18c8a3});}})[_0x7995('0x13')](function(_0x23999f){if(_0x23999f){logger[_0x7995('0xf')]('Agent\x20found!');return _0x23999f;}else{logger['info'](_0x7995('0x18'));return request({'uri':util[_0x7995('0x11')](_0x7995('0x19'),_0x3116fb[_0x7995('0x12')])});}});}else{logger[_0x7995('0xf')](_0x7995('0x1a'));return request({'uri':util[_0x7995('0x11')](_0x7995('0x19'),_0x3116fb['remoteUri'])});}}function request(_0x2eeacc){logger['debug'](_0x7995('0x1b'),JSON[_0x7995('0x1c')](_0x2eeacc));return rp(_[_0x7995('0x8')](_0x2eeacc,{'method':_0x7995('0x1d'),'headers':headers,'json':!![]}));}function getAuth(_0x1e1415){var _0x37a7d4;if(_0x1e1415['authType']==='basic'){_0x37a7d4=util[_0x7995('0x11')]('%s:%s',_0x1e1415['username'],_0x1e1415[_0x7995('0x1e')]);}else if(_0x1e1415[_0x7995('0x1f')]==='token'){_0x37a7d4=util[_0x7995('0x11')]('%s/token:%s',_0x1e1415['username'],_0x1e1415[_0x7995('0x20')]);}return util[_0x7995('0x11')](_0x7995('0x21'),new Buffer(_0x37a7d4)[_0x7995('0x22')](_0x7995('0x23')));}function getEndUser(_0x1c278a,_0x5d40ae,_0x32a09a){logger[_0x7995('0xf')](_0x7995('0x24'),_0x32a09a);return request({'uri':util[_0x7995('0x11')](_0x7995('0x25'),_0x1c278a[_0x7995('0x12')]),'qs':{'phone':_0x32a09a}})[_0x7995('0x13')](function(_0x472195){if(_0x472195['total_entries']){logger[_0x7995('0xf')](_0x7995('0x26'));return _0x472195[_0x7995('0x16')][_0x7995('0x17')][0x0];}else{logger[_0x7995('0xf')](_0x7995('0x27'));return request({'uri':util['format'](_0x7995('0x28'),_0x1c278a['remoteUri']),'method':_0x7995('0x29'),'body':{'first_name':_0x5d40ae,'title':_0x5d40ae,'phone_numbers':[{'type':_0x7995('0x2a'),'value':_0x32a09a}]}});}});}function getTags(_0xf16cc2,_0x132a42){var _0x11c1eb=[];if(_0xf16cc2&&_0xf16cc2['length']>0x0){_0x11c1eb=_[_0x7995('0x2b')](_0xf16cc2,_0x132a42);}return _0x11c1eb;}function getCustomFields(_0x514445,_0x456a28){var _0x3250e0=[];var _0x4253e5={'custom_fields':{}};if(_0x514445['length']>0x0){_['forEach'](_0x514445,function(_0x48e573){if(_[_0x7995('0x2c')]([_0x7995('0x2d'),_0x7995('0x2e')],_0x48e573[_0x7995('0x2f')])&&_0x48e573[_0x7995('0x30')]&&!_0x48e573[_0x7995('0x31')]){_0x4253e5[_0x48e573['nameField']['toLowerCase']()]=_0x48e573[_0x7995('0x32')]['toString']();}else if(_[_0x7995('0x2c')]([_0x7995('0x2d'),_0x7995('0x2e')],_0x48e573[_0x7995('0x2f')])&&_0x48e573[_0x7995('0x33')]&&_0x48e573['customField']){_0x4253e5[_0x7995('0x34')][_0x48e573[_0x7995('0x33')]]=_0x48e573['content']['toString']();}else if(_0x48e573['type']===_0x7995('0x35')&&_0x48e573[_0x7995('0x36')]&&_0x48e573['idField']&&_0x48e573[_0x7995('0x31')]){_0x456a28[_0x48e573['variableName']]&&(_0x4253e5[_0x7995('0x34')][_0x48e573[_0x7995('0x33')]]=_0x456a28[_0x48e573[_0x7995('0x36')]]['toString']());}else if(_0x48e573['type']===_0x7995('0x37')&&_0x48e573['Variable']&&_0x48e573['Variable'][_0x7995('0x38')]&&_0x48e573[_0x7995('0x33')]&&_0x48e573['customField']){_0x456a28[_0x48e573[_0x7995('0x39')][_0x7995('0x38')][_0x7995('0x3a')]()]&&(_0x4253e5[_0x7995('0x34')][_0x48e573[_0x7995('0x33')]]=_0x456a28[_0x48e573['Variable'][_0x7995('0x38')][_0x7995('0x3a')]()][_0x7995('0x22')]());}});}if(_0x4253e5[_0x7995('0x3b')]){_0x4253e5['priority']=Number(_0x4253e5[_0x7995('0x3b')]);}return _0x4253e5;}function getTicket(_0x235df7,_0x3eb04f,_0xe5ea43,_0x1f5bee,_0x1035dc){logger['info'](_0x7995('0x3c'));var _0x3be298=_[_0x7995('0x3d')]({'subject':intUtil[_0x7995('0x3e')](_0x1f5bee[_0x7995('0x3f')],_0x1035dc,'\x20'),'type':_0x7995('0x40'),'status':_0x7995('0x41'),'labels':[_0x7995('0x42'),_0x7995('0x43'),_0x7995('0x44')][_0x7995('0x45')](getTags(_0x1f5bee[_0x7995('0x46')],_0x7995('0x38'))),'description':intUtil['getString'](_0x1f5bee['Descriptions'],_0x1035dc,'\x0a'),'_links':{'assigned_user':{'href':util[_0x7995('0x11')](_0x7995('0x47'),_0x3eb04f['id']),'class':'user'}},'message':{'direction':'in','body':intUtil['getString'](_0x1f5bee[_0x7995('0x48')],_0x1035dc,'\x0a')}},getCustomFields(_0x1f5bee['Fields'],_0x1035dc));return request({'uri':util['format'](_0x7995('0x49'),_0x235df7[_0x7995('0x12')],_0xe5ea43['id']),'method':_0x7995('0x29'),'body':_0x3be298});}exports['queue']=function(_0x46ac4f,_0x5e85b9,_0x3993b5,_0x5a8881,_0x493066,_0x39c5b8){var _0x403f54,_0xc04e5;_0x39c5b8[_0x7995('0x12')]=intUtil['stripTrailingSlash'](_0x39c5b8[_0x7995('0x12')]);_0x39c5b8[_0x7995('0x4a')]=intUtil[_0x7995('0x4b')](_0x39c5b8[_0x7995('0x4a')]);if(_0x493066&&_0x493066['monitor_format']){logger['info'](_0x7995('0x4c'),'Recording\x20is\x20enabled!');_0x5e85b9[_0x7995('0x4d')]=util['format'](_0x7995('0x4e'),_0x39c5b8['serverUrl'],_0x5e85b9[_0x7995('0x4f')],md5(_0x5e85b9[_0x7995('0x4f')]));}else{_0x5e85b9['recordingURL']='';}headers[_0x7995('0x50')]=getAuth(_0x39c5b8);return getUser(_0x39c5b8,_0x5a8881[_0x7995('0x51')])[_0x7995('0x13')](function(_0xb70a51){_0x403f54=_0xb70a51;logger['info'](_0x7995('0x52'),_0x403f54['id']);return getEndUser(_0x39c5b8,_0x5e85b9[_0x7995('0x53')],_0x5e85b9[_0x7995('0x54')]);})['then'](function(_0xe228a5){_0xc04e5=_0xe228a5;logger[_0x7995('0xf')](_0x7995('0x55'),_0xc04e5['id']);return getTicket(_0x39c5b8,_0x403f54,_0xc04e5,_0x3993b5,_0x5e85b9);})[_0x7995('0x13')](function(_0x255313){if(_0x255313){logger['info'](_0x7995('0x56'));logger[_0x7995('0xf')]('The\x20Ticket\x20ID\x20is:',_0x255313['id']);switch(_0x39c5b8[_0x7995('0x2f')]){case'integrationTab':logger[_0x7995('0xf')](_0x7995('0x4c'),_0x7995('0x57'));emit(util[_0x7995('0x11')](_0x7995('0x58'),_0x5a8881[_0x7995('0x38')]),_0x7995('0x59'),{'recordId':_0x255313['id']});break;case'newTab':logger[_0x7995('0xf')](_0x7995('0x4c'),_0x7995('0x5a'));emit(util['format'](_0x7995('0x58'),_0x5a8881[_0x7995('0x38')]),_0x7995('0x5b'),{'uri':util['format']('https://xcally.desk.com/web/agent/case/%d',_0x255313['id'])});break;default:logger['error'](_0x7995('0x4c'),_0x7995('0x5c'));}}})['catch'](function(_0x1cd85){console[_0x7995('0x5d')](_0x1cd85);logger[_0x7995('0x5d')](_0x7995('0x4c'),JSON[_0x7995('0x1c')](_0x1cd85));});};exports['outbound']=function(_0x29ee32,_0x4ab09f,_0x14fe7f,_0x33c801,_0x206d2a,_0x50c7b5,_0x5e1f34){var _0x54e2b1,_0x563f8e;_0x50c7b5[_0x7995('0x12')]=intUtil[_0x7995('0x4b')](_0x50c7b5[_0x7995('0x12')]);_0x50c7b5[_0x7995('0x4a')]=intUtil[_0x7995('0x4b')](_0x50c7b5[_0x7995('0x4a')]);if(_0x5e1f34&&_0x5e1f34[_0x7995('0x5e')]&&_0x5e1f34[_0x7995('0x5e')]!==_0x7995('0x5f')){logger[_0x7995('0xf')](_0x7995('0x60'),_0x7995('0x61'));_0x4ab09f[_0x7995('0x4d')]=util[_0x7995('0x11')](_0x7995('0x4e'),_0x50c7b5[_0x7995('0x4a')],_0x4ab09f[_0x7995('0x4f')],md5(_0x4ab09f[_0x7995('0x4f')]));}headers[_0x7995('0x50')]=getAuth(_0x50c7b5);return getUser(_0x50c7b5,_0x33c801['email'])[_0x7995('0x13')](function(_0x630737){_0x54e2b1=_0x630737;logger[_0x7995('0xf')](_0x7995('0x52'),_0x54e2b1['id']);return getEndUser(_0x50c7b5,_0x4ab09f['destcalleridname'],_0x4ab09f['destcalleridnum']);})[_0x7995('0x13')](function(_0x197b52){_0x563f8e=_0x197b52;logger[_0x7995('0xf')](_0x7995('0x55'),_0x563f8e['id']);return getTicket(_0x50c7b5,_0x54e2b1,_0x563f8e,_0x14fe7f,_0x4ab09f);})['then'](function(_0x13cd7b){if(_0x13cd7b){logger[_0x7995('0xf')](_0x7995('0x56'));logger[_0x7995('0xf')]('The\x20Ticket\x20ID\x20is:',_0x13cd7b['id']);switch(_0x50c7b5['type']){case _0x7995('0x62'):logger[_0x7995('0xf')](_0x7995('0x4c'),_0x7995('0x57'));emit(util[_0x7995('0x11')](_0x7995('0x58'),_0x33c801[_0x7995('0x38')]),_0x7995('0x59'),{'recordId':_0x13cd7b['id']});break;case _0x7995('0x63'):logger['info'](_0x7995('0x4c'),_0x7995('0x5a'));emit(util[_0x7995('0x11')](_0x7995('0x58'),_0x33c801['name']),'trigger:browser:url',{'uri':util[_0x7995('0x11')](_0x7995('0x64'),_0x50c7b5['remoteUri'],_0x13cd7b['id'])});break;default:logger[_0x7995('0x5d')](_0x7995('0x60'),_0x7995('0x5c'));}}})[_0x7995('0x65')](function(_0x32cb04){logger['error'](_0x7995('0x60'),JSON['stringify'](_0x32cb04));});};exports[_0x7995('0x66')]=function(_0xe31dcb,_0x1722e2,_0x25b534,_0x4388c1,_0xeb8920,_0x2b3c1d){var _0x44372a,_0x10f012;_0x2b3c1d[_0x7995('0x12')]=intUtil[_0x7995('0x4b')](_0x2b3c1d[_0x7995('0x12')]);_0x2b3c1d['serverUrl']=intUtil[_0x7995('0x4b')](_0x2b3c1d[_0x7995('0x4a')]);if(_0xeb8920&&_0xeb8920[_0x7995('0x67')]){logger[_0x7995('0xf')]('['+_0x1722e2[_0x7995('0x68')]['toUpperCase']()+']','Recording\x20is\x20enabled!');_0x1722e2[_0x7995('0x4d')]=util[_0x7995('0x11')](_0x7995('0x4e'),_0x2b3c1d[_0x7995('0x4a')],_0x1722e2['uniqueid'],md5(_0x1722e2[_0x7995('0x4f')]));}else{_0x1722e2['recordingURL']='';}headers['Authorization']=getAuth(_0x2b3c1d);return getUser(_0x2b3c1d)[_0x7995('0x13')](function(_0x36d27d){_0x44372a=_0x36d27d;logger[_0x7995('0xf')](_0x7995('0x52'),_0x44372a['id']);return getEndUser(_0x2b3c1d,_0x1722e2[_0x7995('0x53')],_0x1722e2[_0x7995('0x54')]);})[_0x7995('0x13')](function(_0x13dc73){_0x10f012=_0x13dc73;logger[_0x7995('0xf')](_0x7995('0x55'),_0x10f012['id']);return getTicket(_0x2b3c1d,_0x44372a,_0x10f012,_0x25b534,_0x1722e2);})['then'](function(_0x2dc1f7){if(_0x2dc1f7){logger[_0x7995('0xf')](_0x7995('0x56'));logger['info'](_0x7995('0x69'),_0x2dc1f7['id']);}})[_0x7995('0x65')](function(_0x705f0){logger[_0x7995('0x5d')]('['+_0x1722e2[_0x7995('0x68')][_0x7995('0x6a')]()+']',JSON[_0x7995('0x1c')](_0x705f0));});}; \ 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 a78c0b8..76856e7 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 _0x8faf=['user:%s','emit','trigger:browser:url','stripTrailingSlash','serverUrl','unmanaged','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','tenantId','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:','additionalSearchContact',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s',']\x20Call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Dynamics365\x20integration','Error\x20running\x20Dynamics365\x20integration','lodash','request-promise','./util','md5','ioredis','../../../../config/logger','dynamics365','../../../../config/environment','redis','localhost','socket.io-emitter','modernAuthentication','remoteUri','CloudProvider','data7','data2','resolve','data5','POST','clientId','clientSecret','then','error',']\x20Wrong\x20credentials!','message','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','4.0','value','isNil','validateEmail','userEmail','length','isdisabled','toUpperCase',']\x20Agent\x20found\x20','systemuserid','userId','info',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','username','internalemailaddress','catch','toLowerCase','destcalleridnum','calleridnum','contacts','/systemusers(','body','headers','substring','lastIndexOf','enduserId','outbound','telephone1','GET','contacts?$select=','&$filter=','\x20eq\x20\x27','%2b','contactid',']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing',']\x20Enduser\x20created!','forEach','string','picklist','type','nameField','customField','idField','indexOf','content','ticketType','incident','assign','Descriptions','/contacts(','Fields','callDirection','queue','phonecalls','Subjects','getString','odata-entityid','ticketId','format'];(function(_0x9db6e0,_0x1b03d0){var _0x6222a=function(_0x4adbdd){while(--_0x4adbdd){_0x9db6e0['push'](_0x9db6e0['shift']());}};_0x6222a(++_0x1b03d0);}(_0x8faf,0xfd));var _0xf8fa=function(_0x1b5aea,_0x3f04b7){_0x1b5aea=_0x1b5aea-0x0;var _0x15cfc6=_0x8faf[_0x1b5aea];return _0x15cfc6;};'use strict';var _=require(_0xf8fa('0x0'));var rp=require(_0xf8fa('0x1'));var util=require('util');var intUtil=require(_0xf8fa('0x2'));var md5=require(_0xf8fa('0x3'));var Redis=require(_0xf8fa('0x4'));var logger=require(_0xf8fa('0x5'))(_0xf8fa('0x6'));var config=require(_0xf8fa('0x7'));config[_0xf8fa('0x8')]=_['defaults'](config[_0xf8fa('0x8')],{'host':_0xf8fa('0x9'),'port':0x18eb});var io=require(_0xf8fa('0xa'))(new Redis(config[_0xf8fa('0x8')]));function getAuthToken(_0x1c4d34,_0x30aa0b,_0x5cbb62){if(_0x1c4d34[_0xf8fa('0xb')]){_0x1c4d34[_0xf8fa('0xc')]=_0x1c4d34[_0xf8fa('0xd')][_0xf8fa('0xe')];_0x1c4d34['tenantId']=_0x1c4d34[_0xf8fa('0xd')][_0xf8fa('0xf')];return Promise[_0xf8fa('0x10')](_0x1c4d34[_0xf8fa('0xd')][_0xf8fa('0x11')]);}var _0x4cf251={'method':_0xf8fa('0x12'),'uri':_0x30aa0b,'form':{'client_id':_0x1c4d34[_0xf8fa('0x13')],'resource':_0x1c4d34[_0xf8fa('0xc')],'username':_0x1c4d34['username'],'password':_0x1c4d34['password'],'grant_type':'password','client_secret':_0x1c4d34[_0xf8fa('0x14')]},'json':!![]};return rp(_0x4cf251)[_0xf8fa('0x15')](function(_0x45bd6c){return _0x45bd6c['access_token'];})['catch'](function(_0x112bd1){logger[_0xf8fa('0x16')]('['+[_0x5cbb62['toUpperCase']()]+_0xf8fa('0x17'));return _0x112bd1[_0xf8fa('0x18')];});}function getUser(_0x4102e1,_0x20be52,_0x43ac51,_0x24b3c9,_0x405cfe,_0x3d87e2){return new Promise(function(_0x4e483e,_0x57e161){return getAuthToken(_0x20be52,_0x24b3c9,_0x3d87e2)[_0xf8fa('0x15')](function(_0x7ea915){var _0x25d1de={'method':'GET','uri':_0x405cfe+_0xf8fa('0x19'),'headers':{'Authorization':_0xf8fa('0x1a')+_0x7ea915,'OData-Version':_0xf8fa('0x1b')},'json':!![]};return rp(_0x25d1de);})[_0xf8fa('0x15')](function(_0x11fe78){var _0x5730dd=_0x11fe78[_0xf8fa('0x1c')];var _0x524a12=![];var _0x2f24c8=null;if(!_[_0xf8fa('0x1d')](_0x43ac51)){if(intUtil[_0xf8fa('0x1e')](_0x43ac51['email'])){_0x4102e1[_0xf8fa('0x1f')]=_0x43ac51['email'];for(_0x2f24c8=0x0;_0x2f24c8<_0x5730dd[_0xf8fa('0x20')];_0x2f24c8++){if(_0x5730dd[_0x2f24c8]['internalemailaddress']===_0x43ac51['email']&&!_0x5730dd[_0x2f24c8][_0xf8fa('0x21')]){_0x524a12=!![];logger['info']('['+[_0x3d87e2[_0xf8fa('0x22')]()]+_0xf8fa('0x23')+_0x5730dd[_0x2f24c8][_0xf8fa('0x24')]+'!');_0x4102e1[_0xf8fa('0x25')]=_0x5730dd[_0x2f24c8][_0xf8fa('0x24')];}}}}if(!_0x524a12){logger[_0xf8fa('0x26')]('['+[_0x3d87e2[_0xf8fa('0x22')]()]+_0xf8fa('0x27'));_0x4102e1[_0xf8fa('0x1f')]=_0x20be52[_0xf8fa('0x28')];for(_0x2f24c8=0x0;_0x2f24c8<_0x5730dd['length'];_0x2f24c8++){if(_0x5730dd[_0x2f24c8][_0xf8fa('0x29')]===_0x20be52[_0xf8fa('0x28')]){_0x4102e1[_0xf8fa('0x25')]=_0x5730dd[_0x2f24c8][_0xf8fa('0x24')];}}}_0x4e483e(_0x4102e1);})[_0xf8fa('0x2a')](function(_0x2cb853){_0x57e161(_0x2cb853[_0xf8fa('0x18')]);});});}function createEndUser(_0x57ac8f,_0x1beb6a,_0x136a57,_0x3b662d,_0x96965d,_0x12ee47,_0x4e85f2){return new Promise(function(_0x19bac3,_0x22b126){return getAuthToken(_0x1beb6a,_0x136a57,_0x12ee47)[_0xf8fa('0x15')](function(_0x124be5){var _0x4cb290=_0x12ee47[_0xf8fa('0x2b')]()==='outbound'?_0x96965d[_0xf8fa('0x2c')]:_0x96965d[_0xf8fa('0x2d')];var _0x423c0e={'method':_0xf8fa('0x12'),'uri':_0x3b662d+_0xf8fa('0x2e'),'body':{'fullname':_0x4cb290,'firstname':_0x4cb290,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0xf8fa('0x2f')+_0x57ac8f['userId']+')'},'headers':{'Authorization':'Bearer\x20'+_0x124be5,'OData-Version':_0xf8fa('0x1b')},'json':!![],'resolveWithFullResponse':!![]};_0x423c0e[_0xf8fa('0x30')][_0x4e85f2]=_0x4cb290;return rp(_0x423c0e);})['then'](function(_0x512f8c){var _0x16048f=_0x512f8c[_0xf8fa('0x31')]['odata-entityid'];var _0x39b9f6=_0x16048f[_0xf8fa('0x32')](_0x16048f[_0xf8fa('0x33')]('(')+0x1,_0x16048f['lastIndexOf'](')'));_0x57ac8f[_0xf8fa('0x34')]=_0x39b9f6;_0x19bac3(_0x57ac8f);})[_0xf8fa('0x2a')](function(_0x2573a1){_0x22b126(_0x2573a1[_0xf8fa('0x18')]);});});}function getEndUser(_0x32ca22,_0xd24b5e,_0x23f54e,_0x5b69d9,_0x264d48,_0x1b4b2f,_0x367973,_0x509715){var _0x507ae2=_0x1b4b2f[_0xf8fa('0x2b')]()===_0xf8fa('0x35')?_0x264d48['destcalleridnum']:_0x264d48[_0xf8fa('0x2d')];return getAuthToken(_0xd24b5e,_0x23f54e,_0x1b4b2f)[_0xf8fa('0x15')](function(_0x54aa36){_0x509715=_0x509715?_0x509715:_0xf8fa('0x36');var _0x12faff={'method':_0xf8fa('0x37'),'uri':_0x5b69d9+_0xf8fa('0x38')+_0x509715+_0xf8fa('0x39')+_0x509715+_0xf8fa('0x3a')+_0x507ae2['replace']('+',_0xf8fa('0x3b'))+'\x27','headers':{'Authorization':'Bearer\x20'+_0x54aa36,'If-None-Match':null,'OData-Version':_0xf8fa('0x1b')},'json':!![]};return rp(_0x12faff);})[_0xf8fa('0x15')](function(_0x3966dd){var _0x2e2980=![];if(!_0x3966dd)return _0x2e2980;var _0x15796e=_0x3966dd['value'];for(var _0x3f0303=0x0;_0x3f0303<_0x15796e[_0xf8fa('0x20')];_0x3f0303++){if(_0x15796e[_0x3f0303][_0x509715]===_0x507ae2){_0x2e2980=!![];_0x32ca22[_0xf8fa('0x34')]=_0x15796e[_0x3f0303][_0xf8fa('0x3c')];}}return _0x2e2980;})[_0xf8fa('0x15')](function(_0x128e8e){if(_0x128e8e)return _0x32ca22;if(_0x367973==='nothing'){logger[_0xf8fa('0x26')]('['+[_0x1b4b2f['toUpperCase']()]+_0xf8fa('0x3d'));return _0x32ca22;}return createEndUser(_0x32ca22,_0xd24b5e,_0x23f54e,_0x5b69d9,_0x264d48,_0x1b4b2f,_0x509715)[_0xf8fa('0x15')](function(_0x2c78e3){logger[_0xf8fa('0x26')]('['+[_0x1b4b2f[_0xf8fa('0x22')]()]+_0xf8fa('0x3e'),_0x2c78e3[_0xf8fa('0x34')]);return _0x2c78e3;});});}function getCustomFields(_0xe14451,_0x43630a,_0x53a42c){var _0x577e4f={};if(_0xe14451[_0xf8fa('0x20')]>0x0){_[_0xf8fa('0x3f')](_0xe14451,function(_0xa3215a){if(_['includes']([_0xf8fa('0x40'),_0xf8fa('0x41')],_0xa3215a[_0xf8fa('0x42')])&&_0xa3215a[_0xf8fa('0x43')]&&!_0xa3215a[_0xf8fa('0x44')]){var _0x1fdd12=_0xa3215a[_0xf8fa('0x45')][_0xf8fa('0x2b')]();var _0x137184=_0x1fdd12[_0xf8fa('0x32')](0x0,_0x1fdd12[_0xf8fa('0x46')]('_'));var _0x3427d6=_0x1fdd12[_0xf8fa('0x32')](_0x1fdd12[_0xf8fa('0x46')]('_')+0x1);if(_0x137184===_0x53a42c){_0x577e4f[_0x3427d6]=_0xa3215a[_0xf8fa('0x47')];}}});}return _0x577e4f;}function getTicket(_0x5ac073,_0x1c1bb4,_0x29e602,_0x39347d,_0x11c60e,_0x1cb862,_0x2155e1){return new Promise(function(_0x5ea92e,_0x5a50a6){var _0x443efc;return getAuthToken(_0x1c1bb4,_0x29e602,_0x2155e1)[_0xf8fa('0x15')](function(_0x2eb654){if(_0x1cb862[_0xf8fa('0x48')]===_0xf8fa('0x49')){_0x443efc={'method':_0xf8fa('0x12'),'uri':_0x39347d+'incidents','body':Object[_0xf8fa('0x4a')]({},{'title':intUtil['getString'](_0x1cb862['Subjects'],_0x11c60e,'\x20'),'description':intUtil['getString'](_0x1cb862[_0xf8fa('0x4b')],_0x11c60e,'\x0a'),'customerid_contact@odata.bind':_0x5ac073['enduserId']?_0xf8fa('0x4c')+_0x5ac073['enduserId']+')':undefined,'ownerid@odata.bind':_0xf8fa('0x2f')+_0x5ac073[_0xf8fa('0x25')]+')','caseorigincode':'1'},getCustomFields(_0x1cb862[_0xf8fa('0x4d')],_0x11c60e,_0x1cb862[_0xf8fa('0x48')])),'headers':{'Authorization':_0xf8fa('0x1a')+_0x2eb654,'OData-Version':_0xf8fa('0x1b')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x1cb862['ticketType']==='phonecall'){var _0x5ecdcd=_0x5ac073[_0xf8fa('0x34')]?[{'partyid_systemuser@odata.bind':_0xf8fa('0x2f')+_0x5ac073[_0xf8fa('0x25')]+')','participationtypemask':_0x5ac073[_0xf8fa('0x4e')]===_0xf8fa('0x4f')?0x2:0x1},{'partyid_contact@odata.bind':_0xf8fa('0x4c')+_0x5ac073[_0xf8fa('0x34')]+')','participationtypemask':_0x5ac073[_0xf8fa('0x4e')]===_0xf8fa('0x4f')?0x1:0x2}]:[{'partyid_systemuser@odata.bind':_0xf8fa('0x2f')+_0x5ac073['userId']+')','participationtypemask':_0x5ac073[_0xf8fa('0x4e')]===_0xf8fa('0x4f')?0x2:0x1}];_0x443efc={'method':_0xf8fa('0x12'),'uri':_0x39347d+_0xf8fa('0x50'),'body':Object[_0xf8fa('0x4a')]({},{'subject':intUtil['getString'](_0x1cb862[_0xf8fa('0x51')],_0x11c60e,'\x20'),'phonenumber':String(_0x11c60e['calleridnum']),'description':intUtil[_0xf8fa('0x52')](_0x1cb862[_0xf8fa('0x4b')],_0x11c60e,'\x0a'),'regardingobjectid_contact@odata.bind':_0x5ac073[_0xf8fa('0x34')]?_0xf8fa('0x4c')+_0x5ac073[_0xf8fa('0x34')]+')':undefined,'ownerid@odata.bind':_0xf8fa('0x2f')+_0x5ac073[_0xf8fa('0x25')]+')','directioncode':_0x5ac073[_0xf8fa('0x4e')]==='queue'?![]:!![],'phonecall_activity_parties':_0x5ecdcd},getCustomFields(_0x1cb862[_0xf8fa('0x4d')],_0x11c60e,_0x1cb862[_0xf8fa('0x48')])),'headers':{'Authorization':_0xf8fa('0x1a')+_0x2eb654,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x443efc);})[_0xf8fa('0x15')](function(_0x3cca03){var _0x3439ab=_0x3cca03[_0xf8fa('0x31')][_0xf8fa('0x53')];var _0x18fe86=_0x3439ab[_0xf8fa('0x32')](_0x3439ab[_0xf8fa('0x33')]('(')+0x1,_0x3439ab[_0xf8fa('0x33')](')'));_0x5ac073[_0xf8fa('0x54')]=_0x18fe86;_0x5ea92e(_0x5ac073);})[_0xf8fa('0x2a')](function(_0xb17aa2){_0x5a50a6(_0xb17aa2[_0xf8fa('0x18')]);});});}function emit(_0x1a3ff6,_0x4721be,_0x24be82,_0x5e424b){var _0x13753e={'uri':util[_0xf8fa('0x55')]('%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s',_0x1a3ff6,_0x24be82,_0x5e424b)};io['to'](util['format'](_0xf8fa('0x56'),_0x4721be))[_0xf8fa('0x57')](_0xf8fa('0x58'),_0x13753e);}exports['cs']=function(_0x2de061,_0xdbeeed,_0x357fa8,_0x2b5011,_0x4ae2a7,_0x10badd,_0x5ee473,_0x4bbc32){var _0x5ea21b={};_0x10badd[_0xf8fa('0xc')]=_0x10badd[_0xf8fa('0xb')]?intUtil[_0xf8fa('0x59')](_0x10badd[_0xf8fa('0xd')]['data7']):intUtil[_0xf8fa('0x59')](_0x10badd[_0xf8fa('0xc')]);_0x10badd[_0xf8fa('0x5a')]=intUtil['stripTrailingSlash'](_0x10badd['serverUrl']);_0x5ea21b[_0xf8fa('0x4e')]=_0x4bbc32===_0xf8fa('0x4f')||_0x4bbc32===_0xf8fa('0x5b')?'queue':_0xf8fa('0x35');var _0x30b2c2=_0x10badd['modernAuthentication']?util[_0xf8fa('0x55')](_0xf8fa('0x5c'),_0x10badd[_0xf8fa('0xd')]['data7']):util[_0xf8fa('0x55')](_0xf8fa('0x5c'),_0x10badd[_0xf8fa('0xc')]);var _0x29e33f=util[_0xf8fa('0x55')](_0xf8fa('0x5d'),_0x10badd[_0xf8fa('0x5e')]);var _0x926154=util[_0xf8fa('0x55')](_0xf8fa('0x5f'),_0x10badd[_0xf8fa('0x5a')],_0xdbeeed[_0xf8fa('0x60')],md5(_0xdbeeed['uniqueid']));if(_0x4ae2a7&&_0x4ae2a7[_0xf8fa('0x61')]){logger[_0xf8fa('0x26')](_0xf8fa('0x62'),_0xf8fa('0x63'));_0xdbeeed[_0xf8fa('0x64')]=_0x926154;}else if(_0x5ee473&&_0x5ee473['recordingFormat']&&_0x5ee473[_0xf8fa('0x65')]!==_0xf8fa('0x66')){logger[_0xf8fa('0x26')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0xdbeeed[_0xf8fa('0x64')]=_0x926154;}else{_0xdbeeed['recordingURL']='';}return getUser(_0x5ea21b,_0x10badd,_0x2b5011,_0x29e33f,_0x30b2c2,_0x4bbc32)[_0xf8fa('0x15')](function(_0x175a02){logger['info']('['+_0x4bbc32[_0xf8fa('0x22')]()+_0xf8fa('0x67'),_0x175a02[_0xf8fa('0x25')]);logger['info']('['+_0x4bbc32[_0xf8fa('0x22')]()+_0xf8fa('0x68'),_0x175a02[_0xf8fa('0x1f')]);return getEndUser(_0x175a02,_0x10badd,_0x29e33f,_0x30b2c2,_0xdbeeed,_0x4bbc32,_0x357fa8['moduleCreate'],_0x357fa8[_0xf8fa('0x69')]);})[_0xf8fa('0x15')](function(_0x1d6afe){logger[_0xf8fa('0x26')]('['+_0x4bbc32['toUpperCase']()+_0xf8fa('0x6a'),_0x1d6afe['enduserId']);logger['info']('['+_0x4bbc32[_0xf8fa('0x22')]()+']\x20The\x20Enduser\x20phone\x20is:',_0xdbeeed['calleridnum']);return getTicket(_0x1d6afe,_0x10badd,_0x29e33f,_0x30b2c2,_0xdbeeed,_0x357fa8,_0x4bbc32);})['then'](function(_0x4452d5){logger[_0xf8fa('0x26')](util[_0xf8fa('0x55')]('['+_0x4bbc32[_0xf8fa('0x22')]()+_0xf8fa('0x6b'),_0x357fa8['ticketType'],_0x4452d5[_0xf8fa('0x54')]));logger[_0xf8fa('0x26')](util[_0xf8fa('0x55')]('['+_0x4bbc32[_0xf8fa('0x22')]()+_0xf8fa('0x6c'),_0x4bbc32));if(_0x4bbc32!==_0xf8fa('0x5b')&&_0x357fa8['openNewTab']){logger[_0xf8fa('0x26')]('['+_0x4bbc32[_0xf8fa('0x22')]()+']',_0xf8fa('0x6d'));emit(_0x10badd[_0xf8fa('0xc')],_0x2b5011[_0xf8fa('0x6e')],_0x357fa8['ticketType'],_0x4452d5[_0xf8fa('0x54')]);}})[_0xf8fa('0x2a')](function(_0x58a3b5){logger[_0xf8fa('0x16')]('['+_0x4bbc32[_0xf8fa('0x22')]()+_0xf8fa('0x6f'),_0x58a3b5[_0xf8fa('0x18')]);console[_0xf8fa('0x16')](_0xf8fa('0x70'),_0x58a3b5);});}; \ No newline at end of file +var _0x7e76=['contacts','userId','body','headers','odata-entityid','substring','lastIndexOf','enduserId','calleridnum','contacts?$select=','&$filter=','\x20eq\x20\x27','replace','%2b','value','contactid','nothing',']\x20Enduser\x20created!','forEach','string','picklist','type','customField','idField','indexOf','content','incident','incidents','assign','getString','Subjects','Descriptions','/contacts(','Fields','ticketType','/systemusers(','callDirection','queue','ticketId','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','emit','trigger:browser:url','stripTrailingSlash','unmanaged','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','tenantId','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]',']\x20The\x20User\x20ID\x20is:','userEmail','moduleCreate','additionalSearchContact',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s',']\x20Call\x20direction:\x20%s','name',']\x20Error\x20running\x20Dynamics365\x20integration','Error\x20running\x20Dynamics365\x20integration','./util','md5','../../../../config/logger','dynamics365','../../../../config/environment','redis','defaults','localhost','socket.io-emitter','modernAuthentication','remoteUri','CloudProvider','data7','data5','POST','clientId','username','password','clientSecret','access_token','catch','error','toUpperCase',']\x20Wrong\x20credentials!','then','GET','Bearer\x20','4.0','isNil','validateEmail','email','length','internalemailaddress','info','systemuserid',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','message','toLowerCase','outbound','destcalleridnum'];(function(_0x40ad6f,_0x7f4e4){var _0x341e74=function(_0x31a529){while(--_0x31a529){_0x40ad6f['push'](_0x40ad6f['shift']());}};_0x341e74(++_0x7f4e4);}(_0x7e76,0xb2));var _0x67e7=function(_0x3be62c,_0x356009){_0x3be62c=_0x3be62c-0x0;var _0x29f993=_0x7e76[_0x3be62c];return _0x29f993;};'use strict';var _=require('lodash');var rp=require('request-promise');var util=require('util');var intUtil=require(_0x67e7('0x0'));var md5=require(_0x67e7('0x1'));var Redis=require('ioredis');var logger=require(_0x67e7('0x2'))(_0x67e7('0x3'));var config=require(_0x67e7('0x4'));config[_0x67e7('0x5')]=_[_0x67e7('0x6')](config[_0x67e7('0x5')],{'host':_0x67e7('0x7'),'port':0x18eb});var io=require(_0x67e7('0x8'))(new Redis(config['redis']));function getAuthToken(_0x1a7457,_0x20dfc8,_0x2ffb5f){if(_0x1a7457[_0x67e7('0x9')]){_0x1a7457[_0x67e7('0xa')]=_0x1a7457[_0x67e7('0xb')][_0x67e7('0xc')];_0x1a7457['tenantId']=_0x1a7457[_0x67e7('0xb')]['data2'];return Promise['resolve'](_0x1a7457[_0x67e7('0xb')][_0x67e7('0xd')]);}var _0x49891d={'method':_0x67e7('0xe'),'uri':_0x20dfc8,'form':{'client_id':_0x1a7457[_0x67e7('0xf')],'resource':_0x1a7457[_0x67e7('0xa')],'username':_0x1a7457[_0x67e7('0x10')],'password':_0x1a7457[_0x67e7('0x11')],'grant_type':_0x67e7('0x11'),'client_secret':_0x1a7457[_0x67e7('0x12')]},'json':!![]};return rp(_0x49891d)['then'](function(_0x30fe2e){return _0x30fe2e[_0x67e7('0x13')];})[_0x67e7('0x14')](function(_0x5188a2){logger[_0x67e7('0x15')]('['+[_0x2ffb5f[_0x67e7('0x16')]()]+_0x67e7('0x17'));return _0x5188a2['message'];});}function getUser(_0x465656,_0x1e2bbc,_0x367dc5,_0x2c9454,_0x315a17,_0x407024){return new Promise(function(_0x2267cd,_0x1c2313){return getAuthToken(_0x1e2bbc,_0x2c9454,_0x407024)[_0x67e7('0x18')](function(_0x1fd68e){var _0x579bd5={'method':_0x67e7('0x19'),'uri':_0x315a17+'systemusers?$select=internalemailaddress,isdisabled,systemuserid','headers':{'Authorization':_0x67e7('0x1a')+_0x1fd68e,'OData-Version':_0x67e7('0x1b')},'json':!![]};return rp(_0x579bd5);})[_0x67e7('0x18')](function(_0x1ab5f0){var _0xf1b98e=_0x1ab5f0['value'];var _0x1bfeb6=![];var _0x27700d=null;if(!_[_0x67e7('0x1c')](_0x367dc5)){if(intUtil[_0x67e7('0x1d')](_0x367dc5[_0x67e7('0x1e')])){_0x465656['userEmail']=_0x367dc5['email'];for(_0x27700d=0x0;_0x27700d<_0xf1b98e[_0x67e7('0x1f')];_0x27700d++){if(_0xf1b98e[_0x27700d][_0x67e7('0x20')]===_0x367dc5[_0x67e7('0x1e')]&&!_0xf1b98e[_0x27700d]['isdisabled']){_0x1bfeb6=!![];logger[_0x67e7('0x21')]('['+[_0x407024['toUpperCase']()]+']\x20Agent\x20found\x20'+_0xf1b98e[_0x27700d][_0x67e7('0x22')]+'!');_0x465656['userId']=_0xf1b98e[_0x27700d][_0x67e7('0x22')];}}}}if(!_0x1bfeb6){logger[_0x67e7('0x21')]('['+[_0x407024[_0x67e7('0x16')]()]+_0x67e7('0x23'));_0x465656['userEmail']=_0x1e2bbc[_0x67e7('0x10')];for(_0x27700d=0x0;_0x27700d<_0xf1b98e[_0x67e7('0x1f')];_0x27700d++){if(_0xf1b98e[_0x27700d][_0x67e7('0x20')]===_0x1e2bbc[_0x67e7('0x10')]){_0x465656['userId']=_0xf1b98e[_0x27700d]['systemuserid'];}}}_0x2267cd(_0x465656);})[_0x67e7('0x14')](function(_0x1d4238){_0x1c2313(_0x1d4238[_0x67e7('0x24')]);});});}function createEndUser(_0x2658d9,_0x34600c,_0x2b66a9,_0x18cbf3,_0x2eee3b,_0x2c29ee,_0x58d2f0){return new Promise(function(_0x529f5c,_0x209b23){return getAuthToken(_0x34600c,_0x2b66a9,_0x2c29ee)[_0x67e7('0x18')](function(_0x2d67a9){var _0x89d75f=_0x2c29ee[_0x67e7('0x25')]()===_0x67e7('0x26')?_0x2eee3b[_0x67e7('0x27')]:_0x2eee3b['calleridnum'];var _0x4c95c3={'method':'POST','uri':_0x18cbf3+_0x67e7('0x28'),'body':{'fullname':_0x89d75f,'firstname':_0x89d75f,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':'/systemusers('+_0x2658d9[_0x67e7('0x29')]+')'},'headers':{'Authorization':_0x67e7('0x1a')+_0x2d67a9,'OData-Version':_0x67e7('0x1b')},'json':!![],'resolveWithFullResponse':!![]};_0x4c95c3[_0x67e7('0x2a')][_0x58d2f0]=_0x89d75f;return rp(_0x4c95c3);})[_0x67e7('0x18')](function(_0x30c16e){var _0x4db292=_0x30c16e[_0x67e7('0x2b')][_0x67e7('0x2c')];var _0x4c133c=_0x4db292[_0x67e7('0x2d')](_0x4db292['lastIndexOf']('(')+0x1,_0x4db292[_0x67e7('0x2e')](')'));_0x2658d9[_0x67e7('0x2f')]=_0x4c133c;_0x529f5c(_0x2658d9);})['catch'](function(_0x2fd9c4){_0x209b23(_0x2fd9c4[_0x67e7('0x24')]);});});}function getEndUser(_0xdf4bd8,_0x93c408,_0x508d80,_0x400a79,_0x47654a,_0x527bcf,_0x336e54,_0x59c610){var _0xcfab11=_0x527bcf[_0x67e7('0x25')]()===_0x67e7('0x26')?_0x47654a[_0x67e7('0x27')]:_0x47654a[_0x67e7('0x30')];return getAuthToken(_0x93c408,_0x508d80,_0x527bcf)['then'](function(_0x3bcaac){_0x59c610=_0x59c610?_0x59c610:'telephone1';var _0x366f1e={'method':_0x67e7('0x19'),'uri':_0x400a79+_0x67e7('0x31')+_0x59c610+_0x67e7('0x32')+_0x59c610+_0x67e7('0x33')+_0xcfab11[_0x67e7('0x34')]('+',_0x67e7('0x35'))+'\x27','headers':{'Authorization':_0x67e7('0x1a')+_0x3bcaac,'If-None-Match':null,'OData-Version':_0x67e7('0x1b')},'json':!![]};return rp(_0x366f1e);})[_0x67e7('0x18')](function(_0xf3d2b8){var _0x3916f8=![];if(!_0xf3d2b8)return _0x3916f8;var _0x20f3ab=_0xf3d2b8[_0x67e7('0x36')];for(var _0x19c1d7=0x0;_0x19c1d7<_0x20f3ab['length'];_0x19c1d7++){if(_0x20f3ab[_0x19c1d7][_0x59c610]===_0xcfab11){_0x3916f8=!![];_0xdf4bd8[_0x67e7('0x2f')]=_0x20f3ab[_0x19c1d7][_0x67e7('0x37')];}}return _0x3916f8;})['then'](function(_0x5cf2c4){if(_0x5cf2c4)return _0xdf4bd8;if(_0x336e54===_0x67e7('0x38')){logger[_0x67e7('0x21')]('['+[_0x527bcf[_0x67e7('0x16')]()]+']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing');return _0xdf4bd8;}return createEndUser(_0xdf4bd8,_0x93c408,_0x508d80,_0x400a79,_0x47654a,_0x527bcf,_0x59c610)['then'](function(_0x4e0f77){logger[_0x67e7('0x21')]('['+[_0x527bcf['toUpperCase']()]+_0x67e7('0x39'),_0x4e0f77[_0x67e7('0x2f')]);return _0x4e0f77;});});}function getCustomFields(_0x32e526,_0x54656b,_0x2d3036){var _0x41c333={};if(_0x32e526[_0x67e7('0x1f')]>0x0){_[_0x67e7('0x3a')](_0x32e526,function(_0x326f47){if(_['includes']([_0x67e7('0x3b'),_0x67e7('0x3c')],_0x326f47[_0x67e7('0x3d')])&&_0x326f47['nameField']&&!_0x326f47[_0x67e7('0x3e')]){var _0x13e52c=_0x326f47[_0x67e7('0x3f')][_0x67e7('0x25')]();var _0x5e9521=_0x13e52c['substring'](0x0,_0x13e52c['indexOf']('_'));var _0x1395a6=_0x13e52c[_0x67e7('0x2d')](_0x13e52c[_0x67e7('0x40')]('_')+0x1);if(_0x5e9521===_0x2d3036){_0x41c333[_0x1395a6]=_0x326f47[_0x67e7('0x41')];}}});}return _0x41c333;}function getTicket(_0x225d4c,_0x34a17c,_0x5aa9a4,_0x4278b7,_0x3a24b3,_0x23c95a,_0x4f91cb){return new Promise(function(_0x5157cf,_0x5d3282){var _0xec815b;return getAuthToken(_0x34a17c,_0x5aa9a4,_0x4f91cb)[_0x67e7('0x18')](function(_0x72fd6f){if(_0x23c95a['ticketType']===_0x67e7('0x42')){_0xec815b={'method':_0x67e7('0xe'),'uri':_0x4278b7+_0x67e7('0x43'),'body':Object[_0x67e7('0x44')]({},{'title':intUtil[_0x67e7('0x45')](_0x23c95a[_0x67e7('0x46')],_0x3a24b3,'\x20'),'description':intUtil[_0x67e7('0x45')](_0x23c95a[_0x67e7('0x47')],_0x3a24b3,'\x0a'),'customerid_contact@odata.bind':_0x225d4c[_0x67e7('0x2f')]?_0x67e7('0x48')+_0x225d4c[_0x67e7('0x2f')]+')':undefined,'ownerid@odata.bind':'/systemusers('+_0x225d4c[_0x67e7('0x29')]+')','caseorigincode':'1'},getCustomFields(_0x23c95a[_0x67e7('0x49')],_0x3a24b3,_0x23c95a[_0x67e7('0x4a')])),'headers':{'Authorization':_0x67e7('0x1a')+_0x72fd6f,'OData-Version':_0x67e7('0x1b')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x23c95a[_0x67e7('0x4a')]==='phonecall'){var _0x583050=_0x225d4c[_0x67e7('0x2f')]?[{'partyid_systemuser@odata.bind':_0x67e7('0x4b')+_0x225d4c[_0x67e7('0x29')]+')','participationtypemask':_0x225d4c[_0x67e7('0x4c')]===_0x67e7('0x4d')?0x2:0x1},{'partyid_contact@odata.bind':_0x67e7('0x48')+_0x225d4c[_0x67e7('0x2f')]+')','participationtypemask':_0x225d4c[_0x67e7('0x4c')]===_0x67e7('0x4d')?0x1:0x2}]:[{'partyid_systemuser@odata.bind':_0x67e7('0x4b')+_0x225d4c[_0x67e7('0x29')]+')','participationtypemask':_0x225d4c[_0x67e7('0x4c')]===_0x67e7('0x4d')?0x2:0x1}];_0xec815b={'method':_0x67e7('0xe'),'uri':_0x4278b7+'phonecalls','body':Object[_0x67e7('0x44')]({},{'subject':intUtil[_0x67e7('0x45')](_0x23c95a[_0x67e7('0x46')],_0x3a24b3,'\x20'),'phonenumber':String(_0x3a24b3['calleridnum']),'description':intUtil[_0x67e7('0x45')](_0x23c95a[_0x67e7('0x47')],_0x3a24b3,'\x0a'),'regardingobjectid_contact@odata.bind':_0x225d4c['enduserId']?'/contacts('+_0x225d4c['enduserId']+')':undefined,'ownerid@odata.bind':_0x67e7('0x4b')+_0x225d4c['userId']+')','directioncode':_0x225d4c['callDirection']===_0x67e7('0x4d')?![]:!![],'phonecall_activity_parties':_0x583050},getCustomFields(_0x23c95a[_0x67e7('0x49')],_0x3a24b3,_0x23c95a[_0x67e7('0x4a')])),'headers':{'Authorization':_0x67e7('0x1a')+_0x72fd6f,'OData-Version':_0x67e7('0x1b')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0xec815b);})[_0x67e7('0x18')](function(_0x4b49dd){var _0x1507dc=_0x4b49dd[_0x67e7('0x2b')][_0x67e7('0x2c')];var _0xda2f54=_0x1507dc[_0x67e7('0x2d')](_0x1507dc[_0x67e7('0x2e')]('(')+0x1,_0x1507dc[_0x67e7('0x2e')](')'));_0x225d4c[_0x67e7('0x4e')]=_0xda2f54;_0x5157cf(_0x225d4c);})['catch'](function(_0x81a9bf){_0x5d3282(_0x81a9bf['message']);});});}function emit(_0x1d114e,_0x43c1c0,_0x2423ec,_0x2574ef){var _0x12f054={'uri':util[_0x67e7('0x4f')](_0x67e7('0x50'),_0x1d114e,_0x2423ec,_0x2574ef)};io['to'](util['format']('user:%s',_0x43c1c0))[_0x67e7('0x51')](_0x67e7('0x52'),_0x12f054);}exports['cs']=function(_0x46b54b,_0x443667,_0x553e3a,_0x1f7168,_0x235db3,_0x3b923f,_0x1ef83f,_0x4f2712){var _0x193823={};_0x3b923f['remoteUri']=_0x3b923f[_0x67e7('0x9')]?intUtil[_0x67e7('0x53')](_0x3b923f[_0x67e7('0xb')]['data7']):intUtil[_0x67e7('0x53')](_0x3b923f[_0x67e7('0xa')]);_0x3b923f['serverUrl']=intUtil['stripTrailingSlash'](_0x3b923f['serverUrl']);_0x193823[_0x67e7('0x4c')]=_0x4f2712===_0x67e7('0x4d')||_0x4f2712===_0x67e7('0x54')?'queue':'outbound';var _0x28d423=_0x3b923f['modernAuthentication']?util[_0x67e7('0x4f')](_0x67e7('0x55'),_0x3b923f[_0x67e7('0xb')][_0x67e7('0xc')]):util[_0x67e7('0x4f')](_0x67e7('0x55'),_0x3b923f['remoteUri']);var _0x56433a=util['format'](_0x67e7('0x56'),_0x3b923f[_0x67e7('0x57')]);var _0x33fda5=util['format'](_0x67e7('0x58'),_0x3b923f[_0x67e7('0x59')],_0x443667[_0x67e7('0x5a')],md5(_0x443667['uniqueid']));if(_0x235db3&&_0x235db3[_0x67e7('0x5b')]){logger[_0x67e7('0x21')](_0x67e7('0x5c'),_0x67e7('0x5d'));_0x443667[_0x67e7('0x5e')]=_0x33fda5;}else if(_0x1ef83f&&_0x1ef83f[_0x67e7('0x5f')]&&_0x1ef83f['recordingFormat']!==_0x67e7('0x60')){logger['info'](_0x67e7('0x61'),_0x67e7('0x5d'));_0x443667['recordingURL']=_0x33fda5;}else{_0x443667[_0x67e7('0x5e')]='';}return getUser(_0x193823,_0x3b923f,_0x1f7168,_0x56433a,_0x28d423,_0x4f2712)[_0x67e7('0x18')](function(_0x54a205){logger['info']('['+_0x4f2712['toUpperCase']()+_0x67e7('0x62'),_0x54a205['userId']);logger[_0x67e7('0x21')]('['+_0x4f2712[_0x67e7('0x16')]()+']\x20The\x20User\x20email\x20is:',_0x54a205[_0x67e7('0x63')]);return getEndUser(_0x54a205,_0x3b923f,_0x56433a,_0x28d423,_0x443667,_0x4f2712,_0x553e3a[_0x67e7('0x64')],_0x553e3a[_0x67e7('0x65')]);})[_0x67e7('0x18')](function(_0x1ab7d0){logger[_0x67e7('0x21')]('['+_0x4f2712[_0x67e7('0x16')]()+_0x67e7('0x66'),_0x1ab7d0[_0x67e7('0x2f')]);logger[_0x67e7('0x21')]('['+_0x4f2712[_0x67e7('0x16')]()+_0x67e7('0x67'),_0x443667['calleridnum']);return getTicket(_0x1ab7d0,_0x3b923f,_0x56433a,_0x28d423,_0x443667,_0x553e3a,_0x4f2712);})[_0x67e7('0x18')](function(_0x18dc1b){logger[_0x67e7('0x21')](util[_0x67e7('0x4f')]('['+_0x4f2712['toUpperCase']()+_0x67e7('0x68'),_0x553e3a['ticketType'],_0x18dc1b[_0x67e7('0x4e')]));logger[_0x67e7('0x21')](util[_0x67e7('0x4f')]('['+_0x4f2712[_0x67e7('0x16')]()+_0x67e7('0x69'),_0x4f2712));if(_0x4f2712!==_0x67e7('0x54')&&_0x553e3a['openNewTab']){logger[_0x67e7('0x21')]('['+_0x4f2712['toUpperCase']()+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x3b923f[_0x67e7('0xa')],_0x1f7168[_0x67e7('0x6a')],_0x553e3a[_0x67e7('0x4a')],_0x18dc1b[_0x67e7('0x4e')]);}})[_0x67e7('0x14')](function(_0x5d5b5c){logger[_0x67e7('0x15')]('['+_0x4f2712[_0x67e7('0x16')]()+_0x67e7('0x6b'),_0x5d5b5c['message']);console['error'](_0x67e7('0x6c'),_0x5d5b5c);});}; \ 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 569076e..46b21b2 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 _0xb198=['socket.io-emitter','application/json','emit','info','Creating\x20new\x20ticket...','merge','format','Caller\x20-\x20%s','calleridname','calleridnum','getString','Subjects','Descriptions','
','name','Fields','custom_fields','mapValues','keyBy','value','%s/api/v2/tickets','remoteUri','POST','then','Agent\x20found!','find','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Admin\x20account\x20selected.','%s/api/v2/agents/me','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts','length','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Enduser\x20created.','Basic\x20%s','toString','debug','[HTTP]','stringify','defaults','GET','map','forEach','includes','picklist','type','nameField','customField','toLowerCase','content','string','idField','push','variableName','Variable','queue','stripTrailingSlash','serverUrl','monitor_format','Recording\x20is\x20enabled!','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','The\x20Enduser\x20ID\x20is:','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','[QUEUE]','%s/helpdesk/tickets/%d','catch','outbound','recordingFormat','none','[OUTBOUND]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridname','trigger:browser:url','error','lastevent','toUpperCase','request-promise','md5','util','./util','freshdesk','redis','localhost'];(function(_0x166d93,_0x301f09){var _0xba708=function(_0x349bf7){while(--_0x349bf7){_0x166d93['push'](_0x166d93['shift']());}};_0xba708(++_0x301f09);}(_0xb198,0xab));var _0x8b19=function(_0x80e0d6,_0x117ea7){_0x80e0d6=_0x80e0d6-0x0;var _0x3a5fc7=_0xb198[_0x80e0d6];return _0x3a5fc7;};'use strict';var _=require('lodash');var rp=require(_0x8b19('0x0'));var md5=require(_0x8b19('0x1'));var util=require(_0x8b19('0x2'));var Redis=require('ioredis');var intUtil=require(_0x8b19('0x3'));var config=require('../../../../config/environment');var logger=require('../../../../config/logger')(_0x8b19('0x4'));config[_0x8b19('0x5')]=_['defaults'](config[_0x8b19('0x5')],{'host':_0x8b19('0x6'),'port':0x18eb});var io=require(_0x8b19('0x7'))(new Redis(config[_0x8b19('0x5')]));var headers={'Content-Type':_0x8b19('0x8'),'Accept':'application/json'};function emit(_0xf33c28,_0x4f7a2b,_0x572ba8){io['to'](_0xf33c28)[_0x8b19('0x9')](_0x4f7a2b,_0x572ba8);}function getTicket(_0x54a8b4,_0x294f8f,_0x4d865d,_0x134a39,_0x274876){logger[_0x8b19('0xa')](_0x8b19('0xb'));var _0x2f16ed=_[_0x8b19('0xc')]({'responder_id':_0x294f8f['id'],'requester_id':_0x4d865d['id'],'name':util[_0x8b19('0xd')](_0x8b19('0xe'),_0x274876[_0x8b19('0xf')]),'phone':_0x274876[_0x8b19('0x10')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x8b19('0x11')](_0x134a39[_0x8b19('0x12')],_0x274876,'\x20'),'description':intUtil['getString'](_0x134a39[_0x8b19('0x13')],_0x274876,_0x8b19('0x14')),'tags':getTags(_0x134a39['Tags'],_0x8b19('0x15'))},getCustomFields(_0x134a39[_0x8b19('0x16')],_0x274876));_0x2f16ed[_0x8b19('0x17')]=_[_0x8b19('0x18')](_[_0x8b19('0x19')](_0x2f16ed[_0x8b19('0x17')],'id'),_0x8b19('0x1a'));return request({'uri':util['format'](_0x8b19('0x1b'),_0x54a8b4[_0x8b19('0x1c')]),'method':_0x8b19('0x1d'),'body':_0x2f16ed})[_0x8b19('0x1e')](function(_0x1200e7){logger[_0x8b19('0xa')]('Ticket\x20created!');return _0x1200e7;});}function getUser(_0x19b511,_0x474e23){if(intUtil['validateEmail'](_0x474e23)){return request({'uri':util['format']('%s/api/v2/agents',_0x19b511[_0x8b19('0x1c')]),'qs':{'email':_0x474e23}})[_0x8b19('0x1e')](function(_0x35779e){if(_0x35779e['length']){logger['info'](_0x8b19('0x1f'));return _[_0x8b19('0x20')](_0x35779e,function(_0x5da144){return _0x5da144['contact']['email']===_0x474e23;});}else{logger[_0x8b19('0xa')](_0x8b19('0x21'));return request({'uri':util[_0x8b19('0xd')]('%s/api/v2/agents/me',_0x19b511[_0x8b19('0x1c')])})[_0x8b19('0x1e')](function(_0x3fb64e){logger['info'](_0x8b19('0x22'));return _0x3fb64e;});}});}else{logger[_0x8b19('0xa')]('Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x8b19('0xd')](_0x8b19('0x23'),_0x19b511[_0x8b19('0x1c')])})[_0x8b19('0x1e')](function(_0x314982){logger[_0x8b19('0xa')]('Admin\x20account\x20selected.');return _0x314982;});}}function getEndUser(_0x4a8631,_0x11dea0,_0x1a0af2){logger[_0x8b19('0xa')](_0x8b19('0x24'),_0x1a0af2);return request({'uri':util['format'](_0x8b19('0x25'),_0x4a8631[_0x8b19('0x1c')]),'qs':{'phone':_0x1a0af2}})['then'](function(_0x591694){if(_0x591694[_0x8b19('0x26')]){logger['info'](_0x8b19('0x27'));return _[_0x8b19('0x20')](_0x591694,{'phone':_0x1a0af2});}else{logger[_0x8b19('0xa')](_0x8b19('0x28'));return request({'uri':util['format'](_0x8b19('0x25'),_0x4a8631[_0x8b19('0x1c')]),'method':_0x8b19('0x1d'),'body':{'name':_0x11dea0,'phone':_0x1a0af2}})[_0x8b19('0x1e')](function(_0x54b3e3){logger[_0x8b19('0xa')](_0x8b19('0x29'));return _0x54b3e3;});}});}function getAuth(_0x58a55c){return util['format'](_0x8b19('0x2a'),new Buffer(_0x58a55c['apiKey']+':X')[_0x8b19('0x2b')]('base64'));}function request(_0xc59596){logger[_0x8b19('0x2c')](_0x8b19('0x2d'),JSON[_0x8b19('0x2e')](_0xc59596));return rp(_[_0x8b19('0x2f')](_0xc59596,{'method':_0x8b19('0x30'),'headers':headers,'json':!![]}));}function getTags(_0x1ec209,_0x186c3f){var _0x881512=[];if(_0x1ec209&&_0x1ec209[_0x8b19('0x26')]>0x0){_0x881512=_[_0x8b19('0x31')](_0x1ec209,_0x186c3f);}return _0x881512;}function getCustomFields(_0x15505f,_0x5efde7){var _0x4312bc=[];var _0x154987={'custom_fields':[]};if(_0x15505f[_0x8b19('0x26')]>0x0){_[_0x8b19('0x32')](_0x15505f,function(_0x215225){if(_[_0x8b19('0x33')](['string',_0x8b19('0x34')],_0x215225[_0x8b19('0x35')])&&_0x215225[_0x8b19('0x36')]&&!_0x215225[_0x8b19('0x37')]){_0x154987[_0x215225['nameField'][_0x8b19('0x38')]()]=_0x215225[_0x8b19('0x39')]['toString']();}else if(_[_0x8b19('0x33')]([_0x8b19('0x3a'),_0x8b19('0x34')],_0x215225[_0x8b19('0x35')])&&_0x215225[_0x8b19('0x3b')]&&_0x215225[_0x8b19('0x37')]){_0x154987['custom_fields'][_0x8b19('0x3c')]({'id':_0x215225['idField'],'value':_0x215225[_0x8b19('0x39')][_0x8b19('0x2b')]()});}else if(_0x215225['type']==='variable'&&_0x215225[_0x8b19('0x3d')]&&_0x215225[_0x8b19('0x3b')]&&_0x215225[_0x8b19('0x37')]){_0x5efde7[_0x215225[_0x8b19('0x3d')]]&&_0x154987[_0x8b19('0x17')][_0x8b19('0x3c')]({'id':_0x215225['idField'],'value':_0x5efde7[_0x215225[_0x8b19('0x3d')]][_0x8b19('0x2b')]()});}else if(_0x215225[_0x8b19('0x35')]==='customVariable'&&_0x215225['Variable']&&_0x215225[_0x8b19('0x3e')]['name']&&_0x215225[_0x8b19('0x3b')]&&_0x215225[_0x8b19('0x37')]){_0x5efde7[_0x215225['Variable'][_0x8b19('0x15')][_0x8b19('0x38')]()]&&_0x154987[_0x8b19('0x17')][_0x8b19('0x3c')]({'id':_0x215225[_0x8b19('0x3b')],'value':_0x5efde7[_0x215225[_0x8b19('0x3e')][_0x8b19('0x15')][_0x8b19('0x38')]()]['toString']()});}});}return _0x154987;}exports[_0x8b19('0x3f')]=function(_0xa39126,_0x503d5e,_0x335f08,_0x285c04,_0xf9c0d9,_0x3e7ddc){var _0x5758bd,_0xb8fe9d;_0x3e7ddc[_0x8b19('0x1c')]=intUtil[_0x8b19('0x40')](_0x3e7ddc[_0x8b19('0x1c')]);_0x3e7ddc[_0x8b19('0x41')]=intUtil['stripTrailingSlash'](_0x3e7ddc[_0x8b19('0x41')]);if(_0xf9c0d9&&_0xf9c0d9[_0x8b19('0x42')]){logger[_0x8b19('0xa')]('[QUEUE]',_0x8b19('0x43'));_0x503d5e['recordingURL']=util[_0x8b19('0xd')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3e7ddc['serverUrl'],_0x503d5e[_0x8b19('0x44')],md5(_0x503d5e[_0x8b19('0x44')]));}else{_0x503d5e['recordingURL']='';}headers[_0x8b19('0x45')]=getAuth(_0x3e7ddc);return getUser(_0x3e7ddc,_0x285c04[_0x8b19('0x46')])[_0x8b19('0x1e')](function(_0x59fc3b){_0x5758bd=_0x59fc3b;logger['info'](_0x8b19('0x47'),_0x5758bd['id']);return getEndUser(_0x3e7ddc,_0x503d5e[_0x8b19('0xf')],_0x503d5e[_0x8b19('0x10')]);})['then'](function(_0x3e1e28){_0xb8fe9d=_0x3e1e28;logger[_0x8b19('0xa')](_0x8b19('0x48'),_0xb8fe9d['id']);return getTicket(_0x3e7ddc,_0x5758bd,_0xb8fe9d,_0x335f08,_0x503d5e);})[_0x8b19('0x1e')](function(_0x44744f){if(_0x44744f&&_0x44744f['id']){logger['info'](_0x8b19('0x49'));logger[_0x8b19('0xa')](_0x8b19('0x4a'),_0x44744f['id']);logger[_0x8b19('0xa')](_0x8b19('0x4b'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x8b19('0xd')]('user:%s',_0x285c04[_0x8b19('0x15')]),'trigger:browser:url',{'uri':util[_0x8b19('0xd')](_0x8b19('0x4c'),_0x3e7ddc[_0x8b19('0x1c')],_0x44744f['id'])});}})[_0x8b19('0x4d')](function(_0x3b033b){logger['error']('[QUEUE]',JSON['stringify'](_0x3b033b));});};exports[_0x8b19('0x4e')]=function(_0x1cce57,_0x12b977,_0x247a3c,_0x547ee8,_0x3a1e19,_0x17146e,_0x34ef57){var _0x16a935,_0xe8432e;_0x17146e[_0x8b19('0x1c')]=intUtil[_0x8b19('0x40')](_0x17146e[_0x8b19('0x1c')]);_0x17146e['serverUrl']=intUtil['stripTrailingSlash'](_0x17146e['serverUrl']);if(_0x34ef57&&_0x34ef57[_0x8b19('0x4f')]&&_0x34ef57[_0x8b19('0x4f')]!==_0x8b19('0x50')){logger[_0x8b19('0xa')](_0x8b19('0x51'),'Recording\x20is\x20enabled!');_0x12b977[_0x8b19('0x52')]=util[_0x8b19('0xd')](_0x8b19('0x53'),_0x17146e[_0x8b19('0x41')],_0x12b977[_0x8b19('0x44')],md5(_0x12b977[_0x8b19('0x44')]));}headers[_0x8b19('0x45')]=getAuth(_0x17146e);return getUser(_0x17146e,_0x547ee8[_0x8b19('0x46')])[_0x8b19('0x1e')](function(_0x10629c){_0x16a935=_0x10629c;logger['info'](_0x8b19('0x47'),_0x16a935['id']);return getEndUser(_0x17146e,_0x12b977[_0x8b19('0x54')],_0x12b977['destcalleridnum']);})['then'](function(_0x130c26){_0xe8432e=_0x130c26;logger[_0x8b19('0xa')]('The\x20Enduser\x20ID\x20is:',_0xe8432e['id']);return getTicket(_0x17146e,_0x16a935,_0xe8432e,_0x247a3c,_0x12b977);})['then'](function(_0x598079){if(_0x598079&&_0x598079['id']){logger[_0x8b19('0xa')](_0x8b19('0x49'));logger[_0x8b19('0xa')](_0x8b19('0x4a'),_0x598079['id']);logger['info']('[OUTBOUND]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x8b19('0xd')]('user:%s',_0x547ee8['name']),_0x8b19('0x55'),{'uri':util[_0x8b19('0xd')]('%s/helpdesk/tickets/%d',_0x17146e[_0x8b19('0x1c')],_0x598079['id'])});}})['catch'](function(_0x40a63b){logger[_0x8b19('0x56')](_0x8b19('0x51'),JSON[_0x8b19('0x2e')](_0x40a63b));});};exports['unmanaged']=function(_0xbe2166,_0x3349ca,_0x17ed17,_0x37ea50,_0x8603c8,_0x4ec56e){var _0x352c23,_0x4bea9b;_0x4ec56e[_0x8b19('0x1c')]=intUtil['stripTrailingSlash'](_0x4ec56e[_0x8b19('0x1c')]);_0x4ec56e['serverUrl']=intUtil[_0x8b19('0x40')](_0x4ec56e[_0x8b19('0x41')]);if(_0x8603c8&&_0x8603c8[_0x8b19('0x42')]){logger[_0x8b19('0xa')]('['+_0x3349ca[_0x8b19('0x57')][_0x8b19('0x58')]()+']',_0x8b19('0x43'));_0x3349ca['recordingURL']=util[_0x8b19('0xd')](_0x8b19('0x53'),_0x4ec56e[_0x8b19('0x41')],_0x3349ca[_0x8b19('0x44')],md5(_0x3349ca[_0x8b19('0x44')]));}else{_0x3349ca[_0x8b19('0x52')]='';}headers['Authorization']=getAuth(_0x4ec56e);return getUser(_0x4ec56e,'')[_0x8b19('0x1e')](function(_0x1ef188){_0x352c23=_0x1ef188;logger[_0x8b19('0xa')](_0x8b19('0x47'),_0x352c23['id']);return getEndUser(_0x4ec56e,_0x3349ca['calleridname'],_0x3349ca[_0x8b19('0x10')]);})[_0x8b19('0x1e')](function(_0x2e862a){_0x4bea9b=_0x2e862a;logger[_0x8b19('0xa')]('The\x20Enduser\x20ID\x20is:',_0x4bea9b['id']);return getTicket(_0x4ec56e,_0x352c23,_0x4bea9b,_0x17ed17,_0x3349ca);})[_0x8b19('0x1e')](function(_0x35a0a0){if(_0x35a0a0){logger['info']('Ticket\x20created!');logger[_0x8b19('0xa')](_0x8b19('0x4a'),_0x35a0a0['id']);}})[_0x8b19('0x4d')](function(_0x2dc28d){logger['error']('['+_0x3349ca['lastevent']['toUpperCase']()+']',JSON[_0x8b19('0x2e')](_0x2dc28d));});}; \ No newline at end of file +var _0xaed6=['getString','Descriptions','
','Tags','name','Fields','custom_fields','mapValues','keyBy','value','%s/api/v2/tickets','remoteUri','POST','Ticket\x20created!','%s/api/v2/agents','Agent\x20found!','contact','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','then','Admin\x20account\x20selected.','%s/api/v2/contacts','length','Enduser\x20found!','find','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Basic\x20%s','toString','debug','[HTTP]','stringify','map','includes','string','picklist','customField','nameField','toLowerCase','content','type','idField','push','variable','variableName','Variable','queue','stripTrailingSlash','serverUrl','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','trigger:browser:url','%s/helpdesk/tickets/%d','[OUTBOUND]','destcalleridname','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','catch','error','unmanaged','monitor_format','lastevent','toUpperCase','Recording\x20is\x20enabled!','lodash','request-promise','md5','util','ioredis','../../../../config/environment','../../../../config/logger','freshdesk','redis','localhost','application/json','emit','info','format','Caller\x20-\x20%s','calleridname','Subjects'];(function(_0x52555b,_0x12089e){var _0x1e7d16=function(_0x45df5f){while(--_0x45df5f){_0x52555b['push'](_0x52555b['shift']());}};_0x1e7d16(++_0x12089e);}(_0xaed6,0x14f));var _0x6aed=function(_0x32e8c4,_0x39c482){_0x32e8c4=_0x32e8c4-0x0;var _0x1b4ea0=_0xaed6[_0x32e8c4];return _0x1b4ea0;};'use strict';var _=require(_0x6aed('0x0'));var rp=require(_0x6aed('0x1'));var md5=require(_0x6aed('0x2'));var util=require(_0x6aed('0x3'));var Redis=require(_0x6aed('0x4'));var intUtil=require('./util');var config=require(_0x6aed('0x5'));var logger=require(_0x6aed('0x6'))(_0x6aed('0x7'));config['redis']=_['defaults'](config[_0x6aed('0x8')],{'host':_0x6aed('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x6aed('0x8')]));var headers={'Content-Type':_0x6aed('0xa'),'Accept':'application/json'};function emit(_0x399876,_0x2db5b6,_0x5ec29a){io['to'](_0x399876)[_0x6aed('0xb')](_0x2db5b6,_0x5ec29a);}function getTicket(_0x9c14ec,_0x1d2be6,_0x5485ce,_0x101808,_0x9c66bc){logger[_0x6aed('0xc')]('Creating\x20new\x20ticket...');var _0x1c4ed2=_['merge']({'responder_id':_0x1d2be6['id'],'requester_id':_0x5485ce['id'],'name':util[_0x6aed('0xd')](_0x6aed('0xe'),_0x9c66bc[_0x6aed('0xf')]),'phone':_0x9c66bc['calleridnum'],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil['getString'](_0x101808[_0x6aed('0x10')],_0x9c66bc,'\x20'),'description':intUtil[_0x6aed('0x11')](_0x101808[_0x6aed('0x12')],_0x9c66bc,_0x6aed('0x13')),'tags':getTags(_0x101808[_0x6aed('0x14')],_0x6aed('0x15'))},getCustomFields(_0x101808[_0x6aed('0x16')],_0x9c66bc));_0x1c4ed2[_0x6aed('0x17')]=_[_0x6aed('0x18')](_[_0x6aed('0x19')](_0x1c4ed2[_0x6aed('0x17')],'id'),_0x6aed('0x1a'));return request({'uri':util[_0x6aed('0xd')](_0x6aed('0x1b'),_0x9c14ec[_0x6aed('0x1c')]),'method':_0x6aed('0x1d'),'body':_0x1c4ed2})['then'](function(_0x6e0b1){logger[_0x6aed('0xc')](_0x6aed('0x1e'));return _0x6e0b1;});}function getUser(_0x301dc5,_0x3e9756){if(intUtil['validateEmail'](_0x3e9756)){return request({'uri':util[_0x6aed('0xd')](_0x6aed('0x1f'),_0x301dc5[_0x6aed('0x1c')]),'qs':{'email':_0x3e9756}})['then'](function(_0x13781d){if(_0x13781d['length']){logger[_0x6aed('0xc')](_0x6aed('0x20'));return _['find'](_0x13781d,function(_0x51b4bd){return _0x51b4bd[_0x6aed('0x21')]['email']===_0x3e9756;});}else{logger[_0x6aed('0xc')](_0x6aed('0x22'));return request({'uri':util[_0x6aed('0xd')](_0x6aed('0x23'),_0x301dc5[_0x6aed('0x1c')])})[_0x6aed('0x24')](function(_0x309eb7){logger['info']('Admin\x20account\x20selected.');return _0x309eb7;});}});}else{logger[_0x6aed('0xc')]('Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!');return request({'uri':util['format'](_0x6aed('0x23'),_0x301dc5[_0x6aed('0x1c')])})[_0x6aed('0x24')](function(_0x3a4d8d){logger[_0x6aed('0xc')](_0x6aed('0x25'));return _0x3a4d8d;});}}function getEndUser(_0x5ae0a0,_0x4413e6,_0x132d84){logger[_0x6aed('0xc')]('Searching\x20enduser\x20with\x20phone',_0x132d84);return request({'uri':util['format'](_0x6aed('0x26'),_0x5ae0a0[_0x6aed('0x1c')]),'qs':{'phone':_0x132d84}})[_0x6aed('0x24')](function(_0x132e5d){if(_0x132e5d[_0x6aed('0x27')]){logger['info'](_0x6aed('0x28'));return _[_0x6aed('0x29')](_0x132e5d,{'phone':_0x132d84});}else{logger[_0x6aed('0xc')](_0x6aed('0x2a'));return request({'uri':util['format'](_0x6aed('0x26'),_0x5ae0a0[_0x6aed('0x1c')]),'method':_0x6aed('0x1d'),'body':{'name':_0x4413e6,'phone':_0x132d84}})[_0x6aed('0x24')](function(_0x97e246){logger[_0x6aed('0xc')]('Enduser\x20created.');return _0x97e246;});}});}function getAuth(_0x1bfbbb){return util[_0x6aed('0xd')](_0x6aed('0x2b'),new Buffer(_0x1bfbbb['apiKey']+':X')[_0x6aed('0x2c')]('base64'));}function request(_0x243d7e){logger[_0x6aed('0x2d')](_0x6aed('0x2e'),JSON[_0x6aed('0x2f')](_0x243d7e));return rp(_['defaults'](_0x243d7e,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x434bd3,_0x5b0c15){var _0x3841f9=[];if(_0x434bd3&&_0x434bd3[_0x6aed('0x27')]>0x0){_0x3841f9=_[_0x6aed('0x30')](_0x434bd3,_0x5b0c15);}return _0x3841f9;}function getCustomFields(_0x4f234c,_0xc8fa83){var _0x4f5df0=[];var _0x4a9dbb={'custom_fields':[]};if(_0x4f234c[_0x6aed('0x27')]>0x0){_['forEach'](_0x4f234c,function(_0x23ff33){if(_[_0x6aed('0x31')]([_0x6aed('0x32'),_0x6aed('0x33')],_0x23ff33['type'])&&_0x23ff33['nameField']&&!_0x23ff33[_0x6aed('0x34')]){_0x4a9dbb[_0x23ff33[_0x6aed('0x35')][_0x6aed('0x36')]()]=_0x23ff33[_0x6aed('0x37')][_0x6aed('0x2c')]();}else if(_['includes'](['string',_0x6aed('0x33')],_0x23ff33[_0x6aed('0x38')])&&_0x23ff33[_0x6aed('0x39')]&&_0x23ff33[_0x6aed('0x34')]){_0x4a9dbb[_0x6aed('0x17')][_0x6aed('0x3a')]({'id':_0x23ff33[_0x6aed('0x39')],'value':_0x23ff33['content'][_0x6aed('0x2c')]()});}else if(_0x23ff33[_0x6aed('0x38')]===_0x6aed('0x3b')&&_0x23ff33[_0x6aed('0x3c')]&&_0x23ff33[_0x6aed('0x39')]&&_0x23ff33[_0x6aed('0x34')]){_0xc8fa83[_0x23ff33['variableName']]&&_0x4a9dbb[_0x6aed('0x17')]['push']({'id':_0x23ff33['idField'],'value':_0xc8fa83[_0x23ff33[_0x6aed('0x3c')]]['toString']()});}else if(_0x23ff33['type']==='customVariable'&&_0x23ff33['Variable']&&_0x23ff33[_0x6aed('0x3d')][_0x6aed('0x15')]&&_0x23ff33[_0x6aed('0x39')]&&_0x23ff33[_0x6aed('0x34')]){_0xc8fa83[_0x23ff33['Variable']['name'][_0x6aed('0x36')]()]&&_0x4a9dbb[_0x6aed('0x17')][_0x6aed('0x3a')]({'id':_0x23ff33['idField'],'value':_0xc8fa83[_0x23ff33[_0x6aed('0x3d')][_0x6aed('0x15')][_0x6aed('0x36')]()][_0x6aed('0x2c')]()});}});}return _0x4a9dbb;}exports[_0x6aed('0x3e')]=function(_0x37a1dd,_0x42a659,_0x395b59,_0xab82a2,_0x4c17b3,_0x54df0f){var _0x3d968d,_0x5e3f04;_0x54df0f[_0x6aed('0x1c')]=intUtil[_0x6aed('0x3f')](_0x54df0f[_0x6aed('0x1c')]);_0x54df0f[_0x6aed('0x40')]=intUtil[_0x6aed('0x3f')](_0x54df0f[_0x6aed('0x40')]);if(_0x4c17b3&&_0x4c17b3['monitor_format']){logger[_0x6aed('0xc')](_0x6aed('0x41'),'Recording\x20is\x20enabled!');_0x42a659[_0x6aed('0x42')]=util['format'](_0x6aed('0x43'),_0x54df0f[_0x6aed('0x40')],_0x42a659[_0x6aed('0x44')],md5(_0x42a659[_0x6aed('0x44')]));}else{_0x42a659[_0x6aed('0x42')]='';}headers[_0x6aed('0x45')]=getAuth(_0x54df0f);return getUser(_0x54df0f,_0xab82a2[_0x6aed('0x46')])['then'](function(_0xe1cfa6){_0x3d968d=_0xe1cfa6;logger[_0x6aed('0xc')](_0x6aed('0x47'),_0x3d968d['id']);return getEndUser(_0x54df0f,_0x42a659[_0x6aed('0xf')],_0x42a659[_0x6aed('0x48')]);})['then'](function(_0x8a1062){_0x5e3f04=_0x8a1062;logger[_0x6aed('0xc')](_0x6aed('0x49'),_0x5e3f04['id']);return getTicket(_0x54df0f,_0x3d968d,_0x5e3f04,_0x395b59,_0x42a659);})['then'](function(_0x110615){if(_0x110615&&_0x110615['id']){logger[_0x6aed('0xc')]('Ticket\x20created!');logger[_0x6aed('0xc')](_0x6aed('0x4a'),_0x110615['id']);logger[_0x6aed('0xc')](_0x6aed('0x41'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x6aed('0xd')]('user:%s',_0xab82a2['name']),_0x6aed('0x4b'),{'uri':util[_0x6aed('0xd')](_0x6aed('0x4c'),_0x54df0f[_0x6aed('0x1c')],_0x110615['id'])});}})['catch'](function(_0x2a6573){logger['error'](_0x6aed('0x41'),JSON[_0x6aed('0x2f')](_0x2a6573));});};exports['outbound']=function(_0x14b8c8,_0x282a8a,_0x418e6f,_0x3e12b3,_0x4b4904,_0x21a6f6,_0x1982f8){var _0x3db03c,_0x2e6d22;_0x21a6f6['remoteUri']=intUtil['stripTrailingSlash'](_0x21a6f6[_0x6aed('0x1c')]);_0x21a6f6['serverUrl']=intUtil['stripTrailingSlash'](_0x21a6f6[_0x6aed('0x40')]);if(_0x1982f8&&_0x1982f8['recordingFormat']&&_0x1982f8['recordingFormat']!=='none'){logger['info'](_0x6aed('0x4d'),'Recording\x20is\x20enabled!');_0x282a8a['recordingURL']=util[_0x6aed('0xd')](_0x6aed('0x43'),_0x21a6f6[_0x6aed('0x40')],_0x282a8a[_0x6aed('0x44')],md5(_0x282a8a[_0x6aed('0x44')]));}headers['Authorization']=getAuth(_0x21a6f6);return getUser(_0x21a6f6,_0x3e12b3[_0x6aed('0x46')])[_0x6aed('0x24')](function(_0x41944a){_0x3db03c=_0x41944a;logger['info'](_0x6aed('0x47'),_0x3db03c['id']);return getEndUser(_0x21a6f6,_0x282a8a[_0x6aed('0x4e')],_0x282a8a['destcalleridnum']);})[_0x6aed('0x24')](function(_0x41356d){_0x2e6d22=_0x41356d;logger[_0x6aed('0xc')]('The\x20Enduser\x20ID\x20is:',_0x2e6d22['id']);return getTicket(_0x21a6f6,_0x3db03c,_0x2e6d22,_0x418e6f,_0x282a8a);})[_0x6aed('0x24')](function(_0x1efceb){if(_0x1efceb&&_0x1efceb['id']){logger[_0x6aed('0xc')]('Ticket\x20created!');logger[_0x6aed('0xc')]('The\x20Ticket\x20ID\x20is:',_0x1efceb['id']);logger[_0x6aed('0xc')]('[OUTBOUND]',_0x6aed('0x4f'));emit(util[_0x6aed('0xd')](_0x6aed('0x50'),_0x3e12b3['name']),_0x6aed('0x4b'),{'uri':util[_0x6aed('0xd')](_0x6aed('0x4c'),_0x21a6f6['remoteUri'],_0x1efceb['id'])});}})[_0x6aed('0x51')](function(_0x991c88){logger[_0x6aed('0x52')](_0x6aed('0x4d'),JSON[_0x6aed('0x2f')](_0x991c88));});};exports[_0x6aed('0x53')]=function(_0x2c47fc,_0x5d5f58,_0x43e739,_0x35b659,_0x103701,_0x2bd713){var _0x46bd3f,_0x2a732e;_0x2bd713[_0x6aed('0x1c')]=intUtil['stripTrailingSlash'](_0x2bd713[_0x6aed('0x1c')]);_0x2bd713[_0x6aed('0x40')]=intUtil[_0x6aed('0x3f')](_0x2bd713[_0x6aed('0x40')]);if(_0x103701&&_0x103701[_0x6aed('0x54')]){logger[_0x6aed('0xc')]('['+_0x5d5f58[_0x6aed('0x55')][_0x6aed('0x56')]()+']',_0x6aed('0x57'));_0x5d5f58[_0x6aed('0x42')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2bd713[_0x6aed('0x40')],_0x5d5f58[_0x6aed('0x44')],md5(_0x5d5f58[_0x6aed('0x44')]));}else{_0x5d5f58[_0x6aed('0x42')]='';}headers[_0x6aed('0x45')]=getAuth(_0x2bd713);return getUser(_0x2bd713,'')[_0x6aed('0x24')](function(_0x465584){_0x46bd3f=_0x465584;logger[_0x6aed('0xc')](_0x6aed('0x47'),_0x46bd3f['id']);return getEndUser(_0x2bd713,_0x5d5f58[_0x6aed('0xf')],_0x5d5f58[_0x6aed('0x48')]);})[_0x6aed('0x24')](function(_0x1525e8){_0x2a732e=_0x1525e8;logger[_0x6aed('0xc')]('The\x20Enduser\x20ID\x20is:',_0x2a732e['id']);return getTicket(_0x2bd713,_0x46bd3f,_0x2a732e,_0x43e739,_0x5d5f58);})['then'](function(_0x32872e){if(_0x32872e){logger['info'](_0x6aed('0x1e'));logger[_0x6aed('0xc')]('The\x20Ticket\x20ID\x20is:',_0x32872e['id']);}})['catch'](function(_0x127f70){logger[_0x6aed('0x52')]('['+_0x5d5f58[_0x6aed('0x55')][_0x6aed('0x56')]()+']',JSON[_0x6aed('0x2f')](_0x127f70));});}; \ 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 f8555d1..f613ed0 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 _0xed4d=['Contact\x20created:','POST','/api/contacts','YYYY-MM-DDTHH:mm:ss','contact','Creating\x20new\x20task','/api/tasks','Subjects','Descriptions','Contact','add','ticketId','task','Task\x20created:','/contacts/','emit','trigger:browser:url','Token\x20token=','apiKey','remoteUri','stripTrailingSlash','serverUrl','username','outbound','destcalleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','name',']\x20Error\x20running\x20Freshsales\x20integration','inspect','lodash','md5','moment','ioredis','./util','../../../../config/environment','redis','localhost','socket.io-emitter','GET','headers','Getting\x20admin\x20information','then','length','email','adminEmail','info','Requested\x20Resource\x20not\x20Found','error','toUpperCase','message','/api/selector/owners','Getting\x20user\x20list','agentEmail','userEmail','userId','User\x20found:','Admin\x20selected','adminId','catch','contacts','format','contactNumber','mobile_number','endUserId','Contact\x20found\x20mobile_number:','work_number','Contact\x20found\x20work_number:'];(function(_0x22e740,_0x131a29){var _0x2f8d1a=function(_0x4ce65b){while(--_0x4ce65b){_0x22e740['push'](_0x22e740['shift']());}};_0x2f8d1a(++_0x131a29);}(_0xed4d,0x1a8));var _0xded4=function(_0x14d8b4,_0x4f4b03){_0x14d8b4=_0x14d8b4-0x0;var _0x585537=_0xed4d[_0x14d8b4];return _0x585537;};'use strict';var _=require(_0xded4('0x0'));var rp=require('request-promise');var md5=require(_0xded4('0x1'));var util=require('util');var moment=require(_0xded4('0x2'));var Promise=require('bluebird');var Redis=require(_0xded4('0x3'));var intUtil=require(_0xded4('0x4'));var config=require(_0xded4('0x5'));var logger=require('../../../../config/logger')('freshsales');config[_0xded4('0x6')]=_['defaults'](config['redis'],{'host':_0xded4('0x7'),'port':0x18eb});var io=require(_0xded4('0x8'))(new Redis(config[_0xded4('0x6')]));function getAdminId(_0x3df944,_0x1d23c2,_0x1722a1,_0x58e75a){return new Promise(function(_0x51f9c1,_0x12a8fe){var _0x4d66da=![];var _0x235067={'method':_0xded4('0x9'),'uri':_0x58e75a+'/api/selector/owners','json':!![]};_0x235067[_0xded4('0xa')]=_0x1722a1;logger['info'](_0xded4('0xb'));return rp(_0x235067)[_0xded4('0xc')](function(_0x2f7796){if(_0x2f7796){var _0x5a232d=_0x2f7796['users'];var _0x30988e=null;for(_0x30988e=0x0;_0x30988e<_0x5a232d[_0xded4('0xd')];_0x30988e++){if(_0x5a232d[_0x30988e][_0xded4('0xe')]===_0x3df944[_0xded4('0xf')]){_0x3df944['adminId']=_0x5a232d[_0x30988e]['id'];_0x4d66da=!![];}}if(_0x4d66da){logger[_0xded4('0x10')]('Admin\x20found:',_0x3df944['adminId']);_0x51f9c1(_0x3df944);}else{_0x12a8fe({'statusCode':0x194,'message':_0xded4('0x11')});}}else{_0x12a8fe({'statusCode':0x194,'message':_0xded4('0x11')});}})['catch'](function(_0x2d8d4c){logger[_0xded4('0x12')]('['+[_0x1d23c2[_0xded4('0x13')]()]+']',_0x2d8d4c[_0xded4('0x14')]);_0x12a8fe(_0x2d8d4c);});});}function getUser(_0x2e7b7b,_0x1ea5d2,_0x5c5d31){return function(_0x47eb58){return new Promise(function(_0x6aa398,_0x488a06){var _0x48ae66={'method':_0xded4('0x9'),'uri':_0x5c5d31+_0xded4('0x15'),'json':!![]};_0x48ae66[_0xded4('0xa')]=_0x1ea5d2;logger[_0xded4('0x10')](_0xded4('0x16'));return rp(_0x48ae66)[_0xded4('0xc')](function(_0x45d0a6){if(_0x45d0a6){var _0x5563c2=_0x45d0a6['users'];var _0xe02c9b=![];var _0x53279e=null;if(_0x47eb58[_0xded4('0x17')]!==null){logger[_0xded4('0x10')]('Getting\x20user\x20with\x20email',_0x47eb58['agentEmail']);_0x47eb58[_0xded4('0x18')]=_0x47eb58[_0xded4('0x17')];for(_0x53279e=0x0;_0x53279e<_0x5563c2[_0xded4('0xd')];_0x53279e++){if(_0x5563c2[_0x53279e][_0xded4('0xe')]===_0x47eb58[_0xded4('0x17')]){_0xe02c9b=!![];_0x47eb58[_0xded4('0x19')]=_0x5563c2[_0x53279e]['id'];logger[_0xded4('0x10')](_0xded4('0x1a'),_0x47eb58[_0xded4('0x19')]);}}}if(!_0xe02c9b){logger[_0xded4('0x10')](_0xded4('0x1b'));_0x47eb58[_0xded4('0x18')]=_0x47eb58[_0xded4('0xf')];_0x47eb58[_0xded4('0x19')]=_0x47eb58[_0xded4('0x1c')];_0xe02c9b=!![];}if(_0xe02c9b){_0x6aa398(_0x47eb58);}else{_0x488a06({'statusCode':0x194,'message':_0xded4('0x11')});}}else{_0x488a06({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})[_0xded4('0x1d')](function(_0x129b66){logger[_0xded4('0x12')]('['+[_0x2e7b7b[_0xded4('0x13')]()]+']',_0x129b66[_0xded4('0x14')]);_0x488a06(_0x129b66);});});};}function searchContact(_0x31c820,_0x2aba4d,_0xa043f5,_0x10f5ce){return new Promise(function(_0x548b7a,_0x4f1b31){var _0x1666c2={'method':_0xded4('0x9'),'headers':_0x2aba4d,'uri':_0x31c820+'/api/lookup?q='+_0x10f5ce+'&f='+_0xa043f5+'&entities=contact','json':!![]};rp(_0x1666c2)[_0xded4('0xc')](function(_0x32dccb){var _0x468967=_['find'](_0x32dccb['contacts'][_0xded4('0x1e')],[_0xa043f5,_0x10f5ce]);_0x548b7a(_0x468967);})[_0xded4('0x1d')](function(_0x4dfbac){_0x4f1b31(_0x4dfbac);});});}function getEndUser(_0x28ab56,_0x374fe2,_0x45b2b1){return function(_0x28884e){return new Promise(function(_0x49e840,_0x4c3c73){logger[_0xded4('0x10')](util[_0xded4('0x1f')]('Searching\x20contact\x20with\x20phone\x20%s',_0x28884e[_0xded4('0x20')]));searchContact(_0x45b2b1,_0x374fe2,_0xded4('0x21'),_0x28884e[_0xded4('0x20')])[_0xded4('0xc')](function(_0x5f5257){if(_0x5f5257){_0x28884e[_0xded4('0x22')]=_0x5f5257['id'];logger['info'](_0xded4('0x23'),_0x28884e[_0xded4('0x22')]);return _0x49e840(_0x28884e);}searchContact(_0x45b2b1,_0x374fe2,_0xded4('0x24'),_0x28884e[_0xded4('0x20')])[_0xded4('0xc')](function(_0x3629c7){if(_0x3629c7){_0x28884e[_0xded4('0x22')]=_0x3629c7['id'];logger[_0xded4('0x10')](_0xded4('0x25'),_0x28884e['endUserId']);return _0x49e840(_0x28884e);}createEndUser(_0x28884e,_0x28ab56,_0x374fe2,_0x45b2b1)[_0xded4('0xc')](function(_0x59e62f){logger[_0xded4('0x10')](_0xded4('0x26'),_0x59e62f[_0xded4('0x22')]);return _0x49e840(_0x59e62f);});});})[_0xded4('0x1d')](function(_0x553553){_0x4c3c73(_0x553553);});});};}function createEndUser(_0x19d696,_0x87946d,_0x39a41f,_0x1a68ce){return new Promise(function(_0x96ff15,_0x54d224){var _0x1a5e42=moment();var _0x159483={'method':_0xded4('0x27'),'uri':_0x1a68ce+_0xded4('0x28'),'body':{'contact':{'last_name':_0x19d696['contactNumber'],'work_number':_0x19d696[_0xded4('0x20')],'mobile_number':_0x19d696[_0xded4('0x20')],'owner_id':_0x19d696['userId'],'created_at':_0x1a5e42['format'](_0xded4('0x29'))}},'json':!![]};_0x159483[_0xded4('0xa')]=_0x39a41f;logger[_0xded4('0x10')]('Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact');return rp(_0x159483)[_0xded4('0xc')](function(_0x1601a7){_0x19d696[_0xded4('0x22')]=_0x1601a7[_0xded4('0x2a')]['id'];_0x96ff15(_0x19d696);})[_0xded4('0x1d')](function(_0x3ae6d4){logger[_0xded4('0x12')]('['+[_0x87946d[_0xded4('0x13')]()]+']',_0x3ae6d4['message']);_0x54d224(_0x3ae6d4[_0xded4('0x14')]);});});}function getTicket(_0x8d687,_0x477993,_0x2d8128,_0x125845,_0x43486c){return function(_0x4d66b8){logger['info'](_0xded4('0x2b'));return new Promise(function(_0x533fd6,_0x3245c2){var _0x1f08ba=moment();var _0x4a9f99={'method':'POST','uri':_0x2d8128+_0xded4('0x2c'),'body':{'title':intUtil['getString'](_0x125845[_0xded4('0x2d')],_0x43486c,'\x20'),'description':intUtil['getString'](_0x125845[_0xded4('0x2e')],_0x43486c,'\x0a'),'owner_id':_0x4d66b8[_0xded4('0x19')],'creater_id':_0x4d66b8[_0xded4('0x1c')],'targetable_id':_0x4d66b8[_0xded4('0x22')],'targetable_type':_0xded4('0x2f'),'created_at':_0x1f08ba[_0xded4('0x1f')](_0xded4('0x29')),'due_date':_0x1f08ba[_0xded4('0x30')](0x1e,'m')[_0xded4('0x1f')]('YYYY-MM-DDTHH:mm:ss')},'json':!![]};_0x4a9f99[_0xded4('0xa')]=_0x477993;return rp(_0x4a9f99)[_0xded4('0xc')](function(_0x102357){_0x4d66b8[_0xded4('0x31')]=_0x102357[_0xded4('0x32')]['id'];logger['info'](_0xded4('0x33'),_0x4d66b8[_0xded4('0x31')]);_0x533fd6(_0x4d66b8);})['catch'](function(_0x3c445d){logger[_0xded4('0x12')]('['+[_0x8d687['toUpperCase']()]+']',_0x3c445d['message']);_0x3245c2(_0x3c445d[_0xded4('0x14')]);});});};}function emit(_0x157073,_0x2b56be,_0x221fda){var _0x4abdc7={'uri':_0x157073+_0xded4('0x34')+_0x221fda};io['to'](util['format']('user:%s',_0x2b56be))[_0xded4('0x35')](_0xded4('0x36'),_0x4abdc7);}exports['cs']=function(_0x443fd0,_0x46f074,_0x4d7fd0,_0x4f469c,_0x3e206c,_0x154382,_0x398406,_0x44a14a){var _0x34a371={};var _0x207c2c={'Authorization':_0xded4('0x37')+_0x154382[_0xded4('0x38')]};_0x154382[_0xded4('0x39')]=intUtil[_0xded4('0x3a')](_0x154382['remoteUri']);_0x154382[_0xded4('0x3b')]=intUtil[_0xded4('0x3a')](_0x154382[_0xded4('0x3b')]);var _0x19b244=_0x154382[_0xded4('0x39')];_0x34a371[_0xded4('0xf')]=_0x154382[_0xded4('0x3c')];_0x34a371[_0xded4('0x20')]=_0x44a14a['toLowerCase']()===_0xded4('0x3d')?_0x46f074[_0xded4('0x3e')]:_0x46f074['calleridnum'];_0x34a371[_0xded4('0x3f')]=_0x44a14a===_0xded4('0x40')||_0x44a14a===_0xded4('0x41')?_0xded4('0x40'):_0xded4('0x3d');if(_0x4f469c){_0x34a371[_0xded4('0x17')]=_0x4f469c[_0xded4('0xe')];}var _0x1b165f=util[_0xded4('0x1f')](_0xded4('0x42'),_0x154382['serverUrl'],_0x46f074[_0xded4('0x43')],md5(_0x46f074[_0xded4('0x43')]));if(_0x3e206c&&_0x3e206c[_0xded4('0x44')]){logger[_0xded4('0x10')]('[QUEUE]',_0xded4('0x45'));_0x46f074[_0xded4('0x46')]=_0x1b165f;}else if(_0x398406&&_0x398406[_0xded4('0x47')]&&_0x398406[_0xded4('0x47')]!==_0xded4('0x48')){logger[_0xded4('0x10')](_0xded4('0x49'),'Recording\x20is\x20enabled!');_0x46f074['recordingURL']=_0x1b165f;}else{_0x46f074[_0xded4('0x46')]='';}return getAdminId(_0x34a371,_0x44a14a,_0x207c2c,_0x19b244)['then'](getUser(_0x44a14a,_0x207c2c,_0x19b244))[_0xded4('0xc')](getEndUser(_0x44a14a,_0x207c2c,_0x19b244))[_0xded4('0xc')](getTicket(_0x44a14a,_0x207c2c,_0x19b244,_0x4d7fd0,_0x46f074))[_0xded4('0xc')](function(_0x3c7069){logger[_0xded4('0x10')](util[_0xded4('0x1f')]('The\x20ticket\x20ID\x20is:\x20%s',_0x3c7069[_0xded4('0x31')]));if(_0x44a14a!=='unmanaged'){logger[_0xded4('0x10')]('['+[_0x44a14a[_0xded4('0x13')]()]+']','Displaying\x20task\x20in\x20a\x20new\x20tab...');emit(_0x19b244,_0x4f469c[_0xded4('0x4a')],_0x3c7069['endUserId']);}})[_0xded4('0x1d')](function(_0x4dc477){logger[_0xded4('0x12')]('['+[_0x44a14a[_0xded4('0x13')]()]+_0xded4('0x4b'),util[_0xded4('0x4c')](_0x4dc477,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xa4c8=['Getting\x20user\x20with\x20email','userEmail','userId','User\x20found:','Admin\x20selected','adminEmail','/api/lookup?q=','&f=','&entities=contact','find','contacts','Searching\x20contact\x20with\x20phone\x20%s','mobile_number','contactNumber','endUserId','Contact\x20found\x20mobile_number:','work_number','Contact\x20found\x20work_number:','POST','/api/contacts','format','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','/api/tasks','getString','Subjects','Descriptions','Contact','task','ticketId','/contacts/','user:%s','emit','trigger:browser:url','Token\x20token=','apiKey','remoteUri','stripTrailingSlash','serverUrl','username','toLowerCase','outbound','destcalleridnum','calleridnum','queue','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','[OUTBOUND]','unmanaged','Displaying\x20task\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Freshsales\x20integration','lodash','../../../../config/logger','freshsales','redis','defaults','localhost','socket.io-emitter','GET','headers','info','Getting\x20admin\x20information','then','length','email','adminId','Admin\x20found:','Requested\x20Resource\x20not\x20Found','catch','error','toUpperCase','message','/api/selector/owners','Getting\x20user\x20list','users','agentEmail'];(function(_0x5519a9,_0x1c5147){var _0x32f2cc=function(_0x52ed58){while(--_0x52ed58){_0x5519a9['push'](_0x5519a9['shift']());}};_0x32f2cc(++_0x1c5147);}(_0xa4c8,0x8b));var _0x8a4c=function(_0x163628,_0x55a1f8){_0x163628=_0x163628-0x0;var _0xbfa4a1=_0xa4c8[_0x163628];return _0xbfa4a1;};'use strict';var _=require(_0x8a4c('0x0'));var rp=require('request-promise');var md5=require('md5');var util=require('util');var moment=require('moment');var Promise=require('bluebird');var Redis=require('ioredis');var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require(_0x8a4c('0x1'))(_0x8a4c('0x2'));config[_0x8a4c('0x3')]=_[_0x8a4c('0x4')](config['redis'],{'host':_0x8a4c('0x5'),'port':0x18eb});var io=require(_0x8a4c('0x6'))(new Redis(config[_0x8a4c('0x3')]));function getAdminId(_0x1978e2,_0x984d34,_0xfabd98,_0x1c647c){return new Promise(function(_0x6af365,_0x215cbc){var _0x500c71=![];var _0x23b7e8={'method':_0x8a4c('0x7'),'uri':_0x1c647c+'/api/selector/owners','json':!![]};_0x23b7e8[_0x8a4c('0x8')]=_0xfabd98;logger[_0x8a4c('0x9')](_0x8a4c('0xa'));return rp(_0x23b7e8)[_0x8a4c('0xb')](function(_0xe71c75){if(_0xe71c75){var _0x127b73=_0xe71c75['users'];var _0x14b2d8=null;for(_0x14b2d8=0x0;_0x14b2d8<_0x127b73[_0x8a4c('0xc')];_0x14b2d8++){if(_0x127b73[_0x14b2d8][_0x8a4c('0xd')]===_0x1978e2['adminEmail']){_0x1978e2[_0x8a4c('0xe')]=_0x127b73[_0x14b2d8]['id'];_0x500c71=!![];}}if(_0x500c71){logger[_0x8a4c('0x9')](_0x8a4c('0xf'),_0x1978e2[_0x8a4c('0xe')]);_0x6af365(_0x1978e2);}else{_0x215cbc({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0x215cbc({'statusCode':0x194,'message':_0x8a4c('0x10')});}})[_0x8a4c('0x11')](function(_0x2880aa){logger[_0x8a4c('0x12')]('['+[_0x984d34[_0x8a4c('0x13')]()]+']',_0x2880aa[_0x8a4c('0x14')]);_0x215cbc(_0x2880aa);});});}function getUser(_0x371c43,_0x3e52d0,_0x5a275c){return function(_0x343c5d){return new Promise(function(_0x304519,_0x228f5e){var _0x4ebddb={'method':'GET','uri':_0x5a275c+_0x8a4c('0x15'),'json':!![]};_0x4ebddb[_0x8a4c('0x8')]=_0x3e52d0;logger[_0x8a4c('0x9')](_0x8a4c('0x16'));return rp(_0x4ebddb)['then'](function(_0x1f5d66){if(_0x1f5d66){var _0x5f42d8=_0x1f5d66[_0x8a4c('0x17')];var _0x1717f1=![];var _0xc607d7=null;if(_0x343c5d[_0x8a4c('0x18')]!==null){logger[_0x8a4c('0x9')](_0x8a4c('0x19'),_0x343c5d[_0x8a4c('0x18')]);_0x343c5d[_0x8a4c('0x1a')]=_0x343c5d['agentEmail'];for(_0xc607d7=0x0;_0xc607d7<_0x5f42d8['length'];_0xc607d7++){if(_0x5f42d8[_0xc607d7]['email']===_0x343c5d[_0x8a4c('0x18')]){_0x1717f1=!![];_0x343c5d[_0x8a4c('0x1b')]=_0x5f42d8[_0xc607d7]['id'];logger[_0x8a4c('0x9')](_0x8a4c('0x1c'),_0x343c5d[_0x8a4c('0x1b')]);}}}if(!_0x1717f1){logger['info'](_0x8a4c('0x1d'));_0x343c5d['userEmail']=_0x343c5d[_0x8a4c('0x1e')];_0x343c5d['userId']=_0x343c5d[_0x8a4c('0xe')];_0x1717f1=!![];}if(_0x1717f1){_0x304519(_0x343c5d);}else{_0x228f5e({'statusCode':0x194,'message':_0x8a4c('0x10')});}}else{_0x228f5e({'statusCode':0x194,'message':_0x8a4c('0x10')});}})[_0x8a4c('0x11')](function(_0x7240c2){logger[_0x8a4c('0x12')]('['+[_0x371c43[_0x8a4c('0x13')]()]+']',_0x7240c2[_0x8a4c('0x14')]);_0x228f5e(_0x7240c2);});});};}function searchContact(_0xf8c95f,_0x18f474,_0x16e95d,_0x151d74){return new Promise(function(_0x1b3a4a,_0x156d69){var _0x32dad8={'method':'GET','headers':_0x18f474,'uri':_0xf8c95f+_0x8a4c('0x1f')+_0x151d74+_0x8a4c('0x20')+_0x16e95d+_0x8a4c('0x21'),'json':!![]};rp(_0x32dad8)[_0x8a4c('0xb')](function(_0x169878){var _0x2e678a=_[_0x8a4c('0x22')](_0x169878[_0x8a4c('0x23')][_0x8a4c('0x23')],[_0x16e95d,_0x151d74]);_0x1b3a4a(_0x2e678a);})[_0x8a4c('0x11')](function(_0x4bf1d3){_0x156d69(_0x4bf1d3);});});}function getEndUser(_0x5f031c,_0x389ba7,_0x240f9d){return function(_0x44ad5d){return new Promise(function(_0x34fe0d,_0x421c84){logger['info'](util['format'](_0x8a4c('0x24'),_0x44ad5d['contactNumber']));searchContact(_0x240f9d,_0x389ba7,_0x8a4c('0x25'),_0x44ad5d[_0x8a4c('0x26')])[_0x8a4c('0xb')](function(_0x149918){if(_0x149918){_0x44ad5d[_0x8a4c('0x27')]=_0x149918['id'];logger[_0x8a4c('0x9')](_0x8a4c('0x28'),_0x44ad5d[_0x8a4c('0x27')]);return _0x34fe0d(_0x44ad5d);}searchContact(_0x240f9d,_0x389ba7,_0x8a4c('0x29'),_0x44ad5d[_0x8a4c('0x26')])[_0x8a4c('0xb')](function(_0x5041b9){if(_0x5041b9){_0x44ad5d[_0x8a4c('0x27')]=_0x5041b9['id'];logger[_0x8a4c('0x9')](_0x8a4c('0x2a'),_0x44ad5d[_0x8a4c('0x27')]);return _0x34fe0d(_0x44ad5d);}createEndUser(_0x44ad5d,_0x5f031c,_0x389ba7,_0x240f9d)[_0x8a4c('0xb')](function(_0x23099e){logger[_0x8a4c('0x9')]('Contact\x20created:',_0x23099e[_0x8a4c('0x27')]);return _0x34fe0d(_0x23099e);});});})[_0x8a4c('0x11')](function(_0x5c529f){_0x421c84(_0x5c529f);});});};}function createEndUser(_0x364567,_0x233ed9,_0x2f5dbe,_0xa58995){return new Promise(function(_0x1ba073,_0x3ffeb9){var _0x1cc595=moment();var _0x3c86a7={'method':_0x8a4c('0x2b'),'uri':_0xa58995+_0x8a4c('0x2c'),'body':{'contact':{'last_name':_0x364567[_0x8a4c('0x26')],'work_number':_0x364567[_0x8a4c('0x26')],'mobile_number':_0x364567[_0x8a4c('0x26')],'owner_id':_0x364567['userId'],'created_at':_0x1cc595[_0x8a4c('0x2d')](_0x8a4c('0x2e'))}},'json':!![]};_0x3c86a7['headers']=_0x2f5dbe;logger['info'](_0x8a4c('0x2f'));return rp(_0x3c86a7)[_0x8a4c('0xb')](function(_0x50cf82){_0x364567[_0x8a4c('0x27')]=_0x50cf82[_0x8a4c('0x30')]['id'];_0x1ba073(_0x364567);})[_0x8a4c('0x11')](function(_0x3fd251){logger['error']('['+[_0x233ed9['toUpperCase']()]+']',_0x3fd251[_0x8a4c('0x14')]);_0x3ffeb9(_0x3fd251[_0x8a4c('0x14')]);});});}function getTicket(_0x1b234f,_0x3ac42f,_0x3b7940,_0x42d4ef,_0x2264ba){return function(_0x418f7f){logger['info']('Creating\x20new\x20task');return new Promise(function(_0x17133a,_0x1c1a9d){var _0x7f0c43=moment();var _0x1c972e={'method':_0x8a4c('0x2b'),'uri':_0x3b7940+_0x8a4c('0x31'),'body':{'title':intUtil[_0x8a4c('0x32')](_0x42d4ef[_0x8a4c('0x33')],_0x2264ba,'\x20'),'description':intUtil[_0x8a4c('0x32')](_0x42d4ef[_0x8a4c('0x34')],_0x2264ba,'\x0a'),'owner_id':_0x418f7f[_0x8a4c('0x1b')],'creater_id':_0x418f7f[_0x8a4c('0xe')],'targetable_id':_0x418f7f[_0x8a4c('0x27')],'targetable_type':_0x8a4c('0x35'),'created_at':_0x7f0c43[_0x8a4c('0x2d')]('YYYY-MM-DDTHH:mm:ss'),'due_date':_0x7f0c43['add'](0x1e,'m')[_0x8a4c('0x2d')]('YYYY-MM-DDTHH:mm:ss')},'json':!![]};_0x1c972e[_0x8a4c('0x8')]=_0x3ac42f;return rp(_0x1c972e)[_0x8a4c('0xb')](function(_0xe951a){_0x418f7f['ticketId']=_0xe951a[_0x8a4c('0x36')]['id'];logger[_0x8a4c('0x9')]('Task\x20created:',_0x418f7f[_0x8a4c('0x37')]);_0x17133a(_0x418f7f);})['catch'](function(_0x334cfd){logger[_0x8a4c('0x12')]('['+[_0x1b234f[_0x8a4c('0x13')]()]+']',_0x334cfd[_0x8a4c('0x14')]);_0x1c1a9d(_0x334cfd[_0x8a4c('0x14')]);});});};}function emit(_0x2a85b4,_0x515443,_0x3eedfa){var _0x5b2036={'uri':_0x2a85b4+_0x8a4c('0x38')+_0x3eedfa};io['to'](util[_0x8a4c('0x2d')](_0x8a4c('0x39'),_0x515443))[_0x8a4c('0x3a')](_0x8a4c('0x3b'),_0x5b2036);}exports['cs']=function(_0x466a11,_0x2a7088,_0x3bf0c4,_0x2c5b88,_0x14c9e5,_0x58126a,_0x40176f,_0x5cd90c){var _0x341ab3={};var _0x40cdff={'Authorization':_0x8a4c('0x3c')+_0x58126a[_0x8a4c('0x3d')]};_0x58126a[_0x8a4c('0x3e')]=intUtil[_0x8a4c('0x3f')](_0x58126a[_0x8a4c('0x3e')]);_0x58126a['serverUrl']=intUtil['stripTrailingSlash'](_0x58126a[_0x8a4c('0x40')]);var _0x577c8a=_0x58126a[_0x8a4c('0x3e')];_0x341ab3[_0x8a4c('0x1e')]=_0x58126a[_0x8a4c('0x41')];_0x341ab3['contactNumber']=_0x5cd90c[_0x8a4c('0x42')]()===_0x8a4c('0x43')?_0x2a7088[_0x8a4c('0x44')]:_0x2a7088[_0x8a4c('0x45')];_0x341ab3['callDirection']=_0x5cd90c===_0x8a4c('0x46')||_0x5cd90c==='unmanaged'?'queue':_0x8a4c('0x43');if(_0x2c5b88){_0x341ab3[_0x8a4c('0x18')]=_0x2c5b88[_0x8a4c('0xd')];}var _0x5aeb18=util[_0x8a4c('0x2d')](_0x8a4c('0x47'),_0x58126a[_0x8a4c('0x40')],_0x2a7088['uniqueid'],md5(_0x2a7088['uniqueid']));if(_0x14c9e5&&_0x14c9e5[_0x8a4c('0x48')]){logger[_0x8a4c('0x9')](_0x8a4c('0x49'),_0x8a4c('0x4a'));_0x2a7088[_0x8a4c('0x4b')]=_0x5aeb18;}else if(_0x40176f&&_0x40176f['recordingFormat']&&_0x40176f[_0x8a4c('0x4c')]!=='none'){logger['info'](_0x8a4c('0x4d'),_0x8a4c('0x4a'));_0x2a7088[_0x8a4c('0x4b')]=_0x5aeb18;}else{_0x2a7088['recordingURL']='';}return getAdminId(_0x341ab3,_0x5cd90c,_0x40cdff,_0x577c8a)[_0x8a4c('0xb')](getUser(_0x5cd90c,_0x40cdff,_0x577c8a))[_0x8a4c('0xb')](getEndUser(_0x5cd90c,_0x40cdff,_0x577c8a))[_0x8a4c('0xb')](getTicket(_0x5cd90c,_0x40cdff,_0x577c8a,_0x3bf0c4,_0x2a7088))[_0x8a4c('0xb')](function(_0x339c1b){logger['info'](util['format']('The\x20ticket\x20ID\x20is:\x20%s',_0x339c1b[_0x8a4c('0x37')]));if(_0x5cd90c!==_0x8a4c('0x4e')){logger[_0x8a4c('0x9')]('['+[_0x5cd90c[_0x8a4c('0x13')]()]+']',_0x8a4c('0x4f'));emit(_0x577c8a,_0x2c5b88[_0x8a4c('0x50')],_0x339c1b[_0x8a4c('0x27')]);}})[_0x8a4c('0x11')](function(_0x1eb70a){logger[_0x8a4c('0x12')]('['+[_0x5cd90c[_0x8a4c('0x13')]()]+_0x8a4c('0x51'),util['inspect'](_0x1eb70a,{'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 903eb13..9bdfebd 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 _0x7987=['lodash','util','./zendesk','./salesforce','./sugarcrm','./zoho','./vtiger','./servicenow','./dynamics365','zendesk','salesforce','sugarcrm','freshdesk','zoho','desk','vtiger','dynamics365','freshsales','includes','data1','toLowerCase','find','Configurations','data3','routeId','outbound','log','EVENT\x20UNKNOWN','unmanaged','servicenow','unknown\x20integration','../../../../config/logger','[EXEC]','format','error'];(function(_0x299784,_0xb0918f){var _0x5ab008=function(_0x49c1f5){while(--_0x49c1f5){_0x299784['push'](_0x299784['shift']());}};_0x5ab008(++_0xb0918f);}(_0x7987,0x181));var _0x7798=function(_0x57e00e,_0x36e79a){_0x57e00e=_0x57e00e-0x0;var _0x415e60=_0x7987[_0x57e00e];return _0x415e60;};'use strict';var _=require(_0x7798('0x0'));var util=require(_0x7798('0x1'));var zendesk=require(_0x7798('0x2'));var salesforce=require(_0x7798('0x3'));var sugarcrm=require(_0x7798('0x4'));var freshdesk=require('./freshdesk');var zoho=require(_0x7798('0x5'));var desk=require('./desk');var vtiger=require(_0x7798('0x6'));var servicenow=require(_0x7798('0x7'));var dynamics365=require(_0x7798('0x8'));var freshsales=require('./freshsales');var integrations=[_0x7798('0x9'),_0x7798('0xa'),_0x7798('0xb'),_0x7798('0xc'),_0x7798('0xd'),_0x7798('0xe'),_0x7798('0xf'),_0x7798('0x10'),_0x7798('0x11'),'servicenow'];exports['exec']=function(_0x4ca66f,_0x3c2344,_0xc4dc07,_0x2e87a6,_0x27e9fe,_0x3a67bb){if(_0xc4dc07){if(_[_0x7798('0x12')](integrations,_0x4ca66f[_0x7798('0x13')][_0x7798('0x14')]())){try{var _0x5dd3d9=null;var _0x86f43d='';var _0x39442d=_0xc4dc07[_0x4ca66f['data1'][_0x7798('0x14')]()];if(_0x39442d){var _0x16e56a=_0x39442d[_0x4ca66f['data2']];if(_0x16e56a){var _0x163ae1=_[_0x7798('0x15')](_0x16e56a[_0x7798('0x16')],{'id':parseInt(_0x4ca66f[_0x7798('0x17')],0xa)});if(_0x163ae1){if(_0x2e87a6){if(_0x27e9fe&&_0x3c2344['queue']){_0x86f43d='queue';}else if(_0x3c2344[_0x7798('0x18')]){_0x86f43d=_0x7798('0x19');}else{console[_0x7798('0x1a')](_0x7798('0x1b'),_0x3c2344);}}else{_0x86f43d=_0x7798('0x1c');}switch(_0x4ca66f[_0x7798('0x13')][_0x7798('0x14')]()){case'zendesk':zendesk[_0x86f43d](_0x4ca66f,_0x3c2344,_0x163ae1,_0x2e87a6,_0x27e9fe,_0x16e56a,_0x3a67bb);break;case _0x7798('0xa'):salesforce[_0x86f43d](_0x4ca66f,_0x3c2344,_0x163ae1,_0x2e87a6,_0x27e9fe,_0x16e56a,_0x3a67bb);break;case _0x7798('0xb'):sugarcrm[_0x86f43d](_0x4ca66f,_0x3c2344,_0x163ae1,_0x2e87a6,_0x27e9fe,_0x16e56a,_0x3a67bb);break;case'freshdesk':freshdesk[_0x86f43d](_0x4ca66f,_0x3c2344,_0x163ae1,_0x2e87a6,_0x27e9fe,_0x16e56a,_0x3a67bb);break;case _0x7798('0xd'):zoho[_0x86f43d](_0x4ca66f,_0x3c2344,_0x163ae1,_0x2e87a6,_0x27e9fe,_0x16e56a,_0x3a67bb);break;case _0x7798('0xe'):desk[_0x86f43d](_0x4ca66f,_0x3c2344,_0x163ae1,_0x2e87a6,_0x27e9fe,_0x16e56a,_0x3a67bb);break;case _0x7798('0xf'):vtiger[_0x86f43d](_0x4ca66f,_0x3c2344,_0x163ae1,_0x2e87a6,_0x27e9fe,_0x16e56a,_0x3a67bb);break;case _0x7798('0x11'):freshsales['cs'](_0x4ca66f,_0x3c2344,_0x163ae1,_0x2e87a6,_0x27e9fe,_0x16e56a,_0x3a67bb,_0x86f43d);break;case _0x7798('0x1d'):servicenow['cs'](_0x4ca66f,_0x3c2344,_0x163ae1,_0x2e87a6,_0x27e9fe,_0x16e56a,_0x3a67bb,_0x86f43d);break;case _0x7798('0x10'):dynamics365['cs'](_0x4ca66f,_0x3c2344,_0x163ae1,_0x2e87a6,_0x27e9fe,_0x16e56a,_0x3a67bb,_0x86f43d);break;default:console[_0x7798('0x1a')](_0x7798('0x1e'));}}else{_0x5dd3d9=require(_0x7798('0x1f'))(_0x4ca66f[_0x7798('0x13')][_0x7798('0x14')]());_0x5dd3d9['error'](_0x7798('0x20'),util[_0x7798('0x21')]('%s\x20configuration\x20#%s\x20not\x20found',_0x4ca66f[_0x7798('0x13')][_0x7798('0x14')](),_0x4ca66f['data3']));}}else{_0x5dd3d9=require(_0x7798('0x1f'))(_0x4ca66f[_0x7798('0x13')][_0x7798('0x14')]());_0x5dd3d9[_0x7798('0x22')](_0x7798('0x20'),util[_0x7798('0x21')]('%s\x20account\x20#%s\x20not\x20found',_0x4ca66f['data1'][_0x7798('0x14')](),_0x4ca66f['data2']));}}else{}}catch(_0xe598fd){console['error'](_0xe598fd);}}}}; \ No newline at end of file +var _0x805b=['salesforce','zoho','log','unknown\x20integration','error','[EXEC]','format','../../../../config/logger','%s\x20account\x20#%s\x20not\x20found','lodash','util','./zendesk','./salesforce','./sugarcrm','./freshdesk','./zoho','./desk','./vtiger','./servicenow','./freshsales','zendesk','sugarcrm','freshdesk','desk','vtiger','dynamics365','freshsales','servicenow','exec','includes','data1','toLowerCase','data2','find','Configurations','data3','queue','routeId','outbound','EVENT\x20UNKNOWN','unmanaged'];(function(_0x4a3cce,_0x1e378b){var _0x11bc80=function(_0x4eaa89){while(--_0x4eaa89){_0x4a3cce['push'](_0x4a3cce['shift']());}};_0x11bc80(++_0x1e378b);}(_0x805b,0xad));var _0xb805=function(_0xa128c1,_0x132b77){_0xa128c1=_0xa128c1-0x0;var _0xec9b75=_0x805b[_0xa128c1];return _0xec9b75;};'use strict';var _=require(_0xb805('0x0'));var util=require(_0xb805('0x1'));var zendesk=require(_0xb805('0x2'));var salesforce=require(_0xb805('0x3'));var sugarcrm=require(_0xb805('0x4'));var freshdesk=require(_0xb805('0x5'));var zoho=require(_0xb805('0x6'));var desk=require(_0xb805('0x7'));var vtiger=require(_0xb805('0x8'));var servicenow=require(_0xb805('0x9'));var dynamics365=require('./dynamics365');var freshsales=require(_0xb805('0xa'));var integrations=[_0xb805('0xb'),'salesforce',_0xb805('0xc'),_0xb805('0xd'),'zoho',_0xb805('0xe'),_0xb805('0xf'),_0xb805('0x10'),_0xb805('0x11'),_0xb805('0x12')];exports[_0xb805('0x13')]=function(_0x87f04d,_0x5f4f0b,_0x5c0461,_0x54f8d8,_0x3a64e5,_0x4efa0b){if(_0x5c0461){if(_[_0xb805('0x14')](integrations,_0x87f04d[_0xb805('0x15')][_0xb805('0x16')]())){try{var _0x95ca13=null;var _0x3ce023='';var _0x35144a=_0x5c0461[_0x87f04d[_0xb805('0x15')][_0xb805('0x16')]()];if(_0x35144a){var _0xb21378=_0x35144a[_0x87f04d[_0xb805('0x17')]];if(_0xb21378){var _0x44b55d=_[_0xb805('0x18')](_0xb21378[_0xb805('0x19')],{'id':parseInt(_0x87f04d[_0xb805('0x1a')],0xa)});if(_0x44b55d){if(_0x54f8d8){if(_0x3a64e5&&_0x5f4f0b[_0xb805('0x1b')]){_0x3ce023=_0xb805('0x1b');}else if(_0x5f4f0b[_0xb805('0x1c')]){_0x3ce023=_0xb805('0x1d');}else{console['log'](_0xb805('0x1e'),_0x5f4f0b);}}else{_0x3ce023=_0xb805('0x1f');}switch(_0x87f04d[_0xb805('0x15')][_0xb805('0x16')]()){case'zendesk':zendesk[_0x3ce023](_0x87f04d,_0x5f4f0b,_0x44b55d,_0x54f8d8,_0x3a64e5,_0xb21378,_0x4efa0b);break;case _0xb805('0x20'):salesforce[_0x3ce023](_0x87f04d,_0x5f4f0b,_0x44b55d,_0x54f8d8,_0x3a64e5,_0xb21378,_0x4efa0b);break;case _0xb805('0xc'):sugarcrm[_0x3ce023](_0x87f04d,_0x5f4f0b,_0x44b55d,_0x54f8d8,_0x3a64e5,_0xb21378,_0x4efa0b);break;case _0xb805('0xd'):freshdesk[_0x3ce023](_0x87f04d,_0x5f4f0b,_0x44b55d,_0x54f8d8,_0x3a64e5,_0xb21378,_0x4efa0b);break;case _0xb805('0x21'):zoho[_0x3ce023](_0x87f04d,_0x5f4f0b,_0x44b55d,_0x54f8d8,_0x3a64e5,_0xb21378,_0x4efa0b);break;case _0xb805('0xe'):desk[_0x3ce023](_0x87f04d,_0x5f4f0b,_0x44b55d,_0x54f8d8,_0x3a64e5,_0xb21378,_0x4efa0b);break;case _0xb805('0xf'):vtiger[_0x3ce023](_0x87f04d,_0x5f4f0b,_0x44b55d,_0x54f8d8,_0x3a64e5,_0xb21378,_0x4efa0b);break;case _0xb805('0x11'):freshsales['cs'](_0x87f04d,_0x5f4f0b,_0x44b55d,_0x54f8d8,_0x3a64e5,_0xb21378,_0x4efa0b,_0x3ce023);break;case _0xb805('0x12'):servicenow['cs'](_0x87f04d,_0x5f4f0b,_0x44b55d,_0x54f8d8,_0x3a64e5,_0xb21378,_0x4efa0b,_0x3ce023);break;case _0xb805('0x10'):dynamics365['cs'](_0x87f04d,_0x5f4f0b,_0x44b55d,_0x54f8d8,_0x3a64e5,_0xb21378,_0x4efa0b,_0x3ce023);break;default:console[_0xb805('0x22')](_0xb805('0x23'));}}else{_0x95ca13=require('../../../../config/logger')(_0x87f04d[_0xb805('0x15')][_0xb805('0x16')]());_0x95ca13[_0xb805('0x24')](_0xb805('0x25'),util[_0xb805('0x26')]('%s\x20configuration\x20#%s\x20not\x20found',_0x87f04d[_0xb805('0x15')]['toLowerCase'](),_0x87f04d[_0xb805('0x1a')]));}}else{_0x95ca13=require(_0xb805('0x27'))(_0x87f04d['data1'][_0xb805('0x16')]());_0x95ca13[_0xb805('0x24')](_0xb805('0x25'),util['format'](_0xb805('0x28'),_0x87f04d['data1']['toLowerCase'](),_0x87f04d[_0xb805('0x17')]));}}else{}}catch(_0x32a630){console[_0xb805('0x24')](_0x32a630);}}}}; \ 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 dd6f871..93df31e 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 _0x0c31=['includes','string','picklist','idField','toString','variable','variableName','customVariable','Variable','name','password','concat','securityToken','Connection','remoteUri','https://login.salesforce.com','clientId','clientSecret','login','username','Connection\x20established.','queue','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','calleridnum','Fields','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','user:%s','trigger:salesforce:display','%s/%s/e','instanceUrl','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','outbound','stripTrailingSlash','none','destcalleridname','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','newTab','[OUTBOUND]','unmanaged','lastevent','calleridname','toUpperCase',']\x20Ticket\x20%s\x20created.','lodash','moment','bluebird','md5','jsforce','util','../../../../config/environment','../../../../config/logger','salesforce','redis','defaults','socket.io-emitter','getString','Subjects','Descriptions','ticketType','utc','IsReminderSet','endUserType','contact','lead','account','WhatId','Case','AccountId','leadId','info','Association\x20between\x20Case\x20and\x20Lead\x20skipped','sobject','create','isNil','User','find','then','length','Email','Agent\x20%s\x20found.','resolve','user_id','display_name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','additionalSearchContact','merge','$or','Contact','execute','additionalSearchLead','account_contact_lead','cloneDeep','additionalSearchAccount','Lead','Account','first','Name','Phone','attributes','type','toLowerCase','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','Enduser\x20with\x20phone\x20%s\x20not\x20found','moduleCreate','','format','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','LastName','Caller\x20-\x20%s','No\x20Company','upperFirst','forEach'];(function(_0x470883,_0x613e70){var _0x2f4abb=function(_0x2e17e3){while(--_0x2e17e3){_0x470883['push'](_0x470883['shift']());}};_0x2f4abb(++_0x613e70);}(_0x0c31,0x135));var _0x10c3=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x0c31[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x10c3('0x0'));var rp=require('request-promise');var moment=require(_0x10c3('0x1'));var BPromise=require(_0x10c3('0x2'));var md5=require(_0x10c3('0x3'));var jsforce=require(_0x10c3('0x4'));var util=require(_0x10c3('0x5'));var Redis=require('ioredis');var intUtil=require('./util');var config=require(_0x10c3('0x6'));var logger=require(_0x10c3('0x7'))(_0x10c3('0x8'));config[_0x10c3('0x9')]=_[_0x10c3('0xa')](config[_0x10c3('0x9')],{'host':'localhost','port':0x18eb});var io=require(_0x10c3('0xb'))(new Redis(config[_0x10c3('0x9')]));function emit(_0x1c1473,_0x26fdbb,_0x4828fa){io['to'](_0x1c1473)['emit'](_0x26fdbb,_0x4828fa);}function getTicket(_0x2ad306,_0x59dc10,_0xc5f56,_0x36045b,_0x413782,_0xa6a98d,_0x46c71c,_0x462044){var _0x4d096b=Object['assign']({},{'OwnerId':_0x59dc10['id'],'Subject':intUtil[_0x10c3('0xc')](_0x36045b[_0x10c3('0xd')],_0x413782,'\x20'),'Description':intUtil[_0x10c3('0xc')](_0x36045b[_0x10c3('0xe')],_0x413782,'\x0a')},getCustomFields(_0xa6a98d,_0x413782));if(_0xc5f56){if(_0x36045b[_0x10c3('0xf')]==='Task'){_0x4d096b['ActivityDate']=moment[_0x10c3('0x10')]();_0x4d096b[_0x10c3('0x11')]=![];_0x4d096b['IsRecurrence']=![];if(_0xc5f56[_0x10c3('0x12')]===_0x10c3('0x13')||_0xc5f56['endUserType']===_0x10c3('0x14')){_0x4d096b['WhoId']=_0xc5f56['id'];}else if(_0xc5f56[_0x10c3('0x12')]===_0x10c3('0x15')){_0x4d096b[_0x10c3('0x16')]=_0xc5f56['id'];}}else if(_0x36045b[_0x10c3('0xf')]===_0x10c3('0x17')){if(_0xc5f56[_0x10c3('0x12')]===_0x10c3('0x13')){_0x4d096b['ContactId']=_0xc5f56['id'];}else if(_0xc5f56[_0x10c3('0x12')]==='account'){_0x4d096b[_0x10c3('0x18')]=_0xc5f56['id'];}else if(_0xc5f56[_0x10c3('0x12')]===_0x10c3('0x14')&&_0x36045b['leadId']){_0x4d096b[_0x36045b[_0x10c3('0x19')]]=_0xc5f56['id'];}else{logger[_0x10c3('0x1a')](_0x10c3('0x1b'));}}}return _0x46c71c[_0x10c3('0x1c')](_0x36045b[_0x10c3('0xf')])[_0x10c3('0x1d')](_0x4d096b);}function getUser(_0x5bdc02,_0x2fc630,_0x523072){if(!_[_0x10c3('0x1e')](_0x2fc630)&&intUtil['validateEmail'](_0x2fc630)){var _0x239b19={'Email':_0x2fc630};var _0x154e95={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x523072['sobject'](_0x10c3('0x1f'))[_0x10c3('0x20')](_0x239b19,_0x154e95)['execute']()[_0x10c3('0x21')](function(_0x5e8f29){if(_0x5e8f29[_0x10c3('0x22')]){var _0x5b15f3=_[_0x10c3('0x20')](_0x5e8f29,function(_0x393fc3){return _0x393fc3[_0x10c3('0x23')]===_0x2fc630;});if(_0x5b15f3){logger['info'](_0x10c3('0x24'),_0x2fc630);return BPromise[_0x10c3('0x25')]({'id':_0x5b15f3['Id'],'name':_0x5b15f3['Name']});}}else{logger[_0x10c3('0x1a')]('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0x2fc630);return _0x523072['identity']()[_0x10c3('0x21')](function(_0x2c938c){return BPromise[_0x10c3('0x25')]({'id':_0x2c938c[_0x10c3('0x26')],'name':_0x2c938c[_0x10c3('0x27')]});});}});}else{logger[_0x10c3('0x1a')](_0x10c3('0x28'),_0x2fc630);return _0x523072['identity']()[_0x10c3('0x21')](function(_0x3cd380){return BPromise[_0x10c3('0x25')]({'id':_0x3cd380[_0x10c3('0x26')],'name':_0x3cd380[_0x10c3('0x27')]});});}}function getEndUser(_0x1cbe8,_0x4a2c88,_0x486cb8,_0x3c5383,_0x175dcd){var _0x1fcdce={'$or':{'Phone':_0x3c5383}};var _0x2a1afd={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0x10c3('0x25')]()[_0x10c3('0x21')](function(){logger[_0x10c3('0x1a')](_0x10c3('0x29'),_0x3c5383,_0x4a2c88[_0x10c3('0x2a')]);switch(_0x4a2c88[_0x10c3('0x2a')]){case _0x10c3('0x2b'):var _0x1f857f=_['cloneDeep'](_0x1fcdce);if(_0x4a2c88[_0x10c3('0x2c')]){var _0x4f4d6b={};_0x4f4d6b[_0x4a2c88['additionalSearchContact']]=_0x3c5383;_[_0x10c3('0x2d')](_0x1f857f[_0x10c3('0x2e')],_0x4f4d6b);}return _0x175dcd['sobject'](_0x10c3('0x2f'))[_0x10c3('0x20')](_0x1f857f,_0x2a1afd)[_0x10c3('0x30')]()['then'](function(_0x4963f5){if(_0x4963f5&&_0x4963f5[_0x10c3('0x22')]){return _0x4963f5;}else{var _0x12e197=_['cloneDeep'](_0x1fcdce);if(_0x4a2c88['additionalSearchLead']){var _0x411d8b={};_0x411d8b[_0x4a2c88[_0x10c3('0x31')]]=_0x3c5383;_[_0x10c3('0x2d')](_0x12e197['$or'],_0x411d8b);}return _0x175dcd[_0x10c3('0x1c')]('Lead')[_0x10c3('0x20')](_0x12e197,_0x2a1afd);}});case _0x10c3('0x32'):var _0x33a4b9=_[_0x10c3('0x33')](_0x1fcdce);if(_0x4a2c88[_0x10c3('0x34')]){var _0x4f4d6b={};_0x4f4d6b[_0x4a2c88[_0x10c3('0x34')]]=_0x3c5383;_[_0x10c3('0x2d')](_0x33a4b9[_0x10c3('0x2e')],_0x4f4d6b);}return _0x175dcd[_0x10c3('0x1c')]('Account')[_0x10c3('0x20')](_0x33a4b9,_0x2a1afd)[_0x10c3('0x30')]()[_0x10c3('0x21')](function(_0x40b2a3){if(_0x40b2a3&&_0x40b2a3['length']){return _0x40b2a3;}else{var _0x596a01=_[_0x10c3('0x33')](_0x1fcdce);if(_0x4a2c88[_0x10c3('0x2c')]){var _0x4b0ea3={};_0x4b0ea3[_0x4a2c88[_0x10c3('0x2c')]]=_0x3c5383;_[_0x10c3('0x2d')](_0x596a01[_0x10c3('0x2e')],_0x4b0ea3);}return _0x175dcd[_0x10c3('0x1c')](_0x10c3('0x2f'))[_0x10c3('0x20')](_0x596a01,_0x2a1afd)[_0x10c3('0x21')](function(_0x3b9161){if(_0x3b9161&&_0x3b9161[_0x10c3('0x22')]){return _0x3b9161;}else{var _0x2bfb0c=_[_0x10c3('0x33')](_0x1fcdce);if(_0x4a2c88[_0x10c3('0x31')]){var _0x377952={};_0x377952[_0x4a2c88['additionalSearchLead']]=_0x3c5383;_[_0x10c3('0x2d')](_0x2bfb0c['$or'],_0x377952);}return _0x175dcd[_0x10c3('0x1c')](_0x10c3('0x35'))[_0x10c3('0x20')](_0x2bfb0c,_0x2a1afd);}});}});case _0x10c3('0x13'):var _0x1f857f=_[_0x10c3('0x33')](_0x1fcdce);if(_0x4a2c88[_0x10c3('0x2c')]){var _0x4f4d6b={};_0x4f4d6b[_0x4a2c88[_0x10c3('0x2c')]]=_0x3c5383;_['merge'](_0x1f857f[_0x10c3('0x2e')],_0x4f4d6b);}return _0x175dcd[_0x10c3('0x1c')]('Contact')['find'](_0x1f857f,_0x2a1afd)[_0x10c3('0x30')]();case _0x10c3('0x14'):var _0x3cffb8=_[_0x10c3('0x33')](_0x1fcdce);if(_0x4a2c88[_0x10c3('0x31')]){var _0x4f4d6b={};_0x4f4d6b[_0x4a2c88[_0x10c3('0x31')]]=_0x3c5383;_['merge'](_0x3cffb8[_0x10c3('0x2e')],_0x4f4d6b);}return _0x175dcd[_0x10c3('0x1c')](_0x10c3('0x35'))[_0x10c3('0x20')](_0x3cffb8,_0x2a1afd);case _0x10c3('0x15'):var _0x33a4b9=_['cloneDeep'](_0x1fcdce);if(_0x4a2c88[_0x10c3('0x34')]){var _0x4f4d6b={};_0x4f4d6b[_0x4a2c88[_0x10c3('0x34')]]=_0x3c5383;_[_0x10c3('0x2d')](_0x33a4b9[_0x10c3('0x2e')],_0x4f4d6b);}return _0x175dcd[_0x10c3('0x1c')](_0x10c3('0x36'))[_0x10c3('0x20')](_0x33a4b9,_0x2a1afd);default:return null;}})[_0x10c3('0x21')](function(_0x5861ba){if(_0x5861ba&&_0x5861ba[_0x10c3('0x22')]){var _0x596a40=_[_0x10c3('0x37')](_0x5861ba);if(_0x596a40){return BPromise[_0x10c3('0x25')]({'id':_0x596a40['Id'],'name':_0x596a40[_0x10c3('0x38')],'phone':_0x596a40[_0x10c3('0x39')],'endUserType':_0x596a40[_0x10c3('0x3a')][_0x10c3('0x3b')][_0x10c3('0x3c')]()});}}})[_0x10c3('0x21')](function(_0x544e51){if(_0x544e51){logger['info'](_0x10c3('0x3d'),_0x544e51[_0x10c3('0x12')],_0x3c5383);return BPromise[_0x10c3('0x25')](_0x544e51);}else{logger[_0x10c3('0x1a')](_0x10c3('0x3e'),_0x3c5383);var _0x5ce758={'Phone':_0x3c5383};if(_0x4a2c88['moduleCreate']){if(_0x4a2c88[_0x10c3('0x3f')]===_0x10c3('0x13')){logger[_0x10c3('0x1a')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x3c5383,_0x4a2c88[_0x10c3('0x3f')]);_0x5ce758['LastName']=_0x486cb8!==_0x10c3('0x40')?_0x486cb8:util[_0x10c3('0x41')]('Caller\x20-\x20%s',_0x3c5383);}else if(_0x4a2c88[_0x10c3('0x3f')]===_0x10c3('0x14')){logger[_0x10c3('0x1a')](_0x10c3('0x42'),_0x3c5383,_0x4a2c88[_0x10c3('0x3f')]);_0x5ce758[_0x10c3('0x43')]=_0x486cb8!==_0x10c3('0x40')?_0x486cb8:util[_0x10c3('0x41')](_0x10c3('0x44'),_0x3c5383);_0x5ce758['Company']=_0x10c3('0x45');}else if(_0x4a2c88[_0x10c3('0x3f')]===_0x10c3('0x15')){logger[_0x10c3('0x1a')](_0x10c3('0x42'),_0x3c5383,_0x4a2c88[_0x10c3('0x3f')]);_0x5ce758['Name']=_0x486cb8!==''?_0x486cb8:util['format'](_0x10c3('0x44'),_0x3c5383);}else{return null;}}return _0x175dcd[_0x10c3('0x1c')](_[_0x10c3('0x46')](_0x4a2c88['moduleCreate']))['create'](_0x5ce758)[_0x10c3('0x21')](function(_0x97a3ff){return BPromise[_0x10c3('0x25')]({'id':_0x97a3ff['id'],'endUserType':_0x4a2c88['moduleCreate']});});}});}function getCustomFields(_0x9b7a77,_0x3e374a){var _0x1431a0={};if(_0x9b7a77['length']>0x0){_[_0x10c3('0x47')](_0x9b7a77,function(_0x18f9da){if(_[_0x10c3('0x48')]([_0x10c3('0x49'),_0x10c3('0x4a')],_0x18f9da[_0x10c3('0x3b')])&&_0x18f9da[_0x10c3('0x4b')]){_0x1431a0[_0x18f9da[_0x10c3('0x4b')]]=_0x18f9da['content'][_0x10c3('0x4c')]();}else if(_0x18f9da[_0x10c3('0x3b')]===_0x10c3('0x4d')&&_0x18f9da[_0x10c3('0x4e')]&&_0x18f9da[_0x10c3('0x4b')]){_0x3e374a[_0x18f9da[_0x10c3('0x4e')]]&&(_0x1431a0[_0x18f9da[_0x10c3('0x4b')]]=_0x3e374a[_0x18f9da['variableName']][_0x10c3('0x4c')]());}else if(_0x18f9da[_0x10c3('0x3b')]===_0x10c3('0x4f')&&_0x18f9da[_0x10c3('0x50')]&&_0x18f9da[_0x10c3('0x50')][_0x10c3('0x51')]&&_0x18f9da[_0x10c3('0x4b')]){_0x3e374a[_0x18f9da[_0x10c3('0x50')][_0x10c3('0x51')][_0x10c3('0x3c')]()]&&(_0x1431a0[_0x18f9da[_0x10c3('0x4b')]]=_0x3e374a[_0x18f9da['Variable'][_0x10c3('0x51')][_0x10c3('0x3c')]()][_0x10c3('0x4c')]());}});}return _0x1431a0;}function getConnection(_0x10b95b){var _0x553df7=_0x10b95b[_0x10c3('0x52')][_0x10c3('0x53')](_0x10b95b[_0x10c3('0x54')]);var _0xb93fe8=new jsforce[(_0x10c3('0x55'))]({'oauth2':{'loginUrl':_0x10b95b[_0x10c3('0x56')]||_0x10c3('0x57'),'clientId':_0x10b95b[_0x10c3('0x58')],'clientSecret':_0x10b95b[_0x10c3('0x59')]}});return _0xb93fe8[_0x10c3('0x5a')](_0x10b95b[_0x10c3('0x5b')],_0x553df7)[_0x10c3('0x21')](function(){logger[_0x10c3('0x1a')](_0x10c3('0x5c'));return _0xb93fe8;});}exports[_0x10c3('0x5d')]=function(_0x86614a,_0x541253,_0x2b94ac,_0x523053,_0x22d208,_0x29e037){var _0x4250af,_0x356de1,_0x3c860e,_0x1fa5fe;_0x29e037[_0x10c3('0x5e')]=intUtil['stripTrailingSlash'](_0x29e037[_0x10c3('0x5e')]);_0x29e037[_0x10c3('0x56')]=intUtil['stripTrailingSlash'](_0x29e037['remoteUri']);if(_0x22d208&&_0x22d208[_0x10c3('0x5f')]){logger[_0x10c3('0x1a')](_0x10c3('0x60'),_0x10c3('0x61'));_0x541253[_0x10c3('0x62')]=util['format'](_0x10c3('0x63'),_0x29e037[_0x10c3('0x5e')],_0x541253[_0x10c3('0x64')],md5(_0x541253[_0x10c3('0x64')]));}else{_0x541253[_0x10c3('0x62')]='';}return getConnection(_0x29e037)[_0x10c3('0x21')](function(_0x5e77dc){_0x1fa5fe=_0x5e77dc;return getUser(_0x29e037,_0x523053[_0x10c3('0x65')],_0x1fa5fe);})[_0x10c3('0x21')](function(_0x3aa1ea){_0x4250af=_0x3aa1ea;return getEndUser(_0x29e037,_0x2b94ac,_0x541253['calleridname'],_0x541253[_0x10c3('0x66')],_0x1fa5fe);})[_0x10c3('0x21')](function(_0x17ab2c){_0x356de1=_0x17ab2c;return getTicket(_0x29e037,_0x4250af,_0x356de1,_0x2b94ac,_0x541253,_0x2b94ac[_0x10c3('0x67')],_0x1fa5fe,_0x10c3('0x5d'));})['then'](function(_0x2fd431){_0x3c860e=_0x2fd431;logger['info'](_0x10c3('0x68'),_0x3c860e['id']);logger['info'](_0x10c3('0x69'),_0x3c860e['id'],_0x523053[_0x10c3('0x51')],_0x29e037[_0x10c3('0x3b')]);switch(_0x29e037[_0x10c3('0x3b')]){case _0x10c3('0x6a'):emit(util[_0x10c3('0x41')](_0x10c3('0x6b'),_0x523053[_0x10c3('0x51')]),_0x10c3('0x6c'),{'recordId':_0x3c860e['id']});break;case'newTab':emit(util['format'](_0x10c3('0x6b'),_0x523053[_0x10c3('0x51')]),'trigger:browser:url',{'uri':util['format'](_0x10c3('0x6d'),_0x1fa5fe[_0x10c3('0x6e')],_0x3c860e['id'])});break;default:logger[_0x10c3('0x6f')](_0x10c3('0x70'));}})[_0x10c3('0x71')](function(_0x23703b){logger['error'](_0x10c3('0x60'),_0x23703b);});};exports[_0x10c3('0x72')]=function(_0x40a937,_0x493cc3,_0x350b4b,_0x519db5,_0x4122d3,_0x57cef2,_0x567d74){var _0x399bc6,_0x31b36a,_0x247a78,_0x486efc;_0x57cef2['serverUrl']=intUtil[_0x10c3('0x73')](_0x57cef2[_0x10c3('0x5e')]);_0x57cef2[_0x10c3('0x56')]=intUtil[_0x10c3('0x73')](_0x57cef2[_0x10c3('0x56')]);if(_0x567d74&&_0x567d74['recordingFormat']&&_0x567d74['recordingFormat']!==_0x10c3('0x74')){logger[_0x10c3('0x1a')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0x493cc3[_0x10c3('0x62')]=util[_0x10c3('0x41')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x57cef2['serverUrl'],_0x493cc3[_0x10c3('0x64')],md5(_0x493cc3[_0x10c3('0x64')]));}return getConnection(_0x57cef2)[_0x10c3('0x21')](function(_0x4bcac2){_0x486efc=_0x4bcac2;return getUser(_0x57cef2,_0x519db5['email'],_0x486efc);})['then'](function(_0x20dbe0){_0x399bc6=_0x20dbe0;return getEndUser(_0x57cef2,_0x350b4b,_0x493cc3[_0x10c3('0x75')],_0x493cc3['destcalleridnum'],_0x486efc);})[_0x10c3('0x21')](function(_0x1f50c0){_0x31b36a=_0x1f50c0;return getTicket(_0x57cef2,_0x399bc6,_0x31b36a,_0x350b4b,_0x493cc3,_0x350b4b['Fields'],_0x486efc,'outbound');})[_0x10c3('0x21')](function(_0x10a5d8){_0x247a78=_0x10a5d8;logger[_0x10c3('0x1a')](_0x10c3('0x76'),_0x247a78['id']);logger[_0x10c3('0x1a')](_0x10c3('0x77'),_0x247a78['id'],_0x519db5[_0x10c3('0x51')],_0x57cef2['type']);switch(_0x57cef2[_0x10c3('0x3b')]){case _0x10c3('0x6a'):emit(util[_0x10c3('0x41')]('user:%s',_0x519db5['name']),_0x10c3('0x6c'),{'recordId':_0x247a78['id']});break;case _0x10c3('0x78'):emit(util[_0x10c3('0x41')]('user:%s',_0x519db5['name']),'trigger:browser:url',{'uri':util[_0x10c3('0x41')]('%s/%s/e',_0x486efc[_0x10c3('0x6e')],_0x247a78['id'])});break;default:logger[_0x10c3('0x6f')](_0x10c3('0x79'),'Salesforce\x20account\x20type\x20not\x20recognized');}})[_0x10c3('0x71')](function(_0x1a83cf){logger[_0x10c3('0x6f')](_0x10c3('0x79'),_0x1a83cf);});};exports[_0x10c3('0x7a')]=function(_0x221cc2,_0x23831b,_0x6aac2d,_0x3659f2,_0x2b5fec,_0x16e290){var _0x334771,_0xd04c39,_0x52a943,_0x1d38a8;_0x16e290[_0x10c3('0x5e')]=intUtil[_0x10c3('0x73')](_0x16e290[_0x10c3('0x5e')]);_0x16e290['remoteUri']=intUtil[_0x10c3('0x73')](_0x16e290[_0x10c3('0x56')]);if(_0x2b5fec&&_0x2b5fec[_0x10c3('0x5f')]){logger[_0x10c3('0x1a')]('['+_0x23831b[_0x10c3('0x7b')]['toUpperCase']()+']',_0x10c3('0x61'));_0x23831b[_0x10c3('0x62')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x16e290['serverUrl'],_0x23831b[_0x10c3('0x64')],md5(_0x23831b['uniqueid']));}else{_0x23831b[_0x10c3('0x62')]='';}return getConnection(_0x16e290)[_0x10c3('0x21')](function(_0x381f33){_0x1d38a8=_0x381f33;if(!_[_0x10c3('0x1e')](_0x3659f2)){return getUser(_0x16e290,_0x3659f2[_0x10c3('0x51')],_0x1d38a8);}else{return getUser(_0x16e290,null,_0x1d38a8);}})['then'](function(_0x3af312){_0x334771=_0x3af312;return getEndUser(_0x16e290,_0x6aac2d,_0x23831b[_0x10c3('0x7c')],_0x23831b[_0x10c3('0x66')],_0x1d38a8);})[_0x10c3('0x21')](function(_0xdc309f){_0xd04c39=_0xdc309f;return getTicket(_0x16e290,_0x334771,_0xd04c39,_0x6aac2d,_0x23831b,_0x6aac2d[_0x10c3('0x67')],_0x1d38a8);})[_0x10c3('0x21')](function(_0x292089){_0x52a943=_0x292089;logger[_0x10c3('0x1a')]('['+_0x23831b[_0x10c3('0x7b')][_0x10c3('0x7d')]()+_0x10c3('0x7e'),_0x52a943['id']);logger[_0x10c3('0x1a')]('['+_0x23831b[_0x10c3('0x7b')][_0x10c3('0x7d')]()+']\x20Integration\x20account\x20type\x20%s.',_0x16e290[_0x10c3('0x3b')]);})[_0x10c3('0x71')](function(_0x1fec07){logger[_0x10c3('0x6f')]('['+_0x23831b[_0x10c3('0x7b')][_0x10c3('0x7d')]()+']',_0x1fec07);});}; \ No newline at end of file +var _0x2338=['outbound','recordingFormat','none','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridname','destcalleridnum','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','trigger:salesforce:display','trigger:browser:url','%s/%s/e','error','unmanaged','lastevent','toUpperCase',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','lodash','request-promise','moment','md5','jsforce','ioredis','../../../../config/environment','salesforce','defaults','redis','localhost','socket.io-emitter','assign','getString','Descriptions','ticketType','Task','ActivityDate','IsReminderSet','IsRecurrence','endUserType','contact','lead','account','WhatId','leadId','info','Association\x20between\x20Case\x20and\x20Lead\x20skipped','sobject','isNil','validateEmail','User','find','execute','then','length','Email','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','user_id','resolve','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','merge','$or','Contact','cloneDeep','additionalSearchLead','Lead','additionalSearchAccount','Account','additionalSearchContact','Phone','attributes','type','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','Enduser\x20with\x20phone\x20%s\x20not\x20found','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','LastName','','format','Caller\x20-\x20%s','Company','No\x20Company','upperFirst','forEach','string','picklist','idField','toString','variableName','customVariable','Variable','name','toLowerCase','password','concat','Connection','https://login.salesforce.com','clientId','clientSecret','username','serverUrl','stripTrailingSlash','remoteUri','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','uniqueid','recordingURL','email','calleridname','calleridnum','Fields','queue','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','user:%s','newTab','instanceUrl','catch'];(function(_0x254d9f,_0x54ddb5){var _0x1eedb9=function(_0x2d05f1){while(--_0x2d05f1){_0x254d9f['push'](_0x254d9f['shift']());}};_0x1eedb9(++_0x54ddb5);}(_0x2338,0x8d));var _0x8233=function(_0x52c856,_0x47fd69){_0x52c856=_0x52c856-0x0;var _0x41f172=_0x2338[_0x52c856];return _0x41f172;};'use strict';var _=require(_0x8233('0x0'));var rp=require(_0x8233('0x1'));var moment=require(_0x8233('0x2'));var BPromise=require('bluebird');var md5=require(_0x8233('0x3'));var jsforce=require(_0x8233('0x4'));var util=require('util');var Redis=require(_0x8233('0x5'));var intUtil=require('./util');var config=require(_0x8233('0x6'));var logger=require('../../../../config/logger')(_0x8233('0x7'));config['redis']=_[_0x8233('0x8')](config[_0x8233('0x9')],{'host':_0x8233('0xa'),'port':0x18eb});var io=require(_0x8233('0xb'))(new Redis(config[_0x8233('0x9')]));function emit(_0x4daa0e,_0x311d34,_0x388033){io['to'](_0x4daa0e)['emit'](_0x311d34,_0x388033);}function getTicket(_0x1c39d5,_0x4a8508,_0x216975,_0x540b25,_0x28f86f,_0x61af20,_0x98e303,_0x552b40){var _0xbd037d=Object[_0x8233('0xc')]({},{'OwnerId':_0x4a8508['id'],'Subject':intUtil[_0x8233('0xd')](_0x540b25['Subjects'],_0x28f86f,'\x20'),'Description':intUtil[_0x8233('0xd')](_0x540b25[_0x8233('0xe')],_0x28f86f,'\x0a')},getCustomFields(_0x61af20,_0x28f86f));if(_0x216975){if(_0x540b25[_0x8233('0xf')]===_0x8233('0x10')){_0xbd037d[_0x8233('0x11')]=moment['utc']();_0xbd037d[_0x8233('0x12')]=![];_0xbd037d[_0x8233('0x13')]=![];if(_0x216975[_0x8233('0x14')]===_0x8233('0x15')||_0x216975[_0x8233('0x14')]===_0x8233('0x16')){_0xbd037d['WhoId']=_0x216975['id'];}else if(_0x216975[_0x8233('0x14')]===_0x8233('0x17')){_0xbd037d[_0x8233('0x18')]=_0x216975['id'];}}else if(_0x540b25['ticketType']==='Case'){if(_0x216975['endUserType']===_0x8233('0x15')){_0xbd037d['ContactId']=_0x216975['id'];}else if(_0x216975[_0x8233('0x14')]===_0x8233('0x17')){_0xbd037d['AccountId']=_0x216975['id'];}else if(_0x216975[_0x8233('0x14')]===_0x8233('0x16')&&_0x540b25[_0x8233('0x19')]){_0xbd037d[_0x540b25['leadId']]=_0x216975['id'];}else{logger[_0x8233('0x1a')](_0x8233('0x1b'));}}}return _0x98e303[_0x8233('0x1c')](_0x540b25[_0x8233('0xf')])['create'](_0xbd037d);}function getUser(_0x2f19ec,_0x31f8f5,_0x547c7){if(!_[_0x8233('0x1d')](_0x31f8f5)&&intUtil[_0x8233('0x1e')](_0x31f8f5)){var _0x12d67b={'Email':_0x31f8f5};var _0x55ea86={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x547c7[_0x8233('0x1c')](_0x8233('0x1f'))[_0x8233('0x20')](_0x12d67b,_0x55ea86)[_0x8233('0x21')]()[_0x8233('0x22')](function(_0x5f3be2){if(_0x5f3be2[_0x8233('0x23')]){var _0x213e06=_[_0x8233('0x20')](_0x5f3be2,function(_0x3c1839){return _0x3c1839[_0x8233('0x24')]===_0x31f8f5;});if(_0x213e06){logger[_0x8233('0x1a')]('Agent\x20%s\x20found.',_0x31f8f5);return BPromise['resolve']({'id':_0x213e06['Id'],'name':_0x213e06[_0x8233('0x25')]});}}else{logger[_0x8233('0x1a')](_0x8233('0x26'),_0x31f8f5);return _0x547c7[_0x8233('0x27')]()[_0x8233('0x22')](function(_0x909a15){return BPromise['resolve']({'id':_0x909a15[_0x8233('0x28')],'name':_0x909a15['display_name']});});}});}else{logger['info'](_0x8233('0x26'),_0x31f8f5);return _0x547c7[_0x8233('0x27')]()[_0x8233('0x22')](function(_0x2c4e3a){return BPromise[_0x8233('0x29')]({'id':_0x2c4e3a[_0x8233('0x28')],'name':_0x2c4e3a['display_name']});});}}function getEndUser(_0x400cb9,_0x30f984,_0x117722,_0x9fc398,_0x4d844f){var _0x3fbd20={'$or':{'Phone':_0x9fc398}};var _0x10a77c={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0x8233('0x29')]()[_0x8233('0x22')](function(){logger[_0x8233('0x1a')](_0x8233('0x2a'),_0x9fc398,_0x30f984[_0x8233('0x2b')]);switch(_0x30f984[_0x8233('0x2b')]){case _0x8233('0x2c'):var _0x4ab4f7=_['cloneDeep'](_0x3fbd20);if(_0x30f984['additionalSearchContact']){var _0x59a78={};_0x59a78[_0x30f984['additionalSearchContact']]=_0x9fc398;_[_0x8233('0x2d')](_0x4ab4f7[_0x8233('0x2e')],_0x59a78);}return _0x4d844f[_0x8233('0x1c')](_0x8233('0x2f'))[_0x8233('0x20')](_0x4ab4f7,_0x10a77c)[_0x8233('0x21')]()['then'](function(_0x2140fa){if(_0x2140fa&&_0x2140fa[_0x8233('0x23')]){return _0x2140fa;}else{var _0xfd9025=_[_0x8233('0x30')](_0x3fbd20);if(_0x30f984['additionalSearchLead']){var _0x3affac={};_0x3affac[_0x30f984[_0x8233('0x31')]]=_0x9fc398;_[_0x8233('0x2d')](_0xfd9025[_0x8233('0x2e')],_0x3affac);}return _0x4d844f[_0x8233('0x1c')](_0x8233('0x32'))[_0x8233('0x20')](_0xfd9025,_0x10a77c);}});case'account_contact_lead':var _0x28f312=_['cloneDeep'](_0x3fbd20);if(_0x30f984[_0x8233('0x33')]){var _0x59a78={};_0x59a78[_0x30f984[_0x8233('0x33')]]=_0x9fc398;_[_0x8233('0x2d')](_0x28f312[_0x8233('0x2e')],_0x59a78);}return _0x4d844f[_0x8233('0x1c')](_0x8233('0x34'))[_0x8233('0x20')](_0x28f312,_0x10a77c)['execute']()[_0x8233('0x22')](function(_0x512651){if(_0x512651&&_0x512651['length']){return _0x512651;}else{var _0x1f8c80=_['cloneDeep'](_0x3fbd20);if(_0x30f984[_0x8233('0x35')]){var _0xd03460={};_0xd03460[_0x30f984[_0x8233('0x35')]]=_0x9fc398;_[_0x8233('0x2d')](_0x1f8c80[_0x8233('0x2e')],_0xd03460);}return _0x4d844f['sobject'](_0x8233('0x2f'))[_0x8233('0x20')](_0x1f8c80,_0x10a77c)[_0x8233('0x22')](function(_0x3981b0){if(_0x3981b0&&_0x3981b0[_0x8233('0x23')]){return _0x3981b0;}else{var _0x173185=_[_0x8233('0x30')](_0x3fbd20);if(_0x30f984['additionalSearchLead']){var _0x3e7750={};_0x3e7750[_0x30f984['additionalSearchLead']]=_0x9fc398;_['merge'](_0x173185['$or'],_0x3e7750);}return _0x4d844f['sobject'](_0x8233('0x32'))[_0x8233('0x20')](_0x173185,_0x10a77c);}});}});case _0x8233('0x15'):var _0x4ab4f7=_[_0x8233('0x30')](_0x3fbd20);if(_0x30f984['additionalSearchContact']){var _0x59a78={};_0x59a78[_0x30f984['additionalSearchContact']]=_0x9fc398;_[_0x8233('0x2d')](_0x4ab4f7[_0x8233('0x2e')],_0x59a78);}return _0x4d844f[_0x8233('0x1c')](_0x8233('0x2f'))['find'](_0x4ab4f7,_0x10a77c)[_0x8233('0x21')]();case'lead':var _0x2cb45a=_['cloneDeep'](_0x3fbd20);if(_0x30f984[_0x8233('0x31')]){var _0x59a78={};_0x59a78[_0x30f984[_0x8233('0x31')]]=_0x9fc398;_[_0x8233('0x2d')](_0x2cb45a['$or'],_0x59a78);}return _0x4d844f[_0x8233('0x1c')](_0x8233('0x32'))[_0x8233('0x20')](_0x2cb45a,_0x10a77c);case _0x8233('0x17'):var _0x28f312=_['cloneDeep'](_0x3fbd20);if(_0x30f984[_0x8233('0x33')]){var _0x59a78={};_0x59a78[_0x30f984['additionalSearchAccount']]=_0x9fc398;_['merge'](_0x28f312[_0x8233('0x2e')],_0x59a78);}return _0x4d844f[_0x8233('0x1c')](_0x8233('0x34'))[_0x8233('0x20')](_0x28f312,_0x10a77c);default:return null;}})['then'](function(_0x53fad0){if(_0x53fad0&&_0x53fad0[_0x8233('0x23')]){var _0x5731b6=_['first'](_0x53fad0);if(_0x5731b6){return BPromise[_0x8233('0x29')]({'id':_0x5731b6['Id'],'name':_0x5731b6['Name'],'phone':_0x5731b6[_0x8233('0x36')],'endUserType':_0x5731b6[_0x8233('0x37')][_0x8233('0x38')]['toLowerCase']()});}}})['then'](function(_0x4ebd89){if(_0x4ebd89){logger[_0x8233('0x1a')](_0x8233('0x39'),_0x4ebd89[_0x8233('0x14')],_0x9fc398);return BPromise[_0x8233('0x29')](_0x4ebd89);}else{logger['info'](_0x8233('0x3a'),_0x9fc398);var _0x67d222={'Phone':_0x9fc398};if(_0x30f984[_0x8233('0x3b')]){if(_0x30f984[_0x8233('0x3b')]===_0x8233('0x15')){logger[_0x8233('0x1a')](_0x8233('0x3c'),_0x9fc398,_0x30f984[_0x8233('0x3b')]);_0x67d222[_0x8233('0x3d')]=_0x117722!==_0x8233('0x3e')?_0x117722:util[_0x8233('0x3f')](_0x8233('0x40'),_0x9fc398);}else if(_0x30f984['moduleCreate']===_0x8233('0x16')){logger[_0x8233('0x1a')](_0x8233('0x3c'),_0x9fc398,_0x30f984['moduleCreate']);_0x67d222[_0x8233('0x3d')]=_0x117722!==_0x8233('0x3e')?_0x117722:util['format']('Caller\x20-\x20%s',_0x9fc398);_0x67d222[_0x8233('0x41')]=_0x8233('0x42');}else if(_0x30f984[_0x8233('0x3b')]===_0x8233('0x17')){logger['info'](_0x8233('0x3c'),_0x9fc398,_0x30f984[_0x8233('0x3b')]);_0x67d222[_0x8233('0x25')]=_0x117722!==_0x8233('0x3e')?_0x117722:util[_0x8233('0x3f')](_0x8233('0x40'),_0x9fc398);}else{return null;}}return _0x4d844f[_0x8233('0x1c')](_[_0x8233('0x43')](_0x30f984[_0x8233('0x3b')]))['create'](_0x67d222)[_0x8233('0x22')](function(_0x249b09){return BPromise['resolve']({'id':_0x249b09['id'],'endUserType':_0x30f984['moduleCreate']});});}});}function getCustomFields(_0x2a26dd,_0x3027d0){var _0x1eee17={};if(_0x2a26dd[_0x8233('0x23')]>0x0){_[_0x8233('0x44')](_0x2a26dd,function(_0x8ca4f5){if(_['includes']([_0x8233('0x45'),_0x8233('0x46')],_0x8ca4f5['type'])&&_0x8ca4f5['idField']){_0x1eee17[_0x8ca4f5[_0x8233('0x47')]]=_0x8ca4f5['content'][_0x8233('0x48')]();}else if(_0x8ca4f5[_0x8233('0x38')]==='variable'&&_0x8ca4f5[_0x8233('0x49')]&&_0x8ca4f5[_0x8233('0x47')]){_0x3027d0[_0x8ca4f5[_0x8233('0x49')]]&&(_0x1eee17[_0x8ca4f5[_0x8233('0x47')]]=_0x3027d0[_0x8ca4f5['variableName']][_0x8233('0x48')]());}else if(_0x8ca4f5['type']===_0x8233('0x4a')&&_0x8ca4f5[_0x8233('0x4b')]&&_0x8ca4f5[_0x8233('0x4b')][_0x8233('0x4c')]&&_0x8ca4f5[_0x8233('0x47')]){_0x3027d0[_0x8ca4f5[_0x8233('0x4b')]['name'][_0x8233('0x4d')]()]&&(_0x1eee17[_0x8ca4f5[_0x8233('0x47')]]=_0x3027d0[_0x8ca4f5[_0x8233('0x4b')][_0x8233('0x4c')]['toLowerCase']()][_0x8233('0x48')]());}});}return _0x1eee17;}function getConnection(_0x19ba69){var _0x5eb552=_0x19ba69[_0x8233('0x4e')][_0x8233('0x4f')](_0x19ba69['securityToken']);var _0x2a9a0d=new jsforce[(_0x8233('0x50'))]({'oauth2':{'loginUrl':_0x19ba69['remoteUri']||_0x8233('0x51'),'clientId':_0x19ba69[_0x8233('0x52')],'clientSecret':_0x19ba69[_0x8233('0x53')]}});return _0x2a9a0d['login'](_0x19ba69[_0x8233('0x54')],_0x5eb552)[_0x8233('0x22')](function(){logger[_0x8233('0x1a')]('Connection\x20established.');return _0x2a9a0d;});}exports['queue']=function(_0x5ac22d,_0x42ba16,_0x57f316,_0x26375d,_0x2d4071,_0x859450){var _0x29a358,_0x48999d,_0x36be82,_0x1af445;_0x859450[_0x8233('0x55')]=intUtil[_0x8233('0x56')](_0x859450[_0x8233('0x55')]);_0x859450[_0x8233('0x57')]=intUtil[_0x8233('0x56')](_0x859450[_0x8233('0x57')]);if(_0x2d4071&&_0x2d4071[_0x8233('0x58')]){logger[_0x8233('0x1a')](_0x8233('0x59'),_0x8233('0x5a'));_0x42ba16['recordingURL']=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x859450[_0x8233('0x55')],_0x42ba16[_0x8233('0x5b')],md5(_0x42ba16['uniqueid']));}else{_0x42ba16[_0x8233('0x5c')]='';}return getConnection(_0x859450)[_0x8233('0x22')](function(_0x500f4f){_0x1af445=_0x500f4f;return getUser(_0x859450,_0x26375d[_0x8233('0x5d')],_0x1af445);})[_0x8233('0x22')](function(_0x1e9b5e){_0x29a358=_0x1e9b5e;return getEndUser(_0x859450,_0x57f316,_0x42ba16[_0x8233('0x5e')],_0x42ba16[_0x8233('0x5f')],_0x1af445);})[_0x8233('0x22')](function(_0x400a62){_0x48999d=_0x400a62;return getTicket(_0x859450,_0x29a358,_0x48999d,_0x57f316,_0x42ba16,_0x57f316[_0x8233('0x60')],_0x1af445,_0x8233('0x61'));})[_0x8233('0x22')](function(_0x1874c1){_0x36be82=_0x1874c1;logger[_0x8233('0x1a')](_0x8233('0x62'),_0x36be82['id']);logger[_0x8233('0x1a')](_0x8233('0x63'),_0x36be82['id'],_0x26375d['name'],_0x859450[_0x8233('0x38')]);switch(_0x859450[_0x8233('0x38')]){case _0x8233('0x64'):emit(util['format'](_0x8233('0x65'),_0x26375d[_0x8233('0x4c')]),'trigger:salesforce:display',{'recordId':_0x36be82['id']});break;case _0x8233('0x66'):emit(util[_0x8233('0x3f')](_0x8233('0x65'),_0x26375d[_0x8233('0x4c')]),'trigger:browser:url',{'uri':util[_0x8233('0x3f')]('%s/%s/e',_0x1af445[_0x8233('0x67')],_0x36be82['id'])});break;default:logger['error']('[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.');}})[_0x8233('0x68')](function(_0x246bb6){logger['error'](_0x8233('0x59'),_0x246bb6);});};exports[_0x8233('0x69')]=function(_0x2dff1c,_0x5700fb,_0x1e45c2,_0x1af173,_0x4d3964,_0x46f99d,_0x18f004){var _0x40b50f,_0x55759c,_0x15fc6b,_0x3c3848;_0x46f99d[_0x8233('0x55')]=intUtil[_0x8233('0x56')](_0x46f99d[_0x8233('0x55')]);_0x46f99d[_0x8233('0x57')]=intUtil[_0x8233('0x56')](_0x46f99d[_0x8233('0x57')]);if(_0x18f004&&_0x18f004[_0x8233('0x6a')]&&_0x18f004['recordingFormat']!==_0x8233('0x6b')){logger[_0x8233('0x1a')](_0x8233('0x6c'),_0x8233('0x5a'));_0x5700fb[_0x8233('0x5c')]=util['format'](_0x8233('0x6d'),_0x46f99d[_0x8233('0x55')],_0x5700fb[_0x8233('0x5b')],md5(_0x5700fb[_0x8233('0x5b')]));}return getConnection(_0x46f99d)[_0x8233('0x22')](function(_0x2b5c26){_0x3c3848=_0x2b5c26;return getUser(_0x46f99d,_0x1af173['email'],_0x3c3848);})[_0x8233('0x22')](function(_0xbbc957){_0x40b50f=_0xbbc957;return getEndUser(_0x46f99d,_0x1e45c2,_0x5700fb[_0x8233('0x6e')],_0x5700fb[_0x8233('0x6f')],_0x3c3848);})['then'](function(_0x17407a){_0x55759c=_0x17407a;return getTicket(_0x46f99d,_0x40b50f,_0x55759c,_0x1e45c2,_0x5700fb,_0x1e45c2[_0x8233('0x60')],_0x3c3848,'outbound');})[_0x8233('0x22')](function(_0x2fd9cb){_0x15fc6b=_0x2fd9cb;logger['info'](_0x8233('0x70'),_0x15fc6b['id']);logger['info'](_0x8233('0x71'),_0x15fc6b['id'],_0x1af173['name'],_0x46f99d[_0x8233('0x38')]);switch(_0x46f99d['type']){case _0x8233('0x64'):emit(util[_0x8233('0x3f')](_0x8233('0x65'),_0x1af173[_0x8233('0x4c')]),_0x8233('0x72'),{'recordId':_0x15fc6b['id']});break;case _0x8233('0x66'):emit(util['format'](_0x8233('0x65'),_0x1af173[_0x8233('0x4c')]),_0x8233('0x73'),{'uri':util[_0x8233('0x3f')](_0x8233('0x74'),_0x3c3848['instanceUrl'],_0x15fc6b['id'])});break;default:logger[_0x8233('0x75')](_0x8233('0x6c'),'Salesforce\x20account\x20type\x20not\x20recognized');}})[_0x8233('0x68')](function(_0x337c45){logger['error'](_0x8233('0x6c'),_0x337c45);});};exports[_0x8233('0x76')]=function(_0x11e53e,_0x5eeeaa,_0x5d4ba0,_0x3b12a9,_0x2efcee,_0x5d3e01){var _0x2cc6e2,_0x318153,_0x5a7a94,_0x239576;_0x5d3e01[_0x8233('0x55')]=intUtil[_0x8233('0x56')](_0x5d3e01['serverUrl']);_0x5d3e01['remoteUri']=intUtil[_0x8233('0x56')](_0x5d3e01[_0x8233('0x57')]);if(_0x2efcee&&_0x2efcee[_0x8233('0x58')]){logger[_0x8233('0x1a')]('['+_0x5eeeaa[_0x8233('0x77')][_0x8233('0x78')]()+']',_0x8233('0x5a'));_0x5eeeaa[_0x8233('0x5c')]=util['format'](_0x8233('0x6d'),_0x5d3e01[_0x8233('0x55')],_0x5eeeaa[_0x8233('0x5b')],md5(_0x5eeeaa['uniqueid']));}else{_0x5eeeaa[_0x8233('0x5c')]='';}return getConnection(_0x5d3e01)[_0x8233('0x22')](function(_0x5b004c){_0x239576=_0x5b004c;if(!_['isNil'](_0x3b12a9)){return getUser(_0x5d3e01,_0x3b12a9[_0x8233('0x4c')],_0x239576);}else{return getUser(_0x5d3e01,null,_0x239576);}})[_0x8233('0x22')](function(_0x598ef7){_0x2cc6e2=_0x598ef7;return getEndUser(_0x5d3e01,_0x5d4ba0,_0x5eeeaa[_0x8233('0x5e')],_0x5eeeaa['calleridnum'],_0x239576);})['then'](function(_0x5308d9){_0x318153=_0x5308d9;return getTicket(_0x5d3e01,_0x2cc6e2,_0x318153,_0x5d4ba0,_0x5eeeaa,_0x5d4ba0[_0x8233('0x60')],_0x239576);})[_0x8233('0x22')](function(_0x2984a){_0x5a7a94=_0x2984a;logger['info']('['+_0x5eeeaa[_0x8233('0x77')][_0x8233('0x78')]()+_0x8233('0x79'),_0x5a7a94['id']);logger[_0x8233('0x1a')]('['+_0x5eeeaa[_0x8233('0x77')]['toUpperCase']()+_0x8233('0x7a'),_0x5d3e01[_0x8233('0x38')]);})['catch'](function(_0x51f7bd){logger[_0x8233('0x75')]('['+_0x5eeeaa['lastevent'][_0x8233('0x78')]()+']',_0x51f7bd);});}; \ 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 5633dc6..c468c5a 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 _0xe147=['all','Tags','map','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','format','user:%s','emit','trigger:browser:url','username','sysparm_limit=1','sysparm_display_value=true','remoteUri','stripTrailingSlash','serverUrl','isNil','email','outbound','destcalleridnum','calleridnum','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Recording\x20is\x20enabled!','recordingURL','recordingFormat','The\x20ticket\x20ID\x20is:\x20%s','call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...','lodash','bluebird','request-promise','util','./util','../../../../config/environment','../../../../config/logger','servicenow','redis','defaults','localhost','socket.io-emitter','GET','then','result','length','adminId','info','],\x20getAdminUser\x20crm','catch','error','toUpperCase','message','],\x20getUser\x20input\x20crm','validateEmail','userEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','true','userId','sys_id','adminEmail','],\x20getUser\x20crm',']\x20using\x20admin\x20profile','POST','sys_user?','endUserNumber','user','endUserId','],\x20getEndUser\x20input\x20crm','],\x20getEndUser\x20crm','forEach','string','picklist','type','nameField','customField','content','toString','includes','idField','toLowerCase','variable','variableName','customVariable','Variable','name',']\x20getTicket\x20input\x20crm','assign','getString','ticketId','ticketNumber','number','label','?sysparm_query=name%3D','label_entry','Incident',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','push'];(function(_0x4b4dba,_0x50224d){var _0x14fc1b=function(_0x524b0d){while(--_0x524b0d){_0x4b4dba['push'](_0x4b4dba['shift']());}};_0x14fc1b(++_0x50224d);}(_0xe147,0xe7));var _0x7e14=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xe147[_0x5b644e];return _0x49c6bf;};'use strict';var _=require(_0x7e14('0x0'));var Promise=require(_0x7e14('0x1'));var rp=require(_0x7e14('0x2'));var util=require(_0x7e14('0x3'));var md5=require('md5');var Redis=require('ioredis');var intUtil=require(_0x7e14('0x4'));var config=require(_0x7e14('0x5'));var logger=require(_0x7e14('0x6'))(_0x7e14('0x7'));config[_0x7e14('0x8')]=_[_0x7e14('0x9')](config['redis'],{'host':_0x7e14('0xa'),'port':0x18eb});var io=require(_0x7e14('0xb'))(new Redis(config[_0x7e14('0x8')]));function getAdminUser(_0x38b54c,_0x513ff5,_0x52c5fc,_0x76c55a,_0x51594b,_0x1f79a0){return new Promise(function(_0x300e36,_0x1ef23a){var _0x1582af={'method':_0x7e14('0xc'),'uri':_0x76c55a+'sys_user?sysparm_query=user_name%3Dadmin'+'&'+_0x51594b+'&'+_0x1f79a0,'auth':_0x513ff5,'json':!![]};return rp(_0x1582af)[_0x7e14('0xd')](function(_0x50035f){if(_0x50035f[_0x7e14('0xe')][_0x7e14('0xf')]>0x0){_0x52c5fc[_0x7e14('0x10')]=_0x50035f['result'][0x0]['sys_id'];}logger[_0x7e14('0x11')]('['+[_0x38b54c['toUpperCase']()]+_0x7e14('0x12'),_0x52c5fc);_0x300e36(_0x52c5fc);})[_0x7e14('0x13')](function(_0x467ab1){logger[_0x7e14('0x14')]('['+[_0x38b54c[_0x7e14('0x15')]()]+']',_0x467ab1[_0x7e14('0x16')]);_0x1ef23a(_0x467ab1[_0x7e14('0x16')]);});});}function getUser(_0x489fbe,_0x501572,_0x17751e,_0x50fbdf,_0x175964){return function(_0x4bca83){logger[_0x7e14('0x11')]('['+[_0x489fbe[_0x7e14('0x15')]()]+_0x7e14('0x17'),_0x4bca83);return new Promise(function(_0x32e6f8,_0x2a69b3){if(intUtil[_0x7e14('0x18')](_0x4bca83[_0x7e14('0x19')])){var _0x487e0c={'method':'GET','uri':_0x17751e+_0x7e14('0x1a')+_0x4bca83[_0x7e14('0x19')]+'&'+_0x50fbdf+'&'+_0x175964,'auth':_0x501572,'json':!![]};logger[_0x7e14('0x11')]('['+[_0x489fbe[_0x7e14('0x15')]()]+_0x7e14('0x1b'),_0x487e0c);return rp(_0x487e0c)[_0x7e14('0xd')](function(_0x1c158d){logger[_0x7e14('0x11')]('['+[_0x489fbe['toUpperCase']()]+'],\x20getUser\x20entity',_0x1c158d);if(_0x1c158d[_0x7e14('0xe')][_0x7e14('0xf')]>0x0&&String(_0x1c158d['result'][0x0]['active'])===_0x7e14('0x1c')){_0x4bca83[_0x7e14('0x1d')]=_0x1c158d[_0x7e14('0xe')][0x0][_0x7e14('0x1e')];}else{_0x4bca83[_0x7e14('0x1d')]=_0x4bca83[_0x7e14('0x10')];_0x4bca83['userEmail']=_0x4bca83[_0x7e14('0x1f')];}logger[_0x7e14('0x11')]('['+[_0x489fbe[_0x7e14('0x15')]()]+_0x7e14('0x20'),_0x4bca83);_0x32e6f8(_0x4bca83);})[_0x7e14('0x13')](function(_0x1988d6){logger['error']('['+[_0x489fbe[_0x7e14('0x15')]()]+']',_0x1988d6[_0x7e14('0x16')]);_0x2a69b3(_0x1988d6['message']);});}else{logger['info']('['+[_0x489fbe['toUpperCase']()]+_0x7e14('0x21'));_0x4bca83[_0x7e14('0x1d')]=_0x4bca83['adminId'];_0x4bca83[_0x7e14('0x19')]=_0x4bca83[_0x7e14('0x1f')];_0x32e6f8(_0x4bca83);}});};}function createEndUser(_0x330cf3,_0x27c647,_0x36275d,_0x3969fa,_0x5cadfb){logger['info']('['+[_0x330cf3[_0x7e14('0x15')]()]+'],\x20createEndUser\x20input\x20crm',_0x36275d);return new Promise(function(_0x33b7cc,_0x219276){var _0x57f551={'method':_0x7e14('0x22'),'uri':_0x3969fa+_0x7e14('0x23')+_0x5cadfb,'body':{'user_name':_0x36275d[_0x7e14('0x24')],'roles':_0x7e14('0x25'),'first_name':_0x36275d[_0x7e14('0x24')],'active':_0x7e14('0x1c'),'date_format':'System','phone':_0x36275d['endUserNumber']},'auth':_0x27c647,'json':!![]};return rp(_0x57f551)['then'](function(_0x318252){logger[_0x7e14('0x11')]('['+[_0x330cf3[_0x7e14('0x15')]()]+'],\x20EndUser\x20schema',_0x318252['result']);_0x36275d[_0x7e14('0x26')]=_0x318252[_0x7e14('0xe')]['sys_id'];_0x33b7cc(_0x36275d);})[_0x7e14('0x13')](function(_0x444c1e){logger[_0x7e14('0x14')]('['+[_0x330cf3[_0x7e14('0x15')]()]+']',_0x444c1e[_0x7e14('0x16')]);_0x219276(_0x444c1e[_0x7e14('0x16')]);});});}function getEndUser(_0x52544c,_0x3b7eca,_0x35403c,_0x2d1c3d,_0x1e6195){return function(_0x1229e3){logger[_0x7e14('0x11')]('['+[_0x52544c['toUpperCase']()]+_0x7e14('0x27'),_0x1229e3);return new Promise(function(_0x2b3486,_0x53319c){var _0xe03e6d={'method':_0x7e14('0xc'),'uri':_0x35403c+'sys_user?sysparm_query=phone%3D'+_0x1229e3[_0x7e14('0x24')]+'&'+_0x2d1c3d+'&'+_0x1e6195,'auth':_0x3b7eca,'json':!![]};return rp(_0xe03e6d)[_0x7e14('0xd')](function(_0x150c8f){if(_0x150c8f[_0x7e14('0xe')][_0x7e14('0xf')]>0x0){_0x1229e3[_0x7e14('0x26')]=_0x150c8f[_0x7e14('0xe')][0x0][_0x7e14('0x1e')];logger[_0x7e14('0x11')]('['+[_0x52544c[_0x7e14('0x15')]()]+_0x7e14('0x28'),_0x1229e3);_0x2b3486(_0x1229e3);}else{return createEndUser(_0x52544c,_0x3b7eca,_0x1229e3,_0x35403c,_0x2d1c3d)[_0x7e14('0xd')](function(_0x5082ef){logger['info']('['+[_0x52544c[_0x7e14('0x15')]()]+'],\x20createEndUser\x20crm',_0x5082ef);_0x2b3486(_0x5082ef);});}})[_0x7e14('0x13')](function(_0x2922a2){logger['error']('['+[_0x52544c[_0x7e14('0x15')]()]+']',_0x2922a2[_0x7e14('0x16')]);_0x53319c(_0x2922a2[_0x7e14('0x16')]);});});};}function getCustomFields(_0x479829,_0xd53ed4){var _0x504f0b={};if(_0x479829['length']>0x0){_[_0x7e14('0x29')](_0x479829,function(_0x3e7f70){if(_['includes']([_0x7e14('0x2a'),_0x7e14('0x2b')],_0x3e7f70[_0x7e14('0x2c')])&&_0x3e7f70[_0x7e14('0x2d')]&&!_0x3e7f70[_0x7e14('0x2e')]){_0x504f0b[_0x3e7f70[_0x7e14('0x2d')]['toLowerCase']()]=_0x3e7f70[_0x7e14('0x2f')][_0x7e14('0x30')]();}else if(_[_0x7e14('0x31')](['string',_0x7e14('0x2b')],_0x3e7f70['type'])&&_0x3e7f70['idField']&&_0x3e7f70['customField']){_0x504f0b[_0x3e7f70[_0x7e14('0x32')][_0x7e14('0x33')]()]=_0x3e7f70[_0x7e14('0x2f')][_0x7e14('0x30')]();}else if(_0x3e7f70[_0x7e14('0x2c')]===_0x7e14('0x34')&&_0x3e7f70[_0x7e14('0x35')]&&_0x3e7f70[_0x7e14('0x32')]&&_0x3e7f70[_0x7e14('0x2e')]){_0x504f0b[_0x3e7f70[_0x7e14('0x32')][_0x7e14('0x33')]()]=_0xd53ed4[_0x3e7f70['variableName']][_0x7e14('0x30')]();}else if(_0x3e7f70[_0x7e14('0x2c')]===_0x7e14('0x36')&&_0x3e7f70[_0x7e14('0x37')]&&_0x3e7f70[_0x7e14('0x37')][_0x7e14('0x38')]&&_0x3e7f70[_0x7e14('0x32')]&&_0x3e7f70['customField']){_0x504f0b[_0x3e7f70['idField']['toLowerCase']()]=_0xd53ed4[_0x3e7f70[_0x7e14('0x37')][_0x7e14('0x38')]['toLowerCase']()][_0x7e14('0x30')]();}});}return _0x504f0b;}function getTicket(_0x803f72,_0x30ef48,_0xa3e387,_0x191382,_0x4a6103,_0x1c388e){return function(_0x4037d5){logger['info']('['+[_0x803f72[_0x7e14('0x15')]()]+_0x7e14('0x39'),_0x4037d5);return new Promise(function(_0x50bb19,_0x16ac87){var _0x152469=_0x803f72[_0x7e14('0x33')]()==='outbound'?_0x4037d5[_0x7e14('0x1d')]:_0x4037d5['endUserId'];var _0x1078e5={'method':'POST','uri':_0xa3e387+'incident'+'?'+_0x1c388e,'body':Object[_0x7e14('0x3a')]({},{'active':_0x7e14('0x1c'),'caller_id':_0x152469,'assigned_to':_0x4037d5[_0x7e14('0x1d')],'short_description':intUtil['getString'](_0x191382['Subjects'],_0x4a6103,'\x20'),'description':intUtil[_0x7e14('0x3b')](_0x191382['Descriptions'],_0x4a6103,'\x0a')},getCustomFields(_0x191382['Fields'],_0x4a6103)),'auth':_0x30ef48,'json':!![]};return rp(_0x1078e5)['then'](function(_0x3dfcdb){logger['info']('['+[_0x803f72[_0x7e14('0x15')]()]+']\x20POST\x20incident\x20entity\x20schema',_0x3dfcdb[_0x7e14('0xe')]);_0x4037d5[_0x7e14('0x3c')]=_0x3dfcdb[_0x7e14('0xe')]['sys_id'];_0x4037d5[_0x7e14('0x3d')]=_0x3dfcdb[_0x7e14('0xe')][_0x7e14('0x3e')];logger[_0x7e14('0x11')]('['+[_0x803f72[_0x7e14('0x15')]()]+']\x20getTicket\x20crm',_0x4037d5);_0x50bb19(_0x4037d5);})[_0x7e14('0x13')](function(_0x3cd888){logger['error']('['+[_0x803f72[_0x7e14('0x15')]()]+']',_0x3cd888[_0x7e14('0x16')]);_0x16ac87(_0x3cd888[_0x7e14('0x16')]);});});};}function createRemoteTag(_0x53c5f2,_0x3db8db,_0xff5bfa,_0x438d5f){return new Promise(function(_0xff762,_0xa6fa3c){var _0x3c248b={'method':'POST','uri':_0xff5bfa+_0x7e14('0x3f')+'?'+_0x438d5f,'body':{'short_description':_0x53c5f2,'global':!![],'active':!![],'name':_0x53c5f2},'auth':_0x3db8db,'json':!![]};return rp(_0x3c248b)[_0x7e14('0xd')](function(_0xc763de){var _0x2b608b=_0xc763de['result']['sys_id'];_0xff762(_0x2b608b);});});}function getRemoteTag(_0x40d4dd,_0x394561,_0x308cc9,_0x22acda,_0x47c2e1){return new Promise(function(_0x3622d0,_0x2d69ec){var _0x4ec16a={'method':'GET','uri':_0x308cc9+_0x7e14('0x3f')+_0x7e14('0x40')+_0x40d4dd+'&'+_0x22acda,'auth':_0x394561,'json':!![]};return rp(_0x4ec16a)[_0x7e14('0xd')](function(_0xd39079){if(_0xd39079[_0x7e14('0xe')]['length']>0x0){var _0x329dba=_0xd39079['result'][0x0]['sys_id'];_0x3622d0(_0x329dba);}else{return createRemoteTag(_0x40d4dd,_0x394561,_0x308cc9,_0x22acda)[_0x7e14('0xd')](function(_0x340b95){_0x3622d0(_0x340b95);});}});});}function assignTagToIncident(_0x6357bb,_0x5c61b5,_0x37609b,_0x71dbcd,_0x18db94){return new Promise(function(_0x59ba51,_0x2ea1c1){var _0x1d98c2={'method':_0x7e14('0x22'),'uri':_0x37609b+_0x7e14('0x41')+'?'+_0x18db94,'body':{'label':_0x6357bb,'table':'incident','id_type':_0x7e14('0x42'),'table_key':_0x71dbcd['ticketId'],'title':'Incident\x20-\x20'+_0x71dbcd['ticketNumber'],'id_display':_0x71dbcd[_0x7e14('0x3d')]},'auth':_0x5c61b5,'json':!![]};return rp(_0x1d98c2)['then'](function(_0x2fb01e){_0x59ba51();})['catch'](function(){_0x59ba51();});});}function manageTags(_0x3073bb,_0x589fdf,_0x4f72f4,_0x14c0aa,_0x491e6b,_0x5a09c2,_0x57ce22){return new Promise(function(_0x3173c0,_0xff77d){var _0x2218dc=[];_0x589fdf['forEach'](function(_0x376dd6){_0x2218dc['push'](getRemoteTag(_0x376dd6,_0x4f72f4,_0x14c0aa,_0x5a09c2,_0x57ce22));});return Promise['all'](_0x2218dc)['then'](function(_0x3e73e2){if(_0x3e73e2[_0x7e14('0xf')]){logger['info']('['+[_0x3073bb['toUpperCase']()]+_0x7e14('0x43'),_0x3e73e2);var _0x5ec0ca=[];_0x3e73e2[_0x7e14('0x29')](function(_0x4e9ed1){_0x5ec0ca[_0x7e14('0x44')](assignTagToIncident(_0x4e9ed1,_0x4f72f4,_0x14c0aa,_0x491e6b,_0x5a09c2));});return Promise[_0x7e14('0x45')](_0x5ec0ca)[_0x7e14('0xd')](function(){_0x3173c0();})[_0x7e14('0x13')](function(){_0x3173c0();});}else{_0x3173c0();}});});}function getTags(_0x1786d4,_0x47abe9,_0x53ef73,_0x1fe408,_0x556cf8,_0x43e998){return function(_0x21ab43){return new Promise(function(_0x2dfe9f,_0x4d7568){var _0x2f5335=[];var _0x1f2baf=_0x1fe408[_0x7e14('0x46')];if(_0x1f2baf&&_0x1f2baf[_0x7e14('0xf')]>0x0){_0x2f5335=_[_0x7e14('0x47')](_0x1f2baf,_0x7e14('0x38'));}if(_0x2f5335[_0x7e14('0xf')]>0x0){return manageTags(_0x1786d4,_0x2f5335,_0x47abe9,_0x53ef73,_0x21ab43,_0x556cf8,_0x43e998)[_0x7e14('0xd')](function(){_0x2dfe9f(_0x21ab43);});}else{_0x2dfe9f(_0x21ab43);}});};}function emit(_0x196451,_0x505d7b,_0x5a0284){var _0x1263b6=_0x7e14('0x48')+_0x7e14('0x49')+_0x7e14('0x4a')+'%255EORDERBYDESCnumber';var _0x200cf3={'uri':_0x196451+'/nav_to.do?uri=incident.do?sys_id%3D'+_0x5a0284+_0x1263b6};io['to'](util[_0x7e14('0x4b')](_0x7e14('0x4c'),_0x505d7b))[_0x7e14('0x4d')](_0x7e14('0x4e'),_0x200cf3);}exports['cs']=function(_0x910f8b,_0x3fce22,_0x387433,_0x3e87a0,_0x4d1b5b,_0x1af0ce,_0x1e4461,_0x2dc00c){var _0x333a3a={};var _0x233dfc={'user':_0x1af0ce[_0x7e14('0x4f')],'pass':_0x1af0ce['password']};var _0x357df5=_0x7e14('0x50');var _0x333925=_0x7e14('0x51');_0x1af0ce[_0x7e14('0x52')]=intUtil[_0x7e14('0x53')](_0x1af0ce[_0x7e14('0x52')]);_0x1af0ce[_0x7e14('0x54')]=intUtil['stripTrailingSlash'](_0x1af0ce[_0x7e14('0x54')]);var _0xf46492=util[_0x7e14('0x4b')]('%s/api/now/table/',_0x1af0ce[_0x7e14('0x52')]);_0x333a3a[_0x7e14('0x19')]=!_[_0x7e14('0x55')](_0x3e87a0)?_0x3e87a0['email']:null;_0x333a3a[_0x7e14('0x1f')]=_0x1af0ce[_0x7e14('0x56')];_0x333a3a[_0x7e14('0x24')]=_0x2dc00c[_0x7e14('0x33')]()===_0x7e14('0x57')?_0x3fce22[_0x7e14('0x58')]:_0x3fce22[_0x7e14('0x59')];_0x333a3a['callDirection']=_0x2dc00c===_0x7e14('0x5a')||_0x2dc00c===_0x7e14('0x5b')?_0x7e14('0x5a'):_0x7e14('0x57');var _0x22a24a=util[_0x7e14('0x4b')](_0x7e14('0x5c'),_0x1af0ce[_0x7e14('0x54')],_0x3fce22[_0x7e14('0x5d')],md5(_0x3fce22[_0x7e14('0x5d')]));if(_0x4d1b5b&&_0x4d1b5b['monitor_format']){logger[_0x7e14('0x11')]('[QUEUE]',_0x7e14('0x5e'));_0x3fce22[_0x7e14('0x5f')]=_0x22a24a;}else if(_0x1e4461&&_0x1e4461[_0x7e14('0x60')]&&_0x1e4461['recordingFormat']!=='none'){logger[_0x7e14('0x11')]('[OUTBOUND]',_0x7e14('0x5e'));_0x3fce22['recordingURL']=_0x22a24a;}else{_0x3fce22['recordingURL']='';}return getAdminUser(_0x2dc00c,_0x233dfc,_0x333a3a,_0xf46492,_0x333925,_0x357df5)['then'](getUser(_0x2dc00c,_0x233dfc,_0xf46492,_0x333925,_0x357df5))[_0x7e14('0xd')](getEndUser(_0x2dc00c,_0x233dfc,_0xf46492,_0x333925,_0x357df5))[_0x7e14('0xd')](getTicket(_0x2dc00c,_0x233dfc,_0xf46492,_0x387433,_0x3fce22,_0x333925))['then'](function(_0x27cf0f){logger[_0x7e14('0x11')](util[_0x7e14('0x4b')](_0x7e14('0x61'),_0x27cf0f[_0x7e14('0x3c')]));logger[_0x7e14('0x11')](util[_0x7e14('0x4b')](_0x7e14('0x62'),_0x2dc00c));if(_0x2dc00c!==_0x7e14('0x5b')){logger[_0x7e14('0x11')]('['+[_0x2dc00c['toUpperCase']()]+']',_0x7e14('0x63'));emit(_0x1af0ce[_0x7e14('0x52')],_0x3e87a0[_0x7e14('0x38')],_0x27cf0f[_0x7e14('0x3c')]);}})[_0x7e14('0x13')](function(_0x58d7fa){logger[_0x7e14('0x14')]('['+[_0x2dc00c[_0x7e14('0x15')]()]+']\x20Error\x20running\x20ServiceNow\x20integration',util['inspect'](_0x58d7fa,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x2e52=['Incident\x20-\x20','forEach','push','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','Tags','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','/nav_to.do?uri=incident.do?sys_id%3D','user:%s','emit','trigger:browser:url','username','password','sysparm_limit=1','sysparm_display_value=true','serverUrl','stripTrailingSlash','format','remoteUri','isNil','email','outbound','calleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','monitor_format','[QUEUE]','recordingURL','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','The\x20ticket\x20ID\x20is:\x20%s','call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','lodash','bluebird','request-promise','util','ioredis','./util','servicenow','redis','localhost','socket.io-emitter','GET','then','result','length','adminId','sys_id','info','toUpperCase','error','validateEmail','userEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20entity','active','true','userId','adminEmail','],\x20getUser\x20crm','message',']\x20using\x20admin\x20profile','],\x20createEndUser\x20input\x20crm','sys_user?','endUserNumber','user','System','],\x20EndUser\x20schema','endUserId','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','],\x20createEndUser\x20crm','catch','includes','string','picklist','nameField','customField','toLowerCase','content','toString','type','idField','variable','customVariable','Variable','name',']\x20getTicket\x20input\x20crm','POST','assign','getString','Descriptions','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketId','ticketNumber',']\x20getTicket\x20crm','label','label_entry','incident'];(function(_0x5d4366,_0x1ea497){var _0x373165=function(_0x3d0da1){while(--_0x3d0da1){_0x5d4366['push'](_0x5d4366['shift']());}};_0x373165(++_0x1ea497);}(_0x2e52,0x1d8));var _0x22e5=function(_0x525c7b,_0x488fcc){_0x525c7b=_0x525c7b-0x0;var _0x27b33e=_0x2e52[_0x525c7b];return _0x27b33e;};'use strict';var _=require(_0x22e5('0x0'));var Promise=require(_0x22e5('0x1'));var rp=require(_0x22e5('0x2'));var util=require(_0x22e5('0x3'));var md5=require('md5');var Redis=require(_0x22e5('0x4'));var intUtil=require(_0x22e5('0x5'));var config=require('../../../../config/environment');var logger=require('../../../../config/logger')(_0x22e5('0x6'));config[_0x22e5('0x7')]=_['defaults'](config['redis'],{'host':_0x22e5('0x8'),'port':0x18eb});var io=require(_0x22e5('0x9'))(new Redis(config[_0x22e5('0x7')]));function getAdminUser(_0xdfbc7,_0x1d5d6e,_0x42459e,_0x1f4f08,_0x21fcd3,_0x250002){return new Promise(function(_0x136292,_0x522abd){var _0x205a9e={'method':_0x22e5('0xa'),'uri':_0x1f4f08+'sys_user?sysparm_query=user_name%3Dadmin'+'&'+_0x21fcd3+'&'+_0x250002,'auth':_0x1d5d6e,'json':!![]};return rp(_0x205a9e)[_0x22e5('0xb')](function(_0x4af649){if(_0x4af649[_0x22e5('0xc')][_0x22e5('0xd')]>0x0){_0x42459e[_0x22e5('0xe')]=_0x4af649[_0x22e5('0xc')][0x0][_0x22e5('0xf')];}logger[_0x22e5('0x10')]('['+[_0xdfbc7[_0x22e5('0x11')]()]+'],\x20getAdminUser\x20crm',_0x42459e);_0x136292(_0x42459e);})['catch'](function(_0x4140fa){logger[_0x22e5('0x12')]('['+[_0xdfbc7[_0x22e5('0x11')]()]+']',_0x4140fa['message']);_0x522abd(_0x4140fa['message']);});});}function getUser(_0x5aab0e,_0x36cf22,_0x25beb2,_0x39859a,_0xb4edaf){return function(_0x5aec4b){logger['info']('['+[_0x5aab0e[_0x22e5('0x11')]()]+'],\x20getUser\x20input\x20crm',_0x5aec4b);return new Promise(function(_0x18730f,_0x21f0d1){if(intUtil[_0x22e5('0x13')](_0x5aec4b[_0x22e5('0x14')])){var _0xd678f6={'method':'GET','uri':_0x25beb2+_0x22e5('0x15')+_0x5aec4b[_0x22e5('0x14')]+'&'+_0x39859a+'&'+_0xb4edaf,'auth':_0x36cf22,'json':!![]};logger[_0x22e5('0x10')]('['+[_0x5aab0e['toUpperCase']()]+'],\x20getUser\x20rp\x20obj',_0xd678f6);return rp(_0xd678f6)['then'](function(_0x5ed7fe){logger[_0x22e5('0x10')]('['+[_0x5aab0e[_0x22e5('0x11')]()]+_0x22e5('0x16'),_0x5ed7fe);if(_0x5ed7fe['result']['length']>0x0&&String(_0x5ed7fe[_0x22e5('0xc')][0x0][_0x22e5('0x17')])===_0x22e5('0x18')){_0x5aec4b[_0x22e5('0x19')]=_0x5ed7fe[_0x22e5('0xc')][0x0][_0x22e5('0xf')];}else{_0x5aec4b[_0x22e5('0x19')]=_0x5aec4b['adminId'];_0x5aec4b[_0x22e5('0x14')]=_0x5aec4b[_0x22e5('0x1a')];}logger['info']('['+[_0x5aab0e[_0x22e5('0x11')]()]+_0x22e5('0x1b'),_0x5aec4b);_0x18730f(_0x5aec4b);})['catch'](function(_0x2dc17a){logger['error']('['+[_0x5aab0e[_0x22e5('0x11')]()]+']',_0x2dc17a[_0x22e5('0x1c')]);_0x21f0d1(_0x2dc17a[_0x22e5('0x1c')]);});}else{logger[_0x22e5('0x10')]('['+[_0x5aab0e[_0x22e5('0x11')]()]+_0x22e5('0x1d'));_0x5aec4b[_0x22e5('0x19')]=_0x5aec4b[_0x22e5('0xe')];_0x5aec4b[_0x22e5('0x14')]=_0x5aec4b[_0x22e5('0x1a')];_0x18730f(_0x5aec4b);}});};}function createEndUser(_0x2d511a,_0x6d02a0,_0xd44e82,_0x1acdd2,_0x309999){logger['info']('['+[_0x2d511a['toUpperCase']()]+_0x22e5('0x1e'),_0xd44e82);return new Promise(function(_0x20bbe5,_0x185f40){var _0x16f479={'method':'POST','uri':_0x1acdd2+_0x22e5('0x1f')+_0x309999,'body':{'user_name':_0xd44e82[_0x22e5('0x20')],'roles':_0x22e5('0x21'),'first_name':_0xd44e82[_0x22e5('0x20')],'active':_0x22e5('0x18'),'date_format':_0x22e5('0x22'),'phone':_0xd44e82[_0x22e5('0x20')]},'auth':_0x6d02a0,'json':!![]};return rp(_0x16f479)[_0x22e5('0xb')](function(_0x466c92){logger[_0x22e5('0x10')]('['+[_0x2d511a[_0x22e5('0x11')]()]+_0x22e5('0x23'),_0x466c92[_0x22e5('0xc')]);_0xd44e82[_0x22e5('0x24')]=_0x466c92[_0x22e5('0xc')][_0x22e5('0xf')];_0x20bbe5(_0xd44e82);})['catch'](function(_0x3a7758){logger[_0x22e5('0x12')]('['+[_0x2d511a[_0x22e5('0x11')]()]+']',_0x3a7758[_0x22e5('0x1c')]);_0x185f40(_0x3a7758[_0x22e5('0x1c')]);});});}function getEndUser(_0x3fb12b,_0x2f1fc9,_0xd7bea2,_0x388ea4,_0x3fda5f){return function(_0x8aa05d){logger[_0x22e5('0x10')]('['+[_0x3fb12b[_0x22e5('0x11')]()]+_0x22e5('0x25'),_0x8aa05d);return new Promise(function(_0xc61839,_0xe641cc){var _0x30b7a7={'method':'GET','uri':_0xd7bea2+_0x22e5('0x26')+_0x8aa05d[_0x22e5('0x20')]+'&'+_0x388ea4+'&'+_0x3fda5f,'auth':_0x2f1fc9,'json':!![]};return rp(_0x30b7a7)[_0x22e5('0xb')](function(_0x993a8d){if(_0x993a8d[_0x22e5('0xc')]['length']>0x0){_0x8aa05d['endUserId']=_0x993a8d['result'][0x0][_0x22e5('0xf')];logger[_0x22e5('0x10')]('['+[_0x3fb12b[_0x22e5('0x11')]()]+'],\x20getEndUser\x20crm',_0x8aa05d);_0xc61839(_0x8aa05d);}else{return createEndUser(_0x3fb12b,_0x2f1fc9,_0x8aa05d,_0xd7bea2,_0x388ea4)[_0x22e5('0xb')](function(_0x4baaba){logger['info']('['+[_0x3fb12b[_0x22e5('0x11')]()]+_0x22e5('0x27'),_0x4baaba);_0xc61839(_0x4baaba);});}})[_0x22e5('0x28')](function(_0xec2438){logger[_0x22e5('0x12')]('['+[_0x3fb12b[_0x22e5('0x11')]()]+']',_0xec2438[_0x22e5('0x1c')]);_0xe641cc(_0xec2438['message']);});});};}function getCustomFields(_0x490b25,_0x64d247){var _0x8659f={};if(_0x490b25[_0x22e5('0xd')]>0x0){_['forEach'](_0x490b25,function(_0x1dc5a0){if(_[_0x22e5('0x29')]([_0x22e5('0x2a'),_0x22e5('0x2b')],_0x1dc5a0['type'])&&_0x1dc5a0[_0x22e5('0x2c')]&&!_0x1dc5a0[_0x22e5('0x2d')]){_0x8659f[_0x1dc5a0[_0x22e5('0x2c')][_0x22e5('0x2e')]()]=_0x1dc5a0[_0x22e5('0x2f')][_0x22e5('0x30')]();}else if(_[_0x22e5('0x29')](['string',_0x22e5('0x2b')],_0x1dc5a0[_0x22e5('0x31')])&&_0x1dc5a0['idField']&&_0x1dc5a0['customField']){_0x8659f[_0x1dc5a0[_0x22e5('0x32')][_0x22e5('0x2e')]()]=_0x1dc5a0['content'][_0x22e5('0x30')]();}else if(_0x1dc5a0[_0x22e5('0x31')]===_0x22e5('0x33')&&_0x1dc5a0['variableName']&&_0x1dc5a0[_0x22e5('0x32')]&&_0x1dc5a0[_0x22e5('0x2d')]){_0x8659f[_0x1dc5a0['idField'][_0x22e5('0x2e')]()]=_0x64d247[_0x1dc5a0['variableName']]['toString']();}else if(_0x1dc5a0[_0x22e5('0x31')]===_0x22e5('0x34')&&_0x1dc5a0[_0x22e5('0x35')]&&_0x1dc5a0['Variable']['name']&&_0x1dc5a0['idField']&&_0x1dc5a0[_0x22e5('0x2d')]){_0x8659f[_0x1dc5a0[_0x22e5('0x32')][_0x22e5('0x2e')]()]=_0x64d247[_0x1dc5a0[_0x22e5('0x35')][_0x22e5('0x36')][_0x22e5('0x2e')]()][_0x22e5('0x30')]();}});}return _0x8659f;}function getTicket(_0x376168,_0x31ef9e,_0x572199,_0x460692,_0x432a11,_0x116d00){return function(_0x2a812d){logger[_0x22e5('0x10')]('['+[_0x376168[_0x22e5('0x11')]()]+_0x22e5('0x37'),_0x2a812d);return new Promise(function(_0x2ca47a,_0x51926c){var _0x5ed245=_0x376168[_0x22e5('0x2e')]()==='outbound'?_0x2a812d[_0x22e5('0x19')]:_0x2a812d['endUserId'];var _0x44b3d3={'method':_0x22e5('0x38'),'uri':_0x572199+'incident'+'?'+_0x116d00,'body':Object[_0x22e5('0x39')]({},{'active':'true','caller_id':_0x5ed245,'assigned_to':_0x2a812d[_0x22e5('0x19')],'short_description':intUtil[_0x22e5('0x3a')](_0x460692['Subjects'],_0x432a11,'\x20'),'description':intUtil[_0x22e5('0x3a')](_0x460692[_0x22e5('0x3b')],_0x432a11,'\x0a')},getCustomFields(_0x460692[_0x22e5('0x3c')],_0x432a11)),'auth':_0x31ef9e,'json':!![]};return rp(_0x44b3d3)[_0x22e5('0xb')](function(_0x2fc012){logger[_0x22e5('0x10')]('['+[_0x376168[_0x22e5('0x11')]()]+_0x22e5('0x3d'),_0x2fc012[_0x22e5('0xc')]);_0x2a812d[_0x22e5('0x3e')]=_0x2fc012[_0x22e5('0xc')]['sys_id'];_0x2a812d[_0x22e5('0x3f')]=_0x2fc012['result']['number'];logger[_0x22e5('0x10')]('['+[_0x376168[_0x22e5('0x11')]()]+_0x22e5('0x40'),_0x2a812d);_0x2ca47a(_0x2a812d);})[_0x22e5('0x28')](function(_0x2b8c0e){logger[_0x22e5('0x12')]('['+[_0x376168['toUpperCase']()]+']',_0x2b8c0e['message']);_0x51926c(_0x2b8c0e[_0x22e5('0x1c')]);});});};}function createRemoteTag(_0x4e08be,_0x59359a,_0x384a5d,_0x8c9b4a){return new Promise(function(_0x5a45a5,_0x250820){var _0x4850ed={'method':_0x22e5('0x38'),'uri':_0x384a5d+_0x22e5('0x41')+'?'+_0x8c9b4a,'body':{'short_description':_0x4e08be,'global':!![],'active':!![],'name':_0x4e08be},'auth':_0x59359a,'json':!![]};return rp(_0x4850ed)[_0x22e5('0xb')](function(_0x38585f){var _0x46a6bb=_0x38585f[_0x22e5('0xc')][_0x22e5('0xf')];_0x5a45a5(_0x46a6bb);});});}function getRemoteTag(_0x30357e,_0x15b7aa,_0x26fdd4,_0x171ba1,_0x5e7a6f){return new Promise(function(_0x3facbb,_0x4c9072){var _0x307ef0={'method':_0x22e5('0xa'),'uri':_0x26fdd4+_0x22e5('0x41')+'?sysparm_query=name%3D'+_0x30357e+'&'+_0x171ba1,'auth':_0x15b7aa,'json':!![]};return rp(_0x307ef0)[_0x22e5('0xb')](function(_0x34250d){if(_0x34250d[_0x22e5('0xc')]['length']>0x0){var _0x5291be=_0x34250d[_0x22e5('0xc')][0x0][_0x22e5('0xf')];_0x3facbb(_0x5291be);}else{return createRemoteTag(_0x30357e,_0x15b7aa,_0x26fdd4,_0x171ba1)['then'](function(_0x400b64){_0x3facbb(_0x400b64);});}});});}function assignTagToIncident(_0xffd22c,_0x4eb0cf,_0x29fb42,_0x299da9,_0x13e277){return new Promise(function(_0x3763ab,_0x40c700){var _0x146507={'method':'POST','uri':_0x29fb42+_0x22e5('0x42')+'?'+_0x13e277,'body':{'label':_0xffd22c,'table':_0x22e5('0x43'),'id_type':'Incident','table_key':_0x299da9[_0x22e5('0x3e')],'title':_0x22e5('0x44')+_0x299da9[_0x22e5('0x3f')],'id_display':_0x299da9[_0x22e5('0x3f')]},'auth':_0x4eb0cf,'json':!![]};return rp(_0x146507)['then'](function(_0x5e9412){_0x3763ab();})['catch'](function(){_0x3763ab();});});}function manageTags(_0x2b5491,_0xbbed07,_0x244dca,_0x1da435,_0x1b2107,_0x494316,_0x4c7340){return new Promise(function(_0x296a1b,_0x38f340){var _0x451141=[];_0xbbed07[_0x22e5('0x45')](function(_0x1cb009){_0x451141[_0x22e5('0x46')](getRemoteTag(_0x1cb009,_0x244dca,_0x1da435,_0x494316,_0x4c7340));});return Promise[_0x22e5('0x47')](_0x451141)['then'](function(_0x4cdaee){if(_0x4cdaee[_0x22e5('0xd')]){logger[_0x22e5('0x10')]('['+[_0x2b5491['toUpperCase']()]+_0x22e5('0x48'),_0x4cdaee);var _0x5e00ae=[];_0x4cdaee[_0x22e5('0x45')](function(_0x3e5c6d){_0x5e00ae[_0x22e5('0x46')](assignTagToIncident(_0x3e5c6d,_0x244dca,_0x1da435,_0x1b2107,_0x494316));});return Promise[_0x22e5('0x47')](_0x5e00ae)[_0x22e5('0xb')](function(){_0x296a1b();})[_0x22e5('0x28')](function(){_0x296a1b();});}else{_0x296a1b();}});});}function getTags(_0x66b209,_0x55792b,_0x163497,_0x3ff498,_0x2f16db,_0x1ec68d){return function(_0x36c2ec){return new Promise(function(_0x530d27,_0x36f619){var _0x5a7574=[];var _0x12d441=_0x3ff498[_0x22e5('0x49')];if(_0x12d441&&_0x12d441[_0x22e5('0xd')]>0x0){_0x5a7574=_['map'](_0x12d441,_0x22e5('0x36'));}if(_0x5a7574[_0x22e5('0xd')]>0x0){return manageTags(_0x66b209,_0x5a7574,_0x55792b,_0x163497,_0x36c2ec,_0x2f16db,_0x1ec68d)['then'](function(){_0x530d27(_0x36c2ec);});}else{_0x530d27(_0x36c2ec);}});};}function emit(_0x5e91b5,_0x315334,_0x37e7b4){var _0x1626ad=_0x22e5('0x4a')+_0x22e5('0x4b')+_0x22e5('0x4c')+'%255EORDERBYDESCnumber';var _0x458b9a={'uri':_0x5e91b5+_0x22e5('0x4d')+_0x37e7b4+_0x1626ad};io['to'](util['format'](_0x22e5('0x4e'),_0x315334))[_0x22e5('0x4f')](_0x22e5('0x50'),_0x458b9a);}exports['cs']=function(_0x178089,_0x5984d6,_0x407068,_0x40b53a,_0x312083,_0x3073f6,_0x1cd5bb,_0x101ed8){var _0x4862cc={};var _0x403c9d={'user':_0x3073f6[_0x22e5('0x51')],'pass':_0x3073f6[_0x22e5('0x52')]};var _0x49786e=_0x22e5('0x53');var _0x51ad89=_0x22e5('0x54');_0x3073f6['remoteUri']=intUtil['stripTrailingSlash'](_0x3073f6['remoteUri']);_0x3073f6[_0x22e5('0x55')]=intUtil[_0x22e5('0x56')](_0x3073f6[_0x22e5('0x55')]);var _0x58ee88=util[_0x22e5('0x57')]('%s/api/now/table/',_0x3073f6[_0x22e5('0x58')]);_0x4862cc['userEmail']=!_[_0x22e5('0x59')](_0x40b53a)?_0x40b53a['email']:null;_0x4862cc[_0x22e5('0x1a')]=_0x3073f6[_0x22e5('0x5a')];_0x4862cc[_0x22e5('0x20')]=_0x101ed8[_0x22e5('0x2e')]()===_0x22e5('0x5b')?_0x5984d6['destcalleridnum']:_0x5984d6[_0x22e5('0x5c')];_0x4862cc[_0x22e5('0x5d')]=_0x101ed8===_0x22e5('0x5e')||_0x101ed8===_0x22e5('0x5f')?_0x22e5('0x5e'):_0x22e5('0x5b');var _0x35f833=util[_0x22e5('0x57')](_0x22e5('0x60'),_0x3073f6['serverUrl'],_0x5984d6['uniqueid'],md5(_0x5984d6['uniqueid']));if(_0x312083&&_0x312083[_0x22e5('0x61')]){logger[_0x22e5('0x10')](_0x22e5('0x62'),'Recording\x20is\x20enabled!');_0x5984d6[_0x22e5('0x63')]=_0x35f833;}else if(_0x1cd5bb&&_0x1cd5bb[_0x22e5('0x64')]&&_0x1cd5bb[_0x22e5('0x64')]!==_0x22e5('0x65')){logger[_0x22e5('0x10')](_0x22e5('0x66'),_0x22e5('0x67'));_0x5984d6[_0x22e5('0x63')]=_0x35f833;}else{_0x5984d6[_0x22e5('0x63')]='';}return getAdminUser(_0x101ed8,_0x403c9d,_0x4862cc,_0x58ee88,_0x51ad89,_0x49786e)[_0x22e5('0xb')](getUser(_0x101ed8,_0x403c9d,_0x58ee88,_0x51ad89,_0x49786e))['then'](getEndUser(_0x101ed8,_0x403c9d,_0x58ee88,_0x51ad89,_0x49786e))['then'](getTicket(_0x101ed8,_0x403c9d,_0x58ee88,_0x407068,_0x5984d6,_0x51ad89))[_0x22e5('0xb')](function(_0x3560c0){logger['info'](util[_0x22e5('0x57')](_0x22e5('0x68'),_0x3560c0[_0x22e5('0x3e')]));logger['info'](util[_0x22e5('0x57')](_0x22e5('0x69'),_0x101ed8));if(_0x101ed8!==_0x22e5('0x5f')){logger['info']('['+[_0x101ed8[_0x22e5('0x11')]()]+']',_0x22e5('0x6a'));emit(_0x3073f6[_0x22e5('0x58')],_0x40b53a[_0x22e5('0x36')],_0x3560c0[_0x22e5('0x3e')]);}})[_0x22e5('0x28')](function(_0x1891c9){logger['error']('['+[_0x101ed8[_0x22e5('0x11')]()]+_0x22e5('0x6b'),util['inspect'](_0x1891c9,{'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 abed5d2..752cbdd 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 _0x9ba5=['customField','toLowerCase','content','idField','custom_fields','push','customVariable','Variable','login','username','password','PLAIN','xCALLY\x20Motion\x20integration','sessionID','Account\x20%d\x20is\x20not\x20valid','set_relationship','Calls','queue','stripTrailingSlash','serverUrl','remoteUri','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','The\x20Ticket\x20ID\x20is:','users','contacts','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','error','uri','recordingFormat','none','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridname','destcalleridnum','Outbound','Ticket\x20created!','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','unmanaged','%s/service/v4_1/rest.php','lastevent','toUpperCase','catch','lodash','bluebird','md5','util','ioredis','../../../../config/environment','../../../../config/logger','sugarcrm','redis','defaults','localhost','POST','emit','Creating\x20new\x20ticket...','name','getString','Subjects','assigned_user_id','description','Descriptions','date_start','toISOString','slice','parent_id','Contacts','direction','length','forEach','variableName','set_entry','JSON','stringify','format','Basic\x20%s','toString','isNil','info','Getting\x20agent\x20with\x20name','get_entry_list','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','then','entry_list','find','name_value_list','user_name','value','resolve','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','first_name','','Caller\x20-\x20%s','Enduser\x20created.','debug','[HTTP]','merge','map','type','string','nameField'];(function(_0x4b6830,_0x2bf6fb){var _0x239e4a=function(_0x364735){while(--_0x364735){_0x4b6830['push'](_0x4b6830['shift']());}};_0x239e4a(++_0x2bf6fb);}(_0x9ba5,0x129));var _0x59ba=function(_0x1f36bb,_0x8af718){_0x1f36bb=_0x1f36bb-0x0;var _0xaf97fa=_0x9ba5[_0x1f36bb];return _0xaf97fa;};'use strict';var _=require(_0x59ba('0x0'));var rp=require('request-promise');var BPromise=require(_0x59ba('0x1'));var md5=require(_0x59ba('0x2'));var util=require(_0x59ba('0x3'));var Redis=require(_0x59ba('0x4'));var intUtil=require('./util');var config=require(_0x59ba('0x5'));var logger=require(_0x59ba('0x6'))(_0x59ba('0x7'));config[_0x59ba('0x8')]=_[_0x59ba('0x9')](config[_0x59ba('0x8')],{'host':_0x59ba('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x59ba('0x8')]));var def={'method':_0x59ba('0xb'),'json':!![]};function emit(_0x18e658,_0x3a0c3d,_0x41ea6c){io['to'](_0x18e658)[_0x59ba('0xc')](_0x3a0c3d,_0x41ea6c);}function getTicket(_0x4bd5f7,_0x3d3cb6,_0x580e1f,_0x255935,_0x26605f,_0x49c50f,_0x33c2eb,_0xa9e40a){logger['info'](_0x59ba('0xd'));var _0xa9982a=new Date();var _0x10bba2=[{'name':_0x59ba('0xe'),'value':intUtil[_0x59ba('0xf')](_0x255935[_0x59ba('0x10')],_0x26605f,'\x20')},{'name':_0x59ba('0x11'),'value':_0x3d3cb6['id']},{'name':'created_by','value':_0x3d3cb6['id']},{'name':_0x59ba('0x12'),'value':intUtil[_0x59ba('0xf')](_0x255935[_0x59ba('0x13')],_0x26605f,'\x0a')},{'name':_0x59ba('0x14'),'value':_0xa9982a[_0x59ba('0x15')]()[_0x59ba('0x16')](0x0,0x13)['replace']('T','\x20')},{'name':'duration_hours','value':'0'},{'name':'duration_minutes','value':'15'},{'name':_0x59ba('0x17'),'value':_0x580e1f['id']},{'name':'parent_type','value':_0x59ba('0x18')},{'name':'parent_name','value':_0x580e1f[_0x59ba('0xe')]},{'name':_0x59ba('0x19'),'value':_0xa9e40a}];if(_0x49c50f[_0x59ba('0x1a')]){_[_0x59ba('0x1b')](_0x49c50f,function(_0x299763){if(_0x26605f[_0x299763[_0x59ba('0x1c')]]){_0x10bba2['push']({'name':_0x299763['idField'],'value':_0x26605f[_0x299763[_0x59ba('0x1c')]]});}});}return request({'form':{'method':_0x59ba('0x1d'),'input_type':_0x59ba('0x1e'),'response_type':_0x59ba('0x1e'),'rest_data':JSON[_0x59ba('0x1f')]({'session':_0x33c2eb['id'],'module_name':'Calls','name_value_list':_0x10bba2})}});}function getAuth(_0x14905){return util[_0x59ba('0x20')](_0x59ba('0x21'),new Buffer(_0x14905['apiKey']+':X')[_0x59ba('0x22')]('base64'));}function getServerInfo(_0xc02c8a){return request({'form':{'method':'get_server_info','input_type':'JSON','response_type':_0x59ba('0x1e'),'rest_data':JSON[_0x59ba('0x1f')]({'session':_0xc02c8a['id']})}});}function getUser(_0x4b0683,_0x59a309,_0x2b6921){if(!_[_0x59ba('0x23')](_0x59a309)){logger[_0x59ba('0x24')](_0x59ba('0x25'),_0x59a309);return request({'form':{'method':_0x59ba('0x26'),'input_type':_0x59ba('0x1e'),'response_type':_0x59ba('0x1e'),'rest_data':JSON['stringify']({'session':_0x2b6921['id'],'module_name':'Employees','query':util[_0x59ba('0x20')](_0x59ba('0x27'),_0x59a309),'order_by':'','offset':'0','select_fields':['id',_0x59ba('0xe'),'user_name'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x59ba('0x28')](function(_0x344b2e){if(_0x344b2e[_0x59ba('0x29')][_0x59ba('0x1a')]){var _0x431008=_[_0x59ba('0x2a')](_0x344b2e[_0x59ba('0x29')],function(_0x1f8e41){return _0x1f8e41[_0x59ba('0x2b')][_0x59ba('0x2c')][_0x59ba('0x2d')]===_0x59a309;});if(_0x431008){logger[_0x59ba('0x24')]('Agent\x20found!');return BPromise[_0x59ba('0x2e')]({'id':_0x431008[_0x59ba('0x2b')]['id'][_0x59ba('0x2d')],'name':_0x431008[_0x59ba('0x2b')][_0x59ba('0xe')][_0x59ba('0x2d')]});}}logger[_0x59ba('0x24')](_0x59ba('0x2f'));return BPromise[_0x59ba('0x2e')]({'id':_0x2b6921['name_value_list'][_0x59ba('0x30')][_0x59ba('0x2d')],'name':_0x2b6921[_0x59ba('0x2b')][_0x59ba('0x2c')][_0x59ba('0x2d')]});});}else{logger[_0x59ba('0x24')](_0x59ba('0x31'));return BPromise['resolve']({'id':_0x2b6921[_0x59ba('0x2b')][_0x59ba('0x30')][_0x59ba('0x2d')],'name':_0x2b6921[_0x59ba('0x2b')][_0x59ba('0x2c')]['value']});}}function getEndUser(_0x11eb41,_0x1d9ea3,_0x1a176c,_0x21a12a){logger['info'](_0x59ba('0x32'),_0x1a176c);return request({'form':{'method':_0x59ba('0x26'),'input_type':_0x59ba('0x1e'),'response_type':_0x59ba('0x1e'),'rest_data':JSON[_0x59ba('0x1f')]({'session':_0x21a12a['id'],'module_name':_0x59ba('0x18'),'query':util[_0x59ba('0x20')](_0x59ba('0x33'),_0x1a176c),'order_by':'','offset':'0','select_fields':['id',_0x59ba('0xe'),_0x59ba('0x34')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x59ba('0x28')](function(_0x273679){if(_0x273679[_0x59ba('0x29')][_0x59ba('0x1a')]){var _0x1ac9c8=_[_0x59ba('0x2a')](_0x273679[_0x59ba('0x29')],function(_0x14dc3e){return _0x14dc3e['name_value_list']['phone_home'][_0x59ba('0x2d')]===_0x1a176c;});if(_0x1ac9c8){logger[_0x59ba('0x24')](_0x59ba('0x35'));return BPromise[_0x59ba('0x2e')]({'id':_0x1ac9c8[_0x59ba('0x2b')]['id']['value'],'name':_0x1ac9c8[_0x59ba('0x2b')][_0x59ba('0xe')][_0x59ba('0x2d')],'phone':_0x1ac9c8[_0x59ba('0x2b')][_0x59ba('0x34')][_0x59ba('0x2d')]});}}else{logger['info'](_0x59ba('0x36'));return request({'form':{'method':_0x59ba('0x1d'),'input_type':_0x59ba('0x1e'),'response_type':_0x59ba('0x1e'),'rest_data':JSON[_0x59ba('0x1f')]({'session':_0x21a12a['id'],'module_name':_0x59ba('0x18'),'name_value_list':[{'name':_0x59ba('0x37'),'value':_0x1d9ea3!==_0x59ba('0x38')?_0x1d9ea3:util[_0x59ba('0x20')](_0x59ba('0x39'),_0x1a176c)},{'name':_0x59ba('0x34'),'value':_0x1a176c}]})}})[_0x59ba('0x28')](function(_0xa47384){logger[_0x59ba('0x24')](_0x59ba('0x3a'));return BPromise[_0x59ba('0x2e')]({'id':_0xa47384['id'],'name':_0xa47384[_0x59ba('0x29')]['first_name'][_0x59ba('0x2d')],'phone':_0xa47384['entry_list'][_0x59ba('0x34')][_0x59ba('0x2d')]});});}});}function request(_0x4eb57e){logger[_0x59ba('0x3b')](_0x59ba('0x3c'),JSON[_0x59ba('0x1f')](_0x4eb57e));return rp(_[_0x59ba('0x3d')](def,_0x4eb57e));}function getTags(_0x38376a,_0xf03474){var _0x4fd609=[];if(_0x38376a&&_0x38376a[_0x59ba('0x1a')]>0x0){_0x4fd609=_[_0x59ba('0x3e')](_0x38376a,_0xf03474);}return _0x4fd609;}function getCustomFields(_0x36e786,_0x2ee398){var _0x24125e=[];var _0x49395c={'custom_fields':[]};if(_0x36e786[_0x59ba('0x1a')]>0x0){_[_0x59ba('0x1b')](_0x36e786,function(_0x37adf6){if(_0x37adf6[_0x59ba('0x3f')]===_0x59ba('0x40')&&_0x37adf6[_0x59ba('0x41')]&&!_0x37adf6[_0x59ba('0x42')]){_0x49395c[_0x37adf6[_0x59ba('0x41')][_0x59ba('0x43')]()]=_0x37adf6[_0x59ba('0x44')][_0x59ba('0x22')]();}else if(_0x37adf6[_0x59ba('0x3f')]===_0x59ba('0x40')&&_0x37adf6[_0x59ba('0x45')]&&_0x37adf6['customField']){_0x49395c[_0x59ba('0x46')][_0x59ba('0x47')]({'id':_0x37adf6[_0x59ba('0x45')],'value':_0x37adf6[_0x59ba('0x44')]['toString']()});}else if(_0x37adf6['type']==='variable'&&_0x37adf6[_0x59ba('0x1c')]&&_0x37adf6[_0x59ba('0x45')]&&_0x37adf6[_0x59ba('0x42')]){_0x2ee398[_0x37adf6['variableName']]&&_0x49395c[_0x59ba('0x46')][_0x59ba('0x47')]({'id':_0x37adf6[_0x59ba('0x45')],'value':_0x2ee398[_0x37adf6[_0x59ba('0x1c')]][_0x59ba('0x22')]()});}else if(_0x37adf6[_0x59ba('0x3f')]===_0x59ba('0x48')&&_0x37adf6[_0x59ba('0x49')]&&_0x37adf6[_0x59ba('0x49')][_0x59ba('0xe')]&&_0x37adf6[_0x59ba('0x45')]&&_0x37adf6[_0x59ba('0x42')]){_0x2ee398[_0x37adf6[_0x59ba('0x49')][_0x59ba('0xe')][_0x59ba('0x43')]()]&&_0x49395c[_0x59ba('0x46')][_0x59ba('0x47')]({'id':_0x37adf6[_0x59ba('0x45')],'value':_0x2ee398[_0x37adf6[_0x59ba('0x49')][_0x59ba('0xe')][_0x59ba('0x43')]()][_0x59ba('0x22')]()});}});}return _0x49395c;}function getConnection(_0x430f85){return request({'method':_0x59ba('0xb'),'form':{'method':_0x59ba('0x4a'),'input_type':'JSON','response_type':_0x59ba('0x1e'),'rest_data':JSON[_0x59ba('0x1f')]({'user_auth':{'user_name':_0x430f85[_0x59ba('0x4b')],'password':_0x430f85[_0x59ba('0x4c')],'encryption':_0x59ba('0x4d')},'application':_0x59ba('0x4e')})}})[_0x59ba('0x28')](function(_0x219e2f){var _0x48ffb0=_0x219e2f;if(_0x48ffb0['id']){def[_0x59ba('0x4f')]=_0x48ffb0['id'];return BPromise[_0x59ba('0x2e')](_0x48ffb0);}else{throw new Error(util[_0x59ba('0x20')](_0x59ba('0x50'),_0x430f85['id']));}});}function setRelationship(_0x488a18,_0xebd3b6,_0x1b6426,_0xfad942){return request({'form':{'method':_0x59ba('0x51'),'input_type':_0x59ba('0x1e'),'response_type':_0x59ba('0x1e'),'rest_data':JSON[_0x59ba('0x1f')]({'session':_0x488a18['id'],'module_name':_0x59ba('0x52'),'module_id':_0x1b6426['id'],'link_field_name':_0xfad942,'related_ids':[_0xebd3b6['id']],'name_value_list':[],'delete':0x0})}});}exports[_0x59ba('0x53')]=function(_0x167f55,_0x16dd53,_0x29ffb9,_0x277d57,_0x932e17,_0x56d049){var _0x3f11c9,_0x16354b,_0x5a1109,_0x4d4be0;_0x56d049['remoteUri']=intUtil[_0x59ba('0x54')](_0x56d049['remoteUri']);_0x56d049[_0x59ba('0x55')]=intUtil['stripTrailingSlash'](_0x56d049[_0x59ba('0x55')]);def['uri']=util['format']('%s/service/v4_1/rest.php',_0x56d049[_0x59ba('0x56')]);if(_0x932e17&&_0x932e17[_0x59ba('0x57')]){logger[_0x59ba('0x24')](_0x59ba('0x58'),_0x59ba('0x59'));_0x16dd53[_0x59ba('0x5a')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x56d049[_0x59ba('0x55')],_0x16dd53['uniqueid'],md5(_0x16dd53[_0x59ba('0x5b')]));}else{_0x16dd53[_0x59ba('0x5a')]='';}return getConnection(_0x56d049)[_0x59ba('0x28')](function(_0x2deab1){_0x4d4be0=_0x2deab1;return getUser(_0x56d049,_0x277d57[_0x59ba('0xe')],_0x4d4be0);})[_0x59ba('0x28')](function(_0x25a4e9){_0x3f11c9=_0x25a4e9;logger[_0x59ba('0x24')](_0x59ba('0x5c'),_0x3f11c9['id']);return getEndUser(_0x56d049,_0x16dd53[_0x59ba('0x5d')],_0x16dd53[_0x59ba('0x5e')],_0x4d4be0);})[_0x59ba('0x28')](function(_0x1aa319){_0x16354b=_0x1aa319;logger[_0x59ba('0x24')](_0x59ba('0x5f'),_0x16354b['id']);return getTicket(_0x56d049,_0x3f11c9,_0x16354b,_0x29ffb9,_0x16dd53,_0x29ffb9[_0x59ba('0x60')],_0x4d4be0,'Inbound');})[_0x59ba('0x28')](function(_0x3ecb23){_0x5a1109=_0x3ecb23;logger['info']('Ticket\x20created!');logger[_0x59ba('0x24')](_0x59ba('0x61'),_0x5a1109['id']);return setRelationship(_0x4d4be0,_0x3f11c9,_0x5a1109,_0x59ba('0x62'));})['then'](function(){return setRelationship(_0x4d4be0,_0x16354b,_0x5a1109,_0x59ba('0x63'));})[_0x59ba('0x28')](function(){return getServerInfo(_0x4d4be0);})[_0x59ba('0x28')](function(_0x131dac){var _0x4d7d6e=parseInt(_0x131dac['version'][_0x59ba('0x64')](0x0));var _0x312af6=util[_0x59ba('0x20')](_0x59ba('0x65'),_0x56d049['remoteUri'],_0x5a1109['id']);if(_0x4d7d6e>0x6){_0x312af6=util[_0x59ba('0x20')]('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x56d049[_0x59ba('0x56')],_0x5a1109['id']);}logger[_0x59ba('0x24')](_0x59ba('0x58'),_0x59ba('0x66'));emit(util['format'](_0x59ba('0x67'),_0x277d57['name']),_0x59ba('0x68'),{'uri':_0x312af6});})['catch'](function(_0x528e69){logger[_0x59ba('0x69')](_0x59ba('0x58'),JSON[_0x59ba('0x1f')](_0x528e69));});};exports['outbound']=function(_0x57934b,_0x249645,_0x44f870,_0x5d1866,_0x344f68,_0x59c901,_0x1d54b9){var _0x3fe1ef,_0x429353,_0x5779bd,_0x2e1a2b;_0x59c901[_0x59ba('0x56')]=intUtil[_0x59ba('0x54')](_0x59c901[_0x59ba('0x56')]);_0x59c901[_0x59ba('0x55')]=intUtil['stripTrailingSlash'](_0x59c901[_0x59ba('0x55')]);def[_0x59ba('0x6a')]=util[_0x59ba('0x20')]('%s/service/v4_1/rest.php',_0x59c901[_0x59ba('0x56')]);if(_0x1d54b9&&_0x1d54b9[_0x59ba('0x6b')]&&_0x1d54b9[_0x59ba('0x6b')]!==_0x59ba('0x6c')){logger[_0x59ba('0x24')](_0x59ba('0x6d'),_0x59ba('0x59'));_0x249645[_0x59ba('0x5a')]=util[_0x59ba('0x20')](_0x59ba('0x6e'),_0x59c901[_0x59ba('0x55')],_0x249645[_0x59ba('0x5b')],md5(_0x249645[_0x59ba('0x5b')]));}return getConnection(_0x59c901)[_0x59ba('0x28')](function(_0x17c53c){_0x2e1a2b=_0x17c53c;return getUser(_0x59c901,_0x5d1866[_0x59ba('0xe')],_0x2e1a2b);})['then'](function(_0x3b344e){_0x3fe1ef=_0x3b344e;logger[_0x59ba('0x24')](_0x59ba('0x5c'),_0x3fe1ef['id']);return getEndUser(_0x59c901,_0x249645[_0x59ba('0x6f')],_0x249645[_0x59ba('0x70')],_0x2e1a2b);})[_0x59ba('0x28')](function(_0x337f4a){_0x429353=_0x337f4a;logger['info'](_0x59ba('0x5f'),_0x429353['id']);return getTicket(_0x59c901,_0x3fe1ef,_0x429353,_0x44f870,_0x249645,_0x44f870[_0x59ba('0x60')],_0x2e1a2b,_0x59ba('0x71'));})['then'](function(_0x241aa5){_0x5779bd=_0x241aa5;logger['info'](_0x59ba('0x72'));logger[_0x59ba('0x24')]('The\x20Ticket\x20ID\x20is:',_0x5779bd['id']);return setRelationship(_0x2e1a2b,_0x3fe1ef,_0x5779bd,_0x59ba('0x62'));})['then'](function(){return setRelationship(_0x2e1a2b,_0x429353,_0x5779bd,_0x59ba('0x63'));})['then'](function(){return getServerInfo(_0x2e1a2b);})['then'](function(_0x2986ab){var _0x3c9a33=parseInt(_0x2986ab['version'][_0x59ba('0x64')](0x0));var _0x178df4=util[_0x59ba('0x20')](_0x59ba('0x65'),_0x59c901[_0x59ba('0x56')],_0x5779bd['id']);if(_0x3c9a33>0x6){_0x178df4=util['format'](_0x59ba('0x73'),_0x59c901[_0x59ba('0x56')],_0x5779bd['id']);}logger[_0x59ba('0x24')](_0x59ba('0x6d'),_0x59ba('0x66'));emit(util[_0x59ba('0x20')](_0x59ba('0x67'),_0x5d1866[_0x59ba('0xe')]),_0x59ba('0x68'),{'uri':_0x178df4});})['catch'](function(_0x37092f){logger['error']('[OUTBOUND]',JSON[_0x59ba('0x1f')](_0x37092f));});};exports[_0x59ba('0x74')]=function(_0x5cff68,_0xa7caca,_0x32db6f,_0x5f2d4a,_0x54e2ba,_0x3bd0d1){var _0x16565f,_0x5099d4,_0x195c4e,_0x469abf;_0x3bd0d1['remoteUri']=intUtil[_0x59ba('0x54')](_0x3bd0d1[_0x59ba('0x56')]);_0x3bd0d1[_0x59ba('0x55')]=intUtil[_0x59ba('0x54')](_0x3bd0d1[_0x59ba('0x55')]);def[_0x59ba('0x6a')]=util['format'](_0x59ba('0x75'),_0x3bd0d1[_0x59ba('0x56')]);if(_0x54e2ba&&_0x54e2ba['monitor_format']){logger[_0x59ba('0x24')]('['+_0xa7caca[_0x59ba('0x76')][_0x59ba('0x77')]()+']',_0x59ba('0x59'));_0xa7caca['recordingURL']=util[_0x59ba('0x20')](_0x59ba('0x6e'),_0x3bd0d1[_0x59ba('0x55')],_0xa7caca[_0x59ba('0x5b')],md5(_0xa7caca[_0x59ba('0x5b')]));}else{_0xa7caca[_0x59ba('0x5a')]='';}return getConnection(_0x3bd0d1)[_0x59ba('0x28')](function(_0x23ac20){_0x469abf=_0x23ac20;if(!_[_0x59ba('0x23')](_0x5f2d4a)){return getUser(_0x3bd0d1,_0x5f2d4a[_0x59ba('0xe')],_0x469abf);}else{return getUser(_0x3bd0d1,null,_0x469abf);}})['then'](function(_0x22653e){_0x16565f=_0x22653e;logger[_0x59ba('0x24')](_0x59ba('0x5c'),_0x16565f['id']);return getEndUser(_0x3bd0d1,_0xa7caca[_0x59ba('0x5d')],_0xa7caca[_0x59ba('0x5e')],_0x469abf);})[_0x59ba('0x28')](function(_0x5fe4c3){_0x5099d4=_0x5fe4c3;logger[_0x59ba('0x24')](_0x59ba('0x5f'),_0x5099d4['id']);return getTicket(_0x3bd0d1,_0x16565f,_0x5099d4,_0x32db6f,_0xa7caca,_0x32db6f[_0x59ba('0x60')],_0x469abf,'Inbound');})[_0x59ba('0x28')](function(_0x4a9df4){_0x195c4e=_0x4a9df4;logger[_0x59ba('0x24')]('Ticket\x20created!');logger[_0x59ba('0x24')](_0x59ba('0x61'),_0x195c4e['id']);return setRelationship(_0x469abf,_0x16565f,_0x195c4e,'users');})[_0x59ba('0x28')](function(){return setRelationship(_0x469abf,_0x5099d4,_0x195c4e,'contacts');})['then'](function(){return getServerInfo(_0x469abf);})[_0x59ba('0x78')](function(_0x1ffaad){logger[_0x59ba('0x69')]('['+_0xa7caca[_0x59ba('0x76')]['toUpperCase']()+']',JSON[_0x59ba('0x1f')](_0x1ffaad));});}; \ No newline at end of file +var _0x4b35=['Creating\x20new\x20ticket...','name','getString','Subjects','assigned_user_id','created_by','Descriptions','date_start','toISOString','slice','replace','duration_hours','duration_minutes','parent_id','Contacts','parent_name','direction','length','variableName','push','stringify','Calls','format','Basic\x20%s','apiKey','toString','base64','get_server_info','JSON','isNil','Getting\x20agent\x20with\x20name','Employees','user_name','then','entry_list','find','value','Agent\x20found!','name_value_list','user_id','resolve','Searching\x20enduser\x20with\x20phone','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','set_entry','','Caller\x20-\x20%s','Enduser\x20created.','first_name','debug','[HTTP]','merge','string','nameField','customField','toLowerCase','content','custom_fields','variable','idField','Variable','login','username','password','PLAIN','sessionID','Account\x20%d\x20is\x20not\x20valid','set_relationship','queue','remoteUri','stripTrailingSlash','serverUrl','uri','%s/service/v4_1/rest.php','monitor_format','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','contacts','version','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','catch','outbound','recordingFormat','none','[OUTBOUND]','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','Outbound','users','trigger:browser:url','error','lastevent','toUpperCase','Inbound','request-promise','bluebird','ioredis','./util','../../../../config/environment','../../../../config/logger','sugarcrm','redis','defaults','localhost','socket.io-emitter','POST','emit','info'];(function(_0x12f688,_0x585c25){var _0x59c3de=function(_0x4ac301){while(--_0x4ac301){_0x12f688['push'](_0x12f688['shift']());}};_0x59c3de(++_0x585c25);}(_0x4b35,0xea));var _0x54b3=function(_0x3d2c91,_0x2f965f){_0x3d2c91=_0x3d2c91-0x0;var _0x4ea4df=_0x4b35[_0x3d2c91];return _0x4ea4df;};'use strict';var _=require('lodash');var rp=require(_0x54b3('0x0'));var BPromise=require(_0x54b3('0x1'));var md5=require('md5');var util=require('util');var Redis=require(_0x54b3('0x2'));var intUtil=require(_0x54b3('0x3'));var config=require(_0x54b3('0x4'));var logger=require(_0x54b3('0x5'))(_0x54b3('0x6'));config[_0x54b3('0x7')]=_[_0x54b3('0x8')](config[_0x54b3('0x7')],{'host':_0x54b3('0x9'),'port':0x18eb});var io=require(_0x54b3('0xa'))(new Redis(config['redis']));var def={'method':_0x54b3('0xb'),'json':!![]};function emit(_0x444e65,_0xd19c8d,_0x5cc40c){io['to'](_0x444e65)[_0x54b3('0xc')](_0xd19c8d,_0x5cc40c);}function getTicket(_0x31f36b,_0x1092ec,_0x2b3f7d,_0x557b24,_0x3efffd,_0x1b4645,_0x128ae7,_0x3be979){logger[_0x54b3('0xd')](_0x54b3('0xe'));var _0x5a4a84=new Date();var _0x373b57=[{'name':_0x54b3('0xf'),'value':intUtil[_0x54b3('0x10')](_0x557b24[_0x54b3('0x11')],_0x3efffd,'\x20')},{'name':_0x54b3('0x12'),'value':_0x1092ec['id']},{'name':_0x54b3('0x13'),'value':_0x1092ec['id']},{'name':'description','value':intUtil[_0x54b3('0x10')](_0x557b24[_0x54b3('0x14')],_0x3efffd,'\x0a')},{'name':_0x54b3('0x15'),'value':_0x5a4a84[_0x54b3('0x16')]()[_0x54b3('0x17')](0x0,0x13)[_0x54b3('0x18')]('T','\x20')},{'name':_0x54b3('0x19'),'value':'0'},{'name':_0x54b3('0x1a'),'value':'15'},{'name':_0x54b3('0x1b'),'value':_0x2b3f7d['id']},{'name':'parent_type','value':_0x54b3('0x1c')},{'name':_0x54b3('0x1d'),'value':_0x2b3f7d[_0x54b3('0xf')]},{'name':_0x54b3('0x1e'),'value':_0x3be979}];if(_0x1b4645[_0x54b3('0x1f')]){_['forEach'](_0x1b4645,function(_0x378f67){if(_0x3efffd[_0x378f67[_0x54b3('0x20')]]){_0x373b57[_0x54b3('0x21')]({'name':_0x378f67['idField'],'value':_0x3efffd[_0x378f67[_0x54b3('0x20')]]});}});}return request({'form':{'method':'set_entry','input_type':'JSON','response_type':'JSON','rest_data':JSON[_0x54b3('0x22')]({'session':_0x128ae7['id'],'module_name':_0x54b3('0x23'),'name_value_list':_0x373b57})}});}function getAuth(_0x1f46be){return util[_0x54b3('0x24')](_0x54b3('0x25'),new Buffer(_0x1f46be[_0x54b3('0x26')]+':X')[_0x54b3('0x27')](_0x54b3('0x28')));}function getServerInfo(_0x57bf7d){return request({'form':{'method':_0x54b3('0x29'),'input_type':_0x54b3('0x2a'),'response_type':_0x54b3('0x2a'),'rest_data':JSON[_0x54b3('0x22')]({'session':_0x57bf7d['id']})}});}function getUser(_0x56c15a,_0x1664c8,_0x4f80b3){if(!_[_0x54b3('0x2b')](_0x1664c8)){logger[_0x54b3('0xd')](_0x54b3('0x2c'),_0x1664c8);return request({'form':{'method':'get_entry_list','input_type':'JSON','response_type':_0x54b3('0x2a'),'rest_data':JSON[_0x54b3('0x22')]({'session':_0x4f80b3['id'],'module_name':_0x54b3('0x2d'),'query':util[_0x54b3('0x24')]('INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200',_0x1664c8),'order_by':'','offset':'0','select_fields':['id',_0x54b3('0xf'),_0x54b3('0x2e')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x54b3('0x2f')](function(_0x4db8c5){if(_0x4db8c5[_0x54b3('0x30')][_0x54b3('0x1f')]){var _0x2332b5=_[_0x54b3('0x31')](_0x4db8c5['entry_list'],function(_0x4428b2){return _0x4428b2['name_value_list']['user_name'][_0x54b3('0x32')]===_0x1664c8;});if(_0x2332b5){logger[_0x54b3('0xd')](_0x54b3('0x33'));return BPromise['resolve']({'id':_0x2332b5['name_value_list']['id'][_0x54b3('0x32')],'name':_0x2332b5[_0x54b3('0x34')][_0x54b3('0xf')]['value']});}}logger[_0x54b3('0xd')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise['resolve']({'id':_0x4f80b3['name_value_list'][_0x54b3('0x35')][_0x54b3('0x32')],'name':_0x4f80b3[_0x54b3('0x34')]['user_name']['value']});});}else{logger[_0x54b3('0xd')]('Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!');return BPromise[_0x54b3('0x36')]({'id':_0x4f80b3[_0x54b3('0x34')][_0x54b3('0x35')][_0x54b3('0x32')],'name':_0x4f80b3[_0x54b3('0x34')]['user_name'][_0x54b3('0x32')]});}}function getEndUser(_0x429050,_0x520659,_0x280d54,_0x55cf88){logger[_0x54b3('0xd')](_0x54b3('0x37'),_0x280d54);return request({'form':{'method':'get_entry_list','input_type':'JSON','response_type':_0x54b3('0x2a'),'rest_data':JSON[_0x54b3('0x22')]({'session':_0x55cf88['id'],'module_name':_0x54b3('0x1c'),'query':util[_0x54b3('0x24')](_0x54b3('0x38'),_0x280d54),'order_by':'','offset':'0','select_fields':['id',_0x54b3('0xf'),_0x54b3('0x39')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x4c01cf){if(_0x4c01cf['entry_list'][_0x54b3('0x1f')]){var _0x160b5c=_[_0x54b3('0x31')](_0x4c01cf[_0x54b3('0x30')],function(_0x3f00de){return _0x3f00de[_0x54b3('0x34')]['phone_home']['value']===_0x280d54;});if(_0x160b5c){logger[_0x54b3('0xd')](_0x54b3('0x3a'));return BPromise['resolve']({'id':_0x160b5c['name_value_list']['id'][_0x54b3('0x32')],'name':_0x160b5c['name_value_list'][_0x54b3('0xf')][_0x54b3('0x32')],'phone':_0x160b5c[_0x54b3('0x34')][_0x54b3('0x39')][_0x54b3('0x32')]});}}else{logger[_0x54b3('0xd')](_0x54b3('0x3b'));return request({'form':{'method':_0x54b3('0x3c'),'input_type':'JSON','response_type':_0x54b3('0x2a'),'rest_data':JSON[_0x54b3('0x22')]({'session':_0x55cf88['id'],'module_name':_0x54b3('0x1c'),'name_value_list':[{'name':'first_name','value':_0x520659!==_0x54b3('0x3d')?_0x520659:util[_0x54b3('0x24')](_0x54b3('0x3e'),_0x280d54)},{'name':_0x54b3('0x39'),'value':_0x280d54}]})}})['then'](function(_0x58e53d){logger[_0x54b3('0xd')](_0x54b3('0x3f'));return BPromise[_0x54b3('0x36')]({'id':_0x58e53d['id'],'name':_0x58e53d[_0x54b3('0x30')][_0x54b3('0x40')]['value'],'phone':_0x58e53d['entry_list'][_0x54b3('0x39')][_0x54b3('0x32')]});});}});}function request(_0x9b248c){logger[_0x54b3('0x41')](_0x54b3('0x42'),JSON[_0x54b3('0x22')](_0x9b248c));return rp(_[_0x54b3('0x43')](def,_0x9b248c));}function getTags(_0x45ba16,_0x130495){var _0x2ff28e=[];if(_0x45ba16&&_0x45ba16[_0x54b3('0x1f')]>0x0){_0x2ff28e=_['map'](_0x45ba16,_0x130495);}return _0x2ff28e;}function getCustomFields(_0x326f4d,_0x10def0){var _0x1ba511=[];var _0x528c6a={'custom_fields':[]};if(_0x326f4d[_0x54b3('0x1f')]>0x0){_['forEach'](_0x326f4d,function(_0x236496){if(_0x236496['type']===_0x54b3('0x44')&&_0x236496[_0x54b3('0x45')]&&!_0x236496[_0x54b3('0x46')]){_0x528c6a[_0x236496[_0x54b3('0x45')][_0x54b3('0x47')]()]=_0x236496[_0x54b3('0x48')][_0x54b3('0x27')]();}else if(_0x236496['type']===_0x54b3('0x44')&&_0x236496['idField']&&_0x236496[_0x54b3('0x46')]){_0x528c6a[_0x54b3('0x49')]['push']({'id':_0x236496['idField'],'value':_0x236496[_0x54b3('0x48')]['toString']()});}else if(_0x236496['type']===_0x54b3('0x4a')&&_0x236496[_0x54b3('0x20')]&&_0x236496['idField']&&_0x236496[_0x54b3('0x46')]){_0x10def0[_0x236496[_0x54b3('0x20')]]&&_0x528c6a[_0x54b3('0x49')][_0x54b3('0x21')]({'id':_0x236496[_0x54b3('0x4b')],'value':_0x10def0[_0x236496[_0x54b3('0x20')]][_0x54b3('0x27')]()});}else if(_0x236496['type']==='customVariable'&&_0x236496[_0x54b3('0x4c')]&&_0x236496['Variable']['name']&&_0x236496[_0x54b3('0x4b')]&&_0x236496[_0x54b3('0x46')]){_0x10def0[_0x236496[_0x54b3('0x4c')][_0x54b3('0xf')][_0x54b3('0x47')]()]&&_0x528c6a['custom_fields'][_0x54b3('0x21')]({'id':_0x236496[_0x54b3('0x4b')],'value':_0x10def0[_0x236496['Variable']['name'][_0x54b3('0x47')]()][_0x54b3('0x27')]()});}});}return _0x528c6a;}function getConnection(_0x5d9083){return request({'method':_0x54b3('0xb'),'form':{'method':_0x54b3('0x4d'),'input_type':_0x54b3('0x2a'),'response_type':_0x54b3('0x2a'),'rest_data':JSON[_0x54b3('0x22')]({'user_auth':{'user_name':_0x5d9083[_0x54b3('0x4e')],'password':_0x5d9083[_0x54b3('0x4f')],'encryption':_0x54b3('0x50')},'application':'xCALLY\x20Motion\x20integration'})}})['then'](function(_0x300c08){var _0x5427e9=_0x300c08;if(_0x5427e9['id']){def[_0x54b3('0x51')]=_0x5427e9['id'];return BPromise[_0x54b3('0x36')](_0x5427e9);}else{throw new Error(util[_0x54b3('0x24')](_0x54b3('0x52'),_0x5d9083['id']));}});}function setRelationship(_0x20fc8a,_0x21f002,_0x25bfa9,_0x3e5ef8){return request({'form':{'method':_0x54b3('0x53'),'input_type':'JSON','response_type':_0x54b3('0x2a'),'rest_data':JSON[_0x54b3('0x22')]({'session':_0x20fc8a['id'],'module_name':_0x54b3('0x23'),'module_id':_0x25bfa9['id'],'link_field_name':_0x3e5ef8,'related_ids':[_0x21f002['id']],'name_value_list':[],'delete':0x0})}});}exports[_0x54b3('0x54')]=function(_0x1a09b1,_0x57e88a,_0x342d8e,_0x11c289,_0x1c6ff7,_0x32833a){var _0x597da8,_0x8f2f83,_0x369e9a,_0x4415f4;_0x32833a[_0x54b3('0x55')]=intUtil[_0x54b3('0x56')](_0x32833a['remoteUri']);_0x32833a[_0x54b3('0x57')]=intUtil['stripTrailingSlash'](_0x32833a[_0x54b3('0x57')]);def[_0x54b3('0x58')]=util[_0x54b3('0x24')](_0x54b3('0x59'),_0x32833a[_0x54b3('0x55')]);if(_0x1c6ff7&&_0x1c6ff7[_0x54b3('0x5a')]){logger['info']('[QUEUE]',_0x54b3('0x5b'));_0x57e88a['recordingURL']=util[_0x54b3('0x24')](_0x54b3('0x5c'),_0x32833a[_0x54b3('0x57')],_0x57e88a[_0x54b3('0x5d')],md5(_0x57e88a[_0x54b3('0x5d')]));}else{_0x57e88a[_0x54b3('0x5e')]='';}return getConnection(_0x32833a)[_0x54b3('0x2f')](function(_0x541836){_0x4415f4=_0x541836;return getUser(_0x32833a,_0x11c289[_0x54b3('0xf')],_0x4415f4);})[_0x54b3('0x2f')](function(_0xd544c6){_0x597da8=_0xd544c6;logger[_0x54b3('0xd')]('The\x20User\x20ID\x20is:',_0x597da8['id']);return getEndUser(_0x32833a,_0x57e88a[_0x54b3('0x5f')],_0x57e88a[_0x54b3('0x60')],_0x4415f4);})['then'](function(_0x6a5e1a){_0x8f2f83=_0x6a5e1a;logger[_0x54b3('0xd')](_0x54b3('0x61'),_0x8f2f83['id']);return getTicket(_0x32833a,_0x597da8,_0x8f2f83,_0x342d8e,_0x57e88a,_0x342d8e[_0x54b3('0x62')],_0x4415f4,'Inbound');})[_0x54b3('0x2f')](function(_0x5ed0a3){_0x369e9a=_0x5ed0a3;logger[_0x54b3('0xd')](_0x54b3('0x63'));logger[_0x54b3('0xd')](_0x54b3('0x64'),_0x369e9a['id']);return setRelationship(_0x4415f4,_0x597da8,_0x369e9a,'users');})[_0x54b3('0x2f')](function(){return setRelationship(_0x4415f4,_0x8f2f83,_0x369e9a,_0x54b3('0x65'));})[_0x54b3('0x2f')](function(){return getServerInfo(_0x4415f4);})[_0x54b3('0x2f')](function(_0x47ea16){var _0x2d65fa=parseInt(_0x47ea16[_0x54b3('0x66')][_0x54b3('0x67')](0x0));var _0x256396=util[_0x54b3('0x24')](_0x54b3('0x68'),_0x32833a['remoteUri'],_0x369e9a['id']);if(_0x2d65fa>0x6){_0x256396=util['format'](_0x54b3('0x69'),_0x32833a[_0x54b3('0x55')],_0x369e9a['id']);}logger[_0x54b3('0xd')](_0x54b3('0x6a'),_0x54b3('0x6b'));emit(util[_0x54b3('0x24')](_0x54b3('0x6c'),_0x11c289[_0x54b3('0xf')]),'trigger:browser:url',{'uri':_0x256396});})[_0x54b3('0x6d')](function(_0x3c7903){logger['error']('[QUEUE]',JSON[_0x54b3('0x22')](_0x3c7903));});};exports[_0x54b3('0x6e')]=function(_0x305a4a,_0x400016,_0x3de4fa,_0x4d9272,_0x4948aa,_0x6ee705,_0x2d9e07){var _0x3a04de,_0x1d697a,_0x13b749,_0x22f10c;_0x6ee705['remoteUri']=intUtil[_0x54b3('0x56')](_0x6ee705['remoteUri']);_0x6ee705[_0x54b3('0x57')]=intUtil[_0x54b3('0x56')](_0x6ee705['serverUrl']);def[_0x54b3('0x58')]=util[_0x54b3('0x24')](_0x54b3('0x59'),_0x6ee705[_0x54b3('0x55')]);if(_0x2d9e07&&_0x2d9e07[_0x54b3('0x6f')]&&_0x2d9e07['recordingFormat']!==_0x54b3('0x70')){logger['info'](_0x54b3('0x71'),_0x54b3('0x5b'));_0x400016[_0x54b3('0x5e')]=util[_0x54b3('0x24')](_0x54b3('0x5c'),_0x6ee705['serverUrl'],_0x400016[_0x54b3('0x5d')],md5(_0x400016[_0x54b3('0x5d')]));}return getConnection(_0x6ee705)[_0x54b3('0x2f')](function(_0x1f29dd){_0x22f10c=_0x1f29dd;return getUser(_0x6ee705,_0x4d9272['name'],_0x22f10c);})[_0x54b3('0x2f')](function(_0x58fb18){_0x3a04de=_0x58fb18;logger['info'](_0x54b3('0x72'),_0x3a04de['id']);return getEndUser(_0x6ee705,_0x400016[_0x54b3('0x73')],_0x400016[_0x54b3('0x74')],_0x22f10c);})[_0x54b3('0x2f')](function(_0x1a7434){_0x1d697a=_0x1a7434;logger[_0x54b3('0xd')]('The\x20Enduser\x20ID\x20is:',_0x1d697a['id']);return getTicket(_0x6ee705,_0x3a04de,_0x1d697a,_0x3de4fa,_0x400016,_0x3de4fa[_0x54b3('0x62')],_0x22f10c,_0x54b3('0x75'));})[_0x54b3('0x2f')](function(_0x2305af){_0x13b749=_0x2305af;logger['info'](_0x54b3('0x63'));logger[_0x54b3('0xd')]('The\x20Ticket\x20ID\x20is:',_0x13b749['id']);return setRelationship(_0x22f10c,_0x3a04de,_0x13b749,_0x54b3('0x76'));})[_0x54b3('0x2f')](function(){return setRelationship(_0x22f10c,_0x1d697a,_0x13b749,'contacts');})[_0x54b3('0x2f')](function(){return getServerInfo(_0x22f10c);})[_0x54b3('0x2f')](function(_0x12cda0){var _0x1cf8a=parseInt(_0x12cda0['version']['charAt'](0x0));var _0x10ff42=util[_0x54b3('0x24')]('%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s',_0x6ee705[_0x54b3('0x55')],_0x13b749['id']);if(_0x1cf8a>0x6){_0x10ff42=util[_0x54b3('0x24')](_0x54b3('0x69'),_0x6ee705[_0x54b3('0x55')],_0x13b749['id']);}logger[_0x54b3('0xd')](_0x54b3('0x71'),_0x54b3('0x6b'));emit(util['format'](_0x54b3('0x6c'),_0x4d9272[_0x54b3('0xf')]),_0x54b3('0x77'),{'uri':_0x10ff42});})[_0x54b3('0x6d')](function(_0x1455a6){logger[_0x54b3('0x78')](_0x54b3('0x71'),JSON[_0x54b3('0x22')](_0x1455a6));});};exports['unmanaged']=function(_0x3b978c,_0x2492f4,_0x20d12a,_0xc5d0cb,_0x4cc998,_0x4f8bf8){var _0x3b1126,_0x311c72,_0x5b2c1d,_0x1ba0cc;_0x4f8bf8[_0x54b3('0x55')]=intUtil[_0x54b3('0x56')](_0x4f8bf8[_0x54b3('0x55')]);_0x4f8bf8[_0x54b3('0x57')]=intUtil['stripTrailingSlash'](_0x4f8bf8[_0x54b3('0x57')]);def[_0x54b3('0x58')]=util[_0x54b3('0x24')](_0x54b3('0x59'),_0x4f8bf8[_0x54b3('0x55')]);if(_0x4cc998&&_0x4cc998[_0x54b3('0x5a')]){logger[_0x54b3('0xd')]('['+_0x2492f4[_0x54b3('0x79')][_0x54b3('0x7a')]()+']','Recording\x20is\x20enabled!');_0x2492f4[_0x54b3('0x5e')]=util['format'](_0x54b3('0x5c'),_0x4f8bf8[_0x54b3('0x57')],_0x2492f4[_0x54b3('0x5d')],md5(_0x2492f4['uniqueid']));}else{_0x2492f4[_0x54b3('0x5e')]='';}return getConnection(_0x4f8bf8)[_0x54b3('0x2f')](function(_0x465417){_0x1ba0cc=_0x465417;if(!_[_0x54b3('0x2b')](_0xc5d0cb)){return getUser(_0x4f8bf8,_0xc5d0cb[_0x54b3('0xf')],_0x1ba0cc);}else{return getUser(_0x4f8bf8,null,_0x1ba0cc);}})[_0x54b3('0x2f')](function(_0x1a7562){_0x3b1126=_0x1a7562;logger[_0x54b3('0xd')]('The\x20User\x20ID\x20is:',_0x3b1126['id']);return getEndUser(_0x4f8bf8,_0x2492f4['calleridname'],_0x2492f4[_0x54b3('0x60')],_0x1ba0cc);})[_0x54b3('0x2f')](function(_0x1427d3){_0x311c72=_0x1427d3;logger['info'](_0x54b3('0x61'),_0x311c72['id']);return getTicket(_0x4f8bf8,_0x3b1126,_0x311c72,_0x20d12a,_0x2492f4,_0x20d12a['Fields'],_0x1ba0cc,_0x54b3('0x7b'));})[_0x54b3('0x2f')](function(_0x17bedf){_0x5b2c1d=_0x17bedf;logger['info'](_0x54b3('0x63'));logger[_0x54b3('0xd')](_0x54b3('0x64'),_0x5b2c1d['id']);return setRelationship(_0x1ba0cc,_0x3b1126,_0x5b2c1d,_0x54b3('0x76'));})[_0x54b3('0x2f')](function(){return setRelationship(_0x1ba0cc,_0x311c72,_0x5b2c1d,'contacts');})[_0x54b3('0x2f')](function(){return getServerInfo(_0x1ba0cc);})[_0x54b3('0x6d')](function(_0x3e2c41){logger[_0x54b3('0x78')]('['+_0x2492f4[_0x54b3('0x79')][_0x54b3('0x7a')]()+']',JSON[_0x54b3('0x22')](_0x3e2c41));});}; \ 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 790ebb0..f015adc 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 _0x720a=['type','string','variable','variableName','toString','customVariable','Variable','name','toLowerCase','keyType','key','format','%s:\x20%s','push','join','stripTrailingSlash','slice','substring','validateEmail','isNil','test','lodash','util','getString','length','sortBy'];(function(_0x22bee0,_0x412ecb){var _0x2d295b=function(_0x59d4b5){while(--_0x59d4b5){_0x22bee0['push'](_0x22bee0['shift']());}};_0x2d295b(++_0x412ecb);}(_0x720a,0x97));var _0xa720=function(_0x30f7d7,_0x298af2){_0x30f7d7=_0x30f7d7-0x0;var _0x5a164a=_0x720a[_0x30f7d7];return _0x5a164a;};'use strict';var _=require(_0xa720('0x0'));var util=require(_0xa720('0x1'));exports[_0xa720('0x2')]=function(_0x29a925,_0x3611f3,_0x5f2f6a){var _0x826b6b=[];if(_0x29a925[_0xa720('0x3')]>0x0){var _0x1f7d22=_[_0xa720('0x4')](_0x29a925,['id']);for(var _0x3a413e=0x0;_0x3a413e<_0x1f7d22['length'];_0x3a413e++){var _0x4a0b78=_0x1f7d22[_0x3a413e];if(_0x4a0b78[_0xa720('0x5')]===_0xa720('0x6')){_0x826b6b['push'](_0x4a0b78['content']);}else if(_0x4a0b78['type']===_0xa720('0x7')&&_0x4a0b78[_0xa720('0x8')]){_0x3611f3[_0x4a0b78[_0xa720('0x8')]]&&_0x826b6b['push'](_0x3611f3[_0x4a0b78[_0xa720('0x8')]][_0xa720('0x9')]());}else if(_0x4a0b78['type']===_0xa720('0xa')&&_0x4a0b78[_0xa720('0xb')]&&_0x4a0b78['Variable'][_0xa720('0xc')]){_0x3611f3[_0x4a0b78[_0xa720('0xb')][_0xa720('0xc')][_0xa720('0xd')]()]&&_0x826b6b['push'](_0x3611f3[_0x4a0b78[_0xa720('0xb')][_0xa720('0xc')][_0xa720('0xd')]()][_0xa720('0x9')]());}else if(_0x4a0b78[_0xa720('0x5')]==='keyValue'){if(_0x4a0b78[_0xa720('0xe')]===_0xa720('0x6')&&_0x4a0b78[_0xa720('0xf')]){_0x826b6b['push'](util[_0xa720('0x10')](_0xa720('0x11'),_0x4a0b78[_0xa720('0xf')],_0x4a0b78['keyContent']));}else if(_0x4a0b78[_0xa720('0xe')]===_0xa720('0x7')&&_0x4a0b78[_0xa720('0x8')]&&_0x4a0b78['key']){_0x3611f3[_0x4a0b78['variableName']]&&_0x826b6b[_0xa720('0x12')](util[_0xa720('0x10')](_0xa720('0x11'),_0x4a0b78['key'],_0x3611f3[_0x4a0b78[_0xa720('0x8')]]));}else if(_0x4a0b78[_0xa720('0xe')]===_0xa720('0xa')&&_0x4a0b78['Variable']&&_0x4a0b78[_0xa720('0xb')]['name']&&_0x4a0b78[_0xa720('0xf')]){_0x3611f3[_0x4a0b78['Variable']['name']['toLowerCase']()]&&_0x826b6b['push'](util['format']('%s:\x20%s',_0x4a0b78[_0xa720('0xf')],_0x3611f3[_0x4a0b78[_0xa720('0xb')]['name'][_0xa720('0xd')]()]));}}}}return _0x826b6b[_0xa720('0x13')](_0x5f2f6a);};exports[_0xa720('0x14')]=function(_0x58489d){var _0x4f05e0=_0x58489d[_0xa720('0x15')](-0x1);if(_0x4f05e0==='/'){_0x58489d=_0x58489d[_0xa720('0x16')](0x0,_0x58489d['lastIndexOf'](_0x4f05e0));}return _0x58489d;};exports[_0xa720('0x17')]=function(_0x18ded0){if(!_[_0xa720('0x18')](_0x18ded0)&&_0x18ded0!==''){var _0x41a365=/^(([^<>()\[\]\\.,;:\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 _0x41a365[_0xa720('0x19')](String(_0x18ded0)[_0xa720('0xd')]());}else{return![];}}; \ No newline at end of file +var _0x7d22=['validateEmail','isNil','test','lodash','getString','sortBy','length','type','variableName','toString','customVariable','Variable','name','toLowerCase','keyValue','keyType','string','key','push','format','variable','%s:\x20%s','join','substring'];(function(_0x36f8ef,_0x44716d){var _0x443b23=function(_0x55a44c){while(--_0x55a44c){_0x36f8ef['push'](_0x36f8ef['shift']());}};_0x443b23(++_0x44716d);}(_0x7d22,0x1b3));var _0x27d2=function(_0xf6a2ee,_0x24bc47){_0xf6a2ee=_0xf6a2ee-0x0;var _0xaf3bac=_0x7d22[_0xf6a2ee];return _0xaf3bac;};'use strict';var _=require(_0x27d2('0x0'));var util=require('util');exports[_0x27d2('0x1')]=function(_0x5d74b0,_0x39aa00,_0x3da9a8){var _0x38efc5=[];if(_0x5d74b0['length']>0x0){var _0x1d7b3f=_[_0x27d2('0x2')](_0x5d74b0,['id']);for(var _0x23d237=0x0;_0x23d237<_0x1d7b3f[_0x27d2('0x3')];_0x23d237++){var _0x55b2d6=_0x1d7b3f[_0x23d237];if(_0x55b2d6[_0x27d2('0x4')]==='string'){_0x38efc5['push'](_0x55b2d6['content']);}else if(_0x55b2d6[_0x27d2('0x4')]==='variable'&&_0x55b2d6[_0x27d2('0x5')]){_0x39aa00[_0x55b2d6[_0x27d2('0x5')]]&&_0x38efc5['push'](_0x39aa00[_0x55b2d6[_0x27d2('0x5')]][_0x27d2('0x6')]());}else if(_0x55b2d6[_0x27d2('0x4')]===_0x27d2('0x7')&&_0x55b2d6[_0x27d2('0x8')]&&_0x55b2d6[_0x27d2('0x8')][_0x27d2('0x9')]){_0x39aa00[_0x55b2d6['Variable'][_0x27d2('0x9')][_0x27d2('0xa')]()]&&_0x38efc5['push'](_0x39aa00[_0x55b2d6['Variable']['name'][_0x27d2('0xa')]()]['toString']());}else if(_0x55b2d6[_0x27d2('0x4')]===_0x27d2('0xb')){if(_0x55b2d6[_0x27d2('0xc')]===_0x27d2('0xd')&&_0x55b2d6[_0x27d2('0xe')]){_0x38efc5[_0x27d2('0xf')](util[_0x27d2('0x10')]('%s:\x20%s',_0x55b2d6['key'],_0x55b2d6['keyContent']));}else if(_0x55b2d6['keyType']===_0x27d2('0x11')&&_0x55b2d6['variableName']&&_0x55b2d6[_0x27d2('0xe')]){_0x39aa00[_0x55b2d6[_0x27d2('0x5')]]&&_0x38efc5[_0x27d2('0xf')](util[_0x27d2('0x10')]('%s:\x20%s',_0x55b2d6[_0x27d2('0xe')],_0x39aa00[_0x55b2d6[_0x27d2('0x5')]]));}else if(_0x55b2d6['keyType']===_0x27d2('0x7')&&_0x55b2d6[_0x27d2('0x8')]&&_0x55b2d6['Variable']['name']&&_0x55b2d6['key']){_0x39aa00[_0x55b2d6[_0x27d2('0x8')][_0x27d2('0x9')]['toLowerCase']()]&&_0x38efc5[_0x27d2('0xf')](util['format'](_0x27d2('0x12'),_0x55b2d6[_0x27d2('0xe')],_0x39aa00[_0x55b2d6[_0x27d2('0x8')][_0x27d2('0x9')]['toLowerCase']()]));}}}}return _0x38efc5[_0x27d2('0x13')](_0x3da9a8);};exports['stripTrailingSlash']=function(_0x5d153b){var _0x324b51=_0x5d153b['slice'](-0x1);if(_0x324b51==='/'){_0x5d153b=_0x5d153b[_0x27d2('0x14')](0x0,_0x5d153b['lastIndexOf'](_0x324b51));}return _0x5d153b;};exports[_0x27d2('0x15')]=function(_0x27916e){if(!_[_0x27d2('0x16')](_0x27916e)&&_0x27916e!==''){var _0x165a7f=/^(([^<>()\[\]\\.,;:\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 _0x165a7f[_0x27d2('0x17')](String(_0x27916e)[_0x27d2('0xa')]());}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 b26143a..98d9257 100644 --- a/server/services/ami/trigger/integration/vtiger.js +++ b/server/services/ami/trigger/integration/vtiger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['result','Agent\x20found!','email1','first_name','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','admin','getUser','username','Searching\x20end\x20user\x20with\x20phone','remoteUri','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','phone','catch','accessKey','getchallenge','token','Account\x20%d\x20is\x20not\x20valid','getConnection','queue','stripTrailingSlash','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Ticket\x20created!','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','split','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','outbound','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','The\x20Ticket\x20ID\x20is:','user:%s','unmanaged','lastevent','toUpperCase','lodash','request-promise','bluebird','util','ioredis','./util','../../../../config/environment','../../../../config/logger','vTiger','redis','defaults','localhost','socket.io-emitter','emit','length','forEach','includes','string','idField','content','toString','type','variable','variableName','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','merge','Normal','Open','Subjects','getString','Descriptions','POST','format','%s/webservice.php','create','stringify','then','success','resolve','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','statusCode','error','[vTiger],\x20%s,\x20%s,\x20%s','validateEmail','Getting\x20agent\x20with\x20email','GET','query','sessionName','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;'];(function(_0x2b152a,_0x3dd988){var _0x2ad4c7=function(_0x2fa97c){while(--_0x2fa97c){_0x2b152a['push'](_0x2b152a['shift']());}};_0x2ad4c7(++_0x3dd988);}(_0xe706,0xa3));var _0x6e70=function(_0x23bc85,_0x19addc){_0x23bc85=_0x23bc85-0x0;var _0x177dfd=_0xe706[_0x23bc85];return _0x177dfd;};'use strict';var _=require(_0x6e70('0x0'));var rp=require(_0x6e70('0x1'));var BPromise=require(_0x6e70('0x2'));var md5=require('md5');var util=require(_0x6e70('0x3'));var Redis=require(_0x6e70('0x4'));var intUtil=require(_0x6e70('0x5'));var config=require(_0x6e70('0x6'));var logger=require(_0x6e70('0x7'))(_0x6e70('0x8'));config[_0x6e70('0x9')]=_[_0x6e70('0xa')](config[_0x6e70('0x9')],{'host':_0x6e70('0xb'),'port':0x18eb});var io=require(_0x6e70('0xc'))(new Redis(config[_0x6e70('0x9')]));function emit(_0x45a2d4,_0x188ed3,_0x3c4843){io['to'](_0x45a2d4)[_0x6e70('0xd')](_0x188ed3,_0x3c4843);}function getCustomFields(_0x954545,_0x25e61c){var _0x100eb7={};if(_0x954545[_0x6e70('0xe')]>0x0){_[_0x6e70('0xf')](_0x954545,function(_0x3f474a){if(_[_0x6e70('0x10')]([_0x6e70('0x11'),'picklist'],_0x3f474a['type'])&&_0x3f474a[_0x6e70('0x12')]){_0x100eb7[_0x3f474a[_0x6e70('0x12')]]=_0x3f474a[_0x6e70('0x13')][_0x6e70('0x14')]();}else if(_0x3f474a[_0x6e70('0x15')]===_0x6e70('0x16')&&_0x3f474a[_0x6e70('0x17')]&&_0x3f474a[_0x6e70('0x12')]&&_0x25e61c[_0x3f474a['variableName']]){_0x100eb7[_0x3f474a['idField']]=_0x25e61c[_0x3f474a['variableName']][_0x6e70('0x14')]();}else if(_0x3f474a['type']==='customVariable'&&_0x3f474a[_0x6e70('0x18')]&&_0x3f474a[_0x6e70('0x18')]['name']&&_0x3f474a[_0x6e70('0x12')]&&_0x25e61c[_0x3f474a['Variable'][_0x6e70('0x19')][_0x6e70('0x1a')]()]){_0x100eb7[_0x3f474a['idField']]=_0x25e61c[_0x3f474a['Variable'][_0x6e70('0x19')]['toLowerCase']()][_0x6e70('0x14')]();}});}return _0x100eb7;}function createTicket(_0x173afe,_0x53acdc,_0x497d61,_0xc238ba,_0x208e21,_0x2368eb,_0x3a9978){logger[_0x6e70('0x1b')](_0x6e70('0x1c'));var _0x1b2453=_[_0x6e70('0x1d')]({'parent_id':'','assigned_user_id':_0x53acdc['id'],'ticketpriorities':_0x6e70('0x1e'),'ticketstatus':_0x6e70('0x1f'),'ticket_title':intUtil['getString'](_0xc238ba[_0x6e70('0x20')],_0x208e21,'\x20'),'description':intUtil[_0x6e70('0x21')](_0xc238ba[_0x6e70('0x22')],_0x208e21,'\x0a'),'contact_id':_0x497d61['id']},getCustomFields(_0x2368eb,_0x208e21));var _0x502b2d={'method':_0x6e70('0x23'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x173afe['remoteUri']),'form':{'operation':_0x6e70('0x26'),'username':_0x173afe['username'],'sessionName':_0x3a9978['sessionName'],'elementType':'HelpDesk','element':JSON[_0x6e70('0x27')](_0x1b2453)},'json':!![]};return request(_0x502b2d)[_0x6e70('0x28')](function(_0x51d292){if(_0x51d292[_0x6e70('0x29')]){return BPromise[_0x6e70('0x2a')]({'id':_0x51d292['result']['id']});}else{throw new Error(util[_0x6e70('0x24')](_0x6e70('0x2b'),JSON[_0x6e70('0x27')](_0x51d292['error'])));}})['catch'](function(_0x2c4d37){var _0x3af17f=_0x2c4d37[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),'createTicket',_0x3af17f,JSON[_0x6e70('0x27')](_0x2c4d37));});}function getUser(_0x406f29,_0xecf336,_0x2864a0){if(intUtil[_0x6e70('0x2f')](_0xecf336)){logger[_0x6e70('0x1b')](_0x6e70('0x30'),_0xecf336);return request({'method':_0x6e70('0x31'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x406f29['remoteUri']),'qs':{'operation':_0x6e70('0x32'),'username':_0x406f29['username'],'sessionName':_0x2864a0[_0x6e70('0x33')],'query':util['format'](_0x6e70('0x34'),_0xecf336)},'json':!![]})[_0x6e70('0x28')](function(_0x30fa0b){if(_0x30fa0b['success']&&_0x30fa0b[_0x6e70('0x35')][_0x6e70('0xe')]){logger['info'](_0x6e70('0x36'));return BPromise[_0x6e70('0x2a')]({'id':_0x30fa0b['result'][0x0]['id'],'email':_0x30fa0b[_0x6e70('0x35')][0x0][_0x6e70('0x37')],'name':_0x30fa0b[_0x6e70('0x35')][0x0][_0x6e70('0x38')]+'\x20'+_0x30fa0b[_0x6e70('0x35')][_0x6e70('0x39')]});}else{logger[_0x6e70('0x1b')](_0x6e70('0x3a'));return BPromise[_0x6e70('0x2a')]({'id':_0x2864a0[_0x6e70('0x3b')],'email':_0x406f29['username'],'name':_0x6e70('0x3c')});}})['catch'](function(_0x23cd1a){var _0x3222a2=_0x23cd1a[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),_0x6e70('0x3d'),_0x3222a2,JSON[_0x6e70('0x27')](_0x23cd1a));});}else{logger[_0x6e70('0x1b')](_0x6e70('0x3a'));return BPromise[_0x6e70('0x2a')]({'id':_0x2864a0[_0x6e70('0x3b')],'email':_0x406f29[_0x6e70('0x3e')],'name':_0x6e70('0x3c')})['catch'](function(_0x5446a2){var _0x5424eb=_0x5446a2[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),_0x6e70('0x3d'),_0x5424eb,JSON[_0x6e70('0x27')](_0x5446a2));});}}function getEndUser(_0x3bdd87,_0x572a71,_0x3b508c,_0x9e7ad2){logger[_0x6e70('0x1b')](_0x6e70('0x3f'),_0x3b508c);return request({'method':_0x6e70('0x31'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x3bdd87[_0x6e70('0x40')]),'qs':{'operation':'query','username':_0x3bdd87[_0x6e70('0x3e')],'sessionName':_0x9e7ad2[_0x6e70('0x33')],'query':util[_0x6e70('0x24')](_0x6e70('0x41'),_0x3b508c,_0x3b508c,_0x3b508c,_0x3b508c,_0x3b508c)},'json':!![]})[_0x6e70('0x28')](function(_0x1de947){if(_0x1de947[_0x6e70('0x29')]&&_0x1de947['result']['length']){logger['info'](_0x6e70('0x42'));return BPromise[_0x6e70('0x2a')]({'id':_0x1de947[_0x6e70('0x35')][0x0]['id'],'name':_0x1de947[_0x6e70('0x35')][0x0][_0x6e70('0x43')]+'\x20'+_0x1de947['result'][0x0][_0x6e70('0x44')],'phone':_0x3b508c});}else{logger[_0x6e70('0x1b')](_0x6e70('0x45'));return request({'method':'POST','uri':util['format']('%s/webservice.php',_0x3bdd87[_0x6e70('0x40')]),'form':{'operation':'create','sessionName':_0x9e7ad2[_0x6e70('0x33')],'elementType':_0x6e70('0x46'),'element':JSON[_0x6e70('0x27')]({'lastname':_0x572a71,'phone':_0x3b508c,'assigned_user_id':'\x20'})},'json':!![]})[_0x6e70('0x28')](function(_0x59c87d){logger[_0x6e70('0x1b')]('Enduser\x20created.');return BPromise[_0x6e70('0x2a')]({'id':_0x59c87d[_0x6e70('0x35')]['id'],'name':_0x59c87d[_0x6e70('0x35')][_0x6e70('0x44')],'phone':_0x59c87d['result'][_0x6e70('0x47')]});})[_0x6e70('0x48')](function(_0x3d39c3){var _0xac87d6=_0x3d39c3[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),'getEndUser',_0xac87d6,JSON[_0x6e70('0x27')](_0x3d39c3));});}});}function getConnection(_0x3884a4){var _0x10de2a=_0x3884a4[_0x6e70('0x3e')];var _0x3f86cf=_0x3884a4[_0x6e70('0x49')];return request({'method':_0x6e70('0x31'),'uri':util['format'](_0x6e70('0x25'),_0x3884a4['remoteUri']),'qs':{'operation':_0x6e70('0x4a'),'username':_0x10de2a},'json':!![]})[_0x6e70('0x28')](function(_0x4b351e){if(_0x4b351e['success']){return request({'method':_0x6e70('0x23'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x3884a4['remoteUri']),'form':{'operation':'login','username':_0x10de2a,'accessKey':md5(_0x4b351e[_0x6e70('0x35')][_0x6e70('0x4b')]+_0x3f86cf)},'json':!![]});}})[_0x6e70('0x28')](function(_0x79653){if(_0x79653[_0x6e70('0x29')]){return BPromise[_0x6e70('0x2a')](_0x79653['result']);}else{throw new Error(util[_0x6e70('0x24')](_0x6e70('0x4c'),_0x3884a4['id']));}})[_0x6e70('0x48')](function(_0x6ed023){var _0x2c3a7d=_0x6ed023['statusCode']||0x1f4;logger['error'](_0x6e70('0x2e'),_0x6e70('0x4d'),_0x2c3a7d,JSON[_0x6e70('0x27')](_0x6ed023));});}function request(_0x15f994){logger[_0x6e70('0x1b')]('[HTTP]',JSON[_0x6e70('0x27')](_0x15f994));return rp(_0x15f994);}exports[_0x6e70('0x4e')]=function(_0x1fa320,_0x23ebfb,_0x3aba34,_0x4a111a,_0x1142cd,_0x1dd242){var _0x2c20d3,_0x3fb0d3,_0x8ef4f7,_0x3fd03d;_0x1dd242['remoteUri']=intUtil[_0x6e70('0x4f')](_0x1dd242[_0x6e70('0x40')]);if(_0x1142cd&&_0x1142cd['monitor_format']){logger[_0x6e70('0x1b')](_0x6e70('0x50'),'Recording\x20is\x20enabled!');_0x23ebfb[_0x6e70('0x51')]=util[_0x6e70('0x24')](_0x6e70('0x52'),_0x1dd242[_0x6e70('0x53')],_0x23ebfb[_0x6e70('0x54')],md5(_0x23ebfb['uniqueid']));}else{_0x23ebfb[_0x6e70('0x51')]='';}return getConnection(_0x1dd242)[_0x6e70('0x28')](function(_0x10d655){_0x3fd03d=_0x10d655;return getUser(_0x1dd242,_0x4a111a[_0x6e70('0x55')],_0x3fd03d);})[_0x6e70('0x28')](function(_0x1fe13a){_0x2c20d3=_0x1fe13a;logger[_0x6e70('0x1b')](_0x6e70('0x56'),_0x2c20d3['id']);return getEndUser(_0x1dd242,_0x23ebfb[_0x6e70('0x57')],_0x23ebfb[_0x6e70('0x58')],_0x3fd03d);})[_0x6e70('0x28')](function(_0x1b12a1){_0x3fb0d3=_0x1b12a1;logger[_0x6e70('0x1b')](_0x6e70('0x59'),_0x3fb0d3['id']);return createTicket(_0x1dd242,_0x2c20d3,_0x3fb0d3,_0x3aba34,_0x23ebfb,_0x3aba34[_0x6e70('0x5a')],_0x3fd03d);})[_0x6e70('0x28')](function(_0x324fa6){_0x8ef4f7=_0x324fa6;logger[_0x6e70('0x1b')](_0x6e70('0x5b'));logger[_0x6e70('0x1b')]('The\x20Ticket\x20ID\x20is:',_0x8ef4f7['id']);var _0x28898a=util[_0x6e70('0x24')](_0x6e70('0x5c'),_0x1dd242[_0x6e70('0x40')],_[_0x6e70('0x5d')](_0x8ef4f7['id'],'x')[0x1]);logger[_0x6e70('0x1b')]('[QUEUE]',_0x6e70('0x5e'));emit(util[_0x6e70('0x24')]('user:%s',_0x4a111a[_0x6e70('0x19')]),_0x6e70('0x5f'),{'uri':_0x28898a});})[_0x6e70('0x48')](function(_0x590f7f){logger['error'](_0x6e70('0x50'),JSON[_0x6e70('0x27')](_0x590f7f));});};exports[_0x6e70('0x60')]=function(_0x41a861,_0x10d299,_0x739946,_0x30cd88,_0x57bfe5,_0x4d47e1,_0x2c8dc6){var _0x1e23c5,_0x2bf9ec,_0x2ad395,_0x5b1e6f;_0x4d47e1['remoteUri']=intUtil[_0x6e70('0x4f')](_0x4d47e1[_0x6e70('0x40')]);_0x4d47e1['serverUrl']=intUtil['stripTrailingSlash'](_0x4d47e1[_0x6e70('0x53')]);if(_0x2c8dc6&&_0x2c8dc6['recordingFormat']&&_0x2c8dc6[_0x6e70('0x61')]!==_0x6e70('0x62')){logger[_0x6e70('0x1b')](_0x6e70('0x63'),_0x6e70('0x64'));_0x10d299[_0x6e70('0x51')]=util[_0x6e70('0x24')](_0x6e70('0x52'),_0x4d47e1['serverUrl'],_0x10d299[_0x6e70('0x54')],md5(_0x10d299[_0x6e70('0x54')]));}return getConnection(_0x4d47e1)[_0x6e70('0x28')](function(_0x346c79){_0x5b1e6f=_0x346c79;return getUser(_0x4d47e1,_0x30cd88[_0x6e70('0x55')],_0x5b1e6f);})['then'](function(_0x5f5b02){_0x1e23c5=_0x5f5b02;logger['info'](_0x6e70('0x56'),_0x1e23c5['id']);return getEndUser(_0x4d47e1,_0x10d299[_0x6e70('0x65')],_0x10d299[_0x6e70('0x66')],_0x5b1e6f);})['then'](function(_0x58cf1c){_0x2bf9ec=_0x58cf1c;logger[_0x6e70('0x1b')](_0x6e70('0x59'),_0x2bf9ec['id']);return createTicket(_0x4d47e1,_0x1e23c5,_0x2bf9ec,_0x739946,_0x10d299,_0x739946[_0x6e70('0x5a')],_0x5b1e6f);})[_0x6e70('0x28')](function(_0x2285f1){_0x2ad395=_0x2285f1;logger[_0x6e70('0x1b')]('Ticket\x20created!');logger[_0x6e70('0x1b')](_0x6e70('0x67'),_0x2ad395['id']);var _0x30d11b=util[_0x6e70('0x24')]('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x4d47e1[_0x6e70('0x40')],_['split'](_0x2ad395['id'],'x')[0x1]);logger['info'](_0x6e70('0x63'),_0x6e70('0x5e'));emit(util[_0x6e70('0x24')](_0x6e70('0x68'),_0x30cd88[_0x6e70('0x19')]),_0x6e70('0x5f'),{'uri':_0x30d11b});})['catch'](function(_0x370eeb){logger[_0x6e70('0x2d')](_0x6e70('0x63'),JSON[_0x6e70('0x27')](_0x370eeb));});};exports[_0x6e70('0x69')]=function(_0x13c092,_0x363722,_0xd9b4a9,_0x2f1362,_0x29621a,_0x575938){var _0x44c877,_0x303c5a,_0x577c3b,_0x5d398a;_0x575938['remoteUri']=intUtil[_0x6e70('0x4f')](_0x575938[_0x6e70('0x40')]);_0x575938[_0x6e70('0x53')]=intUtil[_0x6e70('0x4f')](_0x575938[_0x6e70('0x53')]);if(_0x29621a&&_0x29621a['monitor_format']){logger['info']('['+_0x363722[_0x6e70('0x6a')][_0x6e70('0x6b')]()+']','Recording\x20is\x20enabled!');_0x363722[_0x6e70('0x51')]=util[_0x6e70('0x24')](_0x6e70('0x52'),_0x575938[_0x6e70('0x53')],_0x363722[_0x6e70('0x54')],md5(_0x363722[_0x6e70('0x54')]));}else{_0x363722[_0x6e70('0x51')]='';}return getConnection(_0x575938)[_0x6e70('0x28')](function(_0x3650e9){_0x5d398a=_0x3650e9;return getUser(_0x575938,'',_0x5d398a);})[_0x6e70('0x28')](function(_0x347cc4){_0x44c877=_0x347cc4;logger[_0x6e70('0x1b')](_0x6e70('0x56'),_0x44c877['id']);return getEndUser(_0x575938,_0x363722[_0x6e70('0x57')],_0x363722['calleridnum'],_0x5d398a);})['then'](function(_0x39ed95){_0x303c5a=_0x39ed95;logger['info'](_0x6e70('0x59'),_0x303c5a['id']);return createTicket(_0x575938,_0x44c877,_0x303c5a,_0xd9b4a9,_0x363722,_0xd9b4a9['Fields'],_0x5d398a);})['then'](function(_0x402f6f){_0x577c3b=_0x402f6f;logger['info']('Ticket\x20created!');logger[_0x6e70('0x1b')](_0x6e70('0x67'),_0x577c3b['id']);})[_0x6e70('0x48')](function(_0x4e9fda){logger['error']('['+_0x363722['lastevent'][_0x6e70('0x6b')]()+']',JSON['stringify'](_0x4e9fda));});}; \ No newline at end of file +var _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(_0x157bd8,_0x39eeb6){var _0x390fa5=function(_0x330586){while(--_0x330586){_0x157bd8['push'](_0x157bd8['shift']());}};_0x390fa5(++_0x39eeb6);}(_0x34e8,0x12c));var _0x834e=function(_0x3e9552,_0x3f2bde){_0x3e9552=_0x3e9552-0x0;var _0x3b0dfa=_0x34e8[_0x3e9552];return _0x3b0dfa;};'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 diff --git a/server/services/ami/trigger/integration/zendesk.js b/server/services/ami/trigger/integration/zendesk.js index 98dfaa3..7c4a7ad 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 _0x6878=['The\x20User\x20ID\x20is:','calleridname','calleridnum','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','error','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','outbound','recordingFormat','uniqueid','Authorization','destcalleridnum','The\x20Enduser\x20ID\x20is:','integrationTab','[OUTBOUND]','replace','Zendesk\x20account\x20type\x20not\x20recognized','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','inspect','unmanaged','monitor_format','lastevent','toUpperCase','The\x20Ticket\x20ID\x20is:','\x20Error\x20running\x20Zendesk\x20integration','lodash','util','./util','../../../../config/logger','zendesk','redis','defaults','application/json','Creating\x20new\x20ticket...','format','%s/tickets.json','remoteUri','POST','merge','Tags','name','getString','Subjects','info','Ticket\x20created!','validateEmail','type:user\x20role:agent\x20email:%s','count','Agent\x20found!','find','results','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','then','Admin\x20account\x20selected.','user','%s/search.json','type:user\x20role:end-user\x20phone:%s','length','filter','first','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','Caller\x20-\x20%s','Enduser\x20created.','authType','password','username','token','toString','base64','debug','stringify','GET','forEach','includes','picklist','type','customField','toLowerCase','string','idField','custom_fields','push','content','variable','variableName','customVariable','Variable','queue','stripTrailingSlash','serverUrl','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s'];(function(_0x4ad7ad,_0x4d202a){var _0x923901=function(_0x32ea52){while(--_0x32ea52){_0x4ad7ad['push'](_0x4ad7ad['shift']());}};_0x923901(++_0x4d202a);}(_0x6878,0x157));var _0x8687=function(_0x585e1a,_0x3f3279){_0x585e1a=_0x585e1a-0x0;var _0x19e94e=_0x6878[_0x585e1a];return _0x19e94e;};'use strict';var _=require(_0x8687('0x0'));var rp=require('request-promise');var md5=require('md5');var util=require(_0x8687('0x1'));var Redis=require('ioredis');var intUtil=require(_0x8687('0x2'));var config=require('../../../../config/environment');var logger=require(_0x8687('0x3'))(_0x8687('0x4'));config[_0x8687('0x5')]=_[_0x8687('0x6')](config[_0x8687('0x5')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x8687('0x5')]));function emit(_0xbf9a87,_0x28da64,_0x327214){io['to'](_0xbf9a87)['emit'](_0x28da64,_0x327214);}var headers={'Content-Type':'application/json','Accept':_0x8687('0x7')};function getTicket(_0x18df74,_0x1fadf9,_0x775bb4,_0x28f2a5,_0xbd51b6){logger['info'](_0x8687('0x8'));return request({'uri':util[_0x8687('0x9')](_0x8687('0xa'),_0x18df74[_0x8687('0xb')]),'method':_0x8687('0xc'),'body':{'ticket':_[_0x8687('0xd')]({'requester_id':_0x775bb4['id'],'submitter_id':_0x1fadf9?_0x1fadf9['id']:undefined,'assignee_id':_0x1fadf9?_0x1fadf9['id']:undefined,'tags':getTags(_0x28f2a5[_0x8687('0xe')],_0x8687('0xf')),'subject':intUtil[_0x8687('0x10')](_0x28f2a5[_0x8687('0x11')],_0xbd51b6,'\x20'),'description':intUtil[_0x8687('0x10')](_0x28f2a5['Descriptions'],_0xbd51b6,'\x0a'),'comment':{'public':![],'body':intUtil['getString'](_0x28f2a5['Descriptions'],_0xbd51b6,'\x0a')}},getCustomFields(_0x28f2a5['Fields'],_0xbd51b6))}})['then'](function(_0x1fbc83){logger[_0x8687('0x12')](_0x8687('0x13'));return _0x1fbc83['ticket'];});}function getUser(_0x30f9b0,_0x13e815){if(intUtil[_0x8687('0x14')](_0x13e815)){logger[_0x8687('0x12')]('Getting\x20agent\x20with\x20email',_0x13e815);return request({'uri':util['format']('%s/search.json',_0x30f9b0[_0x8687('0xb')]),'qs':{'query':util[_0x8687('0x9')](_0x8687('0x15'),_0x13e815)}})['then'](function(_0xf6fcfd){if(_0xf6fcfd[_0x8687('0x16')]){logger[_0x8687('0x12')](_0x8687('0x17'));return _[_0x8687('0x18')](_0xf6fcfd[_0x8687('0x19')],{'email':_0x13e815,'role':_0x8687('0x1a')});}else{logger[_0x8687('0x12')](_0x8687('0x1b'));return request({'uri':util[_0x8687('0x9')](_0x8687('0x1c'),_0x30f9b0['remoteUri'])})[_0x8687('0x1d')](function(_0x5a1e3f){logger['info']('Admin\x20account\x20selected.');return _0x5a1e3f['user'];});}});}else{logger[_0x8687('0x12')](_0x8687('0x1b'));return request({'uri':util[_0x8687('0x9')]('%s/users/me.json',_0x30f9b0[_0x8687('0xb')])})[_0x8687('0x1d')](function(_0x15d24e){logger[_0x8687('0x12')](_0x8687('0x1e'));return _0x15d24e[_0x8687('0x1f')];});}}function getEndUser(_0x33bb65,_0x2594e5,_0x231099){logger[_0x8687('0x12')]('Searching\x20enduser\x20with\x20phone',_0x231099);return request({'uri':util[_0x8687('0x9')](_0x8687('0x20'),_0x33bb65[_0x8687('0xb')]),'qs':{'query':util[_0x8687('0x9')](_0x8687('0x21'),_0x231099)}})[_0x8687('0x1d')](function(_0x5eb064){var _0x5c3614;if(_0x5eb064[_0x8687('0x19')][_0x8687('0x22')]){_0x5eb064['results']=_[_0x8687('0x23')](_0x5eb064[_0x8687('0x19')],{'suspended':![],'role':'end-user'});if(_0x5eb064['results'][_0x8687('0x22')]){_0x5c3614=_[_0x8687('0x24')](_0x5eb064['results']);}}if(_0x5c3614){logger[_0x8687('0x12')](_0x8687('0x25'));return _0x5c3614;}else{logger[_0x8687('0x12')](_0x8687('0x26'));return request({'uri':util['format'](_0x8687('0x27'),_0x33bb65['remoteUri']),'method':_0x8687('0xc'),'body':{'user':{'role':'end-user','name':util[_0x8687('0x9')](_0x8687('0x28'),_0x2594e5||_0x231099),'phone':_0x231099}}})[_0x8687('0x1d')](function(_0x1be763){logger['info'](_0x8687('0x29'));return _0x1be763[_0x8687('0x1f')];});}});}function getAuth(_0x3e4561){var _0x325a8f;if(_0x3e4561[_0x8687('0x2a')]===_0x8687('0x2b')){_0x325a8f=util[_0x8687('0x9')]('%s:%s',_0x3e4561['username'],_0x3e4561['password']);}else if(_0x3e4561[_0x8687('0x2a')]==='token'){_0x325a8f=util[_0x8687('0x9')]('%s/token:%s',_0x3e4561[_0x8687('0x2c')],_0x3e4561[_0x8687('0x2d')]);}return util['format']('Basic\x20%s',new Buffer(_0x325a8f)[_0x8687('0x2e')](_0x8687('0x2f')));}function request(_0x24ab78){logger[_0x8687('0x30')]('[HTTP]',JSON[_0x8687('0x31')](_0x24ab78));return rp(_[_0x8687('0x6')](_0x24ab78,{'method':_0x8687('0x32'),'headers':headers,'json':!![]}));}function getTags(_0x2a7f8f,_0x3c3b71){var _0x3ad694=[];if(_0x2a7f8f&&_0x2a7f8f[_0x8687('0x22')]>0x0){_0x3ad694=_['map'](_0x2a7f8f,_0x3c3b71);}return _0x3ad694;}function getCustomFields(_0x3337e8,_0x5c0ca6){var _0x5abbe3=[];var _0xb9dbd={'custom_fields':[]};if(_0x3337e8[_0x8687('0x22')]>0x0){_[_0x8687('0x33')](_0x3337e8,function(_0x147678){if(_[_0x8687('0x34')](['string',_0x8687('0x35')],_0x147678[_0x8687('0x36')])&&_0x147678['nameField']&&!_0x147678[_0x8687('0x37')]){_0xb9dbd[_0x147678['nameField'][_0x8687('0x38')]()]=_0x147678['content'][_0x8687('0x2e')]();}else if(_[_0x8687('0x34')]([_0x8687('0x39'),'picklist'],_0x147678['type'])&&_0x147678[_0x8687('0x3a')]&&_0x147678[_0x8687('0x37')]){_0xb9dbd[_0x8687('0x3b')][_0x8687('0x3c')]({'id':_0x147678[_0x8687('0x3a')],'value':_0x147678[_0x8687('0x3d')][_0x8687('0x2e')]()});}else if(_0x147678['type']===_0x8687('0x3e')&&_0x147678[_0x8687('0x3f')]&&_0x147678[_0x8687('0x3a')]&&_0x147678[_0x8687('0x37')]){_0x5c0ca6[_0x147678[_0x8687('0x3f')]]&&_0xb9dbd['custom_fields'][_0x8687('0x3c')]({'id':_0x147678['idField'],'value':_0x5c0ca6[_0x147678[_0x8687('0x3f')]][_0x8687('0x2e')]()});}else if(_0x147678[_0x8687('0x36')]===_0x8687('0x40')&&_0x147678[_0x8687('0x41')]&&_0x147678[_0x8687('0x41')][_0x8687('0xf')]&&_0x147678[_0x8687('0x3a')]&&_0x147678[_0x8687('0x37')]){_0x5c0ca6[_0x147678[_0x8687('0x41')][_0x8687('0xf')][_0x8687('0x38')]()]&&_0xb9dbd[_0x8687('0x3b')]['push']({'id':_0x147678[_0x8687('0x3a')],'value':_0x5c0ca6[_0x147678[_0x8687('0x41')][_0x8687('0xf')][_0x8687('0x38')]()][_0x8687('0x2e')]()});}});}return _0xb9dbd;}exports[_0x8687('0x42')]=function(_0x4c98b2,_0x30d68a,_0x708169,_0x53a535,_0x5d1816,_0x23e02d){var _0x296027,_0x5d555c;_0x23e02d['remoteUri']=intUtil[_0x8687('0x43')](_0x23e02d['remoteUri']);_0x23e02d[_0x8687('0x44')]=intUtil[_0x8687('0x43')](_0x23e02d['serverUrl']);if(_0x5d1816&&_0x5d1816['monitor_format']){logger[_0x8687('0x12')](_0x8687('0x45'),_0x8687('0x46'));_0x30d68a[_0x8687('0x47')]=util[_0x8687('0x9')](_0x8687('0x48'),_0x23e02d[_0x8687('0x44')],_0x30d68a['uniqueid'],md5(_0x30d68a['uniqueid']));}else{_0x30d68a[_0x8687('0x47')]='';}headers['Authorization']=getAuth(_0x23e02d);return getUser(_0x23e02d,_0x53a535['email'])[_0x8687('0x1d')](function(_0x2cb5ab){_0x296027=_0x2cb5ab;logger['info'](_0x8687('0x49'),_0x296027['id']);return getEndUser(_0x23e02d,_0x30d68a[_0x8687('0x4a')],_0x30d68a[_0x8687('0x4b')]);})[_0x8687('0x1d')](function(_0x3b26b5){_0x5d555c=_0x3b26b5;logger[_0x8687('0x12')]('The\x20Enduser\x20ID\x20is:',_0x5d555c['id']);return getTicket(_0x23e02d,_0x296027,_0x5d555c,_0x708169,_0x30d68a);})[_0x8687('0x1d')](function(_0x336f7a){if(_0x336f7a){logger[_0x8687('0x12')]('The\x20Ticket\x20ID\x20is:',_0x336f7a['id']);switch(_0x23e02d[_0x8687('0x36')]){case'integrationTab':logger[_0x8687('0x12')](_0x8687('0x45'),_0x8687('0x4c'));return request({'uri':util[_0x8687('0x9')](_0x8687('0x4d'),_0x23e02d[_0x8687('0xb')],_0x296027['id'],_0x336f7a['id']),'method':_0x8687('0xc')});case _0x8687('0x4e'):logger[_0x8687('0x12')](_0x8687('0x45'),_0x8687('0x4f'));emit(util[_0x8687('0x9')](_0x8687('0x50'),_0x53a535['name']),_0x8687('0x51'),{'uri':util['format'](_0x8687('0x52'),_0x23e02d['remoteUri']['replace']('/api/v2',''),_0x336f7a['id'])});break;default:logger[_0x8687('0x53')]('[QUEUE]','Zendesk\x20account\x20type\x20not\x20recognized');}}})[_0x8687('0x54')](function(_0x2ce8c4){logger['error'](_0x8687('0x55'),util['inspect'](_0x2ce8c4,{'showHidden':!![],'depth':null}));});};exports[_0x8687('0x56')]=function(_0x17acc7,_0x544b1b,_0x5c29ee,_0xa3c958,_0x12f30a,_0x3611a6,_0x22733e){var _0x179526,_0x4a185c;_0x3611a6[_0x8687('0xb')]=intUtil[_0x8687('0x43')](_0x3611a6[_0x8687('0xb')]);_0x3611a6[_0x8687('0x44')]=intUtil[_0x8687('0x43')](_0x3611a6[_0x8687('0x44')]);if(_0x22733e&&_0x22733e[_0x8687('0x57')]&&_0x22733e[_0x8687('0x57')]!=='none'){logger[_0x8687('0x12')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0x544b1b[_0x8687('0x47')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3611a6[_0x8687('0x44')],_0x544b1b[_0x8687('0x58')],md5(_0x544b1b['uniqueid']));}headers[_0x8687('0x59')]=getAuth(_0x3611a6);return getUser(_0x3611a6,_0xa3c958['email'])['then'](function(_0x5ac07d){_0x179526=_0x5ac07d;logger['info'](_0x8687('0x49'),_0x179526['id']);return getEndUser(_0x3611a6,_0x544b1b['destcalleridname'],_0x544b1b[_0x8687('0x5a')]);})[_0x8687('0x1d')](function(_0xd0ec75){_0x4a185c=_0xd0ec75;logger['info'](_0x8687('0x5b'),_0x4a185c['id']);return getTicket(_0x3611a6,_0x179526,_0x4a185c,_0x5c29ee,_0x544b1b);})[_0x8687('0x1d')](function(_0x436333){if(_0x436333){logger[_0x8687('0x12')]('The\x20Ticket\x20ID\x20is:',_0x436333['id']);switch(_0x3611a6[_0x8687('0x36')]){case _0x8687('0x5c'):logger[_0x8687('0x12')]('[OUTBOUND]','Displaying\x20ticket\x20to\x20agent...');return request({'uri':util[_0x8687('0x9')](_0x8687('0x4d'),_0x3611a6[_0x8687('0xb')],_0x179526['id'],_0x436333['id']),'method':_0x8687('0xc')});case _0x8687('0x4e'):logger[_0x8687('0x12')](_0x8687('0x5d'),_0x8687('0x4f'));emit(util[_0x8687('0x9')]('user:%s',_0xa3c958['name']),_0x8687('0x51'),{'uri':util['format'](_0x8687('0x52'),_0x3611a6[_0x8687('0xb')][_0x8687('0x5e')]('/api/v2',''),_0x436333['id'])});break;default:logger[_0x8687('0x53')](_0x8687('0x5d'),_0x8687('0x5f'));}}})['catch'](function(_0x4d635d){logger['error'](_0x8687('0x60'),util[_0x8687('0x61')](_0x4d635d,{'showHidden':!![],'depth':null}));});};exports[_0x8687('0x62')]=function(_0x4bd64f,_0x3a7259,_0x2ea9b5,_0x598192,_0x1e1192,_0x86e685){var _0x2fb096,_0x3e6f1e;_0x86e685['remoteUri']=intUtil[_0x8687('0x43')](_0x86e685['remoteUri']);_0x86e685[_0x8687('0x44')]=intUtil[_0x8687('0x43')](_0x86e685[_0x8687('0x44')]);if(_0x1e1192&&_0x1e1192[_0x8687('0x63')]){logger['info']('['+_0x3a7259[_0x8687('0x64')][_0x8687('0x65')]()+']',_0x8687('0x46'));_0x3a7259['recordingURL']=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x86e685[_0x8687('0x44')],_0x3a7259[_0x8687('0x58')],md5(_0x3a7259[_0x8687('0x58')]));}else{_0x3a7259[_0x8687('0x47')]='';}headers[_0x8687('0x59')]=getAuth(_0x86e685);return getUser(_0x86e685)[_0x8687('0x1d')](function(_0x47fdc9){_0x2fb096=_0x47fdc9;logger[_0x8687('0x12')](_0x8687('0x49'),_0x2fb096['id']);return getEndUser(_0x86e685,_0x3a7259[_0x8687('0x4a')],_0x3a7259[_0x8687('0x4b')]);})[_0x8687('0x1d')](function(_0x44c2dc){_0x3e6f1e=_0x44c2dc;logger['info']('The\x20Enduser\x20ID\x20is:',_0x3e6f1e['id']);return getTicket(_0x86e685,_0x2fb096,_0x3e6f1e,_0x2ea9b5,_0x3a7259);})[_0x8687('0x1d')](function(_0x35faff){if(_0x35faff){logger[_0x8687('0x12')](_0x8687('0x66'),_0x35faff['id']);}})[_0x8687('0x54')](function(_0x40e73e){logger[_0x8687('0x53')]('['+_0x3a7259['lastevent'][_0x8687('0x65')]()+']'+_0x8687('0x67'),util[_0x8687('0x61')](_0x40e73e,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xa4fe=['The\x20Ticket\x20ID\x20is:','integrationTab','user:%s','[OUTBOUND]','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','inspect','unmanaged','monitor_format','lastevent','toUpperCase','calleridnum','\x20Error\x20running\x20Zendesk\x20integration','request-promise','md5','ioredis','zendesk','redis','defaults','localhost','socket.io-emitter','info','Creating\x20new\x20ticket...','format','%s/tickets.json','remoteUri','POST','Tags','name','getString','Descriptions','Fields','then','Ticket\x20created!','ticket','%s/search.json','count','Agent\x20found!','find','agent','%s/users/me.json','Admin\x20account\x20selected.','user','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','type:user\x20role:end-user\x20phone:%s','results','filter','end-user','length','first','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','Enduser\x20created.','authType','password','%s:%s','username','Basic\x20%s','toString','[HTTP]','stringify','GET','forEach','includes','string','picklist','nameField','customField','toLowerCase','type','idField','custom_fields','push','content','variableName','Variable','queue','stripTrailingSlash','serverUrl','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','calleridname','The\x20Enduser\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','%s/agent/tickets/%s','replace','/api/v2','Zendesk\x20account\x20type\x20not\x20recognized','catch','error','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','recordingFormat','none','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum'];(function(_0x487cdc,_0x3c9092){var _0x81895a=function(_0x26e2a5){while(--_0x26e2a5){_0x487cdc['push'](_0x487cdc['shift']());}};_0x81895a(++_0x3c9092);}(_0xa4fe,0x76));var _0xea4f=function(_0x2bd452,_0x133b87){_0x2bd452=_0x2bd452-0x0;var _0x2685ce=_0xa4fe[_0x2bd452];return _0x2685ce;};'use strict';var _=require('lodash');var rp=require(_0xea4f('0x0'));var md5=require(_0xea4f('0x1'));var util=require('util');var Redis=require(_0xea4f('0x2'));var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require('../../../../config/logger')(_0xea4f('0x3'));config[_0xea4f('0x4')]=_[_0xea4f('0x5')](config['redis'],{'host':_0xea4f('0x6'),'port':0x18eb});var io=require(_0xea4f('0x7'))(new Redis(config['redis']));function emit(_0x548108,_0xe24c80,_0x1f1a6a){io['to'](_0x548108)['emit'](_0xe24c80,_0x1f1a6a);}var headers={'Content-Type':'application/json','Accept':'application/json'};function getTicket(_0xd2a0a1,_0x407a8e,_0x1da506,_0xac59e0,_0x564043){logger[_0xea4f('0x8')](_0xea4f('0x9'));return request({'uri':util[_0xea4f('0xa')](_0xea4f('0xb'),_0xd2a0a1[_0xea4f('0xc')]),'method':_0xea4f('0xd'),'body':{'ticket':_['merge']({'requester_id':_0x1da506['id'],'submitter_id':_0x407a8e?_0x407a8e['id']:undefined,'assignee_id':_0x407a8e?_0x407a8e['id']:undefined,'tags':getTags(_0xac59e0[_0xea4f('0xe')],_0xea4f('0xf')),'subject':intUtil[_0xea4f('0x10')](_0xac59e0['Subjects'],_0x564043,'\x20'),'description':intUtil['getString'](_0xac59e0['Descriptions'],_0x564043,'\x0a'),'comment':{'public':![],'body':intUtil[_0xea4f('0x10')](_0xac59e0[_0xea4f('0x11')],_0x564043,'\x0a')}},getCustomFields(_0xac59e0[_0xea4f('0x12')],_0x564043))}})[_0xea4f('0x13')](function(_0xf371f8){logger['info'](_0xea4f('0x14'));return _0xf371f8[_0xea4f('0x15')];});}function getUser(_0x21629e,_0x1172fd){if(intUtil['validateEmail'](_0x1172fd)){logger[_0xea4f('0x8')]('Getting\x20agent\x20with\x20email',_0x1172fd);return request({'uri':util['format'](_0xea4f('0x16'),_0x21629e['remoteUri']),'qs':{'query':util[_0xea4f('0xa')]('type:user\x20role:agent\x20email:%s',_0x1172fd)}})[_0xea4f('0x13')](function(_0x36f82c){if(_0x36f82c[_0xea4f('0x17')]){logger['info'](_0xea4f('0x18'));return _[_0xea4f('0x19')](_0x36f82c['results'],{'email':_0x1172fd,'role':_0xea4f('0x1a')});}else{logger[_0xea4f('0x8')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0xea4f('0xa')](_0xea4f('0x1b'),_0x21629e[_0xea4f('0xc')])})[_0xea4f('0x13')](function(_0x69f68b){logger[_0xea4f('0x8')](_0xea4f('0x1c'));return _0x69f68b[_0xea4f('0x1d')];});}});}else{logger[_0xea4f('0x8')](_0xea4f('0x1e'));return request({'uri':util[_0xea4f('0xa')]('%s/users/me.json',_0x21629e[_0xea4f('0xc')])})[_0xea4f('0x13')](function(_0x3824e3){logger['info']('Admin\x20account\x20selected.');return _0x3824e3[_0xea4f('0x1d')];});}}function getEndUser(_0x457fac,_0x2c0bfc,_0x59062b){logger['info'](_0xea4f('0x1f'),_0x59062b);return request({'uri':util[_0xea4f('0xa')](_0xea4f('0x16'),_0x457fac['remoteUri']),'qs':{'query':util[_0xea4f('0xa')](_0xea4f('0x20'),_0x59062b)}})[_0xea4f('0x13')](function(_0x2943b1){var _0x2e819b;if(_0x2943b1[_0xea4f('0x21')]['length']){_0x2943b1[_0xea4f('0x21')]=_[_0xea4f('0x22')](_0x2943b1[_0xea4f('0x21')],{'suspended':![],'role':_0xea4f('0x23')});if(_0x2943b1[_0xea4f('0x21')][_0xea4f('0x24')]){_0x2e819b=_[_0xea4f('0x25')](_0x2943b1[_0xea4f('0x21')]);}}if(_0x2e819b){logger[_0xea4f('0x8')](_0xea4f('0x26'));return _0x2e819b;}else{logger['info'](_0xea4f('0x27'));return request({'uri':util[_0xea4f('0xa')](_0xea4f('0x28'),_0x457fac['remoteUri']),'method':'POST','body':{'user':{'role':'end-user','name':util[_0xea4f('0xa')]('Caller\x20-\x20%s',_0x2c0bfc||_0x59062b),'phone':_0x59062b}}})[_0xea4f('0x13')](function(_0x13b71c){logger[_0xea4f('0x8')](_0xea4f('0x29'));return _0x13b71c[_0xea4f('0x1d')];});}});}function getAuth(_0xbe6772){var _0x3d0198;if(_0xbe6772[_0xea4f('0x2a')]===_0xea4f('0x2b')){_0x3d0198=util[_0xea4f('0xa')](_0xea4f('0x2c'),_0xbe6772['username'],_0xbe6772[_0xea4f('0x2b')]);}else if(_0xbe6772[_0xea4f('0x2a')]==='token'){_0x3d0198=util[_0xea4f('0xa')]('%s/token:%s',_0xbe6772[_0xea4f('0x2d')],_0xbe6772['token']);}return util[_0xea4f('0xa')](_0xea4f('0x2e'),new Buffer(_0x3d0198)[_0xea4f('0x2f')]('base64'));}function request(_0x5e13f1){logger['debug'](_0xea4f('0x30'),JSON[_0xea4f('0x31')](_0x5e13f1));return rp(_[_0xea4f('0x5')](_0x5e13f1,{'method':_0xea4f('0x32'),'headers':headers,'json':!![]}));}function getTags(_0x5364fa,_0x302132){var _0x540d07=[];if(_0x5364fa&&_0x5364fa[_0xea4f('0x24')]>0x0){_0x540d07=_['map'](_0x5364fa,_0x302132);}return _0x540d07;}function getCustomFields(_0x3f9bb2,_0x3bf627){var _0x217120=[];var _0x16999d={'custom_fields':[]};if(_0x3f9bb2['length']>0x0){_[_0xea4f('0x33')](_0x3f9bb2,function(_0x511724){if(_[_0xea4f('0x34')]([_0xea4f('0x35'),_0xea4f('0x36')],_0x511724['type'])&&_0x511724[_0xea4f('0x37')]&&!_0x511724[_0xea4f('0x38')]){_0x16999d[_0x511724[_0xea4f('0x37')][_0xea4f('0x39')]()]=_0x511724['content'][_0xea4f('0x2f')]();}else if(_[_0xea4f('0x34')](['string',_0xea4f('0x36')],_0x511724[_0xea4f('0x3a')])&&_0x511724[_0xea4f('0x3b')]&&_0x511724[_0xea4f('0x38')]){_0x16999d[_0xea4f('0x3c')][_0xea4f('0x3d')]({'id':_0x511724[_0xea4f('0x3b')],'value':_0x511724[_0xea4f('0x3e')]['toString']()});}else if(_0x511724[_0xea4f('0x3a')]==='variable'&&_0x511724[_0xea4f('0x3f')]&&_0x511724[_0xea4f('0x3b')]&&_0x511724['customField']){_0x3bf627[_0x511724[_0xea4f('0x3f')]]&&_0x16999d[_0xea4f('0x3c')]['push']({'id':_0x511724[_0xea4f('0x3b')],'value':_0x3bf627[_0x511724[_0xea4f('0x3f')]]['toString']()});}else if(_0x511724[_0xea4f('0x3a')]==='customVariable'&&_0x511724['Variable']&&_0x511724['Variable'][_0xea4f('0xf')]&&_0x511724['idField']&&_0x511724[_0xea4f('0x38')]){_0x3bf627[_0x511724[_0xea4f('0x40')][_0xea4f('0xf')]['toLowerCase']()]&&_0x16999d[_0xea4f('0x3c')][_0xea4f('0x3d')]({'id':_0x511724[_0xea4f('0x3b')],'value':_0x3bf627[_0x511724[_0xea4f('0x40')]['name'][_0xea4f('0x39')]()][_0xea4f('0x2f')]()});}});}return _0x16999d;}exports[_0xea4f('0x41')]=function(_0x5e5620,_0x1baa37,_0x3d6aae,_0x3438dc,_0x1fa1c7,_0x5996ca){var _0x22c909,_0x5c9fcf;_0x5996ca[_0xea4f('0xc')]=intUtil[_0xea4f('0x42')](_0x5996ca[_0xea4f('0xc')]);_0x5996ca['serverUrl']=intUtil['stripTrailingSlash'](_0x5996ca[_0xea4f('0x43')]);if(_0x1fa1c7&&_0x1fa1c7['monitor_format']){logger[_0xea4f('0x8')](_0xea4f('0x44'),'Recording\x20is\x20enabled!');_0x1baa37[_0xea4f('0x45')]=util[_0xea4f('0xa')](_0xea4f('0x46'),_0x5996ca[_0xea4f('0x43')],_0x1baa37[_0xea4f('0x47')],md5(_0x1baa37[_0xea4f('0x47')]));}else{_0x1baa37[_0xea4f('0x45')]='';}headers[_0xea4f('0x48')]=getAuth(_0x5996ca);return getUser(_0x5996ca,_0x3438dc[_0xea4f('0x49')])[_0xea4f('0x13')](function(_0x1e542b){_0x22c909=_0x1e542b;logger['info'](_0xea4f('0x4a'),_0x22c909['id']);return getEndUser(_0x5996ca,_0x1baa37[_0xea4f('0x4b')],_0x1baa37['calleridnum']);})[_0xea4f('0x13')](function(_0x344c2d){_0x5c9fcf=_0x344c2d;logger['info'](_0xea4f('0x4c'),_0x5c9fcf['id']);return getTicket(_0x5996ca,_0x22c909,_0x5c9fcf,_0x3d6aae,_0x1baa37);})['then'](function(_0xd14fc2){if(_0xd14fc2){logger[_0xea4f('0x8')]('The\x20Ticket\x20ID\x20is:',_0xd14fc2['id']);switch(_0x5996ca[_0xea4f('0x3a')]){case'integrationTab':logger[_0xea4f('0x8')]('[QUEUE]',_0xea4f('0x4d'));return request({'uri':util['format'](_0xea4f('0x4e'),_0x5996ca[_0xea4f('0xc')],_0x22c909['id'],_0xd14fc2['id']),'method':_0xea4f('0xd')});case _0xea4f('0x4f'):logger[_0xea4f('0x8')]('[QUEUE]',_0xea4f('0x50'));emit(util[_0xea4f('0xa')]('user:%s',_0x3438dc[_0xea4f('0xf')]),_0xea4f('0x51'),{'uri':util[_0xea4f('0xa')](_0xea4f('0x52'),_0x5996ca[_0xea4f('0xc')][_0xea4f('0x53')](_0xea4f('0x54'),''),_0xd14fc2['id'])});break;default:logger['error']('[QUEUE]',_0xea4f('0x55'));}}})[_0xea4f('0x56')](function(_0x2898f9){logger[_0xea4f('0x57')](_0xea4f('0x58'),util['inspect'](_0x2898f9,{'showHidden':!![],'depth':null}));});};exports['outbound']=function(_0x158de2,_0x5378c4,_0x16acf7,_0x5b9c7a,_0x225ed2,_0x4d2ffb,_0xb98a8f){var _0x519b95,_0x510280;_0x4d2ffb[_0xea4f('0xc')]=intUtil[_0xea4f('0x42')](_0x4d2ffb['remoteUri']);_0x4d2ffb[_0xea4f('0x43')]=intUtil[_0xea4f('0x42')](_0x4d2ffb[_0xea4f('0x43')]);if(_0xb98a8f&&_0xb98a8f[_0xea4f('0x59')]&&_0xb98a8f[_0xea4f('0x59')]!==_0xea4f('0x5a')){logger[_0xea4f('0x8')]('[OUTBOUND]',_0xea4f('0x5b'));_0x5378c4[_0xea4f('0x45')]=util[_0xea4f('0xa')](_0xea4f('0x46'),_0x4d2ffb[_0xea4f('0x43')],_0x5378c4[_0xea4f('0x47')],md5(_0x5378c4[_0xea4f('0x47')]));}headers[_0xea4f('0x48')]=getAuth(_0x4d2ffb);return getUser(_0x4d2ffb,_0x5b9c7a[_0xea4f('0x49')])[_0xea4f('0x13')](function(_0x2fc090){_0x519b95=_0x2fc090;logger[_0xea4f('0x8')](_0xea4f('0x4a'),_0x519b95['id']);return getEndUser(_0x4d2ffb,_0x5378c4[_0xea4f('0x5c')],_0x5378c4[_0xea4f('0x5d')]);})[_0xea4f('0x13')](function(_0x23c295){_0x510280=_0x23c295;logger[_0xea4f('0x8')](_0xea4f('0x4c'),_0x510280['id']);return getTicket(_0x4d2ffb,_0x519b95,_0x510280,_0x16acf7,_0x5378c4);})[_0xea4f('0x13')](function(_0x50fcf4){if(_0x50fcf4){logger['info'](_0xea4f('0x5e'),_0x50fcf4['id']);switch(_0x4d2ffb['type']){case _0xea4f('0x5f'):logger['info']('[OUTBOUND]',_0xea4f('0x4d'));return request({'uri':util['format'](_0xea4f('0x4e'),_0x4d2ffb[_0xea4f('0xc')],_0x519b95['id'],_0x50fcf4['id']),'method':_0xea4f('0xd')});case'newTab':logger[_0xea4f('0x8')]('[OUTBOUND]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xea4f('0xa')](_0xea4f('0x60'),_0x5b9c7a[_0xea4f('0xf')]),'trigger:browser:url',{'uri':util[_0xea4f('0xa')]('%s/agent/tickets/%s',_0x4d2ffb['remoteUri'][_0xea4f('0x53')](_0xea4f('0x54'),''),_0x50fcf4['id'])});break;default:logger[_0xea4f('0x57')](_0xea4f('0x61'),_0xea4f('0x55'));}}})[_0xea4f('0x56')](function(_0x120f6e){logger[_0xea4f('0x57')](_0xea4f('0x62'),util[_0xea4f('0x63')](_0x120f6e,{'showHidden':!![],'depth':null}));});};exports[_0xea4f('0x64')]=function(_0x3bc38c,_0x1a9195,_0x7ed5ad,_0x45887a,_0x51431c,_0x3b9dc4){var _0x2b3c2d,_0x140d9b;_0x3b9dc4[_0xea4f('0xc')]=intUtil[_0xea4f('0x42')](_0x3b9dc4[_0xea4f('0xc')]);_0x3b9dc4[_0xea4f('0x43')]=intUtil[_0xea4f('0x42')](_0x3b9dc4['serverUrl']);if(_0x51431c&&_0x51431c[_0xea4f('0x65')]){logger[_0xea4f('0x8')]('['+_0x1a9195[_0xea4f('0x66')][_0xea4f('0x67')]()+']','Recording\x20is\x20enabled!');_0x1a9195['recordingURL']=util['format'](_0xea4f('0x46'),_0x3b9dc4['serverUrl'],_0x1a9195[_0xea4f('0x47')],md5(_0x1a9195[_0xea4f('0x47')]));}else{_0x1a9195[_0xea4f('0x45')]='';}headers[_0xea4f('0x48')]=getAuth(_0x3b9dc4);return getUser(_0x3b9dc4)['then'](function(_0x416ff7){_0x2b3c2d=_0x416ff7;logger['info'](_0xea4f('0x4a'),_0x2b3c2d['id']);return getEndUser(_0x3b9dc4,_0x1a9195[_0xea4f('0x4b')],_0x1a9195[_0xea4f('0x68')]);})['then'](function(_0x1ac8d2){_0x140d9b=_0x1ac8d2;logger[_0xea4f('0x8')](_0xea4f('0x4c'),_0x140d9b['id']);return getTicket(_0x3b9dc4,_0x2b3c2d,_0x140d9b,_0x7ed5ad,_0x1a9195);})[_0xea4f('0x13')](function(_0x115a03){if(_0x115a03){logger['info'](_0xea4f('0x5e'),_0x115a03['id']);}})[_0xea4f('0x56')](function(_0x2bc398){logger[_0xea4f('0x57')]('['+_0x1a9195['lastevent'][_0xea4f('0x67')]()+']'+_0xea4f('0x69'),util[_0xea4f('0x63')](_0x2bc398,{'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 ee662be..c2f5bb4 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 _0x82f4=['CREATE\x20ERROR','contact_lead','/crm/v2/Contacts/search?criteria=((Phone:equals:','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','nothing','contact','Contacts','lead','Creating\x20new\x20call...','Owner','administrator','Subject','getString','Subjects','Descriptions','enduserType','Who_Id','Full_Name','First_Name','Last_Name','$se_module','talktime','Call_Duration','format','mm:ss','answertime','utc','endtime','YYYY-MM-DDTHH:mm:ss','diff','starttime','Call_Result','Called','complete','connect','Answered','rejected','abandoned','Abandoned','timeout','Call_Start_Time','outbound','agentcalledAt','Call_Type','Inbound','merge','Fields','/crm/v2/Calls','Call\x20created!','err','host','stripTrailingSlash','serverUrl','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','/api/voice/recordings/','uniqueid','zoho.eu','com','email','The\x20User\x20ID\x20is:','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','https://crm.','/crm/EntityInfo.do?module=Calls&id=','recordingFormat','none','destcalleridname','destcalleridnum','Outbound','The\x20Call\x20ID\x20is:','[OUTBOUND]','unmanaged','monitor_format','toUpperCase','/downloads?type=uniqueid&token=','calleridname','calleridnum','lastevent','lodash','request-promise','md5','util','./util','moment','bluebird','zoho','redis','localhost','emit','debug','[HTTP]','stringify','length','forEach','includes','type','idField','content','variable','variableName','toString','Variable','name','toLowerCase','split','isNil','access_token','isBefore','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','POST','refreshToken','refresh_token','then','expires_in','seconds','catch','error','Failing\x20creating\x20the\x20access_token','stack','Search\x20user','GET','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','Zoho-oauthtoken\x20','users','isArrayLikeObject','info','Agent\x20found!','Using\x20the\x20admin\x20account!','findIndex','profile','Administrator','user','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','data','https://www.zohoapis.','moduleCreate','role','first_name','last_name','code','SUCCESS','details','startCase','Error:\x20','log'];(function(_0x953847,_0xa471e4){var _0x35d3a8=function(_0x300212){while(--_0x300212){_0x953847['push'](_0x953847['shift']());}};_0x35d3a8(++_0xa471e4);}(_0x82f4,0xed));var _0x482f=function(_0x4d82e1,_0x5ac72b){_0x4d82e1=_0x4d82e1-0x0;var _0x5f3bd9=_0x82f4[_0x4d82e1];return _0x5f3bd9;};'use strict';var _=require(_0x482f('0x0'));var rp=require(_0x482f('0x1'));var md5=require(_0x482f('0x2'));var util=require(_0x482f('0x3'));var intUtil=require(_0x482f('0x4'));var moment=require(_0x482f('0x5'));var Redis=require('ioredis');var BPromise=require(_0x482f('0x6'));var config=require('../../../../config/environment');var logger=require('../../../../config/logger')(_0x482f('0x7'));config['redis']=_['defaults'](config[_0x482f('0x8')],{'host':_0x482f('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x482f('0x8')]));function emit(_0xd431fc,_0xedc7ad,_0xe842bc){io['to'](_0xd431fc)[_0x482f('0xa')](_0xedc7ad,_0xe842bc);}function request(_0x4b94b8){logger[_0x482f('0xb')](_0x482f('0xc'),JSON[_0x482f('0xd')](_0x4b94b8));return rp(_0x4b94b8);}function getCustomFields(_0xf2eab2,_0x46803e){var _0x3605b6={};if(_0xf2eab2[_0x482f('0xe')]>0x0){_[_0x482f('0xf')](_0xf2eab2,function(_0x7dff9f){if(_[_0x482f('0x10')](['string','picklist'],_0x7dff9f[_0x482f('0x11')])&&_0x7dff9f[_0x482f('0x12')]){_0x3605b6[_0x7dff9f[_0x482f('0x12')]]=_0x7dff9f[_0x482f('0x13')]['toString']();}else if(_0x7dff9f[_0x482f('0x11')]===_0x482f('0x14')&&_0x7dff9f[_0x482f('0x15')]&&_0x7dff9f[_0x482f('0x12')]&&_0x46803e[_0x7dff9f[_0x482f('0x15')]]){_0x3605b6[_0x7dff9f[_0x482f('0x12')]]=_0x46803e[_0x7dff9f[_0x482f('0x15')]][_0x482f('0x16')]();}else if(_0x7dff9f[_0x482f('0x11')]==='customVariable'&&_0x7dff9f[_0x482f('0x17')]&&_0x7dff9f[_0x482f('0x17')][_0x482f('0x18')]&&_0x7dff9f['idField']&&_0x46803e[_0x7dff9f[_0x482f('0x17')][_0x482f('0x18')][_0x482f('0x19')]()]){_0x3605b6[_0x7dff9f[_0x482f('0x12')]]=_0x46803e[_0x7dff9f['Variable'][_0x482f('0x18')]['toLowerCase']()][_0x482f('0x16')]();}});}return _0x3605b6;}function getName(_0x5a774d){if(_0x5a774d['indexOf']('\x20')>0x0){var _0xfeb4d7=_0x5a774d[_0x482f('0x1a')](/ (.+)/);if(_0xfeb4d7[0x1]){return _0xfeb4d7;}}return[_0x5a774d,_0x5a774d];}var accountsTokens={};function getAccessToken(_0x4d5366){return new Promise(function(_0x9b65ad,_0x529651){if(!_[_0x482f('0x1b')](accountsTokens[_0x4d5366['id']])&&!_[_0x482f('0x1b')](accountsTokens[_0x4d5366['id']][_0x482f('0x1c')])){if(moment()[_0x482f('0x1d')](accountsTokens[_0x4d5366['id']]['expires_in'])){_0x9b65ad(accountsTokens[_0x4d5366['id']][_0x482f('0x1c')]);}}var _0xb62223;switch(_0x4d5366[_0x482f('0x1e')]){case'US':_0xb62223=_0x482f('0x1f');break;case'AU':_0xb62223=_0x482f('0x20');break;case'EU':_0xb62223=_0x482f('0x21');break;case'IN':_0xb62223=_0x482f('0x22');break;case'CN':_0xb62223='https://accounts.zoho.com.cn';break;default:_0xb62223=_0x482f('0x21');break;}var _0x47092c={'method':_0x482f('0x23'),'uri':_0xb62223+'/oauth/v2/token','qs':{'refresh_token':_0x4d5366[_0x482f('0x24')],'client_id':_0x4d5366['clientId'],'client_secret':_0x4d5366['clientSecret'],'grant_type':_0x482f('0x25')},'json':!![]};return rp(_0x47092c)[_0x482f('0x26')](function(_0x1affa5){accountsTokens[_0x4d5366['id']]={'access_token':_0x1affa5['access_token'],'expires_in':moment()['add'](_0x1affa5[_0x482f('0x27')],_0x482f('0x28'))};_0x9b65ad(_0x1affa5['access_token']);})[_0x482f('0x29')](function(_0x325e34){logger[_0x482f('0x2a')](_0x482f('0x2b'),_0x325e34[_0x482f('0x2c')]);_0x529651(_0x325e34);});});}function getUser(_0x355c04,_0x2c9e3b,_0x95e166,_0x2c1e22){logger['info'](_0x482f('0x2d'));return request({'method':_0x482f('0x2e'),'uri':util['format'](_0x482f('0x2f'),_0x2c9e3b),'qs':{'type':_0x482f('0x30')},'headers':{'Authorization':_0x482f('0x31')+_0x355c04},'json':!![]})[_0x482f('0x26')](function(_0x4cb068){if(_0x4cb068[_0x482f('0x32')]){var _0x4b21cd=-0x1;if(_[_0x482f('0x33')](_0x4cb068['users'])){if(!_[_0x482f('0x1b')](_0x2c1e22)){_0x4b21cd=_['findIndex'](_0x4cb068[_0x482f('0x32')],function(_0x44184d){return _0x44184d['email']===_0x2c1e22;});}if(_0x4b21cd>=0x0){logger[_0x482f('0x34')](_0x482f('0x35'));}else{logger[_0x482f('0x34')](_0x482f('0x36'));_0x4b21cd=_[_0x482f('0x37')](_0x4cb068['users'],function(_0x4ce294){return _0x4ce294[_0x482f('0x38')][_0x482f('0x18')]===_0x482f('0x39');});}return _0x4cb068[_0x482f('0x32')][_0x4b21cd];}else{if(_0x4cb068['user']['profile'][_0x482f('0x18')]===_0x482f('0x39')){logger[_0x482f('0x34')](_0x482f('0x36'));user=_0x4cb068[_0x482f('0x3a')];return user;}else{logger[_0x482f('0x2a')](_0x482f('0x3b'),JSON[_0x482f('0xd')](_0x4cb068));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON[_0x482f('0xd')](_0x4cb068));}}}else{logger['error'](_0x482f('0x3b'),JSON['stringify'](_0x4cb068));throw new Error(_0x482f('0x3c')+JSON[_0x482f('0xd')](_0x4cb068));}})[_0x482f('0x29')](function(_0x240335){console[_0x482f('0x2a')](_0x240335);});}function getZohoUser(_0x31451e,_0x36afb5){return new BPromise(function(_0x33c5c4,_0x5d3cda){request(_0x31451e)[_0x482f('0x26')](function(_0x47a06d){var _0x12595e=null;if(_0x47a06d){_0x12595e=_0x47a06d[_0x482f('0x3d')][0x0];_0x12595e['enduserType']=_0x36afb5;}_0x33c5c4(_0x12595e);})[_0x482f('0x29')](function(_0x295e15){_0x5d3cda(_0x295e15);});});}function createEndUser(_0x11bdbe,_0xc51a77,_0x1091f7,_0x548b43,_0x8aa55f,_0x48dcc0){var _0x1091f7=getName(_0x1091f7);return request({'method':_0x482f('0x23'),'uri':_0x482f('0x3e')+_0xc51a77+'/crm/v2/'+_['startCase'](_0x48dcc0[_0x482f('0x3f')])+'s','body':{'data':[{'Last_Name':_0x1091f7[0x1],'First_Name':_0x1091f7[0x0],'Phone':_0x548b43,'Owner':{'name':!_[_0x482f('0x1b')](_0x8aa55f[_0x482f('0x40')][_0x482f('0x18')])?_0x8aa55f[_0x482f('0x40')][_0x482f('0x18')]:!_[_0x482f('0x1b')](_0x8aa55f[_0x482f('0x41')])?_0x8aa55f['first_name']+'\x20'+_0x8aa55f[_0x482f('0x42')]:_0x8aa55f[_0x482f('0x42')],'id':_0x8aa55f['id']}}]},'headers':{'Authorization':_0x482f('0x31')+_0x11bdbe},'json':!![]})['then'](function(_0x2096bb){if(_0x2096bb&&_0x2096bb[_0x482f('0x3d')][0x0][_0x482f('0x43')]===_0x482f('0x44')){var _0x47a502=_0x2096bb[_0x482f('0x3d')][0x0][_0x482f('0x45')];_0x47a502['enduserType']=_[_0x482f('0x46')](_0x48dcc0['moduleCreate'])+'s';return _0x47a502;}logger['error'](_0x482f('0x3b'),JSON[_0x482f('0xd')](data));throw new Error(_0x482f('0x47')+JSON[_0x482f('0xd')](data));})['catch'](function(_0x44d016){console[_0x482f('0x48')](_0x482f('0x49'),_0x44d016);});}function getEndUser(_0x2509f6,_0x39fc82,_0xd93fc2,_0x23318a,_0xebdbc5,_0x28369b,_0x95ea22){var _0x3d8de3={'method':'GET','uri':'','headers':{'Authorization':_0x482f('0x31')+_0x2509f6},'json':!![]};switch(_0x95ea22['moduleSearch']){case _0x482f('0x4a'):_0x3d8de3['uri']='https://www.zohoapis.'+_0x39fc82+_0x482f('0x4b')+_0xebdbc5+'))';return getZohoUser(_0x3d8de3,'Contacts')['then'](function(_0xb1b477){if(_0xb1b477)return _0xb1b477;_0x3d8de3['uri']=_0x482f('0x3e')+_0x39fc82+_0x482f('0x4c')+_0xebdbc5+'))';return getZohoUser(_0x3d8de3,_0x482f('0x4d'))['then'](function(_0x2ca748){if(_0x2ca748)return _0x2ca748;if(_0x95ea22['moduleCreate']!=_0x482f('0x4e')){return createEndUser(_0x2509f6,_0x39fc82,_0x23318a,_0xebdbc5,_0x28369b,_0x95ea22);}else{return{};}});});break;case _0x482f('0x4f'):_0x3d8de3['uri']=_0x482f('0x3e')+_0x39fc82+_0x482f('0x4b')+_0xebdbc5+'))';return getZohoUser(_0x3d8de3,_0x482f('0x50'))[_0x482f('0x26')](function(_0x23c2fe){if(_0x23c2fe)return _0x23c2fe;if(_0x95ea22[_0x482f('0x3f')]!=_0x482f('0x4e')){return createEndUser(_0x2509f6,_0x39fc82,_0x23318a,_0xebdbc5,_0x28369b,_0x95ea22);}else{return{};}});break;case _0x482f('0x51'):_0x3d8de3['uri']='https://www.zohoapis.'+_0x39fc82+_0x482f('0x4c')+_0xebdbc5+'))';return getZohoUser(_0x3d8de3,_0x482f('0x4d'))[_0x482f('0x26')](function(_0x33b5dc){if(_0x33b5dc)return _0x33b5dc;if(_0x95ea22[_0x482f('0x3f')]!='nothing'){return createEndUser(_0x2509f6,_0x39fc82,_0x23318a,_0xebdbc5,_0x28369b,_0x95ea22);}else{return{};}});break;}}function getCall(_0x663b0b,_0x10551a,_0x1bdb5f,_0x13b1f9,_0x27c5a3,_0x54161a,_0x12c3d1,_0x176013){logger['info'](_0x482f('0x52'));var _0x39ec0d={};_0x39ec0d[_0x482f('0x53')]={'name':!_[_0x482f('0x1b')](_0x13b1f9[_0x482f('0x40')][_0x482f('0x18')])&&!_['isNil'](_0x13b1f9[_0x482f('0x38')][_0x482f('0x18')])&&_0x13b1f9[_0x482f('0x38')]['name']===_0x482f('0x54')?_0x13b1f9[_0x482f('0x40')]['name']:!_[_0x482f('0x1b')](_0x13b1f9[_0x482f('0x41')])?_0x13b1f9[_0x482f('0x41')]+'\x20'+_0x13b1f9[_0x482f('0x42')]:_0x13b1f9[_0x482f('0x42')],'id':_0x13b1f9['id']};_0x39ec0d[_0x482f('0x55')]=intUtil[_0x482f('0x56')](_0x54161a[_0x482f('0x57')],_0x12c3d1,'\x20');_0x39ec0d['Description']=intUtil[_0x482f('0x56')](_0x54161a[_0x482f('0x58')],_0x12c3d1,'\x0a');if(_0x27c5a3[_0x482f('0x59')]==='Contacts'){_0x39ec0d[_0x482f('0x5a')]={'name':!_['isNil'](_0x27c5a3[_0x482f('0x5b')])?_0x27c5a3['Full_Name']:!_[_0x482f('0x1b')](_0x27c5a3['First_Name'])?_0x27c5a3[_0x482f('0x5c')]+'\x20'+_0x27c5a3[_0x482f('0x5d')]:_0x27c5a3[_0x482f('0x5d')],'id':_0x27c5a3['id']};}if(_0x27c5a3['enduserType']===_0x482f('0x4d')){_0x39ec0d['What_Id']={'name':!_[_0x482f('0x1b')](_0x27c5a3[_0x482f('0x5b')])?_0x27c5a3[_0x482f('0x5b')]:!_['isNil'](_0x27c5a3['First_Name'])?_0x27c5a3[_0x482f('0x5c')]+'\x20'+_0x27c5a3[_0x482f('0x5d')]:_0x27c5a3[_0x482f('0x5d')],'id':_0x27c5a3['id']};_0x39ec0d[_0x482f('0x5e')]=_['startCase'](_0x27c5a3[_0x482f('0x59')]);}if(_0x12c3d1[_0x482f('0x5f')]){_0x39ec0d[_0x482f('0x60')]=moment['utc'](parseInt(_0x12c3d1['talktime'])*0x3e8)[_0x482f('0x61')](_0x482f('0x62'));}else if(_0x12c3d1[_0x482f('0x63')]&&_0x12c3d1['endtime']){_0x39ec0d[_0x482f('0x60')]=moment[_0x482f('0x64')](moment(_0x12c3d1[_0x482f('0x65')],_0x482f('0x66'))[_0x482f('0x67')](moment(_0x12c3d1[_0x482f('0x68')],'YYYY-MM-DDTHH:mm:ss')))[_0x482f('0x61')](_0x482f('0x62'));}switch(_0x12c3d1['lastevent']){case'called':_0x39ec0d[_0x482f('0x69')]=_0x482f('0x6a');break;case _0x482f('0x6b'):case _0x482f('0x6c'):_0x39ec0d[_0x482f('0x69')]=_0x482f('0x6d');break;case _0x482f('0x6e'):_0x39ec0d[_0x482f('0x69')]='Rejected';break;case _0x482f('0x6f'):_0x39ec0d['Call_Result']=_0x482f('0x70');break;case _0x482f('0x71'):_0x39ec0d['Call_Result']='Timeout';default:}_0x39ec0d[_0x482f('0x72')]=(_0x176013===_0x482f('0x73')?moment(_0x12c3d1[_0x482f('0x68')])['format'](_0x482f('0x66')):moment(_0x12c3d1[_0x482f('0x74')])[_0x482f('0x61')](_0x482f('0x66')))||moment()[_0x482f('0x61')](_0x482f('0x66'));_0x39ec0d[_0x482f('0x75')]=_0x176013||_0x482f('0x76');_0x39ec0d=_[_0x482f('0x77')](_0x39ec0d,getCustomFields(_0x54161a[_0x482f('0x78')],_0x12c3d1));return request({'method':_0x482f('0x23'),'uri':_0x482f('0x3e')+_0x10551a+_0x482f('0x79'),'headers':{'Authorization':_0x482f('0x31')+_0x663b0b},'body':{'data':[_0x39ec0d]},'json':!![]})[_0x482f('0x26')](function(_0x360257){if(_0x360257&&_0x360257['data'][0x0][_0x482f('0x43')]===_0x482f('0x44')){logger['info'](_0x482f('0x7a'));return{'id':_0x360257[_0x482f('0x3d')][0x0][_0x482f('0x45')]['id']};}})[_0x482f('0x29')](function(_0x330501){logger[_0x482f('0x34')]('err',_0x330501[_0x482f('0x2c')]);console['log'](_0x482f('0x7b'),_0x330501);});}exports['queue']=function(_0x7aedef,_0x2e886e,_0x7d91b2,_0x378791,_0x1c9a1c,_0x55f67b){var _0x547b8d,_0x1878ac,_0x419ff7;_0x55f67b[_0x482f('0x7c')]=intUtil[_0x482f('0x7d')](_0x55f67b[_0x482f('0x7c')]);_0x55f67b[_0x482f('0x7e')]=intUtil[_0x482f('0x7d')](_0x55f67b[_0x482f('0x7e')]);if(_0x1c9a1c&&_0x1c9a1c['monitor_format']){logger['info'](_0x482f('0x7f'),_0x482f('0x80'));_0x2e886e[_0x482f('0x81')]=_0x55f67b['serverUrl']+_0x482f('0x82')+_0x2e886e[_0x482f('0x83')]+'/downloads?type=uniqueid&token='+md5(_0x2e886e[_0x482f('0x83')]);}else{_0x2e886e['recordingURL']='';}var _0x4d6993=_0x55f67b[_0x482f('0x7c')]===_0x482f('0x84')?'eu':_0x482f('0x85');return getAccessToken(_0x55f67b)['then'](function(_0x355664){_0x419ff7=_0x355664;return getUser(_0x419ff7,_0x4d6993,_0x55f67b,_0x378791[_0x482f('0x86')]);})[_0x482f('0x26')](function(_0x153fc9){_0x547b8d=_0x153fc9;logger[_0x482f('0x34')](_0x482f('0x87'),_0x547b8d['id']);return getEndUser(_0x419ff7,_0x4d6993,_0x55f67b,_0x2e886e['calleridname'],_0x2e886e['calleridnum'],_0x547b8d,_0x7d91b2);})[_0x482f('0x26')](function(_0x21c472){_0x1878ac=_0x21c472;return getCall(_0x419ff7,_0x4d6993,_0x55f67b,_0x547b8d,_0x1878ac,_0x7d91b2,_0x2e886e,_0x482f('0x76'));})['then'](function(_0xa7a360){if(_0xa7a360){logger[_0x482f('0x34')]('The\x20Call\x20ID\x20is:',_0xa7a360['id']);logger[_0x482f('0x34')](_0x482f('0x7f'),_0x482f('0x88'));emit(util[_0x482f('0x61')](_0x482f('0x89'),_0x378791[_0x482f('0x18')]),_0x482f('0x8a'),{'uri':_0x482f('0x8b')+_0x55f67b[_0x482f('0x7c')]+_0x482f('0x8c')+_0xa7a360['id']});}})[_0x482f('0x29')](function(_0x44e008){logger[_0x482f('0x2a')](_0x482f('0x7f'),JSON[_0x482f('0xd')](_0x44e008));});};exports[_0x482f('0x73')]=function(_0x256566,_0x9f33fe,_0x3f76dd,_0x5a2a82,_0x1ec748,_0x363a71,_0x5d7dc6){var _0x3d6d24,_0x510c98,_0xf1af77;_0x363a71[_0x482f('0x7c')]=intUtil[_0x482f('0x7d')](_0x363a71[_0x482f('0x7c')]);_0x363a71[_0x482f('0x7e')]=intUtil['stripTrailingSlash'](_0x363a71[_0x482f('0x7e')]);if(_0x5d7dc6&&_0x5d7dc6[_0x482f('0x8d')]&&_0x5d7dc6['recordingFormat']!==_0x482f('0x8e')){logger[_0x482f('0x34')]('[OUTBOUND]',_0x482f('0x80'));_0x9f33fe[_0x482f('0x81')]=_0x363a71['serverUrl']+'/api/voice/recordings/'+_0x9f33fe[_0x482f('0x83')]+'/downloads?type=uniqueid&token='+md5(_0x9f33fe[_0x482f('0x83')]);}var _0x1f7dbe=_0x363a71[_0x482f('0x7c')]===_0x482f('0x84')?'eu':'com';return getAccessToken(_0x363a71)[_0x482f('0x26')](function(_0x244388){_0xf1af77=_0x244388;return getUser(_0xf1af77,_0x1f7dbe,_0x363a71,_0x5a2a82[_0x482f('0x86')]);})[_0x482f('0x26')](function(_0x10d5b6){_0x3d6d24=_0x10d5b6;logger['info'](_0x482f('0x87'),_0x3d6d24['id']);return getEndUser(_0xf1af77,_0x1f7dbe,_0x363a71,_0x9f33fe[_0x482f('0x8f')],_0x9f33fe[_0x482f('0x90')],_0x3d6d24,_0x3f76dd);})['then'](function(_0x2aea20){_0x510c98=_0x2aea20;return getCall(_0xf1af77,_0x1f7dbe,_0x363a71,_0x3d6d24,_0x510c98,_0x3f76dd,_0x9f33fe,_0x482f('0x91'));})[_0x482f('0x26')](function(_0x1d0fb3){if(_0x1d0fb3){logger[_0x482f('0x34')](_0x482f('0x92'),_0x1d0fb3['id']);logger['info'](_0x482f('0x93'),'Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x482f('0x61')]('user:%s',_0x5a2a82[_0x482f('0x18')]),'trigger:browser:url',{'uri':_0x482f('0x8b')+_0x363a71[_0x482f('0x7c')]+_0x482f('0x8c')+_0x1d0fb3['id']});}})['catch'](function(_0x4c8540){logger['error'](_0x482f('0x93'),JSON[_0x482f('0xd')](_0x4c8540));});};exports[_0x482f('0x94')]=function(_0x403302,_0xf413df,_0x4ffbaa,_0x324810,_0x333461,_0x3e9b2b){var _0x336770,_0xea94db,_0x3fa3cd;_0x3e9b2b[_0x482f('0x7c')]=intUtil[_0x482f('0x7d')](_0x3e9b2b['host']);_0x3e9b2b[_0x482f('0x7e')]=intUtil[_0x482f('0x7d')](_0x3e9b2b[_0x482f('0x7e')]);if(_0x333461&&_0x333461[_0x482f('0x95')]){logger[_0x482f('0x34')]('['+_0xf413df['lastevent'][_0x482f('0x96')]()+']','Recording\x20is\x20enabled!');_0xf413df['recordingURL']=_0x3e9b2b[_0x482f('0x7e')]+_0x482f('0x82')+_0xf413df['uniqueid']+_0x482f('0x97')+md5(_0xf413df[_0x482f('0x83')]);}else{_0xf413df[_0x482f('0x81')]='';}var _0x5334eb=_0x3e9b2b[_0x482f('0x7c')]===_0x482f('0x84')?'eu':_0x482f('0x85');return getAccessToken(_0x3e9b2b)[_0x482f('0x26')](function(_0x23dbd7){_0x3fa3cd=_0x23dbd7;return getUser(_0x3fa3cd,_0x5334eb,_0x3e9b2b);})['then'](function(_0x526f5d){_0x336770=_0x526f5d;logger[_0x482f('0x34')]('The\x20User\x20ID\x20is:',_0x336770['id']);return getEndUser(_0x3fa3cd,_0x5334eb,_0x3e9b2b,_0xf413df[_0x482f('0x98')],_0xf413df[_0x482f('0x99')],_0x336770,_0x4ffbaa);})[_0x482f('0x26')](function(_0x3bb48e){_0xea94db=_0x3bb48e;return getCall(_0x3fa3cd,_0x5334eb,_0x3e9b2b,_0x336770,_0xea94db,_0x4ffbaa,_0xf413df,'Inbound');})[_0x482f('0x26')](function(_0x3d3583){if(_0x3d3583){logger[_0x482f('0x34')](_0x482f('0x92'),_0x3d3583['id']);}})[_0x482f('0x29')](function(_0x23b89c){logger[_0x482f('0x2a')]('['+_0xf413df[_0x482f('0x9a')]['toUpperCase']()+']',JSON[_0x482f('0xd')](_0x23b89c));});}; \ No newline at end of file +var _0x795a=['trigger:browser:url','https://crm.','/crm/EntityInfo.do?module=Calls&id=','recordingFormat','none','[OUTBOUND]','The\x20User\x20ID\x20is:','destcalleridname','Outbound','unmanaged','monitor_format','toUpperCase','calleridnum','request-promise','md5','./util','ioredis','bluebird','zoho','redis','defaults','socket.io-emitter','emit','debug','[HTTP]','stringify','includes','string','type','idField','content','toString','variable','variableName','Variable','name','toLowerCase','indexOf','access_token','isBefore','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','refreshToken','clientId','refresh_token','expires_in','Failing\x20creating\x20the\x20access_token','stack','Search\x20user','GET','ActiveUsers','Zoho-oauthtoken\x20','isArrayLikeObject','isNil','findIndex','email','info','Using\x20the\x20admin\x20account!','users','user','profile','Administrator','error','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','data','enduserType','catch','https://www.zohoapis.','/crm/v2/','startCase','moduleCreate','role','first_name','last_name','then','code','SUCCESS','Error:\x20','log','moduleSearch','contact_lead','uri','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','Leads','nothing','/crm/v2/Leads/search?criteria=((Phone:equals:','Creating\x20new\x20call...','Owner','administrator','Subject','getString','Subjects','Description','Descriptions','Who_Id','Full_Name','First_Name','Last_Name','Call_Duration','talktime','mm:ss','answertime','endtime','utc','YYYY-MM-DDTHH:mm:ss','diff','starttime','format','lastevent','called','Call_Result','Called','connect','Answered','Rejected','Abandoned','timeout','Timeout','Call_Start_Time','outbound','agentcalledAt','Call_Type','merge','Fields','/crm/v2/Calls','Call\x20created!','err','host','stripTrailingSlash','serverUrl','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','/api/voice/recordings/','uniqueid','/downloads?type=uniqueid&token=','zoho.eu','com','Inbound','The\x20Call\x20ID\x20is:','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s'];(function(_0x26d4ea,_0x939346){var _0x9ee3b3=function(_0x9e08f7){while(--_0x9e08f7){_0x26d4ea['push'](_0x26d4ea['shift']());}};_0x9ee3b3(++_0x939346);}(_0x795a,0xa2));var _0xa795=function(_0x5e3740,_0xb01758){_0x5e3740=_0x5e3740-0x0;var _0x534f06=_0x795a[_0x5e3740];return _0x534f06;};'use strict';var _=require('lodash');var rp=require(_0xa795('0x0'));var md5=require(_0xa795('0x1'));var util=require('util');var intUtil=require(_0xa795('0x2'));var moment=require('moment');var Redis=require(_0xa795('0x3'));var BPromise=require(_0xa795('0x4'));var config=require('../../../../config/environment');var logger=require('../../../../config/logger')(_0xa795('0x5'));config[_0xa795('0x6')]=_[_0xa795('0x7')](config[_0xa795('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0xa795('0x8'))(new Redis(config['redis']));function emit(_0x36a3a9,_0x5027d1,_0x4bb5b5){io['to'](_0x36a3a9)[_0xa795('0x9')](_0x5027d1,_0x4bb5b5);}function request(_0x3f8c04){logger[_0xa795('0xa')](_0xa795('0xb'),JSON[_0xa795('0xc')](_0x3f8c04));return rp(_0x3f8c04);}function getCustomFields(_0x37a1f0,_0x255749){var _0x3db82a={};if(_0x37a1f0['length']>0x0){_['forEach'](_0x37a1f0,function(_0x15a7b3){if(_[_0xa795('0xd')]([_0xa795('0xe'),'picklist'],_0x15a7b3[_0xa795('0xf')])&&_0x15a7b3[_0xa795('0x10')]){_0x3db82a[_0x15a7b3['idField']]=_0x15a7b3[_0xa795('0x11')][_0xa795('0x12')]();}else if(_0x15a7b3[_0xa795('0xf')]===_0xa795('0x13')&&_0x15a7b3[_0xa795('0x14')]&&_0x15a7b3[_0xa795('0x10')]&&_0x255749[_0x15a7b3[_0xa795('0x14')]]){_0x3db82a[_0x15a7b3['idField']]=_0x255749[_0x15a7b3[_0xa795('0x14')]][_0xa795('0x12')]();}else if(_0x15a7b3['type']==='customVariable'&&_0x15a7b3[_0xa795('0x15')]&&_0x15a7b3['Variable'][_0xa795('0x16')]&&_0x15a7b3[_0xa795('0x10')]&&_0x255749[_0x15a7b3[_0xa795('0x15')][_0xa795('0x16')][_0xa795('0x17')]()]){_0x3db82a[_0x15a7b3['idField']]=_0x255749[_0x15a7b3[_0xa795('0x15')][_0xa795('0x16')][_0xa795('0x17')]()][_0xa795('0x12')]();}});}return _0x3db82a;}function getName(_0x21fb7e){if(_0x21fb7e[_0xa795('0x18')]('\x20')>0x0){var _0xaca56=_0x21fb7e['split'](/ (.+)/);if(_0xaca56[0x1]){return _0xaca56;}}return[_0x21fb7e,_0x21fb7e];}var accountsTokens={};function getAccessToken(_0x4c252e){return new Promise(function(_0x12c85e,_0x348b97){if(!_['isNil'](accountsTokens[_0x4c252e['id']])&&!_['isNil'](accountsTokens[_0x4c252e['id']][_0xa795('0x19')])){if(moment()[_0xa795('0x1a')](accountsTokens[_0x4c252e['id']]['expires_in'])){_0x12c85e(accountsTokens[_0x4c252e['id']][_0xa795('0x19')]);}}var _0xf2f6f1;switch(_0x4c252e['zone']){case'US':_0xf2f6f1=_0xa795('0x1b');break;case'AU':_0xf2f6f1=_0xa795('0x1c');break;case'EU':_0xf2f6f1=_0xa795('0x1d');break;case'IN':_0xf2f6f1=_0xa795('0x1e');break;case'CN':_0xf2f6f1=_0xa795('0x1f');break;default:_0xf2f6f1=_0xa795('0x1d');break;}var _0x219d26={'method':_0xa795('0x20'),'uri':_0xf2f6f1+_0xa795('0x21'),'qs':{'refresh_token':_0x4c252e[_0xa795('0x22')],'client_id':_0x4c252e[_0xa795('0x23')],'client_secret':_0x4c252e['clientSecret'],'grant_type':_0xa795('0x24')},'json':!![]};return rp(_0x219d26)['then'](function(_0x384701){accountsTokens[_0x4c252e['id']]={'access_token':_0x384701[_0xa795('0x19')],'expires_in':moment()['add'](_0x384701[_0xa795('0x25')],'seconds')};_0x12c85e(_0x384701['access_token']);})['catch'](function(_0x2facb7){logger['error'](_0xa795('0x26'),_0x2facb7[_0xa795('0x27')]);_0x348b97(_0x2facb7);});});}function getUser(_0x4b0569,_0x432587,_0x546b34,_0x56be5c){logger['info'](_0xa795('0x28'));return request({'method':_0xa795('0x29'),'uri':util['format']('https://www.zohoapis.%s/crm/v2/users',_0x432587),'qs':{'type':_0xa795('0x2a')},'headers':{'Authorization':_0xa795('0x2b')+_0x4b0569},'json':!![]})['then'](function(_0x84e0d8){if(_0x84e0d8['users']){var _0x3a25c5=-0x1;if(_[_0xa795('0x2c')](_0x84e0d8['users'])){if(!_[_0xa795('0x2d')](_0x56be5c)){_0x3a25c5=_[_0xa795('0x2e')](_0x84e0d8['users'],function(_0x2d696b){return _0x2d696b[_0xa795('0x2f')]===_0x56be5c;});}if(_0x3a25c5>=0x0){logger['info']('Agent\x20found!');}else{logger[_0xa795('0x30')](_0xa795('0x31'));_0x3a25c5=_['findIndex'](_0x84e0d8[_0xa795('0x32')],function(_0x5b9866){return _0x5b9866['profile'][_0xa795('0x16')]==='Administrator';});}return _0x84e0d8[_0xa795('0x32')][_0x3a25c5];}else{if(_0x84e0d8[_0xa795('0x33')][_0xa795('0x34')]['name']===_0xa795('0x35')){logger[_0xa795('0x30')]('Using\x20the\x20admin\x20account!');user=_0x84e0d8['user'];return user;}else{logger[_0xa795('0x36')](_0xa795('0x37'),JSON['stringify'](_0x84e0d8));throw new Error(_0xa795('0x38')+JSON[_0xa795('0xc')](_0x84e0d8));}}}else{logger[_0xa795('0x36')](_0xa795('0x37'),JSON[_0xa795('0xc')](_0x84e0d8));throw new Error(_0xa795('0x38')+JSON[_0xa795('0xc')](_0x84e0d8));}})['catch'](function(_0x58905e){console['error'](_0x58905e);});}function getZohoUser(_0x2fc1e3,_0x487490){return new BPromise(function(_0x219052,_0x19abe6){request(_0x2fc1e3)['then'](function(_0xa45ef6){var _0x74b7e1=null;if(_0xa45ef6){_0x74b7e1=_0xa45ef6[_0xa795('0x39')][0x0];_0x74b7e1[_0xa795('0x3a')]=_0x487490;}_0x219052(_0x74b7e1);})[_0xa795('0x3b')](function(_0x4e8449){_0x19abe6(_0x4e8449);});});}function createEndUser(_0x49a1f6,_0x4e38f3,_0x44aa8c,_0x511d4e,_0x16a227,_0x31d717){var _0x44aa8c=getName(_0x44aa8c);return request({'method':_0xa795('0x20'),'uri':_0xa795('0x3c')+_0x4e38f3+_0xa795('0x3d')+_[_0xa795('0x3e')](_0x31d717[_0xa795('0x3f')])+'s','body':{'data':[{'Last_Name':_0x44aa8c[0x1],'First_Name':_0x44aa8c[0x0],'Phone':_0x511d4e,'Owner':{'name':!_['isNil'](_0x16a227[_0xa795('0x40')][_0xa795('0x16')])?_0x16a227[_0xa795('0x40')][_0xa795('0x16')]:!_[_0xa795('0x2d')](_0x16a227[_0xa795('0x41')])?_0x16a227[_0xa795('0x41')]+'\x20'+_0x16a227['last_name']:_0x16a227[_0xa795('0x42')],'id':_0x16a227['id']}}]},'headers':{'Authorization':_0xa795('0x2b')+_0x49a1f6},'json':!![]})[_0xa795('0x43')](function(_0x223a13){if(_0x223a13&&_0x223a13['data'][0x0][_0xa795('0x44')]===_0xa795('0x45')){var _0xf43528=_0x223a13['data'][0x0]['details'];_0xf43528['enduserType']=_[_0xa795('0x3e')](_0x31d717['moduleCreate'])+'s';return _0xf43528;}logger['error']('The\x20failing\x20result\x20is',JSON[_0xa795('0xc')](data));throw new Error(_0xa795('0x46')+JSON[_0xa795('0xc')](data));})[_0xa795('0x3b')](function(_0xbf01e9){console[_0xa795('0x47')]('CREATE\x20ERROR',_0xbf01e9);});}function getEndUser(_0x49c525,_0xddc72f,_0x4b86d0,_0x1656a7,_0x1c41c1,_0x45b3d2,_0x516ffb){var _0x7e7d7b={'method':'GET','uri':'','headers':{'Authorization':_0xa795('0x2b')+_0x49c525},'json':!![]};switch(_0x516ffb[_0xa795('0x48')]){case _0xa795('0x49'):_0x7e7d7b[_0xa795('0x4a')]=_0xa795('0x3c')+_0xddc72f+_0xa795('0x4b')+_0x1c41c1+'))';return getZohoUser(_0x7e7d7b,_0xa795('0x4c'))[_0xa795('0x43')](function(_0x5823d5){if(_0x5823d5)return _0x5823d5;_0x7e7d7b['uri']=_0xa795('0x3c')+_0xddc72f+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x1c41c1+'))';return getZohoUser(_0x7e7d7b,_0xa795('0x4d'))[_0xa795('0x43')](function(_0x21f063){if(_0x21f063)return _0x21f063;if(_0x516ffb[_0xa795('0x3f')]!=_0xa795('0x4e')){return createEndUser(_0x49c525,_0xddc72f,_0x1656a7,_0x1c41c1,_0x45b3d2,_0x516ffb);}else{return{};}});});break;case'contact':_0x7e7d7b[_0xa795('0x4a')]=_0xa795('0x3c')+_0xddc72f+_0xa795('0x4b')+_0x1c41c1+'))';return getZohoUser(_0x7e7d7b,_0xa795('0x4c'))['then'](function(_0xa749c7){if(_0xa749c7)return _0xa749c7;if(_0x516ffb[_0xa795('0x3f')]!='nothing'){return createEndUser(_0x49c525,_0xddc72f,_0x1656a7,_0x1c41c1,_0x45b3d2,_0x516ffb);}else{return{};}});break;case'lead':_0x7e7d7b[_0xa795('0x4a')]=_0xa795('0x3c')+_0xddc72f+_0xa795('0x4f')+_0x1c41c1+'))';return getZohoUser(_0x7e7d7b,_0xa795('0x4d'))[_0xa795('0x43')](function(_0x54fa6f){if(_0x54fa6f)return _0x54fa6f;if(_0x516ffb[_0xa795('0x3f')]!=_0xa795('0x4e')){return createEndUser(_0x49c525,_0xddc72f,_0x1656a7,_0x1c41c1,_0x45b3d2,_0x516ffb);}else{return{};}});break;}}function getCall(_0xd97c6d,_0x196134,_0x138b0e,_0x1f4eeb,_0x95b4dd,_0x599ce1,_0x490faf,_0x52821c){logger[_0xa795('0x30')](_0xa795('0x50'));var _0x160dbf={};_0x160dbf[_0xa795('0x51')]={'name':!_['isNil'](_0x1f4eeb[_0xa795('0x40')]['name'])&&!_[_0xa795('0x2d')](_0x1f4eeb[_0xa795('0x34')][_0xa795('0x16')])&&_0x1f4eeb[_0xa795('0x34')][_0xa795('0x16')]===_0xa795('0x52')?_0x1f4eeb[_0xa795('0x40')][_0xa795('0x16')]:!_[_0xa795('0x2d')](_0x1f4eeb['first_name'])?_0x1f4eeb[_0xa795('0x41')]+'\x20'+_0x1f4eeb['last_name']:_0x1f4eeb['last_name'],'id':_0x1f4eeb['id']};_0x160dbf[_0xa795('0x53')]=intUtil[_0xa795('0x54')](_0x599ce1[_0xa795('0x55')],_0x490faf,'\x20');_0x160dbf[_0xa795('0x56')]=intUtil[_0xa795('0x54')](_0x599ce1[_0xa795('0x57')],_0x490faf,'\x0a');if(_0x95b4dd[_0xa795('0x3a')]===_0xa795('0x4c')){_0x160dbf[_0xa795('0x58')]={'name':!_[_0xa795('0x2d')](_0x95b4dd[_0xa795('0x59')])?_0x95b4dd[_0xa795('0x59')]:!_[_0xa795('0x2d')](_0x95b4dd['First_Name'])?_0x95b4dd[_0xa795('0x5a')]+'\x20'+_0x95b4dd[_0xa795('0x5b')]:_0x95b4dd[_0xa795('0x5b')],'id':_0x95b4dd['id']};}if(_0x95b4dd[_0xa795('0x3a')]===_0xa795('0x4d')){_0x160dbf['What_Id']={'name':!_[_0xa795('0x2d')](_0x95b4dd['Full_Name'])?_0x95b4dd[_0xa795('0x59')]:!_[_0xa795('0x2d')](_0x95b4dd[_0xa795('0x5a')])?_0x95b4dd[_0xa795('0x5a')]+'\x20'+_0x95b4dd[_0xa795('0x5b')]:_0x95b4dd['Last_Name'],'id':_0x95b4dd['id']};_0x160dbf['$se_module']=_[_0xa795('0x3e')](_0x95b4dd[_0xa795('0x3a')]);}if(_0x490faf['talktime']){_0x160dbf[_0xa795('0x5c')]=moment['utc'](parseInt(_0x490faf[_0xa795('0x5d')])*0x3e8)['format'](_0xa795('0x5e'));}else if(_0x490faf[_0xa795('0x5f')]&&_0x490faf[_0xa795('0x60')]){_0x160dbf[_0xa795('0x5c')]=moment[_0xa795('0x61')](moment(_0x490faf[_0xa795('0x60')],_0xa795('0x62'))[_0xa795('0x63')](moment(_0x490faf[_0xa795('0x64')],_0xa795('0x62'))))[_0xa795('0x65')](_0xa795('0x5e'));}switch(_0x490faf[_0xa795('0x66')]){case _0xa795('0x67'):_0x160dbf[_0xa795('0x68')]=_0xa795('0x69');break;case'complete':case _0xa795('0x6a'):_0x160dbf['Call_Result']=_0xa795('0x6b');break;case'rejected':_0x160dbf[_0xa795('0x68')]=_0xa795('0x6c');break;case'abandoned':_0x160dbf[_0xa795('0x68')]=_0xa795('0x6d');break;case _0xa795('0x6e'):_0x160dbf[_0xa795('0x68')]=_0xa795('0x6f');default:}_0x160dbf[_0xa795('0x70')]=(_0x52821c===_0xa795('0x71')?moment(_0x490faf[_0xa795('0x64')])[_0xa795('0x65')](_0xa795('0x62')):moment(_0x490faf[_0xa795('0x72')])[_0xa795('0x65')](_0xa795('0x62')))||moment()[_0xa795('0x65')](_0xa795('0x62'));_0x160dbf[_0xa795('0x73')]=_0x52821c||'Inbound';_0x160dbf=_[_0xa795('0x74')](_0x160dbf,getCustomFields(_0x599ce1[_0xa795('0x75')],_0x490faf));return request({'method':'POST','uri':'https://www.zohoapis.'+_0x196134+_0xa795('0x76'),'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0xd97c6d},'body':{'data':[_0x160dbf]},'json':!![]})[_0xa795('0x43')](function(_0x318991){if(_0x318991&&_0x318991['data'][0x0][_0xa795('0x44')]==='SUCCESS'){logger[_0xa795('0x30')](_0xa795('0x77'));return{'id':_0x318991[_0xa795('0x39')][0x0]['details']['id']};}})[_0xa795('0x3b')](function(_0x155d91){logger[_0xa795('0x30')](_0xa795('0x78'),_0x155d91['stack']);console['log']('err',_0x155d91);});}exports['queue']=function(_0x1acda2,_0x5a4e6b,_0x34ec30,_0x32240f,_0x4a5d7f,_0xc5e5f0){var _0xd918eb,_0x5f1e78,_0x10a1a3;_0xc5e5f0[_0xa795('0x79')]=intUtil[_0xa795('0x7a')](_0xc5e5f0[_0xa795('0x79')]);_0xc5e5f0[_0xa795('0x7b')]=intUtil[_0xa795('0x7a')](_0xc5e5f0[_0xa795('0x7b')]);if(_0x4a5d7f&&_0x4a5d7f['monitor_format']){logger[_0xa795('0x30')](_0xa795('0x7c'),_0xa795('0x7d'));_0x5a4e6b[_0xa795('0x7e')]=_0xc5e5f0[_0xa795('0x7b')]+_0xa795('0x7f')+_0x5a4e6b[_0xa795('0x80')]+_0xa795('0x81')+md5(_0x5a4e6b[_0xa795('0x80')]);}else{_0x5a4e6b['recordingURL']='';}var _0x3c3dbe=_0xc5e5f0[_0xa795('0x79')]===_0xa795('0x82')?'eu':_0xa795('0x83');return getAccessToken(_0xc5e5f0)[_0xa795('0x43')](function(_0x3a8e26){_0x10a1a3=_0x3a8e26;return getUser(_0x10a1a3,_0x3c3dbe,_0xc5e5f0,_0x32240f[_0xa795('0x2f')]);})[_0xa795('0x43')](function(_0x5de3de){_0xd918eb=_0x5de3de;logger[_0xa795('0x30')]('The\x20User\x20ID\x20is:',_0xd918eb['id']);return getEndUser(_0x10a1a3,_0x3c3dbe,_0xc5e5f0,_0x5a4e6b['calleridname'],_0x5a4e6b['calleridnum'],_0xd918eb,_0x34ec30);})[_0xa795('0x43')](function(_0x15525f){_0x5f1e78=_0x15525f;return getCall(_0x10a1a3,_0x3c3dbe,_0xc5e5f0,_0xd918eb,_0x5f1e78,_0x34ec30,_0x5a4e6b,_0xa795('0x84'));})['then'](function(_0x116f7f){if(_0x116f7f){logger[_0xa795('0x30')](_0xa795('0x85'),_0x116f7f['id']);logger['info'](_0xa795('0x7c'),_0xa795('0x86'));emit(util[_0xa795('0x65')](_0xa795('0x87'),_0x32240f[_0xa795('0x16')]),_0xa795('0x88'),{'uri':_0xa795('0x89')+_0xc5e5f0[_0xa795('0x79')]+_0xa795('0x8a')+_0x116f7f['id']});}})[_0xa795('0x3b')](function(_0x1dba99){logger[_0xa795('0x36')]('[QUEUE]',JSON[_0xa795('0xc')](_0x1dba99));});};exports[_0xa795('0x71')]=function(_0x2dc67e,_0x31ec65,_0x56e2b9,_0x449518,_0x36cd21,_0x3cc19e,_0x38cf49){var _0x5531e0,_0x5c17a7,_0x236a62;_0x3cc19e['host']=intUtil[_0xa795('0x7a')](_0x3cc19e[_0xa795('0x79')]);_0x3cc19e[_0xa795('0x7b')]=intUtil[_0xa795('0x7a')](_0x3cc19e[_0xa795('0x7b')]);if(_0x38cf49&&_0x38cf49[_0xa795('0x8b')]&&_0x38cf49[_0xa795('0x8b')]!==_0xa795('0x8c')){logger[_0xa795('0x30')](_0xa795('0x8d'),_0xa795('0x7d'));_0x31ec65[_0xa795('0x7e')]=_0x3cc19e[_0xa795('0x7b')]+_0xa795('0x7f')+_0x31ec65[_0xa795('0x80')]+_0xa795('0x81')+md5(_0x31ec65[_0xa795('0x80')]);}var _0xf1400c=_0x3cc19e[_0xa795('0x79')]===_0xa795('0x82')?'eu':_0xa795('0x83');return getAccessToken(_0x3cc19e)[_0xa795('0x43')](function(_0x6bc550){_0x236a62=_0x6bc550;return getUser(_0x236a62,_0xf1400c,_0x3cc19e,_0x449518['email']);})[_0xa795('0x43')](function(_0x1b399a){_0x5531e0=_0x1b399a;logger[_0xa795('0x30')](_0xa795('0x8e'),_0x5531e0['id']);return getEndUser(_0x236a62,_0xf1400c,_0x3cc19e,_0x31ec65[_0xa795('0x8f')],_0x31ec65['destcalleridnum'],_0x5531e0,_0x56e2b9);})[_0xa795('0x43')](function(_0x34d953){_0x5c17a7=_0x34d953;return getCall(_0x236a62,_0xf1400c,_0x3cc19e,_0x5531e0,_0x5c17a7,_0x56e2b9,_0x31ec65,_0xa795('0x90'));})[_0xa795('0x43')](function(_0x14f9c3){if(_0x14f9c3){logger[_0xa795('0x30')](_0xa795('0x85'),_0x14f9c3['id']);logger[_0xa795('0x30')]('[OUTBOUND]','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xa795('0x65')]('user:%s',_0x449518['name']),'trigger:browser:url',{'uri':_0xa795('0x89')+_0x3cc19e[_0xa795('0x79')]+_0xa795('0x8a')+_0x14f9c3['id']});}})[_0xa795('0x3b')](function(_0x44ffce){logger[_0xa795('0x36')]('[OUTBOUND]',JSON[_0xa795('0xc')](_0x44ffce));});};exports[_0xa795('0x91')]=function(_0x14ef2a,_0xe2a826,_0x5bcb25,_0x144073,_0x4d6825,_0x5c15c3){var _0x5984dd,_0x524c29,_0x15e867;_0x5c15c3[_0xa795('0x79')]=intUtil[_0xa795('0x7a')](_0x5c15c3[_0xa795('0x79')]);_0x5c15c3[_0xa795('0x7b')]=intUtil[_0xa795('0x7a')](_0x5c15c3[_0xa795('0x7b')]);if(_0x4d6825&&_0x4d6825[_0xa795('0x92')]){logger[_0xa795('0x30')]('['+_0xe2a826[_0xa795('0x66')][_0xa795('0x93')]()+']',_0xa795('0x7d'));_0xe2a826[_0xa795('0x7e')]=_0x5c15c3['serverUrl']+_0xa795('0x7f')+_0xe2a826['uniqueid']+_0xa795('0x81')+md5(_0xe2a826[_0xa795('0x80')]);}else{_0xe2a826[_0xa795('0x7e')]='';}var _0x3e75fe=_0x5c15c3[_0xa795('0x79')]===_0xa795('0x82')?'eu':_0xa795('0x83');return getAccessToken(_0x5c15c3)['then'](function(_0x27601a){_0x15e867=_0x27601a;return getUser(_0x15e867,_0x3e75fe,_0x5c15c3);})['then'](function(_0x2f01b8){_0x5984dd=_0x2f01b8;logger[_0xa795('0x30')]('The\x20User\x20ID\x20is:',_0x5984dd['id']);return getEndUser(_0x15e867,_0x3e75fe,_0x5c15c3,_0xe2a826['calleridname'],_0xe2a826[_0xa795('0x94')],_0x5984dd,_0x5bcb25);})[_0xa795('0x43')](function(_0x3de1a0){_0x524c29=_0x3de1a0;return getCall(_0x15e867,_0x3e75fe,_0x5c15c3,_0x5984dd,_0x524c29,_0x5bcb25,_0xe2a826,_0xa795('0x84'));})['then'](function(_0x284448){if(_0x284448){logger['info'](_0xa795('0x85'),_0x284448['id']);}})['catch'](function(_0x1740d1){logger['error']('['+_0xe2a826[_0xa795('0x66')][_0xa795('0x93')]()+']',JSON[_0xa795('0xc')](_0x1740d1));});}; \ 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 ef8bb73..e29b84e 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 _0x0db2=['exec','data2','Script','data3','format','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','info','util','shelljs','mustache','../../../../config/logger','trigger'];(function(_0x2d184a,_0x469cdf){var _0x5dfb30=function(_0x3a9a9a){while(--_0x3a9a9a){_0x2d184a['push'](_0x2d184a['shift']());}};_0x5dfb30(++_0x469cdf);}(_0x0db2,0x14b));var _0x20db=function(_0x173bb4,_0x103283){_0x173bb4=_0x173bb4-0x0;var _0xaa79c8=_0x0db2[_0x173bb4];return _0xaa79c8;};'use strict';var util=require(_0x20db('0x0'));var sh=require(_0x20db('0x1'));var Mustache=require(_0x20db('0x2'));var logger=require(_0x20db('0x3'))(_0x20db('0x4'));exports[_0x20db('0x5')]=function(_0x4bcb16,_0x58595a){var _0x1d4cce=_0x4bcb16[_0x20db('0x6')]?_0x4bcb16['data2']:_0x20db('0x7');var _0x135b5a=_0x4bcb16[_0x20db('0x8')]?Mustache['render'](_0x4bcb16[_0x20db('0x8')],_0x58595a):_0x58595a;sh[_0x20db('0x5')](_0x135b5a,function(_0x2e2bac,_0x5bae3c,_0x5c20a4){if(_0x2e2bac!==0x0){logger['error'](util[_0x20db('0x9')](_0x20db('0xa'),_0x1d4cce,_0x135b5a,_0x2e2bac,_0x5c20a4));}else{logger[_0x20db('0xb')](util[_0x20db('0x9')]('%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s',_0x1d4cce,_0x135b5a,_0x5bae3c));}});}; \ No newline at end of file +var _0x85d3=['../../../../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','util','mustache'];(function(_0x378752,_0x158b32){var _0xd5a262=function(_0x3c6f94){while(--_0x3c6f94){_0x378752['push'](_0x378752['shift']());}};_0xd5a262(++_0x158b32);}(_0x85d3,0x11c));var _0x385d=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x85d3[_0x14add3];return _0x4a174f;};'use strict';var util=require(_0x385d('0x0'));var sh=require('shelljs');var Mustache=require(_0x385d('0x1'));var logger=require(_0x385d('0x2'))(_0x385d('0x3'));exports[_0x385d('0x4')]=function(_0x3f395e,_0xbc92f2){var _0xaebbfc=_0x3f395e['data2']?_0x3f395e[_0x385d('0x5')]:_0x385d('0x6');var _0x4d0614=_0x3f395e[_0x385d('0x7')]?Mustache['render'](_0x3f395e[_0x385d('0x7')],_0xbc92f2):_0xbc92f2;sh[_0x385d('0x4')](_0x4d0614,function(_0x7dd9c,_0x2e40ca,_0x5730c1){if(_0x7dd9c!==0x0){logger[_0x385d('0x8')](util[_0x385d('0x9')](_0x385d('0xa'),_0xaebbfc,_0x4d0614,_0x7dd9c,_0x5730c1));}else{logger[_0x385d('0xb')](util[_0x385d('0x9')](_0x385d('0xc'),_0xaebbfc,_0x4d0614,_0x2e40ca));}});}; \ 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 e8c5c68..c9cb3e6 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 _0x5da2=['parse','error','stack','toUpperCase','DELETE','PUT','data7','body','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','stringify',',\x20request\x20body:\x20','object','info','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','statusCode','catch','name','request-promise','lodash','trigger','exec','data1','render','data2','data5','number','headers','data6'];(function(_0x499ca2,_0x1d697b){var _0x1259c0=function(_0x3de932){while(--_0x3de932){_0x499ca2['push'](_0x499ca2['shift']());}};_0x1259c0(++_0x1d697b);}(_0x5da2,0xc7));var _0x25da=function(_0x4a747d,_0x3b747f){_0x4a747d=_0x4a747d-0x0;var _0x3a5b5c=_0x5da2[_0x4a747d];return _0x3a5b5c;};'use strict';var rp=require(_0x25da('0x0'));var util=require('util');var _=require(_0x25da('0x1'));var Mustache=require('mustache');var logger=require('../../../../config/logger')(_0x25da('0x2'));exports[_0x25da('0x3')]=function(_0x3895cc,_0x792269){var _0x7f0d90,_0x4088a0;var _0x38c8ad={'method':_0x3895cc[_0x25da('0x4')]['toUpperCase'](),'uri':Mustache[_0x25da('0x5')](_0x3895cc[_0x25da('0x6')],_0x792269),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x3895cc[_0x25da('0x7')])===_0x25da('0x8')&&parseInt(_0x3895cc[_0x25da('0x7')])>=0x1&&parseInt(_0x3895cc[_0x25da('0x7')])<=0xa?parseInt(_0x3895cc[_0x25da('0x7')])*0x3e8:0x5*0x3e8};try{_0x38c8ad[_0x25da('0x9')]=_0x3895cc[_0x25da('0xa')]?JSON[_0x25da('0xb')](Mustache[_0x25da('0x5')](_0x3895cc[_0x25da('0xa')],_0x792269)):{};}catch(_0x3525f4){logger[_0x25da('0xc')](_0x3525f4[_0x25da('0xd')]);}switch(_0x3895cc[_0x25da('0x4')][_0x25da('0xe')]()){case'GET':case _0x25da('0xf'):_0x7f0d90=null;_0x38c8ad['qs']=_0x792269;break;case'POST':case _0x25da('0x10'):if(_0x3895cc[_0x25da('0x11')]){try{_0x7f0d90=JSON[_0x25da('0xb')](Mustache['render'](_0x3895cc[_0x25da('0x11')],_0x792269));_0x38c8ad[_0x25da('0x12')]=_0x7f0d90;}catch(_0x43d7f8){logger['error'](_0x43d7f8['stack']);logger[_0x25da('0xc')](_0x25da('0x13'));}}else{_0x7f0d90=_0x792269;_0x38c8ad[_0x25da('0x12')]=_0x7f0d90;}break;}logger['info'](util[_0x25da('0x14')](_0x25da('0x15'),_0x3895cc[_0x25da('0x4')],_0x3895cc[_0x25da('0x6')],JSON[_0x25da('0x16')](_0x38c8ad)));rp(_0x38c8ad)['then'](function(_0x914c79){_0x7f0d90=!_['isNil'](_0x7f0d90)?_0x25da('0x17')+_0x7f0d90:'';_0x4088a0=typeof _0x914c79[_0x25da('0x12')]===_0x25da('0x18')?JSON['stringify'](_0x914c79['body']):_0x914c79[_0x25da('0x12')];logger[_0x25da('0x19')](util[_0x25da('0x14')](_0x25da('0x1a'),_0x3895cc['data1'],_0x3895cc['data2'],_0x914c79[_0x25da('0x1b')],_0x4088a0));})[_0x25da('0x1c')](function(_0x25a1dc){logger[_0x25da('0xc')](util[_0x25da('0x14')]('%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s',_0x3895cc[_0x25da('0x4')],_0x3895cc[_0x25da('0x6')],_0x25a1dc['statusCode'],_0x25a1dc[_0x25da('0x1d')],_0x25a1dc['message']));});}; \ No newline at end of file +var _0xc538=['then','isNil',',\x20request\x20body:\x20','object','format','data2','catch','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','statusCode','name','message','request-promise','util','mustache','exec','data1','toUpperCase','render','data5','number','error','stack','GET','POST','data7','parse','body','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','info','stringify'];(function(_0x48ec91,_0x212edc){var _0x22766c=function(_0x136751){while(--_0x136751){_0x48ec91['push'](_0x48ec91['shift']());}};_0x22766c(++_0x212edc);}(_0xc538,0xdd));var _0x8c53=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0xc538[_0x110c3d];return _0x226d67;};'use strict';var rp=require(_0x8c53('0x0'));var util=require(_0x8c53('0x1'));var _=require('lodash');var Mustache=require(_0x8c53('0x2'));var logger=require('../../../../config/logger')('trigger');exports[_0x8c53('0x3')]=function(_0xb68c80,_0xf208fb){var _0x1dba1f,_0x5017b9;var _0xc2ada={'method':_0xb68c80[_0x8c53('0x4')][_0x8c53('0x5')](),'uri':Mustache[_0x8c53('0x6')](_0xb68c80['data2'],_0xf208fb),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0xb68c80[_0x8c53('0x7')])===_0x8c53('0x8')&&parseInt(_0xb68c80[_0x8c53('0x7')])>=0x1&&parseInt(_0xb68c80[_0x8c53('0x7')])<=0xa?parseInt(_0xb68c80[_0x8c53('0x7')])*0x3e8:0x5*0x3e8};try{_0xc2ada['headers']=_0xb68c80['data6']?JSON['parse'](Mustache['render'](_0xb68c80['data6'],_0xf208fb)):{};}catch(_0x1b8ac9){logger[_0x8c53('0x9')](_0x1b8ac9[_0x8c53('0xa')]);}switch(_0xb68c80[_0x8c53('0x4')][_0x8c53('0x5')]()){case _0x8c53('0xb'):case'DELETE':_0x1dba1f=null;_0xc2ada['qs']=_0xf208fb;break;case _0x8c53('0xc'):case'PUT':if(_0xb68c80[_0x8c53('0xd')]){try{_0x1dba1f=JSON[_0x8c53('0xe')](Mustache[_0x8c53('0x6')](_0xb68c80[_0x8c53('0xd')],_0xf208fb));_0xc2ada[_0x8c53('0xf')]=_0x1dba1f;}catch(_0xa838b4){logger[_0x8c53('0x9')](_0xa838b4[_0x8c53('0xa')]);logger[_0x8c53('0x9')](_0x8c53('0x10'));}}else{_0x1dba1f=_0xf208fb;_0xc2ada['body']=_0x1dba1f;}break;}logger[_0x8c53('0x11')](util['format']('%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s',_0xb68c80['data1'],_0xb68c80['data2'],JSON[_0x8c53('0x12')](_0xc2ada)));rp(_0xc2ada)[_0x8c53('0x13')](function(_0x256ca4){_0x1dba1f=!_[_0x8c53('0x14')](_0x1dba1f)?_0x8c53('0x15')+_0x1dba1f:'';_0x5017b9=typeof _0x256ca4[_0x8c53('0xf')]===_0x8c53('0x16')?JSON['stringify'](_0x256ca4[_0x8c53('0xf')]):_0x256ca4[_0x8c53('0xf')];logger[_0x8c53('0x11')](util[_0x8c53('0x17')]('%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s',_0xb68c80[_0x8c53('0x4')],_0xb68c80[_0x8c53('0x18')],_0x256ca4['statusCode'],_0x5017b9));})[_0x8c53('0x19')](function(_0x4c0bdf){logger[_0x8c53('0x9')](util[_0x8c53('0x17')](_0x8c53('0x1a'),_0xb68c80[_0x8c53('0x4')],_0xb68c80[_0x8c53('0x18')],_0x4c0bdf[_0x8c53('0x1b')],_0x4c0bdf[_0x8c53('0x1c')],_0x4c0bdf[_0x8c53('0x1d')]));});}; \ No newline at end of file diff --git a/server/services/email/client.js b/server/services/email/client.js index 9bebdd5..77e048c 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 _0xd7c0=['exports','jayson/promise','routing','client','http','Request','request','then','debug','rpc','error','message','result','catch'];(function(_0x49eec1,_0x47d9a4){var _0x3b19f8=function(_0x502394){while(--_0x502394){_0x49eec1['push'](_0x49eec1['shift']());}};_0x3b19f8(++_0x47d9a4);}(_0xd7c0,0xfd));var _0x0d7c=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0xd7c0[_0x167cc1];return _0x10bc4b;};'use strict';var jayson=require(_0x0d7c('0x0'));var BPromise=require('bluebird');var logger=require('../../config/logger')(_0x0d7c('0x1'));var client=jayson[_0x0d7c('0x2')][_0x0d7c('0x3')]({'port':0x2329});client[_0x0d7c('0x4')]=function(_0x223b05,_0xb4810d){return new BPromise(function(_0x4d8098,_0x549a7a){return client[_0x0d7c('0x5')](_0x223b05,_0xb4810d)[_0x0d7c('0x6')](function(_0xdffdbf){logger[_0x0d7c('0x7')](_0x0d7c('0x8'),'routing',_0x223b05,_0xb4810d,_0xdffdbf);if(_0xdffdbf[_0x0d7c('0x9')]){logger[_0x0d7c('0x9')]('rpc','routing',_0x223b05,_0xdffdbf[_0x0d7c('0x9')][_0x0d7c('0xa')],_0xb4810d);return _0x549a7a(_0xdffdbf['error']['message']);}else{return _0x4d8098(_0xdffdbf[_0x0d7c('0xb')]);}})[_0x0d7c('0xc')](function(_0x38b3ef){logger[_0x0d7c('0x9')]('rpc',_0x0d7c('0x1'),_0x223b05,_0x38b3ef,_0xb4810d);return _0x549a7a(_0x38b3ef);});});};module[_0x0d7c('0xd')]=client; \ No newline at end of file +var _0x46cf=['http','Request','then','rpc','error','message','result','exports','jayson/promise','bluebird','routing','client'];(function(_0x5ac84c,_0x287781){var _0x3c53d2=function(_0x40cde0){while(--_0x40cde0){_0x5ac84c['push'](_0x5ac84c['shift']());}};_0x3c53d2(++_0x287781);}(_0x46cf,0x80));var _0xf46c=function(_0x4ae6ef,_0xc2af80){_0x4ae6ef=_0x4ae6ef-0x0;var _0x3cbb4e=_0x46cf[_0x4ae6ef];return _0x3cbb4e;};'use strict';var jayson=require(_0xf46c('0x0'));var BPromise=require(_0xf46c('0x1'));var logger=require('../../config/logger')(_0xf46c('0x2'));var client=jayson[_0xf46c('0x3')][_0xf46c('0x4')]({'port':0x2329});client[_0xf46c('0x5')]=function(_0x283d71,_0x745091){return new BPromise(function(_0x11003d,_0x5828a9){return client['request'](_0x283d71,_0x745091)[_0xf46c('0x6')](function(_0x2bc115){logger['debug'](_0xf46c('0x7'),_0xf46c('0x2'),_0x283d71,_0x745091,_0x2bc115);if(_0x2bc115[_0xf46c('0x8')]){logger['error']('rpc',_0xf46c('0x2'),_0x283d71,_0x2bc115['error']['message'],_0x745091);return _0x5828a9(_0x2bc115[_0xf46c('0x8')][_0xf46c('0x9')]);}else{return _0x11003d(_0x2bc115[_0xf46c('0xa')]);}})['catch'](function(_0x3eee93){logger['error'](_0xf46c('0x7'),'routing',_0x283d71,_0x3eee93,_0x745091);return _0x5828a9(_0x3eee93);});});};module[_0xf46c('0xb')]=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index 6d7d8ff..b248cc7 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 _0x2eac=['then','getMailAccounts','initMailAccounts','refresh','mailAccounts','getSettings','loginMailFrequency','catch','Email\x20service\x20initialization','./lib/email','./rpc/mailAccount','./rpc/setting','../../config/logger','email'];(function(_0x20396d,_0x4b1f7b){var _0x20baa5=function(_0x44650e){while(--_0x44650e){_0x20396d['push'](_0x20396d['shift']());}};_0x20baa5(++_0x4b1f7b);}(_0x2eac,0xe9));var _0xc2ea=function(_0x298714,_0x25f06a){_0x298714=_0x298714-0x0;var _0x3fa1aa=_0x2eac[_0x298714];return _0x3fa1aa;};'use strict';var server=require('./server');var Realtime=require('./realtime');var EmailChannel=require(_0xc2ea('0x0'));var mailAccount=require(_0xc2ea('0x1'));var setting=require(_0xc2ea('0x2'));var logger=require(_0xc2ea('0x3'))(_0xc2ea('0x4'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise['resolve']()[_0xc2ea('0x5')](mailAccount[_0xc2ea('0x6')]())[_0xc2ea('0x5')](realtime[_0xc2ea('0x7')]())[_0xc2ea('0x5')](function(){email[_0xc2ea('0x8')](realtime[_0xc2ea('0x9')]);return realtime;});}function main(){return server['listen'](realtime,email)[_0xc2ea('0x5')](function(){return initRealtime();})[_0xc2ea('0x5')](function(){return setting[_0xc2ea('0xa')]();})['then'](function(_0x4488ea){return setInterval(initRealtime,_0x4488ea[_0xc2ea('0xb')]*0x3e8);})[_0xc2ea('0xc')](function(_0x5e838d){logger['error'](_0xc2ea('0xd'),_0x5e838d);});}main(); \ No newline at end of file +var _0x519b=['resolve','then','getMailAccounts','initMailAccounts','refresh','mailAccounts','getSettings','catch','error','Email\x20service\x20initialization','./server','./realtime','./lib/email','./rpc/mailAccount','./rpc/setting','../../config/logger','email'];(function(_0x51489a,_0x3863fe){var _0x8a28d2=function(_0x27ab8c){while(--_0x27ab8c){_0x51489a['push'](_0x51489a['shift']());}};_0x8a28d2(++_0x3863fe);}(_0x519b,0xf8));var _0xb519=function(_0x3f6bcf,_0x531e79){_0x3f6bcf=_0x3f6bcf-0x0;var _0x1c5350=_0x519b[_0x3f6bcf];return _0x1c5350;};'use strict';var server=require(_0xb519('0x0'));var Realtime=require(_0xb519('0x1'));var EmailChannel=require(_0xb519('0x2'));var mailAccount=require(_0xb519('0x3'));var setting=require(_0xb519('0x4'));var logger=require(_0xb519('0x5'))(_0xb519('0x6'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0xb519('0x7')]()[_0xb519('0x8')](mailAccount[_0xb519('0x9')]())[_0xb519('0x8')](realtime[_0xb519('0xa')]())[_0xb519('0x8')](function(){email[_0xb519('0xb')](realtime[_0xb519('0xc')]);return realtime;});}function main(){return server['listen'](realtime,email)[_0xb519('0x8')](function(){return initRealtime();})[_0xb519('0x8')](function(){return setting[_0xb519('0xd')]();})['then'](function(_0x3291a7){return setInterval(initRealtime,_0x3291a7['loginMailFrequency']*0x3e8);})[_0xb519('0xe')](function(_0xa53f87){logger[_0xb519('0xf')](_0xb519('0x10'),_0xa53f87);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index a1f2c21..4f07b6c 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 _0x349f=['send','verifySmtp','Smtp','verified','verify','exports','moment','md5','ioredis','../../../config/environment','email','localhost','socket.io-emitter','redis','./imap','./smtp','../rpc/mailAccount','info','mailAccounts','imapAccounts','smtp','prototype','emit','name','key','active','status','Imap','messageStatus','total','isNil','stringify','mailAccount:update','refresh','hasOwnProperty','service','provider','custom','box','bind','handleImapEmail','end','error','disabled','handleImapBox','connected','messages','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','lastName','from','then','Mail\x20accepted\x20from\x20routing','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s','handleImapEnd','lastSync','handleImapError','sendMail'];(function(_0x1e9424,_0x191cba){var _0x1bd96c=function(_0x5e952d){while(--_0x5e952d){_0x1e9424['push'](_0x1e9424['shift']());}};_0x1bd96c(++_0x191cba);}(_0x349f,0x7a));var _0xf349=function(_0x43389d,_0x244dc6){_0x43389d=_0x43389d-0x0;var _0x124d06=_0x349f[_0x43389d];return _0x124d06;};'use strict';var _=require('lodash');var moment=require(_0xf349('0x0'));var BPromise=require('bluebird');var md5=require(_0xf349('0x1'));var Redis=require(_0xf349('0x2'));var config=require(_0xf349('0x3'));var logger=require('../../../config/logger')(_0xf349('0x4'));config['redis']=_['defaults'](config['redis'],{'host':_0xf349('0x5'),'port':0x18eb});var io=require(_0xf349('0x6'))(new Redis(config[_0xf349('0x7')]));var EmailImap=require(_0xf349('0x8'));var EmailSmtp=require(_0xf349('0x9'));var mailAccount=require(_0xf349('0xa'));var md5Accounts={};function EmailChannel(_0x2e1401){logger[_0xf349('0xb')]('start\x20email\x20channel');this['mailAccounts']=_0x2e1401[_0xf349('0xc')];this[_0xf349('0xd')]={};this[_0xf349('0xe')]=new EmailSmtp();}EmailChannel[_0xf349('0xf')][_0xf349('0x10')]=function(_0x38aae7){var _0x259b02=this[_0xf349('0xc')][_0x38aae7];var _0x5a71de={'id':_0x259b02['id'],'name':_0x259b02[_0xf349('0x11')],'key':_0x259b02[_0xf349('0x12')],'active':_0x259b02[_0xf349('0x13')],'Imap':{'status':_0x259b02['Imap'][_0xf349('0x14')],'messageStatus':_0x259b02[_0xf349('0x15')][_0xf349('0x16')],'total':_0x259b02[_0xf349('0x15')][_0xf349('0x17')]}};if(_[_0xf349('0x18')](md5Accounts[_0x38aae7])){md5Accounts[_0x38aae7]={};}var _0x4e4b4b=md5(JSON[_0xf349('0x19')](_0x5a71de));if(md5Accounts[_0x38aae7][_0xf349('0x1')]!==_0x4e4b4b){md5Accounts[_0x38aae7][_0xf349('0x1')]=_0x4e4b4b;io[_0xf349('0x10')](_0xf349('0x1a'),_0x5a71de);}};EmailChannel[_0xf349('0xf')][_0xf349('0x1b')]=function(_0x55efe6){for(var _0x5e19f3 in _0x55efe6){if(_0x55efe6[_0xf349('0x1c')](_0x5e19f3)){if(_0x55efe6[_0x5e19f3][_0xf349('0x15')]&&_0x55efe6[_0x5e19f3][_0xf349('0x13')]){var _0x2dbec7=_0x55efe6[_0x5e19f3][_0xf349('0x15')];if(!_0x2dbec7[_0xf349('0x1d')]&&_0x55efe6[_0x5e19f3][_0xf349('0x1e')]!==_0xf349('0x1f'))_0x2dbec7[_0xf349('0x1d')]=_0x55efe6[_0x5e19f3]['provider'];if(!this['imapAccounts'][_0xf349('0x1c')](_0x2dbec7['id'])){this['imapAccounts'][_0x2dbec7['id']]=new EmailImap(_0x2dbec7,_0x55efe6[_0x5e19f3][_0xf349('0x4')]);this[_0xf349('0xd')][_0x2dbec7['id']]['on'](_0xf349('0x20'),this['handleImapBox'][_0xf349('0x21')](this,_0x5e19f3));this['imapAccounts'][_0x2dbec7['id']]['on'](_0xf349('0x4'),this[_0xf349('0x22')][_0xf349('0x21')](this,_0x5e19f3));this['imapAccounts'][_0x2dbec7['id']]['on'](_0xf349('0x23'),this['handleImapEnd']['bind'](this,_0x5e19f3));this['imapAccounts'][_0x2dbec7['id']]['on'](_0xf349('0x24'),this['handleImapError']['bind'](this,_0x5e19f3));}}else{if(_[_0xf349('0x18')](this[_0xf349('0xc')][_0x5e19f3][_0xf349('0x15')])){this[_0xf349('0xc')][_0x5e19f3][_0xf349('0x15')]={};}this[_0xf349('0xc')][_0x5e19f3]['Imap']['status']=_0xf349('0x25');this[_0xf349('0xc')][_0x5e19f3][_0xf349('0x15')]['messageStatus']='';this[_0xf349('0x10')](_0x5e19f3);}}}};EmailChannel['prototype'][_0xf349('0x26')]=function(_0x2b08b8,_0x323fd3){if(this[_0xf349('0xc')][_0x2b08b8]){this['mailAccounts'][_0x2b08b8][_0xf349('0x15')][_0xf349('0x14')]=_0xf349('0x27');this['mailAccounts'][_0x2b08b8][_0xf349('0x15')]['messageStatus']=_0x323fd3['name'];if(_0x323fd3[_0xf349('0x28')]){this[_0xf349('0xc')][_0x2b08b8][_0xf349('0x15')][_0xf349('0x17')]=_0x323fd3[_0xf349('0x28')][_0xf349('0x17')];}return this[_0xf349('0x10')](_0x2b08b8);}};EmailChannel[_0xf349('0xf')][_0xf349('0x22')]=function(_0x320f14,_0x5d069e){logger[_0xf349('0xb')](_0xf349('0x29'),_0x5d069e['firstName'],_0x5d069e[_0xf349('0x2a')],_0x5d069e[_0xf349('0x2b')],_0x320f14);if(this['mailAccounts'][_0x320f14]){return mailAccount['notify'](_0x320f14,_0x5d069e)[_0xf349('0x2c')](function(_0x16eae5){if(_0x16eae5){logger['info'](_0xf349('0x2d'));}})[_0xf349('0x2e')](function(_0x2e6b36){logger[_0xf349('0x24')](_0xf349('0x2f'),JSON['stringify'](_0x2e6b36));});}};EmailChannel[_0xf349('0xf')][_0xf349('0x30')]=function(_0x1b6aab){if(this[_0xf349('0xc')][_0x1b6aab]&&this[_0xf349('0xc')][_0x1b6aab]['Imap']){if(this[_0xf349('0xd')][this[_0xf349('0xc')][_0x1b6aab][_0xf349('0x15')]['id']]){delete this[_0xf349('0xd')][this[_0xf349('0xc')][_0x1b6aab][_0xf349('0x15')]['id']];}this[_0xf349('0xc')][_0x1b6aab][_0xf349('0x15')][_0xf349('0x31')]=moment();this['emit'](_0x1b6aab);}};EmailChannel['prototype'][_0xf349('0x32')]=function(_0x202f2c,_0x317507){if(this[_0xf349('0xc')][_0x202f2c]){this['mailAccounts'][_0x202f2c][_0xf349('0x15')][_0xf349('0x14')]=_0xf349('0x24');this[_0xf349('0xc')][_0x202f2c][_0xf349('0x15')][_0xf349('0x16')]=_0x317507;return this['emit'](_0x202f2c);}};EmailChannel[_0xf349('0xf')][_0xf349('0x33')]=function(_0x5280a2,_0xaaca6a){return this[_0xf349('0xe')][_0xf349('0x34')](_0x5280a2,_0xaaca6a);};EmailChannel[_0xf349('0xf')][_0xf349('0x35')]=function(_0x407296){var _0x50393b=this;if(this[_0xf349('0xc')][_0x407296['id']]){if(_[_0xf349('0x18')](this['mailAccounts'][_0x407296['id']]['Smtp'])){this[_0xf349('0xc')][_0x407296['id']][_0xf349('0x36')]={};}this[_0xf349('0xc')][_0x407296['id']][_0xf349('0x36')][_0xf349('0x31')]=moment();return new BPromise(function(_0x1b099d,_0x496d59){return _0x50393b[_0xf349('0xe')]['verify'](_0x407296)[_0xf349('0x2c')](function(_0x53ca1d){_0x50393b[_0xf349('0xc')][_0x407296['id']]['Smtp'][_0xf349('0x14')]=_0xf349('0x37');_0x50393b[_0xf349('0xc')][_0x407296['id']]['Smtp'][_0xf349('0x16')]='';_0x50393b[_0xf349('0x10')](_0x407296['id']);_0x1b099d(_0x53ca1d);})[_0xf349('0x2e')](function(_0x3a797f){_0x50393b[_0xf349('0xc')][_0x407296['id']][_0xf349('0x36')][_0xf349('0x14')]=_0xf349('0x24');_0x50393b[_0xf349('0xc')][_0x407296['id']][_0xf349('0x36')][_0xf349('0x16')]=_0x3a797f;_0x50393b[_0xf349('0x10')](_0x407296['id']);_0x496d59(_0x3a797f);});});}return this[_0xf349('0xe')][_0xf349('0x38')](_0x407296);};module[_0xf349('0x39')]=EmailChannel; \ No newline at end of file +var _0xdd35=['New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','lastName','notify','then','Mail\x20accepted\x20from\x20routing','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s','error','sendMail','send','verifySmtp','Smtp','lastSync','verify','lodash','bluebird','md5','../../../config/environment','redis','defaults','localhost','socket.io-emitter','./imap','./smtp','info','start\x20email\x20channel','mailAccounts','imapAccounts','smtp','prototype','emit','name','key','active','status','Imap','messageStatus','total','isNil','stringify','mailAccount:update','refresh','service','provider','hasOwnProperty','email','box','handleImapBox','bind','handleImapEmail','end','handleImapEnd','handleImapError','disabled','connected','messages'];(function(_0x2a5099,_0x329e92){var _0x2802f1=function(_0x53f99b){while(--_0x53f99b){_0x2a5099['push'](_0x2a5099['shift']());}};_0x2802f1(++_0x329e92);}(_0xdd35,0xb6));var _0x5dd3=function(_0x2041bf,_0x292d27){_0x2041bf=_0x2041bf-0x0;var _0x256e1f=_0xdd35[_0x2041bf];return _0x256e1f;};'use strict';var _=require(_0x5dd3('0x0'));var moment=require('moment');var BPromise=require(_0x5dd3('0x1'));var md5=require(_0x5dd3('0x2'));var Redis=require('ioredis');var config=require(_0x5dd3('0x3'));var logger=require('../../../config/logger')('email');config[_0x5dd3('0x4')]=_[_0x5dd3('0x5')](config[_0x5dd3('0x4')],{'host':_0x5dd3('0x6'),'port':0x18eb});var io=require(_0x5dd3('0x7'))(new Redis(config[_0x5dd3('0x4')]));var EmailImap=require(_0x5dd3('0x8'));var EmailSmtp=require(_0x5dd3('0x9'));var mailAccount=require('../rpc/mailAccount');var md5Accounts={};function EmailChannel(_0x482d94){logger[_0x5dd3('0xa')](_0x5dd3('0xb'));this[_0x5dd3('0xc')]=_0x482d94[_0x5dd3('0xc')];this[_0x5dd3('0xd')]={};this[_0x5dd3('0xe')]=new EmailSmtp();}EmailChannel[_0x5dd3('0xf')][_0x5dd3('0x10')]=function(_0x46a0bf){var _0x432cf8=this['mailAccounts'][_0x46a0bf];var _0x302e55={'id':_0x432cf8['id'],'name':_0x432cf8[_0x5dd3('0x11')],'key':_0x432cf8[_0x5dd3('0x12')],'active':_0x432cf8[_0x5dd3('0x13')],'Imap':{'status':_0x432cf8['Imap'][_0x5dd3('0x14')],'messageStatus':_0x432cf8[_0x5dd3('0x15')][_0x5dd3('0x16')],'total':_0x432cf8[_0x5dd3('0x15')][_0x5dd3('0x17')]}};if(_[_0x5dd3('0x18')](md5Accounts[_0x46a0bf])){md5Accounts[_0x46a0bf]={};}var _0x3e8359=md5(JSON[_0x5dd3('0x19')](_0x302e55));if(md5Accounts[_0x46a0bf][_0x5dd3('0x2')]!==_0x3e8359){md5Accounts[_0x46a0bf][_0x5dd3('0x2')]=_0x3e8359;io[_0x5dd3('0x10')](_0x5dd3('0x1a'),_0x302e55);}};EmailChannel['prototype'][_0x5dd3('0x1b')]=function(_0x3b649c){for(var _0x584c0f in _0x3b649c){if(_0x3b649c['hasOwnProperty'](_0x584c0f)){if(_0x3b649c[_0x584c0f][_0x5dd3('0x15')]&&_0x3b649c[_0x584c0f][_0x5dd3('0x13')]){var _0x5bea1c=_0x3b649c[_0x584c0f][_0x5dd3('0x15')];if(!_0x5bea1c[_0x5dd3('0x1c')]&&_0x3b649c[_0x584c0f][_0x5dd3('0x1d')]!=='custom')_0x5bea1c['service']=_0x3b649c[_0x584c0f]['provider'];if(!this['imapAccounts'][_0x5dd3('0x1e')](_0x5bea1c['id'])){this[_0x5dd3('0xd')][_0x5bea1c['id']]=new EmailImap(_0x5bea1c,_0x3b649c[_0x584c0f][_0x5dd3('0x1f')]);this[_0x5dd3('0xd')][_0x5bea1c['id']]['on'](_0x5dd3('0x20'),this[_0x5dd3('0x21')][_0x5dd3('0x22')](this,_0x584c0f));this[_0x5dd3('0xd')][_0x5bea1c['id']]['on'](_0x5dd3('0x1f'),this[_0x5dd3('0x23')][_0x5dd3('0x22')](this,_0x584c0f));this[_0x5dd3('0xd')][_0x5bea1c['id']]['on'](_0x5dd3('0x24'),this[_0x5dd3('0x25')][_0x5dd3('0x22')](this,_0x584c0f));this['imapAccounts'][_0x5bea1c['id']]['on']('error',this[_0x5dd3('0x26')][_0x5dd3('0x22')](this,_0x584c0f));}}else{if(_[_0x5dd3('0x18')](this['mailAccounts'][_0x584c0f][_0x5dd3('0x15')])){this[_0x5dd3('0xc')][_0x584c0f][_0x5dd3('0x15')]={};}this[_0x5dd3('0xc')][_0x584c0f]['Imap'][_0x5dd3('0x14')]=_0x5dd3('0x27');this[_0x5dd3('0xc')][_0x584c0f][_0x5dd3('0x15')][_0x5dd3('0x16')]='';this[_0x5dd3('0x10')](_0x584c0f);}}}};EmailChannel['prototype']['handleImapBox']=function(_0x563fa9,_0x2386fa){if(this[_0x5dd3('0xc')][_0x563fa9]){this[_0x5dd3('0xc')][_0x563fa9][_0x5dd3('0x15')][_0x5dd3('0x14')]=_0x5dd3('0x28');this['mailAccounts'][_0x563fa9]['Imap']['messageStatus']=_0x2386fa[_0x5dd3('0x11')];if(_0x2386fa['messages']){this[_0x5dd3('0xc')][_0x563fa9][_0x5dd3('0x15')]['total']=_0x2386fa[_0x5dd3('0x29')][_0x5dd3('0x17')];}return this['emit'](_0x563fa9);}};EmailChannel[_0x5dd3('0xf')][_0x5dd3('0x23')]=function(_0x2956e0,_0x509ec3){logger[_0x5dd3('0xa')](_0x5dd3('0x2a'),_0x509ec3['firstName'],_0x509ec3[_0x5dd3('0x2b')],_0x509ec3['from'],_0x2956e0);if(this['mailAccounts'][_0x2956e0]){return mailAccount[_0x5dd3('0x2c')](_0x2956e0,_0x509ec3)[_0x5dd3('0x2d')](function(_0x3f45eb){if(_0x3f45eb){logger['info'](_0x5dd3('0x2e'));}})[_0x5dd3('0x2f')](function(_0x58a02d){logger['error'](_0x5dd3('0x30'),JSON['stringify'](_0x58a02d));});}};EmailChannel['prototype'][_0x5dd3('0x25')]=function(_0x3d6253){if(this[_0x5dd3('0xc')][_0x3d6253]&&this['mailAccounts'][_0x3d6253][_0x5dd3('0x15')]){if(this[_0x5dd3('0xd')][this[_0x5dd3('0xc')][_0x3d6253][_0x5dd3('0x15')]['id']]){delete this[_0x5dd3('0xd')][this[_0x5dd3('0xc')][_0x3d6253]['Imap']['id']];}this[_0x5dd3('0xc')][_0x3d6253][_0x5dd3('0x15')]['lastSync']=moment();this['emit'](_0x3d6253);}};EmailChannel[_0x5dd3('0xf')]['handleImapError']=function(_0x241d4d,_0x5b5a6a){if(this[_0x5dd3('0xc')][_0x241d4d]){this[_0x5dd3('0xc')][_0x241d4d][_0x5dd3('0x15')][_0x5dd3('0x14')]=_0x5dd3('0x31');this[_0x5dd3('0xc')][_0x241d4d][_0x5dd3('0x15')]['messageStatus']=_0x5b5a6a;return this[_0x5dd3('0x10')](_0x241d4d);}};EmailChannel[_0x5dd3('0xf')][_0x5dd3('0x32')]=function(_0x325211,_0xf7499e){return this['smtp'][_0x5dd3('0x33')](_0x325211,_0xf7499e);};EmailChannel[_0x5dd3('0xf')][_0x5dd3('0x34')]=function(_0x40d5dc){var _0x2bb6c1=this;if(this[_0x5dd3('0xc')][_0x40d5dc['id']]){if(_[_0x5dd3('0x18')](this[_0x5dd3('0xc')][_0x40d5dc['id']][_0x5dd3('0x35')])){this[_0x5dd3('0xc')][_0x40d5dc['id']]['Smtp']={};}this[_0x5dd3('0xc')][_0x40d5dc['id']][_0x5dd3('0x35')][_0x5dd3('0x36')]=moment();return new BPromise(function(_0x29584d,_0x3e7b01){return _0x2bb6c1[_0x5dd3('0xe')][_0x5dd3('0x37')](_0x40d5dc)[_0x5dd3('0x2d')](function(_0x302e0a){_0x2bb6c1['mailAccounts'][_0x40d5dc['id']][_0x5dd3('0x35')]['status']='verified';_0x2bb6c1[_0x5dd3('0xc')][_0x40d5dc['id']][_0x5dd3('0x35')][_0x5dd3('0x16')]='';_0x2bb6c1['emit'](_0x40d5dc['id']);_0x29584d(_0x302e0a);})[_0x5dd3('0x2f')](function(_0x4696e6){_0x2bb6c1[_0x5dd3('0xc')][_0x40d5dc['id']]['Smtp']['status']=_0x5dd3('0x31');_0x2bb6c1[_0x5dd3('0xc')][_0x40d5dc['id']][_0x5dd3('0x35')]['messageStatus']=_0x4696e6;_0x2bb6c1[_0x5dd3('0x10')](_0x40d5dc['id']);_0x3e7b01(_0x4696e6);});});}return this[_0x5dd3('0xe')][_0x5dd3('0x37')](_0x40d5dc);};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 fd4c6a2..fa7e7e1 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 _0x33c5=['fetch','message','handleFetchMessage','handleFetchError','closeBox','attributes','handleMessageAttributes','handleMessageEnd','handleSimpleParser','handleFetchEnd','handleCloseBox','handleEnd','stringify','textCode','hasOwnProperty','exports','util','imap','mailparser','simpleParser','Iconv','events','EventEmitter','./utils','../../../config/logger','mailbox','account','getAccount','once','ready','handleReady','bind','end','error','handleError','connect','inherits','connTimeout','authTimeout','service','xoauth2','data5','user','password','authentication','email','anonymous@xcally.com','host','port','tls','required','openBox','handleOpenBox','prototype','emit','search','handleReadUnseen'];(function(_0x39f0b2,_0x25047d){var _0x1f1f06=function(_0xbcbc78){while(--_0xbcbc78){_0x39f0b2['push'](_0x39f0b2['shift']());}};_0x1f1f06(++_0x25047d);}(_0x33c5,0x12d));var _0x533c=function(_0x512f81,_0x4a7986){_0x512f81=_0x512f81-0x0;var _0xa15099=_0x33c5[_0x512f81];return _0xa15099;};'use strict';var _=require('lodash');var util=require(_0x533c('0x0'));var Imap=require(_0x533c('0x1'));var simpleParser=require(_0x533c('0x2'))[_0x533c('0x3')];var Iconv=require('iconv')[_0x533c('0x4')];var EventEmitter=require(_0x533c('0x5'))[_0x533c('0x6')];var utils=require(_0x533c('0x7'));var logger=require(_0x533c('0x8'))('email');function EmailImap(_0x3bb582,_0x4e4b0f){this[_0x533c('0x9')]=_0x3bb582[_0x533c('0x9')];this[_0x533c('0xa')]=this[_0x533c('0xb')](_0x3bb582,_0x4e4b0f);this[_0x533c('0x1')]=new Imap(this[_0x533c('0xa')]);this[_0x533c('0x1')][_0x533c('0xc')](_0x533c('0xd'),this[_0x533c('0xe')][_0x533c('0xf')](this));this[_0x533c('0x1')][_0x533c('0xc')](_0x533c('0x10'),this['handleEnd'][_0x533c('0xf')](this));this[_0x533c('0x1')]['on'](_0x533c('0x11'),this[_0x533c('0x12')]['bind'](this));this[_0x533c('0x1')][_0x533c('0x13')]();}util[_0x533c('0x14')](EmailImap,EventEmitter);EmailImap['prototype'][_0x533c('0xb')]=function(_0x190fe3,_0x530f93){var _0x57ea66={'connTimeout':_0x190fe3['connTimeout']?_0x190fe3[_0x533c('0x15')]*0x3e8:0x2710,'authTimeout':_0x190fe3['authTimeout']?_0x190fe3[_0x533c('0x16')]*0x3e8:0x1388};if(_0x190fe3[_0x533c('0x17')]){_0x57ea66['user']=_0x190fe3['user'];if(_0x190fe3['modernAuthentication']){_0x57ea66[_0x533c('0x18')]=utils['generateXOAuth2Token'](_0x190fe3['CloudProvider'][_0x533c('0x19')],_0x190fe3[_0x533c('0x1a')]);}else{_0x57ea66['password']=_0x190fe3[_0x533c('0x1b')];}}else{if(_0x190fe3[_0x533c('0x1c')]){_0x57ea66[_0x533c('0x1a')]=_0x190fe3[_0x533c('0x1a')];_0x57ea66[_0x533c('0x1b')]=_0x190fe3[_0x533c('0x1b')];}}_0x57ea66[_0x533c('0x1d')]=_0x530f93||_0x190fe3['user']||_0x533c('0x1e');_0x57ea66[_0x533c('0x1f')]=_0x190fe3['host'];_0x57ea66[_0x533c('0x20')]=_0x190fe3[_0x533c('0x20')]||0x3e1;if(_0x190fe3[_0x533c('0x21')]){_0x57ea66[_0x533c('0x21')]=!![];}else{_0x57ea66[_0x533c('0x21')]=![];_0x57ea66['autotls']=_0x533c('0x22');}return _0x57ea66;};EmailImap['prototype']['handleReady']=function(){this[_0x533c('0x1')][_0x533c('0x23')](this[_0x533c('0x9')],![],this[_0x533c('0x24')][_0x533c('0xf')](this));};EmailImap[_0x533c('0x25')][_0x533c('0x24')]=function(_0x1c88a1,_0x170698){if(_0x1c88a1){this[_0x533c('0x12')](_0x1c88a1,!![]);}else{this[_0x533c('0x26')]('box',_0x170698);this['readUnseen']();}};EmailImap['prototype']['handleCloseBox']=function(_0x242f0e){if(_0x242f0e){this[_0x533c('0x12')](_0x242f0e,!![]);}else{this['imap'][_0x533c('0x10')]();}};EmailImap['prototype']['readUnseen']=function(){this[_0x533c('0x1')][_0x533c('0x27')](['UNSEEN'],this['handleReadUnseen'][_0x533c('0xf')](this));};EmailImap[_0x533c('0x25')][_0x533c('0x28')]=function(_0x5ad47d,_0x2f384f){if(_0x5ad47d){this[_0x533c('0x12')](_0x5ad47d,!![]);}else{if(_0x2f384f['length']){try{var _0xaf4f73=this[_0x533c('0x1')][_0x533c('0x29')](_0x2f384f,{'bodies':'','markSeen':!![]});_0xaf4f73['on'](_0x533c('0x2a'),this[_0x533c('0x2b')][_0x533c('0xf')](this));_0xaf4f73['once'](_0x533c('0x11'),this[_0x533c('0x2c')][_0x533c('0xf')](this));_0xaf4f73[_0x533c('0xc')](_0x533c('0x10'),this['handleFetchEnd'][_0x533c('0xf')](this));}catch(_0x9a2a6c){logger[_0x533c('0x11')](_0x9a2a6c);}}else{this[_0x533c('0x1')][_0x533c('0x2d')](!![],this['handleCloseBox'][_0x533c('0xf')](this));}}};EmailImap[_0x533c('0x25')][_0x533c('0x2b')]=function(_0x58d1e3){_0x58d1e3['on']('body',this['handleMessageBody'][_0x533c('0xf')](this));_0x58d1e3[_0x533c('0xc')](_0x533c('0x2e'),this[_0x533c('0x2f')][_0x533c('0xf')](this));_0x58d1e3[_0x533c('0xc')](_0x533c('0x10'),this[_0x533c('0x30')]['bind'](this));};EmailImap[_0x533c('0x25')]['handleMessageBody']=function(_0x45a86e){simpleParser(_0x45a86e,{'Iconv':Iconv},this[_0x533c('0x31')][_0x533c('0xf')](this));};EmailImap[_0x533c('0x25')]['handleMessageAttributes']=function(){};EmailImap['prototype'][_0x533c('0x30')]=function(){};EmailImap[_0x533c('0x25')][_0x533c('0x31')]=function(_0x7d0b7e,_0x42d07d){if(_0x7d0b7e){logger['error'](_0x7d0b7e);}else{var _0x2381d9=this;utils['parser'](this['account'],_0x42d07d,function(_0xadfca5){_0x2381d9[_0x533c('0x26')](_0x533c('0x1d'),_0xadfca5);});}};EmailImap[_0x533c('0x25')][_0x533c('0x32')]=function(){this[_0x533c('0x1')][_0x533c('0x2d')](!![],this[_0x533c('0x33')]['bind'](this));};EmailImap[_0x533c('0x25')]['handleFetchError']=function(_0x32db8f){this[_0x533c('0x12')](_0x32db8f);this[_0x533c('0x1')][_0x533c('0x2d')](!![],this[_0x533c('0x33')][_0x533c('0xf')](this));};EmailImap[_0x533c('0x25')][_0x533c('0x34')]=function(){this[_0x533c('0x26')]('end');};EmailImap[_0x533c('0x25')]['handleError']=function(_0x1238fb,_0x3dd185){logger[_0x533c('0x11')](_0x533c('0x12'),this[_0x533c('0xa')][_0x533c('0x1d')],JSON[_0x533c('0x35')](_0x1238fb));var _0x6e30b9='';if(_0x1238fb){if(_0x1238fb[_0x533c('0x36')]){_0x6e30b9=_0x1238fb[_0x533c('0x36')];}else{for(var _0x59154d in _0x1238fb){if(_0x1238fb[_0x533c('0x37')](_0x59154d)){_0x6e30b9+=_['upperFirst'](_0x59154d)+':\x20'+_0x1238fb[_0x59154d]+'\x0a';}}}}if(_0x3dd185){this[_0x533c('0x1')][_0x533c('0x10')]();}else{this[_0x533c('0x26')](_0x533c('0x11'),_0x6e30b9);this['emit'](_0x533c('0x10'));}};module[_0x533c('0x38')]=EmailImap; \ No newline at end of file +var _0x18e0=['handleReady','bind','error','handleError','connect','inherits','prototype','connTimeout','authTimeout','service','user','xoauth2','generateXOAuth2Token','data5','password','authentication','anonymous@xcally.com','host','port','tls','openBox','handleOpenBox','box','readUnseen','handleCloseBox','end','search','UNSEEN','handleReadUnseen','message','handleFetchMessage','body','attributes','handleMessageEnd','handleMessageBody','handleSimpleParser','emit','handleFetchEnd','handleFetchError','closeBox','handleEnd','stringify','textCode','hasOwnProperty','upperFirst','exports','util','mailparser','simpleParser','iconv','events','../../../config/logger','email','mailbox','account','imap','once','ready'];(function(_0x2c27ed,_0x5c50f0){var _0x597bd1=function(_0xd6db18){while(--_0xd6db18){_0x2c27ed['push'](_0x2c27ed['shift']());}};_0x597bd1(++_0x5c50f0);}(_0x18e0,0xa2));var _0x018e=function(_0x4c445a,_0x4ee80f){_0x4c445a=_0x4c445a-0x0;var _0x2f611c=_0x18e0[_0x4c445a];return _0x2f611c;};'use strict';var _=require('lodash');var util=require(_0x018e('0x0'));var Imap=require('imap');var simpleParser=require(_0x018e('0x1'))[_0x018e('0x2')];var Iconv=require(_0x018e('0x3'))['Iconv'];var EventEmitter=require(_0x018e('0x4'))['EventEmitter'];var utils=require('./utils');var logger=require(_0x018e('0x5'))(_0x018e('0x6'));function EmailImap(_0x1b90dd,_0x50450b){this['mailbox']=_0x1b90dd[_0x018e('0x7')];this[_0x018e('0x8')]=this['getAccount'](_0x1b90dd,_0x50450b);this[_0x018e('0x9')]=new Imap(this[_0x018e('0x8')]);this[_0x018e('0x9')][_0x018e('0xa')](_0x018e('0xb'),this[_0x018e('0xc')]['bind'](this));this[_0x018e('0x9')]['once']('end',this['handleEnd'][_0x018e('0xd')](this));this[_0x018e('0x9')]['on'](_0x018e('0xe'),this[_0x018e('0xf')][_0x018e('0xd')](this));this[_0x018e('0x9')][_0x018e('0x10')]();}util[_0x018e('0x11')](EmailImap,EventEmitter);EmailImap[_0x018e('0x12')]['getAccount']=function(_0xec531a,_0x3b1e5e){var _0x2d6aa0={'connTimeout':_0xec531a[_0x018e('0x13')]?_0xec531a[_0x018e('0x13')]*0x3e8:0x2710,'authTimeout':_0xec531a['authTimeout']?_0xec531a[_0x018e('0x14')]*0x3e8:0x1388};if(_0xec531a[_0x018e('0x15')]){_0x2d6aa0[_0x018e('0x16')]=_0xec531a[_0x018e('0x16')];if(_0xec531a['modernAuthentication']){_0x2d6aa0[_0x018e('0x17')]=utils[_0x018e('0x18')](_0xec531a['CloudProvider'][_0x018e('0x19')],_0xec531a[_0x018e('0x16')]);}else{_0x2d6aa0[_0x018e('0x1a')]=_0xec531a[_0x018e('0x1a')];}}else{if(_0xec531a[_0x018e('0x1b')]){_0x2d6aa0['user']=_0xec531a[_0x018e('0x16')];_0x2d6aa0[_0x018e('0x1a')]=_0xec531a[_0x018e('0x1a')];}}_0x2d6aa0[_0x018e('0x6')]=_0x3b1e5e||_0xec531a[_0x018e('0x16')]||_0x018e('0x1c');_0x2d6aa0[_0x018e('0x1d')]=_0xec531a['host'];_0x2d6aa0[_0x018e('0x1e')]=_0xec531a[_0x018e('0x1e')]||0x3e1;if(_0xec531a[_0x018e('0x1f')]){_0x2d6aa0[_0x018e('0x1f')]=!![];}else{_0x2d6aa0[_0x018e('0x1f')]=![];_0x2d6aa0['autotls']='required';}return _0x2d6aa0;};EmailImap[_0x018e('0x12')][_0x018e('0xc')]=function(){this[_0x018e('0x9')][_0x018e('0x20')](this[_0x018e('0x7')],![],this[_0x018e('0x21')][_0x018e('0xd')](this));};EmailImap[_0x018e('0x12')][_0x018e('0x21')]=function(_0x1d0baa,_0x35f9a3){if(_0x1d0baa){this[_0x018e('0xf')](_0x1d0baa,!![]);}else{this['emit'](_0x018e('0x22'),_0x35f9a3);this[_0x018e('0x23')]();}};EmailImap[_0x018e('0x12')][_0x018e('0x24')]=function(_0x2167e6){if(_0x2167e6){this[_0x018e('0xf')](_0x2167e6,!![]);}else{this[_0x018e('0x9')][_0x018e('0x25')]();}};EmailImap[_0x018e('0x12')][_0x018e('0x23')]=function(){this['imap'][_0x018e('0x26')]([_0x018e('0x27')],this['handleReadUnseen'][_0x018e('0xd')](this));};EmailImap[_0x018e('0x12')][_0x018e('0x28')]=function(_0x2836b1,_0x13929e){if(_0x2836b1){this[_0x018e('0xf')](_0x2836b1,!![]);}else{if(_0x13929e['length']){try{var _0x2db83e=this[_0x018e('0x9')]['fetch'](_0x13929e,{'bodies':'','markSeen':!![]});_0x2db83e['on'](_0x018e('0x29'),this[_0x018e('0x2a')][_0x018e('0xd')](this));_0x2db83e[_0x018e('0xa')](_0x018e('0xe'),this['handleFetchError'][_0x018e('0xd')](this));_0x2db83e[_0x018e('0xa')](_0x018e('0x25'),this['handleFetchEnd'][_0x018e('0xd')](this));}catch(_0x4d0ed8){logger[_0x018e('0xe')](_0x4d0ed8);}}else{this[_0x018e('0x9')]['closeBox'](!![],this['handleCloseBox'][_0x018e('0xd')](this));}}};EmailImap[_0x018e('0x12')][_0x018e('0x2a')]=function(_0x37f8f6){_0x37f8f6['on'](_0x018e('0x2b'),this['handleMessageBody'][_0x018e('0xd')](this));_0x37f8f6[_0x018e('0xa')](_0x018e('0x2c'),this['handleMessageAttributes']['bind'](this));_0x37f8f6[_0x018e('0xa')](_0x018e('0x25'),this[_0x018e('0x2d')][_0x018e('0xd')](this));};EmailImap[_0x018e('0x12')][_0x018e('0x2e')]=function(_0x581a9e){simpleParser(_0x581a9e,{'Iconv':Iconv},this[_0x018e('0x2f')][_0x018e('0xd')](this));};EmailImap['prototype']['handleMessageAttributes']=function(){};EmailImap['prototype'][_0x018e('0x2d')]=function(){};EmailImap[_0x018e('0x12')][_0x018e('0x2f')]=function(_0x1705b7,_0x46344c){if(_0x1705b7){logger['error'](_0x1705b7);}else{var _0x465f38=this;utils['parser'](this[_0x018e('0x8')],_0x46344c,function(_0x2d079b){_0x465f38[_0x018e('0x30')](_0x018e('0x6'),_0x2d079b);});}};EmailImap['prototype'][_0x018e('0x31')]=function(){this[_0x018e('0x9')]['closeBox'](!![],this['handleCloseBox'][_0x018e('0xd')](this));};EmailImap['prototype'][_0x018e('0x32')]=function(_0x16b12d){this['handleError'](_0x16b12d);this[_0x018e('0x9')][_0x018e('0x33')](!![],this[_0x018e('0x24')][_0x018e('0xd')](this));};EmailImap[_0x018e('0x12')][_0x018e('0x34')]=function(){this[_0x018e('0x30')](_0x018e('0x25'));};EmailImap['prototype'][_0x018e('0xf')]=function(_0x1386a0,_0x481a10){logger[_0x018e('0xe')](_0x018e('0xf'),this[_0x018e('0x8')][_0x018e('0x6')],JSON[_0x018e('0x35')](_0x1386a0));var _0x51548a='';if(_0x1386a0){if(_0x1386a0[_0x018e('0x36')]){_0x51548a=_0x1386a0['textCode'];}else{for(var _0x396b2e in _0x1386a0){if(_0x1386a0[_0x018e('0x37')](_0x396b2e)){_0x51548a+=_[_0x018e('0x38')](_0x396b2e)+':\x20'+_0x1386a0[_0x396b2e]+'\x0a';}}}}if(_0x481a10){this[_0x018e('0x9')]['end']();}else{this[_0x018e('0x30')](_0x018e('0xe'),_0x51548a);this['emit'](_0x018e('0x25'));}};module[_0x018e('0x39')]=EmailImap; \ No newline at end of file diff --git a/server/services/email/lib/smtp.js b/server/services/email/lib/smtp.js index 2a5ed6f..939be98 100644 --- a/server/services/email/lib/smtp.js +++ b/server/services/email/lib/smtp.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x75ab=['use','compile','sendMail','toString','verify','Not\x20verifired','exports','nodemailer','nodemailer-plugin-inline-base64','prototype','send','createTransport'];(function(_0xb24a3e,_0x4a3594){var _0x4038d7=function(_0x1ea3c3){while(--_0x1ea3c3){_0xb24a3e['push'](_0xb24a3e['shift']());}};_0x4038d7(++_0x4a3594);}(_0x75ab,0xc7));var _0xb75a=function(_0x35aa5f,_0x527b85){_0x35aa5f=_0x35aa5f-0x0;var _0x2345c2=_0x75ab[_0x35aa5f];return _0x2345c2;};'use strict';var nodemailer=require(_0xb75a('0x0'));var inlineBase64=require(_0xb75a('0x1'));function EmailSmtp(){}EmailSmtp[_0xb75a('0x2')][_0xb75a('0x3')]=function(_0x14dc1b,_0x57f206){return new Promise(function(_0x59c70b,_0x1ce6f9){var _0x6fe262=nodemailer[_0xb75a('0x4')](_0x14dc1b);_0x6fe262[_0xb75a('0x5')](_0xb75a('0x6'),inlineBase64());_0x6fe262[_0xb75a('0x7')](_0x57f206,function(_0x2e6834,_0x1ecae1){if(_0x2e6834){_0x1ce6f9(_0x2e6834[_0xb75a('0x8')]());}else{_0x59c70b(_0x1ecae1);}});});};EmailSmtp[_0xb75a('0x2')][_0xb75a('0x9')]=function(_0x404810){return new Promise(function(_0x219683,_0x20b98d){var _0x3cbca8=nodemailer[_0xb75a('0x4')](_0x404810);_0x3cbca8[_0xb75a('0x9')](function(_0x22b2f8,_0x24733f){if(_0x22b2f8){_0x20b98d(_0x22b2f8['toString']());}else{if(_0x24733f){_0x219683(_0x24733f);}else{_0x20b98d(_0xb75a('0xa'));}}});});};module[_0xb75a('0xb')]=EmailSmtp; \ No newline at end of file +var _0x258f=['nodemailer-plugin-inline-base64','send','use','prototype','verify','toString','Not\x20verifired','exports'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0x258f,0x180));var _0xf258=function(_0x19ba18,_0xf6f979){_0x19ba18=_0x19ba18-0x0;var _0x554c75=_0x258f[_0x19ba18];return _0x554c75;};'use strict';var nodemailer=require('nodemailer');var inlineBase64=require(_0xf258('0x0'));function EmailSmtp(){}EmailSmtp['prototype'][_0xf258('0x1')]=function(_0x312939,_0x73b3e2){return new Promise(function(_0x5496d0,_0x1ac7e9){var _0x18824a=nodemailer['createTransport'](_0x312939);_0x18824a[_0xf258('0x2')]('compile',inlineBase64());_0x18824a['sendMail'](_0x73b3e2,function(_0x37ead2,_0x17e084){if(_0x37ead2){_0x1ac7e9(_0x37ead2['toString']());}else{_0x5496d0(_0x17e084);}});});};EmailSmtp[_0xf258('0x3')][_0xf258('0x4')]=function(_0x846fb9){return new Promise(function(_0x3f7809,_0x41b59a){var _0x15a098=nodemailer['createTransport'](_0x846fb9);_0x15a098[_0xf258('0x4')](function(_0xa3b882,_0x2a85c3){if(_0xa3b882){_0x41b59a(_0xa3b882[_0xf258('0x5')]());}else{if(_0x2a85c3){_0x3f7809(_0x2a85c3);}else{_0x41b59a(_0xf258('0x6'));}}});});};module[_0xf258('0x7')]=EmailSmtp; \ No newline at end of file diff --git a/server/services/email/lib/utils.js b/server/services/email/lib/utils.js index e20c9b2..62596be 100644 --- a/server/services/email/lib/utils.js +++ b/server/services/email/lib/utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xde07=['email','../../../config/environment','head','address','anonymous','value','name','substring','split','slice','join','Anonymous','length','pop','isEmpty','@xcally.com','html','replace','includes','attachments','push','filename','_IMG','\x20[Attachment:\x20','\x20]','body','Empty\x20message

','generateXOAuth2Token','auth=Bearer\x20','utf-8','base64','lodash','moment','randomstring','path','util','node-tnef'];(function(_0x117a9d,_0x54bd98){var _0x259966=function(_0x1dd7bc){while(--_0x1dd7bc){_0x117a9d['push'](_0x117a9d['shift']());}};_0x259966(++_0x54bd98);}(_0xde07,0x11e));var _0x7de0=function(_0x1601c0,_0x8d1d34){_0x1601c0=_0x1601c0-0x0;var _0x24bade=_0xde07[_0x1601c0];return _0x24bade;};'use strict';var _=require(_0x7de0('0x0'));var moment=require(_0x7de0('0x1'));var random=require(_0x7de0('0x2'));var fs=require('fs');var path=require(_0x7de0('0x3'));var util=require(_0x7de0('0x4'));var tnef=require(_0x7de0('0x5'));var logger=require('../../../config/logger')(_0x7de0('0x6'));var config=require(_0x7de0('0x7'));function getAddress(_0x218921){var _0x3b9768=_[_0x7de0('0x8')](_0x218921['value']);return _0x3b9768&&_0x3b9768[_0x7de0('0x9')]?_0x3b9768[_0x7de0('0x9')]:_0x7de0('0xa')+random['generate'](0x6)+'@xcally.com';}function getFirstName(_0x4f6a6c){var _0x32d5d5=_[_0x7de0('0x8')](_0x4f6a6c[_0x7de0('0xb')]);if(_0x32d5d5&&_0x32d5d5[_0x7de0('0xc')]){if(_0x32d5d5[_0x7de0('0xc')]==_0x32d5d5[_0x7de0('0x9')]){return _0x32d5d5[_0x7de0('0xc')][_0x7de0('0xd')](0x0,_0x32d5d5[_0x7de0('0xc')]['indexOf']('@'));}var _0x296bf8=_0x32d5d5[_0x7de0('0xc')][_0x7de0('0xe')](/\s+/);return _0x296bf8['length']>0x1?_0x296bf8[_0x7de0('0xf')](0x0,-0x1)[_0x7de0('0x10')]('\x20'):_0x32d5d5[_0x7de0('0xc')];}return _0x7de0('0x11');}function getLastName(_0x3db3de){var _0x5106a2=_[_0x7de0('0x8')](_0x3db3de[_0x7de0('0xb')]);if(_0x5106a2&&_0x5106a2['name']){var _0x49616d=_0x5106a2['name'][_0x7de0('0xe')](/\s+/);return _0x49616d[_0x7de0('0x12')]>0x1?_0x49616d[_0x7de0('0x13')]():'';}return'';}function getMails(_0x4811ef,_0x52e39a){var _0x365e8c='';for(var _0x491a75=0x0;_0x491a75<_0x52e39a['value'][_0x7de0('0x12')];_0x491a75+=0x1){if(_0x52e39a[_0x7de0('0xb')][_0x491a75][_0x7de0('0x9')]!==_0x4811ef){if(!_[_0x7de0('0x14')](_0x365e8c)){_0x365e8c+=',';}_0x365e8c+=_0x52e39a['value'][_0x491a75][_0x7de0('0xc')]||_0x52e39a['value'][_0x491a75][_0x7de0('0x9')]||'';_0x365e8c+='\x20<';_0x365e8c+=_0x52e39a[_0x7de0('0xb')][_0x491a75][_0x7de0('0x9')]?_0x52e39a[_0x7de0('0xb')][_0x491a75][_0x7de0('0x9')]:_0x7de0('0xa')+random['generate'](0x6)+_0x7de0('0x15');_0x365e8c+='>';}}return _0x365e8c;}function parseEmail(_0x10f31b,_0x183578,_0x252709){if(_0x183578[_0x7de0('0x16')]){var _0x227be4=/)<[^<]*)*<\/script>/gi;while(_0x227be4['test'](_0x183578['html'])){_0x183578[_0x7de0('0x16')]=_0x183578[_0x7de0('0x16')][_0x7de0('0x17')](_0x227be4,'');}if(_0x183578['html'][_0x7de0('0x18')]('{_0x2bda7e[_0x7de0('0x1a')](_0x3544dd[_0x7de0('0x1b')]);});var _0x485faf=/]+>/g;var _0x909986=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x4d974e=_0x183578[_0x7de0('0x16')][_0x7de0('0x17')](_0x909986,'_SRC');var _0x18f521=_0x4d974e['replace'](_0x485faf,_0x7de0('0x1c'));for(let _0x2ce7d4=0x0;_0x2ce7d4<_0x2bda7e[_0x7de0('0x12')];_0x2ce7d4++){var _0x201f14=_0x18f521[_0x7de0('0x17')](_0x7de0('0x1c'),_0x7de0('0x1d')+_0x2bda7e[_0x2ce7d4]+_0x7de0('0x1e'));_0x18f521=_0x201f14;}_0x183578[_0x7de0('0x16')]=_0x18f521;}_0x252709[_0x7de0('0x1f')]=_0x183578[_0x7de0('0x16')];}else{_0x252709[_0x7de0('0x1f')]=_0x183578['textAsHtml'];}if(_0x252709[_0x7de0('0x1f')]){_0x252709[_0x7de0('0x1f')]=_0x252709['body']['replace'](/0x0){var _0x525eb9=['Auto-Submitted:\x20auto-replied',_0x7de0('0x2f'),'Precedence:\x20auto_reply'];for(var _0x110008=0x0;_0x110008<_0x183578['headerLines'][_0x7de0('0x12')];_0x110008++){var _0x422cd5=_[_0x7de0('0x30')](_0x525eb9,_0x183578['headerLines'][_0x110008][_0x7de0('0x31')]);if(_0x422cd5>=0x0){_0x252709[_0x7de0('0x32')]=!![];}}}return _0x252709;}exports[_0x7de0('0x33')]=function(_0x1f5a43,_0x213dd2,_0x308190){var _0x288b46={'from':getAddress(_0x213dd2[_0x7de0('0x34')]),'firstName':getFirstName(_0x213dd2[_0x7de0('0x34')]),'lastName':getLastName(_0x213dd2[_0x7de0('0x34')]),'mapKey':_0x7de0('0x6'),'message':{'from':getMails(_0x1f5a43['email'],_0x213dd2[_0x7de0('0x34')]),'to':_0x1f5a43[_0x7de0('0x6')],'cc':'','subject':_0x213dd2[_0x7de0('0x35')]||'','messageId':_0x213dd2[_0x7de0('0x36')],'inReplyTo':_0x213dd2[_0x7de0('0x37')],'sentAt':moment(_0x213dd2[_0x7de0('0x38')])[_0x7de0('0x27')](_0x7de0('0x39')),'attach':![],'attachments':[]}};if(!_0x213dd2[_0x7de0('0x16')]&&!_0x213dd2[_0x7de0('0x3a')]){var _0x4797ca=_[_0x7de0('0x3b')](_0x213dd2[_0x7de0('0x19')],{'contentType':_0x7de0('0x3c')});if(_0x4797ca[_0x7de0('0x12')]){logger['info'](util[_0x7de0('0x27')](_0x7de0('0x3d'),_0x213dd2[_0x7de0('0x36')]));tnef[_0x7de0('0x3e')](_[_0x7de0('0x3f')](_0x4797ca)[_0x7de0('0x40')],function(_0x3e1543,_0xb0406b){if(_0xb0406b){_0x213dd2[_0x7de0('0x16')]=_0xb0406b[_0x7de0('0x41')]||'

Empty\x20message

';if(_0xb0406b[_0x7de0('0x42')]){for(var _0x35f622=0x0;_0x35f622<_0xb0406b[_0x7de0('0x42')][_0x7de0('0x12')];_0x35f622++){var _0x22146a=_0xb0406b[_0x7de0('0x42')][_0x35f622];_0x288b46[_0x7de0('0x21')]['attachments'][_0x7de0('0x1a')]({'filename':_0x22146a[_0x7de0('0x43')],'content':Buffer['from'](_0x22146a['Data'])});}}}_0x308190(parseEmail(_0x1f5a43,_0x213dd2,_0x288b46));});}else{_0x213dd2[_0x7de0('0x16')]=_0x7de0('0x44');_0x308190(parseEmail(_0x1f5a43,_0x213dd2,_0x288b46));}}else{_0x308190(parseEmail(_0x1f5a43,_0x213dd2,_0x288b46));}};exports[_0x7de0('0x45')]=function(_0x4b26d4,_0x3af18b){var _0x587fb2=['user='+(_0x3af18b||''),_0x7de0('0x46')+_0x4b26d4,'',''];return Buffer[_0x7de0('0x34')](_0x587fb2['join'](''),_0x7de0('0x47'))['toString'](_0x7de0('0x48'));}; \ No newline at end of file +var _0x79c0=['originTo','type','attachment-','format','%s-%s','root','server/files/attachments/','contentType','headerLines','Auto-Submitted:\x20auto-replied','X-Auto-Response-Suppress:\x20All','line','isAutoreply','parser','from','subject','inReplyTo','filter','application/ms-tnef','Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system','messageId','parseBuffer','first','BodyHTML','Attachments','Title','Data','

Empty\x20message

','generateXOAuth2Token','user=','auth=Bearer\x20','join','utf-8','toString','base64','lodash','moment','path','node-tnef','../../../config/logger','email','../../../config/environment','head','value','address','anonymous','generate','@xcally.com','name','substring','indexOf','split','length','slice','pop','isEmpty','html','test','replace','includes','attachments','forEach','push','filename','_SRC','_IMG','\x20[Attachment:\x20','\x20]','body','textAsHtml','0x1?_0x46b4c6[_0x079c('0x12')](0x0,-0x1)['join']('\x20'):_0x48942e[_0x079c('0xd')];}return'Anonymous';}function getLastName(_0xc6b1d6){var _0x4c058a=_[_0x079c('0x7')](_0xc6b1d6[_0x079c('0x8')]);if(_0x4c058a&&_0x4c058a['name']){var _0x15c7a3=_0x4c058a[_0x079c('0xd')][_0x079c('0x10')](/\s+/);return _0x15c7a3['length']>0x1?_0x15c7a3[_0x079c('0x13')]():'';}return'';}function getMails(_0x67854e,_0x50d609){var _0x352c0d='';for(var _0x2b526a=0x0;_0x2b526a<_0x50d609[_0x079c('0x8')][_0x079c('0x11')];_0x2b526a+=0x1){if(_0x50d609[_0x079c('0x8')][_0x2b526a][_0x079c('0x9')]!==_0x67854e){if(!_[_0x079c('0x14')](_0x352c0d)){_0x352c0d+=',';}_0x352c0d+=_0x50d609[_0x079c('0x8')][_0x2b526a]['name']||_0x50d609[_0x079c('0x8')][_0x2b526a][_0x079c('0x9')]||'';_0x352c0d+='\x20<';_0x352c0d+=_0x50d609[_0x079c('0x8')][_0x2b526a][_0x079c('0x9')]?_0x50d609[_0x079c('0x8')][_0x2b526a][_0x079c('0x9')]:_0x079c('0xa')+random[_0x079c('0xb')](0x6)+'@xcally.com';_0x352c0d+='>';}}return _0x352c0d;}function parseEmail(_0x4d67c0,_0xab7397,_0xc1056a){if(_0xab7397[_0x079c('0x15')]){var _0x1844ff=/)<[^<]*)*<\/script>/gi;while(_0x1844ff[_0x079c('0x16')](_0xab7397['html'])){_0xab7397[_0x079c('0x15')]=_0xab7397[_0x079c('0x15')][_0x079c('0x17')](_0x1844ff,'');}if(_0xab7397['html'][_0x079c('0x18')]('{_0xcf4c96[_0x079c('0x1b')](_0x171db0[_0x079c('0x1c')]);});var _0x10ae02=/]+>/g;var _0x5343c0=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x4f12cf=_0xab7397[_0x079c('0x15')][_0x079c('0x17')](_0x5343c0,_0x079c('0x1d'));var _0x15c06d=_0x4f12cf['replace'](_0x10ae02,'_IMG');for(let _0x1eb4b4=0x0;_0x1eb4b4<_0xcf4c96['length'];_0x1eb4b4++){var _0x4bfbaf=_0x15c06d['replace'](_0x079c('0x1e'),_0x079c('0x1f')+_0xcf4c96[_0x1eb4b4]+_0x079c('0x20'));_0x15c06d=_0x4bfbaf;}_0xab7397[_0x079c('0x15')]=_0x15c06d;}_0xc1056a[_0x079c('0x21')]=_0xab7397[_0x079c('0x15')];}else{_0xc1056a[_0x079c('0x21')]=_0xab7397[_0x079c('0x22')];}if(_0xc1056a[_0x079c('0x21')]){_0xc1056a[_0x079c('0x21')]=_0xc1056a[_0x079c('0x21')][_0x079c('0x17')](/0x0){var _0x14b381=[_0x079c('0x2f'),_0x079c('0x30'),'Precedence:\x20auto_reply'];for(var _0x4f6428=0x0;_0x4f6428<_0xab7397[_0x079c('0x2e')][_0x079c('0x11')];_0x4f6428++){var _0x5bfc0f=_[_0x079c('0xf')](_0x14b381,_0xab7397[_0x079c('0x2e')][_0x4f6428][_0x079c('0x31')]);if(_0x5bfc0f>=0x0){_0xc1056a[_0x079c('0x32')]=!![];}}}return _0xc1056a;}exports[_0x079c('0x33')]=function(_0x3ba5ce,_0x4d4ade,_0x5bb261){var _0x2395ca={'from':getAddress(_0x4d4ade['from']),'firstName':getFirstName(_0x4d4ade[_0x079c('0x34')]),'lastName':getLastName(_0x4d4ade[_0x079c('0x34')]),'mapKey':_0x079c('0x5'),'message':{'from':getMails(_0x3ba5ce[_0x079c('0x5')],_0x4d4ade[_0x079c('0x34')]),'to':_0x3ba5ce[_0x079c('0x5')],'cc':'','subject':_0x4d4ade[_0x079c('0x35')]||'','messageId':_0x4d4ade['messageId'],'inReplyTo':_0x4d4ade[_0x079c('0x36')],'sentAt':moment(_0x4d4ade['date'])[_0x079c('0x29')]('YYYY-MM-DD\x20HH:mm:ss'),'attach':![],'attachments':[]}};if(!_0x4d4ade[_0x079c('0x15')]&&!_0x4d4ade['textAsHtml']){var _0x530101=_[_0x079c('0x37')](_0x4d4ade[_0x079c('0x19')],{'contentType':_0x079c('0x38')});if(_0x530101['length']){logger['info'](util[_0x079c('0x29')](_0x079c('0x39'),_0x4d4ade[_0x079c('0x3a')]));tnef[_0x079c('0x3b')](_[_0x079c('0x3c')](_0x530101)['content'],function(_0x37561e,_0x42c4d0){if(_0x42c4d0){_0x4d4ade[_0x079c('0x15')]=_0x42c4d0[_0x079c('0x3d')]||'

Empty\x20message

';if(_0x42c4d0['Attachments']){for(var _0x514a7b=0x0;_0x514a7b<_0x42c4d0[_0x079c('0x3e')][_0x079c('0x11')];_0x514a7b++){var _0x106fd1=_0x42c4d0[_0x079c('0x3e')][_0x514a7b];_0x2395ca[_0x079c('0x24')][_0x079c('0x19')][_0x079c('0x1b')]({'filename':_0x106fd1[_0x079c('0x3f')],'content':Buffer[_0x079c('0x34')](_0x106fd1[_0x079c('0x40')])});}}}_0x5bb261(parseEmail(_0x3ba5ce,_0x4d4ade,_0x2395ca));});}else{_0x4d4ade[_0x079c('0x15')]=_0x079c('0x41');_0x5bb261(parseEmail(_0x3ba5ce,_0x4d4ade,_0x2395ca));}}else{_0x5bb261(parseEmail(_0x3ba5ce,_0x4d4ade,_0x2395ca));}};exports[_0x079c('0x42')]=function(_0x55fcf5,_0x195504){var _0x163db4=[_0x079c('0x43')+(_0x195504||''),_0x079c('0x44')+_0x55fcf5,'',''];return Buffer[_0x079c('0x34')](_0x163db4[_0x079c('0x45')](''),_0x079c('0x46'))[_0x079c('0x47')](_0x079c('0x48'));}; \ No newline at end of file diff --git a/server/services/email/model/mailAccount.js b/server/services/email/model/mailAccount.js index 57db82f..77bedb9 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 _0xd3b7=['Smtp','lodash','name','Service','key','SERV','active','Imap'];(function(_0x46d9a1,_0x136802){var _0x17c284=function(_0x4c6820){while(--_0x4c6820){_0x46d9a1['push'](_0x46d9a1['shift']());}};_0x17c284(++_0x136802);}(_0xd3b7,0x1e1));var _0x7d3b=function(_0x30015a,_0x4976c9){_0x30015a=_0x30015a-0x0;var _0x264e3d=_0xd3b7[_0x30015a];return _0x264e3d;};'use strict';var _=require(_0x7d3b('0x0'));function MailAccount(_0x59c4c8){this['id']=_0x59c4c8['id']||0x0;this[_0x7d3b('0x1')]=_0x59c4c8[_0x7d3b('0x1')]||_0x7d3b('0x2');this[_0x7d3b('0x3')]=_0x59c4c8[_0x7d3b('0x3')]||_0x7d3b('0x4');this[_0x7d3b('0x5')]=_0x59c4c8[_0x7d3b('0x5')]||![];this[_0x7d3b('0x6')]=_0x59c4c8['Imap']||[];this[_0x7d3b('0x7')]=_0x59c4c8[_0x7d3b('0x7')]||[];}module['exports']=MailAccount; \ No newline at end of file +var _0xdd40=['Service','key','SERV','active','Imap','Smtp','exports','lodash','name'];(function(_0x159fd2,_0x3ae329){var _0x59ee66=function(_0x5d5551){while(--_0x5d5551){_0x159fd2['push'](_0x159fd2['shift']());}};_0x59ee66(++_0x3ae329);}(_0xdd40,0x142));var _0x0dd4=function(_0x6ad65,_0x1a955a){_0x6ad65=_0x6ad65-0x0;var _0x159041=_0xdd40[_0x6ad65];return _0x159041;};'use strict';var _=require(_0x0dd4('0x0'));function MailAccount(_0x2cb7d5){this['id']=_0x2cb7d5['id']||0x0;this[_0x0dd4('0x1')]=_0x2cb7d5['name']||_0x0dd4('0x2');this[_0x0dd4('0x3')]=_0x2cb7d5[_0x0dd4('0x3')]||_0x0dd4('0x4');this[_0x0dd4('0x5')]=_0x2cb7d5[_0x0dd4('0x5')]||![];this[_0x0dd4('0x6')]=_0x2cb7d5[_0x0dd4('0x6')]||[];this[_0x0dd4('0x7')]=_0x2cb7d5[_0x0dd4('0x7')]||[];}module[_0x0dd4('0x8')]=MailAccount; \ No newline at end of file diff --git a/server/services/email/realtime/index.js b/server/services/email/realtime/index.js index eaecc16..178297a 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 _0x5e50=['prototype','initMailAccounts','mailAccounts','length','merge','exports','lodash','../model/mailAccount','hasOwnProperty'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x5e50,0x1c8));var _0x05e5=function(_0x137b77,_0x325300){_0x137b77=_0x137b77-0x0;var _0x62283d=_0x5e50[_0x137b77];return _0x62283d;};'use strict';var _=require(_0x05e5('0x0'));var MailAccount=require(_0x05e5('0x1'));var Realtime=function(){this['mailAccounts']={};};function freeIsNotKey(_0x488b19,_0x1e4847,_0x4211e1){var _0x563033=_['mapKeys'](_0x488b19,function(_0x54aef7,_0x9c5eb5){return _0x54aef7[_0x4211e1];});for(var _0x20872a in _0x1e4847){if(_0x1e4847[_0x05e5('0x2')](_0x20872a)){if(!_0x563033[_0x20872a]){delete _0x1e4847[_0x20872a];}}}}Realtime[_0x05e5('0x3')]['mergeFromDatabase']=function(_0xf9bf58,_0x4c350a){for(var _0x21aafc in _0x4c350a){if(_0xf9bf58[_0x05e5('0x2')](_0x21aafc)){_0xf9bf58[_0x21aafc]=_0x4c350a[_0x21aafc];}}};Realtime[_0x05e5('0x3')][_0x05e5('0x4')]=function(){var _0x310311=this;return function(_0x145519){if(_0x145519){freeIsNotKey(_0x145519,_0x310311[_0x05e5('0x5')],'id');for(var _0x3b6dca=0x0,_0x8578be={},_0x40790c={};_0x3b6dca<_0x145519[_0x05e5('0x6')];_0x3b6dca+=0x1){_0x8578be=_0x145519[_0x3b6dca];if(_['isUndefined'](_0x310311[_0x05e5('0x5')][_0x8578be['id']])){_0x310311[_0x05e5('0x5')][_0x8578be['id']]=new MailAccount(_0x8578be);}else{_[_0x05e5('0x7')](_0x310311['mailAccounts'][_0x8578be['id']],_0x8578be);}}}return _0x310311['mailAccounts'];};};module[_0x05e5('0x8')]=Realtime; \ No newline at end of file +var _0xef24=['lodash','mailAccounts','mapKeys','hasOwnProperty','mergeFromDatabase','prototype','initMailAccounts','isUndefined','merge','exports'];(function(_0x15d604,_0x5893ca){var _0x1cfcf1=function(_0x3ec1d6){while(--_0x3ec1d6){_0x15d604['push'](_0x15d604['shift']());}};_0x1cfcf1(++_0x5893ca);}(_0xef24,0xb4));var _0x4ef2=function(_0x1bb139,_0x2ef244){_0x1bb139=_0x1bb139-0x0;var _0x58d7b2=_0xef24[_0x1bb139];return _0x58d7b2;};'use strict';var _=require(_0x4ef2('0x0'));var MailAccount=require('../model/mailAccount');var Realtime=function(){this[_0x4ef2('0x1')]={};};function freeIsNotKey(_0x51a56f,_0x2c55f2,_0x3ca169){var _0x470f7a=_[_0x4ef2('0x2')](_0x51a56f,function(_0x1b7f07,_0x331b59){return _0x1b7f07[_0x3ca169];});for(var _0x385e0f in _0x2c55f2){if(_0x2c55f2[_0x4ef2('0x3')](_0x385e0f)){if(!_0x470f7a[_0x385e0f]){delete _0x2c55f2[_0x385e0f];}}}}Realtime['prototype'][_0x4ef2('0x4')]=function(_0x311302,_0xa514ff){for(var _0x1a94c7 in _0xa514ff){if(_0x311302[_0x4ef2('0x3')](_0x1a94c7)){_0x311302[_0x1a94c7]=_0xa514ff[_0x1a94c7];}}};Realtime[_0x4ef2('0x5')][_0x4ef2('0x6')]=function(){var _0x52a69b=this;return function(_0x3b7893){if(_0x3b7893){freeIsNotKey(_0x3b7893,_0x52a69b[_0x4ef2('0x1')],'id');for(var _0xe37685=0x0,_0x1554f2={},_0x567caf={};_0xe37685<_0x3b7893['length'];_0xe37685+=0x1){_0x1554f2=_0x3b7893[_0xe37685];if(_[_0x4ef2('0x7')](_0x52a69b[_0x4ef2('0x1')][_0x1554f2['id']])){_0x52a69b[_0x4ef2('0x1')][_0x1554f2['id']]=new MailAccount(_0x1554f2);}else{_[_0x4ef2('0x8')](_0x52a69b[_0x4ef2('0x1')][_0x1554f2['id']],_0x1554f2);}}}return _0x52a69b[_0x4ef2('0x1')];};};module[_0x4ef2('0x9')]=Realtime; \ No newline at end of file diff --git a/server/services/email/rpc/mailAccount.js b/server/services/email/rpc/mailAccount.js index 62cf93e..d1147cc 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 _0xf156=['CloudProvider','type','data5','MailServerOut','getMailAccount','notify','NotifyMailAccount','getMailAccounts','Request','name','service','email','active','key','ListId','TemplateId'];(function(_0x1b7196,_0x1e9b02){var _0x38e832=function(_0x2c906d){while(--_0x2c906d){_0x1b7196['push'](_0x1b7196['shift']());}};_0x38e832(++_0x1e9b02);}(_0xf156,0x137));var _0x6f15=function(_0x286b3e,_0x148c7b){_0x286b3e=_0x286b3e-0x0;var _0x47997a=_0xf156[_0x286b3e];return _0x47997a;};'use strict';var client=require('../client');exports[_0x6f15('0x0')]=function(){return function(){return client[_0x6f15('0x1')]('GetMailAccount',{'options':{'attributes':['id',_0x6f15('0x2'),'provider',_0x6f15('0x3'),_0x6f15('0x4'),_0x6f15('0x5'),_0x6f15('0x6'),_0x6f15('0x7'),_0x6f15('0x8')],'raw':![],'include':[{'model':'MailServerIn','as':'Imap','include':[{'model':_0x6f15('0x9'),'attributes':['id',_0x6f15('0x2'),'service',_0x6f15('0xa'),_0x6f15('0xb')],'as':_0x6f15('0x9')}]},{'model':_0x6f15('0xc'),'as':'Smtp','include':[{'model':'CloudProvider','attributes':['id',_0x6f15('0x2'),_0x6f15('0x3'),_0x6f15('0xa'),_0x6f15('0xb')],'as':_0x6f15('0x9')}]}]},'log':_0x6f15('0xd')});};};exports[_0x6f15('0xe')]=function(_0x32ddbc,_0x34ef4e){return client[_0x6f15('0x1')]('NotifyMailAccount',{'account':{'id':_0x32ddbc},'body':_0x34ef4e,'log':_0x6f15('0xf')});}; \ No newline at end of file +var _0x5c84=['notify','NotifyMailAccount','../client','Request','GetMailAccount','provider','service','active','ListId','TemplateId','MailServerIn','Imap','CloudProvider','name','type','data5','MailServerOut','Smtp','getMailAccount'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5c84,0x1ca));var _0x45c8=function(_0x17d45a,_0x334044){_0x17d45a=_0x17d45a-0x0;var _0x1f669c=_0x5c84[_0x17d45a];return _0x1f669c;};'use strict';var client=require(_0x45c8('0x0'));exports['getMailAccounts']=function(){return function(){return client[_0x45c8('0x1')](_0x45c8('0x2'),{'options':{'attributes':['id','name',_0x45c8('0x3'),_0x45c8('0x4'),'email',_0x45c8('0x5'),'key',_0x45c8('0x6'),_0x45c8('0x7')],'raw':![],'include':[{'model':_0x45c8('0x8'),'as':_0x45c8('0x9'),'include':[{'model':_0x45c8('0xa'),'attributes':['id',_0x45c8('0xb'),_0x45c8('0x4'),_0x45c8('0xc'),_0x45c8('0xd')],'as':_0x45c8('0xa')}]},{'model':_0x45c8('0xe'),'as':_0x45c8('0xf'),'include':[{'model':'CloudProvider','attributes':['id','name',_0x45c8('0x4'),_0x45c8('0xc'),_0x45c8('0xd')],'as':_0x45c8('0xa')}]}]},'log':_0x45c8('0x10')});};};exports[_0x45c8('0x11')]=function(_0x3d6c2f,_0x2da758){return client[_0x45c8('0x1')](_0x45c8('0x12'),{'account':{'id':_0x3d6c2f},'body':_0x2da758,'log':_0x45c8('0x12')});}; \ No newline at end of file diff --git a/server/services/email/rpc/setting.js b/server/services/email/rpc/setting.js index 6435083..7f8be62 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 _0x7be5=['../client','getSettings','Request','ShowSetting','GetSettings'];(function(_0x44745f,_0x432d7e){var _0xac7f24=function(_0x53038f){while(--_0x53038f){_0x44745f['push'](_0x44745f['shift']());}};_0xac7f24(++_0x432d7e);}(_0x7be5,0xaf));var _0x57be=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x7be5[_0x321bb2];return _0x9c12ed;};'use strict';var client=require(_0x57be('0x0'));exports[_0x57be('0x1')]=function(){return client[_0x57be('0x2')](_0x57be('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':['loginMailFrequency']},'log':_0x57be('0x4')});}; \ No newline at end of file +var _0x2ea3=['ShowSetting','loginMailFrequency','GetSettings','../client','getSettings'];(function(_0x1695ca,_0x1b0227){var _0x594851=function(_0x487178){while(--_0x487178){_0x1695ca['push'](_0x1695ca['shift']());}};_0x594851(++_0x1b0227);}(_0x2ea3,0x12f));var _0x32ea=function(_0x32e833,_0x46dbdf){_0x32e833=_0x32e833-0x0;var _0xa31d8f=_0x2ea3[_0x32e833];return _0xa31d8f;};'use strict';var client=require(_0x32ea('0x0'));exports[_0x32ea('0x1')]=function(){return client['Request'](_0x32ea('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x32ea('0x3')]},'log':_0x32ea('0x4')});}; \ No newline at end of file diff --git a/server/services/email/server/index.js b/server/services/email/server/index.js index 0b8f6fa..080db99 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(_0x4b7b62,_0x4920a9){_0x4b7b62=_0x4b7b62-0x0;var _0x2280df=_0xa9e0[_0x4b7b62];return _0x2280df;};'use strict';var jayson=require(_0x0a9e('0x0'));var BPromise=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var logger=require('../../../config/logger')('email');exports[_0x0a9e('0x3')]=function(_0x4ce2f1,_0x333808){return new BPromise(function(_0x432180,_0x2ab90b){var _0x991246={'SendMail':function(_0x981158){var _0x57b080=this;return new Promise(function(_0x219af0,_0x441e3a){_0x333808[_0x0a9e('0x4')](_0x981158['account'],_0x981158['message'])[_0x0a9e('0x5')](function(_0x56465b){_0x219af0({'code':0xc8,'message':_0x56465b});})['catch'](function(_0x39753a){_0x441e3a(_0x57b080[_0x0a9e('0x6')](0x1f4,_0x39753a));});});},'VerifySmtp':function(_0x307b3e){var _0x3ab53f=this;return new Promise(function(_0xfeb75b,_0xbd1168){_0x333808['verifySmtp'](_0x307b3e['account'])['then'](function(_0x4cfe67){_0xfeb75b({'code':0xc8,'message':_0x0a9e('0x7')});})[_0x0a9e('0x8')](function(_0xd5b662){_0xbd1168(_0x3ab53f[_0x0a9e('0x6')](0x1f4,_0xd5b662));});});},'MailAccounts':function(_0x32d742){return new Promise(function(_0x69aeb7,_0x5db4b0){var _0x4283ce=_[_0x0a9e('0x9')](_0x4ce2f1[_0x0a9e('0xa')]);for(var _0x281129=0x0;_0x281129<_0x4283ce[_0x0a9e('0xb')];_0x281129+=0x1){if(_0x4283ce[_0x281129][_0x0a9e('0xc')]&&_0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')]){delete _0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')];}if(_0x4283ce[_0x281129]['Smtp']&&_0x4283ce[_0x281129][_0x0a9e('0xe')][_0x0a9e('0xf')]){delete _0x4283ce[_0x281129]['Smtp'][_0x0a9e('0xf')];}}_0x69aeb7({'count':_0x4283ce['length'],'rows':_0x4283ce});});}};var _0x459eb1=jayson[_0x0a9e('0x10')](_0x991246)[_0x0a9e('0x11')]();_0x459eb1['on'](_0x0a9e('0x6'),function(_0x31b1ca){logger[_0x0a9e('0x6')](JSON[_0x0a9e('0x12')](_0x31b1ca));return _0x2ab90b(_0x31b1ca);});_0x459eb1[_0x0a9e('0x3')](0x232b,_0x0a9e('0x13'),function(){console[_0x0a9e('0x14')](_0x0a9e('0x15'),0x232b);return _0x432180(_0x0a9e('0x16')+0x232b);});});}; \ No newline at end of file +var _0xa9e0=['catch','values','mailAccounts','length','Imap','password','Smtp','pass','server','http','stringify','127.0.0.1','log','Email\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','jayson/promise','bluebird','lodash','listen','sendMail','then','error','Verified'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3635ce,_0x33a6f9){_0x3635ce=_0x3635ce-0x0;var _0x97ecd0=_0xa9e0[_0x3635ce];return _0x97ecd0;};'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 b16bab6..e5887d7 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 _0x641c=['../../config/express','../../routes','once','log','Express\x20server\x20listening\x20on\x20port\x20%d!','exports','lodash','http','ioredis','createServer','timeout','port','socket.io','polling','redis','defaults','localhost','socket.io-redis','default','../../config/socketio'];(function(_0x18f3fe,_0x4c79ab){var _0x1c18a3=function(_0x58b121){while(--_0x58b121){_0x18f3fe['push'](_0x18f3fe['shift']());}};_0x1c18a3(++_0x4c79ab);}(_0x641c,0x11e));var _0xc641=function(_0x328d9e,_0x5a6520){_0x328d9e=_0x328d9e-0x0;var _0x3199de=_0x641c[_0x328d9e];return _0x3199de;};'use strict';var _=require(_0xc641('0x0'));var http=require(_0xc641('0x1'));var express=require('express');var sticky=require('sticky-session');var Redis=require(_0xc641('0x2'));var config=require('../../config/environment');var app=express();var server=http[_0xc641('0x3')](app);server[_0xc641('0x4')]=0xdbba0;if(sticky['listen'](server,config[_0xc641('0x5')])){var socketio=require(_0xc641('0x6'))(server,{'transports':['websocket',_0xc641('0x7')]});config[_0xc641('0x8')]=_[_0xc641('0x9')](config['redis'],{'host':_0xc641('0xa'),'port':0x18eb});socketio['adapter'](require(_0xc641('0xb'))({'pubClient':new Redis(config[_0xc641('0x8')]),'subClient':new Redis(config[_0xc641('0x8')])}));require('../../config/triggers')[_0xc641('0xc')]();require(_0xc641('0xd'))[_0xc641('0xc')](socketio);require(_0xc641('0xe'))[_0xc641('0xc')](app);require(_0xc641('0xf'))[_0xc641('0xc')](app);}else{server[_0xc641('0x10')]('listening',function(){console[_0xc641('0x11')](_0xc641('0x12'),config['port']);});}exports=module[_0xc641('0x13')]=app; \ No newline at end of file +var _0x62fe=['lodash','http','ioredis','createServer','timeout','listen','socket.io','polling','redis','localhost','adapter','socket.io-redis','../../config/triggers','default','../../config/express','once','listening','log','port'];(function(_0x6b695f,_0x1607cf){var _0x39536a=function(_0x542d5a){while(--_0x542d5a){_0x6b695f['push'](_0x6b695f['shift']());}};_0x39536a(++_0x1607cf);}(_0x62fe,0xbe));var _0xe62f=function(_0x23d94c,_0x2081ab){_0x23d94c=_0x23d94c-0x0;var _0x37d99d=_0x62fe[_0x23d94c];return _0x37d99d;};'use strict';var _=require(_0xe62f('0x0'));var http=require(_0xe62f('0x1'));var express=require('express');var sticky=require('sticky-session');var Redis=require(_0xe62f('0x2'));var config=require('../../config/environment');var app=express();var server=http[_0xe62f('0x3')](app);server[_0xe62f('0x4')]=0xdbba0;if(sticky[_0xe62f('0x5')](server,config['port'])){var socketio=require(_0xe62f('0x6'))(server,{'transports':['websocket',_0xe62f('0x7')]});config[_0xe62f('0x8')]=_['defaults'](config['redis'],{'host':_0xe62f('0x9'),'port':0x18eb});socketio[_0xe62f('0xa')](require(_0xe62f('0xb'))({'pubClient':new Redis(config[_0xe62f('0x8')]),'subClient':new Redis(config[_0xe62f('0x8')])}));require(_0xe62f('0xc'))[_0xe62f('0xd')]();require('../../config/socketio')[_0xe62f('0xd')](socketio);require(_0xe62f('0xe'))[_0xe62f('0xd')](app);require('../../routes')[_0xe62f('0xd')](app);}else{server[_0xe62f('0xf')](_0xe62f('0x10'),function(){console[_0xe62f('0x11')]('Express\x20server\x20listening\x20on\x20port\x20%d!',config[_0xe62f('0x12')]);});}exports=module['exports']=app; \ No newline at end of file diff --git a/server/services/routing/client.js b/server/services/routing/client.js index 6138614..a7bd7b8 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 _0x4cc7=['client','http','Request','request','debug','rpc','error','message','result','catch','exports','../../config/logger','routing'];(function(_0x4bad42,_0x2c5e2e){var _0x3487bc=function(_0x205662){while(--_0x205662){_0x4bad42['push'](_0x4bad42['shift']());}};_0x3487bc(++_0x2c5e2e);}(_0x4cc7,0x150));var _0x74cc=function(_0x49dfc9,_0x517048){_0x49dfc9=_0x49dfc9-0x0;var _0x440452=_0x4cc7[_0x49dfc9];return _0x440452;};'use strict';var jayson=require('jayson/promise');var BPromise=require('bluebird');var logger=require(_0x74cc('0x0'))(_0x74cc('0x1'));var client=jayson[_0x74cc('0x2')][_0x74cc('0x3')]({'port':0x2329});client[_0x74cc('0x4')]=function(_0x2fa73f,_0x334d76){return new BPromise(function(_0x54e909,_0x139bc8){return client[_0x74cc('0x5')](_0x2fa73f,_0x334d76)['then'](function(_0x32953b){logger[_0x74cc('0x6')](_0x74cc('0x7'),_0x74cc('0x1'),_0x2fa73f,_0x334d76,_0x32953b);if(_0x32953b[_0x74cc('0x8')]){logger[_0x74cc('0x8')](_0x74cc('0x7'),_0x74cc('0x1'),_0x2fa73f,_0x32953b[_0x74cc('0x8')][_0x74cc('0x9')],_0x334d76);return _0x139bc8(_0x32953b[_0x74cc('0x8')][_0x74cc('0x9')]);}else{return _0x54e909(_0x32953b[_0x74cc('0xa')]);}})[_0x74cc('0xb')](function(_0x79a22e){logger[_0x74cc('0x8')](_0x74cc('0x7'),_0x74cc('0x1'),_0x2fa73f,_0x79a22e,_0x334d76);return _0x139bc8(_0x79a22e);});});};module[_0x74cc('0xc')]=client; \ No newline at end of file +var _0x2814=['rpc','error','message','result','catch','exports','jayson/promise','bluebird','../../config/logger','routing','client','http','Request','request','then'];(function(_0x72f47d,_0x573fca){var _0x4cfc6a=function(_0x592f07){while(--_0x592f07){_0x72f47d['push'](_0x72f47d['shift']());}};_0x4cfc6a(++_0x573fca);}(_0x2814,0x1aa));var _0x4281=function(_0x53ee1d,_0x12d490){_0x53ee1d=_0x53ee1d-0x0;var _0x58192e=_0x2814[_0x53ee1d];return _0x58192e;};'use strict';var jayson=require(_0x4281('0x0'));var BPromise=require(_0x4281('0x1'));var logger=require(_0x4281('0x2'))(_0x4281('0x3'));var client=jayson[_0x4281('0x4')][_0x4281('0x5')]({'port':0x2329});client[_0x4281('0x6')]=function(_0xb8f77d,_0x37a56a){return new BPromise(function(_0x22f861,_0x3c4b5b){return client[_0x4281('0x7')](_0xb8f77d,_0x37a56a)[_0x4281('0x8')](function(_0x3576fc){logger['debug'](_0x4281('0x9'),_0x4281('0x3'),_0xb8f77d,_0x37a56a,_0x3576fc);if(_0x3576fc[_0x4281('0xa')]){logger[_0x4281('0xa')](_0x4281('0x9'),_0x4281('0x3'),_0xb8f77d,_0x3576fc[_0x4281('0xa')]['message'],_0x37a56a);return _0x3c4b5b(_0x3576fc[_0x4281('0xa')][_0x4281('0xb')]);}else{return _0x22f861(_0x3576fc[_0x4281('0xc')]);}})[_0x4281('0xd')](function(_0x2c87ac){logger[_0x4281('0xa')](_0x4281('0x9'),'routing',_0xb8f77d,_0x2c87ac,_0x37a56a);return _0x3c4b5b(_0x2c87ac);});});};module[_0x4281('0xe')]=client; \ No newline at end of file diff --git a/server/services/routing/index.js b/server/services/routing/index.js index ee9126d..9b80fa9 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 _0xb900=['log','bluebird','./server','./realtime','./rpc/user','./rpc/interval','./rpc/openchannelQueue','./rpc/chatQueue','./rpc/smsQueue','./rpc/faxQueue','./rpc/whatsappQueue','resolve','then','getAgents','initAgents','getIntervals','getOpenchannelQueues','initOpenchannelQueues','getChatQueues','getSmsQueues','initSmsQueues','getMailQueues','initMailQueues','getFaxQueues','initFaxQueues','getWhatsappQueues','initWhatsappQueues','listen','catch'];(function(_0x21df12,_0x47f3c6){var _0x5d376a=function(_0x47423b){while(--_0x47423b){_0x21df12['push'](_0x21df12['shift']());}};_0x5d376a(++_0x47f3c6);}(_0xb900,0xcc));var _0x0b90=function(_0x43833f,_0x449721){_0x43833f=_0x43833f-0x0;var _0x3f1a04=_0xb900[_0x43833f];return _0x3f1a04;};'use strict';var BPromise=require(_0x0b90('0x0'));var server=require(_0x0b90('0x1'));var Realtime=require(_0x0b90('0x2'));var user=require(_0x0b90('0x3'));var interval=require(_0x0b90('0x4'));var openchannelQueue=require(_0x0b90('0x5'));var chatQueue=require(_0x0b90('0x6'));var smsQueue=require(_0x0b90('0x7'));var mailQueue=require('./rpc/mailQueue');var faxQueue=require(_0x0b90('0x8'));var whatsappQueue=require(_0x0b90('0x9'));var realtime=new Realtime();function initRealtime(){return BPromise[_0x0b90('0xa')]()[_0x0b90('0xb')](user[_0x0b90('0xc')]())['then'](realtime[_0x0b90('0xd')]())[_0x0b90('0xb')](interval[_0x0b90('0xe')]())[_0x0b90('0xb')](realtime['initIntervals']())[_0x0b90('0xb')](openchannelQueue[_0x0b90('0xf')]())[_0x0b90('0xb')](realtime[_0x0b90('0x10')]())[_0x0b90('0xb')](chatQueue[_0x0b90('0x11')]())[_0x0b90('0xb')](realtime['initChatQueues']())['then'](smsQueue[_0x0b90('0x12')]())['then'](realtime[_0x0b90('0x13')]())['then'](mailQueue[_0x0b90('0x14')]())[_0x0b90('0xb')](realtime[_0x0b90('0x15')]())['then'](faxQueue[_0x0b90('0x16')]())[_0x0b90('0xb')](realtime[_0x0b90('0x17')]())['then'](whatsappQueue[_0x0b90('0x18')]())[_0x0b90('0xb')](realtime[_0x0b90('0x19')]())[_0x0b90('0xb')](function(){return realtime;});}function main(){return server[_0x0b90('0x1a')](realtime)[_0x0b90('0xb')](function(_0x464bc0){return initRealtime();})['then'](function(_0x3cdb5b){return setInterval(initRealtime,0x1388);})[_0x0b90('0x1b')](function(_0x22fd5f){console[_0x0b90('0x1c')](_0x22fd5f);});}main(); \ No newline at end of file +var _0xfabf=['./rpc/mailQueue','./rpc/whatsappQueue','resolve','then','getAgents','initAgents','initIntervals','getOpenchannelQueues','getChatQueues','initChatQueues','getMailQueues','initMailQueues','initFaxQueues','catch','log','bluebird','./server','./realtime','./rpc/user','./rpc/interval','./rpc/chatQueue','./rpc/smsQueue'];(function(_0x16dce0,_0x241147){var _0x2f3a04=function(_0x17910e){while(--_0x17910e){_0x16dce0['push'](_0x16dce0['shift']());}};_0x2f3a04(++_0x241147);}(_0xfabf,0x7d));var _0xffab=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfabf[_0x3dd15e];return _0x231fd0;};'use strict';var BPromise=require(_0xffab('0x0'));var server=require(_0xffab('0x1'));var Realtime=require(_0xffab('0x2'));var user=require(_0xffab('0x3'));var interval=require(_0xffab('0x4'));var openchannelQueue=require('./rpc/openchannelQueue');var chatQueue=require(_0xffab('0x5'));var smsQueue=require(_0xffab('0x6'));var mailQueue=require(_0xffab('0x7'));var faxQueue=require('./rpc/faxQueue');var whatsappQueue=require(_0xffab('0x8'));var realtime=new Realtime();function initRealtime(){return BPromise[_0xffab('0x9')]()[_0xffab('0xa')](user[_0xffab('0xb')]())['then'](realtime[_0xffab('0xc')]())['then'](interval['getIntervals']())['then'](realtime[_0xffab('0xd')]())[_0xffab('0xa')](openchannelQueue[_0xffab('0xe')]())['then'](realtime['initOpenchannelQueues']())[_0xffab('0xa')](chatQueue[_0xffab('0xf')]())[_0xffab('0xa')](realtime[_0xffab('0x10')]())['then'](smsQueue['getSmsQueues']())['then'](realtime['initSmsQueues']())[_0xffab('0xa')](mailQueue[_0xffab('0x11')]())[_0xffab('0xa')](realtime[_0xffab('0x12')]())[_0xffab('0xa')](faxQueue['getFaxQueues']())[_0xffab('0xa')](realtime[_0xffab('0x13')]())['then'](whatsappQueue['getWhatsappQueues']())[_0xffab('0xa')](realtime['initWhatsappQueues']())[_0xffab('0xa')](function(){return realtime;});}function main(){return server['listen'](realtime)['then'](function(_0x709b92){return initRealtime();})[_0xffab('0xa')](function(_0x50edf8){return setInterval(initRealtime,0x1388);})[_0xffab('0x14')](function(_0x7d35f2){console[_0xffab('0x15')](_0x7d35f2);});}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 bbebc32..fbd726c 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 _0xc4aa=['ruleRef','name','nextTick','push','call','next','isEqual','restart','isNil','length','condition','matchPath','noop','findRules','matches','turn','prioritize','priority','toJSON','toString','fromJSON','isString','parse','register','exports','lodash','util','events','EventEmitter','ignoreFactChanges','inherits','prototype','init','rules','activeRules','isArray','concat','isObject','sync','filter','orderBy','asc','execute','result','clone','consequence'];(function(_0x3a86e5,_0x262b57){var _0x59c0ee=function(_0x58661e){while(--_0x58661e){_0x3a86e5['push'](_0x3a86e5['shift']());}};_0x59c0ee(++_0x262b57);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x209941,_0x5c9988){_0x209941=_0x209941-0x0;var _0x1e8729=_0xc4aa[_0x209941];return _0x1e8729;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var EventEmitter=require(_0xac4a('0x2'))[_0xac4a('0x3')];function RuleEngine(_0x275161,_0x22469d){this['init']();if(!_['isNil'](_0x275161)){this['register'](_0x275161);}if(_0x22469d){this[_0xac4a('0x4')]=_0x22469d[_0xac4a('0x4')];}return this;}util[_0xac4a('0x5')](RuleEngine,EventEmitter);RuleEngine[_0xac4a('0x6')][_0xac4a('0x7')]=function(_0x15cd34){this[_0xac4a('0x8')]=[];this[_0xac4a('0x9')]=[];};RuleEngine['prototype']['register']=function(_0x1aba6d){if(Array[_0xac4a('0xa')](_0x1aba6d)){this[_0xac4a('0x8')]=this['rules'][_0xac4a('0xb')](_0x1aba6d);}else if(_0x1aba6d!==null&&_[_0xac4a('0xc')](_0x1aba6d)){this[_0xac4a('0x8')]['push'](_0x1aba6d);}this[_0xac4a('0xd')]();};RuleEngine['prototype'][_0xac4a('0xd')]=function(){this['activeRules']=this[_0xac4a('0x8')][_0xac4a('0xe')](function(_0x24291d){if(_['isNil'](_0x24291d['on'])){_0x24291d['on']=!![];}if(_0x24291d['on']===!![]){return _0x24291d;}});this[_0xac4a('0x9')]=_[_0xac4a('0xf')](this[_0xac4a('0x9')],['p'],[_0xac4a('0x10')]);};RuleEngine[_0xac4a('0x6')][_0xac4a('0x11')]=function(_0x34bc01,_0x33c287){var _0x190418=![];_0x34bc01[_0xac4a('0x12')]=!![];var _0x11e101=_[_0xac4a('0x13')](_0x34bc01);var _0x4a2119=_[_0xac4a('0x13')](_0x34bc01);var _0x34d797=this[_0xac4a('0x9')];var _0x144553=[];var _0x3e88e3=this[_0xac4a('0x4')];(function FnRuleLoop(_0x28e304){var _0x44ec59={'rules':function(){return _0x34d797;},'rule':function(){return _0x34d797[_0x28e304];},'when':function(_0x546c5d){if(_0x546c5d){var _0x5ac21e=_0x34d797[_0x28e304][_0xac4a('0x14')];_0x5ac21e[_0xac4a('0x15')]=_0x34d797[_0x28e304]['id']||_0x34d797[_0x28e304][_0xac4a('0x16')]||'index_'+_0x28e304;process[_0xac4a('0x17')](function(){_0x144553[_0xac4a('0x18')](_0x5ac21e[_0xac4a('0x15')]);_0x5ac21e[_0xac4a('0x19')](_0x11e101,_0x44ec59);});}else{process[_0xac4a('0x17')](function(){_0x44ec59[_0xac4a('0x1a')]();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x190418=!![];return FnRuleLoop(0x0);},'next':function(_0xe38996){if(!_0x3e88e3&&!_[_0xac4a('0x1b')](_0x4a2119,_0x11e101)){_0x4a2119=_['clone'](_0x11e101);process[_0xac4a('0x17')](function(){_0x44ec59[_0xac4a('0x1c')]();});}else{process['nextTick'](function(){if(_[_0xac4a('0x1d')](_0xe38996)){return FnRuleLoop(_0x28e304+0x1);}else{return FnRuleLoop(_0xe38996);}});}}};if(_0x28e304<_0x34d797[_0xac4a('0x1e')]&&_0x190418===![]){var _0x3eacd3=_0x34d797[_0x28e304][_0xac4a('0x1f')];_0x3eacd3['call'](_0x11e101,_0x44ec59);}else{process[_0xac4a('0x17')](function(){_0x11e101[_0xac4a('0x20')]=_0x144553;return _0x33c287?_0x33c287(_0x11e101):_[_0xac4a('0x21')]();});}}(0x0));};RuleEngine[_0xac4a('0x6')][_0xac4a('0x22')]=function(_0x2b0dc2){if(_[_0xac4a('0x1d')](_0x2b0dc2)){return this[_0xac4a('0x8')];}else{var _0x3e2c69=_[_0xac4a('0x23')](_0x2b0dc2);return _[_0xac4a('0xe')](this[_0xac4a('0x8')],_0x3e2c69);}};RuleEngine[_0xac4a('0x6')][_0xac4a('0x24')]=function(_0x1c13dc,_0x20202c){var _0x4e17ce=_0x1c13dc==='on'||_0x1c13dc==='ON'?!![]:![];var _0x23b061=this[_0xac4a('0x22')](_0x20202c);for(var _0x42a33c=0x0,_0x2772fe=_0x23b061[_0xac4a('0x1e')];_0x42a33c<_0x2772fe;_0x42a33c+=0x1){_0x23b061[_0x42a33c]['on']=_0x4e17ce;}this['sync']();};RuleEngine['prototype'][_0xac4a('0x25')]=function(_0x7a948b,_0x1f12d5){_0x7a948b=parseInt(_0x7a948b,0xa);var _0x546b65=this['findRules'](_0x1f12d5);for(var _0x355755=0x0,_0x2896bc=_0x546b65[_0xac4a('0x1e')];_0x355755<_0x2896bc;_0x355755+=0x1){_0x546b65[_0x355755][_0xac4a('0x26')]=_0x7a948b;}this[_0xac4a('0xd')]();};RuleEngine['prototype'][_0xac4a('0x27')]=function(){var _0x482afc=this[_0xac4a('0x8')];if(_0x482afc instanceof Array){_0x482afc=_0x482afc['map'](function(_0x17e6de){_0x17e6de[_0xac4a('0x1f')]=_0x17e6de[_0xac4a('0x1f')][_0xac4a('0x28')]();_0x17e6de[_0xac4a('0x14')]=_0x17e6de[_0xac4a('0x14')][_0xac4a('0x28')]();return _0x17e6de;});}else if(!_[_0xac4a('0x1d')](_0x482afc)){_0x482afc[_0xac4a('0x1f')]=_0x482afc[_0xac4a('0x1f')][_0xac4a('0x28')]();_0x482afc[_0xac4a('0x14')]=_0x482afc[_0xac4a('0x14')][_0xac4a('0x28')]();}return _0x482afc;};RuleEngine['prototype'][_0xac4a('0x29')]=function(_0x1c41fb){this['init']();if(_[_0xac4a('0x2a')](_0x1c41fb)){_0x1c41fb=JSON[_0xac4a('0x2b')](_0x1c41fb);}if(_0x1c41fb instanceof Array){_0x1c41fb=_0x1c41fb['map'](function(_0x58804b){_0x58804b[_0xac4a('0x1f')]=eval('('+_0x58804b[_0xac4a('0x1f')]+')');_0x58804b[_0xac4a('0x14')]=eval('('+_0x58804b[_0xac4a('0x14')]+')');return _0x58804b;});}else if(_0x1c41fb!==null&&typeof _0x1c41fb=='object'){_0x1c41fb[_0xac4a('0x1f')]=eval('('+_0x1c41fb[_0xac4a('0x1f')]+')');_0x1c41fb['consequence']=eval('('+_0x1c41fb[_0xac4a('0x14')]+')');}this[_0xac4a('0x2c')](_0x1c41fb);};module[_0xac4a('0x2d')]=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(_0x2ab514,_0x55e9c3){var _0x44deb9=function(_0x50a679){while(--_0x50a679){_0x2ab514['push'](_0x2ab514['shift']());}};_0x44deb9(++_0x55e9c3);}(_0x7a54,0x106));var _0x47a5=function(_0x11d3c9,_0x3f9e35){_0x11d3c9=_0x11d3c9-0x0;var _0x52f19a=_0x7a54[_0x11d3c9];return _0x52f19a;};'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 e453b42..3ec1707 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 _0x8a55=['then','error','message','result','sendMailMessage','bluebird','jayson/promise','client','http','request'];(function(_0x44e7c9,_0x5ba370){var _0x5d7b6d=function(_0x1f2c7c){while(--_0x1f2c7c){_0x44e7c9['push'](_0x44e7c9['shift']());}};_0x5d7b6d(++_0x5ba370);}(_0x8a55,0x73));var _0x58a5=function(_0x3eb4c5,_0x3c5f7f){_0x3eb4c5=_0x3eb4c5-0x0;var _0x5d9be9=_0x8a55[_0x3eb4c5];return _0x5d9be9;};'use strict';var BPromise=require(_0x58a5('0x0'));var jayson=require(_0x58a5('0x1'));var client=jayson[_0x58a5('0x2')][_0x58a5('0x3')]({'port':0x232b});function request(_0x489859,_0x355924){return new BPromise(function(_0x34da05,_0x5bd433){return client[_0x58a5('0x4')](_0x489859,_0x355924)[_0x58a5('0x5')](function(_0x371ae1){if(_0x371ae1['error']){return _0x5bd433(_0x371ae1[_0x58a5('0x6')][_0x58a5('0x7')]);}else{return _0x34da05(_0x371ae1[_0x58a5('0x8')]);}})['catch'](function(_0x377f79){return _0x5bd433(_0x377f79);});});}exports[_0x58a5('0x9')]=function(_0x59bd46,_0x20695b){return request('SendMail',{'account':_0x59bd46,'message':_0x20695b});}; \ No newline at end of file +var _0xb65f=['http','request','error','message','result','catch','sendMailMessage','bluebird','jayson/promise','client'];(function(_0x1f2104,_0x3d1a56){var _0x590031=function(_0x16e37d){while(--_0x16e37d){_0x1f2104['push'](_0x1f2104['shift']());}};_0x590031(++_0x3d1a56);}(_0xb65f,0xcf));var _0xfb65=function(_0x42d33b,_0x107611){_0x42d33b=_0x42d33b-0x0;var _0x304c5c=_0xb65f[_0x42d33b];return _0x304c5c;};'use strict';var BPromise=require(_0xfb65('0x0'));var jayson=require(_0xfb65('0x1'));var client=jayson[_0xfb65('0x2')][_0xfb65('0x3')]({'port':0x232b});function request(_0x3f0012,_0x19507f){return new BPromise(function(_0x4d7afc,_0x58c606){return client[_0xfb65('0x4')](_0x3f0012,_0x19507f)['then'](function(_0x5b90cd){if(_0x5b90cd['error']){return _0x58c606(_0x5b90cd[_0xfb65('0x5')][_0xfb65('0x6')]);}else{return _0x4d7afc(_0x5b90cd[_0xfb65('0x7')]);}})[_0xfb65('0x8')](function(_0x97c9c9){return _0x58c606(_0x97c9c9);});});}exports[_0xfb65('0x9')]=function(_0x568c2a,_0x36f8a7){return request('SendMail',{'account':_0x568c2a,'message':_0x36f8a7});}; \ No newline at end of file diff --git a/server/services/routing/model/agent.js b/server/services/routing/model/agent.js index 544e6fb..36b87ae 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 _0xf2e3=['md5','chatWaitingInteractions','faxWaitingInteractions','mailWaitingInteractions','whatsappWaitingInteractions','updateRealtime','Capacity','CurrentCapacity','idle','prototype','chat','fax','sms','whatsapp','length','getChannelStatus','Status','format','mailStatus','openchannelCurrentCapacity','openchannelWaitingInteractions','smsWaitingInteractions','emit','user:routing:update','exports','lodash','moment','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','unknown','chatStatusTime','chatCapacity','chatCurrentCapacity','mailStatusTime','mailCapacity','mailCurrentCapacity','faxStatusTime','faxCapacity','faxCurrentCapacity','smsStatus','smsStatusTime','smsCapacity','smsCurrentCapacity','whatsappStatus','whatsappStatusTime','whatsappCapacity','whatsappCurrentCapacity','openchannelStatus','openchannelStatusTime','openchannelCapacity','busy','busyQueue'];(function(_0x1bcd13,_0x251fe4){var _0x3fbeb0=function(_0x580c1e){while(--_0x580c1e){_0x1bcd13['push'](_0x1bcd13['shift']());}};_0x3fbeb0(++_0x251fe4);}(_0xf2e3,0x9b));var _0x3f2e=function(_0x36ed48,_0x1ee0d4){_0x36ed48=_0x36ed48-0x0;var _0x51c63a=_0xf2e3[_0x36ed48];return _0x51c63a;};'use strict';var _=require(_0x3f2e('0x0'));var md5=require('md5');var moment=require(_0x3f2e('0x1'));var Redis=require(_0x3f2e('0x2'));var config=require(_0x3f2e('0x3'));config[_0x3f2e('0x4')]=_[_0x3f2e('0x5')](config[_0x3f2e('0x4')],{'host':_0x3f2e('0x6'),'port':0x18eb});var io=require(_0x3f2e('0x7'))(new Redis(config[_0x3f2e('0x4')]));function Agent(_0x5f254a){this['id']=_0x5f254a['id']||0x0;this[_0x3f2e('0x8')]=_0x5f254a[_0x3f2e('0x8')]||'';this[_0x3f2e('0x9')]=_0x5f254a[_0x3f2e('0x9')]||!![];this[_0x3f2e('0xa')]=_0x5f254a[_0x3f2e('0xa')]||![];this[_0x3f2e('0xb')]=_0x5f254a[_0x3f2e('0xb')]||![];this[_0x3f2e('0xc')]=_0x5f254a[_0x3f2e('0xc')]||![];this[_0x3f2e('0xd')]=_0x5f254a[_0x3f2e('0xd')]||![];this[_0x3f2e('0xe')]=_0x5f254a[_0x3f2e('0xe')]||![];this[_0x3f2e('0xf')]=_0x5f254a[_0x3f2e('0xf')]||![];this[_0x3f2e('0x10')]=_0x3f2e('0x11');this[_0x3f2e('0x12')]=0x0;this['chatCapacity']=_0x5f254a[_0x3f2e('0x13')]||0x0;this[_0x3f2e('0x14')]=0x0;this['mailStatus']=_0x3f2e('0x11');this[_0x3f2e('0x15')]=0x0;this[_0x3f2e('0x16')]=_0x5f254a[_0x3f2e('0x16')]||0x0;this[_0x3f2e('0x17')]=0x0;this['faxStatus']=_0x3f2e('0x11');this[_0x3f2e('0x18')]=0x0;this[_0x3f2e('0x19')]=_0x5f254a['faxCapacity']||0x0;this[_0x3f2e('0x1a')]=0x0;this[_0x3f2e('0x1b')]=_0x3f2e('0x11');this[_0x3f2e('0x1c')]=0x0;this[_0x3f2e('0x1d')]=_0x5f254a[_0x3f2e('0x1d')]||0x0;this[_0x3f2e('0x1e')]=0x0;this[_0x3f2e('0x1f')]=_0x3f2e('0x11');this[_0x3f2e('0x20')]=0x0;this[_0x3f2e('0x21')]=_0x5f254a['whatsappCapacity']||0x0;this[_0x3f2e('0x22')]=0x0;this[_0x3f2e('0x23')]=_0x3f2e('0x11');this[_0x3f2e('0x24')]=0x0;this[_0x3f2e('0x25')]=_0x5f254a['openchannelCapacity']||0x0;this['openchannelCurrentCapacity']=0x0;this[_0x3f2e('0x26')]=![];this[_0x3f2e('0x27')]=undefined;this[_0x3f2e('0x28')]='';this[_0x3f2e('0x29')]={};this[_0x3f2e('0x2a')]={};this[_0x3f2e('0x2b')]={};this['openchannelWaitingInteractions']={};this['smsWaitingInteractions']={};this[_0x3f2e('0x2c')]={};this[_0x3f2e('0x2d')]();}Agent['prototype']['getChannelStatus']=function(_0x46bb1c){if(this[_0x46bb1c+'CurrentCapacity']>0x0){if(this[_0x46bb1c+_0x3f2e('0x2e')]>0x0&&this[_0x46bb1c+_0x3f2e('0x2f')]>=this[_0x46bb1c+'Capacity']){return'maxcapacity';}else{return'working';}}else{return _0x3f2e('0x30');}};Agent[_0x3f2e('0x31')]['updateRealtime']=function(){var _0x11a7cc=['mail',_0x3f2e('0x32'),'openchannel',_0x3f2e('0x33'),_0x3f2e('0x34'),_0x3f2e('0x35')];for(var _0x9c6c34=0x0;_0x9c6c34<_0x11a7cc[_0x3f2e('0x36')];_0x9c6c34+=0x1){var _0x4799d3=this[_0x3f2e('0x37')](_0x11a7cc[_0x9c6c34]);if(this[_0x11a7cc[_0x9c6c34]+_0x3f2e('0x38')]!==_0x4799d3){this[_0x11a7cc[_0x9c6c34]+'StatusTime']=_['toNumber'](moment()[_0x3f2e('0x39')]('x'));}this[_0x11a7cc[_0x9c6c34]+_0x3f2e('0x38')]=_0x4799d3;}var _0x35f421={'id':this['id'],'name':this[_0x3f2e('0x8')],'online':this['online'],'voicePause':this[_0x3f2e('0xa')],'chatPause':this[_0x3f2e('0xb')],'mailPause':this[_0x3f2e('0xc')],'smsPause':this['smsPause'],'faxPause':this[_0x3f2e('0xd')],'openchannelPause':this[_0x3f2e('0xf')],'chatStatus':this[_0x3f2e('0x10')],'chatStatusTime':this['chatStatusTime'],'chatCapacity':this[_0x3f2e('0x13')],'chatCurrentCapacity':this[_0x3f2e('0x14')],'mailStatus':this[_0x3f2e('0x3a')],'mailStatusTime':this[_0x3f2e('0x15')],'mailCapacity':this[_0x3f2e('0x16')],'mailCurrentCapacity':this[_0x3f2e('0x17')],'faxStatus':this['faxStatus'],'faxStatusTime':this[_0x3f2e('0x18')],'faxCapacity':this[_0x3f2e('0x19')],'faxCurrentCapacity':this[_0x3f2e('0x1a')],'smsStatus':this[_0x3f2e('0x1b')],'smsStatusTime':this[_0x3f2e('0x1c')],'smsCapacity':this[_0x3f2e('0x1d')],'smsCurrentCapacity':this[_0x3f2e('0x1e')],'whatsappStatus':this['whatsappStatus'],'whatsappStatusTime':this[_0x3f2e('0x20')],'whatsappCapacity':this[_0x3f2e('0x21')],'whatsappCurrentCapacity':this[_0x3f2e('0x22')],'openchannelStatus':this[_0x3f2e('0x23')],'openchannelStatusTime':this['openchannelStatusTime'],'openchannelCapacity':this['openchannelCapacity'],'openchannelCurrentCapacity':this[_0x3f2e('0x3b')],'busy':this[_0x3f2e('0x26')],'busyQueue':this[_0x3f2e('0x27')],'chatWaitingInteractions':this[_0x3f2e('0x29')],'faxWaitingInteractions':this[_0x3f2e('0x2a')],'mailWaitingInteractions':this[_0x3f2e('0x2b')],'openchannelWaitingInteractions':this[_0x3f2e('0x3c')],'smsWaitingInteractions':this[_0x3f2e('0x3d')],'whatsappWaitingInteractions':this[_0x3f2e('0x2c')]};var _0x44e7b9=md5(JSON['stringify'](_0x35f421));if(this[_0x3f2e('0x28')]!==_0x44e7b9){this[_0x3f2e('0x28')]=_0x44e7b9;io[_0x3f2e('0x3e')](_0x3f2e('0x3f'),_['omit'](_0x35f421,[_0x3f2e('0x9')]));}};module[_0x3f2e('0x40')]=Agent; \ No newline at end of file +var _0xeb3b=['mailCapacity','faxStatusTime','faxCapacity','faxCurrentCapacity','smsCapacity','whatsappStatusTime','whatsappCapacity','openchannelStatus','openchannelStatusTime','openchannelCurrentCapacity','busyQueue','faxWaitingInteractions','mailWaitingInteractions','openchannelWaitingInteractions','whatsappWaitingInteractions','updateRealtime','getChannelStatus','Capacity','CurrentCapacity','maxcapacity','working','idle','prototype','openchannel','sms','whatsapp','length','StatusTime','toNumber','chatStatus','mailStatusTime','mailCurrentCapacity','smsStatus','smsStatusTime','smsCurrentCapacity','whatsappCurrentCapacity','openchannelCapacity','busy','smsWaitingInteractions','stringify','emit','omit','lodash','md5','moment','ioredis','../../../config/environment','redis','socket.io-emitter','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','unknown','chatStatusTime','chatCapacity','chatCurrentCapacity','mailStatus'];(function(_0x10def4,_0x4cc347){var _0x4f7382=function(_0x33b437){while(--_0x33b437){_0x10def4['push'](_0x10def4['shift']());}};_0x4f7382(++_0x4cc347);}(_0xeb3b,0x19e));var _0xbeb3=function(_0x2dfd28,_0x153b3c){_0x2dfd28=_0x2dfd28-0x0;var _0x49c016=_0xeb3b[_0x2dfd28];return _0x49c016;};'use strict';var _=require(_0xbeb3('0x0'));var md5=require(_0xbeb3('0x1'));var moment=require(_0xbeb3('0x2'));var Redis=require(_0xbeb3('0x3'));var config=require(_0xbeb3('0x4'));config['redis']=_['defaults'](config[_0xbeb3('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0xbeb3('0x6'))(new Redis(config['redis']));function Agent(_0x2e8a69){this['id']=_0x2e8a69['id']||0x0;this[_0xbeb3('0x7')]=_0x2e8a69[_0xbeb3('0x7')]||'';this[_0xbeb3('0x8')]=_0x2e8a69[_0xbeb3('0x8')]||!![];this[_0xbeb3('0x9')]=_0x2e8a69['voicePause']||![];this[_0xbeb3('0xa')]=_0x2e8a69[_0xbeb3('0xa')]||![];this[_0xbeb3('0xb')]=_0x2e8a69[_0xbeb3('0xb')]||![];this[_0xbeb3('0xc')]=_0x2e8a69[_0xbeb3('0xc')]||![];this[_0xbeb3('0xd')]=_0x2e8a69['smsPause']||![];this[_0xbeb3('0xe')]=_0x2e8a69[_0xbeb3('0xe')]||![];this['chatStatus']=_0xbeb3('0xf');this[_0xbeb3('0x10')]=0x0;this[_0xbeb3('0x11')]=_0x2e8a69[_0xbeb3('0x11')]||0x0;this[_0xbeb3('0x12')]=0x0;this[_0xbeb3('0x13')]='unknown';this['mailStatusTime']=0x0;this[_0xbeb3('0x14')]=_0x2e8a69[_0xbeb3('0x14')]||0x0;this['mailCurrentCapacity']=0x0;this['faxStatus']=_0xbeb3('0xf');this[_0xbeb3('0x15')]=0x0;this[_0xbeb3('0x16')]=_0x2e8a69[_0xbeb3('0x16')]||0x0;this[_0xbeb3('0x17')]=0x0;this['smsStatus']=_0xbeb3('0xf');this['smsStatusTime']=0x0;this[_0xbeb3('0x18')]=_0x2e8a69['smsCapacity']||0x0;this['smsCurrentCapacity']=0x0;this['whatsappStatus']=_0xbeb3('0xf');this[_0xbeb3('0x19')]=0x0;this[_0xbeb3('0x1a')]=_0x2e8a69[_0xbeb3('0x1a')]||0x0;this['whatsappCurrentCapacity']=0x0;this[_0xbeb3('0x1b')]=_0xbeb3('0xf');this[_0xbeb3('0x1c')]=0x0;this['openchannelCapacity']=_0x2e8a69['openchannelCapacity']||0x0;this[_0xbeb3('0x1d')]=0x0;this['busy']=![];this[_0xbeb3('0x1e')]=undefined;this['md5']='';this['chatWaitingInteractions']={};this[_0xbeb3('0x1f')]={};this[_0xbeb3('0x20')]={};this[_0xbeb3('0x21')]={};this['smsWaitingInteractions']={};this[_0xbeb3('0x22')]={};this[_0xbeb3('0x23')]();}Agent['prototype'][_0xbeb3('0x24')]=function(_0x366bdb){if(this[_0x366bdb+'CurrentCapacity']>0x0){if(this[_0x366bdb+_0xbeb3('0x25')]>0x0&&this[_0x366bdb+_0xbeb3('0x26')]>=this[_0x366bdb+_0xbeb3('0x25')]){return _0xbeb3('0x27');}else{return _0xbeb3('0x28');}}else{return _0xbeb3('0x29');}};Agent[_0xbeb3('0x2a')][_0xbeb3('0x23')]=function(){var _0x46fe17=['mail','chat',_0xbeb3('0x2b'),'fax',_0xbeb3('0x2c'),_0xbeb3('0x2d')];for(var _0x138adf=0x0;_0x138adf<_0x46fe17[_0xbeb3('0x2e')];_0x138adf+=0x1){var _0x4fa3c7=this[_0xbeb3('0x24')](_0x46fe17[_0x138adf]);if(this[_0x46fe17[_0x138adf]+'Status']!==_0x4fa3c7){this[_0x46fe17[_0x138adf]+_0xbeb3('0x2f')]=_[_0xbeb3('0x30')](moment()['format']('x'));}this[_0x46fe17[_0x138adf]+'Status']=_0x4fa3c7;}var _0x9b8f13={'id':this['id'],'name':this['name'],'online':this['online'],'voicePause':this['voicePause'],'chatPause':this['chatPause'],'mailPause':this[_0xbeb3('0xb')],'smsPause':this['smsPause'],'faxPause':this[_0xbeb3('0xc')],'openchannelPause':this[_0xbeb3('0xe')],'chatStatus':this[_0xbeb3('0x31')],'chatStatusTime':this[_0xbeb3('0x10')],'chatCapacity':this[_0xbeb3('0x11')],'chatCurrentCapacity':this[_0xbeb3('0x12')],'mailStatus':this[_0xbeb3('0x13')],'mailStatusTime':this[_0xbeb3('0x32')],'mailCapacity':this[_0xbeb3('0x14')],'mailCurrentCapacity':this[_0xbeb3('0x33')],'faxStatus':this['faxStatus'],'faxStatusTime':this[_0xbeb3('0x15')],'faxCapacity':this[_0xbeb3('0x16')],'faxCurrentCapacity':this['faxCurrentCapacity'],'smsStatus':this[_0xbeb3('0x34')],'smsStatusTime':this[_0xbeb3('0x35')],'smsCapacity':this[_0xbeb3('0x18')],'smsCurrentCapacity':this[_0xbeb3('0x36')],'whatsappStatus':this['whatsappStatus'],'whatsappStatusTime':this[_0xbeb3('0x19')],'whatsappCapacity':this[_0xbeb3('0x1a')],'whatsappCurrentCapacity':this[_0xbeb3('0x37')],'openchannelStatus':this[_0xbeb3('0x1b')],'openchannelStatusTime':this[_0xbeb3('0x1c')],'openchannelCapacity':this[_0xbeb3('0x38')],'openchannelCurrentCapacity':this[_0xbeb3('0x1d')],'busy':this[_0xbeb3('0x39')],'busyQueue':this[_0xbeb3('0x1e')],'chatWaitingInteractions':this['chatWaitingInteractions'],'faxWaitingInteractions':this[_0xbeb3('0x1f')],'mailWaitingInteractions':this['mailWaitingInteractions'],'openchannelWaitingInteractions':this[_0xbeb3('0x21')],'smsWaitingInteractions':this[_0xbeb3('0x3a')],'whatsappWaitingInteractions':this[_0xbeb3('0x22')]};var _0xaacc67=md5(JSON[_0xbeb3('0x3b')](_0x9b8f13));if(this[_0xbeb3('0x1')]!==_0xaacc67){this[_0xbeb3('0x1')]=_0xaacc67;io[_0xbeb3('0x3c')]('user:routing:update',_[_0xbeb3('0x3d')](_0x9b8f13,['online']));}};module['exports']=Agent; \ No newline at end of file diff --git a/server/services/routing/model/chatQueue.js b/server/services/routing/model/chatQueue.js index de28953..704fcbf 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 _0x47f8=['defaults','localhost','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','_rr','prototype','loggedIn','paused','online','chatPause','available','stringify','md5','format','chat:queue:%s','lodash','ioredis','../../../config/environment','redis'];(function(_0x143040,_0x23b046){var _0x47e996=function(_0x495cbd){while(--_0x495cbd){_0x143040['push'](_0x143040['shift']());}};_0x47e996(++_0x23b046);}(_0x47f8,0x11a));var _0x847f=function(_0x7d14f8,_0x34c60c){_0x7d14f8=_0x7d14f8-0x0;var _0x1b0468=_0x47f8[_0x7d14f8];return _0x1b0468;};'use strict';var _=require(_0x847f('0x0'));var md5=require('md5');var util=require('util');var Redis=require(_0x847f('0x1'));var config=require(_0x847f('0x2'));config[_0x847f('0x3')]=_[_0x847f('0x4')](config[_0x847f('0x3')],{'host':_0x847f('0x5'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x847f('0x3')]));function ChatQueue(_0x147a6f){this['id']=_0x147a6f['id']||0x0;this[_0x847f('0x6')]=_0x147a6f[_0x847f('0x6')]||'';this[_0x847f('0x7')]=_0x147a6f[_0x847f('0x7')]||0xa;this[_0x847f('0x8')]=_0x147a6f['strategy']||_0x847f('0x9');this[_0x847f('0xa')]=_0x147a6f[_0x847f('0xa')];this[_0x847f('0xb')]={};this[_0x847f('0xc')]=0x0;this['md5']='';this[_0x847f('0xd')]();this[_0x847f('0xe')]();}ChatQueue['prototype'][_0x847f('0xd')]=function(){var _0x19abdf=this['mapAgentsId'][_0x847f('0xf')];this[_0x847f('0xb')]=_['map'](this[_0x847f('0xa')],'id');this[_0x847f('0xb')]['_rr']=_0x19abdf;};ChatQueue[_0x847f('0x10')][_0x847f('0xe')]=function(){this[_0x847f('0x11')]=0x0;this[_0x847f('0x12')]=0x0;for(var _0x392a81=0x0;_0x392a81=0x0?this['available']:0x0;var _0xf6e0d9={'id':this['id'],'available':this[_0x847f('0x15')],'loggedIn':this['loggedIn'],'name':this[_0x847f('0x6')],'paused':this['paused'],'waiting':this[_0x847f('0xc')]};var _0x6c9c1c=md5(JSON[_0x847f('0x16')](_0xf6e0d9));if(this[_0x847f('0x17')]!==_0x6c9c1c){this[_0x847f('0x17')]=_0x6c9c1c;io['to'](util[_0x847f('0x18')](_0x847f('0x19'),_0xf6e0d9[_0x847f('0x6')]))['emit']('chat_queue:save',_0xf6e0d9);}};module['exports']=ChatQueue; \ No newline at end of file +var _0xdf33=['loggedIn','paused','length','online','chatPause','available','stringify','emit','exports','lodash','md5','ioredis','../../../config/environment','defaults','localhost','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','map'];(function(_0x2b8682,_0x2492fe){var _0x51ae26=function(_0x1dd294){while(--_0x1dd294){_0x2b8682['push'](_0x2b8682['shift']());}};_0x51ae26(++_0x2492fe);}(_0xdf33,0x183));var _0x3df3=function(_0x15e42e,_0x2c4612){_0x15e42e=_0x15e42e-0x0;var _0x128ba7=_0xdf33[_0x15e42e];return _0x128ba7;};'use strict';var _=require(_0x3df3('0x0'));var md5=require(_0x3df3('0x1'));var util=require('util');var Redis=require(_0x3df3('0x2'));var config=require(_0x3df3('0x3'));config['redis']=_[_0x3df3('0x4')](config['redis'],{'host':_0x3df3('0x5'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function ChatQueue(_0xc635c9){this['id']=_0xc635c9['id']||0x0;this[_0x3df3('0x6')]=_0xc635c9[_0x3df3('0x6')]||'';this[_0x3df3('0x7')]=_0xc635c9[_0x3df3('0x7')]||0xa;this[_0x3df3('0x8')]=_0xc635c9[_0x3df3('0x8')]||_0x3df3('0x9');this[_0x3df3('0xa')]=_0xc635c9[_0x3df3('0xa')];this[_0x3df3('0xb')]={};this[_0x3df3('0xc')]=0x0;this[_0x3df3('0x1')]='';this[_0x3df3('0xd')]();this[_0x3df3('0xe')]();}ChatQueue[_0x3df3('0xf')][_0x3df3('0xd')]=function(){var _0x17887c=this['mapAgentsId'][_0x3df3('0x10')];this[_0x3df3('0xb')]=_[_0x3df3('0x11')](this[_0x3df3('0xa')],'id');this[_0x3df3('0xb')]['_rr']=_0x17887c;};ChatQueue[_0x3df3('0xf')]['updateRealtime']=function(){this[_0x3df3('0x12')]=0x0;this[_0x3df3('0x13')]=0x0;for(var _0x487939=0x0;_0x487939=0x0?this['available']:0x0;var _0x255528={'id':this['id'],'available':this[_0x3df3('0x17')],'loggedIn':this[_0x3df3('0x12')],'name':this[_0x3df3('0x6')],'paused':this['paused'],'waiting':this[_0x3df3('0xc')]};var _0x2caa7d=md5(JSON[_0x3df3('0x18')](_0x255528));if(this[_0x3df3('0x1')]!==_0x2caa7d){this[_0x3df3('0x1')]=_0x2caa7d;io['to'](util['format']('chat:queue:%s',_0x255528[_0x3df3('0x6')]))[_0x3df3('0x19')]('chat_queue:save',_0x255528);}};module[_0x3df3('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 710fc8e..3a7df13 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 _0xee1b=['paused','length','online','faxPause','available','stringify','format','emit','exports','lodash','md5','util','../../../config/environment','redis','defaults','socket.io-emitter','name','timeout','strategy','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','loggedIn'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xee1b,0x75));var _0xbee1=function(_0x431a22,_0x398615){_0x431a22=_0x431a22-0x0;var _0x3ce751=_0xee1b[_0x431a22];return _0x3ce751;};'use strict';var _=require(_0xbee1('0x0'));var md5=require(_0xbee1('0x1'));var util=require(_0xbee1('0x2'));var Redis=require('ioredis');var config=require(_0xbee1('0x3'));config[_0xbee1('0x4')]=_[_0xbee1('0x5')](config[_0xbee1('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0xbee1('0x6'))(new Redis(config['redis']));function FaxQueue(_0x48619){this['id']=_0x48619['id']||0x0;this['name']=_0x48619[_0xbee1('0x7')]||'';this[_0xbee1('0x8')]=_0x48619[_0xbee1('0x8')]||0xa;this[_0xbee1('0x9')]=_0x48619[_0xbee1('0x9')]||'beepall';this[_0xbee1('0xa')]=_0x48619['Agents'];this[_0xbee1('0xb')]={};this[_0xbee1('0xc')]=0x0;this[_0xbee1('0x1')]='';this[_0xbee1('0xd')]();this[_0xbee1('0xe')]();}FaxQueue[_0xbee1('0xf')][_0xbee1('0xd')]=function(){var _0x54d6e1=this[_0xbee1('0xb')][_0xbee1('0x10')];this[_0xbee1('0xb')]=_['map'](this[_0xbee1('0xa')],'id');this[_0xbee1('0xb')][_0xbee1('0x10')]=_0x54d6e1;};FaxQueue[_0xbee1('0xf')]['updateRealtime']=function(){this[_0xbee1('0x11')]=0x0;this[_0xbee1('0x12')]=0x0;for(var _0x2e64bc=0x0;_0x2e64bc=0x0?this[_0xbee1('0x16')]:0x0;var _0x2d103c={'id':this['id'],'available':this[_0xbee1('0x16')],'loggedIn':this[_0xbee1('0x11')],'name':this[_0xbee1('0x7')],'paused':this[_0xbee1('0x12')],'waiting':this[_0xbee1('0xc')]};var _0x324c9=md5(JSON[_0xbee1('0x17')](_0x2d103c));if(this[_0xbee1('0x1')]!==_0x324c9){this[_0xbee1('0x1')]=_0x324c9;io['to'](util[_0xbee1('0x18')]('fax:queue:%s',_0x2d103c['name']))[_0xbee1('0x19')]('fax_queue:save',_0x2d103c);}};module[_0xbee1('0x1a')]=FaxQueue; \ No newline at end of file +var _0x6564=['defaults','localhost','socket.io-emitter','name','timeout','strategy','Agents','waiting','prototype','updateRouting','mapAgentsId','_rr','updateRealtime','loggedIn','paused','length','faxPause','available','format','fax:queue:%s','emit','fax_queue:save','exports','md5','../../../config/environment','redis'];(function(_0x137d80,_0x4ca815){var _0x406c15=function(_0x1f0e13){while(--_0x1f0e13){_0x137d80['push'](_0x137d80['shift']());}};_0x406c15(++_0x4ca815);}(_0x6564,0x169));var _0x4656=function(_0x446de8,_0x25d27d){_0x446de8=_0x446de8-0x0;var _0x219cd7=_0x6564[_0x446de8];return _0x219cd7;};'use strict';var _=require('lodash');var md5=require(_0x4656('0x0'));var util=require('util');var Redis=require('ioredis');var config=require(_0x4656('0x1'));config[_0x4656('0x2')]=_[_0x4656('0x3')](config[_0x4656('0x2')],{'host':_0x4656('0x4'),'port':0x18eb});var io=require(_0x4656('0x5'))(new Redis(config[_0x4656('0x2')]));function FaxQueue(_0xbcf9a6){this['id']=_0xbcf9a6['id']||0x0;this[_0x4656('0x6')]=_0xbcf9a6[_0x4656('0x6')]||'';this['timeout']=_0xbcf9a6[_0x4656('0x7')]||0xa;this['strategy']=_0xbcf9a6[_0x4656('0x8')]||'beepall';this[_0x4656('0x9')]=_0xbcf9a6[_0x4656('0x9')];this['mapAgentsId']={};this[_0x4656('0xa')]=0x0;this[_0x4656('0x0')]='';this['updateRouting']();this['updateRealtime']();}FaxQueue[_0x4656('0xb')][_0x4656('0xc')]=function(){var _0x532b5a=this[_0x4656('0xd')][_0x4656('0xe')];this['mapAgentsId']=_['map'](this[_0x4656('0x9')],'id');this['mapAgentsId'][_0x4656('0xe')]=_0x532b5a;};FaxQueue[_0x4656('0xb')][_0x4656('0xf')]=function(){this[_0x4656('0x10')]=0x0;this[_0x4656('0x11')]=0x0;for(var _0x466f49=0x0;_0x466f49=0x0?this[_0x4656('0x14')]:0x0;var _0x384fcb={'id':this['id'],'available':this[_0x4656('0x14')],'loggedIn':this['loggedIn'],'name':this['name'],'paused':this[_0x4656('0x11')],'waiting':this[_0x4656('0xa')]};var _0x5dfd75=md5(JSON['stringify'](_0x384fcb));if(this[_0x4656('0x0')]!==_0x5dfd75){this['md5']=_0x5dfd75;io['to'](util[_0x4656('0x15')](_0x4656('0x16'),_0x384fcb['name']))[_0x4656('0x17')](_0x4656('0x18'),_0x384fcb);}};module[_0x4656('0x19')]=FaxQueue; \ No newline at end of file diff --git a/server/services/routing/model/interval.js b/server/services/routing/model/interval.js index a0e8c24..552d395 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 _0x8722=['Intervals','exports'];(function(_0x4e4d69,_0x440f08){var _0xf89658=function(_0x3c7c75){while(--_0x3c7c75){_0x4e4d69['push'](_0x4e4d69['shift']());}};_0xf89658(++_0x440f08);}(_0x8722,0x1c4));var _0x2872=function(_0x53895f,_0xbe8b6){_0x53895f=_0x53895f-0x0;var _0x56dcdf=_0x8722[_0x53895f];return _0x56dcdf;};'use strict';function Interval(_0x58e3bd){this['id']=_0x58e3bd['id']||0x0;this['name']=_0x58e3bd['name']||'';this[_0x2872('0x0')]=_0x58e3bd[_0x2872('0x0')]||{};}module[_0x2872('0x1')]=Interval; \ No newline at end of file +var _0x53b8=['Intervals','exports','name'];(function(_0x4ee0e9,_0x2ff82a){var _0x2605ff=function(_0x4d4194){while(--_0x4d4194){_0x4ee0e9['push'](_0x4ee0e9['shift']());}};_0x2605ff(++_0x2ff82a);}(_0x53b8,0x1f1));var _0x853b=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x53b8[_0xfae23b];return _0x200640;};'use strict';function Interval(_0x2d57a0){this['id']=_0x2d57a0['id']||0x0;this['name']=_0x2d57a0[_0x853b('0x0')]||'';this['Intervals']=_0x2d57a0[_0x853b('0x1')]||{};}module[_0x853b('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 f1f7c84..d4d31c2 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 _0x2a15=['md5','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','paused','length','online','mailPause','available','loggedIn','stringify','format','mail:queue:%s','emit','mail_queue:save'];(function(_0x5c14d7,_0x19af24){var _0x54cf7c=function(_0x405795){while(--_0x405795){_0x5c14d7['push'](_0x5c14d7['shift']());}};_0x54cf7c(++_0x19af24);}(_0x2a15,0x16c));var _0x52a1=function(_0x493c46,_0x386eee){_0x493c46=_0x493c46-0x0;var _0x2d8d06=_0x2a15[_0x493c46];return _0x2d8d06;};'use strict';var _=require('lodash');var md5=require(_0x52a1('0x0'));var util=require('util');var Redis=require(_0x52a1('0x1'));var config=require(_0x52a1('0x2'));config[_0x52a1('0x3')]=_[_0x52a1('0x4')](config[_0x52a1('0x3')],{'host':_0x52a1('0x5'),'port':0x18eb});var io=require(_0x52a1('0x6'))(new Redis(config[_0x52a1('0x3')]));function MailQueue(_0x1782b7){this['id']=_0x1782b7['id']||0x0;this[_0x52a1('0x7')]=_0x1782b7[_0x52a1('0x7')]||'';this[_0x52a1('0x8')]=_0x1782b7[_0x52a1('0x8')]||0xa;this['strategy']=_0x1782b7[_0x52a1('0x9')]||_0x52a1('0xa');this[_0x52a1('0xb')]=_0x1782b7[_0x52a1('0xb')];this[_0x52a1('0xc')]={};this[_0x52a1('0xd')]=0x0;this[_0x52a1('0x0')]='';this[_0x52a1('0xe')]();this[_0x52a1('0xf')]();}MailQueue['prototype'][_0x52a1('0xe')]=function(){var _0x1109e0=this['mapAgentsId']['_rr'];this[_0x52a1('0xc')]=_['map'](this['Agents'],'id');this['mapAgentsId']['_rr']=_0x1109e0;};MailQueue[_0x52a1('0x10')]['updateRealtime']=function(){this['loggedIn']=0x0;this[_0x52a1('0x11')]=0x0;for(var _0x1abc01=0x0;_0x1abc01=0x0?this[_0x52a1('0x15')]:0x0;var _0x17e4a4={'id':this['id'],'available':this[_0x52a1('0x15')],'loggedIn':this[_0x52a1('0x16')],'name':this[_0x52a1('0x7')],'paused':this[_0x52a1('0x11')],'waiting':this[_0x52a1('0xd')]};var _0x3e6d71=md5(JSON[_0x52a1('0x17')](_0x17e4a4));if(this[_0x52a1('0x0')]!==_0x3e6d71){this['md5']=_0x3e6d71;io['to'](util[_0x52a1('0x18')](_0x52a1('0x19'),_0x17e4a4[_0x52a1('0x7')]))[_0x52a1('0x1a')](_0x52a1('0x1b'),_0x17e4a4);}};module['exports']=MailQueue; \ No newline at end of file +var _0x1815=['mailPause','available','stringify','emit','lodash','md5','util','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','waiting','updateRouting','updateRealtime','mapAgentsId','map','loggedIn','paused','length'];(function(_0x5d2926,_0x14ebd6){var _0x117a63=function(_0x2309da){while(--_0x2309da){_0x5d2926['push'](_0x5d2926['shift']());}};_0x117a63(++_0x14ebd6);}(_0x1815,0x9a));var _0x5181=function(_0xc06638,_0x68dc26){_0xc06638=_0xc06638-0x0;var _0x34e96c=_0x1815[_0xc06638];return _0x34e96c;};'use strict';var _=require(_0x5181('0x0'));var md5=require(_0x5181('0x1'));var util=require(_0x5181('0x2'));var Redis=require(_0x5181('0x3'));var config=require(_0x5181('0x4'));config[_0x5181('0x5')]=_['defaults'](config[_0x5181('0x5')],{'host':_0x5181('0x6'),'port':0x18eb});var io=require(_0x5181('0x7'))(new Redis(config[_0x5181('0x5')]));function MailQueue(_0x60ef7c){this['id']=_0x60ef7c['id']||0x0;this[_0x5181('0x8')]=_0x60ef7c[_0x5181('0x8')]||'';this[_0x5181('0x9')]=_0x60ef7c[_0x5181('0x9')]||0xa;this[_0x5181('0xa')]=_0x60ef7c[_0x5181('0xa')]||_0x5181('0xb');this['Agents']=_0x60ef7c[_0x5181('0xc')];this['mapAgentsId']={};this[_0x5181('0xd')]=0x0;this[_0x5181('0x1')]='';this[_0x5181('0xe')]();this[_0x5181('0xf')]();}MailQueue['prototype']['updateRouting']=function(){var _0x5743ad=this[_0x5181('0x10')]['_rr'];this[_0x5181('0x10')]=_[_0x5181('0x11')](this['Agents'],'id');this['mapAgentsId']['_rr']=_0x5743ad;};MailQueue['prototype'][_0x5181('0xf')]=function(){this[_0x5181('0x12')]=0x0;this[_0x5181('0x13')]=0x0;for(var _0x4b8391=0x0;_0x4b8391=0x0?this[_0x5181('0x16')]:0x0;var _0x373e57={'id':this['id'],'available':this[_0x5181('0x16')],'loggedIn':this[_0x5181('0x12')],'name':this[_0x5181('0x8')],'paused':this[_0x5181('0x13')],'waiting':this[_0x5181('0xd')]};var _0x452fbc=md5(JSON[_0x5181('0x17')](_0x373e57));if(this[_0x5181('0x1')]!==_0x452fbc){this[_0x5181('0x1')]=_0x452fbc;io['to'](util['format']('mail:queue:%s',_0x373e57[_0x5181('0x8')]))[_0x5181('0x18')]('mail_queue:save',_0x373e57);}};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 80dd0f8..fd2556f 100644 --- a/server/services/routing/model/openchannelQueue.js +++ b/server/services/routing/model/openchannelQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x326f=['exports','lodash','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','mapAgentsId','waiting','md5','updateRouting','updateRealtime','Agents','prototype','loggedIn','paused','online','openchannelPause','available','stringify','openchannel:queue:%s','openchannel_queue:save'];(function(_0x5f0089,_0x227e2c){var _0x193892=function(_0x24051f){while(--_0x24051f){_0x5f0089['push'](_0x5f0089['shift']());}};_0x193892(++_0x227e2c);}(_0x326f,0xd1));var _0xf326=function(_0x36c0d7,_0x834de5){_0x36c0d7=_0x36c0d7-0x0;var _0x2197da=_0x326f[_0x36c0d7];return _0x2197da;};'use strict';var _=require(_0xf326('0x0'));var md5=require('md5');var util=require('util');var Redis=require(_0xf326('0x1'));var config=require(_0xf326('0x2'));config[_0xf326('0x3')]=_[_0xf326('0x4')](config[_0xf326('0x3')],{'host':_0xf326('0x5'),'port':0x18eb});var io=require(_0xf326('0x6'))(new Redis(config[_0xf326('0x3')]));function OpenchannelQueue(_0x1b5a56){this['id']=_0x1b5a56['id']||0x0;this[_0xf326('0x7')]=_0x1b5a56['name']||'';this[_0xf326('0x8')]=_0x1b5a56[_0xf326('0x8')]||0xa;this[_0xf326('0x9')]=_0x1b5a56[_0xf326('0x9')]||'beepall';this['Agents']=_0x1b5a56['Agents'];this[_0xf326('0xa')]={};this[_0xf326('0xb')]=0x0;this[_0xf326('0xc')]='';this[_0xf326('0xd')]();this[_0xf326('0xe')]();}OpenchannelQueue['prototype'][_0xf326('0xd')]=function(){var _0x53cbcd=this[_0xf326('0xa')]['_rr'];this[_0xf326('0xa')]=_['map'](this[_0xf326('0xf')],'id');this[_0xf326('0xa')]['_rr']=_0x53cbcd;};OpenchannelQueue[_0xf326('0x10')][_0xf326('0xe')]=function(){this[_0xf326('0x11')]=0x0;this[_0xf326('0x12')]=0x0;for(var _0x5c8483=0x0;_0x5c8483=0x0?this[_0xf326('0x15')]:0x0;var _0x18bee3={'id':this['id'],'available':this[_0xf326('0x15')],'loggedIn':this[_0xf326('0x11')],'name':this[_0xf326('0x7')],'paused':this['paused'],'waiting':this['waiting']};var _0x56ad41=md5(JSON[_0xf326('0x16')](_0x18bee3));if(this[_0xf326('0xc')]!==_0x56ad41){this['md5']=_0x56ad41;io['to'](util['format'](_0xf326('0x17'),_0x18bee3['name']))['emit'](_0xf326('0x18'),_0x18bee3);}};module[_0xf326('0x19')]=OpenchannelQueue; \ No newline at end of file +var _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(_0x15a11b,_0x3a1948){var _0x4b2487=function(_0x20c9ec){while(--_0x20c9ec){_0x15a11b['push'](_0x15a11b['shift']());}};_0x4b2487(++_0x3a1948);}(_0x814b,0x1a2));var _0xb814=function(_0x4b6507,_0x5518b5){_0x4b6507=_0x4b6507-0x0;var _0x2001ec=_0x814b[_0x4b6507];return _0x2001ec;};'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 3ba5794..ac75a1a 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 _0x44ae=['mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','loggedIn','paused','length','online','smsPause','available','format','sms:queue:%s','emit','sms_queue:save','exports','lodash','md5','util','ioredis','redis','localhost','socket.io-emitter','name','timeout','strategy','Agents'];(function(_0x4ffede,_0xe8c9ef){var _0x2891bf=function(_0x52d218){while(--_0x52d218){_0x4ffede['push'](_0x4ffede['shift']());}};_0x2891bf(++_0xe8c9ef);}(_0x44ae,0x17d));var _0xe44a=function(_0x29bef7,_0x5127f0){_0x29bef7=_0x29bef7-0x0;var _0x1ba0c1=_0x44ae[_0x29bef7];return _0x1ba0c1;};'use strict';var _=require(_0xe44a('0x0'));var md5=require(_0xe44a('0x1'));var util=require(_0xe44a('0x2'));var Redis=require(_0xe44a('0x3'));var config=require('../../../config/environment');config[_0xe44a('0x4')]=_['defaults'](config[_0xe44a('0x4')],{'host':_0xe44a('0x5'),'port':0x18eb});var io=require(_0xe44a('0x6'))(new Redis(config[_0xe44a('0x4')]));function SmsQueue(_0x1a8842){this['id']=_0x1a8842['id']||0x0;this[_0xe44a('0x7')]=_0x1a8842['name']||'';this[_0xe44a('0x8')]=_0x1a8842[_0xe44a('0x8')]||0xa;this[_0xe44a('0x9')]=_0x1a8842[_0xe44a('0x9')]||'beepall';this[_0xe44a('0xa')]=_0x1a8842[_0xe44a('0xa')];this[_0xe44a('0xb')]={};this[_0xe44a('0xc')]=0x0;this['md5']='';this[_0xe44a('0xd')]();this[_0xe44a('0xe')]();}SmsQueue[_0xe44a('0xf')][_0xe44a('0xd')]=function(){var _0xe19628=this[_0xe44a('0xb')][_0xe44a('0x10')];this['mapAgentsId']=_['map'](this['Agents'],'id');this[_0xe44a('0xb')][_0xe44a('0x10')]=_0xe19628;};SmsQueue[_0xe44a('0xf')]['updateRealtime']=function(){this[_0xe44a('0x11')]=0x0;this[_0xe44a('0x12')]=0x0;for(var _0x3656b2=0x0;_0x3656b2=0x0?this[_0xe44a('0x16')]:0x0;var _0x509f30={'id':this['id'],'available':this[_0xe44a('0x16')],'loggedIn':this[_0xe44a('0x11')],'name':this[_0xe44a('0x7')],'paused':this[_0xe44a('0x12')],'waiting':this[_0xe44a('0xc')]};var _0x33e9ac=md5(JSON['stringify'](_0x509f30));if(this[_0xe44a('0x1')]!==_0x33e9ac){this['md5']=_0x33e9ac;io['to'](util[_0xe44a('0x17')](_0xe44a('0x18'),_0x509f30[_0xe44a('0x7')]))[_0xe44a('0x19')](_0xe44a('0x1a'),_0x509f30);}};module[_0xe44a('0x1b')]=SmsQueue; \ No newline at end of file +var _0x097c=['map','length','online','paused','loggedIn','available','format','emit','sms_queue:save','exports','lodash','md5','util','../../../config/environment','redis','defaults','socket.io-emitter','name','timeout','strategy','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr'];(function(_0x2642cb,_0x4b917f){var _0xe6e41=function(_0x281676){while(--_0x281676){_0x2642cb['push'](_0x2642cb['shift']());}};_0xe6e41(++_0x4b917f);}(_0x097c,0x1d5));var _0xc097=function(_0x2320fb,_0x1fe38b){_0x2320fb=_0x2320fb-0x0;var _0x5189de=_0x097c[_0x2320fb];return _0x5189de;};'use strict';var _=require(_0xc097('0x0'));var md5=require(_0xc097('0x1'));var util=require(_0xc097('0x2'));var Redis=require('ioredis');var config=require(_0xc097('0x3'));config[_0xc097('0x4')]=_[_0xc097('0x5')](config[_0xc097('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0xc097('0x6'))(new Redis(config['redis']));function SmsQueue(_0x22fe81){this['id']=_0x22fe81['id']||0x0;this[_0xc097('0x7')]=_0x22fe81[_0xc097('0x7')]||'';this[_0xc097('0x8')]=_0x22fe81['timeout']||0xa;this[_0xc097('0x9')]=_0x22fe81['strategy']||'beepall';this[_0xc097('0xa')]=_0x22fe81[_0xc097('0xa')];this[_0xc097('0xb')]={};this[_0xc097('0xc')]=0x0;this[_0xc097('0x1')]='';this[_0xc097('0xd')]();this[_0xc097('0xe')]();}SmsQueue[_0xc097('0xf')][_0xc097('0xd')]=function(){var _0x48c376=this[_0xc097('0xb')][_0xc097('0x10')];this['mapAgentsId']=_[_0xc097('0x11')](this[_0xc097('0xa')],'id');this[_0xc097('0xb')][_0xc097('0x10')]=_0x48c376;};SmsQueue[_0xc097('0xf')][_0xc097('0xe')]=function(){this['loggedIn']=0x0;this['paused']=0x0;for(var _0x42fd3a=0x0;_0x42fd3a=0x0?this[_0xc097('0x16')]:0x0;var _0x560cbb={'id':this['id'],'available':this[_0xc097('0x16')],'loggedIn':this[_0xc097('0x15')],'name':this[_0xc097('0x7')],'paused':this[_0xc097('0x14')],'waiting':this['waiting']};var _0x38da65=md5(JSON['stringify'](_0x560cbb));if(this['md5']!==_0x38da65){this['md5']=_0x38da65;io['to'](util[_0xc097('0x17')]('sms:queue:%s',_0x560cbb['name']))[_0xc097('0x18')](_0xc097('0x19'),_0x560cbb);}};module[_0xc097('0x1a')]=SmsQueue; \ No newline at end of file diff --git a/server/services/routing/model/whatsappQueue.js b/server/services/routing/model/whatsappQueue.js index 8af6b97..64da7e7 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 _0x4b03=['updateRealtime','prototype','map','loggedIn','paused','online','available','format','emit','md5','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','Agents','mapAgentsId','waiting','updateRouting'];(function(_0x1653b1,_0x35b7d1){var _0x3e0b17=function(_0x5f21fc){while(--_0x5f21fc){_0x1653b1['push'](_0x1653b1['shift']());}};_0x3e0b17(++_0x35b7d1);}(_0x4b03,0x1c1));var _0x34b0=function(_0x2e2b1f,_0x37c2a0){_0x2e2b1f=_0x2e2b1f-0x0;var _0x53306f=_0x4b03[_0x2e2b1f];return _0x53306f;};'use strict';var _=require('lodash');var md5=require(_0x34b0('0x0'));var util=require('util');var Redis=require(_0x34b0('0x1'));var config=require(_0x34b0('0x2'));config[_0x34b0('0x3')]=_['defaults'](config['redis'],{'host':_0x34b0('0x4'),'port':0x18eb});var io=require(_0x34b0('0x5'))(new Redis(config[_0x34b0('0x3')]));function WhatsappQueue(_0x20c5a7){this['id']=_0x20c5a7['id']||0x0;this[_0x34b0('0x6')]=_0x20c5a7[_0x34b0('0x6')]||'';this[_0x34b0('0x7')]=_0x20c5a7[_0x34b0('0x7')]||0xa;this[_0x34b0('0x8')]=_0x20c5a7[_0x34b0('0x8')]||'beepall';this[_0x34b0('0x9')]=_0x20c5a7[_0x34b0('0x9')];this[_0x34b0('0xa')]={};this[_0x34b0('0xb')]=0x0;this[_0x34b0('0x0')]='';this[_0x34b0('0xc')]();this[_0x34b0('0xd')]();}WhatsappQueue[_0x34b0('0xe')][_0x34b0('0xc')]=function(){var _0x5ca5ff=this[_0x34b0('0xa')]['_rr'];this['mapAgentsId']=_[_0x34b0('0xf')](this[_0x34b0('0x9')],'id');this[_0x34b0('0xa')]['_rr']=_0x5ca5ff;};WhatsappQueue['prototype']['updateRealtime']=function(){this[_0x34b0('0x10')]=0x0;this[_0x34b0('0x11')]=0x0;for(var _0x82c515=0x0;_0x82c515=0x0?this[_0x34b0('0x13')]:0x0;var _0x1e93fb={'id':this['id'],'available':this[_0x34b0('0x13')],'loggedIn':this[_0x34b0('0x10')],'name':this[_0x34b0('0x6')],'paused':this[_0x34b0('0x11')],'waiting':this['waiting']};var _0x560b6e=md5(JSON['stringify'](_0x1e93fb));if(this[_0x34b0('0x0')]!==_0x560b6e){this['md5']=_0x560b6e;io['to'](util[_0x34b0('0x14')]('whatsapp:queue:%s',_0x1e93fb[_0x34b0('0x6')]))[_0x34b0('0x15')]('whatsapp_queue:save',_0x1e93fb);}};module['exports']=WhatsappQueue; \ No newline at end of file +var _0x347f=['util','ioredis','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','Agents','waiting','updateRouting','updateRealtime','prototype','_rr','mapAgentsId','map','loggedIn','length','online','whatsappPause','paused','available','format','exports','lodash','md5'];(function(_0x50b20c,_0x219378){var _0x4dcedd=function(_0x2032d6){while(--_0x2032d6){_0x50b20c['push'](_0x50b20c['shift']());}};_0x4dcedd(++_0x219378);}(_0x347f,0x15d));var _0xf347=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x347f[_0x17d9e3];return _0x14192d;};'use strict';var _=require(_0xf347('0x0'));var md5=require(_0xf347('0x1'));var util=require(_0xf347('0x2'));var Redis=require(_0xf347('0x3'));var config=require('../../../config/environment');config[_0xf347('0x4')]=_[_0xf347('0x5')](config['redis'],{'host':_0xf347('0x6'),'port':0x18eb});var io=require(_0xf347('0x7'))(new Redis(config[_0xf347('0x4')]));function WhatsappQueue(_0xa87e3){this['id']=_0xa87e3['id']||0x0;this[_0xf347('0x8')]=_0xa87e3['name']||'';this[_0xf347('0x9')]=_0xa87e3['timeout']||0xa;this[_0xf347('0xa')]=_0xa87e3[_0xf347('0xa')]||'beepall';this[_0xf347('0xb')]=_0xa87e3['Agents'];this['mapAgentsId']={};this[_0xf347('0xc')]=0x0;this['md5']='';this[_0xf347('0xd')]();this[_0xf347('0xe')]();}WhatsappQueue[_0xf347('0xf')][_0xf347('0xd')]=function(){var _0x45d8fa=this['mapAgentsId'][_0xf347('0x10')];this[_0xf347('0x11')]=_[_0xf347('0x12')](this[_0xf347('0xb')],'id');this[_0xf347('0x11')][_0xf347('0x10')]=_0x45d8fa;};WhatsappQueue[_0xf347('0xf')][_0xf347('0xe')]=function(){this[_0xf347('0x13')]=0x0;this['paused']=0x0;for(var _0x1b4fb7=0x0;_0x1b4fb7=0x0?this[_0xf347('0x18')]:0x0;var _0x4d9cb={'id':this['id'],'available':this[_0xf347('0x18')],'loggedIn':this[_0xf347('0x13')],'name':this[_0xf347('0x8')],'paused':this['paused'],'waiting':this[_0xf347('0xc')]};var _0x6a40fd=md5(JSON['stringify'](_0x4d9cb));if(this[_0xf347('0x1')]!==_0x6a40fd){this[_0xf347('0x1')]=_0x6a40fd;io['to'](util[_0xf347('0x19')]('whatsapp:queue:%s',_0x4d9cb[_0xf347('0x8')]))['emit']('whatsapp_queue:save',_0x4d9cb);}};module[_0xf347('0x1a')]=WhatsappQueue; \ No newline at end of file diff --git a/server/services/routing/realtime/index.js b/server/services/routing/realtime/index.js index 62889dd..c124223 100644 --- a/server/services/routing/realtime/index.js +++ b/server/services/routing/realtime/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['isUndefined','initIntervals','updateRealtime','updateRouting','initSmsQueues','smsQueues','initMailQueues','mailQueues','initWhatsappQueues','whatsappQueues','exports','bluebird','util','lodash','../model/interval','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','chatQueues','faxQueues','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','length'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x934425,_0x5af72f){_0x934425=_0x934425-0x0;var _0x31d596=_0xa9e0[_0x934425];return _0x31d596;};'use strict';var BPromise=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var moment=require('moment');var Agent=require('../model/agent');var Interval=require(_0x0a9e('0x3'));var OpenchannelQueue=require('../model/openchannelQueue');var ChatQueue=require(_0x0a9e('0x4'));var SmsQueue=require(_0x0a9e('0x5'));var MailQueue=require(_0x0a9e('0x6'));var FaxQueue=require(_0x0a9e('0x7'));var WhatsappQueue=require(_0x0a9e('0x8'));var Realtime=function(){this['agents']={};this[_0x0a9e('0x9')]={};this[_0x0a9e('0xa')]={};this[_0x0a9e('0xb')]={};this['smsQueues']={};this['mailQueues']={};this[_0x0a9e('0xc')]={};this['whatsappQueues']={};this['chatQueuesWaitingInteractions']={};this[_0x0a9e('0xd')]={};this[_0x0a9e('0xe')]={};this[_0x0a9e('0xf')]={};this[_0x0a9e('0x10')]={};this[_0x0a9e('0x11')]={};};function freeIsNotKey(_0xbd1168,_0x4a4c56,_0x50dfb2){var _0x527cdd=_['mapKeys'](_0xbd1168,function(_0x273d4d,_0x36471c){return _0x273d4d[_0x50dfb2];});for(var _0xd5b662 in _0x4a4c56){if(_0x4a4c56[_0x0a9e('0x12')](_0xd5b662)){if(!_0x527cdd[_0xd5b662]){delete _0x4a4c56[_0xd5b662];}}}}Realtime[_0x0a9e('0x13')][_0x0a9e('0x14')]=function(_0x5db4b0,_0x4283ce){for(var _0x239b12 in _0x4283ce){if(_0x5db4b0[_0x0a9e('0x12')](_0x239b12)){_0x5db4b0[_0x239b12]=_0x4283ce[_0x239b12];}}};Realtime[_0x0a9e('0x13')][_0x0a9e('0x15')]=function(){var _0x4d5611=this;return function(_0x52a03d){if(_0x52a03d){freeIsNotKey(_0x52a03d,_0x4d5611[_0x0a9e('0x16')],'id');for(var _0x5d0880=0x0,_0x1985b6={},_0x519dfd={};_0x5d0880<_0x52a03d[_0x0a9e('0x17')];_0x5d0880+=0x1){_0x1985b6=_0x52a03d[_0x5d0880];if(_[_0x0a9e('0x18')](_0x4d5611['agents'][_0x1985b6['id']])){_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']]=new Agent(_0x1985b6);}else{_0x4d5611['mergeFromDatabase'](_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']],_0x1985b6);}}}return _0x4d5611[_0x0a9e('0x16')];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x19')]=function(){var _0x31b1ca=this;return function(_0x2eb11f){if(_0x2eb11f){freeIsNotKey(_0x2eb11f,_0x31b1ca[_0x0a9e('0x9')],'id');for(var _0x20559e=0x0,_0x1314ae={},_0x112016={};_0x20559e<_0x2eb11f[_0x0a9e('0x17')];_0x20559e+=0x1){_0x1314ae=_0x2eb11f[_0x20559e];if(_[_0x0a9e('0x18')](_0x31b1ca['intervals'][_0x1314ae['id']])){_0x31b1ca[_0x0a9e('0x9')][_0x1314ae['id']]=new Interval(_0x1314ae);}else{_0x31b1ca[_0x0a9e('0x14')](_0x31b1ca['intervals'][_0x1314ae['id']],_0x1314ae);}}}return _0x31b1ca[_0x0a9e('0x9')];};};Realtime['prototype']['initOpenchannelQueues']=function(){var _0x3a02e1=this;return function(_0x432e56){if(_0x432e56){freeIsNotKey(_0x432e56,_0x3a02e1[_0x0a9e('0xa')],'id');for(var _0x30bae6=0x0,_0x4abc77={},_0xfb6e48={};_0x30bae6<_0x432e56[_0x0a9e('0x17')];_0x30bae6+=0x1){_0x4abc77=_0x432e56[_0x30bae6];if(_[_0x0a9e('0x18')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']])){_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']]=new OpenchannelQueue(_0x4abc77);}else{_0x3a02e1[_0x0a9e('0x14')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']],_0x4abc77);}_0x3a02e1['openchannelQueues'][_0x4abc77['id']]['updateRouting']();_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']][_0x0a9e('0x1a')]();}}return _0x3a02e1[_0x0a9e('0xa')];};};Realtime[_0x0a9e('0x13')]['initChatQueues']=function(){var _0x384319=this;return function(_0x479bc4){if(_0x479bc4){freeIsNotKey(_0x479bc4,_0x384319[_0x0a9e('0xb')],'id');for(var _0x5bfb33=0x0,_0x1dc186={},_0x34dc65={};_0x5bfb33<_0x479bc4[_0x0a9e('0x17')];_0x5bfb33+=0x1){_0x1dc186=_0x479bc4[_0x5bfb33];if(_[_0x0a9e('0x18')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']])){_0x384319[_0x0a9e('0xb')][_0x1dc186['id']]=new ChatQueue(_0x1dc186);}else{_0x384319[_0x0a9e('0x14')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']],_0x1dc186);}_0x384319['chatQueues'][_0x1dc186['id']][_0x0a9e('0x1b')]();_0x384319[_0x0a9e('0xb')][_0x1dc186['id']][_0x0a9e('0x1a')]();}}return _0x384319[_0x0a9e('0xb')];};};Realtime['prototype'][_0x0a9e('0x1c')]=function(){var _0x40e7a3=this;return function(_0x1843b2){if(_0x1843b2){freeIsNotKey(_0x1843b2,_0x40e7a3[_0x0a9e('0x1d')],'id');for(var _0x58b06f=0x0,_0x563b45={},_0x296f41={};_0x58b06f<_0x1843b2[_0x0a9e('0x17')];_0x58b06f+=0x1){_0x563b45=_0x1843b2[_0x58b06f];if(_[_0x0a9e('0x18')](_0x40e7a3['smsQueues'][_0x563b45['id']])){_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']]=new SmsQueue(_0x563b45);}else{_0x40e7a3['mergeFromDatabase'](_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']],_0x563b45);}_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1b')]();_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1a')]();}}return _0x40e7a3['smsQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x1e')]=function(){var _0x40cb85=this;return function(_0x2da5c0){if(_0x2da5c0){freeIsNotKey(_0x2da5c0,_0x40cb85[_0x0a9e('0x1f')],'id');for(var _0x409319=0x0,_0x332d35={},_0x39e565={};_0x409319<_0x2da5c0['length'];_0x409319+=0x1){_0x332d35=_0x2da5c0[_0x409319];if(_[_0x0a9e('0x18')](_0x40cb85['mailQueues'][_0x332d35['id']])){_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]=new MailQueue(_0x332d35);}else{_0x40cb85[_0x0a9e('0x14')](_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']],_0x332d35);}_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]['updateRouting']();_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']][_0x0a9e('0x1a')]();}}return _0x40cb85[_0x0a9e('0x1f')];};};Realtime[_0x0a9e('0x13')]['initFaxQueues']=function(){var _0x54135e=this;return function(_0x1e8694){if(_0x1e8694){freeIsNotKey(_0x1e8694,_0x54135e['faxQueues'],'id');for(var _0x24936a=0x0,_0x3d9717={},_0x381c37={};_0x24936a<_0x1e8694[_0x0a9e('0x17')];_0x24936a+=0x1){_0x3d9717=_0x1e8694[_0x24936a];if(_['isUndefined'](_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']])){_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]=new FaxQueue(_0x3d9717);}else{_0x54135e[_0x0a9e('0x14')](_0x54135e['faxQueues'][_0x3d9717['id']],_0x3d9717);}_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']][_0x0a9e('0x1b')]();_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]['updateRealtime']();}}return _0x54135e['faxQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x20')]=function(){var _0x5adda1=this;return function(_0x2b814e){if(_0x2b814e){freeIsNotKey(_0x2b814e,_0x5adda1[_0x0a9e('0x21')],'id');for(var _0x2e1b3a=0x0,_0x148f55={},_0x4b38d9={};_0x2e1b3a<_0x2b814e['length'];_0x2e1b3a+=0x1){_0x148f55=_0x2b814e[_0x2e1b3a];if(_[_0x0a9e('0x18')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']])){_0x5adda1['whatsappQueues'][_0x148f55['id']]=new WhatsappQueue(_0x148f55);}else{_0x5adda1[_0x0a9e('0x14')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']],_0x148f55);}_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']]['updateRouting']();_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']][_0x0a9e('0x1a')]();}}return _0x5adda1[_0x0a9e('0x21')];};};module[_0x0a9e('0x22')]=Realtime; \ No newline at end of file +var _0xa9e0=['isUndefined','initIntervals','updateRealtime','updateRouting','initSmsQueues','smsQueues','initMailQueues','mailQueues','initWhatsappQueues','whatsappQueues','exports','bluebird','util','lodash','../model/interval','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','chatQueues','faxQueues','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','length'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_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 diff --git a/server/services/routing/rpc/chatInteraction.js b/server/services/routing/rpc/chatInteraction.js index 4e7496c..39d9e87 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 _0x36d9=['UpdateChatInteraction','addTags','AddTagsToChatInteraction','../client','update','Request'];(function(_0x3fa45e,_0x8344d1){var _0x56c62d=function(_0x2faceb){while(--_0x2faceb){_0x3fa45e['push'](_0x3fa45e['shift']());}};_0x56c62d(++_0x8344d1);}(_0x36d9,0xcf));var _0x936d=function(_0x499005,_0x4ef901){_0x499005=_0x499005-0x0;var _0x29af04=_0x36d9[_0x499005];return _0x29af04;};'use strict';var client=require(_0x936d('0x0'));exports[_0x936d('0x1')]=function(_0x53396d,_0x582c3c){return client[_0x936d('0x2')](_0x936d('0x3'),{'body':_0x582c3c,'options':{'where':{'id':_0x53396d}},'log':'updateChatInteraction'});};exports[_0x936d('0x4')]=function(_0xa24bb6,_0x1daa39){return client['Request'](_0x936d('0x5'),{'body':_0x1daa39,'options':{'where':{'id':_0xa24bb6}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file +var _0x32c8=['addTagsToChatInteraction','../client','update','Request','UpdateChatInteraction','addTags'];(function(_0x1d24eb,_0x12295b){var _0x1dc576=function(_0x4d5770){while(--_0x4d5770){_0x1d24eb['push'](_0x1d24eb['shift']());}};_0x1dc576(++_0x12295b);}(_0x32c8,0x1db));var _0x832c=function(_0x2432b8,_0x29591e){_0x2432b8=_0x2432b8-0x0;var _0x10680c=_0x32c8[_0x2432b8];return _0x10680c;};'use strict';var client=require(_0x832c('0x0'));exports[_0x832c('0x1')]=function(_0x10740e,_0xfec291){return client[_0x832c('0x2')](_0x832c('0x3'),{'body':_0xfec291,'options':{'where':{'id':_0x10740e}},'log':'updateChatInteraction'});};exports[_0x832c('0x4')]=function(_0x12d535,_0x13dc4f){return client[_0x832c('0x2')]('AddTagsToChatInteraction',{'body':_0x13dc4f,'options':{'where':{'id':_0x12d535}},'log':_0x832c('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index c9af9cf..f0d81d3 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 _0x85cd=['../client','create','CreateChatMessage'];(function(_0x25fb20,_0x10cf95){var _0x556205=function(_0x596c3d){while(--_0x596c3d){_0x25fb20['push'](_0x25fb20['shift']());}};_0x556205(++_0x10cf95);}(_0x85cd,0x16e));var _0xd85c=function(_0x494f96,_0x1a54ff){_0x494f96=_0x494f96-0x0;var _0x175677=_0x85cd[_0x494f96];return _0x175677;};'use strict';var client=require(_0xd85c('0x0'));exports[_0xd85c('0x1')]=function(_0x16cc24){return client['Request'](_0xd85c('0x2'),{'body':_0x16cc24,'log':'createChatMessage'});}; \ No newline at end of file +var _0x8782=['Request','../client'];(function(_0x2d460c,_0x4f08c0){var _0xf6fc4c=function(_0x4fb81c){while(--_0x4fb81c){_0x2d460c['push'](_0x2d460c['shift']());}};_0xf6fc4c(++_0x4f08c0);}(_0x8782,0x1d7));var _0x2878=function(_0x20f96d,_0x23e67f){_0x20f96d=_0x20f96d-0x0;var _0x9a7524=_0x8782[_0x20f96d];return _0x9a7524;};'use strict';var client=require(_0x2878('0x0'));exports['create']=function(_0x1dd58f){return client[_0x2878('0x1')]('CreateChatMessage',{'body':_0x1dd58f,'log':'createChatMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index 99e338c..d24c7d9 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 _0x9ff4=['timeout','strategy','Agents','online','chatPause','getChatQueues','GetChatQueue','name'];(function(_0x20fdc1,_0xde1296){var _0x25397c=function(_0x814b51){while(--_0x814b51){_0x20fdc1['push'](_0x20fdc1['shift']());}};_0x25397c(++_0xde1296);}(_0x9ff4,0x196));var _0x49ff=function(_0x2ebeb2,_0x2a3024){_0x2ebeb2=_0x2ebeb2-0x0;var _0x33aab6=_0x9ff4[_0x2ebeb2];return _0x33aab6;};'use strict';var client=require('../client');exports['getChatQueues']=function(){return function(){return client['Request'](_0x49ff('0x0'),{'options':{'raw':![],'attributes':['id',_0x49ff('0x1'),_0x49ff('0x2'),_0x49ff('0x3')],'include':[{'model':'User','as':_0x49ff('0x4'),'attributes':['id',_0x49ff('0x1'),_0x49ff('0x5'),_0x49ff('0x6')]}]},'log':_0x49ff('0x7')});};}; \ No newline at end of file +var _0x10af=['chatPause','getChatQueues','../client','Request','GetChatQueue','name','timeout','strategy','User','Agents'];(function(_0x315b3a,_0x5f2c70){var _0x418fd4=function(_0x3b8af1){while(--_0x3b8af1){_0x315b3a['push'](_0x315b3a['shift']());}};_0x418fd4(++_0x5f2c70);}(_0x10af,0xfc));var _0xf10a=function(_0xbd08b4,_0x4790ed){_0xbd08b4=_0xbd08b4-0x0;var _0x314f1e=_0x10af[_0xbd08b4];return _0x314f1e;};'use strict';var client=require(_0xf10a('0x0'));exports['getChatQueues']=function(){return function(){return client[_0xf10a('0x1')](_0xf10a('0x2'),{'options':{'raw':![],'attributes':['id',_0xf10a('0x3'),_0xf10a('0x4'),_0xf10a('0x5')],'include':[{'model':_0xf10a('0x6'),'as':_0xf10a('0x7'),'attributes':['id',_0xf10a('0x3'),'online',_0xf10a('0x8')]}]},'log':_0xf10a('0x9')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index 7697c61..5619efb 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 _0x50c1=['DESC','../client','Request','CreateChatQueueReport','update','UpdateChatQueueReport'];(function(_0x3eac0b,_0x522129){var _0x3c2b76=function(_0x5780a7){while(--_0x5780a7){_0x3eac0b['push'](_0x3eac0b['shift']());}};_0x3c2b76(++_0x522129);}(_0x50c1,0x1a5));var _0x150c=function(_0x16d162,_0x18dbec){_0x16d162=_0x16d162-0x0;var _0xf8a0d7=_0x50c1[_0x16d162];return _0xf8a0d7;};'use strict';var client=require(_0x150c('0x0'));exports['create']=function(_0x47d48d){return client[_0x150c('0x1')](_0x150c('0x2'),{'body':_0x47d48d,'log':_0x150c('0x2')});};exports[_0x150c('0x3')]=function(_0x24cd1b,_0x18c0bd){return client[_0x150c('0x1')](_0x150c('0x4'),{'body':_0x18c0bd,'options':{'where':{'uniqueid':_0x24cd1b},'order':[['id',_0x150c('0x5')]],'limit':0x1},'log':'UpdateChatQueueReport'});}; \ No newline at end of file +var _0x9b67=['DESC','../client','create','Request','CreateChatQueueReport','update','UpdateChatQueueReport'];(function(_0x2077c2,_0x275ab5){var _0x312f9f=function(_0x331435){while(--_0x331435){_0x2077c2['push'](_0x2077c2['shift']());}};_0x312f9f(++_0x275ab5);}(_0x9b67,0xf6));var _0x79b6=function(_0x4bcb7b,_0x3aae0b){_0x4bcb7b=_0x4bcb7b-0x0;var _0x2f1a53=_0x9b67[_0x4bcb7b];return _0x2f1a53;};'use strict';var client=require(_0x79b6('0x0'));exports[_0x79b6('0x1')]=function(_0xfb9138){return client[_0x79b6('0x2')](_0x79b6('0x3'),{'body':_0xfb9138,'log':'CreateChatQueueReport'});};exports[_0x79b6('0x4')]=function(_0x1aeb24,_0x5297d0){return client['Request'](_0x79b6('0x5'),{'body':_0x5297d0,'options':{'where':{'uniqueid':_0x1aeb24},'order':[['id',_0x79b6('0x6')]],'limit':0x1},'log':_0x79b6('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index 5f05125..25baff5 100644 --- a/server/services/routing/rpc/faxInteraction.js +++ b/server/services/routing/rpc/faxInteraction.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['Request','AddTagsToFaxInteraction','addTagsToFaxInteraction','../client','update','UpdateFaxInteraction','updateFaxInteraction','addTags'];(function(_0x225b4b,_0x252976){var _0xf46cae=function(_0x35b39a){while(--_0x35b39a){_0x225b4b['push'](_0x225b4b['shift']());}};_0xf46cae(++_0x252976);}(_0x9957,0x93));var _0x7995=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x9957[_0xbca1b1];return _0x4e1686;};'use strict';var client=require(_0x7995('0x0'));exports[_0x7995('0x1')]=function(_0x2722a3,_0x10a05d){return client['Request'](_0x7995('0x2'),{'body':_0x10a05d,'options':{'where':{'id':_0x2722a3}},'log':_0x7995('0x3')});};exports[_0x7995('0x4')]=function(_0x462a03,_0x576d89){return client[_0x7995('0x5')](_0x7995('0x6'),{'body':_0x576d89,'options':{'where':{'id':_0x462a03}},'log':_0x7995('0x7')});}; \ No newline at end of file +var _0x9957=['Request','AddTagsToFaxInteraction','addTagsToFaxInteraction','../client','update','UpdateFaxInteraction','updateFaxInteraction','addTags'];(function(_0x4ccd63,_0x16efa0){var _0x19e206=function(_0x30f418){while(--_0x30f418){_0x4ccd63['push'](_0x4ccd63['shift']());}};_0x19e206(++_0x16efa0);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'use strict';var client=require(_0x7995('0x0'));exports[_0x7995('0x1')]=function(_0x2722a3,_0x10a05d){return client['Request'](_0x7995('0x2'),{'body':_0x10a05d,'options':{'where':{'id':_0x2722a3}},'log':_0x7995('0x3')});};exports[_0x7995('0x4')]=function(_0x462a03,_0x576d89){return client[_0x7995('0x5')](_0x7995('0x6'),{'body':_0x576d89,'options':{'where':{'id':_0x462a03}},'log':_0x7995('0x7')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxMessage.js b/server/services/routing/rpc/faxMessage.js index 3e6cc8b..4f5532a 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 _0x374d=['Request','CreateFaxMessage','../client','create'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x374d,0x12a));var _0xd374=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x374d[_0x6c993a];return _0x27f547;};'use strict';var client=require(_0xd374('0x0'));exports[_0xd374('0x1')]=function(_0x4b6e47){return client[_0xd374('0x2')](_0xd374('0x3'),{'body':_0x4b6e47,'log':'createFaxMessage'});}; \ No newline at end of file +var _0x378f=['CreateFaxMessage','../client','create'];(function(_0x3878c5,_0x23029c){var _0x37d0cf=function(_0x4066c9){while(--_0x4066c9){_0x3878c5['push'](_0x3878c5['shift']());}};_0x37d0cf(++_0x23029c);}(_0x378f,0x127));var _0xf378=function(_0x3b8fe2,_0x362a80){_0x3b8fe2=_0x3b8fe2-0x0;var _0x13d1d1=_0x378f[_0x3b8fe2];return _0x13d1d1;};'use strict';var client=require(_0xf378('0x0'));exports[_0xf378('0x1')]=function(_0x305f19){return client['Request'](_0xf378('0x2'),{'body':_0x305f19,'log':'createFaxMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index 4fd90b2..e414334 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 _0xa128=['User','Agents','getFaxQueues','../client','Request','name','timeout','strategy'];(function(_0xf48dca,_0x4dd49d){var _0x26464e=function(_0x1f09e1){while(--_0x1f09e1){_0xf48dca['push'](_0xf48dca['shift']());}};_0x26464e(++_0x4dd49d);}(_0xa128,0x10b));var _0x8a12=function(_0x1f9f37,_0x18776e){_0x1f9f37=_0x1f9f37-0x0;var _0x21c080=_0xa128[_0x1f9f37];return _0x21c080;};'use strict';var client=require(_0x8a12('0x0'));exports['getFaxQueues']=function(){return function(){return client[_0x8a12('0x1')]('GetFaxQueue',{'options':{'raw':![],'attributes':['id',_0x8a12('0x2'),_0x8a12('0x3'),_0x8a12('0x4')],'include':[{'model':_0x8a12('0x5'),'as':_0x8a12('0x6'),'attributes':['id',_0x8a12('0x2'),'online','faxPause']}]},'log':_0x8a12('0x7')});};}; \ No newline at end of file +var _0xc504=['name','User','online','getFaxQueues','Request','GetFaxQueue'];(function(_0x52a569,_0xec66b0){var _0x1cfcae=function(_0x2b13c1){while(--_0x2b13c1){_0x52a569['push'](_0x52a569['shift']());}};_0x1cfcae(++_0xec66b0);}(_0xc504,0x130));var _0x4c50=function(_0x534c99,_0xf630c5){_0x534c99=_0x534c99-0x0;var _0x5db938=_0xc504[_0x534c99];return _0x5db938;};'use strict';var client=require('../client');exports['getFaxQueues']=function(){return function(){return client[_0x4c50('0x0')](_0x4c50('0x1'),{'options':{'raw':![],'attributes':['id',_0x4c50('0x2'),'timeout','strategy'],'include':[{'model':_0x4c50('0x3'),'as':'Agents','attributes':['id',_0x4c50('0x2'),_0x4c50('0x4'),'faxPause']}]},'log':_0x4c50('0x5')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index b9ff7e0..e76323a 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 _0x099b=['update','UpdateFaxQueueReport','DESC','create','Request'];(function(_0x317a39,_0x63272f){var _0x3c2dd6=function(_0x1257ac){while(--_0x1257ac){_0x317a39['push'](_0x317a39['shift']());}};_0x3c2dd6(++_0x63272f);}(_0x099b,0xa3));var _0xb099=function(_0x100589,_0x3c1988){_0x100589=_0x100589-0x0;var _0x250b51=_0x099b[_0x100589];return _0x250b51;};'use strict';var client=require('../client');exports[_0xb099('0x0')]=function(_0x31f726){return client[_0xb099('0x1')]('CreateFaxQueueReport',{'body':_0x31f726,'log':'CreateFaxQueueReport'});};exports[_0xb099('0x2')]=function(_0x142a8e,_0x2458c3){return client[_0xb099('0x1')](_0xb099('0x3'),{'body':_0x2458c3,'options':{'where':{'uniqueid':_0x142a8e},'order':[['id',_0xb099('0x4')]],'limit':0x1},'log':_0xb099('0x3')});}; \ No newline at end of file +var _0xd46d=['DESC','create','Request','CreateFaxQueueReport','update'];(function(_0x6c6cfa,_0xa4be99){var _0x523282=function(_0xaab07b){while(--_0xaab07b){_0x6c6cfa['push'](_0x6c6cfa['shift']());}};_0x523282(++_0xa4be99);}(_0xd46d,0x169));var _0xdd46=function(_0x319fb6,_0xa69d58){_0x319fb6=_0x319fb6-0x0;var _0x4a80f0=_0xd46d[_0x319fb6];return _0x4a80f0;};'use strict';var client=require('../client');exports[_0xdd46('0x0')]=function(_0x308920){return client[_0xdd46('0x1')](_0xdd46('0x2'),{'body':_0x308920,'log':_0xdd46('0x2')});};exports[_0xdd46('0x3')]=function(_0x3484fd,_0x592fc9){return client[_0xdd46('0x1')]('UpdateFaxQueueReport',{'body':_0x592fc9,'options':{'where':{'uniqueid':_0x3484fd},'order':[['id',_0xdd46('0x4')]],'limit':0x1},'log':'UpdateFaxQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index f0d20f4..c2ccad8 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 _0x746e=['Interval','../client','getIntervals','Request','GetInterval','name'];(function(_0x51c819,_0xd812db){var _0x15c5d2=function(_0x2977f0){while(--_0x2977f0){_0x51c819['push'](_0x51c819['shift']());}};_0x15c5d2(++_0xd812db);}(_0x746e,0x199));var _0xe746=function(_0x912d27,_0x28e0e3){_0x912d27=_0x912d27-0x0;var _0x31b918=_0x746e[_0x912d27];return _0x31b918;};'use strict';var client=require(_0xe746('0x0'));exports[_0xe746('0x1')]=function(){return function(){return client[_0xe746('0x2')](_0xe746('0x3'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0xe746('0x4')],'include':[{'model':_0xe746('0x5'),'as':'Intervals','attributes':['id',_0xe746('0x4'),'interval']}]},'log':_0xe746('0x1')});};}; \ No newline at end of file +var _0xb79c=['GetInterval','name','Interval','interval','../client','getIntervals','Request'];(function(_0x45b0e7,_0x276c66){var _0x29d69f=function(_0x9335ad){while(--_0x9335ad){_0x45b0e7['push'](_0x45b0e7['shift']());}};_0x29d69f(++_0x276c66);}(_0xb79c,0x82));var _0xcb79=function(_0x201132,_0x44998d){_0x201132=_0x201132-0x0;var _0x59ec2a=_0xb79c[_0x201132];return _0x59ec2a;};'use strict';var client=require(_0xcb79('0x0'));exports[_0xcb79('0x1')]=function(){return function(){return client[_0xcb79('0x2')](_0xcb79('0x3'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0xcb79('0x4')],'include':[{'model':_0xcb79('0x5'),'as':'Intervals','attributes':['id',_0xcb79('0x4'),_0xcb79('0x6')]}]},'log':_0xcb79('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index b23f7cc..ef80b67 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 _0xcf2f=['update','Request','updateMailInteraction','addTags','AddTagsToMailInteraction','addTagsToChatInteraction','../client'];(function(_0x4746f7,_0x2dd6e0){var _0xab048f=function(_0x225739){while(--_0x225739){_0x4746f7['push'](_0x4746f7['shift']());}};_0xab048f(++_0x2dd6e0);}(_0xcf2f,0xa7));var _0xfcf2=function(_0x229c04,_0x42251c){_0x229c04=_0x229c04-0x0;var _0x2b32a7=_0xcf2f[_0x229c04];return _0x2b32a7;};'use strict';var client=require(_0xfcf2('0x0'));exports[_0xfcf2('0x1')]=function(_0xe6b3a5,_0x3165cf){return client[_0xfcf2('0x2')]('UpdateMailInteraction',{'body':_0x3165cf,'options':{'where':{'id':_0xe6b3a5}},'log':_0xfcf2('0x3')});};exports[_0xfcf2('0x4')]=function(_0x1e3661,_0x34bcaf){return client[_0xfcf2('0x2')](_0xfcf2('0x5'),{'body':_0x34bcaf,'options':{'where':{'id':_0x1e3661}},'log':_0xfcf2('0x6')});}; \ No newline at end of file +var _0x1399=['UpdateMailInteraction','updateMailInteraction','addTags','Request','../client','update'];(function(_0x175678,_0x52b9b2){var _0x25cd8f=function(_0x36cac0){while(--_0x36cac0){_0x175678['push'](_0x175678['shift']());}};_0x25cd8f(++_0x52b9b2);}(_0x1399,0x16c));var _0x9139=function(_0x231473,_0x33b93e){_0x231473=_0x231473-0x0;var _0x16d666=_0x1399[_0x231473];return _0x16d666;};'use strict';var client=require(_0x9139('0x0'));exports[_0x9139('0x1')]=function(_0x5740a9,_0x474911){return client['Request'](_0x9139('0x2'),{'body':_0x474911,'options':{'where':{'id':_0x5740a9}},'log':_0x9139('0x3')});};exports[_0x9139('0x4')]=function(_0x28f155,_0x251798){return client[_0x9139('0x5')]('AddTagsToMailInteraction',{'body':_0x251798,'options':{'where':{'id':_0x28f155}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index 47fe502..48ffa2a 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 _0x1209=['createMailMessage','../client','Request','CreateMailMessage'];(function(_0x2d203a,_0x3bf40d){var _0xc00c7=function(_0x2b2bef){while(--_0x2b2bef){_0x2d203a['push'](_0x2d203a['shift']());}};_0xc00c7(++_0x3bf40d);}(_0x1209,0xc9));var _0x9120=function(_0x11d1f4,_0x1dfb4d){_0x11d1f4=_0x11d1f4-0x0;var _0x1140dd=_0x1209[_0x11d1f4];return _0x1140dd;};'use strict';var client=require(_0x9120('0x0'));exports['create']=function(_0x1c1830){return client[_0x9120('0x1')](_0x9120('0x2'),{'body':_0x1c1830,'log':_0x9120('0x3')});}; \ No newline at end of file +var _0x8a4e=['createMailMessage','../client'];(function(_0x3b0b09,_0x87e6cc){var _0x448d98=function(_0x10d07f){while(--_0x10d07f){_0x3b0b09['push'](_0x3b0b09['shift']());}};_0x448d98(++_0x87e6cc);}(_0x8a4e,0x199));var _0xe8a4=function(_0x530ddb,_0x3008f8){_0x530ddb=_0x530ddb-0x0;var _0x4fa295=_0x8a4e[_0x530ddb];return _0x4fa295;};'use strict';var client=require(_0xe8a4('0x0'));exports['create']=function(_0x48e388){return client['Request']('CreateMailMessage',{'body':_0x48e388,'log':_0xe8a4('0x1')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index deb223a..2738a00 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 _0x349f=['User','online','mailPause','../client','getMailQueues','Request','GetMailQueue','name','strategy'];(function(_0x26c5a7,_0x328a59){var _0x287e2d=function(_0x261ecf){while(--_0x261ecf){_0x26c5a7['push'](_0x26c5a7['shift']());}};_0x287e2d(++_0x328a59);}(_0x349f,0xae));var _0xf349=function(_0x3b3650,_0x73a5a2){_0x3b3650=_0x3b3650-0x0;var _0x14f152=_0x349f[_0x3b3650];return _0x14f152;};'use strict';var client=require(_0xf349('0x0'));exports[_0xf349('0x1')]=function(){return function(){return client[_0xf349('0x2')](_0xf349('0x3'),{'options':{'raw':![],'attributes':['id',_0xf349('0x4'),'timeout',_0xf349('0x5')],'include':[{'model':_0xf349('0x6'),'as':'Agents','attributes':['id','name',_0xf349('0x7'),_0xf349('0x8')]}]},'log':_0xf349('0x1')});};}; \ No newline at end of file +var _0x242d=['Request','GetMailQueue','name','timeout','strategy','User','Agents','mailPause','getMailQueues'];(function(_0xa6bc35,_0x5c42b1){var _0x4503de=function(_0x51c4a8){while(--_0x51c4a8){_0xa6bc35['push'](_0xa6bc35['shift']());}};_0x4503de(++_0x5c42b1);}(_0x242d,0x19d));var _0xd242=function(_0x364a36,_0x1e2677){_0x364a36=_0x364a36-0x0;var _0x5cd6fa=_0x242d[_0x364a36];return _0x5cd6fa;};'use strict';var client=require('../client');exports[_0xd242('0x0')]=function(){return function(){return client[_0xd242('0x1')](_0xd242('0x2'),{'options':{'raw':![],'attributes':['id',_0xd242('0x3'),_0xd242('0x4'),_0xd242('0x5')],'include':[{'model':_0xd242('0x6'),'as':_0xd242('0x7'),'attributes':['id',_0xd242('0x3'),'online',_0xd242('0x8')]}]},'log':_0xd242('0x0')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index f206df5..f5c29b0 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 _0x1c1d=['Request','UpdateMailQueueReport','DESC','../client','create','CreateMailQueueReport','update'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x1c1d,0x122));var _0xd1c1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1c1d[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0xd1c1('0x0'));exports[_0xd1c1('0x1')]=function(_0x87227b){return client['Request']('CreateMailQueueReport',{'body':_0x87227b,'log':_0xd1c1('0x2')});};exports[_0xd1c1('0x3')]=function(_0x46caae,_0x8b19f0){return client[_0xd1c1('0x4')](_0xd1c1('0x5'),{'body':_0x8b19f0,'options':{'where':{'uniqueid':_0x46caae},'order':[['id',_0xd1c1('0x6')]],'limit':0x1},'log':_0xd1c1('0x5')});}; \ No newline at end of file +var _0xa36a=['update','UpdateMailQueueReport','DESC','../client','create','Request','CreateMailQueueReport'];(function(_0x55f1cc,_0x2dd4e8){var _0x91df6c=function(_0x469345){while(--_0x469345){_0x55f1cc['push'](_0x55f1cc['shift']());}};_0x91df6c(++_0x2dd4e8);}(_0xa36a,0x88));var _0xaa36=function(_0x26340a,_0x59bea0){_0x26340a=_0x26340a-0x0;var _0xc7b8fb=_0xa36a[_0x26340a];return _0xc7b8fb;};'use strict';var client=require(_0xaa36('0x0'));exports[_0xaa36('0x1')]=function(_0x44e291){return client[_0xaa36('0x2')](_0xaa36('0x3'),{'body':_0x44e291,'log':_0xaa36('0x3')});};exports[_0xaa36('0x4')]=function(_0x538c8c,_0x132591){return client[_0xaa36('0x2')](_0xaa36('0x5'),{'body':_0x132591,'options':{'where':{'uniqueid':_0x538c8c},'order':[['id',_0xaa36('0x6')]],'limit':0x1},'log':'UpdateMailQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index 272a854..67e5700 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 _0x38f8=['addTagsToChatInteraction','../client','update','Request','UpdateOpenchannelInteraction','AddTagsToOpenchannelInteraction'];(function(_0x1cd65a,_0x29fa8f){var _0xf93849=function(_0x29fbe1){while(--_0x29fbe1){_0x1cd65a['push'](_0x1cd65a['shift']());}};_0xf93849(++_0x29fa8f);}(_0x38f8,0x193));var _0x838f=function(_0x18cf75,_0x20fa8e){_0x18cf75=_0x18cf75-0x0;var _0x203dff=_0x38f8[_0x18cf75];return _0x203dff;};'use strict';var client=require(_0x838f('0x0'));exports[_0x838f('0x1')]=function(_0x773cf8,_0x5b228e){return client[_0x838f('0x2')](_0x838f('0x3'),{'body':_0x5b228e,'options':{'where':{'id':_0x773cf8}},'log':'updateOpenchannelInteraction'});};exports['addTags']=function(_0x1c9a2a,_0x47b451){return client[_0x838f('0x2')](_0x838f('0x4'),{'body':_0x47b451,'options':{'where':{'id':_0x1c9a2a}},'log':_0x838f('0x5')});}; \ No newline at end of file +var _0xc44b=['addTags','Request','AddTagsToOpenchannelInteraction','../client','update','UpdateOpenchannelInteraction','updateOpenchannelInteraction'];(function(_0x506172,_0xbc3a3){var _0x2723c0=function(_0x57c3d9){while(--_0x57c3d9){_0x506172['push'](_0x506172['shift']());}};_0x2723c0(++_0xbc3a3);}(_0xc44b,0xab));var _0xbc44=function(_0x19dd7a,_0x51de21){_0x19dd7a=_0x19dd7a-0x0;var _0x3feb6a=_0xc44b[_0x19dd7a];return _0x3feb6a;};'use strict';var client=require(_0xbc44('0x0'));exports[_0xbc44('0x1')]=function(_0x391bb4,_0x26157f){return client['Request'](_0xbc44('0x2'),{'body':_0x26157f,'options':{'where':{'id':_0x391bb4}},'log':_0xbc44('0x3')});};exports[_0xbc44('0x4')]=function(_0x508ffa,_0x46fd76){return client[_0xbc44('0x5')](_0xbc44('0x6'),{'body':_0x46fd76,'options':{'where':{'id':_0x508ffa}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index 2adbfeb..be5767b 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 _0x44d3=['create','CreateOpenchannelMessage','createOpenchannelMessage','../client'];(function(_0x50f932,_0xf602d9){var _0x90ed4a=function(_0x115b31){while(--_0x115b31){_0x50f932['push'](_0x50f932['shift']());}};_0x90ed4a(++_0xf602d9);}(_0x44d3,0xf3));var _0x344d=function(_0x4ef78a,_0x1d1c22){_0x4ef78a=_0x4ef78a-0x0;var _0x188102=_0x44d3[_0x4ef78a];return _0x188102;};'use strict';var client=require(_0x344d('0x0'));exports[_0x344d('0x1')]=function(_0x1dedcd){return client['Request'](_0x344d('0x2'),{'body':_0x1dedcd,'log':_0x344d('0x3')});}; \ No newline at end of file +var _0x4a18=['CreateOpenchannelMessage','createOpenchannelMessage','../client','create','Request'];(function(_0x3fbacd,_0x1df49f){var _0x3e2df3=function(_0x351727){while(--_0x351727){_0x3fbacd['push'](_0x3fbacd['shift']());}};_0x3e2df3(++_0x1df49f);}(_0x4a18,0x147));var _0x84a1=function(_0x278e3c,_0x1c9cfd){_0x278e3c=_0x278e3c-0x0;var _0x3e2d9b=_0x4a18[_0x278e3c];return _0x3e2d9b;};'use strict';var client=require(_0x84a1('0x0'));exports[_0x84a1('0x1')]=function(_0xb0e026){return client[_0x84a1('0x2')](_0x84a1('0x3'),{'body':_0xb0e026,'log':_0x84a1('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index 2d2e11f..1bc3358 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 _0x3f8d=['User','Agents','online','openchannelPause','getOpenchannelQueues','Request','GetOpenchannelQueue','name','timeout','strategy'];(function(_0x25bb2f,_0x21c4ff){var _0x208b06=function(_0x2ca264){while(--_0x2ca264){_0x25bb2f['push'](_0x25bb2f['shift']());}};_0x208b06(++_0x21c4ff);}(_0x3f8d,0x162));var _0xd3f8=function(_0x47b15f,_0x103e93){_0x47b15f=_0x47b15f-0x0;var _0x55bf25=_0x3f8d[_0x47b15f];return _0x55bf25;};'use strict';var client=require('../client');exports[_0xd3f8('0x0')]=function(){return function(){return client[_0xd3f8('0x1')](_0xd3f8('0x2'),{'options':{'raw':![],'attributes':['id',_0xd3f8('0x3'),_0xd3f8('0x4'),_0xd3f8('0x5')],'include':[{'model':_0xd3f8('0x6'),'as':_0xd3f8('0x7'),'attributes':['id',_0xd3f8('0x3'),_0xd3f8('0x8'),_0xd3f8('0x9')]}]},'log':_0xd3f8('0x0')});};}; \ No newline at end of file +var _0xfc68=['name','online','../client','getOpenchannelQueues','Request','GetOpenchannelQueue','timeout','strategy','Agents'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfc68,0xb6));var _0x8fc6=function(_0xa77016,_0x1de579){_0xa77016=_0xa77016-0x0;var _0x30ed8c=_0xfc68[_0xa77016];return _0x30ed8c;};'use strict';var client=require(_0x8fc6('0x0'));exports[_0x8fc6('0x1')]=function(){return function(){return client[_0x8fc6('0x2')](_0x8fc6('0x3'),{'options':{'raw':![],'attributes':['id','name',_0x8fc6('0x4'),_0x8fc6('0x5')],'include':[{'model':'User','as':_0x8fc6('0x6'),'attributes':['id',_0x8fc6('0x7'),_0x8fc6('0x8'),'openchannelPause']}]},'log':_0x8fc6('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index 2bd59b6..7274746 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 _0xa100=['UpdateOpenchannelQueueReport','../client','create','Request','CreateOpenchannelQueueReport','update'];(function(_0x50e40b,_0x338d17){var _0x2608b7=function(_0x4ded5e){while(--_0x4ded5e){_0x50e40b['push'](_0x50e40b['shift']());}};_0x2608b7(++_0x338d17);}(_0xa100,0x1b1));var _0x0a10=function(_0x1b3475,_0x311d88){_0x1b3475=_0x1b3475-0x0;var _0x2b846e=_0xa100[_0x1b3475];return _0x2b846e;};'use strict';var client=require(_0x0a10('0x0'));exports[_0x0a10('0x1')]=function(_0x288171){return client[_0x0a10('0x2')](_0x0a10('0x3'),{'body':_0x288171,'log':_0x0a10('0x3')});};exports[_0x0a10('0x4')]=function(_0x97bbd9,_0x2d20ca){return client[_0x0a10('0x2')]('UpdateOpenchannelQueueReport',{'body':_0x2d20ca,'options':{'where':{'uniqueid':_0x97bbd9},'order':[['id','DESC']],'limit':0x1},'log':_0x0a10('0x5')});}; \ No newline at end of file +var _0x808e=['UpdateOpenchannelQueueReport','DESC','../client','CreateOpenchannelQueueReport','update','Request'];(function(_0x39e50e,_0x570052){var _0x5f1ca1=function(_0x207e52){while(--_0x207e52){_0x39e50e['push'](_0x39e50e['shift']());}};_0x5f1ca1(++_0x570052);}(_0x808e,0x104));var _0xe808=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x808e[_0x5b644e];return _0x49c6bf;};'use strict';var client=require(_0xe808('0x0'));exports['create']=function(_0x4e99e3){return client['Request'](_0xe808('0x1'),{'body':_0x4e99e3,'log':'CreateOpenchannelQueueReport'});};exports[_0xe808('0x2')]=function(_0xf0b07b,_0x152117){return client[_0xe808('0x3')](_0xe808('0x4'),{'body':_0x152117,'options':{'where':{'uniqueid':_0xf0b07b},'order':[['id',_0xe808('0x5')]],'limit':0x1},'log':'UpdateOpenchannelQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index 01ea467..06b9fcb 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 _0x943c=['update','updateSmsInteraction','addTags','Request','AddTagsToSmsInteraction','addTagsToSmsInteraction','../client'];(function(_0x5588d9,_0x37a3ed){var _0x5a85cd=function(_0x3991c7){while(--_0x3991c7){_0x5588d9['push'](_0x5588d9['shift']());}};_0x5a85cd(++_0x37a3ed);}(_0x943c,0xd8));var _0xc943=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x943c[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0xc943('0x0'));exports[_0xc943('0x1')]=function(_0x3ab205,_0x714ac3){return client['Request']('UpdateSmsInteraction',{'body':_0x714ac3,'options':{'where':{'id':_0x3ab205}},'log':_0xc943('0x2')});};exports[_0xc943('0x3')]=function(_0xa24827,_0x5b7d1d){return client[_0xc943('0x4')](_0xc943('0x5'),{'body':_0x5b7d1d,'options':{'where':{'id':_0xa24827}},'log':_0xc943('0x6')});}; \ No newline at end of file +var _0x2dd3=['AddTagsToSmsInteraction','addTagsToSmsInteraction','update','Request','UpdateSmsInteraction','updateSmsInteraction'];(function(_0x4cfc1d,_0x2c0927){var _0x1c01a0=function(_0x264a74){while(--_0x264a74){_0x4cfc1d['push'](_0x4cfc1d['shift']());}};_0x1c01a0(++_0x2c0927);}(_0x2dd3,0x6e));var _0x32dd=function(_0x47fe81,_0x54d6a2){_0x47fe81=_0x47fe81-0x0;var _0xe9139b=_0x2dd3[_0x47fe81];return _0xe9139b;};'use strict';var client=require('../client');exports[_0x32dd('0x0')]=function(_0x29bb49,_0x225c50){return client[_0x32dd('0x1')](_0x32dd('0x2'),{'body':_0x225c50,'options':{'where':{'id':_0x29bb49}},'log':_0x32dd('0x3')});};exports['addTags']=function(_0x36e50d,_0x144ee4){return client[_0x32dd('0x1')](_0x32dd('0x4'),{'body':_0x144ee4,'options':{'where':{'id':_0x36e50d}},'log':_0x32dd('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index ccd5bf7..eff839a 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 _0x828f=['Request','CreateSmsMessage','createSmsMessage','create'];(function(_0xccd9cc,_0x50ed31){var _0x11f890=function(_0x6c8099){while(--_0x6c8099){_0xccd9cc['push'](_0xccd9cc['shift']());}};_0x11f890(++_0x50ed31);}(_0x828f,0x14b));var _0xf828=function(_0x30033a,_0x5ce4a6){_0x30033a=_0x30033a-0x0;var _0x5e3518=_0x828f[_0x30033a];return _0x5e3518;};'use strict';var client=require('../client');exports[_0xf828('0x0')]=function(_0x10ef98){return client[_0xf828('0x1')](_0xf828('0x2'),{'body':_0x10ef98,'log':_0xf828('0x3')});}; \ No newline at end of file +var _0xf5ce=['Request','createSmsMessage'];(function(_0x1ac485,_0xde9db2){var _0x2bb13a=function(_0x40ecfd){while(--_0x40ecfd){_0x1ac485['push'](_0x1ac485['shift']());}};_0x2bb13a(++_0xde9db2);}(_0xf5ce,0x16e));var _0xef5c=function(_0xea8649,_0x4560cc){_0xea8649=_0xea8649-0x0;var _0x481e57=_0xf5ce[_0xea8649];return _0x481e57;};'use strict';var client=require('../client');exports['create']=function(_0x3c66fb){return client[_0xef5c('0x0')]('CreateSmsMessage',{'body':_0x3c66fb,'log':_0xef5c('0x1')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index 0923ca2..777ecc6 100644 --- a/server/services/routing/rpc/smsQueue.js +++ b/server/services/routing/rpc/smsQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0713=['getSmsQueues','Request','GetSmsQueue','name','timeout','strategy','Agents','online','smsPause'];(function(_0x502598,_0x1e95c8){var _0xbdee21=function(_0x140feb){while(--_0x140feb){_0x502598['push'](_0x502598['shift']());}};_0xbdee21(++_0x1e95c8);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var client=require('../client');exports['getSmsQueues']=function(){return function(){return client[_0x3071('0x0')](_0x3071('0x1'),{'options':{'raw':![],'attributes':['id',_0x3071('0x2'),_0x3071('0x3'),_0x3071('0x4')],'include':[{'model':'User','as':_0x3071('0x5'),'attributes':['id',_0x3071('0x2'),_0x3071('0x6'),_0x3071('0x7')]}]},'log':_0x3071('0x8')});};}; \ No newline at end of file +var _0x9c44=['Request','GetSmsQueue','name','timeout','strategy','User','online','getSmsQueues'];(function(_0x219cfd,_0x2ac503){var _0x1fb5a4=function(_0x117971){while(--_0x117971){_0x219cfd['push'](_0x219cfd['shift']());}};_0x1fb5a4(++_0x2ac503);}(_0x9c44,0x178));var _0x49c4=function(_0x2e4aa2,_0x11956a){_0x2e4aa2=_0x2e4aa2-0x0;var _0x5e6092=_0x9c44[_0x2e4aa2];return _0x5e6092;};'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 506b2aa..56909d0 100644 --- a/server/services/routing/rpc/smsQueueReport.js +++ b/server/services/routing/rpc/smsQueueReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xedd9=['create','Request','CreateSmsQueueReport','update','UpdateSmsQueueReport','DESC'];(function(_0x54381d,_0x247b2c){var _0x5308a7=function(_0x3ef056){while(--_0x3ef056){_0x54381d['push'](_0x54381d['shift']());}};_0x5308a7(++_0x247b2c);}(_0xedd9,0xfc));var _0x9edd=function(_0x20712d,_0x4c92c3){_0x20712d=_0x20712d-0x0;var _0x4c7140=_0xedd9[_0x20712d];return _0x4c7140;};'use strict';var client=require('../client');exports[_0x9edd('0x0')]=function(_0x2d7989){return client[_0x9edd('0x1')](_0x9edd('0x2'),{'body':_0x2d7989,'log':_0x9edd('0x2')});};exports[_0x9edd('0x3')]=function(_0x3e6d3a,_0x36b53f){return client['Request'](_0x9edd('0x4'),{'body':_0x36b53f,'options':{'where':{'uniqueid':_0x3e6d3a},'order':[['id',_0x9edd('0x5')]],'limit':0x1},'log':_0x9edd('0x4')});}; \ No newline at end of file +var _0x3e74=['CreateSmsQueueReport','UpdateSmsQueueReport','DESC','../client','Request'];(function(_0x160c76,_0x3c98aa){var _0x4c8231=function(_0x35e777){while(--_0x35e777){_0x160c76['push'](_0x160c76['shift']());}};_0x4c8231(++_0x3c98aa);}(_0x3e74,0x175));var _0x43e7=function(_0x1a14ac,_0x125c6d){_0x1a14ac=_0x1a14ac-0x0;var _0xb766ca=_0x3e74[_0x1a14ac];return _0xb766ca;};'use strict';var client=require(_0x43e7('0x0'));exports['create']=function(_0x349480){return client[_0x43e7('0x1')](_0x43e7('0x2'),{'body':_0x349480,'log':'CreateSmsQueueReport'});};exports['update']=function(_0xc58479,_0x4f9bbe){return client[_0x43e7('0x1')](_0x43e7('0x3'),{'body':_0x4f9bbe,'options':{'where':{'uniqueid':_0xc58479},'order':[['id',_0x43e7('0x4')]],'limit':0x1},'log':_0x43e7('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index 721925c..3f8f017 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(_0x1cbf33,_0x21f2ec){var _0x1ec7eb=function(_0x32ac45){while(--_0x32ac45){_0x1cbf33['push'](_0x1cbf33['shift']());}};_0x1ec7eb(++_0x21f2ec);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xa9e0[_0x5ddb1c];return _0x354adc;};'use strict';var client=require(_0x0a9e('0x0'));exports[_0x0a9e('0x1')]=function(){return function(){return client[_0x0a9e('0x2')]('GetUser',{'options':{'raw':!![],'where':{'role':'agent'},'attributes':['id',_0x0a9e('0x3'),'online',_0x0a9e('0x4'),_0x0a9e('0x5'),_0x0a9e('0x6'),_0x0a9e('0x7'),_0x0a9e('0x8'),'faxPause',_0x0a9e('0x9'),_0x0a9e('0xa'),_0x0a9e('0xb'),'chatCapacity','mailCapacity',_0x0a9e('0xc'),'smsCapacity','whatsappCapacity',_0x0a9e('0xd')]},'log':_0x0a9e('0x1')});};}; \ No newline at end of file +var _0xa9e0=['name','pauseType','lastPauseAt','voicePause','chatPause','mailPause','smsPause','whatsappPause','openchannelPause','faxCapacity','openchannelCapacity','../client','getAgents','Request'];(function(_0x244712,_0x4ea208){var _0x1ea352=function(_0x4fc684){while(--_0x4fc684){_0x244712['push'](_0x244712['shift']());}};_0x1ea352(++_0x4ea208);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2576d7,_0x167624){_0x2576d7=_0x2576d7-0x0;var _0x16a08c=_0xa9e0[_0x2576d7];return _0x16a08c;};'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 fea0178..051fe9b 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 _0xde81=['addTagsToWhatsappInteraction','../client','update','Request','UpdateWhatsappInteraction','AddTagsToWhatsappInteraction'];(function(_0x2bf127,_0x5a4dfe){var _0x9ab9ed=function(_0x1848e7){while(--_0x1848e7){_0x2bf127['push'](_0x2bf127['shift']());}};_0x9ab9ed(++_0x5a4dfe);}(_0xde81,0x109));var _0x1de8=function(_0x3a6f93,_0xbff327){_0x3a6f93=_0x3a6f93-0x0;var _0x32e547=_0xde81[_0x3a6f93];return _0x32e547;};'use strict';var client=require(_0x1de8('0x0'));exports[_0x1de8('0x1')]=function(_0xa96d58,_0x3202df){return client[_0x1de8('0x2')](_0x1de8('0x3'),{'body':_0x3202df,'options':{'where':{'id':_0xa96d58}},'log':'updateWhatsappInteraction'});};exports['addTags']=function(_0xebfcf9,_0x5953a6){return client[_0x1de8('0x2')](_0x1de8('0x4'),{'body':_0x5953a6,'options':{'where':{'id':_0xebfcf9}},'log':_0x1de8('0x5')});}; \ No newline at end of file +var _0x8d0a=['update','Request','UpdateWhatsappInteraction','addTags','AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction','../client'];(function(_0xb6e43,_0x1568fc){var _0x47c40f=function(_0x107786){while(--_0x107786){_0xb6e43['push'](_0xb6e43['shift']());}};_0x47c40f(++_0x1568fc);}(_0x8d0a,0x172));var _0xa8d0=function(_0x18aea4,_0xe06048){_0x18aea4=_0x18aea4-0x0;var _0x303d08=_0x8d0a[_0x18aea4];return _0x303d08;};'use strict';var client=require(_0xa8d0('0x0'));exports[_0xa8d0('0x1')]=function(_0x42a78b,_0x51c455){return client[_0xa8d0('0x2')](_0xa8d0('0x3'),{'body':_0x51c455,'options':{'where':{'id':_0x42a78b}},'log':'updateWhatsappInteraction'});};exports[_0xa8d0('0x4')]=function(_0x3812b4,_0x33c4b1){return client['Request'](_0xa8d0('0x5'),{'body':_0x33c4b1,'options':{'where':{'id':_0x3812b4}},'log':_0xa8d0('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappMessage.js b/server/services/routing/rpc/whatsappMessage.js index 6e0b2c0..5df656e 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 _0x4bd8=['../client','CreateWhatsappMessage','createWhatsappMessage'];(function(_0x5448c9,_0x3c2fb8){var _0x1c3c91=function(_0x21cdd3){while(--_0x21cdd3){_0x5448c9['push'](_0x5448c9['shift']());}};_0x1c3c91(++_0x3c2fb8);}(_0x4bd8,0x12f));var _0x84bd=function(_0x45ad3a,_0x108d36){_0x45ad3a=_0x45ad3a-0x0;var _0x60d1e6=_0x4bd8[_0x45ad3a];return _0x60d1e6;};'use strict';var client=require(_0x84bd('0x0'));exports['create']=function(_0x3526e4){return client['Request'](_0x84bd('0x1'),{'body':_0x3526e4,'log':_0x84bd('0x2')});}; \ No newline at end of file +var _0x3319=['CreateWhatsappMessage','createWhatsappMessage','../client','create','Request'];(function(_0x58fdc5,_0x5986a){var _0x121190=function(_0x28bd5c){while(--_0x28bd5c){_0x58fdc5['push'](_0x58fdc5['shift']());}};_0x121190(++_0x5986a);}(_0x3319,0x1c9));var _0x9331=function(_0x4e9628,_0x250573){_0x4e9628=_0x4e9628-0x0;var _0x27bc8c=_0x3319[_0x4e9628];return _0x27bc8c;};'use strict';var client=require(_0x9331('0x0'));exports[_0x9331('0x1')]=function(_0x327c03){return client[_0x9331('0x2')](_0x9331('0x3'),{'body':_0x327c03,'log':_0x9331('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index 30a983d..4d37c02 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 _0xb545=['GetWhatsappQueue','name','timeout','strategy','User','online','whatsappPause','getWhatsappQueues','../client','Request'];(function(_0x246564,_0x5bcbce){var _0x4eb0b6=function(_0x464b99){while(--_0x464b99){_0x246564['push'](_0x246564['shift']());}};_0x4eb0b6(++_0x5bcbce);}(_0xb545,0x1f2));var _0x5b54=function(_0x4aba49,_0x3da137){_0x4aba49=_0x4aba49-0x0;var _0x4ba51e=_0xb545[_0x4aba49];return _0x4ba51e;};'use strict';var client=require(_0x5b54('0x0'));exports['getWhatsappQueues']=function(){return function(){return client[_0x5b54('0x1')](_0x5b54('0x2'),{'options':{'raw':![],'attributes':['id',_0x5b54('0x3'),_0x5b54('0x4'),_0x5b54('0x5')],'include':[{'model':_0x5b54('0x6'),'as':'Agents','attributes':['id','name',_0x5b54('0x7'),_0x5b54('0x8')]}]},'log':_0x5b54('0x9')});};}; \ No newline at end of file +var _0xc9c1=['online','whatsappPause','getWhatsappQueues','../client','GetWhatsappQueue','timeout','strategy','User','Agents','name'];(function(_0x349367,_0x1cede2){var _0x14179b=function(_0x38a191){while(--_0x38a191){_0x349367['push'](_0x349367['shift']());}};_0x14179b(++_0x1cede2);}(_0xc9c1,0x14d));var _0x1c9c=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0xc9c1[_0x297fd3];return _0x2af381;};'use strict';var client=require(_0x1c9c('0x0'));exports['getWhatsappQueues']=function(){return function(){return client['Request'](_0x1c9c('0x1'),{'options':{'raw':![],'attributes':['id','name',_0x1c9c('0x2'),_0x1c9c('0x3')],'include':[{'model':_0x1c9c('0x4'),'as':_0x1c9c('0x5'),'attributes':['id',_0x1c9c('0x6'),_0x1c9c('0x7'),_0x1c9c('0x8')]}]},'log':_0x1c9c('0x9')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index bc9e3cc..4185bbb 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 _0xe3cd=['create','Request','CreateWhatsappQueueReport','update','UpdateWhatsappQueueReport','DESC','../client'];(function(_0x512e52,_0x121aed){var _0x210dbc=function(_0x4750cc){while(--_0x4750cc){_0x512e52['push'](_0x512e52['shift']());}};_0x210dbc(++_0x121aed);}(_0xe3cd,0x164));var _0xde3c=function(_0x563afd,_0xeb5160){_0x563afd=_0x563afd-0x0;var _0x3e2228=_0xe3cd[_0x563afd];return _0x3e2228;};'use strict';var client=require(_0xde3c('0x0'));exports[_0xde3c('0x1')]=function(_0x3db45f){return client[_0xde3c('0x2')](_0xde3c('0x3'),{'body':_0x3db45f,'log':_0xde3c('0x3')});};exports[_0xde3c('0x4')]=function(_0x218f9c,_0x3cab66){return client['Request'](_0xde3c('0x5'),{'body':_0x3cab66,'options':{'where':{'uniqueid':_0x218f9c},'order':[['id',_0xde3c('0x6')]],'limit':0x1},'log':'UpdateWhatsappQueueReport'});}; \ No newline at end of file +var _0xba3d=['UpdateWhatsappQueueReport','DESC','../client','Request','update'];(function(_0x4b079d,_0x19b2c3){var _0x2e4c1e=function(_0x431ea8){while(--_0x431ea8){_0x4b079d['push'](_0x4b079d['shift']());}};_0x2e4c1e(++_0x19b2c3);}(_0xba3d,0xa2));var _0xdba3=function(_0x28aea5,_0x3bb12e){_0x28aea5=_0x28aea5-0x0;var _0x6a55f9=_0xba3d[_0x28aea5];return _0x6a55f9;};'use strict';var client=require(_0xdba3('0x0'));exports['create']=function(_0x33f7ac){return client[_0xdba3('0x1')]('CreateWhatsappQueueReport',{'body':_0x33f7ac,'log':'CreateWhatsappQueueReport'});};exports[_0xdba3('0x2')]=function(_0x493f10,_0x41541a){return client[_0xdba3('0x1')](_0xdba3('0x3'),{'body':_0x41541a,'options':{'where':{'uniqueid':_0x493f10},'order':[['id',_0xdba3('0x4')]],'limit':0x1},'log':_0xdba3('0x3')});}; \ 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 139bebb..aab2957 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 _0xd677=['join','stop','find','timeout','createQueue','atimeout','channel','START:%s','end','info','close','rules','next','agent','log','[%s][QUEUE]\x20%s','stack','validate','util','seq-queue','routing','./strategy','number','format','name','toLowerCase','error','[%s][AGENT]\x20%s','map','message'];(function(_0x74892f,_0x1e981b){var _0x10ee61=function(_0x3c480a){while(--_0x3c480a){_0x74892f['push'](_0x74892f['shift']());}};_0x10ee61(++_0x1e981b);}(_0xd677,0x179));var _0x7d67=function(_0x18ab2a,_0x4debcd){_0x18ab2a=_0x18ab2a-0x0;var _0x16dcee=_0xd677[_0x18ab2a];return _0x16dcee;};'use strict';var schema=require(_0x7d67('0x0'));var _=require('lodash');var util=require(_0x7d67('0x1'));var seqqueue=require(_0x7d67('0x2'));var logger=require('../../../../config/logger')(_0x7d67('0x3'));var strategy=require(_0x7d67('0x4'));var queue=schema({'name':{'type':'string','required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':_0x7d67('0x5'),'message':'timeout\x20is\x20a\x20number'}});function writeLog(_0x9f7872,_0x50272b,_0x251b06){return logger['info'](util[_0x7d67('0x6')]('[%s][AGENT][NAME:%s][STATUS:%s]',_0x9f7872,_0x50272b[_0x7d67('0x7')],_0x251b06));}function handleFindAgent(_0x27a142){return function(_0xd6757a){return _0xd6757a[_0x7d67('0x7')][_0x7d67('0x8')]()===_0x27a142[_0x7d67('0x8')]();};}exports['consequence']=function(_0x4e95f8,_0x63d0c,_0x52aa59,_0xca3d9e){return function(_0x2d855f){try{var _0x42a72c={'name':_0x63d0c[0x0],'timeout':_0x63d0c[0x1]};var _0xf775f6=queue[_0x7d67('0x0')](_0x42a72c,{'typecast':!![]});if(_0xf775f6['length']){logger[_0x7d67('0x9')](_0x7d67('0xa'),_0x4e95f8,_[_0x7d67('0xb')](_0xf775f6,_0x7d67('0xc'))[_0x7d67('0xd')](',\x20'));_0x2d855f[_0x7d67('0xe')]();}else{var _0x4f1c25=_[_0x7d67('0xf')](_0x52aa59['agents'],handleFindAgent(_0x42a72c[_0x7d67('0x7')]));if(_0x4f1c25){var _0x39d4a5=(_0x42a72c[_0x7d67('0x10')]||0xa)*0x3e8;var _0x17d8da,_0x139324;var _0x1690d5=seqqueue[_0x7d67('0x11')](_0x39d4a5);_0x1690d5['id']=_0x4e95f8;_0x1690d5[_0x7d67('0x12')]=_0x39d4a5;_0x1690d5[_0x7d67('0x13')]=_0xca3d9e['channel'];writeLog(_0x4e95f8,_0x4f1c25,util[_0x7d67('0x6')](_0x7d67('0x14'),_0x39d4a5));_0x52aa59['rules'][_0x4e95f8]['on'](_0x7d67('0x15'),function(){logger[_0x7d67('0x16')]('[%s][AGENT]\x20ROUTING\x20STOPPED',_0x4e95f8);clearTimeout(_0x139324);_0x139324=undefined;_0x1690d5[_0x7d67('0x17')]();if(_0x52aa59[_0x7d67('0x18')][_0x4e95f8]){delete _0x52aa59[_0x7d67('0x18')][_0x4e95f8];}_0x2d855f['stop']();});_0x52aa59['rules'][_0x4e95f8]['on']('complete',function(){if(_0x52aa59['rules'][_0x4e95f8]){delete _0x52aa59[_0x7d67('0x18')][_0x4e95f8];}});_0x139324=setTimeout(function(){logger[_0x7d67('0x16')]('[%s][AGENT]\x20ROUTING\x20END',_0x4e95f8);clearTimeout(_0x139324);_0x1690d5[_0x7d67('0x17')]();_0x2d855f[_0x7d67('0x19')]();},_0x39d4a5);strategy[_0x7d67('0x1a')](_0x1690d5,_0x4f1c25,_0x52aa59,_0xca3d9e);}else{logger['error']('[%s][AGENT]\x20agent\x20not\x20found\x20%s',_0x4e95f8,_0x42a72c[_0x7d67('0x7')]);_0x2d855f['stop']();}}}catch(_0x58e06c){console[_0x7d67('0x1b')](_0x58e06c);logger[_0x7d67('0x9')](_0x7d67('0x1c'),_0x4e95f8,_0x58e06c[_0x7d67('0x1d')]);_0x2d855f[_0x7d67('0xe')]();}};}; \ No newline at end of file +var _0xbbfe=['timeout','atimeout','channel','format','START:%s','rules','end','info','[%s][AGENT]\x20ROUTING\x20STOPPED','close','error','stack','validate','util','seq-queue','../../../../config/logger','routing','./strategy','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','consequence','length','[%s][AGENT]\x20%s','map','message','join','stop','find'];(function(_0x1af747,_0x190c72){var _0x41d936=function(_0x2e73c6){while(--_0x2e73c6){_0x1af747['push'](_0x1af747['shift']());}};_0x41d936(++_0x190c72);}(_0xbbfe,0xfc));var _0xebbf=function(_0x54b723,_0x2b54ee){_0x54b723=_0x54b723-0x0;var _0x57fd0f=_0xbbfe[_0x54b723];return _0x57fd0f;};'use strict';var schema=require(_0xebbf('0x0'));var _=require('lodash');var util=require(_0xebbf('0x1'));var seqqueue=require(_0xebbf('0x2'));var logger=require(_0xebbf('0x3'))(_0xebbf('0x4'));var strategy=require(_0xebbf('0x5'));var queue=schema({'name':{'type':'string','required':!![],'message':_0xebbf('0x6')},'timeout':{'type':'number','message':'timeout\x20is\x20a\x20number'}});function writeLog(_0x5a9bcb,_0x2b6fca,_0x2a25df){return logger['info'](util['format'](_0xebbf('0x7'),_0x5a9bcb,_0x2b6fca[_0xebbf('0x8')],_0x2a25df));}function handleFindAgent(_0x5ed37e){return function(_0x58d2ee){return _0x58d2ee[_0xebbf('0x8')][_0xebbf('0x9')]()===_0x5ed37e['toLowerCase']();};}exports[_0xebbf('0xa')]=function(_0x53dd95,_0x1637dd,_0x137d80,_0x1f36ac){return function(_0x135da2){try{var _0x3c60d3={'name':_0x1637dd[0x0],'timeout':_0x1637dd[0x1]};var _0x4edbfa=queue[_0xebbf('0x0')](_0x3c60d3,{'typecast':!![]});if(_0x4edbfa[_0xebbf('0xb')]){logger['error'](_0xebbf('0xc'),_0x53dd95,_[_0xebbf('0xd')](_0x4edbfa,_0xebbf('0xe'))[_0xebbf('0xf')](',\x20'));_0x135da2[_0xebbf('0x10')]();}else{var _0x1365a4=_[_0xebbf('0x11')](_0x137d80['agents'],handleFindAgent(_0x3c60d3[_0xebbf('0x8')]));if(_0x1365a4){var _0x515b7b=(_0x3c60d3[_0xebbf('0x12')]||0xa)*0x3e8;var _0x5264bb,_0x2ec07f;var _0x4d7631=seqqueue['createQueue'](_0x515b7b);_0x4d7631['id']=_0x53dd95;_0x4d7631[_0xebbf('0x13')]=_0x515b7b;_0x4d7631[_0xebbf('0x14')]=_0x1f36ac[_0xebbf('0x14')];writeLog(_0x53dd95,_0x1365a4,util[_0xebbf('0x15')](_0xebbf('0x16'),_0x515b7b));_0x137d80[_0xebbf('0x17')][_0x53dd95]['on'](_0xebbf('0x18'),function(){logger[_0xebbf('0x19')](_0xebbf('0x1a'),_0x53dd95);clearTimeout(_0x2ec07f);_0x2ec07f=undefined;_0x4d7631[_0xebbf('0x1b')]();if(_0x137d80[_0xebbf('0x17')][_0x53dd95]){delete _0x137d80['rules'][_0x53dd95];}_0x135da2[_0xebbf('0x10')]();});_0x137d80[_0xebbf('0x17')][_0x53dd95]['on']('complete',function(){if(_0x137d80[_0xebbf('0x17')][_0x53dd95]){delete _0x137d80[_0xebbf('0x17')][_0x53dd95];}});_0x2ec07f=setTimeout(function(){logger[_0xebbf('0x19')]('[%s][AGENT]\x20ROUTING\x20END',_0x53dd95);clearTimeout(_0x2ec07f);_0x4d7631['close']();_0x135da2['next']();},_0x515b7b);strategy['agent'](_0x4d7631,_0x1365a4,_0x137d80,_0x1f36ac);}else{logger[_0xebbf('0x1c')]('[%s][AGENT]\x20agent\x20not\x20found\x20%s',_0x53dd95,_0x3c60d3['name']);_0x135da2[_0xebbf('0x10')]();}}}catch(_0x59eeb6){console['log'](_0x59eeb6);logger[_0xebbf('0x1c')]('[%s][QUEUE]\x20%s',_0x53dd95,_0x59eeb6[_0xebbf('0x1d')]);_0x135da2[_0xebbf('0x10')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/amazonlex.js b/server/services/routing/server/applications/amazonlex.js index 60b19c9..0ab9a69 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 _0xa804=['message','amazonlex','providerName','providerResponse','stringify','Message','Failed','stop','catch','lodash','moment','aws-sdk','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','interaction','UserId','[%s][AMAZONLEX]\x20%s','next','format','out','channel','sms','phone','chat','account','upperFirst','AccountId','InteractionId','created','isEmpty','body','getMustacheRender','create','then','info','error','$LATEST','toString'];(function(_0x9f021c,_0x59b485){var _0x3f6ca8=function(_0x2d9b17){while(--_0x2d9b17){_0x9f021c['push'](_0x9f021c['shift']());}};_0x3f6ca8(++_0x59b485);}(_0xa804,0x65));var _0x4a80=function(_0x1cfb30,_0x40ce73){_0x1cfb30=_0x1cfb30-0x0;var _0x3ee601=_0xa804[_0x1cfb30];return _0x3ee601;};'use strict';var _=require(_0x4a80('0x0'));var moment=require(_0x4a80('0x1'));var AWS=require(_0x4a80('0x2'));var utils=require(_0x4a80('0x3'));var logger=require(_0x4a80('0x4'))(_0x4a80('0x5'));var rpc={'chatMessage':require(_0x4a80('0x6')),'openchannelMessage':require(_0x4a80('0x7')),'mailMessage':require(_0x4a80('0x8')),'smsMessage':require(_0x4a80('0x9')),'faxMessage':require(_0x4a80('0xa')),'whatsappMessage':require(_0x4a80('0xb'))};exports[_0x4a80('0xc')]=function(_0x619355,_0x3d29c9){return function(_0x1f6d9e){try{if(!_['isNil'](this[_0x4a80('0xd')][_0x4a80('0xe')])){logger['info'](_0x4a80('0xf'),_0x619355,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x1f6d9e[_0x4a80('0x10')]();}var _0x878485={'ContactId':this['contact']['id'],'sentAt':moment()[_0x4a80('0x11')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0x4a80('0x12')};if(this[_0x4a80('0x13')]===_0x4a80('0x14')||this['channel']==='whatsapp'){_0x878485[_0x4a80('0x15')]=this['interaction'][_0x4a80('0x15')];}var _0x1c0f2a=this[_0x4a80('0x13')];if(_0x1c0f2a===_0x4a80('0x16')){_0x878485['ChatWebsiteId']=this[_0x4a80('0x17')]['id'];}else{_0x878485[_[_0x4a80('0x18')](_0x1c0f2a)+_0x4a80('0x19')]=this[_0x4a80('0x17')]['id'];}_0x878485[_['upperFirst'](_0x1c0f2a)+_0x4a80('0x1a')]=this[_0x4a80('0xd')]['id'];if(this[_0x4a80('0xd')][_0x4a80('0x1b')]){var _0x1c6d73=_0x3d29c9[0x4];if(!_[_0x4a80('0x1c')](_0x1c6d73)){_0x878485[_0x4a80('0x1d')]=utils[_0x4a80('0x1e')](_0x1c6d73,this);return rpc[_0x1c0f2a+'Message'][_0x4a80('0x1f')](_0x878485)[_0x4a80('0x20')](function(_0x594503){logger[_0x4a80('0x21')](_0x4a80('0xf'),_0x619355,_0x878485['body']);})['catch'](function(_0x178afd){logger[_0x4a80('0x22')](_0x4a80('0xf'),_0x619355,JSON['stringify'](_0x178afd));})['finally'](function(){logger['info']('[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x619355);_0x1f6d9e['stop']();});}else{logger['info']('[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x619355);_0x1f6d9e['stop']();}}else{var _0x2b016f=this;var _0x1f4bc2=new AWS['LexRuntime']({'accessKeyId':_0x3d29c9[0x0],'secretAccessKey':_0x3d29c9[0x1],'region':_0x3d29c9[0x2]});var _0x3ab61c={'botAlias':_0x4a80('0x23'),'botName':_0x3d29c9[0x3],'inputText':this['message']['body'],'userId':this[_0x4a80('0x13')]+':'+this[_0x4a80('0xd')]['id'][_0x4a80('0x24')]()};_0x1f4bc2['postText'](_0x3ab61c,function(_0x455a9f,_0x3482da){if(_0x455a9f){logger['error'](_0x4a80('0xf'),_0x619355,_0x455a9f[_0x4a80('0x25')]);_0x1f6d9e[_0x4a80('0x10')]();}else if(_0x3482da&&_0x3482da[_0x4a80('0x25')]){_0x2b016f['body'][_0x4a80('0x26')]=_0x3482da;_0x878485[_0x4a80('0x1d')]=_0x3482da[_0x4a80('0x25')];_0x878485[_0x4a80('0x27')]=_0x4a80('0x26');_0x878485[_0x4a80('0x28')]=JSON[_0x4a80('0x29')](_0x3482da);return rpc[_0x1c0f2a+_0x4a80('0x2a')][_0x4a80('0x1f')](_0x878485)[_0x4a80('0x20')](function(_0x23dde2){logger[_0x4a80('0x21')]('[%s][AMAZONLEX]\x20%s',_0x619355,_0x878485['body']);if(_0x3482da['dialogState']==_0x4a80('0x2b')){_0x1f6d9e[_0x4a80('0x10')]();}else{_0x1f6d9e[_0x4a80('0x2c')]();}})[_0x4a80('0x2d')](function(_0x5bdc78){logger[_0x4a80('0x22')]('[%s][AMAZONLEX]\x20%s',_0x619355,JSON[_0x4a80('0x29')](_0x5bdc78));_0x1f6d9e['next']();});}else{_0x1f6d9e[_0x4a80('0x10')]();}});}}catch(_0x3c3cd8){logger[_0x4a80('0x22')](_0x4a80('0xf'),_0x619355,JSON[_0x4a80('0x29')](_0x3c3cd8));_0x1f6d9e['stop']();}};}; \ No newline at end of file +var _0x9d60=['finally','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','LexRuntime','message','toString','postText','providerName','amazonlex','providerResponse','dialogState','Failed','lodash','moment','../../../../config/logger','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','info','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','channel','sms','whatsapp','phone','chat','ChatWebsiteId','account','upperFirst','AccountId','created','isEmpty','body','getMustacheRender','Message','create','then','catch','error','stringify'];(function(_0x52e64,_0x6ba4e8){var _0x282b80=function(_0xc11939){while(--_0xc11939){_0x52e64['push'](_0x52e64['shift']());}};_0x282b80(++_0x6ba4e8);}(_0x9d60,0xcd));var _0x09d6=function(_0x3e99cb,_0x1d2fe0){_0x3e99cb=_0x3e99cb-0x0;var _0x1bc729=_0x9d60[_0x3e99cb];return _0x1bc729;};'use strict';var _=require(_0x09d6('0x0'));var moment=require(_0x09d6('0x1'));var AWS=require('aws-sdk');var utils=require('./utils');var logger=require(_0x09d6('0x2'))('routing');var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x09d6('0x3')),'smsMessage':require(_0x09d6('0x4')),'faxMessage':require(_0x09d6('0x5')),'whatsappMessage':require(_0x09d6('0x6'))};exports[_0x09d6('0x7')]=function(_0x858d1c,_0x3f9bd5){return function(_0x267321){try{if(!_[_0x09d6('0x8')](this[_0x09d6('0x9')]['UserId'])){logger[_0x09d6('0xa')](_0x09d6('0xb'),_0x858d1c,_0x09d6('0xc'));return _0x267321[_0x09d6('0xd')]();}var _0x30566e={'ContactId':this[_0x09d6('0xe')]['id'],'sentAt':moment()[_0x09d6('0xf')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':'out'};if(this[_0x09d6('0x10')]===_0x09d6('0x11')||this[_0x09d6('0x10')]===_0x09d6('0x12')){_0x30566e[_0x09d6('0x13')]=this[_0x09d6('0x9')][_0x09d6('0x13')];}var _0x429daf=this['channel'];if(_0x429daf===_0x09d6('0x14')){_0x30566e[_0x09d6('0x15')]=this[_0x09d6('0x16')]['id'];}else{_0x30566e[_[_0x09d6('0x17')](_0x429daf)+_0x09d6('0x18')]=this[_0x09d6('0x16')]['id'];}_0x30566e[_[_0x09d6('0x17')](_0x429daf)+'InteractionId']=this[_0x09d6('0x9')]['id'];if(this[_0x09d6('0x9')][_0x09d6('0x19')]){var _0xf3141a=_0x3f9bd5[0x4];if(!_[_0x09d6('0x1a')](_0xf3141a)){_0x30566e[_0x09d6('0x1b')]=utils[_0x09d6('0x1c')](_0xf3141a,this);return rpc[_0x429daf+_0x09d6('0x1d')][_0x09d6('0x1e')](_0x30566e)[_0x09d6('0x1f')](function(_0x475d77){logger[_0x09d6('0xa')](_0x09d6('0xb'),_0x858d1c,_0x30566e[_0x09d6('0x1b')]);})[_0x09d6('0x20')](function(_0x5515e9){logger[_0x09d6('0x21')](_0x09d6('0xb'),_0x858d1c,JSON[_0x09d6('0x22')](_0x5515e9));})[_0x09d6('0x23')](function(){logger[_0x09d6('0xa')](_0x09d6('0x24'),_0x858d1c);_0x267321[_0x09d6('0x25')]();});}else{logger[_0x09d6('0xa')](_0x09d6('0x26'),_0x858d1c);_0x267321[_0x09d6('0x25')]();}}else{var _0xc484d5=this;var _0x4111ee=new AWS[(_0x09d6('0x27'))]({'accessKeyId':_0x3f9bd5[0x0],'secretAccessKey':_0x3f9bd5[0x1],'region':_0x3f9bd5[0x2]});var _0x39999d={'botAlias':'$LATEST','botName':_0x3f9bd5[0x3],'inputText':this[_0x09d6('0x28')][_0x09d6('0x1b')],'userId':this['channel']+':'+this['interaction']['id'][_0x09d6('0x29')]()};_0x4111ee[_0x09d6('0x2a')](_0x39999d,function(_0xc96fa1,_0x57a07f){if(_0xc96fa1){logger['error'](_0x09d6('0xb'),_0x858d1c,_0xc96fa1[_0x09d6('0x28')]);_0x267321['next']();}else if(_0x57a07f&&_0x57a07f['message']){_0xc484d5[_0x09d6('0x1b')]['amazonlex']=_0x57a07f;_0x30566e['body']=_0x57a07f[_0x09d6('0x28')];_0x30566e[_0x09d6('0x2b')]=_0x09d6('0x2c');_0x30566e[_0x09d6('0x2d')]=JSON[_0x09d6('0x22')](_0x57a07f);return rpc[_0x429daf+_0x09d6('0x1d')]['create'](_0x30566e)[_0x09d6('0x1f')](function(_0x189d5a){logger[_0x09d6('0xa')]('[%s][AMAZONLEX]\x20%s',_0x858d1c,_0x30566e[_0x09d6('0x1b')]);if(_0x57a07f[_0x09d6('0x2e')]==_0x09d6('0x2f')){_0x267321[_0x09d6('0xd')]();}else{_0x267321['stop']();}})['catch'](function(_0x31f087){logger[_0x09d6('0x21')](_0x09d6('0xb'),_0x858d1c,JSON[_0x09d6('0x22')](_0x31f087));_0x267321['next']();});}else{_0x267321[_0x09d6('0xd')]();}});}}catch(_0x105bb1){logger['error'](_0x09d6('0xb'),_0x858d1c,JSON[_0x09d6('0x22')](_0x105bb1));_0x267321[_0x09d6('0x25')]();}};}; \ 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 e7cfe98..19bd6b4 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 _0x35c6=['update','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','lodash','moment','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','../../rpc/chatInteraction','../../rpc/mailInteraction','../../rpc/smsInteraction','../../rpc/whatsappInteraction','../../mailRpc','consequence','isAutoreply','info','Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)','next','isNil','interaction','created','[%s][AUTOREPLY]\x20%s','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','One\x20Time\x20already\x20sent','contact','YYYY-MM-DD\x20HH:mm:ss','channel','mail','body','getMustacheRender','message','from','phone','read','subject','startsWith','Re:\x20','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','inReplyTo','html','','replace','','auto-replied','All','auto_reply','smtpOptions','then','[%s][AUTOREPLY]\x20SMTP\x20SENT','messageId','Message','create','stringify','catch','error','finally','autoreplyExecuted','Interaction'];(function(_0x31eeb6,_0xa9f9f2){var _0x4c6e05=function(_0x2f7d69){while(--_0x2f7d69){_0x31eeb6['push'](_0x31eeb6['shift']());}};_0x4c6e05(++_0xa9f9f2);}(_0x35c6,0x112));var _0x635c=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x35c6[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0x635c('0x0'));var moment=require(_0x635c('0x1'));var utils=require(_0x635c('0x2'));var logger=require(_0x635c('0x3'))(_0x635c('0x4'));var rpc={'chatMessage':require(_0x635c('0x5')),'openchannelMessage':require(_0x635c('0x6')),'mailMessage':require(_0x635c('0x7')),'smsMessage':require(_0x635c('0x8')),'faxMessage':require(_0x635c('0x9')),'whatsappMessage':require(_0x635c('0xa')),'chatInteraction':require(_0x635c('0xb')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'mailInteraction':require(_0x635c('0xc')),'smsInteraction':require(_0x635c('0xd')),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require(_0x635c('0xe'))};var mailRpc=require(_0x635c('0xf'));exports[_0x635c('0x10')]=function(_0x3629d5,_0x2667b5,_0x372f35,_0x440896){return function(_0xc9b7ef){try{var _0x3a531e=this['channel'];if(_0x3a531e==='mail'&&_0x440896['body'][_0x635c('0x11')]){logger[_0x635c('0x12')]('[%s][AUTOREPLY]\x20%s',_0x3629d5,_0x635c('0x13'));return _0xc9b7ef[_0x635c('0x14')]();}if(_0x2667b5[0x0]==='1'&&(_[_0x635c('0x15')](this[_0x635c('0x16')][_0x635c('0x17')])||!this[_0x635c('0x16')]['created'])){logger[_0x635c('0x12')](_0x635c('0x18'),_0x3629d5,'Autoreply\x20already\x20sent');return _0xc9b7ef[_0x635c('0x14')]();}if(_0x2667b5[0x0]==='2'&&this[_0x635c('0x16')]['autoreplyExecuted']){logger[_0x635c('0x12')](_0x635c('0x19'),_0x3629d5,_0x635c('0x1a'));return _0xc9b7ef[_0x635c('0x14')]();}var _0x3dd05c={'ContactId':this[_0x635c('0x1b')]['id'],'sentAt':moment()['format'](_0x635c('0x1c')),'direction':'out'};if(this[_0x635c('0x1d')]===_0x635c('0x1e')){_0x3dd05c[_0x635c('0x1f')]=utils[_0x635c('0x20')](_0x2667b5[0x2],this);}else{_0x3dd05c['body']=utils['getMustacheRender'](_0x2667b5[0x1],this);}if(this['message']){_0x3dd05c['to']=this[_0x635c('0x21')][_0x635c('0x22')]||'';if(this['channel']===_0x635c('0x1e')&&_0x2667b5[0x1]==='1'){_0x3dd05c['cc']=this[_0x635c('0x21')]['cc']||'';}_0x3dd05c[_0x635c('0x22')]=this[_0x635c('0x21')]['to']||'';_0x3dd05c['phone']=this[_0x635c('0x21')][_0x635c('0x23')]||'';_0x3dd05c[_0x635c('0x24')]=!![];if(this[_0x635c('0x21')]['subject']){_0x3dd05c[_0x635c('0x25')]='';_0x3dd05c[_0x635c('0x25')]+=_[_0x635c('0x26')](this['message'][_0x635c('0x25')],'Re:')?'':_0x635c('0x27');_0x3dd05c[_0x635c('0x25')]+=this[_0x635c('0x21')]['subject'];}}if(this['channel']===_0x635c('0x28')){_0x3dd05c[_0x635c('0x29')]=this[_0x635c('0x2a')]['id'];}else{_0x3dd05c[_[_0x635c('0x2b')](this[_0x635c('0x1d')])+_0x635c('0x2c')]=this[_0x635c('0x2a')]['id'];}_0x3dd05c[_[_0x635c('0x2b')](this[_0x635c('0x1d')])+_0x635c('0x2d')]=this[_0x635c('0x16')]['id'];var _0x124a74=this['interaction'];if(rpc[this[_0x635c('0x1d')]+'Message']){if(this[_0x635c('0x1d')]==='mail'){_0x3dd05c[_0x635c('0x2e')]=this[_0x635c('0x21')]['messageId'];_0x3dd05c[_0x635c('0x2f')]=_0x635c('0x30')+_[_0x635c('0x31')](_0x3dd05c[_0x635c('0x1f')],'','replace','','headers','All','account','then','[%s][AUTOREPLY]\x20SMTP\x20SENT','create','stringify','catch','error','[RPC][%s][AUTOREPLY]\x20%s','finally','resolve','Interaction','update','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','stop','lodash','moment','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../mailRpc','mail','body','info','[%s][AUTOREPLY]\x20%s','Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)','next','isNil','created','interaction','[%s][AUTOREPLY][autoreplyExecuted]\x20%s'];(function(_0x2f1762,_0xab43df){var _0x8ab21=function(_0xf6c1f5){while(--_0xf6c1f5){_0x2f1762['push'](_0x2f1762['shift']());}};_0x8ab21(++_0xab43df);}(_0x3812,0x135));var _0x2381=function(_0x5792cd,_0x2fadad){_0x5792cd=_0x5792cd-0x0;var _0x1c0293=_0x3812[_0x5792cd];return _0x1c0293;};'use strict';var _=require(_0x2381('0x0'));var moment=require(_0x2381('0x1'));var utils=require('./utils');var logger=require(_0x2381('0x2'))(_0x2381('0x3'));var rpc={'chatMessage':require(_0x2381('0x4')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x2381('0x5')),'smsMessage':require(_0x2381('0x6')),'faxMessage':require(_0x2381('0x7')),'whatsappMessage':require(_0x2381('0x8')),'chatInteraction':require(_0x2381('0x9')),'openchannelInteraction':require(_0x2381('0xa')),'mailInteraction':require(_0x2381('0xb')),'smsInteraction':require(_0x2381('0xc')),'faxInteraction':require(_0x2381('0xd')),'whatsappInteraction':require(_0x2381('0xe'))};var mailRpc=require(_0x2381('0xf'));exports['consequence']=function(_0x2ba8e5,_0x33159b,_0x1ec883,_0x3934f8){return function(_0x23a197){try{var _0x7c67be=this['channel'];if(_0x7c67be===_0x2381('0x10')&&_0x3934f8[_0x2381('0x11')]['isAutoreply']){logger[_0x2381('0x12')](_0x2381('0x13'),_0x2ba8e5,_0x2381('0x14'));return _0x23a197[_0x2381('0x15')]();}if(_0x33159b[0x0]==='1'&&(_[_0x2381('0x16')](this['interaction'][_0x2381('0x17')])||!this[_0x2381('0x18')][_0x2381('0x17')])){logger[_0x2381('0x12')](_0x2381('0x13'),_0x2ba8e5,'Autoreply\x20already\x20sent');return _0x23a197[_0x2381('0x15')]();}if(_0x33159b[0x0]==='2'&&this['interaction']['autoreplyExecuted']){logger[_0x2381('0x12')](_0x2381('0x19'),_0x2ba8e5,_0x2381('0x1a'));return _0x23a197['next']();}var _0x5835b8={'ContactId':this['contact']['id'],'sentAt':moment()[_0x2381('0x1b')](_0x2381('0x1c')),'direction':_0x2381('0x1d')};if(this[_0x2381('0x1e')]===_0x2381('0x10')){_0x5835b8[_0x2381('0x11')]=utils['getMustacheRender'](_0x33159b[0x2],this);}else{_0x5835b8[_0x2381('0x11')]=utils[_0x2381('0x1f')](_0x33159b[0x1],this);}if(this[_0x2381('0x20')]){_0x5835b8['to']=this[_0x2381('0x20')][_0x2381('0x21')]||'';if(this[_0x2381('0x1e')]===_0x2381('0x10')&&_0x33159b[0x1]==='1'){_0x5835b8['cc']=this[_0x2381('0x20')]['cc']||'';}_0x5835b8['from']=this[_0x2381('0x20')]['to']||'';_0x5835b8['phone']=this['message'][_0x2381('0x22')]||'';_0x5835b8[_0x2381('0x23')]=!![];if(this[_0x2381('0x20')][_0x2381('0x24')]){_0x5835b8['subject']='';_0x5835b8[_0x2381('0x24')]+=_[_0x2381('0x25')](this[_0x2381('0x20')][_0x2381('0x24')],_0x2381('0x26'))?'':_0x2381('0x27');_0x5835b8[_0x2381('0x24')]+=this[_0x2381('0x20')][_0x2381('0x24')];}}if(this[_0x2381('0x1e')]==='chat'){_0x5835b8[_0x2381('0x28')]=this['account']['id'];}else{_0x5835b8[_[_0x2381('0x29')](this['channel'])+_0x2381('0x2a')]=this['account']['id'];}_0x5835b8[_[_0x2381('0x29')](this[_0x2381('0x1e')])+_0x2381('0x2b')]=this[_0x2381('0x18')]['id'];var _0x311b7f=this[_0x2381('0x18')];if(rpc[this[_0x2381('0x1e')]+_0x2381('0x2c')]){if(this[_0x2381('0x1e')]===_0x2381('0x10')){_0x5835b8['inReplyTo']=this[_0x2381('0x20')][_0x2381('0x2d')];_0x5835b8['html']=_0x2381('0x2e')+_[_0x2381('0x2f')](_0x5835b8[_0x2381('0x11')],_0x2381('0x30'),_0x2381('0x31'))+_0x2381('0x32');_0x5835b8[_0x2381('0x33')]={'Auto-Submitted':'auto-replied','X-Auto-Response-Suppress':_0x2381('0x34'),'Precedence':'auto_reply'};return mailRpc['sendMailMessage'](this[_0x2381('0x35')]['smtpOptions'],_0x5835b8)[_0x2381('0x36')](function(_0xa1d5a6){logger[_0x2381('0x12')](_0x2381('0x37'),_0x2ba8e5);_0x5835b8['messageId']=_0xa1d5a6[_0x2381('0x20')][_0x2381('0x2d')];return rpc[_0x7c67be+_0x2381('0x2c')][_0x2381('0x38')](_0x5835b8);})[_0x2381('0x36')](function(_0x3e789e){logger['info'](_0x2381('0x13'),_0x2ba8e5,JSON[_0x2381('0x39')](_0x3e789e));})[_0x2381('0x3a')](function(_0x279f9a){logger[_0x2381('0x3b')](_0x2381('0x3c'),_0x2ba8e5,JSON['stringify'](_0x279f9a));})[_0x2381('0x3d')](function(){Promise['resolve']()[_0x2381('0x36')](function(){if(_0x33159b[0x0]!=='2'||_0x311b7f['autoreplyExecuted'])return;return rpc[_0x7c67be+'Interaction']['update'](_0x311b7f['id'],{'autoreplyExecuted':!![]})['then'](function(_0x323240){logger[_0x2381('0x12')](_0x2381('0x19'),_0x2ba8e5,JSON['stringify'](_0x323240));})[_0x2381('0x3a')](function(_0x1dde10){logger[_0x2381('0x3b')]('[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x2ba8e5,JSON[_0x2381('0x39')](_0x1dde10));});})[_0x2381('0x36')](function(){_0x23a197['next']();});});}else{return rpc[this[_0x2381('0x1e')]+_0x2381('0x2c')]['create'](_0x5835b8)[_0x2381('0x36')](function(){logger[_0x2381('0x12')]('[%s][AUTOREPLY]\x20%s',_0x2ba8e5,_0x5835b8[_0x2381('0x11')]);})['catch'](function(_0x2b16a6){logger[_0x2381('0x3b')](_0x2381('0x13'),_0x2ba8e5,JSON['stringify'](_0x2b16a6));})[_0x2381('0x3d')](function(){Promise[_0x2381('0x3e')]()[_0x2381('0x36')](function(){if(_0x33159b[0x0]!=='2'||_0x311b7f['autoreplyExecuted'])return;return rpc[_0x7c67be+_0x2381('0x3f')][_0x2381('0x40')](_0x311b7f['id'],{'autoreplyExecuted':!![]})[_0x2381('0x36')](function(_0x3d426a){logger[_0x2381('0x12')](_0x2381('0x19'),_0x2ba8e5,JSON['stringify'](_0x3d426a));})[_0x2381('0x3a')](function(_0x1e9782){logger[_0x2381('0x3b')](_0x2381('0x41'),_0x2ba8e5,JSON[_0x2381('0x39')](_0x1e9782));});})['then'](function(){_0x23a197[_0x2381('0x15')]();});});}}}catch(_0x2c3ac3){logger[_0x2381('0x3b')](_0x2381('0x13'),_0x2ba8e5,JSON[_0x2381('0x39')](_0x2c3ac3));_0x23a197[_0x2381('0x42')]();}};}; \ 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 9d2abfe..8491cc2 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 _0x2eb0=['routing','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','consequence','info','[%s][CLOSE]\x20reason\x20%s','format','channel','Interaction','then','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','interaction','catch','error','[%s][CLOSE]\x20%s','finally','stop','stringify','moment','../../../../config/logger'];(function(_0x376b45,_0x5964fb){var _0x2341b3=function(_0x5a7f01){while(--_0x5a7f01){_0x376b45['push'](_0x376b45['shift']());}};_0x2341b3(++_0x5964fb);}(_0x2eb0,0x106));var _0x02eb=function(_0x43df37,_0x9c91c1){_0x43df37=_0x43df37-0x0;var _0x3674c8=_0x2eb0[_0x43df37];return _0x3674c8;};'use strict';var moment=require(_0x02eb('0x0'));var logger=require(_0x02eb('0x1'))(_0x02eb('0x2'));var rpc={'chatInteraction':require(_0x02eb('0x3')),'openchannelInteraction':require(_0x02eb('0x4')),'smsInteraction':require(_0x02eb('0x5')),'mailInteraction':require(_0x02eb('0x6')),'faxInteraction':require(_0x02eb('0x7')),'whatsappInteraction':require(_0x02eb('0x8'))};exports[_0x02eb('0x9')]=function(_0x4afe89,_0x32ca4b,_0xe36587,_0x2fd7b4){return function(_0x1f3f2f){try{logger[_0x02eb('0xa')](_0x02eb('0xb'),_0x4afe89,_0x32ca4b[0x0]);var _0x5978c3={'closed':0x1,'closedAt':moment()[_0x02eb('0xc')]('YYYY-MM-DD\x20HH:mm:ss'),'closeReason':'system','disposition':_0x32ca4b[0x0]};if(rpc[_0x2fd7b4[_0x02eb('0xd')]+_0x02eb('0xe')]){rpc[_0x2fd7b4[_0x02eb('0xd')]+_0x02eb('0xe')]['update'](_0x2fd7b4['interaction']['id'],_0x5978c3)[_0x02eb('0xf')](function(_0x595e22){logger[_0x02eb('0xa')](_0x02eb('0x10'),_0x4afe89,_0x2fd7b4[_0x02eb('0x11')]['id']);})[_0x02eb('0x12')](function(_0x4b194f){logger[_0x02eb('0x13')](_0x02eb('0x14'),_0x4afe89,JSON['stringify'](_0x4b194f));})[_0x02eb('0x15')](function(){_0x1f3f2f[_0x02eb('0x16')]();});}}catch(_0x126e94){logger[_0x02eb('0x13')]('[%s][CLOSE]\x20%s',_0x4afe89,JSON[_0x02eb('0x17')](_0x126e94));_0x1f3f2f[_0x02eb('0x16')]();}};}; \ No newline at end of file +var _0x9341=['info','error','[%s][CLOSE]\x20%s','stringify','finally','stop','../../../../config/logger','routing','../../rpc/chatInteraction','../../rpc/smsInteraction','../../rpc/whatsappInteraction','consequence','[%s][CLOSE]\x20reason\x20%s','format','YYYY-MM-DD\x20HH:mm:ss','system','channel','Interaction','update','interaction','then'];(function(_0x2bf6e8,_0x31be12){var _0x3963bf=function(_0x1cdc29){while(--_0x1cdc29){_0x2bf6e8['push'](_0x2bf6e8['shift']());}};_0x3963bf(++_0x31be12);}(_0x9341,0x16b));var _0x1934=function(_0x37ef38,_0x55e5e2){_0x37ef38=_0x37ef38-0x0;var _0x327e96=_0x9341[_0x37ef38];return _0x327e96;};'use strict';var moment=require('moment');var logger=require(_0x1934('0x0'))(_0x1934('0x1'));var rpc={'chatInteraction':require(_0x1934('0x2')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require(_0x1934('0x3')),'mailInteraction':require('../../rpc/mailInteraction'),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require(_0x1934('0x4'))};exports[_0x1934('0x5')]=function(_0x54fb96,_0x5546f8,_0x335f13,_0x2dfccb){return function(_0x4e1537){try{logger['info'](_0x1934('0x6'),_0x54fb96,_0x5546f8[0x0]);var _0x5cf75d={'closed':0x1,'closedAt':moment()[_0x1934('0x7')](_0x1934('0x8')),'closeReason':_0x1934('0x9'),'disposition':_0x5546f8[0x0]};if(rpc[_0x2dfccb[_0x1934('0xa')]+_0x1934('0xb')]){rpc[_0x2dfccb['channel']+_0x1934('0xb')][_0x1934('0xc')](_0x2dfccb[_0x1934('0xd')]['id'],_0x5cf75d)[_0x1934('0xe')](function(_0x2bd513){logger[_0x1934('0xf')]('[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!',_0x54fb96,_0x2dfccb[_0x1934('0xd')]['id']);})['catch'](function(_0xe25096){logger[_0x1934('0x10')](_0x1934('0x11'),_0x54fb96,JSON[_0x1934('0x12')](_0xe25096));})[_0x1934('0x13')](function(){_0x4e1537['stop']();});}}catch(_0x1ef9a6){logger['error'](_0x1934('0x11'),_0x54fb96,JSON[_0x1934('0x12')](_0x1ef9a6));_0x4e1537[_0x1934('0x14')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/dialogflow.js b/server/services/routing/server/applications/dialogflow.js index 395d77f..41d86be 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 _0x11e5=['consequence','isNil','interaction','UserId','info','[%s][DIALOGFLOW]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','channel','whatsapp','phone','ChatWebsiteId','account','AccountId','InteractionId','created','isEmpty','body','getMustacheRender','create','error','stringify','finally','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','textRequest','message','then','fulfillment','providerName','dialogflow','providerResponse','Message','result','metadata','endConversation','catch','lodash','apiai-promise','md5','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/whatsappMessage'];(function(_0x2b6134,_0x1bee41){var _0x3f247a=function(_0xa64b0){while(--_0xa64b0){_0x2b6134['push'](_0x2b6134['shift']());}};_0x3f247a(++_0x1bee41);}(_0x11e5,0x8b));var _0x511e=function(_0xe20e96,_0x4125ab){_0xe20e96=_0xe20e96-0x0;var _0x399a78=_0x11e5[_0xe20e96];return _0x399a78;};'use strict';var _=require(_0x511e('0x0'));var moment=require('moment');var apiai=require(_0x511e('0x1'));var md5=require(_0x511e('0x2'));var utils=require('./utils');var logger=require(_0x511e('0x3'))(_0x511e('0x4'));var rpc={'chatMessage':require(_0x511e('0x5')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x511e('0x6')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0x511e('0x7'))};exports[_0x511e('0x8')]=function(_0x466dec,_0x57cac3){return function(_0x47cf56){try{if(!_[_0x511e('0x9')](this[_0x511e('0xa')][_0x511e('0xb')])){logger[_0x511e('0xc')](_0x511e('0xd'),_0x466dec,_0x511e('0xe'));return _0x47cf56[_0x511e('0xf')]();}var _0x50564b={'ContactId':this[_0x511e('0x10')]['id'],'sentAt':moment()[_0x511e('0x11')](_0x511e('0x12')),'direction':'out'};if(this[_0x511e('0x13')]==='sms'||this['channel']===_0x511e('0x14')){_0x50564b[_0x511e('0x15')]=this[_0x511e('0xa')][_0x511e('0x15')];}var _0x464576=this[_0x511e('0x13')];if(_0x464576==='chat'){_0x50564b[_0x511e('0x16')]=this[_0x511e('0x17')]['id'];}else{_0x50564b[_['upperFirst'](_0x464576)+_0x511e('0x18')]=this[_0x511e('0x17')]['id'];}_0x50564b[_['upperFirst'](_0x464576)+_0x511e('0x19')]=this[_0x511e('0xa')]['id'];if(this[_0x511e('0xa')][_0x511e('0x1a')]){var _0x5b6cd6=_0x57cac3[0x2];if(!_[_0x511e('0x1b')](_0x5b6cd6)){_0x50564b[_0x511e('0x1c')]=utils[_0x511e('0x1d')](_0x5b6cd6,this);return rpc[_0x464576+'Message'][_0x511e('0x1e')](_0x50564b)['then'](function(_0x34e6cd){logger['info']('[%s][DIALOGFLOW]\x20%s',_0x466dec,_0x50564b[_0x511e('0x1c')]);})['catch'](function(_0x33bef5){logger[_0x511e('0x1f')](_0x511e('0xd'),_0x466dec,JSON[_0x511e('0x20')](_0x33bef5));})[_0x511e('0x21')](function(){logger[_0x511e('0xc')](_0x511e('0x22'),_0x466dec);_0x47cf56[_0x511e('0x23')]();});}else{logger['info'](_0x511e('0x24'),_0x466dec);_0x47cf56[_0x511e('0x23')]();}}else{var _0x2ebf30=this;var _0x1a273b=apiai(_0x57cac3[0x0],{'language':_0x57cac3[0x1]||'en'});return _0x1a273b[_0x511e('0x25')](this[_0x511e('0x26')][_0x511e('0x1c')],{'sessionId':md5(this[_0x511e('0xa')]['id'])})[_0x511e('0x27')](function(_0x26618d){_0x2ebf30['body']['dialogflow']=_0x26618d;_0x50564b[_0x511e('0x1c')]=_0x26618d['result'][_0x511e('0x28')]['speech'];_0x50564b[_0x511e('0x29')]=_0x511e('0x2a');_0x50564b[_0x511e('0x2b')]=JSON[_0x511e('0x20')](_0x26618d);return rpc[_0x464576+_0x511e('0x2c')][_0x511e('0x1e')](_0x50564b)[_0x511e('0x27')](function(_0x4d89a5){logger[_0x511e('0xc')](_0x511e('0xd'),_0x466dec,_0x50564b['body']);if(_0x26618d[_0x511e('0x2d')][_0x511e('0x2e')][_0x511e('0x2f')]){_0x47cf56[_0x511e('0xf')]();}else{_0x47cf56[_0x511e('0x23')]();}})['catch'](function(_0x431b75){logger['error']('[%s][DIALOGFLOW]\x20%s',_0x466dec,JSON[_0x511e('0x20')](_0x431b75));_0x47cf56[_0x511e('0xf')]();});})[_0x511e('0x30')](function(_0x2fb396){logger[_0x511e('0x1f')]('[%s][DIALOGFLOW]\x20%s',_0x466dec,_0x2fb396[_0x511e('0x26')]);_0x47cf56[_0x511e('0xf')]();});}}catch(_0xf2a22){logger[_0x511e('0x1f')](_0x511e('0xd'),_0x466dec,JSON['stringify'](_0xf2a22));_0x47cf56[_0x511e('0x23')]();}};}; \ No newline at end of file +var _0x7a2f=['metadata','endConversation','error','lodash','moment','md5','./utils','../../../../config/logger','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','isNil','UserId','info','[%s][DIALOGFLOW]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','out','channel','sms','whatsapp','chat','ChatWebsiteId','account','upperFirst','AccountId','interaction','isEmpty','body','getMustacheRender','Message','catch','finally','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','textRequest','message','then','dialogflow','result','speech','providerName','stringify','create'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0x7a2f,0x99));var _0xf7a2=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x7a2f[_0x4565bf];return _0x5610ba;};'use strict';var _=require(_0xf7a2('0x0'));var moment=require(_0xf7a2('0x1'));var apiai=require('apiai-promise');var md5=require(_0xf7a2('0x2'));var utils=require(_0xf7a2('0x3'));var logger=require(_0xf7a2('0x4'))('routing');var rpc={'chatMessage':require(_0xf7a2('0x5')),'openchannelMessage':require(_0xf7a2('0x6')),'mailMessage':require(_0xf7a2('0x7')),'smsMessage':require(_0xf7a2('0x8')),'faxMessage':require(_0xf7a2('0x9')),'whatsappMessage':require(_0xf7a2('0xa'))};exports['consequence']=function(_0x3e6ae2,_0x33506b){return function(_0x21e9f6){try{if(!_[_0xf7a2('0xb')](this['interaction'][_0xf7a2('0xc')])){logger[_0xf7a2('0xd')](_0xf7a2('0xe'),_0x3e6ae2,_0xf7a2('0xf'));return _0x21e9f6[_0xf7a2('0x10')]();}var _0x385c4f={'ContactId':this[_0xf7a2('0x11')]['id'],'sentAt':moment()[_0xf7a2('0x12')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0xf7a2('0x13')};if(this[_0xf7a2('0x14')]===_0xf7a2('0x15')||this[_0xf7a2('0x14')]===_0xf7a2('0x16')){_0x385c4f['phone']=this['interaction']['phone'];}var _0x27c725=this[_0xf7a2('0x14')];if(_0x27c725===_0xf7a2('0x17')){_0x385c4f[_0xf7a2('0x18')]=this[_0xf7a2('0x19')]['id'];}else{_0x385c4f[_[_0xf7a2('0x1a')](_0x27c725)+_0xf7a2('0x1b')]=this['account']['id'];}_0x385c4f[_['upperFirst'](_0x27c725)+'InteractionId']=this[_0xf7a2('0x1c')]['id'];if(this['interaction']['created']){var _0x29d384=_0x33506b[0x2];if(!_[_0xf7a2('0x1d')](_0x29d384)){_0x385c4f[_0xf7a2('0x1e')]=utils[_0xf7a2('0x1f')](_0x29d384,this);return rpc[_0x27c725+_0xf7a2('0x20')]['create'](_0x385c4f)['then'](function(_0x5de0f1){logger[_0xf7a2('0xd')](_0xf7a2('0xe'),_0x3e6ae2,_0x385c4f[_0xf7a2('0x1e')]);})[_0xf7a2('0x21')](function(_0x3f5e77){logger['error'](_0xf7a2('0xe'),_0x3e6ae2,JSON['stringify'](_0x3f5e77));})[_0xf7a2('0x22')](function(){logger[_0xf7a2('0xd')](_0xf7a2('0x23'),_0x3e6ae2);_0x21e9f6[_0xf7a2('0x24')]();});}else{logger[_0xf7a2('0xd')](_0xf7a2('0x25'),_0x3e6ae2);_0x21e9f6[_0xf7a2('0x24')]();}}else{var _0x5265e0=this;var _0x4b1a06=apiai(_0x33506b[0x0],{'language':_0x33506b[0x1]||'en'});return _0x4b1a06[_0xf7a2('0x26')](this[_0xf7a2('0x27')]['body'],{'sessionId':md5(this[_0xf7a2('0x1c')]['id'])})[_0xf7a2('0x28')](function(_0x3592ba){_0x5265e0[_0xf7a2('0x1e')][_0xf7a2('0x29')]=_0x3592ba;_0x385c4f['body']=_0x3592ba[_0xf7a2('0x2a')]['fulfillment'][_0xf7a2('0x2b')];_0x385c4f[_0xf7a2('0x2c')]=_0xf7a2('0x29');_0x385c4f['providerResponse']=JSON[_0xf7a2('0x2d')](_0x3592ba);return rpc[_0x27c725+'Message'][_0xf7a2('0x2e')](_0x385c4f)['then'](function(_0x1f1a79){logger[_0xf7a2('0xd')](_0xf7a2('0xe'),_0x3e6ae2,_0x385c4f[_0xf7a2('0x1e')]);if(_0x3592ba[_0xf7a2('0x2a')][_0xf7a2('0x2f')][_0xf7a2('0x30')]){_0x21e9f6['next']();}else{_0x21e9f6[_0xf7a2('0x24')]();}})[_0xf7a2('0x21')](function(_0x481007){logger['error']('[%s][DIALOGFLOW]\x20%s',_0x3e6ae2,JSON[_0xf7a2('0x2d')](_0x481007));_0x21e9f6[_0xf7a2('0x10')]();});})[_0xf7a2('0x21')](function(_0x1dd940){logger[_0xf7a2('0x31')]('[%s][DIALOGFLOW]\x20%s',_0x3e6ae2,_0x1dd940[_0xf7a2('0x27')]);_0x21e9f6[_0xf7a2('0x10')]();});}}catch(_0x54b1b2){logger['error'](_0xf7a2('0xe'),_0x3e6ae2,JSON[_0xf7a2('0x2d')](_0x54b1b2));_0x21e9f6[_0xf7a2('0x24')]();}};}; \ 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 c41747d..f6a5bba 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 _0xef05=['DIALOGFLOWV2_LANGUAGECODE','languageCode','DIALOGFLOWV2_QUERYTEXT','intentDetectionConfidence','providerName','providerResponse','fulfillmentText','push','all','stack','lodash','dialogflow','md5','bluebird','../../../../config/logger','routing','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','clone','body','Message','create','then','info','catch','error','stringify','consequence','UserId','[%s][DIALOGFLOWV2]\x20%s','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','whatsapp','phone','interaction','chat','account','upperFirst','AccountId','InteractionId','created','getMustacheRender','finally','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','message','detectIntent','length','dialogflowV2','diagnosticInfo','queryResult','fields','end_conversation','boolValue','DIALOGFLOWV2_ACTION','action','allRequiredParamsPresent','DIALOGFLOWV2_INTENTNAME','intent','name','DIALOGFLOWV2_INTENTDISPLAYNAME','displayName','isFallback'];(function(_0x1c41ca,_0x2f1ada){var _0x36102d=function(_0x4dc51f){while(--_0x4dc51f){_0x1c41ca['push'](_0x1c41ca['shift']());}};_0x36102d(++_0x2f1ada);}(_0xef05,0x1f4));var _0x5ef0=function(_0x30d391,_0x2b12b2){_0x30d391=_0x30d391-0x0;var _0x210495=_0xef05[_0x30d391];return _0x210495;};'use strict';var _=require(_0x5ef0('0x0'));var dialogflow=require(_0x5ef0('0x1'));var md5=require(_0x5ef0('0x2'));var moment=require('moment');var Promise=require(_0x5ef0('0x3'));var logger=require(_0x5ef0('0x4'))(_0x5ef0('0x5'));var utils=require('./utils');var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x5ef0('0x6')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x5ef0('0x7')),'faxMessage':require(_0x5ef0('0x8')),'whatsappMessage':require(_0x5ef0('0x9'))};function createMessage(_0x342dc4,_0x29538d,_0x35f1ad,_0x1b129f){return new Promise(function(_0x4c6a8f,_0x1d2231){var _0x1a37af=_[_0x5ef0('0xa')](_0x35f1ad);_0x1a37af[_0x5ef0('0xb')]=_0x1b129f;return rpc[_0x29538d+_0x5ef0('0xc')][_0x5ef0('0xd')](_0x1a37af)[_0x5ef0('0xe')](function(){logger[_0x5ef0('0xf')]('[%s][DIALOGFLOWV2]\x20%s',_0x342dc4,_0x1a37af[_0x5ef0('0xb')]);_0x4c6a8f();})[_0x5ef0('0x10')](function(_0xe80c74){logger[_0x5ef0('0x11')]('[%s][DIALOGFLOWV2]\x20%s',_0x342dc4,JSON[_0x5ef0('0x12')](_0xe80c74));_0x1d2231(_0xe80c74);});});}exports[_0x5ef0('0x13')]=function(_0x3c83b0,_0x32bdb3){return function(_0x25119e){try{if(!_['isNil'](this['interaction'][_0x5ef0('0x14')])){logger[_0x5ef0('0xf')](_0x5ef0('0x15'),_0x3c83b0,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x25119e[_0x5ef0('0x16')]();}var _0x2de194={'ContactId':this[_0x5ef0('0x17')]['id'],'sentAt':moment()[_0x5ef0('0x18')](_0x5ef0('0x19')),'direction':_0x5ef0('0x1a')};if(this['channel']==='sms'||this[_0x5ef0('0x1b')]===_0x5ef0('0x1c')){_0x2de194[_0x5ef0('0x1d')]=this[_0x5ef0('0x1e')]['phone'];}var _0x124cca=this['channel'];if(_0x124cca===_0x5ef0('0x1f')){_0x2de194['ChatWebsiteId']=this[_0x5ef0('0x20')]['id'];}else{_0x2de194[_[_0x5ef0('0x21')](_0x124cca)+_0x5ef0('0x22')]=this[_0x5ef0('0x20')]['id'];}_0x2de194[_[_0x5ef0('0x21')](_0x124cca)+_0x5ef0('0x23')]=this[_0x5ef0('0x1e')]['id'];if(this[_0x5ef0('0x1e')][_0x5ef0('0x24')]){var _0x4aba4e=_0x32bdb3[0x4];if(!_['isEmpty'](_0x4aba4e)){_0x2de194[_0x5ef0('0xb')]=utils[_0x5ef0('0x25')](_0x4aba4e,this);return rpc[_0x124cca+_0x5ef0('0xc')][_0x5ef0('0xd')](_0x2de194)[_0x5ef0('0xe')](function(_0x347f45){logger[_0x5ef0('0xf')](_0x5ef0('0x15'),_0x3c83b0,_0x2de194['body']);})[_0x5ef0('0x10')](function(_0x4003d3){logger['error']('[%s][DIALOGFLOWV2]\x20%s',_0x3c83b0,JSON['stringify'](_0x4003d3));})[_0x5ef0('0x26')](function(){logger['info'](_0x5ef0('0x27'),_0x3c83b0);_0x25119e[_0x5ef0('0x28')]();});}else{logger[_0x5ef0('0xf')](_0x5ef0('0x29'),_0x3c83b0);_0x25119e['stop']();}}else{var _0x5bb6cb=this;var _0x1a6028=_0x32bdb3[0x2]['replace'](/\\n/g,'\x0a');var _0x44136a={'credentials':{'private_key':_0x1a6028,'client_email':_0x32bdb3[0x1]}};var _0x333fbe=new dialogflow['SessionsClient'](_0x44136a);var _0x5b6f36=_0x333fbe['sessionPath'](_0x32bdb3[0x0],md5(_0x5bb6cb[_0x5ef0('0x1e')]['id']));var _0x32a751={'session':_0x5b6f36,'queryInput':{'text':{'text':_0x5bb6cb[_0x5ef0('0x2a')][_0x5ef0('0xb')],'languageCode':_0x32bdb3[0x3]||'en'}}};return _0x333fbe[_0x5ef0('0x2b')](_0x32a751)['then'](function(_0x488bc9){if(_0x488bc9&&_0x488bc9[_0x5ef0('0x2c')]){_0x5bb6cb[_0x5ef0('0xb')][_0x5ef0('0x2d')]=_0x488bc9;var _0x4d7911=_0x488bc9[0x0];var _0x5046d2=_0x4d7911['queryResult'][_0x5ef0('0x2e')]&&_0x4d7911[_0x5ef0('0x2f')][_0x5ef0('0x2e')]['fields']?_0x4d7911[_0x5ef0('0x2f')][_0x5ef0('0x2e')][_0x5ef0('0x30')][_0x5ef0('0x31')][_0x5ef0('0x32')]:![];_0x5bb6cb['body'][_0x5ef0('0x33')]=_0x4d7911['queryResult'][_0x5ef0('0x34')];_0x5bb6cb['body']['DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT']=_0x4d7911['queryResult'][_0x5ef0('0x35')];_0x5bb6cb['body']['DIALOGFLOWV2_ENDCONVERSATION']=_0x4d7911[_0x5ef0('0x2f')]['diagnosticInfo']&&_0x4d7911['queryResult'][_0x5ef0('0x2e')][_0x5ef0('0x30')]?_0x4d7911[_0x5ef0('0x2f')][_0x5ef0('0x2e')][_0x5ef0('0x30')]['end_conversation'][_0x5ef0('0x32')]:![];_0x5bb6cb['body'][_0x5ef0('0x36')]=_0x4d7911[_0x5ef0('0x2f')][_0x5ef0('0x37')][_0x5ef0('0x38')];_0x5bb6cb[_0x5ef0('0xb')][_0x5ef0('0x39')]=_0x4d7911[_0x5ef0('0x2f')][_0x5ef0('0x37')][_0x5ef0('0x3a')];_0x5bb6cb['body']['DIALOGFLOWV2_ISFALLBACKINTENT']=_0x4d7911[_0x5ef0('0x2f')]['intent'][_0x5ef0('0x3b')];_0x5bb6cb[_0x5ef0('0xb')][_0x5ef0('0x3c')]=_0x4d7911['queryResult'][_0x5ef0('0x3d')];_0x5bb6cb['body'][_0x5ef0('0x3e')]=_0x4d7911['queryResult']['queryText'];_0x5bb6cb['body']['DIALOGFLOWV2_SCORE']=_0x4d7911[_0x5ef0('0x2f')][_0x5ef0('0x3f')];_0x2de194[_0x5ef0('0x40')]='dialogflowV2';_0x2de194[_0x5ef0('0x41')]=JSON[_0x5ef0('0x12')](_0x488bc9);var _0x4a1149=[];for(var _0x3e1e59=0x0;_0x3e1e59<_0x488bc9[_0x5ef0('0x2c')];_0x3e1e59++){var _0x2907ca=_0x488bc9[_0x3e1e59];if(_0x2907ca&&_0x2907ca[_0x5ef0('0x2f')]&&_0x2907ca[_0x5ef0('0x2f')][_0x5ef0('0x42')]){_0x4a1149[_0x5ef0('0x43')](createMessage(_0x3c83b0,_0x124cca,_0x2de194,_0x2907ca[_0x5ef0('0x2f')][_0x5ef0('0x42')]));}}return Promise[_0x5ef0('0x44')](_0x4a1149)['then'](function(){if(_0x5046d2){_0x25119e['next']();}else{_0x25119e['stop']();}})[_0x5ef0('0x10')](function(_0x1bbf47){logger[_0x5ef0('0x11')]('[%s][DIALOGFLOWV2]\x20%s',_0x3c83b0,JSON['stringify'](_0x1bbf47));_0x25119e[_0x5ef0('0x16')]();});}})[_0x5ef0('0x10')](function(_0x4a25ef){logger[_0x5ef0('0x11')](_0x5ef0('0x15'),_0x3c83b0,_0x4a25ef['message'],_0x4a25ef[_0x5ef0('0x45')]);_0x25119e[_0x5ef0('0x16')]();});}}catch(_0x537946){logger['error']('[%s][DIALOGFLOWV2]\x20%s',_0x3c83b0,JSON[_0x5ef0('0x12')](_0x537946));_0x25119e[_0x5ef0('0x28')]();}};}; \ No newline at end of file +var _0xfeba=['DIALOGFLOWV2_ISFALLBACKINTENT','isFallback','DIALOGFLOWV2_LANGUAGECODE','languageCode','queryText','DIALOGFLOWV2_SCORE','intentDetectionConfidence','providerName','fulfillmentText','push','next','catch','message','stack','lodash','dialogflow','md5','bluebird','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','clone','body','Message','create','then','info','[%s][DIALOGFLOWV2]\x20%s','stringify','consequence','isNil','interaction','UserId','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','contact','format','YYYY-MM-DD\x20HH:mm:ss','sms','whatsapp','phone','channel','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','isEmpty','getMustacheRender','error','finally','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','replace','SessionsClient','sessionPath','detectIntent','length','dialogflowV2','queryResult','diagnosticInfo','fields','end_conversation','action','DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT','allRequiredParamsPresent','DIALOGFLOWV2_ENDCONVERSATION','boolValue','DIALOGFLOWV2_INTENTNAME','intent','name','DIALOGFLOWV2_INTENTDISPLAYNAME'];(function(_0x2bbc07,_0x1e2168){var _0x6879e4=function(_0x290fa1){while(--_0x290fa1){_0x2bbc07['push'](_0x2bbc07['shift']());}};_0x6879e4(++_0x1e2168);}(_0xfeba,0x1d6));var _0xafeb=function(_0x33c8d9,_0x8a2018){_0x33c8d9=_0x33c8d9-0x0;var _0x5a440c=_0xfeba[_0x33c8d9];return _0x5a440c;};'use strict';var _=require(_0xafeb('0x0'));var dialogflow=require(_0xafeb('0x1'));var md5=require(_0xafeb('0x2'));var moment=require('moment');var Promise=require(_0xafeb('0x3'));var logger=require(_0xafeb('0x4'))(_0xafeb('0x5'));var utils=require('./utils');var rpc={'chatMessage':require(_0xafeb('0x6')),'openchannelMessage':require(_0xafeb('0x7')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0xafeb('0x8')),'whatsappMessage':require(_0xafeb('0x9'))};function createMessage(_0x235109,_0xcbb7a5,_0x3b3967,_0x4c95ff){return new Promise(function(_0x4f1efb,_0x28aa10){var _0x405ab6=_[_0xafeb('0xa')](_0x3b3967);_0x405ab6[_0xafeb('0xb')]=_0x4c95ff;return rpc[_0xcbb7a5+_0xafeb('0xc')][_0xafeb('0xd')](_0x405ab6)[_0xafeb('0xe')](function(){logger[_0xafeb('0xf')]('[%s][DIALOGFLOWV2]\x20%s',_0x235109,_0x405ab6[_0xafeb('0xb')]);_0x4f1efb();})['catch'](function(_0x463352){logger['error'](_0xafeb('0x10'),_0x235109,JSON[_0xafeb('0x11')](_0x463352));_0x28aa10(_0x463352);});});}exports[_0xafeb('0x12')]=function(_0x214ff5,_0x19b71e){return function(_0x13fa1b){try{if(!_[_0xafeb('0x13')](this[_0xafeb('0x14')][_0xafeb('0x15')])){logger[_0xafeb('0xf')](_0xafeb('0x10'),_0x214ff5,_0xafeb('0x16'));return _0x13fa1b['next']();}var _0xce31eb={'ContactId':this[_0xafeb('0x17')]['id'],'sentAt':moment()[_0xafeb('0x18')](_0xafeb('0x19')),'direction':'out'};if(this['channel']===_0xafeb('0x1a')||this['channel']===_0xafeb('0x1b')){_0xce31eb[_0xafeb('0x1c')]=this['interaction'][_0xafeb('0x1c')];}var _0x46b254=this[_0xafeb('0x1d')];if(_0x46b254===_0xafeb('0x1e')){_0xce31eb[_0xafeb('0x1f')]=this[_0xafeb('0x20')]['id'];}else{_0xce31eb[_[_0xafeb('0x21')](_0x46b254)+_0xafeb('0x22')]=this[_0xafeb('0x20')]['id'];}_0xce31eb[_['upperFirst'](_0x46b254)+_0xafeb('0x23')]=this['interaction']['id'];if(this[_0xafeb('0x14')]['created']){var _0x3b2949=_0x19b71e[0x4];if(!_[_0xafeb('0x24')](_0x3b2949)){_0xce31eb[_0xafeb('0xb')]=utils[_0xafeb('0x25')](_0x3b2949,this);return rpc[_0x46b254+_0xafeb('0xc')][_0xafeb('0xd')](_0xce31eb)[_0xafeb('0xe')](function(_0x4cf1e3){logger[_0xafeb('0xf')](_0xafeb('0x10'),_0x214ff5,_0xce31eb[_0xafeb('0xb')]);})['catch'](function(_0x187e15){logger[_0xafeb('0x26')]('[%s][DIALOGFLOWV2]\x20%s',_0x214ff5,JSON[_0xafeb('0x11')](_0x187e15));})[_0xafeb('0x27')](function(){logger[_0xafeb('0xf')](_0xafeb('0x28'),_0x214ff5);_0x13fa1b[_0xafeb('0x29')]();});}else{logger[_0xafeb('0xf')](_0xafeb('0x2a'),_0x214ff5);_0x13fa1b[_0xafeb('0x29')]();}}else{var _0x54c335=this;var _0x1940ee=_0x19b71e[0x2][_0xafeb('0x2b')](/\\n/g,'\x0a');var _0x2bcd54={'credentials':{'private_key':_0x1940ee,'client_email':_0x19b71e[0x1]}};var _0x433c71=new dialogflow[(_0xafeb('0x2c'))](_0x2bcd54);var _0x3cfb3a=_0x433c71[_0xafeb('0x2d')](_0x19b71e[0x0],md5(_0x54c335[_0xafeb('0x14')]['id']));var _0x5cc057={'session':_0x3cfb3a,'queryInput':{'text':{'text':_0x54c335['message']['body'],'languageCode':_0x19b71e[0x3]||'en'}}};return _0x433c71[_0xafeb('0x2e')](_0x5cc057)[_0xafeb('0xe')](function(_0x374a67){if(_0x374a67&&_0x374a67[_0xafeb('0x2f')]){_0x54c335[_0xafeb('0xb')][_0xafeb('0x30')]=_0x374a67;var _0x3a3e54=_0x374a67[0x0];var _0x55c607=_0x3a3e54[_0xafeb('0x31')][_0xafeb('0x32')]&&_0x3a3e54[_0xafeb('0x31')]['diagnosticInfo']['fields']?_0x3a3e54[_0xafeb('0x31')][_0xafeb('0x32')][_0xafeb('0x33')][_0xafeb('0x34')]['boolValue']:![];_0x54c335['body']['DIALOGFLOWV2_ACTION']=_0x3a3e54[_0xafeb('0x31')][_0xafeb('0x35')];_0x54c335[_0xafeb('0xb')][_0xafeb('0x36')]=_0x3a3e54[_0xafeb('0x31')][_0xafeb('0x37')];_0x54c335['body'][_0xafeb('0x38')]=_0x3a3e54[_0xafeb('0x31')][_0xafeb('0x32')]&&_0x3a3e54[_0xafeb('0x31')][_0xafeb('0x32')][_0xafeb('0x33')]?_0x3a3e54['queryResult']['diagnosticInfo'][_0xafeb('0x33')][_0xafeb('0x34')][_0xafeb('0x39')]:![];_0x54c335[_0xafeb('0xb')][_0xafeb('0x3a')]=_0x3a3e54['queryResult'][_0xafeb('0x3b')][_0xafeb('0x3c')];_0x54c335[_0xafeb('0xb')][_0xafeb('0x3d')]=_0x3a3e54['queryResult'][_0xafeb('0x3b')]['displayName'];_0x54c335[_0xafeb('0xb')][_0xafeb('0x3e')]=_0x3a3e54['queryResult'][_0xafeb('0x3b')][_0xafeb('0x3f')];_0x54c335[_0xafeb('0xb')][_0xafeb('0x40')]=_0x3a3e54['queryResult'][_0xafeb('0x41')];_0x54c335['body']['DIALOGFLOWV2_QUERYTEXT']=_0x3a3e54[_0xafeb('0x31')][_0xafeb('0x42')];_0x54c335['body'][_0xafeb('0x43')]=_0x3a3e54[_0xafeb('0x31')][_0xafeb('0x44')];_0xce31eb[_0xafeb('0x45')]='dialogflowV2';_0xce31eb['providerResponse']=JSON[_0xafeb('0x11')](_0x374a67);var _0x52199b=[];for(var _0x3a4b29=0x0;_0x3a4b29<_0x374a67[_0xafeb('0x2f')];_0x3a4b29++){var _0x56ea37=_0x374a67[_0x3a4b29];if(_0x56ea37&&_0x56ea37[_0xafeb('0x31')]&&_0x56ea37[_0xafeb('0x31')][_0xafeb('0x46')]){_0x52199b[_0xafeb('0x47')](createMessage(_0x214ff5,_0x46b254,_0xce31eb,_0x56ea37['queryResult']['fulfillmentText']));}}return Promise['all'](_0x52199b)['then'](function(){if(_0x55c607){_0x13fa1b[_0xafeb('0x48')]();}else{_0x13fa1b[_0xafeb('0x29')]();}})['catch'](function(_0x598501){logger['error']('[%s][DIALOGFLOWV2]\x20%s',_0x214ff5,JSON[_0xafeb('0x11')](_0x598501));_0x13fa1b[_0xafeb('0x48')]();});}})[_0xafeb('0x49')](function(_0x483363){logger[_0xafeb('0x26')](_0xafeb('0x10'),_0x214ff5,_0x483363[_0xafeb('0x4a')],_0x483363[_0xafeb('0x4b')]);_0x13fa1b[_0xafeb('0x48')]();});}}catch(_0x4f320f){logger[_0xafeb('0x26')]('[%s][DIALOGFLOWV2]\x20%s',_0x214ff5,JSON[_0xafeb('0x11')](_0x4f320f));_0x13fa1b[_0xafeb('0x29')]();}};}; \ 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 3994316..426757f 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 _0x229b=['priority\x20false\x20is\x20a\x20number','fromString','getMustacheRender','replace','length','error','[%s][GOTOIF]\x20%s','join','stop','condition','priorityTrue','priorityFalse','info','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','next','findIndex','rules','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','[%s][GOTOIF]\x20eval\x20error:\x20%s','message','stringify','validate','lodash','html-to-text','routing','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','priority\x20true\x20is\x20a\x20number'];(function(_0x1c3c59,_0x5f251a){var _0x1100b7=function(_0x1cf80c){while(--_0x1cf80c){_0x1c3c59['push'](_0x1c3c59['shift']());}};_0x1100b7(++_0x5f251a);}(_0x229b,0xa7));var _0xb229=function(_0x149c9c,_0x191a50){_0x149c9c=_0x149c9c-0x0;var _0xc952de=_0x229b[_0x149c9c];return _0xc952de;};'use strict';var schema=require(_0xb229('0x0'));var _=require(_0xb229('0x1'));var htmlToText=require(_0xb229('0x2'));var utils=require('./utils');var logger=require('../../../../config/logger')(_0xb229('0x3'));var gotoif=schema({'condition':{'type':'string','required':!![],'message':_0xb229('0x4')},'priorityTrue':{'type':_0xb229('0x5'),'message':_0xb229('0x6')},'priorityFalse':{'type':_0xb229('0x5'),'message':_0xb229('0x7')}});exports['consequence']=function(_0x33b80d,_0x3c5d80){return function(_0x18be3f){try{var _0x4ddfc9={'condition':htmlToText[_0xb229('0x8')](utils[_0xb229('0x9')](_0x3c5d80[0x0],this),{'wordwrap':![]})[_0xb229('0xa')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x3c5d80[0x1],'priorityFalse':_0x3c5d80[0x2]};var _0x1692ff=gotoif['validate'](_0x4ddfc9,{'typecast':!![]});if(_0x1692ff[_0xb229('0xb')]){logger[_0xb229('0xc')](_0xb229('0xd'),_0x33b80d,_['map'](_0x1692ff,'message')[_0xb229('0xe')](',\x20'));_0x18be3f[_0xb229('0xf')]();}else{try{var _0x3dcff0=eval('('+_0x4ddfc9[_0xb229('0x10')]+')');var _0x26cd62=_0x3dcff0?_0x4ddfc9[_0xb229('0x11')]:_0x4ddfc9[_0xb229('0x12')];logger[_0xb229('0x13')](_0xb229('0x14'),_0x33b80d,_0x4ddfc9['condition'],_0x3dcff0,_0x26cd62||_0xb229('0x15'));if(_0x26cd62){var _0xa7fa33=_[_0xb229('0x16')](_0x18be3f[_0xb229('0x17')](),{'p':_0x26cd62});if(_0xa7fa33>=0x0){logger[_0xb229('0x13')](_0xb229('0x18'),_0x33b80d,_0x26cd62||_0xb229('0x15'),_0xa7fa33);_0x18be3f[_0xb229('0x15')](_0xa7fa33);}else{logger[_0xb229('0x13')](_0xb229('0x19'),_0x33b80d,_0x26cd62||_0xb229('0x15'));_0x18be3f['stop']();}}else{_0x18be3f['next']();}}catch(_0x39e86f){logger[_0xb229('0xc')](_0xb229('0x1a'),_0x33b80d,_0x39e86f[_0xb229('0x1b')]);_0x18be3f[_0xb229('0xf')]();}}}catch(_0x2621d0){logger[_0xb229('0xc')](_0xb229('0xd'),_0x33b80d,JSON[_0xb229('0x1c')](_0x2621d0));_0x18be3f['stop']();}};}; \ No newline at end of file +var _0x0964=['validate','html-to-text','../../../../config/logger','routing','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','priority\x20true\x20is\x20a\x20number','priority\x20false\x20is\x20a\x20number','consequence','getMustacheRender','replace','error','map','join','stop','priorityTrue','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','condition','info','next','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','[%s][GOTOIF]\x20eval\x20error:\x20%s','message','[%s][GOTOIF]\x20%s','stringify'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0964,0x1ba));var _0x4096=function(_0x3fba9f,_0x3b7b9b){_0x3fba9f=_0x3fba9f-0x0;var _0x192cf1=_0x0964[_0x3fba9f];return _0x192cf1;};'use strict';var schema=require(_0x4096('0x0'));var _=require('lodash');var htmlToText=require(_0x4096('0x1'));var utils=require('./utils');var logger=require(_0x4096('0x2'))(_0x4096('0x3'));var gotoif=schema({'condition':{'type':_0x4096('0x4'),'required':!![],'message':_0x4096('0x5')},'priorityTrue':{'type':_0x4096('0x6'),'message':_0x4096('0x7')},'priorityFalse':{'type':_0x4096('0x6'),'message':_0x4096('0x8')}});exports[_0x4096('0x9')]=function(_0x16e68b,_0x20309f){return function(_0x1cfca4){try{var _0xd0791e={'condition':htmlToText['fromString'](utils[_0x4096('0xa')](_0x20309f[0x0],this),{'wordwrap':![]})[_0x4096('0xb')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x20309f[0x1],'priorityFalse':_0x20309f[0x2]};var _0x4185a8=gotoif[_0x4096('0x0')](_0xd0791e,{'typecast':!![]});if(_0x4185a8['length']){logger[_0x4096('0xc')]('[%s][GOTOIF]\x20%s',_0x16e68b,_[_0x4096('0xd')](_0x4185a8,'message')[_0x4096('0xe')](',\x20'));_0x1cfca4[_0x4096('0xf')]();}else{try{var _0x2604b1=eval('('+_0xd0791e['condition']+')');var _0x20a9dc=_0x2604b1?_0xd0791e[_0x4096('0x10')]:_0xd0791e['priorityFalse'];logger['info'](_0x4096('0x11'),_0x16e68b,_0xd0791e[_0x4096('0x12')],_0x2604b1,_0x20a9dc||'next');if(_0x20a9dc){var _0x4eeb4=_['findIndex'](_0x1cfca4['rules'](),{'p':_0x20a9dc});if(_0x4eeb4>=0x0){logger[_0x4096('0x13')]('[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x16e68b,_0x20a9dc||_0x4096('0x14'),_0x4eeb4);_0x1cfca4[_0x4096('0x14')](_0x4eeb4);}else{logger[_0x4096('0x13')](_0x4096('0x15'),_0x16e68b,_0x20a9dc||_0x4096('0x14'));_0x1cfca4['stop']();}}else{_0x1cfca4[_0x4096('0x14')]();}}catch(_0x3c926f){logger[_0x4096('0xc')](_0x4096('0x16'),_0x16e68b,_0x3c926f[_0x4096('0x17')]);_0x1cfca4[_0x4096('0xf')]();}}}catch(_0x4a37f8){logger[_0x4096('0xc')](_0x4096('0x18'),_0x16e68b,JSON[_0x4096('0x19')](_0x4a37f8));_0x1cfca4[_0x4096('0xf')]();}};}; \ 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 56d9dd9..a721989 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 _0x0601=['[%s][GOTOP]\x20%s','stringify','validate','lodash','routing','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','length','error','map','join','stop','[%s][GOTOP]\x20priority\x20%s','priority','rules','info','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found'];(function(_0xc817c2,_0x584c72){var _0x41be1b=function(_0x561f96){while(--_0x561f96){_0xc817c2['push'](_0xc817c2['shift']());}};_0x41be1b(++_0x584c72);}(_0x0601,0x122));var _0x1060=function(_0xd685e,_0x360045){_0xd685e=_0xd685e-0x0;var _0x5ef5e0=_0x0601[_0xd685e];return _0x5ef5e0;};'use strict';var schema=require(_0x1060('0x0'));var _=require(_0x1060('0x1'));var logger=require('../../../../config/logger')(_0x1060('0x2'));var gotop=schema({'priority':{'type':'number','required':!![],'message':_0x1060('0x3')}});exports['consequence']=function(_0x29a785,_0x1685df){return function(_0x44c7d7){try{var _0x44cecf={'priority':_0x1685df[0x0]};var _0x49c5df=gotop[_0x1060('0x0')](_0x44cecf,{'typecast':!![]});if(_0x49c5df[_0x1060('0x4')]){logger[_0x1060('0x5')]('[%s][GOTOP]\x20%s',_0x29a785,_[_0x1060('0x6')](_0x49c5df,'message')[_0x1060('0x7')](',\x20'));_0x44c7d7[_0x1060('0x8')]();}else{logger['info'](_0x1060('0x9'),_0x29a785,_0x44cecf[_0x1060('0xa')]);if(_0x44cecf[_0x1060('0xa')]){var _0x5d2c42=_['findIndex'](_0x44c7d7[_0x1060('0xb')](),{'p':_0x44cecf['priority']});if(_0x5d2c42>=0x0){logger[_0x1060('0xc')](_0x1060('0xd'),_0x29a785,_0x44cecf[_0x1060('0xa')]||_0x1060('0xe'),_0x5d2c42);_0x44c7d7['next'](_0x5d2c42);}else{logger[_0x1060('0xc')](_0x1060('0xf'),_0x29a785,_0x44cecf['priority']||_0x1060('0xe'));_0x44c7d7[_0x1060('0x8')]();}}else{_0x44c7d7[_0x1060('0xe')]();}}}catch(_0xb09140){logger[_0x1060('0x5')](_0x1060('0x10'),_0x29a785,JSON[_0x1060('0x11')](_0xb09140));_0x44c7d7[_0x1060('0x8')]();}};}; \ No newline at end of file +var _0x3ed6=['[%s][GOTOP]\x20%s','map','message','join','stop','info','priority','findIndex','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','stringify','validate','lodash','../../../../config/logger','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','length','error'];(function(_0x17edac,_0x30535a){var _0x1e96d6=function(_0x5b9e00){while(--_0x5b9e00){_0x17edac['push'](_0x17edac['shift']());}};_0x1e96d6(++_0x30535a);}(_0x3ed6,0x107));var _0x63ed=function(_0x81a792,_0x1cd2be){_0x81a792=_0x81a792-0x0;var _0x35d356=_0x3ed6[_0x81a792];return _0x35d356;};'use strict';var schema=require(_0x63ed('0x0'));var _=require(_0x63ed('0x1'));var logger=require(_0x63ed('0x2'))('routing');var gotop=schema({'priority':{'type':_0x63ed('0x3'),'required':!![],'message':_0x63ed('0x4')}});exports['consequence']=function(_0x18656a,_0xb5130a){return function(_0x14763f){try{var _0xe624bd={'priority':_0xb5130a[0x0]};var _0x10aa22=gotop[_0x63ed('0x0')](_0xe624bd,{'typecast':!![]});if(_0x10aa22[_0x63ed('0x5')]){logger[_0x63ed('0x6')](_0x63ed('0x7'),_0x18656a,_[_0x63ed('0x8')](_0x10aa22,_0x63ed('0x9'))[_0x63ed('0xa')](',\x20'));_0x14763f[_0x63ed('0xb')]();}else{logger[_0x63ed('0xc')]('[%s][GOTOP]\x20priority\x20%s',_0x18656a,_0xe624bd[_0x63ed('0xd')]);if(_0xe624bd['priority']){var _0x20f4e8=_[_0x63ed('0xe')](_0x14763f['rules'](),{'p':_0xe624bd[_0x63ed('0xd')]});if(_0x20f4e8>=0x0){logger[_0x63ed('0xc')](_0x63ed('0xf'),_0x18656a,_0xe624bd['priority']||_0x63ed('0x10'),_0x20f4e8);_0x14763f['next'](_0x20f4e8);}else{logger[_0x63ed('0xc')]('[%s][GOTOP]\x20priority\x20%s\x20not\x20found',_0x18656a,_0xe624bd['priority']||_0x63ed('0x10'));_0x14763f[_0x63ed('0xb')]();}}else{_0x14763f['next']();}}}catch(_0x11508f){logger[_0x63ed('0x6')](_0x63ed('0x7'),_0x18656a,JSON[_0x63ed('0x11')](_0x11508f));_0x14763f[_0x63ed('0xb')]();}};}; \ 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 a913eb8..40a2d6f 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 _0x61ce=['getMustacheRender','contact','channel','chat','ChatWebsiteId','upperFirst','AccountId','account','interaction','Message','create','then','[%s][MESSAGE]\x20%s','body','next','catch','error','stringify','stop','./utils','../../../../config/logger','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x61ce,0xeb));var _0xe61c=function(_0x47730b,_0x4044e1){_0x47730b=_0x47730b-0x0;var _0x593305=_0x61ce[_0x47730b];return _0x593305;};'use strict';var _=require('lodash');var utils=require(_0xe61c('0x0'));var logger=require(_0xe61c('0x1'))('routing');var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0xe61c('0x2')),'mailMessage':require(_0xe61c('0x3')),'smsMessage':require(_0xe61c('0x4')),'faxMessage':require(_0xe61c('0x5')),'whatsappMessage':require(_0xe61c('0x6'))};exports[_0xe61c('0x7')]=function(_0x18488d,_0x2b93cc){return function(_0x1f2797){try{var _0x547ad7={'body':utils[_0xe61c('0x8')](_0x2b93cc[0x0],this),'ContactId':this[_0xe61c('0x9')]['id']};if(this[_0xe61c('0xa')]===_0xe61c('0xb')){_0x547ad7[_0xe61c('0xc')]=this['account']['id'];}else{_0x547ad7[_[_0xe61c('0xd')](this[_0xe61c('0xa')])+_0xe61c('0xe')]=this[_0xe61c('0xf')]['id'];}_0x547ad7[_[_0xe61c('0xd')](this[_0xe61c('0xa')])+'InteractionId']=this[_0xe61c('0x10')]['id'];if(rpc[this[_0xe61c('0xa')]+'Message']){return rpc[this['channel']+_0xe61c('0x11')][_0xe61c('0x12')](_0x547ad7)[_0xe61c('0x13')](function(_0x3bd46b){logger['info'](_0xe61c('0x14'),_0x18488d,_0x547ad7[_0xe61c('0x15')]);_0x1f2797[_0xe61c('0x16')]();})[_0xe61c('0x17')](function(_0x349237){logger[_0xe61c('0x18')](_0xe61c('0x14'),_0x18488d,JSON[_0xe61c('0x19')](_0x349237));_0x1f2797[_0xe61c('0x1a')]();});}}catch(_0x20a1a1){logger[_0xe61c('0x18')](_0xe61c('0x14'),_0x18488d,JSON['stringify'](_0x20a1a1));_0x1f2797[_0xe61c('0x1a')]();}};}; \ No newline at end of file +var _0x0abf=['[%s][MESSAGE]\x20%s','body','next','catch','error','stringify','stop','lodash','../../../../config/logger','routing','../../rpc/mailMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','contact','channel','chat','ChatWebsiteId','upperFirst','AccountId','interaction','Message','create','then','info'];(function(_0x3740fe,_0x6c543c){var _0x55492b=function(_0x1f851f){while(--_0x1f851f){_0x3740fe['push'](_0x3740fe['shift']());}};_0x55492b(++_0x6c543c);}(_0x0abf,0xe8));var _0xf0ab=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x0abf[_0x2b4411];return _0x8e41ef;};'use strict';var _=require(_0xf0ab('0x0'));var utils=require('./utils');var logger=require(_0xf0ab('0x1'))(_0xf0ab('0x2'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0xf0ab('0x3')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0xf0ab('0x4')),'whatsappMessage':require(_0xf0ab('0x5'))};exports[_0xf0ab('0x6')]=function(_0xbb1f91,_0x2ab7d6){return function(_0x4d2ea8){try{var _0x233afe={'body':utils['getMustacheRender'](_0x2ab7d6[0x0],this),'ContactId':this[_0xf0ab('0x7')]['id']};if(this[_0xf0ab('0x8')]===_0xf0ab('0x9')){_0x233afe[_0xf0ab('0xa')]=this['account']['id'];}else{_0x233afe[_[_0xf0ab('0xb')](this[_0xf0ab('0x8')])+_0xf0ab('0xc')]=this['account']['id'];}_0x233afe[_['upperFirst'](this[_0xf0ab('0x8')])+'InteractionId']=this[_0xf0ab('0xd')]['id'];if(rpc[this[_0xf0ab('0x8')]+_0xf0ab('0xe')]){return rpc[this[_0xf0ab('0x8')]+_0xf0ab('0xe')][_0xf0ab('0xf')](_0x233afe)[_0xf0ab('0x10')](function(_0x4fdd5f){logger[_0xf0ab('0x11')](_0xf0ab('0x12'),_0xbb1f91,_0x233afe[_0xf0ab('0x13')]);_0x4d2ea8[_0xf0ab('0x14')]();})[_0xf0ab('0x15')](function(_0x36cabe){logger[_0xf0ab('0x16')](_0xf0ab('0x12'),_0xbb1f91,JSON[_0xf0ab('0x17')](_0x36cabe));_0x4d2ea8[_0xf0ab('0x18')]();});}}catch(_0x20f453){logger[_0xf0ab('0x16')](_0xf0ab('0x12'),_0xbb1f91,JSON[_0xf0ab('0x17')](_0x20f453));_0x4d2ea8[_0xf0ab('0x18')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/noop.js b/server/services/routing/server/applications/noop.js index 5aa3670..1a0b505 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 _0x2ba9=['getMustacheRender','next','error','[%s][NOOP]\x20%s','stringify','stop','./utils','../../../../config/logger','routing','consequence','info'];(function(_0xb46cee,_0x734f6b){var _0x5e44f0=function(_0x5c90a6){while(--_0x5c90a6){_0xb46cee['push'](_0xb46cee['shift']());}};_0x5e44f0(++_0x734f6b);}(_0x2ba9,0x10e));var _0x92ba=function(_0xd53b81,_0x1da761){_0xd53b81=_0xd53b81-0x0;var _0x52221a=_0x2ba9[_0xd53b81];return _0x52221a;};'use strict';var utils=require(_0x92ba('0x0'));var logger=require(_0x92ba('0x1'))(_0x92ba('0x2'));exports[_0x92ba('0x3')]=function(_0x35947f,_0x28c145){return function(_0x2fc733){try{logger[_0x92ba('0x4')]('[%s][NOOP]\x20%s',_0x35947f,utils[_0x92ba('0x5')](_0x28c145[0x0],this));_0x2fc733[_0x92ba('0x6')]();}catch(_0x6c9256){logger[_0x92ba('0x7')](_0x92ba('0x8'),_0x35947f,JSON[_0x92ba('0x9')](_0x6c9256));_0x2fc733[_0x92ba('0xa')]();}};}; \ No newline at end of file +var _0xc492=['stringify','stop','../../../../config/logger','routing','consequence','info','[%s][NOOP]\x20%s','getMustacheRender','error'];(function(_0x19a49f,_0x444d74){var _0x5351ae=function(_0x58b1ed){while(--_0x58b1ed){_0x19a49f['push'](_0x19a49f['shift']());}};_0x5351ae(++_0x444d74);}(_0xc492,0x146));var _0x2c49=function(_0x268c94,_0x3cf72d){_0x268c94=_0x268c94-0x0;var _0x3c60a4=_0xc492[_0x268c94];return _0x3c60a4;};'use strict';var utils=require('./utils');var logger=require(_0x2c49('0x0'))(_0x2c49('0x1'));exports[_0x2c49('0x2')]=function(_0x103f61,_0x4aae40){return function(_0x18afd2){try{logger[_0x2c49('0x3')](_0x2c49('0x4'),_0x103f61,utils[_0x2c49('0x5')](_0x4aae40[0x0],this));_0x18afd2['next']();}catch(_0x1043c1){logger[_0x2c49('0x6')](_0x2c49('0x4'),_0x103f61,JSON[_0x2c49('0x7')](_0x1043c1));_0x18afd2[_0x2c49('0x8')]();}};}; \ 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 6cbcbfd..383bddd 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 _0x7821=['./strategy','defaults','redis','localhost','account','queue','from','emit','clone','push','capitalize','InteractionId','%sQueuesWaitingInteractions','pick','format','%s:queue:%s','save','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','../../rpc/chatInteraction','../../rpc/mailInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/whatsappInteraction','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','waiting','body','YYYY-MM-DD\x20HH:mm:ss','contact','list','upperFirst','channel','QueueId','interaction','message','chat','AccountId','WebsiteId','name','QueueReport','create','catch','error','accepted','info','[%s][STOP:QUEUE][NAME:%s]','Interaction','then','update\x20queue\x20report','timeout','[%s][END:QUEUE][NAME:%s]','update','toLowerCase','consequence','length','[%s][QUEUE]\x20%s','map','stop','find','Queues','createQueue','atimeout','qtimeout','rules','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','complete','[%s][QUEUE]\x20APPLICATION\x20END','strategy','rrmemory','moment','../../../../config/logger'];(function(_0x1d3eaf,_0x260522){var _0x19aa8d=function(_0x3ebe52){while(--_0x3ebe52){_0x1d3eaf['push'](_0x1d3eaf['shift']());}};_0x19aa8d(++_0x260522);}(_0x7821,0x9c));var _0x1782=function(_0xd7b0a4,_0x53c7d3){_0xd7b0a4=_0xd7b0a4-0x0;var _0x184e9e=_0x7821[_0xd7b0a4];return _0x184e9e;};'use strict';var schema=require('validate');var _=require('lodash');var util=require('util');var seqqueue=require('seq-queue');var moment=require(_0x1782('0x0'));var Redis=require('ioredis');var config=require('../../../../config/environment');var logger=require(_0x1782('0x1'))('routing');var strategy=require(_0x1782('0x2'));config['redis']=_[_0x1782('0x3')](config[_0x1782('0x4')],{'host':_0x1782('0x5'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x1782('0x4')]));var attributes=['id','queue_id',_0x1782('0x6'),_0x1782('0x7'),_0x1782('0x8'),'joinAt'];function emit(_0x184913,_0x37ab9c,_0x4a93b1){io['to'](_0x184913)[_0x1782('0x9')](_0x37ab9c,_0x4a93b1);}function emitChannelQueueInteraction(_0x42d1ed,_0x505a46,_0xa3bd23,_0x5aea9a,_0x4109b8,_0x2508dd,_0x3f955a,_0x565363){var _0xf04421=_[_0x1782('0xa')](_0xa3bd23);_0xf04421['queue_id']=_0x565363;_0xf04421[_0x1782('0x7')]=_0x505a46;_0xf04421['account']=_0x5aea9a;_0xf04421['id']=_0x4109b8;if(_0x2508dd){attributes[_0x1782('0xb')](_[_0x1782('0xc')](_0x42d1ed)+_0x1782('0xd'));_0x3f955a[util['format'](_0x1782('0xe'),_0x42d1ed)][_0x4109b8]=_[_0x1782('0xf')](_0xf04421,attributes);}else{delete _0x3f955a[util['format']('%sQueuesWaitingInteractions',_0x42d1ed)][_0x4109b8];}emit(util[_0x1782('0x10')](_0x1782('0x11'),_0x42d1ed,_0x505a46),util[_0x1782('0x10')]('%s_queue_waiting_interaction:%s',_0x42d1ed,_0x2508dd?_0x1782('0x12'):'remove'),_['pick'](_0xf04421,attributes));}var rpc={'openchannelQueueReport':require(_0x1782('0x13')),'mailQueueReport':require(_0x1782('0x14')),'chatQueueReport':require(_0x1782('0x15')),'smsQueueReport':require('../../rpc/smsQueueReport'),'faxQueueReport':require(_0x1782('0x16')),'whatsappQueueReport':require(_0x1782('0x17')),'chatInteraction':require(_0x1782('0x18')),'faxInteraction':require('../../rpc/faxInteraction'),'mailInteraction':require(_0x1782('0x19')),'openchannelInteraction':require(_0x1782('0x1a')),'smsInteraction':require(_0x1782('0x1b')),'whatsappInteraction':require(_0x1782('0x1c'))};var queue=schema({'name':{'type':_0x1782('0x1d'),'required':!![],'message':_0x1782('0x1e')},'timeout':{'type':_0x1782('0x1f'),'message':_0x1782('0x20')}});function startRouting(_0x3a39c9,_0x4abdbf,_0xd88f5d,_0xa0a71c){if(_0x3a39c9&&_0x4abdbf&&_0xd88f5d){_0x4abdbf[_0x1782('0x21')]+=0x1;var _0x39920d={'uniqueid':_0x3a39c9,'from':_0xd88f5d[_0x1782('0x22')]?_0xd88f5d[_0x1782('0x22')][_0x1782('0x8')]:'','joinAt':moment()['format'](_0x1782('0x23')),'ContactId':_0xd88f5d[_0x1782('0x24')]?_0xd88f5d[_0x1782('0x24')]['id']:null,'ListId':_0xd88f5d[_0x1782('0x25')]?_0xd88f5d[_0x1782('0x25')]['id']:null};_0x39920d[_[_0x1782('0x26')](_0xd88f5d[_0x1782('0x27')])+_0x1782('0x28')]=_0x4abdbf['id']||null;_0x39920d[_[_0x1782('0x26')](_0xd88f5d[_0x1782('0x27')])+_0x1782('0xd')]=_0xd88f5d['interaction']?_0xd88f5d[_0x1782('0x29')]['id']:null;_0x39920d[_[_0x1782('0x26')](_0xd88f5d[_0x1782('0x27')])+'MessageId']=_0xd88f5d[_0x1782('0x2a')]?_0xd88f5d[_0x1782('0x2a')]['id']:null;_0x39920d[_[_0x1782('0x26')](_0xd88f5d[_0x1782('0x27')])+(_0xd88f5d[_0x1782('0x27')]!==_0x1782('0x2b')?_0x1782('0x2c'):_0x1782('0x2d'))]=_0xd88f5d[_0x1782('0x6')]?_0xd88f5d[_0x1782('0x6')]['id']:null;logger['info'](util[_0x1782('0x10')]('[%s][START:QUEUE][NAME:%s]',_0x3a39c9,_0x4abdbf[_0x1782('0x2e')]));emitChannelQueueInteraction(_0xd88f5d[_0x1782('0x27')],_0x4abdbf[_0x1782('0x2e')],_0x39920d,_0xd88f5d[_0x1782('0x6')][_0x1782('0x2e')],_0xd88f5d[_0x1782('0x2a')]['id'],!![],_0xa0a71c,_0x4abdbf['id']);if(rpc[_0xd88f5d[_0x1782('0x27')]+_0x1782('0x2f')]){return rpc[_0xd88f5d[_0x1782('0x27')]+_0x1782('0x2f')][_0x1782('0x30')](_0x39920d)[_0x1782('0x31')](function(_0x54d1e6){logger[_0x1782('0x32')]('create\x20queue\x20report',_0x54d1e6);});}}}function stopRouting(_0x108ceb,_0x4a8768,_0x42f7ca,_0x14dd8d){if(_0x108ceb&&_0x4a8768){_0x4a8768['waiting']-=0x1;var _0x443983={'leaveAt':moment()['format'](_0x1782('0x23')),'acceptAt':moment()[_0x1782('0x10')](_0x1782('0x23')),'reason':_0x1782('0x33')};logger[_0x1782('0x34')](util['format'](_0x1782('0x35'),_0x108ceb,_0x4a8768['name']));emitChannelQueueInteraction(_0x42f7ca[_0x1782('0x27')],_0x4a8768[_0x1782('0x2e')],_0x42f7ca[_0x1782('0x22')],_0x42f7ca[_0x1782('0x6')][_0x1782('0x2e')],_0x42f7ca[_0x1782('0x2a')]['id'],![],_0x14dd8d,_0x4a8768['id']);return rpc[_0x42f7ca[_0x1782('0x27')]+_0x1782('0x36')]['update'](_0x42f7ca['interaction']['id'],{'queueId':_0x4a8768['id']})[_0x1782('0x37')](function(){if(rpc[_0x42f7ca[_0x1782('0x27')]+_0x1782('0x2f')]){return rpc[_0x42f7ca[_0x1782('0x27')]+_0x1782('0x2f')]['update'](_0x108ceb,_0x443983)['catch'](function(_0x5e9a89){logger[_0x1782('0x32')](_0x1782('0x38'),_0x5e9a89);});}});}}function endRouting(_0x524e9f,_0x454b98,_0x1ad731,_0x1ce01b){if(_0x524e9f&&_0x454b98){_0x454b98['waiting']-=0x1;var _0x495bfa={'leaveAt':moment()[_0x1782('0x10')](_0x1782('0x23')),'exitAt':moment()[_0x1782('0x10')](_0x1782('0x23')),'reason':_0x1782('0x39')};logger[_0x1782('0x34')](util['format'](_0x1782('0x3a'),_0x524e9f,_0x454b98[_0x1782('0x2e')]));emitChannelQueueInteraction(_0x1ad731[_0x1782('0x27')],_0x454b98[_0x1782('0x2e')],_0x1ad731['body'],_0x1ad731[_0x1782('0x6')]['name'],_0x1ad731['message']['id'],![],_0x1ce01b);if(rpc[_0x1ad731['channel']+_0x1782('0x2f')]){return rpc[_0x1ad731[_0x1782('0x27')]+'QueueReport'][_0x1782('0x3b')](_0x524e9f,_0x495bfa)[_0x1782('0x31')](function(_0x57c748){logger['error'](_0x1782('0x38'),_0x57c748);});}}}function handleFindQueue(_0x1b5703){return function(_0x7ab579){return _0x7ab579[_0x1782('0x2e')][_0x1782('0x3c')]()===_0x1b5703[_0x1782('0x3c')]();};}exports[_0x1782('0x3d')]=function(_0x4c4f44,_0x5c60f,_0x24c95e,_0x48a96e){return function(_0x47f812){try{var _0x2db4b2={'name':_0x5c60f[0x0],'timeout':_0x5c60f[0x1]};var _0x1c4172=queue['validate'](_0x2db4b2,{'typecast':!![]});if(_0x1c4172[_0x1782('0x3e')]){logger['error'](_0x1782('0x3f'),_0x4c4f44,_[_0x1782('0x40')](_0x1c4172,_0x1782('0x2a'))['join'](',\x20'));_0x47f812[_0x1782('0x41')]();}else{var _0x1161ae=_[_0x1782('0x42')](_0x24c95e[_0x48a96e[_0x1782('0x27')]+_0x1782('0x43')],handleFindQueue(_0x2db4b2[_0x1782('0x2e')]));if(_0x1161ae){startRouting(_0x4c4f44,_0x1161ae,_0x48a96e,_0x24c95e);var _0x3197eb=(_0x1161ae[_0x1782('0x39')]||0xa)*0x3e8;var _0x42f308=(_0x2db4b2['timeout']||0x14)*0x3e8;var _0x564f82;if(_0x3197eb>_0x42f308){_0x42f308=_0x3197eb;}var _0x17954a=seqqueue[_0x1782('0x44')](_0x3197eb);_0x17954a['id']=_0x4c4f44;_0x17954a[_0x1782('0x45')]=_0x3197eb;_0x17954a[_0x1782('0x46')]=_0x42f308;_0x17954a['channel']=_0x48a96e[_0x1782('0x27')];_0x24c95e[_0x1782('0x47')][_0x4c4f44]['on'](_0x1782('0x48'),function(){logger[_0x1782('0x34')](_0x1782('0x49'),_0x4c4f44);stopRouting(_0x4c4f44,_0x1161ae,_0x48a96e,_0x24c95e);clearTimeout(_0x564f82);_0x564f82=undefined;_0x17954a[_0x1782('0x4a')](!![]);if(_0x24c95e[_0x1782('0x47')][_0x4c4f44]){delete _0x24c95e[_0x1782('0x47')][_0x4c4f44];}_0x47f812[_0x1782('0x41')]();});_0x24c95e[_0x1782('0x47')][_0x4c4f44]['on'](_0x1782('0x4b'),function(){if(_0x24c95e[_0x1782('0x47')][_0x4c4f44]){delete _0x24c95e['rules'][_0x4c4f44];}});_0x564f82=setTimeout(function(){logger[_0x1782('0x34')](_0x1782('0x4c'),_0x4c4f44);endRouting(_0x4c4f44,_0x1161ae,_0x48a96e,_0x24c95e);clearTimeout(_0x564f82);_0x17954a['close'](!![]);_0x47f812['next']();},_0x42f308);switch(_0x1161ae[_0x1782('0x4d')]){case _0x1782('0x4e'):strategy[_0x1782('0x4e')](_0x17954a,_0x1161ae,_0x24c95e,_0x48a96e);break;default:strategy['beepall'](_0x17954a,_0x1161ae,_0x24c95e,_0x48a96e);}}else{logger[_0x1782('0x32')]('[%s][QUEUE]\x20queue\x20not\x20found\x20%s',_0x4c4f44,_0x2db4b2[_0x1782('0x2e')]);_0x47f812[_0x1782('0x41')]();}}}catch(_0x4d84f4){logger[_0x1782('0x32')](_0x1782('0x3f'),_0x4c4f44,_0x4d84f4['stack']);_0x47f812[_0x1782('0x41')]();}};}; \ No newline at end of file +var _0x9390=['from','YYYY-MM-DD\x20HH:mm:ss','contact','list','channel','QueueId','upperFirst','interaction','MessageId','message','AccountId','[%s][START:QUEUE][NAME:%s]','name','QueueReport','create','catch','create\x20queue\x20report','info','[%s][STOP:QUEUE][NAME:%s]','Interaction','update','error','update\x20queue\x20report','timeout','[%s][END:QUEUE][NAME:%s]','toLowerCase','consequence','length','[%s][QUEUE]\x20%s','map','join','stop','find','Queues','atimeout','qtimeout','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','rules','complete','[%s][QUEUE]\x20APPLICATION\x20END','strategy','rrmemory','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','stack','validate','util','seq-queue','../../../../config/environment','routing','./strategy','redis','localhost','socket.io-emitter','queue_id','account','queue','joinAt','format','%sQueuesWaitingInteractions','pick','%s:queue:%s','%s_queue_waiting_interaction:%s','save','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','../../rpc/chatInteraction','../../rpc/mailInteraction','../../rpc/openchannelInteraction','number','timeout\x20is\x20a\x20number','waiting','body'];(function(_0x27ca07,_0x326280){var _0x54d51a=function(_0xf7a0ed){while(--_0xf7a0ed){_0x27ca07['push'](_0x27ca07['shift']());}};_0x54d51a(++_0x326280);}(_0x9390,0xc7));var _0x0939=function(_0x4ba96e,_0x2469d4){_0x4ba96e=_0x4ba96e-0x0;var _0x263fa4=_0x9390[_0x4ba96e];return _0x263fa4;};'use strict';var schema=require(_0x0939('0x0'));var _=require('lodash');var util=require(_0x0939('0x1'));var seqqueue=require(_0x0939('0x2'));var moment=require('moment');var Redis=require('ioredis');var config=require(_0x0939('0x3'));var logger=require('../../../../config/logger')(_0x0939('0x4'));var strategy=require(_0x0939('0x5'));config[_0x0939('0x6')]=_['defaults'](config[_0x0939('0x6')],{'host':_0x0939('0x7'),'port':0x18eb});var io=require(_0x0939('0x8'))(new Redis(config[_0x0939('0x6')]));var attributes=['id',_0x0939('0x9'),_0x0939('0xa'),_0x0939('0xb'),'from',_0x0939('0xc')];function emit(_0x5b562b,_0x21c90b,_0xcf172a){io['to'](_0x5b562b)['emit'](_0x21c90b,_0xcf172a);}function emitChannelQueueInteraction(_0x1ef392,_0xb0052e,_0x566522,_0x45ad9,_0x1f62eb,_0x164b66,_0xb36312,_0x54a538){var _0x34c8a9=_['clone'](_0x566522);_0x34c8a9['queue_id']=_0x54a538;_0x34c8a9['queue']=_0xb0052e;_0x34c8a9['account']=_0x45ad9;_0x34c8a9['id']=_0x1f62eb;if(_0x164b66){attributes['push'](_['capitalize'](_0x1ef392)+'InteractionId');_0xb36312[util[_0x0939('0xd')](_0x0939('0xe'),_0x1ef392)][_0x1f62eb]=_[_0x0939('0xf')](_0x34c8a9,attributes);}else{delete _0xb36312[util[_0x0939('0xd')](_0x0939('0xe'),_0x1ef392)][_0x1f62eb];}emit(util[_0x0939('0xd')](_0x0939('0x10'),_0x1ef392,_0xb0052e),util[_0x0939('0xd')](_0x0939('0x11'),_0x1ef392,_0x164b66?_0x0939('0x12'):'remove'),_[_0x0939('0xf')](_0x34c8a9,attributes));}var rpc={'openchannelQueueReport':require(_0x0939('0x13')),'mailQueueReport':require(_0x0939('0x14')),'chatQueueReport':require(_0x0939('0x15')),'smsQueueReport':require(_0x0939('0x16')),'faxQueueReport':require(_0x0939('0x17')),'whatsappQueueReport':require(_0x0939('0x18')),'chatInteraction':require(_0x0939('0x19')),'faxInteraction':require('../../rpc/faxInteraction'),'mailInteraction':require(_0x0939('0x1a')),'openchannelInteraction':require(_0x0939('0x1b')),'smsInteraction':require('../../rpc/smsInteraction'),'whatsappInteraction':require('../../rpc/whatsappInteraction')};var queue=schema({'name':{'type':'string','required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':_0x0939('0x1c'),'message':_0x0939('0x1d')}});function startRouting(_0x5ec9f2,_0x1ba61b,_0x89da51,_0x3e01d2){if(_0x5ec9f2&&_0x1ba61b&&_0x89da51){_0x1ba61b[_0x0939('0x1e')]+=0x1;var _0x3aa422={'uniqueid':_0x5ec9f2,'from':_0x89da51['body']?_0x89da51[_0x0939('0x1f')][_0x0939('0x20')]:'','joinAt':moment()[_0x0939('0xd')](_0x0939('0x21')),'ContactId':_0x89da51[_0x0939('0x22')]?_0x89da51[_0x0939('0x22')]['id']:null,'ListId':_0x89da51[_0x0939('0x23')]?_0x89da51[_0x0939('0x23')]['id']:null};_0x3aa422[_['upperFirst'](_0x89da51[_0x0939('0x24')])+_0x0939('0x25')]=_0x1ba61b['id']||null;_0x3aa422[_[_0x0939('0x26')](_0x89da51[_0x0939('0x24')])+'InteractionId']=_0x89da51[_0x0939('0x27')]?_0x89da51[_0x0939('0x27')]['id']:null;_0x3aa422[_[_0x0939('0x26')](_0x89da51[_0x0939('0x24')])+_0x0939('0x28')]=_0x89da51[_0x0939('0x29')]?_0x89da51[_0x0939('0x29')]['id']:null;_0x3aa422[_['upperFirst'](_0x89da51[_0x0939('0x24')])+(_0x89da51[_0x0939('0x24')]!=='chat'?_0x0939('0x2a'):'WebsiteId')]=_0x89da51['account']?_0x89da51[_0x0939('0xa')]['id']:null;logger['info'](util[_0x0939('0xd')](_0x0939('0x2b'),_0x5ec9f2,_0x1ba61b[_0x0939('0x2c')]));emitChannelQueueInteraction(_0x89da51[_0x0939('0x24')],_0x1ba61b[_0x0939('0x2c')],_0x3aa422,_0x89da51[_0x0939('0xa')]['name'],_0x89da51[_0x0939('0x29')]['id'],!![],_0x3e01d2,_0x1ba61b['id']);if(rpc[_0x89da51['channel']+_0x0939('0x2d')]){return rpc[_0x89da51[_0x0939('0x24')]+_0x0939('0x2d')][_0x0939('0x2e')](_0x3aa422)[_0x0939('0x2f')](function(_0x6ac200){logger['error'](_0x0939('0x30'),_0x6ac200);});}}}function stopRouting(_0x5aa1d3,_0x5e86ed,_0x3c4b1e,_0x3b708f){if(_0x5aa1d3&&_0x5e86ed){_0x5e86ed[_0x0939('0x1e')]-=0x1;var _0x26ef4c={'leaveAt':moment()[_0x0939('0xd')](_0x0939('0x21')),'acceptAt':moment()[_0x0939('0xd')](_0x0939('0x21')),'reason':'accepted'};logger[_0x0939('0x31')](util[_0x0939('0xd')](_0x0939('0x32'),_0x5aa1d3,_0x5e86ed[_0x0939('0x2c')]));emitChannelQueueInteraction(_0x3c4b1e['channel'],_0x5e86ed['name'],_0x3c4b1e[_0x0939('0x1f')],_0x3c4b1e[_0x0939('0xa')][_0x0939('0x2c')],_0x3c4b1e['message']['id'],![],_0x3b708f,_0x5e86ed['id']);return rpc[_0x3c4b1e[_0x0939('0x24')]+_0x0939('0x33')][_0x0939('0x34')](_0x3c4b1e[_0x0939('0x27')]['id'],{'queueId':_0x5e86ed['id']})['then'](function(){if(rpc[_0x3c4b1e['channel']+'QueueReport']){return rpc[_0x3c4b1e['channel']+_0x0939('0x2d')][_0x0939('0x34')](_0x5aa1d3,_0x26ef4c)[_0x0939('0x2f')](function(_0x3257b5){logger[_0x0939('0x35')](_0x0939('0x36'),_0x3257b5);});}});}}function endRouting(_0x138cb9,_0x1e5134,_0x59f06a,_0x3671c0){if(_0x138cb9&&_0x1e5134){_0x1e5134['waiting']-=0x1;var _0x25f1de={'leaveAt':moment()[_0x0939('0xd')](_0x0939('0x21')),'exitAt':moment()[_0x0939('0xd')](_0x0939('0x21')),'reason':_0x0939('0x37')};logger[_0x0939('0x31')](util[_0x0939('0xd')](_0x0939('0x38'),_0x138cb9,_0x1e5134[_0x0939('0x2c')]));emitChannelQueueInteraction(_0x59f06a[_0x0939('0x24')],_0x1e5134[_0x0939('0x2c')],_0x59f06a[_0x0939('0x1f')],_0x59f06a[_0x0939('0xa')]['name'],_0x59f06a['message']['id'],![],_0x3671c0);if(rpc[_0x59f06a[_0x0939('0x24')]+_0x0939('0x2d')]){return rpc[_0x59f06a[_0x0939('0x24')]+_0x0939('0x2d')][_0x0939('0x34')](_0x138cb9,_0x25f1de)[_0x0939('0x2f')](function(_0x4384f1){logger[_0x0939('0x35')]('update\x20queue\x20report',_0x4384f1);});}}}function handleFindQueue(_0x1814ab){return function(_0x116481){return _0x116481[_0x0939('0x2c')][_0x0939('0x39')]()===_0x1814ab['toLowerCase']();};}exports[_0x0939('0x3a')]=function(_0xfd0c6d,_0x291f9f,_0x3cfdcc,_0x504f5c){return function(_0x4d4644){try{var _0x1a1c4d={'name':_0x291f9f[0x0],'timeout':_0x291f9f[0x1]};var _0xe8b51d=queue[_0x0939('0x0')](_0x1a1c4d,{'typecast':!![]});if(_0xe8b51d[_0x0939('0x3b')]){logger[_0x0939('0x35')](_0x0939('0x3c'),_0xfd0c6d,_[_0x0939('0x3d')](_0xe8b51d,_0x0939('0x29'))[_0x0939('0x3e')](',\x20'));_0x4d4644[_0x0939('0x3f')]();}else{var _0x21600f=_[_0x0939('0x40')](_0x3cfdcc[_0x504f5c[_0x0939('0x24')]+_0x0939('0x41')],handleFindQueue(_0x1a1c4d[_0x0939('0x2c')]));if(_0x21600f){startRouting(_0xfd0c6d,_0x21600f,_0x504f5c,_0x3cfdcc);var _0x912b72=(_0x21600f[_0x0939('0x37')]||0xa)*0x3e8;var _0x164693=(_0x1a1c4d[_0x0939('0x37')]||0x14)*0x3e8;var _0x2cc29b;if(_0x912b72>_0x164693){_0x164693=_0x912b72;}var _0x2839ac=seqqueue['createQueue'](_0x912b72);_0x2839ac['id']=_0xfd0c6d;_0x2839ac[_0x0939('0x42')]=_0x912b72;_0x2839ac[_0x0939('0x43')]=_0x164693;_0x2839ac[_0x0939('0x24')]=_0x504f5c[_0x0939('0x24')];_0x3cfdcc['rules'][_0xfd0c6d]['on'](_0x0939('0x44'),function(){logger[_0x0939('0x31')](_0x0939('0x45'),_0xfd0c6d);stopRouting(_0xfd0c6d,_0x21600f,_0x504f5c,_0x3cfdcc);clearTimeout(_0x2cc29b);_0x2cc29b=undefined;_0x2839ac['close'](!![]);if(_0x3cfdcc['rules'][_0xfd0c6d]){delete _0x3cfdcc[_0x0939('0x46')][_0xfd0c6d];}_0x4d4644[_0x0939('0x3f')]();});_0x3cfdcc[_0x0939('0x46')][_0xfd0c6d]['on'](_0x0939('0x47'),function(){if(_0x3cfdcc[_0x0939('0x46')][_0xfd0c6d]){delete _0x3cfdcc['rules'][_0xfd0c6d];}});_0x2cc29b=setTimeout(function(){logger['info'](_0x0939('0x48'),_0xfd0c6d);endRouting(_0xfd0c6d,_0x21600f,_0x504f5c,_0x3cfdcc);clearTimeout(_0x2cc29b);_0x2839ac['close'](!![]);_0x4d4644['next']();},_0x164693);switch(_0x21600f[_0x0939('0x49')]){case _0x0939('0x4a'):strategy['rrmemory'](_0x2839ac,_0x21600f,_0x3cfdcc,_0x504f5c);break;default:strategy['beepall'](_0x2839ac,_0x21600f,_0x3cfdcc,_0x504f5c);}}else{logger[_0x0939('0x35')](_0x0939('0x4b'),_0xfd0c6d,_0x1a1c4d[_0x0939('0x2c')]);_0x4d4644[_0x0939('0x3f')]();}}}catch(_0x473716){logger[_0x0939('0x35')](_0x0939('0x3c'),_0xfd0c6d,_0x473716[_0x0939('0x4c')]);_0x4d4644[_0x0939('0x3f')]();}};}; \ 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 cc0e06d..d7e9f23 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 _0xf006=['realtime','handleRun','bind','handleTimeout','timeout','drained','handleDrained','prototype','push','debug','[%s][AGENT]\x20try\x20with\x20%s','isNil','agents','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','routing','forcedOwnership','isAgentAvailable','channel','saveWaitingNotification','showNotification','notificationId','writeLog','RINGING',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','hideNotification','busy','STOP','TIMEOUT','./util','../../../../../config/logger','squeue','agent'];(function(_0x11d12c,_0x2fa186){var _0x5d53ac=function(_0x443513){while(--_0x443513){_0x11d12c['push'](_0x11d12c['shift']());}};_0x5d53ac(++_0x2fa186);}(_0xf006,0x146));var _0x6f00=function(_0x273a38,_0x3bd943){_0x273a38=_0x273a38-0x0;var _0x3b7a2c=_0xf006[_0x273a38];return _0x3b7a2c;};'use strict';var _=require('lodash');var uuid=require('uuid');var util=require(_0x6f00('0x0'));var logger=require(_0x6f00('0x1'))('routing');var Agent=function(_0xbab575,_0x4e9dbc,_0x1c7a9e,_0x4f4466){this['notificationId']=uuid['v4']();this[_0x6f00('0x2')]=_0xbab575;this[_0x6f00('0x3')]=_0x4e9dbc;this[_0x6f00('0x4')]=_0x1c7a9e;this['routing']=_0x4f4466;this[_0x6f00('0x2')]['push'](this[_0x6f00('0x5')][_0x6f00('0x6')](this),this[_0x6f00('0x7')][_0x6f00('0x6')](this));this[_0x6f00('0x2')]['on'](_0x6f00('0x8'),this[_0x6f00('0x7')][_0x6f00('0x6')](this));this[_0x6f00('0x2')]['on'](_0x6f00('0x9'),this[_0x6f00('0xa')][_0x6f00('0x6')](this));};Agent[_0x6f00('0xb')]['push']=function(){this[_0x6f00('0x2')][_0x6f00('0xc')](this[_0x6f00('0x5')][_0x6f00('0x6')](this),this[_0x6f00('0x7')]['bind'](this));};Agent[_0x6f00('0xb')]['handleDrained']=function(){this[_0x6f00('0x7')](!![]);};Agent['prototype'][_0x6f00('0x5')]=function(){logger[_0x6f00('0xd')](_0x6f00('0xe'),this[_0x6f00('0x2')]['id'],this[_0x6f00('0x3')]['id']);if(_[_0x6f00('0xf')](this[_0x6f00('0x4')][_0x6f00('0x10')][this[_0x6f00('0x3')]['id']])){logger['debug'](_0x6f00('0x11'),this['squeue']['id'],this['agent']['id']);setTimeout(this[_0x6f00('0xc')][_0x6f00('0x6')](this),0x3e8);}else{if(this[_0x6f00('0x12')][_0x6f00('0x13')]||util[_0x6f00('0x14')](this[_0x6f00('0x2')]['id'],this[_0x6f00('0x4')][_0x6f00('0x10')][this[_0x6f00('0x3')]['id']],this[_0x6f00('0x2')][_0x6f00('0x15')],![])){this[_0x6f00('0x4')]['agents'][this['agent']['id']]['busy']=!![];this[_0x6f00('0x4')][_0x6f00('0x10')][this[_0x6f00('0x3')]['id']]['busyQueue']=undefined;util[_0x6f00('0x16')](this[_0x6f00('0x4')],this[_0x6f00('0x12')],this[_0x6f00('0x3')],this[_0x6f00('0x2')][_0x6f00('0x15')]);util[_0x6f00('0x17')](this[_0x6f00('0x18')],this['squeue']['id'],this[_0x6f00('0x4')][_0x6f00('0x10')][this[_0x6f00('0x3')]['id']],null,this['routing']);util[_0x6f00('0x19')](this['squeue']['id'],this[_0x6f00('0x4')]['agents'][this[_0x6f00('0x3')]['id']],_0x6f00('0x1a')+(this[_0x6f00('0x12')][_0x6f00('0x13')]?_0x6f00('0x1b'):''));}else{logger['debug'](_0x6f00('0x1c'),this[_0x6f00('0x2')]['id'],this[_0x6f00('0x3')]['id']);setTimeout(this[_0x6f00('0xc')][_0x6f00('0x6')](this),0x3e8);}}};Agent[_0x6f00('0xb')][_0x6f00('0x7')]=function(_0x451849){if(_[_0x6f00('0xf')](this[_0x6f00('0x4')][_0x6f00('0x10')][this[_0x6f00('0x3')]['id']])){return logger[_0x6f00('0xd')](_0x6f00('0x11'),this['squeue']['id'],this['agent']['id']);}else{logger['debug']('[%s][AGENT]\x20timeout\x20with\x20%s',this['squeue']['id'],this['agent']['id']);util[_0x6f00('0x1d')](this['notificationId'],this[_0x6f00('0x2')]['id'],this[_0x6f00('0x4')][_0x6f00('0x10')][this[_0x6f00('0x3')]['id']],null,this[_0x6f00('0x12')]);this[_0x6f00('0x4')]['agents'][this[_0x6f00('0x3')]['id']][_0x6f00('0x1e')]=![];this[_0x6f00('0x4')][_0x6f00('0x10')][this[_0x6f00('0x3')]['id']]['busyQueue']=undefined;util['removeWaitingNotification'](this['realtime'],this[_0x6f00('0x12')],this[_0x6f00('0x3')],this[_0x6f00('0x2')][_0x6f00('0x15')]);util[_0x6f00('0x19')](this['squeue']['id'],this[_0x6f00('0x4')][_0x6f00('0x10')][this[_0x6f00('0x3')]['id']],_0x451849?_0x6f00('0x1f'):_0x6f00('0x20'));}if(!_0x451849){setTimeout(this[_0x6f00('0xc')][_0x6f00('0x6')](this),0x3e8);}};function agent(_0x52936d,_0x28e436,_0x1dee52,_0x4ba56d){return new Agent(_0x52936d,_0x28e436,_0x1dee52,_0x4ba56d);}module['exports']=agent; \ No newline at end of file +var _0xa8a8=['./util','../../../../../config/logger','notificationId','squeue','agent','realtime','routing','push','handleRun','bind','handleTimeout','drained','prototype','debug','[%s][AGENT]\x20try\x20with\x20%s','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','isAgentAvailable','agents','busy','busyQueue','saveWaitingNotification','channel','showNotification','writeLog','RINGING','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','hideNotification','removeWaitingNotification','STOP','TIMEOUT','exports','lodash','uuid'];(function(_0x44fae1,_0xea074f){var _0x44bf89=function(_0x202318){while(--_0x202318){_0x44fae1['push'](_0x44fae1['shift']());}};_0x44bf89(++_0xea074f);}(_0xa8a8,0xec));var _0x8a8a=function(_0x49469d,_0x4e7cb3){_0x49469d=_0x49469d-0x0;var _0x208616=_0xa8a8[_0x49469d];return _0x208616;};'use strict';var _=require(_0x8a8a('0x0'));var uuid=require(_0x8a8a('0x1'));var util=require(_0x8a8a('0x2'));var logger=require(_0x8a8a('0x3'))('routing');var Agent=function(_0x2a2676,_0x3296a6,_0xf11a08,_0x3ed1de){this[_0x8a8a('0x4')]=uuid['v4']();this[_0x8a8a('0x5')]=_0x2a2676;this[_0x8a8a('0x6')]=_0x3296a6;this[_0x8a8a('0x7')]=_0xf11a08;this[_0x8a8a('0x8')]=_0x3ed1de;this[_0x8a8a('0x5')][_0x8a8a('0x9')](this[_0x8a8a('0xa')][_0x8a8a('0xb')](this),this[_0x8a8a('0xc')][_0x8a8a('0xb')](this));this['squeue']['on']('timeout',this[_0x8a8a('0xc')]['bind'](this));this[_0x8a8a('0x5')]['on'](_0x8a8a('0xd'),this['handleDrained'][_0x8a8a('0xb')](this));};Agent[_0x8a8a('0xe')][_0x8a8a('0x9')]=function(){this['squeue'][_0x8a8a('0x9')](this[_0x8a8a('0xa')][_0x8a8a('0xb')](this),this[_0x8a8a('0xc')]['bind'](this));};Agent[_0x8a8a('0xe')]['handleDrained']=function(){this[_0x8a8a('0xc')](!![]);};Agent[_0x8a8a('0xe')][_0x8a8a('0xa')]=function(){logger[_0x8a8a('0xf')](_0x8a8a('0x10'),this[_0x8a8a('0x5')]['id'],this[_0x8a8a('0x6')]['id']);if(_['isNil'](this[_0x8a8a('0x7')]['agents'][this[_0x8a8a('0x6')]['id']])){logger[_0x8a8a('0xf')](_0x8a8a('0x11'),this[_0x8a8a('0x5')]['id'],this[_0x8a8a('0x6')]['id']);setTimeout(this['push'][_0x8a8a('0xb')](this),0x3e8);}else{if(this[_0x8a8a('0x8')][_0x8a8a('0x12')]||util[_0x8a8a('0x13')](this[_0x8a8a('0x5')]['id'],this[_0x8a8a('0x7')]['agents'][this['agent']['id']],this['squeue']['channel'],![])){this['realtime'][_0x8a8a('0x14')][this[_0x8a8a('0x6')]['id']][_0x8a8a('0x15')]=!![];this[_0x8a8a('0x7')][_0x8a8a('0x14')][this[_0x8a8a('0x6')]['id']][_0x8a8a('0x16')]=undefined;util[_0x8a8a('0x17')](this[_0x8a8a('0x7')],this[_0x8a8a('0x8')],this[_0x8a8a('0x6')],this[_0x8a8a('0x5')][_0x8a8a('0x18')]);util[_0x8a8a('0x19')](this[_0x8a8a('0x4')],this['squeue']['id'],this[_0x8a8a('0x7')][_0x8a8a('0x14')][this[_0x8a8a('0x6')]['id']],null,this[_0x8a8a('0x8')]);util[_0x8a8a('0x1a')](this[_0x8a8a('0x5')]['id'],this[_0x8a8a('0x7')]['agents'][this[_0x8a8a('0x6')]['id']],_0x8a8a('0x1b')+(this[_0x8a8a('0x8')]['forcedOwnership']?':FORCED':''));}else{logger[_0x8a8a('0xf')](_0x8a8a('0x1c'),this['squeue']['id'],this['agent']['id']);setTimeout(this['push'][_0x8a8a('0xb')](this),0x3e8);}}};Agent['prototype'][_0x8a8a('0xc')]=function(_0xdd6221){if(_['isNil'](this[_0x8a8a('0x7')][_0x8a8a('0x14')][this[_0x8a8a('0x6')]['id']])){return logger[_0x8a8a('0xf')](_0x8a8a('0x11'),this[_0x8a8a('0x5')]['id'],this[_0x8a8a('0x6')]['id']);}else{logger[_0x8a8a('0xf')]('[%s][AGENT]\x20timeout\x20with\x20%s',this['squeue']['id'],this['agent']['id']);util[_0x8a8a('0x1d')](this[_0x8a8a('0x4')],this['squeue']['id'],this[_0x8a8a('0x7')][_0x8a8a('0x14')][this['agent']['id']],null,this[_0x8a8a('0x8')]);this[_0x8a8a('0x7')][_0x8a8a('0x14')][this['agent']['id']]['busy']=![];this[_0x8a8a('0x7')]['agents'][this[_0x8a8a('0x6')]['id']][_0x8a8a('0x16')]=undefined;util[_0x8a8a('0x1e')](this[_0x8a8a('0x7')],this[_0x8a8a('0x8')],this[_0x8a8a('0x6')],this[_0x8a8a('0x5')][_0x8a8a('0x18')]);util[_0x8a8a('0x1a')](this[_0x8a8a('0x5')]['id'],this[_0x8a8a('0x7')][_0x8a8a('0x14')][this[_0x8a8a('0x6')]['id']],_0xdd6221?_0x8a8a('0x1f'):_0x8a8a('0x20'));}if(!_0xdd6221){setTimeout(this[_0x8a8a('0x9')][_0x8a8a('0xb')](this),0x3e8);}};function agent(_0x29d187,_0x4c8003,_0x4cc605,_0x53da01){return new Agent(_0x29d187,_0x4c8003,_0x4cc605,_0x53da01);}module[_0x8a8a('0x21')]=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 b2775b5..996c56d 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 _0xc34a=['realtime','channel','writeLog','RINGING','busy','busyQueue','name','saveWaitingNotification','debug','[%s][QUEUE]\x20ALL\x20AGENTS\x20ARE\x20BUSY','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','hideNotification','notificationId','STOP','TIMEOUT','removeWaitingNotification','exports','uuid','../../../../../config/logger','routing','squeue','push','handleRun','bind','handleTimeout','timeout','handleDrained','prototype','queue','isNil','Agents','length','agents','isAgentAvailable'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xc34a,0x143));var _0xac34=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xc34a[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var uuid=require(_0xac34('0x0'));var util=require('./util');var logger=require(_0xac34('0x1'))(_0xac34('0x2'));var Beepall=function(_0x2df874,_0x188210,_0x4b004d,_0x22dec5){this['notificationId']=uuid['v4']();this[_0xac34('0x3')]=_0x2df874;this['queue']=_0x188210;this['realtime']=_0x4b004d;this[_0xac34('0x2')]=_0x22dec5;this['squeue'][_0xac34('0x4')](this[_0xac34('0x5')][_0xac34('0x6')](this),this[_0xac34('0x7')][_0xac34('0x6')](this));this[_0xac34('0x3')]['on'](_0xac34('0x8'),this['handleTimeout'][_0xac34('0x6')](this));this['squeue']['on']('drained',this[_0xac34('0x9')]['bind'](this));};Beepall[_0xac34('0xa')][_0xac34('0x4')]=function(){this['squeue'][_0xac34('0x4')](this[_0xac34('0x5')][_0xac34('0x6')](this),this['handleTimeout'][_0xac34('0x6')](this));};Beepall[_0xac34('0xa')][_0xac34('0x9')]=function(){this['handleTimeout'](!![]);};Beepall[_0xac34('0xa')][_0xac34('0x5')]=function(){var _0x47be92=!![];if(!_['isNil'](this[_0xac34('0xb')])&&!_[_0xac34('0xc')](this['queue'][_0xac34('0xd')])&&this[_0xac34('0xb')][_0xac34('0xd')]['length']>0x0){for(var _0x4cfd46=0x0,_0x2552de;_0x4cfd460x0){for(var _0x6ccdcd=0x0,_0x11df49;_0x6ccdcd0x0&&_0x403716[_0x3d46d2+_0x28ab('0x20')]>=_0x403716[_0x3d46d2+_0x28ab('0x21')]){writeLog(_0x1418f6,_0x403716,_0x3d46d2[_0x28ab('0x22')]()+_0x28ab('0x23'));return![];}}return!![];};exports[_0x28ab('0x24')]=function(_0x41ee51,_0x1ccf9f,_0x2dab8b,_0x32a36e,_0x1c95a9){return sendNotification(!![],_0x41ee51,_0x1ccf9f,_0x2dab8b,_0x32a36e,_0x1c95a9);};exports['hideNotification']=function(_0x40eca3,_0x141e1b,_0x20c8c5,_0x319a97,_0x20c7d8){return sendNotification(![],_0x40eca3,_0x141e1b,_0x20c8c5,_0x319a97,_0x20c7d8);};exports[_0x28ab('0x25')]=function(_0x5ed932,_0x536eca,_0x39f8fc){var _0x1e4fd2=_0x536eca[_0x28ab('0x26')][_0x28ab('0x27')];if(!_0x1e4fd2&&_0x39f8fc){_0x1e4fd2=_0x39f8fc['id'];}var _0x295289=_['some'](_0x5ed932[_0x536eca[_0x28ab('0x28')]+_0x28ab('0x29')],function(_0x47a001){var _0x2f26ba=_[_0x28ab('0x2a')](_0x536eca[_0x28ab('0x28')])+'InteractionId';return _0x47a001[_0x2f26ba]===_0x536eca['interaction']['id'];});if(!_0x295289&&_0x1e4fd2&&_0x5ed932[_0x28ab('0x2b')][_0x1e4fd2]){_0x295289=_[_0x28ab('0x2c')](_0x5ed932[_0x28ab('0x2b')][_0x1e4fd2][_0x536eca[_0x28ab('0x28')]+_0x28ab('0x2d')],function(_0x1395b6){return _0x1395b6['id']===_0x536eca[_0x28ab('0x26')]['id'];});}return _0x295289;};exports[_0x28ab('0x2e')]=function(_0x408d91,_0x4dd982,_0x19b77a,_0x48d4bb){if(_0x19b77a&&_0x19b77a['id']&&_0x408d91[_0x28ab('0x2b')]&&_0x408d91[_0x28ab('0x2b')][_0x19b77a['id']]){_0x408d91[_0x28ab('0x2b')][_0x19b77a['id']][_0x48d4bb+_0x28ab('0x2d')][_0x4dd982[_0x28ab('0x2f')]['id']]={'id':_0x4dd982[_0x28ab('0x26')]['id']};}};exports[_0x28ab('0x30')]=function(_0x46d667,_0x1cb8b6,_0x49a8a3,_0x501364){if(_0x49a8a3&&_0x49a8a3['id']&&_0x46d667[_0x28ab('0x2b')]&&_0x46d667['agents'][_0x49a8a3['id']]){delete _0x46d667['agents'][_0x49a8a3['id']][_0x501364+_0x28ab('0x2d')][_0x1cb8b6['message']['id']];}};exports[_0x28ab('0x31')]=writeLog; \ No newline at end of file +var _0xece7=['redis','defaults','socket.io-emitter','split','\x20interaction','name','account','notificationSound','body','queue','msg','getMustacheRender','notificationTemplate','I\x20can\x27t\x20render\x20your\x20template','error','format','message','emit','notification:%s','save','remove','debug','[%s][QUEUE][AGENT:%s][STATUS:%s]','isAgentAvailable','busy','BUSY','online','OFFLINE','Pause','PAUSE','hasOwnProperty','Capacity','CurrentCapacity','toUpperCase','\x20MAXCAPACITY','showNotification','hideNotification','checkWaitingNotifications','interaction','UserId','some','QueuesWaitingInteractions','capitalize','channel','agents','WaitingInteractions','removeWaitingNotification','lodash','util','../../../../../config/environment','../../../../../config/logger'];(function(_0x146eaf,_0x4ef068){var _0x2efbde=function(_0x3ffbc2){while(--_0x3ffbc2){_0x146eaf['push'](_0x146eaf['shift']());}};_0x2efbde(++_0x4ef068);}(_0xece7,0x95));var _0x7ece=function(_0x45a7a6,_0x380289){_0x45a7a6=_0x45a7a6-0x0;var _0x514f51=_0xece7[_0x45a7a6];return _0x514f51;};'use strict';var _=require(_0x7ece('0x0'));var util=require(_0x7ece('0x1'));var utils=require('../utils');var Redis=require('ioredis');var config=require(_0x7ece('0x2'));var logger=require(_0x7ece('0x3'))('routing');config[_0x7ece('0x4')]=_[_0x7ece('0x5')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x7ece('0x6'))(new Redis(config[_0x7ece('0x4')]));function sendNotification(_0x49a03d,_0x1b12b0,_0x18dea4,_0x1e5a7b,_0x55bd78,_0x57d740){var _0x34c05d=_0x57d740||{};var _0x54feec=_0x18dea4[_0x7ece('0x7')]('.');var _0x203c86={'uniqueid':_0x1b12b0,'channel':_0x54feec[0x0],'id':_0x54feec[0x1],'title':_0x54feec[0x0]+_0x7ece('0x8'),'interactionId':_0x54feec[0x2],'queue':_0x55bd78?_0x55bd78[_0x7ece('0x9')]:null,'sound':_0x34c05d[_0x7ece('0xa')][_0x7ece('0xb')],'shake':_0x34c05d[_0x7ece('0xa')]['notificationShake']};try{if(!_0x34c05d[_0x7ece('0xc')]){_0x34c05d[_0x7ece('0xc')]={};}if(_0x55bd78){_0x34c05d['body'][_0x7ece('0xd')]=_0x55bd78;}else if(_0x34c05d[_0x7ece('0xc')]['queue']){delete _0x34c05d[_0x7ece('0xc')][_0x7ece('0xd')];}_0x203c86[_0x7ece('0xe')]=utils[_0x7ece('0xf')](_0x34c05d[_0x7ece('0xa')][_0x7ece('0x10')],_0x34c05d);}catch(_0x44ce37){_0x203c86[_0x7ece('0xe')]=_0x7ece('0x11');logger[_0x7ece('0x12')](util[_0x7ece('0x13')]('[%s][QUEUE]\x20%s',_0x1b12b0,_0x44ce37[_0x7ece('0x14')]));}io['to'](util[_0x7ece('0x13')]('user:%s',_0x1e5a7b[_0x7ece('0x9')]))[_0x7ece('0x15')](util[_0x7ece('0x13')](_0x7ece('0x16'),_0x49a03d?_0x7ece('0x17'):_0x7ece('0x18')),_0x203c86);}function writeLog(_0x4ae6ec,_0xbffed0,_0x202ac5){return logger[_0x7ece('0x19')](util[_0x7ece('0x13')](_0x7ece('0x1a'),_0x4ae6ec,_0xbffed0[_0x7ece('0x9')],_0x202ac5));}exports[_0x7ece('0x1b')]=function(_0x1483d2,_0x55e322,_0x51b75d,_0x3fe5e7){if(_0x55e322[_0x7ece('0x1c')]){writeLog(_0x1483d2,_0x55e322,_0x7ece('0x1d'));return![];}if(!_0x55e322[_0x7ece('0x1e')]){writeLog(_0x1483d2,_0x55e322,_0x7ece('0x1f'));return![];}if(_0x55e322[_0x51b75d+_0x7ece('0x20')]){writeLog(_0x1483d2,_0x55e322,_0x7ece('0x21'));return![];}if(_0x3fe5e7&&_0x55e322[_0x7ece('0x22')](_0x51b75d+_0x7ece('0x23'))&&_0x55e322[_0x7ece('0x22')](_0x51b75d+_0x7ece('0x24'))){if(_0x55e322[_0x51b75d+'Capacity']>0x0&&_0x55e322[_0x51b75d+_0x7ece('0x24')]>=_0x55e322[_0x51b75d+_0x7ece('0x23')]){writeLog(_0x1483d2,_0x55e322,_0x51b75d[_0x7ece('0x25')]()+_0x7ece('0x26'));return![];}}return!![];};exports[_0x7ece('0x27')]=function(_0x400086,_0x4965e4,_0x15c038,_0x25b451,_0x3bd523){return sendNotification(!![],_0x400086,_0x4965e4,_0x15c038,_0x25b451,_0x3bd523);};exports[_0x7ece('0x28')]=function(_0x18a804,_0x2066f3,_0x4af234,_0x5434a1,_0x198e81){return sendNotification(![],_0x18a804,_0x2066f3,_0x4af234,_0x5434a1,_0x198e81);};exports[_0x7ece('0x29')]=function(_0x1893e2,_0x578b68,_0x40ed78){var _0x3d721f=_0x578b68[_0x7ece('0x2a')][_0x7ece('0x2b')];if(!_0x3d721f&&_0x40ed78){_0x3d721f=_0x40ed78['id'];}var _0x599108=_[_0x7ece('0x2c')](_0x1893e2[_0x578b68['channel']+_0x7ece('0x2d')],function(_0x100d93){var _0x5968c6=_[_0x7ece('0x2e')](_0x578b68[_0x7ece('0x2f')])+'InteractionId';return _0x100d93[_0x5968c6]===_0x578b68[_0x7ece('0x2a')]['id'];});if(!_0x599108&&_0x3d721f&&_0x1893e2[_0x7ece('0x30')][_0x3d721f]){_0x599108=_[_0x7ece('0x2c')](_0x1893e2['agents'][_0x3d721f][_0x578b68['channel']+_0x7ece('0x31')],function(_0x4bf2d9){return _0x4bf2d9['id']===_0x578b68[_0x7ece('0x2a')]['id'];});}return _0x599108;};exports['saveWaitingNotification']=function(_0x477df7,_0x7d4fa7,_0x24f16b,_0x73df12){if(_0x24f16b&&_0x24f16b['id']&&_0x477df7[_0x7ece('0x30')]&&_0x477df7['agents'][_0x24f16b['id']]){_0x477df7['agents'][_0x24f16b['id']][_0x73df12+_0x7ece('0x31')][_0x7d4fa7[_0x7ece('0x14')]['id']]={'id':_0x7d4fa7[_0x7ece('0x2a')]['id']};}};exports[_0x7ece('0x32')]=function(_0x236e29,_0x58968a,_0x5ca7cd,_0x2d1385){if(_0x5ca7cd&&_0x5ca7cd['id']&&_0x236e29[_0x7ece('0x30')]&&_0x236e29[_0x7ece('0x30')][_0x5ca7cd['id']]){delete _0x236e29[_0x7ece('0x30')][_0x5ca7cd['id']][_0x2d1385+'WaitingInteractions'][_0x58968a[_0x7ece('0x14')]['id']];}};exports['writeLog']=writeLog; \ No newline at end of file diff --git a/server/services/routing/server/applications/system.js b/server/services/routing/server/applications/system.js index 936a7e3..4afdd21 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 _0x5279=['getMustacheRender','info','exec','trim','[%s][SYSTEM]\x20result\x20code:\x20%s','isNil','isEmpty','[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','stringify','validate','shelljs','lodash','./utils','../../../../config/logger','string','consequence','error','[%s][SYSTEM]\x20%s','map','message','join','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next'];(function(_0x38eaa9,_0x12309e){var _0x26ecbe=function(_0x498c60){while(--_0x498c60){_0x38eaa9['push'](_0x38eaa9['shift']());}};_0x26ecbe(++_0x12309e);}(_0x5279,0xa1));var _0x9527=function(_0x361d3f,_0x3be2aa){_0x361d3f=_0x361d3f-0x0;var _0x320229=_0x5279[_0x361d3f];return _0x320229;};'use strict';var schema=require(_0x9527('0x0'));var sh=require(_0x9527('0x1'));var _=require(_0x9527('0x2'));var utils=require(_0x9527('0x3'));var logger=require(_0x9527('0x4'))('routing');var system=schema({'command':{'type':_0x9527('0x5'),'required':!![],'message':'command\x20is\x20a\x20string\x20and\x20it\x20is\x20required'}});exports[_0x9527('0x6')]=function(_0x187ff2,_0x271b4c){return function(_0x349cbd){try{var _0x19bfa9={'command':_0x271b4c[0x0]};var _0xbaac4f=system[_0x9527('0x0')](_0x19bfa9,{'typecast':!![]});if(_0xbaac4f['length']){logger[_0x9527('0x7')](_0x9527('0x8'),_0x187ff2,_[_0x9527('0x9')](_0xbaac4f,_0x9527('0xa'))[_0x9527('0xb')](',\x20'));logger['info'](_0x9527('0xc'),_0x187ff2);_0x349cbd[_0x9527('0xd')]();}else{var _0x4255cc=this;var _0x39be91=utils[_0x9527('0xe')](_0x271b4c[0x0],this);logger[_0x9527('0xf')]('[%s][SYSTEM]\x20commnad:\x20%s',_0x187ff2,_0x39be91);sh[_0x9527('0x10')](_[_0x9527('0x11')](_0x39be91),function(_0x33127a,_0x30f931){logger[_0x9527('0xf')](_0x9527('0x12'),_0x187ff2,_0x33127a);if(_0x33127a==0x0){var _0x1ecc52=_0x30f931['replace'](/(\r\n|\n|\r)/gm,'');if(_[_0x9527('0x13')](_0x271b4c[0x1])||_[_0x9527('0x14')](_0x271b4c[0x1])){logger['info'](_0x9527('0x15'),_0x187ff2);_0x4255cc[_0x9527('0x16')][_0x271b4c[0x1]]=_0x1ecc52;}else{logger[_0x9527('0xf')](_0x9527('0x17'),_0x187ff2,_0x271b4c[0x1],_0x1ecc52);_0x4255cc[_0x9527('0x16')][_0x271b4c[0x1]]=_0x1ecc52;}}_0x349cbd[_0x9527('0xd')]();});}}catch(_0x3763b6){logger[_0x9527('0x7')]('[%s][SYSTEM]\x20%s',_0x187ff2,_['isObject'](_0x3763b6)?JSON[_0x9527('0x18')](_0x3763b6):_0x3763b6);logger[_0x9527('0xf')]('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x187ff2);_0x349cbd[_0x9527('0xd')]();}};}; \ No newline at end of file +var _0x629d=['[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isNil','[%s][SYSTEM]\x20no\x20variable','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','body','stringify','shelljs','lodash','routing','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','validate','error','[%s][SYSTEM]\x20%s','map','message','join','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','getMustacheRender','[%s][SYSTEM]\x20commnad:\x20%s','trim'];(function(_0x46b1c6,_0x54d0ea){var _0x3e9cbe=function(_0x446c5b){while(--_0x446c5b){_0x46b1c6['push'](_0x46b1c6['shift']());}};_0x3e9cbe(++_0x54d0ea);}(_0x629d,0x197));var _0xd629=function(_0x1d3a5d,_0x17fc32){_0x1d3a5d=_0x1d3a5d-0x0;var _0x257078=_0x629d[_0x1d3a5d];return _0x257078;};'use strict';var schema=require('validate');var sh=require(_0xd629('0x0'));var _=require(_0xd629('0x1'));var utils=require('./utils');var logger=require('../../../../config/logger')(_0xd629('0x2'));var system=schema({'command':{'type':_0xd629('0x3'),'required':!![],'message':_0xd629('0x4')}});exports[_0xd629('0x5')]=function(_0x56f8dc,_0x708570){return function(_0x280732){try{var _0x9b7ea8={'command':_0x708570[0x0]};var _0x14f0a7=system[_0xd629('0x6')](_0x9b7ea8,{'typecast':!![]});if(_0x14f0a7['length']){logger[_0xd629('0x7')](_0xd629('0x8'),_0x56f8dc,_[_0xd629('0x9')](_0x14f0a7,_0xd629('0xa'))[_0xd629('0xb')](',\x20'));logger[_0xd629('0xc')](_0xd629('0xd'),_0x56f8dc);_0x280732[_0xd629('0xe')]();}else{var _0x1a11f2=this;var _0x50d370=utils[_0xd629('0xf')](_0x708570[0x0],this);logger['info'](_0xd629('0x10'),_0x56f8dc,_0x50d370);sh['exec'](_[_0xd629('0x11')](_0x50d370),function(_0x58c200,_0x19d62e){logger[_0xd629('0xc')](_0xd629('0x12'),_0x56f8dc,_0x58c200);if(_0x58c200==0x0){var _0x33e595=_0x19d62e[_0xd629('0x13')](/(\r\n|\n|\r)/gm,'');if(_[_0xd629('0x14')](_0x708570[0x1])||_['isEmpty'](_0x708570[0x1])){logger[_0xd629('0xc')](_0xd629('0x15'),_0x56f8dc);_0x1a11f2['body'][_0x708570[0x1]]=_0x33e595;}else{logger[_0xd629('0xc')](_0xd629('0x16'),_0x56f8dc,_0x708570[0x1],_0x33e595);_0x1a11f2[_0xd629('0x17')][_0x708570[0x1]]=_0x33e595;}}_0x280732[_0xd629('0xe')]();});}}catch(_0x4b027b){logger[_0xd629('0x7')](_0xd629('0x8'),_0x56f8dc,_['isObject'](_0x4b027b)?JSON[_0xd629('0x18')](_0x4b027b):_0x4b027b);logger[_0xd629('0xc')](_0xd629('0xd'),_0x56f8dc);_0x280732[_0xd629('0xe')]();}};}; \ 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 0208160..babbe4c 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 _0xb333=['[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','finally','isObject','next','validate','lodash','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../../../config/logger','routing','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','join','info','channel','Interaction','addTags','interaction','then','catch','[%s][TAG]\x20%s','stringify'];(function(_0x43d188,_0x44315d){var _0x54d96d=function(_0x49997e){while(--_0x49997e){_0x43d188['push'](_0x43d188['shift']());}};_0x54d96d(++_0x44315d);}(_0xb333,0xe4));var _0x3b33=function(_0x2db7fe,_0xb85dd2){_0x2db7fe=_0x2db7fe-0x0;var _0x1008ba=_0xb333[_0x2db7fe];return _0x1008ba;};'use strict';var schema=require(_0x3b33('0x0'));var _=require(_0x3b33('0x1'));var rpc={'chatInteraction':require(_0x3b33('0x2')),'openchannelInteraction':require(_0x3b33('0x3')),'smsInteraction':require(_0x3b33('0x4')),'mailInteraction':require(_0x3b33('0x5')),'faxInteraction':require(_0x3b33('0x6')),'whatsappInteraction':require(_0x3b33('0x7'))};var logger=require(_0x3b33('0x8'))(_0x3b33('0x9'));var tag=schema({'tag':{'type':'number','required':!![],'message':_0x3b33('0xa')}});exports[_0x3b33('0xb')]=function(_0x443fc8,_0x1874f1,_0x2ca0ea,_0x5aac6d){return function(_0x240cff){try{var _0x2335d0={'tag':_0x1874f1[0x0]};var _0x540662=tag[_0x3b33('0x0')](_0x2335d0,{'typecast':!![]});if(_0x540662[_0x3b33('0xc')]){logger[_0x3b33('0xd')]('[%s][TAG]\x20%s',_0x443fc8,_['map'](_0x540662,'message')[_0x3b33('0xe')](',\x20'));logger[_0x3b33('0xf')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x443fc8);_0x240cff['next']();}else{var _0x60a959={'ids':[_0x1874f1[0x0]]};if(rpc[_0x5aac6d[_0x3b33('0x10')]+_0x3b33('0x11')]){rpc[_0x5aac6d[_0x3b33('0x10')]+_0x3b33('0x11')][_0x3b33('0x12')](_0x5aac6d[_0x3b33('0x13')]['id'],_0x60a959)[_0x3b33('0x14')](function(_0x45e7b7){logger[_0x3b33('0xf')]('[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s',_0x443fc8,_0x1874f1[0x1],_0x5aac6d['channel'],_0x5aac6d[_0x3b33('0x13')]['id']);})[_0x3b33('0x15')](function(_0x4ffbbc){logger[_0x3b33('0xd')](_0x3b33('0x16'),_0x443fc8,JSON[_0x3b33('0x17')](_0x4ffbbc));logger[_0x3b33('0xf')](_0x3b33('0x18'),_0x443fc8);})[_0x3b33('0x19')](function(){_0x240cff['next']();});}}}catch(_0x579020){logger[_0x3b33('0xd')](_0x3b33('0x16'),_0x443fc8,_[_0x3b33('0x1a')](_0x579020)?JSON[_0x3b33('0x17')](_0x579020):_0x579020);logger[_0x3b33('0xf')](_0x3b33('0x18'),_0x443fc8);_0x240cff[_0x3b33('0x1b')]();}};}; \ No newline at end of file +var _0x7b0d=['Interaction','interaction','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','catch','next','isObject','stringify','validate','lodash','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../../../config/logger','routing','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','error','[%s][TAG]\x20%s','map','message','join','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','channel'];(function(_0x2550ce,_0x45209b){var _0x25748d=function(_0x806ad5){while(--_0x806ad5){_0x2550ce['push'](_0x2550ce['shift']());}};_0x25748d(++_0x45209b);}(_0x7b0d,0xf1));var _0xd7b0=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0x7b0d[_0x491a7f];return _0x3d8f44;};'use strict';var schema=require(_0xd7b0('0x0'));var _=require(_0xd7b0('0x1'));var rpc={'chatInteraction':require(_0xd7b0('0x2')),'openchannelInteraction':require(_0xd7b0('0x3')),'smsInteraction':require(_0xd7b0('0x4')),'mailInteraction':require(_0xd7b0('0x5')),'faxInteraction':require(_0xd7b0('0x6')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};var logger=require(_0xd7b0('0x7'))(_0xd7b0('0x8'));var tag=schema({'tag':{'type':_0xd7b0('0x9'),'required':!![],'message':_0xd7b0('0xa')}});exports['consequence']=function(_0x322eb6,_0xb641b1,_0x3c8b3a,_0x5cab72){return function(_0x389541){try{var _0x10dbf1={'tag':_0xb641b1[0x0]};var _0xe85d01=tag[_0xd7b0('0x0')](_0x10dbf1,{'typecast':!![]});if(_0xe85d01['length']){logger[_0xd7b0('0xb')](_0xd7b0('0xc'),_0x322eb6,_[_0xd7b0('0xd')](_0xe85d01,_0xd7b0('0xe'))[_0xd7b0('0xf')](',\x20'));logger[_0xd7b0('0x10')](_0xd7b0('0x11'),_0x322eb6);_0x389541['next']();}else{var _0x389e48={'ids':[_0xb641b1[0x0]]};if(rpc[_0x5cab72[_0xd7b0('0x12')]+_0xd7b0('0x13')]){rpc[_0x5cab72[_0xd7b0('0x12')]+'Interaction']['addTags'](_0x5cab72[_0xd7b0('0x14')]['id'],_0x389e48)['then'](function(_0x46abec){logger['info'](_0xd7b0('0x15'),_0x322eb6,_0xb641b1[0x1],_0x5cab72[_0xd7b0('0x12')],_0x5cab72[_0xd7b0('0x14')]['id']);})[_0xd7b0('0x16')](function(_0x61bd78){logger[_0xd7b0('0xb')](_0xd7b0('0xc'),_0x322eb6,JSON['stringify'](_0x61bd78));logger[_0xd7b0('0x10')](_0xd7b0('0x11'),_0x322eb6);})['finally'](function(){_0x389541[_0xd7b0('0x17')]();});}}}catch(_0x3fec1a){logger['error'](_0xd7b0('0xc'),_0x322eb6,_[_0xd7b0('0x18')](_0x3fec1a)?JSON[_0xd7b0('0x19')](_0x3fec1a):_0x3fec1a);logger[_0xd7b0('0x10')](_0xd7b0('0x11'),_0x322eb6);_0x389541[_0xd7b0('0x17')]();}};}; \ 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 ad7076a..a0354da 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 _0xf652=['utf8','POST','parse','result','logged','&sessionId=','&data=','then','info','[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s','stop','catch','[%s][TVOX]\x20%s','isObject','[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next','next','request-promise','../../../../config/logger','routing','lodash','replace','\x20-\x20','includes','push','urlOnAnswer','?params=','urlOnRing','title','jsonrpc','2.0','method','login','params','stringify'];(function(_0x545a02,_0x2efaab){var _0x70e3e=function(_0x3132a0){while(--_0x3132a0){_0x545a02['push'](_0x545a02['shift']());}};_0x70e3e(++_0x2efaab);}(_0xf652,0x1ec));var _0x2f65=function(_0x2f2384,_0x1e2e88){_0x2f2384=_0x2f2384-0x0;var _0x128431=_0xf652[_0x2f2384];return _0x128431;};'use strict';var rp=require(_0x2f65('0x0'));var logger=require(_0x2f65('0x1'))(_0x2f65('0x2'));var _=require(_0x2f65('0x3'));var arr=[];exports['consequence']=function(_0x3c2641,_0x1e4166){return function(_0x2e98ae){var _0x2da608=_0x1e4166[0xa];var _0x5677e5=_0x1e4166[0xb];var _0x3a4c35=_0x1e4166[0xc];var _0xfb75f8=_0x1e4166[0xd];var _0x5000fc=_0x1e4166[0xe];var _0x5d9612=_0x1e4166[0xf][_0x2f65('0x4')](/\n/g,_0x2f65('0x5'));var _0x346287=_0x1e4166[0x10]['replace'](/\n/g,'\x20');if(!arr[_0x2f65('0x6')](_0x5677e5)){arr[_0x2f65('0x7')](_0x5677e5);var _0x3f7d50=_0x1e4166[0x3];var _0x5efdb8=_0x1e4166[0x4];var _0x26376b=_0x1e4166[0x1];var _0x2b08b3=_0x1e4166[0x0];var _0x4d1409={};_0x4d1409[_0x2f65('0x8')]=_0x1e4166[0x8]+_0x2f65('0x9')+_0x3a4c35+'|'+_0x2da608+'|'+_0xfb75f8+'|'+_0x5677e5+'|'+_0x5000fc;_0x4d1409[_0x2f65('0xa')]=_0x1e4166[0x7]+'?params='+_0x3a4c35+'|'+_0x2da608+'|'+_0xfb75f8+'|'+_0x5677e5+'|'+_0x5000fc+'|'+_0x5d9612+'|'+_0x346287;_0x4d1409[_0x2f65('0xb')]=_0x1e4166[0x9];var _0x23e44e={};_0x23e44e[_0x2f65('0xc')]=_0x2f65('0xd');_0x23e44e[_0x2f65('0xe')]=_0x2f65('0xf');var _0x5978d4=[];_0x5978d4[_0x2f65('0x7')](_0x1e4166[0x2]);_0x5978d4[_0x2f65('0x7')](_0x1e4166[0x5]);_0x5978d4[_0x2f65('0x7')](_0x1e4166[0x6]);_0x23e44e[_0x2f65('0x10')]=_0x5978d4;_0x23e44e['id']=0x1;var _0x9c998f=JSON[_0x2f65('0x11')](_0x23e44e);var _0x426ecd={'encoding':_0x2f65('0x12'),'method':_0x2f65('0x13'),'timeout':0x2710,'url':_0x3f7d50,'headers':{'Content-Type':'application/json-rpc'},'body':_0x9c998f};return rp(_0x426ecd)['then'](function(_0x825003){const _0x4961ac=JSON[_0x2f65('0x14')](_0x825003);if(!_0x4961ac[_0x2f65('0x15')][_0x2f65('0x16')]){throw new Error('Unable\x20to\x20login\x20with\x20TVox\x20application');}var _0x3f4412=_0x5677e5;var _0x12daef='channelId='+_0x26376b+'&serviceId='+_0x2b08b3+_0x2f65('0x17')+_0x3f4412+_0x2f65('0x18')+JSON[_0x2f65('0x11')](_0x4d1409);var _0x1e96ec=_0x5efdb8+'?'+_0x12daef;return rp(_0x1e96ec);})[_0x2f65('0x19')](function(_0x371417){logger[_0x2f65('0x1a')](_0x2f65('0x1b'),_0x3c2641,_0x371417);_0x2e98ae[_0x2f65('0x1c')]();})[_0x2f65('0x1d')](function(_0x54ba76){logger['error'](_0x2f65('0x1e'),_0x3c2641,_[_0x2f65('0x1f')](_0x54ba76)?JSON[_0x2f65('0x11')](_0x54ba76):_0x54ba76);_0x2e98ae[_0x2f65('0x1c')]();});}else{logger[_0x2f65('0x1a')](_0x2f65('0x20'),_0x3c2641);_0x2e98ae[_0x2f65('0x21')]();}};}; \ No newline at end of file +var _0xce64=['2.0','login','params','utf8','application/json-rpc','then','parse','result','logged','Unable\x20to\x20login\x20with\x20TVox\x20application','&serviceId=','stringify','info','[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s','stop','catch','error','[%s][TVOX]\x20%s','isObject','next','request-promise','../../../../config/logger','routing','lodash','consequence','\x20-\x20','replace','includes','push','urlOnAnswer','?params=','urlOnRing','jsonrpc'];(function(_0x58e0d8,_0x4e4d66){var _0x266e24=function(_0xca680){while(--_0xca680){_0x58e0d8['push'](_0x58e0d8['shift']());}};_0x266e24(++_0x4e4d66);}(_0xce64,0xfb));var _0x4ce6=function(_0x449051,_0x296cd4){_0x449051=_0x449051-0x0;var _0x4599aa=_0xce64[_0x449051];return _0x4599aa;};'use strict';var rp=require(_0x4ce6('0x0'));var logger=require(_0x4ce6('0x1'))(_0x4ce6('0x2'));var _=require(_0x4ce6('0x3'));var arr=[];exports[_0x4ce6('0x4')]=function(_0x29ebda,_0x56b6f2){return function(_0x565fb3){var _0x6a351b=_0x56b6f2[0xa];var _0x338bf=_0x56b6f2[0xb];var _0x37c49d=_0x56b6f2[0xc];var _0x14f131=_0x56b6f2[0xd];var _0x3477d0=_0x56b6f2[0xe];var _0x559745=_0x56b6f2[0xf]['replace'](/\n/g,_0x4ce6('0x5'));var _0x1c1e94=_0x56b6f2[0x10][_0x4ce6('0x6')](/\n/g,'\x20');if(!arr[_0x4ce6('0x7')](_0x338bf)){arr[_0x4ce6('0x8')](_0x338bf);var _0x29a1cf=_0x56b6f2[0x3];var _0x4d58e7=_0x56b6f2[0x4];var _0x2b351e=_0x56b6f2[0x1];var _0x201a5d=_0x56b6f2[0x0];var _0x46aa89={};_0x46aa89[_0x4ce6('0x9')]=_0x56b6f2[0x8]+_0x4ce6('0xa')+_0x37c49d+'|'+_0x6a351b+'|'+_0x14f131+'|'+_0x338bf+'|'+_0x3477d0;_0x46aa89[_0x4ce6('0xb')]=_0x56b6f2[0x7]+'?params='+_0x37c49d+'|'+_0x6a351b+'|'+_0x14f131+'|'+_0x338bf+'|'+_0x3477d0+'|'+_0x559745+'|'+_0x1c1e94;_0x46aa89['title']=_0x56b6f2[0x9];var _0x5cac74={};_0x5cac74[_0x4ce6('0xc')]=_0x4ce6('0xd');_0x5cac74['method']=_0x4ce6('0xe');var _0x2a8f97=[];_0x2a8f97[_0x4ce6('0x8')](_0x56b6f2[0x2]);_0x2a8f97['push'](_0x56b6f2[0x5]);_0x2a8f97['push'](_0x56b6f2[0x6]);_0x5cac74[_0x4ce6('0xf')]=_0x2a8f97;_0x5cac74['id']=0x1;var _0x35d61f=JSON['stringify'](_0x5cac74);var _0x157823={'encoding':_0x4ce6('0x10'),'method':'POST','timeout':0x2710,'url':_0x29a1cf,'headers':{'Content-Type':_0x4ce6('0x11')},'body':_0x35d61f};return rp(_0x157823)[_0x4ce6('0x12')](function(_0x109a79){const _0x3503ba=JSON[_0x4ce6('0x13')](_0x109a79);if(!_0x3503ba[_0x4ce6('0x14')][_0x4ce6('0x15')]){throw new Error(_0x4ce6('0x16'));}var _0x109d21=_0x338bf;var _0x44478f='channelId='+_0x2b351e+_0x4ce6('0x17')+_0x201a5d+'&sessionId='+_0x109d21+'&data='+JSON[_0x4ce6('0x18')](_0x46aa89);var _0x17f6f5=_0x4d58e7+'?'+_0x44478f;return rp(_0x17f6f5);})[_0x4ce6('0x12')](function(_0x5c5cf5){logger[_0x4ce6('0x19')](_0x4ce6('0x1a'),_0x29ebda,_0x5c5cf5);_0x565fb3[_0x4ce6('0x1b')]();})[_0x4ce6('0x1c')](function(_0x1160a0){logger[_0x4ce6('0x1d')](_0x4ce6('0x1e'),_0x29ebda,_[_0x4ce6('0x1f')](_0x1160a0)?JSON[_0x4ce6('0x18')](_0x1160a0):_0x1160a0);_0x565fb3[_0x4ce6('0x1b')]();});}else{logger['info']('[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next',_0x29ebda);_0x565fb3[_0x4ce6('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 c5a8cba..26920a6 100644 --- a/server/services/routing/server/applications/utils.js +++ b/server/services/routing/server/applications/utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['exports','render','merge','body','contact','message','account','interaction','list','mustache','lodash'];(function(_0x559ffb,_0x3631b5){var _0xcaa0e3=function(_0x55c28e){while(--_0x55c28e){_0x559ffb['push'](_0x559ffb['shift']());}};_0xcaa0e3(++_0x3631b5);}(_0xe706,0xa3));var _0x6e70=function(_0x561e73,_0x13a224){_0x561e73=_0x561e73-0x0;var _0x2dc60d=_0xe706[_0x561e73];return _0x2dc60d;};'use strict';var Mustache=require(_0x6e70('0x0'));var _=require(_0x6e70('0x1'));module[_0x6e70('0x2')]={'getMustacheRender':function(_0x5e8446,_0x2cae77){return Mustache[_0x6e70('0x3')](_0x5e8446,_[_0x6e70('0x4')](_0x2cae77[_0x6e70('0x5')],{'contact':_0x2cae77[_0x6e70('0x6')],'message':_0x2cae77[_0x6e70('0x7')],'account':_0x2cae77[_0x6e70('0x8')],'interaction':_0x2cae77[_0x6e70('0x9')],'list':_0x2cae77[_0x6e70('0xa')]}))||'';}}; \ No newline at end of file +var _0xd8b0=['merge','body','contact','message','list','mustache','lodash','render'];(function(_0x410958,_0x29e7de){var _0x2e80d8=function(_0x1ae0c4){while(--_0x1ae0c4){_0x410958['push'](_0x410958['shift']());}};_0x2e80d8(++_0x29e7de);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var Mustache=require(_0x0d8b('0x0'));var _=require(_0x0d8b('0x1'));module['exports']={'getMustacheRender':function(_0x585166,_0x4b72b0){return Mustache[_0x0d8b('0x2')](_0x585166,_[_0x0d8b('0x3')](_0x4b72b0[_0x0d8b('0x4')],{'contact':_0x4b72b0[_0x0d8b('0x5')],'message':_0x4b72b0[_0x0d8b('0x6')],'account':_0x4b72b0['account'],'interaction':_0x4b72b0['interaction'],'list':_0x4b72b0[_0x0d8b('0x7')]}))||'';}}; \ No newline at end of file diff --git a/server/services/routing/server/index.js b/server/services/routing/server/index.js index 9e43873..0de174b 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 _0xccd4=['tag','TagId','tvox','getMustacheRender','account','notificationTemplate','interaction','ChatWebsiteId','body','%s:%s:%s','./interval','intervals','./applications/','consequence','info','on\x20interval','\x20|\x20','error','execute','stringify','emit','complete','Skipped\x20routing\x20for\x20%s','stack','routing\x20is\x20empty','agent','agents','busyQueue','QueueReport','update','UserId','error\x20update\x20queue\x20report','message\x20is\x20empty','busy','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','agent\x20not\x20found','values','find','chatQueues','name','paused','waiting','mailQueues','available','openchannelQueues','loggedIn','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','http','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','path','jayson/promise','bluebird','./applications/utils','./applications/strategy/util','../../../config/logger','routing','../rpc/smsQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','format','%s.%s.%s','isNil','IntervalId','Intervals','map','interval','listen','rules','channel','message','checkWaitingNotifications','transfer','applications','isArray','length','existsSync','app','.js','toLowerCase','split','mail','push','slice','join','dialogflow','dialogflowv2','appdata','amazonlex'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xccd4,0xa4));var _0x4ccd=function(_0x68ee8b,_0x3cc6c5){_0x68ee8b=_0x68ee8b-0x0;var _0x5148f7=_0xccd4[_0x68ee8b];return _0x5148f7;};'use strict';var _=require(_0x4ccd('0x0'));var util=require(_0x4ccd('0x1'));var path=require(_0x4ccd('0x2'));var fs=require('fs');var jayson=require(_0x4ccd('0x3'));var BPromise=require(_0x4ccd('0x4'));var utils=require(_0x4ccd('0x5'));var sUtils=require(_0x4ccd('0x6'));var logger=require(_0x4ccd('0x7'))(_0x4ccd('0x8'));var rpc={'openchannelQueueReport':require('../rpc/openchannelQueueReport'),'mailQueueReport':require('../rpc/mailQueueReport'),'chatQueueReport':require('../rpc/chatQueueReport'),'smsQueueReport':require(_0x4ccd('0x9')),'faxQueueReport':require(_0x4ccd('0xa')),'whatsappQueueReport':require(_0x4ccd('0xb'))};var RuleEngine=require(_0x4ccd('0xc'));function getId(_0x37977b,_0x3c5b28,_0x50ab0f){return util[_0x4ccd('0xd')](_0x4ccd('0xe'),_0x37977b,_0x3c5b28||0x0,_0x50ab0f||0x0);}function getIntervals(_0x4a242d,_0x5d4bfd){var _0xa07e4e=[];if(!_[_0x4ccd('0xf')](_0x5d4bfd['IntervalId'])&&!_[_0x4ccd('0xf')](_0x4a242d[_0x5d4bfd[_0x4ccd('0x10')]])&&!_[_0x4ccd('0xf')](_0x4a242d[_0x5d4bfd[_0x4ccd('0x10')]][_0x4ccd('0x11')])){_0xa07e4e=_[_0x4ccd('0x12')](_0x4a242d[_0x5d4bfd[_0x4ccd('0x10')]][_0x4ccd('0x11')],_0x4ccd('0x13'));}else if(!_[_0x4ccd('0xf')](_0x5d4bfd[_0x4ccd('0x13')])){_0xa07e4e=[_0x5d4bfd[_0x4ccd('0x13')]];}return _0xa07e4e;}exports[_0x4ccd('0x14')]=function(_0x46be83){_0x46be83[_0x4ccd('0x15')]={};return new BPromise(function(_0x3784ad,_0x29554c){var _0x1d91da={'Start':function(_0x29643b){var _0x4d4c9a=this;return new Promise(function(_0x27dcfa,_0xf338b7){if(_0x29643b){try{var _0x37805c=[];var _0x64b4a4=getId(_0x29643b[_0x4ccd('0x16')],_0x29643b['message']?_0x29643b[_0x4ccd('0x17')]['id']:0x0,_0x29643b['interaction']?_0x29643b['interaction']['id']:0x0);var _0x2b8389=sUtils[_0x4ccd('0x18')](_0x46be83,_0x29643b);if(_0x29643b[_0x4ccd('0x19')]||!_0x2b8389&&_0x29643b[_0x4ccd('0x1a')]&&_[_0x4ccd('0x1b')](_0x29643b[_0x4ccd('0x1a')])&&_0x29643b[_0x4ccd('0x1a')][_0x4ccd('0x1c')]){for(var _0xf76a13=0x0;_0xf76a13<_0x29643b[_0x4ccd('0x1a')][_0x4ccd('0x1c')];_0xf76a13+=0x1){var _0x33febc=_0x29643b[_0x4ccd('0x1a')][_0xf76a13];if(fs[_0x4ccd('0x1d')](path['join'](__dirname,_0x4ccd('0x1a'),_0x33febc[_0x4ccd('0x1e')]+_0x4ccd('0x1f')))){var _0x1a608d=[];switch(_0x33febc[_0x4ccd('0x1e')][_0x4ccd('0x20')]()){case'autoreply':var _0x35af9b=_0x33febc['appdata'][_0x4ccd('0x21')](',');if(_0x29643b[_0x4ccd('0x16')]===_0x4ccd('0x22')){_0x1a608d[_0x4ccd('0x23')](_0x35af9b[0x0]);_0x1a608d[_0x4ccd('0x23')](_0x35af9b[0x1]);_0x1a608d[_0x4ccd('0x23')](_0x35af9b[_0x4ccd('0x24')](0x2,_0x35af9b[_0x4ccd('0x1c')])[_0x4ccd('0x25')](','));}else{_0x1a608d['push'](_0x35af9b[0x0]);_0x1a608d[_0x4ccd('0x23')](_0x35af9b[_0x4ccd('0x24')](0x1,_0x35af9b['length'])[_0x4ccd('0x25')](','));}break;case _0x4ccd('0x26'):var _0x48a22a=_0x33febc['appdata'][_0x4ccd('0x21')](',');_0x1a608d['push'](_0x48a22a[0x0]);_0x1a608d[_0x4ccd('0x23')](_0x48a22a[0x1]);_0x1a608d[_0x4ccd('0x23')](_0x48a22a['slice'](0x2,_0x48a22a['length'])[_0x4ccd('0x25')](','));break;case _0x4ccd('0x27'):var _0x22d966=_0x33febc[_0x4ccd('0x28')][_0x4ccd('0x21')](',');_0x1a608d[_0x4ccd('0x23')](_0x22d966[0x0]);_0x1a608d[_0x4ccd('0x23')](_0x22d966[0x1]);_0x1a608d[_0x4ccd('0x23')](_0x22d966[0x2]);_0x1a608d[_0x4ccd('0x23')](_0x22d966[0x3]);_0x1a608d[_0x4ccd('0x23')](_0x22d966[_0x4ccd('0x24')](0x4,_0x22d966[_0x4ccd('0x1c')])[_0x4ccd('0x25')](','));break;case _0x4ccd('0x29'):var _0x107f42=_0x33febc[_0x4ccd('0x28')]['split'](',');_0x1a608d[_0x4ccd('0x23')](_0x107f42[0x0]);_0x1a608d[_0x4ccd('0x23')](_0x107f42[0x1]);_0x1a608d[_0x4ccd('0x23')](_0x107f42[0x2]);_0x1a608d[_0x4ccd('0x23')](_0x107f42[0x3]);_0x1a608d[_0x4ccd('0x23')](_0x107f42[_0x4ccd('0x24')](0x4,_0x107f42[_0x4ccd('0x1c')])['join'](','));break;case _0x4ccd('0x17'):_0x1a608d[_0x4ccd('0x23')](_0x33febc[_0x4ccd('0x28')]);break;case _0x4ccd('0x2a'):_0x1a608d['push'](_0x33febc[_0x4ccd('0x2b')]);_0x1a608d[_0x4ccd('0x23')](_0x33febc[_0x4ccd('0x28')]);break;case _0x4ccd('0x2c'):var _0x1836e7=utils[_0x4ccd('0x2d')](_0x29643b[_0x4ccd('0x2e')][_0x4ccd('0x2f')],_0x29643b);var _0x344682=_0x33febc[_0x4ccd('0x28')][_0x4ccd('0x21')](',');_0x1a608d[_0x4ccd('0x23')](_0x344682[0x0]);_0x1a608d[_0x4ccd('0x23')](_0x344682[0x1]);_0x1a608d['push'](_0x344682[0x2]);_0x1a608d['push'](_0x344682[0x3]);_0x1a608d[_0x4ccd('0x23')](_0x344682[0x4]);_0x1a608d['push'](_0x344682[0x5]);_0x1a608d[_0x4ccd('0x23')](_0x344682[0x6]);_0x1a608d[_0x4ccd('0x23')](_0x344682[0x7]);_0x1a608d[_0x4ccd('0x23')](_0x344682[0x8]);_0x1a608d[_0x4ccd('0x23')](_0x344682[0x9]);_0x1a608d[_0x4ccd('0x23')](_0x344682[0xa]);_0x1a608d[_0x4ccd('0x23')](_0x29643b[_0x4ccd('0x30')]['id']);_0x1a608d[_0x4ccd('0x23')](_0x29643b['message']['id']);_0x1a608d[_0x4ccd('0x23')](_0x33febc[_0x4ccd('0x31')]);_0x1a608d[_0x4ccd('0x23')](_0x29643b['interaction']['ContactId']);_0x1a608d[_0x4ccd('0x23')](_0x29643b[_0x4ccd('0x32')]['body']);_0x1a608d[_0x4ccd('0x23')](_0x1836e7);break;default:_0x1a608d=_['isNil'](_0x33febc['appdata'])?[]:_0x33febc[_0x4ccd('0x28')][_0x4ccd('0x21')](',');}var _0x2512dd={'id':util[_0x4ccd('0xd')](_0x4ccd('0x33'),_0x64b4a4,_0x33febc['id'],_0x33febc['app']),'condition':require(_0x4ccd('0x34'))['condition'](_0x64b4a4,getIntervals(_0x46be83[_0x4ccd('0x35')],_0x33febc),_0x46be83),'consequence':require(_0x4ccd('0x36')+_0x33febc[_0x4ccd('0x1e')])[_0x4ccd('0x37')](_0x64b4a4,_0x1a608d,_0x46be83,_0x29643b),'p':_0x33febc['priority']||0x0};logger[_0x4ccd('0x38')]('Push\x20new\x20rule',_0x2512dd['id'],_0x4ccd('0x39'),getIntervals(_0x46be83[_0x4ccd('0x35')],_0x33febc)[_0x4ccd('0x25')](_0x4ccd('0x3a')));_0x37805c[_0x4ccd('0x23')](_0x2512dd);}else{logger[_0x4ccd('0x3b')]('Please\x20create\x20a\x20new\x20file\x20under',path[_0x4ccd('0x25')](__dirname,_0x4ccd('0x1a'),_0x33febc[_0x4ccd('0x1e')]+'.js'));}}_0x46be83[_0x4ccd('0x15')][_0x64b4a4]=new RuleEngine(_0x37805c);_0x46be83[_0x4ccd('0x15')][_0x64b4a4][_0x4ccd('0x3c')](_0x29643b,function(_0x3589b6){logger[_0x4ccd('0x38')]('Applications\x20executed',JSON[_0x4ccd('0x3d')](_0x3589b6['matchPath']));if(_0x46be83['rules'][_0x64b4a4]){_0x46be83[_0x4ccd('0x15')][_0x64b4a4][_0x4ccd('0x3e')](_0x4ccd('0x3f'));}});return _0x27dcfa({'code':0xc8,'message':_0x29643b});}else{if(_0x2b8389){logger[_0x4ccd('0x38')](util[_0x4ccd('0xd')](_0x4ccd('0x40'),_0x64b4a4));}else{logger['info']('No\x20applications\x20to\x20execute');}return _0x27dcfa({'code':0xc8,'message':_0x29643b});}}catch(_0x547019){logger[_0x4ccd('0x3b')](_0x547019[_0x4ccd('0x41')]);return _0xf338b7(_0x4d4c9a[_0x4ccd('0x3b')](0x1f4,_0x547019));}}return _0xf338b7(_0x4ccd('0x42'));});},'AcceptMessage':function(_0x145cfe){var _0x1720f1=this;return new Promise(function(_0x4c256c,_0xbe5e72){if(_0x145cfe[_0x4ccd('0x43')]&&_0x145cfe['agent']['id']){if(_0x46be83[_0x4ccd('0x44')][_0x145cfe[_0x4ccd('0x43')]['id']]){_0x46be83[_0x4ccd('0x44')][_0x145cfe[_0x4ccd('0x43')]['id']]['busy']=![];_0x46be83['agents'][_0x145cfe['agent']['id']][_0x4ccd('0x45')]=undefined;}}if(_0x145cfe['message']&&_0x145cfe[_0x4ccd('0x17')]['id']){try{var _0x4ba428=getId(_0x145cfe[_0x4ccd('0x16')],_0x145cfe['message']?_0x145cfe['message']['id']:0x0,_0x145cfe['interaction']?_0x145cfe[_0x4ccd('0x30')]['id']:0x0);if(_0x46be83[_0x4ccd('0x15')][_0x4ba428]){_0x46be83[_0x4ccd('0x15')][_0x4ba428][_0x4ccd('0x3e')]('end');if(rpc[_0x145cfe[_0x4ccd('0x16')]+_0x4ccd('0x46')]){rpc[_0x145cfe[_0x4ccd('0x16')]+_0x4ccd('0x46')][_0x4ccd('0x47')](_0x4ba428,{'UserId':_0x145cfe[_0x4ccd('0x17')][_0x4ccd('0x48')]})['catch'](function(){logger[_0x4ccd('0x3b')](_0x4ccd('0x49'));});}}return _0x4c256c({'code':0xc8,'message':_0x145cfe});}catch(_0x591e75){logger[_0x4ccd('0x3b')](_0x591e75[_0x4ccd('0x41')]);return _0xbe5e72(_0x1720f1['error'](0x1f4,_0x591e75));}}logger[_0x4ccd('0x3b')]('message\x20is\x20empty');return _0xbe5e72(_0x1720f1[_0x4ccd('0x3b')](0x1f4,_0x4ccd('0x4a')));});},'RejectMessage':function(_0x14d986){var _0x4434c2=this;return new Promise(function(_0x4b37bf,_0x2c6312){if(_0x14d986[_0x4ccd('0x43')]&&_0x14d986[_0x4ccd('0x43')]['id']){try{if(_0x46be83[_0x4ccd('0x44')][_0x14d986['agent']['id']]){_0x46be83['agents'][_0x14d986['agent']['id']][_0x4ccd('0x4b')]=![];_0x46be83[_0x4ccd('0x44')][_0x14d986['agent']['id']][_0x4ccd('0x45')]=undefined;}return _0x4b37bf({'code':0xc8,'message':_0x14d986});}catch(_0x52429a){logger[_0x4ccd('0x3b')](_0x52429a[_0x4ccd('0x41')]);return _0x2c6312(_0x4434c2[_0x4ccd('0x3b')](0x1f4,_0x52429a));}}logger[_0x4ccd('0x3b')](_0x4ccd('0x4a'));return _0x2c6312(_0x4434c2['error'](0x1f4,_0x4ccd('0x4a')));});},'AbandonInteraction':function(_0x89d6bf){var _0x22c0ce=this;return new Promise(function(_0x557612,_0x19d234){if(_0x89d6bf[_0x4ccd('0x16')]&&_0x89d6bf[_0x4ccd('0x30')]&&_0x89d6bf['interaction']['id']){try{var _0x171d21=getId(_0x89d6bf[_0x4ccd('0x16')],_0x89d6bf['message']?_0x89d6bf[_0x4ccd('0x17')]['id']:0x0,_0x89d6bf[_0x4ccd('0x30')]?_0x89d6bf['interaction']['id']:0x0);if(_0x46be83[_0x4ccd('0x15')][_0x171d21]){_0x46be83[_0x4ccd('0x15')][_0x171d21][_0x4ccd('0x3e')]('end');}return _0x557612({'code':0xc8,'message':_0x89d6bf});}catch(_0x3c2890){logger[_0x4ccd('0x3b')](_0x3c2890['stack']);return _0x19d234(_0x22c0ce[_0x4ccd('0x3b')](0x1f4,_0x3c2890));}}logger[_0x4ccd('0x3b')](_0x4ccd('0x4a'));return _0x19d234(_0x22c0ce[_0x4ccd('0x3b')](0x1f4,_0x4ccd('0x4a')));});},'AgentCapacity':function(_0x2f3516){var _0x1bbf94=this;return new Promise(function(_0x27082d,_0x73646a){if(_0x46be83[_0x4ccd('0x44')][_0x4ccd('0x4c')](_0x2f3516['id'])){for(var _0x52f7d9 in _0x2f3516[_0x4ccd('0x4d')]){if(_0x2f3516['capacity'][_0x4ccd('0x4c')](_0x52f7d9)){if(_0x46be83['agents'][_0x2f3516['id']][_0x4ccd('0x4c')](_0x52f7d9+'CurrentCapacity')){_0x46be83[_0x4ccd('0x44')][_0x2f3516['id']][_0x52f7d9+_0x4ccd('0x4e')]=parseInt(_0x2f3516[_0x4ccd('0x4d')][_0x52f7d9],0xa);}}}_0x46be83[_0x4ccd('0x44')][_0x2f3516['id']][_0x4ccd('0x4f')]();return _0x27082d({'code':0xc8,'message':_0x46be83[_0x4ccd('0x44')][_0x2f3516['id']]});}else{return _0x73646a(_0x1bbf94[_0x4ccd('0x3b')](0x1f4,_0x4ccd('0x50')));}});},'Agents':function(_0x4ba532){return new Promise(function(_0x3f0cb9){var _0x40d04a=_[_0x4ccd('0x51')](_0x46be83[_0x4ccd('0x44')]);if(_0x4ba532&&_0x4ba532['id']){var _0x456363=_[_0x4ccd('0x52')](_0x40d04a,function(_0x5c88e3){return _0x5c88e3['id']===_0x4ba532['id'];});_0x3f0cb9(_0x456363);}else{_0x3f0cb9({'count':_0x40d04a[_0x4ccd('0x1c')],'rows':_0x40d04a});}});},'ChatQueues':function(){return new Promise(function(_0x24ad9f){var _0x2cabba=[];for(var _0x5e0d5d in _0x46be83[_0x4ccd('0x53')]){if(_0x46be83[_0x4ccd('0x53')][_0x4ccd('0x4c')](_0x5e0d5d)){var _0x3f4c63=_0x46be83[_0x4ccd('0x53')][_0x5e0d5d];var _0x426bfd={'id':_0x3f4c63['id'],'available':_0x3f4c63['available'],'loggedIn':_0x3f4c63['loggedIn'],'name':_0x3f4c63[_0x4ccd('0x54')],'paused':_0x3f4c63[_0x4ccd('0x55')],'waiting':_0x3f4c63[_0x4ccd('0x56')]};_0x2cabba['push'](_0x426bfd);}}_0x24ad9f({'count':_0x2cabba[_0x4ccd('0x1c')],'rows':_0x2cabba});});},'MailQueues':function(){return new Promise(function(_0x19c53f){var _0x35e817=[];for(var _0x544343 in _0x46be83[_0x4ccd('0x57')]){if(_0x46be83[_0x4ccd('0x57')][_0x4ccd('0x4c')](_0x544343)){var _0xf07a2b=_0x46be83[_0x4ccd('0x57')][_0x544343];var _0x1561b1={'id':_0xf07a2b['id'],'available':_0xf07a2b[_0x4ccd('0x58')],'loggedIn':_0xf07a2b['loggedIn'],'name':_0xf07a2b[_0x4ccd('0x54')],'paused':_0xf07a2b['paused'],'waiting':_0xf07a2b[_0x4ccd('0x56')]};_0x35e817['push'](_0x1561b1);}}_0x19c53f({'count':_0x35e817[_0x4ccd('0x1c')],'rows':_0x35e817});});},'OpenchannelQueues':function(){return new Promise(function(_0x9014a1){var _0x4d971d=[];for(var _0x98a9ae in _0x46be83[_0x4ccd('0x59')]){if(_0x46be83[_0x4ccd('0x59')][_0x4ccd('0x4c')](_0x98a9ae)){var _0x3011b0=_0x46be83[_0x4ccd('0x59')][_0x98a9ae];var _0x45b667={'id':_0x3011b0['id'],'available':_0x3011b0[_0x4ccd('0x58')],'loggedIn':_0x3011b0[_0x4ccd('0x5a')],'name':_0x3011b0['name'],'paused':_0x3011b0[_0x4ccd('0x55')],'waiting':_0x3011b0[_0x4ccd('0x56')]};_0x4d971d[_0x4ccd('0x23')](_0x45b667);}}_0x9014a1({'count':_0x4d971d['length'],'rows':_0x4d971d});});},'SmsQueues':function(){return new Promise(function(_0x49f85e){var _0x5dc349=[];for(var _0x534e84 in _0x46be83[_0x4ccd('0x5b')]){if(_0x46be83['smsQueues'][_0x4ccd('0x4c')](_0x534e84)){var _0x3c1e82=_0x46be83['smsQueues'][_0x534e84];var _0x4eddae={'id':_0x3c1e82['id'],'available':_0x3c1e82[_0x4ccd('0x58')],'loggedIn':_0x3c1e82['loggedIn'],'name':_0x3c1e82['name'],'paused':_0x3c1e82[_0x4ccd('0x55')],'waiting':_0x3c1e82[_0x4ccd('0x56')]};_0x5dc349[_0x4ccd('0x23')](_0x4eddae);}}_0x49f85e({'count':_0x5dc349[_0x4ccd('0x1c')],'rows':_0x5dc349});});},'FaxQueues':function(){return new Promise(function(_0x249418){var _0x3f8974=[];for(var _0x48e0a0 in _0x46be83[_0x4ccd('0x5c')]){if(_0x46be83[_0x4ccd('0x5c')]['hasOwnProperty'](_0x48e0a0)){var _0x50d04d=_0x46be83[_0x4ccd('0x5c')][_0x48e0a0];var _0x3b7405={'id':_0x50d04d['id'],'available':_0x50d04d[_0x4ccd('0x58')],'loggedIn':_0x50d04d[_0x4ccd('0x5a')],'name':_0x50d04d[_0x4ccd('0x54')],'paused':_0x50d04d[_0x4ccd('0x55')],'waiting':_0x50d04d['waiting']};_0x3f8974[_0x4ccd('0x23')](_0x3b7405);}}_0x249418({'count':_0x3f8974['length'],'rows':_0x3f8974});});},'WhatsappQueues':function(){return new Promise(function(_0x3db39e){var _0x3102c2=[];for(var _0x4a4368 in _0x46be83[_0x4ccd('0x5d')]){if(_0x46be83[_0x4ccd('0x5d')]['hasOwnProperty'](_0x4a4368)){var _0x5089af=_0x46be83[_0x4ccd('0x5d')][_0x4a4368];var _0x559e5b={'id':_0x5089af['id'],'available':_0x5089af[_0x4ccd('0x58')],'loggedIn':_0x5089af[_0x4ccd('0x5a')],'name':_0x5089af[_0x4ccd('0x54')],'paused':_0x5089af['paused'],'waiting':_0x5089af[_0x4ccd('0x56')]};_0x3102c2[_0x4ccd('0x23')](_0x559e5b);}}_0x3db39e({'count':_0x3102c2[_0x4ccd('0x1c')],'rows':_0x3102c2});});},'ChatQueuesWaitingInteractions':function(){return new Promise(function(_0x2393cc){var _0x118133=_[_0x4ccd('0x51')](_0x46be83[_0x4ccd('0x5e')]);_0x2393cc({'count':_0x118133[_0x4ccd('0x1c')],'rows':_0x118133});});},'MailQueuesWaitingInteractions':function(){return new Promise(function(_0x5c303d){var _0x268388=_[_0x4ccd('0x51')](_0x46be83['mailQueuesWaitingInteractions']);_0x5c303d({'count':_0x268388['length'],'rows':_0x268388});});},'OpenchannelQueuesWaitingInteractions':function(){return new Promise(function(_0x48608f){var _0x51fb61=_['values'](_0x46be83['openchannelQueuesWaitingInteractions']);_0x48608f({'count':_0x51fb61[_0x4ccd('0x1c')],'rows':_0x51fb61});});},'SmsQueuesWaitingInteractions':function(){return new Promise(function(_0x37c7e7){var _0x3783a3=_['values'](_0x46be83[_0x4ccd('0x5f')]);_0x37c7e7({'count':_0x3783a3['length'],'rows':_0x3783a3});});},'FaxQueuesWaitingInteractions':function(){return new Promise(function(_0x52f289){var _0x45179d=_[_0x4ccd('0x51')](_0x46be83[_0x4ccd('0x60')]);_0x52f289({'count':_0x45179d['length'],'rows':_0x45179d});});},'WhatsappQueuesWaitingInteractions':function(){return new Promise(function(_0x3be105){var _0x5b1453=_[_0x4ccd('0x51')](_0x46be83[_0x4ccd('0x61')]);_0x3be105({'count':_0x5b1453[_0x4ccd('0x1c')],'rows':_0x5b1453});});}};var _0x3120eb=jayson[_0x4ccd('0x62')](_0x1d91da)[_0x4ccd('0x63')]();_0x3120eb['on'](_0x4ccd('0x3b'),function(_0x423743){logger[_0x4ccd('0x3b')](JSON['stringify'](_0x423743));return _0x29554c(_0x423743);});_0x3120eb[_0x4ccd('0x14')](0x232c,'127.0.0.1',function(){console[_0x4ccd('0x64')](_0x4ccd('0x65'),0x232c);return _0x3784ad(_0x4ccd('0x66')+0x232c);});});}; \ No newline at end of file +var _0x887b=['rules','channel','message','interaction','transfer','applications','isArray','existsSync','app','toLowerCase','autoreply','appdata','split','push','slice','length','join','dialogflow','dialogflowv2','amazonlex','tag','TagId','tvox','getMustacheRender','account','ChatWebsiteId','ContactId','body','%s:%s:%s','./interval','condition','intervals','consequence','priority','info','Push\x20new\x20rule','\x20|\x20','error','Please\x20create\x20a\x20new\x20file\x20under','execute','stringify','matchPath','emit','complete','Skipped\x20routing\x20for\x20%s','No\x20applications\x20to\x20execute','routing\x20is\x20empty','agent','agents','busy','end','update','UserId','catch','stack','message\x20is\x20empty','capacity','hasOwnProperty','CurrentCapacity','agent\x20not\x20found','find','chatQueues','loggedIn','name','paused','waiting','mailQueues','available','openchannelQueues','smsQueues','faxQueues','whatsappQueues','values','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','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','../../../config/logger','routing','../rpc/mailQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','format','isNil','IntervalId','Intervals','map','interval','listen'];(function(_0x4f5ed6,_0x5c7f19){var _0x305c18=function(_0x10cbb5){while(--_0x10cbb5){_0x4f5ed6['push'](_0x4f5ed6['shift']());}};_0x305c18(++_0x5c7f19);}(_0x887b,0x185));var _0xb887=function(_0xf7bd9a,_0x509931){_0xf7bd9a=_0xf7bd9a-0x0;var _0x3cb61b=_0x887b[_0xf7bd9a];return _0x3cb61b;};'use strict';var _=require(_0xb887('0x0'));var util=require(_0xb887('0x1'));var path=require(_0xb887('0x2'));var fs=require('fs');var jayson=require(_0xb887('0x3'));var BPromise=require(_0xb887('0x4'));var utils=require(_0xb887('0x5'));var sUtils=require(_0xb887('0x6'));var logger=require(_0xb887('0x7'))(_0xb887('0x8'));var rpc={'openchannelQueueReport':require('../rpc/openchannelQueueReport'),'mailQueueReport':require(_0xb887('0x9')),'chatQueueReport':require('../rpc/chatQueueReport'),'smsQueueReport':require('../rpc/smsQueueReport'),'faxQueueReport':require('../rpc/faxQueueReport'),'whatsappQueueReport':require(_0xb887('0xa'))};var RuleEngine=require(_0xb887('0xb'));function getId(_0x59707f,_0x4a1c1e,_0x32ace2){return util[_0xb887('0xc')]('%s.%s.%s',_0x59707f,_0x4a1c1e||0x0,_0x32ace2||0x0);}function getIntervals(_0x49962f,_0x51370e){var _0x368e22=[];if(!_[_0xb887('0xd')](_0x51370e['IntervalId'])&&!_[_0xb887('0xd')](_0x49962f[_0x51370e['IntervalId']])&&!_[_0xb887('0xd')](_0x49962f[_0x51370e[_0xb887('0xe')]][_0xb887('0xf')])){_0x368e22=_[_0xb887('0x10')](_0x49962f[_0x51370e['IntervalId']]['Intervals'],_0xb887('0x11'));}else if(!_[_0xb887('0xd')](_0x51370e[_0xb887('0x11')])){_0x368e22=[_0x51370e[_0xb887('0x11')]];}return _0x368e22;}exports[_0xb887('0x12')]=function(_0x5899bb){_0x5899bb[_0xb887('0x13')]={};return new BPromise(function(_0xae7291,_0x28bda6){var _0x34174a={'Start':function(_0x7bac36){var _0x1b193c=this;return new Promise(function(_0x2008e4,_0x2b0f05){if(_0x7bac36){try{var _0x36f47b=[];var _0xcb6e66=getId(_0x7bac36[_0xb887('0x14')],_0x7bac36[_0xb887('0x15')]?_0x7bac36['message']['id']:0x0,_0x7bac36['interaction']?_0x7bac36[_0xb887('0x16')]['id']:0x0);var _0x33b7e0=sUtils['checkWaitingNotifications'](_0x5899bb,_0x7bac36);if(_0x7bac36[_0xb887('0x17')]||!_0x33b7e0&&_0x7bac36[_0xb887('0x18')]&&_[_0xb887('0x19')](_0x7bac36[_0xb887('0x18')])&&_0x7bac36[_0xb887('0x18')]['length']){for(var _0x2b1943=0x0;_0x2b1943<_0x7bac36['applications']['length'];_0x2b1943+=0x1){var _0x68ef0a=_0x7bac36[_0xb887('0x18')][_0x2b1943];if(fs[_0xb887('0x1a')](path['join'](__dirname,'applications',_0x68ef0a[_0xb887('0x1b')]+'.js'))){var _0x321cb6=[];switch(_0x68ef0a[_0xb887('0x1b')][_0xb887('0x1c')]()){case _0xb887('0x1d'):var _0x49a401=_0x68ef0a[_0xb887('0x1e')][_0xb887('0x1f')](',');if(_0x7bac36[_0xb887('0x14')]==='mail'){_0x321cb6[_0xb887('0x20')](_0x49a401[0x0]);_0x321cb6['push'](_0x49a401[0x1]);_0x321cb6[_0xb887('0x20')](_0x49a401[_0xb887('0x21')](0x2,_0x49a401[_0xb887('0x22')])['join'](','));}else{_0x321cb6['push'](_0x49a401[0x0]);_0x321cb6[_0xb887('0x20')](_0x49a401[_0xb887('0x21')](0x1,_0x49a401[_0xb887('0x22')])[_0xb887('0x23')](','));}break;case _0xb887('0x24'):var _0x233e78=_0x68ef0a['appdata'][_0xb887('0x1f')](',');_0x321cb6[_0xb887('0x20')](_0x233e78[0x0]);_0x321cb6[_0xb887('0x20')](_0x233e78[0x1]);_0x321cb6[_0xb887('0x20')](_0x233e78['slice'](0x2,_0x233e78[_0xb887('0x22')])['join'](','));break;case _0xb887('0x25'):var _0x3e99f7=_0x68ef0a[_0xb887('0x1e')][_0xb887('0x1f')](',');_0x321cb6['push'](_0x3e99f7[0x0]);_0x321cb6[_0xb887('0x20')](_0x3e99f7[0x1]);_0x321cb6[_0xb887('0x20')](_0x3e99f7[0x2]);_0x321cb6['push'](_0x3e99f7[0x3]);_0x321cb6[_0xb887('0x20')](_0x3e99f7[_0xb887('0x21')](0x4,_0x3e99f7[_0xb887('0x22')])['join'](','));break;case _0xb887('0x26'):var _0x49aed6=_0x68ef0a[_0xb887('0x1e')]['split'](',');_0x321cb6[_0xb887('0x20')](_0x49aed6[0x0]);_0x321cb6[_0xb887('0x20')](_0x49aed6[0x1]);_0x321cb6[_0xb887('0x20')](_0x49aed6[0x2]);_0x321cb6[_0xb887('0x20')](_0x49aed6[0x3]);_0x321cb6['push'](_0x49aed6[_0xb887('0x21')](0x4,_0x49aed6[_0xb887('0x22')])[_0xb887('0x23')](','));break;case _0xb887('0x15'):_0x321cb6['push'](_0x68ef0a[_0xb887('0x1e')]);break;case _0xb887('0x27'):_0x321cb6[_0xb887('0x20')](_0x68ef0a[_0xb887('0x28')]);_0x321cb6[_0xb887('0x20')](_0x68ef0a[_0xb887('0x1e')]);break;case _0xb887('0x29'):var _0x4dac2f=utils[_0xb887('0x2a')](_0x7bac36[_0xb887('0x2b')]['notificationTemplate'],_0x7bac36);var _0x1a2aa8=_0x68ef0a[_0xb887('0x1e')]['split'](',');_0x321cb6[_0xb887('0x20')](_0x1a2aa8[0x0]);_0x321cb6[_0xb887('0x20')](_0x1a2aa8[0x1]);_0x321cb6[_0xb887('0x20')](_0x1a2aa8[0x2]);_0x321cb6['push'](_0x1a2aa8[0x3]);_0x321cb6['push'](_0x1a2aa8[0x4]);_0x321cb6['push'](_0x1a2aa8[0x5]);_0x321cb6['push'](_0x1a2aa8[0x6]);_0x321cb6[_0xb887('0x20')](_0x1a2aa8[0x7]);_0x321cb6[_0xb887('0x20')](_0x1a2aa8[0x8]);_0x321cb6['push'](_0x1a2aa8[0x9]);_0x321cb6[_0xb887('0x20')](_0x1a2aa8[0xa]);_0x321cb6[_0xb887('0x20')](_0x7bac36[_0xb887('0x16')]['id']);_0x321cb6['push'](_0x7bac36[_0xb887('0x15')]['id']);_0x321cb6[_0xb887('0x20')](_0x68ef0a[_0xb887('0x2c')]);_0x321cb6[_0xb887('0x20')](_0x7bac36[_0xb887('0x16')][_0xb887('0x2d')]);_0x321cb6[_0xb887('0x20')](_0x7bac36[_0xb887('0x2e')][_0xb887('0x2e')]);_0x321cb6[_0xb887('0x20')](_0x4dac2f);break;default:_0x321cb6=_[_0xb887('0xd')](_0x68ef0a[_0xb887('0x1e')])?[]:_0x68ef0a['appdata']['split'](',');}var _0x9a1895={'id':util[_0xb887('0xc')](_0xb887('0x2f'),_0xcb6e66,_0x68ef0a['id'],_0x68ef0a[_0xb887('0x1b')]),'condition':require(_0xb887('0x30'))[_0xb887('0x31')](_0xcb6e66,getIntervals(_0x5899bb[_0xb887('0x32')],_0x68ef0a),_0x5899bb),'consequence':require('./applications/'+_0x68ef0a['app'])[_0xb887('0x33')](_0xcb6e66,_0x321cb6,_0x5899bb,_0x7bac36),'p':_0x68ef0a[_0xb887('0x34')]||0x0};logger[_0xb887('0x35')](_0xb887('0x36'),_0x9a1895['id'],'on\x20interval',getIntervals(_0x5899bb['intervals'],_0x68ef0a)[_0xb887('0x23')](_0xb887('0x37')));_0x36f47b[_0xb887('0x20')](_0x9a1895);}else{logger[_0xb887('0x38')](_0xb887('0x39'),path[_0xb887('0x23')](__dirname,_0xb887('0x18'),_0x68ef0a[_0xb887('0x1b')]+'.js'));}}_0x5899bb[_0xb887('0x13')][_0xcb6e66]=new RuleEngine(_0x36f47b);_0x5899bb['rules'][_0xcb6e66][_0xb887('0x3a')](_0x7bac36,function(_0x448cd2){logger['info']('Applications\x20executed',JSON[_0xb887('0x3b')](_0x448cd2[_0xb887('0x3c')]));if(_0x5899bb[_0xb887('0x13')][_0xcb6e66]){_0x5899bb[_0xb887('0x13')][_0xcb6e66][_0xb887('0x3d')](_0xb887('0x3e'));}});return _0x2008e4({'code':0xc8,'message':_0x7bac36});}else{if(_0x33b7e0){logger[_0xb887('0x35')](util[_0xb887('0xc')](_0xb887('0x3f'),_0xcb6e66));}else{logger[_0xb887('0x35')](_0xb887('0x40'));}return _0x2008e4({'code':0xc8,'message':_0x7bac36});}}catch(_0x5aa990){logger[_0xb887('0x38')](_0x5aa990['stack']);return _0x2b0f05(_0x1b193c['error'](0x1f4,_0x5aa990));}}return _0x2b0f05(_0xb887('0x41'));});},'AcceptMessage':function(_0x9c4384){var _0x235766=this;return new Promise(function(_0x18fa99,_0x28c234){if(_0x9c4384[_0xb887('0x42')]&&_0x9c4384['agent']['id']){if(_0x5899bb['agents'][_0x9c4384['agent']['id']]){_0x5899bb[_0xb887('0x43')][_0x9c4384[_0xb887('0x42')]['id']][_0xb887('0x44')]=![];_0x5899bb[_0xb887('0x43')][_0x9c4384['agent']['id']]['busyQueue']=undefined;}}if(_0x9c4384[_0xb887('0x15')]&&_0x9c4384[_0xb887('0x15')]['id']){try{var _0x17fadb=getId(_0x9c4384[_0xb887('0x14')],_0x9c4384[_0xb887('0x15')]?_0x9c4384['message']['id']:0x0,_0x9c4384[_0xb887('0x16')]?_0x9c4384[_0xb887('0x16')]['id']:0x0);if(_0x5899bb[_0xb887('0x13')][_0x17fadb]){_0x5899bb[_0xb887('0x13')][_0x17fadb][_0xb887('0x3d')](_0xb887('0x45'));if(rpc[_0x9c4384[_0xb887('0x14')]+'QueueReport']){rpc[_0x9c4384[_0xb887('0x14')]+'QueueReport'][_0xb887('0x46')](_0x17fadb,{'UserId':_0x9c4384['message'][_0xb887('0x47')]})[_0xb887('0x48')](function(){logger['error']('error\x20update\x20queue\x20report');});}}return _0x18fa99({'code':0xc8,'message':_0x9c4384});}catch(_0x707746){logger[_0xb887('0x38')](_0x707746[_0xb887('0x49')]);return _0x28c234(_0x235766['error'](0x1f4,_0x707746));}}logger[_0xb887('0x38')](_0xb887('0x4a'));return _0x28c234(_0x235766['error'](0x1f4,_0xb887('0x4a')));});},'RejectMessage':function(_0x3bb13a){var _0x4b1d94=this;return new Promise(function(_0x4dd0b9,_0x3be3a0){if(_0x3bb13a[_0xb887('0x42')]&&_0x3bb13a[_0xb887('0x42')]['id']){try{if(_0x5899bb['agents'][_0x3bb13a[_0xb887('0x42')]['id']]){_0x5899bb[_0xb887('0x43')][_0x3bb13a['agent']['id']][_0xb887('0x44')]=![];_0x5899bb[_0xb887('0x43')][_0x3bb13a[_0xb887('0x42')]['id']]['busyQueue']=undefined;}return _0x4dd0b9({'code':0xc8,'message':_0x3bb13a});}catch(_0x412fb4){logger['error'](_0x412fb4[_0xb887('0x49')]);return _0x3be3a0(_0x4b1d94[_0xb887('0x38')](0x1f4,_0x412fb4));}}logger[_0xb887('0x38')](_0xb887('0x4a'));return _0x3be3a0(_0x4b1d94[_0xb887('0x38')](0x1f4,'message\x20is\x20empty'));});},'AbandonInteraction':function(_0x4a8c89){var _0x2bf461=this;return new Promise(function(_0x56b033,_0x21e062){if(_0x4a8c89[_0xb887('0x14')]&&_0x4a8c89['interaction']&&_0x4a8c89['interaction']['id']){try{var _0xf1bc8a=getId(_0x4a8c89['channel'],_0x4a8c89[_0xb887('0x15')]?_0x4a8c89[_0xb887('0x15')]['id']:0x0,_0x4a8c89['interaction']?_0x4a8c89[_0xb887('0x16')]['id']:0x0);if(_0x5899bb[_0xb887('0x13')][_0xf1bc8a]){_0x5899bb[_0xb887('0x13')][_0xf1bc8a][_0xb887('0x3d')](_0xb887('0x45'));}return _0x56b033({'code':0xc8,'message':_0x4a8c89});}catch(_0xe50f5){logger['error'](_0xe50f5[_0xb887('0x49')]);return _0x21e062(_0x2bf461['error'](0x1f4,_0xe50f5));}}logger[_0xb887('0x38')](_0xb887('0x4a'));return _0x21e062(_0x2bf461['error'](0x1f4,'message\x20is\x20empty'));});},'AgentCapacity':function(_0x57e39e){var _0x53fdd3=this;return new Promise(function(_0x10f7db,_0x593f3e){if(_0x5899bb[_0xb887('0x43')]['hasOwnProperty'](_0x57e39e['id'])){for(var _0x359283 in _0x57e39e[_0xb887('0x4b')]){if(_0x57e39e[_0xb887('0x4b')][_0xb887('0x4c')](_0x359283)){if(_0x5899bb[_0xb887('0x43')][_0x57e39e['id']][_0xb887('0x4c')](_0x359283+_0xb887('0x4d'))){_0x5899bb[_0xb887('0x43')][_0x57e39e['id']][_0x359283+_0xb887('0x4d')]=parseInt(_0x57e39e['capacity'][_0x359283],0xa);}}}_0x5899bb[_0xb887('0x43')][_0x57e39e['id']]['updateRealtime']();return _0x10f7db({'code':0xc8,'message':_0x5899bb['agents'][_0x57e39e['id']]});}else{return _0x593f3e(_0x53fdd3['error'](0x1f4,_0xb887('0x4e')));}});},'Agents':function(_0x274fbb){return new Promise(function(_0xbd5373){var _0x1a07b8=_['values'](_0x5899bb[_0xb887('0x43')]);if(_0x274fbb&&_0x274fbb['id']){var _0x3564f5=_[_0xb887('0x4f')](_0x1a07b8,function(_0x2dd54c){return _0x2dd54c['id']===_0x274fbb['id'];});_0xbd5373(_0x3564f5);}else{_0xbd5373({'count':_0x1a07b8[_0xb887('0x22')],'rows':_0x1a07b8});}});},'ChatQueues':function(){return new Promise(function(_0x135ca9){var _0x36876c=[];for(var _0x4a1df0 in _0x5899bb[_0xb887('0x50')]){if(_0x5899bb[_0xb887('0x50')][_0xb887('0x4c')](_0x4a1df0)){var _0x4e15fb=_0x5899bb['chatQueues'][_0x4a1df0];var _0x17795f={'id':_0x4e15fb['id'],'available':_0x4e15fb['available'],'loggedIn':_0x4e15fb[_0xb887('0x51')],'name':_0x4e15fb[_0xb887('0x52')],'paused':_0x4e15fb[_0xb887('0x53')],'waiting':_0x4e15fb[_0xb887('0x54')]};_0x36876c[_0xb887('0x20')](_0x17795f);}}_0x135ca9({'count':_0x36876c[_0xb887('0x22')],'rows':_0x36876c});});},'MailQueues':function(){return new Promise(function(_0x41fbe0){var _0x2f3cd9=[];for(var _0x569cc1 in _0x5899bb['mailQueues']){if(_0x5899bb[_0xb887('0x55')][_0xb887('0x4c')](_0x569cc1)){var _0x45e256=_0x5899bb[_0xb887('0x55')][_0x569cc1];var _0x548dd7={'id':_0x45e256['id'],'available':_0x45e256[_0xb887('0x56')],'loggedIn':_0x45e256['loggedIn'],'name':_0x45e256[_0xb887('0x52')],'paused':_0x45e256['paused'],'waiting':_0x45e256[_0xb887('0x54')]};_0x2f3cd9[_0xb887('0x20')](_0x548dd7);}}_0x41fbe0({'count':_0x2f3cd9[_0xb887('0x22')],'rows':_0x2f3cd9});});},'OpenchannelQueues':function(){return new Promise(function(_0x4a92e9){var _0x52eeb0=[];for(var _0x12ec80 in _0x5899bb[_0xb887('0x57')]){if(_0x5899bb[_0xb887('0x57')]['hasOwnProperty'](_0x12ec80)){var _0x3adc6e=_0x5899bb[_0xb887('0x57')][_0x12ec80];var _0x5a7cdc={'id':_0x3adc6e['id'],'available':_0x3adc6e['available'],'loggedIn':_0x3adc6e[_0xb887('0x51')],'name':_0x3adc6e['name'],'paused':_0x3adc6e[_0xb887('0x53')],'waiting':_0x3adc6e[_0xb887('0x54')]};_0x52eeb0[_0xb887('0x20')](_0x5a7cdc);}}_0x4a92e9({'count':_0x52eeb0[_0xb887('0x22')],'rows':_0x52eeb0});});},'SmsQueues':function(){return new Promise(function(_0x1fe2a3){var _0x28298e=[];for(var _0x476c75 in _0x5899bb[_0xb887('0x58')]){if(_0x5899bb[_0xb887('0x58')]['hasOwnProperty'](_0x476c75)){var _0x58ca3b=_0x5899bb['smsQueues'][_0x476c75];var _0x364e36={'id':_0x58ca3b['id'],'available':_0x58ca3b[_0xb887('0x56')],'loggedIn':_0x58ca3b['loggedIn'],'name':_0x58ca3b[_0xb887('0x52')],'paused':_0x58ca3b[_0xb887('0x53')],'waiting':_0x58ca3b[_0xb887('0x54')]};_0x28298e[_0xb887('0x20')](_0x364e36);}}_0x1fe2a3({'count':_0x28298e['length'],'rows':_0x28298e});});},'FaxQueues':function(){return new Promise(function(_0xa30ed6){var _0x4e032d=[];for(var _0x14958d in _0x5899bb[_0xb887('0x59')]){if(_0x5899bb[_0xb887('0x59')][_0xb887('0x4c')](_0x14958d)){var _0x348f18=_0x5899bb['faxQueues'][_0x14958d];var _0x524a17={'id':_0x348f18['id'],'available':_0x348f18['available'],'loggedIn':_0x348f18['loggedIn'],'name':_0x348f18[_0xb887('0x52')],'paused':_0x348f18[_0xb887('0x53')],'waiting':_0x348f18['waiting']};_0x4e032d[_0xb887('0x20')](_0x524a17);}}_0xa30ed6({'count':_0x4e032d['length'],'rows':_0x4e032d});});},'WhatsappQueues':function(){return new Promise(function(_0x3b320c){var _0x4b44f0=[];for(var _0x47f32d in _0x5899bb[_0xb887('0x5a')]){if(_0x5899bb[_0xb887('0x5a')][_0xb887('0x4c')](_0x47f32d)){var _0x29ac0b=_0x5899bb[_0xb887('0x5a')][_0x47f32d];var _0x223186={'id':_0x29ac0b['id'],'available':_0x29ac0b[_0xb887('0x56')],'loggedIn':_0x29ac0b['loggedIn'],'name':_0x29ac0b['name'],'paused':_0x29ac0b['paused'],'waiting':_0x29ac0b[_0xb887('0x54')]};_0x4b44f0['push'](_0x223186);}}_0x3b320c({'count':_0x4b44f0[_0xb887('0x22')],'rows':_0x4b44f0});});},'ChatQueuesWaitingInteractions':function(){return new Promise(function(_0x1f8b02){var _0x559224=_[_0xb887('0x5b')](_0x5899bb[_0xb887('0x5c')]);_0x1f8b02({'count':_0x559224['length'],'rows':_0x559224});});},'MailQueuesWaitingInteractions':function(){return new Promise(function(_0x3b450e){var _0x2d6ef1=_[_0xb887('0x5b')](_0x5899bb[_0xb887('0x5d')]);_0x3b450e({'count':_0x2d6ef1[_0xb887('0x22')],'rows':_0x2d6ef1});});},'OpenchannelQueuesWaitingInteractions':function(){return new Promise(function(_0x49e29f){var _0x5f33bb=_[_0xb887('0x5b')](_0x5899bb[_0xb887('0x5e')]);_0x49e29f({'count':_0x5f33bb['length'],'rows':_0x5f33bb});});},'SmsQueuesWaitingInteractions':function(){return new Promise(function(_0x5839c1){var _0x3fc349=_['values'](_0x5899bb['smsQueuesWaitingInteractions']);_0x5839c1({'count':_0x3fc349[_0xb887('0x22')],'rows':_0x3fc349});});},'FaxQueuesWaitingInteractions':function(){return new Promise(function(_0x5cc14c){var _0x15f23c=_[_0xb887('0x5b')](_0x5899bb[_0xb887('0x5f')]);_0x5cc14c({'count':_0x15f23c[_0xb887('0x22')],'rows':_0x15f23c});});},'WhatsappQueuesWaitingInteractions':function(){return new Promise(function(_0x1e9f07){var _0x1f3a81=_[_0xb887('0x5b')](_0x5899bb[_0xb887('0x60')]);_0x1e9f07({'count':_0x1f3a81[_0xb887('0x22')],'rows':_0x1f3a81});});}};var _0x3a8c6b=jayson[_0xb887('0x61')](_0x34174a)[_0xb887('0x62')]();_0x3a8c6b['on'](_0xb887('0x38'),function(_0x1196db){logger[_0xb887('0x38')](JSON[_0xb887('0x3b')](_0x1196db));return _0x28bda6(_0x1196db);});_0x3a8c6b[_0xb887('0x12')](0x232c,_0xb887('0x63'),function(){console['log'](_0xb887('0x64'),0x232c);return _0xae7291(_0xb887('0x65')+0x232c);});});}; \ No newline at end of file diff --git a/server/services/routing/server/interval.js b/server/services/routing/server/interval.js index c75229c..ce645c0 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 _0xc55e=['map','some','[%s][INTERVAL\x20VALID]\x20%s\x20%s','join','\x20|\x20','when','stop','lodash','../../../utils/iftime','iftime','../../../config/logger','routing','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED'];(function(_0x5e7cf2,_0x3be5d5){var _0x2df0da=function(_0x44f74f){while(--_0x44f74f){_0x5e7cf2['push'](_0x5e7cf2['shift']());}};_0x2df0da(++_0x3be5d5);}(_0xc55e,0x160));var _0xec55=function(_0x54a7ce,_0x42d072){_0x54a7ce=_0x54a7ce-0x0;var _0x2c62f1=_0xc55e[_0x54a7ce];return _0x2c62f1;};'use strict';var _=require(_0xec55('0x0'));var iftime=require(_0xec55('0x1'))[_0xec55('0x2')];var logger=require(_0xec55('0x3'))(_0xec55('0x4'));exports['condition']=function(_0x545d18,_0xe341ff,_0x3b2f31){return function(_0x469e33){if(_0x3b2f31[_0xec55('0x5')]&&!_0x3b2f31[_0xec55('0x5')][_0x545d18]){logger[_0xec55('0x6')](_0xec55('0x7'),_0x545d18);return _0x469e33['stop']();}var _0x16aa33=_0xe341ff[_0xec55('0x8')](function(_0x554717){return iftime(_0x554717);});var _0x1e2d5a=_[_0xec55('0x9')](_0x16aa33);if(_0x1e2d5a){logger[_0xec55('0x6')](_0xec55('0xa'),_0x545d18,_0xe341ff[_0xec55('0xb')](_0xec55('0xc')),_0x1e2d5a);_0x469e33[_0xec55('0xd')](_0x1e2d5a);}else{logger[_0xec55('0x6')]('[%s][INTERVAL\x20NOT\x20VALID]\x20%s\x20%s',_0x545d18,_0xe341ff[_0xec55('0xb')]('\x20|\x20'));_0x469e33[_0xec55('0xe')]();}};}; \ No newline at end of file +var _0x8f4b=['../../../utils/iftime','condition','rules','info','stop','map','some','join','\x20|\x20','when'];(function(_0x4179a7,_0x2b4ae9){var _0x22a841=function(_0x1badb1){while(--_0x1badb1){_0x4179a7['push'](_0x4179a7['shift']());}};_0x22a841(++_0x2b4ae9);}(_0x8f4b,0x1a4));var _0xb8f4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8f4b[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var iftime=require(_0xb8f4('0x0'))['iftime'];var logger=require('../../../config/logger')('routing');exports[_0xb8f4('0x1')]=function(_0x3d540b,_0x1c8f0a,_0x457279){return function(_0x415ea9){if(_0x457279[_0xb8f4('0x2')]&&!_0x457279[_0xb8f4('0x2')][_0x3d540b]){logger[_0xb8f4('0x3')]('[%s][INTERVAL]\x20ROUTING\x20STOPPED',_0x3d540b);return _0x415ea9[_0xb8f4('0x4')]();}var _0x1f92f4=_0x1c8f0a[_0xb8f4('0x5')](function(_0x9991ed){return iftime(_0x9991ed);});var _0x308881=_[_0xb8f4('0x6')](_0x1f92f4);if(_0x308881){logger[_0xb8f4('0x3')]('[%s][INTERVAL\x20VALID]\x20%s\x20%s',_0x3d540b,_0x1c8f0a[_0xb8f4('0x7')](_0xb8f4('0x8')),_0x308881);_0x415ea9[_0xb8f4('0x9')](_0x308881);}else{logger[_0xb8f4('0x3')]('[%s][INTERVAL\x20NOT\x20VALID]\x20%s\x20%s',_0x3d540b,_0x1c8f0a['join'](_0xb8f4('0x8')));_0x415ea9[_0xb8f4('0x4')]();}};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index b47ad33..a74a0c7 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 _0x34b7=['acwtime','agentacw','acwTimeout','request','CreateVoiceAgentReport','uniqueid','destuniqueid','agentcalled','debug','[%s][agents][agentcalled]','agentcalledAt','now','called','connectedlinename','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','error','agentringnoanswer','isNil','[%s][agents][agentringnoanswer]','agentringnoanswerAt','timeout','holdtime','ringtime','talktime','push','queuecallerabandon','forIn','includes','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','reason','[%s][agents][queuecallerabandon]','agentconnect','agentconnectAt','connect','answered_elsewhere','answeredelsewheremembername','[%s][agents][agentcomplete]','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','diffTime','agentcompleteAt','complete','blindtransfer','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfereruniqueid','transfer','transfertype','blind','transferexten','extension','attendedtransfer','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','ATTENDED','origtransfererexten','transferuniqueid','transfereeuniqueid','agententerreason','secondtransfererexten','transfertargetuniqueid','clone','calleridname','[%s][agents][hangup]','cause','rejected','indexOf','agent','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','./utils','info','format','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','queue','membername','interface','calleridnum','connectedlinenum','lastevent','getVoiceQueueByName','type','agentcomplete','acw'];(function(_0x13ad99,_0x41ffa1){var _0x3884c4=function(_0x54ecdc){while(--_0x54ecdc){_0x13ad99['push'](_0x13ad99['shift']());}};_0x3884c4(++_0x41ffa1);}(_0x34b7,0x196));var _0x734b=function(_0x30b710,_0x4477d1){_0x30b710=_0x30b710-0x0;var _0x205edf=_0x34b7[_0x30b710];return _0x205edf;};'use strict';var _=require('lodash');var util=require('util');var utils=require(_0x734b('0x0'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x1aedd0,_0x6e4318){utils[_0x734b('0x1')](util[_0x734b('0x2')](_0x734b('0x3'),_0x1aedd0['uniqueid'],_0x1aedd0['channel'],_0x1aedd0[_0x734b('0x4')],_0x1aedd0[_0x734b('0x5')],_0x1aedd0[_0x734b('0x6')],_0x1aedd0[_0x734b('0x7')],_0x1aedd0[_0x734b('0x8')],_0x1aedd0[_0x734b('0x9')]));if(_0x1aedd0['queue']){utils[_0x734b('0xa')](_0x1aedd0[_0x734b('0x4')])['then'](function(_0x53f163){if(_0x53f163){_0x1aedd0['type']=_0x53f163[_0x734b('0xb')];_0x1aedd0['agentacw']=_0x1aedd0[_0x734b('0xc')]?_0x53f163[_0x734b('0xd')]:![];_0x1aedd0[_0x734b('0xe')]=_0x1aedd0[_0x734b('0xf')]?_0x53f163[_0x734b('0x10')]:0x0;}utils[_0x734b('0x11')](_0x734b('0x12'),_0x1aedd0);});}else{utils[_0x734b('0x11')](_0x734b('0x12'),_0x1aedd0);}if(_0x6e4318){delete transfers[_0x1aedd0[_0x734b('0x13')]];}else{delete agents[_0x1aedd0[_0x734b('0x14')]];}}exports[_0x734b('0x15')]=function(_0x145ec3){try{utils[_0x734b('0x16')](util['format'](_0x734b('0x17'),_0x145ec3[_0x734b('0x13')]),_0x145ec3);agents[_0x145ec3[_0x734b('0x14')]]=_0x145ec3;agents[_0x145ec3[_0x734b('0x14')]][_0x734b('0x18')]=utils[_0x734b('0x19')]();agents[_0x145ec3[_0x734b('0x14')]][_0x734b('0x9')]=_0x734b('0x1a');agents[_0x145ec3[_0x734b('0x14')]][_0x734b('0x8')]=null;agents[_0x145ec3['destuniqueid']][_0x734b('0x1b')]=null;utils[_0x734b('0x1')](util[_0x734b('0x2')](_0x734b('0x1c'),_0x145ec3['uniqueid'],agents[_0x145ec3['destuniqueid']][_0x734b('0x5')],_0x145ec3[_0x734b('0x14')]));}catch(_0x1e6ed9){utils[_0x734b('0x1d')](util[_0x734b('0x2')](_0x734b('0x17'),_0x145ec3[_0x734b('0x13')]),_0x1e6ed9);}};exports[_0x734b('0x1e')]=function(_0x67eed){try{if(!_[_0x734b('0x1f')](agents[_0x67eed[_0x734b('0x14')]])){utils[_0x734b('0x16')](util[_0x734b('0x2')](_0x734b('0x20'),_0x67eed['uniqueid']),_0x67eed);utils[_0x734b('0x1')](util[_0x734b('0x2')]('[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout',_0x67eed[_0x734b('0x13')],agents[_0x67eed[_0x734b('0x14')]][_0x734b('0x5')],_0x67eed[_0x734b('0x14')]));agents[_0x67eed[_0x734b('0x14')]][_0x734b('0x1e')]=!![];agents[_0x67eed[_0x734b('0x14')]][_0x734b('0x21')]=utils[_0x734b('0x19')]();agents[_0x67eed[_0x734b('0x14')]][_0x734b('0x9')]=_0x734b('0x22');agents[_0x67eed[_0x734b('0x14')]]['reason']='timeout';agents[_0x67eed[_0x734b('0x14')]][_0x734b('0x23')]=_0x67eed['ringtime']?parseInt(_0x67eed[_0x734b('0x24')])/0x3e8:0x0;agents[_0x67eed[_0x734b('0x14')]][_0x734b('0x25')]=0x0;unanswered[_0x734b('0x26')](_0x67eed[_0x734b('0x14')]);}}catch(_0x1b8295){utils[_0x734b('0x1d')](util['format'](_0x734b('0x20'),_0x67eed[_0x734b('0x13')]),_0x1b8295);}};exports[_0x734b('0x27')]=function(_0x241c89){try{_[_0x734b('0x28')](agents,function(_0x427c36,_0x1fed72){if(_0x427c36[_0x734b('0x13')]==_0x241c89[_0x734b('0x13')]&&!_[_0x734b('0x29')](unanswered,_0x427c36['destuniqueid'])){utils[_0x734b('0x16')](util[_0x734b('0x2')]('[%s][agents][queuecallerabandon]',_0x241c89[_0x734b('0x13')]),_0x241c89);utils[_0x734b('0x1')](util[_0x734b('0x2')](_0x734b('0x2a'),_0x241c89[_0x734b('0x13')],_0x427c36[_0x734b('0x5')],_0x427c36[_0x734b('0x14')]));_0x427c36[_0x734b('0x1e')]=!![];_0x427c36[_0x734b('0x21')]=utils[_0x734b('0x19')]();_0x427c36[_0x734b('0x9')]=_0x734b('0x2b');_0x427c36[_0x734b('0x2c')]=_0x734b('0x2b');_0x427c36[_0x734b('0x23')]=_0x241c89['holdtime'];_0x427c36[_0x734b('0x25')]=0x0;writeDB(_0x427c36);}});}catch(_0x5e2444){utils[_0x734b('0x1d')](util[_0x734b('0x2')](_0x734b('0x2d'),_0x241c89[_0x734b('0x13')]),_0x5e2444);}};exports[_0x734b('0x2e')]=function(_0x16ab66){try{if(agents[_0x16ab66['destuniqueid']]){utils['debug'](util[_0x734b('0x2')]('[%s][agents][agentconnect]',_0x16ab66[_0x734b('0x13')]),_0x16ab66);utils['info'](util[_0x734b('0x2')]('[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect',_0x16ab66[_0x734b('0x13')],agents[_0x16ab66['destuniqueid']][_0x734b('0x5')],_0x16ab66[_0x734b('0x14')]));agents[_0x16ab66[_0x734b('0x14')]][_0x734b('0x2f')]=utils[_0x734b('0x19')]();agents[_0x16ab66[_0x734b('0x14')]][_0x734b('0x8')]=_0x16ab66['connectedlinenum'];agents[_0x16ab66[_0x734b('0x14')]][_0x734b('0x1b')]=_0x16ab66['connectedlinename'];agents[_0x16ab66[_0x734b('0x14')]][_0x734b('0x23')]=_0x16ab66[_0x734b('0x24')];agents[_0x16ab66[_0x734b('0x14')]]['lastevent']=_0x734b('0x30');_[_0x734b('0x28')](agents,function(_0x4efb1f,_0x40674c){if(_0x4efb1f[_0x734b('0x14')]!=_0x16ab66['destuniqueid']&&_0x4efb1f[_0x734b('0x13')]==_0x16ab66[_0x734b('0x13')]){_0x4efb1f[_0x734b('0x25')]=0x0;_0x4efb1f[_0x734b('0x23')]=_0x16ab66['ringtime'];_0x4efb1f['agentringnoanswer']=!![];_0x4efb1f[_0x734b('0x21')]=utils['now']();_0x4efb1f['lastevent']=_0x734b('0x31');_0x4efb1f['reason']=_0x734b('0x31');_0x4efb1f['answeredelsewheredestinationuniqueid']=_0x16ab66[_0x734b('0x14')];_0x4efb1f[_0x734b('0x32')]=_0x16ab66[_0x734b('0x5')];writeDB(_0x4efb1f);}});}}catch(_0x4c3fdc){utils['error'](util[_0x734b('0x2')]('[%s][agents][agentconnect]',_0x16ab66['uniqueid']),_0x4c3fdc);}};exports[_0x734b('0xc')]=function(_0x159db9){try{if(!_['isNil'](agents[_0x159db9[_0x734b('0x14')]])){utils['debug'](util[_0x734b('0x2')](_0x734b('0x33'),_0x159db9[_0x734b('0x13')]),_0x159db9);utils['info'](util[_0x734b('0x2')](_0x734b('0x34'),_0x159db9[_0x734b('0x13')],agents[_0x159db9[_0x734b('0x14')]]['membername'],_0x159db9['destuniqueid']));agents[_0x159db9['destuniqueid']][_0x734b('0xc')]=!![];agents[_0x159db9['destuniqueid']]['agentcompleteAt']=utils[_0x734b('0x19')]();agents[_0x159db9['destuniqueid']][_0x734b('0x25')]=utils[_0x734b('0x35')](agents[_0x159db9[_0x734b('0x14')]][_0x734b('0x36')],agents[_0x159db9['destuniqueid']][_0x734b('0x2f')]);agents[_0x159db9['destuniqueid']][_0x734b('0x2c')]=_0x159db9[_0x734b('0x2c')];agents[_0x159db9[_0x734b('0x14')]]['lastevent']=_0x734b('0x37');writeDB(agents[_0x159db9['destuniqueid']]);}}catch(_0x357ae4){utils[_0x734b('0x1d')](util['format'](_0x734b('0x33'),_0x159db9[_0x734b('0x13')]),_0x357ae4);}};exports[_0x734b('0x38')]=function(_0x38125a){try{if(!_[_0x734b('0x1f')](agents[_0x38125a['transfereruniqueid']])){utils[_0x734b('0x16')](util['format'](_0x734b('0x39'),_0x38125a['uniqueid']),_0x38125a);utils[_0x734b('0x1')](util[_0x734b('0x2')](_0x734b('0x3a'),_0x38125a[_0x734b('0x13')],agents[_0x38125a[_0x734b('0x3b')]]['membername'],agents[_0x38125a['transfereruniqueid']]['uniqueid']));agents[_0x38125a[_0x734b('0x3b')]][_0x734b('0x3c')]=!![];agents[_0x38125a['transfereruniqueid']][_0x734b('0x3d')]=_0x734b('0x3e');agents[_0x38125a['transfereruniqueid']][_0x734b('0x3f')]=_0x38125a[_0x734b('0x40')];agents[_0x38125a[_0x734b('0x3b')]]['transferuniqueid']=agents[_0x38125a[_0x734b('0x3b')]][_0x734b('0x13')];}}catch(_0x423b22){utils[_0x734b('0x1d')](util['format'](_0x734b('0x39'),_0x38125a[_0x734b('0x13')]),_0x423b22);}};exports[_0x734b('0x41')]=function(_0x432a96){try{utils['debug'](util[_0x734b('0x2')]('[%s][agents][attendedtransfer]',_0x432a96[_0x734b('0x42')]),_0x432a96);if(_0x432a96[_0x734b('0x42')]==_0x432a96[_0x734b('0x43')]){if(!_[_0x734b('0x1f')](agents[_0x432a96['secondtransfereruniqueid']])){utils[_0x734b('0x1')](util[_0x734b('0x2')]('[%s][agents][attendedtransfer]\x20agent:%s',_0x432a96['origtransfereruniqueid'],agents[_0x432a96[_0x734b('0x44')]]['membername']));agents[_0x432a96[_0x734b('0x44')]][_0x734b('0x3c')]=!![];agents[_0x432a96[_0x734b('0x44')]]['transfertype']=_0x734b('0x45');agents[_0x432a96['secondtransfereruniqueid']][_0x734b('0x3f')]=_0x432a96[_0x734b('0x46')];agents[_0x432a96[_0x734b('0x44')]][_0x734b('0x47')]=_0x432a96['origtransfereruniqueid'];}if(_0x432a96[_0x734b('0x48')]&&agents[_0x432a96['transfereeuniqueid']]){agents[_0x432a96[_0x734b('0x48')]][_0x734b('0x49')]=0x1;transfers[_0x432a96[_0x734b('0x48')]]=_['clone'](agents[_0x432a96[_0x734b('0x48')]]);transfers[_0x432a96['transfereeuniqueid']][_0x734b('0x7')]=agents[_0x432a96[_0x734b('0x44')]][_0x734b('0x7')];transfers[_0x432a96[_0x734b('0x48')]]['calleridname']=agents[_0x432a96[_0x734b('0x44')]]['calleridname'];transfers[_0x432a96[_0x734b('0x48')]][_0x734b('0x18')]=utils[_0x734b('0x19')]();transfers[_0x432a96['transfereeuniqueid']][_0x734b('0x2f')]=utils[_0x734b('0x19')]();transfers[_0x432a96[_0x734b('0x48')]][_0x734b('0x23')]=0x0;transfers[_0x432a96[_0x734b('0x48')]][_0x734b('0x49')]=0x2;}}else if(_0x432a96[_0x734b('0x44')]==_0x432a96['secondtransfererlinkedid']){if(!_[_0x734b('0x1f')](agents[_0x432a96[_0x734b('0x42')]])){utils[_0x734b('0x1')](util['format']('[%s][agents][attendedtransfer]\x20agent:%s',_0x432a96[_0x734b('0x42')],agents[_0x432a96[_0x734b('0x42')]][_0x734b('0x5')]));agents[_0x432a96[_0x734b('0x42')]]['transfer']=!![];agents[_0x432a96['origtransfereruniqueid']]['transfertype']=_0x734b('0x45');agents[_0x432a96[_0x734b('0x42')]][_0x734b('0x3f')]=_0x432a96[_0x734b('0x4a')];agents[_0x432a96[_0x734b('0x42')]][_0x734b('0x47')]=_0x432a96[_0x734b('0x44')];}if(_0x432a96[_0x734b('0x4b')]&&agents[_0x432a96[_0x734b('0x4b')]]){agents[_0x432a96[_0x734b('0x4b')]][_0x734b('0x49')]=0x1;transfers[_0x432a96[_0x734b('0x4b')]]=_[_0x734b('0x4c')](agents[_0x432a96[_0x734b('0x4b')]]);transfers[_0x432a96[_0x734b('0x4b')]][_0x734b('0x7')]=agents[_0x432a96[_0x734b('0x42')]][_0x734b('0x7')];transfers[_0x432a96[_0x734b('0x4b')]][_0x734b('0x4d')]=agents[_0x432a96[_0x734b('0x42')]]['calleridname'];transfers[_0x432a96[_0x734b('0x4b')]][_0x734b('0x18')]=utils[_0x734b('0x19')]();transfers[_0x432a96[_0x734b('0x4b')]][_0x734b('0x2f')]=utils['now']();transfers[_0x432a96[_0x734b('0x4b')]][_0x734b('0x23')]=0x0;transfers[_0x432a96[_0x734b('0x4b')]][_0x734b('0x49')]=0x2;}}}catch(_0x3c7d93){utils[_0x734b('0x1d')](util['format']('[%s][agents][attendedtransfer]',_0x432a96['origtransfereruniqueid']),_0x3c7d93);}};exports['hangup']=function(_0x4d95c7){try{utils[_0x734b('0x16')](util[_0x734b('0x2')](_0x734b('0x4e'),_0x4d95c7[_0x734b('0x13')]),_0x4d95c7);if(agents[_0x4d95c7['uniqueid']]&&agents[_0x4d95c7['uniqueid']][_0x734b('0x2c')]===_0x734b('0x22')){if(_0x4d95c7[_0x734b('0x4f')]==='21'){agents[_0x4d95c7[_0x734b('0x13')]]['reason']=_0x734b('0x50');agents[_0x4d95c7[_0x734b('0x13')]][_0x734b('0x9')]=_0x734b('0x50');}utils['info'](util[_0x734b('0x2')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x4d95c7[_0x734b('0x13')],agents[_0x4d95c7[_0x734b('0x13')]][_0x734b('0x5')],agents[_0x4d95c7[_0x734b('0x13')]][_0x734b('0x2c')],agents[_0x4d95c7['uniqueid']][_0x734b('0x9')]));writeDB(agents[_0x4d95c7[_0x734b('0x13')]]);var _0x3c40b5=unanswered[_0x734b('0x51')](_0x4d95c7[_0x734b('0x13')]);if(_0x3c40b5>-0x1){unanswered['splice'](_0x3c40b5,0x1);}}if(transfers[_0x4d95c7[_0x734b('0x13')]]){transfers[_0x4d95c7[_0x734b('0x13')]][_0x734b('0xc')]=!![];transfers[_0x4d95c7[_0x734b('0x13')]]['agentcompleteAt']=utils[_0x734b('0x19')]();transfers[_0x4d95c7[_0x734b('0x13')]][_0x734b('0x25')]=utils[_0x734b('0x35')](transfers[_0x4d95c7[_0x734b('0x13')]]['agentcompleteAt'],transfers[_0x4d95c7[_0x734b('0x13')]]['agentconnectAt']);transfers[_0x4d95c7[_0x734b('0x13')]][_0x734b('0x2c')]=_0x734b('0x52');transfers[_0x4d95c7[_0x734b('0x13')]][_0x734b('0x9')]=_0x734b('0x37');utils['info'](util['format']('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x4d95c7[_0x734b('0x13')],transfers[_0x4d95c7['uniqueid']][_0x734b('0x5')],transfers[_0x4d95c7[_0x734b('0x13')]]['reason'],transfers[_0x4d95c7[_0x734b('0x13')]][_0x734b('0x9')]));writeDB(transfers[_0x4d95c7[_0x734b('0x13')]],!![]);}if(agents[_0x4d95c7[_0x734b('0x13')]]&&agents[_0x4d95c7[_0x734b('0x13')]][_0x734b('0x2f')]){agents[_0x4d95c7[_0x734b('0x13')]][_0x734b('0xc')]=!![];agents[_0x4d95c7[_0x734b('0x13')]][_0x734b('0x36')]=utils['now']();agents[_0x4d95c7[_0x734b('0x13')]][_0x734b('0x25')]=utils[_0x734b('0x35')](agents[_0x4d95c7['uniqueid']][_0x734b('0x36')],agents[_0x4d95c7[_0x734b('0x13')]][_0x734b('0x2f')]);agents[_0x4d95c7[_0x734b('0x13')]][_0x734b('0x2c')]=agents[_0x4d95c7[_0x734b('0x13')]][_0x734b('0x3c')]?_0x734b('0x3c'):'agent';agents[_0x4d95c7[_0x734b('0x13')]][_0x734b('0x9')]=_0x734b('0x37');utils[_0x734b('0x1')](util[_0x734b('0x2')](_0x734b('0x53'),_0x4d95c7[_0x734b('0x13')],agents[_0x4d95c7[_0x734b('0x13')]][_0x734b('0x5')],agents[_0x4d95c7['uniqueid']][_0x734b('0x2c')],agents[_0x4d95c7[_0x734b('0x13')]][_0x734b('0x9')]));writeDB(agents[_0x4d95c7['uniqueid']]);}}catch(_0x31e1ec){utils[_0x734b('0x1d')](util[_0x734b('0x2')](_0x734b('0x4e'),_0x4d95c7[_0x734b('0x13')]),_0x31e1ec);}}; \ No newline at end of file +var _0x4e81=['[%s][agents][agentcomplete]','blindtransfer','transfereruniqueid','[%s][agents][blindtransfer]','transfertype','blind','transferuniqueid','attendedtransfer','[%s][agents][attendedtransfer]','origtransfereruniqueid','secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','ATTENDED','transferexten','transfereeuniqueid','agententerreason','clone','calleridnum','calleridname','secondtransfererlinkedid','transfer','transfertargetuniqueid','[%s][agents][hangup]','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','splice','agentcompleteAt','agent','lodash','util','./utils','format','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','queue','membername','connectedlinenum','lastevent','getVoiceQueueByName','then','type','agentcomplete','acw','acwtime','agentacw','acwTimeout','request','CreateVoiceAgentReport','agentcalled','debug','[%s][agents][agentcalled]','destuniqueid','agentcalledAt','now','connectedlinename','info','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','error','agentringnoanswer','[%s][agents][agentringnoanswer]','agentringnoanswerAt','timeout','reason','holdtime','ringtime','push','queuecallerabandon','forIn','includes','[%s][agents][queuecallerabandon]','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','talktime','[%s][agents][agentconnect]','agentconnectAt','connect','answeredelsewheremembername','isNil','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','diffTime','complete'];(function(_0x2a5ff0,_0x43476f){var _0x28166e=function(_0x20dc8a){while(--_0x20dc8a){_0x2a5ff0['push'](_0x2a5ff0['shift']());}};_0x28166e(++_0x43476f);}(_0x4e81,0x1bc));var _0x14e8=function(_0x53f04f,_0x419aa8){_0x53f04f=_0x53f04f-0x0;var _0x16a824=_0x4e81[_0x53f04f];return _0x16a824;};'use strict';var _=require(_0x14e8('0x0'));var util=require(_0x14e8('0x1'));var utils=require(_0x14e8('0x2'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x533fb3,_0x4b9800){utils['info'](util[_0x14e8('0x3')](_0x14e8('0x4'),_0x533fb3[_0x14e8('0x5')],_0x533fb3[_0x14e8('0x6')],_0x533fb3[_0x14e8('0x7')],_0x533fb3[_0x14e8('0x8')],_0x533fb3['interface'],_0x533fb3['calleridnum'],_0x533fb3[_0x14e8('0x9')],_0x533fb3[_0x14e8('0xa')]));if(_0x533fb3[_0x14e8('0x7')]){utils[_0x14e8('0xb')](_0x533fb3[_0x14e8('0x7')])[_0x14e8('0xc')](function(_0x39127a){if(_0x39127a){_0x533fb3[_0x14e8('0xd')]=_0x39127a[_0x14e8('0xd')];_0x533fb3['agentacw']=_0x533fb3[_0x14e8('0xe')]?_0x39127a[_0x14e8('0xf')]:![];_0x533fb3[_0x14e8('0x10')]=_0x533fb3[_0x14e8('0x11')]?_0x39127a[_0x14e8('0x12')]:0x0;}utils[_0x14e8('0x13')](_0x14e8('0x14'),_0x533fb3);});}else{utils[_0x14e8('0x13')]('CreateVoiceAgentReport',_0x533fb3);}if(_0x4b9800){delete transfers[_0x533fb3[_0x14e8('0x5')]];}else{delete agents[_0x533fb3['destuniqueid']];}}exports[_0x14e8('0x15')]=function(_0x341d40){try{utils[_0x14e8('0x16')](util['format'](_0x14e8('0x17'),_0x341d40['uniqueid']),_0x341d40);agents[_0x341d40[_0x14e8('0x18')]]=_0x341d40;agents[_0x341d40['destuniqueid']][_0x14e8('0x19')]=utils[_0x14e8('0x1a')]();agents[_0x341d40[_0x14e8('0x18')]][_0x14e8('0xa')]='called';agents[_0x341d40[_0x14e8('0x18')]][_0x14e8('0x9')]=null;agents[_0x341d40[_0x14e8('0x18')]][_0x14e8('0x1b')]=null;utils[_0x14e8('0x1c')](util[_0x14e8('0x3')](_0x14e8('0x1d'),_0x341d40[_0x14e8('0x5')],agents[_0x341d40['destuniqueid']][_0x14e8('0x8')],_0x341d40[_0x14e8('0x18')]));}catch(_0x151f16){utils[_0x14e8('0x1e')](util[_0x14e8('0x3')]('[%s][agents][agentcalled]',_0x341d40[_0x14e8('0x5')]),_0x151f16);}};exports[_0x14e8('0x1f')]=function(_0x2abfec){try{if(!_['isNil'](agents[_0x2abfec[_0x14e8('0x18')]])){utils['debug'](util[_0x14e8('0x3')](_0x14e8('0x20'),_0x2abfec[_0x14e8('0x5')]),_0x2abfec);utils[_0x14e8('0x1c')](util[_0x14e8('0x3')]('[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout',_0x2abfec[_0x14e8('0x5')],agents[_0x2abfec['destuniqueid']][_0x14e8('0x8')],_0x2abfec[_0x14e8('0x18')]));agents[_0x2abfec['destuniqueid']]['agentringnoanswer']=!![];agents[_0x2abfec['destuniqueid']][_0x14e8('0x21')]=utils[_0x14e8('0x1a')]();agents[_0x2abfec[_0x14e8('0x18')]][_0x14e8('0xa')]=_0x14e8('0x22');agents[_0x2abfec['destuniqueid']][_0x14e8('0x23')]=_0x14e8('0x22');agents[_0x2abfec[_0x14e8('0x18')]][_0x14e8('0x24')]=_0x2abfec[_0x14e8('0x25')]?parseInt(_0x2abfec[_0x14e8('0x25')])/0x3e8:0x0;agents[_0x2abfec[_0x14e8('0x18')]]['talktime']=0x0;unanswered[_0x14e8('0x26')](_0x2abfec[_0x14e8('0x18')]);}}catch(_0x393ab0){utils['error'](util['format']('[%s][agents][agentringnoanswer]',_0x2abfec[_0x14e8('0x5')]),_0x393ab0);}};exports[_0x14e8('0x27')]=function(_0x567385){try{_[_0x14e8('0x28')](agents,function(_0x1d71ca,_0x176e8f){if(_0x1d71ca[_0x14e8('0x5')]==_0x567385['uniqueid']&&!_[_0x14e8('0x29')](unanswered,_0x1d71ca[_0x14e8('0x18')])){utils[_0x14e8('0x16')](util[_0x14e8('0x3')](_0x14e8('0x2a'),_0x567385['uniqueid']),_0x567385);utils[_0x14e8('0x1c')](util[_0x14e8('0x3')](_0x14e8('0x2b'),_0x567385[_0x14e8('0x5')],_0x1d71ca['membername'],_0x1d71ca[_0x14e8('0x18')]));_0x1d71ca['agentringnoanswer']=!![];_0x1d71ca[_0x14e8('0x21')]=utils[_0x14e8('0x1a')]();_0x1d71ca[_0x14e8('0xa')]=_0x14e8('0x2c');_0x1d71ca[_0x14e8('0x23')]=_0x14e8('0x2c');_0x1d71ca[_0x14e8('0x24')]=_0x567385[_0x14e8('0x24')];_0x1d71ca[_0x14e8('0x2d')]=0x0;writeDB(_0x1d71ca);}});}catch(_0x2acf6a){utils[_0x14e8('0x1e')](util[_0x14e8('0x3')]('[%s][agents][queuecallerabandon]',_0x567385['uniqueid']),_0x2acf6a);}};exports['agentconnect']=function(_0x16ff09){try{if(agents[_0x16ff09['destuniqueid']]){utils[_0x14e8('0x16')](util['format'](_0x14e8('0x2e'),_0x16ff09[_0x14e8('0x5')]),_0x16ff09);utils[_0x14e8('0x1c')](util[_0x14e8('0x3')]('[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect',_0x16ff09[_0x14e8('0x5')],agents[_0x16ff09['destuniqueid']][_0x14e8('0x8')],_0x16ff09[_0x14e8('0x18')]));agents[_0x16ff09[_0x14e8('0x18')]][_0x14e8('0x2f')]=utils[_0x14e8('0x1a')]();agents[_0x16ff09[_0x14e8('0x18')]]['connectedlinenum']=_0x16ff09[_0x14e8('0x9')];agents[_0x16ff09['destuniqueid']][_0x14e8('0x1b')]=_0x16ff09[_0x14e8('0x1b')];agents[_0x16ff09[_0x14e8('0x18')]]['holdtime']=_0x16ff09[_0x14e8('0x25')];agents[_0x16ff09[_0x14e8('0x18')]]['lastevent']=_0x14e8('0x30');_[_0x14e8('0x28')](agents,function(_0x1f429a,_0x3a7aa7){if(_0x1f429a[_0x14e8('0x18')]!=_0x16ff09[_0x14e8('0x18')]&&_0x1f429a[_0x14e8('0x5')]==_0x16ff09[_0x14e8('0x5')]){_0x1f429a[_0x14e8('0x2d')]=0x0;_0x1f429a[_0x14e8('0x24')]=_0x16ff09[_0x14e8('0x25')];_0x1f429a[_0x14e8('0x1f')]=!![];_0x1f429a[_0x14e8('0x21')]=utils[_0x14e8('0x1a')]();_0x1f429a[_0x14e8('0xa')]='answered_elsewhere';_0x1f429a[_0x14e8('0x23')]='answered_elsewhere';_0x1f429a['answeredelsewheredestinationuniqueid']=_0x16ff09['destuniqueid'];_0x1f429a[_0x14e8('0x31')]=_0x16ff09['membername'];writeDB(_0x1f429a);}});}}catch(_0x46a3c4){utils[_0x14e8('0x1e')](util[_0x14e8('0x3')](_0x14e8('0x2e'),_0x16ff09[_0x14e8('0x5')]),_0x46a3c4);}};exports[_0x14e8('0xe')]=function(_0x125af5){try{if(!_[_0x14e8('0x32')](agents[_0x125af5[_0x14e8('0x18')]])){utils[_0x14e8('0x16')](util[_0x14e8('0x3')]('[%s][agents][agentcomplete]',_0x125af5[_0x14e8('0x5')]),_0x125af5);utils[_0x14e8('0x1c')](util[_0x14e8('0x3')](_0x14e8('0x33'),_0x125af5['uniqueid'],agents[_0x125af5[_0x14e8('0x18')]][_0x14e8('0x8')],_0x125af5['destuniqueid']));agents[_0x125af5['destuniqueid']][_0x14e8('0xe')]=!![];agents[_0x125af5['destuniqueid']]['agentcompleteAt']=utils[_0x14e8('0x1a')]();agents[_0x125af5[_0x14e8('0x18')]]['talktime']=utils[_0x14e8('0x34')](agents[_0x125af5[_0x14e8('0x18')]]['agentcompleteAt'],agents[_0x125af5[_0x14e8('0x18')]][_0x14e8('0x2f')]);agents[_0x125af5[_0x14e8('0x18')]][_0x14e8('0x23')]=_0x125af5[_0x14e8('0x23')];agents[_0x125af5[_0x14e8('0x18')]][_0x14e8('0xa')]=_0x14e8('0x35');writeDB(agents[_0x125af5[_0x14e8('0x18')]]);}}catch(_0x42180d){utils[_0x14e8('0x1e')](util[_0x14e8('0x3')](_0x14e8('0x36'),_0x125af5[_0x14e8('0x5')]),_0x42180d);}};exports[_0x14e8('0x37')]=function(_0x1f50bc){try{if(!_['isNil'](agents[_0x1f50bc[_0x14e8('0x38')]])){utils['debug'](util[_0x14e8('0x3')](_0x14e8('0x39'),_0x1f50bc[_0x14e8('0x5')]),_0x1f50bc);utils[_0x14e8('0x1c')](util['format']('[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s',_0x1f50bc['uniqueid'],agents[_0x1f50bc[_0x14e8('0x38')]]['membername'],agents[_0x1f50bc['transfereruniqueid']][_0x14e8('0x5')]));agents[_0x1f50bc[_0x14e8('0x38')]]['transfer']=!![];agents[_0x1f50bc[_0x14e8('0x38')]][_0x14e8('0x3a')]=_0x14e8('0x3b');agents[_0x1f50bc[_0x14e8('0x38')]]['transferexten']=_0x1f50bc['extension'];agents[_0x1f50bc[_0x14e8('0x38')]][_0x14e8('0x3c')]=agents[_0x1f50bc[_0x14e8('0x38')]][_0x14e8('0x5')];}}catch(_0x41b5ab){utils[_0x14e8('0x1e')](util['format'](_0x14e8('0x39'),_0x1f50bc[_0x14e8('0x5')]),_0x41b5ab);}};exports[_0x14e8('0x3d')]=function(_0xd5adc1){try{utils['debug'](util[_0x14e8('0x3')](_0x14e8('0x3e'),_0xd5adc1[_0x14e8('0x3f')]),_0xd5adc1);if(_0xd5adc1[_0x14e8('0x3f')]==_0xd5adc1['origtransfererlinkedid']){if(!_[_0x14e8('0x32')](agents[_0xd5adc1[_0x14e8('0x40')]])){utils[_0x14e8('0x1c')](util[_0x14e8('0x3')](_0x14e8('0x41'),_0xd5adc1[_0x14e8('0x3f')],agents[_0xd5adc1[_0x14e8('0x40')]][_0x14e8('0x8')]));agents[_0xd5adc1['secondtransfereruniqueid']]['transfer']=!![];agents[_0xd5adc1[_0x14e8('0x40')]][_0x14e8('0x3a')]=_0x14e8('0x42');agents[_0xd5adc1[_0x14e8('0x40')]][_0x14e8('0x43')]=_0xd5adc1['origtransfererexten'];agents[_0xd5adc1['secondtransfereruniqueid']]['transferuniqueid']=_0xd5adc1[_0x14e8('0x3f')];}if(_0xd5adc1[_0x14e8('0x44')]&&agents[_0xd5adc1[_0x14e8('0x44')]]){agents[_0xd5adc1['transfereeuniqueid']][_0x14e8('0x45')]=0x1;transfers[_0xd5adc1[_0x14e8('0x44')]]=_[_0x14e8('0x46')](agents[_0xd5adc1['transfereeuniqueid']]);transfers[_0xd5adc1[_0x14e8('0x44')]][_0x14e8('0x47')]=agents[_0xd5adc1[_0x14e8('0x40')]][_0x14e8('0x47')];transfers[_0xd5adc1[_0x14e8('0x44')]][_0x14e8('0x48')]=agents[_0xd5adc1[_0x14e8('0x40')]][_0x14e8('0x48')];transfers[_0xd5adc1[_0x14e8('0x44')]][_0x14e8('0x19')]=utils[_0x14e8('0x1a')]();transfers[_0xd5adc1['transfereeuniqueid']][_0x14e8('0x2f')]=utils[_0x14e8('0x1a')]();transfers[_0xd5adc1[_0x14e8('0x44')]][_0x14e8('0x24')]=0x0;transfers[_0xd5adc1[_0x14e8('0x44')]][_0x14e8('0x45')]=0x2;}}else if(_0xd5adc1[_0x14e8('0x40')]==_0xd5adc1[_0x14e8('0x49')]){if(!_[_0x14e8('0x32')](agents[_0xd5adc1[_0x14e8('0x3f')]])){utils[_0x14e8('0x1c')](util[_0x14e8('0x3')]('[%s][agents][attendedtransfer]\x20agent:%s',_0xd5adc1[_0x14e8('0x3f')],agents[_0xd5adc1[_0x14e8('0x3f')]]['membername']));agents[_0xd5adc1[_0x14e8('0x3f')]][_0x14e8('0x4a')]=!![];agents[_0xd5adc1[_0x14e8('0x3f')]][_0x14e8('0x3a')]=_0x14e8('0x42');agents[_0xd5adc1[_0x14e8('0x3f')]][_0x14e8('0x43')]=_0xd5adc1['secondtransfererexten'];agents[_0xd5adc1['origtransfereruniqueid']]['transferuniqueid']=_0xd5adc1[_0x14e8('0x40')];}if(_0xd5adc1[_0x14e8('0x4b')]&&agents[_0xd5adc1[_0x14e8('0x4b')]]){agents[_0xd5adc1[_0x14e8('0x4b')]][_0x14e8('0x45')]=0x1;transfers[_0xd5adc1[_0x14e8('0x4b')]]=_[_0x14e8('0x46')](agents[_0xd5adc1['transfertargetuniqueid']]);transfers[_0xd5adc1[_0x14e8('0x4b')]][_0x14e8('0x47')]=agents[_0xd5adc1['origtransfereruniqueid']][_0x14e8('0x47')];transfers[_0xd5adc1[_0x14e8('0x4b')]]['calleridname']=agents[_0xd5adc1['origtransfereruniqueid']]['calleridname'];transfers[_0xd5adc1[_0x14e8('0x4b')]][_0x14e8('0x19')]=utils[_0x14e8('0x1a')]();transfers[_0xd5adc1[_0x14e8('0x4b')]]['agentconnectAt']=utils[_0x14e8('0x1a')]();transfers[_0xd5adc1[_0x14e8('0x4b')]][_0x14e8('0x24')]=0x0;transfers[_0xd5adc1[_0x14e8('0x4b')]][_0x14e8('0x45')]=0x2;}}}catch(_0x36d0e5){utils['error'](util[_0x14e8('0x3')](_0x14e8('0x3e'),_0xd5adc1[_0x14e8('0x3f')]),_0x36d0e5);}};exports['hangup']=function(_0x5add74){try{utils[_0x14e8('0x16')](util['format'](_0x14e8('0x4c'),_0x5add74['uniqueid']),_0x5add74);if(agents[_0x5add74[_0x14e8('0x5')]]&&agents[_0x5add74['uniqueid']][_0x14e8('0x23')]===_0x14e8('0x22')){if(_0x5add74['cause']==='21'){agents[_0x5add74[_0x14e8('0x5')]][_0x14e8('0x23')]=_0x14e8('0x4d');agents[_0x5add74[_0x14e8('0x5')]][_0x14e8('0xa')]=_0x14e8('0x4d');}utils[_0x14e8('0x1c')](util[_0x14e8('0x3')](_0x14e8('0x4e'),_0x5add74[_0x14e8('0x5')],agents[_0x5add74[_0x14e8('0x5')]][_0x14e8('0x8')],agents[_0x5add74[_0x14e8('0x5')]]['reason'],agents[_0x5add74['uniqueid']]['lastevent']));writeDB(agents[_0x5add74[_0x14e8('0x5')]]);var _0x52f0a7=unanswered[_0x14e8('0x4f')](_0x5add74['uniqueid']);if(_0x52f0a7>-0x1){unanswered[_0x14e8('0x50')](_0x52f0a7,0x1);}}if(transfers[_0x5add74['uniqueid']]){transfers[_0x5add74['uniqueid']]['agentcomplete']=!![];transfers[_0x5add74[_0x14e8('0x5')]][_0x14e8('0x51')]=utils[_0x14e8('0x1a')]();transfers[_0x5add74['uniqueid']][_0x14e8('0x2d')]=utils['diffTime'](transfers[_0x5add74[_0x14e8('0x5')]][_0x14e8('0x51')],transfers[_0x5add74[_0x14e8('0x5')]][_0x14e8('0x2f')]);transfers[_0x5add74[_0x14e8('0x5')]][_0x14e8('0x23')]=_0x14e8('0x52');transfers[_0x5add74[_0x14e8('0x5')]][_0x14e8('0xa')]='complete';utils[_0x14e8('0x1c')](util['format'](_0x14e8('0x4e'),_0x5add74[_0x14e8('0x5')],transfers[_0x5add74[_0x14e8('0x5')]][_0x14e8('0x8')],transfers[_0x5add74[_0x14e8('0x5')]][_0x14e8('0x23')],transfers[_0x5add74[_0x14e8('0x5')]][_0x14e8('0xa')]));writeDB(transfers[_0x5add74[_0x14e8('0x5')]],!![]);}if(agents[_0x5add74['uniqueid']]&&agents[_0x5add74[_0x14e8('0x5')]][_0x14e8('0x2f')]){agents[_0x5add74[_0x14e8('0x5')]][_0x14e8('0xe')]=!![];agents[_0x5add74['uniqueid']][_0x14e8('0x51')]=utils[_0x14e8('0x1a')]();agents[_0x5add74[_0x14e8('0x5')]][_0x14e8('0x2d')]=utils['diffTime'](agents[_0x5add74[_0x14e8('0x5')]]['agentcompleteAt'],agents[_0x5add74[_0x14e8('0x5')]]['agentconnectAt']);agents[_0x5add74['uniqueid']][_0x14e8('0x23')]=agents[_0x5add74[_0x14e8('0x5')]][_0x14e8('0x4a')]?_0x14e8('0x4a'):_0x14e8('0x52');agents[_0x5add74[_0x14e8('0x5')]][_0x14e8('0xa')]=_0x14e8('0x35');utils[_0x14e8('0x1c')](util[_0x14e8('0x3')](_0x14e8('0x4e'),_0x5add74['uniqueid'],agents[_0x5add74[_0x14e8('0x5')]][_0x14e8('0x8')],agents[_0x5add74[_0x14e8('0x5')]]['reason'],agents[_0x5add74['uniqueid']][_0x14e8('0xa')]));writeDB(agents[_0x5add74[_0x14e8('0x5')]]);}}catch(_0xc3ebbc){utils[_0x14e8('0x1e')](util[_0x14e8('0x3')](_0x14e8('0x4c'),_0x5add74[_0x14e8('0x5')]),_0xc3ebbc);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index ab6ccaa..9c728b3 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 _0xd692=['xmd-queue','lastapplication','Queue','lastdata','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','xmd-cdrtype','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','type','outboundrouteid','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','routeid','sipcallid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','[%s][calls][newexten]','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','startsWith','split','substring','lastIndexOf','includes','noop','execif','set','gotoif','lodash','util','./utils','NO\x20ANSWER','FAILED','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','queue','membername','interface','connectedlinenum','lastevent','accountcode','request','CreateVoiceCallReport','newchannel','linkedid','OutgoingSpoolFailed','context','exten','calleridnum','DOCUMENTATION','[%s][calls][newchannel]','[%s][calls][newstate]','isNil','channelstate','info','[%s][calls][newstate]\x20context:%s\x20channel:%s','systemanswertime','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','answertime','now','disposition','toNumber','error','hangup','debug','[%s][calls][hangup]','callerid','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','cause-txt','endtime','duration','starttime','billableseconds','diffTime','attendedtransfer','localtwolinkedid','[%s][calls][attendedtransfer]','origtransfereruniqueid','transfereechannel','secondtransfererchannel','userfield','_attended','transfertargetchannel','origtransfererchannel','destinationchannel','musiconholdstart','[%s][calls][musiconholdstart]','musiconholdstartAt','musiconholdstop','[%s][calls][musiconholdstop]\x20mohtime:%s','mohtime','varset','[%s][calls][varset]','variable','xmd-originatecalleridnum','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','source','destination','\x22\x20<','xmd-callerid','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-callerid-preview','xmcs-queue'];(function(_0x47fd36,_0x41535d){var _0x21a0fc=function(_0x44c07c){while(--_0x44c07c){_0x47fd36['push'](_0x47fd36['shift']());}};_0x21a0fc(++_0x41535d);}(_0xd692,0x1c7));var _0x2d69=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xd692[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0x2d69('0x0'));var util=require(_0x2d69('0x1'));var utils=require(_0x2d69('0x2'));var dispositions=[_0x2d69('0x3'),_0x2d69('0x4'),_0x2d69('0x4'),_0x2d69('0x3'),_0x2d69('0x3'),_0x2d69('0x3'),'ANSWERED','BUSY','FAILED',_0x2d69('0x4'),_0x2d69('0x4')];var channels={};function writeDB(_0x4c95f6){utils['info'](util[_0x2d69('0x5')](_0x2d69('0x6'),_0x4c95f6[_0x2d69('0x7')],_0x4c95f6[_0x2d69('0x8')],_0x4c95f6[_0x2d69('0x9')],_0x4c95f6[_0x2d69('0xa')],_0x4c95f6[_0x2d69('0xb')],_0x4c95f6['calleridnum'],_0x4c95f6[_0x2d69('0xc')],_0x4c95f6[_0x2d69('0xd')]));if(_0x4c95f6[_0x2d69('0xe')]){utils['getUserByInternal'](_0x4c95f6['accountcode'])['then'](function(_0x51685a){if(_0x51685a){_0x4c95f6['UserId']=_0x51685a['id'];}utils[_0x2d69('0xf')](_0x2d69('0x10'),_0x4c95f6);});}else{utils['request']('CreateVoiceCallReport',_0x4c95f6);}if(channels[_0x4c95f6[_0x2d69('0x7')]]){delete channels[_0x4c95f6['uniqueid']];}}exports[_0x2d69('0x11')]=function(_0x43c489){try{utils['debug'](util[_0x2d69('0x5')]('[%s][calls][newchannel]',_0x43c489[_0x2d69('0x7')]),_0x43c489);if(_0x43c489[_0x2d69('0x7')]==_0x43c489[_0x2d69('0x12')]&&_0x43c489['channel']!=_0x2d69('0x13')){utils['info'](util['format']('[%s][calls][newchannel]\x20context:%s\x20exten:%s',_0x43c489[_0x2d69('0x7')],_0x43c489[_0x2d69('0x14')],_0x43c489[_0x2d69('0x15')]));channels[_0x43c489[_0x2d69('0x7')]]={'uniqueid':_0x43c489[_0x2d69('0x7')],'accountcode':_0x43c489['accountcode'],'source':_0x43c489[_0x2d69('0x16')],'destination':_0x43c489['exten'],'destinationcontext':_0x43c489[_0x2d69('0x14')],'channel':_0x43c489[_0x2d69('0x8')],'starttime':utils['now'](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x2d69('0x3'),'amaflags':_0x2d69('0x17')};}}catch(_0x2084c3){utils['error'](util[_0x2d69('0x5')](_0x2d69('0x18'),_0x43c489['uniqueid']),_0x2084c3);}};exports['newstate']=function(_0x1da106){try{utils['debug'](util['format'](_0x2d69('0x19'),_0x1da106[_0x2d69('0x7')]),_0x1da106);if(!_[_0x2d69('0x1a')](channels[_0x1da106['uniqueid']])&&_0x1da106[_0x2d69('0x1b')]==0x6){utils[_0x2d69('0x1c')](util[_0x2d69('0x5')](_0x2d69('0x1d'),_0x1da106[_0x2d69('0x7')],_0x1da106[_0x2d69('0x14')],_0x1da106[_0x2d69('0x8')]));if(_[_0x2d69('0x1a')](channels[_0x1da106[_0x2d69('0x7')]][_0x2d69('0x1e')])){channels[_0x1da106[_0x2d69('0x7')]][_0x2d69('0x1e')]=utils['now']();}}else if(!_[_0x2d69('0x1a')](channels[_0x1da106[_0x2d69('0x12')]])&&_0x1da106['channelstate']==0x6&&_0x1da106['context']!=_0x2d69('0x1f')){utils[_0x2d69('0x1c')](util[_0x2d69('0x5')](_0x2d69('0x20'),_0x1da106[_0x2d69('0x7')],_0x1da106[_0x2d69('0x12')],_0x1da106[_0x2d69('0x14')],_0x1da106['channel']));channels[_0x1da106[_0x2d69('0x12')]][_0x2d69('0xe')]=_0x1da106[_0x2d69('0xe')];channels[_0x1da106[_0x2d69('0x12')]]['destinationchannel']=_0x1da106[_0x2d69('0x8')];if(_[_0x2d69('0x1a')](channels[_0x1da106[_0x2d69('0x12')]][_0x2d69('0x21')])){channels[_0x1da106[_0x2d69('0x12')]][_0x2d69('0x21')]=utils[_0x2d69('0x22')]();}channels[_0x1da106['linkedid']][_0x2d69('0x23')]=dispositions[_[_0x2d69('0x24')](_0x1da106[_0x2d69('0x1b')])]||'ANSWERED';}}catch(_0x1e7717){utils[_0x2d69('0x25')](util[_0x2d69('0x5')](_0x2d69('0x19'),_0x1da106[_0x2d69('0x7')]),_0x1e7717);}};exports[_0x2d69('0x26')]=function(_0x98ddbc){try{if(!_[_0x2d69('0x1a')](channels[_0x98ddbc[_0x2d69('0x7')]])){utils[_0x2d69('0x27')](util[_0x2d69('0x5')](_0x2d69('0x28'),_0x98ddbc[_0x2d69('0x7')]),_0x98ddbc);if(_[_0x2d69('0x1a')](channels[_0x98ddbc['uniqueid']][_0x2d69('0x29')])){channels[_0x98ddbc[_0x2d69('0x7')]][_0x2d69('0x29')]=_0x98ddbc[_0x2d69('0x2a')]+'\x20<'+_0x98ddbc[_0x2d69('0x16')]+'>';}utils['info'](util[_0x2d69('0x5')](_0x2d69('0x2b'),_0x98ddbc[_0x2d69('0x7')],channels[_0x98ddbc[_0x2d69('0x7')]][_0x2d69('0x29')],_0x98ddbc[_0x2d69('0x2c')]));channels[_0x98ddbc[_0x2d69('0x7')]][_0x2d69('0x2d')]=utils[_0x2d69('0x22')]();channels[_0x98ddbc[_0x2d69('0x7')]][_0x2d69('0x2e')]=utils['diffTime'](channels[_0x98ddbc['uniqueid']][_0x2d69('0x2d')],channels[_0x98ddbc[_0x2d69('0x7')]][_0x2d69('0x2f')]);channels[_0x98ddbc[_0x2d69('0x7')]][_0x2d69('0x30')]=channels[_0x98ddbc['uniqueid']][_0x2d69('0x21')]?utils[_0x2d69('0x31')](channels[_0x98ddbc[_0x2d69('0x7')]][_0x2d69('0x2d')],channels[_0x98ddbc[_0x2d69('0x7')]][_0x2d69('0x21')]):0x0;writeDB(channels[_0x98ddbc[_0x2d69('0x7')]]);}}catch(_0x53b76f){utils[_0x2d69('0x25')](util[_0x2d69('0x5')](_0x2d69('0x28'),_0x98ddbc[_0x2d69('0x7')]),_0x53b76f);}};exports[_0x2d69('0x32')]=function(_0x4b8cfd){try{if(!_[_0x2d69('0x1a')](channels[_0x4b8cfd[_0x2d69('0x33')]])){utils['debug'](util[_0x2d69('0x5')](_0x2d69('0x34'),_0x4b8cfd[_0x2d69('0x35')]),_0x4b8cfd);if(channels[_0x4b8cfd['localtwolinkedid']][_0x2d69('0x8')]==_0x4b8cfd[_0x2d69('0x36')]){utils[_0x2d69('0x1c')](util[_0x2d69('0x5')]('[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s',_0x4b8cfd[_0x2d69('0x35')],_0x4b8cfd[_0x2d69('0x33')],_0x4b8cfd['secondtransfererchannel']));channels[_0x4b8cfd[_0x2d69('0x33')]]['destinationchannel']=_0x4b8cfd[_0x2d69('0x37')];channels[_0x4b8cfd[_0x2d69('0x33')]][_0x2d69('0x38')]=_0x2d69('0x39');}else if(channels[_0x4b8cfd['localtwolinkedid']][_0x2d69('0x8')]=_0x4b8cfd[_0x2d69('0x3a')]){utils[_0x2d69('0x1c')](util['format']('[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s',_0x4b8cfd['origtransfereruniqueid'],_0x4b8cfd['localtwolinkedid'],_0x4b8cfd[_0x2d69('0x3b')]));channels[_0x4b8cfd[_0x2d69('0x33')]][_0x2d69('0x3c')]=_0x4b8cfd[_0x2d69('0x3b')];channels[_0x4b8cfd[_0x2d69('0x33')]][_0x2d69('0x38')]=_0x2d69('0x39');}}}catch(_0x2386db){utils[_0x2d69('0x25')](util[_0x2d69('0x5')](_0x2d69('0x34'),_0x4b8cfd[_0x2d69('0x35')]),_0x2386db);}};exports[_0x2d69('0x3d')]=function(_0x2842b1){try{if(!_['isNil'](channels[_0x2842b1[_0x2d69('0x7')]])){utils[_0x2d69('0x27')](util[_0x2d69('0x5')](_0x2d69('0x3e'),_0x2842b1[_0x2d69('0x7')]),_0x2842b1);channels[_0x2842b1[_0x2d69('0x7')]][_0x2d69('0x3f')]=utils[_0x2d69('0x22')]();utils['info'](util[_0x2d69('0x5')]('[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s',_0x2842b1[_0x2d69('0x7')],channels[_0x2842b1[_0x2d69('0x7')]][_0x2d69('0x3f')]));}}catch(_0x522748){utils[_0x2d69('0x25')](util[_0x2d69('0x5')]('[%s][calls][musiconholdstart]',_0x2842b1[_0x2d69('0x7')]),_0x522748);}};exports[_0x2d69('0x40')]=function(_0x13ae34){try{if(!_[_0x2d69('0x1a')](channels[_0x13ae34['uniqueid']])){utils['debug'](util[_0x2d69('0x5')]('[%s][calls][musiconholdstop]',_0x13ae34[_0x2d69('0x7')]),_0x13ae34);if(!_[_0x2d69('0x1a')](channels[_0x13ae34[_0x2d69('0x7')]][_0x2d69('0x3f')])){channels[_0x13ae34[_0x2d69('0x7')]]['mohtime']+=utils[_0x2d69('0x31')](utils['now'](),channels[_0x13ae34[_0x2d69('0x7')]][_0x2d69('0x3f')]);utils[_0x2d69('0x1c')](util['format'](_0x2d69('0x41'),_0x13ae34[_0x2d69('0x7')],channels[_0x13ae34['uniqueid']][_0x2d69('0x42')]));delete channels[_0x13ae34[_0x2d69('0x7')]]['musiconholdstartAt'];}}}catch(_0x2e37f7){utils[_0x2d69('0x25')](util[_0x2d69('0x5')]('[%s][calls][musiconholdstop]',_0x13ae34['uniqueid']),_0x2e37f7);}};exports[_0x2d69('0x43')]=function(_0x1fd3e3){try{if(!_[_0x2d69('0x1a')](channels[_0x1fd3e3[_0x2d69('0x7')]])){utils[_0x2d69('0x27')](util[_0x2d69('0x5')](_0x2d69('0x44'),_0x1fd3e3[_0x2d69('0x7')]),_0x1fd3e3);if(!_[_0x2d69('0x1a')](_0x1fd3e3[_0x2d69('0x45')][_0x2d69('0x46')])){utils[_0x2d69('0x1c')](util['format'](_0x2d69('0x47'),_0x1fd3e3[_0x2d69('0x7')],_0x1fd3e3[_0x2d69('0x48')]));channels[_0x1fd3e3[_0x2d69('0x7')]][_0x2d69('0x49')]=_0x1fd3e3[_0x2d69('0x48')];}if(!_['isNil'](_0x1fd3e3['variable']['xmd-phone'])){utils[_0x2d69('0x1c')](util['format']('[%s][calls][varset]\x20variable:xmd-phone\x20value:%s',_0x1fd3e3[_0x2d69('0x7')],_0x1fd3e3[_0x2d69('0x48')]));channels[_0x1fd3e3[_0x2d69('0x7')]][_0x2d69('0x4a')]=_0x1fd3e3[_0x2d69('0x48')];channels[_0x1fd3e3[_0x2d69('0x7')]][_0x2d69('0x29')]='\x22'+_0x1fd3e3['value']+_0x2d69('0x4b')+_0x1fd3e3[_0x2d69('0x48')]+'>';}if(!_[_0x2d69('0x1a')](_0x1fd3e3[_0x2d69('0x45')]['xmd-callerid-preview'])||!_[_0x2d69('0x1a')](_0x1fd3e3[_0x2d69('0x45')][_0x2d69('0x4c')])){utils[_0x2d69('0x1c')](util[_0x2d69('0x5')](_0x2d69('0x4d'),_0x1fd3e3[_0x2d69('0x7')],!_['isNil'](_0x1fd3e3[_0x2d69('0x45')][_0x2d69('0x4e')])?'xmd-callerid-preview':_0x2d69('0x4c'),_0x1fd3e3[_0x2d69('0x48')]));channels[_0x1fd3e3[_0x2d69('0x7')]]['callerid']=_0x1fd3e3['value'];}if(!_['isNil'](_0x1fd3e3['variable']['xmd-queue'])||!_[_0x2d69('0x1a')](_0x1fd3e3[_0x2d69('0x45')][_0x2d69('0x4f')])){utils[_0x2d69('0x1c')](util[_0x2d69('0x5')](_0x2d69('0x4d'),_0x1fd3e3[_0x2d69('0x7')],!_[_0x2d69('0x1a')](_0x1fd3e3[_0x2d69('0x45')][_0x2d69('0x50')])?_0x2d69('0x50'):'xmcs-queue',_0x1fd3e3[_0x2d69('0x48')]));channels[_0x1fd3e3['uniqueid']][_0x2d69('0x51')]=_0x2d69('0x52');channels[_0x1fd3e3[_0x2d69('0x7')]][_0x2d69('0x53')]=_0x1fd3e3['value'];channels[_0x1fd3e3[_0x2d69('0x7')]][_0x2d69('0x9')]=!![];}if(!_[_0x2d69('0x1a')](_0x1fd3e3[_0x2d69('0x45')]['xmd-contactid'])){utils[_0x2d69('0x1c')](util[_0x2d69('0x5')](_0x2d69('0x54'),_0x1fd3e3[_0x2d69('0x7')],_0x1fd3e3[_0x2d69('0x48')]));channels[_0x1fd3e3[_0x2d69('0x7')]]['ContactId']=_0x1fd3e3['value'];}if(!_[_0x2d69('0x1a')](_0x1fd3e3[_0x2d69('0x45')][_0x2d69('0x55')])){utils[_0x2d69('0x1c')](util[_0x2d69('0x5')](_0x2d69('0x56'),_0x1fd3e3[_0x2d69('0x7')],_0x1fd3e3['value']));channels[_0x1fd3e3['uniqueid']][_0x2d69('0x57')]=_0x1fd3e3['value'];}if(!_[_0x2d69('0x1a')](_0x1fd3e3['variable'][_0x2d69('0x58')])){utils[_0x2d69('0x1c')](util['format'](_0x2d69('0x59'),_0x1fd3e3[_0x2d69('0x7')],_0x1fd3e3[_0x2d69('0x48')]));channels[_0x1fd3e3[_0x2d69('0x7')]][_0x2d69('0x5a')]=_0x1fd3e3[_0x2d69('0x48')];}if(!_[_0x2d69('0x1a')](_0x1fd3e3['variable'][_0x2d69('0x5b')])){utils[_0x2d69('0x1c')](util[_0x2d69('0x5')](_0x2d69('0x5c'),_0x1fd3e3['uniqueid'],_0x1fd3e3[_0x2d69('0x48')]));channels[_0x1fd3e3[_0x2d69('0x7')]]['sipcallid']=_0x1fd3e3[_0x2d69('0x48')];}}}catch(_0x495b99){utils[_0x2d69('0x25')](util[_0x2d69('0x5')](_0x2d69('0x44'),_0x1fd3e3[_0x2d69('0x7')]),_0x495b99);}};exports['newexten']=function(_0x310aa1){try{if(!_['isNil'](channels[_0x310aa1[_0x2d69('0x7')]])){utils[_0x2d69('0x27')](util[_0x2d69('0x5')](_0x2d69('0x5d'),_0x310aa1[_0x2d69('0x7')]),_0x310aa1);utils[_0x2d69('0x1c')](util[_0x2d69('0x5')](_0x2d69('0x5e'),_0x310aa1[_0x2d69('0x7')],_0x310aa1[_0x2d69('0x5f')],_0x310aa1[_0x2d69('0x60')]));if(_0x310aa1['application'][_0x2d69('0x61')]()=='set'&&_[_0x2d69('0x62')](_0x310aa1['appdata'][_0x2d69('0x61')](),'cdr')){var _0x1795e2=_0x310aa1[_0x2d69('0x60')][_0x2d69('0x63')]('=');var _0x56becc=_0x1795e2[0x0][_0x2d69('0x64')](_0x1795e2[0x0][_0x2d69('0x65')]('(')+0x1,_0x1795e2[0x0][_0x2d69('0x65')](')'));var _0x513499=_0x1795e2[0x1];channels[_0x310aa1[_0x2d69('0x7')]][_0x56becc]=_0x513499;}if(!_[_0x2d69('0x66')](['hangup',_0x2d69('0x67'),_0x2d69('0x68'),_0x2d69('0x69'),_0x2d69('0x6a')],_0x310aa1['application']['toLowerCase']())){channels[_0x310aa1['uniqueid']][_0x2d69('0x51')]=_0x310aa1[_0x2d69('0x5f')];channels[_0x310aa1[_0x2d69('0x7')]]['lastdata']=_0x310aa1['appdata'];}}}catch(_0x5e2535){utils[_0x2d69('0x25')](util['format'](_0x2d69('0x5d'),_0x310aa1[_0x2d69('0x7')]),_0x5e2535);}}; \ No newline at end of file +var _0xe865=['[%s][calls][newexten]','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','cdr','substring','lastIndexOf','includes','noop','execif','gotoif','lastapplication','lastdata','lodash','util','NO\x20ANSWER','FAILED','BUSY','info','format','uniqueid','channel','queue','calleridnum','lastevent','accountcode','getUserByInternal','request','CreateVoiceCallReport','newchannel','[%s][calls][newchannel]','linkedid','context','exten','now','DOCUMENTATION','error','debug','[%s][calls][newstate]','isNil','channelstate','[%s][calls][newstate]\x20context:%s\x20channel:%s','systemanswertime','transfer','answertime','disposition','toNumber','ANSWERED','hangup','[%s][calls][hangup]','callerid','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','cause-txt','endtime','starttime','billableseconds','diffTime','attendedtransfer','localtwolinkedid','origtransfereruniqueid','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','secondtransfererchannel','userfield','_attended','origtransfererchannel','[%s][calls][attendedtransfer]','musiconholdstart','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','[%s][calls][musiconholdstart]','musiconholdstop','[%s][calls][musiconholdstop]','mohtime','[%s][calls][musiconholdstop]\x20mohtime:%s','varset','[%s][calls][varset]','variable','xmd-originatecalleridnum','source','xmd-phone','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','value','destination','\x22\x20<','xmd-callerid-preview','xmd-callerid','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-queue','xmcs-queue','xmd-contactid','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','ContactId','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','outboundrouteid','routeid','sipcallid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','newexten'];(function(_0x1c37fe,_0x10a098){var _0x45e904=function(_0x2b69f4){while(--_0x2b69f4){_0x1c37fe['push'](_0x1c37fe['shift']());}};_0x45e904(++_0x10a098);}(_0xe865,0x1a7));var _0x5e86=function(_0x1353bc,_0x432b07){_0x1353bc=_0x1353bc-0x0;var _0x3097a6=_0xe865[_0x1353bc];return _0x3097a6;};'use strict';var _=require(_0x5e86('0x0'));var util=require(_0x5e86('0x1'));var utils=require('./utils');var dispositions=[_0x5e86('0x2'),'FAILED',_0x5e86('0x3'),_0x5e86('0x2'),_0x5e86('0x2'),_0x5e86('0x2'),'ANSWERED',_0x5e86('0x4'),'FAILED','FAILED',_0x5e86('0x3')];var channels={};function writeDB(_0x56bb0){utils[_0x5e86('0x5')](util[_0x5e86('0x6')]('[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s',_0x56bb0[_0x5e86('0x7')],_0x56bb0[_0x5e86('0x8')],_0x56bb0[_0x5e86('0x9')],_0x56bb0['membername'],_0x56bb0['interface'],_0x56bb0[_0x5e86('0xa')],_0x56bb0['connectedlinenum'],_0x56bb0[_0x5e86('0xb')]));if(_0x56bb0[_0x5e86('0xc')]){utils[_0x5e86('0xd')](_0x56bb0[_0x5e86('0xc')])['then'](function(_0x433ecb){if(_0x433ecb){_0x56bb0['UserId']=_0x433ecb['id'];}utils[_0x5e86('0xe')](_0x5e86('0xf'),_0x56bb0);});}else{utils[_0x5e86('0xe')](_0x5e86('0xf'),_0x56bb0);}if(channels[_0x56bb0[_0x5e86('0x7')]]){delete channels[_0x56bb0[_0x5e86('0x7')]];}}exports[_0x5e86('0x10')]=function(_0x351151){try{utils['debug'](util['format'](_0x5e86('0x11'),_0x351151[_0x5e86('0x7')]),_0x351151);if(_0x351151['uniqueid']==_0x351151[_0x5e86('0x12')]&&_0x351151[_0x5e86('0x8')]!='OutgoingSpoolFailed'){utils[_0x5e86('0x5')](util[_0x5e86('0x6')]('[%s][calls][newchannel]\x20context:%s\x20exten:%s',_0x351151[_0x5e86('0x7')],_0x351151[_0x5e86('0x13')],_0x351151[_0x5e86('0x14')]));channels[_0x351151[_0x5e86('0x7')]]={'uniqueid':_0x351151['uniqueid'],'accountcode':_0x351151['accountcode'],'source':_0x351151['calleridnum'],'destination':_0x351151[_0x5e86('0x14')],'destinationcontext':_0x351151['context'],'channel':_0x351151[_0x5e86('0x8')],'starttime':utils[_0x5e86('0x15')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x5e86('0x2'),'amaflags':_0x5e86('0x16')};}}catch(_0x4bb143){utils[_0x5e86('0x17')](util[_0x5e86('0x6')](_0x5e86('0x11'),_0x351151[_0x5e86('0x7')]),_0x4bb143);}};exports['newstate']=function(_0x5815e8){try{utils[_0x5e86('0x18')](util[_0x5e86('0x6')](_0x5e86('0x19'),_0x5815e8[_0x5e86('0x7')]),_0x5815e8);if(!_[_0x5e86('0x1a')](channels[_0x5815e8[_0x5e86('0x7')]])&&_0x5815e8[_0x5e86('0x1b')]==0x6){utils['info'](util[_0x5e86('0x6')](_0x5e86('0x1c'),_0x5815e8[_0x5e86('0x7')],_0x5815e8[_0x5e86('0x13')],_0x5815e8[_0x5e86('0x8')]));if(_[_0x5e86('0x1a')](channels[_0x5815e8[_0x5e86('0x7')]]['systemanswertime'])){channels[_0x5815e8[_0x5e86('0x7')]][_0x5e86('0x1d')]=utils[_0x5e86('0x15')]();}}else if(!_[_0x5e86('0x1a')](channels[_0x5815e8[_0x5e86('0x12')]])&&_0x5815e8[_0x5e86('0x1b')]==0x6&&_0x5815e8['context']!=_0x5e86('0x1e')){utils[_0x5e86('0x5')](util['format']('[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s',_0x5815e8[_0x5e86('0x7')],_0x5815e8['linkedid'],_0x5815e8[_0x5e86('0x13')],_0x5815e8[_0x5e86('0x8')]));channels[_0x5815e8[_0x5e86('0x12')]][_0x5e86('0xc')]=_0x5815e8[_0x5e86('0xc')];channels[_0x5815e8['linkedid']]['destinationchannel']=_0x5815e8['channel'];if(_[_0x5e86('0x1a')](channels[_0x5815e8['linkedid']][_0x5e86('0x1f')])){channels[_0x5815e8['linkedid']][_0x5e86('0x1f')]=utils[_0x5e86('0x15')]();}channels[_0x5815e8['linkedid']][_0x5e86('0x20')]=dispositions[_[_0x5e86('0x21')](_0x5815e8[_0x5e86('0x1b')])]||_0x5e86('0x22');}}catch(_0x280888){utils['error'](util[_0x5e86('0x6')](_0x5e86('0x19'),_0x5815e8[_0x5e86('0x7')]),_0x280888);}};exports[_0x5e86('0x23')]=function(_0x283d82){try{if(!_[_0x5e86('0x1a')](channels[_0x283d82['uniqueid']])){utils[_0x5e86('0x18')](util[_0x5e86('0x6')](_0x5e86('0x24'),_0x283d82[_0x5e86('0x7')]),_0x283d82);if(_[_0x5e86('0x1a')](channels[_0x283d82[_0x5e86('0x7')]]['callerid'])){channels[_0x283d82[_0x5e86('0x7')]][_0x5e86('0x25')]=_0x283d82[_0x5e86('0x26')]+'\x20<'+_0x283d82['calleridnum']+'>';}utils[_0x5e86('0x5')](util[_0x5e86('0x6')](_0x5e86('0x27'),_0x283d82[_0x5e86('0x7')],channels[_0x283d82[_0x5e86('0x7')]]['callerid'],_0x283d82[_0x5e86('0x28')]));channels[_0x283d82[_0x5e86('0x7')]]['endtime']=utils['now']();channels[_0x283d82['uniqueid']]['duration']=utils['diffTime'](channels[_0x283d82['uniqueid']][_0x5e86('0x29')],channels[_0x283d82['uniqueid']][_0x5e86('0x2a')]);channels[_0x283d82['uniqueid']][_0x5e86('0x2b')]=channels[_0x283d82[_0x5e86('0x7')]][_0x5e86('0x1f')]?utils[_0x5e86('0x2c')](channels[_0x283d82['uniqueid']][_0x5e86('0x29')],channels[_0x283d82[_0x5e86('0x7')]][_0x5e86('0x1f')]):0x0;writeDB(channels[_0x283d82[_0x5e86('0x7')]]);}}catch(_0x43b227){utils[_0x5e86('0x17')](util[_0x5e86('0x6')](_0x5e86('0x24'),_0x283d82[_0x5e86('0x7')]),_0x43b227);}};exports[_0x5e86('0x2d')]=function(_0x2e41eb){try{if(!_[_0x5e86('0x1a')](channels[_0x2e41eb[_0x5e86('0x2e')]])){utils['debug'](util[_0x5e86('0x6')]('[%s][calls][attendedtransfer]',_0x2e41eb[_0x5e86('0x2f')]),_0x2e41eb);if(channels[_0x2e41eb[_0x5e86('0x2e')]][_0x5e86('0x8')]==_0x2e41eb[_0x5e86('0x30')]){utils[_0x5e86('0x5')](util[_0x5e86('0x6')](_0x5e86('0x31'),_0x2e41eb[_0x5e86('0x2f')],_0x2e41eb[_0x5e86('0x2e')],_0x2e41eb[_0x5e86('0x32')]));channels[_0x2e41eb[_0x5e86('0x2e')]]['destinationchannel']=_0x2e41eb[_0x5e86('0x32')];channels[_0x2e41eb[_0x5e86('0x2e')]][_0x5e86('0x33')]=_0x5e86('0x34');}else if(channels[_0x2e41eb[_0x5e86('0x2e')]][_0x5e86('0x8')]=_0x2e41eb['transfertargetchannel']){utils[_0x5e86('0x5')](util[_0x5e86('0x6')](_0x5e86('0x31'),_0x2e41eb[_0x5e86('0x2f')],_0x2e41eb[_0x5e86('0x2e')],_0x2e41eb[_0x5e86('0x35')]));channels[_0x2e41eb[_0x5e86('0x2e')]]['destinationchannel']=_0x2e41eb[_0x5e86('0x35')];channels[_0x2e41eb[_0x5e86('0x2e')]][_0x5e86('0x33')]='_attended';}}}catch(_0x2d2412){utils['error'](util[_0x5e86('0x6')](_0x5e86('0x36'),_0x2e41eb[_0x5e86('0x2f')]),_0x2d2412);}};exports[_0x5e86('0x37')]=function(_0xe6aa7f){try{if(!_[_0x5e86('0x1a')](channels[_0xe6aa7f[_0x5e86('0x7')]])){utils['debug'](util[_0x5e86('0x6')]('[%s][calls][musiconholdstart]',_0xe6aa7f['uniqueid']),_0xe6aa7f);channels[_0xe6aa7f[_0x5e86('0x7')]][_0x5e86('0x38')]=utils[_0x5e86('0x15')]();utils[_0x5e86('0x5')](util[_0x5e86('0x6')](_0x5e86('0x39'),_0xe6aa7f[_0x5e86('0x7')],channels[_0xe6aa7f[_0x5e86('0x7')]][_0x5e86('0x38')]));}}catch(_0x427b63){utils[_0x5e86('0x17')](util['format'](_0x5e86('0x3a'),_0xe6aa7f[_0x5e86('0x7')]),_0x427b63);}};exports[_0x5e86('0x3b')]=function(_0x5c2b29){try{if(!_[_0x5e86('0x1a')](channels[_0x5c2b29['uniqueid']])){utils[_0x5e86('0x18')](util[_0x5e86('0x6')](_0x5e86('0x3c'),_0x5c2b29['uniqueid']),_0x5c2b29);if(!_[_0x5e86('0x1a')](channels[_0x5c2b29[_0x5e86('0x7')]][_0x5e86('0x38')])){channels[_0x5c2b29[_0x5e86('0x7')]][_0x5e86('0x3d')]+=utils[_0x5e86('0x2c')](utils[_0x5e86('0x15')](),channels[_0x5c2b29['uniqueid']][_0x5e86('0x38')]);utils[_0x5e86('0x5')](util['format'](_0x5e86('0x3e'),_0x5c2b29[_0x5e86('0x7')],channels[_0x5c2b29['uniqueid']]['mohtime']));delete channels[_0x5c2b29[_0x5e86('0x7')]]['musiconholdstartAt'];}}}catch(_0x3152f8){utils[_0x5e86('0x17')](util[_0x5e86('0x6')](_0x5e86('0x3c'),_0x5c2b29[_0x5e86('0x7')]),_0x3152f8);}};exports[_0x5e86('0x3f')]=function(_0x330903){try{if(!_[_0x5e86('0x1a')](channels[_0x330903[_0x5e86('0x7')]])){utils[_0x5e86('0x18')](util[_0x5e86('0x6')](_0x5e86('0x40'),_0x330903[_0x5e86('0x7')]),_0x330903);if(!_[_0x5e86('0x1a')](_0x330903[_0x5e86('0x41')][_0x5e86('0x42')])){utils['info'](util['format']('[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s',_0x330903[_0x5e86('0x7')],_0x330903['value']));channels[_0x330903['uniqueid']][_0x5e86('0x43')]=_0x330903['value'];}if(!_[_0x5e86('0x1a')](_0x330903[_0x5e86('0x41')][_0x5e86('0x44')])){utils[_0x5e86('0x5')](util[_0x5e86('0x6')](_0x5e86('0x45'),_0x330903[_0x5e86('0x7')],_0x330903[_0x5e86('0x46')]));channels[_0x330903[_0x5e86('0x7')]][_0x5e86('0x47')]=_0x330903[_0x5e86('0x46')];channels[_0x330903[_0x5e86('0x7')]][_0x5e86('0x25')]='\x22'+_0x330903[_0x5e86('0x46')]+_0x5e86('0x48')+_0x330903[_0x5e86('0x46')]+'>';}if(!_[_0x5e86('0x1a')](_0x330903[_0x5e86('0x41')][_0x5e86('0x49')])||!_[_0x5e86('0x1a')](_0x330903[_0x5e86('0x41')][_0x5e86('0x4a')])){utils[_0x5e86('0x5')](util['format'](_0x5e86('0x4b'),_0x330903[_0x5e86('0x7')],!_[_0x5e86('0x1a')](_0x330903['variable'][_0x5e86('0x49')])?_0x5e86('0x49'):_0x5e86('0x4a'),_0x330903['value']));channels[_0x330903[_0x5e86('0x7')]]['callerid']=_0x330903[_0x5e86('0x46')];}if(!_[_0x5e86('0x1a')](_0x330903['variable'][_0x5e86('0x4c')])||!_[_0x5e86('0x1a')](_0x330903['variable'][_0x5e86('0x4d')])){utils[_0x5e86('0x5')](util[_0x5e86('0x6')](_0x5e86('0x4b'),_0x330903['uniqueid'],!_[_0x5e86('0x1a')](_0x330903[_0x5e86('0x41')][_0x5e86('0x4c')])?_0x5e86('0x4c'):'xmcs-queue',_0x330903['value']));channels[_0x330903[_0x5e86('0x7')]]['lastapplication']='Queue';channels[_0x330903[_0x5e86('0x7')]]['lastdata']=_0x330903[_0x5e86('0x46')];channels[_0x330903[_0x5e86('0x7')]]['queue']=!![];}if(!_[_0x5e86('0x1a')](_0x330903[_0x5e86('0x41')][_0x5e86('0x4e')])){utils[_0x5e86('0x5')](util[_0x5e86('0x6')](_0x5e86('0x4f'),_0x330903[_0x5e86('0x7')],_0x330903[_0x5e86('0x46')]));channels[_0x330903[_0x5e86('0x7')]][_0x5e86('0x50')]=_0x330903['value'];}if(!_[_0x5e86('0x1a')](_0x330903[_0x5e86('0x41')]['xmd-cdrtype'])){utils[_0x5e86('0x5')](util['format'](_0x5e86('0x51'),_0x330903[_0x5e86('0x7')],_0x330903['value']));channels[_0x330903[_0x5e86('0x7')]]['type']=_0x330903[_0x5e86('0x46')];}if(!_[_0x5e86('0x1a')](_0x330903['variable'][_0x5e86('0x52')])){utils[_0x5e86('0x5')](util[_0x5e86('0x6')]('[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s',_0x330903[_0x5e86('0x7')],_0x330903[_0x5e86('0x46')]));channels[_0x330903[_0x5e86('0x7')]][_0x5e86('0x53')]=_0x330903[_0x5e86('0x46')];}if(!_[_0x5e86('0x1a')](_0x330903['variable'][_0x5e86('0x54')])){utils[_0x5e86('0x5')](util['format'](_0x5e86('0x55'),_0x330903['uniqueid'],_0x330903[_0x5e86('0x46')]));channels[_0x330903[_0x5e86('0x7')]][_0x5e86('0x54')]=_0x330903[_0x5e86('0x46')];}}}catch(_0xa7eebb){utils[_0x5e86('0x17')](util['format'](_0x5e86('0x40'),_0x330903['uniqueid']),_0xa7eebb);}};exports[_0x5e86('0x56')]=function(_0x380f51){try{if(!_[_0x5e86('0x1a')](channels[_0x380f51[_0x5e86('0x7')]])){utils[_0x5e86('0x18')](util[_0x5e86('0x6')](_0x5e86('0x57'),_0x380f51['uniqueid']),_0x380f51);utils['info'](util['format'](_0x5e86('0x58'),_0x380f51[_0x5e86('0x7')],_0x380f51[_0x5e86('0x59')],_0x380f51[_0x5e86('0x5a')]));if(_0x380f51[_0x5e86('0x59')][_0x5e86('0x5b')]()==_0x5e86('0x5c')&&_['startsWith'](_0x380f51[_0x5e86('0x5a')]['toLowerCase'](),_0x5e86('0x5d'))){var _0x30e543=_0x380f51[_0x5e86('0x5a')]['split']('=');var _0x34d524=_0x30e543[0x0][_0x5e86('0x5e')](_0x30e543[0x0]['lastIndexOf']('(')+0x1,_0x30e543[0x0][_0x5e86('0x5f')](')'));var _0x5931fd=_0x30e543[0x1];channels[_0x380f51[_0x5e86('0x7')]][_0x34d524]=_0x5931fd;}if(!_[_0x5e86('0x60')](['hangup',_0x5e86('0x61'),_0x5e86('0x62'),'set',_0x5e86('0x63')],_0x380f51[_0x5e86('0x59')]['toLowerCase']())){channels[_0x380f51[_0x5e86('0x7')]][_0x5e86('0x64')]=_0x380f51[_0x5e86('0x59')];channels[_0x380f51[_0x5e86('0x7')]][_0x5e86('0x65')]=_0x380f51['appdata'];}}}catch(_0x3a30c8){utils[_0x5e86('0x17')](util[_0x5e86('0x6')]('[%s][calls][newexten]',_0x380f51[_0x5e86('0x7')]),_0x3a30c8);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index ecd1aab..5356ad8 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 _0x64f1=['connect','info','[core]\x20connected','shutdown','[core]\x20fullybooted','error','[core]\x20error','close','managerevent','./utils'];(function(_0x352711,_0x4262e6){var _0x46f0f3=function(_0x110fdd){while(--_0x110fdd){_0x352711['push'](_0x352711['shift']());}};_0x46f0f3(++_0x4262e6);}(_0x64f1,0x153));var _0x164f=function(_0x29d623,_0x1a5c9c){_0x29d623=_0x29d623-0x0;var _0x242e59=_0x64f1[_0x29d623];return _0x242e59;};'use strict';var utils=require(_0x164f('0x0'));exports[_0x164f('0x1')]=function(){utils[_0x164f('0x2')](_0x164f('0x3'));};exports[_0x164f('0x4')]=function(){utils[_0x164f('0x2')]('[core]\x20shutdown');};exports['fullybooted']=function(){utils[_0x164f('0x2')](_0x164f('0x5'));};exports[_0x164f('0x6')]=function(_0x35c704){utils[_0x164f('0x6')](_0x164f('0x7'),_0x35c704);};exports[_0x164f('0x8')]=function(){utils['info']('[core]\x20close');};exports[_0x164f('0x9')]=function(_0x353c61){}; \ No newline at end of file +var _0xb6a3=['info','shutdown','[core]\x20shutdown','fullybooted','[core]\x20fullybooted','error','[core]\x20error','close','[core]\x20close','managerevent','./utils','connect'];(function(_0x12ece4,_0xc1346a){var _0x1f0e67=function(_0x47c284){while(--_0x47c284){_0x12ece4['push'](_0x12ece4['shift']());}};_0x1f0e67(++_0xc1346a);}(_0xb6a3,0xa6));var _0x3b6a=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0xb6a3[_0x2be8c2];return _0x97f531;};'use strict';var utils=require(_0x3b6a('0x0'));exports[_0x3b6a('0x1')]=function(){utils[_0x3b6a('0x2')]('[core]\x20connected');};exports[_0x3b6a('0x3')]=function(){utils[_0x3b6a('0x2')](_0x3b6a('0x4'));};exports[_0x3b6a('0x5')]=function(){utils[_0x3b6a('0x2')](_0x3b6a('0x6'));};exports[_0x3b6a('0x7')]=function(_0x35dcb2){utils['error'](_0x3b6a('0x8'),_0x35dcb2);};exports[_0x3b6a('0x9')]=function(){utils[_0x3b6a('0x2')](_0x3b6a('0xa'));};exports[_0x3b6a('0xb')]=function(_0xd0f99c){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index 41cce74..79fbfc7 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 _0xd177=['holdtime','billableseconds','lodash','util','format','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','uniqueid','channel','calleridnum','dialstatus','request','CreateVoiceDialReport','newexten','debug','info','[%s][dials][newexten]\x20application:%s\x20appdata:%s','toLowerCase','set','startsWith','cdr(routeid)','appdata','split','error','varset','[%s][dials][varset]','isNil','variable','outboundrouteid','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','dialbegin','[%s][dials][dialbegin]','assign','starttime','now','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','dialend','[%s][dials][dialend]','ANSWER','answertime','lastevent','[%s][dials][dialend]\x20dialstatus:%s','hangup','[%s][dials][hangup]','calleridname','cause-txt','complete','duration','diffTime','endtime'];(function(_0xaa0e2,_0x3aa20f){var _0x19a563=function(_0x2314c7){while(--_0x2314c7){_0xaa0e2['push'](_0xaa0e2['shift']());}};_0x19a563(++_0x3aa20f);}(_0xd177,0x1c4));var _0x7d17=function(_0x51b02d,_0x23dd0b){_0x51b02d=_0x51b02d-0x0;var _0x26f769=_0xd177[_0x51b02d];return _0x26f769;};'use strict';var _=require(_0x7d17('0x0'));var util=require(_0x7d17('0x1'));var utils=require('./utils');var dials={};function writeDB(_0x5d27c2){utils['info'](util[_0x7d17('0x2')](_0x7d17('0x3'),_0x5d27c2[_0x7d17('0x4')],_0x5d27c2[_0x7d17('0x5')],_0x5d27c2['dialstring'],_0x5d27c2[_0x7d17('0x6')],_0x5d27c2['connectedlinenum'],_0x5d27c2[_0x7d17('0x7')]));utils[_0x7d17('0x8')](_0x7d17('0x9'),_0x5d27c2);delete dials[_0x5d27c2[_0x7d17('0x4')]];}exports[_0x7d17('0xa')]=function(_0x3b25b4){try{utils[_0x7d17('0xb')](util[_0x7d17('0x2')]('[%s][dials][newexten]',_0x3b25b4[_0x7d17('0x4')]),_0x3b25b4);utils[_0x7d17('0xc')](util[_0x7d17('0x2')](_0x7d17('0xd'),_0x3b25b4[_0x7d17('0x4')],_0x3b25b4['application'],_0x3b25b4['appdata']));if(_0x3b25b4['application'][_0x7d17('0xe')]()==_0x7d17('0xf')&&_[_0x7d17('0x10')](_0x3b25b4['appdata']['toLowerCase'](),_0x7d17('0x11'))){var _0x3aedcb=_0x3b25b4[_0x7d17('0x12')][_0x7d17('0x13')]('=');dials[_0x3b25b4[_0x7d17('0x4')]]={'routeId':_0x3aedcb[0x1]};}}catch(_0x563fb6){utils[_0x7d17('0x14')](util['format']('[%s][dials][newexten]',_0x3b25b4[_0x7d17('0x4')]),_0x563fb6);}};exports[_0x7d17('0x15')]=function(_0x4b8932){try{utils[_0x7d17('0xb')](util['format'](_0x7d17('0x16'),_0x4b8932['uniqueid']),_0x4b8932);if(!_[_0x7d17('0x17')](_0x4b8932[_0x7d17('0x18')][_0x7d17('0x19')])){utils[_0x7d17('0xc')](util[_0x7d17('0x2')](_0x7d17('0x1a'),_0x4b8932[_0x7d17('0x4')],_0x4b8932[_0x7d17('0x1b')]));dials[_0x4b8932[_0x7d17('0x4')]]={'routeId':_0x4b8932['value']};}}catch(_0x3ec6e1){utils[_0x7d17('0x14')](util[_0x7d17('0x2')](_0x7d17('0x16'),_0x4b8932[_0x7d17('0x4')]),_0x3ec6e1);}};exports[_0x7d17('0x1c')]=function(_0x42242e){try{if(!_[_0x7d17('0x17')](dials[_0x42242e[_0x7d17('0x4')]])){utils['debug'](util['format'](_0x7d17('0x1d'),_0x42242e[_0x7d17('0x4')]),_0x42242e);dials[_0x42242e[_0x7d17('0x4')]]=_[_0x7d17('0x1e')](dials[_0x42242e['uniqueid']],_0x42242e);dials[_0x42242e['uniqueid']][_0x7d17('0x1f')]=utils[_0x7d17('0x20')]();dials[_0x42242e[_0x7d17('0x4')]]['lastevent']='called';utils[_0x7d17('0xc')](util[_0x7d17('0x2')](_0x7d17('0x21'),_0x42242e['uniqueid'],dials[_0x42242e[_0x7d17('0x4')]]['starttime']));}}catch(_0x4e5167){utils[_0x7d17('0x14')](util['format']('[%s][dials][dialbegin]',_0x42242e[_0x7d17('0x4')]),_0x4e5167);}};exports[_0x7d17('0x22')]=function(_0x50c911){try{if(!_[_0x7d17('0x17')](dials[_0x50c911[_0x7d17('0x4')]])){utils[_0x7d17('0xb')](util[_0x7d17('0x2')](_0x7d17('0x23'),_0x50c911[_0x7d17('0x4')]),_0x50c911);dials[_0x50c911[_0x7d17('0x4')]]['dialstatus']=_0x50c911[_0x7d17('0x7')];if(_0x50c911['dialstatus']==_0x7d17('0x24')){dials[_0x50c911[_0x7d17('0x4')]]=_[_0x7d17('0x1e')](dials[_0x50c911['uniqueid']],_0x50c911);dials[_0x50c911[_0x7d17('0x4')]][_0x7d17('0x25')]=utils[_0x7d17('0x20')]();dials[_0x50c911[_0x7d17('0x4')]][_0x7d17('0x26')]='connect';utils[_0x7d17('0xc')](util[_0x7d17('0x2')]('[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect',_0x50c911[_0x7d17('0x4')],_0x50c911[_0x7d17('0x7')],dials[_0x50c911['uniqueid']][_0x7d17('0x25')]));}else{utils[_0x7d17('0xc')](util[_0x7d17('0x2')](_0x7d17('0x27'),_0x50c911['uniqueid'],_0x50c911['dialstatus']));}}}catch(_0x2c4f28){utils[_0x7d17('0x14')](util[_0x7d17('0x2')](_0x7d17('0x23'),_0x50c911[_0x7d17('0x4')]),_0x2c4f28);}};exports[_0x7d17('0x28')]=function(_0x20fc5c){try{if(!_[_0x7d17('0x17')](dials[_0x20fc5c['uniqueid']])){utils[_0x7d17('0xb')](util[_0x7d17('0x2')](_0x7d17('0x29'),_0x20fc5c['uniqueid']),_0x20fc5c);utils[_0x7d17('0xc')](util['format']('[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s',_0x20fc5c[_0x7d17('0x4')],_0x20fc5c[_0x7d17('0x6')],_0x20fc5c[_0x7d17('0x2a')],_0x20fc5c[_0x7d17('0x2b')]));dials[_0x20fc5c[_0x7d17('0x4')]]=_['assign'](dials[_0x20fc5c['uniqueid']],{'endtime':utils[_0x7d17('0x20')](),'lastevent':_0x7d17('0x2c')});dials[_0x20fc5c[_0x7d17('0x4')]][_0x7d17('0x2d')]=utils[_0x7d17('0x2e')](dials[_0x20fc5c[_0x7d17('0x4')]][_0x7d17('0x2f')],dials[_0x20fc5c[_0x7d17('0x4')]][_0x7d17('0x1f')]);dials[_0x20fc5c[_0x7d17('0x4')]][_0x7d17('0x30')]=utils[_0x7d17('0x2e')](dials[_0x20fc5c['uniqueid']][_0x7d17('0x25')]||dials[_0x20fc5c[_0x7d17('0x4')]]['endtime'],dials[_0x20fc5c['uniqueid']][_0x7d17('0x1f')]);dials[_0x20fc5c[_0x7d17('0x4')]][_0x7d17('0x31')]=dials[_0x20fc5c['uniqueid']][_0x7d17('0x25')]?utils[_0x7d17('0x2e')](dials[_0x20fc5c['uniqueid']]['endtime'],dials[_0x20fc5c['uniqueid']][_0x7d17('0x25')]):0x0;writeDB(dials[_0x20fc5c[_0x7d17('0x4')]]);}}catch(_0x366a37){utils[_0x7d17('0x14')](util[_0x7d17('0x2')](_0x7d17('0x29'),_0x20fc5c[_0x7d17('0x4')]),_0x366a37);}}; \ No newline at end of file +var _0xd90d=['split','error','varset','[%s][dials][varset]','variable','outboundrouteid','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','dialbegin','[%s][dials][dialbegin]','assign','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','dialend','isNil','[%s][dials][dialend]','ANSWER','answertime','now','lastevent','connect','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','[%s][dials][dialend]\x20dialstatus:%s','hangup','[%s][dials][hangup]','calleridname','cause-txt','diffTime','endtime','starttime','holdtime','lodash','util','./utils','info','format','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','calleridnum','connectedlinenum','dialstatus','request','CreateVoiceDialReport','uniqueid','newexten','debug','[%s][dials][newexten]','application','set','startsWith','appdata','toLowerCase','cdr(routeid)'];(function(_0x139db9,_0x31ce3a){var _0x1dc75b=function(_0x1735dd){while(--_0x1735dd){_0x139db9['push'](_0x139db9['shift']());}};_0x1dc75b(++_0x31ce3a);}(_0xd90d,0x150));var _0xdd90=function(_0x1d9aa0,_0x272488){_0x1d9aa0=_0x1d9aa0-0x0;var _0x226868=_0xd90d[_0x1d9aa0];return _0x226868;};'use strict';var _=require(_0xdd90('0x0'));var util=require(_0xdd90('0x1'));var utils=require(_0xdd90('0x2'));var dials={};function writeDB(_0x50b39d){utils[_0xdd90('0x3')](util[_0xdd90('0x4')](_0xdd90('0x5'),_0x50b39d['uniqueid'],_0x50b39d['channel'],_0x50b39d['dialstring'],_0x50b39d[_0xdd90('0x6')],_0x50b39d[_0xdd90('0x7')],_0x50b39d[_0xdd90('0x8')]));utils[_0xdd90('0x9')](_0xdd90('0xa'),_0x50b39d);delete dials[_0x50b39d[_0xdd90('0xb')]];}exports[_0xdd90('0xc')]=function(_0x1f8311){try{utils[_0xdd90('0xd')](util['format'](_0xdd90('0xe'),_0x1f8311[_0xdd90('0xb')]),_0x1f8311);utils[_0xdd90('0x3')](util['format']('[%s][dials][newexten]\x20application:%s\x20appdata:%s',_0x1f8311['uniqueid'],_0x1f8311[_0xdd90('0xf')],_0x1f8311['appdata']));if(_0x1f8311['application']['toLowerCase']()==_0xdd90('0x10')&&_[_0xdd90('0x11')](_0x1f8311[_0xdd90('0x12')][_0xdd90('0x13')](),_0xdd90('0x14'))){var _0x556671=_0x1f8311['appdata'][_0xdd90('0x15')]('=');dials[_0x1f8311[_0xdd90('0xb')]]={'routeId':_0x556671[0x1]};}}catch(_0x4ee2c1){utils[_0xdd90('0x16')](util['format'](_0xdd90('0xe'),_0x1f8311[_0xdd90('0xb')]),_0x4ee2c1);}};exports[_0xdd90('0x17')]=function(_0x7ea57){try{utils['debug'](util['format'](_0xdd90('0x18'),_0x7ea57[_0xdd90('0xb')]),_0x7ea57);if(!_['isNil'](_0x7ea57[_0xdd90('0x19')][_0xdd90('0x1a')])){utils[_0xdd90('0x3')](util[_0xdd90('0x4')](_0xdd90('0x1b'),_0x7ea57['uniqueid'],_0x7ea57[_0xdd90('0x1c')]));dials[_0x7ea57[_0xdd90('0xb')]]={'routeId':_0x7ea57['value']};}}catch(_0x129703){utils['error'](util['format'](_0xdd90('0x18'),_0x7ea57[_0xdd90('0xb')]),_0x129703);}};exports[_0xdd90('0x1d')]=function(_0x24b8e8){try{if(!_['isNil'](dials[_0x24b8e8[_0xdd90('0xb')]])){utils['debug'](util[_0xdd90('0x4')](_0xdd90('0x1e'),_0x24b8e8[_0xdd90('0xb')]),_0x24b8e8);dials[_0x24b8e8[_0xdd90('0xb')]]=_[_0xdd90('0x1f')](dials[_0x24b8e8[_0xdd90('0xb')]],_0x24b8e8);dials[_0x24b8e8[_0xdd90('0xb')]]['starttime']=utils['now']();dials[_0x24b8e8['uniqueid']]['lastevent']='called';utils['info'](util[_0xdd90('0x4')](_0xdd90('0x20'),_0x24b8e8[_0xdd90('0xb')],dials[_0x24b8e8[_0xdd90('0xb')]]['starttime']));}}catch(_0xee8a34){utils['error'](util[_0xdd90('0x4')](_0xdd90('0x1e'),_0x24b8e8[_0xdd90('0xb')]),_0xee8a34);}};exports[_0xdd90('0x21')]=function(_0x25d78b){try{if(!_[_0xdd90('0x22')](dials[_0x25d78b[_0xdd90('0xb')]])){utils['debug'](util[_0xdd90('0x4')](_0xdd90('0x23'),_0x25d78b[_0xdd90('0xb')]),_0x25d78b);dials[_0x25d78b['uniqueid']][_0xdd90('0x8')]=_0x25d78b[_0xdd90('0x8')];if(_0x25d78b[_0xdd90('0x8')]==_0xdd90('0x24')){dials[_0x25d78b[_0xdd90('0xb')]]=_[_0xdd90('0x1f')](dials[_0x25d78b[_0xdd90('0xb')]],_0x25d78b);dials[_0x25d78b[_0xdd90('0xb')]][_0xdd90('0x25')]=utils[_0xdd90('0x26')]();dials[_0x25d78b[_0xdd90('0xb')]][_0xdd90('0x27')]=_0xdd90('0x28');utils[_0xdd90('0x3')](util[_0xdd90('0x4')](_0xdd90('0x29'),_0x25d78b[_0xdd90('0xb')],_0x25d78b[_0xdd90('0x8')],dials[_0x25d78b[_0xdd90('0xb')]][_0xdd90('0x25')]));}else{utils[_0xdd90('0x3')](util[_0xdd90('0x4')](_0xdd90('0x2a'),_0x25d78b[_0xdd90('0xb')],_0x25d78b[_0xdd90('0x8')]));}}}catch(_0x40f679){utils[_0xdd90('0x16')](util[_0xdd90('0x4')](_0xdd90('0x23'),_0x25d78b[_0xdd90('0xb')]),_0x40f679);}};exports[_0xdd90('0x2b')]=function(_0x48ab47){try{if(!_['isNil'](dials[_0x48ab47[_0xdd90('0xb')]])){utils[_0xdd90('0xd')](util[_0xdd90('0x4')](_0xdd90('0x2c'),_0x48ab47[_0xdd90('0xb')]),_0x48ab47);utils[_0xdd90('0x3')](util['format']('[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s',_0x48ab47[_0xdd90('0xb')],_0x48ab47[_0xdd90('0x6')],_0x48ab47[_0xdd90('0x2d')],_0x48ab47[_0xdd90('0x2e')]));dials[_0x48ab47[_0xdd90('0xb')]]=_['assign'](dials[_0x48ab47[_0xdd90('0xb')]],{'endtime':utils[_0xdd90('0x26')](),'lastevent':'complete'});dials[_0x48ab47['uniqueid']]['duration']=utils[_0xdd90('0x2f')](dials[_0x48ab47['uniqueid']][_0xdd90('0x30')],dials[_0x48ab47[_0xdd90('0xb')]][_0xdd90('0x31')]);dials[_0x48ab47[_0xdd90('0xb')]][_0xdd90('0x32')]=utils['diffTime'](dials[_0x48ab47['uniqueid']][_0xdd90('0x25')]||dials[_0x48ab47[_0xdd90('0xb')]][_0xdd90('0x30')],dials[_0x48ab47[_0xdd90('0xb')]]['starttime']);dials[_0x48ab47[_0xdd90('0xb')]]['billableseconds']=dials[_0x48ab47[_0xdd90('0xb')]]['answertime']?utils[_0xdd90('0x2f')](dials[_0x48ab47[_0xdd90('0xb')]][_0xdd90('0x30')],dials[_0x48ab47[_0xdd90('0xb')]]['answertime']):0x0;writeDB(dials[_0x48ab47[_0xdd90('0xb')]]);}}catch(_0x315465){utils[_0xdd90('0x16')](util[_0xdd90('0x4')](_0xdd90('0x2c'),_0x48ab47['uniqueid']),_0x315465);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index bbc79a0..c8c4250 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 _0xfbe6=['production','asterisk','port','username','password','keepConnected','info','XDR\x20DISABLED','./agents.controller','./calls.controller','./queues.controller','./recordings.controller','./members.controller','./dials.controller','./transfers.controller','./core.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','format','[%s][index][devicestatechange]','device','agentcalled','[%s][index][agentcalled]','uniqueid','debug','[%s][index][agentringnoanswer]','agentringnoanswer','agentconnect','[%s][index][agentconnect]','agentcomplete','[%s][index][agentcomplete]','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','[%s][index][queuecallerjoin]','queuecallerleave','[%s][index][queuecallerleave]','musiconholdstart','[%s][index][musiconholdstart]','[%s][index][musiconholdstop]','musiconholdstop','[%s][index][newstate]','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]','newchannel','[%s][index][newchannel]','dialbegin','[%s]dialbegin','dialend','[%s][index][dialend]','asterisk-manager','../../config/environment','./utils','util','disabled','xdr','env'];(function(_0x554a48,_0x3b0b29){var _0x4cd1dc=function(_0x420dff){while(--_0x420dff){_0x554a48['push'](_0x554a48['shift']());}};_0x4cd1dc(++_0x3b0b29);}(_0xfbe6,0x16b));var _0x6fbe=function(_0x2c1b1c,_0x5e9c8e){_0x2c1b1c=_0x2c1b1c-0x0;var _0x1520fb=_0xfbe6[_0x2c1b1c];return _0x1520fb;};var AsteriskManager=require(_0x6fbe('0x0'));var config=require(_0x6fbe('0x1'));var utils=require(_0x6fbe('0x2'));var util=require(_0x6fbe('0x3'));var isXDREnabled=config['xdr']&&config['xdr'][_0x6fbe('0x4')]?!config[_0x6fbe('0x5')]['disabled']:!![];var isProduction=config[_0x6fbe('0x6')]===_0x6fbe('0x7')||![];var isLocalAsterisk=config[_0x6fbe('0x5')]&&config['xdr']['local']===!![]||![];var ami=new AsteriskManager(config[_0x6fbe('0x8')][_0x6fbe('0x9')],config[_0x6fbe('0x8')]['ip'],config['asterisk'][_0x6fbe('0xa')],config[_0x6fbe('0x8')][_0x6fbe('0xb')],!![]);ami[_0x6fbe('0xc')]();if(!isXDREnabled){utils[_0x6fbe('0xd')](_0x6fbe('0xe'));}else if(!isProduction&&!isLocalAsterisk){utils[_0x6fbe('0xd')]('Asterisk\x20disabled\x20on\x20localhost');}else{var agents=require(_0x6fbe('0xf'));var calls=require(_0x6fbe('0x10'));var queues=require(_0x6fbe('0x11'));var recordings=require(_0x6fbe('0x12'));var members=require(_0x6fbe('0x13'));var dials=require(_0x6fbe('0x14'));var transfers=require(_0x6fbe('0x15'));var core=require(_0x6fbe('0x16'));ami['on'](_0x6fbe('0x17'),core[_0x6fbe('0x17')]);ami['on']('shutdown',core[_0x6fbe('0x18')]);ami['on'](_0x6fbe('0x19'),core['fullybooted']);ami['on'](_0x6fbe('0x1a'),core[_0x6fbe('0x1a')]);ami['on'](_0x6fbe('0x1b'),core[_0x6fbe('0x1b')]);ami['on'](_0x6fbe('0x1c'),core['managerevent']);ami['on'](_0x6fbe('0x1d'),function(_0x15129e){try{utils['debug'](util[_0x6fbe('0x1e')](_0x6fbe('0x1f'),_0x15129e[_0x6fbe('0x20')]),_0x15129e);members[_0x6fbe('0x1d')](_0x15129e);}catch(_0x4246d9){utils['error'](util['format']('[%s][index][devicestatechange]',_0x15129e[_0x6fbe('0x20')]),_0x4246d9);}});ami['on'](_0x6fbe('0x21'),function(_0x5b7a2f){try{utils['debug'](util[_0x6fbe('0x1e')](_0x6fbe('0x22'),_0x5b7a2f[_0x6fbe('0x23')]),_0x5b7a2f);agents[_0x6fbe('0x21')](_0x5b7a2f);}catch(_0x41e232){utils[_0x6fbe('0x1a')](util[_0x6fbe('0x1e')](_0x6fbe('0x22'),_0x5b7a2f[_0x6fbe('0x23')]),_0x41e232);}});ami['on']('agentringnoanswer',function(_0x4eaf29){try{utils[_0x6fbe('0x24')](util[_0x6fbe('0x1e')](_0x6fbe('0x25'),_0x4eaf29['uniqueid']),_0x4eaf29);agents[_0x6fbe('0x26')](_0x4eaf29);}catch(_0x1d4b9c){utils[_0x6fbe('0x1a')](util[_0x6fbe('0x1e')](_0x6fbe('0x25'),_0x4eaf29['uniqueid']),_0x1d4b9c);}});ami['on'](_0x6fbe('0x27'),function(_0x4aa2cf){try{utils[_0x6fbe('0x24')](util['format'](_0x6fbe('0x28'),_0x4aa2cf[_0x6fbe('0x23')]),_0x4aa2cf);agents[_0x6fbe('0x27')](_0x4aa2cf);queues['agentconnect'](_0x4aa2cf);}catch(_0x2e8a55){utils[_0x6fbe('0x1a')](util['format']('[%s][index][agentconnect]',_0x4aa2cf[_0x6fbe('0x23')]),_0x2e8a55);}});ami['on'](_0x6fbe('0x29'),function(_0x68fa01){try{utils[_0x6fbe('0x24')](util[_0x6fbe('0x1e')]('[%s][index][agentcomplete]',_0x68fa01[_0x6fbe('0x23')]),_0x68fa01);agents['agentcomplete'](_0x68fa01);queues[_0x6fbe('0x29')](_0x68fa01);members[_0x6fbe('0x29')](_0x68fa01);}catch(_0x2f9ec0){utils[_0x6fbe('0x1a')](util[_0x6fbe('0x1e')](_0x6fbe('0x2a'),_0x68fa01[_0x6fbe('0x23')]),_0x2f9ec0);}});ami['on'](_0x6fbe('0x2b'),function(_0x54a6a9){try{utils[_0x6fbe('0x24')](util[_0x6fbe('0x1e')](_0x6fbe('0x2c'),_0x54a6a9[_0x6fbe('0x23')]),_0x54a6a9);agents[_0x6fbe('0x2b')](_0x54a6a9);queues[_0x6fbe('0x2b')](_0x54a6a9);}catch(_0x27c26e){utils['error'](util[_0x6fbe('0x1e')](_0x6fbe('0x2c'),_0x54a6a9[_0x6fbe('0x23')]),_0x27c26e);}});ami['on'](_0x6fbe('0x2d'),function(_0x24d671){try{utils[_0x6fbe('0x24')](util['format'](_0x6fbe('0x2e'),_0x24d671[_0x6fbe('0x23')]),_0x24d671);queues[_0x6fbe('0x2d')](_0x24d671);recordings[_0x6fbe('0x2d')](_0x24d671);}catch(_0x47b29b){utils[_0x6fbe('0x1a')](util[_0x6fbe('0x1e')](_0x6fbe('0x2e'),_0x24d671[_0x6fbe('0x23')]),_0x47b29b);}});ami['on'](_0x6fbe('0x2f'),function(_0x3849b4){try{utils[_0x6fbe('0x24')](util[_0x6fbe('0x1e')]('[%s][index][queuecallerleave]',_0x3849b4[_0x6fbe('0x23')]),_0x3849b4);queues['queuecallerleave'](_0x3849b4);}catch(_0x421a94){utils[_0x6fbe('0x1a')](util['format'](_0x6fbe('0x30'),_0x3849b4[_0x6fbe('0x23')]),_0x421a94);}});ami['on'](_0x6fbe('0x31'),function(_0x191218){try{utils[_0x6fbe('0x24')](util['format'](_0x6fbe('0x32'),_0x191218[_0x6fbe('0x23')]),_0x191218);queues[_0x6fbe('0x31')](_0x191218);calls['musiconholdstart'](_0x191218);}catch(_0x596e12){utils[_0x6fbe('0x1a')](util['format'](_0x6fbe('0x32'),_0x191218[_0x6fbe('0x23')]),_0x596e12);}});ami['on']('musiconholdstop',function(_0x6a906b){try{utils[_0x6fbe('0x24')](util['format'](_0x6fbe('0x33'),_0x6a906b[_0x6fbe('0x23')]),_0x6a906b);queues[_0x6fbe('0x34')](_0x6a906b);calls[_0x6fbe('0x34')](_0x6a906b);}catch(_0x9e4139){utils[_0x6fbe('0x1a')](util['format']('[%s][index][musiconholdstop]',_0x6a906b['uniqueid']),_0x9e4139);}});ami['on']('newstate',function(_0x5351dc){try{utils[_0x6fbe('0x24')](util[_0x6fbe('0x1e')](_0x6fbe('0x35'),_0x5351dc[_0x6fbe('0x23')]),_0x5351dc);calls[_0x6fbe('0x36')](_0x5351dc);recordings[_0x6fbe('0x36')](_0x5351dc);}catch(_0x2b66e7){utils[_0x6fbe('0x1a')](util['format'](_0x6fbe('0x35'),_0x5351dc[_0x6fbe('0x23')]),_0x2b66e7);}});ami['on']('hangup',function(_0x5f104e){try{utils[_0x6fbe('0x24')](util['format'](_0x6fbe('0x37'),_0x5f104e['uniqueid']),_0x5f104e);calls[_0x6fbe('0x38')](_0x5f104e);recordings['hangup'](_0x5f104e);dials[_0x6fbe('0x38')](_0x5f104e);agents[_0x6fbe('0x38')](_0x5f104e);queues[_0x6fbe('0x38')](_0x5f104e);}catch(_0x445dc2){utils[_0x6fbe('0x1a')](util['format'](_0x6fbe('0x37'),_0x5f104e[_0x6fbe('0x23')]),_0x445dc2);}});ami['on'](_0x6fbe('0x39'),function(_0x1d6dc4){try{utils[_0x6fbe('0x24')](util[_0x6fbe('0x1e')]('[%s][index][cdr]',_0x1d6dc4['uniqueid']),_0x1d6dc4);members['cdr'](_0x1d6dc4);}catch(_0x2786d8){utils[_0x6fbe('0x1a')](util[_0x6fbe('0x1e')](_0x6fbe('0x3a'),_0x1d6dc4[_0x6fbe('0x23')]),_0x2786d8);}});ami['on'](_0x6fbe('0x3b'),function(_0x2d06ad){try{utils['debug'](util[_0x6fbe('0x1e')](_0x6fbe('0x3c'),_0x2d06ad[_0x6fbe('0x23')]),_0x2d06ad);queues['blindtransfer'](_0x2d06ad);agents[_0x6fbe('0x3b')](_0x2d06ad);transfers[_0x6fbe('0x3b')](_0x2d06ad);}catch(_0x474717){utils[_0x6fbe('0x1a')](util[_0x6fbe('0x1e')](_0x6fbe('0x3c'),_0x2d06ad[_0x6fbe('0x23')]),_0x474717);}});ami['on'](_0x6fbe('0x3d'),function(_0x4941ef){try{utils[_0x6fbe('0x24')](util['format']('[%s][index][attendedtransfer]',_0x4941ef[_0x6fbe('0x3e')]),_0x4941ef);queues[_0x6fbe('0x3d')](_0x4941ef);transfers[_0x6fbe('0x3d')](_0x4941ef);agents['attendedtransfer'](_0x4941ef);calls[_0x6fbe('0x3d')](_0x4941ef);}catch(_0x12fc7c){utils[_0x6fbe('0x1a')](util[_0x6fbe('0x1e')](_0x6fbe('0x3f'),_0x4941ef['origtransfereruniqueid']),_0x12fc7c);}});ami['on'](_0x6fbe('0x40'),function(_0x491b8c){try{utils[_0x6fbe('0x24')](util['format'](_0x6fbe('0x41'),_0x491b8c[_0x6fbe('0x23')]),_0x491b8c);queues[_0x6fbe('0x40')](_0x491b8c);recordings['varset'](_0x491b8c);calls[_0x6fbe('0x40')](_0x491b8c);dials[_0x6fbe('0x40')](_0x491b8c);}catch(_0x5bfb62){utils[_0x6fbe('0x1a')](util[_0x6fbe('0x1e')]('[%s][index][varset]',_0x491b8c['uniqueid']),_0x5bfb62);}});ami['on'](_0x6fbe('0x42'),function(_0x11ad6d){try{utils[_0x6fbe('0x24')](util['format']('[%s][index][newexten]',_0x11ad6d[_0x6fbe('0x23')]),_0x11ad6d);calls[_0x6fbe('0x42')](_0x11ad6d);recordings[_0x6fbe('0x42')](_0x11ad6d);dials[_0x6fbe('0x42')](_0x11ad6d);}catch(_0x24f9e0){utils['error'](util[_0x6fbe('0x1e')](_0x6fbe('0x43'),_0x11ad6d[_0x6fbe('0x23')]),_0x24f9e0);}});ami['on'](_0x6fbe('0x44'),function(_0x4d5e0c){try{utils[_0x6fbe('0x24')](util['format'](_0x6fbe('0x45'),_0x4d5e0c[_0x6fbe('0x23')]),_0x4d5e0c);calls[_0x6fbe('0x44')](_0x4d5e0c);recordings[_0x6fbe('0x44')](_0x4d5e0c);}catch(_0xc68ea4){utils[_0x6fbe('0x1a')](util[_0x6fbe('0x1e')]('[%s][index][newchannel]',_0x4d5e0c[_0x6fbe('0x23')]),_0xc68ea4);}});ami['on'](_0x6fbe('0x46'),function(_0x4d2098){try{utils[_0x6fbe('0x24')](util[_0x6fbe('0x1e')]('[%s][index][dialbegin]',_0x4d2098[_0x6fbe('0x23')]),_0x4d2098);dials['dialbegin'](_0x4d2098);}catch(_0x575fa5){utils[_0x6fbe('0x1a')](util[_0x6fbe('0x1e')](_0x6fbe('0x47'),_0x4d2098[_0x6fbe('0x23')]),_0x575fa5);}});ami['on']('dialend',function(_0x5bba1b){try{utils[_0x6fbe('0x24')](util['format']('[%s][index][dialend]',_0x5bba1b[_0x6fbe('0x23')]),_0x5bba1b);dials[_0x6fbe('0x48')](_0x5bba1b);}catch(_0x2cad1a){utils[_0x6fbe('0x1a')](util[_0x6fbe('0x1e')](_0x6fbe('0x49'),_0x5bba1b[_0x6fbe('0x23')]),_0x2cad1a);}});} \ No newline at end of file +var _0x9b89=['blindtransfer','[%s][index][blindtransfer]','attendedtransfer','[%s][index][attendedtransfer]','origtransfereruniqueid','varset','[%s][index][varset]','[%s][index][newexten]','newexten','newchannel','[%s][index][newchannel]','dialbegin','[%s][index][dialbegin]','[%s]dialbegin','dialend','[%s][index][dialend]','asterisk-manager','../../config/environment','./utils','util','xdr','disabled','env','production','local','port','asterisk','username','keepConnected','XDR\x20DISABLED','info','./agents.controller','./calls.controller','./queues.controller','./recordings.controller','./members.controller','./dials.controller','connect','shutdown','fullybooted','close','managerevent','devicestatechange','format','[%s][index][devicestatechange]','device','error','[%s][index][agentcalled]','uniqueid','agentcalled','agentringnoanswer','debug','[%s][index][agentringnoanswer]','agentconnect','[%s][index][agentconnect]','agentcomplete','[%s][index][agentcomplete]','queuecallerabandon','[%s][index][queuecallerabandon]','[%s][index][queuecallerjoin]','queuecallerjoin','queuecallerleave','[%s][index][queuecallerleave]','musiconholdstart','[%s][index][musiconholdstart]','musiconholdstop','[%s][index][musiconholdstop]','newstate','[%s][index][newstate]','hangup','[%s][index][hangup]','cdr','[%s][index][cdr]'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0x9b89,0x17d));var _0x99b8=function(_0xa89e00,_0x321240){_0xa89e00=_0xa89e00-0x0;var _0x12bcc8=_0x9b89[_0xa89e00];return _0x12bcc8;};var AsteriskManager=require(_0x99b8('0x0'));var config=require(_0x99b8('0x1'));var utils=require(_0x99b8('0x2'));var util=require(_0x99b8('0x3'));var isXDREnabled=config[_0x99b8('0x4')]&&config[_0x99b8('0x4')][_0x99b8('0x5')]?!config[_0x99b8('0x4')]['disabled']:!![];var isProduction=config[_0x99b8('0x6')]===_0x99b8('0x7')||![];var isLocalAsterisk=config[_0x99b8('0x4')]&&config[_0x99b8('0x4')][_0x99b8('0x8')]===!![]||![];var ami=new AsteriskManager(config['asterisk'][_0x99b8('0x9')],config['asterisk']['ip'],config[_0x99b8('0xa')][_0x99b8('0xb')],config[_0x99b8('0xa')]['password'],!![]);ami[_0x99b8('0xc')]();if(!isXDREnabled){utils['info'](_0x99b8('0xd'));}else if(!isProduction&&!isLocalAsterisk){utils[_0x99b8('0xe')]('Asterisk\x20disabled\x20on\x20localhost');}else{var agents=require(_0x99b8('0xf'));var calls=require(_0x99b8('0x10'));var queues=require(_0x99b8('0x11'));var recordings=require(_0x99b8('0x12'));var members=require(_0x99b8('0x13'));var dials=require(_0x99b8('0x14'));var transfers=require('./transfers.controller');var core=require('./core.controller');ami['on'](_0x99b8('0x15'),core[_0x99b8('0x15')]);ami['on'](_0x99b8('0x16'),core[_0x99b8('0x16')]);ami['on']('fullybooted',core[_0x99b8('0x17')]);ami['on']('error',core['error']);ami['on'](_0x99b8('0x18'),core[_0x99b8('0x18')]);ami['on'](_0x99b8('0x19'),core[_0x99b8('0x19')]);ami['on'](_0x99b8('0x1a'),function(_0x47de39){try{utils['debug'](util[_0x99b8('0x1b')](_0x99b8('0x1c'),_0x47de39[_0x99b8('0x1d')]),_0x47de39);members[_0x99b8('0x1a')](_0x47de39);}catch(_0x3bd349){utils[_0x99b8('0x1e')](util['format'](_0x99b8('0x1c'),_0x47de39[_0x99b8('0x1d')]),_0x3bd349);}});ami['on']('agentcalled',function(_0x34f173){try{utils['debug'](util[_0x99b8('0x1b')](_0x99b8('0x1f'),_0x34f173[_0x99b8('0x20')]),_0x34f173);agents[_0x99b8('0x21')](_0x34f173);}catch(_0x438015){utils[_0x99b8('0x1e')](util[_0x99b8('0x1b')](_0x99b8('0x1f'),_0x34f173[_0x99b8('0x20')]),_0x438015);}});ami['on'](_0x99b8('0x22'),function(_0x222093){try{utils[_0x99b8('0x23')](util[_0x99b8('0x1b')](_0x99b8('0x24'),_0x222093[_0x99b8('0x20')]),_0x222093);agents['agentringnoanswer'](_0x222093);}catch(_0x10d245){utils['error'](util[_0x99b8('0x1b')](_0x99b8('0x24'),_0x222093['uniqueid']),_0x10d245);}});ami['on'](_0x99b8('0x25'),function(_0x2e8689){try{utils[_0x99b8('0x23')](util[_0x99b8('0x1b')](_0x99b8('0x26'),_0x2e8689[_0x99b8('0x20')]),_0x2e8689);agents[_0x99b8('0x25')](_0x2e8689);queues[_0x99b8('0x25')](_0x2e8689);}catch(_0x1c244f){utils[_0x99b8('0x1e')](util[_0x99b8('0x1b')](_0x99b8('0x26'),_0x2e8689[_0x99b8('0x20')]),_0x1c244f);}});ami['on'](_0x99b8('0x27'),function(_0x26f47c){try{utils['debug'](util['format'](_0x99b8('0x28'),_0x26f47c[_0x99b8('0x20')]),_0x26f47c);agents['agentcomplete'](_0x26f47c);queues['agentcomplete'](_0x26f47c);members[_0x99b8('0x27')](_0x26f47c);}catch(_0x5bc2ac){utils[_0x99b8('0x1e')](util[_0x99b8('0x1b')](_0x99b8('0x28'),_0x26f47c[_0x99b8('0x20')]),_0x5bc2ac);}});ami['on'](_0x99b8('0x29'),function(_0x9e6ec6){try{utils['debug'](util['format'](_0x99b8('0x2a'),_0x9e6ec6[_0x99b8('0x20')]),_0x9e6ec6);agents[_0x99b8('0x29')](_0x9e6ec6);queues[_0x99b8('0x29')](_0x9e6ec6);}catch(_0xe7de73){utils['error'](util[_0x99b8('0x1b')](_0x99b8('0x2a'),_0x9e6ec6[_0x99b8('0x20')]),_0xe7de73);}});ami['on']('queuecallerjoin',function(_0x7205d6){try{utils['debug'](util[_0x99b8('0x1b')](_0x99b8('0x2b'),_0x7205d6['uniqueid']),_0x7205d6);queues[_0x99b8('0x2c')](_0x7205d6);recordings['queuecallerjoin'](_0x7205d6);}catch(_0x4123ef){utils[_0x99b8('0x1e')](util['format'](_0x99b8('0x2b'),_0x7205d6[_0x99b8('0x20')]),_0x4123ef);}});ami['on'](_0x99b8('0x2d'),function(_0x5d7aab){try{utils['debug'](util[_0x99b8('0x1b')]('[%s][index][queuecallerleave]',_0x5d7aab[_0x99b8('0x20')]),_0x5d7aab);queues[_0x99b8('0x2d')](_0x5d7aab);}catch(_0x32f453){utils[_0x99b8('0x1e')](util['format'](_0x99b8('0x2e'),_0x5d7aab['uniqueid']),_0x32f453);}});ami['on'](_0x99b8('0x2f'),function(_0x3e7291){try{utils[_0x99b8('0x23')](util[_0x99b8('0x1b')](_0x99b8('0x30'),_0x3e7291[_0x99b8('0x20')]),_0x3e7291);queues[_0x99b8('0x2f')](_0x3e7291);calls['musiconholdstart'](_0x3e7291);}catch(_0x63b902){utils[_0x99b8('0x1e')](util[_0x99b8('0x1b')]('[%s][index][musiconholdstart]',_0x3e7291[_0x99b8('0x20')]),_0x63b902);}});ami['on'](_0x99b8('0x31'),function(_0x1c00ac){try{utils[_0x99b8('0x23')](util[_0x99b8('0x1b')](_0x99b8('0x32'),_0x1c00ac[_0x99b8('0x20')]),_0x1c00ac);queues[_0x99b8('0x31')](_0x1c00ac);calls[_0x99b8('0x31')](_0x1c00ac);}catch(_0x31ad0d){utils[_0x99b8('0x1e')](util['format'](_0x99b8('0x32'),_0x1c00ac[_0x99b8('0x20')]),_0x31ad0d);}});ami['on'](_0x99b8('0x33'),function(_0x2ce65e){try{utils[_0x99b8('0x23')](util[_0x99b8('0x1b')](_0x99b8('0x34'),_0x2ce65e[_0x99b8('0x20')]),_0x2ce65e);calls[_0x99b8('0x33')](_0x2ce65e);recordings[_0x99b8('0x33')](_0x2ce65e);}catch(_0x5564b9){utils[_0x99b8('0x1e')](util[_0x99b8('0x1b')](_0x99b8('0x34'),_0x2ce65e[_0x99b8('0x20')]),_0x5564b9);}});ami['on'](_0x99b8('0x35'),function(_0x342df4){try{utils[_0x99b8('0x23')](util['format'](_0x99b8('0x36'),_0x342df4[_0x99b8('0x20')]),_0x342df4);calls[_0x99b8('0x35')](_0x342df4);recordings[_0x99b8('0x35')](_0x342df4);dials[_0x99b8('0x35')](_0x342df4);agents[_0x99b8('0x35')](_0x342df4);queues['hangup'](_0x342df4);}catch(_0x27a42c){utils[_0x99b8('0x1e')](util[_0x99b8('0x1b')](_0x99b8('0x36'),_0x342df4['uniqueid']),_0x27a42c);}});ami['on'](_0x99b8('0x37'),function(_0x25dea8){try{utils[_0x99b8('0x23')](util[_0x99b8('0x1b')](_0x99b8('0x38'),_0x25dea8[_0x99b8('0x20')]),_0x25dea8);members[_0x99b8('0x37')](_0x25dea8);}catch(_0x290804){utils[_0x99b8('0x1e')](util[_0x99b8('0x1b')](_0x99b8('0x38'),_0x25dea8[_0x99b8('0x20')]),_0x290804);}});ami['on'](_0x99b8('0x39'),function(_0x1f8517){try{utils[_0x99b8('0x23')](util[_0x99b8('0x1b')]('[%s][index][blindtransfer]',_0x1f8517[_0x99b8('0x20')]),_0x1f8517);queues['blindtransfer'](_0x1f8517);agents[_0x99b8('0x39')](_0x1f8517);transfers['blindtransfer'](_0x1f8517);}catch(_0x1ac566){utils['error'](util[_0x99b8('0x1b')](_0x99b8('0x3a'),_0x1f8517[_0x99b8('0x20')]),_0x1ac566);}});ami['on'](_0x99b8('0x3b'),function(_0x101821){try{utils[_0x99b8('0x23')](util[_0x99b8('0x1b')](_0x99b8('0x3c'),_0x101821[_0x99b8('0x3d')]),_0x101821);queues['attendedtransfer'](_0x101821);transfers[_0x99b8('0x3b')](_0x101821);agents[_0x99b8('0x3b')](_0x101821);calls[_0x99b8('0x3b')](_0x101821);}catch(_0x5007c8){utils[_0x99b8('0x1e')](util[_0x99b8('0x1b')]('[%s][index][attendedtransfer]',_0x101821['origtransfereruniqueid']),_0x5007c8);}});ami['on'](_0x99b8('0x3e'),function(_0x31a0c4){try{utils[_0x99b8('0x23')](util[_0x99b8('0x1b')](_0x99b8('0x3f'),_0x31a0c4[_0x99b8('0x20')]),_0x31a0c4);queues['varset'](_0x31a0c4);recordings['varset'](_0x31a0c4);calls[_0x99b8('0x3e')](_0x31a0c4);dials[_0x99b8('0x3e')](_0x31a0c4);}catch(_0x4a5c99){utils[_0x99b8('0x1e')](util['format'](_0x99b8('0x3f'),_0x31a0c4['uniqueid']),_0x4a5c99);}});ami['on']('newexten',function(_0xb80da){try{utils[_0x99b8('0x23')](util['format'](_0x99b8('0x40'),_0xb80da[_0x99b8('0x20')]),_0xb80da);calls[_0x99b8('0x41')](_0xb80da);recordings['newexten'](_0xb80da);dials[_0x99b8('0x41')](_0xb80da);}catch(_0x49d103){utils[_0x99b8('0x1e')](util[_0x99b8('0x1b')](_0x99b8('0x40'),_0xb80da[_0x99b8('0x20')]),_0x49d103);}});ami['on'](_0x99b8('0x42'),function(_0x3783e1){try{utils[_0x99b8('0x23')](util[_0x99b8('0x1b')](_0x99b8('0x43'),_0x3783e1[_0x99b8('0x20')]),_0x3783e1);calls['newchannel'](_0x3783e1);recordings[_0x99b8('0x42')](_0x3783e1);}catch(_0x1aff19){utils[_0x99b8('0x1e')](util[_0x99b8('0x1b')]('[%s][index][newchannel]',_0x3783e1[_0x99b8('0x20')]),_0x1aff19);}});ami['on'](_0x99b8('0x44'),function(_0x5c3446){try{utils['debug'](util[_0x99b8('0x1b')](_0x99b8('0x45'),_0x5c3446[_0x99b8('0x20')]),_0x5c3446);dials[_0x99b8('0x44')](_0x5c3446);}catch(_0x4fed2f){utils[_0x99b8('0x1e')](util[_0x99b8('0x1b')](_0x99b8('0x46'),_0x5c3446[_0x99b8('0x20')]),_0x4fed2f);}});ami['on']('dialend',function(_0x30a78b){try{utils['debug'](util[_0x99b8('0x1b')]('[%s][index][dialend]',_0x30a78b[_0x99b8('0x20')]),_0x30a78b);dials[_0x99b8('0x47')](_0x30a78b);}catch(_0x39efe0){utils[_0x99b8('0x1e')](util[_0x99b8('0x1b')](_0x99b8('0x48'),_0x30a78b[_0x99b8('0x20')]),_0x39efe0);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index 4425540..acfb5c9 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 _0x2cbd=['diffTime','[%s][members][devicestatechange]','agentcomplete','[%s][members][agentcomplete]','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','assign','queue','cdr','[%s][members][cdr]','data1','data3','destinationchannel','source','destination','lodash','util','Local/_attended@transfer','Queue:','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','channel','data2','membername','type','getUserByInterface','then','name','internal','request','getUserByName','interface','split','CreateMemberReport','error','uniqueid','startsWith','devicestatechange','debug','device','info','state','INUSE','BUSY','voice','TALKING','now','NOT_INUSE','isNil','exitAt','duration'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x2cbd,0x19e));var _0xd2cb=function(_0x1e5cc3,_0x238a87){_0x1e5cc3=_0x1e5cc3-0x0;var _0x15c596=_0x2cbd[_0x1e5cc3];return _0x15c596;};'use strict';var _=require(_0xd2cb('0x0'));var util=require(_0xd2cb('0x1'));var utils=require('./utils');var members={};var exclude=[_0xd2cb('0x2'),_0xd2cb('0x3')];function writeDB(_0x138022){utils['info'](util[_0xd2cb('0x4')](_0xd2cb('0x5'),_0x138022['uniqueid'],_0x138022['interface'],_0x138022[_0xd2cb('0x6')],_0x138022[_0xd2cb('0x7')],_0x138022[_0xd2cb('0x8')],_0x138022[_0xd2cb('0x9')]));if(_0x138022['interface']){utils[_0xd2cb('0xa')](_0x138022['interface'])[_0xd2cb('0xb')](function(_0x5e3bec){if(_0x5e3bec){_0x138022[_0xd2cb('0x8')]=_0x5e3bec[_0xd2cb('0xc')];_0x138022['internal']=_0x5e3bec[_0xd2cb('0xd')];utils[_0xd2cb('0xe')]('CreateMemberReport',_0x138022);}else{utils[_0xd2cb('0xf')](_0x138022[_0xd2cb('0x10')][_0xd2cb('0x11')]('/')[0x1])[_0xd2cb('0xb')](function(_0x51a1b6){if(_0x51a1b6){_0x138022['membername']=_0x51a1b6[_0xd2cb('0xc')];_0x138022[_0xd2cb('0xd')]=_0x51a1b6[_0xd2cb('0xd')];utils[_0xd2cb('0xe')](_0xd2cb('0x12'),_0x138022);}});}})['catch'](function(_0x3d6e2c){utils[_0xd2cb('0x13')](util[_0xd2cb('0x4')]('[%s][members][writeDB]',_0x138022[_0xd2cb('0x14')]),_0x3d6e2c);});}delete members[_0x138022[_0xd2cb('0x10')]];}function startsWith(_0x501e19,_0x33538d){return _['some'](_0x501e19,function(_0x4e02f7){return _[_0xd2cb('0x15')](_0x33538d,_0x4e02f7);});}exports[_0xd2cb('0x16')]=function(_0x1a24ac){try{utils[_0xd2cb('0x17')](util['format']('[%s][members][devicestatechange]',members[_0x1a24ac[_0xd2cb('0x18')]]?members[_0x1a24ac[_0xd2cb('0x18')]]['uniqueid']:_0x1a24ac[_0xd2cb('0x18')]),_0x1a24ac);utils[_0xd2cb('0x19')](util[_0xd2cb('0x4')]('[%s][members][devicestatechange]\x20state:%s\x20interface:%s',members[_0x1a24ac[_0xd2cb('0x18')]]?members[_0x1a24ac['device']]['uniqueid']:_0x1a24ac[_0xd2cb('0x18')],_0x1a24ac[_0xd2cb('0x1a')],_0x1a24ac[_0xd2cb('0x18')]));switch(_0x1a24ac['state']){case _0xd2cb('0x1b'):case _0xd2cb('0x1c'):if(!startsWith(exclude,_0x1a24ac[_0xd2cb('0x18')])){members[_0x1a24ac[_0xd2cb('0x18')]]={'channel':_0xd2cb('0x1d'),'interface':_0x1a24ac[_0xd2cb('0x18')],'type':_0xd2cb('0x1e'),'enterAt':utils[_0xd2cb('0x1f')](),'role':'agent'};}break;case _0xd2cb('0x20'):if(!_[_0xd2cb('0x21')](members[_0x1a24ac['device']])){members[_0x1a24ac[_0xd2cb('0x18')]][_0xd2cb('0x22')]=utils[_0xd2cb('0x1f')]();members[_0x1a24ac[_0xd2cb('0x18')]][_0xd2cb('0x23')]=utils[_0xd2cb('0x24')](members[_0x1a24ac['device']][_0xd2cb('0x22')],members[_0x1a24ac['device']]['enterAt']);if(members[_0x1a24ac['device']][_0xd2cb('0x14')]){writeDB(members[_0x1a24ac[_0xd2cb('0x18')]]);}}break;default:break;}}catch(_0x35ac19){utils[_0xd2cb('0x13')](util['format'](_0xd2cb('0x25'),members[_0x1a24ac[_0xd2cb('0x18')]]?members[_0x1a24ac[_0xd2cb('0x18')]][_0xd2cb('0x14')]:_0x1a24ac[_0xd2cb('0x18')]),_0x35ac19);}};exports[_0xd2cb('0x26')]=function(_0x27926d){try{if(!_[_0xd2cb('0x21')](members[_0x27926d[_0xd2cb('0x10')]])){utils[_0xd2cb('0x17')](util['format'](_0xd2cb('0x27'),_0x27926d[_0xd2cb('0x14')]),_0x27926d);utils['info'](util[_0xd2cb('0x4')](_0xd2cb('0x28'),_0x27926d[_0xd2cb('0x14')],_0x27926d[_0xd2cb('0x10')],_0x27926d['queue']));members[_0x27926d['interface']]=_[_0xd2cb('0x29')](members[_0x27926d[_0xd2cb('0x10')]],{'data4':_0x27926d[_0xd2cb('0x2a')],'uniqueid':_0x27926d[_0xd2cb('0x14')]});}}catch(_0x416c40){utils['error'](util[_0xd2cb('0x4')](_0xd2cb('0x27'),_0x27926d[_0xd2cb('0x14')]),_0x416c40);}};exports[_0xd2cb('0x2b')]=function(_0x17715d){try{utils[_0xd2cb('0x17')](util[_0xd2cb('0x4')](_0xd2cb('0x2c'),_0x17715d['uniqueid']),_0x17715d);if(_0x17715d[_0xd2cb('0x6')]){var _0x4df591=_0x17715d[_0xd2cb('0x6')][_0xd2cb('0x11')]('-')[0x0];if(!_[_0xd2cb('0x21')](members[_0x4df591])){members[_0x4df591]=_[_0xd2cb('0x29')](members[_0x4df591],{'data1':members[_0x4df591][_0xd2cb('0x2d')]||_0x17715d[_0xd2cb('0x9')],'data2':members[_0x4df591][_0xd2cb('0x7')]||_0x17715d['source'],'data3':members[_0x4df591][_0xd2cb('0x2e')]||_0x17715d['destination'],'uniqueid':members[_0x4df591]['uniqueid']||_0x17715d[_0xd2cb('0x14')]});utils[_0xd2cb('0x19')](util[_0xd2cb('0x4')]('[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s',_0x17715d[_0xd2cb('0x14')],members[_0x4df591]['data1'],members[_0x4df591][_0xd2cb('0x7')],members[_0x4df591]['data3']));if(members[_0x4df591]['exitAt']){writeDB(members[_0x4df591]);}}}if(_0x17715d[_0xd2cb('0x2f')]){var _0x11b54e=_0x17715d[_0xd2cb('0x2f')][_0xd2cb('0x11')]('-')[0x0];if(!_[_0xd2cb('0x21')](members[_0x11b54e])){members[_0x11b54e]=_[_0xd2cb('0x29')](members[_0x11b54e],{'data1':members[_0x11b54e][_0xd2cb('0x2d')]||_0x17715d['type'],'data2':members[_0x11b54e]['data2']||_0x17715d[_0xd2cb('0x30')],'data3':members[_0x11b54e][_0xd2cb('0x2e')]||_0x17715d[_0xd2cb('0x31')],'uniqueid':members[_0x11b54e][_0xd2cb('0x14')]||_0x17715d[_0xd2cb('0x14')]});utils['info'](util[_0xd2cb('0x4')]('[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s',_0x17715d['uniqueid'],members[_0x11b54e][_0xd2cb('0x2d')],members[_0x11b54e]['data2'],members[_0x11b54e][_0xd2cb('0x2e')]));if(members[_0x11b54e][_0xd2cb('0x22')]){writeDB(members[_0x11b54e]);}}}}catch(_0x5647b8){utils[_0xd2cb('0x13')](util[_0xd2cb('0x4')](_0xd2cb('0x2c'),_0x17715d[_0xd2cb('0x14')]),_0x5647b8);}}; \ No newline at end of file +var _0x8664=['[%s][members][cdr]','channel','data1','data3','destination','destinationchannel','source','lodash','util','./utils','Local/_attended@transfer','Queue:','info','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','interface','data2','membername','type','getUserByInterface','name','internal','CreateMemberReport','getUserByName','split','then','request','catch','[%s][members][writeDB]','some','startsWith','devicestatechange','debug','device','uniqueid','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','INUSE','BUSY','TALKING','now','NOT_INUSE','exitAt','duration','diffTime','enterAt','[%s][members][devicestatechange]','agentcomplete','isNil','[%s][members][agentcomplete]','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','assign','error','cdr'];(function(_0x28a8ec,_0xce6f28){var _0x5e6961=function(_0x357a49){while(--_0x357a49){_0x28a8ec['push'](_0x28a8ec['shift']());}};_0x5e6961(++_0xce6f28);}(_0x8664,0x11a));var _0x4866=function(_0x4441f1,_0x53efdc){_0x4441f1=_0x4441f1-0x0;var _0x37daff=_0x8664[_0x4441f1];return _0x37daff;};'use strict';var _=require(_0x4866('0x0'));var util=require(_0x4866('0x1'));var utils=require(_0x4866('0x2'));var members={};var exclude=[_0x4866('0x3'),_0x4866('0x4')];function writeDB(_0x65c74c){utils[_0x4866('0x5')](util[_0x4866('0x6')](_0x4866('0x7'),_0x65c74c['uniqueid'],_0x65c74c[_0x4866('0x8')],_0x65c74c['channel'],_0x65c74c[_0x4866('0x9')],_0x65c74c[_0x4866('0xa')],_0x65c74c[_0x4866('0xb')]));if(_0x65c74c[_0x4866('0x8')]){utils[_0x4866('0xc')](_0x65c74c[_0x4866('0x8')])['then'](function(_0x4185f2){if(_0x4185f2){_0x65c74c[_0x4866('0xa')]=_0x4185f2[_0x4866('0xd')];_0x65c74c[_0x4866('0xe')]=_0x4185f2[_0x4866('0xe')];utils['request'](_0x4866('0xf'),_0x65c74c);}else{utils[_0x4866('0x10')](_0x65c74c['interface'][_0x4866('0x11')]('/')[0x1])[_0x4866('0x12')](function(_0x5f11ca){if(_0x5f11ca){_0x65c74c['membername']=_0x5f11ca['name'];_0x65c74c[_0x4866('0xe')]=_0x5f11ca[_0x4866('0xe')];utils[_0x4866('0x13')](_0x4866('0xf'),_0x65c74c);}});}})[_0x4866('0x14')](function(_0x36aa92){utils['error'](util[_0x4866('0x6')](_0x4866('0x15'),_0x65c74c['uniqueid']),_0x36aa92);});}delete members[_0x65c74c[_0x4866('0x8')]];}function startsWith(_0x348996,_0x3f8f56){return _[_0x4866('0x16')](_0x348996,function(_0x16b7ff){return _[_0x4866('0x17')](_0x3f8f56,_0x16b7ff);});}exports[_0x4866('0x18')]=function(_0x653916){try{utils[_0x4866('0x19')](util['format']('[%s][members][devicestatechange]',members[_0x653916[_0x4866('0x1a')]]?members[_0x653916[_0x4866('0x1a')]][_0x4866('0x1b')]:_0x653916['device']),_0x653916);utils['info'](util[_0x4866('0x6')](_0x4866('0x1c'),members[_0x653916['device']]?members[_0x653916[_0x4866('0x1a')]]['uniqueid']:_0x653916[_0x4866('0x1a')],_0x653916['state'],_0x653916[_0x4866('0x1a')]));switch(_0x653916[_0x4866('0x1d')]){case _0x4866('0x1e'):case _0x4866('0x1f'):if(!startsWith(exclude,_0x653916[_0x4866('0x1a')])){members[_0x653916['device']]={'channel':'voice','interface':_0x653916[_0x4866('0x1a')],'type':_0x4866('0x20'),'enterAt':utils[_0x4866('0x21')](),'role':'agent'};}break;case _0x4866('0x22'):if(!_['isNil'](members[_0x653916['device']])){members[_0x653916[_0x4866('0x1a')]][_0x4866('0x23')]=utils['now']();members[_0x653916[_0x4866('0x1a')]][_0x4866('0x24')]=utils[_0x4866('0x25')](members[_0x653916[_0x4866('0x1a')]][_0x4866('0x23')],members[_0x653916[_0x4866('0x1a')]][_0x4866('0x26')]);if(members[_0x653916[_0x4866('0x1a')]][_0x4866('0x1b')]){writeDB(members[_0x653916[_0x4866('0x1a')]]);}}break;default:break;}}catch(_0x278471){utils['error'](util[_0x4866('0x6')](_0x4866('0x27'),members[_0x653916[_0x4866('0x1a')]]?members[_0x653916[_0x4866('0x1a')]][_0x4866('0x1b')]:_0x653916[_0x4866('0x1a')]),_0x278471);}};exports[_0x4866('0x28')]=function(_0xe51cb4){try{if(!_[_0x4866('0x29')](members[_0xe51cb4[_0x4866('0x8')]])){utils[_0x4866('0x19')](util[_0x4866('0x6')](_0x4866('0x2a'),_0xe51cb4[_0x4866('0x1b')]),_0xe51cb4);utils[_0x4866('0x5')](util[_0x4866('0x6')](_0x4866('0x2b'),_0xe51cb4[_0x4866('0x1b')],_0xe51cb4[_0x4866('0x8')],_0xe51cb4[_0x4866('0x2c')]));members[_0xe51cb4[_0x4866('0x8')]]=_[_0x4866('0x2d')](members[_0xe51cb4['interface']],{'data4':_0xe51cb4['queue'],'uniqueid':_0xe51cb4[_0x4866('0x1b')]});}}catch(_0x1bef8d){utils[_0x4866('0x2e')](util[_0x4866('0x6')](_0x4866('0x2a'),_0xe51cb4['uniqueid']),_0x1bef8d);}};exports[_0x4866('0x2f')]=function(_0x21ad2b){try{utils[_0x4866('0x19')](util[_0x4866('0x6')](_0x4866('0x30'),_0x21ad2b['uniqueid']),_0x21ad2b);if(_0x21ad2b[_0x4866('0x31')]){var _0x4055f0=_0x21ad2b[_0x4866('0x31')][_0x4866('0x11')]('-')[0x0];if(!_[_0x4866('0x29')](members[_0x4055f0])){members[_0x4055f0]=_[_0x4866('0x2d')](members[_0x4055f0],{'data1':members[_0x4055f0][_0x4866('0x32')]||_0x21ad2b[_0x4866('0xb')],'data2':members[_0x4055f0][_0x4866('0x9')]||_0x21ad2b['source'],'data3':members[_0x4055f0][_0x4866('0x33')]||_0x21ad2b[_0x4866('0x34')],'uniqueid':members[_0x4055f0]['uniqueid']||_0x21ad2b[_0x4866('0x1b')]});utils[_0x4866('0x5')](util['format']('[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s',_0x21ad2b['uniqueid'],members[_0x4055f0]['data1'],members[_0x4055f0][_0x4866('0x9')],members[_0x4055f0][_0x4866('0x33')]));if(members[_0x4055f0]['exitAt']){writeDB(members[_0x4055f0]);}}}if(_0x21ad2b['destinationchannel']){var _0x4fbe06=_0x21ad2b[_0x4866('0x35')]['split']('-')[0x0];if(!_[_0x4866('0x29')](members[_0x4fbe06])){members[_0x4fbe06]=_['assign'](members[_0x4fbe06],{'data1':members[_0x4fbe06][_0x4866('0x32')]||_0x21ad2b['type'],'data2':members[_0x4fbe06][_0x4866('0x9')]||_0x21ad2b[_0x4866('0x36')],'data3':members[_0x4fbe06][_0x4866('0x33')]||_0x21ad2b[_0x4866('0x34')],'uniqueid':members[_0x4fbe06][_0x4866('0x1b')]||_0x21ad2b[_0x4866('0x1b')]});utils[_0x4866('0x5')](util['format']('[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s',_0x21ad2b[_0x4866('0x1b')],members[_0x4fbe06][_0x4866('0x32')],members[_0x4fbe06][_0x4866('0x9')],members[_0x4fbe06][_0x4866('0x33')]));if(members[_0x4fbe06][_0x4866('0x23')]){writeDB(members[_0x4fbe06]);}}}}catch(_0x26484b){utils['error'](util[_0x4866('0x6')](_0x4866('0x30'),_0x21ad2b['uniqueid']),_0x26484b);}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index ba28b64..b333f79 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 _0x9f27=['musiconholdstartAt','[%s][queues][musiconholdstart]','musiconholdstop','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','lodash','util','./utils','info','format','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','uniqueid','channel','queue','lastAssignedTo','calleridnum','accountcode','queuecallerexitreason','then','type','request','CreateVoiceQueueReport','transfereduniqueid','queuecallerjoin','debug','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','error','[%s][queues][queuecallerjoin]','hangup','isNil','[%s][queues][hangup]','queuecallerleaveAt','queuecallerabandon','queuecallerexit','queuecallercomplete','queuecallercompleteAt','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','queuecallerenterreason','[%s][queues][varset]','variable','queuestatus','toUpperCase','CONTINUE','queuecallerabandonAt','queuecallerexitAt','now','value','queueposition','EXITWITHKEY','[%s][queues][queuecallerabandon]','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','queuecallerleave','[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinename','holdtime','diffTime','queuecallerjoinAt','count','agentconnect','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','assigned','destaccountcode','agentcomplete','[%s][queues][agentcomplete]','reason','transfer','COMPLETEDBY','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','blindtransfer','transfereeuniqueid','[%s][queues][blindtransfer]','transfertype','BLIND','BLINDTRANSFER','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','extension','[%s][queues][attendedtransfer]','origtransfererlinkedid','secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','origtransfererexten','ATTENDED','transferuniqueid','transfereelinkedid','clone','transfertargetuniqueid','calleridname','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','origtransfereruniqueid','secondtransfereruniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererexten','transferexten','ATTENDEDTRANSFER','transfertargetlinkedid','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','musiconholdstart'];(function(_0x5c351c,_0x2046d8){var _0x26f3b3=function(_0x47ac18){while(--_0x47ac18){_0x5c351c['push'](_0x5c351c['shift']());}};_0x26f3b3(++_0x2046d8);}(_0x9f27,0x13c));var _0x79f2=function(_0x314860,_0x5a8d78){_0x314860=_0x314860-0x0;var _0x370bf1=_0x9f27[_0x314860];return _0x370bf1;};'use strict';var _=require(_0x79f2('0x0'));var util=require(_0x79f2('0x1'));var utils=require(_0x79f2('0x2'));var queues={};function writeDB(_0x5a23a5){utils[_0x79f2('0x3')](util[_0x79f2('0x4')](_0x79f2('0x5'),_0x5a23a5[_0x79f2('0x6')],_0x5a23a5[_0x79f2('0x7')],_0x5a23a5[_0x79f2('0x8')],_0x5a23a5[_0x79f2('0x9')],_0x5a23a5[_0x79f2('0xa')],_0x5a23a5[_0x79f2('0xb')],_0x5a23a5[_0x79f2('0xc')]));if(_0x5a23a5[_0x79f2('0x8')]){utils['getVoiceQueueByName'](_0x5a23a5[_0x79f2('0x8')])[_0x79f2('0xd')](function(_0x2f1ab2){if(_0x2f1ab2){_0x5a23a5[_0x79f2('0xe')]=_0x2f1ab2[_0x79f2('0xe')];}utils[_0x79f2('0xf')](_0x79f2('0x10'),_0x5a23a5);});}else{utils[_0x79f2('0xf')](_0x79f2('0x10'),_0x5a23a5);}if(_0x5a23a5[_0x79f2('0x11')]){delete queues[_0x5a23a5[_0x79f2('0x11')]];}else{delete queues[_0x5a23a5[_0x79f2('0x6')]];}}exports[_0x79f2('0x12')]=function(_0x579b1b){try{utils[_0x79f2('0x13')](util[_0x79f2('0x4')]('[%s][queues][queuecallerjoin]',_0x579b1b['uniqueid']),_0x579b1b);utils[_0x79f2('0x3')](util[_0x79f2('0x4')](_0x79f2('0x14'),_0x579b1b[_0x79f2('0x6')],_0x579b1b[_0x79f2('0x8')],_0x579b1b[_0x79f2('0x15')]));queues[_0x579b1b[_0x79f2('0x6')]]=_['assign'](_0x579b1b,{'originalposition':_0x579b1b[_0x79f2('0x15')],'queuecallerjoinAt':utils['now'](),'mohtime':0x0});}catch(_0x3cc51f){utils[_0x79f2('0x16')](util[_0x79f2('0x4')](_0x79f2('0x17'),_0x579b1b[_0x79f2('0x6')]),_0x3cc51f);}};exports[_0x79f2('0x18')]=function(_0x4748de){try{if(!_[_0x79f2('0x19')](queues[_0x4748de['uniqueid']])){utils[_0x79f2('0x13')](util[_0x79f2('0x4')](_0x79f2('0x1a'),_0x4748de[_0x79f2('0x6')]),_0x4748de);if(queues[_0x4748de[_0x79f2('0x6')]][_0x79f2('0x1b')]){if(!queues[_0x4748de[_0x79f2('0x6')]][_0x79f2('0x1c')]&&!queues[_0x4748de[_0x79f2('0x6')]][_0x79f2('0x1d')]){queues[_0x4748de[_0x79f2('0x6')]][_0x79f2('0x1e')]=!![];queues[_0x4748de[_0x79f2('0x6')]][_0x79f2('0x1f')]=utils['now']();queues[_0x4748de['uniqueid']][_0x79f2('0xc')]='COMPLETEDBYAGENT';}utils['info'](util[_0x79f2('0x4')](_0x79f2('0x20'),_0x4748de[_0x79f2('0x6')],queues[_0x4748de[_0x79f2('0x6')]][_0x79f2('0x21')],queues[_0x4748de[_0x79f2('0x6')]][_0x79f2('0xc')]));writeDB(queues[_0x4748de['uniqueid']]);}else if(queues[_0x4748de['uniqueid']][_0x79f2('0x11')]){utils[_0x79f2('0x3')](util[_0x79f2('0x4')](_0x79f2('0x22'),_0x4748de[_0x79f2('0x6')],queues[_0x4748de['uniqueid']]['name'],queues[_0x4748de[_0x79f2('0x6')]][_0x79f2('0x11')]));queues[queues[_0x4748de['uniqueid']][_0x79f2('0x11')]]=queues[_0x4748de[_0x79f2('0x6')]];queues[queues[_0x4748de['uniqueid']][_0x79f2('0x11')]][_0x79f2('0x23')]=0x2;delete queues[_0x4748de[_0x79f2('0x6')]];}}}catch(_0xccf368){utils[_0x79f2('0x16')](util[_0x79f2('0x4')](_0x79f2('0x1a'),_0x4748de[_0x79f2('0x6')]),_0xccf368);}};exports['varset']=function(_0x4dee9f){try{utils[_0x79f2('0x13')](util[_0x79f2('0x4')](_0x79f2('0x24'),_0x4dee9f[_0x79f2('0x6')]),_0x4dee9f);if(!_[_0x79f2('0x19')](_0x4dee9f[_0x79f2('0x25')][_0x79f2('0x26')])&&_0x4dee9f['value'][_0x79f2('0x27')]()!==_0x79f2('0x28')){if(!_[_0x79f2('0x19')](queues[_0x4dee9f[_0x79f2('0x6')]])){queues[_0x4dee9f['uniqueid']][_0x79f2('0x1c')]=![];queues[_0x4dee9f[_0x79f2('0x6')]][_0x79f2('0x29')]=null;queues[_0x4dee9f[_0x79f2('0x6')]][_0x79f2('0x1d')]=!![];queues[_0x4dee9f['uniqueid']][_0x79f2('0x2a')]=utils[_0x79f2('0x2b')]();queues[_0x4dee9f[_0x79f2('0x6')]][_0x79f2('0xc')]=_0x4dee9f[_0x79f2('0x2c')][_0x79f2('0x27')]();utils[_0x79f2('0x3')](util['format']('[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s',_0x4dee9f[_0x79f2('0x6')],queues[_0x4dee9f[_0x79f2('0x6')]]['name'],_0x4dee9f[_0x79f2('0x2c')],queues[_0x4dee9f[_0x79f2('0x6')]]['queuecallerexitreason']));writeDB(queues[_0x4dee9f[_0x79f2('0x6')]]);}}else if(!_[_0x79f2('0x19')](_0x4dee9f[_0x79f2('0x25')][_0x79f2('0x2d')])){if(!_[_0x79f2('0x19')](queues[_0x4dee9f[_0x79f2('0x6')]])&&!queues[_0x4dee9f[_0x79f2('0x6')]][_0x79f2('0x1c')]){queues[_0x4dee9f[_0x79f2('0x6')]]['queuecallerabandon']=![];queues[_0x4dee9f[_0x79f2('0x6')]][_0x79f2('0x29')]=null;queues[_0x4dee9f[_0x79f2('0x6')]][_0x79f2('0x1d')]=!![];queues[_0x4dee9f['uniqueid']][_0x79f2('0x2a')]=utils['now']();queues[_0x4dee9f[_0x79f2('0x6')]][_0x79f2('0xc')]=_0x79f2('0x2e');utils[_0x79f2('0x3')](util[_0x79f2('0x4')]('[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s',_0x4dee9f[_0x79f2('0x6')],queues[_0x4dee9f[_0x79f2('0x6')]][_0x79f2('0x21')],_0x4dee9f[_0x79f2('0x2c')],queues[_0x4dee9f['uniqueid']]['queuecallerexitreason']));}}}catch(_0x21c32b){utils['error'](util[_0x79f2('0x4')](_0x79f2('0x24'),_0x4dee9f[_0x79f2('0x6')]),_0x21c32b);}};exports['queuecallerabandon']=function(_0x11f862){try{if(!_[_0x79f2('0x19')](queues[_0x11f862[_0x79f2('0x6')]])){utils[_0x79f2('0x13')](util['format'](_0x79f2('0x2f'),_0x11f862['uniqueid']),_0x11f862);queues[_0x11f862[_0x79f2('0x6')]]['queuecallerexit']=![];queues[_0x11f862[_0x79f2('0x6')]][_0x79f2('0x2a')]=null;queues[_0x11f862[_0x79f2('0x6')]][_0x79f2('0x1c')]=!![];queues[_0x11f862['uniqueid']]['queuecallerabandonAt']=utils[_0x79f2('0x2b')]();queues[_0x11f862[_0x79f2('0x6')]][_0x79f2('0xc')]='ABANDONED';utils['info'](util[_0x79f2('0x4')](_0x79f2('0x30'),_0x11f862[_0x79f2('0x6')],queues[_0x11f862[_0x79f2('0x6')]][_0x79f2('0x21')],queues[_0x11f862[_0x79f2('0x6')]]['queuecallerexitreason']));}}catch(_0x8a5741){utils[_0x79f2('0x16')](util['format'](_0x79f2('0x2f'),_0x11f862['uniqueid']),_0x8a5741);}};exports[_0x79f2('0x31')]=function(_0x2bc877){try{if(!_[_0x79f2('0x19')](queues[_0x2bc877[_0x79f2('0x6')]])){utils[_0x79f2('0x13')](util[_0x79f2('0x4')](_0x79f2('0x32'),_0x2bc877[_0x79f2('0x6')]),_0x2bc877);utils[_0x79f2('0x3')](util['format'](_0x79f2('0x33'),_0x2bc877['uniqueid'],queues[_0x2bc877[_0x79f2('0x6')]]['name'],_0x2bc877['connectedlinenum'],_0x2bc877[_0x79f2('0x34')]));queues[_0x2bc877['uniqueid']][_0x79f2('0x31')]=!![];queues[_0x2bc877[_0x79f2('0x6')]][_0x79f2('0x1b')]=utils['now']();queues[_0x2bc877[_0x79f2('0x6')]][_0x79f2('0x35')]=utils[_0x79f2('0x36')](queues[_0x2bc877[_0x79f2('0x6')]]['queuecallerleaveAt'],queues[_0x2bc877[_0x79f2('0x6')]][_0x79f2('0x37')]);queues[_0x2bc877['uniqueid']][_0x79f2('0x15')]=_0x2bc877[_0x79f2('0x15')];queues[_0x2bc877['uniqueid']][_0x79f2('0x38')]=_0x2bc877[_0x79f2('0x38')];queues[_0x2bc877[_0x79f2('0x6')]]['connectedlinenum']=_0x2bc877['connectedlinenum'];queues[_0x2bc877[_0x79f2('0x6')]][_0x79f2('0x34')]=_0x2bc877[_0x79f2('0x34')];}}catch(_0x3d9039){utils[_0x79f2('0x16')](util[_0x79f2('0x4')]('[%s][queues][queuecallerleave]',_0x2bc877[_0x79f2('0x6')]),_0x3d9039);}};exports[_0x79f2('0x39')]=function(_0x2a94b3){try{if(!_[_0x79f2('0x19')](queues[_0x2a94b3['uniqueid']])){utils[_0x79f2('0x13')](util[_0x79f2('0x4')](_0x79f2('0x3a'),_0x2a94b3[_0x79f2('0x6')]),_0x2a94b3);utils[_0x79f2('0x3')](util[_0x79f2('0x4')](_0x79f2('0x3b'),_0x2a94b3[_0x79f2('0x6')],queues[_0x2a94b3[_0x79f2('0x6')]]['name'],_0x2a94b3[_0x79f2('0x3c')],_0x2a94b3['destaccountcode']));queues[_0x2a94b3['uniqueid']][_0x79f2('0x1c')]=![];queues[_0x2a94b3[_0x79f2('0x6')]][_0x79f2('0x1c')]=![];queues[_0x2a94b3[_0x79f2('0x6')]][_0x79f2('0x29')]=null;queues[_0x2a94b3[_0x79f2('0x6')]][_0x79f2('0x1d')]=![];queues[_0x2a94b3[_0x79f2('0x6')]]['queuecallerexitreason']=null;queues[_0x2a94b3[_0x79f2('0x6')]][_0x79f2('0x2a')]=null;queues[_0x2a94b3[_0x79f2('0x6')]][_0x79f2('0x3d')]=!![];queues[_0x2a94b3[_0x79f2('0x6')]][_0x79f2('0xb')]=_0x2a94b3[_0x79f2('0x3e')];queues[_0x2a94b3[_0x79f2('0x6')]][_0x79f2('0x9')]=_0x2a94b3[_0x79f2('0x3c')];}}catch(_0x55a52b){utils[_0x79f2('0x16')](util['format'](_0x79f2('0x3a'),_0x2a94b3['uniqueid']),_0x55a52b);}};exports[_0x79f2('0x3f')]=function(_0x137ea0){try{if(!_['isNil'](queues[_0x137ea0[_0x79f2('0x6')]])){if(queues[_0x137ea0[_0x79f2('0x6')]][_0x79f2('0x1b')]){utils[_0x79f2('0x13')](util['format'](_0x79f2('0x40'),_0x137ea0[_0x79f2('0x6')]),_0x137ea0);queues[_0x137ea0[_0x79f2('0x6')]][_0x79f2('0x1c')]=![];queues[_0x137ea0['uniqueid']][_0x79f2('0x1c')]=![];queues[_0x137ea0['uniqueid']][_0x79f2('0x29')]=null;queues[_0x137ea0[_0x79f2('0x6')]]['queuecallerexit']=![];queues[_0x137ea0[_0x79f2('0x6')]]['queuecallerexitAt']=null;queues[_0x137ea0[_0x79f2('0x6')]][_0x79f2('0x3d')]=!![];queues[_0x137ea0[_0x79f2('0x6')]][_0x79f2('0x9')]=_0x137ea0[_0x79f2('0x3c')];queues[_0x137ea0['uniqueid']][_0x79f2('0x1e')]=!![];queues[_0x137ea0[_0x79f2('0x6')]]['queuecallercompleteAt']=utils[_0x79f2('0x2b')]();if(_0x137ea0[_0x79f2('0x41')]==_0x79f2('0x42')){if(!queues[_0x137ea0[_0x79f2('0x6')]][_0x79f2('0x42')]){queues[_0x137ea0['uniqueid']][_0x79f2('0xc')]='TRANSFER';}}else{queues[_0x137ea0[_0x79f2('0x6')]]['queuecallerexitreason']=_0x79f2('0x43')+_0x137ea0['reason'][_0x79f2('0x27')]();}utils[_0x79f2('0x3')](util[_0x79f2('0x4')](_0x79f2('0x44'),_0x137ea0[_0x79f2('0x6')],queues[_0x137ea0[_0x79f2('0x6')]][_0x79f2('0x21')],_0x137ea0[_0x79f2('0x3c')],queues[_0x137ea0['uniqueid']][_0x79f2('0xc')]));writeDB(queues[_0x137ea0['uniqueid']]);}}}catch(_0x33bc6c){utils[_0x79f2('0x16')](util[_0x79f2('0x4')](_0x79f2('0x40'),_0x137ea0[_0x79f2('0x6')]),_0x33bc6c);}};exports[_0x79f2('0x45')]=function(_0x4755cd){try{if(!_['isNil'](queues[_0x4755cd[_0x79f2('0x46')]])){utils['debug'](util[_0x79f2('0x4')](_0x79f2('0x47'),_0x4755cd[_0x79f2('0x6')]),_0x4755cd);queues[_0x4755cd[_0x79f2('0x46')]][_0x79f2('0x42')]=!![];queues[_0x4755cd[_0x79f2('0x46')]][_0x79f2('0x48')]=_0x79f2('0x49');queues[_0x4755cd[_0x79f2('0x46')]]['transferexten']=_0x4755cd['extension'];queues[_0x4755cd[_0x79f2('0x46')]]['transferuniqueid']=_0x4755cd[_0x79f2('0x46')];queues[_0x4755cd['transfereeuniqueid']]['queuecallerexitreason']=_0x79f2('0x4a');utils['info'](util[_0x79f2('0x4')](_0x79f2('0x4b'),_0x4755cd[_0x79f2('0x6')],queues[_0x4755cd[_0x79f2('0x46')]]['name'],_0x4755cd[_0x79f2('0x46')],_0x4755cd[_0x79f2('0x4c')]));}}catch(_0x2bbd5c){utils[_0x79f2('0x16')](util[_0x79f2('0x4')](_0x79f2('0x47'),_0x4755cd[_0x79f2('0x6')]),_0x2bbd5c);}};exports['attendedtransfer']=function(_0x19e4c6){try{utils[_0x79f2('0x13')](util[_0x79f2('0x4')](_0x79f2('0x4d'),_0x19e4c6['origtransfereruniqueid']),_0x19e4c6);if(_0x19e4c6['origtransfereruniqueid']==_0x19e4c6[_0x79f2('0x4e')]){if(!_[_0x79f2('0x19')](queues[_0x19e4c6[_0x79f2('0x4f')]])){utils[_0x79f2('0x3')](util[_0x79f2('0x4')](_0x79f2('0x50'),_0x19e4c6['origtransfereruniqueid'],queues[_0x19e4c6['secondtransfererlinkedid']][_0x79f2('0x21')],_0x19e4c6[_0x79f2('0x51')]));queues[_0x19e4c6[_0x79f2('0x4f')]][_0x79f2('0x42')]=!![];queues[_0x19e4c6[_0x79f2('0x4f')]][_0x79f2('0x48')]=_0x79f2('0x52');queues[_0x19e4c6['secondtransfererlinkedid']]['transferexten']=_0x19e4c6[_0x79f2('0x51')];queues[_0x19e4c6[_0x79f2('0x4f')]][_0x79f2('0x53')]=_0x19e4c6['origtransfereruniqueid'];queues[_0x19e4c6[_0x79f2('0x4f')]][_0x79f2('0xc')]='ATTENDEDTRANSFER';}if(!_[_0x79f2('0x19')](queues[_0x19e4c6[_0x79f2('0x4e')]])){if(_0x19e4c6[_0x79f2('0x54')]&&queues[_0x19e4c6[_0x79f2('0x54')]]){queues[_0x19e4c6['transfereelinkedid']][_0x79f2('0x23')]=0x1;queues[_0x19e4c6[_0x79f2('0x46')]]=_[_0x79f2('0x55')](queues[_0x19e4c6['transfereelinkedid']]);queues[_0x19e4c6['transfereeuniqueid']][_0x79f2('0x11')]=_0x19e4c6[_0x79f2('0x56')];queues[_0x19e4c6[_0x79f2('0x46')]]['queuecallerenterreason']=0x2;queues[_0x19e4c6[_0x79f2('0x46')]][_0x79f2('0xa')]=queues[_0x19e4c6[_0x79f2('0x4f')]]['calleridnum'];queues[_0x19e4c6[_0x79f2('0x46')]]['calleridname']=queues[_0x19e4c6[_0x79f2('0x4f')]][_0x79f2('0x57')];queues[_0x19e4c6[_0x79f2('0x46')]][_0x79f2('0x37')]=utils[_0x79f2('0x2b')]();queues[_0x19e4c6[_0x79f2('0x46')]][_0x79f2('0x1b')]=utils[_0x79f2('0x2b')]();queues[_0x19e4c6[_0x79f2('0x46')]]['holdtime']=0x0;queues[_0x19e4c6['transfereeuniqueid']]['mohtime']=0x0;utils[_0x79f2('0x3')](util[_0x79f2('0x4')](_0x79f2('0x58'),_0x19e4c6['origtransfereruniqueid'],queues[_0x19e4c6[_0x79f2('0x46')]][_0x79f2('0x21')],queues[_0x19e4c6[_0x79f2('0x46')]]['calleridnum'],queues[_0x19e4c6[_0x79f2('0x46')]][_0x79f2('0x57')]));}else{utils[_0x79f2('0x3')](util[_0x79f2('0x4')](_0x79f2('0x59'),_0x19e4c6[_0x79f2('0x5a')],queues[_0x19e4c6['origtransfererlinkedid']][_0x79f2('0x21')],_0x19e4c6['secondtransfererlinkedid']));queues[_0x19e4c6[_0x79f2('0x4e')]]['transfereduniqueid']=_0x19e4c6['secondtransfererlinkedid'];}}}else if(_0x19e4c6[_0x79f2('0x5b')]==_0x19e4c6[_0x79f2('0x4f')]){if(!_[_0x79f2('0x19')](queues[_0x19e4c6[_0x79f2('0x4e')]])){utils['info'](util[_0x79f2('0x4')](_0x79f2('0x5c'),_0x19e4c6[_0x79f2('0x5a')],queues[_0x19e4c6['origtransfererlinkedid']]['name'],_0x19e4c6['secondtransfereruniqueid'],_0x19e4c6[_0x79f2('0x5d')]));queues[_0x19e4c6[_0x79f2('0x4e')]][_0x79f2('0x42')]=!![];queues[_0x19e4c6[_0x79f2('0x4e')]]['transfertype']='ATTENDED';queues[_0x19e4c6[_0x79f2('0x4e')]][_0x79f2('0x5e')]=_0x19e4c6[_0x79f2('0x5d')];queues[_0x19e4c6[_0x79f2('0x4e')]][_0x79f2('0x53')]=_0x19e4c6['secondtransfereruniqueid'];queues[_0x19e4c6[_0x79f2('0x4e')]][_0x79f2('0xc')]=_0x79f2('0x5f');}if(!_[_0x79f2('0x19')](queues[_0x19e4c6[_0x79f2('0x4f')]])){if(_0x19e4c6[_0x79f2('0x60')]&&queues[_0x19e4c6[_0x79f2('0x60')]]){queues[_0x19e4c6[_0x79f2('0x60')]][_0x79f2('0x23')]=0x1;queues[_0x19e4c6[_0x79f2('0x56')]]=_[_0x79f2('0x55')](queues[_0x19e4c6['transfertargetlinkedid']]);queues[_0x19e4c6[_0x79f2('0x56')]][_0x79f2('0x11')]=_0x19e4c6[_0x79f2('0x56')];queues[_0x19e4c6[_0x79f2('0x56')]][_0x79f2('0x23')]=0x2;queues[_0x19e4c6[_0x79f2('0x56')]][_0x79f2('0xa')]=queues[_0x19e4c6[_0x79f2('0x4e')]][_0x79f2('0xa')];queues[_0x19e4c6['transfertargetuniqueid']][_0x79f2('0x57')]=queues[_0x19e4c6['origtransfererlinkedid']][_0x79f2('0x57')];queues[_0x19e4c6[_0x79f2('0x56')]][_0x79f2('0x37')]=utils[_0x79f2('0x2b')]();queues[_0x19e4c6['transfertargetuniqueid']][_0x79f2('0x1b')]=utils[_0x79f2('0x2b')]();queues[_0x19e4c6[_0x79f2('0x56')]][_0x79f2('0x35')]=0x0;queues[_0x19e4c6[_0x79f2('0x56')]][_0x79f2('0x61')]=0x0;utils[_0x79f2('0x3')](util[_0x79f2('0x4')](_0x79f2('0x62'),_0x19e4c6[_0x79f2('0x5a')],queues[_0x19e4c6[_0x79f2('0x56')]][_0x79f2('0x21')],queues[_0x19e4c6['transfertargetuniqueid']]['transfereduniqueid'],queues[_0x19e4c6[_0x79f2('0x56')]][_0x79f2('0xa')],queues[_0x19e4c6[_0x79f2('0x56')]][_0x79f2('0x57')]));}else{utils[_0x79f2('0x3')](util['format'](_0x79f2('0x59'),_0x19e4c6[_0x79f2('0x5a')],queues[_0x19e4c6[_0x79f2('0x4f')]]['name'],_0x19e4c6[_0x79f2('0x4e')]));queues[_0x19e4c6[_0x79f2('0x4f')]][_0x79f2('0x11')]=_0x19e4c6[_0x79f2('0x4e')];}}}}catch(_0x2a378a){utils[_0x79f2('0x16')](util['format'](_0x79f2('0x4d'),_0x19e4c6[_0x79f2('0x5a')]),_0x2a378a);}};exports[_0x79f2('0x63')]=function(_0x1458bc){try{if(!_[_0x79f2('0x19')](queues[_0x1458bc[_0x79f2('0x6')]])){utils[_0x79f2('0x13')](util[_0x79f2('0x4')]('[%s][queues][musiconholdstart]',_0x1458bc['uniqueid']),_0x1458bc);queues[_0x1458bc[_0x79f2('0x6')]][_0x79f2('0x64')]=utils['now']();utils[_0x79f2('0x3')](util['format']('[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s',_0x1458bc['uniqueid'],queues[_0x1458bc[_0x79f2('0x6')]]['name'],queues[_0x1458bc[_0x79f2('0x6')]]['musiconholdstartAt']));}}catch(_0x49fec9){utils[_0x79f2('0x16')](util[_0x79f2('0x4')](_0x79f2('0x65'),_0x1458bc[_0x79f2('0x6')]),_0x49fec9);}};exports[_0x79f2('0x66')]=function(_0x12f874){try{if(!_[_0x79f2('0x19')](queues[_0x12f874[_0x79f2('0x6')]])){if(!_[_0x79f2('0x19')](queues[_0x12f874[_0x79f2('0x6')]][_0x79f2('0x64')])){utils[_0x79f2('0x13')](util[_0x79f2('0x4')]('[%s][queues][musiconholdstop]',_0x12f874[_0x79f2('0x6')]),_0x12f874);queues[_0x12f874['uniqueid']][_0x79f2('0x61')]+=utils['diffTime'](utils[_0x79f2('0x2b')](),queues[_0x12f874['uniqueid']][_0x79f2('0x64')]);utils[_0x79f2('0x3')](util[_0x79f2('0x4')](_0x79f2('0x67'),_0x12f874[_0x79f2('0x6')],queues[_0x12f874['uniqueid']]['name'],queues[_0x12f874['uniqueid']][_0x79f2('0x61')]));delete queues[_0x12f874[_0x79f2('0x6')]]['musiconholdstartAt'];}}}catch(_0x2a1418){utils[_0x79f2('0x16')](util[_0x79f2('0x4')]('[%s][queues][musiconholdstop]',_0x12f874[_0x79f2('0x6')]),_0x2a1418);}}; \ No newline at end of file +var _0x3ffe=['transfertargetlinkedid','calleridname','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','musiconholdstart','[%s][queues][musiconholdstart]','musiconholdstartAt','[%s][queues][musiconholdstop]','util','./utils','format','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','uniqueid','channel','queue','lastAssignedTo','calleridnum','queuecallerexitreason','getVoiceQueueByName','then','type','request','CreateVoiceQueueReport','transfereduniqueid','debug','[%s][queues][queuecallerjoin]','info','position','assign','now','hangup','isNil','[%s][queues][hangup]','queuecallerexit','queuecallercomplete','COMPLETEDBYAGENT','error','varset','[%s][queues][varset]','queuestatus','value','toUpperCase','queuecallerabandon','queuecallerabandonAt','queuecallerexitAt','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','name','variable','queueposition','EXITWITHKEY','ABANDONED','[%s][queues][queuecallerabandon]','[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum','connectedlinename','queuecallerleaveAt','holdtime','diffTime','queuecallerjoinAt','count','agentconnect','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','destaccountcode','assigned','accountcode','agentcomplete','[%s][queues][agentcomplete]','queuecallercompleteAt','reason','transfer','TRANSFER','[%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','[%s][queues][attendedtransfer]','origtransfereruniqueid','secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','origtransfererexten','ATTENDED','ATTENDEDTRANSFER','origtransfererlinkedid','transfereelinkedid','queuecallerenterreason','clone','transfertargetuniqueid','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'];(function(_0x188bf0,_0x3ba7bb){var _0x1d9ebf=function(_0x30b3cf){while(--_0x30b3cf){_0x188bf0['push'](_0x188bf0['shift']());}};_0x1d9ebf(++_0x3ba7bb);}(_0x3ffe,0x136));var _0xe3ff=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3ffe[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xe3ff('0x0'));var utils=require(_0xe3ff('0x1'));var queues={};function writeDB(_0x253962){utils['info'](util[_0xe3ff('0x2')](_0xe3ff('0x3'),_0x253962[_0xe3ff('0x4')],_0x253962[_0xe3ff('0x5')],_0x253962[_0xe3ff('0x6')],_0x253962[_0xe3ff('0x7')],_0x253962[_0xe3ff('0x8')],_0x253962['accountcode'],_0x253962[_0xe3ff('0x9')]));if(_0x253962[_0xe3ff('0x6')]){utils[_0xe3ff('0xa')](_0x253962[_0xe3ff('0x6')])[_0xe3ff('0xb')](function(_0x5bcbdc){if(_0x5bcbdc){_0x253962[_0xe3ff('0xc')]=_0x5bcbdc['type'];}utils[_0xe3ff('0xd')](_0xe3ff('0xe'),_0x253962);});}else{utils[_0xe3ff('0xd')]('CreateVoiceQueueReport',_0x253962);}if(_0x253962[_0xe3ff('0xf')]){delete queues[_0x253962[_0xe3ff('0xf')]];}else{delete queues[_0x253962['uniqueid']];}}exports['queuecallerjoin']=function(_0x544402){try{utils[_0xe3ff('0x10')](util[_0xe3ff('0x2')](_0xe3ff('0x11'),_0x544402[_0xe3ff('0x4')]),_0x544402);utils[_0xe3ff('0x12')](util[_0xe3ff('0x2')]('[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s',_0x544402[_0xe3ff('0x4')],_0x544402[_0xe3ff('0x6')],_0x544402[_0xe3ff('0x13')]));queues[_0x544402[_0xe3ff('0x4')]]=_[_0xe3ff('0x14')](_0x544402,{'originalposition':_0x544402[_0xe3ff('0x13')],'queuecallerjoinAt':utils[_0xe3ff('0x15')](),'mohtime':0x0});}catch(_0x49df5c){utils['error'](util[_0xe3ff('0x2')](_0xe3ff('0x11'),_0x544402['uniqueid']),_0x49df5c);}};exports[_0xe3ff('0x16')]=function(_0x13c05a){try{if(!_[_0xe3ff('0x17')](queues[_0x13c05a[_0xe3ff('0x4')]])){utils[_0xe3ff('0x10')](util['format'](_0xe3ff('0x18'),_0x13c05a[_0xe3ff('0x4')]),_0x13c05a);if(queues[_0x13c05a[_0xe3ff('0x4')]]['queuecallerleaveAt']){if(!queues[_0x13c05a[_0xe3ff('0x4')]]['queuecallerabandon']&&!queues[_0x13c05a[_0xe3ff('0x4')]][_0xe3ff('0x19')]){queues[_0x13c05a[_0xe3ff('0x4')]][_0xe3ff('0x1a')]=!![];queues[_0x13c05a[_0xe3ff('0x4')]]['queuecallercompleteAt']=utils[_0xe3ff('0x15')]();queues[_0x13c05a['uniqueid']][_0xe3ff('0x9')]=_0xe3ff('0x1b');}utils[_0xe3ff('0x12')](util['format']('[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s',_0x13c05a[_0xe3ff('0x4')],queues[_0x13c05a[_0xe3ff('0x4')]]['name'],queues[_0x13c05a[_0xe3ff('0x4')]][_0xe3ff('0x9')]));writeDB(queues[_0x13c05a['uniqueid']]);}else if(queues[_0x13c05a[_0xe3ff('0x4')]][_0xe3ff('0xf')]){utils[_0xe3ff('0x12')](util[_0xe3ff('0x2')]('[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s',_0x13c05a[_0xe3ff('0x4')],queues[_0x13c05a[_0xe3ff('0x4')]]['name'],queues[_0x13c05a[_0xe3ff('0x4')]][_0xe3ff('0xf')]));queues[queues[_0x13c05a[_0xe3ff('0x4')]][_0xe3ff('0xf')]]=queues[_0x13c05a[_0xe3ff('0x4')]];queues[queues[_0x13c05a[_0xe3ff('0x4')]][_0xe3ff('0xf')]]['queuecallerenterreason']=0x2;delete queues[_0x13c05a[_0xe3ff('0x4')]];}}}catch(_0x399efc){utils[_0xe3ff('0x1c')](util[_0xe3ff('0x2')](_0xe3ff('0x18'),_0x13c05a[_0xe3ff('0x4')]),_0x399efc);}};exports[_0xe3ff('0x1d')]=function(_0x306c25){try{utils[_0xe3ff('0x10')](util[_0xe3ff('0x2')](_0xe3ff('0x1e'),_0x306c25['uniqueid']),_0x306c25);if(!_[_0xe3ff('0x17')](_0x306c25['variable'][_0xe3ff('0x1f')])&&_0x306c25[_0xe3ff('0x20')][_0xe3ff('0x21')]()!=='CONTINUE'){if(!_[_0xe3ff('0x17')](queues[_0x306c25['uniqueid']])){queues[_0x306c25[_0xe3ff('0x4')]][_0xe3ff('0x22')]=![];queues[_0x306c25[_0xe3ff('0x4')]][_0xe3ff('0x23')]=null;queues[_0x306c25[_0xe3ff('0x4')]][_0xe3ff('0x19')]=!![];queues[_0x306c25[_0xe3ff('0x4')]][_0xe3ff('0x24')]=utils[_0xe3ff('0x15')]();queues[_0x306c25[_0xe3ff('0x4')]][_0xe3ff('0x9')]=_0x306c25[_0xe3ff('0x20')][_0xe3ff('0x21')]();utils[_0xe3ff('0x12')](util[_0xe3ff('0x2')](_0xe3ff('0x25'),_0x306c25['uniqueid'],queues[_0x306c25[_0xe3ff('0x4')]][_0xe3ff('0x26')],_0x306c25[_0xe3ff('0x20')],queues[_0x306c25['uniqueid']][_0xe3ff('0x9')]));writeDB(queues[_0x306c25[_0xe3ff('0x4')]]);}}else if(!_['isNil'](_0x306c25[_0xe3ff('0x27')][_0xe3ff('0x28')])){if(!_[_0xe3ff('0x17')](queues[_0x306c25[_0xe3ff('0x4')]])&&!queues[_0x306c25[_0xe3ff('0x4')]]['queuecallerabandon']){queues[_0x306c25[_0xe3ff('0x4')]][_0xe3ff('0x22')]=![];queues[_0x306c25[_0xe3ff('0x4')]]['queuecallerabandonAt']=null;queues[_0x306c25[_0xe3ff('0x4')]]['queuecallerexit']=!![];queues[_0x306c25['uniqueid']]['queuecallerexitAt']=utils[_0xe3ff('0x15')]();queues[_0x306c25[_0xe3ff('0x4')]][_0xe3ff('0x9')]=_0xe3ff('0x29');utils[_0xe3ff('0x12')](util[_0xe3ff('0x2')]('[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s',_0x306c25[_0xe3ff('0x4')],queues[_0x306c25[_0xe3ff('0x4')]][_0xe3ff('0x26')],_0x306c25[_0xe3ff('0x20')],queues[_0x306c25[_0xe3ff('0x4')]][_0xe3ff('0x9')]));}}}catch(_0x46cfc0){utils['error'](util[_0xe3ff('0x2')](_0xe3ff('0x1e'),_0x306c25[_0xe3ff('0x4')]),_0x46cfc0);}};exports[_0xe3ff('0x22')]=function(_0x5ab9e4){try{if(!_[_0xe3ff('0x17')](queues[_0x5ab9e4['uniqueid']])){utils['debug'](util['format']('[%s][queues][queuecallerabandon]',_0x5ab9e4[_0xe3ff('0x4')]),_0x5ab9e4);queues[_0x5ab9e4[_0xe3ff('0x4')]][_0xe3ff('0x19')]=![];queues[_0x5ab9e4[_0xe3ff('0x4')]][_0xe3ff('0x24')]=null;queues[_0x5ab9e4[_0xe3ff('0x4')]][_0xe3ff('0x22')]=!![];queues[_0x5ab9e4['uniqueid']][_0xe3ff('0x23')]=utils[_0xe3ff('0x15')]();queues[_0x5ab9e4[_0xe3ff('0x4')]]['queuecallerexitreason']=_0xe3ff('0x2a');utils[_0xe3ff('0x12')](util[_0xe3ff('0x2')]('[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s',_0x5ab9e4[_0xe3ff('0x4')],queues[_0x5ab9e4[_0xe3ff('0x4')]][_0xe3ff('0x26')],queues[_0x5ab9e4[_0xe3ff('0x4')]][_0xe3ff('0x9')]));}}catch(_0x435888){utils[_0xe3ff('0x1c')](util['format'](_0xe3ff('0x2b'),_0x5ab9e4[_0xe3ff('0x4')]),_0x435888);}};exports['queuecallerleave']=function(_0x4eff9d){try{if(!_[_0xe3ff('0x17')](queues[_0x4eff9d[_0xe3ff('0x4')]])){utils['debug'](util['format'](_0xe3ff('0x2c'),_0x4eff9d[_0xe3ff('0x4')]),_0x4eff9d);utils[_0xe3ff('0x12')](util[_0xe3ff('0x2')](_0xe3ff('0x2d'),_0x4eff9d[_0xe3ff('0x4')],queues[_0x4eff9d[_0xe3ff('0x4')]][_0xe3ff('0x26')],_0x4eff9d[_0xe3ff('0x2e')],_0x4eff9d[_0xe3ff('0x2f')]));queues[_0x4eff9d['uniqueid']]['queuecallerleave']=!![];queues[_0x4eff9d['uniqueid']][_0xe3ff('0x30')]=utils[_0xe3ff('0x15')]();queues[_0x4eff9d[_0xe3ff('0x4')]][_0xe3ff('0x31')]=utils[_0xe3ff('0x32')](queues[_0x4eff9d[_0xe3ff('0x4')]][_0xe3ff('0x30')],queues[_0x4eff9d['uniqueid']][_0xe3ff('0x33')]);queues[_0x4eff9d['uniqueid']]['position']=_0x4eff9d[_0xe3ff('0x13')];queues[_0x4eff9d['uniqueid']][_0xe3ff('0x34')]=_0x4eff9d[_0xe3ff('0x34')];queues[_0x4eff9d[_0xe3ff('0x4')]]['connectedlinenum']=_0x4eff9d['connectedlinenum'];queues[_0x4eff9d[_0xe3ff('0x4')]][_0xe3ff('0x2f')]=_0x4eff9d['connectedlinename'];}}catch(_0x302323){utils['error'](util[_0xe3ff('0x2')](_0xe3ff('0x2c'),_0x4eff9d[_0xe3ff('0x4')]),_0x302323);}};exports[_0xe3ff('0x35')]=function(_0x46a8fe){try{if(!_['isNil'](queues[_0x46a8fe[_0xe3ff('0x4')]])){utils[_0xe3ff('0x10')](util[_0xe3ff('0x2')](_0xe3ff('0x36'),_0x46a8fe['uniqueid']),_0x46a8fe);utils[_0xe3ff('0x12')](util['format'](_0xe3ff('0x37'),_0x46a8fe[_0xe3ff('0x4')],queues[_0x46a8fe[_0xe3ff('0x4')]]['name'],_0x46a8fe[_0xe3ff('0x38')],_0x46a8fe[_0xe3ff('0x39')]));queues[_0x46a8fe['uniqueid']][_0xe3ff('0x22')]=![];queues[_0x46a8fe[_0xe3ff('0x4')]][_0xe3ff('0x22')]=![];queues[_0x46a8fe['uniqueid']][_0xe3ff('0x23')]=null;queues[_0x46a8fe[_0xe3ff('0x4')]][_0xe3ff('0x19')]=![];queues[_0x46a8fe[_0xe3ff('0x4')]][_0xe3ff('0x9')]=null;queues[_0x46a8fe[_0xe3ff('0x4')]][_0xe3ff('0x24')]=null;queues[_0x46a8fe[_0xe3ff('0x4')]][_0xe3ff('0x3a')]=!![];queues[_0x46a8fe[_0xe3ff('0x4')]][_0xe3ff('0x3b')]=_0x46a8fe['destaccountcode'];queues[_0x46a8fe[_0xe3ff('0x4')]][_0xe3ff('0x7')]=_0x46a8fe['membername'];}}catch(_0x34ff35){utils['error'](util['format'](_0xe3ff('0x36'),_0x46a8fe[_0xe3ff('0x4')]),_0x34ff35);}};exports[_0xe3ff('0x3c')]=function(_0x2d1460){try{if(!_[_0xe3ff('0x17')](queues[_0x2d1460['uniqueid']])){if(queues[_0x2d1460[_0xe3ff('0x4')]][_0xe3ff('0x30')]){utils['debug'](util['format'](_0xe3ff('0x3d'),_0x2d1460[_0xe3ff('0x4')]),_0x2d1460);queues[_0x2d1460[_0xe3ff('0x4')]][_0xe3ff('0x22')]=![];queues[_0x2d1460['uniqueid']]['queuecallerabandon']=![];queues[_0x2d1460[_0xe3ff('0x4')]][_0xe3ff('0x23')]=null;queues[_0x2d1460[_0xe3ff('0x4')]]['queuecallerexit']=![];queues[_0x2d1460[_0xe3ff('0x4')]]['queuecallerexitAt']=null;queues[_0x2d1460[_0xe3ff('0x4')]]['assigned']=!![];queues[_0x2d1460[_0xe3ff('0x4')]][_0xe3ff('0x7')]=_0x2d1460[_0xe3ff('0x38')];queues[_0x2d1460[_0xe3ff('0x4')]][_0xe3ff('0x1a')]=!![];queues[_0x2d1460[_0xe3ff('0x4')]][_0xe3ff('0x3e')]=utils[_0xe3ff('0x15')]();if(_0x2d1460[_0xe3ff('0x3f')]==_0xe3ff('0x40')){if(!queues[_0x2d1460[_0xe3ff('0x4')]]['transfer']){queues[_0x2d1460[_0xe3ff('0x4')]][_0xe3ff('0x9')]=_0xe3ff('0x41');}}else{queues[_0x2d1460[_0xe3ff('0x4')]][_0xe3ff('0x9')]='COMPLETEDBY'+_0x2d1460[_0xe3ff('0x3f')][_0xe3ff('0x21')]();}utils[_0xe3ff('0x12')](util[_0xe3ff('0x2')](_0xe3ff('0x42'),_0x2d1460[_0xe3ff('0x4')],queues[_0x2d1460[_0xe3ff('0x4')]][_0xe3ff('0x26')],_0x2d1460[_0xe3ff('0x38')],queues[_0x2d1460[_0xe3ff('0x4')]]['queuecallerexitreason']));writeDB(queues[_0x2d1460[_0xe3ff('0x4')]]);}}}catch(_0x21ea05){utils[_0xe3ff('0x1c')](util[_0xe3ff('0x2')](_0xe3ff('0x3d'),_0x2d1460['uniqueid']),_0x21ea05);}};exports[_0xe3ff('0x43')]=function(_0x30674e){try{if(!_[_0xe3ff('0x17')](queues[_0x30674e[_0xe3ff('0x44')]])){utils[_0xe3ff('0x10')](util[_0xe3ff('0x2')](_0xe3ff('0x45'),_0x30674e[_0xe3ff('0x4')]),_0x30674e);queues[_0x30674e[_0xe3ff('0x44')]][_0xe3ff('0x40')]=!![];queues[_0x30674e[_0xe3ff('0x44')]][_0xe3ff('0x46')]=_0xe3ff('0x47');queues[_0x30674e[_0xe3ff('0x44')]][_0xe3ff('0x48')]=_0x30674e[_0xe3ff('0x49')];queues[_0x30674e[_0xe3ff('0x44')]][_0xe3ff('0x4a')]=_0x30674e[_0xe3ff('0x44')];queues[_0x30674e['transfereeuniqueid']][_0xe3ff('0x9')]=_0xe3ff('0x4b');utils[_0xe3ff('0x12')](util[_0xe3ff('0x2')](_0xe3ff('0x4c'),_0x30674e[_0xe3ff('0x4')],queues[_0x30674e[_0xe3ff('0x44')]][_0xe3ff('0x26')],_0x30674e[_0xe3ff('0x44')],_0x30674e[_0xe3ff('0x49')]));}}catch(_0x2d2750){utils[_0xe3ff('0x1c')](util[_0xe3ff('0x2')](_0xe3ff('0x45'),_0x30674e[_0xe3ff('0x4')]),_0x2d2750);}};exports['attendedtransfer']=function(_0x40b4b0){try{utils[_0xe3ff('0x10')](util[_0xe3ff('0x2')](_0xe3ff('0x4d'),_0x40b4b0[_0xe3ff('0x4e')]),_0x40b4b0);if(_0x40b4b0['origtransfereruniqueid']==_0x40b4b0['origtransfererlinkedid']){if(!_[_0xe3ff('0x17')](queues[_0x40b4b0[_0xe3ff('0x4f')]])){utils[_0xe3ff('0x12')](util[_0xe3ff('0x2')](_0xe3ff('0x50'),_0x40b4b0['origtransfereruniqueid'],queues[_0x40b4b0[_0xe3ff('0x4f')]][_0xe3ff('0x26')],_0x40b4b0[_0xe3ff('0x51')]));queues[_0x40b4b0[_0xe3ff('0x4f')]]['transfer']=!![];queues[_0x40b4b0['secondtransfererlinkedid']][_0xe3ff('0x46')]=_0xe3ff('0x52');queues[_0x40b4b0[_0xe3ff('0x4f')]][_0xe3ff('0x48')]=_0x40b4b0['origtransfererexten'];queues[_0x40b4b0['secondtransfererlinkedid']]['transferuniqueid']=_0x40b4b0[_0xe3ff('0x4e')];queues[_0x40b4b0['secondtransfererlinkedid']]['queuecallerexitreason']=_0xe3ff('0x53');}if(!_[_0xe3ff('0x17')](queues[_0x40b4b0[_0xe3ff('0x54')]])){if(_0x40b4b0[_0xe3ff('0x55')]&&queues[_0x40b4b0[_0xe3ff('0x55')]]){queues[_0x40b4b0[_0xe3ff('0x55')]][_0xe3ff('0x56')]=0x1;queues[_0x40b4b0[_0xe3ff('0x44')]]=_[_0xe3ff('0x57')](queues[_0x40b4b0[_0xe3ff('0x55')]]);queues[_0x40b4b0[_0xe3ff('0x44')]][_0xe3ff('0xf')]=_0x40b4b0[_0xe3ff('0x58')];queues[_0x40b4b0[_0xe3ff('0x44')]]['queuecallerenterreason']=0x2;queues[_0x40b4b0[_0xe3ff('0x44')]]['calleridnum']=queues[_0x40b4b0[_0xe3ff('0x4f')]][_0xe3ff('0x8')];queues[_0x40b4b0[_0xe3ff('0x44')]]['calleridname']=queues[_0x40b4b0['secondtransfererlinkedid']]['calleridname'];queues[_0x40b4b0[_0xe3ff('0x44')]]['queuecallerjoinAt']=utils[_0xe3ff('0x15')]();queues[_0x40b4b0[_0xe3ff('0x44')]]['queuecallerleaveAt']=utils[_0xe3ff('0x15')]();queues[_0x40b4b0[_0xe3ff('0x44')]][_0xe3ff('0x31')]=0x0;queues[_0x40b4b0['transfereeuniqueid']][_0xe3ff('0x59')]=0x0;utils[_0xe3ff('0x12')](util[_0xe3ff('0x2')](_0xe3ff('0x5a'),_0x40b4b0[_0xe3ff('0x4e')],queues[_0x40b4b0[_0xe3ff('0x44')]][_0xe3ff('0x26')],queues[_0x40b4b0[_0xe3ff('0x44')]][_0xe3ff('0x8')],queues[_0x40b4b0[_0xe3ff('0x44')]]['calleridname']));}else{utils[_0xe3ff('0x12')](util[_0xe3ff('0x2')](_0xe3ff('0x5b'),_0x40b4b0['origtransfereruniqueid'],queues[_0x40b4b0[_0xe3ff('0x54')]]['name'],_0x40b4b0['secondtransfererlinkedid']));queues[_0x40b4b0[_0xe3ff('0x54')]]['transfereduniqueid']=_0x40b4b0[_0xe3ff('0x4f')];}}}else if(_0x40b4b0[_0xe3ff('0x5c')]==_0x40b4b0[_0xe3ff('0x4f')]){if(!_[_0xe3ff('0x17')](queues[_0x40b4b0[_0xe3ff('0x54')]])){utils[_0xe3ff('0x12')](util[_0xe3ff('0x2')](_0xe3ff('0x5d'),_0x40b4b0['origtransfereruniqueid'],queues[_0x40b4b0[_0xe3ff('0x54')]][_0xe3ff('0x26')],_0x40b4b0[_0xe3ff('0x5c')],_0x40b4b0['secondtransfererexten']));queues[_0x40b4b0[_0xe3ff('0x54')]][_0xe3ff('0x40')]=!![];queues[_0x40b4b0[_0xe3ff('0x54')]][_0xe3ff('0x46')]=_0xe3ff('0x52');queues[_0x40b4b0[_0xe3ff('0x54')]][_0xe3ff('0x48')]=_0x40b4b0['secondtransfererexten'];queues[_0x40b4b0[_0xe3ff('0x54')]][_0xe3ff('0x4a')]=_0x40b4b0['secondtransfereruniqueid'];queues[_0x40b4b0[_0xe3ff('0x54')]][_0xe3ff('0x9')]=_0xe3ff('0x53');}if(!_[_0xe3ff('0x17')](queues[_0x40b4b0[_0xe3ff('0x4f')]])){if(_0x40b4b0[_0xe3ff('0x5e')]&&queues[_0x40b4b0[_0xe3ff('0x5e')]]){queues[_0x40b4b0['transfertargetlinkedid']][_0xe3ff('0x56')]=0x1;queues[_0x40b4b0[_0xe3ff('0x58')]]=_[_0xe3ff('0x57')](queues[_0x40b4b0['transfertargetlinkedid']]);queues[_0x40b4b0[_0xe3ff('0x58')]][_0xe3ff('0xf')]=_0x40b4b0[_0xe3ff('0x58')];queues[_0x40b4b0[_0xe3ff('0x58')]][_0xe3ff('0x56')]=0x2;queues[_0x40b4b0['transfertargetuniqueid']][_0xe3ff('0x8')]=queues[_0x40b4b0['origtransfererlinkedid']][_0xe3ff('0x8')];queues[_0x40b4b0['transfertargetuniqueid']][_0xe3ff('0x5f')]=queues[_0x40b4b0[_0xe3ff('0x54')]][_0xe3ff('0x5f')];queues[_0x40b4b0[_0xe3ff('0x58')]][_0xe3ff('0x33')]=utils['now']();queues[_0x40b4b0['transfertargetuniqueid']][_0xe3ff('0x30')]=utils[_0xe3ff('0x15')]();queues[_0x40b4b0[_0xe3ff('0x58')]][_0xe3ff('0x31')]=0x0;queues[_0x40b4b0[_0xe3ff('0x58')]][_0xe3ff('0x59')]=0x0;utils['info'](util[_0xe3ff('0x2')](_0xe3ff('0x60'),_0x40b4b0['origtransfereruniqueid'],queues[_0x40b4b0[_0xe3ff('0x58')]][_0xe3ff('0x26')],queues[_0x40b4b0[_0xe3ff('0x58')]]['transfereduniqueid'],queues[_0x40b4b0['transfertargetuniqueid']][_0xe3ff('0x8')],queues[_0x40b4b0['transfertargetuniqueid']][_0xe3ff('0x5f')]));}else{utils[_0xe3ff('0x12')](util[_0xe3ff('0x2')](_0xe3ff('0x5b'),_0x40b4b0['origtransfereruniqueid'],queues[_0x40b4b0[_0xe3ff('0x4f')]][_0xe3ff('0x26')],_0x40b4b0[_0xe3ff('0x54')]));queues[_0x40b4b0[_0xe3ff('0x4f')]][_0xe3ff('0xf')]=_0x40b4b0[_0xe3ff('0x54')];}}}}catch(_0x389a5b){utils[_0xe3ff('0x1c')](util[_0xe3ff('0x2')](_0xe3ff('0x4d'),_0x40b4b0[_0xe3ff('0x4e')]),_0x389a5b);}};exports[_0xe3ff('0x61')]=function(_0x3c8773){try{if(!_[_0xe3ff('0x17')](queues[_0x3c8773[_0xe3ff('0x4')]])){utils['debug'](util[_0xe3ff('0x2')](_0xe3ff('0x62'),_0x3c8773[_0xe3ff('0x4')]),_0x3c8773);queues[_0x3c8773[_0xe3ff('0x4')]][_0xe3ff('0x63')]=utils[_0xe3ff('0x15')]();utils[_0xe3ff('0x12')](util[_0xe3ff('0x2')]('[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s',_0x3c8773[_0xe3ff('0x4')],queues[_0x3c8773[_0xe3ff('0x4')]][_0xe3ff('0x26')],queues[_0x3c8773[_0xe3ff('0x4')]][_0xe3ff('0x63')]));}}catch(_0xa24b9a){utils[_0xe3ff('0x1c')](util[_0xe3ff('0x2')](_0xe3ff('0x62'),_0x3c8773[_0xe3ff('0x4')]),_0xa24b9a);}};exports['musiconholdstop']=function(_0x1e9983){try{if(!_[_0xe3ff('0x17')](queues[_0x1e9983[_0xe3ff('0x4')]])){if(!_[_0xe3ff('0x17')](queues[_0x1e9983[_0xe3ff('0x4')]]['musiconholdstartAt'])){utils[_0xe3ff('0x10')](util[_0xe3ff('0x2')](_0xe3ff('0x64'),_0x1e9983[_0xe3ff('0x4')]),_0x1e9983);queues[_0x1e9983[_0xe3ff('0x4')]][_0xe3ff('0x59')]+=utils['diffTime'](utils[_0xe3ff('0x15')](),queues[_0x1e9983[_0xe3ff('0x4')]][_0xe3ff('0x63')]);utils[_0xe3ff('0x12')](util[_0xe3ff('0x2')]('[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s',_0x1e9983['uniqueid'],queues[_0x1e9983[_0xe3ff('0x4')]]['name'],queues[_0x1e9983[_0xe3ff('0x4')]]['mohtime']));delete queues[_0x1e9983[_0xe3ff('0x4')]]['musiconholdstartAt'];}}}catch(_0x51c988){utils[_0xe3ff('0x1c')](util[_0xe3ff('0x2')](_0xe3ff('0x64'),_0x1e9983[_0xe3ff('0x4')]),_0x51c988);}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index bf308cf..e48a978 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 _0xa4e5=['queue','lodash','util','./utils','info','format','[%s][recordings][writeDB]','accountcode','getUserByInternal','name','UserId','request','CreateVoiceRecording','newchannel','debug','[%s][recordings][newchannel]','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','uniqueid','context','exten','channel','newstate','isNil','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','linkedid','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','error','[%s][recordings][newstate]','varset','variable','endsWith','value','replace','.wav49','.WAV','find','monitors','[%s][recordings][varset]','hangup','[%s][recordings][hangup]','calleridnum','calleridname','cause-txt','connectedlinenum','connectedlinename','type','outbound','forEach','newexten','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','appdata','set','startsWith','toLowerCase','cdr','split','substring','lastIndexOf','queuecallerjoin','[%s][recordings][queuecallerjoin]'];(function(_0x3b152e,_0x49c791){var _0x5020af=function(_0x5a2ef7){while(--_0x5a2ef7){_0x3b152e['push'](_0x3b152e['shift']());}};_0x5020af(++_0x49c791);}(_0xa4e5,0x1ba));var _0x5a4e=function(_0x4c5172,_0x5c4f8c){_0x4c5172=_0x4c5172-0x0;var _0x397837=_0xa4e5[_0x4c5172];return _0x397837;};'use strict';var _=require(_0x5a4e('0x0'));var util=require(_0x5a4e('0x1'));var utils=require(_0x5a4e('0x2'));var recordings={};function writeDB(_0x4392d4){utils[_0x5a4e('0x3')](util[_0x5a4e('0x4')](_0x5a4e('0x5'),_0x4392d4['uniqueid']));if(_0x4392d4[_0x5a4e('0x6')]){utils[_0x5a4e('0x7')](_0x4392d4[_0x5a4e('0x6')])['then'](function(_0x323b6d){if(_0x323b6d){_0x4392d4['membername']=_0x323b6d[_0x5a4e('0x8')];_0x4392d4[_0x5a4e('0x9')]=_0x323b6d['id'];}utils[_0x5a4e('0xa')](_0x5a4e('0xb'),_0x4392d4);});}else{utils[_0x5a4e('0xa')](_0x5a4e('0xb'),_0x4392d4);}}exports[_0x5a4e('0xc')]=function(_0x337b5e){try{utils[_0x5a4e('0xd')](util[_0x5a4e('0x4')](_0x5a4e('0xe'),_0x337b5e['uniqueid']),_0x337b5e);if(_0x337b5e['uniqueid']==_0x337b5e['linkedid']){utils['info'](util['format'](_0x5a4e('0xf'),_0x337b5e[_0x5a4e('0x10')],_0x337b5e[_0x5a4e('0x11')],_0x337b5e[_0x5a4e('0x12')]));recordings[_0x337b5e[_0x5a4e('0x10')]]={'uniqueid':_0x337b5e[_0x5a4e('0x10')],'accountcode':_0x337b5e[_0x5a4e('0x6')],'exten':_0x337b5e[_0x5a4e('0x12')],'context':_0x337b5e[_0x5a4e('0x11')],'channel':_0x337b5e[_0x5a4e('0x13')],'monitors':[]};}}catch(_0x9f3420){utils['error'](util[_0x5a4e('0x4')]('[%s][recordings][newchannel]',_0x337b5e[_0x5a4e('0x10')]),_0x9f3420);}};exports[_0x5a4e('0x14')]=function(_0x176652){try{utils[_0x5a4e('0xd')](util['format']('[%s][recordings][newstate]',_0x176652[_0x5a4e('0x10')]),_0x176652);if(!_[_0x5a4e('0x15')](recordings[_0x176652[_0x5a4e('0x10')]])&&_0x176652[_0x5a4e('0x16')]==0x6){utils['info'](util['format'](_0x5a4e('0x17'),_0x176652[_0x5a4e('0x10')],_0x176652[_0x5a4e('0x11')],_0x176652[_0x5a4e('0x13')]));}else if(!_['isNil'](recordings[_0x176652[_0x5a4e('0x18')]])&&_0x176652['channelstate']==0x6&&_0x176652[_0x5a4e('0x11')]!=_0x5a4e('0x19')){utils[_0x5a4e('0x3')](util[_0x5a4e('0x4')](_0x5a4e('0x1a'),_0x176652[_0x5a4e('0x10')],_0x176652['linkedid'],_0x176652[_0x5a4e('0x11')],_0x176652[_0x5a4e('0x13')]));recordings[_0x176652[_0x5a4e('0x18')]][_0x5a4e('0x6')]=_0x176652[_0x5a4e('0x6')];}}catch(_0x7b6c0){utils[_0x5a4e('0x1b')](util[_0x5a4e('0x4')](_0x5a4e('0x1c'),_0x176652[_0x5a4e('0x10')]),_0x7b6c0);}};exports[_0x5a4e('0x1d')]=function(_0x5ae54a){try{if(!_['isNil'](_0x5ae54a[_0x5a4e('0x1e')])&&!_['isNil'](_0x5ae54a[_0x5a4e('0x1e')]['mixmonitor_filename'])){utils['debug'](util['format']('[%s][recordings][varset]',_0x5ae54a[_0x5a4e('0x10')]),_0x5ae54a);utils[_0x5a4e('0x3')](util[_0x5a4e('0x4')]('[%s][recordings][varset]\x20variable:%s\x20value:%s',_0x5ae54a[_0x5a4e('0x10')],_0x5ae54a[_0x5a4e('0x1e')],_0x5ae54a['value']));if(_[_0x5a4e('0x1f')](_0x5ae54a[_0x5a4e('0x20')],'.wav49')){_0x5ae54a[_0x5a4e('0x20')]=_0x5ae54a[_0x5a4e('0x20')][_0x5a4e('0x21')](_0x5a4e('0x22'),_0x5a4e('0x23'));}if(recordings[_0x5ae54a[_0x5a4e('0x18')]]){var _0xc66133=_[_0x5a4e('0x24')](recordings[_0x5ae54a[_0x5a4e('0x18')]]['monitors'],{'value':_0x5ae54a[_0x5a4e('0x20')]});if(_[_0x5a4e('0x15')](_0xc66133)){recordings[_0x5ae54a[_0x5a4e('0x18')]][_0x5a4e('0x25')]['push']({'value':_0x5ae54a[_0x5a4e('0x20')]});}}}}catch(_0x1ab3a8){utils[_0x5a4e('0x1b')](util[_0x5a4e('0x4')](_0x5a4e('0x26'),_0x5ae54a[_0x5a4e('0x10')]),_0x1ab3a8);}};exports[_0x5a4e('0x27')]=function(_0x44eee5){try{if(!_['isNil'](recordings[_0x44eee5[_0x5a4e('0x10')]])){utils['debug'](util['format'](_0x5a4e('0x28'),_0x44eee5[_0x5a4e('0x10')]),_0x44eee5);utils[_0x5a4e('0x3')](util[_0x5a4e('0x4')]('[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s',_0x44eee5[_0x5a4e('0x10')],_0x44eee5[_0x5a4e('0x29')],_0x44eee5[_0x5a4e('0x2a')],_0x44eee5[_0x5a4e('0x2b')]));recordings[_0x44eee5[_0x5a4e('0x10')]]['calleridnum']=_0x44eee5['calleridnum'];recordings[_0x44eee5[_0x5a4e('0x10')]]['calleridname']=_0x44eee5[_0x5a4e('0x2a')];recordings[_0x44eee5['uniqueid']][_0x5a4e('0x2c')]=_0x44eee5[_0x5a4e('0x2c')];recordings[_0x44eee5[_0x5a4e('0x10')]][_0x5a4e('0x2d')]=_0x44eee5[_0x5a4e('0x2d')];if(recordings[_0x44eee5['uniqueid']][_0x5a4e('0x2e')]==_0x5a4e('0x2f')&&recordings[_0x44eee5['uniqueid']][_0x5a4e('0x6')]){recordings[_0x44eee5['uniqueid']][_0x5a4e('0x2c')]=recordings[_0x44eee5[_0x5a4e('0x10')]]['accountcode'];recordings[_0x44eee5['uniqueid']]['connectedlinename']='';}recordings[_0x44eee5[_0x5a4e('0x10')]][_0x5a4e('0x25')][_0x5a4e('0x30')](function(_0x338891){var _0x2db4c8=_['clone'](recordings[_0x44eee5[_0x5a4e('0x10')]]);_0x2db4c8['value']=_0x338891[_0x5a4e('0x20')];writeDB(_0x2db4c8);});delete recordings[_0x44eee5[_0x5a4e('0x10')]];}}catch(_0x6ffddf){utils[_0x5a4e('0x1b')](util[_0x5a4e('0x4')]('[%s][recordings][hangup]',_0x44eee5[_0x5a4e('0x10')]),_0x6ffddf);}};exports[_0x5a4e('0x31')]=function(_0x1e4dfb){try{if(!_['isNil'](recordings[_0x1e4dfb[_0x5a4e('0x10')]])){utils['debug'](util['format'](_0x5a4e('0x32'),_0x1e4dfb['uniqueid']),_0x1e4dfb);utils['info'](util[_0x5a4e('0x4')](_0x5a4e('0x33'),_0x1e4dfb[_0x5a4e('0x10')],_0x1e4dfb['application'],_0x1e4dfb[_0x5a4e('0x34')]));if(_0x1e4dfb['application']['toLowerCase']()==_0x5a4e('0x35')&&_[_0x5a4e('0x36')](_0x1e4dfb[_0x5a4e('0x34')][_0x5a4e('0x37')](),_0x5a4e('0x38'))){var _0x5265bd=_0x1e4dfb[_0x5a4e('0x34')][_0x5a4e('0x39')]('=');var _0x3cf50c=_0x5265bd[0x0][_0x5a4e('0x3a')](_0x5265bd[0x0]['lastIndexOf']('(')+0x1,_0x5265bd[0x0][_0x5a4e('0x3b')](')'));var _0x598c43=_0x5265bd[0x1];recordings[_0x1e4dfb['uniqueid']][_0x3cf50c]=_0x598c43;}}}catch(_0x460e72){utils[_0x5a4e('0x1b')](util[_0x5a4e('0x4')](_0x5a4e('0x32'),_0x1e4dfb[_0x5a4e('0x10')]),_0x460e72);}};exports[_0x5a4e('0x3c')]=function(_0xc11840){try{if(!_['isNil'](recordings[_0xc11840[_0x5a4e('0x10')]])){utils[_0x5a4e('0xd')](util[_0x5a4e('0x4')](_0x5a4e('0x3d'),_0xc11840[_0x5a4e('0x10')]),_0xc11840);utils[_0x5a4e('0x3')](util[_0x5a4e('0x4')]('[%s][recordings][queuecallerjoin]\x20queue:%s',_0xc11840['uniqueid'],_0xc11840[_0x5a4e('0x3e')]));recordings[_0xc11840[_0x5a4e('0x10')]][_0x5a4e('0x3e')]=_0xc11840[_0x5a4e('0x3e')];}}catch(_0x52bb39){utils['error'](util[_0x5a4e('0x4')]('[%s][recordings][queuecallerjoin]',_0xc11840[_0x5a4e('0x10')]),_0x52bb39);}}; \ No newline at end of file +var _0x697c=['lodash','util','./utils','[%s][recordings][writeDB]','uniqueid','accountcode','getUserByInternal','then','newchannel','linkedid','context','channel','newstate','debug','format','[%s][recordings][newstate]','isNil','info','[%s][recordings][newstate]\x20context:%s\x20channel:%s','error','varset','variable','mixmonitor_filename','[%s][recordings][varset]','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','replace','.wav49','.WAV','find','monitors','push','hangup','[%s][recordings][hangup]','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum','calleridname','cause-txt','connectedlinenum','connectedlinename','outbound','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','appdata','set','startsWith','toLowerCase','cdr','split','substring','lastIndexOf','[%s][recordings][queuecallerjoin]\x20queue:%s','queue'];(function(_0x2f023d,_0x29dfe5){var _0x4ef240=function(_0x49f1ec){while(--_0x49f1ec){_0x2f023d['push'](_0x2f023d['shift']());}};_0x4ef240(++_0x29dfe5);}(_0x697c,0xd8));var _0xc697=function(_0x7e7286,_0x3b14e5){_0x7e7286=_0x7e7286-0x0;var _0x3c6e4e=_0x697c[_0x7e7286];return _0x3c6e4e;};'use strict';var _=require(_0xc697('0x0'));var util=require(_0xc697('0x1'));var utils=require(_0xc697('0x2'));var recordings={};function writeDB(_0x5f4ca3){utils['info'](util['format'](_0xc697('0x3'),_0x5f4ca3[_0xc697('0x4')]));if(_0x5f4ca3[_0xc697('0x5')]){utils[_0xc697('0x6')](_0x5f4ca3[_0xc697('0x5')])[_0xc697('0x7')](function(_0x225a0b){if(_0x225a0b){_0x5f4ca3['membername']=_0x225a0b['name'];_0x5f4ca3['UserId']=_0x225a0b['id'];}utils['request']('CreateVoiceRecording',_0x5f4ca3);});}else{utils['request']('CreateVoiceRecording',_0x5f4ca3);}}exports[_0xc697('0x8')]=function(_0x3da258){try{utils['debug'](util['format']('[%s][recordings][newchannel]',_0x3da258[_0xc697('0x4')]),_0x3da258);if(_0x3da258['uniqueid']==_0x3da258[_0xc697('0x9')]){utils['info'](util['format']('[%s][recordings][newchannel]\x20context:%s\x20exten:%s',_0x3da258[_0xc697('0x4')],_0x3da258[_0xc697('0xa')],_0x3da258['exten']));recordings[_0x3da258[_0xc697('0x4')]]={'uniqueid':_0x3da258[_0xc697('0x4')],'accountcode':_0x3da258[_0xc697('0x5')],'exten':_0x3da258['exten'],'context':_0x3da258[_0xc697('0xa')],'channel':_0x3da258[_0xc697('0xb')],'monitors':[]};}}catch(_0x51075b){utils['error'](util['format']('[%s][recordings][newchannel]',_0x3da258[_0xc697('0x4')]),_0x51075b);}};exports[_0xc697('0xc')]=function(_0x1740ae){try{utils[_0xc697('0xd')](util[_0xc697('0xe')](_0xc697('0xf'),_0x1740ae['uniqueid']),_0x1740ae);if(!_[_0xc697('0x10')](recordings[_0x1740ae[_0xc697('0x4')]])&&_0x1740ae['channelstate']==0x6){utils[_0xc697('0x11')](util[_0xc697('0xe')](_0xc697('0x12'),_0x1740ae[_0xc697('0x4')],_0x1740ae[_0xc697('0xa')],_0x1740ae[_0xc697('0xb')]));}else if(!_[_0xc697('0x10')](recordings[_0x1740ae[_0xc697('0x9')]])&&_0x1740ae['channelstate']==0x6&&_0x1740ae['context']!='transfer'){utils[_0xc697('0x11')](util[_0xc697('0xe')]('[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s',_0x1740ae[_0xc697('0x4')],_0x1740ae[_0xc697('0x9')],_0x1740ae[_0xc697('0xa')],_0x1740ae['channel']));recordings[_0x1740ae[_0xc697('0x9')]][_0xc697('0x5')]=_0x1740ae['accountcode'];}}catch(_0x4cebee){utils[_0xc697('0x13')](util[_0xc697('0xe')]('[%s][recordings][newstate]',_0x1740ae[_0xc697('0x4')]),_0x4cebee);}};exports[_0xc697('0x14')]=function(_0x161f7f){try{if(!_[_0xc697('0x10')](_0x161f7f[_0xc697('0x15')])&&!_[_0xc697('0x10')](_0x161f7f[_0xc697('0x15')][_0xc697('0x16')])){utils['debug'](util[_0xc697('0xe')](_0xc697('0x17'),_0x161f7f[_0xc697('0x4')]),_0x161f7f);utils[_0xc697('0x11')](util['format'](_0xc697('0x18'),_0x161f7f['uniqueid'],_0x161f7f['variable'],_0x161f7f[_0xc697('0x19')]));if(_['endsWith'](_0x161f7f[_0xc697('0x19')],'.wav49')){_0x161f7f[_0xc697('0x19')]=_0x161f7f[_0xc697('0x19')][_0xc697('0x1a')](_0xc697('0x1b'),_0xc697('0x1c'));}if(recordings[_0x161f7f[_0xc697('0x9')]]){var _0xce4f49=_[_0xc697('0x1d')](recordings[_0x161f7f[_0xc697('0x9')]][_0xc697('0x1e')],{'value':_0x161f7f[_0xc697('0x19')]});if(_[_0xc697('0x10')](_0xce4f49)){recordings[_0x161f7f[_0xc697('0x9')]]['monitors'][_0xc697('0x1f')]({'value':_0x161f7f['value']});}}}}catch(_0x54ee02){utils[_0xc697('0x13')](util['format']('[%s][recordings][varset]',_0x161f7f[_0xc697('0x4')]),_0x54ee02);}};exports[_0xc697('0x20')]=function(_0x4876c9){try{if(!_[_0xc697('0x10')](recordings[_0x4876c9['uniqueid']])){utils[_0xc697('0xd')](util['format'](_0xc697('0x21'),_0x4876c9['uniqueid']),_0x4876c9);utils[_0xc697('0x11')](util['format'](_0xc697('0x22'),_0x4876c9['uniqueid'],_0x4876c9[_0xc697('0x23')],_0x4876c9[_0xc697('0x24')],_0x4876c9[_0xc697('0x25')]));recordings[_0x4876c9['uniqueid']][_0xc697('0x23')]=_0x4876c9['calleridnum'];recordings[_0x4876c9[_0xc697('0x4')]][_0xc697('0x24')]=_0x4876c9[_0xc697('0x24')];recordings[_0x4876c9[_0xc697('0x4')]][_0xc697('0x26')]=_0x4876c9[_0xc697('0x26')];recordings[_0x4876c9[_0xc697('0x4')]][_0xc697('0x27')]=_0x4876c9[_0xc697('0x27')];if(recordings[_0x4876c9[_0xc697('0x4')]]['type']==_0xc697('0x28')&&recordings[_0x4876c9[_0xc697('0x4')]][_0xc697('0x5')]){recordings[_0x4876c9[_0xc697('0x4')]][_0xc697('0x26')]=recordings[_0x4876c9[_0xc697('0x4')]][_0xc697('0x5')];recordings[_0x4876c9['uniqueid']][_0xc697('0x27')]='';}recordings[_0x4876c9['uniqueid']][_0xc697('0x1e')]['forEach'](function(_0x533311){var _0x5cdb31=_['clone'](recordings[_0x4876c9[_0xc697('0x4')]]);_0x5cdb31[_0xc697('0x19')]=_0x533311['value'];writeDB(_0x5cdb31);});delete recordings[_0x4876c9[_0xc697('0x4')]];}}catch(_0x1e2dbf){utils['error'](util[_0xc697('0xe')]('[%s][recordings][hangup]',_0x4876c9[_0xc697('0x4')]),_0x1e2dbf);}};exports['newexten']=function(_0xa9f4f8){try{if(!_['isNil'](recordings[_0xa9f4f8['uniqueid']])){utils[_0xc697('0xd')](util[_0xc697('0xe')](_0xc697('0x29'),_0xa9f4f8[_0xc697('0x4')]),_0xa9f4f8);utils[_0xc697('0x11')](util[_0xc697('0xe')](_0xc697('0x2a'),_0xa9f4f8[_0xc697('0x4')],_0xa9f4f8[_0xc697('0x2b')],_0xa9f4f8[_0xc697('0x2c')]));if(_0xa9f4f8[_0xc697('0x2b')]['toLowerCase']()==_0xc697('0x2d')&&_[_0xc697('0x2e')](_0xa9f4f8[_0xc697('0x2c')][_0xc697('0x2f')](),_0xc697('0x30'))){var _0x41d36e=_0xa9f4f8[_0xc697('0x2c')][_0xc697('0x31')]('=');var _0x1c99ed=_0x41d36e[0x0][_0xc697('0x32')](_0x41d36e[0x0][_0xc697('0x33')]('(')+0x1,_0x41d36e[0x0][_0xc697('0x33')](')'));var _0x1b4970=_0x41d36e[0x1];recordings[_0xa9f4f8[_0xc697('0x4')]][_0x1c99ed]=_0x1b4970;}}}catch(_0x5eb863){utils[_0xc697('0x13')](util[_0xc697('0xe')]('[%s][recordings][newexten]',_0xa9f4f8[_0xc697('0x4')]),_0x5eb863);}};exports['queuecallerjoin']=function(_0xc03a92){try{if(!_[_0xc697('0x10')](recordings[_0xc03a92[_0xc697('0x4')]])){utils[_0xc697('0xd')](util[_0xc697('0xe')]('[%s][recordings][queuecallerjoin]',_0xc03a92[_0xc697('0x4')]),_0xc03a92);utils['info'](util[_0xc697('0xe')](_0xc697('0x34'),_0xc03a92[_0xc697('0x4')],_0xc03a92[_0xc697('0x35')]));recordings[_0xc03a92['uniqueid']][_0xc697('0x35')]=_0xc03a92[_0xc697('0x35')];}}catch(_0x386a98){utils[_0xc697('0x13')](util[_0xc697('0xe')]('[%s][recordings][queuecallerjoin]',_0xc03a92['uniqueid']),_0x386a98);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index bbd6eb7..d1511bf 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 _0xf840=['CreateVoiceTransferReport','debug','[%s][transfers][blindtransfer]','info','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transferercalleridname','transfereecalleridnum','transfereecalleridname','error','attendedtransfer','[%s][transfers][attendedtransfer]','origtransfereruniqueid','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridname','transfertargetcalleridnum','transfertargetcalleridname','origtransfererchannel','origtransferercalleridnum','secondtransfererconnectedlinenum','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','origtransferercontext','origtransfererexten','transfereechannel','assign','transfertargetchannel','transfertargetconnectedlinenum','transfertargetcontext','transfertargetexten','util','./utils','format','[%s][transfers][writeDB]\x20type:%s','type','attended','uniqueid'];(function(_0x320689,_0x5e496f){var _0xe3f33=function(_0x3173aa){while(--_0x3173aa){_0x320689['push'](_0x320689['shift']());}};_0xe3f33(++_0x5e496f);}(_0xf840,0x175));var _0x0f84=function(_0x565d34,_0x4176da){_0x565d34=_0x565d34-0x0;var _0x3751e7=_0xf840[_0x565d34];return _0x3751e7;};'use strict';var _=require('lodash');var util=require(_0x0f84('0x0'));var utils=require(_0x0f84('0x1'));function writeDB(_0x41d141){utils['info'](util[_0x0f84('0x2')](_0x0f84('0x3'),_0x41d141[_0x0f84('0x4')]===_0x0f84('0x5')?_0x41d141['origtransfereruniqueid']:_0x41d141[_0x0f84('0x6')],_0x41d141[_0x0f84('0x4')]));utils['request'](_0x0f84('0x7'),_0x41d141);}exports['blindtransfer']=function(_0x47ff8f){try{utils[_0x0f84('0x8')](util[_0x0f84('0x2')](_0x0f84('0x9'),_0x47ff8f[_0x0f84('0x6')]),_0x47ff8f);utils[_0x0f84('0xa')](util[_0x0f84('0x2')](_0x0f84('0xb'),_0x47ff8f[_0x0f84('0x6')],_0x47ff8f[_0x0f84('0xc')],_0x47ff8f[_0x0f84('0xd')],_0x47ff8f[_0x0f84('0xe')],_0x47ff8f[_0x0f84('0xf')]));_0x47ff8f[_0x0f84('0x4')]='blind';writeDB(_0x47ff8f);}catch(_0x4f0589){utils[_0x0f84('0x10')](util[_0x0f84('0x2')]('[%s][transfers][blindtransfer]',_0x47ff8f[_0x0f84('0x6')]),_0x4f0589);}};exports[_0x0f84('0x11')]=function(_0x3390d7){try{utils[_0x0f84('0x8')](util['format'](_0x0f84('0x12'),_0x3390d7[_0x0f84('0x13')]),_0x3390d7);utils[_0x0f84('0xa')](util[_0x0f84('0x2')](_0x0f84('0x14'),_0x3390d7[_0x0f84('0x13')],_0x3390d7['origtransferercalleridnum'],_0x3390d7[_0x0f84('0x15')],_0x3390d7[_0x0f84('0x16')],_0x3390d7[_0x0f84('0x17')]));_0x3390d7=_['assign'](_0x3390d7,{'transfererchannel':_0x3390d7[_0x0f84('0x18')],'transferercalleridnum':_0x3390d7[_0x0f84('0x19')],'transferercalleridname':_0x3390d7[_0x0f84('0x15')],'transfererconnectedlinenum':_0x3390d7[_0x0f84('0x1a')],'transfererconnectedlinename':_0x3390d7['secondtransfererconnectedlinename'],'transfereraccountcode':_0x3390d7['origtransfereraccountcode'],'transferercontext':_0x3390d7[_0x0f84('0x1b')],'transfererexten':_0x3390d7[_0x0f84('0x1c')],'transfererlinkedid':_0x3390d7[_0x0f84('0x1d')],'context':_0x3390d7[_0x0f84('0x1e')],'extension':_0x3390d7[_0x0f84('0x1f')],'type':_0x0f84('0x5')});if(_['isNil'](_0x3390d7[_0x0f84('0x20')])){_0x3390d7=_[_0x0f84('0x21')](_0x3390d7,{'transfereechannel':_0x3390d7[_0x0f84('0x22')],'transfereecalleridnum':_0x3390d7[_0x0f84('0x16')],'transfereecalleridname':_0x3390d7[_0x0f84('0x17')],'transfereeconnectedlinenum':_0x3390d7[_0x0f84('0x23')],'transfereeconnectedlinename':_0x3390d7['transfertargetconnectedlinename'],'transfereeaccountcode':_0x3390d7['transfertargetaccountcode'],'transfereecontext':_0x3390d7[_0x0f84('0x24')],'transfereeexten':_0x3390d7[_0x0f84('0x25')],'transfereelinkedid':_0x3390d7['transfertargetlinkedid']});}writeDB(_0x3390d7);}catch(_0x102791){utils[_0x0f84('0x10')](util[_0x0f84('0x2')](_0x0f84('0x12'),_0x3390d7['origtransfereruniqueid']),_0x102791);}}; \ No newline at end of file +var _0xe0af=['origtransfererchannel','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','secondtransferercontext','secondtransfererexten','origtransferercontext','origtransfererexten','isNil','transfereechannel','assign','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetexten','transfertargetlinkedid','lodash','util','./utils','info','format','[%s][transfers][writeDB]\x20type:%s','type','attended','origtransfereruniqueid','uniqueid','request','debug','[%s][transfers][blindtransfer]','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transfereecalleridnum','transfereecalleridname','blind','error','[%s][transfers][attendedtransfer]','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transfertargetcalleridnum','transfertargetcalleridname'];(function(_0x56de82,_0x2a0650){var _0xb4a459=function(_0x367036){while(--_0x367036){_0x56de82['push'](_0x56de82['shift']());}};_0xb4a459(++_0x2a0650);}(_0xe0af,0x1c9));var _0xfe0a=function(_0x231e16,_0x67347b){_0x231e16=_0x231e16-0x0;var _0x570a7c=_0xe0af[_0x231e16];return _0x570a7c;};'use strict';var _=require(_0xfe0a('0x0'));var util=require(_0xfe0a('0x1'));var utils=require(_0xfe0a('0x2'));function writeDB(_0x529e14){utils[_0xfe0a('0x3')](util[_0xfe0a('0x4')](_0xfe0a('0x5'),_0x529e14[_0xfe0a('0x6')]===_0xfe0a('0x7')?_0x529e14[_0xfe0a('0x8')]:_0x529e14[_0xfe0a('0x9')],_0x529e14[_0xfe0a('0x6')]));utils[_0xfe0a('0xa')]('CreateVoiceTransferReport',_0x529e14);}exports['blindtransfer']=function(_0x1251cf){try{utils[_0xfe0a('0xb')](util['format'](_0xfe0a('0xc'),_0x1251cf[_0xfe0a('0x9')]),_0x1251cf);utils['info'](util[_0xfe0a('0x4')](_0xfe0a('0xd'),_0x1251cf[_0xfe0a('0x9')],_0x1251cf[_0xfe0a('0xe')],_0x1251cf['transferercalleridname'],_0x1251cf[_0xfe0a('0xf')],_0x1251cf[_0xfe0a('0x10')]));_0x1251cf[_0xfe0a('0x6')]=_0xfe0a('0x11');writeDB(_0x1251cf);}catch(_0x2ffc9d){utils[_0xfe0a('0x12')](util['format'](_0xfe0a('0xc'),_0x1251cf[_0xfe0a('0x9')]),_0x2ffc9d);}};exports['attendedtransfer']=function(_0x16b62d){try{utils[_0xfe0a('0xb')](util[_0xfe0a('0x4')](_0xfe0a('0x13'),_0x16b62d['origtransfereruniqueid']),_0x16b62d);utils[_0xfe0a('0x3')](util['format'](_0xfe0a('0x14'),_0x16b62d[_0xfe0a('0x8')],_0x16b62d['origtransferercalleridnum'],_0x16b62d['origtransferercalleridname'],_0x16b62d[_0xfe0a('0x15')],_0x16b62d[_0xfe0a('0x16')]));_0x16b62d=_['assign'](_0x16b62d,{'transfererchannel':_0x16b62d[_0xfe0a('0x17')],'transferercalleridnum':_0x16b62d[_0xfe0a('0x18')],'transferercalleridname':_0x16b62d[_0xfe0a('0x19')],'transfererconnectedlinenum':_0x16b62d[_0xfe0a('0x1a')],'transfererconnectedlinename':_0x16b62d[_0xfe0a('0x1b')],'transfereraccountcode':_0x16b62d['origtransfereraccountcode'],'transferercontext':_0x16b62d[_0xfe0a('0x1c')],'transfererexten':_0x16b62d[_0xfe0a('0x1d')],'transfererlinkedid':_0x16b62d['origtransfererlinkedid'],'context':_0x16b62d[_0xfe0a('0x1e')],'extension':_0x16b62d[_0xfe0a('0x1f')],'type':_0xfe0a('0x7')});if(_[_0xfe0a('0x20')](_0x16b62d[_0xfe0a('0x21')])){_0x16b62d=_[_0xfe0a('0x22')](_0x16b62d,{'transfereechannel':_0x16b62d['transfertargetchannel'],'transfereecalleridnum':_0x16b62d[_0xfe0a('0x15')],'transfereecalleridname':_0x16b62d['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x16b62d[_0xfe0a('0x23')],'transfereeconnectedlinename':_0x16b62d[_0xfe0a('0x24')],'transfereeaccountcode':_0x16b62d[_0xfe0a('0x25')],'transfereecontext':_0x16b62d['transfertargetcontext'],'transfereeexten':_0x16b62d[_0xfe0a('0x26')],'transfereelinkedid':_0x16b62d[_0xfe0a('0x27')]});}writeDB(_0x16b62d);}catch(_0x34912e){utils['error'](util[_0xfe0a('0x4')](_0xfe0a('0x13'),_0x16b62d[_0xfe0a('0x8')]),_0x34912e);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index 95128fb..fb585db 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 _0xf273=['[utils][request]\x20name:%s','internal','then','[utils][getUser]\x20where:%s','result','length','getUserByInternal','[utils][getUserByInternal]\x20internal:%s\x20%s','found','notfound','[utils][getUserByInternal]','getUserByInterface','[utils][getUserByInterface]\x20interface:%s\x20%s','getUserByName','[utils][getUserByName]','getVoiceQueueByName','GetVoiceQueue','name','type','acw','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]\x20name:%s\x20%s','[utils][getVoiceQueueByName]','addTime','add','seconds','format','YYYY-MM-DD\x20HH:mm:ss','subtractTime','sumTime','now','isAfter','isBefore','bluebird','moment','../../config/logger','info','inspect','debug','error','request','catch'];(function(_0x4ad063,_0x5eddd0){var _0x12c738=function(_0x5359a6){while(--_0x5359a6){_0x4ad063['push'](_0x4ad063['shift']());}};_0x12c738(++_0x5eddd0);}(_0xf273,0x75));var _0x3f27=function(_0x2efc2d,_0x1efd65){_0x2efc2d=_0x2efc2d-0x0;var _0x2c7ee3=_0xf273[_0x2efc2d];return _0x2c7ee3;};'use strict';var BPromise=require(_0x3f27('0x0'));var jayson=require('jayson/promise');var moment=require(_0x3f27('0x1'));var util=require('util');var client=jayson['client']['http']({'port':0x2329});var logger=require(_0x3f27('0x2'))('xdr');exports['info']=function(_0x5bb9d6,_0xf1d53e){logger[_0x3f27('0x3')](_0x5bb9d6,_0xf1d53e?util[_0x3f27('0x4')](_0xf1d53e,{'showHidden':![],'depth':null}):'');};exports[_0x3f27('0x5')]=function(_0x26e5d0,_0x51736a){logger[_0x3f27('0x5')](_0x26e5d0,_0x51736a?util[_0x3f27('0x4')](_0x51736a,{'showHidden':![],'depth':null}):'');};exports[_0x3f27('0x6')]=function(_0x290af2,_0x48f0b9){logger[_0x3f27('0x6')](_0x290af2,_0x48f0b9?util[_0x3f27('0x4')](_0x48f0b9,{'showHidden':![],'depth':null}):'');};exports[_0x3f27('0x7')]=function(_0x3acaee,_0xe07905){return client[_0x3f27('0x7')](_0x3acaee,{'body':_0xe07905})['then'](function(_0x4a71d7){logger['debug']('[utils][request]\x20name:%s',_0x3acaee,_0x4a71d7?util['inspect'](_0x4a71d7,{'showHidden':![],'depth':null}):'');})[_0x3f27('0x8')](function(_0x1e19a0){logger[_0x3f27('0x6')](_0x3f27('0x9'),_0x3acaee,_0x1e19a0?util['inspect'](_0x1e19a0,{'showHidden':![],'depth':null}):'');});};function getUser(_0x4102d7){return client[_0x3f27('0x7')]('GetUser',{'options':{'raw':!![],'attributes':['id',_0x3f27('0xa'),'name','interface'],'where':_0x4102d7,'limit':0x1}})[_0x3f27('0xb')](function(_0x4ec637){logger[_0x3f27('0x5')](_0x3f27('0xc'),JSON['stringify'](_0x4102d7),_0x4ec637?util[_0x3f27('0x4')](_0x4ec637,{'showHidden':![],'depth':null}):'');return _0x4ec637[_0x3f27('0xd')][_0x3f27('0xe')]?_0x4ec637[_0x3f27('0xd')][0x0]:null;});}exports[_0x3f27('0xf')]=function(_0x43ec08){return new BPromise(function(_0x47427b,_0x47efd9){if(_0x43ec08){return getUser({'internal':_0x43ec08})['then'](function(_0x40857c){logger[_0x3f27('0x3')](_0x3f27('0x10'),_0x43ec08,_0x40857c?_0x3f27('0x11'):_0x3f27('0x12'));return _0x47427b(_0x40857c);})[_0x3f27('0x8')](function(_0x163138){logger['error'](_0x3f27('0x13'),_0x163138?util[_0x3f27('0x4')](_0x163138,{'showHidden':![],'depth':null}):'');return _0x47427b(null);});}return _0x47427b(null);});};exports[_0x3f27('0x14')]=function(_0x2dbefb){return new BPromise(function(_0x12a509,_0x38519c){if(_0x2dbefb){return getUser({'interface':_0x2dbefb})[_0x3f27('0xb')](function(_0x24ac92){logger['info'](_0x3f27('0x15'),_0x2dbefb,_0x24ac92?_0x3f27('0x11'):'notfound');return _0x12a509(_0x24ac92);})['catch'](function(_0x361ed9){logger[_0x3f27('0x6')]('[utils][getUserByInterface]',_0x361ed9?util[_0x3f27('0x4')](_0x361ed9,{'showHidden':![],'depth':null}):'');return _0x12a509(null);});}return _0x12a509(null);});};exports[_0x3f27('0x16')]=function(_0xa92aae){return new BPromise(function(_0x494a3c,_0x775b23){if(_0xa92aae){return getUser({'name':_0xa92aae})[_0x3f27('0xb')](function(_0x483501){logger[_0x3f27('0x3')]('[utils][getUserByName]\x20name:%s\x20%s',_0xa92aae,_0x483501?_0x3f27('0x11'):_0x3f27('0x12'));return _0x494a3c(_0x483501);})['catch'](function(_0x3c626){logger['error'](_0x3f27('0x17'),_0x3c626?util['inspect'](_0x3c626,{'showHidden':![],'depth':null}):'');return _0x494a3c(null);});}return _0x494a3c(null);});};exports[_0x3f27('0x18')]=function(_0x293b7){return new BPromise(function(_0x230f8a,_0x4137e0){if(_0x293b7){return client[_0x3f27('0x7')](_0x3f27('0x19'),{'options':{'raw':!![],'attributes':['id',_0x3f27('0x1a'),_0x3f27('0x1b'),_0x3f27('0x1c'),'acwTimeout'],'where':{'name':_0x293b7},'limit':0x1}})['then'](function(_0x234a77){logger[_0x3f27('0x5')](_0x3f27('0x1d'),_0x293b7,_0x234a77?util['inspect'](_0x234a77,{'showHidden':![],'depth':null}):'');logger['info'](_0x3f27('0x1e'),_0x293b7,_0x234a77?_0x3f27('0x11'):'notfound');return _0x230f8a(_0x234a77[_0x3f27('0xd')][_0x3f27('0xe')]?_0x234a77[_0x3f27('0xd')][0x0]:null);})[_0x3f27('0x8')](function(_0x309786){logger[_0x3f27('0x6')](_0x3f27('0x1f'),_0x309786?util[_0x3f27('0x4')](_0x309786,{'showHidden':![],'depth':null}):'');return _0x230f8a(null);});}return _0x230f8a(null);});};exports[_0x3f27('0x20')]=function(_0x55cf8f,_0x53fb87){return moment(_0x55cf8f)[_0x3f27('0x21')](_0x53fb87,_0x3f27('0x22'))[_0x3f27('0x23')](_0x3f27('0x24'));};exports[_0x3f27('0x25')]=function(_0x4ec28d,_0x376921){return moment(_0x4ec28d)['subtract'](_0x376921,_0x3f27('0x22'))[_0x3f27('0x23')](_0x3f27('0x24'));};exports['diffTime']=function(_0x2e6aae,_0x48b3dc){return moment(_0x2e6aae)['diff'](moment(_0x48b3dc),_0x3f27('0x22'));};exports[_0x3f27('0x26')]=function(_0x10b1fa,_0x29e579){return parseInt(_0x10b1fa,0xa)+parseInt(_0x29e579,0xa);};exports[_0x3f27('0x27')]=function(){return moment()['format']('YYYY-MM-DD\x20HH:mm:ss');};exports['isAfter']=function(_0x67c714,_0x1b3783){if(_0x1b3783){return moment(_0x67c714)[_0x3f27('0x28')](_0x1b3783);}return!![];};exports['isBefore']=function(_0x46a2b4,_0x48e872){if(_0x48e872){return moment(_0x46a2b4)[_0x3f27('0x29')](_0x48e872);}else if(_0x46a2b4){return!![];}return![];}; \ No newline at end of file +var _0xc1fa=['[utils][request]\x20name:%s','GetUser','internal','name','interface','stringify','result','[utils][getUserByInternal]\x20internal:%s\x20%s','notfound','[utils][getUserByInternal]','getUserByInterface','[utils][getUserByInterface]\x20interface:%s\x20%s','found','catch','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','getVoiceQueueByName','GetVoiceQueue','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]\x20name:%s\x20%s','length','[utils][getVoiceQueueByName]','addTime','seconds','format','YYYY-MM-DD\x20HH:mm:ss','subtractTime','subtract','diffTime','diff','sumTime','now','isAfter','isBefore','bluebird','jayson/promise','moment','util','client','http','xdr','info','inspect','debug','error','request','then'];(function(_0x1deb1c,_0x2cb6be){var _0x199621=function(_0x4ced52){while(--_0x4ced52){_0x1deb1c['push'](_0x1deb1c['shift']());}};_0x199621(++_0x2cb6be);}(_0xc1fa,0x83));var _0xac1f=function(_0x44216d,_0x4938a7){_0x44216d=_0x44216d-0x0;var _0xeca523=_0xc1fa[_0x44216d];return _0xeca523;};'use strict';var BPromise=require(_0xac1f('0x0'));var jayson=require(_0xac1f('0x1'));var moment=require(_0xac1f('0x2'));var util=require(_0xac1f('0x3'));var client=jayson[_0xac1f('0x4')][_0xac1f('0x5')]({'port':0x2329});var logger=require('../../config/logger')(_0xac1f('0x6'));exports[_0xac1f('0x7')]=function(_0x22cf15,_0x271b4b){logger[_0xac1f('0x7')](_0x22cf15,_0x271b4b?util[_0xac1f('0x8')](_0x271b4b,{'showHidden':![],'depth':null}):'');};exports[_0xac1f('0x9')]=function(_0x406495,_0x306807){logger[_0xac1f('0x9')](_0x406495,_0x306807?util[_0xac1f('0x8')](_0x306807,{'showHidden':![],'depth':null}):'');};exports[_0xac1f('0xa')]=function(_0x49c4c0,_0xf701a6){logger[_0xac1f('0xa')](_0x49c4c0,_0xf701a6?util[_0xac1f('0x8')](_0xf701a6,{'showHidden':![],'depth':null}):'');};exports[_0xac1f('0xb')]=function(_0x221222,_0x50fbcb){return client['request'](_0x221222,{'body':_0x50fbcb})[_0xac1f('0xc')](function(_0x5a1bad){logger['debug'](_0xac1f('0xd'),_0x221222,_0x5a1bad?util[_0xac1f('0x8')](_0x5a1bad,{'showHidden':![],'depth':null}):'');})['catch'](function(_0x1be117){logger[_0xac1f('0xa')](_0xac1f('0xd'),_0x221222,_0x1be117?util[_0xac1f('0x8')](_0x1be117,{'showHidden':![],'depth':null}):'');});};function getUser(_0xb5005b){return client[_0xac1f('0xb')](_0xac1f('0xe'),{'options':{'raw':!![],'attributes':['id',_0xac1f('0xf'),_0xac1f('0x10'),_0xac1f('0x11')],'where':_0xb5005b,'limit':0x1}})[_0xac1f('0xc')](function(_0x2671ec){logger[_0xac1f('0x9')]('[utils][getUser]\x20where:%s',JSON[_0xac1f('0x12')](_0xb5005b),_0x2671ec?util[_0xac1f('0x8')](_0x2671ec,{'showHidden':![],'depth':null}):'');return _0x2671ec[_0xac1f('0x13')]['length']?_0x2671ec[_0xac1f('0x13')][0x0]:null;});}exports['getUserByInternal']=function(_0xb825f3){return new BPromise(function(_0x1c5e74,_0x120b4e){if(_0xb825f3){return getUser({'internal':_0xb825f3})[_0xac1f('0xc')](function(_0x518180){logger[_0xac1f('0x7')](_0xac1f('0x14'),_0xb825f3,_0x518180?'found':_0xac1f('0x15'));return _0x1c5e74(_0x518180);})['catch'](function(_0x342495){logger[_0xac1f('0xa')](_0xac1f('0x16'),_0x342495?util[_0xac1f('0x8')](_0x342495,{'showHidden':![],'depth':null}):'');return _0x1c5e74(null);});}return _0x1c5e74(null);});};exports[_0xac1f('0x17')]=function(_0x1d1158){return new BPromise(function(_0xba5665,_0x1348e6){if(_0x1d1158){return getUser({'interface':_0x1d1158})['then'](function(_0x51180a){logger[_0xac1f('0x7')](_0xac1f('0x18'),_0x1d1158,_0x51180a?_0xac1f('0x19'):_0xac1f('0x15'));return _0xba5665(_0x51180a);})[_0xac1f('0x1a')](function(_0x2718d3){logger[_0xac1f('0xa')]('[utils][getUserByInterface]',_0x2718d3?util[_0xac1f('0x8')](_0x2718d3,{'showHidden':![],'depth':null}):'');return _0xba5665(null);});}return _0xba5665(null);});};exports[_0xac1f('0x1b')]=function(_0x2747cd){return new BPromise(function(_0x5b69ce,_0x479293){if(_0x2747cd){return getUser({'name':_0x2747cd})[_0xac1f('0xc')](function(_0x3dab27){logger[_0xac1f('0x7')](_0xac1f('0x1c'),_0x2747cd,_0x3dab27?_0xac1f('0x19'):_0xac1f('0x15'));return _0x5b69ce(_0x3dab27);})[_0xac1f('0x1a')](function(_0x2c18bb){logger[_0xac1f('0xa')]('[utils][getUserByName]',_0x2c18bb?util[_0xac1f('0x8')](_0x2c18bb,{'showHidden':![],'depth':null}):'');return _0x5b69ce(null);});}return _0x5b69ce(null);});};exports[_0xac1f('0x1d')]=function(_0x2b5116){return new BPromise(function(_0x550694,_0x537e92){if(_0x2b5116){return client[_0xac1f('0xb')](_0xac1f('0x1e'),{'options':{'raw':!![],'attributes':['id',_0xac1f('0x10'),'type','acw',_0xac1f('0x1f')],'where':{'name':_0x2b5116},'limit':0x1}})[_0xac1f('0xc')](function(_0x3a930d){logger[_0xac1f('0x9')](_0xac1f('0x20'),_0x2b5116,_0x3a930d?util[_0xac1f('0x8')](_0x3a930d,{'showHidden':![],'depth':null}):'');logger[_0xac1f('0x7')](_0xac1f('0x21'),_0x2b5116,_0x3a930d?_0xac1f('0x19'):_0xac1f('0x15'));return _0x550694(_0x3a930d[_0xac1f('0x13')][_0xac1f('0x22')]?_0x3a930d[_0xac1f('0x13')][0x0]:null);})[_0xac1f('0x1a')](function(_0x1bb37a){logger[_0xac1f('0xa')](_0xac1f('0x23'),_0x1bb37a?util['inspect'](_0x1bb37a,{'showHidden':![],'depth':null}):'');return _0x550694(null);});}return _0x550694(null);});};exports[_0xac1f('0x24')]=function(_0x170690,_0x122c3d){return moment(_0x170690)['add'](_0x122c3d,_0xac1f('0x25'))[_0xac1f('0x26')](_0xac1f('0x27'));};exports[_0xac1f('0x28')]=function(_0x3f7847,_0x4a8d06){return moment(_0x3f7847)[_0xac1f('0x29')](_0x4a8d06,_0xac1f('0x25'))[_0xac1f('0x26')](_0xac1f('0x27'));};exports[_0xac1f('0x2a')]=function(_0x1e3e7e,_0x1878a5){return moment(_0x1e3e7e)[_0xac1f('0x2b')](moment(_0x1878a5),_0xac1f('0x25'));};exports[_0xac1f('0x2c')]=function(_0x1da6fe,_0xf1393c){return parseInt(_0x1da6fe,0xa)+parseInt(_0xf1393c,0xa);};exports[_0xac1f('0x2d')]=function(){return moment()[_0xac1f('0x26')](_0xac1f('0x27'));};exports[_0xac1f('0x2e')]=function(_0x4ddcd4,_0x4bebd0){if(_0x4bebd0){return moment(_0x4ddcd4)[_0xac1f('0x2e')](_0x4bebd0);}return!![];};exports[_0xac1f('0x2f')]=function(_0x5a59be,_0x5810fe){if(_0x5810fe){return moment(_0x5a59be)[_0xac1f('0x2f')](_0x5810fe);}else if(_0x5a59be){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 0aaae98..fb15d82 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 _0xa290=['statusCode','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)','responseTime','other','agent_name','test','setupLoggers','fs-extra','fileLogger','safeTemplate','join','/var','log','xcally','client','role','name','then','user','no-user','data','timestamp','catch','error','auth','set','use','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','body','format','method','headers','x-forwarded-for','url'];(function(_0x4f052e,_0x5ae643){var _0x42743e=function(_0x39346e){while(--_0x39346e){_0x4f052e['push'](_0x4f052e['shift']());}};_0x42743e(++_0x5ae643);}(_0xa290,0x1c3));var _0x0a29=function(_0x5bc881,_0x546cda){_0x5bc881=_0x5bc881-0x0;var _0x399dd5=_0xa290[_0x5bc881];return _0x399dd5;};var fs=require(_0x0a29('0x0'));var _=require('lodash');var ewinston=require('express-winston');var path=require('path');var util=require('util');var fileLogger=require('./loggers')[_0x0a29('0x1')];var safeTemplate=require('./safe-template')[_0x0a29('0x2')];var maskSensitiveData=require('./mask-sensitive-data')['maskSensitiveData'];function ClientSideLogger(){function _0x5d8c53(_0x1b85e0){var _0x90f29c=path[_0x0a29('0x3')](_0x0a29('0x4'),_0x0a29('0x5'),_0x0a29('0x6'));var _0x47c623=path[_0x0a29('0x3')](_0x0a29('0x7'),_0x1b85e0[_0x0a29('0x8')]+'-'+_0x1b85e0[_0x0a29('0x9')]);return fs['ensureDir'](path['join'](_0x90f29c,_0x47c623))[_0x0a29('0xa')](function(){var _0x3a20d2=fileLogger(_0x0a29('0x7'),path[_0x0a29('0x3')](_0x90f29c,_0x47c623));return _0x3a20d2;})['catch'](function(_0x1d66de){throw _0x1d66de;});}this[_0x0a29('0x5')]=function(_0x393b60,_0x25cf16,_0x1a46ee,_0x185c60){return _0x5d8c53(_0x393b60['user'])[_0x0a29('0xa')](function(_0x541fe4){var _0x3d112b=_0x541fe4[_0x25cf16];return _0x3d112b;})['then'](function(_0x2673cd){var _0x2d300e=_0x393b60['user']?_0x393b60[_0x0a29('0xb')]['id']:_0x0a29('0xc');var _0x2adc64=_0x185c60[_0x0a29('0xd')];var _0x78aa05=_0x185c60[_0x0a29('0xe')];var _0x21af40=new Date(Number(_0x78aa05));return _0x2673cd(_0x2d300e,_0x21af40,_0x1a46ee,_0x2adc64);})[_0x0a29('0xf')](function(_0x54b56e){fileLogger(_0x0a29('0x7'))[_0x0a29('0x10')](_0x54b56e);});};}function setupLoggers(_0x29606d){return new Promise(function(_0x16662c){var _0x25b5f0=new ClientSideLogger();var _0x240028=fileLogger('api');var _0x586279=fileLogger(_0x0a29('0x11'));_0x29606d[_0x0a29('0x12')]('client-side-logger',_0x25b5f0);_0x29606d[_0x0a29('0x13')](ewinston[_0x0a29('0x14')]({'winstonInstance':_0x240028,'meta':![],'statusLevels':!![],'msg':function(_0x36c245,_0x35827e){var _0x27c08a=_0x0a29('0x15');if(!_[_0x0a29('0x16')](_0x36c245[_0x0a29('0x17')])){_0x27c08a+='\x20body=%s';var _0x363fb2=_0x36c245[_0x0a29('0x17')];maskSensitiveData(_0x363fb2);}return safeTemplate(util[_0x0a29('0x18')](_0x27c08a,_0x36c245[_0x0a29('0x19')],_0x36c245[_0x0a29('0x1a')][_0x0a29('0x1b')]?_0x36c245[_0x0a29('0x1a')]['x-forwarded-for']:_0x36c245['connection']['remoteAddress']||_0x36c245['ip'],_0x36c245[_0x0a29('0x1c')],_0x35827e[_0x0a29('0x1d')],_0x35827e['responseTime'],_0x36c245[_0x0a29('0xb')]?_0x36c245[_0x0a29('0xb')]['id']:null,_0x36c245[_0x0a29('0xb')]?_0x36c245[_0x0a29('0xb')][_0x0a29('0x9')]:null,_0x36c245[_0x0a29('0xb')]?_0x36c245['user'][_0x0a29('0x8')]:null,_0x363fb2?util[_0x0a29('0x1e')](_0x363fb2,![],null):''));}}));_0x29606d['use'](ewinston[_0x0a29('0x14')]({'winstonInstance':_0x586279,'meta':![],'statusLevels':!![],'msg':function(_0x182158,_0x36aa34){var _0xe66c5f=_0x0a29('0x1f');if(_0x182158[_0x0a29('0x17')]&&_0x182158[_0x0a29('0x17')][_0x0a29('0x20')]&&_0x182158[_0x0a29('0x17')][_0x0a29('0x21')]){_0xe66c5f=_0x0a29('0x22');}return util[_0x0a29('0x18')](_0xe66c5f,_0x182158['method'],_0x182158[_0x0a29('0x1a')][_0x0a29('0x1b')]?_0x182158[_0x0a29('0x1a')][_0x0a29('0x1b')]:_0x182158['connection']['remoteAddress']||_0x182158['ip'],_0x182158['url'],_0x36aa34[_0x0a29('0x1d')],_0x36aa34[_0x0a29('0x23')],_0x182158[_0x0a29('0xb')]?_0x182158[_0x0a29('0xb')]['id']:null,_0x182158[_0x0a29('0xb')]?_0x182158[_0x0a29('0xb')]['name']:null,_0x182158[_0x0a29('0xb')]?_0x182158[_0x0a29('0xb')]['role']:null,_0x182158[_0x0a29('0x17')]&&_0x182158[_0x0a29('0x17')]['device']?_0x182158['body'][_0x0a29('0x20')]:_0x0a29('0x24'),_0x182158['body']&&_0x182158[_0x0a29('0x17')][_0x0a29('0x21')]?_0x182158[_0x0a29('0x17')][_0x0a29('0x21')]:'',_0x182158[_0x0a29('0x17')]&&_0x182158[_0x0a29('0x17')][_0x0a29('0x25')]?_0x182158[_0x0a29('0x17')]['agent_name']:'');},'ignoreRoute':function(_0x78a033){var _0x24e622=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x24e622[_0x0a29('0x26')](_0x78a033[_0x0a29('0x1c')]);}}));return _0x16662c();});}exports[_0x0a29('0x27')]=setupLoggers; \ No newline at end of file +var _0xceac=['%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','device','agent_id','format','method','statusCode','other','agent_name','test','setupLoggers','fs-extra','lodash','express-winston','util','./loggers','fileLogger','./safe-template','safeTemplate','log','join','client','ensureDir','catch','user','then','data','timestamp','api','auth','client-side-logger','use','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','\x20body=%s','body','x-forwarded-for','headers','connection','remoteAddress','url','responseTime','name','role','inspect'];(function(_0x27d72e,_0x3bd77e){var _0xc33f0b=function(_0x58a99f){while(--_0x58a99f){_0x27d72e['push'](_0x27d72e['shift']());}};_0xc33f0b(++_0x3bd77e);}(_0xceac,0xeb));var _0xccea=function(_0x2bdb91,_0x22518c){_0x2bdb91=_0x2bdb91-0x0;var _0x2163f9=_0xceac[_0x2bdb91];return _0x2163f9;};var fs=require(_0xccea('0x0'));var _=require(_0xccea('0x1'));var ewinston=require(_0xccea('0x2'));var path=require('path');var util=require(_0xccea('0x3'));var fileLogger=require(_0xccea('0x4'))[_0xccea('0x5')];var safeTemplate=require(_0xccea('0x6'))[_0xccea('0x7')];var maskSensitiveData=require('./mask-sensitive-data')['maskSensitiveData'];function ClientSideLogger(){function _0x330c33(_0x562e1c){var _0xfc2846=path['join']('/var',_0xccea('0x8'),'xcally');var _0x3ef578=path[_0xccea('0x9')](_0xccea('0xa'),_0x562e1c['role']+'-'+_0x562e1c['name']);return fs[_0xccea('0xb')](path[_0xccea('0x9')](_0xfc2846,_0x3ef578))['then'](function(){var _0x1f4d59=fileLogger(_0xccea('0xa'),path[_0xccea('0x9')](_0xfc2846,_0x3ef578));return _0x1f4d59;})[_0xccea('0xc')](function(_0x28e69d){throw _0x28e69d;});}this[_0xccea('0x8')]=function(_0x3a9d33,_0x54c805,_0x2027b1,_0x2e9562){return _0x330c33(_0x3a9d33[_0xccea('0xd')])[_0xccea('0xe')](function(_0x527441){var _0x2e82cb=_0x527441[_0x54c805];return _0x2e82cb;})[_0xccea('0xe')](function(_0x6b244d){var _0x24aa53=_0x3a9d33[_0xccea('0xd')]?_0x3a9d33[_0xccea('0xd')]['id']:'no-user';var _0x32b21d=_0x2e9562[_0xccea('0xf')];var _0x210686=_0x2e9562[_0xccea('0x10')];var _0xe41ea8=new Date(Number(_0x210686));return _0x6b244d(_0x24aa53,_0xe41ea8,_0x2027b1,_0x32b21d);})['catch'](function(_0x600939){fileLogger('client')['error'](_0x600939);});};}function setupLoggers(_0x4217a0){return new Promise(function(_0xb13265){var _0x79b607=new ClientSideLogger();var _0xa83bd5=fileLogger(_0xccea('0x11'));var _0x28ac3f=fileLogger(_0xccea('0x12'));_0x4217a0['set'](_0xccea('0x13'),_0x79b607);_0x4217a0[_0xccea('0x14')](ewinston[_0xccea('0x15')]({'winstonInstance':_0xa83bd5,'meta':![],'statusLevels':!![],'msg':function(_0x2ac028,_0x107063){var _0x5cbeed=_0xccea('0x16');if(!_[_0xccea('0x17')](_0x2ac028['body'])){_0x5cbeed+=_0xccea('0x18');var _0x403540=_0x2ac028[_0xccea('0x19')];maskSensitiveData(_0x403540);}return safeTemplate(util['format'](_0x5cbeed,_0x2ac028['method'],_0x2ac028['headers'][_0xccea('0x1a')]?_0x2ac028[_0xccea('0x1b')][_0xccea('0x1a')]:_0x2ac028[_0xccea('0x1c')][_0xccea('0x1d')]||_0x2ac028['ip'],_0x2ac028[_0xccea('0x1e')],_0x107063['statusCode'],_0x107063[_0xccea('0x1f')],_0x2ac028['user']?_0x2ac028[_0xccea('0xd')]['id']:null,_0x2ac028[_0xccea('0xd')]?_0x2ac028['user'][_0xccea('0x20')]:null,_0x2ac028[_0xccea('0xd')]?_0x2ac028[_0xccea('0xd')][_0xccea('0x21')]:null,_0x403540?util[_0xccea('0x22')](_0x403540,![],null):''));}}));_0x4217a0[_0xccea('0x14')](ewinston[_0xccea('0x15')]({'winstonInstance':_0x28ac3f,'meta':![],'statusLevels':!![],'msg':function(_0x23bcd5,_0x25e5b5){var _0x38e0a8=_0xccea('0x23');if(_0x23bcd5['body']&&_0x23bcd5[_0xccea('0x19')][_0xccea('0x24')]&&_0x23bcd5['body'][_0xccea('0x25')]){_0x38e0a8='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)';}return util[_0xccea('0x26')](_0x38e0a8,_0x23bcd5[_0xccea('0x27')],_0x23bcd5[_0xccea('0x1b')]['x-forwarded-for']?_0x23bcd5[_0xccea('0x1b')][_0xccea('0x1a')]:_0x23bcd5[_0xccea('0x1c')]['remoteAddress']||_0x23bcd5['ip'],_0x23bcd5[_0xccea('0x1e')],_0x25e5b5[_0xccea('0x28')],_0x25e5b5[_0xccea('0x1f')],_0x23bcd5[_0xccea('0xd')]?_0x23bcd5[_0xccea('0xd')]['id']:null,_0x23bcd5[_0xccea('0xd')]?_0x23bcd5[_0xccea('0xd')][_0xccea('0x20')]:null,_0x23bcd5[_0xccea('0xd')]?_0x23bcd5[_0xccea('0xd')]['role']:null,_0x23bcd5[_0xccea('0x19')]&&_0x23bcd5[_0xccea('0x19')][_0xccea('0x24')]?_0x23bcd5[_0xccea('0x19')][_0xccea('0x24')]:_0xccea('0x29'),_0x23bcd5[_0xccea('0x19')]&&_0x23bcd5['body'][_0xccea('0x25')]?_0x23bcd5['body'][_0xccea('0x25')]:'',_0x23bcd5[_0xccea('0x19')]&&_0x23bcd5[_0xccea('0x19')][_0xccea('0x2a')]?_0x23bcd5[_0xccea('0x19')]['agent_name']:'');},'ignoreRoute':function(_0x18cd8c){var _0x32f73f=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x32f73f[_0xccea('0x2b')](_0x18cd8c[_0xccea('0x1e')]);}}));return _0xb13265();});}exports[_0xccea('0x2c')]=setupLoggers; \ No newline at end of file diff --git a/server/utils/iftime.js b/server/utils/iftime.js index 17bb60b..f77cfa3 100644 --- a/server/utils/iftime.js +++ b/server/utils/iftime.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9499=['hours','minutes','isBefore','day','isBetween','ddd','includes','dowCompare','daysInMonth','max','min','domCompare','format','MMM','monthCompare','guess','test','isMoment','split','length','padStart','lodash','moment-timezone','map','source','join','Interval\x20string\x20not\x20valid','Date\x20not\x20valid','isValid','locale','weekdaysShort','toLowerCase','indexOf','slice','concat','exports','circularDoWInterval','monthsShort','circularMonthInterval','clone'];(function(_0xda6ee6,_0x59c8b1){var _0x313510=function(_0x292ee9){while(--_0x292ee9){_0xda6ee6['push'](_0xda6ee6['shift']());}};_0x313510(++_0x59c8b1);}(_0x9499,0x65));var _0x9949=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0x9499[_0x1cc8fe];return _0x230054;};var _=require(_0x9949('0x0'));var moment=require(_0x9949('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][_0x9949('0x2')](function(_0x3ca430){return _0x3ca430[_0x9949('0x3')];})[_0x9949('0x4')](',');var validateRx=new RegExp('^'+globalRx+'$');var EINVALID_STRING=_0x9949('0x5');var EINVALID_DATE=_0x9949('0x6');function throwIfDateNotValid(_0x247a61){if(!_0x247a61[_0x9949('0x7')]()){throw new Error(EINVALID_DATE);}}function extractTime(_0x26d4cb){var _0x1cdc34=_0x26d4cb['split'](':')[_0x9949('0x2')](function(_0x5a7a04){return parseInt(_0x5a7a04,0xa);});var _0x2b14d6=_0x1cdc34[0x0];var _0x58a77d=_0x1cdc34[0x1];if(_0x2b14d6<0x0||_0x2b14d6>0x17||_0x58a77d<0x0||_0x58a77d>0x3b){throw new Error(EINVALID_DATE);}return[_0x2b14d6,_0x58a77d];}function circularDoWInterval(_0x24b77a,_0x3b3b20){if(_0x24b77a===_0x3b3b20){return[_0x24b77a];}else{var _0x34fd2b=moment[_0x9949('0x8')]();moment[_0x9949('0x8')]('en');var _0xa91109=moment[_0x9949('0x9')]()[_0x9949('0x2')](function(_0x48d575){return _0x48d575[_0x9949('0xa')]();});moment['locale'](_0x34fd2b);var _0x4200ab=_0xa91109[_0x9949('0xb')](_0x24b77a);var _0x64feea=_0xa91109[_0x9949('0xb')](_0x3b3b20);if(_0x64feea>_0x4200ab){return _0xa91109['slice'](_0x4200ab,_0x64feea+0x1);}else{var _0x3cdc7b=_0xa91109[_0x9949('0xc')](0x0,_0x64feea+0x1);var _0x165b06=_0xa91109[_0x9949('0xc')](_0x4200ab);return _0x165b06[_0x9949('0xd')](_0x3cdc7b);}}}module[_0x9949('0xe')][_0x9949('0xf')]=circularDoWInterval;function circularMonthInterval(_0x4b8f04,_0x100cb8){if(_0x4b8f04===_0x100cb8){return[_0x4b8f04];}else{var _0x10c8aa=moment[_0x9949('0x8')]();moment['locale']('en');var _0x42a07a=moment[_0x9949('0x10')]()[_0x9949('0x2')](function(_0x54a473){return _0x54a473[_0x9949('0xa')]();});moment['locale'](_0x10c8aa);var _0x10fd83=_0x42a07a[_0x9949('0xb')](_0x4b8f04);var _0xf76153=_0x42a07a[_0x9949('0xb')](_0x100cb8);if(_0xf76153>_0x10fd83){return _0x42a07a[_0x9949('0xc')](_0x10fd83,_0xf76153+0x1);}else{var _0x2af9c1=_0x42a07a[_0x9949('0xc')](0x0,_0xf76153+0x1);var _0x25b46b=_0x42a07a[_0x9949('0xc')](_0x10fd83);return _0x25b46b['concat'](_0x2af9c1);}}}module[_0x9949('0xe')][_0x9949('0x11')]=circularMonthInterval;function parseDom(_0x15da35){var _0xd1e740=parseInt(_0x15da35,0xa);if(_0xd1e740<0x1||_0xd1e740>0x1f){throw new Error(EINVALID_DATE);}return _0xd1e740;}function timeCompare(_0x46b6db,_0x304b06,_0x15dc72){var _0x524b29=_0x46b6db[_0x9949('0x12')]();var _0x3e75a8=extractTime(_0x304b06);var _0x364036=_0x3e75a8[0x0];var _0x4f71e8=_0x3e75a8[0x1];var _0x38d0eb=_0x46b6db[_0x9949('0x12')]()[_0x9949('0x13')](_0x364036)[_0x9949('0x14')](_0x4f71e8);throwIfDateNotValid(_0x38d0eb);var _0x4b391b=extractTime(_0x15dc72);var _0x278547=_0x4b391b[0x0];var _0x189e04=_0x4b391b[0x1];var _0x38bfe5=_0x46b6db['clone']()[_0x9949('0x13')](_0x278547)['minutes'](_0x189e04);throwIfDateNotValid(_0x38bfe5);if(_0x38bfe5[_0x9949('0x15')](_0x38d0eb)){var _0xca1c91=_0x524b29[_0x9949('0x12')]()['startOf'](_0x9949('0x16'));var _0x10848a=_0x524b29[_0x9949('0x12')]()['endOf'](_0x9949('0x16'));return _0x524b29[_0x9949('0x17')](_0x38d0eb,_0x10848a,undefined,'[]')||_0x524b29[_0x9949('0x17')](_0xca1c91,_0x38bfe5,undefined,'[]');}else{return _0x524b29[_0x9949('0x17')](_0x38d0eb,_0x38bfe5,undefined,'[]');}}module[_0x9949('0xe')]['timeCompare']=timeCompare;function dowCompare(_0x38c7ef,_0x5efc2c,_0x1623d9){var _0x3fbcf3=_0x38c7ef[_0x9949('0x8')]('en')['format'](_0x9949('0x18'))[_0x9949('0xa')]();return circularDoWInterval(_0x5efc2c,_0x1623d9)[_0x9949('0x19')](_0x3fbcf3);}module[_0x9949('0xe')][_0x9949('0x1a')]=dowCompare;function domCompare(_0x491c4b,_0xbfda13,_0x44f83c){var _0x10d6cd=_0x491c4b['date']();if(_0xbfda13===_0x44f83c){return _0x10d6cd===_0xbfda13;}else{var _0x509d8c=_0x491c4b[_0x9949('0x1b')]();var _0x5562cc=_0xbfda13<_0x44f83c;let _0x22f509=![];var _0x37f3a8=0x0;var _0x10f244=0x0;if(_0x5562cc){_0x37f3a8=Math[_0x9949('0x1c')](0x1,_0xbfda13);_0x10f244=Math[_0x9949('0x1d')](_0x44f83c,_0x509d8c);_0x22f509=_0x10d6cd>=_0x37f3a8&&_0x10d6cd<=_0x10f244;}else{_0x37f3a8=Math[_0x9949('0x1d')](_0xbfda13,_0x509d8c);_0x10f244=Math[_0x9949('0x1c')](0x1,_0x44f83c);_0x22f509=_0x10d6cd>=_0x37f3a8||_0x10d6cd<=_0x10f244;}return _0x22f509;}}module[_0x9949('0xe')][_0x9949('0x1e')]=domCompare;function monthCompare(_0x1a4ea5,_0x219f5b,_0x1ac8f7){var _0x21a359=_0x1a4ea5[_0x9949('0x8')]('en')[_0x9949('0x1f')](_0x9949('0x20'))[_0x9949('0xa')]();return circularMonthInterval(_0x219f5b,_0x1ac8f7)[_0x9949('0x19')](_0x21a359);}module[_0x9949('0xe')][_0x9949('0x21')]=monthCompare;function iftime(_0x411f23,_0xaff0a6=moment['tz'][_0x9949('0x22')](),_0x39a06b=moment()){if(!validateRx[_0x9949('0x23')](_0x411f23)){throw new Error(EINVALID_STRING);}else{var _0x104bb4=(moment[_0x9949('0x24')](_0x39a06b)?_0x39a06b[_0x9949('0x12')]():moment(_0x39a06b))['tz'](_0xaff0a6)[_0x9949('0x8')]('en');throwIfDateNotValid(_0x104bb4);var _0xb5026d=_0x411f23['split'](',');var _0x1e073e=_0xb5026d[0x0];var _0x20ea3b=_0xb5026d[0x1];var _0x272402=_0xb5026d[0x2];var _0x155f52=_0xb5026d[0x3];let _0x2ff69d=!![];if(_0x1e073e!=='*'){var _0x38914f=_0x1e073e[_0x9949('0x25')]('-');var _0x14a46d=_['padStart'](_0x38914f[0x0],0x5,'0');var _0x1f54ce=_0x38914f[_0x9949('0x26')]===0x2?_[_0x9949('0x27')](_0x38914f[0x1],0x5,'0'):_0x14a46d;_0x2ff69d=timeCompare(_0x104bb4,_0x14a46d,_0x1f54ce);}let _0x130794=!![];if(_0x20ea3b!=='*'){var _0x509efb=_0x20ea3b[_0x9949('0x25')]('-');var _0x58d069=_0x509efb[0x0];var _0x3ac723=_0x509efb[_0x9949('0x26')]===0x2?_0x509efb[0x1]:_0x58d069;_0x130794=dowCompare(_0x104bb4,_0x58d069,_0x3ac723);}let _0x3ad72e=!![];if(_0x272402!=='*'){var _0x70516=_0x272402[_0x9949('0x25')]('-');var _0x50f0fe=parseDom(_0x70516[0x0]);var _0x31de09=_0x70516[_0x9949('0x26')]===0x2?parseDom(_0x70516[0x1]):_0x50f0fe;_0x3ad72e=domCompare(_0x104bb4,_0x50f0fe,_0x31de09);}let _0x6ce849=!![];if(_0x155f52!=='*'){var _0x4c3f23=_0x155f52[_0x9949('0x25')]('-');var _0x46928d=_0x4c3f23[0x0];var _0x48205e=_0x4c3f23[_0x9949('0x26')]===0x2?_0x4c3f23[0x1]:_0x4c3f23[0x0];_0x6ce849=monthCompare(_0x104bb4,_0x46928d,_0x48205e);}return _0x2ff69d&&_0x130794&&_0x3ad72e&&_0x6ce849;}}module['exports']['iftime']=iftime; \ No newline at end of file +var _0x215f=['monthCompare','isMoment','padStart','length','iftime','lodash','moment-timezone','map','source','join','Interval\x20string\x20not\x20valid','Date\x20not\x20valid','isValid','split','locale','weekdaysShort','toLowerCase','indexOf','slice','concat','exports','monthsShort','clone','hours','minutes','isBefore','startOf','day','endOf','isBetween','format','dowCompare','date','daysInMonth','max','min','domCompare','MMM','includes'];(function(_0x263a74,_0xc31414){var _0x2aa86c=function(_0x382896){while(--_0x382896){_0x263a74['push'](_0x263a74['shift']());}};_0x2aa86c(++_0xc31414);}(_0x215f,0x18b));var _0xf215=function(_0x11bf10,_0x3d2485){_0x11bf10=_0x11bf10-0x0;var _0x4c7a2c=_0x215f[_0x11bf10];return _0x4c7a2c;};var _=require(_0xf215('0x0'));var moment=require(_0xf215('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][_0xf215('0x2')](function(_0x14640f){return _0x14640f[_0xf215('0x3')];})[_0xf215('0x4')](',');var validateRx=new RegExp('^'+globalRx+'$');var EINVALID_STRING=_0xf215('0x5');var EINVALID_DATE=_0xf215('0x6');function throwIfDateNotValid(_0x4837f2){if(!_0x4837f2[_0xf215('0x7')]()){throw new Error(EINVALID_DATE);}}function extractTime(_0x11b1db){var _0x1d9d70=_0x11b1db[_0xf215('0x8')](':')[_0xf215('0x2')](function(_0x494215){return parseInt(_0x494215,0xa);});var _0x1843ca=_0x1d9d70[0x0];var _0x5b9180=_0x1d9d70[0x1];if(_0x1843ca<0x0||_0x1843ca>0x17||_0x5b9180<0x0||_0x5b9180>0x3b){throw new Error(EINVALID_DATE);}return[_0x1843ca,_0x5b9180];}function circularDoWInterval(_0x23a348,_0xe37fe){if(_0x23a348===_0xe37fe){return[_0x23a348];}else{var _0x2e544f=moment[_0xf215('0x9')]();moment[_0xf215('0x9')]('en');var _0x27580d=moment[_0xf215('0xa')]()[_0xf215('0x2')](function(_0x53979f){return _0x53979f[_0xf215('0xb')]();});moment[_0xf215('0x9')](_0x2e544f);var _0x1d8748=_0x27580d[_0xf215('0xc')](_0x23a348);var _0x4a6e9b=_0x27580d[_0xf215('0xc')](_0xe37fe);if(_0x4a6e9b>_0x1d8748){return _0x27580d[_0xf215('0xd')](_0x1d8748,_0x4a6e9b+0x1);}else{var _0x644795=_0x27580d[_0xf215('0xd')](0x0,_0x4a6e9b+0x1);var _0x9b78bc=_0x27580d[_0xf215('0xd')](_0x1d8748);return _0x9b78bc[_0xf215('0xe')](_0x644795);}}}module[_0xf215('0xf')]['circularDoWInterval']=circularDoWInterval;function circularMonthInterval(_0x1cfbb5,_0x5b2d1d){if(_0x1cfbb5===_0x5b2d1d){return[_0x1cfbb5];}else{var _0x555adb=moment[_0xf215('0x9')]();moment[_0xf215('0x9')]('en');var _0x556de7=moment[_0xf215('0x10')]()[_0xf215('0x2')](function(_0x5503ca){return _0x5503ca[_0xf215('0xb')]();});moment[_0xf215('0x9')](_0x555adb);var _0x3c869b=_0x556de7['indexOf'](_0x1cfbb5);var _0x489e87=_0x556de7[_0xf215('0xc')](_0x5b2d1d);if(_0x489e87>_0x3c869b){return _0x556de7['slice'](_0x3c869b,_0x489e87+0x1);}else{var _0x13e5f4=_0x556de7['slice'](0x0,_0x489e87+0x1);var _0x24378f=_0x556de7[_0xf215('0xd')](_0x3c869b);return _0x24378f[_0xf215('0xe')](_0x13e5f4);}}}module[_0xf215('0xf')]['circularMonthInterval']=circularMonthInterval;function parseDom(_0x11b874){var _0x2b5256=parseInt(_0x11b874,0xa);if(_0x2b5256<0x1||_0x2b5256>0x1f){throw new Error(EINVALID_DATE);}return _0x2b5256;}function timeCompare(_0xf9e6ef,_0x545975,_0x4526ba){var _0x3b60f3=_0xf9e6ef[_0xf215('0x11')]();var _0x2fa99e=extractTime(_0x545975);var _0x9a83c7=_0x2fa99e[0x0];var _0x1f3dd6=_0x2fa99e[0x1];var _0x2cd36d=_0xf9e6ef[_0xf215('0x11')]()[_0xf215('0x12')](_0x9a83c7)[_0xf215('0x13')](_0x1f3dd6);throwIfDateNotValid(_0x2cd36d);var _0x41632f=extractTime(_0x4526ba);var _0x23990f=_0x41632f[0x0];var _0x1ad070=_0x41632f[0x1];var _0xcb159e=_0xf9e6ef[_0xf215('0x11')]()['hours'](_0x23990f)[_0xf215('0x13')](_0x1ad070);throwIfDateNotValid(_0xcb159e);if(_0xcb159e[_0xf215('0x14')](_0x2cd36d)){var _0x35c977=_0x3b60f3[_0xf215('0x11')]()[_0xf215('0x15')](_0xf215('0x16'));var _0x24e207=_0x3b60f3[_0xf215('0x11')]()[_0xf215('0x17')]('day');return _0x3b60f3[_0xf215('0x18')](_0x2cd36d,_0x24e207,undefined,'[]')||_0x3b60f3['isBetween'](_0x35c977,_0xcb159e,undefined,'[]');}else{return _0x3b60f3['isBetween'](_0x2cd36d,_0xcb159e,undefined,'[]');}}module['exports']['timeCompare']=timeCompare;function dowCompare(_0x2bdce8,_0x461979,_0x3719f6){var _0x1a7830=_0x2bdce8[_0xf215('0x9')]('en')[_0xf215('0x19')]('ddd')[_0xf215('0xb')]();return circularDoWInterval(_0x461979,_0x3719f6)['includes'](_0x1a7830);}module[_0xf215('0xf')][_0xf215('0x1a')]=dowCompare;function domCompare(_0x5e822f,_0x1ae88e,_0x122029){var _0x2f740d=_0x5e822f[_0xf215('0x1b')]();if(_0x1ae88e===_0x122029){return _0x2f740d===_0x1ae88e;}else{var _0x1269b1=_0x5e822f[_0xf215('0x1c')]();var _0x30fc53=_0x1ae88e<_0x122029;let _0x192f1d=![];var _0x3b5de9=0x0;var _0x29962d=0x0;if(_0x30fc53){_0x3b5de9=Math[_0xf215('0x1d')](0x1,_0x1ae88e);_0x29962d=Math['min'](_0x122029,_0x1269b1);_0x192f1d=_0x2f740d>=_0x3b5de9&&_0x2f740d<=_0x29962d;}else{_0x3b5de9=Math[_0xf215('0x1e')](_0x1ae88e,_0x1269b1);_0x29962d=Math[_0xf215('0x1d')](0x1,_0x122029);_0x192f1d=_0x2f740d>=_0x3b5de9||_0x2f740d<=_0x29962d;}return _0x192f1d;}}module['exports'][_0xf215('0x1f')]=domCompare;function monthCompare(_0x46eaad,_0xe787c3,_0x52c652){var _0x3d0f06=_0x46eaad['locale']('en')[_0xf215('0x19')](_0xf215('0x20'))[_0xf215('0xb')]();return circularMonthInterval(_0xe787c3,_0x52c652)[_0xf215('0x21')](_0x3d0f06);}module['exports'][_0xf215('0x22')]=monthCompare;function iftime(_0x382fb9,_0x26dede=moment['tz']['guess'](),_0x3b37db=moment()){if(!validateRx['test'](_0x382fb9)){throw new Error(EINVALID_STRING);}else{var _0x283146=(moment[_0xf215('0x23')](_0x3b37db)?_0x3b37db['clone']():moment(_0x3b37db))['tz'](_0x26dede)['locale']('en');throwIfDateNotValid(_0x283146);var _0x173fb8=_0x382fb9['split'](',');var _0x5409bd=_0x173fb8[0x0];var _0xcda6e0=_0x173fb8[0x1];var _0x3d18e6=_0x173fb8[0x2];var _0xf3ed07=_0x173fb8[0x3];let _0x2d80b9=!![];if(_0x5409bd!=='*'){var _0x21d4d9=_0x5409bd['split']('-');var _0x5aed64=_[_0xf215('0x24')](_0x21d4d9[0x0],0x5,'0');var _0x1acb72=_0x21d4d9[_0xf215('0x25')]===0x2?_[_0xf215('0x24')](_0x21d4d9[0x1],0x5,'0'):_0x5aed64;_0x2d80b9=timeCompare(_0x283146,_0x5aed64,_0x1acb72);}let _0x3f3ef6=!![];if(_0xcda6e0!=='*'){var _0x1341fb=_0xcda6e0[_0xf215('0x8')]('-');var _0x3aa4a6=_0x1341fb[0x0];var _0x1c2917=_0x1341fb[_0xf215('0x25')]===0x2?_0x1341fb[0x1]:_0x3aa4a6;_0x3f3ef6=dowCompare(_0x283146,_0x3aa4a6,_0x1c2917);}let _0x79abe2=!![];if(_0x3d18e6!=='*'){var _0x585140=_0x3d18e6[_0xf215('0x8')]('-');var _0x4ff834=parseDom(_0x585140[0x0]);var _0x8e1c97=_0x585140[_0xf215('0x25')]===0x2?parseDom(_0x585140[0x1]):_0x4ff834;_0x79abe2=domCompare(_0x283146,_0x4ff834,_0x8e1c97);}let _0x32378e=!![];if(_0xf3ed07!=='*'){var _0x52069d=_0xf3ed07[_0xf215('0x8')]('-');var _0x4c71c2=_0x52069d[0x0];var _0x3cfa8d=_0x52069d['length']===0x2?_0x52069d[0x1]:_0x52069d[0x0];_0x32378e=monthCompare(_0x283146,_0x4c71c2,_0x3cfa8d);}return _0x2d80b9&&_0x3f3ef6&&_0x79abe2&&_0x32378e;}}module[_0xf215('0xf')][_0xf215('0x26')]=iftime; \ No newline at end of file diff --git a/server/utils/loggers.js b/server/utils/loggers.js index 89885d0..e33b4e6 100644 --- a/server/utils/loggers.js +++ b/server/utils/loggers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x336d=['bold\x20white','bold\x20green','gray','bold\x20cyan','addColors','/var/log/xcally','join','format','message','{{{','replace','}}}','[%s]\x20[%s]\x20%s\x20-\x20%s','level','toUpperCase','meta','stringify','YYYY-MM-DD\x20HH:mm:ss','Console','warn','Logger','File','%s-%s','transports','consoleLogger','path','moment','winston','../config/environment','debugLevel','toLowerCase','redBG\x20white'];(function(_0x1c2051,_0x4cb6b9){var _0x2b58a0=function(_0x4308df){while(--_0x4308df){_0x1c2051['push'](_0x1c2051['shift']());}};_0x2b58a0(++_0x4cb6b9);}(_0x336d,0x99));var _0xd336=function(_0x2230f7,_0x50b22c){_0x2230f7=_0x2230f7-0x0;var _0x46a081=_0x336d[_0x2230f7];return _0x46a081;};'use strict';var path=require(_0xd336('0x0'));var util=require('util');var moment=require(_0xd336('0x1'));var winston=require(_0xd336('0x2'));var config=require(_0xd336('0x3'));var debugLevel=config['debugLevel']?config[_0xd336('0x4')][_0xd336('0x5')]():'info';var XC_LOG_LEVELS={'fatal':0x0,'error':0x0,'warn':0x1,'info':0x2,'print':0x2,'success':0x2,'http':0x3,'verbose':0x4,'debug':0x5,'silly':0x6};var XC_LOG_COLORS={'fatal':_0xd336('0x6'),'error':'red','warn':'bold\x20yellow','info':'white','print':_0xd336('0x7'),'success':_0xd336('0x8'),'http':_0xd336('0x9'),'verbose':'bold\x20magenta','debug':'bold\x20blue','silly':_0xd336('0xa')};winston[_0xd336('0xb')](XC_LOG_COLORS);function getLogFileName(_0x26bfb5,_0x4e341d,_0x20d418){var _0x1f17b4=_0x26bfb5||_0xd336('0xc');return path[_0xd336('0xd')](_0x1f17b4,util[_0xd336('0xe')]('%s-%s.log',_0x4e341d,_0x20d418));}function formatter(_0x55c5c0,_0x166a3f){_0x166a3f['message']=_0x166a3f[_0xd336('0xf')]['replace'](/@@{/g,_0xd336('0x10'))[_0xd336('0x11')](/}@@/g,_0xd336('0x12'))['replace'](/@{/g,'{{')[_0xd336('0x11')](/}@/g,'}}');return util[_0xd336('0xe')](_0xd336('0x13'),moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),_0x166a3f[_0xd336('0x14')][_0xd336('0x15')](),_0x55c5c0,_0x166a3f[_0xd336('0xf')]);}function fileFormat(_0x9e7ef8,_0x431e38){_0x431e38['message']=_0x431e38[_0xd336('0xf')][_0xd336('0x11')](/@@{/g,_0xd336('0x10'))[_0xd336('0x11')](/}@@/g,_0xd336('0x12'))[_0xd336('0x11')](/@{/g,'{{')[_0xd336('0x11')](/}@/g,'}}');var _0x3bbd3e=_0x431e38['meta']&&Object['keys'](_0x431e38[_0xd336('0x16')])['length']?'\x0a\x09'+JSON[_0xd336('0x17')](_0x431e38[_0xd336('0x16')]):'';return util[_0xd336('0xe')]('[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s',moment()[_0xd336('0xe')](_0xd336('0x18')),_0x431e38['level'][_0xd336('0x15')](),_0x9e7ef8,_0x431e38[_0xd336('0xf')],_0x3bbd3e);}function consoleLogger(){var _0x227505=new winston['Logger']({'levels':XC_LOG_LEVELS,'transports':[new winston['transports'][(_0xd336('0x19'))]({'level':_0xd336('0x1a'),'json':![],'formatter':function(_0x5b73af){return formatter('',_0x5b73af);}})]});return _0x227505;}function fileLogger(_0x2725d2,_0x40dfba){var _0x5d5027=new winston[(_0xd336('0x1b'))]({'levels':XC_LOG_LEVELS,'transports':[new winston['transports'][(_0xd336('0x1c'))]({'name':util[_0xd336('0xe')](_0xd336('0x1d'),_0x2725d2,'error'),'filename':getLogFileName(_0x40dfba,_0x2725d2,'error'),'level':'error','json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x47dd37){return fileFormat(_0x2725d2,_0x47dd37);}}),new winston['transports'][(_0xd336('0x1c'))]({'name':util['format']('%s-%s',_0x2725d2,debugLevel),'filename':getLogFileName(_0x40dfba,_0x2725d2,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x4d0576){return fileFormat(_0x2725d2,_0x4d0576);}}),new winston[(_0xd336('0x1e'))]['Console']({'level':_0xd336('0x1a'),'json':![],'formatter':function(_0x29260b){return fileFormat(_0x2725d2,_0x29260b);}})]});return _0x5d5027;}exports[_0xd336('0x1f')]=consoleLogger;exports['fileLogger']=fileLogger; \ No newline at end of file +var _0xdf95=['bold\x20blue','bold\x20cyan','addColors','format','%s-%s.log','message','{{{','}}}','replace','[%s]\x20[%s]\x20%s\x20-\x20%s','meta','keys','length','YYYY-MM-DD\x20HH:mm:ss','toUpperCase','Logger','transports','Console','File','%s-%s','error','warn','consoleLogger','fileLogger','util','moment','winston','debugLevel','toLowerCase','info','redBG\x20white','red','bold\x20yellow','bold\x20white','bold\x20green','bold\x20magenta'];(function(_0x46a2b4,_0x57e4e3){var _0x4e3f71=function(_0x1cf628){while(--_0x1cf628){_0x46a2b4['push'](_0x46a2b4['shift']());}};_0x4e3f71(++_0x57e4e3);}(_0xdf95,0x15c));var _0x5df9=function(_0x15bc81,_0x4d4f77){_0x15bc81=_0x15bc81-0x0;var _0x59440e=_0xdf95[_0x15bc81];return _0x59440e;};'use strict';var path=require('path');var util=require(_0x5df9('0x0'));var moment=require(_0x5df9('0x1'));var winston=require(_0x5df9('0x2'));var config=require('../config/environment');var debugLevel=config['debugLevel']?config[_0x5df9('0x3')][_0x5df9('0x4')]():_0x5df9('0x5');var XC_LOG_LEVELS={'fatal':0x0,'error':0x0,'warn':0x1,'info':0x2,'print':0x2,'success':0x2,'http':0x3,'verbose':0x4,'debug':0x5,'silly':0x6};var XC_LOG_COLORS={'fatal':_0x5df9('0x6'),'error':_0x5df9('0x7'),'warn':_0x5df9('0x8'),'info':'white','print':_0x5df9('0x9'),'success':_0x5df9('0xa'),'http':'gray','verbose':_0x5df9('0xb'),'debug':_0x5df9('0xc'),'silly':_0x5df9('0xd')};winston[_0x5df9('0xe')](XC_LOG_COLORS);function getLogFileName(_0x3c7546,_0x5a6eac,_0x32f13e){var _0x98f7a9=_0x3c7546||'/var/log/xcally';return path['join'](_0x98f7a9,util[_0x5df9('0xf')](_0x5df9('0x10'),_0x5a6eac,_0x32f13e));}function formatter(_0x1bd9bf,_0x68d8f0){_0x68d8f0['message']=_0x68d8f0[_0x5df9('0x11')]['replace'](/@@{/g,_0x5df9('0x12'))['replace'](/}@@/g,_0x5df9('0x13'))['replace'](/@{/g,'{{')[_0x5df9('0x14')](/}@/g,'}}');return util['format'](_0x5df9('0x15'),moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),_0x68d8f0['level']['toUpperCase'](),_0x1bd9bf,_0x68d8f0[_0x5df9('0x11')]);}function fileFormat(_0x5f03f5,_0x5d2836){_0x5d2836['message']=_0x5d2836[_0x5df9('0x11')][_0x5df9('0x14')](/@@{/g,_0x5df9('0x12'))[_0x5df9('0x14')](/}@@/g,'}}}')['replace'](/@{/g,'{{')['replace'](/}@/g,'}}');var _0x49e8e7=_0x5d2836[_0x5df9('0x16')]&&Object[_0x5df9('0x17')](_0x5d2836['meta'])[_0x5df9('0x18')]?'\x0a\x09'+JSON['stringify'](_0x5d2836[_0x5df9('0x16')]):'';return util[_0x5df9('0xf')]('[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s',moment()[_0x5df9('0xf')](_0x5df9('0x19')),_0x5d2836['level'][_0x5df9('0x1a')](),_0x5f03f5,_0x5d2836[_0x5df9('0x11')],_0x49e8e7);}function consoleLogger(){var _0x258c75=new winston[(_0x5df9('0x1b'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x5df9('0x1c'))][(_0x5df9('0x1d'))]({'level':'warn','json':![],'formatter':function(_0x23ddb6){return formatter('',_0x23ddb6);}})]});return _0x258c75;}function fileLogger(_0x5a7b67,_0x3fd2a3){var _0x589420=new winston['Logger']({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x5df9('0x1c'))][(_0x5df9('0x1e'))]({'name':util[_0x5df9('0xf')](_0x5df9('0x1f'),_0x5a7b67,_0x5df9('0x20')),'filename':getLogFileName(_0x3fd2a3,_0x5a7b67,_0x5df9('0x20')),'level':_0x5df9('0x20'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x76b36){return fileFormat(_0x5a7b67,_0x76b36);}}),new winston[(_0x5df9('0x1c'))][(_0x5df9('0x1e'))]({'name':util[_0x5df9('0xf')](_0x5df9('0x1f'),_0x5a7b67,debugLevel),'filename':getLogFileName(_0x3fd2a3,_0x5a7b67,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x2f7ecd){return fileFormat(_0x5a7b67,_0x2f7ecd);}}),new winston[(_0x5df9('0x1c'))]['Console']({'level':_0x5df9('0x21'),'json':![],'formatter':function(_0x340414){return fileFormat(_0x5a7b67,_0x340414);}})]});return _0x589420;}exports[_0x5df9('0x22')]=consoleLogger;exports[_0x5df9('0x23')]=fileLogger; \ No newline at end of file diff --git a/server/utils/mask-sensitive-data.js b/server/utils/mask-sensitive-data.js index ccc22a1..a8fab70 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 _0x0295=['length','isString','replace','}@@','includes','exports','lodash','newPassword','lastName','street','phone','mobile','fax','email','clientId','clientSecret','securityToken','token','accessToken','authToken','consumerSecret','membername','calleridname','exten','vidaooApiKey','clientEmail','accesskeyid','secretaccesskey','localstationid','dsn','secret','registry','oldPassword','isPlainObject','isArray'];(function(_0x422be2,_0x1c439e){var _0x1b820e=function(_0x513cc8){while(--_0x513cc8){_0x422be2['push'](_0x422be2['shift']());}};_0x1b820e(++_0x1c439e);}(_0x0295,0x1f0));var _0x5029=function(_0x1ac120,_0x3e7e45){_0x1ac120=_0x1ac120-0x0;var _0x19b703=_0x0295[_0x1ac120];return _0x19b703;};var _=require(_0x5029('0x0'));var sensitiveFields=['username','password',_0x5029('0x1'),'apiKey','firstName',_0x5029('0x2'),_0x5029('0x3'),_0x5029('0x4'),_0x5029('0x5'),_0x5029('0x6'),_0x5029('0x7'),_0x5029('0x8'),_0x5029('0x9'),_0x5029('0xa'),'code','accessKey','tenantId',_0x5029('0xb'),'channelSecret',_0x5029('0xc'),'accessTokenSecret',_0x5029('0xd'),'consumerKey',_0x5029('0xe'),_0x5029('0xf'),_0x5029('0x10'),'calleridnum',_0x5029('0x11'),_0x5029('0x12'),_0x5029('0x13'),'privateKey',_0x5029('0x14'),_0x5029('0x15'),'key','user','pass','accountSid',_0x5029('0x16'),_0x5029('0x17'),_0x5029('0x18'),_0x5029('0x19'),_0x5029('0x1a')];function maskSensitiveData(_0x11c24b){const _0xe278b7=/(?!^)[\s\S](?!$)/g;if(_[_0x5029('0x1b')](_0x11c24b)){for(const _0x10bf55 in _0x11c24b){if(_[_0x5029('0x1c')](_0x11c24b[_0x10bf55])){for(let _0x457c73=0x0;_0x457c73<_0x11c24b[_0x10bf55][_0x5029('0x1d')];_0x457c73++){maskSensitiveData(_0x11c24b[_0x10bf55][_0x457c73]);}}else if(_[_0x5029('0x1b')](_0x11c24b[_0x10bf55])){maskSensitiveData(_0x11c24b[_0x10bf55]);}else if(_[_0x5029('0x1e')](_0x11c24b[_0x10bf55])){_0x11c24b[_0x10bf55]=_0x11c24b[_0x10bf55][_0x5029('0x1f')](/{{{/g,'@@{')[_0x5029('0x1f')](/}}}/g,_0x5029('0x20'))[_0x5029('0x1f')](/{{/g,'@{')[_0x5029('0x1f')](/}}/g,'}@');if(_[_0x5029('0x21')](sensitiveFields,_0x10bf55)){_0x11c24b[_0x10bf55]=_0x11c24b[_0x10bf55][_0x5029('0x1f')](_0xe278b7,'*');}}}}}module[_0x5029('0x22')]['maskSensitiveData']=maskSensitiveData; \ No newline at end of file +var _0xda2d=['@@{','replace','}@@','includes','exports','maskSensitiveData','username','password','newPassword','apiKey','firstName','mobile','fax','email','clientId','clientSecret','securityToken','code','accessKey','tenantId','token','accessToken','accessTokenSecret','consumerKey','consumerSecret','membername','calleridname','calleridnum','exten','vidaooApiKey','clientEmail','key','user','pass','accountSid','localstationid','dsn','secret','oldPassword','isPlainObject','isArray','isString'];(function(_0x5f4297,_0x4dd180){var _0x4ef805=function(_0x2210c4){while(--_0x2210c4){_0x5f4297['push'](_0x5f4297['shift']());}};_0x4ef805(++_0x4dd180);}(_0xda2d,0x102));var _0xdda2=function(_0x3a3e34,_0x42d986){_0x3a3e34=_0x3a3e34-0x0;var _0x17c6dc=_0xda2d[_0x3a3e34];return _0x17c6dc;};var _=require('lodash');var sensitiveFields=[_0xdda2('0x0'),_0xdda2('0x1'),_0xdda2('0x2'),_0xdda2('0x3'),_0xdda2('0x4'),'lastName','street','phone',_0xdda2('0x5'),_0xdda2('0x6'),_0xdda2('0x7'),_0xdda2('0x8'),_0xdda2('0x9'),_0xdda2('0xa'),_0xdda2('0xb'),_0xdda2('0xc'),_0xdda2('0xd'),_0xdda2('0xe'),'channelSecret',_0xdda2('0xf'),_0xdda2('0x10'),'authToken',_0xdda2('0x11'),_0xdda2('0x12'),_0xdda2('0x13'),_0xdda2('0x14'),_0xdda2('0x15'),_0xdda2('0x16'),_0xdda2('0x17'),_0xdda2('0x18'),'privateKey','accesskeyid','secretaccesskey',_0xdda2('0x19'),_0xdda2('0x1a'),_0xdda2('0x1b'),_0xdda2('0x1c'),_0xdda2('0x1d'),_0xdda2('0x1e'),_0xdda2('0x1f'),'registry',_0xdda2('0x20')];function maskSensitiveData(_0x4b0220){const _0xbef148=/(?!^)[\s\S](?!$)/g;if(_[_0xdda2('0x21')](_0x4b0220)){for(const _0x3553d5 in _0x4b0220){if(_[_0xdda2('0x22')](_0x4b0220[_0x3553d5])){for(let _0x1922b1=0x0;_0x1922b1<_0x4b0220[_0x3553d5]['length'];_0x1922b1++){maskSensitiveData(_0x4b0220[_0x3553d5][_0x1922b1]);}}else if(_['isPlainObject'](_0x4b0220[_0x3553d5])){maskSensitiveData(_0x4b0220[_0x3553d5]);}else if(_[_0xdda2('0x23')](_0x4b0220[_0x3553d5])){_0x4b0220[_0x3553d5]=_0x4b0220[_0x3553d5]['replace'](/{{{/g,_0xdda2('0x24'))[_0xdda2('0x25')](/}}}/g,_0xdda2('0x26'))[_0xdda2('0x25')](/{{/g,'@{')[_0xdda2('0x25')](/}}/g,'}@');if(_[_0xdda2('0x27')](sensitiveFields,_0x3553d5)){_0x4b0220[_0x3553d5]=_0x4b0220[_0x3553d5][_0xdda2('0x25')](_0xbef148,'*');}}}}}module[_0xdda2('0x28')][_0xdda2('0x29')]=maskSensitiveData; \ No newline at end of file diff --git a/server/utils/safe-template.js b/server/utils/safe-template.js index 3f113d1..4277417 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 _0x9354=['map','isPlainObject','keys','reduce','exports','safeTemplate','{\x20{\x20','string','replace'];(function(_0x178d08,_0x274c99){var _0x23219b=function(_0x325e95){while(--_0x325e95){_0x178d08['push'](_0x178d08['shift']());}};_0x23219b(++_0x274c99);}(_0x9354,0x96));var _0x4935=function(_0x119d25,_0x588c8){_0x119d25=_0x119d25-0x0;var _0x39cf30=_0x9354[_0x119d25];return _0x39cf30;};var _=require('lodash');var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x42d9d9){return _0x42d9d9==='{{'?_0x4935('0x0'):'\x20}\x20}';}function safeTemplate(_0x263dd5){var _0x2a4993=_0x263dd5;if(typeof _0x263dd5===_0x4935('0x1')){_0x2a4993=_0x263dd5[_0x4935('0x2')](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array['isArray'](_0x263dd5)){_0x2a4993=_0x263dd5[_0x4935('0x3')](function(_0x2d509b){return safeTemplate(_0x2d509b);});}else if(_[_0x4935('0x4')](_0x263dd5)){_0x2a4993=Object[_0x4935('0x5')](_0x263dd5)[_0x4935('0x6')](function(_0x2e47bd,_0x118d36){_0x2e47bd[_0x118d36]=safeTemplate(_0x263dd5[_0x118d36]);return _0x2e47bd;},{});}return _0x2a4993;}module[_0x4935('0x7')][_0x4935('0x8')]=safeTemplate; \ No newline at end of file +var _0x4fc2=['reduce','exports','safeTemplate','lodash','{\x20{\x20','\x20}\x20}','string','replace','map','keys'];(function(_0xf39bd8,_0x4ed072){var _0x3a6cee=function(_0x1bb229){while(--_0x1bb229){_0xf39bd8['push'](_0xf39bd8['shift']());}};_0x3a6cee(++_0x4ed072);}(_0x4fc2,0x111));var _0x24fc=function(_0x13d4d2,_0xd2780f){_0x13d4d2=_0x13d4d2-0x0;var _0x4a2592=_0x4fc2[_0x13d4d2];return _0x4a2592;};var _=require(_0x24fc('0x0'));var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x2b05a5){return _0x2b05a5==='{{'?_0x24fc('0x1'):_0x24fc('0x2');}function safeTemplate(_0x5aaa74){var _0x365c56=_0x5aaa74;if(typeof _0x5aaa74===_0x24fc('0x3')){_0x365c56=_0x5aaa74[_0x24fc('0x4')](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array['isArray'](_0x5aaa74)){_0x365c56=_0x5aaa74[_0x24fc('0x5')](function(_0x3772eb){return safeTemplate(_0x3772eb);});}else if(_['isPlainObject'](_0x5aaa74)){_0x365c56=Object[_0x24fc('0x6')](_0x5aaa74)[_0x24fc('0x7')](function(_0x4889f4,_0x115851){_0x4889f4[_0x115851]=safeTemplate(_0x5aaa74[_0x115851]);return _0x4889f4;},{});}return _0x365c56;}module[_0x24fc('0x8')][_0x24fc('0x9')]=safeTemplate; \ No newline at end of file diff --git a/server/utils/update-app-config.js b/server/utils/update-app-config.js index 4a7065b..6873a7e 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 _0x3cc1=['writeJSON','exports','path','resolve','server/app.json','legacy-libs','isArray','apps','findIndex','name','motion2','NODE_PATH','pathExists','then','info','Updating\x20app.json'];(function(_0xb99735,_0x279535){var _0x5757e6=function(_0x4d8fe8){while(--_0x4d8fe8){_0xb99735['push'](_0xb99735['shift']());}};_0x5757e6(++_0x279535);}(_0x3cc1,0x142));var _0x13cc=function(_0x368c73,_0x2eeebc){_0x368c73=_0x368c73-0x0;var _0x310210=_0x3cc1[_0x368c73];return _0x310210;};var fs=require('fs-extra');var path=require(_0x13cc('0x0'));var config=require('../config/environment');var root=config['root'];var APP_JSON_PATH=path[_0x13cc('0x1')](root,_0x13cc('0x2'));var NODEPATH=path['resolve'](root,_0x13cc('0x3'));function setLegacyLibsNodeEnvPath(_0x4ab84d){let _0x5d5c5f=![];if(Array[_0x13cc('0x4')](_0x4ab84d[_0x13cc('0x5')])){var _0x274570=_0x4ab84d['apps'][_0x13cc('0x6')](function(_0x1f91df){return _0x1f91df[_0x13cc('0x7')]===_0x13cc('0x8');});if(_0x274570>-0x1){var _0x2031e5=_0x4ab84d[_0x13cc('0x5')][_0x274570];if(typeof _0x2031e5['env'][_0x13cc('0x9')]!=='string'){_0x2031e5['env'][_0x13cc('0x9')]=NODEPATH;_0x5d5c5f=!![];}}return{'appConfig':_0x4ab84d,'updated':_0x5d5c5f};}}function updateAppConfig(_0x3bdc01){return fs[_0x13cc('0xa')](APP_JSON_PATH)[_0x13cc('0xb')](function(_0x5385a9){if(_0x5385a9){return fs['readJSON'](APP_JSON_PATH)[_0x13cc('0xb')](function(_0x4ad4b6){var _0x3d186a=setLegacyLibsNodeEnvPath(_0x4ad4b6);if(_0x3d186a['updated']){_0x3bdc01[_0x13cc('0xc')](_0x13cc('0xd'));return fs[_0x13cc('0xe')](APP_JSON_PATH,_0x4ad4b6,{'spaces':0x2});}else{return Promise[_0x13cc('0x1')]();}});}else{return Promise[_0x13cc('0x1')]();}});}module[_0x13cc('0xf')]=updateAppConfig; \ No newline at end of file +var _0xe43b=['motion2','string','env','pathExists','then','updated','info','writeJSON','../config/environment','resolve','server/app.json','legacy-libs','isArray','apps','findIndex','name'];(function(_0x5af44f,_0x24e89f){var _0x183108=function(_0x100c70){while(--_0x100c70){_0x5af44f['push'](_0x5af44f['shift']());}};_0x183108(++_0x24e89f);}(_0xe43b,0x88));var _0xbe43=function(_0x448747,_0x52303a){_0x448747=_0x448747-0x0;var _0x34b9f4=_0xe43b[_0x448747];return _0x34b9f4;};var fs=require('fs-extra');var path=require('path');var config=require(_0xbe43('0x0'));var root=config['root'];var APP_JSON_PATH=path[_0xbe43('0x1')](root,_0xbe43('0x2'));var NODEPATH=path[_0xbe43('0x1')](root,_0xbe43('0x3'));function setLegacyLibsNodeEnvPath(_0x5e123a){let _0x56d5af=![];if(Array[_0xbe43('0x4')](_0x5e123a[_0xbe43('0x5')])){var _0x2bc77c=_0x5e123a[_0xbe43('0x5')][_0xbe43('0x6')](function(_0x3763f8){return _0x3763f8[_0xbe43('0x7')]===_0xbe43('0x8');});if(_0x2bc77c>-0x1){var _0x3f80ba=_0x5e123a[_0xbe43('0x5')][_0x2bc77c];if(typeof _0x3f80ba['env']['NODE_PATH']!==_0xbe43('0x9')){_0x3f80ba[_0xbe43('0xa')]['NODE_PATH']=NODEPATH;_0x56d5af=!![];}}return{'appConfig':_0x5e123a,'updated':_0x56d5af};}}function updateAppConfig(_0x136bcb){return fs[_0xbe43('0xb')](APP_JSON_PATH)[_0xbe43('0xc')](function(_0x13fc1a){if(_0x13fc1a){return fs['readJSON'](APP_JSON_PATH)['then'](function(_0x35103a){var _0x1b6c9b=setLegacyLibsNodeEnvPath(_0x35103a);if(_0x1b6c9b[_0xbe43('0xd')]){_0x136bcb[_0xbe43('0xe')]('Updating\x20app.json');return fs[_0xbe43('0xf')](APP_JSON_PATH,_0x35103a,{'spaces':0x2});}else{return Promise[_0xbe43('0x1')]();}});}else{return Promise[_0xbe43('0x1')]();}});}module['exports']=updateAppConfig; \ No newline at end of file